From: support Date: Tue, 31 Jan 2023 11:54:08 +0000 (+0000) Subject: Built motion from commit 20b39a97.|2.6.29 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22https:/fonts.googleapis.com//%22card-image.png/%22?a=commitdiff_plain;h=7cf6d4777ede13d52459b27a1bb7fd60c53d1dd2;p=motion2.git Built motion from commit 20b39a97.|2.6.29 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c72324e..184eff1 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-31T11:22:19.552Z", + "time": "2023-01-31T11:46:28.617Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 6a378b8..c1b14bc 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-31T11:22:19.552Z", + "time": "2023-01-31T11:46:28.617Z", "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 3c608b9..c6e355c 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 _0xaecb=['STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','contactManager','integration','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x17531a,_0x4119d3){var _0x3a3050=function(_0x5ab9af){while(--_0x5ab9af){_0x17531a['push'](_0x17531a['shift']());}};_0x3a3050(++_0x4119d3);}(_0xaecb,0x16e));var _0xbaec=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaecb[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xbaec('0x0'));module[_0xbaec('0x1')]={'name':{'type':Sequelize[_0xbaec('0x2')],'get':function(_0x259bb3){return this[_0xbaec('0x3')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xbaec('0x4'),_0xbaec('0x5'),_0xbaec('0x6'),_0xbaec('0x7'),'urlForward',_0xbaec('0x8'),_0xbaec('0x9'),_0xbaec('0xa')]],'msg':_0xbaec('0xb')}},'comment':_0xbaec('0xb')},'data1':{'type':Sequelize[_0xbaec('0xc')](0x1000),'comment':_0xbaec('0xd')},'data2':{'type':Sequelize[_0xbaec('0xc')](0x1000),'comment':_0xbaec('0xe')},'data3':{'type':Sequelize[_0xbaec('0xc')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xbaec('0xc')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xbaec('0xc')],'comments':_0xbaec('0xf')},'data7':{'type':Sequelize[_0xbaec('0x10')],'comments':_0xbaec('0x11')}}; \ No newline at end of file +var _0xb3f0=['getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL'];(function(_0x347cbb,_0x5708f5){var _0x4352bd=function(_0x3638f0){while(--_0x3638f0){_0x347cbb['push'](_0x347cbb['shift']());}};_0x4352bd(++_0x5708f5);}(_0xb3f0,0x96));var _0x0b3f=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xb3f0[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require('sequelize');module[_0x0b3f('0x0')]={'name':{'type':Sequelize[_0x0b3f('0x1')],'get':function(_0x483280){return this[_0x0b3f('0x2')](_0x0b3f('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x0b3f('0x4'),_0x0b3f('0x5'),_0x0b3f('0x6'),_0x0b3f('0x7'),_0x0b3f('0x8'),_0x0b3f('0x9'),_0x0b3f('0xa'),'script']],'msg':_0x0b3f('0xb')}},'comment':_0x0b3f('0xb')},'data1':{'type':Sequelize[_0x0b3f('0xc')](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[_0x0b3f('0xc')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x0b3f('0xc')](0x1000),'comment':_0x0b3f('0xd')},'data4':{'type':Sequelize[_0x0b3f('0xc')](0x1000),'comments':_0x0b3f('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x0b3f('0xf')},'data6':{'type':Sequelize[_0x0b3f('0xc')],'comments':_0x0b3f('0x10')},'data7':{'type':Sequelize[_0x0b3f('0x11')],'comments':_0x0b3f('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index dedd514..e3fe93b 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 _0xa001=['desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','send','body','find','params','catch','Action','eml-format','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','jsforce'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa001,0x154));var _0x1a00=function(_0x435792,_0x260010){_0x435792=_0x435792-0x0;var _0x3800a0=_0xa001[_0x435792];return _0x3800a0;};'use strict';var emlformat=require(_0x1a00('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1a00('0x1'));var rp=require(_0x1a00('0x2'));var moment=require(_0x1a00('0x3'));var BPromise=require(_0x1a00('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a00('0x5'));var sox=require('sox');var csv=require(_0x1a00('0x6'));var ejs=require(_0x1a00('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a00('0x8'));var squel=require(_0x1a00('0x9'));var crypto=require('crypto');var jsforce=require(_0x1a00('0xa'));var deskjs=require(_0x1a00('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1a00('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1a00('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1a00('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1a00('0xf'));var utils=require('../../config/utils');var config=require(_0x1a00('0x10'));var licenseUtil=require(_0x1a00('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16367a,_0x4c52bb){_0x4c52bb=_0x4c52bb||0xcc;return function(_0xdbad1a){if(_0xdbad1a){return _0x16367a['sendStatus'](_0x4c52bb);}return _0x16367a[_0x1a00('0x12')](_0x4c52bb)[_0x1a00('0x13')]();};}function respondWithResult(_0x5d9c5e,_0xbd91cf){_0xbd91cf=_0xbd91cf||0xc8;return function(_0x23eed5){if(_0x23eed5){return _0x5d9c5e[_0x1a00('0x12')](_0xbd91cf)[_0x1a00('0x14')](_0x23eed5);}};}function respondWithFilteredResult(_0xa2345a,_0x46740f){return function(_0x1fa164){if(_0x1fa164){var _0x337fc3=typeof _0x46740f[_0x1a00('0x15')]===_0x1a00('0x16')&&typeof _0x46740f[_0x1a00('0x17')]===_0x1a00('0x16');var _0x39b546=_0x1fa164[_0x1a00('0x18')];var _0x31b162=_0x337fc3?0x0:_0x46740f['offset'];var _0x49f6a9=_0x337fc3?_0x1fa164['count']:_0x46740f['offset']+_0x46740f[_0x1a00('0x17')];var _0x1c6c87;if(_0x49f6a9>=_0x39b546){_0x49f6a9=_0x39b546;_0x1c6c87=0xc8;}else{_0x1c6c87=0xce;}_0xa2345a[_0x1a00('0x12')](_0x1c6c87);return _0xa2345a['set'](_0x1a00('0x19'),_0x31b162+'-'+_0x49f6a9+'/'+_0x39b546)['json'](_0x1fa164);}return null;};}function patchUpdates(_0x55e22f){return function(_0x5e32ae){try{jsonpatch[_0x1a00('0x1a')](_0x5e32ae,_0x55e22f,!![]);}catch(_0x1e77c1){return BPromise[_0x1a00('0x1b')](_0x1e77c1);}return _0x5e32ae['save']();};}function saveUpdates(_0x446d1b,_0x48ae5c){return function(_0x71eb18){if(_0x71eb18){return _0x71eb18[_0x1a00('0x1c')](_0x446d1b)[_0x1a00('0x1d')](function(_0x3f3750){return _0x3f3750;});}return null;};}function removeEntity(_0x148ede,_0x29f676){return function(_0x1ee212){if(_0x1ee212){return _0x1ee212[_0x1a00('0x1e')]()[_0x1a00('0x1d')](function(){_0x148ede['status'](0xcc)[_0x1a00('0x13')]();});}};}function handleEntityNotFound(_0x451b0d,_0x2dbc17){return function(_0x23b913){if(!_0x23b913){_0x451b0d[_0x1a00('0x1f')](0x194);}return _0x23b913;};}function handleError(_0x27015f,_0x11cdd6){_0x11cdd6=_0x11cdd6||0x1f4;return function(_0x44c274){logger['error'](_0x44c274[_0x1a00('0x20')]);if(_0x44c274['name']){delete _0x44c274['name'];}_0x27015f[_0x1a00('0x12')](_0x11cdd6)[_0x1a00('0x21')](_0x44c274);};}exports[_0x1a00('0x1c')]=function(_0x3a9f5a,_0x471a32){if(_0x3a9f5a[_0x1a00('0x22')]['id']){delete _0x3a9f5a[_0x1a00('0x22')]['id'];}return db['Action'][_0x1a00('0x23')]({'where':{'id':_0x3a9f5a[_0x1a00('0x24')]['id']}})[_0x1a00('0x1d')](handleEntityNotFound(_0x471a32,null))['then'](saveUpdates(_0x3a9f5a[_0x1a00('0x22')],null))[_0x1a00('0x1d')](respondWithResult(_0x471a32,null))[_0x1a00('0x25')](handleError(_0x471a32,null));};exports[_0x1a00('0x1e')]=function(_0x2549ed,_0x2ff32a){return db[_0x1a00('0x26')]['find']({'where':{'id':_0x2549ed[_0x1a00('0x24')]['id']}})[_0x1a00('0x1d')](handleEntityNotFound(_0x2ff32a,null))[_0x1a00('0x1d')](removeEntity(_0x2ff32a,null))['catch'](handleError(_0x2ff32a,null));}; \ No newline at end of file +var _0x2dc6=['limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','body','Action','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x12fcbd,_0x884804){var _0x28ec2a=function(_0xa5ff99){while(--_0xa5ff99){_0x12fcbd['push'](_0x12fcbd['shift']());}};_0x28ec2a(++_0x884804);}(_0x2dc6,0x179));var _0x62dc=function(_0x1d74dd,_0x119353){_0x1d74dd=_0x1d74dd-0x0;var _0x314b21=_0x2dc6[_0x1d74dd];return _0x314b21;};'use strict';var emlformat=require(_0x62dc('0x0'));var rimraf=require(_0x62dc('0x1'));var zipdir=require(_0x62dc('0x2'));var jsonpatch=require(_0x62dc('0x3'));var rp=require(_0x62dc('0x4'));var moment=require(_0x62dc('0x5'));var BPromise=require(_0x62dc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x62dc('0x7'));var sox=require(_0x62dc('0x8'));var csv=require(_0x62dc('0x9'));var ejs=require(_0x62dc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62dc('0xb'));var squel=require(_0x62dc('0xc'));var crypto=require(_0x62dc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x62dc('0xe'));var Papa=require(_0x62dc('0xf'));var Redis=require(_0x62dc('0x10'));var authService=require(_0x62dc('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x62dc('0x12'))(_0x62dc('0x13'));var utils=require(_0x62dc('0x14'));var config=require(_0x62dc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x62dc('0x16'))['db'];function respondWithStatusCode(_0x5bb4b0,_0x40f535){_0x40f535=_0x40f535||0xcc;return function(_0x259da6){if(_0x259da6){return _0x5bb4b0[_0x62dc('0x17')](_0x40f535);}return _0x5bb4b0[_0x62dc('0x18')](_0x40f535)[_0x62dc('0x19')]();};}function respondWithResult(_0x585e56,_0x1b2233){_0x1b2233=_0x1b2233||0xc8;return function(_0x3c3704){if(_0x3c3704){return _0x585e56[_0x62dc('0x18')](_0x1b2233)['json'](_0x3c3704);}};}function respondWithFilteredResult(_0x3d6ae2,_0x22d94b){return function(_0x1f1aab){if(_0x1f1aab){var _0x5e938a=typeof _0x22d94b[_0x62dc('0x1a')]===_0x62dc('0x1b')&&typeof _0x22d94b[_0x62dc('0x1c')]===_0x62dc('0x1b');var _0x5015a8=_0x1f1aab[_0x62dc('0x1d')];var _0x30a162=_0x5e938a?0x0:_0x22d94b[_0x62dc('0x1a')];var _0x2957f2=_0x5e938a?_0x1f1aab[_0x62dc('0x1d')]:_0x22d94b[_0x62dc('0x1a')]+_0x22d94b[_0x62dc('0x1c')];var _0x383e39;if(_0x2957f2>=_0x5015a8){_0x2957f2=_0x5015a8;_0x383e39=0xc8;}else{_0x383e39=0xce;}_0x3d6ae2[_0x62dc('0x18')](_0x383e39);return _0x3d6ae2[_0x62dc('0x1e')](_0x62dc('0x1f'),_0x30a162+'-'+_0x2957f2+'/'+_0x5015a8)[_0x62dc('0x20')](_0x1f1aab);}return null;};}function patchUpdates(_0x2fd060){return function(_0x7c9f5e){try{jsonpatch[_0x62dc('0x21')](_0x7c9f5e,_0x2fd060,!![]);}catch(_0x3bb19e){return BPromise[_0x62dc('0x22')](_0x3bb19e);}return _0x7c9f5e['save']();};}function saveUpdates(_0x2e1ef9,_0x26c268){return function(_0xfbd297){if(_0xfbd297){return _0xfbd297[_0x62dc('0x23')](_0x2e1ef9)[_0x62dc('0x24')](function(_0x16dbf3){return _0x16dbf3;});}return null;};}function removeEntity(_0x22081e,_0x50be5b){return function(_0x543aa2){if(_0x543aa2){return _0x543aa2[_0x62dc('0x25')]()[_0x62dc('0x24')](function(){_0x22081e[_0x62dc('0x18')](0xcc)[_0x62dc('0x19')]();});}};}function handleEntityNotFound(_0x5bcbcb,_0x257c4c){return function(_0x143d39){if(!_0x143d39){_0x5bcbcb[_0x62dc('0x17')](0x194);}return _0x143d39;};}function handleError(_0x1b44d7,_0x4cc759){_0x4cc759=_0x4cc759||0x1f4;return function(_0x2d08a7){logger[_0x62dc('0x26')](_0x2d08a7['stack']);if(_0x2d08a7[_0x62dc('0x27')]){delete _0x2d08a7[_0x62dc('0x27')];}_0x1b44d7[_0x62dc('0x18')](_0x4cc759)['send'](_0x2d08a7);};}exports[_0x62dc('0x23')]=function(_0x4efff5,_0x3d79e8){if(_0x4efff5[_0x62dc('0x28')]['id']){delete _0x4efff5[_0x62dc('0x28')]['id'];}return db[_0x62dc('0x29')][_0x62dc('0x2a')]({'where':{'id':_0x4efff5['params']['id']}})[_0x62dc('0x24')](handleEntityNotFound(_0x3d79e8,null))['then'](saveUpdates(_0x4efff5[_0x62dc('0x28')],null))['then'](respondWithResult(_0x3d79e8,null))[_0x62dc('0x2b')](handleError(_0x3d79e8,null));};exports[_0x62dc('0x25')]=function(_0x2b55f3,_0xc90d5b){return db[_0x62dc('0x29')]['find']({'where':{'id':_0x2b55f3[_0x62dc('0x2c')]['id']}})[_0x62dc('0x24')](handleEntityNotFound(_0xc90d5b,null))[_0x62dc('0x24')](removeEntity(_0xc90d5b,null))['catch'](handleError(_0xc90d5b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index b1930e9..1674387 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 _0x55c7=['request-promise','rimraf','./action.attributes','define','tools_actions','util','../../config/logger','api','moment','bluebird'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x55c7,0x127));var _0x755c=function(_0xedfc2b,_0x5a2c52){_0xedfc2b=_0xedfc2b-0x0;var _0x399263=_0x55c7[_0xedfc2b];return _0x399263;};'use strict';var _=require('lodash');var util=require(_0x755c('0x0'));var logger=require(_0x755c('0x1'))(_0x755c('0x2'));var moment=require(_0x755c('0x3'));var BPromise=require(_0x755c('0x4'));var rp=require(_0x755c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x755c('0x6'));var config=require('../../config/environment');var attributes=require(_0x755c('0x7'));module['exports']=function(_0x3d064d,_0x605e7e){return _0x3d064d[_0x755c('0x8')]('Action',attributes,{'tableName':_0x755c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc292=['../../config/environment','./action.attributes','exports','define','tools_actions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x57402a,_0x392635){var _0x578f73=function(_0x3bae3e){while(--_0x3bae3e){_0x57402a['push'](_0x57402a['shift']());}};_0x578f73(++_0x392635);}(_0xc292,0x18b));var _0x2c29=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xc292[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0x2c29('0x0'));var util=require(_0x2c29('0x1'));var logger=require(_0x2c29('0x2'))(_0x2c29('0x3'));var moment=require(_0x2c29('0x4'));var BPromise=require('bluebird');var rp=require(_0x2c29('0x5'));var fs=require('fs');var path=require(_0x2c29('0x6'));var rimraf=require(_0x2c29('0x7'));var config=require(_0x2c29('0x8'));var attributes=require(_0x2c29('0x9'));module[_0x2c29('0xa')]=function(_0x570c43,_0x213b52){return _0x570c43[_0x2c29('0xb')]('Action',attributes,{'tableName':_0x2c29('0xc'),'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 d52824a..f7454d3 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x4bc9a2,_0x1d8b6b){var _0x2c270d=function(_0x1e852d){while(--_0x1e852d){_0x4bc9a2['push'](_0x4bc9a2['shift']());}};_0x2c270d(++_0x1d8b6b);}(_0xe14b,0x93));var _0xbe14=function(_0x140101,_0x40278a){_0x140101=_0x140101-0x0;var _0xadad2f=_0xe14b[_0x140101];return _0xadad2f;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4f4e5b,_0x3b8b9b){var _0x326141=function(_0x186173){while(--_0x186173){_0x4f4e5b['push'](_0x4f4e5b['shift']());}};_0x326141(++_0x3b8b9b);}(_0x1261,0x144));var _0x1126=function(_0x2cc017,_0x25b198){_0x2cc017=_0x2cc017-0x0;var _0x509276=_0x1261[_0x2cc017];return _0x509276;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b804a40..928f140 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 _0x5291=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x55ba78,_0x456954){var _0x549b16=function(_0x47568d){while(--_0x47568d){_0x55ba78['push'](_0x55ba78['shift']());}};_0x549b16(++_0x456954);}(_0x5291,0x7d));var _0x1529=function(_0x2f70ba,_0x5449b1){_0x2f70ba=_0x2f70ba-0x0;var _0x1ea9b8=_0x5291[_0x2f70ba];return _0x1ea9b8;};'use strict';var multer=require(_0x1529('0x0'));var util=require('util');var path=require(_0x1529('0x1'));var timeout=require(_0x1529('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1529('0x3'));var auth=require(_0x1529('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1529('0x5'));var controller=require(_0x1529('0x6'));router[_0x1529('0x7')](_0x1529('0x8'),auth[_0x1529('0x9')](),controller[_0x1529('0xa')]);router[_0x1529('0xb')](_0x1529('0x8'),auth[_0x1529('0x9')](),controller[_0x1529('0xc')]);module[_0x1529('0xd')]=router; \ No newline at end of file +var _0xb61a=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','exports'];(function(_0x1c0e51,_0x2b42b8){var _0x422c25=function(_0x276431){while(--_0x276431){_0x1c0e51['push'](_0x1c0e51['shift']());}};_0x422c25(++_0x2b42b8);}(_0xb61a,0x122));var _0xab61=function(_0x7614e3,_0x294090){_0x7614e3=_0x7614e3-0x0;var _0x2fd016=_0xb61a[_0x7614e3];return _0x2fd016;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab61('0x0'));var timeout=require(_0xab61('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xab61('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xab61('0x3'));var config=require(_0xab61('0x4'));var controller=require('./action.controller');router[_0xab61('0x5')](_0xab61('0x6'),auth[_0xab61('0x7')](),controller[_0xab61('0x8')]);router['delete'](_0xab61('0x6'),auth[_0xab61('0x7')](),controller['destroy']);module[_0xab61('0x9')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 4da0786..25ac0d5 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0xdc97,0x13b));var _0x7dc9=function(_0x479eba,_0x540ac5){_0x479eba=_0x479eba-0x0;var _0x9e32a1=_0xdc97[_0x479eba];return _0x9e32a1;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file +var _0x7c09=['exports','STRING','TEXT'];(function(_0x293635,_0x273b54){var _0x153e02=function(_0x4e6361){while(--_0x4e6361){_0x293635['push'](_0x293635['shift']());}};_0x153e02(++_0x273b54);}(_0x7c09,0x102));var _0x97c0=function(_0x45407d,_0x2c79e7){_0x45407d=_0x45407d-0x0;var _0x328fad=_0x7c09[_0x45407d];return _0x328fad;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 276bc9c..f107427 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 _0xb184=['mustache','util','path','sox','to-csv','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','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','left_join','cross_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','table','metric','function','format','replace','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','right_join','SUM(%s)','MAX(%s)','ROUND(%s)','IS\x20NULL','operator','Please\x20insert\x20at\x20least\x20one\x20field','MetricId','alias','output','web','fullPath','%s-%s.%s','generate','csv','AnalyticExtractedReport','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','savename','from','countTable','COUNT(*)','run','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x4062f6,_0x5028bb){var _0x80ba05=function(_0x325511){while(--_0x325511){_0x4062f6['push'](_0x4062f6['shift']());}};_0x80ba05(++_0x5028bb);}(_0xb184,0x14e));var _0x4b18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb184[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4b18('0x0'));var rimraf=require(_0x4b18('0x1'));var zipdir=require(_0x4b18('0x2'));var jsonpatch=require(_0x4b18('0x3'));var rp=require(_0x4b18('0x4'));var moment=require('moment');var BPromise=require(_0x4b18('0x5'));var Mustache=require(_0x4b18('0x6'));var util=require(_0x4b18('0x7'));var path=require(_0x4b18('0x8'));var sox=require(_0x4b18('0x9'));var csv=require(_0x4b18('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b18('0xb'));var squel=require(_0x4b18('0xc'));var crypto=require(_0x4b18('0xd'));var jsforce=require(_0x4b18('0xe'));var deskjs=require(_0x4b18('0xf'));var toCsv=require(_0x4b18('0xa'));var querystring=require(_0x4b18('0x10'));var Papa=require(_0x4b18('0x11'));var Redis=require(_0x4b18('0x12'));var authService=require(_0x4b18('0x13'));var qs=require(_0x4b18('0x14'));var as=require(_0x4b18('0x15'));var hardwareService=require(_0x4b18('0x16'));var logger=require(_0x4b18('0x17'))(_0x4b18('0x18'));var utils=require(_0x4b18('0x19'));var config=require(_0x4b18('0x1a'));var licenseUtil=require(_0x4b18('0x1b'));var db=require(_0x4b18('0x1c'))['db'];var dbH=require(_0x4b18('0x1c'))[_0x4b18('0x1d')];function respondWithStatusCode(_0x1dae47,_0x57e08a){_0x57e08a=_0x57e08a||0xcc;return function(_0xe965b6){if(_0xe965b6){return _0x1dae47['sendStatus'](_0x57e08a);}return _0x1dae47[_0x4b18('0x1e')](_0x57e08a)[_0x4b18('0x1f')]();};}function respondWithResult(_0x30bd75,_0x73fa5f){_0x73fa5f=_0x73fa5f||0xc8;return function(_0x13f634){if(_0x13f634){return _0x30bd75[_0x4b18('0x1e')](_0x73fa5f)['json'](_0x13f634);}};}function respondWithFilteredResult(_0x16a2b5,_0x3432e0){return function(_0x2cee09){if(_0x2cee09){var _0x4f6f8a=typeof _0x3432e0[_0x4b18('0x20')]===_0x4b18('0x21')&&typeof _0x3432e0[_0x4b18('0x22')]===_0x4b18('0x21');var _0x244879=_0x2cee09['count'];var _0x9a5271=_0x4f6f8a?0x0:_0x3432e0[_0x4b18('0x20')];var _0x13e825=_0x4f6f8a?_0x2cee09[_0x4b18('0x23')]:_0x3432e0[_0x4b18('0x20')]+_0x3432e0[_0x4b18('0x22')];var _0x4b5555;if(_0x13e825>=_0x244879){_0x13e825=_0x244879;_0x4b5555=0xc8;}else{_0x4b5555=0xce;}_0x16a2b5[_0x4b18('0x1e')](_0x4b5555);return _0x16a2b5[_0x4b18('0x24')](_0x4b18('0x25'),_0x9a5271+'-'+_0x13e825+'/'+_0x244879)[_0x4b18('0x26')](_0x2cee09);}return null;};}function patchUpdates(_0x317115){return function(_0x17111a){try{jsonpatch[_0x4b18('0x27')](_0x17111a,_0x317115,!![]);}catch(_0x4a8ad9){return BPromise['reject'](_0x4a8ad9);}return _0x17111a[_0x4b18('0x28')]();};}function saveUpdates(_0x65bf49,_0x4c3f43){return function(_0x61d828){if(_0x61d828){return _0x61d828[_0x4b18('0x29')](_0x65bf49)[_0x4b18('0x2a')](function(_0x1b14d2){return _0x1b14d2;});}return null;};}function removeEntity(_0x1f33fd,_0x5cccf0){return function(_0x3fb4fa){if(_0x3fb4fa){return _0x3fb4fa[_0x4b18('0x2b')]()[_0x4b18('0x2a')](function(){var _0x2c384e=_0x3fb4fa[_0x4b18('0x2c')]({'plain':!![]});var _0x101349='CustomReports';return db[_0x4b18('0x2d')]['destroy']({'where':{'type':_0x101349,'resourceId':_0x2c384e['id']}})['then'](function(){return _0x3fb4fa;});})[_0x4b18('0x2a')](function(){_0x1f33fd[_0x4b18('0x1e')](0xcc)[_0x4b18('0x1f')]();});}};}function handleEntityNotFound(_0x5f109c,_0x481e55){return function(_0x4a0030){if(!_0x4a0030){_0x5f109c[_0x4b18('0x2e')](0x194);}return _0x4a0030;};}function handleError(_0x3046a6,_0x26d53e){_0x26d53e=_0x26d53e||0x1f4;return function(_0x3b0cda){logger[_0x4b18('0x2f')](_0x3b0cda['stack']);if(_0x3b0cda['name']){delete _0x3b0cda[_0x4b18('0x30')];}_0x3046a6[_0x4b18('0x1e')](_0x26d53e)[_0x4b18('0x31')](_0x3b0cda);};}exports[_0x4b18('0x32')]=function(_0x8d865,_0x4b1fec){var _0x17d50a={},_0x2ef589={},_0x170c79={'count':0x0,'rows':[]};var _0x705bab=_[_0x4b18('0x33')](db[_0x4b18('0x34')][_0x4b18('0x35')],function(_0x25e017){return{'name':_0x25e017[_0x4b18('0x36')],'type':_0x25e017[_0x4b18('0x37')]['key']};});_0x2ef589[_0x4b18('0x38')]=_[_0x4b18('0x33')](_0x705bab,'name');_0x2ef589[_0x4b18('0x39')]=_[_0x4b18('0x3a')](_0x8d865[_0x4b18('0x39')]);_0x2ef589['filters']=_[_0x4b18('0x3b')](_0x2ef589[_0x4b18('0x38')],_0x2ef589[_0x4b18('0x39')]);_0x17d50a[_0x4b18('0x3c')]=_[_0x4b18('0x3b')](_0x2ef589['model'],qs[_0x4b18('0x3d')](_0x8d865['query'][_0x4b18('0x3d')]));_0x17d50a[_0x4b18('0x3c')]=_0x17d50a['attributes']['length']?_0x17d50a['attributes']:_0x2ef589[_0x4b18('0x38')];if(!_0x8d865[_0x4b18('0x39')][_0x4b18('0x3e')](_0x4b18('0x3f'))){_0x17d50a[_0x4b18('0x22')]=qs[_0x4b18('0x22')](_0x8d865[_0x4b18('0x39')][_0x4b18('0x22')]);_0x17d50a[_0x4b18('0x20')]=qs[_0x4b18('0x20')](_0x8d865[_0x4b18('0x39')][_0x4b18('0x20')]);}_0x17d50a[_0x4b18('0x40')]=qs[_0x4b18('0x41')](_0x8d865['query'][_0x4b18('0x41')]);_0x17d50a[_0x4b18('0x42')]=qs[_0x4b18('0x43')](_[_0x4b18('0x44')](_0x8d865[_0x4b18('0x39')],_0x2ef589[_0x4b18('0x43')]),_0x705bab);if(_0x8d865['query'][_0x4b18('0x45')]){_0x17d50a['where']=_[_0x4b18('0x46')](_0x17d50a[_0x4b18('0x42')],{'$or':_['map'](_0x705bab,function(_0x9d69d){if(_0x9d69d[_0x4b18('0x37')]!==_0x4b18('0x47')){var _0x31e594={};_0x31e594[_0x9d69d[_0x4b18('0x30')]]={'$like':'%'+_0x8d865['query'][_0x4b18('0x45')]+'%'};return _0x31e594;}})});}_0x17d50a=_[_0x4b18('0x46')]({},_0x17d50a,_0x8d865[_0x4b18('0x48')]);var _0x4619c5={'where':_0x17d50a[_0x4b18('0x42')]};return db['AnalyticCustomReport']['count'](_0x4619c5)['then'](function(_0x39ba75){_0x170c79[_0x4b18('0x23')]=_0x39ba75;if(_0x8d865[_0x4b18('0x39')]['includeAll']){_0x17d50a['include']=[{'all':!![]}];}return db[_0x4b18('0x34')][_0x4b18('0x49')](_0x17d50a);})[_0x4b18('0x2a')](function(_0x3901b9){_0x170c79[_0x4b18('0x4a')]=_0x3901b9;return _0x170c79;})['then'](respondWithFilteredResult(_0x4b1fec,_0x17d50a))[_0x4b18('0x4b')](handleError(_0x4b1fec,null));};exports[_0x4b18('0x4c')]=function(_0x9f0717,_0xd8908b){var _0x403311={'raw':![],'where':{'id':_0x9f0717['params']['id']}},_0x15dbb9={};_0x15dbb9['model']=_['keys'](db[_0x4b18('0x34')][_0x4b18('0x35')]);_0x15dbb9[_0x4b18('0x39')]=_[_0x4b18('0x3a')](_0x9f0717['query']);_0x15dbb9[_0x4b18('0x43')]=_[_0x4b18('0x3b')](_0x15dbb9[_0x4b18('0x38')],_0x15dbb9[_0x4b18('0x39')]);_0x403311['attributes']=_[_0x4b18('0x3b')](_0x15dbb9[_0x4b18('0x38')],qs[_0x4b18('0x3d')](_0x9f0717['query'][_0x4b18('0x3d')]));_0x403311[_0x4b18('0x3c')]=_0x403311['attributes']['length']?_0x403311['attributes']:_0x15dbb9['model'];if(_0x9f0717[_0x4b18('0x39')][_0x4b18('0x4d')]){_0x403311[_0x4b18('0x4e')]=[{'all':!![]}];}_0x403311=_['merge']({},_0x403311,_0x9f0717[_0x4b18('0x48')]);return db[_0x4b18('0x34')][_0x4b18('0x4f')](_0x403311)[_0x4b18('0x2a')](handleEntityNotFound(_0xd8908b,null))[_0x4b18('0x2a')](respondWithResult(_0xd8908b,null))[_0x4b18('0x4b')](handleError(_0xd8908b,null));};exports[_0x4b18('0x50')]=function(_0xd901f0,_0x261d7e){return db[_0x4b18('0x34')]['create'](_0xd901f0[_0x4b18('0x51')],{})[_0x4b18('0x2a')](function(_0x49dfe7){var _0x57c24b=_0xd901f0['user'][_0x4b18('0x2c')]({'plain':!![]});if(!_0x57c24b)throw new Error(_0x4b18('0x52'));if(_0x57c24b['role']===_0x4b18('0x53')){var _0x38df95=_0x49dfe7['get']({'plain':!![]});var _0x29313e='Reports';return db[_0x4b18('0x54')][_0x4b18('0x4f')]({'where':{'name':_0x29313e,'userProfileId':_0x57c24b[_0x4b18('0x55')]},'raw':!![]})['then'](function(_0x22ece7){if(_0x22ece7&&_0x22ece7[_0x4b18('0x56')]===0x0){return db['UserProfileResource'][_0x4b18('0x50')]({'name':_0x38df95[_0x4b18('0x30')],'resourceId':_0x38df95['id'],'type':_0x4b18('0x57'),'sectionId':_0x22ece7['id']},{})['then'](function(){return _0x49dfe7;});}else{return _0x49dfe7;}})['catch'](function(_0x36741c){logger['error'](_0x4b18('0x58'),_0x36741c);throw _0x36741c;});}return _0x49dfe7;})[_0x4b18('0x2a')](respondWithResult(_0x261d7e,0xc9))[_0x4b18('0x4b')](handleError(_0x261d7e,null));};exports[_0x4b18('0x29')]=function(_0x269e05,_0x187e9c){if(_0x269e05[_0x4b18('0x51')]['id']){delete _0x269e05[_0x4b18('0x51')]['id'];}return db['AnalyticCustomReport'][_0x4b18('0x4f')]({'where':{'id':_0x269e05[_0x4b18('0x59')]['id']}})['then'](handleEntityNotFound(_0x187e9c,null))[_0x4b18('0x2a')](saveUpdates(_0x269e05[_0x4b18('0x51')],null))['then'](respondWithResult(_0x187e9c,null))[_0x4b18('0x4b')](handleError(_0x187e9c,null));};exports['destroy']=function(_0x4405df,_0x46d7be){return db['AnalyticCustomReport'][_0x4b18('0x4f')]({'where':{'id':_0x4405df[_0x4b18('0x59')]['id']}})['then'](handleEntityNotFound(_0x46d7be,null))[_0x4b18('0x2a')](removeEntity(_0x46d7be,null))[_0x4b18('0x4b')](handleError(_0x46d7be,null));};exports[_0x4b18('0x5a')]=function(_0xe96bff,_0x1dd4d4){var _0x39fee8=0xa;var _0x15bf11=['join',_0x4b18('0x5b'),'right_join',_0x4b18('0x5c')];var _0x2c9c5f={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4b18('0x5d'),'MAX':'MAX(%s)','MIN':_0x4b18('0x5e'),'AVG':_0x4b18('0x5f'),'GROUP_CONCAT':_0x4b18('0x60'),'GROUP_CONCAT ASC':_0x4b18('0x61'),'GROUP_CONCAT DESC':_0x4b18('0x62')};var _0x22b216={'SEC_TO_TIME':_0x4b18('0x63'),'DATE':_0x4b18('0x64'),'HOUR':_0x4b18('0x65'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4b18('0x66')};var _0x48c0b5=function(_0x5eb7db){return!_[_0x4b18('0x67')](['IS\x20NULL',_0x4b18('0x68'),_0x4b18('0x69'),_0x4b18('0x6a')],_0x5eb7db);};var _0x4e27a0=function(_0x5a1342){if(!_0x5a1342||!_0x5a1342[_0x4b18('0x6b')][_0x4b18('0x6c')]){return'';}for(var _0x1e0df0='(',_0x20c5bc=0x0;_0x20c5bc<_0x5a1342['rules']['length'];_0x20c5bc+=0x1){_0x20c5bc>0x0&&(_0x1e0df0+='\x20'+_0x5a1342['operator']+'\x20');_0x1e0df0+=_0x5a1342[_0x4b18('0x6b')][_0x20c5bc][_0x4b18('0x6d')]?_0x4e27a0(_0x5a1342[_0x4b18('0x6b')][_0x20c5bc][_0x4b18('0x6d')]):_0x5a1342['rules'][_0x20c5bc][_0x4b18('0x6e')]+'\x20'+_0x5a1342['rules'][_0x20c5bc][_0x4b18('0x6f')]+(_0x48c0b5(_0x5a1342['rules'][_0x20c5bc][_0x4b18('0x6f')])?'\x20'+_0x5a1342[_0x4b18('0x6b')][_0x20c5bc][_0x4b18('0x70')]:'');}return _0x1e0df0+')';};var _0x17f3dc={'where':{'id':_0xe96bff[_0x4b18('0x59')]['id']}},_0x342a55,_0x4dfa49,_0x138367,_0x232e77,_0x2a6645;_0x17f3dc=_[_0x4b18('0x46')]({},_0x17f3dc,_0xe96bff['options']);return db[_0x4b18('0x34')][_0x4b18('0x4f')](_0x17f3dc)[_0x4b18('0x2a')](function(_0x51fc74){if(_0x51fc74){_0x342a55=_0x51fc74;return _0x51fc74[_0x4b18('0x71')]();}return null;})[_0x4b18('0x2a')](function(_0x42c058){if(_0x42c058){if(!_0x42c058[_0x4b18('0x6c')]){throw new db[(_0x4b18('0x72'))][(_0x4b18('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4dfa49=_0x42c058;return db[_0x4b18('0x74')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1bb456){if(_0x1bb456){_0x138367=_[_0x4b18('0x75')](_0x1bb456,'id');var _0x1399f3;var _0x4ccb50=squel[_0x4b18('0x76')]();_0x4ccb50['from'](_0x342a55[_0x4b18('0x77')]);for(var _0x56f1e8=0x0;_0x56f1e8<_0x4dfa49['length'];_0x56f1e8+=0x1){_0x1399f3=_0x4dfa49[_0x56f1e8]['MetricId']?_0x138367[_0x4dfa49[_0x56f1e8]['MetricId']][_0x4b18('0x78')]:_0x4dfa49[_0x56f1e8][_0x4b18('0x6e')];_0x1399f3=_0x4dfa49[_0x56f1e8][_0x4b18('0x79')]?_['replace'](_0x2c9c5f[_0x4dfa49[_0x56f1e8]['function']],'%s',_0x1399f3):_0x1399f3;_0x1399f3=_0x4dfa49[_0x56f1e8][_0x4b18('0x7a')]?_[_0x4b18('0x7b')](_0x22b216[_0x4dfa49[_0x56f1e8][_0x4b18('0x7a')]],'%s',_0x1399f3):_0x1399f3;if(_0x4dfa49[_0x56f1e8][_0x4b18('0x7c')]){_0x4ccb50[_0x4b18('0x6d')](_0x1399f3);}_0x4dfa49[_0x56f1e8][_0x4b18('0x7d')]&&_0x4ccb50[_0x4b18('0x40')](_0x1399f3,_0x4dfa49[_0x56f1e8][_0x4b18('0x7d')]===_0x4b18('0x7e')?![]:!![]);_0x4ccb50[_0x4b18('0x6e')](_0x1399f3,_0x4dfa49[_0x56f1e8]['alias']||_0x1399f3);}if(_0x342a55[_0x4b18('0x7f')]){_0x342a55[_0x4b18('0x7f')]=JSON[_0x4b18('0x80')](_0x342a55[_0x4b18('0x7f')]);for(var _0x550f80=0x0;_0x550f80<_0x342a55[_0x4b18('0x7f')][_0x4b18('0x6c')];_0x550f80+=0x1){if(_0x342a55['joins'][_0x550f80][_0x4b18('0x37')]&&_[_0x4b18('0x67')](_0x15bf11,_0x342a55[_0x4b18('0x7f')][_0x550f80][_0x4b18('0x37')])&&_0x342a55['joins'][_0x550f80][_0x4b18('0x81')]&&_0x342a55[_0x4b18('0x7f')][_0x550f80][_0x4b18('0x82')]&&_0x342a55[_0x4b18('0x7f')][_0x550f80][_0x4b18('0x83')]){_0x4ccb50[_0x342a55[_0x4b18('0x7f')][_0x550f80][_0x4b18('0x37')]](_0x342a55['joins'][_0x550f80][_0x4b18('0x82')],null,util[_0x4b18('0x7a')](_0x4b18('0x84'),_0x342a55['table'],_0x342a55[_0x4b18('0x7f')][_0x550f80][_0x4b18('0x81')],_0x342a55['joins'][_0x550f80][_0x4b18('0x82')],_0x342a55[_0x4b18('0x7f')][_0x550f80][_0x4b18('0x83')]));}}}if(_0x342a55['conditions']){_0x342a55['conditions']=JSON[_0x4b18('0x80')](_0x342a55[_0x4b18('0x85')]);_0x4ccb50[_0x4b18('0x42')](_0x4e27a0(_0x342a55[_0x4b18('0x85')]['group']));}_0x2a6645=_0x4ccb50[_0x4b18('0x86')]();_0x4ccb50[_0x4b18('0x22')](_0x39fee8);_0x4ccb50[_0x4b18('0x20')](0x0);logger['debug'](_0x4b18('0x87'),_0x4ccb50[_0x4b18('0x88')]());return dbH['sequelize'][_0x4b18('0x39')](_0x4ccb50['toString'](),{'type':dbH[_0x4b18('0x89')][_0x4b18('0x8a')][_0x4b18('0x8b')]});}})[_0x4b18('0x2a')](respondWithResult(_0x1dd4d4,null))[_0x4b18('0x4b')](handleError(_0x1dd4d4,null));};function runReport(_0x55a9b9,_0x47a8cb,_0x2a4cf0){var _0x401cea=_0x47a8cb[_0x4b18('0x30')];var _0x37fa98=0xa;var _0x5e41ff=[_0x4b18('0x8c'),_0x4b18('0x5b'),_0x4b18('0x8d'),_0x4b18('0x5c')];var _0x307700={'SUM':_0x4b18('0x8e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4b18('0x5d'),'MAX':_0x4b18('0x8f'),'MIN':'MIN(%s)','AVG':_0x4b18('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4b18('0x61'),'GROUP_CONCAT DESC':_0x4b18('0x62')};var _0x11b2db={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4b18('0x64'),'HOUR':'HOUR(%s)','ROUND':_0x4b18('0x90'),'UNIX_TIMESTAMP':_0x4b18('0x66')};var _0x21d1f2=function(_0x42fd11){return!_[_0x4b18('0x67')]([_0x4b18('0x91'),'IS\x20NOT\x20NULL',_0x4b18('0x69'),_0x4b18('0x6a')],_0x42fd11);};var _0x378baf=function(_0x41b7fc){if(!_0x41b7fc||!_0x41b7fc['rules'][_0x4b18('0x6c')]){return'';}for(var _0x59349e='(',_0xc518b7=0x0;_0xc518b7<_0x41b7fc[_0x4b18('0x6b')][_0x4b18('0x6c')];_0xc518b7+=0x1){_0xc518b7>0x0&&(_0x59349e+='\x20'+_0x41b7fc[_0x4b18('0x92')]+'\x20');_0x59349e+=_0x41b7fc[_0x4b18('0x6b')][_0xc518b7][_0x4b18('0x6d')]?_0x378baf(_0x41b7fc[_0x4b18('0x6b')][_0xc518b7][_0x4b18('0x6d')]):_0x41b7fc['rules'][_0xc518b7][_0x4b18('0x6e')]+'\x20'+_0x41b7fc[_0x4b18('0x6b')][_0xc518b7][_0x4b18('0x6f')]+(_0x21d1f2(_0x41b7fc['rules'][_0xc518b7][_0x4b18('0x6f')])?'\x20'+_0x41b7fc[_0x4b18('0x6b')][_0xc518b7][_0x4b18('0x70')]:'');}return _0x59349e+')';};var _0x3c1f42={'where':{'id':_0x55a9b9['id']}},_0xd4bc54,_0x441187,_0x50809a,_0x4c51a6,_0xfbd114;_0x3c1f42=_[_0x4b18('0x46')]({},_0x3c1f42,_0x2a4cf0);return db['AnalyticCustomReport'][_0x4b18('0x4f')](_0x3c1f42)[_0x4b18('0x2a')](function(_0x24a575){if(_0x24a575){_0xd4bc54=_0x24a575;return _0x24a575[_0x4b18('0x71')]();}return null;})[_0x4b18('0x2a')](function(_0x1adb9b){if(_0x1adb9b){if(!_0x1adb9b[_0x4b18('0x6c')]){throw new db[(_0x4b18('0x72'))]['ValidationErrorItem'](_0x4b18('0x93'),0x193);}_0x441187=_0x1adb9b;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x337539){if(_0x337539){_0x50809a=_['keyBy'](_0x337539,'id');var _0x1fe6f3;var _0x54f57b=squel[_0x4b18('0x76')]();_0x54f57b['from'](_0xd4bc54[_0x4b18('0x77')]);for(var _0x4d3fed=0x0;_0x4d3fed<_0x441187[_0x4b18('0x6c')];_0x4d3fed+=0x1){_0x1fe6f3=_0x441187[_0x4d3fed][_0x4b18('0x94')]?_0x50809a[_0x441187[_0x4d3fed][_0x4b18('0x94')]][_0x4b18('0x78')]:_0x441187[_0x4d3fed][_0x4b18('0x6e')];_0x1fe6f3=_0x441187[_0x4d3fed][_0x4b18('0x79')]?_[_0x4b18('0x7b')](_0x307700[_0x441187[_0x4d3fed][_0x4b18('0x79')]],'%s',_0x1fe6f3):_0x1fe6f3;_0x1fe6f3=_0x441187[_0x4d3fed][_0x4b18('0x7a')]?_[_0x4b18('0x7b')](_0x11b2db[_0x441187[_0x4d3fed][_0x4b18('0x7a')]],'%s',_0x1fe6f3):_0x1fe6f3;if(_0x441187[_0x4d3fed]['groupBy']){_0x54f57b['group'](_0x1fe6f3);}_0x441187[_0x4d3fed]['orderBy']&&_0x54f57b[_0x4b18('0x40')](_0x1fe6f3,_0x441187[_0x4d3fed]['orderBy']===_0x4b18('0x7e')?![]:!![]);_0x54f57b[_0x4b18('0x6e')](_0x1fe6f3,_0x441187[_0x4d3fed][_0x4b18('0x95')]||_0x1fe6f3);}if(_0xd4bc54[_0x4b18('0x7f')]){_0xd4bc54[_0x4b18('0x7f')]=JSON[_0x4b18('0x80')](_0xd4bc54[_0x4b18('0x7f')]);for(var _0x4719af=0x0;_0x4719af<_0xd4bc54[_0x4b18('0x7f')][_0x4b18('0x6c')];_0x4719af+=0x1){if(_0xd4bc54['joins'][_0x4719af][_0x4b18('0x37')]&&_[_0x4b18('0x67')](_0x5e41ff,_0xd4bc54['joins'][_0x4719af]['type'])&&_0xd4bc54[_0x4b18('0x7f')][_0x4719af][_0x4b18('0x81')]&&_0xd4bc54[_0x4b18('0x7f')][_0x4719af][_0x4b18('0x82')]&&_0xd4bc54[_0x4b18('0x7f')][_0x4719af][_0x4b18('0x83')]){_0x54f57b[_0xd4bc54['joins'][_0x4719af][_0x4b18('0x37')]](_0xd4bc54['joins'][_0x4719af][_0x4b18('0x82')],null,util[_0x4b18('0x7a')]('%s.%s\x20=\x20%s.%s',_0xd4bc54[_0x4b18('0x77')],_0xd4bc54['joins'][_0x4719af][_0x4b18('0x81')],_0xd4bc54[_0x4b18('0x7f')][_0x4719af][_0x4b18('0x82')],_0xd4bc54[_0x4b18('0x7f')][_0x4719af][_0x4b18('0x83')]));}}}if(_0xd4bc54[_0x4b18('0x85')]){_0xd4bc54[_0x4b18('0x85')]=JSON[_0x4b18('0x80')](_0xd4bc54[_0x4b18('0x85')]);_0x54f57b[_0x4b18('0x42')](_0x378baf(_0xd4bc54[_0x4b18('0x85')][_0x4b18('0x6d')]));}_0xfbd114=_0x54f57b[_0x4b18('0x86')]();_0x54f57b[_0x4b18('0x22')](_0x37fa98);_0x54f57b['offset'](0x0);return;}})[_0x4b18('0x2a')](function(){if(_0x47a8cb[_0x4b18('0x96')]===_0x4b18('0x97')){return null;}var _0x3b0923=_[_0x4b18('0x46')](_0x47a8cb,{'name':_0x47a8cb[_0x4b18('0x98')]||_0x47a8cb[_0x4b18('0x30')]||_0xd4bc54[_0x4b18('0x30')],'basename':_0x401cea,'savename':util[_0x4b18('0x7a')](_0x4b18('0x99'),_0x47a8cb[_0x4b18('0x30')]||_0xd4bc54['name'],require('randomstring')[_0x4b18('0x9a')](0x4),_0x47a8cb[_0x4b18('0x96')]||_0x4b18('0x9b')),'reportId':_0xd4bc54['id'],'reportType':'custom'});return db[_0x4b18('0x9c')][_0x4b18('0x50')](_0x3b0923,{'raw':!![]});})[_0x4b18('0x2a')](function(_0xb072eb){if(_0xd4bc54[_0x4b18('0x77')]==='cdr'){_0xfbd114[_0x4b18('0x42')](_0xd4bc54[_0x4b18('0x77')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x47a8cb[_0x4b18('0x9d')],_0x47a8cb['endDate']);}else{_0xfbd114[_0x4b18('0x42')](_0xd4bc54[_0x4b18('0x77')]+_0x4b18('0x9e'),_0x47a8cb['startDate'],_0x47a8cb[_0x4b18('0x9f')]);}if(_0xb072eb){logger['info'](_0x4b18('0xa0'),_0xfbd114[_0x4b18('0x88')]());require(_0x4b18('0xa1'))[_0x4b18('0xa2')](path[_0x4b18('0x8c')](__dirname,_0x4b18('0xa3'),_0xb072eb[_0x4b18('0x96')]),[_0xb072eb['id'],_0xfbd114['toString'](),path[_0x4b18('0x8c')](__dirname,'../../files/reports',_0xb072eb[_0x4b18('0xa4')]),_0x401cea]);return _0xb072eb;}else{var _0x28279c=squel[_0x4b18('0x76')]();_0x28279c[_0x4b18('0xa5')]('('+_0xfbd114[_0x4b18('0x88')]()+')',_0x4b18('0xa6'));_0x28279c['field'](_0x4b18('0xa7'),'count');_0xfbd114[_0x4b18('0x22')](_0x47a8cb[_0x4b18('0x22')]||_0x37fa98);_0xfbd114['offset'](_0x47a8cb['offset']||0x0);return dbH[_0x4b18('0x89')][_0x4b18('0x39')](_0x28279c[_0x4b18('0x88')](),{'type':dbH[_0x4b18('0x89')][_0x4b18('0x8a')][_0x4b18('0x8b')]})[_0x4b18('0x2a')](function(_0x3366a9){if(!_0x3366a9[_0x4b18('0x6c')]){_0x4c51a6=0x0;}else{_0x4c51a6=_0x3366a9[0x0][_0x4b18('0x23')]||0x0;}return dbH[_0x4b18('0x89')][_0x4b18('0x39')](_0xfbd114['toString'](),{'type':dbH[_0x4b18('0x89')][_0x4b18('0x8a')][_0x4b18('0x8b')]});})['then'](function(_0x30e4b6){return{'rows':_0x30e4b6||[],'count':_0x4c51a6};});}});}exports[_0x4b18('0xa8')]=function(_0x1bfb6c,_0x3b7da0){return runReport(_0x1bfb6c[_0x4b18('0x59')],_0x1bfb6c[_0x4b18('0x39')],_0x1bfb6c['options'])['then'](respondWithResult(_0x3b7da0,null))[_0x4b18('0x4b')](handleError(_0x3b7da0,null));};exports['runReport']=runReport;exports[_0x4b18('0x39')]=function(_0x31b041,_0x22b71d){var _0x59b035=0xa;var _0x36e01b=[_0x4b18('0x8c'),'left_join',_0x4b18('0x8d'),_0x4b18('0x5c')];var _0x25c04b={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4b18('0x5d'),'MAX':_0x4b18('0x8f'),'MIN':_0x4b18('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4b18('0x60'),'GROUP_CONCAT ASC':_0x4b18('0x61'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4042b0={'SEC_TO_TIME':_0x4b18('0x63'),'DATE':_0x4b18('0x64'),'HOUR':_0x4b18('0x65'),'ROUND':_0x4b18('0x90'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1cedf2=function(_0x31ef92){return!_[_0x4b18('0x67')]([_0x4b18('0x91'),_0x4b18('0x68'),_0x4b18('0x69'),_0x4b18('0x6a')],_0x31ef92);};var _0x251945=function(_0x1a3247){if(!_0x1a3247||!_0x1a3247[_0x4b18('0x6b')][_0x4b18('0x6c')]){return'';}for(var _0x2fa3f8='(',_0x13938b=0x0;_0x13938b<_0x1a3247[_0x4b18('0x6b')][_0x4b18('0x6c')];_0x13938b+=0x1){_0x13938b>0x0&&(_0x2fa3f8+='\x20'+_0x1a3247[_0x4b18('0x92')]+'\x20');_0x2fa3f8+=_0x1a3247[_0x4b18('0x6b')][_0x13938b]['group']?_0x251945(_0x1a3247[_0x4b18('0x6b')][_0x13938b][_0x4b18('0x6d')]):_0x1a3247[_0x4b18('0x6b')][_0x13938b]['field']+'\x20'+_0x1a3247['rules'][_0x13938b][_0x4b18('0x6f')]+(_0x1cedf2(_0x1a3247[_0x4b18('0x6b')][_0x13938b][_0x4b18('0x6f')])?'\x20'+_0x1a3247[_0x4b18('0x6b')][_0x13938b][_0x4b18('0x70')]:'');}return _0x2fa3f8+')';};var _0x3e1219={'where':{'id':_0x31b041['params']['id']}},_0x2309fc,_0x39a1ca,_0x29552a,_0x522b55,_0x4eaf6e;_0x3e1219=_[_0x4b18('0x46')]({},_0x3e1219,_0x31b041[_0x4b18('0x48')]);return db[_0x4b18('0x34')][_0x4b18('0x4f')](_0x3e1219)[_0x4b18('0x2a')](function(_0xa46b0e){if(_0xa46b0e){_0x2309fc=_0xa46b0e;return _0xa46b0e[_0x4b18('0x71')]();}return null;})[_0x4b18('0x2a')](function(_0x1171c6){if(_0x1171c6){if(!_0x1171c6[_0x4b18('0x6c')]){throw new db['Sequelize'][(_0x4b18('0x73'))](_0x4b18('0x93'),0x193);}_0x39a1ca=_0x1171c6;return db['AnalyticMetric'][_0x4b18('0x49')]({'raw':!![]});}return null;})[_0x4b18('0x2a')](function(_0x1004b0){if(_0x1004b0){_0x29552a=_['keyBy'](_0x1004b0,'id');var _0x18c39a;var _0x534928=squel[_0x4b18('0x76')]();_0x534928['from'](_0x2309fc[_0x4b18('0x77')]);for(var _0x5d7a80=0x0;_0x5d7a80<_0x39a1ca[_0x4b18('0x6c')];_0x5d7a80+=0x1){_0x18c39a=_0x39a1ca[_0x5d7a80][_0x4b18('0x94')]?_0x29552a[_0x39a1ca[_0x5d7a80][_0x4b18('0x94')]][_0x4b18('0x78')]:_0x39a1ca[_0x5d7a80]['field'];_0x18c39a=_0x39a1ca[_0x5d7a80][_0x4b18('0x79')]?_[_0x4b18('0x7b')](_0x25c04b[_0x39a1ca[_0x5d7a80][_0x4b18('0x79')]],'%s',_0x18c39a):_0x18c39a;_0x18c39a=_0x39a1ca[_0x5d7a80][_0x4b18('0x7a')]?_[_0x4b18('0x7b')](_0x4042b0[_0x39a1ca[_0x5d7a80][_0x4b18('0x7a')]],'%s',_0x18c39a):_0x18c39a;if(_0x39a1ca[_0x5d7a80]['groupBy']){_0x534928[_0x4b18('0x6d')](_0x18c39a);}_0x39a1ca[_0x5d7a80]['orderBy']&&_0x534928[_0x4b18('0x40')](_0x18c39a,_0x39a1ca[_0x5d7a80][_0x4b18('0x7d')]===_0x4b18('0x7e')?![]:!![]);_0x534928['field'](_0x18c39a,_0x39a1ca[_0x5d7a80][_0x4b18('0x95')]||_0x18c39a);}if(_0x2309fc[_0x4b18('0x7f')]){_0x2309fc[_0x4b18('0x7f')]=JSON['parse'](_0x2309fc[_0x4b18('0x7f')]);for(var _0x23b5f4=0x0;_0x23b5f4<_0x2309fc[_0x4b18('0x7f')][_0x4b18('0x6c')];_0x23b5f4+=0x1){if(_0x2309fc[_0x4b18('0x7f')][_0x23b5f4][_0x4b18('0x37')]&&_[_0x4b18('0x67')](_0x36e01b,_0x2309fc[_0x4b18('0x7f')][_0x23b5f4][_0x4b18('0x37')])&&_0x2309fc[_0x4b18('0x7f')][_0x23b5f4][_0x4b18('0x81')]&&_0x2309fc['joins'][_0x23b5f4][_0x4b18('0x82')]&&_0x2309fc[_0x4b18('0x7f')][_0x23b5f4]['foreignKey']){_0x534928[_0x2309fc[_0x4b18('0x7f')][_0x23b5f4][_0x4b18('0x37')]](_0x2309fc[_0x4b18('0x7f')][_0x23b5f4][_0x4b18('0x82')],null,util['format'](_0x4b18('0x84'),_0x2309fc['table'],_0x2309fc[_0x4b18('0x7f')][_0x23b5f4][_0x4b18('0x81')],_0x2309fc[_0x4b18('0x7f')][_0x23b5f4][_0x4b18('0x82')],_0x2309fc['joins'][_0x23b5f4][_0x4b18('0x83')]));}}}if(_0x2309fc[_0x4b18('0x85')]){_0x2309fc['conditions']=JSON[_0x4b18('0x80')](_0x2309fc['conditions']);_0x534928[_0x4b18('0x42')](_0x251945(_0x2309fc[_0x4b18('0x85')][_0x4b18('0x6d')]));}_0x4eaf6e=_0x534928[_0x4b18('0x86')]();_0x534928[_0x4b18('0x22')](_0x59b035);_0x534928['offset'](0x0);logger[_0x4b18('0xa9')]('Limited\x20Query:',_0x534928[_0x4b18('0x88')]());return dbH[_0x4b18('0x89')][_0x4b18('0x39')](_0x534928[_0x4b18('0x88')](),{'type':dbH['sequelize'][_0x4b18('0x8a')][_0x4b18('0x8b')]});}})[_0x4b18('0x2a')](function(){return{'sql':_0x4eaf6e[_0x4b18('0x88')]()};})[_0x4b18('0x2a')](respondWithResult(_0x22b71d,null))[_0x4b18('0x4b')](handleError(_0x22b71d,null));}; \ No newline at end of file +var _0xfc6b=['cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','Please\x20insert\x20at\x20least\x20one\x20field','replace','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','info','fork','../../components/export/','savename','countTable','COUNT(*)','SELECT','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','AnalyticCustomReport','findAll','rows','catch','params','intersection','includeAll','include','create','body','user','role','Reports','UserProfileSection','userProfileId','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','find','preview','join','left_join','right_join'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xfc6b,0x194));var _0xbfc6=function(_0x22eb1a,_0xcc656e){_0x22eb1a=_0x22eb1a-0x0;var _0x3787d2=_0xfc6b[_0x22eb1a];return _0x3787d2;};'use strict';var emlformat=require(_0xbfc6('0x0'));var rimraf=require(_0xbfc6('0x1'));var zipdir=require(_0xbfc6('0x2'));var jsonpatch=require(_0xbfc6('0x3'));var rp=require(_0xbfc6('0x4'));var moment=require(_0xbfc6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbfc6('0x6'));var util=require('util');var path=require(_0xbfc6('0x7'));var sox=require(_0xbfc6('0x8'));var csv=require(_0xbfc6('0x9'));var ejs=require(_0xbfc6('0xa'));var fs=require('fs');var fs_extra=require(_0xbfc6('0xb'));var _=require(_0xbfc6('0xc'));var squel=require(_0xbfc6('0xd'));var crypto=require('crypto');var jsforce=require(_0xbfc6('0xe'));var deskjs=require(_0xbfc6('0xf'));var toCsv=require(_0xbfc6('0x9'));var querystring=require('querystring');var Papa=require(_0xbfc6('0x10'));var Redis=require(_0xbfc6('0x11'));var authService=require(_0xbfc6('0x12'));var qs=require(_0xbfc6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfc6('0x14'));var logger=require(_0xbfc6('0x15'))('api');var utils=require(_0xbfc6('0x16'));var config=require(_0xbfc6('0x17'));var licenseUtil=require(_0xbfc6('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0xbfc6('0x19'))[_0xbfc6('0x1a')];function respondWithStatusCode(_0x41094a,_0x412b34){_0x412b34=_0x412b34||0xcc;return function(_0x12dd3a){if(_0x12dd3a){return _0x41094a['sendStatus'](_0x412b34);}return _0x41094a[_0xbfc6('0x1b')](_0x412b34)[_0xbfc6('0x1c')]();};}function respondWithResult(_0x1cae0c,_0x369d59){_0x369d59=_0x369d59||0xc8;return function(_0x3df15f){if(_0x3df15f){return _0x1cae0c['status'](_0x369d59)['json'](_0x3df15f);}};}function respondWithFilteredResult(_0x2e6dc2,_0xcaaa5a){return function(_0x28b94b){if(_0x28b94b){var _0x4f2cf6=typeof _0xcaaa5a[_0xbfc6('0x1d')]===_0xbfc6('0x1e')&&typeof _0xcaaa5a[_0xbfc6('0x1f')]===_0xbfc6('0x1e');var _0x3cbef0=_0x28b94b[_0xbfc6('0x20')];var _0x196123=_0x4f2cf6?0x0:_0xcaaa5a['offset'];var _0x3c01b3=_0x4f2cf6?_0x28b94b[_0xbfc6('0x20')]:_0xcaaa5a[_0xbfc6('0x1d')]+_0xcaaa5a[_0xbfc6('0x1f')];var _0x43d030;if(_0x3c01b3>=_0x3cbef0){_0x3c01b3=_0x3cbef0;_0x43d030=0xc8;}else{_0x43d030=0xce;}_0x2e6dc2[_0xbfc6('0x1b')](_0x43d030);return _0x2e6dc2[_0xbfc6('0x21')](_0xbfc6('0x22'),_0x196123+'-'+_0x3c01b3+'/'+_0x3cbef0)[_0xbfc6('0x23')](_0x28b94b);}return null;};}function patchUpdates(_0x2a56b2){return function(_0x43f2e4){try{jsonpatch[_0xbfc6('0x24')](_0x43f2e4,_0x2a56b2,!![]);}catch(_0x4188bc){return BPromise[_0xbfc6('0x25')](_0x4188bc);}return _0x43f2e4['save']();};}function saveUpdates(_0x4b804a,_0x5abc6d){return function(_0x128b7b){if(_0x128b7b){return _0x128b7b[_0xbfc6('0x26')](_0x4b804a)['then'](function(_0x53fe9d){return _0x53fe9d;});}return null;};}function removeEntity(_0x5e5c7b,_0x20cd22){return function(_0x3e0de4){if(_0x3e0de4){return _0x3e0de4['destroy']()[_0xbfc6('0x27')](function(){var _0x289cb2=_0x3e0de4[_0xbfc6('0x28')]({'plain':!![]});var _0x53e810='CustomReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x53e810,'resourceId':_0x289cb2['id']}})[_0xbfc6('0x27')](function(){return _0x3e0de4;});})[_0xbfc6('0x27')](function(){_0x5e5c7b[_0xbfc6('0x1b')](0xcc)[_0xbfc6('0x1c')]();});}};}function handleEntityNotFound(_0x6035e2,_0x2b1148){return function(_0x3affb6){if(!_0x3affb6){_0x6035e2['sendStatus'](0x194);}return _0x3affb6;};}function handleError(_0x406851,_0x18f145){_0x18f145=_0x18f145||0x1f4;return function(_0xa11c65){logger[_0xbfc6('0x29')](_0xa11c65['stack']);if(_0xa11c65['name']){delete _0xa11c65[_0xbfc6('0x2a')];}_0x406851[_0xbfc6('0x1b')](_0x18f145)[_0xbfc6('0x2b')](_0xa11c65);};}exports[_0xbfc6('0x2c')]=function(_0x3d67f3,_0xb40e62){var _0x3f5383={},_0x18a470={},_0x56a9fc={'count':0x0,'rows':[]};var _0x1da590=_['map'](db['AnalyticCustomReport'][_0xbfc6('0x2d')],function(_0x332a78){return{'name':_0x332a78[_0xbfc6('0x2e')],'type':_0x332a78[_0xbfc6('0x2f')][_0xbfc6('0x30')]};});_0x18a470[_0xbfc6('0x31')]=_[_0xbfc6('0x32')](_0x1da590,_0xbfc6('0x2a'));_0x18a470[_0xbfc6('0x33')]=_[_0xbfc6('0x34')](_0x3d67f3[_0xbfc6('0x33')]);_0x18a470['filters']=_['intersection'](_0x18a470[_0xbfc6('0x31')],_0x18a470[_0xbfc6('0x33')]);_0x3f5383['attributes']=_['intersection'](_0x18a470['model'],qs['fields'](_0x3d67f3[_0xbfc6('0x33')][_0xbfc6('0x35')]));_0x3f5383[_0xbfc6('0x36')]=_0x3f5383[_0xbfc6('0x36')][_0xbfc6('0x37')]?_0x3f5383[_0xbfc6('0x36')]:_0x18a470[_0xbfc6('0x31')];if(!_0x3d67f3[_0xbfc6('0x33')][_0xbfc6('0x38')](_0xbfc6('0x39'))){_0x3f5383[_0xbfc6('0x1f')]=qs[_0xbfc6('0x1f')](_0x3d67f3['query'][_0xbfc6('0x1f')]);_0x3f5383[_0xbfc6('0x1d')]=qs[_0xbfc6('0x1d')](_0x3d67f3[_0xbfc6('0x33')][_0xbfc6('0x1d')]);}_0x3f5383[_0xbfc6('0x3a')]=qs['sort'](_0x3d67f3[_0xbfc6('0x33')][_0xbfc6('0x3b')]);_0x3f5383['where']=qs[_0xbfc6('0x3c')](_[_0xbfc6('0x3d')](_0x3d67f3[_0xbfc6('0x33')],_0x18a470[_0xbfc6('0x3c')]),_0x1da590);if(_0x3d67f3[_0xbfc6('0x33')]['filter']){_0x3f5383[_0xbfc6('0x3e')]=_[_0xbfc6('0x3f')](_0x3f5383[_0xbfc6('0x3e')],{'$or':_['map'](_0x1da590,function(_0x35c32a){if(_0x35c32a['type']!==_0xbfc6('0x40')){var _0x244b8c={};_0x244b8c[_0x35c32a['name']]={'$like':'%'+_0x3d67f3['query'][_0xbfc6('0x41')]+'%'};return _0x244b8c;}})});}_0x3f5383=_[_0xbfc6('0x3f')]({},_0x3f5383,_0x3d67f3[_0xbfc6('0x42')]);var _0x55644d={'where':_0x3f5383[_0xbfc6('0x3e')]};return db[_0xbfc6('0x43')][_0xbfc6('0x20')](_0x55644d)[_0xbfc6('0x27')](function(_0xe21e0a){_0x56a9fc[_0xbfc6('0x20')]=_0xe21e0a;if(_0x3d67f3[_0xbfc6('0x33')]['includeAll']){_0x3f5383['include']=[{'all':!![]}];}return db[_0xbfc6('0x43')][_0xbfc6('0x44')](_0x3f5383);})[_0xbfc6('0x27')](function(_0x1d8a7d){_0x56a9fc[_0xbfc6('0x45')]=_0x1d8a7d;return _0x56a9fc;})[_0xbfc6('0x27')](respondWithFilteredResult(_0xb40e62,_0x3f5383))[_0xbfc6('0x46')](handleError(_0xb40e62,null));};exports['show']=function(_0x35b1d3,_0xd91e8a){var _0x5e894d={'raw':![],'where':{'id':_0x35b1d3[_0xbfc6('0x47')]['id']}},_0x277719={};_0x277719[_0xbfc6('0x31')]=_[_0xbfc6('0x34')](db['AnalyticCustomReport'][_0xbfc6('0x2d')]);_0x277719['query']=_[_0xbfc6('0x34')](_0x35b1d3[_0xbfc6('0x33')]);_0x277719[_0xbfc6('0x3c')]=_[_0xbfc6('0x48')](_0x277719[_0xbfc6('0x31')],_0x277719[_0xbfc6('0x33')]);_0x5e894d[_0xbfc6('0x36')]=_[_0xbfc6('0x48')](_0x277719['model'],qs[_0xbfc6('0x35')](_0x35b1d3[_0xbfc6('0x33')][_0xbfc6('0x35')]));_0x5e894d[_0xbfc6('0x36')]=_0x5e894d[_0xbfc6('0x36')][_0xbfc6('0x37')]?_0x5e894d['attributes']:_0x277719[_0xbfc6('0x31')];if(_0x35b1d3[_0xbfc6('0x33')][_0xbfc6('0x49')]){_0x5e894d[_0xbfc6('0x4a')]=[{'all':!![]}];}_0x5e894d=_[_0xbfc6('0x3f')]({},_0x5e894d,_0x35b1d3[_0xbfc6('0x42')]);return db[_0xbfc6('0x43')]['find'](_0x5e894d)[_0xbfc6('0x27')](handleEntityNotFound(_0xd91e8a,null))['then'](respondWithResult(_0xd91e8a,null))[_0xbfc6('0x46')](handleError(_0xd91e8a,null));};exports[_0xbfc6('0x4b')]=function(_0x3a5831,_0x6c4ae9){return db[_0xbfc6('0x43')][_0xbfc6('0x4b')](_0x3a5831[_0xbfc6('0x4c')],{})[_0xbfc6('0x27')](function(_0x49a687){var _0x5a5453=_0x3a5831[_0xbfc6('0x4d')]['get']({'plain':!![]});if(!_0x5a5453)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a5453[_0xbfc6('0x4e')]===_0xbfc6('0x4d')){var _0x1416a8=_0x49a687['get']({'plain':!![]});var _0x5e5e76=_0xbfc6('0x4f');return db[_0xbfc6('0x50')]['find']({'where':{'name':_0x5e5e76,'userProfileId':_0x5a5453[_0xbfc6('0x51')]},'raw':!![]})['then'](function(_0x1815b5){if(_0x1815b5&&_0x1815b5['autoAssociation']===0x0){return db[_0xbfc6('0x52')]['create']({'name':_0x1416a8[_0xbfc6('0x2a')],'resourceId':_0x1416a8['id'],'type':_0xbfc6('0x53'),'sectionId':_0x1815b5['id']},{})[_0xbfc6('0x27')](function(){return _0x49a687;});}else{return _0x49a687;}})['catch'](function(_0x368330){logger[_0xbfc6('0x29')](_0xbfc6('0x54'),_0x368330);throw _0x368330;});}return _0x49a687;})[_0xbfc6('0x27')](respondWithResult(_0x6c4ae9,0xc9))['catch'](handleError(_0x6c4ae9,null));};exports['update']=function(_0x13f984,_0x43e8b8){if(_0x13f984[_0xbfc6('0x4c')]['id']){delete _0x13f984[_0xbfc6('0x4c')]['id'];}return db[_0xbfc6('0x43')]['find']({'where':{'id':_0x13f984['params']['id']}})[_0xbfc6('0x27')](handleEntityNotFound(_0x43e8b8,null))[_0xbfc6('0x27')](saveUpdates(_0x13f984[_0xbfc6('0x4c')],null))['then'](respondWithResult(_0x43e8b8,null))[_0xbfc6('0x46')](handleError(_0x43e8b8,null));};exports[_0xbfc6('0x55')]=function(_0x1767d2,_0x24ede0){return db[_0xbfc6('0x43')][_0xbfc6('0x56')]({'where':{'id':_0x1767d2[_0xbfc6('0x47')]['id']}})['then'](handleEntityNotFound(_0x24ede0,null))[_0xbfc6('0x27')](removeEntity(_0x24ede0,null))[_0xbfc6('0x46')](handleError(_0x24ede0,null));};exports[_0xbfc6('0x57')]=function(_0x206278,_0x26a376){var _0x20e6dc=0xa;var _0x1fae95=[_0xbfc6('0x58'),_0xbfc6('0x59'),_0xbfc6('0x5a'),_0xbfc6('0x5b')];var _0x1286b7={'SUM':_0xbfc6('0x5c'),'COUNT':_0xbfc6('0x5d'),'COUNT DISTINCT':_0xbfc6('0x5e'),'MAX':'MAX(%s)','MIN':_0xbfc6('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xbfc6('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xbfc6('0x61')};var _0x3810ba={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xbfc6('0x62'),'HOUR':_0xbfc6('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbfc6('0x64')};var _0x109a17=function(_0x2ac7de){return!_[_0xbfc6('0x65')]([_0xbfc6('0x66'),_0xbfc6('0x67'),_0xbfc6('0x68'),_0xbfc6('0x69')],_0x2ac7de);};var _0x437749=function(_0x4312b3){if(!_0x4312b3||!_0x4312b3[_0xbfc6('0x6a')][_0xbfc6('0x37')]){return'';}for(var _0x133408='(',_0x3a0b3c=0x0;_0x3a0b3c<_0x4312b3['rules'][_0xbfc6('0x37')];_0x3a0b3c+=0x1){_0x3a0b3c>0x0&&(_0x133408+='\x20'+_0x4312b3[_0xbfc6('0x6b')]+'\x20');_0x133408+=_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c]['group']?_0x437749(_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c][_0xbfc6('0x6c')]):_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c]['field']+'\x20'+_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c][_0xbfc6('0x6d')]+(_0x109a17(_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c][_0xbfc6('0x6d')])?'\x20'+_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c][_0xbfc6('0x6e')]:'');}return _0x133408+')';};var _0x3aeae2={'where':{'id':_0x206278['params']['id']}},_0x3fac03,_0x32d939,_0x315fdb,_0x47ed9c,_0x4782f3;_0x3aeae2=_['merge']({},_0x3aeae2,_0x206278['options']);return db[_0xbfc6('0x43')][_0xbfc6('0x56')](_0x3aeae2)[_0xbfc6('0x27')](function(_0x19debe){if(_0x19debe){_0x3fac03=_0x19debe;return _0x19debe[_0xbfc6('0x6f')]();}return null;})[_0xbfc6('0x27')](function(_0x39389e){if(_0x39389e){if(!_0x39389e['length']){throw new db[(_0xbfc6('0x70'))][(_0xbfc6('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x32d939=_0x39389e;return db[_0xbfc6('0x72')][_0xbfc6('0x44')]({'raw':!![]});}return null;})['then'](function(_0x3b58b4){if(_0x3b58b4){_0x315fdb=_[_0xbfc6('0x73')](_0x3b58b4,'id');var _0x2be7f5;var _0x797045=squel[_0xbfc6('0x74')]();_0x797045[_0xbfc6('0x75')](_0x3fac03[_0xbfc6('0x76')]);for(var _0x24830c=0x0;_0x24830c<_0x32d939[_0xbfc6('0x37')];_0x24830c+=0x1){_0x2be7f5=_0x32d939[_0x24830c][_0xbfc6('0x77')]?_0x315fdb[_0x32d939[_0x24830c][_0xbfc6('0x77')]][_0xbfc6('0x78')]:_0x32d939[_0x24830c][_0xbfc6('0x79')];_0x2be7f5=_0x32d939[_0x24830c][_0xbfc6('0x7a')]?_['replace'](_0x1286b7[_0x32d939[_0x24830c]['function']],'%s',_0x2be7f5):_0x2be7f5;_0x2be7f5=_0x32d939[_0x24830c][_0xbfc6('0x7b')]?_['replace'](_0x3810ba[_0x32d939[_0x24830c][_0xbfc6('0x7b')]],'%s',_0x2be7f5):_0x2be7f5;if(_0x32d939[_0x24830c][_0xbfc6('0x7c')]){_0x797045[_0xbfc6('0x6c')](_0x2be7f5);}_0x32d939[_0x24830c]['orderBy']&&_0x797045[_0xbfc6('0x3a')](_0x2be7f5,_0x32d939[_0x24830c][_0xbfc6('0x7d')]===_0xbfc6('0x7e')?![]:!![]);_0x797045[_0xbfc6('0x79')](_0x2be7f5,_0x32d939[_0x24830c][_0xbfc6('0x7f')]||_0x2be7f5);}if(_0x3fac03[_0xbfc6('0x80')]){_0x3fac03['joins']=JSON[_0xbfc6('0x81')](_0x3fac03[_0xbfc6('0x80')]);for(var _0x3b17cf=0x0;_0x3b17cf<_0x3fac03[_0xbfc6('0x80')][_0xbfc6('0x37')];_0x3b17cf+=0x1){if(_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x2f')]&&_['includes'](_0x1fae95,_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x2f')])&&_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x82')]&&_0x3fac03['joins'][_0x3b17cf]['foreignTable']&&_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x83')]){_0x797045[_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x2f')]](_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x84')],null,util[_0xbfc6('0x7b')](_0xbfc6('0x85'),_0x3fac03['table'],_0x3fac03['joins'][_0x3b17cf][_0xbfc6('0x82')],_0x3fac03[_0xbfc6('0x80')][_0x3b17cf]['foreignTable'],_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x83')]));}}}if(_0x3fac03['conditions']){_0x3fac03[_0xbfc6('0x86')]=JSON[_0xbfc6('0x81')](_0x3fac03['conditions']);_0x797045[_0xbfc6('0x3e')](_0x437749(_0x3fac03['conditions'][_0xbfc6('0x6c')]));}_0x4782f3=_0x797045['clone']();_0x797045[_0xbfc6('0x1f')](_0x20e6dc);_0x797045[_0xbfc6('0x1d')](0x0);logger[_0xbfc6('0x87')](_0xbfc6('0x88'),_0x797045[_0xbfc6('0x89')]());return dbH[_0xbfc6('0x8a')]['query'](_0x797045['toString'](),{'type':dbH[_0xbfc6('0x8a')][_0xbfc6('0x8b')]['SELECT']});}})['then'](respondWithResult(_0x26a376,null))[_0xbfc6('0x46')](handleError(_0x26a376,null));};function runReport(_0xd59e15,_0xed2d4a,_0x3304df){var _0x41d11f=_0xed2d4a[_0xbfc6('0x2a')];var _0x178147=0xa;var _0x23ce9f=[_0xbfc6('0x58'),_0xbfc6('0x59'),_0xbfc6('0x5a'),_0xbfc6('0x5b')];var _0x22472e={'SUM':_0xbfc6('0x5c'),'COUNT':_0xbfc6('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xbfc6('0x8c'),'MIN':_0xbfc6('0x5f'),'AVG':_0xbfc6('0x8d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbfc6('0x8e'),'GROUP_CONCAT DESC':_0xbfc6('0x61')};var _0x331e4b={'SEC_TO_TIME':_0xbfc6('0x8f'),'DATE':_0xbfc6('0x62'),'HOUR':_0xbfc6('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbfc6('0x64')};var _0x2359af=function(_0x11aee5){return!_[_0xbfc6('0x65')]([_0xbfc6('0x66'),'IS\x20NOT\x20NULL',_0xbfc6('0x68'),_0xbfc6('0x69')],_0x11aee5);};var _0x104808=function(_0x3c73ed){if(!_0x3c73ed||!_0x3c73ed[_0xbfc6('0x6a')]['length']){return'';}for(var _0x16f0f8='(',_0x50772c=0x0;_0x50772c<_0x3c73ed['rules'][_0xbfc6('0x37')];_0x50772c+=0x1){_0x50772c>0x0&&(_0x16f0f8+='\x20'+_0x3c73ed['operator']+'\x20');_0x16f0f8+=_0x3c73ed[_0xbfc6('0x6a')][_0x50772c][_0xbfc6('0x6c')]?_0x104808(_0x3c73ed[_0xbfc6('0x6a')][_0x50772c]['group']):_0x3c73ed[_0xbfc6('0x6a')][_0x50772c][_0xbfc6('0x79')]+'\x20'+_0x3c73ed[_0xbfc6('0x6a')][_0x50772c][_0xbfc6('0x6d')]+(_0x2359af(_0x3c73ed[_0xbfc6('0x6a')][_0x50772c][_0xbfc6('0x6d')])?'\x20'+_0x3c73ed['rules'][_0x50772c][_0xbfc6('0x6e')]:'');}return _0x16f0f8+')';};var _0x16bee6={'where':{'id':_0xd59e15['id']}},_0x4e14a4,_0x4abd83,_0x497dba,_0x268bff,_0x377494;_0x16bee6=_[_0xbfc6('0x3f')]({},_0x16bee6,_0x3304df);return db[_0xbfc6('0x43')][_0xbfc6('0x56')](_0x16bee6)[_0xbfc6('0x27')](function(_0xeb77af){if(_0xeb77af){_0x4e14a4=_0xeb77af;return _0xeb77af['getFields']();}return null;})[_0xbfc6('0x27')](function(_0x13a53c){if(_0x13a53c){if(!_0x13a53c[_0xbfc6('0x37')]){throw new db[(_0xbfc6('0x70'))][(_0xbfc6('0x71'))](_0xbfc6('0x90'),0x193);}_0x4abd83=_0x13a53c;return db[_0xbfc6('0x72')][_0xbfc6('0x44')]({'raw':!![]});}return null;})['then'](function(_0x146b09){if(_0x146b09){_0x497dba=_[_0xbfc6('0x73')](_0x146b09,'id');var _0x335746;var _0x3b00fd=squel[_0xbfc6('0x74')]();_0x3b00fd[_0xbfc6('0x75')](_0x4e14a4[_0xbfc6('0x76')]);for(var _0xbcabc=0x0;_0xbcabc<_0x4abd83[_0xbfc6('0x37')];_0xbcabc+=0x1){_0x335746=_0x4abd83[_0xbcabc][_0xbfc6('0x77')]?_0x497dba[_0x4abd83[_0xbcabc][_0xbfc6('0x77')]][_0xbfc6('0x78')]:_0x4abd83[_0xbcabc][_0xbfc6('0x79')];_0x335746=_0x4abd83[_0xbcabc][_0xbfc6('0x7a')]?_[_0xbfc6('0x91')](_0x22472e[_0x4abd83[_0xbcabc]['function']],'%s',_0x335746):_0x335746;_0x335746=_0x4abd83[_0xbcabc][_0xbfc6('0x7b')]?_[_0xbfc6('0x91')](_0x331e4b[_0x4abd83[_0xbcabc][_0xbfc6('0x7b')]],'%s',_0x335746):_0x335746;if(_0x4abd83[_0xbcabc][_0xbfc6('0x7c')]){_0x3b00fd[_0xbfc6('0x6c')](_0x335746);}_0x4abd83[_0xbcabc]['orderBy']&&_0x3b00fd[_0xbfc6('0x3a')](_0x335746,_0x4abd83[_0xbcabc][_0xbfc6('0x7d')]===_0xbfc6('0x7e')?![]:!![]);_0x3b00fd[_0xbfc6('0x79')](_0x335746,_0x4abd83[_0xbcabc]['alias']||_0x335746);}if(_0x4e14a4[_0xbfc6('0x80')]){_0x4e14a4[_0xbfc6('0x80')]=JSON['parse'](_0x4e14a4[_0xbfc6('0x80')]);for(var _0x360a7a=0x0;_0x360a7a<_0x4e14a4[_0xbfc6('0x80')]['length'];_0x360a7a+=0x1){if(_0x4e14a4[_0xbfc6('0x80')][_0x360a7a][_0xbfc6('0x2f')]&&_[_0xbfc6('0x65')](_0x23ce9f,_0x4e14a4['joins'][_0x360a7a][_0xbfc6('0x2f')])&&_0x4e14a4[_0xbfc6('0x80')][_0x360a7a]['parentKey']&&_0x4e14a4['joins'][_0x360a7a][_0xbfc6('0x84')]&&_0x4e14a4[_0xbfc6('0x80')][_0x360a7a]['foreignKey']){_0x3b00fd[_0x4e14a4['joins'][_0x360a7a][_0xbfc6('0x2f')]](_0x4e14a4[_0xbfc6('0x80')][_0x360a7a][_0xbfc6('0x84')],null,util[_0xbfc6('0x7b')](_0xbfc6('0x85'),_0x4e14a4[_0xbfc6('0x76')],_0x4e14a4[_0xbfc6('0x80')][_0x360a7a][_0xbfc6('0x82')],_0x4e14a4[_0xbfc6('0x80')][_0x360a7a]['foreignTable'],_0x4e14a4[_0xbfc6('0x80')][_0x360a7a]['foreignKey']));}}}if(_0x4e14a4[_0xbfc6('0x86')]){_0x4e14a4[_0xbfc6('0x86')]=JSON[_0xbfc6('0x81')](_0x4e14a4[_0xbfc6('0x86')]);_0x3b00fd['where'](_0x104808(_0x4e14a4[_0xbfc6('0x86')][_0xbfc6('0x6c')]));}_0x377494=_0x3b00fd[_0xbfc6('0x92')]();_0x3b00fd[_0xbfc6('0x1f')](_0x178147);_0x3b00fd[_0xbfc6('0x1d')](0x0);return;}})[_0xbfc6('0x27')](function(){if(_0xed2d4a[_0xbfc6('0x93')]===_0xbfc6('0x94')){return null;}var _0x5dbebd=_['merge'](_0xed2d4a,{'name':_0xed2d4a[_0xbfc6('0x95')]||_0xed2d4a['name']||_0x4e14a4[_0xbfc6('0x2a')],'basename':_0x41d11f,'savename':util['format'](_0xbfc6('0x96'),_0xed2d4a[_0xbfc6('0x2a')]||_0x4e14a4[_0xbfc6('0x2a')],require(_0xbfc6('0x97'))[_0xbfc6('0x98')](0x4),_0xed2d4a[_0xbfc6('0x93')]||_0xbfc6('0x99')),'reportId':_0x4e14a4['id'],'reportType':'custom'});return db[_0xbfc6('0x9a')][_0xbfc6('0x4b')](_0x5dbebd,{'raw':!![]});})[_0xbfc6('0x27')](function(_0x254b9e){if(_0x4e14a4['table']==='cdr'){_0x377494[_0xbfc6('0x3e')](_0x4e14a4[_0xbfc6('0x76')]+_0xbfc6('0x9b'),_0xed2d4a[_0xbfc6('0x9c')],_0xed2d4a['endDate']);}else{_0x377494[_0xbfc6('0x3e')](_0x4e14a4[_0xbfc6('0x76')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xed2d4a[_0xbfc6('0x9c')],_0xed2d4a['endDate']);}if(_0x254b9e){logger[_0xbfc6('0x9d')]('Run\x20Query:',_0x377494[_0xbfc6('0x89')]());require('child_process')[_0xbfc6('0x9e')](path[_0xbfc6('0x58')](__dirname,_0xbfc6('0x9f'),_0x254b9e[_0xbfc6('0x93')]),[_0x254b9e['id'],_0x377494[_0xbfc6('0x89')](),path['join'](__dirname,'../../files/reports',_0x254b9e[_0xbfc6('0xa0')]),_0x41d11f]);return _0x254b9e;}else{var _0x512405=squel[_0xbfc6('0x74')]();_0x512405[_0xbfc6('0x75')]('('+_0x377494[_0xbfc6('0x89')]()+')',_0xbfc6('0xa1'));_0x512405['field'](_0xbfc6('0xa2'),_0xbfc6('0x20'));_0x377494[_0xbfc6('0x1f')](_0xed2d4a[_0xbfc6('0x1f')]||_0x178147);_0x377494[_0xbfc6('0x1d')](_0xed2d4a[_0xbfc6('0x1d')]||0x0);return dbH['sequelize'][_0xbfc6('0x33')](_0x512405[_0xbfc6('0x89')](),{'type':dbH[_0xbfc6('0x8a')]['QueryTypes']['SELECT']})[_0xbfc6('0x27')](function(_0xf989c2){if(!_0xf989c2[_0xbfc6('0x37')]){_0x268bff=0x0;}else{_0x268bff=_0xf989c2[0x0][_0xbfc6('0x20')]||0x0;}return dbH['sequelize'][_0xbfc6('0x33')](_0x377494[_0xbfc6('0x89')](),{'type':dbH['sequelize'][_0xbfc6('0x8b')][_0xbfc6('0xa3')]});})[_0xbfc6('0x27')](function(_0x21395){return{'rows':_0x21395||[],'count':_0x268bff};});}});}exports['run']=function(_0x14ccca,_0x4158d6){return runReport(_0x14ccca[_0xbfc6('0x47')],_0x14ccca[_0xbfc6('0x33')],_0x14ccca[_0xbfc6('0x42')])['then'](respondWithResult(_0x4158d6,null))[_0xbfc6('0x46')](handleError(_0x4158d6,null));};exports[_0xbfc6('0xa4')]=runReport;exports[_0xbfc6('0x33')]=function(_0x56a475,_0x2a7435){var _0x4bbbd0=0xa;var _0x66a0b1=[_0xbfc6('0x58'),_0xbfc6('0x59'),'right_join','cross_join'];var _0x2a55e5={'SUM':'SUM(%s)','COUNT':_0xbfc6('0x5d'),'COUNT DISTINCT':_0xbfc6('0x5e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xbfc6('0x8d'),'GROUP_CONCAT':_0xbfc6('0x60'),'GROUP_CONCAT ASC':_0xbfc6('0x8e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5802a0={'SEC_TO_TIME':_0xbfc6('0x8f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbfc6('0x64')};var _0x40bc41=function(_0x2bf6ff){return!_[_0xbfc6('0x65')](['IS\x20NULL',_0xbfc6('0x67'),_0xbfc6('0x68'),'IS\x20NOT\x20EMPTY'],_0x2bf6ff);};var _0x103c8a=function(_0x45930b){if(!_0x45930b||!_0x45930b[_0xbfc6('0x6a')][_0xbfc6('0x37')]){return'';}for(var _0x4410ee='(',_0x544cab=0x0;_0x544cab<_0x45930b[_0xbfc6('0x6a')]['length'];_0x544cab+=0x1){_0x544cab>0x0&&(_0x4410ee+='\x20'+_0x45930b['operator']+'\x20');_0x4410ee+=_0x45930b[_0xbfc6('0x6a')][_0x544cab][_0xbfc6('0x6c')]?_0x103c8a(_0x45930b[_0xbfc6('0x6a')][_0x544cab][_0xbfc6('0x6c')]):_0x45930b[_0xbfc6('0x6a')][_0x544cab][_0xbfc6('0x79')]+'\x20'+_0x45930b[_0xbfc6('0x6a')][_0x544cab]['condition']+(_0x40bc41(_0x45930b[_0xbfc6('0x6a')][_0x544cab][_0xbfc6('0x6d')])?'\x20'+_0x45930b['rules'][_0x544cab][_0xbfc6('0x6e')]:'');}return _0x4410ee+')';};var _0x3c2bb0={'where':{'id':_0x56a475[_0xbfc6('0x47')]['id']}},_0x2673cb,_0x4d33bf,_0x18db1d,_0x34d62c,_0x198f4b;_0x3c2bb0=_[_0xbfc6('0x3f')]({},_0x3c2bb0,_0x56a475['options']);return db['AnalyticCustomReport'][_0xbfc6('0x56')](_0x3c2bb0)['then'](function(_0x49b54c){if(_0x49b54c){_0x2673cb=_0x49b54c;return _0x49b54c[_0xbfc6('0x6f')]();}return null;})[_0xbfc6('0x27')](function(_0x5b1c26){if(_0x5b1c26){if(!_0x5b1c26['length']){throw new db[(_0xbfc6('0x70'))][(_0xbfc6('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4d33bf=_0x5b1c26;return db[_0xbfc6('0x72')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x5eb10b){if(_0x5eb10b){_0x18db1d=_[_0xbfc6('0x73')](_0x5eb10b,'id');var _0x49ac22;var _0x31a7bc=squel[_0xbfc6('0x74')]();_0x31a7bc[_0xbfc6('0x75')](_0x2673cb[_0xbfc6('0x76')]);for(var _0x6fb2bd=0x0;_0x6fb2bd<_0x4d33bf['length'];_0x6fb2bd+=0x1){_0x49ac22=_0x4d33bf[_0x6fb2bd][_0xbfc6('0x77')]?_0x18db1d[_0x4d33bf[_0x6fb2bd][_0xbfc6('0x77')]][_0xbfc6('0x78')]:_0x4d33bf[_0x6fb2bd]['field'];_0x49ac22=_0x4d33bf[_0x6fb2bd][_0xbfc6('0x7a')]?_[_0xbfc6('0x91')](_0x2a55e5[_0x4d33bf[_0x6fb2bd]['function']],'%s',_0x49ac22):_0x49ac22;_0x49ac22=_0x4d33bf[_0x6fb2bd][_0xbfc6('0x7b')]?_[_0xbfc6('0x91')](_0x5802a0[_0x4d33bf[_0x6fb2bd][_0xbfc6('0x7b')]],'%s',_0x49ac22):_0x49ac22;if(_0x4d33bf[_0x6fb2bd][_0xbfc6('0x7c')]){_0x31a7bc[_0xbfc6('0x6c')](_0x49ac22);}_0x4d33bf[_0x6fb2bd]['orderBy']&&_0x31a7bc['order'](_0x49ac22,_0x4d33bf[_0x6fb2bd]['orderBy']==='DESC'?![]:!![]);_0x31a7bc['field'](_0x49ac22,_0x4d33bf[_0x6fb2bd][_0xbfc6('0x7f')]||_0x49ac22);}if(_0x2673cb[_0xbfc6('0x80')]){_0x2673cb[_0xbfc6('0x80')]=JSON['parse'](_0x2673cb['joins']);for(var _0x430831=0x0;_0x430831<_0x2673cb[_0xbfc6('0x80')]['length'];_0x430831+=0x1){if(_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x2f')]&&_[_0xbfc6('0x65')](_0x66a0b1,_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x2f')])&&_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x82')]&&_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x84')]&&_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x83')]){_0x31a7bc[_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x2f')]](_0x2673cb[_0xbfc6('0x80')][_0x430831]['foreignTable'],null,util[_0xbfc6('0x7b')]('%s.%s\x20=\x20%s.%s',_0x2673cb[_0xbfc6('0x76')],_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x82')],_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x84')],_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x83')]));}}}if(_0x2673cb[_0xbfc6('0x86')]){_0x2673cb['conditions']=JSON[_0xbfc6('0x81')](_0x2673cb['conditions']);_0x31a7bc['where'](_0x103c8a(_0x2673cb['conditions'][_0xbfc6('0x6c')]));}_0x198f4b=_0x31a7bc[_0xbfc6('0x92')]();_0x31a7bc['limit'](_0x4bbbd0);_0x31a7bc[_0xbfc6('0x1d')](0x0);logger[_0xbfc6('0x87')](_0xbfc6('0x88'),_0x31a7bc[_0xbfc6('0x89')]());return dbH[_0xbfc6('0x8a')]['query'](_0x31a7bc['toString'](),{'type':dbH[_0xbfc6('0x8a')]['QueryTypes'][_0xbfc6('0xa3')]});}})[_0xbfc6('0x27')](function(){return{'sql':_0x198f4b[_0xbfc6('0x89')]()};})[_0xbfc6('0x27')](respondWithResult(_0x2a7435,null))[_0xbfc6('0x46')](handleError(_0x2a7435,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 036f647..0c32ae7 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 _0xa0d6=['bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','analytics_custom_reports','lodash','../../config/logger','api'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xa0d6,0x19b));var _0x6a0d=function(_0x11dfcc,_0x21a509){_0x11dfcc=_0x11dfcc-0x0;var _0x9264d6=_0xa0d6[_0x11dfcc];return _0x9264d6;};'use strict';var _=require(_0x6a0d('0x0'));var util=require('util');var logger=require(_0x6a0d('0x1'))(_0x6a0d('0x2'));var moment=require('moment');var BPromise=require(_0x6a0d('0x3'));var rp=require(_0x6a0d('0x4'));var fs=require('fs');var path=require(_0x6a0d('0x5'));var rimraf=require(_0x6a0d('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a0d('0x7'));module['exports']=function(_0x3d5fb3,_0x325e60){return _0x3d5fb3['define']('AnalyticCustomReport',attributes,{'tableName':_0x6a0d('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6788=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0x6788,0x132));var _0x8678=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6788[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x8678('0x0'));var util=require(_0x8678('0x1'));var logger=require(_0x8678('0x2'))(_0x8678('0x3'));var moment=require(_0x8678('0x4'));var BPromise=require(_0x8678('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8678('0x6'));var config=require(_0x8678('0x7'));var attributes=require(_0x8678('0x8'));module[_0x8678('0x9')]=function(_0x2528a0,_0x5e7511){return _0x2528a0[_0x8678('0xa')](_0x8678('0xb'),attributes,{'tableName':_0x8678('0xc'),'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 c22c72f..422e1d1 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 _0xea7f=['http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0xea7f,0xd0));var _0xfea7=function(_0x23ef1f,_0x127dd2){_0x23ef1f=_0x23ef1f-0x0;var _0x234192=_0xea7f[_0x23ef1f];return _0x234192;};'use strict';var _=require('lodash');var util=require(_0xfea7('0x0'));var moment=require(_0xfea7('0x1'));var BPromise=require(_0xfea7('0x2'));var rs=require(_0xfea7('0x3'));var fs=require('fs');var Redis=require(_0xfea7('0x4'));var db=require(_0xfea7('0x5'))['db'];var utils=require(_0xfea7('0x6'));var logger=require(_0xfea7('0x7'))(_0xfea7('0x8'));var config=require(_0xfea7('0x9'));var jayson=require(_0xfea7('0xa'));var client=jayson[_0xfea7('0xb')][_0xfea7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x419321,_0x4ab509,_0x27d978){return new BPromise(function(_0x2b5a61,_0x5736fe){return client[_0xfea7('0xd')](_0x419321,_0x27d978)[_0xfea7('0xe')](function(_0x10faf2){logger[_0xfea7('0xf')](_0xfea7('0x10'),_0x4ab509,_0xfea7('0x11'));logger['debug'](_0xfea7('0x12'),_0x4ab509,_0xfea7('0x11'),JSON['stringify'](_0x10faf2));if(_0x10faf2[_0xfea7('0x13')]){if(_0x10faf2['error']['code']===0x1f4){logger[_0xfea7('0x13')](_0xfea7('0x10'),_0x4ab509,_0x10faf2[_0xfea7('0x13')][_0xfea7('0x14')]);return _0x5736fe(_0x10faf2[_0xfea7('0x13')]['message']);}logger['error'](_0xfea7('0x10'),_0x4ab509,_0x10faf2[_0xfea7('0x13')]['message']);return _0x2b5a61(_0x10faf2['error'][_0xfea7('0x14')]);}else{logger['info'](_0xfea7('0x10'),_0x4ab509,'request\x20sent');_0x2b5a61(_0x10faf2[_0xfea7('0x15')][_0xfea7('0x14')]);}})['catch'](function(_0x22f9f9){logger[_0xfea7('0x13')](_0xfea7('0x10'),_0x4ab509,_0x22f9f9);_0x5736fe(_0x22f9f9);});});} \ No newline at end of file +var _0xaab3=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3877e8,_0x155bcb){var _0x552c52=function(_0x5a10bd){while(--_0x5a10bd){_0x3877e8['push'](_0x3877e8['shift']());}};_0x552c52(++_0x155bcb);}(_0xaab3,0x1e5));var _0x3aab=function(_0x26623d,_0x569817){_0x26623d=_0x26623d-0x0;var _0x1c86a4=_0xaab3[_0x26623d];return _0x1c86a4;};'use strict';var _=require(_0x3aab('0x0'));var util=require(_0x3aab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3aab('0x2'));var fs=require('fs');var Redis=require(_0x3aab('0x3'));var db=require(_0x3aab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3aab('0x5'))(_0x3aab('0x6'));var config=require(_0x3aab('0x7'));var jayson=require(_0x3aab('0x8'));var client=jayson[_0x3aab('0x9')][_0x3aab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34cd74,_0x3e0648,_0x2931d0){return new BPromise(function(_0x13e914,_0x59fbc5){return client[_0x3aab('0xb')](_0x34cd74,_0x2931d0)[_0x3aab('0xc')](function(_0x3fa4e6){logger['info'](_0x3aab('0xd'),_0x3e0648,_0x3aab('0xe'));logger['debug'](_0x3aab('0xf'),_0x3e0648,'request\x20sent',JSON[_0x3aab('0x10')](_0x3fa4e6));if(_0x3fa4e6['error']){if(_0x3fa4e6[_0x3aab('0x11')][_0x3aab('0x12')]===0x1f4){logger[_0x3aab('0x11')](_0x3aab('0xd'),_0x3e0648,_0x3fa4e6[_0x3aab('0x11')][_0x3aab('0x13')]);return _0x59fbc5(_0x3fa4e6['error'][_0x3aab('0x13')]);}logger[_0x3aab('0x11')](_0x3aab('0xd'),_0x3e0648,_0x3fa4e6[_0x3aab('0x11')][_0x3aab('0x13')]);return _0x13e914(_0x3fa4e6[_0x3aab('0x11')][_0x3aab('0x13')]);}else{logger[_0x3aab('0x14')](_0x3aab('0xd'),_0x3e0648,'request\x20sent');_0x13e914(_0x3fa4e6[_0x3aab('0x15')]['message']);}})[_0x3aab('0x16')](function(_0x2b6146){logger['error'](_0x3aab('0xd'),_0x3e0648,_0x2b6146);_0x59fbc5(_0x2b6146);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2ca1d52..94c31e7 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 _0xbda8=['destroy','util','path','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','preview','/:id/run','run','query','post','create','put','update'];(function(_0x581ad5,_0x5abbe0){var _0x13cea9=function(_0x2b704a){while(--_0x2b704a){_0x581ad5['push'](_0x581ad5['shift']());}};_0x13cea9(++_0x5abbe0);}(_0xbda8,0x1b6));var _0x8bda=function(_0x5633d2,_0x114c64){_0x5633d2=_0x5633d2-0x0;var _0x1db645=_0xbda8[_0x5633d2];return _0x1db645;};'use strict';var multer=require('multer');var util=require(_0x8bda('0x0'));var path=require(_0x8bda('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8bda('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8bda('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8bda('0x4'));var controller=require(_0x8bda('0x5'));router[_0x8bda('0x6')]('/',auth[_0x8bda('0x7')](),controller['index']);router['get'](_0x8bda('0x8'),auth[_0x8bda('0x7')](),controller[_0x8bda('0x9')]);router[_0x8bda('0x6')]('/:id/preview',auth[_0x8bda('0x7')](),controller[_0x8bda('0xa')]);router[_0x8bda('0x6')](_0x8bda('0xb'),auth[_0x8bda('0x7')](),controller[_0x8bda('0xc')]);router[_0x8bda('0x6')]('/:id/query',auth['isAuthenticated'](),controller[_0x8bda('0xd')]);router[_0x8bda('0xe')]('/',auth[_0x8bda('0x7')](),controller[_0x8bda('0xf')]);router[_0x8bda('0x10')](_0x8bda('0x8'),auth[_0x8bda('0x7')](),controller[_0x8bda('0x11')]);router['delete'](_0x8bda('0x8'),auth[_0x8bda('0x7')](),controller[_0x8bda('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5588=['index','/:id','/:id/preview','isAuthenticated','/:id/run','run','query','post','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get'];(function(_0xfc342f,_0x2f339a){var _0x52e1b5=function(_0x57a460){while(--_0x57a460){_0xfc342f['push'](_0xfc342f['shift']());}};_0x52e1b5(++_0x2f339a);}(_0x5588,0x1c3));var _0x8558=function(_0x2cee80,_0xe8d160){_0x2cee80=_0x2cee80-0x0;var _0x32e7b2=_0x5588[_0x2cee80];return _0x32e7b2;};'use strict';var multer=require(_0x8558('0x0'));var util=require(_0x8558('0x1'));var path=require(_0x8558('0x2'));var timeout=require(_0x8558('0x3'));var express=require('express');var router=express[_0x8558('0x4')]();var fs_extra=require(_0x8558('0x5'));var auth=require(_0x8558('0x6'));var interaction=require(_0x8558('0x7'));var config=require(_0x8558('0x8'));var controller=require(_0x8558('0x9'));router[_0x8558('0xa')]('/',auth['isAuthenticated'](),controller[_0x8558('0xb')]);router['get'](_0x8558('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8558('0xd'),auth[_0x8558('0xe')](),controller['preview']);router[_0x8558('0xa')](_0x8558('0xf'),auth[_0x8558('0xe')](),controller[_0x8558('0x10')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x8558('0x11')]);router[_0x8558('0x12')]('/',auth[_0x8558('0xe')](),controller['create']);router['put'](_0x8558('0xc'),auth[_0x8558('0xe')](),controller[_0x8558('0x13')]);router[_0x8558('0x14')](_0x8558('0xc'),auth[_0x8558('0xe')](),controller['destroy']);module[_0x8558('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 9f411f1..97b8814 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 _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x17ea17,_0x3c2ac9){var _0x1ea925=function(_0x19b32e){while(--_0x19b32e){_0x17ea17['push'](_0x17ea17['shift']());}};_0x1ea925(++_0x3c2ac9);}(_0xb138,0x1dd));var _0x8b13=function(_0x455555,_0x2147fd){_0x455555=_0x455555-0x0;var _0x3cb183=_0xb138[_0x455555];return _0x3cb183;};'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 +var _0xa630=['STRING','TEXT','sequelize','exports'];(function(_0x246a2d,_0x295e02){var _0x5457e7=function(_0x44bba1){while(--_0x44bba1){_0x246a2d['push'](_0x246a2d['shift']());}};_0x5457e7(++_0x295e02);}(_0xa630,0xbe));var _0x0a63=function(_0x367363,_0x14886b){_0x367363=_0x367363-0x0;var _0x3351b0=_0xa630[_0x367363];return _0x3351b0;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x0a63('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x0a63('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 46c333c..0c51667 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 _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%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\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x3c7f1d,_0x44b37b){var _0xd7ab0c=function(_0x1dd6b2){while(--_0x1dd6b2){_0x3c7f1d['push'](_0x3c7f1d['shift']());}};_0xd7ab0c(++_0x44b37b);}(_0xba34,0x119));var _0x4ba3=function(_0x3b826c,_0x349ecc){_0x3b826c=_0x3b826c-0x0;var _0x314f8f=_0xba34[_0x3b826c];return _0x314f8f;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file +var _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x101504,_0x4598b0){var _0x1b7547=function(_0x24432c){while(--_0x24432c){_0x101504['push'](_0x101504['shift']());}};_0x1b7547(++_0x4598b0);}(_0x53ec,0x192));var _0xc53e=function(_0x4c79aa,_0x456fcd){_0x4c79aa=_0x4c79aa-0x0;var _0x28e73a=_0x53ec[_0x4c79aa];return _0x28e73a;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ca97a78..d38a9a4 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 _0x72de=['request-promise','path','../../config/environment','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0x4cfb18,_0x1d9a1d){var _0x44ce8d=function(_0x7abc6){while(--_0x7abc6){_0x4cfb18['push'](_0x4cfb18['shift']());}};_0x44ce8d(++_0x1d9a1d);}(_0x72de,0xd7));var _0xe72d=function(_0x24dacb,_0x420207){_0x24dacb=_0x24dacb-0x0;var _0x5da8d9=_0x72de[_0x24dacb];return _0x5da8d9;};'use strict';var _=require(_0xe72d('0x0'));var util=require(_0xe72d('0x1'));var logger=require(_0xe72d('0x2'))(_0xe72d('0x3'));var moment=require(_0xe72d('0x4'));var BPromise=require('bluebird');var rp=require(_0xe72d('0x5'));var fs=require('fs');var path=require(_0xe72d('0x6'));var rimraf=require('rimraf');var config=require(_0xe72d('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0xe72d('0x8')]=function(_0xdba408,_0x61f855){return _0xdba408['define'](_0xe72d('0x9'),attributes,{'tableName':_0xe72d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x715c=['./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x4a6d5f,_0x40ebfe){var _0x3aeb0d=function(_0x1a955b){while(--_0x1a955b){_0x4a6d5f['push'](_0x4a6d5f['shift']());}};_0x3aeb0d(++_0x40ebfe);}(_0x715c,0x1b2));var _0xc715=function(_0x1ae9ad,_0x2e761d){_0x1ae9ad=_0x1ae9ad-0x0;var _0x4f6f49=_0x715c[_0x1ae9ad];return _0x4f6f49;};'use strict';var _=require(_0xc715('0x0'));var util=require(_0xc715('0x1'));var logger=require(_0xc715('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc715('0x3'));var rp=require(_0xc715('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc715('0x5'));var config=require('../../config/environment');var attributes=require(_0xc715('0x6'));module[_0xc715('0x7')]=function(_0x19f1de,_0x1c6924){return _0x19f1de[_0xc715('0x8')](_0xc715('0x9'),attributes,{'tableName':_0xc715('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 171e555..3b41bf3 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 _0x71e8=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x34ed89,_0xc7a27b){var _0x16d9cc=function(_0x55a811){while(--_0x55a811){_0x34ed89['push'](_0x34ed89['shift']());}};_0x16d9cc(++_0xc7a27b);}(_0x71e8,0xaa));var _0x871e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x71e8[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x871e('0x0'));var moment=require(_0x871e('0x1'));var BPromise=require(_0x871e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x871e('0x3'));var db=require(_0x871e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x871e('0x5'))(_0x871e('0x6'));var config=require(_0x871e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x871e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29928e,_0x5bdc87,_0x2d9e3d){return new BPromise(function(_0x58a357,_0x4d4c75){return client[_0x871e('0x9')](_0x29928e,_0x2d9e3d)[_0x871e('0xa')](function(_0x7fd5a7){logger[_0x871e('0xb')](_0x871e('0xc'),_0x5bdc87,_0x871e('0xd'));logger[_0x871e('0xe')](_0x871e('0xf'),_0x5bdc87,_0x871e('0xd'),JSON[_0x871e('0x10')](_0x7fd5a7));if(_0x7fd5a7[_0x871e('0x11')]){if(_0x7fd5a7[_0x871e('0x11')]['code']===0x1f4){logger[_0x871e('0x11')](_0x871e('0xc'),_0x5bdc87,_0x7fd5a7[_0x871e('0x11')][_0x871e('0x12')]);return _0x4d4c75(_0x7fd5a7['error'][_0x871e('0x12')]);}logger[_0x871e('0x11')](_0x871e('0xc'),_0x5bdc87,_0x7fd5a7[_0x871e('0x11')][_0x871e('0x12')]);return _0x58a357(_0x7fd5a7[_0x871e('0x11')][_0x871e('0x12')]);}else{logger[_0x871e('0xb')](_0x871e('0xc'),_0x5bdc87,_0x871e('0xd'));_0x58a357(_0x7fd5a7[_0x871e('0x13')]['message']);}})[_0x871e('0x14')](function(_0x7cb048){logger[_0x871e('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5bdc87,_0x7cb048);_0x4d4c75(_0x7cb048);});});} \ No newline at end of file +var _0x421b=['result','catch','util','../../config/utils','../../config/logger','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x98e46e,_0x2319b4){var _0x16e2a8=function(_0x1658f1){while(--_0x1658f1){_0x98e46e['push'](_0x98e46e['shift']());}};_0x16e2a8(++_0x2319b4);}(_0x421b,0x1cd));var _0xb421=function(_0xb55bf0,_0x3bc96b){_0xb55bf0=_0xb55bf0-0x0;var _0x1cd7e2=_0x421b[_0xb55bf0];return _0x1cd7e2;};'use strict';var _=require('lodash');var util=require(_0xb421('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb421('0x1'));var logger=require(_0xb421('0x2'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb421('0x3')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4caaf8,_0x4d5d99,_0x194876){return new BPromise(function(_0xcb28eb,_0x5e5f99){return client[_0xb421('0x4')](_0x4caaf8,_0x194876)[_0xb421('0x5')](function(_0x24fb3a){logger[_0xb421('0x6')](_0xb421('0x7'),_0x4d5d99,_0xb421('0x8'));logger[_0xb421('0x9')](_0xb421('0xa'),_0x4d5d99,'request\x20sent',JSON[_0xb421('0xb')](_0x24fb3a));if(_0x24fb3a[_0xb421('0xc')]){if(_0x24fb3a[_0xb421('0xc')][_0xb421('0xd')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4d5d99,_0x24fb3a[_0xb421('0xc')][_0xb421('0xe')]);return _0x5e5f99(_0x24fb3a[_0xb421('0xc')][_0xb421('0xe')]);}logger[_0xb421('0xc')](_0xb421('0x7'),_0x4d5d99,_0x24fb3a['error']['message']);return _0xcb28eb(_0x24fb3a['error'][_0xb421('0xe')]);}else{logger[_0xb421('0x6')](_0xb421('0x7'),_0x4d5d99,_0xb421('0x8'));_0xcb28eb(_0x24fb3a[_0xb421('0xf')]['message']);}})[_0xb421('0x10')](function(_0x13d841){logger['error'](_0xb421('0x7'),_0x4d5d99,_0x13d841);_0x5e5f99(_0x13d841);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index b0eb460..cc736da 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 _0x5fd1=['delete','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','/:id/run','run','/:id/query','query','post','create','update'];(function(_0x4fdd43,_0x58bca6){var _0x6881be=function(_0x1e7893){while(--_0x1e7893){_0x4fdd43['push'](_0x4fdd43['shift']());}};_0x6881be(++_0x58bca6);}(_0x5fd1,0x18f));var _0x15fd=function(_0x20885d,_0x159563){_0x20885d=_0x20885d-0x0;var _0x58a328=_0x5fd1[_0x20885d];return _0x58a328;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x15fd('0x1'));var router=express['Router']();var fs_extra=require(_0x15fd('0x2'));var auth=require(_0x15fd('0x3'));var interaction=require(_0x15fd('0x4'));var config=require(_0x15fd('0x5'));var controller=require(_0x15fd('0x6'));router[_0x15fd('0x7')]('/',auth[_0x15fd('0x8')](),controller[_0x15fd('0x9')]);router[_0x15fd('0x7')](_0x15fd('0xa'),auth[_0x15fd('0x8')](),controller['show']);router[_0x15fd('0x7')](_0x15fd('0xb'),auth[_0x15fd('0x8')](),controller['preview']);router[_0x15fd('0x7')](_0x15fd('0xc'),auth[_0x15fd('0x8')](),controller[_0x15fd('0xd')]);router[_0x15fd('0x7')](_0x15fd('0xe'),auth[_0x15fd('0x8')](),controller[_0x15fd('0xf')]);router[_0x15fd('0x10')]('/',auth[_0x15fd('0x8')](),controller[_0x15fd('0x11')]);router['put']('/:id',auth[_0x15fd('0x8')](),controller[_0x15fd('0x12')]);router[_0x15fd('0x13')](_0x15fd('0xa'),auth[_0x15fd('0x8')](),controller[_0x15fd('0x14')]);module[_0x15fd('0x15')]=router; \ No newline at end of file +var _0xea5f=['update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','get','/:id','show','/:id/preview','preview','run','/:id/query','query','post'];(function(_0xf05156,_0x1375f5){var _0x36a0dd=function(_0x2eef72){while(--_0x2eef72){_0xf05156['push'](_0xf05156['shift']());}};_0x36a0dd(++_0x1375f5);}(_0xea5f,0x156));var _0xfea5=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xea5f[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require(_0xfea5('0x0'));var util=require('util');var path=require(_0xfea5('0x1'));var timeout=require('connect-timeout');var express=require(_0xfea5('0x2'));var router=express[_0xfea5('0x3')]();var fs_extra=require(_0xfea5('0x4'));var auth=require(_0xfea5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfea5('0x6'));var controller=require(_0xfea5('0x7'));router['get']('/',auth[_0xfea5('0x8')](),controller['index']);router[_0xfea5('0x9')](_0xfea5('0xa'),auth['isAuthenticated'](),controller[_0xfea5('0xb')]);router[_0xfea5('0x9')](_0xfea5('0xc'),auth[_0xfea5('0x8')](),controller[_0xfea5('0xd')]);router[_0xfea5('0x9')]('/:id/run',auth['isAuthenticated'](),controller[_0xfea5('0xe')]);router['get'](_0xfea5('0xf'),auth['isAuthenticated'](),controller[_0xfea5('0x10')]);router[_0xfea5('0x11')]('/',auth[_0xfea5('0x8')](),controller['create']);router['put'](_0xfea5('0xa'),auth[_0xfea5('0x8')](),controller[_0xfea5('0x12')]);router['delete'](_0xfea5('0xa'),auth[_0xfea5('0x8')](),controller['destroy']);module[_0xfea5('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8868e1e..b2ea885 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 _0xb548=['DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf'];(function(_0x3d8abb,_0x4fb513){var _0x41266c=function(_0x596d45){while(--_0x596d45){_0x3d8abb['push'](_0x3d8abb['shift']());}};_0x41266c(++_0x4fb513);}(_0xb548,0x1f4));var _0x8b54=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0xb548[_0x644ecd];return _0x1c66ce;};'use strict';var Sequelize=require(_0x8b54('0x0'));var moment=require(_0x8b54('0x1'));module[_0x8b54('0x2')]={'name':{'type':Sequelize[_0x8b54('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x8b54('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x8b54('0x4')](_0x8b54('0x5'),_0x8b54('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0x8b54('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x8b54('0x7')]},'endDate':{'type':Sequelize[_0x8b54('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x8b54('0x8')},'type':{'type':Sequelize[_0x8b54('0x4')](_0x8b54('0x9'),_0x8b54('0xa')),'allowNull':![],'defaultValue':_0x8b54('0x9')},'reportId':{'type':Sequelize[_0x8b54('0xb')](0xb)[_0x8b54('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa5e0=['STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa5e0,0x14e));var _0x0a5e=function(_0x1886d1,_0x55ff51){_0x1886d1=_0x1886d1-0x0;var _0x43dfc5=_0xa5e0[_0x1886d1];return _0x43dfc5;};'use strict';var Sequelize=require(_0x0a5e('0x0'));var moment=require(_0x0a5e('0x1'));module['exports']={'name':{'type':Sequelize[_0x0a5e('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x0a5e('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x0a5e('0x3')](_0x0a5e('0x4'),_0x0a5e('0x5'),_0x0a5e('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x0a5e('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0a5e('0x7')]},'endDate':{'type':Sequelize[_0x0a5e('0x7')]},'status':{'type':Sequelize[_0x0a5e('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x0a5e('0x3')](_0x0a5e('0x8'),_0x0a5e('0x9')),'allowNull':![],'defaultValue':_0x0a5e('0x8')},'reportId':{'type':Sequelize[_0x0a5e('0xa')](0xb)[_0x0a5e('0xb')]},'reportType':{'type':Sequelize[_0x0a5e('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index a517ede..bdb739f 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 _0x285d=['basename','output','existsSync','join','root','server/files/reports','savename','ValidationError','exists','sendStatus','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','set','Content-Range','json','apply','save','then','get','ExtractedReports','UserProfileResource','destroy','end','error','stack','name','send','index','map','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','AnalyticExtractedReport','count','include','rows','show','includeAll','options','find','catch','create','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','download'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x285d,0x6d));var _0xd285=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x285d[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0xd285('0x0'));var rimraf=require(_0xd285('0x1'));var zipdir=require(_0xd285('0x2'));var jsonpatch=require(_0xd285('0x3'));var rp=require(_0xd285('0x4'));var moment=require(_0xd285('0x5'));var BPromise=require(_0xd285('0x6'));var Mustache=require(_0xd285('0x7'));var util=require('util');var path=require('path');var sox=require(_0xd285('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd285('0x9'));var _=require(_0xd285('0xa'));var squel=require('squel');var crypto=require(_0xd285('0xb'));var jsforce=require(_0xd285('0xc'));var deskjs=require(_0xd285('0xd'));var toCsv=require(_0xd285('0xe'));var querystring=require(_0xd285('0xf'));var Papa=require(_0xd285('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd285('0x11'));var as=require(_0xd285('0x12'));var hardwareService=require(_0xd285('0x13'));var logger=require(_0xd285('0x14'))(_0xd285('0x15'));var utils=require(_0xd285('0x16'));var config=require(_0xd285('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd285('0x18'))['db'];function respondWithStatusCode(_0xfad291,_0x38d348){_0x38d348=_0x38d348||0xcc;return function(_0x566542){if(_0x566542){return _0xfad291['sendStatus'](_0x38d348);}return _0xfad291[_0xd285('0x19')](_0x38d348)['end']();};}function respondWithResult(_0x2a7b29,_0x1aad04){_0x1aad04=_0x1aad04||0xc8;return function(_0x546032){if(_0x546032){return _0x2a7b29[_0xd285('0x19')](_0x1aad04)['json'](_0x546032);}};}function respondWithFilteredResult(_0x4227b9,_0x257245){return function(_0x52419a){if(_0x52419a){var _0x52f4c0=typeof _0x257245[_0xd285('0x1a')]===_0xd285('0x1b')&&typeof _0x257245[_0xd285('0x1c')]===_0xd285('0x1b');var _0x461626=_0x52419a['count'];var _0x37fd92=_0x52f4c0?0x0:_0x257245[_0xd285('0x1a')];var _0x524be3=_0x52f4c0?_0x52419a['count']:_0x257245[_0xd285('0x1a')]+_0x257245[_0xd285('0x1c')];var _0x2319f8;if(_0x524be3>=_0x461626){_0x524be3=_0x461626;_0x2319f8=0xc8;}else{_0x2319f8=0xce;}_0x4227b9['status'](_0x2319f8);return _0x4227b9[_0xd285('0x1d')](_0xd285('0x1e'),_0x37fd92+'-'+_0x524be3+'/'+_0x461626)[_0xd285('0x1f')](_0x52419a);}return null;};}function patchUpdates(_0x1a5b13){return function(_0x28c615){try{jsonpatch[_0xd285('0x20')](_0x28c615,_0x1a5b13,!![]);}catch(_0x46c730){return BPromise['reject'](_0x46c730);}return _0x28c615[_0xd285('0x21')]();};}function saveUpdates(_0x26fc4b,_0x4e9b87){return function(_0x55b93c){if(_0x55b93c){return _0x55b93c['update'](_0x26fc4b)[_0xd285('0x22')](function(_0x42e18e){return _0x42e18e;});}return null;};}function removeEntity(_0x334ba3,_0x510241){return function(_0x5ed5dd){if(_0x5ed5dd){return _0x5ed5dd['destroy']()['then'](function(){var _0x44e0fd=_0x5ed5dd[_0xd285('0x23')]({'plain':!![]});var _0x4dfac0=_0xd285('0x24');return db[_0xd285('0x25')][_0xd285('0x26')]({'where':{'type':_0x4dfac0,'resourceId':_0x44e0fd['id']}})[_0xd285('0x22')](function(){return _0x5ed5dd;});})[_0xd285('0x22')](function(){_0x334ba3['status'](0xcc)[_0xd285('0x27')]();});}};}function handleEntityNotFound(_0x18dd21,_0x5255d4){return function(_0x2d36f7){if(!_0x2d36f7){_0x18dd21['sendStatus'](0x194);}return _0x2d36f7;};}function handleError(_0x38aa2b,_0x317b67){_0x317b67=_0x317b67||0x1f4;return function(_0x4f39d2){logger[_0xd285('0x28')](_0x4f39d2[_0xd285('0x29')]);if(_0x4f39d2[_0xd285('0x2a')]){delete _0x4f39d2['name'];}_0x38aa2b[_0xd285('0x19')](_0x317b67)[_0xd285('0x2b')](_0x4f39d2);};}exports[_0xd285('0x2c')]=function(_0xb03a00,_0x1c3e83){var _0x36bdfc={},_0x34be49={},_0x21ae12={'count':0x0,'rows':[]};var _0x11b633=_[_0xd285('0x2d')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x58cc05){return{'name':_0x58cc05['fieldName'],'type':_0x58cc05[_0xd285('0x2e')]['key']};});_0x34be49[_0xd285('0x2f')]=_['map'](_0x11b633,_0xd285('0x2a'));_0x34be49[_0xd285('0x30')]=_[_0xd285('0x31')](_0xb03a00['query']);_0x34be49[_0xd285('0x32')]=_['intersection'](_0x34be49[_0xd285('0x2f')],_0x34be49[_0xd285('0x30')]);_0x36bdfc['attributes']=_[_0xd285('0x33')](_0x34be49[_0xd285('0x2f')],qs['fields'](_0xb03a00['query'][_0xd285('0x34')]));_0x36bdfc[_0xd285('0x35')]=_0x36bdfc['attributes'][_0xd285('0x36')]?_0x36bdfc[_0xd285('0x35')]:_0x34be49[_0xd285('0x2f')];if(!_0xb03a00[_0xd285('0x30')][_0xd285('0x37')](_0xd285('0x38'))){_0x36bdfc[_0xd285('0x1c')]=qs[_0xd285('0x1c')](_0xb03a00[_0xd285('0x30')]['limit']);_0x36bdfc[_0xd285('0x1a')]=qs[_0xd285('0x1a')](_0xb03a00['query'][_0xd285('0x1a')]);}_0x36bdfc[_0xd285('0x39')]=qs['sort'](_0xb03a00[_0xd285('0x30')][_0xd285('0x3a')]);_0x36bdfc[_0xd285('0x3b')]=qs['filters'](_[_0xd285('0x3c')](_0xb03a00[_0xd285('0x30')],_0x34be49[_0xd285('0x32')]),_0x11b633);if(_0xb03a00[_0xd285('0x30')]['filter']){_0x36bdfc[_0xd285('0x3b')]=_[_0xd285('0x3d')](_0x36bdfc[_0xd285('0x3b')],{'$or':_['map'](_0x11b633,function(_0x35d9bf){if(_0x35d9bf[_0xd285('0x2e')]!==_0xd285('0x3e')){var _0x1edcff={};_0x1edcff[_0x35d9bf['name']]={'$like':'%'+_0xb03a00[_0xd285('0x30')][_0xd285('0x3f')]+'%'};return _0x1edcff;}})});}_0x36bdfc=_[_0xd285('0x3d')]({},_0x36bdfc,_0xb03a00['options']);var _0x219bb1={'where':_0x36bdfc['where']};return db[_0xd285('0x40')][_0xd285('0x41')](_0x219bb1)[_0xd285('0x22')](function(_0x24feb4){_0x21ae12[_0xd285('0x41')]=_0x24feb4;if(_0xb03a00[_0xd285('0x30')]['includeAll']){_0x36bdfc[_0xd285('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x36bdfc);})[_0xd285('0x22')](function(_0x2c239c){_0x21ae12[_0xd285('0x43')]=_0x2c239c;return _0x21ae12;})[_0xd285('0x22')](respondWithFilteredResult(_0x1c3e83,_0x36bdfc))['catch'](handleError(_0x1c3e83,null));};exports[_0xd285('0x44')]=function(_0x2ddaf5,_0x2ae0a2){var _0xea17eb={'raw':!![],'where':{'id':_0x2ddaf5['params']['id']}},_0x2e50c7={};_0x2e50c7[_0xd285('0x2f')]=_[_0xd285('0x31')](db[_0xd285('0x40')]['rawAttributes']);_0x2e50c7[_0xd285('0x30')]=_[_0xd285('0x31')](_0x2ddaf5['query']);_0x2e50c7[_0xd285('0x32')]=_[_0xd285('0x33')](_0x2e50c7[_0xd285('0x2f')],_0x2e50c7[_0xd285('0x30')]);_0xea17eb[_0xd285('0x35')]=_['intersection'](_0x2e50c7[_0xd285('0x2f')],qs['fields'](_0x2ddaf5[_0xd285('0x30')][_0xd285('0x34')]));_0xea17eb['attributes']=_0xea17eb['attributes'][_0xd285('0x36')]?_0xea17eb[_0xd285('0x35')]:_0x2e50c7['model'];if(_0x2ddaf5[_0xd285('0x30')][_0xd285('0x45')]){_0xea17eb[_0xd285('0x42')]=[{'all':!![]}];}_0xea17eb=_[_0xd285('0x3d')]({},_0xea17eb,_0x2ddaf5[_0xd285('0x46')]);return db[_0xd285('0x40')][_0xd285('0x47')](_0xea17eb)[_0xd285('0x22')](handleEntityNotFound(_0x2ae0a2,null))[_0xd285('0x22')](respondWithResult(_0x2ae0a2,null))[_0xd285('0x48')](handleError(_0x2ae0a2,null));};exports[_0xd285('0x49')]=function(_0x103458,_0x698ac9){return db[_0xd285('0x40')]['create'](_0x103458['body'],{})[_0xd285('0x22')](function(_0x3dc302){var _0x11115a=_0x103458['user'][_0xd285('0x23')]({'plain':!![]});if(!_0x11115a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11115a[_0xd285('0x4a')]===_0xd285('0x4b')){var _0x22506d=_0x3dc302[_0xd285('0x23')]({'plain':!![]});var _0x1e5833='ExtractedReports';return db[_0xd285('0x4c')][_0xd285('0x47')]({'where':{'name':_0x1e5833,'userProfileId':_0x11115a[_0xd285('0x4d')]},'raw':!![]})[_0xd285('0x22')](function(_0x50011d){if(_0x50011d&&_0x50011d['autoAssociation']===0x0){return db[_0xd285('0x25')]['create']({'name':_0x22506d['name'],'resourceId':_0x22506d['id'],'type':_0x50011d[_0xd285('0x2a')],'sectionId':_0x50011d['id']},{})['then'](function(){return _0x3dc302;});}else{return _0x3dc302;}})['catch'](function(_0x4e2c82){logger[_0xd285('0x28')](_0xd285('0x4e'),_0x4e2c82);throw _0x4e2c82;});}return _0x3dc302;})['then'](respondWithResult(_0x698ac9,0xc9))[_0xd285('0x48')](handleError(_0x698ac9,null));};exports[_0xd285('0x4f')]=function(_0x30dada,_0x346148){if(_0x30dada[_0xd285('0x50')]['id']){delete _0x30dada[_0xd285('0x50')]['id'];}return db[_0xd285('0x40')][_0xd285('0x47')]({'where':{'id':_0x30dada[_0xd285('0x51')]['id']}})[_0xd285('0x22')](handleEntityNotFound(_0x346148,null))['then'](saveUpdates(_0x30dada[_0xd285('0x50')],null))[_0xd285('0x22')](respondWithResult(_0x346148,null))['catch'](handleError(_0x346148,null));};exports['destroy']=function(_0x4893e6,_0x11ce9b){return db[_0xd285('0x40')][_0xd285('0x47')]({'where':{'id':_0x4893e6[_0xd285('0x51')]['id']}})['then'](handleEntityNotFound(_0x11ce9b,null))[_0xd285('0x22')](removeEntity(_0x11ce9b,null))['catch'](handleError(_0x11ce9b,null));};exports[_0xd285('0x52')]=function(_0x305072,_0x5ddeb8,_0xd3a865){return db['AnalyticExtractedReport'][_0xd285('0x47')]({'where':{'id':_0x305072[_0xd285('0x51')]['id']},'attributes':[_0xd285('0x2a'),_0xd285('0x53'),'savename',_0xd285('0x54')],'raw':!![]})[_0xd285('0x22')](handleEntityNotFound(_0x5ddeb8,null))['then'](function(_0x1f3fba){if(_0x1f3fba){if(!fs[_0xd285('0x55')](path[_0xd285('0x56')](config[_0xd285('0x57')],_0xd285('0x58'),_0x1f3fba[_0xd285('0x59')]))){throw new db['Sequelize'][(_0xd285('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x305072[_0xd285('0x30')][_0xd285('0x5b')]){return _0x5ddeb8[_0xd285('0x5c')](0xc8);}return _0x5ddeb8[_0xd285('0x52')](path[_0xd285('0x56')](config['root'],_0xd285('0x58'),_0x1f3fba[_0xd285('0x59')]),util[_0xd285('0x5d')](_0xd285('0x5e'),_0x1f3fba['basename']||_0x1f3fba[_0xd285('0x2a')],_0x1f3fba[_0xd285('0x54')][_0xd285('0x5f')]()));}})[_0xd285('0x48')](handleError(_0x5ddeb8,null));}; \ No newline at end of file +var _0x2480=['json','offset','undefined','count','limit','set','Content-Range','reject','update','then','get','ExtractedReports','destroy','error','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','AnalyticExtractedReport','include','findAll','rows','catch','show','includeAll','options','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','params','basename','savename','output','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0x2480,0xf9));var _0x0248=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2480[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x0248('0x0'));var rimraf=require(_0x0248('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0248('0x2'));var rp=require('request-promise');var moment=require(_0x0248('0x3'));var BPromise=require(_0x0248('0x4'));var Mustache=require(_0x0248('0x5'));var util=require(_0x0248('0x6'));var path=require('path');var sox=require(_0x0248('0x7'));var csv=require(_0x0248('0x8'));var ejs=require(_0x0248('0x9'));var fs=require('fs');var fs_extra=require(_0x0248('0xa'));var _=require(_0x0248('0xb'));var squel=require('squel');var crypto=require(_0x0248('0xc'));var jsforce=require(_0x0248('0xd'));var deskjs=require(_0x0248('0xe'));var toCsv=require(_0x0248('0x8'));var querystring=require('querystring');var Papa=require(_0x0248('0xf'));var Redis=require(_0x0248('0x10'));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(_0x0248('0x11'))('api');var utils=require(_0x0248('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0248('0x13'));var db=require(_0x0248('0x14'))['db'];function respondWithStatusCode(_0xe214ab,_0x19c3a4){_0x19c3a4=_0x19c3a4||0xcc;return function(_0x2f3ba2){if(_0x2f3ba2){return _0xe214ab[_0x0248('0x15')](_0x19c3a4);}return _0xe214ab[_0x0248('0x16')](_0x19c3a4)[_0x0248('0x17')]();};}function respondWithResult(_0x248ec3,_0x72c384){_0x72c384=_0x72c384||0xc8;return function(_0xf6f283){if(_0xf6f283){return _0x248ec3[_0x0248('0x16')](_0x72c384)[_0x0248('0x18')](_0xf6f283);}};}function respondWithFilteredResult(_0xd1eb9,_0x4b6132){return function(_0x4db360){if(_0x4db360){var _0x1048f2=typeof _0x4b6132[_0x0248('0x19')]===_0x0248('0x1a')&&typeof _0x4b6132['limit']===_0x0248('0x1a');var _0x39e626=_0x4db360[_0x0248('0x1b')];var _0x3b74c3=_0x1048f2?0x0:_0x4b6132[_0x0248('0x19')];var _0x368a65=_0x1048f2?_0x4db360[_0x0248('0x1b')]:_0x4b6132['offset']+_0x4b6132[_0x0248('0x1c')];var _0x972725;if(_0x368a65>=_0x39e626){_0x368a65=_0x39e626;_0x972725=0xc8;}else{_0x972725=0xce;}_0xd1eb9[_0x0248('0x16')](_0x972725);return _0xd1eb9[_0x0248('0x1d')](_0x0248('0x1e'),_0x3b74c3+'-'+_0x368a65+'/'+_0x39e626)[_0x0248('0x18')](_0x4db360);}return null;};}function patchUpdates(_0xb2a949){return function(_0x52113a){try{jsonpatch['apply'](_0x52113a,_0xb2a949,!![]);}catch(_0x46090b){return BPromise[_0x0248('0x1f')](_0x46090b);}return _0x52113a['save']();};}function saveUpdates(_0x3e5374,_0x512ae4){return function(_0x367127){if(_0x367127){return _0x367127[_0x0248('0x20')](_0x3e5374)[_0x0248('0x21')](function(_0x3d5c7b){return _0x3d5c7b;});}return null;};}function removeEntity(_0x36f5aa,_0xfc0fff){return function(_0x390086){if(_0x390086){return _0x390086['destroy']()[_0x0248('0x21')](function(){var _0x45ae17=_0x390086[_0x0248('0x22')]({'plain':!![]});var _0x458c80=_0x0248('0x23');return db['UserProfileResource'][_0x0248('0x24')]({'where':{'type':_0x458c80,'resourceId':_0x45ae17['id']}})[_0x0248('0x21')](function(){return _0x390086;});})[_0x0248('0x21')](function(){_0x36f5aa['status'](0xcc)[_0x0248('0x17')]();});}};}function handleEntityNotFound(_0x1e1793,_0x19a040){return function(_0x4a5e86){if(!_0x4a5e86){_0x1e1793[_0x0248('0x15')](0x194);}return _0x4a5e86;};}function handleError(_0x372ac5,_0x5ab758){_0x5ab758=_0x5ab758||0x1f4;return function(_0x21814d){logger[_0x0248('0x25')](_0x21814d['stack']);if(_0x21814d[_0x0248('0x26')]){delete _0x21814d[_0x0248('0x26')];}_0x372ac5['status'](_0x5ab758)[_0x0248('0x27')](_0x21814d);};}exports[_0x0248('0x28')]=function(_0x2ab0aa,_0x4e9781){var _0x45fe37={},_0xc7bdc3={},_0x16bcb6={'count':0x0,'rows':[]};var _0x336cec=_['map'](db['AnalyticExtractedReport'][_0x0248('0x29')],function(_0x18d73b){return{'name':_0x18d73b['fieldName'],'type':_0x18d73b[_0x0248('0x2a')][_0x0248('0x2b')]};});_0xc7bdc3[_0x0248('0x2c')]=_[_0x0248('0x2d')](_0x336cec,_0x0248('0x26'));_0xc7bdc3[_0x0248('0x2e')]=_[_0x0248('0x2f')](_0x2ab0aa[_0x0248('0x2e')]);_0xc7bdc3[_0x0248('0x30')]=_[_0x0248('0x31')](_0xc7bdc3['model'],_0xc7bdc3['query']);_0x45fe37[_0x0248('0x32')]=_[_0x0248('0x31')](_0xc7bdc3[_0x0248('0x2c')],qs[_0x0248('0x33')](_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x33')]));_0x45fe37[_0x0248('0x32')]=_0x45fe37[_0x0248('0x32')][_0x0248('0x34')]?_0x45fe37[_0x0248('0x32')]:_0xc7bdc3[_0x0248('0x2c')];if(!_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x35')](_0x0248('0x36'))){_0x45fe37[_0x0248('0x1c')]=qs['limit'](_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x1c')]);_0x45fe37['offset']=qs[_0x0248('0x19')](_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x19')]);}_0x45fe37[_0x0248('0x37')]=qs['sort'](_0x2ab0aa['query'][_0x0248('0x38')]);_0x45fe37['where']=qs[_0x0248('0x30')](_[_0x0248('0x39')](_0x2ab0aa['query'],_0xc7bdc3[_0x0248('0x30')]),_0x336cec);if(_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x3a')]){_0x45fe37[_0x0248('0x3b')]=_[_0x0248('0x3c')](_0x45fe37[_0x0248('0x3b')],{'$or':_[_0x0248('0x2d')](_0x336cec,function(_0x31eedf){if(_0x31eedf[_0x0248('0x2a')]!==_0x0248('0x3d')){var _0x24cd20={};_0x24cd20[_0x31eedf[_0x0248('0x26')]]={'$like':'%'+_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x3a')]+'%'};return _0x24cd20;}})});}_0x45fe37=_['merge']({},_0x45fe37,_0x2ab0aa['options']);var _0x18d078={'where':_0x45fe37[_0x0248('0x3b')]};return db[_0x0248('0x3e')][_0x0248('0x1b')](_0x18d078)['then'](function(_0x597f82){_0x16bcb6[_0x0248('0x1b')]=_0x597f82;if(_0x2ab0aa[_0x0248('0x2e')]['includeAll']){_0x45fe37[_0x0248('0x3f')]=[{'all':!![]}];}return db[_0x0248('0x3e')][_0x0248('0x40')](_0x45fe37);})[_0x0248('0x21')](function(_0x1876f9){_0x16bcb6[_0x0248('0x41')]=_0x1876f9;return _0x16bcb6;})[_0x0248('0x21')](respondWithFilteredResult(_0x4e9781,_0x45fe37))[_0x0248('0x42')](handleError(_0x4e9781,null));};exports[_0x0248('0x43')]=function(_0x57fd34,_0x2e8ffd){var _0x3eea91={'raw':!![],'where':{'id':_0x57fd34['params']['id']}},_0x540964={};_0x540964['model']=_['keys'](db[_0x0248('0x3e')][_0x0248('0x29')]);_0x540964[_0x0248('0x2e')]=_[_0x0248('0x2f')](_0x57fd34[_0x0248('0x2e')]);_0x540964[_0x0248('0x30')]=_['intersection'](_0x540964[_0x0248('0x2c')],_0x540964[_0x0248('0x2e')]);_0x3eea91['attributes']=_[_0x0248('0x31')](_0x540964[_0x0248('0x2c')],qs[_0x0248('0x33')](_0x57fd34[_0x0248('0x2e')][_0x0248('0x33')]));_0x3eea91['attributes']=_0x3eea91[_0x0248('0x32')][_0x0248('0x34')]?_0x3eea91[_0x0248('0x32')]:_0x540964[_0x0248('0x2c')];if(_0x57fd34[_0x0248('0x2e')][_0x0248('0x44')]){_0x3eea91[_0x0248('0x3f')]=[{'all':!![]}];}_0x3eea91=_[_0x0248('0x3c')]({},_0x3eea91,_0x57fd34[_0x0248('0x45')]);return db[_0x0248('0x3e')][_0x0248('0x46')](_0x3eea91)[_0x0248('0x21')](handleEntityNotFound(_0x2e8ffd,null))['then'](respondWithResult(_0x2e8ffd,null))[_0x0248('0x42')](handleError(_0x2e8ffd,null));};exports[_0x0248('0x47')]=function(_0x5501fa,_0x54b169){return db[_0x0248('0x3e')][_0x0248('0x47')](_0x5501fa[_0x0248('0x48')],{})['then'](function(_0x13cd61){var _0x600898=_0x5501fa[_0x0248('0x49')]['get']({'plain':!![]});if(!_0x600898)throw new Error(_0x0248('0x4a'));if(_0x600898[_0x0248('0x4b')]===_0x0248('0x49')){var _0x78aeeb=_0x13cd61[_0x0248('0x22')]({'plain':!![]});var _0x5a4a00='ExtractedReports';return db[_0x0248('0x4c')][_0x0248('0x46')]({'where':{'name':_0x5a4a00,'userProfileId':_0x600898['userProfileId']},'raw':!![]})['then'](function(_0x91edfa){if(_0x91edfa&&_0x91edfa[_0x0248('0x4d')]===0x0){return db[_0x0248('0x4e')]['create']({'name':_0x78aeeb[_0x0248('0x26')],'resourceId':_0x78aeeb['id'],'type':_0x91edfa[_0x0248('0x26')],'sectionId':_0x91edfa['id']},{})[_0x0248('0x21')](function(){return _0x13cd61;});}else{return _0x13cd61;}})[_0x0248('0x42')](function(_0xf5d7b3){logger[_0x0248('0x25')](_0x0248('0x4f'),_0xf5d7b3);throw _0xf5d7b3;});}return _0x13cd61;})[_0x0248('0x21')](respondWithResult(_0x54b169,0xc9))[_0x0248('0x42')](handleError(_0x54b169,null));};exports[_0x0248('0x20')]=function(_0x165668,_0x252f03){if(_0x165668['body']['id']){delete _0x165668[_0x0248('0x48')]['id'];}return db[_0x0248('0x3e')][_0x0248('0x46')]({'where':{'id':_0x165668[_0x0248('0x50')]['id']}})['then'](handleEntityNotFound(_0x252f03,null))[_0x0248('0x21')](saveUpdates(_0x165668[_0x0248('0x48')],null))['then'](respondWithResult(_0x252f03,null))[_0x0248('0x42')](handleError(_0x252f03,null));};exports[_0x0248('0x24')]=function(_0x242685,_0x34f9f3){return db[_0x0248('0x3e')][_0x0248('0x46')]({'where':{'id':_0x242685[_0x0248('0x50')]['id']}})[_0x0248('0x21')](handleEntityNotFound(_0x34f9f3,null))[_0x0248('0x21')](removeEntity(_0x34f9f3,null))[_0x0248('0x42')](handleError(_0x34f9f3,null));};exports['download']=function(_0x5759bb,_0x171be8,_0x1c555e){return db['AnalyticExtractedReport'][_0x0248('0x46')]({'where':{'id':_0x5759bb[_0x0248('0x50')]['id']},'attributes':['name',_0x0248('0x51'),_0x0248('0x52'),_0x0248('0x53')],'raw':!![]})[_0x0248('0x21')](handleEntityNotFound(_0x171be8,null))[_0x0248('0x21')](function(_0x31f19d){if(_0x31f19d){if(!fs[_0x0248('0x54')](path['join'](config['root'],_0x0248('0x55'),_0x31f19d[_0x0248('0x52')]))){throw new db[(_0x0248('0x56'))][(_0x0248('0x57'))](_0x0248('0x58'));}if(_0x5759bb[_0x0248('0x2e')][_0x0248('0x59')]){return _0x171be8['sendStatus'](0xc8);}return _0x171be8['download'](path['join'](config['root'],'server/files/reports',_0x31f19d[_0x0248('0x52')]),util[_0x0248('0x5a')]('%s.%s',_0x31f19d[_0x0248('0x51')]||_0x31f19d[_0x0248('0x26')],_0x31f19d[_0x0248('0x53')]['toLowerCase']()));}})[_0x0248('0x42')](handleError(_0x171be8,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index a870327..195c4ce 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 _0xe2fe=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xe2fe,0x145));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require(_0xee2f('0x1'));var logger=require(_0xee2f('0x2'))('api');var moment=require(_0xee2f('0x3'));var BPromise=require(_0xee2f('0x4'));var rp=require(_0xee2f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee2f('0x6'));var config=require(_0xee2f('0x7'));var attributes=require(_0xee2f('0x8'));module[_0xee2f('0x9')]=function(_0x27778d,_0x14c426){return _0x27778d[_0xee2f('0xa')](_0xee2f('0xb'),attributes,{'tableName':_0xee2f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b90=['rimraf','../../config/environment','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x247cf7,_0x2abdc8){var _0x543e9a=function(_0x48c933){while(--_0x48c933){_0x247cf7['push'](_0x247cf7['shift']());}};_0x543e9a(++_0x2abdc8);}(_0x9b90,0x119));var _0x09b9=function(_0x4b47af,_0x2bc976){_0x4b47af=_0x4b47af-0x0;var _0x33a8ff=_0x9b90[_0x4b47af];return _0x33a8ff;};'use strict';var _=require(_0x09b9('0x0'));var util=require(_0x09b9('0x1'));var logger=require(_0x09b9('0x2'))('api');var moment=require(_0x09b9('0x3'));var BPromise=require(_0x09b9('0x4'));var rp=require(_0x09b9('0x5'));var fs=require('fs');var path=require(_0x09b9('0x6'));var rimraf=require(_0x09b9('0x7'));var config=require(_0x09b9('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0x09b9('0x9')]=function(_0x3da87d,_0x465603){return _0x3da87d[_0x09b9('0xa')](_0x09b9('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 83e9e9a..445b97b 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 _0x1832=['error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x450f86,_0x36862b){var _0x34f18b=function(_0x2bba63){while(--_0x2bba63){_0x450f86['push'](_0x450f86['shift']());}};_0x34f18b(++_0x36862b);}(_0x1832,0xad));var _0x2183=function(_0x52405a,_0x2b3071){_0x52405a=_0x52405a-0x0;var _0x443b9c=_0x1832[_0x52405a];return _0x443b9c;};'use strict';var _=require(_0x2183('0x0'));var util=require('util');var moment=require(_0x2183('0x1'));var BPromise=require(_0x2183('0x2'));var rs=require(_0x2183('0x3'));var fs=require('fs');var Redis=require(_0x2183('0x4'));var db=require(_0x2183('0x5'))['db'];var utils=require(_0x2183('0x6'));var logger=require(_0x2183('0x7'))(_0x2183('0x8'));var config=require(_0x2183('0x9'));var jayson=require(_0x2183('0xa'));var client=jayson[_0x2183('0xb')][_0x2183('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x93cd4c,_0x623957,_0x5e9151){return new BPromise(function(_0x52e76f,_0x5193de){return client['request'](_0x93cd4c,_0x5e9151)[_0x2183('0xd')](function(_0x3d6566){logger[_0x2183('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x623957,_0x2183('0xf'));logger[_0x2183('0x10')](_0x2183('0x11'),_0x623957,_0x2183('0xf'),JSON[_0x2183('0x12')](_0x3d6566));if(_0x3d6566[_0x2183('0x13')]){if(_0x3d6566[_0x2183('0x13')][_0x2183('0x14')]===0x1f4){logger[_0x2183('0x13')](_0x2183('0x15'),_0x623957,_0x3d6566[_0x2183('0x13')]['message']);return _0x5193de(_0x3d6566[_0x2183('0x13')][_0x2183('0x16')]);}logger['error'](_0x2183('0x15'),_0x623957,_0x3d6566[_0x2183('0x13')][_0x2183('0x16')]);return _0x52e76f(_0x3d6566[_0x2183('0x13')]['message']);}else{logger[_0x2183('0xe')](_0x2183('0x15'),_0x623957,'request\x20sent');_0x52e76f(_0x3d6566[_0x2183('0x17')][_0x2183('0x16')]);}})['catch'](function(_0x2defcd){logger[_0x2183('0x13')](_0x2183('0x15'),_0x623957,_0x2defcd);_0x5193de(_0x2defcd);});});} \ No newline at end of file +var _0x8226=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x56242d,_0x1dd061){var _0x5d7033=function(_0x11c707){while(--_0x11c707){_0x56242d['push'](_0x56242d['shift']());}};_0x5d7033(++_0x1dd061);}(_0x8226,0xe7));var _0x6822=function(_0x9e05d1,_0x3cef4a){_0x9e05d1=_0x9e05d1-0x0;var _0x4f7e97=_0x8226[_0x9e05d1];return _0x4f7e97;};'use strict';var _=require(_0x6822('0x0'));var util=require('util');var moment=require(_0x6822('0x1'));var BPromise=require(_0x6822('0x2'));var rs=require(_0x6822('0x3'));var fs=require('fs');var Redis=require(_0x6822('0x4'));var db=require(_0x6822('0x5'))['db'];var utils=require(_0x6822('0x6'));var logger=require(_0x6822('0x7'))(_0x6822('0x8'));var config=require(_0x6822('0x9'));var jayson=require(_0x6822('0xa'));var client=jayson[_0x6822('0xb')][_0x6822('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48dfd0,_0x2c7ea5,_0x4fbf59){return new BPromise(function(_0x56a7fe,_0x2c94cf){return client[_0x6822('0xd')](_0x48dfd0,_0x4fbf59)[_0x6822('0xe')](function(_0x28e7e9){logger[_0x6822('0xf')](_0x6822('0x10'),_0x2c7ea5,_0x6822('0x11'));logger[_0x6822('0x12')](_0x6822('0x13'),_0x2c7ea5,'request\x20sent',JSON[_0x6822('0x14')](_0x28e7e9));if(_0x28e7e9[_0x6822('0x15')]){if(_0x28e7e9[_0x6822('0x15')][_0x6822('0x16')]===0x1f4){logger['error'](_0x6822('0x10'),_0x2c7ea5,_0x28e7e9['error'][_0x6822('0x17')]);return _0x2c94cf(_0x28e7e9[_0x6822('0x15')][_0x6822('0x17')]);}logger[_0x6822('0x15')](_0x6822('0x10'),_0x2c7ea5,_0x28e7e9[_0x6822('0x15')][_0x6822('0x17')]);return _0x56a7fe(_0x28e7e9[_0x6822('0x15')][_0x6822('0x17')]);}else{logger[_0x6822('0xf')](_0x6822('0x10'),_0x2c7ea5,_0x6822('0x11'));_0x56a7fe(_0x28e7e9[_0x6822('0x18')][_0x6822('0x17')]);}})[_0x6822('0x19')](function(_0xb363a){logger[_0x6822('0x15')](_0x6822('0x10'),_0x2c7ea5,_0xb363a);_0x2c94cf(_0xb363a);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 07da0c0..8284c37 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 _0x1d55=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','update','delete','destroy'];(function(_0x6c5dc0,_0x346ed9){var _0x43d9f9=function(_0x3888c5){while(--_0x3888c5){_0x6c5dc0['push'](_0x6c5dc0['shift']());}};_0x43d9f9(++_0x346ed9);}(_0x1d55,0x191));var _0x51d5=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x1d55[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0x51d5('0x0'));var util=require(_0x51d5('0x1'));var path=require(_0x51d5('0x2'));var timeout=require('connect-timeout');var express=require(_0x51d5('0x3'));var router=express[_0x51d5('0x4')]();var fs_extra=require(_0x51d5('0x5'));var auth=require(_0x51d5('0x6'));var interaction=require(_0x51d5('0x7'));var config=require('../../config/environment');var controller=require(_0x51d5('0x8'));router[_0x51d5('0x9')]('/',auth[_0x51d5('0xa')](),controller['index']);router[_0x51d5('0x9')](_0x51d5('0xb'),auth[_0x51d5('0xa')](),controller[_0x51d5('0xc')]);router[_0x51d5('0x9')](_0x51d5('0xd'),auth['isAuthenticated'](),controller[_0x51d5('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x51d5('0xf')]);router['put'](_0x51d5('0xb'),auth[_0x51d5('0xa')](),controller[_0x51d5('0x10')]);router[_0x51d5('0x11')](_0x51d5('0xb'),auth[_0x51d5('0xa')](),controller[_0x51d5('0x12')]);module[_0x51d5('0x13')]=router; \ No newline at end of file +var _0xfb4f=['../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0xfb4f,0x113));var _0xffb4=function(_0x4e7280,_0x3dd19c){_0x4e7280=_0x4e7280-0x0;var _0x4dcc3a=_0xfb4f[_0x4e7280];return _0x4dcc3a;};'use strict';var multer=require(_0xffb4('0x0'));var util=require('util');var path=require(_0xffb4('0x1'));var timeout=require(_0xffb4('0x2'));var express=require('express');var router=express[_0xffb4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xffb4('0x4'));var interaction=require(_0xffb4('0x5'));var config=require(_0xffb4('0x6'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xffb4('0x7')]);router[_0xffb4('0x8')](_0xffb4('0x9'),auth[_0xffb4('0xa')](),controller[_0xffb4('0xb')]);router['get'](_0xffb4('0xc'),auth[_0xffb4('0xa')](),controller[_0xffb4('0xd')]);router[_0xffb4('0xe')]('/',auth[_0xffb4('0xa')](),controller[_0xffb4('0xf')]);router[_0xffb4('0x10')]('/:id',auth[_0xffb4('0xa')](),controller[_0xffb4('0x11')]);router[_0xffb4('0x12')](_0xffb4('0x9'),auth[_0xffb4('0xa')](),controller[_0xffb4('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index ede5683..4a66c21 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 _0xd586=['STRING','BOOLEAN'];(function(_0x1711ea,_0xfab5d3){var _0xe7d8e3=function(_0x23b6f6){while(--_0x23b6f6){_0x1711ea['push'](_0x1711ea['shift']());}};_0xe7d8e3(++_0xfab5d3);}(_0xd586,0xe2));var _0x6d58=function(_0x46376f,_0x1315c1){_0x46376f=_0x46376f-0x0;var _0x344dc4=_0xd586[_0x46376f];return _0x344dc4;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x6d58('0x0')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x6d58('0x0')]},'groupBy':{'type':Sequelize[_0x6d58('0x1')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x6d58('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x502b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x32bfd4,_0x52f0eb){var _0x36ed14=function(_0xdbc892){while(--_0xdbc892){_0x32bfd4['push'](_0x32bfd4['shift']());}};_0x36ed14(++_0x52f0eb);}(_0x502b,0xda));var _0xb502=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x502b[_0x340380];return _0x49ce1c;};'use strict';var Sequelize=require(_0xb502('0x0'));module[_0xb502('0x1')]={'field':{'type':Sequelize[_0xb502('0x2')]},'alias':{'type':Sequelize[_0xb502('0x3')]},'function':{'type':Sequelize[_0xb502('0x3')]},'format':{'type':Sequelize[_0xb502('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xb502('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 701dc7f..73bbcac 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 _0x847f=['rows','catch','params','keys','options','find','create','body','destroy','ids','addFields','AnalyticCustomReport','sequelize','CustomReportId','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','AnalyticFieldReport','includeAll','include'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x847f,0xa8));var _0xf847=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0x847f[_0x5090d4];return _0x56c310;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf847('0x0'));var zipdir=require(_0xf847('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf847('0x2'));var moment=require(_0xf847('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf847('0x4'));var util=require(_0xf847('0x5'));var path=require(_0xf847('0x6'));var sox=require('sox');var csv=require(_0xf847('0x7'));var ejs=require(_0xf847('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf847('0x9'));var squel=require(_0xf847('0xa'));var crypto=require(_0xf847('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf847('0xc'));var toCsv=require(_0xf847('0x7'));var querystring=require(_0xf847('0xd'));var Papa=require(_0xf847('0xe'));var Redis=require(_0xf847('0xf'));var authService=require(_0xf847('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf847('0x11'));var hardwareService=require(_0xf847('0x12'));var logger=require(_0xf847('0x13'))('api');var utils=require(_0xf847('0x14'));var config=require(_0xf847('0x15'));var licenseUtil=require(_0xf847('0x16'));var db=require(_0xf847('0x17'))['db'];function respondWithStatusCode(_0x568bf6,_0x514518){_0x514518=_0x514518||0xcc;return function(_0x446f67){if(_0x446f67){return _0x568bf6['sendStatus'](_0x514518);}return _0x568bf6[_0xf847('0x18')](_0x514518)[_0xf847('0x19')]();};}function respondWithResult(_0x30c6ba,_0x4e03cb){_0x4e03cb=_0x4e03cb||0xc8;return function(_0x3f58b2){if(_0x3f58b2){return _0x30c6ba['status'](_0x4e03cb)['json'](_0x3f58b2);}};}function respondWithFilteredResult(_0x106e53,_0x4773a8){return function(_0x4c5810){if(_0x4c5810){var _0x1bdc5b=typeof _0x4773a8[_0xf847('0x1a')]===_0xf847('0x1b')&&typeof _0x4773a8[_0xf847('0x1c')]===_0xf847('0x1b');var _0x1df83d=_0x4c5810[_0xf847('0x1d')];var _0x11c1ff=_0x1bdc5b?0x0:_0x4773a8[_0xf847('0x1a')];var _0x36f4ec=_0x1bdc5b?_0x4c5810['count']:_0x4773a8[_0xf847('0x1a')]+_0x4773a8[_0xf847('0x1c')];var _0x43fe5e;if(_0x36f4ec>=_0x1df83d){_0x36f4ec=_0x1df83d;_0x43fe5e=0xc8;}else{_0x43fe5e=0xce;}_0x106e53[_0xf847('0x18')](_0x43fe5e);return _0x106e53[_0xf847('0x1e')](_0xf847('0x1f'),_0x11c1ff+'-'+_0x36f4ec+'/'+_0x1df83d)['json'](_0x4c5810);}return null;};}function patchUpdates(_0x1aa35c){return function(_0x35b91b){try{jsonpatch[_0xf847('0x20')](_0x35b91b,_0x1aa35c,!![]);}catch(_0x32ab80){return BPromise['reject'](_0x32ab80);}return _0x35b91b['save']();};}function saveUpdates(_0x22a9f1,_0x356665){return function(_0x247603){if(_0x247603){return _0x247603[_0xf847('0x21')](_0x22a9f1)[_0xf847('0x22')](function(_0x25d44a){return _0x25d44a;});}return null;};}function removeEntity(_0x485ac4,_0x587cd0){return function(_0x5a535d){if(_0x5a535d){return _0x5a535d['destroy']()['then'](function(){_0x485ac4[_0xf847('0x18')](0xcc)[_0xf847('0x19')]();});}};}function handleEntityNotFound(_0x282e21,_0x48fbd2){return function(_0xd3bcb2){if(!_0xd3bcb2){_0x282e21[_0xf847('0x23')](0x194);}return _0xd3bcb2;};}function handleError(_0x5b16fc,_0x1cad44){_0x1cad44=_0x1cad44||0x1f4;return function(_0x52ec17){logger[_0xf847('0x24')](_0x52ec17['stack']);if(_0x52ec17[_0xf847('0x25')]){delete _0x52ec17[_0xf847('0x25')];}_0x5b16fc[_0xf847('0x18')](_0x1cad44)[_0xf847('0x26')](_0x52ec17);};}exports[_0xf847('0x27')]=function(_0x2531e4,_0x242003){var _0x21b65d={},_0x39ff1b={},_0x3072ba={'count':0x0,'rows':[]};var _0x2e35cc=_[_0xf847('0x28')](db['AnalyticFieldReport'][_0xf847('0x29')],function(_0x401cee){return{'name':_0x401cee[_0xf847('0x2a')],'type':_0x401cee[_0xf847('0x2b')][_0xf847('0x2c')]};});_0x39ff1b[_0xf847('0x2d')]=_['map'](_0x2e35cc,'name');_0x39ff1b[_0xf847('0x2e')]=_['keys'](_0x2531e4[_0xf847('0x2e')]);_0x39ff1b['filters']=_[_0xf847('0x2f')](_0x39ff1b[_0xf847('0x2d')],_0x39ff1b[_0xf847('0x2e')]);_0x21b65d[_0xf847('0x30')]=_[_0xf847('0x2f')](_0x39ff1b[_0xf847('0x2d')],qs[_0xf847('0x31')](_0x2531e4[_0xf847('0x2e')][_0xf847('0x31')]));_0x21b65d[_0xf847('0x30')]=_0x21b65d[_0xf847('0x30')][_0xf847('0x32')]?_0x21b65d[_0xf847('0x30')]:_0x39ff1b[_0xf847('0x2d')];if(!_0x2531e4[_0xf847('0x2e')][_0xf847('0x33')](_0xf847('0x34'))){_0x21b65d[_0xf847('0x1c')]=qs[_0xf847('0x1c')](_0x2531e4['query'][_0xf847('0x1c')]);_0x21b65d[_0xf847('0x1a')]=qs[_0xf847('0x1a')](_0x2531e4[_0xf847('0x2e')]['offset']);}_0x21b65d[_0xf847('0x35')]=qs[_0xf847('0x36')](_0x2531e4[_0xf847('0x2e')][_0xf847('0x36')]);_0x21b65d[_0xf847('0x37')]=qs[_0xf847('0x38')](_['pick'](_0x2531e4[_0xf847('0x2e')],_0x39ff1b['filters']),_0x2e35cc);if(_0x2531e4[_0xf847('0x2e')][_0xf847('0x39')]){_0x21b65d[_0xf847('0x37')]=_['merge'](_0x21b65d[_0xf847('0x37')],{'$or':_['map'](_0x2e35cc,function(_0x35fe95){if(_0x35fe95[_0xf847('0x2b')]!==_0xf847('0x3a')){var _0x35c42a={};_0x35c42a[_0x35fe95[_0xf847('0x25')]]={'$like':'%'+_0x2531e4[_0xf847('0x2e')][_0xf847('0x39')]+'%'};return _0x35c42a;}})});}_0x21b65d=_[_0xf847('0x3b')]({},_0x21b65d,_0x2531e4['options']);var _0xb25f43={'where':_0x21b65d['where']};return db[_0xf847('0x3c')]['count'](_0xb25f43)['then'](function(_0x204933){_0x3072ba[_0xf847('0x1d')]=_0x204933;if(_0x2531e4['query'][_0xf847('0x3d')]){_0x21b65d[_0xf847('0x3e')]=[{'all':!![]}];}return db[_0xf847('0x3c')]['findAll'](_0x21b65d);})['then'](function(_0x5afa5f){_0x3072ba[_0xf847('0x3f')]=_0x5afa5f;return _0x3072ba;})['then'](respondWithFilteredResult(_0x242003,_0x21b65d))[_0xf847('0x40')](handleError(_0x242003,null));};exports['show']=function(_0x1603ee,_0x3cadce){var _0x4094b9={'raw':![],'where':{'id':_0x1603ee[_0xf847('0x41')]['id']}},_0x11cd37={};_0x11cd37[_0xf847('0x2d')]=_[_0xf847('0x42')](db[_0xf847('0x3c')]['rawAttributes']);_0x11cd37[_0xf847('0x2e')]=_[_0xf847('0x42')](_0x1603ee[_0xf847('0x2e')]);_0x11cd37[_0xf847('0x38')]=_[_0xf847('0x2f')](_0x11cd37[_0xf847('0x2d')],_0x11cd37[_0xf847('0x2e')]);_0x4094b9['attributes']=_[_0xf847('0x2f')](_0x11cd37[_0xf847('0x2d')],qs[_0xf847('0x31')](_0x1603ee['query']['fields']));_0x4094b9[_0xf847('0x30')]=_0x4094b9[_0xf847('0x30')][_0xf847('0x32')]?_0x4094b9['attributes']:_0x11cd37[_0xf847('0x2d')];if(_0x1603ee[_0xf847('0x2e')][_0xf847('0x3d')]){_0x4094b9['include']=[{'all':!![]}];}_0x4094b9=_[_0xf847('0x3b')]({},_0x4094b9,_0x1603ee[_0xf847('0x43')]);return db[_0xf847('0x3c')][_0xf847('0x44')](_0x4094b9)[_0xf847('0x22')](handleEntityNotFound(_0x3cadce,null))[_0xf847('0x22')](respondWithResult(_0x3cadce,null))[_0xf847('0x40')](handleError(_0x3cadce,null));};exports['create']=function(_0x421c43,_0x7c33ad){return db[_0xf847('0x3c')][_0xf847('0x45')](_0x421c43[_0xf847('0x46')],{})[_0xf847('0x22')](respondWithResult(_0x7c33ad,0xc9))[_0xf847('0x40')](handleError(_0x7c33ad,null));};exports['bulkCreate']=function(_0x1bc797,_0x51f926){return db[_0xf847('0x3c')]['bulkCreate'](_0x1bc797[_0xf847('0x46')],{'raw':![],'individualHooks':!![]})[_0xf847('0x22')](respondWithResult(_0x51f926,0xc9))[_0xf847('0x40')](handleError(_0x51f926,null));};exports[_0xf847('0x21')]=function(_0x495428,_0x193914){if(_0x495428[_0xf847('0x46')]['id']){delete _0x495428[_0xf847('0x46')]['id'];}return db[_0xf847('0x3c')]['find']({'where':{'id':_0x495428['params']['id']}})[_0xf847('0x22')](handleEntityNotFound(_0x193914,null))['then'](saveUpdates(_0x495428['body'],null))['then'](respondWithResult(_0x193914,null))['catch'](handleError(_0x193914,null));};exports[_0xf847('0x47')]=function(_0x22f977,_0x38c3b2){return db['AnalyticFieldReport'][_0xf847('0x44')]({'where':{'id':_0x22f977[_0xf847('0x41')]['id']}})[_0xf847('0x22')](handleEntityNotFound(_0x38c3b2,null))[_0xf847('0x22')](removeEntity(_0x38c3b2,null))[_0xf847('0x40')](handleError(_0x38c3b2,null));};exports['bulkDestroy']=function(_0x32cb4b,_0x4372c5){return db[_0xf847('0x3c')][_0xf847('0x47')]({'where':{'id':_0x32cb4b[_0xf847('0x2e')][_0xf847('0x48')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4372c5,0xcc))[_0xf847('0x40')](handleError(_0x4372c5,null));};exports[_0xf847('0x49')]=function(_0x321a88,_0x2da82c,_0x5aab9a){return db[_0xf847('0x4a')]['findOne']({'where':{'id':_0x321a88[_0xf847('0x41')]['id']}})[_0xf847('0x22')](handleEntityNotFound(_0x2da82c,null))[_0xf847('0x22')](function(_0x3a501e){if(_0x3a501e){return db[_0xf847('0x4b')]['transaction'](function(_0x55eb60){return db[_0xf847('0x3c')][_0xf847('0x47')]({'where':{'CustomReportId':_0x321a88[_0xf847('0x41')]['id']},'transaction':_0x55eb60})[_0xf847('0x22')](function(_0xd717b8){var _0x446bbf=_[_0xf847('0x28')](_0x321a88[_0xf847('0x46')],function(_0x51e8a7){delete _0x51e8a7['id'];_0x51e8a7[_0xf847('0x4c')]=_0x321a88['params']['id'];return _0x51e8a7;});return db[_0xf847('0x3c')]['bulkCreate'](_0x446bbf,{'transaction':_0x55eb60});});})[_0xf847('0x22')](function(){return db[_0xf847('0x3c')]['findAll']({'where':{'CustomReportId':_0x321a88[_0xf847('0x41')]['id']}});});}})[_0xf847('0x22')](respondWithResult(_0x2da82c,null))[_0xf847('0x40')](handleError(_0x2da82c,null));}; \ No newline at end of file +var _0x52ae=['zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','fields','find','body','bulkCreate','update','destroy','findOne','sequelize','transaction','CustomReportId','findAll','rimraf'];(function(_0x2f5cb6,_0x2b2e01){var _0x486018=function(_0x5db0b0){while(--_0x5db0b0){_0x2f5cb6['push'](_0x2f5cb6['shift']());}};_0x486018(++_0x2b2e01);}(_0x52ae,0x1bb));var _0xe52a=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0x52ae[_0x2e6c19];return _0x52885d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe52a('0x0'));var zipdir=require(_0xe52a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe52a('0x2'));var BPromise=require(_0xe52a('0x3'));var Mustache=require(_0xe52a('0x4'));var util=require('util');var path=require(_0xe52a('0x5'));var sox=require(_0xe52a('0x6'));var csv=require(_0xe52a('0x7'));var ejs=require(_0xe52a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe52a('0x9'));var squel=require(_0xe52a('0xa'));var crypto=require(_0xe52a('0xb'));var jsforce=require(_0xe52a('0xc'));var deskjs=require(_0xe52a('0xd'));var toCsv=require(_0xe52a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe52a('0xe'));var qs=require(_0xe52a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe52a('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xe52a('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aa35a,_0x84db2e){_0x84db2e=_0x84db2e||0xcc;return function(_0x4b8e3d){if(_0x4b8e3d){return _0x2aa35a[_0xe52a('0x12')](_0x84db2e);}return _0x2aa35a[_0xe52a('0x13')](_0x84db2e)[_0xe52a('0x14')]();};}function respondWithResult(_0x5e9fc5,_0x4453a1){_0x4453a1=_0x4453a1||0xc8;return function(_0x467fa3){if(_0x467fa3){return _0x5e9fc5['status'](_0x4453a1)[_0xe52a('0x15')](_0x467fa3);}};}function respondWithFilteredResult(_0x42910a,_0x2c34ef){return function(_0x3716ca){if(_0x3716ca){var _0x363f77=typeof _0x2c34ef[_0xe52a('0x16')]===_0xe52a('0x17')&&typeof _0x2c34ef[_0xe52a('0x18')]==='undefined';var _0x1538ab=_0x3716ca[_0xe52a('0x19')];var _0x25fe5f=_0x363f77?0x0:_0x2c34ef[_0xe52a('0x16')];var _0x5e97ff=_0x363f77?_0x3716ca['count']:_0x2c34ef[_0xe52a('0x16')]+_0x2c34ef['limit'];var _0x37c3cc;if(_0x5e97ff>=_0x1538ab){_0x5e97ff=_0x1538ab;_0x37c3cc=0xc8;}else{_0x37c3cc=0xce;}_0x42910a[_0xe52a('0x13')](_0x37c3cc);return _0x42910a['set'](_0xe52a('0x1a'),_0x25fe5f+'-'+_0x5e97ff+'/'+_0x1538ab)[_0xe52a('0x15')](_0x3716ca);}return null;};}function patchUpdates(_0x20ba2c){return function(_0x1bf125){try{jsonpatch[_0xe52a('0x1b')](_0x1bf125,_0x20ba2c,!![]);}catch(_0x228aa4){return BPromise[_0xe52a('0x1c')](_0x228aa4);}return _0x1bf125[_0xe52a('0x1d')]();};}function saveUpdates(_0x431688,_0x64ea55){return function(_0xa3790){if(_0xa3790){return _0xa3790['update'](_0x431688)[_0xe52a('0x1e')](function(_0x3acb17){return _0x3acb17;});}return null;};}function removeEntity(_0x19c282,_0x120c02){return function(_0x236816){if(_0x236816){return _0x236816['destroy']()[_0xe52a('0x1e')](function(){_0x19c282[_0xe52a('0x13')](0xcc)[_0xe52a('0x14')]();});}};}function handleEntityNotFound(_0x476703,_0x538599){return function(_0x5a3145){if(!_0x5a3145){_0x476703[_0xe52a('0x12')](0x194);}return _0x5a3145;};}function handleError(_0x49cc61,_0x24bb07){_0x24bb07=_0x24bb07||0x1f4;return function(_0x464e0a){logger['error'](_0x464e0a[_0xe52a('0x1f')]);if(_0x464e0a[_0xe52a('0x20')]){delete _0x464e0a[_0xe52a('0x20')];}_0x49cc61[_0xe52a('0x13')](_0x24bb07)[_0xe52a('0x21')](_0x464e0a);};}exports[_0xe52a('0x22')]=function(_0x15eb1a,_0x234abb){var _0x4fe3fa={},_0x57bac1={},_0x5588ae={'count':0x0,'rows':[]};var _0x32c366=_[_0xe52a('0x23')](db[_0xe52a('0x24')][_0xe52a('0x25')],function(_0x4e0b5a){return{'name':_0x4e0b5a[_0xe52a('0x26')],'type':_0x4e0b5a[_0xe52a('0x27')][_0xe52a('0x28')]};});_0x57bac1[_0xe52a('0x29')]=_['map'](_0x32c366,_0xe52a('0x20'));_0x57bac1[_0xe52a('0x2a')]=_[_0xe52a('0x2b')](_0x15eb1a[_0xe52a('0x2a')]);_0x57bac1[_0xe52a('0x2c')]=_[_0xe52a('0x2d')](_0x57bac1[_0xe52a('0x29')],_0x57bac1['query']);_0x4fe3fa[_0xe52a('0x2e')]=_[_0xe52a('0x2d')](_0x57bac1[_0xe52a('0x29')],qs['fields'](_0x15eb1a[_0xe52a('0x2a')]['fields']));_0x4fe3fa[_0xe52a('0x2e')]=_0x4fe3fa[_0xe52a('0x2e')][_0xe52a('0x2f')]?_0x4fe3fa['attributes']:_0x57bac1[_0xe52a('0x29')];if(!_0x15eb1a[_0xe52a('0x2a')][_0xe52a('0x30')](_0xe52a('0x31'))){_0x4fe3fa[_0xe52a('0x18')]=qs[_0xe52a('0x18')](_0x15eb1a['query'][_0xe52a('0x18')]);_0x4fe3fa[_0xe52a('0x16')]=qs[_0xe52a('0x16')](_0x15eb1a[_0xe52a('0x2a')][_0xe52a('0x16')]);}_0x4fe3fa[_0xe52a('0x32')]=qs[_0xe52a('0x33')](_0x15eb1a[_0xe52a('0x2a')][_0xe52a('0x33')]);_0x4fe3fa['where']=qs[_0xe52a('0x2c')](_[_0xe52a('0x34')](_0x15eb1a['query'],_0x57bac1[_0xe52a('0x2c')]),_0x32c366);if(_0x15eb1a['query'][_0xe52a('0x35')]){_0x4fe3fa['where']=_['merge'](_0x4fe3fa['where'],{'$or':_[_0xe52a('0x23')](_0x32c366,function(_0x2c8e88){if(_0x2c8e88[_0xe52a('0x27')]!==_0xe52a('0x36')){var _0x5402ef={};_0x5402ef[_0x2c8e88[_0xe52a('0x20')]]={'$like':'%'+_0x15eb1a[_0xe52a('0x2a')][_0xe52a('0x35')]+'%'};return _0x5402ef;}})});}_0x4fe3fa=_[_0xe52a('0x37')]({},_0x4fe3fa,_0x15eb1a[_0xe52a('0x38')]);var _0x2f9478={'where':_0x4fe3fa['where']};return db['AnalyticFieldReport'][_0xe52a('0x19')](_0x2f9478)[_0xe52a('0x1e')](function(_0x2a9c34){_0x5588ae['count']=_0x2a9c34;if(_0x15eb1a['query'][_0xe52a('0x39')]){_0x4fe3fa[_0xe52a('0x3a')]=[{'all':!![]}];}return db[_0xe52a('0x24')]['findAll'](_0x4fe3fa);})[_0xe52a('0x1e')](function(_0x92a5a5){_0x5588ae[_0xe52a('0x3b')]=_0x92a5a5;return _0x5588ae;})[_0xe52a('0x1e')](respondWithFilteredResult(_0x234abb,_0x4fe3fa))[_0xe52a('0x3c')](handleError(_0x234abb,null));};exports[_0xe52a('0x3d')]=function(_0xe9f6a5,_0x227e79){var _0x1ba571={'raw':![],'where':{'id':_0xe9f6a5[_0xe52a('0x3e')]['id']}},_0x299ae0={};_0x299ae0['model']=_['keys'](db['AnalyticFieldReport']['rawAttributes']);_0x299ae0[_0xe52a('0x2a')]=_[_0xe52a('0x2b')](_0xe9f6a5[_0xe52a('0x2a')]);_0x299ae0[_0xe52a('0x2c')]=_['intersection'](_0x299ae0['model'],_0x299ae0[_0xe52a('0x2a')]);_0x1ba571[_0xe52a('0x2e')]=_[_0xe52a('0x2d')](_0x299ae0['model'],qs[_0xe52a('0x3f')](_0xe9f6a5['query'][_0xe52a('0x3f')]));_0x1ba571['attributes']=_0x1ba571[_0xe52a('0x2e')]['length']?_0x1ba571[_0xe52a('0x2e')]:_0x299ae0[_0xe52a('0x29')];if(_0xe9f6a5['query']['includeAll']){_0x1ba571[_0xe52a('0x3a')]=[{'all':!![]}];}_0x1ba571=_[_0xe52a('0x37')]({},_0x1ba571,_0xe9f6a5[_0xe52a('0x38')]);return db[_0xe52a('0x24')][_0xe52a('0x40')](_0x1ba571)[_0xe52a('0x1e')](handleEntityNotFound(_0x227e79,null))[_0xe52a('0x1e')](respondWithResult(_0x227e79,null))['catch'](handleError(_0x227e79,null));};exports['create']=function(_0x5792a1,_0xb63ac6){return db[_0xe52a('0x24')]['create'](_0x5792a1[_0xe52a('0x41')],{})[_0xe52a('0x1e')](respondWithResult(_0xb63ac6,0xc9))[_0xe52a('0x3c')](handleError(_0xb63ac6,null));};exports['bulkCreate']=function(_0x13f7ce,_0x164b50){return db[_0xe52a('0x24')][_0xe52a('0x42')](_0x13f7ce['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x164b50,0xc9))['catch'](handleError(_0x164b50,null));};exports[_0xe52a('0x43')]=function(_0x152546,_0x1dcc5e){if(_0x152546[_0xe52a('0x41')]['id']){delete _0x152546[_0xe52a('0x41')]['id'];}return db[_0xe52a('0x24')][_0xe52a('0x40')]({'where':{'id':_0x152546[_0xe52a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1dcc5e,null))[_0xe52a('0x1e')](saveUpdates(_0x152546[_0xe52a('0x41')],null))[_0xe52a('0x1e')](respondWithResult(_0x1dcc5e,null))[_0xe52a('0x3c')](handleError(_0x1dcc5e,null));};exports['destroy']=function(_0xb66fdf,_0x3c4f6a){return db[_0xe52a('0x24')][_0xe52a('0x40')]({'where':{'id':_0xb66fdf[_0xe52a('0x3e')]['id']}})[_0xe52a('0x1e')](handleEntityNotFound(_0x3c4f6a,null))[_0xe52a('0x1e')](removeEntity(_0x3c4f6a,null))[_0xe52a('0x3c')](handleError(_0x3c4f6a,null));};exports['bulkDestroy']=function(_0x1abb9b,_0x518403){return db[_0xe52a('0x24')][_0xe52a('0x44')]({'where':{'id':_0x1abb9b['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x518403,0xcc))[_0xe52a('0x3c')](handleError(_0x518403,null));};exports['addFields']=function(_0x5aef20,_0x37eb47,_0x4ecb4e){return db['AnalyticCustomReport'][_0xe52a('0x45')]({'where':{'id':_0x5aef20[_0xe52a('0x3e')]['id']}})[_0xe52a('0x1e')](handleEntityNotFound(_0x37eb47,null))[_0xe52a('0x1e')](function(_0xaae6e1){if(_0xaae6e1){return db[_0xe52a('0x46')][_0xe52a('0x47')](function(_0x10ec67){return db[_0xe52a('0x24')][_0xe52a('0x44')]({'where':{'CustomReportId':_0x5aef20[_0xe52a('0x3e')]['id']},'transaction':_0x10ec67})[_0xe52a('0x1e')](function(_0x3264ae){var _0x3fbf90=_['map'](_0x5aef20[_0xe52a('0x41')],function(_0x50b677){delete _0x50b677['id'];_0x50b677[_0xe52a('0x48')]=_0x5aef20[_0xe52a('0x3e')]['id'];return _0x50b677;});return db[_0xe52a('0x24')][_0xe52a('0x42')](_0x3fbf90,{'transaction':_0x10ec67});});})['then'](function(){return db[_0xe52a('0x24')][_0xe52a('0x49')]({'where':{'CustomReportId':_0x5aef20[_0xe52a('0x3e')]['id']}});});}})[_0xe52a('0x1e')](respondWithResult(_0x37eb47,null))['catch'](handleError(_0x37eb47,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index e2ebf35..af04e32 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 _0x0673=['exports','AnalyticFieldReport','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x0673,0xc8));var _0x3067=function(_0x3ec58a,_0x3ed8df){_0x3ec58a=_0x3ec58a-0x0;var _0x1a0c7b=_0x0673[_0x3ec58a];return _0x1a0c7b;};'use strict';var _=require(_0x3067('0x0'));var util=require(_0x3067('0x1'));var logger=require(_0x3067('0x2'))(_0x3067('0x3'));var moment=require(_0x3067('0x4'));var BPromise=require('bluebird');var rp=require(_0x3067('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3067('0x6'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x3067('0x7')]=function(_0xdcff5d,_0x4612cb){return _0xdcff5d['define'](_0x3067('0x8'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e2a=['path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52774f,_0x3c8b8a){var _0x255cab=function(_0x1900c1){while(--_0x1900c1){_0x52774f['push'](_0x52774f['shift']());}};_0x255cab(++_0x3c8b8a);}(_0x4e2a,0x18d));var _0xa4e2=function(_0x3130ef,_0x413941){_0x3130ef=_0x3130ef-0x0;var _0xab4e77=_0x4e2a[_0x3130ef];return _0xab4e77;};'use strict';var _=require(_0xa4e2('0x0'));var util=require('util');var logger=require(_0xa4e2('0x1'))(_0xa4e2('0x2'));var moment=require(_0xa4e2('0x3'));var BPromise=require(_0xa4e2('0x4'));var rp=require(_0xa4e2('0x5'));var fs=require('fs');var path=require(_0xa4e2('0x6'));var rimraf=require(_0xa4e2('0x7'));var config=require(_0xa4e2('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0xa4e2('0x9')]=function(_0x139643,_0x2f49c5){return _0x139643[_0xa4e2('0xa')](_0xa4e2('0xb'),attributes,{'tableName':_0xa4e2('0xc'),'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 5b28214..d38e776 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 _0x758f=['then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x758f,0x1da));var _0xf758=function(_0x18e80c,_0x4077f7){_0x18e80c=_0x18e80c-0x0;var _0x183ba9=_0x758f[_0x18e80c];return _0x183ba9;};'use strict';var _=require(_0xf758('0x0'));var util=require(_0xf758('0x1'));var moment=require(_0xf758('0x2'));var BPromise=require(_0xf758('0x3'));var rs=require(_0xf758('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf758('0x5'))['db'];var utils=require(_0xf758('0x6'));var logger=require(_0xf758('0x7'))(_0xf758('0x8'));var config=require('../../config/environment');var jayson=require(_0xf758('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2518e6,_0x40f57f,_0x454880){return new BPromise(function(_0x4f4fc2,_0x212a24){return client['request'](_0x2518e6,_0x454880)[_0xf758('0xa')](function(_0x53ae27){logger[_0xf758('0xb')](_0xf758('0xc'),_0x40f57f,_0xf758('0xd'));logger[_0xf758('0xe')](_0xf758('0xf'),_0x40f57f,_0xf758('0xd'),JSON[_0xf758('0x10')](_0x53ae27));if(_0x53ae27[_0xf758('0x11')]){if(_0x53ae27['error'][_0xf758('0x12')]===0x1f4){logger['error'](_0xf758('0xc'),_0x40f57f,_0x53ae27[_0xf758('0x11')][_0xf758('0x13')]);return _0x212a24(_0x53ae27[_0xf758('0x11')]['message']);}logger['error'](_0xf758('0xc'),_0x40f57f,_0x53ae27[_0xf758('0x11')][_0xf758('0x13')]);return _0x4f4fc2(_0x53ae27[_0xf758('0x11')][_0xf758('0x13')]);}else{logger[_0xf758('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x40f57f,_0xf758('0xd'));_0x4f4fc2(_0x53ae27[_0xf758('0x14')][_0xf758('0x13')]);}})[_0xf758('0x15')](function(_0x197b97){logger[_0xf758('0x11')](_0xf758('0xc'),_0x40f57f,_0x197b97);_0x212a24(_0x197b97);});});} \ No newline at end of file +var _0xc066=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3a942d,_0x46b05d){var _0x3c84af=function(_0x1d4511){while(--_0x1d4511){_0x3a942d['push'](_0x3a942d['shift']());}};_0x3c84af(++_0x46b05d);}(_0xc066,0x19f));var _0x6c06=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc066[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x6c06('0x0'));var moment=require(_0x6c06('0x1'));var BPromise=require(_0x6c06('0x2'));var rs=require(_0x6c06('0x3'));var fs=require('fs');var Redis=require(_0x6c06('0x4'));var db=require(_0x6c06('0x5'))['db'];var utils=require(_0x6c06('0x6'));var logger=require(_0x6c06('0x7'))('rpc');var config=require(_0x6c06('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6c06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7ad747,_0x4ba95e,_0x57c59f){return new BPromise(function(_0x4806fc,_0x462966){return client[_0x6c06('0xa')](_0x7ad747,_0x57c59f)['then'](function(_0x1dbc4b){logger[_0x6c06('0xb')](_0x6c06('0xc'),_0x4ba95e,'request\x20sent');logger[_0x6c06('0xd')](_0x6c06('0xe'),_0x4ba95e,'request\x20sent',JSON[_0x6c06('0xf')](_0x1dbc4b));if(_0x1dbc4b[_0x6c06('0x10')]){if(_0x1dbc4b[_0x6c06('0x10')][_0x6c06('0x11')]===0x1f4){logger[_0x6c06('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4ba95e,_0x1dbc4b[_0x6c06('0x10')][_0x6c06('0x12')]);return _0x462966(_0x1dbc4b[_0x6c06('0x10')]['message']);}logger['error'](_0x6c06('0xc'),_0x4ba95e,_0x1dbc4b['error'][_0x6c06('0x12')]);return _0x4806fc(_0x1dbc4b[_0x6c06('0x10')][_0x6c06('0x12')]);}else{logger[_0x6c06('0xb')](_0x6c06('0xc'),_0x4ba95e,'request\x20sent');_0x4806fc(_0x1dbc4b[_0x6c06('0x13')][_0x6c06('0x12')]);}})[_0x6c06('0x14')](function(_0x4fed7a){logger['error'](_0x6c06('0xc'),_0x4ba95e,_0x4fed7a);_0x462966(_0x4fed7a);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 1b21d5e..1886faa 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(_0x4f7b58,_0x4c9c45){var _0x5e526e=function(_0x48f49a){while(--_0x48f49a){_0x4f7b58['push'](_0x4f7b58['shift']());}};_0x5e526e(++_0x4c9c45);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x2fdd18,_0x21f7cb){var _0x1c0217=function(_0x3c223d){while(--_0x3c223d){_0x2fdd18['push'](_0x2fdd18['shift']());}};_0x1c0217(++_0x21f7cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 274532c..218b10a 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 _0x55f1=['STRING','name','TEXT','sequelize'];(function(_0x3da3d4,_0x26d31a){var _0x6d5d64=function(_0x542fed){while(--_0x542fed){_0x3da3d4['push'](_0x3da3d4['shift']());}};_0x6d5d64(++_0x26d31a);}(_0x55f1,0x9b));var _0x155f=function(_0x56751c,_0x4f53ba){_0x56751c=_0x56751c-0x0;var _0x1d4b61=_0x55f1[_0x56751c];return _0x1d4b61;};'use strict';var Sequelize=require(_0x155f('0x0'));module['exports']={'name':{'type':Sequelize[_0x155f('0x1')],'allowNull':![],'unique':_0x155f('0x2')},'table':{'type':Sequelize[_0x155f('0x1')]},'metric':{'type':Sequelize[_0x155f('0x3')]},'description':{'type':Sequelize[_0x155f('0x1')]}}; \ No newline at end of file +var _0x7d5a=['exports','STRING','name','TEXT','sequelize'];(function(_0x273463,_0x32626a){var _0x51bdb2=function(_0xf10645){while(--_0xf10645){_0x273463['push'](_0x273463['shift']());}};_0x51bdb2(++_0x32626a);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x57cbee,_0xc8b1ad){_0x57cbee=_0x57cbee-0x0;var _0x53ef20=_0x7d5a[_0x57cbee];return _0x53ef20;};'use strict';var Sequelize=require(_0xa7d5('0x0'));module[_0xa7d5('0x1')]={'name':{'type':Sequelize[_0xa7d5('0x2')],'allowNull':![],'unique':_0xa7d5('0x3')},'table':{'type':Sequelize[_0xa7d5('0x2')]},'metric':{'type':Sequelize[_0xa7d5('0x4')]},'description':{'type':Sequelize[_0xa7d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index e0571c7..dab379b 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 _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3b9eed,_0x22ff44){var _0x21a808=function(_0x18cde3){while(--_0x18cde3){_0x3b9eed['push'](_0x3b9eed['shift']());}};_0x21a808(++_0x22ff44);}(_0x55ca,0x126));var _0xa55c=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0x55ca[_0x1ee5be];return _0x177140;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file +var _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x40dc06,_0x48dd40){var _0x92d868=function(_0x1a8636){while(--_0x1a8636){_0x40dc06['push'](_0x40dc06['shift']());}};_0x92d868(++_0x48dd40);}(_0x46ed,0x168));var _0xd46e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46ed[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index a7a2afe..a7f0b81 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 _0x9134=['define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x8936be,_0x1a55dc){var _0x236ab6=function(_0x54a20d){while(--_0x54a20d){_0x8936be['push'](_0x8936be['shift']());}};_0x236ab6(++_0x1a55dc);}(_0x9134,0x87));var _0x4913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9134[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4913('0x0'));var logger=require(_0x4913('0x1'))(_0x4913('0x2'));var moment=require(_0x4913('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4913('0x4'));var rimraf=require(_0x4913('0x5'));var config=require(_0x4913('0x6'));var attributes=require(_0x4913('0x7'));module[_0x4913('0x8')]=function(_0x2ab455,_0x52f0cb){return _0x2ab455[_0x4913('0x9')](_0x4913('0xa'),attributes,{'tableName':_0x4913('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c09=['rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x31ff78,_0x423e2c){var _0x484272=function(_0x33783a){while(--_0x33783a){_0x31ff78['push'](_0x31ff78['shift']());}};_0x484272(++_0x423e2c);}(_0x7c09,0x102));var _0x97c0=function(_0x22a2c1,_0x4a0754){_0x22a2c1=_0x22a2c1-0x0;var _0x139c01=_0x7c09[_0x22a2c1];return _0x139c01;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 6d09508..8d17cb5 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 _0xad87=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0xe7d24e,_0x235022){var _0x42c6e3=function(_0x7fe642){while(--_0x7fe642){_0xe7d24e['push'](_0xe7d24e['shift']());}};_0x42c6e3(++_0x235022);}(_0xad87,0x1a6));var _0x7ad8=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0xad87[_0x53b53e];return _0xbb6179;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7ad8('0x0'));var BPromise=require(_0x7ad8('0x1'));var rs=require(_0x7ad8('0x2'));var fs=require('fs');var Redis=require(_0x7ad8('0x3'));var db=require(_0x7ad8('0x4'))['db'];var utils=require(_0x7ad8('0x5'));var logger=require(_0x7ad8('0x6'))(_0x7ad8('0x7'));var config=require(_0x7ad8('0x8'));var jayson=require(_0x7ad8('0x9'));var client=jayson[_0x7ad8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31d10c,_0x103bc9,_0x26096c){return new BPromise(function(_0x4dc130,_0x4206f2){return client[_0x7ad8('0xb')](_0x31d10c,_0x26096c)[_0x7ad8('0xc')](function(_0x51629b){logger[_0x7ad8('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x103bc9,_0x7ad8('0xe'));logger[_0x7ad8('0xf')](_0x7ad8('0x10'),_0x103bc9,_0x7ad8('0xe'),JSON[_0x7ad8('0x11')](_0x51629b));if(_0x51629b[_0x7ad8('0x12')]){if(_0x51629b[_0x7ad8('0x12')][_0x7ad8('0x13')]===0x1f4){logger[_0x7ad8('0x12')](_0x7ad8('0x14'),_0x103bc9,_0x51629b[_0x7ad8('0x12')][_0x7ad8('0x15')]);return _0x4206f2(_0x51629b[_0x7ad8('0x12')][_0x7ad8('0x15')]);}logger[_0x7ad8('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x103bc9,_0x51629b['error'][_0x7ad8('0x15')]);return _0x4dc130(_0x51629b[_0x7ad8('0x12')][_0x7ad8('0x15')]);}else{logger[_0x7ad8('0xd')](_0x7ad8('0x14'),_0x103bc9,_0x7ad8('0xe'));_0x4dc130(_0x51629b['result'][_0x7ad8('0x15')]);}})[_0x7ad8('0x16')](function(_0x3f6af4){logger[_0x7ad8('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x103bc9,_0x3f6af4);_0x4206f2(_0x3f6af4);});});} \ No newline at end of file +var _0xe3e6=['client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x35eb63,_0x280dcb){var _0x3b07c2=function(_0x35b019){while(--_0x35b019){_0x35eb63['push'](_0x35eb63['shift']());}};_0x3b07c2(++_0x280dcb);}(_0xe3e6,0x84));var _0x6e3e=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xe3e6[_0x31e5cb];return _0x4170df;};'use strict';var _=require('lodash');var util=require(_0x6e3e('0x0'));var moment=require(_0x6e3e('0x1'));var BPromise=require(_0x6e3e('0x2'));var rs=require(_0x6e3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e3e('0x4'));var logger=require(_0x6e3e('0x5'))(_0x6e3e('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e3e('0x7'));var client=jayson[_0x6e3e('0x8')][_0x6e3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2aed2d,_0x4d9e77,_0x1c69f0){return new BPromise(function(_0x5e1a0c,_0x688ab9){return client[_0x6e3e('0xa')](_0x2aed2d,_0x1c69f0)['then'](function(_0x54418d){logger[_0x6e3e('0xb')](_0x6e3e('0xc'),_0x4d9e77,_0x6e3e('0xd'));logger['debug'](_0x6e3e('0xe'),_0x4d9e77,_0x6e3e('0xd'),JSON[_0x6e3e('0xf')](_0x54418d));if(_0x54418d[_0x6e3e('0x10')]){if(_0x54418d['error'][_0x6e3e('0x11')]===0x1f4){logger['error'](_0x6e3e('0xc'),_0x4d9e77,_0x54418d[_0x6e3e('0x10')][_0x6e3e('0x12')]);return _0x688ab9(_0x54418d[_0x6e3e('0x10')][_0x6e3e('0x12')]);}logger[_0x6e3e('0x10')](_0x6e3e('0xc'),_0x4d9e77,_0x54418d[_0x6e3e('0x10')][_0x6e3e('0x12')]);return _0x5e1a0c(_0x54418d['error'][_0x6e3e('0x12')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x4d9e77,_0x6e3e('0xd'));_0x5e1a0c(_0x54418d[_0x6e3e('0x13')][_0x6e3e('0x12')]);}})['catch'](function(_0x11cf45){logger['error'](_0x6e3e('0xc'),_0x4d9e77,_0x11cf45);_0x688ab9(_0x11cf45);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index a3a9634..790d8c8 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 _0x5eb8=['fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','destroy','util','path','Router'];(function(_0x15c97c,_0x47772c){var _0x2db36e=function(_0x5174bc){while(--_0x5174bc){_0x15c97c['push'](_0x15c97c['shift']());}};_0x2db36e(++_0x47772c);}(_0x5eb8,0x1d1));var _0x85eb=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5eb8[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require(_0x85eb('0x0'));var path=require(_0x85eb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85eb('0x2')]();var fs_extra=require(_0x85eb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x85eb('0x4'));var config=require(_0x85eb('0x5'));var controller=require(_0x85eb('0x6'));router[_0x85eb('0x7')]('/',auth['isAuthenticated'](),controller[_0x85eb('0x8')]);router[_0x85eb('0x7')](_0x85eb('0x9'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router['put'](_0x85eb('0x9'),auth[_0x85eb('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x85eb('0xc')]);module['exports']=router; \ No newline at end of file +var _0x0650=['../../config/environment','./analyticMetric.controller','index','post','create','put','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x3cf5c7,_0x1eb319){var _0xf3d981=function(_0x3521ef){while(--_0x3521ef){_0x3cf5c7['push'](_0x3cf5c7['shift']());}};_0xf3d981(++_0x1eb319);}(_0x0650,0x1aa));var _0x0065=function(_0x309df4,_0x3391db){_0x309df4=_0x309df4-0x0;var _0x4be8fc=_0x0650[_0x309df4];return _0x4be8fc;};'use strict';var multer=require(_0x0065('0x0'));var util=require(_0x0065('0x1'));var path=require(_0x0065('0x2'));var timeout=require(_0x0065('0x3'));var express=require('express');var router=express[_0x0065('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0065('0x5'));var config=require(_0x0065('0x6'));var controller=require(_0x0065('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0065('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0065('0x9')]('/',auth['isAuthenticated'](),controller[_0x0065('0xa')]);router[_0x0065('0xb')]('/:id',auth[_0x0065('0xc')](),controller[_0x0065('0xd')]);router['delete']('/:id',auth[_0x0065('0xc')](),controller[_0x0065('0xe')]);module[_0x0065('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 2ae46fd..f722b83 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 _0xdb78=['sequelize','TEXT'];(function(_0x30806e,_0x41bb0d){var _0x2777c6=function(_0x2557b6){while(--_0x2557b6){_0x30806e['push'](_0x30806e['shift']());}};_0x2777c6(++_0x41bb0d);}(_0xdb78,0x112));var _0x8db7=function(_0x3939ab,_0x3102c8){_0x3939ab=_0x3939ab-0x0;var _0x31fd33=_0xdb78[_0x3939ab];return _0x31fd33;};'use strict';var Sequelize=require(_0x8db7('0x0'));module['exports']={'tree':{'type':Sequelize[_0x8db7('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3d48=['TEXT','exports'];(function(_0x515c44,_0x1540de){var _0x49c4fa=function(_0x437b62){while(--_0x437b62){_0x515c44['push'](_0x515c44['shift']());}};_0x49c4fa(++_0x1540de);}(_0x3d48,0x151));var _0x83d4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3d48[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0x83d4('0x0')]={'tree':{'type':Sequelize[_0x83d4('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 4623d91..3ce56ae 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 _0xde68=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','destroy','name','send','index','map','fieldName','type','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2ab5d7,_0x1243d9){var _0x516388=function(_0x412cd1){while(--_0x412cd1){_0x2ab5d7['push'](_0x2ab5d7['shift']());}};_0x516388(++_0x1243d9);}(_0xde68,0x162));var _0x8de6=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xde68[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8de6('0x0'));var zipdir=require(_0x8de6('0x1'));var jsonpatch=require(_0x8de6('0x2'));var rp=require(_0x8de6('0x3'));var moment=require('moment');var BPromise=require(_0x8de6('0x4'));var Mustache=require(_0x8de6('0x5'));var util=require(_0x8de6('0x6'));var path=require('path');var sox=require(_0x8de6('0x7'));var csv=require(_0x8de6('0x8'));var ejs=require(_0x8de6('0x9'));var fs=require('fs');var fs_extra=require(_0x8de6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8de6('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8de6('0xc'));var Redis=require(_0x8de6('0xd'));var authService=require(_0x8de6('0xe'));var qs=require(_0x8de6('0xf'));var as=require(_0x8de6('0x10'));var hardwareService=require(_0x8de6('0x11'));var logger=require(_0x8de6('0x12'))(_0x8de6('0x13'));var utils=require(_0x8de6('0x14'));var config=require(_0x8de6('0x15'));var licenseUtil=require(_0x8de6('0x16'));var db=require(_0x8de6('0x17'))['db'];function respondWithStatusCode(_0x23d6a0,_0x3a79cb){_0x3a79cb=_0x3a79cb||0xcc;return function(_0x201fe0){if(_0x201fe0){return _0x23d6a0[_0x8de6('0x18')](_0x3a79cb);}return _0x23d6a0[_0x8de6('0x19')](_0x3a79cb)[_0x8de6('0x1a')]();};}function respondWithResult(_0x42c10f,_0xc4c6da){_0xc4c6da=_0xc4c6da||0xc8;return function(_0x2c50d3){if(_0x2c50d3){return _0x42c10f['status'](_0xc4c6da)['json'](_0x2c50d3);}};}function respondWithFilteredResult(_0x266308,_0x5dc547){return function(_0x35ae09){if(_0x35ae09){var _0x373ee7=typeof _0x5dc547['offset']===_0x8de6('0x1b')&&typeof _0x5dc547[_0x8de6('0x1c')]===_0x8de6('0x1b');var _0xb1bea1=_0x35ae09[_0x8de6('0x1d')];var _0x19460f=_0x373ee7?0x0:_0x5dc547[_0x8de6('0x1e')];var _0x11254e=_0x373ee7?_0x35ae09[_0x8de6('0x1d')]:_0x5dc547[_0x8de6('0x1e')]+_0x5dc547['limit'];var _0x14842f;if(_0x11254e>=_0xb1bea1){_0x11254e=_0xb1bea1;_0x14842f=0xc8;}else{_0x14842f=0xce;}_0x266308[_0x8de6('0x19')](_0x14842f);return _0x266308[_0x8de6('0x1f')](_0x8de6('0x20'),_0x19460f+'-'+_0x11254e+'/'+_0xb1bea1)[_0x8de6('0x21')](_0x35ae09);}return null;};}function patchUpdates(_0xb235e5){return function(_0x5eae2c){try{jsonpatch[_0x8de6('0x22')](_0x5eae2c,_0xb235e5,!![]);}catch(_0x52c672){return BPromise['reject'](_0x52c672);}return _0x5eae2c['save']();};}function saveUpdates(_0x4518dc,_0x3946f7){return function(_0xc593c0){if(_0xc593c0){return _0xc593c0[_0x8de6('0x23')](_0x4518dc)[_0x8de6('0x24')](function(_0x3d546c){return _0x3d546c;});}return null;};}function removeEntity(_0x1d824e,_0x354ee9){return function(_0xcf841d){if(_0xcf841d){return _0xcf841d[_0x8de6('0x25')]()[_0x8de6('0x24')](function(){_0x1d824e[_0x8de6('0x19')](0xcc)[_0x8de6('0x1a')]();});}};}function handleEntityNotFound(_0x3a5307,_0x2240ee){return function(_0x4ef3a7){if(!_0x4ef3a7){_0x3a5307[_0x8de6('0x18')](0x194);}return _0x4ef3a7;};}function handleError(_0x24ec89,_0x1a229e){_0x1a229e=_0x1a229e||0x1f4;return function(_0x1ad44d){logger['error'](_0x1ad44d['stack']);if(_0x1ad44d['name']){delete _0x1ad44d[_0x8de6('0x26')];}_0x24ec89[_0x8de6('0x19')](_0x1a229e)[_0x8de6('0x27')](_0x1ad44d);};}exports[_0x8de6('0x28')]=function(_0x50ef8e,_0x4b95e5){var _0x14bab7={},_0x937671={},_0x4edcd9={'count':0x0,'rows':[]};var _0x24e278=_[_0x8de6('0x29')](db['AnalyticTreeReport']['rawAttributes'],function(_0x511eb9){return{'name':_0x511eb9[_0x8de6('0x2a')],'type':_0x511eb9[_0x8de6('0x2b')]['key']};});_0x937671['model']=_[_0x8de6('0x29')](_0x24e278,_0x8de6('0x26'));_0x937671['query']=_['keys'](_0x50ef8e['query']);_0x937671[_0x8de6('0x2c')]=_[_0x8de6('0x2d')](_0x937671[_0x8de6('0x2e')],_0x937671[_0x8de6('0x2f')]);_0x14bab7[_0x8de6('0x30')]=_[_0x8de6('0x2d')](_0x937671[_0x8de6('0x2e')],qs[_0x8de6('0x31')](_0x50ef8e[_0x8de6('0x2f')][_0x8de6('0x31')]));_0x14bab7['attributes']=_0x14bab7[_0x8de6('0x30')][_0x8de6('0x32')]?_0x14bab7['attributes']:_0x937671['model'];if(!_0x50ef8e[_0x8de6('0x2f')][_0x8de6('0x33')](_0x8de6('0x34'))){_0x14bab7[_0x8de6('0x1c')]=qs[_0x8de6('0x1c')](_0x50ef8e['query'][_0x8de6('0x1c')]);_0x14bab7[_0x8de6('0x1e')]=qs['offset'](_0x50ef8e['query'][_0x8de6('0x1e')]);}_0x14bab7[_0x8de6('0x35')]=qs[_0x8de6('0x36')](_0x50ef8e[_0x8de6('0x2f')][_0x8de6('0x36')]);_0x14bab7[_0x8de6('0x37')]=qs['filters'](_[_0x8de6('0x38')](_0x50ef8e[_0x8de6('0x2f')],_0x937671[_0x8de6('0x2c')]),_0x24e278);if(_0x50ef8e[_0x8de6('0x2f')][_0x8de6('0x39')]){_0x14bab7['where']=_[_0x8de6('0x3a')](_0x14bab7[_0x8de6('0x37')],{'$or':_[_0x8de6('0x29')](_0x24e278,function(_0x500cb0){if(_0x500cb0[_0x8de6('0x2b')]!==_0x8de6('0x3b')){var _0x529a09={};_0x529a09[_0x500cb0['name']]={'$like':'%'+_0x50ef8e['query'][_0x8de6('0x39')]+'%'};return _0x529a09;}})});}_0x14bab7=_[_0x8de6('0x3a')]({},_0x14bab7,_0x50ef8e[_0x8de6('0x3c')]);var _0x136e86={'where':_0x14bab7[_0x8de6('0x37')]};return db[_0x8de6('0x3d')][_0x8de6('0x1d')](_0x136e86)['then'](function(_0x3bf249){_0x4edcd9[_0x8de6('0x1d')]=_0x3bf249;if(_0x50ef8e[_0x8de6('0x2f')][_0x8de6('0x3e')]){_0x14bab7[_0x8de6('0x3f')]=[{'all':!![]}];}return db[_0x8de6('0x3d')][_0x8de6('0x40')](_0x14bab7);})[_0x8de6('0x24')](function(_0x5931d7){_0x4edcd9[_0x8de6('0x41')]=_0x5931d7;return _0x4edcd9;})[_0x8de6('0x24')](respondWithFilteredResult(_0x4b95e5,_0x14bab7))[_0x8de6('0x42')](handleError(_0x4b95e5,null));};exports[_0x8de6('0x43')]=function(_0x44c1e6,_0x393138){var _0x342d4e={'raw':!![],'where':{'id':_0x44c1e6['params']['id']}},_0x47d64a={};_0x47d64a[_0x8de6('0x2e')]=_[_0x8de6('0x44')](db['AnalyticTreeReport'][_0x8de6('0x45')]);_0x47d64a[_0x8de6('0x2f')]=_[_0x8de6('0x44')](_0x44c1e6[_0x8de6('0x2f')]);_0x47d64a[_0x8de6('0x2c')]=_['intersection'](_0x47d64a[_0x8de6('0x2e')],_0x47d64a['query']);_0x342d4e[_0x8de6('0x30')]=_[_0x8de6('0x2d')](_0x47d64a[_0x8de6('0x2e')],qs[_0x8de6('0x31')](_0x44c1e6[_0x8de6('0x2f')]['fields']));_0x342d4e[_0x8de6('0x30')]=_0x342d4e[_0x8de6('0x30')][_0x8de6('0x32')]?_0x342d4e[_0x8de6('0x30')]:_0x47d64a[_0x8de6('0x2e')];if(_0x44c1e6[_0x8de6('0x2f')][_0x8de6('0x3e')]){_0x342d4e['include']=[{'all':!![]}];}_0x342d4e=_['merge']({},_0x342d4e,_0x44c1e6[_0x8de6('0x3c')]);return db[_0x8de6('0x3d')][_0x8de6('0x46')](_0x342d4e)[_0x8de6('0x24')](handleEntityNotFound(_0x393138,null))['then'](respondWithResult(_0x393138,null))[_0x8de6('0x42')](handleError(_0x393138,null));};exports[_0x8de6('0x47')]=function(_0x4cb103,_0x388691){return db[_0x8de6('0x3d')][_0x8de6('0x47')](_0x4cb103[_0x8de6('0x48')],{})[_0x8de6('0x24')](respondWithResult(_0x388691,0xc9))[_0x8de6('0x42')](handleError(_0x388691,null));};exports[_0x8de6('0x23')]=function(_0xf58edf,_0x3e9dce){if(_0xf58edf[_0x8de6('0x48')]['id']){delete _0xf58edf[_0x8de6('0x48')]['id'];}return db[_0x8de6('0x3d')][_0x8de6('0x46')]({'where':{'id':_0xf58edf[_0x8de6('0x49')]['id']}})[_0x8de6('0x24')](handleEntityNotFound(_0x3e9dce,null))['then'](saveUpdates(_0xf58edf[_0x8de6('0x48')],null))[_0x8de6('0x24')](respondWithResult(_0x3e9dce,null))[_0x8de6('0x42')](handleError(_0x3e9dce,null));};exports[_0x8de6('0x25')]=function(_0x1b0592,_0x294372){return db[_0x8de6('0x3d')][_0x8de6('0x46')]({'where':{'id':_0x1b0592['params']['id']}})[_0x8de6('0x24')](handleEntityNotFound(_0x294372,null))[_0x8de6('0x24')](removeEntity(_0x294372,null))[_0x8de6('0x42')](handleError(_0x294372,null));}; \ No newline at end of file +var _0xb202=['params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','pick','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb202,0x120));var _0x2b20=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb202[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0x2b20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b20('0x1'));var jsonpatch=require(_0x2b20('0x2'));var rp=require(_0x2b20('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b20('0x4'));var util=require(_0x2b20('0x5'));var path=require(_0x2b20('0x6'));var sox=require(_0x2b20('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b20('0x8'));var _=require('lodash');var squel=require(_0x2b20('0x9'));var crypto=require('crypto');var jsforce=require(_0x2b20('0xa'));var deskjs=require(_0x2b20('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2b20('0xc'));var Papa=require(_0x2b20('0xd'));var Redis=require(_0x2b20('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b20('0xf'));var logger=require(_0x2b20('0x10'))('api');var utils=require(_0x2b20('0x11'));var config=require(_0x2b20('0x12'));var licenseUtil=require(_0x2b20('0x13'));var db=require(_0x2b20('0x14'))['db'];function respondWithStatusCode(_0x52f06a,_0x1d84ca){_0x1d84ca=_0x1d84ca||0xcc;return function(_0x44ce10){if(_0x44ce10){return _0x52f06a['sendStatus'](_0x1d84ca);}return _0x52f06a[_0x2b20('0x15')](_0x1d84ca)['end']();};}function respondWithResult(_0x468c78,_0x4fe4c2){_0x4fe4c2=_0x4fe4c2||0xc8;return function(_0x2b53e7){if(_0x2b53e7){return _0x468c78[_0x2b20('0x15')](_0x4fe4c2)[_0x2b20('0x16')](_0x2b53e7);}};}function respondWithFilteredResult(_0xdcf66c,_0x2921cf){return function(_0xb3ee8c){if(_0xb3ee8c){var _0x343720=typeof _0x2921cf['offset']===_0x2b20('0x17')&&typeof _0x2921cf[_0x2b20('0x18')]===_0x2b20('0x17');var _0x4d3589=_0xb3ee8c['count'];var _0x15f4af=_0x343720?0x0:_0x2921cf[_0x2b20('0x19')];var _0x4c5676=_0x343720?_0xb3ee8c['count']:_0x2921cf[_0x2b20('0x19')]+_0x2921cf[_0x2b20('0x18')];var _0xd931ac;if(_0x4c5676>=_0x4d3589){_0x4c5676=_0x4d3589;_0xd931ac=0xc8;}else{_0xd931ac=0xce;}_0xdcf66c[_0x2b20('0x15')](_0xd931ac);return _0xdcf66c[_0x2b20('0x1a')](_0x2b20('0x1b'),_0x15f4af+'-'+_0x4c5676+'/'+_0x4d3589)[_0x2b20('0x16')](_0xb3ee8c);}return null;};}function patchUpdates(_0x2b5a7e){return function(_0x143d53){try{jsonpatch['apply'](_0x143d53,_0x2b5a7e,!![]);}catch(_0x13d3b7){return BPromise[_0x2b20('0x1c')](_0x13d3b7);}return _0x143d53[_0x2b20('0x1d')]();};}function saveUpdates(_0xe6c59c,_0x562694){return function(_0x19fae6){if(_0x19fae6){return _0x19fae6[_0x2b20('0x1e')](_0xe6c59c)[_0x2b20('0x1f')](function(_0x2d79f1){return _0x2d79f1;});}return null;};}function removeEntity(_0x40cf85,_0x138942){return function(_0x467339){if(_0x467339){return _0x467339[_0x2b20('0x20')]()[_0x2b20('0x1f')](function(){_0x40cf85[_0x2b20('0x15')](0xcc)[_0x2b20('0x21')]();});}};}function handleEntityNotFound(_0x40335f,_0x37c958){return function(_0x158903){if(!_0x158903){_0x40335f[_0x2b20('0x22')](0x194);}return _0x158903;};}function handleError(_0x305d7e,_0x5289a4){_0x5289a4=_0x5289a4||0x1f4;return function(_0x118e20){logger[_0x2b20('0x23')](_0x118e20[_0x2b20('0x24')]);if(_0x118e20[_0x2b20('0x25')]){delete _0x118e20['name'];}_0x305d7e[_0x2b20('0x15')](_0x5289a4)['send'](_0x118e20);};}exports[_0x2b20('0x26')]=function(_0x44c035,_0x5164f5){var _0x37de99={},_0x3e11d6={},_0x5d17db={'count':0x0,'rows':[]};var _0x311dde=_[_0x2b20('0x27')](db[_0x2b20('0x28')][_0x2b20('0x29')],function(_0x26ab46){return{'name':_0x26ab46[_0x2b20('0x2a')],'type':_0x26ab46[_0x2b20('0x2b')][_0x2b20('0x2c')]};});_0x3e11d6['model']=_['map'](_0x311dde,_0x2b20('0x25'));_0x3e11d6[_0x2b20('0x2d')]=_[_0x2b20('0x2e')](_0x44c035['query']);_0x3e11d6[_0x2b20('0x2f')]=_['intersection'](_0x3e11d6[_0x2b20('0x30')],_0x3e11d6[_0x2b20('0x2d')]);_0x37de99[_0x2b20('0x31')]=_[_0x2b20('0x32')](_0x3e11d6[_0x2b20('0x30')],qs[_0x2b20('0x33')](_0x44c035[_0x2b20('0x2d')][_0x2b20('0x33')]));_0x37de99[_0x2b20('0x31')]=_0x37de99[_0x2b20('0x31')][_0x2b20('0x34')]?_0x37de99[_0x2b20('0x31')]:_0x3e11d6[_0x2b20('0x30')];if(!_0x44c035['query'][_0x2b20('0x35')]('nolimit')){_0x37de99[_0x2b20('0x18')]=qs[_0x2b20('0x18')](_0x44c035['query']['limit']);_0x37de99['offset']=qs[_0x2b20('0x19')](_0x44c035['query'][_0x2b20('0x19')]);}_0x37de99[_0x2b20('0x36')]=qs['sort'](_0x44c035[_0x2b20('0x2d')]['sort']);_0x37de99['where']=qs[_0x2b20('0x2f')](_[_0x2b20('0x37')](_0x44c035[_0x2b20('0x2d')],_0x3e11d6[_0x2b20('0x2f')]),_0x311dde);if(_0x44c035[_0x2b20('0x2d')]['filter']){_0x37de99[_0x2b20('0x38')]=_['merge'](_0x37de99[_0x2b20('0x38')],{'$or':_[_0x2b20('0x27')](_0x311dde,function(_0x295a25){if(_0x295a25[_0x2b20('0x2b')]!=='VIRTUAL'){var _0x1ab468={};_0x1ab468[_0x295a25[_0x2b20('0x25')]]={'$like':'%'+_0x44c035['query'][_0x2b20('0x39')]+'%'};return _0x1ab468;}})});}_0x37de99=_[_0x2b20('0x3a')]({},_0x37de99,_0x44c035[_0x2b20('0x3b')]);var _0x1bf63e={'where':_0x37de99['where']};return db['AnalyticTreeReport'][_0x2b20('0x3c')](_0x1bf63e)[_0x2b20('0x1f')](function(_0xc2b80a){_0x5d17db[_0x2b20('0x3c')]=_0xc2b80a;if(_0x44c035[_0x2b20('0x2d')][_0x2b20('0x3d')]){_0x37de99[_0x2b20('0x3e')]=[{'all':!![]}];}return db[_0x2b20('0x28')][_0x2b20('0x3f')](_0x37de99);})[_0x2b20('0x1f')](function(_0x2b93e4){_0x5d17db[_0x2b20('0x40')]=_0x2b93e4;return _0x5d17db;})[_0x2b20('0x1f')](respondWithFilteredResult(_0x5164f5,_0x37de99))[_0x2b20('0x41')](handleError(_0x5164f5,null));};exports[_0x2b20('0x42')]=function(_0x43caee,_0x599886){var _0x466828={'raw':!![],'where':{'id':_0x43caee[_0x2b20('0x43')]['id']}},_0x2f1d45={};_0x2f1d45['model']=_['keys'](db['AnalyticTreeReport'][_0x2b20('0x29')]);_0x2f1d45[_0x2b20('0x2d')]=_['keys'](_0x43caee[_0x2b20('0x2d')]);_0x2f1d45[_0x2b20('0x2f')]=_[_0x2b20('0x32')](_0x2f1d45[_0x2b20('0x30')],_0x2f1d45[_0x2b20('0x2d')]);_0x466828[_0x2b20('0x31')]=_[_0x2b20('0x32')](_0x2f1d45[_0x2b20('0x30')],qs[_0x2b20('0x33')](_0x43caee[_0x2b20('0x2d')][_0x2b20('0x33')]));_0x466828['attributes']=_0x466828[_0x2b20('0x31')][_0x2b20('0x34')]?_0x466828[_0x2b20('0x31')]:_0x2f1d45[_0x2b20('0x30')];if(_0x43caee['query']['includeAll']){_0x466828[_0x2b20('0x3e')]=[{'all':!![]}];}_0x466828=_[_0x2b20('0x3a')]({},_0x466828,_0x43caee['options']);return db['AnalyticTreeReport'][_0x2b20('0x44')](_0x466828)[_0x2b20('0x1f')](handleEntityNotFound(_0x599886,null))[_0x2b20('0x1f')](respondWithResult(_0x599886,null))['catch'](handleError(_0x599886,null));};exports[_0x2b20('0x45')]=function(_0x5696d3,_0x1f5ba0){return db[_0x2b20('0x28')][_0x2b20('0x45')](_0x5696d3['body'],{})['then'](respondWithResult(_0x1f5ba0,0xc9))['catch'](handleError(_0x1f5ba0,null));};exports['update']=function(_0x278dd6,_0x424ada){if(_0x278dd6[_0x2b20('0x46')]['id']){delete _0x278dd6['body']['id'];}return db['AnalyticTreeReport'][_0x2b20('0x44')]({'where':{'id':_0x278dd6[_0x2b20('0x43')]['id']}})[_0x2b20('0x1f')](handleEntityNotFound(_0x424ada,null))['then'](saveUpdates(_0x278dd6['body'],null))[_0x2b20('0x1f')](respondWithResult(_0x424ada,null))[_0x2b20('0x41')](handleError(_0x424ada,null));};exports['destroy']=function(_0x44eec2,_0x385060){return db[_0x2b20('0x28')][_0x2b20('0x44')]({'where':{'id':_0x44eec2['params']['id']}})['then'](handleEntityNotFound(_0x385060,null))[_0x2b20('0x1f')](removeEntity(_0x385060,null))['catch'](handleError(_0x385060,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 0393c7e..a79d97e 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 _0xc606=['analytics_report_trees','util','../../config/logger','api','bluebird','path','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xc606,0x79));var _0x6c60=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc606[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x6c60('0x0'));var logger=require(_0x6c60('0x1'))(_0x6c60('0x2'));var moment=require('moment');var BPromise=require(_0x6c60('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c60('0x4'));var rimraf=require('rimraf');var config=require(_0x6c60('0x5'));var attributes=require(_0x6c60('0x6'));module[_0x6c60('0x7')]=function(_0x44864f,_0x27e40f){return _0x44864f['define'](_0x6c60('0x8'),attributes,{'tableName':_0x6c60('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb83d=['rimraf','../../config/environment','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xb83d,0x1a5));var _0xdb83=function(_0x2e808,_0x20303e){_0x2e808=_0x2e808-0x0;var _0x1b3cfd=_0xb83d[_0x2e808];return _0x1b3cfd;};'use strict';var _=require(_0xdb83('0x0'));var util=require(_0xdb83('0x1'));var logger=require(_0xdb83('0x2'))(_0xdb83('0x3'));var moment=require(_0xdb83('0x4'));var BPromise=require(_0xdb83('0x5'));var rp=require(_0xdb83('0x6'));var fs=require('fs');var path=require(_0xdb83('0x7'));var rimraf=require(_0xdb83('0x8'));var config=require(_0xdb83('0x9'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x5ababe,_0x3ee45f){return _0x5ababe[_0xdb83('0xa')](_0xdb83('0xb'),attributes,{'tableName':_0xdb83('0xc'),'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 fd271ad..4e890a3 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 _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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x45c25a,_0x2a0eee){_0x45c25a=_0x45c25a-0x0;var _0x81c667=_0x7a54[_0x45c25a];return _0x81c667;};'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 +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x58e39a,_0x474e33){var _0x5233f4=function(_0x3fa875){while(--_0x3fa875){_0x58e39a['push'](_0x58e39a['shift']());}};_0x5233f4(++_0x474e33);}(_0x2ef3,0xba));var _0x32ef=function(_0x3e4656,_0x43a613){_0x3e4656=_0x3e4656-0x0;var _0x5b5fec=_0x2ef3[_0x3e4656];return _0x5b5fec;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 265ac61..8bce226 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 _0x4637=['create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','get','show','post'];(function(_0x33e113,_0x1ef505){var _0x4cb981=function(_0x323abe){while(--_0x323abe){_0x33e113['push'](_0x33e113['shift']());}};_0x4cb981(++_0x1ef505);}(_0x4637,0x103));var _0x7463=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4637[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7463('0x0'));var util=require(_0x7463('0x1'));var path=require('path');var timeout=require(_0x7463('0x2'));var express=require(_0x7463('0x3'));var router=express[_0x7463('0x4')]();var fs_extra=require(_0x7463('0x5'));var auth=require(_0x7463('0x6'));var interaction=require(_0x7463('0x7'));var config=require(_0x7463('0x8'));var controller=require(_0x7463('0x9'));router['get']('/',auth[_0x7463('0xa')](),controller['index']);router[_0x7463('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7463('0xc')]);router[_0x7463('0xd')]('/',auth[_0x7463('0xa')](),controller[_0x7463('0xe')]);router[_0x7463('0xf')](_0x7463('0x10'),auth[_0x7463('0xa')](),controller[_0x7463('0x11')]);router[_0x7463('0x12')]('/:id',auth[_0x7463('0xa')](),controller[_0x7463('0x13')]);module[_0x7463('0x14')]=router; \ No newline at end of file +var _0x8bc4=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0x8bc4,0x19b));var _0x48bc=function(_0xec1b66,_0xa6760c){_0xec1b66=_0xec1b66-0x0;var _0x1fca6f=_0x8bc4[_0xec1b66];return _0x1fca6f;};'use strict';var multer=require(_0x48bc('0x0'));var util=require(_0x48bc('0x1'));var path=require('path');var timeout=require(_0x48bc('0x2'));var express=require(_0x48bc('0x3'));var router=express[_0x48bc('0x4')]();var fs_extra=require(_0x48bc('0x5'));var auth=require(_0x48bc('0x6'));var interaction=require(_0x48bc('0x7'));var config=require(_0x48bc('0x8'));var controller=require(_0x48bc('0x9'));router[_0x48bc('0xa')]('/',auth[_0x48bc('0xb')](),controller[_0x48bc('0xc')]);router[_0x48bc('0xa')](_0x48bc('0xd'),auth[_0x48bc('0xb')](),controller['show']);router[_0x48bc('0xe')]('/',auth[_0x48bc('0xb')](),controller[_0x48bc('0xf')]);router[_0x48bc('0x10')](_0x48bc('0xd'),auth[_0x48bc('0xb')](),controller['update']);router[_0x48bc('0x11')](_0x48bc('0xd'),auth[_0x48bc('0xb')](),controller['destroy']);module[_0x48bc('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 3c00a6a..3d05f3f 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 _0x09f4=['STRING'];(function(_0x2331f8,_0x446a3a){var _0x244773=function(_0x2accba){while(--_0x2accba){_0x2331f8['push'](_0x2331f8['shift']());}};_0x244773(++_0x446a3a);}(_0x09f4,0xe4));var _0x409f=function(_0x2338e9,_0x3b0dd5){_0x2338e9=_0x2338e9-0x0;var _0x4f978b=_0x09f4[_0x2338e9];return _0x4f978b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x409f('0x0')]},'basename':{'type':Sequelize[_0x409f('0x0')]},'type':{'type':Sequelize[_0x409f('0x0')]}}; \ No newline at end of file +var _0x7b83=['exports','STRING','sequelize'];(function(_0x43c1fa,_0x52253b){var _0x1dbfa8=function(_0x3a874c){while(--_0x3a874c){_0x43c1fa['push'](_0x43c1fa['shift']());}};_0x1dbfa8(++_0x52253b);}(_0x7b83,0xa1));var _0x37b8=function(_0x3dac92,_0x199145){_0x3dac92=_0x3dac92-0x0;var _0x134ae2=_0x7b83[_0x3dac92];return _0x134ae2;};'use strict';var Sequelize=require(_0x37b8('0x0'));module[_0x37b8('0x1')]={'name':{'type':Sequelize[_0x37b8('0x2')]},'basename':{'type':Sequelize['STRING']},'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 da5dd00..008e272 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 _0xfa21=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Attachment','include','findAll','rows','catch','show','params','intersection','find','clone','includeAll','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x5268f9,_0x1c653a){var _0x4c5876=function(_0x4171a5){while(--_0x4171a5){_0x5268f9['push'](_0x5268f9['shift']());}};_0x4c5876(++_0x1c653a);}(_0xfa21,0x9a));var _0x1fa2=function(_0x567a26,_0x873234){_0x567a26=_0x567a26-0x0;var _0x3d90e8=_0xfa21[_0x567a26];return _0x3d90e8;};'use strict';var emlformat=require(_0x1fa2('0x0'));var rimraf=require(_0x1fa2('0x1'));var zipdir=require(_0x1fa2('0x2'));var jsonpatch=require(_0x1fa2('0x3'));var rp=require(_0x1fa2('0x4'));var moment=require(_0x1fa2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1fa2('0x6'));var util=require('util');var path=require(_0x1fa2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1fa2('0x8'));var fs=require('fs');var fs_extra=require(_0x1fa2('0x9'));var _=require(_0x1fa2('0xa'));var squel=require(_0x1fa2('0xb'));var crypto=require(_0x1fa2('0xc'));var jsforce=require(_0x1fa2('0xd'));var deskjs=require(_0x1fa2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1fa2('0xf'));var Papa=require(_0x1fa2('0x10'));var Redis=require('ioredis');var authService=require(_0x1fa2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fa2('0x12'));var logger=require(_0x1fa2('0x13'))(_0x1fa2('0x14'));var utils=require(_0x1fa2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1fa2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x198c10,_0x32f1e0){_0x32f1e0=_0x32f1e0||0xcc;return function(_0x4fa1c5){if(_0x4fa1c5){return _0x198c10['sendStatus'](_0x32f1e0);}return _0x198c10['status'](_0x32f1e0)[_0x1fa2('0x17')]();};}function respondWithResult(_0x117bb0,_0x27a095){_0x27a095=_0x27a095||0xc8;return function(_0x57803b){if(_0x57803b){return _0x117bb0[_0x1fa2('0x18')](_0x27a095)[_0x1fa2('0x19')](_0x57803b);}};}function respondWithFilteredResult(_0x1f4b90,_0x5b6388){return function(_0x5ee1ab){if(_0x5ee1ab){var _0x2904c6=typeof _0x5b6388[_0x1fa2('0x1a')]===_0x1fa2('0x1b')&&typeof _0x5b6388[_0x1fa2('0x1c')]===_0x1fa2('0x1b');var _0x3b126d=_0x5ee1ab[_0x1fa2('0x1d')];var _0xb7466c=_0x2904c6?0x0:_0x5b6388[_0x1fa2('0x1a')];var _0x2a50c3=_0x2904c6?_0x5ee1ab['count']:_0x5b6388['offset']+_0x5b6388[_0x1fa2('0x1c')];var _0x3098d6;if(_0x2a50c3>=_0x3b126d){_0x2a50c3=_0x3b126d;_0x3098d6=0xc8;}else{_0x3098d6=0xce;}_0x1f4b90[_0x1fa2('0x18')](_0x3098d6);return _0x1f4b90['set'](_0x1fa2('0x1e'),_0xb7466c+'-'+_0x2a50c3+'/'+_0x3b126d)[_0x1fa2('0x19')](_0x5ee1ab);}return null;};}function patchUpdates(_0x1d85c6){return function(_0x142831){try{jsonpatch[_0x1fa2('0x1f')](_0x142831,_0x1d85c6,!![]);}catch(_0x5eb39b){return BPromise[_0x1fa2('0x20')](_0x5eb39b);}return _0x142831[_0x1fa2('0x21')]();};}function saveUpdates(_0x12008b,_0x43a235){return function(_0x5e21c3){if(_0x5e21c3){return _0x5e21c3[_0x1fa2('0x22')](_0x12008b)[_0x1fa2('0x23')](function(_0x27c80d){return _0x27c80d;});}return null;};}function removeEntity(_0x1748ec,_0x4e09fe){return function(_0x3dce25){if(_0x3dce25){return _0x3dce25[_0x1fa2('0x24')]()[_0x1fa2('0x23')](function(){_0x1748ec[_0x1fa2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x215847,_0x26799d){return function(_0x5684f7){if(!_0x5684f7){_0x215847[_0x1fa2('0x25')](0x194);}return _0x5684f7;};}function handleError(_0x5d7792,_0x3526e7){_0x3526e7=_0x3526e7||0x1f4;return function(_0x3c0ee0){logger[_0x1fa2('0x26')](_0x3c0ee0[_0x1fa2('0x27')]);if(_0x3c0ee0['name']){delete _0x3c0ee0[_0x1fa2('0x28')];}_0x5d7792[_0x1fa2('0x18')](_0x3526e7)[_0x1fa2('0x29')](_0x3c0ee0);};}exports[_0x1fa2('0x2a')]=function(_0x2d5672,_0x722dbc){var _0x4ddff8={},_0x516bf4={},_0x227e69={'count':0x0,'rows':[]};var _0x123a47=_[_0x1fa2('0x2b')](db['Attachment'][_0x1fa2('0x2c')],function(_0x5013f0){return{'name':_0x5013f0[_0x1fa2('0x2d')],'type':_0x5013f0[_0x1fa2('0x2e')][_0x1fa2('0x2f')]};});_0x516bf4[_0x1fa2('0x30')]=_['map'](_0x123a47,'name');_0x516bf4[_0x1fa2('0x31')]=_[_0x1fa2('0x32')](_0x2d5672[_0x1fa2('0x31')]);_0x516bf4[_0x1fa2('0x33')]=_['intersection'](_0x516bf4['model'],_0x516bf4[_0x1fa2('0x31')]);_0x4ddff8[_0x1fa2('0x34')]=_['intersection'](_0x516bf4['model'],qs['fields'](_0x2d5672[_0x1fa2('0x31')][_0x1fa2('0x35')]));_0x4ddff8[_0x1fa2('0x34')]=_0x4ddff8['attributes'][_0x1fa2('0x36')]?_0x4ddff8['attributes']:_0x516bf4[_0x1fa2('0x30')];if(!_0x2d5672[_0x1fa2('0x31')][_0x1fa2('0x37')](_0x1fa2('0x38'))){_0x4ddff8['limit']=qs[_0x1fa2('0x1c')](_0x2d5672[_0x1fa2('0x31')][_0x1fa2('0x1c')]);_0x4ddff8[_0x1fa2('0x1a')]=qs[_0x1fa2('0x1a')](_0x2d5672[_0x1fa2('0x31')][_0x1fa2('0x1a')]);}_0x4ddff8[_0x1fa2('0x39')]=qs[_0x1fa2('0x3a')](_0x2d5672['query'][_0x1fa2('0x3a')]);_0x4ddff8[_0x1fa2('0x3b')]=qs['filters'](_[_0x1fa2('0x3c')](_0x2d5672['query'],_0x516bf4['filters']),_0x123a47);if(_0x2d5672[_0x1fa2('0x31')][_0x1fa2('0x3d')]){_0x4ddff8[_0x1fa2('0x3b')]=_['merge'](_0x4ddff8['where'],{'$or':_['map'](_0x123a47,function(_0x329f2b){if(_0x329f2b[_0x1fa2('0x2e')]!==_0x1fa2('0x3e')){var _0x375a6c={};_0x375a6c[_0x329f2b[_0x1fa2('0x28')]]={'$like':'%'+_0x2d5672['query'][_0x1fa2('0x3d')]+'%'};return _0x375a6c;}})});}_0x4ddff8=_[_0x1fa2('0x3f')]({},_0x4ddff8,_0x2d5672[_0x1fa2('0x40')]);var _0x4e4e9f={'where':_0x4ddff8[_0x1fa2('0x3b')]};return db[_0x1fa2('0x41')][_0x1fa2('0x1d')](_0x4e4e9f)['then'](function(_0x56a795){_0x227e69[_0x1fa2('0x1d')]=_0x56a795;if(_0x2d5672['query']['includeAll']){_0x4ddff8[_0x1fa2('0x42')]=[{'all':!![]}];}return db[_0x1fa2('0x41')][_0x1fa2('0x43')](_0x4ddff8);})[_0x1fa2('0x23')](function(_0x5c32c7){_0x227e69[_0x1fa2('0x44')]=_0x5c32c7;return _0x227e69;})[_0x1fa2('0x23')](respondWithFilteredResult(_0x722dbc,_0x4ddff8))[_0x1fa2('0x45')](handleError(_0x722dbc,null));};exports[_0x1fa2('0x46')]=function(_0x46412d,_0x3fea8b){var _0x3bcfda={'raw':!![],'where':{'id':_0x46412d[_0x1fa2('0x47')]['id']}},_0x1021a6={};_0x1021a6[_0x1fa2('0x30')]=_[_0x1fa2('0x32')](db[_0x1fa2('0x41')]['rawAttributes']);_0x1021a6[_0x1fa2('0x31')]=_[_0x1fa2('0x32')](_0x46412d[_0x1fa2('0x31')]);_0x1021a6[_0x1fa2('0x33')]=_[_0x1fa2('0x48')](_0x1021a6[_0x1fa2('0x30')],_0x1021a6[_0x1fa2('0x31')]);_0x3bcfda[_0x1fa2('0x34')]=_[_0x1fa2('0x48')](_0x1021a6['model'],qs[_0x1fa2('0x35')](_0x46412d[_0x1fa2('0x31')][_0x1fa2('0x35')]));_0x3bcfda[_0x1fa2('0x34')]=_0x3bcfda[_0x1fa2('0x34')][_0x1fa2('0x36')]?_0x3bcfda[_0x1fa2('0x34')]:_0x1021a6[_0x1fa2('0x30')];if(_0x46412d[_0x1fa2('0x31')]['includeAll']){_0x3bcfda[_0x1fa2('0x42')]=[{'all':!![]}];}_0x3bcfda=_['merge']({},_0x3bcfda,_0x46412d[_0x1fa2('0x40')]);return db[_0x1fa2('0x41')][_0x1fa2('0x49')](_0x3bcfda)[_0x1fa2('0x23')](handleEntityNotFound(_0x3fea8b,null))['then'](respondWithResult(_0x3fea8b,null))[_0x1fa2('0x45')](handleError(_0x3fea8b,null));};exports[_0x1fa2('0x4a')]=function(_0x57e62d,_0x594b9d){var _0x4f886a={'where':{'id':_0x57e62d[_0x1fa2('0x47')]['id']}},_0x2cc29a={};_0x2cc29a['model']=_[_0x1fa2('0x32')](db[_0x1fa2('0x41')][_0x1fa2('0x2c')]);_0x4f886a[_0x1fa2('0x34')]=_['intersection'](_0x2cc29a[_0x1fa2('0x30')],qs[_0x1fa2('0x35')](_0x57e62d[_0x1fa2('0x31')][_0x1fa2('0x35')]));_0x4f886a['attributes']=_0x4f886a[_0x1fa2('0x34')][_0x1fa2('0x36')]?_0x4f886a[_0x1fa2('0x34')]:_0x2cc29a[_0x1fa2('0x30')];if(_0x57e62d[_0x1fa2('0x31')][_0x1fa2('0x4b')]){_0x4f886a['include']=[{'all':!![]}];}_0x4f886a=_[_0x1fa2('0x3f')]({},_0x4f886a,_0x57e62d[_0x1fa2('0x40')]);return db[_0x1fa2('0x41')][_0x1fa2('0x49')](_0x4f886a)[_0x1fa2('0x23')](handleEntityNotFound(_0x594b9d,null))['then'](function(_0xcfc57b){if(_0xcfc57b){var _0x5bbd23=_0xcfc57b[_0x1fa2('0x4c')]({'plain':!![]});_0x5bbd23=qs[_0x1fa2('0x4d')](_0x5bbd23,['id',_0x1fa2('0x4e'),_0x1fa2('0x4f')]);_0x57e62d['body']=_['omit'](_0x57e62d[_0x1fa2('0x50')],['id',_0x1fa2('0x4e'),'updatedAt']);return db['Attachment'][_0x1fa2('0x51')](_[_0x1fa2('0x3f')](_0x5bbd23,_0x57e62d['body']),{'include':_0x57e62d[_0x1fa2('0x31')][_0x1fa2('0x4b')]?[{'all':!![]}]:undefined});}})[_0x1fa2('0x23')](respondWithResult(_0x594b9d,0xc9))[_0x1fa2('0x45')](handleError(_0x594b9d,null));};exports[_0x1fa2('0x22')]=function(_0x148179,_0x4abc41){if(_0x148179[_0x1fa2('0x50')]['id']){delete _0x148179[_0x1fa2('0x50')]['id'];}return db[_0x1fa2('0x41')][_0x1fa2('0x49')]({'where':{'id':_0x148179['params']['id']}})[_0x1fa2('0x23')](handleEntityNotFound(_0x4abc41,null))[_0x1fa2('0x23')](saveUpdates(_0x148179[_0x1fa2('0x50')],null))['then'](respondWithResult(_0x4abc41,null))['catch'](handleError(_0x4abc41,null));};exports[_0x1fa2('0x24')]=function(_0xb7b15a,_0xb19aa1){return db[_0x1fa2('0x41')]['find']({'where':{'id':_0xb7b15a[_0x1fa2('0x47')]['id']}})[_0x1fa2('0x23')](handleEntityNotFound(_0xb19aa1,null))[_0x1fa2('0x23')](removeEntity(_0xb19aa1,null))[_0x1fa2('0x45')](handleError(_0xb19aa1,null));};exports[_0x1fa2('0x51')]=function(_0x2c229e,_0x23bc0e,_0x5e96bf){_0x2c229e[_0x1fa2('0x50')]['name']=_0x2c229e[_0x1fa2('0x52')][_0x1fa2('0x53')];_0x2c229e[_0x1fa2('0x50')][_0x1fa2('0x54')]=_0x2c229e['file'][_0x1fa2('0x55')];_0x2c229e[_0x1fa2('0x50')][_0x1fa2('0x2e')]=_0x2c229e[_0x1fa2('0x52')][_0x1fa2('0x56')];return db[_0x1fa2('0x41')]['create'](_0x2c229e[_0x1fa2('0x50')])['then'](respondWithResult(_0x23bc0e,0xc9))['catch'](handleError(_0x23bc0e,null));};exports[_0x1fa2('0x57')]=function(_0x48da59,_0x23b14d,_0x3a6505){return db['Attachment'][_0x1fa2('0x58')]({'where':{'id':_0x48da59[_0x1fa2('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x23b14d,null))[_0x1fa2('0x23')](function(_0x223fcc){if(_0x223fcc){var _0x453ae2=_0x223fcc[_0x1fa2('0x59')]!==null;var _0x3db156=path[_0x1fa2('0x5a')](config['root'],_0x1fa2('0x5b'));if(_0x453ae2){_0x3db156=path['join'](_0x3db156,_0x1fa2('0x5c'));}var _0x2bdbc8=path[_0x1fa2('0x5a')](_0x3db156,_0x223fcc[_0x1fa2('0x54')]);return _0x23b14d[_0x1fa2('0x57')](_0x2bdbc8);}})[_0x1fa2('0x45')](handleError(_0x23b14d,null));}; \ No newline at end of file +var _0xc965=['includeAll','include','rows','catch','show','length','find','params','get','omit','createdAt','updatedAt','body','create','file','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x58dbee,_0x4be613){var _0x3fdc98=function(_0x416171){while(--_0x416171){_0x58dbee['push'](_0x58dbee['shift']());}};_0x3fdc98(++_0x4be613);}(_0xc965,0x12b));var _0x5c96=function(_0x1d29f6,_0x45f6a0){_0x1d29f6=_0x1d29f6-0x0;var _0x491093=_0xc965[_0x1d29f6];return _0x491093;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c96('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c96('0x1'));var rp=require(_0x5c96('0x2'));var moment=require(_0x5c96('0x3'));var BPromise=require(_0x5c96('0x4'));var Mustache=require('mustache');var util=require(_0x5c96('0x5'));var path=require(_0x5c96('0x6'));var sox=require(_0x5c96('0x7'));var csv=require(_0x5c96('0x8'));var ejs=require(_0x5c96('0x9'));var fs=require('fs');var fs_extra=require(_0x5c96('0xa'));var _=require('lodash');var squel=require(_0x5c96('0xb'));var crypto=require(_0x5c96('0xc'));var jsforce=require(_0x5c96('0xd'));var deskjs=require(_0x5c96('0xe'));var toCsv=require(_0x5c96('0x8'));var querystring=require(_0x5c96('0xf'));var Papa=require(_0x5c96('0x10'));var Redis=require(_0x5c96('0x11'));var authService=require(_0x5c96('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5c96('0x13'));var hardwareService=require(_0x5c96('0x14'));var logger=require(_0x5c96('0x15'))(_0x5c96('0x16'));var utils=require(_0x5c96('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5c96('0x18'));var db=require(_0x5c96('0x19'))['db'];function respondWithStatusCode(_0x50d33e,_0xf08ac0){_0xf08ac0=_0xf08ac0||0xcc;return function(_0x5bbe57){if(_0x5bbe57){return _0x50d33e['sendStatus'](_0xf08ac0);}return _0x50d33e[_0x5c96('0x1a')](_0xf08ac0)[_0x5c96('0x1b')]();};}function respondWithResult(_0x44c91d,_0x295749){_0x295749=_0x295749||0xc8;return function(_0x1b4ea0){if(_0x1b4ea0){return _0x44c91d[_0x5c96('0x1a')](_0x295749)[_0x5c96('0x1c')](_0x1b4ea0);}};}function respondWithFilteredResult(_0x23b18f,_0xb19404){return function(_0x45564d){if(_0x45564d){var _0x13c919=typeof _0xb19404[_0x5c96('0x1d')]==='undefined'&&typeof _0xb19404['limit']===_0x5c96('0x1e');var _0x42dd96=_0x45564d['count'];var _0x3c5405=_0x13c919?0x0:_0xb19404['offset'];var _0xd70605=_0x13c919?_0x45564d[_0x5c96('0x1f')]:_0xb19404[_0x5c96('0x1d')]+_0xb19404[_0x5c96('0x20')];var _0x40d9ce;if(_0xd70605>=_0x42dd96){_0xd70605=_0x42dd96;_0x40d9ce=0xc8;}else{_0x40d9ce=0xce;}_0x23b18f['status'](_0x40d9ce);return _0x23b18f[_0x5c96('0x21')](_0x5c96('0x22'),_0x3c5405+'-'+_0xd70605+'/'+_0x42dd96)[_0x5c96('0x1c')](_0x45564d);}return null;};}function patchUpdates(_0x55a339){return function(_0x16a3f3){try{jsonpatch[_0x5c96('0x23')](_0x16a3f3,_0x55a339,!![]);}catch(_0x226995){return BPromise[_0x5c96('0x24')](_0x226995);}return _0x16a3f3[_0x5c96('0x25')]();};}function saveUpdates(_0x49219c,_0x456926){return function(_0x4a595c){if(_0x4a595c){return _0x4a595c[_0x5c96('0x26')](_0x49219c)[_0x5c96('0x27')](function(_0x5aa6cf){return _0x5aa6cf;});}return null;};}function removeEntity(_0x19339e,_0x2f7f0e){return function(_0x5b98f2){if(_0x5b98f2){return _0x5b98f2[_0x5c96('0x28')]()[_0x5c96('0x27')](function(){_0x19339e[_0x5c96('0x1a')](0xcc)[_0x5c96('0x1b')]();});}};}function handleEntityNotFound(_0x453d30,_0xb8d00c){return function(_0x19b5e2){if(!_0x19b5e2){_0x453d30[_0x5c96('0x29')](0x194);}return _0x19b5e2;};}function handleError(_0x33015c,_0x36a7ea){_0x36a7ea=_0x36a7ea||0x1f4;return function(_0x59dc7d){logger[_0x5c96('0x2a')](_0x59dc7d[_0x5c96('0x2b')]);if(_0x59dc7d[_0x5c96('0x2c')]){delete _0x59dc7d[_0x5c96('0x2c')];}_0x33015c[_0x5c96('0x1a')](_0x36a7ea)[_0x5c96('0x2d')](_0x59dc7d);};}exports[_0x5c96('0x2e')]=function(_0x190404,_0x2fd328){var _0x44927f={},_0x110749={},_0x866664={'count':0x0,'rows':[]};var _0x1af09b=_[_0x5c96('0x2f')](db[_0x5c96('0x30')][_0x5c96('0x31')],function(_0x18e217){return{'name':_0x18e217[_0x5c96('0x32')],'type':_0x18e217[_0x5c96('0x33')][_0x5c96('0x34')]};});_0x110749['model']=_[_0x5c96('0x2f')](_0x1af09b,_0x5c96('0x2c'));_0x110749[_0x5c96('0x35')]=_[_0x5c96('0x36')](_0x190404[_0x5c96('0x35')]);_0x110749[_0x5c96('0x37')]=_[_0x5c96('0x38')](_0x110749['model'],_0x110749[_0x5c96('0x35')]);_0x44927f[_0x5c96('0x39')]=_['intersection'](_0x110749['model'],qs[_0x5c96('0x3a')](_0x190404[_0x5c96('0x35')][_0x5c96('0x3a')]));_0x44927f[_0x5c96('0x39')]=_0x44927f[_0x5c96('0x39')]['length']?_0x44927f[_0x5c96('0x39')]:_0x110749[_0x5c96('0x3b')];if(!_0x190404['query'][_0x5c96('0x3c')](_0x5c96('0x3d'))){_0x44927f['limit']=qs[_0x5c96('0x20')](_0x190404[_0x5c96('0x35')][_0x5c96('0x20')]);_0x44927f[_0x5c96('0x1d')]=qs['offset'](_0x190404[_0x5c96('0x35')][_0x5c96('0x1d')]);}_0x44927f[_0x5c96('0x3e')]=qs[_0x5c96('0x3f')](_0x190404['query'][_0x5c96('0x3f')]);_0x44927f[_0x5c96('0x40')]=qs[_0x5c96('0x37')](_[_0x5c96('0x41')](_0x190404[_0x5c96('0x35')],_0x110749[_0x5c96('0x37')]),_0x1af09b);if(_0x190404[_0x5c96('0x35')][_0x5c96('0x42')]){_0x44927f['where']=_[_0x5c96('0x43')](_0x44927f['where'],{'$or':_[_0x5c96('0x2f')](_0x1af09b,function(_0x1f33da){if(_0x1f33da[_0x5c96('0x33')]!=='VIRTUAL'){var _0x178910={};_0x178910[_0x1f33da[_0x5c96('0x2c')]]={'$like':'%'+_0x190404[_0x5c96('0x35')][_0x5c96('0x42')]+'%'};return _0x178910;}})});}_0x44927f=_[_0x5c96('0x43')]({},_0x44927f,_0x190404[_0x5c96('0x44')]);var _0x160bed={'where':_0x44927f['where']};return db['Attachment'][_0x5c96('0x1f')](_0x160bed)[_0x5c96('0x27')](function(_0x5163e6){_0x866664[_0x5c96('0x1f')]=_0x5163e6;if(_0x190404['query'][_0x5c96('0x45')]){_0x44927f[_0x5c96('0x46')]=[{'all':!![]}];}return db[_0x5c96('0x30')]['findAll'](_0x44927f);})[_0x5c96('0x27')](function(_0x176c1d){_0x866664[_0x5c96('0x47')]=_0x176c1d;return _0x866664;})['then'](respondWithFilteredResult(_0x2fd328,_0x44927f))[_0x5c96('0x48')](handleError(_0x2fd328,null));};exports[_0x5c96('0x49')]=function(_0x1091b8,_0x39262a){var _0x45b162={'raw':!![],'where':{'id':_0x1091b8['params']['id']}},_0xa9d092={};_0xa9d092[_0x5c96('0x3b')]=_[_0x5c96('0x36')](db[_0x5c96('0x30')][_0x5c96('0x31')]);_0xa9d092['query']=_['keys'](_0x1091b8['query']);_0xa9d092['filters']=_['intersection'](_0xa9d092[_0x5c96('0x3b')],_0xa9d092[_0x5c96('0x35')]);_0x45b162[_0x5c96('0x39')]=_[_0x5c96('0x38')](_0xa9d092[_0x5c96('0x3b')],qs[_0x5c96('0x3a')](_0x1091b8['query'][_0x5c96('0x3a')]));_0x45b162[_0x5c96('0x39')]=_0x45b162[_0x5c96('0x39')][_0x5c96('0x4a')]?_0x45b162['attributes']:_0xa9d092[_0x5c96('0x3b')];if(_0x1091b8['query'][_0x5c96('0x45')]){_0x45b162[_0x5c96('0x46')]=[{'all':!![]}];}_0x45b162=_['merge']({},_0x45b162,_0x1091b8[_0x5c96('0x44')]);return db[_0x5c96('0x30')][_0x5c96('0x4b')](_0x45b162)[_0x5c96('0x27')](handleEntityNotFound(_0x39262a,null))[_0x5c96('0x27')](respondWithResult(_0x39262a,null))[_0x5c96('0x48')](handleError(_0x39262a,null));};exports['clone']=function(_0x50da84,_0x430226){var _0x54ca57={'where':{'id':_0x50da84[_0x5c96('0x4c')]['id']}},_0x40df47={};_0x40df47['model']=_[_0x5c96('0x36')](db[_0x5c96('0x30')][_0x5c96('0x31')]);_0x54ca57[_0x5c96('0x39')]=_[_0x5c96('0x38')](_0x40df47[_0x5c96('0x3b')],qs[_0x5c96('0x3a')](_0x50da84[_0x5c96('0x35')][_0x5c96('0x3a')]));_0x54ca57[_0x5c96('0x39')]=_0x54ca57['attributes'][_0x5c96('0x4a')]?_0x54ca57[_0x5c96('0x39')]:_0x40df47[_0x5c96('0x3b')];if(_0x50da84[_0x5c96('0x35')]['includeAll']){_0x54ca57[_0x5c96('0x46')]=[{'all':!![]}];}_0x54ca57=_[_0x5c96('0x43')]({},_0x54ca57,_0x50da84[_0x5c96('0x44')]);return db[_0x5c96('0x30')][_0x5c96('0x4b')](_0x54ca57)[_0x5c96('0x27')](handleEntityNotFound(_0x430226,null))['then'](function(_0x350529){if(_0x350529){var _0x44cd56=_0x350529[_0x5c96('0x4d')]({'plain':!![]});_0x44cd56=qs[_0x5c96('0x4e')](_0x44cd56,['id',_0x5c96('0x4f'),_0x5c96('0x50')]);_0x50da84[_0x5c96('0x51')]=_[_0x5c96('0x4e')](_0x50da84[_0x5c96('0x51')],['id','createdAt',_0x5c96('0x50')]);return db[_0x5c96('0x30')][_0x5c96('0x52')](_[_0x5c96('0x43')](_0x44cd56,_0x50da84['body']),{'include':_0x50da84['query'][_0x5c96('0x45')]?[{'all':!![]}]:undefined});}})[_0x5c96('0x27')](respondWithResult(_0x430226,0xc9))['catch'](handleError(_0x430226,null));};exports['update']=function(_0x34f29d,_0x5d5986){if(_0x34f29d['body']['id']){delete _0x34f29d[_0x5c96('0x51')]['id'];}return db[_0x5c96('0x30')][_0x5c96('0x4b')]({'where':{'id':_0x34f29d[_0x5c96('0x4c')]['id']}})[_0x5c96('0x27')](handleEntityNotFound(_0x5d5986,null))[_0x5c96('0x27')](saveUpdates(_0x34f29d[_0x5c96('0x51')],null))[_0x5c96('0x27')](respondWithResult(_0x5d5986,null))[_0x5c96('0x48')](handleError(_0x5d5986,null));};exports[_0x5c96('0x28')]=function(_0x52b4ca,_0x48d915){return db[_0x5c96('0x30')][_0x5c96('0x4b')]({'where':{'id':_0x52b4ca[_0x5c96('0x4c')]['id']}})[_0x5c96('0x27')](handleEntityNotFound(_0x48d915,null))[_0x5c96('0x27')](removeEntity(_0x48d915,null))[_0x5c96('0x48')](handleError(_0x48d915,null));};exports[_0x5c96('0x52')]=function(_0x3ad19c,_0x247463,_0x3be67d){_0x3ad19c[_0x5c96('0x51')][_0x5c96('0x2c')]=_0x3ad19c[_0x5c96('0x53')]['originalname'];_0x3ad19c['body'][_0x5c96('0x54')]=_0x3ad19c['file']['filename'];_0x3ad19c['body']['type']=_0x3ad19c['file'][_0x5c96('0x55')];return db[_0x5c96('0x30')][_0x5c96('0x52')](_0x3ad19c['body'])[_0x5c96('0x27')](respondWithResult(_0x247463,0xc9))[_0x5c96('0x48')](handleError(_0x247463,null));};exports[_0x5c96('0x56')]=function(_0x17daf6,_0x2e52ad,_0x131142){return db[_0x5c96('0x30')][_0x5c96('0x57')]({'where':{'id':_0x17daf6[_0x5c96('0x4c')]['id']},'raw':!![]})[_0x5c96('0x27')](handleEntityNotFound(_0x2e52ad,null))['then'](function(_0x5d911e){if(_0x5d911e){var _0x412f1a=_0x5d911e[_0x5c96('0x58')]!==null;var _0x2a7200=path[_0x5c96('0x59')](config[_0x5c96('0x5a')],'server/files/attachments/');if(_0x412f1a){_0x2a7200=path[_0x5c96('0x59')](_0x2a7200,_0x5c96('0x5b'));}var _0x434269=path['join'](_0x2a7200,_0x5d911e[_0x5c96('0x54')]);return _0x2e52ad['download'](_0x434269);}})[_0x5c96('0x48')](handleError(_0x2e52ad,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 9eb6777..810f201 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 _0x3bc6=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments'];(function(_0x3e614d,_0x6d57dd){var _0x4db3e1=function(_0x3b1850){while(--_0x3b1850){_0x3e614d['push'](_0x3e614d['shift']());}};_0x4db3e1(++_0x6d57dd);}(_0x3bc6,0x11e));var _0x63bc=function(_0x5e7f0f,_0x4d401d){_0x5e7f0f=_0x5e7f0f-0x0;var _0x3fc2ff=_0x3bc6[_0x5e7f0f];return _0x3fc2ff;};'use strict';var _=require(_0x63bc('0x0'));var util=require(_0x63bc('0x1'));var logger=require(_0x63bc('0x2'))(_0x63bc('0x3'));var moment=require(_0x63bc('0x4'));var BPromise=require(_0x63bc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x63bc('0x6'));var config=require(_0x63bc('0x7'));var attributes=require(_0x63bc('0x8'));module[_0x63bc('0x9')]=function(_0x37208c,_0x4544f3){return _0x37208c[_0x63bc('0xa')](_0x63bc('0xb'),attributes,{'tableName':_0x63bc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a0e=['attachments','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Attachment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3a0e,0xcd));var _0xe3a0=function(_0x1b5580,_0x59cf83){_0x1b5580=_0x1b5580-0x0;var _0x1c5c00=_0x3a0e[_0x1b5580];return _0x1c5c00;};'use strict';var _=require(_0xe3a0('0x0'));var util=require(_0xe3a0('0x1'));var logger=require('../../config/logger')(_0xe3a0('0x2'));var moment=require(_0xe3a0('0x3'));var BPromise=require(_0xe3a0('0x4'));var rp=require(_0xe3a0('0x5'));var fs=require('fs');var path=require(_0xe3a0('0x6'));var rimraf=require(_0xe3a0('0x7'));var config=require(_0xe3a0('0x8'));var attributes=require('./attachment.attributes');module[_0xe3a0('0x9')]=function(_0x3648a2,_0x9ff6a2){return _0x3648a2['define'](_0xe3a0('0xa'),attributes,{'tableName':_0xe3a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index b7fc635..cea44d4 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 _0x19ea=['CreateAttachment','create','options','raw','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x129820,_0xc2891c){var _0x3d864e=function(_0x2cc978){while(--_0x2cc978){_0x129820['push'](_0x129820['shift']());}};_0x3d864e(++_0xc2891c);}(_0x19ea,0xfe));var _0xa19e=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x19ea[_0x349367];return _0x14179b;};'use strict';var _=require(_0xa19e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa19e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19e('0x2'));var db=require(_0xa19e('0x3'))['db'];var utils=require(_0xa19e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa19e('0x5'));var jayson=require(_0xa19e('0x6'));var client=jayson[_0xa19e('0x7')][_0xa19e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1087e7,_0x30fd4a,_0x336e23){return new BPromise(function(_0x1867cb,_0x44e468){return client[_0xa19e('0x9')](_0x1087e7,_0x336e23)[_0xa19e('0xa')](function(_0x59b907){logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));logger[_0xa19e('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x30fd4a,_0xa19e('0xd'),JSON[_0xa19e('0xf')](_0x59b907));if(_0x59b907[_0xa19e('0x10')]){if(_0x59b907['error'][_0xa19e('0x11')]===0x1f4){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x44e468(_0x59b907['error'][_0xa19e('0x12')]);}logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x1867cb(_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);}else{logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));_0x1867cb(_0x59b907[_0xa19e('0x13')]['message']);}})[_0xa19e('0x14')](function(_0x34066a){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x34066a);_0x44e468(_0x34066a);});});}exports[_0xa19e('0x15')]=function(_0x38e398){var _0x1f37c4=this;return new Promise(function(_0x530a75,_0xd3e0ff){return db['Attachment'][_0xa19e('0x16')](_0x38e398['body'],{'raw':_0x38e398['options']?_0x38e398[_0xa19e('0x17')][_0xa19e('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1cb9f9){logger[_0xa19e('0xb')](_0xa19e('0x15'),_0x38e398);logger[_0xa19e('0xe')]('CreateAttachment',_0x38e398,JSON[_0xa19e('0xf')](_0x1cb9f9));_0x530a75(_0x1cb9f9);})[_0xa19e('0x14')](function(_0x105874){logger[_0xa19e('0x10')](_0xa19e('0x15'),_0x105874[_0xa19e('0x12')],_0x38e398);_0xd3e0ff(_0x1f37c4[_0xa19e('0x10')](0x1f4,_0x105874[_0xa19e('0x12')]));});});}; \ No newline at end of file +var _0x8e0d=['CreateAttachment','Attachment','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Attachment,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','catch'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x8e0d,0x82));var _0xd8e0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8e0d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd8e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd8e0('0x1'));var rs=require(_0xd8e0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8e0('0x3'))['db'];var utils=require(_0xd8e0('0x4'));var logger=require(_0xd8e0('0x5'))(_0xd8e0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8e0('0x7')][_0xd8e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42d42b,_0x1e4616,_0x5e9735){return new BPromise(function(_0xd0c45c,_0x144a8a){return client[_0xd8e0('0x9')](_0x42d42b,_0x5e9735)[_0xd8e0('0xa')](function(_0x127a32){logger['info'](_0xd8e0('0xb'),_0x1e4616,'request\x20sent');logger[_0xd8e0('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1e4616,'request\x20sent',JSON[_0xd8e0('0xd')](_0x127a32));if(_0x127a32[_0xd8e0('0xe')]){if(_0x127a32[_0xd8e0('0xe')]['code']===0x1f4){logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0x144a8a(_0x127a32['error']['message']);}logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0xd0c45c(_0x127a32[_0xd8e0('0xe')][_0xd8e0('0xf')]);}else{logger[_0xd8e0('0x10')](_0xd8e0('0xb'),_0x1e4616,_0xd8e0('0x11'));_0xd0c45c(_0x127a32[_0xd8e0('0x12')][_0xd8e0('0xf')]);}})[_0xd8e0('0x13')](function(_0x488ed9){logger[_0xd8e0('0xe')](_0xd8e0('0xb'),_0x1e4616,_0x488ed9);_0x144a8a(_0x488ed9);});});}exports[_0xd8e0('0x14')]=function(_0x42586f){var _0x3b28bc=this;return new Promise(function(_0x2bf195,_0x2c4eaf){return db[_0xd8e0('0x15')]['create'](_0x42586f[_0xd8e0('0x16')],{'raw':_0x42586f[_0xd8e0('0x17')]?_0x42586f['options'][_0xd8e0('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55ce9b){logger['info'](_0xd8e0('0x14'),_0x42586f);logger[_0xd8e0('0xc')]('CreateAttachment',_0x42586f,JSON[_0xd8e0('0xd')](_0x55ce9b));_0x2bf195(_0x55ce9b);})[_0xd8e0('0x13')](function(_0x1d31de){logger[_0xd8e0('0xe')](_0xd8e0('0x14'),_0x1d31de[_0xd8e0('0xf')],_0x42586f);_0x2c4eaf(_0x3b28bc['error'](0x1f4,_0x1d31de[_0xd8e0('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 5eb063a..9c0d0d0 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x305eba,_0x4e7d89){var _0x1c908a=function(_0x5b6413){while(--_0x5b6413){_0x305eba['push'](_0x305eba['shift']());}};_0x1c908a(++_0x4e7d89);}(_0xadb5,0xad));var _0x5adb=function(_0x4b4d6e,_0x4b3dcc){_0x4b4d6e=_0x4b4d6e-0x0;var _0x452560=_0xadb5[_0x4b4d6e];return _0x452560;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x276e04,_0x5cfa86){var _0x44a8d7=function(_0x2622c5){while(--_0x2622c5){_0x276e04['push'](_0x276e04['shift']());}};_0x44a8d7(++_0x5cfa86);}(_0x5f2f,0x73));var _0xf5f2=function(_0x195cf9,_0xea46ec){_0x195cf9=_0x195cf9-0x0;var _0x5ba45e=_0x5f2f[_0x195cf9];return _0x5ba45e;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index d353e7f..b4bcae7 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 _0x2706=['../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','findOne','adSsoEnabled','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','add','clearBlockUser','getLicense','catch','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','User','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service'];(function(_0x11bf0e,_0x5c4048){var _0x40860c=function(_0x1472f7){while(--_0x1472f7){_0x11bf0e['push'](_0x11bf0e['shift']());}};_0x40860c(++_0x5c4048);}(_0x2706,0x107));var _0x6270=function(_0x145db7,_0x133334){_0x145db7=_0x145db7-0x0;var _0x292e1d=_0x2706[_0x145db7];return _0x292e1d;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x6270('0x0'))[_0x6270('0x1')];var moment=require(_0x6270('0x2'));var ActiveDirectory=require(_0x6270('0x3'));var BPromise=require('bluebird');var util=require(_0x6270('0x4'));var db=require(_0x6270('0x5'))['db'];var authService=require(_0x6270('0x6'));var utils=require(_0x6270('0x7'));var config=require(_0x6270('0x8'));var logger=require(_0x6270('0x9'))(_0x6270('0xa'));function isActiveDirectoryConfigured(_0x43e34d){var _0x4fac3f=![];if(typeof _0x43e34d[_0x6270('0xb')]!==_0x6270('0xc')){_0x4fac3f=_0x43e34d['activedirectory'][_0x6270('0xd')]&&_0x43e34d[_0x6270('0xb')][_0x6270('0xe')]&&_0x43e34d[_0x6270('0xb')][_0x6270('0xf')];}return _0x4fac3f;}function adAuthenticate(_0x2764de,_0x5d2e8e,_0x97ee0d){return new BPromise(function(_0x37ebc9,_0x15dc65){try{var _0x1ce751=new ActiveDirectory(_0x2764de);_0x1ce751[_0x6270('0x10')](_0x5d2e8e,_0x97ee0d,function(_0x52bd4c,_0x57a59f){if(_0x52bd4c){logger[_0x6270('0x11')](_0x6270('0x12'),_0x5d2e8e,util['inspect'](_0x52bd4c,{'showHidden':![],'depth':null}));_0x15dc65('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x57a59f){logger['error'](_0x6270('0x13'),_0x5d2e8e);_0x15dc65('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x37ebc9(_0x57a59f);}});}catch(_0x2190cf){_0x15dc65(_0x2190cf);}});}function ActiveDirectoryAuthenticate(_0x49a384,_0x5de8e7,_0x5515cc,_0x17d001){var _0x2a117f,_0xc1e9c7;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x5de8e7);return _0x17d001(null,![],{'message':_0x6270('0x14')});}return db['Setting'][_0x6270('0x15')]({'where':{'id':0x1},'attributes':[_0x6270('0x16'),_0x6270('0x17')],'raw':!![]})[_0x6270('0x18')](function(_0x2c87c9){_0x2a117f=_0x2c87c9;if(!_0x2a117f['adSsoEnabled']){logger[_0x6270('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x5de8e7);throw new Error(_0x6270('0x14'));}return _0x49a384[_0x6270('0x15')]({'attributes':['id',_0x6270('0x19'),_0x6270('0x1a'),_0x6270('0x1b'),_0x6270('0x1c'),_0x6270('0x1d'),_0x6270('0x1e'),_0x6270('0x1f'),_0x6270('0x20')],'where':{'name':_0x5de8e7,'role':{'$or':[_0x6270('0x21'),_0x6270('0x22'),'agent']},'adSsoEnabled':!![]}});})[_0x6270('0x18')](function(_0xc5e5d7){if(!_0xc5e5d7||_0xc5e5d7&&_0xc5e5d7[_0x6270('0x19')]!==_0x5de8e7){throw new Error(_0x6270('0x14'));}_0xc1e9c7=_0xc5e5d7;var _0x3a0090=_0xc1e9c7[_0x6270('0x19')]+'@'+config[_0x6270('0xb')]['domain'];return adAuthenticate(config[_0x6270('0xb')],_0x3a0090,_0x5515cc);})[_0x6270('0x18')](function(_0xb21fc){if(_0xc1e9c7['disabled']){throw new Error(_0x6270('0x14'));}if(_0x2a117f[_0x6270('0x17')]>0x0){if(_0xc1e9c7[_0x6270('0x1e')]){if(moment(_0xc1e9c7[_0x6270('0x1f')])[_0x6270('0x23')](_0x2a117f[_0x6270('0x17')],'minutes')>moment()){throw new Error(_0x6270('0x14'));}return utils[_0x6270('0x24')](_0xc1e9c7,0x0,![],null)[_0x6270('0x18')](function(){return utils[_0x6270('0x25')](_0xc1e9c7);})[_0x6270('0x18')](function(){return _0x17d001(null,_0xc1e9c7);});}else{return utils['getLicense'](_0xc1e9c7)['then'](function(){return _0x17d001(null,_0xc1e9c7);});}}else{return utils[_0x6270('0x25')](_0xc1e9c7)['then'](function(){return _0x17d001(null,_0xc1e9c7);});}})[_0x6270('0x26')](function(_0x16e536){return _0x17d001(null,![],_0x16e536);});}function handleError(_0x5b027b,_0x4f4ee0,_0x157052){return _0x5b027b['status'](_0x4f4ee0||0x1f4)[_0x6270('0x27')]({'message':_0x157052?_0x157052[_0x6270('0x28')]||_0x157052:''});}exports[_0x6270('0x29')]=function(_0x24c63f,_0x2a0164,_0x51a8eb){passport[_0x6270('0x10')](_0x6270('0x2a'),function(_0x36f64a,_0xae58dc,_0x1b0f5f){var _0x351b0b=_0x36f64a||_0x1b0f5f;if(_0x351b0b){return handleError(_0x2a0164,0x191,_0x351b0b);}if(!_0xae58dc){return handleError(_0x2a0164,0x194,{'message':_0x6270('0x2b')});}else{var _0x76b030={'payload':{'id':_0xae58dc['id'],'role':_0xae58dc[_0x6270('0x1c')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x76b030)[_0x6270('0x18')](function(_0x451ac3){_0x2a0164['json']({'id':_0xae58dc['id'],'token':_0x451ac3,'statusCall':'','isAlreadyLogged':_0xae58dc[_0x6270('0x20')]});});}})(_0x24c63f,_0x2a0164,_0x51a8eb);};passport['use'](_0x6270('0x2a'),new LocalStrategy({'usernameField':_0x6270('0x19'),'passwordField':_0x6270('0x1a')},function(_0x3796c3,_0x41f42a,_0x2c16aa){return ActiveDirectoryAuthenticate(db[_0x6270('0x2c')],_0x3796c3,_0x41f42a,_0x2c16aa);})); \ No newline at end of file +var _0xdacc=['blocked','online','admin','agent','minutes','getLicense','catch','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','use','User','passport','passport-local','moment','bluebird','util','../../mysqldb','../../config/environment','api','activedirectory','undefined','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled'];(function(_0x4848d,_0x2f98be){var _0x2d2462=function(_0x2e4d05){while(--_0x2e4d05){_0x4848d['push'](_0x4848d['shift']());}};_0x2d2462(++_0x2f98be);}(_0xdacc,0x1d0));var _0xcdac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdacc[_0xa464c9];return _0x3d73c4;};'use strict';var passport=require(_0xcdac('0x0'));var LocalStrategy=require(_0xcdac('0x1'))['Strategy'];var moment=require(_0xcdac('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xcdac('0x3'));var util=require(_0xcdac('0x4'));var db=require(_0xcdac('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0xcdac('0x6'));var logger=require('../../config/logger')(_0xcdac('0x7'));function isActiveDirectoryConfigured(_0xbafb23){var _0x253536=![];if(typeof _0xbafb23[_0xcdac('0x8')]!==_0xcdac('0x9')){_0x253536=_0xbafb23['activedirectory'][_0xcdac('0xa')]&&_0xbafb23[_0xcdac('0x8')][_0xcdac('0xb')]&&_0xbafb23[_0xcdac('0x8')]['domain'];}return _0x253536;}function adAuthenticate(_0x79c30a,_0x50ec79,_0x44a0af){return new BPromise(function(_0x5a2556,_0x2c761a){try{var _0x462acd=new ActiveDirectory(_0x79c30a);_0x462acd[_0xcdac('0xc')](_0x50ec79,_0x44a0af,function(_0x221435,_0x3b364c){if(_0x221435){logger[_0xcdac('0xd')](_0xcdac('0xe'),_0x50ec79,util[_0xcdac('0xf')](_0x221435,{'showHidden':![],'depth':null}));_0x2c761a(_0xcdac('0x10'));}else if(!_0x3b364c){logger[_0xcdac('0xd')](_0xcdac('0x11'),_0x50ec79);_0x2c761a(_0xcdac('0x10'));}else{_0x5a2556(_0x3b364c);}});}catch(_0x1b18f4){_0x2c761a(_0x1b18f4);}});}function ActiveDirectoryAuthenticate(_0x479128,_0x5a070f,_0x322e23,_0x4d78c2){var _0x138d77,_0x5e56e7;if(!isActiveDirectoryConfigured(config)){logger[_0xcdac('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x5a070f);return _0x4d78c2(null,![],{'message':_0xcdac('0x10')});}return db[_0xcdac('0x12')][_0xcdac('0x13')]({'where':{'id':0x1},'attributes':[_0xcdac('0x14'),_0xcdac('0x15')],'raw':!![]})[_0xcdac('0x16')](function(_0xd2c7a8){_0x138d77=_0xd2c7a8;if(!_0x138d77[_0xcdac('0x14')]){logger[_0xcdac('0xd')](_0xcdac('0x17'),_0x5a070f);throw new Error(_0xcdac('0x10'));}return _0x479128[_0xcdac('0x13')]({'attributes':['id',_0xcdac('0x18'),_0xcdac('0x19'),_0xcdac('0x1a'),'role',_0xcdac('0x1b'),_0xcdac('0x1c'),'blockedAt',_0xcdac('0x1d')],'where':{'name':_0x5a070f,'role':{'$or':[_0xcdac('0x1e'),'user',_0xcdac('0x1f')]},'adSsoEnabled':!![]}});})['then'](function(_0x3504a7){if(!_0x3504a7||_0x3504a7&&_0x3504a7['name']!==_0x5a070f){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x5e56e7=_0x3504a7;var _0x3dee9a=_0x5e56e7['name']+'@'+config[_0xcdac('0x8')]['domain'];return adAuthenticate(config[_0xcdac('0x8')],_0x3dee9a,_0x322e23);})['then'](function(_0x26ec94){if(_0x5e56e7[_0xcdac('0x1b')]){throw new Error(_0xcdac('0x10'));}if(_0x138d77['blockDuration']>0x0){if(_0x5e56e7[_0xcdac('0x1c')]){if(moment(_0x5e56e7['blockedAt'])['add'](_0x138d77[_0xcdac('0x15')],_0xcdac('0x20'))>moment()){throw new Error(_0xcdac('0x10'));}return utils['clearBlockUser'](_0x5e56e7,0x0,![],null)[_0xcdac('0x16')](function(){return utils[_0xcdac('0x21')](_0x5e56e7);})['then'](function(){return _0x4d78c2(null,_0x5e56e7);});}else{return utils[_0xcdac('0x21')](_0x5e56e7)[_0xcdac('0x16')](function(){return _0x4d78c2(null,_0x5e56e7);});}}else{return utils['getLicense'](_0x5e56e7)['then'](function(){return _0x4d78c2(null,_0x5e56e7);});}})[_0xcdac('0x22')](function(_0x3b7d9b){return _0x4d78c2(null,![],_0x3b7d9b);});}function handleError(_0x1dbcc9,_0xe6997,_0x1b8542){return _0x1dbcc9['status'](_0xe6997||0x1f4)[_0xcdac('0x23')]({'message':_0x1b8542?_0x1b8542[_0xcdac('0x24')]||_0x1b8542:''});}exports['login']=function(_0x504b54,_0x52aecf,_0x3449f2){passport[_0xcdac('0xc')](_0xcdac('0x25'),function(_0x1f5da6,_0x1c060b,_0x19c3ff){var _0x4cddab=_0x1f5da6||_0x19c3ff;if(_0x4cddab){return handleError(_0x52aecf,0x191,_0x4cddab);}if(!_0x1c060b){return handleError(_0x52aecf,0x194,{'message':_0xcdac('0x26')});}else{var _0x173e19={'payload':{'id':_0x1c060b['id'],'role':_0x1c060b['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x173e19)[_0xcdac('0x16')](function(_0x579fb7){_0x52aecf['json']({'id':_0x1c060b['id'],'token':_0x579fb7,'statusCall':'','isAlreadyLogged':_0x1c060b[_0xcdac('0x1d')]});});}})(_0x504b54,_0x52aecf,_0x3449f2);};passport[_0xcdac('0x27')](_0xcdac('0x25'),new LocalStrategy({'usernameField':'name','passwordField':_0xcdac('0x19')},function(_0x3ccb74,_0xc009b1,_0x8d765a){return ActiveDirectoryAuthenticate(db[_0xcdac('0x28')],_0x3ccb74,_0xc009b1,_0x8d765a);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 74090f3..7c71682 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 _0xd5d4=['login','express','Router','./authActiveDirectory.controller','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd5d4,0x17d));var _0x4d5d=function(_0x52282a,_0x45aef7){_0x52282a=_0x52282a-0x0;var _0x3c66b4=_0xd5d4[_0x52282a];return _0x3c66b4;};'use strict';var express=require(_0x4d5d('0x0'));var router=express[_0x4d5d('0x1')]();var controller=require(_0x4d5d('0x2'));router[_0x4d5d('0x3')]('/',controller[_0x4d5d('0x4')]);module['exports']=router; \ No newline at end of file +var _0xaa60=['./authActiveDirectory.controller','post','login','exports','express','Router'];(function(_0x491cf8,_0x8b5453){var _0x48a17d=function(_0x2f9eec){while(--_0x2f9eec){_0x491cf8['push'](_0x491cf8['shift']());}};_0x48a17d(++_0x8b5453);}(_0xaa60,0xd0));var _0x0aa6=function(_0x4ecbed,_0x1d672f){_0x4ecbed=_0x4ecbed-0x0;var _0x364b4c=_0xaa60[_0x4ecbed];return _0x364b4c;};'use strict';var express=require(_0x0aa6('0x0'));var router=express[_0x0aa6('0x1')]();var controller=require(_0x0aa6('0x2'));router[_0x0aa6('0x3')]('/',controller[_0x0aa6('0x4')]);module[_0x0aa6('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 9bf3384..5d52719 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(_0x3b8240,_0x4cf6d6){var _0x39edd4=function(_0x165de1){while(--_0x165de1){_0x3b8240['push'](_0x3b8240['shift']());}};_0x39edd4(++_0x4cf6d6);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +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(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7a54,0x106));var _0x47a5=function(_0x5a6955,_0x1d0864){_0x5a6955=_0x5a6955-0x0;var _0x5df2a1=_0x7a54[_0x5a6955];return _0x5df2a1;};'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 6d06a42..1f2ef7e 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 _0x422c=['../../components/auth/service','get','login','/callback','callback','isMiddleware','express','passport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x422c,0x1ee));var _0xc422=function(_0x3851ba,_0x3da6fb){_0x3851ba=_0x3851ba-0x0;var _0x3d7a78=_0x422c[_0x3851ba];return _0x3d7a78;};'use strict';var express=require(_0xc422('0x0'));var passport=require(_0xc422('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0xc422('0x2'));router[_0xc422('0x3')]('/',controller[_0xc422('0x4')]);router['get'](_0xc422('0x5'),controller[_0xc422('0x6')],authService[_0xc422('0x7')],userController[_0xc422('0x4')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x12b3=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','exports','express','passport'];(function(_0x5ba714,_0x2bb306){var _0x417277=function(_0x63751d){while(--_0x63751d){_0x5ba714['push'](_0x5ba714['shift']());}};_0x417277(++_0x2bb306);}(_0x12b3,0xf0));var _0x312b=function(_0x1db321,_0x2a3ca7){_0x1db321=_0x1db321-0x0;var _0x53670f=_0x12b3[_0x1db321];return _0x53670f;};'use strict';var express=require(_0x312b('0x0'));var passport=require(_0x312b('0x1'));var router=express['Router']();var controller=require(_0x312b('0x2'));var userController=require(_0x312b('0x3'));var authService=require(_0x312b('0x4'));router[_0x312b('0x5')]('/',controller[_0x312b('0x6')]);router[_0x312b('0x5')](_0x312b('0x7'),controller[_0x312b('0x8')],authService[_0x312b('0x9')],userController[_0x312b('0x6')],authService['setTokenCookie']);module[_0x312b('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 5b9cc4f..5dfbc20 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 _0xc822=['request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','message','local-login','json','online','body','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','Setting','passwordHistoryLimit','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','resetPasswordExpires','send','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','client','http','findOne','allowedLoginAttempts','blockDuration','then','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','Smtp','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xc822,0x10d));var _0x2c82=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0xc822[_0x36fbef];return _0x45e270;};'use strict';var util=require(_0x2c82('0x0'));var passport=require('passport');var LocalStrategy=require(_0x2c82('0x1'))[_0x2c82('0x2')];var jayson=require(_0x2c82('0x3'));var _=require(_0x2c82('0x4'));var rs=require(_0x2c82('0x5'));var moment=require(_0x2c82('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x2c82('0x7'));var utils=require('../../config/utils');var client=jayson[_0x2c82('0x8')][_0x2c82('0x9')]({'port':0x232b});function localAuthenticate(_0x2c53e3,_0x2deb08,_0x57008d,_0x56821b){var _0x55e04e,_0x134089;return db['Setting'][_0x2c82('0xa')]({'where':{'id':0x1},'attributes':[_0x2c82('0xb'),_0x2c82('0xc')],'raw':!![]})[_0x2c82('0xd')](function(_0xd58daa){_0x55e04e=_0xd58daa;return _0x2c53e3[_0x2c82('0xa')]({'attributes':['id','name',_0x2c82('0xe'),_0x2c82('0xf'),_0x2c82('0x10'),_0x2c82('0x11'),_0x2c82('0x12'),_0x2c82('0x13'),_0x2c82('0x14')],'where':{'name':_0x2deb08,'role':{'$or':[_0x2c82('0x15'),_0x2c82('0x16'),'agent']}}});})[_0x2c82('0xd')](function(_0x2b56d1){if(!_0x2b56d1||_0x2b56d1&&_0x2b56d1[_0x2c82('0x17')]!==_0x2deb08){throw new Error(_0x2c82('0x18'));}else{_0x134089=_0x2b56d1;return _0x134089;}})[_0x2c82('0xd')](function(){_0x134089[_0x2c82('0x19')](_0x57008d,function(_0x10c4cb,_0x46c58a){var _0x3ebc9c=_0x134089['loginAttempts']+0x1;if(_0x10c4cb){return _0x56821b(_0x10c4cb);}else if(!_0x46c58a){if(_0x134089[_0x2c82('0x11')]){return _0x56821b(null,![],{'message':_0x2c82('0x18')});}else if(_0x55e04e[_0x2c82('0xb')]>0x0){if(_0x134089['blocked']){if(_0x55e04e[_0x2c82('0xc')]>0x0){if(moment(_0x134089[_0x2c82('0x13')])[_0x2c82('0x1a')](_0x55e04e[_0x2c82('0xc')],'minutes')>moment()){return _0x56821b(null,![],{'message':_0x2c82('0x18')});}else{return utils[_0x2c82('0x1b')](_0x134089,_0x3ebc9c,![],null)['then'](function(){return _0x56821b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x56821b(null,![],{'message':_0x2c82('0x18')});}}else{if(_0x3ebc9c>=_0x55e04e['allowedLoginAttempts']){return utils[_0x2c82('0x1b')](_0x134089,0x0,!![],moment())[_0x2c82('0xd')](function(){return _0x56821b(null,![],{'message':_0x2c82('0x18')});});}else{return utils['clearBlockUser'](_0x134089,_0x3ebc9c,![],null)[_0x2c82('0xd')](function(){return _0x56821b(null,![],{'message':_0x2c82('0x18')});});}}}else{return _0x56821b(null,![],{'message':_0x2c82('0x18')});}}else{if(_0x134089[_0x2c82('0x11')]){return _0x56821b(null,![],{'message':_0x2c82('0x18')});}else if(_0x55e04e[_0x2c82('0xb')]>0x0){if(_0x134089[_0x2c82('0x12')]){if(_0x55e04e[_0x2c82('0xc')]>0x0){if(moment(_0x134089[_0x2c82('0x13')])['add'](_0x55e04e[_0x2c82('0xc')],_0x2c82('0x1c'))>moment()){return _0x56821b(null,![],{'message':_0x2c82('0x18')});}else{return utils['clearBlockUser'](_0x134089,0x0,![],null)['then'](function(){return utils[_0x2c82('0x1d')](_0x134089);})[_0x2c82('0xd')](function(){return _0x56821b(null,_0x134089);});}}else{return _0x56821b(null,![],{'message':_0x2c82('0x18')});}}else{return utils[_0x2c82('0x1b')](_0x134089,0x0,![],null)['then'](function(){return utils['getLicense'](_0x134089);})['then'](function(){return _0x56821b(null,_0x134089);})[_0x2c82('0x1e')](function(_0x72683c){return _0x56821b(null,![],_0x72683c);});}}else{if(_0x134089[_0x2c82('0x12')]){return _0x56821b(null,![],{'message':_0x2c82('0x18')});}else{return utils[_0x2c82('0x1d')](_0x134089)[_0x2c82('0xd')](function(){return _0x56821b(null,_0x134089);});}}}});})[_0x2c82('0x1e')](function(_0x894d01){return _0x56821b(null,![],_0x894d01);});}function sendServiceMail(_0x3a7beb){return db[_0x2c82('0x1f')][_0x2c82('0x20')]({'where':{'service':!![]},'attributes':['id',_0x2c82('0x17'),_0x2c82('0x21')],'include':[{'model':db['MailServerOut'],'as':_0x2c82('0x22'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0x2c82('0xd')](function(_0x130fb9){if(!_0x130fb9){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5dde94=_0x130fb9[_0x2c82('0x23')]();var _0x30ccc8={'account':_0x5dde94,'message':_[_0x2c82('0x24')]({'from':util[_0x2c82('0x25')](_0x2c82('0x26'),_0x130fb9[_0x2c82('0x17')],_0x130fb9[_0x2c82('0x21')]||_0x130fb9[_0x2c82('0x22')][_0x2c82('0x16')])},_0x3a7beb)};return client[_0x2c82('0x27')](_0x2c82('0x28'),_0x30ccc8);})[_0x2c82('0xd')](function(_0x1198e1){if(_0x1198e1[_0x2c82('0x29')]){throw new Error(util[_0x2c82('0x25')](_0x2c82('0x2a'),_0x1198e1['error']['message']||JSON['stringify'](_0x1198e1['error'])));}return!![];});}function handleError(_0x4e0990,_0x5d7aa4,_0x2b1b2f){return _0x4e0990[_0x2c82('0x2b')](_0x5d7aa4||0x1f4)['send']({'message':_0x2b1b2f?_0x2b1b2f[_0x2c82('0x2c')]||_0x2b1b2f:''});}exports['login']=function(_0x2a8cb4,_0x571d1a,_0x5d91da){passport[_0x2c82('0x19')](_0x2c82('0x2d'),function(_0x5a0171,_0x547357,_0x4c06c4){var _0xe69b8d=_0x5a0171||_0x4c06c4;if(_0xe69b8d){return handleError(_0x571d1a,0x191,_0xe69b8d);}if(!_0x547357){return handleError(_0x571d1a,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x239b8b={'payload':{'id':_0x547357['id'],'role':_0x547357[_0x2c82('0x10')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x239b8b)['then'](function(_0x2ce4bd){_0x571d1a[_0x2c82('0x2e')]({'id':_0x547357['id'],'token':_0x2ce4bd,'statusCall':'','isAlreadyLogged':_0x547357[_0x2c82('0x2f')]});});}})(_0x2a8cb4,_0x571d1a,_0x5d91da);};exports['forgot']=function(_0x51495f,_0x2fda11){if(!_0x51495f[_0x2c82('0x30')][_0x2c82('0x21')]){return handleError(_0x2fda11,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x479dae=rs[_0x2c82('0x31')]();_0x51495f[_0x2c82('0x30')]['email']=_0x51495f[_0x2c82('0x30')][_0x2c82('0x21')][_0x2c82('0x32')]()[_0x2c82('0x33')]();var _0x11286b;return db['Setting'][_0x2c82('0xa')]({'where':{'id':0x1},'attributes':[_0x2c82('0xb'),'blockDuration'],'raw':!![]})[_0x2c82('0xd')](function(_0x296173){_0x11286b=_0x296173;return db[_0x2c82('0x34')][_0x2c82('0x20')]({'where':{'email':_0x51495f[_0x2c82('0x30')][_0x2c82('0x21')]}});})[_0x2c82('0xd')](function(_0x37e8e7){if(!_0x37e8e7){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x37e8e7[_0x2c82('0x11')]){throw new Error(_0x2c82('0x35'));}if(_0x37e8e7['blocked']){if(moment(_0x37e8e7[_0x2c82('0x13')])['add'](_0x11286b[_0x2c82('0xc')],_0x2c82('0x1c'))>moment()){throw new Error(_0x2c82('0x36'));}else{_0x37e8e7['blocked']=![];_0x37e8e7[_0x2c82('0x13')]=null;}}_0x37e8e7[_0x2c82('0x37')]=_0x479dae;_0x37e8e7['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x37e8e7[_0x2c82('0x38')]();})[_0x2c82('0xd')](function(){return sendServiceMail({'to':_0x51495f['body']['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x2c82('0x39')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x2c82('0x3a')+_0x51495f['headers'][_0x2c82('0x3b')]+_0x2c82('0x3c')+_0x479dae+'\x0a\x0a'+_0x2c82('0x3d')});})['then'](function(){_0x2fda11[_0x2c82('0x2b')](0xc8)['send']({'message':_0x2c82('0x3e')});})[_0x2c82('0x1e')](function(_0x2e41c3){return handleError(_0x2fda11,0x1f4,_0x2e41c3);});};exports[_0x2c82('0x3f')]=function(_0x10852b,_0x11da1b){return db[_0x2c82('0x34')][_0x2c82('0x20')]({'where':{'resetPasswordToken':_0x10852b[_0x2c82('0x40')][_0x2c82('0x41')],'resetPasswordExpires':{'$gt':Date[_0x2c82('0x42')]()}}})[_0x2c82('0xd')](function(_0xc54a6d){if(!_0xc54a6d){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x2c82('0x43')][_0x2c82('0xa')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x2c82('0x44')]})[_0x2c82('0xd')](function(_0x417487){if(_0x417487[_0x2c82('0x45')])authService[_0x2c82('0x46')](_0x10852b[_0x2c82('0x30')]['password']);if(!_0x417487[_0x2c82('0x47')]||!_0xc54a6d[_0x2c82('0x48')])return _0xc54a6d;authService['validatePasswordHistory'](_0x10852b[_0x2c82('0x30')]['password'],_0xc54a6d['previousPasswords'],_0x417487[_0x2c82('0x44')]);return _0xc54a6d;})[_0x2c82('0xd')](function(){_0xc54a6d[_0x2c82('0xe')]=_0x10852b['body'][_0x2c82('0xe')];_0xc54a6d['resetPasswordToken']=null;_0xc54a6d[_0x2c82('0x49')]=null;return _0xc54a6d[_0x2c82('0x38')]();});})[_0x2c82('0xd')](function(){_0x11da1b['status'](0xc8)[_0x2c82('0x4a')]({'message':_0x2c82('0x4b')});})['catch'](function(_0x4d3208){return handleError(_0x11da1b,0x1f4,_0x4d3208);});};passport[_0x2c82('0x4c')](_0x2c82('0x2d'),new LocalStrategy({'usernameField':_0x2c82('0x17'),'passwordField':_0x2c82('0xe')},function(_0x274ad0,_0x343461,_0x3cdff6){return localAuthenticate(db[_0x2c82('0x34')],_0x274ad0,_0x343461,_0x3cdff6);})); \ No newline at end of file +var _0x64e6=['../../config/utils','client','http','Setting','allowedLoginAttempts','findOne','name','password','salt','blocked','blockedAt','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','loginAttempts','disabled','blockDuration','add','clearBlockUser','minutes','getLicense','catch','MailAccount','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','Email\x20parameter\x20is\x20missing','generate','body','trim','User','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','passport','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service'];(function(_0x46e208,_0x95cd01){var _0x466942=function(_0x13ad96){while(--_0x13ad96){_0x46e208['push'](_0x46e208['shift']());}};_0x466942(++_0x95cd01);}(_0x64e6,0x1e5));var _0x664e=function(_0x34a3fc,_0x3577eb){_0x34a3fc=_0x34a3fc-0x0;var _0x322531=_0x64e6[_0x34a3fc];return _0x322531;};'use strict';var util=require('util');var passport=require(_0x664e('0x0'));var LocalStrategy=require('passport-local')[_0x664e('0x1')];var jayson=require(_0x664e('0x2'));var _=require('lodash');var rs=require(_0x664e('0x3'));var moment=require(_0x664e('0x4'));var db=require(_0x664e('0x5'))['db'];var authService=require(_0x664e('0x6'));var utils=require(_0x664e('0x7'));var client=jayson[_0x664e('0x8')][_0x664e('0x9')]({'port':0x232b});function localAuthenticate(_0x41daa9,_0x8f9308,_0x566799,_0x39bf10){var _0x289581,_0x591fd7;return db[_0x664e('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x664e('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x1fe3ac){_0x289581=_0x1fe3ac;return _0x41daa9[_0x664e('0xc')]({'attributes':['id',_0x664e('0xd'),_0x664e('0xe'),_0x664e('0xf'),'role','disabled',_0x664e('0x10'),_0x664e('0x11'),'loginAttempts'],'where':{'name':_0x8f9308,'role':{'$or':[_0x664e('0x12'),'user',_0x664e('0x13')]}}});})['then'](function(_0x5cfa11){if(!_0x5cfa11||_0x5cfa11&&_0x5cfa11[_0x664e('0xd')]!==_0x8f9308){throw new Error(_0x664e('0x14'));}else{_0x591fd7=_0x5cfa11;return _0x591fd7;}})[_0x664e('0x15')](function(){_0x591fd7[_0x664e('0x16')](_0x566799,function(_0x1a10f3,_0x3c2d53){var _0x4bfacc=_0x591fd7[_0x664e('0x17')]+0x1;if(_0x1a10f3){return _0x39bf10(_0x1a10f3);}else if(!_0x3c2d53){if(_0x591fd7[_0x664e('0x18')]){return _0x39bf10(null,![],{'message':_0x664e('0x14')});}else if(_0x289581[_0x664e('0xb')]>0x0){if(_0x591fd7[_0x664e('0x10')]){if(_0x289581[_0x664e('0x19')]>0x0){if(moment(_0x591fd7[_0x664e('0x11')])[_0x664e('0x1a')](_0x289581[_0x664e('0x19')],'minutes')>moment()){return _0x39bf10(null,![],{'message':_0x664e('0x14')});}else{return utils['clearBlockUser'](_0x591fd7,_0x4bfacc,![],null)['then'](function(){return _0x39bf10(null,![],{'message':_0x664e('0x14')});});}}else{return _0x39bf10(null,![],{'message':_0x664e('0x14')});}}else{if(_0x4bfacc>=_0x289581[_0x664e('0xb')]){return utils['clearBlockUser'](_0x591fd7,0x0,!![],moment())[_0x664e('0x15')](function(){return _0x39bf10(null,![],{'message':_0x664e('0x14')});});}else{return utils[_0x664e('0x1b')](_0x591fd7,_0x4bfacc,![],null)[_0x664e('0x15')](function(){return _0x39bf10(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x39bf10(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x591fd7[_0x664e('0x18')]){return _0x39bf10(null,![],{'message':_0x664e('0x14')});}else if(_0x289581[_0x664e('0xb')]>0x0){if(_0x591fd7[_0x664e('0x10')]){if(_0x289581[_0x664e('0x19')]>0x0){if(moment(_0x591fd7[_0x664e('0x11')])[_0x664e('0x1a')](_0x289581[_0x664e('0x19')],_0x664e('0x1c'))>moment()){return _0x39bf10(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x664e('0x1b')](_0x591fd7,0x0,![],null)[_0x664e('0x15')](function(){return utils[_0x664e('0x1d')](_0x591fd7);})[_0x664e('0x15')](function(){return _0x39bf10(null,_0x591fd7);});}}else{return _0x39bf10(null,![],{'message':_0x664e('0x14')});}}else{return utils[_0x664e('0x1b')](_0x591fd7,0x0,![],null)[_0x664e('0x15')](function(){return utils[_0x664e('0x1d')](_0x591fd7);})['then'](function(){return _0x39bf10(null,_0x591fd7);})[_0x664e('0x1e')](function(_0x4f56b0){return _0x39bf10(null,![],_0x4f56b0);});}}else{if(_0x591fd7[_0x664e('0x10')]){return _0x39bf10(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x664e('0x1d')](_0x591fd7)['then'](function(){return _0x39bf10(null,_0x591fd7);});}}}});})[_0x664e('0x1e')](function(_0x399278){return _0x39bf10(null,![],_0x399278);});}function sendServiceMail(_0x589fb1){return db[_0x664e('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x664e('0xd'),_0x664e('0x20')],'include':[{'model':db[_0x664e('0x21')],'as':'Smtp','include':[{'model':db[_0x664e('0x22')],'as':_0x664e('0x22')}]}]})[_0x664e('0x15')](function(_0x1d7c56){if(!_0x1d7c56){throw new Error(_0x664e('0x23'));}var _0x4a258f=_0x1d7c56[_0x664e('0x24')]();var _0xbe582b={'account':_0x4a258f,'message':_[_0x664e('0x25')]({'from':util[_0x664e('0x26')](_0x664e('0x27'),_0x1d7c56[_0x664e('0xd')],_0x1d7c56['email']||_0x1d7c56[_0x664e('0x28')][_0x664e('0x29')])},_0x589fb1)};return client[_0x664e('0x2a')](_0x664e('0x2b'),_0xbe582b);})[_0x664e('0x15')](function(_0x35cd6f){if(_0x35cd6f[_0x664e('0x2c')]){throw new Error(util[_0x664e('0x26')](_0x664e('0x2d'),_0x35cd6f[_0x664e('0x2c')][_0x664e('0x2e')]||JSON[_0x664e('0x2f')](_0x35cd6f[_0x664e('0x2c')])));}return!![];});}function handleError(_0x4adc9d,_0x569a6d,_0xb2bd2){return _0x4adc9d[_0x664e('0x30')](_0x569a6d||0x1f4)[_0x664e('0x31')]({'message':_0xb2bd2?_0xb2bd2[_0x664e('0x2e')]||_0xb2bd2:''});}exports[_0x664e('0x32')]=function(_0x216130,_0x5e02a1,_0x3b5a00){passport[_0x664e('0x16')](_0x664e('0x33'),function(_0x58bd05,_0x5d8305,_0x1665c3){var _0x55f15c=_0x58bd05||_0x1665c3;if(_0x55f15c){return handleError(_0x5e02a1,0x191,_0x55f15c);}if(!_0x5d8305){return handleError(_0x5e02a1,0x194,{'message':_0x664e('0x34')});}else{var _0x4d5d14={'payload':{'id':_0x5d8305['id'],'role':_0x5d8305['role']},'options':{'expiresIn':0x15180}};return authService[_0x664e('0x35')](_0x4d5d14)[_0x664e('0x15')](function(_0x5891b9){_0x5e02a1[_0x664e('0x36')]({'id':_0x5d8305['id'],'token':_0x5891b9,'statusCall':'','isAlreadyLogged':_0x5d8305['online']});});}})(_0x216130,_0x5e02a1,_0x3b5a00);};exports['forgot']=function(_0x5165f9,_0x2fcd07){if(!_0x5165f9['body']['email']){return handleError(_0x2fcd07,0x1f4,{'message':_0x664e('0x37')});}var _0x39e2c1=rs[_0x664e('0x38')]();_0x5165f9['body'][_0x664e('0x20')]=_0x5165f9[_0x664e('0x39')][_0x664e('0x20')][_0x664e('0x3a')]()['toLowerCase']();var _0x4484b2;return db[_0x664e('0xa')][_0x664e('0xc')]({'where':{'id':0x1},'attributes':[_0x664e('0xb'),'blockDuration'],'raw':!![]})[_0x664e('0x15')](function(_0x122f49){_0x4484b2=_0x122f49;return db[_0x664e('0x3b')][_0x664e('0x3c')]({'where':{'email':_0x5165f9['body'][_0x664e('0x20')]}});})[_0x664e('0x15')](function(_0x575e33){if(!_0x575e33){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x575e33['disabled']){throw new Error(_0x664e('0x3d'));}if(_0x575e33[_0x664e('0x10')]){if(moment(_0x575e33[_0x664e('0x11')])[_0x664e('0x1a')](_0x4484b2[_0x664e('0x19')],_0x664e('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x575e33[_0x664e('0x10')]=![];_0x575e33[_0x664e('0x11')]=null;}}_0x575e33[_0x664e('0x3e')]=_0x39e2c1;_0x575e33[_0x664e('0x3f')]=Date['now']()+0x36ee80;return _0x575e33[_0x664e('0x40')]();})[_0x664e('0x15')](function(){return sendServiceMail({'to':_0x5165f9[_0x664e('0x39')][_0x664e('0x20')],'subject':_0x664e('0x41'),'text':_0x664e('0x42')+_0x664e('0x43')+_0x664e('0x44')+_0x5165f9['headers'][_0x664e('0x45')]+'/reset/'+_0x39e2c1+'\x0a\x0a'+_0x664e('0x46')});})[_0x664e('0x15')](function(){_0x2fcd07['status'](0xc8)[_0x664e('0x31')]({'message':'Reset\x20Email\x20sent!'});})[_0x664e('0x1e')](function(_0x37485d){return handleError(_0x2fcd07,0x1f4,_0x37485d);});};exports[_0x664e('0x47')]=function(_0x2914ba,_0x15380c){return db[_0x664e('0x3b')][_0x664e('0x3c')]({'where':{'resetPasswordToken':_0x2914ba[_0x664e('0x48')]['token'],'resetPasswordExpires':{'$gt':Date[_0x664e('0x49')]()}}})[_0x664e('0x15')](function(_0x218752){if(!_0x218752){throw new Error(_0x664e('0x4a'));}return db[_0x664e('0xa')][_0x664e('0xc')]({'attributes':['id',_0x664e('0x4b'),_0x664e('0x4c'),'passwordHistoryLimit']})[_0x664e('0x15')](function(_0xc3574a){if(_0xc3574a[_0x664e('0x4b')])authService['validatePasswordPattern'](_0x2914ba[_0x664e('0x39')][_0x664e('0xe')]);if(!_0xc3574a[_0x664e('0x4c')]||!_0x218752[_0x664e('0x4d')])return _0x218752;authService[_0x664e('0x4e')](_0x2914ba[_0x664e('0x39')][_0x664e('0xe')],_0x218752[_0x664e('0x4d')],_0xc3574a[_0x664e('0x4f')]);return _0x218752;})[_0x664e('0x15')](function(){_0x218752[_0x664e('0xe')]=_0x2914ba[_0x664e('0x39')]['password'];_0x218752[_0x664e('0x3e')]=null;_0x218752['resetPasswordExpires']=null;return _0x218752[_0x664e('0x40')]();});})[_0x664e('0x15')](function(){_0x15380c[_0x664e('0x30')](0xc8)[_0x664e('0x31')]({'message':_0x664e('0x50')});})[_0x664e('0x1e')](function(_0x45849c){return handleError(_0x15380c,0x1f4,_0x45849c);});};passport[_0x664e('0x51')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0x664e('0xe')},function(_0x248b42,_0x1d2a47,_0x5a3dfd){return localAuthenticate(db['User'],_0x248b42,_0x1d2a47,_0x5a3dfd);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index fff2d54..1b5a9c9 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 _0x66e6=['./authLocal.controller','post','/forgot','forgot','/reset/:token','reset','exports'];(function(_0x3798f0,_0x244b2d){var _0x119f08=function(_0x3b1cb2){while(--_0x3b1cb2){_0x3798f0['push'](_0x3798f0['shift']());}};_0x119f08(++_0x244b2d);}(_0x66e6,0x165));var _0x666e=function(_0x23ca3d,_0x4fb1f2){_0x23ca3d=_0x23ca3d-0x0;var _0x16d24b=_0x66e6[_0x23ca3d];return _0x16d24b;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x666e('0x0'));router['post']('/',controller['login']);router[_0x666e('0x1')](_0x666e('0x2'),controller[_0x666e('0x3')]);router[_0x666e('0x1')](_0x666e('0x4'),controller[_0x666e('0x5')]);module[_0x666e('0x6')]=router; \ No newline at end of file +var _0xdab6=['post','login','/forgot','/reset/:token','reset','express','Router','./authLocal.controller'];(function(_0x10e7ac,_0x4e29d2){var _0x2726da=function(_0x44f6cb){while(--_0x44f6cb){_0x10e7ac['push'](_0x10e7ac['shift']());}};_0x2726da(++_0x4e29d2);}(_0xdab6,0x10d));var _0x6dab=function(_0x47fe98,_0x7d0e8b){_0x47fe98=_0x47fe98-0x0;var _0x53b435=_0xdab6[_0x47fe98];return _0x53b435;};'use strict';var express=require(_0x6dab('0x0'));var router=express[_0x6dab('0x1')]();var controller=require(_0x6dab('0x2'));router[_0x6dab('0x3')]('/',controller[_0x6dab('0x4')]);router[_0x6dab('0x3')](_0x6dab('0x5'),controller['forgot']);router['post'](_0x6dab('0x6'),controller[_0x6dab('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index ff18394..d13901b 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 _0x0a88=['STRING','INTEGER','sequelize'];(function(_0x34ecea,_0x3d11ce){var _0x44b6a8=function(_0x5843a1){while(--_0x5843a1){_0x34ecea['push'](_0x34ecea['shift']());}};_0x44b6a8(++_0x3d11ce);}(_0x0a88,0x19a));var _0x80a8=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0x0a88[_0x1c4409];return _0x356d8f;};'use strict';var Sequelize=require(_0x80a8('0x0'));module['exports']={'name':{'type':Sequelize[_0x80a8('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x80a8('0x1')]},'description':{'type':Sequelize[_0x80a8('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x80a8('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x720e=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x466410,_0x523499){var _0x344596=function(_0xbae55b){while(--_0xbae55b){_0x466410['push'](_0x466410['shift']());}};_0x344596(++_0x523499);}(_0x720e,0xde));var _0xe720=function(_0x3ae4bf,_0x554978){_0x3ae4bf=_0x3ae4bf-0x0;var _0x27f7dd=_0x720e[_0x3ae4bf];return _0x27f7dd;};'use strict';var Sequelize=require('sequelize');module[_0xe720('0x0')]={'name':{'type':Sequelize[_0xe720('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xe720('0x1')]},'description':{'type':Sequelize[_0xe720('0x1')]},'status':{'type':Sequelize[_0xe720('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe720('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index fa5f58b..7e63ba6 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 _0x6943=['keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','addConditions','Condition','ids','getConditions','findOne','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query'];(function(_0x5be5f8,_0x2fda04){var _0x1107a4=function(_0x17fe40){while(--_0x17fe40){_0x5be5f8['push'](_0x5be5f8['shift']());}};_0x1107a4(++_0x2fda04);}(_0x6943,0x168));var _0x3694=function(_0x3c2863,_0x1b2cee){_0x3c2863=_0x3c2863-0x0;var _0x2c3d27=_0x6943[_0x3c2863];return _0x2c3d27;};'use strict';var emlformat=require(_0x3694('0x0'));var rimraf=require(_0x3694('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3694('0x2'));var rp=require(_0x3694('0x3'));var moment=require(_0x3694('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3694('0x5'));var sox=require(_0x3694('0x6'));var csv=require(_0x3694('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3694('0x8'));var _=require(_0x3694('0x9'));var squel=require(_0x3694('0xa'));var crypto=require(_0x3694('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3694('0xc'));var toCsv=require(_0x3694('0x7'));var querystring=require(_0x3694('0xd'));var Papa=require(_0x3694('0xe'));var Redis=require(_0x3694('0xf'));var authService=require(_0x3694('0x10'));var qs=require(_0x3694('0x11'));var as=require(_0x3694('0x12'));var hardwareService=require(_0x3694('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3694('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3694('0x15'))['db'];function respondWithStatusCode(_0x3e9ae3,_0x540bd4){_0x540bd4=_0x540bd4||0xcc;return function(_0x3ae4bd){if(_0x3ae4bd){return _0x3e9ae3[_0x3694('0x16')](_0x540bd4);}return _0x3e9ae3['status'](_0x540bd4)['end']();};}function respondWithResult(_0x13e72d,_0x5dd579){_0x5dd579=_0x5dd579||0xc8;return function(_0x493b78){if(_0x493b78){return _0x13e72d[_0x3694('0x17')](_0x5dd579)[_0x3694('0x18')](_0x493b78);}};}function respondWithFilteredResult(_0x331bfb,_0x22e3b6){return function(_0x3df407){if(_0x3df407){var _0x382599=typeof _0x22e3b6[_0x3694('0x19')]==='undefined'&&typeof _0x22e3b6[_0x3694('0x1a')]===_0x3694('0x1b');var _0x125793=_0x3df407[_0x3694('0x1c')];var _0x11dff0=_0x382599?0x0:_0x22e3b6[_0x3694('0x19')];var _0x5e2d6d=_0x382599?_0x3df407[_0x3694('0x1c')]:_0x22e3b6[_0x3694('0x19')]+_0x22e3b6[_0x3694('0x1a')];var _0x8e6485;if(_0x5e2d6d>=_0x125793){_0x5e2d6d=_0x125793;_0x8e6485=0xc8;}else{_0x8e6485=0xce;}_0x331bfb[_0x3694('0x17')](_0x8e6485);return _0x331bfb[_0x3694('0x1d')](_0x3694('0x1e'),_0x11dff0+'-'+_0x5e2d6d+'/'+_0x125793)[_0x3694('0x18')](_0x3df407);}return null;};}function patchUpdates(_0x115c2b){return function(_0x500528){try{jsonpatch[_0x3694('0x1f')](_0x500528,_0x115c2b,!![]);}catch(_0x50f7bf){return BPromise[_0x3694('0x20')](_0x50f7bf);}return _0x500528['save']();};}function saveUpdates(_0x401241,_0x4b263d){return function(_0x5a1e44){if(_0x5a1e44){return _0x5a1e44[_0x3694('0x21')](_0x401241)[_0x3694('0x22')](function(_0x114d2b){return _0x114d2b;});}return null;};}function removeEntity(_0x453c9c,_0x238ef8){return function(_0x51a372){if(_0x51a372){return _0x51a372[_0x3694('0x23')]()['then'](function(){_0x453c9c[_0x3694('0x17')](0xcc)[_0x3694('0x24')]();});}};}function handleEntityNotFound(_0x5efbe3,_0x4a7e40){return function(_0x50bba8){if(!_0x50bba8){_0x5efbe3['sendStatus'](0x194);}return _0x50bba8;};}function handleError(_0x23eb3c,_0x291624){_0x291624=_0x291624||0x1f4;return function(_0x170506){logger[_0x3694('0x25')](_0x170506[_0x3694('0x26')]);if(_0x170506[_0x3694('0x27')]){delete _0x170506[_0x3694('0x27')];}_0x23eb3c[_0x3694('0x17')](_0x291624)[_0x3694('0x28')](_0x170506);};}exports[_0x3694('0x29')]=function(_0x32c3ec,_0x3d2643){var _0x3c4d8e={},_0x411220={},_0x8a0983={'count':0x0,'rows':[]};var _0x12a690=_[_0x3694('0x2a')](db[_0x3694('0x2b')][_0x3694('0x2c')],function(_0x4b6915){return{'name':_0x4b6915[_0x3694('0x2d')],'type':_0x4b6915[_0x3694('0x2e')][_0x3694('0x2f')]};});_0x411220[_0x3694('0x30')]=_[_0x3694('0x2a')](_0x12a690,_0x3694('0x27'));_0x411220[_0x3694('0x31')]=_[_0x3694('0x32')](_0x32c3ec[_0x3694('0x31')]);_0x411220['filters']=_[_0x3694('0x33')](_0x411220[_0x3694('0x30')],_0x411220[_0x3694('0x31')]);_0x3c4d8e['attributes']=_[_0x3694('0x33')](_0x411220['model'],qs[_0x3694('0x34')](_0x32c3ec[_0x3694('0x31')][_0x3694('0x34')]));_0x3c4d8e[_0x3694('0x35')]=_0x3c4d8e[_0x3694('0x35')][_0x3694('0x36')]?_0x3c4d8e['attributes']:_0x411220['model'];if(!_0x32c3ec[_0x3694('0x31')][_0x3694('0x37')](_0x3694('0x38'))){_0x3c4d8e[_0x3694('0x1a')]=qs[_0x3694('0x1a')](_0x32c3ec['query']['limit']);_0x3c4d8e[_0x3694('0x19')]=qs[_0x3694('0x19')](_0x32c3ec[_0x3694('0x31')][_0x3694('0x19')]);}_0x3c4d8e[_0x3694('0x39')]=qs[_0x3694('0x3a')](_0x32c3ec[_0x3694('0x31')][_0x3694('0x3a')]);_0x3c4d8e[_0x3694('0x3b')]=qs[_0x3694('0x3c')](_[_0x3694('0x3d')](_0x32c3ec['query'],_0x411220[_0x3694('0x3c')]),_0x12a690);if(_0x32c3ec[_0x3694('0x31')][_0x3694('0x3e')]){_0x3c4d8e[_0x3694('0x3b')]=_[_0x3694('0x3f')](_0x3c4d8e[_0x3694('0x3b')],{'$or':_['map'](_0x12a690,function(_0x15c98c){if(_0x15c98c['type']!=='VIRTUAL'){var _0x5e50f8={};_0x5e50f8[_0x15c98c[_0x3694('0x27')]]={'$like':'%'+_0x32c3ec['query'][_0x3694('0x3e')]+'%'};return _0x5e50f8;}})});}_0x3c4d8e=_[_0x3694('0x3f')]({},_0x3c4d8e,_0x32c3ec[_0x3694('0x40')]);var _0x382443={'where':_0x3c4d8e[_0x3694('0x3b')]};return db[_0x3694('0x2b')]['count'](_0x382443)[_0x3694('0x22')](function(_0x8e19d0){_0x8a0983[_0x3694('0x1c')]=_0x8e19d0;if(_0x32c3ec[_0x3694('0x31')][_0x3694('0x41')]){_0x3c4d8e[_0x3694('0x42')]=[{'all':!![]}];}return db[_0x3694('0x2b')][_0x3694('0x43')](_0x3c4d8e);})[_0x3694('0x22')](function(_0x4daa7e){_0x8a0983[_0x3694('0x44')]=_0x4daa7e;return _0x8a0983;})[_0x3694('0x22')](respondWithFilteredResult(_0x3d2643,_0x3c4d8e))[_0x3694('0x45')](handleError(_0x3d2643,null));};exports[_0x3694('0x46')]=function(_0xbb96c2,_0x2aed16){var _0x4b1a92={'raw':![],'where':{'id':_0xbb96c2[_0x3694('0x47')]['id']}},_0x34e19b={};_0x34e19b[_0x3694('0x30')]=_['keys'](db[_0x3694('0x2b')]['rawAttributes']);_0x34e19b[_0x3694('0x31')]=_[_0x3694('0x32')](_0xbb96c2[_0x3694('0x31')]);_0x34e19b[_0x3694('0x3c')]=_['intersection'](_0x34e19b[_0x3694('0x30')],_0x34e19b['query']);_0x4b1a92[_0x3694('0x35')]=_['intersection'](_0x34e19b[_0x3694('0x30')],qs['fields'](_0xbb96c2[_0x3694('0x31')]['fields']));_0x4b1a92[_0x3694('0x35')]=_0x4b1a92[_0x3694('0x35')][_0x3694('0x36')]?_0x4b1a92[_0x3694('0x35')]:_0x34e19b[_0x3694('0x30')];if(_0xbb96c2[_0x3694('0x31')][_0x3694('0x41')]){_0x4b1a92[_0x3694('0x42')]=[{'all':!![]}];}_0x4b1a92=_[_0x3694('0x3f')]({},_0x4b1a92,_0xbb96c2['options']);return db[_0x3694('0x2b')]['find'](_0x4b1a92)['then'](handleEntityNotFound(_0x2aed16,null))[_0x3694('0x22')](respondWithResult(_0x2aed16,null))[_0x3694('0x45')](handleError(_0x2aed16,null));};exports[_0x3694('0x48')]=function(_0x37fcfd,_0x54395f){return db[_0x3694('0x2b')][_0x3694('0x48')](_0x37fcfd[_0x3694('0x49')],{})['then'](respondWithResult(_0x54395f,0xc9))[_0x3694('0x45')](handleError(_0x54395f,null));};exports['update']=function(_0x46d2a7,_0x2cc7e5){if(_0x46d2a7['body']['id']){delete _0x46d2a7[_0x3694('0x49')]['id'];}return db['Automation'][_0x3694('0x4a')]({'where':{'id':_0x46d2a7[_0x3694('0x47')]['id']}})[_0x3694('0x22')](handleEntityNotFound(_0x2cc7e5,null))[_0x3694('0x22')](saveUpdates(_0x46d2a7['body'],null))[_0x3694('0x22')](respondWithResult(_0x2cc7e5,null))[_0x3694('0x45')](handleError(_0x2cc7e5,null));};exports['destroy']=function(_0x3cca96,_0x14bdf7){return db[_0x3694('0x2b')][_0x3694('0x4a')]({'where':{'id':_0x3cca96[_0x3694('0x47')]['id']}})['then'](handleEntityNotFound(_0x14bdf7,null))[_0x3694('0x22')](removeEntity(_0x14bdf7,null))[_0x3694('0x45')](handleError(_0x14bdf7,null));};exports[_0x3694('0x4b')]=function(_0x47a101,_0x4728d6,_0x2849c1){return db[_0x3694('0x4c')]['find']({'where':{'id':_0x47a101[_0x3694('0x47')]['id']}})['then'](handleEntityNotFound(_0x4728d6,null))['then'](function(_0x583c55){if(_0x583c55){return _0x583c55[_0x3694('0x4b')](_0x47a101[_0x3694('0x49')][_0x3694('0x4d')],_['omit'](_0x47a101['body'],[_0x3694('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x4728d6,null))[_0x3694('0x45')](handleError(_0x4728d6,null));};exports[_0x3694('0x4e')]=function(_0x241b49,_0x22fca0,_0x46df7b){var _0x17c521={};var _0x4391cd={};var _0x1e65a4;var _0x34f442;return db[_0x3694('0x2b')][_0x3694('0x4f')]({'where':{'id':_0x241b49[_0x3694('0x47')]['id']}})[_0x3694('0x22')](handleEntityNotFound(_0x22fca0,null))[_0x3694('0x22')](function(_0x48f232){if(_0x48f232){_0x1e65a4=_0x48f232;_0x4391cd[_0x3694('0x30')]=_['keys'](db[_0x3694('0x4c')][_0x3694('0x2c')]);_0x4391cd['query']=_[_0x3694('0x32')](_0x241b49[_0x3694('0x31')]);_0x4391cd[_0x3694('0x3c')]=_[_0x3694('0x33')](_0x4391cd['model'],_0x4391cd['query']);_0x17c521[_0x3694('0x35')]=_[_0x3694('0x33')](_0x4391cd[_0x3694('0x30')],qs[_0x3694('0x34')](_0x241b49[_0x3694('0x31')][_0x3694('0x34')]));_0x17c521[_0x3694('0x35')]=_0x17c521['attributes'][_0x3694('0x36')]?_0x17c521[_0x3694('0x35')]:_0x4391cd[_0x3694('0x30')];_0x17c521[_0x3694('0x39')]=qs[_0x3694('0x3a')](_0x241b49['query'][_0x3694('0x3a')]);_0x17c521[_0x3694('0x3b')]=qs[_0x3694('0x3c')](_[_0x3694('0x3d')](_0x241b49['query'],_0x4391cd[_0x3694('0x3c')]));if(_0x241b49[_0x3694('0x31')][_0x3694('0x3e')]){_0x17c521['where']=_[_0x3694('0x3f')](_0x17c521['where'],{'$or':_[_0x3694('0x2a')](_0x17c521[_0x3694('0x35')],function(_0x123d52){var _0x161140={};_0x161140[_0x123d52]={'$like':'%'+_0x241b49[_0x3694('0x31')]['filter']+'%'};return _0x161140;})});}_0x17c521=_[_0x3694('0x3f')]({},_0x17c521,_0x241b49[_0x3694('0x40')]);return _0x1e65a4[_0x3694('0x4e')](_0x17c521);}})[_0x3694('0x22')](function(_0x4d370e){if(_0x4d370e){_0x34f442=_0x4d370e['length'];if(!_0x241b49['query']['hasOwnProperty'](_0x3694('0x38'))){_0x17c521[_0x3694('0x1a')]=qs[_0x3694('0x1a')](_0x241b49['query']['limit']);_0x17c521['offset']=qs[_0x3694('0x19')](_0x241b49[_0x3694('0x31')][_0x3694('0x19')]);}return _0x1e65a4['getConditions'](_0x17c521);}})[_0x3694('0x22')](function(_0x3f0301){if(_0x3f0301){return _0x3f0301?{'count':_0x34f442,'rows':_0x3f0301}:null;}})[_0x3694('0x22')](respondWithResult(_0x22fca0,null))[_0x3694('0x45')](handleError(_0x22fca0,null));};exports['addActions']=function(_0x240b31,_0x447bdf,_0x5e950c){return db[_0x3694('0x50')][_0x3694('0x4a')]({'where':{'id':_0x240b31['params']['id']}})[_0x3694('0x22')](handleEntityNotFound(_0x447bdf,null))[_0x3694('0x22')](function(_0x2949cf){if(_0x2949cf){return _0x2949cf['addActions'](_0x240b31[_0x3694('0x49')][_0x3694('0x4d')],_['omit'](_0x240b31['body'],[_0x3694('0x4d'),'id'])||{});}})[_0x3694('0x22')](respondWithResult(_0x447bdf,null))['catch'](handleError(_0x447bdf,null));};exports[_0x3694('0x51')]=function(_0x2fe156,_0x4b7efc,_0xbeb660){var _0x1d8bdf={};var _0x453bd0={};var _0x4b4dea;var _0x59311d;return db[_0x3694('0x2b')][_0x3694('0x4f')]({'where':{'id':_0x2fe156['params']['id']}})['then'](handleEntityNotFound(_0x4b7efc,null))['then'](function(_0x568eb3){if(_0x568eb3){_0x4b4dea=_0x568eb3;_0x453bd0[_0x3694('0x30')]=_[_0x3694('0x32')](db[_0x3694('0x50')][_0x3694('0x2c')]);_0x453bd0['query']=_[_0x3694('0x32')](_0x2fe156[_0x3694('0x31')]);_0x453bd0[_0x3694('0x3c')]=_[_0x3694('0x33')](_0x453bd0['model'],_0x453bd0[_0x3694('0x31')]);_0x1d8bdf[_0x3694('0x35')]=_[_0x3694('0x33')](_0x453bd0[_0x3694('0x30')],qs[_0x3694('0x34')](_0x2fe156[_0x3694('0x31')][_0x3694('0x34')]));_0x1d8bdf[_0x3694('0x35')]=_0x1d8bdf[_0x3694('0x35')][_0x3694('0x36')]?_0x1d8bdf[_0x3694('0x35')]:_0x453bd0[_0x3694('0x30')];_0x1d8bdf[_0x3694('0x39')]=qs[_0x3694('0x3a')](_0x2fe156[_0x3694('0x31')][_0x3694('0x3a')]);_0x1d8bdf[_0x3694('0x3b')]=qs[_0x3694('0x3c')](_['pick'](_0x2fe156[_0x3694('0x31')],_0x453bd0[_0x3694('0x3c')]));if(_0x2fe156['query'][_0x3694('0x3e')]){_0x1d8bdf[_0x3694('0x3b')]=_[_0x3694('0x3f')](_0x1d8bdf[_0x3694('0x3b')],{'$or':_[_0x3694('0x2a')](_0x1d8bdf[_0x3694('0x35')],function(_0x254b4e){var _0x62ae0a={};_0x62ae0a[_0x254b4e]={'$like':'%'+_0x2fe156[_0x3694('0x31')]['filter']+'%'};return _0x62ae0a;})});}_0x1d8bdf=_['merge']({},_0x1d8bdf,_0x2fe156[_0x3694('0x40')]);return _0x4b4dea[_0x3694('0x51')](_0x1d8bdf);}})[_0x3694('0x22')](function(_0x5b05c3){if(_0x5b05c3){_0x59311d=_0x5b05c3['length'];if(!_0x2fe156['query'][_0x3694('0x37')](_0x3694('0x38'))){_0x1d8bdf[_0x3694('0x1a')]=qs['limit'](_0x2fe156['query'][_0x3694('0x1a')]);_0x1d8bdf[_0x3694('0x19')]=qs['offset'](_0x2fe156[_0x3694('0x31')][_0x3694('0x19')]);}return _0x4b4dea[_0x3694('0x51')](_0x1d8bdf);}})[_0x3694('0x22')](function(_0x256f48){if(_0x256f48){return _0x256f48?{'count':_0x59311d,'rows':_0x256f48}:null;}})['then'](respondWithResult(_0x4b7efc,null))['catch'](handleError(_0x4b7efc,null));}; \ No newline at end of file +var _0x08eb=['find','create','body','Condition','ids','omit','getConditions','addActions','Action','getActions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','fs-extra','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','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','map','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','Automation','findAll','rows','catch','show','params','rawAttributes','include'];(function(_0x2a4a99,_0x64b4a){var _0x1cef2f=function(_0x43beef){while(--_0x43beef){_0x2a4a99['push'](_0x2a4a99['shift']());}};_0x1cef2f(++_0x64b4a);}(_0x08eb,0xa7));var _0xb08e=function(_0x5d931a,_0x498a79){_0x5d931a=_0x5d931a-0x0;var _0x2c570e=_0x08eb[_0x5d931a];return _0x2c570e;};'use strict';var emlformat=require(_0xb08e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb08e('0x1'));var jsonpatch=require(_0xb08e('0x2'));var rp=require(_0xb08e('0x3'));var moment=require('moment');var BPromise=require(_0xb08e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb08e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb08e('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb08e('0x7'));var deskjs=require(_0xb08e('0x8'));var toCsv=require(_0xb08e('0x9'));var querystring=require('querystring');var Papa=require(_0xb08e('0xa'));var Redis=require(_0xb08e('0xb'));var authService=require(_0xb08e('0xc'));var qs=require(_0xb08e('0xd'));var as=require(_0xb08e('0xe'));var hardwareService=require(_0xb08e('0xf'));var logger=require(_0xb08e('0x10'))(_0xb08e('0x11'));var utils=require(_0xb08e('0x12'));var config=require(_0xb08e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e3c11,_0xcf2c6b){_0xcf2c6b=_0xcf2c6b||0xcc;return function(_0x33472){if(_0x33472){return _0x4e3c11[_0xb08e('0x14')](_0xcf2c6b);}return _0x4e3c11[_0xb08e('0x15')](_0xcf2c6b)[_0xb08e('0x16')]();};}function respondWithResult(_0x3f7235,_0x3ee92c){_0x3ee92c=_0x3ee92c||0xc8;return function(_0x39c986){if(_0x39c986){return _0x3f7235[_0xb08e('0x15')](_0x3ee92c)[_0xb08e('0x17')](_0x39c986);}};}function respondWithFilteredResult(_0x2e243f,_0xe03746){return function(_0x1efb3b){if(_0x1efb3b){var _0x2bf7c6=typeof _0xe03746['offset']===_0xb08e('0x18')&&typeof _0xe03746[_0xb08e('0x19')]==='undefined';var _0x9b7e47=_0x1efb3b[_0xb08e('0x1a')];var _0x466b8e=_0x2bf7c6?0x0:_0xe03746[_0xb08e('0x1b')];var _0x9e8fd=_0x2bf7c6?_0x1efb3b[_0xb08e('0x1a')]:_0xe03746[_0xb08e('0x1b')]+_0xe03746[_0xb08e('0x19')];var _0x383211;if(_0x9e8fd>=_0x9b7e47){_0x9e8fd=_0x9b7e47;_0x383211=0xc8;}else{_0x383211=0xce;}_0x2e243f[_0xb08e('0x15')](_0x383211);return _0x2e243f[_0xb08e('0x1c')]('Content-Range',_0x466b8e+'-'+_0x9e8fd+'/'+_0x9b7e47)[_0xb08e('0x17')](_0x1efb3b);}return null;};}function patchUpdates(_0x47b7f6){return function(_0x34fd62){try{jsonpatch[_0xb08e('0x1d')](_0x34fd62,_0x47b7f6,!![]);}catch(_0x4af222){return BPromise[_0xb08e('0x1e')](_0x4af222);}return _0x34fd62[_0xb08e('0x1f')]();};}function saveUpdates(_0x5effa4,_0x473ce0){return function(_0x4bfa77){if(_0x4bfa77){return _0x4bfa77[_0xb08e('0x20')](_0x5effa4)[_0xb08e('0x21')](function(_0x19579e){return _0x19579e;});}return null;};}function removeEntity(_0x1e5a97,_0x5c624b){return function(_0x38ebe2){if(_0x38ebe2){return _0x38ebe2['destroy']()[_0xb08e('0x21')](function(){_0x1e5a97[_0xb08e('0x15')](0xcc)[_0xb08e('0x16')]();});}};}function handleEntityNotFound(_0xaa84f1,_0x1d9932){return function(_0x4d37dc){if(!_0x4d37dc){_0xaa84f1[_0xb08e('0x14')](0x194);}return _0x4d37dc;};}function handleError(_0x4e504e,_0x110620){_0x110620=_0x110620||0x1f4;return function(_0x18be02){logger[_0xb08e('0x22')](_0x18be02[_0xb08e('0x23')]);if(_0x18be02[_0xb08e('0x24')]){delete _0x18be02['name'];}_0x4e504e[_0xb08e('0x15')](_0x110620)[_0xb08e('0x25')](_0x18be02);};}exports[_0xb08e('0x26')]=function(_0x635cff,_0x132651){var _0x21603f={},_0x4f51d5={},_0x1c3bdd={'count':0x0,'rows':[]};var _0x2831c4=_[_0xb08e('0x27')](db['Automation']['rawAttributes'],function(_0x40deb0){return{'name':_0x40deb0['fieldName'],'type':_0x40deb0['type'][_0xb08e('0x28')]};});_0x4f51d5[_0xb08e('0x29')]=_[_0xb08e('0x27')](_0x2831c4,_0xb08e('0x24'));_0x4f51d5[_0xb08e('0x2a')]=_[_0xb08e('0x2b')](_0x635cff['query']);_0x4f51d5['filters']=_[_0xb08e('0x2c')](_0x4f51d5['model'],_0x4f51d5['query']);_0x21603f['attributes']=_[_0xb08e('0x2c')](_0x4f51d5[_0xb08e('0x29')],qs['fields'](_0x635cff[_0xb08e('0x2a')][_0xb08e('0x2d')]));_0x21603f[_0xb08e('0x2e')]=_0x21603f[_0xb08e('0x2e')][_0xb08e('0x2f')]?_0x21603f[_0xb08e('0x2e')]:_0x4f51d5[_0xb08e('0x29')];if(!_0x635cff[_0xb08e('0x2a')][_0xb08e('0x30')](_0xb08e('0x31'))){_0x21603f[_0xb08e('0x19')]=qs['limit'](_0x635cff['query']['limit']);_0x21603f[_0xb08e('0x1b')]=qs[_0xb08e('0x1b')](_0x635cff[_0xb08e('0x2a')][_0xb08e('0x1b')]);}_0x21603f[_0xb08e('0x32')]=qs[_0xb08e('0x33')](_0x635cff['query']['sort']);_0x21603f['where']=qs[_0xb08e('0x34')](_[_0xb08e('0x35')](_0x635cff[_0xb08e('0x2a')],_0x4f51d5[_0xb08e('0x34')]),_0x2831c4);if(_0x635cff[_0xb08e('0x2a')][_0xb08e('0x36')]){_0x21603f[_0xb08e('0x37')]=_[_0xb08e('0x38')](_0x21603f[_0xb08e('0x37')],{'$or':_[_0xb08e('0x27')](_0x2831c4,function(_0x121590){if(_0x121590['type']!=='VIRTUAL'){var _0xbee87a={};_0xbee87a[_0x121590[_0xb08e('0x24')]]={'$like':'%'+_0x635cff['query'][_0xb08e('0x36')]+'%'};return _0xbee87a;}})});}_0x21603f=_[_0xb08e('0x38')]({},_0x21603f,_0x635cff[_0xb08e('0x39')]);var _0x5c03ad={'where':_0x21603f[_0xb08e('0x37')]};return db['Automation'][_0xb08e('0x1a')](_0x5c03ad)[_0xb08e('0x21')](function(_0x154421){_0x1c3bdd['count']=_0x154421;if(_0x635cff['query'][_0xb08e('0x3a')]){_0x21603f['include']=[{'all':!![]}];}return db[_0xb08e('0x3b')][_0xb08e('0x3c')](_0x21603f);})['then'](function(_0xd3ae22){_0x1c3bdd[_0xb08e('0x3d')]=_0xd3ae22;return _0x1c3bdd;})['then'](respondWithFilteredResult(_0x132651,_0x21603f))[_0xb08e('0x3e')](handleError(_0x132651,null));};exports[_0xb08e('0x3f')]=function(_0x3ef421,_0x9b4b97){var _0x12a029={'raw':![],'where':{'id':_0x3ef421[_0xb08e('0x40')]['id']}},_0x3a8a6d={};_0x3a8a6d[_0xb08e('0x29')]=_[_0xb08e('0x2b')](db[_0xb08e('0x3b')][_0xb08e('0x41')]);_0x3a8a6d['query']=_[_0xb08e('0x2b')](_0x3ef421[_0xb08e('0x2a')]);_0x3a8a6d[_0xb08e('0x34')]=_[_0xb08e('0x2c')](_0x3a8a6d[_0xb08e('0x29')],_0x3a8a6d['query']);_0x12a029[_0xb08e('0x2e')]=_[_0xb08e('0x2c')](_0x3a8a6d[_0xb08e('0x29')],qs[_0xb08e('0x2d')](_0x3ef421[_0xb08e('0x2a')][_0xb08e('0x2d')]));_0x12a029[_0xb08e('0x2e')]=_0x12a029[_0xb08e('0x2e')][_0xb08e('0x2f')]?_0x12a029[_0xb08e('0x2e')]:_0x3a8a6d[_0xb08e('0x29')];if(_0x3ef421[_0xb08e('0x2a')][_0xb08e('0x3a')]){_0x12a029[_0xb08e('0x42')]=[{'all':!![]}];}_0x12a029=_[_0xb08e('0x38')]({},_0x12a029,_0x3ef421['options']);return db[_0xb08e('0x3b')][_0xb08e('0x43')](_0x12a029)['then'](handleEntityNotFound(_0x9b4b97,null))['then'](respondWithResult(_0x9b4b97,null))['catch'](handleError(_0x9b4b97,null));};exports[_0xb08e('0x44')]=function(_0x44f206,_0x28ae68){return db[_0xb08e('0x3b')][_0xb08e('0x44')](_0x44f206[_0xb08e('0x45')],{})[_0xb08e('0x21')](respondWithResult(_0x28ae68,0xc9))[_0xb08e('0x3e')](handleError(_0x28ae68,null));};exports['update']=function(_0x5b021f,_0x219f2a){if(_0x5b021f[_0xb08e('0x45')]['id']){delete _0x5b021f[_0xb08e('0x45')]['id'];}return db[_0xb08e('0x3b')]['find']({'where':{'id':_0x5b021f[_0xb08e('0x40')]['id']}})[_0xb08e('0x21')](handleEntityNotFound(_0x219f2a,null))['then'](saveUpdates(_0x5b021f[_0xb08e('0x45')],null))['then'](respondWithResult(_0x219f2a,null))[_0xb08e('0x3e')](handleError(_0x219f2a,null));};exports['destroy']=function(_0x454ae7,_0x27afb7){return db[_0xb08e('0x3b')]['find']({'where':{'id':_0x454ae7[_0xb08e('0x40')]['id']}})[_0xb08e('0x21')](handleEntityNotFound(_0x27afb7,null))[_0xb08e('0x21')](removeEntity(_0x27afb7,null))[_0xb08e('0x3e')](handleError(_0x27afb7,null));};exports['addConditions']=function(_0xc93a92,_0x4cf6f6,_0x248212){return db[_0xb08e('0x46')][_0xb08e('0x43')]({'where':{'id':_0xc93a92[_0xb08e('0x40')]['id']}})[_0xb08e('0x21')](handleEntityNotFound(_0x4cf6f6,null))[_0xb08e('0x21')](function(_0x2a024a){if(_0x2a024a){return _0x2a024a['addConditions'](_0xc93a92['body'][_0xb08e('0x47')],_[_0xb08e('0x48')](_0xc93a92[_0xb08e('0x45')],['ids','id'])||{});}})[_0xb08e('0x21')](respondWithResult(_0x4cf6f6,null))[_0xb08e('0x3e')](handleError(_0x4cf6f6,null));};exports['getConditions']=function(_0x19c354,_0x231fd3,_0x2a4a27){var _0x1bb7f8={};var _0x5f4e81={};var _0x46c406;var _0x54e732;return db[_0xb08e('0x3b')]['findOne']({'where':{'id':_0x19c354[_0xb08e('0x40')]['id']}})['then'](handleEntityNotFound(_0x231fd3,null))[_0xb08e('0x21')](function(_0x1f42ac){if(_0x1f42ac){_0x46c406=_0x1f42ac;_0x5f4e81['model']=_[_0xb08e('0x2b')](db[_0xb08e('0x46')][_0xb08e('0x41')]);_0x5f4e81[_0xb08e('0x2a')]=_['keys'](_0x19c354['query']);_0x5f4e81[_0xb08e('0x34')]=_[_0xb08e('0x2c')](_0x5f4e81[_0xb08e('0x29')],_0x5f4e81['query']);_0x1bb7f8['attributes']=_[_0xb08e('0x2c')](_0x5f4e81[_0xb08e('0x29')],qs['fields'](_0x19c354['query']['fields']));_0x1bb7f8['attributes']=_0x1bb7f8[_0xb08e('0x2e')][_0xb08e('0x2f')]?_0x1bb7f8['attributes']:_0x5f4e81[_0xb08e('0x29')];_0x1bb7f8[_0xb08e('0x32')]=qs['sort'](_0x19c354['query'][_0xb08e('0x33')]);_0x1bb7f8[_0xb08e('0x37')]=qs[_0xb08e('0x34')](_['pick'](_0x19c354[_0xb08e('0x2a')],_0x5f4e81[_0xb08e('0x34')]));if(_0x19c354[_0xb08e('0x2a')][_0xb08e('0x36')]){_0x1bb7f8['where']=_['merge'](_0x1bb7f8[_0xb08e('0x37')],{'$or':_[_0xb08e('0x27')](_0x1bb7f8['attributes'],function(_0x578f5f){var _0x5913c3={};_0x5913c3[_0x578f5f]={'$like':'%'+_0x19c354[_0xb08e('0x2a')][_0xb08e('0x36')]+'%'};return _0x5913c3;})});}_0x1bb7f8=_[_0xb08e('0x38')]({},_0x1bb7f8,_0x19c354[_0xb08e('0x39')]);return _0x46c406[_0xb08e('0x49')](_0x1bb7f8);}})[_0xb08e('0x21')](function(_0x1247ba){if(_0x1247ba){_0x54e732=_0x1247ba[_0xb08e('0x2f')];if(!_0x19c354[_0xb08e('0x2a')]['hasOwnProperty'](_0xb08e('0x31'))){_0x1bb7f8['limit']=qs[_0xb08e('0x19')](_0x19c354[_0xb08e('0x2a')][_0xb08e('0x19')]);_0x1bb7f8[_0xb08e('0x1b')]=qs[_0xb08e('0x1b')](_0x19c354['query'][_0xb08e('0x1b')]);}return _0x46c406[_0xb08e('0x49')](_0x1bb7f8);}})[_0xb08e('0x21')](function(_0x2faf5b){if(_0x2faf5b){return _0x2faf5b?{'count':_0x54e732,'rows':_0x2faf5b}:null;}})[_0xb08e('0x21')](respondWithResult(_0x231fd3,null))['catch'](handleError(_0x231fd3,null));};exports[_0xb08e('0x4a')]=function(_0x4588fa,_0x1db6fd,_0xe345c3){return db[_0xb08e('0x4b')]['find']({'where':{'id':_0x4588fa[_0xb08e('0x40')]['id']}})[_0xb08e('0x21')](handleEntityNotFound(_0x1db6fd,null))[_0xb08e('0x21')](function(_0x254eb4){if(_0x254eb4){return _0x254eb4[_0xb08e('0x4a')](_0x4588fa[_0xb08e('0x45')][_0xb08e('0x47')],_['omit'](_0x4588fa[_0xb08e('0x45')],[_0xb08e('0x47'),'id'])||{});}})[_0xb08e('0x21')](respondWithResult(_0x1db6fd,null))[_0xb08e('0x3e')](handleError(_0x1db6fd,null));};exports[_0xb08e('0x4c')]=function(_0x2476bd,_0x2dbc49,_0x259b31){var _0x5b79bd={};var _0x4b576c={};var _0x39e1fb;var _0x26d15c;return db['Automation'][_0xb08e('0x4d')]({'where':{'id':_0x2476bd[_0xb08e('0x40')]['id']}})[_0xb08e('0x21')](handleEntityNotFound(_0x2dbc49,null))[_0xb08e('0x21')](function(_0x5e9e21){if(_0x5e9e21){_0x39e1fb=_0x5e9e21;_0x4b576c[_0xb08e('0x29')]=_[_0xb08e('0x2b')](db['Action'][_0xb08e('0x41')]);_0x4b576c[_0xb08e('0x2a')]=_['keys'](_0x2476bd[_0xb08e('0x2a')]);_0x4b576c[_0xb08e('0x34')]=_[_0xb08e('0x2c')](_0x4b576c[_0xb08e('0x29')],_0x4b576c[_0xb08e('0x2a')]);_0x5b79bd['attributes']=_[_0xb08e('0x2c')](_0x4b576c['model'],qs['fields'](_0x2476bd[_0xb08e('0x2a')][_0xb08e('0x2d')]));_0x5b79bd['attributes']=_0x5b79bd['attributes'][_0xb08e('0x2f')]?_0x5b79bd[_0xb08e('0x2e')]:_0x4b576c[_0xb08e('0x29')];_0x5b79bd['order']=qs[_0xb08e('0x33')](_0x2476bd[_0xb08e('0x2a')]['sort']);_0x5b79bd[_0xb08e('0x37')]=qs['filters'](_[_0xb08e('0x35')](_0x2476bd['query'],_0x4b576c[_0xb08e('0x34')]));if(_0x2476bd['query'][_0xb08e('0x36')]){_0x5b79bd['where']=_['merge'](_0x5b79bd[_0xb08e('0x37')],{'$or':_[_0xb08e('0x27')](_0x5b79bd[_0xb08e('0x2e')],function(_0xbd2e52){var _0x2bf8b7={};_0x2bf8b7[_0xbd2e52]={'$like':'%'+_0x2476bd[_0xb08e('0x2a')]['filter']+'%'};return _0x2bf8b7;})});}_0x5b79bd=_[_0xb08e('0x38')]({},_0x5b79bd,_0x2476bd[_0xb08e('0x39')]);return _0x39e1fb['getActions'](_0x5b79bd);}})[_0xb08e('0x21')](function(_0x350fb8){if(_0x350fb8){_0x26d15c=_0x350fb8[_0xb08e('0x2f')];if(!_0x2476bd[_0xb08e('0x2a')]['hasOwnProperty']('nolimit')){_0x5b79bd[_0xb08e('0x19')]=qs[_0xb08e('0x19')](_0x2476bd[_0xb08e('0x2a')][_0xb08e('0x19')]);_0x5b79bd['offset']=qs[_0xb08e('0x1b')](_0x2476bd['query'][_0xb08e('0x1b')]);}return _0x39e1fb[_0xb08e('0x4c')](_0x5b79bd);}})[_0xb08e('0x21')](function(_0x530097){if(_0x530097){return _0x530097?{'count':_0x26d15c,'rows':_0x530097}:null;}})[_0xb08e('0x21')](respondWithResult(_0x2dbc49,null))[_0xb08e('0x3e')](handleError(_0x2dbc49,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 62313ce..cd630f2 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 _0xe604=['./automation.attributes','exports','define','tools_automations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x316cb4,_0x24d20b){var _0x5c8884=function(_0x31d84e){while(--_0x31d84e){_0x316cb4['push'](_0x316cb4['shift']());}};_0x5c8884(++_0x24d20b);}(_0xe604,0xd4));var _0x4e60=function(_0x3e07b9,_0x1da012){_0x3e07b9=_0x3e07b9-0x0;var _0x1a7460=_0xe604[_0x3e07b9];return _0x1a7460;};'use strict';var _=require(_0x4e60('0x0'));var util=require('util');var logger=require(_0x4e60('0x1'))(_0x4e60('0x2'));var moment=require(_0x4e60('0x3'));var BPromise=require(_0x4e60('0x4'));var rp=require(_0x4e60('0x5'));var fs=require('fs');var path=require(_0x4e60('0x6'));var rimraf=require(_0x4e60('0x7'));var config=require(_0x4e60('0x8'));var attributes=require(_0x4e60('0x9'));module[_0x4e60('0xa')]=function(_0x5da184,_0x2a7a04){return _0x5da184[_0x4e60('0xb')]('Automation',attributes,{'tableName':_0x4e60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93c8=['bluebird','request-promise','../../config/environment','define','tools_automations','util','api','moment'];(function(_0x4666c5,_0x3ff2f2){var _0x5a0a31=function(_0x4aea95){while(--_0x4aea95){_0x4666c5['push'](_0x4666c5['shift']());}};_0x5a0a31(++_0x3ff2f2);}(_0x93c8,0x65));var _0x893c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x93c8[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x893c('0x0'));var logger=require('../../config/logger')(_0x893c('0x1'));var moment=require(_0x893c('0x2'));var BPromise=require(_0x893c('0x3'));var rp=require(_0x893c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x893c('0x5'));var attributes=require('./automation.attributes');module['exports']=function(_0x20f006,_0xa22082){return _0x20f006[_0x893c('0x6')]('Automation',attributes,{'tableName':_0x893c('0x7'),'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 7decc1d..63d4f80 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 _0xa8b1=['http','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x205089,_0x2fb2bb){var _0x165a9c=function(_0x2633d4){while(--_0x2633d4){_0x205089['push'](_0x205089['shift']());}};_0x165a9c(++_0x2fb2bb);}(_0xa8b1,0x182));var _0x1a8b=function(_0x20fc91,_0xd5f8e0){_0x20fc91=_0x20fc91-0x0;var _0x3069f8=_0xa8b1[_0x20fc91];return _0x3069f8;};'use strict';var _=require(_0x1a8b('0x0'));var util=require(_0x1a8b('0x1'));var moment=require(_0x1a8b('0x2'));var BPromise=require(_0x1a8b('0x3'));var rs=require(_0x1a8b('0x4'));var fs=require('fs');var Redis=require(_0x1a8b('0x5'));var db=require(_0x1a8b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a8b('0x7'));var config=require(_0x1a8b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1a8b('0x9')][_0x1a8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4693b9,_0x4946cd,_0x2dec98){return new BPromise(function(_0x164e57,_0x402603){return client[_0x1a8b('0xb')](_0x4693b9,_0x2dec98)[_0x1a8b('0xc')](function(_0x2340f6){logger['info'](_0x1a8b('0xd'),_0x4946cd,_0x1a8b('0xe'));logger[_0x1a8b('0xf')](_0x1a8b('0x10'),_0x4946cd,'request\x20sent',JSON[_0x1a8b('0x11')](_0x2340f6));if(_0x2340f6[_0x1a8b('0x12')]){if(_0x2340f6[_0x1a8b('0x12')]['code']===0x1f4){logger['error'](_0x1a8b('0xd'),_0x4946cd,_0x2340f6[_0x1a8b('0x12')]['message']);return _0x402603(_0x2340f6[_0x1a8b('0x12')][_0x1a8b('0x13')]);}logger[_0x1a8b('0x12')](_0x1a8b('0xd'),_0x4946cd,_0x2340f6[_0x1a8b('0x12')][_0x1a8b('0x13')]);return _0x164e57(_0x2340f6['error'][_0x1a8b('0x13')]);}else{logger['info'](_0x1a8b('0xd'),_0x4946cd,'request\x20sent');_0x164e57(_0x2340f6[_0x1a8b('0x14')][_0x1a8b('0x13')]);}})[_0x1a8b('0x15')](function(_0x27d243){logger[_0x1a8b('0x12')]('Automation,\x20%s,\x20%s',_0x4946cd,_0x27d243);_0x402603(_0x27d243);});});} \ No newline at end of file +var _0xdef9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2ee20d,_0x354e70){var _0xade530=function(_0x1db7cc){while(--_0x1db7cc){_0x2ee20d['push'](_0x2ee20d['shift']());}};_0xade530(++_0x354e70);}(_0xdef9,0x1ed));var _0x9def=function(_0x2e7025,_0x187270){_0x2e7025=_0x2e7025-0x0;var _0x5373ed=_0xdef9[_0x2e7025];return _0x5373ed;};'use strict';var _=require(_0x9def('0x0'));var util=require(_0x9def('0x1'));var moment=require(_0x9def('0x2'));var BPromise=require(_0x9def('0x3'));var rs=require(_0x9def('0x4'));var fs=require('fs');var Redis=require(_0x9def('0x5'));var db=require(_0x9def('0x6'))['db'];var utils=require(_0x9def('0x7'));var logger=require(_0x9def('0x8'))(_0x9def('0x9'));var config=require(_0x9def('0xa'));var jayson=require(_0x9def('0xb'));var client=jayson[_0x9def('0xc')][_0x9def('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x40c607,_0x25a03e,_0x42296c){return new BPromise(function(_0x1efce0,_0x8262f1){return client['request'](_0x40c607,_0x42296c)[_0x9def('0xe')](function(_0x4f0a0d){logger['info'](_0x9def('0xf'),_0x25a03e,_0x9def('0x10'));logger[_0x9def('0x11')](_0x9def('0x12'),_0x25a03e,'request\x20sent',JSON[_0x9def('0x13')](_0x4f0a0d));if(_0x4f0a0d[_0x9def('0x14')]){if(_0x4f0a0d[_0x9def('0x14')][_0x9def('0x15')]===0x1f4){logger['error'](_0x9def('0xf'),_0x25a03e,_0x4f0a0d[_0x9def('0x14')]['message']);return _0x8262f1(_0x4f0a0d[_0x9def('0x14')]['message']);}logger['error'](_0x9def('0xf'),_0x25a03e,_0x4f0a0d[_0x9def('0x14')][_0x9def('0x16')]);return _0x1efce0(_0x4f0a0d['error'][_0x9def('0x16')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x25a03e,_0x9def('0x10'));_0x1efce0(_0x4f0a0d[_0x9def('0x17')][_0x9def('0x16')]);}})[_0x9def('0x18')](function(_0x463520){logger[_0x9def('0x14')](_0x9def('0xf'),_0x25a03e,_0x463520);_0x8262f1(_0x463520);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 9d39af9..f1b6848 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 _0x5bb7=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','/:id','delete','destroy','exports'];(function(_0x213ccf,_0x5e7443){var _0x1a3db6=function(_0x1505e6){while(--_0x1505e6){_0x213ccf['push'](_0x213ccf['shift']());}};_0x1a3db6(++_0x5e7443);}(_0x5bb7,0x1ee));var _0x75bb=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x5bb7[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x75bb('0x0'));var util=require(_0x75bb('0x1'));var path=require(_0x75bb('0x2'));var timeout=require(_0x75bb('0x3'));var express=require(_0x75bb('0x4'));var router=express[_0x75bb('0x5')]();var fs_extra=require(_0x75bb('0x6'));var auth=require(_0x75bb('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x75bb('0x8'));var controller=require(_0x75bb('0x9'));router[_0x75bb('0xa')]('/',auth[_0x75bb('0xb')](),controller[_0x75bb('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x75bb('0xd')]);router['get'](_0x75bb('0xe'),auth[_0x75bb('0xb')](),controller[_0x75bb('0xf')]);router[_0x75bb('0xa')](_0x75bb('0x10'),auth['isAuthenticated'](),controller[_0x75bb('0x11')]);router[_0x75bb('0x12')]('/',auth[_0x75bb('0xb')](),controller[_0x75bb('0x13')]);router[_0x75bb('0x12')]('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0x75bb('0x12')]('/:id/actions',auth[_0x75bb('0xb')](),controller[_0x75bb('0x14')]);router[_0x75bb('0x15')](_0x75bb('0x16'),auth['isAuthenticated'](),controller['update']);router[_0x75bb('0x17')](_0x75bb('0x16'),auth[_0x75bb('0xb')](),controller[_0x75bb('0x18')]);module[_0x75bb('0x19')]=router; \ No newline at end of file +var _0x9224=['/:id/actions','getActions','post','create','addActions','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions'];(function(_0x70539e,_0x31793b){var _0x10fbeb=function(_0x5e52cf){while(--_0x5e52cf){_0x70539e['push'](_0x70539e['shift']());}};_0x10fbeb(++_0x31793b);}(_0x9224,0xa3));var _0x4922=function(_0x5d836e,_0x51fcb2){_0x5d836e=_0x5d836e-0x0;var _0x33d831=_0x9224[_0x5d836e];return _0x33d831;};'use strict';var multer=require('multer');var util=require(_0x4922('0x0'));var path=require(_0x4922('0x1'));var timeout=require(_0x4922('0x2'));var express=require(_0x4922('0x3'));var router=express[_0x4922('0x4')]();var fs_extra=require(_0x4922('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4922('0x6'));router['get']('/',auth[_0x4922('0x7')](),controller[_0x4922('0x8')]);router[_0x4922('0x9')](_0x4922('0xa'),auth[_0x4922('0x7')](),controller[_0x4922('0xb')]);router['get'](_0x4922('0xc'),auth[_0x4922('0x7')](),controller['getConditions']);router[_0x4922('0x9')](_0x4922('0xd'),auth[_0x4922('0x7')](),controller[_0x4922('0xe')]);router[_0x4922('0xf')]('/',auth[_0x4922('0x7')](),controller[_0x4922('0x10')]);router[_0x4922('0xf')]('/:id/conditions',auth[_0x4922('0x7')](),controller['addConditions']);router[_0x4922('0xf')](_0x4922('0xd'),auth[_0x4922('0x7')](),controller[_0x4922('0x11')]);router[_0x4922('0x12')]('/:id',auth[_0x4922('0x7')](),controller[_0x4922('0x13')]);router['delete'](_0x4922('0xa'),auth[_0x4922('0x7')](),controller[_0x4922('0x14')]);module[_0x4922('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 7336a6a..8f509aa 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 _0x3285=['exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize'];(function(_0x2b7575,_0x1853b0){var _0x18e74f=function(_0x3d105a){while(--_0x3d105a){_0x2b7575['push'](_0x2b7575['shift']());}};_0x18e74f(++_0x1853b0);}(_0x3285,0xdd));var _0x5328=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x3285[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require(_0x5328('0x0'));module[_0x5328('0x1')]={'name':{'type':Sequelize[_0x5328('0x2')],'unique':_0x5328('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x5328('0x4')),'allowNull':![],'defaultValue':_0x5328('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5328('0x5')],'defaultValue':0x0,'comment':_0x5328('0x6')},'limitCalls':{'type':Sequelize[_0x5328('0x7')](0x4)[_0x5328('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5328('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5328('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5328('0x7')](0x3)[_0x5328('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5328('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5328('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5328('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5328('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x5328('0x7')](0x3)[_0x5328('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5328('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5328('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5328('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5328('0x7')](0x3)[_0x5328('0x8')],'defaultValue':0x3,'comment':_0x5328('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5328('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x5328('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5328('0xf')},'dialTimezone':{'type':Sequelize[_0x5328('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5328('0x2')],'defaultValue':_0x5328('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x5328('0x11')](_0x5328('0x12'),'never',_0x5328('0x13')),'defaultValue':_0x5328('0x12')},'dialAMDActive':{'type':Sequelize[_0x5328('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x5328('0x7')](0x9)[_0x5328('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5328('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x5328('0x7')](0x9)[_0x5328('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5328('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5328('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5328('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5328('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x5328('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5328('0x7')](0x9)[_0x5328('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5328('0x7')](0x9)[_0x5328('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5328('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5328('0x7')](0x5)[_0x5328('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5328('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5328('0x7')](0x9)[_0x5328('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5328('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5328('0x11')]('DESC','ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x5328('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5328('0x1b')},'dialCutDigit':{'type':Sequelize[_0x5328('0x7')](0x3)[_0x5328('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5328('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5328('0x7')](0x3)[_0x5328('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5328('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5328('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5328('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5328('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5328('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5328('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5328('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5328('0x7')](0x3)[_0x5328('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5328('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5328('0x7')](0x5)[_0x5328('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x5328('0x7')](0x3)[_0x5328('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5328('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5328('0x7')](0x5)[_0x5328('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5328('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5328('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5328('0x7')](0x5)[_0x5328('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5328('0x24')}}; \ No newline at end of file +var _0x83d2=['BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','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','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x83d2,0x1f2));var _0x283d=function(_0xb06c82,_0x2017c8){_0xb06c82=_0xb06c82-0x0;var _0x40f219=_0x83d2[_0xb06c82];return _0x40f219;};'use strict';var Sequelize=require(_0x283d('0x0'));module[_0x283d('0x1')]={'name':{'type':Sequelize[_0x283d('0x2')],'unique':_0x283d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x283d('0x4')](_0x283d('0x5')),'allowNull':![],'defaultValue':_0x283d('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x283d('0x6')],'defaultValue':0x0,'comment':_0x283d('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x283d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x283d('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x283d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x283d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x283d('0xa')](0x5)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'comment':_0x283d('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x283d('0xa')](0x5)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x283d('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x283d('0x2')],'defaultValue':_0x283d('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x283d('0x4')]('always',_0x283d('0x12'),_0x283d('0x13')),'defaultValue':_0x283d('0x14')},'dialAMDActive':{'type':Sequelize[_0x283d('0x6')],'defaultValue':0x0,'comment':_0x283d('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x283d('0xa')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x283d('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x283d('0xa')](0x9)[_0x283d('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x283d('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x283d('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x283d('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x283d('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x283d('0xa')](0x9)[_0x283d('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x283d('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x283d('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x283d('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x283d('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x283d('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x283d('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x283d('0x1e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x283d('0x4')](_0x283d('0x1f'),_0x283d('0x20')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x283d('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x283d('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x283d('0x21')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x283d('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0x23')},'dialDropMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0x24')},'dialDropRetryFrequency':{'type':Sequelize[_0x283d('0xa')](0x5)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0x25')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x283d('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0x26')},'dialMachineMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0x27')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0x29')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 92b7c0f..ba6fc63 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 _0xc961=['merge','options','Campaign','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','params','omit','body','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','nolimit','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','order','CmHopperFinal','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','field','NOW()','CmListId','toString','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','insert','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','IvrCampaigns','UserProfileResource','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL'];(function(_0x543c51,_0xc2126e){var _0x4250b7=function(_0x4745d5){while(--_0x4745d5){_0x543c51['push'](_0x543c51['shift']());}};_0x4250b7(++_0xc2126e);}(_0xc961,0x17a));var _0x1c96=function(_0x4a48cf,_0x5f1870){_0x4a48cf=_0x4a48cf-0x0;var _0x24a970=_0xc961[_0x4a48cf];return _0x24a970;};'use strict';var emlformat=require(_0x1c96('0x0'));var rimraf=require(_0x1c96('0x1'));var zipdir=require(_0x1c96('0x2'));var jsonpatch=require(_0x1c96('0x3'));var rp=require(_0x1c96('0x4'));var moment=require(_0x1c96('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1c96('0x6'));var sox=require('sox');var csv=require(_0x1c96('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c96('0x8'));var _=require(_0x1c96('0x9'));var squel=require(_0x1c96('0xa'));var crypto=require(_0x1c96('0xb'));var jsforce=require(_0x1c96('0xc'));var deskjs=require(_0x1c96('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1c96('0xe'));var Papa=require(_0x1c96('0xf'));var Redis=require(_0x1c96('0x10'));var authService=require(_0x1c96('0x11'));var qs=require(_0x1c96('0x12'));var as=require(_0x1c96('0x13'));var hardwareService=require(_0x1c96('0x14'));var logger=require(_0x1c96('0x15'))(_0x1c96('0x16'));var utils=require(_0x1c96('0x17'));var config=require(_0x1c96('0x18'));var licenseUtil=require(_0x1c96('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e0663,_0x3c9850){_0x3c9850=_0x3c9850||0xcc;return function(_0x5a8f97){if(_0x5a8f97){return _0x1e0663[_0x1c96('0x1a')](_0x3c9850);}return _0x1e0663[_0x1c96('0x1b')](_0x3c9850)[_0x1c96('0x1c')]();};}function respondWithResult(_0x3bf224,_0x4c410d){_0x4c410d=_0x4c410d||0xc8;return function(_0x242bb1){if(_0x242bb1){return _0x3bf224[_0x1c96('0x1b')](_0x4c410d)[_0x1c96('0x1d')](_0x242bb1);}};}function respondWithFilteredResult(_0xe1518b,_0x199719){return function(_0x8f03c4){if(_0x8f03c4){var _0x7cfdeb=typeof _0x199719[_0x1c96('0x1e')]==='undefined'&&typeof _0x199719[_0x1c96('0x1f')]==='undefined';var _0x32cb09=_0x8f03c4[_0x1c96('0x20')];var _0x595429=_0x7cfdeb?0x0:_0x199719[_0x1c96('0x1e')];var _0x491875=_0x7cfdeb?_0x8f03c4['count']:_0x199719[_0x1c96('0x1e')]+_0x199719[_0x1c96('0x1f')];var _0x15b2bf;if(_0x491875>=_0x32cb09){_0x491875=_0x32cb09;_0x15b2bf=0xc8;}else{_0x15b2bf=0xce;}_0xe1518b['status'](_0x15b2bf);return _0xe1518b[_0x1c96('0x21')]('Content-Range',_0x595429+'-'+_0x491875+'/'+_0x32cb09)[_0x1c96('0x1d')](_0x8f03c4);}return null;};}function patchUpdates(_0x174ebf){return function(_0x5e11b8){try{jsonpatch[_0x1c96('0x22')](_0x5e11b8,_0x174ebf,!![]);}catch(_0x4e1c7c){return BPromise[_0x1c96('0x23')](_0x4e1c7c);}return _0x5e11b8[_0x1c96('0x24')]();};}function saveUpdates(_0x23722c,_0x3f4293){return function(_0x30e8b8){if(_0x30e8b8){return _0x30e8b8[_0x1c96('0x25')](_0x23722c)[_0x1c96('0x26')](function(_0x275189){return _0x275189;});}return null;};}function removeEntity(_0xad92bd,_0xc40964){return function(_0x4d2c9c){if(_0x4d2c9c){return _0x4d2c9c[_0x1c96('0x27')]()[_0x1c96('0x26')](function(){var _0x289ee5=_0x4d2c9c['get']({'plain':!![]});var _0x5e9ac8=_0x1c96('0x28');return db[_0x1c96('0x29')]['destroy']({'where':{'type':_0x5e9ac8,'resourceId':_0x289ee5['id']}})[_0x1c96('0x26')](function(){return _0x4d2c9c;});})[_0x1c96('0x26')](function(){_0xad92bd[_0x1c96('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d588d,_0x32c3b8){return function(_0x8d0b51){if(!_0x8d0b51){_0x4d588d['sendStatus'](0x194);}return _0x8d0b51;};}function handleError(_0xfd0fbc,_0x4e6dea){_0x4e6dea=_0x4e6dea||0x1f4;return function(_0x3212f3){logger[_0x1c96('0x2a')](_0x3212f3['stack']);if(_0x3212f3['name']){delete _0x3212f3[_0x1c96('0x2b')];}_0xfd0fbc['status'](_0x4e6dea)[_0x1c96('0x2c')](_0x3212f3);};}exports['index']=function(_0x5c7b1d,_0x318052){var _0x4438fb={},_0x104b15={},_0x43f5cc={'count':0x0,'rows':[]};var _0x45cc03=_[_0x1c96('0x2d')](db['Campaign']['rawAttributes'],function(_0x2f7b15){return{'name':_0x2f7b15[_0x1c96('0x2e')],'type':_0x2f7b15[_0x1c96('0x2f')][_0x1c96('0x30')]};});_0x104b15[_0x1c96('0x31')]=_[_0x1c96('0x2d')](_0x45cc03,_0x1c96('0x2b'));_0x104b15[_0x1c96('0x32')]=_[_0x1c96('0x33')](_0x5c7b1d['query']);_0x104b15[_0x1c96('0x34')]=_[_0x1c96('0x35')](_0x104b15[_0x1c96('0x31')],_0x104b15[_0x1c96('0x32')]);_0x4438fb[_0x1c96('0x36')]=_[_0x1c96('0x35')](_0x104b15['model'],qs[_0x1c96('0x37')](_0x5c7b1d[_0x1c96('0x32')]['fields']));_0x4438fb[_0x1c96('0x36')]=_0x4438fb[_0x1c96('0x36')][_0x1c96('0x38')]?_0x4438fb[_0x1c96('0x36')]:_0x104b15[_0x1c96('0x31')];if(!_0x5c7b1d[_0x1c96('0x32')][_0x1c96('0x39')]('nolimit')){_0x4438fb['limit']=qs[_0x1c96('0x1f')](_0x5c7b1d[_0x1c96('0x32')]['limit']);_0x4438fb[_0x1c96('0x1e')]=qs['offset'](_0x5c7b1d[_0x1c96('0x32')][_0x1c96('0x1e')]);}_0x4438fb['order']=qs['sort'](_0x5c7b1d[_0x1c96('0x32')][_0x1c96('0x3a')]);_0x4438fb[_0x1c96('0x3b')]=qs[_0x1c96('0x34')](_[_0x1c96('0x3c')](_0x5c7b1d[_0x1c96('0x32')],_0x104b15[_0x1c96('0x34')]),_0x45cc03);if(_0x5c7b1d['query'][_0x1c96('0x3d')]){_0x4438fb[_0x1c96('0x3b')]=_['merge'](_0x4438fb[_0x1c96('0x3b')],{'$or':_['map'](_0x45cc03,function(_0x2acb06){if(_0x2acb06[_0x1c96('0x2f')]!==_0x1c96('0x3e')){var _0x435748={};_0x435748[_0x2acb06['name']]={'$like':'%'+_0x5c7b1d[_0x1c96('0x32')][_0x1c96('0x3d')]+'%'};return _0x435748;}})});}_0x4438fb=_[_0x1c96('0x3f')]({},_0x4438fb,_0x5c7b1d[_0x1c96('0x40')]);var _0x58e706={'where':_0x4438fb[_0x1c96('0x3b')]};return db[_0x1c96('0x41')]['count'](_0x58e706)[_0x1c96('0x26')](function(_0x181bf5){_0x43f5cc[_0x1c96('0x20')]=_0x181bf5;if(_0x5c7b1d[_0x1c96('0x32')][_0x1c96('0x42')]){_0x4438fb[_0x1c96('0x43')]=[{'all':!![]}];}return db[_0x1c96('0x41')][_0x1c96('0x44')](_0x4438fb);})['then'](function(_0x1404b0){_0x43f5cc[_0x1c96('0x45')]=_0x1404b0;return _0x43f5cc;})[_0x1c96('0x26')](respondWithFilteredResult(_0x318052,_0x4438fb))[_0x1c96('0x46')](handleError(_0x318052,null));};exports[_0x1c96('0x47')]=function(_0x19a6e5,_0x2f39e8){var _0x3edb83={'raw':![],'where':{'id':_0x19a6e5['params']['id']}},_0x2959ab={};_0x2959ab['model']=_[_0x1c96('0x33')](db[_0x1c96('0x41')][_0x1c96('0x48')]);_0x2959ab[_0x1c96('0x32')]=_[_0x1c96('0x33')](_0x19a6e5['query']);_0x2959ab['filters']=_[_0x1c96('0x35')](_0x2959ab[_0x1c96('0x31')],_0x2959ab[_0x1c96('0x32')]);_0x3edb83['attributes']=_[_0x1c96('0x35')](_0x2959ab[_0x1c96('0x31')],qs['fields'](_0x19a6e5[_0x1c96('0x32')]['fields']));_0x3edb83['attributes']=_0x3edb83[_0x1c96('0x36')][_0x1c96('0x38')]?_0x3edb83[_0x1c96('0x36')]:_0x2959ab['model'];if(_0x19a6e5['query']['includeAll']){_0x3edb83[_0x1c96('0x43')]=[{'all':!![]}];}_0x3edb83=_['merge']({},_0x3edb83,_0x19a6e5[_0x1c96('0x40')]);return db['Campaign'][_0x1c96('0x49')](_0x3edb83)[_0x1c96('0x26')](handleEntityNotFound(_0x2f39e8,null))[_0x1c96('0x26')](respondWithResult(_0x2f39e8,null))[_0x1c96('0x46')](handleError(_0x2f39e8,null));};exports['create']=function(_0x200fc9,_0xa5effb){return db[_0x1c96('0x41')][_0x1c96('0x4a')](_0x200fc9['body'],{})[_0x1c96('0x26')](function(_0x3670c1){var _0x2d5ee3=_0x200fc9[_0x1c96('0x4b')][_0x1c96('0x4c')]({'plain':!![]});if(!_0x2d5ee3)throw new Error(_0x1c96('0x4d'));if(_0x2d5ee3[_0x1c96('0x4e')]==='user'){var _0x2a4249=_0x3670c1['get']({'plain':!![]});var _0x1082c3=_0x1c96('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1082c3,'userProfileId':_0x2d5ee3[_0x1c96('0x4f')]},'raw':!![]})[_0x1c96('0x26')](function(_0x4f5cd2){if(_0x4f5cd2&&_0x4f5cd2['autoAssociation']===0x0){return db[_0x1c96('0x29')][_0x1c96('0x4a')]({'name':_0x2a4249[_0x1c96('0x2b')],'resourceId':_0x2a4249['id'],'type':_0x4f5cd2['name'],'sectionId':_0x4f5cd2['id']},{})['then'](function(){return _0x3670c1;});}else{return _0x3670c1;}})[_0x1c96('0x46')](function(_0x534f61){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x534f61);throw _0x534f61;});}return _0x3670c1;})['then'](respondWithResult(_0xa5effb,0xc9))[_0x1c96('0x46')](handleError(_0xa5effb,null));};exports['clone']=function(_0x51309f,_0x5c896e){var _0x75da24={'where':{'id':_0x51309f[_0x1c96('0x50')]['id']}},_0x75d719={};_0x75d719[_0x1c96('0x31')]=_[_0x1c96('0x33')](db[_0x1c96('0x41')][_0x1c96('0x48')]);_0x75da24[_0x1c96('0x36')]=_[_0x1c96('0x35')](_0x75d719['model'],qs[_0x1c96('0x37')](_0x51309f[_0x1c96('0x32')][_0x1c96('0x37')]));_0x75da24[_0x1c96('0x36')]=_0x75da24['attributes'][_0x1c96('0x38')]?_0x75da24[_0x1c96('0x36')]:_0x75d719[_0x1c96('0x31')];if(_0x51309f[_0x1c96('0x32')][_0x1c96('0x42')]){_0x75da24[_0x1c96('0x43')]=[{'all':!![]}];}_0x75da24=_[_0x1c96('0x3f')]({},_0x75da24,_0x51309f[_0x1c96('0x40')]);return db['Campaign'][_0x1c96('0x49')](_0x75da24)[_0x1c96('0x26')](handleEntityNotFound(_0x5c896e,null))[_0x1c96('0x26')](function(_0x4a7a8f){if(_0x4a7a8f){var _0x28cb48=_0x4a7a8f[_0x1c96('0x4c')]({'plain':!![]});_0x28cb48=qs[_0x1c96('0x51')](_0x28cb48,['id','createdAt','updatedAt']);_0x51309f[_0x1c96('0x52')]=_[_0x1c96('0x51')](_0x51309f['body'],['id','createdAt','updatedAt']);return db[_0x1c96('0x41')][_0x1c96('0x4a')](_[_0x1c96('0x3f')](_0x28cb48,_0x51309f[_0x1c96('0x52')]),{'include':_0x51309f['query'][_0x1c96('0x42')]?[{'all':!![]}]:undefined})[_0x1c96('0x26')](function(_0x1c774d){var _0x5acdc=_0x51309f[_0x1c96('0x4b')][_0x1c96('0x4c')]({'plain':!![]});if(!_0x5acdc)throw new Error(_0x1c96('0x4d'));if(_0x5acdc['role']==='user'){var _0x2f9d99=_0x1c774d[_0x1c96('0x4c')]({'plain':!![]});var _0x242ebe=_0x1c96('0x28');return db[_0x1c96('0x53')]['find']({'where':{'name':_0x242ebe,'userProfileId':_0x5acdc['userProfileId']},'raw':!![]})[_0x1c96('0x26')](function(_0xf91a09){if(_0xf91a09&&_0xf91a09[_0x1c96('0x54')]===0x0){return db[_0x1c96('0x29')][_0x1c96('0x4a')]({'name':_0x2f9d99['name'],'resourceId':_0x2f9d99['id'],'type':_0xf91a09['name'],'sectionId':_0xf91a09['id']},{})[_0x1c96('0x26')](function(){return _0x1c774d;});}else{return _0x1c774d;}})[_0x1c96('0x46')](function(_0x40510e){logger[_0x1c96('0x2a')](_0x1c96('0x55'),_0x40510e);throw _0x40510e;});}return _0x1c774d;});}})['then'](respondWithResult(_0x5c896e,0xc9))['catch'](handleError(_0x5c896e,null));};exports[_0x1c96('0x25')]=function(_0x391804,_0x58e053){if(_0x391804[_0x1c96('0x52')]['id']){delete _0x391804[_0x1c96('0x52')]['id'];}return db[_0x1c96('0x41')][_0x1c96('0x49')]({'where':{'id':_0x391804['params']['id']}})[_0x1c96('0x26')](handleEntityNotFound(_0x58e053,null))['then'](saveUpdates(_0x391804['body'],null))[_0x1c96('0x26')](respondWithResult(_0x58e053,null))[_0x1c96('0x46')](handleError(_0x58e053,null));};exports[_0x1c96('0x27')]=function(_0x36e52b,_0x52e7ab){return db[_0x1c96('0x41')][_0x1c96('0x49')]({'where':{'id':_0x36e52b['params']['id']}})[_0x1c96('0x26')](handleEntityNotFound(_0x52e7ab,null))[_0x1c96('0x26')](removeEntity(_0x52e7ab,null))[_0x1c96('0x46')](handleError(_0x52e7ab,null));};exports['getHoppers']=function(_0x1e26ba,_0x52e3e7,_0x5d0006){var _0x1043a6={'raw':!![],'where':{}};var _0xfd585c={};var _0x4aeeee={'count':0x0,'rows':[]};return db[_0x1c96('0x41')][_0x1c96('0x56')]({'where':{'id':_0x1e26ba['params']['id']}})[_0x1c96('0x26')](handleEntityNotFound(_0x52e3e7,null))[_0x1c96('0x26')](function(_0x401fd2){if(_0x401fd2){_0xfd585c[_0x1c96('0x31')]=_['keys'](db['CmHopper']['rawAttributes']);_0xfd585c[_0x1c96('0x32')]=_[_0x1c96('0x33')](_0x1e26ba[_0x1c96('0x32')]);_0xfd585c[_0x1c96('0x34')]=_[_0x1c96('0x35')](_0xfd585c[_0x1c96('0x31')],_0xfd585c[_0x1c96('0x32')]);_0x1043a6['attributes']=_[_0x1c96('0x35')](_0xfd585c[_0x1c96('0x31')],qs[_0x1c96('0x37')](_0x1e26ba[_0x1c96('0x32')][_0x1c96('0x37')]));_0x1043a6['attributes']=_0x1043a6[_0x1c96('0x36')][_0x1c96('0x38')]?_0x1043a6[_0x1c96('0x36')]:_0xfd585c[_0x1c96('0x31')];if(!_0x1e26ba[_0x1c96('0x32')][_0x1c96('0x39')](_0x1c96('0x57'))){_0x1043a6['limit']=qs[_0x1c96('0x1f')](_0x1e26ba[_0x1c96('0x32')][_0x1c96('0x1f')]);_0x1043a6[_0x1c96('0x1e')]=qs[_0x1c96('0x1e')](_0x1e26ba[_0x1c96('0x32')]['offset']);}_0x1043a6['order']=qs[_0x1c96('0x3a')](_0x1e26ba[_0x1c96('0x32')][_0x1c96('0x3a')]);_0x1043a6['where']=qs[_0x1c96('0x34')](_[_0x1c96('0x3c')](_0x1e26ba[_0x1c96('0x32')],_0xfd585c['filters']));_0x1043a6[_0x1c96('0x3b')][_0x1c96('0x58')]=_0x401fd2['id'];if(_0x1e26ba['query'][_0x1c96('0x3d')]){_0x1043a6[_0x1c96('0x3b')]=_[_0x1c96('0x3f')](_0x1043a6['where'],{'$or':_[_0x1c96('0x2d')](_0x1043a6['attributes'],function(_0x2bf76f){var _0x27825d={};_0x27825d[_0x2bf76f]={'$like':'%'+_0x1e26ba[_0x1c96('0x32')][_0x1c96('0x3d')]+'%'};return _0x27825d;})});}_0x1043a6=_[_0x1c96('0x3f')]({},_0x1043a6,_0x1e26ba[_0x1c96('0x40')]);return db[_0x1c96('0x59')][_0x1c96('0x20')]({'where':_0x1043a6[_0x1c96('0x3b')]})['then'](function(_0x3bee7e){_0x4aeeee[_0x1c96('0x20')]=_0x3bee7e;if(_0x1e26ba[_0x1c96('0x32')][_0x1c96('0x42')]){_0x1043a6['include']=[{'all':!![]}];}return db['CmHopper'][_0x1c96('0x44')](_0x1043a6);})[_0x1c96('0x26')](function(_0x39d081){_0x4aeeee[_0x1c96('0x45')]=_0x39d081;return _0x4aeeee;});}})[_0x1c96('0x26')](respondWithFilteredResult(_0x52e3e7,_0x1043a6))[_0x1c96('0x46')](handleError(_0x52e3e7,null));};exports[_0x1c96('0x5a')]=function(_0x3b09e6,_0x27e0d8,_0x45c65c){var _0x5d9bb9={'raw':!![],'where':{}};var _0x2459b0={};var _0x145b60={'count':0x0,'rows':[]};return db['Campaign'][_0x1c96('0x56')]({'where':{'id':_0x3b09e6['params']['id']}})[_0x1c96('0x26')](handleEntityNotFound(_0x27e0d8,null))[_0x1c96('0x26')](function(_0x84b59){if(_0x84b59){_0x2459b0[_0x1c96('0x31')]=_[_0x1c96('0x33')](db[_0x1c96('0x5b')][_0x1c96('0x48')]);_0x2459b0[_0x1c96('0x32')]=_[_0x1c96('0x33')](_0x3b09e6[_0x1c96('0x32')]);_0x2459b0[_0x1c96('0x34')]=_['intersection'](_0x2459b0[_0x1c96('0x31')],_0x2459b0[_0x1c96('0x32')]);_0x5d9bb9[_0x1c96('0x36')]=_[_0x1c96('0x35')](_0x2459b0[_0x1c96('0x31')],qs[_0x1c96('0x37')](_0x3b09e6[_0x1c96('0x32')][_0x1c96('0x37')]));_0x5d9bb9[_0x1c96('0x36')]=_0x5d9bb9[_0x1c96('0x36')][_0x1c96('0x38')]?_0x5d9bb9['attributes']:_0x2459b0[_0x1c96('0x31')];if(!_0x3b09e6[_0x1c96('0x32')][_0x1c96('0x39')](_0x1c96('0x57'))){_0x5d9bb9[_0x1c96('0x1f')]=qs['limit'](_0x3b09e6['query']['limit']);_0x5d9bb9['offset']=qs[_0x1c96('0x1e')](_0x3b09e6[_0x1c96('0x32')]['offset']);}_0x5d9bb9[_0x1c96('0x5c')]=qs[_0x1c96('0x3a')](_0x3b09e6['query'][_0x1c96('0x3a')]);_0x5d9bb9['where']=qs['filters'](_[_0x1c96('0x3c')](_0x3b09e6['query'],_0x2459b0[_0x1c96('0x34')]));_0x5d9bb9['where'][_0x1c96('0x58')]=_0x84b59['id'];if(_0x3b09e6[_0x1c96('0x32')][_0x1c96('0x3d')]){_0x5d9bb9[_0x1c96('0x3b')]=_[_0x1c96('0x3f')](_0x5d9bb9['where'],{'$or':_[_0x1c96('0x2d')](_0x5d9bb9[_0x1c96('0x36')],function(_0xeb07c1){var _0xb5847b={};_0xb5847b[_0xeb07c1]={'$like':'%'+_0x3b09e6[_0x1c96('0x32')][_0x1c96('0x3d')]+'%'};return _0xb5847b;})});}_0x5d9bb9=_[_0x1c96('0x3f')]({},_0x5d9bb9,_0x3b09e6['options']);return db[_0x1c96('0x5b')][_0x1c96('0x20')]({'where':_0x5d9bb9['where']})['then'](function(_0x41ed68){_0x145b60[_0x1c96('0x20')]=_0x41ed68;if(_0x3b09e6['query'][_0x1c96('0x42')]){_0x5d9bb9[_0x1c96('0x43')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x5d9bb9);})['then'](function(_0x1ad641){_0x145b60[_0x1c96('0x45')]=_0x1ad641;return _0x145b60;});}})[_0x1c96('0x26')](respondWithFilteredResult(_0x27e0d8,_0x5d9bb9))['catch'](handleError(_0x27e0d8,null));};exports['getHopperFinals']=function(_0x293f26,_0x1a88d4,_0x568dc1){var _0x3cab5e={'raw':!![],'where':{}};var _0x220ea7={};var _0x134bc7={'count':0x0,'rows':[]};return db[_0x1c96('0x41')]['findOne']({'where':{'id':_0x293f26[_0x1c96('0x50')]['id']}})[_0x1c96('0x26')](handleEntityNotFound(_0x1a88d4,null))[_0x1c96('0x26')](function(_0x51bca9){if(_0x51bca9){_0x220ea7['model']=_[_0x1c96('0x33')](db[_0x1c96('0x5d')][_0x1c96('0x48')]);_0x220ea7[_0x1c96('0x32')]=_['keys'](_0x293f26[_0x1c96('0x32')]);_0x220ea7['filters']=_[_0x1c96('0x35')](_0x220ea7[_0x1c96('0x31')],_0x220ea7[_0x1c96('0x32')]);_0x3cab5e[_0x1c96('0x36')]=_[_0x1c96('0x35')](_0x220ea7[_0x1c96('0x31')],qs[_0x1c96('0x37')](_0x293f26[_0x1c96('0x32')][_0x1c96('0x37')]));_0x3cab5e['attributes']=_0x3cab5e[_0x1c96('0x36')][_0x1c96('0x38')]?_0x3cab5e[_0x1c96('0x36')]:_0x220ea7['model'];if(!_0x293f26[_0x1c96('0x32')][_0x1c96('0x39')](_0x1c96('0x57'))){_0x3cab5e[_0x1c96('0x1f')]=qs[_0x1c96('0x1f')](_0x293f26[_0x1c96('0x32')][_0x1c96('0x1f')]);_0x3cab5e[_0x1c96('0x1e')]=qs['offset'](_0x293f26[_0x1c96('0x32')][_0x1c96('0x1e')]);}_0x3cab5e[_0x1c96('0x5c')]=qs[_0x1c96('0x3a')](_0x293f26[_0x1c96('0x32')][_0x1c96('0x3a')]);_0x3cab5e[_0x1c96('0x3b')]=qs['filters'](_[_0x1c96('0x3c')](_0x293f26[_0x1c96('0x32')],_0x220ea7[_0x1c96('0x34')]));_0x3cab5e['where'][_0x1c96('0x58')]=_0x51bca9['id'];if(_0x293f26[_0x1c96('0x32')][_0x1c96('0x3d')]){_0x3cab5e[_0x1c96('0x3b')]=_[_0x1c96('0x3f')](_0x3cab5e[_0x1c96('0x3b')],{'$or':_[_0x1c96('0x2d')](_0x3cab5e['attributes'],function(_0x201490){var _0x406db4={};_0x406db4[_0x201490]={'$like':'%'+_0x293f26[_0x1c96('0x32')][_0x1c96('0x3d')]+'%'};return _0x406db4;})});}_0x3cab5e=_[_0x1c96('0x3f')]({},_0x3cab5e,_0x293f26['options']);return db['CmHopperFinal'][_0x1c96('0x20')]({'where':_0x3cab5e[_0x1c96('0x3b')]})[_0x1c96('0x26')](function(_0x56fb25){_0x134bc7[_0x1c96('0x20')]=_0x56fb25;if(_0x293f26['query']['includeAll']){_0x3cab5e[_0x1c96('0x43')]=[{'all':!![]}];}return db[_0x1c96('0x5d')][_0x1c96('0x44')](_0x3cab5e);})[_0x1c96('0x26')](function(_0x245045){_0x134bc7[_0x1c96('0x45')]=_0x245045;return _0x134bc7;});}})['then'](respondWithFilteredResult(_0x1a88d4,_0x3cab5e))[_0x1c96('0x46')](handleError(_0x1a88d4,null));};exports['getHopperBlacks']=function(_0xfb2dfe,_0x4d0b68,_0x28e7cb){var _0x5cb9ba={'raw':!![],'where':{}};var _0x2fe4f6={};var _0x22828a={'count':0x0,'rows':[]};return db[_0x1c96('0x41')][_0x1c96('0x56')]({'where':{'id':_0xfb2dfe[_0x1c96('0x50')]['id']}})['then'](handleEntityNotFound(_0x4d0b68,null))[_0x1c96('0x26')](function(_0x1e109d){if(_0x1e109d){_0x2fe4f6[_0x1c96('0x31')]=_[_0x1c96('0x33')](db['CmHopperBlack'][_0x1c96('0x48')]);_0x2fe4f6[_0x1c96('0x32')]=_[_0x1c96('0x33')](_0xfb2dfe['query']);_0x2fe4f6[_0x1c96('0x34')]=_['intersection'](_0x2fe4f6[_0x1c96('0x31')],_0x2fe4f6[_0x1c96('0x32')]);_0x5cb9ba[_0x1c96('0x36')]=_[_0x1c96('0x35')](_0x2fe4f6['model'],qs[_0x1c96('0x37')](_0xfb2dfe[_0x1c96('0x32')][_0x1c96('0x37')]));_0x5cb9ba[_0x1c96('0x36')]=_0x5cb9ba['attributes']['length']?_0x5cb9ba[_0x1c96('0x36')]:_0x2fe4f6[_0x1c96('0x31')];if(!_0xfb2dfe[_0x1c96('0x32')][_0x1c96('0x39')](_0x1c96('0x57'))){_0x5cb9ba[_0x1c96('0x1f')]=qs[_0x1c96('0x1f')](_0xfb2dfe['query']['limit']);_0x5cb9ba['offset']=qs[_0x1c96('0x1e')](_0xfb2dfe[_0x1c96('0x32')][_0x1c96('0x1e')]);}_0x5cb9ba[_0x1c96('0x5c')]=qs[_0x1c96('0x3a')](_0xfb2dfe[_0x1c96('0x32')][_0x1c96('0x3a')]);_0x5cb9ba[_0x1c96('0x3b')]=qs[_0x1c96('0x34')](_[_0x1c96('0x3c')](_0xfb2dfe[_0x1c96('0x32')],_0x2fe4f6[_0x1c96('0x34')]));_0x5cb9ba['where']['CampaignId']=_0x1e109d['id'];if(_0xfb2dfe[_0x1c96('0x32')][_0x1c96('0x3d')]){_0x5cb9ba[_0x1c96('0x3b')]=_[_0x1c96('0x3f')](_0x5cb9ba[_0x1c96('0x3b')],{'$or':_[_0x1c96('0x2d')](_0x5cb9ba['attributes'],function(_0x586f28){var _0x744bd1={};_0x744bd1[_0x586f28]={'$like':'%'+_0xfb2dfe[_0x1c96('0x32')][_0x1c96('0x3d')]+'%'};return _0x744bd1;})});}_0x5cb9ba=_[_0x1c96('0x3f')]({},_0x5cb9ba,_0xfb2dfe[_0x1c96('0x40')]);return db[_0x1c96('0x5e')][_0x1c96('0x20')]({'where':_0x5cb9ba[_0x1c96('0x3b')]})['then'](function(_0x20065f){_0x22828a[_0x1c96('0x20')]=_0x20065f;if(_0xfb2dfe[_0x1c96('0x32')]['includeAll']){_0x5cb9ba['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x1c96('0x44')](_0x5cb9ba);})[_0x1c96('0x26')](function(_0x1f8f3b){_0x22828a[_0x1c96('0x45')]=_0x1f8f3b;return _0x22828a;});}})[_0x1c96('0x26')](respondWithFilteredResult(_0x4d0b68,_0x5cb9ba))[_0x1c96('0x46')](handleError(_0x4d0b68,null));};exports['getLists']=function(_0x4f2c8d,_0x1abafd,_0x2899ca){var _0x1abcfd={};var _0x4a368c={};var _0x10cbe2;var _0x21cd74;return db['Campaign'][_0x1c96('0x56')]({'where':{'id':_0x4f2c8d['params']['id']}})[_0x1c96('0x26')](handleEntityNotFound(_0x1abafd,null))[_0x1c96('0x26')](function(_0x4d3856){if(_0x4d3856){_0x10cbe2=_0x4d3856;_0x4a368c['model']=_[_0x1c96('0x33')](db['CmList']['rawAttributes']);_0x4a368c['query']=_[_0x1c96('0x33')](_0x4f2c8d[_0x1c96('0x32')]);_0x4a368c[_0x1c96('0x34')]=_[_0x1c96('0x35')](_0x4a368c['model'],_0x4a368c[_0x1c96('0x32')]);_0x1abcfd['attributes']=_[_0x1c96('0x35')](_0x4a368c['model'],qs[_0x1c96('0x37')](_0x4f2c8d[_0x1c96('0x32')][_0x1c96('0x37')]));_0x1abcfd[_0x1c96('0x36')]=_0x1abcfd[_0x1c96('0x36')][_0x1c96('0x38')]?_0x1abcfd['attributes']:_0x4a368c[_0x1c96('0x31')];_0x1abcfd[_0x1c96('0x5c')]=qs[_0x1c96('0x3a')](_0x4f2c8d[_0x1c96('0x32')][_0x1c96('0x3a')]);_0x1abcfd[_0x1c96('0x3b')]=qs['filters'](_[_0x1c96('0x3c')](_0x4f2c8d[_0x1c96('0x32')],_0x4a368c[_0x1c96('0x34')]));if(_0x4f2c8d[_0x1c96('0x32')][_0x1c96('0x3d')]){_0x1abcfd[_0x1c96('0x3b')]=_[_0x1c96('0x3f')](_0x1abcfd[_0x1c96('0x3b')],{'$or':_[_0x1c96('0x2d')](_0x1abcfd[_0x1c96('0x36')],function(_0x133629){var _0x391a24={};_0x391a24[_0x133629]={'$like':'%'+_0x4f2c8d[_0x1c96('0x32')][_0x1c96('0x3d')]+'%'};return _0x391a24;})});}_0x1abcfd=_[_0x1c96('0x3f')]({},_0x1abcfd,_0x4f2c8d[_0x1c96('0x40')]);return _0x10cbe2[_0x1c96('0x5f')](_0x1abcfd);}})[_0x1c96('0x26')](function(_0x282453){if(_0x282453){_0x21cd74=_0x282453[_0x1c96('0x38')];if(!_0x4f2c8d[_0x1c96('0x32')][_0x1c96('0x39')](_0x1c96('0x57'))){_0x1abcfd[_0x1c96('0x1f')]=qs['limit'](_0x4f2c8d[_0x1c96('0x32')][_0x1c96('0x1f')]);_0x1abcfd[_0x1c96('0x1e')]=qs[_0x1c96('0x1e')](_0x4f2c8d['query']['offset']);}return _0x10cbe2[_0x1c96('0x5f')](_0x1abcfd);}})[_0x1c96('0x26')](function(_0x376743){if(_0x376743){return _0x376743?{'count':_0x21cd74,'rows':_0x376743}:null;}})[_0x1c96('0x26')](respondWithResult(_0x1abafd,null))['catch'](handleError(_0x1abafd,null));};exports[_0x1c96('0x60')]=function(_0x378d5f,_0x4d936e,_0xfd0663){var _0x1381f9,_0x80f4a8;var _0x1839a8=[];var _0x52a826=moment()[_0x1c96('0x61')](_0x1c96('0x62'));return db[_0x1c96('0x41')][_0x1c96('0x49')]({'where':{'id':_0x378d5f[_0x1c96('0x50')]['id']}})['then'](handleEntityNotFound(_0x4d936e,null))[_0x1c96('0x26')](function(_0xff5297){if(_0xff5297){_0x80f4a8=_0xff5297;return _0xff5297[_0x1c96('0x60')](_0x378d5f['body']['ids'],_[_0x1c96('0x51')](_0x378d5f['body'],[_0x1c96('0x63'),'id'])||{});}return null;})[_0x1c96('0x64')](function(_0x31e461){var _0x576023;var _0x5e83b0;_0x1381f9=_0x31e461||[];var _0x4d06d5=[];if(_0x31e461){for(var _0x1f72cb=0x0;_0x1f72cb<_0x31e461[_0x1c96('0x38')];_0x1f72cb+=0x1){var _0x4f77b1=_0x31e461[_0x1f72cb][_0x1c96('0x4c')]({'plain':!![]});_0x80f4a8['dialCheckDuplicateType']=_0x378d5f[_0x1c96('0x52')]['dialCheckDuplicateType']?_0x378d5f[_0x1c96('0x52')][_0x1c96('0x65')]:_0x80f4a8[_0x1c96('0x65')];switch(_0x80f4a8[_0x1c96('0x65')]){case _0x1c96('0x66'):_0x576023=squel['insert']()[_0x1c96('0x67')]('cm_hopper')[_0x1c96('0x68')]([_0x1c96('0x69'),_0x1c96('0x6a'),_0x1c96('0x6b'),_0x1c96('0x6c'),_0x1c96('0x58'),_0x1c96('0x6d'),'updatedAt'],squel['select']()[_0x1c96('0x6e')](_0x1c96('0x69'),_0x1c96('0x69'))['field'](_0x1c96('0x6f'),_0x1c96('0x6a'))[_0x1c96('0x6e')]('id',_0x1c96('0x6b'))['field'](_0x4f77b1[_0x1c96('0x70')][_0x1c96('0x71')](),'ListId')[_0x1c96('0x6e')](_0x378d5f[_0x1c96('0x50')]['id'][_0x1c96('0x71')](),_0x1c96('0x58'))[_0x1c96('0x6e')]('\x27'+_0x52a826+'\x27',_0x1c96('0x6d'))[_0x1c96('0x6e')]('\x27'+_0x52a826+'\x27',_0x1c96('0x72'))[_0x1c96('0x73')](_0x1c96('0x74'))[_0x1c96('0x3b')](_0x1c96('0x75'))[_0x1c96('0x3b')](_0x1c96('0x76'),_0x4f77b1[_0x1c96('0x70')][_0x1c96('0x71')]())[_0x1c96('0x3b')](_0x1c96('0x77'))[_0x1c96('0x3b')](_0x1c96('0x78'),squel[_0x1c96('0x79')]()['field'](_0x1c96('0x7a'))[_0x1c96('0x73')](_0x1c96('0x7b'))[_0x1c96('0x3b')]('CampaignId\x20=\x20?',_0x378d5f['params']['id'][_0x1c96('0x71')]()))['where'](_0x1c96('0x78'),squel[_0x1c96('0x79')]()[_0x1c96('0x6e')](_0x1c96('0x7c'))[_0x1c96('0x73')](_0x1c96('0x7d'))[_0x1c96('0x3b')](_0x1c96('0x7e'),_0x378d5f[_0x1c96('0x50')]['id'][_0x1c96('0x71')]())))[_0x1c96('0x71')]();break;case _0x1c96('0x7f'):_0x576023=squel[_0x1c96('0x80')]()[_0x1c96('0x67')]('cm_hopper')[_0x1c96('0x68')]([_0x1c96('0x69'),_0x1c96('0x6a'),'ContactId',_0x1c96('0x6c'),'CampaignId',_0x1c96('0x6d'),_0x1c96('0x72')],squel[_0x1c96('0x79')]()['field'](_0x1c96('0x69'),'phone')[_0x1c96('0x6e')](_0x1c96('0x6f'),'scheduledAt')[_0x1c96('0x6e')]('id',_0x1c96('0x6b'))[_0x1c96('0x6e')](_0x4f77b1[_0x1c96('0x70')]['toString'](),'ListId')[_0x1c96('0x6e')](_0x378d5f['params']['id'][_0x1c96('0x71')](),_0x1c96('0x58'))[_0x1c96('0x6e')]('\x27'+_0x52a826+'\x27','createdAt')[_0x1c96('0x6e')]('\x27'+_0x52a826+'\x27',_0x1c96('0x72'))[_0x1c96('0x73')](_0x1c96('0x74'))[_0x1c96('0x3b')](_0x1c96('0x75'))[_0x1c96('0x3b')](_0x1c96('0x76'),_0x4f77b1[_0x1c96('0x70')][_0x1c96('0x71')]())[_0x1c96('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x1c96('0x3b')](_0x1c96('0x78'),squel[_0x1c96('0x79')]()[_0x1c96('0x6e')](_0x1c96('0x7c'))[_0x1c96('0x73')](_0x1c96('0x7d'))['where'](_0x1c96('0x7e'),_0x378d5f['params']['id'][_0x1c96('0x71')]())))[_0x1c96('0x71')]();break;default:_0x576023=squel[_0x1c96('0x80')]()[_0x1c96('0x67')](_0x1c96('0x7d'))[_0x1c96('0x68')]([_0x1c96('0x69'),_0x1c96('0x6a'),_0x1c96('0x6b'),_0x1c96('0x6c'),'CampaignId',_0x1c96('0x6d'),'updatedAt'],squel[_0x1c96('0x79')]()[_0x1c96('0x6e')](_0x1c96('0x69'),_0x1c96('0x69'))[_0x1c96('0x6e')]('NOW()',_0x1c96('0x6a'))[_0x1c96('0x6e')]('id',_0x1c96('0x6b'))[_0x1c96('0x6e')](_0x4f77b1[_0x1c96('0x70')][_0x1c96('0x71')](),'ListId')[_0x1c96('0x6e')](_0x378d5f[_0x1c96('0x50')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x52a826+'\x27','createdAt')['field']('\x27'+_0x52a826+'\x27',_0x1c96('0x72'))[_0x1c96('0x73')]('cm_contacts')['where'](_0x1c96('0x75'))[_0x1c96('0x3b')]('ListId\x20=\x20?',_0x4f77b1[_0x1c96('0x70')][_0x1c96('0x71')]())[_0x1c96('0x3b')](_0x1c96('0x77')))[_0x1c96('0x71')]();}_0x5e83b0=squel[_0x1c96('0x80')]()[_0x1c96('0x67')]('cm_hopper_additional_phones')[_0x1c96('0x68')]([_0x1c96('0x81'),'scheduledAt',_0x1c96('0x69'),_0x1c96('0x82'),_0x1c96('0x6d'),_0x1c96('0x72')],squel['select']()[_0x1c96('0x6e')](_0x1c96('0x83'),'id')[_0x1c96('0x6e')]('NOW()',_0x1c96('0x6a'))[_0x1c96('0x6e')](_0x1c96('0x84'),_0x1c96('0x69'))[_0x1c96('0x6e')](_0x1c96('0x85'),_0x1c96('0x82'))[_0x1c96('0x6e')]('\x27'+_0x52a826+'\x27',_0x1c96('0x6d'))['field']('\x27'+_0x52a826+'\x27',_0x1c96('0x72'))['from'](_0x1c96('0x86'),'ci')['join'](_0x1c96('0x7d'),'h',_0x1c96('0x87'))[_0x1c96('0x3b')](_0x1c96('0x88'),_0x4f77b1[_0x1c96('0x70')]['toString']())['where'](_0x1c96('0x89'),_0x378d5f['params']['id'][_0x1c96('0x71')]())[_0x1c96('0x3b')](_0x1c96('0x8a'),_0x52a826))[_0x1c96('0x71')]();_0x4d06d5[_0x1c96('0x8b')](db[_0x1c96('0x8c')][_0x1c96('0x32')](_0x576023));_0x1839a8[_0x1c96('0x8b')](db[_0x1c96('0x8c')][_0x1c96('0x32')](_0x5e83b0));}return BPromise['all'](_0x4d06d5);}})[_0x1c96('0x26')](function(){return BPromise[_0x1c96('0x8d')](_0x1839a8);})[_0x1c96('0x26')](function(){return _0x1381f9;})['then'](respondWithResult(_0x4d936e,null))['catch'](handleError(_0x4d936e,null));};exports['removeLists']=function(_0x39c2a5,_0x320800,_0x4090ea){return db[_0x1c96('0x41')][_0x1c96('0x49')]({'where':{'id':_0x39c2a5['params']['id']}})[_0x1c96('0x26')](handleEntityNotFound(_0x320800,null))[_0x1c96('0x26')](function(_0xd8ba06){if(_0xd8ba06){return _0xd8ba06[_0x1c96('0x8e')](_0x39c2a5[_0x1c96('0x32')][_0x1c96('0x63')]);}})[_0x1c96('0x26')](function(_0x6cc01e){if(_0x6cc01e){return db[_0x1c96('0x59')][_0x1c96('0x27')]({'where':{'ListId':_0x39c2a5['query'][_0x1c96('0x63')],'CampaignId':_0x39c2a5[_0x1c96('0x50')]['id']}})[_0x1c96('0x26')](function(){return _0x6cc01e;});}})['then'](respondWithStatusCode(_0x320800,null))[_0x1c96('0x46')](handleError(_0x320800,null));};exports[_0x1c96('0x8f')]=function(_0x5677bf,_0x4fda52,_0x39e479){var _0x15e216={};var _0x29a40c={};var _0x1ae4dc;var _0x1a8cf2;return db[_0x1c96('0x41')][_0x1c96('0x56')]({'where':{'id':_0x5677bf[_0x1c96('0x50')]['id']}})[_0x1c96('0x26')](handleEntityNotFound(_0x4fda52,null))['then'](function(_0x1bdca2){if(_0x1bdca2){_0x1ae4dc=_0x1bdca2;_0x29a40c[_0x1c96('0x31')]=_['keys'](db[_0x1c96('0x90')][_0x1c96('0x48')]);_0x29a40c[_0x1c96('0x32')]=_['keys'](_0x5677bf[_0x1c96('0x32')]);_0x29a40c[_0x1c96('0x34')]=_['intersection'](_0x29a40c[_0x1c96('0x31')],_0x29a40c[_0x1c96('0x32')]);_0x15e216[_0x1c96('0x36')]=_[_0x1c96('0x35')](_0x29a40c['model'],qs[_0x1c96('0x37')](_0x5677bf[_0x1c96('0x32')][_0x1c96('0x37')]));_0x15e216['attributes']=_0x15e216[_0x1c96('0x36')]['length']?_0x15e216[_0x1c96('0x36')]:_0x29a40c['model'];_0x15e216[_0x1c96('0x5c')]=qs[_0x1c96('0x3a')](_0x5677bf[_0x1c96('0x32')][_0x1c96('0x3a')]);_0x15e216['where']=qs[_0x1c96('0x34')](_[_0x1c96('0x3c')](_0x5677bf[_0x1c96('0x32')],_0x29a40c[_0x1c96('0x34')]));if(_0x5677bf['query'][_0x1c96('0x3d')]){_0x15e216[_0x1c96('0x3b')]=_[_0x1c96('0x3f')](_0x15e216['where'],{'$or':_[_0x1c96('0x2d')](_0x15e216[_0x1c96('0x36')],function(_0x2e68db){var _0x4184ee={};_0x4184ee[_0x2e68db]={'$like':'%'+_0x5677bf[_0x1c96('0x32')][_0x1c96('0x3d')]+'%'};return _0x4184ee;})});}_0x15e216=_[_0x1c96('0x3f')]({},_0x15e216,_0x5677bf['options']);return _0x1ae4dc[_0x1c96('0x8f')](_0x15e216);}})[_0x1c96('0x26')](function(_0x501066){if(_0x501066){_0x1a8cf2=_0x501066['length'];if(!_0x5677bf[_0x1c96('0x32')][_0x1c96('0x39')](_0x1c96('0x57'))){_0x15e216[_0x1c96('0x1f')]=qs['limit'](_0x5677bf['query'][_0x1c96('0x1f')]);_0x15e216[_0x1c96('0x1e')]=qs[_0x1c96('0x1e')](_0x5677bf[_0x1c96('0x32')]['offset']);}return _0x1ae4dc[_0x1c96('0x8f')](_0x15e216);}})[_0x1c96('0x26')](function(_0x4b5c0b){if(_0x4b5c0b){return _0x4b5c0b?{'count':_0x1a8cf2,'rows':_0x4b5c0b}:null;}})[_0x1c96('0x26')](respondWithResult(_0x4fda52,null))[_0x1c96('0x46')](handleError(_0x4fda52,null));};exports[_0x1c96('0x91')]=function(_0x316278,_0x47bbbc,_0x543c97){var _0x45430e,_0x2f1983;var _0x19c711=[];var _0x2b916a=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x1c96('0x49')]({'where':{'id':_0x316278[_0x1c96('0x50')]['id']}})[_0x1c96('0x26')](handleEntityNotFound(_0x47bbbc,null))['then'](function(_0x5380c9){if(_0x5380c9){_0x2f1983=_0x5380c9;return _0x5380c9[_0x1c96('0x91')](_0x316278[_0x1c96('0x52')][_0x1c96('0x63')],_[_0x1c96('0x51')](_0x316278[_0x1c96('0x52')],['ids','id'])||{});}return null;})[_0x1c96('0x64')](function(_0x59174e){var _0x106935;var _0x1edc72;_0x45430e=_0x59174e||[];var _0xffa6d3=[];if(_0x59174e){for(var _0x1c97f8=0x0;_0x1c97f8<_0x59174e[_0x1c96('0x38')];_0x1c97f8+=0x1){var _0x1f89a3=_0x59174e[_0x1c97f8][_0x1c96('0x4c')]({'plain':!![]});_0x106935=squel['insert']()[_0x1c96('0x67')]('cm_hopper_black')['fromQuery']([_0x1c96('0x69'),'ContactId',_0x1c96('0x6c'),_0x1c96('0x58'),_0x1c96('0x6d'),_0x1c96('0x72')],squel[_0x1c96('0x79')]()[_0x1c96('0x6e')]('phone','phone')[_0x1c96('0x6e')]('id',_0x1c96('0x6b'))[_0x1c96('0x6e')](_0x1f89a3['CmListId'][_0x1c96('0x71')](),_0x1c96('0x6c'))[_0x1c96('0x6e')](_0x316278[_0x1c96('0x50')]['id'][_0x1c96('0x71')](),_0x1c96('0x58'))[_0x1c96('0x6e')](_0x1c96('0x6f'),'createdAt')[_0x1c96('0x6e')](_0x1c96('0x6f'),_0x1c96('0x72'))[_0x1c96('0x73')]('cm_contacts')[_0x1c96('0x3b')](_0x1c96('0x75'))[_0x1c96('0x3b')](_0x1c96('0x76'),_0x1f89a3[_0x1c96('0x70')][_0x1c96('0x71')]())[_0x1c96('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x1c96('0x71')]();_0xffa6d3['push'](db[_0x1c96('0x8c')][_0x1c96('0x32')](_0x106935));}return BPromise['all'](_0xffa6d3);}})[_0x1c96('0x26')](function(){return _0x45430e;})[_0x1c96('0x26')](respondWithResult(_0x47bbbc,null))[_0x1c96('0x46')](handleError(_0x47bbbc,null));};exports[_0x1c96('0x92')]=function(_0x15e4d2,_0x10f35d,_0x431503){return db[_0x1c96('0x41')][_0x1c96('0x49')]({'where':{'id':_0x15e4d2[_0x1c96('0x50')]['id']}})[_0x1c96('0x26')](handleEntityNotFound(_0x10f35d,null))[_0x1c96('0x26')](function(_0x1d6e57){if(_0x1d6e57){return _0x1d6e57[_0x1c96('0x92')](_0x15e4d2[_0x1c96('0x32')][_0x1c96('0x63')]);}})[_0x1c96('0x26')](function(_0x3d0538){if(_0x3d0538){return db['CmHopperBlack'][_0x1c96('0x27')]({'where':{'ListId':_0x15e4d2[_0x1c96('0x32')][_0x1c96('0x63')],'CampaignId':_0x15e4d2['params']['id']}})[_0x1c96('0x26')](function(){return _0x3d0538;});}})[_0x1c96('0x26')](respondWithStatusCode(_0x10f35d,null))[_0x1c96('0x46')](handleError(_0x10f35d,null));}; \ No newline at end of file +var _0xfbe2=['h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','limit','undefined','count','offset','set','Content-Range','json','apply','reject','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','Campaign','rawAttributes','key','map','query','keys','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','createdAt','omit','updatedAt','UserProfileSection','update','getHoppers','findOne','CmHopper','pick','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','phone','toString','ListId','from','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','NOW()','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xfbe2,0x1da));var _0x2fbe=function(_0xec1618,_0xd97de8){_0xec1618=_0xec1618-0x0;var _0x4aad57=_0xfbe2[_0xec1618];return _0x4aad57;};'use strict';var emlformat=require(_0x2fbe('0x0'));var rimraf=require(_0x2fbe('0x1'));var zipdir=require(_0x2fbe('0x2'));var jsonpatch=require(_0x2fbe('0x3'));var rp=require('request-promise');var moment=require(_0x2fbe('0x4'));var BPromise=require(_0x2fbe('0x5'));var Mustache=require(_0x2fbe('0x6'));var util=require('util');var path=require(_0x2fbe('0x7'));var sox=require(_0x2fbe('0x8'));var csv=require(_0x2fbe('0x9'));var ejs=require(_0x2fbe('0xa'));var fs=require('fs');var fs_extra=require(_0x2fbe('0xb'));var _=require(_0x2fbe('0xc'));var squel=require(_0x2fbe('0xd'));var crypto=require(_0x2fbe('0xe'));var jsforce=require(_0x2fbe('0xf'));var deskjs=require(_0x2fbe('0x10'));var toCsv=require(_0x2fbe('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2fbe('0x11'));var authService=require(_0x2fbe('0x12'));var qs=require(_0x2fbe('0x13'));var as=require(_0x2fbe('0x14'));var hardwareService=require(_0x2fbe('0x15'));var logger=require(_0x2fbe('0x16'))(_0x2fbe('0x17'));var utils=require(_0x2fbe('0x18'));var config=require(_0x2fbe('0x19'));var licenseUtil=require(_0x2fbe('0x1a'));var db=require(_0x2fbe('0x1b'))['db'];function respondWithStatusCode(_0x19dd72,_0x421387){_0x421387=_0x421387||0xcc;return function(_0x12be84){if(_0x12be84){return _0x19dd72['sendStatus'](_0x421387);}return _0x19dd72[_0x2fbe('0x1c')](_0x421387)[_0x2fbe('0x1d')]();};}function respondWithResult(_0xfd78c7,_0x2dcfbb){_0x2dcfbb=_0x2dcfbb||0xc8;return function(_0x19777a){if(_0x19777a){return _0xfd78c7[_0x2fbe('0x1c')](_0x2dcfbb)['json'](_0x19777a);}};}function respondWithFilteredResult(_0x40a968,_0x312970){return function(_0x556a98){if(_0x556a98){var _0x19d8fd=typeof _0x312970['offset']==='undefined'&&typeof _0x312970[_0x2fbe('0x1e')]===_0x2fbe('0x1f');var _0x2df01f=_0x556a98[_0x2fbe('0x20')];var _0xdce174=_0x19d8fd?0x0:_0x312970[_0x2fbe('0x21')];var _0x5dcb09=_0x19d8fd?_0x556a98[_0x2fbe('0x20')]:_0x312970[_0x2fbe('0x21')]+_0x312970[_0x2fbe('0x1e')];var _0x258f10;if(_0x5dcb09>=_0x2df01f){_0x5dcb09=_0x2df01f;_0x258f10=0xc8;}else{_0x258f10=0xce;}_0x40a968['status'](_0x258f10);return _0x40a968[_0x2fbe('0x22')](_0x2fbe('0x23'),_0xdce174+'-'+_0x5dcb09+'/'+_0x2df01f)[_0x2fbe('0x24')](_0x556a98);}return null;};}function patchUpdates(_0x4f5b93){return function(_0x4c8f8f){try{jsonpatch[_0x2fbe('0x25')](_0x4c8f8f,_0x4f5b93,!![]);}catch(_0x1620ae){return BPromise[_0x2fbe('0x26')](_0x1620ae);}return _0x4c8f8f['save']();};}function saveUpdates(_0x227ca2,_0x1e3462){return function(_0x30e978){if(_0x30e978){return _0x30e978['update'](_0x227ca2)[_0x2fbe('0x27')](function(_0x1b1f5b){return _0x1b1f5b;});}return null;};}function removeEntity(_0x5c1315,_0x41f262){return function(_0x5ba00e){if(_0x5ba00e){return _0x5ba00e[_0x2fbe('0x28')]()[_0x2fbe('0x27')](function(){var _0x2b17c7=_0x5ba00e[_0x2fbe('0x29')]({'plain':!![]});var _0x5a93a6='IvrCampaigns';return db[_0x2fbe('0x2a')][_0x2fbe('0x28')]({'where':{'type':_0x5a93a6,'resourceId':_0x2b17c7['id']}})[_0x2fbe('0x27')](function(){return _0x5ba00e;});})[_0x2fbe('0x27')](function(){_0x5c1315[_0x2fbe('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49231f,_0xc2f521){return function(_0x3da236){if(!_0x3da236){_0x49231f[_0x2fbe('0x2b')](0x194);}return _0x3da236;};}function handleError(_0x37c090,_0x537d4e){_0x537d4e=_0x537d4e||0x1f4;return function(_0x2c954d){logger['error'](_0x2c954d[_0x2fbe('0x2c')]);if(_0x2c954d[_0x2fbe('0x2d')]){delete _0x2c954d[_0x2fbe('0x2d')];}_0x37c090[_0x2fbe('0x1c')](_0x537d4e)[_0x2fbe('0x2e')](_0x2c954d);};}exports[_0x2fbe('0x2f')]=function(_0x3fe655,_0x3b6988){var _0xccf503={},_0xef4fd={},_0x1a6312={'count':0x0,'rows':[]};var _0x280d21=_['map'](db[_0x2fbe('0x30')][_0x2fbe('0x31')],function(_0x41e769){return{'name':_0x41e769['fieldName'],'type':_0x41e769['type'][_0x2fbe('0x32')]};});_0xef4fd['model']=_[_0x2fbe('0x33')](_0x280d21,_0x2fbe('0x2d'));_0xef4fd[_0x2fbe('0x34')]=_[_0x2fbe('0x35')](_0x3fe655[_0x2fbe('0x34')]);_0xef4fd['filters']=_[_0x2fbe('0x36')](_0xef4fd[_0x2fbe('0x37')],_0xef4fd['query']);_0xccf503['attributes']=_['intersection'](_0xef4fd[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x3fe655['query']['fields']));_0xccf503['attributes']=_0xccf503['attributes'][_0x2fbe('0x39')]?_0xccf503[_0x2fbe('0x3a')]:_0xef4fd[_0x2fbe('0x37')];if(!_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0xccf503[_0x2fbe('0x1e')]=qs[_0x2fbe('0x1e')](_0x3fe655[_0x2fbe('0x34')]['limit']);_0xccf503[_0x2fbe('0x21')]=qs[_0x2fbe('0x21')](_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x21')]);}_0xccf503[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x3e')]);_0xccf503['where']=qs[_0x2fbe('0x3f')](_['pick'](_0x3fe655[_0x2fbe('0x34')],_0xef4fd[_0x2fbe('0x3f')]),_0x280d21);if(_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x40')]){_0xccf503[_0x2fbe('0x41')]=_['merge'](_0xccf503[_0x2fbe('0x41')],{'$or':_[_0x2fbe('0x33')](_0x280d21,function(_0x34127d){if(_0x34127d[_0x2fbe('0x42')]!==_0x2fbe('0x43')){var _0x371f87={};_0x371f87[_0x34127d[_0x2fbe('0x2d')]]={'$like':'%'+_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x40')]+'%'};return _0x371f87;}})});}_0xccf503=_['merge']({},_0xccf503,_0x3fe655[_0x2fbe('0x44')]);var _0x380a3b={'where':_0xccf503[_0x2fbe('0x41')]};return db[_0x2fbe('0x30')][_0x2fbe('0x20')](_0x380a3b)[_0x2fbe('0x27')](function(_0x3f9235){_0x1a6312[_0x2fbe('0x20')]=_0x3f9235;if(_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x45')]){_0xccf503['include']=[{'all':!![]}];}return db[_0x2fbe('0x30')][_0x2fbe('0x46')](_0xccf503);})[_0x2fbe('0x27')](function(_0x414c0c){_0x1a6312['rows']=_0x414c0c;return _0x1a6312;})[_0x2fbe('0x27')](respondWithFilteredResult(_0x3b6988,_0xccf503))[_0x2fbe('0x47')](handleError(_0x3b6988,null));};exports[_0x2fbe('0x48')]=function(_0x341635,_0x357edf){var _0x53b788={'raw':![],'where':{'id':_0x341635[_0x2fbe('0x49')]['id']}},_0x1b6829={};_0x1b6829[_0x2fbe('0x37')]=_[_0x2fbe('0x35')](db[_0x2fbe('0x30')][_0x2fbe('0x31')]);_0x1b6829[_0x2fbe('0x34')]=_[_0x2fbe('0x35')](_0x341635[_0x2fbe('0x34')]);_0x1b6829[_0x2fbe('0x3f')]=_['intersection'](_0x1b6829['model'],_0x1b6829['query']);_0x53b788[_0x2fbe('0x3a')]=_[_0x2fbe('0x36')](_0x1b6829[_0x2fbe('0x37')],qs['fields'](_0x341635['query']['fields']));_0x53b788[_0x2fbe('0x3a')]=_0x53b788[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x53b788[_0x2fbe('0x3a')]:_0x1b6829[_0x2fbe('0x37')];if(_0x341635[_0x2fbe('0x34')][_0x2fbe('0x45')]){_0x53b788[_0x2fbe('0x4a')]=[{'all':!![]}];}_0x53b788=_['merge']({},_0x53b788,_0x341635[_0x2fbe('0x44')]);return db[_0x2fbe('0x30')][_0x2fbe('0x4b')](_0x53b788)[_0x2fbe('0x27')](handleEntityNotFound(_0x357edf,null))['then'](respondWithResult(_0x357edf,null))[_0x2fbe('0x47')](handleError(_0x357edf,null));};exports[_0x2fbe('0x4c')]=function(_0x47bccc,_0x4a213c){return db[_0x2fbe('0x30')]['create'](_0x47bccc[_0x2fbe('0x4d')],{})[_0x2fbe('0x27')](function(_0x55a465){var _0x5da481=_0x47bccc[_0x2fbe('0x4e')][_0x2fbe('0x29')]({'plain':!![]});if(!_0x5da481)throw new Error(_0x2fbe('0x4f'));if(_0x5da481['role']==='user'){var _0x464c48=_0x55a465[_0x2fbe('0x29')]({'plain':!![]});var _0x1dc755=_0x2fbe('0x50');return db['UserProfileSection'][_0x2fbe('0x4b')]({'where':{'name':_0x1dc755,'userProfileId':_0x5da481[_0x2fbe('0x51')]},'raw':!![]})['then'](function(_0x463b25){if(_0x463b25&&_0x463b25[_0x2fbe('0x52')]===0x0){return db[_0x2fbe('0x2a')]['create']({'name':_0x464c48[_0x2fbe('0x2d')],'resourceId':_0x464c48['id'],'type':_0x463b25['name'],'sectionId':_0x463b25['id']},{})[_0x2fbe('0x27')](function(){return _0x55a465;});}else{return _0x55a465;}})[_0x2fbe('0x47')](function(_0x2bdfb0){logger[_0x2fbe('0x53')](_0x2fbe('0x54'),_0x2bdfb0);throw _0x2bdfb0;});}return _0x55a465;})[_0x2fbe('0x27')](respondWithResult(_0x4a213c,0xc9))['catch'](handleError(_0x4a213c,null));};exports[_0x2fbe('0x55')]=function(_0x5d5a5f,_0x354369){var _0x1bf4f5={'where':{'id':_0x5d5a5f[_0x2fbe('0x49')]['id']}},_0x5f07cd={};_0x5f07cd[_0x2fbe('0x37')]=_['keys'](db['Campaign'][_0x2fbe('0x31')]);_0x1bf4f5[_0x2fbe('0x3a')]=_[_0x2fbe('0x36')](_0x5f07cd[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x5d5a5f[_0x2fbe('0x34')]['fields']));_0x1bf4f5['attributes']=_0x1bf4f5['attributes'][_0x2fbe('0x39')]?_0x1bf4f5[_0x2fbe('0x3a')]:_0x5f07cd[_0x2fbe('0x37')];if(_0x5d5a5f[_0x2fbe('0x34')][_0x2fbe('0x45')]){_0x1bf4f5[_0x2fbe('0x4a')]=[{'all':!![]}];}_0x1bf4f5=_[_0x2fbe('0x56')]({},_0x1bf4f5,_0x5d5a5f[_0x2fbe('0x44')]);return db[_0x2fbe('0x30')]['find'](_0x1bf4f5)[_0x2fbe('0x27')](handleEntityNotFound(_0x354369,null))[_0x2fbe('0x27')](function(_0x2b909d){if(_0x2b909d){var _0x2bbc5e=_0x2b909d[_0x2fbe('0x29')]({'plain':!![]});_0x2bbc5e=qs['omit'](_0x2bbc5e,['id',_0x2fbe('0x57'),'updatedAt']);_0x5d5a5f['body']=_[_0x2fbe('0x58')](_0x5d5a5f[_0x2fbe('0x4d')],['id',_0x2fbe('0x57'),_0x2fbe('0x59')]);return db[_0x2fbe('0x30')][_0x2fbe('0x4c')](_[_0x2fbe('0x56')](_0x2bbc5e,_0x5d5a5f[_0x2fbe('0x4d')]),{'include':_0x5d5a5f[_0x2fbe('0x34')][_0x2fbe('0x45')]?[{'all':!![]}]:undefined})[_0x2fbe('0x27')](function(_0x247c68){var _0x3da3d3=_0x5d5a5f[_0x2fbe('0x4e')][_0x2fbe('0x29')]({'plain':!![]});if(!_0x3da3d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3da3d3['role']===_0x2fbe('0x4e')){var _0x538207=_0x247c68[_0x2fbe('0x29')]({'plain':!![]});var _0x13f9e8='IvrCampaigns';return db[_0x2fbe('0x5a')]['find']({'where':{'name':_0x13f9e8,'userProfileId':_0x3da3d3[_0x2fbe('0x51')]},'raw':!![]})[_0x2fbe('0x27')](function(_0x415e76){if(_0x415e76&&_0x415e76[_0x2fbe('0x52')]===0x0){return db[_0x2fbe('0x2a')][_0x2fbe('0x4c')]({'name':_0x538207['name'],'resourceId':_0x538207['id'],'type':_0x415e76['name'],'sectionId':_0x415e76['id']},{})[_0x2fbe('0x27')](function(){return _0x247c68;});}else{return _0x247c68;}})[_0x2fbe('0x47')](function(_0x33a2f9){logger[_0x2fbe('0x53')](_0x2fbe('0x54'),_0x33a2f9);throw _0x33a2f9;});}return _0x247c68;});}})[_0x2fbe('0x27')](respondWithResult(_0x354369,0xc9))['catch'](handleError(_0x354369,null));};exports[_0x2fbe('0x5b')]=function(_0x451626,_0x44c18a){if(_0x451626[_0x2fbe('0x4d')]['id']){delete _0x451626['body']['id'];}return db['Campaign'][_0x2fbe('0x4b')]({'where':{'id':_0x451626['params']['id']}})['then'](handleEntityNotFound(_0x44c18a,null))[_0x2fbe('0x27')](saveUpdates(_0x451626['body'],null))[_0x2fbe('0x27')](respondWithResult(_0x44c18a,null))[_0x2fbe('0x47')](handleError(_0x44c18a,null));};exports['destroy']=function(_0x3be2b0,_0x238717){return db[_0x2fbe('0x30')][_0x2fbe('0x4b')]({'where':{'id':_0x3be2b0[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x238717,null))[_0x2fbe('0x27')](removeEntity(_0x238717,null))[_0x2fbe('0x47')](handleError(_0x238717,null));};exports[_0x2fbe('0x5c')]=function(_0x2928e7,_0x406993,_0x3a61f6){var _0x48d0b3={'raw':!![],'where':{}};var _0x4a4f7d={};var _0x48f2cc={'count':0x0,'rows':[]};return db[_0x2fbe('0x30')][_0x2fbe('0x5d')]({'where':{'id':_0x2928e7[_0x2fbe('0x49')]['id']}})['then'](handleEntityNotFound(_0x406993,null))[_0x2fbe('0x27')](function(_0x2ab4e6){if(_0x2ab4e6){_0x4a4f7d[_0x2fbe('0x37')]=_['keys'](db[_0x2fbe('0x5e')][_0x2fbe('0x31')]);_0x4a4f7d[_0x2fbe('0x34')]=_[_0x2fbe('0x35')](_0x2928e7[_0x2fbe('0x34')]);_0x4a4f7d[_0x2fbe('0x3f')]=_[_0x2fbe('0x36')](_0x4a4f7d[_0x2fbe('0x37')],_0x4a4f7d[_0x2fbe('0x34')]);_0x48d0b3[_0x2fbe('0x3a')]=_[_0x2fbe('0x36')](_0x4a4f7d[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x38')]));_0x48d0b3[_0x2fbe('0x3a')]=_0x48d0b3['attributes']['length']?_0x48d0b3['attributes']:_0x4a4f7d['model'];if(!_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0x48d0b3[_0x2fbe('0x1e')]=qs[_0x2fbe('0x1e')](_0x2928e7['query'][_0x2fbe('0x1e')]);_0x48d0b3[_0x2fbe('0x21')]=qs[_0x2fbe('0x21')](_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x21')]);}_0x48d0b3[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0x2928e7['query'][_0x2fbe('0x3e')]);_0x48d0b3[_0x2fbe('0x41')]=qs['filters'](_[_0x2fbe('0x5f')](_0x2928e7['query'],_0x4a4f7d[_0x2fbe('0x3f')]));_0x48d0b3[_0x2fbe('0x41')][_0x2fbe('0x60')]=_0x2ab4e6['id'];if(_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x40')]){_0x48d0b3[_0x2fbe('0x41')]=_['merge'](_0x48d0b3[_0x2fbe('0x41')],{'$or':_[_0x2fbe('0x33')](_0x48d0b3[_0x2fbe('0x3a')],function(_0x5ea343){var _0x145bb1={};_0x145bb1[_0x5ea343]={'$like':'%'+_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x40')]+'%'};return _0x145bb1;})});}_0x48d0b3=_[_0x2fbe('0x56')]({},_0x48d0b3,_0x2928e7[_0x2fbe('0x44')]);return db[_0x2fbe('0x5e')][_0x2fbe('0x20')]({'where':_0x48d0b3[_0x2fbe('0x41')]})['then'](function(_0x359e19){_0x48f2cc[_0x2fbe('0x20')]=_0x359e19;if(_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x45')]){_0x48d0b3[_0x2fbe('0x4a')]=[{'all':!![]}];}return db[_0x2fbe('0x5e')]['findAll'](_0x48d0b3);})[_0x2fbe('0x27')](function(_0x217bfc){_0x48f2cc[_0x2fbe('0x61')]=_0x217bfc;return _0x48f2cc;});}})[_0x2fbe('0x27')](respondWithFilteredResult(_0x406993,_0x48d0b3))['catch'](handleError(_0x406993,null));};exports[_0x2fbe('0x62')]=function(_0x2b684f,_0x31d544,_0x178468){var _0x13ccef={'raw':!![],'where':{}};var _0x166cb1={};var _0x48eab8={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x2b684f['params']['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x31d544,null))[_0x2fbe('0x27')](function(_0x450b44){if(_0x450b44){_0x166cb1[_0x2fbe('0x37')]=_[_0x2fbe('0x35')](db[_0x2fbe('0x63')][_0x2fbe('0x31')]);_0x166cb1[_0x2fbe('0x34')]=_[_0x2fbe('0x35')](_0x2b684f[_0x2fbe('0x34')]);_0x166cb1[_0x2fbe('0x3f')]=_[_0x2fbe('0x36')](_0x166cb1[_0x2fbe('0x37')],_0x166cb1[_0x2fbe('0x34')]);_0x13ccef[_0x2fbe('0x3a')]=_['intersection'](_0x166cb1[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x2b684f['query'][_0x2fbe('0x38')]));_0x13ccef[_0x2fbe('0x3a')]=_0x13ccef[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x13ccef['attributes']:_0x166cb1['model'];if(!_0x2b684f[_0x2fbe('0x34')]['hasOwnProperty'](_0x2fbe('0x3c'))){_0x13ccef[_0x2fbe('0x1e')]=qs[_0x2fbe('0x1e')](_0x2b684f[_0x2fbe('0x34')]['limit']);_0x13ccef[_0x2fbe('0x21')]=qs['offset'](_0x2b684f[_0x2fbe('0x34')][_0x2fbe('0x21')]);}_0x13ccef['order']=qs['sort'](_0x2b684f[_0x2fbe('0x34')][_0x2fbe('0x3e')]);_0x13ccef[_0x2fbe('0x41')]=qs[_0x2fbe('0x3f')](_[_0x2fbe('0x5f')](_0x2b684f[_0x2fbe('0x34')],_0x166cb1[_0x2fbe('0x3f')]));_0x13ccef[_0x2fbe('0x41')][_0x2fbe('0x60')]=_0x450b44['id'];if(_0x2b684f[_0x2fbe('0x34')]['filter']){_0x13ccef[_0x2fbe('0x41')]=_[_0x2fbe('0x56')](_0x13ccef['where'],{'$or':_[_0x2fbe('0x33')](_0x13ccef[_0x2fbe('0x3a')],function(_0x44da3f){var _0x120256={};_0x120256[_0x44da3f]={'$like':'%'+_0x2b684f[_0x2fbe('0x34')]['filter']+'%'};return _0x120256;})});}_0x13ccef=_['merge']({},_0x13ccef,_0x2b684f[_0x2fbe('0x44')]);return db[_0x2fbe('0x63')]['count']({'where':_0x13ccef[_0x2fbe('0x41')]})['then'](function(_0x15c5d3){_0x48eab8[_0x2fbe('0x20')]=_0x15c5d3;if(_0x2b684f['query'][_0x2fbe('0x45')]){_0x13ccef[_0x2fbe('0x4a')]=[{'all':!![]}];}return db[_0x2fbe('0x63')][_0x2fbe('0x46')](_0x13ccef);})['then'](function(_0x16fa0e){_0x48eab8[_0x2fbe('0x61')]=_0x16fa0e;return _0x48eab8;});}})[_0x2fbe('0x27')](respondWithFilteredResult(_0x31d544,_0x13ccef))[_0x2fbe('0x47')](handleError(_0x31d544,null));};exports[_0x2fbe('0x64')]=function(_0xfac619,_0xb677c6,_0x3cce1b){var _0x49a352={'raw':!![],'where':{}};var _0x1a9758={};var _0x1ce9ec={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xfac619[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0xb677c6,null))[_0x2fbe('0x27')](function(_0x18edec){if(_0x18edec){_0x1a9758[_0x2fbe('0x37')]=_['keys'](db[_0x2fbe('0x65')]['rawAttributes']);_0x1a9758['query']=_[_0x2fbe('0x35')](_0xfac619[_0x2fbe('0x34')]);_0x1a9758[_0x2fbe('0x3f')]=_[_0x2fbe('0x36')](_0x1a9758[_0x2fbe('0x37')],_0x1a9758[_0x2fbe('0x34')]);_0x49a352[_0x2fbe('0x3a')]=_[_0x2fbe('0x36')](_0x1a9758[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0xfac619[_0x2fbe('0x34')][_0x2fbe('0x38')]));_0x49a352['attributes']=_0x49a352[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x49a352[_0x2fbe('0x3a')]:_0x1a9758['model'];if(!_0xfac619['query'][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0x49a352[_0x2fbe('0x1e')]=qs[_0x2fbe('0x1e')](_0xfac619['query'][_0x2fbe('0x1e')]);_0x49a352[_0x2fbe('0x21')]=qs[_0x2fbe('0x21')](_0xfac619['query'][_0x2fbe('0x21')]);}_0x49a352[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0xfac619['query']['sort']);_0x49a352['where']=qs[_0x2fbe('0x3f')](_[_0x2fbe('0x5f')](_0xfac619['query'],_0x1a9758['filters']));_0x49a352['where']['CampaignId']=_0x18edec['id'];if(_0xfac619['query']['filter']){_0x49a352[_0x2fbe('0x41')]=_[_0x2fbe('0x56')](_0x49a352['where'],{'$or':_[_0x2fbe('0x33')](_0x49a352[_0x2fbe('0x3a')],function(_0x383e7f){var _0x34fc88={};_0x34fc88[_0x383e7f]={'$like':'%'+_0xfac619['query'][_0x2fbe('0x40')]+'%'};return _0x34fc88;})});}_0x49a352=_[_0x2fbe('0x56')]({},_0x49a352,_0xfac619[_0x2fbe('0x44')]);return db[_0x2fbe('0x65')][_0x2fbe('0x20')]({'where':_0x49a352[_0x2fbe('0x41')]})['then'](function(_0x5bd0b8){_0x1ce9ec[_0x2fbe('0x20')]=_0x5bd0b8;if(_0xfac619[_0x2fbe('0x34')][_0x2fbe('0x45')]){_0x49a352[_0x2fbe('0x4a')]=[{'all':!![]}];}return db[_0x2fbe('0x65')][_0x2fbe('0x46')](_0x49a352);})[_0x2fbe('0x27')](function(_0x235538){_0x1ce9ec[_0x2fbe('0x61')]=_0x235538;return _0x1ce9ec;});}})[_0x2fbe('0x27')](respondWithFilteredResult(_0xb677c6,_0x49a352))[_0x2fbe('0x47')](handleError(_0xb677c6,null));};exports[_0x2fbe('0x66')]=function(_0x1820ad,_0x107e5e,_0x390e23){var _0x57036a={'raw':!![],'where':{}};var _0x2e5dc2={};var _0x2d078d={'count':0x0,'rows':[]};return db[_0x2fbe('0x30')][_0x2fbe('0x5d')]({'where':{'id':_0x1820ad[_0x2fbe('0x49')]['id']}})['then'](handleEntityNotFound(_0x107e5e,null))[_0x2fbe('0x27')](function(_0x4afad3){if(_0x4afad3){_0x2e5dc2[_0x2fbe('0x37')]=_[_0x2fbe('0x35')](db['CmHopperBlack'][_0x2fbe('0x31')]);_0x2e5dc2[_0x2fbe('0x34')]=_[_0x2fbe('0x35')](_0x1820ad[_0x2fbe('0x34')]);_0x2e5dc2['filters']=_[_0x2fbe('0x36')](_0x2e5dc2[_0x2fbe('0x37')],_0x2e5dc2['query']);_0x57036a[_0x2fbe('0x3a')]=_['intersection'](_0x2e5dc2[_0x2fbe('0x37')],qs['fields'](_0x1820ad[_0x2fbe('0x34')][_0x2fbe('0x38')]));_0x57036a[_0x2fbe('0x3a')]=_0x57036a[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x57036a[_0x2fbe('0x3a')]:_0x2e5dc2[_0x2fbe('0x37')];if(!_0x1820ad[_0x2fbe('0x34')][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0x57036a[_0x2fbe('0x1e')]=qs['limit'](_0x1820ad[_0x2fbe('0x34')][_0x2fbe('0x1e')]);_0x57036a[_0x2fbe('0x21')]=qs[_0x2fbe('0x21')](_0x1820ad[_0x2fbe('0x34')][_0x2fbe('0x21')]);}_0x57036a[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0x1820ad['query'][_0x2fbe('0x3e')]);_0x57036a[_0x2fbe('0x41')]=qs[_0x2fbe('0x3f')](_['pick'](_0x1820ad[_0x2fbe('0x34')],_0x2e5dc2['filters']));_0x57036a[_0x2fbe('0x41')][_0x2fbe('0x60')]=_0x4afad3['id'];if(_0x1820ad[_0x2fbe('0x34')]['filter']){_0x57036a[_0x2fbe('0x41')]=_[_0x2fbe('0x56')](_0x57036a['where'],{'$or':_[_0x2fbe('0x33')](_0x57036a[_0x2fbe('0x3a')],function(_0x1c31cf){var _0x35f033={};_0x35f033[_0x1c31cf]={'$like':'%'+_0x1820ad['query'][_0x2fbe('0x40')]+'%'};return _0x35f033;})});}_0x57036a=_[_0x2fbe('0x56')]({},_0x57036a,_0x1820ad['options']);return db[_0x2fbe('0x67')][_0x2fbe('0x20')]({'where':_0x57036a['where']})[_0x2fbe('0x27')](function(_0x4b8264){_0x2d078d[_0x2fbe('0x20')]=_0x4b8264;if(_0x1820ad[_0x2fbe('0x34')]['includeAll']){_0x57036a[_0x2fbe('0x4a')]=[{'all':!![]}];}return db[_0x2fbe('0x67')][_0x2fbe('0x46')](_0x57036a);})[_0x2fbe('0x27')](function(_0x23f848){_0x2d078d[_0x2fbe('0x61')]=_0x23f848;return _0x2d078d;});}})[_0x2fbe('0x27')](respondWithFilteredResult(_0x107e5e,_0x57036a))[_0x2fbe('0x47')](handleError(_0x107e5e,null));};exports[_0x2fbe('0x68')]=function(_0x18cb00,_0x12c3af,_0x3f76ba){var _0x2f0ad3={};var _0x5c91e5={};var _0x3db637;var _0x48870e;return db[_0x2fbe('0x30')][_0x2fbe('0x5d')]({'where':{'id':_0x18cb00[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x12c3af,null))[_0x2fbe('0x27')](function(_0x489b68){if(_0x489b68){_0x3db637=_0x489b68;_0x5c91e5[_0x2fbe('0x37')]=_[_0x2fbe('0x35')](db[_0x2fbe('0x69')][_0x2fbe('0x31')]);_0x5c91e5['query']=_[_0x2fbe('0x35')](_0x18cb00[_0x2fbe('0x34')]);_0x5c91e5[_0x2fbe('0x3f')]=_[_0x2fbe('0x36')](_0x5c91e5[_0x2fbe('0x37')],_0x5c91e5[_0x2fbe('0x34')]);_0x2f0ad3[_0x2fbe('0x3a')]=_['intersection'](_0x5c91e5[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x18cb00[_0x2fbe('0x34')][_0x2fbe('0x38')]));_0x2f0ad3[_0x2fbe('0x3a')]=_0x2f0ad3[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x2f0ad3['attributes']:_0x5c91e5[_0x2fbe('0x37')];_0x2f0ad3[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0x18cb00[_0x2fbe('0x34')][_0x2fbe('0x3e')]);_0x2f0ad3['where']=qs[_0x2fbe('0x3f')](_[_0x2fbe('0x5f')](_0x18cb00[_0x2fbe('0x34')],_0x5c91e5[_0x2fbe('0x3f')]));if(_0x18cb00[_0x2fbe('0x34')][_0x2fbe('0x40')]){_0x2f0ad3[_0x2fbe('0x41')]=_[_0x2fbe('0x56')](_0x2f0ad3['where'],{'$or':_['map'](_0x2f0ad3[_0x2fbe('0x3a')],function(_0x581469){var _0xfbe1c6={};_0xfbe1c6[_0x581469]={'$like':'%'+_0x18cb00[_0x2fbe('0x34')][_0x2fbe('0x40')]+'%'};return _0xfbe1c6;})});}_0x2f0ad3=_[_0x2fbe('0x56')]({},_0x2f0ad3,_0x18cb00[_0x2fbe('0x44')]);return _0x3db637[_0x2fbe('0x68')](_0x2f0ad3);}})[_0x2fbe('0x27')](function(_0x4d07fa){if(_0x4d07fa){_0x48870e=_0x4d07fa['length'];if(!_0x18cb00['query'][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0x2f0ad3[_0x2fbe('0x1e')]=qs['limit'](_0x18cb00['query'][_0x2fbe('0x1e')]);_0x2f0ad3[_0x2fbe('0x21')]=qs['offset'](_0x18cb00[_0x2fbe('0x34')]['offset']);}return _0x3db637[_0x2fbe('0x68')](_0x2f0ad3);}})['then'](function(_0x54b29){if(_0x54b29){return _0x54b29?{'count':_0x48870e,'rows':_0x54b29}:null;}})[_0x2fbe('0x27')](respondWithResult(_0x12c3af,null))[_0x2fbe('0x47')](handleError(_0x12c3af,null));};exports['addLists']=function(_0x330f1c,_0x70d4ff,_0x59e5dd){var _0x363c0c,_0x49286a;var _0x36baed=[];var _0x110e46=moment()[_0x2fbe('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x2fbe('0x30')][_0x2fbe('0x4b')]({'where':{'id':_0x330f1c[_0x2fbe('0x49')]['id']}})['then'](handleEntityNotFound(_0x70d4ff,null))[_0x2fbe('0x27')](function(_0x5129ef){if(_0x5129ef){_0x49286a=_0x5129ef;return _0x5129ef[_0x2fbe('0x6b')](_0x330f1c[_0x2fbe('0x4d')][_0x2fbe('0x6c')],_[_0x2fbe('0x58')](_0x330f1c[_0x2fbe('0x4d')],[_0x2fbe('0x6c'),'id'])||{});}return null;})[_0x2fbe('0x6d')](function(_0x9b3edb){var _0xa9bef6;var _0x24fa09;_0x363c0c=_0x9b3edb||[];var _0x4e704c=[];if(_0x9b3edb){for(var _0x604c0=0x0;_0x604c0<_0x9b3edb['length'];_0x604c0+=0x1){var _0x48f779=_0x9b3edb[_0x604c0][_0x2fbe('0x29')]({'plain':!![]});_0x49286a[_0x2fbe('0x6e')]=_0x330f1c['body'][_0x2fbe('0x6e')]?_0x330f1c[_0x2fbe('0x4d')][_0x2fbe('0x6e')]:_0x49286a['dialCheckDuplicateType'];switch(_0x49286a[_0x2fbe('0x6e')]){case _0x2fbe('0x6f'):_0xa9bef6=squel[_0x2fbe('0x70')]()[_0x2fbe('0x71')](_0x2fbe('0x72'))[_0x2fbe('0x73')](['phone',_0x2fbe('0x74'),_0x2fbe('0x75'),'ListId',_0x2fbe('0x60'),'createdAt','updatedAt'],squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')]('phone',_0x2fbe('0x78'))[_0x2fbe('0x77')]('NOW()',_0x2fbe('0x74'))[_0x2fbe('0x77')]('id',_0x2fbe('0x75'))[_0x2fbe('0x77')](_0x48f779['CmListId'][_0x2fbe('0x79')](),_0x2fbe('0x7a'))[_0x2fbe('0x77')](_0x330f1c[_0x2fbe('0x49')]['id'][_0x2fbe('0x79')](),_0x2fbe('0x60'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27','createdAt')['field']('\x27'+_0x110e46+'\x27',_0x2fbe('0x59'))[_0x2fbe('0x7b')](_0x2fbe('0x7c'))[_0x2fbe('0x41')]('deletedAt\x20IS\x20NULL')[_0x2fbe('0x41')](_0x2fbe('0x7d'),_0x48f779[_0x2fbe('0x7e')][_0x2fbe('0x79')]())['where'](_0x2fbe('0x7f'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x2fbe('0x76')]()['field'](_0x2fbe('0x80'))['from']('cm_hopper_final')[_0x2fbe('0x41')](_0x2fbe('0x81'),_0x330f1c['params']['id'][_0x2fbe('0x79')]()))[_0x2fbe('0x41')](_0x2fbe('0x82'),squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')](_0x2fbe('0x83'))[_0x2fbe('0x7b')](_0x2fbe('0x72'))[_0x2fbe('0x41')](_0x2fbe('0x81'),_0x330f1c[_0x2fbe('0x49')]['id'][_0x2fbe('0x79')]())))[_0x2fbe('0x79')]();break;case _0x2fbe('0x84'):_0xa9bef6=squel[_0x2fbe('0x70')]()[_0x2fbe('0x71')]('cm_hopper')[_0x2fbe('0x73')]([_0x2fbe('0x78'),'scheduledAt',_0x2fbe('0x75'),_0x2fbe('0x7a'),_0x2fbe('0x60'),_0x2fbe('0x57'),_0x2fbe('0x59')],squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')]('phone','phone')[_0x2fbe('0x77')](_0x2fbe('0x85'),_0x2fbe('0x74'))[_0x2fbe('0x77')]('id','ContactId')['field'](_0x48f779['CmListId'][_0x2fbe('0x79')](),_0x2fbe('0x7a'))['field'](_0x330f1c[_0x2fbe('0x49')]['id'][_0x2fbe('0x79')](),_0x2fbe('0x60'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27','createdAt')[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27',_0x2fbe('0x59'))[_0x2fbe('0x7b')](_0x2fbe('0x7c'))[_0x2fbe('0x41')](_0x2fbe('0x86'))['where'](_0x2fbe('0x7d'),_0x48f779[_0x2fbe('0x7e')][_0x2fbe('0x79')]())[_0x2fbe('0x41')](_0x2fbe('0x7f'))[_0x2fbe('0x41')](_0x2fbe('0x82'),squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')]('COALESCE(phone,\x27\x27)')[_0x2fbe('0x7b')](_0x2fbe('0x72'))[_0x2fbe('0x41')](_0x2fbe('0x81'),_0x330f1c[_0x2fbe('0x49')]['id']['toString']())))[_0x2fbe('0x79')]();break;default:_0xa9bef6=squel[_0x2fbe('0x70')]()[_0x2fbe('0x71')](_0x2fbe('0x72'))[_0x2fbe('0x73')]([_0x2fbe('0x78'),_0x2fbe('0x74'),'ContactId',_0x2fbe('0x7a'),_0x2fbe('0x60'),_0x2fbe('0x57'),_0x2fbe('0x59')],squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')](_0x2fbe('0x78'),_0x2fbe('0x78'))[_0x2fbe('0x77')](_0x2fbe('0x85'),_0x2fbe('0x74'))[_0x2fbe('0x77')]('id',_0x2fbe('0x75'))[_0x2fbe('0x77')](_0x48f779[_0x2fbe('0x7e')][_0x2fbe('0x79')](),'ListId')['field'](_0x330f1c[_0x2fbe('0x49')]['id'][_0x2fbe('0x79')](),_0x2fbe('0x60'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27',_0x2fbe('0x57'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27',_0x2fbe('0x59'))['from'](_0x2fbe('0x7c'))[_0x2fbe('0x41')](_0x2fbe('0x86'))[_0x2fbe('0x41')](_0x2fbe('0x7d'),_0x48f779[_0x2fbe('0x7e')][_0x2fbe('0x79')]())[_0x2fbe('0x41')](_0x2fbe('0x7f')))[_0x2fbe('0x79')]();}_0x24fa09=squel[_0x2fbe('0x70')]()[_0x2fbe('0x71')](_0x2fbe('0x87'))['fromQuery']([_0x2fbe('0x88'),_0x2fbe('0x74'),_0x2fbe('0x78'),_0x2fbe('0x89'),_0x2fbe('0x57'),_0x2fbe('0x59')],squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')](_0x2fbe('0x8a'),'id')['field'](_0x2fbe('0x85'),'scheduledAt')[_0x2fbe('0x77')](_0x2fbe('0x8b'),'phone')['field'](_0x2fbe('0x8c'),_0x2fbe('0x89'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27',_0x2fbe('0x57'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27',_0x2fbe('0x59'))['from'](_0x2fbe('0x8d'),'ci')['join'](_0x2fbe('0x72'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x2fbe('0x41')](_0x2fbe('0x8e'),_0x48f779[_0x2fbe('0x7e')]['toString']())[_0x2fbe('0x41')](_0x2fbe('0x8f'),_0x330f1c[_0x2fbe('0x49')]['id'][_0x2fbe('0x79')]())[_0x2fbe('0x41')](_0x2fbe('0x90'),_0x110e46))[_0x2fbe('0x79')]();_0x4e704c[_0x2fbe('0x91')](db[_0x2fbe('0x92')][_0x2fbe('0x34')](_0xa9bef6));_0x36baed[_0x2fbe('0x91')](db[_0x2fbe('0x92')]['query'](_0x24fa09));}return BPromise['all'](_0x4e704c);}})[_0x2fbe('0x27')](function(){return BPromise[_0x2fbe('0x93')](_0x36baed);})['then'](function(){return _0x363c0c;})[_0x2fbe('0x27')](respondWithResult(_0x70d4ff,null))[_0x2fbe('0x47')](handleError(_0x70d4ff,null));};exports[_0x2fbe('0x94')]=function(_0x201a9a,_0x30436f,_0x20c964){return db['Campaign'][_0x2fbe('0x4b')]({'where':{'id':_0x201a9a[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x30436f,null))[_0x2fbe('0x27')](function(_0x430e2c){if(_0x430e2c){return _0x430e2c[_0x2fbe('0x94')](_0x201a9a[_0x2fbe('0x34')][_0x2fbe('0x6c')]);}})[_0x2fbe('0x27')](function(_0x4b5b61){if(_0x4b5b61){return db[_0x2fbe('0x5e')]['destroy']({'where':{'ListId':_0x201a9a[_0x2fbe('0x34')][_0x2fbe('0x6c')],'CampaignId':_0x201a9a[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](function(){return _0x4b5b61;});}})[_0x2fbe('0x27')](respondWithStatusCode(_0x30436f,null))['catch'](handleError(_0x30436f,null));};exports[_0x2fbe('0x95')]=function(_0x5554de,_0x215056,_0x5cbdab){var _0x3a4431={};var _0x5447cc={};var _0x5db802;var _0x3b30d9;return db[_0x2fbe('0x30')][_0x2fbe('0x5d')]({'where':{'id':_0x5554de[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x215056,null))[_0x2fbe('0x27')](function(_0x25bb48){if(_0x25bb48){_0x5db802=_0x25bb48;_0x5447cc[_0x2fbe('0x37')]=_[_0x2fbe('0x35')](db[_0x2fbe('0x69')][_0x2fbe('0x31')]);_0x5447cc[_0x2fbe('0x34')]=_['keys'](_0x5554de[_0x2fbe('0x34')]);_0x5447cc['filters']=_[_0x2fbe('0x36')](_0x5447cc[_0x2fbe('0x37')],_0x5447cc[_0x2fbe('0x34')]);_0x3a4431[_0x2fbe('0x3a')]=_['intersection'](_0x5447cc[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x38')]));_0x3a4431[_0x2fbe('0x3a')]=_0x3a4431[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x3a4431[_0x2fbe('0x3a')]:_0x5447cc[_0x2fbe('0x37')];_0x3a4431[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0x5554de[_0x2fbe('0x34')]['sort']);_0x3a4431['where']=qs['filters'](_[_0x2fbe('0x5f')](_0x5554de[_0x2fbe('0x34')],_0x5447cc[_0x2fbe('0x3f')]));if(_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x40')]){_0x3a4431[_0x2fbe('0x41')]=_[_0x2fbe('0x56')](_0x3a4431[_0x2fbe('0x41')],{'$or':_[_0x2fbe('0x33')](_0x3a4431[_0x2fbe('0x3a')],function(_0x27fa67){var _0x5086c1={};_0x5086c1[_0x27fa67]={'$like':'%'+_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x40')]+'%'};return _0x5086c1;})});}_0x3a4431=_[_0x2fbe('0x56')]({},_0x3a4431,_0x5554de[_0x2fbe('0x44')]);return _0x5db802[_0x2fbe('0x95')](_0x3a4431);}})[_0x2fbe('0x27')](function(_0x21f1d7){if(_0x21f1d7){_0x3b30d9=_0x21f1d7[_0x2fbe('0x39')];if(!_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0x3a4431[_0x2fbe('0x1e')]=qs[_0x2fbe('0x1e')](_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x1e')]);_0x3a4431['offset']=qs[_0x2fbe('0x21')](_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x21')]);}return _0x5db802[_0x2fbe('0x95')](_0x3a4431);}})['then'](function(_0x566f45){if(_0x566f45){return _0x566f45?{'count':_0x3b30d9,'rows':_0x566f45}:null;}})[_0x2fbe('0x27')](respondWithResult(_0x215056,null))[_0x2fbe('0x47')](handleError(_0x215056,null));};exports[_0x2fbe('0x96')]=function(_0x19275e,_0x527f64,_0x395da3){var _0x34bf2c,_0x53eed9;var _0x68cec0=[];var _0x23f763=moment()['format'](_0x2fbe('0x97'));return db[_0x2fbe('0x30')][_0x2fbe('0x4b')]({'where':{'id':_0x19275e['params']['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x527f64,null))['then'](function(_0x5062e3){if(_0x5062e3){_0x53eed9=_0x5062e3;return _0x5062e3['addBlackLists'](_0x19275e[_0x2fbe('0x4d')][_0x2fbe('0x6c')],_[_0x2fbe('0x58')](_0x19275e[_0x2fbe('0x4d')],[_0x2fbe('0x6c'),'id'])||{});}return null;})[_0x2fbe('0x6d')](function(_0x5b2836){var _0x20cc60;var _0x313a6c;_0x34bf2c=_0x5b2836||[];var _0x3b56ef=[];if(_0x5b2836){for(var _0x346897=0x0;_0x346897<_0x5b2836[_0x2fbe('0x39')];_0x346897+=0x1){var _0x3cfd5f=_0x5b2836[_0x346897][_0x2fbe('0x29')]({'plain':!![]});_0x20cc60=squel[_0x2fbe('0x70')]()[_0x2fbe('0x71')](_0x2fbe('0x98'))[_0x2fbe('0x73')](['phone','ContactId',_0x2fbe('0x7a'),_0x2fbe('0x60'),_0x2fbe('0x57'),_0x2fbe('0x59')],squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')](_0x2fbe('0x78'),_0x2fbe('0x78'))['field']('id',_0x2fbe('0x75'))['field'](_0x3cfd5f[_0x2fbe('0x7e')][_0x2fbe('0x79')](),'ListId')[_0x2fbe('0x77')](_0x19275e['params']['id'][_0x2fbe('0x79')](),_0x2fbe('0x60'))[_0x2fbe('0x77')](_0x2fbe('0x85'),_0x2fbe('0x57'))['field'](_0x2fbe('0x85'),_0x2fbe('0x59'))[_0x2fbe('0x7b')](_0x2fbe('0x7c'))[_0x2fbe('0x41')]('deletedAt\x20IS\x20NULL')[_0x2fbe('0x41')](_0x2fbe('0x7d'),_0x3cfd5f['CmListId'][_0x2fbe('0x79')]())[_0x2fbe('0x41')](_0x2fbe('0x7f')))[_0x2fbe('0x79')]();_0x3b56ef[_0x2fbe('0x91')](db[_0x2fbe('0x92')][_0x2fbe('0x34')](_0x20cc60));}return BPromise[_0x2fbe('0x93')](_0x3b56ef);}})['then'](function(){return _0x34bf2c;})[_0x2fbe('0x27')](respondWithResult(_0x527f64,null))['catch'](handleError(_0x527f64,null));};exports[_0x2fbe('0x99')]=function(_0x4b10e9,_0x5e34e3,_0x1648f9){return db[_0x2fbe('0x30')][_0x2fbe('0x4b')]({'where':{'id':_0x4b10e9[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x5e34e3,null))[_0x2fbe('0x27')](function(_0x46a67b){if(_0x46a67b){return _0x46a67b[_0x2fbe('0x99')](_0x4b10e9[_0x2fbe('0x34')]['ids']);}})[_0x2fbe('0x27')](function(_0x3846a8){if(_0x3846a8){return db[_0x2fbe('0x67')]['destroy']({'where':{'ListId':_0x4b10e9[_0x2fbe('0x34')][_0x2fbe('0x6c')],'CampaignId':_0x4b10e9[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](function(){return _0x3846a8;});}})[_0x2fbe('0x27')](respondWithStatusCode(_0x5e34e3,null))[_0x2fbe('0x47')](handleError(_0x5e34e3,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6beceb0..9cc9813 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(_0xb93732,_0x3ad6b9){var _0x1f1316=function(_0x2a5367){while(--_0x2a5367){_0xb93732['push'](_0xb93732['shift']());}};_0x1f1316(++_0x3ad6b9);}(_0x7a54,0x106));var _0x47a5=function(_0x3d5d75,_0x1ef965){_0x3d5d75=_0x3d5d75-0x0;var _0x18cf09=_0x7a54[_0x3d5d75];return _0x18cf09;};'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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 2a57af7..0abdf09 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 _0x668b=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','findAll','options','raw','attributes','limit','include','model','map'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x668b,0x140));var _0xb668=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0x668b[_0x3cf5a3];return _0x39ba2d;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('Campaign,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});}exports[_0xb668('0x17')]=function(_0x89fe72){var _0x5438ff=this;return new Promise(function(_0x38595d,_0x18e9c1){return db['Campaign'][_0xb668('0x18')]({'raw':_0x89fe72['options']?_0x89fe72[_0xb668('0x19')][_0xb668('0x1a')]===undefined?!![]:![]:!![],'where':_0x89fe72[_0xb668('0x19')]?_0x89fe72[_0xb668('0x19')]['where']||null:null,'attributes':_0x89fe72[_0xb668('0x19')]?_0x89fe72[_0xb668('0x19')][_0xb668('0x1b')]||null:null,'limit':_0x89fe72['options']?_0x89fe72['options'][_0xb668('0x1c')]||null:null,'include':_0x89fe72[_0xb668('0x19')]?_0x89fe72['options'][_0xb668('0x1d')]?_['map'](_0x89fe72[_0xb668('0x19')]['include'],function(_0x3f4745){return{'model':db[_0x3f4745[_0xb668('0x1e')]],'as':_0x3f4745['as'],'attributes':_0x3f4745[_0xb668('0x1b')],'include':_0x3f4745[_0xb668('0x1d')]?_[_0xb668('0x1f')](_0x3f4745[_0xb668('0x1d')],function(_0x4d4bf8){return{'model':db[_0x4d4bf8[_0xb668('0x1e')]],'as':_0x4d4bf8['as'],'attributes':_0x4d4bf8[_0xb668('0x1b')],'include':_0x4d4bf8[_0xb668('0x1d')]?_['map'](_0x4d4bf8['include'],function(_0xe62fce){return{'model':db[_0xe62fce[_0xb668('0x1e')]],'as':_0xe62fce['as'],'attributes':_0xe62fce[_0xb668('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a2543){logger[_0xb668('0xc')](_0xb668('0x17'),_0x89fe72);logger['debug']('GetCampaign',_0x89fe72,JSON[_0xb668('0x11')](_0x3a2543));_0x38595d(_0x3a2543);})[_0xb668('0x16')](function(_0x589c58){logger[_0xb668('0x12')](_0xb668('0x17'),_0x589c58[_0xb668('0x14')],_0x89fe72);_0x18e9c1(_0x5438ff[_0xb668('0x12')](0x1f4,_0x589c58[_0xb668('0x14')]));});});}; \ No newline at end of file +var _0xb575=['jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Campaign','findAll','options','raw','attributes','limit','include','map','model','GetCampaign','debug','stringify','lodash','util','bluebird','../../config/utils','../../config/logger','../../config/environment'];(function(_0x489dd6,_0x2ff564){var _0x22e0ee=function(_0x5110a3){while(--_0x5110a3){_0x489dd6['push'](_0x489dd6['shift']());}};_0x22e0ee(++_0x2ff564);}(_0xb575,0xda));var _0x5b57=function(_0xfb6d53,_0x355c5a){_0xfb6d53=_0xfb6d53-0x0;var _0x32f9e9=_0xb575[_0xfb6d53];return _0x32f9e9;};'use strict';var _=require(_0x5b57('0x0'));var util=require(_0x5b57('0x1'));var moment=require('moment');var BPromise=require(_0x5b57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b57('0x3'));var logger=require(_0x5b57('0x4'))('rpc');var config=require(_0x5b57('0x5'));var jayson=require(_0x5b57('0x6'));var client=jayson[_0x5b57('0x7')][_0x5b57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x672beb,_0x5d223d,_0x4232d0){return new BPromise(function(_0x5dd0c7,_0x2f9789){return client[_0x5b57('0x9')](_0x672beb,_0x4232d0)[_0x5b57('0xa')](function(_0x49ce3a){logger[_0x5b57('0xb')](_0x5b57('0xc'),_0x5d223d,_0x5b57('0xd'));logger['debug'](_0x5b57('0xe'),_0x5d223d,_0x5b57('0xd'),JSON['stringify'](_0x49ce3a));if(_0x49ce3a['error']){if(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x10')]===0x1f4){logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);return _0x2f9789(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);}logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x49ce3a['error'][_0x5b57('0x11')]);return _0x5dd0c7(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);}else{logger['info'](_0x5b57('0xc'),_0x5d223d,_0x5b57('0xd'));_0x5dd0c7(_0x49ce3a[_0x5b57('0x12')][_0x5b57('0x11')]);}})[_0x5b57('0x13')](function(_0x1e7cc0){logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x1e7cc0);_0x2f9789(_0x1e7cc0);});});}exports['GetCampaign']=function(_0x336db6){var _0x1e316f=this;return new Promise(function(_0x2cb809,_0x137899){return db[_0x5b57('0x14')][_0x5b57('0x15')]({'raw':_0x336db6['options']?_0x336db6[_0x5b57('0x16')][_0x5b57('0x17')]===undefined?!![]:![]:!![],'where':_0x336db6[_0x5b57('0x16')]?_0x336db6[_0x5b57('0x16')]['where']||null:null,'attributes':_0x336db6[_0x5b57('0x16')]?_0x336db6[_0x5b57('0x16')][_0x5b57('0x18')]||null:null,'limit':_0x336db6['options']?_0x336db6[_0x5b57('0x16')][_0x5b57('0x19')]||null:null,'include':_0x336db6[_0x5b57('0x16')]?_0x336db6[_0x5b57('0x16')][_0x5b57('0x1a')]?_[_0x5b57('0x1b')](_0x336db6['options'][_0x5b57('0x1a')],function(_0x50ea5f){return{'model':db[_0x50ea5f[_0x5b57('0x1c')]],'as':_0x50ea5f['as'],'attributes':_0x50ea5f[_0x5b57('0x18')],'include':_0x50ea5f['include']?_['map'](_0x50ea5f[_0x5b57('0x1a')],function(_0x5eab3d){return{'model':db[_0x5eab3d[_0x5b57('0x1c')]],'as':_0x5eab3d['as'],'attributes':_0x5eab3d[_0x5b57('0x18')],'include':_0x5eab3d[_0x5b57('0x1a')]?_[_0x5b57('0x1b')](_0x5eab3d[_0x5b57('0x1a')],function(_0x17ac8b){return{'model':db[_0x17ac8b[_0x5b57('0x1c')]],'as':_0x17ac8b['as'],'attributes':_0x17ac8b[_0x5b57('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5b57('0xa')](function(_0x31c4a5){logger[_0x5b57('0xb')](_0x5b57('0x1d'),_0x336db6);logger[_0x5b57('0x1e')](_0x5b57('0x1d'),_0x336db6,JSON[_0x5b57('0x1f')](_0x31c4a5));_0x2cb809(_0x31c4a5);})[_0x5b57('0x13')](function(_0x3e8bc6){logger['error'](_0x5b57('0x1d'),_0x3e8bc6['message'],_0x336db6);_0x137899(_0x1e316f[_0x5b57('0xf')](0x1f4,_0x3e8bc6[_0x5b57('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 13d615f..be146dd 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 _0xb620=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','show','get','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','addLists','addBlackLists','update','/:id','destroy','delete','removeBlackLists'];(function(_0x1ecfa0,_0x10b508){var _0x5716d1=function(_0x29d34e){while(--_0x29d34e){_0x1ecfa0['push'](_0x1ecfa0['shift']());}};_0x5716d1(++_0x10b508);}(_0xb620,0x1a0));var _0x0b62=function(_0x14a075,_0x12e415){_0x14a075=_0x14a075-0x0;var _0x567477=_0xb620[_0x14a075];return _0x567477;};'use strict';var multer=require(_0x0b62('0x0'));var util=require('util');var path=require(_0x0b62('0x1'));var timeout=require(_0x0b62('0x2'));var express=require('express');var router=express[_0x0b62('0x3')]();var fs_extra=require(_0x0b62('0x4'));var auth=require(_0x0b62('0x5'));var interaction=require(_0x0b62('0x6'));var config=require(_0x0b62('0x7'));var controller=require(_0x0b62('0x8'));router['get']('/',auth[_0x0b62('0x9')](),controller[_0x0b62('0xa')]);router['get']('/:id',auth[_0x0b62('0x9')](),controller[_0x0b62('0xb')]);router[_0x0b62('0xc')](_0x0b62('0xd'),auth[_0x0b62('0x9')](),controller['getHoppers']);router[_0x0b62('0xc')](_0x0b62('0xe'),auth[_0x0b62('0x9')](),controller[_0x0b62('0xf')]);router['get'](_0x0b62('0x10'),auth[_0x0b62('0x9')](),controller[_0x0b62('0x11')]);router[_0x0b62('0xc')](_0x0b62('0x12'),auth[_0x0b62('0x9')](),controller[_0x0b62('0x13')]);router[_0x0b62('0xc')](_0x0b62('0x14'),auth[_0x0b62('0x9')](),controller['getLists']);router[_0x0b62('0xc')](_0x0b62('0x15'),auth['isAuthenticated'](),controller[_0x0b62('0x16')]);router[_0x0b62('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0b62('0x17')](_0x0b62('0x18'),auth[_0x0b62('0x9')](),controller['clone']);router[_0x0b62('0x17')](_0x0b62('0x14'),auth['isAuthenticated'](),controller[_0x0b62('0x19')]);router[_0x0b62('0x17')]('/:id/blacklists',auth[_0x0b62('0x9')](),controller[_0x0b62('0x1a')]);router['put']('/:id',auth[_0x0b62('0x9')](),controller[_0x0b62('0x1b')]);router['delete'](_0x0b62('0x1c'),auth['isAuthenticated'](),controller[_0x0b62('0x1d')]);router[_0x0b62('0x1e')](_0x0b62('0x14'),auth[_0x0b62('0x9')](),controller['removeLists']);router[_0x0b62('0x1e')](_0x0b62('0x15'),auth['isAuthenticated'](),controller[_0x0b62('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xa942=['removeBlackLists','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists'];(function(_0x290354,_0x44e8a4){var _0x587db5=function(_0x5185fd){while(--_0x5185fd){_0x290354['push'](_0x290354['shift']());}};_0x587db5(++_0x44e8a4);}(_0xa942,0xc8));var _0x2a94=function(_0x31d9a6,_0x1b1bbd){_0x31d9a6=_0x31d9a6-0x0;var _0x376328=_0xa942[_0x31d9a6];return _0x376328;};'use strict';var multer=require(_0x2a94('0x0'));var util=require(_0x2a94('0x1'));var path=require(_0x2a94('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2a94('0x3')]();var fs_extra=require(_0x2a94('0x4'));var auth=require(_0x2a94('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2a94('0x6'));var controller=require('./campaign.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2a94('0x7')]);router[_0x2a94('0x8')](_0x2a94('0x9'),auth[_0x2a94('0xa')](),controller[_0x2a94('0xb')]);router[_0x2a94('0x8')](_0x2a94('0xc'),auth[_0x2a94('0xa')](),controller[_0x2a94('0xd')]);router[_0x2a94('0x8')](_0x2a94('0xe'),auth[_0x2a94('0xa')](),controller[_0x2a94('0xf')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x2a94('0x10')]);router[_0x2a94('0x8')](_0x2a94('0x11'),auth[_0x2a94('0xa')](),controller['getHopperBlacks']);router[_0x2a94('0x8')](_0x2a94('0x12'),auth[_0x2a94('0xa')](),controller[_0x2a94('0x13')]);router['get'](_0x2a94('0x14'),auth[_0x2a94('0xa')](),controller['getBlackLists']);router['post']('/',auth[_0x2a94('0xa')](),controller['create']);router[_0x2a94('0x15')](_0x2a94('0x16'),auth['isAuthenticated'](),controller[_0x2a94('0x17')]);router[_0x2a94('0x15')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2a94('0x18')]);router[_0x2a94('0x15')](_0x2a94('0x14'),auth[_0x2a94('0xa')](),controller[_0x2a94('0x19')]);router[_0x2a94('0x1a')]('/:id',auth[_0x2a94('0xa')](),controller[_0x2a94('0x1b')]);router[_0x2a94('0x1c')]('/:id',auth[_0x2a94('0xa')](),controller[_0x2a94('0x1d')]);router[_0x2a94('0x1c')](_0x2a94('0x12'),auth[_0x2a94('0xa')](),controller[_0x2a94('0x1e')]);router['delete'](_0x2a94('0x14'),auth[_0x2a94('0xa')](),controller[_0x2a94('0x1f')]);module[_0x2a94('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index b288910..7086e4d 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 _0x2ee6=['STRING','TEXT','medium','VIRTUAL','key'];(function(_0x849d6,_0x56fb89){var _0x2d882d=function(_0x26374e){while(--_0x26374e){_0x849d6['push'](_0x849d6['shift']());}};_0x2d882d(++_0x56fb89);}(_0x2ee6,0xbe));var _0x62ee=function(_0x56179f,_0x8495d6){_0x56179f=_0x56179f-0x0;var _0x56052f=_0x2ee6[_0x56179f];return _0x56052f;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x62ee('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x62ee('0x1')],'length':_0x62ee('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x62ee('0x0')]},'name':{'type':Sequelize[_0x62ee('0x3')],'get':function(){return this['getDataValue'](_0x62ee('0x4'));}}}; \ No newline at end of file +var _0xa04b=['sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue','key'];(function(_0x5980cf,_0x807da8){var _0x110036=function(_0x45c225){while(--_0x45c225){_0x5980cf['push'](_0x5980cf['shift']());}};_0x110036(++_0x807da8);}(_0xa04b,0xc4));var _0xba04=function(_0x2bfb65,_0x3bfe1f){_0x2bfb65=_0x2bfb65-0x0;var _0x3c4250=_0xa04b[_0x2bfb65];return _0x3c4250;};'use strict';var Sequelize=require(_0xba04('0x0'));module[_0xba04('0x1')]={'key':{'type':Sequelize[_0xba04('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xba04('0x3')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0xba04('0x2')]},'name':{'type':Sequelize[_0xba04('0x4')],'get':function(){return this[_0xba04('0x5')](_0xba04('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index e2c1cb8..5d2cc88 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 _0x0635=['fieldName','model','query','keys','filters','attributes','intersection','fields','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','update','body','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','role','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','save','then','destroy','CannedAnswers','end','error','stack','name','send','map','CannedAnswer'];(function(_0x360629,_0x43c97e){var _0x504783=function(_0xf5fb2){while(--_0xf5fb2){_0x360629['push'](_0x360629['shift']());}};_0x504783(++_0x43c97e);}(_0x0635,0xdb));var _0x5063=function(_0x3af91f,_0xbc0a40){_0x3af91f=_0x3af91f-0x0;var _0x30de2a=_0x0635[_0x3af91f];return _0x30de2a;};'use strict';var emlformat=require(_0x5063('0x0'));var rimraf=require(_0x5063('0x1'));var zipdir=require(_0x5063('0x2'));var jsonpatch=require(_0x5063('0x3'));var rp=require(_0x5063('0x4'));var moment=require(_0x5063('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5063('0x6'));var util=require('util');var path=require(_0x5063('0x7'));var sox=require(_0x5063('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5063('0x9'));var _=require(_0x5063('0xa'));var squel=require(_0x5063('0xb'));var crypto=require(_0x5063('0xc'));var jsforce=require(_0x5063('0xd'));var deskjs=require(_0x5063('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5063('0xf'));var Papa=require(_0x5063('0x10'));var Redis=require(_0x5063('0x11'));var authService=require(_0x5063('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5063('0x13'));var hardwareService=require(_0x5063('0x14'));var logger=require('../../config/logger')(_0x5063('0x15'));var utils=require(_0x5063('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5063('0x17'));var db=require(_0x5063('0x18'))['db'];function respondWithStatusCode(_0x52a8bd,_0x13c0b0){_0x13c0b0=_0x13c0b0||0xcc;return function(_0x5b99dd){if(_0x5b99dd){return _0x52a8bd[_0x5063('0x19')](_0x13c0b0);}return _0x52a8bd['status'](_0x13c0b0)['end']();};}function respondWithResult(_0x3e1e69,_0x432d15){_0x432d15=_0x432d15||0xc8;return function(_0x45c341){if(_0x45c341){return _0x3e1e69[_0x5063('0x1a')](_0x432d15)[_0x5063('0x1b')](_0x45c341);}};}function respondWithFilteredResult(_0x56de6d,_0x47ccf6){return function(_0xe2d536){if(_0xe2d536){var _0x2ffc23=typeof _0x47ccf6[_0x5063('0x1c')]==='undefined'&&typeof _0x47ccf6[_0x5063('0x1d')]===_0x5063('0x1e');var _0xfe7623=_0xe2d536['count'];var _0x5676f2=_0x2ffc23?0x0:_0x47ccf6[_0x5063('0x1c')];var _0x1534a0=_0x2ffc23?_0xe2d536['count']:_0x47ccf6[_0x5063('0x1c')]+_0x47ccf6[_0x5063('0x1d')];var _0x503fec;if(_0x1534a0>=_0xfe7623){_0x1534a0=_0xfe7623;_0x503fec=0xc8;}else{_0x503fec=0xce;}_0x56de6d['status'](_0x503fec);return _0x56de6d[_0x5063('0x1f')](_0x5063('0x20'),_0x5676f2+'-'+_0x1534a0+'/'+_0xfe7623)[_0x5063('0x1b')](_0xe2d536);}return null;};}function patchUpdates(_0xa2b777){return function(_0x32b160){try{jsonpatch[_0x5063('0x21')](_0x32b160,_0xa2b777,!![]);}catch(_0x7f7d26){return BPromise['reject'](_0x7f7d26);}return _0x32b160[_0x5063('0x22')]();};}function saveUpdates(_0x1f20f7,_0x50fc8c){return function(_0x7ac899){if(_0x7ac899){return _0x7ac899['update'](_0x1f20f7)[_0x5063('0x23')](function(_0x3b2beb){return _0x3b2beb;});}return null;};}function removeEntity(_0x152008,_0x26a4e8){return function(_0x42fb49){if(_0x42fb49){return _0x42fb49[_0x5063('0x24')]()[_0x5063('0x23')](function(){var _0x561c47=_0x42fb49['get']({'plain':!![]});var _0x1e8b2c=_0x5063('0x25');return db['UserProfileResource'][_0x5063('0x24')]({'where':{'type':_0x1e8b2c,'resourceId':_0x561c47['id']}})['then'](function(){return _0x42fb49;});})[_0x5063('0x23')](function(){_0x152008[_0x5063('0x1a')](0xcc)[_0x5063('0x26')]();});}};}function handleEntityNotFound(_0x5c7ba2,_0x1e51de){return function(_0xdfa728){if(!_0xdfa728){_0x5c7ba2[_0x5063('0x19')](0x194);}return _0xdfa728;};}function handleError(_0x44f86a,_0xa4749f){_0xa4749f=_0xa4749f||0x1f4;return function(_0x135b87){logger[_0x5063('0x27')](_0x135b87[_0x5063('0x28')]);if(_0x135b87[_0x5063('0x29')]){delete _0x135b87[_0x5063('0x29')];}_0x44f86a[_0x5063('0x1a')](_0xa4749f)[_0x5063('0x2a')](_0x135b87);};}exports['index']=function(_0x4b3971,_0x490206){var _0x4da1ac={},_0x45895b={},_0xb13941={'count':0x0,'rows':[]};var _0x4a7a0c=_[_0x5063('0x2b')](db[_0x5063('0x2c')]['rawAttributes'],function(_0xc51d42){return{'name':_0xc51d42[_0x5063('0x2d')],'type':_0xc51d42['type']['key']};});_0x45895b[_0x5063('0x2e')]=_[_0x5063('0x2b')](_0x4a7a0c,'name');_0x45895b[_0x5063('0x2f')]=_[_0x5063('0x30')](_0x4b3971[_0x5063('0x2f')]);_0x45895b[_0x5063('0x31')]=_['intersection'](_0x45895b[_0x5063('0x2e')],_0x45895b[_0x5063('0x2f')]);_0x4da1ac[_0x5063('0x32')]=_[_0x5063('0x33')](_0x45895b[_0x5063('0x2e')],qs[_0x5063('0x34')](_0x4b3971[_0x5063('0x2f')]['fields']));_0x4da1ac[_0x5063('0x32')]=_0x4da1ac['attributes']['length']?_0x4da1ac['attributes']:_0x45895b[_0x5063('0x2e')];if(!_0x4b3971[_0x5063('0x2f')]['hasOwnProperty']('nolimit')){_0x4da1ac[_0x5063('0x1d')]=qs[_0x5063('0x1d')](_0x4b3971['query'][_0x5063('0x1d')]);_0x4da1ac[_0x5063('0x1c')]=qs['offset'](_0x4b3971[_0x5063('0x2f')][_0x5063('0x1c')]);}_0x4da1ac[_0x5063('0x35')]=qs[_0x5063('0x36')](_0x4b3971[_0x5063('0x2f')][_0x5063('0x36')]);_0x4da1ac[_0x5063('0x37')]=qs[_0x5063('0x31')](_[_0x5063('0x38')](_0x4b3971['query'],_0x45895b[_0x5063('0x31')]),_0x4a7a0c);if(_0x4b3971['query']['filter']){_0x4da1ac['where']=_[_0x5063('0x39')](_0x4da1ac[_0x5063('0x37')],{'$or':[{'key':{'$like':'%'+_0x4b3971['query'][_0x5063('0x3a')]+'%'}},{'value':{'$like':'%'+_0x4b3971[_0x5063('0x2f')]['filter']+'%'}}]});}_0x4da1ac=_[_0x5063('0x39')]({},_0x4da1ac,_0x4b3971[_0x5063('0x3b')]);var _0x5bd2f5={'where':_0x4da1ac[_0x5063('0x37')]};return db['CannedAnswer'][_0x5063('0x3c')](_0x5bd2f5)[_0x5063('0x23')](function(_0x373a9f){_0xb13941[_0x5063('0x3c')]=_0x373a9f;if(_0x4b3971['query'][_0x5063('0x3d')]){_0x4da1ac[_0x5063('0x3e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5063('0x3f')](_0x4da1ac);})[_0x5063('0x23')](function(_0x55fdc6){_0xb13941[_0x5063('0x40')]=_0x55fdc6;return _0xb13941;})[_0x5063('0x23')](respondWithFilteredResult(_0x490206,_0x4da1ac))[_0x5063('0x41')](handleError(_0x490206,null));};exports[_0x5063('0x42')]=function(_0x3674a6,_0x3650b0){var _0x2547ad={'raw':!![],'where':{'id':_0x3674a6[_0x5063('0x43')]['id']}},_0x43e767={};_0x43e767['model']=_[_0x5063('0x30')](db[_0x5063('0x2c')][_0x5063('0x44')]);_0x43e767[_0x5063('0x2f')]=_[_0x5063('0x30')](_0x3674a6['query']);_0x43e767['filters']=_[_0x5063('0x33')](_0x43e767[_0x5063('0x2e')],_0x43e767[_0x5063('0x2f')]);_0x2547ad[_0x5063('0x32')]=_[_0x5063('0x33')](_0x43e767[_0x5063('0x2e')],qs[_0x5063('0x34')](_0x3674a6[_0x5063('0x2f')][_0x5063('0x34')]));_0x2547ad[_0x5063('0x32')]=_0x2547ad[_0x5063('0x32')][_0x5063('0x45')]?_0x2547ad[_0x5063('0x32')]:_0x43e767[_0x5063('0x2e')];if(_0x3674a6[_0x5063('0x2f')]['includeAll']){_0x2547ad[_0x5063('0x3e')]=[{'all':!![]}];}_0x2547ad=_[_0x5063('0x39')]({},_0x2547ad,_0x3674a6['options']);return db[_0x5063('0x2c')][_0x5063('0x46')](_0x2547ad)[_0x5063('0x23')](handleEntityNotFound(_0x3650b0,null))[_0x5063('0x23')](respondWithResult(_0x3650b0,null))[_0x5063('0x41')](handleError(_0x3650b0,null));};exports[_0x5063('0x47')]=function(_0x1fc93d,_0x127747){if(_0x1fc93d[_0x5063('0x48')]['id']){delete _0x1fc93d[_0x5063('0x48')]['id'];}return db[_0x5063('0x2c')]['find']({'where':{'id':_0x1fc93d[_0x5063('0x43')]['id']}})[_0x5063('0x23')](handleEntityNotFound(_0x127747,null))['then'](saveUpdates(_0x1fc93d[_0x5063('0x48')],null))[_0x5063('0x23')](respondWithResult(_0x127747,null))['catch'](handleError(_0x127747,null));};exports[_0x5063('0x24')]=function(_0x596bd4,_0x429642){return db['CannedAnswer'][_0x5063('0x46')]({'where':{'id':_0x596bd4[_0x5063('0x43')]['id']}})[_0x5063('0x23')](handleEntityNotFound(_0x429642,null))[_0x5063('0x23')](removeEntity(_0x429642,null))[_0x5063('0x41')](handleError(_0x429642,null));};exports['create']=function(_0x2cbff2,_0x2762c0){var _0x5185d6={'key':_0x2cbff2['body'][_0x5063('0x49')]};if(_0x2cbff2[_0x5063('0x48')]['MailAccountId']){_0x5185d6[_0x5063('0x4a')]=_0x2cbff2[_0x5063('0x48')][_0x5063('0x4a')];}else if(_0x2cbff2['body'][_0x5063('0x4b')]){_0x5185d6[_0x5063('0x4b')]=_0x2cbff2[_0x5063('0x48')][_0x5063('0x4b')];}else if(_0x2cbff2['body']['OpenchannelAccountId']){_0x5185d6['OpenchannelAccountId']=_0x2cbff2[_0x5063('0x48')][_0x5063('0x4c')];}else if(_0x2cbff2['body'][_0x5063('0x4d')]){_0x5185d6[_0x5063('0x4d')]=_0x2cbff2[_0x5063('0x48')][_0x5063('0x4d')];}return db[_0x5063('0x2c')][_0x5063('0x46')]({'where':_0x5185d6})[_0x5063('0x23')](function(_0x58e150){if(_0x58e150){throw new db['Sequelize']['ValidationError'](_0x5063('0x4e'));}return db[_0x5063('0x2c')][_0x5063('0x4f')](_0x2cbff2[_0x5063('0x48')]);})[_0x5063('0x23')](function(_0xdd19c6){var _0xa74cd5=_0x2cbff2['user']['get']({'plain':!![]});if(!_0xa74cd5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa74cd5[_0x5063('0x50')]===_0x5063('0x51')){var _0x49b7d4=_0xdd19c6[_0x5063('0x52')]({'plain':!![]});return db[_0x5063('0x53')][_0x5063('0x46')]({'where':{'name':_0x5063('0x25'),'userProfileId':_0xa74cd5[_0x5063('0x54')]},'raw':!![]})[_0x5063('0x23')](function(_0x3b566a){if(_0x3b566a&&_0x3b566a[_0x5063('0x55')]===0x0){return db[_0x5063('0x56')][_0x5063('0x4f')]({'name':_0x49b7d4['name'],'resourceId':_0x49b7d4['id'],'type':_0x3b566a[_0x5063('0x29')],'sectionId':_0x3b566a['id']},{})['then'](function(){return _0xdd19c6;});}else{return _0xdd19c6;}})[_0x5063('0x41')](function(_0x8b947d){logger[_0x5063('0x27')](_0x5063('0x57'),_0x8b947d);throw _0x8b947d;});}return _0xdd19c6;})[_0x5063('0x23')](respondWithResult(_0x2762c0,0xc9))[_0x5063('0x41')](handleError(_0x2762c0,null));}; \ No newline at end of file +var _0xc5ba=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','CannedAnswers','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x158c34,_0x304597){var _0x5290c8=function(_0xa2170f){while(--_0xa2170f){_0x158c34['push'](_0x158c34['shift']());}};_0x5290c8(++_0x304597);}(_0xc5ba,0x1b2));var _0xac5b=function(_0x2c4570,_0x21871d){_0x2c4570=_0x2c4570-0x0;var _0x26f4b0=_0xc5ba[_0x2c4570];return _0x26f4b0;};'use strict';var emlformat=require(_0xac5b('0x0'));var rimraf=require(_0xac5b('0x1'));var zipdir=require(_0xac5b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xac5b('0x3'));var BPromise=require(_0xac5b('0x4'));var Mustache=require(_0xac5b('0x5'));var util=require(_0xac5b('0x6'));var path=require(_0xac5b('0x7'));var sox=require('sox');var csv=require(_0xac5b('0x8'));var ejs=require(_0xac5b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac5b('0xa'));var squel=require(_0xac5b('0xb'));var crypto=require(_0xac5b('0xc'));var jsforce=require(_0xac5b('0xd'));var deskjs=require(_0xac5b('0xe'));var toCsv=require(_0xac5b('0x8'));var querystring=require(_0xac5b('0xf'));var Papa=require('papaparse');var Redis=require(_0xac5b('0x10'));var authService=require(_0xac5b('0x11'));var qs=require(_0xac5b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac5b('0x13'));var logger=require(_0xac5b('0x14'))(_0xac5b('0x15'));var utils=require(_0xac5b('0x16'));var config=require(_0xac5b('0x17'));var licenseUtil=require(_0xac5b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2076c6,_0x27634a){_0x27634a=_0x27634a||0xcc;return function(_0x2fd2d9){if(_0x2fd2d9){return _0x2076c6[_0xac5b('0x19')](_0x27634a);}return _0x2076c6['status'](_0x27634a)[_0xac5b('0x1a')]();};}function respondWithResult(_0x31c56c,_0xcd8537){_0xcd8537=_0xcd8537||0xc8;return function(_0x46addd){if(_0x46addd){return _0x31c56c[_0xac5b('0x1b')](_0xcd8537)[_0xac5b('0x1c')](_0x46addd);}};}function respondWithFilteredResult(_0x5f28dc,_0x20a19b){return function(_0x15f09b){if(_0x15f09b){var _0x2d13d4=typeof _0x20a19b[_0xac5b('0x1d')]==='undefined'&&typeof _0x20a19b['limit']===_0xac5b('0x1e');var _0x7bbf11=_0x15f09b['count'];var _0x37ab9f=_0x2d13d4?0x0:_0x20a19b['offset'];var _0x293ec3=_0x2d13d4?_0x15f09b[_0xac5b('0x1f')]:_0x20a19b[_0xac5b('0x1d')]+_0x20a19b[_0xac5b('0x20')];var _0x3a3500;if(_0x293ec3>=_0x7bbf11){_0x293ec3=_0x7bbf11;_0x3a3500=0xc8;}else{_0x3a3500=0xce;}_0x5f28dc[_0xac5b('0x1b')](_0x3a3500);return _0x5f28dc[_0xac5b('0x21')](_0xac5b('0x22'),_0x37ab9f+'-'+_0x293ec3+'/'+_0x7bbf11)[_0xac5b('0x1c')](_0x15f09b);}return null;};}function patchUpdates(_0x3e6d2d){return function(_0x256d76){try{jsonpatch[_0xac5b('0x23')](_0x256d76,_0x3e6d2d,!![]);}catch(_0xf6cb0d){return BPromise[_0xac5b('0x24')](_0xf6cb0d);}return _0x256d76[_0xac5b('0x25')]();};}function saveUpdates(_0x3e5e67,_0x41f5de){return function(_0x215a28){if(_0x215a28){return _0x215a28[_0xac5b('0x26')](_0x3e5e67)[_0xac5b('0x27')](function(_0x582716){return _0x582716;});}return null;};}function removeEntity(_0x14ac98,_0x3c9e7b){return function(_0x3a6562){if(_0x3a6562){return _0x3a6562[_0xac5b('0x28')]()[_0xac5b('0x27')](function(){var _0xaf03b=_0x3a6562['get']({'plain':!![]});var _0x3810e1=_0xac5b('0x29');return db['UserProfileResource'][_0xac5b('0x28')]({'where':{'type':_0x3810e1,'resourceId':_0xaf03b['id']}})[_0xac5b('0x27')](function(){return _0x3a6562;});})[_0xac5b('0x27')](function(){_0x14ac98[_0xac5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df37c,_0x113432){return function(_0x371be2){if(!_0x371be2){_0x1df37c[_0xac5b('0x19')](0x194);}return _0x371be2;};}function handleError(_0x3d6bf9,_0x25608b){_0x25608b=_0x25608b||0x1f4;return function(_0x3f4c7b){logger[_0xac5b('0x2a')](_0x3f4c7b[_0xac5b('0x2b')]);if(_0x3f4c7b[_0xac5b('0x2c')]){delete _0x3f4c7b[_0xac5b('0x2c')];}_0x3d6bf9[_0xac5b('0x1b')](_0x25608b)[_0xac5b('0x2d')](_0x3f4c7b);};}exports[_0xac5b('0x2e')]=function(_0x5d397f,_0x2f5e34){var _0x56791e={},_0x3f308f={},_0x2cb5d2={'count':0x0,'rows':[]};var _0x19e669=_[_0xac5b('0x2f')](db[_0xac5b('0x30')][_0xac5b('0x31')],function(_0x534316){return{'name':_0x534316[_0xac5b('0x32')],'type':_0x534316['type'][_0xac5b('0x33')]};});_0x3f308f[_0xac5b('0x34')]=_[_0xac5b('0x2f')](_0x19e669,_0xac5b('0x2c'));_0x3f308f[_0xac5b('0x35')]=_[_0xac5b('0x36')](_0x5d397f[_0xac5b('0x35')]);_0x3f308f[_0xac5b('0x37')]=_[_0xac5b('0x38')](_0x3f308f['model'],_0x3f308f['query']);_0x56791e[_0xac5b('0x39')]=_[_0xac5b('0x38')](_0x3f308f[_0xac5b('0x34')],qs[_0xac5b('0x3a')](_0x5d397f[_0xac5b('0x35')][_0xac5b('0x3a')]));_0x56791e[_0xac5b('0x39')]=_0x56791e[_0xac5b('0x39')][_0xac5b('0x3b')]?_0x56791e[_0xac5b('0x39')]:_0x3f308f[_0xac5b('0x34')];if(!_0x5d397f[_0xac5b('0x35')][_0xac5b('0x3c')]('nolimit')){_0x56791e['limit']=qs[_0xac5b('0x20')](_0x5d397f[_0xac5b('0x35')]['limit']);_0x56791e[_0xac5b('0x1d')]=qs[_0xac5b('0x1d')](_0x5d397f[_0xac5b('0x35')][_0xac5b('0x1d')]);}_0x56791e[_0xac5b('0x3d')]=qs[_0xac5b('0x3e')](_0x5d397f[_0xac5b('0x35')][_0xac5b('0x3e')]);_0x56791e[_0xac5b('0x3f')]=qs[_0xac5b('0x37')](_[_0xac5b('0x40')](_0x5d397f[_0xac5b('0x35')],_0x3f308f['filters']),_0x19e669);if(_0x5d397f['query'][_0xac5b('0x41')]){_0x56791e['where']=_['merge'](_0x56791e['where'],{'$or':[{'key':{'$like':'%'+_0x5d397f['query'][_0xac5b('0x41')]+'%'}},{'value':{'$like':'%'+_0x5d397f['query'][_0xac5b('0x41')]+'%'}}]});}_0x56791e=_[_0xac5b('0x42')]({},_0x56791e,_0x5d397f[_0xac5b('0x43')]);var _0x355da3={'where':_0x56791e[_0xac5b('0x3f')]};return db['CannedAnswer'][_0xac5b('0x1f')](_0x355da3)[_0xac5b('0x27')](function(_0x100c02){_0x2cb5d2[_0xac5b('0x1f')]=_0x100c02;if(_0x5d397f[_0xac5b('0x35')][_0xac5b('0x44')]){_0x56791e['include']=[{'all':!![]}];}return db[_0xac5b('0x30')][_0xac5b('0x45')](_0x56791e);})[_0xac5b('0x27')](function(_0x5d2d85){_0x2cb5d2['rows']=_0x5d2d85;return _0x2cb5d2;})[_0xac5b('0x27')](respondWithFilteredResult(_0x2f5e34,_0x56791e))[_0xac5b('0x46')](handleError(_0x2f5e34,null));};exports[_0xac5b('0x47')]=function(_0x50ae71,_0x36fc6b){var _0x1f416d={'raw':!![],'where':{'id':_0x50ae71[_0xac5b('0x48')]['id']}},_0x313477={};_0x313477['model']=_[_0xac5b('0x36')](db[_0xac5b('0x30')]['rawAttributes']);_0x313477[_0xac5b('0x35')]=_[_0xac5b('0x36')](_0x50ae71[_0xac5b('0x35')]);_0x313477[_0xac5b('0x37')]=_['intersection'](_0x313477[_0xac5b('0x34')],_0x313477[_0xac5b('0x35')]);_0x1f416d['attributes']=_[_0xac5b('0x38')](_0x313477[_0xac5b('0x34')],qs[_0xac5b('0x3a')](_0x50ae71[_0xac5b('0x35')]['fields']));_0x1f416d[_0xac5b('0x39')]=_0x1f416d[_0xac5b('0x39')]['length']?_0x1f416d['attributes']:_0x313477['model'];if(_0x50ae71[_0xac5b('0x35')][_0xac5b('0x44')]){_0x1f416d[_0xac5b('0x49')]=[{'all':!![]}];}_0x1f416d=_['merge']({},_0x1f416d,_0x50ae71[_0xac5b('0x43')]);return db[_0xac5b('0x30')][_0xac5b('0x4a')](_0x1f416d)[_0xac5b('0x27')](handleEntityNotFound(_0x36fc6b,null))[_0xac5b('0x27')](respondWithResult(_0x36fc6b,null))[_0xac5b('0x46')](handleError(_0x36fc6b,null));};exports[_0xac5b('0x26')]=function(_0x3c35ab,_0xac5592){if(_0x3c35ab['body']['id']){delete _0x3c35ab['body']['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x3c35ab[_0xac5b('0x48')]['id']}})[_0xac5b('0x27')](handleEntityNotFound(_0xac5592,null))['then'](saveUpdates(_0x3c35ab['body'],null))[_0xac5b('0x27')](respondWithResult(_0xac5592,null))['catch'](handleError(_0xac5592,null));};exports[_0xac5b('0x28')]=function(_0x1a3c71,_0x458ab9){return db['CannedAnswer']['find']({'where':{'id':_0x1a3c71[_0xac5b('0x48')]['id']}})[_0xac5b('0x27')](handleEntityNotFound(_0x458ab9,null))[_0xac5b('0x27')](removeEntity(_0x458ab9,null))[_0xac5b('0x46')](handleError(_0x458ab9,null));};exports[_0xac5b('0x4b')]=function(_0x199d3f,_0x731eb3){var _0x6d762d={'key':_0x199d3f['body'][_0xac5b('0x33')]};if(_0x199d3f[_0xac5b('0x4c')][_0xac5b('0x4d')]){_0x6d762d[_0xac5b('0x4d')]=_0x199d3f[_0xac5b('0x4c')]['MailAccountId'];}else if(_0x199d3f[_0xac5b('0x4c')][_0xac5b('0x4e')]){_0x6d762d[_0xac5b('0x4e')]=_0x199d3f[_0xac5b('0x4c')]['SmsAccountId'];}else if(_0x199d3f['body'][_0xac5b('0x4f')]){_0x6d762d['OpenchannelAccountId']=_0x199d3f[_0xac5b('0x4c')][_0xac5b('0x4f')];}else if(_0x199d3f[_0xac5b('0x4c')]['ChatWebsiteId']){_0x6d762d['ChatWebsiteId']=_0x199d3f[_0xac5b('0x4c')][_0xac5b('0x50')];}return db[_0xac5b('0x30')][_0xac5b('0x4a')]({'where':_0x6d762d})['then'](function(_0x5c0a7f){if(_0x5c0a7f){throw new db[(_0xac5b('0x51'))][(_0xac5b('0x52'))](_0xac5b('0x53'));}return db['CannedAnswer']['create'](_0x199d3f[_0xac5b('0x4c')]);})[_0xac5b('0x27')](function(_0x4cd187){var _0x2751fb=_0x199d3f[_0xac5b('0x54')][_0xac5b('0x55')]({'plain':!![]});if(!_0x2751fb)throw new Error(_0xac5b('0x56'));if(_0x2751fb[_0xac5b('0x57')]==='user'){var _0x57e5a4=_0x4cd187[_0xac5b('0x55')]({'plain':!![]});return db[_0xac5b('0x58')][_0xac5b('0x4a')]({'where':{'name':_0xac5b('0x29'),'userProfileId':_0x2751fb[_0xac5b('0x59')]},'raw':!![]})[_0xac5b('0x27')](function(_0x27e9bb){if(_0x27e9bb&&_0x27e9bb['autoAssociation']===0x0){return db[_0xac5b('0x5a')][_0xac5b('0x4b')]({'name':_0x57e5a4['name'],'resourceId':_0x57e5a4['id'],'type':_0x27e9bb[_0xac5b('0x2c')],'sectionId':_0x27e9bb['id']},{})[_0xac5b('0x27')](function(){return _0x4cd187;});}else{return _0x4cd187;}})['catch'](function(_0x2ac968){logger[_0xac5b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ac968);throw _0x2ac968;});}return _0x4cd187;})['then'](respondWithResult(_0x731eb3,0xc9))[_0xac5b('0x46')](handleError(_0x731eb3,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 85e4e23..8b75575 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 _0x2a99=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1971c9,_0xb2df1){var _0x2a97f1=function(_0x450950){while(--_0x450950){_0x1971c9['push'](_0x1971c9['shift']());}};_0x2a97f1(++_0xb2df1);}(_0x2a99,0x14a));var _0x92a9=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x2a99[_0xc82d1a];return _0x32fad2;};'use strict';var _=require(_0x92a9('0x0'));var util=require(_0x92a9('0x1'));var logger=require(_0x92a9('0x2'))(_0x92a9('0x3'));var moment=require(_0x92a9('0x4'));var BPromise=require(_0x92a9('0x5'));var rp=require(_0x92a9('0x6'));var fs=require('fs');var path=require(_0x92a9('0x7'));var rimraf=require(_0x92a9('0x8'));var config=require(_0x92a9('0x9'));var attributes=require(_0x92a9('0xa'));module['exports']=function(_0xbcf21,_0x286c9b){return _0xbcf21[_0x92a9('0xb')]('CannedAnswer',attributes,{'tableName':_0x92a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x92a9('0xd'),'collate':_0x92a9('0xe')});}; \ No newline at end of file +var _0x880a=['utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x880a,0xe5));var _0xa880=function(_0x119fa6,_0x32a8ae){_0x119fa6=_0x119fa6-0x0;var _0x1e8732=_0x880a[_0x119fa6];return _0x1e8732;};'use strict';var _=require(_0xa880('0x0'));var util=require(_0xa880('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa880('0x2'));var rp=require(_0xa880('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa880('0x4'));var config=require(_0xa880('0x5'));var attributes=require(_0xa880('0x6'));module[_0xa880('0x7')]=function(_0x49a16c,_0x96355a){return _0x49a16c[_0xa880('0x8')]('CannedAnswer',attributes,{'tableName':_0xa880('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa880('0xa'),'collate':_0xa880('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 91f0260..b558a51 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(_0x1ef875,_0xe12abd){var _0x487d89=function(_0x3d6384){while(--_0x3d6384){_0x1ef875['push'](_0x1ef875['shift']());}};_0x487d89(++_0xe12abd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x35997e,_0x1c724e){var _0x2effc4=function(_0x1a6148){while(--_0x1a6148){_0x35997e['push'](_0x35997e['shift']());}};_0x2effc4(++_0x1c724e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index eeadf88..3626c0b 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 _0x1cde=['create','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x1cde,0x1f3));var _0xe1cd=function(_0x4be83f,_0xdbbdf4){_0x4be83f=_0x4be83f-0x0;var _0x2405d0=_0x1cde[_0x4be83f];return _0x2405d0;};'use strict';var multer=require(_0xe1cd('0x0'));var util=require('util');var path=require(_0xe1cd('0x1'));var timeout=require(_0xe1cd('0x2'));var express=require(_0xe1cd('0x3'));var router=express['Router']();var fs_extra=require(_0xe1cd('0x4'));var auth=require(_0xe1cd('0x5'));var interaction=require(_0xe1cd('0x6'));var config=require(_0xe1cd('0x7'));var controller=require('./cannedAnswer.controller');router[_0xe1cd('0x8')]('/',auth[_0xe1cd('0x9')](),controller[_0xe1cd('0xa')]);router[_0xe1cd('0x8')](_0xe1cd('0xb'),auth[_0xe1cd('0x9')](),controller[_0xe1cd('0xc')]);router[_0xe1cd('0xd')]('/',auth['isAuthenticated'](),controller[_0xe1cd('0xe')]);router[_0xe1cd('0xf')](_0xe1cd('0xb'),auth[_0xe1cd('0x9')](),controller[_0xe1cd('0x10')]);router[_0xe1cd('0x11')]('/:id',auth[_0xe1cd('0x9')](),controller['destroy']);module[_0xe1cd('0x12')]=router; \ No newline at end of file +var _0xfdd7=['fs-extra','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','show','post','put','/:id','delete','destroy','exports','multer','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfdd7,0x14d));var _0x7fdd=function(_0x356513,_0x2815b4){_0x356513=_0x356513-0x0;var _0x3e058b=_0xfdd7[_0x356513];return _0x3e058b;};'use strict';var multer=require(_0x7fdd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7fdd('0x1'));var router=express[_0x7fdd('0x2')]();var fs_extra=require(_0x7fdd('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7fdd('0x4'));var config=require('../../config/environment');var controller=require(_0x7fdd('0x5'));router[_0x7fdd('0x6')]('/',auth[_0x7fdd('0x7')](),controller[_0x7fdd('0x8')]);router[_0x7fdd('0x6')]('/:id',auth[_0x7fdd('0x7')](),controller[_0x7fdd('0x9')]);router[_0x7fdd('0xa')]('/',auth[_0x7fdd('0x7')](),controller['create']);router[_0x7fdd('0xb')](_0x7fdd('0xc'),auth[_0x7fdd('0x7')](),controller['update']);router[_0x7fdd('0xd')](_0x7fdd('0xc'),auth[_0x7fdd('0x7')](),controller[_0x7fdd('0xe')]);module[_0x7fdd('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 6081dd3..072bbe5 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 _0x2ce1=['INTEGER','1970-01-01\x2000:00:01','STRING'];(function(_0xd094a6,_0x642a95){var _0x1408d8=function(_0x117d3c){while(--_0x117d3c){_0xd094a6['push'](_0xd094a6['shift']());}};_0x1408d8(++_0x642a95);}(_0x2ce1,0x8b));var _0x12ce=function(_0xed5185,_0xc6ad22){_0xed5185=_0xed5185-0x0;var _0xdced0f=_0x2ce1[_0xed5185];return _0xdced0f;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x12ce('0x0')},'clid':{'type':Sequelize[_0x12ce('0x1')]},'src':{'type':Sequelize[_0x12ce('0x1')]},'dst':{'type':Sequelize[_0x12ce('0x1')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x12ce('0x1')]},'dstchannel':{'type':Sequelize[_0x12ce('0x1')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x12ce('0x1')]},'duration':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x12ce('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x12ce('0x1')]},'uniqueid':{'type':Sequelize[_0x12ce('0x1')]},'linkedid':{'type':Sequelize[_0x12ce('0x1')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x12ce('0x1')]},'type':{'type':Sequelize[_0x12ce('0x1')]},'tag':{'type':Sequelize[_0x12ce('0x1')]}}; \ No newline at end of file +var _0x62f8=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x210ac5,_0x397fd2){var _0x26978b=function(_0x400420){while(--_0x400420){_0x210ac5['push'](_0x210ac5['shift']());}};_0x26978b(++_0x397fd2);}(_0x62f8,0x13a));var _0x862f=function(_0x3496c4,_0x303861){_0x3496c4=_0x3496c4-0x0;var _0x4cf6e0=_0x62f8[_0x3496c4];return _0x4cf6e0;};'use strict';var Sequelize=require('sequelize');module[_0x862f('0x0')]={'calldate':{'type':Sequelize[_0x862f('0x1')],'allowNull':![],'defaultValue':_0x862f('0x2')},'clid':{'type':Sequelize[_0x862f('0x3')]},'src':{'type':Sequelize[_0x862f('0x3')]},'dst':{'type':Sequelize[_0x862f('0x3')]},'dcontext':{'type':Sequelize[_0x862f('0x3')]},'channel':{'type':Sequelize[_0x862f('0x3')]},'dstchannel':{'type':Sequelize[_0x862f('0x3')]},'lastapp':{'type':Sequelize[_0x862f('0x3')]},'lastdata':{'type':Sequelize[_0x862f('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x862f('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x862f('0x3')]},'amaflags':{'type':Sequelize[_0x862f('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x862f('0x3')]},'userfield':{'type':Sequelize[_0x862f('0x3')]},'uniqueid':{'type':Sequelize[_0x862f('0x3')]},'linkedid':{'type':Sequelize[_0x862f('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x862f('0x3')]},'type':{'type':Sequelize[_0x862f('0x3')]},'tag':{'type':Sequelize[_0x862f('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 84b1712..1299690 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 _0x6596=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','name','index','map','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','options','findAll','rows','show','params','length','includeAll','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse'];(function(_0x4e7e31,_0x1e2302){var _0x3d1597=function(_0x4a21bf){while(--_0x4a21bf){_0x4e7e31['push'](_0x4e7e31['shift']());}};_0x3d1597(++_0x1e2302);}(_0x6596,0x1d3));var _0x6659=function(_0x15e355,_0x2760aa){_0x15e355=_0x15e355-0x0;var _0x4200a8=_0x6596[_0x15e355];return _0x4200a8;};'use strict';var emlformat=require(_0x6659('0x0'));var rimraf=require(_0x6659('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6659('0x2'));var rp=require(_0x6659('0x3'));var moment=require(_0x6659('0x4'));var BPromise=require(_0x6659('0x5'));var Mustache=require(_0x6659('0x6'));var util=require(_0x6659('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6659('0x8'));var ejs=require(_0x6659('0x9'));var fs=require('fs');var fs_extra=require(_0x6659('0xa'));var _=require(_0x6659('0xb'));var squel=require(_0x6659('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6659('0xd'));var toCsv=require(_0x6659('0x8'));var querystring=require(_0x6659('0xe'));var Papa=require(_0x6659('0xf'));var Redis=require(_0x6659('0x10'));var authService=require(_0x6659('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6659('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6659('0x13'));var utils=require('../../config/utils');var config=require(_0x6659('0x14'));var licenseUtil=require(_0x6659('0x15'));var db=require(_0x6659('0x16'))['db'];function respondWithStatusCode(_0x438f95,_0x581baa){_0x581baa=_0x581baa||0xcc;return function(_0x3d68c5){if(_0x3d68c5){return _0x438f95[_0x6659('0x17')](_0x581baa);}return _0x438f95['status'](_0x581baa)[_0x6659('0x18')]();};}function respondWithResult(_0x2fd7da,_0x4238a7){_0x4238a7=_0x4238a7||0xc8;return function(_0x346cb6){if(_0x346cb6){return _0x2fd7da[_0x6659('0x19')](_0x4238a7)[_0x6659('0x1a')](_0x346cb6);}};}function respondWithFilteredResult(_0x5b5c16,_0x3246f1){return function(_0x36707c){if(_0x36707c){var _0x1ddce3=typeof _0x3246f1[_0x6659('0x1b')]===_0x6659('0x1c')&&typeof _0x3246f1[_0x6659('0x1d')]==='undefined';var _0x5b7658=_0x36707c[_0x6659('0x1e')];var _0x5e89f1=_0x1ddce3?0x0:_0x3246f1[_0x6659('0x1b')];var _0x38e4d6=_0x1ddce3?_0x36707c['count']:_0x3246f1[_0x6659('0x1b')]+_0x3246f1['limit'];var _0xa5e094;if(_0x38e4d6>=_0x5b7658){_0x38e4d6=_0x5b7658;_0xa5e094=0xc8;}else{_0xa5e094=0xce;}_0x5b5c16[_0x6659('0x19')](_0xa5e094);return _0x5b5c16['set'](_0x6659('0x1f'),_0x5e89f1+'-'+_0x38e4d6+'/'+_0x5b7658)[_0x6659('0x1a')](_0x36707c);}return null;};}function patchUpdates(_0x332d2c){return function(_0x3e139a){try{jsonpatch[_0x6659('0x20')](_0x3e139a,_0x332d2c,!![]);}catch(_0x3e1f83){return BPromise[_0x6659('0x21')](_0x3e1f83);}return _0x3e139a['save']();};}function saveUpdates(_0x2b4cce,_0x3506fd){return function(_0x314e40){if(_0x314e40){return _0x314e40[_0x6659('0x22')](_0x2b4cce)['then'](function(_0x4ce553){return _0x4ce553;});}return null;};}function removeEntity(_0x5a5e04,_0x564357){return function(_0xbad53f){if(_0xbad53f){return _0xbad53f[_0x6659('0x23')]()[_0x6659('0x24')](function(){_0x5a5e04[_0x6659('0x19')](0xcc)[_0x6659('0x18')]();});}};}function handleEntityNotFound(_0x12b218,_0x436691){return function(_0x3cb0dc){if(!_0x3cb0dc){_0x12b218[_0x6659('0x17')](0x194);}return _0x3cb0dc;};}function handleError(_0x5f48d6,_0x187571){_0x187571=_0x187571||0x1f4;return function(_0x373a3d){logger[_0x6659('0x25')](_0x373a3d['stack']);if(_0x373a3d['name']){delete _0x373a3d[_0x6659('0x26')];}_0x5f48d6[_0x6659('0x19')](_0x187571)['send'](_0x373a3d);};}exports[_0x6659('0x27')]=function(_0x2f5a16,_0x36dab5){var _0xcb5a33={},_0x1b721d={},_0x525b57={'count':0x0,'rows':[]};var _0x23ee05=_[_0x6659('0x28')](db[_0x6659('0x29')][_0x6659('0x2a')],function(_0xc9bd6a){return{'name':_0xc9bd6a['fieldName'],'type':_0xc9bd6a[_0x6659('0x2b')][_0x6659('0x2c')]};});_0x1b721d[_0x6659('0x2d')]=_[_0x6659('0x28')](_0x23ee05,_0x6659('0x26'));_0x1b721d[_0x6659('0x2e')]=_[_0x6659('0x2f')](_0x2f5a16['query']);_0x1b721d[_0x6659('0x30')]=_[_0x6659('0x31')](_0x1b721d['model'],_0x1b721d[_0x6659('0x2e')]);_0xcb5a33['attributes']=_[_0x6659('0x31')](_0x1b721d['model'],qs[_0x6659('0x32')](_0x2f5a16[_0x6659('0x2e')]['fields']));_0xcb5a33['attributes']=_0xcb5a33[_0x6659('0x33')]['length']?_0xcb5a33[_0x6659('0x33')]:_0x1b721d['model'];if(!_0x2f5a16[_0x6659('0x2e')]['hasOwnProperty'](_0x6659('0x34'))){_0xcb5a33[_0x6659('0x1d')]=qs['limit'](_0x2f5a16[_0x6659('0x2e')][_0x6659('0x1d')]);_0xcb5a33[_0x6659('0x1b')]=qs[_0x6659('0x1b')](_0x2f5a16[_0x6659('0x2e')]['offset']);}_0xcb5a33[_0x6659('0x35')]=qs['sort'](_0x2f5a16['query'][_0x6659('0x36')]);_0xcb5a33[_0x6659('0x37')]=qs[_0x6659('0x30')](_['pick'](_0x2f5a16[_0x6659('0x2e')],_0x1b721d['filters']),_0x23ee05);if(_0x2f5a16['query'][_0x6659('0x38')]){_0xcb5a33[_0x6659('0x37')]=_[_0x6659('0x39')](_0xcb5a33[_0x6659('0x37')],{'$or':_[_0x6659('0x28')](_0x23ee05,function(_0x90b64e){if(_0x90b64e[_0x6659('0x2b')]!=='VIRTUAL'){var _0x531a19={};_0x531a19[_0x90b64e[_0x6659('0x26')]]={'$like':'%'+_0x2f5a16[_0x6659('0x2e')][_0x6659('0x38')]+'%'};return _0x531a19;}})});}_0xcb5a33=_['merge']({},_0xcb5a33,_0x2f5a16[_0x6659('0x3a')]);var _0x3e4a93={'where':_0xcb5a33['where']};return db[_0x6659('0x29')][_0x6659('0x1e')](_0x3e4a93)[_0x6659('0x24')](function(_0x2924f4){_0x525b57[_0x6659('0x1e')]=_0x2924f4;if(_0x2f5a16['query']['includeAll']){_0xcb5a33['include']=[{'all':!![]}];}return db['Cdr'][_0x6659('0x3b')](_0xcb5a33);})['then'](function(_0x552282){_0x525b57[_0x6659('0x3c')]=_0x552282;return _0x525b57;})[_0x6659('0x24')](respondWithFilteredResult(_0x36dab5,_0xcb5a33))['catch'](handleError(_0x36dab5,null));};exports[_0x6659('0x3d')]=function(_0x4230cf,_0x55cd09){var _0x176516={'raw':!![],'where':{'id':_0x4230cf[_0x6659('0x3e')]['id']}},_0x3551d4={};_0x3551d4[_0x6659('0x2d')]=_['keys'](db[_0x6659('0x29')]['rawAttributes']);_0x3551d4[_0x6659('0x2e')]=_[_0x6659('0x2f')](_0x4230cf[_0x6659('0x2e')]);_0x3551d4[_0x6659('0x30')]=_[_0x6659('0x31')](_0x3551d4[_0x6659('0x2d')],_0x3551d4['query']);_0x176516['attributes']=_[_0x6659('0x31')](_0x3551d4[_0x6659('0x2d')],qs[_0x6659('0x32')](_0x4230cf[_0x6659('0x2e')][_0x6659('0x32')]));_0x176516[_0x6659('0x33')]=_0x176516[_0x6659('0x33')][_0x6659('0x3f')]?_0x176516[_0x6659('0x33')]:_0x3551d4[_0x6659('0x2d')];if(_0x4230cf['query'][_0x6659('0x40')]){_0x176516['include']=[{'all':!![]}];}_0x176516=_[_0x6659('0x39')]({},_0x176516,_0x4230cf[_0x6659('0x3a')]);return db['Cdr'][_0x6659('0x41')](_0x176516)[_0x6659('0x24')](handleEntityNotFound(_0x55cd09,null))['then'](respondWithResult(_0x55cd09,null))[_0x6659('0x42')](handleError(_0x55cd09,null));};exports[_0x6659('0x43')]=function(_0x6e0e41,_0x304733){return db['Cdr']['create'](_0x6e0e41[_0x6659('0x44')],{})[_0x6659('0x24')](respondWithResult(_0x304733,0xc9))[_0x6659('0x42')](handleError(_0x304733,null));};exports[_0x6659('0x22')]=function(_0x442355,_0x3afc78){if(_0x442355['body']['id']){delete _0x442355[_0x6659('0x44')]['id'];}return db[_0x6659('0x29')]['find']({'where':{'id':_0x442355[_0x6659('0x3e')]['id']}})[_0x6659('0x24')](handleEntityNotFound(_0x3afc78,null))['then'](saveUpdates(_0x442355[_0x6659('0x44')],null))[_0x6659('0x24')](respondWithResult(_0x3afc78,null))[_0x6659('0x42')](handleError(_0x3afc78,null));};exports[_0x6659('0x23')]=function(_0x78c901,_0x1bdf74){return db[_0x6659('0x29')][_0x6659('0x41')]({'where':{'id':_0x78c901[_0x6659('0x3e')]['id']}})[_0x6659('0x24')](handleEntityNotFound(_0x1bdf74,null))[_0x6659('0x24')](removeEntity(_0x1bdf74,null))[_0x6659('0x42')](handleError(_0x1bdf74,null));};exports['describe']=function(_0x4c338b,_0x5fe9bd){return db[_0x6659('0x29')]['describe']()[_0x6659('0x24')](respondWithResult(_0x5fe9bd,null))[_0x6659('0x42')](handleError(_0x5fe9bd,null));}; \ No newline at end of file +var _0xf072=['describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','Cdr','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','merge','body','find','params'];(function(_0x1149f8,_0x3cb799){var _0x965be5=function(_0x2af5f6){while(--_0x2af5f6){_0x1149f8['push'](_0x1149f8['shift']());}};_0x965be5(++_0x3cb799);}(_0xf072,0x1cf));var _0x2f07=function(_0x529902,_0x1c9253){_0x529902=_0x529902-0x0;var _0x6f4be6=_0xf072[_0x529902];return _0x6f4be6;};'use strict';var emlformat=require(_0x2f07('0x0'));var rimraf=require(_0x2f07('0x1'));var zipdir=require(_0x2f07('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f07('0x3'));var moment=require('moment');var BPromise=require(_0x2f07('0x4'));var Mustache=require(_0x2f07('0x5'));var util=require(_0x2f07('0x6'));var path=require('path');var sox=require(_0x2f07('0x7'));var csv=require(_0x2f07('0x8'));var ejs=require(_0x2f07('0x9'));var fs=require('fs');var fs_extra=require(_0x2f07('0xa'));var _=require(_0x2f07('0xb'));var squel=require(_0x2f07('0xc'));var crypto=require(_0x2f07('0xd'));var jsforce=require(_0x2f07('0xe'));var deskjs=require(_0x2f07('0xf'));var toCsv=require(_0x2f07('0x8'));var querystring=require(_0x2f07('0x10'));var Papa=require(_0x2f07('0x11'));var Redis=require(_0x2f07('0x12'));var authService=require(_0x2f07('0x13'));var qs=require(_0x2f07('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f07('0x15'));var logger=require(_0x2f07('0x16'))(_0x2f07('0x17'));var utils=require(_0x2f07('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2f07('0x19'))['db'];function respondWithStatusCode(_0x1e291d,_0x58549c){_0x58549c=_0x58549c||0xcc;return function(_0x6eb88a){if(_0x6eb88a){return _0x1e291d[_0x2f07('0x1a')](_0x58549c);}return _0x1e291d[_0x2f07('0x1b')](_0x58549c)['end']();};}function respondWithResult(_0x211514,_0x443fdc){_0x443fdc=_0x443fdc||0xc8;return function(_0x3596ea){if(_0x3596ea){return _0x211514[_0x2f07('0x1b')](_0x443fdc)[_0x2f07('0x1c')](_0x3596ea);}};}function respondWithFilteredResult(_0x309908,_0x5d32d6){return function(_0x8475cf){if(_0x8475cf){var _0x5a7b5c=typeof _0x5d32d6[_0x2f07('0x1d')]===_0x2f07('0x1e')&&typeof _0x5d32d6[_0x2f07('0x1f')]===_0x2f07('0x1e');var _0x1ec70d=_0x8475cf[_0x2f07('0x20')];var _0x1a6135=_0x5a7b5c?0x0:_0x5d32d6[_0x2f07('0x1d')];var _0x55bd60=_0x5a7b5c?_0x8475cf[_0x2f07('0x20')]:_0x5d32d6['offset']+_0x5d32d6[_0x2f07('0x1f')];var _0x2df6ed;if(_0x55bd60>=_0x1ec70d){_0x55bd60=_0x1ec70d;_0x2df6ed=0xc8;}else{_0x2df6ed=0xce;}_0x309908[_0x2f07('0x1b')](_0x2df6ed);return _0x309908[_0x2f07('0x21')](_0x2f07('0x22'),_0x1a6135+'-'+_0x55bd60+'/'+_0x1ec70d)['json'](_0x8475cf);}return null;};}function patchUpdates(_0x45df73){return function(_0x5a0146){try{jsonpatch['apply'](_0x5a0146,_0x45df73,!![]);}catch(_0x51ed43){return BPromise[_0x2f07('0x23')](_0x51ed43);}return _0x5a0146['save']();};}function saveUpdates(_0xb0c978,_0x5e6ac6){return function(_0x354ee2){if(_0x354ee2){return _0x354ee2[_0x2f07('0x24')](_0xb0c978)[_0x2f07('0x25')](function(_0x307888){return _0x307888;});}return null;};}function removeEntity(_0x49521b,_0x31be77){return function(_0x428d8c){if(_0x428d8c){return _0x428d8c[_0x2f07('0x26')]()['then'](function(){_0x49521b[_0x2f07('0x1b')](0xcc)[_0x2f07('0x27')]();});}};}function handleEntityNotFound(_0x522006,_0x1dcedc){return function(_0x1c9ca1){if(!_0x1c9ca1){_0x522006['sendStatus'](0x194);}return _0x1c9ca1;};}function handleError(_0x427e13,_0x562335){_0x562335=_0x562335||0x1f4;return function(_0x894cd4){logger[_0x2f07('0x28')](_0x894cd4[_0x2f07('0x29')]);if(_0x894cd4[_0x2f07('0x2a')]){delete _0x894cd4[_0x2f07('0x2a')];}_0x427e13[_0x2f07('0x1b')](_0x562335)[_0x2f07('0x2b')](_0x894cd4);};}exports[_0x2f07('0x2c')]=function(_0x3d7fff,_0x468cd8){var _0x3b4e2f={},_0x279eb3={},_0x4c607a={'count':0x0,'rows':[]};var _0x1accef=_[_0x2f07('0x2d')](db[_0x2f07('0x2e')]['rawAttributes'],function(_0x36d4b8){return{'name':_0x36d4b8[_0x2f07('0x2f')],'type':_0x36d4b8[_0x2f07('0x30')]['key']};});_0x279eb3[_0x2f07('0x31')]=_[_0x2f07('0x2d')](_0x1accef,_0x2f07('0x2a'));_0x279eb3[_0x2f07('0x32')]=_[_0x2f07('0x33')](_0x3d7fff[_0x2f07('0x32')]);_0x279eb3[_0x2f07('0x34')]=_['intersection'](_0x279eb3[_0x2f07('0x31')],_0x279eb3['query']);_0x3b4e2f[_0x2f07('0x35')]=_[_0x2f07('0x36')](_0x279eb3[_0x2f07('0x31')],qs[_0x2f07('0x37')](_0x3d7fff[_0x2f07('0x32')][_0x2f07('0x37')]));_0x3b4e2f[_0x2f07('0x35')]=_0x3b4e2f[_0x2f07('0x35')][_0x2f07('0x38')]?_0x3b4e2f[_0x2f07('0x35')]:_0x279eb3[_0x2f07('0x31')];if(!_0x3d7fff[_0x2f07('0x32')][_0x2f07('0x39')](_0x2f07('0x3a'))){_0x3b4e2f[_0x2f07('0x1f')]=qs[_0x2f07('0x1f')](_0x3d7fff['query']['limit']);_0x3b4e2f[_0x2f07('0x1d')]=qs[_0x2f07('0x1d')](_0x3d7fff[_0x2f07('0x32')]['offset']);}_0x3b4e2f['order']=qs[_0x2f07('0x3b')](_0x3d7fff['query'][_0x2f07('0x3b')]);_0x3b4e2f[_0x2f07('0x3c')]=qs[_0x2f07('0x34')](_[_0x2f07('0x3d')](_0x3d7fff[_0x2f07('0x32')],_0x279eb3['filters']),_0x1accef);if(_0x3d7fff[_0x2f07('0x32')]['filter']){_0x3b4e2f[_0x2f07('0x3c')]=_['merge'](_0x3b4e2f[_0x2f07('0x3c')],{'$or':_['map'](_0x1accef,function(_0x508f8a){if(_0x508f8a[_0x2f07('0x30')]!==_0x2f07('0x3e')){var _0x5e96b5={};_0x5e96b5[_0x508f8a[_0x2f07('0x2a')]]={'$like':'%'+_0x3d7fff[_0x2f07('0x32')][_0x2f07('0x3f')]+'%'};return _0x5e96b5;}})});}_0x3b4e2f=_['merge']({},_0x3b4e2f,_0x3d7fff[_0x2f07('0x40')]);var _0x185ef8={'where':_0x3b4e2f[_0x2f07('0x3c')]};return db[_0x2f07('0x2e')][_0x2f07('0x20')](_0x185ef8)[_0x2f07('0x25')](function(_0x1a0ef2){_0x4c607a[_0x2f07('0x20')]=_0x1a0ef2;if(_0x3d7fff['query'][_0x2f07('0x41')]){_0x3b4e2f[_0x2f07('0x42')]=[{'all':!![]}];}return db[_0x2f07('0x2e')][_0x2f07('0x43')](_0x3b4e2f);})[_0x2f07('0x25')](function(_0x2ded2e){_0x4c607a[_0x2f07('0x44')]=_0x2ded2e;return _0x4c607a;})['then'](respondWithFilteredResult(_0x468cd8,_0x3b4e2f))[_0x2f07('0x45')](handleError(_0x468cd8,null));};exports[_0x2f07('0x46')]=function(_0x32e3b0,_0x273c0f){var _0x3db7ad={'raw':!![],'where':{'id':_0x32e3b0['params']['id']}},_0xb6afe8={};_0xb6afe8[_0x2f07('0x31')]=_[_0x2f07('0x33')](db[_0x2f07('0x2e')][_0x2f07('0x47')]);_0xb6afe8['query']=_['keys'](_0x32e3b0[_0x2f07('0x32')]);_0xb6afe8[_0x2f07('0x34')]=_[_0x2f07('0x36')](_0xb6afe8[_0x2f07('0x31')],_0xb6afe8['query']);_0x3db7ad[_0x2f07('0x35')]=_[_0x2f07('0x36')](_0xb6afe8[_0x2f07('0x31')],qs[_0x2f07('0x37')](_0x32e3b0[_0x2f07('0x32')][_0x2f07('0x37')]));_0x3db7ad[_0x2f07('0x35')]=_0x3db7ad[_0x2f07('0x35')][_0x2f07('0x38')]?_0x3db7ad[_0x2f07('0x35')]:_0xb6afe8['model'];if(_0x32e3b0['query']['includeAll']){_0x3db7ad[_0x2f07('0x42')]=[{'all':!![]}];}_0x3db7ad=_[_0x2f07('0x48')]({},_0x3db7ad,_0x32e3b0['options']);return db[_0x2f07('0x2e')]['find'](_0x3db7ad)[_0x2f07('0x25')](handleEntityNotFound(_0x273c0f,null))[_0x2f07('0x25')](respondWithResult(_0x273c0f,null))[_0x2f07('0x45')](handleError(_0x273c0f,null));};exports['create']=function(_0x33f888,_0x350ace){return db['Cdr']['create'](_0x33f888[_0x2f07('0x49')],{})[_0x2f07('0x25')](respondWithResult(_0x350ace,0xc9))[_0x2f07('0x45')](handleError(_0x350ace,null));};exports[_0x2f07('0x24')]=function(_0x1596f8,_0x2f598b){if(_0x1596f8[_0x2f07('0x49')]['id']){delete _0x1596f8[_0x2f07('0x49')]['id'];}return db[_0x2f07('0x2e')][_0x2f07('0x4a')]({'where':{'id':_0x1596f8[_0x2f07('0x4b')]['id']}})[_0x2f07('0x25')](handleEntityNotFound(_0x2f598b,null))[_0x2f07('0x25')](saveUpdates(_0x1596f8[_0x2f07('0x49')],null))[_0x2f07('0x25')](respondWithResult(_0x2f598b,null))[_0x2f07('0x45')](handleError(_0x2f598b,null));};exports['destroy']=function(_0xec609d,_0x91e0e0){return db[_0x2f07('0x2e')][_0x2f07('0x4a')]({'where':{'id':_0xec609d[_0x2f07('0x4b')]['id']}})[_0x2f07('0x25')](handleEntityNotFound(_0x91e0e0,null))[_0x2f07('0x25')](removeEntity(_0x91e0e0,null))[_0x2f07('0x45')](handleError(_0x91e0e0,null));};exports[_0x2f07('0x4c')]=function(_0x5b920b,_0x3354e0){return db[_0x2f07('0x2e')][_0x2f07('0x4c')]()[_0x2f07('0x25')](respondWithResult(_0x3354e0,null))['catch'](handleError(_0x3354e0,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index bd3c616..2d7eb32 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xa26c9a,_0x51afe9){var _0x54eb78=function(_0x5608ba){while(--_0x5608ba){_0xa26c9a['push'](_0xa26c9a['shift']());}};_0x54eb78(++_0x51afe9);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x1633b8,_0x3244e9){var _0x34d717=function(_0x46def1){while(--_0x46def1){_0x1633b8['push'](_0x1633b8['shift']());}};_0x34d717(++_0x3244e9);}(_0x7a54,0x106));var _0x47a5=function(_0x4b12d6,_0x2e1f3f){_0x4b12d6=_0x4b12d6-0x0;var _0x25df4a=_0x7a54[_0x4b12d6];return _0x25df4a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index fe0e462..0975c64 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 _0x6d8f=['message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x6d8f,0xfe));var _0xf6d8=function(_0x10fb07,_0xa5bcef){_0x10fb07=_0x10fb07-0x0;var _0x43389f=_0x6d8f[_0x10fb07];return _0x43389f;};'use strict';var _=require(_0xf6d8('0x0'));var util=require(_0xf6d8('0x1'));var moment=require('moment');var BPromise=require(_0xf6d8('0x2'));var rs=require(_0xf6d8('0x3'));var fs=require('fs');var Redis=require(_0xf6d8('0x4'));var db=require(_0xf6d8('0x5'))['db'];var utils=require(_0xf6d8('0x6'));var logger=require(_0xf6d8('0x7'))(_0xf6d8('0x8'));var config=require('../../config/environment');var jayson=require(_0xf6d8('0x9'));var client=jayson[_0xf6d8('0xa')][_0xf6d8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e6ba1,_0x5f2307,_0x27bc82){return new BPromise(function(_0x325b45,_0x4b505a){return client[_0xf6d8('0xc')](_0x1e6ba1,_0x27bc82)[_0xf6d8('0xd')](function(_0x5baae2){logger[_0xf6d8('0xe')](_0xf6d8('0xf'),_0x5f2307,_0xf6d8('0x10'));logger['debug'](_0xf6d8('0x11'),_0x5f2307,_0xf6d8('0x10'),JSON['stringify'](_0x5baae2));if(_0x5baae2['error']){if(_0x5baae2[_0xf6d8('0x12')]['code']===0x1f4){logger['error'](_0xf6d8('0xf'),_0x5f2307,_0x5baae2[_0xf6d8('0x12')]['message']);return _0x4b505a(_0x5baae2[_0xf6d8('0x12')][_0xf6d8('0x13')]);}logger[_0xf6d8('0x12')](_0xf6d8('0xf'),_0x5f2307,_0x5baae2[_0xf6d8('0x12')][_0xf6d8('0x13')]);return _0x325b45(_0x5baae2[_0xf6d8('0x12')][_0xf6d8('0x13')]);}else{logger[_0xf6d8('0xe')](_0xf6d8('0xf'),_0x5f2307,_0xf6d8('0x10'));_0x325b45(_0x5baae2[_0xf6d8('0x14')][_0xf6d8('0x13')]);}})['catch'](function(_0x883d76){logger[_0xf6d8('0x12')](_0xf6d8('0xf'),_0x5f2307,_0x883d76);_0x4b505a(_0x883d76);});});} \ No newline at end of file +var _0x787d=['info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x787d,0x1ab));var _0xd787=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x787d[_0x5e6ea3];return _0x4048b5;};'use strict';var _=require(_0xd787('0x0'));var util=require(_0xd787('0x1'));var moment=require(_0xd787('0x2'));var BPromise=require(_0xd787('0x3'));var rs=require(_0xd787('0x4'));var fs=require('fs');var Redis=require(_0xd787('0x5'));var db=require(_0xd787('0x6'))['db'];var utils=require(_0xd787('0x7'));var logger=require(_0xd787('0x8'))('rpc');var config=require(_0xd787('0x9'));var jayson=require(_0xd787('0xa'));var client=jayson[_0xd787('0xb')][_0xd787('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3009a4,_0x2f9bd5,_0xd6e500){return new BPromise(function(_0x579a9c,_0x3414c6){return client[_0xd787('0xd')](_0x3009a4,_0xd6e500)[_0xd787('0xe')](function(_0x7d3c51){logger[_0xd787('0xf')](_0xd787('0x10'),_0x2f9bd5,_0xd787('0x11'));logger[_0xd787('0x12')](_0xd787('0x13'),_0x2f9bd5,_0xd787('0x11'),JSON[_0xd787('0x14')](_0x7d3c51));if(_0x7d3c51[_0xd787('0x15')]){if(_0x7d3c51[_0xd787('0x15')][_0xd787('0x16')]===0x1f4){logger[_0xd787('0x15')](_0xd787('0x10'),_0x2f9bd5,_0x7d3c51[_0xd787('0x15')][_0xd787('0x17')]);return _0x3414c6(_0x7d3c51['error'][_0xd787('0x17')]);}logger[_0xd787('0x15')]('Cdr,\x20%s,\x20%s',_0x2f9bd5,_0x7d3c51[_0xd787('0x15')][_0xd787('0x17')]);return _0x579a9c(_0x7d3c51[_0xd787('0x15')][_0xd787('0x17')]);}else{logger[_0xd787('0xf')](_0xd787('0x10'),_0x2f9bd5,_0xd787('0x11'));_0x579a9c(_0x7d3c51[_0xd787('0x18')][_0xd787('0x17')]);}})[_0xd787('0x19')](function(_0x100a36){logger[_0xd787('0x15')](_0xd787('0x10'),_0x2f9bd5,_0x100a36);_0x3414c6(_0x100a36);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 29767e9..7715d3c 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(_0x41ddf3,_0x4c5db7){var _0x2adac3=function(_0x15cf40){while(--_0x15cf40){_0x41ddf3['push'](_0x41ddf3['shift']());}};_0x2adac3(++_0x4c5db7);}(_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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c23d380..6af599e 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 _0xa935=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x1c5095,_0x11b60d){var _0x1b154d=function(_0x4dc5c2){while(--_0x4dc5c2){_0x1c5095['push'](_0x1c5095['shift']());}};_0x1b154d(++_0x11b60d);}(_0xa935,0x7a));var _0x5a93=function(_0x5ce7e2,_0x8dd5de){_0x5ce7e2=_0x5ce7e2-0x0;var _0x5224d1=_0xa935[_0x5ce7e2];return _0x5224d1;};'use strict';var Sequelize=require(_0x5a93('0x0'));module[_0x5a93('0x1')]={'priority':{'type':Sequelize[_0x5a93('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5a93('0x3')},'appdata':{'type':Sequelize[_0x5a93('0x4')]()},'description':{'type':Sequelize[_0x5a93('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5a93('0x6')}}; \ No newline at end of file +var _0x09c9=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x174a1b,_0x8a02a6){var _0x1dff64=function(_0x1ccf3e){while(--_0x1ccf3e){_0x174a1b['push'](_0x174a1b['shift']());}};_0x1dff64(++_0x8a02a6);}(_0x09c9,0xe5));var _0x909c=function(_0x69a12f,_0x352416){_0x69a12f=_0x69a12f-0x0;var _0x4ecc51=_0x09c9[_0x69a12f];return _0x4ecc51;};'use strict';var Sequelize=require(_0x909c('0x0'));module[_0x909c('0x1')]={'priority':{'type':Sequelize[_0x909c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x909c('0x3')],'allowNull':![],'defaultValue':_0x909c('0x4')},'appdata':{'type':Sequelize[_0x909c('0x5')]()},'description':{'type':Sequelize[_0x909c('0x3')]},'interval':{'type':Sequelize[_0x909c('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 948f2a8..bedf2ae 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 _0x9e0d=['sox','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/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatApplication','find','catch','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x1027a3,_0x2522a6){var _0x41804b=function(_0x2a5f74){while(--_0x2a5f74){_0x1027a3['push'](_0x1027a3['shift']());}};_0x41804b(++_0x2522a6);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x3a29ef,_0xe4270e){_0x3a29ef=_0x3a29ef-0x0;var _0x5de1d3=_0x9e0d[_0x3a29ef];return _0x5de1d3;};'use strict';var emlformat=require(_0xd9e0('0x0'));var rimraf=require(_0xd9e0('0x1'));var zipdir=require(_0xd9e0('0x2'));var jsonpatch=require(_0xd9e0('0x3'));var rp=require('request-promise');var moment=require(_0xd9e0('0x4'));var BPromise=require(_0xd9e0('0x5'));var Mustache=require(_0xd9e0('0x6'));var util=require(_0xd9e0('0x7'));var path=require(_0xd9e0('0x8'));var sox=require(_0xd9e0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9e0('0xa'));var _=require(_0xd9e0('0xb'));var squel=require(_0xd9e0('0xc'));var crypto=require(_0xd9e0('0xd'));var jsforce=require(_0xd9e0('0xe'));var deskjs=require(_0xd9e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9e0('0x10'));var Papa=require(_0xd9e0('0x11'));var Redis=require(_0xd9e0('0x12'));var authService=require(_0xd9e0('0x13'));var qs=require(_0xd9e0('0x14'));var as=require(_0xd9e0('0x15'));var hardwareService=require(_0xd9e0('0x16'));var logger=require('../../config/logger')(_0xd9e0('0x17'));var utils=require(_0xd9e0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd9e0('0x19'));var db=require(_0xd9e0('0x1a'))['db'];function respondWithStatusCode(_0x418d84,_0x1fb454){_0x1fb454=_0x1fb454||0xcc;return function(_0x18fdf2){if(_0x18fdf2){return _0x418d84['sendStatus'](_0x1fb454);}return _0x418d84[_0xd9e0('0x1b')](_0x1fb454)['end']();};}function respondWithResult(_0x2f311c,_0x55c704){_0x55c704=_0x55c704||0xc8;return function(_0x24d361){if(_0x24d361){return _0x2f311c[_0xd9e0('0x1b')](_0x55c704)[_0xd9e0('0x1c')](_0x24d361);}};}function respondWithFilteredResult(_0x18301b,_0x3e4c5d){return function(_0x4da900){if(_0x4da900){var _0x58d44c=typeof _0x3e4c5d['offset']===_0xd9e0('0x1d')&&typeof _0x3e4c5d[_0xd9e0('0x1e')]===_0xd9e0('0x1d');var _0x1cdcb6=_0x4da900['count'];var _0x209c04=_0x58d44c?0x0:_0x3e4c5d['offset'];var _0x483b74=_0x58d44c?_0x4da900[_0xd9e0('0x1f')]:_0x3e4c5d[_0xd9e0('0x20')]+_0x3e4c5d['limit'];var _0x5ac8f5;if(_0x483b74>=_0x1cdcb6){_0x483b74=_0x1cdcb6;_0x5ac8f5=0xc8;}else{_0x5ac8f5=0xce;}_0x18301b[_0xd9e0('0x1b')](_0x5ac8f5);return _0x18301b[_0xd9e0('0x21')]('Content-Range',_0x209c04+'-'+_0x483b74+'/'+_0x1cdcb6)[_0xd9e0('0x1c')](_0x4da900);}return null;};}function patchUpdates(_0x4cc3c9){return function(_0xd3d455){try{jsonpatch[_0xd9e0('0x22')](_0xd3d455,_0x4cc3c9,!![]);}catch(_0x67f69f){return BPromise[_0xd9e0('0x23')](_0x67f69f);}return _0xd3d455[_0xd9e0('0x24')]();};}function saveUpdates(_0x5711a1,_0x19534a){return function(_0x333233){if(_0x333233){return _0x333233['update'](_0x5711a1)[_0xd9e0('0x25')](function(_0x124ca7){return _0x124ca7;});}return null;};}function removeEntity(_0x5d4549,_0x357bd9){return function(_0x5e17d4){if(_0x5e17d4){return _0x5e17d4[_0xd9e0('0x26')]()[_0xd9e0('0x25')](function(){_0x5d4549['status'](0xcc)[_0xd9e0('0x27')]();});}};}function handleEntityNotFound(_0x53cf67,_0x554aeb){return function(_0x50f57d){if(!_0x50f57d){_0x53cf67[_0xd9e0('0x28')](0x194);}return _0x50f57d;};}function handleError(_0x21c796,_0x7065c6){_0x7065c6=_0x7065c6||0x1f4;return function(_0x1c36df){logger[_0xd9e0('0x29')](_0x1c36df[_0xd9e0('0x2a')]);if(_0x1c36df[_0xd9e0('0x2b')]){delete _0x1c36df['name'];}_0x21c796[_0xd9e0('0x1b')](_0x7065c6)[_0xd9e0('0x2c')](_0x1c36df);};}exports[_0xd9e0('0x2d')]=function(_0x17a899,_0x2738e9){var _0x4f5367={'raw':!![],'where':{'id':_0x17a899['params']['id']}},_0x4b4f7d={};_0x4b4f7d[_0xd9e0('0x2e')]=_[_0xd9e0('0x2f')](db['ChatApplication'][_0xd9e0('0x30')]);_0x4b4f7d[_0xd9e0('0x31')]=_[_0xd9e0('0x2f')](_0x17a899[_0xd9e0('0x31')]);_0x4b4f7d[_0xd9e0('0x32')]=_[_0xd9e0('0x33')](_0x4b4f7d[_0xd9e0('0x2e')],_0x4b4f7d['query']);_0x4f5367[_0xd9e0('0x34')]=_[_0xd9e0('0x33')](_0x4b4f7d[_0xd9e0('0x2e')],qs[_0xd9e0('0x35')](_0x17a899[_0xd9e0('0x31')][_0xd9e0('0x35')]));_0x4f5367[_0xd9e0('0x34')]=_0x4f5367[_0xd9e0('0x34')][_0xd9e0('0x36')]?_0x4f5367[_0xd9e0('0x34')]:_0x4b4f7d[_0xd9e0('0x2e')];if(_0x17a899[_0xd9e0('0x31')]['includeAll']){_0x4f5367[_0xd9e0('0x37')]=[{'all':!![]}];}_0x4f5367=_[_0xd9e0('0x38')]({},_0x4f5367,_0x17a899[_0xd9e0('0x39')]);return db[_0xd9e0('0x3a')][_0xd9e0('0x3b')](_0x4f5367)['then'](handleEntityNotFound(_0x2738e9,null))[_0xd9e0('0x25')](respondWithResult(_0x2738e9,null))[_0xd9e0('0x3c')](handleError(_0x2738e9,null));};exports[_0xd9e0('0x3d')]=function(_0x23901a,_0x588f8c){if(_0x23901a[_0xd9e0('0x3e')]['id']){delete _0x23901a['body']['id'];}return db[_0xd9e0('0x3a')][_0xd9e0('0x3b')]({'where':{'id':_0x23901a[_0xd9e0('0x3f')]['id']}})[_0xd9e0('0x25')](handleEntityNotFound(_0x588f8c,null))[_0xd9e0('0x25')](saveUpdates(_0x23901a[_0xd9e0('0x3e')],null))[_0xd9e0('0x25')](respondWithResult(_0x588f8c,null))[_0xd9e0('0x3c')](handleError(_0x588f8c,null));};exports[_0xd9e0('0x26')]=function(_0x5065f7,_0x318679){return db[_0xd9e0('0x3a')][_0xd9e0('0x3b')]({'where':{'id':_0x5065f7[_0xd9e0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x318679,null))[_0xd9e0('0x25')](removeEntity(_0x318679,null))[_0xd9e0('0x3c')](handleError(_0x318679,null));}; \ No newline at end of file +var _0x2e21=['merge','options','find','catch','body','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','show','params','keys','ChatApplication','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','include'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2e21,0xba));var _0x12e2=function(_0x125fa1,_0x54d5b4){_0x125fa1=_0x125fa1-0x0;var _0x1bfa21=_0x2e21[_0x125fa1];return _0x1bfa21;};'use strict';var emlformat=require(_0x12e2('0x0'));var rimraf=require(_0x12e2('0x1'));var zipdir=require(_0x12e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x12e2('0x3'));var moment=require('moment');var BPromise=require(_0x12e2('0x4'));var Mustache=require(_0x12e2('0x5'));var util=require(_0x12e2('0x6'));var path=require(_0x12e2('0x7'));var sox=require(_0x12e2('0x8'));var csv=require(_0x12e2('0x9'));var ejs=require(_0x12e2('0xa'));var fs=require('fs');var fs_extra=require(_0x12e2('0xb'));var _=require(_0x12e2('0xc'));var squel=require(_0x12e2('0xd'));var crypto=require(_0x12e2('0xe'));var jsforce=require(_0x12e2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x12e2('0x9'));var querystring=require('querystring');var Papa=require(_0x12e2('0x10'));var Redis=require('ioredis');var authService=require(_0x12e2('0x11'));var qs=require(_0x12e2('0x12'));var as=require(_0x12e2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x12e2('0x14'))(_0x12e2('0x15'));var utils=require('../../config/utils');var config=require(_0x12e2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x12e2('0x17'))['db'];function respondWithStatusCode(_0x4eaf75,_0x106015){_0x106015=_0x106015||0xcc;return function(_0x25edc8){if(_0x25edc8){return _0x4eaf75[_0x12e2('0x18')](_0x106015);}return _0x4eaf75[_0x12e2('0x19')](_0x106015)[_0x12e2('0x1a')]();};}function respondWithResult(_0x1c92de,_0x1cfa64){_0x1cfa64=_0x1cfa64||0xc8;return function(_0x3b936e){if(_0x3b936e){return _0x1c92de[_0x12e2('0x19')](_0x1cfa64)['json'](_0x3b936e);}};}function respondWithFilteredResult(_0x29c58e,_0x411049){return function(_0x44b3e0){if(_0x44b3e0){var _0x285ff7=typeof _0x411049[_0x12e2('0x1b')]===_0x12e2('0x1c')&&typeof _0x411049[_0x12e2('0x1d')]===_0x12e2('0x1c');var _0x1d3da5=_0x44b3e0[_0x12e2('0x1e')];var _0x210f5c=_0x285ff7?0x0:_0x411049[_0x12e2('0x1b')];var _0x298e64=_0x285ff7?_0x44b3e0[_0x12e2('0x1e')]:_0x411049[_0x12e2('0x1b')]+_0x411049[_0x12e2('0x1d')];var _0x3cf1e3;if(_0x298e64>=_0x1d3da5){_0x298e64=_0x1d3da5;_0x3cf1e3=0xc8;}else{_0x3cf1e3=0xce;}_0x29c58e[_0x12e2('0x19')](_0x3cf1e3);return _0x29c58e[_0x12e2('0x1f')](_0x12e2('0x20'),_0x210f5c+'-'+_0x298e64+'/'+_0x1d3da5)[_0x12e2('0x21')](_0x44b3e0);}return null;};}function patchUpdates(_0xd85795){return function(_0x475cab){try{jsonpatch['apply'](_0x475cab,_0xd85795,!![]);}catch(_0x2afa39){return BPromise[_0x12e2('0x22')](_0x2afa39);}return _0x475cab[_0x12e2('0x23')]();};}function saveUpdates(_0x34ce6f,_0x47be59){return function(_0x400d23){if(_0x400d23){return _0x400d23[_0x12e2('0x24')](_0x34ce6f)['then'](function(_0x4002db){return _0x4002db;});}return null;};}function removeEntity(_0x5dac82,_0xe5868a){return function(_0x33fed2){if(_0x33fed2){return _0x33fed2['destroy']()[_0x12e2('0x25')](function(){_0x5dac82[_0x12e2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4936fb,_0x719371){return function(_0x461e2b){if(!_0x461e2b){_0x4936fb['sendStatus'](0x194);}return _0x461e2b;};}function handleError(_0x1cb0d1,_0x18639b){_0x18639b=_0x18639b||0x1f4;return function(_0x441c84){logger[_0x12e2('0x26')](_0x441c84[_0x12e2('0x27')]);if(_0x441c84[_0x12e2('0x28')]){delete _0x441c84[_0x12e2('0x28')];}_0x1cb0d1[_0x12e2('0x19')](_0x18639b)['send'](_0x441c84);};}exports[_0x12e2('0x29')]=function(_0x2a32a6,_0xdeff70){var _0x2f2a21={'raw':!![],'where':{'id':_0x2a32a6[_0x12e2('0x2a')]['id']}},_0xb62e62={};_0xb62e62['model']=_[_0x12e2('0x2b')](db[_0x12e2('0x2c')][_0x12e2('0x2d')]);_0xb62e62['query']=_[_0x12e2('0x2b')](_0x2a32a6[_0x12e2('0x2e')]);_0xb62e62['filters']=_[_0x12e2('0x2f')](_0xb62e62[_0x12e2('0x30')],_0xb62e62[_0x12e2('0x2e')]);_0x2f2a21[_0x12e2('0x31')]=_[_0x12e2('0x2f')](_0xb62e62['model'],qs[_0x12e2('0x32')](_0x2a32a6[_0x12e2('0x2e')][_0x12e2('0x32')]));_0x2f2a21[_0x12e2('0x31')]=_0x2f2a21[_0x12e2('0x31')][_0x12e2('0x33')]?_0x2f2a21[_0x12e2('0x31')]:_0xb62e62['model'];if(_0x2a32a6[_0x12e2('0x2e')][_0x12e2('0x34')]){_0x2f2a21[_0x12e2('0x35')]=[{'all':!![]}];}_0x2f2a21=_[_0x12e2('0x36')]({},_0x2f2a21,_0x2a32a6[_0x12e2('0x37')]);return db[_0x12e2('0x2c')][_0x12e2('0x38')](_0x2f2a21)[_0x12e2('0x25')](handleEntityNotFound(_0xdeff70,null))[_0x12e2('0x25')](respondWithResult(_0xdeff70,null))[_0x12e2('0x39')](handleError(_0xdeff70,null));};exports['update']=function(_0x5d00bf,_0x5e2246){if(_0x5d00bf[_0x12e2('0x3a')]['id']){delete _0x5d00bf[_0x12e2('0x3a')]['id'];}return db[_0x12e2('0x2c')][_0x12e2('0x38')]({'where':{'id':_0x5d00bf[_0x12e2('0x2a')]['id']}})[_0x12e2('0x25')](handleEntityNotFound(_0x5e2246,null))['then'](saveUpdates(_0x5d00bf[_0x12e2('0x3a')],null))[_0x12e2('0x25')](respondWithResult(_0x5e2246,null))[_0x12e2('0x39')](handleError(_0x5e2246,null));};exports[_0x12e2('0x3b')]=function(_0x4ab554,_0x34cbb7){return db[_0x12e2('0x2c')][_0x12e2('0x38')]({'where':{'id':_0x4ab554[_0x12e2('0x2a')]['id']}})['then'](handleEntityNotFound(_0x34cbb7,null))[_0x12e2('0x25')](removeEntity(_0x34cbb7,null))[_0x12e2('0x39')](handleError(_0x34cbb7,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2d3029f..4db8d96 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 _0x42c8=['./chatApplication.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x524a0a,_0x4853a9){var _0x16fed2=function(_0x19162e){while(--_0x19162e){_0x524a0a['push'](_0x524a0a['shift']());}};_0x16fed2(++_0x4853a9);}(_0x42c8,0x116));var _0x842c=function(_0x456b77,_0x4fed12){_0x456b77=_0x456b77-0x0;var _0x118bb6=_0x42c8[_0x456b77];return _0x118bb6;};'use strict';var _=require(_0x842c('0x0'));var util=require(_0x842c('0x1'));var logger=require(_0x842c('0x2'))(_0x842c('0x3'));var moment=require(_0x842c('0x4'));var BPromise=require('bluebird');var rp=require(_0x842c('0x5'));var fs=require('fs');var path=require(_0x842c('0x6'));var rimraf=require('rimraf');var config=require(_0x842c('0x7'));var attributes=require(_0x842c('0x8'));module[_0x842c('0x9')]=function(_0x506797,_0x2ad613){return _0x506797[_0x842c('0xa')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x63f1=['rimraf','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1bcb83,_0x51bc7a){var _0x5a83fa=function(_0x4576fa){while(--_0x4576fa){_0x1bcb83['push'](_0x1bcb83['shift']());}};_0x5a83fa(++_0x51bc7a);}(_0x63f1,0x71));var _0x163f=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x63f1[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x163f('0x0'));var util=require(_0x163f('0x1'));var logger=require(_0x163f('0x2'))(_0x163f('0x3'));var moment=require(_0x163f('0x4'));var BPromise=require(_0x163f('0x5'));var rp=require(_0x163f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x163f('0x7'));var config=require('../../config/environment');var attributes=require(_0x163f('0x8'));module[_0x163f('0x9')]=function(_0x24de4b,_0x11cb90){return _0x24de4b[_0x163f('0xa')](_0x163f('0xb'),attributes,{'tableName':_0x163f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x163f('0xd'),'collate':_0x163f('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b2d8c62..8a8fac7 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 _0xc524=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0xc524,0x159));var _0x4c52=function(_0xf08e73,_0x15631a){_0xf08e73=_0xf08e73-0x0;var _0x6517bb=_0xc524[_0xf08e73];return _0x6517bb;};'use strict';var _=require(_0x4c52('0x0'));var util=require(_0x4c52('0x1'));var moment=require('moment');var BPromise=require(_0x4c52('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4c52('0x3'));var logger=require(_0x4c52('0x4'))('rpc');var config=require(_0x4c52('0x5'));var jayson=require(_0x4c52('0x6'));var client=jayson[_0x4c52('0x7')][_0x4c52('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38f235,_0x1102f9,_0x4eb231){return new BPromise(function(_0x22c7dc,_0x58a542){return client[_0x4c52('0x9')](_0x38f235,_0x4eb231)[_0x4c52('0xa')](function(_0x31702d){logger[_0x4c52('0xb')](_0x4c52('0xc'),_0x1102f9,_0x4c52('0xd'));logger[_0x4c52('0xe')](_0x4c52('0xf'),_0x1102f9,_0x4c52('0xd'),JSON[_0x4c52('0x10')](_0x31702d));if(_0x31702d['error']){if(_0x31702d['error']['code']===0x1f4){logger[_0x4c52('0x11')]('ChatApplication,\x20%s,\x20%s',_0x1102f9,_0x31702d['error'][_0x4c52('0x12')]);return _0x58a542(_0x31702d[_0x4c52('0x11')]['message']);}logger[_0x4c52('0x11')]('ChatApplication,\x20%s,\x20%s',_0x1102f9,_0x31702d[_0x4c52('0x11')]['message']);return _0x22c7dc(_0x31702d[_0x4c52('0x11')]['message']);}else{logger[_0x4c52('0xb')](_0x4c52('0xc'),_0x1102f9,_0x4c52('0xd'));_0x22c7dc(_0x31702d[_0x4c52('0x13')]['message']);}})[_0x4c52('0x14')](function(_0x50f736){logger[_0x4c52('0x11')]('ChatApplication,\x20%s,\x20%s',_0x1102f9,_0x50f736);_0x58a542(_0x50f736);});});} \ No newline at end of file +var _0xe3c8=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x31c3c8,_0x266f74){var _0x3ec8fb=function(_0x5bf0ae){while(--_0x5bf0ae){_0x31c3c8['push'](_0x31c3c8['shift']());}};_0x3ec8fb(++_0x266f74);}(_0xe3c8,0x10c));var _0x8e3c=function(_0x4dcc88,_0x4af25e){_0x4dcc88=_0x4dcc88-0x0;var _0x377ec8=_0xe3c8[_0x4dcc88];return _0x377ec8;};'use strict';var _=require(_0x8e3c('0x0'));var util=require(_0x8e3c('0x1'));var moment=require(_0x8e3c('0x2'));var BPromise=require(_0x8e3c('0x3'));var rs=require(_0x8e3c('0x4'));var fs=require('fs');var Redis=require(_0x8e3c('0x5'));var db=require(_0x8e3c('0x6'))['db'];var utils=require(_0x8e3c('0x7'));var logger=require(_0x8e3c('0x8'))(_0x8e3c('0x9'));var config=require(_0x8e3c('0xa'));var jayson=require(_0x8e3c('0xb'));var client=jayson['client'][_0x8e3c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19a260,_0x1da666,_0x12b5ab){return new BPromise(function(_0x18f413,_0xd0ee6b){return client[_0x8e3c('0xd')](_0x19a260,_0x12b5ab)['then'](function(_0x190fc6){logger['info'](_0x8e3c('0xe'),_0x1da666,_0x8e3c('0xf'));logger['debug'](_0x8e3c('0x10'),_0x1da666,_0x8e3c('0xf'),JSON[_0x8e3c('0x11')](_0x190fc6));if(_0x190fc6[_0x8e3c('0x12')]){if(_0x190fc6[_0x8e3c('0x12')][_0x8e3c('0x13')]===0x1f4){logger[_0x8e3c('0x12')](_0x8e3c('0xe'),_0x1da666,_0x190fc6[_0x8e3c('0x12')][_0x8e3c('0x14')]);return _0xd0ee6b(_0x190fc6[_0x8e3c('0x12')][_0x8e3c('0x14')]);}logger[_0x8e3c('0x12')](_0x8e3c('0xe'),_0x1da666,_0x190fc6['error'][_0x8e3c('0x14')]);return _0x18f413(_0x190fc6[_0x8e3c('0x12')]['message']);}else{logger[_0x8e3c('0x15')](_0x8e3c('0xe'),_0x1da666,_0x8e3c('0xf'));_0x18f413(_0x190fc6[_0x8e3c('0x16')][_0x8e3c('0x14')]);}})['catch'](function(_0x28941e){logger['error']('ChatApplication,\x20%s,\x20%s',_0x1da666,_0x28941e);_0xd0ee6b(_0x28941e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index bca58e2..231dc7e 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 _0x681d=['destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','show','update'];(function(_0x1734ab,_0x254bb2){var _0x41008e=function(_0x131727){while(--_0x131727){_0x1734ab['push'](_0x1734ab['shift']());}};_0x41008e(++_0x254bb2);}(_0x681d,0x1af));var _0xd681=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x681d[_0x4d613c];return _0x301fe3;};'use strict';var multer=require(_0xd681('0x0'));var util=require('util');var path=require(_0xd681('0x1'));var timeout=require('connect-timeout');var express=require(_0xd681('0x2'));var router=express[_0xd681('0x3')]();var fs_extra=require(_0xd681('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd681('0x5'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xd681('0x6')](_0xd681('0x7'),auth[_0xd681('0x8')](),controller[_0xd681('0x9')]);router['put'](_0xd681('0x7'),auth[_0xd681('0x8')](),controller[_0xd681('0xa')]);router['delete'](_0xd681('0x7'),auth[_0xd681('0x8')](),controller[_0xd681('0xb')]);module[_0xd681('0xc')]=router; \ No newline at end of file +var _0xc6ac=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0xc6ac,0x1dd));var _0xcc6a=function(_0x45b9e7,_0x3862e5){_0x45b9e7=_0x45b9e7-0x0;var _0x26110a=_0xc6ac[_0x45b9e7];return _0x26110a;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')](_0xcc6a('0xb'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xe')](_0xcc6a('0xb'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router[_0xcc6a('0x10')](_0xcc6a('0xb'),auth[_0xcc6a('0xc')](),controller['destroy']);module[_0xcc6a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 2b1c9b9..30c0c0e 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 _0x084b=['BOOLEAN','sequelize'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x084b,0xd5));var _0xb084=function(_0x2492dd,_0x190912){_0x2492dd=_0x2492dd-0x0;var _0x4b7c4f=_0x084b[_0x2492dd];return _0x4b7c4f;};'use strict';var Sequelize=require(_0xb084('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xb084('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcdac=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2aa227,_0x32f559){var _0x488c01=function(_0x6d9145){while(--_0x6d9145){_0x2aa227['push'](_0x2aa227['shift']());}};_0x488c01(++_0x32f559);}(_0xcdac,0xb6));var _0xccda=function(_0x151cbe,_0x40fa90){_0x151cbe=_0x151cbe-0x0;var _0x2adae9=_0xcdac[_0x151cbe];return _0x2adae9;};'use strict';var Sequelize=require(_0xccda('0x0'));module[_0xccda('0x1')]={'name':{'type':Sequelize[_0xccda('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xccda('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 a286f49..89b1717 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 _0xb9fb=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','ChatGroup','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','options','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','ids','omit','getMembers','findOne','User','order','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x7f3667,_0x30c3f1){var _0x2c4c24=function(_0xf070f3){while(--_0xf070f3){_0x7f3667['push'](_0x7f3667['shift']());}};_0x2c4c24(++_0x30c3f1);}(_0xb9fb,0x171));var _0xbb9f=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xb9fb[_0x9df060];return _0x338dfe;};'use strict';var emlformat=require(_0xbb9f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbb9f('0x1'));var rp=require(_0xbb9f('0x2'));var moment=require(_0xbb9f('0x3'));var BPromise=require(_0xbb9f('0x4'));var Mustache=require(_0xbb9f('0x5'));var util=require(_0xbb9f('0x6'));var path=require(_0xbb9f('0x7'));var sox=require('sox');var csv=require(_0xbb9f('0x8'));var ejs=require(_0xbb9f('0x9'));var fs=require('fs');var fs_extra=require(_0xbb9f('0xa'));var _=require(_0xbb9f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb9f('0xc'));var deskjs=require(_0xbb9f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbb9f('0xe'));var Papa=require(_0xbb9f('0xf'));var Redis=require(_0xbb9f('0x10'));var authService=require(_0xbb9f('0x11'));var qs=require(_0xbb9f('0x12'));var as=require(_0xbb9f('0x13'));var hardwareService=require(_0xbb9f('0x14'));var logger=require('../../config/logger')(_0xbb9f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbb9f('0x16'));var db=require(_0xbb9f('0x17'))['db'];config[_0xbb9f('0x18')]=_['defaults'](config[_0xbb9f('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb9f('0x19'))(new Redis(config[_0xbb9f('0x18')]));require(_0xbb9f('0x1a'))[_0xbb9f('0x1b')](socket);function respondWithStatusCode(_0x1c8a27,_0x4338c7){_0x4338c7=_0x4338c7||0xcc;return function(_0x5c1dcd){if(_0x5c1dcd){return _0x1c8a27['sendStatus'](_0x4338c7);}return _0x1c8a27['status'](_0x4338c7)['end']();};}function respondWithResult(_0x3dbcbb,_0x545c67){_0x545c67=_0x545c67||0xc8;return function(_0x3b6bf3){if(_0x3b6bf3){return _0x3dbcbb[_0xbb9f('0x1c')](_0x545c67)[_0xbb9f('0x1d')](_0x3b6bf3);}};}function respondWithFilteredResult(_0x2e4611,_0xd2c364){return function(_0xd2f752){if(_0xd2f752){var _0x1d5bb3=typeof _0xd2c364[_0xbb9f('0x1e')]===_0xbb9f('0x1f')&&typeof _0xd2c364[_0xbb9f('0x20')]===_0xbb9f('0x1f');var _0x1d8ce7=_0xd2f752[_0xbb9f('0x21')];var _0x49a9c5=_0x1d5bb3?0x0:_0xd2c364[_0xbb9f('0x1e')];var _0x32d6ca=_0x1d5bb3?_0xd2f752[_0xbb9f('0x21')]:_0xd2c364[_0xbb9f('0x1e')]+_0xd2c364[_0xbb9f('0x20')];var _0xe08dee;if(_0x32d6ca>=_0x1d8ce7){_0x32d6ca=_0x1d8ce7;_0xe08dee=0xc8;}else{_0xe08dee=0xce;}_0x2e4611['status'](_0xe08dee);return _0x2e4611[_0xbb9f('0x22')](_0xbb9f('0x23'),_0x49a9c5+'-'+_0x32d6ca+'/'+_0x1d8ce7)['json'](_0xd2f752);}return null;};}function patchUpdates(_0x2f50f6){return function(_0xf7f64c){try{jsonpatch[_0xbb9f('0x24')](_0xf7f64c,_0x2f50f6,!![]);}catch(_0x57b2ae){return BPromise[_0xbb9f('0x25')](_0x57b2ae);}return _0xf7f64c[_0xbb9f('0x26')]();};}function saveUpdates(_0x370c24,_0x59d15d){return function(_0x4983df){if(_0x4983df){return _0x4983df[_0xbb9f('0x27')](_0x370c24)[_0xbb9f('0x28')](function(_0x35ab35){return _0x35ab35;});}return null;};}function removeEntity(_0x2a9d77,_0x252d86){return function(_0x1a7f7b){if(_0x1a7f7b){return _0x1a7f7b[_0xbb9f('0x29')]()[_0xbb9f('0x28')](function(){_0x2a9d77[_0xbb9f('0x1c')](0xcc)[_0xbb9f('0x2a')]();});}};}function handleEntityNotFound(_0x38c0db,_0x40c1a0){return function(_0x354c73){if(!_0x354c73){_0x38c0db[_0xbb9f('0x2b')](0x194);}return _0x354c73;};}function handleError(_0x3304e5,_0x1ad038){_0x1ad038=_0x1ad038||0x1f4;return function(_0x13f367){logger[_0xbb9f('0x2c')](_0x13f367['stack']);if(_0x13f367[_0xbb9f('0x2d')]){delete _0x13f367[_0xbb9f('0x2d')];}_0x3304e5[_0xbb9f('0x1c')](_0x1ad038)[_0xbb9f('0x2e')](_0x13f367);};}exports[_0xbb9f('0x2f')]=function(_0xa1026a,_0x1e6c1f){var _0x581e0c={},_0x1173d8={},_0x14fe35={'count':0x0,'rows':[]};var _0x506ef5=_[_0xbb9f('0x30')](db['ChatGroup']['rawAttributes'],function(_0x81e427){return{'name':_0x81e427['fieldName'],'type':_0x81e427[_0xbb9f('0x31')][_0xbb9f('0x32')]};});_0x1173d8[_0xbb9f('0x33')]=_[_0xbb9f('0x30')](_0x506ef5,_0xbb9f('0x2d'));_0x1173d8[_0xbb9f('0x34')]=_[_0xbb9f('0x35')](_0xa1026a[_0xbb9f('0x34')]);_0x1173d8[_0xbb9f('0x36')]=_[_0xbb9f('0x37')](_0x1173d8[_0xbb9f('0x33')],_0x1173d8['query']);_0x581e0c[_0xbb9f('0x38')]=_['intersection'](_0x1173d8[_0xbb9f('0x33')],qs['fields'](_0xa1026a[_0xbb9f('0x34')]['fields']));_0x581e0c[_0xbb9f('0x38')]=_0x581e0c[_0xbb9f('0x38')][_0xbb9f('0x39')]?_0x581e0c[_0xbb9f('0x38')]:_0x1173d8['model'];if(!_0xa1026a['query']['hasOwnProperty'](_0xbb9f('0x3a'))){_0x581e0c[_0xbb9f('0x20')]=qs['limit'](_0xa1026a[_0xbb9f('0x34')][_0xbb9f('0x20')]);_0x581e0c[_0xbb9f('0x1e')]=qs[_0xbb9f('0x1e')](_0xa1026a[_0xbb9f('0x34')]['offset']);}_0x581e0c['order']=qs[_0xbb9f('0x3b')](_0xa1026a[_0xbb9f('0x34')][_0xbb9f('0x3b')]);_0x581e0c[_0xbb9f('0x3c')]=qs[_0xbb9f('0x36')](_[_0xbb9f('0x3d')](_0xa1026a[_0xbb9f('0x34')],_0x1173d8[_0xbb9f('0x36')]),_0x506ef5);if(_0xa1026a[_0xbb9f('0x34')]['filter']){_0x581e0c['where']=_['merge'](_0x581e0c['where'],{'$or':_[_0xbb9f('0x30')](_0x506ef5,function(_0x54c016){if(_0x54c016[_0xbb9f('0x31')]!==_0xbb9f('0x3e')){var _0x22322c={};_0x22322c[_0x54c016['name']]={'$like':'%'+_0xa1026a[_0xbb9f('0x34')][_0xbb9f('0x3f')]+'%'};return _0x22322c;}})});}_0x581e0c=_[_0xbb9f('0x40')]({},_0x581e0c,_0xa1026a['options']);var _0x5a18e0={'where':_0x581e0c[_0xbb9f('0x3c')]};return db[_0xbb9f('0x41')][_0xbb9f('0x21')](_0x5a18e0)[_0xbb9f('0x28')](function(_0x15f8df){_0x14fe35[_0xbb9f('0x21')]=_0x15f8df;if(_0xa1026a[_0xbb9f('0x34')]['includeAll']){_0x581e0c['include']=[{'all':!![]}];}return db['ChatGroup'][_0xbb9f('0x42')](_0x581e0c);})['then'](function(_0x45bbe7){_0x14fe35[_0xbb9f('0x43')]=_0x45bbe7;return _0x14fe35;})[_0xbb9f('0x28')](respondWithFilteredResult(_0x1e6c1f,_0x581e0c))[_0xbb9f('0x44')](handleError(_0x1e6c1f,null));};exports[_0xbb9f('0x45')]=function(_0x3df174,_0x592dd2){var _0x5d8264={'raw':!![],'where':{'id':_0x3df174[_0xbb9f('0x46')]['id']}},_0x28b0f5={};_0x28b0f5['model']=_[_0xbb9f('0x35')](db[_0xbb9f('0x41')][_0xbb9f('0x47')]);_0x28b0f5[_0xbb9f('0x34')]=_[_0xbb9f('0x35')](_0x3df174[_0xbb9f('0x34')]);_0x28b0f5['filters']=_[_0xbb9f('0x37')](_0x28b0f5['model'],_0x28b0f5['query']);_0x5d8264['attributes']=_['intersection'](_0x28b0f5['model'],qs[_0xbb9f('0x48')](_0x3df174[_0xbb9f('0x34')][_0xbb9f('0x48')]));_0x5d8264[_0xbb9f('0x38')]=_0x5d8264[_0xbb9f('0x38')][_0xbb9f('0x39')]?_0x5d8264[_0xbb9f('0x38')]:_0x28b0f5[_0xbb9f('0x33')];if(_0x3df174[_0xbb9f('0x34')][_0xbb9f('0x49')]){_0x5d8264['include']=[{'all':!![]}];}_0x5d8264=_[_0xbb9f('0x40')]({},_0x5d8264,_0x3df174[_0xbb9f('0x4a')]);return db['ChatGroup'][_0xbb9f('0x4b')](_0x5d8264)['then'](handleEntityNotFound(_0x592dd2,null))[_0xbb9f('0x28')](respondWithResult(_0x592dd2,null))['catch'](handleError(_0x592dd2,null));};exports[_0xbb9f('0x4c')]=function(_0x392647,_0x53984f){return db['ChatGroup'][_0xbb9f('0x4c')](_0x392647[_0xbb9f('0x4d')],{})[_0xbb9f('0x28')](respondWithResult(_0x53984f,0xc9))[_0xbb9f('0x44')](handleError(_0x53984f,null));};exports[_0xbb9f('0x27')]=function(_0xe5bb4,_0x2a14ec){if(_0xe5bb4['body']['id']){delete _0xe5bb4[_0xbb9f('0x4d')]['id'];}return db['ChatGroup'][_0xbb9f('0x4b')]({'where':{'id':_0xe5bb4[_0xbb9f('0x46')]['id']}})[_0xbb9f('0x28')](handleEntityNotFound(_0x2a14ec,null))['then'](saveUpdates(_0xe5bb4[_0xbb9f('0x4d')],null))[_0xbb9f('0x28')](respondWithResult(_0x2a14ec,null))[_0xbb9f('0x44')](handleError(_0x2a14ec,null));};exports['destroy']=function(_0x4c894f,_0x5ddc70){return db['ChatGroup'][_0xbb9f('0x4b')]({'where':{'id':_0x4c894f[_0xbb9f('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ddc70,null))[_0xbb9f('0x28')](removeEntity(_0x5ddc70,null))['catch'](handleError(_0x5ddc70,null));};exports[_0xbb9f('0x4e')]=function(_0x12c541,_0x487953){return db[_0xbb9f('0x41')][_0xbb9f('0x4e')]()[_0xbb9f('0x28')](respondWithResult(_0x487953,null))[_0xbb9f('0x44')](handleError(_0x487953,null));};exports[_0xbb9f('0x4f')]=function(_0x557a1c,_0x574d64,_0x30fe10){return db[_0xbb9f('0x50')]['count']({'where':{'ChatGroupId':_0x557a1c['params']['id'],'ToId':_0x557a1c['user']['id'],'read':![]}})['then'](function(_0x2d5e80){return{'id':_[_0xbb9f('0x51')](_0x557a1c[_0xbb9f('0x46')]['id']),'count':_0x2d5e80};})[_0xbb9f('0x28')](respondWithResult(_0x574d64,null))[_0xbb9f('0x44')](handleError(_0x574d64,null));};exports['addMembers']=function(_0x2fbcd,_0x14910e,_0x55c4d9){return db[_0xbb9f('0x41')][_0xbb9f('0x4b')]({'where':{'id':_0x2fbcd[_0xbb9f('0x46')]['id']}})[_0xbb9f('0x28')](handleEntityNotFound(_0x14910e,null))[_0xbb9f('0x28')](function(_0x5245bd){if(_0x5245bd){return _0x5245bd['addMembers'](_0x2fbcd[_0xbb9f('0x4d')][_0xbb9f('0x52')],_[_0xbb9f('0x53')](_0x2fbcd[_0xbb9f('0x4d')],[_0xbb9f('0x52'),'id'])||{});}})[_0xbb9f('0x28')](respondWithResult(_0x14910e,null))[_0xbb9f('0x44')](handleError(_0x14910e,null));};exports[_0xbb9f('0x54')]=function(_0x536190,_0x349cf6,_0x282c35){var _0x17aa28={};var _0x1ec0b8={};var _0x5a1220;var _0x3d6542;return db[_0xbb9f('0x41')][_0xbb9f('0x55')]({'where':{'id':_0x536190['params']['id']}})[_0xbb9f('0x28')](handleEntityNotFound(_0x349cf6,null))[_0xbb9f('0x28')](function(_0x550338){if(_0x550338){_0x5a1220=_0x550338;_0x1ec0b8[_0xbb9f('0x33')]=_[_0xbb9f('0x35')](db[_0xbb9f('0x56')][_0xbb9f('0x47')]);_0x1ec0b8['query']=_['keys'](_0x536190[_0xbb9f('0x34')]);_0x1ec0b8[_0xbb9f('0x36')]=_[_0xbb9f('0x37')](_0x1ec0b8['model'],_0x1ec0b8[_0xbb9f('0x34')]);_0x17aa28['attributes']=_['intersection'](_0x1ec0b8[_0xbb9f('0x33')],qs[_0xbb9f('0x48')](_0x536190[_0xbb9f('0x34')][_0xbb9f('0x48')]));_0x17aa28[_0xbb9f('0x38')]=_0x17aa28[_0xbb9f('0x38')][_0xbb9f('0x39')]?_0x17aa28[_0xbb9f('0x38')]:_0x1ec0b8['model'];_0x17aa28[_0xbb9f('0x57')]=qs['sort'](_0x536190[_0xbb9f('0x34')]['sort']);_0x17aa28[_0xbb9f('0x3c')]=qs['filters'](_[_0xbb9f('0x3d')](_0x536190[_0xbb9f('0x34')],_0x1ec0b8[_0xbb9f('0x36')]));if(_0x536190[_0xbb9f('0x34')][_0xbb9f('0x3f')]){_0x17aa28[_0xbb9f('0x3c')]=_['merge'](_0x17aa28[_0xbb9f('0x3c')],{'$or':_[_0xbb9f('0x30')](_0x17aa28['attributes'],function(_0x3916b3){var _0x1e4c37={};_0x1e4c37[_0x3916b3]={'$like':'%'+_0x536190[_0xbb9f('0x34')][_0xbb9f('0x3f')]+'%'};return _0x1e4c37;})});}_0x17aa28=_[_0xbb9f('0x40')]({},_0x17aa28,_0x536190[_0xbb9f('0x4a')]);return _0x5a1220['getMembers'](_0x17aa28);}})[_0xbb9f('0x28')](function(_0x4cfa86){if(_0x4cfa86){_0x3d6542=_0x4cfa86[_0xbb9f('0x39')];if(!_0x536190[_0xbb9f('0x34')][_0xbb9f('0x58')](_0xbb9f('0x3a'))){_0x17aa28[_0xbb9f('0x20')]=qs[_0xbb9f('0x20')](_0x536190[_0xbb9f('0x34')][_0xbb9f('0x20')]);_0x17aa28[_0xbb9f('0x1e')]=qs['offset'](_0x536190[_0xbb9f('0x34')][_0xbb9f('0x1e')]);}return _0x5a1220[_0xbb9f('0x54')](_0x17aa28);}})['then'](function(_0x36e49d){if(_0x36e49d){return _0x36e49d?{'count':_0x3d6542,'rows':_0x36e49d}:null;}})[_0xbb9f('0x28')](respondWithResult(_0x349cf6,null))[_0xbb9f('0x44')](handleError(_0x349cf6,null));};exports['removeMembers']=function(_0x226698,_0x59d9e9,_0x55ae78){return db[_0xbb9f('0x41')][_0xbb9f('0x4b')]({'where':{'id':_0x226698[_0xbb9f('0x46')]['id']}})['then'](handleEntityNotFound(_0x59d9e9,null))[_0xbb9f('0x28')](function(_0x514e70){if(_0x514e70){return _0x514e70[_0xbb9f('0x59')](_0x226698[_0xbb9f('0x34')][_0xbb9f('0x52')]);}})[_0xbb9f('0x28')](respondWithStatusCode(_0x59d9e9,null))[_0xbb9f('0x44')](handleError(_0x59d9e9,null));};exports[_0xbb9f('0x5a')]=function(_0x11dd00,_0x2835e0,_0x51f933){if(_0x11dd00[_0xbb9f('0x4d')]['id']){delete _0x11dd00[_0xbb9f('0x4d')]['id'];}return db[_0xbb9f('0x41')][_0xbb9f('0x4b')]({'where':{'id':_0x11dd00['params']['id']}})[_0xbb9f('0x28')](handleEntityNotFound(_0x2835e0,null))['then'](function(_0x138b18){if(_0x138b18){_0x11dd00['body'][_0xbb9f('0x5b')]=_0x138b18['id'];return db[_0xbb9f('0x50')][_0xbb9f('0x4c')](_0x11dd00[_0xbb9f('0x4d')]);}})[_0xbb9f('0x28')](respondWithResult(_0x2835e0,null))[_0xbb9f('0x44')](handleError(_0x2835e0,null));};exports[_0xbb9f('0x5c')]=function(_0x161e81,_0x4ed003,_0xa3d020){var _0x500d94={};var _0x23b03b={};var _0x4a7589;var _0x27f1f5;return db[_0xbb9f('0x41')]['findOne']({'where':{'id':_0x161e81[_0xbb9f('0x46')]['id']}})[_0xbb9f('0x28')](handleEntityNotFound(_0x4ed003,null))[_0xbb9f('0x28')](function(_0x322b52){if(_0x322b52){_0x4a7589=_0x322b52;_0x23b03b['model']=_[_0xbb9f('0x35')](db[_0xbb9f('0x50')][_0xbb9f('0x47')]);_0x23b03b[_0xbb9f('0x34')]=_[_0xbb9f('0x35')](_0x161e81[_0xbb9f('0x34')]);_0x23b03b[_0xbb9f('0x36')]=_[_0xbb9f('0x37')](_0x23b03b[_0xbb9f('0x33')],_0x23b03b[_0xbb9f('0x34')]);_0x500d94[_0xbb9f('0x38')]=_[_0xbb9f('0x37')](_0x23b03b[_0xbb9f('0x33')],qs[_0xbb9f('0x48')](_0x161e81[_0xbb9f('0x34')]['fields']));_0x500d94[_0xbb9f('0x38')]=_0x500d94[_0xbb9f('0x38')][_0xbb9f('0x39')]?_0x500d94[_0xbb9f('0x38')]:_0x23b03b[_0xbb9f('0x33')];_0x500d94['order']=qs[_0xbb9f('0x3b')](_0x161e81[_0xbb9f('0x34')][_0xbb9f('0x3b')]);_0x500d94[_0xbb9f('0x3c')]=qs['filters'](_['pick'](_0x161e81[_0xbb9f('0x34')],_0x23b03b['filters']));if(_0x161e81[_0xbb9f('0x34')][_0xbb9f('0x3f')]){_0x500d94[_0xbb9f('0x3c')]=_[_0xbb9f('0x40')](_0x500d94[_0xbb9f('0x3c')],{'$or':_[_0xbb9f('0x30')](_0x500d94[_0xbb9f('0x38')],function(_0x1d4da9){var _0xb2f9a9={};_0xb2f9a9[_0x1d4da9]={'$like':'%'+_0x161e81[_0xbb9f('0x34')][_0xbb9f('0x3f')]+'%'};return _0xb2f9a9;})});}if(_0x161e81[_0xbb9f('0x34')][_0xbb9f('0x5d')]){var _0x471aaf=_0x161e81[_0xbb9f('0x34')][_0xbb9f('0x5d')][_0xbb9f('0x5e')](',');var _0x27fbe3={};_0x27fbe3[_0x471aaf[0x0]]={'$gte':moment(_0x471aaf[0x1])[_0xbb9f('0x5f')](_0xbb9f('0x60'))};_0x500d94[_0xbb9f('0x3c')]=_[_0xbb9f('0x40')](_0x500d94['where'],_0x27fbe3);}_0x500d94=_[_0xbb9f('0x40')]({},_0x500d94,_0x161e81[_0xbb9f('0x4a')]);return _0x4a7589[_0xbb9f('0x5c')](_0x500d94);}})['then'](function(_0x20e96a){if(_0x20e96a){_0x27f1f5=_0x20e96a[_0xbb9f('0x39')];if(!_0x161e81[_0xbb9f('0x34')]['hasOwnProperty'](_0xbb9f('0x3a'))){_0x500d94['limit']=qs['limit'](_0x161e81['query'][_0xbb9f('0x20')]);_0x500d94[_0xbb9f('0x1e')]=qs[_0xbb9f('0x1e')](_0x161e81['query'][_0xbb9f('0x1e')]);}return _0x4a7589[_0xbb9f('0x5c')](_0x500d94);}})[_0xbb9f('0x28')](function(_0x10d092){if(_0x10d092){return _0x10d092?{'count':_0x27f1f5,'rows':_0x10d092}:null;}})[_0xbb9f('0x28')](respondWithResult(_0x4ed003,null))[_0xbb9f('0x44')](handleError(_0x4ed003,null));}; \ No newline at end of file +var _0xbd02=['getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','User','order','hasOwnProperty','nolimit','getMembers','removeMembers','addMessage','findOne','$gte','split','format','getMessages','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./chatGroup.socket','end','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','create','body','find','describe'];(function(_0x6651c3,_0x13210f){var _0x3d1598=function(_0x53dc1c){while(--_0x53dc1c){_0x6651c3['push'](_0x6651c3['shift']());}};_0x3d1598(++_0x13210f);}(_0xbd02,0xcd));var _0x2bd0=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xbd02[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x2bd0('0x0'));var rimraf=require(_0x2bd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2bd0('0x2'));var moment=require(_0x2bd0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2bd0('0x4'));var util=require(_0x2bd0('0x5'));var path=require(_0x2bd0('0x6'));var sox=require(_0x2bd0('0x7'));var csv=require('to-csv');var ejs=require(_0x2bd0('0x8'));var fs=require('fs');var fs_extra=require(_0x2bd0('0x9'));var _=require('lodash');var squel=require(_0x2bd0('0xa'));var crypto=require(_0x2bd0('0xb'));var jsforce=require(_0x2bd0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2bd0('0xd'));var querystring=require(_0x2bd0('0xe'));var Papa=require(_0x2bd0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2bd0('0x10'));var as=require(_0x2bd0('0x11'));var hardwareService=require(_0x2bd0('0x12'));var logger=require(_0x2bd0('0x13'))(_0x2bd0('0x14'));var utils=require(_0x2bd0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2bd0('0x16'));var db=require('../../mysqldb')['db'];config[_0x2bd0('0x17')]=_[_0x2bd0('0x18')](config[_0x2bd0('0x17')],{'host':_0x2bd0('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2bd0('0x17')]));require(_0x2bd0('0x1a'))['register'](socket);function respondWithStatusCode(_0x10aba5,_0x5088bb){_0x5088bb=_0x5088bb||0xcc;return function(_0x158a06){if(_0x158a06){return _0x10aba5['sendStatus'](_0x5088bb);}return _0x10aba5['status'](_0x5088bb)[_0x2bd0('0x1b')]();};}function respondWithResult(_0x25f79c,_0x20e975){_0x20e975=_0x20e975||0xc8;return function(_0x50df73){if(_0x50df73){return _0x25f79c[_0x2bd0('0x1c')](_0x20e975)[_0x2bd0('0x1d')](_0x50df73);}};}function respondWithFilteredResult(_0x54dc78,_0x52b4a3){return function(_0x411b38){if(_0x411b38){var _0x297d44=typeof _0x52b4a3[_0x2bd0('0x1e')]===_0x2bd0('0x1f')&&typeof _0x52b4a3[_0x2bd0('0x20')]===_0x2bd0('0x1f');var _0x1db952=_0x411b38[_0x2bd0('0x21')];var _0x472c33=_0x297d44?0x0:_0x52b4a3[_0x2bd0('0x1e')];var _0xbf0771=_0x297d44?_0x411b38[_0x2bd0('0x21')]:_0x52b4a3[_0x2bd0('0x1e')]+_0x52b4a3[_0x2bd0('0x20')];var _0x509efb;if(_0xbf0771>=_0x1db952){_0xbf0771=_0x1db952;_0x509efb=0xc8;}else{_0x509efb=0xce;}_0x54dc78[_0x2bd0('0x1c')](_0x509efb);return _0x54dc78[_0x2bd0('0x22')]('Content-Range',_0x472c33+'-'+_0xbf0771+'/'+_0x1db952)['json'](_0x411b38);}return null;};}function patchUpdates(_0x2c5f65){return function(_0x31722f){try{jsonpatch[_0x2bd0('0x23')](_0x31722f,_0x2c5f65,!![]);}catch(_0x991c5){return BPromise['reject'](_0x991c5);}return _0x31722f[_0x2bd0('0x24')]();};}function saveUpdates(_0x5e7fd0,_0x4b486e){return function(_0x1aa0c5){if(_0x1aa0c5){return _0x1aa0c5[_0x2bd0('0x25')](_0x5e7fd0)['then'](function(_0x4b9a90){return _0x4b9a90;});}return null;};}function removeEntity(_0x493985,_0x42c85e){return function(_0x233412){if(_0x233412){return _0x233412[_0x2bd0('0x26')]()[_0x2bd0('0x27')](function(){_0x493985[_0x2bd0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c5de,_0x3a6d55){return function(_0x404e05){if(!_0x404e05){_0x34c5de[_0x2bd0('0x28')](0x194);}return _0x404e05;};}function handleError(_0x2b4f29,_0x197ef4){_0x197ef4=_0x197ef4||0x1f4;return function(_0x5c49d3){logger[_0x2bd0('0x29')](_0x5c49d3[_0x2bd0('0x2a')]);if(_0x5c49d3[_0x2bd0('0x2b')]){delete _0x5c49d3['name'];}_0x2b4f29[_0x2bd0('0x1c')](_0x197ef4)[_0x2bd0('0x2c')](_0x5c49d3);};}exports[_0x2bd0('0x2d')]=function(_0x56124c,_0x45be09){var _0x1fb9b7={},_0x10abac={},_0x267c73={'count':0x0,'rows':[]};var _0x3fbc5f=_[_0x2bd0('0x2e')](db[_0x2bd0('0x2f')][_0x2bd0('0x30')],function(_0x57243e){return{'name':_0x57243e['fieldName'],'type':_0x57243e[_0x2bd0('0x31')]['key']};});_0x10abac[_0x2bd0('0x32')]=_[_0x2bd0('0x2e')](_0x3fbc5f,'name');_0x10abac['query']=_[_0x2bd0('0x33')](_0x56124c[_0x2bd0('0x34')]);_0x10abac[_0x2bd0('0x35')]=_[_0x2bd0('0x36')](_0x10abac[_0x2bd0('0x32')],_0x10abac[_0x2bd0('0x34')]);_0x1fb9b7['attributes']=_[_0x2bd0('0x36')](_0x10abac[_0x2bd0('0x32')],qs[_0x2bd0('0x37')](_0x56124c['query'][_0x2bd0('0x37')]));_0x1fb9b7[_0x2bd0('0x38')]=_0x1fb9b7['attributes'][_0x2bd0('0x39')]?_0x1fb9b7[_0x2bd0('0x38')]:_0x10abac[_0x2bd0('0x32')];if(!_0x56124c[_0x2bd0('0x34')]['hasOwnProperty']('nolimit')){_0x1fb9b7['limit']=qs['limit'](_0x56124c[_0x2bd0('0x34')][_0x2bd0('0x20')]);_0x1fb9b7[_0x2bd0('0x1e')]=qs['offset'](_0x56124c[_0x2bd0('0x34')][_0x2bd0('0x1e')]);}_0x1fb9b7['order']=qs[_0x2bd0('0x3a')](_0x56124c[_0x2bd0('0x34')][_0x2bd0('0x3a')]);_0x1fb9b7[_0x2bd0('0x3b')]=qs['filters'](_[_0x2bd0('0x3c')](_0x56124c[_0x2bd0('0x34')],_0x10abac[_0x2bd0('0x35')]),_0x3fbc5f);if(_0x56124c['query']['filter']){_0x1fb9b7[_0x2bd0('0x3b')]=_[_0x2bd0('0x3d')](_0x1fb9b7['where'],{'$or':_['map'](_0x3fbc5f,function(_0x279b97){if(_0x279b97[_0x2bd0('0x31')]!==_0x2bd0('0x3e')){var _0x4f88c3={};_0x4f88c3[_0x279b97['name']]={'$like':'%'+_0x56124c[_0x2bd0('0x34')][_0x2bd0('0x3f')]+'%'};return _0x4f88c3;}})});}_0x1fb9b7=_[_0x2bd0('0x3d')]({},_0x1fb9b7,_0x56124c[_0x2bd0('0x40')]);var _0x57c69d={'where':_0x1fb9b7[_0x2bd0('0x3b')]};return db[_0x2bd0('0x2f')][_0x2bd0('0x21')](_0x57c69d)[_0x2bd0('0x27')](function(_0x33e015){_0x267c73[_0x2bd0('0x21')]=_0x33e015;if(_0x56124c[_0x2bd0('0x34')][_0x2bd0('0x41')]){_0x1fb9b7[_0x2bd0('0x42')]=[{'all':!![]}];}return db[_0x2bd0('0x2f')][_0x2bd0('0x43')](_0x1fb9b7);})[_0x2bd0('0x27')](function(_0x4b8ee4){_0x267c73['rows']=_0x4b8ee4;return _0x267c73;})[_0x2bd0('0x27')](respondWithFilteredResult(_0x45be09,_0x1fb9b7))[_0x2bd0('0x44')](handleError(_0x45be09,null));};exports['show']=function(_0x35c505,_0x4aa966){var _0x598db7={'raw':!![],'where':{'id':_0x35c505[_0x2bd0('0x45')]['id']}},_0x2cd0b4={};_0x2cd0b4[_0x2bd0('0x32')]=_['keys'](db[_0x2bd0('0x2f')][_0x2bd0('0x30')]);_0x2cd0b4[_0x2bd0('0x34')]=_[_0x2bd0('0x33')](_0x35c505[_0x2bd0('0x34')]);_0x2cd0b4['filters']=_[_0x2bd0('0x36')](_0x2cd0b4[_0x2bd0('0x32')],_0x2cd0b4['query']);_0x598db7[_0x2bd0('0x38')]=_[_0x2bd0('0x36')](_0x2cd0b4['model'],qs[_0x2bd0('0x37')](_0x35c505[_0x2bd0('0x34')]['fields']));_0x598db7[_0x2bd0('0x38')]=_0x598db7[_0x2bd0('0x38')][_0x2bd0('0x39')]?_0x598db7[_0x2bd0('0x38')]:_0x2cd0b4[_0x2bd0('0x32')];if(_0x35c505[_0x2bd0('0x34')]['includeAll']){_0x598db7[_0x2bd0('0x42')]=[{'all':!![]}];}_0x598db7=_['merge']({},_0x598db7,_0x35c505[_0x2bd0('0x40')]);return db[_0x2bd0('0x2f')]['find'](_0x598db7)[_0x2bd0('0x27')](handleEntityNotFound(_0x4aa966,null))['then'](respondWithResult(_0x4aa966,null))[_0x2bd0('0x44')](handleError(_0x4aa966,null));};exports[_0x2bd0('0x46')]=function(_0x5819fe,_0x39297c){return db['ChatGroup'][_0x2bd0('0x46')](_0x5819fe[_0x2bd0('0x47')],{})[_0x2bd0('0x27')](respondWithResult(_0x39297c,0xc9))[_0x2bd0('0x44')](handleError(_0x39297c,null));};exports[_0x2bd0('0x25')]=function(_0x25e581,_0x37d712){if(_0x25e581[_0x2bd0('0x47')]['id']){delete _0x25e581[_0x2bd0('0x47')]['id'];}return db[_0x2bd0('0x2f')][_0x2bd0('0x48')]({'where':{'id':_0x25e581[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x37d712,null))[_0x2bd0('0x27')](saveUpdates(_0x25e581['body'],null))[_0x2bd0('0x27')](respondWithResult(_0x37d712,null))[_0x2bd0('0x44')](handleError(_0x37d712,null));};exports['destroy']=function(_0x47a0c6,_0x1d5c27){return db[_0x2bd0('0x2f')][_0x2bd0('0x48')]({'where':{'id':_0x47a0c6[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x1d5c27,null))[_0x2bd0('0x27')](removeEntity(_0x1d5c27,null))[_0x2bd0('0x44')](handleError(_0x1d5c27,null));};exports[_0x2bd0('0x49')]=function(_0x124fcf,_0x554253){return db[_0x2bd0('0x2f')]['describe']()[_0x2bd0('0x27')](respondWithResult(_0x554253,null))['catch'](handleError(_0x554253,null));};exports[_0x2bd0('0x4a')]=function(_0x469230,_0xabe037,_0x1bc2d3){return db[_0x2bd0('0x4b')][_0x2bd0('0x21')]({'where':{'ChatGroupId':_0x469230[_0x2bd0('0x45')]['id'],'ToId':_0x469230[_0x2bd0('0x4c')]['id'],'read':![]}})[_0x2bd0('0x27')](function(_0x1c2108){return{'id':_[_0x2bd0('0x4d')](_0x469230[_0x2bd0('0x45')]['id']),'count':_0x1c2108};})[_0x2bd0('0x27')](respondWithResult(_0xabe037,null))[_0x2bd0('0x44')](handleError(_0xabe037,null));};exports[_0x2bd0('0x4e')]=function(_0x3c1bfe,_0x191b9d,_0x3c7165){return db[_0x2bd0('0x2f')][_0x2bd0('0x48')]({'where':{'id':_0x3c1bfe[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x191b9d,null))[_0x2bd0('0x27')](function(_0x53f3b9){if(_0x53f3b9){return _0x53f3b9['addMembers'](_0x3c1bfe[_0x2bd0('0x47')][_0x2bd0('0x4f')],_[_0x2bd0('0x50')](_0x3c1bfe[_0x2bd0('0x47')],[_0x2bd0('0x4f'),'id'])||{});}})[_0x2bd0('0x27')](respondWithResult(_0x191b9d,null))[_0x2bd0('0x44')](handleError(_0x191b9d,null));};exports['getMembers']=function(_0x106e20,_0x59fe59,_0x1ea6cb){var _0x2660a0={};var _0xee17cf={};var _0x3bf848;var _0x3832fe;return db[_0x2bd0('0x2f')]['findOne']({'where':{'id':_0x106e20[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x59fe59,null))[_0x2bd0('0x27')](function(_0x5a269e){if(_0x5a269e){_0x3bf848=_0x5a269e;_0xee17cf[_0x2bd0('0x32')]=_[_0x2bd0('0x33')](db[_0x2bd0('0x51')][_0x2bd0('0x30')]);_0xee17cf[_0x2bd0('0x34')]=_[_0x2bd0('0x33')](_0x106e20[_0x2bd0('0x34')]);_0xee17cf[_0x2bd0('0x35')]=_[_0x2bd0('0x36')](_0xee17cf[_0x2bd0('0x32')],_0xee17cf['query']);_0x2660a0[_0x2bd0('0x38')]=_[_0x2bd0('0x36')](_0xee17cf['model'],qs[_0x2bd0('0x37')](_0x106e20[_0x2bd0('0x34')]['fields']));_0x2660a0[_0x2bd0('0x38')]=_0x2660a0[_0x2bd0('0x38')][_0x2bd0('0x39')]?_0x2660a0['attributes']:_0xee17cf[_0x2bd0('0x32')];_0x2660a0[_0x2bd0('0x52')]=qs['sort'](_0x106e20[_0x2bd0('0x34')][_0x2bd0('0x3a')]);_0x2660a0[_0x2bd0('0x3b')]=qs[_0x2bd0('0x35')](_[_0x2bd0('0x3c')](_0x106e20[_0x2bd0('0x34')],_0xee17cf[_0x2bd0('0x35')]));if(_0x106e20['query'][_0x2bd0('0x3f')]){_0x2660a0[_0x2bd0('0x3b')]=_[_0x2bd0('0x3d')](_0x2660a0[_0x2bd0('0x3b')],{'$or':_[_0x2bd0('0x2e')](_0x2660a0[_0x2bd0('0x38')],function(_0x30ba61){var _0x2b313d={};_0x2b313d[_0x30ba61]={'$like':'%'+_0x106e20['query'][_0x2bd0('0x3f')]+'%'};return _0x2b313d;})});}_0x2660a0=_['merge']({},_0x2660a0,_0x106e20[_0x2bd0('0x40')]);return _0x3bf848['getMembers'](_0x2660a0);}})[_0x2bd0('0x27')](function(_0x582e2a){if(_0x582e2a){_0x3832fe=_0x582e2a['length'];if(!_0x106e20[_0x2bd0('0x34')][_0x2bd0('0x53')](_0x2bd0('0x54'))){_0x2660a0[_0x2bd0('0x20')]=qs[_0x2bd0('0x20')](_0x106e20['query'][_0x2bd0('0x20')]);_0x2660a0[_0x2bd0('0x1e')]=qs['offset'](_0x106e20[_0x2bd0('0x34')][_0x2bd0('0x1e')]);}return _0x3bf848[_0x2bd0('0x55')](_0x2660a0);}})[_0x2bd0('0x27')](function(_0x1a8889){if(_0x1a8889){return _0x1a8889?{'count':_0x3832fe,'rows':_0x1a8889}:null;}})['then'](respondWithResult(_0x59fe59,null))[_0x2bd0('0x44')](handleError(_0x59fe59,null));};exports[_0x2bd0('0x56')]=function(_0x53845f,_0x4e8790,_0x2071fd){return db[_0x2bd0('0x2f')][_0x2bd0('0x48')]({'where':{'id':_0x53845f[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x4e8790,null))[_0x2bd0('0x27')](function(_0x2ea2fe){if(_0x2ea2fe){return _0x2ea2fe[_0x2bd0('0x56')](_0x53845f[_0x2bd0('0x34')][_0x2bd0('0x4f')]);}})['then'](respondWithStatusCode(_0x4e8790,null))['catch'](handleError(_0x4e8790,null));};exports[_0x2bd0('0x57')]=function(_0x2be007,_0x194fb1,_0x4f420d){if(_0x2be007[_0x2bd0('0x47')]['id']){delete _0x2be007['body']['id'];}return db[_0x2bd0('0x2f')][_0x2bd0('0x48')]({'where':{'id':_0x2be007[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x194fb1,null))[_0x2bd0('0x27')](function(_0x3648b2){if(_0x3648b2){_0x2be007[_0x2bd0('0x47')]['ChatGroupId']=_0x3648b2['id'];return db[_0x2bd0('0x4b')]['create'](_0x2be007[_0x2bd0('0x47')]);}})[_0x2bd0('0x27')](respondWithResult(_0x194fb1,null))[_0x2bd0('0x44')](handleError(_0x194fb1,null));};exports['getMessages']=function(_0x58c90c,_0x339aa7,_0xfbff77){var _0x524bfb={};var _0xea3039={};var _0x5e9640;var _0x42bf9f;return db[_0x2bd0('0x2f')][_0x2bd0('0x58')]({'where':{'id':_0x58c90c[_0x2bd0('0x45')]['id']}})['then'](handleEntityNotFound(_0x339aa7,null))[_0x2bd0('0x27')](function(_0x565ca7){if(_0x565ca7){_0x5e9640=_0x565ca7;_0xea3039[_0x2bd0('0x32')]=_[_0x2bd0('0x33')](db['ChatInternalMessage'][_0x2bd0('0x30')]);_0xea3039[_0x2bd0('0x34')]=_[_0x2bd0('0x33')](_0x58c90c[_0x2bd0('0x34')]);_0xea3039[_0x2bd0('0x35')]=_[_0x2bd0('0x36')](_0xea3039['model'],_0xea3039[_0x2bd0('0x34')]);_0x524bfb[_0x2bd0('0x38')]=_['intersection'](_0xea3039[_0x2bd0('0x32')],qs[_0x2bd0('0x37')](_0x58c90c[_0x2bd0('0x34')][_0x2bd0('0x37')]));_0x524bfb[_0x2bd0('0x38')]=_0x524bfb[_0x2bd0('0x38')]['length']?_0x524bfb[_0x2bd0('0x38')]:_0xea3039[_0x2bd0('0x32')];_0x524bfb['order']=qs[_0x2bd0('0x3a')](_0x58c90c['query'][_0x2bd0('0x3a')]);_0x524bfb[_0x2bd0('0x3b')]=qs['filters'](_['pick'](_0x58c90c['query'],_0xea3039['filters']));if(_0x58c90c['query'][_0x2bd0('0x3f')]){_0x524bfb[_0x2bd0('0x3b')]=_[_0x2bd0('0x3d')](_0x524bfb[_0x2bd0('0x3b')],{'$or':_[_0x2bd0('0x2e')](_0x524bfb[_0x2bd0('0x38')],function(_0x50e538){var _0x52a566={};_0x52a566[_0x50e538]={'$like':'%'+_0x58c90c[_0x2bd0('0x34')]['filter']+'%'};return _0x52a566;})});}if(_0x58c90c[_0x2bd0('0x34')][_0x2bd0('0x59')]){var _0x22f69c=_0x58c90c[_0x2bd0('0x34')]['$gte'][_0x2bd0('0x5a')](',');var _0x2eadaa={};_0x2eadaa[_0x22f69c[0x0]]={'$gte':moment(_0x22f69c[0x1])[_0x2bd0('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x524bfb[_0x2bd0('0x3b')]=_[_0x2bd0('0x3d')](_0x524bfb[_0x2bd0('0x3b')],_0x2eadaa);}_0x524bfb=_['merge']({},_0x524bfb,_0x58c90c[_0x2bd0('0x40')]);return _0x5e9640[_0x2bd0('0x5c')](_0x524bfb);}})['then'](function(_0x315a57){if(_0x315a57){_0x42bf9f=_0x315a57[_0x2bd0('0x39')];if(!_0x58c90c['query'][_0x2bd0('0x53')](_0x2bd0('0x54'))){_0x524bfb['limit']=qs[_0x2bd0('0x20')](_0x58c90c[_0x2bd0('0x34')][_0x2bd0('0x20')]);_0x524bfb['offset']=qs['offset'](_0x58c90c['query'][_0x2bd0('0x1e')]);}return _0x5e9640[_0x2bd0('0x5c')](_0x524bfb);}})[_0x2bd0('0x27')](function(_0x496cad){if(_0x496cad){return _0x496cad?{'count':_0x42bf9f,'rows':_0x496cad}:null;}})[_0x2bd0('0x27')](respondWithResult(_0x339aa7,null))[_0x2bd0('0x44')](handleError(_0x339aa7,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 00c7340..b72b3da 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 _0x71d5=['exports','events','../../mysqldb','save','update','remove','emit','hook'];(function(_0x418873,_0x7ea982){var _0x13e827=function(_0x3219c7){while(--_0x3219c7){_0x418873['push'](_0x418873['shift']());}};_0x13e827(++_0x7ea982);}(_0x71d5,0x109));var _0x571d=function(_0x70fe73,_0x435a10){_0x70fe73=_0x70fe73-0x0;var _0x3af159=_0x71d5[_0x70fe73];return _0x3af159;};'use strict';var EventEmitter=require(_0x571d('0x0'));var ChatGroup=require(_0x571d('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x571d('0x2'),'afterUpdate':_0x571d('0x3'),'afterDestroy':_0x571d('0x4')};function emitEvent(_0x35cc55){return function(_0x342aea,_0x43309c,_0x249173){ChatGroupEvents[_0x571d('0x5')](_0x35cc55+':'+_0x342aea['id'],_0x342aea);ChatGroupEvents[_0x571d('0x5')](_0x35cc55,_0x342aea);_0x249173(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x571d('0x6')](e,emitEvent(event));}}module[_0x571d('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x9f37=['../../mysqldb','setMaxListeners','remove','emit','hook','exports','events'];(function(_0x1aa2e4,_0x3e5637){var _0x11da92=function(_0x585f){while(--_0x585f){_0x1aa2e4['push'](_0x1aa2e4['shift']());}};_0x11da92(++_0x3e5637);}(_0x9f37,0xd1));var _0x79f3=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x9f37[_0x2ec461];return _0x28603d;};'use strict';var EventEmitter=require(_0x79f3('0x0'));var ChatGroup=require(_0x79f3('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x79f3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x79f3('0x3')};function emitEvent(_0x3c3d35){return function(_0x4b11da,_0x599d3a,_0x361808){ChatGroupEvents[_0x79f3('0x4')](_0x3c3d35+':'+_0x4b11da['id'],_0x4b11da);ChatGroupEvents['emit'](_0x3c3d35,_0x4b11da);_0x361808(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x79f3('0x5')](e,emitEvent(event));}}module[_0x79f3('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 8157e6b..f9f0330 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 _0x9f48=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x1a4b42,_0x198645){var _0x4e78a9=function(_0x36b49b){while(--_0x36b49b){_0x1a4b42['push'](_0x1a4b42['shift']());}};_0x4e78a9(++_0x198645);}(_0x9f48,0x12b));var _0x89f4=function(_0x1f79f8,_0x4b68e7){_0x1f79f8=_0x1f79f8-0x0;var _0x21baa6=_0x9f48[_0x1f79f8];return _0x21baa6;};'use strict';var _=require(_0x89f4('0x0'));var util=require(_0x89f4('0x1'));var logger=require(_0x89f4('0x2'))(_0x89f4('0x3'));var moment=require(_0x89f4('0x4'));var BPromise=require(_0x89f4('0x5'));var rp=require(_0x89f4('0x6'));var fs=require('fs');var path=require(_0x89f4('0x7'));var rimraf=require(_0x89f4('0x8'));var config=require(_0x89f4('0x9'));var attributes=require(_0x89f4('0xa'));module[_0x89f4('0xb')]=function(_0xe31513,_0x16e561){return _0xe31513[_0x89f4('0xc')](_0x89f4('0xd'),attributes,{'tableName':_0x89f4('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8e5=['api','moment','bluebird','path','rimraf','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x51151b,_0x5c7800){var _0x4d9b66=function(_0x41ab5a){while(--_0x41ab5a){_0x51151b['push'](_0x51151b['shift']());}};_0x4d9b66(++_0x5c7800);}(_0xf8e5,0xae));var _0x5f8e=function(_0x2e36bf,_0x5e575e){_0x2e36bf=_0x2e36bf-0x0;var _0x51c5a6=_0xf8e5[_0x2e36bf];return _0x51c5a6;};'use strict';var _=require(_0x5f8e('0x0'));var util=require(_0x5f8e('0x1'));var logger=require('../../config/logger')(_0x5f8e('0x2'));var moment=require(_0x5f8e('0x3'));var BPromise=require(_0x5f8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f8e('0x5'));var rimraf=require(_0x5f8e('0x6'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0x5f8e('0x7')]=function(_0x5e396b,_0x2f7de5){return _0x5e396b[_0x5f8e('0x8')](_0x5f8e('0x9'),attributes,{'tableName':_0x5f8e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 995a302..eae1d10 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 _0xcb26=['stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','request\x20sent','debug'];(function(_0x5ec695,_0x398929){var _0xf7916f=function(_0x191030){while(--_0x191030){_0x5ec695['push'](_0x5ec695['shift']());}};_0xf7916f(++_0x398929);}(_0xcb26,0x14c));var _0x6cb2=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xcb26[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require('lodash');var util=require(_0x6cb2('0x0'));var moment=require(_0x6cb2('0x1'));var BPromise=require(_0x6cb2('0x2'));var rs=require(_0x6cb2('0x3'));var fs=require('fs');var Redis=require(_0x6cb2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6cb2('0x5'));var logger=require('../../config/logger')(_0x6cb2('0x6'));var config=require(_0x6cb2('0x7'));var jayson=require(_0x6cb2('0x8'));var client=jayson[_0x6cb2('0x9')][_0x6cb2('0xa')]({'port':0x232a});config[_0x6cb2('0xb')]=_['defaults'](config['redis'],{'host':_0x6cb2('0xc'),'port':0x18eb});var socket=require(_0x6cb2('0xd'))(new Redis(config[_0x6cb2('0xb')]));require(_0x6cb2('0xe'))['register'](socket);function respondWithRpcPromise(_0xb6f6ce,_0x369e9b,_0x24b927){return new BPromise(function(_0x436b8d,_0x59032f){return client[_0x6cb2('0xf')](_0xb6f6ce,_0x24b927)[_0x6cb2('0x10')](function(_0xa74087){logger['info']('ChatGroup,\x20%s,\x20%s',_0x369e9b,_0x6cb2('0x11'));logger[_0x6cb2('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x369e9b,'request\x20sent',JSON[_0x6cb2('0x13')](_0xa74087));if(_0xa74087[_0x6cb2('0x14')]){if(_0xa74087[_0x6cb2('0x14')][_0x6cb2('0x15')]===0x1f4){logger['error'](_0x6cb2('0x16'),_0x369e9b,_0xa74087['error']['message']);return _0x59032f(_0xa74087[_0x6cb2('0x14')]['message']);}logger[_0x6cb2('0x14')]('ChatGroup,\x20%s,\x20%s',_0x369e9b,_0xa74087[_0x6cb2('0x14')][_0x6cb2('0x17')]);return _0x436b8d(_0xa74087['error'][_0x6cb2('0x17')]);}else{logger[_0x6cb2('0x18')](_0x6cb2('0x16'),_0x369e9b,_0x6cb2('0x11'));_0x436b8d(_0xa74087[_0x6cb2('0x19')][_0x6cb2('0x17')]);}})[_0x6cb2('0x1a')](function(_0x4c7350){logger[_0x6cb2('0x14')](_0x6cb2('0x16'),_0x369e9b,_0x4c7350);_0x59032f(_0x4c7350);});});} \ No newline at end of file +var _0x40c2=['info','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then'];(function(_0x2ec7f2,_0xe24da3){var _0x29de00=function(_0x383338){while(--_0x383338){_0x2ec7f2['push'](_0x2ec7f2['shift']());}};_0x29de00(++_0xe24da3);}(_0x40c2,0x10d));var _0x240c=function(_0x1652b2,_0xebc432){_0x1652b2=_0x1652b2-0x0;var _0x45202c=_0x40c2[_0x1652b2];return _0x45202c;};'use strict';var _=require('lodash');var util=require(_0x240c('0x0'));var moment=require(_0x240c('0x1'));var BPromise=require(_0x240c('0x2'));var rs=require(_0x240c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x240c('0x4'));var logger=require(_0x240c('0x5'))(_0x240c('0x6'));var config=require(_0x240c('0x7'));var jayson=require(_0x240c('0x8'));var client=jayson[_0x240c('0x9')][_0x240c('0xa')]({'port':0x232a});config['redis']=_[_0x240c('0xb')](config[_0x240c('0xc')],{'host':_0x240c('0xd'),'port':0x18eb});var socket=require(_0x240c('0xe'))(new Redis(config[_0x240c('0xc')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x4305c6,_0x225111,_0x57a5df){return new BPromise(function(_0x586326,_0x51752a){return client[_0x240c('0xf')](_0x4305c6,_0x57a5df)[_0x240c('0x10')](function(_0xcb1aaf){logger[_0x240c('0x11')]('ChatGroup,\x20%s,\x20%s',_0x225111,'request\x20sent');logger[_0x240c('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x225111,'request\x20sent',JSON[_0x240c('0x13')](_0xcb1aaf));if(_0xcb1aaf[_0x240c('0x14')]){if(_0xcb1aaf[_0x240c('0x14')][_0x240c('0x15')]===0x1f4){logger[_0x240c('0x14')](_0x240c('0x16'),_0x225111,_0xcb1aaf['error'][_0x240c('0x17')]);return _0x51752a(_0xcb1aaf[_0x240c('0x14')][_0x240c('0x17')]);}logger[_0x240c('0x14')](_0x240c('0x16'),_0x225111,_0xcb1aaf[_0x240c('0x14')][_0x240c('0x17')]);return _0x586326(_0xcb1aaf[_0x240c('0x14')][_0x240c('0x17')]);}else{logger[_0x240c('0x11')](_0x240c('0x16'),_0x225111,'request\x20sent');_0x586326(_0xcb1aaf[_0x240c('0x18')]['message']);}})[_0x240c('0x19')](function(_0xfc1115){logger[_0x240c('0x14')](_0x240c('0x16'),_0x225111,_0xfc1115);_0x51752a(_0xfc1115);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 4eed723..6b0a190 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 _0x4563=['chatGroup:','./chatGroup.events','save','remove','update','register'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x4563,0x1b7));var _0x3456=function(_0x2d647e,_0x1c9fd5){_0x2d647e=_0x2d647e-0x0;var _0x42d7f9=_0x4563[_0x2d647e];return _0x42d7f9;};'use strict';var ChatGroupEvents=require(_0x3456('0x0'));var events=[_0x3456('0x1'),_0x3456('0x2'),_0x3456('0x3')];function createListener(_0x479832,_0x4e5e01){return function(_0x597637){_0x4e5e01['emit'](_0x479832,_0x597637);};}function removeListener(_0xf0eec0,_0x193c9d){return function(){ChatGroupEvents['removeListener'](_0xf0eec0,_0x193c9d);};}exports[_0x3456('0x4')]=function(_0x437225){for(var _0x5f4ecb=0x0,_0x46db1a=events['length'];_0x5f4ecb<_0x46db1a;_0x5f4ecb++){var _0x41527d=events[_0x5f4ecb];var _0x55c259=createListener(_0x3456('0x5')+_0x41527d,_0x437225);ChatGroupEvents['on'](_0x41527d,_0x55c259);}}; \ No newline at end of file +var _0xc558=['chatGroup:','save','remove','update'];(function(_0x16faaf,_0x4dc066){var _0x4611ec=function(_0x128a60){while(--_0x128a60){_0x16faaf['push'](_0x16faaf['shift']());}};_0x4611ec(++_0x4dc066);}(_0xc558,0x85));var _0x8c55=function(_0x272f82,_0x1de220){_0x272f82=_0x272f82-0x0;var _0x58506d=_0xc558[_0x272f82];return _0x58506d;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x8c55('0x0'),_0x8c55('0x1'),_0x8c55('0x2')];function createListener(_0x95195f,_0x1bdbc3){return function(_0x41ca9e){_0x1bdbc3['emit'](_0x95195f,_0x41ca9e);};}function removeListener(_0x3da635,_0x4f9ffd){return function(){ChatGroupEvents['removeListener'](_0x3da635,_0x4f9ffd);};}exports['register']=function(_0x27ea7e){for(var _0x5c653e=0x0,_0x2e227a=events['length'];_0x5c653e<_0x2e227a;_0x5c653e++){var _0x27a182=events[_0x5c653e];var _0x3fc842=createListener(_0x8c55('0x3')+_0x27a182,_0x27ea7e);ChatGroupEvents['on'](_0x27a182,_0x3fc842);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4a65fc2..ddab109 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 _0x0448=['./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','update','destroy','delete','removeMembers','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa514d2,_0x5a4ac2){var _0xc724b6=function(_0x2e9066){while(--_0x2e9066){_0xa514d2['push'](_0xa514d2['shift']());}};_0xc724b6(++_0x5a4ac2);}(_0x0448,0x1bb));var _0x8044=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x0448[_0x264b9b];return _0x4c7a0e;};'use strict';var multer=require('multer');var util=require(_0x8044('0x0'));var path=require(_0x8044('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8044('0x2')]();var fs_extra=require(_0x8044('0x3'));var auth=require(_0x8044('0x4'));var interaction=require(_0x8044('0x5'));var config=require(_0x8044('0x6'));var controller=require(_0x8044('0x7'));router[_0x8044('0x8')]('/',auth[_0x8044('0x9')](),controller[_0x8044('0xa')]);router[_0x8044('0x8')](_0x8044('0xb'),auth['isAuthenticated'](),controller[_0x8044('0xc')]);router[_0x8044('0x8')](_0x8044('0xd'),auth[_0x8044('0x9')](),controller[_0x8044('0xe')]);router[_0x8044('0x8')](_0x8044('0xf'),auth[_0x8044('0x9')](),controller[_0x8044('0x10')]);router[_0x8044('0x8')](_0x8044('0x11'),auth[_0x8044('0x9')](),controller[_0x8044('0x12')]);router[_0x8044('0x8')](_0x8044('0x13'),auth[_0x8044('0x9')](),controller[_0x8044('0x14')]);router[_0x8044('0x15')]('/',auth['isAuthenticated'](),controller[_0x8044('0x16')]);router['post'](_0x8044('0x11'),auth[_0x8044('0x9')](),controller[_0x8044('0x17')]);router[_0x8044('0x15')]('/:id/messages',auth[_0x8044('0x9')](),controller[_0x8044('0x18')]);router['put'](_0x8044('0xd'),auth[_0x8044('0x9')](),controller[_0x8044('0x19')]);router['delete'](_0x8044('0xd'),auth['isAuthenticated'](),controller[_0x8044('0x1a')]);router[_0x8044('0x1b')](_0x8044('0x11'),auth[_0x8044('0x9')](),controller[_0x8044('0x1c')]);module[_0x8044('0x1d')]=router; \ No newline at end of file +var _0x6422=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','util','connect-timeout'];(function(_0xacf8c,_0x1d484b){var _0x21fd7b=function(_0x10b1bf){while(--_0x10b1bf){_0xacf8c['push'](_0xacf8c['shift']());}};_0x21fd7b(++_0x1d484b);}(_0x6422,0x16a));var _0x2642=function(_0x3fd115,_0x57b144){_0x3fd115=_0x3fd115-0x0;var _0x22122f=_0x6422[_0x3fd115];return _0x22122f;};'use strict';var multer=require('multer');var util=require(_0x2642('0x0'));var path=require('path');var timeout=require(_0x2642('0x1'));var express=require(_0x2642('0x2'));var router=express[_0x2642('0x3')]();var fs_extra=require(_0x2642('0x4'));var auth=require(_0x2642('0x5'));var interaction=require(_0x2642('0x6'));var config=require(_0x2642('0x7'));var controller=require('./chatGroup.controller');router[_0x2642('0x8')]('/',auth[_0x2642('0x9')](),controller[_0x2642('0xa')]);router['get'](_0x2642('0xb'),auth[_0x2642('0x9')](),controller['describe']);router[_0x2642('0x8')](_0x2642('0xc'),auth[_0x2642('0x9')](),controller[_0x2642('0xd')]);router[_0x2642('0x8')]('/:id/unread',auth[_0x2642('0x9')](),controller[_0x2642('0xe')]);router[_0x2642('0x8')](_0x2642('0xf'),auth[_0x2642('0x9')](),controller[_0x2642('0x10')]);router[_0x2642('0x8')](_0x2642('0x11'),auth[_0x2642('0x9')](),controller['getMessages']);router[_0x2642('0x12')]('/',auth[_0x2642('0x9')](),controller[_0x2642('0x13')]);router[_0x2642('0x12')](_0x2642('0xf'),auth[_0x2642('0x9')](),controller[_0x2642('0x14')]);router[_0x2642('0x12')](_0x2642('0x11'),auth[_0x2642('0x9')](),controller[_0x2642('0x15')]);router[_0x2642('0x16')](_0x2642('0xc'),auth[_0x2642('0x9')](),controller[_0x2642('0x17')]);router[_0x2642('0x18')](_0x2642('0xc'),auth[_0x2642('0x9')](),controller[_0x2642('0x19')]);router['delete'](_0x2642('0xf'),auth[_0x2642('0x9')](),controller[_0x2642('0x1a')]);module[_0x2642('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index cc0ddfa..24136e7 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 _0xec69=['star','thumb','TEXT','STRING','DATE','long','ENUM','out','sequelize','BOOLEAN','INTEGER'];(function(_0x202295,_0x307455){var _0xf2db7f=function(_0x3873d6){while(--_0x3873d6){_0x202295['push'](_0x202295['shift']());}};_0xf2db7f(++_0x307455);}(_0xec69,0x126));var _0x9ec6=function(_0x542c11,_0x35d5df){_0x542c11=_0x542c11-0x0;var _0xd5ba30=_0xec69[_0x542c11];return _0xd5ba30;};'use strict';var Sequelize=require(_0x9ec6('0x0'));module['exports']={'closed':{'type':Sequelize[_0x9ec6('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9ec6('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x9ec6('0x3'),_0x9ec6('0x4')),'defaultValue':_0x9ec6('0x3')},'ratingMessage':{'type':Sequelize[_0x9ec6('0x5')]},'pathTranscript':{'type':Sequelize[_0x9ec6('0x5')]},'mailTranscript':{'type':Sequelize[_0x9ec6('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x9ec6('0x7')]},'disposition':{'type':Sequelize[_0x9ec6('0x6')]},'secondDisposition':{'type':Sequelize[_0x9ec6('0x6')]},'thirdDisposition':{'type':Sequelize[_0x9ec6('0x6')]},'note':{'type':Sequelize[_0x9ec6('0x6')]},'browserName':{'type':Sequelize[_0x9ec6('0x6')]},'browserVersion':{'type':Sequelize[_0x9ec6('0x6')]},'osName':{'type':Sequelize[_0x9ec6('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x9ec6('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x9ec6('0x5')](_0x9ec6('0x8'))},'read1stAt':{'type':Sequelize[_0x9ec6('0x7')]},'lastMsgAt':{'type':Sequelize[_0x9ec6('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x9ec6('0x9')]('in',_0x9ec6('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x9ec6('0x6')]},'customerPort':{'type':Sequelize[_0x9ec6('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x9ec6('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9ec6('0x2')]}}; \ No newline at end of file +var _0x3613=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize'];(function(_0x1920d3,_0x6599d3){var _0xd5d01c=function(_0x8a6ea9){while(--_0x8a6ea9){_0x1920d3['push'](_0x1920d3['shift']());}};_0xd5d01c(++_0x6599d3);}(_0x3613,0x1ee));var _0x3361=function(_0x4f5817,_0x3e7d5f){_0x4f5817=_0x4f5817-0x0;var _0x47b044=_0x3613[_0x4f5817];return _0x47b044;};'use strict';var Sequelize=require(_0x3361('0x0'));module['exports']={'closed':{'type':Sequelize[_0x3361('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3361('0x2')]},'ratingType':{'type':Sequelize[_0x3361('0x3')](_0x3361('0x4'),_0x3361('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x3361('0x6')]},'pathTranscript':{'type':Sequelize[_0x3361('0x6')]},'mailTranscript':{'type':Sequelize[_0x3361('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3361('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3361('0x7')]},'thirdDisposition':{'type':Sequelize[_0x3361('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x3361('0x7')]},'browserVersion':{'type':Sequelize[_0x3361('0x7')]},'osName':{'type':Sequelize[_0x3361('0x7')]},'osVersion':{'type':Sequelize[_0x3361('0x7')]},'deviceModel':{'type':Sequelize[_0x3361('0x7')]},'deviceVendor':{'type':Sequelize[_0x3361('0x7')]},'deviceType':{'type':Sequelize[_0x3361('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x3361('0x6')](_0x3361('0x9'))},'read1stAt':{'type':Sequelize[_0x3361('0x8')]},'lastMsgAt':{'type':Sequelize[_0x3361('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3361('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3361('0x7')]},'customerPort':{'type':Sequelize[_0x3361('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x3361('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x3361('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3361('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f724106..5889cf9 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 _0xfc8a=['index','map','ChatInteraction','rawAttributes','fieldName','type','getOptions','findAll','chat','query','show','params','keys','filters','intersection','attributes','fields','length','model','includeAll','include','options','find','create','destroy','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooEscalation','user','fullname','email','isNull','follow','vidaooMetadata','parse','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','closed','json','Unauthorized','attachId','join','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','%s%d','agentAlias','System','Visitor','ContactId','agentIdentifier','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','pick','includeAgent','rows','addTags','setTags','Tag','color','removeTags','unix','toString','root','server','files','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','Account','get','mkdirSync','Chat','Owner','N.A.','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','unlinkSync','rimraf','request-promise','moment','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','update','stack','name','send','render','merge','body','contact','agent','interaction','account'];(function(_0x2c91b4,_0x1ad186){var _0x37ef66=function(_0x15ecd8){while(--_0x15ecd8){_0x2c91b4['push'](_0x2c91b4['shift']());}};_0x37ef66(++_0x1ad186);}(_0xfc8a,0x9b));var _0xafc8=function(_0x360cc7,_0x2373f4){_0x360cc7=_0x360cc7-0x0;var _0x36c3b7=_0xfc8a[_0x360cc7];return _0x36c3b7;};'use strict';var rimraf=require(_0xafc8('0x0'));var zipdir=require('zip-dir');var rp=require(_0xafc8('0x1'));var moment=require(_0xafc8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xafc8('0x3'));var util=require(_0xafc8('0x4'));var path=require(_0xafc8('0x5'));var ejs=require(_0xafc8('0x6'));var fs=require('fs');var _=require(_0xafc8('0x7'));var Redis=require(_0xafc8('0x8'));var interaction=require(_0xafc8('0x9'));var qs=require(_0xafc8('0xa'));var pdf=require(_0xafc8('0xb'));var logger=require(_0xafc8('0xc'))(_0xafc8('0xd'));var config=require(_0xafc8('0xe'));var db=require(_0xafc8('0xf'))['db'];config[_0xafc8('0x10')]=_[_0xafc8('0x11')](config[_0xafc8('0x10')],{'host':_0xafc8('0x12'),'port':0x18eb});var socket=require(_0xafc8('0x13'))(new Redis(config[_0xafc8('0x10')]));require(_0xafc8('0x14'))[_0xafc8('0x15')](socket);var jayson=require(_0xafc8('0x16'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0xafc8('0x17')][_0xafc8('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x95948d,_0x5c147c,_0x1912ce,_0x171f95){return new BPromise(function(_0x3e37b4,_0x4f246f){var _0x153708=_0x171f95||client;return _0x153708[_0xafc8('0x19')](_0x95948d,_0x1912ce)[_0xafc8('0x1a')](function(_0x1cccb9){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5c147c,'request\x20sent');logger[_0xafc8('0x1b')](_0xafc8('0x1c'),_0x5c147c,'request\x20sent',JSON[_0xafc8('0x1d')](_0x1cccb9));if(_0x1cccb9[_0xafc8('0x1e')]){if(_0x1cccb9['error'][_0xafc8('0x1f')]===0x1f4){logger[_0xafc8('0x1e')](_0xafc8('0x20'),_0x5c147c,_0x1cccb9[_0xafc8('0x1e')][_0xafc8('0x21')]);return _0x4f246f(_0x1cccb9[_0xafc8('0x1e')]['message']);}logger[_0xafc8('0x1e')](_0xafc8('0x20'),_0x5c147c,_0x1cccb9[_0xafc8('0x1e')]['message']);return _0x3e37b4(_0x1cccb9[_0xafc8('0x1e')][_0xafc8('0x21')]);}else{logger[_0xafc8('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x5c147c,'request\x20sent');_0x3e37b4(_0x1cccb9[_0xafc8('0x23')]['message']);}})[_0xafc8('0x24')](function(_0x6f99a0){logger[_0xafc8('0x1e')](_0xafc8('0x20'),_0x5c147c,_0x6f99a0);_0x4f246f(_0x6f99a0);});});}function respondWithStatusCode(_0xc0d917,_0x4704b7){_0x4704b7=_0x4704b7||0xcc;return function(_0x1f9f05){if(_0x1f9f05){return _0xc0d917[_0xafc8('0x25')](_0x4704b7);}return _0xc0d917[_0xafc8('0x26')](_0x4704b7)[_0xafc8('0x27')]();};}function respondWithResult(_0x236061,_0x486c9d){_0x486c9d=_0x486c9d||0xc8;return function(_0x4b61ef){if(_0x4b61ef){return _0x236061[_0xafc8('0x26')](_0x486c9d)['json'](_0x4b61ef);}};}function respondWithFilteredResult(_0x41a9be,_0x5f41c3){return function(_0xeb96df){if(_0xeb96df){var _0x46d8ed=typeof _0x5f41c3[_0xafc8('0x28')]===_0xafc8('0x29')&&typeof _0x5f41c3[_0xafc8('0x2a')]===_0xafc8('0x29');var _0x379000=_0xeb96df['count'];var _0xebdf2=_0x46d8ed?0x0:_0x5f41c3[_0xafc8('0x28')];var _0x1266dc=_0x46d8ed?_0xeb96df[_0xafc8('0x2b')]:_0x5f41c3[_0xafc8('0x28')]+_0x5f41c3[_0xafc8('0x2a')];var _0x279998;if(_0x1266dc>=_0x379000){_0x1266dc=_0x379000;_0x279998=0xc8;}else{_0x279998=0xce;}_0x41a9be[_0xafc8('0x26')](_0x279998);return _0x41a9be['set']('Content-Range',_0xebdf2+'-'+_0x1266dc+'/'+_0x379000)['json'](_0xeb96df);}return null;};}function saveUpdates(_0x4e62e4){return function(_0x3b125c){if(_0x3b125c){return _0x3b125c[_0xafc8('0x2c')](_0x4e62e4)['then'](function(_0x2d1161){return _0x2d1161;});}return null;};}function removeEntity(_0x39c8cd){return function(_0x2463b2){if(_0x2463b2){return _0x2463b2['destroy']()[_0xafc8('0x1a')](function(){_0x39c8cd[_0xafc8('0x26')](0xcc)[_0xafc8('0x27')]();});}};}function handleEntityNotFound(_0x166a12){return function(_0x3bd92f){if(!_0x3bd92f){_0x166a12[_0xafc8('0x25')](0x194);}return _0x3bd92f;};}function handleError(_0xa057c,_0x206fc1){_0x206fc1=_0x206fc1||0x1f4;return function(_0x1ae15e){logger['error'](_0x1ae15e[_0xafc8('0x2d')]);if(_0x1ae15e[_0xafc8('0x2e')]){delete _0x1ae15e['name'];}_0xa057c[_0xafc8('0x26')](_0x206fc1)[_0xafc8('0x2f')](_0x1ae15e);};}function getMustacheRender(_0x152b87,_0x1fed6a){return Mustache[_0xafc8('0x30')](_0x152b87,_[_0xafc8('0x31')](_0x1fed6a[_0xafc8('0x32')],{'contact':_0x1fed6a[_0xafc8('0x33')],'message':_0x1fed6a[_0xafc8('0x21')],'agent':_0x1fed6a[_0xafc8('0x34')],'interaction':_0x1fed6a[_0xafc8('0x35')],'account':_0x1fed6a[_0xafc8('0x36')]}))||'';}exports[_0xafc8('0x37')]=function(_0x4dbb5c,_0x2ba1a4){var _0x47bf68={};var _0x19e1da=_[_0xafc8('0x38')](db[_0xafc8('0x39')][_0xafc8('0x3a')],function(_0x1a8940){return{'name':_0x1a8940[_0xafc8('0x3b')],'type':_0x1a8940[_0xafc8('0x3c')]['key']};});_0x47bf68=qs[_0xafc8('0x3d')](_0x19e1da,_0x4dbb5c);return interaction[_0xafc8('0x3e')](_0xafc8('0x3f'),_0x4dbb5c[_0xafc8('0x40')],_0x4dbb5c['user'],_0x47bf68,_0x19e1da)[_0xafc8('0x1a')](respondWithFilteredResult(_0x2ba1a4,_0x47bf68))['catch'](handleError(_0x2ba1a4,null));};exports[_0xafc8('0x41')]=function(_0x1010c2,_0x2ad228){var _0x738b1a={'raw':![],'where':{'id':_0x1010c2[_0xafc8('0x42')]['id']}},_0x14641d={};_0x14641d['model']=_[_0xafc8('0x43')](db[_0xafc8('0x39')][_0xafc8('0x3a')]);_0x14641d[_0xafc8('0x40')]=_[_0xafc8('0x43')](_0x1010c2[_0xafc8('0x40')]);_0x14641d[_0xafc8('0x44')]=_[_0xafc8('0x45')](_0x14641d['model'],_0x14641d[_0xafc8('0x40')]);_0x738b1a[_0xafc8('0x46')]=_[_0xafc8('0x45')](_0x14641d['model'],qs[_0xafc8('0x47')](_0x1010c2[_0xafc8('0x40')][_0xafc8('0x47')]));_0x738b1a[_0xafc8('0x46')]=_0x738b1a['attributes'][_0xafc8('0x48')]?_0x738b1a[_0xafc8('0x46')]:_0x14641d[_0xafc8('0x49')];if(_0x1010c2[_0xafc8('0x40')][_0xafc8('0x4a')]){_0x738b1a[_0xafc8('0x4b')]=[{'all':!![]}];}_0x738b1a=_[_0xafc8('0x31')]({},_0x738b1a,_0x1010c2[_0xafc8('0x4c')]);return db[_0xafc8('0x39')][_0xafc8('0x4d')](_0x738b1a)['then'](handleEntityNotFound(_0x2ad228,null))['then'](respondWithResult(_0x2ad228,null))[_0xafc8('0x24')](handleError(_0x2ad228,null));};exports[_0xafc8('0x4e')]=function(_0x434f55,_0x3c5be0){return db[_0xafc8('0x39')][_0xafc8('0x4e')](_0x434f55[_0xafc8('0x32')],{})[_0xafc8('0x1a')](respondWithResult(_0x3c5be0,0xc9))['catch'](handleError(_0x3c5be0,null));};exports[_0xafc8('0x2c')]=function(_0x3e4867,_0x1e0862){if(_0x3e4867[_0xafc8('0x32')]['id']){delete _0x3e4867[_0xafc8('0x32')]['id'];}return db[_0xafc8('0x39')]['find']({'where':{'id':_0x3e4867['params']['id']}})['then'](handleEntityNotFound(_0x1e0862,null))[_0xafc8('0x1a')](saveUpdates(_0x3e4867[_0xafc8('0x32')],null))[_0xafc8('0x1a')](respondWithResult(_0x1e0862,null))[_0xafc8('0x24')](handleError(_0x1e0862,null));};exports[_0xafc8('0x4f')]=function(_0x3cf75f,_0x377df9){return db['ChatInteraction']['find']({'where':{'id':_0x3cf75f[_0xafc8('0x42')]['id']}})['then'](handleEntityNotFound(_0x377df9,null))[_0xafc8('0x1a')](removeEntity(_0x377df9,null))['catch'](handleError(_0x377df9,null));};exports['describe']=function(_0x249f38,_0x2ef58e){return db[_0xafc8('0x39')][_0xafc8('0x50')]()['then'](respondWithResult(_0x2ef58e,null))[_0xafc8('0x24')](handleError(_0x2ef58e,null));};exports['createVidaooSession']=function(_0x3a2d80,_0x1009ed){var _0x592244=_0x3a2d80[_0xafc8('0x42')]['id'];var _0x31a908;var _0x42708d;var _0x3aa1cb;return db['ChatInteraction'][_0xafc8('0x51')]({'where':{'id':_0x592244}})[_0xafc8('0x1a')](function(_0x395982){_0x31a908=_0x395982;return db[_0xafc8('0x52')][_0xafc8('0x51')]({'where':{'id':_0x395982[_0xafc8('0x53')]},'attributes':['id',_0xafc8('0x54'),'vidaooEscalation',_0xafc8('0x55'),_0xafc8('0x56'),'vidaooMetadata'],'raw':!![]});})[_0xafc8('0x1a')](function(_0x4f708d){if(_0x4f708d&&_0x4f708d[_0xafc8('0x54')]&&_0x4f708d[_0xafc8('0x57')]){_0x42708d=_0x4f708d;var _0x737455={'interaction':{'id':_0x592244},'agent':{'id':_0x3a2d80[_0xafc8('0x58')]['id'],'name':_0x3a2d80['user'][_0xafc8('0x2e')],'fullname':_0x3a2d80['user'][_0xafc8('0x59')],'email':_0x3a2d80[_0xafc8('0x58')][_0xafc8('0x5a')]},'contact':_0x3a2d80[_0xafc8('0x32')][_0xafc8('0x33')],'account':_0x3a2d80[_0xafc8('0x32')]['account']};var _0x548cdf={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x4f708d[_0xafc8('0x54')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3a2d80[_0xafc8('0x58')][_0xafc8('0x5a')]],'buttons':null,'topic':_0x42708d['vidaooTopic'],'note':_[_0xafc8('0x5b')](_0x42708d[_0xafc8('0x56')])?null:getMustacheRender(_0x42708d['vidaooNote'],_0x737455),'metadata':null},'redirect':_0xafc8('0x5c'),'json':!![]};try{if(!_[_0xafc8('0x5b')](_0x42708d[_0xafc8('0x5d')])){var _0x55c3ba=getMustacheRender(_0x42708d[_0xafc8('0x5d')],_0x737455);var _0x80c476=JSON[_0xafc8('0x5e')](_0x55c3ba);_0x548cdf[_0xafc8('0x32')]['metadata']=_0x80c476;}}catch(_0x12b916){throw new db['Sequelize'][(_0xafc8('0x5f'))](_0xafc8('0x60'));}return rp(_0x548cdf);}else{throw new db[(_0xafc8('0x61'))][(_0xafc8('0x5f'))](_0xafc8('0x62'));}})['then'](function(_0x5a39e5){_0x3aa1cb=_0x5a39e5;if(_0x3aa1cb['id']){var _0x19bcbc={'body':_0x3aa1cb[_0xafc8('0x63')],'ChatWebsiteId':_0x42708d['id'],'ChatInteractionId':_0x31a908['id'],'direction':_0xafc8('0x64'),'UserId':_0x3a2d80[_0xafc8('0x58')]['id']};return db[_0xafc8('0x65')][_0xafc8('0x4e')](_0x19bcbc,{});}else{throw new db[(_0xafc8('0x61'))][(_0xafc8('0x5f'))](_0xafc8('0x66'));}})['then'](function(){return _0x31a908[_0xafc8('0x67')]({'vidaooSessionId':_0x3aa1cb['id']});})['then'](respondWithResult(_0x1009ed,null))[_0xafc8('0x24')](handleError(_0x1009ed,null));};exports['customUpdate']=function(_0x1fed5c,_0x9737c8){if(_0x1fed5c[_0xafc8('0x32')]['id']){delete _0x1fed5c[_0xafc8('0x32')]['id'];}return db['ChatInteraction'][_0xafc8('0x4d')]({'where':{'id':_0x1fed5c[_0xafc8('0x42')]['id']},'include':[{'model':db[_0xafc8('0x68')],'as':_0xafc8('0x69')}]})['then'](handleEntityNotFound(_0x9737c8,null))['then'](saveUpdates(_0x1fed5c[_0xafc8('0x32')],null))[_0xafc8('0x1a')](respondWithResult(_0x9737c8,null))['catch'](handleError(_0x9737c8,null));};exports[_0xafc8('0x6a')]=function(_0x2076e6,_0x4901eb){if(_0x2076e6[_0xafc8('0x32')]['id']){delete _0x2076e6[_0xafc8('0x32')]['id'];}return db[_0xafc8('0x39')]['find']({'where':{'id':_0x2076e6[_0xafc8('0x42')]['id']}})[_0xafc8('0x1a')](function(_0x2d0965){if(!_0x2d0965){logger[_0xafc8('0x1e')](_0xafc8('0x6b'),_0xafc8('0x6a'),0x194,'entity\x20not\x20found');_0x4901eb[_0xafc8('0x25')](0x194);}else{if(_0x2d0965[_0xafc8('0x6c')]){throw new db[(_0xafc8('0x61'))][(_0xafc8('0x5f'))](_0xafc8('0x6d'));}}return _0x2d0965;})[_0xafc8('0x1a')](function(_0x362d5a){if(_0x362d5a){return _0x362d5a['update']({'closed':_0x2076e6[_0xafc8('0x32')]['closed'],'disposition':_0x2076e6[_0xafc8('0x32')][_0xafc8('0x6e')]})[_0xafc8('0x1a')](function(_0x2bf748){return _0x2bf748;});}})[_0xafc8('0x1a')](function(){return respondWithRpcPromise(_0xafc8('0x6f'),_0xafc8('0x6a'),_0x2076e6[_0xafc8('0x32')],client9004);})[_0xafc8('0x1a')](respondWithResult(_0x4901eb,null))[_0xafc8('0x24')](handleError(_0x4901eb,null));};exports['attachmentUpload']=function(_0x3d64e7,_0x3bdc10){_0x3d64e7[_0xafc8('0x32')][_0xafc8('0x2e')]=_0x3d64e7[_0xafc8('0x70')][_0xafc8('0x71')];_0x3d64e7[_0xafc8('0x32')][_0xafc8('0x72')]=_0x3d64e7['file'][_0xafc8('0x73')];_0x3d64e7[_0xafc8('0x32')]['type']=_0x3d64e7[_0xafc8('0x70')][_0xafc8('0x74')];return db[_0xafc8('0x75')][_0xafc8('0x4e')](_0x3d64e7[_0xafc8('0x32')])[_0xafc8('0x1a')](respondWithResult(_0x3bdc10,0xc9))[_0xafc8('0x24')](handleError(_0x3bdc10,null));};exports[_0xafc8('0x76')]=function(_0x25f421,_0x5524b0){return db[_0xafc8('0x39')][_0xafc8('0x51')]({'where':{'id':_0x25f421[_0xafc8('0x42')]['id']},'raw':!![]})[_0xafc8('0x1a')](handleEntityNotFound(_0x5524b0,null))[_0xafc8('0x1a')](function(_0x162a1b){if(_0x162a1b){if(_0x162a1b[_0xafc8('0x77')]){return _0x5524b0[_0xafc8('0x26')](0x193)[_0xafc8('0x78')]({'status':0x193,'message':_0xafc8('0x79')});}return db[_0xafc8('0x75')]['findOne']({'where':{'id':_0x25f421[_0xafc8('0x40')][_0xafc8('0x7a')]},'raw':!![]})['then'](handleEntityNotFound(_0x5524b0,null));}})[_0xafc8('0x1a')](function(_0x5c3d09){if(_0x5c3d09){var _0x1cd8e8=_0x5c3d09['ChatOfflineMessageId']!==null;var _0x35b365=path[_0xafc8('0x7b')](config['root'],_0xafc8('0x7c'));if(_0x1cd8e8){_0x35b365=path[_0xafc8('0x7b')](_0x35b365,'offline-chat/');}var _0x494a6b=path['join'](_0x35b365,_0x5c3d09[_0xafc8('0x72')]);return _0x5524b0['download'](_0x494a6b);}})['catch'](handleError(_0x5524b0,null));};exports[_0xafc8('0x7d')]=function(_0x196f0d,_0x29258d){var _0x5be5a3=null;var _0x4e0ed0=null;var _0x1aeb4a=null;if(_0x196f0d[_0xafc8('0x32')]['id']){delete _0x196f0d[_0xafc8('0x32')]['id'];}if(_0x196f0d[_0xafc8('0x32')][_0xafc8('0x7e')]){_0x1aeb4a=path[_0xafc8('0x7b')](config['root'],_0xafc8('0x7f'),util[_0xafc8('0x80')](_0xafc8('0x81'),Date[_0xafc8('0x82')]()));_0x196f0d[_0xafc8('0x32')][_0xafc8('0x83')]=_0x1aeb4a;}return db[_0xafc8('0x39')][_0xafc8('0x4d')]({'where':{'id':_0x196f0d[_0xafc8('0x42')]['id']},'include':[{'model':db[_0xafc8('0x65')],'as':_0xafc8('0x84'),'include':[{'model':db[_0xafc8('0x85')],'as':'User'}]}]})[_0xafc8('0x1a')](handleEntityNotFound(_0x29258d,null))['then'](saveUpdates(_0x196f0d[_0xafc8('0x32')],null))[_0xafc8('0x1a')](function(_0xe68ff8){if(_0xe68ff8){_0x5be5a3=_0xe68ff8;return db[_0xafc8('0x52')]['find']({'where':{'id':_0x5be5a3[_0xafc8('0x53')]}});}})[_0xafc8('0x1a')](function(_0x34e297){if(_0x34e297){_0x4e0ed0=_0x34e297;return db[_0xafc8('0x68')][_0xafc8('0x4d')]({'where':{'id':_0x5be5a3['ContactId']}});}})['then'](function(_0x3d3bb4){if(_0x3d3bb4){if(_0x1aeb4a){var _0x1d14cb=null;for(var _0x357cb5=0x1;_0x357cb5<_0x5be5a3[_0xafc8('0x84')][_0xafc8('0x48')];++_0x357cb5){_0x1d14cb=_0x5be5a3[_0xafc8('0x84')][_0x357cb5];var _0x14c4ea=_0x1d14cb[_0xafc8('0x6c')]?util[_0xafc8('0x80')](_0xafc8('0x86'),_0x4e0ed0[_0xafc8('0x87')],_0x1d14cb[_0xafc8('0x6c')]):_0xafc8('0x88');var _0x5f1afa=_0x196f0d[_0xafc8('0x32')]['customer']||util[_0xafc8('0x80')]('%s%d',_0xafc8('0x89'),_0x1d14cb[_0xafc8('0x8a')]);switch(_0x4e0ed0[_0xafc8('0x8b')]){case'website_alias':_0x14c4ea=_0x1d14cb[_0xafc8('0x6c')]?util[_0xafc8('0x80')](_0xafc8('0x86'),_0x4e0ed0[_0xafc8('0x87')],_0x1d14cb[_0xafc8('0x6c')]):_0xafc8('0x88');break;case'agent_alias':_0x14c4ea=_0x1d14cb[_0xafc8('0x6c')]?_0x1d14cb[_0xafc8('0x85')][_0xafc8('0x8c')]||_0x1d14cb['User']['fullname']:_0xafc8('0x88');break;case'agent_fullname':_0x14c4ea=_0x1d14cb[_0xafc8('0x6c')]?_0x1d14cb[_0xafc8('0x85')][_0xafc8('0x59')]:'System';break;default:_0x14c4ea=_0x1d14cb[_0xafc8('0x6c')]?util[_0xafc8('0x80')](_0xafc8('0x86'),_0x4e0ed0[_0xafc8('0x87')],_0x1d14cb[_0xafc8('0x6c')]):'System';}var _0x4da53f=util['format'](_0xafc8('0x8d'),moment(_0x1d14cb[_0xafc8('0x8e')])[_0xafc8('0x80')](_0xafc8('0x8f')),_0x1d14cb[_0xafc8('0x90')]==='in'?_0x5f1afa:_0x14c4ea,_0x1d14cb[_0xafc8('0x32')]);if(!_0x1d14cb[_0xafc8('0x91')]){fs[_0xafc8('0x92')](_0x1aeb4a,_0x4da53f);}}return db[_0xafc8('0x93')][_0xafc8('0x51')]({'where':{'service':!![]},'include':[{'model':db[_0xafc8('0x94')],'as':_0xafc8('0x95'),'raw':!![],'include':[{'model':db[_0xafc8('0x96')],'as':_0xafc8('0x96'),'raw':!![]}]}]});}}})[_0xafc8('0x1a')](function(_0x301517){if(!_0x301517||!_0x301517[_0xafc8('0x95')]||!_0x196f0d['body'])return _0x5be5a3;var _0x13eb7a=_0x301517[_0xafc8('0x97')]();return respondWithRpcPromise(_0xafc8('0x98'),_0xafc8('0x99'),{'account':_0x13eb7a,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x301517[_0xafc8('0x2e')],_0x301517['email']||_0x301517['Smtp']['user']),'to':_0x196f0d[_0xafc8('0x32')][_0xafc8('0x7e')],'subject':_0xafc8('0x9a'),'text':util[_0xafc8('0x80')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x196f0d[_0xafc8('0x32')]['mailTranscript']),'attachments':[{'path':_0x1aeb4a}]}})[_0xafc8('0x1a')](function(){return _0x5be5a3;})[_0xafc8('0x24')](function(_0x1064e7){logger[_0xafc8('0x1e')](_0x1064e7);});})[_0xafc8('0x1a')](respondWithStatusCode(_0x29258d,0xc8))[_0xafc8('0x24')](handleError(_0x29258d,null));};exports[_0xafc8('0x9b')]=function(_0x26e8bf,_0x4a70f5){return db[_0xafc8('0x65')][_0xafc8('0x4d')]({'where':{'id':_0x26e8bf[_0xafc8('0x42')]['id']}})['then'](handleEntityNotFound(_0x4a70f5,null))['then'](function(_0x5a8ea5){if(_0x5a8ea5){return _0x5a8ea5['addMessage'](_0x26e8bf[_0xafc8('0x32')][_0xafc8('0x9c')],_[_0xafc8('0x9d')](_0x26e8bf[_0xafc8('0x32')],[_0xafc8('0x9c'),'id'])||{});}})[_0xafc8('0x1a')](respondWithResult(_0x4a70f5,null))[_0xafc8('0x24')](handleError(_0x4a70f5,null));};exports[_0xafc8('0x9e')]=function(_0x205dcf,_0x8bd0b7){var _0x46bdfb={'raw':![],'where':{}};var _0x3dc332={};var _0x34ca73={'count':0x0,'rows':[]};return db[_0xafc8('0x39')][_0xafc8('0x51')]({'where':{'id':_0x205dcf[_0xafc8('0x42')]['id']}})[_0xafc8('0x1a')](handleEntityNotFound(_0x8bd0b7,null))['then'](function(_0x3ebd90){if(_0x3ebd90){_0x3dc332[_0xafc8('0x49')]=_['keys'](db[_0xafc8('0x65')][_0xafc8('0x3a')]);_0x3dc332[_0xafc8('0x40')]=_['keys'](_0x205dcf[_0xafc8('0x40')]);_0x3dc332[_0xafc8('0x44')]=_[_0xafc8('0x45')](_0x3dc332[_0xafc8('0x49')],_0x3dc332[_0xafc8('0x40')]);_0x46bdfb['attributes']=_[_0xafc8('0x45')](_0x3dc332['model'],qs[_0xafc8('0x47')](_0x205dcf[_0xafc8('0x40')]['fields']));_0x46bdfb['attributes']=_0x46bdfb[_0xafc8('0x46')][_0xafc8('0x48')]?_0x46bdfb[_0xafc8('0x46')]:_0x3dc332[_0xafc8('0x49')];if(!_0x205dcf[_0xafc8('0x40')][_0xafc8('0x9f')](_0xafc8('0xa0'))){_0x46bdfb[_0xafc8('0x2a')]=qs[_0xafc8('0x2a')](_0x205dcf[_0xafc8('0x40')]['limit']);_0x46bdfb[_0xafc8('0x28')]=qs[_0xafc8('0x28')](_0x205dcf[_0xafc8('0x40')][_0xafc8('0x28')]);}_0x46bdfb[_0xafc8('0xa1')]=qs[_0xafc8('0xa2')](_0x205dcf['query'][_0xafc8('0xa2')]);_0x46bdfb[_0xafc8('0xa3')]=qs[_0xafc8('0x44')](_['pick'](_0x205dcf[_0xafc8('0x40')],_0x3dc332[_0xafc8('0x44')]));_0x46bdfb[_0xafc8('0xa3')][_0xafc8('0xa4')]=_0x3ebd90['id'];if(_0x205dcf[_0xafc8('0x40')][_0xafc8('0xa5')]){_0x46bdfb['where']=_[_0xafc8('0x31')](_0x46bdfb[_0xafc8('0xa3')],{'$or':_[_0xafc8('0x38')](_0x46bdfb[_0xafc8('0x46')],function(_0x39fa4f){var _0x10129f={};_0x10129f[_0x39fa4f]={'$like':'%'+_0x205dcf[_0xafc8('0x40')][_0xafc8('0xa5')]+'%'};return _0x10129f;})});}if(_0x205dcf[_0xafc8('0x40')][_0xafc8('0xa6')]){var _0x2b0c03=_0x205dcf[_0xafc8('0x40')][_0xafc8('0xa6')][_0xafc8('0xa7')](',');var _0x47e4eb={};_0x47e4eb[_0x2b0c03[0x0]]={'$gte':moment(_0x2b0c03[0x1])['format'](_0xafc8('0xa8'))};_0x46bdfb['where']=_[_0xafc8('0x31')](_0x46bdfb['where'],_0x47e4eb);}_0x46bdfb=_['merge']({},_0x46bdfb,_0x205dcf[_0xafc8('0x4c')]);return db[_0xafc8('0x65')][_0xafc8('0x2b')]({'where':_0x46bdfb[_0xafc8('0xa3')]})[_0xafc8('0x1a')](function(_0x196429){_0x34ca73[_0xafc8('0x2b')]=_0x196429;if(_0x205dcf[_0xafc8('0x40')][_0xafc8('0x4a')]){_0x46bdfb[_0xafc8('0x4b')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x46bdfb);})['then'](function(_0x587500){_0x34ca73['rows']=_0x587500;return _0x34ca73;});}})[_0xafc8('0x1a')](respondWithFilteredResult(_0x8bd0b7,_0x46bdfb))[_0xafc8('0x24')](handleError(_0x8bd0b7,null));};exports[_0xafc8('0xa9')]=function(_0x756e77,_0x638f68){var _0x2a2af0={'where':{}},_0x89379f={},_0x2fe6ee={'count':0x0,'rows':[]};return db[_0xafc8('0x39')]['findOne']({'where':{'id':_0x756e77['params']['id']}})[_0xafc8('0x1a')](handleEntityNotFound(_0x638f68,null))['then'](function(_0x77dac1){if(_0x77dac1){_0x89379f['model']=_[_0xafc8('0x43')](db[_0xafc8('0x65')][_0xafc8('0x3a')]);_0x89379f['query']=_[_0xafc8('0x43')](_0x756e77['query']);_0x89379f['filters']=_['intersection'](_0x89379f[_0xafc8('0x49')],_0x89379f['query']);_0x2a2af0['attributes']=_[_0xafc8('0x45')](_0x89379f[_0xafc8('0x49')],qs[_0xafc8('0x47')](_0x756e77[_0xafc8('0x40')]['fields']));_0x2a2af0[_0xafc8('0x46')]=_0x2a2af0['attributes'][_0xafc8('0x48')]?_0x2a2af0[_0xafc8('0x46')]:_0x89379f['model'];if(!_0x756e77[_0xafc8('0x40')][_0xafc8('0x9f')](_0xafc8('0xa0'))){_0x2a2af0['limit']=qs['limit'](_0x756e77['query'][_0xafc8('0x2a')]);_0x2a2af0[_0xafc8('0x28')]=qs[_0xafc8('0x28')](_0x756e77[_0xafc8('0x40')][_0xafc8('0x28')]);}_0x2a2af0[_0xafc8('0xa1')]=qs[_0xafc8('0xa2')](_0x756e77[_0xafc8('0x40')][_0xafc8('0xa2')]);_0x2a2af0['where']=qs[_0xafc8('0x44')](_[_0xafc8('0xaa')](_0x756e77[_0xafc8('0x40')],_0x89379f[_0xafc8('0x44')]));_0x2a2af0[_0xafc8('0xa3')][_0xafc8('0xa4')]=_0x77dac1['id'];if(_0x756e77['query'][_0xafc8('0xa5')]){_0x2a2af0[_0xafc8('0xa3')]=_['merge'](_0x2a2af0['where'],{'$or':_[_0xafc8('0x38')](_0x2a2af0[_0xafc8('0x46')],function(_0x597ac2){var _0x16a5b1={};_0x16a5b1[_0x597ac2]={'$like':'%'+_0x756e77[_0xafc8('0x40')]['filter']+'%'};return _0x16a5b1;})});}_0x2a2af0[_0xafc8('0xa3')][_0xafc8('0x91')]=![];if(_0x756e77[_0xafc8('0x40')]['id']){_0x2a2af0['where']['id']={'$gt':_0x756e77[_0xafc8('0x40')]['id']};}_0x2a2af0=_[_0xafc8('0x31')]({},_0x2a2af0,_0x756e77['options']);return db[_0xafc8('0x65')][_0xafc8('0x2b')]({'where':_0x2a2af0[_0xafc8('0xa3')]})[_0xafc8('0x1a')](function(_0x36365b){_0x2fe6ee[_0xafc8('0x2b')]=_0x36365b;_0x2a2af0['include']=[];if(_0x756e77[_0xafc8('0x40')][_0xafc8('0xab')]){_0x2a2af0[_0xafc8('0x4b')]['push']({'model':db[_0xafc8('0x85')],'as':'User','attributes':['id',_0xafc8('0x59'),_0xafc8('0x8c')]});}if(_0x756e77[_0xafc8('0x40')][_0xafc8('0x4a')]){_0x2a2af0[_0xafc8('0x4b')]=[{'all':!![]}];}return db[_0xafc8('0x65')][_0xafc8('0x3e')](_0x2a2af0);})[_0xafc8('0x1a')](function(_0x59d729){_0x2fe6ee[_0xafc8('0xac')]=_0x59d729;return _0x2fe6ee;});}})[_0xafc8('0x1a')](respondWithFilteredResult(_0x638f68,_0x2a2af0))['catch'](handleError(_0x638f68,null));};exports[_0xafc8('0xad')]=function(_0x27a726,_0x4e47f0){return db[_0xafc8('0x39')][_0xafc8('0x4d')]({'where':{'id':_0x27a726['params']['id']}})[_0xafc8('0x1a')](handleEntityNotFound(_0x4e47f0,null))[_0xafc8('0x1a')](function(_0x4c13da){if(_0x4c13da){return _0x4c13da[_0xafc8('0xae')](_0x27a726['body'][_0xafc8('0x9c')],_[_0xafc8('0x9d')](_0x27a726[_0xafc8('0x32')],['ids','id'])||{})['spread'](function(){return db[_0xafc8('0xaf')][_0xafc8('0x3e')]({'attributes':['id',_0xafc8('0x2e'),_0xafc8('0xb0')],'where':{'id':_0x27a726[_0xafc8('0x32')][_0xafc8('0x9c')]}});})[_0xafc8('0x1a')](function(_0x4acc30){socket['emit']('chatInteractionTags:save',{'id':Number(_0x27a726[_0xafc8('0x42')]['id']),'tags':_0x4acc30||[]});return{'id':Number(_0x27a726[_0xafc8('0x42')]['id']),'tags':_0x4acc30||[]};});}})['then'](respondWithResult(_0x4e47f0,null))[_0xafc8('0x24')](handleError(_0x4e47f0,null));};exports[_0xafc8('0xb1')]=function(_0x4d6851,_0x5deadf){return db[_0xafc8('0x39')][_0xafc8('0x4d')]({'where':{'id':_0x4d6851[_0xafc8('0x42')]['id']}})[_0xafc8('0x1a')](handleEntityNotFound(_0x5deadf,null))[_0xafc8('0x1a')](function(_0x13bd10){if(_0x13bd10){return _0x13bd10[_0xafc8('0xb1')](_0x4d6851[_0xafc8('0x40')]['ids']);}})[_0xafc8('0x1a')](respondWithStatusCode(_0x5deadf,null))['catch'](handleError(_0x5deadf,null));};exports['download']=function(_0xa53308,_0xc0e564){var _0x5c79ff=moment()[_0xafc8('0xb2')]()[_0xafc8('0xb3')]();var _0x3a1fb3=path[_0xafc8('0x7b')](config[_0xafc8('0xb4')],_0xafc8('0xb5'),_0xafc8('0xb6'),'tmp');var _0xff7dff=path[_0xafc8('0x7b')](config['root'],_0xafc8('0xb5'),_0xafc8('0xb6'),_0xafc8('0xb7'));var _0x3c4165=path[_0xafc8('0x7b')](_0x3a1fb3,_0x5c79ff);var _0x3b4a48=util['format'](_0xafc8('0xb8'),_0xa53308[_0xafc8('0x42')]['id'],_0x5c79ff);var _0x483535=path['join'](_0x3a1fb3,_0x3b4a48);var _0x4bbcf5=[];_0x4bbcf5[_0xafc8('0xb9')]({'model':db[_0xafc8('0x85')],'as':_0xafc8('0x85'),'attributes':['id',_0xafc8('0x59')],'raw':!![]});_0x4bbcf5[_0xafc8('0xb9')]({'model':db['CmContact'],'as':_0xafc8('0x69'),'attributes':['id',_0xafc8('0xba'),_0xafc8('0xbb')],'raw':!![]});if(_0xa53308[_0xafc8('0x40')]['attachments']){_0x4bbcf5[_0xafc8('0xb9')]({'model':db['Attachment'],'as':_0xafc8('0x75'),'raw':!![]});}var _0x2c3e6f=[{'model':db['ChatMessage'],'as':_0xafc8('0x84'),'attributes':['id',_0xafc8('0x32'),_0xafc8('0x8e'),_0xafc8('0x90'),'secret',_0xafc8('0xbc')],'include':_0x4bbcf5}];_0x2c3e6f[_0xafc8('0xb9')]({'model':db[_0xafc8('0x52')],'as':_0xafc8('0xbd'),'attributes':['id','name']});_0x2c3e6f[_0xafc8('0xb9')]({'model':db[_0xafc8('0x85')],'as':'Owner','attributes':['id',_0xafc8('0x59')]});return db['ChatInteraction'][_0xafc8('0x4d')]({'where':{'id':_0xa53308[_0xafc8('0x42')]['id']},'include':_0x2c3e6f})[_0xafc8('0x1a')](handleEntityNotFound(_0xc0e564,null))[_0xafc8('0x1a')](function(_0x1650ba){if(_0x1650ba){var _0x364efa=_0x1650ba[_0xafc8('0xbe')]({'plain':!![]});fs[_0xafc8('0xbf')](_0x3c4165);var _0x180da4={'channel':_0xafc8('0xc0'),'account':_0x364efa['Account'][_0xafc8('0x2e')],'agent':_0x364efa[_0xafc8('0xc1')]?_0x364efa[_0xafc8('0xc1')][_0xafc8('0x59')]:_0xafc8('0xc2'),'createdAt':moment(_0x364efa[_0xafc8('0x8e')])['format'](_0xafc8('0xa8'))[_0xafc8('0xb3')](),'closedAt':_0x364efa[_0xafc8('0x77')]?moment(_0x364efa['closedAt'])[_0xafc8('0x80')](_0xafc8('0xa8'))['toString']():'','disposition':_0x364efa['disposition'],'chatInfo':{'browser':_0x364efa['browserName'],'os':_0x364efa[_0xafc8('0xc3')],'referer':_0x364efa[_0xafc8('0xc4')],'customerIp':_0x364efa[_0xafc8('0xc5')],'customerPort':_0x364efa[_0xafc8('0xc6')]?_0x364efa[_0xafc8('0xc6')]:_0xafc8('0xc2')},'messages':_(_0x364efa['Messages'])[_0xafc8('0xc7')]()[_0xafc8('0xa5')]({'secret':![]})[_0xafc8('0x38')](function(_0x2e6b64){if(_0x2e6b64[_0xafc8('0x75')]){var _0xcf062d=path[_0xafc8('0x7b')](_0xff7dff,_0x2e6b64['Attachment'][_0xafc8('0x72')]);if(fs[_0xafc8('0xc8')](_0xcf062d)){fs['createReadStream'](_0xcf062d)[_0xafc8('0xc9')](fs[_0xafc8('0xca')](path[_0xafc8('0x7b')](_0x3c4165,_0x2e6b64['Attachment'][_0xafc8('0x72')])));}}return{'date':moment(_0x2e6b64['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xafc8('0xb3')](),'sender':_0x2e6b64[_0xafc8('0x90')]===_0xafc8('0x64')?_0x2e6b64[_0xafc8('0x85')]?_0x2e6b64['User'][_0xafc8('0x59')]:'System':_0x2e6b64['Contact']['firstName']+(_0x2e6b64[_0xafc8('0x69')][_0xafc8('0xbb')]?'\x20'+_0x2e6b64[_0xafc8('0x69')][_0xafc8('0xbb')]:''),'body':_0x2e6b64[_0xafc8('0x75')]?_0x2e6b64[_0xafc8('0x75')][_0xafc8('0x72')]:_0x2e6b64[_0xafc8('0x32')],'direction':_0x2e6b64[_0xafc8('0x90')]===_0xafc8('0x64')?'A':'C','secret':_0x2e6b64[_0xafc8('0x91')],'read':_0x2e6b64[_0xafc8('0xbc')],'attachment':_0x2e6b64['Attachment']};})['value']()};return ejs['renderFile'](path[_0xafc8('0x7b')](config[_0xafc8('0xb4')],'server',_0xafc8('0xcb'),_0xafc8('0xcc')),{'interaction':_0x180da4})[_0xafc8('0x1a')](function(_0xfa723e){var _0x22e4ef=path['join'](_0x3c4165,_0xafc8('0xcd')+_0x364efa['id']+'-'+_0x5c79ff+_0xafc8('0xce'));var _0x1bccfa={'path':_0x22e4ef,'channel':'Chat','interactionId':_0x364efa['id']};return pdf[_0xafc8('0xcf')](_0xfa723e,_0x1bccfa);})[_0xafc8('0x1a')](function(){return new Promise(function(_0x435f58,_0x45344c){zipdir(_0x3c4165,{'saveTo':_0x483535},function(_0x3409a5,_0x1357d4){if(_0x3409a5)return _0x45344c(_0x3409a5);return _0x435f58(_0x1357d4);});})['then'](function(){return new BPromise(function(_0x43a3ad,_0x1e6344){rimraf(_0x3c4165,function(_0x19d0ce){if(_0x19d0ce)_0x1e6344(_0x19d0ce);return _0x43a3ad();});});})[_0xafc8('0x1a')](function(){return _0xc0e564[_0xafc8('0xd0')](_0x483535,_0x3b4a48,function(_0x351d0e){if(_0x351d0e){logger[_0xafc8('0x1e')]('err',_0x351d0e);}else{fs[_0xafc8('0xd1')](_0x483535);}});});});}else{return _0xc0e564[_0xafc8('0x25')](0xc8);}})[_0xafc8('0x24')](handleError(_0xc0e564,null));}; \ No newline at end of file +var _0x65a6=['show','model','keys','filters','intersection','attributes','fields','includeAll','include','options','find','create','params','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','sendStatus','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','root','server/files/attachments/','offline-chat/','join','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','ContactId','length','%s%d','agentAlias','System','customer','Visitor','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','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','ids','getMessages','nolimit','limit','order','sort','pick','where','ChatInteractionId','filter','merge','map','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','hasOwnProperty','includeAgent','addTags','omit','spread','Tag','color','emit','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','push','lastName','read','Account','get','mkdirSync','Chat','Owner','N.A.','toString','closedAt','browserName','referer','customerIp','customerPort','createReadStream','pipe','renderFile','views','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','count','set','Content-Range','update','destroy','stack','name','send','render','body','account','index','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user'];(function(_0x4663bb,_0x1c2966){var _0x285df2=function(_0x48f7fc){while(--_0x48f7fc){_0x4663bb['push'](_0x4663bb['shift']());}};_0x285df2(++_0x1c2966);}(_0x65a6,0x16c));var _0x665a=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x65a6[_0xf51c06];return _0x1d5420;};'use strict';var rimraf=require(_0x665a('0x0'));var zipdir=require('zip-dir');var rp=require(_0x665a('0x1'));var moment=require(_0x665a('0x2'));var BPromise=require(_0x665a('0x3'));var Mustache=require(_0x665a('0x4'));var util=require('util');var path=require(_0x665a('0x5'));var ejs=require(_0x665a('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x665a('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x665a('0x8'));var pdf=require(_0x665a('0x9'));var logger=require(_0x665a('0xa'))(_0x665a('0xb'));var config=require(_0x665a('0xc'));var db=require(_0x665a('0xd'))['db'];config['redis']=_[_0x665a('0xe')](config[_0x665a('0xf')],{'host':_0x665a('0x10'),'port':0x18eb});var socket=require(_0x665a('0x11'))(new Redis(config[_0x665a('0xf')]));require(_0x665a('0x12'))[_0x665a('0x13')](socket);var jayson=require(_0x665a('0x14'));var client=jayson[_0x665a('0x15')][_0x665a('0x16')]({'port':0x232b});var client9004=jayson[_0x665a('0x15')]['http']({'port':0x232c});function respondWithRpcPromise(_0x454360,_0x17ef7b,_0x21b164,_0x2ebe0e){return new BPromise(function(_0x48da76,_0x4ffe3d){var _0x4fef67=_0x2ebe0e||client;return _0x4fef67['request'](_0x454360,_0x21b164)[_0x665a('0x17')](function(_0x13a71e){logger[_0x665a('0x18')](_0x665a('0x19'),_0x17ef7b,_0x665a('0x1a'));logger['debug'](_0x665a('0x1b'),_0x17ef7b,_0x665a('0x1a'),JSON[_0x665a('0x1c')](_0x13a71e));if(_0x13a71e[_0x665a('0x1d')]){if(_0x13a71e[_0x665a('0x1d')][_0x665a('0x1e')]===0x1f4){logger[_0x665a('0x1d')](_0x665a('0x19'),_0x17ef7b,_0x13a71e[_0x665a('0x1d')][_0x665a('0x1f')]);return _0x4ffe3d(_0x13a71e[_0x665a('0x1d')][_0x665a('0x1f')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x17ef7b,_0x13a71e[_0x665a('0x1d')][_0x665a('0x1f')]);return _0x48da76(_0x13a71e[_0x665a('0x1d')]['message']);}else{logger[_0x665a('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x17ef7b,_0x665a('0x1a'));_0x48da76(_0x13a71e['result']['message']);}})[_0x665a('0x20')](function(_0x4def99){logger[_0x665a('0x1d')](_0x665a('0x19'),_0x17ef7b,_0x4def99);_0x4ffe3d(_0x4def99);});});}function respondWithStatusCode(_0x22be50,_0x5abca6){_0x5abca6=_0x5abca6||0xcc;return function(_0x25291e){if(_0x25291e){return _0x22be50['sendStatus'](_0x5abca6);}return _0x22be50[_0x665a('0x21')](_0x5abca6)['end']();};}function respondWithResult(_0xa7b307,_0x38dcd9){_0x38dcd9=_0x38dcd9||0xc8;return function(_0x5b5637){if(_0x5b5637){return _0xa7b307[_0x665a('0x21')](_0x38dcd9)[_0x665a('0x22')](_0x5b5637);}};}function respondWithFilteredResult(_0x2ab6e6,_0x3ad9e8){return function(_0x54574c){if(_0x54574c){var _0x261964=typeof _0x3ad9e8[_0x665a('0x23')]===_0x665a('0x24')&&typeof _0x3ad9e8['limit']===_0x665a('0x24');var _0x172736=_0x54574c[_0x665a('0x25')];var _0x405760=_0x261964?0x0:_0x3ad9e8[_0x665a('0x23')];var _0x59a2d2=_0x261964?_0x54574c[_0x665a('0x25')]:_0x3ad9e8[_0x665a('0x23')]+_0x3ad9e8['limit'];var _0x47ec0d;if(_0x59a2d2>=_0x172736){_0x59a2d2=_0x172736;_0x47ec0d=0xc8;}else{_0x47ec0d=0xce;}_0x2ab6e6[_0x665a('0x21')](_0x47ec0d);return _0x2ab6e6[_0x665a('0x26')](_0x665a('0x27'),_0x405760+'-'+_0x59a2d2+'/'+_0x172736)['json'](_0x54574c);}return null;};}function saveUpdates(_0x360398){return function(_0x574ebd){if(_0x574ebd){return _0x574ebd[_0x665a('0x28')](_0x360398)[_0x665a('0x17')](function(_0x48b46a){return _0x48b46a;});}return null;};}function removeEntity(_0x17137b){return function(_0x49786d){if(_0x49786d){return _0x49786d[_0x665a('0x29')]()[_0x665a('0x17')](function(){_0x17137b[_0x665a('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ab863){return function(_0x562f36){if(!_0x562f36){_0x4ab863['sendStatus'](0x194);}return _0x562f36;};}function handleError(_0x10333b,_0x2f5510){_0x2f5510=_0x2f5510||0x1f4;return function(_0x27c7f9){logger[_0x665a('0x1d')](_0x27c7f9[_0x665a('0x2a')]);if(_0x27c7f9[_0x665a('0x2b')]){delete _0x27c7f9['name'];}_0x10333b[_0x665a('0x21')](_0x2f5510)[_0x665a('0x2c')](_0x27c7f9);};}function getMustacheRender(_0x3c2e81,_0x393003){return Mustache[_0x665a('0x2d')](_0x3c2e81,_['merge'](_0x393003[_0x665a('0x2e')],{'contact':_0x393003['contact'],'message':_0x393003[_0x665a('0x1f')],'agent':_0x393003['agent'],'interaction':_0x393003['interaction'],'account':_0x393003[_0x665a('0x2f')]}))||'';}exports[_0x665a('0x30')]=function(_0x33b296,_0x3f0167){var _0x2cf609={};var _0x1604ff=_['map'](db[_0x665a('0x31')][_0x665a('0x32')],function(_0x4fb88a){return{'name':_0x4fb88a[_0x665a('0x33')],'type':_0x4fb88a[_0x665a('0x34')][_0x665a('0x35')]};});_0x2cf609=qs[_0x665a('0x36')](_0x1604ff,_0x33b296);return interaction[_0x665a('0x37')]('chat',_0x33b296[_0x665a('0x38')],_0x33b296[_0x665a('0x39')],_0x2cf609,_0x1604ff)['then'](respondWithFilteredResult(_0x3f0167,_0x2cf609))[_0x665a('0x20')](handleError(_0x3f0167,null));};exports[_0x665a('0x3a')]=function(_0x3cff6e,_0x200d78){var _0x30e1bc={'raw':![],'where':{'id':_0x3cff6e['params']['id']}},_0x28f2e0={};_0x28f2e0[_0x665a('0x3b')]=_[_0x665a('0x3c')](db['ChatInteraction'][_0x665a('0x32')]);_0x28f2e0[_0x665a('0x38')]=_['keys'](_0x3cff6e[_0x665a('0x38')]);_0x28f2e0[_0x665a('0x3d')]=_[_0x665a('0x3e')](_0x28f2e0[_0x665a('0x3b')],_0x28f2e0[_0x665a('0x38')]);_0x30e1bc[_0x665a('0x3f')]=_[_0x665a('0x3e')](_0x28f2e0['model'],qs[_0x665a('0x40')](_0x3cff6e[_0x665a('0x38')][_0x665a('0x40')]));_0x30e1bc[_0x665a('0x3f')]=_0x30e1bc[_0x665a('0x3f')]['length']?_0x30e1bc[_0x665a('0x3f')]:_0x28f2e0[_0x665a('0x3b')];if(_0x3cff6e[_0x665a('0x38')][_0x665a('0x41')]){_0x30e1bc[_0x665a('0x42')]=[{'all':!![]}];}_0x30e1bc=_['merge']({},_0x30e1bc,_0x3cff6e[_0x665a('0x43')]);return db[_0x665a('0x31')][_0x665a('0x44')](_0x30e1bc)[_0x665a('0x17')](handleEntityNotFound(_0x200d78,null))['then'](respondWithResult(_0x200d78,null))[_0x665a('0x20')](handleError(_0x200d78,null));};exports[_0x665a('0x45')]=function(_0x4c4fe8,_0x51305f){return db[_0x665a('0x31')][_0x665a('0x45')](_0x4c4fe8[_0x665a('0x2e')],{})['then'](respondWithResult(_0x51305f,0xc9))[_0x665a('0x20')](handleError(_0x51305f,null));};exports[_0x665a('0x28')]=function(_0x23c1d1,_0x1af583){if(_0x23c1d1[_0x665a('0x2e')]['id']){delete _0x23c1d1[_0x665a('0x2e')]['id'];}return db[_0x665a('0x31')][_0x665a('0x44')]({'where':{'id':_0x23c1d1[_0x665a('0x46')]['id']}})[_0x665a('0x17')](handleEntityNotFound(_0x1af583,null))['then'](saveUpdates(_0x23c1d1[_0x665a('0x2e')],null))[_0x665a('0x17')](respondWithResult(_0x1af583,null))[_0x665a('0x20')](handleError(_0x1af583,null));};exports['destroy']=function(_0x269042,_0x46fc83){return db[_0x665a('0x31')]['find']({'where':{'id':_0x269042[_0x665a('0x46')]['id']}})[_0x665a('0x17')](handleEntityNotFound(_0x46fc83,null))[_0x665a('0x17')](removeEntity(_0x46fc83,null))[_0x665a('0x20')](handleError(_0x46fc83,null));};exports[_0x665a('0x47')]=function(_0xc4a2c5,_0x365049){return db[_0x665a('0x31')]['describe']()['then'](respondWithResult(_0x365049,null))[_0x665a('0x20')](handleError(_0x365049,null));};exports[_0x665a('0x48')]=function(_0x49a546,_0xf1a106){var _0x4ed64c=_0x49a546[_0x665a('0x46')]['id'];var _0x390a4b;var _0x3d5c03;var _0x264da8;return db[_0x665a('0x31')][_0x665a('0x49')]({'where':{'id':_0x4ed64c}})['then'](function(_0x1f2b13){_0x390a4b=_0x1f2b13;return db[_0x665a('0x4a')][_0x665a('0x49')]({'where':{'id':_0x1f2b13[_0x665a('0x4b')]},'attributes':['id',_0x665a('0x4c'),_0x665a('0x4d'),_0x665a('0x4e'),'vidaooNote',_0x665a('0x4f')],'raw':!![]});})[_0x665a('0x17')](function(_0x1907fb){if(_0x1907fb&&_0x1907fb[_0x665a('0x4c')]&&_0x1907fb[_0x665a('0x4d')]){_0x3d5c03=_0x1907fb;var _0x55b998={'interaction':{'id':_0x4ed64c},'agent':{'id':_0x49a546[_0x665a('0x39')]['id'],'name':_0x49a546['user']['name'],'fullname':_0x49a546[_0x665a('0x39')]['fullname'],'email':_0x49a546[_0x665a('0x39')][_0x665a('0x50')]},'contact':_0x49a546['body'][_0x665a('0x51')],'account':_0x49a546[_0x665a('0x2e')][_0x665a('0x2f')]};var _0x4b0990={'rejectUnauthorized':![],'method':_0x665a('0x52'),'url':_0x665a('0x53'),'headers':{'X-APIKEY':_0x1907fb[_0x665a('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x49a546['user']['email']],'buttons':null,'topic':_0x3d5c03['vidaooTopic'],'note':_['isNull'](_0x3d5c03[_0x665a('0x54')])?null:getMustacheRender(_0x3d5c03[_0x665a('0x54')],_0x55b998),'metadata':null},'redirect':_0x665a('0x55'),'json':!![]};try{if(!_[_0x665a('0x56')](_0x3d5c03[_0x665a('0x4f')])){var _0x2f5e20=getMustacheRender(_0x3d5c03[_0x665a('0x4f')],_0x55b998);var _0x2fadfa=JSON[_0x665a('0x57')](_0x2f5e20);_0x4b0990[_0x665a('0x2e')][_0x665a('0x58')]=_0x2fadfa;}}catch(_0x3837d6){throw new db['Sequelize'][(_0x665a('0x59'))](_0x665a('0x5a'));}return rp(_0x4b0990);}else{throw new db['Sequelize'][(_0x665a('0x59'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x665a('0x17')](function(_0x2aa2a0){_0x264da8=_0x2aa2a0;if(_0x264da8['id']){var _0x23e638={'body':_0x264da8[_0x665a('0x5b')],'ChatWebsiteId':_0x3d5c03['id'],'ChatInteractionId':_0x390a4b['id'],'direction':_0x665a('0x5c'),'UserId':_0x49a546[_0x665a('0x39')]['id']};return db['ChatMessage'][_0x665a('0x45')](_0x23e638,{});}else{throw new db[(_0x665a('0x5d'))]['ValidationError'](_0x665a('0x5e'));}})[_0x665a('0x17')](function(){return _0x390a4b[_0x665a('0x5f')]({'vidaooSessionId':_0x264da8['id']});})[_0x665a('0x17')](respondWithResult(_0xf1a106,null))[_0x665a('0x20')](handleError(_0xf1a106,null));};exports[_0x665a('0x60')]=function(_0x41a007,_0x3b53ab){if(_0x41a007['body']['id']){delete _0x41a007['body']['id'];}return db[_0x665a('0x31')][_0x665a('0x44')]({'where':{'id':_0x41a007[_0x665a('0x46')]['id']},'include':[{'model':db[_0x665a('0x61')],'as':_0x665a('0x62')}]})['then'](handleEntityNotFound(_0x3b53ab,null))['then'](saveUpdates(_0x41a007[_0x665a('0x2e')],null))[_0x665a('0x17')](respondWithResult(_0x3b53ab,null))['catch'](handleError(_0x3b53ab,null));};exports['abandon']=function(_0x2c95c0,_0xde2649){if(_0x2c95c0[_0x665a('0x2e')]['id']){delete _0x2c95c0[_0x665a('0x2e')]['id'];}return db[_0x665a('0x31')][_0x665a('0x44')]({'where':{'id':_0x2c95c0[_0x665a('0x46')]['id']}})[_0x665a('0x17')](function(_0xa1aa17){if(!_0xa1aa17){logger[_0x665a('0x1d')](_0x665a('0x63'),_0x665a('0x64'),0x194,_0x665a('0x65'));_0xde2649[_0x665a('0x66')](0x194);}else{if(_0xa1aa17[_0x665a('0x67')]){throw new db[(_0x665a('0x5d'))][(_0x665a('0x59'))](_0x665a('0x68'));}}return _0xa1aa17;})[_0x665a('0x17')](function(_0x430110){if(_0x430110){return _0x430110[_0x665a('0x28')]({'closed':_0x2c95c0[_0x665a('0x2e')][_0x665a('0x69')],'disposition':_0x2c95c0[_0x665a('0x2e')][_0x665a('0x6a')]})[_0x665a('0x17')](function(_0x33051d){return _0x33051d;});}})[_0x665a('0x17')](function(){return respondWithRpcPromise(_0x665a('0x6b'),_0x665a('0x64'),_0x2c95c0[_0x665a('0x2e')],client9004);})['then'](respondWithResult(_0xde2649,null))[_0x665a('0x20')](handleError(_0xde2649,null));};exports[_0x665a('0x6c')]=function(_0x4b8004,_0x54c28a){_0x4b8004[_0x665a('0x2e')]['name']=_0x4b8004['file'][_0x665a('0x6d')];_0x4b8004[_0x665a('0x2e')][_0x665a('0x6e')]=_0x4b8004[_0x665a('0x6f')]['filename'];_0x4b8004[_0x665a('0x2e')][_0x665a('0x34')]=_0x4b8004[_0x665a('0x6f')][_0x665a('0x70')];return db[_0x665a('0x71')][_0x665a('0x45')](_0x4b8004[_0x665a('0x2e')])[_0x665a('0x17')](respondWithResult(_0x54c28a,0xc9))[_0x665a('0x20')](handleError(_0x54c28a,null));};exports[_0x665a('0x72')]=function(_0x48c59a,_0x43d4fd){return db[_0x665a('0x31')][_0x665a('0x49')]({'where':{'id':_0x48c59a[_0x665a('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x43d4fd,null))[_0x665a('0x17')](function(_0xe75721){if(_0xe75721){if(_0xe75721[_0x665a('0x69')]){return _0x43d4fd[_0x665a('0x21')](0x193)[_0x665a('0x22')]({'status':0x193,'message':_0x665a('0x73')});}return db[_0x665a('0x71')]['findOne']({'where':{'id':_0x48c59a[_0x665a('0x38')][_0x665a('0x74')]},'raw':!![]})[_0x665a('0x17')](handleEntityNotFound(_0x43d4fd,null));}})[_0x665a('0x17')](function(_0x16ddf1){if(_0x16ddf1){var _0x2c181c=_0x16ddf1['ChatOfflineMessageId']!==null;var _0xaab45b=path['join'](config[_0x665a('0x75')],_0x665a('0x76'));if(_0x2c181c){_0xaab45b=path['join'](_0xaab45b,_0x665a('0x77'));}var _0x417c07=path[_0x665a('0x78')](_0xaab45b,_0x16ddf1['basename']);return _0x43d4fd[_0x665a('0x79')](_0x417c07);}})['catch'](handleError(_0x43d4fd,null));};exports[_0x665a('0x7a')]=function(_0x1934cd,_0x30c455){var _0x3d97bb=null;var _0x37c537=null;var _0x2f2c72=null;if(_0x1934cd['body']['id']){delete _0x1934cd[_0x665a('0x2e')]['id'];}if(_0x1934cd[_0x665a('0x2e')][_0x665a('0x7b')]){_0x2f2c72=path[_0x665a('0x78')](config[_0x665a('0x75')],_0x665a('0x7c'),util[_0x665a('0x7d')](_0x665a('0x7e'),Date[_0x665a('0x7f')]()));_0x1934cd[_0x665a('0x2e')][_0x665a('0x80')]=_0x2f2c72;}return db['ChatInteraction'][_0x665a('0x44')]({'where':{'id':_0x1934cd[_0x665a('0x46')]['id']},'include':[{'model':db[_0x665a('0x81')],'as':_0x665a('0x82'),'include':[{'model':db['User'],'as':_0x665a('0x83')}]}]})[_0x665a('0x17')](handleEntityNotFound(_0x30c455,null))[_0x665a('0x17')](saveUpdates(_0x1934cd[_0x665a('0x2e')],null))[_0x665a('0x17')](function(_0x1dc6e2){if(_0x1dc6e2){_0x3d97bb=_0x1dc6e2;return db[_0x665a('0x4a')]['find']({'where':{'id':_0x3d97bb[_0x665a('0x4b')]}});}})[_0x665a('0x17')](function(_0x337826){if(_0x337826){_0x37c537=_0x337826;return db[_0x665a('0x61')]['find']({'where':{'id':_0x3d97bb[_0x665a('0x84')]}});}})[_0x665a('0x17')](function(_0x304b72){if(_0x304b72){if(_0x2f2c72){var _0xcee4c3=null;for(var _0x1f5e77=0x1;_0x1f5e77<_0x3d97bb[_0x665a('0x82')][_0x665a('0x85')];++_0x1f5e77){_0xcee4c3=_0x3d97bb[_0x665a('0x82')][_0x1f5e77];var _0x5d0bfd=_0xcee4c3[_0x665a('0x67')]?util[_0x665a('0x7d')](_0x665a('0x86'),_0x37c537[_0x665a('0x87')],_0xcee4c3[_0x665a('0x67')]):_0x665a('0x88');var _0x706d0=_0x1934cd['body'][_0x665a('0x89')]||util[_0x665a('0x7d')](_0x665a('0x86'),_0x665a('0x8a'),_0xcee4c3[_0x665a('0x84')]);switch(_0x37c537['agentIdentifier']){case'website_alias':_0x5d0bfd=_0xcee4c3[_0x665a('0x67')]?util['format'](_0x665a('0x86'),_0x37c537[_0x665a('0x87')],_0xcee4c3[_0x665a('0x67')]):_0x665a('0x88');break;case _0x665a('0x8b'):_0x5d0bfd=_0xcee4c3['UserId']?_0xcee4c3[_0x665a('0x83')][_0x665a('0x8c')]||_0xcee4c3['User'][_0x665a('0x8d')]:'System';break;case _0x665a('0x8e'):_0x5d0bfd=_0xcee4c3[_0x665a('0x67')]?_0xcee4c3[_0x665a('0x83')][_0x665a('0x8d')]:_0x665a('0x88');break;default:_0x5d0bfd=_0xcee4c3[_0x665a('0x67')]?util[_0x665a('0x7d')](_0x665a('0x86'),_0x37c537[_0x665a('0x87')],_0xcee4c3['UserId']):_0x665a('0x88');}var _0xe04002=util[_0x665a('0x7d')](_0x665a('0x8f'),moment(_0xcee4c3[_0x665a('0x90')])[_0x665a('0x7d')](_0x665a('0x91')),_0xcee4c3[_0x665a('0x92')]==='in'?_0x706d0:_0x5d0bfd,_0xcee4c3['body']);if(!_0xcee4c3[_0x665a('0x93')]){fs[_0x665a('0x94')](_0x2f2c72,_0xe04002);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x665a('0x95')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x665a('0x96')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x665a('0x17')](function(_0x15a85e){if(!_0x15a85e||!_0x15a85e[_0x665a('0x97')]||!_0x1934cd[_0x665a('0x2e')])return _0x3d97bb;var _0x149a8f=_0x15a85e[_0x665a('0x98')]();return respondWithRpcPromise(_0x665a('0x99'),_0x665a('0x9a'),{'account':_0x149a8f,'message':{'from':util[_0x665a('0x7d')](_0x665a('0x9b'),_0x15a85e['name'],_0x15a85e['email']||_0x15a85e[_0x665a('0x97')]['user']),'to':_0x1934cd[_0x665a('0x2e')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x665a('0x7d')](_0x665a('0x9c'),_0x1934cd[_0x665a('0x2e')][_0x665a('0x7b')]),'attachments':[{'path':_0x2f2c72}]}})['then'](function(){return _0x3d97bb;})[_0x665a('0x20')](function(_0x409321){logger['error'](_0x409321);});})[_0x665a('0x17')](respondWithStatusCode(_0x30c455,0xc8))[_0x665a('0x20')](handleError(_0x30c455,null));};exports['addMessage']=function(_0x1d97f1,_0x1304fa){return db[_0x665a('0x81')]['find']({'where':{'id':_0x1d97f1['params']['id']}})[_0x665a('0x17')](handleEntityNotFound(_0x1304fa,null))[_0x665a('0x17')](function(_0x4294a0){if(_0x4294a0){return _0x4294a0[_0x665a('0x9d')](_0x1d97f1[_0x665a('0x2e')][_0x665a('0x9e')],_['omit'](_0x1d97f1['body'],[_0x665a('0x9e'),'id'])||{});}})['then'](respondWithResult(_0x1304fa,null))['catch'](handleError(_0x1304fa,null));};exports[_0x665a('0x9f')]=function(_0xcfc934,_0x74197d){var _0x5cddbf={'raw':![],'where':{}};var _0x18a40c={};var _0x32b752={'count':0x0,'rows':[]};return db[_0x665a('0x31')]['findOne']({'where':{'id':_0xcfc934[_0x665a('0x46')]['id']}})[_0x665a('0x17')](handleEntityNotFound(_0x74197d,null))['then'](function(_0x4b51d4){if(_0x4b51d4){_0x18a40c[_0x665a('0x3b')]=_[_0x665a('0x3c')](db[_0x665a('0x81')][_0x665a('0x32')]);_0x18a40c['query']=_[_0x665a('0x3c')](_0xcfc934[_0x665a('0x38')]);_0x18a40c[_0x665a('0x3d')]=_[_0x665a('0x3e')](_0x18a40c[_0x665a('0x3b')],_0x18a40c[_0x665a('0x38')]);_0x5cddbf['attributes']=_[_0x665a('0x3e')](_0x18a40c[_0x665a('0x3b')],qs['fields'](_0xcfc934['query'][_0x665a('0x40')]));_0x5cddbf[_0x665a('0x3f')]=_0x5cddbf[_0x665a('0x3f')]['length']?_0x5cddbf[_0x665a('0x3f')]:_0x18a40c[_0x665a('0x3b')];if(!_0xcfc934[_0x665a('0x38')]['hasOwnProperty'](_0x665a('0xa0'))){_0x5cddbf[_0x665a('0xa1')]=qs[_0x665a('0xa1')](_0xcfc934[_0x665a('0x38')][_0x665a('0xa1')]);_0x5cddbf['offset']=qs[_0x665a('0x23')](_0xcfc934[_0x665a('0x38')][_0x665a('0x23')]);}_0x5cddbf[_0x665a('0xa2')]=qs[_0x665a('0xa3')](_0xcfc934[_0x665a('0x38')][_0x665a('0xa3')]);_0x5cddbf['where']=qs['filters'](_[_0x665a('0xa4')](_0xcfc934[_0x665a('0x38')],_0x18a40c[_0x665a('0x3d')]));_0x5cddbf[_0x665a('0xa5')][_0x665a('0xa6')]=_0x4b51d4['id'];if(_0xcfc934['query'][_0x665a('0xa7')]){_0x5cddbf[_0x665a('0xa5')]=_[_0x665a('0xa8')](_0x5cddbf[_0x665a('0xa5')],{'$or':_[_0x665a('0xa9')](_0x5cddbf[_0x665a('0x3f')],function(_0x43f3e1){var _0x485178={};_0x485178[_0x43f3e1]={'$like':'%'+_0xcfc934[_0x665a('0x38')][_0x665a('0xa7')]+'%'};return _0x485178;})});}if(_0xcfc934['query'][_0x665a('0xaa')]){var _0x7837b9=_0xcfc934[_0x665a('0x38')][_0x665a('0xaa')]['split'](',');var _0xdbc1d6={};_0xdbc1d6[_0x7837b9[0x0]]={'$gte':moment(_0x7837b9[0x1])[_0x665a('0x7d')](_0x665a('0xab'))};_0x5cddbf['where']=_[_0x665a('0xa8')](_0x5cddbf[_0x665a('0xa5')],_0xdbc1d6);}_0x5cddbf=_[_0x665a('0xa8')]({},_0x5cddbf,_0xcfc934['options']);return db[_0x665a('0x81')][_0x665a('0x25')]({'where':_0x5cddbf[_0x665a('0xa5')]})['then'](function(_0x461e1a){_0x32b752[_0x665a('0x25')]=_0x461e1a;if(_0xcfc934[_0x665a('0x38')][_0x665a('0x41')]){_0x5cddbf[_0x665a('0x42')]=[{'all':!![]}];}return db['ChatMessage'][_0x665a('0x37')](_0x5cddbf);})['then'](function(_0x42e09a){_0x32b752[_0x665a('0xac')]=_0x42e09a;return _0x32b752;});}})[_0x665a('0x17')](respondWithFilteredResult(_0x74197d,_0x5cddbf))['catch'](handleError(_0x74197d,null));};exports[_0x665a('0xad')]=function(_0x92cb4,_0x59e970){var _0x17037c={'where':{}},_0x46bff3={},_0x6da8ff={'count':0x0,'rows':[]};return db[_0x665a('0x31')][_0x665a('0x49')]({'where':{'id':_0x92cb4['params']['id']}})[_0x665a('0x17')](handleEntityNotFound(_0x59e970,null))['then'](function(_0x15db41){if(_0x15db41){_0x46bff3['model']=_['keys'](db['ChatMessage'][_0x665a('0x32')]);_0x46bff3[_0x665a('0x38')]=_[_0x665a('0x3c')](_0x92cb4['query']);_0x46bff3[_0x665a('0x3d')]=_['intersection'](_0x46bff3[_0x665a('0x3b')],_0x46bff3[_0x665a('0x38')]);_0x17037c['attributes']=_[_0x665a('0x3e')](_0x46bff3[_0x665a('0x3b')],qs[_0x665a('0x40')](_0x92cb4[_0x665a('0x38')][_0x665a('0x40')]));_0x17037c['attributes']=_0x17037c['attributes'][_0x665a('0x85')]?_0x17037c[_0x665a('0x3f')]:_0x46bff3['model'];if(!_0x92cb4[_0x665a('0x38')][_0x665a('0xae')](_0x665a('0xa0'))){_0x17037c[_0x665a('0xa1')]=qs[_0x665a('0xa1')](_0x92cb4[_0x665a('0x38')]['limit']);_0x17037c[_0x665a('0x23')]=qs['offset'](_0x92cb4['query'][_0x665a('0x23')]);}_0x17037c['order']=qs[_0x665a('0xa3')](_0x92cb4['query'][_0x665a('0xa3')]);_0x17037c['where']=qs[_0x665a('0x3d')](_[_0x665a('0xa4')](_0x92cb4['query'],_0x46bff3[_0x665a('0x3d')]));_0x17037c[_0x665a('0xa5')][_0x665a('0xa6')]=_0x15db41['id'];if(_0x92cb4[_0x665a('0x38')][_0x665a('0xa7')]){_0x17037c[_0x665a('0xa5')]=_[_0x665a('0xa8')](_0x17037c[_0x665a('0xa5')],{'$or':_[_0x665a('0xa9')](_0x17037c['attributes'],function(_0x5519a3){var _0xf9dcac={};_0xf9dcac[_0x5519a3]={'$like':'%'+_0x92cb4['query'][_0x665a('0xa7')]+'%'};return _0xf9dcac;})});}_0x17037c[_0x665a('0xa5')][_0x665a('0x93')]=![];if(_0x92cb4[_0x665a('0x38')]['id']){_0x17037c[_0x665a('0xa5')]['id']={'$gt':_0x92cb4['query']['id']};}_0x17037c=_[_0x665a('0xa8')]({},_0x17037c,_0x92cb4[_0x665a('0x43')]);return db[_0x665a('0x81')][_0x665a('0x25')]({'where':_0x17037c['where']})[_0x665a('0x17')](function(_0x904027){_0x6da8ff[_0x665a('0x25')]=_0x904027;_0x17037c[_0x665a('0x42')]=[];if(_0x92cb4[_0x665a('0x38')][_0x665a('0xaf')]){_0x17037c[_0x665a('0x42')]['push']({'model':db['User'],'as':_0x665a('0x83'),'attributes':['id',_0x665a('0x8d'),_0x665a('0x8c')]});}if(_0x92cb4['query'][_0x665a('0x41')]){_0x17037c['include']=[{'all':!![]}];}return db[_0x665a('0x81')][_0x665a('0x37')](_0x17037c);})[_0x665a('0x17')](function(_0x53abfb){_0x6da8ff[_0x665a('0xac')]=_0x53abfb;return _0x6da8ff;});}})[_0x665a('0x17')](respondWithFilteredResult(_0x59e970,_0x17037c))[_0x665a('0x20')](handleError(_0x59e970,null));};exports[_0x665a('0xb0')]=function(_0x581bac,_0x51e019){return db[_0x665a('0x31')][_0x665a('0x44')]({'where':{'id':_0x581bac['params']['id']}})['then'](handleEntityNotFound(_0x51e019,null))[_0x665a('0x17')](function(_0x9b1e98){if(_0x9b1e98){return _0x9b1e98['setTags'](_0x581bac[_0x665a('0x2e')]['ids'],_[_0x665a('0xb1')](_0x581bac[_0x665a('0x2e')],[_0x665a('0x9e'),'id'])||{})[_0x665a('0xb2')](function(){return db[_0x665a('0xb3')][_0x665a('0x37')]({'attributes':['id',_0x665a('0x2b'),_0x665a('0xb4')],'where':{'id':_0x581bac[_0x665a('0x2e')][_0x665a('0x9e')]}});})[_0x665a('0x17')](function(_0x59166b){socket[_0x665a('0xb5')]('chatInteractionTags:save',{'id':Number(_0x581bac[_0x665a('0x46')]['id']),'tags':_0x59166b||[]});return{'id':Number(_0x581bac[_0x665a('0x46')]['id']),'tags':_0x59166b||[]};});}})[_0x665a('0x17')](respondWithResult(_0x51e019,null))[_0x665a('0x20')](handleError(_0x51e019,null));};exports[_0x665a('0xb6')]=function(_0x2b3863,_0x36dc74){return db['ChatInteraction'][_0x665a('0x44')]({'where':{'id':_0x2b3863['params']['id']}})['then'](handleEntityNotFound(_0x36dc74,null))[_0x665a('0x17')](function(_0x42a848){if(_0x42a848){return _0x42a848[_0x665a('0xb6')](_0x2b3863['query'][_0x665a('0x9e')]);}})[_0x665a('0x17')](respondWithStatusCode(_0x36dc74,null))[_0x665a('0x20')](handleError(_0x36dc74,null));};exports[_0x665a('0x79')]=function(_0x25b8d2,_0x5dca96){var _0x37c658=moment()['unix']()['toString']();var _0x4059ef=path['join'](config[_0x665a('0x75')],_0x665a('0xb7'),_0x665a('0xb8'),_0x665a('0xb9'));var _0x32a8cd=path[_0x665a('0x78')](config['root'],_0x665a('0xb7'),'files',_0x665a('0xba'));var _0x361e05=path[_0x665a('0x78')](_0x4059ef,_0x37c658);var _0x12529b=util[_0x665a('0x7d')](_0x665a('0xbb'),_0x25b8d2[_0x665a('0x46')]['id'],_0x37c658);var _0x9c8773=path['join'](_0x4059ef,_0x12529b);var _0xc9a3d2=[];_0xc9a3d2[_0x665a('0xbc')]({'model':db[_0x665a('0x83')],'as':_0x665a('0x83'),'attributes':['id',_0x665a('0x8d')],'raw':!![]});_0xc9a3d2[_0x665a('0xbc')]({'model':db[_0x665a('0x61')],'as':_0x665a('0x62'),'attributes':['id','firstName',_0x665a('0xbd')],'raw':!![]});if(_0x25b8d2[_0x665a('0x38')][_0x665a('0xba')]){_0xc9a3d2[_0x665a('0xbc')]({'model':db[_0x665a('0x71')],'as':_0x665a('0x71'),'raw':!![]});}var _0xc6a0d3=[{'model':db['ChatMessage'],'as':_0x665a('0x82'),'attributes':['id','body',_0x665a('0x90'),_0x665a('0x92'),_0x665a('0x93'),_0x665a('0xbe')],'include':_0xc9a3d2}];_0xc6a0d3[_0x665a('0xbc')]({'model':db['ChatWebsite'],'as':_0x665a('0xbf'),'attributes':['id',_0x665a('0x2b')]});_0xc6a0d3['push']({'model':db[_0x665a('0x83')],'as':'Owner','attributes':['id','fullname']});return db[_0x665a('0x31')][_0x665a('0x44')]({'where':{'id':_0x25b8d2['params']['id']},'include':_0xc6a0d3})['then'](handleEntityNotFound(_0x5dca96,null))['then'](function(_0x135dfd){if(_0x135dfd){var _0x5104e1=_0x135dfd[_0x665a('0xc0')]({'plain':!![]});fs[_0x665a('0xc1')](_0x361e05);var _0x51bcce={'channel':_0x665a('0xc2'),'account':_0x5104e1[_0x665a('0xbf')][_0x665a('0x2b')],'agent':_0x5104e1[_0x665a('0xc3')]?_0x5104e1[_0x665a('0xc3')][_0x665a('0x8d')]:_0x665a('0xc4'),'createdAt':moment(_0x5104e1[_0x665a('0x90')])[_0x665a('0x7d')](_0x665a('0xab'))[_0x665a('0xc5')](),'closedAt':_0x5104e1[_0x665a('0x69')]?moment(_0x5104e1[_0x665a('0xc6')])[_0x665a('0x7d')](_0x665a('0xab'))['toString']():'','disposition':_0x5104e1['disposition'],'chatInfo':{'browser':_0x5104e1[_0x665a('0xc7')],'os':_0x5104e1['osName'],'referer':_0x5104e1[_0x665a('0xc8')],'customerIp':_0x5104e1[_0x665a('0xc9')],'customerPort':_0x5104e1[_0x665a('0xca')]?_0x5104e1[_0x665a('0xca')]:_0x665a('0xc4')},'messages':_(_0x5104e1[_0x665a('0x82')])['tail']()[_0x665a('0xa7')]({'secret':![]})[_0x665a('0xa9')](function(_0xbe8cf0){if(_0xbe8cf0[_0x665a('0x71')]){var _0x2fe40c=path[_0x665a('0x78')](_0x32a8cd,_0xbe8cf0[_0x665a('0x71')][_0x665a('0x6e')]);if(fs['existsSync'](_0x2fe40c)){fs[_0x665a('0xcb')](_0x2fe40c)[_0x665a('0xcc')](fs['createWriteStream'](path[_0x665a('0x78')](_0x361e05,_0xbe8cf0['Attachment'][_0x665a('0x6e')])));}}return{'date':moment(_0xbe8cf0[_0x665a('0x90')])[_0x665a('0x7d')](_0x665a('0xab'))['toString'](),'sender':_0xbe8cf0[_0x665a('0x92')]===_0x665a('0x5c')?_0xbe8cf0['User']?_0xbe8cf0['User'][_0x665a('0x8d')]:'System':_0xbe8cf0[_0x665a('0x62')]['firstName']+(_0xbe8cf0[_0x665a('0x62')][_0x665a('0xbd')]?'\x20'+_0xbe8cf0['Contact'][_0x665a('0xbd')]:''),'body':_0xbe8cf0[_0x665a('0x71')]?_0xbe8cf0[_0x665a('0x71')][_0x665a('0x6e')]:_0xbe8cf0[_0x665a('0x2e')],'direction':_0xbe8cf0[_0x665a('0x92')]==='out'?'A':'C','secret':_0xbe8cf0[_0x665a('0x93')],'read':_0xbe8cf0[_0x665a('0xbe')],'attachment':_0xbe8cf0[_0x665a('0x71')]};})['value']()};return ejs[_0x665a('0xcd')](path['join'](config['root'],'server',_0x665a('0xce'),'downloadInteraction.ejs'),{'interaction':_0x51bcce})[_0x665a('0x17')](function(_0x5ad0d2){var _0x22c32a=path['join'](_0x361e05,'transcript-'+_0x5104e1['id']+'-'+_0x37c658+_0x665a('0xcf'));var _0x304ca8={'path':_0x22c32a,'channel':_0x665a('0xc2'),'interactionId':_0x5104e1['id']};return pdf[_0x665a('0xd0')](_0x5ad0d2,_0x304ca8);})['then'](function(){return new Promise(function(_0x40b8dd,_0x1c67fe){zipdir(_0x361e05,{'saveTo':_0x9c8773},function(_0x3df48c,_0x3002ba){if(_0x3df48c)return _0x1c67fe(_0x3df48c);return _0x40b8dd(_0x3002ba);});})[_0x665a('0x17')](function(){return new BPromise(function(_0x26f4fb,_0x1550db){rimraf(_0x361e05,function(_0x590922){if(_0x590922)_0x1550db(_0x590922);return _0x26f4fb();});});})[_0x665a('0x17')](function(){return _0x5dca96[_0x665a('0x79')](_0x9c8773,_0x12529b,function(_0x195fbb){if(_0x195fbb){logger[_0x665a('0x1d')](_0x665a('0xd1'),_0x195fbb);}else{fs[_0x665a('0xd2')](_0x9c8773);}});});});}else{return _0x5dca96['sendStatus'](0xc8);}})[_0x665a('0x20')](handleError(_0x5dca96,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index cdd474d..e627590 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 _0x30b7=['then','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','ChatInteraction','ChatMessage','save','update','remove','getUsers'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x30b7,0xa3));var _0x730b=function(_0x32db09,_0x12da24){_0x32db09=_0x32db09-0x0;var _0x55dbf9=_0x30b7[_0x32db09];return _0x55dbf9;};'use strict';var EventEmitter=require(_0x730b('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x730b('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x730b('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x730b('0x3'),'afterUpdate':_0x730b('0x4'),'afterDestroy':_0x730b('0x5')};function emitEvent(_0x5f2245){return function(_0x3a829d,_0x23a9d8,_0x347bf4){_0x3a829d[_0x730b('0x6')]({'attributes':['id'],'raw':!![]})[_0x730b('0x7')](function(_0x4f9905){_0x3a829d[_0x730b('0x8')](_0x730b('0x9'),_0x4f9905['map'](function(_0x26156d){return{'id':_0x26156d['id']};}));return ChatMessage[_0x730b('0xa')]({'where':{'ChatInteractionId':_0x3a829d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30eb6f){_0x3a829d[_0x730b('0x8')](_0x730b('0xb'),_0x30eb6f[_0x730b('0xc')]);ChatInteractionEvents[_0x730b('0xd')](_0x5f2245+':'+_0x3a829d['id'],_0x3a829d);ChatInteractionEvents['emit'](_0x5f2245,_0x3a829d);_0x347bf4(null);})['catch'](_0x347bf4(null));};}for(var e in events){if(events[_0x730b('0xe')](e)){var event=events[e];ChatInteraction[_0x730b('0xf')](e,emitEvent(event));}}module[_0x730b('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xb6fa=['remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','update'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xb6fa,0x11c));var _0xab6f=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0xb6fa[_0x609988];return _0x159984;};'use strict';var EventEmitter=require(_0xab6f('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0xab6f('0x1'))['db'][_0xab6f('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xab6f('0x3'),'afterDestroy':_0xab6f('0x4')};function emitEvent(_0x461f1){return function(_0x278eb1,_0x2e75ac,_0x17abcd){_0x278eb1['getUsers']({'attributes':['id'],'raw':!![]})[_0xab6f('0x5')](function(_0x786ad5){_0x278eb1[_0xab6f('0x6')](_0xab6f('0x7'),_0x786ad5[_0xab6f('0x8')](function(_0x135bb1){return{'id':_0x135bb1['id']};}));return ChatMessage[_0xab6f('0x9')]({'where':{'ChatInteractionId':_0x278eb1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xab6f('0x5')](function(_0x36effe){_0x278eb1['setDataValue'](_0xab6f('0xa'),_0x36effe[_0xab6f('0xb')]);ChatInteractionEvents['emit'](_0x461f1+':'+_0x278eb1['id'],_0x278eb1);ChatInteractionEvents[_0xab6f('0xc')](_0x461f1,_0x278eb1);_0x17abcd(null);})[_0xab6f('0xd')](_0x17abcd(null));};}for(var e in events){if(events[_0xab6f('0xe')](e)){var event=events[e];ChatInteraction[_0xab6f('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index b973a17..f15160c 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 _0x72f2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x13e17f,_0x89b33c){var _0x1eaa46=function(_0x22724b){while(--_0x22724b){_0x13e17f['push'](_0x13e17f['shift']());}};_0x1eaa46(++_0x89b33c);}(_0x72f2,0xe2));var _0x272f=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x72f2[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x272f('0x0'));var util=require(_0x272f('0x1'));var logger=require(_0x272f('0x2'))(_0x272f('0x3'));var moment=require(_0x272f('0x4'));var BPromise=require(_0x272f('0x5'));var rp=require(_0x272f('0x6'));var fs=require('fs');var path=require(_0x272f('0x7'));var rimraf=require(_0x272f('0x8'));var config=require(_0x272f('0x9'));var attributes=require('./chatInteraction.attributes');module[_0x272f('0xa')]=function(_0x3fb4cb,_0x136024){return _0x3fb4cb[_0x272f('0xb')](_0x272f('0xc'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x565ed4,_0x5c3da0,_0x21a8c8){if(_0x565ed4[_0x272f('0xd')]('closed')){_0x565ed4[_0x272f('0xe')]=moment()[_0x272f('0xf')](_0x272f('0x10'));}_0x21a8c8(null,_0x565ed4);}},'charset':_0x272f('0x11'),'collate':_0x272f('0x12')});}; \ No newline at end of file +var _0xb221=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb221,0x6b));var _0x1b22=function(_0x2272d7,_0x694f20){_0x2272d7=_0x2272d7-0x0;var _0x42697c=_0xb221[_0x2272d7];return _0x42697c;};'use strict';var _=require(_0x1b22('0x0'));var util=require('util');var logger=require(_0x1b22('0x1'))(_0x1b22('0x2'));var moment=require(_0x1b22('0x3'));var BPromise=require(_0x1b22('0x4'));var rp=require(_0x1b22('0x5'));var fs=require('fs');var path=require(_0x1b22('0x6'));var rimraf=require(_0x1b22('0x7'));var config=require(_0x1b22('0x8'));var attributes=require(_0x1b22('0x9'));module[_0x1b22('0xa')]=function(_0x244daa,_0x35953b){return _0x244daa[_0x1b22('0xb')](_0x1b22('0xc'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1925a1,_0x3b003f,_0x58ff0b){if(_0x1925a1[_0x1b22('0xd')](_0x1b22('0xe'))){_0x1925a1[_0x1b22('0xf')]=moment()['format'](_0x1b22('0x10'));}_0x58ff0b(null,_0x1925a1);}},'charset':_0x1b22('0x11'),'collate':_0x1b22('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index daed266..96afa1f 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 _0xad0a=['redis','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','debug','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','stringify','util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost'];(function(_0x46aae9,_0x20601f){var _0x43bb1e=function(_0x39596e){while(--_0x39596e){_0x46aae9['push'](_0x46aae9['shift']());}};_0x43bb1e(++_0x20601f);}(_0xad0a,0xec));var _0xaad0=function(_0x468369,_0x13cdd4){_0x468369=_0x468369-0x0;var _0x229a8b=_0xad0a[_0x468369];return _0x229a8b;};'use strict';var _=require('lodash');var util=require(_0xaad0('0x0'));var moment=require('moment');var BPromise=require(_0xaad0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaad0('0x2'))(_0xaad0('0x3'));var config=require(_0xaad0('0x4'));var jayson=require(_0xaad0('0x5'));var client=jayson[_0xaad0('0x6')][_0xaad0('0x7')]({'port':0x232a});config['redis']=_[_0xaad0('0x8')](config['redis'],{'host':_0xaad0('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaad0('0xa')]));require(_0xaad0('0xb'))[_0xaad0('0xc')](socket);function respondWithRpcPromise(_0x3b51af,_0x2339f2,_0x26b22e){return new BPromise(function(_0x37d3d7,_0x3ccc27){return client[_0xaad0('0xd')](_0x3b51af,_0x26b22e)[_0xaad0('0xe')](function(_0x357102){logger[_0xaad0('0xf')](_0xaad0('0x10'),_0x2339f2,_0xaad0('0x11'));logger['debug'](_0xaad0('0x12'),_0x2339f2,_0xaad0('0x11'),JSON['stringify'](_0x357102));if(_0x357102[_0xaad0('0x13')]){if(_0x357102[_0xaad0('0x13')][_0xaad0('0x14')]===0x1f4){logger['error'](_0xaad0('0x10'),_0x2339f2,_0x357102['error'][_0xaad0('0x15')]);return _0x3ccc27(_0x357102[_0xaad0('0x13')][_0xaad0('0x15')]);}logger['error'](_0xaad0('0x10'),_0x2339f2,_0x357102['error'][_0xaad0('0x15')]);return _0x37d3d7(_0x357102[_0xaad0('0x13')][_0xaad0('0x15')]);}else{logger['info'](_0xaad0('0x10'),_0x2339f2,_0xaad0('0x11'));_0x37d3d7(_0x357102[_0xaad0('0x16')][_0xaad0('0x15')]);}})[_0xaad0('0x17')](function(_0x50a374){logger['error'](_0xaad0('0x10'),_0x2339f2,_0x50a374);_0x3ccc27(_0x50a374);});});}exports[_0xaad0('0x18')]=function(_0x1e0b8a){var _0xf03c80=this;return new Promise(function(_0x1bf072,_0x2ff2d2){return db[_0xaad0('0x19')][_0xaad0('0x1a')](_0x1e0b8a[_0xaad0('0x1b')],{'raw':_0x1e0b8a[_0xaad0('0x1c')]?_0x1e0b8a[_0xaad0('0x1c')][_0xaad0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e0b8a['options']?_0x1e0b8a[_0xaad0('0x1c')][_0xaad0('0x1e')]||null:null,'attributes':_0x1e0b8a['options']?_0x1e0b8a[_0xaad0('0x1c')][_0xaad0('0x1f')]||null:null,'limit':_0x1e0b8a[_0xaad0('0x1c')]?_0x1e0b8a['options']['limit']||null:null})[_0xaad0('0xe')](function(_0x35813a){logger['info']('UpdateChatInteraction',_0x1e0b8a);logger[_0xaad0('0x20')](_0xaad0('0x18'),_0x1e0b8a,JSON['stringify'](_0x35813a));_0x1bf072(_0x35813a);})[_0xaad0('0x17')](function(_0x5f4883){logger[_0xaad0('0x13')](_0xaad0('0x18'),_0x5f4883[_0xaad0('0x15')],_0x1e0b8a);_0x2ff2d2(_0xf03c80['error'](0x1f4,_0x5f4883[_0xaad0('0x15')]));});});};exports[_0xaad0('0x21')]=function(_0x7fb7f9){return new Promise(function(_0x504abf,_0x49e0fc){return db[_0xaad0('0x19')][_0xaad0('0x22')]({'where':_0x7fb7f9[_0xaad0('0x1c')]?_0x7fb7f9[_0xaad0('0x1c')]['where']||null:null})[_0xaad0('0xe')](function(_0x4424c4){if(_0x4424c4){return _0x4424c4[_0xaad0('0x23')](_0x7fb7f9['body'][_0xaad0('0x24')],_[_0xaad0('0x25')](_0x7fb7f9[_0xaad0('0x1b')],['ids','id'])||{});}})[_0xaad0('0x26')](function(_0x1f4bfd){logger['info'](_0xaad0('0x27'),_0x7fb7f9);logger['debug'](_0xaad0('0x27'),_0x7fb7f9,JSON[_0xaad0('0x28')](_0x1f4bfd));_0x504abf(_0x1f4bfd);})[_0xaad0('0x17')](function(_0x2c4b55){logger[_0xaad0('0x13')](_0xaad0('0x27'),_0x2c4b55[_0xaad0('0x15')],_0x7fb7f9);_0x49e0fc(_this['error'](0x1f4,_0x2c4b55[_0xaad0('0x15')]));});});}; \ No newline at end of file +var _0x89f0=['result','catch','UpdateChatInteraction','update','body','options','where','then','AddTagsToChatInteraction','ChatInteraction','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message'];(function(_0x387583,_0x127b08){var _0x45d2f9=function(_0x1d82ac){while(--_0x1d82ac){_0x387583['push'](_0x387583['shift']());}};_0x45d2f9(++_0x127b08);}(_0x89f0,0xf8));var _0x089f=function(_0x572eb2,_0x12f42d){_0x572eb2=_0x572eb2-0x0;var _0x3de9b0=_0x89f0[_0x572eb2];return _0x3de9b0;};'use strict';var _=require(_0x089f('0x0'));var util=require('util');var moment=require(_0x089f('0x1'));var BPromise=require(_0x089f('0x2'));var rs=require(_0x089f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x089f('0x4'))['db'];var utils=require(_0x089f('0x5'));var logger=require(_0x089f('0x6'))(_0x089f('0x7'));var config=require('../../config/environment');var jayson=require(_0x089f('0x8'));var client=jayson['client'][_0x089f('0x9')]({'port':0x232a});config['redis']=_[_0x089f('0xa')](config[_0x089f('0xb')],{'host':_0x089f('0xc'),'port':0x18eb});var socket=require(_0x089f('0xd'))(new Redis(config[_0x089f('0xb')]));require('./chatInteraction.socket')[_0x089f('0xe')](socket);function respondWithRpcPromise(_0xa89bca,_0x534c26,_0x17f219){return new BPromise(function(_0x29a416,_0x448917){return client[_0x089f('0xf')](_0xa89bca,_0x17f219)['then'](function(_0x1fa6fd){logger[_0x089f('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x534c26,_0x089f('0x11'));logger[_0x089f('0x12')](_0x089f('0x13'),_0x534c26,_0x089f('0x11'),JSON[_0x089f('0x14')](_0x1fa6fd));if(_0x1fa6fd[_0x089f('0x15')]){if(_0x1fa6fd[_0x089f('0x15')][_0x089f('0x16')]===0x1f4){logger[_0x089f('0x15')](_0x089f('0x17'),_0x534c26,_0x1fa6fd[_0x089f('0x15')][_0x089f('0x18')]);return _0x448917(_0x1fa6fd[_0x089f('0x15')][_0x089f('0x18')]);}logger[_0x089f('0x15')](_0x089f('0x17'),_0x534c26,_0x1fa6fd[_0x089f('0x15')][_0x089f('0x18')]);return _0x29a416(_0x1fa6fd[_0x089f('0x15')][_0x089f('0x18')]);}else{logger[_0x089f('0x10')](_0x089f('0x17'),_0x534c26,_0x089f('0x11'));_0x29a416(_0x1fa6fd[_0x089f('0x19')]['message']);}})[_0x089f('0x1a')](function(_0x5793c5){logger[_0x089f('0x15')](_0x089f('0x17'),_0x534c26,_0x5793c5);_0x448917(_0x5793c5);});});}exports[_0x089f('0x1b')]=function(_0x89ca37){var _0x22b676=this;return new Promise(function(_0x4b9af1,_0x4e40c4){return db['ChatInteraction'][_0x089f('0x1c')](_0x89ca37[_0x089f('0x1d')],{'raw':_0x89ca37['options']?_0x89ca37[_0x089f('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x89ca37[_0x089f('0x1e')]?_0x89ca37[_0x089f('0x1e')][_0x089f('0x1f')]||null:null,'attributes':_0x89ca37[_0x089f('0x1e')]?_0x89ca37['options']['attributes']||null:null,'limit':_0x89ca37[_0x089f('0x1e')]?_0x89ca37[_0x089f('0x1e')]['limit']||null:null})[_0x089f('0x20')](function(_0x53f13a){logger['info'](_0x089f('0x1b'),_0x89ca37);logger[_0x089f('0x12')]('UpdateChatInteraction',_0x89ca37,JSON[_0x089f('0x14')](_0x53f13a));_0x4b9af1(_0x53f13a);})['catch'](function(_0x34b8b7){logger['error'](_0x089f('0x1b'),_0x34b8b7[_0x089f('0x18')],_0x89ca37);_0x4e40c4(_0x22b676[_0x089f('0x15')](0x1f4,_0x34b8b7[_0x089f('0x18')]));});});};exports[_0x089f('0x21')]=function(_0x5a0f58){return new Promise(function(_0x40282c,_0x4cca31){return db[_0x089f('0x22')]['find']({'where':_0x5a0f58[_0x089f('0x1e')]?_0x5a0f58[_0x089f('0x1e')][_0x089f('0x1f')]||null:null})[_0x089f('0x20')](function(_0xc633cb){if(_0xc633cb){return _0xc633cb['addTags'](_0x5a0f58['body'][_0x089f('0x23')],_[_0x089f('0x24')](_0x5a0f58['body'],[_0x089f('0x23'),'id'])||{});}})[_0x089f('0x25')](function(_0x48ad1b){logger[_0x089f('0x10')](_0x089f('0x26'),_0x5a0f58);logger['debug']('AddTags',_0x5a0f58,JSON['stringify'](_0x48ad1b));_0x40282c(_0x48ad1b);})[_0x089f('0x1a')](function(_0x330653){logger['error'](_0x089f('0x26'),_0x330653[_0x089f('0x18')],_0x5a0f58);_0x4cca31(_this['error'](0x1f4,_0x330653[_0x089f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 6a4466e..4c74f4e 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 _0xa468=['update','emit','removeListener','register','chatInteraction:','remove'];(function(_0x187a62,_0x3244b8){var _0x1f18a0=function(_0x41855e){while(--_0x41855e){_0x187a62['push'](_0x187a62['shift']());}};_0x1f18a0(++_0x3244b8);}(_0xa468,0xef));var _0x8a46=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa468[_0x5b644e];return _0x49c6bf;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x8a46('0x0'),_0x8a46('0x1')];function createListener(_0xd2461f,_0x46bd36){return function(_0x595766){_0x46bd36[_0x8a46('0x2')](_0xd2461f,_0x595766);};}function removeListener(_0x2ecbb3,_0x5da4c9){return function(){ChatInteractionEvents[_0x8a46('0x3')](_0x2ecbb3,_0x5da4c9);};}exports[_0x8a46('0x4')]=function(_0x39d9ff){for(var _0x4a1b00=0x0,_0xd45665=events['length'];_0x4a1b00<_0xd45665;_0x4a1b00++){var _0x1f1a94=events[_0x4a1b00];var _0x218ab5=createListener(_0x8a46('0x5')+_0x1f1a94,_0x39d9ff);ChatInteractionEvents['on'](_0x1f1a94,_0x218ab5);}}; \ No newline at end of file +var _0x078c=['register','length','./chatInteraction.events','remove','update','emit','removeListener'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x078c,0x19f));var _0xc078=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x078c[_0x326e79];return _0x37eb89;};'use strict';var ChatInteractionEvents=require(_0xc078('0x0'));var events=['save',_0xc078('0x1'),_0xc078('0x2')];function createListener(_0x503bd4,_0x82572){return function(_0x107624){_0x82572[_0xc078('0x3')](_0x503bd4,_0x107624);};}function removeListener(_0x217004,_0x56bf2e){return function(){ChatInteractionEvents[_0xc078('0x4')](_0x217004,_0x56bf2e);};}exports[_0xc078('0x5')]=function(_0x394068){for(var _0x24b241=0x0,_0x40e428=events[_0xc078('0x6')];_0x24b241<_0x40e428;_0x24b241++){var _0x22661e=events[_0x24b241];var _0x4030b1=createListener('chatInteraction:'+_0x22661e,_0x394068);ChatInteractionEvents['on'](_0x22661e,_0x4030b1);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index cb66aa1..68767cf 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 _0x7c44=['./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','download','post','createVidaooSession','diskStorage','root','server/files/attachments/','format','now','originalname','replace','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','delete','chatinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x32f3d6,_0x42ddf8){var _0x3bdc6c=function(_0x40f464){while(--_0x40f464){_0x32f3d6['push'](_0x32f3d6['shift']());}};_0x3bdc6c(++_0x42ddf8);}(_0x7c44,0xed));var _0x47c4=function(_0x5f21d5,_0x18caf4){_0x5f21d5=_0x5f21d5-0x0;var _0x5866ad=_0x7c44[_0x5f21d5];return _0x5866ad;};'use strict';var multer=require(_0x47c4('0x0'));var util=require(_0x47c4('0x1'));var path=require('path');var timeout=require(_0x47c4('0x2'));var express=require(_0x47c4('0x3'));var router=express[_0x47c4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47c4('0x5'));var interaction=require(_0x47c4('0x6'));var config=require(_0x47c4('0x7'));var controller=require(_0x47c4('0x8'));router[_0x47c4('0x9')]('/',auth[_0x47c4('0xa')](),controller[_0x47c4('0xb')]);router[_0x47c4('0x9')](_0x47c4('0xc'),auth['isAuthenticated'](),controller[_0x47c4('0xd')]);router['get']('/:id',auth[_0x47c4('0xe')](),controller[_0x47c4('0xf')]);router[_0x47c4('0x9')](_0x47c4('0x10'),auth[_0x47c4('0xe')](),controller[_0x47c4('0x11')]);router[_0x47c4('0x9')]('/:id/messages',auth[_0x47c4('0xa')](),controller[_0x47c4('0x12')]);router['get'](_0x47c4('0x13'),auth[_0x47c4('0xe')](),controller[_0x47c4('0x14')]);router[_0x47c4('0x9')]('/:id/download',auth[_0x47c4('0xa')](),controller[_0x47c4('0x15')]);router[_0x47c4('0x16')]('/',auth[_0x47c4('0xa')](),controller['create']);router['post']('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x47c4('0x17')]);var upload=multer({'storage':multer[_0x47c4('0x18')]({'destination':function(_0xa66d1e,_0x55424c,_0xe3af29){_0xe3af29(null,path['join'](config[_0x47c4('0x19')],_0x47c4('0x1a')));},'filename':function(_0x3c3232,_0x55785b,_0x5e89dd){_0x5e89dd(null,util[_0x47c4('0x1b')]('%s-%s',Date[_0x47c4('0x1c')](),_0x55785b[_0x47c4('0x1d')][_0x47c4('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x47c4('0x16')]('/:id/attachment_upload',upload[_0x47c4('0x1f')]('file'),controller[_0x47c4('0x20')]);router[_0x47c4('0x16')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x47c4('0x21')]);router[_0x47c4('0x16')](_0x47c4('0x22'),auth[_0x47c4('0xa')](),interaction[_0x47c4('0x23')](_0x47c4('0x24'),'chatinteraction:addtags'),controller[_0x47c4('0x25')]);router[_0x47c4('0x26')](_0x47c4('0x27'),auth[_0x47c4('0xa')](),interaction['tracked']('chat',_0x47c4('0x28')),controller[_0x47c4('0x29')]);router[_0x47c4('0x26')](_0x47c4('0x2a'),controller[_0x47c4('0x2b')]);router[_0x47c4('0x26')]('/:id/abandon',auth[_0x47c4('0xe')](),controller[_0x47c4('0x2c')]);router[_0x47c4('0x26')]('/:id/close',controller['close']);router[_0x47c4('0x2d')](_0x47c4('0x27'),auth[_0x47c4('0xa')](),interaction[_0x47c4('0x23')](_0x47c4('0x24'),_0x47c4('0x2e')),controller['destroy']);router['delete'](_0x47c4('0x22'),auth[_0x47c4('0xa')](),controller[_0x47c4('0x2f')]);module[_0x47c4('0x30')]=router; \ No newline at end of file +var _0xccf4=['format','%s-%s','originalname','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','chatinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','diskStorage','root'];(function(_0x20fbb6,_0x22f7d2){var _0x262e17=function(_0x1b4822){while(--_0x1b4822){_0x20fbb6['push'](_0x20fbb6['shift']());}};_0x262e17(++_0x22f7d2);}(_0xccf4,0x9f));var _0x4ccf=function(_0x592adc,_0x3bbb34){_0x592adc=_0x592adc-0x0;var _0x3609dc=_0xccf4[_0x592adc];return _0x3609dc;};'use strict';var multer=require(_0x4ccf('0x0'));var util=require(_0x4ccf('0x1'));var path=require(_0x4ccf('0x2'));var timeout=require(_0x4ccf('0x3'));var express=require('express');var router=express[_0x4ccf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ccf('0x5'));var config=require(_0x4ccf('0x6'));var controller=require(_0x4ccf('0x7'));router['get']('/',auth[_0x4ccf('0x8')](),controller[_0x4ccf('0x9')]);router[_0x4ccf('0xa')](_0x4ccf('0xb'),auth[_0x4ccf('0x8')](),controller['describe']);router['get'](_0x4ccf('0xc'),auth[_0x4ccf('0xd')](),controller['show']);router[_0x4ccf('0xa')](_0x4ccf('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x4ccf('0xf')]);router['get']('/:id/messages',auth[_0x4ccf('0x8')](),controller[_0x4ccf('0x10')]);router[_0x4ccf('0xa')](_0x4ccf('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x4ccf('0x12')]);router[_0x4ccf('0xa')](_0x4ccf('0x13'),auth[_0x4ccf('0x8')](),controller[_0x4ccf('0x14')]);router[_0x4ccf('0x15')]('/',auth[_0x4ccf('0x8')](),controller[_0x4ccf('0x16')]);router[_0x4ccf('0x15')]('/:id/vidaoo',auth[_0x4ccf('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x4ccf('0x17')]({'destination':function(_0x4fec6c,_0x2abb56,_0x24562d){_0x24562d(null,path['join'](config[_0x4ccf('0x18')],'server/files/attachments/'));},'filename':function(_0xbf9c9a,_0x103ea0,_0x6c4596){_0x6c4596(null,util[_0x4ccf('0x19')](_0x4ccf('0x1a'),Date['now'](),_0x103ea0[_0x4ccf('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload['single'](_0x4ccf('0x1c')),controller[_0x4ccf('0x1d')]);router[_0x4ccf('0x15')](_0x4ccf('0x1e'),auth[_0x4ccf('0xd')](),controller[_0x4ccf('0x1f')]);router['post'](_0x4ccf('0x20'),auth[_0x4ccf('0x8')](),interaction[_0x4ccf('0x21')](_0x4ccf('0x22'),'chatinteraction:addtags'),controller[_0x4ccf('0x23')]);router[_0x4ccf('0x24')](_0x4ccf('0xc'),auth[_0x4ccf('0x8')](),interaction[_0x4ccf('0x21')](_0x4ccf('0x22'),_0x4ccf('0x25')),controller['update']);router['put'](_0x4ccf('0x26'),controller[_0x4ccf('0x27')]);router[_0x4ccf('0x24')](_0x4ccf('0x28'),auth[_0x4ccf('0xd')](),controller[_0x4ccf('0x29')]);router[_0x4ccf('0x24')](_0x4ccf('0x2a'),controller['close']);router['delete']('/:id',auth[_0x4ccf('0x8')](),interaction[_0x4ccf('0x21')]('chat',_0x4ccf('0x2b')),controller[_0x4ccf('0x2c')]);router['delete'](_0x4ccf('0x20'),auth[_0x4ccf('0x8')](),controller[_0x4ccf('0x2d')]);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 af40a2b..8853b37 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 _0x21bc=['sequelize','exports','medium','BOOLEAN','INTEGER'];(function(_0x46345f,_0x45e74e){var _0x5ceac4=function(_0x491784){while(--_0x491784){_0x46345f['push'](_0x46345f['shift']());}};_0x5ceac4(++_0x45e74e);}(_0x21bc,0xd2));var _0xc21b=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x21bc[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0xc21b('0x0'));module[_0xc21b('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc21b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc21b('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc21b('0x4')]}}; \ No newline at end of file +var _0x4312=['BOOLEAN','sequelize','medium'];(function(_0x5d375e,_0x13066f){var _0x564ce4=function(_0x1a8c20){while(--_0x1a8c20){_0x5d375e['push'](_0x5d375e['shift']());}};_0x564ce4(++_0x13066f);}(_0x4312,0xdc));var _0x2431=function(_0x55e631,_0x4e9bdb){_0x55e631=_0x55e631-0x0;var _0x1a0670=_0x4312[_0x55e631];return _0x1a0670;};'use strict';var Sequelize=require(_0x2431('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2431('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x2431('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ddc0bab..8b65625 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 _0x38c6=['fullname','role','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','read','-createdAt','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','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','then','error','stack','name','send','map','ChatInternalMessage','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','destroy','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User'];(function(_0x501880,_0x253f0f){var _0x42277c=function(_0x424056){while(--_0x424056){_0x501880['push'](_0x501880['shift']());}};_0x42277c(++_0x253f0f);}(_0x38c6,0xfa));var _0x638c=function(_0xb0acd8,_0x4cac86){_0xb0acd8=_0xb0acd8-0x0;var _0x491d41=_0x38c6[_0xb0acd8];return _0x491d41;};'use strict';var emlformat=require(_0x638c('0x0'));var rimraf=require(_0x638c('0x1'));var zipdir=require(_0x638c('0x2'));var jsonpatch=require(_0x638c('0x3'));var rp=require(_0x638c('0x4'));var moment=require('moment');var BPromise=require(_0x638c('0x5'));var Mustache=require(_0x638c('0x6'));var util=require(_0x638c('0x7'));var path=require(_0x638c('0x8'));var sox=require('sox');var csv=require(_0x638c('0x9'));var ejs=require(_0x638c('0xa'));var fs=require('fs');var fs_extra=require(_0x638c('0xb'));var _=require(_0x638c('0xc'));var squel=require(_0x638c('0xd'));var crypto=require(_0x638c('0xe'));var jsforce=require(_0x638c('0xf'));var deskjs=require(_0x638c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x638c('0x11'));var Papa=require(_0x638c('0x12'));var Redis=require(_0x638c('0x13'));var authService=require(_0x638c('0x14'));var qs=require(_0x638c('0x15'));var as=require(_0x638c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x638c('0x17'));var utils=require(_0x638c('0x18'));var config=require(_0x638c('0x19'));var licenseUtil=require(_0x638c('0x1a'));var db=require(_0x638c('0x1b'))['db'];config[_0x638c('0x1c')]=_['defaults'](config[_0x638c('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x638c('0x1d'))(new Redis(config[_0x638c('0x1c')]));require(_0x638c('0x1e'))[_0x638c('0x1f')](socket);function respondWithStatusCode(_0x2ba537,_0x42b1ea){_0x42b1ea=_0x42b1ea||0xcc;return function(_0x25d63a){if(_0x25d63a){return _0x2ba537[_0x638c('0x20')](_0x42b1ea);}return _0x2ba537[_0x638c('0x21')](_0x42b1ea)[_0x638c('0x22')]();};}function respondWithResult(_0x36b345,_0x4fc3fd){_0x4fc3fd=_0x4fc3fd||0xc8;return function(_0x3630d0){if(_0x3630d0){return _0x36b345['status'](_0x4fc3fd)[_0x638c('0x23')](_0x3630d0);}};}function respondWithFilteredResult(_0x922390,_0x11884f){return function(_0x1a63be){if(_0x1a63be){var _0x3d74f6=typeof _0x11884f[_0x638c('0x24')]===_0x638c('0x25')&&typeof _0x11884f[_0x638c('0x26')]===_0x638c('0x25');var _0x5c18af=_0x1a63be[_0x638c('0x27')];var _0x48f4a7=_0x3d74f6?0x0:_0x11884f[_0x638c('0x24')];var _0x136275=_0x3d74f6?_0x1a63be['count']:_0x11884f[_0x638c('0x24')]+_0x11884f['limit'];var _0x57af7d;if(_0x136275>=_0x5c18af){_0x136275=_0x5c18af;_0x57af7d=0xc8;}else{_0x57af7d=0xce;}_0x922390[_0x638c('0x21')](_0x57af7d);return _0x922390['set'](_0x638c('0x28'),_0x48f4a7+'-'+_0x136275+'/'+_0x5c18af)[_0x638c('0x23')](_0x1a63be);}return null;};}function patchUpdates(_0x5ab927){return function(_0x28779e){try{jsonpatch['apply'](_0x28779e,_0x5ab927,!![]);}catch(_0xca4707){return BPromise[_0x638c('0x29')](_0xca4707);}return _0x28779e['save']();};}function saveUpdates(_0x294c17,_0x19e88b){return function(_0x12d5ac){if(_0x12d5ac){return _0x12d5ac['update'](_0x294c17)[_0x638c('0x2a')](function(_0x2e94fa){return _0x2e94fa;});}return null;};}function removeEntity(_0x1b8ea8,_0x51e2cb){return function(_0x1e4119){if(_0x1e4119){return _0x1e4119['destroy']()[_0x638c('0x2a')](function(){_0x1b8ea8[_0x638c('0x21')](0xcc)[_0x638c('0x22')]();});}};}function handleEntityNotFound(_0x4acec6,_0x50aa48){return function(_0x144b8e){if(!_0x144b8e){_0x4acec6['sendStatus'](0x194);}return _0x144b8e;};}function handleError(_0x107bdf,_0xe38c5b){_0xe38c5b=_0xe38c5b||0x1f4;return function(_0x3fc25f){logger[_0x638c('0x2b')](_0x3fc25f[_0x638c('0x2c')]);if(_0x3fc25f[_0x638c('0x2d')]){delete _0x3fc25f['name'];}_0x107bdf['status'](_0xe38c5b)[_0x638c('0x2e')](_0x3fc25f);};}exports['index']=function(_0x57a1a9,_0x570105){var _0x26043f={},_0x1b58b3={},_0x56d0da={'count':0x0,'rows':[]};var _0x10ffa2=_[_0x638c('0x2f')](db[_0x638c('0x30')][_0x638c('0x31')],function(_0x25aef6){return{'name':_0x25aef6['fieldName'],'type':_0x25aef6[_0x638c('0x32')][_0x638c('0x33')]};});_0x1b58b3['model']=_[_0x638c('0x2f')](_0x10ffa2,_0x638c('0x2d'));_0x1b58b3[_0x638c('0x34')]=_['keys'](_0x57a1a9[_0x638c('0x34')]);_0x1b58b3[_0x638c('0x35')]=_[_0x638c('0x36')](_0x1b58b3[_0x638c('0x37')],_0x1b58b3[_0x638c('0x34')]);_0x26043f['attributes']=_[_0x638c('0x36')](_0x1b58b3[_0x638c('0x37')],qs[_0x638c('0x38')](_0x57a1a9[_0x638c('0x34')][_0x638c('0x38')]));_0x26043f[_0x638c('0x39')]=_0x26043f[_0x638c('0x39')][_0x638c('0x3a')]?_0x26043f[_0x638c('0x39')]:_0x1b58b3['model'];if(!_0x57a1a9['query'][_0x638c('0x3b')]('nolimit')){_0x26043f[_0x638c('0x26')]=qs[_0x638c('0x26')](_0x57a1a9[_0x638c('0x34')][_0x638c('0x26')]);_0x26043f[_0x638c('0x24')]=qs[_0x638c('0x24')](_0x57a1a9[_0x638c('0x34')][_0x638c('0x24')]);}_0x26043f[_0x638c('0x3c')]=qs[_0x638c('0x3d')](_0x57a1a9['query'][_0x638c('0x3d')]);_0x26043f[_0x638c('0x3e')]=qs[_0x638c('0x35')](_[_0x638c('0x3f')](_0x57a1a9[_0x638c('0x34')],_0x1b58b3[_0x638c('0x35')]),_0x10ffa2);if(_0x57a1a9[_0x638c('0x34')][_0x638c('0x40')]){_0x26043f[_0x638c('0x3e')]=_[_0x638c('0x41')](_0x26043f['where'],{'$or':_[_0x638c('0x2f')](_0x10ffa2,function(_0x327d09){if(_0x327d09[_0x638c('0x32')]!==_0x638c('0x42')){var _0x4ecf6a={};_0x4ecf6a[_0x327d09[_0x638c('0x2d')]]={'$like':'%'+_0x57a1a9[_0x638c('0x34')][_0x638c('0x40')]+'%'};return _0x4ecf6a;}})});}_0x26043f=_[_0x638c('0x41')]({},_0x26043f,_0x57a1a9[_0x638c('0x43')]);var _0x179b78={'where':_0x26043f[_0x638c('0x3e')]};return db['ChatInternalMessage'][_0x638c('0x27')](_0x179b78)[_0x638c('0x2a')](function(_0x3cc96d){_0x56d0da[_0x638c('0x27')]=_0x3cc96d;if(_0x57a1a9[_0x638c('0x34')][_0x638c('0x44')]){_0x26043f[_0x638c('0x45')]=[{'all':!![]}];}return db[_0x638c('0x30')][_0x638c('0x46')](_0x26043f);})[_0x638c('0x2a')](function(_0x1ad96b){_0x56d0da['rows']=_0x1ad96b;return _0x56d0da;})[_0x638c('0x2a')](respondWithFilteredResult(_0x570105,_0x26043f))[_0x638c('0x47')](handleError(_0x570105,null));};exports[_0x638c('0x48')]=function(_0x3b75e8,_0x4aeca8){var _0x5f568f={'raw':!![],'where':{'id':_0x3b75e8[_0x638c('0x49')]['id']}},_0x2132d7={};_0x2132d7[_0x638c('0x37')]=_[_0x638c('0x4a')](db[_0x638c('0x30')]['rawAttributes']);_0x2132d7['query']=_[_0x638c('0x4a')](_0x3b75e8['query']);_0x2132d7['filters']=_['intersection'](_0x2132d7[_0x638c('0x37')],_0x2132d7[_0x638c('0x34')]);_0x5f568f[_0x638c('0x39')]=_[_0x638c('0x36')](_0x2132d7[_0x638c('0x37')],qs['fields'](_0x3b75e8[_0x638c('0x34')][_0x638c('0x38')]));_0x5f568f['attributes']=_0x5f568f[_0x638c('0x39')][_0x638c('0x3a')]?_0x5f568f[_0x638c('0x39')]:_0x2132d7['model'];if(_0x3b75e8['query'][_0x638c('0x44')]){_0x5f568f[_0x638c('0x45')]=[{'all':!![]}];}_0x5f568f=_[_0x638c('0x41')]({},_0x5f568f,_0x3b75e8['options']);return db[_0x638c('0x30')][_0x638c('0x4b')](_0x5f568f)[_0x638c('0x2a')](handleEntityNotFound(_0x4aeca8,null))[_0x638c('0x2a')](respondWithResult(_0x4aeca8,null))[_0x638c('0x47')](handleError(_0x4aeca8,null));};exports['create']=function(_0x9b8d88,_0xa5681f){return db['ChatInternalMessage'][_0x638c('0x4c')](_0x9b8d88[_0x638c('0x4d')],{})['then'](respondWithResult(_0xa5681f,0xc9))[_0x638c('0x47')](handleError(_0xa5681f,null));};exports[_0x638c('0x4e')]=function(_0x1776d2,_0x2b9d7c){if(_0x1776d2[_0x638c('0x4d')]['id']){delete _0x1776d2[_0x638c('0x4d')]['id'];}return db[_0x638c('0x30')][_0x638c('0x4b')]({'where':{'id':_0x1776d2[_0x638c('0x49')]['id']}})[_0x638c('0x2a')](handleEntityNotFound(_0x2b9d7c,null))[_0x638c('0x2a')](saveUpdates(_0x1776d2[_0x638c('0x4d')],null))[_0x638c('0x2a')](respondWithResult(_0x2b9d7c,null))['catch'](handleError(_0x2b9d7c,null));};exports[_0x638c('0x4f')]=function(_0x356310,_0x4824ad){return db['ChatInternalMessage']['find']({'where':{'id':_0x356310[_0x638c('0x49')]['id']}})[_0x638c('0x2a')](handleEntityNotFound(_0x4824ad,null))[_0x638c('0x2a')](removeEntity(_0x4824ad,null))[_0x638c('0x47')](handleError(_0x4824ad,null));};exports[_0x638c('0x50')]=function(_0x6d8687,_0x414453){return db['ChatInternalMessage'][_0x638c('0x50')]()[_0x638c('0x2a')](respondWithResult(_0x414453,null))[_0x638c('0x47')](handleError(_0x414453,null));};function wrapUser(_0x2c5cd9){return function(_0x5553b5){var _0x2e32c0=_0x2c5cd9['get']({'plain':!![]});_0x2e32c0[_0x638c('0x51')]=[];if(_0x5553b5){_0x2e32c0[_0x638c('0x52')]=_0x5553b5[_0x638c('0x53')];_0x2e32c0[_0x638c('0x54')]=_0x5553b5;}else{_0x2e32c0[_0x638c('0x52')]=moment(0x0)[_0x638c('0x55')](_0x638c('0x56'));_0x2e32c0[_0x638c('0x54')]={};}return _0x2e32c0;};}exports[_0x638c('0x57')]=function(_0x5128ae,_0x11049d,_0x36c464){var _0x5db048=[];return db[_0x638c('0x58')]['findAll']({'where':{'role':['agent','admin','user']},'attributes':['id',_0x638c('0x59'),_0x638c('0x2d'),_0x638c('0x5a'),'userpic',_0x638c('0x5b'),_0x638c('0x5c'),'lastLoginAt',_0x638c('0x5d'),_0x638c('0x5e')],'order':qs[_0x638c('0x3d')](_0x638c('0x5f')),'include':[{'model':db[_0x638c('0x60')],'as':_0x638c('0x61'),'attributes':['id',_0x638c('0x2d'),_0x638c('0x32')],'through':{'attributes':[]}}]})[_0x638c('0x2a')](function(_0x3ce0ad){if(_0x3ce0ad){var _0x250f6f=_0x5128ae[_0x638c('0x62')][_0x638c('0x63')]({'plain':!![]});if(!_0x250f6f)throw new Error(_0x638c('0x64'));if(_0x250f6f['role']==='user'){return db[_0x638c('0x65')]['find']({'where':{'name':'Agents','userProfileId':_0x250f6f[_0x638c('0x66')]},'raw':!![]})[_0x638c('0x2a')](function(_0x594c5f){if(_0x594c5f){if(_0x594c5f[_0x638c('0x67')]===0x0){return db[_0x638c('0x68')][_0x638c('0x46')]({'where':{'sectionId':_0x594c5f['id']},'raw':!![]})[_0x638c('0x2a')](function(_0xd37d0d){var _0x20a40f=[];if(_[_0x638c('0x69')](_0xd37d0d)){_0x20a40f=_[_0x638c('0x40')](_0x3ce0ad,function(_0x3657c2){if(_0x3657c2[_0x638c('0x5a')]!==_0x638c('0x6a')){return _0x3657c2;}});return _0x20a40f;}else{for(var _0x5090af=0x0;_0x5090af<_0x3ce0ad[_0x638c('0x3a')];_0x5090af++){var _0x1e665b=_0x3ce0ad[_0x5090af];if(_0x1e665b[_0x638c('0x5a')]===_0x638c('0x6a')){var _0x108fcc=_[_0x638c('0x4b')](_0xd37d0d,function(_0xa474bb){return _0xa474bb[_0x638c('0x6b')]===_0x1e665b['id'];});if(_0x108fcc)_0x20a40f['push'](_0x1e665b);}else{_0x20a40f[_0x638c('0x6c')](_0x1e665b);}}return _0x20a40f;}});}else{return _0x3ce0ad;}}else{var _0x23a06f=_[_0x638c('0x40')](_0x3ce0ad,function(_0x15f3e6){if(_0x15f3e6[_0x638c('0x5a')]!=='agent'){return _0x15f3e6;}});return _0x23a06f;}});}else{return _0x3ce0ad;}}})[_0x638c('0x2a')](function(_0x5161fe){var _0x45701f=[];if(_0x5161fe){_0x5db048=_0x5161fe;for(var _0x1fb28c=0x0;_0x1fb28c<_0x5161fe['length'];_0x1fb28c+=0x1){_0x5db048[_0x1fb28c][_0x638c('0x51')]=[];_0x45701f['push'](db['ChatInternalMessage'][_0x638c('0x4b')]({'where':{'FromId':[_0x5128ae[_0x638c('0x62')]['id'],_0x5161fe[_0x1fb28c]['id']],'ToId':[_0x5128ae[_0x638c('0x62')]['id'],_0x5161fe[_0x1fb28c]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x638c('0x6d'),_0x638c('0x6e'),_0x638c('0x6f'),_0x638c('0x4d')],'order':qs['sort'](_0x638c('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5161fe[_0x1fb28c])));}return BPromise['all'](_0x45701f);}return[];})[_0x638c('0x2a')](function(_0x1403e7){return{'rows':_0x1403e7,'count':_0x1403e7['length']};})['then'](respondWithResult(_0x11049d,null))[_0x638c('0x47')](handleError(_0x11049d,null));}; \ No newline at end of file +var _0xe3c7=['error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','params','options','find','catch','create','body','describe','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','admin','role','userpic','internal','online','-online','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','UserProfileResource','agent','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','destroy'];(function(_0x5dcb2f,_0x402ca3){var _0x2cf625=function(_0x3792e4){while(--_0x3792e4){_0x5dcb2f['push'](_0x5dcb2f['shift']());}};_0x2cf625(++_0x402ca3);}(_0xe3c7,0x114));var _0x7e3c=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0xe3c7[_0xe3e0af];return _0x4828e9;};'use strict';var emlformat=require(_0x7e3c('0x0'));var rimraf=require(_0x7e3c('0x1'));var zipdir=require(_0x7e3c('0x2'));var jsonpatch=require(_0x7e3c('0x3'));var rp=require(_0x7e3c('0x4'));var moment=require(_0x7e3c('0x5'));var BPromise=require(_0x7e3c('0x6'));var Mustache=require(_0x7e3c('0x7'));var util=require('util');var path=require(_0x7e3c('0x8'));var sox=require(_0x7e3c('0x9'));var csv=require(_0x7e3c('0xa'));var ejs=require(_0x7e3c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e3c('0xc'));var squel=require(_0x7e3c('0xd'));var crypto=require(_0x7e3c('0xe'));var jsforce=require(_0x7e3c('0xf'));var deskjs=require(_0x7e3c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7e3c('0x11'));var Papa=require(_0x7e3c('0x12'));var Redis=require('ioredis');var authService=require(_0x7e3c('0x13'));var qs=require(_0x7e3c('0x14'));var as=require(_0x7e3c('0x15'));var hardwareService=require(_0x7e3c('0x16'));var logger=require('../../config/logger')(_0x7e3c('0x17'));var utils=require(_0x7e3c('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7e3c('0x19'))['db'];config[_0x7e3c('0x1a')]=_[_0x7e3c('0x1b')](config[_0x7e3c('0x1a')],{'host':_0x7e3c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7e3c('0x1a')]));require(_0x7e3c('0x1d'))[_0x7e3c('0x1e')](socket);function respondWithStatusCode(_0x1a5cfd,_0xc83531){_0xc83531=_0xc83531||0xcc;return function(_0x2cf281){if(_0x2cf281){return _0x1a5cfd[_0x7e3c('0x1f')](_0xc83531);}return _0x1a5cfd['status'](_0xc83531)[_0x7e3c('0x20')]();};}function respondWithResult(_0x6d3eb0,_0x2917f4){_0x2917f4=_0x2917f4||0xc8;return function(_0x22211f){if(_0x22211f){return _0x6d3eb0[_0x7e3c('0x21')](_0x2917f4)[_0x7e3c('0x22')](_0x22211f);}};}function respondWithFilteredResult(_0x4437cf,_0x3dcb9b){return function(_0x5119cc){if(_0x5119cc){var _0x32c974=typeof _0x3dcb9b['offset']==='undefined'&&typeof _0x3dcb9b[_0x7e3c('0x23')]===_0x7e3c('0x24');var _0x37d951=_0x5119cc[_0x7e3c('0x25')];var _0x4f2abc=_0x32c974?0x0:_0x3dcb9b[_0x7e3c('0x26')];var _0x704525=_0x32c974?_0x5119cc[_0x7e3c('0x25')]:_0x3dcb9b['offset']+_0x3dcb9b[_0x7e3c('0x23')];var _0x298c86;if(_0x704525>=_0x37d951){_0x704525=_0x37d951;_0x298c86=0xc8;}else{_0x298c86=0xce;}_0x4437cf[_0x7e3c('0x21')](_0x298c86);return _0x4437cf[_0x7e3c('0x27')](_0x7e3c('0x28'),_0x4f2abc+'-'+_0x704525+'/'+_0x37d951)[_0x7e3c('0x22')](_0x5119cc);}return null;};}function patchUpdates(_0x1c7086){return function(_0x317547){try{jsonpatch[_0x7e3c('0x29')](_0x317547,_0x1c7086,!![]);}catch(_0x1e03e1){return BPromise['reject'](_0x1e03e1);}return _0x317547['save']();};}function saveUpdates(_0x153e66,_0x1b00e1){return function(_0x4aa8d9){if(_0x4aa8d9){return _0x4aa8d9[_0x7e3c('0x2a')](_0x153e66)[_0x7e3c('0x2b')](function(_0x29cd37){return _0x29cd37;});}return null;};}function removeEntity(_0x1be945,_0x47b1f8){return function(_0x3208bc){if(_0x3208bc){return _0x3208bc[_0x7e3c('0x2c')]()[_0x7e3c('0x2b')](function(){_0x1be945[_0x7e3c('0x21')](0xcc)[_0x7e3c('0x20')]();});}};}function handleEntityNotFound(_0x3fed03,_0x24f798){return function(_0x47ca01){if(!_0x47ca01){_0x3fed03[_0x7e3c('0x1f')](0x194);}return _0x47ca01;};}function handleError(_0x363adb,_0x2d0105){_0x2d0105=_0x2d0105||0x1f4;return function(_0x5d4543){logger[_0x7e3c('0x2d')](_0x5d4543[_0x7e3c('0x2e')]);if(_0x5d4543[_0x7e3c('0x2f')]){delete _0x5d4543[_0x7e3c('0x2f')];}_0x363adb[_0x7e3c('0x21')](_0x2d0105)['send'](_0x5d4543);};}exports[_0x7e3c('0x30')]=function(_0x401f60,_0x2e83e7){var _0x20c0be={},_0x36f407={},_0x3e42b2={'count':0x0,'rows':[]};var _0x1c91e0=_[_0x7e3c('0x31')](db[_0x7e3c('0x32')][_0x7e3c('0x33')],function(_0x46017a){return{'name':_0x46017a[_0x7e3c('0x34')],'type':_0x46017a[_0x7e3c('0x35')][_0x7e3c('0x36')]};});_0x36f407['model']=_[_0x7e3c('0x31')](_0x1c91e0,_0x7e3c('0x2f'));_0x36f407[_0x7e3c('0x37')]=_[_0x7e3c('0x38')](_0x401f60[_0x7e3c('0x37')]);_0x36f407[_0x7e3c('0x39')]=_['intersection'](_0x36f407[_0x7e3c('0x3a')],_0x36f407[_0x7e3c('0x37')]);_0x20c0be['attributes']=_[_0x7e3c('0x3b')](_0x36f407[_0x7e3c('0x3a')],qs['fields'](_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x3c')]));_0x20c0be[_0x7e3c('0x3d')]=_0x20c0be[_0x7e3c('0x3d')][_0x7e3c('0x3e')]?_0x20c0be[_0x7e3c('0x3d')]:_0x36f407[_0x7e3c('0x3a')];if(!_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x3f')]('nolimit')){_0x20c0be[_0x7e3c('0x23')]=qs['limit'](_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x23')]);_0x20c0be[_0x7e3c('0x26')]=qs[_0x7e3c('0x26')](_0x401f60[_0x7e3c('0x37')]['offset']);}_0x20c0be['order']=qs[_0x7e3c('0x40')](_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x40')]);_0x20c0be[_0x7e3c('0x41')]=qs['filters'](_[_0x7e3c('0x42')](_0x401f60[_0x7e3c('0x37')],_0x36f407[_0x7e3c('0x39')]),_0x1c91e0);if(_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x43')]){_0x20c0be['where']=_['merge'](_0x20c0be[_0x7e3c('0x41')],{'$or':_[_0x7e3c('0x31')](_0x1c91e0,function(_0x409c72){if(_0x409c72[_0x7e3c('0x35')]!==_0x7e3c('0x44')){var _0x1514cc={};_0x1514cc[_0x409c72[_0x7e3c('0x2f')]]={'$like':'%'+_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x43')]+'%'};return _0x1514cc;}})});}_0x20c0be=_[_0x7e3c('0x45')]({},_0x20c0be,_0x401f60['options']);var _0x585add={'where':_0x20c0be['where']};return db[_0x7e3c('0x32')][_0x7e3c('0x25')](_0x585add)['then'](function(_0x189b9f){_0x3e42b2[_0x7e3c('0x25')]=_0x189b9f;if(_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x46')]){_0x20c0be[_0x7e3c('0x47')]=[{'all':!![]}];}return db[_0x7e3c('0x32')]['findAll'](_0x20c0be);})['then'](function(_0x4318b7){_0x3e42b2[_0x7e3c('0x48')]=_0x4318b7;return _0x3e42b2;})[_0x7e3c('0x2b')](respondWithFilteredResult(_0x2e83e7,_0x20c0be))['catch'](handleError(_0x2e83e7,null));};exports['show']=function(_0x121baf,_0x39fca5){var _0x58066e={'raw':!![],'where':{'id':_0x121baf[_0x7e3c('0x49')]['id']}},_0x42a935={};_0x42a935[_0x7e3c('0x3a')]=_['keys'](db[_0x7e3c('0x32')][_0x7e3c('0x33')]);_0x42a935[_0x7e3c('0x37')]=_[_0x7e3c('0x38')](_0x121baf[_0x7e3c('0x37')]);_0x42a935[_0x7e3c('0x39')]=_['intersection'](_0x42a935['model'],_0x42a935[_0x7e3c('0x37')]);_0x58066e[_0x7e3c('0x3d')]=_[_0x7e3c('0x3b')](_0x42a935[_0x7e3c('0x3a')],qs['fields'](_0x121baf[_0x7e3c('0x37')]['fields']));_0x58066e['attributes']=_0x58066e[_0x7e3c('0x3d')][_0x7e3c('0x3e')]?_0x58066e['attributes']:_0x42a935[_0x7e3c('0x3a')];if(_0x121baf[_0x7e3c('0x37')][_0x7e3c('0x46')]){_0x58066e[_0x7e3c('0x47')]=[{'all':!![]}];}_0x58066e=_[_0x7e3c('0x45')]({},_0x58066e,_0x121baf[_0x7e3c('0x4a')]);return db[_0x7e3c('0x32')][_0x7e3c('0x4b')](_0x58066e)[_0x7e3c('0x2b')](handleEntityNotFound(_0x39fca5,null))[_0x7e3c('0x2b')](respondWithResult(_0x39fca5,null))[_0x7e3c('0x4c')](handleError(_0x39fca5,null));};exports[_0x7e3c('0x4d')]=function(_0x5c8e2b,_0x3cfd5c){return db[_0x7e3c('0x32')][_0x7e3c('0x4d')](_0x5c8e2b['body'],{})['then'](respondWithResult(_0x3cfd5c,0xc9))[_0x7e3c('0x4c')](handleError(_0x3cfd5c,null));};exports[_0x7e3c('0x2a')]=function(_0xc7a58f,_0x55f978){if(_0xc7a58f[_0x7e3c('0x4e')]['id']){delete _0xc7a58f[_0x7e3c('0x4e')]['id'];}return db[_0x7e3c('0x32')][_0x7e3c('0x4b')]({'where':{'id':_0xc7a58f['params']['id']}})[_0x7e3c('0x2b')](handleEntityNotFound(_0x55f978,null))[_0x7e3c('0x2b')](saveUpdates(_0xc7a58f[_0x7e3c('0x4e')],null))[_0x7e3c('0x2b')](respondWithResult(_0x55f978,null))['catch'](handleError(_0x55f978,null));};exports[_0x7e3c('0x2c')]=function(_0x2e0af4,_0x47e20b){return db[_0x7e3c('0x32')]['find']({'where':{'id':_0x2e0af4[_0x7e3c('0x49')]['id']}})[_0x7e3c('0x2b')](handleEntityNotFound(_0x47e20b,null))[_0x7e3c('0x2b')](removeEntity(_0x47e20b,null))['catch'](handleError(_0x47e20b,null));};exports[_0x7e3c('0x4f')]=function(_0xf48846,_0x1fa426){return db[_0x7e3c('0x32')][_0x7e3c('0x4f')]()[_0x7e3c('0x2b')](respondWithResult(_0x1fa426,null))['catch'](handleError(_0x1fa426,null));};function wrapUser(_0x362cbb){return function(_0xe0f0a6){var _0x5c5de4=_0x362cbb['get']({'plain':!![]});_0x5c5de4[_0x7e3c('0x50')]=[];if(_0xe0f0a6){_0x5c5de4[_0x7e3c('0x51')]=_0xe0f0a6['createdAt'];_0x5c5de4['lastMessage']=_0xe0f0a6;}else{_0x5c5de4[_0x7e3c('0x51')]=moment(0x0)[_0x7e3c('0x52')](_0x7e3c('0x53'));_0x5c5de4['lastMessage']={};}return _0x5c5de4;};}exports[_0x7e3c('0x54')]=function(_0x7c5b59,_0x2c2cf8,_0x4a6193){var _0x1f024f=[];return db['User'][_0x7e3c('0x55')]({'where':{'role':['agent',_0x7e3c('0x56'),'user']},'attributes':['id','fullname','name',_0x7e3c('0x57'),_0x7e3c('0x58'),_0x7e3c('0x59'),_0x7e3c('0x5a'),'lastLoginAt','allowmessenger','showWebBar'],'order':qs[_0x7e3c('0x40')](_0x7e3c('0x5b')),'include':[{'model':db[_0x7e3c('0x5c')],'as':'VoiceQueues','attributes':['id','name',_0x7e3c('0x35')],'through':{'attributes':[]}}]})[_0x7e3c('0x2b')](function(_0x3dbe70){if(_0x3dbe70){var _0x316f9a=_0x7c5b59[_0x7e3c('0x5d')]['get']({'plain':!![]});if(!_0x316f9a)throw new Error(_0x7e3c('0x5e'));if(_0x316f9a['role']===_0x7e3c('0x5d')){return db['UserProfileSection'][_0x7e3c('0x4b')]({'where':{'name':_0x7e3c('0x5f'),'userProfileId':_0x316f9a[_0x7e3c('0x60')]},'raw':!![]})[_0x7e3c('0x2b')](function(_0x22e0a1){if(_0x22e0a1){if(_0x22e0a1['autoAssociation']===0x0){return db[_0x7e3c('0x61')][_0x7e3c('0x55')]({'where':{'sectionId':_0x22e0a1['id']},'raw':!![]})[_0x7e3c('0x2b')](function(_0x329989){var _0x443f2d=[];if(_['isEmpty'](_0x329989)){_0x443f2d=_['filter'](_0x3dbe70,function(_0x142407){if(_0x142407[_0x7e3c('0x57')]!==_0x7e3c('0x62')){return _0x142407;}});return _0x443f2d;}else{for(var _0x4f5df3=0x0;_0x4f5df3<_0x3dbe70[_0x7e3c('0x3e')];_0x4f5df3++){var _0xeb32c1=_0x3dbe70[_0x4f5df3];if(_0xeb32c1[_0x7e3c('0x57')]===_0x7e3c('0x62')){var _0x28fc30=_['find'](_0x329989,function(_0x2a54bb){return _0x2a54bb[_0x7e3c('0x63')]===_0xeb32c1['id'];});if(_0x28fc30)_0x443f2d[_0x7e3c('0x64')](_0xeb32c1);}else{_0x443f2d['push'](_0xeb32c1);}}return _0x443f2d;}});}else{return _0x3dbe70;}}else{var _0x57e68b=_[_0x7e3c('0x43')](_0x3dbe70,function(_0x194691){if(_0x194691['role']!=='agent'){return _0x194691;}});return _0x57e68b;}});}else{return _0x3dbe70;}}})['then'](function(_0xeae64e){var _0x566fa6=[];if(_0xeae64e){_0x1f024f=_0xeae64e;for(var _0x298fa8=0x0;_0x298fa8<_0xeae64e[_0x7e3c('0x3e')];_0x298fa8+=0x1){_0x1f024f[_0x298fa8][_0x7e3c('0x50')]=[];_0x566fa6[_0x7e3c('0x64')](db['ChatInternalMessage'][_0x7e3c('0x4b')]({'where':{'FromId':[_0x7c5b59['user']['id'],_0xeae64e[_0x298fa8]['id']],'ToId':[_0x7c5b59[_0x7e3c('0x5d')]['id'],_0xeae64e[_0x298fa8]['id']],'ChatGroupId':null},'attributes':['id',_0x7e3c('0x65'),_0x7e3c('0x66'),_0x7e3c('0x67'),_0x7e3c('0x68'),_0x7e3c('0x4e')],'order':qs[_0x7e3c('0x40')](_0x7e3c('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xeae64e[_0x298fa8])));}return BPromise[_0x7e3c('0x6a')](_0x566fa6);}return[];})[_0x7e3c('0x2b')](function(_0x251d2b){return{'rows':_0x251d2b,'count':_0x251d2b[_0x7e3c('0x3e')]};})[_0x7e3c('0x2b')](respondWithResult(_0x2c2cf8,null))['catch'](handleError(_0x2c2cf8,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f14163d..4b73ac8 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 _0x8ed7=['ChatInternalMessage','setMaxListeners','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x1786b7,_0x25bfc1){var _0x415e7c=function(_0x4e460d){while(--_0x4e460d){_0x1786b7['push'](_0x1786b7['shift']());}};_0x415e7c(++_0x25bfc1);}(_0x8ed7,0x8b));var _0x78ed=function(_0x2806bb,_0x5222be){_0x2806bb=_0x2806bb-0x0;var _0x4e83d1=_0x8ed7[_0x2806bb];return _0x4e83d1;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x78ed('0x0'))['db'][_0x78ed('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x78ed('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x78ed('0x3')};function emitEvent(_0x117e45){return function(_0x3b4895,_0x1301bc,_0x137b24){ChatInternalMessageEvents[_0x78ed('0x4')](_0x117e45+':'+_0x3b4895['id'],_0x3b4895);ChatInternalMessageEvents[_0x78ed('0x4')](_0x117e45,_0x3b4895);_0x137b24(null);};}for(var e in events){if(events[_0x78ed('0x5')](e)){var event=events[e];ChatInternalMessage[_0x78ed('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x77e1=['exports','ChatInternalMessage','setMaxListeners','emit','hook'];(function(_0x461264,_0x4109e2){var _0x28cb91=function(_0x21ada0){while(--_0x21ada0){_0x461264['push'](_0x461264['shift']());}};_0x28cb91(++_0x4109e2);}(_0x77e1,0x1a0));var _0x177e=function(_0x1fc331,_0x2f7678){_0x1fc331=_0x1fc331-0x0;var _0x35ece7=_0x77e1[_0x1fc331];return _0x35ece7;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x177e('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x177e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5b826d){return function(_0x58dfe6,_0x5a7358,_0x131fd8){ChatInternalMessageEvents[_0x177e('0x2')](_0x5b826d+':'+_0x58dfe6['id'],_0x58dfe6);ChatInternalMessageEvents[_0x177e('0x2')](_0x5b826d,_0x58dfe6);_0x131fd8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x177e('0x3')](e,emitEvent(event));}}module[_0x177e('0x4')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 520501c..2ff7636 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 _0x10d2=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','rimraf','exports','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x1c2585,_0x57976d){var _0x1d9d6d=function(_0x385f00){while(--_0x385f00){_0x1c2585['push'](_0x1c2585['shift']());}};_0x1d9d6d(++_0x57976d);}(_0x10d2,0x10f));var _0x210d=function(_0x2cffa7,_0x334f12){_0x2cffa7=_0x2cffa7-0x0;var _0x3653c1=_0x10d2[_0x2cffa7];return _0x3653c1;};'use strict';var _=require(_0x210d('0x0'));var util=require('util');var logger=require(_0x210d('0x1'))(_0x210d('0x2'));var moment=require(_0x210d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x210d('0x4'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x210d('0x5')]=function(_0x3340eb,_0x496bfc){return _0x3340eb['define'](_0x210d('0x6'),attributes,{'tableName':_0x210d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x210d('0x8'),'collate':_0x210d('0x9')});}; \ No newline at end of file +var _0xe152=['ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3f6499,_0x556b78){var _0x34ef56=function(_0x3bc4e7){while(--_0x3bc4e7){_0x3f6499['push'](_0x3f6499['shift']());}};_0x34ef56(++_0x556b78);}(_0xe152,0x1e4));var _0x2e15=function(_0x4a8773,_0x522735){_0x4a8773=_0x4a8773-0x0;var _0x38656b=_0xe152[_0x4a8773];return _0x38656b;};'use strict';var _=require('lodash');var util=require(_0x2e15('0x0'));var logger=require(_0x2e15('0x1'))(_0x2e15('0x2'));var moment=require(_0x2e15('0x3'));var BPromise=require(_0x2e15('0x4'));var rp=require(_0x2e15('0x5'));var fs=require('fs');var path=require(_0x2e15('0x6'));var rimraf=require(_0x2e15('0x7'));var config=require(_0x2e15('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0x2e15('0x9')]=function(_0x1f4e6c,_0x24d146){return _0x1f4e6c[_0x2e15('0xa')](_0x2e15('0xb'),attributes,{'tableName':_0x2e15('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2e15('0xd'),'collate':_0x2e15('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index d11af4d..a549800 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 _0xb714=['error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','request','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3e1c83,_0x62d459){var _0x4fd08f=function(_0x4374f3){while(--_0x4374f3){_0x3e1c83['push'](_0x3e1c83['shift']());}};_0x4fd08f(++_0x62d459);}(_0xb714,0x196));var _0x4b71=function(_0x5f1d5a,_0x1c85a7){_0x5f1d5a=_0x5f1d5a-0x0;var _0x449071=_0xb714[_0x5f1d5a];return _0x449071;};'use strict';var _=require(_0x4b71('0x0'));var util=require(_0x4b71('0x1'));var moment=require(_0x4b71('0x2'));var BPromise=require(_0x4b71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b71('0x4'));var db=require(_0x4b71('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b71('0x6'))(_0x4b71('0x7'));var config=require('../../config/environment');var jayson=require(_0x4b71('0x8'));var client=jayson[_0x4b71('0x9')][_0x4b71('0xa')]({'port':0x232a});config['redis']=_[_0x4b71('0xb')](config[_0x4b71('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b71('0xd'))(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x25a47a,_0x673cd5,_0x38b513){return new BPromise(function(_0xb0dc,_0x2afbe6){return client[_0x4b71('0xe')](_0x25a47a,_0x38b513)['then'](function(_0x26f2e4){logger[_0x4b71('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x673cd5,_0x4b71('0x10'));logger[_0x4b71('0x11')](_0x4b71('0x12'),_0x673cd5,_0x4b71('0x10'),JSON['stringify'](_0x26f2e4));if(_0x26f2e4[_0x4b71('0x13')]){if(_0x26f2e4[_0x4b71('0x13')][_0x4b71('0x14')]===0x1f4){logger[_0x4b71('0x13')](_0x4b71('0x15'),_0x673cd5,_0x26f2e4[_0x4b71('0x13')][_0x4b71('0x16')]);return _0x2afbe6(_0x26f2e4[_0x4b71('0x13')][_0x4b71('0x16')]);}logger[_0x4b71('0x13')](_0x4b71('0x15'),_0x673cd5,_0x26f2e4[_0x4b71('0x13')][_0x4b71('0x16')]);return _0xb0dc(_0x26f2e4[_0x4b71('0x13')][_0x4b71('0x16')]);}else{logger[_0x4b71('0xf')](_0x4b71('0x15'),_0x673cd5,_0x4b71('0x10'));_0xb0dc(_0x26f2e4[_0x4b71('0x17')][_0x4b71('0x16')]);}})[_0x4b71('0x18')](function(_0x3e00e5){logger[_0x4b71('0x13')](_0x4b71('0x15'),_0x673cd5,_0x3e00e5);_0x2afbe6(_0x3e00e5);});});} \ No newline at end of file +var _0x220b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x220b,0x1b7));var _0xb220=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x220b[_0x2307fa];return _0x496486;};'use strict';var _=require('lodash');var util=require(_0xb220('0x0'));var moment=require(_0xb220('0x1'));var BPromise=require(_0xb220('0x2'));var rs=require(_0xb220('0x3'));var fs=require('fs');var Redis=require(_0xb220('0x4'));var db=require(_0xb220('0x5'))['db'];var utils=require(_0xb220('0x6'));var logger=require(_0xb220('0x7'))(_0xb220('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb220('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb220('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb220('0xb'))(new Redis(config[_0xb220('0xa')]));require(_0xb220('0xc'))[_0xb220('0xd')](socket);function respondWithRpcPromise(_0x5517c7,_0x8314d4,_0x2c3a2d){return new BPromise(function(_0x332381,_0x1fba57){return client[_0xb220('0xe')](_0x5517c7,_0x2c3a2d)[_0xb220('0xf')](function(_0x504770){logger[_0xb220('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x8314d4,_0xb220('0x11'));logger[_0xb220('0x12')](_0xb220('0x13'),_0x8314d4,_0xb220('0x11'),JSON['stringify'](_0x504770));if(_0x504770['error']){if(_0x504770[_0xb220('0x14')][_0xb220('0x15')]===0x1f4){logger[_0xb220('0x14')](_0xb220('0x16'),_0x8314d4,_0x504770[_0xb220('0x14')][_0xb220('0x17')]);return _0x1fba57(_0x504770[_0xb220('0x14')]['message']);}logger[_0xb220('0x14')](_0xb220('0x16'),_0x8314d4,_0x504770[_0xb220('0x14')][_0xb220('0x17')]);return _0x332381(_0x504770[_0xb220('0x14')][_0xb220('0x17')]);}else{logger[_0xb220('0x10')](_0xb220('0x16'),_0x8314d4,_0xb220('0x11'));_0x332381(_0x504770[_0xb220('0x18')][_0xb220('0x17')]);}})[_0xb220('0x19')](function(_0x40716e){logger[_0xb220('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x8314d4,_0x40716e);_0x1fba57(_0x40716e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 9c4072c..409d762 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 _0x7a85=['removeListener','register','chatInternalMessage:','save','update','emit'];(function(_0x30667c,_0x190c7d){var _0x155998=function(_0x2fd617){while(--_0x2fd617){_0x30667c['push'](_0x30667c['shift']());}};_0x155998(++_0x190c7d);}(_0x7a85,0x1d1));var _0x57a8=function(_0x26362c,_0x2d9186){_0x26362c=_0x26362c-0x0;var _0x16c001=_0x7a85[_0x26362c];return _0x16c001;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x57a8('0x0'),'remove',_0x57a8('0x1')];function createListener(_0x3faeb0,_0x5773cc){return function(_0x4ef91f){_0x5773cc[_0x57a8('0x2')](_0x3faeb0,_0x4ef91f);};}function removeListener(_0x339aac,_0x17a9f7){return function(){ChatInternalMessageEvents[_0x57a8('0x3')](_0x339aac,_0x17a9f7);};}exports[_0x57a8('0x4')]=function(_0xfce3ce){for(var _0x19fcb8=0x0,_0x34cf83=events['length'];_0x19fcb8<_0x34cf83;_0x19fcb8++){var _0x1b6952=events[_0x19fcb8];var _0x479f70=createListener(_0x57a8('0x5')+_0x1b6952,_0xfce3ce);ChatInternalMessageEvents['on'](_0x1b6952,_0x479f70);}}; \ No newline at end of file +var _0xa3e0=['./chatInternalMessage.events','save','remove','update','emit','length','chatInternalMessage:'];(function(_0x1964e9,_0x1adade){var _0x35bffe=function(_0x29c150){while(--_0x29c150){_0x1964e9['push'](_0x1964e9['shift']());}};_0x35bffe(++_0x1adade);}(_0xa3e0,0x1b9));var _0x0a3e=function(_0x26dfd0,_0x404f9d){_0x26dfd0=_0x26dfd0-0x0;var _0x3e7507=_0xa3e0[_0x26dfd0];return _0x3e7507;};'use strict';var ChatInternalMessageEvents=require(_0x0a3e('0x0'));var events=[_0x0a3e('0x1'),_0x0a3e('0x2'),_0x0a3e('0x3')];function createListener(_0x7d65ae,_0x4377ad){return function(_0x214120){_0x4377ad[_0x0a3e('0x4')](_0x7d65ae,_0x214120);};}function removeListener(_0x517ee7,_0x547cd3){return function(){ChatInternalMessageEvents['removeListener'](_0x517ee7,_0x547cd3);};}exports['register']=function(_0x2d9a6b){for(var _0x2c2b8a=0x0,_0x1ef3ba=events[_0x0a3e('0x5')];_0x2c2b8a<_0x1ef3ba;_0x2c2b8a++){var _0x1c5435=events[_0x2c2b8a];var _0x1573b8=createListener(_0x0a3e('0x6')+_0x1c5435,_0x2d9a6b);ChatInternalMessageEvents['on'](_0x1c5435,_0x1573b8);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 5a6d1fd..809971c 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 _0x726b=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/users','getUsers','/:id','show','create','put','update','delete'];(function(_0x36e65d,_0x442690){var _0x33bc42=function(_0x301b20){while(--_0x301b20){_0x36e65d['push'](_0x36e65d['shift']());}};_0x33bc42(++_0x442690);}(_0x726b,0x120));var _0xb726=function(_0x131acd,_0xab927){_0x131acd=_0x131acd-0x0;var _0xdfc70f=_0x726b[_0x131acd];return _0xdfc70f;};'use strict';var multer=require(_0xb726('0x0'));var util=require('util');var path=require(_0xb726('0x1'));var timeout=require(_0xb726('0x2'));var express=require(_0xb726('0x3'));var router=express[_0xb726('0x4')]();var fs_extra=require(_0xb726('0x5'));var auth=require(_0xb726('0x6'));var interaction=require(_0xb726('0x7'));var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0xb726('0x8')]('/',auth[_0xb726('0x9')](),controller[_0xb726('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb726('0xb')]);router[_0xb726('0x8')](_0xb726('0xc'),auth[_0xb726('0x9')](),controller[_0xb726('0xd')]);router[_0xb726('0x8')](_0xb726('0xe'),auth[_0xb726('0x9')](),controller[_0xb726('0xf')]);router['post']('/',auth[_0xb726('0x9')](),controller[_0xb726('0x10')]);router[_0xb726('0x11')]('/:id',controller[_0xb726('0x12')]);router[_0xb726('0x13')]('/:id',auth[_0xb726('0x9')](),controller[_0xb726('0x14')]);module[_0xb726('0x15')]=router; \ No newline at end of file +var _0xdaa2=['express','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','isAuthenticated','/describe','describe','get','/users','getUsers','/:id','show','post','create','update','delete','multer','path','connect-timeout'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xdaa2,0x18c));var _0x2daa=function(_0x524188,_0x270495){_0x524188=_0x524188-0x0;var _0x31ea2f=_0xdaa2[_0x524188];return _0x31ea2f;};'use strict';var multer=require(_0x2daa('0x0'));var util=require('util');var path=require(_0x2daa('0x1'));var timeout=require(_0x2daa('0x2'));var express=require(_0x2daa('0x3'));var router=express['Router']();var fs_extra=require(_0x2daa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2daa('0x5'));var config=require('../../config/environment');var controller=require(_0x2daa('0x6'));router['get']('/',auth[_0x2daa('0x7')](),controller['index']);router['get'](_0x2daa('0x8'),auth['isAuthenticated'](),controller[_0x2daa('0x9')]);router[_0x2daa('0xa')](_0x2daa('0xb'),auth[_0x2daa('0x7')](),controller[_0x2daa('0xc')]);router['get'](_0x2daa('0xd'),auth[_0x2daa('0x7')](),controller[_0x2daa('0xe')]);router[_0x2daa('0xf')]('/',auth[_0x2daa('0x7')](),controller[_0x2daa('0x10')]);router['put'](_0x2daa('0xd'),controller[_0x2daa('0x11')]);router[_0x2daa('0x12')](_0x2daa('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 6b1fe40..f02d683 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 _0xb10b=['DATE','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f06fa,_0x31c38b){_0x4f06fa=_0x4f06fa-0x0;var _0x25c1a1=_0xb10b[_0x4f06fa];return _0x25c1a1;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xbb10('0x4')]('in',_0xbb10('0x5')),'defaultValue':_0xbb10('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbb10('0x6')]},'providerName':{'type':Sequelize[_0xbb10('0x7')]},'providerResponse':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xae60=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xae60,0x1c7));var _0x0ae6=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xae60[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0x0ae6('0x0'));module[_0x0ae6('0x1')]={'body':{'type':Sequelize[_0x0ae6('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0ae6('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0ae6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0ae6('0x4')]('in','out'),'defaultValue':_0x0ae6('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0ae6('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0ae6('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index b693284..08f0743 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 _0xce41=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatMessage','findAll','show','params','includeAll','include','find','create','body','describe','chat-interactions','read','readAt','UserId','user','get','ChatInteraction','ChatInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','ContactId','Sequelize','SELECT','contact','agent','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','reject','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','User','interface','rejectmessage','eml-format','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key'];(function(_0x10772c,_0x1df6ad){var _0x806119=function(_0xd52771){while(--_0xd52771){_0x10772c['push'](_0x10772c['shift']());}};_0x806119(++_0x1df6ad);}(_0xce41,0x1c0));var _0x1ce4=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0xce41[_0x336376];return _0x1d2a8e;};'use strict';var emlformat=require(_0x1ce4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ce4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ce4('0x2'));var moment=require(_0x1ce4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1ce4('0x4'));var util=require(_0x1ce4('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1ce4('0x6'));var ejs=require(_0x1ce4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ce4('0x8'));var squel=require(_0x1ce4('0x9'));var crypto=require(_0x1ce4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1ce4('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1ce4('0xc'));var Papa=require(_0x1ce4('0xd'));var Redis=require(_0x1ce4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1ce4('0xf'));var hardwareService=require(_0x1ce4('0x10'));var logger=require(_0x1ce4('0x11'))('api');var utils=require(_0x1ce4('0x12'));var config=require(_0x1ce4('0x13'));var licenseUtil=require(_0x1ce4('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1ce4('0x15')](config[_0x1ce4('0x16')],{'host':_0x1ce4('0x17'),'port':0x18eb});var socket=require(_0x1ce4('0x18'))(new Redis(config['redis']));require(_0x1ce4('0x19'))['register'](socket);var jayson=require(_0x1ce4('0x1a'));var client=jayson[_0x1ce4('0x1b')][_0x1ce4('0x1c')]({'port':0x232c});var client9002=jayson[_0x1ce4('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e98ad,_0x376316,_0x15cefd,_0x3ec71c){return new BPromise(function(_0x5a2260,_0x333da9){var _0x2971a0=_0x3ec71c||client;return _0x2971a0[_0x1ce4('0x1d')](_0x3e98ad,_0x15cefd)[_0x1ce4('0x1e')](function(_0x52a3d5){logger[_0x1ce4('0x1f')](_0x1ce4('0x20'),_0x376316,_0x1ce4('0x21'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x376316,_0x1ce4('0x21'),JSON[_0x1ce4('0x22')](_0x52a3d5));if(_0x52a3d5[_0x1ce4('0x23')]){if(_0x52a3d5[_0x1ce4('0x23')][_0x1ce4('0x24')]===0x1f4){logger[_0x1ce4('0x23')](_0x1ce4('0x20'),_0x376316,_0x52a3d5['error'][_0x1ce4('0x25')]);return _0x333da9(_0x52a3d5['error'][_0x1ce4('0x25')]);}logger[_0x1ce4('0x23')](_0x1ce4('0x20'),_0x376316,_0x52a3d5[_0x1ce4('0x23')]['message']);return _0x5a2260(_0x52a3d5[_0x1ce4('0x23')][_0x1ce4('0x25')]);}else{logger[_0x1ce4('0x1f')](_0x1ce4('0x20'),_0x376316,_0x1ce4('0x21'));_0x5a2260(_0x52a3d5[_0x1ce4('0x26')][_0x1ce4('0x25')]);}})[_0x1ce4('0x27')](function(_0x232570){logger['error']('ChatMessage,\x20%s,\x20%s',_0x376316,_0x232570);_0x333da9(_0x232570);});});}function respondWithStatusCode(_0x4282fe,_0x3a81f7){_0x3a81f7=_0x3a81f7||0xcc;return function(_0x4edba4){if(_0x4edba4){return _0x4282fe['sendStatus'](_0x3a81f7);}return _0x4282fe[_0x1ce4('0x28')](_0x3a81f7)[_0x1ce4('0x29')]();};}function respondWithResult(_0x200d87,_0x54849a){_0x54849a=_0x54849a||0xc8;return function(_0x228bf1){if(_0x228bf1){return _0x200d87[_0x1ce4('0x28')](_0x54849a)[_0x1ce4('0x2a')](_0x228bf1);}};}function respondWithFilteredResult(_0x1c0648,_0x1d44d9){return function(_0x1941fe){if(_0x1941fe){var _0x5bc7ae=typeof _0x1d44d9[_0x1ce4('0x2b')]===_0x1ce4('0x2c')&&typeof _0x1d44d9['limit']===_0x1ce4('0x2c');var _0x28e703=_0x1941fe['count'];var _0xb3d4f2=_0x5bc7ae?0x0:_0x1d44d9['offset'];var _0x1bd64f=_0x5bc7ae?_0x1941fe[_0x1ce4('0x2d')]:_0x1d44d9['offset']+_0x1d44d9[_0x1ce4('0x2e')];var _0x2c5ab8;if(_0x1bd64f>=_0x28e703){_0x1bd64f=_0x28e703;_0x2c5ab8=0xc8;}else{_0x2c5ab8=0xce;}_0x1c0648['status'](_0x2c5ab8);return _0x1c0648[_0x1ce4('0x2f')]('Content-Range',_0xb3d4f2+'-'+_0x1bd64f+'/'+_0x28e703)['json'](_0x1941fe);}return null;};}function patchUpdates(_0x565d0d){return function(_0x537916){try{jsonpatch['apply'](_0x537916,_0x565d0d,!![]);}catch(_0x9dfae8){return BPromise['reject'](_0x9dfae8);}return _0x537916[_0x1ce4('0x30')]();};}function saveUpdates(_0xab04b4,_0x466749){return function(_0x8bbcd3){if(_0x8bbcd3){return _0x8bbcd3[_0x1ce4('0x31')](_0xab04b4)[_0x1ce4('0x1e')](function(_0x583e35){return _0x583e35;});}return null;};}function removeEntity(_0x2817fd,_0x22555d){return function(_0x122dc7){if(_0x122dc7){return _0x122dc7[_0x1ce4('0x32')]()[_0x1ce4('0x1e')](function(){_0x2817fd[_0x1ce4('0x28')](0xcc)[_0x1ce4('0x29')]();});}};}function handleEntityNotFound(_0x242dc6,_0x179801){return function(_0x387fd6){if(!_0x387fd6){_0x242dc6[_0x1ce4('0x33')](0x194);}return _0x387fd6;};}function handleError(_0x2b3b16,_0x161e81){_0x161e81=_0x161e81||0x1f4;return function(_0x2a9890){logger[_0x1ce4('0x23')](_0x2a9890[_0x1ce4('0x34')]);if(_0x2a9890[_0x1ce4('0x35')]){delete _0x2a9890[_0x1ce4('0x35')];}_0x2b3b16[_0x1ce4('0x28')](_0x161e81)[_0x1ce4('0x36')](_0x2a9890);};}exports[_0x1ce4('0x37')]=function(_0x4d52b4,_0x4b1cac){var _0x4ae16f={},_0x5c6bb8={},_0x299e56={'count':0x0,'rows':[]};var _0x303f24=_[_0x1ce4('0x38')](db['ChatMessage'][_0x1ce4('0x39')],function(_0x574e59){return{'name':_0x574e59['fieldName'],'type':_0x574e59[_0x1ce4('0x3a')][_0x1ce4('0x3b')]};});_0x5c6bb8['model']=_[_0x1ce4('0x38')](_0x303f24,'name');_0x5c6bb8[_0x1ce4('0x3c')]=_[_0x1ce4('0x3d')](_0x4d52b4[_0x1ce4('0x3c')]);_0x5c6bb8[_0x1ce4('0x3e')]=_[_0x1ce4('0x3f')](_0x5c6bb8[_0x1ce4('0x40')],_0x5c6bb8['query']);_0x4ae16f[_0x1ce4('0x41')]=_['intersection'](_0x5c6bb8[_0x1ce4('0x40')],qs[_0x1ce4('0x42')](_0x4d52b4[_0x1ce4('0x3c')][_0x1ce4('0x42')]));_0x4ae16f[_0x1ce4('0x41')]=_0x4ae16f[_0x1ce4('0x41')][_0x1ce4('0x43')]?_0x4ae16f['attributes']:_0x5c6bb8[_0x1ce4('0x40')];if(!_0x4d52b4[_0x1ce4('0x3c')][_0x1ce4('0x44')](_0x1ce4('0x45'))){_0x4ae16f['limit']=qs[_0x1ce4('0x2e')](_0x4d52b4[_0x1ce4('0x3c')][_0x1ce4('0x2e')]);_0x4ae16f['offset']=qs[_0x1ce4('0x2b')](_0x4d52b4[_0x1ce4('0x3c')][_0x1ce4('0x2b')]);}_0x4ae16f['order']=qs[_0x1ce4('0x46')](_0x4d52b4['query'][_0x1ce4('0x46')]);_0x4ae16f[_0x1ce4('0x47')]=qs['filters'](_['pick'](_0x4d52b4[_0x1ce4('0x3c')],_0x5c6bb8[_0x1ce4('0x3e')]),_0x303f24);if(_0x4d52b4['query'][_0x1ce4('0x48')]){_0x4ae16f[_0x1ce4('0x47')]=_[_0x1ce4('0x49')](_0x4ae16f['where'],{'$or':_['map'](_0x303f24,function(_0x3759cb){if(_0x3759cb[_0x1ce4('0x3a')]!==_0x1ce4('0x4a')){var _0x4b4ca0={};_0x4b4ca0[_0x3759cb[_0x1ce4('0x35')]]={'$like':'%'+_0x4d52b4['query'][_0x1ce4('0x48')]+'%'};return _0x4b4ca0;}})});}_0x4ae16f=_[_0x1ce4('0x49')]({},_0x4ae16f,_0x4d52b4[_0x1ce4('0x4b')]);var _0x57a239={'where':_0x4ae16f['where']};return db['ChatMessage'][_0x1ce4('0x2d')](_0x57a239)[_0x1ce4('0x1e')](function(_0x4c3adc){_0x299e56[_0x1ce4('0x2d')]=_0x4c3adc;if(_0x4d52b4[_0x1ce4('0x3c')]['includeAll']){_0x4ae16f['include']=[{'all':!![]}];}return db[_0x1ce4('0x4c')][_0x1ce4('0x4d')](_0x4ae16f);})[_0x1ce4('0x1e')](function(_0x54c7eb){_0x299e56['rows']=_0x54c7eb;return _0x299e56;})[_0x1ce4('0x1e')](respondWithFilteredResult(_0x4b1cac,_0x4ae16f))[_0x1ce4('0x27')](handleError(_0x4b1cac,null));};exports[_0x1ce4('0x4e')]=function(_0x9635bc,_0x80f8a7){var _0x3c7b3c={'raw':!![],'where':{'id':_0x9635bc[_0x1ce4('0x4f')]['id']}},_0x79749c={};_0x79749c[_0x1ce4('0x40')]=_[_0x1ce4('0x3d')](db[_0x1ce4('0x4c')]['rawAttributes']);_0x79749c[_0x1ce4('0x3c')]=_[_0x1ce4('0x3d')](_0x9635bc[_0x1ce4('0x3c')]);_0x79749c[_0x1ce4('0x3e')]=_['intersection'](_0x79749c['model'],_0x79749c[_0x1ce4('0x3c')]);_0x3c7b3c[_0x1ce4('0x41')]=_[_0x1ce4('0x3f')](_0x79749c[_0x1ce4('0x40')],qs[_0x1ce4('0x42')](_0x9635bc[_0x1ce4('0x3c')][_0x1ce4('0x42')]));_0x3c7b3c[_0x1ce4('0x41')]=_0x3c7b3c['attributes'][_0x1ce4('0x43')]?_0x3c7b3c[_0x1ce4('0x41')]:_0x79749c['model'];if(_0x9635bc['query'][_0x1ce4('0x50')]){_0x3c7b3c[_0x1ce4('0x51')]=[{'all':!![]}];}_0x3c7b3c=_[_0x1ce4('0x49')]({},_0x3c7b3c,_0x9635bc['options']);return db[_0x1ce4('0x4c')][_0x1ce4('0x52')](_0x3c7b3c)['then'](handleEntityNotFound(_0x80f8a7,null))[_0x1ce4('0x1e')](respondWithResult(_0x80f8a7,null))['catch'](handleError(_0x80f8a7,null));};exports[_0x1ce4('0x53')]=function(_0x202d66,_0xdf374b){return db[_0x1ce4('0x4c')][_0x1ce4('0x53')](_0x202d66[_0x1ce4('0x54')],{})[_0x1ce4('0x1e')](respondWithResult(_0xdf374b,0xc9))['catch'](handleError(_0xdf374b,null));};exports[_0x1ce4('0x31')]=function(_0x1248ab,_0x3fc177){if(_0x1248ab[_0x1ce4('0x54')]['id']){delete _0x1248ab[_0x1ce4('0x54')]['id'];}return db['ChatMessage'][_0x1ce4('0x52')]({'where':{'id':_0x1248ab[_0x1ce4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3fc177,null))[_0x1ce4('0x1e')](saveUpdates(_0x1248ab[_0x1ce4('0x54')],null))[_0x1ce4('0x1e')](respondWithResult(_0x3fc177,null))[_0x1ce4('0x27')](handleError(_0x3fc177,null));};exports[_0x1ce4('0x32')]=function(_0x5b7411,_0x540ad2){return db[_0x1ce4('0x4c')][_0x1ce4('0x52')]({'where':{'id':_0x5b7411[_0x1ce4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x540ad2,null))['then'](removeEntity(_0x540ad2,null))[_0x1ce4('0x27')](handleError(_0x540ad2,null));};exports[_0x1ce4('0x55')]=function(_0x16d493,_0x3c6f96){return db[_0x1ce4('0x4c')]['describe']()[_0x1ce4('0x1e')](respondWithResult(_0x3c6f96,null))[_0x1ce4('0x27')](handleError(_0x3c6f96,null));};var interaction_log=require('../../config/logger')(_0x1ce4('0x56'));exports['accept']=function(_0x374ec2,_0xc4eef8,_0x51a1a0){var _0x3a1fc1={'agent':{},'channel':'chat'};if(_0x374ec2[_0x1ce4('0x54')]['id']){delete _0x374ec2[_0x1ce4('0x54')]['id'];}_0x374ec2[_0x1ce4('0x54')][_0x1ce4('0x57')]=!![];_0x374ec2[_0x1ce4('0x54')][_0x1ce4('0x58')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x374ec2['body'][_0x1ce4('0x59')]=_0x374ec2[_0x1ce4('0x54')]['UserId']||_0x374ec2[_0x1ce4('0x5a')]['id'];_0x3a1fc1['agent']['id']=_0x374ec2[_0x1ce4('0x54')][_0x1ce4('0x59')];return db['ChatMessage']['find']({'where':{'id':_0x374ec2[_0x1ce4('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xc4eef8,null))[_0x1ce4('0x1e')](saveUpdates(_0x374ec2['body'],null))[_0x1ce4('0x1e')](function(_0x1fdbd5){if(_0x1fdbd5){_0x3a1fc1['message']=_0x1fdbd5[_0x1ce4('0x5b')]({'plain':!![]});return db[_0x1ce4('0x5c')][_0x1ce4('0x52')]({'where':{'id':_0x1fdbd5[_0x1ce4('0x5d')]}});}return null;})[_0x1ce4('0x1e')](handleEntityNotFound(_0xc4eef8,null))[_0x1ce4('0x1e')](function(_0x25b9e0){if(_0x25b9e0){return _0x25b9e0[_0x1ce4('0x31')]({'UserId':_0x374ec2[_0x1ce4('0x54')][_0x1ce4('0x59')],'read1stAt':_['isNil'](_0x25b9e0[_0x1ce4('0x5e')])?moment()[_0x1ce4('0x5f')](_0x1ce4('0x60')):undefined});}return null;})['then'](function(_0x2554a2){if(_0x2554a2){_0x3a1fc1[_0x1ce4('0x61')]=_0x2554a2[_0x1ce4('0x5b')]({'plain':!![]});interaction_log[_0x1ce4('0x1f')](_0x1ce4('0x62'),_0x374ec2[_0x1ce4('0x5a')]['id'],_0x374ec2[_0x1ce4('0x5a')]['name'],_0x374ec2['user'][_0x1ce4('0x63')],_0x3a1fc1[_0x1ce4('0x61')]['id'],_0x374ec2[_0x1ce4('0x54')]?JSON['stringify'](_0x374ec2[_0x1ce4('0x54')]):_0x1ce4('0x64'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3a1fc1);}return null;})['then'](function(_0x493686){var _0x3ee3b8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x493686['message'][_0x1ce4('0x65')];return db['sequelize']['query'](_0x3ee3b8,{'type':db[_0x1ce4('0x66')]['QueryTypes'][_0x1ce4('0x67')],'raw':!![]})[_0x1ce4('0x1e')](function(_0x5c679a){return _0x5c679a;});})['then'](function(_0x1fdd68){if(_0x1fdd68){_0x3a1fc1[_0x1ce4('0x25')][_0x1ce4('0x68')]=_0x1fdd68[0x0];if(!_0x374ec2[_0x1ce4('0x54')][_0x1ce4('0x59')])return;return db['User']['find']({'where':{'id':_0x374ec2[_0x1ce4('0x54')][_0x1ce4('0x59')],'role':_0x1ce4('0x69')},'attributes':['id','name',_0x1ce4('0x6a'),_0x1ce4('0x6b'),_0x1ce4('0x6c')],'raw':!![]});}return null;})[_0x1ce4('0x1e')](function(_0x4f50f5){if(!_0x4f50f5)return null;_0x3a1fc1[_0x1ce4('0x25')][_0x1ce4('0x69')]=_0x4f50f5;return _0x3a1fc1;})[_0x1ce4('0x1e')](function(_0x328000){if(_0x328000){if(_0x374ec2['body'][_0x1ce4('0x6d')]){_0x3a1fc1[_0x1ce4('0x25')]['interface']=util[_0x1ce4('0x5f')](_0x1ce4('0x6e'),_0x374ec2[_0x1ce4('0x5a')][_0x1ce4('0x35')]);_0x3a1fc1[_0x1ce4('0x25')][_0x1ce4('0x6f')]=_0x3a1fc1['channel'];_0x3a1fc1[_0x1ce4('0x25')][_0x1ce4('0x70')]=_0x3a1fc1[_0x1ce4('0x6f')];_0x3a1fc1[_0x1ce4('0x25')][_0x1ce4('0x71')]='accept';return respondWithRpcPromise('EventManager',_0x1ce4('0x72'),{'event':'acceptmessage','message':_[_0x1ce4('0x49')](_0x3a1fc1['message'],JSON[_0x1ce4('0x73')](_0x3a1fc1[_0x1ce4('0x61')][_0x1ce4('0x74')]))},client9002)[_0x1ce4('0x1e')](function(){return _0x3a1fc1;});}return _0x3a1fc1;}return null;})[_0x1ce4('0x1e')](respondWithResult(_0xc4eef8,null))[_0x1ce4('0x27')](handleError(_0xc4eef8,null));};var interaction_log=require(_0x1ce4('0x11'))(_0x1ce4('0x56'));exports[_0x1ce4('0x75')]=function(_0xd2b8fb,_0x117f06,_0x5387e7){var _0x5360e5={'agent':{},'channel':_0x1ce4('0x76')};if(_0xd2b8fb[_0x1ce4('0x54')]['id']){delete _0xd2b8fb[_0x1ce4('0x54')]['id'];}_0xd2b8fb[_0x1ce4('0x54')][_0x1ce4('0x59')]=_0xd2b8fb[_0x1ce4('0x54')]['UserId']||_0xd2b8fb[_0x1ce4('0x5a')]['id'];_0x5360e5[_0x1ce4('0x69')]['id']=_0xd2b8fb[_0x1ce4('0x54')]['UserId'];return db[_0x1ce4('0x4c')][_0x1ce4('0x52')]({'where':{'id':_0xd2b8fb[_0x1ce4('0x4f')]['id'],'UserId':null}})[_0x1ce4('0x1e')](handleEntityNotFound(_0x117f06,null))['then'](function(_0x20aa4d){if(_0x20aa4d){_0x5360e5[_0x1ce4('0x25')]=_0x20aa4d[_0x1ce4('0x5b')]({'plain':!![]});return db['ChatInteraction'][_0x1ce4('0x52')]({'where':{'id':_0x20aa4d[_0x1ce4('0x5d')]}});}return null;})[_0x1ce4('0x1e')](handleEntityNotFound(_0x117f06,null))[_0x1ce4('0x1e')](function(_0x3a8c18){if(_0x3a8c18){_0x5360e5[_0x1ce4('0x61')]=_0x3a8c18[_0x1ce4('0x5b')]({'plain':!![]});interaction_log[_0x1ce4('0x1f')](_0x1ce4('0x77'),_0xd2b8fb[_0x1ce4('0x5a')]['id'],_0xd2b8fb[_0x1ce4('0x5a')][_0x1ce4('0x35')],_0xd2b8fb[_0x1ce4('0x5a')][_0x1ce4('0x63')],_0x5360e5[_0x1ce4('0x61')]['id'],_0xd2b8fb[_0x1ce4('0x54')]?JSON[_0x1ce4('0x22')](_0xd2b8fb[_0x1ce4('0x54')]):'null');return respondWithRpcPromise(_0x1ce4('0x78'),_0x1ce4('0x79'),_0x5360e5);}return null;})[_0x1ce4('0x1e')](function(_0xa9b99d){var _0x4c4b21='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xa9b99d[_0x1ce4('0x25')]['ContactId'];return db[_0x1ce4('0x7a')][_0x1ce4('0x3c')](_0x4c4b21,{'type':db[_0x1ce4('0x66')][_0x1ce4('0x7b')]['SELECT'],'raw':!![]})[_0x1ce4('0x1e')](function(_0x3a2ef7){return _0x3a2ef7;});})[_0x1ce4('0x1e')](function(_0x566178){if(_0x566178){_0x5360e5[_0x1ce4('0x25')][_0x1ce4('0x68')]=_0x566178[0x0];if(!_0xd2b8fb[_0x1ce4('0x54')][_0x1ce4('0x59')])return;return db[_0x1ce4('0x7c')][_0x1ce4('0x52')]({'where':{'id':_0xd2b8fb[_0x1ce4('0x54')][_0x1ce4('0x59')],'role':_0x1ce4('0x69')},'attributes':['id',_0x1ce4('0x35'),'fullname','email',_0x1ce4('0x6c')],'raw':!![]});}return null;})[_0x1ce4('0x1e')](function(_0x413994){if(!_0x413994)return null;_0x5360e5[_0x1ce4('0x25')][_0x1ce4('0x69')]=_0x413994;return _0x5360e5;})[_0x1ce4('0x1e')](function(_0x1cdf29){if(_0x1cdf29){_0x1cdf29[_0x1ce4('0x25')][_0x1ce4('0x7d')]=util[_0x1ce4('0x5f')]('SIP/%s',_0xd2b8fb['user'][_0x1ce4('0x35')]);_0x1cdf29[_0x1ce4('0x25')]['channel']=_0x5360e5[_0x1ce4('0x6f')];_0x1cdf29[_0x1ce4('0x25')][_0x1ce4('0x70')]=_0x5360e5[_0x1ce4('0x6f')];_0x1cdf29['message'][_0x1ce4('0x71')]=_0x1ce4('0x75');respondWithRpcPromise(_0x1ce4('0x72'),_0x1ce4('0x72'),{'event':_0x1ce4('0x7e'),'message':_['merge'](_0x5360e5[_0x1ce4('0x25')],JSON[_0x1ce4('0x73')](_0x5360e5[_0x1ce4('0x61')][_0x1ce4('0x74')]))},client9002);return _0x5360e5;}return null;})['then'](respondWithResult(_0x117f06,null))['catch'](handleError(_0x117f06,null));}; \ No newline at end of file +var _0x55ef=['stack','name','send','map','ChatMessage','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','create','body','describe','chat-interactions','accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','reject','chat','RejectMessage','rejectMessage','QueryTypes','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','update','destroy'];(function(_0x222dc5,_0xe61028){var _0x306259=function(_0x4efba6){while(--_0x4efba6){_0x222dc5['push'](_0x222dc5['shift']());}};_0x306259(++_0xe61028);}(_0x55ef,0x1d2));var _0xf55e=function(_0x226701,_0x14d1f9){_0x226701=_0x226701-0x0;var _0x4a56a6=_0x55ef[_0x226701];return _0x4a56a6;};'use strict';var emlformat=require(_0xf55e('0x0'));var rimraf=require(_0xf55e('0x1'));var zipdir=require(_0xf55e('0x2'));var jsonpatch=require(_0xf55e('0x3'));var rp=require(_0xf55e('0x4'));var moment=require(_0xf55e('0x5'));var BPromise=require(_0xf55e('0x6'));var Mustache=require(_0xf55e('0x7'));var util=require(_0xf55e('0x8'));var path=require(_0xf55e('0x9'));var sox=require(_0xf55e('0xa'));var csv=require(_0xf55e('0xb'));var ejs=require(_0xf55e('0xc'));var fs=require('fs');var fs_extra=require(_0xf55e('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf55e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf55e('0xf'));var toCsv=require(_0xf55e('0xb'));var querystring=require(_0xf55e('0x10'));var Papa=require(_0xf55e('0x11'));var Redis=require(_0xf55e('0x12'));var authService=require(_0xf55e('0x13'));var qs=require(_0xf55e('0x14'));var as=require(_0xf55e('0x15'));var hardwareService=require(_0xf55e('0x16'));var logger=require(_0xf55e('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf55e('0x18'));var licenseUtil=require(_0xf55e('0x19'));var db=require(_0xf55e('0x1a'))['db'];config['redis']=_[_0xf55e('0x1b')](config[_0xf55e('0x1c')],{'host':_0xf55e('0x1d'),'port':0x18eb});var socket=require(_0xf55e('0x1e'))(new Redis(config[_0xf55e('0x1c')]));require(_0xf55e('0x1f'))['register'](socket);var jayson=require(_0xf55e('0x20'));var client=jayson[_0xf55e('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xf55e('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2719a6,_0x2b4f9b,_0x266d53,_0x485795){return new BPromise(function(_0x423088,_0x4bf816){var _0x2353e1=_0x485795||client;return _0x2353e1[_0xf55e('0x22')](_0x2719a6,_0x266d53)[_0xf55e('0x23')](function(_0x516522){logger[_0xf55e('0x24')](_0xf55e('0x25'),_0x2b4f9b,_0xf55e('0x26'));logger[_0xf55e('0x27')](_0xf55e('0x28'),_0x2b4f9b,_0xf55e('0x26'),JSON['stringify'](_0x516522));if(_0x516522['error']){if(_0x516522[_0xf55e('0x29')][_0xf55e('0x2a')]===0x1f4){logger[_0xf55e('0x29')]('ChatMessage,\x20%s,\x20%s',_0x2b4f9b,_0x516522[_0xf55e('0x29')][_0xf55e('0x2b')]);return _0x4bf816(_0x516522[_0xf55e('0x29')][_0xf55e('0x2b')]);}logger[_0xf55e('0x29')](_0xf55e('0x25'),_0x2b4f9b,_0x516522[_0xf55e('0x29')][_0xf55e('0x2b')]);return _0x423088(_0x516522[_0xf55e('0x29')][_0xf55e('0x2b')]);}else{logger[_0xf55e('0x24')](_0xf55e('0x25'),_0x2b4f9b,_0xf55e('0x26'));_0x423088(_0x516522[_0xf55e('0x2c')][_0xf55e('0x2b')]);}})[_0xf55e('0x2d')](function(_0x3f0d3f){logger[_0xf55e('0x29')](_0xf55e('0x25'),_0x2b4f9b,_0x3f0d3f);_0x4bf816(_0x3f0d3f);});});}function respondWithStatusCode(_0xd56f82,_0xe90daa){_0xe90daa=_0xe90daa||0xcc;return function(_0x337f8f){if(_0x337f8f){return _0xd56f82[_0xf55e('0x2e')](_0xe90daa);}return _0xd56f82[_0xf55e('0x2f')](_0xe90daa)[_0xf55e('0x30')]();};}function respondWithResult(_0x50ef95,_0x5565b8){_0x5565b8=_0x5565b8||0xc8;return function(_0x252c58){if(_0x252c58){return _0x50ef95[_0xf55e('0x2f')](_0x5565b8)[_0xf55e('0x31')](_0x252c58);}};}function respondWithFilteredResult(_0x337eee,_0x40eb35){return function(_0x202dcd){if(_0x202dcd){var _0x8bc4f8=typeof _0x40eb35['offset']==='undefined'&&typeof _0x40eb35[_0xf55e('0x32')]==='undefined';var _0x3e2a57=_0x202dcd[_0xf55e('0x33')];var _0x2196ae=_0x8bc4f8?0x0:_0x40eb35[_0xf55e('0x34')];var _0x3af3f5=_0x8bc4f8?_0x202dcd[_0xf55e('0x33')]:_0x40eb35[_0xf55e('0x34')]+_0x40eb35[_0xf55e('0x32')];var _0x5b1a92;if(_0x3af3f5>=_0x3e2a57){_0x3af3f5=_0x3e2a57;_0x5b1a92=0xc8;}else{_0x5b1a92=0xce;}_0x337eee['status'](_0x5b1a92);return _0x337eee['set'](_0xf55e('0x35'),_0x2196ae+'-'+_0x3af3f5+'/'+_0x3e2a57)[_0xf55e('0x31')](_0x202dcd);}return null;};}function patchUpdates(_0xdbf42a){return function(_0x4fa19e){try{jsonpatch[_0xf55e('0x36')](_0x4fa19e,_0xdbf42a,!![]);}catch(_0x1455a5){return BPromise['reject'](_0x1455a5);}return _0x4fa19e[_0xf55e('0x37')]();};}function saveUpdates(_0xb1cf74,_0x426385){return function(_0x634fc8){if(_0x634fc8){return _0x634fc8[_0xf55e('0x38')](_0xb1cf74)[_0xf55e('0x23')](function(_0x4843e1){return _0x4843e1;});}return null;};}function removeEntity(_0x237ab8,_0x53d897){return function(_0x2abf92){if(_0x2abf92){return _0x2abf92[_0xf55e('0x39')]()['then'](function(){_0x237ab8[_0xf55e('0x2f')](0xcc)[_0xf55e('0x30')]();});}};}function handleEntityNotFound(_0x5b5502,_0xdeb28a){return function(_0x12aaf4){if(!_0x12aaf4){_0x5b5502[_0xf55e('0x2e')](0x194);}return _0x12aaf4;};}function handleError(_0x276567,_0x40235c){_0x40235c=_0x40235c||0x1f4;return function(_0x5713dd){logger[_0xf55e('0x29')](_0x5713dd[_0xf55e('0x3a')]);if(_0x5713dd['name']){delete _0x5713dd[_0xf55e('0x3b')];}_0x276567['status'](_0x40235c)[_0xf55e('0x3c')](_0x5713dd);};}exports['index']=function(_0x51ca40,_0x4541fb){var _0x22662d={},_0x5f2cf9={},_0x54ae50={'count':0x0,'rows':[]};var _0x564923=_[_0xf55e('0x3d')](db[_0xf55e('0x3e')]['rawAttributes'],function(_0x13f1cc){return{'name':_0x13f1cc['fieldName'],'type':_0x13f1cc[_0xf55e('0x3f')]['key']};});_0x5f2cf9[_0xf55e('0x40')]=_[_0xf55e('0x3d')](_0x564923,_0xf55e('0x3b'));_0x5f2cf9[_0xf55e('0x41')]=_[_0xf55e('0x42')](_0x51ca40['query']);_0x5f2cf9[_0xf55e('0x43')]=_['intersection'](_0x5f2cf9['model'],_0x5f2cf9[_0xf55e('0x41')]);_0x22662d[_0xf55e('0x44')]=_[_0xf55e('0x45')](_0x5f2cf9['model'],qs[_0xf55e('0x46')](_0x51ca40[_0xf55e('0x41')]['fields']));_0x22662d['attributes']=_0x22662d['attributes'][_0xf55e('0x47')]?_0x22662d[_0xf55e('0x44')]:_0x5f2cf9[_0xf55e('0x40')];if(!_0x51ca40['query'][_0xf55e('0x48')](_0xf55e('0x49'))){_0x22662d[_0xf55e('0x32')]=qs[_0xf55e('0x32')](_0x51ca40['query']['limit']);_0x22662d[_0xf55e('0x34')]=qs['offset'](_0x51ca40['query'][_0xf55e('0x34')]);}_0x22662d['order']=qs[_0xf55e('0x4a')](_0x51ca40[_0xf55e('0x41')]['sort']);_0x22662d[_0xf55e('0x4b')]=qs[_0xf55e('0x43')](_[_0xf55e('0x4c')](_0x51ca40[_0xf55e('0x41')],_0x5f2cf9[_0xf55e('0x43')]),_0x564923);if(_0x51ca40['query'][_0xf55e('0x4d')]){_0x22662d[_0xf55e('0x4b')]=_['merge'](_0x22662d[_0xf55e('0x4b')],{'$or':_[_0xf55e('0x3d')](_0x564923,function(_0x3c9bcd){if(_0x3c9bcd[_0xf55e('0x3f')]!==_0xf55e('0x4e')){var _0x31bad8={};_0x31bad8[_0x3c9bcd[_0xf55e('0x3b')]]={'$like':'%'+_0x51ca40[_0xf55e('0x41')][_0xf55e('0x4d')]+'%'};return _0x31bad8;}})});}_0x22662d=_[_0xf55e('0x4f')]({},_0x22662d,_0x51ca40[_0xf55e('0x50')]);var _0x539771={'where':_0x22662d[_0xf55e('0x4b')]};return db[_0xf55e('0x3e')][_0xf55e('0x33')](_0x539771)[_0xf55e('0x23')](function(_0x285840){_0x54ae50[_0xf55e('0x33')]=_0x285840;if(_0x51ca40[_0xf55e('0x41')][_0xf55e('0x51')]){_0x22662d[_0xf55e('0x52')]=[{'all':!![]}];}return db[_0xf55e('0x3e')][_0xf55e('0x53')](_0x22662d);})[_0xf55e('0x23')](function(_0xd06884){_0x54ae50[_0xf55e('0x54')]=_0xd06884;return _0x54ae50;})[_0xf55e('0x23')](respondWithFilteredResult(_0x4541fb,_0x22662d))['catch'](handleError(_0x4541fb,null));};exports['show']=function(_0x42967e,_0x122050){var _0x509813={'raw':!![],'where':{'id':_0x42967e[_0xf55e('0x55')]['id']}},_0x503e8f={};_0x503e8f[_0xf55e('0x40')]=_[_0xf55e('0x42')](db['ChatMessage']['rawAttributes']);_0x503e8f['query']=_[_0xf55e('0x42')](_0x42967e['query']);_0x503e8f[_0xf55e('0x43')]=_[_0xf55e('0x45')](_0x503e8f['model'],_0x503e8f[_0xf55e('0x41')]);_0x509813[_0xf55e('0x44')]=_[_0xf55e('0x45')](_0x503e8f['model'],qs[_0xf55e('0x46')](_0x42967e['query'][_0xf55e('0x46')]));_0x509813[_0xf55e('0x44')]=_0x509813[_0xf55e('0x44')][_0xf55e('0x47')]?_0x509813[_0xf55e('0x44')]:_0x503e8f[_0xf55e('0x40')];if(_0x42967e[_0xf55e('0x41')][_0xf55e('0x51')]){_0x509813[_0xf55e('0x52')]=[{'all':!![]}];}_0x509813=_[_0xf55e('0x4f')]({},_0x509813,_0x42967e[_0xf55e('0x50')]);return db[_0xf55e('0x3e')][_0xf55e('0x56')](_0x509813)[_0xf55e('0x23')](handleEntityNotFound(_0x122050,null))[_0xf55e('0x23')](respondWithResult(_0x122050,null))[_0xf55e('0x2d')](handleError(_0x122050,null));};exports[_0xf55e('0x57')]=function(_0xee0215,_0x326e6a){return db[_0xf55e('0x3e')]['create'](_0xee0215[_0xf55e('0x58')],{})['then'](respondWithResult(_0x326e6a,0xc9))['catch'](handleError(_0x326e6a,null));};exports[_0xf55e('0x38')]=function(_0x11aa5f,_0x74f271){if(_0x11aa5f['body']['id']){delete _0x11aa5f[_0xf55e('0x58')]['id'];}return db[_0xf55e('0x3e')][_0xf55e('0x56')]({'where':{'id':_0x11aa5f[_0xf55e('0x55')]['id']}})['then'](handleEntityNotFound(_0x74f271,null))['then'](saveUpdates(_0x11aa5f[_0xf55e('0x58')],null))[_0xf55e('0x23')](respondWithResult(_0x74f271,null))['catch'](handleError(_0x74f271,null));};exports[_0xf55e('0x39')]=function(_0x61d10d,_0x56d5c9){return db[_0xf55e('0x3e')][_0xf55e('0x56')]({'where':{'id':_0x61d10d[_0xf55e('0x55')]['id']}})[_0xf55e('0x23')](handleEntityNotFound(_0x56d5c9,null))[_0xf55e('0x23')](removeEntity(_0x56d5c9,null))['catch'](handleError(_0x56d5c9,null));};exports['describe']=function(_0x59dce5,_0x65ccc3){return db[_0xf55e('0x3e')][_0xf55e('0x59')]()[_0xf55e('0x23')](respondWithResult(_0x65ccc3,null))[_0xf55e('0x2d')](handleError(_0x65ccc3,null));};var interaction_log=require(_0xf55e('0x17'))(_0xf55e('0x5a'));exports[_0xf55e('0x5b')]=function(_0x597f92,_0x3500e0,_0x3843fb){var _0xe7e5a4={'agent':{},'channel':'chat'};if(_0x597f92[_0xf55e('0x58')]['id']){delete _0x597f92[_0xf55e('0x58')]['id'];}_0x597f92['body']['read']=!![];_0x597f92[_0xf55e('0x58')]['readAt']=moment()[_0xf55e('0x5c')](_0xf55e('0x5d'));_0x597f92['body'][_0xf55e('0x5e')]=_0x597f92[_0xf55e('0x58')][_0xf55e('0x5e')]||_0x597f92['user']['id'];_0xe7e5a4[_0xf55e('0x5f')]['id']=_0x597f92[_0xf55e('0x58')][_0xf55e('0x5e')];return db[_0xf55e('0x3e')][_0xf55e('0x56')]({'where':{'id':_0x597f92[_0xf55e('0x55')]['id'],'UserId':null}})[_0xf55e('0x23')](handleEntityNotFound(_0x3500e0,null))[_0xf55e('0x23')](saveUpdates(_0x597f92[_0xf55e('0x58')],null))['then'](function(_0x4095be){if(_0x4095be){_0xe7e5a4['message']=_0x4095be[_0xf55e('0x60')]({'plain':!![]});return db[_0xf55e('0x61')][_0xf55e('0x56')]({'where':{'id':_0x4095be[_0xf55e('0x62')]}});}return null;})[_0xf55e('0x23')](handleEntityNotFound(_0x3500e0,null))['then'](function(_0x1e14ac){if(_0x1e14ac){return _0x1e14ac['update']({'UserId':_0x597f92[_0xf55e('0x58')][_0xf55e('0x5e')],'read1stAt':_[_0xf55e('0x63')](_0x1e14ac['read1stAt'])?moment()[_0xf55e('0x5c')](_0xf55e('0x5d')):undefined});}return null;})['then'](function(_0x360611){if(_0x360611){_0xe7e5a4[_0xf55e('0x64')]=_0x360611[_0xf55e('0x60')]({'plain':!![]});interaction_log[_0xf55e('0x24')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x597f92[_0xf55e('0x65')]['id'],_0x597f92[_0xf55e('0x65')][_0xf55e('0x3b')],_0x597f92['user'][_0xf55e('0x66')],_0xe7e5a4['interaction']['id'],_0x597f92['body']?JSON[_0xf55e('0x67')](_0x597f92[_0xf55e('0x58')]):_0xf55e('0x68'));return respondWithRpcPromise(_0xf55e('0x69'),_0xf55e('0x6a'),_0xe7e5a4);}return null;})[_0xf55e('0x23')](function(_0x8f81bf){var _0x565655=_0xf55e('0x6b')+_0x8f81bf[_0xf55e('0x2b')][_0xf55e('0x6c')];return db[_0xf55e('0x6d')][_0xf55e('0x41')](_0x565655,{'type':db[_0xf55e('0x6e')]['QueryTypes'][_0xf55e('0x6f')],'raw':!![]})['then'](function(_0x3ee333){return _0x3ee333;});})['then'](function(_0x1e39fe){if(_0x1e39fe){_0xe7e5a4[_0xf55e('0x2b')][_0xf55e('0x70')]=_0x1e39fe[0x0];if(!_0x597f92[_0xf55e('0x58')][_0xf55e('0x5e')])return;return db[_0xf55e('0x71')][_0xf55e('0x56')]({'where':{'id':_0x597f92[_0xf55e('0x58')][_0xf55e('0x5e')],'role':'agent'},'attributes':['id',_0xf55e('0x3b'),_0xf55e('0x72'),_0xf55e('0x73'),_0xf55e('0x74')],'raw':!![]});}return null;})[_0xf55e('0x23')](function(_0x3f38b6){if(!_0x3f38b6)return null;_0xe7e5a4[_0xf55e('0x2b')][_0xf55e('0x5f')]=_0x3f38b6;return _0xe7e5a4;})['then'](function(_0x4a363f){if(_0x4a363f){if(_0x597f92['body']['manual']){_0xe7e5a4['message']['interface']=util[_0xf55e('0x5c')]('SIP/%s',_0x597f92[_0xf55e('0x65')]['name']);_0xe7e5a4[_0xf55e('0x2b')][_0xf55e('0x75')]=_0xe7e5a4[_0xf55e('0x75')];_0xe7e5a4[_0xf55e('0x2b')][_0xf55e('0x76')]=_0xe7e5a4[_0xf55e('0x75')];_0xe7e5a4[_0xf55e('0x2b')][_0xf55e('0x77')]=_0xf55e('0x5b');return respondWithRpcPromise(_0xf55e('0x78'),'EventManager',{'event':_0xf55e('0x79'),'message':_[_0xf55e('0x4f')](_0xe7e5a4[_0xf55e('0x2b')],JSON[_0xf55e('0x7a')](_0xe7e5a4[_0xf55e('0x64')][_0xf55e('0x7b')]))},client9002)[_0xf55e('0x23')](function(){return _0xe7e5a4;});}return _0xe7e5a4;}return null;})[_0xf55e('0x23')](respondWithResult(_0x3500e0,null))['catch'](handleError(_0x3500e0,null));};var interaction_log=require(_0xf55e('0x17'))(_0xf55e('0x5a'));exports[_0xf55e('0x7c')]=function(_0x41d51d,_0x7318c9,_0x10dce5){var _0x436622={'agent':{},'channel':_0xf55e('0x7d')};if(_0x41d51d[_0xf55e('0x58')]['id']){delete _0x41d51d['body']['id'];}_0x41d51d[_0xf55e('0x58')]['UserId']=_0x41d51d[_0xf55e('0x58')]['UserId']||_0x41d51d[_0xf55e('0x65')]['id'];_0x436622[_0xf55e('0x5f')]['id']=_0x41d51d['body'][_0xf55e('0x5e')];return db[_0xf55e('0x3e')][_0xf55e('0x56')]({'where':{'id':_0x41d51d[_0xf55e('0x55')]['id'],'UserId':null}})[_0xf55e('0x23')](handleEntityNotFound(_0x7318c9,null))[_0xf55e('0x23')](function(_0x438844){if(_0x438844){_0x436622[_0xf55e('0x2b')]=_0x438844[_0xf55e('0x60')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x438844['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x7318c9,null))[_0xf55e('0x23')](function(_0x1d8cc7){if(_0x1d8cc7){_0x436622[_0xf55e('0x64')]=_0x1d8cc7['get']({'plain':!![]});interaction_log[_0xf55e('0x24')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x41d51d['user']['id'],_0x41d51d['user'][_0xf55e('0x3b')],_0x41d51d[_0xf55e('0x65')][_0xf55e('0x66')],_0x436622['interaction']['id'],_0x41d51d['body']?JSON[_0xf55e('0x67')](_0x41d51d[_0xf55e('0x58')]):_0xf55e('0x68'));return respondWithRpcPromise(_0xf55e('0x7e'),_0xf55e('0x7f'),_0x436622);}return null;})[_0xf55e('0x23')](function(_0x4f347d){var _0x33e734=_0xf55e('0x6b')+_0x4f347d[_0xf55e('0x2b')]['ContactId'];return db['sequelize'][_0xf55e('0x41')](_0x33e734,{'type':db[_0xf55e('0x6e')][_0xf55e('0x80')]['SELECT'],'raw':!![]})[_0xf55e('0x23')](function(_0x135c1c){return _0x135c1c;});})[_0xf55e('0x23')](function(_0x16cc30){if(_0x16cc30){_0x436622[_0xf55e('0x2b')][_0xf55e('0x70')]=_0x16cc30[0x0];if(!_0x41d51d[_0xf55e('0x58')][_0xf55e('0x5e')])return;return db[_0xf55e('0x71')][_0xf55e('0x56')]({'where':{'id':_0x41d51d[_0xf55e('0x58')][_0xf55e('0x5e')],'role':_0xf55e('0x5f')},'attributes':['id',_0xf55e('0x3b'),'fullname',_0xf55e('0x73'),_0xf55e('0x74')],'raw':!![]});}return null;})[_0xf55e('0x23')](function(_0x48642b){if(!_0x48642b)return null;_0x436622[_0xf55e('0x2b')][_0xf55e('0x5f')]=_0x48642b;return _0x436622;})['then'](function(_0x24ae1c){if(_0x24ae1c){_0x24ae1c[_0xf55e('0x2b')][_0xf55e('0x81')]=util[_0xf55e('0x5c')]('SIP/%s',_0x41d51d['user'][_0xf55e('0x3b')]);_0x24ae1c[_0xf55e('0x2b')][_0xf55e('0x75')]=_0x436622[_0xf55e('0x75')];_0x24ae1c['message'][_0xf55e('0x76')]=_0x436622[_0xf55e('0x75')];_0x24ae1c['message'][_0xf55e('0x77')]=_0xf55e('0x7c');respondWithRpcPromise(_0xf55e('0x78'),_0xf55e('0x78'),{'event':_0xf55e('0x82'),'message':_[_0xf55e('0x4f')](_0x436622[_0xf55e('0x2b')],JSON[_0xf55e('0x7a')](_0x436622[_0xf55e('0x64')][_0xf55e('0x7b')]))},client9002);return _0x436622;}return null;})[_0xf55e('0x23')](respondWithResult(_0x7318c9,null))[_0xf55e('0x2d')](handleError(_0x7318c9,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index c3ec14e..5bf5c55 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 _0xc4bf=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','ChatMessage'];(function(_0x55eb7b,_0x594af1){var _0xaaa521=function(_0x43dc41){while(--_0x43dc41){_0x55eb7b['push'](_0x55eb7b['shift']());}};_0xaaa521(++_0x594af1);}(_0xc4bf,0x142));var _0xfc4b=function(_0x4ab78f,_0x1cbc7f){_0x4ab78f=_0x4ab78f-0x0;var _0x5f1de1=_0xc4bf[_0x4ab78f];return _0x5f1de1;};'use strict';var EventEmitter=require(_0xfc4b('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xfc4b('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xfc4b('0x2')](0x0);var events={'afterCreate':_0xfc4b('0x3'),'afterUpdate':_0xfc4b('0x4'),'afterDestroy':_0xfc4b('0x5')};function emitEvent(_0x180352){return function(_0x570de4,_0x8b8988,_0x3a1498){ChatMessageEvents[_0xfc4b('0x6')](_0x180352+':'+_0x570de4['id'],_0x570de4);ChatMessageEvents[_0xfc4b('0x6')](_0x180352,_0x570de4);_0x3a1498(null);};}for(var e in events){if(events[_0xfc4b('0x7')](e)){var event=events[e];ChatMessage[_0xfc4b('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x8caf=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','save'];(function(_0x1b767d,_0x3a5b43){var _0x1105d1=function(_0x390bd7){while(--_0x390bd7){_0x1b767d['push'](_0x1b767d['shift']());}};_0x1105d1(++_0x3a5b43);}(_0x8caf,0xba));var _0xf8ca=function(_0x464251,_0x41951f){_0x464251=_0x464251-0x0;var _0x47b041=_0x8caf[_0x464251];return _0x47b041;};'use strict';var EventEmitter=require(_0xf8ca('0x0'));var ChatMessage=require(_0xf8ca('0x1'))['db'][_0xf8ca('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8ca('0x3'),'afterUpdate':_0xf8ca('0x4'),'afterDestroy':_0xf8ca('0x5')};function emitEvent(_0x29c085){return function(_0x58c33c,_0x249ac4,_0x556418){ChatMessageEvents[_0xf8ca('0x6')](_0x29c085+':'+_0x58c33c['id'],_0x58c33c);ChatMessageEvents[_0xf8ca('0x6')](_0x29c085,_0x58c33c);_0x556418(null);};}for(var e in events){if(events[_0xf8ca('0x7')](e)){var event=events[e];ChatMessage[_0xf8ca('0x8')](e,emitEvent(event));}}module[_0xf8ca('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 3fbd726..f551758 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 _0xd53c=['fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteractionId','then','update','catch','error','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','ChatMessage'];(function(_0x22f8fa,_0x476ee6){var _0x32ff99=function(_0x986049){while(--_0x986049){_0x22f8fa['push'](_0x22f8fa['shift']());}};_0x32ff99(++_0x476ee6);}(_0xd53c,0x6f));var _0xcd53=function(_0xe47185,_0x269cb7){_0xe47185=_0xe47185-0x0;var _0x1362a9=_0xd53c[_0xe47185];return _0x1362a9;};'use strict';var _=require('lodash');var util=require(_0xcd53('0x0'));var logger=require(_0xcd53('0x1'))(_0xcd53('0x2'));var moment=require(_0xcd53('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd53('0x4'));var rimraf=require(_0xcd53('0x5'));var config=require(_0xcd53('0x6'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x132c6b,_0x273e4b){return _0x132c6b[_0xcd53('0x7')](_0xcd53('0x8'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xcd53('0x9'),'fields':[_0xcd53('0xa')],'type':_0xcd53('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31fc45,_0x5084f2,_0x16e901){var _0xc62f53=_0x132c6b[_0xcd53('0xc')];var _0x56d9d5=_0x31fc45[_0xcd53('0xd')]({'plain':!![]});if(_0x56d9d5[_0xcd53('0xe')][_0xcd53('0xf')]()==='in'||_0x56d9d5[_0xcd53('0xe')][_0xcd53('0xf')]()===_0xcd53('0x10')&&!_0x56d9d5[_0xcd53('0x11')]&&!_['isNil'](_0x56d9d5[_0xcd53('0x12')])){_0xc62f53['ChatInteraction']['findOne']({'where':{'id':_0x56d9d5[_0xcd53('0x13')]}})[_0xcd53('0x14')](function(_0x38f2c6){if(_0x38f2c6){_0x38f2c6[_0xcd53('0x15')]({'lastMsgAt':_0x56d9d5['createdAt'],'lastMsgDirection':_0x56d9d5[_0xcd53('0xe')][_0xcd53('0xf')]()});}})[_0xcd53('0x16')](function(_0x3c016f){console[_0xcd53('0x17')](_0x3c016f);});}_0x16e901();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8c1a=['bluebird','request-promise','path','./chatMessage.attributes','ChatMessage','chat_messages','fti_chat_messages','body','get','direction','toLowerCase','out','UserId','ChatInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8c1a,0x1ad));var _0xa8c1=function(_0x17730a,_0x362127){_0x17730a=_0x17730a-0x0;var _0x485db1=_0x8c1a[_0x17730a];return _0x485db1;};'use strict';var _=require(_0xa8c1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa8c1('0x1'));var moment=require(_0xa8c1('0x2'));var BPromise=require(_0xa8c1('0x3'));var rp=require(_0xa8c1('0x4'));var fs=require('fs');var path=require(_0xa8c1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa8c1('0x6'));module['exports']=function(_0x396c2e,_0x3d8943){return _0x396c2e['define'](_0xa8c1('0x7'),attributes,{'tableName':_0xa8c1('0x8'),'paranoid':![],'indexes':[{'name':_0xa8c1('0x9'),'fields':[_0xa8c1('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4892ab,_0xad239a,_0x305cd2){var _0x451e9e=_0x396c2e['models'];var _0x5db77e=_0x4892ab[_0xa8c1('0xb')]({'plain':!![]});if(_0x5db77e[_0xa8c1('0xc')][_0xa8c1('0xd')]()==='in'||_0x5db77e[_0xa8c1('0xc')][_0xa8c1('0xd')]()===_0xa8c1('0xe')&&!_0x5db77e['secret']&&!_['isNil'](_0x5db77e[_0xa8c1('0xf')])){_0x451e9e[_0xa8c1('0x10')][_0xa8c1('0x11')]({'where':{'id':_0x5db77e['ChatInteractionId']}})['then'](function(_0x5bc4a1){if(_0x5bc4a1){_0x5bc4a1[_0xa8c1('0x12')]({'lastMsgAt':_0x5db77e[_0xa8c1('0x13')],'lastMsgDirection':_0x5db77e[_0xa8c1('0xc')][_0xa8c1('0xd')]()});}})[_0xa8c1('0x14')](function(_0x105dc5){console[_0xa8c1('0x15')](_0x105dc5);});}_0x305cd2();}},'charset':_0xa8c1('0x16'),'collate':_0xa8c1('0x17')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index dab253e..f7f944f 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 _0x097f=['options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','CreateChatMessage','ChatMessage','create','body'];(function(_0x331472,_0xb37851){var _0x269859=function(_0x49686d){while(--_0x49686d){_0x331472['push'](_0x331472['shift']());}};_0x269859(++_0xb37851);}(_0x097f,0xa7));var _0xf097=function(_0x5982a5,_0x3dc07b){_0x5982a5=_0x5982a5-0x0;var _0x159c80=_0x097f[_0x5982a5];return _0x159c80;};'use strict';var _=require('lodash');var util=require(_0xf097('0x0'));var moment=require(_0xf097('0x1'));var BPromise=require('bluebird');var rs=require(_0xf097('0x2'));var fs=require('fs');var Redis=require(_0xf097('0x3'));var db=require(_0xf097('0x4'))['db'];var utils=require(_0xf097('0x5'));var logger=require(_0xf097('0x6'))(_0xf097('0x7'));var config=require('../../config/environment');var jayson=require(_0xf097('0x8'));var client=jayson['client'][_0xf097('0x9')]({'port':0x232a});config[_0xf097('0xa')]=_[_0xf097('0xb')](config[_0xf097('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf097('0xc'))(new Redis(config[_0xf097('0xa')]));require('./chatMessage.socket')[_0xf097('0xd')](socket);function respondWithRpcPromise(_0x42bcb8,_0x48ed88,_0x33f6a0){return new BPromise(function(_0x2deaab,_0x329cca){return client[_0xf097('0xe')](_0x42bcb8,_0x33f6a0)[_0xf097('0xf')](function(_0x25dbbc){logger[_0xf097('0x10')]('ChatMessage,\x20%s,\x20%s',_0x48ed88,_0xf097('0x11'));logger[_0xf097('0x12')](_0xf097('0x13'),_0x48ed88,_0xf097('0x11'),JSON[_0xf097('0x14')](_0x25dbbc));if(_0x25dbbc[_0xf097('0x15')]){if(_0x25dbbc['error'][_0xf097('0x16')]===0x1f4){logger[_0xf097('0x15')]('ChatMessage,\x20%s,\x20%s',_0x48ed88,_0x25dbbc[_0xf097('0x15')][_0xf097('0x17')]);return _0x329cca(_0x25dbbc[_0xf097('0x15')]['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x48ed88,_0x25dbbc[_0xf097('0x15')]['message']);return _0x2deaab(_0x25dbbc[_0xf097('0x15')]['message']);}else{logger['info'](_0xf097('0x18'),_0x48ed88,_0xf097('0x11'));_0x2deaab(_0x25dbbc[_0xf097('0x19')][_0xf097('0x17')]);}})[_0xf097('0x1a')](function(_0x5df2db){logger['error'](_0xf097('0x18'),_0x48ed88,_0x5df2db);_0x329cca(_0x5df2db);});});}exports[_0xf097('0x1b')]=function(_0x359c1d){var _0x2f1b02=this;return new Promise(function(_0x317290,_0x519699){return db[_0xf097('0x1c')][_0xf097('0x1d')](_0x359c1d[_0xf097('0x1e')],{'raw':_0x359c1d['options']?_0x359c1d[_0xf097('0x1f')][_0xf097('0x20')]===undefined?!![]:![]:!![]})[_0xf097('0xf')](function(_0xa23320){logger[_0xf097('0x10')]('CreateChatMessage',_0x359c1d);logger[_0xf097('0x12')](_0xf097('0x1b'),_0x359c1d,JSON[_0xf097('0x14')](_0xa23320));_0x317290(_0xa23320);})[_0xf097('0x1a')](function(_0x13d9bb){logger['error'](_0xf097('0x1b'),_0x13d9bb[_0xf097('0x17')],_0x359c1d);_0x519699(_0x2f1b02[_0xf097('0x15')](0x1f4,_0x13d9bb['message']));});});}; \ No newline at end of file +var _0x8c9c=['catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateChatMessage','ChatMessage','create','body','options','debug'];(function(_0x51ee07,_0x552e5c){var _0x30de31=function(_0x31d744){while(--_0x31d744){_0x51ee07['push'](_0x51ee07['shift']());}};_0x30de31(++_0x552e5c);}(_0x8c9c,0xf9));var _0xc8c9=function(_0x38ed84,_0x31718d){_0x38ed84=_0x38ed84-0x0;var _0x4bb181=_0x8c9c[_0x38ed84];return _0x4bb181;};'use strict';var _=require(_0xc8c9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc8c9('0x1'));var fs=require('fs');var Redis=require(_0xc8c9('0x2'));var db=require(_0xc8c9('0x3'))['db'];var utils=require(_0xc8c9('0x4'));var logger=require('../../config/logger')(_0xc8c9('0x5'));var config=require(_0xc8c9('0x6'));var jayson=require(_0xc8c9('0x7'));var client=jayson['client'][_0xc8c9('0x8')]({'port':0x232a});config[_0xc8c9('0x9')]=_[_0xc8c9('0xa')](config['redis'],{'host':_0xc8c9('0xb'),'port':0x18eb});var socket=require(_0xc8c9('0xc'))(new Redis(config[_0xc8c9('0x9')]));require(_0xc8c9('0xd'))[_0xc8c9('0xe')](socket);function respondWithRpcPromise(_0x2a1d66,_0x2fd9f1,_0x7de14a){return new BPromise(function(_0x31f530,_0x15d6bc){return client['request'](_0x2a1d66,_0x7de14a)[_0xc8c9('0xf')](function(_0x15988c){logger[_0xc8c9('0x10')](_0xc8c9('0x11'),_0x2fd9f1,_0xc8c9('0x12'));logger['debug'](_0xc8c9('0x13'),_0x2fd9f1,'request\x20sent',JSON[_0xc8c9('0x14')](_0x15988c));if(_0x15988c[_0xc8c9('0x15')]){if(_0x15988c[_0xc8c9('0x15')]['code']===0x1f4){logger['error'](_0xc8c9('0x11'),_0x2fd9f1,_0x15988c['error'][_0xc8c9('0x16')]);return _0x15d6bc(_0x15988c[_0xc8c9('0x15')][_0xc8c9('0x16')]);}logger['error'](_0xc8c9('0x11'),_0x2fd9f1,_0x15988c['error'][_0xc8c9('0x16')]);return _0x31f530(_0x15988c[_0xc8c9('0x15')][_0xc8c9('0x16')]);}else{logger[_0xc8c9('0x10')](_0xc8c9('0x11'),_0x2fd9f1,_0xc8c9('0x12'));_0x31f530(_0x15988c[_0xc8c9('0x17')][_0xc8c9('0x16')]);}})['catch'](function(_0x4c96e7){logger[_0xc8c9('0x15')](_0xc8c9('0x11'),_0x2fd9f1,_0x4c96e7);_0x15d6bc(_0x4c96e7);});});}exports[_0xc8c9('0x18')]=function(_0xbe10c5){var _0x2c45a6=this;return new Promise(function(_0x22d5fa,_0xbd65e7){return db[_0xc8c9('0x19')][_0xc8c9('0x1a')](_0xbe10c5[_0xc8c9('0x1b')],{'raw':_0xbe10c5[_0xc8c9('0x1c')]?_0xbe10c5[_0xc8c9('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc8c9('0xf')](function(_0xc7d63b){logger[_0xc8c9('0x10')](_0xc8c9('0x18'),_0xbe10c5);logger[_0xc8c9('0x1d')](_0xc8c9('0x18'),_0xbe10c5,JSON[_0xc8c9('0x14')](_0xc7d63b));_0x22d5fa(_0xc7d63b);})[_0xc8c9('0x1e')](function(_0x253f20){logger[_0xc8c9('0x15')](_0xc8c9('0x18'),_0x253f20['message'],_0xbe10c5);_0xbd65e7(_0x2c45a6['error'](0x1f4,_0x253f20[_0xc8c9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 5d9edcf..8d4db73 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 _0x0763=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x28998f,_0x5c94a5){var _0x379f73=function(_0x4357e9){while(--_0x4357e9){_0x28998f['push'](_0x28998f['shift']());}};_0x379f73(++_0x5c94a5);}(_0x0763,0x87));var _0x3076=function(_0x4fa97c,_0x4aa6ab){_0x4fa97c=_0x4fa97c-0x0;var _0x518c7f=_0x0763[_0x4fa97c];return _0x518c7f;};'use strict';var ChatMessageEvents=require(_0x3076('0x0'));var events=['save',_0x3076('0x1'),_0x3076('0x2')];function createListener(_0x5d64db,_0x37d1cf){return function(_0xa646e7){_0x37d1cf[_0x3076('0x3')](_0x5d64db,_0xa646e7);};}function removeListener(_0xecc289,_0x55bd44){return function(){ChatMessageEvents[_0x3076('0x4')](_0xecc289,_0x55bd44);};}exports[_0x3076('0x5')]=function(_0x1ce2ff){for(var _0x1b5f4e=0x0,_0x18b4c8=events[_0x3076('0x6')];_0x1b5f4e<_0x18b4c8;_0x1b5f4e++){var _0x2776c8=events[_0x1b5f4e];var _0xf1ee41=createListener(_0x3076('0x7')+_0x2776c8,_0x1ce2ff);ChatMessageEvents['on'](_0x2776c8,_0xf1ee41);}}; \ No newline at end of file +var _0x3d6d=['update','emit','removeListener','length','./chatMessage.events','save','remove'];(function(_0x4d21b0,_0x54f2d1){var _0x3f1f1c=function(_0x2f31b4){while(--_0x2f31b4){_0x4d21b0['push'](_0x4d21b0['shift']());}};_0x3f1f1c(++_0x54f2d1);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x3d6d[_0x1e6db3];return _0x1de886;};'use strict';var ChatMessageEvents=require(_0xd3d6('0x0'));var events=[_0xd3d6('0x1'),_0xd3d6('0x2'),_0xd3d6('0x3')];function createListener(_0x380c09,_0x1e1915){return function(_0x366f41){_0x1e1915[_0xd3d6('0x4')](_0x380c09,_0x366f41);};}function removeListener(_0x297bd6,_0x3d5e37){return function(){ChatMessageEvents[_0xd3d6('0x5')](_0x297bd6,_0x3d5e37);};}exports['register']=function(_0x5400f8){for(var _0x3f36=0x0,_0x1f02f5=events[_0xd3d6('0x6')];_0x3f36<_0x1f02f5;_0x3f36++){var _0x3c2a9b=events[_0x3f36];var _0x4356b7=createListener('chatMessage:'+_0x3c2a9b,_0x5400f8);ChatMessageEvents['on'](_0x3c2a9b,_0x4356b7);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 9b8fdaa..e4501b6 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 _0x6879=['connect-timeout','Router','fs-extra','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','multer','util','path'];(function(_0x466507,_0x409da7){var _0x3839e5=function(_0x25e44c){while(--_0x25e44c){_0x466507['push'](_0x466507['shift']());}};_0x3839e5(++_0x409da7);}(_0x6879,0x156));var _0x9687=function(_0x326fc6,_0x1af9c4){_0x326fc6=_0x326fc6-0x0;var _0x419b67=_0x6879[_0x326fc6];return _0x419b67;};'use strict';var multer=require(_0x9687('0x0'));var util=require(_0x9687('0x1'));var path=require(_0x9687('0x2'));var timeout=require(_0x9687('0x3'));var express=require('express');var router=express[_0x9687('0x4')]();var fs_extra=require(_0x9687('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9687('0x6'));var config=require('../../config/environment');var controller=require(_0x9687('0x7'));router[_0x9687('0x8')]('/',auth[_0x9687('0x9')](),controller[_0x9687('0xa')]);router['get']('/describe',auth[_0x9687('0x9')](),controller[_0x9687('0xb')]);router['get'](_0x9687('0xc'),auth[_0x9687('0x9')](),controller[_0x9687('0xd')]);router[_0x9687('0xe')]('/',auth[_0x9687('0x9')](),interaction['tracked'](_0x9687('0xf'),_0x9687('0x10')),controller['create']);router[_0x9687('0x11')](_0x9687('0xc'),controller[_0x9687('0x12')]);router['put'](_0x9687('0x13'),auth[_0x9687('0x9')](),controller[_0x9687('0x14')]);router[_0x9687('0x11')](_0x9687('0x15'),auth[_0x9687('0x9')](),controller['reject']);router[_0x9687('0x16')](_0x9687('0xc'),auth[_0x9687('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe5b4=['put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','/:id','show','chat','chatmessage:create','create'];(function(_0xb73009,_0x4b206f){var _0x272a63=function(_0x2109b2){while(--_0x2109b2){_0xb73009['push'](_0xb73009['shift']());}};_0x272a63(++_0x4b206f);}(_0xe5b4,0x117));var _0x4e5b=function(_0x535815,_0x1771a9){_0x535815=_0x535815-0x0;var _0x2e27e3=_0xe5b4[_0x535815];return _0x2e27e3;};'use strict';var multer=require('multer');var util=require(_0x4e5b('0x0'));var path=require(_0x4e5b('0x1'));var timeout=require(_0x4e5b('0x2'));var express=require('express');var router=express[_0x4e5b('0x3')]();var fs_extra=require(_0x4e5b('0x4'));var auth=require(_0x4e5b('0x5'));var interaction=require(_0x4e5b('0x6'));var config=require(_0x4e5b('0x7'));var controller=require(_0x4e5b('0x8'));router['get']('/',auth[_0x4e5b('0x9')](),controller[_0x4e5b('0xa')]);router[_0x4e5b('0xb')](_0x4e5b('0xc'),auth[_0x4e5b('0x9')](),controller['describe']);router[_0x4e5b('0xb')](_0x4e5b('0xd'),auth[_0x4e5b('0x9')](),controller[_0x4e5b('0xe')]);router['post']('/',auth[_0x4e5b('0x9')](),interaction['tracked'](_0x4e5b('0xf'),_0x4e5b('0x10')),controller[_0x4e5b('0x11')]);router[_0x4e5b('0x12')]('/:id',controller[_0x4e5b('0x13')]);router['put'](_0x4e5b('0x14'),auth[_0x4e5b('0x9')](),controller[_0x4e5b('0x15')]);router[_0x4e5b('0x12')](_0x4e5b('0x16'),auth['isAuthenticated'](),controller[_0x4e5b('0x17')]);router[_0x4e5b('0x18')]('/:id',auth[_0x4e5b('0x9')](),controller[_0x4e5b('0x19')]);module[_0x4e5b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 736c136..51fcf75 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['medium','TEXT','exports'];(function(_0x57f2ea,_0x2b285c){var _0x377044=function(_0x4e05d5){while(--_0x4e05d5){_0x57f2ea['push'](_0x57f2ea['shift']());}};_0x377044(++_0x2b285c);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x59ac19,_0x4fd450){var _0xe0daaa=function(_0xd6215e){while(--_0xd6215e){_0x59ac19['push'](_0x59ac19['shift']());}};_0xe0daaa(++_0x4fd450);}(_0x5f2f,0x73));var _0xf5f2=function(_0x44d909,_0x37a80c){_0x44d909=_0x44d909-0x0;var _0x44bd83=_0x5f2f[_0x44d909];return _0x44bd83;};'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 9bc5372..3fd7cdb 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(_0xa973e3,_0x48cb90){var _0x3923bf=function(_0x15bf25){while(--_0x15bf25){_0xa973e3['push'](_0xa973e3['shift']());}};_0x3923bf(++_0x48cb90);}(_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){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7a54,0x106));var _0x47a5=function(_0x28e5a2,_0x457386){_0x28e5a2=_0x28e5a2-0x0;var _0x49d0bc=_0x7a54[_0x28e5a2];return _0x49d0bc;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 515e298..bfc1124 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 _0x3832=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit'];(function(_0x5760ce,_0x36e4a3){var _0xd87900=function(_0x33b3bb){while(--_0x33b3bb){_0x5760ce['push'](_0x5760ce['shift']());}};_0xd87900(++_0x36e4a3);}(_0x3832,0x9d));var _0x2383=function(_0x1da5f4,_0x44bca7){_0x1da5f4=_0x1da5f4-0x0;var _0x58e944=_0x3832[_0x1da5f4];return _0x58e944;};'use strict';var EventEmitter=require(_0x2383('0x0'));var ChatOfflineMessage=require(_0x2383('0x1'))['db'][_0x2383('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x2383('0x3')](0x0);var events={'afterCreate':_0x2383('0x4'),'afterUpdate':_0x2383('0x5'),'afterDestroy':_0x2383('0x6')};function emitEvent(_0x1c1931){return function(_0x543b67,_0x394167,_0x1557f1){ChatOfflineMessageEvents[_0x2383('0x7')](_0x1c1931+':'+_0x543b67['id'],_0x543b67);ChatOfflineMessageEvents['emit'](_0x1c1931,_0x543b67);_0x1557f1(null);};}for(var e in events){if(events[_0x2383('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x2383('0x9')](e,emitEvent(event));}}module[_0x2383('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x170a=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','save','remove','emit'];(function(_0x2e26b9,_0x213fca){var _0x24beb8=function(_0x402479){while(--_0x402479){_0x2e26b9['push'](_0x2e26b9['shift']());}};_0x24beb8(++_0x213fca);}(_0x170a,0xed));var _0xa170=function(_0x4cef91,_0x16b251){_0x4cef91=_0x4cef91-0x0;var _0x3fe1f6=_0x170a[_0x4cef91];return _0x3fe1f6;};'use strict';var EventEmitter=require(_0xa170('0x0'));var ChatOfflineMessage=require(_0xa170('0x1'))['db'][_0xa170('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa170('0x3'),'afterUpdate':'update','afterDestroy':_0xa170('0x4')};function emitEvent(_0x494b60){return function(_0x2ba277,_0x18866d,_0x1cf4b5){ChatOfflineMessageEvents[_0xa170('0x5')](_0x494b60+':'+_0x2ba277['id'],_0x2ba277);ChatOfflineMessageEvents[_0xa170('0x5')](_0x494b60,_0x2ba277);_0x1cf4b5(null);};}for(var e in events){if(events[_0xa170('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xa170('0x7')](e,emitEvent(event));}}module[_0xa170('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index e24a304..f1d1041 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 _0x2dd4=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports','define'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x2dd4,0xd5));var _0x42dd=function(_0xb41a97,_0x524de2){_0xb41a97=_0xb41a97-0x0;var _0x457704=_0x2dd4[_0xb41a97];return _0x457704;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x42dd('0x0')]=function(_0x1d56b7){return _0x1d56b7[_0x42dd('0x1')]('ChatOfflineMessage',attributes,{'tableName':_0x42dd('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x42dd('0x3'),'collate':_0x42dd('0x4')});}; \ No newline at end of file +var _0x2787=['define','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x22d7f1,_0x1a3cab){var _0x4da1e0=function(_0x5a2392){while(--_0x5a2392){_0x22d7f1['push'](_0x22d7f1['shift']());}};_0x4da1e0(++_0x1a3cab);}(_0x2787,0xdf));var _0x7278=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2787[_0x17d9e3];return _0x14192d;};'use strict';var attributes=require(_0x7278('0x0'));module[_0x7278('0x1')]=function(_0x21a0ce){return _0x21a0ce[_0x7278('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x7278('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7278('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e17076c..033a086 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 _0x397b=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatOfflineMessage,\x20%s,\x20%s','lodash'];(function(_0x3a2512,_0x3e2a93){var _0x511664=function(_0x4f6f44){while(--_0x4f6f44){_0x3a2512['push'](_0x3a2512['shift']());}};_0x511664(++_0x3e2a93);}(_0x397b,0x168));var _0xb397=function(_0x5caec4,_0x4a0749){_0x5caec4=_0x5caec4-0x0;var _0x480bb6=_0x397b[_0x5caec4];return _0x480bb6;};'use strict';var _=require(_0xb397('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb397('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb397('0x2'))['db'];var utils=require(_0xb397('0x3'));var logger=require(_0xb397('0x4'))(_0xb397('0x5'));var config=require('../../config/environment');var jayson=require(_0xb397('0x6'));var client=jayson[_0xb397('0x7')][_0xb397('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f2006,_0x70e395,_0x34f19e){return new BPromise(function(_0x110724,_0x38653f){return client[_0xb397('0x9')](_0x5f2006,_0x34f19e)[_0xb397('0xa')](function(_0x4e5dd2){logger[_0xb397('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x70e395,_0xb397('0xc'));logger[_0xb397('0xd')](_0xb397('0xe'),_0x70e395,'request\x20sent',JSON[_0xb397('0xf')](_0x4e5dd2));if(_0x4e5dd2['error']){if(_0x4e5dd2[_0xb397('0x10')]['code']===0x1f4){logger[_0xb397('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x70e395,_0x4e5dd2[_0xb397('0x10')][_0xb397('0x11')]);return _0x38653f(_0x4e5dd2[_0xb397('0x10')][_0xb397('0x11')]);}logger[_0xb397('0x10')](_0xb397('0x12'),_0x70e395,_0x4e5dd2[_0xb397('0x10')][_0xb397('0x11')]);return _0x110724(_0x4e5dd2[_0xb397('0x10')][_0xb397('0x11')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x70e395,_0xb397('0xc'));_0x110724(_0x4e5dd2['result'][_0xb397('0x11')]);}})['catch'](function(_0x494397){logger[_0xb397('0x10')](_0xb397('0x12'),_0x70e395,_0x494397);_0x38653f(_0x494397);});});} \ No newline at end of file +var _0x0f9a=['client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3fa874,_0x5a725e){var _0xd5649b=function(_0x2e5540){while(--_0x2e5540){_0x3fa874['push'](_0x3fa874['shift']());}};_0xd5649b(++_0x5a725e);}(_0x0f9a,0x174));var _0xa0f9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x0f9a[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xa0f9('0x0'));var util=require(_0xa0f9('0x1'));var moment=require(_0xa0f9('0x2'));var BPromise=require(_0xa0f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa0f9('0x5'))('rpc');var config=require(_0xa0f9('0x6'));var jayson=require(_0xa0f9('0x7'));var client=jayson[_0xa0f9('0x8')][_0xa0f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34a8f3,_0x167785,_0xbea873){return new BPromise(function(_0x4d7b7d,_0x52cd2f){return client[_0xa0f9('0xa')](_0x34a8f3,_0xbea873)['then'](function(_0x7b205f){logger[_0xa0f9('0xb')](_0xa0f9('0xc'),_0x167785,_0xa0f9('0xd'));logger[_0xa0f9('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x167785,'request\x20sent',JSON[_0xa0f9('0xf')](_0x7b205f));if(_0x7b205f[_0xa0f9('0x10')]){if(_0x7b205f['error'][_0xa0f9('0x11')]===0x1f4){logger[_0xa0f9('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x167785,_0x7b205f[_0xa0f9('0x10')][_0xa0f9('0x12')]);return _0x52cd2f(_0x7b205f[_0xa0f9('0x10')][_0xa0f9('0x12')]);}logger['error'](_0xa0f9('0xc'),_0x167785,_0x7b205f[_0xa0f9('0x10')]['message']);return _0x4d7b7d(_0x7b205f[_0xa0f9('0x10')][_0xa0f9('0x12')]);}else{logger[_0xa0f9('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x167785,_0xa0f9('0xd'));_0x4d7b7d(_0x7b205f[_0xa0f9('0x13')][_0xa0f9('0x12')]);}})['catch'](function(_0x5c22b3){logger[_0xa0f9('0x10')](_0xa0f9('0xc'),_0x167785,_0x5c22b3);_0x52cd2f(_0x5c22b3);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 83b2392..f3dc138 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 _0x4d88=['./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x279964,_0x3bc99e){var _0x21e9a7=function(_0x4db47d){while(--_0x4db47d){_0x279964['push'](_0x279964['shift']());}};_0x21e9a7(++_0x3bc99e);}(_0x4d88,0x15c));var _0x84d8=function(_0xeca7c9,_0x24f347){_0xeca7c9=_0xeca7c9-0x0;var _0x28f169=_0x4d88[_0xeca7c9];return _0x28f169;};'use strict';var multer=require('multer');var util=require(_0x84d8('0x0'));var path=require(_0x84d8('0x1'));var timeout=require(_0x84d8('0x2'));var express=require(_0x84d8('0x3'));var router=express[_0x84d8('0x4')]();var fs_extra=require(_0x84d8('0x5'));var auth=require(_0x84d8('0x6'));var interaction=require(_0x84d8('0x7'));var config=require(_0x84d8('0x8'));var controller=require(_0x84d8('0x9'));router['get']('/',auth[_0x84d8('0xa')](),controller['index']);router[_0x84d8('0xb')](_0x84d8('0xc'),auth['isAuthenticated'](),controller[_0x84d8('0xd')]);router[_0x84d8('0xb')](_0x84d8('0xe'),auth[_0x84d8('0xa')](),controller[_0x84d8('0xf')]);router['post']('/',auth[_0x84d8('0xa')](),controller[_0x84d8('0x10')]);router[_0x84d8('0x11')](_0x84d8('0xe'),auth[_0x84d8('0xa')](),controller[_0x84d8('0x12')]);router[_0x84d8('0x13')](_0x84d8('0xe'),auth['isAuthenticated'](),controller[_0x84d8('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2296=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get'];(function(_0x3ddd5a,_0x5dd179){var _0x4434a7=function(_0x3a0e99){while(--_0x3a0e99){_0x3ddd5a['push'](_0x3ddd5a['shift']());}};_0x4434a7(++_0x5dd179);}(_0x2296,0xfa));var _0x6229=function(_0x31d97d,_0x636901){_0x31d97d=_0x31d97d-0x0;var _0x15f7db=_0x2296[_0x31d97d];return _0x15f7db;};'use strict';var multer=require(_0x6229('0x0'));var util=require(_0x6229('0x1'));var path=require('path');var timeout=require(_0x6229('0x2'));var express=require('express');var router=express[_0x6229('0x3')]();var fs_extra=require(_0x6229('0x4'));var auth=require(_0x6229('0x5'));var interaction=require(_0x6229('0x6'));var config=require(_0x6229('0x7'));var controller=require(_0x6229('0x8'));router[_0x6229('0x9')]('/',auth[_0x6229('0xa')](),controller[_0x6229('0xb')]);router[_0x6229('0x9')]('/describe',auth[_0x6229('0xa')](),controller['describe']);router[_0x6229('0x9')](_0x6229('0xc'),auth['isAuthenticated'](),controller[_0x6229('0xd')]);router[_0x6229('0xe')]('/',auth[_0x6229('0xa')](),controller[_0x6229('0xf')]);router[_0x6229('0x10')](_0x6229('0xc'),auth[_0x6229('0xa')](),controller[_0x6229('0x11')]);router[_0x6229('0x12')](_0x6229('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x6229('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 096266b..d87a42b 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 _0x7d5c=['sequelize','exports','STRING','ENUM','timeout','mouseOver','INTEGER'];(function(_0x1eb164,_0x392952){var _0x326aa9=function(_0x440cd3){while(--_0x440cd3){_0x1eb164['push'](_0x1eb164['shift']());}};_0x326aa9(++_0x392952);}(_0x7d5c,0x126));var _0xc7d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d5c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc7d5('0x0'));module[_0xc7d5('0x1')]={'name':{'type':Sequelize[_0xc7d5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc7d5('0x3')]('mouseOver',_0xc7d5('0x4')),'defaultValue':_0xc7d5('0x5')},'selector':{'type':Sequelize[_0xc7d5('0x2')]},'timeout':{'type':Sequelize[_0xc7d5('0x6')]}}; \ No newline at end of file +var _0x31f5=['mouseOver','INTEGER','sequelize','ENUM','timeout'];(function(_0x1a1bd2,_0x1f07e4){var _0x2fabdc=function(_0x50c293){while(--_0x50c293){_0x1a1bd2['push'](_0x1a1bd2['shift']());}};_0x2fabdc(++_0x1f07e4);}(_0x31f5,0x151));var _0x531f=function(_0x3f7f93,_0x252411){_0x3f7f93=_0x3f7f93-0x0;var _0x5a512f=_0x31f5[_0x3f7f93];return _0x5a512f;};'use strict';var Sequelize=require(_0x531f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x531f('0x1')]('mouseOver',_0x531f('0x2')),'defaultValue':_0x531f('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x531f('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2f89737..82331a4 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 _0x864a=['set','Content-Range','reject','update','then','destroy','stack','name','send','model','ChatProactiveAction','rawAttributes','keys','query','filters','attributes','intersection','fields','length','includeAll','options','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x864a,0x8a));var _0xa864=function(_0x58d82e,_0x5459fa){_0x58d82e=_0x58d82e-0x0;var _0xfdc332=_0x864a[_0x58d82e];return _0xfdc332;};'use strict';var emlformat=require(_0xa864('0x0'));var rimraf=require(_0xa864('0x1'));var zipdir=require(_0xa864('0x2'));var jsonpatch=require(_0xa864('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa864('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa864('0x5'));var csv=require(_0xa864('0x6'));var ejs=require(_0xa864('0x7'));var fs=require('fs');var fs_extra=require(_0xa864('0x8'));var _=require(_0xa864('0x9'));var squel=require('squel');var crypto=require(_0xa864('0xa'));var jsforce=require(_0xa864('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa864('0x6'));var querystring=require(_0xa864('0xc'));var Papa=require(_0xa864('0xd'));var Redis=require(_0xa864('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa864('0xf'));var hardwareService=require(_0xa864('0x10'));var logger=require(_0xa864('0x11'))(_0xa864('0x12'));var utils=require(_0xa864('0x13'));var config=require(_0xa864('0x14'));var licenseUtil=require(_0xa864('0x15'));var db=require(_0xa864('0x16'))['db'];function respondWithStatusCode(_0x44a6b7,_0x1c4242){_0x1c4242=_0x1c4242||0xcc;return function(_0x5f3cc2){if(_0x5f3cc2){return _0x44a6b7[_0xa864('0x17')](_0x1c4242);}return _0x44a6b7[_0xa864('0x18')](_0x1c4242)['end']();};}function respondWithResult(_0x9e3d5a,_0x6e0430){_0x6e0430=_0x6e0430||0xc8;return function(_0x2d82d1){if(_0x2d82d1){return _0x9e3d5a[_0xa864('0x18')](_0x6e0430)[_0xa864('0x19')](_0x2d82d1);}};}function respondWithFilteredResult(_0x2aeed5,_0x4a3055){return function(_0x43a1f7){if(_0x43a1f7){var _0x212513=typeof _0x4a3055[_0xa864('0x1a')]===_0xa864('0x1b')&&typeof _0x4a3055[_0xa864('0x1c')]===_0xa864('0x1b');var _0x2e8336=_0x43a1f7[_0xa864('0x1d')];var _0x5e7d59=_0x212513?0x0:_0x4a3055[_0xa864('0x1a')];var _0x40cc6a=_0x212513?_0x43a1f7['count']:_0x4a3055[_0xa864('0x1a')]+_0x4a3055[_0xa864('0x1c')];var _0x1b3941;if(_0x40cc6a>=_0x2e8336){_0x40cc6a=_0x2e8336;_0x1b3941=0xc8;}else{_0x1b3941=0xce;}_0x2aeed5[_0xa864('0x18')](_0x1b3941);return _0x2aeed5[_0xa864('0x1e')](_0xa864('0x1f'),_0x5e7d59+'-'+_0x40cc6a+'/'+_0x2e8336)[_0xa864('0x19')](_0x43a1f7);}return null;};}function patchUpdates(_0x91b2dc){return function(_0x7e9cab){try{jsonpatch['apply'](_0x7e9cab,_0x91b2dc,!![]);}catch(_0xc4c6ce){return BPromise[_0xa864('0x20')](_0xc4c6ce);}return _0x7e9cab['save']();};}function saveUpdates(_0x14873a,_0x37dc42){return function(_0x31d019){if(_0x31d019){return _0x31d019[_0xa864('0x21')](_0x14873a)[_0xa864('0x22')](function(_0x3b6bd5){return _0x3b6bd5;});}return null;};}function removeEntity(_0x452be5,_0x544415){return function(_0x282b12){if(_0x282b12){return _0x282b12[_0xa864('0x23')]()['then'](function(){_0x452be5[_0xa864('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f2068,_0x7beb66){return function(_0x2e7123){if(!_0x2e7123){_0x3f2068['sendStatus'](0x194);}return _0x2e7123;};}function handleError(_0x4ec4e4,_0xa77740){_0xa77740=_0xa77740||0x1f4;return function(_0x474872){logger['error'](_0x474872[_0xa864('0x24')]);if(_0x474872[_0xa864('0x25')]){delete _0x474872[_0xa864('0x25')];}_0x4ec4e4[_0xa864('0x18')](_0xa77740)[_0xa864('0x26')](_0x474872);};}exports['show']=function(_0x4235e8,_0x1b3e9f){var _0x4e519b={'raw':!![],'where':{'id':_0x4235e8['params']['id']}},_0x18da54={};_0x18da54[_0xa864('0x27')]=_['keys'](db[_0xa864('0x28')][_0xa864('0x29')]);_0x18da54['query']=_[_0xa864('0x2a')](_0x4235e8[_0xa864('0x2b')]);_0x18da54[_0xa864('0x2c')]=_['intersection'](_0x18da54[_0xa864('0x27')],_0x18da54['query']);_0x4e519b[_0xa864('0x2d')]=_[_0xa864('0x2e')](_0x18da54[_0xa864('0x27')],qs['fields'](_0x4235e8[_0xa864('0x2b')][_0xa864('0x2f')]));_0x4e519b['attributes']=_0x4e519b['attributes'][_0xa864('0x30')]?_0x4e519b[_0xa864('0x2d')]:_0x18da54['model'];if(_0x4235e8[_0xa864('0x2b')][_0xa864('0x31')]){_0x4e519b['include']=[{'all':!![]}];}_0x4e519b=_['merge']({},_0x4e519b,_0x4235e8[_0xa864('0x32')]);return db[_0xa864('0x28')][_0xa864('0x33')](_0x4e519b)[_0xa864('0x22')](handleEntityNotFound(_0x1b3e9f,null))[_0xa864('0x22')](respondWithResult(_0x1b3e9f,null))['catch'](handleError(_0x1b3e9f,null));};exports[_0xa864('0x34')]=function(_0x23b518,_0x59b186){return db['ChatProactiveAction']['create'](_0x23b518[_0xa864('0x35')],{})[_0xa864('0x22')](respondWithResult(_0x59b186,0xc9))[_0xa864('0x36')](handleError(_0x59b186,null));};exports['update']=function(_0x319842,_0x2bfcdc){if(_0x319842['body']['id']){delete _0x319842['body']['id'];}return db[_0xa864('0x28')][_0xa864('0x33')]({'where':{'id':_0x319842[_0xa864('0x37')]['id']}})[_0xa864('0x22')](handleEntityNotFound(_0x2bfcdc,null))[_0xa864('0x22')](saveUpdates(_0x319842[_0xa864('0x35')],null))[_0xa864('0x22')](respondWithResult(_0x2bfcdc,null))[_0xa864('0x36')](handleError(_0x2bfcdc,null));};exports[_0xa864('0x23')]=function(_0x136185,_0x9cba3b){return db[_0xa864('0x28')][_0xa864('0x33')]({'where':{'id':_0x136185[_0xa864('0x37')]['id']}})[_0xa864('0x22')](handleEntityNotFound(_0x9cba3b,null))['then'](removeEntity(_0x9cba3b,null))['catch'](handleError(_0x9cba3b,null));}; \ No newline at end of file +var _0x0d6a=['sendStatus','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','include','merge','find','catch','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x0d6a,0xc9));var _0xa0d6=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x0d6a[_0xb24a3e];return _0x4038d7;};'use strict';var emlformat=require(_0xa0d6('0x0'));var rimraf=require(_0xa0d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0d6('0x2'));var rp=require(_0xa0d6('0x3'));var moment=require(_0xa0d6('0x4'));var BPromise=require(_0xa0d6('0x5'));var Mustache=require(_0xa0d6('0x6'));var util=require(_0xa0d6('0x7'));var path=require(_0xa0d6('0x8'));var sox=require(_0xa0d6('0x9'));var csv=require(_0xa0d6('0xa'));var ejs=require(_0xa0d6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0d6('0xc'));var squel=require(_0xa0d6('0xd'));var crypto=require(_0xa0d6('0xe'));var jsforce=require(_0xa0d6('0xf'));var deskjs=require(_0xa0d6('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa0d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xa0d6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa0d6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0d6('0x14'));var logger=require(_0xa0d6('0x15'))(_0xa0d6('0x16'));var utils=require(_0xa0d6('0x17'));var config=require(_0xa0d6('0x18'));var licenseUtil=require(_0xa0d6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x304c6a,_0x17da11){_0x17da11=_0x17da11||0xcc;return function(_0x27aa06){if(_0x27aa06){return _0x304c6a['sendStatus'](_0x17da11);}return _0x304c6a[_0xa0d6('0x1a')](_0x17da11)[_0xa0d6('0x1b')]();};}function respondWithResult(_0x212b39,_0x31b97b){_0x31b97b=_0x31b97b||0xc8;return function(_0x3c3c15){if(_0x3c3c15){return _0x212b39[_0xa0d6('0x1a')](_0x31b97b)[_0xa0d6('0x1c')](_0x3c3c15);}};}function respondWithFilteredResult(_0x4a0f3a,_0x5ddf29){return function(_0x39e63f){if(_0x39e63f){var _0x3f8ed3=typeof _0x5ddf29[_0xa0d6('0x1d')]===_0xa0d6('0x1e')&&typeof _0x5ddf29[_0xa0d6('0x1f')]===_0xa0d6('0x1e');var _0x82e7b6=_0x39e63f['count'];var _0x1c8547=_0x3f8ed3?0x0:_0x5ddf29[_0xa0d6('0x1d')];var _0x20c387=_0x3f8ed3?_0x39e63f['count']:_0x5ddf29[_0xa0d6('0x1d')]+_0x5ddf29['limit'];var _0x1dc618;if(_0x20c387>=_0x82e7b6){_0x20c387=_0x82e7b6;_0x1dc618=0xc8;}else{_0x1dc618=0xce;}_0x4a0f3a['status'](_0x1dc618);return _0x4a0f3a[_0xa0d6('0x20')](_0xa0d6('0x21'),_0x1c8547+'-'+_0x20c387+'/'+_0x82e7b6)[_0xa0d6('0x1c')](_0x39e63f);}return null;};}function patchUpdates(_0x3e9968){return function(_0x798c80){try{jsonpatch[_0xa0d6('0x22')](_0x798c80,_0x3e9968,!![]);}catch(_0x5a78ec){return BPromise[_0xa0d6('0x23')](_0x5a78ec);}return _0x798c80[_0xa0d6('0x24')]();};}function saveUpdates(_0x4ded22,_0x1a053e){return function(_0x51c67e){if(_0x51c67e){return _0x51c67e['update'](_0x4ded22)[_0xa0d6('0x25')](function(_0x222152){return _0x222152;});}return null;};}function removeEntity(_0x181606,_0x16cd24){return function(_0x469c42){if(_0x469c42){return _0x469c42[_0xa0d6('0x26')]()[_0xa0d6('0x25')](function(){_0x181606[_0xa0d6('0x1a')](0xcc)[_0xa0d6('0x1b')]();});}};}function handleEntityNotFound(_0x338b17,_0x4c4111){return function(_0x2eedfe){if(!_0x2eedfe){_0x338b17[_0xa0d6('0x27')](0x194);}return _0x2eedfe;};}function handleError(_0x621e42,_0x2656c5){_0x2656c5=_0x2656c5||0x1f4;return function(_0x173838){logger[_0xa0d6('0x28')](_0x173838[_0xa0d6('0x29')]);if(_0x173838[_0xa0d6('0x2a')]){delete _0x173838[_0xa0d6('0x2a')];}_0x621e42[_0xa0d6('0x1a')](_0x2656c5)[_0xa0d6('0x2b')](_0x173838);};}exports[_0xa0d6('0x2c')]=function(_0x414b84,_0x382a37){var _0x11b38c={'raw':!![],'where':{'id':_0x414b84[_0xa0d6('0x2d')]['id']}},_0x19b932={};_0x19b932[_0xa0d6('0x2e')]=_[_0xa0d6('0x2f')](db[_0xa0d6('0x30')][_0xa0d6('0x31')]);_0x19b932[_0xa0d6('0x32')]=_[_0xa0d6('0x2f')](_0x414b84[_0xa0d6('0x32')]);_0x19b932['filters']=_[_0xa0d6('0x33')](_0x19b932['model'],_0x19b932[_0xa0d6('0x32')]);_0x11b38c[_0xa0d6('0x34')]=_[_0xa0d6('0x33')](_0x19b932['model'],qs[_0xa0d6('0x35')](_0x414b84[_0xa0d6('0x32')]['fields']));_0x11b38c[_0xa0d6('0x34')]=_0x11b38c[_0xa0d6('0x34')]['length']?_0x11b38c[_0xa0d6('0x34')]:_0x19b932[_0xa0d6('0x2e')];if(_0x414b84['query']['includeAll']){_0x11b38c[_0xa0d6('0x36')]=[{'all':!![]}];}_0x11b38c=_[_0xa0d6('0x37')]({},_0x11b38c,_0x414b84['options']);return db[_0xa0d6('0x30')][_0xa0d6('0x38')](_0x11b38c)['then'](handleEntityNotFound(_0x382a37,null))[_0xa0d6('0x25')](respondWithResult(_0x382a37,null))[_0xa0d6('0x39')](handleError(_0x382a37,null));};exports['create']=function(_0x4525c5,_0x29651e){return db['ChatProactiveAction']['create'](_0x4525c5[_0xa0d6('0x3a')],{})[_0xa0d6('0x25')](respondWithResult(_0x29651e,0xc9))[_0xa0d6('0x39')](handleError(_0x29651e,null));};exports[_0xa0d6('0x3b')]=function(_0x5aba86,_0x41fbe3){if(_0x5aba86['body']['id']){delete _0x5aba86[_0xa0d6('0x3a')]['id'];}return db[_0xa0d6('0x30')][_0xa0d6('0x38')]({'where':{'id':_0x5aba86[_0xa0d6('0x2d')]['id']}})[_0xa0d6('0x25')](handleEntityNotFound(_0x41fbe3,null))[_0xa0d6('0x25')](saveUpdates(_0x5aba86[_0xa0d6('0x3a')],null))[_0xa0d6('0x25')](respondWithResult(_0x41fbe3,null))['catch'](handleError(_0x41fbe3,null));};exports[_0xa0d6('0x26')]=function(_0x3c0d5f,_0x44c204){return db['ChatProactiveAction']['find']({'where':{'id':_0x3c0d5f[_0xa0d6('0x2d')]['id']}})['then'](handleEntityNotFound(_0x44c204,null))[_0xa0d6('0x25')](removeEntity(_0x44c204,null))[_0xa0d6('0x39')](handleError(_0x44c204,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7c96c7d..58aa739 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 _0x21d8=['exports','define','chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x21586f,_0x4bcf74){var _0x620124=function(_0x50f2eb){while(--_0x50f2eb){_0x21586f['push'](_0x21586f['shift']());}};_0x620124(++_0x4bcf74);}(_0x21d8,0xcf));var _0x821d=function(_0x55c3a9,_0x4fddb3){_0x55c3a9=_0x55c3a9-0x0;var _0x53f824=_0x21d8[_0x55c3a9];return _0x53f824;};'use strict';var _=require(_0x821d('0x0'));var util=require('util');var logger=require(_0x821d('0x1'))(_0x821d('0x2'));var moment=require(_0x821d('0x3'));var BPromise=require(_0x821d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x821d('0x5'));var rimraf=require(_0x821d('0x6'));var config=require(_0x821d('0x7'));var attributes=require(_0x821d('0x8'));module[_0x821d('0x9')]=function(_0x57e522,_0xcaeab9){return _0x57e522[_0x821d('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x821d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0403=['exports','define','ChatProactiveAction','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0403,0xdf));var _0x3040=function(_0x14722b,_0x5af9ec){_0x14722b=_0x14722b-0x0;var _0x6629ce=_0x0403[_0x14722b];return _0x6629ce;};'use strict';var _=require(_0x3040('0x0'));var util=require(_0x3040('0x1'));var logger=require(_0x3040('0x2'))('api');var moment=require(_0x3040('0x3'));var BPromise=require('bluebird');var rp=require(_0x3040('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3040('0x5'));var config=require(_0x3040('0x6'));var attributes=require(_0x3040('0x7'));module[_0x3040('0x8')]=function(_0x3f5c86,_0x1374a3){return _0x3f5c86[_0x3040('0x9')](_0x3040('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index c9bd7ec..4ee21ea 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 _0x9465=['jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0x9465,0x81));var _0x5946=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x9465[_0x26462c];return _0x509a42;};'use strict';var _=require(_0x5946('0x0'));var util=require('util');var moment=require(_0x5946('0x1'));var BPromise=require(_0x5946('0x2'));var rs=require(_0x5946('0x3'));var fs=require('fs');var Redis=require(_0x5946('0x4'));var db=require(_0x5946('0x5'))['db'];var utils=require(_0x5946('0x6'));var logger=require(_0x5946('0x7'))(_0x5946('0x8'));var config=require('../../config/environment');var jayson=require(_0x5946('0x9'));var client=jayson[_0x5946('0xa')][_0x5946('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ed467,_0x591adb,_0x2aee25){return new BPromise(function(_0x1f6ead,_0x1fe823){return client[_0x5946('0xc')](_0x1ed467,_0x2aee25)['then'](function(_0x162ad7){logger[_0x5946('0xd')](_0x5946('0xe'),_0x591adb,_0x5946('0xf'));logger[_0x5946('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x591adb,_0x5946('0xf'),JSON[_0x5946('0x11')](_0x162ad7));if(_0x162ad7[_0x5946('0x12')]){if(_0x162ad7['error'][_0x5946('0x13')]===0x1f4){logger[_0x5946('0x12')](_0x5946('0xe'),_0x591adb,_0x162ad7['error']['message']);return _0x1fe823(_0x162ad7[_0x5946('0x12')][_0x5946('0x14')]);}logger[_0x5946('0x12')](_0x5946('0xe'),_0x591adb,_0x162ad7[_0x5946('0x12')]['message']);return _0x1f6ead(_0x162ad7[_0x5946('0x12')]['message']);}else{logger['info'](_0x5946('0xe'),_0x591adb,'request\x20sent');_0x1f6ead(_0x162ad7[_0x5946('0x15')][_0x5946('0x14')]);}})[_0x5946('0x16')](function(_0x25a0f1){logger[_0x5946('0x12')](_0x5946('0xe'),_0x591adb,_0x25a0f1);_0x1fe823(_0x25a0f1);});});} \ No newline at end of file +var _0x4a56=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis'];(function(_0x10778c,_0x461571){var _0x38d5f2=function(_0x3afba0){while(--_0x3afba0){_0x10778c['push'](_0x10778c['shift']());}};_0x38d5f2(++_0x461571);}(_0x4a56,0xd5));var _0x64a5=function(_0x3d0ad3,_0x1783ee){_0x3d0ad3=_0x3d0ad3-0x0;var _0x5397b6=_0x4a56[_0x3d0ad3];return _0x5397b6;};'use strict';var _=require('lodash');var util=require(_0x64a5('0x0'));var moment=require('moment');var BPromise=require(_0x64a5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64a5('0x2'));var db=require(_0x64a5('0x3'))['db'];var utils=require(_0x64a5('0x4'));var logger=require(_0x64a5('0x5'))(_0x64a5('0x6'));var config=require(_0x64a5('0x7'));var jayson=require(_0x64a5('0x8'));var client=jayson[_0x64a5('0x9')][_0x64a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c09e,_0x5ae8cf,_0x56a0f0){return new BPromise(function(_0x493178,_0x3ed361){return client[_0x64a5('0xb')](_0x32c09e,_0x56a0f0)[_0x64a5('0xc')](function(_0x53c14e){logger[_0x64a5('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ae8cf,_0x64a5('0xe'));logger[_0x64a5('0xf')](_0x64a5('0x10'),_0x5ae8cf,'request\x20sent',JSON[_0x64a5('0x11')](_0x53c14e));if(_0x53c14e[_0x64a5('0x12')]){if(_0x53c14e[_0x64a5('0x12')][_0x64a5('0x13')]===0x1f4){logger['error'](_0x64a5('0x14'),_0x5ae8cf,_0x53c14e[_0x64a5('0x12')][_0x64a5('0x15')]);return _0x3ed361(_0x53c14e[_0x64a5('0x12')][_0x64a5('0x15')]);}logger[_0x64a5('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ae8cf,_0x53c14e[_0x64a5('0x12')]['message']);return _0x493178(_0x53c14e['error']['message']);}else{logger[_0x64a5('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ae8cf,'request\x20sent');_0x493178(_0x53c14e[_0x64a5('0x16')]['message']);}})[_0x64a5('0x17')](function(_0x4ede48){logger['error'](_0x64a5('0x14'),_0x5ae8cf,_0x4ede48);_0x3ed361(_0x4ede48);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a43478b..11165fc 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 _0x6aa7=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2b7da3,_0x3cd907){var _0x4de3fa=function(_0x4a5e5b){while(--_0x4a5e5b){_0x2b7da3['push'](_0x2b7da3['shift']());}};_0x4de3fa(++_0x3cd907);}(_0x6aa7,0x178));var _0x76aa=function(_0x3f7cdd,_0x44c669){_0x3f7cdd=_0x3f7cdd-0x0;var _0x2c520b=_0x6aa7[_0x3f7cdd];return _0x2c520b;};'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('./chatProactiveAction.controller');router['get'](_0x76aa('0x8'),auth['isAuthenticated'](),controller[_0x76aa('0x9')]);router[_0x76aa('0xa')]('/',auth[_0x76aa('0xb')](),controller['create']);router[_0x76aa('0xc')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller['update']);router[_0x76aa('0xd')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller[_0x76aa('0xe')]);module[_0x76aa('0xf')]=router; \ No newline at end of file +var _0x24ca=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3063a3,_0x297517){var _0x3d678b=function(_0x13be31){while(--_0x13be31){_0x3063a3['push'](_0x3063a3['shift']());}};_0x3d678b(++_0x297517);}(_0x24ca,0x1bc));var _0xa24c=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x24ca[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0xc')]);router[_0xa24c('0xd')]('/',auth[_0xa24c('0xb')](),controller['create']);router[_0xa24c('0xe')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller['update']);router[_0xa24c('0xf')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0x10')]);module[_0xa24c('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a128970..f907f39 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 _0xacc3=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x26110c,_0x4e43ab){var _0x281967=function(_0x260d9f){while(--_0x260d9f){_0x26110c['push'](_0x26110c['shift']());}};_0x281967(++_0x4e43ab);}(_0xacc3,0xa2));var _0x3acc=function(_0x411ca9,_0x3a99e9){_0x411ca9=_0x411ca9-0x0;var _0x462942=_0xacc3[_0x411ca9];return _0x462942;};'use strict';var Sequelize=require(_0x3acc('0x0'));module[_0x3acc('0x1')]={'name':{'type':Sequelize[_0x3acc('0x2')],'unique':_0x3acc('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3acc('0x2')]},'timeout':{'type':Sequelize[_0x3acc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3acc('0x5')](_0x3acc('0x6'),_0x3acc('0x7'),_0x3acc('0x8'))}}; \ No newline at end of file +var _0x9c21=['ENUM','roundrobin','exports','STRING','name','INTEGER'];(function(_0x3387ee,_0x4b83dc){var _0x2ad2fa=function(_0x2664b7){while(--_0x2664b7){_0x3387ee['push'](_0x3387ee['shift']());}};_0x2ad2fa(++_0x4b83dc);}(_0x9c21,0x8c));var _0x19c2=function(_0x259b29,_0x8dc8a2){_0x259b29=_0x259b29-0x0;var _0x2e04f0=_0x9c21[_0x259b29];return _0x2e04f0;};'use strict';var Sequelize=require('sequelize');module[_0x19c2('0x0')]={'name':{'type':Sequelize[_0x19c2('0x1')],'unique':_0x19c2('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x19c2('0x1')]},'timeout':{'type':Sequelize[_0x19c2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x19c2('0x4')]('rrmemory','beepall',_0x19c2('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 506f6d8..304d8c4 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 _0x01ea=['findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','from','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','json','update','then','destroy','get','stack','name','index','ChatQueue','rawAttributes','fieldName','key','getOptions','where','query','findAll','rows','catch','params','model','keys','filters','attributes','intersection','fields','includeAll','include','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','hasOwnProperty','nolimit','limit','sort','pick','ChatQueueId','map','filter','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','length','order','addTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','each'];(function(_0x4aff6b,_0xa8202f){var _0x444afb=function(_0x3eb0ed){while(--_0x3eb0ed){_0x4aff6b['push'](_0x4aff6b['shift']());}};_0x444afb(++_0xa8202f);}(_0x01ea,0x116));var _0xa01e=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x01ea[_0x13ce0c];return _0x4388fb;};'use strict';var BPromise=require('bluebird');var util=require(_0xa01e('0x0'));var _=require(_0xa01e('0x1'));var squel=require(_0xa01e('0x2'));var Redis=require(_0xa01e('0x3'));var qs=require(_0xa01e('0x4'));var logger=require(_0xa01e('0x5'))('api');var config=require(_0xa01e('0x6'));var db=require('../../mysqldb')['db'];config[_0xa01e('0x7')]=_[_0xa01e('0x8')](config[_0xa01e('0x7')],{'host':_0xa01e('0x9'),'port':0x18eb});var socket=require(_0xa01e('0xa'))(new Redis(config[_0xa01e('0x7')]));require('./chatQueue.socket')[_0xa01e('0xb')](socket);function respondWithStatusCode(_0xc75759,_0x1eb607){_0x1eb607=_0x1eb607||0xcc;return function(_0x234b3a){if(_0x234b3a){return _0xc75759[_0xa01e('0xc')](_0x1eb607);}return _0xc75759[_0xa01e('0xd')](_0x1eb607)[_0xa01e('0xe')]();};}function respondWithResult(_0x1d7c81,_0x4ae372){_0x4ae372=_0x4ae372||0xc8;return function(_0x3f7e15){if(_0x3f7e15){return _0x1d7c81['status'](_0x4ae372)['json'](_0x3f7e15);}};}function respondWithFilteredResult(_0x23fd43,_0x5afb01){return function(_0x5b88ee){if(_0x5b88ee){var _0x5436d0=typeof _0x5afb01[_0xa01e('0xf')]===_0xa01e('0x10')&&typeof _0x5afb01['limit']===_0xa01e('0x10');var _0x32458f=_0x5b88ee[_0xa01e('0x11')];var _0xfcec11=_0x5436d0?0x0:_0x5afb01['offset'];var _0x20b10c=_0x5436d0?_0x5b88ee[_0xa01e('0x11')]:_0x5afb01['offset']+_0x5afb01['limit'];var _0x179fe4;if(_0x20b10c>=_0x32458f){_0x20b10c=_0x32458f;_0x179fe4=0xc8;}else{_0x179fe4=0xce;}_0x23fd43[_0xa01e('0xd')](_0x179fe4);return _0x23fd43[_0xa01e('0x12')]('Content-Range',_0xfcec11+'-'+_0x20b10c+'/'+_0x32458f)[_0xa01e('0x13')](_0x5b88ee);}return null;};}function saveUpdates(_0x50657b){return function(_0x50bb02){if(_0x50bb02){return _0x50bb02[_0xa01e('0x14')](_0x50657b)[_0xa01e('0x15')](function(_0x49cd78){return _0x49cd78;});}return null;};}function removeEntity(_0x453093){return function(_0x48879f){if(_0x48879f){return _0x48879f[_0xa01e('0x16')]()['then'](function(){var _0x1dee42=_0x48879f[_0xa01e('0x17')]({'plain':!![]});var _0xdb091='ChatQueues';return db['UserProfileResource'][_0xa01e('0x16')]({'where':{'type':_0xdb091,'resourceId':_0x1dee42['id']}})['then'](function(){return _0x48879f;});})[_0xa01e('0x15')](function(){_0x453093['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a52cb){return function(_0x15be23){if(!_0x15be23){_0x2a52cb[_0xa01e('0xc')](0x194);}return _0x15be23;};}function handleError(_0x8fbd42,_0x3f8abd){_0x3f8abd=_0x3f8abd||0x1f4;return function(_0x10419e){logger['error'](_0x10419e[_0xa01e('0x18')]);if(_0x10419e[_0xa01e('0x19')]){delete _0x10419e['name'];}_0x8fbd42[_0xa01e('0xd')](_0x3f8abd)['send'](_0x10419e);};}exports[_0xa01e('0x1a')]=function(_0x4a4000,_0x2f6cc4){var _0x2350ba={};var _0xfe8a94={'count':0x0,'rows':[]};var _0x5598b0=_['map'](db[_0xa01e('0x1b')][_0xa01e('0x1c')],function(_0x23f50e){return{'name':_0x23f50e[_0xa01e('0x1d')],'type':_0x23f50e['type'][_0xa01e('0x1e')]};});_0x2350ba=qs[_0xa01e('0x1f')](_0x5598b0,_0x4a4000);var _0x6bff7b={'where':_0x2350ba[_0xa01e('0x20')]};return db['ChatQueue'][_0xa01e('0x11')](_0x6bff7b)[_0xa01e('0x15')](function(_0x2cbab1){_0xfe8a94['count']=_0x2cbab1;_0x2350ba['include']=qs['include'](_0x4a4000[_0xa01e('0x21')]);return db[_0xa01e('0x1b')][_0xa01e('0x22')](_0x2350ba);})['then'](function(_0x8b23f9){_0xfe8a94[_0xa01e('0x23')]=_0x8b23f9;return _0xfe8a94;})[_0xa01e('0x15')](respondWithFilteredResult(_0x2f6cc4,_0x2350ba))[_0xa01e('0x24')](handleError(_0x2f6cc4,null));};exports['show']=function(_0x312d9b,_0x45d8bc){var _0x3f6059={'raw':!![],'where':{'id':_0x312d9b[_0xa01e('0x25')]['id']}},_0x4ebff1={};_0x4ebff1[_0xa01e('0x26')]=_[_0xa01e('0x27')](db['ChatQueue'][_0xa01e('0x1c')]);_0x4ebff1['query']=_[_0xa01e('0x27')](_0x312d9b[_0xa01e('0x21')]);_0x4ebff1[_0xa01e('0x28')]=_['intersection'](_0x4ebff1['model'],_0x4ebff1[_0xa01e('0x21')]);_0x3f6059[_0xa01e('0x29')]=_[_0xa01e('0x2a')](_0x4ebff1[_0xa01e('0x26')],qs[_0xa01e('0x2b')](_0x312d9b[_0xa01e('0x21')][_0xa01e('0x2b')]));_0x3f6059[_0xa01e('0x29')]=_0x3f6059[_0xa01e('0x29')]['length']?_0x3f6059[_0xa01e('0x29')]:_0x4ebff1[_0xa01e('0x26')];if(_0x312d9b[_0xa01e('0x21')][_0xa01e('0x2c')]){_0x3f6059[_0xa01e('0x2d')]=[{'all':!![]}];}_0x3f6059=_[_0xa01e('0x2e')]({},_0x3f6059,_0x312d9b[_0xa01e('0x2f')]);return db[_0xa01e('0x1b')][_0xa01e('0x30')](_0x3f6059)[_0xa01e('0x15')](handleEntityNotFound(_0x45d8bc,null))['then'](respondWithResult(_0x45d8bc,null))[_0xa01e('0x24')](handleError(_0x45d8bc,null));};exports['create']=function(_0x52894c,_0x597bb5){return db['ChatQueue'][_0xa01e('0x31')](_0x52894c['body'],{})[_0xa01e('0x15')](function(_0x2fc6ea){var _0x328fbf=_0x52894c[_0xa01e('0x32')][_0xa01e('0x17')]({'plain':!![]});if(!_0x328fbf)throw new Error(_0xa01e('0x33'));if(_0x328fbf[_0xa01e('0x34')]===_0xa01e('0x32')){var _0x299b0b=_0x2fc6ea['get']({'plain':!![]});var _0xfaee79=_0xa01e('0x35');return db['UserProfileSection']['find']({'where':{'name':_0xfaee79,'userProfileId':_0x328fbf[_0xa01e('0x36')]},'raw':!![]})['then'](function(_0x2cb5c9){if(_0x2cb5c9&&_0x2cb5c9[_0xa01e('0x37')]===0x0){return db[_0xa01e('0x38')][_0xa01e('0x31')]({'name':_0x299b0b[_0xa01e('0x19')],'resourceId':_0x299b0b['id'],'type':_0x2cb5c9[_0xa01e('0x19')],'sectionId':_0x2cb5c9['id']},{})['then'](function(){return _0x2fc6ea;});}else{return _0x2fc6ea;}})[_0xa01e('0x24')](function(_0x58b9ef){logger[_0xa01e('0x39')](_0xa01e('0x3a'),_0x58b9ef);throw _0x58b9ef;});}return _0x2fc6ea;})['then'](respondWithResult(_0x597bb5,0xc9))[_0xa01e('0x24')](handleError(_0x597bb5,null));};exports[_0xa01e('0x14')]=function(_0x3209a4,_0x3a2630){if(_0x3209a4[_0xa01e('0x3b')]['id']){delete _0x3209a4[_0xa01e('0x3b')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x3209a4[_0xa01e('0x25')]['id']}})[_0xa01e('0x15')](handleEntityNotFound(_0x3a2630,null))[_0xa01e('0x15')](saveUpdates(_0x3209a4[_0xa01e('0x3b')],null))[_0xa01e('0x15')](respondWithResult(_0x3a2630,null))['catch'](handleError(_0x3a2630,null));};exports[_0xa01e('0x16')]=function(_0x5b56e4,_0x342804){return db[_0xa01e('0x1b')][_0xa01e('0x30')]({'where':{'id':_0x5b56e4[_0xa01e('0x25')]['id']}})[_0xa01e('0x15')](handleEntityNotFound(_0x342804,null))[_0xa01e('0x15')](removeEntity(_0x342804,null))[_0xa01e('0x24')](handleError(_0x342804,null));};exports[_0xa01e('0x3c')]=function(_0x4efaa6,_0xe9dd86){return db['ChatQueue'][_0xa01e('0x3c')]()[_0xa01e('0x15')](respondWithResult(_0xe9dd86,null))[_0xa01e('0x24')](handleError(_0xe9dd86,null));};exports[_0xa01e('0x3d')]=function(_0x561c61,_0x50a14c){var _0x3dd118={'raw':!![],'where':{}},_0x432d00={},_0x433c2b;return db[_0xa01e('0x1b')][_0xa01e('0x3e')]({'where':{'id':_0x561c61['params']['id']}})['then'](handleEntityNotFound(_0x50a14c,null))[_0xa01e('0x15')](function(_0x2c1e2b){if(_0x2c1e2b){_0x433c2b=_0x2c1e2b[_0xa01e('0x17')]({'plain':!![]});_0x432d00[_0xa01e('0x26')]=_[_0xa01e('0x27')](db['UserChatQueue'][_0xa01e('0x1c')]);_0x432d00[_0xa01e('0x21')]=_['keys'](_0x561c61[_0xa01e('0x21')]);_0x432d00[_0xa01e('0x28')]=_['intersection'](_0x432d00[_0xa01e('0x26')],_0x432d00[_0xa01e('0x21')]);_0x3dd118['attributes']=_[_0xa01e('0x2a')](_0x432d00[_0xa01e('0x26')],qs[_0xa01e('0x2b')](_0x561c61[_0xa01e('0x21')][_0xa01e('0x2b')]));_0x3dd118[_0xa01e('0x29')]=_0x3dd118['attributes']['length']?_0x3dd118['attributes']:_0x432d00[_0xa01e('0x26')];if(!_0x561c61[_0xa01e('0x21')][_0xa01e('0x3f')](_0xa01e('0x40'))){_0x3dd118[_0xa01e('0x41')]=qs[_0xa01e('0x41')](_0x561c61['query']['limit']);_0x3dd118[_0xa01e('0xf')]=qs['offset'](_0x561c61[_0xa01e('0x21')][_0xa01e('0xf')]);}_0x3dd118['order']=qs[_0xa01e('0x42')](_0x561c61['query']['sort']);_0x3dd118[_0xa01e('0x20')]=qs[_0xa01e('0x28')](_[_0xa01e('0x43')](_0x561c61['query'],_0x432d00[_0xa01e('0x28')]));_0x3dd118[_0xa01e('0x20')][_0xa01e('0x44')]=_0x2c1e2b['id'];if(_0x561c61[_0xa01e('0x21')]['filter']){_0x3dd118[_0xa01e('0x20')]=_['merge'](_0x3dd118[_0xa01e('0x20')],{'$or':_[_0xa01e('0x45')](_0x3dd118[_0xa01e('0x29')],function(_0x4caa4a){var _0x452b0b={};_0x452b0b[_0x4caa4a]={'$like':'%'+_0x561c61['query'][_0xa01e('0x46')]+'%'};return _0x452b0b;})});}_0x3dd118=_['merge']({},_0x3dd118,_0x561c61[_0xa01e('0x2f')]);return db['UserChatQueue']['findAll'](_0x3dd118);}})['then'](function(_0x295c10){if(_0x295c10){return db[_0xa01e('0x47')][_0xa01e('0x48')]({'where':{'id':_[_0xa01e('0x45')](_0x295c10,'UserId'),'role':_0xa01e('0x49')},'attributes':['id','name',_0xa01e('0x4a'),_0xa01e('0x4b'),_0xa01e('0x4c')]});}})[_0xa01e('0x15')](function(_0x4db91d){if(_0x4db91d){return{'count':_0x4db91d['count'],'rows':_[_0xa01e('0x45')](_0x4db91d[_0xa01e('0x23')],function(_0xe822a){return{'membername':_0xe822a[_0xa01e('0x19')],'UserId':_0xe822a['id'],'queue_name':_0x433c2b[_0xa01e('0x19')],'ChatQueueId':_0x433c2b['id'],'interface':util[_0xa01e('0x4d')](_0xa01e('0x4e'),_0xa01e('0x4f'),_0xe822a[_0xa01e('0x19')]),'penalty':0x0,'paused':_0xe822a[_0xa01e('0x4a')],'createdAt':_0xe822a[_0xa01e('0x4c')],'updatedAt':_0xe822a[_0xa01e('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa01e('0x15')](respondWithFilteredResult(_0x50a14c,_0x3dd118))[_0xa01e('0x24')](handleError(_0x50a14c,null));};exports['getTeams']=function(_0x2e81e0,_0x57256a){var _0xc1fdd5={};var _0x2ad3b7={};var _0x2e73db;var _0xa55677;return db[_0xa01e('0x1b')][_0xa01e('0x3e')]({'where':{'id':_0x2e81e0[_0xa01e('0x25')]['id']}})[_0xa01e('0x15')](handleEntityNotFound(_0x57256a,null))[_0xa01e('0x15')](function(_0x4aee16){if(_0x4aee16){_0x2e73db=_0x4aee16;_0x2ad3b7[_0xa01e('0x26')]=_[_0xa01e('0x27')](db['Team']['rawAttributes']);_0x2ad3b7[_0xa01e('0x21')]=_[_0xa01e('0x27')](_0x2e81e0[_0xa01e('0x21')]);_0x2ad3b7[_0xa01e('0x28')]=_[_0xa01e('0x2a')](_0x2ad3b7[_0xa01e('0x26')],_0x2ad3b7[_0xa01e('0x21')]);_0xc1fdd5[_0xa01e('0x29')]=_[_0xa01e('0x2a')](_0x2ad3b7['model'],qs[_0xa01e('0x2b')](_0x2e81e0[_0xa01e('0x21')]['fields']));_0xc1fdd5[_0xa01e('0x29')]=_0xc1fdd5[_0xa01e('0x29')][_0xa01e('0x50')]?_0xc1fdd5[_0xa01e('0x29')]:_0x2ad3b7[_0xa01e('0x26')];_0xc1fdd5[_0xa01e('0x51')]=qs[_0xa01e('0x42')](_0x2e81e0['query'][_0xa01e('0x42')]);_0xc1fdd5[_0xa01e('0x20')]=qs[_0xa01e('0x28')](_[_0xa01e('0x43')](_0x2e81e0['query'],_0x2ad3b7[_0xa01e('0x28')]));if(_0x2e81e0[_0xa01e('0x21')][_0xa01e('0x46')]){_0xc1fdd5[_0xa01e('0x20')]=_[_0xa01e('0x2e')](_0xc1fdd5[_0xa01e('0x20')],{'$or':_[_0xa01e('0x45')](_0xc1fdd5[_0xa01e('0x29')],function(_0x3fbf58){var _0x437ca2={};_0x437ca2[_0x3fbf58]={'$like':'%'+_0x2e81e0[_0xa01e('0x21')][_0xa01e('0x46')]+'%'};return _0x437ca2;})});}_0xc1fdd5=_[_0xa01e('0x2e')]({},_0xc1fdd5,_0x2e81e0[_0xa01e('0x2f')]);return _0x2e73db['getTeams'](_0xc1fdd5);}})[_0xa01e('0x15')](function(_0x48a0c4){if(_0x48a0c4){_0xa55677=_0x48a0c4[_0xa01e('0x50')];if(!_0x2e81e0['query']['hasOwnProperty'](_0xa01e('0x40'))){_0xc1fdd5[_0xa01e('0x41')]=qs['limit'](_0x2e81e0[_0xa01e('0x21')]['limit']);_0xc1fdd5[_0xa01e('0xf')]=qs[_0xa01e('0xf')](_0x2e81e0[_0xa01e('0x21')][_0xa01e('0xf')]);}return _0x2e73db['getTeams'](_0xc1fdd5);}})[_0xa01e('0x15')](function(_0x54e90e){if(_0x54e90e){return _0x54e90e?{'count':_0xa55677,'rows':_0x54e90e}:null;}})[_0xa01e('0x15')](respondWithResult(_0x57256a,null))[_0xa01e('0x24')](handleError(_0x57256a,null));};exports[_0xa01e('0x52')]=function(_0x14b77c,_0x2b44b7){var _0x2918d1=_0x14b77c[_0xa01e('0x3b')]['ids'];return db[_0xa01e('0x53')][_0xa01e('0x22')]({'where':{'id':_0x2918d1},'attributes':['id'],'include':[{'model':db[_0xa01e('0x47')],'as':_0xa01e('0x54'),'attributes':['id',_0xa01e('0x19'),_0xa01e('0x55'),_0xa01e('0x56'),_0xa01e('0x57')],'raw':!![]}]})[_0xa01e('0x15')](function(_0x50145b){if(_0x50145b){var _0x6f4133=_[_0xa01e('0x58')](_0x50145b,function(_0x4371fd){var _0x18a781=_0x4371fd[_0xa01e('0x17')]({'plain':!![]});return _0x18a781['Agents'];});return db[_0xa01e('0x1b')][_0xa01e('0x30')]({'where':{'id':_0x14b77c[_0xa01e('0x25')]['id']}})[_0xa01e('0x15')](function(_0xa4c51f){return db['sequelize'][_0xa01e('0x59')](function(_0x23c417){return _0xa4c51f[_0xa01e('0x52')](_0x2918d1,{'transaction':_0x23c417})[_0xa01e('0x15')](function(){return BPromise[_0xa01e('0x5a')](_0x6f4133,function(_0x6cf00f){return db['UserChatQueue'][_0xa01e('0x5b')]({'where':{'UserId':_0x6cf00f['id'],'ChatQueueId':_0x14b77c[_0xa01e('0x25')]['id']},'transaction':_0x23c417});});})[_0xa01e('0x15')](function(){_0x6f4133[_0xa01e('0x5c')](function(_0x18305f){socket[_0xa01e('0x5d')](_0xa01e('0x5e'),{'UserId':_0x18305f['id'],'ChatQueueId':_0xa4c51f['id']});});});});});}})[_0xa01e('0x15')](respondWithStatusCode(_0x2b44b7,null))['catch'](handleError(_0x2b44b7,null));};exports[_0xa01e('0x5f')]=function(_0x34b11a,_0x273518){return db['Team'][_0xa01e('0x22')]({'where':{'id':_0x34b11a[_0xa01e('0x21')][_0xa01e('0x60')]},'attributes':['id'],'include':[{'model':db[_0xa01e('0x47')],'as':_0xa01e('0x54'),'attributes':['id'],'raw':!![]}]})[_0xa01e('0x15')](handleEntityNotFound(_0x273518,null))[_0xa01e('0x15')](function(_0x28e628){var _0x56e02f=_[_0xa01e('0x45')](_0x28e628,'id');var _0x463ef1=[];var _0xf21996=[];var _0x548c09=squel[_0xa01e('0x61')]();_0x548c09['field']('tq.TeamId')[_0xa01e('0x62')]('team_has_chat_queues','tq')[_0xa01e('0x63')](_0xa01e('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa01e('0x20')](_0xa01e('0x65'),_0x34b11a[_0xa01e('0x25')]['id']);for(var _0x1a072b=0x0;_0x1a072b<_0x28e628[_0xa01e('0x50')];_0x1a072b+=0x1){let _0x543008=_0x28e628[_0x1a072b];for(var _0x43712c=0x0;_0x43712c<_0x543008[_0xa01e('0x54')][_0xa01e('0x50')];_0x43712c+=0x1){let _0x512d17=_0x543008['Agents'][_0x43712c];var _0x1ede0f=_0x548c09[_0xa01e('0x66')]();_0x1ede0f[_0xa01e('0x20')](_0xa01e('0x67'),_0x512d17['id']);_0xf21996[_0xa01e('0x68')](db[_0xa01e('0x69')]['query'](_0x1ede0f[_0xa01e('0x6a')](),{'type':db[_0xa01e('0x69')][_0xa01e('0x6b')][_0xa01e('0x6c')]})[_0xa01e('0x15')](function(_0x53cc0a){if(_0x53cc0a[_0xa01e('0x50')]===0x1){return _0x512d17['id'];}else{var _0x5d2f91=_[_0xa01e('0x6d')](_[_0xa01e('0x45')](_0x53cc0a,'TeamId'),function(_0x3d3ab8){return _[_0xa01e('0x6e')](_0x56e02f,_0x3d3ab8);});if(_0x5d2f91){return _0x512d17['id'];}}}));}}return BPromise[_0xa01e('0x6f')](_0xf21996)['then'](function(_0x21b0a9){_0x463ef1=_(_0x463ef1)[_0xa01e('0x70')](_0x21b0a9)[_0xa01e('0x71')]()[_0xa01e('0x72')]();return db['ChatQueue']['find']({'where':{'id':_0x34b11a[_0xa01e('0x25')]['id']}})[_0xa01e('0x15')](function(_0x559587){return db[_0xa01e('0x69')][_0xa01e('0x59')](function(_0x525e82){return _0x559587[_0xa01e('0x5f')](_0x34b11a['query'][_0xa01e('0x60')],{'transaction':_0x525e82})[_0xa01e('0x15')](function(){if(!_[_0xa01e('0x73')](_0x463ef1)){return _0x559587['removeAgents'](_0x463ef1,{'transaction':_0x525e82});}})['then'](function(){_0x463ef1[_0xa01e('0x5c')](function(_0x41fc18){socket[_0xa01e('0x5d')](_0xa01e('0x74'),{'UserId':_0x41fc18,'ChatQueueId':_0x559587['id']});});});});});});})[_0xa01e('0x15')](respondWithStatusCode(_0x273518,null))[_0xa01e('0x24')](handleError(_0x273518,null));};exports[_0xa01e('0x75')]=function(_0x185903,_0x56e941){return db[_0xa01e('0x1b')]['find']({'where':{'id':_0x185903['params']['id']}})['then'](handleEntityNotFound(_0x56e941,null))['then'](function(_0x463fb5){if(_0x463fb5){return _0x463fb5[_0xa01e('0x75')](_0x185903[_0xa01e('0x3b')][_0xa01e('0x60')],_[_0xa01e('0x76')](_0x185903[_0xa01e('0x3b')],[_0xa01e('0x60'),'id'])||{})[_0xa01e('0x77')](function(_0x1de6b2){for(var _0x2bdb49=0x0;_0x2bdb49<_0x185903['body'][_0xa01e('0x60')][_0xa01e('0x50')];_0x2bdb49+=0x1){socket[_0xa01e('0x5d')](_0xa01e('0x5e'),{'UserId':Number(_0x185903[_0xa01e('0x3b')][_0xa01e('0x60')][_0x2bdb49]),'ChatQueueId':Number(_0x185903['params']['id'])});}return _0x1de6b2;});}})[_0xa01e('0x15')](respondWithResult(_0x56e941,null))[_0xa01e('0x24')](handleError(_0x56e941,null));};exports[_0xa01e('0x78')]=function(_0x5b710e,_0x2b681a){return db[_0xa01e('0x1b')]['find']({'where':{'id':_0x5b710e[_0xa01e('0x25')]['id']}})['then'](handleEntityNotFound(_0x2b681a,null))['then'](function(_0x15a7eb){if(_0x15a7eb){return _0x15a7eb[_0xa01e('0x78')](_0x5b710e[_0xa01e('0x21')][_0xa01e('0x60')])[_0xa01e('0x15')](function(){if(_[_0xa01e('0x79')](_0x5b710e['query'][_0xa01e('0x60')])){for(var _0x7efab=0x0;_0x7efab<_0x5b710e[_0xa01e('0x21')][_0xa01e('0x60')][_0xa01e('0x50')];_0x7efab+=0x1){socket[_0xa01e('0x5d')](_0xa01e('0x74'),{'UserId':Number(_0x5b710e[_0xa01e('0x21')][_0xa01e('0x60')][_0x7efab]),'ChatQueueId':Number(_0x5b710e[_0xa01e('0x25')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x5b710e['query']['ids']),'ChatQueueId':Number(_0x5b710e[_0xa01e('0x25')]['id'])});}});}})[_0xa01e('0x15')](respondWithStatusCode(_0x2b681a,null))[_0xa01e('0x24')](handleError(_0x2b681a,null));};exports[_0xa01e('0x7a')]=function(_0x1bd12f,_0x2cb12d){var _0x4bdae5={};var _0x405ccf={};var _0x138b39;var _0x120a84;return db[_0xa01e('0x1b')]['findOne']({'where':{'id':_0x1bd12f['params']['id']}})[_0xa01e('0x15')](handleEntityNotFound(_0x2cb12d,null))[_0xa01e('0x15')](function(_0xbda332){if(_0xbda332){_0x138b39=_0xbda332;_0x405ccf['model']=_['keys'](db['User'][_0xa01e('0x1c')]);_0x405ccf['query']=_['keys'](_0x1bd12f['query']);_0x405ccf['filters']=_['intersection'](_0x405ccf[_0xa01e('0x26')],_0x405ccf[_0xa01e('0x21')]);_0x4bdae5[_0xa01e('0x29')]=_[_0xa01e('0x2a')](_0x405ccf['model'],qs['fields'](_0x1bd12f[_0xa01e('0x21')]['fields']));_0x4bdae5[_0xa01e('0x29')]=_0x4bdae5[_0xa01e('0x29')][_0xa01e('0x50')]?_0x4bdae5[_0xa01e('0x29')]:_0x405ccf['model'];_0x4bdae5['order']=qs[_0xa01e('0x42')](_0x1bd12f[_0xa01e('0x21')][_0xa01e('0x42')]);_0x4bdae5[_0xa01e('0x20')]=qs['filters'](_['pick'](_0x1bd12f[_0xa01e('0x21')],_0x405ccf[_0xa01e('0x28')]));if(_0x1bd12f[_0xa01e('0x21')][_0xa01e('0x46')]){_0x4bdae5[_0xa01e('0x20')]=_[_0xa01e('0x2e')](_0x4bdae5[_0xa01e('0x20')],{'$or':_[_0xa01e('0x45')](_0x4bdae5[_0xa01e('0x29')],function(_0x21669e){var _0x1364da={};_0x1364da[_0x21669e]={'$like':'%'+_0x1bd12f['query']['filter']+'%'};return _0x1364da;})});}_0x4bdae5=_[_0xa01e('0x2e')]({},_0x4bdae5,_0x1bd12f[_0xa01e('0x2f')]);return _0x138b39[_0xa01e('0x7a')](_0x4bdae5);}})[_0xa01e('0x15')](function(_0x1d9637){if(_0x1d9637){_0x120a84=_0x1d9637[_0xa01e('0x50')];if(!_0x1bd12f['query'][_0xa01e('0x3f')](_0xa01e('0x40'))){_0x4bdae5[_0xa01e('0x41')]=qs[_0xa01e('0x41')](_0x1bd12f[_0xa01e('0x21')]['limit']);_0x4bdae5[_0xa01e('0xf')]=qs[_0xa01e('0xf')](_0x1bd12f[_0xa01e('0x21')]['offset']);}return _0x138b39[_0xa01e('0x7a')](_0x4bdae5);}})[_0xa01e('0x15')](function(_0x4723af){if(_0x4723af){return _0x4723af?{'count':_0x120a84,'rows':_0x4723af}:null;}})[_0xa01e('0x15')](respondWithResult(_0x2cb12d,null))[_0xa01e('0x24')](handleError(_0x2cb12d,null));}; \ No newline at end of file +var _0x446d=['params','describe','getMembers','findOne','keys','UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','where','findAndCountAll','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','ids','findAll','User','Agents','online','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','userChatQueue:save','removeTeams','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','TeamId','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','emit','isArray','userChatQueue:remove','getAgents','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','update','then','get','ChatQueues','UserProfileResource','destroy','end','error','stack','name','send','index','map','ChatQueue','rawAttributes','getOptions','include','query','rows','show','model','filters','attributes','intersection','fields','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2bf246,_0x5b16e2){var _0x170b38=function(_0x4d251c){while(--_0x4d251c){_0x2bf246['push'](_0x2bf246['shift']());}};_0x170b38(++_0x5b16e2);}(_0x446d,0x133));var _0xd446=function(_0xb4e052,_0x1d3cb6){_0xb4e052=_0xb4e052-0x0;var _0x5197e7=_0x446d[_0xb4e052];return _0x5197e7;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var squel=require(_0xd446('0x0'));var Redis=require(_0xd446('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xd446('0x2'))(_0xd446('0x3'));var config=require(_0xd446('0x4'));var db=require(_0xd446('0x5'))['db'];config[_0xd446('0x6')]=_[_0xd446('0x7')](config[_0xd446('0x6')],{'host':_0xd446('0x8'),'port':0x18eb});var socket=require(_0xd446('0x9'))(new Redis(config[_0xd446('0x6')]));require(_0xd446('0xa'))[_0xd446('0xb')](socket);function respondWithStatusCode(_0x5dda85,_0xaa1027){_0xaa1027=_0xaa1027||0xcc;return function(_0x4d4702){if(_0x4d4702){return _0x5dda85[_0xd446('0xc')](_0xaa1027);}return _0x5dda85[_0xd446('0xd')](_0xaa1027)['end']();};}function respondWithResult(_0x12424f,_0x516f5a){_0x516f5a=_0x516f5a||0xc8;return function(_0x3717b8){if(_0x3717b8){return _0x12424f[_0xd446('0xd')](_0x516f5a)[_0xd446('0xe')](_0x3717b8);}};}function respondWithFilteredResult(_0x3ffe57,_0x11e211){return function(_0x23d37e){if(_0x23d37e){var _0x4f9431=typeof _0x11e211[_0xd446('0xf')]===_0xd446('0x10')&&typeof _0x11e211['limit']===_0xd446('0x10');var _0x83de94=_0x23d37e[_0xd446('0x11')];var _0x3f6847=_0x4f9431?0x0:_0x11e211[_0xd446('0xf')];var _0xb64b29=_0x4f9431?_0x23d37e[_0xd446('0x11')]:_0x11e211[_0xd446('0xf')]+_0x11e211[_0xd446('0x12')];var _0x421cfd;if(_0xb64b29>=_0x83de94){_0xb64b29=_0x83de94;_0x421cfd=0xc8;}else{_0x421cfd=0xce;}_0x3ffe57['status'](_0x421cfd);return _0x3ffe57['set']('Content-Range',_0x3f6847+'-'+_0xb64b29+'/'+_0x83de94)['json'](_0x23d37e);}return null;};}function saveUpdates(_0x5ea1ca){return function(_0x4da4d4){if(_0x4da4d4){return _0x4da4d4[_0xd446('0x13')](_0x5ea1ca)[_0xd446('0x14')](function(_0x41fe1f){return _0x41fe1f;});}return null;};}function removeEntity(_0x284769){return function(_0x366da2){if(_0x366da2){return _0x366da2['destroy']()['then'](function(){var _0x25b91e=_0x366da2[_0xd446('0x15')]({'plain':!![]});var _0x165ff3=_0xd446('0x16');return db[_0xd446('0x17')][_0xd446('0x18')]({'where':{'type':_0x165ff3,'resourceId':_0x25b91e['id']}})[_0xd446('0x14')](function(){return _0x366da2;});})[_0xd446('0x14')](function(){_0x284769['status'](0xcc)[_0xd446('0x19')]();});}};}function handleEntityNotFound(_0x1876e4){return function(_0x1ca941){if(!_0x1ca941){_0x1876e4[_0xd446('0xc')](0x194);}return _0x1ca941;};}function handleError(_0x11f443,_0x2386bd){_0x2386bd=_0x2386bd||0x1f4;return function(_0x1ae8d2){logger[_0xd446('0x1a')](_0x1ae8d2[_0xd446('0x1b')]);if(_0x1ae8d2[_0xd446('0x1c')]){delete _0x1ae8d2[_0xd446('0x1c')];}_0x11f443['status'](_0x2386bd)[_0xd446('0x1d')](_0x1ae8d2);};}exports[_0xd446('0x1e')]=function(_0x441ed0,_0x4e11e7){var _0x414749={};var _0x4ccec9={'count':0x0,'rows':[]};var _0x41db4f=_[_0xd446('0x1f')](db[_0xd446('0x20')][_0xd446('0x21')],function(_0x2e6c9f){return{'name':_0x2e6c9f['fieldName'],'type':_0x2e6c9f['type']['key']};});_0x414749=qs[_0xd446('0x22')](_0x41db4f,_0x441ed0);var _0x578a31={'where':_0x414749['where']};return db[_0xd446('0x20')][_0xd446('0x11')](_0x578a31)[_0xd446('0x14')](function(_0xeb1f8c){_0x4ccec9['count']=_0xeb1f8c;_0x414749[_0xd446('0x23')]=qs['include'](_0x441ed0[_0xd446('0x24')]);return db[_0xd446('0x20')]['findAll'](_0x414749);})[_0xd446('0x14')](function(_0x4873e5){_0x4ccec9[_0xd446('0x25')]=_0x4873e5;return _0x4ccec9;})[_0xd446('0x14')](respondWithFilteredResult(_0x4e11e7,_0x414749))['catch'](handleError(_0x4e11e7,null));};exports[_0xd446('0x26')]=function(_0x5860a5,_0x66d772){var _0xd7a956={'raw':!![],'where':{'id':_0x5860a5['params']['id']}},_0x25002d={};_0x25002d[_0xd446('0x27')]=_['keys'](db['ChatQueue']['rawAttributes']);_0x25002d[_0xd446('0x24')]=_['keys'](_0x5860a5[_0xd446('0x24')]);_0x25002d[_0xd446('0x28')]=_['intersection'](_0x25002d[_0xd446('0x27')],_0x25002d['query']);_0xd7a956[_0xd446('0x29')]=_[_0xd446('0x2a')](_0x25002d['model'],qs[_0xd446('0x2b')](_0x5860a5[_0xd446('0x24')][_0xd446('0x2b')]));_0xd7a956['attributes']=_0xd7a956['attributes'][_0xd446('0x2c')]?_0xd7a956[_0xd446('0x29')]:_0x25002d[_0xd446('0x27')];if(_0x5860a5[_0xd446('0x24')][_0xd446('0x2d')]){_0xd7a956[_0xd446('0x23')]=[{'all':!![]}];}_0xd7a956=_[_0xd446('0x2e')]({},_0xd7a956,_0x5860a5[_0xd446('0x2f')]);return db[_0xd446('0x20')][_0xd446('0x30')](_0xd7a956)[_0xd446('0x14')](handleEntityNotFound(_0x66d772,null))['then'](respondWithResult(_0x66d772,null))[_0xd446('0x31')](handleError(_0x66d772,null));};exports[_0xd446('0x32')]=function(_0x3ad59a,_0xc3eb31){return db['ChatQueue'][_0xd446('0x32')](_0x3ad59a[_0xd446('0x33')],{})[_0xd446('0x14')](function(_0x2be48d){var _0x31bfc9=_0x3ad59a[_0xd446('0x34')][_0xd446('0x15')]({'plain':!![]});if(!_0x31bfc9)throw new Error(_0xd446('0x35'));if(_0x31bfc9[_0xd446('0x36')]===_0xd446('0x34')){var _0x6bacc1=_0x2be48d['get']({'plain':!![]});var _0x287226=_0xd446('0x16');return db[_0xd446('0x37')][_0xd446('0x30')]({'where':{'name':_0x287226,'userProfileId':_0x31bfc9[_0xd446('0x38')]},'raw':!![]})[_0xd446('0x14')](function(_0x28e5a8){if(_0x28e5a8&&_0x28e5a8[_0xd446('0x39')]===0x0){return db['UserProfileResource']['create']({'name':_0x6bacc1['name'],'resourceId':_0x6bacc1['id'],'type':_0x28e5a8[_0xd446('0x1c')],'sectionId':_0x28e5a8['id']},{})[_0xd446('0x14')](function(){return _0x2be48d;});}else{return _0x2be48d;}})['catch'](function(_0x4c133d){logger[_0xd446('0x1a')](_0xd446('0x3a'),_0x4c133d);throw _0x4c133d;});}return _0x2be48d;})[_0xd446('0x14')](respondWithResult(_0xc3eb31,0xc9))[_0xd446('0x31')](handleError(_0xc3eb31,null));};exports[_0xd446('0x13')]=function(_0x14d3b1,_0x20987d){if(_0x14d3b1['body']['id']){delete _0x14d3b1['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x14d3b1['params']['id']}})['then'](handleEntityNotFound(_0x20987d,null))[_0xd446('0x14')](saveUpdates(_0x14d3b1[_0xd446('0x33')],null))['then'](respondWithResult(_0x20987d,null))[_0xd446('0x31')](handleError(_0x20987d,null));};exports['destroy']=function(_0x565894,_0x57d2c3){return db[_0xd446('0x20')][_0xd446('0x30')]({'where':{'id':_0x565894[_0xd446('0x3b')]['id']}})[_0xd446('0x14')](handleEntityNotFound(_0x57d2c3,null))[_0xd446('0x14')](removeEntity(_0x57d2c3,null))[_0xd446('0x31')](handleError(_0x57d2c3,null));};exports[_0xd446('0x3c')]=function(_0x579b49,_0x44466b){return db['ChatQueue'][_0xd446('0x3c')]()[_0xd446('0x14')](respondWithResult(_0x44466b,null))[_0xd446('0x31')](handleError(_0x44466b,null));};exports[_0xd446('0x3d')]=function(_0x19c8c5,_0x7028b){var _0x14bdfc={'raw':!![],'where':{}},_0x1cbbae={},_0x227398;return db[_0xd446('0x20')][_0xd446('0x3e')]({'where':{'id':_0x19c8c5[_0xd446('0x3b')]['id']}})['then'](handleEntityNotFound(_0x7028b,null))['then'](function(_0xc7e60c){if(_0xc7e60c){_0x227398=_0xc7e60c[_0xd446('0x15')]({'plain':!![]});_0x1cbbae[_0xd446('0x27')]=_[_0xd446('0x3f')](db[_0xd446('0x40')][_0xd446('0x21')]);_0x1cbbae[_0xd446('0x24')]=_['keys'](_0x19c8c5['query']);_0x1cbbae[_0xd446('0x28')]=_['intersection'](_0x1cbbae[_0xd446('0x27')],_0x1cbbae[_0xd446('0x24')]);_0x14bdfc[_0xd446('0x29')]=_['intersection'](_0x1cbbae['model'],qs[_0xd446('0x2b')](_0x19c8c5['query'][_0xd446('0x2b')]));_0x14bdfc[_0xd446('0x29')]=_0x14bdfc['attributes'][_0xd446('0x2c')]?_0x14bdfc[_0xd446('0x29')]:_0x1cbbae['model'];if(!_0x19c8c5[_0xd446('0x24')][_0xd446('0x41')](_0xd446('0x42'))){_0x14bdfc[_0xd446('0x12')]=qs['limit'](_0x19c8c5[_0xd446('0x24')]['limit']);_0x14bdfc[_0xd446('0xf')]=qs[_0xd446('0xf')](_0x19c8c5[_0xd446('0x24')]['offset']);}_0x14bdfc[_0xd446('0x43')]=qs[_0xd446('0x44')](_0x19c8c5[_0xd446('0x24')][_0xd446('0x44')]);_0x14bdfc['where']=qs[_0xd446('0x28')](_[_0xd446('0x45')](_0x19c8c5[_0xd446('0x24')],_0x1cbbae[_0xd446('0x28')]));_0x14bdfc['where'][_0xd446('0x46')]=_0xc7e60c['id'];if(_0x19c8c5['query'][_0xd446('0x47')]){_0x14bdfc[_0xd446('0x48')]=_[_0xd446('0x2e')](_0x14bdfc[_0xd446('0x48')],{'$or':_[_0xd446('0x1f')](_0x14bdfc[_0xd446('0x29')],function(_0x2e87e3){var _0x4a0441={};_0x4a0441[_0x2e87e3]={'$like':'%'+_0x19c8c5['query'][_0xd446('0x47')]+'%'};return _0x4a0441;})});}_0x14bdfc=_[_0xd446('0x2e')]({},_0x14bdfc,_0x19c8c5['options']);return db[_0xd446('0x40')]['findAll'](_0x14bdfc);}})[_0xd446('0x14')](function(_0xb1dc91){if(_0xb1dc91){return db['User'][_0xd446('0x49')]({'where':{'id':_['map'](_0xb1dc91,'UserId'),'role':_0xd446('0x4a')},'attributes':['id','name',_0xd446('0x4b'),_0xd446('0x4c'),'createdAt']});}})[_0xd446('0x14')](function(_0x28657b){if(_0x28657b){return{'count':_0x28657b[_0xd446('0x11')],'rows':_[_0xd446('0x1f')](_0x28657b['rows'],function(_0x59d583){return{'membername':_0x59d583['name'],'UserId':_0x59d583['id'],'queue_name':_0x227398['name'],'ChatQueueId':_0x227398['id'],'interface':util[_0xd446('0x4d')](_0xd446('0x4e'),_0xd446('0x4f'),_0x59d583[_0xd446('0x1c')]),'penalty':0x0,'paused':_0x59d583[_0xd446('0x4b')],'createdAt':_0x59d583[_0xd446('0x50')],'updatedAt':_0x59d583[_0xd446('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x7028b,_0x14bdfc))[_0xd446('0x31')](handleError(_0x7028b,null));};exports[_0xd446('0x51')]=function(_0x116e7b,_0x50cb7f){var _0x22869a={};var _0x15d16d={};var _0x99d53c;var _0x5c7a0c;return db[_0xd446('0x20')][_0xd446('0x3e')]({'where':{'id':_0x116e7b['params']['id']}})[_0xd446('0x14')](handleEntityNotFound(_0x50cb7f,null))[_0xd446('0x14')](function(_0x23a49b){if(_0x23a49b){_0x99d53c=_0x23a49b;_0x15d16d[_0xd446('0x27')]=_[_0xd446('0x3f')](db[_0xd446('0x52')]['rawAttributes']);_0x15d16d['query']=_[_0xd446('0x3f')](_0x116e7b[_0xd446('0x24')]);_0x15d16d[_0xd446('0x28')]=_[_0xd446('0x2a')](_0x15d16d[_0xd446('0x27')],_0x15d16d['query']);_0x22869a['attributes']=_[_0xd446('0x2a')](_0x15d16d[_0xd446('0x27')],qs[_0xd446('0x2b')](_0x116e7b[_0xd446('0x24')][_0xd446('0x2b')]));_0x22869a[_0xd446('0x29')]=_0x22869a[_0xd446('0x29')][_0xd446('0x2c')]?_0x22869a[_0xd446('0x29')]:_0x15d16d[_0xd446('0x27')];_0x22869a[_0xd446('0x43')]=qs[_0xd446('0x44')](_0x116e7b[_0xd446('0x24')][_0xd446('0x44')]);_0x22869a[_0xd446('0x48')]=qs['filters'](_[_0xd446('0x45')](_0x116e7b['query'],_0x15d16d[_0xd446('0x28')]));if(_0x116e7b[_0xd446('0x24')][_0xd446('0x47')]){_0x22869a['where']=_[_0xd446('0x2e')](_0x22869a['where'],{'$or':_[_0xd446('0x1f')](_0x22869a[_0xd446('0x29')],function(_0x122dc7){var _0x4a928a={};_0x4a928a[_0x122dc7]={'$like':'%'+_0x116e7b[_0xd446('0x24')]['filter']+'%'};return _0x4a928a;})});}_0x22869a=_[_0xd446('0x2e')]({},_0x22869a,_0x116e7b['options']);return _0x99d53c['getTeams'](_0x22869a);}})[_0xd446('0x14')](function(_0x334458){if(_0x334458){_0x5c7a0c=_0x334458[_0xd446('0x2c')];if(!_0x116e7b[_0xd446('0x24')][_0xd446('0x41')](_0xd446('0x42'))){_0x22869a['limit']=qs[_0xd446('0x12')](_0x116e7b[_0xd446('0x24')]['limit']);_0x22869a[_0xd446('0xf')]=qs[_0xd446('0xf')](_0x116e7b[_0xd446('0x24')][_0xd446('0xf')]);}return _0x99d53c['getTeams'](_0x22869a);}})[_0xd446('0x14')](function(_0x2d404e){if(_0x2d404e){return _0x2d404e?{'count':_0x5c7a0c,'rows':_0x2d404e}:null;}})['then'](respondWithResult(_0x50cb7f,null))[_0xd446('0x31')](handleError(_0x50cb7f,null));};exports['addTeams']=function(_0x21f14a,_0x561e68){var _0x590316=_0x21f14a[_0xd446('0x33')][_0xd446('0x53')];return db[_0xd446('0x52')][_0xd446('0x54')]({'where':{'id':_0x590316},'attributes':['id'],'include':[{'model':db[_0xd446('0x55')],'as':_0xd446('0x56'),'attributes':['id',_0xd446('0x1c'),_0xd446('0x57'),'voicePause',_0xd446('0x58')],'raw':!![]}]})[_0xd446('0x14')](function(_0x159f86){if(_0x159f86){var _0x385dc2=_[_0xd446('0x59')](_0x159f86,function(_0x119bb3){var _0x2629e5=_0x119bb3[_0xd446('0x15')]({'plain':!![]});return _0x2629e5[_0xd446('0x56')];});return db['ChatQueue'][_0xd446('0x30')]({'where':{'id':_0x21f14a[_0xd446('0x3b')]['id']}})[_0xd446('0x14')](function(_0x35842b){return db['sequelize'][_0xd446('0x5a')](function(_0x36b336){return _0x35842b[_0xd446('0x5b')](_0x590316,{'transaction':_0x36b336})['then'](function(){return BPromise[_0xd446('0x5c')](_0x385dc2,function(_0x4ca544){return db[_0xd446('0x40')][_0xd446('0x5d')]({'where':{'UserId':_0x4ca544['id'],'ChatQueueId':_0x21f14a['params']['id']},'transaction':_0x36b336});});})[_0xd446('0x14')](function(){_0x385dc2[_0xd446('0x5e')](function(_0x23be00){socket['emit'](_0xd446('0x5f'),{'UserId':_0x23be00['id'],'ChatQueueId':_0x35842b['id']});});});});});}})['then'](respondWithStatusCode(_0x561e68,null))[_0xd446('0x31')](handleError(_0x561e68,null));};exports[_0xd446('0x60')]=function(_0x3b93ab,_0xe92374){return db[_0xd446('0x52')][_0xd446('0x54')]({'where':{'id':_0x3b93ab[_0xd446('0x24')][_0xd446('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd446('0x56'),'attributes':['id'],'raw':!![]}]})[_0xd446('0x14')](handleEntityNotFound(_0xe92374,null))[_0xd446('0x14')](function(_0x181b4b){var _0x3c733c=_[_0xd446('0x1f')](_0x181b4b,'id');var _0x55425e=[];var _0x42f2d3=[];var _0x5e6007=squel['select']();_0x5e6007[_0xd446('0x61')]('tq.TeamId')[_0xd446('0x62')](_0xd446('0x63'),'tq')[_0xd446('0x64')](_0xd446('0x65'),'ut',_0xd446('0x66'))[_0xd446('0x48')](_0xd446('0x67'),_0x3b93ab[_0xd446('0x3b')]['id']);for(var _0x381842=0x0;_0x381842<_0x181b4b[_0xd446('0x2c')];_0x381842+=0x1){let _0x4229bc=_0x181b4b[_0x381842];for(var _0x1ec6df=0x0;_0x1ec6df<_0x4229bc[_0xd446('0x56')][_0xd446('0x2c')];_0x1ec6df+=0x1){let _0x12b5fb=_0x4229bc[_0xd446('0x56')][_0x1ec6df];var _0x426567=_0x5e6007[_0xd446('0x68')]();_0x426567[_0xd446('0x48')](_0xd446('0x69'),_0x12b5fb['id']);_0x42f2d3['push'](db[_0xd446('0x6a')][_0xd446('0x24')](_0x426567[_0xd446('0x6b')](),{'type':db[_0xd446('0x6a')][_0xd446('0x6c')]['SELECT']})[_0xd446('0x14')](function(_0x5cebd9){if(_0x5cebd9[_0xd446('0x2c')]===0x1){return _0x12b5fb['id'];}else{var _0x2b1f13=_['every'](_[_0xd446('0x1f')](_0x5cebd9,_0xd446('0x6d')),function(_0x3bcd32){return _['includes'](_0x3c733c,_0x3bcd32);});if(_0x2b1f13){return _0x12b5fb['id'];}}}));}}return BPromise['all'](_0x42f2d3)['then'](function(_0x3d19ef){_0x55425e=_(_0x55425e)[_0xd446('0x6e')](_0x3d19ef)[_0xd446('0x6f')]()[_0xd446('0x70')]();return db['ChatQueue'][_0xd446('0x30')]({'where':{'id':_0x3b93ab[_0xd446('0x3b')]['id']}})[_0xd446('0x14')](function(_0x5d063b){return db[_0xd446('0x6a')]['transaction'](function(_0x1dccbe){return _0x5d063b['removeTeams'](_0x3b93ab[_0xd446('0x24')][_0xd446('0x53')],{'transaction':_0x1dccbe})[_0xd446('0x14')](function(){if(!_[_0xd446('0x71')](_0x55425e)){return _0x5d063b[_0xd446('0x72')](_0x55425e,{'transaction':_0x1dccbe});}})[_0xd446('0x14')](function(){_0x55425e['forEach'](function(_0x1eaa5d){socket['emit']('userChatQueue:remove',{'UserId':_0x1eaa5d,'ChatQueueId':_0x5d063b['id']});});});});});});})['then'](respondWithStatusCode(_0xe92374,null))[_0xd446('0x31')](handleError(_0xe92374,null));};exports[_0xd446('0x73')]=function(_0x3275db,_0x24dbd9){return db[_0xd446('0x20')][_0xd446('0x30')]({'where':{'id':_0x3275db['params']['id']}})[_0xd446('0x14')](handleEntityNotFound(_0x24dbd9,null))['then'](function(_0x56656b){if(_0x56656b){return _0x56656b[_0xd446('0x73')](_0x3275db[_0xd446('0x33')][_0xd446('0x53')],_[_0xd446('0x74')](_0x3275db[_0xd446('0x33')],[_0xd446('0x53'),'id'])||{})[_0xd446('0x75')](function(_0x544d65){for(var _0xe3a4fa=0x0;_0xe3a4fa<_0x3275db[_0xd446('0x33')][_0xd446('0x53')]['length'];_0xe3a4fa+=0x1){socket[_0xd446('0x76')](_0xd446('0x5f'),{'UserId':Number(_0x3275db[_0xd446('0x33')][_0xd446('0x53')][_0xe3a4fa]),'ChatQueueId':Number(_0x3275db[_0xd446('0x3b')]['id'])});}return _0x544d65;});}})['then'](respondWithResult(_0x24dbd9,null))[_0xd446('0x31')](handleError(_0x24dbd9,null));};exports['removeAgents']=function(_0x17e92e,_0x19abbb){return db['ChatQueue']['find']({'where':{'id':_0x17e92e['params']['id']}})[_0xd446('0x14')](handleEntityNotFound(_0x19abbb,null))[_0xd446('0x14')](function(_0x17fdd5){if(_0x17fdd5){return _0x17fdd5[_0xd446('0x72')](_0x17e92e['query']['ids'])['then'](function(){if(_[_0xd446('0x77')](_0x17e92e[_0xd446('0x24')][_0xd446('0x53')])){for(var _0x326496=0x0;_0x326496<_0x17e92e[_0xd446('0x24')]['ids'][_0xd446('0x2c')];_0x326496+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x17e92e['query'][_0xd446('0x53')][_0x326496]),'ChatQueueId':Number(_0x17e92e[_0xd446('0x3b')]['id'])});}}else{socket['emit'](_0xd446('0x78'),{'UserId':Number(_0x17e92e[_0xd446('0x24')][_0xd446('0x53')]),'ChatQueueId':Number(_0x17e92e[_0xd446('0x3b')]['id'])});}});}})['then'](respondWithStatusCode(_0x19abbb,null))['catch'](handleError(_0x19abbb,null));};exports[_0xd446('0x79')]=function(_0x30b4d6,_0x2f11cb){var _0x238b66={};var _0x20b313={};var _0x48c2d8;var _0x4dab0b;return db[_0xd446('0x20')][_0xd446('0x3e')]({'where':{'id':_0x30b4d6[_0xd446('0x3b')]['id']}})[_0xd446('0x14')](handleEntityNotFound(_0x2f11cb,null))[_0xd446('0x14')](function(_0x59d6d7){if(_0x59d6d7){_0x48c2d8=_0x59d6d7;_0x20b313[_0xd446('0x27')]=_['keys'](db[_0xd446('0x55')]['rawAttributes']);_0x20b313[_0xd446('0x24')]=_[_0xd446('0x3f')](_0x30b4d6[_0xd446('0x24')]);_0x20b313[_0xd446('0x28')]=_[_0xd446('0x2a')](_0x20b313['model'],_0x20b313[_0xd446('0x24')]);_0x238b66[_0xd446('0x29')]=_['intersection'](_0x20b313[_0xd446('0x27')],qs[_0xd446('0x2b')](_0x30b4d6[_0xd446('0x24')]['fields']));_0x238b66[_0xd446('0x29')]=_0x238b66[_0xd446('0x29')][_0xd446('0x2c')]?_0x238b66[_0xd446('0x29')]:_0x20b313[_0xd446('0x27')];_0x238b66[_0xd446('0x43')]=qs[_0xd446('0x44')](_0x30b4d6[_0xd446('0x24')][_0xd446('0x44')]);_0x238b66[_0xd446('0x48')]=qs['filters'](_['pick'](_0x30b4d6[_0xd446('0x24')],_0x20b313[_0xd446('0x28')]));if(_0x30b4d6[_0xd446('0x24')][_0xd446('0x47')]){_0x238b66[_0xd446('0x48')]=_[_0xd446('0x2e')](_0x238b66[_0xd446('0x48')],{'$or':_['map'](_0x238b66[_0xd446('0x29')],function(_0x19274b){var _0x49eb88={};_0x49eb88[_0x19274b]={'$like':'%'+_0x30b4d6[_0xd446('0x24')][_0xd446('0x47')]+'%'};return _0x49eb88;})});}_0x238b66=_[_0xd446('0x2e')]({},_0x238b66,_0x30b4d6['options']);return _0x48c2d8['getAgents'](_0x238b66);}})[_0xd446('0x14')](function(_0x4350e3){if(_0x4350e3){_0x4dab0b=_0x4350e3[_0xd446('0x2c')];if(!_0x30b4d6[_0xd446('0x24')]['hasOwnProperty']('nolimit')){_0x238b66[_0xd446('0x12')]=qs[_0xd446('0x12')](_0x30b4d6[_0xd446('0x24')][_0xd446('0x12')]);_0x238b66[_0xd446('0xf')]=qs['offset'](_0x30b4d6[_0xd446('0x24')][_0xd446('0xf')]);}return _0x48c2d8[_0xd446('0x79')](_0x238b66);}})[_0xd446('0x14')](function(_0x1199c3){if(_0x1199c3){return _0x1199c3?{'count':_0x4dab0b,'rows':_0x1199c3}:null;}})[_0xd446('0x14')](respondWithResult(_0x2f11cb,null))[_0xd446('0x31')](handleError(_0x2f11cb,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 624b3aa..8ce0cbb 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 _0x247a=['hasOwnProperty','hook','exports','events','ChatQueue','save','update','remove','emit'];(function(_0x4dfa8,_0x4642e5){var _0x149947=function(_0x2bbf14){while(--_0x2bbf14){_0x4dfa8['push'](_0x4dfa8['shift']());}};_0x149947(++_0x4642e5);}(_0x247a,0x162));var _0xa247=function(_0x12ed67,_0x1a5083){_0x12ed67=_0x12ed67-0x0;var _0x197263=_0x247a[_0x12ed67];return _0x197263;};'use strict';var EventEmitter=require(_0xa247('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xa247('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa247('0x2'),'afterUpdate':_0xa247('0x3'),'afterDestroy':_0xa247('0x4')};function emitEvent(_0xfe593a){return function(_0x2be4a1,_0x582b77,_0x564b65){ChatQueueEvents[_0xa247('0x5')](_0xfe593a+':'+_0x2be4a1['id'],_0x2be4a1);ChatQueueEvents[_0xa247('0x5')](_0xfe593a,_0x2be4a1);_0x564b65(null);};}for(var e in events){if(events[_0xa247('0x6')](e)){var event=events[e];ChatQueue[_0xa247('0x7')](e,emitEvent(event));}}module[_0xa247('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xe799=['events','ChatQueue','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x50b922,_0x10cab8){var _0x1397b1=function(_0x21f12a){while(--_0x21f12a){_0x50b922['push'](_0x50b922['shift']());}};_0x1397b1(++_0x10cab8);}(_0xe799,0x170));var _0x9e79=function(_0x4fe9d3,_0x39fc2c){_0x4fe9d3=_0x4fe9d3-0x0;var _0x3a9818=_0xe799[_0x4fe9d3];return _0x3a9818;};'use strict';var EventEmitter=require(_0x9e79('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x9e79('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9e79('0x2'),'afterUpdate':_0x9e79('0x3'),'afterDestroy':'remove'};function emitEvent(_0x34a40e){return function(_0x3f0a4f,_0x809ffd,_0x4cfc04){ChatQueueEvents[_0x9e79('0x4')](_0x34a40e+':'+_0x3f0a4f['id'],_0x3f0a4f);ChatQueueEvents['emit'](_0x34a40e,_0x3f0a4f);_0x4cfc04(null);};}for(var e in events){if(events[_0x9e79('0x5')](e)){var event=events[e];ChatQueue[_0x9e79('0x6')](e,emitEvent(event));}}module[_0x9e79('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 1841b2a..6d1fec6 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 _0x9199=['util','api','moment','bluebird','rimraf','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x223cdb,_0x527b14){var _0x4a10af=function(_0x1ffde2){while(--_0x1ffde2){_0x223cdb['push'](_0x223cdb['shift']());}};_0x4a10af(++_0x527b14);}(_0x9199,0xf9));var _0x9919=function(_0x44c09c,_0x225ba3){_0x44c09c=_0x44c09c-0x0;var _0x4da5c8=_0x9199[_0x44c09c];return _0x4da5c8;};'use strict';var _=require(_0x9919('0x0'));var util=require(_0x9919('0x1'));var logger=require('../../config/logger')(_0x9919('0x2'));var moment=require(_0x9919('0x3'));var BPromise=require(_0x9919('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9919('0x5'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x9919('0x6')]=function(_0x6ede7f,_0x5849f1){return _0x6ede7f[_0x9919('0x7')](_0x9919('0x8'),attributes,{'tableName':_0x9919('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e1c=['./chatQueue.attributes','exports','chat_queues','lodash','util','api','bluebird','request-promise','path'];(function(_0x4b956f,_0x443051){var _0x5cc84e=function(_0x28d360){while(--_0x28d360){_0x4b956f['push'](_0x4b956f['shift']());}};_0x5cc84e(++_0x443051);}(_0x1e1c,0x1bc));var _0xc1e1=function(_0x145c82,_0x55e865){_0x145c82=_0x145c82-0x0;var _0x26b045=_0x1e1c[_0x145c82];return _0x26b045;};'use strict';var _=require(_0xc1e1('0x0'));var util=require(_0xc1e1('0x1'));var logger=require('../../config/logger')(_0xc1e1('0x2'));var moment=require('moment');var BPromise=require(_0xc1e1('0x3'));var rp=require(_0xc1e1('0x4'));var fs=require('fs');var path=require(_0xc1e1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc1e1('0x6'));module[_0xc1e1('0x7')]=function(_0x4db5db,_0x804a35){return _0x4db5db['define']('ChatQueue',attributes,{'tableName':_0xc1e1('0x8'),'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 1b3ce67..a08c03e 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 _0x268c=['jayson/promise','client','defaults','redis','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','attributes','limit','include','map','model','ShowChatQueue','find','raw','where','lodash','moment','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x268c,0xb3));var _0xc268=function(_0x4370c7,_0x5dbfb0){_0x4370c7=_0x4370c7-0x0;var _0xce78a9=_0x268c[_0x4370c7];return _0xce78a9;};'use strict';var _=require(_0xc268('0x0'));var util=require('util');var moment=require(_0xc268('0x1'));var BPromise=require('bluebird');var rs=require(_0xc268('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc268('0x3'));var logger=require('../../config/logger')(_0xc268('0x4'));var config=require(_0xc268('0x5'));var jayson=require(_0xc268('0x6'));var client=jayson[_0xc268('0x7')]['http']({'port':0x232a});config['redis']=_[_0xc268('0x8')](config[_0xc268('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc268('0xa'))(new Redis(config[_0xc268('0x9')]));require(_0xc268('0xb'))[_0xc268('0xc')](socket);function respondWithRpcPromise(_0x20d843,_0x3a6790,_0x2cf15b){return new BPromise(function(_0x430851,_0x429611){return client[_0xc268('0xd')](_0x20d843,_0x2cf15b)[_0xc268('0xe')](function(_0x3e086d){logger[_0xc268('0xf')](_0xc268('0x10'),_0x3a6790,'request\x20sent');logger[_0xc268('0x11')](_0xc268('0x12'),_0x3a6790,'request\x20sent',JSON[_0xc268('0x13')](_0x3e086d));if(_0x3e086d[_0xc268('0x14')]){if(_0x3e086d[_0xc268('0x14')][_0xc268('0x15')]===0x1f4){logger[_0xc268('0x14')](_0xc268('0x10'),_0x3a6790,_0x3e086d['error'][_0xc268('0x16')]);return _0x429611(_0x3e086d['error'][_0xc268('0x16')]);}logger[_0xc268('0x14')](_0xc268('0x10'),_0x3a6790,_0x3e086d[_0xc268('0x14')][_0xc268('0x16')]);return _0x430851(_0x3e086d[_0xc268('0x14')]['message']);}else{logger[_0xc268('0xf')](_0xc268('0x10'),_0x3a6790,'request\x20sent');_0x430851(_0x3e086d['result'][_0xc268('0x16')]);}})[_0xc268('0x17')](function(_0x16d744){logger[_0xc268('0x14')](_0xc268('0x10'),_0x3a6790,_0x16d744);_0x429611(_0x16d744);});});}exports[_0xc268('0x18')]=function(_0x222500){var _0x507f18=this;return new Promise(function(_0x13b27c,_0x288189){return db[_0xc268('0x19')][_0xc268('0x1a')]({'raw':_0x222500[_0xc268('0x1b')]?_0x222500[_0xc268('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x222500['options']?_0x222500['options']['where']||null:null,'attributes':_0x222500[_0xc268('0x1b')]?_0x222500[_0xc268('0x1b')][_0xc268('0x1c')]||null:null,'limit':_0x222500['options']?_0x222500['options'][_0xc268('0x1d')]||null:null,'include':_0x222500[_0xc268('0x1b')]?_0x222500['options'][_0xc268('0x1e')]?_[_0xc268('0x1f')](_0x222500[_0xc268('0x1b')][_0xc268('0x1e')],function(_0x40432e){return{'model':db[_0x40432e[_0xc268('0x20')]],'as':_0x40432e['as'],'attributes':_0x40432e['attributes'],'include':_0x40432e[_0xc268('0x1e')]?_[_0xc268('0x1f')](_0x40432e[_0xc268('0x1e')],function(_0x3b6b16){return{'model':db[_0x3b6b16[_0xc268('0x20')]],'as':_0x3b6b16['as'],'attributes':_0x3b6b16[_0xc268('0x1c')],'include':_0x3b6b16['include']?_['map'](_0x3b6b16['include'],function(_0x7f28b1){return{'model':db[_0x7f28b1[_0xc268('0x20')]],'as':_0x7f28b1['as'],'attributes':_0x7f28b1[_0xc268('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc268('0xe')](function(_0x9ef361){logger[_0xc268('0xf')](_0xc268('0x18'),_0x222500);logger[_0xc268('0x11')](_0xc268('0x18'),_0x222500,JSON[_0xc268('0x13')](_0x9ef361));_0x13b27c(_0x9ef361);})['catch'](function(_0x515620){logger[_0xc268('0x14')](_0xc268('0x18'),_0x515620['message'],_0x222500);_0x288189(_0x507f18[_0xc268('0x14')](0x1f4,_0x515620[_0xc268('0x16')]));});});};exports[_0xc268('0x21')]=function(_0x2c5364){var _0xa482a1=this;return new Promise(function(_0x5d8346,_0x598523){return db[_0xc268('0x19')][_0xc268('0x22')]({'raw':_0x2c5364['options']?_0x2c5364['options'][_0xc268('0x23')]===undefined?!![]:![]:!![],'where':_0x2c5364[_0xc268('0x1b')]?_0x2c5364[_0xc268('0x1b')][_0xc268('0x24')]||null:null,'attributes':_0x2c5364[_0xc268('0x1b')]?_0x2c5364['options']['attributes']||null:null,'include':_0x2c5364[_0xc268('0x1b')]?_0x2c5364[_0xc268('0x1b')][_0xc268('0x1e')]?_[_0xc268('0x1f')](_0x2c5364['options']['include'],function(_0x4573c6){return{'model':db[_0x4573c6[_0xc268('0x20')]],'as':_0x4573c6['as'],'attributes':_0x4573c6[_0xc268('0x1c')],'include':_0x4573c6['include']?_[_0xc268('0x1f')](_0x4573c6[_0xc268('0x1e')],function(_0x463169){return{'model':db[_0x463169[_0xc268('0x20')]],'as':_0x463169['as'],'attributes':_0x463169[_0xc268('0x1c')],'include':_0x463169[_0xc268('0x1e')]?_['map'](_0x463169[_0xc268('0x1e')],function(_0x5267bb){return{'model':db[_0x5267bb['model']],'as':_0x5267bb['as'],'attributes':_0x5267bb['attributes']};}):[]};}):[]};}):[]:[]})[_0xc268('0xe')](function(_0x5d61e8){logger[_0xc268('0xf')](_0xc268('0x21'),_0x2c5364);logger[_0xc268('0x11')](_0xc268('0x21'),_0x2c5364,JSON[_0xc268('0x13')](_0x5d61e8));_0x5d8346(_0x5d61e8);})['catch'](function(_0x144d4b){logger[_0xc268('0x14')](_0xc268('0x21'),_0x144d4b[_0xc268('0x16')],_0x2c5364);_0x598523(_0xa482a1[_0xc268('0x14')](0x1f4,_0x144d4b[_0xc268('0x16')]));});});}; \ No newline at end of file +var _0xb1ef=['client','defaults','redis','localhost','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','options','where','attributes','limit','map','include','model','ShowChatQueue','find','raw','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1ef,0x146));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xfb1e('0x0'));var util=require('util');var moment=require(_0xfb1e('0x1'));var BPromise=require(_0xfb1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb1e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb1e('0x4'));var logger=require(_0xfb1e('0x5'))('rpc');var config=require(_0xfb1e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfb1e('0x7')]['http']({'port':0x232a});config['redis']=_[_0xfb1e('0x8')](config[_0xfb1e('0x9')],{'host':_0xfb1e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb1e('0x9')]));require(_0xfb1e('0xb'))[_0xfb1e('0xc')](socket);function respondWithRpcPromise(_0x512860,_0x3e648b,_0x5e4bfa){return new BPromise(function(_0x301566,_0x228c95){return client['request'](_0x512860,_0x5e4bfa)[_0xfb1e('0xd')](function(_0x273e58){logger[_0xfb1e('0xe')](_0xfb1e('0xf'),_0x3e648b,_0xfb1e('0x10'));logger[_0xfb1e('0x11')](_0xfb1e('0x12'),_0x3e648b,'request\x20sent',JSON[_0xfb1e('0x13')](_0x273e58));if(_0x273e58[_0xfb1e('0x14')]){if(_0x273e58[_0xfb1e('0x14')][_0xfb1e('0x15')]===0x1f4){logger[_0xfb1e('0x14')](_0xfb1e('0xf'),_0x3e648b,_0x273e58['error'][_0xfb1e('0x16')]);return _0x228c95(_0x273e58[_0xfb1e('0x14')]['message']);}logger[_0xfb1e('0x14')](_0xfb1e('0xf'),_0x3e648b,_0x273e58[_0xfb1e('0x14')][_0xfb1e('0x16')]);return _0x301566(_0x273e58[_0xfb1e('0x14')][_0xfb1e('0x16')]);}else{logger[_0xfb1e('0xe')]('ChatQueue,\x20%s,\x20%s',_0x3e648b,_0xfb1e('0x10'));_0x301566(_0x273e58[_0xfb1e('0x17')][_0xfb1e('0x16')]);}})[_0xfb1e('0x18')](function(_0x25f742){logger[_0xfb1e('0x14')](_0xfb1e('0xf'),_0x3e648b,_0x25f742);_0x228c95(_0x25f742);});});}exports[_0xfb1e('0x19')]=function(_0x517ddd){var _0x41c882=this;return new Promise(function(_0x1594de,_0x2b8c7b){return db[_0xfb1e('0x1a')]['findAll']({'raw':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')][_0xfb1e('0x1c')]||null:null,'attributes':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')][_0xfb1e('0x1d')]||null:null,'limit':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')][_0xfb1e('0x1e')]||null:null,'include':_0x517ddd['options']?_0x517ddd['options']['include']?_[_0xfb1e('0x1f')](_0x517ddd['options'][_0xfb1e('0x20')],function(_0x16c328){return{'model':db[_0x16c328[_0xfb1e('0x21')]],'as':_0x16c328['as'],'attributes':_0x16c328[_0xfb1e('0x1d')],'include':_0x16c328[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x16c328[_0xfb1e('0x20')],function(_0x2f6c0f){return{'model':db[_0x2f6c0f['model']],'as':_0x2f6c0f['as'],'attributes':_0x2f6c0f[_0xfb1e('0x1d')],'include':_0x2f6c0f[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x2f6c0f[_0xfb1e('0x20')],function(_0x3b891c){return{'model':db[_0x3b891c['model']],'as':_0x3b891c['as'],'attributes':_0x3b891c[_0xfb1e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfb1e('0xd')](function(_0x1266f6){logger[_0xfb1e('0xe')](_0xfb1e('0x19'),_0x517ddd);logger[_0xfb1e('0x11')](_0xfb1e('0x19'),_0x517ddd,JSON['stringify'](_0x1266f6));_0x1594de(_0x1266f6);})[_0xfb1e('0x18')](function(_0x399de0){logger[_0xfb1e('0x14')](_0xfb1e('0x19'),_0x399de0[_0xfb1e('0x16')],_0x517ddd);_0x2b8c7b(_0x41c882['error'](0x1f4,_0x399de0[_0xfb1e('0x16')]));});});};exports[_0xfb1e('0x22')]=function(_0xd8abfd){var _0x47d5c4=this;return new Promise(function(_0x4aecca,_0x204ad3){return db[_0xfb1e('0x1a')][_0xfb1e('0x23')]({'raw':_0xd8abfd[_0xfb1e('0x1b')]?_0xd8abfd[_0xfb1e('0x1b')][_0xfb1e('0x24')]===undefined?!![]:![]:!![],'where':_0xd8abfd['options']?_0xd8abfd['options'][_0xfb1e('0x1c')]||null:null,'attributes':_0xd8abfd[_0xfb1e('0x1b')]?_0xd8abfd[_0xfb1e('0x1b')]['attributes']||null:null,'include':_0xd8abfd['options']?_0xd8abfd['options'][_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0xd8abfd[_0xfb1e('0x1b')][_0xfb1e('0x20')],function(_0x40024b){return{'model':db[_0x40024b[_0xfb1e('0x21')]],'as':_0x40024b['as'],'attributes':_0x40024b[_0xfb1e('0x1d')],'include':_0x40024b[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x40024b[_0xfb1e('0x20')],function(_0x438ba0){return{'model':db[_0x438ba0[_0xfb1e('0x21')]],'as':_0x438ba0['as'],'attributes':_0x438ba0['attributes'],'include':_0x438ba0[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x438ba0[_0xfb1e('0x20')],function(_0x154b9f){return{'model':db[_0x154b9f[_0xfb1e('0x21')]],'as':_0x154b9f['as'],'attributes':_0x154b9f[_0xfb1e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34dde7){logger[_0xfb1e('0xe')]('ShowChatQueue',_0xd8abfd);logger[_0xfb1e('0x11')](_0xfb1e('0x22'),_0xd8abfd,JSON[_0xfb1e('0x13')](_0x34dde7));_0x4aecca(_0x34dde7);})[_0xfb1e('0x18')](function(_0x586e81){logger['error'](_0xfb1e('0x22'),_0x586e81['message'],_0xd8abfd);_0x204ad3(_0x47d5c4[_0xfb1e('0x14')](0x1f4,_0x586e81['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f3f5492..d59d3a1 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 _0x54ef=['remove','emit','removeListener','length','./chatQueue.events','save'];(function(_0x258e15,_0x15dbf2){var _0x3dc8ad=function(_0x30cfc9){while(--_0x30cfc9){_0x258e15['push'](_0x258e15['shift']());}};_0x3dc8ad(++_0x15dbf2);}(_0x54ef,0x112));var _0xf54e=function(_0xad2c60,_0x606a6){_0xad2c60=_0xad2c60-0x0;var _0x3d5924=_0x54ef[_0xad2c60];return _0x3d5924;};'use strict';var ChatQueueEvents=require(_0xf54e('0x0'));var events=[_0xf54e('0x1'),_0xf54e('0x2'),'update'];function createListener(_0xd936f7,_0x18b7d6){return function(_0x18b1cf){_0x18b7d6[_0xf54e('0x3')](_0xd936f7,_0x18b1cf);};}function removeListener(_0x8b6bb6,_0x431e36){return function(){ChatQueueEvents[_0xf54e('0x4')](_0x8b6bb6,_0x431e36);};}exports['register']=function(_0x55e611){for(var _0x18e84e=0x0,_0x99cf9=events[_0xf54e('0x5')];_0x18e84e<_0x99cf9;_0x18e84e++){var _0x561870=events[_0x18e84e];var _0x27e69b=createListener('chatQueue:'+_0x561870,_0x55e611);ChatQueueEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file +var _0xbd50=['length','./chatQueue.events','save','remove','emit'];(function(_0x4ebd30,_0x27adc3){var _0x5cd4e7=function(_0x5d936e){while(--_0x5d936e){_0x4ebd30['push'](_0x4ebd30['shift']());}};_0x5cd4e7(++_0x27adc3);}(_0xbd50,0x196));var _0x0bd5=function(_0x5ec266,_0x2274b9){_0x5ec266=_0x5ec266-0x0;var _0x386316=_0xbd50[_0x5ec266];return _0x386316;};'use strict';var ChatQueueEvents=require(_0x0bd5('0x0'));var events=[_0x0bd5('0x1'),_0x0bd5('0x2'),'update'];function createListener(_0x44fcb9,_0x167372){return function(_0x37acba){_0x167372[_0x0bd5('0x3')](_0x44fcb9,_0x37acba);};}function removeListener(_0x15620d,_0x4c17ee){return function(){ChatQueueEvents['removeListener'](_0x15620d,_0x4c17ee);};}exports['register']=function(_0x376024){for(var _0x2ef1d0=0x0,_0xcc6cfa=events[_0x0bd5('0x4')];_0x2ef1d0<_0xcc6cfa;_0x2ef1d0++){var _0x1b99f3=events[_0x2ef1d0];var _0x5ebe64=createListener('chatQueue:'+_0x1b99f3,_0x376024);ChatQueueEvents['on'](_0x1b99f3,_0x5ebe64);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 55f0cda..7ea68c8 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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x19e3b2,_0x2dcced){_0x19e3b2=_0x19e3b2-0x0;var _0x31f050=_0x3e74[_0x19e3b2];return _0x31f050;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +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(_0x5a6a3f,_0x313a88){var _0x3b6bc8=function(_0x16bd1a){while(--_0x16bd1a){_0x5a6a3f['push'](_0x5a6a3f['shift']());}};_0x3b6bc8(++_0x313a88);}(_0x55ca,0x126));var _0xa55c=function(_0x569560,_0x16b989){_0x569560=_0x569560-0x0;var _0x3c1de0=_0x55ca[_0x569560];return _0x3c1de0;};'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 107b133..25148ee 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 _0x31ae=['moment','exports','STRING','DATE'];(function(_0x5348a7,_0x1c5759){var _0x14eec4=function(_0x3f91d8){while(--_0x3f91d8){_0x5348a7['push'](_0x5348a7['shift']());}};_0x14eec4(++_0x1c5759);}(_0x31ae,0x15c));var _0xe31a=function(_0x12c50f,_0x29be50){_0x12c50f=_0x12c50f-0x0;var _0x36dc8e=_0x31ae[_0x12c50f];return _0x36dc8e;};'use strict';var moment=require(_0xe31a('0x0'));var Sequelize=require('sequelize');module[_0xe31a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe31a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe31a('0x3')]},'exitAt':{'type':Sequelize[_0xe31a('0x3')]},'reason':{'type':Sequelize[_0xe31a('0x2')]}}; \ No newline at end of file +var _0xc439=['STRING','DATE','moment','sequelize','exports'];(function(_0x23bbf4,_0x37c390){var _0x2f1b95=function(_0x16a7fe){while(--_0x16a7fe){_0x23bbf4['push'](_0x23bbf4['shift']());}};_0x2f1b95(++_0x37c390);}(_0xc439,0x174));var _0x9c43=function(_0x12d88a,_0x53e041){_0x12d88a=_0x12d88a-0x0;var _0x3a8562=_0xc439[_0x12d88a];return _0x3a8562;};'use strict';var moment=require(_0x9c43('0x0'));var Sequelize=require(_0x9c43('0x1'));module[_0x9c43('0x2')]={'uniqueid':{'type':Sequelize[_0x9c43('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9c43('0x3')]},'joinAt':{'type':Sequelize[_0x9c43('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9c43('0x4')]},'reason':{'type':Sequelize[_0x9c43('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b581025..6e48aca 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 _0x10ad=['length','model','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','fast-json-patch','moment','bluebird','mustache','util','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','save','update','then','destroy','end','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields'];(function(_0x37ce3e,_0x248d3d){var _0x506bef=function(_0x2b8292){while(--_0x2b8292){_0x37ce3e['push'](_0x37ce3e['shift']());}};_0x506bef(++_0x248d3d);}(_0x10ad,0xf4));var _0xd10a=function(_0x408a5e,_0x715fad){_0x408a5e=_0x408a5e-0x0;var _0x38ff17=_0x10ad[_0x408a5e];return _0x38ff17;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd10a('0x0'));var rp=require('request-promise');var moment=require(_0xd10a('0x1'));var BPromise=require(_0xd10a('0x2'));var Mustache=require(_0xd10a('0x3'));var util=require(_0xd10a('0x4'));var path=require('path');var sox=require(_0xd10a('0x5'));var csv=require(_0xd10a('0x6'));var ejs=require(_0xd10a('0x7'));var fs=require('fs');var fs_extra=require(_0xd10a('0x8'));var _=require(_0xd10a('0x9'));var squel=require(_0xd10a('0xa'));var crypto=require(_0xd10a('0xb'));var jsforce=require(_0xd10a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd10a('0xd'));var Papa=require('papaparse');var Redis=require(_0xd10a('0xe'));var authService=require(_0xd10a('0xf'));var qs=require(_0xd10a('0x10'));var as=require(_0xd10a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd10a('0x12'))(_0xd10a('0x13'));var utils=require(_0xd10a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd10a('0x15'));var db=require(_0xd10a('0x16'))['db'];function respondWithStatusCode(_0x45441a,_0x42b94d){_0x42b94d=_0x42b94d||0xcc;return function(_0x2142be){if(_0x2142be){return _0x45441a[_0xd10a('0x17')](_0x42b94d);}return _0x45441a['status'](_0x42b94d)['end']();};}function respondWithResult(_0x289066,_0x388c6f){_0x388c6f=_0x388c6f||0xc8;return function(_0x30f838){if(_0x30f838){return _0x289066[_0xd10a('0x18')](_0x388c6f)['json'](_0x30f838);}};}function respondWithFilteredResult(_0x50403e,_0x1c04a7){return function(_0x17fdd7){if(_0x17fdd7){var _0x143557=typeof _0x1c04a7[_0xd10a('0x19')]===_0xd10a('0x1a')&&typeof _0x1c04a7[_0xd10a('0x1b')]===_0xd10a('0x1a');var _0x1ec13f=_0x17fdd7[_0xd10a('0x1c')];var _0x48a07b=_0x143557?0x0:_0x1c04a7['offset'];var _0x40dd9f=_0x143557?_0x17fdd7[_0xd10a('0x1c')]:_0x1c04a7['offset']+_0x1c04a7['limit'];var _0x53ca7c;if(_0x40dd9f>=_0x1ec13f){_0x40dd9f=_0x1ec13f;_0x53ca7c=0xc8;}else{_0x53ca7c=0xce;}_0x50403e[_0xd10a('0x18')](_0x53ca7c);return _0x50403e[_0xd10a('0x1d')]('Content-Range',_0x48a07b+'-'+_0x40dd9f+'/'+_0x1ec13f)[_0xd10a('0x1e')](_0x17fdd7);}return null;};}function patchUpdates(_0x449c8c){return function(_0x48af70){try{jsonpatch['apply'](_0x48af70,_0x449c8c,!![]);}catch(_0x3ff3f0){return BPromise['reject'](_0x3ff3f0);}return _0x48af70[_0xd10a('0x1f')]();};}function saveUpdates(_0x35e066,_0x3b20e6){return function(_0x44d295){if(_0x44d295){return _0x44d295[_0xd10a('0x20')](_0x35e066)[_0xd10a('0x21')](function(_0x5dc935){return _0x5dc935;});}return null;};}function removeEntity(_0x43095a,_0x13eefe){return function(_0x4782c6){if(_0x4782c6){return _0x4782c6[_0xd10a('0x22')]()[_0xd10a('0x21')](function(){_0x43095a[_0xd10a('0x18')](0xcc)[_0xd10a('0x23')]();});}};}function handleEntityNotFound(_0x3715fe,_0x50724d){return function(_0x497a38){if(!_0x497a38){_0x3715fe['sendStatus'](0x194);}return _0x497a38;};}function handleError(_0x2a87ff,_0xaf25b5){_0xaf25b5=_0xaf25b5||0x1f4;return function(_0x58f500){logger[_0xd10a('0x24')](_0x58f500[_0xd10a('0x25')]);if(_0x58f500[_0xd10a('0x26')]){delete _0x58f500[_0xd10a('0x26')];}_0x2a87ff[_0xd10a('0x18')](_0xaf25b5)['send'](_0x58f500);};}exports[_0xd10a('0x27')]=function(_0x198715,_0x11de73){var _0x3c5f47={},_0x41e582={},_0xfede68={'count':0x0,'rows':[]};var _0x23f0ff=_[_0xd10a('0x28')](db[_0xd10a('0x29')][_0xd10a('0x2a')],function(_0xa285ad){return{'name':_0xa285ad[_0xd10a('0x2b')],'type':_0xa285ad[_0xd10a('0x2c')][_0xd10a('0x2d')]};});_0x41e582['model']=_['map'](_0x23f0ff,_0xd10a('0x26'));_0x41e582[_0xd10a('0x2e')]=_[_0xd10a('0x2f')](_0x198715[_0xd10a('0x2e')]);_0x41e582[_0xd10a('0x30')]=_[_0xd10a('0x31')](_0x41e582['model'],_0x41e582[_0xd10a('0x2e')]);_0x3c5f47[_0xd10a('0x32')]=_['intersection'](_0x41e582['model'],qs[_0xd10a('0x33')](_0x198715[_0xd10a('0x2e')][_0xd10a('0x33')]));_0x3c5f47[_0xd10a('0x32')]=_0x3c5f47['attributes'][_0xd10a('0x34')]?_0x3c5f47['attributes']:_0x41e582[_0xd10a('0x35')];if(!_0x198715['query']['hasOwnProperty'](_0xd10a('0x36'))){_0x3c5f47[_0xd10a('0x1b')]=qs[_0xd10a('0x1b')](_0x198715['query'][_0xd10a('0x1b')]);_0x3c5f47['offset']=qs[_0xd10a('0x19')](_0x198715[_0xd10a('0x2e')][_0xd10a('0x19')]);}_0x3c5f47[_0xd10a('0x37')]=qs[_0xd10a('0x38')](_0x198715[_0xd10a('0x2e')][_0xd10a('0x38')]);_0x3c5f47['where']=qs[_0xd10a('0x30')](_[_0xd10a('0x39')](_0x198715[_0xd10a('0x2e')],_0x41e582[_0xd10a('0x30')]),_0x23f0ff);if(_0x198715['query'][_0xd10a('0x3a')]){_0x3c5f47[_0xd10a('0x3b')]=_[_0xd10a('0x3c')](_0x3c5f47['where'],{'$or':_['map'](_0x23f0ff,function(_0x42f0a2){if(_0x42f0a2[_0xd10a('0x2c')]!==_0xd10a('0x3d')){var _0x1100f0={};_0x1100f0[_0x42f0a2['name']]={'$like':'%'+_0x198715[_0xd10a('0x2e')]['filter']+'%'};return _0x1100f0;}})});}_0x3c5f47=_[_0xd10a('0x3c')]({},_0x3c5f47,_0x198715[_0xd10a('0x3e')]);var _0x46720a={'where':_0x3c5f47[_0xd10a('0x3b')]};return db[_0xd10a('0x29')][_0xd10a('0x1c')](_0x46720a)[_0xd10a('0x21')](function(_0x5c48aa){_0xfede68[_0xd10a('0x1c')]=_0x5c48aa;if(_0x198715['query']['includeAll']){_0x3c5f47[_0xd10a('0x3f')]=[{'all':!![]}];}return db[_0xd10a('0x29')][_0xd10a('0x40')](_0x3c5f47);})[_0xd10a('0x21')](function(_0x4c14a7){_0xfede68[_0xd10a('0x41')]=_0x4c14a7;return _0xfede68;})[_0xd10a('0x21')](respondWithFilteredResult(_0x11de73,_0x3c5f47))[_0xd10a('0x42')](handleError(_0x11de73,null));};exports[_0xd10a('0x43')]=function(_0x2af23e,_0x3c74e1){var _0x39e48b={'raw':!![],'where':{'id':_0x2af23e[_0xd10a('0x44')]['id']}},_0x32505c={};_0x32505c[_0xd10a('0x35')]=_[_0xd10a('0x2f')](db['ChatQueueReport'][_0xd10a('0x2a')]);_0x32505c[_0xd10a('0x2e')]=_[_0xd10a('0x2f')](_0x2af23e[_0xd10a('0x2e')]);_0x32505c[_0xd10a('0x30')]=_[_0xd10a('0x31')](_0x32505c[_0xd10a('0x35')],_0x32505c['query']);_0x39e48b[_0xd10a('0x32')]=_[_0xd10a('0x31')](_0x32505c[_0xd10a('0x35')],qs[_0xd10a('0x33')](_0x2af23e[_0xd10a('0x2e')]['fields']));_0x39e48b[_0xd10a('0x32')]=_0x39e48b[_0xd10a('0x32')][_0xd10a('0x34')]?_0x39e48b[_0xd10a('0x32')]:_0x32505c[_0xd10a('0x35')];if(_0x2af23e[_0xd10a('0x2e')][_0xd10a('0x45')]){_0x39e48b[_0xd10a('0x3f')]=[{'all':!![]}];}_0x39e48b=_[_0xd10a('0x3c')]({},_0x39e48b,_0x2af23e[_0xd10a('0x3e')]);return db[_0xd10a('0x29')][_0xd10a('0x46')](_0x39e48b)[_0xd10a('0x21')](handleEntityNotFound(_0x3c74e1,null))[_0xd10a('0x21')](respondWithResult(_0x3c74e1,null))[_0xd10a('0x42')](handleError(_0x3c74e1,null));};exports['create']=function(_0x2aa46a,_0xe55621){return db[_0xd10a('0x29')][_0xd10a('0x47')](_0x2aa46a[_0xd10a('0x48')],{})['then'](respondWithResult(_0xe55621,0xc9))[_0xd10a('0x42')](handleError(_0xe55621,null));};exports[_0xd10a('0x20')]=function(_0x429494,_0x807b4a){if(_0x429494[_0xd10a('0x48')]['id']){delete _0x429494[_0xd10a('0x48')]['id'];}return db[_0xd10a('0x29')][_0xd10a('0x46')]({'where':{'id':_0x429494[_0xd10a('0x44')]['id']}})[_0xd10a('0x21')](handleEntityNotFound(_0x807b4a,null))[_0xd10a('0x21')](saveUpdates(_0x429494[_0xd10a('0x48')],null))[_0xd10a('0x21')](respondWithResult(_0x807b4a,null))[_0xd10a('0x42')](handleError(_0x807b4a,null));};exports[_0xd10a('0x22')]=function(_0x1abc93,_0x2c5d67){return db[_0xd10a('0x29')]['find']({'where':{'id':_0x1abc93['params']['id']}})['then'](handleEntityNotFound(_0x2c5d67,null))[_0xd10a('0x21')](removeEntity(_0x2c5d67,null))[_0xd10a('0x42')](handleError(_0x2c5d67,null));};exports['describe']=function(_0x2091a9,_0x448421){return db[_0xd10a('0x29')][_0xd10a('0x49')]()['then'](respondWithResult(_0x448421,null))[_0xd10a('0x42')](handleError(_0x448421,null));}; \ No newline at end of file +var _0x804d=['apply','reject','destroy','end','error','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','filter','count','includeAll','include','findAll','then','rows','catch','show','intersection','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set'];(function(_0x1c8da6,_0xaabe8a){var _0x310260=function(_0x5deba3){while(--_0x5deba3){_0x1c8da6['push'](_0x1c8da6['shift']());}};_0x310260(++_0xaabe8a);}(_0x804d,0x116));var _0xd804=function(_0x1554e6,_0x28607d){_0x1554e6=_0x1554e6-0x0;var _0x4cafbf=_0x804d[_0x1554e6];return _0x4cafbf;};'use strict';var emlformat=require(_0xd804('0x0'));var rimraf=require(_0xd804('0x1'));var zipdir=require(_0xd804('0x2'));var jsonpatch=require(_0xd804('0x3'));var rp=require(_0xd804('0x4'));var moment=require(_0xd804('0x5'));var BPromise=require(_0xd804('0x6'));var Mustache=require(_0xd804('0x7'));var util=require('util');var path=require(_0xd804('0x8'));var sox=require(_0xd804('0x9'));var csv=require(_0xd804('0xa'));var ejs=require(_0xd804('0xb'));var fs=require('fs');var fs_extra=require(_0xd804('0xc'));var _=require(_0xd804('0xd'));var squel=require(_0xd804('0xe'));var crypto=require(_0xd804('0xf'));var jsforce=require(_0xd804('0x10'));var deskjs=require(_0xd804('0x11'));var toCsv=require(_0xd804('0xa'));var querystring=require(_0xd804('0x12'));var Papa=require('papaparse');var Redis=require(_0xd804('0x13'));var authService=require(_0xd804('0x14'));var qs=require(_0xd804('0x15'));var as=require(_0xd804('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd804('0x17'));var utils=require(_0xd804('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd804('0x19'));var db=require(_0xd804('0x1a'))['db'];function respondWithStatusCode(_0x4fff76,_0x1d5594){_0x1d5594=_0x1d5594||0xcc;return function(_0x2dd4e5){if(_0x2dd4e5){return _0x4fff76[_0xd804('0x1b')](_0x1d5594);}return _0x4fff76['status'](_0x1d5594)['end']();};}function respondWithResult(_0x31b189,_0x3298f5){_0x3298f5=_0x3298f5||0xc8;return function(_0xcec83){if(_0xcec83){return _0x31b189[_0xd804('0x1c')](_0x3298f5)[_0xd804('0x1d')](_0xcec83);}};}function respondWithFilteredResult(_0x5ee270,_0x18c4a0){return function(_0x30be96){if(_0x30be96){var _0x597be3=typeof _0x18c4a0[_0xd804('0x1e')]===_0xd804('0x1f')&&typeof _0x18c4a0[_0xd804('0x20')]==='undefined';var _0x335203=_0x30be96['count'];var _0x421ddb=_0x597be3?0x0:_0x18c4a0[_0xd804('0x1e')];var _0x13fa46=_0x597be3?_0x30be96['count']:_0x18c4a0[_0xd804('0x1e')]+_0x18c4a0[_0xd804('0x20')];var _0x398f79;if(_0x13fa46>=_0x335203){_0x13fa46=_0x335203;_0x398f79=0xc8;}else{_0x398f79=0xce;}_0x5ee270[_0xd804('0x1c')](_0x398f79);return _0x5ee270[_0xd804('0x21')]('Content-Range',_0x421ddb+'-'+_0x13fa46+'/'+_0x335203)['json'](_0x30be96);}return null;};}function patchUpdates(_0x37021f){return function(_0x5425f0){try{jsonpatch[_0xd804('0x22')](_0x5425f0,_0x37021f,!![]);}catch(_0x103f52){return BPromise[_0xd804('0x23')](_0x103f52);}return _0x5425f0['save']();};}function saveUpdates(_0x29a3b4,_0x5dd939){return function(_0x18d28c){if(_0x18d28c){return _0x18d28c['update'](_0x29a3b4)['then'](function(_0x52c85c){return _0x52c85c;});}return null;};}function removeEntity(_0x51b191,_0x2cde57){return function(_0x2fc18b){if(_0x2fc18b){return _0x2fc18b[_0xd804('0x24')]()['then'](function(){_0x51b191[_0xd804('0x1c')](0xcc)[_0xd804('0x25')]();});}};}function handleEntityNotFound(_0x2a2502,_0x35bfef){return function(_0x5045a1){if(!_0x5045a1){_0x2a2502[_0xd804('0x1b')](0x194);}return _0x5045a1;};}function handleError(_0x11d2c4,_0x5da178){_0x5da178=_0x5da178||0x1f4;return function(_0x38a6f6){logger[_0xd804('0x26')](_0x38a6f6['stack']);if(_0x38a6f6['name']){delete _0x38a6f6['name'];}_0x11d2c4[_0xd804('0x1c')](_0x5da178)[_0xd804('0x27')](_0x38a6f6);};}exports[_0xd804('0x28')]=function(_0x570990,_0x225615){var _0x28a26f={},_0x1858f0={},_0x1f4234={'count':0x0,'rows':[]};var _0x473588=_[_0xd804('0x29')](db[_0xd804('0x2a')][_0xd804('0x2b')],function(_0x5b197a){return{'name':_0x5b197a[_0xd804('0x2c')],'type':_0x5b197a[_0xd804('0x2d')][_0xd804('0x2e')]};});_0x1858f0[_0xd804('0x2f')]=_[_0xd804('0x29')](_0x473588,_0xd804('0x30'));_0x1858f0[_0xd804('0x31')]=_[_0xd804('0x32')](_0x570990[_0xd804('0x31')]);_0x1858f0[_0xd804('0x33')]=_['intersection'](_0x1858f0['model'],_0x1858f0[_0xd804('0x31')]);_0x28a26f[_0xd804('0x34')]=_['intersection'](_0x1858f0['model'],qs[_0xd804('0x35')](_0x570990['query']['fields']));_0x28a26f[_0xd804('0x34')]=_0x28a26f[_0xd804('0x34')][_0xd804('0x36')]?_0x28a26f[_0xd804('0x34')]:_0x1858f0[_0xd804('0x2f')];if(!_0x570990[_0xd804('0x31')][_0xd804('0x37')](_0xd804('0x38'))){_0x28a26f['limit']=qs[_0xd804('0x20')](_0x570990['query'][_0xd804('0x20')]);_0x28a26f[_0xd804('0x1e')]=qs[_0xd804('0x1e')](_0x570990[_0xd804('0x31')][_0xd804('0x1e')]);}_0x28a26f['order']=qs['sort'](_0x570990['query'][_0xd804('0x39')]);_0x28a26f['where']=qs[_0xd804('0x33')](_[_0xd804('0x3a')](_0x570990[_0xd804('0x31')],_0x1858f0[_0xd804('0x33')]),_0x473588);if(_0x570990[_0xd804('0x31')]['filter']){_0x28a26f['where']=_[_0xd804('0x3b')](_0x28a26f[_0xd804('0x3c')],{'$or':_[_0xd804('0x29')](_0x473588,function(_0x46018c){if(_0x46018c['type']!=='VIRTUAL'){var _0x24c0a1={};_0x24c0a1[_0x46018c[_0xd804('0x30')]]={'$like':'%'+_0x570990[_0xd804('0x31')][_0xd804('0x3d')]+'%'};return _0x24c0a1;}})});}_0x28a26f=_['merge']({},_0x28a26f,_0x570990['options']);var _0x5628cf={'where':_0x28a26f[_0xd804('0x3c')]};return db[_0xd804('0x2a')][_0xd804('0x3e')](_0x5628cf)['then'](function(_0x293aee){_0x1f4234['count']=_0x293aee;if(_0x570990[_0xd804('0x31')][_0xd804('0x3f')]){_0x28a26f[_0xd804('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xd804('0x41')](_0x28a26f);})[_0xd804('0x42')](function(_0xd13bf0){_0x1f4234[_0xd804('0x43')]=_0xd13bf0;return _0x1f4234;})['then'](respondWithFilteredResult(_0x225615,_0x28a26f))[_0xd804('0x44')](handleError(_0x225615,null));};exports[_0xd804('0x45')]=function(_0x14099b,_0xadfde0){var _0x45c011={'raw':!![],'where':{'id':_0x14099b['params']['id']}},_0x409278={};_0x409278['model']=_[_0xd804('0x32')](db['ChatQueueReport'][_0xd804('0x2b')]);_0x409278[_0xd804('0x31')]=_[_0xd804('0x32')](_0x14099b[_0xd804('0x31')]);_0x409278[_0xd804('0x33')]=_[_0xd804('0x46')](_0x409278[_0xd804('0x2f')],_0x409278[_0xd804('0x31')]);_0x45c011[_0xd804('0x34')]=_['intersection'](_0x409278['model'],qs[_0xd804('0x35')](_0x14099b[_0xd804('0x31')][_0xd804('0x35')]));_0x45c011[_0xd804('0x34')]=_0x45c011['attributes']['length']?_0x45c011[_0xd804('0x34')]:_0x409278['model'];if(_0x14099b[_0xd804('0x31')][_0xd804('0x3f')]){_0x45c011[_0xd804('0x40')]=[{'all':!![]}];}_0x45c011=_[_0xd804('0x3b')]({},_0x45c011,_0x14099b[_0xd804('0x47')]);return db[_0xd804('0x2a')][_0xd804('0x48')](_0x45c011)[_0xd804('0x42')](handleEntityNotFound(_0xadfde0,null))['then'](respondWithResult(_0xadfde0,null))[_0xd804('0x44')](handleError(_0xadfde0,null));};exports[_0xd804('0x49')]=function(_0x504f76,_0x12a15b){return db[_0xd804('0x2a')]['create'](_0x504f76[_0xd804('0x4a')],{})['then'](respondWithResult(_0x12a15b,0xc9))[_0xd804('0x44')](handleError(_0x12a15b,null));};exports[_0xd804('0x4b')]=function(_0x514eb2,_0x2f0146){if(_0x514eb2[_0xd804('0x4a')]['id']){delete _0x514eb2['body']['id'];}return db[_0xd804('0x2a')][_0xd804('0x48')]({'where':{'id':_0x514eb2[_0xd804('0x4c')]['id']}})[_0xd804('0x42')](handleEntityNotFound(_0x2f0146,null))[_0xd804('0x42')](saveUpdates(_0x514eb2[_0xd804('0x4a')],null))[_0xd804('0x42')](respondWithResult(_0x2f0146,null))[_0xd804('0x44')](handleError(_0x2f0146,null));};exports[_0xd804('0x24')]=function(_0x4d988d,_0x187cf2){return db['ChatQueueReport'][_0xd804('0x48')]({'where':{'id':_0x4d988d[_0xd804('0x4c')]['id']}})[_0xd804('0x42')](handleEntityNotFound(_0x187cf2,null))[_0xd804('0x42')](removeEntity(_0x187cf2,null))[_0xd804('0x44')](handleError(_0x187cf2,null));};exports[_0xd804('0x4d')]=function(_0x4399fc,_0x20bf43){return db[_0xd804('0x2a')]['describe']()[_0xd804('0x42')](respondWithResult(_0x20bf43,null))[_0xd804('0x44')](handleError(_0x20bf43,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 067e7d9..8838ee3 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x44c49d,_0x520b61){var _0x1a7141=function(_0x33a588){while(--_0x33a588){_0x44c49d['push'](_0x44c49d['shift']());}};_0x1a7141(++_0x520b61);}(_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('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x5d09de,_0x352295){var _0x1f3575=function(_0x58384a){while(--_0x58384a){_0x5d09de['push'](_0x5d09de['shift']());}};_0x1f3575(++_0x352295);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0xcb91[_0x19efbc];return _0x205c5e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 236ba8b..ea3bd54 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 _0x4974=['http','request','then','request\x20sent','debug','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','info','result','catch','ChatQueueReport','create','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update','body','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1f3a70,_0x32c4ff){var _0x2903b4=function(_0x5aa5d1){while(--_0x5aa5d1){_0x1f3a70['push'](_0x1f3a70['shift']());}};_0x2903b4(++_0x32c4ff);}(_0x4974,0x147));var _0x4497=function(_0x4631f7,_0xecb55f){_0x4631f7=_0x4631f7-0x0;var _0x3fa0ae=_0x4974[_0x4631f7];return _0x3fa0ae;};'use strict';var _=require(_0x4497('0x0'));var util=require(_0x4497('0x1'));var moment=require(_0x4497('0x2'));var BPromise=require(_0x4497('0x3'));var rs=require(_0x4497('0x4'));var fs=require('fs');var Redis=require(_0x4497('0x5'));var db=require(_0x4497('0x6'))['db'];var utils=require(_0x4497('0x7'));var logger=require(_0x4497('0x8'))(_0x4497('0x9'));var config=require(_0x4497('0xa'));var jayson=require(_0x4497('0xb'));var client=jayson[_0x4497('0xc')][_0x4497('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x6bce0a,_0x35ff0a,_0x5e8d36){return new BPromise(function(_0x5681c5,_0x3301a2){return client[_0x4497('0xe')](_0x6bce0a,_0x5e8d36)[_0x4497('0xf')](function(_0x5c5461){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x35ff0a,_0x4497('0x10'));logger[_0x4497('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x35ff0a,'request\x20sent',JSON[_0x4497('0x12')](_0x5c5461));if(_0x5c5461[_0x4497('0x13')]){if(_0x5c5461['error']['code']===0x1f4){logger['error'](_0x4497('0x14'),_0x35ff0a,_0x5c5461[_0x4497('0x13')][_0x4497('0x15')]);return _0x3301a2(_0x5c5461[_0x4497('0x13')][_0x4497('0x15')]);}logger[_0x4497('0x13')](_0x4497('0x14'),_0x35ff0a,_0x5c5461[_0x4497('0x13')]['message']);return _0x5681c5(_0x5c5461[_0x4497('0x13')][_0x4497('0x15')]);}else{logger[_0x4497('0x16')](_0x4497('0x14'),_0x35ff0a,_0x4497('0x10'));_0x5681c5(_0x5c5461[_0x4497('0x17')][_0x4497('0x15')]);}})[_0x4497('0x18')](function(_0x38ca30){logger[_0x4497('0x13')](_0x4497('0x14'),_0x35ff0a,_0x38ca30);_0x3301a2(_0x38ca30);});});}exports['CreateChatQueueReport']=function(_0x3d1134){var _0x1df017=this;return new Promise(function(_0x44c510,_0x55a597){return db[_0x4497('0x19')][_0x4497('0x1a')](_0x3d1134['body'],{'raw':_0x3d1134[_0x4497('0x1b')]?_0x3d1134[_0x4497('0x1b')][_0x4497('0x1c')]===undefined?!![]:![]:!![]})[_0x4497('0xf')](function(_0x178051){logger[_0x4497('0x16')]('CreateChatQueueReport',_0x3d1134);logger[_0x4497('0x11')](_0x4497('0x1d'),_0x3d1134,JSON['stringify'](_0x178051));_0x44c510(_0x178051);})[_0x4497('0x18')](function(_0x571420){logger['error'](_0x4497('0x1d'),_0x571420[_0x4497('0x15')],_0x3d1134);_0x55a597(_0x1df017[_0x4497('0x13')](0x1f4,_0x571420['message']));});});};exports[_0x4497('0x1e')]=function(_0x2e3780){var _0x37357c=this;return new Promise(function(_0x530843,_0x51eafe){return db[_0x4497('0x19')][_0x4497('0x1f')](_0x2e3780[_0x4497('0x20')],{'raw':_0x2e3780[_0x4497('0x1b')]?_0x2e3780[_0x4497('0x1b')][_0x4497('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e3780[_0x4497('0x1b')]?_0x2e3780['options']['where']||null:null,'attributes':_0x2e3780['options']?_0x2e3780[_0x4497('0x1b')][_0x4497('0x21')]||null:null,'limit':_0x2e3780[_0x4497('0x1b')]?_0x2e3780[_0x4497('0x1b')]['limit']||null:null})[_0x4497('0xf')](function(_0x643d97){logger['info'](_0x4497('0x1e'),_0x2e3780);logger[_0x4497('0x11')]('UpdateChatQueueReport',_0x2e3780,JSON['stringify'](_0x643d97));_0x530843(_0x643d97);})[_0x4497('0x18')](function(_0x47053c){logger[_0x4497('0x13')](_0x4497('0x1e'),_0x47053c[_0x4497('0x15')],_0x2e3780);_0x51eafe(_0x37357c['error'](0x1f4,_0x47053c[_0x4497('0x15')]));});});}; \ No newline at end of file +var _0x52b0=['ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','result','CreateChatQueueReport','ChatQueueReport','body','options','raw','then','debug','catch','update','UpdateChatQueueReport','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request\x20sent'];(function(_0xac6666,_0x1fdd85){var _0x9e59f3=function(_0x59473f){while(--_0x59473f){_0xac6666['push'](_0xac6666['shift']());}};_0x9e59f3(++_0x1fdd85);}(_0x52b0,0x17e));var _0x052b=function(_0x359d1b,_0x4dbc97){_0x359d1b=_0x359d1b-0x0;var _0x39fc0c=_0x52b0[_0x359d1b];return _0x39fc0c;};'use strict';var _=require(_0x052b('0x0'));var util=require(_0x052b('0x1'));var moment=require(_0x052b('0x2'));var BPromise=require('bluebird');var rs=require(_0x052b('0x3'));var fs=require('fs');var Redis=require(_0x052b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x052b('0x5'));var config=require(_0x052b('0x6'));var jayson=require(_0x052b('0x7'));var client=jayson[_0x052b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37f762,_0x1bd332,_0x13f952){return new BPromise(function(_0x313177,_0x15c5e6){return client['request'](_0x37f762,_0x13f952)['then'](function(_0x3cf3e5){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x1bd332,_0x052b('0x9'));logger['debug'](_0x052b('0xa'),_0x1bd332,'request\x20sent',JSON[_0x052b('0xb')](_0x3cf3e5));if(_0x3cf3e5[_0x052b('0xc')]){if(_0x3cf3e5['error'][_0x052b('0xd')]===0x1f4){logger[_0x052b('0xc')](_0x052b('0xe'),_0x1bd332,_0x3cf3e5[_0x052b('0xc')][_0x052b('0xf')]);return _0x15c5e6(_0x3cf3e5[_0x052b('0xc')][_0x052b('0xf')]);}logger[_0x052b('0xc')](_0x052b('0xe'),_0x1bd332,_0x3cf3e5[_0x052b('0xc')][_0x052b('0xf')]);return _0x313177(_0x3cf3e5['error'][_0x052b('0xf')]);}else{logger[_0x052b('0x10')](_0x052b('0xe'),_0x1bd332,_0x052b('0x9'));_0x313177(_0x3cf3e5[_0x052b('0x11')]['message']);}})['catch'](function(_0x14b572){logger['error'](_0x052b('0xe'),_0x1bd332,_0x14b572);_0x15c5e6(_0x14b572);});});}exports[_0x052b('0x12')]=function(_0x2a0691){var _0x190375=this;return new Promise(function(_0x60841e,_0x5bf03b){return db[_0x052b('0x13')]['create'](_0x2a0691[_0x052b('0x14')],{'raw':_0x2a0691[_0x052b('0x15')]?_0x2a0691[_0x052b('0x15')][_0x052b('0x16')]===undefined?!![]:![]:!![]})[_0x052b('0x17')](function(_0x54b247){logger[_0x052b('0x10')](_0x052b('0x12'),_0x2a0691);logger[_0x052b('0x18')](_0x052b('0x12'),_0x2a0691,JSON['stringify'](_0x54b247));_0x60841e(_0x54b247);})[_0x052b('0x19')](function(_0x2cb914){logger[_0x052b('0xc')](_0x052b('0x12'),_0x2cb914['message'],_0x2a0691);_0x5bf03b(_0x190375[_0x052b('0xc')](0x1f4,_0x2cb914[_0x052b('0xf')]));});});};exports['UpdateChatQueueReport']=function(_0x30f727){var _0x4d6f7f=this;return new Promise(function(_0x4bba82,_0x554005){return db[_0x052b('0x13')][_0x052b('0x1a')](_0x30f727['body'],{'raw':_0x30f727[_0x052b('0x15')]?_0x30f727[_0x052b('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30f727[_0x052b('0x15')]?_0x30f727['options']['where']||null:null,'attributes':_0x30f727['options']?_0x30f727['options']['attributes']||null:null,'limit':_0x30f727['options']?_0x30f727[_0x052b('0x15')]['limit']||null:null})[_0x052b('0x17')](function(_0x9e6203){logger['info']('UpdateChatQueueReport',_0x30f727);logger[_0x052b('0x18')](_0x052b('0x1b'),_0x30f727,JSON[_0x052b('0xb')](_0x9e6203));_0x4bba82(_0x9e6203);})['catch'](function(_0x5e7594){logger['error'](_0x052b('0x1b'),_0x5e7594[_0x052b('0xf')],_0x30f727);_0x554005(_0x4d6f7f['error'](0x1f4,_0x5e7594[_0x052b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8722965..c92997a 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 _0x998e=['show','post','create','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x998e,0x1be));var _0xe998=function(_0x3a90cb,_0x5e413c){_0x3a90cb=_0x3a90cb-0x0;var _0x8b42fd=_0x998e[_0x3a90cb];return _0x8b42fd;};'use strict';var multer=require(_0xe998('0x0'));var util=require(_0xe998('0x1'));var path=require(_0xe998('0x2'));var timeout=require(_0xe998('0x3'));var express=require(_0xe998('0x4'));var router=express[_0xe998('0x5')]();var fs_extra=require(_0xe998('0x6'));var auth=require(_0xe998('0x7'));var interaction=require(_0xe998('0x8'));var config=require('../../config/environment');var controller=require(_0xe998('0x9'));router[_0xe998('0xa')]('/',auth[_0xe998('0xb')](),controller[_0xe998('0xc')]);router[_0xe998('0xa')](_0xe998('0xd'),auth[_0xe998('0xb')](),controller[_0xe998('0xe')]);router[_0xe998('0xa')](_0xe998('0xf'),auth[_0xe998('0xb')](),controller[_0xe998('0x10')]);router[_0xe998('0x11')]('/',auth[_0xe998('0xb')](),controller[_0xe998('0x12')]);router['put'](_0xe998('0xf'),auth[_0xe998('0xb')](),controller[_0xe998('0x13')]);router['delete'](_0xe998('0xf'),auth[_0xe998('0xb')](),controller[_0xe998('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2da3=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2da3,0x1b3));var _0x32da=function(_0x2ee53b,_0x10e949){_0x2ee53b=_0x2ee53b-0x0;var _0x34bd72=_0x2da3[_0x2ee53b];return _0x34bd72;};'use strict';var multer=require(_0x32da('0x0'));var util=require(_0x32da('0x1'));var path=require(_0x32da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x32da('0x3')]();var fs_extra=require(_0x32da('0x4'));var auth=require(_0x32da('0x5'));var interaction=require(_0x32da('0x6'));var config=require(_0x32da('0x7'));var controller=require(_0x32da('0x8'));router[_0x32da('0x9')]('/',auth[_0x32da('0xa')](),controller['index']);router[_0x32da('0x9')](_0x32da('0xb'),auth[_0x32da('0xa')](),controller[_0x32da('0xc')]);router[_0x32da('0x9')](_0x32da('0xd'),auth[_0x32da('0xa')](),controller[_0x32da('0xe')]);router[_0x32da('0xf')]('/',auth['isAuthenticated'](),controller[_0x32da('0x10')]);router['put']('/:id',auth[_0x32da('0xa')](),controller['update']);router[_0x32da('0x11')](_0x32da('0xd'),auth[_0x32da('0xa')](),controller[_0x32da('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index a81d680..53be4e7 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x503699,_0x152145){var _0xd66c82=function(_0x48c6e7){while(--_0x48c6e7){_0x503699['push'](_0x503699['shift']());}};_0xd66c82(++_0x152145);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x41facc,_0x1d2cc4){var _0xe521cd=function(_0x59c537){while(--_0x59c537){_0x41facc['push'](_0x41facc['shift']());}};_0xe521cd(++_0x1d2cc4);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index f199652..349e823 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 _0xb497=['fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','name','map','ChatTransferReport','fieldName','type','model','query','filters','intersection','attributes'];(function(_0xc8a692,_0x579320){var _0x5055d8=function(_0x528459){while(--_0x528459){_0xc8a692['push'](_0xc8a692['shift']());}};_0x5055d8(++_0x579320);}(_0xb497,0x9f));var _0x7b49=function(_0x256d9f,_0x447342){_0x256d9f=_0x256d9f-0x0;var _0x36ec91=_0xb497[_0x256d9f];return _0x36ec91;};'use strict';var emlformat=require(_0x7b49('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7b49('0x1'));var rp=require('request-promise');var moment=require(_0x7b49('0x2'));var BPromise=require(_0x7b49('0x3'));var Mustache=require(_0x7b49('0x4'));var util=require(_0x7b49('0x5'));var path=require(_0x7b49('0x6'));var sox=require(_0x7b49('0x7'));var csv=require(_0x7b49('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b49('0x9'));var _=require(_0x7b49('0xa'));var squel=require(_0x7b49('0xb'));var crypto=require(_0x7b49('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7b49('0x8'));var querystring=require(_0x7b49('0xd'));var Papa=require(_0x7b49('0xe'));var Redis=require('ioredis');var authService=require(_0x7b49('0xf'));var qs=require(_0x7b49('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b49('0x11'));var logger=require(_0x7b49('0x12'))(_0x7b49('0x13'));var utils=require(_0x7b49('0x14'));var config=require(_0x7b49('0x15'));var licenseUtil=require(_0x7b49('0x16'));var db=require(_0x7b49('0x17'))['db'];function respondWithStatusCode(_0x4e315d,_0x389545){_0x389545=_0x389545||0xcc;return function(_0x3ac94b){if(_0x3ac94b){return _0x4e315d[_0x7b49('0x18')](_0x389545);}return _0x4e315d[_0x7b49('0x19')](_0x389545)[_0x7b49('0x1a')]();};}function respondWithResult(_0x1e8e79,_0x92fc6e){_0x92fc6e=_0x92fc6e||0xc8;return function(_0x3e8b5e){if(_0x3e8b5e){return _0x1e8e79[_0x7b49('0x19')](_0x92fc6e)['json'](_0x3e8b5e);}};}function respondWithFilteredResult(_0x49f0b5,_0x38c899){return function(_0x56bdeb){if(_0x56bdeb){var _0x21b096=typeof _0x38c899[_0x7b49('0x1b')]===_0x7b49('0x1c')&&typeof _0x38c899[_0x7b49('0x1d')]===_0x7b49('0x1c');var _0x179334=_0x56bdeb[_0x7b49('0x1e')];var _0x351b6e=_0x21b096?0x0:_0x38c899['offset'];var _0x41c1db=_0x21b096?_0x56bdeb[_0x7b49('0x1e')]:_0x38c899[_0x7b49('0x1b')]+_0x38c899[_0x7b49('0x1d')];var _0x49446a;if(_0x41c1db>=_0x179334){_0x41c1db=_0x179334;_0x49446a=0xc8;}else{_0x49446a=0xce;}_0x49f0b5[_0x7b49('0x19')](_0x49446a);return _0x49f0b5[_0x7b49('0x1f')](_0x7b49('0x20'),_0x351b6e+'-'+_0x41c1db+'/'+_0x179334)[_0x7b49('0x21')](_0x56bdeb);}return null;};}function patchUpdates(_0x16e436){return function(_0x4a6b25){try{jsonpatch[_0x7b49('0x22')](_0x4a6b25,_0x16e436,!![]);}catch(_0x13707b){return BPromise[_0x7b49('0x23')](_0x13707b);}return _0x4a6b25['save']();};}function saveUpdates(_0x3d6718,_0x17be39){return function(_0x181d97){if(_0x181d97){return _0x181d97[_0x7b49('0x24')](_0x3d6718)[_0x7b49('0x25')](function(_0x437b69){return _0x437b69;});}return null;};}function removeEntity(_0x4cc960,_0x465522){return function(_0x1e46bb){if(_0x1e46bb){return _0x1e46bb['destroy']()['then'](function(){_0x4cc960[_0x7b49('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7c8651,_0x32412d){return function(_0x3f53f9){if(!_0x3f53f9){_0x7c8651[_0x7b49('0x18')](0x194);}return _0x3f53f9;};}function handleError(_0x526c69,_0x3581e7){_0x3581e7=_0x3581e7||0x1f4;return function(_0x64ad10){logger['error'](_0x64ad10['stack']);if(_0x64ad10[_0x7b49('0x26')]){delete _0x64ad10['name'];}_0x526c69[_0x7b49('0x19')](_0x3581e7)['send'](_0x64ad10);};}exports['index']=function(_0x513c12,_0x275c3e){var _0x4c1a66={},_0x59da61={},_0x497831={'count':0x0,'rows':[]};var _0x1e035e=_[_0x7b49('0x27')](db[_0x7b49('0x28')]['rawAttributes'],function(_0x1078ab){return{'name':_0x1078ab[_0x7b49('0x29')],'type':_0x1078ab[_0x7b49('0x2a')]['key']};});_0x59da61[_0x7b49('0x2b')]=_[_0x7b49('0x27')](_0x1e035e,_0x7b49('0x26'));_0x59da61[_0x7b49('0x2c')]=_['keys'](_0x513c12[_0x7b49('0x2c')]);_0x59da61[_0x7b49('0x2d')]=_[_0x7b49('0x2e')](_0x59da61['model'],_0x59da61[_0x7b49('0x2c')]);_0x4c1a66[_0x7b49('0x2f')]=_[_0x7b49('0x2e')](_0x59da61[_0x7b49('0x2b')],qs[_0x7b49('0x30')](_0x513c12[_0x7b49('0x2c')][_0x7b49('0x30')]));_0x4c1a66[_0x7b49('0x2f')]=_0x4c1a66['attributes'][_0x7b49('0x31')]?_0x4c1a66[_0x7b49('0x2f')]:_0x59da61[_0x7b49('0x2b')];if(!_0x513c12[_0x7b49('0x2c')][_0x7b49('0x32')]('nolimit')){_0x4c1a66['limit']=qs[_0x7b49('0x1d')](_0x513c12[_0x7b49('0x2c')][_0x7b49('0x1d')]);_0x4c1a66[_0x7b49('0x1b')]=qs[_0x7b49('0x1b')](_0x513c12[_0x7b49('0x2c')][_0x7b49('0x1b')]);}_0x4c1a66[_0x7b49('0x33')]=qs[_0x7b49('0x34')](_0x513c12['query']['sort']);_0x4c1a66[_0x7b49('0x35')]=qs[_0x7b49('0x2d')](_['pick'](_0x513c12[_0x7b49('0x2c')],_0x59da61[_0x7b49('0x2d')]),_0x1e035e);if(_0x513c12[_0x7b49('0x2c')][_0x7b49('0x36')]){_0x4c1a66[_0x7b49('0x35')]=_[_0x7b49('0x37')](_0x4c1a66[_0x7b49('0x35')],{'$or':_[_0x7b49('0x27')](_0x1e035e,function(_0x446c3e){if(_0x446c3e[_0x7b49('0x2a')]!==_0x7b49('0x38')){var _0x2f4f33={};_0x2f4f33[_0x446c3e[_0x7b49('0x26')]]={'$like':'%'+_0x513c12[_0x7b49('0x2c')][_0x7b49('0x36')]+'%'};return _0x2f4f33;}})});}_0x4c1a66=_['merge']({},_0x4c1a66,_0x513c12[_0x7b49('0x39')]);var _0x14b104={'where':_0x4c1a66[_0x7b49('0x35')]};return db['ChatTransferReport'][_0x7b49('0x1e')](_0x14b104)[_0x7b49('0x25')](function(_0x32fee6){_0x497831['count']=_0x32fee6;if(_0x513c12[_0x7b49('0x2c')][_0x7b49('0x3a')]){_0x4c1a66[_0x7b49('0x3b')]=[{'all':!![]}];}return db[_0x7b49('0x28')][_0x7b49('0x3c')](_0x4c1a66);})[_0x7b49('0x25')](function(_0x4e526e){_0x497831['rows']=_0x4e526e;return _0x497831;})[_0x7b49('0x25')](respondWithFilteredResult(_0x275c3e,_0x4c1a66))[_0x7b49('0x3d')](handleError(_0x275c3e,null));};exports[_0x7b49('0x3e')]=function(_0x23b595,_0x376522){var _0x10838a={'raw':!![],'where':{'id':_0x23b595['params']['id']}},_0x3dd5e7={};_0x3dd5e7[_0x7b49('0x2b')]=_[_0x7b49('0x3f')](db['ChatTransferReport']['rawAttributes']);_0x3dd5e7['query']=_[_0x7b49('0x3f')](_0x23b595[_0x7b49('0x2c')]);_0x3dd5e7['filters']=_['intersection'](_0x3dd5e7[_0x7b49('0x2b')],_0x3dd5e7[_0x7b49('0x2c')]);_0x10838a[_0x7b49('0x2f')]=_[_0x7b49('0x2e')](_0x3dd5e7['model'],qs[_0x7b49('0x30')](_0x23b595['query']['fields']));_0x10838a[_0x7b49('0x2f')]=_0x10838a['attributes'][_0x7b49('0x31')]?_0x10838a['attributes']:_0x3dd5e7['model'];if(_0x23b595[_0x7b49('0x2c')][_0x7b49('0x3a')]){_0x10838a['include']=[{'all':!![]}];}_0x10838a=_[_0x7b49('0x37')]({},_0x10838a,_0x23b595[_0x7b49('0x39')]);return db['ChatTransferReport'][_0x7b49('0x40')](_0x10838a)['then'](handleEntityNotFound(_0x376522,null))['then'](respondWithResult(_0x376522,null))[_0x7b49('0x3d')](handleError(_0x376522,null));};exports[_0x7b49('0x41')]=function(_0x417243,_0x565967){return db[_0x7b49('0x28')][_0x7b49('0x41')](_0x417243['body'],{})[_0x7b49('0x25')](respondWithResult(_0x565967,0xc9))[_0x7b49('0x3d')](handleError(_0x565967,null));};exports[_0x7b49('0x24')]=function(_0x3ea51a,_0x2ff4e9){if(_0x3ea51a[_0x7b49('0x42')]['id']){delete _0x3ea51a[_0x7b49('0x42')]['id'];}return db[_0x7b49('0x28')][_0x7b49('0x40')]({'where':{'id':_0x3ea51a[_0x7b49('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ff4e9,null))[_0x7b49('0x25')](saveUpdates(_0x3ea51a[_0x7b49('0x42')],null))['then'](respondWithResult(_0x2ff4e9,null))[_0x7b49('0x3d')](handleError(_0x2ff4e9,null));};exports['destroy']=function(_0x5b50a2,_0x462e8e){return db[_0x7b49('0x28')][_0x7b49('0x40')]({'where':{'id':_0x5b50a2[_0x7b49('0x43')]['id']}})[_0x7b49('0x25')](handleEntityNotFound(_0x462e8e,null))['then'](removeEntity(_0x462e8e,null))[_0x7b49('0x3d')](handleError(_0x462e8e,null));};exports[_0x7b49('0x44')]=function(_0x3c2550,_0x37dbe6){return db[_0x7b49('0x28')][_0x7b49('0x44')]()[_0x7b49('0x25')](respondWithResult(_0x37dbe6,null))[_0x7b49('0x3d')](handleError(_0x37dbe6,null));}; \ No newline at end of file +var _0xa644=['includeAll','include','findAll','rows','catch','show','params','fields','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','moment','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','index','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x3ab014,_0x1f4fe7){var _0x3cf093=function(_0x3a91c7){while(--_0x3a91c7){_0x3ab014['push'](_0x3ab014['shift']());}};_0x3cf093(++_0x1f4fe7);}(_0xa644,0x1c3));var _0x4a64=function(_0x2de418,_0x1c508c){_0x2de418=_0x2de418-0x0;var _0x30d7e8=_0xa644[_0x2de418];return _0x30d7e8;};'use strict';var emlformat=require(_0x4a64('0x0'));var rimraf=require(_0x4a64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a64('0x2'));var rp=require('request-promise');var moment=require(_0x4a64('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4a64('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4a64('0x5'));var csv=require(_0x4a64('0x6'));var ejs=require(_0x4a64('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4a64('0x8'));var crypto=require(_0x4a64('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4a64('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4a64('0xb'));var Papa=require(_0x4a64('0xc'));var Redis=require(_0x4a64('0xd'));var authService=require(_0x4a64('0xe'));var qs=require(_0x4a64('0xf'));var as=require(_0x4a64('0x10'));var hardwareService=require(_0x4a64('0x11'));var logger=require(_0x4a64('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4a64('0x13'));var licenseUtil=require(_0x4a64('0x14'));var db=require(_0x4a64('0x15'))['db'];function respondWithStatusCode(_0x3bdf4c,_0xefb8d3){_0xefb8d3=_0xefb8d3||0xcc;return function(_0x12ed3d){if(_0x12ed3d){return _0x3bdf4c[_0x4a64('0x16')](_0xefb8d3);}return _0x3bdf4c[_0x4a64('0x17')](_0xefb8d3)['end']();};}function respondWithResult(_0x4bc892,_0x151e55){_0x151e55=_0x151e55||0xc8;return function(_0x250659){if(_0x250659){return _0x4bc892[_0x4a64('0x17')](_0x151e55)[_0x4a64('0x18')](_0x250659);}};}function respondWithFilteredResult(_0x38a498,_0x53a574){return function(_0x934d3b){if(_0x934d3b){var _0x3a8f62=typeof _0x53a574[_0x4a64('0x19')]===_0x4a64('0x1a')&&typeof _0x53a574[_0x4a64('0x1b')]===_0x4a64('0x1a');var _0x177645=_0x934d3b[_0x4a64('0x1c')];var _0x4d65b4=_0x3a8f62?0x0:_0x53a574[_0x4a64('0x19')];var _0x5c4fce=_0x3a8f62?_0x934d3b[_0x4a64('0x1c')]:_0x53a574[_0x4a64('0x19')]+_0x53a574['limit'];var _0x54e351;if(_0x5c4fce>=_0x177645){_0x5c4fce=_0x177645;_0x54e351=0xc8;}else{_0x54e351=0xce;}_0x38a498['status'](_0x54e351);return _0x38a498[_0x4a64('0x1d')](_0x4a64('0x1e'),_0x4d65b4+'-'+_0x5c4fce+'/'+_0x177645)[_0x4a64('0x18')](_0x934d3b);}return null;};}function patchUpdates(_0x1136bf){return function(_0x3fea0c){try{jsonpatch[_0x4a64('0x1f')](_0x3fea0c,_0x1136bf,!![]);}catch(_0x485920){return BPromise['reject'](_0x485920);}return _0x3fea0c[_0x4a64('0x20')]();};}function saveUpdates(_0x140b81,_0x3452f2){return function(_0x2415d9){if(_0x2415d9){return _0x2415d9['update'](_0x140b81)[_0x4a64('0x21')](function(_0x4e883f){return _0x4e883f;});}return null;};}function removeEntity(_0x5f439d,_0x2cbcfa){return function(_0x17423d){if(_0x17423d){return _0x17423d[_0x4a64('0x22')]()[_0x4a64('0x21')](function(){_0x5f439d[_0x4a64('0x17')](0xcc)[_0x4a64('0x23')]();});}};}function handleEntityNotFound(_0x4e77dc,_0x54924b){return function(_0xc09344){if(!_0xc09344){_0x4e77dc['sendStatus'](0x194);}return _0xc09344;};}function handleError(_0x4e4649,_0x2b7411){_0x2b7411=_0x2b7411||0x1f4;return function(_0x269755){logger[_0x4a64('0x24')](_0x269755[_0x4a64('0x25')]);if(_0x269755[_0x4a64('0x26')]){delete _0x269755['name'];}_0x4e4649[_0x4a64('0x17')](_0x2b7411)['send'](_0x269755);};}exports[_0x4a64('0x27')]=function(_0x2f4b22,_0x3229d9){var _0x42be7a={},_0x527159={},_0x4536fb={'count':0x0,'rows':[]};var _0x8ebb9b=_['map'](db[_0x4a64('0x28')][_0x4a64('0x29')],function(_0x44fcbe){return{'name':_0x44fcbe[_0x4a64('0x2a')],'type':_0x44fcbe[_0x4a64('0x2b')]['key']};});_0x527159[_0x4a64('0x2c')]=_['map'](_0x8ebb9b,_0x4a64('0x26'));_0x527159[_0x4a64('0x2d')]=_[_0x4a64('0x2e')](_0x2f4b22['query']);_0x527159[_0x4a64('0x2f')]=_['intersection'](_0x527159['model'],_0x527159[_0x4a64('0x2d')]);_0x42be7a[_0x4a64('0x30')]=_[_0x4a64('0x31')](_0x527159[_0x4a64('0x2c')],qs['fields'](_0x2f4b22[_0x4a64('0x2d')]['fields']));_0x42be7a[_0x4a64('0x30')]=_0x42be7a[_0x4a64('0x30')][_0x4a64('0x32')]?_0x42be7a['attributes']:_0x527159[_0x4a64('0x2c')];if(!_0x2f4b22['query'][_0x4a64('0x33')]('nolimit')){_0x42be7a[_0x4a64('0x1b')]=qs[_0x4a64('0x1b')](_0x2f4b22[_0x4a64('0x2d')][_0x4a64('0x1b')]);_0x42be7a['offset']=qs['offset'](_0x2f4b22[_0x4a64('0x2d')]['offset']);}_0x42be7a[_0x4a64('0x34')]=qs[_0x4a64('0x35')](_0x2f4b22[_0x4a64('0x2d')]['sort']);_0x42be7a[_0x4a64('0x36')]=qs[_0x4a64('0x2f')](_[_0x4a64('0x37')](_0x2f4b22[_0x4a64('0x2d')],_0x527159[_0x4a64('0x2f')]),_0x8ebb9b);if(_0x2f4b22[_0x4a64('0x2d')][_0x4a64('0x38')]){_0x42be7a[_0x4a64('0x36')]=_[_0x4a64('0x39')](_0x42be7a[_0x4a64('0x36')],{'$or':_['map'](_0x8ebb9b,function(_0x11ef60){if(_0x11ef60['type']!==_0x4a64('0x3a')){var _0x189347={};_0x189347[_0x11ef60[_0x4a64('0x26')]]={'$like':'%'+_0x2f4b22[_0x4a64('0x2d')][_0x4a64('0x38')]+'%'};return _0x189347;}})});}_0x42be7a=_['merge']({},_0x42be7a,_0x2f4b22[_0x4a64('0x3b')]);var _0x2c29ea={'where':_0x42be7a[_0x4a64('0x36')]};return db['ChatTransferReport'][_0x4a64('0x1c')](_0x2c29ea)['then'](function(_0x288352){_0x4536fb[_0x4a64('0x1c')]=_0x288352;if(_0x2f4b22[_0x4a64('0x2d')][_0x4a64('0x3c')]){_0x42be7a[_0x4a64('0x3d')]=[{'all':!![]}];}return db[_0x4a64('0x28')][_0x4a64('0x3e')](_0x42be7a);})[_0x4a64('0x21')](function(_0x2e81e2){_0x4536fb[_0x4a64('0x3f')]=_0x2e81e2;return _0x4536fb;})[_0x4a64('0x21')](respondWithFilteredResult(_0x3229d9,_0x42be7a))[_0x4a64('0x40')](handleError(_0x3229d9,null));};exports[_0x4a64('0x41')]=function(_0x3bedae,_0x12acd3){var _0x5a9279={'raw':!![],'where':{'id':_0x3bedae[_0x4a64('0x42')]['id']}},_0x3d4569={};_0x3d4569[_0x4a64('0x2c')]=_[_0x4a64('0x2e')](db['ChatTransferReport'][_0x4a64('0x29')]);_0x3d4569[_0x4a64('0x2d')]=_[_0x4a64('0x2e')](_0x3bedae[_0x4a64('0x2d')]);_0x3d4569[_0x4a64('0x2f')]=_[_0x4a64('0x31')](_0x3d4569[_0x4a64('0x2c')],_0x3d4569['query']);_0x5a9279[_0x4a64('0x30')]=_[_0x4a64('0x31')](_0x3d4569['model'],qs['fields'](_0x3bedae['query'][_0x4a64('0x43')]));_0x5a9279['attributes']=_0x5a9279[_0x4a64('0x30')]['length']?_0x5a9279[_0x4a64('0x30')]:_0x3d4569['model'];if(_0x3bedae[_0x4a64('0x2d')][_0x4a64('0x3c')]){_0x5a9279[_0x4a64('0x3d')]=[{'all':!![]}];}_0x5a9279=_['merge']({},_0x5a9279,_0x3bedae['options']);return db[_0x4a64('0x28')]['find'](_0x5a9279)['then'](handleEntityNotFound(_0x12acd3,null))['then'](respondWithResult(_0x12acd3,null))[_0x4a64('0x40')](handleError(_0x12acd3,null));};exports[_0x4a64('0x44')]=function(_0x4f89d7,_0x396f07){return db[_0x4a64('0x28')][_0x4a64('0x44')](_0x4f89d7[_0x4a64('0x45')],{})[_0x4a64('0x21')](respondWithResult(_0x396f07,0xc9))['catch'](handleError(_0x396f07,null));};exports[_0x4a64('0x46')]=function(_0x534544,_0x4ac692){if(_0x534544[_0x4a64('0x45')]['id']){delete _0x534544[_0x4a64('0x45')]['id'];}return db[_0x4a64('0x28')][_0x4a64('0x47')]({'where':{'id':_0x534544[_0x4a64('0x42')]['id']}})[_0x4a64('0x21')](handleEntityNotFound(_0x4ac692,null))['then'](saveUpdates(_0x534544[_0x4a64('0x45')],null))[_0x4a64('0x21')](respondWithResult(_0x4ac692,null))[_0x4a64('0x40')](handleError(_0x4ac692,null));};exports['destroy']=function(_0x34e3f4,_0x56b6ba){return db[_0x4a64('0x28')][_0x4a64('0x47')]({'where':{'id':_0x34e3f4[_0x4a64('0x42')]['id']}})[_0x4a64('0x21')](handleEntityNotFound(_0x56b6ba,null))['then'](removeEntity(_0x56b6ba,null))[_0x4a64('0x40')](handleError(_0x56b6ba,null));};exports[_0x4a64('0x48')]=function(_0x11fc0c,_0x56fda7){return db[_0x4a64('0x28')][_0x4a64('0x48')]()['then'](respondWithResult(_0x56fda7,null))[_0x4a64('0x40')](handleError(_0x56fda7,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index b8628b6..6bb3e8c 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 _0x5c6b=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','ChatTransferReport','uniqueid','lodash'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x5c6b,0x1c2));var _0xb5c6=function(_0x46bae6,_0x3d2157){_0x46bae6=_0x46bae6-0x0;var _0x600618=_0x5c6b[_0x46bae6];return _0x600618;};'use strict';var _=require(_0xb5c6('0x0'));var util=require(_0xb5c6('0x1'));var logger=require(_0xb5c6('0x2'))(_0xb5c6('0x3'));var moment=require(_0xb5c6('0x4'));var BPromise=require('bluebird');var rp=require(_0xb5c6('0x5'));var fs=require('fs');var path=require(_0xb5c6('0x6'));var rimraf=require(_0xb5c6('0x7'));var config=require(_0xb5c6('0x8'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x280931,_0x2311ff){return _0x280931['define'](_0xb5c6('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xb5c6('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1c0=['report_chat_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x1a1ef5,_0x3cae36){var _0xfe502a=function(_0x5a37f8){while(--_0x5a37f8){_0x1a1ef5['push'](_0x1a1ef5['shift']());}};_0xfe502a(++_0x3cae36);}(_0xb1c0,0x113));var _0x0b1c=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xb1c0[_0x1589dd];return _0x1bddd1;};'use strict';var _=require('lodash');var util=require(_0x0b1c('0x0'));var logger=require(_0x0b1c('0x1'))(_0x0b1c('0x2'));var moment=require(_0x0b1c('0x3'));var BPromise=require(_0x0b1c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b1c('0x5'));var rimraf=require('rimraf');var config=require(_0x0b1c('0x6'));var attributes=require(_0x0b1c('0x7'));module[_0x0b1c('0x8')]=function(_0x1e66a4,_0x10ee39){return _0x1e66a4[_0x0b1c('0x9')](_0x0b1c('0xa'),attributes,{'tableName':_0x0b1c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0b1c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9f5d2dd..e8f975a 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 _0xf919=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x5051e1,_0x516023){var _0x10ac1d=function(_0x140eb2){while(--_0x140eb2){_0x5051e1['push'](_0x5051e1['shift']());}};_0x10ac1d(++_0x516023);}(_0xf919,0xb3));var _0x9f91=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0xf919[_0x47f7ec];return _0x415101;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9f91('0x0'));var BPromise=require('bluebird');var rs=require(_0x9f91('0x1'));var fs=require('fs');var Redis=require(_0x9f91('0x2'));var db=require(_0x9f91('0x3'))['db'];var utils=require(_0x9f91('0x4'));var logger=require(_0x9f91('0x5'))(_0x9f91('0x6'));var config=require(_0x9f91('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f91('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d248f,_0x55c095,_0x24a87d){return new BPromise(function(_0x262662,_0xa3688f){return client[_0x9f91('0x9')](_0x2d248f,_0x24a87d)[_0x9f91('0xa')](function(_0x49a208){logger[_0x9f91('0xb')](_0x9f91('0xc'),_0x55c095,_0x9f91('0xd'));logger[_0x9f91('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x55c095,_0x9f91('0xd'),JSON['stringify'](_0x49a208));if(_0x49a208['error']){if(_0x49a208[_0x9f91('0xf')]['code']===0x1f4){logger[_0x9f91('0xf')](_0x9f91('0xc'),_0x55c095,_0x49a208['error'][_0x9f91('0x10')]);return _0xa3688f(_0x49a208[_0x9f91('0xf')][_0x9f91('0x10')]);}logger[_0x9f91('0xf')](_0x9f91('0xc'),_0x55c095,_0x49a208[_0x9f91('0xf')][_0x9f91('0x10')]);return _0x262662(_0x49a208[_0x9f91('0xf')][_0x9f91('0x10')]);}else{logger[_0x9f91('0xb')](_0x9f91('0xc'),_0x55c095,_0x9f91('0xd'));_0x262662(_0x49a208[_0x9f91('0x11')][_0x9f91('0x10')]);}})[_0x9f91('0x12')](function(_0x358dd8){logger[_0x9f91('0xf')](_0x9f91('0xc'),_0x55c095,_0x358dd8);_0xa3688f(_0x358dd8);});});} \ No newline at end of file +var _0x449b=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x249123,_0x5f50bb){var _0x3d178c=function(_0x1e6202){while(--_0x1e6202){_0x249123['push'](_0x249123['shift']());}};_0x3d178c(++_0x5f50bb);}(_0x449b,0x1b3));var _0xb449=function(_0x5f4149,_0x32f993){_0x5f4149=_0x5f4149-0x0;var _0x3f27b2=_0x449b[_0x5f4149];return _0x3f27b2;};'use strict';var _=require(_0xb449('0x0'));var util=require(_0xb449('0x1'));var moment=require(_0xb449('0x2'));var BPromise=require(_0xb449('0x3'));var rs=require(_0xb449('0x4'));var fs=require('fs');var Redis=require(_0xb449('0x5'));var db=require(_0xb449('0x6'))['db'];var utils=require(_0xb449('0x7'));var logger=require(_0xb449('0x8'))(_0xb449('0x9'));var config=require(_0xb449('0xa'));var jayson=require(_0xb449('0xb'));var client=jayson[_0xb449('0xc')][_0xb449('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x436b4b,_0x4c6306,_0x1ca53c){return new BPromise(function(_0x207757,_0x2afcc3){return client[_0xb449('0xe')](_0x436b4b,_0x1ca53c)[_0xb449('0xf')](function(_0x512638){logger['info'](_0xb449('0x10'),_0x4c6306,'request\x20sent');logger[_0xb449('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4c6306,_0xb449('0x12'),JSON[_0xb449('0x13')](_0x512638));if(_0x512638[_0xb449('0x14')]){if(_0x512638[_0xb449('0x14')][_0xb449('0x15')]===0x1f4){logger[_0xb449('0x14')](_0xb449('0x10'),_0x4c6306,_0x512638['error'][_0xb449('0x16')]);return _0x2afcc3(_0x512638['error']['message']);}logger['error'](_0xb449('0x10'),_0x4c6306,_0x512638[_0xb449('0x14')][_0xb449('0x16')]);return _0x207757(_0x512638['error']['message']);}else{logger['info'](_0xb449('0x10'),_0x4c6306,_0xb449('0x12'));_0x207757(_0x512638['result'][_0xb449('0x16')]);}})[_0xb449('0x17')](function(_0x121806){logger['error'](_0xb449('0x10'),_0x4c6306,_0x121806);_0x2afcc3(_0x121806);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index d4f7fe3..89fbc9e 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 _0x36c2=['./chatTransferReport.controller','get','isAuthenticated','index','/describe','show','post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x205eca,_0x138c20){var _0x193e81=function(_0x3e8c88){while(--_0x3e8c88){_0x205eca['push'](_0x205eca['shift']());}};_0x193e81(++_0x138c20);}(_0x36c2,0x1da));var _0x236c=function(_0x43af1f,_0x328b50){_0x43af1f=_0x43af1f-0x0;var _0x22fe1b=_0x36c2[_0x43af1f];return _0x22fe1b;};'use strict';var multer=require(_0x236c('0x0'));var util=require(_0x236c('0x1'));var path=require(_0x236c('0x2'));var timeout=require(_0x236c('0x3'));var express=require(_0x236c('0x4'));var router=express['Router']();var fs_extra=require(_0x236c('0x5'));var auth=require(_0x236c('0x6'));var interaction=require(_0x236c('0x7'));var config=require(_0x236c('0x8'));var controller=require(_0x236c('0x9'));router[_0x236c('0xa')]('/',auth[_0x236c('0xb')](),controller[_0x236c('0xc')]);router[_0x236c('0xa')](_0x236c('0xd'),auth[_0x236c('0xb')](),controller['describe']);router[_0x236c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x236c('0xe')]);router[_0x236c('0xf')]('/',auth[_0x236c('0xb')](),controller['create']);router[_0x236c('0x10')](_0x236c('0x11'),auth[_0x236c('0xb')](),controller[_0x236c('0x12')]);router[_0x236c('0x13')](_0x236c('0x11'),auth[_0x236c('0xb')](),controller[_0x236c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x82a9=['isAuthenticated','index','get','describe','/:id','create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller'];(function(_0x554047,_0x46ec41){var _0x5d11e4=function(_0x5a026e){while(--_0x5a026e){_0x554047['push'](_0x554047['shift']());}};_0x5d11e4(++_0x46ec41);}(_0x82a9,0x1bb));var _0x982a=function(_0x5cdeb7,_0x19194b){_0x5cdeb7=_0x5cdeb7-0x0;var _0x1ad6a5=_0x82a9[_0x5cdeb7];return _0x1ad6a5;};'use strict';var multer=require('multer');var util=require(_0x982a('0x0'));var path=require('path');var timeout=require(_0x982a('0x1'));var express=require(_0x982a('0x2'));var router=express['Router']();var fs_extra=require(_0x982a('0x3'));var auth=require(_0x982a('0x4'));var interaction=require(_0x982a('0x5'));var config=require('../../config/environment');var controller=require(_0x982a('0x6'));router['get']('/',auth[_0x982a('0x7')](),controller[_0x982a('0x8')]);router[_0x982a('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x982a('0xa')]);router['get'](_0x982a('0xb'),auth[_0x982a('0x7')](),controller['show']);router['post']('/',auth[_0x982a('0x7')](),controller[_0x982a('0xc')]);router[_0x982a('0xd')](_0x982a('0xb'),auth[_0x982a('0x7')](),controller[_0x982a('0xe')]);router[_0x982a('0xf')](_0x982a('0xb'),auth['isAuthenticated'](),controller[_0x982a('0x10')]);module[_0x982a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index c424419..638be05 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 _0xedfd=['offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','address','STRING','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Skip','Feedback','star','stringify','input','text','name','getDataValue','onlineForm','setDataValue','Comments'];(function(_0x38175c,_0x2de69b){var _0x1566ad=function(_0x25f78d){while(--_0x25f78d){_0x38175c['push'](_0x38175c['shift']());}};_0x1566ad(++_0x2de69b);}(_0xedfd,0x181));var _0xdedf=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0xedfd[_0x11946c];return _0x383935;};'use strict';var Sequelize=require(_0xdedf('0x0'));var rs=require('randomstring');module[_0xdedf('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdedf('0x2')},'description':{'type':Sequelize[_0xdedf('0x3')]},'mapKey':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x4')},'mapKeyOffline':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x4')},'key':{'type':Sequelize[_0xdedf('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xdedf('0x5')},'customerAlias':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xdedf('0x3')],'allowNull':![],'defaultValue':_0xdedf('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xdedf('0x3')],'allowNull':![],'defaultValue':_0xdedf('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xdedf('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xdedf('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xdedf('0x9')]('rounded','squared'),'defaultValue':_0xdedf('0xa')},'header_online':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0xb')},'start_chat_button':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0xc')},'offline_chat_button':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0xd')},'header_offline':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdedf('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xdedf('0xe')]},'closingQuestion':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x11')},'placeholderMessage':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xdedf('0xd')},'skipMessageButton':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x12')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x13')},'ratingType':{'type':Sequelize['ENUM'](_0xdedf('0x14'),'thumb'),'defaultValue':_0xdedf('0x14')},'ratingStarsNumber':{'type':Sequelize[_0xdedf('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xdedf('0xe')],'defaultValue':function(){return JSON[_0xdedf('0x15')]({'items':[{'type':_0xdedf('0x16'),'variable':null,'config':{'placeholder':'name','type':_0xdedf('0x17'),'required':!![]},'props':{'title':_0xdedf('0x18'),'helpText':''}},{'type':_0xdedf('0x16'),'props':{'title':_0xdedf('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xdedf('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdedf('0x19')]('onlineForm')?JSON['parse'](this[_0xdedf('0x19')](_0xdedf('0x1a'))):{};},'set':function(_0x1021d0){return this[_0xdedf('0x1b')](_0xdedf('0x1a'),JSON[_0xdedf('0x15')](_0x1021d0));}},'offlineForm':{'type':Sequelize[_0xdedf('0xe')],'defaultValue':function(){return JSON[_0xdedf('0x15')]({'items':[{'type':'input','props':{'title':_0xdedf('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xdedf('0x4'),'type':_0xdedf('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0xdedf('0x1c')},'props':{'title':_0xdedf('0x1c'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xdedf('0x19')](_0xdedf('0x1d'))?JSON[_0xdedf('0x1e')](this['getDataValue'](_0xdedf('0x1d'))):{};},'set':function(_0x25e2f8){return this[_0xdedf('0x1b')](_0xdedf('0x1d'),JSON[_0xdedf('0x15')](_0x25e2f8));}},'token':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':function(){return rs[_0xdedf('0x1f')]();}},'autoclose':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xdedf('0x3')]},'waitingTitle':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x20')},'waitingMessage':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x21')},'offlineMessageSubject':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x22')},'offlineMessageBody':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x24')},'skipUnmanaged':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x12')},'sendUnmanaged':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdedf('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xdedf('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xdedf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdedf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xdedf('0x25')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x26')},'messagesAlignment':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':_0xdedf('0x27')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdedf('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdedf('0x3')],'allowNull':![],'defaultValue':_0xdedf('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdedf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdedf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xdedf('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdedf('0x7')],'comment':_0xdedf('0x29')},'mandatoryDisposition':{'type':Sequelize[_0xdedf('0x8')],'defaultValue':![],'comment':_0xdedf('0x2a'),'set':function(_0x180780){if(!_0x180780)this[_0xdedf('0x1b')]('mandatoryDispositionPauseId',null);this[_0xdedf('0x1b')](_0xdedf('0x2b'),_0x180780);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xdedf('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdedf('0x2c')},'vidaooNote':{'type':Sequelize[_0xdedf('0x3')],'defaultValue':function(){return _0xdedf('0x2d');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xdedf('0xe')]}}; \ No newline at end of file +var _0xd829=['You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','thumb','TEXT','stringify','input','name','text','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','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'];(function(_0xb35654,_0x422ea2){var _0x489648=function(_0x4d5091){while(--_0x4d5091){_0xb35654['push'](_0xb35654['shift']());}};_0x489648(++_0x422ea2);}(_0xd829,0xea));var _0x9d82=function(_0xf652f0,_0x191014){_0xf652f0=_0xf652f0-0x0;var _0x84122c=_0xd829[_0xf652f0];return _0x84122c;};'use strict';var Sequelize=require(_0x9d82('0x0'));var rs=require(_0x9d82('0x1'));module[_0x9d82('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'unique':_0x9d82('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x5')},'mapKeyOffline':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x5')},'key':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x6')},'customerAlias':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'defaultValue':_0x9d82('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'defaultValue':_0x9d82('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'defaultValue':_0x9d82('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x9d82('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9d82('0x3')]},'animation':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x9d82('0xb'),_0x9d82('0xc')),'defaultValue':_0x9d82('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x9d82('0xd')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x9d82('0xe')},'offline_chat_button':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0xf')},'download_transcript':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9d82('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x12')},'placeholderMessage':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x13')},'closingMessage':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x14')},'closingMessageButton':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x9d82('0x15')},'conditionAgreement':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x9d82('0x16')](_0x9d82('0x17'),_0x9d82('0x18')),'defaultValue':_0x9d82('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x9d82('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9d82('0x19')],'defaultValue':function(){return JSON[_0x9d82('0x1a')]({'items':[{'type':_0x9d82('0x1b'),'variable':null,'config':{'placeholder':_0x9d82('0x1c'),'type':_0x9d82('0x1d'),'required':!![]},'props':{'title':_0x9d82('0x1c'),'helpText':''}},{'type':_0x9d82('0x1b'),'props':{'title':_0x9d82('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9d82('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this[_0x9d82('0x1e')](_0x9d82('0x1f'))):{};},'set':function(_0x25b4bc){return this['setDataValue'](_0x9d82('0x1f'),JSON[_0x9d82('0x1a')](_0x25b4bc));}},'offlineForm':{'type':Sequelize[_0x9d82('0x19')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x9d82('0x1b'),'props':{'title':_0x9d82('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x9d82('0x5'),'type':'email'},'variable':null},{'type':_0x9d82('0x20'),'config':{'placeholder':_0x9d82('0x21')},'props':{'title':'Comments','helpText':_0x9d82('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x9d82('0x1e')](_0x9d82('0x23'))?JSON['parse'](this[_0x9d82('0x1e')](_0x9d82('0x23'))):{};},'set':function(_0x1cf518){return this[_0x9d82('0x24')](_0x9d82('0x23'),JSON[_0x9d82('0x1a')](_0x1cf518));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9d82('0x25')]();}},'autoclose':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9d82('0x3')]},'forwardOffline':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9d82('0x3')]},'waitingTitle':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x26')},'waitingMessage':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x9d82('0x28')},'offlineMessageBody':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x29')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9d82('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x2b')},'enableCustomerAttachment':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9d82('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9d82('0x2c');}},'notificationSound':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9d82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x2e')},'verticalAlignment':{'type':Sequelize[_0x9d82('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x2f')},'defaultTitle':{'type':Sequelize[_0x9d82('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9d82('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'defaultValue':_0x9d82('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9d82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9d82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x31')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9d82('0x9')],'comment':_0x9d82('0x32')},'mandatoryDisposition':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![],'comment':_0x9d82('0x33'),'set':function(_0x5bec20){if(!_0x5bec20)this[_0x9d82('0x24')]('mandatoryDispositionPauseId',null);this[_0x9d82('0x24')](_0x9d82('0x34'),_0x5bec20);}},'vidaooEscalation':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9d82('0x3')]},'vidaooTopic':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'defaultValue':_0x9d82('0x35')},'vidaooNote':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':function(){return _0x9d82('0x36');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9d82('0x19')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index f5f56f1..b0c2aad 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 _0xb28a=['SendMail','sendMail','offlineMessageSubject','MailAccountId','toPairsIn','subjectOffline','email','lastName','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','User','Tag','Tags','color','tag','getSnippet','../../config/license/util','virtual','License','chatLicenseExceeded','3.10.1','origin','http://localhost:9000','testWebsiteWithWildcard','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textButtonColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','onlineForm','items','fromKey','getOfflineMessages','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','util','path','fs-extra','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APIOutOfIntervalError','handleError','APIConflictError','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','update','then','destroy','UserProfileResource','stack','name','send','user-agent-parser','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','unknown','%s\x20%s','device','model','vendor','format','type','Pause','map','ChatWebsite','rawAttributes','key','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','fields','length','options','find','create','body','address','forEach','testWildcardValidity','trim','user','get','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','describe','ChatWebsiteId','getDispositions','findOne','Disposition','addAnswer','CannedAnswer','ids','addLogo','file','agentAvatar','filename','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','resolve','timezone','ifTime','notify','from','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','ListId','list','headers','threadId','closed','externalUrl','ChatInteraction','ContactId','interaction','Writing\x20on\x20closed\x20interaction','contact','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','waitForTheAssignedAgent','forcedOwnership','queueId','unshift','queue','Start','EventManager','files','ValidationError','no\x20available\x20attributes','difference','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions'];(function(_0x3ca8f8,_0x306e7e){var _0x670e9f=function(_0x440f40){while(--_0x440f40){_0x3ca8f8['push'](_0x3ca8f8['shift']());}};_0x670e9f(++_0x306e7e);}(_0xb28a,0x166));var _0xab28=function(_0x3993a6,_0x451762){_0x3993a6=_0x3993a6-0x0;var _0x2252b1=_0xb28a[_0x3993a6];return _0x2252b1;};'use strict';var Mustache=require('mustache');var util=require(_0xab28('0x0'));var path=require(_0xab28('0x1'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab28('0x2'));var _=require('lodash');var querystring=require('querystring');var htmlToText=require('html-to-text');var Redis=require(_0xab28('0x3'));var jayson=require(_0xab28('0x4'));var qs=require(_0xab28('0x5'));var logger=require(_0xab28('0x6'))(_0xab28('0x7'));var config=require(_0xab28('0x8'));var APIBadRequestError=require(_0xab28('0x9'))[_0xab28('0xa')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIOutOfIntervalError=require(_0xab28('0x9'))[_0xab28('0xb')];var APIHandleError=require(_0xab28('0x9'))[_0xab28('0xc')];var APIConflictError=require(_0xab28('0x9'))[_0xab28('0xd')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0xab28('0xe'))['URL'];var db=require(_0xab28('0xf'))['db'];config[_0xab28('0x10')]=_[_0xab28('0x11')](config[_0xab28('0x10')],{'host':_0xab28('0x12'),'port':0x18eb});var socket=require(_0xab28('0x13'))(new Redis(config[_0xab28('0x10')]));require(_0xab28('0x14'))['register'](socket);var client=jayson[_0xab28('0x15')][_0xab28('0x16')]({'port':0x232c});var client9002=jayson[_0xab28('0x15')][_0xab28('0x16')]({'port':0x232a});var client9003=jayson[_0xab28('0x15')][_0xab28('0x16')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x7c1921,_0x3d133e,_0x14e8b4,_0xaaeb24){return new Promise(function(_0x53c5c7,_0x28ebe2){var _0x4912fa=_0xaaeb24||client;return _0x4912fa[_0xab28('0x17')](_0x7c1921,_0x14e8b4)['then'](function(_0x242bd4){logger[_0xab28('0x18')](_0xab28('0x19'),_0x3d133e,_0xab28('0x1a'));logger[_0xab28('0x1b')](_0xab28('0x1c'),_0x3d133e,_0xab28('0x1a'),JSON[_0xab28('0x1d')](_0x242bd4));if(_0x242bd4['error']){if(_0x242bd4[_0xab28('0x1e')][_0xab28('0x1f')]===0x1f4){logger[_0xab28('0x1e')](_0xab28('0x19'),_0x3d133e,_0x242bd4[_0xab28('0x1e')][_0xab28('0x20')]);return _0x28ebe2(_0x242bd4[_0xab28('0x1e')]['message']);}logger[_0xab28('0x1e')]('ChatWebsite,\x20%s,\x20%s',_0x3d133e,_0x242bd4[_0xab28('0x1e')][_0xab28('0x20')]);return _0x53c5c7(_0x242bd4['error'][_0xab28('0x20')]);}else{logger[_0xab28('0x18')](_0xab28('0x19'),_0x3d133e,_0xab28('0x1a'));_0x53c5c7(_0x242bd4[_0xab28('0x21')][_0xab28('0x20')]);}})[_0xab28('0x22')](function(_0x56c6ef){logger[_0xab28('0x1e')]('ChatWebsite,\x20%s,\x20%s',_0x3d133e,_0x56c6ef);_0x28ebe2(_0x56c6ef);});});}function respondWithStatusCode(_0x2163d2,_0x2e6359){_0x2e6359=_0x2e6359||0xcc;return function(_0x5069d0){if(_0x5069d0){return _0x2163d2[_0xab28('0x23')](_0x2e6359);}return _0x2163d2['status'](_0x2e6359)[_0xab28('0x24')]();};}function respondWithResult(_0x2a3405,_0x3d8c60){_0x3d8c60=_0x3d8c60||0xc8;return function(_0x4e3b93){if(_0x4e3b93){return _0x2a3405[_0xab28('0x25')](_0x3d8c60)[_0xab28('0x26')](_0x4e3b93);}};}function respondWithFilteredResult(_0x4a6435,_0x6a494e){return function(_0x46b19b){if(_0x46b19b){var _0x323e0d=typeof _0x6a494e[_0xab28('0x27')]==='undefined'&&typeof _0x6a494e[_0xab28('0x28')]===_0xab28('0x29');var _0x33e5ce=_0x46b19b[_0xab28('0x2a')];var _0x376589=_0x323e0d?0x0:_0x6a494e[_0xab28('0x27')];var _0x44f016=_0x323e0d?_0x46b19b[_0xab28('0x2a')]:_0x6a494e[_0xab28('0x27')]+_0x6a494e[_0xab28('0x28')];var _0x5908bc;if(_0x44f016>=_0x33e5ce){_0x44f016=_0x33e5ce;_0x5908bc=0xc8;}else{_0x5908bc=0xce;}_0x4a6435['status'](_0x5908bc);return _0x4a6435[_0xab28('0x2b')]('Content-Range',_0x376589+'-'+_0x44f016+'/'+_0x33e5ce)['json'](_0x46b19b);}return null;};}function saveUpdates(_0x3324d3){return function(_0x292b82){if(_0x292b82){return _0x292b82[_0xab28('0x2c')](_0x3324d3)[_0xab28('0x2d')](function(_0x3639e1){return _0x3639e1;});}return null;};}function removeEntity(_0x1911fa){return function(_0x4d59ea){if(_0x4d59ea){return _0x4d59ea[_0xab28('0x2e')]()[_0xab28('0x2d')](function(){var _0x348cb5=_0x4d59ea['get']({'plain':!![]});var _0x9ab55='ChatWebsites';return db[_0xab28('0x2f')][_0xab28('0x2e')]({'where':{'type':_0x9ab55,'resourceId':_0x348cb5['id']}})['then'](function(){return _0x4d59ea;});})[_0xab28('0x2d')](function(){_0x1911fa[_0xab28('0x25')](0xcc)[_0xab28('0x24')]();});}};}function handleEntityNotFound(_0xb5e561){return function(_0x64b7ef){if(!_0x64b7ef){_0xb5e561[_0xab28('0x23')](0x194);}return _0x64b7ef;};}function handleError(_0x4f5e45,_0x157be0){_0x157be0=_0x157be0||0x1f4;return function(_0x471a30){logger['error'](_0x471a30[_0xab28('0x30')]);if(_0x471a30[_0xab28('0x31')]){delete _0x471a30[_0xab28('0x31')];}_0x4f5e45[_0xab28('0x25')](_0x157be0)[_0xab28('0x32')](_0x471a30);};}function createInteractionObject(_0xd4984c,_0x2d3ba7,_0x35e18a,_0x51aefa){var _0x207ac3=require(_0xab28('0x33'));var _0x5e826c=new _0x207ac3();var _0x45ac88=_0x5e826c[_0xab28('0x34')](_0x35e18a['user-agent'])[_0xab28('0x35')]();var _0x2a69d0=_0x2d3ba7[_0xab28('0x36')];if(_0x35e18a[_0xab28('0x37')]){_0x2a69d0=_0x35e18a[_0xab28('0x37')];}else if(_0x35e18a[_0xab28('0x38')]){_0x2a69d0=_[_0xab28('0x39')](_0x35e18a['x-forwarded-for'][_0xab28('0x3a')](','));}return{'ContactId':_0x51aefa['id'],'ChatWebsiteId':_0xd4984c,'from':(_0x51aefa[_0xab28('0x3b')]||'')+'\x20'+(_0x51aefa['lastName']||''),'customerIp':_0x2a69d0,'customerPort':_0x35e18a[_0xab28('0x3c')]?_0x35e18a[_0xab28('0x3c')]:null,'referer':_0x2d3ba7[_0xab28('0x3d')],'browserName':_0x45ac88[_0xab28('0x3e')][_0xab28('0x31')]&&_0x45ac88['browser'][_0xab28('0x3f')]?util['format']('%s\x20%s',_0x45ac88[_0xab28('0x3e')][_0xab28('0x31')],_0x45ac88[_0xab28('0x3e')][_0xab28('0x3f')]):_0xab28('0x40'),'browserVersion':_0x45ac88['browser']['version']||_0xab28('0x40'),'osName':util['format'](_0xab28('0x41'),_0x45ac88['os']['name'],_0x45ac88['os']['version']),'osVersion':_0x45ac88['os'][_0xab28('0x3f')],'deviceModel':_0x45ac88[_0xab28('0x42')][_0xab28('0x43')]&&_0x45ac88[_0xab28('0x42')][_0xab28('0x44')]?util[_0xab28('0x45')]('%s\x20%s\x20%s',_0x45ac88['device'][_0xab28('0x43')],_0x45ac88['device'][_0xab28('0x44')],_0x45ac88['device'][_0xab28('0x46')]):null,'deviceVendor':_0x45ac88['device']['vendor'],'deviceType':_0x45ac88[_0xab28('0x42')]['type'],'formData':JSON['stringify'](_0x2d3ba7)};}exports['index']=function(_0x21bd9,_0x55b220){var _0xaf3796={'include':[{'model':db[_0xab28('0x47')],'as':'mandatoryDispositionPause'}]},_0x31bf66={},_0x3f1da9={'count':0x0,'rows':[]};var _0x249a71=_[_0xab28('0x48')](db[_0xab28('0x49')][_0xab28('0x4a')],function(_0xa4e9a1){return{'name':_0xa4e9a1['fieldName'],'type':_0xa4e9a1[_0xab28('0x46')][_0xab28('0x4b')]};});_0x31bf66['model']=_[_0xab28('0x48')](_0x249a71,'name');_0x31bf66['query']=_[_0xab28('0x4c')](_0x21bd9[_0xab28('0x4d')]);_0x31bf66['filters']=_[_0xab28('0x4e')](_0x31bf66['model'],_0x31bf66[_0xab28('0x4d')]);_0xaf3796[_0xab28('0x4f')]=_[_0xab28('0x4e')](_0x31bf66[_0xab28('0x43')],qs['fields'](_0x21bd9[_0xab28('0x4d')]['fields']));_0xaf3796['attributes']=_0xaf3796[_0xab28('0x4f')]['length']?_0xaf3796[_0xab28('0x4f')]:_0x31bf66[_0xab28('0x43')];if(!_0x21bd9['query'][_0xab28('0x50')](_0xab28('0x51'))){_0xaf3796[_0xab28('0x28')]=qs[_0xab28('0x28')](_0x21bd9['query'][_0xab28('0x28')]);_0xaf3796[_0xab28('0x27')]=qs[_0xab28('0x27')](_0x21bd9[_0xab28('0x4d')][_0xab28('0x27')]);}_0xaf3796[_0xab28('0x52')]=qs[_0xab28('0x53')](_0x21bd9[_0xab28('0x4d')]['sort']);_0xaf3796[_0xab28('0x54')]=qs[_0xab28('0x55')](_[_0xab28('0x56')](_0x21bd9[_0xab28('0x4d')],_0x31bf66[_0xab28('0x55')]),_0x249a71);if(_0x21bd9[_0xab28('0x4d')][_0xab28('0x57')]){_0xaf3796[_0xab28('0x54')]=_[_0xab28('0x58')](_0xaf3796[_0xab28('0x54')],{'$or':_[_0xab28('0x48')](_0x249a71,function(_0x4824f7){if(_0x4824f7[_0xab28('0x46')]!=='VIRTUAL'){var _0x5d6d01={};_0x5d6d01[_0x4824f7[_0xab28('0x31')]]={'$like':'%'+_0x21bd9[_0xab28('0x4d')][_0xab28('0x57')]+'%'};return _0x5d6d01;}})});}_0xaf3796=_['merge']({},_0xaf3796,_0x21bd9['options']);var _0x13265a={'where':_0xaf3796[_0xab28('0x54')]};return db[_0xab28('0x49')][_0xab28('0x2a')](_0x13265a)[_0xab28('0x2d')](function(_0x10b6b4){_0x3f1da9[_0xab28('0x2a')]=_0x10b6b4;if(_0x21bd9[_0xab28('0x4d')][_0xab28('0x59')]){_0xaf3796[_0xab28('0x5a')]=[{'all':!![]}];}return db[_0xab28('0x49')][_0xab28('0x5b')](_0xaf3796);})[_0xab28('0x2d')](function(_0x150ee2){_0x3f1da9[_0xab28('0x5c')]=_0x150ee2;return _0x3f1da9;})[_0xab28('0x2d')](respondWithFilteredResult(_0x55b220,_0xaf3796))[_0xab28('0x22')](handleError(_0x55b220,null));};exports[_0xab28('0x5d')]=function(_0x254367,_0x29a235){var _0x473c0b={'raw':![],'where':{'id':_0x254367[_0xab28('0x5e')]['id']},'include':[{'model':db[_0xab28('0x47')],'as':_0xab28('0x5f')}]},_0x10b226={};_0x10b226[_0xab28('0x43')]=_[_0xab28('0x4c')](db['ChatWebsite'][_0xab28('0x4a')]);_0x10b226[_0xab28('0x4d')]=_[_0xab28('0x4c')](_0x254367['query']);_0x10b226[_0xab28('0x55')]=_['intersection'](_0x10b226[_0xab28('0x43')],_0x10b226[_0xab28('0x4d')]);_0x473c0b['attributes']=_['intersection'](_0x10b226[_0xab28('0x43')],qs[_0xab28('0x60')](_0x254367['query'][_0xab28('0x60')]));_0x473c0b['attributes']=_0x473c0b['attributes'][_0xab28('0x61')]?_0x473c0b[_0xab28('0x4f')]:_0x10b226[_0xab28('0x43')];if(_0x254367['query'][_0xab28('0x59')]){_0x473c0b[_0xab28('0x5a')]=[{'all':!![]}];}_0x473c0b=_[_0xab28('0x58')]({},_0x473c0b,_0x254367[_0xab28('0x62')]);return db[_0xab28('0x49')][_0xab28('0x63')](_0x473c0b)[_0xab28('0x2d')](handleEntityNotFound(_0x29a235,null))['then'](respondWithResult(_0x29a235,null))[_0xab28('0x22')](handleError(_0x29a235,null));};exports[_0xab28('0x64')]=function(_0x8b9fa3,_0x7c046d){var _0x21b1a6=null;_0x8b9fa3[_0xab28('0x65')][_0xab28('0x66')]['split'](',')[_0xab28('0x67')](_0x1a2753=>{if(_0x1a2753['trim']()!==''&&!wildcardUtils[_0xab28('0x68')](_0x1a2753['trim']())){_0x21b1a6=new APIBadRequestError('\x22'+_0x1a2753[_0xab28('0x69')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x21b1a6){return handleError(_0x7c046d,null)(_0x21b1a6);}return db[_0xab28('0x49')][_0xab28('0x64')](_0x8b9fa3[_0xab28('0x65')],{})['then'](function(_0x3fbbd4){var _0x11699a=_0x8b9fa3[_0xab28('0x6a')]['get']({'plain':!![]});if(!_0x11699a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11699a['role']==='user'){var _0x4ede4f=_0x3fbbd4[_0xab28('0x6b')]({'plain':!![]});var _0x25f342=_0xab28('0x6c');return db[_0xab28('0x6d')][_0xab28('0x63')]({'where':{'name':_0x25f342,'userProfileId':_0x11699a['userProfileId']},'raw':!![]})[_0xab28('0x2d')](function(_0x337b3d){if(_0x337b3d&&_0x337b3d[_0xab28('0x6e')]===0x0){return db[_0xab28('0x2f')][_0xab28('0x64')]({'name':_0x4ede4f['name'],'resourceId':_0x4ede4f['id'],'type':_0x337b3d[_0xab28('0x31')],'sectionId':_0x337b3d['id']},{})['then'](function(){return _0x3fbbd4;});}else{return _0x3fbbd4;}})[_0xab28('0x22')](function(_0x490858){logger[_0xab28('0x1e')](_0xab28('0x6f'),_0x490858);throw _0x490858;});}return _0x3fbbd4;})[_0xab28('0x2d')](respondWithResult(_0x7c046d,0xc9))[_0xab28('0x22')](handleError(_0x7c046d,null));};exports[_0xab28('0x2c')]=function(_0x3c9d1f,_0x75c7f6){var _0x345252=null;_0x3c9d1f['body'][_0xab28('0x66')][_0xab28('0x3a')](',')['forEach'](_0x46d287=>{if(_0x46d287[_0xab28('0x69')]()!==''&&!wildcardUtils[_0xab28('0x68')](_0x46d287[_0xab28('0x69')]())){_0x345252=new APIBadRequestError('\x22'+_0x46d287[_0xab28('0x69')]()+_0xab28('0x70'));}});if(_0x345252){return handleError(_0x75c7f6,null)(_0x345252);}if(_0x3c9d1f[_0xab28('0x65')]['id']){delete _0x3c9d1f[_0xab28('0x65')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x3c9d1f['params']['id']},'include':[{'model':db[_0xab28('0x47')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x75c7f6,null))[_0xab28('0x2d')](saveUpdates(_0x3c9d1f[_0xab28('0x65')],null))[_0xab28('0x2d')](respondWithResult(_0x75c7f6,null))[_0xab28('0x22')](handleError(_0x75c7f6,null));};exports[_0xab28('0x2e')]=function(_0x474233,_0xe536f3){return db[_0xab28('0x49')][_0xab28('0x63')]({'where':{'id':_0x474233[_0xab28('0x5e')]['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0xe536f3,null))[_0xab28('0x2d')](removeEntity(_0xe536f3,null))[_0xab28('0x22')](handleError(_0xe536f3,null));};exports[_0xab28('0x71')]=function(_0x1f2a31,_0x513e4e){return db[_0xab28('0x49')][_0xab28('0x71')]()[_0xab28('0x2d')](respondWithResult(_0x513e4e,null))[_0xab28('0x22')](handleError(_0x513e4e,null));};exports['addDisposition']=function(_0x530616,_0x3ee8d4){if(_0x530616[_0xab28('0x65')]['id']){delete _0x530616['body']['id'];}return db[_0xab28('0x49')][_0xab28('0x63')]({'where':{'id':_0x530616[_0xab28('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3ee8d4,null))['then'](function(_0x53c47c){if(_0x53c47c){_0x530616[_0xab28('0x65')][_0xab28('0x72')]=_0x53c47c['id'];return db['Disposition']['create'](_0x530616[_0xab28('0x65')]);}})[_0xab28('0x2d')](respondWithResult(_0x3ee8d4,null))[_0xab28('0x22')](handleError(_0x3ee8d4,null));};exports[_0xab28('0x73')]=function(_0x4198a4,_0x3cc368){var _0x594644={'raw':![],'where':{}};var _0x191ed8={};var _0x17d5c0={'count':0x0,'rows':[]};return db[_0xab28('0x49')][_0xab28('0x74')]({'where':{'id':_0x4198a4[_0xab28('0x5e')]['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x3cc368,null))[_0xab28('0x2d')](function(_0x5bb6c2){if(_0x5bb6c2){_0x191ed8[_0xab28('0x43')]=_['keys'](db[_0xab28('0x75')]['rawAttributes']);_0x191ed8[_0xab28('0x4d')]=_[_0xab28('0x4c')](_0x4198a4[_0xab28('0x4d')]);_0x191ed8[_0xab28('0x55')]=_['intersection'](_0x191ed8['model'],_0x191ed8['query']);_0x594644['attributes']=_[_0xab28('0x4e')](_0x191ed8[_0xab28('0x43')],qs[_0xab28('0x60')](_0x4198a4[_0xab28('0x4d')][_0xab28('0x60')]));_0x594644[_0xab28('0x4f')]=_0x594644['attributes'][_0xab28('0x61')]?_0x594644[_0xab28('0x4f')]:_0x191ed8[_0xab28('0x43')];if(!_0x4198a4[_0xab28('0x4d')][_0xab28('0x50')](_0xab28('0x51'))){_0x594644[_0xab28('0x28')]=qs[_0xab28('0x28')](_0x4198a4[_0xab28('0x4d')][_0xab28('0x28')]);_0x594644[_0xab28('0x27')]=qs[_0xab28('0x27')](_0x4198a4[_0xab28('0x4d')][_0xab28('0x27')]);}_0x594644[_0xab28('0x52')]=qs[_0xab28('0x53')](_0x4198a4[_0xab28('0x4d')]['sort']);_0x594644[_0xab28('0x54')]=qs['filters'](_[_0xab28('0x56')](_0x4198a4[_0xab28('0x4d')],_0x191ed8[_0xab28('0x55')]));_0x594644[_0xab28('0x54')]['ChatWebsiteId']=_0x5bb6c2['id'];if(_0x4198a4[_0xab28('0x4d')][_0xab28('0x57')]){_0x594644[_0xab28('0x54')]=_[_0xab28('0x58')](_0x594644[_0xab28('0x54')],{'$or':_[_0xab28('0x48')](_0x594644[_0xab28('0x4f')],function(_0x337c30){var _0x1eaa53={};_0x1eaa53[_0x337c30]={'$like':'%'+_0x4198a4[_0xab28('0x4d')]['filter']+'%'};return _0x1eaa53;})});}_0x594644=_[_0xab28('0x58')]({},_0x594644,_0x4198a4['options']);return db['Disposition'][_0xab28('0x2a')]({'where':_0x594644['where']})['then'](function(_0x3921fa){_0x17d5c0['count']=_0x3921fa;if(_0x4198a4['query'][_0xab28('0x59')]){_0x594644[_0xab28('0x5a')]=[{'all':!![]}];}return db[_0xab28('0x75')][_0xab28('0x5b')](_0x594644);})[_0xab28('0x2d')](function(_0x3e4ed0){_0x17d5c0['rows']=_0x3e4ed0;return _0x17d5c0;});}})[_0xab28('0x2d')](respondWithFilteredResult(_0x3cc368,_0x594644))[_0xab28('0x22')](handleError(_0x3cc368,null));};exports['removeDispositions']=function(_0x411ee3,_0x2ca31a){return db[_0xab28('0x49')][_0xab28('0x63')]({'where':{'id':_0x411ee3[_0xab28('0x5e')]['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x2ca31a,null))[_0xab28('0x2d')](function(_0x3a4118){if(_0x3a4118){return _0x3a4118['removeDispositions'](_0x411ee3[_0xab28('0x4d')]['ids']);}})[_0xab28('0x2d')](respondWithStatusCode(_0x2ca31a,null))[_0xab28('0x22')](handleError(_0x2ca31a,null));};exports[_0xab28('0x76')]=function(_0x7347ff,_0x190afe){if(_0x7347ff[_0xab28('0x65')]['id']){delete _0x7347ff[_0xab28('0x65')]['id'];}return db['ChatWebsite'][_0xab28('0x63')]({'where':{'id':_0x7347ff['params']['id']}})['then'](handleEntityNotFound(_0x190afe,null))['then'](function(_0x2d975d){if(_0x2d975d){_0x7347ff[_0xab28('0x65')][_0xab28('0x72')]=_0x2d975d['id'];return db[_0xab28('0x77')][_0xab28('0x64')](_0x7347ff['body']);}})[_0xab28('0x2d')](respondWithResult(_0x190afe,null))[_0xab28('0x22')](handleError(_0x190afe,null));};exports['getAnswers']=function(_0x1a79af,_0x3ad397){var _0xdf33b6={'raw':![],'where':{}};var _0x2d353b={};var _0x1c3e3f={'count':0x0,'rows':[]};return db[_0xab28('0x49')]['findOne']({'where':{'id':_0x1a79af[_0xab28('0x5e')]['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x3ad397,null))['then'](function(_0x25a286){if(_0x25a286){_0x2d353b['model']=_['keys'](db['CannedAnswer'][_0xab28('0x4a')]);_0x2d353b[_0xab28('0x4d')]=_['keys'](_0x1a79af[_0xab28('0x4d')]);_0x2d353b[_0xab28('0x55')]=_[_0xab28('0x4e')](_0x2d353b[_0xab28('0x43')],_0x2d353b['query']);_0xdf33b6[_0xab28('0x4f')]=_[_0xab28('0x4e')](_0x2d353b[_0xab28('0x43')],qs[_0xab28('0x60')](_0x1a79af[_0xab28('0x4d')][_0xab28('0x60')]));_0xdf33b6[_0xab28('0x4f')]=_0xdf33b6[_0xab28('0x4f')]['length']?_0xdf33b6[_0xab28('0x4f')]:_0x2d353b[_0xab28('0x43')];if(!_0x1a79af[_0xab28('0x4d')]['hasOwnProperty']('nolimit')){_0xdf33b6[_0xab28('0x28')]=qs[_0xab28('0x28')](_0x1a79af['query']['limit']);_0xdf33b6[_0xab28('0x27')]=qs['offset'](_0x1a79af[_0xab28('0x4d')][_0xab28('0x27')]);}_0xdf33b6['order']=qs[_0xab28('0x53')](_0x1a79af['query'][_0xab28('0x53')]);_0xdf33b6[_0xab28('0x54')]=qs[_0xab28('0x55')](_[_0xab28('0x56')](_0x1a79af[_0xab28('0x4d')],_0x2d353b[_0xab28('0x55')]));_0xdf33b6[_0xab28('0x54')][_0xab28('0x72')]=_0x25a286['id'];if(_0x1a79af[_0xab28('0x4d')]['filter']){_0xdf33b6[_0xab28('0x54')]=_['merge'](_0xdf33b6[_0xab28('0x54')],{'$or':_[_0xab28('0x48')](_0xdf33b6['attributes'],function(_0x19619b){var _0x568ba4={};_0x568ba4[_0x19619b]={'$like':'%'+_0x1a79af['query'][_0xab28('0x57')]+'%'};return _0x568ba4;})});}_0xdf33b6=_['merge']({},_0xdf33b6,_0x1a79af['options']);return db[_0xab28('0x77')][_0xab28('0x2a')]({'where':_0xdf33b6[_0xab28('0x54')]})['then'](function(_0x7a209c){_0x1c3e3f[_0xab28('0x2a')]=_0x7a209c;if(_0x1a79af[_0xab28('0x4d')]['includeAll']){_0xdf33b6['include']=[{'all':!![]}];}return db[_0xab28('0x77')][_0xab28('0x5b')](_0xdf33b6);})[_0xab28('0x2d')](function(_0xdab11e){_0x1c3e3f[_0xab28('0x5c')]=_0xdab11e;return _0x1c3e3f;});}})[_0xab28('0x2d')](respondWithFilteredResult(_0x3ad397,_0xdf33b6))[_0xab28('0x22')](handleError(_0x3ad397,null));};exports['removeAnswers']=function(_0x2bfe05,_0x134acd){return db[_0xab28('0x49')][_0xab28('0x63')]({'where':{'id':_0x2bfe05[_0xab28('0x5e')]['id']}})['then'](handleEntityNotFound(_0x134acd,null))[_0xab28('0x2d')](function(_0x3cc251){if(_0x3cc251){return _0x3cc251['removeAnswers'](_0x2bfe05[_0xab28('0x4d')][_0xab28('0x78')]);}})[_0xab28('0x2d')](respondWithStatusCode(_0x134acd,null))['catch'](handleError(_0x134acd,null));};exports[_0xab28('0x79')]=function(_0x3c18ec,_0x391ac6){_0x3c18ec['body']['sitepic']=_0x3c18ec[_0xab28('0x7a')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x3c18ec[_0xab28('0x5e')]['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x391ac6,null))[_0xab28('0x2d')](saveUpdates(_0x3c18ec[_0xab28('0x65')],null))[_0xab28('0x2d')](respondWithResult(_0x391ac6,null))['catch'](handleError(_0x391ac6,null));};exports['addAvatar']=function(_0xd408bc,_0x1d9aa6){_0xd408bc[_0xab28('0x65')][_0xab28('0x7b')]=_0xd408bc[_0xab28('0x7a')][_0xab28('0x7c')];return db['ChatWebsite'][_0xab28('0x63')]({'where':{'id':_0xd408bc[_0xab28('0x5e')]['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x1d9aa6,null))[_0xab28('0x2d')](saveUpdates(_0xd408bc[_0xab28('0x65')],null))[_0xab28('0x2d')](respondWithResult(_0x1d9aa6,null))[_0xab28('0x22')](handleError(_0x1d9aa6,null));};exports['addCustomerAvatar']=function(_0x471ee3,_0xb955db){_0x471ee3['body']['customerAvatar']=_0x471ee3[_0xab28('0x7a')][_0xab28('0x7c')];return db['ChatWebsite']['find']({'where':{'id':_0x471ee3[_0xab28('0x5e')]['id']}})['then'](handleEntityNotFound(_0xb955db,null))[_0xab28('0x2d')](saveUpdates(_0x471ee3[_0xab28('0x65')],null))[_0xab28('0x2d')](respondWithResult(_0xb955db,null))['catch'](handleError(_0xb955db,null));};exports[_0xab28('0x7d')]=function(_0x24ebaa,_0x28ae61){_0x24ebaa[_0xab28('0x65')][_0xab28('0x7e')]=_0x24ebaa[_0xab28('0x7a')][_0xab28('0x7c')];return db[_0xab28('0x49')][_0xab28('0x63')]({'where':{'id':_0x24ebaa['params']['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x28ae61,null))[_0xab28('0x2d')](saveUpdates(_0x24ebaa[_0xab28('0x65')],null))['then'](respondWithResult(_0x28ae61,null))[_0xab28('0x22')](handleError(_0x28ae61,null));};exports[_0xab28('0x7f')]=function(_0x397113,_0x53d31a){var _0xd9cce9=path[_0xab28('0x80')](config[_0xab28('0x81')],_0xab28('0x82'));var _0x517b8d={'where':{'id':_0x397113[_0xab28('0x5e')]['id']},'attributes':['id',_0xab28('0x83')],'raw':!![]};var _0x63339=![];return require('../../config/license/util')[_0xab28('0x84')]()[_0xab28('0x2d')](function(_0x4c446a){if(_0x4c446a){_0x63339=_0x4c446a[_0xab28('0x85')];}})['then'](function(){return db['ChatWebsite'][_0xab28('0x63')](_0x517b8d);})[_0xab28('0x2d')](handleEntityNotFound(_0x53d31a,null))[_0xab28('0x2d')](function(_0x53ff33){if(_0x53ff33){if(!_[_0xab28('0x86')](_0x53ff33[_0xab28('0x83')])){if(fs[_0xab28('0x87')](path[_0xab28('0x80')](config[_0xab28('0x81')],_0xab28('0x88'),_0x53ff33['sitepic']))&&_0x63339){_0xd9cce9=path['join'](config[_0xab28('0x81')],_0xab28('0x88'),_0x53ff33[_0xab28('0x83')]);}}return _0x53d31a['download'](_0xd9cce9);}})[_0xab28('0x22')](handleError(_0x53d31a,null));};exports[_0xab28('0x89')]=function(_0x5416c3,_0x2f2472){var _0x1a3356=path['join'](config[_0xab28('0x81')],_0xab28('0x8a'));var _0x18b66d={'where':{'id':_0x5416c3[_0xab28('0x5e')]['id']},'attributes':['id',_0xab28('0x7b')],'raw':!![]};return db[_0xab28('0x49')][_0xab28('0x63')](_0x18b66d)[_0xab28('0x2d')](handleEntityNotFound(_0x2f2472,null))['then'](function(_0x17e61d){if(_0x17e61d){if(!_['isNil'](_0x17e61d[_0xab28('0x7b')])){if(fs[_0xab28('0x87')](path[_0xab28('0x80')](config[_0xab28('0x81')],'server/files/images/avatars/',_0x17e61d['agentAvatar']))){_0x1a3356=path[_0xab28('0x80')](config[_0xab28('0x81')],_0xab28('0x8b'),_0x17e61d[_0xab28('0x7b')]);}}return _0x2f2472[_0xab28('0x8c')](_0x1a3356);}})[_0xab28('0x22')](handleError(_0x2f2472,null));};exports[_0xab28('0x8d')]=function(_0x3f1055,_0x4a6cdd){var _0x12e7e9=path[_0xab28('0x80')](config[_0xab28('0x81')],_0xab28('0x8e'));var _0x2c1d28={'where':{'id':_0x3f1055[_0xab28('0x5e')]['id']},'attributes':['id','customerAvatar',_0xab28('0x8f')],'raw':!![]};return db[_0xab28('0x49')][_0xab28('0x63')](_0x2c1d28)[_0xab28('0x2d')](handleEntityNotFound(_0x4a6cdd,null))['then'](function(_0x35a668){if(_0x35a668){if(!_[_0xab28('0x86')](_0x35a668[_0xab28('0x90')])){if(fs['existsSync'](path[_0xab28('0x80')](config[_0xab28('0x81')],_0xab28('0x8b'),_0x35a668[_0xab28('0x90')]))&&_0x35a668[_0xab28('0x8f')]){_0x12e7e9=path[_0xab28('0x80')](config[_0xab28('0x81')],_0xab28('0x8b'),_0x35a668[_0xab28('0x90')]);}}return _0x4a6cdd[_0xab28('0x8c')](_0x12e7e9);}})[_0xab28('0x22')](handleError(_0x4a6cdd,null));};exports[_0xab28('0x91')]=function(_0x10babb,_0x2241e2){var _0x3f3f00=path['join'](config[_0xab28('0x81')],_0xab28('0x92'));var _0x21172f={'where':{'id':_0x10babb[_0xab28('0x5e')]['id']},'attributes':['id',_0xab28('0x7e')],'raw':!![]};return db[_0xab28('0x49')]['find'](_0x21172f)[_0xab28('0x2d')](handleEntityNotFound(_0x2241e2,null))[_0xab28('0x2d')](function(_0x25b996){if(_0x25b996){if(!_[_0xab28('0x86')](_0x25b996[_0xab28('0x7e')])){if(fs[_0xab28('0x87')](path[_0xab28('0x80')](config[_0xab28('0x81')],_0xab28('0x8b'),_0x25b996[_0xab28('0x7e')]))){_0x3f3f00=path['join'](config[_0xab28('0x81')],'server/files/images/avatars/',_0x25b996[_0xab28('0x7e')]);}}return _0x2241e2[_0xab28('0x8c')](_0x3f3f00);}})[_0xab28('0x22')](handleError(_0x2241e2,null));};function checkWebsiteInterval(_0x287bc6){var _0x1b2314=_0x287bc6['Interval'];if(!_0x1b2314){return Promise[_0xab28('0x93')](_0x287bc6);}var _0x495a52=_0x287bc6[_0xab28('0x94')]||undefined;return _0x1b2314[_0xab28('0x95')](_0x495a52)[_0xab28('0x2d')](function(_0x3a9469){if(!_0x3a9469){throw new APIOutOfIntervalError();}return _0x287bc6;});}exports[_0xab28('0x96')]=function(_0x32a2c8,_0x52cbb3){var _0x517e72={'body':_0x32a2c8[_0xab28('0x65')],'channel':'chat'};var _0xf8a32d=[];var _0x19deaa=[];var _0x4d56a7={};var _0x31061d=![];if(_0x32a2c8[_0xab28('0x65')]['id']){delete _0x32a2c8[_0xab28('0x65')]['id'];}if(_['isNil'](_0x32a2c8['body'][_0xab28('0x97')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xab28('0x86')](_0x32a2c8[_0xab28('0x65')][_0xab28('0x98')])){throw new APIBadRequestError(_0xab28('0x99'));}if(_[_0xab28('0x9a')](_0x32a2c8[_0xab28('0x65')][_0xab28('0x65')])){throw new APIBadRequestError(_0xab28('0x9b'));}var _0xe0722f=_0x32a2c8[_0xab28('0x65')][_0xab28('0x36')]&&_0x32a2c8[_0xab28('0x65')][_0xab28('0x3d')];return db[_0xab28('0x9c')]['describe']()[_0xab28('0x2d')](function(_0x3329ee){if(!_0x3329ee){throw new Error(_0xab28('0x9d'));}_0xf8a32d=Object['keys'](_0x3329ee)[_0xab28('0x57')](function(_0x6c9a43){return![_0xab28('0x9e'),_0xab28('0x9f')][_0xab28('0xa0')](_0x6c9a43);});_0x19deaa=Object[_0xab28('0x4c')](_0x3329ee)['filter'](function(_0x35e2f9){return![_0xab28('0x9e'),_0xab28('0x9f'),_0xab28('0xa1'),'ListId']['includes'](_0x35e2f9);});if(!_['includes'](_0x19deaa,_0x32a2c8[_0xab28('0x65')][_0xab28('0x98')])){throw new APIBadRequestError(_0xab28('0xa2')+_0x19deaa[_0xab28('0x80')](',\x20'));}_0x4d56a7[_0x32a2c8['body'][_0xab28('0x98')]]=_0x32a2c8[_0xab28('0x65')][_0xab28('0x97')];})[_0xab28('0x2d')](function(){return db[_0xab28('0x49')][_0xab28('0x63')]({'where':{'id':_0x32a2c8[_0xab28('0x5e')]['id']},'include':[{'model':db[_0xab28('0xa3')],'as':_0xab28('0xa4'),'include':[{'model':db[_0xab28('0x9c')],'as':_0xab28('0xa5'),'where':_0x4d56a7,'limit':0x1,'order':[[_0xab28('0x9f'),_0xab28('0xa6')]]}]},{'model':db[_0xab28('0xa7')],'as':_0xab28('0xa8')},{'model':db[_0xab28('0xa9')],'as':_0xab28('0xa9'),'include':[{'model':db[_0xab28('0xa9')],'as':_0xab28('0xaa'),'attributes':['id',_0xab28('0xab')],'raw':!![]}]}]});})[_0xab28('0x2d')](function(_0x3c9865){if(!_0x3c9865){throw new APINotFoundError(util[_0xab28('0x45')](_0xab28('0xac'),_0x32a2c8['params']['id']));}if(_0xe0722f){return checkWebsiteInterval(_0x3c9865);}return _0x3c9865;})['then'](function(_0x15e744){_0x517e72[_0xab28('0xad')]=_0x15e744;_0x517e72[_0xab28('0xae')]=_[_0xab28('0xaf')](_0x15e744[_0xab28('0xa8')],[_0xab28('0xb0')],['asc']);if(_0x517e72[_0xab28('0xad')][_0xab28('0xa8')]){delete _0x517e72[_0xab28('0xad')][_0xab28('0xa8')];}_0x517e72['list']=_0x15e744[_0xab28('0xa4')]||{'id':_0x15e744[_0xab28('0xb1')]};if(_0x517e72[_0xab28('0xb2')]&&_0x517e72[_0xab28('0xb2')][_0xab28('0xa5')][_0xab28('0x61')]){return _0x517e72[_0xab28('0xb2')][_0xab28('0xa5')][0x0];}var _0x3dcc26=_['defaults'](_0x32a2c8[_0xab28('0x65')],{'firstName':_0x32a2c8[_0xab28('0x65')][_0xab28('0x97')],'ListId':_0x15e744[_0xab28('0xb1')]});_0x3dcc26[_0x32a2c8[_0xab28('0x65')][_0xab28('0x98')]]=_0x32a2c8[_0xab28('0x65')]['from'];return db[_0xab28('0x9c')][_0xab28('0x64')](_0x3dcc26,{'fields':_0xf8a32d,'raw':!![]});})['then'](function(_0x48a01c){_0x517e72['contact']=_0x48a01c;var _0x4c9b5a=createInteractionObject(_0x32a2c8[_0xab28('0x5e')]['id'],_0x32a2c8[_0xab28('0x65')],_0x32a2c8[_0xab28('0xb3')],_0x48a01c);var _0x22960e={'ChatWebsiteId':_0x32a2c8[_0xab28('0x5e')]['id']};if(_0x32a2c8['body'][_0xab28('0xb4')]){_0x22960e[_0xab28('0xb4')]=_0x32a2c8[_0xab28('0x65')][_0xab28('0xb4')];_0x22960e['closed']=![];return db['ChatInteraction'][_0xab28('0x63')]({'where':_0x22960e})[_0xab28('0x2d')](function(_0x383862){var _0x42e274=_0x32a2c8['body'][_0xab28('0x36')]&&_0x32a2c8['body'][_0xab28('0x3d')];if(_0x383862){_0x31061d=!![];return _0x383862;}else if(!_0x42e274&&_0x383862&&_0x383862[_0xab28('0xb5')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x4c9b5a[_0xab28('0xb4')]=_0x32a2c8[_0xab28('0x65')][_0xab28('0xb4')];_0x4c9b5a[_0xab28('0xb6')]=_0x32a2c8['body']['externalUrl'];return db[_0xab28('0xb7')][_0xab28('0x64')](_0x4c9b5a);});}_0x22960e[_0xab28('0xb8')]=_0x48a01c['id'];if(_0x32a2c8[_0xab28('0x65')][_0xab28('0xb9')]&&_0x32a2c8[_0xab28('0x65')][_0xab28('0xb9')]['id']){_0x22960e['id']=_0x32a2c8[_0xab28('0x65')][_0xab28('0xb9')]['id'];return db[_0xab28('0xb7')][_0xab28('0x63')]({'where':_0x22960e})[_0xab28('0x2d')](function(_0x5a6dfe){var _0x41570e=_0x32a2c8[_0xab28('0x65')]['customerIp']&&_0x32a2c8['body'][_0xab28('0x3d')];if(!_0x41570e&&_0x5a6dfe&&_0x5a6dfe[_0xab28('0xb5')]){throw new APIConflictError(_0xab28('0xba'));}else if(_0x5a6dfe){_0x31061d=!![];return _0x5a6dfe;}else{return db[_0xab28('0xb7')][_0xab28('0x64')](_0x4c9b5a);}});}return db[_0xab28('0xb7')][_0xab28('0x64')](_0x4c9b5a);})['then'](function(_0x428eee){if(!_0x31061d){return _0x428eee;}var _0x5ae443={'from':(_0x517e72[_0xab28('0xbb')]['firstName']||'')+'\x20'+(_0x517e72[_0xab28('0xbb')]['lastName']||'')};if(_0x32a2c8['body'][_0xab28('0xb4')]&&_0x32a2c8[_0xab28('0x65')][_0xab28('0xbc')]&&_0x32a2c8[_0xab28('0x65')][_0xab28('0xb4')]!=_0x32a2c8[_0xab28('0x65')]['messageId']){_0x5ae443['threadId']=_0x32a2c8['body'][_0xab28('0xbc')];}return _0x428eee[_0xab28('0x2c')](_0x5ae443);})[_0xab28('0x2d')](function(_0x20bfdc){_0x517e72[_0xab28('0xb9')]=_0x20bfdc['get']({'plain':!![]});_0x517e72[_0xab28('0xb9')][_0xab28('0xbd')]=!_0x31061d;if(_0x517e72[_0xab28('0xb9')]['created']){if(_0x517e72[_0xab28('0xad')]['autoclose']){_0x517e72[_0xab28('0xae')]['push']({'id':0x0,'priority':_0x517e72[_0xab28('0xae')][_0xab28('0x61')]+0x1,'app':_0xab28('0xbe'),'appdata':_0xab28('0xbf'),'interval':_0xab28('0xc0')});}}return db[_0xab28('0xc1')][_0xab28('0x64')]({'body':_0x32a2c8[_0xab28('0x65')][_0xab28('0x65')],'ChatWebsiteId':_0x32a2c8[_0xab28('0x5e')]['id'],'ChatInteractionId':_0x20bfdc['id'],'direction':'in','ContactId':_0x517e72[_0xab28('0xbb')]['id'],'AttachmentId':_0x32a2c8[_0xab28('0x65')][_0xab28('0xc2')]});})[_0xab28('0x2d')](function(_0x57eee5){_0x517e72[_0xab28('0x20')]=_0x57eee5;if(!_0x517e72[_0xab28('0xb9')][_0xab28('0xc3')]){return;}return db['User'][_0xab28('0x63')]({'attributes':['id',_0xab28('0x31')],'where':{'id':_0x517e72[_0xab28('0xb9')][_0xab28('0xc3')]}});})[_0xab28('0x2d')](function(_0x5db23a){if(_0x5db23a){_0x517e72['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5db23a[_0xab28('0x31')]+','+(_0x517e72['account'][_0xab28('0xc4')]||0xa),'interval':_0xab28('0xc0')});_0x517e72[_0xab28('0xc5')]=!![];}if(!_0x517e72[_0xab28('0xb9')][_0xab28('0xc6')]){return;}return db['ChatQueue'][_0xab28('0x63')]({'attributes':['id',_0xab28('0x31')],'where':{'id':_0x517e72[_0xab28('0xb9')][_0xab28('0xc6')]}});})[_0xab28('0x2d')](function(_0x42a488){if(_0x42a488){_0x517e72['applications'][_0xab28('0xc7')]({'id':0x0,'priority':0x1,'app':_0xab28('0xc8'),'appdata':_0x42a488[_0xab28('0x31')]+','+(_0x517e72[_0xab28('0xad')]['waitForTheAssignedQueue']||0x12c),'interval':_0xab28('0xc0')});}return respondWithRpcPromise(_0xab28('0xc9'),'startRouting',_0x517e72);})[_0xab28('0x2d')](function(_0x2065d9){respondWithRpcPromise('EventManager',_0xab28('0xca'),{'event':_0xab28('0x96'),'message':_0x2065d9},client9002);return _0x2065d9;})[_0xab28('0x2d')](respondWithResult(_0x52cbb3,null))[_0xab28('0x22')](APIHandleError(_0x52cbb3));};exports['offline']=function(_0x5a5311,_0x14ec89){var _0x17e9d7,_0x105948,_0x55c3f4;var _0x58bdef=[];var _0x32ec16={};var _0x7146f2=_0x5a5311[_0xab28('0xcb')]||[];var _0x140194=[];var _0x364341;return db[_0xab28('0x9c')][_0xab28('0x71')]()['then'](function(_0x3db316){if(!_0x3db316){throw new db['Sequelize'][(_0xab28('0xcc'))](_0xab28('0xcd'));}_0x58bdef=_[_0xab28('0xce')](_[_0xab28('0x4c')](_0x3db316),[_0xab28('0x9e'),_0xab28('0x9f'),_0xab28('0xa1'),_0xab28('0xb1')]);if(_0x5a5311[_0xab28('0x65')]['id']){delete _0x5a5311[_0xab28('0x65')]['id'];}if(_[_0xab28('0x86')](_0x5a5311['body'][_0xab28('0x97')])){throw _0x14ec89[_0xab28('0x25')](0x1f4)[_0xab28('0x32')](new db[(_0xab28('0xcf'))][(_0xab28('0xcc'))](_0xab28('0xd0')));}if(_[_0xab28('0x86')](_0x5a5311[_0xab28('0x65')]['body'])||_0x5a5311['body'][_0xab28('0x65')]===''){throw _0x14ec89[_0xab28('0x25')](0x1f4)[_0xab28('0x32')](new db[(_0xab28('0xcf'))][(_0xab28('0xcc'))](_0xab28('0xd1')));}if(_[_0xab28('0x86')](_0x5a5311[_0xab28('0x65')][_0xab28('0xd2')])){throw _0x14ec89['status'](0x1f4)[_0xab28('0x32')](new db[(_0xab28('0xcf'))]['ValidationError'](_0xab28('0xd3')+_0x58bdef));}if(!_['includes'](_0x58bdef,_0x5a5311[_0xab28('0x65')][_0xab28('0xd2')])){throw _0x14ec89[_0xab28('0x25')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0xab28('0xd4')+_0x58bdef));}_0x32ec16[_0x5a5311[_0xab28('0x65')][_0xab28('0xd2')]]=_0x5a5311[_0xab28('0x65')]['from'];})[_0xab28('0x2d')](function(){return db[_0xab28('0x49')][_0xab28('0x63')]({'where':{'id':_0x5a5311[_0xab28('0x5e')]['id']},'include':[{'model':db[_0xab28('0xa3')],'as':_0xab28('0xa4')},{'model':db[_0xab28('0xd5')],'as':_0xab28('0xd5')}]});})[_0xab28('0x2d')](handleEntityNotFound(_0x14ec89,null))[_0xab28('0x2d')](function(_0x391ae2){if(_0x391ae2&&_0x391ae2['List']){_0x105948=_0x391ae2;var _0x252091=_['defaults'](_0x5a5311[_0xab28('0x65')],{'firstName':_0x5a5311[_0xab28('0x65')]['from'],'phone':_0x5a5311[_0xab28('0x65')][_0xab28('0x97')],'ListId':_0x391ae2[_0xab28('0xb1')]});_0x252091[_0x5a5311[_0xab28('0x65')][_0xab28('0xd2')]]=_0x5a5311[_0xab28('0x65')]['from'];return db[_0xab28('0x9c')][_0xab28('0xd6')]({'where':_0x32ec16,'defaults':_0x252091});}})[_0xab28('0xd7')](function(_0x51b596){if(_0x51b596){_0x55c3f4=_0x51b596;var _0x57908a=fs[_0xab28('0xd8')](path[_0xab28('0x80')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0xab28('0xd9'));var _0x4b2620=ejs[_0xab28('0xda')](_0x57908a,{'body':_[_0xab28('0xdb')](_0x5a5311[_0xab28('0x65')][_0xab28('0x65')]),'bodyTitle':_0x105948[_0xab28('0xdc')]});return db[_0xab28('0xdd')][_0xab28('0x64')]({'body':_0x4b2620,'plainBody':htmlToText[_0xab28('0xde')](_0x4b2620),'ContactId':_0x51b596['id'],'ChatWebsiteId':_0x105948['id']});}})[_0xab28('0x2d')](function(_0x3433c0){_0x364341=_0x3433c0;if(_0x7146f2['length']){var _0x6c7993=_0x7146f2[_0xab28('0x48')](function(_0x10c15f){return{'name':_0x10c15f[_0xab28('0xdf')],'basename':_0x10c15f[_0xab28('0x7c')],'type':_0x10c15f[_0xab28('0xe0')],'ChatOfflineMessageId':_0x3433c0['id']};});_0x140194=_0x6c7993[_0xab28('0x48')](_0x5aafb1=>{var _0x2a7bf5={'filename':_0x5aafb1[_0xab28('0x31')],'path':path[_0xab28('0x80')](config[_0xab28('0x81')],_0xab28('0xe1'),_0xab28('0xcb'),_0xab28('0xe2'),_0xab28('0xe3'),_0x5aafb1[_0xab28('0xe4')])};return _0x2a7bf5;});if(!_0x105948['openNewInteraction']){return db[_0xab28('0xe5')][_0xab28('0xe6')](function(_0x5a0682){return db[_0xab28('0xe7')][_0xab28('0xe8')](_0x6c7993,{'transaction':_0x5a0682});});}}})[_0xab28('0x2d')](function(){if(_0x364341){_0x17e9d7=_0x364341;return db[_0xab28('0xd5')][_0xab28('0x74')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xab28('0xe9'),'raw':!![],'include':[{'model':db[_0xab28('0xea')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xab28('0x2d')](function(_0x41f40f){if(_0x41f40f&&_0x41f40f['Smtp']&&_0x105948[_0xab28('0xeb')]&&_0x105948[_0xab28('0xec')]){var _0xc008d=_0x41f40f[_0xab28('0xed')]();return respondWithRpcPromise(_0xab28('0xee'),_0xab28('0xef'),{'account':_0xc008d,'message':{'from':util[_0xab28('0x45')]('\x22%s\x22\x20<%s>',_0x41f40f[_0xab28('0x31')],_0x41f40f['email']||_0x41f40f[_0xab28('0xe9')][_0xab28('0x6a')]),'to':_0x105948[_0xab28('0xec')],'subject':_0x105948[_0xab28('0xf0')],'html':_0x17e9d7['body'],'attachments':_0x140194}},client9003)[_0xab28('0x2d')](function(){return _0x17e9d7;})[_0xab28('0x22')](function(_0x34b396){logger[_0xab28('0x1e')](_0x34b396);});}})['then'](function(){if(_0x105948&&_0x105948['openNewInteraction']&&_0x105948[_0xab28('0xf1')]){var _0x244dc1=[];if(_0x7146f2[_0xab28('0x61')]){_0x244dc1=_0x7146f2['map'](function(_0x3dd69b){return{'name':_0x3dd69b[_0xab28('0xdf')],'basename':_0x3dd69b[_0xab28('0x7c')],'type':_0x3dd69b[_0xab28('0xe0')],'ChatOfflineMessageId':_0x364341['id']};});}var _0x41d902;if(!_[_0xab28('0x86')](_0x105948['subjectOffline'])){var _0x2d8972=_[_0xab28('0x48')](_0x5a5311['body'],function(_0x187d7b){return _0x187d7b;});var _0x3250c7=_[_0xab28('0xf2')](_0x2d8972)[0x0];var _0x46750d=_['mapValues'](_0x3250c7,function(_0x4d9c6b){return _0x4d9c6b;});_0x41d902=_0x46750d[0x1][_0x105948[_0xab28('0xf3')]];}var _0x5f3ce9={'from':_0x55c3f4[_0xab28('0xf4')],'firstName':_0x55c3f4['firstName'],'lastName':_0x55c3f4[_0xab28('0xf5')],'mapKey':'email','message':{'from':_0x55c3f4['email'],'to':_0x105948[_0xab28('0xd5')][_0xab28('0xf4')],'cc':'','subject':_[_0xab28('0x86')](_0x41d902)?_0x105948[_0xab28('0xf0')]:_0x41d902,'messageId':'','sentAt':new Date(),'attach':_0x244dc1['length'],'attachments':_0x244dc1,'originChannel':_0xab28('0xf6'),'ChatWebsiteId':_0x105948['id'],'ChatOfflineMessageId':_0x17e9d7['id'],'originTo':_0x105948[_0xab28('0xd5')]['email']},'body':_0x17e9d7[_0xab28('0x65')]};var _0x46e4d2={'account':{'id':_0x105948['MailAccountId']},'body':_0x5f3ce9,'log':_0xab28('0xf7')};return respondWithRpcPromise(_0xab28('0xf7'),_0xab28('0xf8'),_0x46e4d2,client9001)['then'](function(){return _0x17e9d7;})[_0xab28('0x22')](function(_0x11ac33){logger['error'](_0x11ac33);});}return;})['then'](function(){if(_0x17e9d7){return _0x17e9d7;}})[_0xab28('0x2d')](respondWithResult(_0x14ec89,null))['catch'](function(){for(var _0x1f4d24 of _0x7146f2){var _0x32ac60=path[_0xab28('0x80')](config[_0xab28('0x81')],_0xab28('0xe1'),_0xab28('0xcb'),_0xab28('0xe2'),_0xab28('0xe3'),_0x1f4d24[_0xab28('0x7c')]);fs_extra['remove'](_0x32ac60)[_0xab28('0x22')](function(_0x37d8e9){logger[_0xab28('0x1e')](_0xab28('0xf9'),_0x32ac60,_0x37d8e9);});}});};exports[_0xab28('0xfa')]=function(_0x4891bd,_0x947022){return db[_0xab28('0xb7')][_0xab28('0x63')]({'where':{'id':_0x4891bd[_0xab28('0x5e')]['id']}})['then'](handleEntityNotFound(_0x947022,null))[_0xab28('0x2d')](function(_0x1fbb0d){if(_0x1fbb0d){return _0x1fbb0d[_0xab28('0xfa')](_0x4891bd[_0xab28('0x65')]['ids'],_[_0xab28('0xfb')](_0x4891bd[_0xab28('0x65')],[_0xab28('0x78'),'id'])||{});}})[_0xab28('0x2d')](respondWithResult(_0x947022,null))[_0xab28('0x22')](handleError(_0x947022,null));};exports[_0xab28('0xfc')]=function(_0x278e4a,_0x1cf3ab){var _0x521521={'raw':![],'where':{}};var _0x36fb85={};var _0x304055={'count':0x0,'rows':[]};return db[_0xab28('0x49')][_0xab28('0x74')]({'where':{'id':_0x278e4a[_0xab28('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1cf3ab,null))[_0xab28('0x2d')](function(_0x393a63){if(_0x393a63){_0x36fb85['model']=_['keys'](db['ChatInteraction'][_0xab28('0x4a')]);_0x36fb85[_0xab28('0x4d')]=_['keys'](_0x278e4a['query']);_0x36fb85[_0xab28('0x55')]=_[_0xab28('0x4e')](_0x36fb85[_0xab28('0x43')],_0x36fb85[_0xab28('0x4d')]);_0x521521[_0xab28('0x4f')]=_[_0xab28('0x4e')](_0x36fb85['model'],qs['fields'](_0x278e4a[_0xab28('0x4d')][_0xab28('0x60')]));_0x521521[_0xab28('0x4f')]=_0x521521['attributes']['length']?_0x521521[_0xab28('0x4f')]:_0x36fb85[_0xab28('0x43')];if(!_0x278e4a[_0xab28('0x4d')]['hasOwnProperty'](_0xab28('0x51'))){_0x521521['limit']=qs[_0xab28('0x28')](_0x278e4a[_0xab28('0x4d')]['limit']);_0x521521[_0xab28('0x27')]=qs['offset'](_0x278e4a[_0xab28('0x4d')][_0xab28('0x27')]);}_0x521521[_0xab28('0x52')]=qs[_0xab28('0x53')](_0x278e4a[_0xab28('0x4d')][_0xab28('0x53')]);_0x521521['where']=qs[_0xab28('0x55')](_[_0xab28('0x56')](_0x278e4a[_0xab28('0x4d')],_0x36fb85[_0xab28('0x55')]));_0x521521[_0xab28('0x54')][_0xab28('0x72')]=_0x393a63['id'];if(_0x278e4a[_0xab28('0x4d')][_0xab28('0x57')]){_0x521521[_0xab28('0x54')]=_[_0xab28('0x58')](_0x521521['where'],{'$or':_[_0xab28('0x48')](_0x521521[_0xab28('0x4f')],function(_0x27f396){var _0x2cc1bc={};_0x2cc1bc[_0x27f396]={'$like':'%'+_0x278e4a[_0xab28('0x4d')]['filter']+'%'};return _0x2cc1bc;})});}_0x521521=_[_0xab28('0x58')]({},_0x521521,_0x278e4a[_0xab28('0x62')]);return db[_0xab28('0xb7')][_0xab28('0x2a')]({'where':_0x521521[_0xab28('0x54')]})[_0xab28('0x2d')](function(_0x540e9a){_0x304055[_0xab28('0x2a')]=_0x540e9a;if(_0x278e4a[_0xab28('0x4d')]['includeAll']){_0x521521['include']=[{'model':db[_0xab28('0x9c')],'as':_0xab28('0xfd'),'required':![]},{'model':db[_0xab28('0xfe')],'as':'Owner','attributes':[_0xab28('0x31'),'fullname','internal'],'required':![]},{'model':db[_0xab28('0xff')],'as':_0xab28('0x100'),'attributes':['id',_0xab28('0x31'),_0xab28('0x101')],'where':_0x278e4a[_0xab28('0x4d')][_0xab28('0x102')]?{'id':_0x278e4a[_0xab28('0x4d')]['tag']}:undefined,'required':_0x278e4a[_0xab28('0x4d')][_0xab28('0x102')]?!![]:![]}];}return db[_0xab28('0xb7')][_0xab28('0x5b')](_0x521521);})[_0xab28('0x2d')](function(_0x414c09){_0x304055[_0xab28('0x5c')]=_0x414c09;return _0x304055;});}})['then'](respondWithFilteredResult(_0x1cf3ab,_0x521521))[_0xab28('0x22')](handleError(_0x1cf3ab,null));};exports[_0xab28('0x103')]=function(_0x1ded28,_0x1a1fe4){var _0x4b8f2e=0x0;var _0x1d54b4=0x0;var _0x65b114=![];var _0x5720a8;var _0x3dc486;return db[_0xab28('0x49')]['find']({'where':{'id':_0x1ded28[_0xab28('0x5e')]['id']},'include':[{'model':db[_0xab28('0xa9')],'as':_0xab28('0xa9'),'include':[{'model':db[_0xab28('0xa9')],'as':_0xab28('0xaa'),'attributes':['id','interval']}]}]})[_0xab28('0x2d')](handleEntityNotFound(_0x1a1fe4,null))[_0xab28('0x2d')](function(_0x58819e){if(_0x58819e){_0x5720a8=_0x58819e;return _0x58819e['getProactiveActions']({'raw':!![]});}})[_0xab28('0x2d')](function(_0x5b633f){if(_0x5720a8){if(_0x5b633f){_0x3dc486=_0x5b633f;}}return require(_0xab28('0x104'))[_0xab28('0x84')]();})[_0xab28('0x2d')](function(_0x237c76){if(_0x237c76){_0x1d54b4=_0x237c76[_0xab28('0x105')];_0x65b114=_0x237c76[_0xab28('0x85')];}})[_0xab28('0x2d')](function(){return db[_0xab28('0xb7')][_0xab28('0x2a')]({'where':{'closed':![]}});})[_0xab28('0x2d')](function(_0x325b3b){_0x4b8f2e=_0x325b3b;if(_0x1d54b4&&_0x325b3b>_0x1d54b4){return db[_0xab28('0x106')][_0xab28('0x74')]({'where':{'id':0x1}})['then'](function(_0x5005e0){if(_0x5005e0){_0x5005e0['increment'](_0xab28('0x107'));}});}})[_0xab28('0x2d')](function(){var _0x996f2f=_0x5720a8[_0xab28('0xa9')];var _0x55a2d1=_0x5720a8['timezone']||undefined;return _0x996f2f?_0x996f2f[_0xab28('0x95')](_0x55a2d1):!![];})[_0xab28('0x2d')](function(_0x3c821c){var _0x16cf01=fs['readFileSync'](path[_0xab28('0x80')](config[_0xab28('0x81')],'server/files/chat/iframe.ejs'),_0xab28('0xd9'));var _0x43b079=_0xab28('0x108');var _0x11278b=![];var _0x371d95,_0x438ad0;if(_0x1ded28[_0xab28('0xb3')]['referer']){_0x371d95=new URL(_0x1ded28['headers']['referer'])[_0xab28('0x109')];}else if(_0x1ded28[_0xab28('0xb3')][_0xab28('0x109')]){_0x371d95=new URL(_0x1ded28['headers'][_0xab28('0x109')])[_0xab28('0x109')];}else{_0x371d95=_0xab28('0x10a');}_0x438ad0=typeof _0x5720a8[_0xab28('0x66')]['split'](',')['find'](function(_0x23dd4e){return wildcardUtils[_0xab28('0x10b')](_0x23dd4e,_0x371d95);})!=='undefined';var _0x51eb09={'chatVersion':_0x43b079,'chatWebsiteAddressOrigin':_0x438ad0?_0x371d95:_0x5720a8[_0xab28('0x66')],'remote':_0x5720a8['remote'],'query':querystring[_0xab28('0x1d')](_['merge'](_0x5720a8['get']({'plain':!![]}),{'customerIp':_0x1ded28[_0xab28('0xb3')][_0xab28('0x38')]||_0x1ded28['headers'][_0xab28('0x10c')]||_0x1ded28[_0xab28('0x10d')][_0xab28('0x10e')]||_0x1ded28['ip'],'referer':_0x1ded28[_0xab28('0xb3')][_0xab28('0x3d')],'openedInteractions':_0x4b8f2e,'maxInteractions':_0x1d54b4,'virtual':_0x65b114['virtual'],'online':_0x3c821c,'custom':_0x65b114,'address':_0x438ad0?_0x371d95:null}))[_0xab28('0x10f')](/'/g,'\x5c\x27')};_0x1a1fe4['send'](ejs[_0xab28('0xda')](Mustache[_0xab28('0xda')](_0x16cf01,_0x51eb09),{'proactiveActions':_0x3dc486,'alignment':_0x5720a8[_0xab28('0x110')],'verticalAlignment':_0x5720a8[_0xab28('0x111')],'div_color':_0x5720a8['color'],'labelText':_0x5720a8[_0xab28('0x112')],'text_color':_0x5720a8['textColor'],'text_button_color':_0x5720a8[_0xab28('0x113')],'button_color':_0x5720a8['color_button'],'background_color':_0x5720a8['backgroundColor'],'hideWhenOffline':_0x5720a8[_0xab28('0x114')],'intervalId':_0x5720a8[_0xab28('0x115')],'isDevelopment':_0x11278b,'chatVersion':_0x43b079}));})[_0xab28('0x22')](handleError(_0x1a1fe4,null));};exports['addApplications']=function(_0x2a8af0,_0x547c52){var _0x5a2c4e=_0x2a8af0[_0xab28('0x5e')]['id'];var _0x4a23bc=_0x2a8af0[_0xab28('0x65')];var _0xdbd848=0xc8;var _0xe5a514=null;return db[_0xab28('0xe5')][_0xab28('0xe6')]({'isolationLevel':db[_0xab28('0xe5')][_0xab28('0x116')][_0xab28('0x117')]['READ_COMMITTED']},function(_0x233256){return db['ChatWebsite']['findOne']({'where':{'id':_0x5a2c4e},'transaction':_0x233256})[_0xab28('0x2d')](function(_0x1399a7){if(_0x1399a7){return db[_0xab28('0xa7')][_0xab28('0x2e')]({'where':{'ChatWebsiteId':_0x5a2c4e},'transaction':_0x233256})[_0xab28('0x2d')](function(){var _0x5529b9=_[_0xab28('0x48')](_0x4a23bc,function(_0x3e8615){_0x3e8615['ChatWebsiteId']=_0x5a2c4e;return _0x3e8615;});return db['ChatApplication'][_0xab28('0xe8')](_0x5529b9,{'transaction':_0x233256});});}else{_0xdbd848=0x194;_0xe5a514=[];}});})['then'](function(){if(_0xdbd848!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x5a2c4e},'order':_0xab28('0xb0')})[_0xab28('0x2d')](function(_0x1afd16){_0xe5a514=_0x1afd16;});}})[_0xab28('0x22')](function(_0x488578){_0xdbd848=0x1f4;logger[_0xab28('0x1e')](_0x488578[_0xab28('0x30')]);if(_0x488578['name']){delete _0x488578[_0xab28('0x31')];}_0xe5a514=_0x488578;})[_0xab28('0x118')](function(){if(_0xe5a514===null){_0x547c52['sendStatus'](_0xdbd848);}else{if(_0xdbd848===0x1f4){_0x547c52[_0xab28('0x25')](_0xdbd848)[_0xab28('0x32')](_0xe5a514);}else{_0x547c52['status'](_0xdbd848)[_0xab28('0x26')](_0xe5a514);}}});};exports[_0xab28('0x119')]=function(_0x4a5489,_0x1c1120){var _0x4f2d02={};var _0x57cad0={};var _0x229da0;var _0x4259db;return db[_0xab28('0x49')]['findOne']({'where':{'id':_0x4a5489['params']['id']}})['then'](handleEntityNotFound(_0x1c1120,null))['then'](function(_0x2fbed5){if(_0x2fbed5){_0x229da0=_0x2fbed5;_0x57cad0[_0xab28('0x43')]=_[_0xab28('0x4c')](db['ChatApplication'][_0xab28('0x4a')]);_0x57cad0['query']=_['keys'](_0x4a5489[_0xab28('0x4d')]);_0x57cad0[_0xab28('0x55')]=_[_0xab28('0x4e')](_0x57cad0['model'],_0x57cad0['query']);_0x4f2d02[_0xab28('0x4f')]=_[_0xab28('0x4e')](_0x57cad0[_0xab28('0x43')],qs[_0xab28('0x60')](_0x4a5489['query'][_0xab28('0x60')]));_0x4f2d02['attributes']=_0x4f2d02['attributes'][_0xab28('0x61')]?_0x4f2d02[_0xab28('0x4f')]:_0x57cad0[_0xab28('0x43')];_0x4f2d02[_0xab28('0x52')]=qs['sort'](_0x4a5489[_0xab28('0x4d')][_0xab28('0x53')]);_0x4f2d02['where']=qs[_0xab28('0x55')](_[_0xab28('0x56')](_0x4a5489[_0xab28('0x4d')],_0x57cad0[_0xab28('0x55')]));if(_0x4a5489['query'][_0xab28('0x57')]){_0x4f2d02[_0xab28('0x54')]=_['merge'](_0x4f2d02[_0xab28('0x54')],{'$or':_[_0xab28('0x48')](_0x4f2d02[_0xab28('0x4f')],function(_0x4eb2d6){var _0x262988={};_0x262988[_0x4eb2d6]={'$like':'%'+_0x4a5489[_0xab28('0x4d')][_0xab28('0x57')]+'%'};return _0x262988;})});}_0x4f2d02=_[_0xab28('0x58')]({},_0x4f2d02,_0x4a5489[_0xab28('0x62')]);return _0x229da0[_0xab28('0x119')](_0x4f2d02);}})[_0xab28('0x2d')](function(_0x26a773){if(_0x26a773){_0x4259db=_0x26a773['length'];if(!_0x4a5489[_0xab28('0x4d')][_0xab28('0x50')](_0xab28('0x51'))){_0x4f2d02[_0xab28('0x28')]=qs[_0xab28('0x28')](_0x4a5489[_0xab28('0x4d')][_0xab28('0x28')]);_0x4f2d02[_0xab28('0x27')]=qs['offset'](_0x4a5489[_0xab28('0x4d')]['offset']);}return _0x229da0[_0xab28('0x119')](_0x4f2d02);}})[_0xab28('0x2d')](function(_0x5ed01f){if(_0x5ed01f){return _0x5ed01f?{'count':_0x4259db,'rows':_0x5ed01f}:null;}})[_0xab28('0x2d')](respondWithResult(_0x1c1120,null))['catch'](handleError(_0x1c1120,null));};exports[_0xab28('0x11a')]=function(_0x4d8b4e,_0x2ec741){return db[_0xab28('0x11b')][_0xab28('0x63')]({'where':{'id':_0x4d8b4e[_0xab28('0x5e')]['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x2ec741,null))[_0xab28('0x2d')](function(_0x78e76a){if(_0x78e76a){return _0x78e76a[_0xab28('0x11a')](_0x4d8b4e[_0xab28('0x65')][_0xab28('0x78')],_[_0xab28('0xfb')](_0x4d8b4e[_0xab28('0x65')],[_0xab28('0x78'),'id'])||{});}})['then'](respondWithResult(_0x2ec741,null))[_0xab28('0x22')](handleError(_0x2ec741,null));};exports[_0xab28('0x11c')]=function(_0x19e63f,_0x340473){var _0x119e2f={};var _0x316b99={};var _0x4fc985;var _0x5cc339;return db[_0xab28('0x49')][_0xab28('0x74')]({'where':{'id':_0x19e63f[_0xab28('0x5e')]['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x340473,null))[_0xab28('0x2d')](function(_0xd45e5e){if(_0xd45e5e){_0x4fc985=_0xd45e5e;_0x316b99['model']=_['keys'](db[_0xab28('0x11d')][_0xab28('0x4a')]);_0x316b99[_0xab28('0x4d')]=_['keys'](_0x19e63f[_0xab28('0x4d')]);_0x316b99['filters']=_['intersection'](_0x316b99['model'],_0x316b99[_0xab28('0x4d')]);_0x119e2f[_0xab28('0x4f')]=_[_0xab28('0x4e')](_0x316b99['model'],qs[_0xab28('0x60')](_0x19e63f['query']['fields']));_0x119e2f[_0xab28('0x4f')]=_0x119e2f[_0xab28('0x4f')][_0xab28('0x61')]?_0x119e2f[_0xab28('0x4f')]:_0x316b99[_0xab28('0x43')];_0x119e2f[_0xab28('0x52')]=qs['sort'](_0x19e63f[_0xab28('0x4d')][_0xab28('0x53')]);_0x119e2f[_0xab28('0x54')]=qs[_0xab28('0x55')](_['pick'](_0x19e63f['query'],_0x316b99['filters']));if(_0x19e63f[_0xab28('0x4d')][_0xab28('0x57')]){_0x119e2f[_0xab28('0x54')]=_[_0xab28('0x58')](_0x119e2f[_0xab28('0x54')],{'$or':_[_0xab28('0x48')](_0x119e2f[_0xab28('0x4f')],function(_0x539f25){var _0x5aea9a={};_0x5aea9a[_0x539f25]={'$like':'%'+_0x19e63f['query']['filter']+'%'};return _0x5aea9a;})});}_0x119e2f=_['merge']({},_0x119e2f,_0x19e63f['options']);return _0x4fc985[_0xab28('0x11c')](_0x119e2f);}})[_0xab28('0x2d')](function(_0x1fba04){if(_0x1fba04){_0x5cc339=_0x1fba04[_0xab28('0x61')];if(!_0x19e63f[_0xab28('0x4d')][_0xab28('0x50')](_0xab28('0x51'))){_0x119e2f[_0xab28('0x28')]=qs[_0xab28('0x28')](_0x19e63f[_0xab28('0x4d')][_0xab28('0x28')]);_0x119e2f[_0xab28('0x27')]=qs[_0xab28('0x27')](_0x19e63f[_0xab28('0x4d')]['offset']);}return _0x4fc985[_0xab28('0x11c')](_0x119e2f);}})[_0xab28('0x2d')](function(_0x583fd8){if(_0x583fd8){return _0x583fd8?{'count':_0x5cc339,'rows':_0x583fd8}:null;}})[_0xab28('0x2d')](respondWithResult(_0x340473,null))[_0xab28('0x22')](handleError(_0x340473,null));};exports[_0xab28('0x11e')]=function(_0x2d2972,_0x1d1f4b){var _0x316646=_0x2d2972[_0xab28('0x4d')]['online']==='false'?'offlineForm':_0xab28('0x11f');return db[_0xab28('0x49')][_0xab28('0x63')]({'attributes':['id',_0x316646],'where':{'id':_0x2d2972['params']['id']}})['then'](handleEntityNotFound(_0x1d1f4b,null))['then'](function(_0x1c0b38){if(_0x1c0b38){var _0x323782=_0x1c0b38[_0x316646];var _0x1e10a3=_0x323782&&_0x323782['items']?_0x323782[_0xab28('0x120')]:[];_0x1d1f4b['send']({'fromKey':_[_0xab28('0x86')](_0x323782[_0xab28('0x121')])?undefined:_0x323782[_0xab28('0x121')],'count':_0x1e10a3[_0xab28('0x61')],'rows':_0x1e10a3});}})[_0xab28('0x22')](handleError(_0x1d1f4b,null));};exports[_0xab28('0x122')]=function(_0x4bc979,_0x1b14b4){var _0x3128a4={'raw':![],'where':{}};var _0x3b01c0={};var _0x437bef={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xab28('0x74')]({'where':{'id':_0x4bc979['params']['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x1b14b4,null))[_0xab28('0x2d')](function(_0x1fa96a){if(_0x1fa96a){_0x3b01c0[_0xab28('0x43')]=_[_0xab28('0x4c')](db['ChatOfflineMessage']['rawAttributes']);_0x3b01c0['query']=_[_0xab28('0x4c')](_0x4bc979[_0xab28('0x4d')]);_0x3b01c0['filters']=_[_0xab28('0x4e')](_0x3b01c0[_0xab28('0x43')],_0x3b01c0['query']);_0x3128a4[_0xab28('0x4f')]=_[_0xab28('0x4e')](_0x3b01c0[_0xab28('0x43')],qs['fields'](_0x4bc979[_0xab28('0x4d')][_0xab28('0x60')]));_0x3128a4[_0xab28('0x4f')]=_0x3128a4[_0xab28('0x4f')][_0xab28('0x61')]?_0x3128a4[_0xab28('0x4f')]:_0x3b01c0[_0xab28('0x43')];if(!_0x4bc979[_0xab28('0x4d')]['hasOwnProperty'](_0xab28('0x51'))){_0x3128a4[_0xab28('0x28')]=qs[_0xab28('0x28')](_0x4bc979[_0xab28('0x4d')][_0xab28('0x28')]);_0x3128a4[_0xab28('0x27')]=qs[_0xab28('0x27')](_0x4bc979[_0xab28('0x4d')]['offset']);}_0x3128a4[_0xab28('0x52')]=qs['sort'](_0x4bc979[_0xab28('0x4d')][_0xab28('0x53')]);_0x3128a4['where']=qs[_0xab28('0x55')](_['pick'](_0x4bc979[_0xab28('0x4d')],_0x3b01c0[_0xab28('0x55')]));_0x3128a4[_0xab28('0x54')][_0xab28('0x72')]=_0x1fa96a['id'];if(_0x4bc979[_0xab28('0x4d')][_0xab28('0x57')]){_0x3128a4['where']=_[_0xab28('0x58')](_0x3128a4['where'],{'$or':_[_0xab28('0x48')](_0x3128a4['attributes'],function(_0x56f74e){var _0x29c11d={};_0x29c11d[_0x56f74e]={'$like':'%'+_0x4bc979[_0xab28('0x4d')][_0xab28('0x57')]+'%'};return _0x29c11d;})});}_0x3128a4=_['merge']({},_0x3128a4,_0x4bc979[_0xab28('0x62')]);return db['ChatOfflineMessage'][_0xab28('0x2a')]({'where':_0x3128a4[_0xab28('0x54')]})[_0xab28('0x2d')](function(_0x4d145f){_0x437bef[_0xab28('0x2a')]=_0x4d145f;if(_0x4bc979['query'][_0xab28('0x59')]){_0x3128a4[_0xab28('0x5a')]=[{'all':!![]}];}else{_0x3128a4['include']=[{'model':db[_0xab28('0x9c')],'as':_0xab28('0xfd'),'required':![]},{'model':db[_0xab28('0xe7')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x3128a4);})[_0xab28('0x2d')](function(_0x2a0f60){_0x437bef[_0xab28('0x5c')]=_0x2a0f60;return _0x437bef;});}})['then'](respondWithFilteredResult(_0x1b14b4,_0x3128a4))['catch'](handleError(_0x1b14b4,null));};exports['addAgents']=function(_0xe12155,_0x26b7b0){return db[_0xab28('0x49')]['find']({'where':{'id':_0xe12155[_0xab28('0x5e')]['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x26b7b0,null))[_0xab28('0x2d')](function(_0x3e339f){if(_0x3e339f){return _0x3e339f[_0xab28('0x123')](_0xe12155[_0xab28('0x65')][_0xab28('0x78')],_[_0xab28('0xfb')](_0xe12155[_0xab28('0x65')],[_0xab28('0x78'),'id'])||{})[_0xab28('0xd7')](function(_0x35c6b1){for(var _0x2e58ac=0x0;_0x2e58ac<_0xe12155[_0xab28('0x65')][_0xab28('0x78')]['length'];_0x2e58ac+=0x1){socket['emit'](_0xab28('0x124'),{'UserId':Number(_0xe12155[_0xab28('0x65')][_0xab28('0x78')][_0x2e58ac]),'ChatWebsiteId':Number(_0xe12155['params']['id'])});}return _0x35c6b1;});}})[_0xab28('0x2d')](respondWithResult(_0x26b7b0,null))[_0xab28('0x22')](handleError(_0x26b7b0,null));};exports[_0xab28('0x125')]=function(_0x28f77b,_0x26c9b9){return db['ChatWebsite'][_0xab28('0x63')]({'where':{'id':_0x28f77b[_0xab28('0x5e')]['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x26c9b9,null))['then'](function(_0x287b38){if(_0x287b38){return _0x287b38[_0xab28('0x125')](_0x28f77b[_0xab28('0x4d')][_0xab28('0x78')])[_0xab28('0x2d')](function(){if(_[_0xab28('0x126')](_0x28f77b[_0xab28('0x4d')][_0xab28('0x78')])){for(var _0x30ded7=0x0;_0x30ded7<_0x28f77b[_0xab28('0x4d')][_0xab28('0x78')]['length'];_0x30ded7+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x28f77b[_0xab28('0x4d')][_0xab28('0x78')][_0x30ded7]),'ChatWebsiteId':Number(_0x28f77b[_0xab28('0x5e')]['id'])});}}else{socket[_0xab28('0x127')](_0xab28('0x128'),{'UserId':Number(_0x28f77b[_0xab28('0x4d')]['ids']),'ChatWebsiteId':Number(_0x28f77b[_0xab28('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x26c9b9,null))[_0xab28('0x22')](handleError(_0x26c9b9,null));};exports[_0xab28('0x129')]=function(_0x54c129,_0x3bf629){var _0x37a973={};var _0x2a77a6={};var _0x1604d7;var _0x55aa2d;return db['ChatWebsite']['findOne']({'where':{'id':_0x54c129[_0xab28('0x5e')]['id']}})[_0xab28('0x2d')](handleEntityNotFound(_0x3bf629,null))[_0xab28('0x2d')](function(_0x238f9b){if(_0x238f9b){_0x1604d7=_0x238f9b;_0x2a77a6[_0xab28('0x43')]=_[_0xab28('0x4c')](db[_0xab28('0xfe')][_0xab28('0x4a')]);_0x2a77a6[_0xab28('0x4d')]=_['keys'](_0x54c129['query']);_0x2a77a6[_0xab28('0x55')]=_[_0xab28('0x4e')](_0x2a77a6[_0xab28('0x43')],_0x2a77a6[_0xab28('0x4d')]);_0x37a973[_0xab28('0x4f')]=_['intersection'](_0x2a77a6['model'],qs[_0xab28('0x60')](_0x54c129[_0xab28('0x4d')][_0xab28('0x60')]));_0x37a973['attributes']=_0x37a973[_0xab28('0x4f')][_0xab28('0x61')]?_0x37a973['attributes']:_0x2a77a6['model'];_0x37a973[_0xab28('0x52')]=qs[_0xab28('0x53')](_0x54c129['query']['sort']);_0x37a973[_0xab28('0x54')]=qs[_0xab28('0x55')](_['pick'](_0x54c129[_0xab28('0x4d')],_0x2a77a6[_0xab28('0x55')]));if(_0x54c129[_0xab28('0x4d')][_0xab28('0x57')]){_0x37a973[_0xab28('0x54')]=_[_0xab28('0x58')](_0x37a973['where'],{'$or':_['map'](_0x37a973['attributes'],function(_0x2f5f71){var _0x2528f3={};_0x2528f3[_0x2f5f71]={'$like':'%'+_0x54c129['query'][_0xab28('0x57')]+'%'};return _0x2528f3;})});}_0x37a973=_[_0xab28('0x58')]({},_0x37a973,_0x54c129[_0xab28('0x62')]);return _0x1604d7[_0xab28('0x129')](_0x37a973);}})[_0xab28('0x2d')](function(_0x10b218){if(_0x10b218){_0x55aa2d=_0x10b218[_0xab28('0x61')];if(!_0x54c129[_0xab28('0x4d')]['hasOwnProperty'](_0xab28('0x51'))){_0x37a973[_0xab28('0x28')]=qs[_0xab28('0x28')](_0x54c129['query'][_0xab28('0x28')]);_0x37a973[_0xab28('0x27')]=qs['offset'](_0x54c129['query'][_0xab28('0x27')]);}return _0x1604d7[_0xab28('0x129')](_0x37a973);}})[_0xab28('0x2d')](function(_0x23f780){if(_0x23f780){return _0x23f780?{'count':_0x55aa2d,'rows':_0x23f780}:null;}})[_0xab28('0x2d')](respondWithResult(_0x3bf629,null))[_0xab28('0x22')](handleError(_0x3bf629,null));}; \ No newline at end of file +var _0x008c=['server','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','\x22%s\x22\x20<%s>','email','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','tag','Intervals','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','timezone','server/files/chat/iframe.ejs','3.10.1','origin','http://localhost:9000','testWebsiteWithWildcard','remote','connection','remoteAddress','replace','render','alignment','color','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','handleError','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','request\x20sent','debug','error','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','ChatWebsites','UserProfileResource','name','send','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','model','%s\x20%s\x20%s','vendor','type','stringify','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','key','map','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','ChatWebsite','findAll','show','params','keys','includeAll','include','find','create','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','nolimit','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','No\x20available\x20attributes','updatedAt','CompanyId','ListId','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','CmContact','Contacts','ChatApplication','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','Applications','priority','asc','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','files','ValidationError','no\x20available\x20attributes','difference','createdAt','Sequelize','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','originalname'];(function(_0x346e01,_0x11018b){var _0x54e1db=function(_0x3b7c22){while(--_0x3b7c22){_0x346e01['push'](_0x346e01['shift']());}};_0x54e1db(++_0x11018b);}(_0x008c,0x188));var _0xc008=function(_0xda99d6,_0x5d0efa){_0xda99d6=_0xda99d6-0x0;var _0x4d8540=_0x008c[_0xda99d6];return _0x4d8540;};'use strict';var Mustache=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var ejs=require(_0xc008('0x3'));var fs=require('fs');var fs_extra=require(_0xc008('0x4'));var _=require('lodash');var querystring=require(_0xc008('0x5'));var htmlToText=require(_0xc008('0x6'));var Redis=require(_0xc008('0x7'));var jayson=require(_0xc008('0x8'));var qs=require(_0xc008('0x9'));var logger=require(_0xc008('0xa'))(_0xc008('0xb'));var config=require(_0xc008('0xc'));var APIBadRequestError=require(_0xc008('0xd'))['APIBadRequestError'];var APINotFoundError=require(_0xc008('0xd'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xc008('0xd'))['APIOutOfIntervalError'];var APIHandleError=require('../../errors/api')[_0xc008('0xe')];var APIConflictError=require(_0xc008('0xd'))['APIConflictError'];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require('url')[_0xc008('0xf')];var db=require(_0xc008('0x10'))['db'];config['redis']=_[_0xc008('0x11')](config[_0xc008('0x12')],{'host':_0xc008('0x13'),'port':0x18eb});var socket=require(_0xc008('0x14'))(new Redis(config[_0xc008('0x12')]));require(_0xc008('0x15'))[_0xc008('0x16')](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc008('0x17')]['http']({'port':0x232a});var client9003=jayson[_0xc008('0x17')][_0xc008('0x18')]({'port':0x232b});var client9001=jayson[_0xc008('0x17')][_0xc008('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x3f0ecf,_0x5ee00b,_0x5e894e,_0x4bd0f4){return new Promise(function(_0x11ef38,_0x15a6ad){var _0x3cafe3=_0x4bd0f4||client;return _0x3cafe3[_0xc008('0x19')](_0x3f0ecf,_0x5e894e)['then'](function(_0x53b06e){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5ee00b,_0xc008('0x1a'));logger[_0xc008('0x1b')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5ee00b,_0xc008('0x1a'),JSON['stringify'](_0x53b06e));if(_0x53b06e['error']){if(_0x53b06e['error']['code']===0x1f4){logger[_0xc008('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x5ee00b,_0x53b06e['error']['message']);return _0x15a6ad(_0x53b06e['error']['message']);}logger[_0xc008('0x1c')](_0xc008('0x1d'),_0x5ee00b,_0x53b06e[_0xc008('0x1c')][_0xc008('0x1e')]);return _0x11ef38(_0x53b06e[_0xc008('0x1c')][_0xc008('0x1e')]);}else{logger['info'](_0xc008('0x1d'),_0x5ee00b,'request\x20sent');_0x11ef38(_0x53b06e['result'][_0xc008('0x1e')]);}})[_0xc008('0x1f')](function(_0x2e3cfb){logger[_0xc008('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x5ee00b,_0x2e3cfb);_0x15a6ad(_0x2e3cfb);});});}function respondWithStatusCode(_0x48582b,_0x5de1e9){_0x5de1e9=_0x5de1e9||0xcc;return function(_0x3f7b07){if(_0x3f7b07){return _0x48582b[_0xc008('0x20')](_0x5de1e9);}return _0x48582b[_0xc008('0x21')](_0x5de1e9)[_0xc008('0x22')]();};}function respondWithResult(_0x5bebd9,_0x5e2aca){_0x5e2aca=_0x5e2aca||0xc8;return function(_0x4fce9c){if(_0x4fce9c){return _0x5bebd9['status'](_0x5e2aca)['json'](_0x4fce9c);}};}function respondWithFilteredResult(_0x3865c0,_0x29ba43){return function(_0x25eae4){if(_0x25eae4){var _0x529961=typeof _0x29ba43[_0xc008('0x23')]===_0xc008('0x24')&&typeof _0x29ba43[_0xc008('0x25')]===_0xc008('0x24');var _0x4c5dec=_0x25eae4[_0xc008('0x26')];var _0x2e0b4e=_0x529961?0x0:_0x29ba43['offset'];var _0x58db82=_0x529961?_0x25eae4['count']:_0x29ba43[_0xc008('0x23')]+_0x29ba43[_0xc008('0x25')];var _0xf831f2;if(_0x58db82>=_0x4c5dec){_0x58db82=_0x4c5dec;_0xf831f2=0xc8;}else{_0xf831f2=0xce;}_0x3865c0[_0xc008('0x21')](_0xf831f2);return _0x3865c0[_0xc008('0x27')](_0xc008('0x28'),_0x2e0b4e+'-'+_0x58db82+'/'+_0x4c5dec)[_0xc008('0x29')](_0x25eae4);}return null;};}function saveUpdates(_0x22d8e8){return function(_0x1fe1e1){if(_0x1fe1e1){return _0x1fe1e1[_0xc008('0x2a')](_0x22d8e8)[_0xc008('0x2b')](function(_0x1ac7c8){return _0x1ac7c8;});}return null;};}function removeEntity(_0x596ee8){return function(_0x334a09){if(_0x334a09){return _0x334a09[_0xc008('0x2c')]()['then'](function(){var _0xaf4b84=_0x334a09[_0xc008('0x2d')]({'plain':!![]});var _0x383be7=_0xc008('0x2e');return db[_0xc008('0x2f')][_0xc008('0x2c')]({'where':{'type':_0x383be7,'resourceId':_0xaf4b84['id']}})[_0xc008('0x2b')](function(){return _0x334a09;});})[_0xc008('0x2b')](function(){_0x596ee8[_0xc008('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b87){return function(_0x389a40){if(!_0x389a40){_0x415b87[_0xc008('0x20')](0x194);}return _0x389a40;};}function handleError(_0x344bad,_0x40002f){_0x40002f=_0x40002f||0x1f4;return function(_0x315562){logger[_0xc008('0x1c')](_0x315562['stack']);if(_0x315562[_0xc008('0x30')]){delete _0x315562[_0xc008('0x30')];}_0x344bad['status'](_0x40002f)[_0xc008('0x31')](_0x315562);};}function createInteractionObject(_0x15453c,_0x5e38d5,_0x263473,_0x2e4ae1){var _0x280e9b=require('user-agent-parser');var _0x53b353=new _0x280e9b();var _0x478810=_0x53b353[_0xc008('0x32')](_0x263473['user-agent'])[_0xc008('0x33')]();var _0x3884dd=_0x5e38d5[_0xc008('0x34')];if(_0x263473[_0xc008('0x35')]){_0x3884dd=_0x263473[_0xc008('0x35')];}else if(_0x263473[_0xc008('0x36')]){_0x3884dd=_[_0xc008('0x37')](_0x263473[_0xc008('0x36')][_0xc008('0x38')](','));}return{'ContactId':_0x2e4ae1['id'],'ChatWebsiteId':_0x15453c,'from':(_0x2e4ae1[_0xc008('0x39')]||'')+'\x20'+(_0x2e4ae1[_0xc008('0x3a')]||''),'customerIp':_0x3884dd,'customerPort':_0x263473[_0xc008('0x3b')]?_0x263473[_0xc008('0x3b')]:null,'referer':_0x5e38d5[_0xc008('0x3c')],'browserName':_0x478810['browser'][_0xc008('0x30')]&&_0x478810[_0xc008('0x3d')][_0xc008('0x3e')]?util[_0xc008('0x3f')]('%s\x20%s',_0x478810[_0xc008('0x3d')][_0xc008('0x30')],_0x478810[_0xc008('0x3d')][_0xc008('0x3e')]):_0xc008('0x40'),'browserVersion':_0x478810['browser'][_0xc008('0x3e')]||_0xc008('0x40'),'osName':util[_0xc008('0x3f')](_0xc008('0x41'),_0x478810['os'][_0xc008('0x30')],_0x478810['os']['version']),'osVersion':_0x478810['os'][_0xc008('0x3e')],'deviceModel':_0x478810[_0xc008('0x42')][_0xc008('0x43')]&&_0x478810[_0xc008('0x42')]['vendor']?util[_0xc008('0x3f')](_0xc008('0x44'),_0x478810[_0xc008('0x42')]['model'],_0x478810[_0xc008('0x42')]['vendor'],_0x478810[_0xc008('0x42')]['type']):null,'deviceVendor':_0x478810[_0xc008('0x42')][_0xc008('0x45')],'deviceType':_0x478810['device'][_0xc008('0x46')],'formData':JSON[_0xc008('0x47')](_0x5e38d5)};}exports[_0xc008('0x48')]=function(_0x5caaa2,_0x1cec64){var _0x2a9b5c={'include':[{'model':db[_0xc008('0x49')],'as':_0xc008('0x4a')}]},_0x200469={},_0x44fc5d={'count':0x0,'rows':[]};var _0x59ca2b=_['map'](db['ChatWebsite'][_0xc008('0x4b')],function(_0x36417a){return{'name':_0x36417a[_0xc008('0x4c')],'type':_0x36417a[_0xc008('0x46')][_0xc008('0x4d')]};});_0x200469[_0xc008('0x43')]=_[_0xc008('0x4e')](_0x59ca2b,_0xc008('0x30'));_0x200469['query']=_['keys'](_0x5caaa2['query']);_0x200469[_0xc008('0x4f')]=_[_0xc008('0x50')](_0x200469[_0xc008('0x43')],_0x200469['query']);_0x2a9b5c[_0xc008('0x51')]=_[_0xc008('0x50')](_0x200469[_0xc008('0x43')],qs[_0xc008('0x52')](_0x5caaa2[_0xc008('0x53')][_0xc008('0x52')]));_0x2a9b5c[_0xc008('0x51')]=_0x2a9b5c[_0xc008('0x51')][_0xc008('0x54')]?_0x2a9b5c[_0xc008('0x51')]:_0x200469['model'];if(!_0x5caaa2['query'][_0xc008('0x55')]('nolimit')){_0x2a9b5c[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x5caaa2[_0xc008('0x53')]['limit']);_0x2a9b5c[_0xc008('0x23')]=qs[_0xc008('0x23')](_0x5caaa2[_0xc008('0x53')][_0xc008('0x23')]);}_0x2a9b5c[_0xc008('0x56')]=qs['sort'](_0x5caaa2[_0xc008('0x53')][_0xc008('0x57')]);_0x2a9b5c['where']=qs[_0xc008('0x4f')](_[_0xc008('0x58')](_0x5caaa2['query'],_0x200469['filters']),_0x59ca2b);if(_0x5caaa2[_0xc008('0x53')][_0xc008('0x59')]){_0x2a9b5c[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x2a9b5c[_0xc008('0x5a')],{'$or':_['map'](_0x59ca2b,function(_0x57f1f9){if(_0x57f1f9[_0xc008('0x46')]!=='VIRTUAL'){var _0x3d7cce={};_0x3d7cce[_0x57f1f9[_0xc008('0x30')]]={'$like':'%'+_0x5caaa2[_0xc008('0x53')][_0xc008('0x59')]+'%'};return _0x3d7cce;}})});}_0x2a9b5c=_[_0xc008('0x5b')]({},_0x2a9b5c,_0x5caaa2[_0xc008('0x5c')]);var _0x49d8b0={'where':_0x2a9b5c[_0xc008('0x5a')]};return db[_0xc008('0x5d')][_0xc008('0x26')](_0x49d8b0)[_0xc008('0x2b')](function(_0x4424f5){_0x44fc5d['count']=_0x4424f5;if(_0x5caaa2[_0xc008('0x53')]['includeAll']){_0x2a9b5c['include']=[{'all':!![]}];}return db['ChatWebsite'][_0xc008('0x5e')](_0x2a9b5c);})[_0xc008('0x2b')](function(_0x5dfb69){_0x44fc5d['rows']=_0x5dfb69;return _0x44fc5d;})[_0xc008('0x2b')](respondWithFilteredResult(_0x1cec64,_0x2a9b5c))[_0xc008('0x1f')](handleError(_0x1cec64,null));};exports[_0xc008('0x5f')]=function(_0x47a58b,_0x3587c3){var _0x1092cb={'raw':![],'where':{'id':_0x47a58b[_0xc008('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0xc008('0x4a')}]},_0x12ba3f={};_0x12ba3f['model']=_[_0xc008('0x61')](db[_0xc008('0x5d')][_0xc008('0x4b')]);_0x12ba3f[_0xc008('0x53')]=_[_0xc008('0x61')](_0x47a58b[_0xc008('0x53')]);_0x12ba3f['filters']=_[_0xc008('0x50')](_0x12ba3f['model'],_0x12ba3f['query']);_0x1092cb[_0xc008('0x51')]=_[_0xc008('0x50')](_0x12ba3f['model'],qs[_0xc008('0x52')](_0x47a58b[_0xc008('0x53')][_0xc008('0x52')]));_0x1092cb[_0xc008('0x51')]=_0x1092cb[_0xc008('0x51')][_0xc008('0x54')]?_0x1092cb[_0xc008('0x51')]:_0x12ba3f['model'];if(_0x47a58b[_0xc008('0x53')][_0xc008('0x62')]){_0x1092cb[_0xc008('0x63')]=[{'all':!![]}];}_0x1092cb=_[_0xc008('0x5b')]({},_0x1092cb,_0x47a58b[_0xc008('0x5c')]);return db[_0xc008('0x5d')][_0xc008('0x64')](_0x1092cb)[_0xc008('0x2b')](handleEntityNotFound(_0x3587c3,null))[_0xc008('0x2b')](respondWithResult(_0x3587c3,null))[_0xc008('0x1f')](handleError(_0x3587c3,null));};exports[_0xc008('0x65')]=function(_0x2b5eb6,_0x131b81){var _0x41dd45=null;_0x2b5eb6['body'][_0xc008('0x66')][_0xc008('0x38')](',')[_0xc008('0x67')](_0x566dea=>{if(_0x566dea[_0xc008('0x68')]()!==''&&!wildcardUtils[_0xc008('0x69')](_0x566dea['trim']())){_0x41dd45=new APIBadRequestError('\x22'+_0x566dea['trim']()+_0xc008('0x6a'));}});if(_0x41dd45){return handleError(_0x131b81,null)(_0x41dd45);}return db[_0xc008('0x5d')][_0xc008('0x65')](_0x2b5eb6[_0xc008('0x6b')],{})[_0xc008('0x2b')](function(_0x335f00){var _0x238852=_0x2b5eb6[_0xc008('0x6c')][_0xc008('0x2d')]({'plain':!![]});if(!_0x238852)throw new Error(_0xc008('0x6d'));if(_0x238852[_0xc008('0x6e')]==='user'){var _0x336516=_0x335f00[_0xc008('0x2d')]({'plain':!![]});var _0xfdb5e3=_0xc008('0x2e');return db['UserProfileSection'][_0xc008('0x64')]({'where':{'name':_0xfdb5e3,'userProfileId':_0x238852['userProfileId']},'raw':!![]})[_0xc008('0x2b')](function(_0x46fa7b){if(_0x46fa7b&&_0x46fa7b[_0xc008('0x6f')]===0x0){return db['UserProfileResource'][_0xc008('0x65')]({'name':_0x336516[_0xc008('0x30')],'resourceId':_0x336516['id'],'type':_0x46fa7b[_0xc008('0x30')],'sectionId':_0x46fa7b['id']},{})['then'](function(){return _0x335f00;});}else{return _0x335f00;}})[_0xc008('0x1f')](function(_0x539fc8){logger[_0xc008('0x1c')](_0xc008('0x70'),_0x539fc8);throw _0x539fc8;});}return _0x335f00;})[_0xc008('0x2b')](respondWithResult(_0x131b81,0xc9))[_0xc008('0x1f')](handleError(_0x131b81,null));};exports[_0xc008('0x2a')]=function(_0x4ca4a6,_0x3c30db){var _0x3f2342=null;_0x4ca4a6['body'][_0xc008('0x66')]['split'](',')[_0xc008('0x67')](_0x50bfe5=>{if(_0x50bfe5[_0xc008('0x68')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x50bfe5[_0xc008('0x68')]())){_0x3f2342=new APIBadRequestError('\x22'+_0x50bfe5[_0xc008('0x68')]()+_0xc008('0x6a'));}});if(_0x3f2342){return handleError(_0x3c30db,null)(_0x3f2342);}if(_0x4ca4a6[_0xc008('0x6b')]['id']){delete _0x4ca4a6['body']['id'];}return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x4ca4a6[_0xc008('0x60')]['id']},'include':[{'model':db[_0xc008('0x49')],'as':_0xc008('0x4a')}]})[_0xc008('0x2b')](handleEntityNotFound(_0x3c30db,null))[_0xc008('0x2b')](saveUpdates(_0x4ca4a6[_0xc008('0x6b')],null))['then'](respondWithResult(_0x3c30db,null))[_0xc008('0x1f')](handleError(_0x3c30db,null));};exports['destroy']=function(_0x511477,_0x4c84da){return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x511477[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x4c84da,null))[_0xc008('0x2b')](removeEntity(_0x4c84da,null))[_0xc008('0x1f')](handleError(_0x4c84da,null));};exports[_0xc008('0x71')]=function(_0x519328,_0x127bdf){return db['ChatWebsite'][_0xc008('0x71')]()[_0xc008('0x2b')](respondWithResult(_0x127bdf,null))[_0xc008('0x1f')](handleError(_0x127bdf,null));};exports[_0xc008('0x72')]=function(_0xc9f3f4,_0x3b2669){if(_0xc9f3f4[_0xc008('0x6b')]['id']){delete _0xc9f3f4[_0xc008('0x6b')]['id'];}return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0xc9f3f4[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x3b2669,null))['then'](function(_0x4e7af3){if(_0x4e7af3){_0xc9f3f4[_0xc008('0x6b')][_0xc008('0x73')]=_0x4e7af3['id'];return db[_0xc008('0x74')]['create'](_0xc9f3f4[_0xc008('0x6b')]);}})[_0xc008('0x2b')](respondWithResult(_0x3b2669,null))['catch'](handleError(_0x3b2669,null));};exports['getDispositions']=function(_0x4908c8,_0x3fc44f){var _0x2ece80={'raw':![],'where':{}};var _0xd52e2b={};var _0x38ca14={'count':0x0,'rows':[]};return db[_0xc008('0x5d')][_0xc008('0x75')]({'where':{'id':_0x4908c8[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x3fc44f,null))[_0xc008('0x2b')](function(_0x1e7a11){if(_0x1e7a11){_0xd52e2b['model']=_['keys'](db[_0xc008('0x74')][_0xc008('0x4b')]);_0xd52e2b[_0xc008('0x53')]=_[_0xc008('0x61')](_0x4908c8[_0xc008('0x53')]);_0xd52e2b[_0xc008('0x4f')]=_['intersection'](_0xd52e2b['model'],_0xd52e2b[_0xc008('0x53')]);_0x2ece80[_0xc008('0x51')]=_[_0xc008('0x50')](_0xd52e2b['model'],qs['fields'](_0x4908c8['query']['fields']));_0x2ece80['attributes']=_0x2ece80['attributes'][_0xc008('0x54')]?_0x2ece80['attributes']:_0xd52e2b[_0xc008('0x43')];if(!_0x4908c8['query'][_0xc008('0x55')](_0xc008('0x76'))){_0x2ece80[_0xc008('0x25')]=qs['limit'](_0x4908c8['query'][_0xc008('0x25')]);_0x2ece80['offset']=qs[_0xc008('0x23')](_0x4908c8[_0xc008('0x53')]['offset']);}_0x2ece80[_0xc008('0x56')]=qs['sort'](_0x4908c8['query'][_0xc008('0x57')]);_0x2ece80[_0xc008('0x5a')]=qs['filters'](_[_0xc008('0x58')](_0x4908c8[_0xc008('0x53')],_0xd52e2b[_0xc008('0x4f')]));_0x2ece80['where'][_0xc008('0x73')]=_0x1e7a11['id'];if(_0x4908c8[_0xc008('0x53')][_0xc008('0x59')]){_0x2ece80[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x2ece80[_0xc008('0x5a')],{'$or':_['map'](_0x2ece80[_0xc008('0x51')],function(_0xdaff5b){var _0x2517c6={};_0x2517c6[_0xdaff5b]={'$like':'%'+_0x4908c8['query'][_0xc008('0x59')]+'%'};return _0x2517c6;})});}_0x2ece80=_[_0xc008('0x5b')]({},_0x2ece80,_0x4908c8[_0xc008('0x5c')]);return db['Disposition']['count']({'where':_0x2ece80['where']})[_0xc008('0x2b')](function(_0x470888){_0x38ca14[_0xc008('0x26')]=_0x470888;if(_0x4908c8[_0xc008('0x53')][_0xc008('0x62')]){_0x2ece80[_0xc008('0x63')]=[{'all':!![]}];}return db[_0xc008('0x74')][_0xc008('0x5e')](_0x2ece80);})['then'](function(_0x29f225){_0x38ca14[_0xc008('0x77')]=_0x29f225;return _0x38ca14;});}})['then'](respondWithFilteredResult(_0x3fc44f,_0x2ece80))['catch'](handleError(_0x3fc44f,null));};exports[_0xc008('0x78')]=function(_0x128123,_0x2be063){return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x128123['params']['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x2be063,null))[_0xc008('0x2b')](function(_0x56be9d){if(_0x56be9d){return _0x56be9d[_0xc008('0x78')](_0x128123[_0xc008('0x53')][_0xc008('0x79')]);}})[_0xc008('0x2b')](respondWithStatusCode(_0x2be063,null))['catch'](handleError(_0x2be063,null));};exports[_0xc008('0x7a')]=function(_0x2d42e0,_0x21dd25){if(_0x2d42e0[_0xc008('0x6b')]['id']){delete _0x2d42e0['body']['id'];}return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x2d42e0['params']['id']}})['then'](handleEntityNotFound(_0x21dd25,null))[_0xc008('0x2b')](function(_0x581a45){if(_0x581a45){_0x2d42e0[_0xc008('0x6b')][_0xc008('0x73')]=_0x581a45['id'];return db['CannedAnswer'][_0xc008('0x65')](_0x2d42e0[_0xc008('0x6b')]);}})[_0xc008('0x2b')](respondWithResult(_0x21dd25,null))[_0xc008('0x1f')](handleError(_0x21dd25,null));};exports[_0xc008('0x7b')]=function(_0x1cbd0c,_0x56fa88){var _0x2b2bfb={'raw':![],'where':{}};var _0x357043={};var _0x2fcad1={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1cbd0c[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x56fa88,null))['then'](function(_0x16c1f2){if(_0x16c1f2){_0x357043[_0xc008('0x43')]=_[_0xc008('0x61')](db['CannedAnswer'][_0xc008('0x4b')]);_0x357043[_0xc008('0x53')]=_[_0xc008('0x61')](_0x1cbd0c[_0xc008('0x53')]);_0x357043[_0xc008('0x4f')]=_[_0xc008('0x50')](_0x357043[_0xc008('0x43')],_0x357043['query']);_0x2b2bfb[_0xc008('0x51')]=_['intersection'](_0x357043[_0xc008('0x43')],qs[_0xc008('0x52')](_0x1cbd0c[_0xc008('0x53')]['fields']));_0x2b2bfb[_0xc008('0x51')]=_0x2b2bfb[_0xc008('0x51')][_0xc008('0x54')]?_0x2b2bfb[_0xc008('0x51')]:_0x357043[_0xc008('0x43')];if(!_0x1cbd0c[_0xc008('0x53')][_0xc008('0x55')](_0xc008('0x76'))){_0x2b2bfb[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x1cbd0c['query'][_0xc008('0x25')]);_0x2b2bfb[_0xc008('0x23')]=qs[_0xc008('0x23')](_0x1cbd0c[_0xc008('0x53')][_0xc008('0x23')]);}_0x2b2bfb['order']=qs[_0xc008('0x57')](_0x1cbd0c[_0xc008('0x53')][_0xc008('0x57')]);_0x2b2bfb[_0xc008('0x5a')]=qs[_0xc008('0x4f')](_[_0xc008('0x58')](_0x1cbd0c[_0xc008('0x53')],_0x357043[_0xc008('0x4f')]));_0x2b2bfb[_0xc008('0x5a')][_0xc008('0x73')]=_0x16c1f2['id'];if(_0x1cbd0c[_0xc008('0x53')][_0xc008('0x59')]){_0x2b2bfb[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x2b2bfb[_0xc008('0x5a')],{'$or':_['map'](_0x2b2bfb['attributes'],function(_0xa53d53){var _0x276ced={};_0x276ced[_0xa53d53]={'$like':'%'+_0x1cbd0c[_0xc008('0x53')][_0xc008('0x59')]+'%'};return _0x276ced;})});}_0x2b2bfb=_[_0xc008('0x5b')]({},_0x2b2bfb,_0x1cbd0c[_0xc008('0x5c')]);return db[_0xc008('0x7c')][_0xc008('0x26')]({'where':_0x2b2bfb[_0xc008('0x5a')]})['then'](function(_0x9e53af){_0x2fcad1[_0xc008('0x26')]=_0x9e53af;if(_0x1cbd0c['query'][_0xc008('0x62')]){_0x2b2bfb[_0xc008('0x63')]=[{'all':!![]}];}return db[_0xc008('0x7c')][_0xc008('0x5e')](_0x2b2bfb);})[_0xc008('0x2b')](function(_0x3718d9){_0x2fcad1['rows']=_0x3718d9;return _0x2fcad1;});}})[_0xc008('0x2b')](respondWithFilteredResult(_0x56fa88,_0x2b2bfb))[_0xc008('0x1f')](handleError(_0x56fa88,null));};exports[_0xc008('0x7d')]=function(_0x1cff37,_0x59e3d0){return db[_0xc008('0x5d')]['find']({'where':{'id':_0x1cff37[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x59e3d0,null))['then'](function(_0x184f30){if(_0x184f30){return _0x184f30['removeAnswers'](_0x1cff37[_0xc008('0x53')]['ids']);}})['then'](respondWithStatusCode(_0x59e3d0,null))['catch'](handleError(_0x59e3d0,null));};exports[_0xc008('0x7e')]=function(_0x402b67,_0x48f40f){_0x402b67[_0xc008('0x6b')][_0xc008('0x7f')]=_0x402b67['file'][_0xc008('0x80')];return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x402b67['params']['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x48f40f,null))[_0xc008('0x2b')](saveUpdates(_0x402b67[_0xc008('0x6b')],null))[_0xc008('0x2b')](respondWithResult(_0x48f40f,null))[_0xc008('0x1f')](handleError(_0x48f40f,null));};exports[_0xc008('0x81')]=function(_0x2d87ff,_0x45a4d4){_0x2d87ff[_0xc008('0x6b')][_0xc008('0x82')]=_0x2d87ff[_0xc008('0x83')]['filename'];return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x2d87ff[_0xc008('0x60')]['id']}})['then'](handleEntityNotFound(_0x45a4d4,null))[_0xc008('0x2b')](saveUpdates(_0x2d87ff[_0xc008('0x6b')],null))[_0xc008('0x2b')](respondWithResult(_0x45a4d4,null))['catch'](handleError(_0x45a4d4,null));};exports[_0xc008('0x84')]=function(_0x5468b9,_0x3d3ebc){_0x5468b9[_0xc008('0x6b')][_0xc008('0x85')]=_0x5468b9['file'][_0xc008('0x80')];return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x5468b9[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x3d3ebc,null))[_0xc008('0x2b')](saveUpdates(_0x5468b9[_0xc008('0x6b')],null))['then'](respondWithResult(_0x3d3ebc,null))[_0xc008('0x1f')](handleError(_0x3d3ebc,null));};exports[_0xc008('0x86')]=function(_0x17db9a,_0x39d1fd){_0x17db9a['body'][_0xc008('0x87')]=_0x17db9a['file'][_0xc008('0x80')];return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x17db9a[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x39d1fd,null))[_0xc008('0x2b')](saveUpdates(_0x17db9a[_0xc008('0x6b')],null))['then'](respondWithResult(_0x39d1fd,null))[_0xc008('0x1f')](handleError(_0x39d1fd,null));};exports[_0xc008('0x88')]=function(_0x372822,_0x3e5a69){var _0x4f0c8a=path[_0xc008('0x89')](config['root'],_0xc008('0x8a'));var _0x3b2e99={'where':{'id':_0x372822[_0xc008('0x60')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x58231d=![];return require(_0xc008('0x8b'))['getLicense']()[_0xc008('0x2b')](function(_0x59596d){if(_0x59596d){_0x58231d=_0x59596d[_0xc008('0x8c')];}})[_0xc008('0x2b')](function(){return db['ChatWebsite'][_0xc008('0x64')](_0x3b2e99);})[_0xc008('0x2b')](handleEntityNotFound(_0x3e5a69,null))['then'](function(_0x5b2261){if(_0x5b2261){if(!_[_0xc008('0x8d')](_0x5b2261[_0xc008('0x7f')])){if(fs['existsSync'](path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0x8f'),_0x5b2261[_0xc008('0x7f')]))&&_0x58231d){_0x4f0c8a=path['join'](config[_0xc008('0x8e')],_0xc008('0x8f'),_0x5b2261[_0xc008('0x7f')]);}}return _0x3e5a69[_0xc008('0x90')](_0x4f0c8a);}})[_0xc008('0x1f')](handleError(_0x3e5a69,null));};exports[_0xc008('0x91')]=function(_0x27fd97,_0x3ff1b2){var _0x2f0e45=path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0x92'));var _0x1f9b4f={'where':{'id':_0x27fd97['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xc008('0x5d')][_0xc008('0x64')](_0x1f9b4f)[_0xc008('0x2b')](handleEntityNotFound(_0x3ff1b2,null))[_0xc008('0x2b')](function(_0x1b5d7b){if(_0x1b5d7b){if(!_[_0xc008('0x8d')](_0x1b5d7b[_0xc008('0x82')])){if(fs['existsSync'](path['join'](config[_0xc008('0x8e')],_0xc008('0x93'),_0x1b5d7b[_0xc008('0x82')]))){_0x2f0e45=path['join'](config[_0xc008('0x8e')],_0xc008('0x93'),_0x1b5d7b[_0xc008('0x82')]);}}return _0x3ff1b2[_0xc008('0x90')](_0x2f0e45);}})[_0xc008('0x1f')](handleError(_0x3ff1b2,null));};exports[_0xc008('0x94')]=function(_0x35e59b,_0x39e8e3){var _0x354115=path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0x95'));var _0x4ffaa3={'where':{'id':_0x35e59b['params']['id']},'attributes':['id',_0xc008('0x85'),_0xc008('0x96')],'raw':!![]};return db['ChatWebsite'][_0xc008('0x64')](_0x4ffaa3)[_0xc008('0x2b')](handleEntityNotFound(_0x39e8e3,null))[_0xc008('0x2b')](function(_0x15b272){if(_0x15b272){if(!_[_0xc008('0x8d')](_0x15b272[_0xc008('0x85')])){if(fs[_0xc008('0x97')](path[_0xc008('0x89')](config[_0xc008('0x8e')],'server/files/images/avatars/',_0x15b272['customerAvatar']))&&_0x15b272['showCustomerAvatar']){_0x354115=path[_0xc008('0x89')](config['root'],_0xc008('0x93'),_0x15b272[_0xc008('0x85')]);}}return _0x39e8e3[_0xc008('0x90')](_0x354115);}})[_0xc008('0x1f')](handleError(_0x39e8e3,null));};exports[_0xc008('0x98')]=function(_0x2073be,_0x293fc5){var _0x37636e=path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0x99'));var _0x4ce373={'where':{'id':_0x2073be[_0xc008('0x60')]['id']},'attributes':['id',_0xc008('0x87')],'raw':!![]};return db[_0xc008('0x5d')][_0xc008('0x64')](_0x4ce373)[_0xc008('0x2b')](handleEntityNotFound(_0x293fc5,null))['then'](function(_0x755321){if(_0x755321){if(!_['isNil'](_0x755321[_0xc008('0x87')])){if(fs[_0xc008('0x97')](path[_0xc008('0x89')](config['root'],_0xc008('0x93'),_0x755321[_0xc008('0x87')]))){_0x37636e=path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0x93'),_0x755321[_0xc008('0x87')]);}}return _0x293fc5[_0xc008('0x90')](_0x37636e);}})['catch'](handleError(_0x293fc5,null));};function checkWebsiteInterval(_0x1cad4b){var _0x3835ce=_0x1cad4b[_0xc008('0x9a')];if(!_0x3835ce){return Promise[_0xc008('0x9b')](_0x1cad4b);}var _0x52a7b5=_0x1cad4b['timezone']||undefined;return _0x3835ce['ifTime'](_0x52a7b5)['then'](function(_0x7cdb67){if(!_0x7cdb67){throw new APIOutOfIntervalError();}return _0x1cad4b;});}exports[_0xc008('0x9c')]=function(_0xfa6008,_0xdbe8ad){var _0x4db69f={'body':_0xfa6008[_0xc008('0x6b')],'channel':_0xc008('0x9d')};var _0xff42e6=[];var _0x567bfc=[];var _0x438195={};var _0x5bfe83=![];if(_0xfa6008[_0xc008('0x6b')]['id']){delete _0xfa6008['body']['id'];}if(_[_0xc008('0x8d')](_0xfa6008[_0xc008('0x6b')][_0xc008('0x9e')])){throw new APIBadRequestError(_0xc008('0x9f'));}if(_['isNil'](_0xfa6008[_0xc008('0x6b')][_0xc008('0xa0')])){throw new APIBadRequestError(_0xc008('0xa1'));}if(_[_0xc008('0xa2')](_0xfa6008[_0xc008('0x6b')][_0xc008('0x6b')])){throw new APIBadRequestError(_0xc008('0xa3'));}var _0x4c6cfa=_0xfa6008[_0xc008('0x6b')][_0xc008('0x34')]&&_0xfa6008[_0xc008('0x6b')]['referer'];return db['CmContact'][_0xc008('0x71')]()[_0xc008('0x2b')](function(_0x773edd){if(!_0x773edd){throw new Error(_0xc008('0xa4'));}_0xff42e6=Object['keys'](_0x773edd)[_0xc008('0x59')](function(_0x22b653){return!['createdAt','updatedAt']['includes'](_0x22b653);});_0x567bfc=Object[_0xc008('0x61')](_0x773edd)['filter'](function(_0x3744e1){return!['createdAt',_0xc008('0xa5'),_0xc008('0xa6'),_0xc008('0xa7')][_0xc008('0xa8')](_0x3744e1);});if(!_['includes'](_0x567bfc,_0xfa6008['body'][_0xc008('0xa0')])){throw new APIBadRequestError(_0xc008('0xa9')+_0x567bfc[_0xc008('0x89')](',\x20'));}_0x438195[_0xfa6008['body'][_0xc008('0xa0')]]=_0xfa6008[_0xc008('0x6b')][_0xc008('0x9e')];})[_0xc008('0x2b')](function(){return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0xfa6008[_0xc008('0x60')]['id']},'include':[{'model':db[_0xc008('0xaa')],'as':_0xc008('0xab'),'include':[{'model':db[_0xc008('0xac')],'as':_0xc008('0xad'),'where':_0x438195,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xc008('0xae')],'as':'Applications'},{'model':db[_0xc008('0x9a')],'as':_0xc008('0x9a'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xc008('0xaf')],'raw':!![]}]}]});})[_0xc008('0x2b')](function(_0x36af70){if(!_0x36af70){throw new APINotFoundError(util[_0xc008('0x3f')](_0xc008('0xb0'),_0xfa6008[_0xc008('0x60')]['id']));}if(_0x4c6cfa){return checkWebsiteInterval(_0x36af70);}return _0x36af70;})['then'](function(_0xdf5bb2){_0x4db69f[_0xc008('0xb1')]=_0xdf5bb2;_0x4db69f[_0xc008('0xb2')]=_['orderBy'](_0xdf5bb2[_0xc008('0xb3')],[_0xc008('0xb4')],[_0xc008('0xb5')]);if(_0x4db69f[_0xc008('0xb1')]['Applications']){delete _0x4db69f['account'][_0xc008('0xb3')];}_0x4db69f['list']=_0xdf5bb2[_0xc008('0xab')]||{'id':_0xdf5bb2[_0xc008('0xa7')]};if(_0x4db69f[_0xc008('0xb6')]&&_0x4db69f[_0xc008('0xb6')][_0xc008('0xad')]['length']){return _0x4db69f['list'][_0xc008('0xad')][0x0];}var _0x2d3fb4=_[_0xc008('0x11')](_0xfa6008[_0xc008('0x6b')],{'firstName':_0xfa6008[_0xc008('0x6b')][_0xc008('0x9e')],'ListId':_0xdf5bb2[_0xc008('0xa7')]});_0x2d3fb4[_0xfa6008['body'][_0xc008('0xa0')]]=_0xfa6008[_0xc008('0x6b')][_0xc008('0x9e')];return db[_0xc008('0xac')][_0xc008('0x65')](_0x2d3fb4,{'fields':_0xff42e6,'raw':!![]});})[_0xc008('0x2b')](function(_0x3af9d0){_0x4db69f[_0xc008('0xb7')]=_0x3af9d0;var _0x16f9e0=createInteractionObject(_0xfa6008[_0xc008('0x60')]['id'],_0xfa6008[_0xc008('0x6b')],_0xfa6008[_0xc008('0xb8')],_0x3af9d0);var _0x4e8fca={'ChatWebsiteId':_0xfa6008[_0xc008('0x60')]['id']};if(_0xfa6008[_0xc008('0x6b')]['threadId']){_0x4e8fca[_0xc008('0xb9')]=_0xfa6008[_0xc008('0x6b')][_0xc008('0xb9')];_0x4e8fca[_0xc008('0xba')]=![];return db[_0xc008('0xbb')][_0xc008('0x64')]({'where':_0x4e8fca})[_0xc008('0x2b')](function(_0x20fbb3){var _0x1859c1=_0xfa6008[_0xc008('0x6b')][_0xc008('0x34')]&&_0xfa6008['body'][_0xc008('0x3c')];if(_0x20fbb3){_0x5bfe83=!![];return _0x20fbb3;}else if(!_0x1859c1&&_0x20fbb3&&_0x20fbb3[_0xc008('0xba')]){throw new APIConflictError(_0xc008('0xbc'));}_0x16f9e0[_0xc008('0xb9')]=_0xfa6008[_0xc008('0x6b')][_0xc008('0xb9')];_0x16f9e0[_0xc008('0xbd')]=_0xfa6008[_0xc008('0x6b')][_0xc008('0xbd')];return db[_0xc008('0xbb')][_0xc008('0x65')](_0x16f9e0);});}_0x4e8fca[_0xc008('0xbe')]=_0x3af9d0['id'];if(_0xfa6008[_0xc008('0x6b')][_0xc008('0xbf')]&&_0xfa6008[_0xc008('0x6b')][_0xc008('0xbf')]['id']){_0x4e8fca['id']=_0xfa6008['body']['interaction']['id'];return db['ChatInteraction'][_0xc008('0x64')]({'where':_0x4e8fca})[_0xc008('0x2b')](function(_0x3f80f4){var _0x1397bd=_0xfa6008[_0xc008('0x6b')][_0xc008('0x34')]&&_0xfa6008[_0xc008('0x6b')]['referer'];if(!_0x1397bd&&_0x3f80f4&&_0x3f80f4[_0xc008('0xba')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x3f80f4){_0x5bfe83=!![];return _0x3f80f4;}else{return db['ChatInteraction'][_0xc008('0x65')](_0x16f9e0);}});}return db[_0xc008('0xbb')]['create'](_0x16f9e0);})[_0xc008('0x2b')](function(_0x37257d){if(!_0x5bfe83){return _0x37257d;}var _0x3dc75c={'from':(_0x4db69f['contact'][_0xc008('0x39')]||'')+'\x20'+(_0x4db69f[_0xc008('0xb7')][_0xc008('0x3a')]||'')};if(_0xfa6008['body'][_0xc008('0xb9')]&&_0xfa6008[_0xc008('0x6b')][_0xc008('0xc0')]&&_0xfa6008[_0xc008('0x6b')][_0xc008('0xb9')]!=_0xfa6008[_0xc008('0x6b')][_0xc008('0xc0')]){_0x3dc75c[_0xc008('0xb9')]=_0xfa6008['body'][_0xc008('0xc0')];}return _0x37257d[_0xc008('0x2a')](_0x3dc75c);})[_0xc008('0x2b')](function(_0x1b5f8c){_0x4db69f[_0xc008('0xbf')]=_0x1b5f8c['get']({'plain':!![]});_0x4db69f[_0xc008('0xbf')][_0xc008('0xc1')]=!_0x5bfe83;if(_0x4db69f[_0xc008('0xbf')][_0xc008('0xc1')]){if(_0x4db69f[_0xc008('0xb1')][_0xc008('0xc2')]){_0x4db69f[_0xc008('0xb2')][_0xc008('0xc3')]({'id':0x0,'priority':_0x4db69f['applications'][_0xc008('0x54')]+0x1,'app':_0xc008('0xc4'),'appdata':_0xc008('0xc5'),'interval':_0xc008('0xc6')});}}return db['ChatMessage']['create']({'body':_0xfa6008[_0xc008('0x6b')][_0xc008('0x6b')],'ChatWebsiteId':_0xfa6008['params']['id'],'ChatInteractionId':_0x1b5f8c['id'],'direction':'in','ContactId':_0x4db69f[_0xc008('0xb7')]['id'],'AttachmentId':_0xfa6008[_0xc008('0x6b')][_0xc008('0xc7')]});})[_0xc008('0x2b')](function(_0x2ecaff){_0x4db69f[_0xc008('0x1e')]=_0x2ecaff;if(!_0x4db69f[_0xc008('0xbf')]['UserId']){return;}return db['User'][_0xc008('0x64')]({'attributes':['id','name'],'where':{'id':_0x4db69f[_0xc008('0xbf')][_0xc008('0xc8')]}});})[_0xc008('0x2b')](function(_0x2ee321){if(_0x2ee321){_0x4db69f[_0xc008('0xb2')][_0xc008('0xc9')]({'id':0x0,'priority':0x0,'app':_0xc008('0xca'),'appdata':_0x2ee321[_0xc008('0x30')]+','+(_0x4db69f[_0xc008('0xb1')][_0xc008('0xcb')]||0xa),'interval':_0xc008('0xc6')});_0x4db69f['forcedOwnership']=!![];}if(!_0x4db69f[_0xc008('0xbf')][_0xc008('0xcc')]){return;}return db[_0xc008('0xcd')][_0xc008('0x64')]({'attributes':['id',_0xc008('0x30')],'where':{'id':_0x4db69f[_0xc008('0xbf')][_0xc008('0xcc')]}});})['then'](function(_0x43065b){if(_0x43065b){_0x4db69f[_0xc008('0xb2')][_0xc008('0xc9')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x43065b[_0xc008('0x30')]+','+(_0x4db69f[_0xc008('0xb1')][_0xc008('0xce')]||0x12c),'interval':_0xc008('0xc6')});}return respondWithRpcPromise(_0xc008('0xcf'),_0xc008('0xd0'),_0x4db69f);})['then'](function(_0x501134){respondWithRpcPromise(_0xc008('0xd1'),_0xc008('0xd1'),{'event':_0xc008('0x9c'),'message':_0x501134},client9002);return _0x501134;})[_0xc008('0x2b')](respondWithResult(_0xdbe8ad,null))[_0xc008('0x1f')](APIHandleError(_0xdbe8ad));};exports['offline']=function(_0x7c1bf8,_0x569ac1){var _0x15cdd1,_0x8fde89,_0x59df96;var _0x1c348e=[];var _0xcae7ad={};var _0x214071=_0x7c1bf8[_0xc008('0xd2')]||[];var _0x499da6=[];var _0x348c42;return db[_0xc008('0xac')][_0xc008('0x71')]()[_0xc008('0x2b')](function(_0x157b26){if(!_0x157b26){throw new db['Sequelize'][(_0xc008('0xd3'))](_0xc008('0xd4'));}_0x1c348e=_[_0xc008('0xd5')](_['keys'](_0x157b26),[_0xc008('0xd6'),_0xc008('0xa5'),_0xc008('0xa6'),_0xc008('0xa7')]);if(_0x7c1bf8['body']['id']){delete _0x7c1bf8[_0xc008('0x6b')]['id'];}if(_[_0xc008('0x8d')](_0x7c1bf8[_0xc008('0x6b')][_0xc008('0x9e')])){throw _0x569ac1[_0xc008('0x21')](0x1f4)['send'](new db[(_0xc008('0xd7'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xc008('0x8d')](_0x7c1bf8['body'][_0xc008('0x6b')])||_0x7c1bf8[_0xc008('0x6b')][_0xc008('0x6b')]===''){throw _0x569ac1[_0xc008('0x21')](0x1f4)[_0xc008('0x31')](new db[(_0xc008('0xd7'))][(_0xc008('0xd3'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xc008('0x8d')](_0x7c1bf8[_0xc008('0x6b')][_0xc008('0xd8')])){throw _0x569ac1[_0xc008('0x21')](0x1f4)[_0xc008('0x31')](new db[(_0xc008('0xd7'))]['ValidationError'](_0xc008('0xd9')+_0x1c348e));}if(!_[_0xc008('0xa8')](_0x1c348e,_0x7c1bf8[_0xc008('0x6b')][_0xc008('0xd8')])){throw _0x569ac1[_0xc008('0x21')](0x1f4)[_0xc008('0x31')](new db[(_0xc008('0xd7'))][(_0xc008('0xd3'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c348e));}_0xcae7ad[_0x7c1bf8['body'][_0xc008('0xd8')]]=_0x7c1bf8[_0xc008('0x6b')]['from'];})[_0xc008('0x2b')](function(){return db['ChatWebsite'][_0xc008('0x64')]({'where':{'id':_0x7c1bf8[_0xc008('0x60')]['id']},'include':[{'model':db[_0xc008('0xaa')],'as':_0xc008('0xab')},{'model':db[_0xc008('0xda')],'as':_0xc008('0xda')}]});})[_0xc008('0x2b')](handleEntityNotFound(_0x569ac1,null))['then'](function(_0x286082){if(_0x286082&&_0x286082['List']){_0x8fde89=_0x286082;var _0x39924c=_[_0xc008('0x11')](_0x7c1bf8[_0xc008('0x6b')],{'firstName':_0x7c1bf8[_0xc008('0x6b')][_0xc008('0x9e')],'phone':_0x7c1bf8[_0xc008('0x6b')][_0xc008('0x9e')],'ListId':_0x286082['ListId']});_0x39924c[_0x7c1bf8[_0xc008('0x6b')][_0xc008('0xd8')]]=_0x7c1bf8['body'][_0xc008('0x9e')];return db[_0xc008('0xac')][_0xc008('0xdb')]({'where':_0xcae7ad,'defaults':_0x39924c});}})[_0xc008('0xdc')](function(_0x10f98a){if(_0x10f98a){_0x59df96=_0x10f98a;var _0x2ed7e0=fs['readFileSync'](path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0xdd')),_0xc008('0xde'));var _0x47d263=ejs['render'](_0x2ed7e0,{'body':_['toPairs'](_0x7c1bf8[_0xc008('0x6b')][_0xc008('0x6b')]),'bodyTitle':_0x8fde89['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x47d263,'plainBody':htmlToText['fromString'](_0x47d263),'ContactId':_0x10f98a['id'],'ChatWebsiteId':_0x8fde89['id']});}})[_0xc008('0x2b')](function(_0x134ec8){_0x348c42=_0x134ec8;if(_0x214071['length']){var _0x43ef43=_0x214071[_0xc008('0x4e')](function(_0x9bd8e6){return{'name':_0x9bd8e6[_0xc008('0xdf')],'basename':_0x9bd8e6[_0xc008('0x80')],'type':_0x9bd8e6['mimetype'],'ChatOfflineMessageId':_0x134ec8['id']};});_0x499da6=_0x43ef43['map'](_0x197cfd=>{var _0xce5e90={'filename':_0x197cfd[_0xc008('0x30')],'path':path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0xe0'),_0xc008('0xd2'),'attachments',_0xc008('0xe1'),_0x197cfd[_0xc008('0xe2')])};return _0xce5e90;});if(!_0x8fde89[_0xc008('0xe3')]){return db[_0xc008('0xe4')][_0xc008('0xe5')](function(_0x3bcf94){return db[_0xc008('0xe6')]['bulkCreate'](_0x43ef43,{'transaction':_0x3bcf94});});}}})['then'](function(){if(_0x348c42){_0x15cdd1=_0x348c42;return db[_0xc008('0xda')][_0xc008('0x75')]({'where':{'service':!![]},'include':[{'model':db[_0xc008('0xe7')],'as':_0xc008('0xe8'),'raw':!![],'include':[{'model':db[_0xc008('0xe9')],'as':_0xc008('0xe9'),'raw':!![]}]}]});}})[_0xc008('0x2b')](function(_0x3f9be3){if(_0x3f9be3&&_0x3f9be3[_0xc008('0xe8')]&&_0x8fde89[_0xc008('0xea')]&&_0x8fde89[_0xc008('0xeb')]){var _0x202826=_0x3f9be3[_0xc008('0xec')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x202826,'message':{'from':util[_0xc008('0x3f')](_0xc008('0xed'),_0x3f9be3[_0xc008('0x30')],_0x3f9be3[_0xc008('0xee')]||_0x3f9be3[_0xc008('0xe8')][_0xc008('0x6c')]),'to':_0x8fde89[_0xc008('0xeb')],'subject':_0x8fde89['offlineMessageSubject'],'html':_0x15cdd1['body'],'attachments':_0x499da6}},client9003)['then'](function(){return _0x15cdd1;})[_0xc008('0x1f')](function(_0x4b7132){logger['error'](_0x4b7132);});}})['then'](function(){if(_0x8fde89&&_0x8fde89[_0xc008('0xe3')]&&_0x8fde89[_0xc008('0xef')]){var _0x8a1e6a=[];if(_0x214071[_0xc008('0x54')]){_0x8a1e6a=_0x214071[_0xc008('0x4e')](function(_0x3d427d){return{'name':_0x3d427d[_0xc008('0xdf')],'basename':_0x3d427d[_0xc008('0x80')],'type':_0x3d427d[_0xc008('0xf0')],'ChatOfflineMessageId':_0x348c42['id']};});}var _0xdcda1f;if(!_[_0xc008('0x8d')](_0x8fde89[_0xc008('0xf1')])){var _0x5065aa=_['map'](_0x7c1bf8[_0xc008('0x6b')],function(_0x6a87a7){return _0x6a87a7;});var _0xc55c88=_[_0xc008('0xf2')](_0x5065aa)[0x0];var _0x3935a2=_[_0xc008('0xf3')](_0xc55c88,function(_0xcdba52){return _0xcdba52;});_0xdcda1f=_0x3935a2[0x1][_0x8fde89[_0xc008('0xf1')]];}var _0x5adeeb={'from':_0x59df96[_0xc008('0xee')],'firstName':_0x59df96['firstName'],'lastName':_0x59df96['lastName'],'mapKey':'email','message':{'from':_0x59df96['email'],'to':_0x8fde89[_0xc008('0xda')]['email'],'cc':'','subject':_[_0xc008('0x8d')](_0xdcda1f)?_0x8fde89[_0xc008('0xf4')]:_0xdcda1f,'messageId':'','sentAt':new Date(),'attach':_0x8a1e6a[_0xc008('0x54')],'attachments':_0x8a1e6a,'originChannel':'Chat','ChatWebsiteId':_0x8fde89['id'],'ChatOfflineMessageId':_0x15cdd1['id'],'originTo':_0x8fde89['MailAccount'][_0xc008('0xee')]},'body':_0x15cdd1[_0xc008('0x6b')]};var _0x5e1141={'account':{'id':_0x8fde89[_0xc008('0xef')]},'body':_0x5adeeb,'log':_0xc008('0xf5')};return respondWithRpcPromise(_0xc008('0xf5'),_0xc008('0xf6'),_0x5e1141,client9001)[_0xc008('0x2b')](function(){return _0x15cdd1;})[_0xc008('0x1f')](function(_0x157664){logger[_0xc008('0x1c')](_0x157664);});}return;})[_0xc008('0x2b')](function(){if(_0x15cdd1){return _0x15cdd1;}})[_0xc008('0x2b')](respondWithResult(_0x569ac1,null))['catch'](function(){for(var _0x2392ac of _0x214071){var _0x17d146=path['join'](config['root'],_0xc008('0xe0'),_0xc008('0xd2'),_0xc008('0xf7'),'offline-chat',_0x2392ac['filename']);fs_extra['remove'](_0x17d146)['catch'](function(_0x97380b){logger[_0xc008('0x1c')](_0xc008('0xf8'),_0x17d146,_0x97380b);});}});};exports[_0xc008('0xf9')]=function(_0x43e343,_0xb24d64){return db[_0xc008('0xbb')]['find']({'where':{'id':_0x43e343[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0xb24d64,null))[_0xc008('0x2b')](function(_0x2ab8b1){if(_0x2ab8b1){return _0x2ab8b1[_0xc008('0xf9')](_0x43e343['body'][_0xc008('0x79')],_[_0xc008('0xfa')](_0x43e343['body'],[_0xc008('0x79'),'id'])||{});}})[_0xc008('0x2b')](respondWithResult(_0xb24d64,null))[_0xc008('0x1f')](handleError(_0xb24d64,null));};exports[_0xc008('0xfb')]=function(_0x5658f7,_0x1f2e30){var _0x4da239={'raw':![],'where':{}};var _0x188280={};var _0x1c048d={'count':0x0,'rows':[]};return db[_0xc008('0x5d')][_0xc008('0x75')]({'where':{'id':_0x5658f7[_0xc008('0x60')]['id']}})['then'](handleEntityNotFound(_0x1f2e30,null))[_0xc008('0x2b')](function(_0x168e28){if(_0x168e28){_0x188280[_0xc008('0x43')]=_[_0xc008('0x61')](db['ChatInteraction'][_0xc008('0x4b')]);_0x188280['query']=_['keys'](_0x5658f7[_0xc008('0x53')]);_0x188280[_0xc008('0x4f')]=_[_0xc008('0x50')](_0x188280['model'],_0x188280[_0xc008('0x53')]);_0x4da239[_0xc008('0x51')]=_['intersection'](_0x188280[_0xc008('0x43')],qs[_0xc008('0x52')](_0x5658f7['query']['fields']));_0x4da239[_0xc008('0x51')]=_0x4da239['attributes']['length']?_0x4da239[_0xc008('0x51')]:_0x188280['model'];if(!_0x5658f7[_0xc008('0x53')][_0xc008('0x55')](_0xc008('0x76'))){_0x4da239[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x5658f7['query']['limit']);_0x4da239[_0xc008('0x23')]=qs['offset'](_0x5658f7[_0xc008('0x53')]['offset']);}_0x4da239['order']=qs['sort'](_0x5658f7[_0xc008('0x53')]['sort']);_0x4da239[_0xc008('0x5a')]=qs[_0xc008('0x4f')](_['pick'](_0x5658f7['query'],_0x188280[_0xc008('0x4f')]));_0x4da239[_0xc008('0x5a')][_0xc008('0x73')]=_0x168e28['id'];if(_0x5658f7[_0xc008('0x53')]['filter']){_0x4da239['where']=_[_0xc008('0x5b')](_0x4da239['where'],{'$or':_['map'](_0x4da239[_0xc008('0x51')],function(_0x3f8bdf){var _0x4bbe91={};_0x4bbe91[_0x3f8bdf]={'$like':'%'+_0x5658f7['query']['filter']+'%'};return _0x4bbe91;})});}_0x4da239=_[_0xc008('0x5b')]({},_0x4da239,_0x5658f7['options']);return db[_0xc008('0xbb')][_0xc008('0x26')]({'where':_0x4da239[_0xc008('0x5a')]})[_0xc008('0x2b')](function(_0x1007b2){_0x1c048d['count']=_0x1007b2;if(_0x5658f7['query'][_0xc008('0x62')]){_0x4da239[_0xc008('0x63')]=[{'model':db[_0xc008('0xac')],'as':_0xc008('0xfc'),'required':![]},{'model':db[_0xc008('0xfd')],'as':_0xc008('0xfe'),'attributes':[_0xc008('0x30'),_0xc008('0xff'),_0xc008('0x100')],'required':![]},{'model':db[_0xc008('0x101')],'as':_0xc008('0x102'),'attributes':['id',_0xc008('0x30'),'color'],'where':_0x5658f7[_0xc008('0x53')][_0xc008('0x103')]?{'id':_0x5658f7[_0xc008('0x53')][_0xc008('0x103')]}:undefined,'required':_0x5658f7['query'][_0xc008('0x103')]?!![]:![]}];}return db[_0xc008('0xbb')][_0xc008('0x5e')](_0x4da239);})[_0xc008('0x2b')](function(_0x122084){_0x1c048d[_0xc008('0x77')]=_0x122084;return _0x1c048d;});}})[_0xc008('0x2b')](respondWithFilteredResult(_0x1f2e30,_0x4da239))[_0xc008('0x1f')](handleError(_0x1f2e30,null));};exports['getSnippet']=function(_0x31d1ac,_0x258ede){var _0x1e8036=0x0;var _0x2c9336=0x0;var _0x30d36a=![];var _0x3ed6eb;var _0x3640b0;return db['ChatWebsite'][_0xc008('0x64')]({'where':{'id':_0x31d1ac['params']['id']},'include':[{'model':db[_0xc008('0x9a')],'as':_0xc008('0x9a'),'include':[{'model':db[_0xc008('0x9a')],'as':_0xc008('0x104'),'attributes':['id',_0xc008('0xaf')]}]}]})[_0xc008('0x2b')](handleEntityNotFound(_0x258ede,null))[_0xc008('0x2b')](function(_0x22a459){if(_0x22a459){_0x3ed6eb=_0x22a459;return _0x22a459[_0xc008('0x105')]({'raw':!![]});}})[_0xc008('0x2b')](function(_0x4fae34){if(_0x3ed6eb){if(_0x4fae34){_0x3640b0=_0x4fae34;}}return require(_0xc008('0x8b'))[_0xc008('0x106')]();})[_0xc008('0x2b')](function(_0x1ddd81){if(_0x1ddd81){_0x2c9336=_0x1ddd81[_0xc008('0x107')];_0x30d36a=_0x1ddd81[_0xc008('0x8c')];}})[_0xc008('0x2b')](function(){return db[_0xc008('0xbb')][_0xc008('0x26')]({'where':{'closed':![]}});})[_0xc008('0x2b')](function(_0x471618){_0x1e8036=_0x471618;if(_0x2c9336&&_0x471618>_0x2c9336){return db[_0xc008('0x108')][_0xc008('0x75')]({'where':{'id':0x1}})['then'](function(_0xd48308){if(_0xd48308){_0xd48308['increment'](_0xc008('0x109'));}});}})[_0xc008('0x2b')](function(){var _0x40e3b0=_0x3ed6eb[_0xc008('0x9a')];var _0x370234=_0x3ed6eb[_0xc008('0x10a')]||undefined;return _0x40e3b0?_0x40e3b0['ifTime'](_0x370234):!![];})[_0xc008('0x2b')](function(_0x34cbce){var _0x337acd=fs['readFileSync'](path['join'](config['root'],_0xc008('0x10b')),_0xc008('0xde'));var _0x2ccfcf=_0xc008('0x10c');var _0x2685f0=![];var _0x3f4588,_0x1ffb27;if(_0x31d1ac['headers'][_0xc008('0x3c')]){_0x3f4588=new URL(_0x31d1ac[_0xc008('0xb8')][_0xc008('0x3c')])[_0xc008('0x10d')];}else if(_0x31d1ac[_0xc008('0xb8')]['origin']){_0x3f4588=new URL(_0x31d1ac[_0xc008('0xb8')][_0xc008('0x10d')])[_0xc008('0x10d')];}else{_0x3f4588=_0xc008('0x10e');}_0x1ffb27=typeof _0x3ed6eb[_0xc008('0x66')][_0xc008('0x38')](',')[_0xc008('0x64')](function(_0x3485a3){return wildcardUtils[_0xc008('0x10f')](_0x3485a3,_0x3f4588);})!==_0xc008('0x24');var _0x5fa4bf={'chatVersion':_0x2ccfcf,'chatWebsiteAddressOrigin':_0x1ffb27?_0x3f4588:_0x3ed6eb['address'],'remote':_0x3ed6eb[_0xc008('0x110')],'query':querystring['stringify'](_[_0xc008('0x5b')](_0x3ed6eb[_0xc008('0x2d')]({'plain':!![]}),{'customerIp':_0x31d1ac[_0xc008('0xb8')]['x-forwarded-for']||_0x31d1ac[_0xc008('0xb8')]['x-real-ip']||_0x31d1ac[_0xc008('0x111')][_0xc008('0x112')]||_0x31d1ac['ip'],'referer':_0x31d1ac[_0xc008('0xb8')][_0xc008('0x3c')],'openedInteractions':_0x1e8036,'maxInteractions':_0x2c9336,'virtual':_0x30d36a[_0xc008('0x107')],'online':_0x34cbce,'custom':_0x30d36a,'address':_0x1ffb27?_0x3f4588:null}))[_0xc008('0x113')](/'/g,'\x5c\x27')};_0x258ede[_0xc008('0x31')](ejs[_0xc008('0x114')](Mustache[_0xc008('0x114')](_0x337acd,_0x5fa4bf),{'proactiveActions':_0x3640b0,'alignment':_0x3ed6eb[_0xc008('0x115')],'verticalAlignment':_0x3ed6eb['verticalAlignment'],'div_color':_0x3ed6eb[_0xc008('0x116')],'labelText':_0x3ed6eb['labelText'],'text_color':_0x3ed6eb['textColor'],'text_button_color':_0x3ed6eb[_0xc008('0x117')],'button_color':_0x3ed6eb['color_button'],'background_color':_0x3ed6eb[_0xc008('0x118')],'hideWhenOffline':_0x3ed6eb[_0xc008('0x119')],'intervalId':_0x3ed6eb[_0xc008('0x11a')],'isDevelopment':_0x2685f0,'chatVersion':_0x2ccfcf}));})[_0xc008('0x1f')](handleError(_0x258ede,null));};exports['addApplications']=function(_0x20b0f6,_0x210db6){var _0x104afd=_0x20b0f6[_0xc008('0x60')]['id'];var _0xc5b3de=_0x20b0f6['body'];var _0x2b9571=0xc8;var _0x26022c=null;return db['sequelize'][_0xc008('0xe5')]({'isolationLevel':db[_0xc008('0xe4')][_0xc008('0x11b')][_0xc008('0x11c')][_0xc008('0x11d')]},function(_0x3b46db){return db['ChatWebsite'][_0xc008('0x75')]({'where':{'id':_0x104afd},'transaction':_0x3b46db})[_0xc008('0x2b')](function(_0x2566aa){if(_0x2566aa){return db[_0xc008('0xae')][_0xc008('0x2c')]({'where':{'ChatWebsiteId':_0x104afd},'transaction':_0x3b46db})[_0xc008('0x2b')](function(){var _0x113151=_[_0xc008('0x4e')](_0xc5b3de,function(_0x2d2362){_0x2d2362[_0xc008('0x73')]=_0x104afd;return _0x2d2362;});return db['ChatApplication'][_0xc008('0x11e')](_0x113151,{'transaction':_0x3b46db});});}else{_0x2b9571=0x194;_0x26022c=[];}});})[_0xc008('0x2b')](function(){if(_0x2b9571!==0x194){return db[_0xc008('0xae')][_0xc008('0x11f')]({'where':{'ChatWebsiteId':_0x104afd},'order':'priority'})[_0xc008('0x2b')](function(_0x1838e3){_0x26022c=_0x1838e3;});}})[_0xc008('0x1f')](function(_0x360b5b){_0x2b9571=0x1f4;logger[_0xc008('0x1c')](_0x360b5b[_0xc008('0x120')]);if(_0x360b5b[_0xc008('0x30')]){delete _0x360b5b[_0xc008('0x30')];}_0x26022c=_0x360b5b;})[_0xc008('0x121')](function(){if(_0x26022c===null){_0x210db6[_0xc008('0x20')](_0x2b9571);}else{if(_0x2b9571===0x1f4){_0x210db6[_0xc008('0x21')](_0x2b9571)[_0xc008('0x31')](_0x26022c);}else{_0x210db6[_0xc008('0x21')](_0x2b9571)[_0xc008('0x29')](_0x26022c);}}});};exports['getApplications']=function(_0x2a2bc6,_0x33545e){var _0x3e3f3b={};var _0xbc2c57={};var _0x202896;var _0x4f46d7;return db[_0xc008('0x5d')][_0xc008('0x75')]({'where':{'id':_0x2a2bc6['params']['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x33545e,null))[_0xc008('0x2b')](function(_0x552498){if(_0x552498){_0x202896=_0x552498;_0xbc2c57['model']=_['keys'](db['ChatApplication'][_0xc008('0x4b')]);_0xbc2c57['query']=_['keys'](_0x2a2bc6[_0xc008('0x53')]);_0xbc2c57[_0xc008('0x4f')]=_[_0xc008('0x50')](_0xbc2c57['model'],_0xbc2c57['query']);_0x3e3f3b[_0xc008('0x51')]=_[_0xc008('0x50')](_0xbc2c57[_0xc008('0x43')],qs[_0xc008('0x52')](_0x2a2bc6['query'][_0xc008('0x52')]));_0x3e3f3b[_0xc008('0x51')]=_0x3e3f3b['attributes'][_0xc008('0x54')]?_0x3e3f3b['attributes']:_0xbc2c57['model'];_0x3e3f3b[_0xc008('0x56')]=qs[_0xc008('0x57')](_0x2a2bc6['query']['sort']);_0x3e3f3b[_0xc008('0x5a')]=qs[_0xc008('0x4f')](_['pick'](_0x2a2bc6[_0xc008('0x53')],_0xbc2c57['filters']));if(_0x2a2bc6[_0xc008('0x53')][_0xc008('0x59')]){_0x3e3f3b[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x3e3f3b[_0xc008('0x5a')],{'$or':_[_0xc008('0x4e')](_0x3e3f3b[_0xc008('0x51')],function(_0x41a8a6){var _0x502352={};_0x502352[_0x41a8a6]={'$like':'%'+_0x2a2bc6[_0xc008('0x53')]['filter']+'%'};return _0x502352;})});}_0x3e3f3b=_[_0xc008('0x5b')]({},_0x3e3f3b,_0x2a2bc6['options']);return _0x202896['getApplications'](_0x3e3f3b);}})[_0xc008('0x2b')](function(_0x52e7d2){if(_0x52e7d2){_0x4f46d7=_0x52e7d2[_0xc008('0x54')];if(!_0x2a2bc6[_0xc008('0x53')][_0xc008('0x55')]('nolimit')){_0x3e3f3b['limit']=qs[_0xc008('0x25')](_0x2a2bc6[_0xc008('0x53')]['limit']);_0x3e3f3b['offset']=qs[_0xc008('0x23')](_0x2a2bc6[_0xc008('0x53')][_0xc008('0x23')]);}return _0x202896[_0xc008('0x122')](_0x3e3f3b);}})[_0xc008('0x2b')](function(_0x1ddfca){if(_0x1ddfca){return _0x1ddfca?{'count':_0x4f46d7,'rows':_0x1ddfca}:null;}})[_0xc008('0x2b')](respondWithResult(_0x33545e,null))[_0xc008('0x1f')](handleError(_0x33545e,null));};exports['addProactiveActions']=function(_0x24757f,_0x107fdc){return db['chatProactiveAction'][_0xc008('0x64')]({'where':{'id':_0x24757f[_0xc008('0x60')]['id']}})['then'](handleEntityNotFound(_0x107fdc,null))[_0xc008('0x2b')](function(_0x5be0f8){if(_0x5be0f8){return _0x5be0f8[_0xc008('0x123')](_0x24757f['body'][_0xc008('0x79')],_[_0xc008('0xfa')](_0x24757f['body'],[_0xc008('0x79'),'id'])||{});}})['then'](respondWithResult(_0x107fdc,null))[_0xc008('0x1f')](handleError(_0x107fdc,null));};exports[_0xc008('0x105')]=function(_0x25969f,_0x34d4c0){var _0x1483bd={};var _0x2bf125={};var _0x384e8a;var _0x1b4a2f;return db[_0xc008('0x5d')]['findOne']({'where':{'id':_0x25969f[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x34d4c0,null))[_0xc008('0x2b')](function(_0x22de7a){if(_0x22de7a){_0x384e8a=_0x22de7a;_0x2bf125[_0xc008('0x43')]=_['keys'](db[_0xc008('0x124')][_0xc008('0x4b')]);_0x2bf125[_0xc008('0x53')]=_[_0xc008('0x61')](_0x25969f[_0xc008('0x53')]);_0x2bf125[_0xc008('0x4f')]=_[_0xc008('0x50')](_0x2bf125[_0xc008('0x43')],_0x2bf125[_0xc008('0x53')]);_0x1483bd[_0xc008('0x51')]=_[_0xc008('0x50')](_0x2bf125[_0xc008('0x43')],qs[_0xc008('0x52')](_0x25969f[_0xc008('0x53')][_0xc008('0x52')]));_0x1483bd[_0xc008('0x51')]=_0x1483bd['attributes'][_0xc008('0x54')]?_0x1483bd[_0xc008('0x51')]:_0x2bf125[_0xc008('0x43')];_0x1483bd[_0xc008('0x56')]=qs[_0xc008('0x57')](_0x25969f[_0xc008('0x53')][_0xc008('0x57')]);_0x1483bd[_0xc008('0x5a')]=qs[_0xc008('0x4f')](_[_0xc008('0x58')](_0x25969f['query'],_0x2bf125[_0xc008('0x4f')]));if(_0x25969f[_0xc008('0x53')]['filter']){_0x1483bd[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x1483bd['where'],{'$or':_[_0xc008('0x4e')](_0x1483bd[_0xc008('0x51')],function(_0x2f24f7){var _0x460313={};_0x460313[_0x2f24f7]={'$like':'%'+_0x25969f[_0xc008('0x53')][_0xc008('0x59')]+'%'};return _0x460313;})});}_0x1483bd=_['merge']({},_0x1483bd,_0x25969f[_0xc008('0x5c')]);return _0x384e8a[_0xc008('0x105')](_0x1483bd);}})[_0xc008('0x2b')](function(_0x16fa87){if(_0x16fa87){_0x1b4a2f=_0x16fa87[_0xc008('0x54')];if(!_0x25969f['query'][_0xc008('0x55')](_0xc008('0x76'))){_0x1483bd[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x25969f[_0xc008('0x53')][_0xc008('0x25')]);_0x1483bd[_0xc008('0x23')]=qs[_0xc008('0x23')](_0x25969f[_0xc008('0x53')][_0xc008('0x23')]);}return _0x384e8a[_0xc008('0x105')](_0x1483bd);}})[_0xc008('0x2b')](function(_0xd6b32d){if(_0xd6b32d){return _0xd6b32d?{'count':_0x1b4a2f,'rows':_0xd6b32d}:null;}})[_0xc008('0x2b')](respondWithResult(_0x34d4c0,null))[_0xc008('0x1f')](handleError(_0x34d4c0,null));};exports[_0xc008('0x125')]=function(_0x15422f,_0x252e57){var _0x5ce6cf=_0x15422f['query']['online']===_0xc008('0x126')?_0xc008('0x127'):_0xc008('0x128');return db[_0xc008('0x5d')][_0xc008('0x64')]({'attributes':['id',_0x5ce6cf],'where':{'id':_0x15422f[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x252e57,null))[_0xc008('0x2b')](function(_0x56c009){if(_0x56c009){var _0x192e7a=_0x56c009[_0x5ce6cf];var _0x2918fa=_0x192e7a&&_0x192e7a[_0xc008('0x129')]?_0x192e7a[_0xc008('0x129')]:[];_0x252e57[_0xc008('0x31')]({'fromKey':_[_0xc008('0x8d')](_0x192e7a['fromKey'])?undefined:_0x192e7a['fromKey'],'count':_0x2918fa['length'],'rows':_0x2918fa});}})[_0xc008('0x1f')](handleError(_0x252e57,null));};exports[_0xc008('0x12a')]=function(_0x5708a7,_0x5d46ce){var _0x22a2b0={'raw':![],'where':{}};var _0x256cb0={};var _0x2f36f6={'count':0x0,'rows':[]};return db[_0xc008('0x5d')][_0xc008('0x75')]({'where':{'id':_0x5708a7['params']['id']}})['then'](handleEntityNotFound(_0x5d46ce,null))[_0xc008('0x2b')](function(_0x8c41c8){if(_0x8c41c8){_0x256cb0[_0xc008('0x43')]=_['keys'](db[_0xc008('0x12b')][_0xc008('0x4b')]);_0x256cb0[_0xc008('0x53')]=_[_0xc008('0x61')](_0x5708a7[_0xc008('0x53')]);_0x256cb0[_0xc008('0x4f')]=_[_0xc008('0x50')](_0x256cb0['model'],_0x256cb0['query']);_0x22a2b0[_0xc008('0x51')]=_[_0xc008('0x50')](_0x256cb0[_0xc008('0x43')],qs[_0xc008('0x52')](_0x5708a7[_0xc008('0x53')]['fields']));_0x22a2b0[_0xc008('0x51')]=_0x22a2b0['attributes']['length']?_0x22a2b0[_0xc008('0x51')]:_0x256cb0['model'];if(!_0x5708a7[_0xc008('0x53')]['hasOwnProperty']('nolimit')){_0x22a2b0['limit']=qs[_0xc008('0x25')](_0x5708a7['query'][_0xc008('0x25')]);_0x22a2b0[_0xc008('0x23')]=qs['offset'](_0x5708a7[_0xc008('0x53')][_0xc008('0x23')]);}_0x22a2b0[_0xc008('0x56')]=qs[_0xc008('0x57')](_0x5708a7['query']['sort']);_0x22a2b0[_0xc008('0x5a')]=qs[_0xc008('0x4f')](_[_0xc008('0x58')](_0x5708a7[_0xc008('0x53')],_0x256cb0['filters']));_0x22a2b0[_0xc008('0x5a')]['ChatWebsiteId']=_0x8c41c8['id'];if(_0x5708a7[_0xc008('0x53')][_0xc008('0x59')]){_0x22a2b0[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x22a2b0['where'],{'$or':_['map'](_0x22a2b0[_0xc008('0x51')],function(_0x32b85b){var _0x191a25={};_0x191a25[_0x32b85b]={'$like':'%'+_0x5708a7['query'][_0xc008('0x59')]+'%'};return _0x191a25;})});}_0x22a2b0=_[_0xc008('0x5b')]({},_0x22a2b0,_0x5708a7[_0xc008('0x5c')]);return db[_0xc008('0x12b')][_0xc008('0x26')]({'where':_0x22a2b0['where']})['then'](function(_0x1bbbe6){_0x2f36f6[_0xc008('0x26')]=_0x1bbbe6;if(_0x5708a7[_0xc008('0x53')][_0xc008('0x62')]){_0x22a2b0[_0xc008('0x63')]=[{'all':!![]}];}else{_0x22a2b0[_0xc008('0x63')]=[{'model':db[_0xc008('0xac')],'as':_0xc008('0xfc'),'required':![]},{'model':db[_0xc008('0xe6')],'as':_0xc008('0x12c'),'required':![]}];}return db[_0xc008('0x12b')][_0xc008('0x5e')](_0x22a2b0);})[_0xc008('0x2b')](function(_0x23d0db){_0x2f36f6[_0xc008('0x77')]=_0x23d0db;return _0x2f36f6;});}})[_0xc008('0x2b')](respondWithFilteredResult(_0x5d46ce,_0x22a2b0))['catch'](handleError(_0x5d46ce,null));};exports[_0xc008('0x12d')]=function(_0x651201,_0x1a363a){return db['ChatWebsite'][_0xc008('0x64')]({'where':{'id':_0x651201[_0xc008('0x60')]['id']}})['then'](handleEntityNotFound(_0x1a363a,null))[_0xc008('0x2b')](function(_0x4b002f){if(_0x4b002f){return _0x4b002f[_0xc008('0x12d')](_0x651201[_0xc008('0x6b')][_0xc008('0x79')],_[_0xc008('0xfa')](_0x651201[_0xc008('0x6b')],[_0xc008('0x79'),'id'])||{})['spread'](function(_0x2f0c37){for(var _0x893638=0x0;_0x893638<_0x651201[_0xc008('0x6b')][_0xc008('0x79')][_0xc008('0x54')];_0x893638+=0x1){socket[_0xc008('0x12e')](_0xc008('0x12f'),{'UserId':Number(_0x651201[_0xc008('0x6b')][_0xc008('0x79')][_0x893638]),'ChatWebsiteId':Number(_0x651201['params']['id'])});}return _0x2f0c37;});}})[_0xc008('0x2b')](respondWithResult(_0x1a363a,null))[_0xc008('0x1f')](handleError(_0x1a363a,null));};exports[_0xc008('0x130')]=function(_0x53153b,_0x198ae4){return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x53153b[_0xc008('0x60')]['id']}})['then'](handleEntityNotFound(_0x198ae4,null))['then'](function(_0x293ec3){if(_0x293ec3){return _0x293ec3[_0xc008('0x130')](_0x53153b['query'][_0xc008('0x79')])['then'](function(){if(_[_0xc008('0x131')](_0x53153b['query'][_0xc008('0x79')])){for(var _0x4b1c77=0x0;_0x4b1c77<_0x53153b[_0xc008('0x53')][_0xc008('0x79')][_0xc008('0x54')];_0x4b1c77+=0x1){socket[_0xc008('0x12e')](_0xc008('0x132'),{'UserId':Number(_0x53153b[_0xc008('0x53')]['ids'][_0x4b1c77]),'ChatWebsiteId':Number(_0x53153b['params']['id'])});}}else{socket[_0xc008('0x12e')](_0xc008('0x132'),{'UserId':Number(_0x53153b['query']['ids']),'ChatWebsiteId':Number(_0x53153b['params']['id'])});}});}})[_0xc008('0x2b')](respondWithStatusCode(_0x198ae4,null))[_0xc008('0x1f')](handleError(_0x198ae4,null));};exports[_0xc008('0x133')]=function(_0x3ed206,_0x9a4217){var _0x141500={};var _0x5619f1={};var _0x5373db;var _0x2fae6e;return db[_0xc008('0x5d')][_0xc008('0x75')]({'where':{'id':_0x3ed206[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x9a4217,null))['then'](function(_0x275df7){if(_0x275df7){_0x5373db=_0x275df7;_0x5619f1[_0xc008('0x43')]=_['keys'](db[_0xc008('0xfd')][_0xc008('0x4b')]);_0x5619f1[_0xc008('0x53')]=_[_0xc008('0x61')](_0x3ed206[_0xc008('0x53')]);_0x5619f1['filters']=_[_0xc008('0x50')](_0x5619f1[_0xc008('0x43')],_0x5619f1['query']);_0x141500[_0xc008('0x51')]=_[_0xc008('0x50')](_0x5619f1['model'],qs[_0xc008('0x52')](_0x3ed206[_0xc008('0x53')][_0xc008('0x52')]));_0x141500['attributes']=_0x141500[_0xc008('0x51')][_0xc008('0x54')]?_0x141500[_0xc008('0x51')]:_0x5619f1[_0xc008('0x43')];_0x141500[_0xc008('0x56')]=qs[_0xc008('0x57')](_0x3ed206[_0xc008('0x53')][_0xc008('0x57')]);_0x141500['where']=qs[_0xc008('0x4f')](_[_0xc008('0x58')](_0x3ed206[_0xc008('0x53')],_0x5619f1[_0xc008('0x4f')]));if(_0x3ed206['query'][_0xc008('0x59')]){_0x141500['where']=_['merge'](_0x141500[_0xc008('0x5a')],{'$or':_['map'](_0x141500[_0xc008('0x51')],function(_0x1ca910){var _0x3385db={};_0x3385db[_0x1ca910]={'$like':'%'+_0x3ed206[_0xc008('0x53')][_0xc008('0x59')]+'%'};return _0x3385db;})});}_0x141500=_['merge']({},_0x141500,_0x3ed206[_0xc008('0x5c')]);return _0x5373db[_0xc008('0x133')](_0x141500);}})[_0xc008('0x2b')](function(_0x53e845){if(_0x53e845){_0x2fae6e=_0x53e845[_0xc008('0x54')];if(!_0x3ed206[_0xc008('0x53')][_0xc008('0x55')](_0xc008('0x76'))){_0x141500['limit']=qs[_0xc008('0x25')](_0x3ed206[_0xc008('0x53')][_0xc008('0x25')]);_0x141500[_0xc008('0x23')]=qs['offset'](_0x3ed206[_0xc008('0x53')][_0xc008('0x23')]);}return _0x5373db['getAgents'](_0x141500);}})[_0xc008('0x2b')](function(_0x59ef4a){if(_0x59ef4a){return _0x59ef4a?{'count':_0x2fae6e,'rows':_0x59ef4a}:null;}})['then'](respondWithResult(_0x9a4217,null))['catch'](handleError(_0x9a4217,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 2ced5ca..c5d0830 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 _0x23ea=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x23ea,0xc3));var _0xa23e=function(_0x102243,_0x2b4dde){_0x102243=_0x102243-0x0;var _0x1d302c=_0x23ea[_0x102243];return _0x1d302c;};'use strict';var EventEmitter=require(_0xa23e('0x0'));var ChatWebsite=require(_0xa23e('0x1'))['db'][_0xa23e('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa23e('0x3')](0x0);var events={'afterCreate':_0xa23e('0x4'),'afterUpdate':_0xa23e('0x5'),'afterDestroy':_0xa23e('0x6')};function emitEvent(_0x3428d6){return function(_0xf8cea8,_0x441b2e,_0x6f7d68){ChatWebsiteEvents['emit'](_0x3428d6+':'+_0xf8cea8['id'],_0xf8cea8);ChatWebsiteEvents[_0xa23e('0x7')](_0x3428d6,_0xf8cea8);_0x6f7d68(null);};}for(var e in events){if(events[_0xa23e('0x8')](e)){var event=events[e];ChatWebsite[_0xa23e('0x9')](e,emitEvent(event));}}module[_0xa23e('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0xa991=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xa991,0x143));var _0x1a99=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xa991[_0x2064e5];return _0x21a233;};'use strict';var EventEmitter=require(_0x1a99('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x1a99('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1a99('0x2')](0x0);var events={'afterCreate':_0x1a99('0x3'),'afterUpdate':_0x1a99('0x4'),'afterDestroy':_0x1a99('0x5')};function emitEvent(_0x577db5){return function(_0x46c8c4,_0x1fe48a,_0x118756){ChatWebsiteEvents[_0x1a99('0x6')](_0x577db5+':'+_0x46c8c4['id'],_0x46c8c4);ChatWebsiteEvents[_0x1a99('0x6')](_0x577db5,_0x46c8c4);_0x118756(null);};}for(var e in events){if(events[_0x1a99('0x7')](e)){var event=events[e];ChatWebsite[_0x1a99('0x8')](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 f9ce3cb..320db48 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 _0x6a85=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','chat_websites'];(function(_0x140988,_0x38385e){var _0x484d71=function(_0x484aba){while(--_0x484aba){_0x140988['push'](_0x140988['shift']());}};_0x484d71(++_0x38385e);}(_0x6a85,0x1d4));var _0x56a8=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x6a85[_0x571c1d];return _0x33c609;};'use strict';var _=require('lodash');var util=require(_0x56a8('0x0'));var logger=require(_0x56a8('0x1'))('api');var moment=require(_0x56a8('0x2'));var BPromise=require(_0x56a8('0x3'));var rp=require(_0x56a8('0x4'));var fs=require('fs');var path=require(_0x56a8('0x5'));var rimraf=require(_0x56a8('0x6'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x384989,_0x2ba634){return _0x384989[_0x56a8('0x7')]('ChatWebsite',attributes,{'tableName':_0x56a8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x037f=['bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','../../config/logger','api'];(function(_0x140e7f,_0x5f50a7){var _0x39656b=function(_0xd5f5d7){while(--_0xd5f5d7){_0x140e7f['push'](_0x140e7f['shift']());}};_0x39656b(++_0x5f50a7);}(_0x037f,0x1ab));var _0xf037=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x037f[_0x90a39a];return _0x2b62f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf037('0x0'))(_0xf037('0x1'));var moment=require('moment');var BPromise=require(_0xf037('0x2'));var rp=require(_0xf037('0x3'));var fs=require('fs');var path=require(_0xf037('0x4'));var rimraf=require(_0xf037('0x5'));var config=require('../../config/environment');var attributes=require(_0xf037('0x6'));module[_0xf037('0x7')]=function(_0x3d61f1,_0x4b3589){return _0x3d61f1[_0xf037('0x8')](_0xf037('0x9'),attributes,{'tableName':_0xf037('0xa'),'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 d48c9b2..9647828 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 _0x9764=['request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x249ce7,_0xbe8447){var _0x328a18=function(_0x309e3b){while(--_0x309e3b){_0x249ce7['push'](_0x249ce7['shift']());}};_0x328a18(++_0xbe8447);}(_0x9764,0x7a));var _0x4976=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9764[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4976('0x0'));var moment=require(_0x4976('0x1'));var BPromise=require(_0x4976('0x2'));var rs=require(_0x4976('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4976('0x4'));var logger=require('../../config/logger')(_0x4976('0x5'));var config=require(_0x4976('0x6'));var jayson=require(_0x4976('0x7'));var client=jayson['client'][_0x4976('0x8')]({'port':0x232a});config[_0x4976('0x9')]=_['defaults'](config[_0x4976('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4976('0xa'))(new Redis(config[_0x4976('0x9')]));require(_0x4976('0xb'))['register'](socket);function respondWithRpcPromise(_0x475271,_0x39b418,_0x1213de){return new BPromise(function(_0x44e164,_0x393141){return client[_0x4976('0xc')](_0x475271,_0x1213de)[_0x4976('0xd')](function(_0x4d7374){logger[_0x4976('0xe')](_0x4976('0xf'),_0x39b418,_0x4976('0x10'));logger[_0x4976('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x39b418,_0x4976('0x10'),JSON[_0x4976('0x12')](_0x4d7374));if(_0x4d7374[_0x4976('0x13')]){if(_0x4d7374[_0x4976('0x13')][_0x4976('0x14')]===0x1f4){logger[_0x4976('0x13')](_0x4976('0xf'),_0x39b418,_0x4d7374[_0x4976('0x13')][_0x4976('0x15')]);return _0x393141(_0x4d7374[_0x4976('0x13')][_0x4976('0x15')]);}logger[_0x4976('0x13')](_0x4976('0xf'),_0x39b418,_0x4d7374[_0x4976('0x13')]['message']);return _0x44e164(_0x4d7374[_0x4976('0x13')][_0x4976('0x15')]);}else{logger['info'](_0x4976('0xf'),_0x39b418,_0x4976('0x10'));_0x44e164(_0x4d7374['result'][_0x4976('0x15')]);}})[_0x4976('0x16')](function(_0x4ec887){logger[_0x4976('0x13')](_0x4976('0xf'),_0x39b418,_0x4ec887);_0x393141(_0x4ec887);});});} \ No newline at end of file +var _0xdce7=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4e9e00,_0x157820){var _0x201de0=function(_0x3217d5){while(--_0x3217d5){_0x4e9e00['push'](_0x4e9e00['shift']());}};_0x201de0(++_0x157820);}(_0xdce7,0xaa));var _0x7dce=function(_0x15a3a4,_0x524046){_0x15a3a4=_0x15a3a4-0x0;var _0x248605=_0xdce7[_0x15a3a4];return _0x248605;};'use strict';var _=require('lodash');var util=require(_0x7dce('0x0'));var moment=require(_0x7dce('0x1'));var BPromise=require(_0x7dce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dce('0x3'));var db=require(_0x7dce('0x4'))['db'];var utils=require(_0x7dce('0x5'));var logger=require(_0x7dce('0x6'))(_0x7dce('0x7'));var config=require(_0x7dce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7dce('0x9')][_0x7dce('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7dce('0xb')],{'host':_0x7dce('0xc'),'port':0x18eb});var socket=require(_0x7dce('0xd'))(new Redis(config[_0x7dce('0xb')]));require(_0x7dce('0xe'))['register'](socket);function respondWithRpcPromise(_0x4efaf1,_0x501c40,_0x4d292a){return new BPromise(function(_0x55ca99,_0x7ced39){return client[_0x7dce('0xf')](_0x4efaf1,_0x4d292a)['then'](function(_0x26c725){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x501c40,'request\x20sent');logger[_0x7dce('0x10')](_0x7dce('0x11'),_0x501c40,_0x7dce('0x12'),JSON[_0x7dce('0x13')](_0x26c725));if(_0x26c725['error']){if(_0x26c725[_0x7dce('0x14')]['code']===0x1f4){logger[_0x7dce('0x14')](_0x7dce('0x15'),_0x501c40,_0x26c725[_0x7dce('0x14')][_0x7dce('0x16')]);return _0x7ced39(_0x26c725[_0x7dce('0x14')][_0x7dce('0x16')]);}logger[_0x7dce('0x14')](_0x7dce('0x15'),_0x501c40,_0x26c725['error'][_0x7dce('0x16')]);return _0x55ca99(_0x26c725['error'][_0x7dce('0x16')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x501c40,_0x7dce('0x12'));_0x55ca99(_0x26c725[_0x7dce('0x17')]['message']);}})[_0x7dce('0x18')](function(_0x934d53){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x501c40,_0x934d53);_0x7ced39(_0x934d53);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c1ea8d3..68de689 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 _0x3bd9=['emit','removeListener','register','length','./chatWebsite.events','save','update'];(function(_0x6a58aa,_0x4af448){var _0x211cac=function(_0x49fcad){while(--_0x49fcad){_0x6a58aa['push'](_0x6a58aa['shift']());}};_0x211cac(++_0x4af448);}(_0x3bd9,0x115));var _0x93bd=function(_0x3ce6c6,_0x501ff8){_0x3ce6c6=_0x3ce6c6-0x0;var _0x46091f=_0x3bd9[_0x3ce6c6];return _0x46091f;};'use strict';var ChatWebsiteEvents=require(_0x93bd('0x0'));var events=[_0x93bd('0x1'),'remove',_0x93bd('0x2')];function createListener(_0x382191,_0x10cadd){return function(_0x1a1268){_0x10cadd[_0x93bd('0x3')](_0x382191,_0x1a1268);};}function removeListener(_0x4bbd88,_0x5277ba){return function(){ChatWebsiteEvents[_0x93bd('0x4')](_0x4bbd88,_0x5277ba);};}exports[_0x93bd('0x5')]=function(_0x26448d){for(var _0x184d03=0x0,_0x19832a=events[_0x93bd('0x6')];_0x184d03<_0x19832a;_0x184d03++){var _0x1fafce=events[_0x184d03];var _0x3de69a=createListener('chatWebsite:'+_0x1fafce,_0x26448d);ChatWebsiteEvents['on'](_0x1fafce,_0x3de69a);}}; \ No newline at end of file +var _0x1cb4=['emit','removeListener','chatWebsite:','./chatWebsite.events','save'];(function(_0x2a5755,_0x17f587){var _0x1700da=function(_0x40c908){while(--_0x40c908){_0x2a5755['push'](_0x2a5755['shift']());}};_0x1700da(++_0x17f587);}(_0x1cb4,0xb2));var _0x41cb=function(_0x584342,_0x2159a0){_0x584342=_0x584342-0x0;var _0x3cca99=_0x1cb4[_0x584342];return _0x3cca99;};'use strict';var ChatWebsiteEvents=require(_0x41cb('0x0'));var events=[_0x41cb('0x1'),'remove','update'];function createListener(_0x593865,_0x258ff4){return function(_0x432627){_0x258ff4[_0x41cb('0x2')](_0x593865,_0x432627);};}function removeListener(_0x5b0363,_0x4ced44){return function(){ChatWebsiteEvents[_0x41cb('0x3')](_0x5b0363,_0x4ced44);};}exports['register']=function(_0x2502fd){for(var _0x4ec3c7=0x0,_0x3e52a6=events['length'];_0x4ec3c7<_0x3e52a6;_0x4ec3c7++){var _0x2fbd07=events[_0x4ec3c7];var _0x4fb8f4=createListener(_0x41cb('0x4')+_0x2fbd07,_0x2502fd);ChatWebsiteEvents['on'](_0x2fbd07,_0x4fb8f4);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index ddecc97..9c6cca9 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x543b=['replace','test','trim','([\x5cw]+)','localhost','../../../utils/misc','escapeRegExp','url'];(function(_0x461739,_0x19e3ab){var _0xab4001=function(_0x51f7f1){while(--_0x51f7f1){_0x461739['push'](_0x461739['shift']());}};_0xab4001(++_0x19e3ab);}(_0x543b,0x18d));var _0xb543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x543b[_0x14add3];return _0x4a174f;};var escapeRegExp=require(_0xb543('0x0'))[_0xb543('0x1')];var URL=require(_0xb543('0x2'))['URL'];function testWildcardValidity(_0x39e803){var _0xf1e971=!![];try{new URL(_0x39e803[_0xb543('0x3')]('*','localhost'));}catch(_0x3a0e39){_0xf1e971=![];}return _0xf1e971&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xb543('0x4')](_0x39e803);}function testWebsiteWithWildcard(_0x33e1db,_0x1e12d3){var _0x29c539;var _0x35ebbf=escapeRegExp(_0x33e1db[_0xb543('0x5')]()[_0xb543('0x3')](/\/$/,''))[_0xb543('0x3')]('\x5c*',_0xb543('0x6'));try{new URL(_0x33e1db[_0xb543('0x3')]('\x5c*',_0xb543('0x7')));_0x29c539=new RegExp(_0x35ebbf)['test'](_0x1e12d3);}catch(_0xa94776){_0x29c539=![];}return _0x29c539;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xa498=['escapeRegExp','url','localhost','test','trim','([\x5cw]+)','replace','exports','../../../utils/misc'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0xa498,0x179));var _0x8a49=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0xa498[_0x280ae7];return _0x418b9e;};var escapeRegExp=require(_0x8a49('0x0'))[_0x8a49('0x1')];var URL=require(_0x8a49('0x2'))['URL'];function testWildcardValidity(_0x35e092){var _0x3c8f12=!![];try{new URL(_0x35e092['replace']('*',_0x8a49('0x3')));}catch(_0x4630fe){_0x3c8f12=![];}return _0x3c8f12&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x8a49('0x4')](_0x35e092);}function testWebsiteWithWildcard(_0x2e7948,_0x17d85c){var _0x35a826;var _0x580bd3=escapeRegExp(_0x2e7948[_0x8a49('0x5')]()['replace'](/\/$/,''))['replace']('\x5c*',_0x8a49('0x6'));try{new URL(_0x2e7948[_0x8a49('0x7')]('\x5c*',_0x8a49('0x3')));_0x35a826=new RegExp(_0x580bd3)[_0x8a49('0x4')](_0x17d85c);}catch(_0x26ee03){_0x35a826=![];}return _0x35a826;}module[_0x8a49('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 2a6fe96..d6e51e6 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 _0x9457=['/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','addDisposition','addAnswer','join','root','format','%s-%s','now','originalname','post','single','file','addAvatar','diskStorage','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated'];(function(_0x5eaf39,_0x358e22){var _0xc6da0=function(_0x485c2f){while(--_0x485c2f){_0x5eaf39['push'](_0x5eaf39['shift']());}};_0xc6da0(++_0x358e22);}(_0x9457,0x85));var _0x7945=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9457[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7945('0x0'));var util=require(_0x7945('0x1'));var path=require(_0x7945('0x2'));var timeout=require(_0x7945('0x3'));var express=require(_0x7945('0x4'));var router=express[_0x7945('0x5')]();var fs_extra=require(_0x7945('0x6'));var auth=require(_0x7945('0x7'));var interaction=require(_0x7945('0x8'));var config=require(_0x7945('0x9'));var controller=require(_0x7945('0xa'));router[_0x7945('0xb')]('/',auth[_0x7945('0xc')](),controller['index']);router[_0x7945('0xb')](_0x7945('0xd'),auth[_0x7945('0xc')](),controller[_0x7945('0xe')]);router[_0x7945('0xb')]('/:id',auth[_0x7945('0xc')](),controller[_0x7945('0xf')]);router[_0x7945('0xb')](_0x7945('0x10'),auth[_0x7945('0xc')](),controller[_0x7945('0x11')]);router['get'](_0x7945('0x12'),auth[_0x7945('0xc')](),controller[_0x7945('0x13')]);router['get'](_0x7945('0x14'),controller[_0x7945('0x15')]);router['get'](_0x7945('0x16'),controller[_0x7945('0x17')]);router[_0x7945('0xb')]('/:id/customer_avatar',controller[_0x7945('0x18')]);router['get'](_0x7945('0x19'),controller[_0x7945('0x1a')]);router[_0x7945('0xb')](_0x7945('0x1b'),auth[_0x7945('0xc')](),controller[_0x7945('0x1c')]);router['get']('/:id/snippet',controller[_0x7945('0x1d')]);router[_0x7945('0xb')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x7945('0x1e'),auth['isAuthenticated'](),controller[_0x7945('0x1f')]);router[_0x7945('0xb')](_0x7945('0x20'),controller[_0x7945('0x21')]);router[_0x7945('0xb')](_0x7945('0x22'),auth['isAuthenticated'](),controller[_0x7945('0x23')]);router[_0x7945('0xb')](_0x7945('0x24'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x7945('0xc')](),controller['create']);router['post'](_0x7945('0x10'),auth[_0x7945('0xc')](),controller[_0x7945('0x25')]);router['post']('/:id/canned_answers',auth[_0x7945('0xc')](),controller[_0x7945('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x146b84,_0x1fd699,_0x2252a){_0x2252a(null,path[_0x7945('0x27')](config[_0x7945('0x28')],'server/files/images/logos/'));},'filename':function(_0x27e39b,_0x322cca,_0x50d97d){_0x50d97d(null,util[_0x7945('0x29')](_0x7945('0x2a'),Date[_0x7945('0x2b')](),_0x322cca[_0x7945('0x2c')]));}})});router[_0x7945('0x2d')](_0x7945('0x14'),upload[_0x7945('0x2e')]('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x483fce,_0x276791,_0x1c8c03){_0x1c8c03(null,path[_0x7945('0x27')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x15fea4,_0x46fbe2,_0x34ae10){_0x34ae10(null,util[_0x7945('0x29')]('%s-%s',Date[_0x7945('0x2b')](),_0x46fbe2['originalname']));}})});router[_0x7945('0x2d')]('/:id/avatar',upload['single'](_0x7945('0x2f')),controller[_0x7945('0x30')]);var upload=multer({'storage':multer[_0x7945('0x31')]({'destination':function(_0x95b899,_0x51b1e5,_0x4a7333){_0x4a7333(null,path[_0x7945('0x27')](config[_0x7945('0x28')],'server/files/images/avatars/'));},'filename':function(_0x11f464,_0xad6059,_0x4a4819){_0x4a4819(null,util[_0x7945('0x29')]('%s-%s',Date['now'](),_0xad6059[_0x7945('0x2c')]));}})});router['post'](_0x7945('0x32'),upload['single'](_0x7945('0x2f')),controller[_0x7945('0x33')]);var upload=multer({'storage':multer[_0x7945('0x31')]({'destination':function(_0x21b950,_0x360242,_0x240a68){_0x240a68(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x1a6873,_0x5acb2d,_0x4fb240){_0x4fb240(null,util[_0x7945('0x29')](_0x7945('0x2a'),Date[_0x7945('0x2b')](),_0x5acb2d[_0x7945('0x2c')]));}})});router['post'](_0x7945('0x19'),upload[_0x7945('0x2e')](_0x7945('0x2f')),controller[_0x7945('0x34')]);router['post']('/:id/notify',controller[_0x7945('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x7945('0x31')]({'destination':function(_0x471195,_0x14473a,_0x35fcf7){const _0xd28e1d=path['join'](config[_0x7945('0x28')],_0x7945('0x36'),_0x7945('0x37'),_0x7945('0x38'));fs_extra[_0x7945('0x39')](_0xd28e1d,function(){_0x35fcf7(null,_0xd28e1d);});},'filename':function(_0x50b516,_0x1fa589,_0x5f34a6){const _0x4832b8=_0x1fa589[_0x7945('0x2c')][_0x7945('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x522a46=path[_0x7945('0x3b')](_0x4832b8);const _0x54f6d2=Date[_0x7945('0x2b')]()+'-'+_0x4832b8['replace'](_0x522a46,'')+_0x522a46;_0x5f34a6(null,_0x54f6d2);}})});router['post'](_0x7945('0x3c'),offlineUploadMulter[_0x7945('0x3d')](),controller[_0x7945('0x3e')]);router[_0x7945('0x2d')](_0x7945('0x1b'),auth[_0x7945('0xc')](),controller[_0x7945('0x3f')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x7945('0x40')]);router[_0x7945('0x2d')]('/:id/proactive_actions',auth[_0x7945('0xc')](),controller[_0x7945('0x41')]);router[_0x7945('0x2d')](_0x7945('0x24'),auth[_0x7945('0xc')](),controller['addAgents']);router['put'](_0x7945('0x42'),auth[_0x7945('0xc')](),controller[_0x7945('0x43')]);router[_0x7945('0x44')]('/:id',auth[_0x7945('0xc')](),controller['destroy']);router[_0x7945('0x44')](_0x7945('0x10'),auth['isAuthenticated'](),controller[_0x7945('0x45')]);router[_0x7945('0x44')](_0x7945('0x12'),auth[_0x7945('0xc')](),controller[_0x7945('0x46')]);router[_0x7945('0x44')](_0x7945('0x24'),auth[_0x7945('0xc')](),controller[_0x7945('0x47')]);module[_0x7945('0x48')]=router; \ No newline at end of file +var _0x91b0=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/users','create','post','addDisposition','addAnswer','diskStorage','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','addAvatar','root','addCustomerAvatar','join','server/files/images/avatars/','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','/:id/offline','any','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeAnswers','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show'];(function(_0x3fd89f,_0x5d2f5e){var _0x1f2af8=function(_0x14c264){while(--_0x14c264){_0x3fd89f['push'](_0x3fd89f['shift']());}};_0x1f2af8(++_0x5d2f5e);}(_0x91b0,0x1c9));var _0x091b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x91b0[_0x5783f4];return _0x28e380;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x091b('0x0'));var timeout=require(_0x091b('0x1'));var express=require(_0x091b('0x2'));var router=express[_0x091b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x091b('0x4'));var interaction=require(_0x091b('0x5'));var config=require(_0x091b('0x6'));var controller=require('./chatWebsite.controller');router[_0x091b('0x7')]('/',auth['isAuthenticated'](),controller[_0x091b('0x8')]);router[_0x091b('0x7')]('/describe',auth[_0x091b('0x9')](),controller['describe']);router[_0x091b('0x7')](_0x091b('0xa'),auth[_0x091b('0x9')](),controller[_0x091b('0xb')]);router[_0x091b('0x7')](_0x091b('0xc'),auth['isAuthenticated'](),controller[_0x091b('0xd')]);router[_0x091b('0x7')](_0x091b('0xe'),auth[_0x091b('0x9')](),controller[_0x091b('0xf')]);router[_0x091b('0x7')](_0x091b('0x10'),controller[_0x091b('0x11')]);router[_0x091b('0x7')](_0x091b('0x12'),controller['getAvatar']);router['get'](_0x091b('0x13'),controller[_0x091b('0x14')]);router['get']('/:id/system_avatar',controller['getSystemAvatar']);router[_0x091b('0x7')](_0x091b('0x15'),auth[_0x091b('0x9')](),controller[_0x091b('0x16')]);router[_0x091b('0x7')](_0x091b('0x17'),controller[_0x091b('0x18')]);router[_0x091b('0x7')](_0x091b('0x19'),auth[_0x091b('0x9')](),controller[_0x091b('0x1a')]);router[_0x091b('0x7')](_0x091b('0x1b'),auth[_0x091b('0x9')](),controller[_0x091b('0x1c')]);router['get'](_0x091b('0x1d'),controller['getFields']);router[_0x091b('0x7')]('/:id/offline_messages',auth[_0x091b('0x9')](),controller['getOfflineMessages']);router[_0x091b('0x7')](_0x091b('0x1e'),auth[_0x091b('0x9')](),controller['getAgents']);router['post']('/',auth[_0x091b('0x9')](),controller[_0x091b('0x1f')]);router[_0x091b('0x20')](_0x091b('0xc'),auth[_0x091b('0x9')](),controller[_0x091b('0x21')]);router[_0x091b('0x20')]('/:id/canned_answers',auth[_0x091b('0x9')](),controller[_0x091b('0x22')]);var upload=multer({'storage':multer[_0x091b('0x23')]({'destination':function(_0x1869d2,_0x40d567,_0x7c0556){_0x7c0556(null,path['join'](config['root'],_0x091b('0x24')));},'filename':function(_0x1d0b6a,_0x367a47,_0xf7faa){_0xf7faa(null,util[_0x091b('0x25')](_0x091b('0x26'),Date[_0x091b('0x27')](),_0x367a47[_0x091b('0x28')]));}})});router[_0x091b('0x20')](_0x091b('0x10'),upload[_0x091b('0x29')](_0x091b('0x2a')),controller[_0x091b('0x2b')]);var upload=multer({'storage':multer[_0x091b('0x23')]({'destination':function(_0x149a99,_0x378d10,_0x2151e8){_0x2151e8(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x4c3c1e,_0x5089e1,_0x455ce5){_0x455ce5(null,util['format'](_0x091b('0x26'),Date[_0x091b('0x27')](),_0x5089e1['originalname']));}})});router[_0x091b('0x20')](_0x091b('0x12'),upload['single'](_0x091b('0x2a')),controller[_0x091b('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13c2d3,_0x526ea9,_0x3f9d6a){_0x3f9d6a(null,path['join'](config[_0x091b('0x2d')],'server/files/images/avatars/'));},'filename':function(_0x1e80a1,_0x422986,_0x718cc9){_0x718cc9(null,util[_0x091b('0x25')](_0x091b('0x26'),Date[_0x091b('0x27')](),_0x422986[_0x091b('0x28')]));}})});router[_0x091b('0x20')]('/:id/customer_avatar',upload['single'](_0x091b('0x2a')),controller[_0x091b('0x2e')]);var upload=multer({'storage':multer[_0x091b('0x23')]({'destination':function(_0x2f1d3a,_0x515761,_0x425fb6){_0x425fb6(null,path[_0x091b('0x2f')](config['root'],_0x091b('0x30')));},'filename':function(_0x22fffb,_0x377f76,_0x4e143b){_0x4e143b(null,util['format']('%s-%s',Date[_0x091b('0x27')](),_0x377f76['originalname']));}})});router['post'](_0x091b('0x31'),upload[_0x091b('0x29')](_0x091b('0x2a')),controller[_0x091b('0x32')]);router['post'](_0x091b('0x33'),controller[_0x091b('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x091b('0x23')]({'destination':function(_0x41fea6,_0x2b58b8,_0x481c5a){const _0x1f24c7=path['join'](config[_0x091b('0x2d')],_0x091b('0x35'),'attachments',_0x091b('0x36'));fs_extra[_0x091b('0x37')](_0x1f24c7,function(){_0x481c5a(null,_0x1f24c7);});},'filename':function(_0x1376a3,_0x53d4b3,_0x1bde22){const _0x45e208=_0x53d4b3[_0x091b('0x28')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x472738=path['extname'](_0x45e208);const _0x48479e=Date['now']()+'-'+_0x45e208['replace'](_0x472738,'')+_0x472738;_0x1bde22(null,_0x48479e);}})});router[_0x091b('0x20')](_0x091b('0x38'),offlineUploadMulter[_0x091b('0x39')](),controller['offline']);router[_0x091b('0x20')](_0x091b('0x15'),auth[_0x091b('0x9')](),controller[_0x091b('0x3a')]);router[_0x091b('0x20')](_0x091b('0x19'),auth[_0x091b('0x9')](),controller[_0x091b('0x3b')]);router[_0x091b('0x20')](_0x091b('0x1b'),auth[_0x091b('0x9')](),controller[_0x091b('0x3c')]);router['post'](_0x091b('0x1e'),auth['isAuthenticated'](),controller[_0x091b('0x3d')]);router[_0x091b('0x3e')](_0x091b('0xa'),auth[_0x091b('0x9')](),controller[_0x091b('0x3f')]);router[_0x091b('0x40')](_0x091b('0xa'),auth[_0x091b('0x9')](),controller['destroy']);router['delete'](_0x091b('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x091b('0xe'),auth['isAuthenticated'](),controller[_0x091b('0x41')]);router[_0x091b('0x40')](_0x091b('0x1e'),auth[_0x091b('0x9')](),controller['removeAgents']);module[_0x091b('0x42')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 2d12dbc..41ed696 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 _0x98e6=['use','exports','../components/auth/service','../config/environment','Router','env','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x98e6,0x1c4));var _0x698e=function(_0x5f10a4,_0x539da9){_0x5f10a4=_0x5f10a4-0x0;var _0x2fad68=_0x98e6[_0x5f10a4];return _0x2fad68;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0x698e('0x0'));var config=require(_0x698e('0x1'));var router=express[_0x698e('0x2')]();var isProduction=config[_0x698e('0x3')]==='production'||![];function clientSideLogs(_0xb177ce,_0x2172db,_0x557562){var _0x465821=_0xb177ce[_0x698e('0x4')]['get'](_0x698e('0x5'));if(!_0x465821){throw new Error(_0x698e('0x6'));}return beaverLogger['expressEndpoint']({'uri':_0x698e('0x7'),'logger':_0x465821,'enableCors':!isProduction})(_0xb177ce,_0x2172db,_0x557562);}router[_0x698e('0x8')](auth['isAuthenticated'](),clientSideLogs);module[_0x698e('0x9')]=router; \ No newline at end of file +var _0x3b0f=['get','expressEndpoint','use','isAuthenticated','exports','express','../components/auth/service','Router','env','production','app'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x3b0f,0x1c8));var _0xf3b0=function(_0x3a02dd,_0x52392b){_0x3a02dd=_0x3a02dd-0x0;var _0x5988e8=_0x3b0f[_0x3a02dd];return _0x5988e8;};var beaverLogger=require('beaver-logger/server');var express=require(_0xf3b0('0x0'));var auth=require(_0xf3b0('0x1'));var config=require('../config/environment');var router=express[_0xf3b0('0x2')]();var isProduction=config[_0xf3b0('0x3')]===_0xf3b0('0x4')||![];function clientSideLogs(_0x51c85f,_0x119015,_0x544f32){var _0x4f27ef=_0x51c85f[_0xf3b0('0x5')][_0xf3b0('0x6')]('client-side-logger');if(!_0x4f27ef){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xf3b0('0x7')]({'uri':'/client-logs','logger':_0x4f27ef,'enableCors':!isProduction})(_0x51c85f,_0x119015,_0x544f32);}router[_0xf3b0('0x8')](auth[_0xf3b0('0x9')](),clientSideLogs);module[_0xf3b0('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 19ce703..c845aca 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 _0x82cb=['MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT'];(function(_0x126f83,_0x2e5e98){var _0x5c819e=function(_0x43e964){while(--_0x43e964){_0x126f83['push'](_0x126f83['shift']());}};_0x5c819e(++_0x2e5e98);}(_0x82cb,0xc3));var _0xb82c=function(_0x37b66a,_0x194701){_0x37b66a=_0x37b66a-0x0;var _0x28e521=_0x82cb[_0x37b66a];return _0x28e521;};'use strict';var Sequelize=require(_0xb82c('0x0'));module[_0xb82c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb82c('0x2')](_0xb82c('0x3'),_0xb82c('0x4'),_0xb82c('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xb82c('0x2')](_0xb82c('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0xb82c('0x7')],'comment':_0xb82c('0x8')},'data2':{'type':Sequelize[_0xb82c('0x7')],'comment':_0xb82c('0x9')},'data3':{'type':Sequelize[_0xb82c('0x7')],'comment':_0xb82c('0xa')},'data4':{'type':Sequelize['STRING'],'comment':_0xb82c('0xb')},'data5':{'type':Sequelize[_0xb82c('0xc')],'comment':_0xb82c('0xd')},'data6':{'type':Sequelize[_0xb82c('0xc')],'comment':_0xb82c('0xe')},'data7':{'type':Sequelize[_0xb82c('0xc')],'comment':_0xb82c('0xf')}}; \ No newline at end of file +var _0xdf09=['TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xdf09,0x185));var _0x9df0=function(_0x3307ab,_0x4ecbda){_0x3307ab=_0x3307ab-0x0;var _0x1ee655=_0xdf09[_0x3307ab];return _0x1ee655;};'use strict';var Sequelize=require(_0x9df0('0x0'));module['exports']={'name':{'type':Sequelize[_0x9df0('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9df0('0x2')](_0x9df0('0x3'),'Google',_0x9df0('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x9df0('0x2')](_0x9df0('0x5'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x9df0('0x1')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x9df0('0x1')],'comment':_0x9df0('0x6')},'data4':{'type':Sequelize[_0x9df0('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x9df0('0x7')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x9df0('0x7')],'comment':_0x9df0('0x8')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 1098c1a..2defbcb 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 _0x7f24=['find','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/encryptor','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','padEnd','slice','index','CloudProvider','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','create','body','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString'];(function(_0x4e9d00,_0x2bdcc5){var _0x5771f4=function(_0x1f8541){while(--_0x1f8541){_0x4e9d00['push'](_0x4e9d00['shift']());}};_0x5771f4(++_0x2bdcc5);}(_0x7f24,0x197));var _0x47f2=function(_0x5c8a11,_0x10805f){_0x5c8a11=_0x5c8a11-0x0;var _0x116b22=_0x7f24[_0x5c8a11];return _0x116b22;};'use strict';var _=require(_0x47f2('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x47f2('0x1'));var config=require('../../config/environment');var logger=require(_0x47f2('0x2'))(_0x47f2('0x3'));var db=require('../../mysqldb')['db'];var oauth=require(_0x47f2('0x4'));config[_0x47f2('0x5')]=_[_0x47f2('0x6')](config[_0x47f2('0x5')],{'host':_0x47f2('0x7'),'port':0x18eb});var socket=require(_0x47f2('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0x47f2('0x5')]);function respondWithStatusCode(_0x4f53f3,_0x337244){_0x337244=_0x337244||0xcc;return function(_0x4ed042){if(_0x4ed042){return _0x4f53f3[_0x47f2('0x9')](_0x337244);}return _0x4f53f3[_0x47f2('0xa')](_0x337244)[_0x47f2('0xb')]();};}function respondWithResult(_0x65f1de,_0x24f28d){_0x24f28d=_0x24f28d||0xc8;return function(_0x7fa6cb){if(_0x7fa6cb){return _0x65f1de[_0x47f2('0xa')](_0x24f28d)[_0x47f2('0xc')](_0x7fa6cb);}};}function respondWithFilteredResult(_0x148730,_0x35a5e9){return function(_0x5eb4e1){if(_0x5eb4e1){var _0x361731=typeof _0x35a5e9[_0x47f2('0xd')]===_0x47f2('0xe')&&typeof _0x35a5e9['limit']==='undefined';var _0x12c117=_0x5eb4e1[_0x47f2('0xf')];var _0x56f95a=_0x361731?0x0:_0x35a5e9[_0x47f2('0xd')];var _0x33e4a3=_0x361731?_0x5eb4e1[_0x47f2('0xf')]:_0x35a5e9['offset']+_0x35a5e9[_0x47f2('0x10')];var _0x242c1f;if(_0x33e4a3>=_0x12c117){_0x33e4a3=_0x12c117;_0x242c1f=0xc8;}else{_0x242c1f=0xce;}_0x148730[_0x47f2('0xa')](_0x242c1f);return _0x148730[_0x47f2('0x11')](_0x47f2('0x12'),_0x56f95a+'-'+_0x33e4a3+'/'+_0x12c117)[_0x47f2('0xc')](_0x5eb4e1);}return null;};}function saveUpdates(_0x547bb9){return function(_0x15eb82){if(_0x15eb82){return _0x15eb82[_0x47f2('0x13')](_0x547bb9)[_0x47f2('0x14')](function(_0x20b0f5){return _0x20b0f5;});}return null;};}function removeEntity(_0x305974){return function(_0x259266){if(_0x259266){return _0x259266[_0x47f2('0x15')]()[_0x47f2('0x14')](function(){_0x305974[_0x47f2('0xa')](0xcc)[_0x47f2('0xb')]();});}};}function handleEntityNotFound(_0x1a1df5){return function(_0x121550){if(!_0x121550){_0x1a1df5[_0x47f2('0x9')](0x194);}return _0x121550;};}function handleError(_0x4de355,_0x46dfc1){_0x46dfc1=_0x46dfc1||0x1f4;return function(_0x5bb041){logger[_0x47f2('0x16')](_0x5bb041[_0x47f2('0x17')]);if(_0x5bb041[_0x47f2('0x18')]){delete _0x5bb041[_0x47f2('0x18')];}_0x4de355[_0x47f2('0xa')](_0x46dfc1)['send'](_0x5bb041);};}function maskClientSecret(_0x53eb2e){return _[_0x47f2('0x19')](_0x53eb2e[_0x47f2('0x1a')](0x0,0x3),0x14,'*');}exports[_0x47f2('0x1b')]=function(_0x37fe8a,_0x21c739){var _0x43b42a={},_0x14df2b={},_0x458d86={'count':0x0,'rows':[]};var _0x3b4429=_['map'](db[_0x47f2('0x1c')]['rawAttributes'],function(_0x406e9a){return{'name':_0x406e9a[_0x47f2('0x1d')],'type':_0x406e9a[_0x47f2('0x1e')][_0x47f2('0x1f')]};});_0x14df2b[_0x47f2('0x20')]=_[_0x47f2('0x21')](_0x3b4429,_0x47f2('0x18'));_0x14df2b[_0x47f2('0x22')]=_[_0x47f2('0x23')](_0x37fe8a[_0x47f2('0x22')]);_0x14df2b['filters']=_[_0x47f2('0x24')](_0x14df2b[_0x47f2('0x20')],_0x14df2b[_0x47f2('0x22')]);_0x43b42a[_0x47f2('0x25')]=_['intersection'](_0x14df2b[_0x47f2('0x20')],qs[_0x47f2('0x26')](_0x37fe8a[_0x47f2('0x22')][_0x47f2('0x26')]));_0x43b42a[_0x47f2('0x25')]=_0x43b42a['attributes'][_0x47f2('0x27')]?_0x43b42a['attributes']:_0x14df2b[_0x47f2('0x20')];if(!_0x37fe8a[_0x47f2('0x22')]['hasOwnProperty']('nolimit')){_0x43b42a[_0x47f2('0x10')]=qs['limit'](_0x37fe8a[_0x47f2('0x22')][_0x47f2('0x10')]);_0x43b42a[_0x47f2('0xd')]=qs['offset'](_0x37fe8a[_0x47f2('0x22')]['offset']);}_0x43b42a[_0x47f2('0x28')]=qs[_0x47f2('0x29')](_0x37fe8a[_0x47f2('0x22')][_0x47f2('0x29')]);_0x43b42a['where']=qs[_0x47f2('0x2a')](_[_0x47f2('0x2b')](_0x37fe8a[_0x47f2('0x22')],_0x14df2b['filters']),_0x3b4429);if(_0x37fe8a['query'][_0x47f2('0x2c')]){_0x43b42a[_0x47f2('0x2d')]=_[_0x47f2('0x2e')](_0x43b42a[_0x47f2('0x2d')],{'$or':_[_0x47f2('0x21')](_0x3b4429,function(_0xecc9f5){if(_0xecc9f5['type']!==_0x47f2('0x2f')){var _0x79520a={};_0x79520a[_0xecc9f5[_0x47f2('0x18')]]={'$like':'%'+_0x37fe8a['query']['filter']+'%'};return _0x79520a;}})});}_0x43b42a=_[_0x47f2('0x2e')]({},_0x43b42a,_0x37fe8a[_0x47f2('0x30')]);var _0x2614be={'where':_0x43b42a[_0x47f2('0x2d')]};return db[_0x47f2('0x1c')][_0x47f2('0xf')](_0x2614be)[_0x47f2('0x14')](function(_0x110ff0){_0x458d86[_0x47f2('0xf')]=_0x110ff0;if(_0x37fe8a['query'][_0x47f2('0x31')]){_0x43b42a[_0x47f2('0x32')]=[{'all':!![]}];}return db[_0x47f2('0x1c')][_0x47f2('0x33')](_0x43b42a);})['then'](function(_0xc0a9ee){_0x458d86[_0x47f2('0x34')]=_['map'](_0xc0a9ee,function(_0x410c24){if(_0x410c24[_0x47f2('0x35')]===_0x47f2('0x36')){var _0xefce7a=encryptor[_0x47f2('0x37')](_0x410c24[_0x47f2('0x38')]);_0x410c24[_0x47f2('0x38')]=maskClientSecret(_0xefce7a);}return _0x410c24;});return _0x458d86;})[_0x47f2('0x14')](respondWithFilteredResult(_0x21c739,_0x43b42a))[_0x47f2('0x39')](handleError(_0x21c739,null));};exports[_0x47f2('0x3a')]=function(_0x33c81e,_0x5a8e9d){var _0x38ed38={'raw':!![],'where':{'id':_0x33c81e[_0x47f2('0x3b')]['id']}},_0x2755d5={};_0x2755d5[_0x47f2('0x20')]=_['keys'](db[_0x47f2('0x1c')][_0x47f2('0x3c')]);_0x2755d5[_0x47f2('0x22')]=_[_0x47f2('0x23')](_0x33c81e[_0x47f2('0x22')]);_0x2755d5[_0x47f2('0x2a')]=_['intersection'](_0x2755d5[_0x47f2('0x20')],_0x2755d5[_0x47f2('0x22')]);_0x38ed38[_0x47f2('0x25')]=_[_0x47f2('0x24')](_0x2755d5[_0x47f2('0x20')],qs[_0x47f2('0x26')](_0x33c81e[_0x47f2('0x22')][_0x47f2('0x26')]));_0x38ed38[_0x47f2('0x25')]=_0x38ed38[_0x47f2('0x25')]['length']?_0x38ed38[_0x47f2('0x25')]:_0x2755d5[_0x47f2('0x20')];if(_0x33c81e[_0x47f2('0x22')]['includeAll']){_0x38ed38['include']=[{'all':!![]}];}_0x38ed38=_['merge']({},_0x38ed38,_0x33c81e[_0x47f2('0x30')]);return db[_0x47f2('0x1c')]['find'](_0x38ed38)['then'](handleEntityNotFound(_0x5a8e9d,null))['then'](function(_0xea74c7){if(_0xea74c7[_0x47f2('0x35')]==='MicrosoftAzure'){var _0x560944=encryptor[_0x47f2('0x37')](_0xea74c7['data3']);_0xea74c7[_0x47f2('0x38')]=maskClientSecret(_0x560944);}return _0xea74c7;})['then'](respondWithResult(_0x5a8e9d,null))[_0x47f2('0x39')](handleError(_0x5a8e9d,null));};exports[_0x47f2('0x3d')]=function(_0x6e881d,_0x11c133){if(!_0x6e881d[_0x47f2('0x3e')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x6e881d['body'][_0x47f2('0x35')])throw new Error(_0x47f2('0x3f'));var _0x121fb6=db[_0x47f2('0x1c')][_0x47f2('0x3c')][_0x47f2('0x35')][_0x47f2('0x40')];if(!_0x121fb6[_0x47f2('0x41')](_0x6e881d[_0x47f2('0x3e')][_0x47f2('0x35')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x121fb6[_0x47f2('0x42')](',\x20'));if(_0x6e881d[_0x47f2('0x3e')]['service']===_0x47f2('0x36')&&_0x6e881d[_0x47f2('0x3e')]['data3']){_0x6e881d[_0x47f2('0x3e')][_0x47f2('0x38')]=encryptor[_0x47f2('0x43')](_0x6e881d[_0x47f2('0x3e')][_0x47f2('0x38')]);}return db[_0x47f2('0x1c')][_0x47f2('0x3d')](_0x6e881d[_0x47f2('0x3e')],{})[_0x47f2('0x14')](respondWithResult(_0x11c133,0xc9))['catch'](handleError(_0x11c133,null));};exports[_0x47f2('0x13')]=function(_0x3f9569,_0x35448f){if(_0x3f9569[_0x47f2('0x3e')]['id']){delete _0x3f9569[_0x47f2('0x3e')]['id'];}return db[_0x47f2('0x1c')]['find']({'where':{'id':_0x3f9569[_0x47f2('0x3b')]['id']}})[_0x47f2('0x14')](handleEntityNotFound(_0x35448f,null))[_0x47f2('0x14')](function(_0x545480){if(_0x545480['service']===_0x47f2('0x36')&&_0x3f9569[_0x47f2('0x3e')][_0x47f2('0x38')]){_0x3f9569['body'][_0x47f2('0x38')]=encryptor[_0x47f2('0x43')](_0x3f9569['body'][_0x47f2('0x38')]);}return _0x545480;})[_0x47f2('0x14')](saveUpdates(_0x3f9569[_0x47f2('0x3e')],null))[_0x47f2('0x14')](respondWithResult(_0x35448f,null))[_0x47f2('0x39')](handleError(_0x35448f,null));};exports['destroy']=function(_0x2b14fb,_0x12844e){return db['CloudProvider'][_0x47f2('0x44')]({'where':{'id':_0x2b14fb[_0x47f2('0x3b')]['id']}})[_0x47f2('0x14')](handleEntityNotFound(_0x12844e,null))['then'](removeEntity(_0x12844e,null))[_0x47f2('0x39')](handleError(_0x12844e,null));};exports[_0x47f2('0x45')]=function(_0xbac2b0,_0x37fcbf){return db[_0x47f2('0x1c')]['findOne']({'where':{'id':_0xbac2b0['params']['id']},'raw':!![]})[_0x47f2('0x14')](function(_0x690e1f){if(!_0x690e1f)return _0x37fcbf[_0x47f2('0x9')](0x194);return{'url':oauth[_0x47f2('0x46')](_0x690e1f,_0xbac2b0[_0x47f2('0x47')]['id'])};})['then'](respondWithResult(_0x37fcbf,null))[_0x47f2('0x39')](handleError(_0x37fcbf,null));};exports[_0x47f2('0x48')]=function(_0x18f32b,_0x27e0c7){var _0x2c095c=_0x18f32b[_0x47f2('0x3e')];var _0xf07c4a;var _0x9c09c4;if(_0x2c095c[_0x47f2('0x16')])throw _0x2c095c;redis[_0x47f2('0x49')](_0x2c095c[_0x47f2('0x4a')])[_0x47f2('0x14')](function(_0x5ea597){if(!_0x5ea597)throw new Error(_0x47f2('0x4b'));_0xf07c4a=JSON[_0x47f2('0x4c')](_0x5ea597);var _0x1d105b=Buffer[_0x47f2('0x4d')](_0x2c095c[_0x47f2('0x4a')],'base64')[_0x47f2('0x4e')](_0x47f2('0x4f'));_0x9c09c4=JSON[_0x47f2('0x4c')](_0x1d105b);if(!oauth['isValidIdToken'](_0x2c095c[_0x47f2('0x50')],_0xf07c4a[_0x47f2('0x51')]))throw new Error(_0x47f2('0x52'));redis[_0x47f2('0x53')](_0x2c095c[_0x47f2('0x4a')]);return oauth[_0x47f2('0x54')](_0x2c095c[_0x47f2('0x55')],_0xf07c4a);})['then'](function(_0x15f010){_0xf07c4a[_0x47f2('0x56')]=_0x15f010['access_token'];_0xf07c4a[_0x47f2('0x57')]=_0x15f010[_0x47f2('0x58')];return db[_0x47f2('0x1c')]['update']({'data5':_0xf07c4a['data5'],'data6':_0xf07c4a[_0x47f2('0x57')]},{'where':{'id':_0xf07c4a['id']}});})['then'](function(){oauth[_0x47f2('0x59')](_0xf07c4a);socket[_0x47f2('0x5a')](_0x47f2('0x5b'),{'id':_0x9c09c4['id']});return;})[_0x47f2('0x14')](respondWithStatusCode(_0x27e0c7,null))[_0x47f2('0x39')](function(_0x328a33){if(_0x9c09c4){socket['emit']('microsoftAuthorization:error',{'id':_0x9c09c4['id']});}if(!_0xf07c4a){logger['error'](_0x47f2('0x5c'),_0x328a33);return _0x27e0c7[_0x47f2('0xa')](0x1f4)['send'](_0x328a33['message']);}logger[_0x47f2('0x16')](_0x47f2('0x5d'),_0xf07c4a['id'],JSON[_0x47f2('0x5e')](_0x328a33));});}; \ No newline at end of file +var _0x70dc=['get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','del','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','json','limit','undefined','offset','count','status','set','Content-Range','then','destroy','sendStatus','error','stack','name','send','padEnd','index','CloudProvider','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','length','options','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','update','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x70dc,0x199));var _0xc70d=function(_0x42dc68,_0x565387){_0x42dc68=_0x42dc68-0x0;var _0xed76e=_0x70dc[_0x42dc68];return _0xed76e;};'use strict';var _=require(_0xc70d('0x0'));var Redis=require(_0xc70d('0x1'));var qs=require(_0xc70d('0x2'));var encryptor=require(_0xc70d('0x3'));var config=require(_0xc70d('0x4'));var logger=require(_0xc70d('0x5'))(_0xc70d('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0xc70d('0x7'));config[_0xc70d('0x8')]=_[_0xc70d('0x9')](config[_0xc70d('0x8')],{'host':_0xc70d('0xa'),'port':0x18eb});var socket=require(_0xc70d('0xb'))(new Redis(config[_0xc70d('0x8')]));var redis=new Redis(config[_0xc70d('0x8')]);function respondWithStatusCode(_0x1620e5,_0x379607){_0x379607=_0x379607||0xcc;return function(_0x1c8137){if(_0x1c8137){return _0x1620e5['sendStatus'](_0x379607);}return _0x1620e5['status'](_0x379607)['end']();};}function respondWithResult(_0x1ae7de,_0x264562){_0x264562=_0x264562||0xc8;return function(_0x1984a6){if(_0x1984a6){return _0x1ae7de['status'](_0x264562)[_0xc70d('0xc')](_0x1984a6);}};}function respondWithFilteredResult(_0x55ae21,_0x3bf3f7){return function(_0x468a6c){if(_0x468a6c){var _0xeb9fb8=typeof _0x3bf3f7['offset']==='undefined'&&typeof _0x3bf3f7[_0xc70d('0xd')]===_0xc70d('0xe');var _0x516d77=_0x468a6c['count'];var _0x4e7171=_0xeb9fb8?0x0:_0x3bf3f7[_0xc70d('0xf')];var _0x18b065=_0xeb9fb8?_0x468a6c[_0xc70d('0x10')]:_0x3bf3f7[_0xc70d('0xf')]+_0x3bf3f7[_0xc70d('0xd')];var _0x57148b;if(_0x18b065>=_0x516d77){_0x18b065=_0x516d77;_0x57148b=0xc8;}else{_0x57148b=0xce;}_0x55ae21[_0xc70d('0x11')](_0x57148b);return _0x55ae21[_0xc70d('0x12')](_0xc70d('0x13'),_0x4e7171+'-'+_0x18b065+'/'+_0x516d77)[_0xc70d('0xc')](_0x468a6c);}return null;};}function saveUpdates(_0x47fa47){return function(_0x165469){if(_0x165469){return _0x165469['update'](_0x47fa47)[_0xc70d('0x14')](function(_0x149f51){return _0x149f51;});}return null;};}function removeEntity(_0x39cc7e){return function(_0x241ade){if(_0x241ade){return _0x241ade[_0xc70d('0x15')]()[_0xc70d('0x14')](function(){_0x39cc7e[_0xc70d('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27f309){return function(_0x4088a2){if(!_0x4088a2){_0x27f309[_0xc70d('0x16')](0x194);}return _0x4088a2;};}function handleError(_0x2b6792,_0x592ff1){_0x592ff1=_0x592ff1||0x1f4;return function(_0x330560){logger[_0xc70d('0x17')](_0x330560[_0xc70d('0x18')]);if(_0x330560[_0xc70d('0x19')]){delete _0x330560[_0xc70d('0x19')];}_0x2b6792[_0xc70d('0x11')](_0x592ff1)[_0xc70d('0x1a')](_0x330560);};}function maskClientSecret(_0x52051c){return _[_0xc70d('0x1b')](_0x52051c['slice'](0x0,0x3),0x14,'*');}exports[_0xc70d('0x1c')]=function(_0x5c67c4,_0x361269){var _0x1d913f={},_0x2f87b3={},_0x1de9f5={'count':0x0,'rows':[]};var _0x41b696=_['map'](db[_0xc70d('0x1d')][_0xc70d('0x1e')],function(_0x5b7094){return{'name':_0x5b7094[_0xc70d('0x1f')],'type':_0x5b7094[_0xc70d('0x20')]['key']};});_0x2f87b3[_0xc70d('0x21')]=_[_0xc70d('0x22')](_0x41b696,_0xc70d('0x19'));_0x2f87b3[_0xc70d('0x23')]=_['keys'](_0x5c67c4[_0xc70d('0x23')]);_0x2f87b3[_0xc70d('0x24')]=_[_0xc70d('0x25')](_0x2f87b3[_0xc70d('0x21')],_0x2f87b3[_0xc70d('0x23')]);_0x1d913f[_0xc70d('0x26')]=_[_0xc70d('0x25')](_0x2f87b3['model'],qs[_0xc70d('0x27')](_0x5c67c4[_0xc70d('0x23')]['fields']));_0x1d913f[_0xc70d('0x26')]=_0x1d913f[_0xc70d('0x26')]['length']?_0x1d913f[_0xc70d('0x26')]:_0x2f87b3[_0xc70d('0x21')];if(!_0x5c67c4['query'][_0xc70d('0x28')](_0xc70d('0x29'))){_0x1d913f[_0xc70d('0xd')]=qs[_0xc70d('0xd')](_0x5c67c4[_0xc70d('0x23')][_0xc70d('0xd')]);_0x1d913f[_0xc70d('0xf')]=qs[_0xc70d('0xf')](_0x5c67c4[_0xc70d('0x23')][_0xc70d('0xf')]);}_0x1d913f[_0xc70d('0x2a')]=qs[_0xc70d('0x2b')](_0x5c67c4[_0xc70d('0x23')][_0xc70d('0x2b')]);_0x1d913f[_0xc70d('0x2c')]=qs[_0xc70d('0x24')](_[_0xc70d('0x2d')](_0x5c67c4[_0xc70d('0x23')],_0x2f87b3[_0xc70d('0x24')]),_0x41b696);if(_0x5c67c4['query']['filter']){_0x1d913f[_0xc70d('0x2c')]=_[_0xc70d('0x2e')](_0x1d913f[_0xc70d('0x2c')],{'$or':_['map'](_0x41b696,function(_0x371925){if(_0x371925[_0xc70d('0x20')]!==_0xc70d('0x2f')){var _0x537a74={};_0x537a74[_0x371925[_0xc70d('0x19')]]={'$like':'%'+_0x5c67c4['query'][_0xc70d('0x30')]+'%'};return _0x537a74;}})});}_0x1d913f=_[_0xc70d('0x2e')]({},_0x1d913f,_0x5c67c4['options']);var _0xcaeb44={'where':_0x1d913f[_0xc70d('0x2c')]};return db[_0xc70d('0x1d')][_0xc70d('0x10')](_0xcaeb44)[_0xc70d('0x14')](function(_0x1b30e8){_0x1de9f5[_0xc70d('0x10')]=_0x1b30e8;if(_0x5c67c4[_0xc70d('0x23')][_0xc70d('0x31')]){_0x1d913f[_0xc70d('0x32')]=[{'all':!![]}];}return db[_0xc70d('0x1d')]['findAll'](_0x1d913f);})['then'](function(_0x4d30a9){_0x1de9f5[_0xc70d('0x33')]=_[_0xc70d('0x22')](_0x4d30a9,function(_0x2cb455){if(_0x2cb455[_0xc70d('0x34')]===_0xc70d('0x35')){var _0x4b1b83=encryptor[_0xc70d('0x36')](_0x2cb455[_0xc70d('0x37')]);_0x2cb455['data3']=maskClientSecret(_0x4b1b83);}return _0x2cb455;});return _0x1de9f5;})[_0xc70d('0x14')](respondWithFilteredResult(_0x361269,_0x1d913f))[_0xc70d('0x38')](handleError(_0x361269,null));};exports[_0xc70d('0x39')]=function(_0x42a876,_0x1785e0){var _0x517bf5={'raw':!![],'where':{'id':_0x42a876[_0xc70d('0x3a')]['id']}},_0x215f92={};_0x215f92[_0xc70d('0x21')]=_[_0xc70d('0x3b')](db[_0xc70d('0x1d')][_0xc70d('0x1e')]);_0x215f92[_0xc70d('0x23')]=_['keys'](_0x42a876[_0xc70d('0x23')]);_0x215f92[_0xc70d('0x24')]=_['intersection'](_0x215f92['model'],_0x215f92[_0xc70d('0x23')]);_0x517bf5['attributes']=_[_0xc70d('0x25')](_0x215f92[_0xc70d('0x21')],qs[_0xc70d('0x27')](_0x42a876[_0xc70d('0x23')][_0xc70d('0x27')]));_0x517bf5[_0xc70d('0x26')]=_0x517bf5[_0xc70d('0x26')][_0xc70d('0x3c')]?_0x517bf5[_0xc70d('0x26')]:_0x215f92[_0xc70d('0x21')];if(_0x42a876[_0xc70d('0x23')][_0xc70d('0x31')]){_0x517bf5[_0xc70d('0x32')]=[{'all':!![]}];}_0x517bf5=_['merge']({},_0x517bf5,_0x42a876[_0xc70d('0x3d')]);return db[_0xc70d('0x1d')][_0xc70d('0x3e')](_0x517bf5)[_0xc70d('0x14')](handleEntityNotFound(_0x1785e0,null))[_0xc70d('0x14')](function(_0x497b8b){if(_0x497b8b['service']==='MicrosoftAzure'){var _0x307249=encryptor[_0xc70d('0x36')](_0x497b8b[_0xc70d('0x37')]);_0x497b8b[_0xc70d('0x37')]=maskClientSecret(_0x307249);}return _0x497b8b;})['then'](respondWithResult(_0x1785e0,null))[_0xc70d('0x38')](handleError(_0x1785e0,null));};exports[_0xc70d('0x3f')]=function(_0x5d89b2,_0x15d513){if(!_0x5d89b2[_0xc70d('0x40')][_0xc70d('0x19')])throw new Error(_0xc70d('0x41'));if(!_0x5d89b2[_0xc70d('0x40')][_0xc70d('0x34')])throw new Error(_0xc70d('0x42'));var _0x19149d=db['CloudProvider'][_0xc70d('0x1e')]['service'][_0xc70d('0x43')];if(!_0x19149d[_0xc70d('0x44')](_0x5d89b2['body'][_0xc70d('0x34')]))throw new Error(_0xc70d('0x45')+_0x19149d['join'](',\x20'));if(_0x5d89b2[_0xc70d('0x40')][_0xc70d('0x34')]===_0xc70d('0x35')&&_0x5d89b2[_0xc70d('0x40')][_0xc70d('0x37')]){_0x5d89b2[_0xc70d('0x40')]['data3']=encryptor[_0xc70d('0x46')](_0x5d89b2[_0xc70d('0x40')]['data3']);}return db[_0xc70d('0x1d')][_0xc70d('0x3f')](_0x5d89b2[_0xc70d('0x40')],{})[_0xc70d('0x14')](respondWithResult(_0x15d513,0xc9))[_0xc70d('0x38')](handleError(_0x15d513,null));};exports[_0xc70d('0x47')]=function(_0x33e601,_0x2d4863){if(_0x33e601['body']['id']){delete _0x33e601['body']['id'];}return db['CloudProvider'][_0xc70d('0x3e')]({'where':{'id':_0x33e601[_0xc70d('0x3a')]['id']}})[_0xc70d('0x14')](handleEntityNotFound(_0x2d4863,null))[_0xc70d('0x14')](function(_0xf75acf){if(_0xf75acf[_0xc70d('0x34')]===_0xc70d('0x35')&&_0x33e601[_0xc70d('0x40')][_0xc70d('0x37')]){_0x33e601['body'][_0xc70d('0x37')]=encryptor[_0xc70d('0x46')](_0x33e601[_0xc70d('0x40')]['data3']);}return _0xf75acf;})[_0xc70d('0x14')](saveUpdates(_0x33e601[_0xc70d('0x40')],null))[_0xc70d('0x14')](respondWithResult(_0x2d4863,null))['catch'](handleError(_0x2d4863,null));};exports[_0xc70d('0x15')]=function(_0x25d366,_0x1e1435){return db['CloudProvider'][_0xc70d('0x3e')]({'where':{'id':_0x25d366[_0xc70d('0x3a')]['id']}})[_0xc70d('0x14')](handleEntityNotFound(_0x1e1435,null))[_0xc70d('0x14')](removeEntity(_0x1e1435,null))[_0xc70d('0x38')](handleError(_0x1e1435,null));};exports[_0xc70d('0x48')]=function(_0xb20d4b,_0x4df2eb){return db[_0xc70d('0x1d')][_0xc70d('0x49')]({'where':{'id':_0xb20d4b[_0xc70d('0x3a')]['id']},'raw':!![]})[_0xc70d('0x14')](function(_0x29e7bd){if(!_0x29e7bd)return _0x4df2eb[_0xc70d('0x16')](0x194);return{'url':oauth[_0xc70d('0x4a')](_0x29e7bd,_0xb20d4b[_0xc70d('0x4b')]['id'])};})[_0xc70d('0x14')](respondWithResult(_0x4df2eb,null))[_0xc70d('0x38')](handleError(_0x4df2eb,null));};exports['oauth2MicrosoftCallback']=function(_0x208ee9,_0x56067b){var _0x519814=_0x208ee9[_0xc70d('0x40')];var _0x390117;var _0x3e2b15;if(_0x519814[_0xc70d('0x17')])throw _0x519814;redis[_0xc70d('0x4c')](_0x519814[_0xc70d('0x4d')])[_0xc70d('0x14')](function(_0x3bb561){if(!_0x3bb561)throw new Error(_0xc70d('0x4e'));_0x390117=JSON[_0xc70d('0x4f')](_0x3bb561);var _0x9bfbd4=Buffer[_0xc70d('0x50')](_0x519814[_0xc70d('0x4d')],_0xc70d('0x51'))[_0xc70d('0x52')](_0xc70d('0x53'));_0x3e2b15=JSON[_0xc70d('0x4f')](_0x9bfbd4);if(!oauth[_0xc70d('0x54')](_0x519814[_0xc70d('0x55')],_0x390117[_0xc70d('0x56')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xc70d('0x57')](_0x519814['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x519814['code'],_0x390117);})[_0xc70d('0x14')](function(_0x5cc486){_0x390117[_0xc70d('0x58')]=_0x5cc486['access_token'];_0x390117[_0xc70d('0x59')]=_0x5cc486[_0xc70d('0x5a')];return db[_0xc70d('0x1d')][_0xc70d('0x47')]({'data5':_0x390117[_0xc70d('0x58')],'data6':_0x390117[_0xc70d('0x59')]},{'where':{'id':_0x390117['id']}});})[_0xc70d('0x14')](function(){oauth[_0xc70d('0x5b')](_0x390117);socket[_0xc70d('0x5c')](_0xc70d('0x5d'),{'id':_0x3e2b15['id']});return;})[_0xc70d('0x14')](respondWithStatusCode(_0x56067b,null))['catch'](function(_0x562dcc){if(_0x3e2b15){socket[_0xc70d('0x5c')]('microsoftAuthorization:error',{'id':_0x3e2b15['id']});}if(!_0x390117){logger['error'](_0xc70d('0x5e'),_0x562dcc);return _0x56067b[_0xc70d('0x11')](0x1f4)['send'](_0x562dcc['message']);}logger['error'](_0xc70d('0x5f'),_0x390117['id'],JSON[_0xc70d('0x60')](_0x562dcc));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b1171a2..bacffa6 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 _0xbb19=['cloud_providers','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CloudProvider'];(function(_0x4a3c85,_0x92289c){var _0x4f982c=function(_0x10c9de){while(--_0x10c9de){_0x4a3c85['push'](_0x4a3c85['shift']());}};_0x4f982c(++_0x92289c);}(_0xbb19,0x1a3));var _0x9bb1=function(_0x33b43f,_0x328384){_0x33b43f=_0x33b43f-0x0;var _0x304569=_0xbb19[_0x33b43f];return _0x304569;};'use strict';var _=require(_0x9bb1('0x0'));var util=require(_0x9bb1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9bb1('0x2'));var BPromise=require(_0x9bb1('0x3'));var rp=require(_0x9bb1('0x4'));var fs=require('fs');var path=require(_0x9bb1('0x5'));var rimraf=require(_0x9bb1('0x6'));var config=require(_0x9bb1('0x7'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x236ac8,_0x12486f){return _0x236ac8[_0x9bb1('0x8')](_0x9bb1('0x9'),attributes,{'tableName':_0x9bb1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d6b=['cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','CloudProvider'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x5d6b,0x109));var _0xb5d6=function(_0x478e95,_0x57af41){_0x478e95=_0x478e95-0x0;var _0x2ba047=_0x5d6b[_0x478e95];return _0x2ba047;};'use strict';var _=require(_0xb5d6('0x0'));var util=require(_0xb5d6('0x1'));var logger=require(_0xb5d6('0x2'))(_0xb5d6('0x3'));var moment=require('moment');var BPromise=require(_0xb5d6('0x4'));var rp=require(_0xb5d6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb5d6('0x6'));var config=require(_0xb5d6('0x7'));var attributes=require('./cloudProvider.attributes');module[_0xb5d6('0x8')]=function(_0x45a9f4,_0x2ac8e4){return _0x45a9f4[_0xb5d6('0x9')](_0xb5d6('0xa'),attributes,{'tableName':_0xb5d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index b3e15ae..fef38de 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 _0x4b00=['payload','iss','issuer','aud','audience','isAfter','unix','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','data3','{TENANT_ID}','data5','access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','type','Dynamics365','push','/.default','join','Outlook365','data7','replace','data2','code','id_token','from','stringify','toString','base64','randomBytes','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','value','set','decode'];(function(_0xbb2b8b,_0x325cbe){var _0x65d0d3=function(_0x4444d2){while(--_0x4444d2){_0xbb2b8b['push'](_0xbb2b8b['shift']());}};_0x65d0d3(++_0x325cbe);}(_0x4b00,0xc5));var _0x04b0=function(_0x4a7ad5,_0x1d3336){_0x4a7ad5=_0x4a7ad5-0x0;var _0x2bdfeb=_0x4b00[_0x4a7ad5];return _0x2bdfeb;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x04b0('0x0'));var moment=require(_0x04b0('0x1'));var Redis=require(_0x04b0('0x2'));var rp=require('request-promise');var util=require(_0x04b0('0x3'));var encryptor=require(_0x04b0('0x4'));var config=require(_0x04b0('0x5'));var logger=require(_0x04b0('0x6'))(_0x04b0('0x7'));var schedule=require(_0x04b0('0x8'));var db=require(_0x04b0('0x9'))['db'];config['redis']=_[_0x04b0('0xa')](config[_0x04b0('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x04b0('0xb')]);var MICROSOFT_AUTH_URL=_0x04b0('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x04b0('0xd'),_0x04b0('0xe'),_0x04b0('0xf'),_0x04b0('0x10'),_0x04b0('0x11'),_0x04b0('0x12')],'Dynamics365':[_0x04b0('0x13'),_0x04b0('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x04b0('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x04b0('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x756459){var _0x464a92=_[_0x04b0('0x16')](AZURE_AUTH_SCOPES[_0x756459[_0x04b0('0x17')]]);if(_0x756459[_0x04b0('0x17')]===_0x04b0('0x18'))_0x464a92[_0x04b0('0x19')](_0x756459['data7']+_0x04b0('0x1a'));return _0x464a92[_0x04b0('0x1b')]('\x20');}function getAccessTokenScope(_0x101061){if(_0x101061[_0x04b0('0x17')]===_0x04b0('0x1c'))return _0x04b0('0x10');if(_0x101061[_0x04b0('0x17')]===_0x04b0('0x18'))return _0x101061[_0x04b0('0x1d')]+_0x04b0('0x1a');}function generateMicrosoftAuthorizationUrl(_0x323f7e,_0x1ce389){var _0x218c13=MICROSOFT_AUTH_URL[_0x04b0('0x1e')]('{TENANT_ID}',_0x323f7e[_0x04b0('0x1f')]);var _0x32df25=[_0x04b0('0x20'),_0x04b0('0x21')];var _0x554764=Buffer[_0x04b0('0x22')](JSON[_0x04b0('0x23')]({'id':_0x1ce389}))[_0x04b0('0x24')](_0x04b0('0x25'));var _0x2aa0ef=crypto[_0x04b0('0x26')](0x10)[_0x04b0('0x24')]('hex');var _0xcc81f8=getAuthorizationScopes(_0x323f7e);var _0x2348d9=[{'key':_0x04b0('0x27'),'value':_0x323f7e[_0x04b0('0x28')]},{'key':_0x04b0('0x29'),'value':encodeURIComponent(_0x32df25[_0x04b0('0x1b')]('\x20'))},{'key':_0x04b0('0x2a'),'value':_0x323f7e[_0x04b0('0x2b')]},{'key':_0x04b0('0x2c'),'value':_0x04b0('0x2d')},{'key':_0x04b0('0x2e'),'value':encodeURIComponent(_0xcc81f8)},{'key':_0x04b0('0x2f'),'value':_0x554764},{'key':_0x04b0('0x30'),'value':_0x2aa0ef},{'key':_0x04b0('0x31'),'value':_0x04b0('0x32')}];var _0x4aeac2=_0x218c13+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x04b0('0x16')](_0x2348d9,function(_0x4a6ed7){return _0x4a6ed7[_0x04b0('0x33')]+'='+_0x4a6ed7[_0x04b0('0x34')];})[_0x04b0('0x1b')]('&');_0x323f7e['oauth2Claims']={'issuer':_0x218c13[_0x04b0('0x1e')]('oauth2/',''),'audience':_0x323f7e[_0x04b0('0x28')],'state':_0x554764,'nonce':_0x2aa0ef};redis[_0x04b0('0x35')](_0x554764,JSON[_0x04b0('0x23')](_0x323f7e));return _0x4aeac2;}function isValidIdToken(_0x402489,_0x3252a6){try{var _0x3137ec=jwt[_0x04b0('0x36')](_0x402489,{'complete':!![]});var _0x503c6e=_0x3137ec[_0x04b0('0x37')];if(_0x503c6e[_0x04b0('0x38')]!==_0x3252a6[_0x04b0('0x39')])return![];if(_0x503c6e[_0x04b0('0x3a')]!==_0x3252a6[_0x04b0('0x3b')])return![];if(_0x503c6e[_0x04b0('0x30')]!==_0x3252a6['nonce'])return![];if(moment()[_0x04b0('0x3c')](moment[_0x04b0('0x3d')](_0x503c6e['exp'])))return![];return!![];}catch(_0x43aab2){throw _0x43aab2;}}function refreshOauth2MicrosoftAccessToken(_0x3c098c){return Promise[_0x04b0('0x3e')]()[_0x04b0('0x3f')](function(){if(_0x3c098c['data3'])return _0x3c098c;return db[_0x04b0('0x40')][_0x04b0('0x41')]({'where':{'id':_0x3c098c['id']},'raw':!![]});})['then'](function(_0x393b93){var _0x6161db={'grant_type':_0x04b0('0x42'),'refresh_token':_0x393b93[_0x04b0('0x43')],'scope':getAccessTokenScope(_0x393b93),'redirect_uri':_0x393b93['data4'],'client_id':_0x393b93[_0x04b0('0x28')],'client_secret':encryptor[_0x04b0('0x44')](_0x393b93[_0x04b0('0x45')])};var _0x46557e={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x04b0('0x1e')](_0x04b0('0x46'),_0x393b93[_0x04b0('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x6161db,'json':!![]};return rp(_0x46557e);})['then'](function(_0x32068c){_0x3c098c[_0x04b0('0x47')]=_0x32068c[_0x04b0('0x48')];_0x3c098c[_0x04b0('0x43')]=_0x32068c['refresh_token'];return db['CloudProvider'][_0x04b0('0x49')]({'data5':_0x3c098c['data5'],'data6':_0x3c098c['data6']},{'where':{'id':_0x3c098c['id']}});})[_0x04b0('0x3f')](function(){return _0x3c098c;})['catch'](function(_0x187f4e){logger[_0x04b0('0x4a')](_0x04b0('0x4b'),_0x3c098c['id'],_0x187f4e);});}function getOauth2MicrosoftAccessToken(_0x2783c0,_0x381ae9){var _0x3afb04={'grant_type':_0x04b0('0x4c'),'code':_0x2783c0,'scope':getAccessTokenScope(_0x381ae9),'redirect_uri':_0x381ae9[_0x04b0('0x2b')],'client_id':_0x381ae9[_0x04b0('0x28')],'client_secret':encryptor[_0x04b0('0x44')](_0x381ae9[_0x04b0('0x45')])};var _0x1903c2={'method':_0x04b0('0x4d'),'uri':MICROSOFT_AUTH_URL[_0x04b0('0x1e')](_0x04b0('0x46'),_0x381ae9[_0x04b0('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3afb04,'json':!![]};return rp(_0x1903c2);}function startRefreshInterval(_0x37762b){var _0x1c631c=schedule[_0x04b0('0x4e')];if(_0x1c631c[_0x37762b['id']])clearInterval(_0x1c631c[_0x37762b['id']]);_0x1c631c[_0x37762b['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x37762b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x04b0('0x4e')]=_0x1c631c;}function startAllRefreshIntervals(){return db[_0x04b0('0x40')][_0x04b0('0x4f')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x04b0('0x3f')](function(_0x40cf16){var _0x1495cc=_0x40cf16[_0x04b0('0x16')](function(_0x3e37fa){return refreshOauth2MicrosoftAccessToken(_0x3e37fa)['then'](function(_0x485a6c){startRefreshInterval(_0x485a6c);});});return Promise[_0x04b0('0x50')](_0x1495cc);})['catch'](function(_0x729077){var _0x226dfa=_0x729077?util[_0x04b0('0x51')](_0x729077,{'showHidden':![],'depth':null}):'';logger[_0x04b0('0x4a')](_0x04b0('0x52'),_0x226dfa);});}module[_0x04b0('0x53')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xeec4=['iss','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','catch','authorization_code','intervals','bind','findAll','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','moment','ioredis','util','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','id_token','from','stringify','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','map','value','oauth2Claims','oauth2/','decode','payload'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0xeec4,0x1a6));var _0x4eec=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0xeec4[_0x59eefb];return _0x1a49e8;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x4eec('0x0'));var moment=require(_0x4eec('0x1'));var Redis=require(_0x4eec('0x2'));var rp=require('request-promise');var util=require(_0x4eec('0x3'));var encryptor=require('../../components/encryptor');var config=require(_0x4eec('0x4'));var logger=require('../../config/logger')(_0x4eec('0x5'));var schedule=require(_0x4eec('0x6'));var db=require(_0x4eec('0x7'))['db'];config['redis']=_[_0x4eec('0x8')](config[_0x4eec('0x9')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x4eec('0x9')]);var MICROSOFT_AUTH_URL=_0x4eec('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x4eec('0xb'),_0x4eec('0xc'),'email',_0x4eec('0xd'),_0x4eec('0xe'),'https://outlook.office.com/POP.AccessAsUser.All',_0x4eec('0xf')],'Dynamics365':[_0x4eec('0xb'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x4eec('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0x4eec('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x7e70b3){var _0xcbdcef=_['map'](AZURE_AUTH_SCOPES[_0x7e70b3[_0x4eec('0x12')]]);if(_0x7e70b3[_0x4eec('0x12')]===_0x4eec('0x13'))_0xcbdcef[_0x4eec('0x14')](_0x7e70b3[_0x4eec('0x15')]+_0x4eec('0x16'));return _0xcbdcef[_0x4eec('0x17')]('\x20');}function getAccessTokenScope(_0x29b7f4){if(_0x29b7f4['type']===_0x4eec('0x18'))return _0x4eec('0xe');if(_0x29b7f4[_0x4eec('0x12')]===_0x4eec('0x13'))return _0x29b7f4['data7']+_0x4eec('0x16');}function generateMicrosoftAuthorizationUrl(_0x649b29,_0x52e91e){var _0x54b874=MICROSOFT_AUTH_URL[_0x4eec('0x19')](_0x4eec('0x1a'),_0x649b29[_0x4eec('0x1b')]);var _0x3c728e=['code',_0x4eec('0x1c')];var _0x25e3cb=Buffer[_0x4eec('0x1d')](JSON[_0x4eec('0x1e')]({'id':_0x52e91e}))['toString']('base64');var _0x4bc1ca=crypto[_0x4eec('0x1f')](0x10)[_0x4eec('0x20')](_0x4eec('0x21'));var _0x437ef8=getAuthorizationScopes(_0x649b29);var _0x50385e=[{'key':_0x4eec('0x22'),'value':_0x649b29[_0x4eec('0x23')]},{'key':_0x4eec('0x24'),'value':encodeURIComponent(_0x3c728e[_0x4eec('0x17')]('\x20'))},{'key':_0x4eec('0x25'),'value':_0x649b29[_0x4eec('0x26')]},{'key':_0x4eec('0x27'),'value':_0x4eec('0x28')},{'key':_0x4eec('0x29'),'value':encodeURIComponent(_0x437ef8)},{'key':_0x4eec('0x2a'),'value':_0x25e3cb},{'key':_0x4eec('0x2b'),'value':_0x4bc1ca},{'key':_0x4eec('0x2c'),'value':_0x4eec('0x2d')}];var _0x444cd1=_0x54b874+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x4eec('0x2e')](_0x50385e,function(_0x2e200c){return _0x2e200c['key']+'='+_0x2e200c[_0x4eec('0x2f')];})[_0x4eec('0x17')]('&');_0x649b29[_0x4eec('0x30')]={'issuer':_0x54b874[_0x4eec('0x19')](_0x4eec('0x31'),''),'audience':_0x649b29[_0x4eec('0x23')],'state':_0x25e3cb,'nonce':_0x4bc1ca};redis['set'](_0x25e3cb,JSON['stringify'](_0x649b29));return _0x444cd1;}function isValidIdToken(_0x3b1f6d,_0x2d7e1e){try{var _0x2ccfbc=jwt[_0x4eec('0x32')](_0x3b1f6d,{'complete':!![]});var _0x1cd4f0=_0x2ccfbc[_0x4eec('0x33')];if(_0x1cd4f0[_0x4eec('0x34')]!==_0x2d7e1e['issuer'])return![];if(_0x1cd4f0[_0x4eec('0x35')]!==_0x2d7e1e[_0x4eec('0x36')])return![];if(_0x1cd4f0[_0x4eec('0x2b')]!==_0x2d7e1e[_0x4eec('0x2b')])return![];if(moment()[_0x4eec('0x37')](moment[_0x4eec('0x38')](_0x1cd4f0[_0x4eec('0x39')])))return![];return!![];}catch(_0x3b44df){throw _0x3b44df;}}function refreshOauth2MicrosoftAccessToken(_0x259a0b){return Promise[_0x4eec('0x3a')]()[_0x4eec('0x3b')](function(){if(_0x259a0b[_0x4eec('0x3c')])return _0x259a0b;return db[_0x4eec('0x3d')][_0x4eec('0x3e')]({'where':{'id':_0x259a0b['id']},'raw':!![]});})[_0x4eec('0x3b')](function(_0x4f5117){var _0x3f37a5={'grant_type':_0x4eec('0x3f'),'refresh_token':_0x4f5117[_0x4eec('0x40')],'scope':getAccessTokenScope(_0x4f5117),'redirect_uri':_0x4f5117[_0x4eec('0x26')],'client_id':_0x4f5117[_0x4eec('0x23')],'client_secret':encryptor[_0x4eec('0x41')](_0x4f5117[_0x4eec('0x3c')])};var _0x28f3cf={'method':_0x4eec('0x42'),'uri':MICROSOFT_AUTH_URL[_0x4eec('0x19')](_0x4eec('0x1a'),_0x4f5117[_0x4eec('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3f37a5,'json':!![]};return rp(_0x28f3cf);})[_0x4eec('0x3b')](function(_0x4a67b9){_0x259a0b[_0x4eec('0x43')]=_0x4a67b9[_0x4eec('0x44')];_0x259a0b[_0x4eec('0x40')]=_0x4a67b9[_0x4eec('0x3f')];return db[_0x4eec('0x3d')][_0x4eec('0x45')]({'data5':_0x259a0b[_0x4eec('0x43')],'data6':_0x259a0b[_0x4eec('0x40')]},{'where':{'id':_0x259a0b['id']}});})[_0x4eec('0x3b')](function(){return _0x259a0b;})[_0x4eec('0x46')](function(_0xe7ac11){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x259a0b['id'],_0xe7ac11);});}function getOauth2MicrosoftAccessToken(_0x2e0cd3,_0x51db15){var _0xb5f75={'grant_type':_0x4eec('0x47'),'code':_0x2e0cd3,'scope':getAccessTokenScope(_0x51db15),'redirect_uri':_0x51db15[_0x4eec('0x26')],'client_id':_0x51db15[_0x4eec('0x23')],'client_secret':encryptor[_0x4eec('0x41')](_0x51db15[_0x4eec('0x3c')])};var _0x26d032={'method':_0x4eec('0x42'),'uri':MICROSOFT_AUTH_URL[_0x4eec('0x19')](_0x4eec('0x1a'),_0x51db15['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xb5f75,'json':!![]};return rp(_0x26d032);}function startRefreshInterval(_0x2ea2fd){var _0x10133d=schedule[_0x4eec('0x48')];if(_0x10133d[_0x2ea2fd['id']])clearInterval(_0x10133d[_0x2ea2fd['id']]);_0x10133d[_0x2ea2fd['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x4eec('0x49')](this,{'id':_0x2ea2fd['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x4eec('0x48')]=_0x10133d;}function startAllRefreshIntervals(){return db[_0x4eec('0x3d')][_0x4eec('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x4eec('0x3b')](function(_0x51de3b){var _0x16a151=_0x51de3b[_0x4eec('0x2e')](function(_0x1cfac5){return refreshOauth2MicrosoftAccessToken(_0x1cfac5)[_0x4eec('0x3b')](function(_0x27338a){startRefreshInterval(_0x27338a);});});return Promise['all'](_0x16a151);})[_0x4eec('0x46')](function(_0x42cc03){var _0x146a7d=_0x42cc03?util[_0x4eec('0x4b')](_0x42cc03,{'showHidden':![],'depth':null}):'';logger[_0x4eec('0x4c')](_0x4eec('0x4d'),_0x146a7d);});}module[_0x4eec('0x4e')]={'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 086b8cb..4059cb4 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 _0xcdd2=['../../config/logger','../../config/environment','jayson/promise','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x353372,_0x165c80){var _0x900a55=function(_0x2045e8){while(--_0x2045e8){_0x353372['push'](_0x353372['shift']());}};_0x900a55(++_0x165c80);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var moment=require(_0x2cdd('0x2'));var BPromise=require(_0x2cdd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cdd('0x4'));var db=require(_0x2cdd('0x5'))['db'];var utils=require(_0x2cdd('0x6'));var logger=require(_0x2cdd('0x7'))('rpc');var config=require(_0x2cdd('0x8'));var jayson=require(_0x2cdd('0x9'));var client=jayson['client'][_0x2cdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36f9ad,_0x2647e6,_0x2ff8e0){return new BPromise(function(_0x506b09,_0x569943){return client['request'](_0x36f9ad,_0x2ff8e0)[_0x2cdd('0xb')](function(_0x4cd731){logger[_0x2cdd('0xc')](_0x2cdd('0xd'),_0x2647e6,_0x2cdd('0xe'));logger[_0x2cdd('0xf')](_0x2cdd('0x10'),_0x2647e6,_0x2cdd('0xe'),JSON[_0x2cdd('0x11')](_0x4cd731));if(_0x4cd731[_0x2cdd('0x12')]){if(_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x13')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x2647e6,_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x14')]);return _0x569943(_0x4cd731['error'][_0x2cdd('0x14')]);}logger[_0x2cdd('0x12')](_0x2cdd('0xd'),_0x2647e6,_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x14')]);return _0x506b09(_0x4cd731['error'][_0x2cdd('0x14')]);}else{logger[_0x2cdd('0xc')]('CloudProvider,\x20%s,\x20%s',_0x2647e6,_0x2cdd('0xe'));_0x506b09(_0x4cd731[_0x2cdd('0x15')][_0x2cdd('0x14')]);}})[_0x2cdd('0x16')](function(_0x3af7c8){logger[_0x2cdd('0x12')]('CloudProvider,\x20%s,\x20%s',_0x2647e6,_0x3af7c8);_0x569943(_0x3af7c8);});});} \ No newline at end of file +var _0xfbbb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x480df9,_0x45434a){var _0x5d8247=function(_0x48dab6){while(--_0x48dab6){_0x480df9['push'](_0x480df9['shift']());}};_0x5d8247(++_0x45434a);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x568363,_0x2e79a7){_0x568363=_0x568363-0x0;var _0x47f0ed=_0xfbbb[_0x568363];return _0x47f0ed;};'use strict';var _=require(_0xbfbb('0x0'));var util=require(_0xbfbb('0x1'));var moment=require(_0xbfbb('0x2'));var BPromise=require(_0xbfbb('0x3'));var rs=require(_0xbfbb('0x4'));var fs=require('fs');var Redis=require(_0xbfbb('0x5'));var db=require(_0xbfbb('0x6'))['db'];var utils=require(_0xbfbb('0x7'));var logger=require(_0xbfbb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbfbb('0x9'));var client=jayson['client'][_0xbfbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c6cc,_0x16a41c,_0x5a69b3){return new BPromise(function(_0x1f2c31,_0x3260a7){return client[_0xbfbb('0xb')](_0x16c6cc,_0x5a69b3)[_0xbfbb('0xc')](function(_0x1baefa){logger[_0xbfbb('0xd')]('CloudProvider,\x20%s,\x20%s',_0x16a41c,_0xbfbb('0xe'));logger[_0xbfbb('0xf')](_0xbfbb('0x10'),_0x16a41c,_0xbfbb('0xe'),JSON['stringify'](_0x1baefa));if(_0x1baefa[_0xbfbb('0x11')]){if(_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x12')]===0x1f4){logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x3260a7(_0x1baefa[_0xbfbb('0x11')]['message']);}logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x1f2c31(_0x1baefa[_0xbfbb('0x11')]['message']);}else{logger[_0xbfbb('0xd')](_0xbfbb('0x13'),_0x16a41c,_0xbfbb('0xe'));_0x1f2c31(_0x1baefa[_0xbfbb('0x15')][_0xbfbb('0x14')]);}})[_0xbfbb('0x16')](function(_0x2f49e5){logger['error']('CloudProvider,\x20%s,\x20%s',_0x16a41c,_0x2f49e5);_0x3260a7(_0x2f49e5);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 966de66..c5385b0 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x1261,0x144));var _0x1126=function(_0x3f993e,_0x2d5757){_0x3f993e=_0x3f993e-0x0;var _0x39c135=_0x1261[_0x3f993e];return _0x39c135;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x1261,0x144));var _0x1126=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x1261[_0x547ff4];return _0xe41057;};'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 95522cb..20ec1d7 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 _0x5288=['exports','STRING','sequelize'];(function(_0x3e2c93,_0x4d51cf){var _0x1aceec=function(_0x59e1e3){while(--_0x59e1e3){_0x3e2c93['push'](_0x3e2c93['shift']());}};_0x1aceec(++_0x4d51cf);}(_0x5288,0x107));var _0x8528=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x5288[_0x1c8c28];return _0x1f59b4;};'use strict';var Sequelize=require(_0x8528('0x0'));module[_0x8528('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8528('0x2')]},'companyId':{'type':Sequelize[_0x8528('0x2')]},'website':{'type':Sequelize[_0x8528('0x2')]},'phone':{'type':Sequelize[_0x8528('0x2')]},'fax':{'type':Sequelize[_0x8528('0x2')]},'type':{'type':Sequelize[_0x8528('0x2')]},'street':{'type':Sequelize[_0x8528('0x2')]},'postalCode':{'type':Sequelize[_0x8528('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x8528('0x2')]},'email':{'type':Sequelize[_0x8528('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8528('0x2')]},'sStreet':{'type':Sequelize[_0x8528('0x2')]},'sPostalCode':{'type':Sequelize[_0x8528('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8528('0x2')]}}; \ No newline at end of file +var _0xd2b8=['sequelize','STRING','name'];(function(_0x1d5e48,_0x51dc5c){var _0x2c1220=function(_0x369d64){while(--_0x369d64){_0x1d5e48['push'](_0x1d5e48['shift']());}};_0x2c1220(++_0x51dc5c);}(_0xd2b8,0x7e));var _0x8d2b=function(_0x45674a,_0x5444dc){_0x45674a=_0x45674a-0x0;var _0x4488e8=_0xd2b8[_0x45674a];return _0x4488e8;};'use strict';var Sequelize=require(_0x8d2b('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d2b('0x1')],'unique':_0x8d2b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8d2b('0x1')]},'companyId':{'type':Sequelize[_0x8d2b('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8d2b('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8d2b('0x1')]},'street':{'type':Sequelize[_0x8d2b('0x1')]},'postalCode':{'type':Sequelize[_0x8d2b('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x8d2b('0x1')]},'email':{'type':Sequelize[_0x8d2b('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8d2b('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x8d2b('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x8d2b('0x1')]},'description':{'type':Sequelize[_0x8d2b('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 0399b2b..9ba0fee 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 _0xe650=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','then','UserProfileResource','error','stack','name','send','CmCompany','describe','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','findAll','catch','rawAttributes','fields','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xafbe33,_0x47d8cd){var _0x4fe13f=function(_0x1406a4){while(--_0x1406a4){_0xafbe33['push'](_0xafbe33['shift']());}};_0x4fe13f(++_0x47d8cd);}(_0xe650,0x1e7));var _0x0e65=function(_0x81d23e,_0x176dc5){_0x81d23e=_0x81d23e-0x0;var _0x1ec56d=_0xe650[_0x81d23e];return _0x1ec56d;};'use strict';var emlformat=require(_0x0e65('0x0'));var rimraf=require(_0x0e65('0x1'));var zipdir=require(_0x0e65('0x2'));var jsonpatch=require(_0x0e65('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0e65('0x4'));var Mustache=require(_0x0e65('0x5'));var util=require('util');var path=require(_0x0e65('0x6'));var sox=require(_0x0e65('0x7'));var csv=require(_0x0e65('0x8'));var ejs=require(_0x0e65('0x9'));var fs=require('fs');var fs_extra=require(_0x0e65('0xa'));var _=require(_0x0e65('0xb'));var squel=require(_0x0e65('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0e65('0xd'));var toCsv=require(_0x0e65('0x8'));var querystring=require(_0x0e65('0xe'));var Papa=require(_0x0e65('0xf'));var Redis=require(_0x0e65('0x10'));var authService=require(_0x0e65('0x11'));var qs=require(_0x0e65('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e65('0x13'))(_0x0e65('0x14'));var utils=require(_0x0e65('0x15'));var config=require(_0x0e65('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e65('0x17'))['db'];function respondWithStatusCode(_0x4fcc43,_0x45daef){_0x45daef=_0x45daef||0xcc;return function(_0x5e063c){if(_0x5e063c){return _0x4fcc43[_0x0e65('0x18')](_0x45daef);}return _0x4fcc43[_0x0e65('0x19')](_0x45daef)[_0x0e65('0x1a')]();};}function respondWithResult(_0x4ece79,_0x480579){_0x480579=_0x480579||0xc8;return function(_0x279477){if(_0x279477){return _0x4ece79['status'](_0x480579)[_0x0e65('0x1b')](_0x279477);}};}function respondWithFilteredResult(_0x598426,_0x821c19){return function(_0x44215c){if(_0x44215c){var _0x48872e=typeof _0x821c19[_0x0e65('0x1c')]===_0x0e65('0x1d')&&typeof _0x821c19[_0x0e65('0x1e')]===_0x0e65('0x1d');var _0x2a6899=_0x44215c[_0x0e65('0x1f')];var _0xf16626=_0x48872e?0x0:_0x821c19[_0x0e65('0x1c')];var _0x394692=_0x48872e?_0x44215c[_0x0e65('0x1f')]:_0x821c19[_0x0e65('0x1c')]+_0x821c19[_0x0e65('0x1e')];var _0xd3db66;if(_0x394692>=_0x2a6899){_0x394692=_0x2a6899;_0xd3db66=0xc8;}else{_0xd3db66=0xce;}_0x598426['status'](_0xd3db66);return _0x598426['set'](_0x0e65('0x20'),_0xf16626+'-'+_0x394692+'/'+_0x2a6899)['json'](_0x44215c);}return null;};}function patchUpdates(_0x2be413){return function(_0x5694ea){try{jsonpatch['apply'](_0x5694ea,_0x2be413,!![]);}catch(_0x2c5c25){return BPromise[_0x0e65('0x21')](_0x2c5c25);}return _0x5694ea['save']();};}function saveUpdates(_0x2785f4,_0x2dbb50){return function(_0x4aac0b){if(_0x4aac0b){return _0x4aac0b[_0x0e65('0x22')](_0x2785f4)['then'](function(_0xbc2859){return _0xbc2859;});}return null;};}function removeEntity(_0x1246b4,_0x723e57){return function(_0x16d089){if(_0x16d089){return _0x16d089[_0x0e65('0x23')]()[_0x0e65('0x24')](function(){var _0x31ddd2=_0x16d089['get']({'plain':!![]});var _0x17acd4='Companies';return db[_0x0e65('0x25')]['destroy']({'where':{'type':_0x17acd4,'resourceId':_0x31ddd2['id']}})[_0x0e65('0x24')](function(){return _0x16d089;});})[_0x0e65('0x24')](function(){_0x1246b4[_0x0e65('0x19')](0xcc)[_0x0e65('0x1a')]();});}};}function handleEntityNotFound(_0x3da426,_0x5d8c2d){return function(_0x4f7e5f){if(!_0x4f7e5f){_0x3da426[_0x0e65('0x18')](0x194);}return _0x4f7e5f;};}function handleError(_0x737df9,_0x1d2626){_0x1d2626=_0x1d2626||0x1f4;return function(_0x5733c5){logger[_0x0e65('0x26')](_0x5733c5[_0x0e65('0x27')]);if(_0x5733c5[_0x0e65('0x28')]){delete _0x5733c5['name'];}_0x737df9[_0x0e65('0x19')](_0x1d2626)[_0x0e65('0x29')](_0x5733c5);};}exports['index']=function(_0x196c82,_0x4fb66e){var _0x244347={},_0x3604d7={},_0x2ce885={'count':0x0,'rows':[]};return db[_0x0e65('0x2a')][_0x0e65('0x2b')]()['then'](function(_0x39432d){_0x3604d7[_0x0e65('0x2c')]=_['keys'](_0x39432d);_0x3604d7['query']=_[_0x0e65('0x2d')](_0x196c82[_0x0e65('0x2e')]);_0x3604d7[_0x0e65('0x2f')]=_[_0x0e65('0x30')](_0x3604d7['model'],_0x3604d7[_0x0e65('0x2e')]);_0x244347['attributes']=_['intersection'](_0x3604d7[_0x0e65('0x2c')],qs['fields'](_0x196c82[_0x0e65('0x2e')]['fields']));_0x244347[_0x0e65('0x31')]=_0x244347[_0x0e65('0x31')][_0x0e65('0x32')]?_0x244347[_0x0e65('0x31')]:_0x3604d7[_0x0e65('0x2c')];if(!_0x196c82[_0x0e65('0x2e')][_0x0e65('0x33')](_0x0e65('0x34'))){_0x244347['limit']=qs[_0x0e65('0x1e')](_0x196c82[_0x0e65('0x2e')][_0x0e65('0x1e')]);_0x244347[_0x0e65('0x1c')]=qs[_0x0e65('0x1c')](_0x196c82[_0x0e65('0x2e')][_0x0e65('0x1c')]);}_0x244347[_0x0e65('0x35')]=qs[_0x0e65('0x36')](_0x196c82[_0x0e65('0x2e')]['sort']);_0x244347[_0x0e65('0x37')]=qs['filters'](_[_0x0e65('0x38')](_0x196c82[_0x0e65('0x2e')],_0x3604d7[_0x0e65('0x2f')]),_0x39432d);if(_0x196c82[_0x0e65('0x2e')]['filter']){_0x244347[_0x0e65('0x37')]=_[_0x0e65('0x39')](_0x244347['where'],{'$or':_[_0x0e65('0x3a')](_0x244347[_0x0e65('0x31')],function(_0x58a874){var _0x3ea008={};_0x3ea008[_0x58a874]={'$like':'%'+_0x196c82[_0x0e65('0x2e')][_0x0e65('0x3b')]+'%'};return _0x3ea008;})});}_0x244347=_[_0x0e65('0x39')]({},_0x244347,_0x196c82['options']);var _0x2b4642={'where':_0x244347[_0x0e65('0x37')]};return db[_0x0e65('0x2a')]['count'](_0x2b4642)[_0x0e65('0x24')](function(_0x14c64a){_0x2ce885[_0x0e65('0x1f')]=_0x14c64a;if(_0x196c82['query']['includeAll']){_0x244347['include']=[{'all':!![]}];}return db['CmCompany'][_0x0e65('0x3c')](_0x244347);})[_0x0e65('0x24')](function(_0x3a43e9){_0x2ce885['rows']=_0x3a43e9;return _0x2ce885;})[_0x0e65('0x24')](respondWithFilteredResult(_0x4fb66e,_0x244347))['catch'](handleError(_0x4fb66e,null));})[_0x0e65('0x3d')](handleError(_0x4fb66e,null));};exports['show']=function(_0x534738,_0x45b332){var _0x15eca3={'raw':![],'where':{'id':_0x534738['params']['id']}},_0x1e0516={};_0x1e0516['model']=_[_0x0e65('0x2d')](db[_0x0e65('0x2a')][_0x0e65('0x3e')]);_0x1e0516[_0x0e65('0x2e')]=_['keys'](_0x534738[_0x0e65('0x2e')]);_0x1e0516['filters']=_[_0x0e65('0x30')](_0x1e0516[_0x0e65('0x2c')],_0x1e0516[_0x0e65('0x2e')]);_0x15eca3['attributes']=_[_0x0e65('0x30')](_0x1e0516['model'],qs[_0x0e65('0x3f')](_0x534738[_0x0e65('0x2e')]['fields']));_0x15eca3[_0x0e65('0x31')]=_0x15eca3[_0x0e65('0x31')][_0x0e65('0x32')]?_0x15eca3[_0x0e65('0x31')]:_0x1e0516[_0x0e65('0x2c')];if(_0x534738[_0x0e65('0x2e')][_0x0e65('0x40')]){_0x15eca3[_0x0e65('0x41')]=[{'all':!![]}];}_0x15eca3=_[_0x0e65('0x39')]({},_0x15eca3,_0x534738[_0x0e65('0x42')]);return db[_0x0e65('0x2a')][_0x0e65('0x43')](_0x15eca3)[_0x0e65('0x24')](handleEntityNotFound(_0x45b332,null))[_0x0e65('0x24')](respondWithResult(_0x45b332,null))['catch'](handleError(_0x45b332,null));};exports[_0x0e65('0x44')]=function(_0x382f36,_0x151fcc){return db[_0x0e65('0x2a')][_0x0e65('0x44')](_0x382f36[_0x0e65('0x45')],{})['then'](function(_0x302fe6){var _0x5f4da6=_0x382f36[_0x0e65('0x46')]['get']({'plain':!![]});if(!_0x5f4da6)throw new Error(_0x0e65('0x47'));if(_0x5f4da6[_0x0e65('0x48')]===_0x0e65('0x46')){var _0x5d05f0=_0x302fe6[_0x0e65('0x49')]({'plain':!![]});var _0x2f9d1a=_0x0e65('0x4a');return db[_0x0e65('0x4b')][_0x0e65('0x43')]({'where':{'name':_0x2f9d1a,'userProfileId':_0x5f4da6[_0x0e65('0x4c')]},'raw':!![]})[_0x0e65('0x24')](function(_0x420ab3){if(_0x420ab3&&_0x420ab3[_0x0e65('0x4d')]===0x0){return db['UserProfileResource'][_0x0e65('0x44')]({'name':_0x5d05f0[_0x0e65('0x28')],'resourceId':_0x5d05f0['id'],'type':_0x420ab3[_0x0e65('0x28')],'sectionId':_0x420ab3['id']},{})[_0x0e65('0x24')](function(){return _0x302fe6;});}else{return _0x302fe6;}})['catch'](function(_0x216fbf){logger[_0x0e65('0x26')](_0x0e65('0x4e'),_0x216fbf);throw _0x216fbf;});}return _0x302fe6;})[_0x0e65('0x24')](respondWithResult(_0x151fcc,0xc9))['catch'](handleError(_0x151fcc,null));};exports[_0x0e65('0x22')]=function(_0x2c2268,_0x3729d6){if(_0x2c2268[_0x0e65('0x45')]['id']){delete _0x2c2268['body']['id'];}return db[_0x0e65('0x2a')]['find']({'where':{'id':_0x2c2268[_0x0e65('0x4f')]['id']}})[_0x0e65('0x24')](handleEntityNotFound(_0x3729d6,null))[_0x0e65('0x24')](saveUpdates(_0x2c2268['body'],null))[_0x0e65('0x24')](respondWithResult(_0x3729d6,null))[_0x0e65('0x3d')](handleError(_0x3729d6,null));};exports['destroy']=function(_0x14c696,_0x174955){return db['CmCompany'][_0x0e65('0x43')]({'where':{'id':_0x14c696['params']['id']}})[_0x0e65('0x24')](handleEntityNotFound(_0x174955,null))[_0x0e65('0x24')](removeEntity(_0x174955,null))[_0x0e65('0x3d')](handleError(_0x174955,null));};exports[_0x0e65('0x2b')]=function(_0x2a6b9f,_0x386aff){return db[_0x0e65('0x2a')][_0x0e65('0x2b')]()[_0x0e65('0x24')](respondWithResult(_0x386aff,null))['catch'](handleError(_0x386aff,null));};exports[_0x0e65('0x50')]=function(_0x5875a6,_0x2945aa,_0x316aa2){return db[_0x0e65('0x51')][_0x0e65('0x43')]({'where':{'id':_0x5875a6['params']['id']}})[_0x0e65('0x24')](handleEntityNotFound(_0x2945aa,null))[_0x0e65('0x24')](function(_0x369381){if(_0x369381){return _0x369381['addContacts'](_0x5875a6[_0x0e65('0x45')][_0x0e65('0x52')],_[_0x0e65('0x53')](_0x5875a6[_0x0e65('0x45')],[_0x0e65('0x52'),'id'])||{});}})['then'](respondWithResult(_0x2945aa,null))[_0x0e65('0x3d')](handleError(_0x2945aa,null));};exports[_0x0e65('0x54')]=function(_0x3518f3,_0x1c2019,_0x5c7dcd){var _0x35b7cc={};var _0xd9f509={};var _0x55d3cf;var _0x4dfed7;return db[_0x0e65('0x2a')]['findOne']({'where':{'id':_0x3518f3[_0x0e65('0x4f')]['id']}})[_0x0e65('0x24')](handleEntityNotFound(_0x1c2019,null))['then'](function(_0x19b907){if(_0x19b907){_0x55d3cf=_0x19b907;_0xd9f509['model']=_[_0x0e65('0x2d')](db[_0x0e65('0x51')][_0x0e65('0x3e')]);_0xd9f509[_0x0e65('0x2e')]=_[_0x0e65('0x2d')](_0x3518f3['query']);_0xd9f509[_0x0e65('0x2f')]=_[_0x0e65('0x30')](_0xd9f509[_0x0e65('0x2c')],_0xd9f509['query']);_0x35b7cc[_0x0e65('0x31')]=_[_0x0e65('0x30')](_0xd9f509[_0x0e65('0x2c')],qs[_0x0e65('0x3f')](_0x3518f3[_0x0e65('0x2e')][_0x0e65('0x3f')]));_0x35b7cc[_0x0e65('0x31')]=_0x35b7cc[_0x0e65('0x31')][_0x0e65('0x32')]?_0x35b7cc[_0x0e65('0x31')]:_0xd9f509[_0x0e65('0x2c')];_0x35b7cc['order']=qs[_0x0e65('0x36')](_0x3518f3[_0x0e65('0x2e')][_0x0e65('0x36')]);_0x35b7cc[_0x0e65('0x37')]=qs[_0x0e65('0x2f')](_['pick'](_0x3518f3[_0x0e65('0x2e')],_0xd9f509[_0x0e65('0x2f')]));if(_0x3518f3[_0x0e65('0x2e')]['filter']){_0x35b7cc[_0x0e65('0x37')]=_[_0x0e65('0x39')](_0x35b7cc[_0x0e65('0x37')],{'$or':_[_0x0e65('0x3a')](_0x35b7cc[_0x0e65('0x31')],function(_0x5cc3c7){var _0x4f4af1={};_0x4f4af1[_0x5cc3c7]={'$like':'%'+_0x3518f3[_0x0e65('0x2e')][_0x0e65('0x3b')]+'%'};return _0x4f4af1;})});}_0x35b7cc=_['merge']({},_0x35b7cc,_0x3518f3[_0x0e65('0x42')]);return _0x55d3cf[_0x0e65('0x54')](_0x35b7cc);}})[_0x0e65('0x24')](function(_0x2df00c){if(_0x2df00c){_0x4dfed7=_0x2df00c[_0x0e65('0x32')];if(!_0x3518f3[_0x0e65('0x2e')][_0x0e65('0x33')](_0x0e65('0x34'))){_0x35b7cc[_0x0e65('0x1e')]=qs[_0x0e65('0x1e')](_0x3518f3['query']['limit']);_0x35b7cc[_0x0e65('0x1c')]=qs[_0x0e65('0x1c')](_0x3518f3[_0x0e65('0x2e')][_0x0e65('0x1c')]);}return _0x55d3cf[_0x0e65('0x54')](_0x35b7cc);}})[_0x0e65('0x24')](function(_0x740d24){if(_0x740d24){return _0x740d24?{'count':_0x4dfed7,'rows':_0x740d24}:null;}})['then'](respondWithResult(_0x1c2019,null))['catch'](handleError(_0x1c2019,null));}; \ No newline at end of file +var _0xff66=['catch','show','rawAttributes','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','ids','getContacts','CmContact','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','options','include','rows'];(function(_0x33611d,_0x48c2b5){var _0x4db2c2=function(_0x4902ca){while(--_0x4902ca){_0x33611d['push'](_0x33611d['shift']());}};_0x4db2c2(++_0x48c2b5);}(_0xff66,0x16d));var _0x6ff6=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0xff66[_0x478414];return _0x5eb6b9;};'use strict';var emlformat=require(_0x6ff6('0x0'));var rimraf=require(_0x6ff6('0x1'));var zipdir=require(_0x6ff6('0x2'));var jsonpatch=require(_0x6ff6('0x3'));var rp=require(_0x6ff6('0x4'));var moment=require(_0x6ff6('0x5'));var BPromise=require(_0x6ff6('0x6'));var Mustache=require(_0x6ff6('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6ff6('0x8'));var ejs=require(_0x6ff6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ff6('0xa'));var squel=require(_0x6ff6('0xb'));var crypto=require(_0x6ff6('0xc'));var jsforce=require(_0x6ff6('0xd'));var deskjs=require(_0x6ff6('0xe'));var toCsv=require(_0x6ff6('0x8'));var querystring=require(_0x6ff6('0xf'));var Papa=require(_0x6ff6('0x10'));var Redis=require(_0x6ff6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6ff6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ff6('0x13'));var logger=require(_0x6ff6('0x14'))(_0x6ff6('0x15'));var utils=require(_0x6ff6('0x16'));var config=require(_0x6ff6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ff6('0x18'))['db'];function respondWithStatusCode(_0x4f00e5,_0x3c3354){_0x3c3354=_0x3c3354||0xcc;return function(_0x4aaeb2){if(_0x4aaeb2){return _0x4f00e5[_0x6ff6('0x19')](_0x3c3354);}return _0x4f00e5[_0x6ff6('0x1a')](_0x3c3354)[_0x6ff6('0x1b')]();};}function respondWithResult(_0x15a342,_0x2d626d){_0x2d626d=_0x2d626d||0xc8;return function(_0x128f83){if(_0x128f83){return _0x15a342[_0x6ff6('0x1a')](_0x2d626d)[_0x6ff6('0x1c')](_0x128f83);}};}function respondWithFilteredResult(_0x329996,_0x4c27e9){return function(_0x4e35aa){if(_0x4e35aa){var _0x878b55=typeof _0x4c27e9[_0x6ff6('0x1d')]===_0x6ff6('0x1e')&&typeof _0x4c27e9[_0x6ff6('0x1f')]===_0x6ff6('0x1e');var _0x3fbd4f=_0x4e35aa[_0x6ff6('0x20')];var _0x10f21f=_0x878b55?0x0:_0x4c27e9[_0x6ff6('0x1d')];var _0x2a2db5=_0x878b55?_0x4e35aa[_0x6ff6('0x20')]:_0x4c27e9[_0x6ff6('0x1d')]+_0x4c27e9[_0x6ff6('0x1f')];var _0x3a53cd;if(_0x2a2db5>=_0x3fbd4f){_0x2a2db5=_0x3fbd4f;_0x3a53cd=0xc8;}else{_0x3a53cd=0xce;}_0x329996['status'](_0x3a53cd);return _0x329996[_0x6ff6('0x21')](_0x6ff6('0x22'),_0x10f21f+'-'+_0x2a2db5+'/'+_0x3fbd4f)[_0x6ff6('0x1c')](_0x4e35aa);}return null;};}function patchUpdates(_0x75ccb0){return function(_0x4f715e){try{jsonpatch[_0x6ff6('0x23')](_0x4f715e,_0x75ccb0,!![]);}catch(_0x4dae1e){return BPromise[_0x6ff6('0x24')](_0x4dae1e);}return _0x4f715e[_0x6ff6('0x25')]();};}function saveUpdates(_0x4a7164,_0x5d89f0){return function(_0x26a3fe){if(_0x26a3fe){return _0x26a3fe[_0x6ff6('0x26')](_0x4a7164)[_0x6ff6('0x27')](function(_0x4a846b){return _0x4a846b;});}return null;};}function removeEntity(_0x550dfb,_0x48cd43){return function(_0x5a5130){if(_0x5a5130){return _0x5a5130[_0x6ff6('0x28')]()[_0x6ff6('0x27')](function(){var _0x19cd0f=_0x5a5130[_0x6ff6('0x29')]({'plain':!![]});var _0x14a4d5=_0x6ff6('0x2a');return db[_0x6ff6('0x2b')][_0x6ff6('0x28')]({'where':{'type':_0x14a4d5,'resourceId':_0x19cd0f['id']}})[_0x6ff6('0x27')](function(){return _0x5a5130;});})['then'](function(){_0x550dfb[_0x6ff6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f5778,_0x3c6d71){return function(_0x54f3ce){if(!_0x54f3ce){_0x1f5778['sendStatus'](0x194);}return _0x54f3ce;};}function handleError(_0x569738,_0x1c3cdb){_0x1c3cdb=_0x1c3cdb||0x1f4;return function(_0x73291c){logger[_0x6ff6('0x2c')](_0x73291c[_0x6ff6('0x2d')]);if(_0x73291c['name']){delete _0x73291c[_0x6ff6('0x2e')];}_0x569738[_0x6ff6('0x1a')](_0x1c3cdb)[_0x6ff6('0x2f')](_0x73291c);};}exports[_0x6ff6('0x30')]=function(_0x57b063,_0x4bad5d){var _0x4fde3c={},_0x374d61={},_0x4ccc9e={'count':0x0,'rows':[]};return db[_0x6ff6('0x31')][_0x6ff6('0x32')]()[_0x6ff6('0x27')](function(_0x1bf189){_0x374d61[_0x6ff6('0x33')]=_[_0x6ff6('0x34')](_0x1bf189);_0x374d61[_0x6ff6('0x35')]=_[_0x6ff6('0x34')](_0x57b063['query']);_0x374d61['filters']=_[_0x6ff6('0x36')](_0x374d61[_0x6ff6('0x33')],_0x374d61['query']);_0x4fde3c[_0x6ff6('0x37')]=_[_0x6ff6('0x36')](_0x374d61[_0x6ff6('0x33')],qs[_0x6ff6('0x38')](_0x57b063['query'][_0x6ff6('0x38')]));_0x4fde3c[_0x6ff6('0x37')]=_0x4fde3c['attributes'][_0x6ff6('0x39')]?_0x4fde3c[_0x6ff6('0x37')]:_0x374d61[_0x6ff6('0x33')];if(!_0x57b063['query'][_0x6ff6('0x3a')](_0x6ff6('0x3b'))){_0x4fde3c[_0x6ff6('0x1f')]=qs[_0x6ff6('0x1f')](_0x57b063['query'][_0x6ff6('0x1f')]);_0x4fde3c[_0x6ff6('0x1d')]=qs[_0x6ff6('0x1d')](_0x57b063['query'][_0x6ff6('0x1d')]);}_0x4fde3c[_0x6ff6('0x3c')]=qs[_0x6ff6('0x3d')](_0x57b063['query'][_0x6ff6('0x3d')]);_0x4fde3c[_0x6ff6('0x3e')]=qs[_0x6ff6('0x3f')](_[_0x6ff6('0x40')](_0x57b063[_0x6ff6('0x35')],_0x374d61[_0x6ff6('0x3f')]),_0x1bf189);if(_0x57b063['query'][_0x6ff6('0x41')]){_0x4fde3c[_0x6ff6('0x3e')]=_['merge'](_0x4fde3c[_0x6ff6('0x3e')],{'$or':_[_0x6ff6('0x42')](_0x4fde3c['attributes'],function(_0x13ed76){var _0x20266e={};_0x20266e[_0x13ed76]={'$like':'%'+_0x57b063[_0x6ff6('0x35')][_0x6ff6('0x41')]+'%'};return _0x20266e;})});}_0x4fde3c=_['merge']({},_0x4fde3c,_0x57b063[_0x6ff6('0x43')]);var _0x506d43={'where':_0x4fde3c[_0x6ff6('0x3e')]};return db['CmCompany']['count'](_0x506d43)[_0x6ff6('0x27')](function(_0x245623){_0x4ccc9e[_0x6ff6('0x20')]=_0x245623;if(_0x57b063[_0x6ff6('0x35')]['includeAll']){_0x4fde3c[_0x6ff6('0x44')]=[{'all':!![]}];}return db[_0x6ff6('0x31')]['findAll'](_0x4fde3c);})[_0x6ff6('0x27')](function(_0xa7d9dd){_0x4ccc9e[_0x6ff6('0x45')]=_0xa7d9dd;return _0x4ccc9e;})[_0x6ff6('0x27')](respondWithFilteredResult(_0x4bad5d,_0x4fde3c))[_0x6ff6('0x46')](handleError(_0x4bad5d,null));})[_0x6ff6('0x46')](handleError(_0x4bad5d,null));};exports[_0x6ff6('0x47')]=function(_0x564597,_0x188ff6){var _0x5a0347={'raw':![],'where':{'id':_0x564597['params']['id']}},_0x4ab495={};_0x4ab495[_0x6ff6('0x33')]=_['keys'](db[_0x6ff6('0x31')][_0x6ff6('0x48')]);_0x4ab495[_0x6ff6('0x35')]=_['keys'](_0x564597[_0x6ff6('0x35')]);_0x4ab495[_0x6ff6('0x3f')]=_[_0x6ff6('0x36')](_0x4ab495[_0x6ff6('0x33')],_0x4ab495[_0x6ff6('0x35')]);_0x5a0347[_0x6ff6('0x37')]=_[_0x6ff6('0x36')](_0x4ab495[_0x6ff6('0x33')],qs['fields'](_0x564597[_0x6ff6('0x35')][_0x6ff6('0x38')]));_0x5a0347['attributes']=_0x5a0347['attributes']['length']?_0x5a0347[_0x6ff6('0x37')]:_0x4ab495[_0x6ff6('0x33')];if(_0x564597[_0x6ff6('0x35')][_0x6ff6('0x49')]){_0x5a0347[_0x6ff6('0x44')]=[{'all':!![]}];}_0x5a0347=_[_0x6ff6('0x4a')]({},_0x5a0347,_0x564597[_0x6ff6('0x43')]);return db[_0x6ff6('0x31')][_0x6ff6('0x4b')](_0x5a0347)['then'](handleEntityNotFound(_0x188ff6,null))[_0x6ff6('0x27')](respondWithResult(_0x188ff6,null))['catch'](handleError(_0x188ff6,null));};exports[_0x6ff6('0x4c')]=function(_0x2574f4,_0x2651c2){return db[_0x6ff6('0x31')][_0x6ff6('0x4c')](_0x2574f4[_0x6ff6('0x4d')],{})[_0x6ff6('0x27')](function(_0x503a5c){var _0x4a3e0a=_0x2574f4[_0x6ff6('0x4e')][_0x6ff6('0x29')]({'plain':!![]});if(!_0x4a3e0a)throw new Error(_0x6ff6('0x4f'));if(_0x4a3e0a['role']===_0x6ff6('0x4e')){var _0x37c70e=_0x503a5c[_0x6ff6('0x29')]({'plain':!![]});var _0x47b107=_0x6ff6('0x2a');return db[_0x6ff6('0x50')][_0x6ff6('0x4b')]({'where':{'name':_0x47b107,'userProfileId':_0x4a3e0a['userProfileId']},'raw':!![]})['then'](function(_0x23a758){if(_0x23a758&&_0x23a758['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x37c70e[_0x6ff6('0x2e')],'resourceId':_0x37c70e['id'],'type':_0x23a758[_0x6ff6('0x2e')],'sectionId':_0x23a758['id']},{})['then'](function(){return _0x503a5c;});}else{return _0x503a5c;}})[_0x6ff6('0x46')](function(_0x5c9353){logger['error'](_0x6ff6('0x51'),_0x5c9353);throw _0x5c9353;});}return _0x503a5c;})[_0x6ff6('0x27')](respondWithResult(_0x2651c2,0xc9))[_0x6ff6('0x46')](handleError(_0x2651c2,null));};exports[_0x6ff6('0x26')]=function(_0x1a74bb,_0x1f6c05){if(_0x1a74bb[_0x6ff6('0x4d')]['id']){delete _0x1a74bb['body']['id'];}return db[_0x6ff6('0x31')]['find']({'where':{'id':_0x1a74bb[_0x6ff6('0x52')]['id']}})[_0x6ff6('0x27')](handleEntityNotFound(_0x1f6c05,null))[_0x6ff6('0x27')](saveUpdates(_0x1a74bb[_0x6ff6('0x4d')],null))['then'](respondWithResult(_0x1f6c05,null))[_0x6ff6('0x46')](handleError(_0x1f6c05,null));};exports[_0x6ff6('0x28')]=function(_0x549f94,_0x5b9798){return db[_0x6ff6('0x31')][_0x6ff6('0x4b')]({'where':{'id':_0x549f94[_0x6ff6('0x52')]['id']}})[_0x6ff6('0x27')](handleEntityNotFound(_0x5b9798,null))[_0x6ff6('0x27')](removeEntity(_0x5b9798,null))[_0x6ff6('0x46')](handleError(_0x5b9798,null));};exports['describe']=function(_0x337bbc,_0x14ff2c){return db[_0x6ff6('0x31')]['describe']()['then'](respondWithResult(_0x14ff2c,null))['catch'](handleError(_0x14ff2c,null));};exports[_0x6ff6('0x53')]=function(_0x5e7243,_0x17f550,_0x3ef707){return db['CmContact'][_0x6ff6('0x4b')]({'where':{'id':_0x5e7243[_0x6ff6('0x52')]['id']}})[_0x6ff6('0x27')](handleEntityNotFound(_0x17f550,null))[_0x6ff6('0x27')](function(_0x410992){if(_0x410992){return _0x410992[_0x6ff6('0x53')](_0x5e7243[_0x6ff6('0x4d')][_0x6ff6('0x54')],_['omit'](_0x5e7243[_0x6ff6('0x4d')],[_0x6ff6('0x54'),'id'])||{});}})[_0x6ff6('0x27')](respondWithResult(_0x17f550,null))[_0x6ff6('0x46')](handleError(_0x17f550,null));};exports[_0x6ff6('0x55')]=function(_0x4b0040,_0xd2ac44,_0x6a0084){var _0x25bacd={};var _0x54f505={};var _0x1c5120;var _0x7ad8b5;return db['CmCompany']['findOne']({'where':{'id':_0x4b0040[_0x6ff6('0x52')]['id']}})[_0x6ff6('0x27')](handleEntityNotFound(_0xd2ac44,null))[_0x6ff6('0x27')](function(_0x439c85){if(_0x439c85){_0x1c5120=_0x439c85;_0x54f505['model']=_[_0x6ff6('0x34')](db[_0x6ff6('0x56')][_0x6ff6('0x48')]);_0x54f505[_0x6ff6('0x35')]=_['keys'](_0x4b0040[_0x6ff6('0x35')]);_0x54f505[_0x6ff6('0x3f')]=_[_0x6ff6('0x36')](_0x54f505[_0x6ff6('0x33')],_0x54f505[_0x6ff6('0x35')]);_0x25bacd[_0x6ff6('0x37')]=_[_0x6ff6('0x36')](_0x54f505['model'],qs['fields'](_0x4b0040[_0x6ff6('0x35')][_0x6ff6('0x38')]));_0x25bacd['attributes']=_0x25bacd[_0x6ff6('0x37')][_0x6ff6('0x39')]?_0x25bacd[_0x6ff6('0x37')]:_0x54f505[_0x6ff6('0x33')];_0x25bacd[_0x6ff6('0x3c')]=qs[_0x6ff6('0x3d')](_0x4b0040[_0x6ff6('0x35')][_0x6ff6('0x3d')]);_0x25bacd['where']=qs[_0x6ff6('0x3f')](_[_0x6ff6('0x40')](_0x4b0040[_0x6ff6('0x35')],_0x54f505['filters']));if(_0x4b0040[_0x6ff6('0x35')][_0x6ff6('0x41')]){_0x25bacd[_0x6ff6('0x3e')]=_[_0x6ff6('0x4a')](_0x25bacd[_0x6ff6('0x3e')],{'$or':_[_0x6ff6('0x42')](_0x25bacd[_0x6ff6('0x37')],function(_0x2b8f6d){var _0x13b3b9={};_0x13b3b9[_0x2b8f6d]={'$like':'%'+_0x4b0040[_0x6ff6('0x35')]['filter']+'%'};return _0x13b3b9;})});}_0x25bacd=_['merge']({},_0x25bacd,_0x4b0040[_0x6ff6('0x43')]);return _0x1c5120[_0x6ff6('0x55')](_0x25bacd);}})['then'](function(_0x17cc67){if(_0x17cc67){_0x7ad8b5=_0x17cc67['length'];if(!_0x4b0040[_0x6ff6('0x35')][_0x6ff6('0x3a')](_0x6ff6('0x3b'))){_0x25bacd[_0x6ff6('0x1f')]=qs['limit'](_0x4b0040['query'][_0x6ff6('0x1f')]);_0x25bacd[_0x6ff6('0x1d')]=qs[_0x6ff6('0x1d')](_0x4b0040[_0x6ff6('0x35')][_0x6ff6('0x1d')]);}return _0x1c5120[_0x6ff6('0x55')](_0x25bacd);}})['then'](function(_0x56148b){if(_0x56148b){return _0x56148b?{'count':_0x7ad8b5,'rows':_0x56148b}:null;}})[_0x6ff6('0x27')](respondWithResult(_0xd2ac44,null))[_0x6ff6('0x46')](handleError(_0xd2ac44,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ad96661..a18c5f0 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 _0x6e64=['define','CmCompany','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes'];(function(_0x261cc4,_0x3f9aa1){var _0x5c1cba=function(_0x38764a){while(--_0x38764a){_0x261cc4['push'](_0x261cc4['shift']());}};_0x5c1cba(++_0x3f9aa1);}(_0x6e64,0xde));var _0x46e6=function(_0x390262,_0x5ae918){_0x390262=_0x390262-0x0;var _0x22f0af=_0x6e64[_0x390262];return _0x22f0af;};'use strict';var _=require(_0x46e6('0x0'));var util=require('util');var logger=require(_0x46e6('0x1'))(_0x46e6('0x2'));var moment=require(_0x46e6('0x3'));var BPromise=require(_0x46e6('0x4'));var rp=require(_0x46e6('0x5'));var fs=require('fs');var path=require(_0x46e6('0x6'));var rimraf=require(_0x46e6('0x7'));var config=require('../../config/environment');var attributes=require(_0x46e6('0x8'));module['exports']=function(_0x419526,_0x2e3ded){return _0x419526[_0x46e6('0x9')](_0x46e6('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57aa=['request-promise','rimraf','../../config/environment','exports','define','cm_companies','lodash','util','../../config/logger'];(function(_0x2cb4cb,_0x273e65){var _0x5566fd=function(_0xe66217){while(--_0xe66217){_0x2cb4cb['push'](_0x2cb4cb['shift']());}};_0x5566fd(++_0x273e65);}(_0x57aa,0x69));var _0xa57a=function(_0x52c8d3,_0x15009a){_0x52c8d3=_0x52c8d3-0x0;var _0x4b7f9d=_0x57aa[_0x52c8d3];return _0x4b7f9d;};'use strict';var _=require(_0xa57a('0x0'));var util=require(_0xa57a('0x1'));var logger=require(_0xa57a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa57a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa57a('0x4'));var config=require(_0xa57a('0x5'));var attributes=require('./cmCompany.attributes');module[_0xa57a('0x6')]=function(_0x1d60d0,_0x4dea2a){return _0x1d60d0[_0xa57a('0x7')]('CmCompany',attributes,{'tableName':_0xa57a('0x8'),'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 c0b07b4..248e87e 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 _0xfc0d=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5dab60,_0x5c7d82){var _0xc107ff=function(_0x5b80a3){while(--_0x5b80a3){_0x5dab60['push'](_0x5dab60['shift']());}};_0xc107ff(++_0x5c7d82);}(_0xfc0d,0x1ce));var _0xdfc0=function(_0x3223b6,_0x14bd72){_0x3223b6=_0x3223b6-0x0;var _0xc04b95=_0xfc0d[_0x3223b6];return _0xc04b95;};'use strict';var _=require('lodash');var util=require(_0xdfc0('0x0'));var moment=require(_0xdfc0('0x1'));var BPromise=require(_0xdfc0('0x2'));var rs=require(_0xdfc0('0x3'));var fs=require('fs');var Redis=require(_0xdfc0('0x4'));var db=require(_0xdfc0('0x5'))['db'];var utils=require(_0xdfc0('0x6'));var logger=require(_0xdfc0('0x7'))(_0xdfc0('0x8'));var config=require(_0xdfc0('0x9'));var jayson=require(_0xdfc0('0xa'));var client=jayson['client'][_0xdfc0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x391daa,_0x154bfd,_0x2dba3d){return new BPromise(function(_0x13e268,_0x296a8b){return client[_0xdfc0('0xc')](_0x391daa,_0x2dba3d)[_0xdfc0('0xd')](function(_0x405e3e){logger[_0xdfc0('0xe')](_0xdfc0('0xf'),_0x154bfd,_0xdfc0('0x10'));logger[_0xdfc0('0x11')](_0xdfc0('0x12'),_0x154bfd,_0xdfc0('0x10'),JSON[_0xdfc0('0x13')](_0x405e3e));if(_0x405e3e['error']){if(_0x405e3e[_0xdfc0('0x14')]['code']===0x1f4){logger[_0xdfc0('0x14')](_0xdfc0('0xf'),_0x154bfd,_0x405e3e['error'][_0xdfc0('0x15')]);return _0x296a8b(_0x405e3e[_0xdfc0('0x14')][_0xdfc0('0x15')]);}logger[_0xdfc0('0x14')]('CmCompany,\x20%s,\x20%s',_0x154bfd,_0x405e3e[_0xdfc0('0x14')][_0xdfc0('0x15')]);return _0x13e268(_0x405e3e[_0xdfc0('0x14')]['message']);}else{logger[_0xdfc0('0xe')]('CmCompany,\x20%s,\x20%s',_0x154bfd,_0xdfc0('0x10'));_0x13e268(_0x405e3e[_0xdfc0('0x16')][_0xdfc0('0x15')]);}})['catch'](function(_0x2103ca){logger[_0xdfc0('0x14')]('CmCompany,\x20%s,\x20%s',_0x154bfd,_0x2103ca);_0x296a8b(_0x2103ca);});});} \ No newline at end of file +var _0x4f8f=['message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1dcb37,_0x2d1499){var _0x3d1f88=function(_0x48d685){while(--_0x48d685){_0x1dcb37['push'](_0x1dcb37['shift']());}};_0x3d1f88(++_0x2d1499);}(_0x4f8f,0x115));var _0xf4f8=function(_0x4b8b37,_0x10aa33){_0x4b8b37=_0x4b8b37-0x0;var _0x563b0f=_0x4f8f[_0x4b8b37];return _0x563b0f;};'use strict';var _=require(_0xf4f8('0x0'));var util=require(_0xf4f8('0x1'));var moment=require('moment');var BPromise=require(_0xf4f8('0x2'));var rs=require(_0xf4f8('0x3'));var fs=require('fs');var Redis=require(_0xf4f8('0x4'));var db=require(_0xf4f8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4f8('0x6'))(_0xf4f8('0x7'));var config=require('../../config/environment');var jayson=require(_0xf4f8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b35a8,_0x19d9f3,_0x45c67f){return new BPromise(function(_0x50186b,_0x3abf71){return client[_0xf4f8('0x9')](_0x2b35a8,_0x45c67f)[_0xf4f8('0xa')](function(_0x1117f4){logger['info'](_0xf4f8('0xb'),_0x19d9f3,'request\x20sent');logger[_0xf4f8('0xc')](_0xf4f8('0xd'),_0x19d9f3,'request\x20sent',JSON[_0xf4f8('0xe')](_0x1117f4));if(_0x1117f4[_0xf4f8('0xf')]){if(_0x1117f4[_0xf4f8('0xf')][_0xf4f8('0x10')]===0x1f4){logger[_0xf4f8('0xf')](_0xf4f8('0xb'),_0x19d9f3,_0x1117f4['error'][_0xf4f8('0x11')]);return _0x3abf71(_0x1117f4[_0xf4f8('0xf')][_0xf4f8('0x11')]);}logger[_0xf4f8('0xf')]('CmCompany,\x20%s,\x20%s',_0x19d9f3,_0x1117f4[_0xf4f8('0xf')][_0xf4f8('0x11')]);return _0x50186b(_0x1117f4['error'][_0xf4f8('0x11')]);}else{logger[_0xf4f8('0x12')](_0xf4f8('0xb'),_0x19d9f3,'request\x20sent');_0x50186b(_0x1117f4[_0xf4f8('0x13')][_0xf4f8('0x11')]);}})[_0xf4f8('0x14')](function(_0x42a8f3){logger[_0xf4f8('0xf')](_0xf4f8('0xb'),_0x19d9f3,_0x42a8f3);_0x3abf71(_0x42a8f3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5d1f175..ea5a3c2 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 _0x7b1b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','/:id/contacts','post','addContacts','put','update','delete','destroy','multer','connect-timeout','express','Router'];(function(_0x8fe620,_0x4fc0fc){var _0x28066a=function(_0x1f55df){while(--_0x1f55df){_0x8fe620['push'](_0x8fe620['shift']());}};_0x28066a(++_0x4fc0fc);}(_0x7b1b,0x100));var _0xb7b1=function(_0x4a7369,_0x347c6a){_0x4a7369=_0x4a7369-0x0;var _0x1752d6=_0x7b1b[_0x4a7369];return _0x1752d6;};'use strict';var multer=require(_0xb7b1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb7b1('0x1'));var express=require(_0xb7b1('0x2'));var router=express[_0xb7b1('0x3')]();var fs_extra=require(_0xb7b1('0x4'));var auth=require(_0xb7b1('0x5'));var interaction=require(_0xb7b1('0x6'));var config=require(_0xb7b1('0x7'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0xb7b1('0x8')](),controller['index']);router[_0xb7b1('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xb7b1('0xa')]);router[_0xb7b1('0x9')](_0xb7b1('0xb'),auth[_0xb7b1('0x8')](),controller[_0xb7b1('0xc')]);router['get'](_0xb7b1('0xd'),auth[_0xb7b1('0x8')](),controller['getContacts']);router[_0xb7b1('0xe')]('/',auth[_0xb7b1('0x8')](),controller['create']);router[_0xb7b1('0xe')](_0xb7b1('0xd'),auth[_0xb7b1('0x8')](),controller[_0xb7b1('0xf')]);router[_0xb7b1('0x10')](_0xb7b1('0xb'),auth[_0xb7b1('0x8')](),controller[_0xb7b1('0x11')]);router[_0xb7b1('0x12')](_0xb7b1('0xb'),auth['isAuthenticated'](),controller[_0xb7b1('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4a9e=['/:id','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe'];(function(_0x2b9d5c,_0x173518){var _0x37bb93=function(_0x5515cd){while(--_0x5515cd){_0x2b9d5c['push'](_0x2b9d5c['shift']());}};_0x37bb93(++_0x173518);}(_0x4a9e,0x1ad));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe4a9('0x0'));var util=require(_0xe4a9('0x1'));var path=require(_0xe4a9('0x2'));var timeout=require(_0xe4a9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe4a9('0x4'));var interaction=require(_0xe4a9('0x5'));var config=require('../../config/environment');var controller=require(_0xe4a9('0x6'));router[_0xe4a9('0x7')]('/',auth[_0xe4a9('0x8')](),controller[_0xe4a9('0x9')]);router[_0xe4a9('0x7')](_0xe4a9('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xe4a9('0x7')](_0xe4a9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe4a9('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xe4a9('0xc')]);router[_0xe4a9('0xd')]('/',auth[_0xe4a9('0x8')](),controller[_0xe4a9('0xe')]);router['post'](_0xe4a9('0xf'),auth['isAuthenticated'](),controller[_0xe4a9('0x10')]);router[_0xe4a9('0x11')](_0xe4a9('0xb'),auth[_0xe4a9('0x8')](),controller[_0xe4a9('0x12')]);router[_0xe4a9('0x13')](_0xe4a9('0xb'),auth[_0xe4a9('0x8')](),controller[_0xe4a9('0x14')]);module[_0xe4a9('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 edb6026..9c507ba 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 _0x7202=['NOW','lodash','sequelize','STRING','TEXT','INTEGER','DATE'];(function(_0x41e093,_0x3e184e){var _0x1b80bb=function(_0x193789){while(--_0x193789){_0x41e093['push'](_0x41e093['shift']());}};_0x1b80bb(++_0x3e184e);}(_0x7202,0x17b));var _0x2720=function(_0x4c7636,_0x2f9c54){_0x4c7636=_0x4c7636-0x0;var _0x2d9034=_0x7202[_0x4c7636];return _0x2d9034;};'use strict';var _=require(_0x2720('0x0'));var Sequelize=require(_0x2720('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x2720('0x2')]},'street':{'type':Sequelize[_0x2720('0x2')]},'postalCode':{'type':Sequelize[_0x2720('0x2')]},'city':{'type':Sequelize[_0x2720('0x2')]},'country':{'type':Sequelize[_0x2720('0x2')]},'dateOfBirth':{'type':Sequelize[_0x2720('0x2')]},'description':{'type':Sequelize[_0x2720('0x3')]},'phone':{'type':Sequelize[_0x2720('0x2')]},'mobile':{'type':Sequelize[_0x2720('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x2720('0x2')]},'facebook':{'type':Sequelize[_0x2720('0x2')]},'fb_data':{'type':Sequelize[_0x2720('0x2')]},'twitter':{'type':Sequelize[_0x2720('0x2')]},'skype':{'type':Sequelize[_0x2720('0x2')]},'teams':{'type':Sequelize[_0x2720('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x2720('0x2')]},'wechat':{'type':Sequelize[_0x2720('0x2')]},'telegram':{'type':Sequelize[_0x2720('0x2')]},'UserId':{'type':Sequelize[_0x2720('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2720('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x2720('0x5')],'defaultValue':Sequelize[_0x2720('0x6')]},'dialTimezone':{'type':Sequelize[_0x2720('0x2')]},'utcOffset':{'type':Sequelize[_0x2720('0x4')]}}; \ No newline at end of file +var _0xb896=['INTEGER','DATE','NOW','lodash','exports','STRING','TEXT'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xb896,0xb9));var _0x6b89=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0xb896[_0x52e68e];return _0x3211a4;};'use strict';var _=require(_0x6b89('0x0'));var Sequelize=require('sequelize');module[_0x6b89('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x6b89('0x2')]},'street':{'type':Sequelize[_0x6b89('0x2')]},'postalCode':{'type':Sequelize[_0x6b89('0x2')]},'city':{'type':Sequelize[_0x6b89('0x2')]},'country':{'type':Sequelize[_0x6b89('0x2')]},'dateOfBirth':{'type':Sequelize[_0x6b89('0x2')]},'description':{'type':Sequelize[_0x6b89('0x3')]},'phone':{'type':Sequelize[_0x6b89('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x6b89('0x2')]},'email':{'type':Sequelize[_0x6b89('0x2')]},'url':{'type':Sequelize[_0x6b89('0x2')]},'facebook':{'type':Sequelize[_0x6b89('0x2')]},'fb_data':{'type':Sequelize[_0x6b89('0x2')]},'twitter':{'type':Sequelize[_0x6b89('0x2')]},'skype':{'type':Sequelize[_0x6b89('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x6b89('0x2')]},'wechat':{'type':Sequelize[_0x6b89('0x2')]},'telegram':{'type':Sequelize[_0x6b89('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x6b89('0x2')]},'priority':{'type':Sequelize[_0x6b89('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6b89('0x5')],'defaultValue':Sequelize[_0x6b89('0x6')]},'dialTimezone':{'type':Sequelize[_0x6b89('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 8844552..8ffe7ab 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 _0x2503=['server/files/tmp','file','filename','chmodSync','0777','CompanyId','File\x20uploaded\x20correctly!','createReadStream','parse','import','User','agent','binding','No\x20firstName\x20column\x20specified','child_process','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','fork','../../components/import/cm/csvUpdates','message','getJourney','mail','chat','openchannel','whatsapp','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','callerid','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','findAndCountAll','startCase','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','Account','key','Owner','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','Interaction','flatten','sortBy','reverse','slice','moment','bluebird','util','path','squel','papaparse','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','limit','undefined','count','set','Content-Range','update','then','sendStatus','stack','send','index','describe','findAll','query','user','destroy','CmContact','find','params','catch','tags','keys','cf_','CmCustomField','columnName','alias','custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','merge','body','from','length','get','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopperBlack','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','isArray','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','where','ListId','findOrCreate','contact','all','Tags','name','color','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','cf_%d','pickBy','startsWith','map','format','isEmpty','table','cm_contacts','id\x20=\x20?','text','phone','CmHopper','getTags','findOne','rawAttributes','filters','intersection','model','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','include','getHopperHistories','rows','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0x2503,0x148));var _0x3250=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2503[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x3250('0x0'));var BPromise=require(_0x3250('0x1'));var util=require(_0x3250('0x2'));var path=require(_0x3250('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3250('0x4'));var Papa=require(_0x3250('0x5'));var Redis=require(_0x3250('0x6'));var contacts=require(_0x3250('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x3250('0x8'))(_0x3250('0x9'));var config=require(_0x3250('0xa'));var shared=require(_0x3250('0xb'));var db=require(_0x3250('0xc'))['db'];config[_0x3250('0xd')]=_[_0x3250('0xe')](config[_0x3250('0xd')],{'host':_0x3250('0xf'),'port':0x18eb});var socket=require(_0x3250('0x10'))(new Redis(config[_0x3250('0xd')]));require(_0x3250('0x11'))['register'](socket);function respondWithResult(_0x11e1b3,_0x5de62){_0x5de62=_0x5de62||0xc8;return function(_0x11e993){if(_0x11e993){return _0x11e1b3[_0x3250('0x12')](_0x5de62)[_0x3250('0x13')](_0x11e993);}};}function respondWithFilteredResult(_0x1b727a,_0x142e58){return function(_0x312ef6){if(_0x312ef6){var _0x9d662f=typeof _0x142e58[_0x3250('0x14')]==='undefined'&&typeof _0x142e58[_0x3250('0x15')]===_0x3250('0x16');var _0x221cc0=_0x312ef6[_0x3250('0x17')];var _0x125982=_0x9d662f?0x0:_0x142e58['offset'];var _0x571e42=_0x9d662f?_0x312ef6[_0x3250('0x17')]:_0x142e58[_0x3250('0x14')]+_0x142e58[_0x3250('0x15')];var _0x2309b0;if(_0x571e42>=_0x221cc0){_0x571e42=_0x221cc0;_0x2309b0=0xc8;}else{_0x2309b0=0xce;}_0x1b727a[_0x3250('0x12')](_0x2309b0);return _0x1b727a[_0x3250('0x18')](_0x3250('0x19'),_0x125982+'-'+_0x571e42+'/'+_0x221cc0)[_0x3250('0x13')](_0x312ef6);}return null;};}function saveUpdates(_0x1c551e){return function(_0x1affe4){if(_0x1affe4){return _0x1affe4[_0x3250('0x1a')](_0x1c551e)[_0x3250('0x1b')](function(_0x1ae2ee){return _0x1ae2ee;});}return null;};}function removeEntity(_0x18bf12){return function(_0x13bbfd){if(_0x13bbfd){return _0x13bbfd['destroy']()[_0x3250('0x1b')](function(){_0x18bf12['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbea730){return function(_0x1ec750){if(!_0x1ec750){_0xbea730[_0x3250('0x1c')](0x194);}return _0x1ec750;};}function handleError(_0x30721e,_0x3d0c58){_0x3d0c58=_0x3d0c58||0x1f4;return function(_0x5373bf){logger['error'](_0x5373bf[_0x3250('0x1d')]);if(_0x5373bf['name']){delete _0x5373bf['name'];}_0x30721e[_0x3250('0x12')](_0x3d0c58)[_0x3250('0x1e')](_0x5373bf);};}exports[_0x3250('0x1f')]=function(_0x384ea7,_0x3ccd44){var _0x2efff1={};return contacts[_0x3250('0x20')]()['then'](function(_0x574218){_0x2efff1=qs['getOptions'](_0x574218,_0x384ea7);return contacts[_0x3250('0x21')](_0x384ea7[_0x3250('0x22')],_0x384ea7[_0x3250('0x23')],_0x2efff1,_0x574218);})[_0x3250('0x1b')](respondWithFilteredResult(_0x3ccd44,_0x2efff1))['catch'](handleError(_0x3ccd44,null));};exports[_0x3250('0x24')]=function(_0x1a8d1f,_0x4f0281){return db[_0x3250('0x25')][_0x3250('0x26')]({'where':{'id':_0x1a8d1f[_0x3250('0x27')]['id']}})[_0x3250('0x1b')](handleEntityNotFound(_0x4f0281,null))['then'](removeEntity(_0x4f0281,null))[_0x3250('0x28')](handleError(_0x4f0281,null));};exports[_0x3250('0x20')]=function(_0x1a097f,_0x530469){return db[_0x3250('0x25')]['describe']()[_0x3250('0x1b')](function(_0x5b2904){delete _0x5b2904[_0x3250('0x29')];for(var _0x265901=0x0;_0x2659010x0){return new Promise(function(_0x1974bb){var _0x3c37cc=[];for(var _0x41d66d=0x0;_0x41d66d<_0x442a0e[_0x3250('0x37')];_0x41d66d++){_0x3c37cc['push'](insertAdditionalPhones(_0x442a0e[_0x41d66d][_0x3250('0x63')],_0x442a0e[_0x41d66d][_0x3250('0x5a')]));}Promise[_0x3250('0x64')](_0x3c37cc)['then'](function(){_0x1974bb(0x1);});})[_0x3250('0x1b')](function(){return{'success':_0x422962,'failure':_0x45d084,'duplicates':_0x196260};});}else{return{'success':_0x422962,'failure':_0x45d084,'duplicates':_0x196260};}}})[_0x3250('0x1b')](respondWithResult(_0x3b8441,0xc9))[_0x3250('0x28')](handleError(_0x3b8441,null));};exports['show']=function(_0x395458,_0x347a3d){var _0x33fc77;return db['CmContact'][_0x3250('0x20')]()['then'](function(_0x59a1f7){return db[_0x3250('0x25')][_0x3250('0x26')]({'where':{'id':_0x395458[_0x3250('0x27')]['id']},'include':[{'model':db['Tag'],'as':_0x3250('0x65'),'attributes':['id',_0x3250('0x66'),_0x3250('0x67')],'required':_0x395458[_0x3250('0x22')]['tag']?!![]:![]},{'model':db[_0x3250('0x48')],'as':'Phones','where':{'CmContactId':_0x395458[_0x3250('0x27')]['id']},'required':![],'include':[{'model':db[_0x3250('0x68')],'as':_0x3250('0x69')}]}],'order':[db[_0x3250('0x6a')][_0x3250('0x6b')](_0x3250('0x6c'))],'attributes':_[_0x3250('0x2a')](_0x59a1f7)});})[_0x3250('0x1b')](function(_0x5dc4d8){if(!_['isNil'](_0x5dc4d8)){_0x33fc77=_0x5dc4d8['get']({'plain':!![]});var _0x20b8b1={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5dc4d8&&_0x5dc4d8['ListId']){if(_0x5dc4d8['ListId']){_0x20b8b1[_0x3250('0x60')][_0x3250('0x6d')]['push']({'ListId':{'$ne':_0x5dc4d8[_0x3250('0x61')]}});}}return db[_0x3250('0x2c')]['findAll'](_0x20b8b1);}})['then'](function(_0x465124){if(!_[_0x3250('0x56')](_0x465124)){return _[_0x3250('0x6e')](_0x33fc77,_['map'](_0x465124,function(_0x5cfcbb){return util['format'](_0x3250('0x6f'),_0x5cfcbb['id']);}));}})[_0x3250('0x1b')](handleEntityNotFound(_0x347a3d,null))['then'](respondWithResult(_0x347a3d,null))[_0x3250('0x28')](handleError(_0x347a3d,null));};exports[_0x3250('0x1a')]=function(_0x5cbc4b,_0x4d14e2){var _0x2d7cbd;if(_0x5cbc4b[_0x3250('0x35')]['id']){delete _0x5cbc4b[_0x3250('0x35')]['id'];}if(!_[_0x3250('0x56')](_0x5cbc4b[_0x3250('0x35')][_0x3250('0x57')])){var _0x5aa404=_0x5cbc4b[_0x3250('0x35')][_0x3250('0x57')];if(!_[_0x3250('0x56')](shared[_0x3250('0x58')][_0x5aa404]))_0x5cbc4b[_0x3250('0x35')][_0x3250('0x59')]=shared['timezones'][_0x5aa404]['utcOffset'];}return db[_0x3250('0x25')]['find']({'where':{'id':_0x5cbc4b[_0x3250('0x27')]['id']}})[_0x3250('0x1b')](handleEntityNotFound(_0x4d14e2,null))['then'](saveUpdates(_0x5cbc4b[_0x3250('0x35')],null))[_0x3250('0x1b')](function(_0x4e9e01){_0x2d7cbd=_0x4e9e01;var _0xe8da90={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4e9e01&&_0x4e9e01[_0x3250('0x61')]){if(_0x4e9e01[_0x3250('0x61')]){_0xe8da90[_0x3250('0x60')][_0x3250('0x6d')][_0x3250('0x5f')]({'ListId':{'$ne':_0x4e9e01[_0x3250('0x61')]}});}}return db[_0x3250('0x2c')]['findAll'](_0xe8da90);})[_0x3250('0x1b')](function(_0x208ffd){if(_0x208ffd){return _[_0x3250('0x6e')](_[_0x3250('0x70')](_0x5cbc4b[_0x3250('0x35')],function(_0x49a519,_0x744949){return _[_0x3250('0x71')](_0x744949,_0x3250('0x2b'));}),_[_0x3250('0x72')](_0x208ffd,function(_0xd0b6fb){return util[_0x3250('0x73')](_0x3250('0x6f'),_0xd0b6fb['id']);}));}})[_0x3250('0x1b')](function(_0x3402c5){if(_0x3402c5&&!_[_0x3250('0x74')](_0x3402c5)){var _0x2ab29f=squel[_0x3250('0x1a')]()[_0x3250('0x75')](_0x3250('0x76'))['setFields'](_0x3402c5)[_0x3250('0x60')](_0x3250('0x77'),_0x5cbc4b['params']['id'])['toParam']();return db[_0x3250('0x6a')][_0x3250('0x22')](_0x2ab29f[_0x3250('0x78')],{'replacements':_0x2ab29f[_0x3250('0x31')]});}})['then'](function(){if(_0x5cbc4b[_0x3250('0x35')][_0x3250('0x79')]&&_0x2d7cbd){return db[_0x3250('0x7a')][_0x3250('0x1a')]({'phone':_0x5cbc4b['body'][_0x3250('0x79')],'OrderBy':0x0},{'where':{'ContactId':_0x2d7cbd['id']}});}})[_0x3250('0x1b')](function(){return _0x2d7cbd;})['then'](respondWithResult(_0x4d14e2,null))['catch'](handleError(_0x4d14e2,null));};exports[_0x3250('0x7b')]=function(_0x2c47b3,_0x7255f6){var _0x2049f7={};var _0x179c5a={};var _0x554c8b;var _0x479ec6;return db['CmContact'][_0x3250('0x7c')]({'where':{'id':_0x2c47b3['params']['id']}})['then'](handleEntityNotFound(_0x7255f6,null))[_0x3250('0x1b')](function(_0x239a2e){if(_0x239a2e){_0x554c8b=_0x239a2e;_0x179c5a['model']=_[_0x3250('0x2a')](db['Tag'][_0x3250('0x7d')]);_0x179c5a[_0x3250('0x22')]=_[_0x3250('0x2a')](_0x2c47b3[_0x3250('0x22')]);_0x179c5a[_0x3250('0x7e')]=_[_0x3250('0x7f')](_0x179c5a[_0x3250('0x80')],_0x179c5a[_0x3250('0x22')]);_0x2049f7[_0x3250('0x81')]=_[_0x3250('0x7f')](_0x179c5a[_0x3250('0x80')],qs['fields'](_0x2c47b3['query'][_0x3250('0x82')]));_0x2049f7['attributes']=_0x2049f7[_0x3250('0x81')][_0x3250('0x37')]?_0x2049f7[_0x3250('0x81')]:_0x179c5a['model'];_0x2049f7[_0x3250('0x83')]=qs[_0x3250('0x84')](_0x2c47b3[_0x3250('0x22')][_0x3250('0x84')]);_0x2049f7[_0x3250('0x60')]=qs[_0x3250('0x7e')](_[_0x3250('0x85')](_0x2c47b3[_0x3250('0x22')],_0x179c5a['filters']));if(_0x2c47b3['query']['filter']){_0x2049f7['where']=_[_0x3250('0x34')](_0x2049f7[_0x3250('0x60')],{'$or':_[_0x3250('0x72')](_0x2049f7[_0x3250('0x81')],function(_0x1b7c73){var _0x26bfee={};_0x26bfee[_0x1b7c73]={'$like':'%'+_0x2c47b3[_0x3250('0x22')][_0x3250('0x86')]+'%'};return _0x26bfee;})});}_0x2049f7=_[_0x3250('0x34')]({},_0x2049f7,_0x2c47b3[_0x3250('0x87')]);return _0x554c8b['getTags'](_0x2049f7);}})['then'](function(_0x4c2943){if(_0x4c2943){_0x479ec6=_0x4c2943[_0x3250('0x37')];if(!_0x2c47b3[_0x3250('0x22')][_0x3250('0x33')](_0x3250('0x88'))){_0x2049f7[_0x3250('0x15')]=qs[_0x3250('0x15')](_0x2c47b3[_0x3250('0x22')]['limit']);_0x2049f7['offset']=qs['offset'](_0x2c47b3['query'][_0x3250('0x14')]);}return _0x554c8b[_0x3250('0x7b')](_0x2049f7);}})['then'](function(_0x2007cc){if(_0x2007cc){return _0x2007cc?{'count':_0x479ec6,'rows':_0x2007cc}:null;}})[_0x3250('0x1b')](respondWithResult(_0x7255f6,null))[_0x3250('0x28')](handleError(_0x7255f6,null));};exports[_0x3250('0x89')]=function(_0x1f99f7,_0x3827c7){if(_0x1f99f7['body']['id']){delete _0x1f99f7['body']['id'];}return db[_0x3250('0x25')][_0x3250('0x7c')]({'where':{'id':_0x1f99f7['params']['id']}})[_0x3250('0x1b')](handleEntityNotFound(_0x3827c7,null))['then'](function(_0x35fa9c){if(_0x35fa9c){return _0x35fa9c['setTags'](_0x1f99f7[_0x3250('0x35')][_0x3250('0x8a')]||[]);}return null;})[_0x3250('0x1b')](respondWithResult(_0x3827c7,null))['catch'](handleError(_0x3827c7,null));};exports[_0x3250('0x8b')]=function(_0x1f7aba,_0x8beef1){var _0x5ebe41=[];_0x5ebe41[_0x3250('0x5f')](addAdditionalPhones(_0x1f7aba[_0x3250('0x35')]));Promise[_0x3250('0x64')](_0x5ebe41)['then'](function(){_0x5ebe41=[];_0x5ebe41[_0x3250('0x5f')](deleteCmHopperPhones(_0x1f7aba[_0x3250('0x35')]['id']));_0x5ebe41['push'](addCmHopperPhones(_0x1f7aba['body']['id']));Promise[_0x3250('0x64')](_0x5ebe41)[_0x3250('0x1b')](function(){return[0x1];})['then'](respondWithResult(_0x8beef1,null));});};function addAdditionalPhones(_0x13d6af){var _0x27093e;return new Promise(function(_0x273ea1){return db[_0x3250('0x48')][_0x3250('0x24')]({'where':{'CmContactId':_0x13d6af['id']}})[_0x3250('0x1b')](function(){db['ContactItemType'][_0x3250('0x21')]({'raw':!![],'attributes':['id',_0x3250('0x8c')]})[_0x3250('0x1b')](function(_0x3b9cb4){var _0x446da8=[];for(var _0x2f4a95=0x0;_0x2f4a95<_0x13d6af[_0x3250('0x8d')][_0x3250('0x37')];_0x2f4a95++){var _0x519034=_0x13d6af['item_types']?_['isNil'](_0x13d6af[_0x3250('0x8e')][_0x2f4a95])?'':_0x13d6af[_0x3250('0x8e')][_0x2f4a95]:_0x13d6af['items'][_0x2f4a95][_0x3250('0x8f')]?_0x13d6af['items'][_0x2f4a95][_0x3250('0x8f')]:'';var _0x7d7760=_[_0x3250('0x56')](_0x13d6af[_0x3250('0x8d')][_0x2f4a95][_0x3250('0x90')])?'':_0x13d6af[_0x3250('0x8d')][_0x2f4a95][_0x3250('0x90')];var _0x3518fc=_0x519034+':'+_0x13d6af[_0x3250('0x8d')][_0x2f4a95][_0x3250('0x79')]+'§'+_0x7d7760;if(_[_0x3250('0x56')](_0x27093e))_0x27093e=_0x3518fc;else _0x27093e+=';'+_0x3518fc;var _0x20c5fb=null;var _0x3239cd=null;if(_0x13d6af[_0x3250('0x8e')]){if(!_[_0x3250('0x56')](_0x13d6af[_0x3250('0x8e')][_0x2f4a95])){_0x3239cd=_['find'](_0x3b9cb4,function(_0x16686f){return _0x16686f['id']===_0x13d6af['item_types'][_0x2f4a95];});if(!_[_0x3250('0x56')](_0x3239cd)){_0x20c5fb=_0x3239cd['OrderBy'];}}}else{if(!_['isNil'](_0x13d6af[_0x3250('0x8d')][_0x2f4a95])){_0x3239cd=_['find'](_0x3b9cb4,function(_0x5934a3){return _0x5934a3['id']===_0x13d6af[_0x3250('0x8d')][_0x2f4a95][_0x3250('0x8f')];});if(!_[_0x3250('0x56')](_0x3239cd)){_0x20c5fb=_0x2f4a95;}}}if(_[_0x3250('0x56')](_0x20c5fb)){_0x20c5fb=0x64;}_0x446da8[_0x3250('0x5f')](addAdditionalPhone(_0x13d6af['id'],_0x13d6af[_0x3250('0x8d')][_0x2f4a95][_0x3250('0x79')],_0x13d6af['item_types']?_[_0x3250('0x56')](_0x13d6af[_0x3250('0x8e')][_0x2f4a95])?null:_0x13d6af[_0x3250('0x8e')][_0x2f4a95]:_0x13d6af[_0x3250('0x8d')][_0x2f4a95][_0x3250('0x8f')]?_0x13d6af[_0x3250('0x8d')][_0x2f4a95][_0x3250('0x8f')]:null,_0x20c5fb,_0x7d7760));}Promise['all'](_0x446da8)[_0x3250('0x1b')](function(){db[_0x3250('0x25')][_0x3250('0x1a')]({'AdditionalPhones':_0x27093e},{'where':{'id':_0x13d6af['id']}})[_0x3250('0x1b')](function(){_0x273ea1(0x1);});});});});});}function addAdditionalPhone(_0x29181f,_0x2678a7,_0x4cbae6,_0xcdfc82,_0x1c29f2){return db[_0x3250('0x48')][_0x3250('0x26')]({'where':{'CmContactId':_0x29181f,'item':_0x2678a7}})[_0x3250('0x1b')](function(_0x433d3f){if(_0x433d3f)logger['info'](_0x3250('0x91'),_0x433d3f);else{db[_0x3250('0x48')][_0x3250('0x3d')]({'CmContactId':_0x29181f,'item':_0x2678a7,'ItemTypeId':_0x4cbae6,'OrderBy':_0xcdfc82,'ItemClass':'PHONE','description':_0x1c29f2});}});}function deleteCmHopperPhones(_0x3c91e8){return new Promise(function(_0x553c07){return db[_0x3250('0x7a')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3c91e8}})['then'](function(_0x73bc63){db[_0x3250('0x92')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x3250('0x72')](_0x73bc63,'id')}}});})[_0x3250('0x1b')](function(){_0x553c07(0x1);});});}function addCmHopperPhones(_0x4288fe){return new Promise(function(_0x3c6967){return db[_0x3250('0x7a')][_0x3250('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4288fe}})[_0x3250('0x1b')](function(_0x30e0a8){var _0x43b09f=[];_[_0x3250('0x72')](_0x30e0a8,function(_0x19be3c){_0x43b09f['push'](createCmHopperPhone(_0x4288fe,_0x19be3c['id']));});Promise[_0x3250('0x64')](_0x43b09f)[_0x3250('0x1b')](function(){_0x3c6967(0x1);});});});}function createCmHopperPhone(_0x4ed03c,_0x19e099){return new Promise(function(_0x543dc9){db[_0x3250('0x48')][_0x3250('0x21')]({'raw':!![],'attributes':[_0x3250('0x93'),_0x3250('0x8c')],'where':{'CmContactId':_0x4ed03c,'ItemClass':'PHONE'},'include':[{'model':db[_0x3250('0x68')],'attributes':[_0x3250('0x8c')],'as':_0x3250('0x69')}],'order':['OrderBy',db[_0x3250('0x6a')][_0x3250('0x6b')](_0x3250('0x94'))]})[_0x3250('0x1b')](function(_0xc7dd17){var _0x13740f=0x1;var _0x238209=_[_0x3250('0x72')](_0xc7dd17,function(_0x56838b){_0x56838b[_0x3250('0x95')]=_0x19e099;_0x56838b['phone']=_0x56838b[_0x3250('0x93')];_0x56838b[_0x3250('0x8c')]=_0x13740f;delete _0x56838b[_0x3250('0x96')];_0x13740f=_0x13740f+0x1;return _0x56838b;});return db[_0x3250('0x92')][_0x3250('0x5b')](_0x238209,{});})['then'](function(){_0x543dc9(0x1);});});}function insertAdditionalPhones(_0x16ca37,_0x532983){return new Promise(function(_0x3bb7e6){var _0x2d98d8=[];for(var _0xd24835=0x0;_0xd24835<_0x532983[_0x3250('0x37')];_0xd24835++){var _0x30e63c=_0x532983[_0xd24835];_0x2d98d8['push'](parseContactItemType(_0x30e63c));}Promise['all'](_0x2d98d8)[_0x3250('0x1b')](function(){var _0x437336={'id':_0x16ca37['id'],'items':_0x532983};return addAdditionalPhones(_0x437336)[_0x3250('0x1b')](function(){return addCmHopperPhones(_0x16ca37['id']);});})[_0x3250('0x1b')](function(){_0x3bb7e6(_0x16ca37);});});}function parseContactItemType(_0x284184){return new Promise(function(_0x94b0d1){if(_0x284184[_0x3250('0x33')]('ItemTypeId')){_0x94b0d1(_0x284184);}else{return db['ContactItemType'][_0x3250('0x26')]({'where':{'name':_0x284184[_0x3250('0x69')]}})[_0x3250('0x1b')](function(_0x6098f8){if(_[_0x3250('0x56')](_0x6098f8))_0x284184[_0x3250('0x8f')]=null;else _0x284184[_0x3250('0x8f')]=_0x6098f8['id'];_0x94b0d1(_0x284184);});}});}exports[_0x3250('0x97')]=function(_0x28510b,_0x5303ec){return db[_0x3250('0x48')][_0x3250('0x21')]({'raw':!![],'where':{'CmContactId':_0x28510b[_0x3250('0x27')]['id'],'ItemClass':_0x3250('0x98')},'include':[{'model':db[_0x3250('0x68')],'as':'ItemType'}],'order':[['OrderBy'],[db[_0x3250('0x6a')][_0x3250('0x6b')](_0x3250('0x94'))]]})[_0x3250('0x1b')](function(_0x24fbc5){return _0x24fbc5;})[_0x3250('0x1b')](respondWithResult(_0x5303ec,null))['catch'](handleError(_0x5303ec,null));};exports[_0x3250('0x99')]=function(_0x1d6b79,_0x381706){return db[_0x3250('0x48')][_0x3250('0x21')]({'raw':!![],'where':{'CmContactId':_0x1d6b79[_0x3250('0x35')][_0x3250('0x9a')]}})[_0x3250('0x1b')](function(_0x289767){var _0xb57e70=_[_0x3250('0x72')](_0x289767,function(_0x2f6a60){_0x2f6a60[_0x3250('0x9b')]=_0x1d6b79[_0x3250('0x35')]['toContactId'];return _0x2f6a60;});return db[_0x3250('0x48')]['bulkCreate'](_0xb57e70,{});})['then'](function(){return addCmHopperPhones(_0x1d6b79[_0x3250('0x35')][_0x3250('0x9c')]);})[_0x3250('0x1b')](function(){return['ok'];})['then'](respondWithResult(_0x381706,null))[_0x3250('0x28')](handleError(_0x381706,null));};exports[_0x3250('0x9d')]=function(_0x54ce11,_0x39104e){var _0x4a73ad=[];_0x4a73ad[_0x3250('0x5f')](createCmHopperPhone(_0x54ce11[_0x3250('0x35')]['id'],_0x54ce11['body'][_0x3250('0x9e')]));Promise[_0x3250('0x64')](_0x4a73ad)[_0x3250('0x1b')](function(){return[0x1];})[_0x3250('0x1b')](respondWithResult(_0x39104e,null));};exports[_0x3250('0x9f')]=function(_0x52f6c8,_0x18c386){var _0x504948={'raw':![],'where':{}};var _0x2f0853={};var _0x444dd0={'count':0x0,'rows':[]};return db[_0x3250('0x25')][_0x3250('0x7c')]({'where':{'id':_0x52f6c8['params']['id']}})[_0x3250('0x1b')](handleEntityNotFound(_0x18c386,null))[_0x3250('0x1b')](function(_0x10f116){if(_0x10f116){_0x2f0853[_0x3250('0x80')]=_['keys'](db[_0x3250('0x7a')][_0x3250('0x7d')]);_0x2f0853[_0x3250('0x22')]=_[_0x3250('0x2a')](_0x52f6c8['query']);_0x2f0853[_0x3250('0x7e')]=_[_0x3250('0x7f')](_0x2f0853[_0x3250('0x80')],_0x2f0853['query']);_0x504948[_0x3250('0x81')]=_[_0x3250('0x7f')](_0x2f0853[_0x3250('0x80')],qs[_0x3250('0x82')](_0x52f6c8[_0x3250('0x22')][_0x3250('0x82')]));_0x504948[_0x3250('0x81')]=_0x504948[_0x3250('0x81')][_0x3250('0x37')]?_0x504948[_0x3250('0x81')]:_0x2f0853[_0x3250('0x80')];if(!_0x52f6c8[_0x3250('0x22')][_0x3250('0x33')](_0x3250('0x88'))){_0x504948['limit']=qs[_0x3250('0x15')](_0x52f6c8['query'][_0x3250('0x15')]);_0x504948['offset']=qs[_0x3250('0x14')](_0x52f6c8['query']['offset']);}_0x504948[_0x3250('0x83')]=qs['sort'](_0x52f6c8[_0x3250('0x22')]['sort']);_0x504948[_0x3250('0x60')]=qs[_0x3250('0x7e')](_[_0x3250('0x85')](_0x52f6c8[_0x3250('0x22')],_0x2f0853[_0x3250('0x7e')]));_0x504948['where'][_0x3250('0xa0')]=_0x10f116['id'];if(_0x52f6c8[_0x3250('0x22')][_0x3250('0x86')]){_0x504948[_0x3250('0x60')]=_['merge'](_0x504948[_0x3250('0x60')],{'$or':_[_0x3250('0x72')](_0x504948['attributes'],function(_0x4bfe07){var _0x1b3171={};_0x1b3171[_0x4bfe07]={'$like':'%'+_0x52f6c8[_0x3250('0x22')][_0x3250('0x86')]+'%'};return _0x1b3171;})});}_0x504948=_[_0x3250('0x34')]({},_0x504948,_0x52f6c8[_0x3250('0x87')]);return db[_0x3250('0x7a')][_0x3250('0x17')]({'where':_0x504948[_0x3250('0x60')]})[_0x3250('0x1b')](function(_0x466418){_0x444dd0['count']=_0x466418;if(_0x52f6c8['query'][_0x3250('0xa1')]){_0x504948[_0x3250('0xa2')]=[{'all':!![]}];}return db[_0x3250('0x7a')][_0x3250('0x21')](_0x504948);})['then'](function(_0x563421){_0x444dd0['rows']=_0x563421;return _0x444dd0;});}})[_0x3250('0x1b')](respondWithFilteredResult(_0x18c386,_0x504948))[_0x3250('0x28')](handleError(_0x18c386,null));};exports[_0x3250('0xa3')]=function(_0x2a674e,_0x55a76d){var _0x566d7d={'raw':!![],'where':{}};var _0x5a306f={};var _0x4caf65={'count':0x0,'rows':[]};return db[_0x3250('0x25')][_0x3250('0x7c')]({'where':{'id':_0x2a674e['params']['id']}})[_0x3250('0x1b')](handleEntityNotFound(_0x55a76d,null))[_0x3250('0x1b')](function(_0x1ae3b6){if(_0x1ae3b6){_0x5a306f['model']=_[_0x3250('0x2a')](db[_0x3250('0x4a')][_0x3250('0x7d')]);_0x5a306f[_0x3250('0x22')]=_[_0x3250('0x2a')](_0x2a674e[_0x3250('0x22')]);_0x5a306f[_0x3250('0x7e')]=_[_0x3250('0x7f')](_0x5a306f[_0x3250('0x80')],_0x5a306f[_0x3250('0x22')]);_0x566d7d[_0x3250('0x81')]=_['intersection'](_0x5a306f['model'],qs[_0x3250('0x82')](_0x2a674e[_0x3250('0x22')][_0x3250('0x82')]));_0x566d7d[_0x3250('0x81')]=_0x566d7d[_0x3250('0x81')][_0x3250('0x37')]?_0x566d7d[_0x3250('0x81')]:_0x5a306f['model'];if(!_0x2a674e[_0x3250('0x22')]['hasOwnProperty'](_0x3250('0x88'))){_0x566d7d[_0x3250('0x15')]=qs[_0x3250('0x15')](_0x2a674e[_0x3250('0x22')][_0x3250('0x15')]);_0x566d7d[_0x3250('0x14')]=qs[_0x3250('0x14')](_0x2a674e['query']['offset']);}_0x566d7d['order']=qs[_0x3250('0x84')](_0x2a674e[_0x3250('0x22')][_0x3250('0x84')]);_0x566d7d['where']=qs['filters'](_[_0x3250('0x85')](_0x2a674e[_0x3250('0x22')],_0x5a306f[_0x3250('0x7e')]));_0x566d7d['where'][_0x3250('0xa0')]=_0x1ae3b6['id'];if(_0x2a674e[_0x3250('0x22')][_0x3250('0x86')]){_0x566d7d[_0x3250('0x60')]=_['merge'](_0x566d7d['where'],{'$or':_[_0x3250('0x72')](_0x566d7d[_0x3250('0x81')],function(_0x3f7353){var _0x43eedc={};_0x43eedc[_0x3f7353]={'$like':'%'+_0x2a674e[_0x3250('0x22')]['filter']+'%'};return _0x43eedc;})});}_0x566d7d=_[_0x3250('0x34')]({},_0x566d7d,_0x2a674e[_0x3250('0x87')]);return db[_0x3250('0x4a')][_0x3250('0x17')]({'where':_0x566d7d[_0x3250('0x60')]})[_0x3250('0x1b')](function(_0x4025c3){_0x4caf65[_0x3250('0x17')]=_0x4025c3;if(_0x2a674e[_0x3250('0x22')][_0x3250('0xa1')]){_0x566d7d[_0x3250('0xa2')]=[{'all':!![]}];}return db[_0x3250('0x4a')]['findAll'](_0x566d7d);})[_0x3250('0x1b')](function(_0xef8eae){_0x4caf65[_0x3250('0xa4')]=_0xef8eae;return _0x4caf65;});}})[_0x3250('0x1b')](respondWithFilteredResult(_0x55a76d,_0x566d7d))[_0x3250('0x28')](handleError(_0x55a76d,null));};exports[_0x3250('0xa5')]=function(_0x4e1a5d,_0x45a4c4){var _0x5ac2cc={'raw':!![],'where':{}};var _0x503b1f={};var _0x59bd66={'count':0x0,'rows':[]};return db['CmContact'][_0x3250('0x7c')]({'where':{'id':_0x4e1a5d[_0x3250('0x27')]['id']}})[_0x3250('0x1b')](handleEntityNotFound(_0x45a4c4,null))[_0x3250('0x1b')](function(_0x52f72f){if(_0x52f72f){_0x503b1f[_0x3250('0x80')]=_[_0x3250('0x2a')](db[_0x3250('0x49')]['rawAttributes']);_0x503b1f[_0x3250('0x22')]=_[_0x3250('0x2a')](_0x4e1a5d[_0x3250('0x22')]);_0x503b1f[_0x3250('0x7e')]=_[_0x3250('0x7f')](_0x503b1f['model'],_0x503b1f[_0x3250('0x22')]);_0x5ac2cc[_0x3250('0x81')]=_[_0x3250('0x7f')](_0x503b1f[_0x3250('0x80')],qs[_0x3250('0x82')](_0x4e1a5d[_0x3250('0x22')][_0x3250('0x82')]));_0x5ac2cc[_0x3250('0x81')]=_0x5ac2cc[_0x3250('0x81')][_0x3250('0x37')]?_0x5ac2cc[_0x3250('0x81')]:_0x503b1f[_0x3250('0x80')];if(!_0x4e1a5d['query'][_0x3250('0x33')](_0x3250('0x88'))){_0x5ac2cc[_0x3250('0x15')]=qs[_0x3250('0x15')](_0x4e1a5d[_0x3250('0x22')][_0x3250('0x15')]);_0x5ac2cc[_0x3250('0x14')]=qs[_0x3250('0x14')](_0x4e1a5d['query'][_0x3250('0x14')]);}_0x5ac2cc[_0x3250('0x83')]=qs['sort'](_0x4e1a5d[_0x3250('0x22')]['sort']);_0x5ac2cc['where']=qs[_0x3250('0x7e')](_[_0x3250('0x85')](_0x4e1a5d[_0x3250('0x22')],_0x503b1f[_0x3250('0x7e')]));_0x5ac2cc[_0x3250('0x60')][_0x3250('0xa0')]=_0x52f72f['id'];if(_0x4e1a5d[_0x3250('0x22')][_0x3250('0x86')]){_0x5ac2cc[_0x3250('0x60')]=_[_0x3250('0x34')](_0x5ac2cc['where'],{'$or':_[_0x3250('0x72')](_0x5ac2cc[_0x3250('0x81')],function(_0x2e2c7f){var _0x4bce12={};_0x4bce12[_0x2e2c7f]={'$like':'%'+_0x4e1a5d[_0x3250('0x22')][_0x3250('0x86')]+'%'};return _0x4bce12;})});}_0x5ac2cc=_['merge']({},_0x5ac2cc,_0x4e1a5d[_0x3250('0x87')]);return db[_0x3250('0x49')][_0x3250('0x17')]({'where':_0x5ac2cc[_0x3250('0x60')]})[_0x3250('0x1b')](function(_0x24fab1){_0x59bd66[_0x3250('0x17')]=_0x24fab1;if(_0x4e1a5d[_0x3250('0x22')]['includeAll']){_0x5ac2cc[_0x3250('0xa2')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5ac2cc);})[_0x3250('0x1b')](function(_0x5be2a0){_0x59bd66[_0x3250('0xa4')]=_0x5be2a0;return _0x59bd66;});}})[_0x3250('0x1b')](respondWithFilteredResult(_0x45a4c4,_0x5ac2cc))['catch'](handleError(_0x45a4c4,null));};exports[_0x3250('0xa6')]=function(_0x2b0a29,_0x537185){var _0x5f7b08={'raw':!![],'where':{}};var _0x5f1117={};var _0x399e29={'count':0x0,'rows':[]};return db[_0x3250('0x25')]['findOne']({'where':{'id':_0x2b0a29[_0x3250('0x27')]['id']}})['then'](handleEntityNotFound(_0x537185,null))['then'](function(_0x347912){if(_0x347912){_0x5f1117[_0x3250('0x80')]=_[_0x3250('0x2a')](db[_0x3250('0x52')]['rawAttributes']);_0x5f1117[_0x3250('0x22')]=_['keys'](_0x2b0a29['query']);_0x5f1117[_0x3250('0x7e')]=_[_0x3250('0x7f')](_0x5f1117['model'],_0x5f1117[_0x3250('0x22')]);_0x5f7b08['attributes']=_['intersection'](_0x5f1117['model'],qs[_0x3250('0x82')](_0x2b0a29[_0x3250('0x22')][_0x3250('0x82')]));_0x5f7b08['attributes']=_0x5f7b08[_0x3250('0x81')][_0x3250('0x37')]?_0x5f7b08['attributes']:_0x5f1117[_0x3250('0x80')];if(!_0x2b0a29[_0x3250('0x22')][_0x3250('0x33')](_0x3250('0x88'))){_0x5f7b08[_0x3250('0x15')]=qs['limit'](_0x2b0a29['query'][_0x3250('0x15')]);_0x5f7b08['offset']=qs[_0x3250('0x14')](_0x2b0a29[_0x3250('0x22')]['offset']);}_0x5f7b08['order']=qs[_0x3250('0x84')](_0x2b0a29['query'][_0x3250('0x84')]);_0x5f7b08[_0x3250('0x60')]=qs['filters'](_[_0x3250('0x85')](_0x2b0a29[_0x3250('0x22')],_0x5f1117['filters']));_0x5f7b08[_0x3250('0x60')]['ContactId']=_0x347912['id'];if(_0x2b0a29[_0x3250('0x22')][_0x3250('0x86')]){_0x5f7b08[_0x3250('0x60')]=_[_0x3250('0x34')](_0x5f7b08[_0x3250('0x60')],{'$or':_[_0x3250('0x72')](_0x5f7b08[_0x3250('0x81')],function(_0x5b8d93){var _0x4c7fbc={};_0x4c7fbc[_0x5b8d93]={'$like':'%'+_0x2b0a29['query'][_0x3250('0x86')]+'%'};return _0x4c7fbc;})});}_0x5f7b08=_[_0x3250('0x34')]({},_0x5f7b08,_0x2b0a29[_0x3250('0x87')]);return db[_0x3250('0x52')]['count']({'where':_0x5f7b08['where']})[_0x3250('0x1b')](function(_0x43e430){_0x399e29[_0x3250('0x17')]=_0x43e430;if(_0x2b0a29['query'][_0x3250('0xa1')]){_0x5f7b08[_0x3250('0xa2')]=[{'all':!![]}];}return db[_0x3250('0x52')][_0x3250('0x21')](_0x5f7b08);})[_0x3250('0x1b')](function(_0x2e26ec){_0x399e29[_0x3250('0xa4')]=_0x2e26ec;return _0x399e29;});}})['then'](respondWithFilteredResult(_0x537185,_0x5f7b08))[_0x3250('0x28')](handleError(_0x537185,null));};exports['uploadCsv']=function(_0x221ccf,_0x46653e){try{if(!_0x221ccf[_0x3250('0x35')][_0x3250('0x61')]){throw new Error(_0x3250('0xa7'));}if(!_0x221ccf[_0x3250('0x35')][_0x3250('0xa8')]){throw new Error(_0x3250('0xa9'));}if(!_0x221ccf[_0x3250('0x35')][_0x3250('0xaa')]){throw new Error(_0x3250('0xab'));}if(!_0x221ccf[_0x3250('0x35')][_0x3250('0xac')]){throw new Error(_0x3250('0xad'));}var _0x2ac00f=_0x221ccf[_0x3250('0x35')][_0x3250('0xa8')]['split'](',');var _0x4850d7=_0x221ccf[_0x3250('0x35')][_0x3250('0xaa')]['split'](',');if(!_0x2ac00f[_0x3250('0x37')]||!_0x4850d7[_0x3250('0x37')]||_0x2ac00f[_0x3250('0x37')]!==_0x4850d7['length']){throw new Error(_0x3250('0xae'));}_0x221ccf['body'][_0x3250('0x82')]=_['zipObject'](_0x2ac00f,_0x4850d7);if(!_0x221ccf[_0x3250('0x35')]['fields'][_0x3250('0x79')]){throw new Error(_0x3250('0xaf'));}if(!_0x221ccf[_0x3250('0x35')][_0x3250('0x82')][_0x3250('0xb0')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x33216=path[_0x3250('0x39')](config[_0x3250('0xb1')],_0x3250('0xb2'),_0x221ccf[_0x3250('0xb3')][_0x3250('0xb4')]);fs[_0x3250('0xb5')](_0x33216,parseInt(_0x3250('0xb6'),0x8));var _0x3bbe0e=require('child_process')['fork'](path[_0x3250('0x39')](__dirname,'../../components/import/cm/csv'),[_0x33216,_0x221ccf['body'][_0x3250('0xa8')],_0x221ccf[_0x3250('0x35')][_0x3250('0xaa')],_0x221ccf[_0x3250('0x35')][_0x3250('0x61')],_0x221ccf[_0x3250('0x35')][_0x3250('0xb7')],_0x221ccf[_0x3250('0x35')][_0x3250('0x5d')],_0x221ccf['body'][_0x3250('0xac')]]);return _0x46653e['status'](0xc8)[_0x3250('0x13')]({'message':_0x3250('0xb8'),'pid':_0x3bbe0e['pid']});}catch(_0x1ac0f2){return _0x46653e[_0x3250('0x12')](0x1f4)[_0x3250('0x1e')](_0x1ac0f2);}};exports['upload']=function(_0x5f39b8,_0x39b00c){var _0x113395=fs[_0x3250('0xb9')](_0x5f39b8[_0x3250('0xb3')]['path']);Papa[_0x3250('0xba')](_0x113395,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4c774a){return _0x39b00c['status'](0xc8)[_0x3250('0x13')]({'file':_0x5f39b8['file'],'fields':_0x4c774a['meta'][_0x3250('0x82')]});}});};exports[_0x3250('0xbb')]=function(_0x526da3,_0x42d0c8){return db[_0x3250('0xbc')][_0x3250('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3250('0xbd')}})[_0x3250('0x1b')](function(_0x5d5b3a){var _0x4a2546=![];if(!_0x526da3['body']['ListId']){throw new Error(_0x3250('0xa7'));}if(!_0x526da3[_0x3250('0x35')][_0x3250('0xbe')][_0x3250('0x79')]){throw new Error(_0x3250('0xaf'));}if(!_0x526da3[_0x3250('0x35')]['binding']['firstName']){throw new Error(_0x3250('0xbf'));}if(!_0x526da3[_0x3250('0x35')][_0x3250('0xac')]){throw new Error(_0x3250('0xad'));}var _0x413008=require(_0x3250('0xc0'))['fork'](path[_0x3250('0x39')](__dirname,_0x3250('0xc1')),[_0x526da3[_0x3250('0x27')]['id'],JSON['stringify'](_0x526da3[_0x3250('0x35')]),JSON[_0x3250('0xc2')](_0x5d5b3a)]);_0x413008['on']('message',function(){_0x4a2546=!![];return _0x42d0c8[_0x3250('0x12')](0xc8)[_0x3250('0x13')]({'message':_0x3250('0xc3'),'pid':_0x413008[_0x3250('0xc4')]});});_0x413008['on'](_0x3250('0xc5'),function(_0x27b073){if(_0x27b073&&!_0x4a2546){return _0x42d0c8[_0x3250('0x12')](0x1f4)[_0x3250('0x13')]({'message':_0x3250('0xc6'),'pid':_0x413008[_0x3250('0xc4')]});}});})['catch'](handleError(_0x42d0c8,null));};exports['importUpdates']=function(_0x38aebc,_0x52f5db){return db['User'][_0x3250('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3250('0xbd')}})['then'](function(_0x5b680e){var _0x155c4e=![];if(!_0x38aebc['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x38aebc[_0x3250('0x35')][_0x3250('0xbe')][_0x3250('0x79')]){throw new Error(_0x3250('0xaf'));}if(!_0x38aebc[_0x3250('0x35')]['binding'][_0x3250('0xb0')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x38aebc[_0x3250('0x35')][_0x3250('0xac')]){throw new Error(_0x3250('0xad'));}var _0xd9a383=require(_0x3250('0xc0'))[_0x3250('0xc7')](path[_0x3250('0x39')](__dirname,_0x3250('0xc8')),[_0x38aebc[_0x3250('0x27')]['id'],JSON[_0x3250('0xc2')](_0x38aebc['body']),JSON[_0x3250('0xc2')](_0x5b680e)]);_0xd9a383['on'](_0x3250('0xc9'),function(){_0x155c4e=!![];return _0x52f5db[_0x3250('0x12')](0xc8)[_0x3250('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0xd9a383['pid']});});_0xd9a383['on'](_0x3250('0xc5'),function(_0x5baef3){if(_0x5baef3&&!_0x155c4e){return _0x52f5db[_0x3250('0x12')](0x1f4)[_0x3250('0x13')]({'message':_0x3250('0xc6'),'pid':_0xd9a383[_0x3250('0xc4')]});}});})[_0x3250('0x28')](handleError(_0x52f5db,null));};exports[_0x3250('0xca')]=function(_0x4002aa,_0x156b89){var _0x168b6c=[_0x3250('0xcb'),_0x3250('0xcc'),'sms',_0x3250('0xcd'),'fax',_0x3250('0xce'),'voice'];var _0x3018ab={'offset':0x0,'order':qs[_0x3250('0x84')](_0x3250('0xcf'))},_0x3853a4={'count':0x0,'rows':[]};Promise['resolve']()['then'](function(){if(_0x4002aa['query']['channel']){if(!_['includes'](_0x168b6c,_0x4002aa[_0x3250('0x22')][_0x3250('0xd0')][_0x3250('0xd1')]())){throw new Error(_0x3250('0xd2'));}_0x168b6c=[_0x4002aa[_0x3250('0x22')][_0x3250('0xd0')]['toLowerCase']()];}if(_0x4002aa['query'][_0x3250('0xd3')]){try{var _0x3cd882=JSON[_0x3250('0xba')](_0x4002aa['query']['range']);if(!moment(_0x3cd882[_0x3250('0x36')])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x3cd882['to'])[_0x3250('0xd4')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x433560){throw new Error(_0x3250('0xd5'));}}if(!_0x4002aa[_0x3250('0x22')][_0x3250('0x33')](_0x3250('0x88'))){_0x3018ab[_0x3250('0x15')]=qs[_0x3250('0x15')](_0x4002aa[_0x3250('0x22')][_0x3250('0x15')]||0xa);_0x3018ab[_0x3250('0x14')]=qs[_0x3250('0x14')](_0x4002aa[_0x3250('0x22')][_0x3250('0x14')]);}var _0x4e012d=_0x168b6c[_0x3250('0x72')](function(_0x3efd42){if(_0x3efd42===_0x3250('0xd6')){var _0x57aaa9={'attributes':['id',_0x3250('0xd7'),_0x3250('0x30'),_0x3250('0xd8'),_0x3250('0xd9'),_0x3250('0xda'),_0x3250('0xdb'),_0x3250('0xdc'),'duration',_0x3250('0xdd'),_0x3250('0xde'),_0x3250('0xdf'),_0x3250('0xe0'),_0x3250('0xe1'),'UserId'],'where':{'ContactId':_0x4002aa[_0x3250('0x27')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0x3250('0x66'),_0x3250('0xe2'),_0x3250('0x2e')]}],'order':[[_0x3250('0xde'),'DESC']]};if(_0x4002aa[_0x3250('0x22')][_0x3250('0xd3')]){_0x57aaa9['where'][_0x3250('0xde')]={'$gte':_0x3cd882[_0x3250('0x36')],'$lte':_0x3cd882['to']};}return db[_0x3250('0x4c')][_0x3250('0xe3')](_0x57aaa9)[_0x3250('0x1b')](function(_0x14aa64){_0x3853a4[_0x3250('0x17')]+=_0x14aa64['count'];return _[_0x3250('0x72')](_0x14aa64[_0x3250('0xa4')],function(_0x4587bf){var _0x489479=_0x4587bf[_0x3250('0x38')]({'plain':!![]});_0x489479[_0x3250('0xd0')]=_0x3efd42;if(_0x489479[_0x3250('0xbc')]){_0x489479[_0x3250('0xbc')]={'id':_0x489479[_0x3250('0xbc')]['id'],'name':_0x489479[_0x3250('0xbc')][_0x3250('0x66')],'fullname':_0x489479[_0x3250('0xbc')]['fullname'],'alias':_0x489479[_0x3250('0xbc')][_0x3250('0x2e')]};}return _0x489479;});});}else{var _0x378dad=_[_0x3250('0xe4')](_0x3efd42)+(_0x3efd42===_0x3250('0xcc')?'Website':'Account');var _0x5838da={'attributes':['id',_0x3250('0xe5'),_0x3250('0xe6'),_0x3250('0xde'),_0x3250('0xdd'),_0x3250('0xe7'),_0x3250('0xe8'),_0x3250('0xe9'),_0x3250('0xea'),_0x378dad+'Id'],'where':{'ContactId':_0x4002aa[_0x3250('0x27')]['id']},'include':[{'model':db[_0x378dad],'as':_0x3250('0xeb'),'attributes':['id',_0x3250('0x66'),_0x3250('0xec')]},{'model':db[_0x3250('0xbc')],'as':_0x3250('0xed'),'attributes':['id',_0x3250('0x66'),_0x3250('0xe2')]},{'model':db['Tag'],'as':_0x3250('0x65'),'attributes':['id',_0x3250('0x66'),_0x3250('0x67')],'through':{'attributes':[]}}],'order':[[_0x3250('0xde'),'DESC']]};if(_0x4002aa[_0x3250('0x22')][_0x3250('0xd3')]){_0x5838da[_0x3250('0x60')][_0x3250('0xde')]={'$gte':_0x3cd882[_0x3250('0x36')],'$lte':_0x3cd882['to']};}switch(_0x3efd42){case _0x3250('0xcc'):_0x5838da[_0x3250('0x81')][_0x3250('0x5f')](_0x3250('0xee'),_0x3250('0xef'),_0x3250('0xf0'),'deviceModel',_0x3250('0xf1'),_0x3250('0xf2'),_0x3250('0xf3'),_0x3250('0xf4'),_0x3250('0xf5'));break;case _0x3250('0xcb'):_0x5838da[_0x3250('0x81')][_0x3250('0x5f')](_0x3250('0xf6'),_0x3250('0xf7'));break;case'openchannel':_0x5838da[_0x3250('0x81')][_0x3250('0x5f')]('externalUrl','threadId');break;}return db[_[_0x3250('0xe4')](_0x3efd42)+_0x3250('0xf8')][_0x3250('0xe3')](_0x5838da)['then'](function(_0x5a738b){_0x3853a4['count']+=_0x5a738b[_0x3250('0x17')];return _[_0x3250('0x72')](_0x5a738b[_0x3250('0xa4')],function(_0x163e60){var _0x206ff4=_0x163e60[_0x3250('0x38')]({'plain':!![]});_0x206ff4[_0x3250('0xd0')]=_0x3efd42;if(_0x206ff4[_0x3250('0xed')]){_0x206ff4[_0x3250('0xed')]={'id':_0x206ff4[_0x3250('0xed')]['id'],'name':_0x206ff4['Owner'][_0x3250('0x66')],'fullname':_0x206ff4['Owner']['fullname']};}return _0x206ff4;});});}});return Promise[_0x3250('0x64')](_0x4e012d);})[_0x3250('0x1b')](function(_0x4b0e40){return _(_0x4b0e40)[_0x3250('0xf9')]()[_0x3250('0xfa')](_0x3250('0xde'))[_0x3250('0xfb')]()['value']();})[_0x3250('0x1b')](function(_0xfa1111){_0x3853a4[_0x3250('0xa4')]=_0x3018ab[_0x3250('0x15')]?_0xfa1111[_0x3250('0xfc')](_0x3018ab[_0x3250('0x14')],_0x3018ab[_0x3250('0x14')]+_0x3018ab[_0x3250('0x15')]):_0xfa1111;return _0x3853a4;})['then'](respondWithFilteredResult(_0x156b89,_0x3018ab))[_0x3250('0x28')](handleError(_0x156b89,null));}; \ No newline at end of file +var _0x0633=['each','duplicates','$or','where','ListId','findOrCreate','spread','push','contact','all','Tags','color','tag','Phones','ContactItemType','sequelize','literal','omit','map','$and','pickBy','format','cf_%d','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','Tag','filters','intersection','attributes','model','fields','order','sort','pick','options','nolimit','setAdditionalPhones','CmContactHasItem','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','CmHopperAdditionalPhone','PHONE','ItemType','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rawAttributes','ContactId','filter','includeAll','rows','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','file','filename','chmodSync','child_process','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','send','upload','createReadStream','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','importUpdates','fork','../../components/import/cm/csvUpdates','exit','error\x20child\x20process','getJourney','mail','chat','openchannel','whatsapp','voice','-createdAt','resolve','includes','channel','toLowerCase','Invalid\x20channel','range','parse','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','Website','Account','closed','closedAt','thirdDisposition','key','Owner','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','subject','externalUrl','threadId','startCase','findAndCountAll','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','limit','undefined','count','offset','set','update','then','destroy','end','sendStatus','stack','name','index','describe','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','findAll','length','columnName','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x0633,0x19e));var _0x3063=function(_0x122a37,_0x3ee0cf){_0x122a37=_0x122a37-0x0;var _0x5db960=_0x0633[_0x122a37];return _0x5db960;};'use strict';var moment=require(_0x3063('0x0'));var BPromise=require(_0x3063('0x1'));var util=require(_0x3063('0x2'));var path=require(_0x3063('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3063('0x4'));var Papa=require(_0x3063('0x5'));var Redis=require(_0x3063('0x6'));var contacts=require(_0x3063('0x7'));var qs=require(_0x3063('0x8'));var logger=require('../../config/logger')(_0x3063('0x9'));var config=require(_0x3063('0xa'));var shared=require('../../config/environment/shared');var db=require(_0x3063('0xb'))['db'];config[_0x3063('0xc')]=_[_0x3063('0xd')](config['redis'],{'host':_0x3063('0xe'),'port':0x18eb});var socket=require(_0x3063('0xf'))(new Redis(config['redis']));require(_0x3063('0x10'))[_0x3063('0x11')](socket);function respondWithResult(_0x21ec67,_0x4ecea0){_0x4ecea0=_0x4ecea0||0xc8;return function(_0x225cd7){if(_0x225cd7){return _0x21ec67[_0x3063('0x12')](_0x4ecea0)[_0x3063('0x13')](_0x225cd7);}};}function respondWithFilteredResult(_0x482235,_0x36332b){return function(_0x5a5de6){if(_0x5a5de6){var _0xb20dbe=typeof _0x36332b['offset']==='undefined'&&typeof _0x36332b[_0x3063('0x14')]===_0x3063('0x15');var _0xffc2a=_0x5a5de6[_0x3063('0x16')];var _0x5c5a0e=_0xb20dbe?0x0:_0x36332b[_0x3063('0x17')];var _0xccad6f=_0xb20dbe?_0x5a5de6[_0x3063('0x16')]:_0x36332b[_0x3063('0x17')]+_0x36332b[_0x3063('0x14')];var _0x1fc749;if(_0xccad6f>=_0xffc2a){_0xccad6f=_0xffc2a;_0x1fc749=0xc8;}else{_0x1fc749=0xce;}_0x482235[_0x3063('0x12')](_0x1fc749);return _0x482235[_0x3063('0x18')]('Content-Range',_0x5c5a0e+'-'+_0xccad6f+'/'+_0xffc2a)['json'](_0x5a5de6);}return null;};}function saveUpdates(_0xbcb100){return function(_0x2e23a2){if(_0x2e23a2){return _0x2e23a2[_0x3063('0x19')](_0xbcb100)[_0x3063('0x1a')](function(_0x2a9020){return _0x2a9020;});}return null;};}function removeEntity(_0x38a052){return function(_0x1fe40c){if(_0x1fe40c){return _0x1fe40c[_0x3063('0x1b')]()[_0x3063('0x1a')](function(){_0x38a052[_0x3063('0x12')](0xcc)[_0x3063('0x1c')]();});}};}function handleEntityNotFound(_0x45e952){return function(_0x1b0f0b){if(!_0x1b0f0b){_0x45e952[_0x3063('0x1d')](0x194);}return _0x1b0f0b;};}function handleError(_0x21b407,_0x4bc368){_0x4bc368=_0x4bc368||0x1f4;return function(_0x486e75){logger['error'](_0x486e75[_0x3063('0x1e')]);if(_0x486e75[_0x3063('0x1f')]){delete _0x486e75['name'];}_0x21b407[_0x3063('0x12')](_0x4bc368)['send'](_0x486e75);};}exports[_0x3063('0x20')]=function(_0xf96c1c,_0x5ee8d1){var _0x5ae3a8={};return contacts[_0x3063('0x21')]()['then'](function(_0x36c689){_0x5ae3a8=qs['getOptions'](_0x36c689,_0xf96c1c);return contacts['findAll'](_0xf96c1c[_0x3063('0x22')],_0xf96c1c[_0x3063('0x23')],_0x5ae3a8,_0x36c689);})[_0x3063('0x1a')](respondWithFilteredResult(_0x5ee8d1,_0x5ae3a8))[_0x3063('0x24')](handleError(_0x5ee8d1,null));};exports[_0x3063('0x1b')]=function(_0x10d53f,_0xc9519a){return db[_0x3063('0x25')][_0x3063('0x26')]({'where':{'id':_0x10d53f[_0x3063('0x27')]['id']}})[_0x3063('0x1a')](handleEntityNotFound(_0xc9519a,null))[_0x3063('0x1a')](removeEntity(_0xc9519a,null))[_0x3063('0x24')](handleError(_0xc9519a,null));};exports['describe']=function(_0x55ebe4,_0x5c8876){return db[_0x3063('0x25')]['describe']()[_0x3063('0x1a')](function(_0x50c97b){delete _0x50c97b[_0x3063('0x28')];for(var _0x124d8d=0x0;_0x124d8d0x0){return new Promise(function(_0x3442f7){var _0x5b4cc4=[];for(var _0x47ecc4=0x0;_0x47ecc4<_0x57e4a7[_0x3063('0x30')];_0x47ecc4++){_0x5b4cc4[_0x3063('0x69')](insertAdditionalPhones(_0x57e4a7[_0x47ecc4][_0x3063('0x6a')],_0x57e4a7[_0x47ecc4]['additionalPhones']));}Promise[_0x3063('0x6b')](_0x5b4cc4)['then'](function(){_0x3442f7(0x1);});})['then'](function(){return{'success':_0x3dca66,'failure':_0x500a16,'duplicates':_0x26b89a};});}else{return{'success':_0x3dca66,'failure':_0x500a16,'duplicates':_0x26b89a};}}})['then'](respondWithResult(_0x1b44c0,0xc9))[_0x3063('0x24')](handleError(_0x1b44c0,null));};exports['show']=function(_0x125b6e,_0x5cf918){var _0x536a01;return db[_0x3063('0x25')][_0x3063('0x21')]()['then'](function(_0x366698){return db[_0x3063('0x25')][_0x3063('0x26')]({'where':{'id':_0x125b6e['params']['id']},'include':[{'model':db['Tag'],'as':_0x3063('0x6c'),'attributes':['id','name',_0x3063('0x6d')],'required':_0x125b6e[_0x3063('0x22')][_0x3063('0x6e')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x3063('0x6f'),'where':{'CmContactId':_0x125b6e[_0x3063('0x27')]['id']},'required':![],'include':[{'model':db[_0x3063('0x70')],'as':'ItemType'}]}],'order':[db[_0x3063('0x71')][_0x3063('0x72')]('Phones.OrderBy')],'attributes':_['keys'](_0x366698)});})[_0x3063('0x1a')](function(_0x549456){if(!_[_0x3063('0x5d')](_0x549456)){_0x536a01=_0x549456[_0x3063('0x3c')]({'plain':!![]});var _0x37777b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x549456&&_0x549456[_0x3063('0x66')]){if(_0x549456['ListId']){_0x37777b[_0x3063('0x65')]['$and'][_0x3063('0x69')]({'ListId':{'$ne':_0x549456[_0x3063('0x66')]}});}}return db['CmCustomField']['findAll'](_0x37777b);}})[_0x3063('0x1a')](function(_0x441690){if(!_[_0x3063('0x5d')](_0x441690)){return _[_0x3063('0x73')](_0x536a01,_[_0x3063('0x74')](_0x441690,function(_0x3b3d26){return util['format']('cf_%d',_0x3b3d26['id']);}));}})['then'](handleEntityNotFound(_0x5cf918,null))['then'](respondWithResult(_0x5cf918,null))[_0x3063('0x24')](handleError(_0x5cf918,null));};exports[_0x3063('0x19')]=function(_0xbc4bf6,_0x1e865b){var _0x3b61eb;if(_0xbc4bf6[_0x3063('0x3a')]['id']){delete _0xbc4bf6[_0x3063('0x3a')]['id'];}if(!_[_0x3063('0x5d')](_0xbc4bf6[_0x3063('0x3a')]['dialTimezone'])){var _0x574af9=_0xbc4bf6[_0x3063('0x3a')]['dialTimezone'];if(!_[_0x3063('0x5d')](shared[_0x3063('0x5e')][_0x574af9]))_0xbc4bf6[_0x3063('0x3a')][_0x3063('0x5f')]=shared[_0x3063('0x5e')][_0x574af9]['utcOffset'];}return db[_0x3063('0x25')]['find']({'where':{'id':_0xbc4bf6[_0x3063('0x27')]['id']}})['then'](handleEntityNotFound(_0x1e865b,null))[_0x3063('0x1a')](saveUpdates(_0xbc4bf6[_0x3063('0x3a')],null))['then'](function(_0x4b7542){_0x3b61eb=_0x4b7542;var _0x268020={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4b7542&&_0x4b7542[_0x3063('0x66')]){if(_0x4b7542[_0x3063('0x66')]){_0x268020[_0x3063('0x65')][_0x3063('0x75')][_0x3063('0x69')]({'ListId':{'$ne':_0x4b7542[_0x3063('0x66')]}});}}return db['CmCustomField'][_0x3063('0x2f')](_0x268020);})[_0x3063('0x1a')](function(_0x1694b6){if(_0x1694b6){return _[_0x3063('0x73')](_[_0x3063('0x76')](_0xbc4bf6[_0x3063('0x3a')],function(_0x4462b7,_0x5edb24){return _['startsWith'](_0x5edb24,_0x3063('0x2b'));}),_[_0x3063('0x74')](_0x1694b6,function(_0x3a1828){return util[_0x3063('0x77')](_0x3063('0x78'),_0x3a1828['id']);}));}})[_0x3063('0x1a')](function(_0x14f2ca){if(_0x14f2ca&&!_['isEmpty'](_0x14f2ca)){var _0x11e700=squel['update']()[_0x3063('0x79')](_0x3063('0x7a'))[_0x3063('0x7b')](_0x14f2ca)[_0x3063('0x65')](_0x3063('0x7c'),_0xbc4bf6[_0x3063('0x27')]['id'])[_0x3063('0x7d')]();return db['sequelize']['query'](_0x11e700[_0x3063('0x7e')],{'replacements':_0x11e700['values']});}})[_0x3063('0x1a')](function(){if(_0xbc4bf6['body'][_0x3063('0x7f')]&&_0x3b61eb){return db[_0x3063('0x40')]['update']({'phone':_0xbc4bf6[_0x3063('0x3a')][_0x3063('0x7f')],'OrderBy':0x0},{'where':{'ContactId':_0x3b61eb['id']}});}})[_0x3063('0x1a')](function(){return _0x3b61eb;})['then'](respondWithResult(_0x1e865b,null))[_0x3063('0x24')](handleError(_0x1e865b,null));};exports[_0x3063('0x80')]=function(_0x19f802,_0x2ae671){var _0xf2cc08={};var _0x1721d2={};var _0x37aad0;var _0x4faaa8;return db[_0x3063('0x25')][_0x3063('0x81')]({'where':{'id':_0x19f802['params']['id']}})['then'](handleEntityNotFound(_0x2ae671,null))['then'](function(_0x340ee7){if(_0x340ee7){_0x37aad0=_0x340ee7;_0x1721d2['model']=_['keys'](db[_0x3063('0x82')]['rawAttributes']);_0x1721d2[_0x3063('0x22')]=_[_0x3063('0x29')](_0x19f802[_0x3063('0x22')]);_0x1721d2[_0x3063('0x83')]=_[_0x3063('0x84')](_0x1721d2['model'],_0x1721d2[_0x3063('0x22')]);_0xf2cc08[_0x3063('0x85')]=_['intersection'](_0x1721d2[_0x3063('0x86')],qs[_0x3063('0x87')](_0x19f802[_0x3063('0x22')]['fields']));_0xf2cc08[_0x3063('0x85')]=_0xf2cc08[_0x3063('0x85')][_0x3063('0x30')]?_0xf2cc08[_0x3063('0x85')]:_0x1721d2[_0x3063('0x86')];_0xf2cc08[_0x3063('0x88')]=qs[_0x3063('0x89')](_0x19f802[_0x3063('0x22')]['sort']);_0xf2cc08[_0x3063('0x65')]=qs[_0x3063('0x83')](_[_0x3063('0x8a')](_0x19f802[_0x3063('0x22')],_0x1721d2[_0x3063('0x83')]));if(_0x19f802['query']['filter']){_0xf2cc08[_0x3063('0x65')]=_[_0x3063('0x39')](_0xf2cc08[_0x3063('0x65')],{'$or':_[_0x3063('0x74')](_0xf2cc08[_0x3063('0x85')],function(_0x2c5355){var _0x56c027={};_0x56c027[_0x2c5355]={'$like':'%'+_0x19f802[_0x3063('0x22')]['filter']+'%'};return _0x56c027;})});}_0xf2cc08=_[_0x3063('0x39')]({},_0xf2cc08,_0x19f802[_0x3063('0x8b')]);return _0x37aad0[_0x3063('0x80')](_0xf2cc08);}})[_0x3063('0x1a')](function(_0x45d330){if(_0x45d330){_0x4faaa8=_0x45d330[_0x3063('0x30')];if(!_0x19f802['query']['hasOwnProperty'](_0x3063('0x8c'))){_0xf2cc08[_0x3063('0x14')]=qs[_0x3063('0x14')](_0x19f802[_0x3063('0x22')][_0x3063('0x14')]);_0xf2cc08[_0x3063('0x17')]=qs[_0x3063('0x17')](_0x19f802[_0x3063('0x22')][_0x3063('0x17')]);}return _0x37aad0[_0x3063('0x80')](_0xf2cc08);}})[_0x3063('0x1a')](function(_0x4d66b1){if(_0x4d66b1){return _0x4d66b1?{'count':_0x4faaa8,'rows':_0x4d66b1}:null;}})[_0x3063('0x1a')](respondWithResult(_0x2ae671,null))['catch'](handleError(_0x2ae671,null));};exports['setTags']=function(_0x4a4fc5,_0x1eb7d4){if(_0x4a4fc5[_0x3063('0x3a')]['id']){delete _0x4a4fc5[_0x3063('0x3a')]['id'];}return db['CmContact'][_0x3063('0x81')]({'where':{'id':_0x4a4fc5[_0x3063('0x27')]['id']}})[_0x3063('0x1a')](handleEntityNotFound(_0x1eb7d4,null))['then'](function(_0x113da7){if(_0x113da7){return _0x113da7['setTags'](_0x4a4fc5[_0x3063('0x3a')]['ids']||[]);}return null;})[_0x3063('0x1a')](respondWithResult(_0x1eb7d4,null))[_0x3063('0x24')](handleError(_0x1eb7d4,null));};exports[_0x3063('0x8d')]=function(_0x73c0f1,_0x511fcb){var _0x38c4f4=[];_0x38c4f4['push'](addAdditionalPhones(_0x73c0f1[_0x3063('0x3a')]));Promise[_0x3063('0x6b')](_0x38c4f4)['then'](function(){_0x38c4f4=[];_0x38c4f4[_0x3063('0x69')](deleteCmHopperPhones(_0x73c0f1['body']['id']));_0x38c4f4['push'](addCmHopperPhones(_0x73c0f1[_0x3063('0x3a')]['id']));Promise['all'](_0x38c4f4)[_0x3063('0x1a')](function(){return[0x1];})[_0x3063('0x1a')](respondWithResult(_0x511fcb,null));});};function addAdditionalPhones(_0x3355e1){var _0x52922e;return new Promise(function(_0x4d786b){return db[_0x3063('0x8e')][_0x3063('0x1b')]({'where':{'CmContactId':_0x3355e1['id']}})[_0x3063('0x1a')](function(){db[_0x3063('0x70')][_0x3063('0x2f')]({'raw':!![],'attributes':['id','OrderBy']})[_0x3063('0x1a')](function(_0x40a7c4){var _0x1e1705=[];for(var _0x200a81=0x0;_0x200a81<_0x3355e1[_0x3063('0x8f')][_0x3063('0x30')];_0x200a81++){var _0x806742=_0x3355e1['item_types']?_[_0x3063('0x5d')](_0x3355e1[_0x3063('0x90')][_0x200a81])?'':_0x3355e1[_0x3063('0x90')][_0x200a81]:_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x91')]?_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x91')]:'';var _0x2254f1=_['isNil'](_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x92')])?'':_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x92')];var _0x546ce0=_0x806742+':'+_0x3355e1['items'][_0x200a81]['phone']+'§'+_0x2254f1;if(_[_0x3063('0x5d')](_0x52922e))_0x52922e=_0x546ce0;else _0x52922e+=';'+_0x546ce0;var _0x14f1ec=null;var _0x58579d=null;if(_0x3355e1[_0x3063('0x90')]){if(!_[_0x3063('0x5d')](_0x3355e1[_0x3063('0x90')][_0x200a81])){_0x58579d=_['find'](_0x40a7c4,function(_0x5146e8){return _0x5146e8['id']===_0x3355e1['item_types'][_0x200a81];});if(!_[_0x3063('0x5d')](_0x58579d)){_0x14f1ec=_0x58579d[_0x3063('0x93')];}}}else{if(!_[_0x3063('0x5d')](_0x3355e1[_0x3063('0x8f')][_0x200a81])){_0x58579d=_[_0x3063('0x26')](_0x40a7c4,function(_0x5b4753){return _0x5b4753['id']===_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x91')];});if(!_[_0x3063('0x5d')](_0x58579d)){_0x14f1ec=_0x200a81;}}}if(_[_0x3063('0x5d')](_0x14f1ec)){_0x14f1ec=0x64;}_0x1e1705['push'](addAdditionalPhone(_0x3355e1['id'],_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x7f')],_0x3355e1[_0x3063('0x90')]?_[_0x3063('0x5d')](_0x3355e1['item_types'][_0x200a81])?null:_0x3355e1[_0x3063('0x90')][_0x200a81]:_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x91')]?_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x91')]:null,_0x14f1ec,_0x2254f1));}Promise[_0x3063('0x6b')](_0x1e1705)[_0x3063('0x1a')](function(){db[_0x3063('0x25')][_0x3063('0x19')]({'AdditionalPhones':_0x52922e},{'where':{'id':_0x3355e1['id']}})['then'](function(){_0x4d786b(0x1);});});});});});}function addAdditionalPhone(_0x4e78ea,_0x3ff197,_0x535141,_0x558970,_0x48a19b){return db['CmContactHasItem'][_0x3063('0x26')]({'where':{'CmContactId':_0x4e78ea,'item':_0x3ff197}})[_0x3063('0x1a')](function(_0x261b70){if(_0x261b70)logger[_0x3063('0x35')](_0x3063('0x94'),_0x261b70);else{db[_0x3063('0x8e')][_0x3063('0x44')]({'CmContactId':_0x4e78ea,'item':_0x3ff197,'ItemTypeId':_0x535141,'OrderBy':_0x558970,'ItemClass':'PHONE','description':_0x48a19b});}});}function deleteCmHopperPhones(_0x51800e){return new Promise(function(_0x2b421a){return db[_0x3063('0x40')][_0x3063('0x2f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x51800e}})[_0x3063('0x1a')](function(_0x508580){db[_0x3063('0x95')][_0x3063('0x1b')]({'where':{'CmHopperId':{'$in':_['map'](_0x508580,'id')}}});})[_0x3063('0x1a')](function(){_0x2b421a(0x1);});});}function addCmHopperPhones(_0x3942a1){return new Promise(function(_0x4cc506){return db[_0x3063('0x40')][_0x3063('0x2f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3942a1}})[_0x3063('0x1a')](function(_0x3d4387){var _0x5d536d=[];_[_0x3063('0x74')](_0x3d4387,function(_0x2727bb){_0x5d536d[_0x3063('0x69')](createCmHopperPhone(_0x3942a1,_0x2727bb['id']));});Promise[_0x3063('0x6b')](_0x5d536d)[_0x3063('0x1a')](function(){_0x4cc506(0x1);});});});}function createCmHopperPhone(_0x55a838,_0x1078e2){return new Promise(function(_0x43e583){db['CmContactHasItem']['findAll']({'raw':!![],'attributes':['item',_0x3063('0x93')],'where':{'CmContactId':_0x55a838,'ItemClass':_0x3063('0x96')},'include':[{'model':db[_0x3063('0x70')],'attributes':[_0x3063('0x93')],'as':_0x3063('0x97')}],'order':[_0x3063('0x93'),db[_0x3063('0x71')]['literal'](_0x3063('0x98'))]})['then'](function(_0x161e72){var _0xd45cd0=0x1;var _0x26214b=_[_0x3063('0x74')](_0x161e72,function(_0x2fd49c){_0x2fd49c[_0x3063('0x99')]=_0x1078e2;_0x2fd49c[_0x3063('0x7f')]=_0x2fd49c['item'];_0x2fd49c[_0x3063('0x93')]=_0xd45cd0;delete _0x2fd49c['ItemType.OrderBy'];_0xd45cd0=_0xd45cd0+0x1;return _0x2fd49c;});return db[_0x3063('0x95')][_0x3063('0x61')](_0x26214b,{});})[_0x3063('0x1a')](function(){_0x43e583(0x1);});});}function insertAdditionalPhones(_0x5b1d06,_0x1adee0){return new Promise(function(_0x39dc27){var _0x391013=[];for(var _0x1a7976=0x0;_0x1a7976<_0x1adee0['length'];_0x1a7976++){var _0x5023ed=_0x1adee0[_0x1a7976];_0x391013[_0x3063('0x69')](parseContactItemType(_0x5023ed));}Promise['all'](_0x391013)['then'](function(){var _0x267619={'id':_0x5b1d06['id'],'items':_0x1adee0};return addAdditionalPhones(_0x267619)[_0x3063('0x1a')](function(){return addCmHopperPhones(_0x5b1d06['id']);});})[_0x3063('0x1a')](function(){_0x39dc27(_0x5b1d06);});});}function parseContactItemType(_0x2ed579){return new Promise(function(_0x13d684){if(_0x2ed579[_0x3063('0x38')](_0x3063('0x91'))){_0x13d684(_0x2ed579);}else{return db[_0x3063('0x70')]['find']({'where':{'name':_0x2ed579[_0x3063('0x97')]}})[_0x3063('0x1a')](function(_0x41e488){if(_[_0x3063('0x5d')](_0x41e488))_0x2ed579[_0x3063('0x91')]=null;else _0x2ed579['ItemTypeId']=_0x41e488['id'];_0x13d684(_0x2ed579);});}});}exports[_0x3063('0x9a')]=function(_0x58a61d,_0x25e967){return db[_0x3063('0x8e')][_0x3063('0x2f')]({'raw':!![],'where':{'CmContactId':_0x58a61d[_0x3063('0x27')]['id'],'ItemClass':_0x3063('0x96')},'include':[{'model':db[_0x3063('0x70')],'as':_0x3063('0x97')}],'order':[[_0x3063('0x93')],[db[_0x3063('0x71')][_0x3063('0x72')](_0x3063('0x98'))]]})[_0x3063('0x1a')](function(_0x4df573){return _0x4df573;})[_0x3063('0x1a')](respondWithResult(_0x25e967,null))[_0x3063('0x24')](handleError(_0x25e967,null));};exports[_0x3063('0x9b')]=function(_0x16654f,_0x1f8288){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x16654f[_0x3063('0x3a')][_0x3063('0x9c')]}})[_0x3063('0x1a')](function(_0x4d3c58){var _0x27a2cf=_['map'](_0x4d3c58,function(_0x33804c){_0x33804c['CmContactId']=_0x16654f[_0x3063('0x3a')][_0x3063('0x9d')];return _0x33804c;});return db[_0x3063('0x8e')][_0x3063('0x61')](_0x27a2cf,{});})[_0x3063('0x1a')](function(){return addCmHopperPhones(_0x16654f[_0x3063('0x3a')]['toContactId']);})[_0x3063('0x1a')](function(){return['ok'];})['then'](respondWithResult(_0x1f8288,null))['catch'](handleError(_0x1f8288,null));};exports['rescheduleAdditionalPhones']=function(_0x34dd4a,_0x59f3a7){var _0x3832c6=[];_0x3832c6[_0x3063('0x69')](createCmHopperPhone(_0x34dd4a[_0x3063('0x3a')]['id'],_0x34dd4a[_0x3063('0x3a')]['hopperId']));Promise['all'](_0x3832c6)[_0x3063('0x1a')](function(){return[0x1];})['then'](respondWithResult(_0x59f3a7,null));};exports['getHoppers']=function(_0x473973,_0x410127){var _0x15a6d8={'raw':![],'where':{}};var _0xc9e1dd={};var _0x6a2638={'count':0x0,'rows':[]};return db[_0x3063('0x25')][_0x3063('0x81')]({'where':{'id':_0x473973[_0x3063('0x27')]['id']}})[_0x3063('0x1a')](handleEntityNotFound(_0x410127,null))[_0x3063('0x1a')](function(_0x5918b9){if(_0x5918b9){_0xc9e1dd[_0x3063('0x86')]=_[_0x3063('0x29')](db[_0x3063('0x40')][_0x3063('0x9e')]);_0xc9e1dd[_0x3063('0x22')]=_['keys'](_0x473973[_0x3063('0x22')]);_0xc9e1dd[_0x3063('0x83')]=_[_0x3063('0x84')](_0xc9e1dd[_0x3063('0x86')],_0xc9e1dd[_0x3063('0x22')]);_0x15a6d8['attributes']=_[_0x3063('0x84')](_0xc9e1dd[_0x3063('0x86')],qs[_0x3063('0x87')](_0x473973['query'][_0x3063('0x87')]));_0x15a6d8['attributes']=_0x15a6d8[_0x3063('0x85')][_0x3063('0x30')]?_0x15a6d8[_0x3063('0x85')]:_0xc9e1dd['model'];if(!_0x473973['query'][_0x3063('0x38')](_0x3063('0x8c'))){_0x15a6d8[_0x3063('0x14')]=qs[_0x3063('0x14')](_0x473973[_0x3063('0x22')]['limit']);_0x15a6d8[_0x3063('0x17')]=qs[_0x3063('0x17')](_0x473973[_0x3063('0x22')]['offset']);}_0x15a6d8[_0x3063('0x88')]=qs[_0x3063('0x89')](_0x473973[_0x3063('0x22')]['sort']);_0x15a6d8['where']=qs[_0x3063('0x83')](_['pick'](_0x473973['query'],_0xc9e1dd['filters']));_0x15a6d8['where'][_0x3063('0x9f')]=_0x5918b9['id'];if(_0x473973[_0x3063('0x22')][_0x3063('0xa0')]){_0x15a6d8[_0x3063('0x65')]=_[_0x3063('0x39')](_0x15a6d8[_0x3063('0x65')],{'$or':_[_0x3063('0x74')](_0x15a6d8[_0x3063('0x85')],function(_0x2a4523){var _0x866876={};_0x866876[_0x2a4523]={'$like':'%'+_0x473973[_0x3063('0x22')][_0x3063('0xa0')]+'%'};return _0x866876;})});}_0x15a6d8=_[_0x3063('0x39')]({},_0x15a6d8,_0x473973[_0x3063('0x8b')]);return db[_0x3063('0x40')]['count']({'where':_0x15a6d8[_0x3063('0x65')]})[_0x3063('0x1a')](function(_0x255f03){_0x6a2638[_0x3063('0x16')]=_0x255f03;if(_0x473973['query'][_0x3063('0xa1')]){_0x15a6d8['include']=[{'all':!![]}];}return db['CmHopper'][_0x3063('0x2f')](_0x15a6d8);})[_0x3063('0x1a')](function(_0x43eb34){_0x6a2638[_0x3063('0xa2')]=_0x43eb34;return _0x6a2638;});}})[_0x3063('0x1a')](respondWithFilteredResult(_0x410127,_0x15a6d8))['catch'](handleError(_0x410127,null));};exports['getHopperHistories']=function(_0x3937a6,_0x446dbc){var _0x2abfe5={'raw':!![],'where':{}};var _0x5072d8={};var _0x55a10b={'count':0x0,'rows':[]};return db[_0x3063('0x25')][_0x3063('0x81')]({'where':{'id':_0x3937a6[_0x3063('0x27')]['id']}})['then'](handleEntityNotFound(_0x446dbc,null))[_0x3063('0x1a')](function(_0x20ae31){if(_0x20ae31){_0x5072d8[_0x3063('0x86')]=_[_0x3063('0x29')](db[_0x3063('0x51')][_0x3063('0x9e')]);_0x5072d8[_0x3063('0x22')]=_['keys'](_0x3937a6[_0x3063('0x22')]);_0x5072d8[_0x3063('0x83')]=_['intersection'](_0x5072d8['model'],_0x5072d8['query']);_0x2abfe5[_0x3063('0x85')]=_['intersection'](_0x5072d8[_0x3063('0x86')],qs[_0x3063('0x87')](_0x3937a6[_0x3063('0x22')][_0x3063('0x87')]));_0x2abfe5[_0x3063('0x85')]=_0x2abfe5[_0x3063('0x85')]['length']?_0x2abfe5[_0x3063('0x85')]:_0x5072d8[_0x3063('0x86')];if(!_0x3937a6[_0x3063('0x22')][_0x3063('0x38')]('nolimit')){_0x2abfe5[_0x3063('0x14')]=qs['limit'](_0x3937a6[_0x3063('0x22')]['limit']);_0x2abfe5[_0x3063('0x17')]=qs['offset'](_0x3937a6[_0x3063('0x22')][_0x3063('0x17')]);}_0x2abfe5[_0x3063('0x88')]=qs['sort'](_0x3937a6['query'][_0x3063('0x89')]);_0x2abfe5[_0x3063('0x65')]=qs['filters'](_[_0x3063('0x8a')](_0x3937a6[_0x3063('0x22')],_0x5072d8[_0x3063('0x83')]));_0x2abfe5[_0x3063('0x65')][_0x3063('0x9f')]=_0x20ae31['id'];if(_0x3937a6[_0x3063('0x22')][_0x3063('0xa0')]){_0x2abfe5['where']=_['merge'](_0x2abfe5[_0x3063('0x65')],{'$or':_[_0x3063('0x74')](_0x2abfe5['attributes'],function(_0x414d35){var _0x540544={};_0x540544[_0x414d35]={'$like':'%'+_0x3937a6['query'][_0x3063('0xa0')]+'%'};return _0x540544;})});}_0x2abfe5=_[_0x3063('0x39')]({},_0x2abfe5,_0x3937a6[_0x3063('0x8b')]);return db['CmHopperHistory'][_0x3063('0x16')]({'where':_0x2abfe5[_0x3063('0x65')]})[_0x3063('0x1a')](function(_0x4d54c0){_0x55a10b[_0x3063('0x16')]=_0x4d54c0;if(_0x3937a6[_0x3063('0x22')]['includeAll']){_0x2abfe5[_0x3063('0xa3')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3063('0x2f')](_0x2abfe5);})[_0x3063('0x1a')](function(_0x1aefb5){_0x55a10b[_0x3063('0xa2')]=_0x1aefb5;return _0x55a10b;});}})[_0x3063('0x1a')](respondWithFilteredResult(_0x446dbc,_0x2abfe5))['catch'](handleError(_0x446dbc,null));};exports[_0x3063('0xa4')]=function(_0x58eaea,_0x48167c){var _0x4588af={'raw':!![],'where':{}};var _0x1a62cd={};var _0x4ec6b6={'count':0x0,'rows':[]};return db[_0x3063('0x25')][_0x3063('0x81')]({'where':{'id':_0x58eaea[_0x3063('0x27')]['id']}})['then'](handleEntityNotFound(_0x48167c,null))[_0x3063('0x1a')](function(_0x121e96){if(_0x121e96){_0x1a62cd[_0x3063('0x86')]=_[_0x3063('0x29')](db[_0x3063('0x50')][_0x3063('0x9e')]);_0x1a62cd[_0x3063('0x22')]=_[_0x3063('0x29')](_0x58eaea[_0x3063('0x22')]);_0x1a62cd[_0x3063('0x83')]=_[_0x3063('0x84')](_0x1a62cd[_0x3063('0x86')],_0x1a62cd[_0x3063('0x22')]);_0x4588af[_0x3063('0x85')]=_[_0x3063('0x84')](_0x1a62cd['model'],qs[_0x3063('0x87')](_0x58eaea[_0x3063('0x22')][_0x3063('0x87')]));_0x4588af[_0x3063('0x85')]=_0x4588af[_0x3063('0x85')][_0x3063('0x30')]?_0x4588af[_0x3063('0x85')]:_0x1a62cd['model'];if(!_0x58eaea[_0x3063('0x22')][_0x3063('0x38')](_0x3063('0x8c'))){_0x4588af[_0x3063('0x14')]=qs['limit'](_0x58eaea[_0x3063('0x22')]['limit']);_0x4588af[_0x3063('0x17')]=qs[_0x3063('0x17')](_0x58eaea[_0x3063('0x22')][_0x3063('0x17')]);}_0x4588af[_0x3063('0x88')]=qs['sort'](_0x58eaea[_0x3063('0x22')][_0x3063('0x89')]);_0x4588af[_0x3063('0x65')]=qs[_0x3063('0x83')](_['pick'](_0x58eaea[_0x3063('0x22')],_0x1a62cd[_0x3063('0x83')]));_0x4588af[_0x3063('0x65')][_0x3063('0x9f')]=_0x121e96['id'];if(_0x58eaea[_0x3063('0x22')]['filter']){_0x4588af[_0x3063('0x65')]=_[_0x3063('0x39')](_0x4588af[_0x3063('0x65')],{'$or':_['map'](_0x4588af[_0x3063('0x85')],function(_0x3ee430){var _0x55b675={};_0x55b675[_0x3ee430]={'$like':'%'+_0x58eaea[_0x3063('0x22')][_0x3063('0xa0')]+'%'};return _0x55b675;})});}_0x4588af=_['merge']({},_0x4588af,_0x58eaea[_0x3063('0x8b')]);return db[_0x3063('0x50')][_0x3063('0x16')]({'where':_0x4588af[_0x3063('0x65')]})['then'](function(_0x51b956){_0x4ec6b6[_0x3063('0x16')]=_0x51b956;if(_0x58eaea[_0x3063('0x22')][_0x3063('0xa1')]){_0x4588af[_0x3063('0xa3')]=[{'all':!![]}];}return db[_0x3063('0x50')][_0x3063('0x2f')](_0x4588af);})[_0x3063('0x1a')](function(_0x46b032){_0x4ec6b6[_0x3063('0xa2')]=_0x46b032;return _0x4ec6b6;});}})[_0x3063('0x1a')](respondWithFilteredResult(_0x48167c,_0x4588af))['catch'](handleError(_0x48167c,null));};exports[_0x3063('0xa5')]=function(_0x5ceaae,_0x48ded8){var _0x307b5d={'raw':!![],'where':{}};var _0x301363={};var _0x412315={'count':0x0,'rows':[]};return db['CmContact'][_0x3063('0x81')]({'where':{'id':_0x5ceaae['params']['id']}})[_0x3063('0x1a')](handleEntityNotFound(_0x48ded8,null))[_0x3063('0x1a')](function(_0xbd35b6){if(_0xbd35b6){_0x301363[_0x3063('0x86')]=_['keys'](db[_0x3063('0x58')][_0x3063('0x9e')]);_0x301363['query']=_[_0x3063('0x29')](_0x5ceaae[_0x3063('0x22')]);_0x301363[_0x3063('0x83')]=_[_0x3063('0x84')](_0x301363[_0x3063('0x86')],_0x301363[_0x3063('0x22')]);_0x307b5d[_0x3063('0x85')]=_[_0x3063('0x84')](_0x301363[_0x3063('0x86')],qs[_0x3063('0x87')](_0x5ceaae['query'][_0x3063('0x87')]));_0x307b5d['attributes']=_0x307b5d[_0x3063('0x85')][_0x3063('0x30')]?_0x307b5d[_0x3063('0x85')]:_0x301363[_0x3063('0x86')];if(!_0x5ceaae[_0x3063('0x22')][_0x3063('0x38')]('nolimit')){_0x307b5d[_0x3063('0x14')]=qs[_0x3063('0x14')](_0x5ceaae[_0x3063('0x22')][_0x3063('0x14')]);_0x307b5d[_0x3063('0x17')]=qs[_0x3063('0x17')](_0x5ceaae['query'][_0x3063('0x17')]);}_0x307b5d[_0x3063('0x88')]=qs[_0x3063('0x89')](_0x5ceaae[_0x3063('0x22')]['sort']);_0x307b5d[_0x3063('0x65')]=qs[_0x3063('0x83')](_[_0x3063('0x8a')](_0x5ceaae[_0x3063('0x22')],_0x301363[_0x3063('0x83')]));_0x307b5d['where']['ContactId']=_0xbd35b6['id'];if(_0x5ceaae[_0x3063('0x22')][_0x3063('0xa0')]){_0x307b5d[_0x3063('0x65')]=_[_0x3063('0x39')](_0x307b5d[_0x3063('0x65')],{'$or':_[_0x3063('0x74')](_0x307b5d[_0x3063('0x85')],function(_0x15deb1){var _0x5ea032={};_0x5ea032[_0x15deb1]={'$like':'%'+_0x5ceaae[_0x3063('0x22')]['filter']+'%'};return _0x5ea032;})});}_0x307b5d=_[_0x3063('0x39')]({},_0x307b5d,_0x5ceaae['options']);return db[_0x3063('0x58')]['count']({'where':_0x307b5d[_0x3063('0x65')]})[_0x3063('0x1a')](function(_0x3a343d){_0x412315[_0x3063('0x16')]=_0x3a343d;if(_0x5ceaae[_0x3063('0x22')][_0x3063('0xa1')]){_0x307b5d[_0x3063('0xa3')]=[{'all':!![]}];}return db[_0x3063('0x58')][_0x3063('0x2f')](_0x307b5d);})[_0x3063('0x1a')](function(_0x50dfce){_0x412315[_0x3063('0xa2')]=_0x50dfce;return _0x412315;});}})[_0x3063('0x1a')](respondWithFilteredResult(_0x48ded8,_0x307b5d))[_0x3063('0x24')](handleError(_0x48ded8,null));};exports[_0x3063('0xa6')]=function(_0x250a75,_0x361279){try{if(!_0x250a75[_0x3063('0x3a')][_0x3063('0x66')]){throw new Error(_0x3063('0xa7'));}if(!_0x250a75['body'][_0x3063('0xa8')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x250a75[_0x3063('0x3a')][_0x3063('0xa9')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x250a75['body']['socket_timestamp']){throw new Error(_0x3063('0xaa'));}var _0x1e617a=_0x250a75[_0x3063('0x3a')][_0x3063('0xa8')][_0x3063('0xab')](',');var _0x166bb3=_0x250a75[_0x3063('0x3a')][_0x3063('0xa9')][_0x3063('0xab')](',');if(!_0x1e617a[_0x3063('0x30')]||!_0x166bb3[_0x3063('0x30')]||_0x1e617a['length']!==_0x166bb3[_0x3063('0x30')]){throw new Error(_0x3063('0xac'));}_0x250a75['body'][_0x3063('0x87')]=_[_0x3063('0xad')](_0x1e617a,_0x166bb3);if(!_0x250a75[_0x3063('0x3a')][_0x3063('0x87')][_0x3063('0x7f')]){throw new Error(_0x3063('0xae'));}if(!_0x250a75['body'][_0x3063('0x87')][_0x3063('0xaf')]){throw new Error(_0x3063('0xb0'));}var _0x59932f=path[_0x3063('0x3f')](config['root'],'server/files/tmp',_0x250a75[_0x3063('0xb1')][_0x3063('0xb2')]);fs[_0x3063('0xb3')](_0x59932f,parseInt('0777',0x8));var _0x583d7f=require(_0x3063('0xb4'))['fork'](path[_0x3063('0x3f')](__dirname,'../../components/import/cm/csv'),[_0x59932f,_0x250a75['body'][_0x3063('0xa8')],_0x250a75[_0x3063('0x3a')]['binding_values'],_0x250a75[_0x3063('0x3a')][_0x3063('0x66')],_0x250a75[_0x3063('0x3a')][_0x3063('0xb5')],_0x250a75['body']['duplicates'],_0x250a75[_0x3063('0x3a')][_0x3063('0xb6')]]);return _0x361279[_0x3063('0x12')](0xc8)[_0x3063('0x13')]({'message':_0x3063('0xb7'),'pid':_0x583d7f['pid']});}catch(_0x244d46){return _0x361279[_0x3063('0x12')](0x1f4)[_0x3063('0xb8')](_0x244d46);}};exports[_0x3063('0xb9')]=function(_0x5b3893,_0x14156b){var _0x5b1d3a=fs[_0x3063('0xba')](_0x5b3893['file'][_0x3063('0x3')]);Papa['parse'](_0x5b1d3a,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x38fe01){return _0x14156b['status'](0xc8)['json']({'file':_0x5b3893[_0x3063('0xb1')],'fields':_0x38fe01[_0x3063('0xbb')][_0x3063('0x87')]});}});};exports[_0x3063('0xbc')]=function(_0x26fccc,_0x493608){return db[_0x3063('0xbd')][_0x3063('0x2f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3063('0xbe')}})[_0x3063('0x1a')](function(_0x2505d8){var _0x47ae08=![];if(!_0x26fccc[_0x3063('0x3a')][_0x3063('0x66')]){throw new Error(_0x3063('0xa7'));}if(!_0x26fccc[_0x3063('0x3a')][_0x3063('0xbf')][_0x3063('0x7f')]){throw new Error(_0x3063('0xae'));}if(!_0x26fccc[_0x3063('0x3a')][_0x3063('0xbf')]['firstName']){throw new Error(_0x3063('0xb0'));}if(!_0x26fccc[_0x3063('0x3a')][_0x3063('0xb6')]){throw new Error(_0x3063('0xaa'));}var _0xd5429e=require(_0x3063('0xb4'))['fork'](path['join'](__dirname,_0x3063('0xc0')),[_0x26fccc[_0x3063('0x27')]['id'],JSON[_0x3063('0xc1')](_0x26fccc['body']),JSON[_0x3063('0xc1')](_0x2505d8)]);_0xd5429e['on'](_0x3063('0xc2'),function(){_0x47ae08=!![];return _0x493608[_0x3063('0x12')](0xc8)[_0x3063('0x13')]({'message':_0x3063('0xc3'),'pid':_0xd5429e[_0x3063('0xc4')]});});_0xd5429e['on']('exit',function(_0x34ca4d){if(_0x34ca4d&&!_0x47ae08){return _0x493608['status'](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0xd5429e['pid']});}});})[_0x3063('0x24')](handleError(_0x493608,null));};exports[_0x3063('0xc5')]=function(_0x55c2ef,_0x161197){return db[_0x3063('0xbd')][_0x3063('0x2f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3063('0xbe')}})[_0x3063('0x1a')](function(_0x384388){var _0x255730=![];if(!_0x55c2ef[_0x3063('0x3a')][_0x3063('0x66')]){throw new Error('No\x20ListId\x20specified');}if(!_0x55c2ef['body']['binding']['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x55c2ef[_0x3063('0x3a')][_0x3063('0xbf')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x55c2ef['body'][_0x3063('0xb6')]){throw new Error(_0x3063('0xaa'));}var _0x2fc393=require(_0x3063('0xb4'))[_0x3063('0xc6')](path[_0x3063('0x3f')](__dirname,_0x3063('0xc7')),[_0x55c2ef[_0x3063('0x27')]['id'],JSON[_0x3063('0xc1')](_0x55c2ef[_0x3063('0x3a')]),JSON['stringify'](_0x384388)]);_0x2fc393['on'](_0x3063('0xc2'),function(){_0x255730=!![];return _0x161197['status'](0xc8)[_0x3063('0x13')]({'message':_0x3063('0xc3'),'pid':_0x2fc393['pid']});});_0x2fc393['on'](_0x3063('0xc8'),function(_0x212117){if(_0x212117&&!_0x255730){return _0x161197[_0x3063('0x12')](0x1f4)[_0x3063('0x13')]({'message':_0x3063('0xc9'),'pid':_0x2fc393['pid']});}});})[_0x3063('0x24')](handleError(_0x161197,null));};exports[_0x3063('0xca')]=function(_0xf986bf,_0x43a149){var _0x515d36=[_0x3063('0xcb'),_0x3063('0xcc'),'sms',_0x3063('0xcd'),'fax',_0x3063('0xce'),_0x3063('0xcf')];var _0x1afe5b={'offset':0x0,'order':qs[_0x3063('0x89')](_0x3063('0xd0'))},_0x137ef0={'count':0x0,'rows':[]};Promise[_0x3063('0xd1')]()['then'](function(){if(_0xf986bf[_0x3063('0x22')]['channel']){if(!_[_0x3063('0xd2')](_0x515d36,_0xf986bf[_0x3063('0x22')][_0x3063('0xd3')][_0x3063('0xd4')]())){throw new Error(_0x3063('0xd5'));}_0x515d36=[_0xf986bf[_0x3063('0x22')][_0x3063('0xd3')]['toLowerCase']()];}if(_0xf986bf[_0x3063('0x22')][_0x3063('0xd6')]){try{var _0x584a10=JSON[_0x3063('0xd7')](_0xf986bf[_0x3063('0x22')][_0x3063('0xd6')]);if(!moment(_0x584a10[_0x3063('0x3b')])['isValid']()){throw new Error(_0x3063('0xd8'));}if(!moment(_0x584a10['to'])[_0x3063('0xd9')]()){throw new Error(_0x3063('0xda'));}}catch(_0x103898){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0xf986bf[_0x3063('0x22')][_0x3063('0x38')](_0x3063('0x8c'))){_0x1afe5b[_0x3063('0x14')]=qs[_0x3063('0x14')](_0xf986bf[_0x3063('0x22')]['limit']||0xa);_0x1afe5b['offset']=qs[_0x3063('0x17')](_0xf986bf['query']['offset']);}var _0x3a63e7=_0x515d36[_0x3063('0x74')](function(_0xa161f2){if(_0xa161f2===_0x3063('0xcf')){var _0x58254d={'attributes':['id','uniqueid',_0x3063('0x33'),'source',_0x3063('0xdb'),_0x3063('0xdc'),_0x3063('0xdd'),_0x3063('0xde'),_0x3063('0xdf'),_0x3063('0xe0'),_0x3063('0xe1'),_0x3063('0xe2'),_0x3063('0xe3'),_0x3063('0xe4'),_0x3063('0xe5')],'where':{'ContactId':_0xf986bf['params']['id']},'include':[{'model':db[_0x3063('0xbd')],'as':_0x3063('0xbd'),'attributes':['id',_0x3063('0x1f'),_0x3063('0xe6'),_0x3063('0x32')]}],'order':[[_0x3063('0xe1'),_0x3063('0xe7')]]};if(_0xf986bf['query'][_0x3063('0xd6')]){_0x58254d[_0x3063('0x65')][_0x3063('0xe1')]={'$gte':_0x584a10[_0x3063('0x3b')],'$lte':_0x584a10['to']};}return db[_0x3063('0x53')]['findAndCountAll'](_0x58254d)[_0x3063('0x1a')](function(_0x226a92){_0x137ef0['count']+=_0x226a92[_0x3063('0x16')];return _[_0x3063('0x74')](_0x226a92[_0x3063('0xa2')],function(_0x5520b9){var _0x4c2b75=_0x5520b9['get']({'plain':!![]});_0x4c2b75[_0x3063('0xd3')]=_0xa161f2;if(_0x4c2b75[_0x3063('0xbd')]){_0x4c2b75[_0x3063('0xbd')]={'id':_0x4c2b75['User']['id'],'name':_0x4c2b75[_0x3063('0xbd')][_0x3063('0x1f')],'fullname':_0x4c2b75[_0x3063('0xbd')][_0x3063('0xe6')],'alias':_0x4c2b75[_0x3063('0xbd')]['alias']};}return _0x4c2b75;});});}else{var _0x44929d=_['startCase'](_0xa161f2)+(_0xa161f2===_0x3063('0xcc')?_0x3063('0xe8'):_0x3063('0xe9'));var _0x44a8bb={'attributes':['id',_0x3063('0xea'),_0x3063('0xeb'),_0x3063('0xe1'),_0x3063('0xe0'),'disposition','secondDisposition',_0x3063('0xec'),_0x3063('0xe5'),_0x44929d+'Id'],'where':{'ContactId':_0xf986bf[_0x3063('0x27')]['id']},'include':[{'model':db[_0x44929d],'as':_0x3063('0xe9'),'attributes':['id',_0x3063('0x1f'),_0x3063('0xed')]},{'model':db[_0x3063('0xbd')],'as':_0x3063('0xee'),'attributes':['id',_0x3063('0x1f'),'fullname']},{'model':db[_0x3063('0x82')],'as':_0x3063('0x6c'),'attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[[_0x3063('0xe1'),_0x3063('0xe7')]]};if(_0xf986bf['query'][_0x3063('0xd6')]){_0x44a8bb[_0x3063('0x65')][_0x3063('0xe1')]={'$gte':_0x584a10[_0x3063('0x3b')],'$lte':_0x584a10['to']};}switch(_0xa161f2){case'chat':_0x44a8bb[_0x3063('0x85')][_0x3063('0x69')]('browserName',_0x3063('0xef'),_0x3063('0xf0'),'deviceModel',_0x3063('0xf1'),_0x3063('0xf2'),_0x3063('0xf3'),_0x3063('0xf4'),_0x3063('0xf5'));break;case _0x3063('0xcb'):_0x44a8bb[_0x3063('0x85')][_0x3063('0x69')](_0x3063('0xf6'),'substatus');break;case _0x3063('0xcd'):_0x44a8bb[_0x3063('0x85')]['push'](_0x3063('0xf7'),_0x3063('0xf8'));break;}return db[_[_0x3063('0xf9')](_0xa161f2)+'Interaction'][_0x3063('0xfa')](_0x44a8bb)[_0x3063('0x1a')](function(_0x97e833){_0x137ef0['count']+=_0x97e833[_0x3063('0x16')];return _[_0x3063('0x74')](_0x97e833[_0x3063('0xa2')],function(_0x540020){var _0x3b8cef=_0x540020[_0x3063('0x3c')]({'plain':!![]});_0x3b8cef[_0x3063('0xd3')]=_0xa161f2;if(_0x3b8cef[_0x3063('0xee')]){_0x3b8cef[_0x3063('0xee')]={'id':_0x3b8cef[_0x3063('0xee')]['id'],'name':_0x3b8cef[_0x3063('0xee')][_0x3063('0x1f')],'fullname':_0x3b8cef[_0x3063('0xee')][_0x3063('0xe6')]};}return _0x3b8cef;});});}});return Promise[_0x3063('0x6b')](_0x3a63e7);})[_0x3063('0x1a')](function(_0x3b5f2d){return _(_0x3b5f2d)[_0x3063('0xfb')]()[_0x3063('0xfc')]('createdAt')[_0x3063('0xfd')]()[_0x3063('0xfe')]();})[_0x3063('0x1a')](function(_0x43f096){_0x137ef0[_0x3063('0xa2')]=_0x1afe5b[_0x3063('0x14')]?_0x43f096[_0x3063('0xff')](_0x1afe5b[_0x3063('0x17')],_0x1afe5b['offset']+_0x1afe5b['limit']):_0x43f096;return _0x137ef0;})['then'](respondWithFilteredResult(_0x43a149,_0x1afe5b))[_0x3063('0x24')](handleError(_0x43a149,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index ef0849d..8b61d8e 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 _0x4539=['setMaxListeners','update','remove','hook','exports','../../mysqldb','CmContact'];(function(_0x538896,_0x2c894c){var _0xaea97=function(_0x10ef5e){while(--_0x10ef5e){_0x538896['push'](_0x538896['shift']());}};_0xaea97(++_0x2c894c);}(_0x4539,0xb4));var _0x9453=function(_0x11857c,_0x5c70eb){_0x11857c=_0x11857c-0x0;var _0x2b8268=_0x4539[_0x11857c];return _0x2b8268;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x9453('0x0'))['db'][_0x9453('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9453('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9453('0x3'),'afterDestroy':_0x9453('0x4')};function emitEvent(_0x2c0b20){return function(_0x330765,_0x304719,_0x2932bb){CmContactEvents['emit'](_0x2c0b20+':'+_0x330765['id'],_0x330765);CmContactEvents['emit'](_0x2c0b20,_0x330765);_0x2932bb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x9453('0x5')](e,emitEvent(event));}}module[_0x9453('0x6')]=CmContactEvents; \ No newline at end of file +var _0x5ecb=['emit','hasOwnProperty','hook','exports','../../mysqldb','save','update','remove'];(function(_0x10e3b2,_0x3187b9){var _0xed1e6=function(_0x3bdb39){while(--_0x3bdb39){_0x10e3b2['push'](_0x10e3b2['shift']());}};_0xed1e6(++_0x3187b9);}(_0x5ecb,0x154));var _0xb5ec=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x5ecb[_0x3f5dca];return _0x5b833a;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xb5ec('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb5ec('0x1'),'afterUpdate':_0xb5ec('0x2'),'afterDestroy':_0xb5ec('0x3')};function emitEvent(_0x235ce0){return function(_0x44b5b3,_0x4bf38d,_0x525600){CmContactEvents[_0xb5ec('0x4')](_0x235ce0+':'+_0x44b5b3['id'],_0x44b5b3);CmContactEvents[_0xb5ec('0x4')](_0x235ce0,_0x44b5b3);_0x525600(null);};}for(var e in events){if(events[_0xb5ec('0x5')](e)){var event=events[e];CmContact[_0xb5ec('0x6')](e,emitEvent(event));}}module[_0xb5ec('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 78b046a..d8dfac9 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 _0xde0c=['dialTimezone','resolve','findOne','then','isNil','utcOffset','add','minutes','ListId','priority','callbackUniqueid','phone','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','dialCheckDuplicateType','always','onlyIfOpen','findAll','outbound','CmList','Lists','map','CmHopperBlack','Campaign','BlackLists','all','exports','define','CmContact','cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','isEmpty','length','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','./cmContact.attributes','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x42c423,_0x7f2d37){var _0x358d9c=function(_0x401372){while(--_0x401372){_0x42c423['push'](_0x42c423['shift']());}};_0x358d9c(++_0x7f2d37);}(_0xde0c,0x1e0));var _0xcde0=function(_0x180c73,_0x2fde22){_0x180c73=_0x180c73-0x0;var _0x5d384f=_0xde0c[_0x180c73];return _0x5d384f;};'use strict';var _=require(_0xcde0('0x0'));var util=require(_0xcde0('0x1'));var logger=require(_0xcde0('0x2'))(_0xcde0('0x3'));var moment=require(_0xcde0('0x4'));var shared=require('../../config/environment/shared');var attributes=require(_0xcde0('0x5'));function getTimezoneCallbackAt(_0xb34b2e,_0x4b5cc1,_0x15ee98,_0xd93ab9){var _0x3ddac3=_0xd93ab9?'Campaign':_0xcde0('0x6');var _0x4d9f7a=_0x15ee98['scheduledat']?_0x15ee98[_0xcde0('0x7')]:moment()[_0xcde0('0x8')](_0xcde0('0x9'));if(_['isNil'](_0x15ee98[_0xcde0('0xa')])){return Promise[_0xcde0('0xb')](_0x4d9f7a);}return _0xb34b2e[_0x3ddac3][_0xcde0('0xc')]({'where':{'id':_0x4b5cc1}})[_0xcde0('0xd')](function(_0xddc774){if(_[_0xcde0('0xe')](_0xddc774)||_['isNil'](_0xddc774[_0xcde0('0xa')])){return Promise[_0xcde0('0xb')](_0x4d9f7a);}var _0x2d9867=shared['timezones'];var _0xa509d9=_0x2d9867[_0xddc774[_0xcde0('0xa')]];var _0x5673e5=_0x2d9867[_0x15ee98[_0xcde0('0xa')]];if(_['isNil'](_0xa509d9)&&_[_0xcde0('0xe')](_0x5673e5)){return Promise[_0xcde0('0xb')](_0x4d9f7a);}var _0x30cfd9=_0xa509d9[_0xcde0('0xf')]-_0x5673e5['utcOffset'];var _0x3b80e6=_0x15ee98[_0xcde0('0x7')]?_0x15ee98[_0xcde0('0x7')]:moment();_0x4d9f7a=moment(_0x3b80e6)[_0xcde0('0x10')](_0x30cfd9,_0xcde0('0x11'))[_0xcde0('0x8')]('YYYY-MM-DD\x20HH:mm:ss');return Promise[_0xcde0('0xb')](_0x4d9f7a);});}function getNewHopperPayload(_0x1ef41e){return{'phone':_0x1ef41e['phone'],'ContactId':_0x1ef41e['id'],'ListId':_0x1ef41e[_0xcde0('0x12')],'scheduledat':_0x1ef41e[_0xcde0('0x7')]?_0x1ef41e[_0xcde0('0x7')]:moment()[_0xcde0('0x8')](_0xcde0('0x9')),'priority':_0x1ef41e[_0xcde0('0x13')]?_0x1ef41e[_0xcde0('0x13')]:0x2,'callback':_0x1ef41e[_0xcde0('0x14')]?!![]:![],'callbackuniqueid':_0x1ef41e[_0xcde0('0x14')]?_0x1ef41e['callbackUniqueid']:undefined,'callbackat':_0x1ef41e[_0xcde0('0x14')]?moment()['format'](_0xcde0('0x9')):undefined};}function handleAlwaysCheckDuplicate(_0x3b1a7d,_0x428321,_0x149c23,_0x2f61d3){var _0x5703fa={'phone':_0x149c23[_0xcde0('0x15')]};var _0x1698f4={'calleridnum':_0x149c23[_0xcde0('0x15')]};if(_0x2f61d3){Object[_0xcde0('0x16')](_0x5703fa,{'CampaignId':_0x428321['id']});Object[_0xcde0('0x16')](_0x1698f4,{'CampaignId':_0x428321['id']});}else{Object[_0xcde0('0x16')](_0x5703fa,{'VoiceQueueId':_0x428321['id']});Object[_0xcde0('0x16')](_0x1698f4,{'VoiceQueueId':_0x428321['id']});}return _0x3b1a7d[_0xcde0('0x17')][_0xcde0('0xc')]({'where':_0x5703fa})[_0xcde0('0xd')](function(_0x2efc21){if(_0x2efc21){throw new Error(_0xcde0('0x18')+_0x149c23[_0xcde0('0x15')]+_0xcde0('0x19')+_0x428321['id']);}return _0x3b1a7d[_0xcde0('0x1a')]['findOne']({'where':_0x1698f4});})[_0xcde0('0xd')](function(_0x361491){if(_0x361491){throw new Error(_0xcde0('0x1b')+_0x149c23[_0xcde0('0x15')]+_0xcde0('0x19')+_0x428321['id']);}var _0x34f88d=getNewHopperPayload(_0x149c23);if(_0x2f61d3){_0x34f88d['CampaignId']=_0x428321['id'];}else{_0x34f88d[_0xcde0('0x1c')]=_0x428321['id'];}return _0x3b1a7d[_0xcde0('0x17')][_0xcde0('0x1d')](_0x34f88d);});}function handleOnlyIfOpenCheckDuplicate(_0x863fcf,_0x201435,_0x3f0ae3,_0x3757eb){var _0x3fbef9={'phone':_0x3f0ae3[_0xcde0('0x15')]};if(_0x3757eb){Object[_0xcde0('0x16')](_0x3fbef9,{'CampaignId':_0x201435['id']});}else{Object[_0xcde0('0x16')](_0x3fbef9,{'VoiceQueueId':_0x201435['id']});}return _0x863fcf[_0xcde0('0x17')][_0xcde0('0xc')]({'where':_0x3fbef9})[_0xcde0('0xd')](function(_0x23f241){if(_0x23f241){throw new Error(_0xcde0('0x1e')+_0x3f0ae3[_0xcde0('0x15')]+_0xcde0('0x19')+_0x201435['id']);}var _0x37416f=getNewHopperPayload(_0x3f0ae3);if(_0x3757eb){_0x37416f['CampaignId']=_0x201435['id'];}else{_0x37416f[_0xcde0('0x1c')]=_0x201435['id'];}return _0x863fcf[_0xcde0('0x17')][_0xcde0('0x1d')](_0x37416f);});}function handleNeverCheckDuplicate(_0x43c7e6,_0x5a4d8a,_0x5e1ee1){var _0x8cb558=getNewHopperPayload(_0x5e1ee1);_0x8cb558[_0xcde0('0x1c')]=_0x5a4d8a['id'];return _0x43c7e6[_0xcde0('0x17')][_0xcde0('0x1d')](_0x8cb558);}function handleCheckDuplicate(_0x4667f5,_0x56fe6d,_0x5d9a3c,_0x1695b5){return getTimezoneCallbackAt(_0x4667f5,_0x56fe6d,_0x5d9a3c,_0x1695b5)[_0xcde0('0xd')](function(_0x53f57f){_0x5d9a3c[_0xcde0('0x7')]=_0x53f57f;switch(_0x56fe6d[_0xcde0('0x1f')]){case _0xcde0('0x20'):return handleAlwaysCheckDuplicate(_0x4667f5,_0x56fe6d,_0x5d9a3c,_0x1695b5);case _0xcde0('0x21'):return handleOnlyIfOpenCheckDuplicate(_0x4667f5,_0x56fe6d,_0x5d9a3c,_0x1695b5);default:return handleNeverCheckDuplicate(_0x4667f5,_0x56fe6d,_0x5d9a3c);}});}function createHopperForVoiceQueues(_0x58ed6e,_0x57ba35){return _0x58ed6e[_0xcde0('0x6')][_0xcde0('0x22')]({'where':{'type':_0xcde0('0x23')},'attributes':['id','dialCheckDuplicateType',_0xcde0('0xa')],'include':[{'model':_0x58ed6e[_0xcde0('0x24')],'as':_0xcde0('0x25'),'where':{'id':_0x57ba35['ListId']}}],'raw':!![]})[_0xcde0('0xd')](function(_0x554cb6){var _0x2e962a=_0x554cb6[_0xcde0('0x26')](function(_0x3cada7){return handleCheckDuplicate(_0x58ed6e,_0x3cada7,_0x57ba35,![]);});return Promise['all'](_0x2e962a);});}function createHopperForCampaigns(_0x10f473,_0x43ca5a){return _0x10f473['Campaign'][_0xcde0('0x22')]({'attributes':['id',_0xcde0('0x1f'),_0xcde0('0xa')],'include':[{'model':_0x10f473[_0xcde0('0x24')],'as':_0xcde0('0x25'),'where':{'id':_0x43ca5a[_0xcde0('0x12')]}}],'raw':!![]})[_0xcde0('0xd')](function(_0x2bf42a){var _0x35d52a=_0x2bf42a['map'](function(_0x5b31db){return handleCheckDuplicate(_0x10f473,_0x5b31db,_0x43ca5a,!![]);});return Promise['all'](_0x35d52a);});}function createHopperBlackForVoiceQueues(_0x3f06a1,_0x20b984){return _0x3f06a1[_0xcde0('0x6')][_0xcde0('0x22')]({'where':{'type':_0xcde0('0x23')},'attributes':['id'],'include':[{'model':_0x3f06a1['CmList'],'as':'BlackLists','where':{'id':_0x20b984['ListId']}}],'raw':!![]})['then'](function(_0xe63e00){var _0xae7b5f=_0xe63e00[_0xcde0('0x26')](function(_0x50265d){return _0x3f06a1[_0xcde0('0x27')][_0xcde0('0x1d')]({'phone':_0x20b984[_0xcde0('0x15')],'ContactId':_0x20b984['id'],'ListId':_0x20b984[_0xcde0('0x12')],'VoiceQueueId':_0x50265d['id']});});return Promise['all'](_0xae7b5f);});}function createHopperBlackForCampaigns(_0x2b26b0,_0xcb54f2){return _0x2b26b0[_0xcde0('0x28')][_0xcde0('0x22')]({'attributes':['id'],'include':[{'model':_0x2b26b0['CmList'],'as':_0xcde0('0x29'),'where':{'id':_0xcb54f2[_0xcde0('0x12')]}}],'raw':!![]})['then'](function(_0x57732f){var _0x2a62e8=_0x57732f[_0xcde0('0x26')](function(_0x14a097){return _0x2b26b0['CmHopperBlack']['create']({'phone':_0xcb54f2['phone'],'ContactId':_0xcb54f2['id'],'ListId':_0xcb54f2[_0xcde0('0x12')],'CampaignId':_0x14a097['id']});});return Promise[_0xcde0('0x2a')](_0x2a62e8);});}module[_0xcde0('0x2b')]=function(_0x4992db){return _0x4992db[_0xcde0('0x2c')](_0xcde0('0x2d'),attributes,{'tableName':_0xcde0('0x2e'),'paranoid':!![],'indexes':[{'name':_0xcde0('0x15'),'fields':[_0xcde0('0x15')]},{'name':'fti_cm_contacts','fields':[_0xcde0('0x2f'),_0xcde0('0x30'),_0xcde0('0x15'),_0xcde0('0x31'),_0xcde0('0x32'),_0xcde0('0x33')],'type':_0xcde0('0x34')}],'timestamps':!![],'charset':_0xcde0('0x35'),'collate':_0xcde0('0x36'),'hooks':{'afterCreate':function(_0x146d43,_0x1ce36d,_0x41cfe6){var _0x18da59=_0x4992db[_0xcde0('0x37')];var _0x398299=_0x146d43[_0xcde0('0x38')]({'plain':!![]});if(!_0x398299[_0xcde0('0x12')]){logger[_0xcde0('0x39')](_0xcde0('0x3a')+_0x398299['id']);return _0x41cfe6();}if(!_0x398299[_0xcde0('0x15')]){return _0x41cfe6();}return createHopperForVoiceQueues(_0x18da59,_0x398299)[_0xcde0('0xd')](function(){return createHopperBlackForVoiceQueues(_0x18da59,_0x398299);})[_0xcde0('0xd')](function(){return createHopperForCampaigns(_0x18da59,_0x398299);})[_0xcde0('0xd')](function(){return createHopperBlackForCampaigns(_0x18da59,_0x398299);})['then'](function(){return _0x41cfe6();})[_0xcde0('0x3b')](function(_0x107794){logger[_0xcde0('0x39')](_0xcde0('0x3c'),_0x107794[_0xcde0('0x3d')]);_0x41cfe6();});},'afterDestroy':function(_0xab9ec7,_0x13137e,_0x5ca531){var _0x5edf90=_0x4992db['models'];var _0x27b500=_0xab9ec7[_0xcde0('0x38')]({'plain':!![]});return _0x5edf90[_0xcde0('0x17')]['findAll']({'raw':!![],'where':{'ListId':_0x27b500[_0xcde0('0x12')],'ContactId':_0x27b500['id']}})['then'](function(_0x51bdbc){if(!_[_0xcde0('0x3e')](_0x51bdbc)){var _0x2245a2=[];for(var _0x44b38c=0x0;_0x44b38c<_0x51bdbc[_0xcde0('0x3f')];_0x44b38c+=0x1){var _0x2c1d77=_0x5edf90[_0xcde0('0x17')]['destroy']({'where':{'ListId':_0x51bdbc[_0x44b38c]['ListId'],'ContactId':_0x51bdbc[_0x44b38c][_0xcde0('0x40')],'VoiceQueueId':_0x51bdbc[_0x44b38c][_0xcde0('0x1c')],'CampaignId':_0x51bdbc[_0x44b38c]['CampaignId']}});_0x2245a2[_0xcde0('0x41')](_0x2c1d77);}return Promise[_0xcde0('0x2a')](_0x2245a2);}})['then'](function(_0x43fe96){logger[_0xcde0('0x42')](_0xcde0('0x43'),util[_0xcde0('0x44')](_0x43fe96,{'showHidden':![],'depth':null}));_0x5ca531();})[_0xcde0('0x3b')](function(_0x9ad698){logger[_0xcde0('0x39')](_0xcde0('0x45'),util['inspect'](_0x9ad698,{'showHidden':![],'depth':null}));_0x5ca531(_0x9ad698);});}}});}; \ No newline at end of file +var _0xf2b8=['catch','message','isEmpty','length','destroy','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','../../config/environment/shared','./cmContact.attributes','VoiceQueue','scheduledat','format','isNil','dialTimezone','findOne','then','resolve','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','always','findAll','outbound','dialCheckDuplicateType','Lists','map','all','Campaign','CmList','BlackLists','CmHopperBlack','create','exports','define','cm_contacts','fti_cm_contacts','firstName','lastName','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'];(function(_0x4cbe17,_0x300320){var _0x3070ef=function(_0xce193c){while(--_0xce193c){_0x4cbe17['push'](_0x4cbe17['shift']());}};_0x3070ef(++_0x300320);}(_0xf2b8,0x116));var _0x8f2b=function(_0x11d452,_0x14e650){_0x11d452=_0x11d452-0x0;var _0x44cc01=_0xf2b8[_0x11d452];return _0x44cc01;};'use strict';var _=require(_0x8f2b('0x0'));var util=require(_0x8f2b('0x1'));var logger=require(_0x8f2b('0x2'))(_0x8f2b('0x3'));var moment=require('moment');var shared=require(_0x8f2b('0x4'));var attributes=require(_0x8f2b('0x5'));function getTimezoneCallbackAt(_0x4d71c2,_0x2c2db1,_0x2c9aff,_0xd317a4){var _0x165fa2=_0xd317a4?'Campaign':_0x8f2b('0x6');var _0x21f115=_0x2c9aff[_0x8f2b('0x7')]?_0x2c9aff['scheduledat']:moment()[_0x8f2b('0x8')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x8f2b('0x9')](_0x2c9aff[_0x8f2b('0xa')])){return Promise['resolve'](_0x21f115);}return _0x4d71c2[_0x165fa2][_0x8f2b('0xb')]({'where':{'id':_0x2c2db1}})[_0x8f2b('0xc')](function(_0x74f32a){if(_[_0x8f2b('0x9')](_0x74f32a)||_[_0x8f2b('0x9')](_0x74f32a[_0x8f2b('0xa')])){return Promise[_0x8f2b('0xd')](_0x21f115);}var _0x438e56=shared['timezones'];var _0x47354a=_0x438e56[_0x74f32a[_0x8f2b('0xa')]];var _0x3833d1=_0x438e56[_0x2c9aff[_0x8f2b('0xa')]];if(_[_0x8f2b('0x9')](_0x47354a)&&_[_0x8f2b('0x9')](_0x3833d1)){return Promise[_0x8f2b('0xd')](_0x21f115);}var _0x516dcc=_0x47354a[_0x8f2b('0xe')]-_0x3833d1[_0x8f2b('0xe')];var _0x3b7455=_0x2c9aff[_0x8f2b('0x7')]?_0x2c9aff[_0x8f2b('0x7')]:moment();_0x21f115=moment(_0x3b7455)[_0x8f2b('0xf')](_0x516dcc,_0x8f2b('0x10'))['format'](_0x8f2b('0x11'));return Promise[_0x8f2b('0xd')](_0x21f115);});}function getNewHopperPayload(_0xa5aebe){return{'phone':_0xa5aebe[_0x8f2b('0x12')],'ContactId':_0xa5aebe['id'],'ListId':_0xa5aebe[_0x8f2b('0x13')],'scheduledat':_0xa5aebe[_0x8f2b('0x7')]?_0xa5aebe[_0x8f2b('0x7')]:moment()['format'](_0x8f2b('0x11')),'priority':_0xa5aebe[_0x8f2b('0x14')]?_0xa5aebe[_0x8f2b('0x14')]:0x2,'callback':_0xa5aebe[_0x8f2b('0x15')]?!![]:![],'callbackuniqueid':_0xa5aebe[_0x8f2b('0x15')]?_0xa5aebe[_0x8f2b('0x15')]:undefined,'callbackat':_0xa5aebe[_0x8f2b('0x15')]?moment()[_0x8f2b('0x8')](_0x8f2b('0x11')):undefined};}function handleAlwaysCheckDuplicate(_0x79d6e1,_0x42ec43,_0x44fd1e,_0x1c7347){var _0x19aeea={'phone':_0x44fd1e[_0x8f2b('0x12')]};var _0x24fdf7={'calleridnum':_0x44fd1e[_0x8f2b('0x12')]};if(_0x1c7347){Object[_0x8f2b('0x16')](_0x19aeea,{'CampaignId':_0x42ec43['id']});Object['assign'](_0x24fdf7,{'CampaignId':_0x42ec43['id']});}else{Object['assign'](_0x19aeea,{'VoiceQueueId':_0x42ec43['id']});Object['assign'](_0x24fdf7,{'VoiceQueueId':_0x42ec43['id']});}return _0x79d6e1[_0x8f2b('0x17')][_0x8f2b('0xb')]({'where':_0x19aeea})[_0x8f2b('0xc')](function(_0x28b61f){if(_0x28b61f){throw new Error(_0x8f2b('0x18')+_0x44fd1e[_0x8f2b('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x42ec43['id']);}return _0x79d6e1[_0x8f2b('0x19')][_0x8f2b('0xb')]({'where':_0x24fdf7});})['then'](function(_0x552071){if(_0x552071){throw new Error(_0x8f2b('0x1a')+_0x44fd1e[_0x8f2b('0x12')]+_0x8f2b('0x1b')+_0x42ec43['id']);}var _0x270009=getNewHopperPayload(_0x44fd1e);if(_0x1c7347){_0x270009[_0x8f2b('0x1c')]=_0x42ec43['id'];}else{_0x270009[_0x8f2b('0x1d')]=_0x42ec43['id'];}return _0x79d6e1['CmHopper']['create'](_0x270009);});}function handleOnlyIfOpenCheckDuplicate(_0x3f246b,_0x587273,_0xeb6b84,_0x4245d1){var _0x3f3696={'phone':_0xeb6b84[_0x8f2b('0x12')]};if(_0x4245d1){Object[_0x8f2b('0x16')](_0x3f3696,{'CampaignId':_0x587273['id']});}else{Object['assign'](_0x3f3696,{'VoiceQueueId':_0x587273['id']});}return _0x3f246b[_0x8f2b('0x17')]['findOne']({'where':_0x3f3696})[_0x8f2b('0xc')](function(_0x5666f0){if(_0x5666f0){throw new Error(_0x8f2b('0x1e')+_0xeb6b84['phone']+_0x8f2b('0x1b')+_0x587273['id']);}var _0x570f76=getNewHopperPayload(_0xeb6b84);if(_0x4245d1){_0x570f76['CampaignId']=_0x587273['id'];}else{_0x570f76[_0x8f2b('0x1d')]=_0x587273['id'];}return _0x3f246b[_0x8f2b('0x17')]['create'](_0x570f76);});}function handleNeverCheckDuplicate(_0x158d12,_0x44d57b,_0x20ed6e){var _0x2d44b8=getNewHopperPayload(_0x20ed6e);_0x2d44b8[_0x8f2b('0x1d')]=_0x44d57b['id'];return _0x158d12[_0x8f2b('0x17')]['create'](_0x2d44b8);}function handleCheckDuplicate(_0x25d883,_0x4a490c,_0xd461b7,_0x42ac9c){return getTimezoneCallbackAt(_0x25d883,_0x4a490c,_0xd461b7,_0x42ac9c)[_0x8f2b('0xc')](function(_0xa2b748){_0xd461b7['scheduledat']=_0xa2b748;switch(_0x4a490c['dialCheckDuplicateType']){case _0x8f2b('0x1f'):return handleAlwaysCheckDuplicate(_0x25d883,_0x4a490c,_0xd461b7,_0x42ac9c);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x25d883,_0x4a490c,_0xd461b7,_0x42ac9c);default:return handleNeverCheckDuplicate(_0x25d883,_0x4a490c,_0xd461b7);}});}function createHopperForVoiceQueues(_0x5ba6dc,_0x437a9b){return _0x5ba6dc[_0x8f2b('0x6')][_0x8f2b('0x20')]({'where':{'type':_0x8f2b('0x21')},'attributes':['id',_0x8f2b('0x22'),_0x8f2b('0xa')],'include':[{'model':_0x5ba6dc['CmList'],'as':_0x8f2b('0x23'),'where':{'id':_0x437a9b[_0x8f2b('0x13')]}}],'raw':!![]})[_0x8f2b('0xc')](function(_0x5d096d){var _0x5502b4=_0x5d096d[_0x8f2b('0x24')](function(_0xff3ecd){return handleCheckDuplicate(_0x5ba6dc,_0xff3ecd,_0x437a9b,![]);});return Promise[_0x8f2b('0x25')](_0x5502b4);});}function createHopperForCampaigns(_0x414211,_0x3b047b){return _0x414211[_0x8f2b('0x26')][_0x8f2b('0x20')]({'attributes':['id',_0x8f2b('0x22'),_0x8f2b('0xa')],'include':[{'model':_0x414211[_0x8f2b('0x27')],'as':'Lists','where':{'id':_0x3b047b[_0x8f2b('0x13')]}}],'raw':!![]})['then'](function(_0x2ddfe5){var _0x449ba5=_0x2ddfe5['map'](function(_0x3324df){return handleCheckDuplicate(_0x414211,_0x3324df,_0x3b047b,!![]);});return Promise[_0x8f2b('0x25')](_0x449ba5);});}function createHopperBlackForVoiceQueues(_0x37094f,_0xeedc4b){return _0x37094f[_0x8f2b('0x6')][_0x8f2b('0x20')]({'where':{'type':_0x8f2b('0x21')},'attributes':['id'],'include':[{'model':_0x37094f[_0x8f2b('0x27')],'as':_0x8f2b('0x28'),'where':{'id':_0xeedc4b['ListId']}}],'raw':!![]})['then'](function(_0x290e2b){var _0x19f0d9=_0x290e2b['map'](function(_0x21ead7){return _0x37094f[_0x8f2b('0x29')][_0x8f2b('0x2a')]({'phone':_0xeedc4b[_0x8f2b('0x12')],'ContactId':_0xeedc4b['id'],'ListId':_0xeedc4b[_0x8f2b('0x13')],'VoiceQueueId':_0x21ead7['id']});});return Promise[_0x8f2b('0x25')](_0x19f0d9);});}function createHopperBlackForCampaigns(_0xc03fb4,_0x36db49){return _0xc03fb4[_0x8f2b('0x26')]['findAll']({'attributes':['id'],'include':[{'model':_0xc03fb4[_0x8f2b('0x27')],'as':_0x8f2b('0x28'),'where':{'id':_0x36db49[_0x8f2b('0x13')]}}],'raw':!![]})[_0x8f2b('0xc')](function(_0x5a3fb3){var _0xf5546b=_0x5a3fb3[_0x8f2b('0x24')](function(_0x550857){return _0xc03fb4[_0x8f2b('0x29')]['create']({'phone':_0x36db49[_0x8f2b('0x12')],'ContactId':_0x36db49['id'],'ListId':_0x36db49[_0x8f2b('0x13')],'CampaignId':_0x550857['id']});});return Promise[_0x8f2b('0x25')](_0xf5546b);});}module[_0x8f2b('0x2b')]=function(_0x3c9dcb){return _0x3c9dcb[_0x8f2b('0x2c')]('CmContact',attributes,{'tableName':_0x8f2b('0x2d'),'paranoid':!![],'indexes':[{'name':_0x8f2b('0x12'),'fields':[_0x8f2b('0x12')]},{'name':_0x8f2b('0x2e'),'fields':[_0x8f2b('0x2f'),_0x8f2b('0x30'),_0x8f2b('0x12'),'mobile',_0x8f2b('0x31'),'email'],'type':_0x8f2b('0x32')}],'timestamps':!![],'charset':_0x8f2b('0x33'),'collate':_0x8f2b('0x34'),'hooks':{'afterCreate':function(_0x103afb,_0x3443ad,_0x3e5523){var _0x2a8880=_0x3c9dcb[_0x8f2b('0x35')];var _0x2f0a61=_0x103afb[_0x8f2b('0x36')]({'plain':!![]});if(!_0x2f0a61[_0x8f2b('0x13')]){logger[_0x8f2b('0x37')](_0x8f2b('0x38')+_0x2f0a61['id']);return _0x3e5523();}if(!_0x2f0a61[_0x8f2b('0x12')]){return _0x3e5523();}return createHopperForVoiceQueues(_0x2a8880,_0x2f0a61)[_0x8f2b('0xc')](function(){return createHopperBlackForVoiceQueues(_0x2a8880,_0x2f0a61);})[_0x8f2b('0xc')](function(){return createHopperForCampaigns(_0x2a8880,_0x2f0a61);})[_0x8f2b('0xc')](function(){return createHopperBlackForCampaigns(_0x2a8880,_0x2f0a61);})[_0x8f2b('0xc')](function(){return _0x3e5523();})[_0x8f2b('0x39')](function(_0x5151c4){logger[_0x8f2b('0x37')]('[cmContact][afterCreate]',_0x5151c4[_0x8f2b('0x3a')]);_0x3e5523();});},'afterDestroy':function(_0x14c401,_0x484f41,_0x1a41d6){var _0x29c490=_0x3c9dcb[_0x8f2b('0x35')];var _0x17df6a=_0x14c401[_0x8f2b('0x36')]({'plain':!![]});return _0x29c490[_0x8f2b('0x17')][_0x8f2b('0x20')]({'raw':!![],'where':{'ListId':_0x17df6a[_0x8f2b('0x13')],'ContactId':_0x17df6a['id']}})[_0x8f2b('0xc')](function(_0x3a8ce0){if(!_[_0x8f2b('0x3b')](_0x3a8ce0)){var _0xd7ab11=[];for(var _0x4045dd=0x0;_0x4045dd<_0x3a8ce0[_0x8f2b('0x3c')];_0x4045dd+=0x1){var _0x990e29=_0x29c490[_0x8f2b('0x17')][_0x8f2b('0x3d')]({'where':{'ListId':_0x3a8ce0[_0x4045dd][_0x8f2b('0x13')],'ContactId':_0x3a8ce0[_0x4045dd][_0x8f2b('0x3e')],'VoiceQueueId':_0x3a8ce0[_0x4045dd][_0x8f2b('0x1d')],'CampaignId':_0x3a8ce0[_0x4045dd][_0x8f2b('0x1c')]}});_0xd7ab11[_0x8f2b('0x3f')](_0x990e29);}return Promise[_0x8f2b('0x25')](_0xd7ab11);}})[_0x8f2b('0xc')](function(_0x21f3a6){logger['info'](_0x8f2b('0x40'),util[_0x8f2b('0x41')](_0x21f3a6,{'showHidden':![],'depth':null}));_0x1a41d6();})[_0x8f2b('0x39')](function(_0x133d0e){logger['error'](_0x8f2b('0x42'),util[_0x8f2b('0x41')](_0x133d0e,{'showHidden':![],'depth':null}));_0x1a41d6(_0x133d0e);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 57f3c7a..5ca1712 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x45618e,_0x4e8cc6){var _0xb0e543=function(_0xe8ff84){while(--_0xe8ff84){_0x45618e['push'](_0x45618e['shift']());}};_0xb0e543(++_0x4e8cc6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0xbd14f2,_0x13cdec){var _0xd02b92=function(_0x144431){while(--_0x144431){_0xbd14f2['push'](_0xbd14f2['shift']());}};_0xd02b92(++_0x13cdec);}(_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'));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 4a24dbb..d610026 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 _0x98d3=['exports','STRING','INTEGER','sequelize'];(function(_0x1c59ba,_0x589946){var _0x4c5959=function(_0x544d60){while(--_0x544d60){_0x1c59ba['push'](_0x1c59ba['shift']());}};_0x4c5959(++_0x589946);}(_0x98d3,0x173));var _0x398d=function(_0x55336a,_0x240d59){_0x55336a=_0x55336a-0x0;var _0x28ceb3=_0x98d3[_0x55336a];return _0x28ceb3;};'use strict';var Sequelize=require(_0x398d('0x0'));module[_0x398d('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x398d('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x398d('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x398d('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x398d('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x6732=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x430d11,_0x4268b2){var _0x222357=function(_0x3a90a9){while(--_0x3a90a9){_0x430d11['push'](_0x430d11['shift']());}};_0x222357(++_0x4268b2);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2673('0x0'));module[_0x2673('0x1')]={'CmContactId':{'type':Sequelize[_0x2673('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2673('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x2673('0x3')],'defaultValue':_0x2673('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x2673('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 23dd684..bfaa16f 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 _0x39df=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','update','then','destroy','get','CmContactHasItems','UserProfileResource','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x39df,0x14f));var _0xf39d=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x39df[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xf39d('0x0'));var rimraf=require(_0xf39d('0x1'));var zipdir=require(_0xf39d('0x2'));var jsonpatch=require(_0xf39d('0x3'));var rp=require(_0xf39d('0x4'));var moment=require(_0xf39d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf39d('0x6'));var util=require('util');var path=require(_0xf39d('0x7'));var sox=require(_0xf39d('0x8'));var csv=require(_0xf39d('0x9'));var ejs=require(_0xf39d('0xa'));var fs=require('fs');var fs_extra=require(_0xf39d('0xb'));var _=require(_0xf39d('0xc'));var squel=require(_0xf39d('0xd'));var crypto=require(_0xf39d('0xe'));var jsforce=require(_0xf39d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf39d('0x9'));var querystring=require('querystring');var Papa=require(_0xf39d('0x10'));var Redis=require(_0xf39d('0x11'));var authService=require(_0xf39d('0x12'));var qs=require(_0xf39d('0x13'));var as=require(_0xf39d('0x14'));var hardwareService=require(_0xf39d('0x15'));var logger=require(_0xf39d('0x16'))(_0xf39d('0x17'));var utils=require(_0xf39d('0x18'));var config=require(_0xf39d('0x19'));var licenseUtil=require(_0xf39d('0x1a'));var db=require(_0xf39d('0x1b'))['db'];function respondWithStatusCode(_0x249afd,_0x2ce9a9){_0x2ce9a9=_0x2ce9a9||0xcc;return function(_0x179ef1){if(_0x179ef1){return _0x249afd[_0xf39d('0x1c')](_0x2ce9a9);}return _0x249afd[_0xf39d('0x1d')](_0x2ce9a9)[_0xf39d('0x1e')]();};}function respondWithResult(_0x52352c,_0x2004b5){_0x2004b5=_0x2004b5||0xc8;return function(_0x311a35){if(_0x311a35){return _0x52352c['status'](_0x2004b5)['json'](_0x311a35);}};}function respondWithFilteredResult(_0x51ca95,_0x5b4d7e){return function(_0x259cc8){if(_0x259cc8){var _0x1b3bd4=typeof _0x5b4d7e[_0xf39d('0x1f')]==='undefined'&&typeof _0x5b4d7e[_0xf39d('0x20')]===_0xf39d('0x21');var _0x716bf4=_0x259cc8['count'];var _0x736e97=_0x1b3bd4?0x0:_0x5b4d7e[_0xf39d('0x1f')];var _0x5e608e=_0x1b3bd4?_0x259cc8[_0xf39d('0x22')]:_0x5b4d7e[_0xf39d('0x1f')]+_0x5b4d7e[_0xf39d('0x20')];var _0xe4af6c;if(_0x5e608e>=_0x716bf4){_0x5e608e=_0x716bf4;_0xe4af6c=0xc8;}else{_0xe4af6c=0xce;}_0x51ca95['status'](_0xe4af6c);return _0x51ca95[_0xf39d('0x23')](_0xf39d('0x24'),_0x736e97+'-'+_0x5e608e+'/'+_0x716bf4)[_0xf39d('0x25')](_0x259cc8);}return null;};}function patchUpdates(_0x55db7c){return function(_0x1dcfeb){try{jsonpatch[_0xf39d('0x26')](_0x1dcfeb,_0x55db7c,!![]);}catch(_0x20b5be){return BPromise['reject'](_0x20b5be);}return _0x1dcfeb['save']();};}function saveUpdates(_0x58df0d,_0x14a060){return function(_0x3ea9ca){if(_0x3ea9ca){return _0x3ea9ca[_0xf39d('0x27')](_0x58df0d)[_0xf39d('0x28')](function(_0x3116d3){return _0x3116d3;});}return null;};}function removeEntity(_0x36b0ea,_0x286c52){return function(_0x2a9a1a){if(_0x2a9a1a){return _0x2a9a1a[_0xf39d('0x29')]()[_0xf39d('0x28')](function(){var _0x38c39b=_0x2a9a1a[_0xf39d('0x2a')]({'plain':!![]});var _0xbd0072=_0xf39d('0x2b');return db[_0xf39d('0x2c')][_0xf39d('0x29')]({'where':{'type':_0xbd0072,'resourceId':_0x38c39b['id']}})[_0xf39d('0x28')](function(){return _0x2a9a1a;});})['then'](function(){_0x36b0ea[_0xf39d('0x1d')](0xcc)[_0xf39d('0x1e')]();});}};}function handleEntityNotFound(_0x113036,_0x27a04c){return function(_0x2e85ca){if(!_0x2e85ca){_0x113036[_0xf39d('0x1c')](0x194);}return _0x2e85ca;};}function handleError(_0x50bea6,_0x2792ea){_0x2792ea=_0x2792ea||0x1f4;return function(_0x50ab4c){logger['error'](_0x50ab4c[_0xf39d('0x2d')]);if(_0x50ab4c[_0xf39d('0x2e')]){delete _0x50ab4c[_0xf39d('0x2e')];}_0x50bea6[_0xf39d('0x1d')](_0x2792ea)[_0xf39d('0x2f')](_0x50ab4c);};}exports['index']=function(_0x1394a6,_0xaa70c7){var _0x551027={},_0x54e9c7={},_0x33e1b4={'count':0x0,'rows':[]};var _0x49f057=_[_0xf39d('0x30')](db[_0xf39d('0x31')][_0xf39d('0x32')],function(_0x495e88){return{'name':_0x495e88[_0xf39d('0x33')],'type':_0x495e88[_0xf39d('0x34')][_0xf39d('0x35')]};});_0x54e9c7[_0xf39d('0x36')]=_[_0xf39d('0x30')](_0x49f057,_0xf39d('0x2e'));_0x54e9c7[_0xf39d('0x37')]=_[_0xf39d('0x38')](_0x1394a6[_0xf39d('0x37')]);_0x54e9c7[_0xf39d('0x39')]=_[_0xf39d('0x3a')](_0x54e9c7[_0xf39d('0x36')],_0x54e9c7['query']);_0x551027[_0xf39d('0x3b')]=_[_0xf39d('0x3a')](_0x54e9c7[_0xf39d('0x36')],qs[_0xf39d('0x3c')](_0x1394a6[_0xf39d('0x37')]['fields']));_0x551027['attributes']=_0x551027[_0xf39d('0x3b')][_0xf39d('0x3d')]?_0x551027[_0xf39d('0x3b')]:_0x54e9c7[_0xf39d('0x36')];if(!_0x1394a6[_0xf39d('0x37')][_0xf39d('0x3e')](_0xf39d('0x3f'))){_0x551027[_0xf39d('0x20')]=qs[_0xf39d('0x20')](_0x1394a6[_0xf39d('0x37')][_0xf39d('0x20')]);_0x551027[_0xf39d('0x1f')]=qs[_0xf39d('0x1f')](_0x1394a6[_0xf39d('0x37')][_0xf39d('0x1f')]);}_0x551027[_0xf39d('0x40')]=qs['sort'](_0x1394a6['query']['sort']);_0x551027[_0xf39d('0x41')]=qs[_0xf39d('0x39')](_['pick'](_0x1394a6[_0xf39d('0x37')],_0x54e9c7[_0xf39d('0x39')]),_0x49f057);if(_0x1394a6[_0xf39d('0x37')][_0xf39d('0x42')]){_0x551027[_0xf39d('0x41')]=_['merge'](_0x551027['where'],{'$or':_[_0xf39d('0x30')](_0x49f057,function(_0x20d4f6){if(_0x20d4f6[_0xf39d('0x34')]!==_0xf39d('0x43')){var _0x4ab332={};_0x4ab332[_0x20d4f6[_0xf39d('0x2e')]]={'$like':'%'+_0x1394a6['query'][_0xf39d('0x42')]+'%'};return _0x4ab332;}})});}_0x551027=_[_0xf39d('0x44')]({},_0x551027,_0x1394a6[_0xf39d('0x45')]);var _0x722c07={'where':_0x551027['where']};return db['CmContactHasItem'][_0xf39d('0x22')](_0x722c07)[_0xf39d('0x28')](function(_0x1e7bd4){_0x33e1b4[_0xf39d('0x22')]=_0x1e7bd4;if(_0x1394a6[_0xf39d('0x37')][_0xf39d('0x46')]){_0x551027[_0xf39d('0x47')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xf39d('0x48')](_0x551027);})[_0xf39d('0x28')](function(_0x52201f){_0x33e1b4[_0xf39d('0x49')]=_0x52201f;return _0x33e1b4;})[_0xf39d('0x28')](respondWithFilteredResult(_0xaa70c7,_0x551027))[_0xf39d('0x4a')](handleError(_0xaa70c7,null));};exports[_0xf39d('0x4b')]=function(_0x8139d9,_0x395f1c){var _0x1c0c49={'raw':!![],'where':{'id':_0x8139d9[_0xf39d('0x4c')]['id']}},_0x50bc25={};_0x50bc25[_0xf39d('0x36')]=_['keys'](db[_0xf39d('0x31')][_0xf39d('0x32')]);_0x50bc25[_0xf39d('0x37')]=_['keys'](_0x8139d9[_0xf39d('0x37')]);_0x50bc25['filters']=_[_0xf39d('0x3a')](_0x50bc25[_0xf39d('0x36')],_0x50bc25['query']);_0x1c0c49[_0xf39d('0x3b')]=_['intersection'](_0x50bc25['model'],qs[_0xf39d('0x3c')](_0x8139d9[_0xf39d('0x37')][_0xf39d('0x3c')]));_0x1c0c49[_0xf39d('0x3b')]=_0x1c0c49['attributes'][_0xf39d('0x3d')]?_0x1c0c49[_0xf39d('0x3b')]:_0x50bc25[_0xf39d('0x36')];if(_0x8139d9[_0xf39d('0x37')][_0xf39d('0x46')]){_0x1c0c49[_0xf39d('0x47')]=[{'all':!![]}];}_0x1c0c49=_[_0xf39d('0x44')]({},_0x1c0c49,_0x8139d9[_0xf39d('0x45')]);return db[_0xf39d('0x31')][_0xf39d('0x4d')](_0x1c0c49)[_0xf39d('0x28')](handleEntityNotFound(_0x395f1c,null))[_0xf39d('0x28')](respondWithResult(_0x395f1c,null))[_0xf39d('0x4a')](handleError(_0x395f1c,null));};exports[_0xf39d('0x4e')]=function(_0xd428c5,_0x5afaf4){return db[_0xf39d('0x31')]['create'](_0xd428c5[_0xf39d('0x4f')],{})[_0xf39d('0x28')](function(_0x1adc27){var _0x26d85f=_0xd428c5['user']['get']({'plain':!![]});if(!_0x26d85f)throw new Error(_0xf39d('0x50'));if(_0x26d85f[_0xf39d('0x51')]===_0xf39d('0x52')){var _0x14c228=_0x1adc27[_0xf39d('0x2a')]({'plain':!![]});var _0x6c610e=_0xf39d('0x2b');return db['UserProfileSection'][_0xf39d('0x4d')]({'where':{'name':_0x6c610e,'userProfileId':_0x26d85f[_0xf39d('0x53')]},'raw':!![]})['then'](function(_0xf48b0a){if(_0xf48b0a&&_0xf48b0a[_0xf39d('0x54')]===0x0){return db['UserProfileResource'][_0xf39d('0x4e')]({'name':_0x14c228['name'],'resourceId':_0x14c228['id'],'type':_0xf48b0a[_0xf39d('0x2e')],'sectionId':_0xf48b0a['id']},{})[_0xf39d('0x28')](function(){return _0x1adc27;});}else{return _0x1adc27;}})['catch'](function(_0x299373){logger[_0xf39d('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x299373);throw _0x299373;});}return _0x1adc27;})['then'](respondWithResult(_0x5afaf4,0xc9))['catch'](handleError(_0x5afaf4,null));};exports['update']=function(_0x576a1f,_0x1ac136){if(_0x576a1f['body']['id']){delete _0x576a1f[_0xf39d('0x4f')]['id'];}return db[_0xf39d('0x31')][_0xf39d('0x4d')]({'where':{'id':_0x576a1f[_0xf39d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ac136,null))['then'](saveUpdates(_0x576a1f[_0xf39d('0x4f')],null))[_0xf39d('0x28')](respondWithResult(_0x1ac136,null))[_0xf39d('0x4a')](handleError(_0x1ac136,null));};exports['destroy']=function(_0x55b5c4,_0x23211b){return db[_0xf39d('0x31')][_0xf39d('0x4d')]({'where':{'id':_0x55b5c4[_0xf39d('0x4c')]['id']}})[_0xf39d('0x28')](handleEntityNotFound(_0x23211b,null))[_0xf39d('0x28')](removeEntity(_0x23211b,null))[_0xf39d('0x4a')](handleError(_0x23211b,null));}; \ No newline at end of file +var _0x586a=['count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','error','name','map','fieldName','model','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','CmContactHasItem','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x2e4790,_0x15d4ed){var _0x324230=function(_0x592269){while(--_0x592269){_0x2e4790['push'](_0x2e4790['shift']());}};_0x324230(++_0x15d4ed);}(_0x586a,0x17e));var _0xa586=function(_0x390ccc,_0x44622d){_0x390ccc=_0x390ccc-0x0;var _0xf97425=_0x586a[_0x390ccc];return _0xf97425;};'use strict';var emlformat=require(_0xa586('0x0'));var rimraf=require(_0xa586('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa586('0x2'));var rp=require(_0xa586('0x3'));var moment=require('moment');var BPromise=require(_0xa586('0x4'));var Mustache=require(_0xa586('0x5'));var util=require(_0xa586('0x6'));var path=require(_0xa586('0x7'));var sox=require(_0xa586('0x8'));var csv=require(_0xa586('0x9'));var ejs=require(_0xa586('0xa'));var fs=require('fs');var fs_extra=require(_0xa586('0xb'));var _=require(_0xa586('0xc'));var squel=require(_0xa586('0xd'));var crypto=require(_0xa586('0xe'));var jsforce=require(_0xa586('0xf'));var deskjs=require(_0xa586('0x10'));var toCsv=require(_0xa586('0x9'));var querystring=require('querystring');var Papa=require(_0xa586('0x11'));var Redis=require('ioredis');var authService=require(_0xa586('0x12'));var qs=require(_0xa586('0x13'));var as=require(_0xa586('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa586('0x15'))(_0xa586('0x16'));var utils=require(_0xa586('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa586('0x18'));var db=require(_0xa586('0x19'))['db'];function respondWithStatusCode(_0x3b59cc,_0x3a6733){_0x3a6733=_0x3a6733||0xcc;return function(_0x4d2211){if(_0x4d2211){return _0x3b59cc[_0xa586('0x1a')](_0x3a6733);}return _0x3b59cc[_0xa586('0x1b')](_0x3a6733)[_0xa586('0x1c')]();};}function respondWithResult(_0x37a7c5,_0xe630e3){_0xe630e3=_0xe630e3||0xc8;return function(_0x404daa){if(_0x404daa){return _0x37a7c5[_0xa586('0x1b')](_0xe630e3)[_0xa586('0x1d')](_0x404daa);}};}function respondWithFilteredResult(_0x4b1338,_0x25ed40){return function(_0x5b22ee){if(_0x5b22ee){var _0x13d20a=typeof _0x25ed40[_0xa586('0x1e')]===_0xa586('0x1f')&&typeof _0x25ed40[_0xa586('0x20')]===_0xa586('0x1f');var _0x8ebad8=_0x5b22ee[_0xa586('0x21')];var _0x5743bb=_0x13d20a?0x0:_0x25ed40[_0xa586('0x1e')];var _0x4c41e1=_0x13d20a?_0x5b22ee[_0xa586('0x21')]:_0x25ed40[_0xa586('0x1e')]+_0x25ed40[_0xa586('0x20')];var _0x4ddfd8;if(_0x4c41e1>=_0x8ebad8){_0x4c41e1=_0x8ebad8;_0x4ddfd8=0xc8;}else{_0x4ddfd8=0xce;}_0x4b1338[_0xa586('0x1b')](_0x4ddfd8);return _0x4b1338[_0xa586('0x22')](_0xa586('0x23'),_0x5743bb+'-'+_0x4c41e1+'/'+_0x8ebad8)['json'](_0x5b22ee);}return null;};}function patchUpdates(_0x30862f){return function(_0x4362f2){try{jsonpatch[_0xa586('0x24')](_0x4362f2,_0x30862f,!![]);}catch(_0x314bf4){return BPromise[_0xa586('0x25')](_0x314bf4);}return _0x4362f2['save']();};}function saveUpdates(_0x223581,_0x3f3635){return function(_0x2ed474){if(_0x2ed474){return _0x2ed474[_0xa586('0x26')](_0x223581)[_0xa586('0x27')](function(_0x4856c8){return _0x4856c8;});}return null;};}function removeEntity(_0x313991,_0x2351ab){return function(_0x319008){if(_0x319008){return _0x319008[_0xa586('0x28')]()['then'](function(){var _0x134a9a=_0x319008['get']({'plain':!![]});var _0x530231='CmContactHasItems';return db[_0xa586('0x29')][_0xa586('0x28')]({'where':{'type':_0x530231,'resourceId':_0x134a9a['id']}})[_0xa586('0x27')](function(){return _0x319008;});})[_0xa586('0x27')](function(){_0x313991[_0xa586('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5987c4,_0x152e78){return function(_0x26d04c){if(!_0x26d04c){_0x5987c4[_0xa586('0x1a')](0x194);}return _0x26d04c;};}function handleError(_0x35b8a8,_0xd67b17){_0xd67b17=_0xd67b17||0x1f4;return function(_0x5eb31f){logger[_0xa586('0x2a')](_0x5eb31f['stack']);if(_0x5eb31f[_0xa586('0x2b')]){delete _0x5eb31f[_0xa586('0x2b')];}_0x35b8a8[_0xa586('0x1b')](_0xd67b17)['send'](_0x5eb31f);};}exports['index']=function(_0x2e92c3,_0x138a7d){var _0x4c26d6={},_0x279b26={},_0x524304={'count':0x0,'rows':[]};var _0x396445=_[_0xa586('0x2c')](db['CmContactHasItem']['rawAttributes'],function(_0x296a68){return{'name':_0x296a68[_0xa586('0x2d')],'type':_0x296a68['type']['key']};});_0x279b26[_0xa586('0x2e')]=_[_0xa586('0x2c')](_0x396445,_0xa586('0x2b'));_0x279b26[_0xa586('0x2f')]=_['keys'](_0x2e92c3['query']);_0x279b26[_0xa586('0x30')]=_[_0xa586('0x31')](_0x279b26['model'],_0x279b26[_0xa586('0x2f')]);_0x4c26d6[_0xa586('0x32')]=_[_0xa586('0x31')](_0x279b26[_0xa586('0x2e')],qs['fields'](_0x2e92c3[_0xa586('0x2f')][_0xa586('0x33')]));_0x4c26d6[_0xa586('0x32')]=_0x4c26d6[_0xa586('0x32')]['length']?_0x4c26d6['attributes']:_0x279b26['model'];if(!_0x2e92c3[_0xa586('0x2f')]['hasOwnProperty'](_0xa586('0x34'))){_0x4c26d6[_0xa586('0x20')]=qs[_0xa586('0x20')](_0x2e92c3[_0xa586('0x2f')][_0xa586('0x20')]);_0x4c26d6['offset']=qs[_0xa586('0x1e')](_0x2e92c3[_0xa586('0x2f')][_0xa586('0x1e')]);}_0x4c26d6[_0xa586('0x35')]=qs[_0xa586('0x36')](_0x2e92c3[_0xa586('0x2f')][_0xa586('0x36')]);_0x4c26d6['where']=qs[_0xa586('0x30')](_[_0xa586('0x37')](_0x2e92c3['query'],_0x279b26[_0xa586('0x30')]),_0x396445);if(_0x2e92c3[_0xa586('0x2f')][_0xa586('0x38')]){_0x4c26d6['where']=_[_0xa586('0x39')](_0x4c26d6[_0xa586('0x3a')],{'$or':_[_0xa586('0x2c')](_0x396445,function(_0x19c0f4){if(_0x19c0f4[_0xa586('0x3b')]!==_0xa586('0x3c')){var _0x47e34c={};_0x47e34c[_0x19c0f4[_0xa586('0x2b')]]={'$like':'%'+_0x2e92c3[_0xa586('0x2f')][_0xa586('0x38')]+'%'};return _0x47e34c;}})});}_0x4c26d6=_[_0xa586('0x39')]({},_0x4c26d6,_0x2e92c3[_0xa586('0x3d')]);var _0xd849d4={'where':_0x4c26d6[_0xa586('0x3a')]};return db[_0xa586('0x3e')][_0xa586('0x21')](_0xd849d4)[_0xa586('0x27')](function(_0x14e2ec){_0x524304[_0xa586('0x21')]=_0x14e2ec;if(_0x2e92c3[_0xa586('0x2f')][_0xa586('0x3f')]){_0x4c26d6[_0xa586('0x40')]=[{'all':!![]}];}return db[_0xa586('0x3e')][_0xa586('0x41')](_0x4c26d6);})[_0xa586('0x27')](function(_0x1e2089){_0x524304[_0xa586('0x42')]=_0x1e2089;return _0x524304;})[_0xa586('0x27')](respondWithFilteredResult(_0x138a7d,_0x4c26d6))[_0xa586('0x43')](handleError(_0x138a7d,null));};exports[_0xa586('0x44')]=function(_0x26ffa9,_0x571894){var _0x2a6813={'raw':!![],'where':{'id':_0x26ffa9[_0xa586('0x45')]['id']}},_0x1f1dad={};_0x1f1dad['model']=_['keys'](db[_0xa586('0x3e')]['rawAttributes']);_0x1f1dad[_0xa586('0x2f')]=_['keys'](_0x26ffa9[_0xa586('0x2f')]);_0x1f1dad[_0xa586('0x30')]=_[_0xa586('0x31')](_0x1f1dad[_0xa586('0x2e')],_0x1f1dad[_0xa586('0x2f')]);_0x2a6813[_0xa586('0x32')]=_[_0xa586('0x31')](_0x1f1dad[_0xa586('0x2e')],qs[_0xa586('0x33')](_0x26ffa9['query'][_0xa586('0x33')]));_0x2a6813[_0xa586('0x32')]=_0x2a6813['attributes'][_0xa586('0x46')]?_0x2a6813[_0xa586('0x32')]:_0x1f1dad[_0xa586('0x2e')];if(_0x26ffa9[_0xa586('0x2f')]['includeAll']){_0x2a6813[_0xa586('0x40')]=[{'all':!![]}];}_0x2a6813=_[_0xa586('0x39')]({},_0x2a6813,_0x26ffa9['options']);return db[_0xa586('0x3e')][_0xa586('0x47')](_0x2a6813)['then'](handleEntityNotFound(_0x571894,null))[_0xa586('0x27')](respondWithResult(_0x571894,null))[_0xa586('0x43')](handleError(_0x571894,null));};exports['create']=function(_0x44b3ad,_0xaa9fe5){return db[_0xa586('0x3e')][_0xa586('0x48')](_0x44b3ad[_0xa586('0x49')],{})[_0xa586('0x27')](function(_0x18d3af){var _0xe35d80=_0x44b3ad[_0xa586('0x4a')][_0xa586('0x4b')]({'plain':!![]});if(!_0xe35d80)throw new Error(_0xa586('0x4c'));if(_0xe35d80[_0xa586('0x4d')]===_0xa586('0x4a')){var _0x538845=_0x18d3af[_0xa586('0x4b')]({'plain':!![]});var _0x5675a0=_0xa586('0x4e');return db[_0xa586('0x4f')][_0xa586('0x47')]({'where':{'name':_0x5675a0,'userProfileId':_0xe35d80[_0xa586('0x50')]},'raw':!![]})[_0xa586('0x27')](function(_0x10c6a6){if(_0x10c6a6&&_0x10c6a6[_0xa586('0x51')]===0x0){return db[_0xa586('0x29')]['create']({'name':_0x538845[_0xa586('0x2b')],'resourceId':_0x538845['id'],'type':_0x10c6a6[_0xa586('0x2b')],'sectionId':_0x10c6a6['id']},{})['then'](function(){return _0x18d3af;});}else{return _0x18d3af;}})[_0xa586('0x43')](function(_0x454205){logger[_0xa586('0x2a')](_0xa586('0x52'),_0x454205);throw _0x454205;});}return _0x18d3af;})['then'](respondWithResult(_0xaa9fe5,0xc9))['catch'](handleError(_0xaa9fe5,null));};exports['update']=function(_0x2f33c5,_0x3071f3){if(_0x2f33c5[_0xa586('0x49')]['id']){delete _0x2f33c5['body']['id'];}return db[_0xa586('0x3e')][_0xa586('0x47')]({'where':{'id':_0x2f33c5[_0xa586('0x45')]['id']}})[_0xa586('0x27')](handleEntityNotFound(_0x3071f3,null))[_0xa586('0x27')](saveUpdates(_0x2f33c5[_0xa586('0x49')],null))[_0xa586('0x27')](respondWithResult(_0x3071f3,null))[_0xa586('0x43')](handleError(_0x3071f3,null));};exports[_0xa586('0x28')]=function(_0x384013,_0x58aaf4){return db[_0xa586('0x3e')][_0xa586('0x47')]({'where':{'id':_0x384013[_0xa586('0x45')]['id']}})['then'](handleEntityNotFound(_0x58aaf4,null))['then'](removeEntity(_0x58aaf4,null))[_0xa586('0x43')](handleError(_0x58aaf4,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 53c61a1..84ceccf 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 _0xbb95=['cm_contact_has_items','lodash','util','moment','bluebird','path','exports','define','CmContactHasItem'];(function(_0x17ff3e,_0x18e552){var _0x5362a2=function(_0x1de2de){while(--_0x1de2de){_0x17ff3e['push'](_0x17ff3e['shift']());}};_0x5362a2(++_0x18e552);}(_0xbb95,0x7f));var _0x5bb9=function(_0x487ec9,_0x351700){_0x487ec9=_0x487ec9-0x0;var _0x5224f1=_0xbb95[_0x487ec9];return _0x5224f1;};'use strict';var _=require(_0x5bb9('0x0'));var util=require(_0x5bb9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5bb9('0x2'));var BPromise=require(_0x5bb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bb9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x5bb9('0x5')]=function(_0x2b72aa,_0x49b590){return _0x2b72aa[_0x5bb9('0x6')](_0x5bb9('0x7'),attributes,{'tableName':_0x5bb9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6da=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa6da,0x13d));var _0xaa6d=function(_0x5cfc40,_0x421f58){_0x5cfc40=_0x5cfc40-0x0;var _0x1f9716=_0xa6da[_0x5cfc40];return _0x1f9716;};'use strict';var _=require(_0xaa6d('0x0'));var util=require(_0xaa6d('0x1'));var logger=require(_0xaa6d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaa6d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa6d('0x4'));var rimraf=require(_0xaa6d('0x5'));var config=require(_0xaa6d('0x6'));var attributes=require(_0xaa6d('0x7'));module[_0xaa6d('0x8')]=function(_0x41f7ea,_0x35e514){return _0x41f7ea[_0xaa6d('0x9')](_0xaa6d('0xa'),attributes,{'tableName':_0xaa6d('0xb'),'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 8bec523..4128f8d 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 _0xdb8d=['request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x2da0bf,_0x5660c9){var _0x4ea8f1=function(_0x202390){while(--_0x202390){_0x2da0bf['push'](_0x2da0bf['shift']());}};_0x4ea8f1(++_0x5660c9);}(_0xdb8d,0x1c0));var _0xddb8=function(_0x4fb001,_0x3f9e2e){_0x4fb001=_0x4fb001-0x0;var _0x207eda=_0xdb8d[_0x4fb001];return _0x207eda;};'use strict';var _=require(_0xddb8('0x0'));var util=require(_0xddb8('0x1'));var moment=require('moment');var BPromise=require(_0xddb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddb8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xddb8('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xddb8('0x5'));var client=jayson[_0xddb8('0x6')][_0xddb8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55887a,_0x269083,_0x135b85){return new BPromise(function(_0x221147,_0x26d6ec){return client[_0xddb8('0x8')](_0x55887a,_0x135b85)[_0xddb8('0x9')](function(_0xd65975){logger['info'](_0xddb8('0xa'),_0x269083,_0xddb8('0xb'));logger['debug'](_0xddb8('0xc'),_0x269083,'request\x20sent',JSON[_0xddb8('0xd')](_0xd65975));if(_0xd65975['error']){if(_0xd65975[_0xddb8('0xe')]['code']===0x1f4){logger[_0xddb8('0xe')](_0xddb8('0xa'),_0x269083,_0xd65975[_0xddb8('0xe')][_0xddb8('0xf')]);return _0x26d6ec(_0xd65975[_0xddb8('0xe')][_0xddb8('0xf')]);}logger[_0xddb8('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x269083,_0xd65975[_0xddb8('0xe')][_0xddb8('0xf')]);return _0x221147(_0xd65975[_0xddb8('0xe')][_0xddb8('0xf')]);}else{logger[_0xddb8('0x10')](_0xddb8('0xa'),_0x269083,_0xddb8('0xb'));_0x221147(_0xd65975[_0xddb8('0x11')][_0xddb8('0xf')]);}})[_0xddb8('0x12')](function(_0x42731c){logger['error'](_0xddb8('0xa'),_0x269083,_0x42731c);_0x26d6ec(_0x42731c);});});} \ No newline at end of file +var _0x6c60=['ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','randomstring'];(function(_0x30c93d,_0x1e3bb7){var _0x4d9f45=function(_0xe268eb){while(--_0xe268eb){_0x30c93d['push'](_0x30c93d['shift']());}};_0x4d9f45(++_0x1e3bb7);}(_0x6c60,0xd0));var _0x06c6=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x6c60[_0x3f0b30];return _0x2748a5;};'use strict';var _=require('lodash');var util=require(_0x06c6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x06c6('0x1'));var fs=require('fs');var Redis=require(_0x06c6('0x2'));var db=require(_0x06c6('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x06c6('0x4'));var config=require('../../config/environment');var jayson=require(_0x06c6('0x5'));var client=jayson[_0x06c6('0x6')][_0x06c6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x108321,_0x9c02b2,_0x2a115c){return new BPromise(function(_0x2909d0,_0x1bedfc){return client[_0x06c6('0x8')](_0x108321,_0x2a115c)[_0x06c6('0x9')](function(_0x2ae12b){logger[_0x06c6('0xa')](_0x06c6('0xb'),_0x9c02b2,'request\x20sent');logger[_0x06c6('0xc')](_0x06c6('0xd'),_0x9c02b2,_0x06c6('0xe'),JSON[_0x06c6('0xf')](_0x2ae12b));if(_0x2ae12b[_0x06c6('0x10')]){if(_0x2ae12b[_0x06c6('0x10')][_0x06c6('0x11')]===0x1f4){logger[_0x06c6('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x9c02b2,_0x2ae12b[_0x06c6('0x10')]['message']);return _0x1bedfc(_0x2ae12b[_0x06c6('0x10')][_0x06c6('0x12')]);}logger[_0x06c6('0x10')](_0x06c6('0xb'),_0x9c02b2,_0x2ae12b[_0x06c6('0x10')]['message']);return _0x2909d0(_0x2ae12b[_0x06c6('0x10')]['message']);}else{logger[_0x06c6('0xa')](_0x06c6('0xb'),_0x9c02b2,_0x06c6('0xe'));_0x2909d0(_0x2ae12b[_0x06c6('0x13')]['message']);}})[_0x06c6('0x14')](function(_0x1e2714){logger['error'](_0x06c6('0xb'),_0x9c02b2,_0x1e2714);_0x1bedfc(_0x1e2714);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 77bb701..7ae2771 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 _0xb377=['index','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb377,0xf7));var _0x7b37=function(_0x24f5fb,_0x284b43){_0x24f5fb=_0x24f5fb-0x0;var _0x208c03=_0xb377[_0x24f5fb];return _0x208c03;};'use strict';var multer=require('multer');var util=require(_0x7b37('0x0'));var path=require('path');var timeout=require(_0x7b37('0x1'));var express=require('express');var router=express[_0x7b37('0x2')]();var fs_extra=require(_0x7b37('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b37('0x4'));var config=require('../../config/environment');var controller=require(_0x7b37('0x5'));router[_0x7b37('0x6')]('/',auth[_0x7b37('0x7')](),controller[_0x7b37('0x8')]);router['get'](_0x7b37('0x9'),auth[_0x7b37('0x7')](),controller[_0x7b37('0xa')]);router[_0x7b37('0xb')]('/',auth['isAuthenticated'](),controller[_0x7b37('0xc')]);router[_0x7b37('0xd')](_0x7b37('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x7b37('0xe')](_0x7b37('0x9'),auth[_0x7b37('0x7')](),controller[_0x7b37('0xf')]);module[_0x7b37('0x10')]=router; \ No newline at end of file +var _0x76d8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util'];(function(_0xe3430,_0x118fdf){var _0xbfe94b=function(_0xa3decd){while(--_0xa3decd){_0xe3430['push'](_0xe3430['shift']());}};_0xbfe94b(++_0x118fdf);}(_0x76d8,0xbc));var _0x876d=function(_0x514f19,_0x5d9b97){_0x514f19=_0x514f19-0x0;var _0x3706e1=_0x76d8[_0x514f19];return _0x3706e1;};'use strict';var multer=require(_0x876d('0x0'));var util=require(_0x876d('0x1'));var path=require(_0x876d('0x2'));var timeout=require(_0x876d('0x3'));var express=require('express');var router=express[_0x876d('0x4')]();var fs_extra=require(_0x876d('0x5'));var auth=require(_0x876d('0x6'));var interaction=require(_0x876d('0x7'));var config=require('../../config/environment');var controller=require(_0x876d('0x8'));router[_0x876d('0x9')]('/',auth[_0x876d('0xa')](),controller[_0x876d('0xb')]);router[_0x876d('0x9')](_0x876d('0xc'),auth[_0x876d('0xa')](),controller[_0x876d('0xd')]);router[_0x876d('0xe')]('/',auth[_0x876d('0xa')](),controller[_0x876d('0xf')]);router[_0x876d('0x10')]('/:id',auth[_0x876d('0xa')](),controller[_0x876d('0x11')]);router['delete'](_0x876d('0xc'),auth[_0x876d('0xa')](),controller[_0x876d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b59b67c..60826b5 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 _0x44dd=['STRING','setDataValue','name','long','type','select','parse','values','isArray','stringify','voice','sequelize','exports','VIRTUAL','getDataValue','alias'];(function(_0x19ed24,_0xbafeed){var _0x53aeea=function(_0x95a7c6){while(--_0x95a7c6){_0x19ed24['push'](_0x19ed24['shift']());}};_0x53aeea(++_0xbafeed);}(_0x44dd,0x16b));var _0xd44d=function(_0x4cf499,_0x408b05){_0x4cf499=_0x4cf499-0x0;var _0x5d4ff8=_0x44dd[_0x4cf499];return _0x5d4ff8;};'use strict';var Sequelize=require(_0xd44d('0x0'));var _=require('lodash');module[_0xd44d('0x1')]={'name':{'type':Sequelize[_0xd44d('0x2')],'get':function(_0x7598f2){return this[_0xd44d('0x3')](_0xd44d('0x4'));}},'alias':{'type':Sequelize[_0xd44d('0x5')],'allowNull':![],'set':function(_0x2c65b0){this[_0xd44d('0x6')](_0xd44d('0x4'),_0x2c65b0?_0x2c65b0:this[_0xd44d('0x3')](_0xd44d('0x7')));}},'type':{'type':Sequelize[_0xd44d('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xd44d('0x8')),'get':function(){if(this['getDataValue'](_0xd44d('0x9'))===_0xd44d('0xa')){return JSON[_0xd44d('0xb')](this['getDataValue'](_0xd44d('0xc')));}else{return this[_0xd44d('0x3')](_0xd44d('0xc'));}},'set':function(_0x5770b5){if(Array[_0xd44d('0xd')](_0x5770b5)){this[_0xd44d('0x6')]('values',JSON[_0xd44d('0xe')](_0x5770b5));}else{this['setDataValue'](_0xd44d('0xc'),_0x5770b5);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xd44d('0xf'))}}; \ No newline at end of file +var _0x09bf=['TEXT','type','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x09bf,0x195));var _0xf09b=function(_0x11ca06,_0x239d8b){_0x11ca06=_0x11ca06-0x0;var _0x41d8fb=_0x09bf[_0x11ca06];return _0x41d8fb;};'use strict';var Sequelize=require(_0xf09b('0x0'));var _=require(_0xf09b('0x1'));module[_0xf09b('0x2')]={'name':{'type':Sequelize[_0xf09b('0x3')],'get':function(_0x404555){return this['getDataValue'](_0xf09b('0x4'));}},'alias':{'type':Sequelize[_0xf09b('0x5')],'allowNull':![],'set':function(_0x25958a){this[_0xf09b('0x6')](_0xf09b('0x4'),_0x25958a?_0x25958a:this[_0xf09b('0x7')](_0xf09b('0x8')));}},'type':{'type':Sequelize[_0xf09b('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf09b('0x9')]('long'),'get':function(){if(this[_0xf09b('0x7')](_0xf09b('0xa'))==='select'){return JSON[_0xf09b('0xb')](this[_0xf09b('0x7')](_0xf09b('0xc')));}else{return this[_0xf09b('0x7')]('values');}},'set':function(_0x8be632){if(Array[_0xf09b('0xd')](_0x8be632)){this[_0xf09b('0x6')](_0xf09b('0xc'),JSON[_0xf09b('0xe')](_0x8be632));}else{this[_0xf09b('0x6')]('values',_0x8be632);}}},'required':{'type':Sequelize[_0xf09b('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf09b('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf09b('0x10')](_0xf09b('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 73bdb7a..23a2e34 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 _0x44d4=['filter','merge','options','CmCustomField','includeAll','findAll','rows','show','rawAttributes','length','include','find','catch','body','params','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','addColumn','cm_contacts','format','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','apply','save','update','then','destroy','stack','name','send','index','fieldName','type','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x44d4,0x102));var _0x444d=function(_0x4f4679,_0x713087){_0x4f4679=_0x4f4679-0x0;var _0x2f7cd0=_0x44d4[_0x4f4679];return _0x2f7cd0;};'use strict';var emlformat=require(_0x444d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x444d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x444d('0x2'));var moment=require(_0x444d('0x3'));var BPromise=require(_0x444d('0x4'));var Mustache=require(_0x444d('0x5'));var util=require('util');var path=require(_0x444d('0x6'));var sox=require(_0x444d('0x7'));var csv=require(_0x444d('0x8'));var ejs=require(_0x444d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x444d('0xa'));var squel=require(_0x444d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x444d('0xc'));var toCsv=require(_0x444d('0x8'));var querystring=require(_0x444d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x444d('0xe'));var as=require(_0x444d('0xf'));var hardwareService=require(_0x444d('0x10'));var logger=require(_0x444d('0x11'))(_0x444d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x444d('0x13'));var db=require(_0x444d('0x14'))['db'];function respondWithStatusCode(_0x1b353b,_0x3b0d73){_0x3b0d73=_0x3b0d73||0xcc;return function(_0x2615f2){if(_0x2615f2){return _0x1b353b[_0x444d('0x15')](_0x3b0d73);}return _0x1b353b[_0x444d('0x16')](_0x3b0d73)['end']();};}function respondWithResult(_0x315443,_0x100a22){_0x100a22=_0x100a22||0xc8;return function(_0x5995cf){if(_0x5995cf){return _0x315443['status'](_0x100a22)['json'](_0x5995cf);}};}function respondWithFilteredResult(_0x100a05,_0x349ebc){return function(_0x153074){if(_0x153074){var _0xc3fc17=typeof _0x349ebc[_0x444d('0x17')]===_0x444d('0x18')&&typeof _0x349ebc[_0x444d('0x19')]===_0x444d('0x18');var _0x184a9d=_0x153074[_0x444d('0x1a')];var _0x13b25d=_0xc3fc17?0x0:_0x349ebc[_0x444d('0x17')];var _0x1af0fc=_0xc3fc17?_0x153074[_0x444d('0x1a')]:_0x349ebc[_0x444d('0x17')]+_0x349ebc[_0x444d('0x19')];var _0x47fae0;if(_0x1af0fc>=_0x184a9d){_0x1af0fc=_0x184a9d;_0x47fae0=0xc8;}else{_0x47fae0=0xce;}_0x100a05[_0x444d('0x16')](_0x47fae0);return _0x100a05['set']('Content-Range',_0x13b25d+'-'+_0x1af0fc+'/'+_0x184a9d)['json'](_0x153074);}return null;};}function patchUpdates(_0x188a0e){return function(_0x530343){try{jsonpatch[_0x444d('0x1b')](_0x530343,_0x188a0e,!![]);}catch(_0x31612f){return BPromise['reject'](_0x31612f);}return _0x530343[_0x444d('0x1c')]();};}function saveUpdates(_0x304e16,_0x2c9191){return function(_0x1ae181){if(_0x1ae181){return _0x1ae181[_0x444d('0x1d')](_0x304e16)[_0x444d('0x1e')](function(_0x17d674){return _0x17d674;});}return null;};}function removeEntity(_0x484c48,_0x300b04){return function(_0x58288a){if(_0x58288a){return _0x58288a[_0x444d('0x1f')]()[_0x444d('0x1e')](function(){_0x484c48[_0x444d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3421d5,_0x28afb4){return function(_0x540e28){if(!_0x540e28){_0x3421d5['sendStatus'](0x194);}return _0x540e28;};}function handleError(_0x2147b4,_0x107fd1){_0x107fd1=_0x107fd1||0x1f4;return function(_0x46df2a){logger['error'](_0x46df2a[_0x444d('0x20')]);if(_0x46df2a['name']){delete _0x46df2a[_0x444d('0x21')];}_0x2147b4[_0x444d('0x16')](_0x107fd1)[_0x444d('0x22')](_0x46df2a);};}exports[_0x444d('0x23')]=function(_0x4432c2,_0x27b70f){var _0x125734={},_0x1cef85={},_0x3188c2={'count':0x0,'rows':[]};var _0x28942b=_['map'](db['CmCustomField']['rawAttributes'],function(_0x233725){return{'name':_0x233725[_0x444d('0x24')],'type':_0x233725[_0x444d('0x25')]['key']};});_0x1cef85[_0x444d('0x26')]=_[_0x444d('0x27')](_[_0x444d('0x28')](_0x28942b,_0x444d('0x21')),[_0x444d('0x21')]);_0x1cef85[_0x444d('0x29')]=_[_0x444d('0x2a')](_0x4432c2['query']);_0x1cef85[_0x444d('0x2b')]=_[_0x444d('0x2c')](_0x1cef85[_0x444d('0x26')],_0x1cef85['query']);_0x125734[_0x444d('0x2d')]=_[_0x444d('0x2c')](_0x1cef85[_0x444d('0x26')],qs[_0x444d('0x2e')](_0x4432c2[_0x444d('0x29')]['fields']));_0x125734[_0x444d('0x2d')]=_0x125734['attributes']['length']?_0x125734[_0x444d('0x2d')]:_0x1cef85[_0x444d('0x26')];if(!_0x4432c2[_0x444d('0x29')][_0x444d('0x2f')]('nolimit')){_0x125734['limit']=qs[_0x444d('0x19')](_0x4432c2[_0x444d('0x29')][_0x444d('0x19')]);_0x125734['offset']=qs[_0x444d('0x17')](_0x4432c2[_0x444d('0x29')][_0x444d('0x17')]);}_0x125734['order']=qs[_0x444d('0x30')](_0x4432c2[_0x444d('0x29')][_0x444d('0x30')]);_0x125734[_0x444d('0x31')]=qs['filters'](_['pick'](_0x4432c2[_0x444d('0x29')],_0x1cef85[_0x444d('0x2b')]),_0x28942b);if(_0x4432c2[_0x444d('0x29')][_0x444d('0x32')]){_0x125734[_0x444d('0x31')]=_[_0x444d('0x33')](_0x125734[_0x444d('0x31')],{'$or':_[_0x444d('0x28')](_0x28942b,function(_0x56f992){if(_0x56f992[_0x444d('0x25')]!=='VIRTUAL'){var _0x57d28f={};_0x57d28f[_0x56f992[_0x444d('0x21')]]={'$like':'%'+_0x4432c2[_0x444d('0x29')][_0x444d('0x32')]+'%'};return _0x57d28f;}})});}_0x125734=_[_0x444d('0x33')]({},_0x125734,_0x4432c2[_0x444d('0x34')]);var _0x3f15d6={'where':_0x125734['where']};return db[_0x444d('0x35')][_0x444d('0x1a')](_0x3f15d6)['then'](function(_0x4562b3){_0x3188c2[_0x444d('0x1a')]=_0x4562b3;if(_0x4432c2[_0x444d('0x29')][_0x444d('0x36')]){_0x125734['include']=[{'all':!![]}];}return db[_0x444d('0x35')][_0x444d('0x37')](_0x125734);})[_0x444d('0x1e')](function(_0x52cc99){_0x3188c2[_0x444d('0x38')]=_0x52cc99;return _0x3188c2;})[_0x444d('0x1e')](respondWithFilteredResult(_0x27b70f,_0x125734))['catch'](handleError(_0x27b70f,null));};exports[_0x444d('0x39')]=function(_0x91ff44,_0x11e8e0){var _0x1f56bf={'raw':!![],'where':{'id':_0x91ff44['params']['id']}},_0x1cb879={};_0x1cb879[_0x444d('0x26')]=_[_0x444d('0x2a')](db['CmCustomField'][_0x444d('0x3a')]);_0x1cb879[_0x444d('0x29')]=_[_0x444d('0x2a')](_0x91ff44[_0x444d('0x29')]);_0x1cb879['filters']=_[_0x444d('0x2c')](_0x1cb879[_0x444d('0x26')],_0x1cb879[_0x444d('0x29')]);_0x1f56bf['attributes']=_[_0x444d('0x2c')](_0x1cb879['model'],qs[_0x444d('0x2e')](_0x91ff44['query'][_0x444d('0x2e')]));_0x1f56bf[_0x444d('0x2d')]=_0x1f56bf[_0x444d('0x2d')][_0x444d('0x3b')]?_0x1f56bf[_0x444d('0x2d')]:_0x1cb879['model'];if(_0x91ff44['query'][_0x444d('0x36')]){_0x1f56bf[_0x444d('0x3c')]=[{'all':!![]}];}_0x1f56bf=_[_0x444d('0x33')]({},_0x1f56bf,_0x91ff44[_0x444d('0x34')]);return db[_0x444d('0x35')][_0x444d('0x3d')](_0x1f56bf)['then'](handleEntityNotFound(_0x11e8e0,null))['then'](respondWithResult(_0x11e8e0,null))[_0x444d('0x3e')](handleError(_0x11e8e0,null));};exports[_0x444d('0x1d')]=function(_0x2ca5a6,_0x2b65bf){if(_0x2ca5a6[_0x444d('0x3f')]['id']){delete _0x2ca5a6[_0x444d('0x3f')]['id'];}return db[_0x444d('0x35')][_0x444d('0x3d')]({'where':{'id':_0x2ca5a6[_0x444d('0x40')]['id']}})[_0x444d('0x1e')](handleEntityNotFound(_0x2b65bf,null))['then'](saveUpdates(_0x2ca5a6['body'],null))[_0x444d('0x1e')](respondWithResult(_0x2b65bf,null))['catch'](handleError(_0x2b65bf,null));};exports[_0x444d('0x1f')]=function(_0x46c880,_0x90d3c4){return db[_0x444d('0x35')][_0x444d('0x3d')]({'where':{'id':_0x46c880['params']['id']}})[_0x444d('0x1e')](handleEntityNotFound(_0x90d3c4,null))[_0x444d('0x1e')](removeEntity(_0x90d3c4,null))['catch'](handleError(_0x90d3c4,null));};exports[_0x444d('0x41')]=function(_0xea2fa,_0x595d0c){var _0x3bf062;return db[_0x444d('0x42')][_0x444d('0x43')](function(_0x265f93){return db[_0x444d('0x35')]['create'](_0xea2fa['body'],{'transaction':_0x265f93})[_0x444d('0x1e')](function(_0x27b0ac){_0x3bf062=_0x27b0ac;var _0x3b071c={'type':db[_0x444d('0x44')][_0x444d('0x45')],'transaction':_0x265f93};switch(_0xea2fa['body'][_0x444d('0x25')]){case'text':_0x3b071c['type']=db[_0x444d('0x44')][_0x444d('0x45')];break;case _0x444d('0x46'):_0x3b071c[_0x444d('0x25')]=db[_0x444d('0x44')][_0x444d('0x47')];break;case _0x444d('0x48'):_0x3b071c[_0x444d('0x25')]=db['Sequelize'][_0x444d('0x49')];_0x3b071c['defaultValue']=![];break;default:}return db[_0x444d('0x42')]['queryInterface'][_0x444d('0x4a')](_0x444d('0x4b'),util[_0x444d('0x4c')]('cf_%d',_0x3bf062['id']),_0x3b071c);})[_0x444d('0x1e')](function(){return _0x3bf062;});})['then'](respondWithResult(_0x595d0c,0xc9))[_0x444d('0x3e')](handleError(_0x595d0c,null));}; \ No newline at end of file +var _0x9971=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','index','CmCustomField','type','key','differenceBy','keys','filters','intersection','model','query','fields','attributes','length'];(function(_0xd86ce5,_0xb30ee8){var _0x2b114b=function(_0x1caff3){while(--_0x1caff3){_0xd86ce5['push'](_0xd86ce5['shift']());}};_0x2b114b(++_0xb30ee8);}(_0x9971,0xcc));var _0x1997=function(_0x403ece,_0x3e9f1e){_0x403ece=_0x403ece-0x0;var _0x248976=_0x9971[_0x403ece];return _0x248976;};'use strict';var emlformat=require(_0x1997('0x0'));var rimraf=require(_0x1997('0x1'));var zipdir=require(_0x1997('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1997('0x3'));var moment=require(_0x1997('0x4'));var BPromise=require(_0x1997('0x5'));var Mustache=require(_0x1997('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1997('0x7'));var csv=require(_0x1997('0x8'));var ejs=require(_0x1997('0x9'));var fs=require('fs');var fs_extra=require(_0x1997('0xa'));var _=require('lodash');var squel=require(_0x1997('0xb'));var crypto=require('crypto');var jsforce=require(_0x1997('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1997('0x8'));var querystring=require(_0x1997('0xd'));var Papa=require(_0x1997('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1997('0xf'));var as=require(_0x1997('0x10'));var hardwareService=require(_0x1997('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x1997('0x12'));var config=require(_0x1997('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1997('0x14'))['db'];function respondWithStatusCode(_0x17984e,_0x535a5a){_0x535a5a=_0x535a5a||0xcc;return function(_0x1b4ae8){if(_0x1b4ae8){return _0x17984e[_0x1997('0x15')](_0x535a5a);}return _0x17984e[_0x1997('0x16')](_0x535a5a)[_0x1997('0x17')]();};}function respondWithResult(_0x37c9f2,_0x41c605){_0x41c605=_0x41c605||0xc8;return function(_0x32bd02){if(_0x32bd02){return _0x37c9f2[_0x1997('0x16')](_0x41c605)[_0x1997('0x18')](_0x32bd02);}};}function respondWithFilteredResult(_0x261668,_0x5a427c){return function(_0x24c36c){if(_0x24c36c){var _0x16f6c4=typeof _0x5a427c['offset']===_0x1997('0x19')&&typeof _0x5a427c[_0x1997('0x1a')]===_0x1997('0x19');var _0x25f83f=_0x24c36c[_0x1997('0x1b')];var _0x5c3385=_0x16f6c4?0x0:_0x5a427c[_0x1997('0x1c')];var _0x4261ac=_0x16f6c4?_0x24c36c['count']:_0x5a427c[_0x1997('0x1c')]+_0x5a427c[_0x1997('0x1a')];var _0x55f439;if(_0x4261ac>=_0x25f83f){_0x4261ac=_0x25f83f;_0x55f439=0xc8;}else{_0x55f439=0xce;}_0x261668[_0x1997('0x16')](_0x55f439);return _0x261668[_0x1997('0x1d')](_0x1997('0x1e'),_0x5c3385+'-'+_0x4261ac+'/'+_0x25f83f)[_0x1997('0x18')](_0x24c36c);}return null;};}function patchUpdates(_0x1752f4){return function(_0x4679ed){try{jsonpatch[_0x1997('0x1f')](_0x4679ed,_0x1752f4,!![]);}catch(_0xb70035){return BPromise[_0x1997('0x20')](_0xb70035);}return _0x4679ed[_0x1997('0x21')]();};}function saveUpdates(_0x500f9d,_0x425738){return function(_0x88f3bc){if(_0x88f3bc){return _0x88f3bc[_0x1997('0x22')](_0x500f9d)[_0x1997('0x23')](function(_0x2d2b53){return _0x2d2b53;});}return null;};}function removeEntity(_0x336eec,_0x474317){return function(_0xe2228a){if(_0xe2228a){return _0xe2228a[_0x1997('0x24')]()['then'](function(){_0x336eec[_0x1997('0x16')](0xcc)[_0x1997('0x17')]();});}};}function handleEntityNotFound(_0x5e5e86,_0x4da48d){return function(_0x353120){if(!_0x353120){_0x5e5e86[_0x1997('0x15')](0x194);}return _0x353120;};}function handleError(_0x6829f0,_0x539a45){_0x539a45=_0x539a45||0x1f4;return function(_0xb4f9d){logger['error'](_0xb4f9d['stack']);if(_0xb4f9d['name']){delete _0xb4f9d[_0x1997('0x25')];}_0x6829f0[_0x1997('0x16')](_0x539a45)['send'](_0xb4f9d);};}exports[_0x1997('0x26')]=function(_0x3d9d2a,_0x41a32d){var _0x309d9f={},_0x51d6a1={},_0x44fa02={'count':0x0,'rows':[]};var _0x203fb0=_['map'](db[_0x1997('0x27')]['rawAttributes'],function(_0x3b7f4c){return{'name':_0x3b7f4c['fieldName'],'type':_0x3b7f4c[_0x1997('0x28')][_0x1997('0x29')]};});_0x51d6a1['model']=_[_0x1997('0x2a')](_['map'](_0x203fb0,_0x1997('0x25')),[_0x1997('0x25')]);_0x51d6a1['query']=_[_0x1997('0x2b')](_0x3d9d2a['query']);_0x51d6a1[_0x1997('0x2c')]=_[_0x1997('0x2d')](_0x51d6a1[_0x1997('0x2e')],_0x51d6a1[_0x1997('0x2f')]);_0x309d9f['attributes']=_[_0x1997('0x2d')](_0x51d6a1[_0x1997('0x2e')],qs[_0x1997('0x30')](_0x3d9d2a[_0x1997('0x2f')][_0x1997('0x30')]));_0x309d9f[_0x1997('0x31')]=_0x309d9f[_0x1997('0x31')][_0x1997('0x32')]?_0x309d9f[_0x1997('0x31')]:_0x51d6a1[_0x1997('0x2e')];if(!_0x3d9d2a[_0x1997('0x2f')]['hasOwnProperty'](_0x1997('0x33'))){_0x309d9f['limit']=qs['limit'](_0x3d9d2a['query'][_0x1997('0x1a')]);_0x309d9f['offset']=qs['offset'](_0x3d9d2a[_0x1997('0x2f')][_0x1997('0x1c')]);}_0x309d9f[_0x1997('0x34')]=qs[_0x1997('0x35')](_0x3d9d2a[_0x1997('0x2f')][_0x1997('0x35')]);_0x309d9f['where']=qs['filters'](_['pick'](_0x3d9d2a[_0x1997('0x2f')],_0x51d6a1[_0x1997('0x2c')]),_0x203fb0);if(_0x3d9d2a[_0x1997('0x2f')][_0x1997('0x36')]){_0x309d9f[_0x1997('0x37')]=_[_0x1997('0x38')](_0x309d9f[_0x1997('0x37')],{'$or':_['map'](_0x203fb0,function(_0x31ed87){if(_0x31ed87[_0x1997('0x28')]!==_0x1997('0x39')){var _0x222c1={};_0x222c1[_0x31ed87[_0x1997('0x25')]]={'$like':'%'+_0x3d9d2a[_0x1997('0x2f')][_0x1997('0x36')]+'%'};return _0x222c1;}})});}_0x309d9f=_[_0x1997('0x38')]({},_0x309d9f,_0x3d9d2a[_0x1997('0x3a')]);var _0x5861d0={'where':_0x309d9f[_0x1997('0x37')]};return db[_0x1997('0x27')][_0x1997('0x1b')](_0x5861d0)[_0x1997('0x23')](function(_0x4d289d){_0x44fa02['count']=_0x4d289d;if(_0x3d9d2a['query'][_0x1997('0x3b')]){_0x309d9f[_0x1997('0x3c')]=[{'all':!![]}];}return db[_0x1997('0x27')][_0x1997('0x3d')](_0x309d9f);})[_0x1997('0x23')](function(_0x215a0b){_0x44fa02[_0x1997('0x3e')]=_0x215a0b;return _0x44fa02;})[_0x1997('0x23')](respondWithFilteredResult(_0x41a32d,_0x309d9f))[_0x1997('0x3f')](handleError(_0x41a32d,null));};exports[_0x1997('0x40')]=function(_0x320f86,_0x1c0d20){var _0x1dbb85={'raw':!![],'where':{'id':_0x320f86[_0x1997('0x41')]['id']}},_0xb5e5f0={};_0xb5e5f0[_0x1997('0x2e')]=_[_0x1997('0x2b')](db[_0x1997('0x27')][_0x1997('0x42')]);_0xb5e5f0['query']=_[_0x1997('0x2b')](_0x320f86[_0x1997('0x2f')]);_0xb5e5f0['filters']=_[_0x1997('0x2d')](_0xb5e5f0[_0x1997('0x2e')],_0xb5e5f0[_0x1997('0x2f')]);_0x1dbb85['attributes']=_[_0x1997('0x2d')](_0xb5e5f0[_0x1997('0x2e')],qs[_0x1997('0x30')](_0x320f86[_0x1997('0x2f')][_0x1997('0x30')]));_0x1dbb85[_0x1997('0x31')]=_0x1dbb85[_0x1997('0x31')][_0x1997('0x32')]?_0x1dbb85[_0x1997('0x31')]:_0xb5e5f0['model'];if(_0x320f86[_0x1997('0x2f')][_0x1997('0x3b')]){_0x1dbb85[_0x1997('0x3c')]=[{'all':!![]}];}_0x1dbb85=_[_0x1997('0x38')]({},_0x1dbb85,_0x320f86[_0x1997('0x3a')]);return db['CmCustomField'][_0x1997('0x43')](_0x1dbb85)[_0x1997('0x23')](handleEntityNotFound(_0x1c0d20,null))[_0x1997('0x23')](respondWithResult(_0x1c0d20,null))[_0x1997('0x3f')](handleError(_0x1c0d20,null));};exports['update']=function(_0x2d436a,_0x4c20e9){if(_0x2d436a[_0x1997('0x44')]['id']){delete _0x2d436a[_0x1997('0x44')]['id'];}return db['CmCustomField'][_0x1997('0x43')]({'where':{'id':_0x2d436a[_0x1997('0x41')]['id']}})['then'](handleEntityNotFound(_0x4c20e9,null))[_0x1997('0x23')](saveUpdates(_0x2d436a['body'],null))[_0x1997('0x23')](respondWithResult(_0x4c20e9,null))['catch'](handleError(_0x4c20e9,null));};exports['destroy']=function(_0x58e927,_0x50b94f){return db[_0x1997('0x27')][_0x1997('0x43')]({'where':{'id':_0x58e927['params']['id']}})[_0x1997('0x23')](handleEntityNotFound(_0x50b94f,null))[_0x1997('0x23')](removeEntity(_0x50b94f,null))[_0x1997('0x3f')](handleError(_0x50b94f,null));};exports[_0x1997('0x45')]=function(_0x48ec3e,_0x912d79){var _0x3dcb7c;return db[_0x1997('0x46')][_0x1997('0x47')](function(_0x40024a){return db['CmCustomField'][_0x1997('0x45')](_0x48ec3e[_0x1997('0x44')],{'transaction':_0x40024a})['then'](function(_0x572aa4){_0x3dcb7c=_0x572aa4;var _0x10787c={'type':db[_0x1997('0x48')][_0x1997('0x49')],'transaction':_0x40024a};switch(_0x48ec3e[_0x1997('0x44')]['type']){case _0x1997('0x4a'):_0x10787c[_0x1997('0x28')]=db[_0x1997('0x48')][_0x1997('0x49')];break;case _0x1997('0x4b'):_0x10787c['type']=db['Sequelize'][_0x1997('0x4c')];break;case _0x1997('0x4d'):_0x10787c[_0x1997('0x28')]=db[_0x1997('0x48')][_0x1997('0x4e')];_0x10787c[_0x1997('0x4f')]=![];break;default:}return db[_0x1997('0x46')][_0x1997('0x50')][_0x1997('0x51')](_0x1997('0x52'),util[_0x1997('0x53')](_0x1997('0x54'),_0x3dcb7c['id']),_0x10787c);})[_0x1997('0x23')](function(){return _0x3dcb7c;});})[_0x1997('0x23')](respondWithResult(_0x912d79,0xc9))[_0x1997('0x3f')](handleError(_0x912d79,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 442e9ec..b5db58a 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 _0xe1e6=['./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x23465a,_0x41ed48){var _0x382ec6=function(_0x2df315){while(--_0x2df315){_0x23465a['push'](_0x23465a['shift']());}};_0x382ec6(++_0x41ed48);}(_0xe1e6,0x1b2));var _0x6e1e=function(_0x2ef317,_0xb6cf){_0x2ef317=_0x2ef317-0x0;var _0x168526=_0xe1e6[_0x2ef317];return _0x168526;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e1e('0x0'))('api');var moment=require(_0x6e1e('0x1'));var BPromise=require(_0x6e1e('0x2'));var rp=require(_0x6e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e1e('0x4'));var config=require(_0x6e1e('0x5'));var attributes=require(_0x6e1e('0x6'));module[_0x6e1e('0x7')]=function(_0x38a1c8,_0x5ebed8){return _0x38a1c8[_0x6e1e('0x8')](_0x6e1e('0x9'),attributes,{'tableName':_0x6e1e('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ee6=['moment','bluebird','../../config/environment','./cmCustomField.attributes','CmCustomField','cm_custom_fields','lodash','util','api'];(function(_0x1f66a1,_0x15dc56){var _0x1ae463=function(_0x563131){while(--_0x563131){_0x1f66a1['push'](_0x1f66a1['shift']());}};_0x1ae463(++_0x15dc56);}(_0x2ee6,0x1ad));var _0x62ee=function(_0xa785d3,_0x23ce94){_0xa785d3=_0xa785d3-0x0;var _0x18049c=_0x2ee6[_0xa785d3];return _0x18049c;};'use strict';var _=require(_0x62ee('0x0'));var util=require(_0x62ee('0x1'));var logger=require('../../config/logger')(_0x62ee('0x2'));var moment=require(_0x62ee('0x3'));var BPromise=require(_0x62ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x62ee('0x5'));var attributes=require(_0x62ee('0x6'));module['exports']=function(_0x397177,_0x2b7e39){return _0x397177['define'](_0x62ee('0x7'),attributes,{'tableName':_0x62ee('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 30ccd0e..66d9d07 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 _0xe382=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CmCustomField,\x20%s,\x20%s','info','result','lodash','util'];(function(_0x127446,_0x748577){var _0x1efa67=function(_0x2aff5a){while(--_0x2aff5a){_0x127446['push'](_0x127446['shift']());}};_0x1efa67(++_0x748577);}(_0xe382,0x88));var _0x2e38=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xe382[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x2e38('0x0'));var util=require(_0x2e38('0x1'));var moment=require(_0x2e38('0x2'));var BPromise=require(_0x2e38('0x3'));var rs=require(_0x2e38('0x4'));var fs=require('fs');var Redis=require(_0x2e38('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e38('0x6'));var logger=require(_0x2e38('0x7'))(_0x2e38('0x8'));var config=require(_0x2e38('0x9'));var jayson=require(_0x2e38('0xa'));var client=jayson[_0x2e38('0xb')][_0x2e38('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c77fb,_0xb2fa52,_0x1bc9b6){return new BPromise(function(_0x5d8ad9,_0x43f1b7){return client[_0x2e38('0xd')](_0x4c77fb,_0x1bc9b6)[_0x2e38('0xe')](function(_0x263276){logger['info']('CmCustomField,\x20%s,\x20%s',_0xb2fa52,'request\x20sent');logger['debug'](_0x2e38('0xf'),_0xb2fa52,_0x2e38('0x10'),JSON[_0x2e38('0x11')](_0x263276));if(_0x263276['error']){if(_0x263276[_0x2e38('0x12')]['code']===0x1f4){logger[_0x2e38('0x12')]('CmCustomField,\x20%s,\x20%s',_0xb2fa52,_0x263276[_0x2e38('0x12')][_0x2e38('0x13')]);return _0x43f1b7(_0x263276[_0x2e38('0x12')][_0x2e38('0x13')]);}logger[_0x2e38('0x12')](_0x2e38('0x14'),_0xb2fa52,_0x263276['error'][_0x2e38('0x13')]);return _0x5d8ad9(_0x263276['error'][_0x2e38('0x13')]);}else{logger[_0x2e38('0x15')](_0x2e38('0x14'),_0xb2fa52,_0x2e38('0x10'));_0x5d8ad9(_0x263276[_0x2e38('0x16')]['message']);}})['catch'](function(_0x58c8c8){logger['error'](_0x2e38('0x14'),_0xb2fa52,_0x58c8c8);_0x43f1b7(_0x58c8c8);});});} \ No newline at end of file +var _0x6784=['../../config/logger','rpc','../../config/environment','client','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6784,0xf6));var _0x4678=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x6784[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x4678('0x0'));var util=require(_0x4678('0x1'));var moment=require('moment');var BPromise=require(_0x4678('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4678('0x3'));var db=require(_0x4678('0x4'))['db'];var utils=require(_0x4678('0x5'));var logger=require(_0x4678('0x6'))(_0x4678('0x7'));var config=require(_0x4678('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4678('0x9')][_0x4678('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x431d6b,_0x4a20ce,_0x9e4aea){return new BPromise(function(_0x249800,_0x11bc54){return client[_0x4678('0xb')](_0x431d6b,_0x9e4aea)['then'](function(_0x4627de){logger['info'](_0x4678('0xc'),_0x4a20ce,_0x4678('0xd'));logger[_0x4678('0xe')](_0x4678('0xf'),_0x4a20ce,_0x4678('0xd'),JSON['stringify'](_0x4627de));if(_0x4627de[_0x4678('0x10')]){if(_0x4627de[_0x4678('0x10')][_0x4678('0x11')]===0x1f4){logger[_0x4678('0x10')](_0x4678('0xc'),_0x4a20ce,_0x4627de['error']['message']);return _0x11bc54(_0x4627de[_0x4678('0x10')]['message']);}logger[_0x4678('0x10')](_0x4678('0xc'),_0x4a20ce,_0x4627de['error'][_0x4678('0x12')]);return _0x249800(_0x4627de['error'][_0x4678('0x12')]);}else{logger['info'](_0x4678('0xc'),_0x4a20ce,_0x4678('0xd'));_0x249800(_0x4627de[_0x4678('0x13')][_0x4678('0x12')]);}})[_0x4678('0x14')](function(_0x28f4d2){logger['error']('CmCustomField,\x20%s,\x20%s',_0x4a20ce,_0x28f4d2);_0x11bc54(_0x28f4d2);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2b43c82..e40bb7a 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 _0xc569=['post','create','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x5cdce6,_0x30757c){var _0x22e5be=function(_0x3a49fb){while(--_0x3a49fb){_0x5cdce6['push'](_0x5cdce6['shift']());}};_0x22e5be(++_0x30757c);}(_0xc569,0x159));var _0x9c56=function(_0x5adeeb,_0x3fb330){_0x5adeeb=_0x5adeeb-0x0;var _0x14f035=_0xc569[_0x5adeeb];return _0x14f035;};'use strict';var multer=require(_0x9c56('0x0'));var util=require(_0x9c56('0x1'));var path=require(_0x9c56('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c56('0x3'));var router=express[_0x9c56('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c56('0x5'));var interaction=require(_0x9c56('0x6'));var config=require(_0x9c56('0x7'));var controller=require('./cmCustomField.controller');router[_0x9c56('0x8')]('/',auth[_0x9c56('0x9')](),controller[_0x9c56('0xa')]);router[_0x9c56('0x8')]('/:id',auth[_0x9c56('0x9')](),controller[_0x9c56('0xb')]);router[_0x9c56('0xc')]('/',auth[_0x9c56('0x9')](),controller[_0x9c56('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9c56('0xe')]);router[_0x9c56('0xf')]('/:id',auth[_0x9c56('0x9')](),controller['destroy']);module[_0x9c56('0x10')]=router; \ No newline at end of file +var _0x723e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','put','delete','exports','util','path','connect-timeout'];(function(_0x343f78,_0x542846){var _0x224655=function(_0x10d5d4){while(--_0x10d5d4){_0x343f78['push'](_0x343f78['shift']());}};_0x224655(++_0x542846);}(_0x723e,0x179));var _0xe723=function(_0x58afb0,_0x3f5c0e){_0x58afb0=_0x58afb0-0x0;var _0x94fb03=_0x723e[_0x58afb0];return _0x94fb03;};'use strict';var multer=require('multer');var util=require(_0xe723('0x0'));var path=require(_0xe723('0x1'));var timeout=require(_0xe723('0x2'));var express=require(_0xe723('0x3'));var router=express[_0xe723('0x4')]();var fs_extra=require(_0xe723('0x5'));var auth=require(_0xe723('0x6'));var interaction=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var controller=require(_0xe723('0x9'));router['get']('/',auth[_0xe723('0xa')](),controller[_0xe723('0xb')]);router[_0xe723('0xc')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller[_0xe723('0xe')]);router[_0xe723('0xf')]('/',auth[_0xe723('0xa')](),controller['create']);router[_0xe723('0x10')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller['update']);router[_0xe723('0x11')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller['destroy']);module[_0xe723('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 db3164e..a01419a 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 _0x6338=['STRING','contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format','INTEGER'];(function(_0x4ef519,_0x435ddd){var _0x14e7a4=function(_0x76339a){while(--_0x76339a){_0x4ef519['push'](_0x4ef519['shift']());}};_0x14e7a4(++_0x435ddd);}(_0x6338,0x158));var _0x8633=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6338[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x8633('0x0'));var Sequelize=require(_0x8633('0x1'));module[_0x8633('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x8633('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8633('0x4')],'defaultValue':moment()[_0x8633('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8633('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8633('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8633('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8633('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8633('0x4')]},'priority':{'type':Sequelize[_0x8633('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8633('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x8633('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x8633('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x8633('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x8633('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x8633('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8633('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8633('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8633('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8633('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8633('0x7')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8633('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x011a=['contactListQueue','moment','sequelize','DATE','format','INTEGER','BOOLEAN','STRING','UNSIGNED'];(function(_0x57c48a,_0x4f0e5a){var _0x344f74=function(_0xc0dfbc){while(--_0xc0dfbc){_0x57c48a['push'](_0x57c48a['shift']());}};_0x344f74(++_0x4f0e5a);}(_0x011a,0x91));var _0xa011=function(_0x322296,_0x57eb19){_0x322296=_0x322296-0x0;var _0x432ea7=_0x011a[_0x322296];return _0x432ea7;};'use strict';var moment=require(_0xa011('0x0'));var Sequelize=require(_0xa011('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa011('0x2')],'defaultValue':moment()[_0xa011('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa011('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa011('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa011('0x2')]},'priority':{'type':Sequelize[_0xa011('0x4')](0x2)[_0xa011('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa011('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa011('0x4')],'unique':_0xa011('0x8')},'ListId':{'type':Sequelize[_0xa011('0x4')],'unique':_0xa011('0x8')},'UserId':{'type':Sequelize[_0xa011('0x4')]},'VoiceQueueId':{'type':Sequelize[_0xa011('0x4')],'unique':_0xa011('0x8')},'CampaignId':{'type':Sequelize[_0xa011('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xa011('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa011('0x6')]},'recallmeNotifiedDate':{'type':Sequelize[_0xa011('0x2')],'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 e788b24..9e7c659 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 _0x1cb9=['calleridnum','phone','campaigntype','queue','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','destroy','end','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','map','filter','value','direction','prev','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmCompany','Company','List','VoiceQueue','Queue','dialActive','getPreviewRecall','findOne','recallme','Contact','getOpenContacts','outbound','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','undefined','count','offset','limit','set','update','then','sendStatus','error','stack','name','index','CmHopper','fieldName','type','query','keys','intersection','model','concat','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$between','$in','$notIn','$like','$iLike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','VoiceQueueId','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x549b48,_0x2de299){var _0x1ec344=function(_0x4152ef){while(--_0x4152ef){_0x549b48['push'](_0x549b48['shift']());}};_0x1ec344(++_0x2de299);}(_0x1cb9,0x14e));var _0x91cb=function(_0x293a36,_0xcc7486){_0x293a36=_0x293a36-0x0;var _0x55fea1=_0x1cb9[_0x293a36];return _0x55fea1;};'use strict';var moment=require(_0x91cb('0x0'));var _=require('lodash');var qs=require(_0x91cb('0x1'));var logger=require(_0x91cb('0x2'))(_0x91cb('0x3'));var shared=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x42910d,_0x2b7314){_0x2b7314=_0x2b7314||0xc8;return function(_0x5652cd){if(_0x5652cd){return _0x42910d[_0x91cb('0x5')](_0x2b7314)[_0x91cb('0x6')](_0x5652cd);}};}function respondWithFilteredResult(_0x186dc3,_0x28543e){return function(_0x3b9d98){if(_0x3b9d98){var _0x8f8a3b=typeof _0x28543e['offset']===_0x91cb('0x7')&&typeof _0x28543e['limit']===_0x91cb('0x7');var _0x4cf9ed=_0x3b9d98[_0x91cb('0x8')];var _0x317df0=_0x8f8a3b?0x0:_0x28543e[_0x91cb('0x9')];var _0x4a631d=_0x8f8a3b?_0x3b9d98[_0x91cb('0x8')]:_0x28543e[_0x91cb('0x9')]+_0x28543e[_0x91cb('0xa')];var _0x22dcab;if(_0x4a631d>=_0x4cf9ed){_0x4a631d=_0x4cf9ed;_0x22dcab=0xc8;}else{_0x22dcab=0xce;}_0x186dc3[_0x91cb('0x5')](_0x22dcab);return _0x186dc3[_0x91cb('0xb')]('Content-Range',_0x317df0+'-'+_0x4a631d+'/'+_0x4cf9ed)[_0x91cb('0x6')](_0x3b9d98);}return null;};}function saveUpdates(_0x366f09,_0x4ba2f2){return function(_0x20e6e0){if(_0x20e6e0){return _0x20e6e0[_0x91cb('0xc')](_0x366f09)[_0x91cb('0xd')](function(_0x2c7d40){return _0x2c7d40;});}return null;};}function handleEntityNotFound(_0x4a7d45,_0x4cc6ef){return function(_0x4aae25){if(!_0x4aae25){_0x4a7d45[_0x91cb('0xe')](0x194);}return _0x4aae25;};}function handleError(_0x585470,_0x528f73){_0x528f73=_0x528f73||0x1f4;return function(_0x576369){logger[_0x91cb('0xf')](_0x576369[_0x91cb('0x10')]);if(_0x576369['name']){delete _0x576369[_0x91cb('0x11')];}_0x585470[_0x91cb('0x5')](_0x528f73)['send'](_0x576369);};}exports[_0x91cb('0x12')]=function(_0x139f4b,_0x1cd34b){var _0xcd1a78={},_0x5cc1c3={},_0x3fba4f={'count':0x0,'rows':[]};var _0x7dcf60=_['map'](db[_0x91cb('0x13')]['rawAttributes'],function(_0x55042a){return{'name':_0x55042a[_0x91cb('0x14')],'type':_0x55042a[_0x91cb('0x15')]['key']};});_0x5cc1c3['model']=_['map'](_0x7dcf60,_0x91cb('0x11'));_0x5cc1c3[_0x91cb('0x16')]=_[_0x91cb('0x17')](_0x139f4b[_0x91cb('0x16')]);_0x5cc1c3['filters']=_[_0x91cb('0x18')](_0x5cc1c3[_0x91cb('0x19')],_0x5cc1c3[_0x91cb('0x16')]);_0x5cc1c3['filters']=_[_0x91cb('0x1a')](_0x5cc1c3[_0x91cb('0x1b')],[_0x91cb('0x1c'),_0x91cb('0x1d'),_0x91cb('0x1e'),_0x91cb('0x1f'),_0x91cb('0x20'),_0x91cb('0x21'),_0x91cb('0x22'),'$eq','$not',_0x91cb('0x23'),'$notBetween',_0x91cb('0x24'),_0x91cb('0x25'),_0x91cb('0x26'),'$notLike',_0x91cb('0x27'),'$notILike',_0x91cb('0x26'),_0x91cb('0x28'),_0x91cb('0x29'),_0x91cb('0x2a'),_0x91cb('0x2b')]);_0xcd1a78['attributes']=_[_0x91cb('0x18')](_0x5cc1c3['model'],qs[_0x91cb('0x2c')](_0x139f4b[_0x91cb('0x16')][_0x91cb('0x2c')]));_0xcd1a78['attributes']=_0xcd1a78[_0x91cb('0x2d')][_0x91cb('0x2e')]?_0xcd1a78[_0x91cb('0x2d')]:_0x5cc1c3[_0x91cb('0x19')];if(!_0x139f4b[_0x91cb('0x16')][_0x91cb('0x2f')](_0x91cb('0x30'))){_0xcd1a78[_0x91cb('0xa')]=qs[_0x91cb('0xa')](_0x139f4b['query'][_0x91cb('0xa')]);_0xcd1a78[_0x91cb('0x9')]=qs[_0x91cb('0x9')](_0x139f4b[_0x91cb('0x16')][_0x91cb('0x9')]);}_0xcd1a78['order']=qs[_0x91cb('0x31')](_0x139f4b[_0x91cb('0x16')][_0x91cb('0x31')]);_0xcd1a78[_0x91cb('0x32')]=qs[_0x91cb('0x1b')](_['pick'](_0x139f4b[_0x91cb('0x16')],_0x5cc1c3['filters']),_0x7dcf60);if(_0x139f4b['query']['filter']){_0xcd1a78[_0x91cb('0x32')]=_['merge'](_0xcd1a78[_0x91cb('0x32')],{'$or':_['map'](_0x7dcf60,function(_0x59faf6){if(_0x59faf6[_0x91cb('0x15')]!==_0x91cb('0x33')){var _0x1deabb={};_0x1deabb[_0x59faf6[_0x91cb('0x11')]]={'$like':'%'+_0x139f4b[_0x91cb('0x16')]['filter']+'%'};return _0x1deabb;}})});}_0xcd1a78=_[_0x91cb('0x34')]({},_0xcd1a78,_0x139f4b[_0x91cb('0x35')]);var _0x13a5ea={'where':_0xcd1a78[_0x91cb('0x32')]};return db['CmHopper']['count'](_0x13a5ea)[_0x91cb('0xd')](function(_0x135bf1){_0x3fba4f['count']=_0x135bf1;if(_0x139f4b[_0x91cb('0x16')][_0x91cb('0x36')]){_0xcd1a78['include']=[{'all':!![]}];}return db[_0x91cb('0x13')][_0x91cb('0x37')](_0xcd1a78);})['then'](function(_0x43d4fe){_0x3fba4f['rows']=_0x43d4fe;return _0x3fba4f;})[_0x91cb('0xd')](respondWithFilteredResult(_0x1cd34b,_0xcd1a78))[_0x91cb('0x38')](handleError(_0x1cd34b,null));};exports[_0x91cb('0x39')]=function(_0x279ad5,_0x51d0ea){var _0x20bf50={'raw':!![],'where':{'id':_0x279ad5[_0x91cb('0x3a')]['id']}},_0x5d0e37={};_0x5d0e37[_0x91cb('0x19')]=_['keys'](db[_0x91cb('0x13')]['rawAttributes']);_0x5d0e37[_0x91cb('0x16')]=_[_0x91cb('0x17')](_0x279ad5[_0x91cb('0x16')]);_0x5d0e37[_0x91cb('0x1b')]=_['intersection'](_0x5d0e37[_0x91cb('0x19')],_0x5d0e37[_0x91cb('0x16')]);_0x20bf50[_0x91cb('0x2d')]=_[_0x91cb('0x18')](_0x5d0e37[_0x91cb('0x19')],qs[_0x91cb('0x2c')](_0x279ad5[_0x91cb('0x16')][_0x91cb('0x2c')]));_0x20bf50[_0x91cb('0x2d')]=_0x20bf50[_0x91cb('0x2d')]['length']?_0x20bf50[_0x91cb('0x2d')]:_0x5d0e37['model'];if(_0x279ad5[_0x91cb('0x16')]['includeAll']){_0x20bf50[_0x91cb('0x3b')]=[{'all':!![]}];}_0x20bf50=_['merge']({},_0x20bf50,_0x279ad5[_0x91cb('0x35')]);return db[_0x91cb('0x13')][_0x91cb('0x3c')](_0x20bf50)[_0x91cb('0xd')](handleEntityNotFound(_0x51d0ea,null))['then'](respondWithResult(_0x51d0ea,null))[_0x91cb('0x38')](handleError(_0x51d0ea,null));};exports[_0x91cb('0x3d')]=function(_0x57e26d,_0x461e1e){return db[_0x91cb('0x13')][_0x91cb('0x3d')](_0x57e26d[_0x91cb('0x3e')],{})[_0x91cb('0xd')](respondWithResult(_0x461e1e,0xc9))[_0x91cb('0x38')](handleError(_0x461e1e,null));};exports[_0x91cb('0xc')]=function(_0x29d5a1,_0x396b81){if(_0x29d5a1['body']['id']){delete _0x29d5a1[_0x91cb('0x3e')]['id'];}return db[_0x91cb('0x13')][_0x91cb('0x3c')]({'where':{'id':_0x29d5a1[_0x91cb('0x3a')]['id']}})[_0x91cb('0xd')](handleEntityNotFound(_0x396b81,null))[_0x91cb('0xd')](saveUpdates(_0x29d5a1[_0x91cb('0x3e')],null))[_0x91cb('0xd')](respondWithResult(_0x396b81,null))['catch'](handleError(_0x396b81,null));};exports[_0x91cb('0x3f')]=function(_0x46caf1,_0x2b8b7f){return db[_0x91cb('0x13')]['describe']()[_0x91cb('0xd')](respondWithResult(_0x2b8b7f,null))[_0x91cb('0x38')](handleError(_0x2b8b7f,null));};exports['destroy']=function(_0x212473,_0x47cdb7){var _0x2c419b;var _0x4c0acd=_0x212473['params']['id'];return db['CmHopper'][_0x91cb('0x3c')]({'where':{'id':_0x212473[_0x91cb('0x3a')]['id']}})[_0x91cb('0xd')](handleEntityNotFound(_0x47cdb7,null))[_0x91cb('0xd')](function(_0x333814){if(_0x333814){return _0x333814['destroy']()['then'](function(_0x1d26b8){return _0x1d26b8;});}})[_0x91cb('0xd')](function(_0x140994){_0x2c419b=_0x140994;if(_0x140994){if(_0x140994[_0x91cb('0x40')]||_0x140994['CampaignId']){return db[_0x140994['VoiceQueueId']?'VoiceQueue':_0x91cb('0x41')]['find']({'where':{'id':_0x140994[_0x91cb('0x40')]?_0x140994['VoiceQueueId']:_0x140994[_0x91cb('0x42')]},'attributes':['id',_0x91cb('0x11')],'raw':!![]});}}})[_0x91cb('0xd')](function(_0x649976){var _0x1884bc={};if(_0x649976){_[_0x91cb('0x34')](_0x1884bc,_[_0x91cb('0x43')](_0x2c419b[_0x91cb('0x44')],[_0x91cb('0x45'),_0x91cb('0x46'),'id']));_0x1884bc[_0x91cb('0x47')]=0x15;_0x1884bc['statedesc']=_0x91cb('0x48');_0x1884bc[_0x91cb('0x49')]=_0x649976['name'];_0x1884bc[_0x91cb('0x4a')]=_0x212473[_0x91cb('0x4b')]['name'];_0x1884bc[_0x91cb('0x4c')]=_0x212473[_0x91cb('0x4b')]['id'];_0x1884bc[_0x91cb('0x48')]=!![];_0x1884bc[_0x91cb('0x4d')]=moment()[_0x91cb('0x4e')](_0x91cb('0x4f'));_0x1884bc[_0x91cb('0x50')]=_0x2c419b[_0x91cb('0x51')];_0x1884bc[_0x91cb('0x52')]=_0x2c419b[_0x91cb('0x40')]?_0x91cb('0x53'):'ivr';return db[_0x91cb('0x54')]['find']({'where':{'id':_0x1884bc[_0x91cb('0x55')]},'attributes':['firstName',_0x91cb('0x56')]})[_0x91cb('0xd')](function(_0x1986d7){if(!_['isNil'](_0x47cdb7)&&!_[_0x91cb('0x57')](_0x1986d7[_0x91cb('0x58')])){_0x1884bc['calleridname']=_0x1986d7[_0x91cb('0x58')];if(!_[_0x91cb('0x57')](_0x1986d7[_0x91cb('0x56')])){_0x1884bc[_0x91cb('0x59')]+='\x20'+_0x1986d7['lastName'];}}})[_0x91cb('0x5a')](function(){return db[_0x91cb('0x5b')][_0x91cb('0x3d')](_0x1884bc);});}})[_0x91cb('0xd')](function(_0x55a0e3){return db[_0x91cb('0x5c')][_0x91cb('0x5d')]({'where':{'CmHopperId':_0x4c0acd}});})['then'](function(){return _0x47cdb7['status'](0xcc)[_0x91cb('0x5e')]();})['catch'](handleError(_0x47cdb7,null));};exports[_0x91cb('0x5f')]=function(_0x1237fd,_0x5ae0d2){var _0x4f19c8=[];return db[_0x91cb('0x54')]['describe']()[_0x91cb('0xd')](function(_0x961ebf){_0x4f19c8=_[_0x91cb('0x17')](_0x961ebf);return _0x1237fd['user'][_0x91cb('0x60')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x91cb('0x61')},'attributes':['id',_0x91cb('0x62'),_0x91cb('0x63')],'raw':!![]});})[_0x91cb('0xd')](function(_0x483172){if(_0x483172&&_0x483172[_0x91cb('0x2e')]){return db[_0x91cb('0x64')][_0x91cb('0x65')](function(_0x443c72){var _0xaf70c5={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x91cb('0x4e')](_0x91cb('0x4f'))},'VoiceQueueId':{'$in':_[_0x91cb('0x66')](_0x483172,'id')},'$or':[{'UserId':null},{'UserId':_0x1237fd[_0x91cb('0x4b')]['id']}]};var _0x2e4978={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x483172)[_0x91cb('0x67')]([_0x91cb('0x63'),0x0])['map']('id')[_0x91cb('0x68')]()},'$or':[{'UserId':null},{'UserId':_0x1237fd[_0x91cb('0x4b')]['id']}]};var _0x474682={'$or':[_0xaf70c5,_0x2e4978]};var _0x51ab8a=[];if(_0x1237fd[_0x91cb('0x3e')][_0x91cb('0x69')]&&_0x1237fd[_0x91cb('0x3e')]['direction']===_0x91cb('0x6a')){if(!_['isEmpty'](_0x1237fd[_0x91cb('0x3e')][_0x91cb('0x6b')])){_0x474682['id']={'$in':_0x1237fd[_0x91cb('0x3e')][_0x91cb('0x6b')]};}_0x51ab8a=[['priority',_0x91cb('0x6c')],[_0x91cb('0x6d'),_0x483172[0x0][_0x91cb('0x62')]===_0x91cb('0x6c')?_0x91cb('0x6e'):_0x91cb('0x6c')],db['sequelize'][_0x91cb('0x6f')](_0x91cb('0x70')),['id',_0x91cb('0x6e')]];}else{if(!_[_0x91cb('0x71')](_0x1237fd[_0x91cb('0x3e')][_0x91cb('0x6b')])){_0x474682['id']={'$notIn':_0x1237fd[_0x91cb('0x3e')][_0x91cb('0x6b')]};}_0x51ab8a=[[_0x91cb('0x72'),_0x91cb('0x6e')],[_0x91cb('0x6d'),_0x483172[0x0][_0x91cb('0x62')]],db[_0x91cb('0x64')][_0x91cb('0x6f')](_0x91cb('0x73')),['id',_0x91cb('0x6c')]];}return db[_0x91cb('0x13')]['findOne']({'attributes':['id',_0x91cb('0x74'),_0x91cb('0x51'),'recallme'],'where':_0x474682,'order':_0x51ab8a,'transaction':_0x443c72,'lock':_0x443c72[_0x91cb('0x75')][_0x91cb('0x76')],'include':[{'model':db[_0x91cb('0x54')],'as':'Contact','attributes':_0x4f19c8,'include':[{'model':db[_0x91cb('0x77')],'as':_0x91cb('0x78'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x91cb('0x79'),'attributes':['id','name']},{'model':db[_0x91cb('0x7a')],'as':_0x91cb('0x7b'),'attributes':['id','name',_0x91cb('0x7c')]}]})['then'](function(_0x2c44ca){if(_0x2c44ca){return _0x2c44ca[_0x91cb('0xc')]({'UserId':_0x1237fd['user']['id']},{'transaction':_0x443c72});}});});}})['then'](handleEntityNotFound(_0x5ae0d2,null))[_0x91cb('0xd')](respondWithResult(_0x5ae0d2,null))[_0x91cb('0x38')](handleError(_0x5ae0d2,null));};exports[_0x91cb('0x7d')]=function(_0x4b5bea,_0x154014,_0x23a458){var _0x98fb94=[];var _0x127b93=_0x4b5bea['params']['id'];var _0x440209=_0x4b5bea['user']['id'];return db[_0x91cb('0x54')][_0x91cb('0x3f')]()[_0x91cb('0xd')](function(_0x281eda){_0x98fb94=_['keys'](_0x281eda);return db['sequelize'][_0x91cb('0x65')](function(_0x4a4b00){const _0x2f8c2d={'id':_0x127b93};return db[_0x91cb('0x13')][_0x91cb('0x7e')]({'attributes':['id',_0x91cb('0x74'),_0x91cb('0x7f')],'where':_0x2f8c2d,'transaction':_0x4a4b00,'lock':_0x4a4b00[_0x91cb('0x75')][_0x91cb('0x76')],'include':[{'model':db['CmContact'],'as':_0x91cb('0x80'),'attributes':_0x98fb94,'include':[{'model':db[_0x91cb('0x77')],'as':'Company','attributes':['id',_0x91cb('0x11')]}]},{'model':db['CmList'],'as':_0x91cb('0x79'),'attributes':['id',_0x91cb('0x11')]},{'model':db[_0x91cb('0x7a')],'as':_0x91cb('0x7b'),'attributes':['id',_0x91cb('0x11'),_0x91cb('0x7c')]}]})[_0x91cb('0xd')](function(_0x30259d){if(_0x30259d){return _0x30259d[_0x91cb('0xc')]({'UserId':_0x440209},{'transaction':_0x4a4b00});}});});})[_0x91cb('0xd')](handleEntityNotFound(_0x154014,null))[_0x91cb('0xd')](respondWithResult(_0x154014,null))[_0x91cb('0x38')](handleError(_0x154014,null));};exports[_0x91cb('0x81')]=function(_0x14882d,_0x22ba54){return _0x14882d[_0x91cb('0x4b')]['getVoiceQueues']({'where':{'type':_0x91cb('0x82'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x91cb('0xd')](function(_0x123d72){if(_0x123d72&&_0x123d72[_0x91cb('0x2e')]){return db[_0x91cb('0x13')][_0x91cb('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x91cb('0x4e')](_0x91cb('0x4f'))},'VoiceQueueId':{'$in':_[_0x91cb('0x66')](_0x123d72,'id')},'$or':[{'UserId':null},{'UserId':_0x14882d['user']['id']}]}});}return 0x0;})[_0x91cb('0xd')](function(_0xdee7f){if(!_['isNil'](_0xdee7f)&&_['isNumber'](_0xdee7f)){return _0x22ba54[_0x91cb('0x5')](0xc8)['json']({'contacts':_0xdee7f});}else{logger['error'](_0x91cb('0x83'),'getOpenContacts',0x194,_0x91cb('0x84'));_0x22ba54['sendStatus'](0x194);}})[_0x91cb('0x38')](handleError(_0x22ba54,null));};exports[_0x91cb('0x85')]=function(_0x45a8e1,_0x443c01){var _0x4e899c=shared[_0x91cb('0x86')];var _0x1b5137=[];_[_0x91cb('0x66')](_0x4e899c,function(_0x427afd){_0x1b5137[_0x91cb('0x87')]({'id':_0x427afd[_0x91cb('0x11')],'name':_0x427afd[_0x91cb('0x11')],'utcOffset':_0x427afd[_0x91cb('0x88')]});});return _0x443c01[_0x91cb('0x5')](0xc8)[_0x91cb('0x6')]({'tz':_0x1b5137});};exports[_0x91cb('0x89')]=function(_0x32704d,_0x422293){var _0x18c526=shared[_0x91cb('0x86')];var _0x3356de={};if(!_[_0x91cb('0x57')](_0x18c526[_0x32704d[_0x91cb('0x3e')]['id']]))_0x3356de=_0x18c526[_0x32704d[_0x91cb('0x3e')]['id']];return _0x422293[_0x91cb('0x5')](0xc8)[_0x91cb('0x6')](_0x3356de);}; \ No newline at end of file +var _0xf120=['$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','keys','rawAttributes','intersection','includeAll','find','create','body','describe','destroy','params','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','length','sequelize','transaction','filter','value','direction','prev','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','findOne','Company','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','CmHopper','fieldName','type','key','map','query','filters','model','concat','$or','$lte','$ne','$eq','$not'];(function(_0x6d4d11,_0x204d60){var _0x49c1f3=function(_0x219253){while(--_0x219253){_0x6d4d11['push'](_0x6d4d11['shift']());}};_0x49c1f3(++_0x204d60);}(_0xf120,0x179));var _0x0f12=function(_0x1ac0c9,_0x3575e9){_0x1ac0c9=_0x1ac0c9-0x0;var _0x5b60e6=_0xf120[_0x1ac0c9];return _0x5b60e6;};'use strict';var moment=require('moment');var _=require(_0x0f12('0x0'));var qs=require(_0x0f12('0x1'));var logger=require(_0x0f12('0x2'))('api');var shared=require(_0x0f12('0x3'));var db=require(_0x0f12('0x4'))['db'];function respondWithResult(_0x163c58,_0x5a263b){_0x5a263b=_0x5a263b||0xc8;return function(_0x1a4043){if(_0x1a4043){return _0x163c58[_0x0f12('0x5')](_0x5a263b)[_0x0f12('0x6')](_0x1a4043);}};}function respondWithFilteredResult(_0x308941,_0x21f951){return function(_0x341516){if(_0x341516){var _0x1f32b7=typeof _0x21f951[_0x0f12('0x7')]==='undefined'&&typeof _0x21f951[_0x0f12('0x8')]==='undefined';var _0x3b909b=_0x341516[_0x0f12('0x9')];var _0x45a714=_0x1f32b7?0x0:_0x21f951['offset'];var _0x5f158a=_0x1f32b7?_0x341516[_0x0f12('0x9')]:_0x21f951[_0x0f12('0x7')]+_0x21f951[_0x0f12('0x8')];var _0xd85187;if(_0x5f158a>=_0x3b909b){_0x5f158a=_0x3b909b;_0xd85187=0xc8;}else{_0xd85187=0xce;}_0x308941[_0x0f12('0x5')](_0xd85187);return _0x308941[_0x0f12('0xa')](_0x0f12('0xb'),_0x45a714+'-'+_0x5f158a+'/'+_0x3b909b)['json'](_0x341516);}return null;};}function saveUpdates(_0xf75042,_0x11a236){return function(_0xb80905){if(_0xb80905){return _0xb80905[_0x0f12('0xc')](_0xf75042)[_0x0f12('0xd')](function(_0xc019be){return _0xc019be;});}return null;};}function handleEntityNotFound(_0x35ef6f,_0x7f1ae7){return function(_0x215a7a){if(!_0x215a7a){_0x35ef6f[_0x0f12('0xe')](0x194);}return _0x215a7a;};}function handleError(_0x23adc0,_0x3f2716){_0x3f2716=_0x3f2716||0x1f4;return function(_0xe61624){logger[_0x0f12('0xf')](_0xe61624[_0x0f12('0x10')]);if(_0xe61624['name']){delete _0xe61624[_0x0f12('0x11')];}_0x23adc0['status'](_0x3f2716)[_0x0f12('0x12')](_0xe61624);};}exports[_0x0f12('0x13')]=function(_0x28119e,_0x12eb6c){var _0x60daff={},_0xa2168f={},_0x5f4290={'count':0x0,'rows':[]};var _0x2fdc6c=_['map'](db[_0x0f12('0x14')]['rawAttributes'],function(_0x4867c8){return{'name':_0x4867c8[_0x0f12('0x15')],'type':_0x4867c8[_0x0f12('0x16')][_0x0f12('0x17')]};});_0xa2168f['model']=_[_0x0f12('0x18')](_0x2fdc6c,'name');_0xa2168f[_0x0f12('0x19')]=_['keys'](_0x28119e[_0x0f12('0x19')]);_0xa2168f[_0x0f12('0x1a')]=_['intersection'](_0xa2168f[_0x0f12('0x1b')],_0xa2168f[_0x0f12('0x19')]);_0xa2168f[_0x0f12('0x1a')]=_[_0x0f12('0x1c')](_0xa2168f[_0x0f12('0x1a')],['$and',_0x0f12('0x1d'),'$gt','$gte','$lt',_0x0f12('0x1e'),_0x0f12('0x1f'),_0x0f12('0x20'),_0x0f12('0x21'),'$between',_0x0f12('0x22'),_0x0f12('0x23'),_0x0f12('0x24'),'$like',_0x0f12('0x25'),_0x0f12('0x26'),_0x0f12('0x27'),'$like',_0x0f12('0x28'),_0x0f12('0x29'),_0x0f12('0x2a'),_0x0f12('0x2b')]);_0x60daff[_0x0f12('0x2c')]=_['intersection'](_0xa2168f['model'],qs[_0x0f12('0x2d')](_0x28119e['query'][_0x0f12('0x2d')]));_0x60daff[_0x0f12('0x2c')]=_0x60daff[_0x0f12('0x2c')]['length']?_0x60daff[_0x0f12('0x2c')]:_0xa2168f[_0x0f12('0x1b')];if(!_0x28119e[_0x0f12('0x19')][_0x0f12('0x2e')](_0x0f12('0x2f'))){_0x60daff[_0x0f12('0x8')]=qs['limit'](_0x28119e[_0x0f12('0x19')][_0x0f12('0x8')]);_0x60daff[_0x0f12('0x7')]=qs['offset'](_0x28119e[_0x0f12('0x19')][_0x0f12('0x7')]);}_0x60daff[_0x0f12('0x30')]=qs[_0x0f12('0x31')](_0x28119e['query'][_0x0f12('0x31')]);_0x60daff[_0x0f12('0x32')]=qs[_0x0f12('0x1a')](_[_0x0f12('0x33')](_0x28119e[_0x0f12('0x19')],_0xa2168f[_0x0f12('0x1a')]),_0x2fdc6c);if(_0x28119e[_0x0f12('0x19')]['filter']){_0x60daff[_0x0f12('0x32')]=_[_0x0f12('0x34')](_0x60daff['where'],{'$or':_[_0x0f12('0x18')](_0x2fdc6c,function(_0x40715e){if(_0x40715e['type']!==_0x0f12('0x35')){var _0x2ca92b={};_0x2ca92b[_0x40715e['name']]={'$like':'%'+_0x28119e[_0x0f12('0x19')]['filter']+'%'};return _0x2ca92b;}})});}_0x60daff=_[_0x0f12('0x34')]({},_0x60daff,_0x28119e[_0x0f12('0x36')]);var _0x2ed69c={'where':_0x60daff[_0x0f12('0x32')]};return db[_0x0f12('0x14')][_0x0f12('0x9')](_0x2ed69c)[_0x0f12('0xd')](function(_0x1d48a7){_0x5f4290[_0x0f12('0x9')]=_0x1d48a7;if(_0x28119e[_0x0f12('0x19')]['includeAll']){_0x60daff[_0x0f12('0x37')]=[{'all':!![]}];}return db[_0x0f12('0x14')][_0x0f12('0x38')](_0x60daff);})['then'](function(_0x5bea02){_0x5f4290['rows']=_0x5bea02;return _0x5f4290;})[_0x0f12('0xd')](respondWithFilteredResult(_0x12eb6c,_0x60daff))[_0x0f12('0x39')](handleError(_0x12eb6c,null));};exports['show']=function(_0x4bf268,_0x21be62){var _0x1a43c6={'raw':!![],'where':{'id':_0x4bf268['params']['id']}},_0x3acc80={};_0x3acc80[_0x0f12('0x1b')]=_[_0x0f12('0x3a')](db['CmHopper'][_0x0f12('0x3b')]);_0x3acc80[_0x0f12('0x19')]=_[_0x0f12('0x3a')](_0x4bf268[_0x0f12('0x19')]);_0x3acc80[_0x0f12('0x1a')]=_[_0x0f12('0x3c')](_0x3acc80[_0x0f12('0x1b')],_0x3acc80['query']);_0x1a43c6[_0x0f12('0x2c')]=_['intersection'](_0x3acc80[_0x0f12('0x1b')],qs[_0x0f12('0x2d')](_0x4bf268['query'][_0x0f12('0x2d')]));_0x1a43c6[_0x0f12('0x2c')]=_0x1a43c6[_0x0f12('0x2c')]['length']?_0x1a43c6['attributes']:_0x3acc80[_0x0f12('0x1b')];if(_0x4bf268[_0x0f12('0x19')][_0x0f12('0x3d')]){_0x1a43c6[_0x0f12('0x37')]=[{'all':!![]}];}_0x1a43c6=_['merge']({},_0x1a43c6,_0x4bf268[_0x0f12('0x36')]);return db[_0x0f12('0x14')][_0x0f12('0x3e')](_0x1a43c6)[_0x0f12('0xd')](handleEntityNotFound(_0x21be62,null))['then'](respondWithResult(_0x21be62,null))[_0x0f12('0x39')](handleError(_0x21be62,null));};exports[_0x0f12('0x3f')]=function(_0x54ec90,_0x4b7599){return db[_0x0f12('0x14')][_0x0f12('0x3f')](_0x54ec90[_0x0f12('0x40')],{})['then'](respondWithResult(_0x4b7599,0xc9))['catch'](handleError(_0x4b7599,null));};exports[_0x0f12('0xc')]=function(_0x108ade,_0x569c2f){if(_0x108ade[_0x0f12('0x40')]['id']){delete _0x108ade['body']['id'];}return db[_0x0f12('0x14')][_0x0f12('0x3e')]({'where':{'id':_0x108ade['params']['id']}})['then'](handleEntityNotFound(_0x569c2f,null))[_0x0f12('0xd')](saveUpdates(_0x108ade[_0x0f12('0x40')],null))[_0x0f12('0xd')](respondWithResult(_0x569c2f,null))[_0x0f12('0x39')](handleError(_0x569c2f,null));};exports[_0x0f12('0x41')]=function(_0x2f561c,_0x294314){return db[_0x0f12('0x14')]['describe']()[_0x0f12('0xd')](respondWithResult(_0x294314,null))['catch'](handleError(_0x294314,null));};exports[_0x0f12('0x42')]=function(_0x52f1c2,_0x4add76){var _0xbbacc1;var _0x5cfd51=_0x52f1c2[_0x0f12('0x43')]['id'];return db[_0x0f12('0x14')][_0x0f12('0x3e')]({'where':{'id':_0x52f1c2[_0x0f12('0x43')]['id']}})['then'](handleEntityNotFound(_0x4add76,null))[_0x0f12('0xd')](function(_0x90f918){if(_0x90f918){return _0x90f918[_0x0f12('0x42')]()[_0x0f12('0xd')](function(_0x48acec){return _0x48acec;});}})['then'](function(_0x122a57){_0xbbacc1=_0x122a57;if(_0x122a57){if(_0x122a57[_0x0f12('0x44')]||_0x122a57[_0x0f12('0x45')]){return db[_0x122a57[_0x0f12('0x44')]?_0x0f12('0x46'):'Campaign']['find']({'where':{'id':_0x122a57['VoiceQueueId']?_0x122a57[_0x0f12('0x44')]:_0x122a57[_0x0f12('0x45')]},'attributes':['id',_0x0f12('0x11')],'raw':!![]});}}})[_0x0f12('0xd')](function(_0x18c68b){var _0x33af1f={};if(_0x18c68b){_[_0x0f12('0x34')](_0x33af1f,_[_0x0f12('0x47')](_0xbbacc1[_0x0f12('0x48')],[_0x0f12('0x49'),_0x0f12('0x4a'),'id']));_0x33af1f['state']=0x15;_0x33af1f[_0x0f12('0x4b')]=_0x0f12('0x4c');_0x33af1f[_0x0f12('0x4d')]=_0x18c68b[_0x0f12('0x11')];_0x33af1f['membername']=_0x52f1c2['user'][_0x0f12('0x11')];_0x33af1f[_0x0f12('0x4e')]=_0x52f1c2[_0x0f12('0x4f')]['id'];_0x33af1f[_0x0f12('0x4c')]=!![];_0x33af1f[_0x0f12('0x50')]=moment()[_0x0f12('0x51')](_0x0f12('0x52'));_0x33af1f[_0x0f12('0x53')]=_0xbbacc1['phone'];_0x33af1f[_0x0f12('0x54')]=_0xbbacc1[_0x0f12('0x44')]?'queue':_0x0f12('0x55');return db[_0x0f12('0x56')][_0x0f12('0x3e')]({'where':{'id':_0x33af1f['ContactId']},'attributes':[_0x0f12('0x57'),_0x0f12('0x58')]})[_0x0f12('0xd')](function(_0x2ca6bb){if(!_[_0x0f12('0x59')](_0x4add76)&&!_['isNil'](_0x2ca6bb[_0x0f12('0x57')])){_0x33af1f['calleridname']=_0x2ca6bb[_0x0f12('0x57')];if(!_['isNil'](_0x2ca6bb[_0x0f12('0x58')])){_0x33af1f[_0x0f12('0x5a')]+='\x20'+_0x2ca6bb['lastName'];}}})[_0x0f12('0x5b')](function(){return db[_0x0f12('0x5c')]['create'](_0x33af1f);});}})[_0x0f12('0xd')](function(_0x5498aa){return db[_0x0f12('0x5d')]['destroy']({'where':{'CmHopperId':_0x5cfd51}});})[_0x0f12('0xd')](function(){return _0x4add76[_0x0f12('0x5')](0xcc)[_0x0f12('0x5e')]();})['catch'](handleError(_0x4add76,null));};exports[_0x0f12('0x5f')]=function(_0x2df09e,_0x2cc2d6){var _0x5cf716=[];return db[_0x0f12('0x56')][_0x0f12('0x41')]()['then'](function(_0x155ead){_0x5cf716=_[_0x0f12('0x3a')](_0x155ead);return _0x2df09e['user'][_0x0f12('0x60')]({'where':{'type':_0x0f12('0x61'),'dialActive':!![],'dialMethod':_0x0f12('0x62')},'attributes':['id',_0x0f12('0x63'),_0x0f12('0x64')],'raw':!![]});})[_0x0f12('0xd')](function(_0x9b2714){if(_0x9b2714&&_0x9b2714[_0x0f12('0x65')]){return db[_0x0f12('0x66')][_0x0f12('0x67')](function(_0x13db9c){var _0x2f3392={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x0f12('0x52'))},'VoiceQueueId':{'$in':_[_0x0f12('0x18')](_0x9b2714,'id')},'$or':[{'UserId':null},{'UserId':_0x2df09e[_0x0f12('0x4f')]['id']}]};var _0x1f6c14={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x9b2714)[_0x0f12('0x68')](['dialPreviewAutoRecallMe',0x0])[_0x0f12('0x18')]('id')[_0x0f12('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x2df09e[_0x0f12('0x4f')]['id']}]};var _0x5967c2={'$or':[_0x2f3392,_0x1f6c14]};var _0x128af9=[];if(_0x2df09e['body'][_0x0f12('0x6a')]&&_0x2df09e[_0x0f12('0x40')][_0x0f12('0x6a')]===_0x0f12('0x6b')){if(!_['isEmpty'](_0x2df09e[_0x0f12('0x40')]['hopperIds'])){_0x5967c2['id']={'$in':_0x2df09e[_0x0f12('0x40')][_0x0f12('0x6c')]};}_0x128af9=[['priority',_0x0f12('0x6d')],[_0x0f12('0x6e'),_0x9b2714[0x0][_0x0f12('0x63')]===_0x0f12('0x6d')?_0x0f12('0x6f'):_0x0f12('0x6d')],db['sequelize'][_0x0f12('0x70')](_0x0f12('0x71')),['id',_0x0f12('0x6f')]];}else{if(!_[_0x0f12('0x72')](_0x2df09e[_0x0f12('0x40')][_0x0f12('0x6c')])){_0x5967c2['id']={'$notIn':_0x2df09e[_0x0f12('0x40')][_0x0f12('0x6c')]};}_0x128af9=[[_0x0f12('0x73'),_0x0f12('0x6f')],[_0x0f12('0x6e'),_0x9b2714[0x0]['dialOrderByScheduledAt']],db[_0x0f12('0x66')]['literal'](_0x0f12('0x74')),['id',_0x0f12('0x6d')]];}return db[_0x0f12('0x14')]['findOne']({'attributes':['id',_0x0f12('0x75'),_0x0f12('0x76'),_0x0f12('0x77')],'where':_0x5967c2,'order':_0x128af9,'transaction':_0x13db9c,'lock':_0x13db9c[_0x0f12('0x78')][_0x0f12('0x79')],'include':[{'model':db[_0x0f12('0x56')],'as':_0x0f12('0x7a'),'attributes':_0x5cf716,'include':[{'model':db[_0x0f12('0x7b')],'as':'Company','attributes':['id',_0x0f12('0x11')]}]},{'model':db[_0x0f12('0x7c')],'as':_0x0f12('0x7d'),'attributes':['id',_0x0f12('0x11')]},{'model':db[_0x0f12('0x46')],'as':_0x0f12('0x7e'),'attributes':['id',_0x0f12('0x11'),_0x0f12('0x7f')]}]})[_0x0f12('0xd')](function(_0x498966){if(_0x498966){return _0x498966['update']({'UserId':_0x2df09e[_0x0f12('0x4f')]['id']},{'transaction':_0x13db9c});}});});}})[_0x0f12('0xd')](handleEntityNotFound(_0x2cc2d6,null))[_0x0f12('0xd')](respondWithResult(_0x2cc2d6,null))[_0x0f12('0x39')](handleError(_0x2cc2d6,null));};exports['getPreviewRecall']=function(_0x3a169b,_0x1557db,_0x3567db){var _0x5a3255=[];var _0x8e211=_0x3a169b[_0x0f12('0x43')]['id'];var _0xd18662=_0x3a169b[_0x0f12('0x4f')]['id'];return db[_0x0f12('0x56')][_0x0f12('0x41')]()['then'](function(_0x2981db){_0x5a3255=_[_0x0f12('0x3a')](_0x2981db);return db[_0x0f12('0x66')]['transaction'](function(_0x2cc0b7){const _0x1b28c2={'id':_0x8e211};return db[_0x0f12('0x14')][_0x0f12('0x80')]({'attributes':['id',_0x0f12('0x75'),_0x0f12('0x77')],'where':_0x1b28c2,'transaction':_0x2cc0b7,'lock':_0x2cc0b7['LOCK'][_0x0f12('0x79')],'include':[{'model':db[_0x0f12('0x56')],'as':'Contact','attributes':_0x5a3255,'include':[{'model':db[_0x0f12('0x7b')],'as':_0x0f12('0x81'),'attributes':['id',_0x0f12('0x11')]}]},{'model':db[_0x0f12('0x7c')],'as':_0x0f12('0x7d'),'attributes':['id',_0x0f12('0x11')]},{'model':db[_0x0f12('0x46')],'as':_0x0f12('0x7e'),'attributes':['id','name','dialActive']}]})[_0x0f12('0xd')](function(_0x1782a9){if(_0x1782a9){return _0x1782a9[_0x0f12('0xc')]({'UserId':_0xd18662},{'transaction':_0x2cc0b7});}});});})[_0x0f12('0xd')](handleEntityNotFound(_0x1557db,null))['then'](respondWithResult(_0x1557db,null))['catch'](handleError(_0x1557db,null));};exports[_0x0f12('0x82')]=function(_0x310af3,_0x597a9b){return _0x310af3[_0x0f12('0x4f')]['getVoiceQueues']({'where':{'type':_0x0f12('0x61'),'dialActive':!![],'dialMethod':_0x0f12('0x62')},'attributes':['id'],'raw':!![]})[_0x0f12('0xd')](function(_0x4ec86a){if(_0x4ec86a&&_0x4ec86a[_0x0f12('0x65')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0f12('0x51')](_0x0f12('0x52'))},'VoiceQueueId':{'$in':_['map'](_0x4ec86a,'id')},'$or':[{'UserId':null},{'UserId':_0x310af3[_0x0f12('0x4f')]['id']}]}});}return 0x0;})[_0x0f12('0xd')](function(_0x130b70){if(!_[_0x0f12('0x59')](_0x130b70)&&_['isNumber'](_0x130b70)){return _0x597a9b[_0x0f12('0x5')](0xc8)[_0x0f12('0x6')]({'contacts':_0x130b70});}else{logger[_0x0f12('0xf')](_0x0f12('0x83'),_0x0f12('0x82'),0x194,_0x0f12('0x84'));_0x597a9b['sendStatus'](0x194);}})[_0x0f12('0x39')](handleError(_0x597a9b,null));};exports[_0x0f12('0x85')]=function(_0x3093a0,_0x57b290){var _0x4c2c6e=shared[_0x0f12('0x86')];var _0x169fbb=[];_[_0x0f12('0x18')](_0x4c2c6e,function(_0x10e218){_0x169fbb[_0x0f12('0x87')]({'id':_0x10e218[_0x0f12('0x11')],'name':_0x10e218[_0x0f12('0x11')],'utcOffset':_0x10e218[_0x0f12('0x88')]});});return _0x57b290[_0x0f12('0x5')](0xc8)[_0x0f12('0x6')]({'tz':_0x169fbb});};exports['getTimezone']=function(_0x259652,_0x1c0610){var _0x404bc7=shared[_0x0f12('0x86')];var _0x322067={};if(!_[_0x0f12('0x59')](_0x404bc7[_0x259652[_0x0f12('0x40')]['id']]))_0x322067=_0x404bc7[_0x259652[_0x0f12('0x40')]['id']];return _0x1c0610[_0x0f12('0x5')](0xc8)['json'](_0x322067);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index cac6630..9239da3 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 _0x7c09=['scheduledat','phone','priority','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x9a9995,_0x4f1f77){var _0x48c8f1=function(_0x49a70c){while(--_0x49a70c){_0x9a9995['push'](_0x9a9995['shift']());}};_0x48c8f1(++_0x4f1f77);}(_0x7c09,0x102));var _0x97c0=function(_0x2ff287,_0x1a9180){_0x2ff287=_0x2ff287-0x0;var _0x1099a4=_0x7c09[_0x2ff287];return _0x1099a4;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'name':_0x97c0('0xc'),'fields':[_0x97c0('0xc')]},{'name':'phone','fields':[_0x97c0('0xd')]},{'name':'priority','fields':[_0x97c0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x426ff1,_0xd23e7){_0x426ff1=_0x426ff1-0x0;var _0x2638bb=_0xb4c7[_0x426ff1];return _0x2638bb;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('CmHopper',attributes,{'tableName':_0x7b4c('0xb'),'paranoid':![],'indexes':[{'name':_0x7b4c('0xc'),'fields':['scheduledat']},{'name':_0x7b4c('0xd'),'fields':[_0x7b4c('0xd')]},{'name':_0x7b4c('0xe'),'fields':[_0x7b4c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 34963cb..9b56a55 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 _0x9fc0=['active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','order','UPDATE','CmContact','Contact','keys','Agent','name','voicePause','UserId','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','create','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','LOCK','length','all','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','lodash','util','bluebird','../../mysqldb','rpc','GetCmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','catch','error','message','CmHopper','find','info','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update'];(function(_0x5430a5,_0x4d613f){var _0x96a99f=function(_0x29c08d){while(--_0x29c08d){_0x5430a5['push'](_0x5430a5['shift']());}};_0x96a99f(++_0x4d613f);}(_0x9fc0,0xd3));var _0x09fc=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x9fc0[_0x43c8b8];return _0x413be3;};'use strict';var _=require(_0x09fc('0x0'));var util=require(_0x09fc('0x1'));var moment=require('moment');var BPromise=require(_0x09fc('0x2'));var db=require(_0x09fc('0x3'))['db'];var logger=require('../../config/logger')(_0x09fc('0x4'));exports[_0x09fc('0x5')]=function(_0x1a3b84){var _0x369c90=this;return new Promise(function(_0x4cb1e7,_0x29a4cf){return db['CmHopper'][_0x09fc('0x6')]({'raw':_0x1a3b84[_0x09fc('0x7')]?_0x1a3b84[_0x09fc('0x7')][_0x09fc('0x8')]===undefined?!![]:![]:!![],'where':_0x1a3b84[_0x09fc('0x7')]?_0x1a3b84[_0x09fc('0x7')][_0x09fc('0x9')]||null:null,'attributes':_0x1a3b84[_0x09fc('0x7')]?_0x1a3b84[_0x09fc('0x7')][_0x09fc('0xa')]||null:null,'limit':_0x1a3b84[_0x09fc('0x7')]?_0x1a3b84['options'][_0x09fc('0xb')]||null:null,'include':_0x1a3b84[_0x09fc('0x7')]?_0x1a3b84['options'][_0x09fc('0xc')]?_[_0x09fc('0xd')](_0x1a3b84[_0x09fc('0x7')][_0x09fc('0xc')],function(_0x56655b){return{'model':db[_0x56655b[_0x09fc('0xe')]],'as':_0x56655b['as'],'attributes':_0x56655b[_0x09fc('0xa')],'include':_0x56655b[_0x09fc('0xc')]?_[_0x09fc('0xd')](_0x56655b[_0x09fc('0xc')],function(_0x565843){return{'model':db[_0x565843['model']],'as':_0x565843['as'],'attributes':_0x565843[_0x09fc('0xa')],'include':_0x565843[_0x09fc('0xc')]?_['map'](_0x565843[_0x09fc('0xc')],function(_0x2aa71c){return{'model':db[_0x2aa71c[_0x09fc('0xe')]],'as':_0x2aa71c['as'],'attributes':_0x2aa71c['attributes']};}):[]};}):[]};}):[]:[]})[_0x09fc('0xf')](function(_0x5ea6a5){logger['info'](_0x09fc('0x5'),_0x1a3b84);logger[_0x09fc('0x10')](_0x09fc('0x5'),_0x1a3b84,JSON[_0x09fc('0x11')](_0x5ea6a5));_0x4cb1e7(_0x5ea6a5);})[_0x09fc('0x12')](function(_0x4e123e){logger[_0x09fc('0x13')](_0x09fc('0x5'),_0x4e123e[_0x09fc('0x14')],_0x1a3b84);_0x29a4cf(_0x369c90[_0x09fc('0x13')](0x1f4,_0x4e123e['message']));});});};exports['ShowCmHopper']=function(_0x203186){var _0x3a9014=this;return new Promise(function(_0x5a7388,_0x415360){return db[_0x09fc('0x15')][_0x09fc('0x16')]({'raw':_0x203186[_0x09fc('0x7')]?_0x203186[_0x09fc('0x7')][_0x09fc('0x8')]===undefined?!![]:![]:!![],'where':_0x203186['options']?_0x203186[_0x09fc('0x7')][_0x09fc('0x9')]||null:null,'attributes':_0x203186[_0x09fc('0x7')]?_0x203186['options']['attributes']||null:null,'include':_0x203186[_0x09fc('0x7')]?_0x203186['options'][_0x09fc('0xc')]?_['map'](_0x203186['options'][_0x09fc('0xc')],function(_0x3a0898){return{'model':db[_0x3a0898[_0x09fc('0xe')]],'as':_0x3a0898['as'],'attributes':_0x3a0898['attributes'],'include':_0x3a0898[_0x09fc('0xc')]?_[_0x09fc('0xd')](_0x3a0898[_0x09fc('0xc')],function(_0x3d45ba){return{'model':db[_0x3d45ba['model']],'as':_0x3d45ba['as'],'attributes':_0x3d45ba['attributes'],'include':_0x3d45ba[_0x09fc('0xc')]?_[_0x09fc('0xd')](_0x3d45ba[_0x09fc('0xc')],function(_0x2ae383){return{'model':db[_0x2ae383[_0x09fc('0xe')]],'as':_0x2ae383['as'],'attributes':_0x2ae383[_0x09fc('0xa')]};}):[]};}):[]};}):[]:[]})[_0x09fc('0xf')](function(_0x7be0ac){logger[_0x09fc('0x17')](_0x09fc('0x18'),_0x203186);logger['debug']('ShowCmHopper',_0x203186,JSON['stringify'](_0x7be0ac));_0x5a7388(_0x7be0ac);})['catch'](function(_0x477641){logger[_0x09fc('0x13')](_0x09fc('0x18'),_0x477641['message'],_0x203186);_0x415360(_0x3a9014[_0x09fc('0x13')](0x1f4,_0x477641[_0x09fc('0x14')]));});});};exports[_0x09fc('0x19')]=function(_0x5f2511){var _0x4e883e=this;return new Promise(function(_0x236252,_0x1c82bb){return db[_0x09fc('0x15')]['create'](_0x5f2511[_0x09fc('0x1a')],{'raw':_0x5f2511['options']?_0x5f2511['options'][_0x09fc('0x8')]===undefined?!![]:![]:!![]})['then'](function(_0x444a6f){logger[_0x09fc('0x17')](_0x09fc('0x19'),_0x5f2511);logger[_0x09fc('0x10')](_0x09fc('0x19'),_0x5f2511,JSON[_0x09fc('0x11')](_0x444a6f));_0x236252(_0x444a6f);})[_0x09fc('0x12')](function(_0x2fd1e1){logger[_0x09fc('0x13')](_0x09fc('0x19'),_0x2fd1e1[_0x09fc('0x14')],_0x5f2511);_0x1c82bb(_0x4e883e['error'](0x1f4,_0x2fd1e1[_0x09fc('0x14')]));});});};exports[_0x09fc('0x1b')]=function(_0x5c65b6){var _0x31b79d=this;return new Promise(function(_0x5c2f88,_0x25529b){return db[_0x09fc('0x15')][_0x09fc('0x1c')](_0x5c65b6[_0x09fc('0x1a')],{'raw':_0x5c65b6[_0x09fc('0x7')]?_0x5c65b6[_0x09fc('0x7')][_0x09fc('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c65b6['options']?_0x5c65b6[_0x09fc('0x7')][_0x09fc('0x9')]||null:null,'attributes':_0x5c65b6[_0x09fc('0x7')]?_0x5c65b6[_0x09fc('0x7')][_0x09fc('0xa')]||null:null,'limit':_0x5c65b6[_0x09fc('0x7')]?_0x5c65b6[_0x09fc('0x7')][_0x09fc('0xb')]||null:null})[_0x09fc('0xf')](function(_0x4cc5e5){logger['info'](_0x09fc('0x1b'),_0x5c65b6);logger[_0x09fc('0x17')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x5c65b6[_0x09fc('0x7')][_0x09fc('0x9')]),_0x5c65b6[_0x09fc('0x1a')][_0x09fc('0x1d')]);logger['debug']('UpdateCmHopper',_0x5c65b6,JSON[_0x09fc('0x11')](_0x4cc5e5));_0x5c2f88(_0x4cc5e5);})[_0x09fc('0x12')](function(_0x414088){logger['error'](_0x09fc('0x1b'),_0x414088['message'],_0x5c65b6);_0x25529b(_0x31b79d[_0x09fc('0x13')](0x1f4,_0x414088[_0x09fc('0x14')]));});});};exports[_0x09fc('0x1e')]=function(_0x405b99){var _0x2dd85e=this;return new Promise(function(_0x2d1ceb,_0x570c1d){return db[_0x09fc('0x15')][_0x09fc('0x1f')]({'where':_0x405b99['options']?_0x405b99[_0x09fc('0x7')]['where']||null:null})['then'](function(_0x2ceeb4){logger['info'](_0x09fc('0x1e'),_0x405b99);logger[_0x09fc('0x10')](_0x09fc('0x1e'),_0x405b99,JSON['stringify'](_0x2ceeb4));_0x2d1ceb(_0x2ceeb4);})[_0x09fc('0x12')](function(_0x5cf548){logger[_0x09fc('0x13')](_0x09fc('0x1e'),_0x5cf548[_0x09fc('0x14')],_0x405b99);_0x570c1d(_0x2dd85e[_0x09fc('0x13')](0x1f4,_0x5cf548[_0x09fc('0x14')]));});});};exports[_0x09fc('0x20')]=function(_0x1a47fb){var _0x5bc945=this;return new Promise(function(_0x43d5a7,_0x540016){return db['CmContact'][_0x09fc('0x21')]()[_0x09fc('0xf')](function(_0x1bf923){return db[_0x09fc('0x22')][_0x09fc('0x23')](function(_0x1d06e0){return db[_0x09fc('0x15')][_0x09fc('0x6')]({'where':_0x1a47fb[_0x09fc('0x7')]?_0x1a47fb[_0x09fc('0x7')][_0x09fc('0x9')]||null:null,'attributes':_0x1a47fb[_0x09fc('0x7')]?_0x1a47fb[_0x09fc('0x7')][_0x09fc('0xa')]||null:null,'limit':_0x1a47fb[_0x09fc('0x7')]?_0x1a47fb[_0x09fc('0x7')][_0x09fc('0xb')]||null:null,'order':_0x1a47fb[_0x09fc('0x7')]?_0x1a47fb['options'][_0x09fc('0x24')]||null:null,'transaction':_0x1d06e0,'lock':_0x1d06e0['LOCK'][_0x09fc('0x25')],'include':[{'model':db[_0x09fc('0x26')],'as':_0x09fc('0x27'),'attributes':_[_0x09fc('0x28')](_0x1bf923)},{'model':db['User'],'as':_0x09fc('0x29'),'attributes':['id',_0x09fc('0x2a'),_0x09fc('0x2b')]}]})['then'](function(_0xbed6cb){var _0x300332=[];var _0x146c14=[];for(var _0x2e03ce=0x0;_0x2e03ce<_0xbed6cb['length'];_0x2e03ce+=0x1){var _0x5d4742=_0xbed6cb[_0x2e03ce][_0x09fc('0x2c')];if(_0x5d4742===null){_0x300332[_0x09fc('0x2d')](_0xbed6cb[_0x2e03ce][_0x09fc('0x1c')](_0x1a47fb['body'],{'transaction':_0x1d06e0}));}else if(!_0x146c14['includes'](_0x5d4742)){_0x146c14[_0x09fc('0x2d')](_0x5d4742);_0x300332[_0x09fc('0x2d')](_0xbed6cb[_0x2e03ce][_0x09fc('0x1c')](_0x1a47fb[_0x09fc('0x1a')],{'transaction':_0x1d06e0}));}}return BPromise['all'](_0x300332);});})[_0x09fc('0xf')](function(_0x1ae475){logger[_0x09fc('0x17')](_0x09fc('0x20'),_0x1a47fb);if(_0x1ae475['length']>0x0){logger[_0x09fc('0x17')](_0x09fc('0x2e'),_0x1ae475[0x0][_0x09fc('0x2f')]['id'],_0x1ae475[0x0][_0x09fc('0x2f')][_0x09fc('0x30')],_0x1ae475[0x0][_0x09fc('0x2f')][_0x09fc('0x1d')]);}logger[_0x09fc('0x10')](_0x09fc('0x20'),_0x1a47fb,JSON['stringify'](_0x1ae475));_0x43d5a7(_0x1ae475);})['catch'](function(_0x142f0c){logger['error'](_0x09fc('0x20'),_0x142f0c[_0x09fc('0x14')],_0x1a47fb);_0x540016(_0x5bc945['error'](0x1f4,_0x142f0c[_0x09fc('0x14')]));});});});};exports[_0x09fc('0x31')]=function(_0x47ec8e){var _0x4f2648=this;return new Promise(function(_0x5ab107,_0x32f326){return db[_0x09fc('0x22')][_0x09fc('0x23')](function(_0x19dfbc){return db[_0x09fc('0x32')][_0x09fc('0x33')](_0x47ec8e[_0x09fc('0x1a')],{'raw':_0x47ec8e[_0x09fc('0x7')]?_0x47ec8e['options'][_0x09fc('0x8')]===undefined?!![]:![]:!![],'transaction':_0x19dfbc})['then'](function(){logger[_0x09fc('0x17')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x09fc('0x11')](_0x47ec8e[_0x09fc('0x7')]['where']),_0x47ec8e[_0x09fc('0x7')][_0x09fc('0x9')][_0x09fc('0x1d')]);return db[_0x09fc('0x15')][_0x09fc('0x1f')]({'where':_0x47ec8e[_0x09fc('0x7')]?_0x47ec8e[_0x09fc('0x7')][_0x09fc('0x9')]||null:null,'transaction':_0x19dfbc});});})[_0x09fc('0xf')](function(_0x2d2729){logger[_0x09fc('0x17')](_0x09fc('0x31'),_0x47ec8e);logger['debug']('MoveContactManagedDialer',_0x47ec8e,JSON[_0x09fc('0x11')](_0x2d2729));_0x5ab107(_0x2d2729);})[_0x09fc('0x12')](function(_0x1d79c5){logger[_0x09fc('0x13')](_0x09fc('0x31'),_0x1d79c5['message'],_0x47ec8e);_0x32f326(_0x4f2648[_0x09fc('0x13')](0x1f4,_0x1d79c5[_0x09fc('0x14')]));});});};exports['CountReScheduled']=function(_0x5ac5e4){var _0xa1b761=this;return new Promise(function(_0x2452e7,_0x3d7479){return db['CmHopper'][_0x09fc('0x6')]({'raw':_0x5ac5e4[_0x09fc('0x7')]?_0x5ac5e4[_0x09fc('0x7')][_0x09fc('0x8')]===undefined?!![]:![]:!![],'where':_0x5ac5e4[_0x09fc('0x7')]?_0x5ac5e4[_0x09fc('0x7')]['where']||null:null,'attributes':[[db[_0x09fc('0x22')]['fn']('COUNT',db[_0x09fc('0x22')]['fn']('IF',db[_0x09fc('0x22')]['literal'](_0x09fc('0x34')+util[_0x09fc('0x35')](_0x09fc('0x36'),moment()[_0x09fc('0x35')](_0x09fc('0x37')))+_0x09fc('0x38')))),_0x09fc('0x39')]]})[_0x09fc('0xf')](function(_0x506211){logger[_0x09fc('0x17')]('CountReScheduled',_0x5ac5e4);logger['debug'](_0x09fc('0x3a'),_0x5ac5e4,JSON[_0x09fc('0x11')](_0x506211));_0x2452e7(_0x506211);})[_0x09fc('0x12')](function(_0x3bf6c4){logger[_0x09fc('0x13')](_0x09fc('0x3a'),_0x3bf6c4[_0x09fc('0x14')],_0x5ac5e4);_0x3d7479(_0xa1b761[_0x09fc('0x13')](0x1f4,_0x3bf6c4[_0x09fc('0x14')]));});});};exports['GetContactRecallMe']=function(_0xcefb51){var _0x45b0d1=this;return new Promise(function(_0x7e4a9a,_0x488bb5){return db['CmContact'][_0x09fc('0x21')]()['then'](function(){return db[_0x09fc('0x22')][_0x09fc('0x23')](function(_0x3dfdb4){return db[_0x09fc('0x15')][_0x09fc('0x6')]({'where':_0xcefb51['options']?_0xcefb51['options']['where']||null:null,'attributes':_0xcefb51['options']?_0xcefb51[_0x09fc('0x7')][_0x09fc('0xa')]||null:null,'limit':0x1,'order':_0xcefb51[_0x09fc('0x7')]?_0xcefb51[_0x09fc('0x7')][_0x09fc('0x24')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x3dfdb4,'lock':_0x3dfdb4[_0x09fc('0x3b')][_0x09fc('0x25')],'include':_0xcefb51[_0x09fc('0x7')]?_0xcefb51[_0x09fc('0x7')][_0x09fc('0xc')]?_['map'](_0xcefb51[_0x09fc('0x7')]['include'],function(_0x26d57c){return{'model':db[_0x26d57c[_0x09fc('0xe')]],'as':_0x26d57c['as'],'attributes':_0x26d57c['attributes'],'include':_0x26d57c[_0x09fc('0xc')]?_[_0x09fc('0xd')](_0x26d57c[_0x09fc('0xc')],function(_0x28f6c4){return{'model':db[_0x28f6c4['model']],'as':_0x28f6c4['as'],'attributes':_0x28f6c4[_0x09fc('0xa')],'include':_0x28f6c4[_0x09fc('0xc')]?_[_0x09fc('0xd')](_0x28f6c4['include'],function(_0x305a49){return{'model':db[_0x305a49[_0x09fc('0xe')]],'as':_0x305a49['as'],'attributes':_0x305a49['attributes']};}):[]};}):[]};}):[]:[]})[_0x09fc('0xf')](function(_0x8fa1cd){var _0x5a14db=[];for(var _0x187f58=0x0;_0x187f58<_0x8fa1cd[_0x09fc('0x3c')];_0x187f58+=0x1){_0x5a14db[_0x09fc('0x2d')](_0x8fa1cd[_0x187f58][_0x09fc('0x1c')](_0xcefb51[_0x09fc('0x1a')],{'transaction':_0x3dfdb4}));}return BPromise[_0x09fc('0x3d')](_0x5a14db);});})[_0x09fc('0xf')](function(_0xe39fa5){logger[_0x09fc('0x17')]('GetContactRecallMe',_0xcefb51);logger[_0x09fc('0x10')]('GetContactRecallMe',_0xcefb51,JSON['stringify'](_0xe39fa5));_0x7e4a9a(_0xe39fa5);})[_0x09fc('0x12')](function(_0x109836){logger[_0x09fc('0x13')](_0x09fc('0x3e'),_0x109836[_0x09fc('0x14')],_0xcefb51);_0x488bb5(_0x45b0d1[_0x09fc('0x13')](0x1f4,_0x109836[_0x09fc('0x14')]));});});});};exports[_0x09fc('0x3f')]=function(_0x1b07c5){var _0x7fa390=this;return new Promise(function(_0x21eab1,_0x2d9706){db[_0x09fc('0x26')][_0x09fc('0x21')]()[_0x09fc('0xf')](function(_0x5e1c60){return db['CmHopper'][_0x09fc('0x6')]({'raw':_0x1b07c5[_0x09fc('0x7')]?_0x1b07c5[_0x09fc('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x1b07c5[_0x09fc('0x7')]?_0x1b07c5[_0x09fc('0x7')][_0x09fc('0x9')]||null:null,'attributes':_0x1b07c5[_0x09fc('0x7')]?_0x1b07c5[_0x09fc('0x7')]['attributes']||null:null,'limit':_0x1b07c5['options']?_0x1b07c5[_0x09fc('0x7')][_0x09fc('0xb')]||null:null,'include':_0x1b07c5['options']?_0x1b07c5['options'][_0x09fc('0xc')]?_[_0x09fc('0xd')](_0x1b07c5[_0x09fc('0x7')][_0x09fc('0xc')],function(_0x45b44e){return{'model':db[_0x45b44e[_0x09fc('0xe')]],'as':_0x45b44e['as'],'attributes':_0x45b44e['as']===_0x09fc('0x27')?_[_0x09fc('0x28')](_0x5e1c60):_0x45b44e[_0x09fc('0xa')],'include':_0x45b44e[_0x09fc('0xc')]?_['map'](_0x45b44e[_0x09fc('0xc')],function(_0x144045){return{'model':db[_0x144045[_0x09fc('0xe')]],'as':_0x144045['as'],'attributes':_0x144045[_0x09fc('0xa')],'include':_0x144045[_0x09fc('0xc')]?_[_0x09fc('0xd')](_0x144045[_0x09fc('0xc')],function(_0x2974a7){return{'model':db[_0x2974a7[_0x09fc('0xe')]],'as':_0x2974a7['as'],'attributes':_0x2974a7[_0x09fc('0xa')]};}):[]};}):[]};}):[]:[]})[_0x09fc('0xf')](function(_0x9d3ec){logger[_0x09fc('0x17')]('GetCmHopper',_0x1b07c5);logger['debug'](_0x09fc('0x5'),_0x1b07c5,JSON[_0x09fc('0x11')](_0x9d3ec));_0x21eab1(_0x9d3ec);})['catch'](function(_0x58e20b){logger[_0x09fc('0x13')](_0x09fc('0x5'),_0x58e20b[_0x09fc('0x14')],_0x1b07c5);_0x2d9706(_0x7fa390[_0x09fc('0x13')](0x1f4,_0x58e20b[_0x09fc('0x14')]));});});});};exports[_0x09fc('0x40')]=function(_0x3f4508){var _0x265951=this;return new Promise(function(_0x3cd331,_0x3d53ab){return db[_0x09fc('0x26')]['findOne']({'raw':!![],'where':{'phone':_0x3f4508[_0x09fc('0x7')]['where'][_0x09fc('0x41')]},'attributes':['id',_0x09fc('0x42')],'order':[['id',_0x09fc('0x43')]]})['then'](function(_0xd96312){logger[_0x09fc('0x17')](_0x09fc('0x44'),_0x3f4508);logger['debug'](_0x09fc('0x44'),_0x3f4508,JSON[_0x09fc('0x11')](_0xd96312));_0x3cd331(_0xd96312);})['catch'](function(_0x3d1020){logger['error']('getContactByPhone',_0x3d1020['message'],_0x3f4508);_0x3d53ab(_0x265951[_0x09fc('0x13')](0x1f4,_0x3d1020[_0x09fc('0x14')]));});});};exports[_0x09fc('0x45')]=function(_0x5f2ac1){var _0xfcdcbd=this;return new Promise(function(_0x1a5985,_0x2762dc){return db['sequelize'][_0x09fc('0x23')](function(_0x1504f0){var _0x50a8f9=_0x5f2ac1['options']&&_0x5f2ac1['options'][_0x09fc('0x9')]?_0x5f2ac1[_0x09fc('0x7')][_0x09fc('0x9')]:{};return db[_0x09fc('0x15')][_0x09fc('0x1c')](_0x5f2ac1['body'],{'where':_0x50a8f9,'transaction':_0x1504f0})[_0x09fc('0xf')](function(_0x57dd4a){logger['info'](_0x09fc('0x45'),_0x5f2ac1);logger[_0x09fc('0x10')](_0x09fc('0x45'),_0x5f2ac1,JSON[_0x09fc('0x11')](_0x57dd4a));_0x1a5985(_0x57dd4a);})[_0x09fc('0x12')](function(_0x2a990d){logger[_0x09fc('0x13')]('ResetActiveCalls',_0x2a990d['message'],_0x5f2ac1);_0x2762dc(_0xfcdcbd[_0x09fc('0x13')](0x1f4,_0x2a990d['message']));});});});};exports[_0x09fc('0x46')]=function(_0x409725){var _0x179363=this;var _0x102310=_0x409725[_0x09fc('0x1a')]['where'][_0x09fc('0x47')];var _0x196026=_0x409725[_0x09fc('0x1a')]['where'][_0x09fc('0x48')];var _0x5765f4=_0x409725['body'][_0x09fc('0x9')][_0x09fc('0x49')];return new Promise(function(_0xaf0dbb,_0x3f39bb){return db[_0x09fc('0x15')]['findAll']({'where':{'voiceQueueId':{'$in':_0x102310},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x09fc('0x22')][_0x09fc('0x4a')](_0x09fc('0x4b')+_0x196026+_0x09fc('0x4c')),'$gt':db[_0x09fc('0x22')][_0x09fc('0x4a')](_0x09fc('0x4d'))}},'UserId':{'$in':_0x5765f4}},'include':[{'model':db[_0x09fc('0x26')],'as':_0x09fc('0x27')},{'model':db[_0x09fc('0x4e')],'as':_0x09fc('0x29'),'attributes':['id','name','voicePause']},{'model':db[_0x09fc('0x4f')],'as':'List'}]})[_0x09fc('0xf')](function(_0x3ef567){if(_0x3ef567['length']>0x0){return db[_0x09fc('0x22')][_0x09fc('0x23')](function(_0x294951){return db[_0x09fc('0x15')]['update']({'recallmeNotifiedDate':db[_0x09fc('0x22')]['literal'](_0x09fc('0x4d'))},{'where':{'id':{'$in':_[_0x09fc('0xd')](_0x3ef567,'id')}},'transaction':_0x294951})[_0x09fc('0xf')](function(){_0xaf0dbb(_0x3ef567);})[_0x09fc('0x12')](function(_0x229544){logger['error'](_0x09fc('0x46'),_0x229544['message'],_0x409725);_0x3f39bb(_0x179363[_0x09fc('0x13')](0x1f4,_0x229544['message']));});})[_0x09fc('0x12')](function(_0x2b2af1){logger['error'](_0x09fc('0x46'),_0x2b2af1[_0x09fc('0x14')],_0x409725);_0x3f39bb(_0x179363[_0x09fc('0x13')](0x1f4,_0x2b2af1[_0x09fc('0x14')]));});}else{_0xaf0dbb(_0x3ef567);}});});}; \ No newline at end of file +var _0x3a7f=['UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','findAll','LOCK','UPDATE','keys','User','Agent','voicePause','length','UserId','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()','CmList','CmHopperHandlePreviewRecallNotifications','lodash','util','../../config/logger','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','model','map','info','debug','stringify','catch','error','message','ShowCmHopper','find','body','then','CreateCmHopper','update'];(function(_0x4e1f1a,_0x5787f3){var _0x20a493=function(_0x237d4){while(--_0x237d4){_0x4e1f1a['push'](_0x4e1f1a['shift']());}};_0x20a493(++_0x5787f3);}(_0x3a7f,0x113));var _0xf3a7=function(_0x3022ed,_0x483a78){_0x3022ed=_0x3022ed-0x0;var _0x1cd99c=_0x3a7f[_0x3022ed];return _0x1cd99c;};'use strict';var _=require(_0xf3a7('0x0'));var util=require(_0xf3a7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0xf3a7('0x2'))('rpc');exports[_0xf3a7('0x3')]=function(_0x51e633){var _0x240f57=this;return new Promise(function(_0x231479,_0x200813){return db[_0xf3a7('0x4')]['findAll']({'raw':_0x51e633['options']?_0x51e633[_0xf3a7('0x5')][_0xf3a7('0x6')]===undefined?!![]:![]:!![],'where':_0x51e633[_0xf3a7('0x5')]?_0x51e633[_0xf3a7('0x5')][_0xf3a7('0x7')]||null:null,'attributes':_0x51e633[_0xf3a7('0x5')]?_0x51e633[_0xf3a7('0x5')][_0xf3a7('0x8')]||null:null,'limit':_0x51e633[_0xf3a7('0x5')]?_0x51e633[_0xf3a7('0x5')][_0xf3a7('0x9')]||null:null,'include':_0x51e633[_0xf3a7('0x5')]?_0x51e633[_0xf3a7('0x5')][_0xf3a7('0xa')]?_['map'](_0x51e633[_0xf3a7('0x5')][_0xf3a7('0xa')],function(_0x437d63){return{'model':db[_0x437d63[_0xf3a7('0xb')]],'as':_0x437d63['as'],'attributes':_0x437d63[_0xf3a7('0x8')],'include':_0x437d63[_0xf3a7('0xa')]?_[_0xf3a7('0xc')](_0x437d63[_0xf3a7('0xa')],function(_0x2d8787){return{'model':db[_0x2d8787['model']],'as':_0x2d8787['as'],'attributes':_0x2d8787[_0xf3a7('0x8')],'include':_0x2d8787['include']?_[_0xf3a7('0xc')](_0x2d8787[_0xf3a7('0xa')],function(_0xd9be09){return{'model':db[_0xd9be09[_0xf3a7('0xb')]],'as':_0xd9be09['as'],'attributes':_0xd9be09[_0xf3a7('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x307fdc){logger[_0xf3a7('0xd')](_0xf3a7('0x3'),_0x51e633);logger[_0xf3a7('0xe')](_0xf3a7('0x3'),_0x51e633,JSON[_0xf3a7('0xf')](_0x307fdc));_0x231479(_0x307fdc);})[_0xf3a7('0x10')](function(_0x122c54){logger[_0xf3a7('0x11')](_0xf3a7('0x3'),_0x122c54[_0xf3a7('0x12')],_0x51e633);_0x200813(_0x240f57['error'](0x1f4,_0x122c54[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x13')]=function(_0x2bcbe0){var _0x5d5471=this;return new Promise(function(_0x4de002,_0x1de09d){return db['CmHopper'][_0xf3a7('0x14')]({'raw':_0x2bcbe0[_0xf3a7('0x5')]?_0x2bcbe0[_0xf3a7('0x5')][_0xf3a7('0x6')]===undefined?!![]:![]:!![],'where':_0x2bcbe0[_0xf3a7('0x5')]?_0x2bcbe0['options']['where']||null:null,'attributes':_0x2bcbe0[_0xf3a7('0x5')]?_0x2bcbe0[_0xf3a7('0x5')][_0xf3a7('0x8')]||null:null,'include':_0x2bcbe0[_0xf3a7('0x5')]?_0x2bcbe0['options'][_0xf3a7('0xa')]?_['map'](_0x2bcbe0[_0xf3a7('0x5')][_0xf3a7('0xa')],function(_0x1f4e05){return{'model':db[_0x1f4e05['model']],'as':_0x1f4e05['as'],'attributes':_0x1f4e05[_0xf3a7('0x8')],'include':_0x1f4e05[_0xf3a7('0xa')]?_[_0xf3a7('0xc')](_0x1f4e05[_0xf3a7('0xa')],function(_0x16e556){return{'model':db[_0x16e556[_0xf3a7('0xb')]],'as':_0x16e556['as'],'attributes':_0x16e556[_0xf3a7('0x8')],'include':_0x16e556['include']?_[_0xf3a7('0xc')](_0x16e556['include'],function(_0x4ddff2){return{'model':db[_0x4ddff2['model']],'as':_0x4ddff2['as'],'attributes':_0x4ddff2[_0xf3a7('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13b879){logger[_0xf3a7('0xd')](_0xf3a7('0x13'),_0x2bcbe0);logger['debug'](_0xf3a7('0x13'),_0x2bcbe0,JSON[_0xf3a7('0xf')](_0x13b879));_0x4de002(_0x13b879);})[_0xf3a7('0x10')](function(_0x3cba20){logger[_0xf3a7('0x11')](_0xf3a7('0x13'),_0x3cba20[_0xf3a7('0x12')],_0x2bcbe0);_0x1de09d(_0x5d5471[_0xf3a7('0x11')](0x1f4,_0x3cba20['message']));});});};exports['CreateCmHopper']=function(_0x2e97e2){var _0x4403bd=this;return new Promise(function(_0x57fefd,_0x43d178){return db[_0xf3a7('0x4')]['create'](_0x2e97e2[_0xf3a7('0x15')],{'raw':_0x2e97e2[_0xf3a7('0x5')]?_0x2e97e2[_0xf3a7('0x5')]['raw']===undefined?!![]:![]:!![]})[_0xf3a7('0x16')](function(_0x2b0002){logger['info']('CreateCmHopper',_0x2e97e2);logger[_0xf3a7('0xe')](_0xf3a7('0x17'),_0x2e97e2,JSON[_0xf3a7('0xf')](_0x2b0002));_0x57fefd(_0x2b0002);})['catch'](function(_0x4dc36f){logger[_0xf3a7('0x11')](_0xf3a7('0x17'),_0x4dc36f[_0xf3a7('0x12')],_0x2e97e2);_0x43d178(_0x4403bd[_0xf3a7('0x11')](0x1f4,_0x4dc36f[_0xf3a7('0x12')]));});});};exports['UpdateCmHopper']=function(_0x484806){var _0xf24127=this;return new Promise(function(_0x11bf50,_0x102f26){return db['CmHopper'][_0xf3a7('0x18')](_0x484806[_0xf3a7('0x15')],{'raw':_0x484806[_0xf3a7('0x5')]?_0x484806[_0xf3a7('0x5')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x484806[_0xf3a7('0x5')]?_0x484806['options'][_0xf3a7('0x7')]||null:null,'attributes':_0x484806[_0xf3a7('0x5')]?_0x484806[_0xf3a7('0x5')][_0xf3a7('0x8')]||null:null,'limit':_0x484806['options']?_0x484806[_0xf3a7('0x5')]['limit']||null:null})['then'](function(_0x25feae){logger[_0xf3a7('0xd')](_0xf3a7('0x19'),_0x484806);logger['info'](_0xf3a7('0x1a'),JSON['stringify'](_0x484806[_0xf3a7('0x5')]['where']),_0x484806[_0xf3a7('0x15')][_0xf3a7('0x1b')]);logger[_0xf3a7('0xe')](_0xf3a7('0x19'),_0x484806,JSON[_0xf3a7('0xf')](_0x25feae));_0x11bf50(_0x25feae);})['catch'](function(_0x49f631){logger['error']('UpdateCmHopper',_0x49f631['message'],_0x484806);_0x102f26(_0xf24127[_0xf3a7('0x11')](0x1f4,_0x49f631[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x1c')]=function(_0x9425fb){var _0xb954d1=this;return new Promise(function(_0x5dbc83,_0x478df7){return db[_0xf3a7('0x4')][_0xf3a7('0x1d')]({'where':_0x9425fb[_0xf3a7('0x5')]?_0x9425fb['options'][_0xf3a7('0x7')]||null:null})[_0xf3a7('0x16')](function(_0x53ff2e){logger[_0xf3a7('0xd')](_0xf3a7('0x1c'),_0x9425fb);logger['debug'](_0xf3a7('0x1c'),_0x9425fb,JSON[_0xf3a7('0xf')](_0x53ff2e));_0x5dbc83(_0x53ff2e);})[_0xf3a7('0x10')](function(_0x2c5b40){logger[_0xf3a7('0x11')]('DestroyCmHopper',_0x2c5b40[_0xf3a7('0x12')],_0x9425fb);_0x478df7(_0xb954d1[_0xf3a7('0x11')](0x1f4,_0x2c5b40[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x1e')]=function(_0x318c15){var _0x54b8f1=this;return new Promise(function(_0x4a508b,_0x4e56d7){return db[_0xf3a7('0x1f')][_0xf3a7('0x20')]()[_0xf3a7('0x16')](function(_0x5843e0){return db[_0xf3a7('0x21')]['transaction'](function(_0x3f752b){return db[_0xf3a7('0x4')][_0xf3a7('0x22')]({'where':_0x318c15[_0xf3a7('0x5')]?_0x318c15[_0xf3a7('0x5')][_0xf3a7('0x7')]||null:null,'attributes':_0x318c15[_0xf3a7('0x5')]?_0x318c15[_0xf3a7('0x5')][_0xf3a7('0x8')]||null:null,'limit':_0x318c15[_0xf3a7('0x5')]?_0x318c15[_0xf3a7('0x5')][_0xf3a7('0x9')]||null:null,'order':_0x318c15[_0xf3a7('0x5')]?_0x318c15['options']['order']||null:null,'transaction':_0x3f752b,'lock':_0x3f752b[_0xf3a7('0x23')][_0xf3a7('0x24')],'include':[{'model':db[_0xf3a7('0x1f')],'as':'Contact','attributes':_[_0xf3a7('0x25')](_0x5843e0)},{'model':db[_0xf3a7('0x26')],'as':_0xf3a7('0x27'),'attributes':['id','name',_0xf3a7('0x28')]}]})[_0xf3a7('0x16')](function(_0xa687eb){var _0x273a98=[];var _0xd7e777=[];for(var _0xfd2797=0x0;_0xfd2797<_0xa687eb[_0xf3a7('0x29')];_0xfd2797+=0x1){var _0x1a26f1=_0xa687eb[_0xfd2797][_0xf3a7('0x2a')];if(_0x1a26f1===null){_0x273a98[_0xf3a7('0x2b')](_0xa687eb[_0xfd2797][_0xf3a7('0x18')](_0x318c15['body'],{'transaction':_0x3f752b}));}else if(!_0xd7e777['includes'](_0x1a26f1)){_0xd7e777[_0xf3a7('0x2b')](_0x1a26f1);_0x273a98[_0xf3a7('0x2b')](_0xa687eb[_0xfd2797][_0xf3a7('0x18')](_0x318c15[_0xf3a7('0x15')],{'transaction':_0x3f752b}));}}return BPromise['all'](_0x273a98);});})[_0xf3a7('0x16')](function(_0x5ae7c2){logger[_0xf3a7('0xd')](_0xf3a7('0x1e'),_0x318c15);if(_0x5ae7c2['length']>0x0){logger[_0xf3a7('0xd')](_0xf3a7('0x2c'),_0x5ae7c2[0x0][_0xf3a7('0x2d')]['id'],_0x5ae7c2[0x0][_0xf3a7('0x2d')][_0xf3a7('0x2e')],_0x5ae7c2[0x0][_0xf3a7('0x2d')]['active']);}logger['debug'](_0xf3a7('0x1e'),_0x318c15,JSON[_0xf3a7('0xf')](_0x5ae7c2));_0x4a508b(_0x5ae7c2);})['catch'](function(_0x2391ee){logger[_0xf3a7('0x11')](_0xf3a7('0x1e'),_0x2391ee[_0xf3a7('0x12')],_0x318c15);_0x4e56d7(_0x54b8f1['error'](0x1f4,_0x2391ee[_0xf3a7('0x12')]));});});});};exports[_0xf3a7('0x2f')]=function(_0x29ebac){var _0x3ccd48=this;return new Promise(function(_0x223ecf,_0x19867f){return db['sequelize'][_0xf3a7('0x30')](function(_0xd7bed){return db[_0xf3a7('0x31')][_0xf3a7('0x32')](_0x29ebac[_0xf3a7('0x15')],{'raw':_0x29ebac['options']?_0x29ebac[_0xf3a7('0x5')][_0xf3a7('0x6')]===undefined?!![]:![]:!![],'transaction':_0xd7bed})[_0xf3a7('0x16')](function(){logger[_0xf3a7('0xd')](_0xf3a7('0x33'),JSON[_0xf3a7('0xf')](_0x29ebac[_0xf3a7('0x5')][_0xf3a7('0x7')]),_0x29ebac[_0xf3a7('0x5')][_0xf3a7('0x7')][_0xf3a7('0x1b')]);return db[_0xf3a7('0x4')]['destroy']({'where':_0x29ebac[_0xf3a7('0x5')]?_0x29ebac['options'][_0xf3a7('0x7')]||null:null,'transaction':_0xd7bed});});})['then'](function(_0x62cee4){logger['info'](_0xf3a7('0x2f'),_0x29ebac);logger['debug'](_0xf3a7('0x2f'),_0x29ebac,JSON[_0xf3a7('0xf')](_0x62cee4));_0x223ecf(_0x62cee4);})[_0xf3a7('0x10')](function(_0x30d7b7){logger[_0xf3a7('0x11')](_0xf3a7('0x2f'),_0x30d7b7['message'],_0x29ebac);_0x19867f(_0x3ccd48['error'](0x1f4,_0x30d7b7[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x34')]=function(_0x404f33){var _0x12ae39=this;return new Promise(function(_0x17059f,_0x2d05b1){return db[_0xf3a7('0x4')][_0xf3a7('0x22')]({'raw':_0x404f33[_0xf3a7('0x5')]?_0x404f33['options']['raw']===undefined?!![]:![]:!![],'where':_0x404f33[_0xf3a7('0x5')]?_0x404f33['options']['where']||null:null,'attributes':[[db[_0xf3a7('0x21')]['fn'](_0xf3a7('0x35'),db[_0xf3a7('0x21')]['fn']('IF',db['sequelize'][_0xf3a7('0x36')](_0xf3a7('0x37')+util[_0xf3a7('0x38')](_0xf3a7('0x39'),moment()[_0xf3a7('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xf3a7('0x3a')))),_0xf3a7('0x3b')]]})[_0xf3a7('0x16')](function(_0x64e0f4){logger[_0xf3a7('0xd')](_0xf3a7('0x34'),_0x404f33);logger[_0xf3a7('0xe')](_0xf3a7('0x34'),_0x404f33,JSON['stringify'](_0x64e0f4));_0x17059f(_0x64e0f4);})['catch'](function(_0x300825){logger['error']('CountReScheduled',_0x300825[_0xf3a7('0x12')],_0x404f33);_0x2d05b1(_0x12ae39[_0xf3a7('0x11')](0x1f4,_0x300825[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x3c')]=function(_0x277a6d){var _0x2cd572=this;return new Promise(function(_0x39cf7b,_0x430b53){return db[_0xf3a7('0x1f')][_0xf3a7('0x20')]()[_0xf3a7('0x16')](function(){return db[_0xf3a7('0x21')][_0xf3a7('0x30')](function(_0x2a8560){return db[_0xf3a7('0x4')][_0xf3a7('0x22')]({'where':_0x277a6d[_0xf3a7('0x5')]?_0x277a6d[_0xf3a7('0x5')][_0xf3a7('0x7')]||null:null,'attributes':_0x277a6d[_0xf3a7('0x5')]?_0x277a6d[_0xf3a7('0x5')][_0xf3a7('0x8')]||null:null,'limit':0x1,'order':_0x277a6d[_0xf3a7('0x5')]?_0x277a6d[_0xf3a7('0x5')][_0xf3a7('0x3d')]||null:null,'group':db[_0xf3a7('0x4')][_0xf3a7('0x2a')],'transaction':_0x2a8560,'lock':_0x2a8560['LOCK'][_0xf3a7('0x24')],'include':_0x277a6d['options']?_0x277a6d[_0xf3a7('0x5')][_0xf3a7('0xa')]?_['map'](_0x277a6d[_0xf3a7('0x5')]['include'],function(_0x4dac58){return{'model':db[_0x4dac58[_0xf3a7('0xb')]],'as':_0x4dac58['as'],'attributes':_0x4dac58[_0xf3a7('0x8')],'include':_0x4dac58[_0xf3a7('0xa')]?_[_0xf3a7('0xc')](_0x4dac58[_0xf3a7('0xa')],function(_0x346d3c){return{'model':db[_0x346d3c[_0xf3a7('0xb')]],'as':_0x346d3c['as'],'attributes':_0x346d3c[_0xf3a7('0x8')],'include':_0x346d3c[_0xf3a7('0xa')]?_['map'](_0x346d3c[_0xf3a7('0xa')],function(_0x2519f0){return{'model':db[_0x2519f0[_0xf3a7('0xb')]],'as':_0x2519f0['as'],'attributes':_0x2519f0[_0xf3a7('0x8')]};}):[]};}):[]};}):[]:[]})[_0xf3a7('0x16')](function(_0x3bbd86){var _0x1b22cc=[];for(var _0xafc543=0x0;_0xafc543<_0x3bbd86['length'];_0xafc543+=0x1){_0x1b22cc[_0xf3a7('0x2b')](_0x3bbd86[_0xafc543][_0xf3a7('0x18')](_0x277a6d[_0xf3a7('0x15')],{'transaction':_0x2a8560}));}return BPromise['all'](_0x1b22cc);});})[_0xf3a7('0x16')](function(_0x2e251b){logger[_0xf3a7('0xd')](_0xf3a7('0x3c'),_0x277a6d);logger[_0xf3a7('0xe')](_0xf3a7('0x3c'),_0x277a6d,JSON['stringify'](_0x2e251b));_0x39cf7b(_0x2e251b);})[_0xf3a7('0x10')](function(_0x1c1c8a){logger['error'](_0xf3a7('0x3c'),_0x1c1c8a[_0xf3a7('0x12')],_0x277a6d);_0x430b53(_0x2cd572[_0xf3a7('0x11')](0x1f4,_0x1c1c8a[_0xf3a7('0x12')]));});});});};exports[_0xf3a7('0x3e')]=function(_0x22e361){var _0x37afa7=this;return new Promise(function(_0x5380e7,_0x21d0be){db['CmContact']['describe']()[_0xf3a7('0x16')](function(_0x24d5c4){return db['CmHopper'][_0xf3a7('0x22')]({'raw':_0x22e361[_0xf3a7('0x5')]?_0x22e361[_0xf3a7('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x22e361['options']?_0x22e361[_0xf3a7('0x5')][_0xf3a7('0x7')]||null:null,'attributes':_0x22e361['options']?_0x22e361['options']['attributes']||null:null,'limit':_0x22e361[_0xf3a7('0x5')]?_0x22e361['options'][_0xf3a7('0x9')]||null:null,'include':_0x22e361[_0xf3a7('0x5')]?_0x22e361[_0xf3a7('0x5')][_0xf3a7('0xa')]?_[_0xf3a7('0xc')](_0x22e361[_0xf3a7('0x5')]['include'],function(_0x4e9eed){return{'model':db[_0x4e9eed[_0xf3a7('0xb')]],'as':_0x4e9eed['as'],'attributes':_0x4e9eed['as']===_0xf3a7('0x3f')?_['keys'](_0x24d5c4):_0x4e9eed['attributes'],'include':_0x4e9eed[_0xf3a7('0xa')]?_['map'](_0x4e9eed['include'],function(_0x354fc8){return{'model':db[_0x354fc8[_0xf3a7('0xb')]],'as':_0x354fc8['as'],'attributes':_0x354fc8[_0xf3a7('0x8')],'include':_0x354fc8[_0xf3a7('0xa')]?_['map'](_0x354fc8['include'],function(_0x25b42b){return{'model':db[_0x25b42b[_0xf3a7('0xb')]],'as':_0x25b42b['as'],'attributes':_0x25b42b[_0xf3a7('0x8')]};}):[]};}):[]};}):[]:[]})[_0xf3a7('0x16')](function(_0x4c1f02){logger[_0xf3a7('0xd')]('GetCmHopper',_0x22e361);logger['debug']('GetCmHopper',_0x22e361,JSON[_0xf3a7('0xf')](_0x4c1f02));_0x5380e7(_0x4c1f02);})['catch'](function(_0x339aae){logger['error'](_0xf3a7('0x3'),_0x339aae[_0xf3a7('0x12')],_0x22e361);_0x21d0be(_0x37afa7[_0xf3a7('0x11')](0x1f4,_0x339aae[_0xf3a7('0x12')]));});});});};exports[_0xf3a7('0x40')]=function(_0xd46843){var _0x45ba4a=this;return new Promise(function(_0x30b26d,_0x46ca0b){return db[_0xf3a7('0x1f')][_0xf3a7('0x41')]({'raw':!![],'where':{'phone':_0xd46843['options'][_0xf3a7('0x7')][_0xf3a7('0x42')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0xf3a7('0x16')](function(_0x4f636f){logger[_0xf3a7('0xd')]('getContactByPhone',_0xd46843);logger[_0xf3a7('0xe')](_0xf3a7('0x43'),_0xd46843,JSON[_0xf3a7('0xf')](_0x4f636f));_0x30b26d(_0x4f636f);})[_0xf3a7('0x10')](function(_0x57e553){logger['error'](_0xf3a7('0x43'),_0x57e553['message'],_0xd46843);_0x46ca0b(_0x45ba4a['error'](0x1f4,_0x57e553[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x44')]=function(_0x20b1ab){var _0x1a7329=this;return new Promise(function(_0x11799a,_0x3755fe){return db[_0xf3a7('0x21')][_0xf3a7('0x30')](function(_0x2f2d30){var _0x4294eb=_0x20b1ab[_0xf3a7('0x5')]&&_0x20b1ab['options']['where']?_0x20b1ab[_0xf3a7('0x5')][_0xf3a7('0x7')]:{};return db[_0xf3a7('0x4')]['update'](_0x20b1ab[_0xf3a7('0x15')],{'where':_0x4294eb,'transaction':_0x2f2d30})[_0xf3a7('0x16')](function(_0x4b3a47){logger[_0xf3a7('0xd')](_0xf3a7('0x44'),_0x20b1ab);logger[_0xf3a7('0xe')](_0xf3a7('0x44'),_0x20b1ab,JSON[_0xf3a7('0xf')](_0x4b3a47));_0x11799a(_0x4b3a47);})[_0xf3a7('0x10')](function(_0x3a638b){logger[_0xf3a7('0x11')](_0xf3a7('0x44'),_0x3a638b['message'],_0x20b1ab);_0x3755fe(_0x1a7329[_0xf3a7('0x11')](0x1f4,_0x3a638b['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x4be209){var _0x3bc68b=this;var _0x15e83d=_0x4be209[_0xf3a7('0x15')][_0xf3a7('0x7')][_0xf3a7('0x45')];var _0x2c4e50=_0x4be209[_0xf3a7('0x15')][_0xf3a7('0x7')][_0xf3a7('0x46')];var _0x39aa02=_0x4be209[_0xf3a7('0x15')][_0xf3a7('0x7')][_0xf3a7('0x47')];return new Promise(function(_0x21260b,_0x348b2f){return db[_0xf3a7('0x4')]['findAll']({'where':{'voiceQueueId':{'$in':_0x15e83d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xf3a7('0x36')]('NOW()\x20+\x20INTERVAL\x20'+_0x2c4e50+'\x20MINUTE'),'$gt':db[_0xf3a7('0x21')]['literal'](_0xf3a7('0x48'))}},'UserId':{'$in':_0x39aa02}},'include':[{'model':db[_0xf3a7('0x1f')],'as':'Contact'},{'model':db['User'],'as':_0xf3a7('0x27'),'attributes':['id','name',_0xf3a7('0x28')]},{'model':db[_0xf3a7('0x49')],'as':'List'}]})[_0xf3a7('0x16')](function(_0x1c7642){if(_0x1c7642[_0xf3a7('0x29')]>0x0){return db['sequelize'][_0xf3a7('0x30')](function(_0x3f3746){return db[_0xf3a7('0x4')][_0xf3a7('0x18')]({'recallmeNotifiedDate':db[_0xf3a7('0x21')]['literal']('NOW()')},{'where':{'id':{'$in':_['map'](_0x1c7642,'id')}},'transaction':_0x3f3746})[_0xf3a7('0x16')](function(){_0x21260b(_0x1c7642);})['catch'](function(_0x5c2bf4){logger['error'](_0xf3a7('0x4a'),_0x5c2bf4[_0xf3a7('0x12')],_0x4be209);_0x348b2f(_0x3bc68b[_0xf3a7('0x11')](0x1f4,_0x5c2bf4[_0xf3a7('0x12')]));});})[_0xf3a7('0x10')](function(_0x1a55bc){logger[_0xf3a7('0x11')](_0xf3a7('0x4a'),_0x1a55bc[_0xf3a7('0x12')],_0x4be209);_0x348b2f(_0x3bc68b['error'](0x1f4,_0x1a55bc[_0xf3a7('0x12')]));});}else{_0x21260b(_0x1c7642);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 7aea26e..c81c721 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 _0x18f4=['isAuthenticated','describe','get','getOpenContacts','/timezones','show','/:id/previewrecall','getPreviewRecall','create','post','/preview','getPreview','/timezone','getTimezone','put','/:id','update','express','Router','./cmHopper.controller','index','/describe'];(function(_0x33cf17,_0x242661){var _0x2feeb8=function(_0x242719){while(--_0x242719){_0x33cf17['push'](_0x33cf17['shift']());}};_0x2feeb8(++_0x242661);}(_0x18f4,0x69));var _0x418f=function(_0x2f3d9d,_0x4e7c15){_0x2f3d9d=_0x2f3d9d-0x0;var _0x5ec938=_0x18f4[_0x2f3d9d];return _0x5ec938;};'use strict';var express=require(_0x418f('0x0'));var router=express[_0x418f('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x418f('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x418f('0x3')]);router['get'](_0x418f('0x4'),auth[_0x418f('0x5')](),controller[_0x418f('0x6')]);router[_0x418f('0x7')]('/opencontacts',auth[_0x418f('0x5')](),controller[_0x418f('0x8')]);router[_0x418f('0x7')](_0x418f('0x9'),auth[_0x418f('0x5')](),controller['getTimezones']);router['get']('/:id',auth[_0x418f('0x5')](),controller[_0x418f('0xa')]);router[_0x418f('0x7')](_0x418f('0xb'),auth[_0x418f('0x5')](),controller[_0x418f('0xc')]);router['post']('/',auth[_0x418f('0x5')](),controller[_0x418f('0xd')]);router[_0x418f('0xe')](_0x418f('0xf'),auth[_0x418f('0x5')](),controller[_0x418f('0x10')]);router[_0x418f('0xe')](_0x418f('0x11'),auth[_0x418f('0x5')](),controller[_0x418f('0x12')]);router[_0x418f('0x13')](_0x418f('0x14'),auth['isAuthenticated'](),controller[_0x418f('0x15')]);router['delete'](_0x418f('0x14'),auth[_0x418f('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9fe2=['/preview','getPreview','/timezone','getTimezone','/:id','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id/previewrecall','create','post'];(function(_0x114c1c,_0x5bfd6d){var _0x50a0a6=function(_0x4f97f0){while(--_0x4f97f0){_0x114c1c['push'](_0x114c1c['shift']());}};_0x50a0a6(++_0x5bfd6d);}(_0x9fe2,0x189));var _0x29fe=function(_0x1d4bb9,_0x2f0617){_0x1d4bb9=_0x1d4bb9-0x0;var _0x16cf96=_0x9fe2[_0x1d4bb9];return _0x16cf96;};'use strict';var express=require(_0x29fe('0x0'));var router=express[_0x29fe('0x1')]();var auth=require(_0x29fe('0x2'));var controller=require('./cmHopper.controller');router[_0x29fe('0x3')]('/',auth[_0x29fe('0x4')](),controller[_0x29fe('0x5')]);router[_0x29fe('0x3')](_0x29fe('0x6'),auth['isAuthenticated'](),controller[_0x29fe('0x7')]);router[_0x29fe('0x3')](_0x29fe('0x8'),auth[_0x29fe('0x4')](),controller[_0x29fe('0x9')]);router[_0x29fe('0x3')](_0x29fe('0xa'),auth['isAuthenticated'](),controller[_0x29fe('0xb')]);router[_0x29fe('0x3')]('/:id',auth[_0x29fe('0x4')](),controller['show']);router['get'](_0x29fe('0xc'),auth[_0x29fe('0x4')](),controller['getPreviewRecall']);router['post']('/',auth[_0x29fe('0x4')](),controller[_0x29fe('0xd')]);router[_0x29fe('0xe')](_0x29fe('0xf'),auth[_0x29fe('0x4')](),controller[_0x29fe('0x10')]);router[_0x29fe('0xe')](_0x29fe('0x11'),auth[_0x29fe('0x4')](),controller[_0x29fe('0x12')]);router['put'](_0x29fe('0x13'),auth[_0x29fe('0x4')](),controller[_0x29fe('0x14')]);router[_0x29fe('0x15')]('/:id',auth[_0x29fe('0x4')](),controller[_0x29fe('0x16')]);module[_0x29fe('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 ee1d106..c0435e2 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 _0xbe1c=['DATE','moment','sequelize','exports','INTEGER'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0xbe1c,0xb0));var _0xcbe1=function(_0x3cc651,_0x32f10e){_0x3cc651=_0x3cc651-0x0;var _0x372a5a=_0xbe1c[_0x3cc651];return _0x372a5a;};'use strict';var moment=require(_0xcbe1('0x0'));var Sequelize=require(_0xcbe1('0x1'));module[_0xcbe1('0x2')]={'CmHopperId':{'type':Sequelize[_0xcbe1('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xcbe1('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xcbe1('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcbe1('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcbe1('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xcbe1('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcbe1('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaa71=['sequelize','exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x22dd2b,_0x3b116a){var _0x2c816c=function(_0x4f2765){while(--_0x4f2765){_0x22dd2b['push'](_0x22dd2b['shift']());}};_0x2c816c(++_0x3b116a);}(_0xaa71,0xae));var _0x1aa7=function(_0x1ed65d,_0x2e344e){_0x1ed65d=_0x1ed65d-0x0;var _0x96d5f2=_0xaa71[_0x1ed65d];return _0x96d5f2;};'use strict';var moment=require(_0x1aa7('0x0'));var Sequelize=require(_0x1aa7('0x1'));module[_0x1aa7('0x2')]={'CmHopperId':{'type':Sequelize[_0x1aa7('0x3')]},'phone':{'type':Sequelize[_0x1aa7('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x1aa7('0x5')],'defaultValue':moment()['format'](_0x1aa7('0x6'))},'countbusyretry':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1aa7('0x3')],'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 b32bac8..82e70bf 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 _0xef1f=['util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','CmHopperAdditionalPhones','UserProfileResource','error','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef1f,0x9d));var _0xfef1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xef1f[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xfef1('0x0'));var rimraf=require(_0xfef1('0x1'));var zipdir=require(_0xfef1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfef1('0x3'));var moment=require(_0xfef1('0x4'));var BPromise=require(_0xfef1('0x5'));var Mustache=require(_0xfef1('0x6'));var util=require(_0xfef1('0x7'));var path=require(_0xfef1('0x8'));var sox=require('sox');var csv=require(_0xfef1('0x9'));var ejs=require(_0xfef1('0xa'));var fs=require('fs');var fs_extra=require(_0xfef1('0xb'));var _=require(_0xfef1('0xc'));var squel=require(_0xfef1('0xd'));var crypto=require('crypto');var jsforce=require(_0xfef1('0xe'));var deskjs=require(_0xfef1('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfef1('0x10'));var Papa=require(_0xfef1('0x11'));var Redis=require(_0xfef1('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfef1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfef1('0x14'))(_0xfef1('0x15'));var utils=require('../../config/utils');var config=require(_0xfef1('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bf08a,_0x5a258f){_0x5a258f=_0x5a258f||0xcc;return function(_0x2f4286){if(_0x2f4286){return _0x5bf08a[_0xfef1('0x17')](_0x5a258f);}return _0x5bf08a[_0xfef1('0x18')](_0x5a258f)[_0xfef1('0x19')]();};}function respondWithResult(_0x57b87d,_0x565f80){_0x565f80=_0x565f80||0xc8;return function(_0x653b40){if(_0x653b40){return _0x57b87d['status'](_0x565f80)[_0xfef1('0x1a')](_0x653b40);}};}function respondWithFilteredResult(_0x562d8d,_0x496f9d){return function(_0x24c26d){if(_0x24c26d){var _0x287812=typeof _0x496f9d[_0xfef1('0x1b')]===_0xfef1('0x1c')&&typeof _0x496f9d[_0xfef1('0x1d')]===_0xfef1('0x1c');var _0x526d60=_0x24c26d[_0xfef1('0x1e')];var _0x16d5da=_0x287812?0x0:_0x496f9d[_0xfef1('0x1b')];var _0x270909=_0x287812?_0x24c26d[_0xfef1('0x1e')]:_0x496f9d['offset']+_0x496f9d[_0xfef1('0x1d')];var _0x3286fb;if(_0x270909>=_0x526d60){_0x270909=_0x526d60;_0x3286fb=0xc8;}else{_0x3286fb=0xce;}_0x562d8d['status'](_0x3286fb);return _0x562d8d[_0xfef1('0x1f')]('Content-Range',_0x16d5da+'-'+_0x270909+'/'+_0x526d60)[_0xfef1('0x1a')](_0x24c26d);}return null;};}function patchUpdates(_0x2c8a32){return function(_0x137aa6){try{jsonpatch[_0xfef1('0x20')](_0x137aa6,_0x2c8a32,!![]);}catch(_0x4f3c19){return BPromise['reject'](_0x4f3c19);}return _0x137aa6[_0xfef1('0x21')]();};}function saveUpdates(_0xb631f3,_0x5a5725){return function(_0x54df0e){if(_0x54df0e){return _0x54df0e[_0xfef1('0x22')](_0xb631f3)['then'](function(_0x3966aa){return _0x3966aa;});}return null;};}function removeEntity(_0x6decf8,_0x10db25){return function(_0x3773ba){if(_0x3773ba){return _0x3773ba[_0xfef1('0x23')]()[_0xfef1('0x24')](function(){var _0x39fee6=_0x3773ba['get']({'plain':!![]});var _0x117ac2=_0xfef1('0x25');return db[_0xfef1('0x26')][_0xfef1('0x23')]({'where':{'type':_0x117ac2,'resourceId':_0x39fee6['id']}})[_0xfef1('0x24')](function(){return _0x3773ba;});})[_0xfef1('0x24')](function(){_0x6decf8[_0xfef1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4975dc,_0x4b3ef5){return function(_0x2adbeb){if(!_0x2adbeb){_0x4975dc['sendStatus'](0x194);}return _0x2adbeb;};}function handleError(_0x25643c,_0x140171){_0x140171=_0x140171||0x1f4;return function(_0x184351){logger[_0xfef1('0x27')](_0x184351['stack']);if(_0x184351['name']){delete _0x184351[_0xfef1('0x28')];}_0x25643c[_0xfef1('0x18')](_0x140171)[_0xfef1('0x29')](_0x184351);};}exports[_0xfef1('0x2a')]=function(_0x238169,_0x359064){var _0x4fd062={},_0x4b1564={},_0x21eb59={'count':0x0,'rows':[]};var _0x1ca2f7=_[_0xfef1('0x2b')](db[_0xfef1('0x2c')][_0xfef1('0x2d')],function(_0x72ee2){return{'name':_0x72ee2[_0xfef1('0x2e')],'type':_0x72ee2[_0xfef1('0x2f')]['key']};});_0x4b1564[_0xfef1('0x30')]=_[_0xfef1('0x2b')](_0x1ca2f7,_0xfef1('0x28'));_0x4b1564[_0xfef1('0x31')]=_[_0xfef1('0x32')](_0x238169['query']);_0x4b1564[_0xfef1('0x33')]=_[_0xfef1('0x34')](_0x4b1564[_0xfef1('0x30')],_0x4b1564[_0xfef1('0x31')]);_0x4fd062['attributes']=_[_0xfef1('0x34')](_0x4b1564[_0xfef1('0x30')],qs[_0xfef1('0x35')](_0x238169['query'][_0xfef1('0x35')]));_0x4fd062[_0xfef1('0x36')]=_0x4fd062['attributes'][_0xfef1('0x37')]?_0x4fd062[_0xfef1('0x36')]:_0x4b1564[_0xfef1('0x30')];if(!_0x238169['query'][_0xfef1('0x38')]('nolimit')){_0x4fd062[_0xfef1('0x1d')]=qs[_0xfef1('0x1d')](_0x238169[_0xfef1('0x31')][_0xfef1('0x1d')]);_0x4fd062[_0xfef1('0x1b')]=qs[_0xfef1('0x1b')](_0x238169[_0xfef1('0x31')][_0xfef1('0x1b')]);}_0x4fd062[_0xfef1('0x39')]=qs[_0xfef1('0x3a')](_0x238169[_0xfef1('0x31')][_0xfef1('0x3a')]);_0x4fd062[_0xfef1('0x3b')]=qs['filters'](_[_0xfef1('0x3c')](_0x238169[_0xfef1('0x31')],_0x4b1564[_0xfef1('0x33')]),_0x1ca2f7);if(_0x238169[_0xfef1('0x31')]['filter']){_0x4fd062[_0xfef1('0x3b')]=_[_0xfef1('0x3d')](_0x4fd062[_0xfef1('0x3b')],{'$or':_[_0xfef1('0x2b')](_0x1ca2f7,function(_0x221e35){if(_0x221e35[_0xfef1('0x2f')]!==_0xfef1('0x3e')){var _0x5a0739={};_0x5a0739[_0x221e35[_0xfef1('0x28')]]={'$like':'%'+_0x238169['query'][_0xfef1('0x3f')]+'%'};return _0x5a0739;}})});}_0x4fd062=_['merge']({},_0x4fd062,_0x238169['options']);var _0x44e8e1={'where':_0x4fd062[_0xfef1('0x3b')]};return db[_0xfef1('0x2c')][_0xfef1('0x1e')](_0x44e8e1)[_0xfef1('0x24')](function(_0x1ea914){_0x21eb59[_0xfef1('0x1e')]=_0x1ea914;if(_0x238169[_0xfef1('0x31')][_0xfef1('0x40')]){_0x4fd062[_0xfef1('0x41')]=[{'all':!![]}];}return db[_0xfef1('0x2c')][_0xfef1('0x42')](_0x4fd062);})[_0xfef1('0x24')](function(_0x60d721){_0x21eb59[_0xfef1('0x43')]=_0x60d721;return _0x21eb59;})[_0xfef1('0x24')](respondWithFilteredResult(_0x359064,_0x4fd062))[_0xfef1('0x44')](handleError(_0x359064,null));};exports[_0xfef1('0x45')]=function(_0x11f055,_0x1bc09d){var _0x5a5fef={'raw':!![],'where':{'id':_0x11f055[_0xfef1('0x46')]['id']}},_0x1d8533={};_0x1d8533[_0xfef1('0x30')]=_[_0xfef1('0x32')](db['CmHopperAdditionalPhone'][_0xfef1('0x2d')]);_0x1d8533['query']=_[_0xfef1('0x32')](_0x11f055[_0xfef1('0x31')]);_0x1d8533[_0xfef1('0x33')]=_[_0xfef1('0x34')](_0x1d8533[_0xfef1('0x30')],_0x1d8533['query']);_0x5a5fef['attributes']=_[_0xfef1('0x34')](_0x1d8533[_0xfef1('0x30')],qs[_0xfef1('0x35')](_0x11f055[_0xfef1('0x31')][_0xfef1('0x35')]));_0x5a5fef[_0xfef1('0x36')]=_0x5a5fef[_0xfef1('0x36')]['length']?_0x5a5fef[_0xfef1('0x36')]:_0x1d8533['model'];if(_0x11f055[_0xfef1('0x31')][_0xfef1('0x40')]){_0x5a5fef['include']=[{'all':!![]}];}_0x5a5fef=_[_0xfef1('0x3d')]({},_0x5a5fef,_0x11f055[_0xfef1('0x47')]);return db[_0xfef1('0x2c')]['find'](_0x5a5fef)[_0xfef1('0x24')](handleEntityNotFound(_0x1bc09d,null))[_0xfef1('0x24')](respondWithResult(_0x1bc09d,null))['catch'](handleError(_0x1bc09d,null));};exports[_0xfef1('0x48')]=function(_0x99cd11,_0x39a6a2){return db[_0xfef1('0x2c')][_0xfef1('0x48')](_0x99cd11[_0xfef1('0x49')],{})[_0xfef1('0x24')](function(_0x1129da){var _0x390816=_0x99cd11[_0xfef1('0x4a')][_0xfef1('0x4b')]({'plain':!![]});if(!_0x390816)throw new Error(_0xfef1('0x4c'));if(_0x390816[_0xfef1('0x4d')]===_0xfef1('0x4a')){var _0xa846d6=_0x1129da[_0xfef1('0x4b')]({'plain':!![]});var _0x135e2d=_0xfef1('0x25');return db[_0xfef1('0x4e')][_0xfef1('0x4f')]({'where':{'name':_0x135e2d,'userProfileId':_0x390816['userProfileId']},'raw':!![]})['then'](function(_0x2019c4){if(_0x2019c4&&_0x2019c4[_0xfef1('0x50')]===0x0){return db[_0xfef1('0x26')][_0xfef1('0x48')]({'name':_0xa846d6[_0xfef1('0x28')],'resourceId':_0xa846d6['id'],'type':_0x2019c4[_0xfef1('0x28')],'sectionId':_0x2019c4['id']},{})[_0xfef1('0x24')](function(){return _0x1129da;});}else{return _0x1129da;}})[_0xfef1('0x44')](function(_0x348986){logger[_0xfef1('0x27')](_0xfef1('0x51'),_0x348986);throw _0x348986;});}return _0x1129da;})[_0xfef1('0x24')](respondWithResult(_0x39a6a2,0xc9))['catch'](handleError(_0x39a6a2,null));};exports['update']=function(_0xfc8ffb,_0x2d2cee){if(_0xfc8ffb[_0xfef1('0x49')]['id']){delete _0xfc8ffb['body']['id'];}return db['CmHopperAdditionalPhone'][_0xfef1('0x4f')]({'where':{'id':_0xfc8ffb[_0xfef1('0x46')]['id']}})[_0xfef1('0x24')](handleEntityNotFound(_0x2d2cee,null))[_0xfef1('0x24')](saveUpdates(_0xfc8ffb[_0xfef1('0x49')],null))[_0xfef1('0x24')](respondWithResult(_0x2d2cee,null))['catch'](handleError(_0x2d2cee,null));};exports[_0xfef1('0x23')]=function(_0x2b6cf6,_0x56d9f1){return db[_0xfef1('0x2c')][_0xfef1('0x4f')]({'where':{'id':_0x2b6cf6[_0xfef1('0x46')]['id']}})[_0xfef1('0x24')](handleEntityNotFound(_0x56d9f1,null))[_0xfef1('0x24')](removeEntity(_0x56d9f1,null))[_0xfef1('0x44')](handleError(_0x56d9f1,null));}; \ No newline at end of file +var _0x9cf5=['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','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','name','CmHopperAdditionalPhone','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','options','includeAll','include','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format'];(function(_0x21d2b5,_0x3dea6c){var _0x4e5991=function(_0xb9aca1){while(--_0xb9aca1){_0x21d2b5['push'](_0x21d2b5['shift']());}};_0x4e5991(++_0x3dea6c);}(_0x9cf5,0x180));var _0x59cf=function(_0x10c35f,_0x33d9b7){_0x10c35f=_0x10c35f-0x0;var _0x144ada=_0x9cf5[_0x10c35f];return _0x144ada;};'use strict';var emlformat=require(_0x59cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59cf('0x1'));var jsonpatch=require(_0x59cf('0x2'));var rp=require(_0x59cf('0x3'));var moment=require(_0x59cf('0x4'));var BPromise=require(_0x59cf('0x5'));var Mustache=require(_0x59cf('0x6'));var util=require(_0x59cf('0x7'));var path=require(_0x59cf('0x8'));var sox=require(_0x59cf('0x9'));var csv=require('to-csv');var ejs=require(_0x59cf('0xa'));var fs=require('fs');var fs_extra=require(_0x59cf('0xb'));var _=require(_0x59cf('0xc'));var squel=require(_0x59cf('0xd'));var crypto=require(_0x59cf('0xe'));var jsforce=require(_0x59cf('0xf'));var deskjs=require(_0x59cf('0x10'));var toCsv=require(_0x59cf('0x11'));var querystring=require(_0x59cf('0x12'));var Papa=require(_0x59cf('0x13'));var Redis=require(_0x59cf('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x59cf('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x59cf('0x16'))('api');var utils=require(_0x59cf('0x17'));var config=require(_0x59cf('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x357628,_0x1e05fe){_0x1e05fe=_0x1e05fe||0xcc;return function(_0x26deb0){if(_0x26deb0){return _0x357628[_0x59cf('0x19')](_0x1e05fe);}return _0x357628[_0x59cf('0x1a')](_0x1e05fe)[_0x59cf('0x1b')]();};}function respondWithResult(_0x56af73,_0x4e40ab){_0x4e40ab=_0x4e40ab||0xc8;return function(_0x57ea74){if(_0x57ea74){return _0x56af73[_0x59cf('0x1a')](_0x4e40ab)[_0x59cf('0x1c')](_0x57ea74);}};}function respondWithFilteredResult(_0x2d9891,_0x132d5f){return function(_0x26fcbd){if(_0x26fcbd){var _0x42ac08=typeof _0x132d5f[_0x59cf('0x1d')]===_0x59cf('0x1e')&&typeof _0x132d5f[_0x59cf('0x1f')]===_0x59cf('0x1e');var _0x3f7ff3=_0x26fcbd[_0x59cf('0x20')];var _0x539bab=_0x42ac08?0x0:_0x132d5f[_0x59cf('0x1d')];var _0x5f4125=_0x42ac08?_0x26fcbd['count']:_0x132d5f[_0x59cf('0x1d')]+_0x132d5f['limit'];var _0x525bff;if(_0x5f4125>=_0x3f7ff3){_0x5f4125=_0x3f7ff3;_0x525bff=0xc8;}else{_0x525bff=0xce;}_0x2d9891[_0x59cf('0x1a')](_0x525bff);return _0x2d9891[_0x59cf('0x21')]('Content-Range',_0x539bab+'-'+_0x5f4125+'/'+_0x3f7ff3)[_0x59cf('0x1c')](_0x26fcbd);}return null;};}function patchUpdates(_0x4b73f9){return function(_0x56842d){try{jsonpatch[_0x59cf('0x22')](_0x56842d,_0x4b73f9,!![]);}catch(_0x532b3e){return BPromise['reject'](_0x532b3e);}return _0x56842d[_0x59cf('0x23')]();};}function saveUpdates(_0x4d2c7c,_0xd99678){return function(_0x275ce0){if(_0x275ce0){return _0x275ce0[_0x59cf('0x24')](_0x4d2c7c)[_0x59cf('0x25')](function(_0x1c9524){return _0x1c9524;});}return null;};}function removeEntity(_0x19de4a,_0x3f684d){return function(_0x3034e9){if(_0x3034e9){return _0x3034e9[_0x59cf('0x26')]()[_0x59cf('0x25')](function(){var _0x269dee=_0x3034e9[_0x59cf('0x27')]({'plain':!![]});var _0x5237b7=_0x59cf('0x28');return db[_0x59cf('0x29')][_0x59cf('0x26')]({'where':{'type':_0x5237b7,'resourceId':_0x269dee['id']}})['then'](function(){return _0x3034e9;});})[_0x59cf('0x25')](function(){_0x19de4a[_0x59cf('0x1a')](0xcc)[_0x59cf('0x1b')]();});}};}function handleEntityNotFound(_0x46821f,_0x539799){return function(_0x362efb){if(!_0x362efb){_0x46821f[_0x59cf('0x19')](0x194);}return _0x362efb;};}function handleError(_0x3c5693,_0x5de512){_0x5de512=_0x5de512||0x1f4;return function(_0x556fde){logger[_0x59cf('0x2a')](_0x556fde['stack']);if(_0x556fde[_0x59cf('0x2b')]){delete _0x556fde[_0x59cf('0x2b')];}_0x3c5693[_0x59cf('0x1a')](_0x5de512)['send'](_0x556fde);};}exports['index']=function(_0x17c179,_0x38a80f){var _0x160e61={},_0x4d056b={},_0x231928={'count':0x0,'rows':[]};var _0x485824=_['map'](db[_0x59cf('0x2c')][_0x59cf('0x2d')],function(_0x4e0a6f){return{'name':_0x4e0a6f[_0x59cf('0x2e')],'type':_0x4e0a6f[_0x59cf('0x2f')]['key']};});_0x4d056b['model']=_[_0x59cf('0x30')](_0x485824,_0x59cf('0x2b'));_0x4d056b[_0x59cf('0x31')]=_[_0x59cf('0x32')](_0x17c179[_0x59cf('0x31')]);_0x4d056b[_0x59cf('0x33')]=_[_0x59cf('0x34')](_0x4d056b[_0x59cf('0x35')],_0x4d056b[_0x59cf('0x31')]);_0x160e61[_0x59cf('0x36')]=_[_0x59cf('0x34')](_0x4d056b[_0x59cf('0x35')],qs[_0x59cf('0x37')](_0x17c179[_0x59cf('0x31')]['fields']));_0x160e61[_0x59cf('0x36')]=_0x160e61[_0x59cf('0x36')][_0x59cf('0x38')]?_0x160e61[_0x59cf('0x36')]:_0x4d056b['model'];if(!_0x17c179[_0x59cf('0x31')][_0x59cf('0x39')]('nolimit')){_0x160e61[_0x59cf('0x1f')]=qs[_0x59cf('0x1f')](_0x17c179[_0x59cf('0x31')][_0x59cf('0x1f')]);_0x160e61[_0x59cf('0x1d')]=qs[_0x59cf('0x1d')](_0x17c179[_0x59cf('0x31')]['offset']);}_0x160e61[_0x59cf('0x3a')]=qs[_0x59cf('0x3b')](_0x17c179['query'][_0x59cf('0x3b')]);_0x160e61[_0x59cf('0x3c')]=qs[_0x59cf('0x33')](_['pick'](_0x17c179['query'],_0x4d056b[_0x59cf('0x33')]),_0x485824);if(_0x17c179['query']['filter']){_0x160e61[_0x59cf('0x3c')]=_['merge'](_0x160e61[_0x59cf('0x3c')],{'$or':_[_0x59cf('0x30')](_0x485824,function(_0x11e237){if(_0x11e237[_0x59cf('0x2f')]!==_0x59cf('0x3d')){var _0xfe3e={};_0xfe3e[_0x11e237[_0x59cf('0x2b')]]={'$like':'%'+_0x17c179[_0x59cf('0x31')]['filter']+'%'};return _0xfe3e;}})});}_0x160e61=_[_0x59cf('0x3e')]({},_0x160e61,_0x17c179[_0x59cf('0x3f')]);var _0x41d8e6={'where':_0x160e61['where']};return db[_0x59cf('0x2c')]['count'](_0x41d8e6)[_0x59cf('0x25')](function(_0x25e319){_0x231928[_0x59cf('0x20')]=_0x25e319;if(_0x17c179[_0x59cf('0x31')][_0x59cf('0x40')]){_0x160e61[_0x59cf('0x41')]=[{'all':!![]}];}return db[_0x59cf('0x2c')]['findAll'](_0x160e61);})[_0x59cf('0x25')](function(_0xb6fa22){_0x231928['rows']=_0xb6fa22;return _0x231928;})[_0x59cf('0x25')](respondWithFilteredResult(_0x38a80f,_0x160e61))[_0x59cf('0x42')](handleError(_0x38a80f,null));};exports[_0x59cf('0x43')]=function(_0x99d051,_0x319a83){var _0x54f0bd={'raw':!![],'where':{'id':_0x99d051[_0x59cf('0x44')]['id']}},_0x5edca7={};_0x5edca7[_0x59cf('0x35')]=_['keys'](db[_0x59cf('0x2c')][_0x59cf('0x2d')]);_0x5edca7[_0x59cf('0x31')]=_[_0x59cf('0x32')](_0x99d051[_0x59cf('0x31')]);_0x5edca7[_0x59cf('0x33')]=_[_0x59cf('0x34')](_0x5edca7[_0x59cf('0x35')],_0x5edca7['query']);_0x54f0bd['attributes']=_[_0x59cf('0x34')](_0x5edca7[_0x59cf('0x35')],qs[_0x59cf('0x37')](_0x99d051[_0x59cf('0x31')][_0x59cf('0x37')]));_0x54f0bd['attributes']=_0x54f0bd[_0x59cf('0x36')][_0x59cf('0x38')]?_0x54f0bd[_0x59cf('0x36')]:_0x5edca7[_0x59cf('0x35')];if(_0x99d051[_0x59cf('0x31')][_0x59cf('0x40')]){_0x54f0bd[_0x59cf('0x41')]=[{'all':!![]}];}_0x54f0bd=_['merge']({},_0x54f0bd,_0x99d051[_0x59cf('0x3f')]);return db[_0x59cf('0x2c')]['find'](_0x54f0bd)[_0x59cf('0x25')](handleEntityNotFound(_0x319a83,null))[_0x59cf('0x25')](respondWithResult(_0x319a83,null))['catch'](handleError(_0x319a83,null));};exports[_0x59cf('0x45')]=function(_0x403221,_0x116e87){return db[_0x59cf('0x2c')][_0x59cf('0x45')](_0x403221['body'],{})[_0x59cf('0x25')](function(_0x299145){var _0x42b13a=_0x403221[_0x59cf('0x46')][_0x59cf('0x27')]({'plain':!![]});if(!_0x42b13a)throw new Error(_0x59cf('0x47'));if(_0x42b13a['role']===_0x59cf('0x46')){var _0x1314e3=_0x299145[_0x59cf('0x27')]({'plain':!![]});var _0x359cf4=_0x59cf('0x28');return db[_0x59cf('0x48')][_0x59cf('0x49')]({'where':{'name':_0x359cf4,'userProfileId':_0x42b13a['userProfileId']},'raw':!![]})[_0x59cf('0x25')](function(_0x4153a0){if(_0x4153a0&&_0x4153a0[_0x59cf('0x4a')]===0x0){return db['UserProfileResource'][_0x59cf('0x45')]({'name':_0x1314e3[_0x59cf('0x2b')],'resourceId':_0x1314e3['id'],'type':_0x4153a0[_0x59cf('0x2b')],'sectionId':_0x4153a0['id']},{})[_0x59cf('0x25')](function(){return _0x299145;});}else{return _0x299145;}})[_0x59cf('0x42')](function(_0x290b69){logger[_0x59cf('0x2a')](_0x59cf('0x4b'),_0x290b69);throw _0x290b69;});}return _0x299145;})[_0x59cf('0x25')](respondWithResult(_0x116e87,0xc9))[_0x59cf('0x42')](handleError(_0x116e87,null));};exports[_0x59cf('0x24')]=function(_0x4b9d6a,_0x2ba98b){if(_0x4b9d6a['body']['id']){delete _0x4b9d6a[_0x59cf('0x4c')]['id'];}return db[_0x59cf('0x2c')]['find']({'where':{'id':_0x4b9d6a[_0x59cf('0x44')]['id']}})[_0x59cf('0x25')](handleEntityNotFound(_0x2ba98b,null))[_0x59cf('0x25')](saveUpdates(_0x4b9d6a[_0x59cf('0x4c')],null))['then'](respondWithResult(_0x2ba98b,null))[_0x59cf('0x42')](handleError(_0x2ba98b,null));};exports[_0x59cf('0x26')]=function(_0xf8bf0a,_0x361cfc){return db['CmHopperAdditionalPhone'][_0x59cf('0x49')]({'where':{'id':_0xf8bf0a[_0x59cf('0x44')]['id']}})[_0x59cf('0x25')](handleEntityNotFound(_0x361cfc,null))['then'](removeEntity(_0x361cfc,null))[_0x59cf('0x42')](handleError(_0x361cfc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 0549c05..d03ef10 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 _0x0689=['define','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x0689,0x161));var _0x9068=function(_0x150199,_0x5d8234){_0x150199=_0x150199-0x0;var _0x50fa5c=_0x0689[_0x150199];return _0x50fa5c;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var logger=require('../../config/logger')(_0x9068('0x1'));var moment=require(_0x9068('0x2'));var BPromise=require(_0x9068('0x3'));var rp=require(_0x9068('0x4'));var fs=require('fs');var path=require(_0x9068('0x5'));var rimraf=require(_0x9068('0x6'));var config=require(_0x9068('0x7'));var attributes=require(_0x9068('0x8'));module[_0x9068('0x9')]=function(_0x287846,_0x5ce5a7){return _0x287846[_0x9068('0xa')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe157=['api','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x4caf6b,_0x1e60ea){var _0x29e73c=function(_0x1299ad){while(--_0x1299ad){_0x4caf6b['push'](_0x4caf6b['shift']());}};_0x29e73c(++_0x1e60ea);}(_0xe157,0x13c));var _0x7e15=function(_0x5c7eb9,_0x5307de){_0x5c7eb9=_0x5c7eb9-0x0;var _0x4d0189=_0xe157[_0x5c7eb9];return _0x4d0189;};'use strict';var _=require(_0x7e15('0x0'));var util=require(_0x7e15('0x1'));var logger=require(_0x7e15('0x2'))(_0x7e15('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e15('0x4'));var rimraf=require(_0x7e15('0x5'));var config=require(_0x7e15('0x6'));var attributes=require(_0x7e15('0x7'));module[_0x7e15('0x8')]=function(_0x331934,_0x422932){return _0x331934[_0x7e15('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x7e15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 2ee5b82..49a41d4 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 _0x2983=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','countnosuchnumberretry','countmachineretry','entity','SwapAdditionalPhones','CmHopper','duration','waitTime','scheduledat','add','minutes','isNil','phone','countabandonedretry','updatedAt','createdAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0x2983,0x11b));var _0x3298=function(_0x2a8637,_0x32ed82){_0x2a8637=_0x2a8637-0x0;var _0x169c18=_0x2983[_0x2a8637];return _0x169c18;};'use strict';var _=require(_0x3298('0x0'));var util=require(_0x3298('0x1'));var moment=require(_0x3298('0x2'));var BPromise=require(_0x3298('0x3'));var rs=require(_0x3298('0x4'));var fs=require('fs');var Redis=require(_0x3298('0x5'));var db=require(_0x3298('0x6'))['db'];var utils=require(_0x3298('0x7'));var logger=require(_0x3298('0x8'))(_0x3298('0x9'));var config=require(_0x3298('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3298('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a5440,_0x2a03b5,_0x218a70){return new BPromise(function(_0x22463e,_0x29f017){return client[_0x3298('0xc')](_0x4a5440,_0x218a70)['then'](function(_0x4ad233){logger[_0x3298('0xd')](_0x3298('0xe'),_0x2a03b5,_0x3298('0xf'));logger[_0x3298('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x2a03b5,_0x3298('0xf'),JSON[_0x3298('0x11')](_0x4ad233));if(_0x4ad233[_0x3298('0x12')]){if(_0x4ad233[_0x3298('0x12')][_0x3298('0x13')]===0x1f4){logger[_0x3298('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2a03b5,_0x4ad233[_0x3298('0x12')][_0x3298('0x14')]);return _0x29f017(_0x4ad233['error']['message']);}logger['error'](_0x3298('0xe'),_0x2a03b5,_0x4ad233[_0x3298('0x12')]['message']);return _0x22463e(_0x4ad233[_0x3298('0x12')][_0x3298('0x14')]);}else{logger['info'](_0x3298('0xe'),_0x2a03b5,_0x3298('0xf'));_0x22463e(_0x4ad233['result'][_0x3298('0x14')]);}})[_0x3298('0x15')](function(_0x282cd3){logger[_0x3298('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2a03b5,_0x282cd3);_0x29f017(_0x282cd3);});});}exports[_0x3298('0x16')]=function(_0x48ef62){var _0x2736c5=this;return new Promise(function(_0x2136ad,_0x60b6e5){return db['CmHopper'][_0x3298('0x17')]({'raw':!![],'where':{'ContactId':_0x48ef62[_0x3298('0x18')][_0x3298('0x19')],'ListId':_0x48ef62[_0x3298('0x18')][_0x3298('0x1a')],'VoiceQueueId':_0x48ef62[_0x3298('0x18')]['VoiceQueueId']===undefined?null:_0x48ef62[_0x3298('0x18')][_0x3298('0x1b')],'CampaignId':_0x48ef62['body'][_0x3298('0x1c')]===undefined?null:_0x48ef62[_0x3298('0x18')][_0x3298('0x1c')]}})[_0x3298('0x1d')](function(_0x19394c){if(_0x19394c!=null){return db[_0x3298('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x19394c['id'],'OrderBy':{'$gt':_0x19394c[_0x3298('0x1f')]}},'order':[[_0x3298('0x1f'),_0x3298('0x20')]]})[_0x3298('0x1d')](function(_0x561ab9){var _0x3ce8ec=0x0;if(_0x561ab9){if(_0x561ab9[_0x3298('0x21')]+_0x561ab9[_0x3298('0x22')]+_0x561ab9[_0x3298('0x23')]+_0x561ab9['countnosuchnumberretry']+_0x561ab9[_0x3298('0x24')]+_0x561ab9['countabandonedretry']+_0x561ab9['countmachineretry']+_0x561ab9[_0x3298('0x25')]<_0x48ef62['entity'][_0x3298('0x26')])_0x3ce8ec=0x1;_0x2136ad({'additional':_0x3ce8ec});}else{return db[_0x3298('0x1e')][_0x3298('0x17')]({'raw':!![],'where':{'CmHopperId':_0x19394c['id']},'order':[[_0x3298('0x1f'),_0x3298('0x20')]]})[_0x3298('0x1d')](function(_0x569aed){var _0x43d7f2=0x0;if(_0x569aed){if(_0x569aed[_0x3298('0x21')]+_0x569aed[_0x3298('0x22')]+_0x569aed[_0x3298('0x23')]+_0x569aed[_0x3298('0x27')]+_0x569aed[_0x3298('0x24')]+_0x569aed['countabandonedretry']+_0x569aed[_0x3298('0x28')]+_0x569aed['countagentrejectretry']<_0x48ef62[_0x3298('0x29')][_0x3298('0x26')])_0x43d7f2=0x1;_0x2136ad({'additional':_0x43d7f2});}else{_0x2136ad({'additional':0x0});}})[_0x3298('0x15')](function(_0x4f5d96){logger[_0x3298('0x12')](_0x3298('0x16'),_0x4f5d96[_0x3298('0x14')]);_0x60b6e5(_0x2736c5['error'](0x1f4,_0x4f5d96[_0x3298('0x14')]));});}})[_0x3298('0x15')](function(_0x4e6b6b){logger[_0x3298('0x12')](_0x3298('0x16'),_0x4e6b6b['message']);_0x60b6e5(_0x2736c5[_0x3298('0x12')](0x1f4,_0x4e6b6b[_0x3298('0x14')]));});}else _0x2136ad({'additional':0x0});});});};exports[_0x3298('0x2a')]=function(_0x107f22){var _0x3f0eef=this;return new Promise(function(_0x28687a,_0x48236d){return db[_0x3298('0x2b')][_0x3298('0x17')]({'raw':!![],'where':{'ContactId':_0x107f22[_0x3298('0x18')][_0x3298('0x19')],'ListId':_0x107f22[_0x3298('0x18')]['ListId'],'VoiceQueueId':_0x107f22[_0x3298('0x18')]['VoiceQueueId']===undefined?null:_0x107f22['body'][_0x3298('0x1b')],'CampaignId':_0x107f22[_0x3298('0x18')][_0x3298('0x1c')]===undefined?null:_0x107f22[_0x3298('0x18')][_0x3298('0x1c')]}})[_0x3298('0x1d')](function(_0x2ee3d1){if(_0x2ee3d1!=null){return db[_0x3298('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x2ee3d1['id'],'OrderBy':{'$gte':_0x2ee3d1[_0x3298('0x1f')]}},'order':[[_0x3298('0x1f'),'ASC']]})[_0x3298('0x1d')](function(_0x467261){if(_0x467261)return activateAdditionalPhone(_0x2ee3d1,_0x107f22[_0x3298('0x18')],_0x467261,_0x107f22[_0x3298('0x2c')],_0x107f22[_0x3298('0x2d')])['then'](function(_0x12d9f7){_0x28687a(_0x12d9f7);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2ee3d1['id']},'order':[[_0x3298('0x1f'),_0x3298('0x20')]]})[_0x3298('0x1d')](function(_0x4bb4eb){if(_0x4bb4eb)return activateAdditionalPhone(_0x2ee3d1,_0x107f22[_0x3298('0x18')],_0x4bb4eb,_0x107f22[_0x3298('0x2c')],_0x107f22['waitTime'])[_0x3298('0x1d')](function(_0x1fa9be){_0x28687a(_0x1fa9be);});else{_0x28687a({'id':_0x2ee3d1['id'],'phone':''});}})[_0x3298('0x15')](function(_0x56bf9e){logger[_0x3298('0x12')](_0x3298('0x16'),_0x56bf9e[_0x3298('0x14')]);_0x48236d(_0x3f0eef['error'](0x1f4,_0x56bf9e['message']));});}})[_0x3298('0x15')](function(_0x569d12){logger[_0x3298('0x12')]('VerifyAdditionalPhones',_0x569d12['message']);_0x48236d(_0x3f0eef['error'](0x1f4,_0x569d12[_0x3298('0x14')]));});}else _0x28687a(0x1);});});};function activateAdditionalPhone(_0x2539e7,_0x18cacd,_0x2feab9,_0x335513,_0x1f43c2){return new Promise(function(_0x48c02a,_0x46ddd7){var _0x4d3484;if(_['isNil'](_0x2feab9[_0x3298('0x2e')])){_0x2feab9[_0x3298('0x2e')]=moment();}if(moment()>moment(_0x2feab9[_0x3298('0x2e')])){_0x4d3484=moment()[_0x3298('0x2f')](_0x1f43c2||0x3,_0x3298('0x30'));}else{if(_0x2feab9[_0x3298('0x1f')]==0x0){_0x4d3484=moment(_0x2feab9[_0x3298('0x2e')]);}else{_0x4d3484=moment()[_0x3298('0x2f')](_0x1f43c2||0x3,_0x3298('0x30'));}}if(_[_0x3298('0x31')](_0x4d3484)){_0x4d3484=moment()['add'](_0x1f43c2||0x3,_0x3298('0x30'));}var _0x267211={'phone':_0x2539e7[_0x3298('0x32')],'active':0x0,'OrderBy':_[_0x3298('0x31')](_0x2539e7[_0x3298('0x1f')])?0x0:_0x2539e7['OrderBy'],'scheduledat':moment()[_0x3298('0x2f')](_0x335513||0x1,_0x3298('0x30')),'countbusyretry':_0x18cacd[_0x3298('0x21')],'countcongestionretry':_0x18cacd['countcongestionretry'],'countnoanswerretry':_0x18cacd[_0x3298('0x23')],'countnosuchnumberretry':_0x18cacd[_0x3298('0x27')],'countdropretry':_0x18cacd[_0x3298('0x24')],'countabandonedretry':_0x18cacd[_0x3298('0x33')],'countmachineretry':_0x18cacd[_0x3298('0x28')],'countagentrejectretry':_0x18cacd['countagentrejectretry'],'createdAt':_0x18cacd['createdAt'],'updatedAt':_0x18cacd[_0x3298('0x34')]};var _0x522594={'CmHopperId':_0x2539e7['id'],'phone':_0x2feab9[_0x3298('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x2feab9[_0x3298('0x1f')])?0x0:_0x2feab9[_0x3298('0x1f')],'scheduledat':_0x4d3484,'countbusyretry':_0x2feab9[_0x3298('0x21')],'countcongestionretry':_0x2feab9[_0x3298('0x22')],'countnoanswerretry':_0x2feab9[_0x3298('0x23')],'countnosuchnumberretry':_0x2feab9[_0x3298('0x27')],'countdropretry':_0x2feab9[_0x3298('0x24')],'countabandonedretry':_0x2feab9['countabandonedretry'],'countmachineretry':_0x2feab9[_0x3298('0x28')],'countagentrejectretry':_0x2feab9[_0x3298('0x25')],'createdAt':_0x2feab9[_0x3298('0x35')],'updatedAt':_0x2feab9[_0x3298('0x34')]};return db[_0x3298('0x36')]['transaction'](function(_0x394148){return db[_0x3298('0x1e')][_0x3298('0x37')](_0x267211,{'where':{'id':_0x2feab9['id']}},{'transaction':_0x394148})[_0x3298('0x1d')](function(){return db[_0x3298('0x2b')][_0x3298('0x37')](_0x522594,{'where':{'id':_0x2539e7['id']}},{'transaction':_0x394148});});})[_0x3298('0x1d')](function(_0x1e4051){_0x48c02a({'id':_0x2539e7['id'],'phone':_0x2feab9['phone']});})[_0x3298('0x15')](function(_0x5a5743){logger[_0x3298('0x12')](_0x3298('0x38'),_0x5a5743[_0x3298('0x14')]);_0x46ddd7({'error':_0x5a5743['message']});});});}exports[_0x3298('0x39')]=function(_0x593860){var _0x29f96a=this;return new Promise(function(_0x3b60ef,_0x163862){return db[_0x3298('0x2b')][_0x3298('0x37')](_0x593860[_0x3298('0x18')]['field'],{'where':{'id':_0x593860[_0x3298('0x18')]['id']}})[_0x3298('0x1d')](function(_0x5cb332){_0x3b60ef(_0x5cb332);})[_0x3298('0x15')](function(_0x48f523){logger['error'](_0x3298('0x39'),_0x48f523[_0x3298('0x14')]);_0x163862(_0x29f96a[_0x3298('0x12')](0x1f4,_0x48f523[_0x3298('0x14')]));});});}; \ No newline at end of file +var _0x4d07=['jayson/promise','then','info','debug','request\x20sent','stringify','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','OrderBy','ASC','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','countcongestionretry','countnoanswerretry','countagentrejectretry','SwapAdditionalPhones','ListId','CampaignId','CmHopperAdditionalPhone','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5a14d2,_0x22b89a){var _0xb08187=function(_0x541eeb){while(--_0x541eeb){_0x5a14d2['push'](_0x5a14d2['shift']());}};_0xb08187(++_0x22b89a);}(_0x4d07,0x1ad));var _0x74d0=function(_0x4a372d,_0x3bd91f){_0x4a372d=_0x4a372d-0x0;var _0x546ac0=_0x4d07[_0x4a372d];return _0x546ac0;};'use strict';var _=require(_0x74d0('0x0'));var util=require(_0x74d0('0x1'));var moment=require(_0x74d0('0x2'));var BPromise=require(_0x74d0('0x3'));var rs=require(_0x74d0('0x4'));var fs=require('fs');var Redis=require(_0x74d0('0x5'));var db=require(_0x74d0('0x6'))['db'];var utils=require(_0x74d0('0x7'));var logger=require(_0x74d0('0x8'))(_0x74d0('0x9'));var config=require(_0x74d0('0xa'));var jayson=require(_0x74d0('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x488cbe,_0x520d68,_0x1bd416){return new BPromise(function(_0x1fb039,_0x2a18b0){return client['request'](_0x488cbe,_0x1bd416)[_0x74d0('0xc')](function(_0x1553b9){logger[_0x74d0('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x520d68,'request\x20sent');logger[_0x74d0('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x520d68,_0x74d0('0xf'),JSON[_0x74d0('0x10')](_0x1553b9));if(_0x1553b9[_0x74d0('0x11')]){if(_0x1553b9[_0x74d0('0x11')]['code']===0x1f4){logger[_0x74d0('0x11')](_0x74d0('0x12'),_0x520d68,_0x1553b9[_0x74d0('0x11')]['message']);return _0x2a18b0(_0x1553b9['error'][_0x74d0('0x13')]);}logger[_0x74d0('0x11')](_0x74d0('0x12'),_0x520d68,_0x1553b9[_0x74d0('0x11')][_0x74d0('0x13')]);return _0x1fb039(_0x1553b9[_0x74d0('0x11')]['message']);}else{logger[_0x74d0('0xd')](_0x74d0('0x12'),_0x520d68,'request\x20sent');_0x1fb039(_0x1553b9[_0x74d0('0x14')][_0x74d0('0x13')]);}})[_0x74d0('0x15')](function(_0x5a4f3b){logger[_0x74d0('0x11')](_0x74d0('0x12'),_0x520d68,_0x5a4f3b);_0x2a18b0(_0x5a4f3b);});});}exports[_0x74d0('0x16')]=function(_0xc40c3a){var _0x46780c=this;return new Promise(function(_0x38f43c,_0x1ebb37){return db[_0x74d0('0x17')][_0x74d0('0x18')]({'raw':!![],'where':{'ContactId':_0xc40c3a[_0x74d0('0x19')][_0x74d0('0x1a')],'ListId':_0xc40c3a[_0x74d0('0x19')]['ListId'],'VoiceQueueId':_0xc40c3a['body'][_0x74d0('0x1b')]===undefined?null:_0xc40c3a[_0x74d0('0x19')]['VoiceQueueId'],'CampaignId':_0xc40c3a[_0x74d0('0x19')]['CampaignId']===undefined?null:_0xc40c3a[_0x74d0('0x19')]['CampaignId']}})['then'](function(_0x2a4eae){if(_0x2a4eae!=null){return db['CmHopperAdditionalPhone'][_0x74d0('0x18')]({'raw':!![],'where':{'CmHopperId':_0x2a4eae['id'],'OrderBy':{'$gt':_0x2a4eae['OrderBy']}},'order':[[_0x74d0('0x1c'),_0x74d0('0x1d')]]})['then'](function(_0x1d9165){var _0x34848e=0x0;if(_0x1d9165){if(_0x1d9165[_0x74d0('0x1e')]+_0x1d9165['countcongestionretry']+_0x1d9165['countnoanswerretry']+_0x1d9165[_0x74d0('0x1f')]+_0x1d9165[_0x74d0('0x20')]+_0x1d9165[_0x74d0('0x21')]+_0x1d9165[_0x74d0('0x22')]+_0x1d9165['countagentrejectretry']<_0xc40c3a[_0x74d0('0x23')]['dialGlobalMaxRetry'])_0x34848e=0x1;_0x38f43c({'additional':_0x34848e});}else{return db['CmHopperAdditionalPhone'][_0x74d0('0x18')]({'raw':!![],'where':{'CmHopperId':_0x2a4eae['id']},'order':[[_0x74d0('0x1c'),_0x74d0('0x1d')]]})[_0x74d0('0xc')](function(_0x4a16cd){var _0x373484=0x0;if(_0x4a16cd){if(_0x4a16cd['countbusyretry']+_0x4a16cd[_0x74d0('0x24')]+_0x4a16cd[_0x74d0('0x25')]+_0x4a16cd['countnosuchnumberretry']+_0x4a16cd[_0x74d0('0x20')]+_0x4a16cd[_0x74d0('0x21')]+_0x4a16cd[_0x74d0('0x22')]+_0x4a16cd[_0x74d0('0x26')]<_0xc40c3a[_0x74d0('0x23')]['dialGlobalMaxRetry'])_0x373484=0x1;_0x38f43c({'additional':_0x373484});}else{_0x38f43c({'additional':0x0});}})['catch'](function(_0x1d3f52){logger[_0x74d0('0x11')](_0x74d0('0x16'),_0x1d3f52['message']);_0x1ebb37(_0x46780c['error'](0x1f4,_0x1d3f52[_0x74d0('0x13')]));});}})[_0x74d0('0x15')](function(_0x305a55){logger[_0x74d0('0x11')](_0x74d0('0x16'),_0x305a55[_0x74d0('0x13')]);_0x1ebb37(_0x46780c['error'](0x1f4,_0x305a55[_0x74d0('0x13')]));});}else _0x38f43c({'additional':0x0});});});};exports[_0x74d0('0x27')]=function(_0x6c4ea5){var _0x117b8b=this;return new Promise(function(_0x169a9a,_0x5e1893){return db[_0x74d0('0x17')][_0x74d0('0x18')]({'raw':!![],'where':{'ContactId':_0x6c4ea5[_0x74d0('0x19')]['ContactId'],'ListId':_0x6c4ea5['body'][_0x74d0('0x28')],'VoiceQueueId':_0x6c4ea5[_0x74d0('0x19')][_0x74d0('0x1b')]===undefined?null:_0x6c4ea5[_0x74d0('0x19')][_0x74d0('0x1b')],'CampaignId':_0x6c4ea5[_0x74d0('0x19')][_0x74d0('0x29')]===undefined?null:_0x6c4ea5[_0x74d0('0x19')]['CampaignId']}})[_0x74d0('0xc')](function(_0x37f61f){if(_0x37f61f!=null){return db[_0x74d0('0x2a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x37f61f['id'],'OrderBy':{'$gte':_0x37f61f['OrderBy']}},'order':[[_0x74d0('0x1c'),_0x74d0('0x1d')]]})['then'](function(_0xdf3b5){if(_0xdf3b5)return activateAdditionalPhone(_0x37f61f,_0x6c4ea5[_0x74d0('0x19')],_0xdf3b5,_0x6c4ea5[_0x74d0('0x2b')],_0x6c4ea5['waitTime'])['then'](function(_0x20d07f){_0x169a9a(_0x20d07f);});else{return db[_0x74d0('0x2a')][_0x74d0('0x18')]({'raw':!![],'where':{'CmHopperId':_0x37f61f['id']},'order':[[_0x74d0('0x1c'),_0x74d0('0x1d')]]})['then'](function(_0x143b94){if(_0x143b94)return activateAdditionalPhone(_0x37f61f,_0x6c4ea5[_0x74d0('0x19')],_0x143b94,_0x6c4ea5[_0x74d0('0x2b')],_0x6c4ea5[_0x74d0('0x2c')])['then'](function(_0x580487){_0x169a9a(_0x580487);});else{_0x169a9a({'id':_0x37f61f['id'],'phone':''});}})[_0x74d0('0x15')](function(_0x28d7e5){logger[_0x74d0('0x11')](_0x74d0('0x16'),_0x28d7e5[_0x74d0('0x13')]);_0x5e1893(_0x117b8b['error'](0x1f4,_0x28d7e5[_0x74d0('0x13')]));});}})[_0x74d0('0x15')](function(_0x5a1c18){logger[_0x74d0('0x11')]('VerifyAdditionalPhones',_0x5a1c18[_0x74d0('0x13')]);_0x5e1893(_0x117b8b[_0x74d0('0x11')](0x1f4,_0x5a1c18[_0x74d0('0x13')]));});}else _0x169a9a(0x1);});});};function activateAdditionalPhone(_0x36b070,_0x50b533,_0x17ff97,_0x1b08f4,_0x126dcf){return new Promise(function(_0xb4b992,_0x4e6cfa){var _0x3bfe5c;if(_[_0x74d0('0x2d')](_0x17ff97[_0x74d0('0x2e')])){_0x17ff97['scheduledat']=moment();}if(moment()>moment(_0x17ff97['scheduledat'])){_0x3bfe5c=moment()[_0x74d0('0x2f')](_0x126dcf||0x3,_0x74d0('0x30'));}else{if(_0x17ff97[_0x74d0('0x1c')]==0x0){_0x3bfe5c=moment(_0x17ff97[_0x74d0('0x2e')]);}else{_0x3bfe5c=moment()[_0x74d0('0x2f')](_0x126dcf||0x3,_0x74d0('0x30'));}}if(_[_0x74d0('0x2d')](_0x3bfe5c)){_0x3bfe5c=moment()[_0x74d0('0x2f')](_0x126dcf||0x3,_0x74d0('0x30'));}var _0xbda7d={'phone':_0x36b070[_0x74d0('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x36b070[_0x74d0('0x1c')])?0x0:_0x36b070[_0x74d0('0x1c')],'scheduledat':moment()[_0x74d0('0x2f')](_0x1b08f4||0x1,_0x74d0('0x30')),'countbusyretry':_0x50b533['countbusyretry'],'countcongestionretry':_0x50b533[_0x74d0('0x24')],'countnoanswerretry':_0x50b533[_0x74d0('0x25')],'countnosuchnumberretry':_0x50b533[_0x74d0('0x1f')],'countdropretry':_0x50b533[_0x74d0('0x20')],'countabandonedretry':_0x50b533[_0x74d0('0x21')],'countmachineretry':_0x50b533[_0x74d0('0x22')],'countagentrejectretry':_0x50b533['countagentrejectretry'],'createdAt':_0x50b533[_0x74d0('0x32')],'updatedAt':_0x50b533['updatedAt']};var _0x1b0295={'CmHopperId':_0x36b070['id'],'phone':_0x17ff97[_0x74d0('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x17ff97[_0x74d0('0x1c')])?0x0:_0x17ff97[_0x74d0('0x1c')],'scheduledat':_0x3bfe5c,'countbusyretry':_0x17ff97[_0x74d0('0x1e')],'countcongestionretry':_0x17ff97[_0x74d0('0x24')],'countnoanswerretry':_0x17ff97[_0x74d0('0x25')],'countnosuchnumberretry':_0x17ff97['countnosuchnumberretry'],'countdropretry':_0x17ff97[_0x74d0('0x20')],'countabandonedretry':_0x17ff97[_0x74d0('0x21')],'countmachineretry':_0x17ff97[_0x74d0('0x22')],'countagentrejectretry':_0x17ff97[_0x74d0('0x26')],'createdAt':_0x17ff97[_0x74d0('0x32')],'updatedAt':_0x17ff97[_0x74d0('0x33')]};return db['sequelize']['transaction'](function(_0x3de8bc){return db['CmHopperAdditionalPhone'][_0x74d0('0x34')](_0xbda7d,{'where':{'id':_0x17ff97['id']}},{'transaction':_0x3de8bc})[_0x74d0('0xc')](function(){return db[_0x74d0('0x17')][_0x74d0('0x34')](_0x1b0295,{'where':{'id':_0x36b070['id']}},{'transaction':_0x3de8bc});});})[_0x74d0('0xc')](function(_0x2f62b7){_0xb4b992({'id':_0x36b070['id'],'phone':_0x17ff97[_0x74d0('0x31')]});})['catch'](function(_0x579733){logger[_0x74d0('0x11')](_0x74d0('0x35'),_0x579733['message']);_0x4e6cfa({'error':_0x579733[_0x74d0('0x13')]});});});}exports[_0x74d0('0x36')]=function(_0x259ee1){var _0x16ffbd=this;return new Promise(function(_0x382b0b,_0x165bdd){return db[_0x74d0('0x17')][_0x74d0('0x34')](_0x259ee1[_0x74d0('0x19')]['field'],{'where':{'id':_0x259ee1[_0x74d0('0x19')]['id']}})[_0x74d0('0xc')](function(_0x2d2c53){_0x382b0b(_0x2d2c53);})[_0x74d0('0x15')](function(_0x36b58f){logger[_0x74d0('0x11')](_0x74d0('0x36'),_0x36b58f['message']);_0x165bdd(_0x16ffbd[_0x74d0('0x11')](0x1f4,_0x36b58f['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 90fd5be..8241064 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 _0x29d2=['exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','post','put','update','delete','/:id','destroy'];(function(_0x288bb5,_0x44bcbb){var _0x500d91=function(_0x48d7f4){while(--_0x48d7f4){_0x288bb5['push'](_0x288bb5['shift']());}};_0x500d91(++_0x44bcbb);}(_0x29d2,0x67));var _0x229d=function(_0x572288,_0x582c20){_0x572288=_0x572288-0x0;var _0x5bd358=_0x29d2[_0x572288];return _0x5bd358;};'use strict';var multer=require(_0x229d('0x0'));var util=require('util');var path=require(_0x229d('0x1'));var timeout=require('connect-timeout');var express=require(_0x229d('0x2'));var router=express[_0x229d('0x3')]();var fs_extra=require(_0x229d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x229d('0x5'));var config=require('../../config/environment');var controller=require(_0x229d('0x6'));router[_0x229d('0x7')]('/',auth[_0x229d('0x8')](),controller[_0x229d('0x9')]);router[_0x229d('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x229d('0xa')]('/',auth[_0x229d('0x8')](),controller['create']);router[_0x229d('0xb')]('/:id',auth[_0x229d('0x8')](),controller[_0x229d('0xc')]);router[_0x229d('0xd')](_0x229d('0xe'),auth[_0x229d('0x8')](),controller[_0x229d('0xf')]);module[_0x229d('0x10')]=router; \ No newline at end of file +var _0x50c0=['./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0x50c0,0xd0));var _0x050c=function(_0x598f1f,_0xa7d1c){_0x598f1f=_0x598f1f-0x0;var _0x26d77d=_0x50c0[_0x598f1f];return _0x26d77d;};'use strict';var multer=require(_0x050c('0x0'));var util=require('util');var path=require(_0x050c('0x1'));var timeout=require(_0x050c('0x2'));var express=require('express');var router=express[_0x050c('0x3')]();var fs_extra=require(_0x050c('0x4'));var auth=require(_0x050c('0x5'));var interaction=require(_0x050c('0x6'));var config=require(_0x050c('0x7'));var controller=require(_0x050c('0x8'));router[_0x050c('0x9')]('/',auth[_0x050c('0xa')](),controller[_0x050c('0xb')]);router['get'](_0x050c('0xc'),auth[_0x050c('0xa')](),controller[_0x050c('0xd')]);router['post']('/',auth[_0x050c('0xa')](),controller['create']);router[_0x050c('0xe')](_0x050c('0xc'),auth[_0x050c('0xa')](),controller['update']);router[_0x050c('0xf')](_0x050c('0xc'),auth[_0x050c('0xa')](),controller[_0x050c('0x10')]);module[_0x050c('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 a569d61..b20e226 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 _0xcfeb=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfeb,0x1b2));var _0xbcfe=function(_0xef1e4c,_0x5cb9ae){_0xef1e4c=_0xef1e4c-0x0;var _0x203904=_0xcfeb[_0xef1e4c];return _0x203904;};'use strict';var moment=require(_0xbcfe('0x0'));var Sequelize=require(_0xbcfe('0x1'));module[_0xbcfe('0x2')]={'phone':{'type':Sequelize[_0xbcfe('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xbcfe('0x4')],'unique':_0xbcfe('0x5')},'VoiceQueueId':{'type':Sequelize[_0xbcfe('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x02b6=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x7f87e0,_0x4fb109){var _0x54603c=function(_0x4d0cb1){while(--_0x4d0cb1){_0x7f87e0['push'](_0x7f87e0['shift']());}};_0x54603c(++_0x4fb109);}(_0x02b6,0xfe));var _0x602b=function(_0x58f971,_0x5336f8){_0x58f971=_0x58f971-0x0;var _0x33f9d6=_0x02b6[_0x58f971];return _0x33f9d6;};'use strict';var moment=require(_0x602b('0x0'));var Sequelize=require('sequelize');module[_0x602b('0x1')]={'phone':{'type':Sequelize[_0x602b('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x602b('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x602b('0x4')},'VoiceQueueId':{'type':Sequelize[_0x602b('0x3')],'unique':_0x602b('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index d38ddcc..9109a69 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 _0x7a47=['../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','index','CmHopperBlack','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','order','where','filter','VIRTUAL','merge','includeAll','include','rows','show','params','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2a8bd5,_0xcbf63){var _0x3675a6=function(_0x3744ef){while(--_0x3744ef){_0x2a8bd5['push'](_0x2a8bd5['shift']());}};_0x3675a6(++_0xcbf63);}(_0x7a47,0xbf));var _0x77a4=function(_0x5e9a72,_0x4ad204){_0x5e9a72=_0x5e9a72-0x0;var _0x571b77=_0x7a47[_0x5e9a72];return _0x571b77;};'use strict';var emlformat=require(_0x77a4('0x0'));var rimraf=require(_0x77a4('0x1'));var zipdir=require(_0x77a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77a4('0x3'));var moment=require(_0x77a4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77a4('0x5'));var util=require(_0x77a4('0x6'));var path=require(_0x77a4('0x7'));var sox=require(_0x77a4('0x8'));var csv=require(_0x77a4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77a4('0xa'));var _=require(_0x77a4('0xb'));var squel=require(_0x77a4('0xc'));var crypto=require(_0x77a4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x77a4('0xe'));var toCsv=require(_0x77a4('0x9'));var querystring=require(_0x77a4('0xf'));var Papa=require(_0x77a4('0x10'));var Redis=require('ioredis');var authService=require(_0x77a4('0x11'));var qs=require(_0x77a4('0x12'));var as=require(_0x77a4('0x13'));var hardwareService=require(_0x77a4('0x14'));var logger=require(_0x77a4('0x15'))(_0x77a4('0x16'));var utils=require(_0x77a4('0x17'));var config=require(_0x77a4('0x18'));var licenseUtil=require(_0x77a4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b45dd,_0x5b119f){_0x5b119f=_0x5b119f||0xcc;return function(_0x464253){if(_0x464253){return _0x4b45dd[_0x77a4('0x1a')](_0x5b119f);}return _0x4b45dd['status'](_0x5b119f)[_0x77a4('0x1b')]();};}function respondWithResult(_0x63c3f8,_0x76f51b){_0x76f51b=_0x76f51b||0xc8;return function(_0x4867a8){if(_0x4867a8){return _0x63c3f8[_0x77a4('0x1c')](_0x76f51b)['json'](_0x4867a8);}};}function respondWithFilteredResult(_0x416d9d,_0x1a4d6d){return function(_0x2b7740){if(_0x2b7740){var _0x15f31f=typeof _0x1a4d6d[_0x77a4('0x1d')]===_0x77a4('0x1e')&&typeof _0x1a4d6d[_0x77a4('0x1f')]==='undefined';var _0x513480=_0x2b7740[_0x77a4('0x20')];var _0x146e48=_0x15f31f?0x0:_0x1a4d6d[_0x77a4('0x1d')];var _0x23cf09=_0x15f31f?_0x2b7740[_0x77a4('0x20')]:_0x1a4d6d[_0x77a4('0x1d')]+_0x1a4d6d[_0x77a4('0x1f')];var _0xa0b2a6;if(_0x23cf09>=_0x513480){_0x23cf09=_0x513480;_0xa0b2a6=0xc8;}else{_0xa0b2a6=0xce;}_0x416d9d['status'](_0xa0b2a6);return _0x416d9d['set'](_0x77a4('0x21'),_0x146e48+'-'+_0x23cf09+'/'+_0x513480)[_0x77a4('0x22')](_0x2b7740);}return null;};}function patchUpdates(_0x2cdc65){return function(_0x25ff98){try{jsonpatch[_0x77a4('0x23')](_0x25ff98,_0x2cdc65,!![]);}catch(_0xf6cd22){return BPromise[_0x77a4('0x24')](_0xf6cd22);}return _0x25ff98[_0x77a4('0x25')]();};}function saveUpdates(_0x2315bb,_0x46839a){return function(_0x5b90cb){if(_0x5b90cb){return _0x5b90cb[_0x77a4('0x26')](_0x2315bb)[_0x77a4('0x27')](function(_0xe1ec87){return _0xe1ec87;});}return null;};}function removeEntity(_0x28ba99,_0x317d25){return function(_0x3a7d4c){if(_0x3a7d4c){return _0x3a7d4c[_0x77a4('0x28')]()[_0x77a4('0x27')](function(){_0x28ba99[_0x77a4('0x1c')](0xcc)[_0x77a4('0x1b')]();});}};}function handleEntityNotFound(_0xb5e394,_0x899214){return function(_0x5ccf21){if(!_0x5ccf21){_0xb5e394[_0x77a4('0x1a')](0x194);}return _0x5ccf21;};}function handleError(_0x2aced9,_0x5d5dbe){_0x5d5dbe=_0x5d5dbe||0x1f4;return function(_0x38252b){logger['error'](_0x38252b['stack']);if(_0x38252b[_0x77a4('0x29')]){delete _0x38252b[_0x77a4('0x29')];}_0x2aced9[_0x77a4('0x1c')](_0x5d5dbe)['send'](_0x38252b);};}exports[_0x77a4('0x2a')]=function(_0x26edf6,_0x16d441){var _0x294c2f={},_0x2391dc={},_0x39bab5={'count':0x0,'rows':[]};var _0x12450f=_['map'](db[_0x77a4('0x2b')][_0x77a4('0x2c')],function(_0x34acf8){return{'name':_0x34acf8[_0x77a4('0x2d')],'type':_0x34acf8[_0x77a4('0x2e')][_0x77a4('0x2f')]};});_0x2391dc['model']=_[_0x77a4('0x30')](_0x12450f,'name');_0x2391dc[_0x77a4('0x31')]=_[_0x77a4('0x32')](_0x26edf6[_0x77a4('0x31')]);_0x2391dc[_0x77a4('0x33')]=_[_0x77a4('0x34')](_0x2391dc[_0x77a4('0x35')],_0x2391dc['query']);_0x294c2f[_0x77a4('0x36')]=_[_0x77a4('0x34')](_0x2391dc[_0x77a4('0x35')],qs[_0x77a4('0x37')](_0x26edf6[_0x77a4('0x31')][_0x77a4('0x37')]));_0x294c2f[_0x77a4('0x36')]=_0x294c2f[_0x77a4('0x36')][_0x77a4('0x38')]?_0x294c2f[_0x77a4('0x36')]:_0x2391dc[_0x77a4('0x35')];if(!_0x26edf6[_0x77a4('0x31')]['hasOwnProperty']('nolimit')){_0x294c2f[_0x77a4('0x1f')]=qs[_0x77a4('0x1f')](_0x26edf6[_0x77a4('0x31')][_0x77a4('0x1f')]);_0x294c2f['offset']=qs[_0x77a4('0x1d')](_0x26edf6[_0x77a4('0x31')]['offset']);}_0x294c2f[_0x77a4('0x39')]=qs['sort'](_0x26edf6['query']['sort']);_0x294c2f[_0x77a4('0x3a')]=qs[_0x77a4('0x33')](_['pick'](_0x26edf6[_0x77a4('0x31')],_0x2391dc[_0x77a4('0x33')]),_0x12450f);if(_0x26edf6[_0x77a4('0x31')][_0x77a4('0x3b')]){_0x294c2f['where']=_['merge'](_0x294c2f[_0x77a4('0x3a')],{'$or':_[_0x77a4('0x30')](_0x12450f,function(_0xc69f21){if(_0xc69f21[_0x77a4('0x2e')]!==_0x77a4('0x3c')){var _0x3e5195={};_0x3e5195[_0xc69f21['name']]={'$like':'%'+_0x26edf6[_0x77a4('0x31')][_0x77a4('0x3b')]+'%'};return _0x3e5195;}})});}_0x294c2f=_[_0x77a4('0x3d')]({},_0x294c2f,_0x26edf6['options']);var _0x19a7ea={'where':_0x294c2f[_0x77a4('0x3a')]};return db['CmHopperBlack']['count'](_0x19a7ea)[_0x77a4('0x27')](function(_0x3598c3){_0x39bab5[_0x77a4('0x20')]=_0x3598c3;if(_0x26edf6['query'][_0x77a4('0x3e')]){_0x294c2f[_0x77a4('0x3f')]=[{'all':!![]}];}return db[_0x77a4('0x2b')]['findAll'](_0x294c2f);})[_0x77a4('0x27')](function(_0x23e280){_0x39bab5[_0x77a4('0x40')]=_0x23e280;return _0x39bab5;})[_0x77a4('0x27')](respondWithFilteredResult(_0x16d441,_0x294c2f))['catch'](handleError(_0x16d441,null));};exports[_0x77a4('0x41')]=function(_0x5633c5,_0x7b8454){var _0xf2481b={'raw':!![],'where':{'id':_0x5633c5[_0x77a4('0x42')]['id']}},_0x4056de={};_0x4056de[_0x77a4('0x35')]=_[_0x77a4('0x32')](db[_0x77a4('0x2b')][_0x77a4('0x2c')]);_0x4056de[_0x77a4('0x31')]=_[_0x77a4('0x32')](_0x5633c5['query']);_0x4056de[_0x77a4('0x33')]=_[_0x77a4('0x34')](_0x4056de[_0x77a4('0x35')],_0x4056de[_0x77a4('0x31')]);_0xf2481b[_0x77a4('0x36')]=_[_0x77a4('0x34')](_0x4056de[_0x77a4('0x35')],qs['fields'](_0x5633c5[_0x77a4('0x31')][_0x77a4('0x37')]));_0xf2481b[_0x77a4('0x36')]=_0xf2481b[_0x77a4('0x36')][_0x77a4('0x38')]?_0xf2481b[_0x77a4('0x36')]:_0x4056de[_0x77a4('0x35')];if(_0x5633c5[_0x77a4('0x31')][_0x77a4('0x3e')]){_0xf2481b[_0x77a4('0x3f')]=[{'all':!![]}];}_0xf2481b=_[_0x77a4('0x3d')]({},_0xf2481b,_0x5633c5[_0x77a4('0x43')]);return db['CmHopperBlack'][_0x77a4('0x44')](_0xf2481b)[_0x77a4('0x27')](handleEntityNotFound(_0x7b8454,null))[_0x77a4('0x27')](respondWithResult(_0x7b8454,null))[_0x77a4('0x45')](handleError(_0x7b8454,null));};exports[_0x77a4('0x26')]=function(_0x229553,_0x34934c){if(_0x229553[_0x77a4('0x46')]['id']){delete _0x229553[_0x77a4('0x46')]['id'];}return db[_0x77a4('0x2b')][_0x77a4('0x44')]({'where':{'id':_0x229553[_0x77a4('0x42')]['id']}})[_0x77a4('0x27')](handleEntityNotFound(_0x34934c,null))[_0x77a4('0x27')](saveUpdates(_0x229553[_0x77a4('0x46')],null))['then'](respondWithResult(_0x34934c,null))['catch'](handleError(_0x34934c,null));};exports[_0x77a4('0x28')]=function(_0xfaa270,_0x452759){return db[_0x77a4('0x2b')][_0x77a4('0x44')]({'where':{'id':_0xfaa270[_0x77a4('0x42')]['id']}})[_0x77a4('0x27')](handleEntityNotFound(_0x452759,null))[_0x77a4('0x27')](removeEntity(_0x452759,null))[_0x77a4('0x45')](handleError(_0x452759,null));};exports[_0x77a4('0x47')]=function(_0x3888a2,_0x1b4ae8){return db[_0x77a4('0x2b')][_0x77a4('0x47')]()[_0x77a4('0x27')](respondWithResult(_0x1b4ae8,null))[_0x77a4('0x45')](handleError(_0x1b4ae8,null));}; \ No newline at end of file +var _0xaf73=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','CmHopperBlack','find','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','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','map','rawAttributes','key','model','query'];(function(_0x341a67,_0x230d99){var _0x35007a=function(_0x5aaa62){while(--_0x5aaa62){_0x341a67['push'](_0x341a67['shift']());}};_0x35007a(++_0x230d99);}(_0xaf73,0x149));var _0x3af7=function(_0x2cc671,_0x6a8aa5){_0x2cc671=_0x2cc671-0x0;var _0x1977a2=_0xaf73[_0x2cc671];return _0x1977a2;};'use strict';var emlformat=require(_0x3af7('0x0'));var rimraf=require(_0x3af7('0x1'));var zipdir=require(_0x3af7('0x2'));var jsonpatch=require(_0x3af7('0x3'));var rp=require(_0x3af7('0x4'));var moment=require(_0x3af7('0x5'));var BPromise=require(_0x3af7('0x6'));var Mustache=require(_0x3af7('0x7'));var util=require(_0x3af7('0x8'));var path=require(_0x3af7('0x9'));var sox=require(_0x3af7('0xa'));var csv=require(_0x3af7('0xb'));var ejs=require(_0x3af7('0xc'));var fs=require('fs');var fs_extra=require(_0x3af7('0xd'));var _=require(_0x3af7('0xe'));var squel=require(_0x3af7('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3af7('0xb'));var querystring=require(_0x3af7('0x10'));var Papa=require(_0x3af7('0x11'));var Redis=require(_0x3af7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3af7('0x13'));var hardwareService=require(_0x3af7('0x14'));var logger=require(_0x3af7('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3af7('0x16'));var licenseUtil=require(_0x3af7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26db9d,_0x275ba9){_0x275ba9=_0x275ba9||0xcc;return function(_0x5c6054){if(_0x5c6054){return _0x26db9d[_0x3af7('0x18')](_0x275ba9);}return _0x26db9d['status'](_0x275ba9)[_0x3af7('0x19')]();};}function respondWithResult(_0x27dffa,_0x2616ec){_0x2616ec=_0x2616ec||0xc8;return function(_0xceba6a){if(_0xceba6a){return _0x27dffa[_0x3af7('0x1a')](_0x2616ec)[_0x3af7('0x1b')](_0xceba6a);}};}function respondWithFilteredResult(_0x4df0f0,_0x5dbf21){return function(_0x3c4288){if(_0x3c4288){var _0x49aee5=typeof _0x5dbf21[_0x3af7('0x1c')]==='undefined'&&typeof _0x5dbf21[_0x3af7('0x1d')]===_0x3af7('0x1e');var _0x475b61=_0x3c4288[_0x3af7('0x1f')];var _0x5281f1=_0x49aee5?0x0:_0x5dbf21[_0x3af7('0x1c')];var _0x4f3911=_0x49aee5?_0x3c4288['count']:_0x5dbf21[_0x3af7('0x1c')]+_0x5dbf21[_0x3af7('0x1d')];var _0x25ae05;if(_0x4f3911>=_0x475b61){_0x4f3911=_0x475b61;_0x25ae05=0xc8;}else{_0x25ae05=0xce;}_0x4df0f0[_0x3af7('0x1a')](_0x25ae05);return _0x4df0f0[_0x3af7('0x20')](_0x3af7('0x21'),_0x5281f1+'-'+_0x4f3911+'/'+_0x475b61)[_0x3af7('0x1b')](_0x3c4288);}return null;};}function patchUpdates(_0x20d88d){return function(_0x5eebf0){try{jsonpatch[_0x3af7('0x22')](_0x5eebf0,_0x20d88d,!![]);}catch(_0x3c1739){return BPromise[_0x3af7('0x23')](_0x3c1739);}return _0x5eebf0[_0x3af7('0x24')]();};}function saveUpdates(_0x351458,_0x1a9c63){return function(_0x4116f9){if(_0x4116f9){return _0x4116f9['update'](_0x351458)[_0x3af7('0x25')](function(_0x58dac5){return _0x58dac5;});}return null;};}function removeEntity(_0x2a707b,_0x5db8aa){return function(_0x581250){if(_0x581250){return _0x581250[_0x3af7('0x26')]()['then'](function(){_0x2a707b[_0x3af7('0x1a')](0xcc)[_0x3af7('0x19')]();});}};}function handleEntityNotFound(_0x13fc85,_0x832f2a){return function(_0x5490bc){if(!_0x5490bc){_0x13fc85[_0x3af7('0x18')](0x194);}return _0x5490bc;};}function handleError(_0x14a265,_0x264ef1){_0x264ef1=_0x264ef1||0x1f4;return function(_0x17ba2f){logger[_0x3af7('0x27')](_0x17ba2f['stack']);if(_0x17ba2f[_0x3af7('0x28')]){delete _0x17ba2f[_0x3af7('0x28')];}_0x14a265[_0x3af7('0x1a')](_0x264ef1)['send'](_0x17ba2f);};}exports['index']=function(_0x11500a,_0x41b905){var _0x273fc5={},_0x552166={},_0x2e82c7={'count':0x0,'rows':[]};var _0x360eca=_[_0x3af7('0x29')](db['CmHopperBlack'][_0x3af7('0x2a')],function(_0x491174){return{'name':_0x491174['fieldName'],'type':_0x491174['type'][_0x3af7('0x2b')]};});_0x552166[_0x3af7('0x2c')]=_[_0x3af7('0x29')](_0x360eca,_0x3af7('0x28'));_0x552166[_0x3af7('0x2d')]=_[_0x3af7('0x2e')](_0x11500a[_0x3af7('0x2d')]);_0x552166[_0x3af7('0x2f')]=_[_0x3af7('0x30')](_0x552166[_0x3af7('0x2c')],_0x552166['query']);_0x273fc5[_0x3af7('0x31')]=_['intersection'](_0x552166[_0x3af7('0x2c')],qs[_0x3af7('0x32')](_0x11500a[_0x3af7('0x2d')][_0x3af7('0x32')]));_0x273fc5['attributes']=_0x273fc5['attributes'][_0x3af7('0x33')]?_0x273fc5['attributes']:_0x552166[_0x3af7('0x2c')];if(!_0x11500a['query'][_0x3af7('0x34')](_0x3af7('0x35'))){_0x273fc5[_0x3af7('0x1d')]=qs[_0x3af7('0x1d')](_0x11500a[_0x3af7('0x2d')][_0x3af7('0x1d')]);_0x273fc5[_0x3af7('0x1c')]=qs[_0x3af7('0x1c')](_0x11500a[_0x3af7('0x2d')]['offset']);}_0x273fc5[_0x3af7('0x36')]=qs[_0x3af7('0x37')](_0x11500a[_0x3af7('0x2d')]['sort']);_0x273fc5[_0x3af7('0x38')]=qs[_0x3af7('0x2f')](_[_0x3af7('0x39')](_0x11500a[_0x3af7('0x2d')],_0x552166['filters']),_0x360eca);if(_0x11500a[_0x3af7('0x2d')][_0x3af7('0x3a')]){_0x273fc5[_0x3af7('0x38')]=_['merge'](_0x273fc5[_0x3af7('0x38')],{'$or':_['map'](_0x360eca,function(_0x2ed0eb){if(_0x2ed0eb[_0x3af7('0x3b')]!==_0x3af7('0x3c')){var _0x309845={};_0x309845[_0x2ed0eb[_0x3af7('0x28')]]={'$like':'%'+_0x11500a[_0x3af7('0x2d')]['filter']+'%'};return _0x309845;}})});}_0x273fc5=_[_0x3af7('0x3d')]({},_0x273fc5,_0x11500a[_0x3af7('0x3e')]);var _0x453994={'where':_0x273fc5['where']};return db['CmHopperBlack'][_0x3af7('0x1f')](_0x453994)[_0x3af7('0x25')](function(_0x668b74){_0x2e82c7[_0x3af7('0x1f')]=_0x668b74;if(_0x11500a['query'][_0x3af7('0x3f')]){_0x273fc5[_0x3af7('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3af7('0x41')](_0x273fc5);})[_0x3af7('0x25')](function(_0x516d62){_0x2e82c7[_0x3af7('0x42')]=_0x516d62;return _0x2e82c7;})[_0x3af7('0x25')](respondWithFilteredResult(_0x41b905,_0x273fc5))[_0x3af7('0x43')](handleError(_0x41b905,null));};exports[_0x3af7('0x44')]=function(_0x6bc790,_0x18d483){var _0x3b7746={'raw':!![],'where':{'id':_0x6bc790[_0x3af7('0x45')]['id']}},_0x7e952c={};_0x7e952c[_0x3af7('0x2c')]=_[_0x3af7('0x2e')](db['CmHopperBlack'][_0x3af7('0x2a')]);_0x7e952c[_0x3af7('0x2d')]=_[_0x3af7('0x2e')](_0x6bc790[_0x3af7('0x2d')]);_0x7e952c[_0x3af7('0x2f')]=_['intersection'](_0x7e952c[_0x3af7('0x2c')],_0x7e952c[_0x3af7('0x2d')]);_0x3b7746['attributes']=_[_0x3af7('0x30')](_0x7e952c['model'],qs['fields'](_0x6bc790['query'][_0x3af7('0x32')]));_0x3b7746['attributes']=_0x3b7746['attributes']['length']?_0x3b7746[_0x3af7('0x31')]:_0x7e952c[_0x3af7('0x2c')];if(_0x6bc790[_0x3af7('0x2d')][_0x3af7('0x3f')]){_0x3b7746[_0x3af7('0x40')]=[{'all':!![]}];}_0x3b7746=_['merge']({},_0x3b7746,_0x6bc790[_0x3af7('0x3e')]);return db[_0x3af7('0x46')][_0x3af7('0x47')](_0x3b7746)[_0x3af7('0x25')](handleEntityNotFound(_0x18d483,null))[_0x3af7('0x25')](respondWithResult(_0x18d483,null))[_0x3af7('0x43')](handleError(_0x18d483,null));};exports[_0x3af7('0x48')]=function(_0x5ad13a,_0x405722){if(_0x5ad13a[_0x3af7('0x49')]['id']){delete _0x5ad13a[_0x3af7('0x49')]['id'];}return db[_0x3af7('0x46')][_0x3af7('0x47')]({'where':{'id':_0x5ad13a[_0x3af7('0x45')]['id']}})[_0x3af7('0x25')](handleEntityNotFound(_0x405722,null))['then'](saveUpdates(_0x5ad13a['body'],null))[_0x3af7('0x25')](respondWithResult(_0x405722,null))[_0x3af7('0x43')](handleError(_0x405722,null));};exports[_0x3af7('0x26')]=function(_0x2116c1,_0x15026a){return db[_0x3af7('0x46')][_0x3af7('0x47')]({'where':{'id':_0x2116c1[_0x3af7('0x45')]['id']}})['then'](handleEntityNotFound(_0x15026a,null))['then'](removeEntity(_0x15026a,null))[_0x3af7('0x43')](handleError(_0x15026a,null));};exports[_0x3af7('0x4a')]=function(_0x1186ee,_0x4e88e7){return db[_0x3af7('0x46')][_0x3af7('0x4a')]()['then'](respondWithResult(_0x4e88e7,null))[_0x3af7('0x43')](handleError(_0x4e88e7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d6b2528..e9c92e4 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 _0x50c3=['cm_hopper_black','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x41135e,_0x510f65){var _0x36de3c=function(_0x26d7a8){while(--_0x26d7a8){_0x41135e['push'](_0x41135e['shift']());}};_0x36de3c(++_0x510f65);}(_0x50c3,0x1ae));var _0x350c=function(_0x186765,_0x54f9e8){_0x186765=_0x186765-0x0;var _0x105dec=_0x50c3[_0x186765];return _0x105dec;};'use strict';var _=require('lodash');var util=require(_0x350c('0x0'));var logger=require(_0x350c('0x1'))('api');var moment=require(_0x350c('0x2'));var BPromise=require(_0x350c('0x3'));var rp=require(_0x350c('0x4'));var fs=require('fs');var path=require(_0x350c('0x5'));var rimraf=require(_0x350c('0x6'));var config=require(_0x350c('0x7'));var attributes=require(_0x350c('0x8'));module[_0x350c('0x9')]=function(_0x1a6582,_0x3ef9b4){return _0x1a6582[_0x350c('0xa')](_0x350c('0xb'),attributes,{'tableName':_0x350c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb10=['path','rimraf','../../config/environment','define','CmHopperBlack','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2d0312,_0x133a2c){var _0x488377=function(_0x4df70d){while(--_0x4df70d){_0x2d0312['push'](_0x2d0312['shift']());}};_0x488377(++_0x133a2c);}(_0xcb10,0xb5));var _0x0cb1=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xcb10[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x0cb1('0x0'));var util=require(_0x0cb1('0x1'));var logger=require(_0x0cb1('0x2'))(_0x0cb1('0x3'));var moment=require('moment');var BPromise=require(_0x0cb1('0x4'));var rp=require(_0x0cb1('0x5'));var fs=require('fs');var path=require(_0x0cb1('0x6'));var rimraf=require(_0x0cb1('0x7'));var config=require(_0x0cb1('0x8'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0xd4495e,_0x1ae714){return _0xd4495e[_0x0cb1('0x9')](_0x0cb1('0xa'),attributes,{'tableName':'cm_hopper_black','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 3162fe9..f2bcc22 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 _0x64af=['../../mysqldb','../../config/utils','../../config/environment','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','catch','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis'];(function(_0x6b298f,_0x1bd2f4){var _0x376a01=function(_0x12e1b3){while(--_0x12e1b3){_0x6b298f['push'](_0x6b298f['shift']());}};_0x376a01(++_0x1bd2f4);}(_0x64af,0x113));var _0xf64a=function(_0x45bf48,_0x5dd33e){_0x45bf48=_0x45bf48-0x0;var _0x5299a0=_0x64af[_0x45bf48];return _0x5299a0;};'use strict';var _=require(_0xf64a('0x0'));var util=require(_0xf64a('0x1'));var moment=require(_0xf64a('0x2'));var BPromise=require(_0xf64a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf64a('0x4'));var db=require(_0xf64a('0x5'))['db'];var utils=require(_0xf64a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf64a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf64a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x221bd0,_0x2fa442,_0x545eb9){return new BPromise(function(_0x58ed0e,_0x38cb43){return client['request'](_0x221bd0,_0x545eb9)[_0xf64a('0x9')](function(_0x3ce366){logger[_0xf64a('0xa')](_0xf64a('0xb'),_0x2fa442,_0xf64a('0xc'));logger[_0xf64a('0xd')](_0xf64a('0xe'),_0x2fa442,'request\x20sent',JSON[_0xf64a('0xf')](_0x3ce366));if(_0x3ce366[_0xf64a('0x10')]){if(_0x3ce366[_0xf64a('0x10')][_0xf64a('0x11')]===0x1f4){logger[_0xf64a('0x10')](_0xf64a('0xb'),_0x2fa442,_0x3ce366['error'][_0xf64a('0x12')]);return _0x38cb43(_0x3ce366['error'][_0xf64a('0x12')]);}logger[_0xf64a('0x10')](_0xf64a('0xb'),_0x2fa442,_0x3ce366['error'][_0xf64a('0x12')]);return _0x58ed0e(_0x3ce366[_0xf64a('0x10')][_0xf64a('0x12')]);}else{logger[_0xf64a('0xa')](_0xf64a('0xb'),_0x2fa442,_0xf64a('0xc'));_0x58ed0e(_0x3ce366['result'][_0xf64a('0x12')]);}})['catch'](function(_0x2ddd36){logger[_0xf64a('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x2fa442,_0x2ddd36);_0x38cb43(_0x2ddd36);});});}exports['GetCmHopperBlack']=function(_0x40f719){var _0xabd690=this;return new Promise(function(_0xb49398,_0x5bbaa2){return db[_0xf64a('0x13')][_0xf64a('0x14')]({'raw':_0x40f719[_0xf64a('0x15')]?_0x40f719[_0xf64a('0x15')][_0xf64a('0x16')]===undefined?!![]:![]:!![],'where':_0x40f719[_0xf64a('0x15')]?_0x40f719['options'][_0xf64a('0x17')]||null:null,'attributes':_0x40f719[_0xf64a('0x15')]?_0x40f719['options'][_0xf64a('0x18')]||null:null,'limit':_0x40f719[_0xf64a('0x15')]?_0x40f719[_0xf64a('0x15')][_0xf64a('0x19')]||null:null,'include':_0x40f719[_0xf64a('0x15')]?_0x40f719['options'][_0xf64a('0x1a')]?_[_0xf64a('0x1b')](_0x40f719[_0xf64a('0x15')]['include'],function(_0x59d4c4){return{'model':db[_0x59d4c4[_0xf64a('0x1c')]],'as':_0x59d4c4['as'],'attributes':_0x59d4c4['attributes'],'include':_0x59d4c4[_0xf64a('0x1a')]?_[_0xf64a('0x1b')](_0x59d4c4[_0xf64a('0x1a')],function(_0x3118ad){return{'model':db[_0x3118ad['model']],'as':_0x3118ad['as'],'attributes':_0x3118ad[_0xf64a('0x18')],'include':_0x3118ad['include']?_['map'](_0x3118ad[_0xf64a('0x1a')],function(_0xf1483f){return{'model':db[_0xf1483f[_0xf64a('0x1c')]],'as':_0xf1483f['as'],'attributes':_0xf1483f['attributes']};}):[]};}):[]};}):[]:[]})[_0xf64a('0x9')](function(_0x4c88fc){logger[_0xf64a('0xa')](_0xf64a('0x1d'),_0x40f719);logger[_0xf64a('0xd')]('GetCmHopperBlack',_0x40f719,JSON[_0xf64a('0xf')](_0x4c88fc));_0xb49398(_0x4c88fc);})['catch'](function(_0x3c23f2){logger[_0xf64a('0x10')]('GetCmHopperBlack',_0x3c23f2[_0xf64a('0x12')],_0x40f719);_0x5bbaa2(_0xabd690[_0xf64a('0x10')](0x1f4,_0x3c23f2[_0xf64a('0x12')]));});});};exports[_0xf64a('0x1e')]=function(_0xe78152){var _0x470a51=this;return new Promise(function(_0x24940d,_0x3cb7c7){return db['CmHopperBlack'][_0xf64a('0x1f')](_0xe78152['body'],{'raw':_0xe78152['options']?_0xe78152[_0xf64a('0x15')][_0xf64a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe78152[_0xf64a('0x15')]?_0xe78152['options'][_0xf64a('0x17')]||null:null,'attributes':_0xe78152[_0xf64a('0x15')]?_0xe78152[_0xf64a('0x15')]['attributes']||null:null,'limit':_0xe78152[_0xf64a('0x15')]?_0xe78152[_0xf64a('0x15')][_0xf64a('0x19')]||null:null})['then'](function(_0x18f0d3){logger[_0xf64a('0xa')](_0xf64a('0x1e'),_0xe78152);logger[_0xf64a('0xd')]('UpdateCmHopperBlack',_0xe78152,JSON[_0xf64a('0xf')](_0x18f0d3));_0x24940d(_0x18f0d3);})[_0xf64a('0x20')](function(_0x5e704b){logger[_0xf64a('0x10')](_0xf64a('0x1e'),_0x5e704b[_0xf64a('0x12')],_0xe78152);_0x3cb7c7(_0x470a51['error'](0x1f4,_0x5e704b[_0xf64a('0x12')]));});});};exports[_0xf64a('0x21')]=function(_0x2b5452){var _0x450882=this;return new Promise(function(_0x219cc4,_0x1731be){return db[_0xf64a('0x13')][_0xf64a('0x22')]({'where':_0x2b5452[_0xf64a('0x15')]?_0x2b5452[_0xf64a('0x15')][_0xf64a('0x17')]||null:null})[_0xf64a('0x9')](function(_0x1e4823){logger[_0xf64a('0xa')](_0xf64a('0x21'),_0x2b5452);logger[_0xf64a('0xd')](_0xf64a('0x21'),_0x2b5452,JSON[_0xf64a('0xf')](_0x1e4823));_0x219cc4(_0x1e4823);})[_0xf64a('0x20')](function(_0x1d9068){logger[_0xf64a('0x10')](_0xf64a('0x21'),_0x1d9068[_0xf64a('0x12')],_0x2b5452);_0x1731be(_0x450882[_0xf64a('0x10')](0x1f4,_0x1d9068[_0xf64a('0x12')]));});});}; \ No newline at end of file +var _0x6922=['where','attributes','map','include','model','update','body','limit','then','UpdateCmHopperBlack','catch','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetCmHopperBlack','CmHopperBlack','findAll','options','raw'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6922,0x1b9));var _0x2692=function(_0x497976,_0x2d7586){_0x497976=_0x497976-0x0;var _0x177dcc=_0x6922[_0x497976];return _0x177dcc;};'use strict';var _=require(_0x2692('0x0'));var util=require(_0x2692('0x1'));var moment=require(_0x2692('0x2'));var BPromise=require(_0x2692('0x3'));var rs=require(_0x2692('0x4'));var fs=require('fs');var Redis=require(_0x2692('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2692('0x6'));var logger=require(_0x2692('0x7'))(_0x2692('0x8'));var config=require(_0x2692('0x9'));var jayson=require(_0x2692('0xa'));var client=jayson[_0x2692('0xb')][_0x2692('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4dcbf3,_0x5243ea,_0x307ce2){return new BPromise(function(_0x38acd6,_0x328f4a){return client[_0x2692('0xd')](_0x4dcbf3,_0x307ce2)['then'](function(_0xc9e450){logger[_0x2692('0xe')](_0x2692('0xf'),_0x5243ea,_0x2692('0x10'));logger[_0x2692('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5243ea,_0x2692('0x10'),JSON[_0x2692('0x12')](_0xc9e450));if(_0xc9e450[_0x2692('0x13')]){if(_0xc9e450[_0x2692('0x13')][_0x2692('0x14')]===0x1f4){logger[_0x2692('0x13')](_0x2692('0xf'),_0x5243ea,_0xc9e450[_0x2692('0x13')]['message']);return _0x328f4a(_0xc9e450[_0x2692('0x13')][_0x2692('0x15')]);}logger['error'](_0x2692('0xf'),_0x5243ea,_0xc9e450[_0x2692('0x13')][_0x2692('0x15')]);return _0x38acd6(_0xc9e450[_0x2692('0x13')][_0x2692('0x15')]);}else{logger[_0x2692('0xe')](_0x2692('0xf'),_0x5243ea,_0x2692('0x10'));_0x38acd6(_0xc9e450['result'][_0x2692('0x15')]);}})['catch'](function(_0x37be2a){logger[_0x2692('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x5243ea,_0x37be2a);_0x328f4a(_0x37be2a);});});}exports[_0x2692('0x16')]=function(_0x27371a){var _0x2eb4de=this;return new Promise(function(_0x21b95a,_0x441af4){return db[_0x2692('0x17')][_0x2692('0x18')]({'raw':_0x27371a[_0x2692('0x19')]?_0x27371a[_0x2692('0x19')][_0x2692('0x1a')]===undefined?!![]:![]:!![],'where':_0x27371a['options']?_0x27371a[_0x2692('0x19')][_0x2692('0x1b')]||null:null,'attributes':_0x27371a[_0x2692('0x19')]?_0x27371a[_0x2692('0x19')][_0x2692('0x1c')]||null:null,'limit':_0x27371a['options']?_0x27371a['options']['limit']||null:null,'include':_0x27371a[_0x2692('0x19')]?_0x27371a[_0x2692('0x19')]['include']?_[_0x2692('0x1d')](_0x27371a[_0x2692('0x19')][_0x2692('0x1e')],function(_0x1540c2){return{'model':db[_0x1540c2['model']],'as':_0x1540c2['as'],'attributes':_0x1540c2[_0x2692('0x1c')],'include':_0x1540c2[_0x2692('0x1e')]?_[_0x2692('0x1d')](_0x1540c2[_0x2692('0x1e')],function(_0x4ffc83){return{'model':db[_0x4ffc83[_0x2692('0x1f')]],'as':_0x4ffc83['as'],'attributes':_0x4ffc83['attributes'],'include':_0x4ffc83[_0x2692('0x1e')]?_['map'](_0x4ffc83[_0x2692('0x1e')],function(_0x2f3907){return{'model':db[_0x2f3907['model']],'as':_0x2f3907['as'],'attributes':_0x2f3907[_0x2692('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ec20a){logger['info']('GetCmHopperBlack',_0x27371a);logger[_0x2692('0x11')](_0x2692('0x16'),_0x27371a,JSON[_0x2692('0x12')](_0x3ec20a));_0x21b95a(_0x3ec20a);})['catch'](function(_0x59d679){logger[_0x2692('0x13')]('GetCmHopperBlack',_0x59d679[_0x2692('0x15')],_0x27371a);_0x441af4(_0x2eb4de[_0x2692('0x13')](0x1f4,_0x59d679[_0x2692('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x2ba6a6){var _0x1b67a7=this;return new Promise(function(_0x1f77d0,_0xf49b73){return db[_0x2692('0x17')][_0x2692('0x20')](_0x2ba6a6[_0x2692('0x21')],{'raw':_0x2ba6a6['options']?_0x2ba6a6[_0x2692('0x19')][_0x2692('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ba6a6['options']?_0x2ba6a6['options'][_0x2692('0x1b')]||null:null,'attributes':_0x2ba6a6[_0x2692('0x19')]?_0x2ba6a6[_0x2692('0x19')][_0x2692('0x1c')]||null:null,'limit':_0x2ba6a6[_0x2692('0x19')]?_0x2ba6a6[_0x2692('0x19')][_0x2692('0x22')]||null:null})[_0x2692('0x23')](function(_0x36ee1c){logger['info'](_0x2692('0x24'),_0x2ba6a6);logger['debug']('UpdateCmHopperBlack',_0x2ba6a6,JSON[_0x2692('0x12')](_0x36ee1c));_0x1f77d0(_0x36ee1c);})[_0x2692('0x25')](function(_0x3fe14b){logger[_0x2692('0x13')](_0x2692('0x24'),_0x3fe14b[_0x2692('0x15')],_0x2ba6a6);_0xf49b73(_0x1b67a7[_0x2692('0x13')](0x1f4,_0x3fe14b[_0x2692('0x15')]));});});};exports['DestroyCmHopperBlack']=function(_0x2a87b7){var _0x4c181b=this;return new Promise(function(_0x49236b,_0x5a1f0e){return db[_0x2692('0x17')]['destroy']({'where':_0x2a87b7['options']?_0x2a87b7[_0x2692('0x19')][_0x2692('0x1b')]||null:null})[_0x2692('0x23')](function(_0x4d23c8){logger[_0x2692('0xe')](_0x2692('0x26'),_0x2a87b7);logger[_0x2692('0x11')](_0x2692('0x26'),_0x2a87b7,JSON[_0x2692('0x12')](_0x4d23c8));_0x49236b(_0x4d23c8);})[_0x2692('0x25')](function(_0x28ff26){logger[_0x2692('0x13')](_0x2692('0x26'),_0x28ff26['message'],_0x2a87b7);_0x5a1f0e(_0x4c181b[_0x2692('0x13')](0x1f4,_0x28ff26[_0x2692('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 56afcd0..05b95e5 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 _0xfb11=['show','put','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xfb11[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fb1('0x5'));var controller=require(_0x1fb1('0x6'));router['get']('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x8')]);router['get'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xa')]);router[_0x1fb1('0xb')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xd')]);router[_0x1fb1('0xe')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller['update']);router[_0x1fb1('0xf')]('/:id',auth[_0x1fb1('0x7')](),controller['destroy']);module[_0x1fb1('0x10')]=router; \ No newline at end of file +var _0x5334=['isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','describe','get','/:id'];(function(_0x12d3f4,_0x377f2c){var _0x4f9bf4=function(_0x2df216){while(--_0x2df216){_0x12d3f4['push'](_0x12d3f4['shift']());}};_0x4f9bf4(++_0x377f2c);}(_0x5334,0x84));var _0x4533=function(_0x3bca4f,_0x3e0414){_0x3bca4f=_0x3bca4f-0x0;var _0x5e45d3=_0x5334[_0x3bca4f];return _0x5e45d3;};'use strict';var multer=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var path=require(_0x4533('0x2'));var timeout=require(_0x4533('0x3'));var express=require(_0x4533('0x4'));var router=express['Router']();var fs_extra=require(_0x4533('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4533('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4533('0x9')]);router[_0x4533('0xa')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller[_0x4533('0xd')]);router[_0x4533('0xe')](_0x4533('0xb'),auth['isAuthenticated'](),controller[_0x4533('0xf')]);router[_0x4533('0x10')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller['destroy']);module[_0x4533('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 91239aa..5071408 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 _0x7ddd=['endtime','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports','STRING','INTEGER','DATE','getDataValue'];(function(_0x17da7f,_0x323970){var _0x2ad092=function(_0x19deb3){while(--_0x19deb3){_0x17da7f['push'](_0x17da7f['shift']());}};_0x2ad092(++_0x323970);}(_0x7ddd,0x101));var _0xd7dd=function(_0x28f8f7,_0x28cef7){_0x28f8f7=_0x28f8f7-0x0;var _0xfaccaa=_0x7ddd[_0x28f8f7];return _0xfaccaa;};'use strict';var Sequelize=require(_0xd7dd('0x0'));var moment=require(_0xd7dd('0x1'));module[_0xd7dd('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd7dd('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd7dd('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd7dd('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd7dd('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd7dd('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd7dd('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd7dd('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd7dd('0x3')]},'starttime':{'type':Sequelize[_0xd7dd('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd7dd('0x5')]},'droptime':{'type':Sequelize[_0xd7dd('0x5')]},'endtime':{'type':Sequelize[_0xd7dd('0x5')]},'ringtime':{'type':Sequelize[_0xd7dd('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd7dd('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd7dd('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xd7dd('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd7dd('0x3')]},'reason':{'type':Sequelize[_0xd7dd('0x3')]},'disposition':{'type':Sequelize[_0xd7dd('0x3')]},'secondDisposition':{'type':Sequelize[_0xd7dd('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xd7dd('0x5')],'set':function(_0x2d475a){var _0x48fb61=this[_0xd7dd('0x6')](_0xd7dd('0x7'));if(_0x48fb61&&_0x2d475a){this[_0xd7dd('0x8')](_0xd7dd('0x9'),moment(_0x2d475a)[_0xd7dd('0xa')](moment(_0x48fb61),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd7dd('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd7dd('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd7dd('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd7dd('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd7dd('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd7dd('0x5')]},'deleted':{'type':Sequelize[_0xd7dd('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd7dd('0x5')]},'recallme':{'type':Sequelize[_0xd7dd('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd7dd('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xd7dd('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd7dd('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd7dd('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd7dd('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x145e=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff','seconds'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x145e,0x1ed));var _0xe145=function(_0x111c6c,_0x5ac573){_0x111c6c=_0x111c6c-0x0;var _0x2e983a=_0x145e[_0x111c6c];return _0x2e983a;};'use strict';var Sequelize=require(_0xe145('0x0'));var moment=require(_0xe145('0x1'));module[_0xe145('0x2')]={'state':{'type':Sequelize[_0xe145('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe145('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xe145('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe145('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe145('0x5')]},'responsetime':{'type':Sequelize[_0xe145('0x5')]},'answertime':{'type':Sequelize[_0xe145('0x5')]},'droptime':{'type':Sequelize[_0xe145('0x5')]},'endtime':{'type':Sequelize[_0xe145('0x5')]},'ringtime':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xe145('0x4')]},'campaigntype':{'type':Sequelize[_0xe145('0x4')]},'membername':{'type':Sequelize[_0xe145('0x4')]},'reason':{'type':Sequelize[_0xe145('0x4')]},'disposition':{'type':Sequelize[_0xe145('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe145('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x17b478){var _0x3a84d6=this[_0xe145('0x6')](_0xe145('0x7'));if(_0x3a84d6&&_0x17b478){this['setDataValue'](_0xe145('0x8'),moment(_0x17b478)[_0xe145('0x9')](moment(_0x3a84d6),_0xe145('0xa')));}}},'amd':{'type':Sequelize[_0xe145('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe145('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe145('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe145('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe145('0x5')]},'callback':{'type':Sequelize[_0xe145('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe145('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe145('0x5')]},'deleted':{'type':Sequelize[_0xe145('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe145('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe145('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe145('0x3')],'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 4ce9e7d..07a3d26 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 _0x1261=['attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','describe','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','cm_hopper','fromQuery','phone','scheduledAt','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','into','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','CmHopperFinal','model','map','name','keys','query','intersection'];(function(_0x2bc174,_0x2c50c0){var _0xc3d009=function(_0x29faef){while(--_0x29faef){_0x2bc174['push'](_0x2bc174['shift']());}};_0xc3d009(++_0x2c50c0);}(_0x1261,0x144));var _0x1126=function(_0x1f69bc,_0xaffd71){_0x1f69bc=_0x1f69bc-0x0;var _0x1ac3c5=_0x1261[_0x1f69bc];return _0x1ac3c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['CmHopperFinal'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':!![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['CmHopperFinal']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')]()['then'](respondWithResult(_0x5111d3,null))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports[_0x1126('0x24')]=function(_0x518e0a,_0x3e4eeb){if(_0x518e0a[_0x1126('0x44')][_0x1126('0x45')]){delete _0x518e0a['body'][_0x1126('0x45')];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'uniqueid':_0x518e0a[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x25')](saveUpdates(_0x518e0a[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0x3e4eeb,null))['catch'](handleError(_0x3e4eeb,null));};exports[_0x1126('0x46')]=function(_0x5a2287,_0x40168e,_0x2ad118){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5a2287[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4a')))),_0x1126('0x4b')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x4e')))),_0x1126('0x4f')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1126('0x50')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1126('0x51')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),_0x1126('0x53')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x40168e,null))[_0x1126('0x25')](respondWithResult(_0x40168e,null))[_0x1126('0x43')](handleError(_0x40168e,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xcc1a95,_0x315386,_0x5e0ea1){return db[_0x1126('0x29')]['findAll']({'raw':![],'where':{'CampaignId':_0xcc1a95[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x1126('0x4b')],[db['sequelize']['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x56')))),_0x1126('0x57')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x4e')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x58')))),'dropContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x59')))),_0x1126('0x51')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x315386,null))[_0x1126('0x25')](respondWithResult(_0x315386,null))[_0x1126('0x43')](handleError(_0x315386,null));};exports[_0x1126('0x5a')]=function(_0x247f12,_0xd20fbe,_0x3d5e15){return db[_0x1126('0x5b')][_0x1126('0x41')]({'where':{'id':_0x247f12[_0x1126('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd20fbe,null))[_0x1126('0x25')](function(_0x274343){var _0x2b61ae;if(_0x274343){_0x2b61ae=squel['insert']()['into'](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),'ContactId','ListId','VoiceQueueId',_0x1126('0x60'),_0x1126('0x61')],squel[_0x1126('0x62')]()[_0x1126('0x63')]('ANY_VALUE(calleridnum)',_0x1126('0x5e'))['field'](_0x1126('0x64'),_0x1126('0x5f'))[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),'ListId')[_0x1126('0x63')]('ANY_VALUE(VoiceQueueId)',_0x1126('0x68'))[_0x1126('0x63')]('NOW()',_0x1126('0x60'))[_0x1126('0x63')]('NOW()',_0x1126('0x61'))[_0x1126('0x69')]('cm_hopper_final')['where'](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())['where']('state\x20=\x20?',_0x247f12['body'][_0x1126('0x6c')]['toString']())['where'](_0x1126('0x6d'))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()['field'](_0x1126('0x5e'))[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12['params']['id'][_0x1126('0x6b')]()))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')](_0x1126('0x71')))[_0x1126('0x72')](_0x1126('0x66')))[_0x1126('0x6b')]();return db[_0x1126('0x47')][_0x1126('0x2e')](_0x2b61ae);}return[];})['then'](respondWithResult(_0xd20fbe,null))[_0x1126('0x43')](handleError(_0xd20fbe,null));};exports[_0x1126('0x73')]=function(_0x33cccf,_0x1483f4,_0x3be5bf){return db['Campaign'][_0x1126('0x41')]({'where':{'id':_0x33cccf['params']['id']}})['then'](handleEntityNotFound(_0x1483f4,null))[_0x1126('0x25')](function(_0x2b1884){var _0x55f366;if(_0x2b1884){_0x55f366=squel['insert']()[_0x1126('0x74')](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),_0x1126('0x66'),_0x1126('0x75'),_0x1126('0x76'),_0x1126('0x60'),'updatedAt'],squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x77'),_0x1126('0x5e'))[_0x1126('0x63')](_0x1126('0x64'),'scheduledAt')[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),_0x1126('0x75'))[_0x1126('0x63')](_0x1126('0x78'),_0x1126('0x76'))[_0x1126('0x63')]('NOW()','createdAt')[_0x1126('0x63')]('NOW()',_0x1126('0x61'))['from'](_0x1126('0x70'))['where'](_0x1126('0x79'),_0x33cccf['params']['id']['toString']())['where'](_0x1126('0x7a'),_0x33cccf[_0x1126('0x44')]['state']['toString']())[_0x1126('0x37')](_0x1126('0x6d'))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x1126('0x63')]('phone')[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id']['toString']()))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')]('state\x20=\x204'))[_0x1126('0x72')]('ContactId'))[_0x1126('0x6b')]();return db['sequelize'][_0x1126('0x2e')](_0x55f366);}return[];})[_0x1126('0x25')](respondWithResult(_0x1483f4,null))[_0x1126('0x43')](handleError(_0x1483f4,null));};exports[_0x1126('0x7b')]=function(_0x59c04b,_0x429183,_0x834360){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x59c04b[_0x1126('0x44')][_0x1126('0x68')],'CampaignId':_0x59c04b[_0x1126('0x44')]['CampaignId'],'ContactId':_0x59c04b[_0x1126('0x44')]['ContactId']}})[_0x1126('0x25')](handleEntityNotFound(_0x429183,null))[_0x1126('0x25')](function(_0x4d6bb2){if(_0x4d6bb2){return _0x4d6bb2;}return null;})[_0x1126('0x25')](respondWithResult(_0x429183,null))[_0x1126('0x43')](handleError(_0x429183,null));}; \ No newline at end of file +var _0x57ca=['state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','cm_hopper','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','toString','group','moveContactsIvrCampaignHopperFinal','scheduledAt','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','from','state\x20=\x204','checkContactHopper','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','CmHopperFinal','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0x37fe9a,_0x454238){var _0x23f59d=function(_0x909f5b){while(--_0x909f5b){_0x37fe9a['push'](_0x37fe9a['shift']());}};_0x23f59d(++_0x454238);}(_0x57ca,0x108));var _0xa57c=function(_0x294cd5,_0x42d039){_0x294cd5=_0x294cd5-0x0;var _0x558055=_0x57ca[_0x294cd5];return _0x558055;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':!![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')]()['then'](respondWithResult(_0x44ea0a,null))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x5082ef,_0x232675){if(_0x5082ef['body'][_0xa57c('0x42')]){delete _0x5082ef[_0xa57c('0x43')]['uniqueid'];}return db[_0xa57c('0x2a')][_0xa57c('0x3f')]({'where':{'uniqueid':_0x5082ef[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x232675,null))[_0xa57c('0x21')](saveUpdates(_0x5082ef['body'],null))[_0xa57c('0x21')](respondWithResult(_0x232675,null))[_0xa57c('0x40')](handleError(_0x232675,null));};exports[_0xa57c('0x44')]=function(_0xd57bac,_0x2e4b84,_0x5ace6d){return db[_0xa57c('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0xd57bac['params']['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize']['literal'](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4a')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x4b')))),_0xa57c('0x4c')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),_0xa57c('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db['sequelize']['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0x2e4b84,null))['then'](respondWithResult(_0x2e4b84,null))[_0xa57c('0x40')](handleError(_0x2e4b84,null));};exports[_0xa57c('0x56')]=function(_0x1899ad,_0xb19d93,_0x2adcf6){return db[_0xa57c('0x2a')][_0xa57c('0x3d')]({'raw':![],'where':{'CampaignId':_0x1899ad[_0xa57c('0x3e')]['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0xa57c('0x57')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4b')))),'busyContacts'],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),'dropContacts'],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0xb19d93,null))['then'](respondWithResult(_0xb19d93,null))[_0xa57c('0x40')](handleError(_0xb19d93,null));};exports[_0xa57c('0x58')]=function(_0x1be631,_0x47e3d5,_0x571e10){return db[_0xa57c('0x59')][_0xa57c('0x3f')]({'where':{'id':_0x1be631[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x47e3d5,null))[_0xa57c('0x21')](function(_0x39411b){var _0x2a7aab;if(_0x39411b){_0x2a7aab=squel[_0xa57c('0x5a')]()[_0xa57c('0x5b')]('cm_hopper')[_0xa57c('0x5c')]([_0xa57c('0x5d'),'scheduledAt',_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x60'),_0xa57c('0x61'),_0xa57c('0x62')],squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x65'),'phone')[_0xa57c('0x64')](_0xa57c('0x66'),'scheduledAt')[_0xa57c('0x64')](_0xa57c('0x67'),'ContactId')['field'](_0xa57c('0x68'),_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x69'),_0xa57c('0x60'))['field'](_0xa57c('0x66'),_0xa57c('0x61'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x62'))['from'](_0xa57c('0x6a'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1be631[_0xa57c('0x43')][_0xa57c('0x6d')]['toString']())[_0xa57c('0x37')](_0xa57c('0x6e'))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x5d'))['from'](_0xa57c('0x6f'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']()))[_0xa57c('0x37')](_0xa57c('0x70'),squel['select']()[_0xa57c('0x64')](_0xa57c('0x71'))['from'](_0xa57c('0x6a'))['where'](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id'][_0xa57c('0x72')]())[_0xa57c('0x37')]('state\x20=\x204'))[_0xa57c('0x73')](_0xa57c('0x5e')))[_0xa57c('0x72')]();return db[_0xa57c('0x45')][_0xa57c('0x2e')](_0x2a7aab);}return[];})[_0xa57c('0x21')](respondWithResult(_0x47e3d5,null))[_0xa57c('0x40')](handleError(_0x47e3d5,null));};exports[_0xa57c('0x74')]=function(_0x1129f,_0x2c4e6c,_0x46dbb1){return db['Campaign']['find']({'where':{'id':_0x1129f['params']['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x2c4e6c,null))['then'](function(_0x43c430){var _0x442dc7;if(_0x43c430){_0x442dc7=squel[_0xa57c('0x5a')]()['into'](_0xa57c('0x6f'))[_0xa57c('0x5c')]([_0xa57c('0x5d'),_0xa57c('0x75'),_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x76'),'createdAt',_0xa57c('0x62')],squel[_0xa57c('0x63')]()['field']('ANY_VALUE(calleridnum)',_0xa57c('0x5d'))[_0xa57c('0x64')]('NOW()','scheduledAt')[_0xa57c('0x64')]('ANY_VALUE(ContactId)',_0xa57c('0x5e'))[_0xa57c('0x64')]('ANY_VALUE(ListId)',_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x77'),_0xa57c('0x76'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x61'))['field'](_0xa57c('0x66'),_0xa57c('0x62'))['from']('cm_hopper_final')['where'](_0xa57c('0x78'),_0x1129f['params']['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1129f[_0xa57c('0x43')]['state'][_0xa57c('0x72')]())[_0xa57c('0x37')](_0xa57c('0x6e'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()['field'](_0xa57c('0x5d'))[_0xa57c('0x79')]('cm_hopper')[_0xa57c('0x37')]('CampaignId\x20=\x20?',_0x1129f['params']['id']['toString']()))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xa57c('0x71'))[_0xa57c('0x79')]('cm_hopper_final')[_0xa57c('0x37')](_0xa57c('0x78'),_0x1129f[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x7a')))[_0xa57c('0x73')](_0xa57c('0x5e')))['toString']();return db['sequelize'][_0xa57c('0x2e')](_0x442dc7);}return[];})['then'](respondWithResult(_0x2c4e6c,null))[_0xa57c('0x40')](handleError(_0x2c4e6c,null));};exports[_0xa57c('0x7b')]=function(_0x2cc12b,_0x4dc6ac,_0x138c4e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x2cc12b[_0xa57c('0x43')]['VoiceQueueId'],'CampaignId':_0x2cc12b[_0xa57c('0x43')][_0xa57c('0x76')],'ContactId':_0x2cc12b['body']['ContactId']}})[_0xa57c('0x21')](handleEntityNotFound(_0x4dc6ac,null))[_0xa57c('0x21')](function(_0x50a940){if(_0x50a940){return _0x50a940;}return null;})['then'](respondWithResult(_0x4dc6ac,null))[_0xa57c('0x40')](handleError(_0x4dc6ac,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 0f4bb38..ce6ecec 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 _0xe1b6=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x52c994,_0x39fed0){var _0x4d6c32=function(_0x465387){while(--_0x465387){_0x52c994['push'](_0x52c994['shift']());}};_0x4d6c32(++_0x39fed0);}(_0xe1b6,0x161));var _0x6e1b=function(_0x29fff0,_0x1a853d){_0x29fff0=_0x29fff0-0x0;var _0x40b453=_0xe1b6[_0x29fff0];return _0x40b453;};'use strict';var _=require(_0x6e1b('0x0'));var util=require(_0x6e1b('0x1'));var logger=require(_0x6e1b('0x2'))(_0x6e1b('0x3'));var moment=require('moment');var BPromise=require(_0x6e1b('0x4'));var rp=require(_0x6e1b('0x5'));var fs=require('fs');var path=require(_0x6e1b('0x6'));var rimraf=require(_0x6e1b('0x7'));var config=require(_0x6e1b('0x8'));var attributes=require(_0x6e1b('0x9'));module[_0x6e1b('0xa')]=function(_0x4758c2,_0x7593bc){return _0x4758c2[_0x6e1b('0xb')](_0x6e1b('0xc'),attributes,{'tableName':_0x6e1b('0xd'),'paranoid':![],'indexes':[{'name':_0x6e1b('0xe'),'fields':['calleridnum']},{'name':_0x6e1b('0xf'),'fields':[_0x6e1b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0818=['../../config/logger','request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x13d0c2,_0x46def9){var _0x153302=function(_0x2bb361){while(--_0x2bb361){_0x13d0c2['push'](_0x13d0c2['shift']());}};_0x153302(++_0x46def9);}(_0x0818,0x143));var _0x8081=function(_0x4313b7,_0x48641c){_0x4313b7=_0x4313b7-0x0;var _0x57dbbe=_0x0818[_0x4313b7];return _0x57dbbe;};'use strict';var _=require(_0x8081('0x0'));var util=require(_0x8081('0x1'));var logger=require(_0x8081('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8081('0x3'));var fs=require('fs');var path=require(_0x8081('0x4'));var rimraf=require('rimraf');var config=require(_0x8081('0x5'));var attributes=require(_0x8081('0x6'));module[_0x8081('0x7')]=function(_0x459f8e,_0x3d34b0){return _0x459f8e[_0x8081('0x8')](_0x8081('0x9'),attributes,{'tableName':_0x8081('0xa'),'paranoid':![],'indexes':[{'name':_0x8081('0xb'),'fields':[_0x8081('0xb')]},{'name':_0x8081('0xc'),'fields':[_0x8081('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 4da63ff..8591741 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(_0x4fb7b1,_0x12c04b){var _0x201836=function(_0x17cadd){while(--_0x17cadd){_0x4fb7b1['push'](_0x4fb7b1['shift']());}};_0x201836(++_0x12c04b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a54df,_0x45ea17){_0x2a54df=_0x2a54df-0x0;var _0x1d5f05=_0xb10b[_0x2a54df];return _0x1d5f05;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x46f12b,_0x28678b){var _0x179daf=function(_0xa18d9){while(--_0xa18d9){_0x46f12b['push'](_0x46f12b['shift']());}};_0x179daf(++_0x28678b);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f9ea9,_0x19840d){_0x3f9ea9=_0x3f9ea9-0x0;var _0x291e7f=_0xb10b[_0x3f9ea9];return _0x291e7f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 49e2d84..d056845 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 _0x1184=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/voice/queue/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','exports'];(function(_0x5a8a5e,_0x3541bc){var _0x2f6ef9=function(_0x727ecb){while(--_0x727ecb){_0x5a8a5e['push'](_0x5a8a5e['shift']());}};_0x2f6ef9(++_0x3541bc);}(_0x1184,0xa0));var _0x4118=function(_0x42e8ce,_0x48b956){_0x42e8ce=_0x42e8ce-0x0;var _0x143c37=_0x1184[_0x42e8ce];return _0x143c37;};'use strict';var multer=require(_0x4118('0x0'));var util=require('util');var path=require(_0x4118('0x1'));var timeout=require(_0x4118('0x2'));var express=require('express');var router=express[_0x4118('0x3')]();var fs_extra=require(_0x4118('0x4'));var auth=require(_0x4118('0x5'));var interaction=require(_0x4118('0x6'));var config=require('../../config/environment');var controller=require(_0x4118('0x7'));router[_0x4118('0x8')]('/',auth[_0x4118('0x9')](),controller[_0x4118('0xa')]);router['get'](_0x4118('0xb'),auth[_0x4118('0x9')](),controller[_0x4118('0xc')]);router['get']('/:id',auth[_0x4118('0x9')](),controller['show']);router['get'](_0x4118('0xd'),auth[_0x4118('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get']('/campaign/countAttributes/:id',auth[_0x4118('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x4118('0xe')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x4118('0xf')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0x4118('0x9')](),controller[_0x4118('0x10')]);router[_0x4118('0xe')]('/checkContactHopper',auth[_0x4118('0x9')](),controller[_0x4118('0x11')]);router[_0x4118('0x12')]('/:id',auth[_0x4118('0x9')](),controller['update']);module[_0x4118('0x13')]=router; \ No newline at end of file +var _0x9e42=['show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','/checkContactHopper','put','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x34331b,_0x22a64c){var _0x1f97c8=function(_0x488b07){while(--_0x488b07){_0x34331b['push'](_0x34331b['shift']());}};_0x1f97c8(++_0x22a64c);}(_0x9e42,0xd0));var _0x29e4=function(_0x3adb8e,_0x247ca2){_0x3adb8e=_0x3adb8e-0x0;var _0x3eacdb=_0x9e42[_0x3adb8e];return _0x3eacdb;};'use strict';var multer=require(_0x29e4('0x0'));var util=require(_0x29e4('0x1'));var path=require('path');var timeout=require(_0x29e4('0x2'));var express=require(_0x29e4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x29e4('0x4'));var interaction=require(_0x29e4('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x29e4('0x6')]('/',auth[_0x29e4('0x7')](),controller[_0x29e4('0x8')]);router[_0x29e4('0x6')](_0x29e4('0x9'),auth['isAuthenticated'](),controller[_0x29e4('0xa')]);router['get'](_0x29e4('0xb'),auth[_0x29e4('0x7')](),controller[_0x29e4('0xc')]);router[_0x29e4('0x6')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x29e4('0xd')]);router[_0x29e4('0x6')]('/campaign/countAttributes/:id',auth[_0x29e4('0x7')](),controller[_0x29e4('0xe')]);router[_0x29e4('0xf')](_0x29e4('0x10'),auth[_0x29e4('0x7')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x29e4('0xf')](_0x29e4('0x11'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x29e4('0xf')](_0x29e4('0x12'),auth[_0x29e4('0x7')](),controller['checkContactHopper']);router[_0x29e4('0x13')](_0x29e4('0xb'),auth[_0x29e4('0x7')](),controller[_0x29e4('0x14')]);module[_0x29e4('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index a5f121d..75a639b 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 _0xa6d1=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0xca2427,_0x4f1902){var _0x5099ee=function(_0x2bce15){while(--_0x2bce15){_0xca2427['push'](_0xca2427['shift']());}};_0x5099ee(++_0x4f1902);}(_0xa6d1,0x1e1));var _0x1a6d=function(_0x2b4c2f,_0x42de56){_0x2b4c2f=_0x2b4c2f-0x0;var _0x193e7e=_0xa6d1[_0x2b4c2f];return _0x193e7e;};'use strict';var Sequelize=require(_0x1a6d('0x0'));module[_0x1a6d('0x1')]={'state':{'type':Sequelize[_0x1a6d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1a6d('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1a6d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1a6d('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x1a6d('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1a6d('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x1a6d('0x4')]},'answertime':{'type':Sequelize[_0x1a6d('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x1a6d('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1a6d('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1a6d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1a6d('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1a6d('0x3')]},'campaign':{'type':Sequelize[_0x1a6d('0x3')]},'campaigntype':{'type':Sequelize[_0x1a6d('0x3')]},'membername':{'type':Sequelize[_0x1a6d('0x3')]},'reason':{'type':Sequelize[_0x1a6d('0x3')]},'amd':{'type':Sequelize[_0x1a6d('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1a6d('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1a6d('0x4')]},'recallme':{'type':Sequelize[_0x1a6d('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x1a6d('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1a6d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1a6d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1a6d('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1a6d('0x3')]}}; \ No newline at end of file +var _0xe108=['DATE','BOOLEAN','exports','STRING','INTEGER'];(function(_0x3a38f7,_0x2b700e){var _0x5a0eb3=function(_0x28fcd8){while(--_0x28fcd8){_0x3a38f7['push'](_0x3a38f7['shift']());}};_0x5a0eb3(++_0x2b700e);}(_0xe108,0x6b));var _0x8e10=function(_0x2c7377,_0x32ade5){_0x2c7377=_0x2c7377-0x0;var _0x35e181=_0xe108[_0x2c7377];return _0x35e181;};'use strict';var Sequelize=require('sequelize');module[_0x8e10('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8e10('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8e10('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x8e10('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8e10('0x1')]},'calleridname':{'type':Sequelize[_0x8e10('0x1')]},'starttime':{'type':Sequelize[_0x8e10('0x3')]},'responsetime':{'type':Sequelize[_0x8e10('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8e10('0x3')]},'endtime':{'type':Sequelize[_0x8e10('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8e10('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8e10('0x1')]},'amd':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8e10('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8e10('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8e10('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a7f2231..5f282ea 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 _0x7170=['fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','CmHopperHistory','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','describe','update','body','uniqueid','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','map','fieldName','key','model','query','keys','intersection','attributes'];(function(_0x31db70,_0x62d245){var _0x5623a4=function(_0x13ae49){while(--_0x13ae49){_0x31db70['push'](_0x31db70['shift']());}};_0x5623a4(++_0x62d245);}(_0x7170,0x15b));var _0x0717=function(_0x5d5866,_0x10091d){_0x5d5866=_0x5d5866-0x0;var _0x514311=_0x7170[_0x5d5866];return _0x514311;};'use strict';var emlformat=require(_0x0717('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0717('0x1'));var jsonpatch=require(_0x0717('0x2'));var rp=require(_0x0717('0x3'));var moment=require(_0x0717('0x4'));var BPromise=require(_0x0717('0x5'));var Mustache=require(_0x0717('0x6'));var util=require(_0x0717('0x7'));var path=require(_0x0717('0x8'));var sox=require(_0x0717('0x9'));var csv=require(_0x0717('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0717('0xb'));var squel=require('squel');var crypto=require(_0x0717('0xc'));var jsforce=require(_0x0717('0xd'));var deskjs=require(_0x0717('0xe'));var toCsv=require(_0x0717('0xa'));var querystring=require(_0x0717('0xf'));var Papa=require(_0x0717('0x10'));var Redis=require(_0x0717('0x11'));var authService=require(_0x0717('0x12'));var qs=require(_0x0717('0x13'));var as=require(_0x0717('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0717('0x15'))(_0x0717('0x16'));var utils=require(_0x0717('0x17'));var config=require(_0x0717('0x18'));var licenseUtil=require(_0x0717('0x19'));var db=require(_0x0717('0x1a'))['db'];function respondWithStatusCode(_0x47c0c5,_0x56ef44){_0x56ef44=_0x56ef44||0xcc;return function(_0x2c8e63){if(_0x2c8e63){return _0x47c0c5[_0x0717('0x1b')](_0x56ef44);}return _0x47c0c5[_0x0717('0x1c')](_0x56ef44)[_0x0717('0x1d')]();};}function respondWithResult(_0x48b448,_0x222c3d){_0x222c3d=_0x222c3d||0xc8;return function(_0x36b22e){if(_0x36b22e){return _0x48b448[_0x0717('0x1c')](_0x222c3d)['json'](_0x36b22e);}};}function respondWithFilteredResult(_0x21110f,_0x2d0067){return function(_0x156e2f){if(_0x156e2f){var _0x2a701=typeof _0x2d0067[_0x0717('0x1e')]===_0x0717('0x1f')&&typeof _0x2d0067[_0x0717('0x20')]==='undefined';var _0x44331e=_0x156e2f['count'];var _0x4cf220=_0x2a701?0x0:_0x2d0067[_0x0717('0x1e')];var _0x56dfdd=_0x2a701?_0x156e2f[_0x0717('0x21')]:_0x2d0067[_0x0717('0x1e')]+_0x2d0067[_0x0717('0x20')];var _0x3eb703;if(_0x56dfdd>=_0x44331e){_0x56dfdd=_0x44331e;_0x3eb703=0xc8;}else{_0x3eb703=0xce;}_0x21110f[_0x0717('0x1c')](_0x3eb703);return _0x21110f[_0x0717('0x22')](_0x0717('0x23'),_0x4cf220+'-'+_0x56dfdd+'/'+_0x44331e)[_0x0717('0x24')](_0x156e2f);}return null;};}function patchUpdates(_0x1a2409){return function(_0x5d386a){try{jsonpatch[_0x0717('0x25')](_0x5d386a,_0x1a2409,!![]);}catch(_0x5ef647){return BPromise[_0x0717('0x26')](_0x5ef647);}return _0x5d386a[_0x0717('0x27')]();};}function saveUpdates(_0x532622,_0x34d28f){return function(_0x187274){if(_0x187274){return _0x187274['update'](_0x532622)[_0x0717('0x28')](function(_0x2a7033){return _0x2a7033;});}return null;};}function removeEntity(_0x111f29,_0x4da215){return function(_0x15d7ad){if(_0x15d7ad){return _0x15d7ad[_0x0717('0x29')]()['then'](function(){_0x111f29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x315a27,_0x2cdd62){return function(_0x2448dc){if(!_0x2448dc){_0x315a27[_0x0717('0x1b')](0x194);}return _0x2448dc;};}function handleError(_0x21c107,_0x187961){_0x187961=_0x187961||0x1f4;return function(_0x2dd33c){logger[_0x0717('0x2a')](_0x2dd33c['stack']);if(_0x2dd33c[_0x0717('0x2b')]){delete _0x2dd33c[_0x0717('0x2b')];}_0x21c107[_0x0717('0x1c')](_0x187961)[_0x0717('0x2c')](_0x2dd33c);};}exports['index']=function(_0x5b959b,_0x91f2b7){var _0x3c47ab={},_0x2e7063={},_0x441ae5={'count':0x0,'rows':[]};var _0x185e68=_[_0x0717('0x2d')](db['CmHopperHistory']['rawAttributes'],function(_0x4aceea){return{'name':_0x4aceea[_0x0717('0x2e')],'type':_0x4aceea['type'][_0x0717('0x2f')]};});_0x2e7063[_0x0717('0x30')]=_[_0x0717('0x2d')](_0x185e68,_0x0717('0x2b'));_0x2e7063[_0x0717('0x31')]=_[_0x0717('0x32')](_0x5b959b[_0x0717('0x31')]);_0x2e7063['filters']=_[_0x0717('0x33')](_0x2e7063[_0x0717('0x30')],_0x2e7063[_0x0717('0x31')]);_0x3c47ab[_0x0717('0x34')]=_[_0x0717('0x33')](_0x2e7063[_0x0717('0x30')],qs[_0x0717('0x35')](_0x5b959b[_0x0717('0x31')][_0x0717('0x35')]));_0x3c47ab[_0x0717('0x34')]=_0x3c47ab[_0x0717('0x34')][_0x0717('0x36')]?_0x3c47ab[_0x0717('0x34')]:_0x2e7063['model'];if(!_0x5b959b['query'][_0x0717('0x37')](_0x0717('0x38'))){_0x3c47ab[_0x0717('0x20')]=qs[_0x0717('0x20')](_0x5b959b['query']['limit']);_0x3c47ab['offset']=qs[_0x0717('0x1e')](_0x5b959b[_0x0717('0x31')][_0x0717('0x1e')]);}_0x3c47ab['order']=qs[_0x0717('0x39')](_0x5b959b[_0x0717('0x31')][_0x0717('0x39')]);_0x3c47ab[_0x0717('0x3a')]=qs[_0x0717('0x3b')](_[_0x0717('0x3c')](_0x5b959b[_0x0717('0x31')],_0x2e7063[_0x0717('0x3b')]),_0x185e68);if(_0x5b959b[_0x0717('0x31')]['filter']){_0x3c47ab[_0x0717('0x3a')]=_[_0x0717('0x3d')](_0x3c47ab['where'],{'$or':_[_0x0717('0x2d')](_0x185e68,function(_0x5d47e4){if(_0x5d47e4['type']!==_0x0717('0x3e')){var _0x4312bb={};_0x4312bb[_0x5d47e4[_0x0717('0x2b')]]={'$like':'%'+_0x5b959b[_0x0717('0x31')][_0x0717('0x3f')]+'%'};return _0x4312bb;}})});}_0x3c47ab=_[_0x0717('0x3d')]({},_0x3c47ab,_0x5b959b[_0x0717('0x40')]);var _0x1088cc={'where':_0x3c47ab['where']};return db[_0x0717('0x41')][_0x0717('0x21')](_0x1088cc)[_0x0717('0x28')](function(_0x2817ad){_0x441ae5[_0x0717('0x21')]=_0x2817ad;if(_0x5b959b[_0x0717('0x31')]['includeAll']){_0x3c47ab[_0x0717('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0717('0x43')](_0x3c47ab);})[_0x0717('0x28')](function(_0x326dae){_0x441ae5[_0x0717('0x44')]=_0x326dae;return _0x441ae5;})[_0x0717('0x28')](respondWithFilteredResult(_0x91f2b7,_0x3c47ab))[_0x0717('0x45')](handleError(_0x91f2b7,null));};exports[_0x0717('0x46')]=function(_0x27efa2,_0x85ed5){var _0x4d93ff={'raw':!![],'where':{'id':_0x27efa2[_0x0717('0x47')]['id']}},_0x38d627={};_0x38d627['model']=_[_0x0717('0x32')](db['CmHopperHistory'][_0x0717('0x48')]);_0x38d627['query']=_[_0x0717('0x32')](_0x27efa2['query']);_0x38d627[_0x0717('0x3b')]=_['intersection'](_0x38d627[_0x0717('0x30')],_0x38d627[_0x0717('0x31')]);_0x4d93ff[_0x0717('0x34')]=_['intersection'](_0x38d627[_0x0717('0x30')],qs[_0x0717('0x35')](_0x27efa2[_0x0717('0x31')][_0x0717('0x35')]));_0x4d93ff[_0x0717('0x34')]=_0x4d93ff[_0x0717('0x34')][_0x0717('0x36')]?_0x4d93ff[_0x0717('0x34')]:_0x38d627['model'];if(_0x27efa2[_0x0717('0x31')][_0x0717('0x49')]){_0x4d93ff[_0x0717('0x42')]=[{'all':!![]}];}_0x4d93ff=_[_0x0717('0x3d')]({},_0x4d93ff,_0x27efa2[_0x0717('0x40')]);return db[_0x0717('0x41')]['find'](_0x4d93ff)[_0x0717('0x28')](handleEntityNotFound(_0x85ed5,null))[_0x0717('0x28')](respondWithResult(_0x85ed5,null))['catch'](handleError(_0x85ed5,null));};exports[_0x0717('0x4a')]=function(_0xaad8b7,_0x519f2c){return db['CmHopperHistory'][_0x0717('0x4a')](_0xaad8b7['body'],{})[_0x0717('0x28')](respondWithResult(_0x519f2c,0xc9))[_0x0717('0x45')](handleError(_0x519f2c,null));};exports[_0x0717('0x4b')]=function(_0x2f2305,_0x4ed09e){return db[_0x0717('0x41')][_0x0717('0x4b')]()[_0x0717('0x28')](respondWithResult(_0x4ed09e,null))[_0x0717('0x45')](handleError(_0x4ed09e,null));};exports[_0x0717('0x4c')]=function(_0x6093de,_0x307b98){if(_0x6093de[_0x0717('0x4d')][_0x0717('0x4e')]){delete _0x6093de[_0x0717('0x4d')][_0x0717('0x4e')];}return db[_0x0717('0x41')][_0x0717('0x4f')]({'where':{'uniqueid':_0x6093de['params']['id']}})[_0x0717('0x28')](handleEntityNotFound(_0x307b98,null))[_0x0717('0x28')](saveUpdates(_0x6093de[_0x0717('0x4d')],null))[_0x0717('0x28')](respondWithResult(_0x307b98,null))[_0x0717('0x45')](handleError(_0x307b98,null));}; \ No newline at end of file +var _0x8d2b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','type','key','map','query','keys','filters','intersection','fields','attributes','length','model','order','sort','pick','filter','where','merge','options','CmHopperHistory','findAll','then','rows','catch','show','rawAttributes','includeAll','find','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x2fcf43,_0x3e5722){var _0x2bed87=function(_0x422b67){while(--_0x422b67){_0x2fcf43['push'](_0x2fcf43['shift']());}};_0x2bed87(++_0x3e5722);}(_0x8d2b,0x1c9));var _0xb8d2=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x8d2b[_0x261e29];return _0x25ef43;};'use strict';var emlformat=require(_0xb8d2('0x0'));var rimraf=require(_0xb8d2('0x1'));var zipdir=require(_0xb8d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8d2('0x3'));var moment=require(_0xb8d2('0x4'));var BPromise=require(_0xb8d2('0x5'));var Mustache=require(_0xb8d2('0x6'));var util=require(_0xb8d2('0x7'));var path=require(_0xb8d2('0x8'));var sox=require('sox');var csv=require(_0xb8d2('0x9'));var ejs=require(_0xb8d2('0xa'));var fs=require('fs');var fs_extra=require(_0xb8d2('0xb'));var _=require(_0xb8d2('0xc'));var squel=require(_0xb8d2('0xd'));var crypto=require(_0xb8d2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb8d2('0xf'));var toCsv=require(_0xb8d2('0x9'));var querystring=require(_0xb8d2('0x10'));var Papa=require(_0xb8d2('0x11'));var Redis=require(_0xb8d2('0x12'));var authService=require(_0xb8d2('0x13'));var qs=require(_0xb8d2('0x14'));var as=require(_0xb8d2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8d2('0x16'))(_0xb8d2('0x17'));var utils=require(_0xb8d2('0x18'));var config=require(_0xb8d2('0x19'));var licenseUtil=require(_0xb8d2('0x1a'));var db=require(_0xb8d2('0x1b'))['db'];function respondWithStatusCode(_0x32e6c9,_0x4f2afc){_0x4f2afc=_0x4f2afc||0xcc;return function(_0x2014e5){if(_0x2014e5){return _0x32e6c9['sendStatus'](_0x4f2afc);}return _0x32e6c9[_0xb8d2('0x1c')](_0x4f2afc)[_0xb8d2('0x1d')]();};}function respondWithResult(_0x3c1b0f,_0x50297b){_0x50297b=_0x50297b||0xc8;return function(_0x1a3254){if(_0x1a3254){return _0x3c1b0f[_0xb8d2('0x1c')](_0x50297b)[_0xb8d2('0x1e')](_0x1a3254);}};}function respondWithFilteredResult(_0x108efb,_0x199033){return function(_0x2f6b6c){if(_0x2f6b6c){var _0xc6a21e=typeof _0x199033[_0xb8d2('0x1f')]===_0xb8d2('0x20')&&typeof _0x199033[_0xb8d2('0x21')]==='undefined';var _0x1cb37d=_0x2f6b6c[_0xb8d2('0x22')];var _0x588178=_0xc6a21e?0x0:_0x199033[_0xb8d2('0x1f')];var _0x389b41=_0xc6a21e?_0x2f6b6c[_0xb8d2('0x22')]:_0x199033[_0xb8d2('0x1f')]+_0x199033[_0xb8d2('0x21')];var _0x3fdbee;if(_0x389b41>=_0x1cb37d){_0x389b41=_0x1cb37d;_0x3fdbee=0xc8;}else{_0x3fdbee=0xce;}_0x108efb[_0xb8d2('0x1c')](_0x3fdbee);return _0x108efb['set'](_0xb8d2('0x23'),_0x588178+'-'+_0x389b41+'/'+_0x1cb37d)[_0xb8d2('0x1e')](_0x2f6b6c);}return null;};}function patchUpdates(_0xb57c0c){return function(_0x59d3d9){try{jsonpatch[_0xb8d2('0x24')](_0x59d3d9,_0xb57c0c,!![]);}catch(_0x37fd3f){return BPromise[_0xb8d2('0x25')](_0x37fd3f);}return _0x59d3d9[_0xb8d2('0x26')]();};}function saveUpdates(_0x3f55c3,_0xee0da5){return function(_0x290f84){if(_0x290f84){return _0x290f84[_0xb8d2('0x27')](_0x3f55c3)['then'](function(_0x4b6e3f){return _0x4b6e3f;});}return null;};}function removeEntity(_0x50be9b,_0x2f701b){return function(_0x2ee906){if(_0x2ee906){return _0x2ee906[_0xb8d2('0x28')]()['then'](function(){_0x50be9b[_0xb8d2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f45c3,_0x13f40c){return function(_0x189383){if(!_0x189383){_0x4f45c3[_0xb8d2('0x29')](0x194);}return _0x189383;};}function handleError(_0x1d588f,_0x2cf2a4){_0x2cf2a4=_0x2cf2a4||0x1f4;return function(_0x212c94){logger[_0xb8d2('0x2a')](_0x212c94[_0xb8d2('0x2b')]);if(_0x212c94[_0xb8d2('0x2c')]){delete _0x212c94[_0xb8d2('0x2c')];}_0x1d588f[_0xb8d2('0x1c')](_0x2cf2a4)[_0xb8d2('0x2d')](_0x212c94);};}exports[_0xb8d2('0x2e')]=function(_0x3998ea,_0x4d1539){var _0x40f12e={},_0x473368={},_0x634597={'count':0x0,'rows':[]};var _0xeffe98=_['map'](db['CmHopperHistory']['rawAttributes'],function(_0x55608e){return{'name':_0x55608e['fieldName'],'type':_0x55608e[_0xb8d2('0x2f')][_0xb8d2('0x30')]};});_0x473368['model']=_[_0xb8d2('0x31')](_0xeffe98,'name');_0x473368[_0xb8d2('0x32')]=_[_0xb8d2('0x33')](_0x3998ea['query']);_0x473368[_0xb8d2('0x34')]=_[_0xb8d2('0x35')](_0x473368['model'],_0x473368[_0xb8d2('0x32')]);_0x40f12e['attributes']=_[_0xb8d2('0x35')](_0x473368['model'],qs[_0xb8d2('0x36')](_0x3998ea['query'][_0xb8d2('0x36')]));_0x40f12e[_0xb8d2('0x37')]=_0x40f12e['attributes'][_0xb8d2('0x38')]?_0x40f12e[_0xb8d2('0x37')]:_0x473368[_0xb8d2('0x39')];if(!_0x3998ea[_0xb8d2('0x32')]['hasOwnProperty']('nolimit')){_0x40f12e['limit']=qs[_0xb8d2('0x21')](_0x3998ea['query']['limit']);_0x40f12e[_0xb8d2('0x1f')]=qs[_0xb8d2('0x1f')](_0x3998ea['query'][_0xb8d2('0x1f')]);}_0x40f12e[_0xb8d2('0x3a')]=qs[_0xb8d2('0x3b')](_0x3998ea[_0xb8d2('0x32')][_0xb8d2('0x3b')]);_0x40f12e['where']=qs[_0xb8d2('0x34')](_[_0xb8d2('0x3c')](_0x3998ea[_0xb8d2('0x32')],_0x473368[_0xb8d2('0x34')]),_0xeffe98);if(_0x3998ea[_0xb8d2('0x32')][_0xb8d2('0x3d')]){_0x40f12e[_0xb8d2('0x3e')]=_[_0xb8d2('0x3f')](_0x40f12e[_0xb8d2('0x3e')],{'$or':_[_0xb8d2('0x31')](_0xeffe98,function(_0x4ae041){if(_0x4ae041[_0xb8d2('0x2f')]!=='VIRTUAL'){var _0x16d5c5={};_0x16d5c5[_0x4ae041[_0xb8d2('0x2c')]]={'$like':'%'+_0x3998ea[_0xb8d2('0x32')]['filter']+'%'};return _0x16d5c5;}})});}_0x40f12e=_[_0xb8d2('0x3f')]({},_0x40f12e,_0x3998ea[_0xb8d2('0x40')]);var _0xb675f3={'where':_0x40f12e[_0xb8d2('0x3e')]};return db['CmHopperHistory'][_0xb8d2('0x22')](_0xb675f3)['then'](function(_0xcd8725){_0x634597[_0xb8d2('0x22')]=_0xcd8725;if(_0x3998ea[_0xb8d2('0x32')]['includeAll']){_0x40f12e['include']=[{'all':!![]}];}return db[_0xb8d2('0x41')][_0xb8d2('0x42')](_0x40f12e);})[_0xb8d2('0x43')](function(_0x563460){_0x634597[_0xb8d2('0x44')]=_0x563460;return _0x634597;})['then'](respondWithFilteredResult(_0x4d1539,_0x40f12e))[_0xb8d2('0x45')](handleError(_0x4d1539,null));};exports[_0xb8d2('0x46')]=function(_0x3b75c3,_0x5a0176){var _0x2ca4d4={'raw':!![],'where':{'id':_0x3b75c3['params']['id']}},_0x1adffe={};_0x1adffe[_0xb8d2('0x39')]=_[_0xb8d2('0x33')](db['CmHopperHistory'][_0xb8d2('0x47')]);_0x1adffe['query']=_[_0xb8d2('0x33')](_0x3b75c3['query']);_0x1adffe['filters']=_[_0xb8d2('0x35')](_0x1adffe['model'],_0x1adffe[_0xb8d2('0x32')]);_0x2ca4d4[_0xb8d2('0x37')]=_['intersection'](_0x1adffe[_0xb8d2('0x39')],qs[_0xb8d2('0x36')](_0x3b75c3['query'][_0xb8d2('0x36')]));_0x2ca4d4[_0xb8d2('0x37')]=_0x2ca4d4[_0xb8d2('0x37')][_0xb8d2('0x38')]?_0x2ca4d4[_0xb8d2('0x37')]:_0x1adffe[_0xb8d2('0x39')];if(_0x3b75c3[_0xb8d2('0x32')][_0xb8d2('0x48')]){_0x2ca4d4['include']=[{'all':!![]}];}_0x2ca4d4=_[_0xb8d2('0x3f')]({},_0x2ca4d4,_0x3b75c3['options']);return db[_0xb8d2('0x41')][_0xb8d2('0x49')](_0x2ca4d4)[_0xb8d2('0x43')](handleEntityNotFound(_0x5a0176,null))['then'](respondWithResult(_0x5a0176,null))['catch'](handleError(_0x5a0176,null));};exports[_0xb8d2('0x4a')]=function(_0x30cb7f,_0x389a43){return db[_0xb8d2('0x41')]['create'](_0x30cb7f[_0xb8d2('0x4b')],{})[_0xb8d2('0x43')](respondWithResult(_0x389a43,0xc9))[_0xb8d2('0x45')](handleError(_0x389a43,null));};exports[_0xb8d2('0x4c')]=function(_0x4f0dbe,_0x47eb70){return db[_0xb8d2('0x41')]['describe']()['then'](respondWithResult(_0x47eb70,null))[_0xb8d2('0x45')](handleError(_0x47eb70,null));};exports['update']=function(_0x137773,_0x402a99){if(_0x137773[_0xb8d2('0x4b')][_0xb8d2('0x4d')]){delete _0x137773[_0xb8d2('0x4b')][_0xb8d2('0x4d')];}return db[_0xb8d2('0x41')][_0xb8d2('0x49')]({'where':{'uniqueid':_0x137773[_0xb8d2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x402a99,null))[_0xb8d2('0x43')](saveUpdates(_0x137773[_0xb8d2('0x4b')],null))[_0xb8d2('0x43')](respondWithResult(_0x402a99,null))[_0xb8d2('0x45')](handleError(_0x402a99,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 4e2d8bf..b2cdafe 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 _0x042a=['moment','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x042a,0x1d9));var _0xa042=function(_0x16b61d,_0x3c3d0c){_0x16b61d=_0x16b61d-0x0;var _0xa1f3=_0x042a[_0x16b61d];return _0xa1f3;};'use strict';var _=require(_0xa042('0x0'));var util=require('util');var logger=require(_0xa042('0x1'))(_0xa042('0x2'));var moment=require(_0xa042('0x3'));var BPromise=require('bluebird');var rp=require(_0xa042('0x4'));var fs=require('fs');var path=require(_0xa042('0x5'));var rimraf=require(_0xa042('0x6'));var config=require(_0xa042('0x7'));var attributes=require(_0xa042('0x8'));module[_0xa042('0x9')]=function(_0x622ece,_0xc35608){return _0x622ece['define'](_0xa042('0xa'),attributes,{'tableName':_0xa042('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xa042('0xc')]},{'name':'uniqueid','fields':[_0xa042('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5800=['uniqueid','util','../../config/logger','api','moment','request-promise','path','../../config/environment','CmHopperHistory','endtime'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x5800,0x1b9));var _0x0580=function(_0x4852e9,_0x5f2606){_0x4852e9=_0x4852e9-0x0;var _0x41df49=_0x5800[_0x4852e9];return _0x41df49;};'use strict';var _=require('lodash');var util=require(_0x0580('0x0'));var logger=require(_0x0580('0x1'))(_0x0580('0x2'));var moment=require(_0x0580('0x3'));var BPromise=require('bluebird');var rp=require(_0x0580('0x4'));var fs=require('fs');var path=require(_0x0580('0x5'));var rimraf=require('rimraf');var config=require(_0x0580('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x36e61e,_0xe05a43){return _0x36e61e['define'](_0x0580('0x7'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x0580('0x8'),'fields':['endtime']},{'name':_0x0580('0x9'),'fields':[_0x0580('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index e527fe9..84303cb 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 _0xb84e=['../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','ivrTotalCallsDays','GetCampaignHopperHistory','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x16938f,_0x35e57f){var _0x5c66e9=function(_0x5167d7){while(--_0x5167d7){_0x16938f['push'](_0x16938f['shift']());}};_0x5c66e9(++_0x35e57f);}(_0xb84e,0xbf));var _0xeb84=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0xb84e[_0x65c0bb];return _0x320bd5;};'use strict';var _=require('lodash');var util=require(_0xeb84('0x0'));var moment=require(_0xeb84('0x1'));var BPromise=require(_0xeb84('0x2'));var rs=require(_0xeb84('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeb84('0x4'));var logger=require(_0xeb84('0x5'))(_0xeb84('0x6'));var config=require(_0xeb84('0x7'));var jayson=require(_0xeb84('0x8'));var client=jayson[_0xeb84('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a046c,_0x3ebad9,_0x4cd86e){return new BPromise(function(_0x45a089,_0x1b3548){return client[_0xeb84('0xa')](_0x4a046c,_0x4cd86e)[_0xeb84('0xb')](function(_0x5b1b26){logger[_0xeb84('0xc')](_0xeb84('0xd'),_0x3ebad9,_0xeb84('0xe'));logger[_0xeb84('0xf')](_0xeb84('0x10'),_0x3ebad9,_0xeb84('0xe'),JSON[_0xeb84('0x11')](_0x5b1b26));if(_0x5b1b26[_0xeb84('0x12')]){if(_0x5b1b26[_0xeb84('0x12')][_0xeb84('0x13')]===0x1f4){logger[_0xeb84('0x12')](_0xeb84('0xd'),_0x3ebad9,_0x5b1b26[_0xeb84('0x12')]['message']);return _0x1b3548(_0x5b1b26['error'][_0xeb84('0x14')]);}logger[_0xeb84('0x12')](_0xeb84('0xd'),_0x3ebad9,_0x5b1b26[_0xeb84('0x12')][_0xeb84('0x14')]);return _0x45a089(_0x5b1b26[_0xeb84('0x12')]['message']);}else{logger[_0xeb84('0xc')](_0xeb84('0xd'),_0x3ebad9,_0xeb84('0xe'));_0x45a089(_0x5b1b26[_0xeb84('0x15')]['message']);}})[_0xeb84('0x16')](function(_0x1678f7){logger[_0xeb84('0x12')](_0xeb84('0xd'),_0x3ebad9,_0x1678f7);_0x1b3548(_0x1678f7);});});}exports[_0xeb84('0x17')]=function(_0x502e75){var _0x6ec07d=this;return new Promise(function(_0x5bbdb9,_0x360575){return db[_0xeb84('0x18')][_0xeb84('0x19')](_0x502e75['body'],{'raw':_0x502e75['options']?_0x502e75[_0xeb84('0x1a')][_0xeb84('0x1b')]===undefined?!![]:![]:!![]})[_0xeb84('0xb')](function(_0x3ac277){logger[_0xeb84('0xc')](_0xeb84('0x17'),_0x502e75);logger[_0xeb84('0xf')](_0xeb84('0x17'),_0x502e75,JSON[_0xeb84('0x11')](_0x3ac277));_0x5bbdb9(_0x3ac277);})[_0xeb84('0x16')](function(_0x159622){logger[_0xeb84('0x12')](_0xeb84('0x17'),_0x159622[_0xeb84('0x14')],_0x502e75);_0x360575(_0x6ec07d[_0xeb84('0x12')](0x1f4,_0x159622[_0xeb84('0x14')]));});});};exports['AvgHandleTime']=function(_0x22ebf7){var _0x64b4ac=this;return new Promise(function(_0x4c0865,_0x1345f3){return db[_0xeb84('0x18')][_0xeb84('0x1c')]({'raw':_0x22ebf7[_0xeb84('0x1a')]?_0x22ebf7[_0xeb84('0x1a')][_0xeb84('0x1b')]===undefined?!![]:![]:!![],'where':_0x22ebf7[_0xeb84('0x1a')]?_0x22ebf7['options']['where']||null:null,'attributes':[[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')][_0xeb84('0x1f')]('id')),_0xeb84('0x20')],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db[_0xeb84('0x1d')][_0xeb84('0x21')](_0xeb84('0x22')))),_0xeb84('0x23')],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db['sequelize']['fn']('IF',db[_0xeb84('0x1d')][_0xeb84('0x21')](_0xeb84('0x24')))),_0xeb84('0x25')],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db[_0xeb84('0x1d')][_0xeb84('0x21')](_0xeb84('0x26')))),_0xeb84('0x27')],[db['sequelize']['fn']('AVG',db[_0xeb84('0x1d')]['fn']('IF',db['sequelize'][_0xeb84('0x21')](_0xeb84('0x28')))),_0xeb84('0x29')],[db[_0xeb84('0x1d')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xeb84('0x1d')][_0xeb84('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xeb84('0x2a')]]})[_0xeb84('0xb')](function(_0x5a6fd4){logger[_0xeb84('0xc')](_0xeb84('0x2b'),_0x22ebf7);logger['debug'](_0xeb84('0x2b'),_0x22ebf7,JSON['stringify'](_0x5a6fd4));_0x4c0865(_0x5a6fd4);})['catch'](function(_0xb9ae36){logger['error'](_0xeb84('0x2b'),_0xb9ae36[_0xeb84('0x14')],_0x22ebf7);_0x1345f3(_0x64b4ac[_0xeb84('0x12')](0x1f4,_0xb9ae36[_0xeb84('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x18b22d){var _0x516b96=this;return new Promise(function(_0x46462a,_0x25b031){return db[_0xeb84('0x18')][_0xeb84('0x1c')]({'raw':_0x18b22d[_0xeb84('0x1a')]?_0x18b22d[_0xeb84('0x1a')][_0xeb84('0x1b')]===undefined?!![]:![]:!![],'where':_0x18b22d[_0xeb84('0x1a')]?_0x18b22d['options'][_0xeb84('0x2c')]||null:null,'attributes':[[_0xeb84('0x2d'),_0xeb84('0x2e')],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xeb84('0x2f')))),'outboundNoSuchCallsDay'],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db['sequelize'][_0xeb84('0x21')](_0xeb84('0x30')))),_0xeb84('0x31')],[db['sequelize']['fn'](_0xeb84('0x1e'),db['sequelize']['fn']('IF',db[_0xeb84('0x1d')]['literal'](_0xeb84('0x22')))),_0xeb84('0x32')],[db['sequelize']['fn']('COUNT',db[_0xeb84('0x1d')]['fn']('IF',db[_0xeb84('0x1d')][_0xeb84('0x21')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db['sequelize']['fn']('IF',db[_0xeb84('0x1d')]['literal'](_0xeb84('0x33')))),_0xeb84('0x34')],[db['sequelize']['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db[_0xeb84('0x1d')][_0xeb84('0x21')](_0xeb84('0x35')))),_0xeb84('0x36')],[db['sequelize']['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db['sequelize'][_0xeb84('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db[_0xeb84('0x1d')]['literal'](_0xeb84('0x37')))),_0xeb84('0x38')],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db['sequelize'][_0xeb84('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db[_0xeb84('0x1d')]['literal'](_0xeb84('0x39')))),_0xeb84('0x3a')],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db['sequelize'][_0xeb84('0x21')](_0xeb84('0x3b')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xeb84('0x3c')))),'outboundRejectCallsDay'],[db[_0xeb84('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xeb84('0x1d')]['literal'](_0xeb84('0x3d')))),_0xeb84('0x3e')]],'group':[_0xeb84('0x2d')]})['then'](function(_0x2c0673){logger['info']('GetVoiceQueueHopperHistory',_0x18b22d);logger[_0xeb84('0xf')](_0xeb84('0x3f'),_0x18b22d,JSON['stringify'](_0x2c0673));_0x46462a(_0x2c0673);})['catch'](function(_0x5a81d6){logger['error'](_0xeb84('0x3f'),_0x5a81d6[_0xeb84('0x14')],_0x18b22d);_0x25b031(_0x516b96[_0xeb84('0x12')](0x1f4,_0x5a81d6[_0xeb84('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x1487ed){var _0xc99fa0=this;return new Promise(function(_0x57acb8,_0x281255){return db[_0xeb84('0x18')][_0xeb84('0x1c')]({'raw':_0x1487ed[_0xeb84('0x1a')]?_0x1487ed['options'][_0xeb84('0x1b')]===undefined?!![]:![]:!![],'where':_0x1487ed['options']?_0x1487ed[_0xeb84('0x1a')][_0xeb84('0x2c')]||null:null,'attributes':[[_0xeb84('0x2d'),'name'],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')][_0xeb84('0x1f')]('id')),_0xeb84('0x40')],[db[_0xeb84('0x1d')]['fn'](_0xeb84('0x1e'),db[_0xeb84('0x1d')]['fn']('IF',db[_0xeb84('0x1d')][_0xeb84('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0xeb84('0x2d')]})[_0xeb84('0xb')](function(_0x44719c){logger[_0xeb84('0xc')](_0xeb84('0x41'),_0x1487ed);logger[_0xeb84('0xf')](_0xeb84('0x41'),_0x1487ed,JSON[_0xeb84('0x11')](_0x44719c));_0x57acb8(_0x44719c);})['catch'](function(_0x4bdf3d){logger[_0xeb84('0x12')](_0xeb84('0x41'),_0x4bdf3d[_0xeb84('0x14')],_0x1487ed);_0x281255(_0xc99fa0[_0xeb84('0x12')](0x1f4,_0x4bdf3d[_0xeb84('0x14')]));});});}; \ No newline at end of file +var _0x4dd3=['`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','raw','col','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','stringify','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG'];(function(_0x5906fd,_0x107f15){var _0x49aee4=function(_0x22b07b){while(--_0x22b07b){_0x5906fd['push'](_0x5906fd['shift']());}};_0x49aee4(++_0x107f15);}(_0x4dd3,0xf5));var _0x34dd=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x4dd3[_0x2b5b44];return _0x32cb66;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var moment=require(_0x34dd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x34dd('0x4'));var logger=require(_0x34dd('0x5'))(_0x34dd('0x6'));var config=require('../../config/environment');var jayson=require(_0x34dd('0x7'));var client=jayson[_0x34dd('0x8')][_0x34dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x365482,_0x3a3429,_0x5e8911){return new BPromise(function(_0x4cb036,_0xc0c516){return client[_0x34dd('0xa')](_0x365482,_0x5e8911)[_0x34dd('0xb')](function(_0x4e1bc8){logger[_0x34dd('0xc')](_0x34dd('0xd'),_0x3a3429,_0x34dd('0xe'));logger[_0x34dd('0xf')](_0x34dd('0x10'),_0x3a3429,_0x34dd('0xe'),JSON['stringify'](_0x4e1bc8));if(_0x4e1bc8[_0x34dd('0x11')]){if(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x12')]===0x1f4){logger[_0x34dd('0x11')](_0x34dd('0xd'),_0x3a3429,_0x4e1bc8['error']['message']);return _0xc0c516(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x13')]);}logger[_0x34dd('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3a3429,_0x4e1bc8[_0x34dd('0x11')]['message']);return _0x4cb036(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x13')]);}else{logger[_0x34dd('0xc')](_0x34dd('0xd'),_0x3a3429,_0x34dd('0xe'));_0x4cb036(_0x4e1bc8[_0x34dd('0x14')]['message']);}})[_0x34dd('0x15')](function(_0x46d9f5){logger[_0x34dd('0x11')](_0x34dd('0xd'),_0x3a3429,_0x46d9f5);_0xc0c516(_0x46d9f5);});});}exports[_0x34dd('0x16')]=function(_0x366274){var _0x3e2084=this;return new Promise(function(_0x2b4b52,_0xcbe2b5){return db[_0x34dd('0x17')][_0x34dd('0x18')](_0x366274[_0x34dd('0x19')],{'raw':_0x366274[_0x34dd('0x1a')]?_0x366274[_0x34dd('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x23072a){logger[_0x34dd('0xc')](_0x34dd('0x16'),_0x366274);logger[_0x34dd('0xf')](_0x34dd('0x16'),_0x366274,JSON[_0x34dd('0x1b')](_0x23072a));_0x2b4b52(_0x23072a);})['catch'](function(_0x41e4bf){logger[_0x34dd('0x11')]('CreateCmHopperHistory',_0x41e4bf['message'],_0x366274);_0xcbe2b5(_0x3e2084['error'](0x1f4,_0x41e4bf[_0x34dd('0x13')]));});});};exports['AvgHandleTime']=function(_0x93beae){var _0x330641=this;return new Promise(function(_0x4c2e31,_0x29e4a3){return db[_0x34dd('0x17')]['findAll']({'raw':_0x93beae['options']?_0x93beae[_0x34dd('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x93beae[_0x34dd('0x1a')]?_0x93beae[_0x34dd('0x1a')][_0x34dd('0x1c')]||null:null,'attributes':[[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['col']('id')),_0x34dd('0x1f')],[db[_0x34dd('0x1d')]['fn']('COUNT',db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x21')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x22')))),_0x34dd('0x23')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x34dd('0x20')](_0x34dd('0x24')))),_0x34dd('0x25')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x26'),db[_0x34dd('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x34dd('0x27')))),_0x34dd('0x28')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x26'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')]['literal'](_0x34dd('0x29')))),_0x34dd('0x2a')]]})['then'](function(_0x580155){logger[_0x34dd('0xc')](_0x34dd('0x2b'),_0x93beae);logger[_0x34dd('0xf')](_0x34dd('0x2b'),_0x93beae,JSON[_0x34dd('0x1b')](_0x580155));_0x4c2e31(_0x580155);})[_0x34dd('0x15')](function(_0x3c567e){logger[_0x34dd('0x11')]('AvgHandleTime',_0x3c567e[_0x34dd('0x13')],_0x93beae);_0x29e4a3(_0x330641[_0x34dd('0x11')](0x1f4,_0x3c567e['message']));});});};exports[_0x34dd('0x2c')]=function(_0x1df9e4){var _0x6c3eba=this;return new Promise(function(_0x32a7fb,_0x5906b8){return db[_0x34dd('0x17')][_0x34dd('0x2d')]({'raw':_0x1df9e4['options']?_0x1df9e4[_0x34dd('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1df9e4['options']?_0x1df9e4[_0x34dd('0x1a')][_0x34dd('0x1c')]||null:null,'attributes':[[_0x34dd('0x2e'),_0x34dd('0x2f')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')]('`state`\x20=\x200,\x201,\x20null'))),_0x34dd('0x30')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x31')))),_0x34dd('0x32')],[db[_0x34dd('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x21')))),'outboundAnswerCallsDay'],[db[_0x34dd('0x1d')]['fn']('COUNT',db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x33')))),'outboundBusyCallsDay'],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x34')))),_0x34dd('0x35')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db['sequelize']['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x36')))),_0x34dd('0x37')],[db['sequelize']['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x38')))),_0x34dd('0x39')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db['sequelize']['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0x34dd('0x3a')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),_0x34dd('0x3b')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')]['literal'](_0x34dd('0x3c')))),_0x34dd('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x3e')))),_0x34dd('0x3f')],[db[_0x34dd('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x34dd('0x40')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db['sequelize'][_0x34dd('0x20')](_0x34dd('0x41')))),_0x34dd('0x3f')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x34dd('0x2e')]})[_0x34dd('0xb')](function(_0x181c8e){logger['info'](_0x34dd('0x2c'),_0x1df9e4);logger[_0x34dd('0xf')]('GetVoiceQueueHopperHistory',_0x1df9e4,JSON[_0x34dd('0x1b')](_0x181c8e));_0x32a7fb(_0x181c8e);})[_0x34dd('0x15')](function(_0x365b97){logger[_0x34dd('0x11')]('GetVoiceQueueHopperHistory',_0x365b97[_0x34dd('0x13')],_0x1df9e4);_0x5906b8(_0x6c3eba[_0x34dd('0x11')](0x1f4,_0x365b97[_0x34dd('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x376bb6){var _0x396b3c=this;return new Promise(function(_0x2827e4,_0xbf3a2c){return db[_0x34dd('0x17')][_0x34dd('0x2d')]({'raw':_0x376bb6['options']?_0x376bb6[_0x34dd('0x1a')][_0x34dd('0x42')]===undefined?!![]:![]:!![],'where':_0x376bb6[_0x34dd('0x1a')]?_0x376bb6[_0x34dd('0x1a')]['where']||null:null,'attributes':[[_0x34dd('0x2e'),_0x34dd('0x2f')],[db['sequelize']['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')][_0x34dd('0x43')]('id')),_0x34dd('0x44')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db['sequelize']['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x21')))),_0x34dd('0x45')]],'group':[_0x34dd('0x2e')]})[_0x34dd('0xb')](function(_0x38b212){logger[_0x34dd('0xc')]('GetCampaignHopperHistory',_0x376bb6);logger[_0x34dd('0xf')](_0x34dd('0x46'),_0x376bb6,JSON[_0x34dd('0x1b')](_0x38b212));_0x2827e4(_0x38b212);})[_0x34dd('0x15')](function(_0x269e1f){logger[_0x34dd('0x11')](_0x34dd('0x46'),_0x269e1f[_0x34dd('0x13')],_0x376bb6);_0xbf3a2c(_0x396b3c[_0x34dd('0x11')](0x1f4,_0x269e1f['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 1fea6d2..28cacc0 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 _0x8225=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','post','put','exports','multer','util','path','connect-timeout','express'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0x8225,0x19d));var _0x5822=function(_0x2b0113,_0x2fcc52){_0x2b0113=_0x2b0113-0x0;var _0x16c5e4=_0x8225[_0x2b0113];return _0x16c5e4;};'use strict';var multer=require(_0x5822('0x0'));var util=require(_0x5822('0x1'));var path=require(_0x5822('0x2'));var timeout=require(_0x5822('0x3'));var express=require(_0x5822('0x4'));var router=express[_0x5822('0x5')]();var fs_extra=require(_0x5822('0x6'));var auth=require(_0x5822('0x7'));var interaction=require(_0x5822('0x8'));var config=require(_0x5822('0x9'));var controller=require(_0x5822('0xa'));router[_0x5822('0xb')]('/',auth[_0x5822('0xc')](),controller['index']);router[_0x5822('0xb')](_0x5822('0xd'),auth[_0x5822('0xc')](),controller[_0x5822('0xe')]);router['get'](_0x5822('0xf'),auth[_0x5822('0xc')](),controller['show']);router[_0x5822('0x10')]('/',auth[_0x5822('0xc')](),controller['create']);router[_0x5822('0x11')](_0x5822('0xf'),auth[_0x5822('0xc')](),controller['update']);module[_0x5822('0x12')]=router; \ No newline at end of file +var _0x4ae7=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','update','exports','util','path','connect-timeout'];(function(_0x1cb167,_0x5c7737){var _0xdc8018=function(_0x4fa87f){while(--_0x4fa87f){_0x1cb167['push'](_0x1cb167['shift']());}};_0xdc8018(++_0x5c7737);}(_0x4ae7,0x10d));var _0x74ae=function(_0x54f128,_0x2987fd){_0x54f128=_0x54f128-0x0;var _0x30f507=_0x4ae7[_0x54f128];return _0x30f507;};'use strict';var multer=require('multer');var util=require(_0x74ae('0x0'));var path=require(_0x74ae('0x1'));var timeout=require(_0x74ae('0x2'));var express=require(_0x74ae('0x3'));var router=express[_0x74ae('0x4')]();var fs_extra=require(_0x74ae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x74ae('0x6'));var config=require(_0x74ae('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x74ae('0x8')]('/',auth[_0x74ae('0x9')](),controller['index']);router[_0x74ae('0x8')](_0x74ae('0xa'),auth[_0x74ae('0x9')](),controller[_0x74ae('0xb')]);router['get'](_0x74ae('0xc'),auth[_0x74ae('0x9')](),controller[_0x74ae('0xd')]);router['post']('/',auth[_0x74ae('0x9')](),controller[_0x74ae('0xe')]);router['put'](_0x74ae('0xc'),auth[_0x74ae('0x9')](),controller[_0x74ae('0xf')]);module[_0x74ae('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 643f50d..94952e9 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 _0x448b=['name','sequelize','exports','STRING'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x448b,0x125));var _0xb448=function(_0x1fdba8,_0x234d1d){_0x1fdba8=_0x1fdba8-0x0;var _0x4e4cef=_0x448b[_0x1fdba8];return _0x4e4cef;};'use strict';var Sequelize=require(_0xb448('0x0'));module[_0xb448('0x1')]={'name':{'type':Sequelize[_0xb448('0x2')],'unique':_0xb448('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb448('0x2')]},'dialPrefix':{'type':Sequelize[_0xb448('0x2')]}}; \ No newline at end of file +var _0xf120=['STRING','name','exports'];(function(_0x3fcf30,_0xe3a49e){var _0x2ed4b0=function(_0x306e68){while(--_0x306e68){_0x3fcf30['push'](_0x3fcf30['shift']());}};_0x2ed4b0(++_0xe3a49e);}(_0xf120,0x179));var _0x0f12=function(_0x5dd180,_0x20a332){_0x5dd180=_0x5dd180-0x0;var _0x4d3319=_0xf120[_0x5dd180];return _0x4d3319;};'use strict';var Sequelize=require('sequelize');module[_0x0f12('0x0')]={'name':{'type':Sequelize[_0x0f12('0x1')],'unique':_0x0f12('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x0f12('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 64fef24..0a184a3 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 _0x7b49=['length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','findAll','rows','show','params','include','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','nolimit','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','success','dataValues','errors','getContacts','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./cmList.socket','register','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','then','destroy','get','Lists','UserProfileResource','error','stack','send','index','map','CmList','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields'];(function(_0x1123bb,_0x54472a){var _0xdeb602=function(_0x529467){while(--_0x529467){_0x1123bb['push'](_0x1123bb['shift']());}};_0xdeb602(++_0x54472a);}(_0x7b49,0x6e));var _0x97b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7b49[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x97b4('0x0'));var rimraf=require(_0x97b4('0x1'));var zipdir=require(_0x97b4('0x2'));var jsonpatch=require(_0x97b4('0x3'));var rp=require(_0x97b4('0x4'));var moment=require('moment');var BPromise=require(_0x97b4('0x5'));var Mustache=require(_0x97b4('0x6'));var util=require(_0x97b4('0x7'));var path=require(_0x97b4('0x8'));var sox=require(_0x97b4('0x9'));var csv=require(_0x97b4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x97b4('0xb'));var crypto=require('crypto');var jsforce=require(_0x97b4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x97b4('0xa'));var querystring=require(_0x97b4('0xd'));var Papa=require(_0x97b4('0xe'));var Redis=require(_0x97b4('0xf'));var authService=require(_0x97b4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97b4('0x11'));var logger=require(_0x97b4('0x12'))(_0x97b4('0x13'));var utils=require(_0x97b4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x97b4('0x15'));var db=require(_0x97b4('0x16'))['db'];var csv_results;config[_0x97b4('0x17')]=_['defaults'](config[_0x97b4('0x17')],{'host':_0x97b4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x97b4('0x17')]));require(_0x97b4('0x19'))[_0x97b4('0x1a')](socket);function respondWithStatusCode(_0x5d0432,_0x538a5c){_0x538a5c=_0x538a5c||0xcc;return function(_0x46aa4b){if(_0x46aa4b){return _0x5d0432[_0x97b4('0x1b')](_0x538a5c);}return _0x5d0432['status'](_0x538a5c)[_0x97b4('0x1c')]();};}function respondWithResult(_0x1ab2e4,_0x3eca16){_0x3eca16=_0x3eca16||0xc8;return function(_0xe0dc88){if(_0xe0dc88){return _0x1ab2e4['status'](_0x3eca16)[_0x97b4('0x1d')](_0xe0dc88);}};}function respondWithFilteredResult(_0x1f12a2,_0x4d8fb9){return function(_0x5cd1c2){if(_0x5cd1c2){var _0x11acf5=typeof _0x4d8fb9[_0x97b4('0x1e')]===_0x97b4('0x1f')&&typeof _0x4d8fb9['limit']===_0x97b4('0x1f');var _0x22a0d9=_0x5cd1c2[_0x97b4('0x20')];var _0x55923b=_0x11acf5?0x0:_0x4d8fb9[_0x97b4('0x1e')];var _0x22b37e=_0x11acf5?_0x5cd1c2[_0x97b4('0x20')]:_0x4d8fb9['offset']+_0x4d8fb9['limit'];var _0x3c82bc;if(_0x22b37e>=_0x22a0d9){_0x22b37e=_0x22a0d9;_0x3c82bc=0xc8;}else{_0x3c82bc=0xce;}_0x1f12a2[_0x97b4('0x21')](_0x3c82bc);return _0x1f12a2[_0x97b4('0x22')](_0x97b4('0x23'),_0x55923b+'-'+_0x22b37e+'/'+_0x22a0d9)[_0x97b4('0x1d')](_0x5cd1c2);}return null;};}function patchUpdates(_0xf3edd){return function(_0x7da4b){try{jsonpatch[_0x97b4('0x24')](_0x7da4b,_0xf3edd,!![]);}catch(_0x4ddeb0){return BPromise[_0x97b4('0x25')](_0x4ddeb0);}return _0x7da4b['save']();};}function saveUpdates(_0x12bb71,_0xaace3c){return function(_0x27d454){if(_0x27d454){return _0x27d454['update'](_0x12bb71)[_0x97b4('0x26')](function(_0x302067){return _0x302067;});}return null;};}function removeEntity(_0x441080,_0x25ed34){return function(_0x1d7e7e){if(_0x1d7e7e){return _0x1d7e7e[_0x97b4('0x27')]()[_0x97b4('0x26')](function(){var _0x42d415=_0x1d7e7e[_0x97b4('0x28')]({'plain':!![]});var _0x4a8c3c=_0x97b4('0x29');return db[_0x97b4('0x2a')][_0x97b4('0x27')]({'where':{'type':_0x4a8c3c,'resourceId':_0x42d415['id']}})['then'](function(){return _0x1d7e7e;});})[_0x97b4('0x26')](function(){_0x441080[_0x97b4('0x21')](0xcc)[_0x97b4('0x1c')]();});}};}function handleEntityNotFound(_0x39910c,_0x287b04){return function(_0x48bdd9){if(!_0x48bdd9){_0x39910c[_0x97b4('0x1b')](0x194);}return _0x48bdd9;};}function handleError(_0x135d5c,_0x51500d){_0x51500d=_0x51500d||0x1f4;return function(_0x921468){logger[_0x97b4('0x2b')](_0x921468[_0x97b4('0x2c')]);if(_0x921468['name']){delete _0x921468['name'];}_0x135d5c[_0x97b4('0x21')](_0x51500d)[_0x97b4('0x2d')](_0x921468);};}exports[_0x97b4('0x2e')]=function(_0x53023d,_0x43cab3){var _0x420ef7={},_0x16d3ab={},_0x38e8ca={'count':0x0,'rows':[]};var _0x15a263=_[_0x97b4('0x2f')](db[_0x97b4('0x30')][_0x97b4('0x31')],function(_0x1dac2d){return{'name':_0x1dac2d[_0x97b4('0x32')],'type':_0x1dac2d[_0x97b4('0x33')]['key']};});_0x16d3ab['model']=_[_0x97b4('0x2f')](_0x15a263,'name');_0x16d3ab['query']=_[_0x97b4('0x34')](_0x53023d[_0x97b4('0x35')]);_0x16d3ab[_0x97b4('0x36')]=_[_0x97b4('0x37')](_0x16d3ab['model'],_0x16d3ab[_0x97b4('0x35')]);_0x420ef7[_0x97b4('0x38')]=_[_0x97b4('0x37')](_0x16d3ab[_0x97b4('0x39')],qs[_0x97b4('0x3a')](_0x53023d[_0x97b4('0x35')][_0x97b4('0x3a')]));_0x420ef7[_0x97b4('0x38')]=_0x420ef7[_0x97b4('0x38')][_0x97b4('0x3b')]?_0x420ef7[_0x97b4('0x38')]:_0x16d3ab[_0x97b4('0x39')];if(!_0x53023d[_0x97b4('0x35')][_0x97b4('0x3c')]('nolimit')){_0x420ef7['limit']=qs[_0x97b4('0x3d')](_0x53023d['query'][_0x97b4('0x3d')]);_0x420ef7[_0x97b4('0x1e')]=qs[_0x97b4('0x1e')](_0x53023d['query'][_0x97b4('0x1e')]);}_0x420ef7[_0x97b4('0x3e')]=qs[_0x97b4('0x3f')](_0x53023d[_0x97b4('0x35')][_0x97b4('0x3f')]);_0x420ef7['where']=qs[_0x97b4('0x36')](_[_0x97b4('0x40')](_0x53023d[_0x97b4('0x35')],_0x16d3ab[_0x97b4('0x36')]),_0x15a263);if(_0x53023d['query'][_0x97b4('0x41')]){_0x420ef7[_0x97b4('0x42')]=_[_0x97b4('0x43')](_0x420ef7[_0x97b4('0x42')],{'$or':_['map'](_0x15a263,function(_0x38b0f7){if(_0x38b0f7[_0x97b4('0x33')]!==_0x97b4('0x44')){var _0x2d1467={};_0x2d1467[_0x38b0f7[_0x97b4('0x45')]]={'$like':'%'+_0x53023d[_0x97b4('0x35')]['filter']+'%'};return _0x2d1467;}})});}_0x420ef7=_[_0x97b4('0x43')]({},_0x420ef7,_0x53023d[_0x97b4('0x46')]);var _0x5dd60e={'where':_0x420ef7['where']};return db[_0x97b4('0x30')][_0x97b4('0x20')](_0x5dd60e)[_0x97b4('0x26')](function(_0x1915ad){_0x38e8ca[_0x97b4('0x20')]=_0x1915ad;if(_0x53023d[_0x97b4('0x35')][_0x97b4('0x47')]){_0x420ef7['include']=[{'all':!![]}];}return db[_0x97b4('0x30')][_0x97b4('0x48')](_0x420ef7);})[_0x97b4('0x26')](function(_0x5b9708){_0x38e8ca[_0x97b4('0x49')]=_0x5b9708;return _0x38e8ca;})[_0x97b4('0x26')](respondWithFilteredResult(_0x43cab3,_0x420ef7))['catch'](handleError(_0x43cab3,null));};exports[_0x97b4('0x4a')]=function(_0x23d4c1,_0x3fa81a){var _0x5f3892={'raw':![],'where':{'id':_0x23d4c1[_0x97b4('0x4b')]['id']}},_0x32ec02={};_0x32ec02[_0x97b4('0x39')]=_[_0x97b4('0x34')](db[_0x97b4('0x30')][_0x97b4('0x31')]);_0x32ec02['query']=_[_0x97b4('0x34')](_0x23d4c1[_0x97b4('0x35')]);_0x32ec02[_0x97b4('0x36')]=_['intersection'](_0x32ec02['model'],_0x32ec02[_0x97b4('0x35')]);_0x5f3892[_0x97b4('0x38')]=_[_0x97b4('0x37')](_0x32ec02['model'],qs[_0x97b4('0x3a')](_0x23d4c1[_0x97b4('0x35')][_0x97b4('0x3a')]));_0x5f3892['attributes']=_0x5f3892['attributes'][_0x97b4('0x3b')]?_0x5f3892['attributes']:_0x32ec02[_0x97b4('0x39')];if(_0x23d4c1[_0x97b4('0x35')][_0x97b4('0x47')]){_0x5f3892[_0x97b4('0x4c')]=[{'all':!![]}];}_0x5f3892=_[_0x97b4('0x43')]({},_0x5f3892,_0x23d4c1[_0x97b4('0x46')]);return db['CmList']['find'](_0x5f3892)[_0x97b4('0x26')](handleEntityNotFound(_0x3fa81a,null))['then'](respondWithResult(_0x3fa81a,null))[_0x97b4('0x4d')](handleError(_0x3fa81a,null));};exports[_0x97b4('0x4e')]=function(_0x2ec6be,_0x12373c){return db[_0x97b4('0x30')][_0x97b4('0x4e')](_0x2ec6be[_0x97b4('0x4f')],{})[_0x97b4('0x26')](function(_0x5ab1b2){var _0x838765=_0x2ec6be['user']['get']({'plain':!![]});if(!_0x838765)throw new Error(_0x97b4('0x50'));if(_0x838765[_0x97b4('0x51')]===_0x97b4('0x52')){var _0x3b0d1b=_0x5ab1b2[_0x97b4('0x28')]({'plain':!![]});var _0x41eea7=_0x97b4('0x29');return db[_0x97b4('0x53')][_0x97b4('0x54')]({'where':{'name':_0x41eea7,'userProfileId':_0x838765[_0x97b4('0x55')]},'raw':!![]})[_0x97b4('0x26')](function(_0x498395){if(_0x498395&&_0x498395[_0x97b4('0x56')]===0x0){return db[_0x97b4('0x2a')]['create']({'name':_0x3b0d1b['name'],'resourceId':_0x3b0d1b['id'],'type':_0x498395[_0x97b4('0x45')],'sectionId':_0x498395['id']},{})[_0x97b4('0x26')](function(){return _0x5ab1b2;});}else{return _0x5ab1b2;}})['catch'](function(_0x147cba){logger['error'](_0x97b4('0x57'),_0x147cba);throw _0x147cba;});}return _0x5ab1b2;})[_0x97b4('0x26')](respondWithResult(_0x12373c,0xc9))[_0x97b4('0x4d')](handleError(_0x12373c,null));};exports[_0x97b4('0x58')]=function(_0x42610b,_0xe54139){if(_0x42610b[_0x97b4('0x4f')]['id']){delete _0x42610b[_0x97b4('0x4f')]['id'];}return db[_0x97b4('0x30')][_0x97b4('0x54')]({'where':{'id':_0x42610b[_0x97b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe54139,null))[_0x97b4('0x26')](saveUpdates(_0x42610b[_0x97b4('0x4f')],null))[_0x97b4('0x26')](respondWithResult(_0xe54139,null))[_0x97b4('0x4d')](handleError(_0xe54139,null));};exports[_0x97b4('0x27')]=function(_0x4c1cb3,_0x34dbd){return db[_0x97b4('0x30')]['find']({'where':{'id':_0x4c1cb3['params']['id']}})['then'](handleEntityNotFound(_0x34dbd,null))[_0x97b4('0x26')](removeEntity(_0x34dbd,null))['catch'](handleError(_0x34dbd,null));};exports[_0x97b4('0x59')]=function(_0x564bb5,_0x10b9a8){return db[_0x97b4('0x30')][_0x97b4('0x59')]()[_0x97b4('0x26')](respondWithResult(_0x10b9a8,null))['catch'](handleError(_0x10b9a8,null));};exports[_0x97b4('0x5a')]=function(_0xd1ee2,_0x245cbe,_0x3fe92e){if(_0xd1ee2[_0x97b4('0x4f')]['id']){delete _0xd1ee2[_0x97b4('0x4f')]['id'];}return db[_0x97b4('0x30')]['find']({'where':{'id':_0xd1ee2[_0x97b4('0x4b')]['id']}})[_0x97b4('0x26')](handleEntityNotFound(_0x245cbe,null))[_0x97b4('0x26')](function(_0x41f4f8){if(_0x41f4f8){_0xd1ee2[_0x97b4('0x4f')][_0x97b4('0x5b')]=_0x41f4f8['id'];return db['Disposition'][_0x97b4('0x4e')](_0xd1ee2[_0x97b4('0x4f')]);}})[_0x97b4('0x26')](respondWithResult(_0x245cbe,null))[_0x97b4('0x4d')](handleError(_0x245cbe,null));};exports['getDispositions']=function(_0x2a2236,_0x21e51a,_0x1735a5){var _0x45b345={'raw':![],'where':{}};var _0x1d87a3={};var _0x32650d={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x2a2236['params']['id']}})[_0x97b4('0x26')](handleEntityNotFound(_0x21e51a,null))['then'](function(_0x177ba1){if(_0x177ba1){_0x1d87a3['model']=_[_0x97b4('0x34')](db[_0x97b4('0x5c')][_0x97b4('0x31')]);_0x1d87a3[_0x97b4('0x35')]=_[_0x97b4('0x34')](_0x2a2236[_0x97b4('0x35')]);_0x1d87a3[_0x97b4('0x36')]=_[_0x97b4('0x37')](_0x1d87a3[_0x97b4('0x39')],_0x1d87a3[_0x97b4('0x35')]);_0x45b345[_0x97b4('0x38')]=_['intersection'](_0x1d87a3[_0x97b4('0x39')],qs['fields'](_0x2a2236[_0x97b4('0x35')][_0x97b4('0x3a')]));_0x45b345[_0x97b4('0x38')]=_0x45b345[_0x97b4('0x38')]['length']?_0x45b345[_0x97b4('0x38')]:_0x1d87a3['model'];if(!_0x2a2236[_0x97b4('0x35')][_0x97b4('0x3c')](_0x97b4('0x5d'))){_0x45b345[_0x97b4('0x3d')]=qs['limit'](_0x2a2236['query']['limit']);_0x45b345[_0x97b4('0x1e')]=qs['offset'](_0x2a2236['query'][_0x97b4('0x1e')]);}_0x45b345[_0x97b4('0x3e')]=qs[_0x97b4('0x3f')](_0x2a2236[_0x97b4('0x35')][_0x97b4('0x3f')]);_0x45b345['where']=qs[_0x97b4('0x36')](_[_0x97b4('0x40')](_0x2a2236[_0x97b4('0x35')],_0x1d87a3[_0x97b4('0x36')]));_0x45b345[_0x97b4('0x42')]['ListId']=_0x177ba1['id'];if(_0x2a2236[_0x97b4('0x35')]['filter']){_0x45b345[_0x97b4('0x42')]=_[_0x97b4('0x43')](_0x45b345[_0x97b4('0x42')],{'$or':_[_0x97b4('0x2f')](_0x45b345[_0x97b4('0x38')],function(_0x2921cf){var _0x23919e={};_0x23919e[_0x2921cf]={'$like':'%'+_0x2a2236[_0x97b4('0x35')]['filter']+'%'};return _0x23919e;})});}_0x45b345=_['merge']({},_0x45b345,_0x2a2236[_0x97b4('0x46')]);return db[_0x97b4('0x5c')][_0x97b4('0x20')]({'where':_0x45b345[_0x97b4('0x42')]})['then'](function(_0x2d9b19){_0x32650d[_0x97b4('0x20')]=_0x2d9b19;if(_0x2a2236[_0x97b4('0x35')][_0x97b4('0x47')]){_0x45b345['include']=[{'all':!![]}];}return db[_0x97b4('0x5c')][_0x97b4('0x48')](_0x45b345);})[_0x97b4('0x26')](function(_0x254923){_0x32650d['rows']=_0x254923;return _0x32650d;});}})[_0x97b4('0x26')](respondWithFilteredResult(_0x21e51a,_0x45b345))[_0x97b4('0x4d')](handleError(_0x21e51a,null));};exports[_0x97b4('0x5e')]=function(_0x249f5f,_0x38b6a4,_0x271a56){return db[_0x97b4('0x30')]['find']({'where':{'id':_0x249f5f[_0x97b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38b6a4,null))['then'](function(_0x497a91){if(_0x497a91){return _0x497a91[_0x97b4('0x5e')](_0x249f5f[_0x97b4('0x35')][_0x97b4('0x5f')]);}})['then'](respondWithStatusCode(_0x38b6a4,null))[_0x97b4('0x4d')](handleError(_0x38b6a4,null));};exports[_0x97b4('0x60')]=function(_0x283a51,_0x241cdd,_0x42d0d0){return db[_0x97b4('0x30')][_0x97b4('0x54')]({'where':{'id':_0x283a51[_0x97b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x241cdd,null))[_0x97b4('0x26')](function(_0x516bef){if(_0x516bef){var _0x89ab76=[];var _0x368466={'success':[],'errors':[]};return db[_0x97b4('0x61')]['describe']()[_0x97b4('0x26')](function(_0x1fd0b8){if(_0x283a51['body']['tags']&&_[_0x97b4('0x62')](_0x283a51[_0x97b4('0x4f')][_0x97b4('0x63')])){if(_0x283a51[_0x97b4('0x4f')][_0x97b4('0x63')]['length']){_0x283a51[_0x97b4('0x4f')][_0x97b4('0x63')]=_0x283a51[_0x97b4('0x4f')][_0x97b4('0x63')][_0x97b4('0x64')](';')+';';}else{_0x283a51[_0x97b4('0x4f')]['tags']=null;}}else{_0x283a51[_0x97b4('0x4f')][_0x97b4('0x63')]=null;}if(_0x283a51['body']&&_[_0x97b4('0x62')](_0x283a51[_0x97b4('0x4f')])){for(var _0x122a91=0x0;_0x122a91<_0x283a51[_0x97b4('0x4f')][_0x97b4('0x3b')];_0x122a91+=0x1){_0x283a51[_0x97b4('0x4f')][_0x122a91][_0x97b4('0x5b')]=_0x283a51['params']['id'];_0x89ab76[_0x97b4('0x65')](_0x283a51[_0x97b4('0x4f')][_0x122a91]);}return BPromise[_0x97b4('0x66')](_0x89ab76,function(_0x5784f0){return db[_0x97b4('0x61')][_0x97b4('0x4e')](_['omit'](_0x5784f0,[_0x97b4('0x5f'),'id'])||{},{'fields':_[_0x97b4('0x34')](_0x1fd0b8),'raw':!![]})[_0x97b4('0x26')](function(_0x371611){_0x368466[_0x97b4('0x67')][_0x97b4('0x65')](_0x371611[_0x97b4('0x68')]);})[_0x97b4('0x4d')](function(_0x5d8790){_0x368466[_0x97b4('0x69')][_0x97b4('0x65')]({'data':_0x5784f0,'error':_0x5d8790['message']});});})[_0x97b4('0x26')](function(_0x1f615d){return _0x368466;})[_0x97b4('0x4d')](function(_0x42738f){return _0x42738f;});}else{_0x241cdd[_0x97b4('0x21')](0x190)[_0x97b4('0x1d')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x97b4('0x26')](respondWithResult(_0x241cdd,null))[_0x97b4('0x4d')](handleError(_0x241cdd,null));};exports[_0x97b4('0x6a')]=function(_0x5aa626,_0x4ece0f,_0x4857d3){var _0xc4749e;return db['CmList'][_0x97b4('0x54')]({'where':{'id':_0x5aa626[_0x97b4('0x4b')]['id']},'include':[{'model':db[_0x97b4('0x6b')],'as':_0x97b4('0x6c')}]})[_0x97b4('0x26')](handleEntityNotFound(_0x4ece0f,null))['then'](function(_0xb16e85){if(_0xb16e85){_0xc4749e=_0xb16e85;return db[_0x97b4('0x61')][_0x97b4('0x31')];}})[_0x97b4('0x26')](function(_0x20c3ae){if(_0x20c3ae){var _0x398ee7={};var _0x22ccb5={};_0x22ccb5[_0x97b4('0x39')]=_[_0x97b4('0x6d')](_[_0x97b4('0x34')](_0x20c3ae),_[_0x97b4('0x2f')](_0xc4749e[_0x97b4('0x6c')],function(_0x36abe5){return util[_0x97b4('0x6e')]('cf_%d',_0x36abe5['id']);}));_0x22ccb5['query']=_['keys'](_0x5aa626[_0x97b4('0x35')]);_0x22ccb5['filters']=_[_0x97b4('0x37')](_0x22ccb5['model'],_0x22ccb5[_0x97b4('0x35')]);_0x398ee7[_0x97b4('0x38')]=_[_0x97b4('0x37')](_0x22ccb5[_0x97b4('0x39')],qs[_0x97b4('0x3a')](_0x5aa626[_0x97b4('0x35')][_0x97b4('0x3a')]));_0x398ee7[_0x97b4('0x38')]=_0x398ee7[_0x97b4('0x38')][_0x97b4('0x3b')]?_0x398ee7[_0x97b4('0x38')]:_0x22ccb5[_0x97b4('0x39')];if(!_0x5aa626['query']['hasOwnProperty'](_0x97b4('0x5d'))){_0x398ee7['limit']=qs[_0x97b4('0x3d')](_0x5aa626[_0x97b4('0x35')][_0x97b4('0x3d')]);_0x398ee7['offset']=qs[_0x97b4('0x1e')](_0x5aa626[_0x97b4('0x35')]['offset']);}_0x398ee7[_0x97b4('0x3e')]=qs[_0x97b4('0x3f')](_0x5aa626[_0x97b4('0x35')]['sort']);_0x398ee7[_0x97b4('0x42')]=qs[_0x97b4('0x36')](_[_0x97b4('0x40')](_0x5aa626[_0x97b4('0x35')],_0x22ccb5[_0x97b4('0x36')]));_0x398ee7[_0x97b4('0x6f')]=!![];if(_0x5aa626['query'][_0x97b4('0x41')]){_0x398ee7['where']=_['merge'](_0x398ee7[_0x97b4('0x42')],{'$or':_['map'](_0x398ee7['attributes'],function(_0x2003eb){var _0x11e14e={};_0x11e14e[_0x2003eb]={'$like':'%'+_0x5aa626[_0x97b4('0x35')][_0x97b4('0x41')]+'%'};return _0x11e14e;})});}_0x398ee7=_[_0x97b4('0x43')]({},_0x398ee7,_0x5aa626[_0x97b4('0x46')]);return _0xc4749e['getContacts'](_0x398ee7);}})[_0x97b4('0x26')](respondWithResult(_0x4ece0f,null))['catch'](handleError(_0x4ece0f,null));};exports[_0x97b4('0x70')]=function(_0x4071c7,_0x4b4cd6,_0x485c10){var _0x29cead;var _0x47620e;var _0x51e479;var _0x527f72=_0x4071c7['params']['id'];csv_results=[];return db[_0x97b4('0x71')][_0x97b4('0x48')]({'attributes':['id',_0x97b4('0x45')],'raw':!![],'order':[_0x97b4('0x72')]})[_0x97b4('0x26')](function(_0x101ba7){_0x29cead=_0x101ba7;var _0x2fe293=_[_0x97b4('0x34')](db['CmContact']['rawAttributes']);return db[_0x97b4('0x6b')][_0x97b4('0x48')]({'raw':!![],'attributes':['id',_0x97b4('0x73')]})[_0x97b4('0x26')](function(_0x107ef8){_0x47620e=_0x107ef8;var _0x44fda5=squel[_0x97b4('0x74')]()[_0x97b4('0x3a')](_0x2fe293)[_0x97b4('0x75')]('cm_contacts','c')[_0x97b4('0x42')](_0x97b4('0x76'),_0x527f72)[_0x97b4('0x42')]('c.deletedAt\x20is\x20null')[_0x97b4('0x77')]();for(var _0x1ca4e8=0x0;_0x1ca4e8<_0x47620e[_0x97b4('0x3b')];_0x1ca4e8++){_0x44fda5[_0x97b4('0x78')](_0x97b4('0x79')+_0x47620e[_0x1ca4e8]['id'],_0x97b4('0x7a')+_0x47620e[_0x1ca4e8][_0x97b4('0x73')]);}for(var _0x1ca4e8=0x0;_0x1ca4e8<_0x29cead[_0x97b4('0x3b')];_0x1ca4e8++){_0x44fda5[_0x97b4('0x78')](squel[_0x97b4('0x74')]()[_0x97b4('0x78')](_0x97b4('0x7b'))[_0x97b4('0x75')](_0x97b4('0x7c'))[_0x97b4('0x42')](_0x97b4('0x7d'),_0x29cead[_0x1ca4e8]['id'])[_0x97b4('0x42')](_0x97b4('0x7e')),'additionalPhone_'+_0x29cead[_0x1ca4e8][_0x97b4('0x45')]);_0x44fda5['field'](squel[_0x97b4('0x74')]()['field'](_0x97b4('0x7f'))['from'](_0x97b4('0x7c'))[_0x97b4('0x42')](_0x97b4('0x7d'),_0x29cead[_0x1ca4e8]['id'])[_0x97b4('0x42')](_0x97b4('0x7e')),_0x97b4('0x80')+_0x29cead[_0x1ca4e8][_0x97b4('0x45')]);}var _0x1af927=[];_0x1af927[_0x97b4('0x65')](_0x44fda5[_0x97b4('0x81')]());BPromise[_0x97b4('0x66')](_0x1af927,handleQuery)[_0x97b4('0x26')](function(_0x4412cd){handleQuery(_0x44fda5[_0x97b4('0x81')]());var _0x52dfec=csv_results[0x0];if(!_['isEmpty'](_0x52dfec)){var _0x3e971f=toCsv(_0x52dfec);var _0x5a8341=Date[_0x97b4('0x82')]();fs[_0x97b4('0x83')](util[_0x97b4('0x6e')](_0x97b4('0x84'),_0x527f72,_0x5a8341),_0x3e971f);_0x4b4cd6['setHeader'](_0x97b4('0x85'),_0x97b4('0x86')+util[_0x97b4('0x6e')](_0x97b4('0x87'),_0x527f72,_0x5a8341));_0x4b4cd6[_0x97b4('0x88')](_0x97b4('0x89'),_0x97b4('0x8a'));return _0x4b4cd6[_0x97b4('0x8b')](util[_0x97b4('0x6e')](_0x97b4('0x84'),_0x527f72,_0x5a8341));}else{return _0x4b4cd6['sendStatus'](0xcc);}});});});};exports[_0x97b4('0x8c')]=function(_0x2f94fb,_0x281a44,_0xadf24d){var _0x5af6f7;delete _0x2f94fb['body']['id'];return db['CmList'][_0x97b4('0x8d')]({'where':{'id':_0x2f94fb['params']['id']}})[_0x97b4('0x26')](handleEntityNotFound(_0x281a44,null))['then'](function(_0x5d47e3){if(_0x5d47e3){return db[_0x97b4('0x8e')][_0x97b4('0x8f')](function(_0x3bd2a5){return db[_0x97b4('0x6b')]['create'](_0x2f94fb[_0x97b4('0x4f')],{'transaction':_0x3bd2a5})[_0x97b4('0x26')](function(_0x29c11a){_0x5af6f7=_0x29c11a;return _0x5d47e3[_0x97b4('0x90')](_0x29c11a,{'transaction':_0x3bd2a5});})[_0x97b4('0x26')](function(){var _0xab6c02={'type':db[_0x97b4('0x91')][_0x97b4('0x92')],'transaction':_0x3bd2a5};switch(_0x2f94fb['body'][_0x97b4('0x33')]){case _0x97b4('0x93'):_0xab6c02[_0x97b4('0x33')]=db['Sequelize']['TEXT'];break;case _0x97b4('0x94'):_0xab6c02[_0x97b4('0x33')]=db[_0x97b4('0x91')][_0x97b4('0x95')];break;case _0x97b4('0x96'):_0xab6c02[_0x97b4('0x33')]=db[_0x97b4('0x91')][_0x97b4('0x97')];_0xab6c02[_0x97b4('0x98')]=![];break;default:}return db['sequelize'][_0x97b4('0x99')][_0x97b4('0x9a')](_0x97b4('0x9b'),util[_0x97b4('0x6e')]('cf_%s',_0x5af6f7['id']),_0xab6c02);})[_0x97b4('0x26')](function(){return _0x5af6f7;});});}})[_0x97b4('0x26')](respondWithResult(_0x281a44,null))[_0x97b4('0x4d')](handleError(_0x281a44,null));};exports['getCustomFields']=function(_0xfecbf1,_0x1c9cdf,_0xb4ae09){var _0x216b7a={};var _0x5cc5cf={};var _0xfac2a9;var _0x8c7676;return db['CmList'][_0x97b4('0x8d')]({'where':{'id':_0xfecbf1[_0x97b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1c9cdf,null))[_0x97b4('0x26')](function(_0xae2891){if(_0xae2891){_0xfac2a9=_0xae2891;_0x5cc5cf[_0x97b4('0x39')]=_[_0x97b4('0x34')](db[_0x97b4('0x6b')]['rawAttributes']);_0x5cc5cf[_0x97b4('0x35')]=_[_0x97b4('0x34')](_0xfecbf1[_0x97b4('0x35')]);_0x5cc5cf[_0x97b4('0x36')]=_['intersection'](_0x5cc5cf['model'],_0x5cc5cf[_0x97b4('0x35')]);_0x216b7a['attributes']=_['intersection'](_0x5cc5cf['model'],qs[_0x97b4('0x3a')](_0xfecbf1[_0x97b4('0x35')]['fields']));_0x216b7a[_0x97b4('0x38')]=_0x216b7a[_0x97b4('0x38')][_0x97b4('0x3b')]?_0x216b7a[_0x97b4('0x38')]:_0x5cc5cf[_0x97b4('0x39')];_0x216b7a[_0x97b4('0x3e')]=qs[_0x97b4('0x3f')](_0xfecbf1[_0x97b4('0x35')]['sort']);_0x216b7a[_0x97b4('0x42')]=qs[_0x97b4('0x36')](_[_0x97b4('0x40')](_0xfecbf1[_0x97b4('0x35')],_0x5cc5cf[_0x97b4('0x36')]));_0x216b7a['where']=_['merge'](_0x216b7a[_0x97b4('0x42')],{'$or':[{'ListId':_0xae2891['id']},{'ListId':null}]});if(_0xfecbf1['query'][_0x97b4('0x41')]){_0x216b7a[_0x97b4('0x42')]=_[_0x97b4('0x43')](_0x216b7a[_0x97b4('0x42')],{'$or':_['map'](_0x216b7a[_0x97b4('0x38')],function(_0x154e4e){var _0x139fd8={};_0x139fd8[_0x154e4e]={'$like':'%'+_0xfecbf1[_0x97b4('0x35')]['filter']+'%'};return _0x139fd8;})});}_0x216b7a=_['merge']({},_0x216b7a,_0xfecbf1[_0x97b4('0x46')]);return db[_0x97b4('0x6b')][_0x97b4('0x9c')](_0x216b7a);}})[_0x97b4('0x26')](respondWithResult(_0x1c9cdf,null))['catch'](handleError(_0x1c9cdf,null));};exports[_0x97b4('0x9d')]=function(_0x4a3a40,_0x4c76c2){return db[_0x97b4('0x6b')]['findAndCountAll']({'where':{'ListId':null}})[_0x97b4('0x26')](handleEntityNotFound(_0x4c76c2,null))[_0x97b4('0x26')](function(_0x3518ce){return _0x3518ce;})[_0x97b4('0x26')](respondWithResult(_0x4c76c2,null))[_0x97b4('0x4d')](handleError(_0x4c76c2,null));};exports[_0x97b4('0x9e')]=function(_0x1338a9,_0x4762bf,_0x574918){return db[_0x97b4('0x30')]['find']({'where':{'id':_0x1338a9[_0x97b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4762bf,null))[_0x97b4('0x26')](function(_0x41ce77){if(_0x41ce77){return _0x41ce77[_0x97b4('0x9e')](_0x1338a9[_0x97b4('0x4f')][_0x97b4('0x5f')],_[_0x97b4('0x9f')](_0x1338a9['body'],[_0x97b4('0x5f'),'id'])||{})[_0x97b4('0xa0')](function(_0x8dac45){for(var _0xbf639=0x0;_0xbf639<_0x1338a9['body'][_0x97b4('0x5f')]['length'];_0xbf639+=0x1){socket[_0x97b4('0xa1')](_0x97b4('0xa2'),{'UserId':Number(_0x1338a9[_0x97b4('0x4f')][_0x97b4('0x5f')][_0xbf639]),'CmListId':Number(_0x1338a9[_0x97b4('0x4b')]['id'])});}return _0x8dac45;});}})[_0x97b4('0x26')](respondWithResult(_0x4762bf,null))[_0x97b4('0x4d')](handleError(_0x4762bf,null));};exports[_0x97b4('0xa3')]=function(_0x2b6ae2,_0x5f420a,_0x684c0c){return db[_0x97b4('0x30')][_0x97b4('0x54')]({'where':{'id':_0x2b6ae2['params']['id']}})[_0x97b4('0x26')](handleEntityNotFound(_0x5f420a,null))['then'](function(_0x2f5619){if(_0x2f5619){return _0x2f5619[_0x97b4('0xa3')](_0x2b6ae2[_0x97b4('0x35')][_0x97b4('0x5f')])[_0x97b4('0x26')](function(){if(_[_0x97b4('0x62')](_0x2b6ae2[_0x97b4('0x35')]['ids'])){for(var _0x4a28f3=0x0;_0x4a28f3<_0x2b6ae2[_0x97b4('0x35')]['ids'][_0x97b4('0x3b')];_0x4a28f3+=0x1){socket['emit'](_0x97b4('0xa4'),{'UserId':Number(_0x2b6ae2[_0x97b4('0x35')][_0x97b4('0x5f')][_0x4a28f3]),'CmListId':Number(_0x2b6ae2[_0x97b4('0x4b')]['id'])});}}else{socket[_0x97b4('0xa1')](_0x97b4('0xa4'),{'UserId':Number(_0x2b6ae2['query'][_0x97b4('0x5f')]),'CmListId':Number(_0x2b6ae2[_0x97b4('0x4b')]['id'])});}});}})[_0x97b4('0x26')](respondWithStatusCode(_0x5f420a,null))[_0x97b4('0x4d')](handleError(_0x5f420a,null));};exports[_0x97b4('0xa5')]=function(_0x68b3fa,_0x2ddba9,_0x396893){var _0x4e4c05={};var _0x163449={};var _0x1e8f6f;var _0x52b2ea;return db[_0x97b4('0x30')][_0x97b4('0x8d')]({'where':{'id':_0x68b3fa[_0x97b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2ddba9,null))[_0x97b4('0x26')](function(_0x2d8049){if(_0x2d8049){_0x1e8f6f=_0x2d8049;_0x163449['model']=_[_0x97b4('0x34')](db[_0x97b4('0xa6')]['rawAttributes']);_0x163449['query']=_[_0x97b4('0x34')](_0x68b3fa[_0x97b4('0x35')]);_0x163449['filters']=_[_0x97b4('0x37')](_0x163449[_0x97b4('0x39')],_0x163449[_0x97b4('0x35')]);_0x4e4c05[_0x97b4('0x38')]=_['intersection'](_0x163449['model'],qs['fields'](_0x68b3fa['query']['fields']));_0x4e4c05[_0x97b4('0x38')]=_0x4e4c05[_0x97b4('0x38')]['length']?_0x4e4c05[_0x97b4('0x38')]:_0x163449[_0x97b4('0x39')];_0x4e4c05[_0x97b4('0x3e')]=qs[_0x97b4('0x3f')](_0x68b3fa[_0x97b4('0x35')][_0x97b4('0x3f')]);_0x4e4c05[_0x97b4('0x42')]=qs[_0x97b4('0x36')](_[_0x97b4('0x40')](_0x68b3fa[_0x97b4('0x35')],_0x163449['filters']));if(_0x68b3fa[_0x97b4('0x35')][_0x97b4('0x41')]){_0x4e4c05['where']=_['merge'](_0x4e4c05['where'],{'$or':_[_0x97b4('0x2f')](_0x4e4c05['attributes'],function(_0x1cabba){var _0x98ff79={};_0x98ff79[_0x1cabba]={'$like':'%'+_0x68b3fa['query']['filter']+'%'};return _0x98ff79;})});}_0x4e4c05=_['merge']({},_0x4e4c05,_0x68b3fa['options']);return _0x1e8f6f['getAgents'](_0x4e4c05);}})[_0x97b4('0x26')](function(_0x378e7e){if(_0x378e7e){_0x52b2ea=_0x378e7e[_0x97b4('0x3b')];if(!_0x68b3fa[_0x97b4('0x35')][_0x97b4('0x3c')]('nolimit')){_0x4e4c05[_0x97b4('0x3d')]=qs[_0x97b4('0x3d')](_0x68b3fa[_0x97b4('0x35')][_0x97b4('0x3d')]);_0x4e4c05['offset']=qs[_0x97b4('0x1e')](_0x68b3fa[_0x97b4('0x35')][_0x97b4('0x1e')]);}return _0x1e8f6f[_0x97b4('0xa5')](_0x4e4c05);}})[_0x97b4('0x26')](function(_0x5a0a2e){if(_0x5a0a2e){return _0x5a0a2e?{'count':_0x52b2ea,'rows':_0x5a0a2e}:null;}})[_0x97b4('0x26')](respondWithResult(_0x2ddba9,null))['catch'](handleError(_0x2ddba9,null));};function handleQuery(_0x22cfc0){logger[_0x97b4('0xa7')](_0x22cfc0);return db[_0x97b4('0x8e')][_0x97b4('0x35')](_0x22cfc0)['spread'](function(_0x52e8aa){csv_results[_0x97b4('0x65')](_0x52e8aa);})[_0x97b4('0x4d')](function(_0x53d98b){logger[_0x97b4('0x2b')](_0x53d98b[_0x97b4('0xa8')]);});} \ No newline at end of file +var _0x34b2=['then','get','destroy','error','name','send','map','CmList','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','Disposition','removeDispositions','ids','addContacts','CmContact','isArray','tags','each','omit','success','dataValues','errors','push','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','getContactsCsv','ContactItemType','OrderBy','select','from','cm_contacts','c.deletedAt\x20is\x20null','field','alias','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','findOne','transaction','addCustomFields','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','cf_%s','order','findAndCountAll','getGlobalCustomFields','spread','emit','userCmList:save','removeAgents','getAgents','User','info','sequelize','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update'];(function(_0x13727f,_0x529dd9){var _0x1f8749=function(_0x58b69d){while(--_0x58b69d){_0x13727f['push'](_0x13727f['shift']());}};_0x1f8749(++_0x529dd9);}(_0x34b2,0x75));var _0x234b=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x34b2[_0x3da612];return _0x1a9d1d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x234b('0x0'));var jsonpatch=require(_0x234b('0x1'));var rp=require(_0x234b('0x2'));var moment=require('moment');var BPromise=require(_0x234b('0x3'));var Mustache=require(_0x234b('0x4'));var util=require(_0x234b('0x5'));var path=require('path');var sox=require(_0x234b('0x6'));var csv=require(_0x234b('0x7'));var ejs=require(_0x234b('0x8'));var fs=require('fs');var fs_extra=require(_0x234b('0x9'));var _=require(_0x234b('0xa'));var squel=require(_0x234b('0xb'));var crypto=require(_0x234b('0xc'));var jsforce=require(_0x234b('0xd'));var deskjs=require(_0x234b('0xe'));var toCsv=require(_0x234b('0x7'));var querystring=require('querystring');var Papa=require(_0x234b('0xf'));var Redis=require(_0x234b('0x10'));var authService=require(_0x234b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x234b('0x12'));var hardwareService=require(_0x234b('0x13'));var logger=require(_0x234b('0x14'))(_0x234b('0x15'));var utils=require(_0x234b('0x16'));var config=require(_0x234b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0x234b('0x18')]=_[_0x234b('0x19')](config[_0x234b('0x18')],{'host':_0x234b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x234b('0x18')]));require(_0x234b('0x1b'))[_0x234b('0x1c')](socket);function respondWithStatusCode(_0x680903,_0x15cd69){_0x15cd69=_0x15cd69||0xcc;return function(_0x38914a){if(_0x38914a){return _0x680903[_0x234b('0x1d')](_0x15cd69);}return _0x680903[_0x234b('0x1e')](_0x15cd69)[_0x234b('0x1f')]();};}function respondWithResult(_0x5b8f3c,_0xddf766){_0xddf766=_0xddf766||0xc8;return function(_0x17cf59){if(_0x17cf59){return _0x5b8f3c[_0x234b('0x1e')](_0xddf766)[_0x234b('0x20')](_0x17cf59);}};}function respondWithFilteredResult(_0x19b995,_0x576453){return function(_0x33f189){if(_0x33f189){var _0x355878=typeof _0x576453[_0x234b('0x21')]==='undefined'&&typeof _0x576453[_0x234b('0x22')]===_0x234b('0x23');var _0x4c8591=_0x33f189['count'];var _0x224ecc=_0x355878?0x0:_0x576453[_0x234b('0x21')];var _0x53af4d=_0x355878?_0x33f189[_0x234b('0x24')]:_0x576453[_0x234b('0x21')]+_0x576453['limit'];var _0x5a9b6d;if(_0x53af4d>=_0x4c8591){_0x53af4d=_0x4c8591;_0x5a9b6d=0xc8;}else{_0x5a9b6d=0xce;}_0x19b995[_0x234b('0x1e')](_0x5a9b6d);return _0x19b995[_0x234b('0x25')](_0x234b('0x26'),_0x224ecc+'-'+_0x53af4d+'/'+_0x4c8591)[_0x234b('0x20')](_0x33f189);}return null;};}function patchUpdates(_0x157d25){return function(_0x2947ad){try{jsonpatch[_0x234b('0x27')](_0x2947ad,_0x157d25,!![]);}catch(_0x24b39b){return BPromise[_0x234b('0x28')](_0x24b39b);}return _0x2947ad['save']();};}function saveUpdates(_0x3c12bd,_0x5441b5){return function(_0x3bbbcf){if(_0x3bbbcf){return _0x3bbbcf[_0x234b('0x29')](_0x3c12bd)[_0x234b('0x2a')](function(_0x226c02){return _0x226c02;});}return null;};}function removeEntity(_0x50c95e,_0x2d67ae){return function(_0x45a535){if(_0x45a535){return _0x45a535['destroy']()['then'](function(){var _0x260a88=_0x45a535[_0x234b('0x2b')]({'plain':!![]});var _0x520c36='Lists';return db['UserProfileResource'][_0x234b('0x2c')]({'where':{'type':_0x520c36,'resourceId':_0x260a88['id']}})[_0x234b('0x2a')](function(){return _0x45a535;});})[_0x234b('0x2a')](function(){_0x50c95e[_0x234b('0x1e')](0xcc)[_0x234b('0x1f')]();});}};}function handleEntityNotFound(_0x2414f7,_0x23b058){return function(_0x3deaca){if(!_0x3deaca){_0x2414f7[_0x234b('0x1d')](0x194);}return _0x3deaca;};}function handleError(_0x82432f,_0x3ec48a){_0x3ec48a=_0x3ec48a||0x1f4;return function(_0x4a3df2){logger[_0x234b('0x2d')](_0x4a3df2['stack']);if(_0x4a3df2['name']){delete _0x4a3df2[_0x234b('0x2e')];}_0x82432f['status'](_0x3ec48a)[_0x234b('0x2f')](_0x4a3df2);};}exports['index']=function(_0x45cf78,_0x5b65bf){var _0x2320fe={},_0x27fc76={},_0x3aaff1={'count':0x0,'rows':[]};var _0xce2596=_[_0x234b('0x30')](db[_0x234b('0x31')][_0x234b('0x32')],function(_0x23b6c3){return{'name':_0x23b6c3[_0x234b('0x33')],'type':_0x23b6c3['type'][_0x234b('0x34')]};});_0x27fc76['model']=_[_0x234b('0x30')](_0xce2596,_0x234b('0x2e'));_0x27fc76[_0x234b('0x35')]=_['keys'](_0x45cf78[_0x234b('0x35')]);_0x27fc76[_0x234b('0x36')]=_[_0x234b('0x37')](_0x27fc76[_0x234b('0x38')],_0x27fc76[_0x234b('0x35')]);_0x2320fe[_0x234b('0x39')]=_[_0x234b('0x37')](_0x27fc76[_0x234b('0x38')],qs[_0x234b('0x3a')](_0x45cf78[_0x234b('0x35')]['fields']));_0x2320fe['attributes']=_0x2320fe[_0x234b('0x39')][_0x234b('0x3b')]?_0x2320fe[_0x234b('0x39')]:_0x27fc76['model'];if(!_0x45cf78['query'][_0x234b('0x3c')](_0x234b('0x3d'))){_0x2320fe[_0x234b('0x22')]=qs[_0x234b('0x22')](_0x45cf78[_0x234b('0x35')][_0x234b('0x22')]);_0x2320fe[_0x234b('0x21')]=qs[_0x234b('0x21')](_0x45cf78[_0x234b('0x35')]['offset']);}_0x2320fe['order']=qs[_0x234b('0x3e')](_0x45cf78[_0x234b('0x35')][_0x234b('0x3e')]);_0x2320fe[_0x234b('0x3f')]=qs[_0x234b('0x36')](_[_0x234b('0x40')](_0x45cf78['query'],_0x27fc76[_0x234b('0x36')]),_0xce2596);if(_0x45cf78[_0x234b('0x35')][_0x234b('0x41')]){_0x2320fe[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x2320fe[_0x234b('0x3f')],{'$or':_[_0x234b('0x30')](_0xce2596,function(_0x35af56){if(_0x35af56[_0x234b('0x43')]!=='VIRTUAL'){var _0x28cac8={};_0x28cac8[_0x35af56[_0x234b('0x2e')]]={'$like':'%'+_0x45cf78[_0x234b('0x35')][_0x234b('0x41')]+'%'};return _0x28cac8;}})});}_0x2320fe=_[_0x234b('0x42')]({},_0x2320fe,_0x45cf78[_0x234b('0x44')]);var _0x52c5ed={'where':_0x2320fe[_0x234b('0x3f')]};return db[_0x234b('0x31')][_0x234b('0x24')](_0x52c5ed)[_0x234b('0x2a')](function(_0x390e4d){_0x3aaff1[_0x234b('0x24')]=_0x390e4d;if(_0x45cf78[_0x234b('0x35')][_0x234b('0x45')]){_0x2320fe[_0x234b('0x46')]=[{'all':!![]}];}return db[_0x234b('0x31')][_0x234b('0x47')](_0x2320fe);})[_0x234b('0x2a')](function(_0xdf9c5){_0x3aaff1[_0x234b('0x48')]=_0xdf9c5;return _0x3aaff1;})['then'](respondWithFilteredResult(_0x5b65bf,_0x2320fe))['catch'](handleError(_0x5b65bf,null));};exports['show']=function(_0x401f0d,_0x1bf37f){var _0x4af2f3={'raw':![],'where':{'id':_0x401f0d[_0x234b('0x49')]['id']}},_0xf017e={};_0xf017e[_0x234b('0x38')]=_[_0x234b('0x4a')](db['CmList']['rawAttributes']);_0xf017e[_0x234b('0x35')]=_[_0x234b('0x4a')](_0x401f0d[_0x234b('0x35')]);_0xf017e['filters']=_[_0x234b('0x37')](_0xf017e[_0x234b('0x38')],_0xf017e['query']);_0x4af2f3[_0x234b('0x39')]=_['intersection'](_0xf017e['model'],qs[_0x234b('0x3a')](_0x401f0d['query']['fields']));_0x4af2f3['attributes']=_0x4af2f3[_0x234b('0x39')][_0x234b('0x3b')]?_0x4af2f3[_0x234b('0x39')]:_0xf017e[_0x234b('0x38')];if(_0x401f0d['query'][_0x234b('0x45')]){_0x4af2f3['include']=[{'all':!![]}];}_0x4af2f3=_[_0x234b('0x42')]({},_0x4af2f3,_0x401f0d[_0x234b('0x44')]);return db[_0x234b('0x31')][_0x234b('0x4b')](_0x4af2f3)[_0x234b('0x2a')](handleEntityNotFound(_0x1bf37f,null))[_0x234b('0x2a')](respondWithResult(_0x1bf37f,null))[_0x234b('0x4c')](handleError(_0x1bf37f,null));};exports[_0x234b('0x4d')]=function(_0xc4d492,_0x55affe){return db[_0x234b('0x31')][_0x234b('0x4d')](_0xc4d492[_0x234b('0x4e')],{})[_0x234b('0x2a')](function(_0x799e5f){var _0x14ffd3=_0xc4d492[_0x234b('0x4f')][_0x234b('0x2b')]({'plain':!![]});if(!_0x14ffd3)throw new Error(_0x234b('0x50'));if(_0x14ffd3[_0x234b('0x51')]===_0x234b('0x4f')){var _0x425ef9=_0x799e5f[_0x234b('0x2b')]({'plain':!![]});var _0x1e97da=_0x234b('0x52');return db[_0x234b('0x53')]['find']({'where':{'name':_0x1e97da,'userProfileId':_0x14ffd3[_0x234b('0x54')]},'raw':!![]})['then'](function(_0xab45fb){if(_0xab45fb&&_0xab45fb[_0x234b('0x55')]===0x0){return db[_0x234b('0x56')][_0x234b('0x4d')]({'name':_0x425ef9[_0x234b('0x2e')],'resourceId':_0x425ef9['id'],'type':_0xab45fb[_0x234b('0x2e')],'sectionId':_0xab45fb['id']},{})['then'](function(){return _0x799e5f;});}else{return _0x799e5f;}})[_0x234b('0x4c')](function(_0x26534c){logger[_0x234b('0x2d')](_0x234b('0x57'),_0x26534c);throw _0x26534c;});}return _0x799e5f;})[_0x234b('0x2a')](respondWithResult(_0x55affe,0xc9))[_0x234b('0x4c')](handleError(_0x55affe,null));};exports['update']=function(_0x865835,_0x387185){if(_0x865835[_0x234b('0x4e')]['id']){delete _0x865835['body']['id'];}return db[_0x234b('0x31')]['find']({'where':{'id':_0x865835[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0x387185,null))['then'](saveUpdates(_0x865835['body'],null))[_0x234b('0x2a')](respondWithResult(_0x387185,null))[_0x234b('0x4c')](handleError(_0x387185,null));};exports[_0x234b('0x2c')]=function(_0x5db805,_0x4ee51f){return db['CmList'][_0x234b('0x4b')]({'where':{'id':_0x5db805[_0x234b('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ee51f,null))[_0x234b('0x2a')](removeEntity(_0x4ee51f,null))[_0x234b('0x4c')](handleError(_0x4ee51f,null));};exports['describe']=function(_0x3ae122,_0x1751c1){return db[_0x234b('0x31')][_0x234b('0x58')]()['then'](respondWithResult(_0x1751c1,null))['catch'](handleError(_0x1751c1,null));};exports[_0x234b('0x59')]=function(_0x57f340,_0xc1388f,_0x6aa334){if(_0x57f340[_0x234b('0x4e')]['id']){delete _0x57f340[_0x234b('0x4e')]['id'];}return db['CmList']['find']({'where':{'id':_0x57f340[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0xc1388f,null))[_0x234b('0x2a')](function(_0x5daa0f){if(_0x5daa0f){_0x57f340[_0x234b('0x4e')][_0x234b('0x5a')]=_0x5daa0f['id'];return db['Disposition'][_0x234b('0x4d')](_0x57f340[_0x234b('0x4e')]);}})[_0x234b('0x2a')](respondWithResult(_0xc1388f,null))[_0x234b('0x4c')](handleError(_0xc1388f,null));};exports[_0x234b('0x5b')]=function(_0x21ec39,_0x46e968,_0x210833){var _0x951b67={'raw':![],'where':{}};var _0x1ed7d1={};var _0x43bab3={'count':0x0,'rows':[]};return db[_0x234b('0x31')]['findOne']({'where':{'id':_0x21ec39[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0x46e968,null))[_0x234b('0x2a')](function(_0x1d36af){if(_0x1d36af){_0x1ed7d1[_0x234b('0x38')]=_['keys'](db[_0x234b('0x5c')][_0x234b('0x32')]);_0x1ed7d1[_0x234b('0x35')]=_[_0x234b('0x4a')](_0x21ec39[_0x234b('0x35')]);_0x1ed7d1[_0x234b('0x36')]=_[_0x234b('0x37')](_0x1ed7d1[_0x234b('0x38')],_0x1ed7d1[_0x234b('0x35')]);_0x951b67[_0x234b('0x39')]=_[_0x234b('0x37')](_0x1ed7d1['model'],qs[_0x234b('0x3a')](_0x21ec39[_0x234b('0x35')][_0x234b('0x3a')]));_0x951b67[_0x234b('0x39')]=_0x951b67[_0x234b('0x39')]['length']?_0x951b67[_0x234b('0x39')]:_0x1ed7d1[_0x234b('0x38')];if(!_0x21ec39[_0x234b('0x35')][_0x234b('0x3c')]('nolimit')){_0x951b67[_0x234b('0x22')]=qs[_0x234b('0x22')](_0x21ec39[_0x234b('0x35')][_0x234b('0x22')]);_0x951b67[_0x234b('0x21')]=qs[_0x234b('0x21')](_0x21ec39[_0x234b('0x35')][_0x234b('0x21')]);}_0x951b67['order']=qs[_0x234b('0x3e')](_0x21ec39[_0x234b('0x35')][_0x234b('0x3e')]);_0x951b67['where']=qs['filters'](_[_0x234b('0x40')](_0x21ec39[_0x234b('0x35')],_0x1ed7d1[_0x234b('0x36')]));_0x951b67[_0x234b('0x3f')][_0x234b('0x5a')]=_0x1d36af['id'];if(_0x21ec39[_0x234b('0x35')][_0x234b('0x41')]){_0x951b67[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x951b67[_0x234b('0x3f')],{'$or':_[_0x234b('0x30')](_0x951b67[_0x234b('0x39')],function(_0x1e8856){var _0xf2a83b={};_0xf2a83b[_0x1e8856]={'$like':'%'+_0x21ec39[_0x234b('0x35')]['filter']+'%'};return _0xf2a83b;})});}_0x951b67=_[_0x234b('0x42')]({},_0x951b67,_0x21ec39[_0x234b('0x44')]);return db[_0x234b('0x5c')][_0x234b('0x24')]({'where':_0x951b67[_0x234b('0x3f')]})[_0x234b('0x2a')](function(_0x2a2728){_0x43bab3[_0x234b('0x24')]=_0x2a2728;if(_0x21ec39['query']['includeAll']){_0x951b67[_0x234b('0x46')]=[{'all':!![]}];}return db[_0x234b('0x5c')]['findAll'](_0x951b67);})[_0x234b('0x2a')](function(_0x398942){_0x43bab3[_0x234b('0x48')]=_0x398942;return _0x43bab3;});}})[_0x234b('0x2a')](respondWithFilteredResult(_0x46e968,_0x951b67))[_0x234b('0x4c')](handleError(_0x46e968,null));};exports[_0x234b('0x5d')]=function(_0x438ece,_0xc9e987,_0x1b6efc){return db[_0x234b('0x31')][_0x234b('0x4b')]({'where':{'id':_0x438ece[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0xc9e987,null))[_0x234b('0x2a')](function(_0x5b40c1){if(_0x5b40c1){return _0x5b40c1['removeDispositions'](_0x438ece[_0x234b('0x35')][_0x234b('0x5e')]);}})['then'](respondWithStatusCode(_0xc9e987,null))[_0x234b('0x4c')](handleError(_0xc9e987,null));};exports[_0x234b('0x5f')]=function(_0x5b3a07,_0x567a34,_0xa9dd10){return db[_0x234b('0x31')][_0x234b('0x4b')]({'where':{'id':_0x5b3a07['params']['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0x567a34,null))[_0x234b('0x2a')](function(_0x445545){if(_0x445545){var _0x38a15f=[];var _0x31a06b={'success':[],'errors':[]};return db[_0x234b('0x60')][_0x234b('0x58')]()[_0x234b('0x2a')](function(_0x241b7d){if(_0x5b3a07[_0x234b('0x4e')]['tags']&&_[_0x234b('0x61')](_0x5b3a07[_0x234b('0x4e')]['tags'])){if(_0x5b3a07[_0x234b('0x4e')][_0x234b('0x62')][_0x234b('0x3b')]){_0x5b3a07[_0x234b('0x4e')][_0x234b('0x62')]=_0x5b3a07[_0x234b('0x4e')][_0x234b('0x62')]['join'](';')+';';}else{_0x5b3a07[_0x234b('0x4e')][_0x234b('0x62')]=null;}}else{_0x5b3a07[_0x234b('0x4e')][_0x234b('0x62')]=null;}if(_0x5b3a07[_0x234b('0x4e')]&&_[_0x234b('0x61')](_0x5b3a07['body'])){for(var _0x3ae399=0x0;_0x3ae399<_0x5b3a07[_0x234b('0x4e')]['length'];_0x3ae399+=0x1){_0x5b3a07[_0x234b('0x4e')][_0x3ae399]['ListId']=_0x5b3a07[_0x234b('0x49')]['id'];_0x38a15f['push'](_0x5b3a07[_0x234b('0x4e')][_0x3ae399]);}return BPromise[_0x234b('0x63')](_0x38a15f,function(_0x450edc){return db[_0x234b('0x60')][_0x234b('0x4d')](_[_0x234b('0x64')](_0x450edc,['ids','id'])||{},{'fields':_[_0x234b('0x4a')](_0x241b7d),'raw':!![]})[_0x234b('0x2a')](function(_0x2cf263){_0x31a06b[_0x234b('0x65')]['push'](_0x2cf263[_0x234b('0x66')]);})['catch'](function(_0x4e5dad){_0x31a06b[_0x234b('0x67')][_0x234b('0x68')]({'data':_0x450edc,'error':_0x4e5dad[_0x234b('0x69')]});});})[_0x234b('0x2a')](function(_0x1179ca){return _0x31a06b;})[_0x234b('0x4c')](function(_0x3d070e){return _0x3d070e;});}else{_0x567a34[_0x234b('0x1e')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x234b('0x2a')](respondWithResult(_0x567a34,null))['catch'](handleError(_0x567a34,null));};exports[_0x234b('0x6a')]=function(_0x15f238,_0x1986bb,_0x1121ec){var _0x66cdd6;return db['CmList']['find']({'where':{'id':_0x15f238[_0x234b('0x49')]['id']},'include':[{'model':db[_0x234b('0x6b')],'as':_0x234b('0x6c')}]})[_0x234b('0x2a')](handleEntityNotFound(_0x1986bb,null))[_0x234b('0x2a')](function(_0x73e139){if(_0x73e139){_0x66cdd6=_0x73e139;return db[_0x234b('0x60')][_0x234b('0x32')];}})[_0x234b('0x2a')](function(_0x39916d){if(_0x39916d){var _0x1ec910={};var _0xd222fb={};_0xd222fb[_0x234b('0x38')]=_[_0x234b('0x6d')](_[_0x234b('0x4a')](_0x39916d),_[_0x234b('0x30')](_0x66cdd6[_0x234b('0x6c')],function(_0x3c18ca){return util[_0x234b('0x6e')](_0x234b('0x6f'),_0x3c18ca['id']);}));_0xd222fb[_0x234b('0x35')]=_[_0x234b('0x4a')](_0x15f238[_0x234b('0x35')]);_0xd222fb[_0x234b('0x36')]=_[_0x234b('0x37')](_0xd222fb[_0x234b('0x38')],_0xd222fb[_0x234b('0x35')]);_0x1ec910[_0x234b('0x39')]=_[_0x234b('0x37')](_0xd222fb[_0x234b('0x38')],qs[_0x234b('0x3a')](_0x15f238[_0x234b('0x35')][_0x234b('0x3a')]));_0x1ec910[_0x234b('0x39')]=_0x1ec910[_0x234b('0x39')]['length']?_0x1ec910[_0x234b('0x39')]:_0xd222fb[_0x234b('0x38')];if(!_0x15f238[_0x234b('0x35')][_0x234b('0x3c')](_0x234b('0x3d'))){_0x1ec910['limit']=qs['limit'](_0x15f238[_0x234b('0x35')][_0x234b('0x22')]);_0x1ec910[_0x234b('0x21')]=qs[_0x234b('0x21')](_0x15f238['query']['offset']);}_0x1ec910['order']=qs[_0x234b('0x3e')](_0x15f238[_0x234b('0x35')]['sort']);_0x1ec910['where']=qs['filters'](_[_0x234b('0x40')](_0x15f238[_0x234b('0x35')],_0xd222fb[_0x234b('0x36')]));_0x1ec910['raw']=!![];if(_0x15f238['query'][_0x234b('0x41')]){_0x1ec910[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x1ec910[_0x234b('0x3f')],{'$or':_[_0x234b('0x30')](_0x1ec910[_0x234b('0x39')],function(_0x4fe359){var _0x53e530={};_0x53e530[_0x4fe359]={'$like':'%'+_0x15f238['query'][_0x234b('0x41')]+'%'};return _0x53e530;})});}_0x1ec910=_[_0x234b('0x42')]({},_0x1ec910,_0x15f238[_0x234b('0x44')]);return _0x66cdd6[_0x234b('0x6a')](_0x1ec910);}})[_0x234b('0x2a')](respondWithResult(_0x1986bb,null))['catch'](handleError(_0x1986bb,null));};exports[_0x234b('0x70')]=function(_0x3f0ee0,_0x22ab60,_0x121951){var _0x51d10e;var _0x5d12b1;var _0x4d23ee;var _0x498140=_0x3f0ee0[_0x234b('0x49')]['id'];csv_results=[];return db[_0x234b('0x71')][_0x234b('0x47')]({'attributes':['id','name'],'raw':!![],'order':[_0x234b('0x72')]})[_0x234b('0x2a')](function(_0x281cef){_0x51d10e=_0x281cef;var _0x208013=_['keys'](db[_0x234b('0x60')][_0x234b('0x32')]);return db[_0x234b('0x6b')][_0x234b('0x47')]({'raw':!![],'attributes':['id','alias']})[_0x234b('0x2a')](function(_0x53c78d){_0x5d12b1=_0x53c78d;var _0x2e7072=squel[_0x234b('0x73')]()[_0x234b('0x3a')](_0x208013)[_0x234b('0x74')](_0x234b('0x75'),'c')['where']('c.ListId\x20=\x20?',_0x498140)[_0x234b('0x3f')](_0x234b('0x76'))['distinct']();for(var _0x55ee4e=0x0;_0x55ee4e<_0x5d12b1['length'];_0x55ee4e++){_0x2e7072[_0x234b('0x77')]('c.cf_'+_0x5d12b1[_0x55ee4e]['id'],'customField_'+_0x5d12b1[_0x55ee4e][_0x234b('0x78')]);}for(var _0x55ee4e=0x0;_0x55ee4e<_0x51d10e['length'];_0x55ee4e++){_0x2e7072['field'](squel['select']()[_0x234b('0x77')]('item')['from'](_0x234b('0x79'))[_0x234b('0x3f')](_0x234b('0x7a'),_0x51d10e[_0x55ee4e]['id'])[_0x234b('0x3f')]('CmContactId\x20=\x20c.id'),_0x234b('0x7b')+_0x51d10e[_0x55ee4e][_0x234b('0x2e')]);_0x2e7072[_0x234b('0x77')](squel[_0x234b('0x73')]()[_0x234b('0x77')](_0x234b('0x7c'))[_0x234b('0x74')](_0x234b('0x79'))[_0x234b('0x3f')]('ItemTypeId\x20=\x20?',_0x51d10e[_0x55ee4e]['id'])['where'](_0x234b('0x7d')),'description_additionalPhone_'+_0x51d10e[_0x55ee4e]['name']);}var _0x19d68b=[];_0x19d68b[_0x234b('0x68')](_0x2e7072[_0x234b('0x7e')]());BPromise[_0x234b('0x63')](_0x19d68b,handleQuery)[_0x234b('0x2a')](function(_0x26c758){handleQuery(_0x2e7072[_0x234b('0x7e')]());var _0x140922=csv_results[0x0];if(!_[_0x234b('0x7f')](_0x140922)){var _0x50229c=toCsv(_0x140922);var _0x62cfd3=Date[_0x234b('0x80')]();fs[_0x234b('0x81')](util[_0x234b('0x6e')](_0x234b('0x82'),_0x498140,_0x62cfd3),_0x50229c);_0x22ab60[_0x234b('0x83')](_0x234b('0x84'),_0x234b('0x85')+util['format'](_0x234b('0x86'),_0x498140,_0x62cfd3));_0x22ab60[_0x234b('0x83')](_0x234b('0x87'),_0x234b('0x88'));return _0x22ab60['download'](util['format'](_0x234b('0x82'),_0x498140,_0x62cfd3));}else{return _0x22ab60['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x4c7f47,_0x412299,_0x5f398a){var _0x2ce028;delete _0x4c7f47[_0x234b('0x4e')]['id'];return db[_0x234b('0x31')][_0x234b('0x89')]({'where':{'id':_0x4c7f47[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0x412299,null))['then'](function(_0x29780f){if(_0x29780f){return db['sequelize'][_0x234b('0x8a')](function(_0x296cd4){return db[_0x234b('0x6b')][_0x234b('0x4d')](_0x4c7f47[_0x234b('0x4e')],{'transaction':_0x296cd4})[_0x234b('0x2a')](function(_0x4261fa){_0x2ce028=_0x4261fa;return _0x29780f[_0x234b('0x8b')](_0x4261fa,{'transaction':_0x296cd4});})[_0x234b('0x2a')](function(){var _0x224cf2={'type':db['Sequelize'][_0x234b('0x8c')],'transaction':_0x296cd4};switch(_0x4c7f47['body'][_0x234b('0x43')]){case _0x234b('0x8d'):_0x224cf2[_0x234b('0x43')]=db[_0x234b('0x8e')][_0x234b('0x8c')];break;case'number':_0x224cf2[_0x234b('0x43')]=db[_0x234b('0x8e')][_0x234b('0x8f')];break;case _0x234b('0x90'):_0x224cf2[_0x234b('0x43')]=db[_0x234b('0x8e')][_0x234b('0x91')];_0x224cf2[_0x234b('0x92')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0x234b('0x75'),util[_0x234b('0x6e')](_0x234b('0x93'),_0x2ce028['id']),_0x224cf2);})[_0x234b('0x2a')](function(){return _0x2ce028;});});}})[_0x234b('0x2a')](respondWithResult(_0x412299,null))['catch'](handleError(_0x412299,null));};exports['getCustomFields']=function(_0x4fffeb,_0x2e985e,_0x1bc9ac){var _0x218490={};var _0x5d0416={};var _0x4a382d;var _0x2e5eed;return db[_0x234b('0x31')][_0x234b('0x89')]({'where':{'id':_0x4fffeb[_0x234b('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e985e,null))[_0x234b('0x2a')](function(_0x45cd70){if(_0x45cd70){_0x4a382d=_0x45cd70;_0x5d0416['model']=_[_0x234b('0x4a')](db[_0x234b('0x6b')][_0x234b('0x32')]);_0x5d0416['query']=_['keys'](_0x4fffeb[_0x234b('0x35')]);_0x5d0416[_0x234b('0x36')]=_[_0x234b('0x37')](_0x5d0416[_0x234b('0x38')],_0x5d0416['query']);_0x218490[_0x234b('0x39')]=_[_0x234b('0x37')](_0x5d0416['model'],qs[_0x234b('0x3a')](_0x4fffeb['query'][_0x234b('0x3a')]));_0x218490['attributes']=_0x218490[_0x234b('0x39')]['length']?_0x218490[_0x234b('0x39')]:_0x5d0416['model'];_0x218490[_0x234b('0x94')]=qs[_0x234b('0x3e')](_0x4fffeb[_0x234b('0x35')][_0x234b('0x3e')]);_0x218490[_0x234b('0x3f')]=qs[_0x234b('0x36')](_[_0x234b('0x40')](_0x4fffeb['query'],_0x5d0416[_0x234b('0x36')]));_0x218490[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x218490[_0x234b('0x3f')],{'$or':[{'ListId':_0x45cd70['id']},{'ListId':null}]});if(_0x4fffeb['query'][_0x234b('0x41')]){_0x218490[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x218490[_0x234b('0x3f')],{'$or':_[_0x234b('0x30')](_0x218490[_0x234b('0x39')],function(_0xb0b18d){var _0x15465c={};_0x15465c[_0xb0b18d]={'$like':'%'+_0x4fffeb[_0x234b('0x35')][_0x234b('0x41')]+'%'};return _0x15465c;})});}_0x218490=_[_0x234b('0x42')]({},_0x218490,_0x4fffeb[_0x234b('0x44')]);return db[_0x234b('0x6b')][_0x234b('0x95')](_0x218490);}})[_0x234b('0x2a')](respondWithResult(_0x2e985e,null))[_0x234b('0x4c')](handleError(_0x2e985e,null));};exports[_0x234b('0x96')]=function(_0x392b3d,_0x2b5d29){return db[_0x234b('0x6b')][_0x234b('0x95')]({'where':{'ListId':null}})[_0x234b('0x2a')](handleEntityNotFound(_0x2b5d29,null))['then'](function(_0x1023ff){return _0x1023ff;})[_0x234b('0x2a')](respondWithResult(_0x2b5d29,null))[_0x234b('0x4c')](handleError(_0x2b5d29,null));};exports['addAgents']=function(_0xedbe32,_0x451205,_0x528772){return db['CmList'][_0x234b('0x4b')]({'where':{'id':_0xedbe32[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0x451205,null))['then'](function(_0x9cef8f){if(_0x9cef8f){return _0x9cef8f['addAgents'](_0xedbe32['body'][_0x234b('0x5e')],_['omit'](_0xedbe32[_0x234b('0x4e')],[_0x234b('0x5e'),'id'])||{})[_0x234b('0x97')](function(_0x3021eb){for(var _0x4e11b3=0x0;_0x4e11b3<_0xedbe32[_0x234b('0x4e')][_0x234b('0x5e')]['length'];_0x4e11b3+=0x1){socket[_0x234b('0x98')](_0x234b('0x99'),{'UserId':Number(_0xedbe32[_0x234b('0x4e')][_0x234b('0x5e')][_0x4e11b3]),'CmListId':Number(_0xedbe32[_0x234b('0x49')]['id'])});}return _0x3021eb;});}})[_0x234b('0x2a')](respondWithResult(_0x451205,null))[_0x234b('0x4c')](handleError(_0x451205,null));};exports[_0x234b('0x9a')]=function(_0x1b97cd,_0x41cc7a,_0x316a23){return db[_0x234b('0x31')][_0x234b('0x4b')]({'where':{'id':_0x1b97cd[_0x234b('0x49')]['id']}})['then'](handleEntityNotFound(_0x41cc7a,null))[_0x234b('0x2a')](function(_0x408e89){if(_0x408e89){return _0x408e89[_0x234b('0x9a')](_0x1b97cd[_0x234b('0x35')][_0x234b('0x5e')])[_0x234b('0x2a')](function(){if(_[_0x234b('0x61')](_0x1b97cd[_0x234b('0x35')]['ids'])){for(var _0x248ce2=0x0;_0x248ce2<_0x1b97cd[_0x234b('0x35')][_0x234b('0x5e')][_0x234b('0x3b')];_0x248ce2+=0x1){socket[_0x234b('0x98')]('userCmList:remove',{'UserId':Number(_0x1b97cd['query'][_0x234b('0x5e')][_0x248ce2]),'CmListId':Number(_0x1b97cd['params']['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x1b97cd['query']['ids']),'CmListId':Number(_0x1b97cd[_0x234b('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x41cc7a,null))['catch'](handleError(_0x41cc7a,null));};exports[_0x234b('0x9b')]=function(_0x2a0183,_0x1600b3,_0x373b60){var _0x5e87f9={};var _0x31b0e4={};var _0x41c8a2;var _0x510bdc;return db[_0x234b('0x31')]['findOne']({'where':{'id':_0x2a0183[_0x234b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1600b3,null))[_0x234b('0x2a')](function(_0x41a859){if(_0x41a859){_0x41c8a2=_0x41a859;_0x31b0e4[_0x234b('0x38')]=_[_0x234b('0x4a')](db[_0x234b('0x9c')][_0x234b('0x32')]);_0x31b0e4['query']=_[_0x234b('0x4a')](_0x2a0183[_0x234b('0x35')]);_0x31b0e4[_0x234b('0x36')]=_[_0x234b('0x37')](_0x31b0e4[_0x234b('0x38')],_0x31b0e4[_0x234b('0x35')]);_0x5e87f9[_0x234b('0x39')]=_[_0x234b('0x37')](_0x31b0e4[_0x234b('0x38')],qs[_0x234b('0x3a')](_0x2a0183[_0x234b('0x35')][_0x234b('0x3a')]));_0x5e87f9[_0x234b('0x39')]=_0x5e87f9[_0x234b('0x39')]['length']?_0x5e87f9['attributes']:_0x31b0e4[_0x234b('0x38')];_0x5e87f9[_0x234b('0x94')]=qs[_0x234b('0x3e')](_0x2a0183['query'][_0x234b('0x3e')]);_0x5e87f9[_0x234b('0x3f')]=qs[_0x234b('0x36')](_[_0x234b('0x40')](_0x2a0183[_0x234b('0x35')],_0x31b0e4[_0x234b('0x36')]));if(_0x2a0183[_0x234b('0x35')][_0x234b('0x41')]){_0x5e87f9[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x5e87f9[_0x234b('0x3f')],{'$or':_[_0x234b('0x30')](_0x5e87f9[_0x234b('0x39')],function(_0x56944d){var _0x2b7bf8={};_0x2b7bf8[_0x56944d]={'$like':'%'+_0x2a0183[_0x234b('0x35')][_0x234b('0x41')]+'%'};return _0x2b7bf8;})});}_0x5e87f9=_[_0x234b('0x42')]({},_0x5e87f9,_0x2a0183[_0x234b('0x44')]);return _0x41c8a2[_0x234b('0x9b')](_0x5e87f9);}})['then'](function(_0x1c0186){if(_0x1c0186){_0x510bdc=_0x1c0186[_0x234b('0x3b')];if(!_0x2a0183['query'][_0x234b('0x3c')](_0x234b('0x3d'))){_0x5e87f9[_0x234b('0x22')]=qs[_0x234b('0x22')](_0x2a0183[_0x234b('0x35')][_0x234b('0x22')]);_0x5e87f9[_0x234b('0x21')]=qs[_0x234b('0x21')](_0x2a0183[_0x234b('0x35')][_0x234b('0x21')]);}return _0x41c8a2[_0x234b('0x9b')](_0x5e87f9);}})[_0x234b('0x2a')](function(_0x5d4d7b){if(_0x5d4d7b){return _0x5d4d7b?{'count':_0x510bdc,'rows':_0x5d4d7b}:null;}})[_0x234b('0x2a')](respondWithResult(_0x1600b3,null))[_0x234b('0x4c')](handleError(_0x1600b3,null));};function handleQuery(_0x1645ad){logger[_0x234b('0x9d')](_0x1645ad);return db[_0x234b('0x9e')][_0x234b('0x35')](_0x1645ad)[_0x234b('0x97')](function(_0x9a1088){csv_results['push'](_0x9a1088);})[_0x234b('0x4c')](function(_0x2fd22b){logger[_0x234b('0x2d')](_0x2fd22b[_0x234b('0x69')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 04817f0..da5c252 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0xac8a7e,_0x235858){var _0x479a84=function(_0x260d98){while(--_0x260d98){_0xac8a7e['push'](_0xac8a7e['shift']());}};_0x479a84(++_0x235858);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x315ad5,_0x4c6fbc){var _0x353745=function(_0x18e21a){while(--_0x18e21a){_0x315ad5['push'](_0x315ad5['shift']());}};_0x353745(++_0x4c6fbc);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f5bbb1b..b91e738 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 _0xa74f=['cm_lists','../../config/logger','bluebird','request-promise','path','rimraf','./cmList.attributes','define','CmList'];(function(_0x136155,_0xd81065){var _0x2cbc8c=function(_0x1e58e1){while(--_0x1e58e1){_0x136155['push'](_0x136155['shift']());}};_0x2cbc8c(++_0xd81065);}(_0xa74f,0x9a));var _0xfa74=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xa74f[_0x597484];return _0x218e64;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb903=['rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x501c00,_0x1dc98b){var _0x5ad836=function(_0x21299f){while(--_0x21299f){_0x501c00['push'](_0x501c00['shift']());}};_0x5ad836(++_0x1dc98b);}(_0xb903,0x185));var _0x3b90=function(_0x276d28,_0xdab4e8){_0x276d28=_0x276d28-0x0;var _0x425d0d=_0xb903[_0x276d28];return _0x425d0d;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('CmList',attributes,{'tableName':_0x3b90('0xb'),'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 2667115..27a03d6 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 _0xd087=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x28e28b,_0x340c0f){var _0x40a4e1=function(_0x4c1acf){while(--_0x4c1acf){_0x28e28b['push'](_0x28e28b['shift']());}};_0x40a4e1(++_0x340c0f);}(_0xd087,0x1e6));var _0x7d08=function(_0x2ca515,_0x2f0654){_0x2ca515=_0x2ca515-0x0;var _0x2f7701=_0xd087[_0x2ca515];return _0x2f7701;};'use strict';var _=require(_0x7d08('0x0'));var util=require(_0x7d08('0x1'));var moment=require(_0x7d08('0x2'));var BPromise=require(_0x7d08('0x3'));var rs=require(_0x7d08('0x4'));var fs=require('fs');var Redis=require(_0x7d08('0x5'));var db=require(_0x7d08('0x6'))['db'];var utils=require(_0x7d08('0x7'));var logger=require(_0x7d08('0x8'))('rpc');var config=require(_0x7d08('0x9'));var jayson=require(_0x7d08('0xa'));var client=jayson[_0x7d08('0xb')][_0x7d08('0xc')]({'port':0x232a});config[_0x7d08('0xd')]=_['defaults'](config[_0x7d08('0xd')],{'host':_0x7d08('0xe'),'port':0x18eb});var socket=require(_0x7d08('0xf'))(new Redis(config[_0x7d08('0xd')]));require('./cmList.socket')[_0x7d08('0x10')](socket);function respondWithRpcPromise(_0x2a6441,_0x486b3e,_0x118d06){return new BPromise(function(_0x24302e,_0x207292){return client[_0x7d08('0x11')](_0x2a6441,_0x118d06)[_0x7d08('0x12')](function(_0x5f3776){logger[_0x7d08('0x13')](_0x7d08('0x14'),_0x486b3e,_0x7d08('0x15'));logger['debug'](_0x7d08('0x16'),_0x486b3e,_0x7d08('0x15'),JSON[_0x7d08('0x17')](_0x5f3776));if(_0x5f3776[_0x7d08('0x18')]){if(_0x5f3776['error'][_0x7d08('0x19')]===0x1f4){logger[_0x7d08('0x18')](_0x7d08('0x14'),_0x486b3e,_0x5f3776[_0x7d08('0x18')][_0x7d08('0x1a')]);return _0x207292(_0x5f3776[_0x7d08('0x18')][_0x7d08('0x1a')]);}logger['error'](_0x7d08('0x14'),_0x486b3e,_0x5f3776[_0x7d08('0x18')][_0x7d08('0x1a')]);return _0x24302e(_0x5f3776[_0x7d08('0x18')]['message']);}else{logger[_0x7d08('0x13')]('CmList,\x20%s,\x20%s',_0x486b3e,'request\x20sent');_0x24302e(_0x5f3776[_0x7d08('0x1b')]['message']);}})[_0x7d08('0x1c')](function(_0x3398c2){logger[_0x7d08('0x18')]('CmList,\x20%s,\x20%s',_0x486b3e,_0x3398c2);_0x207292(_0x3398c2);});});} \ No newline at end of file +var _0xf769=['debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0x556dda,_0x3180e8){var _0x3405ce=function(_0x4b0aac){while(--_0x4b0aac){_0x556dda['push'](_0x556dda['shift']());}};_0x3405ce(++_0x3180e8);}(_0xf769,0x157));var _0x9f76=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0xf769[_0x28e74e];return _0xb45ac1;};'use strict';var _=require(_0x9f76('0x0'));var util=require(_0x9f76('0x1'));var moment=require(_0x9f76('0x2'));var BPromise=require(_0x9f76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f76('0x4'));var db=require(_0x9f76('0x5'))['db'];var utils=require(_0x9f76('0x6'));var logger=require('../../config/logger')(_0x9f76('0x7'));var config=require(_0x9f76('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f76('0x9')][_0x9f76('0xa')]({'port':0x232a});config[_0x9f76('0xb')]=_[_0x9f76('0xc')](config[_0x9f76('0xb')],{'host':_0x9f76('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f76('0xb')]));require(_0x9f76('0xe'))[_0x9f76('0xf')](socket);function respondWithRpcPromise(_0x45454a,_0xc6dcb1,_0x30b7f5){return new BPromise(function(_0x93e62e,_0x1cd10f){return client[_0x9f76('0x10')](_0x45454a,_0x30b7f5)[_0x9f76('0x11')](function(_0x4fa730){logger[_0x9f76('0x12')](_0x9f76('0x13'),_0xc6dcb1,_0x9f76('0x14'));logger[_0x9f76('0x15')](_0x9f76('0x16'),_0xc6dcb1,_0x9f76('0x14'),JSON['stringify'](_0x4fa730));if(_0x4fa730[_0x9f76('0x17')]){if(_0x4fa730[_0x9f76('0x17')][_0x9f76('0x18')]===0x1f4){logger[_0x9f76('0x17')]('CmList,\x20%s,\x20%s',_0xc6dcb1,_0x4fa730[_0x9f76('0x17')][_0x9f76('0x19')]);return _0x1cd10f(_0x4fa730[_0x9f76('0x17')][_0x9f76('0x19')]);}logger['error']('CmList,\x20%s,\x20%s',_0xc6dcb1,_0x4fa730[_0x9f76('0x17')][_0x9f76('0x19')]);return _0x93e62e(_0x4fa730['error'][_0x9f76('0x19')]);}else{logger[_0x9f76('0x12')](_0x9f76('0x13'),_0xc6dcb1,_0x9f76('0x14'));_0x93e62e(_0x4fa730[_0x9f76('0x1a')]['message']);}})[_0x9f76('0x1b')](function(_0x4975d6){logger['error']('CmList,\x20%s,\x20%s',_0xc6dcb1,_0x4975d6);_0x1cd10f(_0x4975d6);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 64f139d..1d4a55f 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 _0x8ae5=['./cmList.events','save','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x25e9df,_0x17a63a){var _0x3dea70=function(_0x3b808a){while(--_0x3b808a){_0x25e9df['push'](_0x25e9df['shift']());}};_0x3dea70(++_0x17a63a);}(_0x8ae5,0xab));var _0x58ae=function(_0x26c716,_0x1cabbd){_0x26c716=_0x26c716-0x0;var _0x799e6d=_0x8ae5[_0x26c716];return _0x799e6d;};'use strict';var CmListEvents=require(_0x58ae('0x0'));var events=[_0x58ae('0x1'),_0x58ae('0x2'),_0x58ae('0x3')];function createListener(_0x392e4e,_0x2f3b82){return function(_0x2dfd1b){_0x2f3b82[_0x58ae('0x4')](_0x392e4e,_0x2dfd1b);};}function removeListener(_0x464fbb,_0x898c59){return function(){CmListEvents[_0x58ae('0x5')](_0x464fbb,_0x898c59);};}exports[_0x58ae('0x6')]=function(_0x129865){for(var _0xba23e0=0x0,_0x14a4e0=events[_0x58ae('0x7')];_0xba23e0<_0x14a4e0;_0xba23e0++){var _0x59f192=events[_0xba23e0];var _0x5b520a=createListener(_0x58ae('0x8')+_0x59f192,_0x129865);CmListEvents['on'](_0x59f192,_0x5b520a);}}; \ No newline at end of file +var _0xe3b7=['save','remove','update','emit','register','length','./cmList.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe3b7,0x12c));var _0x7e3b=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xe3b7[_0x21aec3];return _0x288bbc;};'use strict';var CmListEvents=require(_0x7e3b('0x0'));var events=[_0x7e3b('0x1'),_0x7e3b('0x2'),_0x7e3b('0x3')];function createListener(_0x4c8a26,_0x386f5a){return function(_0x22ea97){_0x386f5a[_0x7e3b('0x4')](_0x4c8a26,_0x22ea97);};}function removeListener(_0x5641fc,_0x1e652e){return function(){CmListEvents['removeListener'](_0x5641fc,_0x1e652e);};}exports[_0x7e3b('0x5')]=function(_0x3a9809){for(var _0x4b7396=0x0,_0xfbede5=events[_0x7e3b('0x6')];_0x4b7396<_0xfbede5;_0x4b7396++){var _0x23afed=events[_0x4b7396];var _0x4dd509=createListener('cmList:'+_0x23afed,_0x3a9809);CmListEvents['on'](_0x23afed,_0x4dd509);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d42b067..d603fe0 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 _0x29a7=['/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields'];(function(_0x3972dd,_0x298e3f){var _0x3a29c8=function(_0x461387){while(--_0x461387){_0x3972dd['push'](_0x3972dd['shift']());}};_0x3a29c8(++_0x298e3f);}(_0x29a7,0x1af));var _0x729a=function(_0x1bfd18,_0x3ba1ab){_0x1bfd18=_0x1bfd18-0x0;var _0x17c907=_0x29a7[_0x1bfd18];return _0x17c907;};'use strict';var multer=require(_0x729a('0x0'));var util=require(_0x729a('0x1'));var path=require(_0x729a('0x2'));var timeout=require(_0x729a('0x3'));var express=require(_0x729a('0x4'));var router=express[_0x729a('0x5')]();var fs_extra=require(_0x729a('0x6'));var auth=require(_0x729a('0x7'));var interaction=require(_0x729a('0x8'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x729a('0x9')]('/',auth['isAuthenticated'](),controller[_0x729a('0xa')]);router[_0x729a('0x9')](_0x729a('0xb'),auth[_0x729a('0xc')](),controller[_0x729a('0xd')]);router['get'](_0x729a('0xe'),auth[_0x729a('0xc')](),controller[_0x729a('0xf')]);router[_0x729a('0x9')](_0x729a('0x10'),auth[_0x729a('0xc')](),controller[_0x729a('0x11')]);router[_0x729a('0x9')](_0x729a('0x12'),auth['isAuthenticated'](),controller[_0x729a('0x13')]);router[_0x729a('0x9')](_0x729a('0x14'),auth['isAuthenticated'](),controller[_0x729a('0x15')]);router[_0x729a('0x9')](_0x729a('0x16'),auth[_0x729a('0xc')](),controller['getContactsCsv']);router['get'](_0x729a('0x17'),auth['isAuthenticated'](),controller[_0x729a('0x18')]);router[_0x729a('0x9')](_0x729a('0x19'),auth['isAuthenticated'](),controller[_0x729a('0x1a')]);router['post']('/',auth[_0x729a('0xc')](),controller['create']);router[_0x729a('0x1b')](_0x729a('0x12'),auth[_0x729a('0xc')](),controller[_0x729a('0x1c')]);router[_0x729a('0x1b')]('/:id/contacts',auth[_0x729a('0xc')](),controller[_0x729a('0x1d')]);router[_0x729a('0x1b')](_0x729a('0x17'),auth[_0x729a('0xc')](),controller[_0x729a('0x1e')]);router[_0x729a('0x1b')](_0x729a('0x19'),auth[_0x729a('0xc')](),controller[_0x729a('0x1f')]);router[_0x729a('0x20')](_0x729a('0x10'),auth[_0x729a('0xc')](),controller[_0x729a('0x21')]);router[_0x729a('0x22')]('/:id',auth['isAuthenticated'](),controller[_0x729a('0x23')]);router[_0x729a('0x22')](_0x729a('0x12'),auth[_0x729a('0xc')](),controller[_0x729a('0x24')]);router[_0x729a('0x22')](_0x729a('0x19'),auth[_0x729a('0xc')](),controller[_0x729a('0x25')]);module['exports']=router; \ No newline at end of file +var _0xa8ad=['update','delete','destroy','removeAgents','multer','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','/:id'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0xa8ad,0x10c));var _0xda8a=function(_0x242491,_0xd2c9ac){_0x242491=_0x242491-0x0;var _0x4e176f=_0xa8ad[_0x242491];return _0x4e176f;};'use strict';var multer=require(_0xda8a('0x0'));var util=require('util');var path=require(_0xda8a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xda8a('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xda8a('0x3'));var config=require(_0xda8a('0x4'));var controller=require(_0xda8a('0x5'));router[_0xda8a('0x6')]('/',auth['isAuthenticated'](),controller[_0xda8a('0x7')]);router[_0xda8a('0x6')](_0xda8a('0x8'),auth[_0xda8a('0x9')](),controller['describe']);router['get']('/global_fields',auth[_0xda8a('0x9')](),controller[_0xda8a('0xa')]);router[_0xda8a('0x6')]('/:id',auth[_0xda8a('0x9')](),controller[_0xda8a('0xb')]);router[_0xda8a('0x6')](_0xda8a('0xc'),auth['isAuthenticated'](),controller[_0xda8a('0xd')]);router[_0xda8a('0x6')](_0xda8a('0xe'),auth[_0xda8a('0x9')](),controller[_0xda8a('0xf')]);router['get'](_0xda8a('0x10'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0xda8a('0x6')](_0xda8a('0x11'),auth[_0xda8a('0x9')](),controller[_0xda8a('0x12')]);router[_0xda8a('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xda8a('0x13')]);router[_0xda8a('0x14')]('/',auth['isAuthenticated'](),controller[_0xda8a('0x15')]);router[_0xda8a('0x14')](_0xda8a('0xc'),auth[_0xda8a('0x9')](),controller[_0xda8a('0x16')]);router[_0xda8a('0x14')](_0xda8a('0xe'),auth[_0xda8a('0x9')](),controller[_0xda8a('0x17')]);router[_0xda8a('0x14')](_0xda8a('0x11'),auth['isAuthenticated'](),controller[_0xda8a('0x18')]);router['post'](_0xda8a('0x19'),auth[_0xda8a('0x9')](),controller[_0xda8a('0x1a')]);router[_0xda8a('0x1b')](_0xda8a('0x1c'),auth['isAuthenticated'](),controller[_0xda8a('0x1d')]);router[_0xda8a('0x1e')](_0xda8a('0x1c'),auth['isAuthenticated'](),controller[_0xda8a('0x1f')]);router[_0xda8a('0x1e')](_0xda8a('0xc'),auth[_0xda8a('0x9')](),controller['removeDispositions']);router[_0xda8a('0x1e')](_0xda8a('0x19'),auth[_0xda8a('0x9')](),controller[_0xda8a('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 1630cf0..f84f025 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 _0xd3ae=['STRING','sequelize','field'];(function(_0x4fbbf1,_0x5e27d5){var _0x343025=function(_0x3b6d84){while(--_0x3b6d84){_0x4fbbf1['push'](_0x4fbbf1['shift']());}};_0x343025(++_0x5e27d5);}(_0xd3ae,0x1e1));var _0xed3a=function(_0x5d5c49,_0x528f94){_0x5d5c49=_0x5d5c49-0x0;var _0x41cb72=_0xd3ae[_0x5d5c49];return _0x41cb72;};'use strict';var Sequelize=require(_0xed3a('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2cfb54){return this['getDataValue'](_0xed3a('0x1'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xed3a('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xed3a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x874c=['field','STRING','sequelize','exports','getDataValue'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x874c,0xe3));var _0xc874=function(_0x5a5c0e,_0x479bf1){_0x5a5c0e=_0x5a5c0e-0x0;var _0x5edc4f=_0x874c[_0x5a5c0e];return _0x5edc4f;};'use strict';var Sequelize=require(_0xc874('0x0'));module[_0xc874('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x12ce87){return this[_0xc874('0x2')](_0xc874('0x3'));}},'field':{'type':Sequelize[_0xc874('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xc874('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xc874('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index f37f76d..903b541 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(_0x11f11d,_0x116f61){var _0xc98cb8=function(_0x1b52ff){while(--_0x1b52ff){_0x11f11d['push'](_0x11f11d['shift']());}};_0xc98cb8(++_0x116f61);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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(_0x2f1781,_0xc26ecf){var _0x5133ec=function(_0x15d769){while(--_0x15d769){_0x2f1781['push'](_0x2f1781['shift']());}};_0x5133ec(++_0xc26ecf);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0008ed0..5e8523f 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 _0x1c85=['moment','bluebird','path','rimraf','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1c85,0x98));var _0x51c8=function(_0x5c7c22,_0x264485){_0x5c7c22=_0x5c7c22-0x0;var _0x560fcf=_0x1c85[_0x5c7c22];return _0x560fcf;};'use strict';var _=require(_0x51c8('0x0'));var util=require(_0x51c8('0x1'));var logger=require(_0x51c8('0x2'))(_0x51c8('0x3'));var moment=require(_0x51c8('0x4'));var BPromise=require(_0x51c8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51c8('0x6'));var rimraf=require(_0x51c8('0x7'));var config=require('../../config/environment');var attributes=require(_0x51c8('0x8'));module[_0x51c8('0x9')]=function(_0x345dd5,_0x689298){return _0x345dd5[_0x51c8('0xa')](_0x51c8('0xb'),attributes,{'tableName':_0x51c8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fb6=['rimraf','./condition.attributes','exports','define','tools_conditions','lodash','api','moment','request-promise','path'];(function(_0x4b1cd7,_0x27b641){var _0x400e61=function(_0x51d246){while(--_0x51d246){_0x4b1cd7['push'](_0x4b1cd7['shift']());}};_0x400e61(++_0x27b641);}(_0x8fb6,0x1b3));var _0x68fb=function(_0x5712a7,_0x4e4280){_0x5712a7=_0x5712a7-0x0;var _0x3beca3=_0x8fb6[_0x5712a7];return _0x3beca3;};'use strict';var _=require(_0x68fb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x68fb('0x1'));var moment=require(_0x68fb('0x2'));var BPromise=require('bluebird');var rp=require(_0x68fb('0x3'));var fs=require('fs');var path=require(_0x68fb('0x4'));var rimraf=require(_0x68fb('0x5'));var config=require('../../config/environment');var attributes=require(_0x68fb('0x6'));module[_0x68fb('0x7')]=function(_0x3ff084,_0x145118){return _0x3ff084[_0x68fb('0x8')]('Condition',attributes,{'tableName':_0x68fb('0x9'),'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 f749e5c..394157a 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 _0xee95=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xee95,0x1af));var _0x5ee9=function(_0x338381,_0x8ecfed){_0x338381=_0x338381-0x0;var _0x1d7762=_0xee95[_0x338381];return _0x1d7762;};'use strict';var _=require(_0x5ee9('0x0'));var util=require(_0x5ee9('0x1'));var moment=require('moment');var BPromise=require(_0x5ee9('0x2'));var rs=require(_0x5ee9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ee9('0x4'))['db'];var utils=require(_0x5ee9('0x5'));var logger=require(_0x5ee9('0x6'))(_0x5ee9('0x7'));var config=require(_0x5ee9('0x8'));var jayson=require(_0x5ee9('0x9'));var client=jayson[_0x5ee9('0xa')][_0x5ee9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x406a5b,_0x36d8e2,_0x22cd9a){return new BPromise(function(_0x30447b,_0x1feae0){return client[_0x5ee9('0xc')](_0x406a5b,_0x22cd9a)[_0x5ee9('0xd')](function(_0x3c7067){logger['info'](_0x5ee9('0xe'),_0x36d8e2,_0x5ee9('0xf'));logger[_0x5ee9('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x36d8e2,_0x5ee9('0xf'),JSON[_0x5ee9('0x11')](_0x3c7067));if(_0x3c7067[_0x5ee9('0x12')]){if(_0x3c7067[_0x5ee9('0x12')][_0x5ee9('0x13')]===0x1f4){logger['error'](_0x5ee9('0xe'),_0x36d8e2,_0x3c7067[_0x5ee9('0x12')][_0x5ee9('0x14')]);return _0x1feae0(_0x3c7067[_0x5ee9('0x12')][_0x5ee9('0x14')]);}logger['error'](_0x5ee9('0xe'),_0x36d8e2,_0x3c7067[_0x5ee9('0x12')]['message']);return _0x30447b(_0x3c7067[_0x5ee9('0x12')][_0x5ee9('0x14')]);}else{logger[_0x5ee9('0x15')](_0x5ee9('0xe'),_0x36d8e2,_0x5ee9('0xf'));_0x30447b(_0x3c7067[_0x5ee9('0x16')][_0x5ee9('0x14')]);}})[_0x5ee9('0x17')](function(_0x31bf11){logger[_0x5ee9('0x12')](_0x5ee9('0xe'),_0x36d8e2,_0x31bf11);_0x1feae0(_0x31bf11);});});} \ No newline at end of file +var _0xd820=['Condition,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x28d5cd,_0x5db33b){var _0x424c22=function(_0x4bea4c){while(--_0x4bea4c){_0x28d5cd['push'](_0x28d5cd['shift']());}};_0x424c22(++_0x5db33b);}(_0xd820,0xb3));var _0x0d82=function(_0x51bf0f,_0x3b3cfb){_0x51bf0f=_0x51bf0f-0x0;var _0x5c8633=_0xd820[_0x51bf0f];return _0x5c8633;};'use strict';var _=require(_0x0d82('0x0'));var util=require(_0x0d82('0x1'));var moment=require('moment');var BPromise=require(_0x0d82('0x2'));var rs=require(_0x0d82('0x3'));var fs=require('fs');var Redis=require(_0x0d82('0x4'));var db=require(_0x0d82('0x5'))['db'];var utils=require(_0x0d82('0x6'));var logger=require(_0x0d82('0x7'))(_0x0d82('0x8'));var config=require('../../config/environment');var jayson=require(_0x0d82('0x9'));var client=jayson[_0x0d82('0xa')][_0x0d82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11d929,_0x57ed0d,_0x4ae193){return new BPromise(function(_0x3015b7,_0x24c034){return client[_0x0d82('0xc')](_0x11d929,_0x4ae193)['then'](function(_0x3d92ec){logger[_0x0d82('0xd')]('Condition,\x20%s,\x20%s',_0x57ed0d,_0x0d82('0xe'));logger[_0x0d82('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x57ed0d,_0x0d82('0xe'),JSON[_0x0d82('0x10')](_0x3d92ec));if(_0x3d92ec[_0x0d82('0x11')]){if(_0x3d92ec['error'][_0x0d82('0x12')]===0x1f4){logger[_0x0d82('0x11')](_0x0d82('0x13'),_0x57ed0d,_0x3d92ec[_0x0d82('0x11')][_0x0d82('0x14')]);return _0x24c034(_0x3d92ec[_0x0d82('0x11')]['message']);}logger[_0x0d82('0x11')](_0x0d82('0x13'),_0x57ed0d,_0x3d92ec[_0x0d82('0x11')]['message']);return _0x3015b7(_0x3d92ec[_0x0d82('0x11')]['message']);}else{logger['info'](_0x0d82('0x13'),_0x57ed0d,_0x0d82('0xe'));_0x3015b7(_0x3d92ec[_0x0d82('0x15')]['message']);}})['catch'](function(_0x168401){logger['error']('Condition,\x20%s,\x20%s',_0x57ed0d,_0x168401);_0x24c034(_0x168401);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index b0b3c43..ad76573 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 _0xd1da=['../../config/environment','./condition.controller','isAuthenticated','update','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5c9f56,_0x42c9ad){var _0x2a726b=function(_0x4a13cd){while(--_0x4a13cd){_0x5c9f56['push'](_0x5c9f56['shift']());}};_0x2a726b(++_0x42c9ad);}(_0xd1da,0xca));var _0xad1d=function(_0x48b6c6,_0xba4073){_0x48b6c6=_0x48b6c6-0x0;var _0x1bcc9a=_0xd1da[_0x48b6c6];return _0x1bcc9a;};'use strict';var multer=require(_0xad1d('0x0'));var util=require(_0xad1d('0x1'));var path=require('path');var timeout=require(_0xad1d('0x2'));var express=require(_0xad1d('0x3'));var router=express[_0xad1d('0x4')]();var fs_extra=require(_0xad1d('0x5'));var auth=require(_0xad1d('0x6'));var interaction=require(_0xad1d('0x7'));var config=require(_0xad1d('0x8'));var controller=require(_0xad1d('0x9'));router['put']('/:id',auth[_0xad1d('0xa')](),controller[_0xad1d('0xb')]);router[_0xad1d('0xc')](_0xad1d('0xd'),auth[_0xad1d('0xa')](),controller['destroy']);module[_0xad1d('0xe')]=router; \ No newline at end of file +var _0x33db=['isAuthenticated','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x1d6528,_0x1c20a3){var _0x3928df=function(_0x520799){while(--_0x520799){_0x1d6528['push'](_0x1d6528['shift']());}};_0x3928df(++_0x1c20a3);}(_0x33db,0x17c));var _0xb33d=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x33db[_0x1db251];return _0x56685a;};'use strict';var multer=require(_0xb33d('0x0'));var util=require(_0xb33d('0x1'));var path=require(_0xb33d('0x2'));var timeout=require('connect-timeout');var express=require(_0xb33d('0x3'));var router=express[_0xb33d('0x4')]();var fs_extra=require(_0xb33d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb33d('0x6'));var config=require(_0xb33d('0x7'));var controller=require(_0xb33d('0x8'));router[_0xb33d('0x9')]('/:id',auth[_0xb33d('0xa')](),controller['update']);router[_0xb33d('0xb')](_0xb33d('0xc'),auth['isAuthenticated'](),controller[_0xb33d('0xd')]);module[_0xb33d('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index afec6df..163f42c 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 _0xf086=['exports','STRING','name','sequelize'];(function(_0x352d08,_0x3fa048){var _0x791e50=function(_0x1dc5c2){while(--_0x1dc5c2){_0x352d08['push'](_0x352d08['shift']());}};_0x791e50(++_0x3fa048);}(_0xf086,0x1a7));var _0x6f08=function(_0x1aa832,_0x93f678){_0x1aa832=_0x1aa832-0x0;var _0x334378=_0xf086[_0x1aa832];return _0x334378;};'use strict';var Sequelize=require(_0x6f08('0x0'));module[_0x6f08('0x1')]={'name':{'type':Sequelize[_0x6f08('0x2')],'allowNull':![],'unique':_0x6f08('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x6f08('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xf117=['INTEGER','sequelize','exports','STRING'];(function(_0x1dc992,_0x2a7a63){var _0x4adf26=function(_0x2546db){while(--_0x2546db){_0x1dc992['push'](_0x1dc992['shift']());}};_0x4adf26(++_0x2a7a63);}(_0xf117,0x99));var _0x7f11=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xf117[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0x7f11('0x0'));module[_0x7f11('0x1')]={'name':{'type':Sequelize[_0x7f11('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x7f11('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7f11('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1712c31..daf7bde 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 _0xe511=['save','update','then','get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','create','catch','body','destroy','CmContactHasItem','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range'];(function(_0x49bb68,_0xde3c01){var _0x1542f3=function(_0x49d74d){while(--_0x49d74d){_0x49bb68['push'](_0x49bb68['shift']());}};_0x1542f3(++_0xde3c01);}(_0xe511,0x16f));var _0x1e51=function(_0x100ffb,_0x5a8adc){_0x100ffb=_0x100ffb-0x0;var _0x54e870=_0xe511[_0x100ffb];return _0x54e870;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){var _0x43f5c5=_0x461d3d[_0x1e51('0x24')]({'plain':!![]});var _0x2e42b1=_0x1e51('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e42b1,'resourceId':_0x43f5c5['id']}})['then'](function(){return _0x461d3d;});})[_0x1e51('0x23')](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x5412bc,_0x1e7a96){return function(_0x49c507){if(!_0x49c507){_0x5412bc['sendStatus'](0x194);}return _0x49c507;};}function handleError(_0x3349f0,_0x5c5bbd){_0x5c5bbd=_0x5c5bbd||0x1f4;return function(_0x170ec6){logger[_0x1e51('0x26')](_0x170ec6['stack']);if(_0x170ec6[_0x1e51('0x27')]){delete _0x170ec6[_0x1e51('0x27')];}_0x3349f0[_0x1e51('0x19')](_0x5c5bbd)[_0x1e51('0x28')](_0x170ec6);};}exports['index']=function(_0x4cf046,_0x4f67d3){var _0x20eb9b={},_0x288b50={},_0x1ba84a={'count':0x0,'rows':[]};var _0x36dabe=_[_0x1e51('0x29')](db[_0x1e51('0x2a')][_0x1e51('0x2b')],function(_0x34701c){return{'name':_0x34701c[_0x1e51('0x2c')],'type':_0x34701c[_0x1e51('0x2d')][_0x1e51('0x2e')]};});_0x288b50['model']=_[_0x1e51('0x29')](_0x36dabe,_0x1e51('0x27'));_0x288b50[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4cf046[_0x1e51('0x2f')]);_0x288b50['filters']=_[_0x1e51('0x31')](_0x288b50['model'],_0x288b50[_0x1e51('0x2f')]);_0x20eb9b[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x288b50['model'],qs[_0x1e51('0x33')](_0x4cf046['query'][_0x1e51('0x33')]));_0x20eb9b['attributes']=_0x20eb9b['attributes'][_0x1e51('0x34')]?_0x20eb9b[_0x1e51('0x32')]:_0x288b50[_0x1e51('0x35')];if(!_0x4cf046['query'][_0x1e51('0x36')]('nolimit')){_0x20eb9b[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x4cf046['query'][_0x1e51('0x1d')]);_0x20eb9b[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x20eb9b[_0x1e51('0x37')]=qs['sort'](_0x4cf046['query'][_0x1e51('0x38')]);_0x20eb9b['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x4cf046[_0x1e51('0x2f')],_0x288b50[_0x1e51('0x39')]),_0x36dabe);if(_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x20eb9b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x20eb9b[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x36dabe,function(_0x45d5fe){if(_0x45d5fe['type']!==_0x1e51('0x3e')){var _0x5818be={};_0x5818be[_0x45d5fe[_0x1e51('0x27')]]={'$like':'%'+_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x5818be;}})});}_0x20eb9b=_[_0x1e51('0x3d')]({},_0x20eb9b,_0x4cf046[_0x1e51('0x3f')]);var _0x2f8fd9={'where':_0x20eb9b[_0x1e51('0x3c')]};return db[_0x1e51('0x2a')][_0x1e51('0x1e')](_0x2f8fd9)[_0x1e51('0x23')](function(_0xc40fce){_0x1ba84a['count']=_0xc40fce;if(_0x4cf046['query'][_0x1e51('0x40')]){_0x20eb9b[_0x1e51('0x41')]=[{'all':!![]}];}return db[_0x1e51('0x2a')][_0x1e51('0x42')](_0x20eb9b);})[_0x1e51('0x23')](function(_0x1a9e0d){_0x1ba84a[_0x1e51('0x43')]=_0x1a9e0d;return _0x1ba84a;})[_0x1e51('0x23')](respondWithFilteredResult(_0x4f67d3,_0x20eb9b))['catch'](handleError(_0x4f67d3,null));};exports[_0x1e51('0x44')]=function(_0x30eba9,_0x1750b3){var _0x41ca21={'raw':!![],'where':{'id':_0x30eba9[_0x1e51('0x45')]['id']}},_0xfd96a0={};_0xfd96a0[_0x1e51('0x35')]=_['keys'](db[_0x1e51('0x2a')][_0x1e51('0x2b')]);_0xfd96a0['query']=_[_0x1e51('0x30')](_0x30eba9[_0x1e51('0x2f')]);_0xfd96a0[_0x1e51('0x39')]=_['intersection'](_0xfd96a0[_0x1e51('0x35')],_0xfd96a0[_0x1e51('0x2f')]);_0x41ca21[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0xfd96a0[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x41ca21[_0x1e51('0x32')]=_0x41ca21['attributes'][_0x1e51('0x34')]?_0x41ca21[_0x1e51('0x32')]:_0xfd96a0['model'];if(_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x41ca21[_0x1e51('0x41')]=[{'all':!![]}];}_0x41ca21=_['merge']({},_0x41ca21,_0x30eba9[_0x1e51('0x3f')]);return db[_0x1e51('0x2a')][_0x1e51('0x46')](_0x41ca21)['then'](handleEntityNotFound(_0x1750b3,null))[_0x1e51('0x23')](respondWithResult(_0x1750b3,null))['catch'](handleError(_0x1750b3,null));};exports['create']=function(_0x54688b,_0x169e6c){return db[_0x1e51('0x2a')]['create'](_0x54688b['body'],{})[_0x1e51('0x23')](function(_0x7ffc42){var _0x2a43dd=_0x54688b[_0x1e51('0x47')][_0x1e51('0x24')]({'plain':!![]});if(!_0x2a43dd)throw new Error(_0x1e51('0x48'));if(_0x2a43dd['role']===_0x1e51('0x47')){var _0x48a2d0=_0x7ffc42[_0x1e51('0x24')]({'plain':!![]});var _0x43589a='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x43589a,'userProfileId':_0x2a43dd[_0x1e51('0x49')]},'raw':!![]})[_0x1e51('0x23')](function(_0x31a37a){if(_0x31a37a&&_0x31a37a['autoAssociation']===0x0){return db[_0x1e51('0x4a')][_0x1e51('0x4b')]({'name':_0x48a2d0[_0x1e51('0x27')],'resourceId':_0x48a2d0['id'],'type':_0x31a37a[_0x1e51('0x27')],'sectionId':_0x31a37a['id']},{})[_0x1e51('0x23')](function(){return _0x7ffc42;});}else{return _0x7ffc42;}})[_0x1e51('0x4c')](function(_0x32fe1f){logger[_0x1e51('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32fe1f);throw _0x32fe1f;});}return _0x7ffc42;})[_0x1e51('0x23')](respondWithResult(_0x169e6c,0xc9))[_0x1e51('0x4c')](handleError(_0x169e6c,null));};exports[_0x1e51('0x22')]=function(_0x213edb,_0x177b63){if(_0x213edb[_0x1e51('0x4d')]['id']){delete _0x213edb['body']['id'];}return db[_0x1e51('0x2a')]['find']({'where':{'id':_0x213edb['params']['id']}})['then'](handleEntityNotFound(_0x177b63,null))[_0x1e51('0x23')](saveUpdates(_0x213edb[_0x1e51('0x4d')],null))[_0x1e51('0x23')](respondWithResult(_0x177b63,null))['catch'](handleError(_0x177b63,null));};exports[_0x1e51('0x4e')]=function(_0x133576,_0x36c981){return db['ContactItemType'][_0x1e51('0x46')]({'where':{'id':_0x133576[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x36c981,null))['then'](db[_0x1e51('0x4f')][_0x1e51('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x133576[_0x1e51('0x45')]['id']}}))[_0x1e51('0x23')](removeEntity(_0x36c981,null))[_0x1e51('0x4c')](handleError(_0x36c981,null));}; \ No newline at end of file +var _0x3d04=['nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','ContactItemTypes','end','error','stack','name','send','map','ContactItemType','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x256fee,_0x57b509){var _0x52c53f=function(_0x46d68c){while(--_0x46d68c){_0x256fee['push'](_0x256fee['shift']());}};_0x52c53f(++_0x57b509);}(_0x3d04,0xbe));var _0x43d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d04[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x43d0('0x0'));var rimraf=require(_0x43d0('0x1'));var zipdir=require(_0x43d0('0x2'));var jsonpatch=require(_0x43d0('0x3'));var rp=require(_0x43d0('0x4'));var moment=require(_0x43d0('0x5'));var BPromise=require(_0x43d0('0x6'));var Mustache=require(_0x43d0('0x7'));var util=require('util');var path=require(_0x43d0('0x8'));var sox=require(_0x43d0('0x9'));var csv=require(_0x43d0('0xa'));var ejs=require(_0x43d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43d0('0xc'));var deskjs=require(_0x43d0('0xd'));var toCsv=require(_0x43d0('0xa'));var querystring=require(_0x43d0('0xe'));var Papa=require(_0x43d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43d0('0x11'))(_0x43d0('0x12'));var utils=require(_0x43d0('0x13'));var config=require(_0x43d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x43d0('0x15'))['db'];function respondWithStatusCode(_0x23daaa,_0x546b23){_0x546b23=_0x546b23||0xcc;return function(_0x29773b){if(_0x29773b){return _0x23daaa[_0x43d0('0x16')](_0x546b23);}return _0x23daaa[_0x43d0('0x17')](_0x546b23)['end']();};}function respondWithResult(_0xd262a8,_0x2454fa){_0x2454fa=_0x2454fa||0xc8;return function(_0x436130){if(_0x436130){return _0xd262a8['status'](_0x2454fa)[_0x43d0('0x18')](_0x436130);}};}function respondWithFilteredResult(_0x357f87,_0x44e6ec){return function(_0x1218b5){if(_0x1218b5){var _0x91b4a1=typeof _0x44e6ec['offset']==='undefined'&&typeof _0x44e6ec[_0x43d0('0x19')]===_0x43d0('0x1a');var _0x35decf=_0x1218b5['count'];var _0x2c641e=_0x91b4a1?0x0:_0x44e6ec['offset'];var _0x2c9d06=_0x91b4a1?_0x1218b5[_0x43d0('0x1b')]:_0x44e6ec[_0x43d0('0x1c')]+_0x44e6ec['limit'];var _0x3d7dcc;if(_0x2c9d06>=_0x35decf){_0x2c9d06=_0x35decf;_0x3d7dcc=0xc8;}else{_0x3d7dcc=0xce;}_0x357f87[_0x43d0('0x17')](_0x3d7dcc);return _0x357f87['set'](_0x43d0('0x1d'),_0x2c641e+'-'+_0x2c9d06+'/'+_0x35decf)[_0x43d0('0x18')](_0x1218b5);}return null;};}function patchUpdates(_0x348429){return function(_0x248622){try{jsonpatch[_0x43d0('0x1e')](_0x248622,_0x348429,!![]);}catch(_0x28381b){return BPromise[_0x43d0('0x1f')](_0x28381b);}return _0x248622[_0x43d0('0x20')]();};}function saveUpdates(_0x30febc,_0xc8a644){return function(_0xec5f07){if(_0xec5f07){return _0xec5f07[_0x43d0('0x21')](_0x30febc)[_0x43d0('0x22')](function(_0xbc72e6){return _0xbc72e6;});}return null;};}function removeEntity(_0x2efd77,_0x48aa18){return function(_0x2c7b24){if(_0x2c7b24){return _0x2c7b24[_0x43d0('0x23')]()['then'](function(){var _0x1fe708=_0x2c7b24['get']({'plain':!![]});var _0x29c111=_0x43d0('0x24');return db['UserProfileResource'][_0x43d0('0x23')]({'where':{'type':_0x29c111,'resourceId':_0x1fe708['id']}})[_0x43d0('0x22')](function(){return _0x2c7b24;});})['then'](function(){_0x2efd77[_0x43d0('0x17')](0xcc)[_0x43d0('0x25')]();});}};}function handleEntityNotFound(_0x22ae3c,_0x5f16ac){return function(_0x447725){if(!_0x447725){_0x22ae3c[_0x43d0('0x16')](0x194);}return _0x447725;};}function handleError(_0x2c4f3f,_0x1eb771){_0x1eb771=_0x1eb771||0x1f4;return function(_0x37d78f){logger[_0x43d0('0x26')](_0x37d78f[_0x43d0('0x27')]);if(_0x37d78f['name']){delete _0x37d78f[_0x43d0('0x28')];}_0x2c4f3f[_0x43d0('0x17')](_0x1eb771)[_0x43d0('0x29')](_0x37d78f);};}exports['index']=function(_0x4bfce9,_0x52c37b){var _0x3c1ea3={},_0x2db9dc={},_0x10086b={'count':0x0,'rows':[]};var _0x13e3c9=_[_0x43d0('0x2a')](db[_0x43d0('0x2b')]['rawAttributes'],function(_0x77654d){return{'name':_0x77654d[_0x43d0('0x2c')],'type':_0x77654d[_0x43d0('0x2d')][_0x43d0('0x2e')]};});_0x2db9dc[_0x43d0('0x2f')]=_[_0x43d0('0x2a')](_0x13e3c9,_0x43d0('0x28'));_0x2db9dc[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x4bfce9[_0x43d0('0x30')]);_0x2db9dc[_0x43d0('0x32')]=_['intersection'](_0x2db9dc[_0x43d0('0x2f')],_0x2db9dc[_0x43d0('0x30')]);_0x3c1ea3[_0x43d0('0x33')]=_[_0x43d0('0x34')](_0x2db9dc['model'],qs[_0x43d0('0x35')](_0x4bfce9['query'][_0x43d0('0x35')]));_0x3c1ea3[_0x43d0('0x33')]=_0x3c1ea3['attributes'][_0x43d0('0x36')]?_0x3c1ea3[_0x43d0('0x33')]:_0x2db9dc[_0x43d0('0x2f')];if(!_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x37')](_0x43d0('0x38'))){_0x3c1ea3[_0x43d0('0x19')]=qs[_0x43d0('0x19')](_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x19')]);_0x3c1ea3[_0x43d0('0x1c')]=qs['offset'](_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x1c')]);}_0x3c1ea3[_0x43d0('0x39')]=qs[_0x43d0('0x3a')](_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x3a')]);_0x3c1ea3[_0x43d0('0x3b')]=qs[_0x43d0('0x32')](_[_0x43d0('0x3c')](_0x4bfce9[_0x43d0('0x30')],_0x2db9dc[_0x43d0('0x32')]),_0x13e3c9);if(_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x3d')]){_0x3c1ea3[_0x43d0('0x3b')]=_['merge'](_0x3c1ea3[_0x43d0('0x3b')],{'$or':_[_0x43d0('0x2a')](_0x13e3c9,function(_0x38f330){if(_0x38f330[_0x43d0('0x2d')]!==_0x43d0('0x3e')){var _0x1e6c8b={};_0x1e6c8b[_0x38f330[_0x43d0('0x28')]]={'$like':'%'+_0x4bfce9[_0x43d0('0x30')]['filter']+'%'};return _0x1e6c8b;}})});}_0x3c1ea3=_['merge']({},_0x3c1ea3,_0x4bfce9[_0x43d0('0x3f')]);var _0x5ad2d0={'where':_0x3c1ea3['where']};return db[_0x43d0('0x2b')]['count'](_0x5ad2d0)[_0x43d0('0x22')](function(_0x5027d0){_0x10086b[_0x43d0('0x1b')]=_0x5027d0;if(_0x4bfce9['query'][_0x43d0('0x40')]){_0x3c1ea3[_0x43d0('0x41')]=[{'all':!![]}];}return db[_0x43d0('0x2b')]['findAll'](_0x3c1ea3);})[_0x43d0('0x22')](function(_0x520406){_0x10086b[_0x43d0('0x42')]=_0x520406;return _0x10086b;})['then'](respondWithFilteredResult(_0x52c37b,_0x3c1ea3))['catch'](handleError(_0x52c37b,null));};exports[_0x43d0('0x43')]=function(_0xcb5a02,_0x4d539f){var _0x2f2ac9={'raw':!![],'where':{'id':_0xcb5a02[_0x43d0('0x44')]['id']}},_0x1c87bc={};_0x1c87bc[_0x43d0('0x2f')]=_[_0x43d0('0x31')](db['ContactItemType'][_0x43d0('0x45')]);_0x1c87bc[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0xcb5a02[_0x43d0('0x30')]);_0x1c87bc['filters']=_[_0x43d0('0x34')](_0x1c87bc[_0x43d0('0x2f')],_0x1c87bc[_0x43d0('0x30')]);_0x2f2ac9[_0x43d0('0x33')]=_[_0x43d0('0x34')](_0x1c87bc['model'],qs[_0x43d0('0x35')](_0xcb5a02[_0x43d0('0x30')]['fields']));_0x2f2ac9[_0x43d0('0x33')]=_0x2f2ac9[_0x43d0('0x33')][_0x43d0('0x36')]?_0x2f2ac9['attributes']:_0x1c87bc[_0x43d0('0x2f')];if(_0xcb5a02['query'][_0x43d0('0x40')]){_0x2f2ac9['include']=[{'all':!![]}];}_0x2f2ac9=_[_0x43d0('0x46')]({},_0x2f2ac9,_0xcb5a02[_0x43d0('0x3f')]);return db[_0x43d0('0x2b')][_0x43d0('0x47')](_0x2f2ac9)[_0x43d0('0x22')](handleEntityNotFound(_0x4d539f,null))['then'](respondWithResult(_0x4d539f,null))[_0x43d0('0x48')](handleError(_0x4d539f,null));};exports['create']=function(_0x5a6364,_0x3e7392){return db[_0x43d0('0x2b')][_0x43d0('0x49')](_0x5a6364[_0x43d0('0x4a')],{})[_0x43d0('0x22')](function(_0x3685cf){var _0x36c9d0=_0x5a6364[_0x43d0('0x4b')][_0x43d0('0x4c')]({'plain':!![]});if(!_0x36c9d0)throw new Error(_0x43d0('0x4d'));if(_0x36c9d0[_0x43d0('0x4e')]==='user'){var _0x338203=_0x3685cf[_0x43d0('0x4c')]({'plain':!![]});var _0x1503bc='ContactItemTypes';return db[_0x43d0('0x4f')]['find']({'where':{'name':_0x1503bc,'userProfileId':_0x36c9d0['userProfileId']},'raw':!![]})[_0x43d0('0x22')](function(_0x29a14a){if(_0x29a14a&&_0x29a14a[_0x43d0('0x50')]===0x0){return db[_0x43d0('0x51')][_0x43d0('0x49')]({'name':_0x338203['name'],'resourceId':_0x338203['id'],'type':_0x29a14a['name'],'sectionId':_0x29a14a['id']},{})[_0x43d0('0x22')](function(){return _0x3685cf;});}else{return _0x3685cf;}})['catch'](function(_0x32aab0){logger[_0x43d0('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32aab0);throw _0x32aab0;});}return _0x3685cf;})['then'](respondWithResult(_0x3e7392,0xc9))['catch'](handleError(_0x3e7392,null));};exports[_0x43d0('0x21')]=function(_0x126863,_0x3d89d4){if(_0x126863[_0x43d0('0x4a')]['id']){delete _0x126863[_0x43d0('0x4a')]['id'];}return db[_0x43d0('0x2b')][_0x43d0('0x47')]({'where':{'id':_0x126863[_0x43d0('0x44')]['id']}})[_0x43d0('0x22')](handleEntityNotFound(_0x3d89d4,null))['then'](saveUpdates(_0x126863[_0x43d0('0x4a')],null))[_0x43d0('0x22')](respondWithResult(_0x3d89d4,null))[_0x43d0('0x48')](handleError(_0x3d89d4,null));};exports[_0x43d0('0x23')]=function(_0x44feea,_0x5e341f){return db[_0x43d0('0x2b')][_0x43d0('0x47')]({'where':{'id':_0x44feea[_0x43d0('0x44')]['id']}})[_0x43d0('0x22')](handleEntityNotFound(_0x5e341f,null))['then'](db['CmContactHasItem'][_0x43d0('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x44feea[_0x43d0('0x44')]['id']}}))[_0x43d0('0x22')](removeEntity(_0x5e341f,null))[_0x43d0('0x48')](handleError(_0x5e341f,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 7f70c07..24ae513 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 _0x58b4=['tools_contact_item_types','lodash','util','api','moment','request-promise','path','../../config/environment','./contactItemType.attributes','exports','define'];(function(_0x4aa4af,_0x210cde){var _0x3bf44a=function(_0x4a8126){while(--_0x4a8126){_0x4aa4af['push'](_0x4aa4af['shift']());}};_0x3bf44a(++_0x210cde);}(_0x58b4,0x177));var _0x458b=function(_0x5c5373,_0x43adb6){_0x5c5373=_0x5c5373-0x0;var _0x463a1f=_0x58b4[_0x5c5373];return _0x463a1f;};'use strict';var _=require(_0x458b('0x0'));var util=require(_0x458b('0x1'));var logger=require('../../config/logger')(_0x458b('0x2'));var moment=require(_0x458b('0x3'));var BPromise=require('bluebird');var rp=require(_0x458b('0x4'));var fs=require('fs');var path=require(_0x458b('0x5'));var rimraf=require('rimraf');var config=require(_0x458b('0x6'));var attributes=require(_0x458b('0x7'));module[_0x458b('0x8')]=function(_0x1bae9a,_0x38f780){return _0x1bae9a[_0x458b('0x9')]('ContactItemType',attributes,{'tableName':_0x458b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf92f=['util','../../config/logger','bluebird','path','../../config/environment','exports','ContactItemType','tools_contact_item_types'];(function(_0x19b23a,_0x5e6cea){var _0x4a4c52=function(_0x67636d){while(--_0x67636d){_0x19b23a['push'](_0x19b23a['shift']());}};_0x4a4c52(++_0x5e6cea);}(_0xf92f,0x1f0));var _0xff92=function(_0x538478,_0xcc0e64){_0x538478=_0x538478-0x0;var _0x349fae=_0xf92f[_0x538478];return _0x349fae;};'use strict';var _=require('lodash');var util=require(_0xff92('0x0'));var logger=require(_0xff92('0x1'))('api');var moment=require('moment');var BPromise=require(_0xff92('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff92('0x3'));var rimraf=require('rimraf');var config=require(_0xff92('0x4'));var attributes=require('./contactItemType.attributes');module[_0xff92('0x5')]=function(_0x2db7fe,_0x2f9724){return _0x2db7fe['define'](_0xff92('0x6'),attributes,{'tableName':_0xff92('0x7'),'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 f73d340..7d8edf9 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 _0x34a5=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x34a5,0x15a));var _0x534a=function(_0x37e43c,_0x17ff37){_0x37e43c=_0x37e43c-0x0;var _0x119134=_0x34a5[_0x37e43c];return _0x119134;};'use strict';var _=require('lodash');var util=require(_0x534a('0x0'));var moment=require(_0x534a('0x1'));var BPromise=require(_0x534a('0x2'));var rs=require(_0x534a('0x3'));var fs=require('fs');var Redis=require(_0x534a('0x4'));var db=require(_0x534a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x534a('0x6'))(_0x534a('0x7'));var config=require(_0x534a('0x8'));var jayson=require(_0x534a('0x9'));var client=jayson[_0x534a('0xa')][_0x534a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29ec9a,_0x2912d9,_0x3a95a9){return new BPromise(function(_0x1407fa,_0x4b7d02){return client[_0x534a('0xc')](_0x29ec9a,_0x3a95a9)[_0x534a('0xd')](function(_0xbd3dc1){logger['info'](_0x534a('0xe'),_0x2912d9,_0x534a('0xf'));logger[_0x534a('0x10')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x2912d9,_0x534a('0xf'),JSON['stringify'](_0xbd3dc1));if(_0xbd3dc1['error']){if(_0xbd3dc1[_0x534a('0x11')][_0x534a('0x12')]===0x1f4){logger[_0x534a('0x11')](_0x534a('0xe'),_0x2912d9,_0xbd3dc1[_0x534a('0x11')][_0x534a('0x13')]);return _0x4b7d02(_0xbd3dc1[_0x534a('0x11')]['message']);}logger[_0x534a('0x11')](_0x534a('0xe'),_0x2912d9,_0xbd3dc1[_0x534a('0x11')][_0x534a('0x13')]);return _0x1407fa(_0xbd3dc1[_0x534a('0x11')][_0x534a('0x13')]);}else{logger[_0x534a('0x14')](_0x534a('0xe'),_0x2912d9,_0x534a('0xf'));_0x1407fa(_0xbd3dc1['result'][_0x534a('0x13')]);}})[_0x534a('0x15')](function(_0x3e6959){logger[_0x534a('0x11')](_0x534a('0xe'),_0x2912d9,_0x3e6959);_0x4b7d02(_0x3e6959);});});} \ No newline at end of file +var _0x0cee=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x596623,_0x3930a1){var _0x5b51bf=function(_0x4759b9){while(--_0x4759b9){_0x596623['push'](_0x596623['shift']());}};_0x5b51bf(++_0x3930a1);}(_0x0cee,0x12f));var _0xe0ce=function(_0x39ecf4,_0x326b43){_0x39ecf4=_0x39ecf4-0x0;var _0x54191e=_0x0cee[_0x39ecf4];return _0x54191e;};'use strict';var _=require(_0xe0ce('0x0'));var util=require(_0xe0ce('0x1'));var moment=require(_0xe0ce('0x2'));var BPromise=require(_0xe0ce('0x3'));var rs=require(_0xe0ce('0x4'));var fs=require('fs');var Redis=require(_0xe0ce('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe0ce('0x6'))(_0xe0ce('0x7'));var config=require(_0xe0ce('0x8'));var jayson=require(_0xe0ce('0x9'));var client=jayson[_0xe0ce('0xa')][_0xe0ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x64f82c,_0x415f34,_0x494eca){return new BPromise(function(_0x27eea3,_0x2fa936){return client['request'](_0x64f82c,_0x494eca)[_0xe0ce('0xc')](function(_0x94afeb){logger[_0xe0ce('0xd')](_0xe0ce('0xe'),_0x415f34,'request\x20sent');logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x415f34,_0xe0ce('0xf'),JSON[_0xe0ce('0x10')](_0x94afeb));if(_0x94afeb[_0xe0ce('0x11')]){if(_0x94afeb[_0xe0ce('0x11')][_0xe0ce('0x12')]===0x1f4){logger[_0xe0ce('0x11')](_0xe0ce('0xe'),_0x415f34,_0x94afeb[_0xe0ce('0x11')][_0xe0ce('0x13')]);return _0x2fa936(_0x94afeb[_0xe0ce('0x11')][_0xe0ce('0x13')]);}logger[_0xe0ce('0x11')]('ContactItemType,\x20%s,\x20%s',_0x415f34,_0x94afeb['error'][_0xe0ce('0x13')]);return _0x27eea3(_0x94afeb[_0xe0ce('0x11')]['message']);}else{logger['info'](_0xe0ce('0xe'),_0x415f34,_0xe0ce('0xf'));_0x27eea3(_0x94afeb[_0xe0ce('0x14')][_0xe0ce('0x13')]);}})[_0xe0ce('0x15')](function(_0x4e82bc){logger[_0xe0ce('0x11')]('ContactItemType,\x20%s,\x20%s',_0x415f34,_0x4e82bc);_0x2fa936(_0x4e82bc);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 7dc70c5..0b33d4a 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 _0x94e5=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy'];(function(_0x2db025,_0x1cf6de){var _0x47afbe=function(_0x37840e){while(--_0x37840e){_0x2db025['push'](_0x2db025['shift']());}};_0x47afbe(++_0x1cf6de);}(_0x94e5,0xc9));var _0x594e=function(_0x18fa7a,_0x266fe5){_0x18fa7a=_0x18fa7a-0x0;var _0x1fa8ae=_0x94e5[_0x18fa7a];return _0x1fa8ae;};'use strict';var multer=require(_0x594e('0x0'));var util=require('util');var path=require(_0x594e('0x1'));var timeout=require(_0x594e('0x2'));var express=require(_0x594e('0x3'));var router=express[_0x594e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x594e('0x5'));var interaction=require(_0x594e('0x6'));var config=require(_0x594e('0x7'));var controller=require(_0x594e('0x8'));router[_0x594e('0x9')]('/',auth[_0x594e('0xa')](),controller[_0x594e('0xb')]);router[_0x594e('0x9')]('/:id',auth[_0x594e('0xa')](),controller[_0x594e('0xc')]);router[_0x594e('0xd')]('/',auth[_0x594e('0xa')](),controller[_0x594e('0xe')]);router[_0x594e('0xf')](_0x594e('0x10'),auth['isAuthenticated'](),controller[_0x594e('0x11')]);router['delete'](_0x594e('0x10'),auth[_0x594e('0xa')](),controller[_0x594e('0x12')]);module[_0x594e('0x13')]=router; \ No newline at end of file +var _0x4fc2=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','./contactItemType.controller'];(function(_0x3adfd7,_0x14bcbf){var _0x54d03e=function(_0x5ef73e){while(--_0x5ef73e){_0x3adfd7['push'](_0x3adfd7['shift']());}};_0x54d03e(++_0x14bcbf);}(_0x4fc2,0x197));var _0x24fc=function(_0xf32c6d,_0x372704){_0xf32c6d=_0xf32c6d-0x0;var _0x156c11=_0x4fc2[_0xf32c6d];return _0x156c11;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x24fc('0x6'));router[_0x24fc('0x7')]('/',auth[_0x24fc('0x8')](),controller[_0x24fc('0x9')]);router[_0x24fc('0x7')](_0x24fc('0xa'),auth[_0x24fc('0x8')](),controller[_0x24fc('0xb')]);router['post']('/',auth[_0x24fc('0x8')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xa'),auth['isAuthenticated'](),controller[_0x24fc('0xe')]);router[_0x24fc('0xf')](_0x24fc('0xa'),auth['isAuthenticated'](),controller[_0x24fc('0x10')]);module[_0x24fc('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 0735c6f..c023445 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(_0x5b790d,_0x442200){var _0x443353=function(_0x32919a){while(--_0x32919a){_0x5b790d['push'](_0x5b790d['shift']());}};_0x443353(++_0x442200);}(_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 _0xb10b=['name','sequelize','STRING'];(function(_0x371886,_0x352931){var _0x104864=function(_0x1055c2){while(--_0x1055c2){_0x371886['push'](_0x371886['shift']());}};_0x104864(++_0x352931);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c206c,_0x30bdcf){_0x1c206c=_0x1c206c-0x0;var _0x188aaa=_0xb10b[_0x1c206c];return _0x188aaa;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 5bd3906..96692bf 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 _0x7dca=['nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrs','https://','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','attrSmsAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x390d58,_0x9d4593){var _0x5ba088=function(_0x16f153){while(--_0x16f153){_0x390d58['push'](_0x390d58['shift']());}};_0x5ba088(++_0x9d4593);}(_0x7dca,0x1bc));var _0xa7dc=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x7dca[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xa7dc('0x0'));var rimraf=require(_0xa7dc('0x1'));var zipdir=require(_0xa7dc('0x2'));var jsonpatch=require(_0xa7dc('0x3'));var rp=require(_0xa7dc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa7dc('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa7dc('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa7dc('0x7'));var _=require(_0xa7dc('0x8'));var squel=require(_0xa7dc('0x9'));var crypto=require(_0xa7dc('0xa'));var jsforce=require(_0xa7dc('0xb'));var deskjs=require(_0xa7dc('0xc'));var toCsv=require(_0xa7dc('0xd'));var querystring=require(_0xa7dc('0xe'));var Papa=require(_0xa7dc('0xf'));var Redis=require(_0xa7dc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa7dc('0x11'));var as=require(_0xa7dc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7dc('0x13'))(_0xa7dc('0x14'));var utils=require('../../config/utils');var config=require(_0xa7dc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7dc('0x16'))['db'];config[_0xa7dc('0x17')]=_[_0xa7dc('0x18')](config[_0xa7dc('0x17')],{'host':_0xa7dc('0x19'),'port':0x18eb});var socket=require(_0xa7dc('0x1a'))(new Redis(config[_0xa7dc('0x17')]));require('./dashboard.socket')[_0xa7dc('0x1b')](socket);function respondWithStatusCode(_0x32111b,_0x54b664){_0x54b664=_0x54b664||0xcc;return function(_0x1dcdec){if(_0x1dcdec){return _0x32111b[_0xa7dc('0x1c')](_0x54b664);}return _0x32111b[_0xa7dc('0x1d')](_0x54b664)[_0xa7dc('0x1e')]();};}function respondWithResult(_0x50f465,_0x13feb2){_0x13feb2=_0x13feb2||0xc8;return function(_0x42767b){if(_0x42767b){return _0x50f465[_0xa7dc('0x1d')](_0x13feb2)[_0xa7dc('0x1f')](_0x42767b);}};}function respondWithFilteredResult(_0x39dd04,_0x57a0ba){return function(_0x29438a){if(_0x29438a){var _0x5ba225=typeof _0x57a0ba[_0xa7dc('0x20')]==='undefined'&&typeof _0x57a0ba['limit']===_0xa7dc('0x21');var _0x177e0e=_0x29438a[_0xa7dc('0x22')];var _0x2f12e7=_0x5ba225?0x0:_0x57a0ba[_0xa7dc('0x20')];var _0x3765d1=_0x5ba225?_0x29438a[_0xa7dc('0x22')]:_0x57a0ba[_0xa7dc('0x20')]+_0x57a0ba['limit'];var _0x5cc07c;if(_0x3765d1>=_0x177e0e){_0x3765d1=_0x177e0e;_0x5cc07c=0xc8;}else{_0x5cc07c=0xce;}_0x39dd04[_0xa7dc('0x1d')](_0x5cc07c);return _0x39dd04[_0xa7dc('0x23')](_0xa7dc('0x24'),_0x2f12e7+'-'+_0x3765d1+'/'+_0x177e0e)['json'](_0x29438a);}return null;};}function patchUpdates(_0x117608){return function(_0x2f27b7){try{jsonpatch['apply'](_0x2f27b7,_0x117608,!![]);}catch(_0x21a3d6){return BPromise['reject'](_0x21a3d6);}return _0x2f27b7[_0xa7dc('0x25')]();};}function saveUpdates(_0x19e668,_0x3d80c6){return function(_0x5152e9){if(_0x5152e9){return _0x5152e9[_0xa7dc('0x26')](_0x19e668)[_0xa7dc('0x27')](function(_0x5f51e2){return _0x5f51e2;});}return null;};}function removeEntity(_0x4c807a,_0x30d87a){return function(_0x5dda3e){if(_0x5dda3e){return _0x5dda3e[_0xa7dc('0x28')]()['then'](function(){var _0xf9ff62=_0x5dda3e[_0xa7dc('0x29')]({'plain':!![]});var _0xdb2fe4=_0xa7dc('0x2a');return db[_0xa7dc('0x2b')][_0xa7dc('0x28')]({'where':{'type':_0xdb2fe4,'resourceId':_0xf9ff62['id']}})[_0xa7dc('0x27')](function(){return _0x5dda3e;});})[_0xa7dc('0x27')](function(){_0x4c807a['status'](0xcc)[_0xa7dc('0x1e')]();});}};}function handleEntityNotFound(_0xf7954e,_0x5ed138){return function(_0x1b62b2){if(!_0x1b62b2){_0xf7954e[_0xa7dc('0x1c')](0x194);}return _0x1b62b2;};}function handleError(_0x440b88,_0x50b482){_0x50b482=_0x50b482||0x1f4;return function(_0x39f437){logger[_0xa7dc('0x2c')](_0x39f437['stack']);if(_0x39f437[_0xa7dc('0x2d')]){delete _0x39f437[_0xa7dc('0x2d')];}_0x440b88['status'](_0x50b482)[_0xa7dc('0x2e')](_0x39f437);};}exports[_0xa7dc('0x2f')]=function(_0x36e445,_0x5af396){var _0x53eea5={},_0x50f7d2={},_0x35957e={'count':0x0,'rows':[]};var _0x5ed6df=_[_0xa7dc('0x30')](db[_0xa7dc('0x31')][_0xa7dc('0x32')],function(_0x3867ea){return{'name':_0x3867ea[_0xa7dc('0x33')],'type':_0x3867ea['type']['key']};});_0x50f7d2[_0xa7dc('0x34')]=_[_0xa7dc('0x30')](_0x5ed6df,_0xa7dc('0x2d'));_0x50f7d2['query']=_['keys'](_0x36e445[_0xa7dc('0x35')]);_0x50f7d2[_0xa7dc('0x36')]=_[_0xa7dc('0x37')](_0x50f7d2[_0xa7dc('0x34')],_0x50f7d2['query']);_0x53eea5[_0xa7dc('0x38')]=_['intersection'](_0x50f7d2[_0xa7dc('0x34')],qs[_0xa7dc('0x39')](_0x36e445[_0xa7dc('0x35')]['fields']));_0x53eea5[_0xa7dc('0x38')]=_0x53eea5[_0xa7dc('0x38')][_0xa7dc('0x3a')]?_0x53eea5['attributes']:_0x50f7d2[_0xa7dc('0x34')];if(!_0x36e445['query'][_0xa7dc('0x3b')](_0xa7dc('0x3c'))){_0x53eea5['limit']=qs[_0xa7dc('0x3d')](_0x36e445[_0xa7dc('0x35')][_0xa7dc('0x3d')]);_0x53eea5[_0xa7dc('0x20')]=qs['offset'](_0x36e445[_0xa7dc('0x35')][_0xa7dc('0x20')]);}_0x53eea5[_0xa7dc('0x3e')]=qs[_0xa7dc('0x3f')](_0x36e445[_0xa7dc('0x35')]['sort']);_0x53eea5[_0xa7dc('0x40')]=qs[_0xa7dc('0x36')](_['pick'](_0x36e445['query'],_0x50f7d2['filters']),_0x5ed6df);if(_0x36e445[_0xa7dc('0x35')][_0xa7dc('0x41')]){_0x53eea5[_0xa7dc('0x40')]=_[_0xa7dc('0x42')](_0x53eea5['where'],{'$or':_[_0xa7dc('0x30')](_0x5ed6df,function(_0x519ac3){if(_0x519ac3[_0xa7dc('0x43')]!==_0xa7dc('0x44')){var _0x34e3b4={};_0x34e3b4[_0x519ac3[_0xa7dc('0x2d')]]={'$like':'%'+_0x36e445[_0xa7dc('0x35')][_0xa7dc('0x41')]+'%'};return _0x34e3b4;}})});}_0x53eea5=_[_0xa7dc('0x42')]({},_0x53eea5,_0x36e445[_0xa7dc('0x45')]);var _0x48e554={'where':_0x53eea5[_0xa7dc('0x40')]};return db[_0xa7dc('0x31')][_0xa7dc('0x22')](_0x48e554)['then'](function(_0x462fcc){_0x35957e['count']=_0x462fcc;if(_0x36e445[_0xa7dc('0x35')][_0xa7dc('0x46')]){_0x53eea5[_0xa7dc('0x47')]=[{'all':!![]}];}return db['Dashboard'][_0xa7dc('0x48')](_0x53eea5);})[_0xa7dc('0x27')](function(_0x4e9672){_0x35957e['rows']=_0x4e9672;return _0x35957e;})['then'](respondWithFilteredResult(_0x5af396,_0x53eea5))[_0xa7dc('0x49')](handleError(_0x5af396,null));};exports['show']=function(_0x2daf66,_0x7debc3){var _0x4d4221={'raw':![],'where':{'id':_0x2daf66[_0xa7dc('0x4a')]['id']}},_0x49159a={};_0x49159a[_0xa7dc('0x34')]=_['keys'](db[_0xa7dc('0x31')][_0xa7dc('0x32')]);_0x49159a['query']=_[_0xa7dc('0x4b')](_0x2daf66[_0xa7dc('0x35')]);_0x49159a[_0xa7dc('0x36')]=_[_0xa7dc('0x37')](_0x49159a['model'],_0x49159a['query']);_0x4d4221[_0xa7dc('0x38')]=_[_0xa7dc('0x37')](_0x49159a[_0xa7dc('0x34')],qs[_0xa7dc('0x39')](_0x2daf66[_0xa7dc('0x35')][_0xa7dc('0x39')]));_0x4d4221['attributes']=_0x4d4221[_0xa7dc('0x38')]['length']?_0x4d4221[_0xa7dc('0x38')]:_0x49159a['model'];if(_0x2daf66['query'][_0xa7dc('0x46')]){_0x4d4221[_0xa7dc('0x47')]=[{'all':!![]}];}_0x4d4221=_['merge']({},_0x4d4221,_0x2daf66['options']);return db[_0xa7dc('0x31')][_0xa7dc('0x4c')](_0x4d4221)[_0xa7dc('0x27')](handleEntityNotFound(_0x7debc3,null))['then'](respondWithResult(_0x7debc3,null))['catch'](handleError(_0x7debc3,null));};exports[_0xa7dc('0x4d')]=function(_0x2e0bc6,_0x42b87b){return db['Dashboard'][_0xa7dc('0x4d')](_0x2e0bc6[_0xa7dc('0x4e')],{})[_0xa7dc('0x27')](function(_0x500159){var _0x419cd7=_0x2e0bc6[_0xa7dc('0x4f')][_0xa7dc('0x29')]({'plain':!![]});if(!_0x419cd7)throw new Error(_0xa7dc('0x50'));if(_0x419cd7['role']===_0xa7dc('0x4f')){var _0x7d56c0=_0x500159[_0xa7dc('0x29')]({'plain':!![]});var _0x3e36de='CustomDashboards';return db[_0xa7dc('0x51')][_0xa7dc('0x4c')]({'where':{'name':_0x3e36de,'userProfileId':_0x419cd7[_0xa7dc('0x52')]},'raw':!![]})['then'](function(_0x44472f){if(_0x44472f&&_0x44472f[_0xa7dc('0x53')]===0x0){return db[_0xa7dc('0x2b')][_0xa7dc('0x4d')]({'name':_0x7d56c0[_0xa7dc('0x2d')],'resourceId':_0x7d56c0['id'],'type':_0x44472f[_0xa7dc('0x2d')],'sectionId':_0x44472f['id']},{})['then'](function(){return _0x500159;});}else{return _0x500159;}})[_0xa7dc('0x49')](function(_0x5c071d){logger[_0xa7dc('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c071d);throw _0x5c071d;});}return _0x500159;})[_0xa7dc('0x27')](respondWithResult(_0x42b87b,0xc9))['catch'](handleError(_0x42b87b,null));};exports[_0xa7dc('0x54')]=function(_0x1e9671,_0x415329){var _0x185717={'where':{'id':_0x1e9671['params']['id']}},_0x4bb52b={};_0x4bb52b[_0xa7dc('0x34')]=_[_0xa7dc('0x4b')](db[_0xa7dc('0x31')]['rawAttributes']);_0x185717[_0xa7dc('0x38')]=_[_0xa7dc('0x37')](_0x4bb52b[_0xa7dc('0x34')],qs[_0xa7dc('0x39')](_0x1e9671[_0xa7dc('0x35')][_0xa7dc('0x39')]));_0x185717[_0xa7dc('0x38')]=_0x185717[_0xa7dc('0x38')][_0xa7dc('0x3a')]?_0x185717['attributes']:_0x4bb52b[_0xa7dc('0x34')];if(_0x1e9671['query'][_0xa7dc('0x46')]){_0x185717[_0xa7dc('0x47')]=[{'all':!![]}];}_0x185717=_[_0xa7dc('0x42')]({},_0x185717,_0x1e9671[_0xa7dc('0x45')]);return db[_0xa7dc('0x31')][_0xa7dc('0x4c')](_0x185717)[_0xa7dc('0x27')](handleEntityNotFound(_0x415329,null))[_0xa7dc('0x27')](function(_0x4577f8){if(_0x4577f8){var _0x3cf00b=_0x4577f8[_0xa7dc('0x29')]({'plain':!![]});_0x3cf00b=qs[_0xa7dc('0x55')](_0x3cf00b,['id',_0xa7dc('0x56'),_0xa7dc('0x57')]);_0x1e9671['body']=_['omit'](_0x1e9671[_0xa7dc('0x4e')],['id',_0xa7dc('0x56'),'updatedAt']);return db['Dashboard'][_0xa7dc('0x4d')](_[_0xa7dc('0x42')](_0x3cf00b,_0x1e9671[_0xa7dc('0x4e')]),{'include':_0x1e9671[_0xa7dc('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x448c9e){var _0x53b076=_0x1e9671[_0xa7dc('0x4f')][_0xa7dc('0x29')]({'plain':!![]});if(!_0x53b076)throw new Error(_0xa7dc('0x50'));if(_0x53b076['role']===_0xa7dc('0x4f')){var _0x2a71db=_0x448c9e['get']({'plain':!![]});var _0x2446c1=_0xa7dc('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x2446c1,'userProfileId':_0x53b076[_0xa7dc('0x52')]},'raw':!![]})['then'](function(_0x264427){if(_0x264427&&_0x264427[_0xa7dc('0x53')]===0x0){return db[_0xa7dc('0x2b')][_0xa7dc('0x4d')]({'name':_0x2a71db['name'],'resourceId':_0x2a71db['id'],'type':_0x264427[_0xa7dc('0x2d')],'sectionId':_0x264427['id']},{})[_0xa7dc('0x27')](function(){return _0x448c9e;});}else{return _0x448c9e;}})[_0xa7dc('0x49')](function(_0x42fc91){logger[_0xa7dc('0x2c')](_0xa7dc('0x58'),_0x42fc91);throw _0x42fc91;});}return _0x448c9e;});}})[_0xa7dc('0x27')](respondWithResult(_0x415329,0xc9))['catch'](handleError(_0x415329,null));};exports[_0xa7dc('0x26')]=function(_0x24f4a7,_0x4ff7c7){if(_0x24f4a7[_0xa7dc('0x4e')]['id']){delete _0x24f4a7[_0xa7dc('0x4e')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x24f4a7[_0xa7dc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ff7c7,null))[_0xa7dc('0x27')](saveUpdates(_0x24f4a7[_0xa7dc('0x4e')],null))[_0xa7dc('0x27')](respondWithResult(_0x4ff7c7,null))[_0xa7dc('0x49')](handleError(_0x4ff7c7,null));};exports[_0xa7dc('0x28')]=function(_0x5dfa80,_0x252877){return db[_0xa7dc('0x31')]['find']({'where':{'id':_0x5dfa80['params']['id']}})[_0xa7dc('0x27')](handleEntityNotFound(_0x252877,null))[_0xa7dc('0x27')](removeEntity(_0x252877,null))[_0xa7dc('0x49')](handleError(_0x252877,null));};function widgetAttributes(_0x1942b1){try{switch(_0x1942b1[_0xa7dc('0x43')]){case _0xa7dc('0x59'):return[{'name':'attrUrl','value':_0x1942b1['attrUrl']||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x0]?_0x1942b1[_0xa7dc('0x5a')][0x0]['value']:undefined)||_0xa7dc('0x5b')}];case'custom':return[{'name':_0xa7dc('0x5c'),'value':_0x1942b1['attrPath']||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x0]?_0x1942b1['attrs'][0x0][_0xa7dc('0x5d')]:undefined)||''}];case'clock':return[{'name':_0xa7dc('0x5e'),'value':_0x1942b1[_0xa7dc('0x5e')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x0]?_0x1942b1[_0xa7dc('0x5a')][0x0][_0xa7dc('0x5d')]:undefined)||_0xa7dc('0x5f')},{'name':_0xa7dc('0x60'),'value':_0x1942b1[_0xa7dc('0x60')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x1]?_0x1942b1[_0xa7dc('0x5a')][0x1][_0xa7dc('0x5d')]:undefined)||_0xa7dc('0x61')},{'name':_0xa7dc('0x62'),'value':_0x1942b1['attrFontSize']||(_0x1942b1['attrs']&&_0x1942b1[_0xa7dc('0x5a')][0x2]?_0x1942b1['attrs'][0x2][_0xa7dc('0x5d')]:undefined)||0xc}];case _0xa7dc('0x63'):return[{'name':_0xa7dc('0x64'),'value':_0x1942b1[_0xa7dc('0x64')]||(_0x1942b1['attrs']&&_0x1942b1[_0xa7dc('0x5a')][0x0]?_0x1942b1[_0xa7dc('0x5a')][0x0][_0xa7dc('0x5d')]:undefined)||'total'},{'name':_0xa7dc('0x65'),'value':_0x1942b1[_0xa7dc('0x65')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x1]?_0x1942b1[_0xa7dc('0x5a')][0x1][_0xa7dc('0x5d')]:undefined)||[]},{'name':'attrFontSize','value':_0x1942b1[_0xa7dc('0x62')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x2]?_0x1942b1[_0xa7dc('0x5a')][0x2][_0xa7dc('0x5d')]:undefined)||0x14},{'name':_0xa7dc('0x66'),'value':_0x1942b1[_0xa7dc('0x66')]||(_0x1942b1['attrs']&&_0x1942b1[_0xa7dc('0x5a')][0x3]?_0x1942b1['attrs'][0x3][_0xa7dc('0x5d')]:undefined)||'voice'},{'name':_0xa7dc('0x67'),'value':_0x1942b1[_0xa7dc('0x67')]||(_0x1942b1['attrs']&&_0x1942b1['attrs'][0x4]?_0x1942b1['attrs'][0x4][_0xa7dc('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1942b1[_0xa7dc('0x68')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x5]?_0x1942b1[_0xa7dc('0x5a')][0x5][_0xa7dc('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1942b1['attrSmsAccounts']||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1['attrs'][0x6]?_0x1942b1[_0xa7dc('0x5a')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1942b1[_0xa7dc('0x69')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x7]?_0x1942b1[_0xa7dc('0x5a')][0x7][_0xa7dc('0x5d')]:undefined)||''},{'name':_0xa7dc('0x6a'),'value':_0x1942b1[_0xa7dc('0x6a')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1['attrs'][0x8]?_0x1942b1[_0xa7dc('0x5a')][0x8][_0xa7dc('0x5d')]:undefined)||''},{'name':_0xa7dc('0x6b'),'value':_0x1942b1[_0xa7dc('0x6b')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x9]?_0x1942b1[_0xa7dc('0x5a')][0x9][_0xa7dc('0x5d')]:undefined)||''}];case _0xa7dc('0x6c'):case _0xa7dc('0x6d'):return[{'name':_0xa7dc('0x6e'),'value':_0x1942b1[_0xa7dc('0x6e')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x0]?_0x1942b1[_0xa7dc('0x5a')][0x0][_0xa7dc('0x5d')]:undefined)||_0xa7dc('0x6f')},{'name':'attrSerie2','value':_0x1942b1[_0xa7dc('0x70')]||(_0x1942b1['attrs']&&_0x1942b1[_0xa7dc('0x5a')][0x1]?_0x1942b1[_0xa7dc('0x5a')][0x1][_0xa7dc('0x5d')]:undefined)||null},{'name':_0xa7dc('0x71'),'value':_0x1942b1[_0xa7dc('0x71')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x2]?_0x1942b1[_0xa7dc('0x5a')][0x2]['value']:undefined)||null},{'name':_0xa7dc('0x65'),'value':_0x1942b1[_0xa7dc('0x65')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1['attrs'][0x3]?_0x1942b1[_0xa7dc('0x5a')][0x3][_0xa7dc('0x5d')]:undefined)||[]},{'name':_0xa7dc('0x66'),'value':_0x1942b1['attrChannel']||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x4]?_0x1942b1['attrs'][0x4][_0xa7dc('0x5d')]:undefined)||_0xa7dc('0x72')},{'name':_0xa7dc('0x67'),'value':_0x1942b1[_0xa7dc('0x67')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x5]?_0x1942b1[_0xa7dc('0x5a')][0x5][_0xa7dc('0x5d')]:undefined)||''},{'name':_0xa7dc('0x68'),'value':_0x1942b1[_0xa7dc('0x68')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x6]?_0x1942b1['attrs'][0x6]['value']:undefined)||''},{'name':_0xa7dc('0x73'),'value':_0x1942b1[_0xa7dc('0x73')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1['attrs'][0x7]?_0x1942b1[_0xa7dc('0x5a')][0x7][_0xa7dc('0x5d')]:undefined)||''},{'name':_0xa7dc('0x69'),'value':_0x1942b1[_0xa7dc('0x69')]||(_0x1942b1['attrs']&&_0x1942b1['attrs'][0x8]?_0x1942b1[_0xa7dc('0x5a')][0x8][_0xa7dc('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1942b1[_0xa7dc('0x6a')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x9]?_0x1942b1[_0xa7dc('0x5a')][0x9][_0xa7dc('0x5d')]:undefined)||''},{'name':_0xa7dc('0x6b'),'value':_0x1942b1[_0xa7dc('0x6b')]||(_0x1942b1['attrs']&&_0x1942b1[_0xa7dc('0x5a')][0xa]?_0x1942b1['attrs'][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0xa7dc('0x74'),'type':_0x1942b1[_0xa7dc('0x75')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1[_0xa7dc('0x5a')][0x0]?_0x1942b1[_0xa7dc('0x5a')][0x0]['type']:undefined)||null,'value':_0x1942b1[_0xa7dc('0x74')]||(_0x1942b1[_0xa7dc('0x5a')]&&_0x1942b1['attrs'][0x0]?_0x1942b1[_0xa7dc('0x5a')][0x0][_0xa7dc('0x5d')]:undefined)||null},{'name':_0xa7dc('0x76'),'value':_0x1942b1[_0xa7dc('0x76')]||(_0x1942b1['attrs']&&_0x1942b1[_0xa7dc('0x5a')][0x1]?_0x1942b1[_0xa7dc('0x5a')][0x1][_0xa7dc('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x4f2108){logger['error'](_0xa7dc('0x77'),JSON[_0xa7dc('0x78')](_0x4f2108));return[];}}exports[_0xa7dc('0x79')]=function(_0x1f182a,_0xea9107,_0x1a4718){if(_0x1f182a['body']['id']){delete _0x1f182a[_0xa7dc('0x4e')]['id'];}return db[_0xa7dc('0x31')]['find']({'where':{'id':_0x1f182a[_0xa7dc('0x4a')]['id']}})['then'](handleEntityNotFound(_0xea9107,null))[_0xa7dc('0x27')](function(_0xd00973){if(_0xd00973){_0x1f182a[_0xa7dc('0x4e')]['DashboardId']=_0xd00973['id'];_0x1f182a[_0xa7dc('0x4e')]['attrs']=widgetAttributes(_0x1f182a[_0xa7dc('0x4e')]);return db[_0xa7dc('0x7a')][_0xa7dc('0x4d')](_0x1f182a[_0xa7dc('0x4e')]);}})[_0xa7dc('0x27')](respondWithResult(_0xea9107,null))[_0xa7dc('0x49')](handleError(_0xea9107,null));};exports[_0xa7dc('0x7b')]=function(_0x509155,_0x92712f,_0x261f64){var _0x5001b4={};var _0x1b8041={};var _0x4c5f62;var _0x406156;return db['Dashboard'][_0xa7dc('0x7c')]({'where':{'id':_0x509155[_0xa7dc('0x4a')]['id']}})[_0xa7dc('0x27')](handleEntityNotFound(_0x92712f,null))[_0xa7dc('0x27')](function(_0x52c0c9){if(_0x52c0c9){_0x4c5f62=_0x52c0c9;_0x1b8041[_0xa7dc('0x34')]=_[_0xa7dc('0x4b')](db[_0xa7dc('0x7a')][_0xa7dc('0x32')]);_0x1b8041[_0xa7dc('0x35')]=_['keys'](_0x509155[_0xa7dc('0x35')]);_0x1b8041[_0xa7dc('0x36')]=_[_0xa7dc('0x37')](_0x1b8041[_0xa7dc('0x34')],_0x1b8041['query']);_0x5001b4['attributes']=_[_0xa7dc('0x37')](_0x1b8041[_0xa7dc('0x34')],qs['fields'](_0x509155[_0xa7dc('0x35')]['fields']));_0x5001b4[_0xa7dc('0x38')]=_0x5001b4[_0xa7dc('0x38')]['length']?_0x5001b4[_0xa7dc('0x38')]:_0x1b8041[_0xa7dc('0x34')];_0x5001b4[_0xa7dc('0x3e')]=qs[_0xa7dc('0x3f')](_0x509155['query'][_0xa7dc('0x3f')]);_0x5001b4[_0xa7dc('0x40')]=qs['filters'](_[_0xa7dc('0x7d')](_0x509155['query'],_0x1b8041['filters']));if(_0x509155[_0xa7dc('0x35')][_0xa7dc('0x41')]){_0x5001b4[_0xa7dc('0x40')]=_['merge'](_0x5001b4[_0xa7dc('0x40')],{'$or':_['map'](_0x5001b4[_0xa7dc('0x38')],function(_0x270efe){var _0x460198={};_0x460198[_0x270efe]={'$like':'%'+_0x509155[_0xa7dc('0x35')]['filter']+'%'};return _0x460198;})});}_0x5001b4=_[_0xa7dc('0x42')]({},_0x5001b4,_0x509155[_0xa7dc('0x45')]);return _0x4c5f62['getItems'](_0x5001b4);}})['then'](function(_0x72409){if(_0x72409){_0x406156=_0x72409[_0xa7dc('0x3a')];if(!_0x509155[_0xa7dc('0x35')][_0xa7dc('0x3b')]('nolimit')){_0x5001b4[_0xa7dc('0x3d')]=qs['limit'](_0x509155[_0xa7dc('0x35')][_0xa7dc('0x3d')]);_0x5001b4['offset']=qs['offset'](_0x509155[_0xa7dc('0x35')][_0xa7dc('0x20')]);}return _0x4c5f62[_0xa7dc('0x7b')](_0x5001b4);}})['then'](function(_0x580950){if(_0x580950){return _0x580950?{'count':_0x406156,'rows':_0x580950}:null;}})['then'](respondWithResult(_0x92712f,null))[_0xa7dc('0x49')](handleError(_0x92712f,null));}; \ No newline at end of file +var _0x983b=['findOne','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','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','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','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','clone','omit','createdAt','updatedAt','params','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','getItems'];(function(_0x5180c3,_0x4b35f7){var _0x55c975=function(_0x4746cb){while(--_0x4746cb){_0x5180c3['push'](_0x5180c3['shift']());}};_0x55c975(++_0x4b35f7);}(_0x983b,0x187));var _0xb983=function(_0x40cdfe,_0x11cce4){_0x40cdfe=_0x40cdfe-0x0;var _0x22e2d6=_0x983b[_0x40cdfe];return _0x22e2d6;};'use strict';var emlformat=require(_0xb983('0x0'));var rimraf=require(_0xb983('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb983('0x2'));var rp=require('request-promise');var moment=require(_0xb983('0x3'));var BPromise=require(_0xb983('0x4'));var Mustache=require(_0xb983('0x5'));var util=require(_0xb983('0x6'));var path=require(_0xb983('0x7'));var sox=require('sox');var csv=require(_0xb983('0x8'));var ejs=require(_0xb983('0x9'));var fs=require('fs');var fs_extra=require(_0xb983('0xa'));var _=require(_0xb983('0xb'));var squel=require(_0xb983('0xc'));var crypto=require('crypto');var jsforce=require(_0xb983('0xd'));var deskjs=require(_0xb983('0xe'));var toCsv=require(_0xb983('0x8'));var querystring=require('querystring');var Papa=require(_0xb983('0xf'));var Redis=require('ioredis');var authService=require(_0xb983('0x10'));var qs=require(_0xb983('0x11'));var as=require(_0xb983('0x12'));var hardwareService=require(_0xb983('0x13'));var logger=require(_0xb983('0x14'))(_0xb983('0x15'));var utils=require(_0xb983('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb983('0x17'));var db=require(_0xb983('0x18'))['db'];config[_0xb983('0x19')]=_[_0xb983('0x1a')](config[_0xb983('0x19')],{'host':_0xb983('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb983('0x19')]));require('./dashboard.socket')[_0xb983('0x1c')](socket);function respondWithStatusCode(_0x59642f,_0x34af87){_0x34af87=_0x34af87||0xcc;return function(_0x119c57){if(_0x119c57){return _0x59642f[_0xb983('0x1d')](_0x34af87);}return _0x59642f['status'](_0x34af87)[_0xb983('0x1e')]();};}function respondWithResult(_0x297b34,_0x3d9f26){_0x3d9f26=_0x3d9f26||0xc8;return function(_0x5c872f){if(_0x5c872f){return _0x297b34['status'](_0x3d9f26)[_0xb983('0x1f')](_0x5c872f);}};}function respondWithFilteredResult(_0x51ba87,_0x5a94ad){return function(_0x1f66fd){if(_0x1f66fd){var _0x1c9435=typeof _0x5a94ad[_0xb983('0x20')]===_0xb983('0x21')&&typeof _0x5a94ad[_0xb983('0x22')]===_0xb983('0x21');var _0x335cff=_0x1f66fd[_0xb983('0x23')];var _0x444fc8=_0x1c9435?0x0:_0x5a94ad['offset'];var _0x378bcf=_0x1c9435?_0x1f66fd[_0xb983('0x23')]:_0x5a94ad[_0xb983('0x20')]+_0x5a94ad[_0xb983('0x22')];var _0x13103a;if(_0x378bcf>=_0x335cff){_0x378bcf=_0x335cff;_0x13103a=0xc8;}else{_0x13103a=0xce;}_0x51ba87[_0xb983('0x24')](_0x13103a);return _0x51ba87[_0xb983('0x25')](_0xb983('0x26'),_0x444fc8+'-'+_0x378bcf+'/'+_0x335cff)[_0xb983('0x1f')](_0x1f66fd);}return null;};}function patchUpdates(_0x30a83f){return function(_0x58927c){try{jsonpatch['apply'](_0x58927c,_0x30a83f,!![]);}catch(_0x1fc62e){return BPromise[_0xb983('0x27')](_0x1fc62e);}return _0x58927c[_0xb983('0x28')]();};}function saveUpdates(_0x3e3b97,_0x4ee096){return function(_0x1dc947){if(_0x1dc947){return _0x1dc947[_0xb983('0x29')](_0x3e3b97)[_0xb983('0x2a')](function(_0x298545){return _0x298545;});}return null;};}function removeEntity(_0xf6a49,_0xa4a139){return function(_0x1b996e){if(_0x1b996e){return _0x1b996e[_0xb983('0x2b')]()[_0xb983('0x2a')](function(){var _0x463d2d=_0x1b996e[_0xb983('0x2c')]({'plain':!![]});var _0x3bfedb=_0xb983('0x2d');return db[_0xb983('0x2e')][_0xb983('0x2b')]({'where':{'type':_0x3bfedb,'resourceId':_0x463d2d['id']}})[_0xb983('0x2a')](function(){return _0x1b996e;});})[_0xb983('0x2a')](function(){_0xf6a49['status'](0xcc)[_0xb983('0x1e')]();});}};}function handleEntityNotFound(_0x587dea,_0x395ea4){return function(_0x7bb155){if(!_0x7bb155){_0x587dea[_0xb983('0x1d')](0x194);}return _0x7bb155;};}function handleError(_0x1f8d7b,_0x3ac614){_0x3ac614=_0x3ac614||0x1f4;return function(_0x2baf10){logger[_0xb983('0x2f')](_0x2baf10[_0xb983('0x30')]);if(_0x2baf10[_0xb983('0x31')]){delete _0x2baf10[_0xb983('0x31')];}_0x1f8d7b[_0xb983('0x24')](_0x3ac614)[_0xb983('0x32')](_0x2baf10);};}exports[_0xb983('0x33')]=function(_0x8b71e5,_0x2fc595){var _0x544201={},_0x3bb0ed={},_0xb3d9b6={'count':0x0,'rows':[]};var _0x549651=_[_0xb983('0x34')](db[_0xb983('0x35')][_0xb983('0x36')],function(_0xc4e197){return{'name':_0xc4e197[_0xb983('0x37')],'type':_0xc4e197[_0xb983('0x38')][_0xb983('0x39')]};});_0x3bb0ed[_0xb983('0x3a')]=_[_0xb983('0x34')](_0x549651,_0xb983('0x31'));_0x3bb0ed[_0xb983('0x3b')]=_[_0xb983('0x3c')](_0x8b71e5[_0xb983('0x3b')]);_0x3bb0ed[_0xb983('0x3d')]=_[_0xb983('0x3e')](_0x3bb0ed['model'],_0x3bb0ed[_0xb983('0x3b')]);_0x544201[_0xb983('0x3f')]=_[_0xb983('0x3e')](_0x3bb0ed[_0xb983('0x3a')],qs[_0xb983('0x40')](_0x8b71e5['query'][_0xb983('0x40')]));_0x544201[_0xb983('0x3f')]=_0x544201[_0xb983('0x3f')][_0xb983('0x41')]?_0x544201[_0xb983('0x3f')]:_0x3bb0ed[_0xb983('0x3a')];if(!_0x8b71e5[_0xb983('0x3b')][_0xb983('0x42')](_0xb983('0x43'))){_0x544201[_0xb983('0x22')]=qs['limit'](_0x8b71e5[_0xb983('0x3b')][_0xb983('0x22')]);_0x544201[_0xb983('0x20')]=qs['offset'](_0x8b71e5[_0xb983('0x3b')][_0xb983('0x20')]);}_0x544201[_0xb983('0x44')]=qs['sort'](_0x8b71e5[_0xb983('0x3b')][_0xb983('0x45')]);_0x544201['where']=qs['filters'](_['pick'](_0x8b71e5[_0xb983('0x3b')],_0x3bb0ed['filters']),_0x549651);if(_0x8b71e5[_0xb983('0x3b')]['filter']){_0x544201[_0xb983('0x46')]=_[_0xb983('0x47')](_0x544201[_0xb983('0x46')],{'$or':_[_0xb983('0x34')](_0x549651,function(_0x5109bb){if(_0x5109bb[_0xb983('0x38')]!==_0xb983('0x48')){var _0x1402e5={};_0x1402e5[_0x5109bb[_0xb983('0x31')]]={'$like':'%'+_0x8b71e5[_0xb983('0x3b')][_0xb983('0x49')]+'%'};return _0x1402e5;}})});}_0x544201=_['merge']({},_0x544201,_0x8b71e5[_0xb983('0x4a')]);var _0x4deb7b={'where':_0x544201['where']};return db['Dashboard']['count'](_0x4deb7b)[_0xb983('0x2a')](function(_0x11a209){_0xb3d9b6[_0xb983('0x23')]=_0x11a209;if(_0x8b71e5[_0xb983('0x3b')][_0xb983('0x4b')]){_0x544201[_0xb983('0x4c')]=[{'all':!![]}];}return db['Dashboard'][_0xb983('0x4d')](_0x544201);})[_0xb983('0x2a')](function(_0x2ccb81){_0xb3d9b6['rows']=_0x2ccb81;return _0xb3d9b6;})[_0xb983('0x2a')](respondWithFilteredResult(_0x2fc595,_0x544201))[_0xb983('0x4e')](handleError(_0x2fc595,null));};exports[_0xb983('0x4f')]=function(_0x36e540,_0x1cf52b){var _0x902680={'raw':![],'where':{'id':_0x36e540['params']['id']}},_0x136543={};_0x136543[_0xb983('0x3a')]=_[_0xb983('0x3c')](db['Dashboard'][_0xb983('0x36')]);_0x136543['query']=_['keys'](_0x36e540['query']);_0x136543[_0xb983('0x3d')]=_['intersection'](_0x136543[_0xb983('0x3a')],_0x136543[_0xb983('0x3b')]);_0x902680[_0xb983('0x3f')]=_[_0xb983('0x3e')](_0x136543[_0xb983('0x3a')],qs['fields'](_0x36e540[_0xb983('0x3b')]['fields']));_0x902680[_0xb983('0x3f')]=_0x902680[_0xb983('0x3f')]['length']?_0x902680[_0xb983('0x3f')]:_0x136543['model'];if(_0x36e540[_0xb983('0x3b')]['includeAll']){_0x902680[_0xb983('0x4c')]=[{'all':!![]}];}_0x902680=_[_0xb983('0x47')]({},_0x902680,_0x36e540[_0xb983('0x4a')]);return db[_0xb983('0x35')][_0xb983('0x50')](_0x902680)['then'](handleEntityNotFound(_0x1cf52b,null))['then'](respondWithResult(_0x1cf52b,null))['catch'](handleError(_0x1cf52b,null));};exports[_0xb983('0x51')]=function(_0x22f88d,_0x34506b){return db['Dashboard'][_0xb983('0x51')](_0x22f88d[_0xb983('0x52')],{})[_0xb983('0x2a')](function(_0x2f57d3){var _0x389a0=_0x22f88d[_0xb983('0x53')]['get']({'plain':!![]});if(!_0x389a0)throw new Error(_0xb983('0x54'));if(_0x389a0[_0xb983('0x55')]==='user'){var _0x556356=_0x2f57d3['get']({'plain':!![]});var _0x62e3ff=_0xb983('0x2d');return db[_0xb983('0x56')]['find']({'where':{'name':_0x62e3ff,'userProfileId':_0x389a0[_0xb983('0x57')]},'raw':!![]})[_0xb983('0x2a')](function(_0x2860e5){if(_0x2860e5&&_0x2860e5[_0xb983('0x58')]===0x0){return db[_0xb983('0x2e')][_0xb983('0x51')]({'name':_0x556356[_0xb983('0x31')],'resourceId':_0x556356['id'],'type':_0x2860e5[_0xb983('0x31')],'sectionId':_0x2860e5['id']},{})[_0xb983('0x2a')](function(){return _0x2f57d3;});}else{return _0x2f57d3;}})[_0xb983('0x4e')](function(_0x2c4435){logger[_0xb983('0x2f')](_0xb983('0x59'),_0x2c4435);throw _0x2c4435;});}return _0x2f57d3;})['then'](respondWithResult(_0x34506b,0xc9))['catch'](handleError(_0x34506b,null));};exports[_0xb983('0x5a')]=function(_0x54c2e9,_0x35cdaa){var _0x50bebc={'where':{'id':_0x54c2e9['params']['id']}},_0x8ee928={};_0x8ee928[_0xb983('0x3a')]=_[_0xb983('0x3c')](db[_0xb983('0x35')][_0xb983('0x36')]);_0x50bebc[_0xb983('0x3f')]=_[_0xb983('0x3e')](_0x8ee928[_0xb983('0x3a')],qs['fields'](_0x54c2e9[_0xb983('0x3b')][_0xb983('0x40')]));_0x50bebc[_0xb983('0x3f')]=_0x50bebc['attributes'][_0xb983('0x41')]?_0x50bebc['attributes']:_0x8ee928[_0xb983('0x3a')];if(_0x54c2e9['query'][_0xb983('0x4b')]){_0x50bebc['include']=[{'all':!![]}];}_0x50bebc=_['merge']({},_0x50bebc,_0x54c2e9[_0xb983('0x4a')]);return db['Dashboard'][_0xb983('0x50')](_0x50bebc)[_0xb983('0x2a')](handleEntityNotFound(_0x35cdaa,null))[_0xb983('0x2a')](function(_0x4df12f){if(_0x4df12f){var _0x487618=_0x4df12f[_0xb983('0x2c')]({'plain':!![]});_0x487618=qs[_0xb983('0x5b')](_0x487618,['id',_0xb983('0x5c'),_0xb983('0x5d')]);_0x54c2e9[_0xb983('0x52')]=_[_0xb983('0x5b')](_0x54c2e9[_0xb983('0x52')],['id','createdAt','updatedAt']);return db['Dashboard'][_0xb983('0x51')](_[_0xb983('0x47')](_0x487618,_0x54c2e9[_0xb983('0x52')]),{'include':_0x54c2e9[_0xb983('0x3b')][_0xb983('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x59865c){var _0x44455b=_0x54c2e9[_0xb983('0x53')][_0xb983('0x2c')]({'plain':!![]});if(!_0x44455b)throw new Error(_0xb983('0x54'));if(_0x44455b['role']==='user'){var _0x1a54f4=_0x59865c[_0xb983('0x2c')]({'plain':!![]});var _0x3b5ca8=_0xb983('0x2d');return db[_0xb983('0x56')][_0xb983('0x50')]({'where':{'name':_0x3b5ca8,'userProfileId':_0x44455b['userProfileId']},'raw':!![]})['then'](function(_0x10953c){if(_0x10953c&&_0x10953c[_0xb983('0x58')]===0x0){return db[_0xb983('0x2e')][_0xb983('0x51')]({'name':_0x1a54f4[_0xb983('0x31')],'resourceId':_0x1a54f4['id'],'type':_0x10953c['name'],'sectionId':_0x10953c['id']},{})['then'](function(){return _0x59865c;});}else{return _0x59865c;}})[_0xb983('0x4e')](function(_0xf6375f){logger[_0xb983('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf6375f);throw _0xf6375f;});}return _0x59865c;});}})['then'](respondWithResult(_0x35cdaa,0xc9))['catch'](handleError(_0x35cdaa,null));};exports[_0xb983('0x29')]=function(_0x58fc8e,_0x39c073){if(_0x58fc8e[_0xb983('0x52')]['id']){delete _0x58fc8e[_0xb983('0x52')]['id'];}return db[_0xb983('0x35')][_0xb983('0x50')]({'where':{'id':_0x58fc8e['params']['id']}})[_0xb983('0x2a')](handleEntityNotFound(_0x39c073,null))[_0xb983('0x2a')](saveUpdates(_0x58fc8e[_0xb983('0x52')],null))[_0xb983('0x2a')](respondWithResult(_0x39c073,null))[_0xb983('0x4e')](handleError(_0x39c073,null));};exports[_0xb983('0x2b')]=function(_0x5b26a4,_0x1c0064){return db[_0xb983('0x35')]['find']({'where':{'id':_0x5b26a4[_0xb983('0x5e')]['id']}})[_0xb983('0x2a')](handleEntityNotFound(_0x1c0064,null))[_0xb983('0x2a')](removeEntity(_0x1c0064,null))[_0xb983('0x4e')](handleError(_0x1c0064,null));};function widgetAttributes(_0x198e60){try{switch(_0x198e60['type']){case _0xb983('0x5f'):return[{'name':_0xb983('0x60'),'value':_0x198e60[_0xb983('0x60')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x0]?_0x198e60['attrs'][0x0]['value']:undefined)||_0xb983('0x62')}];case'custom':return[{'name':_0xb983('0x63'),'value':_0x198e60['attrPath']||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x64')]:undefined)||''}];case _0xb983('0x65'):return[{'name':_0xb983('0x66'),'value':_0x198e60['attrHourFormat']||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x64')]:undefined)||_0xb983('0x67')},{'name':_0xb983('0x68'),'value':_0x198e60[_0xb983('0x68')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x1]?_0x198e60[_0xb983('0x61')][0x1][_0xb983('0x64')]:undefined)||_0xb983('0x69')},{'name':_0xb983('0x6a'),'value':_0x198e60[_0xb983('0x6a')]||(_0x198e60['attrs']&&_0x198e60[_0xb983('0x61')][0x2]?_0x198e60[_0xb983('0x61')][0x2]['value']:undefined)||0xc}];case _0xb983('0x6b'):return[{'name':'attrMetric','value':_0x198e60['attrMetric']||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x64')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x198e60[_0xb983('0x6c')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x1]?_0x198e60[_0xb983('0x61')][0x1][_0xb983('0x64')]:undefined)||[]},{'name':_0xb983('0x6a'),'value':_0x198e60[_0xb983('0x6a')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x2]?_0x198e60[_0xb983('0x61')][0x2][_0xb983('0x64')]:undefined)||0x14},{'name':_0xb983('0x6d'),'value':_0x198e60[_0xb983('0x6d')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x3]?_0x198e60[_0xb983('0x61')][0x3][_0xb983('0x64')]:undefined)||_0xb983('0x6e')},{'name':'attrEmailAccounts','value':_0x198e60[_0xb983('0x6f')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x4]?_0x198e60[_0xb983('0x61')][0x4]['value']:undefined)||''},{'name':_0xb983('0x70'),'value':_0x198e60[_0xb983('0x70')]||(_0x198e60['attrs']&&_0x198e60['attrs'][0x5]?_0x198e60[_0xb983('0x61')][0x5][_0xb983('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x198e60[_0xb983('0x71')]||(_0x198e60['attrs']&&_0x198e60['attrs'][0x6]?_0x198e60[_0xb983('0x61')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x198e60['attrOpenchannelAccounts']||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x7]?_0x198e60[_0xb983('0x61')][0x7][_0xb983('0x64')]:undefined)||''},{'name':_0xb983('0x72'),'value':_0x198e60['attrWhatsappAccounts']||(_0x198e60['attrs']&&_0x198e60[_0xb983('0x61')][0x8]?_0x198e60[_0xb983('0x61')][0x8][_0xb983('0x64')]:undefined)||''},{'name':'attrChatWebsites','value':_0x198e60[_0xb983('0x73')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x9]?_0x198e60[_0xb983('0x61')][0x9]['value']:undefined)||''}];case _0xb983('0x74'):case _0xb983('0x75'):return[{'name':_0xb983('0x76'),'value':_0x198e60[_0xb983('0x76')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x64')]:undefined)||_0xb983('0x77')},{'name':_0xb983('0x78'),'value':_0x198e60[_0xb983('0x78')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x1]?_0x198e60[_0xb983('0x61')][0x1][_0xb983('0x64')]:undefined)||null},{'name':_0xb983('0x79'),'value':_0x198e60['attrSerie3']||(_0x198e60['attrs']&&_0x198e60[_0xb983('0x61')][0x2]?_0x198e60[_0xb983('0x61')][0x2][_0xb983('0x64')]:undefined)||null},{'name':_0xb983('0x6c'),'value':_0x198e60[_0xb983('0x6c')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x3]?_0x198e60[_0xb983('0x61')][0x3][_0xb983('0x64')]:undefined)||[]},{'name':'attrChannel','value':_0x198e60[_0xb983('0x6d')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x4]?_0x198e60['attrs'][0x4][_0xb983('0x64')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x198e60['attrEmailAccounts']||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x5]?_0x198e60[_0xb983('0x61')][0x5]['value']:undefined)||''},{'name':_0xb983('0x70'),'value':_0x198e60[_0xb983('0x70')]||(_0x198e60['attrs']&&_0x198e60['attrs'][0x6]?_0x198e60[_0xb983('0x61')][0x6][_0xb983('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x198e60[_0xb983('0x71')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x7]?_0x198e60[_0xb983('0x61')][0x7][_0xb983('0x64')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x198e60[_0xb983('0x7a')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x8]?_0x198e60[_0xb983('0x61')][0x8][_0xb983('0x64')]:undefined)||''},{'name':_0xb983('0x72'),'value':_0x198e60[_0xb983('0x72')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x9]?_0x198e60[_0xb983('0x61')][0x9]['value']:undefined)||''},{'name':_0xb983('0x73'),'value':_0x198e60[_0xb983('0x73')]||(_0x198e60['attrs']&&_0x198e60[_0xb983('0x61')][0xa]?_0x198e60[_0xb983('0x61')][0xa][_0xb983('0x64')]:undefined)||''}];case _0xb983('0x7b'):return[{'name':'attrReport','type':_0x198e60['reportType']||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x38')]:undefined)||null,'value':_0x198e60['attrReport']||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x64')]:undefined)||null},{'name':_0xb983('0x7c'),'value':_0x198e60[_0xb983('0x7c')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x1]?_0x198e60['attrs'][0x1][_0xb983('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x3a89a8){logger['error'](_0xb983('0x7d'),JSON[_0xb983('0x7e')](_0x3a89a8));return[];}}exports[_0xb983('0x7f')]=function(_0x1156e7,_0x587592,_0x3fa306){if(_0x1156e7[_0xb983('0x52')]['id']){delete _0x1156e7['body']['id'];}return db[_0xb983('0x35')][_0xb983('0x50')]({'where':{'id':_0x1156e7[_0xb983('0x5e')]['id']}})[_0xb983('0x2a')](handleEntityNotFound(_0x587592,null))[_0xb983('0x2a')](function(_0x52a48d){if(_0x52a48d){_0x1156e7[_0xb983('0x52')]['DashboardId']=_0x52a48d['id'];_0x1156e7['body'][_0xb983('0x61')]=widgetAttributes(_0x1156e7[_0xb983('0x52')]);return db['DashboardItem'][_0xb983('0x51')](_0x1156e7['body']);}})[_0xb983('0x2a')](respondWithResult(_0x587592,null))[_0xb983('0x4e')](handleError(_0x587592,null));};exports[_0xb983('0x80')]=function(_0x57140d,_0xdb7ac6,_0x2e9ff7){var _0x2e65d2={};var _0x5ccadf={};var _0x1413a9;var _0x5884dd;return db[_0xb983('0x35')][_0xb983('0x81')]({'where':{'id':_0x57140d[_0xb983('0x5e')]['id']}})[_0xb983('0x2a')](handleEntityNotFound(_0xdb7ac6,null))[_0xb983('0x2a')](function(_0x127c47){if(_0x127c47){_0x1413a9=_0x127c47;_0x5ccadf[_0xb983('0x3a')]=_[_0xb983('0x3c')](db['DashboardItem'][_0xb983('0x36')]);_0x5ccadf[_0xb983('0x3b')]=_[_0xb983('0x3c')](_0x57140d['query']);_0x5ccadf[_0xb983('0x3d')]=_[_0xb983('0x3e')](_0x5ccadf[_0xb983('0x3a')],_0x5ccadf[_0xb983('0x3b')]);_0x2e65d2[_0xb983('0x3f')]=_[_0xb983('0x3e')](_0x5ccadf['model'],qs[_0xb983('0x40')](_0x57140d['query']['fields']));_0x2e65d2['attributes']=_0x2e65d2[_0xb983('0x3f')][_0xb983('0x41')]?_0x2e65d2['attributes']:_0x5ccadf['model'];_0x2e65d2[_0xb983('0x44')]=qs[_0xb983('0x45')](_0x57140d[_0xb983('0x3b')][_0xb983('0x45')]);_0x2e65d2['where']=qs['filters'](_['pick'](_0x57140d[_0xb983('0x3b')],_0x5ccadf[_0xb983('0x3d')]));if(_0x57140d[_0xb983('0x3b')]['filter']){_0x2e65d2[_0xb983('0x46')]=_[_0xb983('0x47')](_0x2e65d2[_0xb983('0x46')],{'$or':_[_0xb983('0x34')](_0x2e65d2['attributes'],function(_0x5a4f3d){var _0x4e8efb={};_0x4e8efb[_0x5a4f3d]={'$like':'%'+_0x57140d[_0xb983('0x3b')][_0xb983('0x49')]+'%'};return _0x4e8efb;})});}_0x2e65d2=_[_0xb983('0x47')]({},_0x2e65d2,_0x57140d[_0xb983('0x4a')]);return _0x1413a9[_0xb983('0x80')](_0x2e65d2);}})['then'](function(_0x387578){if(_0x387578){_0x5884dd=_0x387578[_0xb983('0x41')];if(!_0x57140d[_0xb983('0x3b')][_0xb983('0x42')](_0xb983('0x43'))){_0x2e65d2[_0xb983('0x22')]=qs[_0xb983('0x22')](_0x57140d[_0xb983('0x3b')][_0xb983('0x22')]);_0x2e65d2[_0xb983('0x20')]=qs[_0xb983('0x20')](_0x57140d[_0xb983('0x3b')][_0xb983('0x20')]);}return _0x1413a9[_0xb983('0x80')](_0x2e65d2);}})[_0xb983('0x2a')](function(_0x472b4f){if(_0x472b4f){return _0x472b4f?{'count':_0x5884dd,'rows':_0x472b4f}:null;}})['then'](respondWithResult(_0xdb7ac6,null))['catch'](handleError(_0xdb7ac6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1bc2aa0..642f9bf 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 _0x0e2a=['save','remove','emit','hook','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x315ae0,_0x406b7a){var _0x30d681=function(_0x2899f9){while(--_0x2899f9){_0x315ae0['push'](_0x315ae0['shift']());}};_0x30d681(++_0x406b7a);}(_0x0e2a,0x154));var _0xa0e2=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x0e2a[_0x3740fe];return _0x55492b;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xa0e2('0x0'))['db'][_0xa0e2('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa0e2('0x2')](0x0);var events={'afterCreate':_0xa0e2('0x3'),'afterUpdate':'update','afterDestroy':_0xa0e2('0x4')};function emitEvent(_0x576c74){return function(_0x5f1eb9,_0x78c4b3,_0x414041){DashboardEvents[_0xa0e2('0x5')](_0x576c74+':'+_0x5f1eb9['id'],_0x5f1eb9);DashboardEvents[_0xa0e2('0x5')](_0x576c74,_0x5f1eb9);_0x414041(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xa0e2('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x92f4=['save','update','emit','hook','exports','../../mysqldb','Dashboard'];(function(_0x342231,_0x1618f3){var _0x32e1cd=function(_0x63a7d9){while(--_0x63a7d9){_0x342231['push'](_0x342231['shift']());}};_0x32e1cd(++_0x1618f3);}(_0x92f4,0x10f));var _0x492f=function(_0x3793a4,_0x18871a){_0x3793a4=_0x3793a4-0x0;var _0x2ab94f=_0x92f4[_0x3793a4];return _0x2ab94f;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x492f('0x0'))['db'][_0x492f('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x492f('0x2'),'afterUpdate':_0x492f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1a951a){return function(_0x5de633,_0x415caf,_0x264a66){DashboardEvents[_0x492f('0x4')](_0x1a951a+':'+_0x5de633['id'],_0x5de633);DashboardEvents['emit'](_0x1a951a,_0x5de633);_0x264a66(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x492f('0x5')](e,emitEvent(event));}}module[_0x492f('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 1d99f93..fdf7456 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 _0xbd63=['path','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf95558,_0x2e50d5){var _0x56f963=function(_0x544da5){while(--_0x544da5){_0xf95558['push'](_0xf95558['shift']());}};_0x56f963(++_0x2e50d5);}(_0xbd63,0x199));var _0x3bd6=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xbd63[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x3bd6('0x0'));var util=require(_0x3bd6('0x1'));var logger=require(_0x3bd6('0x2'))(_0x3bd6('0x3'));var moment=require(_0x3bd6('0x4'));var BPromise=require(_0x3bd6('0x5'));var rp=require(_0x3bd6('0x6'));var fs=require('fs');var path=require(_0x3bd6('0x7'));var rimraf=require('rimraf');var config=require(_0x3bd6('0x8'));var attributes=require(_0x3bd6('0x9'));module[_0x3bd6('0xa')]=function(_0x5aee7f,_0x2be37d){return _0x5aee7f['define'](_0x3bd6('0xb'),attributes,{'tableName':_0x3bd6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4fb=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash'];(function(_0x482c27,_0x232507){var _0x539fff=function(_0x47de55){while(--_0x47de55){_0x482c27['push'](_0x482c27['shift']());}};_0x539fff(++_0x232507);}(_0xc4fb,0x12a));var _0xbc4f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc4fb[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xbc4f('0x0'));var util=require(_0xbc4f('0x1'));var logger=require(_0xbc4f('0x2'))('api');var moment=require(_0xbc4f('0x3'));var BPromise=require(_0xbc4f('0x4'));var rp=require(_0xbc4f('0x5'));var fs=require('fs');var path=require(_0xbc4f('0x6'));var rimraf=require('rimraf');var config=require(_0xbc4f('0x7'));var attributes=require(_0xbc4f('0x8'));module[_0xbc4f('0x9')]=function(_0x4f78ae,_0x4db060){return _0x4f78ae[_0xbc4f('0xa')](_0xbc4f('0xb'),attributes,{'tableName':_0xbc4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index cab73ed..052185e 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 _0x7ac0=['../../config/environment','jayson/promise','client','http','redis','defaults','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3dda00,_0x392dca){var _0x2a6b26=function(_0x4634f3){while(--_0x4634f3){_0x3dda00['push'](_0x3dda00['shift']());}};_0x2a6b26(++_0x392dca);}(_0x7ac0,0x18d));var _0x07ac=function(_0x6309b0,_0x1f1c88){_0x6309b0=_0x6309b0-0x0;var _0x17792f=_0x7ac0[_0x6309b0];return _0x17792f;};'use strict';var _=require(_0x07ac('0x0'));var util=require(_0x07ac('0x1'));var moment=require(_0x07ac('0x2'));var BPromise=require('bluebird');var rs=require(_0x07ac('0x3'));var fs=require('fs');var Redis=require(_0x07ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x07ac('0x5'));var logger=require(_0x07ac('0x6'))(_0x07ac('0x7'));var config=require(_0x07ac('0x8'));var jayson=require(_0x07ac('0x9'));var client=jayson[_0x07ac('0xa')][_0x07ac('0xb')]({'port':0x232a});config[_0x07ac('0xc')]=_[_0x07ac('0xd')](config[_0x07ac('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07ac('0xc')]));require(_0x07ac('0xe'))[_0x07ac('0xf')](socket);function respondWithRpcPromise(_0x146856,_0x3cf6b4,_0x2f7b41){return new BPromise(function(_0x158d01,_0x2ec783){return client[_0x07ac('0x10')](_0x146856,_0x2f7b41)['then'](function(_0x8fc276){logger[_0x07ac('0x11')](_0x07ac('0x12'),_0x3cf6b4,_0x07ac('0x13'));logger[_0x07ac('0x14')](_0x07ac('0x15'),_0x3cf6b4,'request\x20sent',JSON[_0x07ac('0x16')](_0x8fc276));if(_0x8fc276['error']){if(_0x8fc276[_0x07ac('0x17')]['code']===0x1f4){logger[_0x07ac('0x17')](_0x07ac('0x12'),_0x3cf6b4,_0x8fc276[_0x07ac('0x17')]['message']);return _0x2ec783(_0x8fc276[_0x07ac('0x17')]['message']);}logger[_0x07ac('0x17')]('Dashboard,\x20%s,\x20%s',_0x3cf6b4,_0x8fc276['error'][_0x07ac('0x18')]);return _0x158d01(_0x8fc276[_0x07ac('0x17')][_0x07ac('0x18')]);}else{logger['info'](_0x07ac('0x12'),_0x3cf6b4,'request\x20sent');_0x158d01(_0x8fc276[_0x07ac('0x19')]['message']);}})[_0x07ac('0x1a')](function(_0x2f5450){logger['error'](_0x07ac('0x12'),_0x3cf6b4,_0x2f5450);_0x2ec783(_0x2f5450);});});} \ No newline at end of file +var _0x4579=['rpc','../../config/environment','jayson/promise','http','redis','localhost','./dashboard.socket','register','request','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x4579,0x164));var _0x9457=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4579[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9457('0x0'));var util=require('util');var moment=require(_0x9457('0x1'));var BPromise=require(_0x9457('0x2'));var rs=require(_0x9457('0x3'));var fs=require('fs');var Redis=require(_0x9457('0x4'));var db=require(_0x9457('0x5'))['db'];var utils=require(_0x9457('0x6'));var logger=require(_0x9457('0x7'))(_0x9457('0x8'));var config=require(_0x9457('0x9'));var jayson=require(_0x9457('0xa'));var client=jayson['client'][_0x9457('0xb')]({'port':0x232a});config[_0x9457('0xc')]=_['defaults'](config[_0x9457('0xc')],{'host':_0x9457('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9457('0xe'))[_0x9457('0xf')](socket);function respondWithRpcPromise(_0x2e6172,_0x254711,_0x4bf92c){return new BPromise(function(_0x228f2c,_0x3da939){return client[_0x9457('0x10')](_0x2e6172,_0x4bf92c)[_0x9457('0x11')](function(_0x48ceed){logger['info']('Dashboard,\x20%s,\x20%s',_0x254711,_0x9457('0x12'));logger[_0x9457('0x13')](_0x9457('0x14'),_0x254711,_0x9457('0x12'),JSON['stringify'](_0x48ceed));if(_0x48ceed[_0x9457('0x15')]){if(_0x48ceed[_0x9457('0x15')][_0x9457('0x16')]===0x1f4){logger[_0x9457('0x15')](_0x9457('0x17'),_0x254711,_0x48ceed['error'][_0x9457('0x18')]);return _0x3da939(_0x48ceed[_0x9457('0x15')]['message']);}logger[_0x9457('0x15')]('Dashboard,\x20%s,\x20%s',_0x254711,_0x48ceed[_0x9457('0x15')][_0x9457('0x18')]);return _0x228f2c(_0x48ceed[_0x9457('0x15')]['message']);}else{logger[_0x9457('0x19')]('Dashboard,\x20%s,\x20%s',_0x254711,_0x9457('0x12'));_0x228f2c(_0x48ceed[_0x9457('0x1a')][_0x9457('0x18')]);}})[_0x9457('0x1b')](function(_0x2a698d){logger[_0x9457('0x15')](_0x9457('0x17'),_0x254711,_0x2a698d);_0x3da939(_0x2a698d);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 90bf24f..6af3634 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 _0x8db9=['remove','update','removeListener','register','length','dashboard:','./dashboard.events','save'];(function(_0x575b72,_0x1a7eb1){var _0x561c57=function(_0x10e401){while(--_0x10e401){_0x575b72['push'](_0x575b72['shift']());}};_0x561c57(++_0x1a7eb1);}(_0x8db9,0xf6));var _0x98db=function(_0x3fb21a,_0x4e88e6){_0x3fb21a=_0x3fb21a-0x0;var _0x432166=_0x8db9[_0x3fb21a];return _0x432166;};'use strict';var DashboardEvents=require(_0x98db('0x0'));var events=[_0x98db('0x1'),_0x98db('0x2'),_0x98db('0x3')];function createListener(_0x341367,_0x44d0a8){return function(_0x5cf130){_0x44d0a8['emit'](_0x341367,_0x5cf130);};}function removeListener(_0x463e8b,_0x394d56){return function(){DashboardEvents[_0x98db('0x4')](_0x463e8b,_0x394d56);};}exports[_0x98db('0x5')]=function(_0x1aeb7c){for(var _0x33602b=0x0,_0x2c2a73=events[_0x98db('0x6')];_0x33602b<_0x2c2a73;_0x33602b++){var _0x7b7f32=events[_0x33602b];var _0x47f486=createListener(_0x98db('0x7')+_0x7b7f32,_0x1aeb7c);DashboardEvents['on'](_0x7b7f32,_0x47f486);}}; \ No newline at end of file +var _0xdd1d=['remove','emit','removeListener','register','length','dashboard:'];(function(_0x5aaa66,_0x3522ab){var _0x19f48a=function(_0x16e595){while(--_0x16e595){_0x5aaa66['push'](_0x5aaa66['shift']());}};_0x19f48a(++_0x3522ab);}(_0xdd1d,0x150));var _0xddd1=function(_0x39a04c,_0x2b4002){_0x39a04c=_0x39a04c-0x0;var _0x580cb0=_0xdd1d[_0x39a04c];return _0x580cb0;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xddd1('0x0'),'update'];function createListener(_0x558f17,_0x589dab){return function(_0x26fc48){_0x589dab[_0xddd1('0x1')](_0x558f17,_0x26fc48);};}function removeListener(_0x566bbf,_0x592f8b){return function(){DashboardEvents[_0xddd1('0x2')](_0x566bbf,_0x592f8b);};}exports[_0xddd1('0x3')]=function(_0x484484){for(var _0x28193e=0x0,_0x5f431c=events[_0xddd1('0x4')];_0x28193e<_0x5f431c;_0x28193e++){var _0x3b4743=events[_0x28193e];var _0x213242=createListener(_0xddd1('0x5')+_0x3b4743,_0x484484);DashboardEvents['on'](_0x3b4743,_0x213242);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 50fa6a5..4c7bc2e 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 _0xad67=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/items','getItems','post','create','clone','addItem','put','delete','destroy','multer','util'];(function(_0x310735,_0x13ebf4){var _0x4bb092=function(_0x5483f3){while(--_0x5483f3){_0x310735['push'](_0x310735['shift']());}};_0x4bb092(++_0x13ebf4);}(_0xad67,0x1de));var _0x7ad6=function(_0x296b3c,_0x203828){_0x296b3c=_0x296b3c-0x0;var _0x53adfa=_0xad67[_0x296b3c];return _0x53adfa;};'use strict';var multer=require(_0x7ad6('0x0'));var util=require(_0x7ad6('0x1'));var path=require(_0x7ad6('0x2'));var timeout=require(_0x7ad6('0x3'));var express=require(_0x7ad6('0x4'));var router=express[_0x7ad6('0x5')]();var fs_extra=require(_0x7ad6('0x6'));var auth=require(_0x7ad6('0x7'));var interaction=require(_0x7ad6('0x8'));var config=require(_0x7ad6('0x9'));var controller=require('./dashboard.controller');router[_0x7ad6('0xa')]('/',auth['isAuthenticated'](),controller[_0x7ad6('0xb')]);router[_0x7ad6('0xa')](_0x7ad6('0xc'),auth[_0x7ad6('0xd')](),controller[_0x7ad6('0xe')]);router['get'](_0x7ad6('0xf'),auth[_0x7ad6('0xd')](),controller[_0x7ad6('0x10')]);router[_0x7ad6('0x11')]('/',auth[_0x7ad6('0xd')](),controller[_0x7ad6('0x12')]);router[_0x7ad6('0x11')]('/:id/clone',auth[_0x7ad6('0xd')](),controller[_0x7ad6('0x13')]);router[_0x7ad6('0x11')](_0x7ad6('0xf'),auth[_0x7ad6('0xd')](),controller[_0x7ad6('0x14')]);router[_0x7ad6('0x15')](_0x7ad6('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7ad6('0x16')](_0x7ad6('0xc'),auth[_0x7ad6('0xd')](),controller[_0x7ad6('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8341=['post','clone','addItem','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','isAuthenticated','show','/:id/items','getItems','create'];(function(_0x27bf3b,_0x353051){var _0x417ff7=function(_0x417989){while(--_0x417989){_0x27bf3b['push'](_0x27bf3b['shift']());}};_0x417ff7(++_0x353051);}(_0x8341,0x1e9));var _0x1834=function(_0x3d491e,_0x5c5126){_0x3d491e=_0x3d491e-0x0;var _0x29ab5c=_0x8341[_0x3d491e];return _0x29ab5c;};'use strict';var multer=require(_0x1834('0x0'));var util=require('util');var path=require(_0x1834('0x1'));var timeout=require(_0x1834('0x2'));var express=require('express');var router=express[_0x1834('0x3')]();var fs_extra=require(_0x1834('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1834('0x5'));var config=require(_0x1834('0x6'));var controller=require(_0x1834('0x7'));router[_0x1834('0x8')]('/',auth['isAuthenticated'](),controller[_0x1834('0x9')]);router[_0x1834('0x8')]('/:id',auth[_0x1834('0xa')](),controller[_0x1834('0xb')]);router[_0x1834('0x8')](_0x1834('0xc'),auth[_0x1834('0xa')](),controller[_0x1834('0xd')]);router['post']('/',auth[_0x1834('0xa')](),controller[_0x1834('0xe')]);router[_0x1834('0xf')]('/:id/clone',auth[_0x1834('0xa')](),controller[_0x1834('0x10')]);router[_0x1834('0xf')](_0x1834('0xc'),auth[_0x1834('0xa')](),controller[_0x1834('0x11')]);router[_0x1834('0x12')](_0x1834('0x13'),auth[_0x1834('0xa')](),controller[_0x1834('0x14')]);router[_0x1834('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1834('0x16')]);module[_0x1834('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 83e5c60..7da1f67 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 _0x6d38=['INTEGER','STRING','#2196f3','squel','lodash','exports','TEXT','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0x5e6782,_0x4517d0){var _0xef4ceb=function(_0x32251c){while(--_0x32251c){_0x5e6782['push'](_0x5e6782['shift']());}};_0xef4ceb(++_0x4517d0);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x86d3('0x0'));var _=require(_0x86d3('0x1'));module[_0x86d3('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x86d3('0x3')]('long'),'get':function(){try{return JSON[_0x86d3('0x4')](this[_0x86d3('0x5')](_0x86d3('0x6')));}catch(_0x4ef557){return[];}},'set':function(_0x2d8272){try{this[_0x86d3('0x7')](_0x86d3('0x6'),JSON[_0x86d3('0x8')](_0x2d8272));}catch(_0x47e654){this['setDataValue'](_0x86d3('0x6'),JSON[_0x86d3('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x86d3('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x86d3('0x9')]},'background':{'type':Sequelize[_0x86d3('0xa')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x86d3('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x86d3('0xa')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xafc4=['TEXT','long','setDataValue','attrs','stringify','INTEGER','sequelize','lodash','STRING'];(function(_0x492492,_0x4380cc){var _0x558059=function(_0x493b8c){while(--_0x493b8c){_0x492492['push'](_0x492492['shift']());}};_0x558059(++_0x4380cc);}(_0xafc4,0x69));var _0x4afc=function(_0x361e17,_0x29c1f1){_0x361e17=_0x361e17-0x0;var _0xda8154=_0xafc4[_0x361e17];return _0xda8154;};'use strict';var Sequelize=require(_0x4afc('0x0'));var squel=require('squel');var _=require(_0x4afc('0x1'));module['exports']={'title':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4afc('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4afc('0x3')](_0x4afc('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue']('attrs'));}catch(_0x36cb50){return[];}},'set':function(_0x471d45){try{this[_0x4afc('0x5')](_0x4afc('0x6'),JSON[_0x4afc('0x7')](_0x471d45));}catch(_0xaf053d){this['setDataValue'](_0x4afc('0x6'),JSON[_0x4afc('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4afc('0x8')]},'col':{'type':Sequelize[_0x4afc('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4afc('0x2')]},'titleFontSize':{'type':Sequelize[_0x4afc('0x8')],'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 9552388..189c98e 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 _0x6050=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf'];(function(_0x381aca,_0x3784a1){var _0x17b285=function(_0x5c6b08){while(--_0x5c6b08){_0x381aca['push'](_0x381aca['shift']());}};_0x17b285(++_0x3784a1);}(_0x6050,0x196));var _0x0605=function(_0x129825,_0x31f828){_0x129825=_0x129825-0x0;var _0x502b83=_0x6050[_0x129825];return _0x502b83;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];config[_0x0605('0x19')]=_[_0x0605('0x1a')](config[_0x0605('0x19')],{'host':_0x0605('0x1b'),'port':0x18eb});var socket=require(_0x0605('0x1c'))(new Redis(config[_0x0605('0x19')]));require(_0x0605('0x1d'))[_0x0605('0x1e')](socket);function respondWithStatusCode(_0x1b944f,_0x5b08ba){_0x5b08ba=_0x5b08ba||0xcc;return function(_0x2b4610){if(_0x2b4610){return _0x1b944f[_0x0605('0x1f')](_0x5b08ba);}return _0x1b944f[_0x0605('0x20')](_0x5b08ba)['end']();};}function respondWithResult(_0x4eefe9,_0x12a455){_0x12a455=_0x12a455||0xc8;return function(_0xd0996d){if(_0xd0996d){return _0x4eefe9[_0x0605('0x20')](_0x12a455)[_0x0605('0x21')](_0xd0996d);}};}function respondWithFilteredResult(_0xefc557,_0x351dbd){return function(_0x2b7b5a){if(_0x2b7b5a){var _0x1d57ba=typeof _0x351dbd[_0x0605('0x22')]===_0x0605('0x23')&&typeof _0x351dbd[_0x0605('0x24')]===_0x0605('0x23');var _0x2e2204=_0x2b7b5a[_0x0605('0x25')];var _0x59bc87=_0x1d57ba?0x0:_0x351dbd[_0x0605('0x22')];var _0x14a920=_0x1d57ba?_0x2b7b5a[_0x0605('0x25')]:_0x351dbd[_0x0605('0x22')]+_0x351dbd[_0x0605('0x24')];var _0x90b2e1;if(_0x14a920>=_0x2e2204){_0x14a920=_0x2e2204;_0x90b2e1=0xc8;}else{_0x90b2e1=0xce;}_0xefc557[_0x0605('0x20')](_0x90b2e1);return _0xefc557[_0x0605('0x26')](_0x0605('0x27'),_0x59bc87+'-'+_0x14a920+'/'+_0x2e2204)['json'](_0x2b7b5a);}return null;};}function patchUpdates(_0xc334b8){return function(_0x4fe293){try{jsonpatch[_0x0605('0x28')](_0x4fe293,_0xc334b8,!![]);}catch(_0x118e9c){return BPromise[_0x0605('0x29')](_0x118e9c);}return _0x4fe293[_0x0605('0x2a')]();};}function saveUpdates(_0x10c575,_0xb4d805){return function(_0x2ea61d){if(_0x2ea61d){return _0x2ea61d[_0x0605('0x2b')](_0x10c575)[_0x0605('0x2c')](function(_0x2896d7){return _0x2896d7;});}return null;};}function removeEntity(_0x9f2833,_0x1c3722){return function(_0x5a602e){if(_0x5a602e){return _0x5a602e[_0x0605('0x2d')]()[_0x0605('0x2c')](function(){_0x9f2833['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ebd8,_0x33558f){return function(_0x226825){if(!_0x226825){_0x55ebd8[_0x0605('0x1f')](0x194);}return _0x226825;};}function handleError(_0x149e36,_0x1cee1d){_0x1cee1d=_0x1cee1d||0x1f4;return function(_0x4554df){logger['error'](_0x4554df[_0x0605('0x2e')]);if(_0x4554df['name']){delete _0x4554df[_0x0605('0x2f')];}_0x149e36[_0x0605('0x20')](_0x1cee1d)[_0x0605('0x30')](_0x4554df);};}exports[_0x0605('0x31')]=function(_0x1f65aa,_0x352dd6){var _0x56dd1a={'raw':![],'where':{'id':_0x1f65aa[_0x0605('0x32')]['id']}},_0x165a0c={};_0x165a0c[_0x0605('0x33')]=_[_0x0605('0x34')](db[_0x0605('0x35')][_0x0605('0x36')]);_0x165a0c[_0x0605('0x37')]=_[_0x0605('0x34')](_0x1f65aa[_0x0605('0x37')]);_0x165a0c[_0x0605('0x38')]=_[_0x0605('0x39')](_0x165a0c[_0x0605('0x33')],_0x165a0c[_0x0605('0x37')]);_0x56dd1a[_0x0605('0x3a')]=_[_0x0605('0x39')](_0x165a0c[_0x0605('0x33')],qs[_0x0605('0x3b')](_0x1f65aa[_0x0605('0x37')][_0x0605('0x3b')]));_0x56dd1a[_0x0605('0x3a')]=_0x56dd1a[_0x0605('0x3a')][_0x0605('0x3c')]?_0x56dd1a[_0x0605('0x3a')]:_0x165a0c[_0x0605('0x33')];if(_0x1f65aa[_0x0605('0x37')][_0x0605('0x3d')]){_0x56dd1a[_0x0605('0x3e')]=[{'all':!![]}];}_0x56dd1a=_['merge']({},_0x56dd1a,_0x1f65aa[_0x0605('0x3f')]);return db[_0x0605('0x35')]['find'](_0x56dd1a)[_0x0605('0x2c')](handleEntityNotFound(_0x352dd6,null))[_0x0605('0x2c')](respondWithResult(_0x352dd6,null))['catch'](handleError(_0x352dd6,null));};exports[_0x0605('0x2d')]=function(_0x4743b4,_0x239e8f){return db[_0x0605('0x35')][_0x0605('0x40')]({'where':{'id':_0x4743b4[_0x0605('0x32')]['id']}})['then'](handleEntityNotFound(_0x239e8f,null))['then'](removeEntity(_0x239e8f,null))[_0x0605('0x41')](handleError(_0x239e8f,null));};function widgetAttributes(_0x18f7f2){try{switch(_0x18f7f2[_0x0605('0x42')]){case'iframe':return[{'name':_0x0605('0x43'),'value':_0x18f7f2['attrUrl']||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x0]?_0x18f7f2[_0x0605('0x44')][0x0][_0x0605('0x45')]:undefined)||_0x0605('0x46')}];case _0x0605('0x47'):return[{'name':_0x0605('0x48'),'value':_0x18f7f2[_0x0605('0x48')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x0]?_0x18f7f2['attrs'][0x0][_0x0605('0x45')]:undefined)||''}];case'clock':return[{'name':_0x0605('0x49'),'value':_0x18f7f2[_0x0605('0x49')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2['attrs'][0x0]?_0x18f7f2['attrs'][0x0][_0x0605('0x45')]:undefined)||'HH:mm:ss'},{'name':_0x0605('0x4a'),'value':_0x18f7f2[_0x0605('0x4a')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x1]?_0x18f7f2[_0x0605('0x44')][0x1][_0x0605('0x45')]:undefined)||_0x0605('0x4b')},{'name':_0x0605('0x4c'),'value':_0x18f7f2[_0x0605('0x4c')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x2]?_0x18f7f2[_0x0605('0x44')][0x2][_0x0605('0x45')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x18f7f2[_0x0605('0x4d')]||(_0x18f7f2['attrs']&&_0x18f7f2[_0x0605('0x44')][0x0]?_0x18f7f2[_0x0605('0x44')][0x0]['value']:undefined)||_0x0605('0x4e')},{'name':_0x0605('0x4f'),'value':_0x18f7f2['attrVoiceQueues']||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x1]?_0x18f7f2['attrs'][0x1][_0x0605('0x45')]:undefined)||[]},{'name':_0x0605('0x4c'),'value':_0x18f7f2['attrFontSize']||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2['attrs'][0x2]?_0x18f7f2['attrs'][0x2][_0x0605('0x45')]:undefined)||0x14},{'name':_0x0605('0x50'),'value':_0x18f7f2[_0x0605('0x50')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x3]?_0x18f7f2[_0x0605('0x44')][0x3][_0x0605('0x45')]:undefined)||_0x0605('0x51')},{'name':'attrEmailAccounts','value':_0x18f7f2[_0x0605('0x52')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x4]?_0x18f7f2['attrs'][0x4][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x53'),'value':_0x18f7f2[_0x0605('0x53')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x5]?_0x18f7f2[_0x0605('0x44')][0x5][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x54'),'value':_0x18f7f2[_0x0605('0x54')]||(_0x18f7f2['attrs']&&_0x18f7f2[_0x0605('0x44')][0x6]?_0x18f7f2[_0x0605('0x44')][0x6][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x55'),'value':_0x18f7f2[_0x0605('0x55')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x7]?_0x18f7f2[_0x0605('0x44')][0x7][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x56'),'value':_0x18f7f2['attrWhatsappAccounts']||(_0x18f7f2['attrs']&&_0x18f7f2['attrs'][0x8]?_0x18f7f2[_0x0605('0x44')][0x8][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x57'),'value':_0x18f7f2[_0x0605('0x57')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x9]?_0x18f7f2['attrs'][0x9][_0x0605('0x45')]:undefined)||''}];case _0x0605('0x58'):case _0x0605('0x59'):return[{'name':_0x0605('0x5a'),'value':_0x18f7f2['attrSerie1']||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x0]?_0x18f7f2[_0x0605('0x44')][0x0]['value']:undefined)||'total'},{'name':_0x0605('0x5b'),'value':_0x18f7f2[_0x0605('0x5b')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2['attrs'][0x1]?_0x18f7f2['attrs'][0x1][_0x0605('0x45')]:undefined)||null},{'name':'attrSerie3','value':_0x18f7f2[_0x0605('0x5c')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x2]?_0x18f7f2[_0x0605('0x44')][0x2][_0x0605('0x45')]:undefined)||null},{'name':_0x0605('0x4f'),'value':_0x18f7f2[_0x0605('0x4f')]||(_0x18f7f2['attrs']&&_0x18f7f2[_0x0605('0x44')][0x3]?_0x18f7f2['attrs'][0x3][_0x0605('0x45')]:undefined)||[]},{'name':'attrChannel','value':_0x18f7f2[_0x0605('0x50')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x4]?_0x18f7f2[_0x0605('0x44')][0x4]['value']:undefined)||'voice'},{'name':_0x0605('0x52'),'value':_0x18f7f2[_0x0605('0x52')]||(_0x18f7f2['attrs']&&_0x18f7f2['attrs'][0x5]?_0x18f7f2['attrs'][0x5][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x53'),'value':_0x18f7f2[_0x0605('0x53')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x6]?_0x18f7f2[_0x0605('0x44')][0x6]['value']:undefined)||''},{'name':_0x0605('0x54'),'value':_0x18f7f2[_0x0605('0x54')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x7]?_0x18f7f2[_0x0605('0x44')][0x7][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x55'),'value':_0x18f7f2[_0x0605('0x55')]||(_0x18f7f2['attrs']&&_0x18f7f2['attrs'][0x8]?_0x18f7f2['attrs'][0x8][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x56'),'value':_0x18f7f2[_0x0605('0x56')]||(_0x18f7f2['attrs']&&_0x18f7f2['attrs'][0x9]?_0x18f7f2[_0x0605('0x44')][0x9][_0x0605('0x45')]:undefined)||''},{'name':_0x0605('0x57'),'value':_0x18f7f2[_0x0605('0x57')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0xa]?_0x18f7f2[_0x0605('0x44')][0xa][_0x0605('0x45')]:undefined)||''}];case _0x0605('0x5d'):return[{'name':_0x0605('0x5e'),'type':_0x18f7f2[_0x0605('0x5f')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2['attrs'][0x0]?_0x18f7f2[_0x0605('0x44')][0x0][_0x0605('0x42')]:undefined)||null,'value':_0x18f7f2[_0x0605('0x5e')]||(_0x18f7f2[_0x0605('0x44')]&&_0x18f7f2[_0x0605('0x44')][0x0]?_0x18f7f2[_0x0605('0x44')][0x0]['value']:undefined)||null},{'name':_0x0605('0x60'),'value':_0x18f7f2['attrRefresh']||(_0x18f7f2['attrs']&&_0x18f7f2[_0x0605('0x44')][0x1]?_0x18f7f2[_0x0605('0x44')][0x1][_0x0605('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x1d26a3){logger[_0x0605('0x61')](_0x0605('0x62'),JSON[_0x0605('0x63')](_0x1d26a3));return[];}}exports[_0x0605('0x64')]=function(_0x7ac9f0,_0x309da5){if(_0x7ac9f0['body']){_0x7ac9f0['body']['attrs']=widgetAttributes(_0x7ac9f0['body']);}return db['DashboardItem'][_0x0605('0x64')](_0x7ac9f0[_0x0605('0x65')],{})[_0x0605('0x2c')](respondWithResult(_0x309da5,0xc9))['catch'](handleError(_0x309da5,null));};exports[_0x0605('0x2b')]=function(_0x3e3bd7,_0x43d2a6){if(_0x3e3bd7[_0x0605('0x65')]['id']){delete _0x3e3bd7[_0x0605('0x65')]['id'];}_0x3e3bd7[_0x0605('0x65')]['attrs']=widgetAttributes(_0x3e3bd7[_0x0605('0x65')]);return db[_0x0605('0x35')][_0x0605('0x40')]({'where':{'id':_0x3e3bd7['params']['id']}})['then'](handleEntityNotFound(_0x43d2a6,null))['then'](saveUpdates(_0x3e3bd7[_0x0605('0x65')],null))[_0x0605('0x2c')](respondWithResult(_0x43d2a6,null))[_0x0605('0x41')](handleError(_0x43d2a6,null));}; \ No newline at end of file +var _0x4819=['attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie3','web-report','attrReport','attrRefresh','stringify','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../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','./dashboardItem.socket','register','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','show','params','model','keys','filters','query','attributes','intersection','fields','length','includeAll','include','options','find','catch','DashboardItem','type','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x402f6e,_0x30d2df){var _0x31a8dc=function(_0x594553){while(--_0x594553){_0x402f6e['push'](_0x402f6e['shift']());}};_0x31a8dc(++_0x30d2df);}(_0x4819,0xcd));var _0x9481=function(_0x83ee0a,_0x44947d){_0x83ee0a=_0x83ee0a-0x0;var _0x5dc29f=_0x4819[_0x83ee0a];return _0x5dc29f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];config[_0x9481('0x1a')]=_['defaults'](config['redis'],{'host':_0x9481('0x1b'),'port':0x18eb});var socket=require(_0x9481('0x1c'))(new Redis(config[_0x9481('0x1a')]));require(_0x9481('0x1d'))[_0x9481('0x1e')](socket);function respondWithStatusCode(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xcc;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1f')](_0x3fb97f);}return _0xc7a0b5[_0x9481('0x20')](_0x3fb97f)['end']();};}function respondWithResult(_0x2266d5,_0x518150){_0x518150=_0x518150||0xc8;return function(_0x34108d){if(_0x34108d){return _0x2266d5[_0x9481('0x20')](_0x518150)[_0x9481('0x21')](_0x34108d);}};}function respondWithFilteredResult(_0x2bb2a4,_0x546fce){return function(_0x5eda66){if(_0x5eda66){var _0x20473d=typeof _0x546fce['offset']==='undefined'&&typeof _0x546fce[_0x9481('0x22')]===_0x9481('0x23');var _0x18c6f5=_0x5eda66[_0x9481('0x24')];var _0x7000e7=_0x20473d?0x0:_0x546fce[_0x9481('0x25')];var _0x55a1bd=_0x20473d?_0x5eda66[_0x9481('0x24')]:_0x546fce[_0x9481('0x25')]+_0x546fce[_0x9481('0x22')];var _0x615e02;if(_0x55a1bd>=_0x18c6f5){_0x55a1bd=_0x18c6f5;_0x615e02=0xc8;}else{_0x615e02=0xce;}_0x2bb2a4[_0x9481('0x20')](_0x615e02);return _0x2bb2a4['set'](_0x9481('0x26'),_0x7000e7+'-'+_0x55a1bd+'/'+_0x18c6f5)[_0x9481('0x21')](_0x5eda66);}return null;};}function patchUpdates(_0x572599){return function(_0x2bcf37){try{jsonpatch[_0x9481('0x27')](_0x2bcf37,_0x572599,!![]);}catch(_0x352b3a){return BPromise[_0x9481('0x28')](_0x352b3a);}return _0x2bcf37[_0x9481('0x29')]();};}function saveUpdates(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['update'](_0x49ecfa)['then'](function(_0x12b0c3){return _0x12b0c3;});}return null;};}function removeEntity(_0x299e28,_0x550fce){return function(_0x1e6f28){if(_0x1e6f28){return _0x1e6f28[_0x9481('0x2a')]()[_0x9481('0x2b')](function(){_0x299e28[_0x9481('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14f03e,_0x3ca064){return function(_0x3c2585){if(!_0x3c2585){_0x14f03e['sendStatus'](0x194);}return _0x3c2585;};}function handleError(_0x1791b2,_0x56e944){_0x56e944=_0x56e944||0x1f4;return function(_0x2e1eff){logger[_0x9481('0x2c')](_0x2e1eff[_0x9481('0x2d')]);if(_0x2e1eff[_0x9481('0x2e')]){delete _0x2e1eff[_0x9481('0x2e')];}_0x1791b2['status'](_0x56e944)[_0x9481('0x2f')](_0x2e1eff);};}exports[_0x9481('0x30')]=function(_0x46e4ab,_0x4895a0){var _0x56752e={'raw':![],'where':{'id':_0x46e4ab[_0x9481('0x31')]['id']}},_0x1addc8={};_0x1addc8[_0x9481('0x32')]=_[_0x9481('0x33')](db['DashboardItem']['rawAttributes']);_0x1addc8['query']=_[_0x9481('0x33')](_0x46e4ab['query']);_0x1addc8[_0x9481('0x34')]=_['intersection'](_0x1addc8[_0x9481('0x32')],_0x1addc8[_0x9481('0x35')]);_0x56752e[_0x9481('0x36')]=_[_0x9481('0x37')](_0x1addc8[_0x9481('0x32')],qs['fields'](_0x46e4ab[_0x9481('0x35')][_0x9481('0x38')]));_0x56752e[_0x9481('0x36')]=_0x56752e['attributes'][_0x9481('0x39')]?_0x56752e[_0x9481('0x36')]:_0x1addc8[_0x9481('0x32')];if(_0x46e4ab[_0x9481('0x35')][_0x9481('0x3a')]){_0x56752e[_0x9481('0x3b')]=[{'all':!![]}];}_0x56752e=_['merge']({},_0x56752e,_0x46e4ab[_0x9481('0x3c')]);return db['DashboardItem'][_0x9481('0x3d')](_0x56752e)[_0x9481('0x2b')](handleEntityNotFound(_0x4895a0,null))[_0x9481('0x2b')](respondWithResult(_0x4895a0,null))[_0x9481('0x3e')](handleError(_0x4895a0,null));};exports[_0x9481('0x2a')]=function(_0x2face9,_0x541d8b){return db[_0x9481('0x3f')][_0x9481('0x3d')]({'where':{'id':_0x2face9['params']['id']}})['then'](handleEntityNotFound(_0x541d8b,null))[_0x9481('0x2b')](removeEntity(_0x541d8b,null))['catch'](handleError(_0x541d8b,null));};function widgetAttributes(_0x224b88){try{switch(_0x224b88[_0x9481('0x40')]){case _0x9481('0x41'):return[{'name':_0x9481('0x42'),'value':_0x224b88['attrUrl']||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x0]?_0x224b88[_0x9481('0x43')][0x0]['value']:undefined)||_0x9481('0x44')}];case'custom':return[{'name':_0x9481('0x45'),'value':_0x224b88[_0x9481('0x45')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x0]?_0x224b88[_0x9481('0x43')][0x0][_0x9481('0x46')]:undefined)||''}];case _0x9481('0x47'):return[{'name':'attrHourFormat','value':_0x224b88[_0x9481('0x48')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x0]?_0x224b88[_0x9481('0x43')][0x0][_0x9481('0x46')]:undefined)||_0x9481('0x49')},{'name':_0x9481('0x4a'),'value':_0x224b88['attrTimezone']||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x1]?_0x224b88['attrs'][0x1][_0x9481('0x46')]:undefined)||_0x9481('0x4b')},{'name':_0x9481('0x4c'),'value':_0x224b88[_0x9481('0x4c')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x2]?_0x224b88[_0x9481('0x43')][0x2]['value']:undefined)||0xc}];case _0x9481('0x4d'):return[{'name':_0x9481('0x4e'),'value':_0x224b88['attrMetric']||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x0]?_0x224b88[_0x9481('0x43')][0x0][_0x9481('0x46')]:undefined)||'total'},{'name':_0x9481('0x4f'),'value':_0x224b88[_0x9481('0x4f')]||(_0x224b88['attrs']&&_0x224b88['attrs'][0x1]?_0x224b88[_0x9481('0x43')][0x1]['value']:undefined)||[]},{'name':_0x9481('0x4c'),'value':_0x224b88[_0x9481('0x4c')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x2]?_0x224b88[_0x9481('0x43')][0x2]['value']:undefined)||0x14},{'name':_0x9481('0x50'),'value':_0x224b88[_0x9481('0x50')]||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x3]?_0x224b88[_0x9481('0x43')][0x3][_0x9481('0x46')]:undefined)||_0x9481('0x51')},{'name':_0x9481('0x52'),'value':_0x224b88[_0x9481('0x52')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x4]?_0x224b88[_0x9481('0x43')][0x4]['value']:undefined)||''},{'name':_0x9481('0x53'),'value':_0x224b88['attrFaxAccounts']||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x5]?_0x224b88['attrs'][0x5][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x54'),'value':_0x224b88['attrSmsAccounts']||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x6]?_0x224b88[_0x9481('0x43')][0x6][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x55'),'value':_0x224b88[_0x9481('0x55')]||(_0x224b88['attrs']&&_0x224b88['attrs'][0x7]?_0x224b88[_0x9481('0x43')][0x7][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x56'),'value':_0x224b88[_0x9481('0x56')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x8]?_0x224b88[_0x9481('0x43')][0x8][_0x9481('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x224b88[_0x9481('0x57')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x9]?_0x224b88[_0x9481('0x43')][0x9][_0x9481('0x46')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x9481('0x58'),'value':_0x224b88[_0x9481('0x58')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x0]?_0x224b88['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x224b88['attrSerie2']||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x1]?_0x224b88[_0x9481('0x43')][0x1]['value']:undefined)||null},{'name':_0x9481('0x59'),'value':_0x224b88['attrSerie3']||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x2]?_0x224b88[_0x9481('0x43')][0x2][_0x9481('0x46')]:undefined)||null},{'name':_0x9481('0x4f'),'value':_0x224b88[_0x9481('0x4f')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x3]?_0x224b88[_0x9481('0x43')][0x3][_0x9481('0x46')]:undefined)||[]},{'name':'attrChannel','value':_0x224b88[_0x9481('0x50')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x4]?_0x224b88[_0x9481('0x43')][0x4][_0x9481('0x46')]:undefined)||'voice'},{'name':_0x9481('0x52'),'value':_0x224b88[_0x9481('0x52')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x5]?_0x224b88[_0x9481('0x43')][0x5][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x53'),'value':_0x224b88[_0x9481('0x53')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x6]?_0x224b88['attrs'][0x6]['value']:undefined)||''},{'name':_0x9481('0x54'),'value':_0x224b88[_0x9481('0x54')]||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x7]?_0x224b88[_0x9481('0x43')][0x7][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x55'),'value':_0x224b88[_0x9481('0x55')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x8]?_0x224b88['attrs'][0x8][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x56'),'value':_0x224b88[_0x9481('0x56')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x9]?_0x224b88[_0x9481('0x43')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x224b88[_0x9481('0x57')]||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0xa]?_0x224b88['attrs'][0xa][_0x9481('0x46')]:undefined)||''}];case _0x9481('0x5a'):return[{'name':_0x9481('0x5b'),'type':_0x224b88['reportType']||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x0]?_0x224b88['attrs'][0x0]['type']:undefined)||null,'value':_0x224b88['attrReport']||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x0]?_0x224b88['attrs'][0x0][_0x9481('0x46')]:undefined)||null},{'name':_0x9481('0x5c'),'value':_0x224b88[_0x9481('0x5c')]||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x1]?_0x224b88['attrs'][0x1][_0x9481('0x46')]:undefined)||0x0}];default:return[];}}catch(_0xdf1bd9){logger[_0x9481('0x2c')]('widgetAttributes:\x20%s',JSON[_0x9481('0x5d')](_0xdf1bd9));return[];}}exports[_0x9481('0x5e')]=function(_0x4ff016,_0x321972){if(_0x4ff016[_0x9481('0x5f')]){_0x4ff016[_0x9481('0x5f')][_0x9481('0x43')]=widgetAttributes(_0x4ff016[_0x9481('0x5f')]);}return db[_0x9481('0x3f')][_0x9481('0x5e')](_0x4ff016[_0x9481('0x5f')],{})[_0x9481('0x2b')](respondWithResult(_0x321972,0xc9))[_0x9481('0x3e')](handleError(_0x321972,null));};exports[_0x9481('0x60')]=function(_0xc9a414,_0x3daaff){if(_0xc9a414[_0x9481('0x5f')]['id']){delete _0xc9a414[_0x9481('0x5f')]['id'];}_0xc9a414[_0x9481('0x5f')][_0x9481('0x43')]=widgetAttributes(_0xc9a414['body']);return db[_0x9481('0x3f')]['find']({'where':{'id':_0xc9a414['params']['id']}})[_0x9481('0x2b')](handleEntityNotFound(_0x3daaff,null))['then'](saveUpdates(_0xc9a414['body'],null))['then'](respondWithResult(_0x3daaff,null))[_0x9481('0x3e')](handleError(_0x3daaff,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6f44494..4c2a4e3 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 _0xd089=['hook','exports','events','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xd089,0x156));var _0x9d08=function(_0x16a631,_0x15c4ef){_0x16a631=_0x16a631-0x0;var _0x24037f=_0xd089[_0x16a631];return _0x24037f;};'use strict';var EventEmitter=require(_0x9d08('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x9d08('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9d08('0x2')](0x0);var events={'afterCreate':_0x9d08('0x3'),'afterUpdate':_0x9d08('0x4'),'afterDestroy':_0x9d08('0x5')};function emitEvent(_0x4e8a0c){return function(_0x541cdc,_0x549127,_0x15a577){DashboardItemEvents['emit'](_0x4e8a0c+':'+_0x541cdc['id'],_0x541cdc);DashboardItemEvents[_0x9d08('0x6')](_0x4e8a0c,_0x541cdc);_0x15a577(null);};}for(var e in events){if(events[_0x9d08('0x7')](e)){var event=events[e];DashboardItem[_0x9d08('0x8')](e,emitEvent(event));}}module[_0x9d08('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x6e12=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem','update'];(function(_0x2ddd42,_0x39be46){var _0x189dc1=function(_0xab9aac){while(--_0xab9aac){_0x2ddd42['push'](_0x2ddd42['shift']());}};_0x189dc1(++_0x39be46);}(_0x6e12,0xac));var _0x26e1=function(_0x1b1db0,_0x2403da){_0x1b1db0=_0x1b1db0-0x0;var _0x5c5c32=_0x6e12[_0x1b1db0];return _0x5c5c32;};'use strict';var EventEmitter=require(_0x26e1('0x0'));var DashboardItem=require(_0x26e1('0x1'))['db'][_0x26e1('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x26e1('0x3'),'afterDestroy':_0x26e1('0x4')};function emitEvent(_0xdad967){return function(_0x332dd4,_0x4782ed,_0x4dd09c){DashboardItemEvents[_0x26e1('0x5')](_0xdad967+':'+_0x332dd4['id'],_0x332dd4);DashboardItemEvents[_0x26e1('0x5')](_0xdad967,_0x332dd4);_0x4dd09c(null);};}for(var e in events){if(events[_0x26e1('0x6')](e)){var event=events[e];DashboardItem[_0x26e1('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 3748072..c96d769 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 _0x1a14=['define','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x10ff4c,_0x35c7e2){var _0x28bac8=function(_0x5129ba){while(--_0x5129ba){_0x10ff4c['push'](_0x10ff4c['shift']());}};_0x28bac8(++_0x35c7e2);}(_0x1a14,0xce));var _0x41a1=function(_0x448fa9,_0x5ee134){_0x448fa9=_0x448fa9-0x0;var _0x54abe4=_0x1a14[_0x448fa9];return _0x54abe4;};'use strict';var _=require(_0x41a1('0x0'));var util=require(_0x41a1('0x1'));var logger=require(_0x41a1('0x2'))(_0x41a1('0x3'));var moment=require(_0x41a1('0x4'));var BPromise=require(_0x41a1('0x5'));var rp=require(_0x41a1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41a1('0x7'));var config=require(_0x41a1('0x8'));var attributes=require('./dashboardItem.attributes');module[_0x41a1('0x9')]=function(_0xca4ce4,_0x28aa07){return _0xca4ce4[_0x41a1('0xa')]('DashboardItem',attributes,{'tableName':_0x41a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd99d=['dashboard_items','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd99d,0x1ae));var _0xdd99=function(_0x1d1c61,_0x241ab0){_0x1d1c61=_0x1d1c61-0x0;var _0x190333=_0xd99d[_0x1d1c61];return _0x190333;};'use strict';var _=require(_0xdd99('0x0'));var util=require('util');var logger=require(_0xdd99('0x1'))(_0xdd99('0x2'));var moment=require('moment');var BPromise=require(_0xdd99('0x3'));var rp=require(_0xdd99('0x4'));var fs=require('fs');var path=require(_0xdd99('0x5'));var rimraf=require(_0xdd99('0x6'));var config=require(_0xdd99('0x7'));var attributes=require(_0xdd99('0x8'));module[_0xdd99('0x9')]=function(_0x2537e5,_0x30b828){return _0x2537e5[_0xdd99('0xa')](_0xdd99('0xb'),attributes,{'tableName':_0xdd99('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 c94d07a..473d949 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 _0xca7a=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x45e316,_0x22b350){var _0x5e5440=function(_0x2d9c76){while(--_0x2d9c76){_0x45e316['push'](_0x45e316['shift']());}};_0x5e5440(++_0x22b350);}(_0xca7a,0xb4));var _0xaca7=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0xca7a[_0x5e2cb4];return _0x282902;};'use strict';var _=require(_0xaca7('0x0'));var util=require('util');var moment=require(_0xaca7('0x1'));var BPromise=require(_0xaca7('0x2'));var rs=require(_0xaca7('0x3'));var fs=require('fs');var Redis=require(_0xaca7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaca7('0x5'));var logger=require(_0xaca7('0x6'))(_0xaca7('0x7'));var config=require(_0xaca7('0x8'));var jayson=require(_0xaca7('0x9'));var client=jayson[_0xaca7('0xa')]['http']({'port':0x232a});config[_0xaca7('0xb')]=_[_0xaca7('0xc')](config[_0xaca7('0xb')],{'host':_0xaca7('0xd'),'port':0x18eb});var socket=require(_0xaca7('0xe'))(new Redis(config[_0xaca7('0xb')]));require(_0xaca7('0xf'))['register'](socket);function respondWithRpcPromise(_0x4f9654,_0x4a0a6d,_0x3e98b4){return new BPromise(function(_0x522a29,_0x31d125){return client['request'](_0x4f9654,_0x3e98b4)[_0xaca7('0x10')](function(_0x3cb2a4){logger[_0xaca7('0x11')](_0xaca7('0x12'),_0x4a0a6d,_0xaca7('0x13'));logger[_0xaca7('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4a0a6d,_0xaca7('0x13'),JSON[_0xaca7('0x15')](_0x3cb2a4));if(_0x3cb2a4['error']){if(_0x3cb2a4[_0xaca7('0x16')][_0xaca7('0x17')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x4a0a6d,_0x3cb2a4[_0xaca7('0x16')][_0xaca7('0x18')]);return _0x31d125(_0x3cb2a4[_0xaca7('0x16')][_0xaca7('0x18')]);}logger[_0xaca7('0x16')](_0xaca7('0x12'),_0x4a0a6d,_0x3cb2a4[_0xaca7('0x16')][_0xaca7('0x18')]);return _0x522a29(_0x3cb2a4['error'][_0xaca7('0x18')]);}else{logger['info'](_0xaca7('0x12'),_0x4a0a6d,'request\x20sent');_0x522a29(_0x3cb2a4[_0xaca7('0x19')]['message']);}})[_0xaca7('0x1a')](function(_0xd4cf7a){logger[_0xaca7('0x16')](_0xaca7('0x12'),_0x4a0a6d,_0xd4cf7a);_0x31d125(_0xd4cf7a);});});} \ No newline at end of file +var _0x7f48=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s'];(function(_0x187b71,_0x4cfd66){var _0x4566a6=function(_0x45f3c5){while(--_0x45f3c5){_0x187b71['push'](_0x187b71['shift']());}};_0x4566a6(++_0x4cfd66);}(_0x7f48,0xd7));var _0x87f4=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x7f48[_0x1e2080];return _0x260111;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x87f4('0x0'));var BPromise=require(_0x87f4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87f4('0x2'));var db=require(_0x87f4('0x3'))['db'];var utils=require(_0x87f4('0x4'));var logger=require('../../config/logger')(_0x87f4('0x5'));var config=require(_0x87f4('0x6'));var jayson=require(_0x87f4('0x7'));var client=jayson[_0x87f4('0x8')][_0x87f4('0x9')]({'port':0x232a});config[_0x87f4('0xa')]=_[_0x87f4('0xb')](config['redis'],{'host':_0x87f4('0xc'),'port':0x18eb});var socket=require(_0x87f4('0xd'))(new Redis(config[_0x87f4('0xa')]));require(_0x87f4('0xe'))[_0x87f4('0xf')](socket);function respondWithRpcPromise(_0x30662c,_0x3cecab,_0x5976a8){return new BPromise(function(_0x46dc70,_0x1e855f){return client[_0x87f4('0x10')](_0x30662c,_0x5976a8)[_0x87f4('0x11')](function(_0x150501){logger['info'](_0x87f4('0x12'),_0x3cecab,'request\x20sent');logger[_0x87f4('0x13')](_0x87f4('0x14'),_0x3cecab,'request\x20sent',JSON['stringify'](_0x150501));if(_0x150501[_0x87f4('0x15')]){if(_0x150501['error'][_0x87f4('0x16')]===0x1f4){logger[_0x87f4('0x15')](_0x87f4('0x12'),_0x3cecab,_0x150501['error'][_0x87f4('0x17')]);return _0x1e855f(_0x150501[_0x87f4('0x15')][_0x87f4('0x17')]);}logger[_0x87f4('0x15')](_0x87f4('0x12'),_0x3cecab,_0x150501[_0x87f4('0x15')][_0x87f4('0x17')]);return _0x46dc70(_0x150501[_0x87f4('0x15')][_0x87f4('0x17')]);}else{logger['info'](_0x87f4('0x12'),_0x3cecab,_0x87f4('0x18'));_0x46dc70(_0x150501['result'][_0x87f4('0x17')]);}})[_0x87f4('0x19')](function(_0x27a25f){logger[_0x87f4('0x15')](_0x87f4('0x12'),_0x3cecab,_0x27a25f);_0x1e855f(_0x27a25f);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index df71fdf..3fd475a 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 _0x42c0=['remove','update','emit','removeListener','register','dashboardItem:','./dashboardItem.events'];(function(_0x2d9f30,_0x258111){var _0x243932=function(_0x2eca4a){while(--_0x2eca4a){_0x2d9f30['push'](_0x2d9f30['shift']());}};_0x243932(++_0x258111);}(_0x42c0,0x156));var _0x042c=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x42c0[_0x36884e];return _0x1cc367;};'use strict';var DashboardItemEvents=require(_0x042c('0x0'));var events=['save',_0x042c('0x1'),_0x042c('0x2')];function createListener(_0x1cfe9d,_0x4f2c9d){return function(_0x38075b){_0x4f2c9d[_0x042c('0x3')](_0x1cfe9d,_0x38075b);};}function removeListener(_0x186c3b,_0x4d643d){return function(){DashboardItemEvents[_0x042c('0x4')](_0x186c3b,_0x4d643d);};}exports[_0x042c('0x5')]=function(_0xa9f6e0){for(var _0x37466a=0x0,_0x35faac=events['length'];_0x37466a<_0x35faac;_0x37466a++){var _0xd8a0e0=events[_0x37466a];var _0x34d2c1=createListener(_0x042c('0x6')+_0xd8a0e0,_0xa9f6e0);DashboardItemEvents['on'](_0xd8a0e0,_0x34d2c1);}}; \ No newline at end of file +var _0xf464=['save','update','removeListener','register','length','./dashboardItem.events'];(function(_0x41339a,_0x28fdc4){var _0x3fe50a=function(_0x5ebd6f){while(--_0x5ebd6f){_0x41339a['push'](_0x41339a['shift']());}};_0x3fe50a(++_0x28fdc4);}(_0xf464,0xdd));var _0x4f46=function(_0x6c6a89,_0x4468b7){_0x6c6a89=_0x6c6a89-0x0;var _0x182a9f=_0xf464[_0x6c6a89];return _0x182a9f;};'use strict';var DashboardItemEvents=require(_0x4f46('0x0'));var events=[_0x4f46('0x1'),'remove',_0x4f46('0x2')];function createListener(_0x5380af,_0x540f6c){return function(_0x10eb54){_0x540f6c['emit'](_0x5380af,_0x10eb54);};}function removeListener(_0x41868e,_0x47f9f3){return function(){DashboardItemEvents[_0x4f46('0x3')](_0x41868e,_0x47f9f3);};}exports[_0x4f46('0x4')]=function(_0x32e396){for(var _0x43a6a4=0x0,_0x4a05fe=events[_0x4f46('0x5')];_0x43a6a4<_0x4a05fe;_0x43a6a4++){var _0x2855b5=events[_0x43a6a4];var _0x462b25=createListener('dashboardItem:'+_0x2855b5,_0x32e396);DashboardItemEvents['on'](_0x2855b5,_0x462b25);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 6233925..a10abf7 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 _0x70b9=['./dashboardItem.controller','get','/:id','show','post','create','put','update','delete','isAuthenticated','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x70b9,0x1c4));var _0x970b=function(_0x3e5c75,_0x5c05ea){_0x3e5c75=_0x3e5c75-0x0;var _0x44b065=_0x70b9[_0x3e5c75];return _0x44b065;};'use strict';var multer=require(_0x970b('0x0'));var util=require(_0x970b('0x1'));var path=require(_0x970b('0x2'));var timeout=require(_0x970b('0x3'));var express=require(_0x970b('0x4'));var router=express[_0x970b('0x5')]();var fs_extra=require(_0x970b('0x6'));var auth=require(_0x970b('0x7'));var interaction=require(_0x970b('0x8'));var config=require(_0x970b('0x9'));var controller=require(_0x970b('0xa'));router[_0x970b('0xb')](_0x970b('0xc'),auth['isAuthenticated'](),controller[_0x970b('0xd')]);router[_0x970b('0xe')]('/',auth['isAuthenticated'](),controller[_0x970b('0xf')]);router[_0x970b('0x10')](_0x970b('0xc'),auth['isAuthenticated'](),controller[_0x970b('0x11')]);router[_0x970b('0x12')](_0x970b('0xc'),auth[_0x970b('0x13')](),controller[_0x970b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x590a=['post','create','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./dashboardItem.controller','/:id','isAuthenticated','show'];(function(_0x153ecb,_0x1e8c1c){var _0x388094=function(_0x5dabc5){while(--_0x5dabc5){_0x153ecb['push'](_0x153ecb['shift']());}};_0x388094(++_0x1e8c1c);}(_0x590a,0x113));var _0xa590=function(_0x4e1407,_0x368305){_0x4e1407=_0x4e1407-0x0;var _0x69baad=_0x590a[_0x4e1407];return _0x69baad;};'use strict';var multer=require(_0xa590('0x0'));var util=require('util');var path=require(_0xa590('0x1'));var timeout=require(_0xa590('0x2'));var express=require(_0xa590('0x3'));var router=express['Router']();var fs_extra=require(_0xa590('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa590('0x5'));var config=require('../../config/environment');var controller=require(_0xa590('0x6'));router['get'](_0xa590('0x7'),auth[_0xa590('0x8')](),controller[_0xa590('0x9')]);router[_0xa590('0xa')]('/',auth[_0xa590('0x8')](),controller[_0xa590('0xb')]);router[_0xa590('0xc')](_0xa590('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xa590('0xd')](_0xa590('0x7'),auth['isAuthenticated'](),controller[_0xa590('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index bc5cb22..1f82a16 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 _0x9caf=['STRING','sequelize','exports','ENUM','first','second','third'];(function(_0x3ca358,_0x43b25a){var _0x358086=function(_0x1e7785){while(--_0x1e7785){_0x3ca358['push'](_0x3ca358['shift']());}};_0x358086(++_0x43b25a);}(_0x9caf,0x8d));var _0xf9ca=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9caf[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf9ca('0x0'));module[_0xf9ca('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xf9ca('0x2')](_0xf9ca('0x3'),_0xf9ca('0x4'),_0xf9ca('0x5')),'allowNull':![],'defaultValue':_0xf9ca('0x3')},'description':{'type':Sequelize[_0xf9ca('0x6')]}}; \ No newline at end of file +var _0xdde9=['sequelize','exports','STRING','ENUM','second'];(function(_0x2a635c,_0x451c5f){var _0x4e52cc=function(_0x35d1d9){while(--_0x35d1d9){_0x2a635c['push'](_0x2a635c['shift']());}};_0x4e52cc(++_0x451c5f);}(_0xdde9,0x9b));var _0x9dde=function(_0x2e3116,_0x284b68){_0x2e3116=_0x2e3116-0x0;var _0x4d2680=_0xdde9[_0x2e3116];return _0x4d2680;};'use strict';var Sequelize=require(_0x9dde('0x0'));module[_0x9dde('0x1')]={'name':{'type':Sequelize[_0x9dde('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x9dde('0x3')]('first',_0x9dde('0x4'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x9dde('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 44a63a1..c735f54 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 _0xf148=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','Dispositions','end','sendStatus','error','stack','name','send','Disposition','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox'];(function(_0x2375e1,_0x3d125a){var _0x2ccc7d=function(_0x343bb6){while(--_0x343bb6){_0x2375e1['push'](_0x2375e1['shift']());}};_0x2ccc7d(++_0x3d125a);}(_0xf148,0xf4));var _0x8f14=function(_0x30350a,_0x42c85f){_0x30350a=_0x30350a-0x0;var _0x3852ac=_0xf148[_0x30350a];return _0x3852ac;};'use strict';var emlformat=require(_0x8f14('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f14('0x1'));var jsonpatch=require(_0x8f14('0x2'));var rp=require(_0x8f14('0x3'));var moment=require(_0x8f14('0x4'));var BPromise=require(_0x8f14('0x5'));var Mustache=require(_0x8f14('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8f14('0x7'));var csv=require('to-csv');var ejs=require(_0x8f14('0x8'));var fs=require('fs');var fs_extra=require(_0x8f14('0x9'));var _=require(_0x8f14('0xa'));var squel=require(_0x8f14('0xb'));var crypto=require(_0x8f14('0xc'));var jsforce=require(_0x8f14('0xd'));var deskjs=require(_0x8f14('0xe'));var toCsv=require(_0x8f14('0xf'));var querystring=require(_0x8f14('0x10'));var Papa=require(_0x8f14('0x11'));var Redis=require(_0x8f14('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8f14('0x13'));var as=require(_0x8f14('0x14'));var hardwareService=require(_0x8f14('0x15'));var logger=require(_0x8f14('0x16'))(_0x8f14('0x17'));var utils=require(_0x8f14('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8f14('0x19'));var db=require(_0x8f14('0x1a'))['db'];function respondWithStatusCode(_0x1bf977,_0x1650a6){_0x1650a6=_0x1650a6||0xcc;return function(_0x335f98){if(_0x335f98){return _0x1bf977['sendStatus'](_0x1650a6);}return _0x1bf977['status'](_0x1650a6)['end']();};}function respondWithResult(_0x41f2c0,_0x156785){_0x156785=_0x156785||0xc8;return function(_0x3f261c){if(_0x3f261c){return _0x41f2c0[_0x8f14('0x1b')](_0x156785)['json'](_0x3f261c);}};}function respondWithFilteredResult(_0x5d53e6,_0x85bc1){return function(_0x5406db){if(_0x5406db){var _0x25becd=typeof _0x85bc1[_0x8f14('0x1c')]==='undefined'&&typeof _0x85bc1[_0x8f14('0x1d')]==='undefined';var _0x449bd2=_0x5406db[_0x8f14('0x1e')];var _0x1e9893=_0x25becd?0x0:_0x85bc1[_0x8f14('0x1c')];var _0x9b2815=_0x25becd?_0x5406db[_0x8f14('0x1e')]:_0x85bc1[_0x8f14('0x1c')]+_0x85bc1[_0x8f14('0x1d')];var _0x2dafe3;if(_0x9b2815>=_0x449bd2){_0x9b2815=_0x449bd2;_0x2dafe3=0xc8;}else{_0x2dafe3=0xce;}_0x5d53e6[_0x8f14('0x1b')](_0x2dafe3);return _0x5d53e6[_0x8f14('0x1f')](_0x8f14('0x20'),_0x1e9893+'-'+_0x9b2815+'/'+_0x449bd2)[_0x8f14('0x21')](_0x5406db);}return null;};}function patchUpdates(_0x6e87e2){return function(_0x483e43){try{jsonpatch[_0x8f14('0x22')](_0x483e43,_0x6e87e2,!![]);}catch(_0x4fa5f8){return BPromise[_0x8f14('0x23')](_0x4fa5f8);}return _0x483e43[_0x8f14('0x24')]();};}function saveUpdates(_0x2cf89f,_0x50f470){return function(_0x19fca5){if(_0x19fca5){return _0x19fca5[_0x8f14('0x25')](_0x2cf89f)[_0x8f14('0x26')](function(_0x3bb1b9){return _0x3bb1b9;});}return null;};}function removeEntity(_0x4979a0,_0x1f72f2){return function(_0x1e58d7){if(_0x1e58d7){return _0x1e58d7[_0x8f14('0x27')]()[_0x8f14('0x26')](function(){var _0x3a1259=_0x1e58d7['get']({'plain':!![]});var _0x2014ed=_0x8f14('0x28');return db['UserProfileResource'][_0x8f14('0x27')]({'where':{'type':_0x2014ed,'resourceId':_0x3a1259['id']}})[_0x8f14('0x26')](function(){return _0x1e58d7;});})[_0x8f14('0x26')](function(){_0x4979a0[_0x8f14('0x1b')](0xcc)[_0x8f14('0x29')]();});}};}function handleEntityNotFound(_0x493fa8,_0x56db72){return function(_0x2ee83e){if(!_0x2ee83e){_0x493fa8[_0x8f14('0x2a')](0x194);}return _0x2ee83e;};}function handleError(_0x563b19,_0xe892f7){_0xe892f7=_0xe892f7||0x1f4;return function(_0x63b512){logger[_0x8f14('0x2b')](_0x63b512[_0x8f14('0x2c')]);if(_0x63b512[_0x8f14('0x2d')]){delete _0x63b512[_0x8f14('0x2d')];}_0x563b19[_0x8f14('0x1b')](_0xe892f7)[_0x8f14('0x2e')](_0x63b512);};}exports['index']=function(_0x4673b6,_0x5a4e76){var _0x2cc24d={},_0x571551={},_0x5b3004={'count':0x0,'rows':[]};var _0x26f84f=_['map'](db[_0x8f14('0x2f')]['rawAttributes'],function(_0x7d4472){return{'name':_0x7d4472[_0x8f14('0x30')],'type':_0x7d4472[_0x8f14('0x31')]['key']};});_0x571551[_0x8f14('0x32')]=_[_0x8f14('0x33')](_0x26f84f,_0x8f14('0x2d'));_0x571551[_0x8f14('0x34')]=_[_0x8f14('0x35')](_0x4673b6['query']);_0x571551[_0x8f14('0x36')]=_[_0x8f14('0x37')](_0x571551[_0x8f14('0x32')],_0x571551[_0x8f14('0x34')]);_0x2cc24d[_0x8f14('0x38')]=_[_0x8f14('0x37')](_0x571551[_0x8f14('0x32')],qs['fields'](_0x4673b6[_0x8f14('0x34')]['fields']));_0x2cc24d[_0x8f14('0x38')]=_0x2cc24d[_0x8f14('0x38')][_0x8f14('0x39')]?_0x2cc24d[_0x8f14('0x38')]:_0x571551[_0x8f14('0x32')];if(!_0x4673b6[_0x8f14('0x34')][_0x8f14('0x3a')](_0x8f14('0x3b'))){_0x2cc24d[_0x8f14('0x1d')]=qs['limit'](_0x4673b6[_0x8f14('0x34')][_0x8f14('0x1d')]);_0x2cc24d['offset']=qs[_0x8f14('0x1c')](_0x4673b6['query'][_0x8f14('0x1c')]);}_0x2cc24d['order']=qs['sort'](_0x4673b6[_0x8f14('0x34')][_0x8f14('0x3c')]);_0x2cc24d['where']=qs['filters'](_[_0x8f14('0x3d')](_0x4673b6['query'],_0x571551[_0x8f14('0x36')]),_0x26f84f);if(_0x4673b6[_0x8f14('0x34')][_0x8f14('0x3e')]){_0x2cc24d['where']=_[_0x8f14('0x3f')](_0x2cc24d[_0x8f14('0x40')],{'$or':_[_0x8f14('0x33')](_0x26f84f,function(_0x344ed8){if(_0x344ed8[_0x8f14('0x31')]!=='VIRTUAL'){var _0x5c925b={};_0x5c925b[_0x344ed8[_0x8f14('0x2d')]]={'$like':'%'+_0x4673b6[_0x8f14('0x34')][_0x8f14('0x3e')]+'%'};return _0x5c925b;}})});}_0x2cc24d=_[_0x8f14('0x3f')]({},_0x2cc24d,_0x4673b6[_0x8f14('0x41')]);var _0x52838a={'where':_0x2cc24d[_0x8f14('0x40')]};return db['Disposition']['count'](_0x52838a)[_0x8f14('0x26')](function(_0x1ee254){_0x5b3004[_0x8f14('0x1e')]=_0x1ee254;if(_0x4673b6[_0x8f14('0x34')][_0x8f14('0x42')]){_0x2cc24d[_0x8f14('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x8f14('0x44')](_0x2cc24d);})[_0x8f14('0x26')](function(_0x229c1b){_0x5b3004['rows']=_0x229c1b;return _0x5b3004;})['then'](respondWithFilteredResult(_0x5a4e76,_0x2cc24d))[_0x8f14('0x45')](handleError(_0x5a4e76,null));};exports[_0x8f14('0x46')]=function(_0x2502f6,_0x4540b3){var _0x49b518={'raw':!![],'where':{'id':_0x2502f6[_0x8f14('0x47')]['id']}},_0x44eb3e={};_0x44eb3e[_0x8f14('0x32')]=_[_0x8f14('0x35')](db[_0x8f14('0x2f')]['rawAttributes']);_0x44eb3e[_0x8f14('0x34')]=_[_0x8f14('0x35')](_0x2502f6[_0x8f14('0x34')]);_0x44eb3e['filters']=_[_0x8f14('0x37')](_0x44eb3e[_0x8f14('0x32')],_0x44eb3e[_0x8f14('0x34')]);_0x49b518[_0x8f14('0x38')]=_[_0x8f14('0x37')](_0x44eb3e[_0x8f14('0x32')],qs[_0x8f14('0x48')](_0x2502f6[_0x8f14('0x34')][_0x8f14('0x48')]));_0x49b518['attributes']=_0x49b518[_0x8f14('0x38')]['length']?_0x49b518[_0x8f14('0x38')]:_0x44eb3e[_0x8f14('0x32')];if(_0x2502f6['query'][_0x8f14('0x42')]){_0x49b518[_0x8f14('0x43')]=[{'all':!![]}];}_0x49b518=_[_0x8f14('0x3f')]({},_0x49b518,_0x2502f6[_0x8f14('0x41')]);return db[_0x8f14('0x2f')][_0x8f14('0x49')](_0x49b518)[_0x8f14('0x26')](handleEntityNotFound(_0x4540b3,null))[_0x8f14('0x26')](respondWithResult(_0x4540b3,null))[_0x8f14('0x45')](handleError(_0x4540b3,null));};exports[_0x8f14('0x4a')]=function(_0x4872e4,_0x503d42){return db[_0x8f14('0x2f')][_0x8f14('0x4a')](_0x4872e4[_0x8f14('0x4b')],{})['then'](function(_0x506f60){var _0x3816e9=_0x4872e4[_0x8f14('0x4c')][_0x8f14('0x4d')]({'plain':!![]});if(!_0x3816e9)throw new Error(_0x8f14('0x4e'));if(_0x3816e9[_0x8f14('0x4f')]===_0x8f14('0x4c')){var _0x3fdab6=_0x506f60[_0x8f14('0x4d')]({'plain':!![]});var _0x23cc1f=_0x8f14('0x28');return db[_0x8f14('0x50')][_0x8f14('0x49')]({'where':{'name':_0x23cc1f,'userProfileId':_0x3816e9[_0x8f14('0x51')]},'raw':!![]})[_0x8f14('0x26')](function(_0x3711ac){if(_0x3711ac&&_0x3711ac[_0x8f14('0x52')]===0x0){return db[_0x8f14('0x53')]['create']({'name':_0x3fdab6[_0x8f14('0x2d')],'resourceId':_0x3fdab6['id'],'type':_0x3711ac['name'],'sectionId':_0x3711ac['id']},{})[_0x8f14('0x26')](function(){return _0x506f60;});}else{return _0x506f60;}})[_0x8f14('0x45')](function(_0x54f846){logger[_0x8f14('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54f846);throw _0x54f846;});}return _0x506f60;})['then'](respondWithResult(_0x503d42,0xc9))[_0x8f14('0x45')](handleError(_0x503d42,null));};exports[_0x8f14('0x25')]=function(_0x1fed77,_0x1150f7){if(_0x1fed77[_0x8f14('0x4b')]['id']){delete _0x1fed77[_0x8f14('0x4b')]['id'];}return db['Disposition'][_0x8f14('0x49')]({'where':{'id':_0x1fed77[_0x8f14('0x47')]['id']}})[_0x8f14('0x26')](handleEntityNotFound(_0x1150f7,null))[_0x8f14('0x26')](saveUpdates(_0x1fed77[_0x8f14('0x4b')],null))[_0x8f14('0x26')](respondWithResult(_0x1150f7,null))[_0x8f14('0x45')](handleError(_0x1150f7,null));};exports['destroy']=function(_0x4b51de,_0x2cc78c){return db['Disposition']['find']({'where':{'id':_0x4b51de['params']['id']}})[_0x8f14('0x26')](handleEntityNotFound(_0x2cc78c,null))[_0x8f14('0x26')](removeEntity(_0x2cc78c,null))[_0x8f14('0x45')](handleError(_0x2cc78c,null));}; \ No newline at end of file +var _0x2384=['moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','Dispositions','UserProfileResource','error','stack','name','send','index','Disposition','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x5cc136,_0x5a2c2e){var _0x1b4ff7=function(_0xcc19f7){while(--_0xcc19f7){_0x5cc136['push'](_0x5cc136['shift']());}};_0x1b4ff7(++_0x5a2c2e);}(_0x2384,0x1aa));var _0x4238=function(_0x9a99cc,_0x489c4f){_0x9a99cc=_0x9a99cc-0x0;var _0x2a8d2f=_0x2384[_0x9a99cc];return _0x2a8d2f;};'use strict';var emlformat=require(_0x4238('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4238('0x1'));var jsonpatch=require(_0x4238('0x2'));var rp=require(_0x4238('0x3'));var moment=require(_0x4238('0x4'));var BPromise=require(_0x4238('0x5'));var Mustache=require('mustache');var util=require(_0x4238('0x6'));var path=require('path');var sox=require(_0x4238('0x7'));var csv=require(_0x4238('0x8'));var ejs=require(_0x4238('0x9'));var fs=require('fs');var fs_extra=require(_0x4238('0xa'));var _=require(_0x4238('0xb'));var squel=require(_0x4238('0xc'));var crypto=require(_0x4238('0xd'));var jsforce=require(_0x4238('0xe'));var deskjs=require(_0x4238('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4238('0x10'));var Papa=require(_0x4238('0x11'));var Redis=require('ioredis');var authService=require(_0x4238('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4238('0x13'));var logger=require(_0x4238('0x14'))(_0x4238('0x15'));var utils=require(_0x4238('0x16'));var config=require(_0x4238('0x17'));var licenseUtil=require(_0x4238('0x18'));var db=require(_0x4238('0x19'))['db'];function respondWithStatusCode(_0x22d54a,_0x121264){_0x121264=_0x121264||0xcc;return function(_0x43841f){if(_0x43841f){return _0x22d54a[_0x4238('0x1a')](_0x121264);}return _0x22d54a[_0x4238('0x1b')](_0x121264)[_0x4238('0x1c')]();};}function respondWithResult(_0xd0ec7,_0x360b56){_0x360b56=_0x360b56||0xc8;return function(_0x2cc41c){if(_0x2cc41c){return _0xd0ec7['status'](_0x360b56)[_0x4238('0x1d')](_0x2cc41c);}};}function respondWithFilteredResult(_0x3afc0a,_0x55540f){return function(_0x468875){if(_0x468875){var _0x40c89f=typeof _0x55540f[_0x4238('0x1e')]==='undefined'&&typeof _0x55540f[_0x4238('0x1f')]===_0x4238('0x20');var _0x384361=_0x468875['count'];var _0x49e9ce=_0x40c89f?0x0:_0x55540f[_0x4238('0x1e')];var _0x4c24b6=_0x40c89f?_0x468875[_0x4238('0x21')]:_0x55540f[_0x4238('0x1e')]+_0x55540f[_0x4238('0x1f')];var _0x210f86;if(_0x4c24b6>=_0x384361){_0x4c24b6=_0x384361;_0x210f86=0xc8;}else{_0x210f86=0xce;}_0x3afc0a[_0x4238('0x1b')](_0x210f86);return _0x3afc0a[_0x4238('0x22')](_0x4238('0x23'),_0x49e9ce+'-'+_0x4c24b6+'/'+_0x384361)['json'](_0x468875);}return null;};}function patchUpdates(_0x44afc0){return function(_0x125072){try{jsonpatch[_0x4238('0x24')](_0x125072,_0x44afc0,!![]);}catch(_0x383392){return BPromise['reject'](_0x383392);}return _0x125072[_0x4238('0x25')]();};}function saveUpdates(_0x125107,_0x3816ce){return function(_0x39e021){if(_0x39e021){return _0x39e021['update'](_0x125107)[_0x4238('0x26')](function(_0x381e1f){return _0x381e1f;});}return null;};}function removeEntity(_0x4371c2,_0xc2f2fb){return function(_0x3b8352){if(_0x3b8352){return _0x3b8352['destroy']()[_0x4238('0x26')](function(){var _0xded23f=_0x3b8352['get']({'plain':!![]});var _0xc765e6=_0x4238('0x27');return db[_0x4238('0x28')]['destroy']({'where':{'type':_0xc765e6,'resourceId':_0xded23f['id']}})[_0x4238('0x26')](function(){return _0x3b8352;});})['then'](function(){_0x4371c2[_0x4238('0x1b')](0xcc)[_0x4238('0x1c')]();});}};}function handleEntityNotFound(_0x23d1d2,_0x36e41a){return function(_0x3fc5d0){if(!_0x3fc5d0){_0x23d1d2[_0x4238('0x1a')](0x194);}return _0x3fc5d0;};}function handleError(_0x4c5a35,_0x3e3d0a){_0x3e3d0a=_0x3e3d0a||0x1f4;return function(_0x2d68a9){logger[_0x4238('0x29')](_0x2d68a9[_0x4238('0x2a')]);if(_0x2d68a9[_0x4238('0x2b')]){delete _0x2d68a9['name'];}_0x4c5a35['status'](_0x3e3d0a)[_0x4238('0x2c')](_0x2d68a9);};}exports[_0x4238('0x2d')]=function(_0x3c8d70,_0x5482d4){var _0x33c58f={},_0x4a51c6={},_0x112954={'count':0x0,'rows':[]};var _0x3f2bef=_['map'](db[_0x4238('0x2e')][_0x4238('0x2f')],function(_0x484953){return{'name':_0x484953[_0x4238('0x30')],'type':_0x484953['type'][_0x4238('0x31')]};});_0x4a51c6[_0x4238('0x32')]=_['map'](_0x3f2bef,'name');_0x4a51c6['query']=_[_0x4238('0x33')](_0x3c8d70[_0x4238('0x34')]);_0x4a51c6['filters']=_[_0x4238('0x35')](_0x4a51c6['model'],_0x4a51c6[_0x4238('0x34')]);_0x33c58f[_0x4238('0x36')]=_['intersection'](_0x4a51c6[_0x4238('0x32')],qs[_0x4238('0x37')](_0x3c8d70[_0x4238('0x34')][_0x4238('0x37')]));_0x33c58f[_0x4238('0x36')]=_0x33c58f[_0x4238('0x36')][_0x4238('0x38')]?_0x33c58f[_0x4238('0x36')]:_0x4a51c6['model'];if(!_0x3c8d70[_0x4238('0x34')][_0x4238('0x39')](_0x4238('0x3a'))){_0x33c58f[_0x4238('0x1f')]=qs[_0x4238('0x1f')](_0x3c8d70[_0x4238('0x34')][_0x4238('0x1f')]);_0x33c58f[_0x4238('0x1e')]=qs['offset'](_0x3c8d70[_0x4238('0x34')][_0x4238('0x1e')]);}_0x33c58f[_0x4238('0x3b')]=qs[_0x4238('0x3c')](_0x3c8d70['query'][_0x4238('0x3c')]);_0x33c58f[_0x4238('0x3d')]=qs[_0x4238('0x3e')](_[_0x4238('0x3f')](_0x3c8d70[_0x4238('0x34')],_0x4a51c6['filters']),_0x3f2bef);if(_0x3c8d70[_0x4238('0x34')][_0x4238('0x40')]){_0x33c58f[_0x4238('0x3d')]=_[_0x4238('0x41')](_0x33c58f['where'],{'$or':_[_0x4238('0x42')](_0x3f2bef,function(_0x435e4c){if(_0x435e4c['type']!==_0x4238('0x43')){var _0x531e15={};_0x531e15[_0x435e4c['name']]={'$like':'%'+_0x3c8d70['query'][_0x4238('0x40')]+'%'};return _0x531e15;}})});}_0x33c58f=_[_0x4238('0x41')]({},_0x33c58f,_0x3c8d70[_0x4238('0x44')]);var _0x3af6d9={'where':_0x33c58f[_0x4238('0x3d')]};return db['Disposition'][_0x4238('0x21')](_0x3af6d9)[_0x4238('0x26')](function(_0x184b9d){_0x112954[_0x4238('0x21')]=_0x184b9d;if(_0x3c8d70[_0x4238('0x34')][_0x4238('0x45')]){_0x33c58f[_0x4238('0x46')]=[{'all':!![]}];}return db['Disposition'][_0x4238('0x47')](_0x33c58f);})[_0x4238('0x26')](function(_0x324f31){_0x112954[_0x4238('0x48')]=_0x324f31;return _0x112954;})['then'](respondWithFilteredResult(_0x5482d4,_0x33c58f))[_0x4238('0x49')](handleError(_0x5482d4,null));};exports[_0x4238('0x4a')]=function(_0x3d7d1b,_0x580eb3){var _0x2f54ab={'raw':!![],'where':{'id':_0x3d7d1b[_0x4238('0x4b')]['id']}},_0xffb567={};_0xffb567[_0x4238('0x32')]=_[_0x4238('0x33')](db[_0x4238('0x2e')][_0x4238('0x2f')]);_0xffb567['query']=_['keys'](_0x3d7d1b['query']);_0xffb567[_0x4238('0x3e')]=_[_0x4238('0x35')](_0xffb567[_0x4238('0x32')],_0xffb567['query']);_0x2f54ab[_0x4238('0x36')]=_['intersection'](_0xffb567['model'],qs['fields'](_0x3d7d1b['query'][_0x4238('0x37')]));_0x2f54ab[_0x4238('0x36')]=_0x2f54ab[_0x4238('0x36')][_0x4238('0x38')]?_0x2f54ab[_0x4238('0x36')]:_0xffb567[_0x4238('0x32')];if(_0x3d7d1b[_0x4238('0x34')][_0x4238('0x45')]){_0x2f54ab['include']=[{'all':!![]}];}_0x2f54ab=_[_0x4238('0x41')]({},_0x2f54ab,_0x3d7d1b[_0x4238('0x44')]);return db[_0x4238('0x2e')]['find'](_0x2f54ab)[_0x4238('0x26')](handleEntityNotFound(_0x580eb3,null))[_0x4238('0x26')](respondWithResult(_0x580eb3,null))[_0x4238('0x49')](handleError(_0x580eb3,null));};exports[_0x4238('0x4c')]=function(_0x2c1c2d,_0x20f5fd){return db['Disposition'][_0x4238('0x4c')](_0x2c1c2d['body'],{})[_0x4238('0x26')](function(_0x304238){var _0x3ce701=_0x2c1c2d[_0x4238('0x4d')][_0x4238('0x4e')]({'plain':!![]});if(!_0x3ce701)throw new Error(_0x4238('0x4f'));if(_0x3ce701[_0x4238('0x50')]==='user'){var _0x550c70=_0x304238[_0x4238('0x4e')]({'plain':!![]});var _0x34e816=_0x4238('0x27');return db[_0x4238('0x51')]['find']({'where':{'name':_0x34e816,'userProfileId':_0x3ce701['userProfileId']},'raw':!![]})['then'](function(_0x465ab3){if(_0x465ab3&&_0x465ab3['autoAssociation']===0x0){return db[_0x4238('0x28')]['create']({'name':_0x550c70[_0x4238('0x2b')],'resourceId':_0x550c70['id'],'type':_0x465ab3[_0x4238('0x2b')],'sectionId':_0x465ab3['id']},{})[_0x4238('0x26')](function(){return _0x304238;});}else{return _0x304238;}})[_0x4238('0x49')](function(_0x2e9b19){logger[_0x4238('0x29')](_0x4238('0x52'),_0x2e9b19);throw _0x2e9b19;});}return _0x304238;})[_0x4238('0x26')](respondWithResult(_0x20f5fd,0xc9))[_0x4238('0x49')](handleError(_0x20f5fd,null));};exports['update']=function(_0x21d14f,_0x2d6f2e){if(_0x21d14f[_0x4238('0x53')]['id']){delete _0x21d14f[_0x4238('0x53')]['id'];}return db[_0x4238('0x2e')][_0x4238('0x54')]({'where':{'id':_0x21d14f[_0x4238('0x4b')]['id']}})[_0x4238('0x26')](handleEntityNotFound(_0x2d6f2e,null))['then'](saveUpdates(_0x21d14f[_0x4238('0x53')],null))[_0x4238('0x26')](respondWithResult(_0x2d6f2e,null))[_0x4238('0x49')](handleError(_0x2d6f2e,null));};exports[_0x4238('0x55')]=function(_0x696d65,_0x327ee0){return db[_0x4238('0x2e')][_0x4238('0x54')]({'where':{'id':_0x696d65[_0x4238('0x4b')]['id']}})[_0x4238('0x26')](handleEntityNotFound(_0x327ee0,null))['then'](removeEntity(_0x327ee0,null))[_0x4238('0x49')](handleError(_0x327ee0,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2f1648b..0149515 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 _0x8495=['name_openchannel','name_whatsapp','WhatsappAccountId','util','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_fax','FaxAccountId'];(function(_0x7eed46,_0x3f1be6){var _0xb791c5=function(_0x8c10cb){while(--_0x8c10cb){_0x7eed46['push'](_0x7eed46['shift']());}};_0xb791c5(++_0x3f1be6);}(_0x8495,0x8f));var _0x5849=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x8495[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require('lodash');var util=require(_0x5849('0x0'));var logger=require('../../config/logger')(_0x5849('0x1'));var moment=require(_0x5849('0x2'));var BPromise=require(_0x5849('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5849('0x4'));var rimraf=require(_0x5849('0x5'));var config=require(_0x5849('0x6'));var attributes=require(_0x5849('0x7'));module[_0x5849('0x8')]=function(_0x5c915a,_0x4df3a0){return _0x5c915a[_0x5849('0x9')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x5849('0xa'),_0x5849('0xb')]},{'unique':!![],'name':'name_chat','fields':['name',_0x5849('0xc')]},{'unique':!![],'name':_0x5849('0xd'),'fields':[_0x5849('0xa'),_0x5849('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0x5849('0xa'),'SmsAccountId']},{'unique':!![],'name':_0x5849('0xf'),'fields':['name',_0x5849('0x10')]},{'unique':!![],'name':_0x5849('0x11'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x5849('0x12'),'fields':[_0x5849('0xa'),_0x5849('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd529=['bluebird','request-promise','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd529,0x6a));var _0x9d52=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd529[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x9d52('0x0'));var util=require('util');var logger=require(_0x9d52('0x1'))(_0x9d52('0x2'));var moment=require(_0x9d52('0x3'));var BPromise=require(_0x9d52('0x4'));var rp=require(_0x9d52('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d52('0x6'));module['exports']=function(_0xb46874,_0x3e1cc7){return _0xb46874[_0x9d52('0x7')](_0x9d52('0x8'),attributes,{'tableName':_0x9d52('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9d52('0xa'),'fields':[_0x9d52('0xb'),'ListId']},{'unique':!![],'name':_0x9d52('0xc'),'fields':[_0x9d52('0xb'),_0x9d52('0xd')]},{'unique':!![],'name':_0x9d52('0xe'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x9d52('0xf'),'fields':[_0x9d52('0xb'),_0x9d52('0x10')]},{'unique':!![],'name':_0x9d52('0x11'),'fields':[_0x9d52('0xb'),'FaxAccountId']},{'unique':!![],'name':_0x9d52('0x12'),'fields':[_0x9d52('0xb'),_0x9d52('0x13')]},{'unique':!![],'name':_0x9d52('0x14'),'fields':['name',_0x9d52('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index e4cd740..6f526bb 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(_0x24792f,_0x55e3e3){var _0x565c98=function(_0x259ae7){while(--_0x259ae7){_0x24792f['push'](_0x24792f['shift']());}};_0x565c98(++_0x55e3e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x6c704c,_0x1501ac){var _0x542f27=function(_0x4402e){while(--_0x4402e){_0x6c704c['push'](_0x6c704c['shift']());}};_0x542f27(++_0x1501ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 5549d1b..cdf09e4 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 _0x436f=['isAuthenticated','index','/:id','show','post','create','put','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x516bd9,_0xc46059){var _0x3b71f9=function(_0x2b5bfd){while(--_0x2b5bfd){_0x516bd9['push'](_0x516bd9['shift']());}};_0x3b71f9(++_0xc46059);}(_0x436f,0xf2));var _0xf436=function(_0xfdc376,_0x291a4d){_0xfdc376=_0xfdc376-0x0;var _0x9fda8f=_0x436f[_0xfdc376];return _0x9fda8f;};'use strict';var multer=require(_0xf436('0x0'));var util=require(_0xf436('0x1'));var path=require(_0xf436('0x2'));var timeout=require('connect-timeout');var express=require(_0xf436('0x3'));var router=express['Router']();var fs_extra=require(_0xf436('0x4'));var auth=require(_0xf436('0x5'));var interaction=require(_0xf436('0x6'));var config=require(_0xf436('0x7'));var controller=require(_0xf436('0x8'));router[_0xf436('0x9')]('/',auth[_0xf436('0xa')](),controller[_0xf436('0xb')]);router[_0xf436('0x9')](_0xf436('0xc'),auth[_0xf436('0xa')](),controller[_0xf436('0xd')]);router[_0xf436('0xe')]('/',auth[_0xf436('0xa')](),controller[_0xf436('0xf')]);router[_0xf436('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf436('0xa')](),controller[_0xf436('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5c03=['./disposition.controller','get','isAuthenticated','index','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x54a229,_0x479dd1){var _0x36232e=function(_0x48a4d3){while(--_0x48a4d3){_0x54a229['push'](_0x54a229['shift']());}};_0x36232e(++_0x479dd1);}(_0x5c03,0x174));var _0x35c0=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x5c03[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x35c0('0x0'));var util=require(_0x35c0('0x1'));var path=require('path');var timeout=require(_0x35c0('0x2'));var express=require('express');var router=express[_0x35c0('0x3')]();var fs_extra=require(_0x35c0('0x4'));var auth=require(_0x35c0('0x5'));var interaction=require(_0x35c0('0x6'));var config=require(_0x35c0('0x7'));var controller=require(_0x35c0('0x8'));router[_0x35c0('0x9')]('/',auth[_0x35c0('0xa')](),controller[_0x35c0('0xb')]);router[_0x35c0('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x35c0('0xa')](),controller[_0x35c0('0xc')]);router[_0x35c0('0xd')]('/:id',auth[_0x35c0('0xa')](),controller[_0x35c0('0xe')]);router[_0x35c0('0xf')](_0x35c0('0x10'),auth[_0x35c0('0xa')](),controller[_0x35c0('0x11')]);module[_0x35c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 62ad843..39657aa 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 _0xc1c6=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','9600','12000','14400','2400','v17,v27,v29','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5e743f,_0x3924f5){_0x5e743f=_0x5e743f-0x0;var _0x334a1f=_0xc1c6[_0x5e743f];return _0x334a1f;};'use strict';var Sequelize=require(_0x6c1c('0x0'));module[_0x6c1c('0x1')]={'name':{'type':Sequelize[_0x6c1c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x6c1c('0x3')]('yes','no'),'defaultValue':_0x6c1c('0x4')},'headerinfo':{'type':Sequelize[_0x6c1c('0x2')],'defaultValue':_0x6c1c('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x6c1c('0x3')]('2400',_0x6c1c('0x6'),'7200',_0x6c1c('0x7'),_0x6c1c('0x8'),_0x6c1c('0x9')),'defaultValue':_0x6c1c('0x6')},'maxrate':{'type':Sequelize['ENUM'](_0x6c1c('0xa'),_0x6c1c('0x6'),'7200',_0x6c1c('0x7'),_0x6c1c('0x8'),_0x6c1c('0x9')),'defaultValue':_0x6c1c('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x6c1c('0xb')},'gateway':{'type':Sequelize[_0x6c1c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6c1c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6c1c('0x3')](_0x6c1c('0xc'),_0x6c1c('0xd'),'DADHI',_0x6c1c('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x6c1c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6c1c('0xf')],'defaultValue':function(){return _0x6c1c('0x10');}},'notificationSound':{'type':Sequelize[_0x6c1c('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6c1c('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6c1c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6c1c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6c1c('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6c1c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6c1c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c1c('0x12')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6c1c('0x11')],'defaultValue':![],'comment':_0x6c1c('0x13'),'set':function(_0x494ffc){if(!_0x494ffc)this[_0x6c1c('0x14')]('mandatoryDispositionPauseId',null);this[_0x6c1c('0x14')](_0x6c1c('0x15'),_0x494ffc);}}}; \ No newline at end of file +var _0x2c8f=['IAX','DADHI','KHOMP','SIP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','yes','STRING','localstationid','ENUM','2400','4800','7200','12000','14400','9600','v17,v27,v29'];(function(_0xd0f198,_0x44e8a6){var _0x3afa4f=function(_0x106f6e){while(--_0x106f6e){_0xd0f198['push'](_0xd0f198['shift']());}};_0x3afa4f(++_0x44e8a6);}(_0x2c8f,0x192));var _0xf2c8=function(_0x2949be,_0xf8dd34){_0x2949be=_0x2949be-0x0;var _0x4cf0bc=_0x2c8f[_0x2949be];return _0x4cf0bc;};'use strict';var Sequelize=require('sequelize');module[_0xf2c8('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0xf2c8('0x1'),'no'),'defaultValue':_0xf2c8('0x1')},'headerinfo':{'type':Sequelize[_0xf2c8('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0xf2c8('0x3')},'minrate':{'type':Sequelize[_0xf2c8('0x4')](_0xf2c8('0x5'),_0xf2c8('0x6'),_0xf2c8('0x7'),'9600',_0xf2c8('0x8'),_0xf2c8('0x9')),'defaultValue':_0xf2c8('0x6')},'maxrate':{'type':Sequelize[_0xf2c8('0x4')](_0xf2c8('0x5'),_0xf2c8('0x6'),'7200',_0xf2c8('0xa'),_0xf2c8('0x8'),_0xf2c8('0x9')),'defaultValue':_0xf2c8('0x9')},'modem':{'type':Sequelize[_0xf2c8('0x2')],'defaultValue':_0xf2c8('0xb')},'gateway':{'type':Sequelize[_0xf2c8('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf2c8('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf2c8('0x4')]('SIP',_0xf2c8('0xc'),_0xf2c8('0xd'),_0xf2c8('0xe')),'defaultValue':_0xf2c8('0xf')},'key':{'type':Sequelize[_0xf2c8('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf2c8('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf2c8('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf2c8('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf2c8('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf2c8('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf2c8('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf2c8('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf2c8('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf2c8('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0xf2c8('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xf2c8('0x11')],'defaultValue':![],'comment':_0xf2c8('0x14'),'set':function(_0xe1ec71){if(!_0xe1ec71)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xf2c8('0x15')](_0xf2c8('0x16'),_0xe1ec71);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9e47b3e..5c252d7 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 _0x2152=['model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','params','rawAttributes','length','includeAll','create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','include','rows','removeDispositions','ids','addAnswer','CannedAnswer','addInteraction','getInteractions','FaxInteraction','Owner','fullname','internal','Tag','Tags','color','tag','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','exten','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','localstationid','gateway','faxdetect','maxrate','minrate','modem','FAXOPT(','Wait','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','List','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','offset','limit','undefined','count','status','Content-Range','json','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','type','key'];(function(_0x2e937e,_0x925b29){var _0xb9cb1b=function(_0x3fea3a){while(--_0x3fea3a){_0x2e937e['push'](_0x2e937e['shift']());}};_0xb9cb1b(++_0x925b29);}(_0x2152,0x7d));var _0x2215=function(_0x109faf,_0x441fcd){_0x109faf=_0x109faf-0x0;var _0x391286=_0x2152[_0x109faf];return _0x391286;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2215('0x0'));var zipdir=require(_0x2215('0x1'));var jsonpatch=require(_0x2215('0x2'));var rp=require(_0x2215('0x3'));var moment=require(_0x2215('0x4'));var BPromise=require(_0x2215('0x5'));var Mustache=require('mustache');var util=require(_0x2215('0x6'));var path=require(_0x2215('0x7'));var sox=require('sox');var csv=require(_0x2215('0x8'));var ejs=require(_0x2215('0x9'));var fs=require('fs');var fs_extra=require(_0x2215('0xa'));var _=require(_0x2215('0xb'));var squel=require(_0x2215('0xc'));var crypto=require(_0x2215('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2215('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2215('0xf'));var Papa=require(_0x2215('0x10'));var Redis=require(_0x2215('0x11'));var authService=require(_0x2215('0x12'));var qs=require(_0x2215('0x13'));var as=require(_0x2215('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2215('0x15'));var utils=require('../../config/utils');var config=require(_0x2215('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2215('0x17'))['db'];config['redis']=_[_0x2215('0x18')](config['redis'],{'host':_0x2215('0x19'),'port':0x18eb});var socket=require(_0x2215('0x1a'))(new Redis(config['redis']));require(_0x2215('0x1b'))[_0x2215('0x1c')](socket);var jayson=require(_0x2215('0x1d'));var client=jayson[_0x2215('0x1e')][_0x2215('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x2215('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1d7956,_0x5f19a7,_0x5bed6a,_0x5847cf){return new BPromise(function(_0x5b9e06,_0x3f6342){var _0x423067=_0x5847cf||client;return _0x423067['request'](_0x1d7956,_0x5bed6a)[_0x2215('0x20')](function(_0x21e6fa){logger[_0x2215('0x21')]('FaxAccount,\x20%s,\x20%s',_0x5f19a7,_0x2215('0x22'));logger[_0x2215('0x23')](_0x2215('0x24'),_0x5f19a7,'request\x20sent',JSON[_0x2215('0x25')](_0x21e6fa));if(_0x21e6fa['error']){if(_0x21e6fa[_0x2215('0x26')]['code']===0x1f4){logger['error'](_0x2215('0x27'),_0x5f19a7,_0x21e6fa['error']['message']);return _0x3f6342(_0x21e6fa[_0x2215('0x26')][_0x2215('0x28')]);}logger[_0x2215('0x26')](_0x2215('0x27'),_0x5f19a7,_0x21e6fa['error'][_0x2215('0x28')]);return _0x5b9e06(_0x21e6fa[_0x2215('0x26')][_0x2215('0x28')]);}else{logger[_0x2215('0x21')](_0x2215('0x27'),_0x5f19a7,_0x2215('0x22'));_0x5b9e06(_0x21e6fa[_0x2215('0x29')]['message']);}})[_0x2215('0x2a')](function(_0xf2185a){logger[_0x2215('0x26')](_0x2215('0x27'),_0x5f19a7,_0xf2185a);_0x3f6342(_0xf2185a);});});}function respondWithStatusCode(_0x54d9a8,_0x27c177){_0x27c177=_0x27c177||0xcc;return function(_0x37a588){if(_0x37a588){return _0x54d9a8[_0x2215('0x2b')](_0x27c177);}return _0x54d9a8['status'](_0x27c177)[_0x2215('0x2c')]();};}function respondWithResult(_0x46f078,_0x3d2332){_0x3d2332=_0x3d2332||0xc8;return function(_0x4ac92c){if(_0x4ac92c){return _0x46f078['status'](_0x3d2332)['json'](_0x4ac92c);}};}function respondWithFilteredResult(_0x46771e,_0x34e1cf){return function(_0x426bda){if(_0x426bda){var _0x32283b=typeof _0x34e1cf[_0x2215('0x2d')]==='undefined'&&typeof _0x34e1cf[_0x2215('0x2e')]===_0x2215('0x2f');var _0x5b93e8=_0x426bda[_0x2215('0x30')];var _0x2bebd7=_0x32283b?0x0:_0x34e1cf[_0x2215('0x2d')];var _0x547bef=_0x32283b?_0x426bda[_0x2215('0x30')]:_0x34e1cf[_0x2215('0x2d')]+_0x34e1cf[_0x2215('0x2e')];var _0x32d9d3;if(_0x547bef>=_0x5b93e8){_0x547bef=_0x5b93e8;_0x32d9d3=0xc8;}else{_0x32d9d3=0xce;}_0x46771e[_0x2215('0x31')](_0x32d9d3);return _0x46771e['set'](_0x2215('0x32'),_0x2bebd7+'-'+_0x547bef+'/'+_0x5b93e8)[_0x2215('0x33')](_0x426bda);}return null;};}function patchUpdates(_0x3b2237){return function(_0x442fc3){try{jsonpatch[_0x2215('0x34')](_0x442fc3,_0x3b2237,!![]);}catch(_0x451a30){return BPromise[_0x2215('0x35')](_0x451a30);}return _0x442fc3[_0x2215('0x36')]();};}function saveUpdates(_0x10a459,_0x5a135a){return function(_0x2fff3f){if(_0x2fff3f){return _0x2fff3f[_0x2215('0x37')](_0x10a459)[_0x2215('0x20')](function(_0x5d86ee){return _0x5d86ee;});}return null;};}function removeEntity(_0x3e2585,_0x5df41a){return function(_0x4fc7d1){if(_0x4fc7d1){return _0x4fc7d1[_0x2215('0x38')]()[_0x2215('0x20')](function(){var _0x186185=_0x4fc7d1[_0x2215('0x39')]({'plain':!![]});var _0x112e9a=_0x2215('0x3a');return db[_0x2215('0x3b')][_0x2215('0x38')]({'where':{'type':_0x112e9a,'resourceId':_0x186185['id']}})[_0x2215('0x20')](function(){return _0x4fc7d1;});})[_0x2215('0x20')](function(){_0x3e2585[_0x2215('0x31')](0xcc)[_0x2215('0x2c')]();});}};}function handleEntityNotFound(_0x5f0aab,_0x3424a2){return function(_0x1f71c3){if(!_0x1f71c3){_0x5f0aab[_0x2215('0x2b')](0x194);}return _0x1f71c3;};}function handleError(_0x5072e2,_0x16f364){_0x16f364=_0x16f364||0x1f4;return function(_0x38f2d3){logger[_0x2215('0x26')](_0x38f2d3[_0x2215('0x3c')]);if(_0x38f2d3[_0x2215('0x3d')]){delete _0x38f2d3[_0x2215('0x3d')];}_0x5072e2[_0x2215('0x31')](_0x16f364)[_0x2215('0x3e')](_0x38f2d3);};}exports[_0x2215('0x3f')]=function(_0x190244,_0x458aaf){var _0x217cd3={'include':[{'model':db[_0x2215('0x40')],'as':_0x2215('0x41')}]},_0x43ca28={},_0x3e2562={'count':0x0,'rows':[]};var _0x1627d5=_[_0x2215('0x42')](db[_0x2215('0x43')]['rawAttributes'],function(_0x128497){return{'name':_0x128497['fieldName'],'type':_0x128497[_0x2215('0x44')][_0x2215('0x45')]};});_0x43ca28[_0x2215('0x46')]=_['map'](_0x1627d5,_0x2215('0x3d'));_0x43ca28['query']=_[_0x2215('0x47')](_0x190244[_0x2215('0x48')]);_0x43ca28[_0x2215('0x49')]=_['intersection'](_0x43ca28[_0x2215('0x46')],_0x43ca28[_0x2215('0x48')]);_0x217cd3['attributes']=_[_0x2215('0x4a')](_0x43ca28['model'],qs[_0x2215('0x4b')](_0x190244[_0x2215('0x48')][_0x2215('0x4b')]));_0x217cd3[_0x2215('0x4c')]=_0x217cd3['attributes']['length']?_0x217cd3['attributes']:_0x43ca28[_0x2215('0x46')];if(!_0x190244['query'][_0x2215('0x4d')](_0x2215('0x4e'))){_0x217cd3[_0x2215('0x2e')]=qs[_0x2215('0x2e')](_0x190244[_0x2215('0x48')][_0x2215('0x2e')]);_0x217cd3[_0x2215('0x2d')]=qs[_0x2215('0x2d')](_0x190244[_0x2215('0x48')][_0x2215('0x2d')]);}_0x217cd3[_0x2215('0x4f')]=qs['sort'](_0x190244['query'][_0x2215('0x50')]);_0x217cd3['where']=qs[_0x2215('0x49')](_[_0x2215('0x51')](_0x190244[_0x2215('0x48')],_0x43ca28[_0x2215('0x49')]),_0x1627d5);if(_0x190244[_0x2215('0x48')][_0x2215('0x52')]){_0x217cd3[_0x2215('0x53')]=_[_0x2215('0x54')](_0x217cd3['where'],{'$or':_[_0x2215('0x42')](_0x1627d5,function(_0x18158d){if(_0x18158d[_0x2215('0x44')]!==_0x2215('0x55')){var _0x5e966b={};_0x5e966b[_0x18158d['name']]={'$like':'%'+_0x190244[_0x2215('0x48')][_0x2215('0x52')]+'%'};return _0x5e966b;}})});}_0x217cd3=_['merge']({},_0x217cd3,_0x190244[_0x2215('0x56')]);var _0x57d06a={'where':_0x217cd3[_0x2215('0x53')]};return db['FaxAccount'][_0x2215('0x30')](_0x57d06a)[_0x2215('0x20')](function(_0x2fcaf1){_0x3e2562[_0x2215('0x30')]=_0x2fcaf1;if(_0x190244['query']['includeAll']){_0x217cd3['include']=[{'all':!![]}];}return db[_0x2215('0x43')][_0x2215('0x57')](_0x217cd3);})[_0x2215('0x20')](function(_0xe237a8){_0x3e2562['rows']=_0xe237a8;return _0x3e2562;})[_0x2215('0x20')](respondWithFilteredResult(_0x458aaf,_0x217cd3))['catch'](handleError(_0x458aaf,null));};exports['show']=function(_0xafebb8,_0x158d67){var _0xd3474c={'raw':![],'where':{'id':_0xafebb8[_0x2215('0x58')]['id']},'include':[{'model':db[_0x2215('0x40')],'as':_0x2215('0x41')}]},_0x2f7d8b={};_0x2f7d8b[_0x2215('0x46')]=_['keys'](db[_0x2215('0x43')][_0x2215('0x59')]);_0x2f7d8b['query']=_['keys'](_0xafebb8[_0x2215('0x48')]);_0x2f7d8b[_0x2215('0x49')]=_[_0x2215('0x4a')](_0x2f7d8b['model'],_0x2f7d8b[_0x2215('0x48')]);_0xd3474c[_0x2215('0x4c')]=_[_0x2215('0x4a')](_0x2f7d8b[_0x2215('0x46')],qs[_0x2215('0x4b')](_0xafebb8[_0x2215('0x48')][_0x2215('0x4b')]));_0xd3474c['attributes']=_0xd3474c[_0x2215('0x4c')][_0x2215('0x5a')]?_0xd3474c[_0x2215('0x4c')]:_0x2f7d8b['model'];if(_0xafebb8['query'][_0x2215('0x5b')]){_0xd3474c['include']=[{'all':!![]}];}_0xd3474c=_[_0x2215('0x54')]({},_0xd3474c,_0xafebb8[_0x2215('0x56')]);return db[_0x2215('0x43')]['find'](_0xd3474c)[_0x2215('0x20')](handleEntityNotFound(_0x158d67,null))[_0x2215('0x20')](respondWithResult(_0x158d67,null))[_0x2215('0x2a')](handleError(_0x158d67,null));};exports[_0x2215('0x5c')]=function(_0xe4710d,_0x1b8e62){return db['FaxAccount']['create'](_0xe4710d[_0x2215('0x5d')],{})[_0x2215('0x20')](function(_0x9c33a5){var _0x483204=_0xe4710d[_0x2215('0x5e')][_0x2215('0x39')]({'plain':!![]});if(!_0x483204)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x483204[_0x2215('0x5f')]===_0x2215('0x5e')){var _0x254e86=_0x9c33a5[_0x2215('0x39')]({'plain':!![]});var _0x15756c='FaxAccounts';return db[_0x2215('0x60')][_0x2215('0x61')]({'where':{'name':_0x15756c,'userProfileId':_0x483204['userProfileId']},'raw':!![]})[_0x2215('0x20')](function(_0x4bd3a1){if(_0x4bd3a1&&_0x4bd3a1[_0x2215('0x62')]===0x0){return db[_0x2215('0x3b')][_0x2215('0x5c')]({'name':_0x254e86[_0x2215('0x3d')],'resourceId':_0x254e86['id'],'type':_0x4bd3a1[_0x2215('0x3d')],'sectionId':_0x4bd3a1['id']},{})[_0x2215('0x20')](function(){return _0x9c33a5;});}else{return _0x9c33a5;}})['catch'](function(_0x592671){logger[_0x2215('0x26')](_0x2215('0x63'),_0x592671);throw _0x592671;});}return _0x9c33a5;})[_0x2215('0x20')](respondWithResult(_0x1b8e62,0xc9))['catch'](handleError(_0x1b8e62,null));};exports[_0x2215('0x37')]=function(_0x1cf377,_0x41431a){if(_0x1cf377[_0x2215('0x5d')]['id']){delete _0x1cf377[_0x2215('0x5d')]['id'];}return db[_0x2215('0x43')][_0x2215('0x61')]({'where':{'id':_0x1cf377[_0x2215('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x2215('0x41')}]})[_0x2215('0x20')](handleEntityNotFound(_0x41431a,null))[_0x2215('0x20')](saveUpdates(_0x1cf377['body'],null))[_0x2215('0x20')](respondWithResult(_0x41431a,null))['catch'](handleError(_0x41431a,null));};exports[_0x2215('0x38')]=function(_0x26fdea,_0x369530){return db[_0x2215('0x43')][_0x2215('0x61')]({'where':{'id':_0x26fdea[_0x2215('0x58')]['id']}})[_0x2215('0x20')](handleEntityNotFound(_0x369530,null))['then'](removeEntity(_0x369530,null))['catch'](handleError(_0x369530,null));};exports[_0x2215('0x64')]=function(_0x3c737c,_0x55577d){return db['FaxAccount'][_0x2215('0x64')]()[_0x2215('0x20')](respondWithResult(_0x55577d,null))['catch'](handleError(_0x55577d,null));};exports[_0x2215('0x65')]=function(_0x1e9cfc,_0x5d7de9,_0x50333f){if(_0x1e9cfc['body']['id']){delete _0x1e9cfc['body']['id'];}return db[_0x2215('0x43')]['find']({'where':{'id':_0x1e9cfc[_0x2215('0x58')]['id']}})[_0x2215('0x20')](handleEntityNotFound(_0x5d7de9,null))[_0x2215('0x20')](function(_0x4e3fda){if(_0x4e3fda){_0x1e9cfc[_0x2215('0x5d')]['FaxAccountId']=_0x4e3fda['id'];return db[_0x2215('0x66')][_0x2215('0x5c')](_0x1e9cfc['body']);}})['then'](respondWithResult(_0x5d7de9,null))[_0x2215('0x2a')](handleError(_0x5d7de9,null));};exports[_0x2215('0x67')]=function(_0x2cbc67,_0x47b699,_0x323114){var _0x25238e={'raw':![],'where':{}};var _0x1d5bd1={};var _0x547c95={'count':0x0,'rows':[]};return db[_0x2215('0x43')][_0x2215('0x68')]({'where':{'id':_0x2cbc67[_0x2215('0x58')]['id']}})[_0x2215('0x20')](handleEntityNotFound(_0x47b699,null))[_0x2215('0x20')](function(_0x27b094){if(_0x27b094){_0x1d5bd1['model']=_[_0x2215('0x47')](db['Disposition'][_0x2215('0x59')]);_0x1d5bd1[_0x2215('0x48')]=_[_0x2215('0x47')](_0x2cbc67[_0x2215('0x48')]);_0x1d5bd1[_0x2215('0x49')]=_['intersection'](_0x1d5bd1[_0x2215('0x46')],_0x1d5bd1[_0x2215('0x48')]);_0x25238e[_0x2215('0x4c')]=_['intersection'](_0x1d5bd1[_0x2215('0x46')],qs[_0x2215('0x4b')](_0x2cbc67['query'][_0x2215('0x4b')]));_0x25238e[_0x2215('0x4c')]=_0x25238e[_0x2215('0x4c')]['length']?_0x25238e[_0x2215('0x4c')]:_0x1d5bd1[_0x2215('0x46')];if(!_0x2cbc67['query'][_0x2215('0x4d')](_0x2215('0x4e'))){_0x25238e[_0x2215('0x2e')]=qs[_0x2215('0x2e')](_0x2cbc67[_0x2215('0x48')][_0x2215('0x2e')]);_0x25238e['offset']=qs[_0x2215('0x2d')](_0x2cbc67[_0x2215('0x48')]['offset']);}_0x25238e[_0x2215('0x4f')]=qs[_0x2215('0x50')](_0x2cbc67[_0x2215('0x48')][_0x2215('0x50')]);_0x25238e['where']=qs[_0x2215('0x49')](_[_0x2215('0x51')](_0x2cbc67['query'],_0x1d5bd1['filters']));_0x25238e[_0x2215('0x53')][_0x2215('0x69')]=_0x27b094['id'];if(_0x2cbc67[_0x2215('0x48')]['filter']){_0x25238e[_0x2215('0x53')]=_[_0x2215('0x54')](_0x25238e[_0x2215('0x53')],{'$or':_[_0x2215('0x42')](_0x25238e['attributes'],function(_0x1d223b){var _0x2c0461={};_0x2c0461[_0x1d223b]={'$like':'%'+_0x2cbc67[_0x2215('0x48')][_0x2215('0x52')]+'%'};return _0x2c0461;})});}_0x25238e=_['merge']({},_0x25238e,_0x2cbc67[_0x2215('0x56')]);return db[_0x2215('0x66')][_0x2215('0x30')]({'where':_0x25238e[_0x2215('0x53')]})[_0x2215('0x20')](function(_0x45f40d){_0x547c95[_0x2215('0x30')]=_0x45f40d;if(_0x2cbc67[_0x2215('0x48')]['includeAll']){_0x25238e[_0x2215('0x6a')]=[{'all':!![]}];}return db[_0x2215('0x66')][_0x2215('0x57')](_0x25238e);})[_0x2215('0x20')](function(_0x4adaf1){_0x547c95[_0x2215('0x6b')]=_0x4adaf1;return _0x547c95;});}})[_0x2215('0x20')](respondWithFilteredResult(_0x47b699,_0x25238e))[_0x2215('0x2a')](handleError(_0x47b699,null));};exports[_0x2215('0x6c')]=function(_0x67de9b,_0x410fb0,_0x140944){return db[_0x2215('0x43')][_0x2215('0x61')]({'where':{'id':_0x67de9b[_0x2215('0x58')]['id']}})[_0x2215('0x20')](handleEntityNotFound(_0x410fb0,null))[_0x2215('0x20')](function(_0x58bf45){if(_0x58bf45){return _0x58bf45[_0x2215('0x6c')](_0x67de9b[_0x2215('0x48')][_0x2215('0x6d')]);}})[_0x2215('0x20')](respondWithStatusCode(_0x410fb0,null))['catch'](handleError(_0x410fb0,null));};exports[_0x2215('0x6e')]=function(_0x383b4c,_0x39cb4e,_0x27d89c){if(_0x383b4c['body']['id']){delete _0x383b4c['body']['id'];}return db[_0x2215('0x43')]['find']({'where':{'id':_0x383b4c[_0x2215('0x58')]['id']}})[_0x2215('0x20')](handleEntityNotFound(_0x39cb4e,null))[_0x2215('0x20')](function(_0x4406c8){if(_0x4406c8){_0x383b4c[_0x2215('0x5d')][_0x2215('0x69')]=_0x4406c8['id'];return db[_0x2215('0x6f')][_0x2215('0x5c')](_0x383b4c['body']);}})[_0x2215('0x20')](respondWithResult(_0x39cb4e,null))[_0x2215('0x2a')](handleError(_0x39cb4e,null));};exports['getAnswers']=function(_0x1182f2,_0xf7880d,_0x38985d){var _0x20152d={'raw':![],'where':{}};var _0x143f41={};var _0x3e2dee={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2215('0x68')]({'where':{'id':_0x1182f2[_0x2215('0x58')]['id']}})['then'](handleEntityNotFound(_0xf7880d,null))['then'](function(_0x2e6da3){if(_0x2e6da3){_0x143f41[_0x2215('0x46')]=_[_0x2215('0x47')](db[_0x2215('0x6f')][_0x2215('0x59')]);_0x143f41['query']=_[_0x2215('0x47')](_0x1182f2[_0x2215('0x48')]);_0x143f41[_0x2215('0x49')]=_['intersection'](_0x143f41[_0x2215('0x46')],_0x143f41[_0x2215('0x48')]);_0x20152d['attributes']=_['intersection'](_0x143f41[_0x2215('0x46')],qs[_0x2215('0x4b')](_0x1182f2[_0x2215('0x48')]['fields']));_0x20152d[_0x2215('0x4c')]=_0x20152d[_0x2215('0x4c')][_0x2215('0x5a')]?_0x20152d[_0x2215('0x4c')]:_0x143f41[_0x2215('0x46')];if(!_0x1182f2[_0x2215('0x48')][_0x2215('0x4d')](_0x2215('0x4e'))){_0x20152d[_0x2215('0x2e')]=qs['limit'](_0x1182f2[_0x2215('0x48')][_0x2215('0x2e')]);_0x20152d[_0x2215('0x2d')]=qs[_0x2215('0x2d')](_0x1182f2[_0x2215('0x48')][_0x2215('0x2d')]);}_0x20152d[_0x2215('0x4f')]=qs[_0x2215('0x50')](_0x1182f2[_0x2215('0x48')]['sort']);_0x20152d[_0x2215('0x53')]=qs['filters'](_[_0x2215('0x51')](_0x1182f2[_0x2215('0x48')],_0x143f41[_0x2215('0x49')]));_0x20152d['where'][_0x2215('0x69')]=_0x2e6da3['id'];if(_0x1182f2[_0x2215('0x48')][_0x2215('0x52')]){_0x20152d[_0x2215('0x53')]=_[_0x2215('0x54')](_0x20152d[_0x2215('0x53')],{'$or':_[_0x2215('0x42')](_0x20152d[_0x2215('0x4c')],function(_0x4a67c8){var _0x249349={};_0x249349[_0x4a67c8]={'$like':'%'+_0x1182f2[_0x2215('0x48')]['filter']+'%'};return _0x249349;})});}_0x20152d=_[_0x2215('0x54')]({},_0x20152d,_0x1182f2[_0x2215('0x56')]);return db[_0x2215('0x6f')][_0x2215('0x30')]({'where':_0x20152d[_0x2215('0x53')]})[_0x2215('0x20')](function(_0x5771f4){_0x3e2dee[_0x2215('0x30')]=_0x5771f4;if(_0x1182f2[_0x2215('0x48')][_0x2215('0x5b')]){_0x20152d[_0x2215('0x6a')]=[{'all':!![]}];}return db[_0x2215('0x6f')][_0x2215('0x57')](_0x20152d);})[_0x2215('0x20')](function(_0x3f603d){_0x3e2dee[_0x2215('0x6b')]=_0x3f603d;return _0x3e2dee;});}})['then'](respondWithFilteredResult(_0xf7880d,_0x20152d))['catch'](handleError(_0xf7880d,null));};exports['removeAnswers']=function(_0x5a6cef,_0x4c1f5d,_0x4204a2){return db[_0x2215('0x43')]['find']({'where':{'id':_0x5a6cef[_0x2215('0x58')]['id']}})['then'](handleEntityNotFound(_0x4c1f5d,null))[_0x2215('0x20')](function(_0x3d6625){if(_0x3d6625){return _0x3d6625['removeAnswers'](_0x5a6cef[_0x2215('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x4c1f5d,null))[_0x2215('0x2a')](handleError(_0x4c1f5d,null));};exports[_0x2215('0x70')]=function(_0x56aa90,_0x35d29d,_0x5ce843){return db['FaxInteraction'][_0x2215('0x61')]({'where':{'id':_0x56aa90['params']['id']}})[_0x2215('0x20')](handleEntityNotFound(_0x35d29d,null))[_0x2215('0x20')](function(_0x7e6946){if(_0x7e6946){return _0x7e6946[_0x2215('0x70')](_0x56aa90[_0x2215('0x5d')][_0x2215('0x6d')],_['omit'](_0x56aa90[_0x2215('0x5d')],[_0x2215('0x6d'),'id'])||{});}})[_0x2215('0x20')](respondWithResult(_0x35d29d,null))['catch'](handleError(_0x35d29d,null));};exports[_0x2215('0x71')]=function(_0x2b5cd1,_0x4b4d8a,_0x3eab31){var _0x12536f={'raw':![],'where':{}};var _0x11216e={};var _0x1a54b1={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2b5cd1[_0x2215('0x58')]['id']}})[_0x2215('0x20')](handleEntityNotFound(_0x4b4d8a,null))[_0x2215('0x20')](function(_0x55d1b0){if(_0x55d1b0){_0x11216e['model']=_['keys'](db[_0x2215('0x72')]['rawAttributes']);_0x11216e[_0x2215('0x48')]=_[_0x2215('0x47')](_0x2b5cd1['query']);_0x11216e[_0x2215('0x49')]=_[_0x2215('0x4a')](_0x11216e[_0x2215('0x46')],_0x11216e[_0x2215('0x48')]);_0x12536f['attributes']=_[_0x2215('0x4a')](_0x11216e[_0x2215('0x46')],qs[_0x2215('0x4b')](_0x2b5cd1[_0x2215('0x48')][_0x2215('0x4b')]));_0x12536f[_0x2215('0x4c')]=_0x12536f['attributes'][_0x2215('0x5a')]?_0x12536f[_0x2215('0x4c')]:_0x11216e['model'];if(!_0x2b5cd1[_0x2215('0x48')]['hasOwnProperty'](_0x2215('0x4e'))){_0x12536f['limit']=qs[_0x2215('0x2e')](_0x2b5cd1[_0x2215('0x48')]['limit']);_0x12536f[_0x2215('0x2d')]=qs['offset'](_0x2b5cd1['query'][_0x2215('0x2d')]);}_0x12536f[_0x2215('0x4f')]=qs[_0x2215('0x50')](_0x2b5cd1['query'][_0x2215('0x50')]);_0x12536f[_0x2215('0x53')]=qs['filters'](_[_0x2215('0x51')](_0x2b5cd1[_0x2215('0x48')],_0x11216e[_0x2215('0x49')]));_0x12536f[_0x2215('0x53')][_0x2215('0x69')]=_0x55d1b0['id'];if(_0x2b5cd1[_0x2215('0x48')][_0x2215('0x52')]){_0x12536f[_0x2215('0x53')]=_[_0x2215('0x54')](_0x12536f[_0x2215('0x53')],{'$or':_[_0x2215('0x42')](_0x12536f[_0x2215('0x4c')],function(_0x3dcf19){var _0x4ea2e6={};_0x4ea2e6[_0x3dcf19]={'$like':'%'+_0x2b5cd1[_0x2215('0x48')][_0x2215('0x52')]+'%'};return _0x4ea2e6;})});}_0x12536f=_[_0x2215('0x54')]({},_0x12536f,_0x2b5cd1[_0x2215('0x56')]);return db[_0x2215('0x72')][_0x2215('0x30')]({'where':_0x12536f[_0x2215('0x53')]})['then'](function(_0x1ec3b5){_0x1a54b1[_0x2215('0x30')]=_0x1ec3b5;if(_0x2b5cd1['query'][_0x2215('0x5b')]){_0x12536f[_0x2215('0x6a')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x2215('0x73'),'attributes':['name',_0x2215('0x74'),_0x2215('0x75')],'required':![]},{'model':db[_0x2215('0x76')],'as':_0x2215('0x77'),'attributes':['id',_0x2215('0x3d'),_0x2215('0x78')],'where':_0x2b5cd1['query'][_0x2215('0x79')]?{'id':_0x2b5cd1[_0x2215('0x48')][_0x2215('0x79')]}:undefined,'required':_0x2b5cd1[_0x2215('0x48')][_0x2215('0x79')]?!![]:![]}];}return db[_0x2215('0x72')]['findAll'](_0x12536f);})['then'](function(_0x2d8075){_0x1a54b1[_0x2215('0x6b')]=_0x2d8075;return _0x1a54b1;});}})[_0x2215('0x20')](respondWithFilteredResult(_0x4b4d8a,_0x12536f))[_0x2215('0x2a')](handleError(_0x4b4d8a,null));};exports['addApplications']=function(_0x2bfef0,_0x28cace){var _0xdf9aa9=_0x2bfef0[_0x2215('0x58')]['id'];var _0x28f640=_0x2bfef0['body'];var _0x4a90a2=0xc8;var _0x2b873b=null;return db['sequelize'][_0x2215('0x7a')]({'isolationLevel':db['sequelize'][_0x2215('0x7b')][_0x2215('0x7c')][_0x2215('0x7d')]},function(_0x4f5f61){return db['FaxAccount']['findOne']({'where':{'id':_0xdf9aa9},'transaction':_0x4f5f61})[_0x2215('0x20')](function(_0x15b4a6){if(_0x15b4a6){return db[_0x2215('0x7e')][_0x2215('0x38')]({'where':{'FaxAccountId':_0xdf9aa9},'transaction':_0x4f5f61})[_0x2215('0x20')](function(){var _0x2cc2b9=_['map'](_0x28f640,function(_0x446481){_0x446481['FaxAccountId']=_0xdf9aa9;return _0x446481;});return db[_0x2215('0x7e')][_0x2215('0x7f')](_0x2cc2b9,{'transaction':_0x4f5f61});});}else{_0x4a90a2=0x194;_0x2b873b=[];}});})[_0x2215('0x20')](function(){if(_0x4a90a2!==0x194){return db[_0x2215('0x7e')]['findAndCountAll']({'where':{'FaxAccountId':_0xdf9aa9},'order':_0x2215('0x80')})[_0x2215('0x20')](function(_0x30fb38){_0x2b873b=_0x30fb38;});}})['catch'](function(_0x528d86){_0x4a90a2=0x1f4;logger[_0x2215('0x26')](_0x528d86['stack']);if(_0x528d86[_0x2215('0x3d')]){delete _0x528d86[_0x2215('0x3d')];}_0x2b873b=_0x528d86;})[_0x2215('0x81')](function(){if(_0x2b873b===null){_0x28cace['sendStatus'](_0x4a90a2);}else{if(_0x4a90a2===0x1f4){_0x28cace['status'](_0x4a90a2)['send'](_0x2b873b);}else{_0x28cace[_0x2215('0x31')](_0x4a90a2)[_0x2215('0x33')](_0x2b873b);}}});};exports[_0x2215('0x82')]=function(_0xce550a,_0x90a5b,_0x4328b5){var _0x13a7e1={};var _0x59513c={};var _0x44a817;var _0x3f84a6;return db['FaxAccount'][_0x2215('0x68')]({'where':{'id':_0xce550a['params']['id']}})[_0x2215('0x20')](handleEntityNotFound(_0x90a5b,null))[_0x2215('0x20')](function(_0x1eab0e){if(_0x1eab0e){_0x44a817=_0x1eab0e;_0x59513c[_0x2215('0x46')]=_['keys'](db[_0x2215('0x7e')][_0x2215('0x59')]);_0x59513c[_0x2215('0x48')]=_[_0x2215('0x47')](_0xce550a[_0x2215('0x48')]);_0x59513c['filters']=_[_0x2215('0x4a')](_0x59513c[_0x2215('0x46')],_0x59513c[_0x2215('0x48')]);_0x13a7e1['attributes']=_[_0x2215('0x4a')](_0x59513c[_0x2215('0x46')],qs[_0x2215('0x4b')](_0xce550a[_0x2215('0x48')][_0x2215('0x4b')]));_0x13a7e1[_0x2215('0x4c')]=_0x13a7e1[_0x2215('0x4c')][_0x2215('0x5a')]?_0x13a7e1[_0x2215('0x4c')]:_0x59513c['model'];_0x13a7e1[_0x2215('0x4f')]=qs[_0x2215('0x50')](_0xce550a['query']['sort']);_0x13a7e1['where']=qs['filters'](_[_0x2215('0x51')](_0xce550a[_0x2215('0x48')],_0x59513c[_0x2215('0x49')]));if(_0xce550a[_0x2215('0x48')][_0x2215('0x52')]){_0x13a7e1[_0x2215('0x53')]=_[_0x2215('0x54')](_0x13a7e1[_0x2215('0x53')],{'$or':_['map'](_0x13a7e1[_0x2215('0x4c')],function(_0x522f10){var _0x39bbea={};_0x39bbea[_0x522f10]={'$like':'%'+_0xce550a[_0x2215('0x48')][_0x2215('0x52')]+'%'};return _0x39bbea;})});}_0x13a7e1=_[_0x2215('0x54')]({},_0x13a7e1,_0xce550a[_0x2215('0x56')]);return _0x44a817['getApplications'](_0x13a7e1);}})[_0x2215('0x20')](function(_0x9a7bd){if(_0x9a7bd){_0x3f84a6=_0x9a7bd[_0x2215('0x5a')];if(!_0xce550a[_0x2215('0x48')][_0x2215('0x4d')](_0x2215('0x4e'))){_0x13a7e1[_0x2215('0x2e')]=qs[_0x2215('0x2e')](_0xce550a[_0x2215('0x48')]['limit']);_0x13a7e1[_0x2215('0x2d')]=qs[_0x2215('0x2d')](_0xce550a[_0x2215('0x48')][_0x2215('0x2d')]);}return _0x44a817['getApplications'](_0x13a7e1);}})[_0x2215('0x20')](function(_0x115a54){if(_0x115a54){return _0x115a54?{'count':_0x3f84a6,'rows':_0x115a54}:null;}})[_0x2215('0x20')](respondWithResult(_0x90a5b,null))[_0x2215('0x2a')](handleError(_0x90a5b,null));};function Extension(_0xbab55f,_0x3d4230,_0x5148f8,_0x256668){this[_0x2215('0x83')]=_0x2215('0x84');this[_0x2215('0x85')]=_0xbab55f['localstationid'];this['app']=_0x256668;this['type']=_0x2215('0x86');this[_0x2215('0x87')]=_0x2215('0x88');this[_0x2215('0x69')]=_0xbab55f['id'];this[_0x2215('0x80')]=_0x3d4230;this[_0x2215('0x89')]=_0x5148f8;}function createExtensionsReciveFax(_0x58fdf6){var _0x9fbe1=0x1;var _0x127ea9=[];_0x127ea9[_0x2215('0x8a')](new Extension(_0x58fdf6,_0x9fbe1,'',_0x2215('0x8b')));_0x9fbe1+=0x1;_0x127ea9[_0x2215('0x8a')](new Extension(_0x58fdf6,_0x9fbe1,_0x2215('0x8c'),'Set'));_0x9fbe1+=0x1;for(var _0x1fe06d in _0x58fdf6){if(_0x58fdf6['hasOwnProperty'](_0x1fe06d)&&(_0x1fe06d===_0x2215('0x8d')||_0x1fe06d===_0x2215('0x8e')||_0x1fe06d===_0x2215('0x8f')||_0x1fe06d===_0x2215('0x90')||_0x1fe06d==='headerinfo'||_0x1fe06d===_0x2215('0x91')||_0x1fe06d===_0x2215('0x92')||_0x1fe06d===_0x2215('0x93')||_0x1fe06d==='t38timeout')){_0x127ea9['push'](new Extension(_0x58fdf6,_0x9fbe1,_0x2215('0x94')+_0x1fe06d+')='+_0x58fdf6[_0x1fe06d],'Set'));_0x9fbe1+=0x1;}}_0x127ea9[_0x2215('0x8a')](new Extension(_0x58fdf6,_0x9fbe1,'6',_0x2215('0x95')));_0x9fbe1+=0x1;_0x127ea9[_0x2215('0x8a')](new Extension(_0x58fdf6,_0x9fbe1,'/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',_0x2215('0x96')));_0x9fbe1=0x0;return _0x127ea9;}exports[_0x2215('0x97')]=function(_0x307895,_0x2bb5d3,_0x362322){var _0x1a5e4f;return db[_0x2215('0x98')][_0x2215('0x7a')](function(_0x19b444){return db[_0x2215('0x43')][_0x2215('0x5c')](_0x307895[_0x2215('0x5d')],{'transaction':_0x19b444})['then'](function(_0x55525f){_0x1a5e4f=_0x55525f[_0x2215('0x39')]({'plain':!![]});return db[_0x2215('0x99')][_0x2215('0x7f')](createExtensionsReciveFax(_0x1a5e4f),{'transaction':_0x19b444});});})[_0x2215('0x20')](function(){return _0x1a5e4f;})[_0x2215('0x20')](respondWithResult(_0x2bb5d3,null))[_0x2215('0x2a')](handleError(_0x2bb5d3,null));};exports[_0x2215('0x9a')]=function(_0x2a3e96,_0x39a92e,_0x463fad){var _0x3d7aab;return db[_0x2215('0x98')]['transaction'](function(_0x5e4eab){return db[_0x2215('0x43')]['update'](_0x2a3e96[_0x2215('0x5d')],{'where':{'id':_0x2a3e96['body']['id']},'transaction':_0x5e4eab})[_0x2215('0x20')](function(_0x44dc80){return db[_0x2215('0x99')]['destroy']({'where':{'FaxAccountId':_0x2a3e96[_0x2215('0x5d')]['id']},'transaction':_0x5e4eab})[_0x2215('0x20')](function(_0x5579ea){return db['VoiceExtension'][_0x2215('0x7f')](createExtensionsReciveFax(_[_0x2215('0x9b')](_0x2a3e96[_0x2215('0x5d')],[_0x2215('0x9c'),'key',_0x2215('0x9d'),_0x2215('0x9e'),_0x2215('0x9f'),_0x2215('0xa0')])),{'transaction':_0x5e4eab});});});})['then'](function(){return db[_0x2215('0x43')][_0x2215('0xa1')](_0x2a3e96['body']['id']);})[_0x2215('0x20')](respondWithResult(_0x39a92e,null))[_0x2215('0x2a')](handleError(_0x39a92e,null));};exports[_0x2215('0xa2')]=function(_0x4ebc2b,_0x18818b,_0x8cbc72){var _0x487c79={'raw':!![],'where':{}};var _0x119ae2={};var _0x3ae840={'count':0x0,'rows':[]};return db[_0x2215('0x43')][_0x2215('0x68')]({'where':{'id':_0x4ebc2b[_0x2215('0x58')]['id']}})['then'](handleEntityNotFound(_0x18818b,null))[_0x2215('0x20')](function(_0x217876){if(_0x217876){_0x119ae2['model']=_[_0x2215('0x47')](db[_0x2215('0xa3')]['rawAttributes']);_0x119ae2[_0x2215('0x48')]=_[_0x2215('0x47')](_0x4ebc2b['query']);_0x119ae2['filters']=_['intersection'](_0x119ae2['model'],_0x119ae2[_0x2215('0x48')]);_0x487c79[_0x2215('0x4c')]=_[_0x2215('0x4a')](_0x119ae2[_0x2215('0x46')],qs[_0x2215('0x4b')](_0x4ebc2b[_0x2215('0x48')][_0x2215('0x4b')]));_0x487c79[_0x2215('0x4c')]=_0x487c79[_0x2215('0x4c')][_0x2215('0x5a')]?_0x487c79[_0x2215('0x4c')]:_0x119ae2['model'];if(!_0x4ebc2b[_0x2215('0x48')][_0x2215('0x4d')](_0x2215('0x4e'))){_0x487c79[_0x2215('0x2e')]=qs[_0x2215('0x2e')](_0x4ebc2b[_0x2215('0x48')]['limit']);_0x487c79[_0x2215('0x2d')]=qs[_0x2215('0x2d')](_0x4ebc2b[_0x2215('0x48')][_0x2215('0x2d')]);}_0x487c79[_0x2215('0x4f')]=qs[_0x2215('0x50')](_0x4ebc2b['query'][_0x2215('0x50')]);_0x487c79['where']=qs[_0x2215('0x49')](_[_0x2215('0x51')](_0x4ebc2b[_0x2215('0x48')],_0x119ae2[_0x2215('0x49')]));_0x487c79[_0x2215('0x53')][_0x2215('0x69')]=_0x217876['id'];if(_0x4ebc2b[_0x2215('0x48')][_0x2215('0x52')]){_0x487c79[_0x2215('0x53')]=_[_0x2215('0x54')](_0x487c79[_0x2215('0x53')],{'$or':_['map'](_0x487c79['attributes'],function(_0x1a42e4){var _0x2b37db={};_0x2b37db[_0x1a42e4]={'$like':'%'+_0x4ebc2b[_0x2215('0x48')][_0x2215('0x52')]+'%'};return _0x2b37db;})});}if(_0x4ebc2b[_0x2215('0x48')][_0x2215('0xa4')]){var _0x35a35f=_0x4ebc2b[_0x2215('0x48')][_0x2215('0xa4')][_0x2215('0xa5')](',');var _0xf029ab={};_0xf029ab[_0x35a35f[0x0]]={'$gte':moment(_0x35a35f[0x1])[_0x2215('0xa6')](_0x2215('0xa7'))};_0x487c79[_0x2215('0x53')]=_['merge'](_0x487c79[_0x2215('0x53')],_0xf029ab);}_0x487c79=_[_0x2215('0x54')]({},_0x487c79,_0x4ebc2b[_0x2215('0x56')]);return db[_0x2215('0xa3')][_0x2215('0x30')]({'where':_0x487c79[_0x2215('0x53')]})[_0x2215('0x20')](function(_0x40d94a){_0x3ae840[_0x2215('0x30')]=_0x40d94a;if(_0x4ebc2b['query'][_0x2215('0x5b')]){_0x487c79[_0x2215('0x6a')]=[{'all':!![]}];}return db[_0x2215('0xa3')]['findAll'](_0x487c79);})['then'](function(_0x47b671){_0x3ae840[_0x2215('0x6b')]=_0x47b671;return _0x3ae840;});}})[_0x2215('0x20')](respondWithFilteredResult(_0x18818b,_0x487c79))[_0x2215('0x2a')](handleError(_0x18818b,null));};exports[_0x2215('0x3e')]=function(_0x2c78f6,_0x446bfc,_0x46f2d5){var _0x51d24f,_0x5d2fbc={},_0x4698ca;if(_0x2c78f6['body']['to']){_0x4698ca=_0x2c78f6['body']['to'][0x0];}return db[_0x2215('0x43')][_0x2215('0x61')]({'where':{'id':_0x2c78f6[_0x2215('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2215('0xa8')],'as':_0x2215('0xa9'),'where':{'fax':_0x4698ca},'limit':0x1,'order':[[_0x2215('0x9e'),_0x2215('0xaa')]]}]}]})[_0x2215('0x20')](handleEntityNotFound(_0x446bfc,null))[_0x2215('0x20')](function(_0x36d16f){_0x51d24f=_0x36d16f;if(_0x2c78f6[_0x2215('0x5d')][_0x2215('0xab')]&&_0x2c78f6['body'][_0x2215('0xab')][_0x2215('0x5a')]){for(var _0x458e0a=0x0;_0x458e0a<_0x2c78f6[_0x2215('0x5d')][_0x2215('0xab')][_0x2215('0x5a')];_0x458e0a+=0x1){_0x2c78f6['body'][_0x2215('0xab')][_0x458e0a]={'filename':_0x2c78f6[_0x2215('0x5d')][_0x2215('0xab')][_0x458e0a]['name'],'id':_0x2c78f6[_0x2215('0x5d')][_0x2215('0xab')][_0x458e0a]['id'],'path':path[_0x2215('0xac')](config['root'],_0x2215('0xad'),_0x2c78f6['body'][_0x2215('0xab')][_0x458e0a][_0x2215('0xae')])};}}return respondWithRpcPromise(_0x2215('0xaf'),_0x2215('0xaf'),{'FaxAccountId':_['isNil'](_0x2c78f6[_0x2215('0x58')]['id'])?undefined:_0x2c78f6[_0x2215('0x58')]['id'],'path':_['isNil'](_0x2c78f6[_0x2215('0x5d')]['attachments'][0x0][_0x2215('0x7')])?undefined:_0x2c78f6[_0x2215('0x5d')]['attachments'][0x0][_0x2215('0x7')],'fax':_[_0x2215('0xb0')](_0x2c78f6['body']['to'][0x0])?undefined:_0x2c78f6[_0x2215('0x5d')]['to'][0x0]},client9002);})['then'](function(){if(_0x51d24f){if(_[_0x2215('0xb0')](_0x2c78f6['body']['from'])){_0x2c78f6[_0x2215('0x5d')][_0x2215('0xb1')]=util[_0x2215('0xa6')]('\x22%s\x22\x20<%s>',_0x51d24f['name'],_0x51d24f['fax']);}if(_0x51d24f[_0x2215('0xb2')]){if(_0x51d24f[_0x2215('0xb2')][_0x2215('0xa9')]['length']){return _0x51d24f['List'][_0x2215('0xa9')][0x0];}else{return db[_0x2215('0xa8')][_0x2215('0x5c')](_['defaults'](_0x2c78f6['body'],{'firstName':_0x2c78f6[_0x2215('0x5d')]['to'][0x0],'phone':_0x2c78f6[_0x2215('0x5d')]['to'][0x0],'fax':_0x2c78f6[_0x2215('0x5d')]['to'][0x0],'ListId':_0x51d24f['ListId']}));}}else{throw new Error(_0x2215('0xb3'));}}else{throw new Error(_0x2215('0xb4'));}})[_0x2215('0x20')](function(_0x25d51c){if(_0x25d51c){return db['FaxInteraction'][_0x2215('0x61')]({'where':{'ContactId':_0x25d51c['id'],'closed':![],'FaxAccountId':_0x51d24f['id']}})['then'](function(_0x1f475e){if(_0x1f475e){return[_0x1f475e,![]];}return db[_0x2215('0x72')][_0x2215('0x5c')]({'UserId':_0x2c78f6[_0x2215('0x5e')]['id'],'ContactId':_0x25d51c['id'],'FaxAccountId':_0x51d24f['id'],'fax':_0x2c78f6['body']['to'][0x0],'firstMsgDirection':_0x2215('0xb5'),'Messages':[_[_0x2215('0x54')](_0x2c78f6['body'],{'read':![],'body':_0x2c78f6[_0x2215('0x5d')][_0x2215('0xab')][0x0]['filename'],'FaxAccountId':_0x51d24f['id'],'UserId':_0x2c78f6['user']['id'],'ContactId':_0x25d51c['id'],'AttachmentId':_0x2c78f6[_0x2215('0x5d')][_0x2215('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x2215('0xa3')],'as':_0x2215('0xb6')}]})['then'](function(_0x3506ec){return[_0x3506ec,!![]];});});}else{throw new Error(_0x2215('0xb7'));}})[_0x2215('0xb8')](function(_0x44c820,_0x867ed2){if(_0x867ed2){return _0x44c820;}return db['FaxMessage']['create']({'direction':_0x2215('0xb5'),'read':![],'body':_0x2c78f6[_0x2215('0x5d')][_0x2215('0xab')][0x0]['filename'],'FaxAccountId':_0x51d24f['id'],'FaxInteractionId':_0x44c820['id'],'UserId':_0x2c78f6[_0x2215('0x5e')]['id'],'ContactId':_0x44c820[_0x2215('0xb9')],'AttachmentId':_0x2c78f6[_0x2215('0x5d')][_0x2215('0xab')][0x0]['id']})[_0x2215('0x20')](function(_0x37ce8f){_0x44c820[_0x2215('0xba')]['Messages']=[];_0x44c820[_0x2215('0xba')]['Messages']['push'](_0x37ce8f[_0x2215('0xba')]);return _0x44c820;});})[_0x2215('0x20')](function(_0x54bbbf){respondWithRpcPromise(_0x2215('0xbb'),_0x2215('0xbb'),{'FaxAccountId':_[_0x2215('0xb0')](_0x2c78f6[_0x2215('0x58')]['id'])?undefined:_0x2c78f6[_0x2215('0x58')]['id'],'path':_[_0x2215('0xb0')](_0x2c78f6['body']['attachments'][0x0]['path'])?undefined:_0x2c78f6['body'][_0x2215('0xab')][0x0][_0x2215('0x7')],'fax':_[_0x2215('0xb0')](_0x2c78f6[_0x2215('0x5d')]['to'][0x0])?undefined:_0x2c78f6['body']['to'][0x0],'AttachmentId':_0x2c78f6['body'][_0x2215('0xab')][0x0]['id']},client9002)['then'](function(_0x437776){logger[_0x2215('0x21')](_0x2215('0xbc'),_0x437776);})['catch'](function(_0x77135c){logger['info']('SendFaxRpc,\x20%s',_0x77135c);});return _0x54bbbf;})[_0x2215('0x20')](respondWithResult(_0x446bfc,null))[_0x2215('0x2a')](handleError(_0x446bfc,null));};exports[_0x2215('0xbd')]=function(_0x4e55fa,_0x36fd7e,_0xf339d7){return db[_0x2215('0x43')][_0x2215('0x61')]({'where':{'id':_0x4e55fa[_0x2215('0x58')]['id']}})[_0x2215('0x20')](handleEntityNotFound(_0x36fd7e,null))[_0x2215('0x20')](function(_0x43dd38){if(_0x43dd38){return _0x43dd38[_0x2215('0xbd')](_0x4e55fa[_0x2215('0x5d')][_0x2215('0x6d')],_[_0x2215('0x9b')](_0x4e55fa[_0x2215('0x5d')],['ids','id'])||{})[_0x2215('0xb8')](function(_0x44b44c){for(var _0x25ef0a=0x0;_0x25ef0a<_0x4e55fa['body']['ids'][_0x2215('0x5a')];_0x25ef0a+=0x1){socket[_0x2215('0xbe')]('userFaxAccount:save',{'UserId':Number(_0x4e55fa['body']['ids'][_0x25ef0a]),'FaxAccountId':Number(_0x4e55fa[_0x2215('0x58')]['id'])});}return _0x44b44c;});}})[_0x2215('0x20')](respondWithResult(_0x36fd7e,null))[_0x2215('0x2a')](handleError(_0x36fd7e,null));};exports[_0x2215('0xbf')]=function(_0x534d3f,_0x5c2d86,_0x416a8a){return db['FaxAccount'][_0x2215('0x61')]({'where':{'id':_0x534d3f['params']['id']}})[_0x2215('0x20')](handleEntityNotFound(_0x5c2d86,null))[_0x2215('0x20')](function(_0x4f7be5){if(_0x4f7be5){return _0x4f7be5[_0x2215('0xbf')](_0x534d3f[_0x2215('0x48')][_0x2215('0x6d')])[_0x2215('0x20')](function(){if(_['isArray'](_0x534d3f['query'][_0x2215('0x6d')])){for(var _0x3f7877=0x0;_0x3f7877<_0x534d3f[_0x2215('0x48')][_0x2215('0x6d')]['length'];_0x3f7877+=0x1){socket[_0x2215('0xbe')](_0x2215('0xc0'),{'UserId':Number(_0x534d3f[_0x2215('0x48')]['ids'][_0x3f7877]),'FaxAccountId':Number(_0x534d3f[_0x2215('0x58')]['id'])});}}else{socket[_0x2215('0xbe')](_0x2215('0xc0'),{'UserId':Number(_0x534d3f[_0x2215('0x48')][_0x2215('0x6d')]),'FaxAccountId':Number(_0x534d3f[_0x2215('0x58')]['id'])});}});}})[_0x2215('0x20')](respondWithStatusCode(_0x5c2d86,null))[_0x2215('0x2a')](handleError(_0x5c2d86,null));};exports[_0x2215('0xc1')]=function(_0xd47698,_0xef3ad,_0xb95956){var _0x14f72a={};var _0x4533f2={};var _0x1f2c90;var _0x37ff69;return db[_0x2215('0x43')][_0x2215('0x68')]({'where':{'id':_0xd47698['params']['id']}})[_0x2215('0x20')](handleEntityNotFound(_0xef3ad,null))['then'](function(_0x419e3c){if(_0x419e3c){_0x1f2c90=_0x419e3c;_0x4533f2[_0x2215('0x46')]=_[_0x2215('0x47')](db[_0x2215('0xc2')][_0x2215('0x59')]);_0x4533f2['query']=_[_0x2215('0x47')](_0xd47698[_0x2215('0x48')]);_0x4533f2[_0x2215('0x49')]=_[_0x2215('0x4a')](_0x4533f2[_0x2215('0x46')],_0x4533f2[_0x2215('0x48')]);_0x14f72a[_0x2215('0x4c')]=_[_0x2215('0x4a')](_0x4533f2[_0x2215('0x46')],qs[_0x2215('0x4b')](_0xd47698[_0x2215('0x48')][_0x2215('0x4b')]));_0x14f72a[_0x2215('0x4c')]=_0x14f72a[_0x2215('0x4c')][_0x2215('0x5a')]?_0x14f72a[_0x2215('0x4c')]:_0x4533f2[_0x2215('0x46')];_0x14f72a[_0x2215('0x4f')]=qs[_0x2215('0x50')](_0xd47698[_0x2215('0x48')][_0x2215('0x50')]);_0x14f72a['where']=qs[_0x2215('0x49')](_[_0x2215('0x51')](_0xd47698['query'],_0x4533f2[_0x2215('0x49')]));if(_0xd47698[_0x2215('0x48')][_0x2215('0x52')]){_0x14f72a[_0x2215('0x53')]=_['merge'](_0x14f72a[_0x2215('0x53')],{'$or':_[_0x2215('0x42')](_0x14f72a[_0x2215('0x4c')],function(_0x5759f1){var _0x375bad={};_0x375bad[_0x5759f1]={'$like':'%'+_0xd47698[_0x2215('0x48')][_0x2215('0x52')]+'%'};return _0x375bad;})});}_0x14f72a=_[_0x2215('0x54')]({},_0x14f72a,_0xd47698[_0x2215('0x56')]);return _0x1f2c90[_0x2215('0xc1')](_0x14f72a);}})[_0x2215('0x20')](function(_0x24d0ef){if(_0x24d0ef){_0x37ff69=_0x24d0ef['length'];if(!_0xd47698[_0x2215('0x48')][_0x2215('0x4d')]('nolimit')){_0x14f72a[_0x2215('0x2e')]=qs[_0x2215('0x2e')](_0xd47698['query'][_0x2215('0x2e')]);_0x14f72a[_0x2215('0x2d')]=qs[_0x2215('0x2d')](_0xd47698[_0x2215('0x48')][_0x2215('0x2d')]);}return _0x1f2c90[_0x2215('0xc1')](_0x14f72a);}})[_0x2215('0x20')](function(_0x4c4ed4){if(_0x4c4ed4){return _0x4c4ed4?{'count':_0x37ff69,'rows':_0x4c4ed4}:null;}})[_0x2215('0x20')](respondWithResult(_0xef3ad,null))[_0x2215('0x2a')](handleError(_0xef3ad,null));}; \ No newline at end of file +var _0x37be=['UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','length','hasOwnProperty','pick','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','transaction','VoiceExtension','bulkCreate','tech','key','createdAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','user','filename','Messages','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./faxAccount.socket','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','get','FaxAccounts'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x37be,0x153));var _0xe37b=function(_0xa2a5d6,_0x524481){_0xa2a5d6=_0xa2a5d6-0x0;var _0x140d6b=_0x37be[_0xa2a5d6];return _0x140d6b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe37b('0x0'));var jsonpatch=require(_0xe37b('0x1'));var rp=require(_0xe37b('0x2'));var moment=require(_0xe37b('0x3'));var BPromise=require(_0xe37b('0x4'));var Mustache=require('mustache');var util=require(_0xe37b('0x5'));var path=require(_0xe37b('0x6'));var sox=require(_0xe37b('0x7'));var csv=require(_0xe37b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe37b('0x9'));var _=require(_0xe37b('0xa'));var squel=require(_0xe37b('0xb'));var crypto=require(_0xe37b('0xc'));var jsforce=require(_0xe37b('0xd'));var deskjs=require(_0xe37b('0xe'));var toCsv=require(_0xe37b('0x8'));var querystring=require(_0xe37b('0xf'));var Papa=require(_0xe37b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe37b('0x11'));var as=require(_0xe37b('0x12'));var hardwareService=require(_0xe37b('0x13'));var logger=require('../../config/logger')(_0xe37b('0x14'));var utils=require(_0xe37b('0x15'));var config=require(_0xe37b('0x16'));var licenseUtil=require(_0xe37b('0x17'));var db=require(_0xe37b('0x18'))['db'];config['redis']=_[_0xe37b('0x19')](config[_0xe37b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe37b('0x1b'))['register'](socket);var jayson=require(_0xe37b('0x1c'));var client=jayson[_0xe37b('0x1d')][_0xe37b('0x1e')]({'port':0x232c});var client9002=jayson[_0xe37b('0x1d')][_0xe37b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x24eba6,_0x4d6d6e,_0x5bbb12,_0x1f23a8){return new BPromise(function(_0x59c4a8,_0x1e2b69){var _0x4771a2=_0x1f23a8||client;return _0x4771a2[_0xe37b('0x1f')](_0x24eba6,_0x5bbb12)['then'](function(_0x5b81c4){logger[_0xe37b('0x20')](_0xe37b('0x21'),_0x4d6d6e,'request\x20sent');logger[_0xe37b('0x22')](_0xe37b('0x23'),_0x4d6d6e,_0xe37b('0x24'),JSON['stringify'](_0x5b81c4));if(_0x5b81c4['error']){if(_0x5b81c4[_0xe37b('0x25')][_0xe37b('0x26')]===0x1f4){logger[_0xe37b('0x25')](_0xe37b('0x21'),_0x4d6d6e,_0x5b81c4[_0xe37b('0x25')]['message']);return _0x1e2b69(_0x5b81c4[_0xe37b('0x25')][_0xe37b('0x27')]);}logger[_0xe37b('0x25')](_0xe37b('0x21'),_0x4d6d6e,_0x5b81c4[_0xe37b('0x25')][_0xe37b('0x27')]);return _0x59c4a8(_0x5b81c4['error'][_0xe37b('0x27')]);}else{logger[_0xe37b('0x20')](_0xe37b('0x21'),_0x4d6d6e,'request\x20sent');_0x59c4a8(_0x5b81c4[_0xe37b('0x28')]['message']);}})[_0xe37b('0x29')](function(_0x31aef8){logger['error'](_0xe37b('0x21'),_0x4d6d6e,_0x31aef8);_0x1e2b69(_0x31aef8);});});}function respondWithStatusCode(_0x317e03,_0x2c34f4){_0x2c34f4=_0x2c34f4||0xcc;return function(_0x1a3e90){if(_0x1a3e90){return _0x317e03['sendStatus'](_0x2c34f4);}return _0x317e03[_0xe37b('0x2a')](_0x2c34f4)[_0xe37b('0x2b')]();};}function respondWithResult(_0x50e4ad,_0x3b1617){_0x3b1617=_0x3b1617||0xc8;return function(_0x57e743){if(_0x57e743){return _0x50e4ad[_0xe37b('0x2a')](_0x3b1617)[_0xe37b('0x2c')](_0x57e743);}};}function respondWithFilteredResult(_0x2471b5,_0x2e3135){return function(_0x34ee5f){if(_0x34ee5f){var _0x11c40c=typeof _0x2e3135['offset']===_0xe37b('0x2d')&&typeof _0x2e3135[_0xe37b('0x2e')]===_0xe37b('0x2d');var _0x8cc7aa=_0x34ee5f[_0xe37b('0x2f')];var _0x1a70e8=_0x11c40c?0x0:_0x2e3135[_0xe37b('0x30')];var _0x16fb5d=_0x11c40c?_0x34ee5f[_0xe37b('0x2f')]:_0x2e3135[_0xe37b('0x30')]+_0x2e3135['limit'];var _0x1991b6;if(_0x16fb5d>=_0x8cc7aa){_0x16fb5d=_0x8cc7aa;_0x1991b6=0xc8;}else{_0x1991b6=0xce;}_0x2471b5['status'](_0x1991b6);return _0x2471b5['set'](_0xe37b('0x31'),_0x1a70e8+'-'+_0x16fb5d+'/'+_0x8cc7aa)['json'](_0x34ee5f);}return null;};}function patchUpdates(_0x114015){return function(_0x1c2ad1){try{jsonpatch[_0xe37b('0x32')](_0x1c2ad1,_0x114015,!![]);}catch(_0x586aa5){return BPromise['reject'](_0x586aa5);}return _0x1c2ad1[_0xe37b('0x33')]();};}function saveUpdates(_0x533928,_0x103bcf){return function(_0x18ca48){if(_0x18ca48){return _0x18ca48[_0xe37b('0x34')](_0x533928)[_0xe37b('0x35')](function(_0x171644){return _0x171644;});}return null;};}function removeEntity(_0x12e287,_0x2864c4){return function(_0x11edbc){if(_0x11edbc){return _0x11edbc[_0xe37b('0x36')]()[_0xe37b('0x35')](function(){var _0x8ebe80=_0x11edbc[_0xe37b('0x37')]({'plain':!![]});var _0x311933=_0xe37b('0x38');return db[_0xe37b('0x39')][_0xe37b('0x36')]({'where':{'type':_0x311933,'resourceId':_0x8ebe80['id']}})['then'](function(){return _0x11edbc;});})[_0xe37b('0x35')](function(){_0x12e287[_0xe37b('0x2a')](0xcc)[_0xe37b('0x2b')]();});}};}function handleEntityNotFound(_0x44c17f,_0x49f4c9){return function(_0x32ec28){if(!_0x32ec28){_0x44c17f[_0xe37b('0x3a')](0x194);}return _0x32ec28;};}function handleError(_0xbaad55,_0x308779){_0x308779=_0x308779||0x1f4;return function(_0x2d9d9d){logger['error'](_0x2d9d9d[_0xe37b('0x3b')]);if(_0x2d9d9d[_0xe37b('0x3c')]){delete _0x2d9d9d[_0xe37b('0x3c')];}_0xbaad55['status'](_0x308779)[_0xe37b('0x3d')](_0x2d9d9d);};}exports[_0xe37b('0x3e')]=function(_0x32ac4d,_0x19a057){var _0x56c5c8={'include':[{'model':db['Pause'],'as':_0xe37b('0x3f')}]},_0x27784b={},_0xa1b3f={'count':0x0,'rows':[]};var _0x910515=_[_0xe37b('0x40')](db[_0xe37b('0x41')][_0xe37b('0x42')],function(_0xf8172c){return{'name':_0xf8172c['fieldName'],'type':_0xf8172c[_0xe37b('0x43')]['key']};});_0x27784b[_0xe37b('0x44')]=_[_0xe37b('0x40')](_0x910515,_0xe37b('0x3c'));_0x27784b[_0xe37b('0x45')]=_[_0xe37b('0x46')](_0x32ac4d[_0xe37b('0x45')]);_0x27784b[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x27784b[_0xe37b('0x44')],_0x27784b[_0xe37b('0x45')]);_0x56c5c8[_0xe37b('0x49')]=_[_0xe37b('0x48')](_0x27784b['model'],qs[_0xe37b('0x4a')](_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x4a')]));_0x56c5c8['attributes']=_0x56c5c8['attributes']['length']?_0x56c5c8[_0xe37b('0x49')]:_0x27784b[_0xe37b('0x44')];if(!_0x32ac4d[_0xe37b('0x45')]['hasOwnProperty'](_0xe37b('0x4b'))){_0x56c5c8[_0xe37b('0x2e')]=qs[_0xe37b('0x2e')](_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x2e')]);_0x56c5c8[_0xe37b('0x30')]=qs[_0xe37b('0x30')](_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x30')]);}_0x56c5c8[_0xe37b('0x4c')]=qs[_0xe37b('0x4d')](_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x4d')]);_0x56c5c8[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_['pick'](_0x32ac4d[_0xe37b('0x45')],_0x27784b[_0xe37b('0x47')]),_0x910515);if(_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x4f')]){_0x56c5c8[_0xe37b('0x4e')]=_['merge'](_0x56c5c8[_0xe37b('0x4e')],{'$or':_[_0xe37b('0x40')](_0x910515,function(_0x3aa415){if(_0x3aa415['type']!==_0xe37b('0x50')){var _0x15ef81={};_0x15ef81[_0x3aa415[_0xe37b('0x3c')]]={'$like':'%'+_0x32ac4d[_0xe37b('0x45')]['filter']+'%'};return _0x15ef81;}})});}_0x56c5c8=_[_0xe37b('0x51')]({},_0x56c5c8,_0x32ac4d[_0xe37b('0x52')]);var _0x2e492e={'where':_0x56c5c8[_0xe37b('0x4e')]};return db[_0xe37b('0x41')]['count'](_0x2e492e)[_0xe37b('0x35')](function(_0x4d58e2){_0xa1b3f[_0xe37b('0x2f')]=_0x4d58e2;if(_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x53')]){_0x56c5c8[_0xe37b('0x54')]=[{'all':!![]}];}return db[_0xe37b('0x41')][_0xe37b('0x55')](_0x56c5c8);})['then'](function(_0x222fbd){_0xa1b3f[_0xe37b('0x56')]=_0x222fbd;return _0xa1b3f;})[_0xe37b('0x35')](respondWithFilteredResult(_0x19a057,_0x56c5c8))[_0xe37b('0x29')](handleError(_0x19a057,null));};exports[_0xe37b('0x57')]=function(_0x3fe041,_0x432c6d){var _0x24aa99={'raw':![],'where':{'id':_0x3fe041[_0xe37b('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xe37b('0x3f')}]},_0x367405={};_0x367405[_0xe37b('0x44')]=_[_0xe37b('0x46')](db[_0xe37b('0x41')][_0xe37b('0x42')]);_0x367405[_0xe37b('0x45')]=_['keys'](_0x3fe041['query']);_0x367405[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x367405[_0xe37b('0x44')],_0x367405[_0xe37b('0x45')]);_0x24aa99[_0xe37b('0x49')]=_[_0xe37b('0x48')](_0x367405[_0xe37b('0x44')],qs[_0xe37b('0x4a')](_0x3fe041[_0xe37b('0x45')][_0xe37b('0x4a')]));_0x24aa99[_0xe37b('0x49')]=_0x24aa99['attributes']['length']?_0x24aa99[_0xe37b('0x49')]:_0x367405[_0xe37b('0x44')];if(_0x3fe041[_0xe37b('0x45')][_0xe37b('0x53')]){_0x24aa99[_0xe37b('0x54')]=[{'all':!![]}];}_0x24aa99=_[_0xe37b('0x51')]({},_0x24aa99,_0x3fe041[_0xe37b('0x52')]);return db[_0xe37b('0x41')][_0xe37b('0x59')](_0x24aa99)[_0xe37b('0x35')](handleEntityNotFound(_0x432c6d,null))[_0xe37b('0x35')](respondWithResult(_0x432c6d,null))['catch'](handleError(_0x432c6d,null));};exports['create']=function(_0xb2f748,_0x290337){return db['FaxAccount'][_0xe37b('0x5a')](_0xb2f748['body'],{})[_0xe37b('0x35')](function(_0x2cecfe){var _0x536d5c=_0xb2f748['user'][_0xe37b('0x37')]({'plain':!![]});if(!_0x536d5c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x536d5c[_0xe37b('0x5b')]==='user'){var _0x59d464=_0x2cecfe['get']({'plain':!![]});var _0x2dd500=_0xe37b('0x38');return db[_0xe37b('0x5c')]['find']({'where':{'name':_0x2dd500,'userProfileId':_0x536d5c[_0xe37b('0x5d')]},'raw':!![]})[_0xe37b('0x35')](function(_0x6f742a){if(_0x6f742a&&_0x6f742a['autoAssociation']===0x0){return db[_0xe37b('0x39')][_0xe37b('0x5a')]({'name':_0x59d464[_0xe37b('0x3c')],'resourceId':_0x59d464['id'],'type':_0x6f742a[_0xe37b('0x3c')],'sectionId':_0x6f742a['id']},{})[_0xe37b('0x35')](function(){return _0x2cecfe;});}else{return _0x2cecfe;}})[_0xe37b('0x29')](function(_0x1390f0){logger[_0xe37b('0x25')](_0xe37b('0x5e'),_0x1390f0);throw _0x1390f0;});}return _0x2cecfe;})[_0xe37b('0x35')](respondWithResult(_0x290337,0xc9))[_0xe37b('0x29')](handleError(_0x290337,null));};exports[_0xe37b('0x34')]=function(_0x4362bf,_0x37074d){if(_0x4362bf['body']['id']){delete _0x4362bf[_0xe37b('0x5f')]['id'];}return db['FaxAccount'][_0xe37b('0x59')]({'where':{'id':_0x4362bf[_0xe37b('0x58')]['id']},'include':[{'model':db[_0xe37b('0x60')],'as':_0xe37b('0x3f')}]})['then'](handleEntityNotFound(_0x37074d,null))[_0xe37b('0x35')](saveUpdates(_0x4362bf[_0xe37b('0x5f')],null))[_0xe37b('0x35')](respondWithResult(_0x37074d,null))['catch'](handleError(_0x37074d,null));};exports[_0xe37b('0x36')]=function(_0x3b4a2d,_0x4cc8ca){return db[_0xe37b('0x41')]['find']({'where':{'id':_0x3b4a2d['params']['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x4cc8ca,null))['then'](removeEntity(_0x4cc8ca,null))[_0xe37b('0x29')](handleError(_0x4cc8ca,null));};exports['describe']=function(_0x2c25f2,_0x2ea6e6){return db['FaxAccount'][_0xe37b('0x61')]()[_0xe37b('0x35')](respondWithResult(_0x2ea6e6,null))[_0xe37b('0x29')](handleError(_0x2ea6e6,null));};exports[_0xe37b('0x62')]=function(_0x5806d8,_0x37b2e7,_0x4b1c26){if(_0x5806d8['body']['id']){delete _0x5806d8[_0xe37b('0x5f')]['id'];}return db[_0xe37b('0x41')][_0xe37b('0x59')]({'where':{'id':_0x5806d8[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x37b2e7,null))[_0xe37b('0x35')](function(_0x30f0b6){if(_0x30f0b6){_0x5806d8[_0xe37b('0x5f')][_0xe37b('0x63')]=_0x30f0b6['id'];return db['Disposition'][_0xe37b('0x5a')](_0x5806d8[_0xe37b('0x5f')]);}})['then'](respondWithResult(_0x37b2e7,null))['catch'](handleError(_0x37b2e7,null));};exports[_0xe37b('0x64')]=function(_0xfad093,_0x1b4472,_0xa165fe){var _0x1f62bd={'raw':![],'where':{}};var _0x3fbf9b={};var _0x3f6b08={'count':0x0,'rows':[]};return db[_0xe37b('0x41')][_0xe37b('0x65')]({'where':{'id':_0xfad093[_0xe37b('0x58')]['id']}})['then'](handleEntityNotFound(_0x1b4472,null))['then'](function(_0x11f2d9){if(_0x11f2d9){_0x3fbf9b['model']=_['keys'](db[_0xe37b('0x66')]['rawAttributes']);_0x3fbf9b[_0xe37b('0x45')]=_[_0xe37b('0x46')](_0xfad093[_0xe37b('0x45')]);_0x3fbf9b[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x3fbf9b[_0xe37b('0x44')],_0x3fbf9b[_0xe37b('0x45')]);_0x1f62bd['attributes']=_[_0xe37b('0x48')](_0x3fbf9b['model'],qs[_0xe37b('0x4a')](_0xfad093['query'][_0xe37b('0x4a')]));_0x1f62bd[_0xe37b('0x49')]=_0x1f62bd[_0xe37b('0x49')][_0xe37b('0x67')]?_0x1f62bd[_0xe37b('0x49')]:_0x3fbf9b['model'];if(!_0xfad093[_0xe37b('0x45')][_0xe37b('0x68')](_0xe37b('0x4b'))){_0x1f62bd[_0xe37b('0x2e')]=qs['limit'](_0xfad093['query'][_0xe37b('0x2e')]);_0x1f62bd[_0xe37b('0x30')]=qs['offset'](_0xfad093['query']['offset']);}_0x1f62bd[_0xe37b('0x4c')]=qs[_0xe37b('0x4d')](_0xfad093[_0xe37b('0x45')][_0xe37b('0x4d')]);_0x1f62bd[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_[_0xe37b('0x69')](_0xfad093[_0xe37b('0x45')],_0x3fbf9b[_0xe37b('0x47')]));_0x1f62bd[_0xe37b('0x4e')][_0xe37b('0x63')]=_0x11f2d9['id'];if(_0xfad093[_0xe37b('0x45')][_0xe37b('0x4f')]){_0x1f62bd[_0xe37b('0x4e')]=_[_0xe37b('0x51')](_0x1f62bd['where'],{'$or':_[_0xe37b('0x40')](_0x1f62bd[_0xe37b('0x49')],function(_0x331a45){var _0x581ebc={};_0x581ebc[_0x331a45]={'$like':'%'+_0xfad093[_0xe37b('0x45')]['filter']+'%'};return _0x581ebc;})});}_0x1f62bd=_[_0xe37b('0x51')]({},_0x1f62bd,_0xfad093['options']);return db[_0xe37b('0x66')][_0xe37b('0x2f')]({'where':_0x1f62bd[_0xe37b('0x4e')]})[_0xe37b('0x35')](function(_0x42912e){_0x3f6b08['count']=_0x42912e;if(_0xfad093['query']['includeAll']){_0x1f62bd[_0xe37b('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xe37b('0x55')](_0x1f62bd);})['then'](function(_0x592f2c){_0x3f6b08[_0xe37b('0x56')]=_0x592f2c;return _0x3f6b08;});}})[_0xe37b('0x35')](respondWithFilteredResult(_0x1b4472,_0x1f62bd))[_0xe37b('0x29')](handleError(_0x1b4472,null));};exports[_0xe37b('0x6a')]=function(_0x120bfc,_0x2e379b,_0x7816b1){return db[_0xe37b('0x41')][_0xe37b('0x59')]({'where':{'id':_0x120bfc[_0xe37b('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e379b,null))[_0xe37b('0x35')](function(_0x1f9b29){if(_0x1f9b29){return _0x1f9b29['removeDispositions'](_0x120bfc[_0xe37b('0x45')][_0xe37b('0x6b')]);}})[_0xe37b('0x35')](respondWithStatusCode(_0x2e379b,null))[_0xe37b('0x29')](handleError(_0x2e379b,null));};exports['addAnswer']=function(_0x1d28e8,_0x101c66,_0x224dee){if(_0x1d28e8[_0xe37b('0x5f')]['id']){delete _0x1d28e8[_0xe37b('0x5f')]['id'];}return db[_0xe37b('0x41')][_0xe37b('0x59')]({'where':{'id':_0x1d28e8[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x101c66,null))[_0xe37b('0x35')](function(_0x4c9bc3){if(_0x4c9bc3){_0x1d28e8[_0xe37b('0x5f')][_0xe37b('0x63')]=_0x4c9bc3['id'];return db['CannedAnswer'][_0xe37b('0x5a')](_0x1d28e8[_0xe37b('0x5f')]);}})[_0xe37b('0x35')](respondWithResult(_0x101c66,null))['catch'](handleError(_0x101c66,null));};exports[_0xe37b('0x6c')]=function(_0x4fb0d8,_0x37547f,_0x2bd311){var _0x48b0c9={'raw':![],'where':{}};var _0x371be0={};var _0x2da1ee={'count':0x0,'rows':[]};return db[_0xe37b('0x41')][_0xe37b('0x65')]({'where':{'id':_0x4fb0d8[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x37547f,null))[_0xe37b('0x35')](function(_0xcaf5ed){if(_0xcaf5ed){_0x371be0[_0xe37b('0x44')]=_[_0xe37b('0x46')](db[_0xe37b('0x6d')][_0xe37b('0x42')]);_0x371be0[_0xe37b('0x45')]=_[_0xe37b('0x46')](_0x4fb0d8[_0xe37b('0x45')]);_0x371be0[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x371be0[_0xe37b('0x44')],_0x371be0['query']);_0x48b0c9['attributes']=_[_0xe37b('0x48')](_0x371be0['model'],qs[_0xe37b('0x4a')](_0x4fb0d8[_0xe37b('0x45')][_0xe37b('0x4a')]));_0x48b0c9[_0xe37b('0x49')]=_0x48b0c9[_0xe37b('0x49')]['length']?_0x48b0c9[_0xe37b('0x49')]:_0x371be0[_0xe37b('0x44')];if(!_0x4fb0d8['query'][_0xe37b('0x68')]('nolimit')){_0x48b0c9['limit']=qs[_0xe37b('0x2e')](_0x4fb0d8[_0xe37b('0x45')][_0xe37b('0x2e')]);_0x48b0c9[_0xe37b('0x30')]=qs[_0xe37b('0x30')](_0x4fb0d8[_0xe37b('0x45')][_0xe37b('0x30')]);}_0x48b0c9['order']=qs[_0xe37b('0x4d')](_0x4fb0d8['query'][_0xe37b('0x4d')]);_0x48b0c9[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_['pick'](_0x4fb0d8[_0xe37b('0x45')],_0x371be0[_0xe37b('0x47')]));_0x48b0c9[_0xe37b('0x4e')][_0xe37b('0x63')]=_0xcaf5ed['id'];if(_0x4fb0d8[_0xe37b('0x45')]['filter']){_0x48b0c9[_0xe37b('0x4e')]=_[_0xe37b('0x51')](_0x48b0c9['where'],{'$or':_[_0xe37b('0x40')](_0x48b0c9[_0xe37b('0x49')],function(_0x593530){var _0x32186d={};_0x32186d[_0x593530]={'$like':'%'+_0x4fb0d8[_0xe37b('0x45')]['filter']+'%'};return _0x32186d;})});}_0x48b0c9=_[_0xe37b('0x51')]({},_0x48b0c9,_0x4fb0d8[_0xe37b('0x52')]);return db['CannedAnswer']['count']({'where':_0x48b0c9[_0xe37b('0x4e')]})['then'](function(_0x5c3763){_0x2da1ee[_0xe37b('0x2f')]=_0x5c3763;if(_0x4fb0d8[_0xe37b('0x45')][_0xe37b('0x53')]){_0x48b0c9['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xe37b('0x55')](_0x48b0c9);})[_0xe37b('0x35')](function(_0x5ca5f4){_0x2da1ee[_0xe37b('0x56')]=_0x5ca5f4;return _0x2da1ee;});}})[_0xe37b('0x35')](respondWithFilteredResult(_0x37547f,_0x48b0c9))[_0xe37b('0x29')](handleError(_0x37547f,null));};exports['removeAnswers']=function(_0x5551ba,_0x5c54f4,_0x3e02bd){return db[_0xe37b('0x41')][_0xe37b('0x59')]({'where':{'id':_0x5551ba['params']['id']}})['then'](handleEntityNotFound(_0x5c54f4,null))[_0xe37b('0x35')](function(_0x13d776){if(_0x13d776){return _0x13d776[_0xe37b('0x6e')](_0x5551ba[_0xe37b('0x45')][_0xe37b('0x6b')]);}})['then'](respondWithStatusCode(_0x5c54f4,null))[_0xe37b('0x29')](handleError(_0x5c54f4,null));};exports[_0xe37b('0x6f')]=function(_0x4946f7,_0x527521,_0xc2d2af){return db['FaxInteraction']['find']({'where':{'id':_0x4946f7[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x527521,null))[_0xe37b('0x35')](function(_0x4fa8e5){if(_0x4fa8e5){return _0x4fa8e5['addInteraction'](_0x4946f7[_0xe37b('0x5f')]['ids'],_[_0xe37b('0x70')](_0x4946f7['body'],[_0xe37b('0x6b'),'id'])||{});}})[_0xe37b('0x35')](respondWithResult(_0x527521,null))[_0xe37b('0x29')](handleError(_0x527521,null));};exports[_0xe37b('0x71')]=function(_0x18c0b7,_0x211c85,_0x26edf2){var _0x234f98={'raw':![],'where':{}};var _0x59f5ea={};var _0x2b740c={'count':0x0,'rows':[]};return db[_0xe37b('0x41')]['findOne']({'where':{'id':_0x18c0b7[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x211c85,null))[_0xe37b('0x35')](function(_0x1f0c30){if(_0x1f0c30){_0x59f5ea[_0xe37b('0x44')]=_[_0xe37b('0x46')](db[_0xe37b('0x72')]['rawAttributes']);_0x59f5ea[_0xe37b('0x45')]=_[_0xe37b('0x46')](_0x18c0b7[_0xe37b('0x45')]);_0x59f5ea[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x59f5ea[_0xe37b('0x44')],_0x59f5ea[_0xe37b('0x45')]);_0x234f98[_0xe37b('0x49')]=_[_0xe37b('0x48')](_0x59f5ea[_0xe37b('0x44')],qs['fields'](_0x18c0b7['query'][_0xe37b('0x4a')]));_0x234f98[_0xe37b('0x49')]=_0x234f98[_0xe37b('0x49')][_0xe37b('0x67')]?_0x234f98[_0xe37b('0x49')]:_0x59f5ea[_0xe37b('0x44')];if(!_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x68')](_0xe37b('0x4b'))){_0x234f98['limit']=qs['limit'](_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x2e')]);_0x234f98[_0xe37b('0x30')]=qs[_0xe37b('0x30')](_0x18c0b7[_0xe37b('0x45')]['offset']);}_0x234f98[_0xe37b('0x4c')]=qs['sort'](_0x18c0b7[_0xe37b('0x45')]['sort']);_0x234f98[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_[_0xe37b('0x69')](_0x18c0b7[_0xe37b('0x45')],_0x59f5ea['filters']));_0x234f98[_0xe37b('0x4e')][_0xe37b('0x63')]=_0x1f0c30['id'];if(_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x4f')]){_0x234f98[_0xe37b('0x4e')]=_['merge'](_0x234f98['where'],{'$or':_[_0xe37b('0x40')](_0x234f98[_0xe37b('0x49')],function(_0x541ddb){var _0x2ba034={};_0x2ba034[_0x541ddb]={'$like':'%'+_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x4f')]+'%'};return _0x2ba034;})});}_0x234f98=_[_0xe37b('0x51')]({},_0x234f98,_0x18c0b7['options']);return db[_0xe37b('0x72')][_0xe37b('0x2f')]({'where':_0x234f98[_0xe37b('0x4e')]})[_0xe37b('0x35')](function(_0x30ed19){_0x2b740c[_0xe37b('0x2f')]=_0x30ed19;if(_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x53')]){_0x234f98[_0xe37b('0x54')]=[{'model':db[_0xe37b('0x73')],'as':_0xe37b('0x74'),'required':![]},{'model':db[_0xe37b('0x75')],'as':_0xe37b('0x76'),'attributes':['name',_0xe37b('0x77'),_0xe37b('0x78')],'required':![]},{'model':db[_0xe37b('0x79')],'as':_0xe37b('0x7a'),'attributes':['id',_0xe37b('0x3c'),'color'],'where':_0x18c0b7[_0xe37b('0x45')]['tag']?{'id':_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x7b')]}:undefined,'required':_0x18c0b7['query']['tag']?!![]:![]}];}return db[_0xe37b('0x72')][_0xe37b('0x55')](_0x234f98);})[_0xe37b('0x35')](function(_0x56723e){_0x2b740c[_0xe37b('0x56')]=_0x56723e;return _0x2b740c;});}})[_0xe37b('0x35')](respondWithFilteredResult(_0x211c85,_0x234f98))[_0xe37b('0x29')](handleError(_0x211c85,null));};exports['addApplications']=function(_0x1eb9b2,_0x120990){var _0xddac6e=_0x1eb9b2[_0xe37b('0x58')]['id'];var _0x14cf3c=_0x1eb9b2[_0xe37b('0x5f')];var _0x526240=0xc8;var _0x2944c2=null;return db[_0xe37b('0x7c')]['transaction']({'isolationLevel':db[_0xe37b('0x7c')][_0xe37b('0x7d')][_0xe37b('0x7e')][_0xe37b('0x7f')]},function(_0x1df10d){return db[_0xe37b('0x41')][_0xe37b('0x65')]({'where':{'id':_0xddac6e},'transaction':_0x1df10d})['then'](function(_0x4be4fb){if(_0x4be4fb){return db['FaxApplication'][_0xe37b('0x36')]({'where':{'FaxAccountId':_0xddac6e},'transaction':_0x1df10d})[_0xe37b('0x35')](function(){var _0x2236fd=_['map'](_0x14cf3c,function(_0x389587){_0x389587[_0xe37b('0x63')]=_0xddac6e;return _0x389587;});return db[_0xe37b('0x80')]['bulkCreate'](_0x2236fd,{'transaction':_0x1df10d});});}else{_0x526240=0x194;_0x2944c2=[];}});})[_0xe37b('0x35')](function(){if(_0x526240!==0x194){return db[_0xe37b('0x80')][_0xe37b('0x81')]({'where':{'FaxAccountId':_0xddac6e},'order':_0xe37b('0x82')})[_0xe37b('0x35')](function(_0x558aa9){_0x2944c2=_0x558aa9;});}})['catch'](function(_0x5a073a){_0x526240=0x1f4;logger[_0xe37b('0x25')](_0x5a073a[_0xe37b('0x3b')]);if(_0x5a073a['name']){delete _0x5a073a[_0xe37b('0x3c')];}_0x2944c2=_0x5a073a;})[_0xe37b('0x83')](function(){if(_0x2944c2===null){_0x120990[_0xe37b('0x3a')](_0x526240);}else{if(_0x526240===0x1f4){_0x120990[_0xe37b('0x2a')](_0x526240)[_0xe37b('0x3d')](_0x2944c2);}else{_0x120990[_0xe37b('0x2a')](_0x526240)[_0xe37b('0x2c')](_0x2944c2);}}});};exports[_0xe37b('0x84')]=function(_0x42e094,_0x2fe464,_0x117c40){var _0x10ec60={};var _0x27188b={};var _0x3ac134;var _0x57bfb1;return db[_0xe37b('0x41')][_0xe37b('0x65')]({'where':{'id':_0x42e094[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x2fe464,null))[_0xe37b('0x35')](function(_0x1f3239){if(_0x1f3239){_0x3ac134=_0x1f3239;_0x27188b['model']=_[_0xe37b('0x46')](db['FaxApplication'][_0xe37b('0x42')]);_0x27188b[_0xe37b('0x45')]=_['keys'](_0x42e094['query']);_0x27188b[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x27188b['model'],_0x27188b[_0xe37b('0x45')]);_0x10ec60[_0xe37b('0x49')]=_[_0xe37b('0x48')](_0x27188b[_0xe37b('0x44')],qs['fields'](_0x42e094[_0xe37b('0x45')][_0xe37b('0x4a')]));_0x10ec60[_0xe37b('0x49')]=_0x10ec60['attributes'][_0xe37b('0x67')]?_0x10ec60[_0xe37b('0x49')]:_0x27188b[_0xe37b('0x44')];_0x10ec60['order']=qs[_0xe37b('0x4d')](_0x42e094[_0xe37b('0x45')][_0xe37b('0x4d')]);_0x10ec60[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_[_0xe37b('0x69')](_0x42e094[_0xe37b('0x45')],_0x27188b['filters']));if(_0x42e094['query']['filter']){_0x10ec60[_0xe37b('0x4e')]=_['merge'](_0x10ec60[_0xe37b('0x4e')],{'$or':_[_0xe37b('0x40')](_0x10ec60[_0xe37b('0x49')],function(_0x2b65a6){var _0x40f80c={};_0x40f80c[_0x2b65a6]={'$like':'%'+_0x42e094[_0xe37b('0x45')][_0xe37b('0x4f')]+'%'};return _0x40f80c;})});}_0x10ec60=_['merge']({},_0x10ec60,_0x42e094[_0xe37b('0x52')]);return _0x3ac134[_0xe37b('0x84')](_0x10ec60);}})[_0xe37b('0x35')](function(_0x779416){if(_0x779416){_0x57bfb1=_0x779416['length'];if(!_0x42e094['query'][_0xe37b('0x68')]('nolimit')){_0x10ec60[_0xe37b('0x2e')]=qs[_0xe37b('0x2e')](_0x42e094[_0xe37b('0x45')]['limit']);_0x10ec60['offset']=qs['offset'](_0x42e094['query'][_0xe37b('0x30')]);}return _0x3ac134[_0xe37b('0x84')](_0x10ec60);}})[_0xe37b('0x35')](function(_0xc2c415){if(_0xc2c415){return _0xc2c415?{'count':_0x57bfb1,'rows':_0xc2c415}:null;}})[_0xe37b('0x35')](respondWithResult(_0x2fe464,null))[_0xe37b('0x29')](handleError(_0x2fe464,null));};function Extension(_0x3b0c0e,_0x12ee1e,_0x15698f,_0x13dbbe){this['context']=_0xe37b('0x85');this[_0xe37b('0x86')]=_0x3b0c0e[_0xe37b('0x87')];this[_0xe37b('0x88')]=_0x13dbbe;this[_0xe37b('0x43')]=_0xe37b('0x89');this[_0xe37b('0x8a')]=_0xe37b('0x8b');this[_0xe37b('0x63')]=_0x3b0c0e['id'];this[_0xe37b('0x82')]=_0x12ee1e;this[_0xe37b('0x8c')]=_0x15698f;}function createExtensionsReciveFax(_0x4e8b23){var _0xc0277c=0x1;var _0x4e562f=[];_0x4e562f[_0xe37b('0x8d')](new Extension(_0x4e8b23,_0xc0277c,'',_0xe37b('0x8e')));_0xc0277c+=0x1;_0x4e562f[_0xe37b('0x8d')](new Extension(_0x4e8b23,_0xc0277c,_0xe37b('0x8f'),_0xe37b('0x90')));_0xc0277c+=0x1;for(var _0x2ec17d in _0x4e8b23){if(_0x4e8b23[_0xe37b('0x68')](_0x2ec17d)&&(_0x2ec17d===_0xe37b('0x91')||_0x2ec17d===_0xe37b('0x87')||_0x2ec17d==='gateway'||_0x2ec17d==='faxdetect'||_0x2ec17d==='headerinfo'||_0x2ec17d===_0xe37b('0x92')||_0x2ec17d===_0xe37b('0x93')||_0x2ec17d===_0xe37b('0x94')||_0x2ec17d===_0xe37b('0x95'))){_0x4e562f['push'](new Extension(_0x4e8b23,_0xc0277c,_0xe37b('0x96')+_0x2ec17d+')='+_0x4e8b23[_0x2ec17d],_0xe37b('0x90')));_0xc0277c+=0x1;}}_0x4e562f[_0xe37b('0x8d')](new Extension(_0x4e8b23,_0xc0277c,'6',_0xe37b('0x97')));_0xc0277c+=0x1;_0x4e562f['push'](new Extension(_0x4e8b23,_0xc0277c,'/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',_0xe37b('0x98')));_0xc0277c=0x0;return _0x4e562f;}exports[_0xe37b('0x99')]=function(_0x490cbe,_0x27a5b7,_0xd70508){var _0x845acb;return db[_0xe37b('0x7c')][_0xe37b('0x9a')](function(_0x2ebcb8){return db['FaxAccount'][_0xe37b('0x5a')](_0x490cbe[_0xe37b('0x5f')],{'transaction':_0x2ebcb8})[_0xe37b('0x35')](function(_0x526f58){_0x845acb=_0x526f58[_0xe37b('0x37')]({'plain':!![]});return db[_0xe37b('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x845acb),{'transaction':_0x2ebcb8});});})[_0xe37b('0x35')](function(){return _0x845acb;})['then'](respondWithResult(_0x27a5b7,null))[_0xe37b('0x29')](handleError(_0x27a5b7,null));};exports['updateAccountApplications']=function(_0x1cd192,_0xc2aced,_0x5117a3){var _0x3e8017;return db[_0xe37b('0x7c')]['transaction'](function(_0x484ec2){return db[_0xe37b('0x41')][_0xe37b('0x34')](_0x1cd192['body'],{'where':{'id':_0x1cd192[_0xe37b('0x5f')]['id']},'transaction':_0x484ec2})['then'](function(_0x3b2282){return db[_0xe37b('0x9b')]['destroy']({'where':{'FaxAccountId':_0x1cd192[_0xe37b('0x5f')]['id']},'transaction':_0x484ec2})[_0xe37b('0x35')](function(_0x3beb99){return db[_0xe37b('0x9b')][_0xe37b('0x9c')](createExtensionsReciveFax(_[_0xe37b('0x70')](_0x1cd192[_0xe37b('0x5f')],[_0xe37b('0x9d'),_0xe37b('0x9e'),_0xe37b('0x9f'),'updatedAt',_0xe37b('0xa0'),_0xe37b('0xa1')])),{'transaction':_0x484ec2});});});})[_0xe37b('0x35')](function(){return db[_0xe37b('0x41')]['findById'](_0x1cd192[_0xe37b('0x5f')]['id']);})['then'](respondWithResult(_0xc2aced,null))[_0xe37b('0x29')](handleError(_0xc2aced,null));};exports[_0xe37b('0xa2')]=function(_0x807984,_0x8b5a40,_0x166a54){var _0x3f6c54={'raw':!![],'where':{}};var _0x2ef41a={};var _0x258753={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x807984[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x8b5a40,null))[_0xe37b('0x35')](function(_0x1f7c5d){if(_0x1f7c5d){_0x2ef41a[_0xe37b('0x44')]=_[_0xe37b('0x46')](db[_0xe37b('0xa3')]['rawAttributes']);_0x2ef41a[_0xe37b('0x45')]=_['keys'](_0x807984[_0xe37b('0x45')]);_0x2ef41a[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x2ef41a[_0xe37b('0x44')],_0x2ef41a[_0xe37b('0x45')]);_0x3f6c54[_0xe37b('0x49')]=_['intersection'](_0x2ef41a[_0xe37b('0x44')],qs[_0xe37b('0x4a')](_0x807984[_0xe37b('0x45')][_0xe37b('0x4a')]));_0x3f6c54['attributes']=_0x3f6c54[_0xe37b('0x49')][_0xe37b('0x67')]?_0x3f6c54[_0xe37b('0x49')]:_0x2ef41a[_0xe37b('0x44')];if(!_0x807984[_0xe37b('0x45')][_0xe37b('0x68')]('nolimit')){_0x3f6c54[_0xe37b('0x2e')]=qs[_0xe37b('0x2e')](_0x807984[_0xe37b('0x45')]['limit']);_0x3f6c54[_0xe37b('0x30')]=qs[_0xe37b('0x30')](_0x807984[_0xe37b('0x45')][_0xe37b('0x30')]);}_0x3f6c54[_0xe37b('0x4c')]=qs[_0xe37b('0x4d')](_0x807984['query'][_0xe37b('0x4d')]);_0x3f6c54[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_[_0xe37b('0x69')](_0x807984[_0xe37b('0x45')],_0x2ef41a[_0xe37b('0x47')]));_0x3f6c54['where'][_0xe37b('0x63')]=_0x1f7c5d['id'];if(_0x807984[_0xe37b('0x45')][_0xe37b('0x4f')]){_0x3f6c54[_0xe37b('0x4e')]=_['merge'](_0x3f6c54[_0xe37b('0x4e')],{'$or':_['map'](_0x3f6c54[_0xe37b('0x49')],function(_0x2e0e68){var _0xc094db={};_0xc094db[_0x2e0e68]={'$like':'%'+_0x807984[_0xe37b('0x45')][_0xe37b('0x4f')]+'%'};return _0xc094db;})});}if(_0x807984[_0xe37b('0x45')][_0xe37b('0xa4')]){var _0x4d86f1=_0x807984[_0xe37b('0x45')]['$gte'][_0xe37b('0xa5')](',');var _0x4d458d={};_0x4d458d[_0x4d86f1[0x0]]={'$gte':moment(_0x4d86f1[0x1])[_0xe37b('0xa6')](_0xe37b('0xa7'))};_0x3f6c54[_0xe37b('0x4e')]=_['merge'](_0x3f6c54[_0xe37b('0x4e')],_0x4d458d);}_0x3f6c54=_['merge']({},_0x3f6c54,_0x807984[_0xe37b('0x52')]);return db[_0xe37b('0xa3')][_0xe37b('0x2f')]({'where':_0x3f6c54[_0xe37b('0x4e')]})[_0xe37b('0x35')](function(_0x1b2b4f){_0x258753[_0xe37b('0x2f')]=_0x1b2b4f;if(_0x807984['query'][_0xe37b('0x53')]){_0x3f6c54[_0xe37b('0x54')]=[{'all':!![]}];}return db[_0xe37b('0xa3')]['findAll'](_0x3f6c54);})[_0xe37b('0x35')](function(_0x2df8ad){_0x258753[_0xe37b('0x56')]=_0x2df8ad;return _0x258753;});}})[_0xe37b('0x35')](respondWithFilteredResult(_0x8b5a40,_0x3f6c54))[_0xe37b('0x29')](handleError(_0x8b5a40,null));};exports['send']=function(_0x2f325a,_0x349637,_0x445f14){var _0x3ecc2f,_0x26582a={},_0x54b30f;if(_0x2f325a[_0xe37b('0x5f')]['to']){_0x54b30f=_0x2f325a['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x2f325a[_0xe37b('0x58')]['id']},'include':[{'model':db[_0xe37b('0xa8')],'as':'List','include':[{'model':db[_0xe37b('0x73')],'as':_0xe37b('0xa9'),'where':{'fax':_0x54b30f},'limit':0x1,'order':[['updatedAt',_0xe37b('0xaa')]]}]}]})[_0xe37b('0x35')](handleEntityNotFound(_0x349637,null))[_0xe37b('0x35')](function(_0x559deb){_0x3ecc2f=_0x559deb;if(_0x2f325a[_0xe37b('0x5f')]['attachments']&&_0x2f325a[_0xe37b('0x5f')]['attachments'][_0xe37b('0x67')]){for(var _0x47b41a=0x0;_0x47b41a<_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')]['length'];_0x47b41a+=0x1){_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][_0x47b41a]={'filename':_0x2f325a[_0xe37b('0x5f')]['attachments'][_0x47b41a][_0xe37b('0x3c')],'id':_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][_0x47b41a]['id'],'path':path[_0xe37b('0xac')](config[_0xe37b('0xad')],_0xe37b('0xae'),_0x2f325a[_0xe37b('0x5f')]['attachments'][_0x47b41a][_0xe37b('0xaf')])};}}return respondWithRpcPromise(_0xe37b('0xb0'),_0xe37b('0xb0'),{'FaxAccountId':_[_0xe37b('0xb1')](_0x2f325a[_0xe37b('0x58')]['id'])?undefined:_0x2f325a[_0xe37b('0x58')]['id'],'path':_[_0xe37b('0xb1')](_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0][_0xe37b('0x6')])?undefined:_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0][_0xe37b('0x6')],'fax':_[_0xe37b('0xb1')](_0x2f325a['body']['to'][0x0])?undefined:_0x2f325a[_0xe37b('0x5f')]['to'][0x0]},client9002);})['then'](function(){if(_0x3ecc2f){if(_[_0xe37b('0xb1')](_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xb2')])){_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xb2')]=util[_0xe37b('0xa6')](_0xe37b('0xb3'),_0x3ecc2f['name'],_0x3ecc2f[_0xe37b('0xb4')]);}if(_0x3ecc2f[_0xe37b('0xb5')]){if(_0x3ecc2f[_0xe37b('0xb5')][_0xe37b('0xa9')][_0xe37b('0x67')]){return _0x3ecc2f[_0xe37b('0xb5')][_0xe37b('0xa9')][0x0];}else{return db[_0xe37b('0x73')][_0xe37b('0x5a')](_['defaults'](_0x2f325a[_0xe37b('0x5f')],{'firstName':_0x2f325a[_0xe37b('0x5f')]['to'][0x0],'phone':_0x2f325a[_0xe37b('0x5f')]['to'][0x0],'fax':_0x2f325a[_0xe37b('0x5f')]['to'][0x0],'ListId':_0x3ecc2f[_0xe37b('0xa1')]}));}}else{throw new Error(_0xe37b('0xb6'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xe37b('0x35')](function(_0x1b2e46){if(_0x1b2e46){return db['FaxInteraction'][_0xe37b('0x59')]({'where':{'ContactId':_0x1b2e46['id'],'closed':![],'FaxAccountId':_0x3ecc2f['id']}})[_0xe37b('0x35')](function(_0x25d690){if(_0x25d690){return[_0x25d690,![]];}return db['FaxInteraction'][_0xe37b('0x5a')]({'UserId':_0x2f325a[_0xe37b('0xb7')]['id'],'ContactId':_0x1b2e46['id'],'FaxAccountId':_0x3ecc2f['id'],'fax':_0x2f325a[_0xe37b('0x5f')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xe37b('0x51')](_0x2f325a[_0xe37b('0x5f')],{'read':![],'body':_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0][_0xe37b('0xb8')],'FaxAccountId':_0x3ecc2f['id'],'UserId':_0x2f325a[_0xe37b('0xb7')]['id'],'ContactId':_0x1b2e46['id'],'AttachmentId':_0x2f325a['body'][_0xe37b('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xe37b('0xb9')}]})[_0xe37b('0x35')](function(_0x43693b){return[_0x43693b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x49e22c,_0x479841){if(_0x479841){return _0x49e22c;}return db[_0xe37b('0xa3')][_0xe37b('0x5a')]({'direction':_0xe37b('0xba'),'read':![],'body':_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0][_0xe37b('0xb8')],'FaxAccountId':_0x3ecc2f['id'],'FaxInteractionId':_0x49e22c['id'],'UserId':_0x2f325a[_0xe37b('0xb7')]['id'],'ContactId':_0x49e22c['ContactId'],'AttachmentId':_0x2f325a[_0xe37b('0x5f')]['attachments'][0x0]['id']})[_0xe37b('0x35')](function(_0x1a0ab3){_0x49e22c[_0xe37b('0xbb')][_0xe37b('0xb9')]=[];_0x49e22c['dataValues'][_0xe37b('0xb9')][_0xe37b('0x8d')](_0x1a0ab3[_0xe37b('0xbb')]);return _0x49e22c;});})[_0xe37b('0x35')](function(_0x5bb01c){respondWithRpcPromise(_0xe37b('0xbc'),'SendFax',{'FaxAccountId':_[_0xe37b('0xb1')](_0x2f325a['params']['id'])?undefined:_0x2f325a[_0xe37b('0x58')]['id'],'path':_[_0xe37b('0xb1')](_0x2f325a['body'][_0xe37b('0xab')][0x0]['path'])?undefined:_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0][_0xe37b('0x6')],'fax':_[_0xe37b('0xb1')](_0x2f325a[_0xe37b('0x5f')]['to'][0x0])?undefined:_0x2f325a['body']['to'][0x0],'AttachmentId':_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0]['id']},client9002)[_0xe37b('0x35')](function(_0x4dffad){logger['info'](_0xe37b('0xbd'),_0x4dffad);})[_0xe37b('0x29')](function(_0x89ecfe){logger[_0xe37b('0x20')](_0xe37b('0xbd'),_0x89ecfe);});return _0x5bb01c;})[_0xe37b('0x35')](respondWithResult(_0x349637,null))[_0xe37b('0x29')](handleError(_0x349637,null));};exports[_0xe37b('0xbe')]=function(_0x3a7d63,_0x3eaf10,_0x531741){return db['FaxAccount'][_0xe37b('0x59')]({'where':{'id':_0x3a7d63[_0xe37b('0x58')]['id']}})['then'](handleEntityNotFound(_0x3eaf10,null))[_0xe37b('0x35')](function(_0x17a3fa){if(_0x17a3fa){return _0x17a3fa[_0xe37b('0xbe')](_0x3a7d63[_0xe37b('0x5f')][_0xe37b('0x6b')],_[_0xe37b('0x70')](_0x3a7d63[_0xe37b('0x5f')],[_0xe37b('0x6b'),'id'])||{})[_0xe37b('0xbf')](function(_0xe8231f){for(var _0x4e2ef4=0x0;_0x4e2ef4<_0x3a7d63[_0xe37b('0x5f')][_0xe37b('0x6b')][_0xe37b('0x67')];_0x4e2ef4+=0x1){socket['emit'](_0xe37b('0xc0'),{'UserId':Number(_0x3a7d63['body'][_0xe37b('0x6b')][_0x4e2ef4]),'FaxAccountId':Number(_0x3a7d63['params']['id'])});}return _0xe8231f;});}})[_0xe37b('0x35')](respondWithResult(_0x3eaf10,null))['catch'](handleError(_0x3eaf10,null));};exports[_0xe37b('0xc1')]=function(_0x53c935,_0x4bfa37,_0x208046){return db[_0xe37b('0x41')][_0xe37b('0x59')]({'where':{'id':_0x53c935['params']['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x4bfa37,null))['then'](function(_0x102194){if(_0x102194){return _0x102194[_0xe37b('0xc1')](_0x53c935[_0xe37b('0x45')]['ids'])['then'](function(){if(_[_0xe37b('0xc2')](_0x53c935[_0xe37b('0x45')][_0xe37b('0x6b')])){for(var _0x5ecd54=0x0;_0x5ecd54<_0x53c935['query']['ids'][_0xe37b('0x67')];_0x5ecd54+=0x1){socket[_0xe37b('0xc3')](_0xe37b('0xc4'),{'UserId':Number(_0x53c935['query']['ids'][_0x5ecd54]),'FaxAccountId':Number(_0x53c935['params']['id'])});}}else{socket[_0xe37b('0xc3')]('userFaxAccount:remove',{'UserId':Number(_0x53c935[_0xe37b('0x45')]['ids']),'FaxAccountId':Number(_0x53c935[_0xe37b('0x58')]['id'])});}});}})[_0xe37b('0x35')](respondWithStatusCode(_0x4bfa37,null))[_0xe37b('0x29')](handleError(_0x4bfa37,null));};exports['getAgents']=function(_0x185fda,_0x6913df,_0x16766b){var _0x2a7607={};var _0x2dd064={};var _0x49b6a1;var _0x1521f4;return db[_0xe37b('0x41')]['findOne']({'where':{'id':_0x185fda[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x6913df,null))[_0xe37b('0x35')](function(_0x479ed4){if(_0x479ed4){_0x49b6a1=_0x479ed4;_0x2dd064['model']=_[_0xe37b('0x46')](db[_0xe37b('0x75')][_0xe37b('0x42')]);_0x2dd064[_0xe37b('0x45')]=_['keys'](_0x185fda[_0xe37b('0x45')]);_0x2dd064[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x2dd064['model'],_0x2dd064[_0xe37b('0x45')]);_0x2a7607[_0xe37b('0x49')]=_[_0xe37b('0x48')](_0x2dd064[_0xe37b('0x44')],qs['fields'](_0x185fda[_0xe37b('0x45')]['fields']));_0x2a7607[_0xe37b('0x49')]=_0x2a7607['attributes'][_0xe37b('0x67')]?_0x2a7607['attributes']:_0x2dd064[_0xe37b('0x44')];_0x2a7607['order']=qs['sort'](_0x185fda[_0xe37b('0x45')]['sort']);_0x2a7607['where']=qs[_0xe37b('0x47')](_['pick'](_0x185fda[_0xe37b('0x45')],_0x2dd064['filters']));if(_0x185fda[_0xe37b('0x45')][_0xe37b('0x4f')]){_0x2a7607[_0xe37b('0x4e')]=_['merge'](_0x2a7607[_0xe37b('0x4e')],{'$or':_[_0xe37b('0x40')](_0x2a7607[_0xe37b('0x49')],function(_0x8df767){var _0x2999a2={};_0x2999a2[_0x8df767]={'$like':'%'+_0x185fda[_0xe37b('0x45')][_0xe37b('0x4f')]+'%'};return _0x2999a2;})});}_0x2a7607=_[_0xe37b('0x51')]({},_0x2a7607,_0x185fda[_0xe37b('0x52')]);return _0x49b6a1[_0xe37b('0xc5')](_0x2a7607);}})[_0xe37b('0x35')](function(_0x148580){if(_0x148580){_0x1521f4=_0x148580['length'];if(!_0x185fda['query'][_0xe37b('0x68')](_0xe37b('0x4b'))){_0x2a7607[_0xe37b('0x2e')]=qs['limit'](_0x185fda['query'][_0xe37b('0x2e')]);_0x2a7607[_0xe37b('0x30')]=qs[_0xe37b('0x30')](_0x185fda[_0xe37b('0x45')][_0xe37b('0x30')]);}return _0x49b6a1['getAgents'](_0x2a7607);}})['then'](function(_0x163c4e){if(_0x163c4e){return _0x163c4e?{'count':_0x1521f4,'rows':_0x163c4e}:null;}})['then'](respondWithResult(_0x6913df,null))['catch'](handleError(_0x6913df,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 7b45402..cbb4215 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 _0x6db6=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6db6,0x1ca));var _0x66db=function(_0x4deb04,_0x4deee3){_0x4deb04=_0x4deb04-0x0;var _0x3d65e4=_0x6db6[_0x4deb04];return _0x3d65e4;};'use strict';var EventEmitter=require(_0x66db('0x0'));var FaxAccount=require(_0x66db('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x66db('0x2'),'afterUpdate':_0x66db('0x3'),'afterDestroy':_0x66db('0x4')};function emitEvent(_0x341cd2){return function(_0x2b2e54,_0x5b2f65,_0x5d444f){FaxAccountEvents[_0x66db('0x5')](_0x341cd2+':'+_0x2b2e54['id'],_0x2b2e54);FaxAccountEvents[_0x66db('0x5')](_0x341cd2,_0x2b2e54);_0x5d444f(null);};}for(var e in events){if(events[_0x66db('0x6')](e)){var event=events[e];FaxAccount[_0x66db('0x7')](e,emitEvent(event));}}module[_0x66db('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x6da9=['emit','hook','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x2ef6c8,_0x43ea5f){var _0x15e631=function(_0x5e3b3a){while(--_0x5e3b3a){_0x2ef6c8['push'](_0x2ef6c8['shift']());}};_0x15e631(++_0x43ea5f);}(_0x6da9,0x161));var _0x96da=function(_0x5429fd,_0x456b33){_0x5429fd=_0x5429fd-0x0;var _0x577643=_0x6da9[_0x5429fd];return _0x577643;};'use strict';var EventEmitter=require(_0x96da('0x0'));var FaxAccount=require(_0x96da('0x1'))['db'][_0x96da('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x96da('0x3')](0x0);var events={'afterCreate':_0x96da('0x4'),'afterUpdate':_0x96da('0x5'),'afterDestroy':_0x96da('0x6')};function emitEvent(_0x5198e8){return function(_0x5d07cd,_0x4fd3b8,_0x191a57){FaxAccountEvents[_0x96da('0x7')](_0x5198e8+':'+_0x5d07cd['id'],_0x5d07cd);FaxAccountEvents[_0x96da('0x7')](_0x5198e8,_0x5d07cd);_0x191a57(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x96da('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 462a818..9102f59 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 _0x24e4=['./faxAccount.attributes','exports','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x34ea5d,_0x233880){var _0x12801c=function(_0x6d6f14){while(--_0x6d6f14){_0x34ea5d['push'](_0x34ea5d['shift']());}};_0x12801c(++_0x233880);}(_0x24e4,0x13a));var _0x424e=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x24e4[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0x424e('0x0'));var util=require(_0x424e('0x1'));var logger=require(_0x424e('0x2'))(_0x424e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x424e('0x4'));var fs=require('fs');var path=require(_0x424e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x424e('0x6'));module[_0x424e('0x7')]=function(_0x152c17,_0x2fbf92){return _0x152c17['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa394=['../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','FaxAccount','fax_accounts','lodash'];(function(_0x3449b7,_0x49680a){var _0x33ce15=function(_0xc3a88b){while(--_0xc3a88b){_0x3449b7['push'](_0x3449b7['shift']());}};_0x33ce15(++_0x49680a);}(_0xa394,0xd1));var _0x4a39=function(_0x46fa46,_0x533f3e){_0x46fa46=_0x46fa46-0x0;var _0x2ab26c=_0xa394[_0x46fa46];return _0x2ab26c;};'use strict';var _=require(_0x4a39('0x0'));var util=require('util');var logger=require(_0x4a39('0x1'))(_0x4a39('0x2'));var moment=require(_0x4a39('0x3'));var BPromise=require(_0x4a39('0x4'));var rp=require(_0x4a39('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a39('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x4a39('0x7')]=function(_0x419a46,_0x4591a9){return _0x419a46['define'](_0x4a39('0x8'),attributes,{'tableName':_0x4a39('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index befece4..48722b1 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 _0x44c5=['agent','name','waitForTheAssignedAgent','*,*,*,*','queueId','FaxQueue','unshift','queue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxAccount','findAll','options','where','attributes','limit','include','map','model','body','fax','CmContact','describe','Sequelize','ValidationError','updatedAt','difference','keys','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','applications','list','priority','asc','contact','FaxInteraction','create','Contact\x20not\x20found','get','autoclose','push','length','close','unmanaged','created','interaction','AttachmentId','UserId','User'];(function(_0x5d7c06,_0x3c4489){var _0x315f62=function(_0x2334cd){while(--_0x2334cd){_0x5d7c06['push'](_0x5d7c06['shift']());}};_0x315f62(++_0x3c4489);}(_0x44c5,0x1db));var _0x544c=function(_0x1943d9,_0x245bb8){_0x1943d9=_0x1943d9-0x0;var _0x4b4f3f=_0x44c5[_0x1943d9];return _0x4b4f3f;};'use strict';var _=require(_0x544c('0x0'));var util=require(_0x544c('0x1'));var moment=require(_0x544c('0x2'));var BPromise=require(_0x544c('0x3'));var rs=require(_0x544c('0x4'));var fs=require('fs');var Redis=require(_0x544c('0x5'));var db=require(_0x544c('0x6'))['db'];var utils=require(_0x544c('0x7'));var logger=require(_0x544c('0x8'))(_0x544c('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x544c('0xa')][_0x544c('0xb')]({'port':0x232c});config[_0x544c('0xc')]=_[_0x544c('0xd')](config[_0x544c('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x544c('0xc')]));require(_0x544c('0xe'))[_0x544c('0xf')](socket);function respondWithRpcPromise(_0xaa9bb1,_0x5da561,_0x1f15c1){return new BPromise(function(_0x15c0d1,_0x450766){return client[_0x544c('0x10')](_0xaa9bb1,_0x1f15c1)[_0x544c('0x11')](function(_0x3db838){logger[_0x544c('0x12')](_0x544c('0x13'),_0x5da561,_0x544c('0x14'));logger[_0x544c('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5da561,_0x544c('0x14'),JSON[_0x544c('0x16')](_0x3db838));if(_0x3db838[_0x544c('0x17')]){if(_0x3db838[_0x544c('0x17')][_0x544c('0x18')]===0x1f4){logger[_0x544c('0x17')](_0x544c('0x13'),_0x5da561,_0x3db838['error'][_0x544c('0x19')]);return _0x450766(_0x3db838[_0x544c('0x17')][_0x544c('0x19')]);}logger[_0x544c('0x17')](_0x544c('0x13'),_0x5da561,_0x3db838[_0x544c('0x17')]['message']);return _0x15c0d1(_0x3db838['error']['message']);}else{logger[_0x544c('0x12')](_0x544c('0x13'),_0x5da561,_0x544c('0x14'));_0x15c0d1(_0x3db838[_0x544c('0x1a')][_0x544c('0x19')]);}})[_0x544c('0x1b')](function(_0x532a02){logger[_0x544c('0x17')](_0x544c('0x13'),_0x5da561,_0x532a02);_0x450766(_0x532a02);});});}exports[_0x544c('0x1c')]=function(_0x1834c8){var _0x6e63c5=this;return new Promise(function(_0x56712e,_0x15e460){return db['FaxAccount'][_0x544c('0x1d')]({'raw':_0x1834c8[_0x544c('0x1e')]?_0x1834c8[_0x544c('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1834c8[_0x544c('0x1e')]?_0x1834c8[_0x544c('0x1e')][_0x544c('0x1f')]||null:null,'attributes':_0x1834c8[_0x544c('0x1e')]?_0x1834c8[_0x544c('0x1e')][_0x544c('0x20')]||null:null,'limit':_0x1834c8[_0x544c('0x1e')]?_0x1834c8['options'][_0x544c('0x21')]||null:null,'include':_0x1834c8[_0x544c('0x1e')]?_0x1834c8[_0x544c('0x1e')][_0x544c('0x22')]?_[_0x544c('0x23')](_0x1834c8['options'][_0x544c('0x22')],function(_0x39a05a){return{'model':db[_0x39a05a[_0x544c('0x24')]],'as':_0x39a05a['as'],'attributes':_0x39a05a[_0x544c('0x20')],'include':_0x39a05a[_0x544c('0x22')]?_['map'](_0x39a05a[_0x544c('0x22')],function(_0x1a4aff){return{'model':db[_0x1a4aff['model']],'as':_0x1a4aff['as'],'attributes':_0x1a4aff['attributes'],'include':_0x1a4aff[_0x544c('0x22')]?_['map'](_0x1a4aff[_0x544c('0x22')],function(_0x2dac4c){return{'model':db[_0x2dac4c[_0x544c('0x24')]],'as':_0x2dac4c['as'],'attributes':_0x2dac4c[_0x544c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x544c('0x11')](function(_0x51605b){logger[_0x544c('0x12')](_0x544c('0x1c'),_0x1834c8);logger['debug'](_0x544c('0x1c'),_0x1834c8,JSON[_0x544c('0x16')](_0x51605b));_0x56712e(_0x51605b);})['catch'](function(_0x354903){logger[_0x544c('0x17')]('GetFaxAccount',_0x354903[_0x544c('0x19')],_0x1834c8);_0x15e460(_0x6e63c5[_0x544c('0x17')](0x1f4,_0x354903[_0x544c('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x3f2e28,_0x2bf3a8,_0x280ef2){var _0x254475=this;return new Promise(function(_0x50d703,_0x24e84c){var _0x275734={'body':_0x3f2e28[_0x544c('0x25')],'channel':_0x544c('0x26')};var _0x691d97=[];var _0x33bc11=[];var _0x129efc={};return db[_0x544c('0x27')][_0x544c('0x28')]()[_0x544c('0x11')](function(_0x45c130){if(!_0x45c130){throw new db[(_0x544c('0x29'))][(_0x544c('0x2a'))]('no\x20available\x20attributes');}_0x691d97=_['difference'](_['keys'](_0x45c130),['createdAt',_0x544c('0x2b')]);_0x33bc11=_[_0x544c('0x2c')](_[_0x544c('0x2d')](_0x45c130),[_0x544c('0x2e'),_0x544c('0x2b'),_0x544c('0x2f'),_0x544c('0x30')]);if(_0x3f2e28[_0x544c('0x25')]['id']){delete _0x3f2e28[_0x544c('0x25')]['id'];}if(_[_0x544c('0x31')](_0x3f2e28[_0x544c('0x25')][_0x544c('0x32')])){throw new db[(_0x544c('0x29'))][(_0x544c('0x2a'))](_0x544c('0x33'));}if(_[_0x544c('0x31')](_0x3f2e28[_0x544c('0x25')][_0x544c('0x25')])||_0x3f2e28[_0x544c('0x25')][_0x544c('0x25')]===''){throw new db[(_0x544c('0x29'))][(_0x544c('0x2a'))](_0x544c('0x34'));}if(_[_0x544c('0x31')](_0x3f2e28[_0x544c('0x25')][_0x544c('0x35')])){throw new db['Sequelize'][(_0x544c('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33bc11);}if(!_[_0x544c('0x36')](_0x33bc11,_0x3f2e28[_0x544c('0x25')][_0x544c('0x35')])){throw new db[(_0x544c('0x29'))][(_0x544c('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33bc11);}_0x129efc[_0x3f2e28['body'][_0x544c('0x35')]]=_0x3f2e28[_0x544c('0x25')][_0x544c('0x32')];})[_0x544c('0x11')](function(){return db[_0x544c('0x37')][_0x544c('0x38')]({'where':{'id':_0x3f2e28[_0x544c('0x39')]['id']},'include':[{'model':db[_0x544c('0x3a')],'as':_0x544c('0x3b'),'include':[{'model':db[_0x544c('0x27')],'as':_0x544c('0x3c'),'where':_0x129efc,'limit':0x1,'order':[[_0x544c('0x2b'),_0x544c('0x3d')]]}]},{'model':db[_0x544c('0x3e')],'as':_0x544c('0x3f')}]});})[_0x544c('0x11')](function(_0x3ceaa1){if(_0x3ceaa1&&_0x3ceaa1[_0x544c('0x3b')]){var _0x3a36ab=_0x3ceaa1['get']({'plain':!![]});_0x275734['account']=_0x3a36ab;_0x275734[_0x544c('0x40')]=_0x3a36ab[_0x544c('0x3f')];_0x275734[_0x544c('0x41')]=_0x3a36ab['List'];_0x275734[_0x544c('0x40')]=_['orderBy'](_0x275734['applications'],[_0x544c('0x42')],[_0x544c('0x43')]);if(_0x275734[_0x544c('0x39')][_0x544c('0x3f')]){delete _0x275734[_0x544c('0x39')][_0x544c('0x3f')];}if(_0x275734['account']['List']&&_0x275734[_0x544c('0x39')][_0x544c('0x3b')]['Contacts']['length']){return _0x275734[_0x544c('0x39')][_0x544c('0x3b')][_0x544c('0x3c')][0x0];}var _0x211f32=_[_0x544c('0xd')](_0x3f2e28['body'],{'firstName':_0x3f2e28[_0x544c('0x25')][_0x544c('0x32')],'ListId':_0x3a36ab[_0x544c('0x30')]});_0x211f32[_0x3f2e28[_0x544c('0x25')][_0x544c('0x35')]]=_0x3f2e28[_0x544c('0x25')][_0x544c('0x32')];return db[_0x544c('0x27')]['create'](_0x211f32,{'fields':_0x691d97,'raw':!![]});}})[_0x544c('0x11')](function(_0x39a68e){_0x275734[_0x544c('0x44')]=_0x39a68e;if(_0x39a68e){var _0x35ca99={'ContactId':_0x39a68e['id'],'FaxAccountId':_0x3f2e28['account']['id'],'fax':_0x39a68e['fax']};return db[_0x544c('0x45')][_0x544c('0x38')]({'where':{'ContactId':_0x39a68e['id'],'closed':![],'FaxAccountId':_0x3f2e28[_0x544c('0x39')]['id']}})[_0x544c('0x11')](function(_0x9d430d){if(_0x9d430d){return[_0x9d430d,![]];}return db[_0x544c('0x45')][_0x544c('0x46')](_0x35ca99)['then'](function(_0x2be6db){return[_0x2be6db,!![]];});});}else{throw new Error(_0x544c('0x47'));}})['spread'](function(_0x4e1427,_0x2ffbbf){var _0x3dee66=_0x4e1427[_0x544c('0x48')]({'plain':!![]});if(_0x2ffbbf){if(_0x275734[_0x544c('0x39')][_0x544c('0x49')]){_0x275734['applications'][_0x544c('0x4a')]({'id':0x0,'priority':_0x275734[_0x544c('0x40')][_0x544c('0x4b')]+0x1,'app':_0x544c('0x4c'),'appdata':_0x544c('0x4d'),'interval':'*,*,*,*'});}_0x3dee66['created']=!![];}else{_0x3dee66[_0x544c('0x4e')]=![];}_0x275734[_0x544c('0x4f')]=_0x3dee66;return db['FaxMessage']['create']({'body':_0x3f2e28[_0x544c('0x25')][_0x544c('0x25')],'FaxAccountId':_0x3f2e28['account']['id'],'FaxInteractionId':_0x4e1427['id'],'direction':'in','ContactId':_0x4e1427['ContactId'],'AttachmentId':_0x3f2e28[_0x544c('0x25')][_0x544c('0x50')]});})[_0x544c('0x11')](function(_0x506d75){_0x275734[_0x544c('0x19')]=_0x506d75;if(!_0x275734[_0x544c('0x4f')][_0x544c('0x51')])return;return db[_0x544c('0x52')][_0x544c('0x38')]({'attributes':['id','name'],'where':{'id':_0x275734['interaction'][_0x544c('0x51')]}});})['then'](function(_0x45063c){if(_0x45063c){_0x275734[_0x544c('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':_0x544c('0x53'),'appdata':_0x45063c[_0x544c('0x54')]+','+(_0x275734[_0x544c('0x39')][_0x544c('0x55')]||0xa),'interval':_0x544c('0x56')});}if(!_0x275734[_0x544c('0x4f')][_0x544c('0x57')])return;return db[_0x544c('0x58')][_0x544c('0x38')]({'attributes':['id',_0x544c('0x54')],'where':{'id':_0x275734[_0x544c('0x4f')][_0x544c('0x57')]}});})[_0x544c('0x11')](function(_0x1134db){if(_0x1134db){_0x275734[_0x544c('0x40')][_0x544c('0x59')]({'id':0x0,'priority':0x1,'app':_0x544c('0x5a'),'appdata':_0x1134db[_0x544c('0x54')]+','+(_0x275734[_0x544c('0x39')]['waitForTheAssignedQueue']||0x12c),'interval':_0x544c('0x56')});}return respondWithRpcPromise(_0x544c('0x5b'),_0x544c('0x5c'),_0x275734);})[_0x544c('0x11')](function(_0x150f7a){_0x50d703(_0x150f7a);})['catch'](function(_0x334d54){_0x24e84c(_0x254475[_0x544c('0x17')](0x1f4,_0x334d54['message']));});});}; \ No newline at end of file +var _0xf3ab=['startRouting','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','fax','CmContact','ValidationError','no\x20available\x20attributes','difference','keys','body','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','updatedAt','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','Contacts','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue'];(function(_0x13d2d0,_0x1b3a81){var _0x447d57=function(_0x5a53d2){while(--_0x5a53d2){_0x13d2d0['push'](_0x13d2d0['shift']());}};_0x447d57(++_0x1b3a81);}(_0xf3ab,0xb5));var _0xbf3a=function(_0x172660,_0x260d9b){_0x172660=_0x172660-0x0;var _0x83204f=_0xf3ab[_0x172660];return _0x83204f;};'use strict';var _=require(_0xbf3a('0x0'));var util=require(_0xbf3a('0x1'));var moment=require('moment');var BPromise=require(_0xbf3a('0x2'));var rs=require(_0xbf3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf3a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf3a('0x5'))(_0xbf3a('0x6'));var config=require(_0xbf3a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbf3a('0x8')]['http']({'port':0x232c});config['redis']=_[_0xbf3a('0x9')](config['redis'],{'host':_0xbf3a('0xa'),'port':0x18eb});var socket=require(_0xbf3a('0xb'))(new Redis(config[_0xbf3a('0xc')]));require(_0xbf3a('0xd'))['register'](socket);function respondWithRpcPromise(_0x33a7fa,_0x295f6c,_0x42fb1e){return new BPromise(function(_0x2623fc,_0x3124a2){return client[_0xbf3a('0xe')](_0x33a7fa,_0x42fb1e)[_0xbf3a('0xf')](function(_0x268317){logger[_0xbf3a('0x10')]('FaxAccount,\x20%s,\x20%s',_0x295f6c,'request\x20sent');logger[_0xbf3a('0x11')](_0xbf3a('0x12'),_0x295f6c,'request\x20sent',JSON[_0xbf3a('0x13')](_0x268317));if(_0x268317[_0xbf3a('0x14')]){if(_0x268317['error'][_0xbf3a('0x15')]===0x1f4){logger[_0xbf3a('0x14')](_0xbf3a('0x16'),_0x295f6c,_0x268317[_0xbf3a('0x14')][_0xbf3a('0x17')]);return _0x3124a2(_0x268317[_0xbf3a('0x14')][_0xbf3a('0x17')]);}logger[_0xbf3a('0x14')](_0xbf3a('0x16'),_0x295f6c,_0x268317[_0xbf3a('0x14')][_0xbf3a('0x17')]);return _0x2623fc(_0x268317[_0xbf3a('0x14')]['message']);}else{logger[_0xbf3a('0x10')](_0xbf3a('0x16'),_0x295f6c,_0xbf3a('0x18'));_0x2623fc(_0x268317[_0xbf3a('0x19')][_0xbf3a('0x17')]);}})[_0xbf3a('0x1a')](function(_0x18cbf2){logger[_0xbf3a('0x14')]('FaxAccount,\x20%s,\x20%s',_0x295f6c,_0x18cbf2);_0x3124a2(_0x18cbf2);});});}exports[_0xbf3a('0x1b')]=function(_0x5c2c3b){var _0x1441d7=this;return new Promise(function(_0x1f9a29,_0x187b1b){return db[_0xbf3a('0x1c')]['findAll']({'raw':_0x5c2c3b[_0xbf3a('0x1d')]?_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c2c3b[_0xbf3a('0x1d')]?_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x1f')]||null:null,'attributes':_0x5c2c3b['options']?_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x20')]||null:null,'limit':_0x5c2c3b[_0xbf3a('0x1d')]?_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x21')]||null:null,'include':_0x5c2c3b[_0xbf3a('0x1d')]?_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x22')]?_[_0xbf3a('0x23')](_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x22')],function(_0x333557){return{'model':db[_0x333557['model']],'as':_0x333557['as'],'attributes':_0x333557['attributes'],'include':_0x333557[_0xbf3a('0x22')]?_[_0xbf3a('0x23')](_0x333557[_0xbf3a('0x22')],function(_0x49d53c){return{'model':db[_0x49d53c[_0xbf3a('0x24')]],'as':_0x49d53c['as'],'attributes':_0x49d53c[_0xbf3a('0x20')],'include':_0x49d53c['include']?_['map'](_0x49d53c[_0xbf3a('0x22')],function(_0x4e414f){return{'model':db[_0x4e414f[_0xbf3a('0x24')]],'as':_0x4e414f['as'],'attributes':_0x4e414f[_0xbf3a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbf3a('0xf')](function(_0x47083a){logger[_0xbf3a('0x10')](_0xbf3a('0x1b'),_0x5c2c3b);logger[_0xbf3a('0x11')](_0xbf3a('0x1b'),_0x5c2c3b,JSON['stringify'](_0x47083a));_0x1f9a29(_0x47083a);})[_0xbf3a('0x1a')](function(_0x5636c2){logger[_0xbf3a('0x14')]('GetFaxAccount',_0x5636c2[_0xbf3a('0x17')],_0x5c2c3b);_0x187b1b(_0x1441d7[_0xbf3a('0x14')](0x1f4,_0x5636c2[_0xbf3a('0x17')]));});});};exports[_0xbf3a('0x25')]=function(_0x25e13d,_0x3bf4f6,_0x318ee3){var _0x1daac2=this;return new Promise(function(_0x3d965e,_0x23d37a){var _0x4694cb={'body':_0x25e13d['body'],'channel':_0xbf3a('0x26')};var _0x37b621=[];var _0x180567=[];var _0xc56f78={};return db[_0xbf3a('0x27')]['describe']()['then'](function(_0x5b6816){if(!_0x5b6816){throw new db['Sequelize'][(_0xbf3a('0x28'))](_0xbf3a('0x29'));}_0x37b621=_[_0xbf3a('0x2a')](_[_0xbf3a('0x2b')](_0x5b6816),['createdAt','updatedAt']);_0x180567=_[_0xbf3a('0x2a')](_[_0xbf3a('0x2b')](_0x5b6816),['createdAt','updatedAt','CompanyId','ListId']);if(_0x25e13d[_0xbf3a('0x2c')]['id']){delete _0x25e13d[_0xbf3a('0x2c')]['id'];}if(_[_0xbf3a('0x2d')](_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x2e')])){throw new db[(_0xbf3a('0x2f'))][(_0xbf3a('0x28'))](_0xbf3a('0x30'));}if(_[_0xbf3a('0x2d')](_0x25e13d['body']['body'])||_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x2c')]===''){throw new db[(_0xbf3a('0x2f'))][(_0xbf3a('0x28'))](_0xbf3a('0x31'));}if(_[_0xbf3a('0x2d')](_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x32')])){throw new db[(_0xbf3a('0x2f'))][(_0xbf3a('0x28'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x180567);}if(!_['includes'](_0x180567,_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x32')])){throw new db[(_0xbf3a('0x2f'))]['ValidationError'](_0xbf3a('0x33')+_0x180567);}_0xc56f78[_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x32')]]=_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x2e')];})[_0xbf3a('0xf')](function(){return db[_0xbf3a('0x1c')][_0xbf3a('0x34')]({'where':{'id':_0x25e13d[_0xbf3a('0x35')]['id']},'include':[{'model':db[_0xbf3a('0x36')],'as':_0xbf3a('0x37'),'include':[{'model':db[_0xbf3a('0x27')],'as':'Contacts','where':_0xc56f78,'limit':0x1,'order':[[_0xbf3a('0x38'),_0xbf3a('0x39')]]}]},{'model':db[_0xbf3a('0x3a')],'as':_0xbf3a('0x3b')}]});})[_0xbf3a('0xf')](function(_0x4d14f6){if(_0x4d14f6&&_0x4d14f6[_0xbf3a('0x37')]){var _0x48ff60=_0x4d14f6[_0xbf3a('0x3c')]({'plain':!![]});_0x4694cb['account']=_0x48ff60;_0x4694cb[_0xbf3a('0x3d')]=_0x48ff60[_0xbf3a('0x3b')];_0x4694cb[_0xbf3a('0x3e')]=_0x48ff60['List'];_0x4694cb['applications']=_[_0xbf3a('0x3f')](_0x4694cb[_0xbf3a('0x3d')],['priority'],[_0xbf3a('0x40')]);if(_0x4694cb[_0xbf3a('0x35')]['Applications']){delete _0x4694cb[_0xbf3a('0x35')]['Applications'];}if(_0x4694cb[_0xbf3a('0x35')]['List']&&_0x4694cb[_0xbf3a('0x35')]['List'][_0xbf3a('0x41')][_0xbf3a('0x42')]){return _0x4694cb['account'][_0xbf3a('0x37')][_0xbf3a('0x41')][0x0];}var _0x22235a=_[_0xbf3a('0x9')](_0x25e13d[_0xbf3a('0x2c')],{'firstName':_0x25e13d['body'][_0xbf3a('0x2e')],'ListId':_0x48ff60[_0xbf3a('0x43')]});_0x22235a[_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x32')]]=_0x25e13d[_0xbf3a('0x2c')]['from'];return db['CmContact'][_0xbf3a('0x44')](_0x22235a,{'fields':_0x37b621,'raw':!![]});}})['then'](function(_0x5d2e07){_0x4694cb[_0xbf3a('0x45')]=_0x5d2e07;if(_0x5d2e07){var _0xc9df12={'ContactId':_0x5d2e07['id'],'FaxAccountId':_0x25e13d[_0xbf3a('0x35')]['id'],'fax':_0x5d2e07[_0xbf3a('0x26')]};return db[_0xbf3a('0x46')][_0xbf3a('0x34')]({'where':{'ContactId':_0x5d2e07['id'],'closed':![],'FaxAccountId':_0x25e13d[_0xbf3a('0x35')]['id']}})['then'](function(_0x20600c){if(_0x20600c){return[_0x20600c,![]];}return db[_0xbf3a('0x46')]['create'](_0xc9df12)[_0xbf3a('0xf')](function(_0x4c1c59){return[_0x4c1c59,!![]];});});}else{throw new Error(_0xbf3a('0x47'));}})[_0xbf3a('0x48')](function(_0x4ac59b,_0x19deca){var _0x37b29c=_0x4ac59b[_0xbf3a('0x3c')]({'plain':!![]});if(_0x19deca){if(_0x4694cb[_0xbf3a('0x35')][_0xbf3a('0x49')]){_0x4694cb[_0xbf3a('0x3d')]['push']({'id':0x0,'priority':_0x4694cb['applications']['length']+0x1,'app':_0xbf3a('0x4a'),'appdata':_0xbf3a('0x4b'),'interval':_0xbf3a('0x4c')});}_0x37b29c['created']=!![];}else{_0x37b29c[_0xbf3a('0x4d')]=![];}_0x4694cb[_0xbf3a('0x4e')]=_0x37b29c;return db[_0xbf3a('0x4f')][_0xbf3a('0x44')]({'body':_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x2c')],'FaxAccountId':_0x25e13d[_0xbf3a('0x35')]['id'],'FaxInteractionId':_0x4ac59b['id'],'direction':'in','ContactId':_0x4ac59b['ContactId'],'AttachmentId':_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x50')]});})[_0xbf3a('0xf')](function(_0x2fc54b){_0x4694cb[_0xbf3a('0x17')]=_0x2fc54b;if(!_0x4694cb[_0xbf3a('0x4e')][_0xbf3a('0x51')])return;return db[_0xbf3a('0x52')][_0xbf3a('0x34')]({'attributes':['id',_0xbf3a('0x53')],'where':{'id':_0x4694cb[_0xbf3a('0x4e')]['UserId']}});})[_0xbf3a('0xf')](function(_0x4c84c7){if(_0x4c84c7){_0x4694cb['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c84c7[_0xbf3a('0x53')]+','+(_0x4694cb[_0xbf3a('0x35')][_0xbf3a('0x54')]||0xa),'interval':'*,*,*,*'});}if(!_0x4694cb[_0xbf3a('0x4e')][_0xbf3a('0x55')])return;return db[_0xbf3a('0x56')][_0xbf3a('0x34')]({'attributes':['id',_0xbf3a('0x53')],'where':{'id':_0x4694cb[_0xbf3a('0x4e')][_0xbf3a('0x55')]}});})[_0xbf3a('0xf')](function(_0x3445f4){if(_0x3445f4){_0x4694cb['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xbf3a('0x57'),'appdata':_0x3445f4[_0xbf3a('0x53')]+','+(_0x4694cb['account'][_0xbf3a('0x58')]||0x12c),'interval':_0xbf3a('0x4c')});}return respondWithRpcPromise('Start',_0xbf3a('0x59'),_0x4694cb);})[_0xbf3a('0xf')](function(_0x840d52){_0x3d965e(_0x840d52);})[_0xbf3a('0x1a')](function(_0x148ebf){_0x23d37a(_0x1daac2['error'](0x1f4,_0x148ebf[_0xbf3a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 2014d3f..49ed61d 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 _0x26c3=['remove','update','emit','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x3a9cae,_0x29b84a){var _0x342f94=function(_0x910cdc){while(--_0x910cdc){_0x3a9cae['push'](_0x3a9cae['shift']());}};_0x342f94(++_0x29b84a);}(_0x26c3,0x17e));var _0x326c=function(_0x2a7654,_0x3aa945){_0x2a7654=_0x2a7654-0x0;var _0x448267=_0x26c3[_0x2a7654];return _0x448267;};'use strict';var FaxAccountEvents=require(_0x326c('0x0'));var events=[_0x326c('0x1'),_0x326c('0x2'),_0x326c('0x3')];function createListener(_0x54a1b3,_0x4d0144){return function(_0x9d6e53){_0x4d0144[_0x326c('0x4')](_0x54a1b3,_0x9d6e53);};}function removeListener(_0x4c852f,_0x3b3f38){return function(){FaxAccountEvents['removeListener'](_0x4c852f,_0x3b3f38);};}exports[_0x326c('0x5')]=function(_0x232cd0){for(var _0x2d9670=0x0,_0x13dcfa=events[_0x326c('0x6')];_0x2d9670<_0x13dcfa;_0x2d9670++){var _0x302a5a=events[_0x2d9670];var _0x33d989=createListener(_0x326c('0x7')+_0x302a5a,_0x232cd0);FaxAccountEvents['on'](_0x302a5a,_0x33d989);}}; \ No newline at end of file +var _0x61db=['register','length','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x7f70e1,_0x283365){var _0x309c5e=function(_0x395a8c){while(--_0x395a8c){_0x7f70e1['push'](_0x7f70e1['shift']());}};_0x309c5e(++_0x283365);}(_0x61db,0x10a));var _0xb61d=function(_0x580831,_0x2e293d){_0x580831=_0x580831-0x0;var _0x14c21a=_0x61db[_0x580831];return _0x14c21a;};'use strict';var FaxAccountEvents=require(_0xb61d('0x0'));var events=[_0xb61d('0x1'),_0xb61d('0x2'),_0xb61d('0x3')];function createListener(_0x138053,_0x39260b){return function(_0x47f7cb){_0x39260b[_0xb61d('0x4')](_0x138053,_0x47f7cb);};}function removeListener(_0x2f57ec,_0x508b51){return function(){FaxAccountEvents[_0xb61d('0x5')](_0x2f57ec,_0x508b51);};}exports[_0xb61d('0x6')]=function(_0x30dbcf){for(var _0x33f37f=0x0,_0x25b304=events[_0xb61d('0x7')];_0x33f37f<_0x25b304;_0x33f37f++){var _0x31428f=events[_0x33f37f];var _0x3c96c5=createListener('faxAccount:'+_0x31428f,_0x30dbcf);FaxAccountEvents['on'](_0x31428f,_0x3c96c5);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6b32852..61de83b 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 _0x88a6=['index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','/:id/messages','getMessages','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','send','/:id/users','put','update','delete','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2e83dc,_0x5114d7){var _0x4d68b1=function(_0x3f87ea){while(--_0x3f87ea){_0x2e83dc['push'](_0x2e83dc['shift']());}};_0x4d68b1(++_0x5114d7);}(_0x88a6,0x126));var _0x688a=function(_0x3c10b7,_0x10fb4a){_0x3c10b7=_0x3c10b7-0x0;var _0xbd891b=_0x88a6[_0x3c10b7];return _0xbd891b;};'use strict';var multer=require(_0x688a('0x0'));var util=require(_0x688a('0x1'));var path=require('path');var timeout=require(_0x688a('0x2'));var express=require(_0x688a('0x3'));var router=express['Router']();var fs_extra=require(_0x688a('0x4'));var auth=require(_0x688a('0x5'));var interaction=require(_0x688a('0x6'));var config=require(_0x688a('0x7'));var controller=require('./faxAccount.controller');router[_0x688a('0x8')]('/',auth[_0x688a('0x9')](),controller[_0x688a('0xa')]);router['get'](_0x688a('0xb'),auth[_0x688a('0x9')](),controller[_0x688a('0xc')]);router[_0x688a('0x8')](_0x688a('0xd'),auth[_0x688a('0x9')](),controller[_0x688a('0xe')]);router[_0x688a('0x8')](_0x688a('0xf'),auth[_0x688a('0x9')](),controller['getDispositions']);router[_0x688a('0x8')](_0x688a('0x10'),auth[_0x688a('0x9')](),controller[_0x688a('0x11')]);router[_0x688a('0x8')](_0x688a('0x12'),auth[_0x688a('0x9')](),controller['getInteractions']);router['get'](_0x688a('0x13'),auth[_0x688a('0x9')](),controller['getApplications']);router['get'](_0x688a('0x14'),auth[_0x688a('0x9')](),controller[_0x688a('0x15')]);router['get']('/:id/users',auth[_0x688a('0x9')](),controller['getAgents']);router[_0x688a('0x16')]('/',auth[_0x688a('0x9')](),controller['create']);router[_0x688a('0x16')]('/:id/dispositions',auth[_0x688a('0x9')](),controller[_0x688a('0x17')]);router[_0x688a('0x16')](_0x688a('0x10'),auth[_0x688a('0x9')](),controller[_0x688a('0x18')]);router['post'](_0x688a('0x12'),auth[_0x688a('0x9')](),controller[_0x688a('0x19')]);router['post'](_0x688a('0x13'),auth[_0x688a('0x9')](),controller[_0x688a('0x1a')]);router[_0x688a('0x16')](_0x688a('0x1b'),auth[_0x688a('0x9')](),controller[_0x688a('0x1c')]);router[_0x688a('0x16')](_0x688a('0x1d'),auth[_0x688a('0x9')](),controller['updateAccountApplications']);router['post']('/:id/send',auth[_0x688a('0x9')](),controller[_0x688a('0x1e')]);router['post'](_0x688a('0x1f'),auth['isAuthenticated'](),controller['addAgents']);router[_0x688a('0x20')](_0x688a('0xd'),auth[_0x688a('0x9')](),controller[_0x688a('0x21')]);router[_0x688a('0x22')](_0x688a('0xd'),auth[_0x688a('0x9')](),controller['destroy']);router['delete'](_0x688a('0xf'),auth[_0x688a('0x9')](),controller['removeDispositions']);router[_0x688a('0x22')](_0x688a('0x10'),auth[_0x688a('0x9')](),controller[_0x688a('0x23')]);router[_0x688a('0x22')](_0x688a('0x1f'),auth[_0x688a('0x9')](),controller[_0x688a('0x24')]);module[_0x688a('0x25')]=router; \ No newline at end of file +var _0x273b=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x26c04b,_0x43a36){var _0x5d1bed=function(_0x2d60af){while(--_0x2d60af){_0x26c04b['push'](_0x26c04b['shift']());}};_0x5d1bed(++_0x43a36);}(_0x273b,0xb8));var _0xb273=function(_0x129282,_0x408da7){_0x129282=_0x129282-0x0;var _0x2e0be9=_0x273b[_0x129282];return _0x2e0be9;};'use strict';var multer=require('multer');var util=require(_0xb273('0x0'));var path=require(_0xb273('0x1'));var timeout=require(_0xb273('0x2'));var express=require('express');var router=express[_0xb273('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb273('0x4'));var interaction=require(_0xb273('0x5'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0xb273('0x6')]('/',auth[_0xb273('0x7')](),controller[_0xb273('0x8')]);router[_0xb273('0x6')](_0xb273('0x9'),auth[_0xb273('0x7')](),controller[_0xb273('0xa')]);router[_0xb273('0x6')](_0xb273('0xb'),auth[_0xb273('0x7')](),controller[_0xb273('0xc')]);router[_0xb273('0x6')](_0xb273('0xd'),auth[_0xb273('0x7')](),controller[_0xb273('0xe')]);router[_0xb273('0x6')](_0xb273('0xf'),auth[_0xb273('0x7')](),controller[_0xb273('0x10')]);router['get'](_0xb273('0x11'),auth[_0xb273('0x7')](),controller[_0xb273('0x12')]);router[_0xb273('0x6')](_0xb273('0x13'),auth[_0xb273('0x7')](),controller['getApplications']);router[_0xb273('0x6')](_0xb273('0x14'),auth[_0xb273('0x7')](),controller[_0xb273('0x15')]);router['get'](_0xb273('0x16'),auth[_0xb273('0x7')](),controller[_0xb273('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb273('0x18')]);router[_0xb273('0x19')](_0xb273('0xd'),auth[_0xb273('0x7')](),controller[_0xb273('0x1a')]);router['post'](_0xb273('0xf'),auth[_0xb273('0x7')](),controller[_0xb273('0x1b')]);router[_0xb273('0x19')]('/:id/interactions',auth[_0xb273('0x7')](),controller['addInteraction']);router[_0xb273('0x19')](_0xb273('0x13'),auth[_0xb273('0x7')](),controller['addApplications']);router[_0xb273('0x19')](_0xb273('0x1c'),auth[_0xb273('0x7')](),controller[_0xb273('0x1d')]);router[_0xb273('0x19')](_0xb273('0x1e'),auth[_0xb273('0x7')](),controller[_0xb273('0x1f')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0xb273('0x20')]);router[_0xb273('0x19')](_0xb273('0x16'),auth[_0xb273('0x7')](),controller[_0xb273('0x21')]);router['put'](_0xb273('0xb'),auth[_0xb273('0x7')](),controller['update']);router[_0xb273('0x22')]('/:id',auth['isAuthenticated'](),controller[_0xb273('0x23')]);router[_0xb273('0x22')](_0xb273('0xd'),auth[_0xb273('0x7')](),controller[_0xb273('0x24')]);router[_0xb273('0x22')](_0xb273('0xf'),auth[_0xb273('0x7')](),controller[_0xb273('0x25')]);router['delete'](_0xb273('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xb273('0x26')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index f367ac5..db8602f 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 _0x5bc6=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x4c7d8b,_0x572388){var _0x187158=function(_0x5e956d){while(--_0x5e956d){_0x4c7d8b['push'](_0x4c7d8b['shift']());}};_0x187158(++_0x572388);}(_0x5bc6,0xf9));var _0x65bc=function(_0x198e50,_0x1f8708){_0x198e50=_0x198e50-0x0;var _0x478867=_0x5bc6[_0x198e50];return _0x478867;};'use strict';var Sequelize=require('sequelize');module[_0x65bc('0x0')]={'priority':{'type':Sequelize[_0x65bc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x65bc('0x2')],'allowNull':![],'defaultValue':_0x65bc('0x3')},'appdata':{'type':Sequelize[_0x65bc('0x4')]()},'description':{'type':Sequelize[_0x65bc('0x2')]},'interval':{'type':Sequelize[_0x65bc('0x2')],'defaultValue':_0x65bc('0x5')}}; \ No newline at end of file +var _0x92ed=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x92ed,0xdf));var _0xd92e=function(_0x2610ae,_0x40c221){_0x2610ae=_0x2610ae-0x0;var _0x1b368b=_0x92ed[_0x2610ae];return _0x1b368b;};'use strict';var Sequelize=require(_0xd92e('0x0'));module[_0xd92e('0x1')]={'priority':{'type':Sequelize[_0xd92e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd92e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd92e('0x4')]()},'description':{'type':Sequelize[_0xd92e('0x3')]},'interval':{'type':Sequelize[_0xd92e('0x3')],'defaultValue':_0xd92e('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 3d0147b..ec5528d 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 _0xc49a=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','end','error','stack','send','index','FaxApplication','rawAttributes','fieldName','type','model','map','name','keys','query','filters','intersection','attributes','fields','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x49c437,_0x4cd275){var _0x4862f4=function(_0x29448d){while(--_0x29448d){_0x49c437['push'](_0x49c437['shift']());}};_0x4862f4(++_0x4cd275);}(_0xc49a,0x1b6));var _0xac49=function(_0x289a14,_0x2eebfd){_0x289a14=_0x289a14-0x0;var _0x12574e=_0xc49a[_0x289a14];return _0x12574e;};'use strict';var emlformat=require(_0xac49('0x0'));var rimraf=require(_0xac49('0x1'));var zipdir=require(_0xac49('0x2'));var jsonpatch=require(_0xac49('0x3'));var rp=require(_0xac49('0x4'));var moment=require('moment');var BPromise=require(_0xac49('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xac49('0x6'));var sox=require(_0xac49('0x7'));var csv=require(_0xac49('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac49('0x9'));var _=require(_0xac49('0xa'));var squel=require(_0xac49('0xb'));var crypto=require(_0xac49('0xc'));var jsforce=require(_0xac49('0xd'));var deskjs=require(_0xac49('0xe'));var toCsv=require('to-csv');var querystring=require(_0xac49('0xf'));var Papa=require(_0xac49('0x10'));var Redis=require(_0xac49('0x11'));var authService=require(_0xac49('0x12'));var qs=require(_0xac49('0x13'));var as=require(_0xac49('0x14'));var hardwareService=require(_0xac49('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xac49('0x16'));var config=require(_0xac49('0x17'));var licenseUtil=require(_0xac49('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57a117,_0x27a8cf){_0x27a8cf=_0x27a8cf||0xcc;return function(_0x1df267){if(_0x1df267){return _0x57a117[_0xac49('0x19')](_0x27a8cf);}return _0x57a117[_0xac49('0x1a')](_0x27a8cf)['end']();};}function respondWithResult(_0x33b6dc,_0x28c6cc){_0x28c6cc=_0x28c6cc||0xc8;return function(_0x4e5fba){if(_0x4e5fba){return _0x33b6dc[_0xac49('0x1a')](_0x28c6cc)[_0xac49('0x1b')](_0x4e5fba);}};}function respondWithFilteredResult(_0x44dfcb,_0x8072c0){return function(_0x4fabf3){if(_0x4fabf3){var _0x231773=typeof _0x8072c0[_0xac49('0x1c')]===_0xac49('0x1d')&&typeof _0x8072c0['limit']===_0xac49('0x1d');var _0x47610d=_0x4fabf3[_0xac49('0x1e')];var _0x59b048=_0x231773?0x0:_0x8072c0[_0xac49('0x1c')];var _0x571f05=_0x231773?_0x4fabf3[_0xac49('0x1e')]:_0x8072c0[_0xac49('0x1c')]+_0x8072c0['limit'];var _0x20b034;if(_0x571f05>=_0x47610d){_0x571f05=_0x47610d;_0x20b034=0xc8;}else{_0x20b034=0xce;}_0x44dfcb[_0xac49('0x1a')](_0x20b034);return _0x44dfcb[_0xac49('0x1f')](_0xac49('0x20'),_0x59b048+'-'+_0x571f05+'/'+_0x47610d)[_0xac49('0x1b')](_0x4fabf3);}return null;};}function patchUpdates(_0x1390e6){return function(_0x5b8153){try{jsonpatch['apply'](_0x5b8153,_0x1390e6,!![]);}catch(_0x50089d){return BPromise['reject'](_0x50089d);}return _0x5b8153[_0xac49('0x21')]();};}function saveUpdates(_0x262b83,_0x2372e0){return function(_0x117f55){if(_0x117f55){return _0x117f55[_0xac49('0x22')](_0x262b83)[_0xac49('0x23')](function(_0x4bd2ad){return _0x4bd2ad;});}return null;};}function removeEntity(_0x1213cc,_0x37b7e5){return function(_0x4089cf){if(_0x4089cf){return _0x4089cf['destroy']()[_0xac49('0x23')](function(){_0x1213cc[_0xac49('0x1a')](0xcc)[_0xac49('0x24')]();});}};}function handleEntityNotFound(_0x21b478,_0x5dcb6d){return function(_0x511fa8){if(!_0x511fa8){_0x21b478[_0xac49('0x19')](0x194);}return _0x511fa8;};}function handleError(_0x7851ee,_0x3b0907){_0x3b0907=_0x3b0907||0x1f4;return function(_0x419a6b){logger[_0xac49('0x25')](_0x419a6b[_0xac49('0x26')]);if(_0x419a6b['name']){delete _0x419a6b['name'];}_0x7851ee[_0xac49('0x1a')](_0x3b0907)[_0xac49('0x27')](_0x419a6b);};}exports[_0xac49('0x28')]=function(_0x3a66c0,_0x10c74c){var _0x7bce6f={},_0x590e82={},_0x50de3f={'count':0x0,'rows':[]};var _0x1c7102=_['map'](db[_0xac49('0x29')][_0xac49('0x2a')],function(_0x1ea80b){return{'name':_0x1ea80b[_0xac49('0x2b')],'type':_0x1ea80b[_0xac49('0x2c')]['key']};});_0x590e82[_0xac49('0x2d')]=_[_0xac49('0x2e')](_0x1c7102,_0xac49('0x2f'));_0x590e82['query']=_[_0xac49('0x30')](_0x3a66c0[_0xac49('0x31')]);_0x590e82[_0xac49('0x32')]=_[_0xac49('0x33')](_0x590e82[_0xac49('0x2d')],_0x590e82[_0xac49('0x31')]);_0x7bce6f[_0xac49('0x34')]=_['intersection'](_0x590e82[_0xac49('0x2d')],qs[_0xac49('0x35')](_0x3a66c0[_0xac49('0x31')][_0xac49('0x35')]));_0x7bce6f[_0xac49('0x34')]=_0x7bce6f['attributes']['length']?_0x7bce6f[_0xac49('0x34')]:_0x590e82[_0xac49('0x2d')];if(!_0x3a66c0['query']['hasOwnProperty']('nolimit')){_0x7bce6f['limit']=qs[_0xac49('0x36')](_0x3a66c0[_0xac49('0x31')]['limit']);_0x7bce6f['offset']=qs[_0xac49('0x1c')](_0x3a66c0['query'][_0xac49('0x1c')]);}_0x7bce6f[_0xac49('0x37')]=qs[_0xac49('0x38')](_0x3a66c0['query']['sort']);_0x7bce6f[_0xac49('0x39')]=qs[_0xac49('0x32')](_[_0xac49('0x3a')](_0x3a66c0[_0xac49('0x31')],_0x590e82[_0xac49('0x32')]),_0x1c7102);if(_0x3a66c0[_0xac49('0x31')][_0xac49('0x3b')]){_0x7bce6f[_0xac49('0x39')]=_[_0xac49('0x3c')](_0x7bce6f[_0xac49('0x39')],{'$or':_['map'](_0x1c7102,function(_0x248f57){if(_0x248f57[_0xac49('0x2c')]!==_0xac49('0x3d')){var _0x38d6ff={};_0x38d6ff[_0x248f57[_0xac49('0x2f')]]={'$like':'%'+_0x3a66c0['query'][_0xac49('0x3b')]+'%'};return _0x38d6ff;}})});}_0x7bce6f=_['merge']({},_0x7bce6f,_0x3a66c0['options']);var _0x2446b2={'where':_0x7bce6f[_0xac49('0x39')]};return db[_0xac49('0x29')]['count'](_0x2446b2)['then'](function(_0xebdbd1){_0x50de3f['count']=_0xebdbd1;if(_0x3a66c0[_0xac49('0x31')][_0xac49('0x3e')]){_0x7bce6f['include']=[{'all':!![]}];}return db[_0xac49('0x29')][_0xac49('0x3f')](_0x7bce6f);})[_0xac49('0x23')](function(_0x436771){_0x50de3f[_0xac49('0x40')]=_0x436771;return _0x50de3f;})[_0xac49('0x23')](respondWithFilteredResult(_0x10c74c,_0x7bce6f))[_0xac49('0x41')](handleError(_0x10c74c,null));};exports[_0xac49('0x42')]=function(_0x4864de,_0x24c9eb){var _0x1d90c8={'raw':!![],'where':{'id':_0x4864de['params']['id']}},_0x83e8f1={};_0x83e8f1[_0xac49('0x2d')]=_[_0xac49('0x30')](db[_0xac49('0x29')][_0xac49('0x2a')]);_0x83e8f1[_0xac49('0x31')]=_[_0xac49('0x30')](_0x4864de[_0xac49('0x31')]);_0x83e8f1[_0xac49('0x32')]=_[_0xac49('0x33')](_0x83e8f1[_0xac49('0x2d')],_0x83e8f1[_0xac49('0x31')]);_0x1d90c8[_0xac49('0x34')]=_['intersection'](_0x83e8f1[_0xac49('0x2d')],qs[_0xac49('0x35')](_0x4864de[_0xac49('0x31')]['fields']));_0x1d90c8[_0xac49('0x34')]=_0x1d90c8[_0xac49('0x34')]['length']?_0x1d90c8[_0xac49('0x34')]:_0x83e8f1[_0xac49('0x2d')];if(_0x4864de[_0xac49('0x31')][_0xac49('0x3e')]){_0x1d90c8[_0xac49('0x43')]=[{'all':!![]}];}_0x1d90c8=_[_0xac49('0x3c')]({},_0x1d90c8,_0x4864de[_0xac49('0x44')]);return db[_0xac49('0x29')][_0xac49('0x45')](_0x1d90c8)[_0xac49('0x23')](handleEntityNotFound(_0x24c9eb,null))[_0xac49('0x23')](respondWithResult(_0x24c9eb,null))[_0xac49('0x41')](handleError(_0x24c9eb,null));};exports[_0xac49('0x46')]=function(_0x4231d,_0x1549d7){return db[_0xac49('0x29')]['create'](_0x4231d[_0xac49('0x47')],{})[_0xac49('0x23')](respondWithResult(_0x1549d7,0xc9))[_0xac49('0x41')](handleError(_0x1549d7,null));};exports[_0xac49('0x22')]=function(_0x38083c,_0x559f47){if(_0x38083c[_0xac49('0x47')]['id']){delete _0x38083c[_0xac49('0x47')]['id'];}return db[_0xac49('0x29')]['find']({'where':{'id':_0x38083c[_0xac49('0x48')]['id']}})[_0xac49('0x23')](handleEntityNotFound(_0x559f47,null))['then'](saveUpdates(_0x38083c[_0xac49('0x47')],null))[_0xac49('0x23')](respondWithResult(_0x559f47,null))[_0xac49('0x41')](handleError(_0x559f47,null));};exports[_0xac49('0x49')]=function(_0x6f027d,_0x1b8a1e){return db[_0xac49('0x29')][_0xac49('0x45')]({'where':{'id':_0x6f027d[_0xac49('0x48')]['id']}})[_0xac49('0x23')](handleEntityNotFound(_0x1b8a1e,null))[_0xac49('0x23')](removeEntity(_0x1b8a1e,null))['catch'](handleError(_0x1b8a1e,null));}; \ No newline at end of file +var _0x16ba=['rows','catch','params','rawAttributes','find','create','update','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','end','error','name','map','FaxApplication','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x16ba,0x1be));var _0xa16b=function(_0x45411c,_0x424a3a){_0x45411c=_0x45411c-0x0;var _0x61af2d=_0x16ba[_0x45411c];return _0x61af2d;};'use strict';var emlformat=require(_0xa16b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa16b('0x1'));var jsonpatch=require(_0xa16b('0x2'));var rp=require('request-promise');var moment=require(_0xa16b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa16b('0x4'));var util=require(_0xa16b('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa16b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa16b('0x7'));var squel=require(_0xa16b('0x8'));var crypto=require(_0xa16b('0x9'));var jsforce=require(_0xa16b('0xa'));var deskjs=require(_0xa16b('0xb'));var toCsv=require(_0xa16b('0xc'));var querystring=require(_0xa16b('0xd'));var Papa=require(_0xa16b('0xe'));var Redis=require(_0xa16b('0xf'));var authService=require(_0xa16b('0x10'));var qs=require(_0xa16b('0x11'));var as=require(_0xa16b('0x12'));var hardwareService=require(_0xa16b('0x13'));var logger=require(_0xa16b('0x14'))(_0xa16b('0x15'));var utils=require(_0xa16b('0x16'));var config=require(_0xa16b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa16b('0x18'))['db'];function respondWithStatusCode(_0x11da83,_0x6d30c1){_0x6d30c1=_0x6d30c1||0xcc;return function(_0x52b5c5){if(_0x52b5c5){return _0x11da83[_0xa16b('0x19')](_0x6d30c1);}return _0x11da83[_0xa16b('0x1a')](_0x6d30c1)['end']();};}function respondWithResult(_0x2e47bc,_0x1475eb){_0x1475eb=_0x1475eb||0xc8;return function(_0x1e6a06){if(_0x1e6a06){return _0x2e47bc['status'](_0x1475eb)[_0xa16b('0x1b')](_0x1e6a06);}};}function respondWithFilteredResult(_0x3b85f0,_0x4bd8d1){return function(_0x51a5f7){if(_0x51a5f7){var _0x275cb1=typeof _0x4bd8d1['offset']===_0xa16b('0x1c')&&typeof _0x4bd8d1[_0xa16b('0x1d')]===_0xa16b('0x1c');var _0x59cfee=_0x51a5f7[_0xa16b('0x1e')];var _0x23fc3f=_0x275cb1?0x0:_0x4bd8d1[_0xa16b('0x1f')];var _0x1fb0b7=_0x275cb1?_0x51a5f7[_0xa16b('0x1e')]:_0x4bd8d1[_0xa16b('0x1f')]+_0x4bd8d1['limit'];var _0x509473;if(_0x1fb0b7>=_0x59cfee){_0x1fb0b7=_0x59cfee;_0x509473=0xc8;}else{_0x509473=0xce;}_0x3b85f0[_0xa16b('0x1a')](_0x509473);return _0x3b85f0[_0xa16b('0x20')](_0xa16b('0x21'),_0x23fc3f+'-'+_0x1fb0b7+'/'+_0x59cfee)['json'](_0x51a5f7);}return null;};}function patchUpdates(_0x2bb3d2){return function(_0x697929){try{jsonpatch[_0xa16b('0x22')](_0x697929,_0x2bb3d2,!![]);}catch(_0x725a67){return BPromise[_0xa16b('0x23')](_0x725a67);}return _0x697929[_0xa16b('0x24')]();};}function saveUpdates(_0x19cf3a,_0x56b919){return function(_0x1719f6){if(_0x1719f6){return _0x1719f6['update'](_0x19cf3a)[_0xa16b('0x25')](function(_0x1a0a22){return _0x1a0a22;});}return null;};}function removeEntity(_0x170b37,_0x3817ae){return function(_0x2cc425){if(_0x2cc425){return _0x2cc425['destroy']()[_0xa16b('0x25')](function(){_0x170b37[_0xa16b('0x1a')](0xcc)[_0xa16b('0x26')]();});}};}function handleEntityNotFound(_0x3969c4,_0x111c40){return function(_0x2ef7f2){if(!_0x2ef7f2){_0x3969c4[_0xa16b('0x19')](0x194);}return _0x2ef7f2;};}function handleError(_0x4ea950,_0x1a2f45){_0x1a2f45=_0x1a2f45||0x1f4;return function(_0x2ee305){logger[_0xa16b('0x27')](_0x2ee305['stack']);if(_0x2ee305[_0xa16b('0x28')]){delete _0x2ee305['name'];}_0x4ea950['status'](_0x1a2f45)['send'](_0x2ee305);};}exports['index']=function(_0x44f2fe,_0x3e8b27){var _0x3b1a24={},_0x3e60d8={},_0x25cbb7={'count':0x0,'rows':[]};var _0x5931c7=_[_0xa16b('0x29')](db[_0xa16b('0x2a')]['rawAttributes'],function(_0x349590){return{'name':_0x349590[_0xa16b('0x2b')],'type':_0x349590[_0xa16b('0x2c')]['key']};});_0x3e60d8[_0xa16b('0x2d')]=_[_0xa16b('0x29')](_0x5931c7,_0xa16b('0x28'));_0x3e60d8[_0xa16b('0x2e')]=_[_0xa16b('0x2f')](_0x44f2fe[_0xa16b('0x2e')]);_0x3e60d8[_0xa16b('0x30')]=_[_0xa16b('0x31')](_0x3e60d8['model'],_0x3e60d8[_0xa16b('0x2e')]);_0x3b1a24[_0xa16b('0x32')]=_[_0xa16b('0x31')](_0x3e60d8[_0xa16b('0x2d')],qs['fields'](_0x44f2fe['query'][_0xa16b('0x33')]));_0x3b1a24[_0xa16b('0x32')]=_0x3b1a24['attributes'][_0xa16b('0x34')]?_0x3b1a24[_0xa16b('0x32')]:_0x3e60d8[_0xa16b('0x2d')];if(!_0x44f2fe['query'][_0xa16b('0x35')](_0xa16b('0x36'))){_0x3b1a24[_0xa16b('0x1d')]=qs[_0xa16b('0x1d')](_0x44f2fe['query'][_0xa16b('0x1d')]);_0x3b1a24['offset']=qs[_0xa16b('0x1f')](_0x44f2fe[_0xa16b('0x2e')][_0xa16b('0x1f')]);}_0x3b1a24['order']=qs['sort'](_0x44f2fe[_0xa16b('0x2e')][_0xa16b('0x37')]);_0x3b1a24['where']=qs['filters'](_[_0xa16b('0x38')](_0x44f2fe['query'],_0x3e60d8[_0xa16b('0x30')]),_0x5931c7);if(_0x44f2fe[_0xa16b('0x2e')]['filter']){_0x3b1a24['where']=_[_0xa16b('0x39')](_0x3b1a24[_0xa16b('0x3a')],{'$or':_['map'](_0x5931c7,function(_0x3959d9){if(_0x3959d9[_0xa16b('0x2c')]!==_0xa16b('0x3b')){var _0x58911b={};_0x58911b[_0x3959d9[_0xa16b('0x28')]]={'$like':'%'+_0x44f2fe[_0xa16b('0x2e')][_0xa16b('0x3c')]+'%'};return _0x58911b;}})});}_0x3b1a24=_[_0xa16b('0x39')]({},_0x3b1a24,_0x44f2fe[_0xa16b('0x3d')]);var _0x12aeae={'where':_0x3b1a24['where']};return db[_0xa16b('0x2a')][_0xa16b('0x1e')](_0x12aeae)[_0xa16b('0x25')](function(_0x5420f7){_0x25cbb7[_0xa16b('0x1e')]=_0x5420f7;if(_0x44f2fe[_0xa16b('0x2e')][_0xa16b('0x3e')]){_0x3b1a24[_0xa16b('0x3f')]=[{'all':!![]}];}return db[_0xa16b('0x2a')][_0xa16b('0x40')](_0x3b1a24);})[_0xa16b('0x25')](function(_0x44d234){_0x25cbb7[_0xa16b('0x41')]=_0x44d234;return _0x25cbb7;})[_0xa16b('0x25')](respondWithFilteredResult(_0x3e8b27,_0x3b1a24))[_0xa16b('0x42')](handleError(_0x3e8b27,null));};exports['show']=function(_0x181dae,_0x36fc16){var _0x3ee474={'raw':!![],'where':{'id':_0x181dae[_0xa16b('0x43')]['id']}},_0x1625ff={};_0x1625ff[_0xa16b('0x2d')]=_[_0xa16b('0x2f')](db[_0xa16b('0x2a')][_0xa16b('0x44')]);_0x1625ff[_0xa16b('0x2e')]=_[_0xa16b('0x2f')](_0x181dae[_0xa16b('0x2e')]);_0x1625ff[_0xa16b('0x30')]=_[_0xa16b('0x31')](_0x1625ff[_0xa16b('0x2d')],_0x1625ff['query']);_0x3ee474['attributes']=_[_0xa16b('0x31')](_0x1625ff[_0xa16b('0x2d')],qs[_0xa16b('0x33')](_0x181dae[_0xa16b('0x2e')][_0xa16b('0x33')]));_0x3ee474[_0xa16b('0x32')]=_0x3ee474['attributes'][_0xa16b('0x34')]?_0x3ee474['attributes']:_0x1625ff['model'];if(_0x181dae[_0xa16b('0x2e')][_0xa16b('0x3e')]){_0x3ee474[_0xa16b('0x3f')]=[{'all':!![]}];}_0x3ee474=_['merge']({},_0x3ee474,_0x181dae[_0xa16b('0x3d')]);return db[_0xa16b('0x2a')][_0xa16b('0x45')](_0x3ee474)[_0xa16b('0x25')](handleEntityNotFound(_0x36fc16,null))['then'](respondWithResult(_0x36fc16,null))[_0xa16b('0x42')](handleError(_0x36fc16,null));};exports[_0xa16b('0x46')]=function(_0x392f1c,_0x29775a){return db[_0xa16b('0x2a')][_0xa16b('0x46')](_0x392f1c['body'],{})['then'](respondWithResult(_0x29775a,0xc9))[_0xa16b('0x42')](handleError(_0x29775a,null));};exports[_0xa16b('0x47')]=function(_0x1f40de,_0x5882f1){if(_0x1f40de['body']['id']){delete _0x1f40de[_0xa16b('0x48')]['id'];}return db[_0xa16b('0x2a')]['find']({'where':{'id':_0x1f40de[_0xa16b('0x43')]['id']}})[_0xa16b('0x25')](handleEntityNotFound(_0x5882f1,null))[_0xa16b('0x25')](saveUpdates(_0x1f40de[_0xa16b('0x48')],null))[_0xa16b('0x25')](respondWithResult(_0x5882f1,null))['catch'](handleError(_0x5882f1,null));};exports['destroy']=function(_0x541a76,_0x28dfe3){return db[_0xa16b('0x2a')][_0xa16b('0x45')]({'where':{'id':_0x541a76[_0xa16b('0x43')]['id']}})[_0xa16b('0x25')](handleEntityNotFound(_0x28dfe3,null))[_0xa16b('0x25')](removeEntity(_0x28dfe3,null))[_0xa16b('0x42')](handleError(_0x28dfe3,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 024a4c1..1378619 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 _0x816f=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3ec972,_0x13821f){var _0x1ae25e=function(_0x11a0a7){while(--_0x11a0a7){_0x3ec972['push'](_0x3ec972['shift']());}};_0x1ae25e(++_0x13821f);}(_0x816f,0x99));var _0xf816=function(_0x18b4de,_0xad00ad){_0x18b4de=_0x18b4de-0x0;var _0x5c0da0=_0x816f[_0x18b4de];return _0x5c0da0;};'use strict';var _=require(_0xf816('0x0'));var util=require(_0xf816('0x1'));var logger=require(_0xf816('0x2'))(_0xf816('0x3'));var moment=require(_0xf816('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf816('0x5'));var rimraf=require(_0xf816('0x6'));var config=require(_0xf816('0x7'));var attributes=require(_0xf816('0x8'));module['exports']=function(_0x7160f3,_0x174e03){return _0x7160f3[_0xf816('0x9')](_0xf816('0xa'),attributes,{'tableName':_0xf816('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf816('0xc'),'collate':_0xf816('0xd')});}; \ No newline at end of file +var _0x6f63=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x302ed2,_0x506e66){var _0x5b1191=function(_0x3d76ac){while(--_0x3d76ac){_0x302ed2['push'](_0x302ed2['shift']());}};_0x5b1191(++_0x506e66);}(_0x6f63,0x1a1));var _0x36f6=function(_0x2ade68,_0x435d63){_0x2ade68=_0x2ade68-0x0;var _0x3d6562=_0x6f63[_0x2ade68];return _0x3d6562;};'use strict';var _=require(_0x36f6('0x0'));var util=require(_0x36f6('0x1'));var logger=require(_0x36f6('0x2'))(_0x36f6('0x3'));var moment=require(_0x36f6('0x4'));var BPromise=require(_0x36f6('0x5'));var rp=require(_0x36f6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36f6('0x7'));var config=require(_0x36f6('0x8'));var attributes=require(_0x36f6('0x9'));module[_0x36f6('0xa')]=function(_0x395e61,_0x3823cc){return _0x395e61[_0x36f6('0xb')](_0x36f6('0xc'),attributes,{'tableName':_0x36f6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x36f6('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 21d87b8..e335982 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 _0x8563=['FaxApplication','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8563,0xdb));var _0x3856=function(_0x11c0ad,_0x134629){_0x11c0ad=_0x11c0ad-0x0;var _0x543a44=_0x8563[_0x11c0ad];return _0x543a44;};'use strict';var _=require(_0x3856('0x0'));var util=require(_0x3856('0x1'));var moment=require(_0x3856('0x2'));var BPromise=require(_0x3856('0x3'));var rs=require(_0x3856('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3856('0x5'))['db'];var utils=require(_0x3856('0x6'));var logger=require(_0x3856('0x7'))(_0x3856('0x8'));var config=require(_0x3856('0x9'));var jayson=require(_0x3856('0xa'));var client=jayson[_0x3856('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e025d,_0x294a5f,_0x1337d4){return new BPromise(function(_0x3b0e60,_0x4f33bc){return client['request'](_0x5e025d,_0x1337d4)[_0x3856('0xc')](function(_0x561674){logger[_0x3856('0xd')]('FaxApplication,\x20%s,\x20%s',_0x294a5f,_0x3856('0xe'));logger[_0x3856('0xf')](_0x3856('0x10'),_0x294a5f,_0x3856('0xe'),JSON['stringify'](_0x561674));if(_0x561674[_0x3856('0x11')]){if(_0x561674[_0x3856('0x11')][_0x3856('0x12')]===0x1f4){logger[_0x3856('0x11')](_0x3856('0x13'),_0x294a5f,_0x561674['error'][_0x3856('0x14')]);return _0x4f33bc(_0x561674[_0x3856('0x11')][_0x3856('0x14')]);}logger[_0x3856('0x11')](_0x3856('0x13'),_0x294a5f,_0x561674[_0x3856('0x11')]['message']);return _0x3b0e60(_0x561674[_0x3856('0x11')][_0x3856('0x14')]);}else{logger[_0x3856('0xd')](_0x3856('0x13'),_0x294a5f,'request\x20sent');_0x3b0e60(_0x561674[_0x3856('0x15')][_0x3856('0x14')]);}})[_0x3856('0x16')](function(_0x5656a7){logger[_0x3856('0x11')]('FaxApplication,\x20%s,\x20%s',_0x294a5f,_0x5656a7);_0x4f33bc(_0x5656a7);});});}exports[_0x3856('0x17')]=function(_0x53f52a){var _0x5b3295=this;return new Promise(function(_0x249c87,_0x4b8ba2){return db[_0x3856('0x18')]['update'](_0x53f52a['body'],{'raw':_0x53f52a[_0x3856('0x19')]?_0x53f52a['options'][_0x3856('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53f52a[_0x3856('0x19')]?_0x53f52a['options']['where']||null:null,'attributes':_0x53f52a[_0x3856('0x19')]?_0x53f52a[_0x3856('0x19')]['attributes']||null:null,'limit':_0x53f52a[_0x3856('0x19')]?_0x53f52a[_0x3856('0x19')]['limit']||null:null})['then'](function(_0x2c160e){logger['info'](_0x3856('0x17'),_0x53f52a);logger['debug'](_0x3856('0x17'),_0x53f52a,JSON['stringify'](_0x2c160e));_0x249c87(_0x2c160e);})['catch'](function(_0x3f0144){logger[_0x3856('0x11')]('UpdateFaxApplication',_0x3f0144[_0x3856('0x14')],_0x53f52a);_0x4b8ba2(_0x5b3295[_0x3856('0x11')](0x1f4,_0x3f0144[_0x3856('0x14')]));});});}; \ No newline at end of file +var _0x3718=['../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','info','body','options','where','attributes','limit','UpdateFaxApplication','catch','lodash','util','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3718,0xb2));var _0x8371=function(_0x2fa2b9,_0x1f876a){_0x2fa2b9=_0x2fa2b9-0x0;var _0x3dc9e6=_0x3718[_0x2fa2b9];return _0x3dc9e6;};'use strict';var _=require(_0x8371('0x0'));var util=require(_0x8371('0x1'));var moment=require(_0x8371('0x2'));var BPromise=require('bluebird');var rs=require(_0x8371('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8371('0x4'))['db'];var utils=require(_0x8371('0x5'));var logger=require('../../config/logger')(_0x8371('0x6'));var config=require('../../config/environment');var jayson=require(_0x8371('0x7'));var client=jayson['client'][_0x8371('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x516885,_0x5eebe2,_0x4389c7){return new BPromise(function(_0x3898bc,_0x3cf639){return client[_0x8371('0x9')](_0x516885,_0x4389c7)[_0x8371('0xa')](function(_0x200daa){logger['info']('FaxApplication,\x20%s,\x20%s',_0x5eebe2,_0x8371('0xb'));logger[_0x8371('0xc')](_0x8371('0xd'),_0x5eebe2,_0x8371('0xb'),JSON[_0x8371('0xe')](_0x200daa));if(_0x200daa[_0x8371('0xf')]){if(_0x200daa[_0x8371('0xf')]['code']===0x1f4){logger[_0x8371('0xf')](_0x8371('0x10'),_0x5eebe2,_0x200daa[_0x8371('0xf')]['message']);return _0x3cf639(_0x200daa[_0x8371('0xf')][_0x8371('0x11')]);}logger['error'](_0x8371('0x10'),_0x5eebe2,_0x200daa['error'][_0x8371('0x11')]);return _0x3898bc(_0x200daa[_0x8371('0xf')][_0x8371('0x11')]);}else{logger[_0x8371('0x12')](_0x8371('0x10'),_0x5eebe2,_0x8371('0xb'));_0x3898bc(_0x200daa['result'][_0x8371('0x11')]);}})['catch'](function(_0x399207){logger[_0x8371('0xf')](_0x8371('0x10'),_0x5eebe2,_0x399207);_0x3cf639(_0x399207);});});}exports['UpdateFaxApplication']=function(_0x4ed92f){var _0x1c897c=this;return new Promise(function(_0x77ffaf,_0x57fde3){return db['FaxApplication']['update'](_0x4ed92f[_0x8371('0x13')],{'raw':_0x4ed92f[_0x8371('0x14')]?_0x4ed92f[_0x8371('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ed92f[_0x8371('0x14')]?_0x4ed92f[_0x8371('0x14')][_0x8371('0x15')]||null:null,'attributes':_0x4ed92f[_0x8371('0x14')]?_0x4ed92f['options'][_0x8371('0x16')]||null:null,'limit':_0x4ed92f[_0x8371('0x14')]?_0x4ed92f[_0x8371('0x14')][_0x8371('0x17')]||null:null})['then'](function(_0x41d7c3){logger[_0x8371('0x12')](_0x8371('0x18'),_0x4ed92f);logger[_0x8371('0xc')](_0x8371('0x18'),_0x4ed92f,JSON[_0x8371('0xe')](_0x41d7c3));_0x77ffaf(_0x41d7c3);})[_0x8371('0x19')](function(_0x278821){logger['error'](_0x8371('0x18'),_0x278821[_0x8371('0x11')],_0x4ed92f);_0x57fde3(_0x1c897c['error'](0x1f4,_0x278821[_0x8371('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index c0e794e..b425e02 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 _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x2f45ac,_0x317496){var _0x172a29=function(_0x494b53){while(--_0x494b53){_0x2f45ac['push'](_0x2f45ac['shift']());}};_0x172a29(++_0x317496);}(_0x34b7,0x196));var _0x734b=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x34b7[_0xd21fe7];return _0x14d570;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file +var _0x0598=['../../components/auth/service','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x9d4ce4,_0x510f23){var _0x555e00=function(_0x2572f9){while(--_0x2572f9){_0x9d4ce4['push'](_0x9d4ce4['shift']());}};_0x555e00(++_0x510f23);}(_0x0598,0x92));var _0x8059=function(_0x15d767,_0x3ed410){_0x15d767=_0x15d767-0x0;var _0x2eca00=_0x0598[_0x15d767];return _0x2eca00;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8059('0xa')](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router[_0x8059('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8059('0xd')]);module[_0x8059('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 40dba87..b8e6596 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 _0x1a85=['STRING','out','ENUM','INTEGER','BOOLEAN','DATE'];(function(_0xb55f80,_0x2bdda0){var _0x2e123f=function(_0x192011){while(--_0x192011){_0xb55f80['push'](_0xb55f80['shift']());}};_0x2e123f(++_0x2bdda0);}(_0x1a85,0x178));var _0x51a8=function(_0x3a2e8c,_0x4001d3){_0x3a2e8c=_0x3a2e8c-0x0;var _0x588177=_0x1a85[_0x3a2e8c];return _0x588177;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x51a8('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x51a8('0x1')]},'disposition':{'type':Sequelize[_0x51a8('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x51a8('0x2')]},'read1stAt':{'type':Sequelize[_0x51a8('0x1')]},'fax':{'type':Sequelize[_0x51a8('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x51a8('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x51a8('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x51a8('0x5')]}}; \ No newline at end of file +var _0xa30a=['exports','BOOLEAN','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x591331,_0x39cdc1){var _0x4570ff=function(_0xe4a8fb){while(--_0xe4a8fb){_0x591331['push'](_0x591331['shift']());}};_0x4570ff(++_0x39cdc1);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'closed':{'type':Sequelize[_0xaa30('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xaa30('0x3')]},'secondDisposition':{'type':Sequelize[_0xaa30('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaa30('0x3')]},'note':{'type':Sequelize[_0xaa30('0x3')]},'read1stAt':{'type':Sequelize[_0xaa30('0x4')]},'fax':{'type':Sequelize[_0xaa30('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xaa30('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaa30('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaa30('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xaa30('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 4caa220..b619c65 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 _0xb74e=['rawAttributes','key','getOptions','findAll','fax','user','catch','show','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','merge','options','create','body','find','addMessage','FaxMessage','ids','getMessages','findOne','nolimit','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','server','files','attachments','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','existsSync','createReadStream','basename','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','map','FaxInteraction'];(function(_0x2d3d66,_0xcffeaf){var _0x9a4e88=function(_0x18eac3){while(--_0x18eac3){_0x2d3d66['push'](_0x2d3d66['shift']());}};_0x9a4e88(++_0xcffeaf);}(_0xb74e,0xa9));var _0xeb74=function(_0x9f3370,_0x7e4e66){_0x9f3370=_0x9f3370-0x0;var _0x40643b=_0xb74e[_0x9f3370];return _0x40643b;};'use strict';var rimraf=require(_0xeb74('0x0'));var zipdir=require(_0xeb74('0x1'));var moment=require(_0xeb74('0x2'));var BPromise=require(_0xeb74('0x3'));var util=require(_0xeb74('0x4'));var path=require(_0xeb74('0x5'));var fs=require('fs');var _=require(_0xeb74('0x6'));var Redis=require(_0xeb74('0x7'));var interaction=require(_0xeb74('0x8'));var qs=require(_0xeb74('0x9'));var logger=require(_0xeb74('0xa'))(_0xeb74('0xb'));var config=require(_0xeb74('0xc'));var db=require(_0xeb74('0xd'))['db'];config[_0xeb74('0xe')]=_[_0xeb74('0xf')](config[_0xeb74('0xe')],{'host':_0xeb74('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb74('0xe')]));require(_0xeb74('0x11'))[_0xeb74('0x12')](socket);function respondWithStatusCode(_0x54257a,_0x4c3e53){_0x4c3e53=_0x4c3e53||0xcc;return function(_0x5af22e){if(_0x5af22e){return _0x54257a[_0xeb74('0x13')](_0x4c3e53);}return _0x54257a[_0xeb74('0x14')](_0x4c3e53)[_0xeb74('0x15')]();};}function respondWithResult(_0x4ef3a5,_0xd8e9ff){_0xd8e9ff=_0xd8e9ff||0xc8;return function(_0x221b30){if(_0x221b30){return _0x4ef3a5['status'](_0xd8e9ff)[_0xeb74('0x16')](_0x221b30);}};}function respondWithFilteredResult(_0x55debe,_0x48f577){return function(_0x4ca7c6){if(_0x4ca7c6){var _0x237d53=typeof _0x48f577[_0xeb74('0x17')]===_0xeb74('0x18')&&typeof _0x48f577[_0xeb74('0x19')]===_0xeb74('0x18');var _0x16ea4e=_0x4ca7c6['count'];var _0x592501=_0x237d53?0x0:_0x48f577['offset'];var _0x3026a6=_0x237d53?_0x4ca7c6[_0xeb74('0x1a')]:_0x48f577['offset']+_0x48f577['limit'];var _0x4e217a;if(_0x3026a6>=_0x16ea4e){_0x3026a6=_0x16ea4e;_0x4e217a=0xc8;}else{_0x4e217a=0xce;}_0x55debe[_0xeb74('0x14')](_0x4e217a);return _0x55debe[_0xeb74('0x1b')](_0xeb74('0x1c'),_0x592501+'-'+_0x3026a6+'/'+_0x16ea4e)[_0xeb74('0x16')](_0x4ca7c6);}return null;};}function saveUpdates(_0x39d3b9){return function(_0x50836c){if(_0x50836c){return _0x50836c[_0xeb74('0x1d')](_0x39d3b9)[_0xeb74('0x1e')](function(_0x368087){return _0x368087;});}return null;};}function removeEntity(_0x5b632b){return function(_0x45e2d7){if(_0x45e2d7){return _0x45e2d7['destroy']()[_0xeb74('0x1e')](function(){_0x5b632b[_0xeb74('0x14')](0xcc)[_0xeb74('0x15')]();});}};}function handleEntityNotFound(_0x1a9adf){return function(_0x28173a){if(!_0x28173a){_0x1a9adf[_0xeb74('0x13')](0x194);}return _0x28173a;};}function handleError(_0x4da52f,_0x1f2854){_0x1f2854=_0x1f2854||0x1f4;return function(_0xc6bc18){logger[_0xeb74('0x1f')](_0xc6bc18[_0xeb74('0x20')]);if(_0xc6bc18['name']){delete _0xc6bc18[_0xeb74('0x21')];}_0x4da52f[_0xeb74('0x14')](_0x1f2854)[_0xeb74('0x22')](_0xc6bc18);};}exports['index']=function(_0x45cc9f,_0x470958){var _0x280a96={};var _0x38e3b6=_[_0xeb74('0x23')](db[_0xeb74('0x24')][_0xeb74('0x25')],function(_0x1c4e2d){return{'name':_0x1c4e2d['fieldName'],'type':_0x1c4e2d['type'][_0xeb74('0x26')]};});_0x280a96=qs[_0xeb74('0x27')](_0x38e3b6,_0x45cc9f);return interaction[_0xeb74('0x28')](_0xeb74('0x29'),_0x45cc9f['query'],_0x45cc9f[_0xeb74('0x2a')],_0x280a96,_0x38e3b6)['then'](respondWithFilteredResult(_0x470958,_0x280a96))[_0xeb74('0x2b')](handleError(_0x470958,null));};exports[_0xeb74('0x2c')]=function(_0x27c669,_0x2f7f1a){var _0x1cfd05={'raw':![],'where':{'id':_0x27c669[_0xeb74('0x2d')]['id']}},_0x21c4e7={};_0x21c4e7[_0xeb74('0x2e')]=_[_0xeb74('0x2f')](db[_0xeb74('0x24')][_0xeb74('0x25')]);_0x21c4e7[_0xeb74('0x30')]=_[_0xeb74('0x2f')](_0x27c669[_0xeb74('0x30')]);_0x21c4e7[_0xeb74('0x31')]=_[_0xeb74('0x32')](_0x21c4e7[_0xeb74('0x2e')],_0x21c4e7['query']);_0x1cfd05['attributes']=_[_0xeb74('0x32')](_0x21c4e7[_0xeb74('0x2e')],qs['fields'](_0x27c669[_0xeb74('0x30')][_0xeb74('0x33')]));_0x1cfd05[_0xeb74('0x34')]=_0x1cfd05[_0xeb74('0x34')][_0xeb74('0x35')]?_0x1cfd05[_0xeb74('0x34')]:_0x21c4e7[_0xeb74('0x2e')];if(_0x27c669[_0xeb74('0x30')][_0xeb74('0x36')]){_0x1cfd05['include']=[{'all':!![]}];}_0x1cfd05=_[_0xeb74('0x37')]({},_0x1cfd05,_0x27c669[_0xeb74('0x38')]);return db[_0xeb74('0x24')]['find'](_0x1cfd05)['then'](handleEntityNotFound(_0x2f7f1a,null))['then'](respondWithResult(_0x2f7f1a,null))[_0xeb74('0x2b')](handleError(_0x2f7f1a,null));};exports[_0xeb74('0x39')]=function(_0x283165,_0xfeb2ca){return db['FaxInteraction']['create'](_0x283165[_0xeb74('0x3a')],{})[_0xeb74('0x1e')](respondWithResult(_0xfeb2ca,0xc9))[_0xeb74('0x2b')](handleError(_0xfeb2ca,null));};exports[_0xeb74('0x1d')]=function(_0x5f4311,_0x179db5){if(_0x5f4311[_0xeb74('0x3a')]['id']){delete _0x5f4311[_0xeb74('0x3a')]['id'];}return db['FaxInteraction'][_0xeb74('0x3b')]({'where':{'id':_0x5f4311[_0xeb74('0x2d')]['id']}})[_0xeb74('0x1e')](handleEntityNotFound(_0x179db5,null))['then'](saveUpdates(_0x5f4311['body'],null))[_0xeb74('0x1e')](respondWithResult(_0x179db5,null))[_0xeb74('0x2b')](handleError(_0x179db5,null));};exports['destroy']=function(_0x58bc7b,_0xe46bd3){return db['FaxInteraction'][_0xeb74('0x3b')]({'where':{'id':_0x58bc7b['params']['id']}})[_0xeb74('0x1e')](handleEntityNotFound(_0xe46bd3,null))[_0xeb74('0x1e')](removeEntity(_0xe46bd3,null))[_0xeb74('0x2b')](handleError(_0xe46bd3,null));};exports['describe']=function(_0x219066,_0x17f0df){return db[_0xeb74('0x24')]['describe']()['then'](respondWithResult(_0x17f0df,null))[_0xeb74('0x2b')](handleError(_0x17f0df,null));};exports[_0xeb74('0x3c')]=function(_0x317151,_0x72f143){return db[_0xeb74('0x3d')][_0xeb74('0x3b')]({'where':{'id':_0x317151[_0xeb74('0x2d')]['id']}})[_0xeb74('0x1e')](handleEntityNotFound(_0x72f143,null))[_0xeb74('0x1e')](function(_0x27b9d0){if(_0x27b9d0){return _0x27b9d0[_0xeb74('0x3c')](_0x317151[_0xeb74('0x3a')][_0xeb74('0x3e')],_['omit'](_0x317151[_0xeb74('0x3a')],[_0xeb74('0x3e'),'id'])||{});}})[_0xeb74('0x1e')](respondWithResult(_0x72f143,null))[_0xeb74('0x2b')](handleError(_0x72f143,null));};exports[_0xeb74('0x3f')]=function(_0x56f57c,_0x190c3e){var _0x4ebdb3={'raw':![],'where':{}};var _0x5e5b22={};var _0x312039={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xeb74('0x40')]({'where':{'id':_0x56f57c[_0xeb74('0x2d')]['id']}})[_0xeb74('0x1e')](handleEntityNotFound(_0x190c3e,null))[_0xeb74('0x1e')](function(_0x2cb9f6){if(_0x2cb9f6){_0x5e5b22[_0xeb74('0x2e')]=_['keys'](db[_0xeb74('0x3d')][_0xeb74('0x25')]);_0x5e5b22['query']=_[_0xeb74('0x2f')](_0x56f57c[_0xeb74('0x30')]);_0x5e5b22[_0xeb74('0x31')]=_[_0xeb74('0x32')](_0x5e5b22[_0xeb74('0x2e')],_0x5e5b22[_0xeb74('0x30')]);_0x4ebdb3[_0xeb74('0x34')]=_['intersection'](_0x5e5b22['model'],qs[_0xeb74('0x33')](_0x56f57c[_0xeb74('0x30')][_0xeb74('0x33')]));_0x4ebdb3[_0xeb74('0x34')]=_0x4ebdb3[_0xeb74('0x34')][_0xeb74('0x35')]?_0x4ebdb3[_0xeb74('0x34')]:_0x5e5b22[_0xeb74('0x2e')];if(!_0x56f57c[_0xeb74('0x30')]['hasOwnProperty'](_0xeb74('0x41'))){_0x4ebdb3['limit']=qs['limit'](_0x56f57c[_0xeb74('0x30')]['limit']);_0x4ebdb3[_0xeb74('0x17')]=qs['offset'](_0x56f57c['query'][_0xeb74('0x17')]);}_0x4ebdb3['order']=qs['sort'](_0x56f57c['query']['sort']);_0x4ebdb3['where']=qs[_0xeb74('0x31')](_[_0xeb74('0x42')](_0x56f57c[_0xeb74('0x30')],_0x5e5b22['filters']));_0x4ebdb3[_0xeb74('0x43')][_0xeb74('0x44')]=_0x2cb9f6['id'];if(_0x56f57c[_0xeb74('0x30')]['filter']){_0x4ebdb3[_0xeb74('0x43')]=_[_0xeb74('0x37')](_0x4ebdb3[_0xeb74('0x43')],{'$or':_[_0xeb74('0x23')](_0x4ebdb3[_0xeb74('0x34')],function(_0x2269d9){var _0x5d070d={};_0x5d070d[_0x2269d9]={'$like':'%'+_0x56f57c[_0xeb74('0x30')][_0xeb74('0x45')]+'%'};return _0x5d070d;})});}if(_0x56f57c[_0xeb74('0x30')]['$gte']){var _0xc6a4ea=_0x56f57c[_0xeb74('0x30')][_0xeb74('0x46')][_0xeb74('0x47')](',');var _0x5eb233={};_0x5eb233[_0xc6a4ea[0x0]]={'$gte':moment(_0xc6a4ea[0x1])[_0xeb74('0x48')](_0xeb74('0x49'))};_0x4ebdb3[_0xeb74('0x43')]=_[_0xeb74('0x37')](_0x4ebdb3['where'],_0x5eb233);}_0x4ebdb3=_[_0xeb74('0x37')]({},_0x4ebdb3,_0x56f57c['options']);return db[_0xeb74('0x3d')][_0xeb74('0x1a')]({'where':_0x4ebdb3[_0xeb74('0x43')]})[_0xeb74('0x1e')](function(_0x5eefb3){_0x312039[_0xeb74('0x1a')]=_0x5eefb3;if(_0x56f57c[_0xeb74('0x30')]['includeAll']){_0x4ebdb3['include']=[{'all':!![]}];}return db[_0xeb74('0x3d')]['findAll'](_0x4ebdb3);})[_0xeb74('0x1e')](function(_0x342c28){_0x312039[_0xeb74('0x4a')]=_0x342c28;return _0x312039;});}})[_0xeb74('0x1e')](respondWithFilteredResult(_0x190c3e,_0x4ebdb3))[_0xeb74('0x2b')](handleError(_0x190c3e,null));};exports[_0xeb74('0x4b')]=function(_0x3267bb,_0x279f25){return db[_0xeb74('0x24')][_0xeb74('0x3b')]({'where':{'id':_0x3267bb['params']['id']}})[_0xeb74('0x1e')](handleEntityNotFound(_0x279f25,null))[_0xeb74('0x1e')](function(_0x27cd05){if(_0x27cd05){return _0x27cd05[_0xeb74('0x4c')](_0x3267bb['body'][_0xeb74('0x3e')],_['omit'](_0x3267bb[_0xeb74('0x3a')],[_0xeb74('0x3e'),'id'])||{})[_0xeb74('0x4d')](function(){return db[_0xeb74('0x4e')][_0xeb74('0x28')]({'attributes':['id',_0xeb74('0x21'),_0xeb74('0x4f')],'where':{'id':_0x3267bb[_0xeb74('0x3a')][_0xeb74('0x3e')]}});})[_0xeb74('0x1e')](function(_0x3f5aee){socket[_0xeb74('0x50')](_0xeb74('0x51'),{'id':Number(_0x3267bb[_0xeb74('0x2d')]['id']),'tags':_0x3f5aee||[]});return{'id':Number(_0x3267bb['params']['id']),'tags':_0x3f5aee||[]};});}})[_0xeb74('0x1e')](respondWithResult(_0x279f25,null))['catch'](handleError(_0x279f25,null));};exports[_0xeb74('0x52')]=function(_0x54c9d7,_0x53c1c5){return db[_0xeb74('0x24')][_0xeb74('0x3b')]({'where':{'id':_0x54c9d7[_0xeb74('0x2d')]['id']}})[_0xeb74('0x1e')](handleEntityNotFound(_0x53c1c5,null))['then'](function(_0x5b46d0){if(_0x5b46d0){return _0x5b46d0[_0xeb74('0x52')](_0x54c9d7[_0xeb74('0x30')][_0xeb74('0x3e')]);}})[_0xeb74('0x1e')](respondWithStatusCode(_0x53c1c5,null))['catch'](handleError(_0x53c1c5,null));};exports[_0xeb74('0x53')]=function(_0x235705,_0x23e2e5){var _0x4665b8=moment()[_0xeb74('0x54')]()[_0xeb74('0x55')]();var _0xcabc0d=path[_0xeb74('0x56')](config['root'],_0xeb74('0x57'),_0xeb74('0x58'),'tmp');var _0x23185d=path['join'](config['root'],_0xeb74('0x57'),_0xeb74('0x58'),_0xeb74('0x59'));var _0x1abf5e=path[_0xeb74('0x56')](_0xcabc0d,_0x4665b8);var _0x1cc315=util[_0xeb74('0x48')](_0xeb74('0x5a'),_0x235705['params']['id'],_0x4665b8);var _0x3db79b=path[_0xeb74('0x56')](_0xcabc0d,_0x1cc315);var _0x13b498=[];_0x13b498['push']({'model':db[_0xeb74('0x5b')],'as':'Attachment','raw':!![]});var _0x66dc97=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0xeb74('0x3a'),_0xeb74('0x5c')],'include':_0x13b498}];return db[_0xeb74('0x24')][_0xeb74('0x3b')]({'where':{'id':_0x235705[_0xeb74('0x2d')]['id']},'include':_0x66dc97})[_0xeb74('0x1e')](handleEntityNotFound(_0x23e2e5,null))[_0xeb74('0x1e')](function(_0x1f1aa7){if(_0x1f1aa7&&_0x1f1aa7[_0xeb74('0x5d')]){var _0x47485f=_0x1f1aa7[_0xeb74('0x5e')]({'plain':!![]});fs[_0xeb74('0x5f')](_0x1abf5e);for(var _0x20fb15=0x0;_0x20fb15<_0x47485f[_0xeb74('0x5d')][_0xeb74('0x35')];_0x20fb15++){var _0x3367c4=_0x47485f['Messages'][_0x20fb15]['Attachment'];if(_0x3367c4){var _0x218bd0=path[_0xeb74('0x56')](_0x23185d,_0x3367c4['basename']);if(fs[_0xeb74('0x60')](_0x218bd0)){fs[_0xeb74('0x61')](_0x218bd0)['pipe'](fs['createWriteStream'](path[_0xeb74('0x56')](_0x1abf5e,_0x3367c4[_0xeb74('0x62')])));}}}return BPromise[_0xeb74('0x63')]()[_0xeb74('0x1e')](function(){return new BPromise(function(_0x323ad4,_0x2a1c08){zipdir(_0x1abf5e,{'saveTo':_0x3db79b},function(_0x261fe6,_0x3b4dc9){if(_0x261fe6)return _0x2a1c08(_0x261fe6);return _0x323ad4(_0x3b4dc9);});})['then'](function(){return new BPromise(function(_0x9edf72,_0x4534e4){rimraf(_0x1abf5e,function(_0xe8b698){if(_0xe8b698)_0x4534e4(_0xe8b698);return _0x9edf72();});});})[_0xeb74('0x1e')](function(){return _0x23e2e5['download'](_0x3db79b,_0x1cc315,function(_0xe66f68){if(_0xe66f68){console[_0xeb74('0x64')](_0xeb74('0x65'),_0xe66f68);}else{fs[_0xeb74('0x66')](_0x3db79b);}});});});}else{return _0x23e2e5[_0xeb74('0x13')](0xc8);}})[_0xeb74('0x2b')](handleError(_0x23e2e5,null));}; \ No newline at end of file +var _0xe751=['socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','name','index','FaxInteraction','rawAttributes','fieldName','type','getOptions','findAll','fax','query','user','catch','show','params','model','keys','intersection','attributes','fields','includeAll','include','options','create','body','find','addMessage','ids','omit','FaxMessage','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','unix','toString','join','root','server','files','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','download','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis'];(function(_0x1f8490,_0xf8509b){var _0x295061=function(_0xa4b16){while(--_0xa4b16){_0x1f8490['push'](_0x1f8490['shift']());}};_0x295061(++_0xf8509b);}(_0xe751,0x199));var _0x1e75=function(_0x11239c,_0x2fc625){_0x11239c=_0x11239c-0x0;var _0x2ad4e6=_0xe751[_0x11239c];return _0x2ad4e6;};'use strict';var rimraf=require(_0x1e75('0x0'));var zipdir=require(_0x1e75('0x1'));var moment=require('moment');var BPromise=require(_0x1e75('0x2'));var util=require(_0x1e75('0x3'));var path=require(_0x1e75('0x4'));var fs=require('fs');var _=require(_0x1e75('0x5'));var Redis=require(_0x1e75('0x6'));var interaction=require(_0x1e75('0x7'));var qs=require(_0x1e75('0x8'));var logger=require(_0x1e75('0x9'))(_0x1e75('0xa'));var config=require(_0x1e75('0xb'));var db=require(_0x1e75('0xc'))['db'];config['redis']=_[_0x1e75('0xd')](config[_0x1e75('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e75('0xf'))(new Redis(config['redis']));require(_0x1e75('0x10'))[_0x1e75('0x11')](socket);function respondWithStatusCode(_0xe98774,_0x73f583){_0x73f583=_0x73f583||0xcc;return function(_0x5a5a5e){if(_0x5a5a5e){return _0xe98774[_0x1e75('0x12')](_0x73f583);}return _0xe98774['status'](_0x73f583)[_0x1e75('0x13')]();};}function respondWithResult(_0x391f7c,_0x31aa23){_0x31aa23=_0x31aa23||0xc8;return function(_0x2aa2a0){if(_0x2aa2a0){return _0x391f7c[_0x1e75('0x14')](_0x31aa23)[_0x1e75('0x15')](_0x2aa2a0);}};}function respondWithFilteredResult(_0x37d70e,_0x52a10f){return function(_0x2a0cd8){if(_0x2a0cd8){var _0x4fffd2=typeof _0x52a10f[_0x1e75('0x16')]===_0x1e75('0x17')&&typeof _0x52a10f[_0x1e75('0x18')]==='undefined';var _0x3d1951=_0x2a0cd8['count'];var _0xd703e5=_0x4fffd2?0x0:_0x52a10f['offset'];var _0x5531bd=_0x4fffd2?_0x2a0cd8[_0x1e75('0x19')]:_0x52a10f[_0x1e75('0x16')]+_0x52a10f[_0x1e75('0x18')];var _0x29bbc3;if(_0x5531bd>=_0x3d1951){_0x5531bd=_0x3d1951;_0x29bbc3=0xc8;}else{_0x29bbc3=0xce;}_0x37d70e[_0x1e75('0x14')](_0x29bbc3);return _0x37d70e[_0x1e75('0x1a')](_0x1e75('0x1b'),_0xd703e5+'-'+_0x5531bd+'/'+_0x3d1951)[_0x1e75('0x15')](_0x2a0cd8);}return null;};}function saveUpdates(_0x1b3dbc){return function(_0xdcfd40){if(_0xdcfd40){return _0xdcfd40[_0x1e75('0x1c')](_0x1b3dbc)['then'](function(_0x4a499f){return _0x4a499f;});}return null;};}function removeEntity(_0x48e40f){return function(_0x1bf67e){if(_0x1bf67e){return _0x1bf67e[_0x1e75('0x1d')]()[_0x1e75('0x1e')](function(){_0x48e40f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb47dde){return function(_0x58d991){if(!_0x58d991){_0xb47dde[_0x1e75('0x12')](0x194);}return _0x58d991;};}function handleError(_0x2bb4a9,_0x4d6b29){_0x4d6b29=_0x4d6b29||0x1f4;return function(_0x2f9f05){logger[_0x1e75('0x1f')](_0x2f9f05['stack']);if(_0x2f9f05[_0x1e75('0x20')]){delete _0x2f9f05[_0x1e75('0x20')];}_0x2bb4a9[_0x1e75('0x14')](_0x4d6b29)['send'](_0x2f9f05);};}exports[_0x1e75('0x21')]=function(_0x307be0,_0x1d87d8){var _0x12d337={};var _0x2f76e5=_['map'](db[_0x1e75('0x22')][_0x1e75('0x23')],function(_0x437b3d){return{'name':_0x437b3d[_0x1e75('0x24')],'type':_0x437b3d[_0x1e75('0x25')]['key']};});_0x12d337=qs[_0x1e75('0x26')](_0x2f76e5,_0x307be0);return interaction[_0x1e75('0x27')](_0x1e75('0x28'),_0x307be0[_0x1e75('0x29')],_0x307be0[_0x1e75('0x2a')],_0x12d337,_0x2f76e5)[_0x1e75('0x1e')](respondWithFilteredResult(_0x1d87d8,_0x12d337))[_0x1e75('0x2b')](handleError(_0x1d87d8,null));};exports[_0x1e75('0x2c')]=function(_0x13cd6b,_0x4247f0){var _0x2a96d8={'raw':![],'where':{'id':_0x13cd6b[_0x1e75('0x2d')]['id']}},_0xafe0={};_0xafe0[_0x1e75('0x2e')]=_['keys'](db[_0x1e75('0x22')][_0x1e75('0x23')]);_0xafe0[_0x1e75('0x29')]=_[_0x1e75('0x2f')](_0x13cd6b[_0x1e75('0x29')]);_0xafe0['filters']=_[_0x1e75('0x30')](_0xafe0[_0x1e75('0x2e')],_0xafe0[_0x1e75('0x29')]);_0x2a96d8[_0x1e75('0x31')]=_['intersection'](_0xafe0['model'],qs[_0x1e75('0x32')](_0x13cd6b[_0x1e75('0x29')][_0x1e75('0x32')]));_0x2a96d8[_0x1e75('0x31')]=_0x2a96d8['attributes']['length']?_0x2a96d8[_0x1e75('0x31')]:_0xafe0[_0x1e75('0x2e')];if(_0x13cd6b[_0x1e75('0x29')][_0x1e75('0x33')]){_0x2a96d8[_0x1e75('0x34')]=[{'all':!![]}];}_0x2a96d8=_['merge']({},_0x2a96d8,_0x13cd6b[_0x1e75('0x35')]);return db['FaxInteraction']['find'](_0x2a96d8)[_0x1e75('0x1e')](handleEntityNotFound(_0x4247f0,null))[_0x1e75('0x1e')](respondWithResult(_0x4247f0,null))[_0x1e75('0x2b')](handleError(_0x4247f0,null));};exports['create']=function(_0x54fedc,_0xb9fdc0){return db[_0x1e75('0x22')][_0x1e75('0x36')](_0x54fedc[_0x1e75('0x37')],{})[_0x1e75('0x1e')](respondWithResult(_0xb9fdc0,0xc9))[_0x1e75('0x2b')](handleError(_0xb9fdc0,null));};exports[_0x1e75('0x1c')]=function(_0x8024a1,_0x479e85){if(_0x8024a1[_0x1e75('0x37')]['id']){delete _0x8024a1['body']['id'];}return db[_0x1e75('0x22')][_0x1e75('0x38')]({'where':{'id':_0x8024a1[_0x1e75('0x2d')]['id']}})[_0x1e75('0x1e')](handleEntityNotFound(_0x479e85,null))[_0x1e75('0x1e')](saveUpdates(_0x8024a1[_0x1e75('0x37')],null))['then'](respondWithResult(_0x479e85,null))[_0x1e75('0x2b')](handleError(_0x479e85,null));};exports[_0x1e75('0x1d')]=function(_0x1cf1b7,_0x54a3d4){return db[_0x1e75('0x22')][_0x1e75('0x38')]({'where':{'id':_0x1cf1b7[_0x1e75('0x2d')]['id']}})[_0x1e75('0x1e')](handleEntityNotFound(_0x54a3d4,null))['then'](removeEntity(_0x54a3d4,null))[_0x1e75('0x2b')](handleError(_0x54a3d4,null));};exports['describe']=function(_0x1bac15,_0x2fa270){return db[_0x1e75('0x22')]['describe']()[_0x1e75('0x1e')](respondWithResult(_0x2fa270,null))[_0x1e75('0x2b')](handleError(_0x2fa270,null));};exports[_0x1e75('0x39')]=function(_0x4c166c,_0x334bb0){return db['FaxMessage'][_0x1e75('0x38')]({'where':{'id':_0x4c166c['params']['id']}})['then'](handleEntityNotFound(_0x334bb0,null))[_0x1e75('0x1e')](function(_0x24fcc6){if(_0x24fcc6){return _0x24fcc6['addMessage'](_0x4c166c[_0x1e75('0x37')][_0x1e75('0x3a')],_[_0x1e75('0x3b')](_0x4c166c['body'],[_0x1e75('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x334bb0,null))[_0x1e75('0x2b')](handleError(_0x334bb0,null));};exports['getMessages']=function(_0x5e9a7a,_0x10f00e){var _0x490f47={'raw':![],'where':{}};var _0x2a1cd7={};var _0x27e3ae={'count':0x0,'rows':[]};return db[_0x1e75('0x22')]['findOne']({'where':{'id':_0x5e9a7a[_0x1e75('0x2d')]['id']}})[_0x1e75('0x1e')](handleEntityNotFound(_0x10f00e,null))[_0x1e75('0x1e')](function(_0x317b95){if(_0x317b95){_0x2a1cd7[_0x1e75('0x2e')]=_[_0x1e75('0x2f')](db[_0x1e75('0x3c')][_0x1e75('0x23')]);_0x2a1cd7[_0x1e75('0x29')]=_[_0x1e75('0x2f')](_0x5e9a7a[_0x1e75('0x29')]);_0x2a1cd7[_0x1e75('0x3d')]=_[_0x1e75('0x30')](_0x2a1cd7['model'],_0x2a1cd7[_0x1e75('0x29')]);_0x490f47[_0x1e75('0x31')]=_['intersection'](_0x2a1cd7[_0x1e75('0x2e')],qs['fields'](_0x5e9a7a[_0x1e75('0x29')][_0x1e75('0x32')]));_0x490f47[_0x1e75('0x31')]=_0x490f47[_0x1e75('0x31')][_0x1e75('0x3e')]?_0x490f47[_0x1e75('0x31')]:_0x2a1cd7[_0x1e75('0x2e')];if(!_0x5e9a7a['query'][_0x1e75('0x3f')](_0x1e75('0x40'))){_0x490f47[_0x1e75('0x18')]=qs[_0x1e75('0x18')](_0x5e9a7a['query'][_0x1e75('0x18')]);_0x490f47[_0x1e75('0x16')]=qs['offset'](_0x5e9a7a[_0x1e75('0x29')][_0x1e75('0x16')]);}_0x490f47[_0x1e75('0x41')]=qs['sort'](_0x5e9a7a[_0x1e75('0x29')][_0x1e75('0x42')]);_0x490f47[_0x1e75('0x43')]=qs['filters'](_[_0x1e75('0x44')](_0x5e9a7a[_0x1e75('0x29')],_0x2a1cd7[_0x1e75('0x3d')]));_0x490f47[_0x1e75('0x43')][_0x1e75('0x45')]=_0x317b95['id'];if(_0x5e9a7a[_0x1e75('0x29')][_0x1e75('0x46')]){_0x490f47[_0x1e75('0x43')]=_[_0x1e75('0x47')](_0x490f47['where'],{'$or':_[_0x1e75('0x48')](_0x490f47['attributes'],function(_0x5ee58e){var _0x4c3096={};_0x4c3096[_0x5ee58e]={'$like':'%'+_0x5e9a7a[_0x1e75('0x29')]['filter']+'%'};return _0x4c3096;})});}if(_0x5e9a7a['query'][_0x1e75('0x49')]){var _0xffe6c4=_0x5e9a7a[_0x1e75('0x29')]['$gte'][_0x1e75('0x4a')](',');var _0x1d120d={};_0x1d120d[_0xffe6c4[0x0]]={'$gte':moment(_0xffe6c4[0x1])['format'](_0x1e75('0x4b'))};_0x490f47['where']=_[_0x1e75('0x47')](_0x490f47['where'],_0x1d120d);}_0x490f47=_[_0x1e75('0x47')]({},_0x490f47,_0x5e9a7a[_0x1e75('0x35')]);return db[_0x1e75('0x3c')][_0x1e75('0x19')]({'where':_0x490f47[_0x1e75('0x43')]})[_0x1e75('0x1e')](function(_0x936b0c){_0x27e3ae[_0x1e75('0x19')]=_0x936b0c;if(_0x5e9a7a[_0x1e75('0x29')][_0x1e75('0x33')]){_0x490f47[_0x1e75('0x34')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x490f47);})[_0x1e75('0x1e')](function(_0x365646){_0x27e3ae[_0x1e75('0x4c')]=_0x365646;return _0x27e3ae;});}})[_0x1e75('0x1e')](respondWithFilteredResult(_0x10f00e,_0x490f47))[_0x1e75('0x2b')](handleError(_0x10f00e,null));};exports[_0x1e75('0x4d')]=function(_0x67baca,_0x418cc6){return db[_0x1e75('0x22')][_0x1e75('0x38')]({'where':{'id':_0x67baca[_0x1e75('0x2d')]['id']}})['then'](handleEntityNotFound(_0x418cc6,null))[_0x1e75('0x1e')](function(_0xf253af){if(_0xf253af){return _0xf253af['setTags'](_0x67baca[_0x1e75('0x37')][_0x1e75('0x3a')],_[_0x1e75('0x3b')](_0x67baca[_0x1e75('0x37')],['ids','id'])||{})[_0x1e75('0x4e')](function(){return db[_0x1e75('0x4f')][_0x1e75('0x27')]({'attributes':['id',_0x1e75('0x20'),_0x1e75('0x50')],'where':{'id':_0x67baca['body']['ids']}});})[_0x1e75('0x1e')](function(_0x16b7de){socket[_0x1e75('0x51')](_0x1e75('0x52'),{'id':Number(_0x67baca[_0x1e75('0x2d')]['id']),'tags':_0x16b7de||[]});return{'id':Number(_0x67baca[_0x1e75('0x2d')]['id']),'tags':_0x16b7de||[]};});}})[_0x1e75('0x1e')](respondWithResult(_0x418cc6,null))[_0x1e75('0x2b')](handleError(_0x418cc6,null));};exports['removeTags']=function(_0x3d0da0,_0x271f85){return db[_0x1e75('0x22')][_0x1e75('0x38')]({'where':{'id':_0x3d0da0['params']['id']}})[_0x1e75('0x1e')](handleEntityNotFound(_0x271f85,null))[_0x1e75('0x1e')](function(_0x5c1f98){if(_0x5c1f98){return _0x5c1f98[_0x1e75('0x53')](_0x3d0da0[_0x1e75('0x29')][_0x1e75('0x3a')]);}})[_0x1e75('0x1e')](respondWithStatusCode(_0x271f85,null))[_0x1e75('0x2b')](handleError(_0x271f85,null));};exports['download']=function(_0x25f940,_0x1093f6){var _0xed760b=moment()[_0x1e75('0x54')]()[_0x1e75('0x55')]();var _0x36bd38=path[_0x1e75('0x56')](config[_0x1e75('0x57')],_0x1e75('0x58'),_0x1e75('0x59'),'tmp');var _0x3e127c=path['join'](config[_0x1e75('0x57')],'server',_0x1e75('0x59'),_0x1e75('0x5a'));var _0x9cfd80=path['join'](_0x36bd38,_0xed760b);var _0x1f8dfe=util[_0x1e75('0x5b')](_0x1e75('0x5c'),_0x25f940[_0x1e75('0x2d')]['id'],_0xed760b);var _0x5f0e39=path[_0x1e75('0x56')](_0x36bd38,_0x1f8dfe);var _0x5680b0=[];_0x5680b0['push']({'model':db[_0x1e75('0x5d')],'as':_0x1e75('0x5d'),'raw':!![]});var _0x16d2b1=[{'model':db['FaxMessage'],'as':_0x1e75('0x5e'),'attributes':['id','body',_0x1e75('0x5f')],'include':_0x5680b0}];return db[_0x1e75('0x22')]['find']({'where':{'id':_0x25f940[_0x1e75('0x2d')]['id']},'include':_0x16d2b1})['then'](handleEntityNotFound(_0x1093f6,null))[_0x1e75('0x1e')](function(_0xa06f0f){if(_0xa06f0f&&_0xa06f0f['Messages']){var _0x45ccc8=_0xa06f0f[_0x1e75('0x60')]({'plain':!![]});fs[_0x1e75('0x61')](_0x9cfd80);for(var _0x37d76f=0x0;_0x37d76f<_0x45ccc8[_0x1e75('0x5e')][_0x1e75('0x3e')];_0x37d76f++){var _0x13297e=_0x45ccc8[_0x1e75('0x5e')][_0x37d76f][_0x1e75('0x5d')];if(_0x13297e){var _0x2a086c=path[_0x1e75('0x56')](_0x3e127c,_0x13297e[_0x1e75('0x62')]);if(fs[_0x1e75('0x63')](_0x2a086c)){fs[_0x1e75('0x64')](_0x2a086c)['pipe'](fs[_0x1e75('0x65')](path['join'](_0x9cfd80,_0x13297e[_0x1e75('0x62')])));}}}return BPromise['resolve']()[_0x1e75('0x1e')](function(){return new BPromise(function(_0x1f5d6c,_0x2dbd7b){zipdir(_0x9cfd80,{'saveTo':_0x5f0e39},function(_0x5d02d4,_0xbbced8){if(_0x5d02d4)return _0x2dbd7b(_0x5d02d4);return _0x1f5d6c(_0xbbced8);});})[_0x1e75('0x1e')](function(){return new BPromise(function(_0x259e50,_0x40cac9){rimraf(_0x9cfd80,function(_0x4f1015){if(_0x4f1015)_0x40cac9(_0x4f1015);return _0x259e50();});});})['then'](function(){return _0x1093f6[_0x1e75('0x66')](_0x5f0e39,_0x1f8dfe,function(_0x2ec1){if(_0x2ec1){console[_0x1e75('0x67')](_0x1e75('0x68'),_0x2ec1);}else{fs[_0x1e75('0x69')](_0x5f0e39);}});});});}else{return _0x1093f6[_0x1e75('0x12')](0xc8);}})[_0x1e75('0x2b')](handleError(_0x1093f6,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a14abc2..57f0ceb 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 _0x071b=['length','emit','hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x284435,_0xb263f6){var _0x4f9e26=function(_0x4681ca){while(--_0x4681ca){_0x284435['push'](_0x284435['shift']());}};_0x4f9e26(++_0xb263f6);}(_0x071b,0xd0));var _0xb071=function(_0x2cefc5,_0x11cda0){_0x2cefc5=_0x2cefc5-0x0;var _0x3e7362=_0x071b[_0x2cefc5];return _0x3e7362;};'use strict';var EventEmitter=require(_0xb071('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0xb071('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb071('0x2')](0x0);var events={'afterCreate':_0xb071('0x3'),'afterUpdate':_0xb071('0x4'),'afterDestroy':_0xb071('0x5')};function emitEvent(_0x52907c){return function(_0x2d9708,_0x5ace6f,_0x2a64a0){_0x2d9708[_0xb071('0x6')]({'attributes':['id'],'raw':!![]})[_0xb071('0x7')](function(_0x26c8bc){_0x2d9708[_0xb071('0x8')](_0xb071('0x9'),_0x26c8bc[_0xb071('0xa')](function(_0x1e3022){return{'id':_0x1e3022['id']};}));return FaxMessage[_0xb071('0xb')]({'where':{'FaxInteractionId':_0x2d9708['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x36f6ee){_0x2d9708['setDataValue'](_0xb071('0xc'),_0x36f6ee[_0xb071('0xd')]);FaxInteractionEvents[_0xb071('0xe')](_0x52907c+':'+_0x2d9708['id'],_0x2d9708);FaxInteractionEvents[_0xb071('0xe')](_0x52907c,_0x2d9708);_0x2a64a0(null);})['catch'](_0x2a64a0(null));};}for(var e in events){if(events[_0xb071('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb071('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xf607=['getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x184023,_0x29ac97){var _0x39eac0=function(_0x150f65){while(--_0x150f65){_0x184023['push'](_0x184023['shift']());}};_0x39eac0(++_0x29ac97);}(_0xf607,0xe4));var _0x7f60=function(_0x23abf2,_0x2a6ad1){_0x23abf2=_0x23abf2-0x0;var _0x5b2cfe=_0xf607[_0x23abf2];return _0x5b2cfe;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x7f60('0x0'))['db'][_0x7f60('0x1')];var FaxMessage=require(_0x7f60('0x0'))['db'][_0x7f60('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x7f60('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7f60('0x4'),'afterDestroy':_0x7f60('0x5')};function emitEvent(_0x4b04e0){return function(_0x4ffe2f,_0x21ffd0,_0x582e4b){_0x4ffe2f[_0x7f60('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x15beb5){_0x4ffe2f[_0x7f60('0x7')](_0x7f60('0x8'),_0x15beb5[_0x7f60('0x9')](function(_0x427fcc){return{'id':_0x427fcc['id']};}));return FaxMessage[_0x7f60('0xa')]({'where':{'FaxInteractionId':_0x4ffe2f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7f60('0xb')](function(_0x57b30f){_0x4ffe2f['setDataValue'](_0x7f60('0xc'),_0x57b30f['length']);FaxInteractionEvents[_0x7f60('0xd')](_0x4b04e0+':'+_0x4ffe2f['id'],_0x4ffe2f);FaxInteractionEvents[_0x7f60('0xd')](_0x4b04e0,_0x4ffe2f);_0x582e4b(null);})[_0x7f60('0xe')](_0x582e4b(null));};}for(var e in events){if(events[_0x7f60('0xf')](e)){var event=events[e];FaxInteraction[_0x7f60('0x10')](e,emitEvent(event));}}module[_0x7f60('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6d0f591..fcd9e7c 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 _0x7a08=['api','path','rimraf','../../config/environment','exports','FaxInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x3d9262,_0x52ff44){var _0xfae6d2=function(_0x4f41d2){while(--_0x4f41d2){_0x3d9262['push'](_0x3d9262['shift']());}};_0xfae6d2(++_0x52ff44);}(_0x7a08,0x15f));var _0x87a0=function(_0x17b1c0,_0x5f48f5){_0x17b1c0=_0x17b1c0-0x0;var _0x5b0ff5=_0x7a08[_0x17b1c0];return _0x5b0ff5;};'use strict';var _=require(_0x87a0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x87a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x87a0('0x2'));var rimraf=require(_0x87a0('0x3'));var config=require(_0x87a0('0x4'));var attributes=require('./faxInteraction.attributes');module[_0x87a0('0x5')]=function(_0x102be3,_0x4c9b9a){return _0x102be3['define'](_0x87a0('0x6'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x690c3c,_0x23f4b2,_0x20ca51){if(_0x690c3c[_0x87a0('0x7')](_0x87a0('0x8'))){_0x690c3c['closedAt']=moment()[_0x87a0('0x9')](_0x87a0('0xa'));}_0x20ca51(null,_0x690c3c);}}});}; \ No newline at end of file +var _0xb2c8=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed'];(function(_0x2db45e,_0x3c3b37){var _0x200a5=function(_0x2a9fb2){while(--_0x2a9fb2){_0x2db45e['push'](_0x2db45e['shift']());}};_0x200a5(++_0x3c3b37);}(_0xb2c8,0x197));var _0x8b2c=function(_0x3e3082,_0x3487ec){_0x3e3082=_0x3e3082-0x0;var _0x1ee834=_0xb2c8[_0x3e3082];return _0x1ee834;};'use strict';var _=require(_0x8b2c('0x0'));var util=require(_0x8b2c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8b2c('0x2'));var BPromise=require(_0x8b2c('0x3'));var rp=require(_0x8b2c('0x4'));var fs=require('fs');var path=require(_0x8b2c('0x5'));var rimraf=require(_0x8b2c('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b2c('0x7'));module[_0x8b2c('0x8')]=function(_0x1b0e93,_0x565ad3){return _0x1b0e93[_0x8b2c('0x9')](_0x8b2c('0xa'),attributes,{'tableName':_0x8b2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59d8a1,_0x35608c,_0x399eb0){if(_0x59d8a1['changed'](_0x8b2c('0xc'))){_0x59d8a1['closedAt']=moment()[_0x8b2c('0xd')](_0x8b2c('0xe'));}_0x399eb0(null,_0x59d8a1);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 25ccdb0..c199385 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 _0xdcba=['body','options','raw','where','limit','debug','AddTagsToFaxInteraction','FaxInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','update'];(function(_0x5a41b4,_0x1cc01a){var _0x48ea46=function(_0x172482){while(--_0x172482){_0x5a41b4['push'](_0x5a41b4['shift']());}};_0x48ea46(++_0x1cc01a);}(_0xdcba,0xb1));var _0xadcb=function(_0x21ece6,_0x489fde){_0x21ece6=_0x21ece6-0x0;var _0x22a7e3=_0xdcba[_0x21ece6];return _0x22a7e3;};'use strict';var _=require(_0xadcb('0x0'));var util=require(_0xadcb('0x1'));var moment=require(_0xadcb('0x2'));var BPromise=require(_0xadcb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadcb('0x4'))['db'];var utils=require(_0xadcb('0x5'));var logger=require(_0xadcb('0x6'))(_0xadcb('0x7'));var config=require(_0xadcb('0x8'));var jayson=require(_0xadcb('0x9'));var client=jayson[_0xadcb('0xa')][_0xadcb('0xb')]({'port':0x232a});config[_0xadcb('0xc')]=_[_0xadcb('0xd')](config['redis'],{'host':_0xadcb('0xe'),'port':0x18eb});var socket=require(_0xadcb('0xf'))(new Redis(config[_0xadcb('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4ad5f8,_0x2b5502,_0x459c31){return new BPromise(function(_0x14e549,_0x522117){return client['request'](_0x4ad5f8,_0x459c31)[_0xadcb('0x10')](function(_0x42529b){logger[_0xadcb('0x11')](_0xadcb('0x12'),_0x2b5502,_0xadcb('0x13'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2b5502,'request\x20sent',JSON[_0xadcb('0x14')](_0x42529b));if(_0x42529b[_0xadcb('0x15')]){if(_0x42529b[_0xadcb('0x15')][_0xadcb('0x16')]===0x1f4){logger['error'](_0xadcb('0x12'),_0x2b5502,_0x42529b[_0xadcb('0x15')][_0xadcb('0x17')]);return _0x522117(_0x42529b[_0xadcb('0x15')][_0xadcb('0x17')]);}logger[_0xadcb('0x15')](_0xadcb('0x12'),_0x2b5502,_0x42529b[_0xadcb('0x15')][_0xadcb('0x17')]);return _0x14e549(_0x42529b['error'][_0xadcb('0x17')]);}else{logger[_0xadcb('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x2b5502,'request\x20sent');_0x14e549(_0x42529b[_0xadcb('0x18')][_0xadcb('0x17')]);}})[_0xadcb('0x19')](function(_0x1164be){logger[_0xadcb('0x15')](_0xadcb('0x12'),_0x2b5502,_0x1164be);_0x522117(_0x1164be);});});}exports[_0xadcb('0x1a')]=function(_0x434244){var _0x24e39e=this;return new Promise(function(_0x453acc,_0xa745){return db['FaxInteraction'][_0xadcb('0x1b')](_0x434244[_0xadcb('0x1c')],{'raw':_0x434244[_0xadcb('0x1d')]?_0x434244[_0xadcb('0x1d')][_0xadcb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x434244[_0xadcb('0x1d')]?_0x434244[_0xadcb('0x1d')][_0xadcb('0x1f')]||null:null,'attributes':_0x434244['options']?_0x434244['options']['attributes']||null:null,'limit':_0x434244[_0xadcb('0x1d')]?_0x434244[_0xadcb('0x1d')][_0xadcb('0x20')]||null:null})[_0xadcb('0x10')](function(_0x36053c){logger[_0xadcb('0x11')](_0xadcb('0x1a'),_0x434244);logger[_0xadcb('0x21')]('UpdateFaxInteraction',_0x434244,JSON['stringify'](_0x36053c));_0x453acc(_0x36053c);})[_0xadcb('0x19')](function(_0x1610ae){logger[_0xadcb('0x15')](_0xadcb('0x1a'),_0x1610ae[_0xadcb('0x17')],_0x434244);_0xa745(_0x24e39e[_0xadcb('0x15')](0x1f4,_0x1610ae['message']));});});};exports[_0xadcb('0x22')]=function(_0x4e0980){return new Promise(function(_0xeaaef8,_0x143033){return db[_0xadcb('0x23')][_0xadcb('0x24')]({'where':_0x4e0980[_0xadcb('0x1d')]?_0x4e0980[_0xadcb('0x1d')][_0xadcb('0x1f')]||null:null})[_0xadcb('0x10')](function(_0x1ee4de){if(_0x1ee4de){return _0x1ee4de[_0xadcb('0x25')](_0x4e0980['body']['ids'],_[_0xadcb('0x26')](_0x4e0980[_0xadcb('0x1c')],[_0xadcb('0x27'),'id'])||{});}})['spread'](function(_0x203caa){logger['info']('AddTags',_0x4e0980);logger[_0xadcb('0x21')]('AddTags',_0x4e0980,JSON[_0xadcb('0x14')](_0x203caa));_0xeaaef8(_0x203caa);})['catch'](function(_0x322b70){logger[_0xadcb('0x15')](_0xadcb('0x28'),_0x322b70[_0xadcb('0x17')],_0x4e0980);_0x143033(_this[_0xadcb('0x15')](0x1f4,_0x322b70[_0xadcb('0x17')]));});});}; \ No newline at end of file +var _0x394a=['localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','then','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis'];(function(_0x93c068,_0x12f596){var _0x3c7015=function(_0x130131){while(--_0x130131){_0x93c068['push'](_0x93c068['shift']());}};_0x3c7015(++_0x12f596);}(_0x394a,0x143));var _0xa394=function(_0x5c1f23,_0x5f2cef){_0x5c1f23=_0x5c1f23-0x0;var _0x407ef8=_0x394a[_0x5c1f23];return _0x407ef8;};'use strict';var _=require(_0xa394('0x0'));var util=require('util');var moment=require(_0xa394('0x1'));var BPromise=require(_0xa394('0x2'));var rs=require(_0xa394('0x3'));var fs=require('fs');var Redis=require(_0xa394('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa394('0x5'));var logger=require(_0xa394('0x6'))(_0xa394('0x7'));var config=require(_0xa394('0x8'));var jayson=require(_0xa394('0x9'));var client=jayson[_0xa394('0xa')]['http']({'port':0x232a});config['redis']=_[_0xa394('0xb')](config[_0xa394('0xc')],{'host':_0xa394('0xd'),'port':0x18eb});var socket=require(_0xa394('0xe'))(new Redis(config[_0xa394('0xc')]));require(_0xa394('0xf'))[_0xa394('0x10')](socket);function respondWithRpcPromise(_0x2102c6,_0x52afba,_0x86b2ba){return new BPromise(function(_0x469839,_0xfea1b3){return client[_0xa394('0x11')](_0x2102c6,_0x86b2ba)['then'](function(_0x1d481e){logger[_0xa394('0x12')](_0xa394('0x13'),_0x52afba,_0xa394('0x14'));logger[_0xa394('0x15')](_0xa394('0x16'),_0x52afba,_0xa394('0x14'),JSON[_0xa394('0x17')](_0x1d481e));if(_0x1d481e['error']){if(_0x1d481e[_0xa394('0x18')][_0xa394('0x19')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x52afba,_0x1d481e['error'][_0xa394('0x1a')]);return _0xfea1b3(_0x1d481e[_0xa394('0x18')][_0xa394('0x1a')]);}logger['error'](_0xa394('0x13'),_0x52afba,_0x1d481e['error'][_0xa394('0x1a')]);return _0x469839(_0x1d481e[_0xa394('0x18')][_0xa394('0x1a')]);}else{logger[_0xa394('0x12')](_0xa394('0x13'),_0x52afba,'request\x20sent');_0x469839(_0x1d481e['result'][_0xa394('0x1a')]);}})[_0xa394('0x1b')](function(_0x2e926e){logger[_0xa394('0x18')](_0xa394('0x13'),_0x52afba,_0x2e926e);_0xfea1b3(_0x2e926e);});});}exports[_0xa394('0x1c')]=function(_0x448013){var _0x1b162b=this;return new Promise(function(_0x33de8a,_0x4c855f){return db[_0xa394('0x1d')]['update'](_0x448013[_0xa394('0x1e')],{'raw':_0x448013[_0xa394('0x1f')]?_0x448013[_0xa394('0x1f')][_0xa394('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x448013['options']?_0x448013[_0xa394('0x1f')][_0xa394('0x21')]||null:null,'attributes':_0x448013[_0xa394('0x1f')]?_0x448013[_0xa394('0x1f')][_0xa394('0x22')]||null:null,'limit':_0x448013[_0xa394('0x1f')]?_0x448013[_0xa394('0x1f')]['limit']||null:null})[_0xa394('0x23')](function(_0x3df011){logger[_0xa394('0x12')]('UpdateFaxInteraction',_0x448013);logger[_0xa394('0x15')]('UpdateFaxInteraction',_0x448013,JSON[_0xa394('0x17')](_0x3df011));_0x33de8a(_0x3df011);})[_0xa394('0x1b')](function(_0x542c6b){logger['error'](_0xa394('0x1c'),_0x542c6b[_0xa394('0x1a')],_0x448013);_0x4c855f(_0x1b162b['error'](0x1f4,_0x542c6b[_0xa394('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x1750d5){return new Promise(function(_0x1fe06f,_0x3c3903){return db[_0xa394('0x1d')][_0xa394('0x24')]({'where':_0x1750d5[_0xa394('0x1f')]?_0x1750d5[_0xa394('0x1f')]['where']||null:null})['then'](function(_0x18887c){if(_0x18887c){return _0x18887c[_0xa394('0x25')](_0x1750d5[_0xa394('0x1e')]['ids'],_[_0xa394('0x26')](_0x1750d5[_0xa394('0x1e')],[_0xa394('0x27'),'id'])||{});}})[_0xa394('0x28')](function(_0x127124){logger[_0xa394('0x12')](_0xa394('0x29'),_0x1750d5);logger[_0xa394('0x15')](_0xa394('0x29'),_0x1750d5,JSON[_0xa394('0x17')](_0x127124));_0x1fe06f(_0x127124);})[_0xa394('0x1b')](function(_0x116e9e){logger[_0xa394('0x18')](_0xa394('0x29'),_0x116e9e['message'],_0x1750d5);_0x3c3903(_this[_0xa394('0x18')](0x1f4,_0x116e9e['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index be0feca..f0351de 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 _0x5465=['save','emit','removeListener','register','faxInteraction:'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x5465,0x87));var _0x5546=function(_0x393101,_0x553754){_0x393101=_0x393101-0x0;var _0x138b75=_0x5465[_0x393101];return _0x138b75;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x5546('0x0'),'remove','update'];function createListener(_0x58c24d,_0x10b406){return function(_0x4167e2){_0x10b406[_0x5546('0x1')](_0x58c24d,_0x4167e2);};}function removeListener(_0x26fa94,_0x126c0b){return function(){FaxInteractionEvents[_0x5546('0x2')](_0x26fa94,_0x126c0b);};}exports[_0x5546('0x3')]=function(_0x147b33){for(var _0x14bec6=0x0,_0x222468=events['length'];_0x14bec6<_0x222468;_0x14bec6++){var _0x2f0083=events[_0x14bec6];var _0x339a10=createListener(_0x5546('0x4')+_0x2f0083,_0x147b33);FaxInteractionEvents['on'](_0x2f0083,_0x339a10);}}; \ No newline at end of file +var _0x05bd=['save','remove','update','register','length','faxInteraction:'];(function(_0x563b6a,_0x29d2b7){var _0x46da0c=function(_0x20f3b9){while(--_0x20f3b9){_0x563b6a['push'](_0x563b6a['shift']());}};_0x46da0c(++_0x29d2b7);}(_0x05bd,0xa8));var _0xd05b=function(_0x657e67,_0x518f58){_0x657e67=_0x657e67-0x0;var _0x29e86d=_0x05bd[_0x657e67];return _0x29e86d;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xd05b('0x0'),_0xd05b('0x1'),_0xd05b('0x2')];function createListener(_0x4dd7bc,_0x55deca){return function(_0x226079){_0x55deca['emit'](_0x4dd7bc,_0x226079);};}function removeListener(_0x4e345f,_0x3e47a1){return function(){FaxInteractionEvents['removeListener'](_0x4e345f,_0x3e47a1);};}exports[_0xd05b('0x3')]=function(_0x55c552){for(var _0x3a6b48=0x0,_0x2cbb6c=events[_0xd05b('0x4')];_0x3a6b48<_0x2cbb6c;_0x3a6b48++){var _0x21f668=events[_0x3a6b48];var _0x3f364a=createListener(_0xd05b('0x5')+_0x21f668,_0x55c552);FaxInteractionEvents['on'](_0x21f668,_0x3f364a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 49ef1b0..4a44283 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 _0xeff1=['delete','faxinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','addTags','put','faxinteraction:update','update'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0xeff1,0x198));var _0x1eff=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0xeff1[_0x4e198a];return _0xb84bfe;};'use strict';var multer=require(_0x1eff('0x0'));var util=require('util');var path=require(_0x1eff('0x1'));var timeout=require(_0x1eff('0x2'));var express=require(_0x1eff('0x3'));var router=express['Router']();var fs_extra=require(_0x1eff('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1eff('0x5'));var controller=require('./faxInteraction.controller');router[_0x1eff('0x6')]('/',auth[_0x1eff('0x7')](),controller[_0x1eff('0x8')]);router['get'](_0x1eff('0x9'),auth[_0x1eff('0x7')](),controller['describe']);router[_0x1eff('0x6')](_0x1eff('0xa'),auth[_0x1eff('0x7')](),controller[_0x1eff('0xb')]);router['get'](_0x1eff('0xc'),auth[_0x1eff('0x7')](),controller[_0x1eff('0xd')]);router[_0x1eff('0x6')](_0x1eff('0xe'),auth[_0x1eff('0x7')](),controller[_0x1eff('0xf')]);router[_0x1eff('0x10')]('/',auth[_0x1eff('0x7')](),controller[_0x1eff('0x11')]);router[_0x1eff('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1eff('0x12')]);router['post'](_0x1eff('0x13'),auth['isAuthenticated'](),interaction[_0x1eff('0x14')](_0x1eff('0x15'),'faxinteraction:addtags'),controller[_0x1eff('0x16')]);router[_0x1eff('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0x1eff('0x14')](_0x1eff('0x15'),_0x1eff('0x18')),controller[_0x1eff('0x19')]);router[_0x1eff('0x1a')](_0x1eff('0xa'),auth[_0x1eff('0x7')](),interaction['tracked']('fax',_0x1eff('0x1b')),controller[_0x1eff('0x1c')]);router['delete'](_0x1eff('0x13'),auth[_0x1eff('0x7')](),controller[_0x1eff('0x1d')]);module[_0x1eff('0x1e')]=router; \ No newline at end of file +var _0xb3ea=['/:id','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','addTags','put','faxinteraction:update','delete','fax','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb3ea,0x10d));var _0xab3e=function(_0x2ee3e2,_0x3c4049){_0x2ee3e2=_0x2ee3e2-0x0;var _0x3ac875=_0xb3ea[_0x2ee3e2];return _0x3ac875;};'use strict';var multer=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var path=require(_0xab3e('0x2'));var timeout=require('connect-timeout');var express=require(_0xab3e('0x3'));var router=express['Router']();var fs_extra=require(_0xab3e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xab3e('0x5'));var config=require(_0xab3e('0x6'));var controller=require(_0xab3e('0x7'));router[_0xab3e('0x8')]('/',auth[_0xab3e('0x9')](),controller['index']);router[_0xab3e('0x8')]('/describe',auth[_0xab3e('0x9')](),controller[_0xab3e('0xa')]);router['get'](_0xab3e('0xb'),auth[_0xab3e('0x9')](),controller['show']);router[_0xab3e('0x8')](_0xab3e('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0xab3e('0x8')](_0xab3e('0xd'),auth[_0xab3e('0x9')](),controller[_0xab3e('0xe')]);router[_0xab3e('0xf')]('/',auth[_0xab3e('0x9')](),controller['create']);router['post']('/:id/messages',auth[_0xab3e('0x9')](),controller[_0xab3e('0x10')]);router[_0xab3e('0xf')](_0xab3e('0x11'),auth['isAuthenticated'](),interaction[_0xab3e('0x12')]('fax','faxinteraction:addtags'),controller[_0xab3e('0x13')]);router[_0xab3e('0x14')]('/:id',auth[_0xab3e('0x9')](),interaction[_0xab3e('0x12')]('fax',_0xab3e('0x15')),controller['update']);router[_0xab3e('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0xab3e('0x12')](_0xab3e('0x17'),_0xab3e('0x18')),controller[_0xab3e('0x19')]);router[_0xab3e('0x16')](_0xab3e('0x11'),auth['isAuthenticated'](),controller[_0xab3e('0x1a')]);module[_0xab3e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 1a2564c..c2025e4 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 _0x0e35=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3732bc,_0x588aac){var _0x4038ab=function(_0x11168d){while(--_0x11168d){_0x3732bc['push'](_0x3732bc['shift']());}};_0x4038ab(++_0x588aac);}(_0x0e35,0xc2));var _0x50e3=function(_0x281c6f,_0x19af31){_0x281c6f=_0x281c6f-0x0;var _0x3ed51a=_0x0e35[_0x281c6f];return _0x3ed51a;};'use strict';var Sequelize=require(_0x50e3('0x0'));module[_0x50e3('0x1')]={'body':{'type':Sequelize[_0x50e3('0x2')](_0x50e3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x50e3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x50e3('0x5')]('in',_0x50e3('0x6')),'defaultValue':_0x50e3('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x50e3('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x50e3('0x7')]}}; \ No newline at end of file +var _0xd2ea=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd2ea,0x15f));var _0xad2e=function(_0xb0787e,_0xab707f){_0xb0787e=_0xb0787e-0x0;var _0x1cdcd6=_0xd2ea[_0xb0787e];return _0x1cdcd6;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'body':{'type':Sequelize[_0xad2e('0x2')](_0xad2e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xad2e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xad2e('0x5')),'defaultValue':_0xad2e('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xad2e('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xad2e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 2ca5286..3037295 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 _0xc87d=['update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','options','FaxMessage','includeAll','include','findAll','rows','show','params','body','find','catch','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteractionId','read1stAt','interaction','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','User','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','interface','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','isNil','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','Attachment','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xc87d,0xed));var _0xdc87=function(_0x3ad06e,_0x2cc9af){_0x3ad06e=_0x3ad06e-0x0;var _0xa97338=_0xc87d[_0x3ad06e];return _0xa97338;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc87('0x0'));var zipdir=require(_0xdc87('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc87('0x2'));var moment=require('moment');var BPromise=require(_0xdc87('0x3'));var Mustache=require(_0xdc87('0x4'));var util=require(_0xdc87('0x5'));var path=require(_0xdc87('0x6'));var sox=require('sox');var csv=require(_0xdc87('0x7'));var ejs=require(_0xdc87('0x8'));var fs=require('fs');var fs_extra=require(_0xdc87('0x9'));var _=require(_0xdc87('0xa'));var squel=require(_0xdc87('0xb'));var crypto=require(_0xdc87('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdc87('0xd'));var toCsv=require(_0xdc87('0x7'));var querystring=require('querystring');var Papa=require(_0xdc87('0xe'));var Redis=require(_0xdc87('0xf'));var authService=require(_0xdc87('0x10'));var qs=require(_0xdc87('0x11'));var as=require(_0xdc87('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc87('0x13'))(_0xdc87('0x14'));var utils=require(_0xdc87('0x15'));var config=require(_0xdc87('0x16'));var licenseUtil=require(_0xdc87('0x17'));var db=require(_0xdc87('0x18'))['db'];config[_0xdc87('0x19')]=_[_0xdc87('0x1a')](config[_0xdc87('0x19')],{'host':_0xdc87('0x1b'),'port':0x18eb});var socket=require(_0xdc87('0x1c'))(new Redis(config[_0xdc87('0x19')]));require(_0xdc87('0x1d'))[_0xdc87('0x1e')](socket);var jayson=require(_0xdc87('0x1f'));var client=jayson[_0xdc87('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xdc87('0x20')][_0xdc87('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x44bde2,_0x2134a1,_0x48ed2a,_0x268de7){return new BPromise(function(_0x97cc51,_0x515c2a){var _0x3570e8=_0x268de7||client;return _0x3570e8[_0xdc87('0x22')](_0x44bde2,_0x48ed2a)[_0xdc87('0x23')](function(_0x4cf0df){logger[_0xdc87('0x24')](_0xdc87('0x25'),_0x2134a1,'request\x20sent');logger[_0xdc87('0x26')](_0xdc87('0x27'),_0x2134a1,_0xdc87('0x28'),JSON[_0xdc87('0x29')](_0x4cf0df));if(_0x4cf0df[_0xdc87('0x2a')]){if(_0x4cf0df[_0xdc87('0x2a')][_0xdc87('0x2b')]===0x1f4){logger['error'](_0xdc87('0x25'),_0x2134a1,_0x4cf0df[_0xdc87('0x2a')][_0xdc87('0x2c')]);return _0x515c2a(_0x4cf0df[_0xdc87('0x2a')][_0xdc87('0x2c')]);}logger[_0xdc87('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x2134a1,_0x4cf0df[_0xdc87('0x2a')][_0xdc87('0x2c')]);return _0x97cc51(_0x4cf0df[_0xdc87('0x2a')][_0xdc87('0x2c')]);}else{logger[_0xdc87('0x24')](_0xdc87('0x25'),_0x2134a1,_0xdc87('0x28'));_0x97cc51(_0x4cf0df[_0xdc87('0x2d')][_0xdc87('0x2c')]);}})['catch'](function(_0x3b76bd){logger[_0xdc87('0x2a')](_0xdc87('0x25'),_0x2134a1,_0x3b76bd);_0x515c2a(_0x3b76bd);});});}function respondWithStatusCode(_0x6b0a39,_0x155dcf){_0x155dcf=_0x155dcf||0xcc;return function(_0x4fd935){if(_0x4fd935){return _0x6b0a39[_0xdc87('0x2e')](_0x155dcf);}return _0x6b0a39[_0xdc87('0x2f')](_0x155dcf)[_0xdc87('0x30')]();};}function respondWithResult(_0x230f77,_0x9fa11d){_0x9fa11d=_0x9fa11d||0xc8;return function(_0x3e9555){if(_0x3e9555){return _0x230f77[_0xdc87('0x2f')](_0x9fa11d)[_0xdc87('0x31')](_0x3e9555);}};}function respondWithFilteredResult(_0x24a39e,_0x31a0dd){return function(_0x49e021){if(_0x49e021){var _0x541a9e=typeof _0x31a0dd[_0xdc87('0x32')]===_0xdc87('0x33')&&typeof _0x31a0dd[_0xdc87('0x34')]===_0xdc87('0x33');var _0x2afd35=_0x49e021[_0xdc87('0x35')];var _0x547765=_0x541a9e?0x0:_0x31a0dd[_0xdc87('0x32')];var _0x279602=_0x541a9e?_0x49e021[_0xdc87('0x35')]:_0x31a0dd[_0xdc87('0x32')]+_0x31a0dd[_0xdc87('0x34')];var _0x42f5d8;if(_0x279602>=_0x2afd35){_0x279602=_0x2afd35;_0x42f5d8=0xc8;}else{_0x42f5d8=0xce;}_0x24a39e[_0xdc87('0x2f')](_0x42f5d8);return _0x24a39e[_0xdc87('0x36')]('Content-Range',_0x547765+'-'+_0x279602+'/'+_0x2afd35)[_0xdc87('0x31')](_0x49e021);}return null;};}function patchUpdates(_0x26fa3c){return function(_0x65da1d){try{jsonpatch[_0xdc87('0x37')](_0x65da1d,_0x26fa3c,!![]);}catch(_0xc1afb7){return BPromise[_0xdc87('0x38')](_0xc1afb7);}return _0x65da1d['save']();};}function saveUpdates(_0x284de0,_0x5a092d){return function(_0xbdab8e){if(_0xbdab8e){return _0xbdab8e[_0xdc87('0x39')](_0x284de0)[_0xdc87('0x23')](function(_0x5bb60e){return _0x5bb60e;});}return null;};}function removeEntity(_0x8e529e,_0x1ed21a){return function(_0x4dcf1d){if(_0x4dcf1d){return _0x4dcf1d[_0xdc87('0x3a')]()[_0xdc87('0x23')](function(){_0x8e529e[_0xdc87('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x484df0,_0xa130e7){return function(_0x237c1a){if(!_0x237c1a){_0x484df0[_0xdc87('0x2e')](0x194);}return _0x237c1a;};}function handleError(_0x114266,_0x3d7d20){_0x3d7d20=_0x3d7d20||0x1f4;return function(_0x1fd6b1){logger['error'](_0x1fd6b1[_0xdc87('0x3b')]);if(_0x1fd6b1['name']){delete _0x1fd6b1[_0xdc87('0x3c')];}_0x114266[_0xdc87('0x2f')](_0x3d7d20)[_0xdc87('0x3d')](_0x1fd6b1);};}exports[_0xdc87('0x3e')]=function(_0x4550b9,_0xeb98cf){var _0x50cb6c={},_0x3d623={},_0x306fbc={'count':0x0,'rows':[]};var _0x236b67=_[_0xdc87('0x3f')](db['FaxMessage'][_0xdc87('0x40')],function(_0x10cb1c){return{'name':_0x10cb1c[_0xdc87('0x41')],'type':_0x10cb1c[_0xdc87('0x42')]['key']};});_0x3d623[_0xdc87('0x43')]=_[_0xdc87('0x3f')](_0x236b67,'name');_0x3d623[_0xdc87('0x44')]=_[_0xdc87('0x45')](_0x4550b9[_0xdc87('0x44')]);_0x3d623[_0xdc87('0x46')]=_[_0xdc87('0x47')](_0x3d623[_0xdc87('0x43')],_0x3d623[_0xdc87('0x44')]);_0x50cb6c['attributes']=_['intersection'](_0x3d623[_0xdc87('0x43')],qs['fields'](_0x4550b9[_0xdc87('0x44')][_0xdc87('0x48')]));_0x50cb6c[_0xdc87('0x49')]=_0x50cb6c[_0xdc87('0x49')][_0xdc87('0x4a')]?_0x50cb6c[_0xdc87('0x49')]:_0x3d623['model'];if(!_0x4550b9[_0xdc87('0x44')][_0xdc87('0x4b')]('nolimit')){_0x50cb6c['limit']=qs[_0xdc87('0x34')](_0x4550b9[_0xdc87('0x44')][_0xdc87('0x34')]);_0x50cb6c['offset']=qs['offset'](_0x4550b9[_0xdc87('0x44')][_0xdc87('0x32')]);}_0x50cb6c[_0xdc87('0x4c')]=qs['sort'](_0x4550b9[_0xdc87('0x44')][_0xdc87('0x4d')]);_0x50cb6c[_0xdc87('0x4e')]=qs[_0xdc87('0x46')](_['pick'](_0x4550b9[_0xdc87('0x44')],_0x3d623['filters']),_0x236b67);if(_0x4550b9[_0xdc87('0x44')]['filter']){_0x50cb6c['where']=_['merge'](_0x50cb6c[_0xdc87('0x4e')],{'$or':_[_0xdc87('0x3f')](_0x236b67,function(_0x397fbb){if(_0x397fbb[_0xdc87('0x42')]!==_0xdc87('0x4f')){var _0x495011={};_0x495011[_0x397fbb['name']]={'$like':'%'+_0x4550b9[_0xdc87('0x44')]['filter']+'%'};return _0x495011;}})});}_0x50cb6c=_[_0xdc87('0x50')]({},_0x50cb6c,_0x4550b9[_0xdc87('0x51')]);var _0xfdd3a8={'where':_0x50cb6c[_0xdc87('0x4e')]};return db[_0xdc87('0x52')][_0xdc87('0x35')](_0xfdd3a8)[_0xdc87('0x23')](function(_0x50aaf3){_0x306fbc['count']=_0x50aaf3;if(_0x4550b9[_0xdc87('0x44')][_0xdc87('0x53')]){_0x50cb6c[_0xdc87('0x54')]=[{'all':!![]}];}return db[_0xdc87('0x52')][_0xdc87('0x55')](_0x50cb6c);})['then'](function(_0x3fb031){_0x306fbc[_0xdc87('0x56')]=_0x3fb031;return _0x306fbc;})[_0xdc87('0x23')](respondWithFilteredResult(_0xeb98cf,_0x50cb6c))['catch'](handleError(_0xeb98cf,null));};exports[_0xdc87('0x57')]=function(_0x236d27,_0x461238){var _0x54eaf2={'raw':!![],'where':{'id':_0x236d27[_0xdc87('0x58')]['id']}},_0x18a0df={};_0x18a0df[_0xdc87('0x43')]=_[_0xdc87('0x45')](db[_0xdc87('0x52')][_0xdc87('0x40')]);_0x18a0df[_0xdc87('0x44')]=_[_0xdc87('0x45')](_0x236d27[_0xdc87('0x44')]);_0x18a0df[_0xdc87('0x46')]=_[_0xdc87('0x47')](_0x18a0df[_0xdc87('0x43')],_0x18a0df['query']);_0x54eaf2[_0xdc87('0x49')]=_['intersection'](_0x18a0df['model'],qs[_0xdc87('0x48')](_0x236d27[_0xdc87('0x44')][_0xdc87('0x48')]));_0x54eaf2['attributes']=_0x54eaf2[_0xdc87('0x49')][_0xdc87('0x4a')]?_0x54eaf2[_0xdc87('0x49')]:_0x18a0df[_0xdc87('0x43')];if(_0x236d27[_0xdc87('0x44')][_0xdc87('0x53')]){_0x54eaf2['include']=[{'all':!![]}];}_0x54eaf2=_[_0xdc87('0x50')]({},_0x54eaf2,_0x236d27[_0xdc87('0x51')]);return db[_0xdc87('0x52')]['find'](_0x54eaf2)['then'](handleEntityNotFound(_0x461238,null))[_0xdc87('0x23')](respondWithResult(_0x461238,null))['catch'](handleError(_0x461238,null));};exports[_0xdc87('0x39')]=function(_0x4e576e,_0x2c01de){if(_0x4e576e[_0xdc87('0x59')]['id']){delete _0x4e576e['body']['id'];}return db[_0xdc87('0x52')][_0xdc87('0x5a')]({'where':{'id':_0x4e576e[_0xdc87('0x58')]['id']}})[_0xdc87('0x23')](handleEntityNotFound(_0x2c01de,null))[_0xdc87('0x23')](saveUpdates(_0x4e576e[_0xdc87('0x59')],null))['then'](respondWithResult(_0x2c01de,null))['catch'](handleError(_0x2c01de,null));};exports['destroy']=function(_0x4be03c,_0x318e6f){return db[_0xdc87('0x52')][_0xdc87('0x5a')]({'where':{'id':_0x4be03c[_0xdc87('0x58')]['id']}})[_0xdc87('0x23')](handleEntityNotFound(_0x318e6f,null))[_0xdc87('0x23')](removeEntity(_0x318e6f,null))[_0xdc87('0x5b')](handleError(_0x318e6f,null));};exports[_0xdc87('0x5c')]=function(_0x7bff0,_0x49e286){return db[_0xdc87('0x52')][_0xdc87('0x5c')]()['then'](respondWithResult(_0x49e286,null))['catch'](handleError(_0x49e286,null));};var interaction_log=require(_0xdc87('0x13'))(_0xdc87('0x5d'));exports[_0xdc87('0x5e')]=function(_0xcad23e,_0x114d2c,_0x531dbf){var _0x351bc9={'agent':{},'channel':_0xdc87('0x5f')};if(_0xcad23e[_0xdc87('0x59')]['id']){delete _0xcad23e[_0xdc87('0x59')]['id'];}_0xcad23e[_0xdc87('0x59')][_0xdc87('0x60')]=!![];_0xcad23e[_0xdc87('0x59')][_0xdc87('0x61')]=moment()[_0xdc87('0x62')](_0xdc87('0x63'));_0xcad23e[_0xdc87('0x59')][_0xdc87('0x64')]=_0xcad23e[_0xdc87('0x59')][_0xdc87('0x64')]||_0xcad23e['user']['id'];_0x351bc9[_0xdc87('0x65')]['id']=_0xcad23e[_0xdc87('0x59')]['UserId'];return db['FaxMessage'][_0xdc87('0x5a')]({'where':{'id':_0xcad23e[_0xdc87('0x58')]['id'],'UserId':null}})[_0xdc87('0x23')](handleEntityNotFound(_0x114d2c,null))['then'](saveUpdates(_0xcad23e[_0xdc87('0x59')],null))[_0xdc87('0x23')](function(_0x51813b){if(_0x51813b){_0x351bc9['message']=_0x51813b[_0xdc87('0x66')]({'plain':!![]});return db['FaxInteraction'][_0xdc87('0x5a')]({'where':{'id':_0x51813b[_0xdc87('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x114d2c,null))['then'](function(_0xcbd48f){if(_0xcbd48f){return _0xcbd48f[_0xdc87('0x39')]({'UserId':_0xcad23e[_0xdc87('0x59')][_0xdc87('0x64')],'read1stAt':_['isNil'](_0xcbd48f[_0xdc87('0x68')])?moment()[_0xdc87('0x62')](_0xdc87('0x63')):undefined});}return null;})['then'](function(_0x1f3110){if(_0x1f3110){_0x351bc9[_0xdc87('0x69')]=_0x1f3110[_0xdc87('0x66')]({'plain':!![]});interaction_log[_0xdc87('0x24')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xcad23e['user']['id'],_0xcad23e[_0xdc87('0x6a')]['name'],_0xcad23e['user'][_0xdc87('0x6b')],_0x351bc9[_0xdc87('0x69')]['id'],_0xcad23e[_0xdc87('0x59')]?JSON['stringify'](_0xcad23e[_0xdc87('0x59')]):_0xdc87('0x6c'));return respondWithRpcPromise(_0xdc87('0x6d'),_0xdc87('0x6e'),_0x351bc9);}return null;})['then'](function(_0x30d3e7){var _0x4b4305=_0xdc87('0x6f')+_0x30d3e7['message'][_0xdc87('0x70')];return db[_0xdc87('0x71')][_0xdc87('0x44')](_0x4b4305,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xdc87('0x23')](function(_0xc8f9dd){return _0xc8f9dd;});})[_0xdc87('0x23')](function(_0x3d54e9){if(_0x3d54e9){_0x351bc9[_0xdc87('0x2c')][_0xdc87('0x72')]=_0x3d54e9[0x0];if(!_0xcad23e[_0xdc87('0x59')][_0xdc87('0x64')])return;return db[_0xdc87('0x73')][_0xdc87('0x5a')]({'where':{'id':_0xcad23e[_0xdc87('0x59')][_0xdc87('0x64')],'role':_0xdc87('0x65')},'attributes':['id',_0xdc87('0x3c'),'fullname','email',_0xdc87('0x74')],'raw':!![]});}return null;})[_0xdc87('0x23')](function(_0x2da9d3){if(!_0x2da9d3)return null;_0x351bc9['message'][_0xdc87('0x65')]=_0x2da9d3;return _0x351bc9;})[_0xdc87('0x23')](function(_0xd01030){if(_0xd01030){if(_0xcad23e[_0xdc87('0x59')][_0xdc87('0x75')]){_0x351bc9['message']['interface']=util[_0xdc87('0x62')](_0xdc87('0x76'),_0xcad23e[_0xdc87('0x6a')][_0xdc87('0x3c')]);_0x351bc9[_0xdc87('0x2c')]['channel']=_0x351bc9[_0xdc87('0x77')];_0x351bc9['message'][_0xdc87('0x78')]=_0x351bc9[_0xdc87('0x77')];_0x351bc9[_0xdc87('0x2c')][_0xdc87('0x79')]=_0xdc87('0x5e');return respondWithRpcPromise('EventManager',_0xdc87('0x7a'),{'event':_0xdc87('0x7b'),'message':_0x351bc9[_0xdc87('0x2c')]},client9002)[_0xdc87('0x23')](function(){return _0x351bc9;});}return _0x351bc9;}return null;})[_0xdc87('0x23')](respondWithResult(_0x114d2c,null))[_0xdc87('0x5b')](handleError(_0x114d2c,null));};var interaction_log=require(_0xdc87('0x13'))(_0xdc87('0x5d'));exports[_0xdc87('0x38')]=function(_0x139cf6,_0x1b6b0c,_0x18c08b){var _0x4bf4e8={'agent':{},'channel':_0xdc87('0x5f')};if(_0x139cf6['body']['id']){delete _0x139cf6['body']['id'];}_0x139cf6['body']['UserId']=_0x139cf6['body'][_0xdc87('0x64')]||_0x139cf6['user']['id'];_0x4bf4e8[_0xdc87('0x65')]['id']=_0x139cf6[_0xdc87('0x59')][_0xdc87('0x64')];return db[_0xdc87('0x52')][_0xdc87('0x5a')]({'where':{'id':_0x139cf6['params']['id'],'UserId':null}})[_0xdc87('0x23')](handleEntityNotFound(_0x1b6b0c,null))['then'](function(_0x24b8b8){if(_0x24b8b8){_0x4bf4e8[_0xdc87('0x2c')]=_0x24b8b8[_0xdc87('0x66')]({'plain':!![]});return db[_0xdc87('0x7c')][_0xdc87('0x5a')]({'where':{'id':_0x24b8b8[_0xdc87('0x67')]}});}return null;})[_0xdc87('0x23')](handleEntityNotFound(_0x1b6b0c,null))[_0xdc87('0x23')](function(_0x2b7f63){if(_0x2b7f63){_0x4bf4e8[_0xdc87('0x69')]=_0x2b7f63['get']({'plain':!![]});interaction_log[_0xdc87('0x24')](_0xdc87('0x7d'),_0x139cf6[_0xdc87('0x6a')]['id'],_0x139cf6[_0xdc87('0x6a')]['name'],_0x139cf6[_0xdc87('0x6a')][_0xdc87('0x6b')],_0x4bf4e8[_0xdc87('0x69')]['id'],_0x139cf6[_0xdc87('0x59')]?JSON['stringify'](_0x139cf6[_0xdc87('0x59')]):_0xdc87('0x6c'));return respondWithRpcPromise('RejectMessage',_0xdc87('0x7e'),_0x4bf4e8);}return null;})[_0xdc87('0x23')](function(_0x59575a){var _0x41fa7d=_0xdc87('0x6f')+_0x59575a[_0xdc87('0x2c')]['ContactId'];return db[_0xdc87('0x71')][_0xdc87('0x44')](_0x41fa7d,{'type':db[_0xdc87('0x7f')][_0xdc87('0x80')][_0xdc87('0x81')],'raw':!![]})[_0xdc87('0x23')](function(_0x4ab167){return _0x4ab167;});})[_0xdc87('0x23')](function(_0x496750){if(_0x496750){_0x4bf4e8[_0xdc87('0x2c')]['contact']=_0x496750[0x0];if(!_0x139cf6['body'][_0xdc87('0x64')])return;return db['User'][_0xdc87('0x5a')]({'where':{'id':_0x139cf6[_0xdc87('0x59')][_0xdc87('0x64')],'role':_0xdc87('0x65')},'attributes':['id','name',_0xdc87('0x82'),'email',_0xdc87('0x74')],'raw':!![]});}return null;})['then'](function(_0x263fe2){if(!_0x263fe2)return null;_0x4bf4e8['message']['agent']=_0x263fe2;return _0x4bf4e8;})[_0xdc87('0x23')](function(_0x220894){if(_0x220894){_0x220894[_0xdc87('0x2c')][_0xdc87('0x83')]=util[_0xdc87('0x62')](_0xdc87('0x76'),_0x139cf6[_0xdc87('0x6a')][_0xdc87('0x3c')]);_0x220894[_0xdc87('0x2c')][_0xdc87('0x77')]=_0x4bf4e8[_0xdc87('0x77')];_0x220894[_0xdc87('0x2c')][_0xdc87('0x78')]=_0x4bf4e8[_0xdc87('0x77')];_0x220894['message'][_0xdc87('0x79')]=_0xdc87('0x38');respondWithRpcPromise(_0xdc87('0x7a'),'EventManager',{'event':_0xdc87('0x84'),'message':_0x220894['message']},client9002);return _0x4bf4e8;}return null;})[_0xdc87('0x23')](respondWithResult(_0x1b6b0c,null))[_0xdc87('0x5b')](handleError(_0x1b6b0c,null));};exports[_0xdc87('0x85')]=function(_0x5bf84a,_0x5c8063){var _0x392314;return db[_0xdc87('0x52')]['create'](_0x5bf84a[_0xdc87('0x59')],{})[_0xdc87('0x23')](function(_0x539d97){_0x392314=_0x539d97;return db[_0xdc87('0x86')][_0xdc87('0x87')]({'where':{'id':_0x392314[_0xdc87('0x70')]}});})[_0xdc87('0x23')](function(_0x259e73){if(_['isNil'](_0x259e73)){return;}else{_0x392314[_0xdc87('0x5f')]=_0x259e73[_0xdc87('0x5f')];return db['Attachment']['findOne']({'where':{'id':_0x392314[_0xdc87('0x88')]}});}})[_0xdc87('0x23')](function(_0x2ce7f9){return respondWithRpcPromise(_0xdc87('0x89'),_0xdc87('0x89'),{'FaxAccountId':_[_0xdc87('0x8a')](_0x5bf84a[_0xdc87('0x59')])?undefined:_0x5bf84a['body']['FaxAccountId'],'path':_['isNil'](_0x2ce7f9)?undefined:util[_0xdc87('0x62')](_0xdc87('0x8b'),_0x2ce7f9[_0xdc87('0x8c')]),'fax':_[_0xdc87('0x8a')](_0x392314[_0xdc87('0x5f')])?undefined:_0x392314[_0xdc87('0x5f')],'AttachmentId':_0x392314[_0xdc87('0x88')]},client9002);})['then'](respondWithResult(_0x5c8063,0xc9))['catch'](handleError(_0x5c8063,null));};exports[_0xdc87('0x8d')]=function(_0x47d809,_0x4c020c){var _0x5c0832=path[_0xdc87('0x8e')](config[_0xdc87('0x8f')],_0xdc87('0x90'),_0xdc87('0x91'),'attachments');return db['FaxMessage'][_0xdc87('0x5a')]({'where':{'id':_0x47d809[_0xdc87('0x58')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0xdc87('0x23')](handleEntityNotFound(_0x4c020c,null))[_0xdc87('0x23')](function(_0x4e0a58){if(_0x4e0a58){return _0x4c020c[_0xdc87('0x8d')](path[_0xdc87('0x8e')](_0x5c0832,_0x4e0a58[_0xdc87('0x92')][_0xdc87('0x8c')]));}})[_0xdc87('0x5b')](handleError(_0x4c020c,null));}; \ No newline at end of file +var _0x7a33=['findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','server','files','download','join','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','set','reject','update','destroy','name','send','map','FaxMessage','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','body','find','params','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','get','FaxInteraction','FaxInteractionId','UserId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','create'];(function(_0x5d2ec1,_0x812619){var _0xbb8e5=function(_0x422c7a){while(--_0x422c7a){_0x5d2ec1['push'](_0x5d2ec1['shift']());}};_0xbb8e5(++_0x812619);}(_0x7a33,0x11e));var _0x37a3=function(_0x2615e1,_0x14ef24){_0x2615e1=_0x2615e1-0x0;var _0x15efb8=_0x7a33[_0x2615e1];return _0x15efb8;};'use strict';var emlformat=require(_0x37a3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x37a3('0x1'));var rp=require(_0x37a3('0x2'));var moment=require(_0x37a3('0x3'));var BPromise=require(_0x37a3('0x4'));var Mustache=require(_0x37a3('0x5'));var util=require(_0x37a3('0x6'));var path=require(_0x37a3('0x7'));var sox=require(_0x37a3('0x8'));var csv=require(_0x37a3('0x9'));var ejs=require(_0x37a3('0xa'));var fs=require('fs');var fs_extra=require(_0x37a3('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x37a3('0xc'));var deskjs=require(_0x37a3('0xd'));var toCsv=require(_0x37a3('0x9'));var querystring=require(_0x37a3('0xe'));var Papa=require(_0x37a3('0xf'));var Redis=require('ioredis');var authService=require(_0x37a3('0x10'));var qs=require(_0x37a3('0x11'));var as=require(_0x37a3('0x12'));var hardwareService=require(_0x37a3('0x13'));var logger=require(_0x37a3('0x14'))(_0x37a3('0x15'));var utils=require(_0x37a3('0x16'));var config=require(_0x37a3('0x17'));var licenseUtil=require(_0x37a3('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x37a3('0x19')],{'host':_0x37a3('0x1a'),'port':0x18eb});var socket=require(_0x37a3('0x1b'))(new Redis(config[_0x37a3('0x19')]));require(_0x37a3('0x1c'))[_0x37a3('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x37a3('0x1e')][_0x37a3('0x1f')]({'port':0x232c});var client9002=jayson[_0x37a3('0x1e')][_0x37a3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4e8d00,_0x41aeac,_0x28899e,_0x2be390){return new BPromise(function(_0x82671b,_0x10c37a){var _0x223198=_0x2be390||client;return _0x223198['request'](_0x4e8d00,_0x28899e)[_0x37a3('0x20')](function(_0xa7d7e3){logger[_0x37a3('0x21')](_0x37a3('0x22'),_0x41aeac,_0x37a3('0x23'));logger[_0x37a3('0x24')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x41aeac,'request\x20sent',JSON[_0x37a3('0x25')](_0xa7d7e3));if(_0xa7d7e3[_0x37a3('0x26')]){if(_0xa7d7e3[_0x37a3('0x26')][_0x37a3('0x27')]===0x1f4){logger['error'](_0x37a3('0x22'),_0x41aeac,_0xa7d7e3[_0x37a3('0x26')][_0x37a3('0x28')]);return _0x10c37a(_0xa7d7e3[_0x37a3('0x26')]['message']);}logger['error'](_0x37a3('0x22'),_0x41aeac,_0xa7d7e3[_0x37a3('0x26')][_0x37a3('0x28')]);return _0x82671b(_0xa7d7e3[_0x37a3('0x26')]['message']);}else{logger['info'](_0x37a3('0x22'),_0x41aeac,_0x37a3('0x23'));_0x82671b(_0xa7d7e3[_0x37a3('0x29')][_0x37a3('0x28')]);}})[_0x37a3('0x2a')](function(_0x550a9f){logger[_0x37a3('0x26')]('FaxMessage,\x20%s,\x20%s',_0x41aeac,_0x550a9f);_0x10c37a(_0x550a9f);});});}function respondWithStatusCode(_0x505130,_0x4f28c8){_0x4f28c8=_0x4f28c8||0xcc;return function(_0x9731d7){if(_0x9731d7){return _0x505130[_0x37a3('0x2b')](_0x4f28c8);}return _0x505130['status'](_0x4f28c8)[_0x37a3('0x2c')]();};}function respondWithResult(_0x887486,_0x1a9aa8){_0x1a9aa8=_0x1a9aa8||0xc8;return function(_0x2e342a){if(_0x2e342a){return _0x887486[_0x37a3('0x2d')](_0x1a9aa8)[_0x37a3('0x2e')](_0x2e342a);}};}function respondWithFilteredResult(_0x5bdc6b,_0x2c285d){return function(_0x387b53){if(_0x387b53){var _0x2781f1=typeof _0x2c285d[_0x37a3('0x2f')]===_0x37a3('0x30')&&typeof _0x2c285d['limit']===_0x37a3('0x30');var _0x35840f=_0x387b53[_0x37a3('0x31')];var _0xce6163=_0x2781f1?0x0:_0x2c285d[_0x37a3('0x2f')];var _0x35f58b=_0x2781f1?_0x387b53['count']:_0x2c285d[_0x37a3('0x2f')]+_0x2c285d['limit'];var _0x49242e;if(_0x35f58b>=_0x35840f){_0x35f58b=_0x35840f;_0x49242e=0xc8;}else{_0x49242e=0xce;}_0x5bdc6b[_0x37a3('0x2d')](_0x49242e);return _0x5bdc6b[_0x37a3('0x32')]('Content-Range',_0xce6163+'-'+_0x35f58b+'/'+_0x35840f)['json'](_0x387b53);}return null;};}function patchUpdates(_0x42fb7c){return function(_0x133731){try{jsonpatch['apply'](_0x133731,_0x42fb7c,!![]);}catch(_0x1dc21e){return BPromise[_0x37a3('0x33')](_0x1dc21e);}return _0x133731['save']();};}function saveUpdates(_0x48bca3,_0x44d252){return function(_0x34854d){if(_0x34854d){return _0x34854d[_0x37a3('0x34')](_0x48bca3)['then'](function(_0x8c3940){return _0x8c3940;});}return null;};}function removeEntity(_0x20c13a,_0x2b4a8d){return function(_0x270420){if(_0x270420){return _0x270420[_0x37a3('0x35')]()[_0x37a3('0x20')](function(){_0x20c13a['status'](0xcc)[_0x37a3('0x2c')]();});}};}function handleEntityNotFound(_0x17d093,_0x509ea6){return function(_0x965222){if(!_0x965222){_0x17d093[_0x37a3('0x2b')](0x194);}return _0x965222;};}function handleError(_0x5e0e7d,_0x3ac51d){_0x3ac51d=_0x3ac51d||0x1f4;return function(_0x5f20ae){logger['error'](_0x5f20ae['stack']);if(_0x5f20ae[_0x37a3('0x36')]){delete _0x5f20ae[_0x37a3('0x36')];}_0x5e0e7d[_0x37a3('0x2d')](_0x3ac51d)[_0x37a3('0x37')](_0x5f20ae);};}exports['index']=function(_0x33767b,_0x5969de){var _0x383b67={},_0x2f957c={},_0x550a00={'count':0x0,'rows':[]};var _0x16dcc3=_[_0x37a3('0x38')](db[_0x37a3('0x39')][_0x37a3('0x3a')],function(_0xb15213){return{'name':_0xb15213['fieldName'],'type':_0xb15213['type'][_0x37a3('0x3b')]};});_0x2f957c[_0x37a3('0x3c')]=_[_0x37a3('0x38')](_0x16dcc3,'name');_0x2f957c[_0x37a3('0x3d')]=_[_0x37a3('0x3e')](_0x33767b[_0x37a3('0x3d')]);_0x2f957c[_0x37a3('0x3f')]=_[_0x37a3('0x40')](_0x2f957c[_0x37a3('0x3c')],_0x2f957c[_0x37a3('0x3d')]);_0x383b67['attributes']=_[_0x37a3('0x40')](_0x2f957c[_0x37a3('0x3c')],qs[_0x37a3('0x41')](_0x33767b['query']['fields']));_0x383b67[_0x37a3('0x42')]=_0x383b67[_0x37a3('0x42')][_0x37a3('0x43')]?_0x383b67['attributes']:_0x2f957c['model'];if(!_0x33767b[_0x37a3('0x3d')]['hasOwnProperty']('nolimit')){_0x383b67[_0x37a3('0x44')]=qs['limit'](_0x33767b[_0x37a3('0x3d')]['limit']);_0x383b67['offset']=qs[_0x37a3('0x2f')](_0x33767b[_0x37a3('0x3d')][_0x37a3('0x2f')]);}_0x383b67[_0x37a3('0x45')]=qs[_0x37a3('0x46')](_0x33767b[_0x37a3('0x3d')][_0x37a3('0x46')]);_0x383b67[_0x37a3('0x47')]=qs[_0x37a3('0x3f')](_[_0x37a3('0x48')](_0x33767b[_0x37a3('0x3d')],_0x2f957c[_0x37a3('0x3f')]),_0x16dcc3);if(_0x33767b[_0x37a3('0x3d')][_0x37a3('0x49')]){_0x383b67[_0x37a3('0x47')]=_[_0x37a3('0x4a')](_0x383b67['where'],{'$or':_['map'](_0x16dcc3,function(_0x4ad2fc){if(_0x4ad2fc['type']!==_0x37a3('0x4b')){var _0x426c40={};_0x426c40[_0x4ad2fc[_0x37a3('0x36')]]={'$like':'%'+_0x33767b[_0x37a3('0x3d')]['filter']+'%'};return _0x426c40;}})});}_0x383b67=_['merge']({},_0x383b67,_0x33767b[_0x37a3('0x4c')]);var _0x282127={'where':_0x383b67['where']};return db[_0x37a3('0x39')][_0x37a3('0x31')](_0x282127)['then'](function(_0x355ade){_0x550a00['count']=_0x355ade;if(_0x33767b['query'][_0x37a3('0x4d')]){_0x383b67[_0x37a3('0x4e')]=[{'all':!![]}];}return db[_0x37a3('0x39')]['findAll'](_0x383b67);})[_0x37a3('0x20')](function(_0x30e0ee){_0x550a00[_0x37a3('0x4f')]=_0x30e0ee;return _0x550a00;})[_0x37a3('0x20')](respondWithFilteredResult(_0x5969de,_0x383b67))[_0x37a3('0x2a')](handleError(_0x5969de,null));};exports[_0x37a3('0x50')]=function(_0x3669d5,_0xd18e98){var _0x342d42={'raw':!![],'where':{'id':_0x3669d5['params']['id']}},_0x4baec1={};_0x4baec1[_0x37a3('0x3c')]=_[_0x37a3('0x3e')](db['FaxMessage']['rawAttributes']);_0x4baec1[_0x37a3('0x3d')]=_[_0x37a3('0x3e')](_0x3669d5[_0x37a3('0x3d')]);_0x4baec1[_0x37a3('0x3f')]=_['intersection'](_0x4baec1[_0x37a3('0x3c')],_0x4baec1[_0x37a3('0x3d')]);_0x342d42[_0x37a3('0x42')]=_[_0x37a3('0x40')](_0x4baec1[_0x37a3('0x3c')],qs[_0x37a3('0x41')](_0x3669d5[_0x37a3('0x3d')][_0x37a3('0x41')]));_0x342d42[_0x37a3('0x42')]=_0x342d42['attributes'][_0x37a3('0x43')]?_0x342d42[_0x37a3('0x42')]:_0x4baec1[_0x37a3('0x3c')];if(_0x3669d5['query'][_0x37a3('0x4d')]){_0x342d42[_0x37a3('0x4e')]=[{'all':!![]}];}_0x342d42=_[_0x37a3('0x4a')]({},_0x342d42,_0x3669d5[_0x37a3('0x4c')]);return db[_0x37a3('0x39')]['find'](_0x342d42)[_0x37a3('0x20')](handleEntityNotFound(_0xd18e98,null))['then'](respondWithResult(_0xd18e98,null))[_0x37a3('0x2a')](handleError(_0xd18e98,null));};exports[_0x37a3('0x34')]=function(_0x5f2f03,_0xa1f873){if(_0x5f2f03['body']['id']){delete _0x5f2f03[_0x37a3('0x51')]['id'];}return db[_0x37a3('0x39')][_0x37a3('0x52')]({'where':{'id':_0x5f2f03['params']['id']}})[_0x37a3('0x20')](handleEntityNotFound(_0xa1f873,null))[_0x37a3('0x20')](saveUpdates(_0x5f2f03[_0x37a3('0x51')],null))[_0x37a3('0x20')](respondWithResult(_0xa1f873,null))[_0x37a3('0x2a')](handleError(_0xa1f873,null));};exports[_0x37a3('0x35')]=function(_0x2fb836,_0x411fdc){return db[_0x37a3('0x39')]['find']({'where':{'id':_0x2fb836[_0x37a3('0x53')]['id']}})[_0x37a3('0x20')](handleEntityNotFound(_0x411fdc,null))[_0x37a3('0x20')](removeEntity(_0x411fdc,null))[_0x37a3('0x2a')](handleError(_0x411fdc,null));};exports[_0x37a3('0x54')]=function(_0xadaf0c,_0x5b977b){return db[_0x37a3('0x39')]['describe']()[_0x37a3('0x20')](respondWithResult(_0x5b977b,null))['catch'](handleError(_0x5b977b,null));};var interaction_log=require('../../config/logger')(_0x37a3('0x55'));exports[_0x37a3('0x56')]=function(_0x9acee8,_0x5316ae,_0x3cf446){var _0xe323f8={'agent':{},'channel':'fax'};if(_0x9acee8['body']['id']){delete _0x9acee8['body']['id'];}_0x9acee8['body'][_0x37a3('0x57')]=!![];_0x9acee8['body'][_0x37a3('0x58')]=moment()[_0x37a3('0x59')](_0x37a3('0x5a'));_0x9acee8[_0x37a3('0x51')]['UserId']=_0x9acee8[_0x37a3('0x51')]['UserId']||_0x9acee8['user']['id'];_0xe323f8[_0x37a3('0x5b')]['id']=_0x9acee8[_0x37a3('0x51')]['UserId'];return db[_0x37a3('0x39')][_0x37a3('0x52')]({'where':{'id':_0x9acee8['params']['id'],'UserId':null}})[_0x37a3('0x20')](handleEntityNotFound(_0x5316ae,null))[_0x37a3('0x20')](saveUpdates(_0x9acee8['body'],null))[_0x37a3('0x20')](function(_0x5bd006){if(_0x5bd006){_0xe323f8[_0x37a3('0x28')]=_0x5bd006[_0x37a3('0x5c')]({'plain':!![]});return db[_0x37a3('0x5d')]['find']({'where':{'id':_0x5bd006[_0x37a3('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x5316ae,null))[_0x37a3('0x20')](function(_0x20a5fd){if(_0x20a5fd){return _0x20a5fd['update']({'UserId':_0x9acee8[_0x37a3('0x51')][_0x37a3('0x5f')],'read1stAt':_['isNil'](_0x20a5fd[_0x37a3('0x60')])?moment()[_0x37a3('0x59')](_0x37a3('0x5a')):undefined});}return null;})[_0x37a3('0x20')](function(_0x29f361){if(_0x29f361){_0xe323f8[_0x37a3('0x61')]=_0x29f361[_0x37a3('0x5c')]({'plain':!![]});interaction_log[_0x37a3('0x21')](_0x37a3('0x62'),_0x9acee8[_0x37a3('0x63')]['id'],_0x9acee8[_0x37a3('0x63')][_0x37a3('0x36')],_0x9acee8[_0x37a3('0x63')][_0x37a3('0x64')],_0xe323f8[_0x37a3('0x61')]['id'],_0x9acee8['body']?JSON[_0x37a3('0x25')](_0x9acee8[_0x37a3('0x51')]):_0x37a3('0x65'));return respondWithRpcPromise(_0x37a3('0x66'),_0x37a3('0x67'),_0xe323f8);}return null;})[_0x37a3('0x20')](function(_0x2ff48c){var _0x21aade=_0x37a3('0x68')+_0x2ff48c[_0x37a3('0x28')][_0x37a3('0x69')];return db[_0x37a3('0x6a')][_0x37a3('0x3d')](_0x21aade,{'type':db[_0x37a3('0x6b')][_0x37a3('0x6c')][_0x37a3('0x6d')],'raw':!![]})['then'](function(_0x4dfa12){return _0x4dfa12;});})[_0x37a3('0x20')](function(_0x53a6d1){if(_0x53a6d1){_0xe323f8[_0x37a3('0x28')]['contact']=_0x53a6d1[0x0];if(!_0x9acee8[_0x37a3('0x51')][_0x37a3('0x5f')])return;return db['User'][_0x37a3('0x52')]({'where':{'id':_0x9acee8[_0x37a3('0x51')]['UserId'],'role':'agent'},'attributes':['id',_0x37a3('0x36'),_0x37a3('0x6e'),_0x37a3('0x6f'),_0x37a3('0x70')],'raw':!![]});}return null;})[_0x37a3('0x20')](function(_0x572954){if(!_0x572954)return null;_0xe323f8[_0x37a3('0x28')][_0x37a3('0x5b')]=_0x572954;return _0xe323f8;})[_0x37a3('0x20')](function(_0x3f0fd5){if(_0x3f0fd5){if(_0x9acee8[_0x37a3('0x51')][_0x37a3('0x71')]){_0xe323f8[_0x37a3('0x28')][_0x37a3('0x72')]=util['format'](_0x37a3('0x73'),_0x9acee8[_0x37a3('0x63')][_0x37a3('0x36')]);_0xe323f8['message']['channel']=_0xe323f8['channel'];_0xe323f8[_0x37a3('0x28')]['motionChannel']=_0xe323f8[_0x37a3('0x74')];_0xe323f8[_0x37a3('0x28')][_0x37a3('0x75')]=_0x37a3('0x56');return respondWithRpcPromise(_0x37a3('0x76'),_0x37a3('0x76'),{'event':_0x37a3('0x77'),'message':_0xe323f8['message']},client9002)[_0x37a3('0x20')](function(){return _0xe323f8;});}return _0xe323f8;}return null;})[_0x37a3('0x20')](respondWithResult(_0x5316ae,null))[_0x37a3('0x2a')](handleError(_0x5316ae,null));};var interaction_log=require(_0x37a3('0x14'))(_0x37a3('0x55'));exports['reject']=function(_0x17fd71,_0x379088,_0x40a041){var _0x33658b={'agent':{},'channel':_0x37a3('0x78')};if(_0x17fd71['body']['id']){delete _0x17fd71[_0x37a3('0x51')]['id'];}_0x17fd71[_0x37a3('0x51')]['UserId']=_0x17fd71['body']['UserId']||_0x17fd71['user']['id'];_0x33658b[_0x37a3('0x5b')]['id']=_0x17fd71['body'][_0x37a3('0x5f')];return db[_0x37a3('0x39')][_0x37a3('0x52')]({'where':{'id':_0x17fd71[_0x37a3('0x53')]['id'],'UserId':null}})[_0x37a3('0x20')](handleEntityNotFound(_0x379088,null))[_0x37a3('0x20')](function(_0x6a722e){if(_0x6a722e){_0x33658b[_0x37a3('0x28')]=_0x6a722e[_0x37a3('0x5c')]({'plain':!![]});return db[_0x37a3('0x5d')][_0x37a3('0x52')]({'where':{'id':_0x6a722e[_0x37a3('0x5e')]}});}return null;})[_0x37a3('0x20')](handleEntityNotFound(_0x379088,null))[_0x37a3('0x20')](function(_0x18e16c){if(_0x18e16c){_0x33658b['interaction']=_0x18e16c['get']({'plain':!![]});interaction_log['info'](_0x37a3('0x79'),_0x17fd71[_0x37a3('0x63')]['id'],_0x17fd71['user']['name'],_0x17fd71[_0x37a3('0x63')][_0x37a3('0x64')],_0x33658b[_0x37a3('0x61')]['id'],_0x17fd71[_0x37a3('0x51')]?JSON[_0x37a3('0x25')](_0x17fd71[_0x37a3('0x51')]):'null');return respondWithRpcPromise('RejectMessage',_0x37a3('0x7a'),_0x33658b);}return null;})[_0x37a3('0x20')](function(_0xd6f182){var _0x119ec8=_0x37a3('0x68')+_0xd6f182[_0x37a3('0x28')]['ContactId'];return db[_0x37a3('0x6a')][_0x37a3('0x3d')](_0x119ec8,{'type':db[_0x37a3('0x6b')][_0x37a3('0x6c')][_0x37a3('0x6d')],'raw':!![]})[_0x37a3('0x20')](function(_0x3e095b){return _0x3e095b;});})[_0x37a3('0x20')](function(_0x257fea){if(_0x257fea){_0x33658b['message'][_0x37a3('0x7b')]=_0x257fea[0x0];if(!_0x17fd71[_0x37a3('0x51')][_0x37a3('0x5f')])return;return db['User'][_0x37a3('0x52')]({'where':{'id':_0x17fd71[_0x37a3('0x51')][_0x37a3('0x5f')],'role':_0x37a3('0x5b')},'attributes':['id','name',_0x37a3('0x6e'),_0x37a3('0x6f'),_0x37a3('0x70')],'raw':!![]});}return null;})['then'](function(_0xfb5565){if(!_0xfb5565)return null;_0x33658b[_0x37a3('0x28')][_0x37a3('0x5b')]=_0xfb5565;return _0x33658b;})[_0x37a3('0x20')](function(_0x3b309b){if(_0x3b309b){_0x3b309b[_0x37a3('0x28')][_0x37a3('0x72')]=util[_0x37a3('0x59')](_0x37a3('0x73'),_0x17fd71[_0x37a3('0x63')][_0x37a3('0x36')]);_0x3b309b[_0x37a3('0x28')][_0x37a3('0x74')]=_0x33658b['channel'];_0x3b309b[_0x37a3('0x28')]['motionChannel']=_0x33658b[_0x37a3('0x74')];_0x3b309b[_0x37a3('0x28')][_0x37a3('0x75')]=_0x37a3('0x33');respondWithRpcPromise(_0x37a3('0x76'),_0x37a3('0x76'),{'event':'rejectmessage','message':_0x3b309b[_0x37a3('0x28')]},client9002);return _0x33658b;}return null;})[_0x37a3('0x20')](respondWithResult(_0x379088,null))['catch'](handleError(_0x379088,null));};exports['create']=function(_0x159967,_0x20f362){var _0x4dcda8;return db['FaxMessage'][_0x37a3('0x7c')](_0x159967[_0x37a3('0x51')],{})['then'](function(_0x5df7f9){_0x4dcda8=_0x5df7f9;return db['CmContact'][_0x37a3('0x7d')]({'where':{'id':_0x4dcda8['ContactId']}});})[_0x37a3('0x20')](function(_0x109f50){if(_[_0x37a3('0x7e')](_0x109f50)){return;}else{_0x4dcda8[_0x37a3('0x78')]=_0x109f50[_0x37a3('0x78')];return db[_0x37a3('0x7f')]['findOne']({'where':{'id':_0x4dcda8[_0x37a3('0x80')]}});}})[_0x37a3('0x20')](function(_0x3d807d){return respondWithRpcPromise(_0x37a3('0x81'),'SendFax',{'FaxAccountId':_[_0x37a3('0x7e')](_0x159967[_0x37a3('0x51')])?undefined:_0x159967[_0x37a3('0x51')][_0x37a3('0x82')],'path':_[_0x37a3('0x7e')](_0x3d807d)?undefined:util[_0x37a3('0x59')](_0x37a3('0x83'),_0x3d807d[_0x37a3('0x84')]),'fax':_['isNil'](_0x4dcda8['fax'])?undefined:_0x4dcda8[_0x37a3('0x78')],'AttachmentId':_0x4dcda8[_0x37a3('0x80')]},client9002);})[_0x37a3('0x20')](respondWithResult(_0x20f362,0xc9))[_0x37a3('0x2a')](handleError(_0x20f362,null));};exports['download']=function(_0x2ab674,_0x1bb2d6){var _0x14e7ad=path['join'](config['root'],_0x37a3('0x85'),_0x37a3('0x86'),'attachments');return db[_0x37a3('0x39')][_0x37a3('0x52')]({'where':{'id':_0x2ab674[_0x37a3('0x53')]['id']},'include':[{'model':db['Attachment'],'as':_0x37a3('0x7f')}]})[_0x37a3('0x20')](handleEntityNotFound(_0x1bb2d6,null))[_0x37a3('0x20')](function(_0x300ee7){if(_0x300ee7){return _0x1bb2d6[_0x37a3('0x87')](path[_0x37a3('0x88')](_0x14e7ad,_0x300ee7[_0x37a3('0x7f')][_0x37a3('0x84')]));}})[_0x37a3('0x2a')](handleError(_0x1bb2d6,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ee69eeb..6ba9a91 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 _0xdb7e=['hook','exports','events','../../mysqldb','FaxMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0xdb7e,0x11a));var _0xedb7=function(_0x54a062,_0x5b0e97){_0x54a062=_0x54a062-0x0;var _0x161783=_0xdb7e[_0x54a062];return _0x161783;};'use strict';var EventEmitter=require(_0xedb7('0x0'));var FaxMessage=require(_0xedb7('0x1'))['db'][_0xedb7('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xedb7('0x3'),'afterUpdate':_0xedb7('0x4'),'afterDestroy':_0xedb7('0x5')};function emitEvent(_0x58fc55){return function(_0x16179a,_0x4130d2,_0x40f048){FaxMessageEvents[_0xedb7('0x6')](_0x58fc55+':'+_0x16179a['id'],_0x16179a);FaxMessageEvents[_0xedb7('0x6')](_0x58fc55,_0x16179a);_0x40f048(null);};}for(var e in events){if(events[_0xedb7('0x7')](e)){var event=events[e];FaxMessage[_0xedb7('0x8')](e,emitEvent(event));}}module[_0xedb7('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x855f=['remove','emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0x855f,0x145));var _0xf855=function(_0x2a5ebe,_0x386556){_0x2a5ebe=_0x2a5ebe-0x0;var _0x221517=_0x855f[_0x2a5ebe];return _0x221517;};'use strict';var EventEmitter=require(_0xf855('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xf855('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xf855('0x2')](0x0);var events={'afterCreate':_0xf855('0x3'),'afterUpdate':_0xf855('0x4'),'afterDestroy':_0xf855('0x5')};function emitEvent(_0x5046aa){return function(_0x4620ba,_0x33ad4f,_0x4887c0){FaxMessageEvents['emit'](_0x5046aa+':'+_0x4620ba['id'],_0x4620ba);FaxMessageEvents[_0xf855('0x6')](_0x5046aa,_0x4620ba);_0x4887c0(null);};}for(var e in events){if(events[_0xf855('0x7')](e)){var event=events[e];FaxMessage[_0xf855('0x8')](e,emitEvent(event));}}module[_0xf855('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 4e5ab93..6614ab1 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 _0x295b=['exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes'];(function(_0x51722d,_0x2b19be){var _0x579719=function(_0x550787){while(--_0x550787){_0x51722d['push'](_0x51722d['shift']());}};_0x579719(++_0x2b19be);}(_0x295b,0xb6));var _0xb295=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x295b[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xb295('0x0'));var util=require(_0xb295('0x1'));var logger=require(_0xb295('0x2'))(_0xb295('0x3'));var moment=require(_0xb295('0x4'));var BPromise=require(_0xb295('0x5'));var rp=require(_0xb295('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb295('0x7'));var config=require(_0xb295('0x8'));var attributes=require(_0xb295('0x9'));module[_0xb295('0xa')]=function(_0x7aad46,_0x58fd81){return _0x7aad46[_0xb295('0xb')](_0xb295('0xc'),attributes,{'tableName':_0xb295('0xd'),'paranoid':![],'indexes':[{'name':_0xb295('0xe'),'fields':[_0xb295('0xf')],'type':_0xb295('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53f033,_0x300aaa,_0x172e36){var _0x815497=_0x7aad46[_0xb295('0x11')];var _0x2a5ad2=_0x53f033['get']({'plain':!![]});if(_0x2a5ad2[_0xb295('0x12')][_0xb295('0x13')]()==='in'||_0x2a5ad2[_0xb295('0x12')][_0xb295('0x13')]()===_0xb295('0x14')&&!_0x2a5ad2[_0xb295('0x15')]&&!_['isNil'](_0x2a5ad2[_0xb295('0x16')])){_0x815497[_0xb295('0x17')][_0xb295('0x18')]({'where':{'id':_0x2a5ad2[_0xb295('0x19')]}})[_0xb295('0x1a')](function(_0x3b2d35){if(_0x3b2d35){_0x3b2d35[_0xb295('0x1b')]({'lastMsgAt':_0x2a5ad2[_0xb295('0x1c')],'lastMsgDirection':_0x2a5ad2[_0xb295('0x12')][_0xb295('0x13')]()});}})[_0xb295('0x1d')](function(_0x3833b6){console['error'](_0x3833b6);});}_0x172e36();}},'charset':_0xb295('0x1e'),'collate':_0xb295('0x1f')});}; \ No newline at end of file +var _0xb3c1=['FaxInteractionId','then','update','createdAt','catch','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x2c6a71,_0x245a2b){var _0x2d8e58=function(_0x3a811a){while(--_0x3a811a){_0x2c6a71['push'](_0x2c6a71['shift']());}};_0x2d8e58(++_0x245a2b);}(_0xb3c1,0xa7));var _0x1b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1b3c('0x0'));var util=require(_0x1b3c('0x1'));var logger=require(_0x1b3c('0x2'))(_0x1b3c('0x3'));var moment=require('moment');var BPromise=require(_0x1b3c('0x4'));var rp=require(_0x1b3c('0x5'));var fs=require('fs');var path=require(_0x1b3c('0x6'));var rimraf=require(_0x1b3c('0x7'));var config=require('../../config/environment');var attributes=require(_0x1b3c('0x8'));module[_0x1b3c('0x9')]=function(_0x52c83d,_0x24859c){return _0x52c83d[_0x1b3c('0xa')](_0x1b3c('0xb'),attributes,{'tableName':_0x1b3c('0xc'),'paranoid':![],'indexes':[{'name':_0x1b3c('0xd'),'fields':['body'],'type':_0x1b3c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ba39b,_0x5bf1c8,_0x48fc89){var _0x596547=_0x52c83d[_0x1b3c('0xf')];var _0x2f557a=_0x2ba39b[_0x1b3c('0x10')]({'plain':!![]});if(_0x2f557a[_0x1b3c('0x11')][_0x1b3c('0x12')]()==='in'||_0x2f557a[_0x1b3c('0x11')][_0x1b3c('0x12')]()===_0x1b3c('0x13')&&!_0x2f557a[_0x1b3c('0x14')]&&!_[_0x1b3c('0x15')](_0x2f557a['UserId'])){_0x596547['FaxInteraction']['findOne']({'where':{'id':_0x2f557a[_0x1b3c('0x16')]}})[_0x1b3c('0x17')](function(_0x4dc0ab){if(_0x4dc0ab){_0x4dc0ab[_0x1b3c('0x18')]({'lastMsgAt':_0x2f557a[_0x1b3c('0x19')],'lastMsgDirection':_0x2f557a[_0x1b3c('0x11')]['toLowerCase']()});}})[_0x1b3c('0x1a')](function(_0x4a5ae0){console['error'](_0x4a5ae0);});}_0x48fc89();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index daa44b7..b8e3079 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 _0xda55=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','update','where','limit','debug','UpdateFaxMessage','lodash','util'];(function(_0x7fdeea,_0x2e8af1){var _0x4c7bbf=function(_0x261d31){while(--_0x261d31){_0x7fdeea['push'](_0x7fdeea['shift']());}};_0x4c7bbf(++_0x2e8af1);}(_0xda55,0x6d));var _0x5da5=function(_0x38154f,_0xf0d239){_0x38154f=_0x38154f-0x0;var _0x9e29fe=_0xda55[_0x38154f];return _0x9e29fe;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});config[_0x5da5('0x9')]=_[_0x5da5('0xa')](config[_0x5da5('0x9')],{'host':_0x5da5('0xb'),'port':0x18eb});var socket=require(_0x5da5('0xc'))(new Redis(config[_0x5da5('0x9')]));require(_0x5da5('0xd'))[_0x5da5('0xe')](socket);function respondWithRpcPromise(_0x5c056f,_0x3ed24c,_0x1f98a7){return new BPromise(function(_0x2731a3,_0x26fbe3){return client[_0x5da5('0xf')](_0x5c056f,_0x1f98a7)[_0x5da5('0x10')](function(_0x33313e){logger['info'](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));logger['debug'](_0x5da5('0x13'),_0x3ed24c,_0x5da5('0x12'),JSON[_0x5da5('0x14')](_0x33313e));if(_0x33313e[_0x5da5('0x15')]){if(_0x33313e[_0x5da5('0x15')][_0x5da5('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3ed24c,_0x33313e['error'][_0x5da5('0x17')]);return _0x26fbe3(_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);}logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);return _0x2731a3(_0x33313e['error'][_0x5da5('0x17')]);}else{logger[_0x5da5('0x18')](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));_0x2731a3(_0x33313e[_0x5da5('0x19')][_0x5da5('0x17')]);}})['catch'](function(_0x1920e2){logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x1920e2);_0x26fbe3(_0x1920e2);});});}exports[_0x5da5('0x1a')]=function(_0xf023af){var _0x513a34=this;return new Promise(function(_0x4393d7,_0x3372fc){return db[_0x5da5('0x1b')]['create'](_0xf023af[_0x5da5('0x1c')],{'raw':_0xf023af[_0x5da5('0x1d')]?_0xf023af[_0x5da5('0x1d')][_0x5da5('0x1e')]===undefined?!![]:![]:!![]})[_0x5da5('0x10')](function(_0x436960){logger['info'](_0x5da5('0x1a'),_0xf023af);logger['debug'](_0x5da5('0x1a'),_0xf023af,JSON[_0x5da5('0x14')](_0x436960));_0x4393d7(_0x436960);})[_0x5da5('0x1f')](function(_0x5d983c){logger[_0x5da5('0x15')](_0x5da5('0x1a'),_0x5d983c[_0x5da5('0x17')],_0xf023af);_0x3372fc(_0x513a34[_0x5da5('0x15')](0x1f4,_0x5d983c['message']));});});};exports['UpdateFaxMessage']=function(_0x50aadc){var _0x3526cf=this;return new Promise(function(_0x56d509,_0x4e8890){return db[_0x5da5('0x1b')][_0x5da5('0x20')](_0x50aadc['body'],{'raw':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x21')]||null:null,'attributes':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['attributes']||null:null,'limit':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x22')]||null:null})[_0x5da5('0x10')](function(_0x55e2bf){logger['info']('UpdateFaxMessage',_0x50aadc);logger[_0x5da5('0x23')](_0x5da5('0x24'),_0x50aadc,JSON[_0x5da5('0x14')](_0x55e2bf));_0x56d509(_0x55e2bf);})[_0x5da5('0x1f')](function(_0x51b712){logger['error'](_0x5da5('0x24'),_0x51b712['message'],_0x50aadc);_0x4e8890(_0x3526cf['error'](0x1f4,_0x51b712[_0x5da5('0x17')]));});});}; \ No newline at end of file +var _0x4ea3=['message','result','catch','body','options','CreateFaxMessage','update','where','attributes','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x442214,_0x3a869f){var _0x2bddf9=function(_0x34b9c7){while(--_0x34b9c7){_0x442214['push'](_0x442214['shift']());}};_0x2bddf9(++_0x3a869f);}(_0x4ea3,0x70));var _0x34ea=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4ea3[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});config[_0x34ea('0xa')]=_[_0x34ea('0xb')](config[_0x34ea('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x34ea('0xc'))(new Redis(config[_0x34ea('0xa')]));require(_0x34ea('0xd'))['register'](socket);function respondWithRpcPromise(_0x301b98,_0xea1be2,_0x5126de){return new BPromise(function(_0x4a76b1,_0x5bd8b6){return client[_0x34ea('0xe')](_0x301b98,_0x5126de)[_0x34ea('0xf')](function(_0x58bb0d){logger[_0x34ea('0x10')](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));logger[_0x34ea('0x13')](_0x34ea('0x14'),_0xea1be2,_0x34ea('0x12'),JSON[_0x34ea('0x15')](_0x58bb0d));if(_0x58bb0d[_0x34ea('0x16')]){if(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x17')]===0x1f4){logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x5bd8b6(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x4a76b1(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}else{logger['info'](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));_0x4a76b1(_0x58bb0d[_0x34ea('0x19')]['message']);}})[_0x34ea('0x1a')](function(_0x1353de){logger[_0x34ea('0x16')](_0x34ea('0x11'),_0xea1be2,_0x1353de);_0x5bd8b6(_0x1353de);});});}exports['CreateFaxMessage']=function(_0x2eea57){var _0x35328c=this;return new Promise(function(_0x287aaa,_0x247ee7){return db['FaxMessage']['create'](_0x2eea57[_0x34ea('0x1b')],{'raw':_0x2eea57[_0x34ea('0x1c')]?_0x2eea57[_0x34ea('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2eafc6){logger[_0x34ea('0x10')](_0x34ea('0x1d'),_0x2eea57);logger[_0x34ea('0x13')](_0x34ea('0x1d'),_0x2eea57,JSON[_0x34ea('0x15')](_0x2eafc6));_0x287aaa(_0x2eafc6);})['catch'](function(_0xf24962){logger[_0x34ea('0x16')](_0x34ea('0x1d'),_0xf24962[_0x34ea('0x18')],_0x2eea57);_0x247ee7(_0x35328c['error'](0x1f4,_0xf24962['message']));});});};exports['UpdateFaxMessage']=function(_0x142709){var _0x187306=this;return new Promise(function(_0x37c214,_0x4204d7){return db['FaxMessage'][_0x34ea('0x1e')](_0x142709[_0x34ea('0x1b')],{'raw':_0x142709[_0x34ea('0x1c')]?_0x142709['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x142709['options']?_0x142709['options'][_0x34ea('0x1f')]||null:null,'attributes':_0x142709[_0x34ea('0x1c')]?_0x142709[_0x34ea('0x1c')][_0x34ea('0x20')]||null:null,'limit':_0x142709['options']?_0x142709[_0x34ea('0x1c')]['limit']||null:null})[_0x34ea('0xf')](function(_0x4f2b77){logger[_0x34ea('0x10')](_0x34ea('0x21'),_0x142709);logger[_0x34ea('0x13')]('UpdateFaxMessage',_0x142709,JSON[_0x34ea('0x15')](_0x4f2b77));_0x37c214(_0x4f2b77);})[_0x34ea('0x1a')](function(_0x55c8ba){logger[_0x34ea('0x16')]('UpdateFaxMessage',_0x55c8ba[_0x34ea('0x18')],_0x142709);_0x4204d7(_0x187306[_0x34ea('0x16')](0x1f4,_0x55c8ba[_0x34ea('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 905f1b2..408714d 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 _0x9172=['update','emit','removeListener','register','length','faxMessage:','./faxMessage.events','save'];(function(_0xc07b1e,_0x41559a){var _0x38bf62=function(_0x525f26){while(--_0x525f26){_0xc07b1e['push'](_0xc07b1e['shift']());}};_0x38bf62(++_0x41559a);}(_0x9172,0x19e));var _0x2917=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x9172[_0x49b207];return _0x2dc8fa;};'use strict';var FaxMessageEvents=require(_0x2917('0x0'));var events=[_0x2917('0x1'),'remove',_0x2917('0x2')];function createListener(_0x4c4ccb,_0x3f6e15){return function(_0x2e2bc1){_0x3f6e15[_0x2917('0x3')](_0x4c4ccb,_0x2e2bc1);};}function removeListener(_0x577416,_0x24f059){return function(){FaxMessageEvents[_0x2917('0x4')](_0x577416,_0x24f059);};}exports[_0x2917('0x5')]=function(_0x596251){for(var _0x371b85=0x0,_0x40c305=events[_0x2917('0x6')];_0x371b85<_0x40c305;_0x371b85++){var _0xfd38dc=events[_0x371b85];var _0x2a57a4=createListener(_0x2917('0x7')+_0xfd38dc,_0x596251);FaxMessageEvents['on'](_0xfd38dc,_0x2a57a4);}}; \ No newline at end of file +var _0x1601=['./faxMessage.events','save','remove','update','emit','register','faxMessage:'];(function(_0x28d23b,_0x145cbf){var _0x910bf0=function(_0x555de7){while(--_0x555de7){_0x28d23b['push'](_0x28d23b['shift']());}};_0x910bf0(++_0x145cbf);}(_0x1601,0xbd));var _0x1160=function(_0x348e46,_0x5187dc){_0x348e46=_0x348e46-0x0;var _0x58b74f=_0x1601[_0x348e46];return _0x58b74f;};'use strict';var FaxMessageEvents=require(_0x1160('0x0'));var events=[_0x1160('0x1'),_0x1160('0x2'),_0x1160('0x3')];function createListener(_0x5ea87b,_0x4d8cab){return function(_0x3de1c5){_0x4d8cab[_0x1160('0x4')](_0x5ea87b,_0x3de1c5);};}function removeListener(_0x3c161f,_0x4a092f){return function(){FaxMessageEvents['removeListener'](_0x3c161f,_0x4a092f);};}exports[_0x1160('0x5')]=function(_0x24e404){for(var _0xb2ef24=0x0,_0x1f7319=events['length'];_0xb2ef24<_0x1f7319;_0xb2ef24++){var _0x54db4a=events[_0xb2ef24];var _0x18ab66=createListener(_0x1160('0x6')+_0x54db4a,_0x24e404);FaxMessageEvents['on'](_0x54db4a,_0x18ab66);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 861e9af..5daf701 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 _0x6c76=['path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x6c76,0x184));var _0x66c7=function(_0x1998f1,_0x31fda2){_0x1998f1=_0x1998f1-0x0;var _0x25e0ba=_0x6c76[_0x1998f1];return _0x25e0ba;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./faxMessage.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0x7')](_0x66c7('0xc'),auth[_0x66c7('0x8')](),controller['download']);router[_0x66c7('0xd')]('/',auth[_0x66c7('0x8')](),interaction[_0x66c7('0xe')](_0x66c7('0xf'),_0x66c7('0x10')),controller[_0x66c7('0x11')]);router[_0x66c7('0x12')]('/:id',auth[_0x66c7('0x8')](),controller[_0x66c7('0x13')]);router[_0x66c7('0x12')](_0x66c7('0x14'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x15')]);router[_0x66c7('0x12')](_0x66c7('0x16'),auth[_0x66c7('0x8')](),controller['reject']);router[_0x66c7('0x17')]('/:id',auth[_0x66c7('0x8')](),controller[_0x66c7('0x18')]);module[_0x66c7('0x19')]=router; \ No newline at end of file +var _0x4ded=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','download','fax','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x165514,_0x1b2758){var _0x44a5e0=function(_0x2ad624){while(--_0x2ad624){_0x165514['push'](_0x165514['shift']());}};_0x44a5e0(++_0x1b2758);}(_0x4ded,0x116));var _0xd4de=function(_0x3e8f45,_0x17059f){_0x3e8f45=_0x3e8f45-0x0;var _0x362216=_0x4ded[_0x3e8f45];return _0x362216;};'use strict';var multer=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var path=require(_0xd4de('0x2'));var timeout=require(_0xd4de('0x3'));var express=require(_0xd4de('0x4'));var router=express[_0xd4de('0x5')]();var fs_extra=require(_0xd4de('0x6'));var auth=require(_0xd4de('0x7'));var interaction=require(_0xd4de('0x8'));var config=require(_0xd4de('0x9'));var controller=require(_0xd4de('0xa'));router[_0xd4de('0xb')]('/',auth['isAuthenticated'](),controller[_0xd4de('0xc')]);router[_0xd4de('0xb')](_0xd4de('0xd'),auth[_0xd4de('0xe')](),controller[_0xd4de('0xf')]);router[_0xd4de('0xb')]('/:id',auth[_0xd4de('0xe')](),controller['show']);router['get']('/:id/download',auth[_0xd4de('0xe')](),controller[_0xd4de('0x10')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xd4de('0x11'),'faxmessage:create'),controller[_0xd4de('0x12')]);router[_0xd4de('0x13')](_0xd4de('0x14'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x15')]);router[_0xd4de('0x13')](_0xd4de('0x16'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x17')]);router[_0xd4de('0x13')](_0xd4de('0x18'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x19')]);router[_0xd4de('0x1a')](_0xd4de('0x14'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 02f8fc6..6f8a658 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 _0x6d7a=['INTEGER','sequelize','exports','STRING','name','ENUM','beepall','roundrobin'];(function(_0x2f2c16,_0x1e1168){var _0xfbf11b=function(_0x59609f){while(--_0x59609f){_0x2f2c16['push'](_0x2f2c16['shift']());}};_0xfbf11b(++_0x1e1168);}(_0x6d7a,0xd9));var _0xa6d7=function(_0x2d5848,_0x37a517){_0x2d5848=_0x2d5848-0x0;var _0x475c4b=_0x6d7a[_0x2d5848];return _0x475c4b;};'use strict';var Sequelize=require(_0xa6d7('0x0'));module[_0xa6d7('0x1')]={'name':{'type':Sequelize[_0xa6d7('0x2')],'unique':_0xa6d7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa6d7('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa6d7('0x4')]('rrmemory',_0xa6d7('0x5'),_0xa6d7('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa6d7('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0a9a=['rrmemory','beepall','roundrobin','sequelize','INTEGER','ENUM'];(function(_0x660f86,_0x49283f){var _0x4e1ac8=function(_0x3620f9){while(--_0x3620f9){_0x660f86['push'](_0x660f86['shift']());}};_0x4e1ac8(++_0x49283f);}(_0x0a9a,0x1a7));var _0xa0a9=function(_0xcf5cf4,_0x4158d8){_0xcf5cf4=_0xcf5cf4-0x0;var _0xf79146=_0x0a9a[_0xcf5cf4];return _0xf79146;};'use strict';var Sequelize=require(_0xa0a9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa0a9('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa0a9('0x2')](_0xa0a9('0x3'),_0xa0a9('0x4'),_0xa0a9('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa0a9('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 4950682..b7e8ad2 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 _0x5496=['limit','undefined','count','offset','set','update','then','get','FaxQueues','UserProfileResource','error','stack','name','index','FaxQueue','rawAttributes','fieldName','type','key','getOptions','findAll','rows','catch','show','params','model','keys','filters','query','attributes','fields','includeAll','include','merge','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','destroy','describe','getMembers','findOne','UserFaxQueue','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','FaxQueueId','filter','User','findAndCountAll','map','UserId','faxPause','createdAt','format','SIP','updatedAt','getTeams','ids','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','Team','Agents','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json'];(function(_0x245c4f,_0x34b70f){var _0x3157a1=function(_0x18bfc7){while(--_0x18bfc7){_0x245c4f['push'](_0x245c4f['shift']());}};_0x3157a1(++_0x34b70f);}(_0x5496,0x175));var _0x6549=function(_0x20ddc1,_0x5c0e51){_0x20ddc1=_0x20ddc1-0x0;var _0x37f43c=_0x5496[_0x20ddc1];return _0x37f43c;};'use strict';var BPromise=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var _=require(_0x6549('0x2'));var squel=require(_0x6549('0x3'));var Redis=require(_0x6549('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x6549('0x5'))('api');var config=require(_0x6549('0x6'));var db=require(_0x6549('0x7'))['db'];config[_0x6549('0x8')]=_['defaults'](config['redis'],{'host':_0x6549('0x9'),'port':0x18eb});var socket=require(_0x6549('0xa'))(new Redis(config['redis']));require(_0x6549('0xb'))[_0x6549('0xc')](socket);function respondWithStatusCode(_0x1ef2a6,_0x5c47ba){_0x5c47ba=_0x5c47ba||0xcc;return function(_0xa12086){if(_0xa12086){return _0x1ef2a6[_0x6549('0xd')](_0x5c47ba);}return _0x1ef2a6[_0x6549('0xe')](_0x5c47ba)[_0x6549('0xf')]();};}function respondWithResult(_0x1e5083,_0x3e08a6){_0x3e08a6=_0x3e08a6||0xc8;return function(_0x50fa35){if(_0x50fa35){return _0x1e5083['status'](_0x3e08a6)[_0x6549('0x10')](_0x50fa35);}};}function respondWithFilteredResult(_0xac828c,_0x3c5f9b){return function(_0x216620){if(_0x216620){var _0x1a0f72=typeof _0x3c5f9b['offset']==='undefined'&&typeof _0x3c5f9b[_0x6549('0x11')]===_0x6549('0x12');var _0x57a149=_0x216620[_0x6549('0x13')];var _0x150fc8=_0x1a0f72?0x0:_0x3c5f9b[_0x6549('0x14')];var _0x12b068=_0x1a0f72?_0x216620[_0x6549('0x13')]:_0x3c5f9b[_0x6549('0x14')]+_0x3c5f9b['limit'];var _0x5db86d;if(_0x12b068>=_0x57a149){_0x12b068=_0x57a149;_0x5db86d=0xc8;}else{_0x5db86d=0xce;}_0xac828c[_0x6549('0xe')](_0x5db86d);return _0xac828c[_0x6549('0x15')]('Content-Range',_0x150fc8+'-'+_0x12b068+'/'+_0x57a149)[_0x6549('0x10')](_0x216620);}return null;};}function saveUpdates(_0x67acc0){return function(_0x4608fb){if(_0x4608fb){return _0x4608fb[_0x6549('0x16')](_0x67acc0)[_0x6549('0x17')](function(_0x53b12b){return _0x53b12b;});}return null;};}function removeEntity(_0x5d61a0){return function(_0x26a212){if(_0x26a212){return _0x26a212['destroy']()['then'](function(){var _0x31f8e7=_0x26a212[_0x6549('0x18')]({'plain':!![]});var _0x19c4a6=_0x6549('0x19');return db[_0x6549('0x1a')]['destroy']({'where':{'type':_0x19c4a6,'resourceId':_0x31f8e7['id']}})[_0x6549('0x17')](function(){return _0x26a212;});})['then'](function(){_0x5d61a0[_0x6549('0xe')](0xcc)[_0x6549('0xf')]();});}};}function handleEntityNotFound(_0x3992cf){return function(_0x29c6b3){if(!_0x29c6b3){_0x3992cf[_0x6549('0xd')](0x194);}return _0x29c6b3;};}function handleError(_0x12d547,_0x427b47){_0x427b47=_0x427b47||0x1f4;return function(_0x25bc01){logger[_0x6549('0x1b')](_0x25bc01[_0x6549('0x1c')]);if(_0x25bc01[_0x6549('0x1d')]){delete _0x25bc01[_0x6549('0x1d')];}_0x12d547[_0x6549('0xe')](_0x427b47)['send'](_0x25bc01);};}exports[_0x6549('0x1e')]=function(_0x1bc8db,_0x53bbca){var _0x126967={};var _0x29f89e={'count':0x0,'rows':[]};var _0x3768cb=_['map'](db[_0x6549('0x1f')][_0x6549('0x20')],function(_0x14de1f){return{'name':_0x14de1f[_0x6549('0x21')],'type':_0x14de1f[_0x6549('0x22')][_0x6549('0x23')]};});_0x126967=qs[_0x6549('0x24')](_0x3768cb,_0x1bc8db);var _0xa6c718={'where':_0x126967['where']};return db[_0x6549('0x1f')][_0x6549('0x13')](_0xa6c718)[_0x6549('0x17')](function(_0x4c605c){_0x29f89e[_0x6549('0x13')]=_0x4c605c;_0x126967['include']=qs['include'](_0x1bc8db['query']);return db[_0x6549('0x1f')][_0x6549('0x25')](_0x126967);})['then'](function(_0x30aac6){_0x29f89e[_0x6549('0x26')]=_0x30aac6;return _0x29f89e;})[_0x6549('0x17')](respondWithFilteredResult(_0x53bbca,_0x126967))[_0x6549('0x27')](handleError(_0x53bbca,null));};exports[_0x6549('0x28')]=function(_0xebf799,_0x464adf){var _0x504c42={'raw':!![],'where':{'id':_0xebf799[_0x6549('0x29')]['id']}},_0x1b453c={};_0x1b453c[_0x6549('0x2a')]=_[_0x6549('0x2b')](db[_0x6549('0x1f')][_0x6549('0x20')]);_0x1b453c['query']=_[_0x6549('0x2b')](_0xebf799['query']);_0x1b453c[_0x6549('0x2c')]=_['intersection'](_0x1b453c[_0x6549('0x2a')],_0x1b453c[_0x6549('0x2d')]);_0x504c42[_0x6549('0x2e')]=_['intersection'](_0x1b453c[_0x6549('0x2a')],qs[_0x6549('0x2f')](_0xebf799[_0x6549('0x2d')][_0x6549('0x2f')]));_0x504c42['attributes']=_0x504c42['attributes']['length']?_0x504c42[_0x6549('0x2e')]:_0x1b453c[_0x6549('0x2a')];if(_0xebf799['query'][_0x6549('0x30')]){_0x504c42[_0x6549('0x31')]=[{'all':!![]}];}_0x504c42=_[_0x6549('0x32')]({},_0x504c42,_0xebf799[_0x6549('0x33')]);return db[_0x6549('0x1f')]['find'](_0x504c42)['then'](handleEntityNotFound(_0x464adf,null))[_0x6549('0x17')](respondWithResult(_0x464adf,null))[_0x6549('0x27')](handleError(_0x464adf,null));};exports[_0x6549('0x34')]=function(_0xa79ffb,_0xa96598){return db[_0x6549('0x1f')][_0x6549('0x34')](_0xa79ffb[_0x6549('0x35')],{})[_0x6549('0x17')](function(_0x433fe1){var _0x525f82=_0xa79ffb[_0x6549('0x36')][_0x6549('0x18')]({'plain':!![]});if(!_0x525f82)throw new Error(_0x6549('0x37'));if(_0x525f82[_0x6549('0x38')]===_0x6549('0x36')){var _0x50ee2e=_0x433fe1['get']({'plain':!![]});var _0x4d63ba=_0x6549('0x19');return db[_0x6549('0x39')][_0x6549('0x3a')]({'where':{'name':_0x4d63ba,'userProfileId':_0x525f82[_0x6549('0x3b')]},'raw':!![]})['then'](function(_0x56ce9f){if(_0x56ce9f&&_0x56ce9f[_0x6549('0x3c')]===0x0){return db[_0x6549('0x1a')][_0x6549('0x34')]({'name':_0x50ee2e['name'],'resourceId':_0x50ee2e['id'],'type':_0x56ce9f[_0x6549('0x1d')],'sectionId':_0x56ce9f['id']},{})['then'](function(){return _0x433fe1;});}else{return _0x433fe1;}})[_0x6549('0x27')](function(_0x2ec614){logger[_0x6549('0x1b')](_0x6549('0x3d'),_0x2ec614);throw _0x2ec614;});}return _0x433fe1;})[_0x6549('0x17')](respondWithResult(_0xa96598,0xc9))[_0x6549('0x27')](handleError(_0xa96598,null));};exports[_0x6549('0x16')]=function(_0x4deaab,_0x132625){if(_0x4deaab[_0x6549('0x35')]['id']){delete _0x4deaab[_0x6549('0x35')]['id'];}return db[_0x6549('0x1f')][_0x6549('0x3a')]({'where':{'id':_0x4deaab[_0x6549('0x29')]['id']}})[_0x6549('0x17')](handleEntityNotFound(_0x132625,null))[_0x6549('0x17')](saveUpdates(_0x4deaab[_0x6549('0x35')],null))[_0x6549('0x17')](respondWithResult(_0x132625,null))[_0x6549('0x27')](handleError(_0x132625,null));};exports[_0x6549('0x3e')]=function(_0x2e9931,_0x283cfe){return db[_0x6549('0x1f')][_0x6549('0x3a')]({'where':{'id':_0x2e9931['params']['id']}})[_0x6549('0x17')](handleEntityNotFound(_0x283cfe,null))[_0x6549('0x17')](removeEntity(_0x283cfe,null))[_0x6549('0x27')](handleError(_0x283cfe,null));};exports[_0x6549('0x3f')]=function(_0x52e819,_0x8f03dd){return db['FaxQueue'][_0x6549('0x3f')]()[_0x6549('0x17')](respondWithResult(_0x8f03dd,null))['catch'](handleError(_0x8f03dd,null));};exports[_0x6549('0x40')]=function(_0x2503d5,_0x44e608){var _0x18a751={'raw':!![],'where':{}},_0x168dfb={},_0x595679;return db['FaxQueue'][_0x6549('0x41')]({'where':{'id':_0x2503d5[_0x6549('0x29')]['id']}})[_0x6549('0x17')](handleEntityNotFound(_0x44e608,null))[_0x6549('0x17')](function(_0x1e562b){if(_0x1e562b){_0x595679=_0x1e562b['get']({'plain':!![]});_0x168dfb[_0x6549('0x2a')]=_[_0x6549('0x2b')](db[_0x6549('0x42')][_0x6549('0x20')]);_0x168dfb[_0x6549('0x2d')]=_[_0x6549('0x2b')](_0x2503d5[_0x6549('0x2d')]);_0x168dfb[_0x6549('0x2c')]=_['intersection'](_0x168dfb[_0x6549('0x2a')],_0x168dfb['query']);_0x18a751[_0x6549('0x2e')]=_[_0x6549('0x43')](_0x168dfb[_0x6549('0x2a')],qs['fields'](_0x2503d5[_0x6549('0x2d')][_0x6549('0x2f')]));_0x18a751[_0x6549('0x2e')]=_0x18a751['attributes'][_0x6549('0x44')]?_0x18a751[_0x6549('0x2e')]:_0x168dfb[_0x6549('0x2a')];if(!_0x2503d5[_0x6549('0x2d')][_0x6549('0x45')](_0x6549('0x46'))){_0x18a751['limit']=qs[_0x6549('0x11')](_0x2503d5['query'][_0x6549('0x11')]);_0x18a751[_0x6549('0x14')]=qs[_0x6549('0x14')](_0x2503d5[_0x6549('0x2d')][_0x6549('0x14')]);}_0x18a751[_0x6549('0x47')]=qs[_0x6549('0x48')](_0x2503d5[_0x6549('0x2d')][_0x6549('0x48')]);_0x18a751[_0x6549('0x49')]=qs[_0x6549('0x2c')](_[_0x6549('0x4a')](_0x2503d5['query'],_0x168dfb[_0x6549('0x2c')]));_0x18a751[_0x6549('0x49')][_0x6549('0x4b')]=_0x1e562b['id'];if(_0x2503d5[_0x6549('0x2d')][_0x6549('0x4c')]){_0x18a751[_0x6549('0x49')]=_[_0x6549('0x32')](_0x18a751[_0x6549('0x49')],{'$or':_['map'](_0x18a751[_0x6549('0x2e')],function(_0x46e923){var _0x2b655d={};_0x2b655d[_0x46e923]={'$like':'%'+_0x2503d5[_0x6549('0x2d')][_0x6549('0x4c')]+'%'};return _0x2b655d;})});}_0x18a751=_[_0x6549('0x32')]({},_0x18a751,_0x2503d5[_0x6549('0x33')]);return db[_0x6549('0x42')]['findAll'](_0x18a751);}})[_0x6549('0x17')](function(_0x3b89d0){if(_0x3b89d0){return db[_0x6549('0x4d')][_0x6549('0x4e')]({'where':{'id':_[_0x6549('0x4f')](_0x3b89d0,_0x6549('0x50')),'role':'agent'},'attributes':['id',_0x6549('0x1d'),_0x6549('0x51'),'updatedAt',_0x6549('0x52')]});}})[_0x6549('0x17')](function(_0x2efad1){if(_0x2efad1){return{'count':_0x2efad1['count'],'rows':_[_0x6549('0x4f')](_0x2efad1[_0x6549('0x26')],function(_0x5c05c9){return{'membername':_0x5c05c9[_0x6549('0x1d')],'UserId':_0x5c05c9['id'],'queue_name':_0x595679['name'],'FaxQueueId':_0x595679['id'],'interface':util[_0x6549('0x53')]('%s/%s',_0x6549('0x54'),_0x5c05c9[_0x6549('0x1d')]),'penalty':0x0,'paused':_0x5c05c9[_0x6549('0x51')],'createdAt':_0x5c05c9[_0x6549('0x52')],'updatedAt':_0x5c05c9[_0x6549('0x55')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6549('0x17')](respondWithFilteredResult(_0x44e608,_0x18a751))[_0x6549('0x27')](handleError(_0x44e608,null));};exports[_0x6549('0x56')]=function(_0xed105a,_0x3cfe83){var _0x92adfb={};var _0x2ad9ca={};var _0x50cd18;var _0x2f3fc7;return db['FaxQueue'][_0x6549('0x41')]({'where':{'id':_0xed105a[_0x6549('0x29')]['id']}})['then'](handleEntityNotFound(_0x3cfe83,null))[_0x6549('0x17')](function(_0x8eb1eb){if(_0x8eb1eb){_0x50cd18=_0x8eb1eb;_0x2ad9ca[_0x6549('0x2a')]=_[_0x6549('0x2b')](db['Team'][_0x6549('0x20')]);_0x2ad9ca[_0x6549('0x2d')]=_[_0x6549('0x2b')](_0xed105a[_0x6549('0x2d')]);_0x2ad9ca['filters']=_[_0x6549('0x43')](_0x2ad9ca['model'],_0x2ad9ca[_0x6549('0x2d')]);_0x92adfb[_0x6549('0x2e')]=_[_0x6549('0x43')](_0x2ad9ca[_0x6549('0x2a')],qs[_0x6549('0x2f')](_0xed105a[_0x6549('0x2d')][_0x6549('0x2f')]));_0x92adfb[_0x6549('0x2e')]=_0x92adfb[_0x6549('0x2e')][_0x6549('0x44')]?_0x92adfb['attributes']:_0x2ad9ca[_0x6549('0x2a')];_0x92adfb[_0x6549('0x47')]=qs[_0x6549('0x48')](_0xed105a[_0x6549('0x2d')][_0x6549('0x48')]);_0x92adfb[_0x6549('0x49')]=qs['filters'](_['pick'](_0xed105a[_0x6549('0x2d')],_0x2ad9ca[_0x6549('0x2c')]));if(_0xed105a[_0x6549('0x2d')]['filter']){_0x92adfb[_0x6549('0x49')]=_[_0x6549('0x32')](_0x92adfb['where'],{'$or':_[_0x6549('0x4f')](_0x92adfb[_0x6549('0x2e')],function(_0x46026b){var _0x29604b={};_0x29604b[_0x46026b]={'$like':'%'+_0xed105a[_0x6549('0x2d')][_0x6549('0x4c')]+'%'};return _0x29604b;})});}_0x92adfb=_[_0x6549('0x32')]({},_0x92adfb,_0xed105a[_0x6549('0x33')]);return _0x50cd18['getTeams'](_0x92adfb);}})[_0x6549('0x17')](function(_0x51916f){if(_0x51916f){_0x2f3fc7=_0x51916f[_0x6549('0x44')];if(!_0xed105a[_0x6549('0x2d')]['hasOwnProperty'](_0x6549('0x46'))){_0x92adfb[_0x6549('0x11')]=qs[_0x6549('0x11')](_0xed105a['query'][_0x6549('0x11')]);_0x92adfb[_0x6549('0x14')]=qs[_0x6549('0x14')](_0xed105a[_0x6549('0x2d')][_0x6549('0x14')]);}return _0x50cd18[_0x6549('0x56')](_0x92adfb);}})['then'](function(_0x384237){if(_0x384237){return _0x384237?{'count':_0x2f3fc7,'rows':_0x384237}:null;}})[_0x6549('0x17')](respondWithResult(_0x3cfe83,null))[_0x6549('0x27')](handleError(_0x3cfe83,null));};exports['addTeams']=function(_0x5a860f,_0x4bcd01){var _0x3fb701=_0x5a860f[_0x6549('0x35')][_0x6549('0x57')];return db['Team']['findAll']({'where':{'id':_0x3fb701},'attributes':['id'],'include':[{'model':db[_0x6549('0x4d')],'as':'Agents','attributes':['id',_0x6549('0x1d'),_0x6549('0x58'),_0x6549('0x59'),_0x6549('0x5a')],'raw':!![]}]})[_0x6549('0x17')](function(_0x15b9ba){if(_0x15b9ba){var _0x33c6ab=_['flatMap'](_0x15b9ba,function(_0x2f8c3a){var _0x38b330=_0x2f8c3a[_0x6549('0x18')]({'plain':!![]});return _0x38b330['Agents'];});return db[_0x6549('0x1f')][_0x6549('0x3a')]({'where':{'id':_0x5a860f[_0x6549('0x29')]['id']}})[_0x6549('0x17')](function(_0x3e8252){return db[_0x6549('0x5b')][_0x6549('0x5c')](function(_0x47b135){return _0x3e8252[_0x6549('0x5d')](_0x3fb701,{'transaction':_0x47b135})['then'](function(){return BPromise[_0x6549('0x5e')](_0x33c6ab,function(_0x476b0d){return db[_0x6549('0x42')][_0x6549('0x5f')]({'where':{'UserId':_0x476b0d['id'],'FaxQueueId':_0x5a860f[_0x6549('0x29')]['id']},'transaction':_0x47b135});});})[_0x6549('0x17')](function(){_0x33c6ab[_0x6549('0x60')](function(_0x13696e){socket['emit'](_0x6549('0x61'),{'UserId':_0x13696e['id'],'FaxQueueId':_0x3e8252['id']});});});});});}})[_0x6549('0x17')](respondWithStatusCode(_0x4bcd01,null))[_0x6549('0x27')](handleError(_0x4bcd01,null));};exports[_0x6549('0x62')]=function(_0x1fa3a4,_0x1e1f84){return db[_0x6549('0x63')][_0x6549('0x25')]({'where':{'id':_0x1fa3a4[_0x6549('0x2d')][_0x6549('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6549('0x64'),'attributes':['id'],'raw':!![]}]})[_0x6549('0x17')](handleEntityNotFound(_0x1e1f84,null))[_0x6549('0x17')](function(_0x45dc56){var _0x416657=_[_0x6549('0x4f')](_0x45dc56,'id');var _0x2d6b35=[];var _0x463ab1=[];var _0x12fb24=squel[_0x6549('0x65')]();_0x12fb24[_0x6549('0x66')](_0x6549('0x67'))[_0x6549('0x68')](_0x6549('0x69'),'tq')[_0x6549('0x6a')](_0x6549('0x6b'),'ut',_0x6549('0x6c'))[_0x6549('0x49')]('FaxQueueId\x20=\x20?',_0x1fa3a4[_0x6549('0x29')]['id']);for(var _0x401eb0=0x0;_0x401eb0<_0x45dc56[_0x6549('0x44')];_0x401eb0+=0x1){let _0x35bad6=_0x45dc56[_0x401eb0];for(var _0x371d8a=0x0;_0x371d8a<_0x35bad6[_0x6549('0x64')][_0x6549('0x44')];_0x371d8a+=0x1){let _0x18334c=_0x35bad6[_0x6549('0x64')][_0x371d8a];var _0x1196f9=_0x12fb24[_0x6549('0x6d')]();_0x1196f9[_0x6549('0x49')](_0x6549('0x6e'),_0x18334c['id']);_0x463ab1[_0x6549('0x6f')](db[_0x6549('0x5b')][_0x6549('0x2d')](_0x1196f9[_0x6549('0x70')](),{'type':db['sequelize'][_0x6549('0x71')][_0x6549('0x72')]})[_0x6549('0x17')](function(_0x28f104){if(_0x28f104[_0x6549('0x44')]===0x1){return _0x18334c['id'];}else{var _0x42a47f=_[_0x6549('0x73')](_['map'](_0x28f104,_0x6549('0x74')),function(_0x567414){return _['includes'](_0x416657,_0x567414);});if(_0x42a47f){return _0x18334c['id'];}}}));}}return BPromise[_0x6549('0x75')](_0x463ab1)['then'](function(_0x3e8de9){_0x2d6b35=_(_0x2d6b35)[_0x6549('0x76')](_0x3e8de9)[_0x6549('0x77')]()[_0x6549('0x78')]();return db[_0x6549('0x1f')]['find']({'where':{'id':_0x1fa3a4[_0x6549('0x29')]['id']}})['then'](function(_0xbaf80d){return db[_0x6549('0x5b')][_0x6549('0x5c')](function(_0x5e4788){return _0xbaf80d[_0x6549('0x62')](_0x1fa3a4[_0x6549('0x2d')]['ids'],{'transaction':_0x5e4788})['then'](function(){if(!_[_0x6549('0x79')](_0x2d6b35)){return _0xbaf80d[_0x6549('0x7a')](_0x2d6b35,{'transaction':_0x5e4788});}})[_0x6549('0x17')](function(){_0x2d6b35[_0x6549('0x60')](function(_0x1138d4){socket[_0x6549('0x7b')](_0x6549('0x7c'),{'UserId':_0x1138d4,'FaxQueueId':_0xbaf80d['id']});});});});});});})[_0x6549('0x17')](respondWithStatusCode(_0x1e1f84,null))[_0x6549('0x27')](handleError(_0x1e1f84,null));};exports[_0x6549('0x7d')]=function(_0x28ec97,_0x24fbe8){return db[_0x6549('0x1f')][_0x6549('0x3a')]({'where':{'id':_0x28ec97[_0x6549('0x29')]['id']}})[_0x6549('0x17')](handleEntityNotFound(_0x24fbe8,null))[_0x6549('0x17')](function(_0x3cf7b1){if(_0x3cf7b1){return _0x3cf7b1[_0x6549('0x7d')](_0x28ec97['body']['ids'],_[_0x6549('0x7e')](_0x28ec97[_0x6549('0x35')],[_0x6549('0x57'),'id'])||{})[_0x6549('0x7f')](function(_0x1fccb2){for(var _0x171e14=0x0;_0x171e14<_0x28ec97[_0x6549('0x35')][_0x6549('0x57')][_0x6549('0x44')];_0x171e14+=0x1){socket[_0x6549('0x7b')]('userFaxQueue:save',{'UserId':Number(_0x28ec97['body']['ids'][_0x171e14]),'FaxQueueId':Number(_0x28ec97[_0x6549('0x29')]['id'])});}return _0x1fccb2;});}})[_0x6549('0x17')](respondWithResult(_0x24fbe8,null))[_0x6549('0x27')](handleError(_0x24fbe8,null));};exports[_0x6549('0x7a')]=function(_0x7a1c77,_0x570f56){return db[_0x6549('0x1f')][_0x6549('0x3a')]({'where':{'id':_0x7a1c77[_0x6549('0x29')]['id']}})[_0x6549('0x17')](handleEntityNotFound(_0x570f56,null))[_0x6549('0x17')](function(_0x3be369){if(_0x3be369){return _0x3be369[_0x6549('0x7a')](_0x7a1c77[_0x6549('0x2d')][_0x6549('0x57')])[_0x6549('0x17')](function(){if(_[_0x6549('0x80')](_0x7a1c77['query'][_0x6549('0x57')])){for(var _0x43708a=0x0;_0x43708a<_0x7a1c77[_0x6549('0x2d')][_0x6549('0x57')]['length'];_0x43708a+=0x1){socket[_0x6549('0x7b')](_0x6549('0x7c'),{'UserId':Number(_0x7a1c77[_0x6549('0x2d')][_0x6549('0x57')][_0x43708a]),'FaxQueueId':Number(_0x7a1c77[_0x6549('0x29')]['id'])});}}else{socket[_0x6549('0x7b')](_0x6549('0x7c'),{'UserId':Number(_0x7a1c77[_0x6549('0x2d')][_0x6549('0x57')]),'FaxQueueId':Number(_0x7a1c77['params']['id'])});}});}})[_0x6549('0x17')](respondWithStatusCode(_0x570f56,null))[_0x6549('0x27')](handleError(_0x570f56,null));};exports[_0x6549('0x81')]=function(_0x2cdc8f,_0x50adfa){var _0x5a86d1={};var _0x50b47f={};var _0x144ff9;var _0x4e3b20;return db['FaxQueue'][_0x6549('0x41')]({'where':{'id':_0x2cdc8f['params']['id']}})[_0x6549('0x17')](handleEntityNotFound(_0x50adfa,null))[_0x6549('0x17')](function(_0x423f97){if(_0x423f97){_0x144ff9=_0x423f97;_0x50b47f[_0x6549('0x2a')]=_['keys'](db[_0x6549('0x4d')][_0x6549('0x20')]);_0x50b47f[_0x6549('0x2d')]=_[_0x6549('0x2b')](_0x2cdc8f[_0x6549('0x2d')]);_0x50b47f[_0x6549('0x2c')]=_[_0x6549('0x43')](_0x50b47f[_0x6549('0x2a')],_0x50b47f[_0x6549('0x2d')]);_0x5a86d1['attributes']=_[_0x6549('0x43')](_0x50b47f[_0x6549('0x2a')],qs[_0x6549('0x2f')](_0x2cdc8f[_0x6549('0x2d')]['fields']));_0x5a86d1['attributes']=_0x5a86d1[_0x6549('0x2e')][_0x6549('0x44')]?_0x5a86d1[_0x6549('0x2e')]:_0x50b47f['model'];_0x5a86d1[_0x6549('0x47')]=qs[_0x6549('0x48')](_0x2cdc8f['query'][_0x6549('0x48')]);_0x5a86d1['where']=qs[_0x6549('0x2c')](_['pick'](_0x2cdc8f[_0x6549('0x2d')],_0x50b47f['filters']));if(_0x2cdc8f[_0x6549('0x2d')]['filter']){_0x5a86d1[_0x6549('0x49')]=_[_0x6549('0x32')](_0x5a86d1[_0x6549('0x49')],{'$or':_[_0x6549('0x4f')](_0x5a86d1[_0x6549('0x2e')],function(_0x4cf1dd){var _0x327c01={};_0x327c01[_0x4cf1dd]={'$like':'%'+_0x2cdc8f['query'][_0x6549('0x4c')]+'%'};return _0x327c01;})});}_0x5a86d1=_[_0x6549('0x32')]({},_0x5a86d1,_0x2cdc8f[_0x6549('0x33')]);return _0x144ff9[_0x6549('0x81')](_0x5a86d1);}})['then'](function(_0x57d9c3){if(_0x57d9c3){_0x4e3b20=_0x57d9c3['length'];if(!_0x2cdc8f[_0x6549('0x2d')][_0x6549('0x45')]('nolimit')){_0x5a86d1[_0x6549('0x11')]=qs[_0x6549('0x11')](_0x2cdc8f['query'][_0x6549('0x11')]);_0x5a86d1[_0x6549('0x14')]=qs[_0x6549('0x14')](_0x2cdc8f[_0x6549('0x2d')]['offset']);}return _0x144ff9['getAgents'](_0x5a86d1);}})['then'](function(_0x6ed426){if(_0x6ed426){return _0x6ed426?{'count':_0x4e3b20,'rows':_0x6ed426}:null;}})[_0x6549('0x17')](respondWithResult(_0x50adfa,null))[_0x6549('0x27')](handleError(_0x50adfa,null));}; \ No newline at end of file +var _0x8921=['transaction','each','findOrCreate','forEach','userFaxQueue:save','ids','select','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','emit','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','update','destroy','get','FaxQueues','UserProfileResource','then','error','name','send','map','FaxQueue','rawAttributes','fieldName','type','getOptions','include','findAll','rows','catch','show','params','model','query','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','findOne','keys','hasOwnProperty','nolimit','order','sort','pick','where','FaxQueueId','filter','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','%s/%s','SIP','createdAt','updatedAt','Team','length','getTeams','addTeams','Agents','online','interface','sequelize'];(function(_0x2713a1,_0x3cc8de){var _0x5bd7a5=function(_0x1db877){while(--_0x1db877){_0x2713a1['push'](_0x2713a1['shift']());}};_0x5bd7a5(++_0x3cc8de);}(_0x8921,0x9a));var _0x1892=function(_0xcec75b,_0x1436da){_0xcec75b=_0xcec75b-0x0;var _0x2d2554=_0x8921[_0xcec75b];return _0x2d2554;};'use strict';var BPromise=require(_0x1892('0x0'));var util=require('util');var _=require(_0x1892('0x1'));var squel=require(_0x1892('0x2'));var Redis=require(_0x1892('0x3'));var qs=require(_0x1892('0x4'));var logger=require(_0x1892('0x5'))(_0x1892('0x6'));var config=require(_0x1892('0x7'));var db=require(_0x1892('0x8'))['db'];config[_0x1892('0x9')]=_[_0x1892('0xa')](config[_0x1892('0x9')],{'host':_0x1892('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1892('0x9')]));require(_0x1892('0xc'))[_0x1892('0xd')](socket);function respondWithStatusCode(_0x18d62f,_0x1e8c17){_0x1e8c17=_0x1e8c17||0xcc;return function(_0xb50f8a){if(_0xb50f8a){return _0x18d62f['sendStatus'](_0x1e8c17);}return _0x18d62f[_0x1892('0xe')](_0x1e8c17)[_0x1892('0xf')]();};}function respondWithResult(_0x7435c2,_0x25683b){_0x25683b=_0x25683b||0xc8;return function(_0x1efeed){if(_0x1efeed){return _0x7435c2[_0x1892('0xe')](_0x25683b)[_0x1892('0x10')](_0x1efeed);}};}function respondWithFilteredResult(_0x531383,_0x3b2927){return function(_0x22baab){if(_0x22baab){var _0xe5ef78=typeof _0x3b2927['offset']===_0x1892('0x11')&&typeof _0x3b2927[_0x1892('0x12')]===_0x1892('0x11');var _0x53c709=_0x22baab[_0x1892('0x13')];var _0xeb57f7=_0xe5ef78?0x0:_0x3b2927[_0x1892('0x14')];var _0xf11b26=_0xe5ef78?_0x22baab['count']:_0x3b2927['offset']+_0x3b2927[_0x1892('0x12')];var _0x4b15ec;if(_0xf11b26>=_0x53c709){_0xf11b26=_0x53c709;_0x4b15ec=0xc8;}else{_0x4b15ec=0xce;}_0x531383[_0x1892('0xe')](_0x4b15ec);return _0x531383['set'](_0x1892('0x15'),_0xeb57f7+'-'+_0xf11b26+'/'+_0x53c709)[_0x1892('0x10')](_0x22baab);}return null;};}function saveUpdates(_0x237451){return function(_0x3dc9a4){if(_0x3dc9a4){return _0x3dc9a4[_0x1892('0x16')](_0x237451)['then'](function(_0x5d28fc){return _0x5d28fc;});}return null;};}function removeEntity(_0x349b58){return function(_0x49937d){if(_0x49937d){return _0x49937d[_0x1892('0x17')]()['then'](function(){var _0x11c2e6=_0x49937d[_0x1892('0x18')]({'plain':!![]});var _0x4c2e74=_0x1892('0x19');return db[_0x1892('0x1a')][_0x1892('0x17')]({'where':{'type':_0x4c2e74,'resourceId':_0x11c2e6['id']}})[_0x1892('0x1b')](function(){return _0x49937d;});})['then'](function(){_0x349b58['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5759){return function(_0x1fd123){if(!_0x1fd123){_0x3f5759['sendStatus'](0x194);}return _0x1fd123;};}function handleError(_0xa9a3e0,_0x8fd69a){_0x8fd69a=_0x8fd69a||0x1f4;return function(_0x27a514){logger[_0x1892('0x1c')](_0x27a514['stack']);if(_0x27a514[_0x1892('0x1d')]){delete _0x27a514[_0x1892('0x1d')];}_0xa9a3e0[_0x1892('0xe')](_0x8fd69a)[_0x1892('0x1e')](_0x27a514);};}exports['index']=function(_0x8e9dd4,_0x17ed21){var _0x25cd30={};var _0x38aac3={'count':0x0,'rows':[]};var _0x296c45=_[_0x1892('0x1f')](db[_0x1892('0x20')][_0x1892('0x21')],function(_0x3b6628){return{'name':_0x3b6628[_0x1892('0x22')],'type':_0x3b6628[_0x1892('0x23')]['key']};});_0x25cd30=qs[_0x1892('0x24')](_0x296c45,_0x8e9dd4);var _0x280a18={'where':_0x25cd30['where']};return db[_0x1892('0x20')]['count'](_0x280a18)[_0x1892('0x1b')](function(_0x1ca4db){_0x38aac3[_0x1892('0x13')]=_0x1ca4db;_0x25cd30[_0x1892('0x25')]=qs[_0x1892('0x25')](_0x8e9dd4['query']);return db[_0x1892('0x20')][_0x1892('0x26')](_0x25cd30);})[_0x1892('0x1b')](function(_0x1e3e4c){_0x38aac3[_0x1892('0x27')]=_0x1e3e4c;return _0x38aac3;})[_0x1892('0x1b')](respondWithFilteredResult(_0x17ed21,_0x25cd30))[_0x1892('0x28')](handleError(_0x17ed21,null));};exports[_0x1892('0x29')]=function(_0x6dda79,_0x504ba1){var _0x5f2b7b={'raw':!![],'where':{'id':_0x6dda79[_0x1892('0x2a')]['id']}},_0x49d5d4={};_0x49d5d4[_0x1892('0x2b')]=_['keys'](db['FaxQueue'][_0x1892('0x21')]);_0x49d5d4[_0x1892('0x2c')]=_['keys'](_0x6dda79[_0x1892('0x2c')]);_0x49d5d4[_0x1892('0x2d')]=_[_0x1892('0x2e')](_0x49d5d4[_0x1892('0x2b')],_0x49d5d4['query']);_0x5f2b7b[_0x1892('0x2f')]=_[_0x1892('0x2e')](_0x49d5d4['model'],qs[_0x1892('0x30')](_0x6dda79['query']['fields']));_0x5f2b7b[_0x1892('0x2f')]=_0x5f2b7b[_0x1892('0x2f')]['length']?_0x5f2b7b[_0x1892('0x2f')]:_0x49d5d4[_0x1892('0x2b')];if(_0x6dda79[_0x1892('0x2c')][_0x1892('0x31')]){_0x5f2b7b[_0x1892('0x25')]=[{'all':!![]}];}_0x5f2b7b=_[_0x1892('0x32')]({},_0x5f2b7b,_0x6dda79[_0x1892('0x33')]);return db[_0x1892('0x20')][_0x1892('0x34')](_0x5f2b7b)[_0x1892('0x1b')](handleEntityNotFound(_0x504ba1,null))['then'](respondWithResult(_0x504ba1,null))[_0x1892('0x28')](handleError(_0x504ba1,null));};exports[_0x1892('0x35')]=function(_0x1ac7bd,_0x532134){return db[_0x1892('0x20')][_0x1892('0x35')](_0x1ac7bd[_0x1892('0x36')],{})[_0x1892('0x1b')](function(_0x4b6e29){var _0x1f0f47=_0x1ac7bd[_0x1892('0x37')][_0x1892('0x18')]({'plain':!![]});if(!_0x1f0f47)throw new Error(_0x1892('0x38'));if(_0x1f0f47[_0x1892('0x39')]===_0x1892('0x37')){var _0x2e9b01=_0x4b6e29[_0x1892('0x18')]({'plain':!![]});var _0x13e72c=_0x1892('0x19');return db[_0x1892('0x3a')]['find']({'where':{'name':_0x13e72c,'userProfileId':_0x1f0f47[_0x1892('0x3b')]},'raw':!![]})[_0x1892('0x1b')](function(_0x118bfb){if(_0x118bfb&&_0x118bfb[_0x1892('0x3c')]===0x0){return db[_0x1892('0x1a')][_0x1892('0x35')]({'name':_0x2e9b01[_0x1892('0x1d')],'resourceId':_0x2e9b01['id'],'type':_0x118bfb[_0x1892('0x1d')],'sectionId':_0x118bfb['id']},{})[_0x1892('0x1b')](function(){return _0x4b6e29;});}else{return _0x4b6e29;}})[_0x1892('0x28')](function(_0x2ded54){logger[_0x1892('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ded54);throw _0x2ded54;});}return _0x4b6e29;})['then'](respondWithResult(_0x532134,0xc9))['catch'](handleError(_0x532134,null));};exports['update']=function(_0x53a7cc,_0x17b833){if(_0x53a7cc['body']['id']){delete _0x53a7cc[_0x1892('0x36')]['id'];}return db['FaxQueue'][_0x1892('0x34')]({'where':{'id':_0x53a7cc[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x17b833,null))[_0x1892('0x1b')](saveUpdates(_0x53a7cc[_0x1892('0x36')],null))[_0x1892('0x1b')](respondWithResult(_0x17b833,null))[_0x1892('0x28')](handleError(_0x17b833,null));};exports[_0x1892('0x17')]=function(_0x170ebc,_0x1f5cbd){return db[_0x1892('0x20')][_0x1892('0x34')]({'where':{'id':_0x170ebc[_0x1892('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1f5cbd,null))[_0x1892('0x1b')](removeEntity(_0x1f5cbd,null))['catch'](handleError(_0x1f5cbd,null));};exports['describe']=function(_0x49571,_0x5886cf){return db[_0x1892('0x20')][_0x1892('0x3d')]()[_0x1892('0x1b')](respondWithResult(_0x5886cf,null))[_0x1892('0x28')](handleError(_0x5886cf,null));};exports['getMembers']=function(_0x5f431f,_0x11ab70){var _0x68b91e={'raw':!![],'where':{}},_0x55d78f={},_0xd56892;return db['FaxQueue'][_0x1892('0x3e')]({'where':{'id':_0x5f431f[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x11ab70,null))[_0x1892('0x1b')](function(_0x3f9135){if(_0x3f9135){_0xd56892=_0x3f9135['get']({'plain':!![]});_0x55d78f[_0x1892('0x2b')]=_['keys'](db['UserFaxQueue'][_0x1892('0x21')]);_0x55d78f[_0x1892('0x2c')]=_[_0x1892('0x3f')](_0x5f431f[_0x1892('0x2c')]);_0x55d78f[_0x1892('0x2d')]=_[_0x1892('0x2e')](_0x55d78f[_0x1892('0x2b')],_0x55d78f['query']);_0x68b91e[_0x1892('0x2f')]=_[_0x1892('0x2e')](_0x55d78f[_0x1892('0x2b')],qs[_0x1892('0x30')](_0x5f431f[_0x1892('0x2c')][_0x1892('0x30')]));_0x68b91e['attributes']=_0x68b91e[_0x1892('0x2f')]['length']?_0x68b91e[_0x1892('0x2f')]:_0x55d78f[_0x1892('0x2b')];if(!_0x5f431f['query'][_0x1892('0x40')](_0x1892('0x41'))){_0x68b91e['limit']=qs[_0x1892('0x12')](_0x5f431f[_0x1892('0x2c')]['limit']);_0x68b91e[_0x1892('0x14')]=qs[_0x1892('0x14')](_0x5f431f[_0x1892('0x2c')][_0x1892('0x14')]);}_0x68b91e[_0x1892('0x42')]=qs[_0x1892('0x43')](_0x5f431f[_0x1892('0x2c')][_0x1892('0x43')]);_0x68b91e['where']=qs[_0x1892('0x2d')](_[_0x1892('0x44')](_0x5f431f[_0x1892('0x2c')],_0x55d78f['filters']));_0x68b91e[_0x1892('0x45')][_0x1892('0x46')]=_0x3f9135['id'];if(_0x5f431f['query'][_0x1892('0x47')]){_0x68b91e[_0x1892('0x45')]=_[_0x1892('0x32')](_0x68b91e['where'],{'$or':_[_0x1892('0x1f')](_0x68b91e[_0x1892('0x2f')],function(_0x5c4305){var _0x448304={};_0x448304[_0x5c4305]={'$like':'%'+_0x5f431f['query'][_0x1892('0x47')]+'%'};return _0x448304;})});}_0x68b91e=_[_0x1892('0x32')]({},_0x68b91e,_0x5f431f['options']);return db[_0x1892('0x48')]['findAll'](_0x68b91e);}})[_0x1892('0x1b')](function(_0xc4139c){if(_0xc4139c){return db[_0x1892('0x49')][_0x1892('0x4a')]({'where':{'id':_['map'](_0xc4139c,_0x1892('0x4b')),'role':_0x1892('0x4c')},'attributes':['id',_0x1892('0x1d'),_0x1892('0x4d'),'updatedAt','createdAt']});}})['then'](function(_0x907913){if(_0x907913){return{'count':_0x907913[_0x1892('0x13')],'rows':_[_0x1892('0x1f')](_0x907913[_0x1892('0x27')],function(_0x2af629){return{'membername':_0x2af629[_0x1892('0x1d')],'UserId':_0x2af629['id'],'queue_name':_0xd56892[_0x1892('0x1d')],'FaxQueueId':_0xd56892['id'],'interface':util['format'](_0x1892('0x4e'),_0x1892('0x4f'),_0x2af629['name']),'penalty':0x0,'paused':_0x2af629[_0x1892('0x4d')],'createdAt':_0x2af629[_0x1892('0x50')],'updatedAt':_0x2af629[_0x1892('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1892('0x1b')](respondWithFilteredResult(_0x11ab70,_0x68b91e))[_0x1892('0x28')](handleError(_0x11ab70,null));};exports['getTeams']=function(_0x155b54,_0x4d1e21){var _0x3ad2={};var _0x2e419c={};var _0x16aca4;var _0x56abd;return db['FaxQueue'][_0x1892('0x3e')]({'where':{'id':_0x155b54[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x4d1e21,null))[_0x1892('0x1b')](function(_0x691aaf){if(_0x691aaf){_0x16aca4=_0x691aaf;_0x2e419c['model']=_['keys'](db[_0x1892('0x52')][_0x1892('0x21')]);_0x2e419c[_0x1892('0x2c')]=_[_0x1892('0x3f')](_0x155b54[_0x1892('0x2c')]);_0x2e419c[_0x1892('0x2d')]=_[_0x1892('0x2e')](_0x2e419c['model'],_0x2e419c[_0x1892('0x2c')]);_0x3ad2['attributes']=_['intersection'](_0x2e419c['model'],qs[_0x1892('0x30')](_0x155b54['query']['fields']));_0x3ad2[_0x1892('0x2f')]=_0x3ad2[_0x1892('0x2f')][_0x1892('0x53')]?_0x3ad2[_0x1892('0x2f')]:_0x2e419c[_0x1892('0x2b')];_0x3ad2['order']=qs['sort'](_0x155b54[_0x1892('0x2c')][_0x1892('0x43')]);_0x3ad2['where']=qs[_0x1892('0x2d')](_[_0x1892('0x44')](_0x155b54[_0x1892('0x2c')],_0x2e419c['filters']));if(_0x155b54[_0x1892('0x2c')][_0x1892('0x47')]){_0x3ad2[_0x1892('0x45')]=_[_0x1892('0x32')](_0x3ad2[_0x1892('0x45')],{'$or':_[_0x1892('0x1f')](_0x3ad2[_0x1892('0x2f')],function(_0x4bd538){var _0xa64578={};_0xa64578[_0x4bd538]={'$like':'%'+_0x155b54[_0x1892('0x2c')]['filter']+'%'};return _0xa64578;})});}_0x3ad2=_[_0x1892('0x32')]({},_0x3ad2,_0x155b54['options']);return _0x16aca4['getTeams'](_0x3ad2);}})['then'](function(_0x3be81b){if(_0x3be81b){_0x56abd=_0x3be81b[_0x1892('0x53')];if(!_0x155b54[_0x1892('0x2c')]['hasOwnProperty'](_0x1892('0x41'))){_0x3ad2['limit']=qs[_0x1892('0x12')](_0x155b54[_0x1892('0x2c')][_0x1892('0x12')]);_0x3ad2['offset']=qs['offset'](_0x155b54[_0x1892('0x2c')][_0x1892('0x14')]);}return _0x16aca4[_0x1892('0x54')](_0x3ad2);}})[_0x1892('0x1b')](function(_0x5c1693){if(_0x5c1693){return _0x5c1693?{'count':_0x56abd,'rows':_0x5c1693}:null;}})['then'](respondWithResult(_0x4d1e21,null))[_0x1892('0x28')](handleError(_0x4d1e21,null));};exports[_0x1892('0x55')]=function(_0x3e7b42,_0x4be458){var _0xf976d7=_0x3e7b42[_0x1892('0x36')]['ids'];return db[_0x1892('0x52')][_0x1892('0x26')]({'where':{'id':_0xf976d7},'attributes':['id'],'include':[{'model':db[_0x1892('0x49')],'as':_0x1892('0x56'),'attributes':['id',_0x1892('0x1d'),_0x1892('0x57'),'voicePause',_0x1892('0x58')],'raw':!![]}]})[_0x1892('0x1b')](function(_0x5f1b33){if(_0x5f1b33){var _0x554c2f=_['flatMap'](_0x5f1b33,function(_0x166fd8){var _0x44d0ce=_0x166fd8[_0x1892('0x18')]({'plain':!![]});return _0x44d0ce[_0x1892('0x56')];});return db[_0x1892('0x20')][_0x1892('0x34')]({'where':{'id':_0x3e7b42[_0x1892('0x2a')]['id']}})['then'](function(_0x5a9abe){return db[_0x1892('0x59')][_0x1892('0x5a')](function(_0x4234f2){return _0x5a9abe[_0x1892('0x55')](_0xf976d7,{'transaction':_0x4234f2})[_0x1892('0x1b')](function(){return BPromise[_0x1892('0x5b')](_0x554c2f,function(_0x41dd8d){return db['UserFaxQueue'][_0x1892('0x5c')]({'where':{'UserId':_0x41dd8d['id'],'FaxQueueId':_0x3e7b42['params']['id']},'transaction':_0x4234f2});});})[_0x1892('0x1b')](function(){_0x554c2f[_0x1892('0x5d')](function(_0x453f0d){socket['emit'](_0x1892('0x5e'),{'UserId':_0x453f0d['id'],'FaxQueueId':_0x5a9abe['id']});});});});});}})[_0x1892('0x1b')](respondWithStatusCode(_0x4be458,null))[_0x1892('0x28')](handleError(_0x4be458,null));};exports['removeTeams']=function(_0x572889,_0x4d3122){return db['Team']['findAll']({'where':{'id':_0x572889[_0x1892('0x2c')][_0x1892('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1892('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d3122,null))[_0x1892('0x1b')](function(_0x34c62e){var _0x452ab5=_['map'](_0x34c62e,'id');var _0x464a9a=[];var _0x2dfd9a=[];var _0x211c9c=squel[_0x1892('0x60')]();_0x211c9c['field'](_0x1892('0x61'))['from'](_0x1892('0x62'),'tq')[_0x1892('0x63')]('user_has_teams','ut',_0x1892('0x64'))[_0x1892('0x45')](_0x1892('0x65'),_0x572889[_0x1892('0x2a')]['id']);for(var _0x3059a9=0x0;_0x3059a9<_0x34c62e[_0x1892('0x53')];_0x3059a9+=0x1){let _0x3d7097=_0x34c62e[_0x3059a9];for(var _0x1bf24e=0x0;_0x1bf24e<_0x3d7097['Agents'][_0x1892('0x53')];_0x1bf24e+=0x1){let _0x405cd0=_0x3d7097[_0x1892('0x56')][_0x1bf24e];var _0x5812dc=_0x211c9c[_0x1892('0x66')]();_0x5812dc[_0x1892('0x45')](_0x1892('0x67'),_0x405cd0['id']);_0x2dfd9a[_0x1892('0x68')](db['sequelize'][_0x1892('0x2c')](_0x5812dc[_0x1892('0x69')](),{'type':db[_0x1892('0x59')][_0x1892('0x6a')][_0x1892('0x6b')]})[_0x1892('0x1b')](function(_0x233698){if(_0x233698[_0x1892('0x53')]===0x1){return _0x405cd0['id'];}else{var _0x45ab5d=_[_0x1892('0x6c')](_[_0x1892('0x1f')](_0x233698,_0x1892('0x6d')),function(_0x109e83){return _[_0x1892('0x6e')](_0x452ab5,_0x109e83);});if(_0x45ab5d){return _0x405cd0['id'];}}}));}}return BPromise[_0x1892('0x6f')](_0x2dfd9a)[_0x1892('0x1b')](function(_0x18dd0d){_0x464a9a=_(_0x464a9a)['union'](_0x18dd0d)['compact']()['value']();return db[_0x1892('0x20')][_0x1892('0x34')]({'where':{'id':_0x572889[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](function(_0x251c17){return db['sequelize'][_0x1892('0x5a')](function(_0x426e69){return _0x251c17[_0x1892('0x70')](_0x572889[_0x1892('0x2c')][_0x1892('0x5f')],{'transaction':_0x426e69})[_0x1892('0x1b')](function(){if(!_[_0x1892('0x71')](_0x464a9a)){return _0x251c17['removeAgents'](_0x464a9a,{'transaction':_0x426e69});}})[_0x1892('0x1b')](function(){_0x464a9a[_0x1892('0x5d')](function(_0x585018){socket[_0x1892('0x72')](_0x1892('0x73'),{'UserId':_0x585018,'FaxQueueId':_0x251c17['id']});});});});});});})['then'](respondWithStatusCode(_0x4d3122,null))[_0x1892('0x28')](handleError(_0x4d3122,null));};exports[_0x1892('0x74')]=function(_0x46eb60,_0x43e2fe){return db[_0x1892('0x20')][_0x1892('0x34')]({'where':{'id':_0x46eb60[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x43e2fe,null))[_0x1892('0x1b')](function(_0x12d35d){if(_0x12d35d){return _0x12d35d[_0x1892('0x74')](_0x46eb60['body'][_0x1892('0x5f')],_[_0x1892('0x75')](_0x46eb60[_0x1892('0x36')],[_0x1892('0x5f'),'id'])||{})[_0x1892('0x76')](function(_0x15daa7){for(var _0x41f17f=0x0;_0x41f17f<_0x46eb60[_0x1892('0x36')][_0x1892('0x5f')][_0x1892('0x53')];_0x41f17f+=0x1){socket[_0x1892('0x72')](_0x1892('0x5e'),{'UserId':Number(_0x46eb60[_0x1892('0x36')][_0x1892('0x5f')][_0x41f17f]),'FaxQueueId':Number(_0x46eb60[_0x1892('0x2a')]['id'])});}return _0x15daa7;});}})[_0x1892('0x1b')](respondWithResult(_0x43e2fe,null))[_0x1892('0x28')](handleError(_0x43e2fe,null));};exports[_0x1892('0x77')]=function(_0x22a8ec,_0x1ca156){return db[_0x1892('0x20')][_0x1892('0x34')]({'where':{'id':_0x22a8ec[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x1ca156,null))[_0x1892('0x1b')](function(_0x46221c){if(_0x46221c){return _0x46221c[_0x1892('0x77')](_0x22a8ec[_0x1892('0x2c')][_0x1892('0x5f')])[_0x1892('0x1b')](function(){if(_[_0x1892('0x78')](_0x22a8ec[_0x1892('0x2c')][_0x1892('0x5f')])){for(var _0x55f447=0x0;_0x55f447<_0x22a8ec['query']['ids'][_0x1892('0x53')];_0x55f447+=0x1){socket['emit'](_0x1892('0x73'),{'UserId':Number(_0x22a8ec[_0x1892('0x2c')][_0x1892('0x5f')][_0x55f447]),'FaxQueueId':Number(_0x22a8ec[_0x1892('0x2a')]['id'])});}}else{socket[_0x1892('0x72')](_0x1892('0x73'),{'UserId':Number(_0x22a8ec[_0x1892('0x2c')][_0x1892('0x5f')]),'FaxQueueId':Number(_0x22a8ec['params']['id'])});}});}})[_0x1892('0x1b')](respondWithStatusCode(_0x1ca156,null))[_0x1892('0x28')](handleError(_0x1ca156,null));};exports[_0x1892('0x79')]=function(_0x683898,_0x40feba){var _0x2868fe={};var _0xb1a1b4={};var _0x5485d6;var _0x105d88;return db['FaxQueue'][_0x1892('0x3e')]({'where':{'id':_0x683898['params']['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x40feba,null))[_0x1892('0x1b')](function(_0x4e68ff){if(_0x4e68ff){_0x5485d6=_0x4e68ff;_0xb1a1b4[_0x1892('0x2b')]=_[_0x1892('0x3f')](db[_0x1892('0x49')][_0x1892('0x21')]);_0xb1a1b4[_0x1892('0x2c')]=_[_0x1892('0x3f')](_0x683898['query']);_0xb1a1b4[_0x1892('0x2d')]=_[_0x1892('0x2e')](_0xb1a1b4['model'],_0xb1a1b4['query']);_0x2868fe['attributes']=_[_0x1892('0x2e')](_0xb1a1b4[_0x1892('0x2b')],qs[_0x1892('0x30')](_0x683898[_0x1892('0x2c')][_0x1892('0x30')]));_0x2868fe[_0x1892('0x2f')]=_0x2868fe[_0x1892('0x2f')][_0x1892('0x53')]?_0x2868fe[_0x1892('0x2f')]:_0xb1a1b4['model'];_0x2868fe[_0x1892('0x42')]=qs[_0x1892('0x43')](_0x683898['query'][_0x1892('0x43')]);_0x2868fe[_0x1892('0x45')]=qs[_0x1892('0x2d')](_['pick'](_0x683898[_0x1892('0x2c')],_0xb1a1b4[_0x1892('0x2d')]));if(_0x683898[_0x1892('0x2c')][_0x1892('0x47')]){_0x2868fe[_0x1892('0x45')]=_[_0x1892('0x32')](_0x2868fe[_0x1892('0x45')],{'$or':_[_0x1892('0x1f')](_0x2868fe['attributes'],function(_0x1c78e0){var _0x4d7f03={};_0x4d7f03[_0x1c78e0]={'$like':'%'+_0x683898[_0x1892('0x2c')][_0x1892('0x47')]+'%'};return _0x4d7f03;})});}_0x2868fe=_[_0x1892('0x32')]({},_0x2868fe,_0x683898[_0x1892('0x33')]);return _0x5485d6[_0x1892('0x79')](_0x2868fe);}})['then'](function(_0x301484){if(_0x301484){_0x105d88=_0x301484[_0x1892('0x53')];if(!_0x683898[_0x1892('0x2c')][_0x1892('0x40')](_0x1892('0x41'))){_0x2868fe[_0x1892('0x12')]=qs[_0x1892('0x12')](_0x683898[_0x1892('0x2c')][_0x1892('0x12')]);_0x2868fe[_0x1892('0x14')]=qs[_0x1892('0x14')](_0x683898[_0x1892('0x2c')][_0x1892('0x14')]);}return _0x5485d6[_0x1892('0x79')](_0x2868fe);}})[_0x1892('0x1b')](function(_0x60f292){if(_0x60f292){return _0x60f292?{'count':_0x105d88,'rows':_0x60f292}:null;}})[_0x1892('0x1b')](respondWithResult(_0x40feba,null))['catch'](handleError(_0x40feba,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 914d4c8..f9a60a5 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 _0x66cc=['save','update','remove','emit','hasOwnProperty','exports','FaxQueue','setMaxListeners'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x66cc,0x10e));var _0xc66c=function(_0x2655df,_0x5d9d00){_0x2655df=_0x2655df-0x0;var _0x4f3ebc=_0x66cc[_0x2655df];return _0x4f3ebc;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0xc66c('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xc66c('0x1')](0x0);var events={'afterCreate':_0xc66c('0x2'),'afterUpdate':_0xc66c('0x3'),'afterDestroy':_0xc66c('0x4')};function emitEvent(_0x28f84a){return function(_0x3aa1be,_0x4eda0b,_0x520b4b){FaxQueueEvents[_0xc66c('0x5')](_0x28f84a+':'+_0x3aa1be['id'],_0x3aa1be);FaxQueueEvents[_0xc66c('0x5')](_0x28f84a,_0x3aa1be);_0x520b4b(null);};}for(var e in events){if(events[_0xc66c('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xc66c('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x9a01=['hook','exports','../../mysqldb','FaxQueue','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x4a0480,_0x17582d){var _0x47e240=function(_0x8ad609){while(--_0x8ad609){_0x4a0480['push'](_0x4a0480['shift']());}};_0x47e240(++_0x17582d);}(_0x9a01,0xe2));var _0x19a0=function(_0x1f00b5,_0x94861d){_0x1f00b5=_0x1f00b5-0x0;var _0x1204db=_0x9a01[_0x1f00b5];return _0x1204db;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x19a0('0x0'))['db'][_0x19a0('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x19a0('0x2')](0x0);var events={'afterCreate':_0x19a0('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5daf03){return function(_0x2c1b25,_0x1604fd,_0x4bf651){FaxQueueEvents[_0x19a0('0x4')](_0x5daf03+':'+_0x2c1b25['id'],_0x2c1b25);FaxQueueEvents[_0x19a0('0x4')](_0x5daf03,_0x2c1b25);_0x4bf651(null);};}for(var e in events){if(events[_0x19a0('0x5')](e)){var event=events[e];FaxQueue[_0x19a0('0x6')](e,emitEvent(event));}}module[_0x19a0('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index a63b4fd..67096eb 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 _0xbe3b=['rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0xbe3b,0x1d4));var _0xbbe3=function(_0x3494e8,_0x4111ea){_0x3494e8=_0x3494e8-0x0;var _0x20bd8c=_0xbe3b[_0x3494e8];return _0x20bd8c;};'use strict';var _=require(_0xbbe3('0x0'));var util=require(_0xbbe3('0x1'));var logger=require(_0xbbe3('0x2'))('api');var moment=require(_0xbbe3('0x3'));var BPromise=require(_0xbbe3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbbe3('0x5'));var config=require(_0xbbe3('0x6'));var attributes=require(_0xbbe3('0x7'));module[_0xbbe3('0x8')]=function(_0x5657d1,_0xd75876){return _0x5657d1[_0xbbe3('0x9')]('FaxQueue',attributes,{'tableName':_0xbbe3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb285=['exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x3fd53b,_0x1a3e99){var _0x43d561=function(_0x56f39d){while(--_0x56f39d){_0x3fd53b['push'](_0x3fd53b['shift']());}};_0x43d561(++_0x1a3e99);}(_0xb285,0x1c6));var _0x5b28=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0xb285[_0x4bdf64];return _0x9a1a19;};'use strict';var _=require(_0x5b28('0x0'));var util=require(_0x5b28('0x1'));var logger=require(_0x5b28('0x2'))('api');var moment=require(_0x5b28('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b28('0x4'));var rimraf=require(_0x5b28('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x5b28('0x6')]=function(_0xd0c209,_0x5b842b){return _0xd0c209[_0x5b28('0x7')](_0x5b28('0x8'),attributes,{'tableName':_0x5b28('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 15540af..8d76a83 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 _0x1bed=['./faxQueue.socket','register','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','options','where','attributes','limit','include','map','model','ShowFaxQueue','find','raw','info','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x1bed,0x1d5));var _0xd1be=function(_0x315caa,_0x3e521e){_0x315caa=_0x315caa-0x0;var _0x202b66=_0x1bed[_0x315caa];return _0x202b66;};'use strict';var _=require(_0xd1be('0x0'));var util=require(_0xd1be('0x1'));var moment=require('moment');var BPromise=require(_0xd1be('0x2'));var rs=require(_0xd1be('0x3'));var fs=require('fs');var Redis=require(_0xd1be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1be('0x5'));var logger=require(_0xd1be('0x6'))(_0xd1be('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd1be('0x8')][_0xd1be('0x9')]({'port':0x232a});config[_0xd1be('0xa')]=_['defaults'](config[_0xd1be('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd1be('0xb'))(new Redis(config['redis']));require(_0xd1be('0xc'))[_0xd1be('0xd')](socket);function respondWithRpcPromise(_0xc00e7,_0x3bfab7,_0x409a37){return new BPromise(function(_0x256bb2,_0x551618){return client['request'](_0xc00e7,_0x409a37)[_0xd1be('0xe')](function(_0x3a4587){logger['info'](_0xd1be('0xf'),_0x3bfab7,_0xd1be('0x10'));logger[_0xd1be('0x11')](_0xd1be('0x12'),_0x3bfab7,_0xd1be('0x10'),JSON[_0xd1be('0x13')](_0x3a4587));if(_0x3a4587['error']){if(_0x3a4587[_0xd1be('0x14')]['code']===0x1f4){logger['error'](_0xd1be('0xf'),_0x3bfab7,_0x3a4587[_0xd1be('0x14')][_0xd1be('0x15')]);return _0x551618(_0x3a4587[_0xd1be('0x14')][_0xd1be('0x15')]);}logger[_0xd1be('0x14')](_0xd1be('0xf'),_0x3bfab7,_0x3a4587[_0xd1be('0x14')][_0xd1be('0x15')]);return _0x256bb2(_0x3a4587[_0xd1be('0x14')][_0xd1be('0x15')]);}else{logger['info'](_0xd1be('0xf'),_0x3bfab7,_0xd1be('0x10'));_0x256bb2(_0x3a4587[_0xd1be('0x16')][_0xd1be('0x15')]);}})[_0xd1be('0x17')](function(_0x1d951e){logger[_0xd1be('0x14')](_0xd1be('0xf'),_0x3bfab7,_0x1d951e);_0x551618(_0x1d951e);});});}exports[_0xd1be('0x18')]=function(_0x16ae56){var _0x44f52c=this;return new Promise(function(_0x3ae86f,_0xd03096){return db[_0xd1be('0x19')]['findAll']({'raw':_0x16ae56[_0xd1be('0x1a')]?_0x16ae56[_0xd1be('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x16ae56[_0xd1be('0x1a')]?_0x16ae56[_0xd1be('0x1a')][_0xd1be('0x1b')]||null:null,'attributes':_0x16ae56[_0xd1be('0x1a')]?_0x16ae56[_0xd1be('0x1a')][_0xd1be('0x1c')]||null:null,'limit':_0x16ae56[_0xd1be('0x1a')]?_0x16ae56[_0xd1be('0x1a')][_0xd1be('0x1d')]||null:null,'include':_0x16ae56[_0xd1be('0x1a')]?_0x16ae56[_0xd1be('0x1a')][_0xd1be('0x1e')]?_[_0xd1be('0x1f')](_0x16ae56['options'][_0xd1be('0x1e')],function(_0x25fd55){return{'model':db[_0x25fd55[_0xd1be('0x20')]],'as':_0x25fd55['as'],'attributes':_0x25fd55['attributes'],'include':_0x25fd55['include']?_['map'](_0x25fd55[_0xd1be('0x1e')],function(_0x5e8afe){return{'model':db[_0x5e8afe[_0xd1be('0x20')]],'as':_0x5e8afe['as'],'attributes':_0x5e8afe[_0xd1be('0x1c')],'include':_0x5e8afe['include']?_['map'](_0x5e8afe[_0xd1be('0x1e')],function(_0x89fd67){return{'model':db[_0x89fd67['model']],'as':_0x89fd67['as'],'attributes':_0x89fd67[_0xd1be('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36541c){logger['info'](_0xd1be('0x18'),_0x16ae56);logger[_0xd1be('0x11')]('GetFaxQueue',_0x16ae56,JSON[_0xd1be('0x13')](_0x36541c));_0x3ae86f(_0x36541c);})[_0xd1be('0x17')](function(_0x14b123){logger['error'](_0xd1be('0x18'),_0x14b123[_0xd1be('0x15')],_0x16ae56);_0xd03096(_0x44f52c[_0xd1be('0x14')](0x1f4,_0x14b123[_0xd1be('0x15')]));});});};exports[_0xd1be('0x21')]=function(_0x417fa1){var _0x139215=this;return new Promise(function(_0x53d699,_0x41fc15){return db['FaxQueue'][_0xd1be('0x22')]({'raw':_0x417fa1['options']?_0x417fa1[_0xd1be('0x1a')][_0xd1be('0x23')]===undefined?!![]:![]:!![],'where':_0x417fa1['options']?_0x417fa1[_0xd1be('0x1a')][_0xd1be('0x1b')]||null:null,'attributes':_0x417fa1[_0xd1be('0x1a')]?_0x417fa1[_0xd1be('0x1a')][_0xd1be('0x1c')]||null:null,'include':_0x417fa1['options']?_0x417fa1['options'][_0xd1be('0x1e')]?_[_0xd1be('0x1f')](_0x417fa1['options']['include'],function(_0x31906c){return{'model':db[_0x31906c[_0xd1be('0x20')]],'as':_0x31906c['as'],'attributes':_0x31906c[_0xd1be('0x1c')],'include':_0x31906c['include']?_[_0xd1be('0x1f')](_0x31906c[_0xd1be('0x1e')],function(_0x37c79c){return{'model':db[_0x37c79c[_0xd1be('0x20')]],'as':_0x37c79c['as'],'attributes':_0x37c79c[_0xd1be('0x1c')],'include':_0x37c79c[_0xd1be('0x1e')]?_[_0xd1be('0x1f')](_0x37c79c[_0xd1be('0x1e')],function(_0x3c6626){return{'model':db[_0x3c6626[_0xd1be('0x20')]],'as':_0x3c6626['as'],'attributes':_0x3c6626[_0xd1be('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44d95f){logger[_0xd1be('0x24')](_0xd1be('0x21'),_0x417fa1);logger[_0xd1be('0x11')](_0xd1be('0x21'),_0x417fa1,JSON['stringify'](_0x44d95f));_0x53d699(_0x44d95f);})[_0xd1be('0x17')](function(_0x30ce68){logger[_0xd1be('0x14')](_0xd1be('0x21'),_0x30ce68[_0xd1be('0x15')],_0x417fa1);_0x41fc15(_0x139215[_0xd1be('0x14')](0x1f4,_0x30ce68[_0xd1be('0x15')]));});});}; \ No newline at end of file +var _0xf095=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','FaxQueue','findAll','options','raw','where','attributes','include','map','model','GetFaxQueue','ShowFaxQueue','debug','lodash','util','moment','bluebird','ioredis'];(function(_0x100dea,_0x2ca828){var _0x785cb5=function(_0x1827ec){while(--_0x1827ec){_0x100dea['push'](_0x100dea['shift']());}};_0x785cb5(++_0x2ca828);}(_0xf095,0x163));var _0x5f09=function(_0x1ff7f9,_0x7f4e5d){_0x1ff7f9=_0x1ff7f9-0x0;var _0x42f261=_0xf095[_0x1ff7f9];return _0x42f261;};'use strict';var _=require(_0x5f09('0x0'));var util=require(_0x5f09('0x1'));var moment=require(_0x5f09('0x2'));var BPromise=require(_0x5f09('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f09('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f09('0x5'));var logger=require(_0x5f09('0x6'))(_0x5f09('0x7'));var config=require(_0x5f09('0x8'));var jayson=require(_0x5f09('0x9'));var client=jayson[_0x5f09('0xa')][_0x5f09('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5f09('0xc')],{'host':_0x5f09('0xd'),'port':0x18eb});var socket=require(_0x5f09('0xe'))(new Redis(config[_0x5f09('0xc')]));require(_0x5f09('0xf'))[_0x5f09('0x10')](socket);function respondWithRpcPromise(_0x35666c,_0x39e6be,_0x1f5b7f){return new BPromise(function(_0x4d697c,_0x37e7e0){return client[_0x5f09('0x11')](_0x35666c,_0x1f5b7f)[_0x5f09('0x12')](function(_0x57d2d2){logger['info'](_0x5f09('0x13'),_0x39e6be,_0x5f09('0x14'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x39e6be,'request\x20sent',JSON[_0x5f09('0x15')](_0x57d2d2));if(_0x57d2d2[_0x5f09('0x16')]){if(_0x57d2d2['error'][_0x5f09('0x17')]===0x1f4){logger[_0x5f09('0x16')](_0x5f09('0x13'),_0x39e6be,_0x57d2d2[_0x5f09('0x16')][_0x5f09('0x18')]);return _0x37e7e0(_0x57d2d2[_0x5f09('0x16')][_0x5f09('0x18')]);}logger[_0x5f09('0x16')]('FaxQueue,\x20%s,\x20%s',_0x39e6be,_0x57d2d2['error']['message']);return _0x4d697c(_0x57d2d2[_0x5f09('0x16')]['message']);}else{logger[_0x5f09('0x19')](_0x5f09('0x13'),_0x39e6be,_0x5f09('0x14'));_0x4d697c(_0x57d2d2[_0x5f09('0x1a')][_0x5f09('0x18')]);}})[_0x5f09('0x1b')](function(_0x1d62be){logger['error']('FaxQueue,\x20%s,\x20%s',_0x39e6be,_0x1d62be);_0x37e7e0(_0x1d62be);});});}exports['GetFaxQueue']=function(_0x1aeba3){var _0x2bd56e=this;return new Promise(function(_0x1c1f45,_0x4bacdf){return db[_0x5f09('0x1c')][_0x5f09('0x1d')]({'raw':_0x1aeba3[_0x5f09('0x1e')]?_0x1aeba3[_0x5f09('0x1e')][_0x5f09('0x1f')]===undefined?!![]:![]:!![],'where':_0x1aeba3['options']?_0x1aeba3[_0x5f09('0x1e')][_0x5f09('0x20')]||null:null,'attributes':_0x1aeba3['options']?_0x1aeba3['options'][_0x5f09('0x21')]||null:null,'limit':_0x1aeba3[_0x5f09('0x1e')]?_0x1aeba3[_0x5f09('0x1e')]['limit']||null:null,'include':_0x1aeba3[_0x5f09('0x1e')]?_0x1aeba3[_0x5f09('0x1e')][_0x5f09('0x22')]?_[_0x5f09('0x23')](_0x1aeba3[_0x5f09('0x1e')]['include'],function(_0x396d27){return{'model':db[_0x396d27[_0x5f09('0x24')]],'as':_0x396d27['as'],'attributes':_0x396d27['attributes'],'include':_0x396d27[_0x5f09('0x22')]?_[_0x5f09('0x23')](_0x396d27[_0x5f09('0x22')],function(_0x55d765){return{'model':db[_0x55d765[_0x5f09('0x24')]],'as':_0x55d765['as'],'attributes':_0x55d765[_0x5f09('0x21')],'include':_0x55d765[_0x5f09('0x22')]?_[_0x5f09('0x23')](_0x55d765[_0x5f09('0x22')],function(_0x9bc00f){return{'model':db[_0x9bc00f[_0x5f09('0x24')]],'as':_0x9bc00f['as'],'attributes':_0x9bc00f[_0x5f09('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5f09('0x12')](function(_0x55aaf6){logger['info'](_0x5f09('0x25'),_0x1aeba3);logger['debug'](_0x5f09('0x25'),_0x1aeba3,JSON[_0x5f09('0x15')](_0x55aaf6));_0x1c1f45(_0x55aaf6);})[_0x5f09('0x1b')](function(_0x3d73a3){logger['error']('GetFaxQueue',_0x3d73a3[_0x5f09('0x18')],_0x1aeba3);_0x4bacdf(_0x2bd56e[_0x5f09('0x16')](0x1f4,_0x3d73a3[_0x5f09('0x18')]));});});};exports[_0x5f09('0x26')]=function(_0x1a24ef){var _0x432e10=this;return new Promise(function(_0x314393,_0x15a21f){return db[_0x5f09('0x1c')]['find']({'raw':_0x1a24ef[_0x5f09('0x1e')]?_0x1a24ef[_0x5f09('0x1e')][_0x5f09('0x1f')]===undefined?!![]:![]:!![],'where':_0x1a24ef['options']?_0x1a24ef[_0x5f09('0x1e')]['where']||null:null,'attributes':_0x1a24ef[_0x5f09('0x1e')]?_0x1a24ef[_0x5f09('0x1e')][_0x5f09('0x21')]||null:null,'include':_0x1a24ef[_0x5f09('0x1e')]?_0x1a24ef[_0x5f09('0x1e')][_0x5f09('0x22')]?_[_0x5f09('0x23')](_0x1a24ef[_0x5f09('0x1e')][_0x5f09('0x22')],function(_0x54877d){return{'model':db[_0x54877d[_0x5f09('0x24')]],'as':_0x54877d['as'],'attributes':_0x54877d[_0x5f09('0x21')],'include':_0x54877d['include']?_[_0x5f09('0x23')](_0x54877d[_0x5f09('0x22')],function(_0x67acd7){return{'model':db[_0x67acd7['model']],'as':_0x67acd7['as'],'attributes':_0x67acd7['attributes'],'include':_0x67acd7[_0x5f09('0x22')]?_[_0x5f09('0x23')](_0x67acd7[_0x5f09('0x22')],function(_0x2cb60b){return{'model':db[_0x2cb60b['model']],'as':_0x2cb60b['as'],'attributes':_0x2cb60b[_0x5f09('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5f09('0x12')](function(_0x341977){logger['info'](_0x5f09('0x26'),_0x1a24ef);logger[_0x5f09('0x27')](_0x5f09('0x26'),_0x1a24ef,JSON[_0x5f09('0x15')](_0x341977));_0x314393(_0x341977);})[_0x5f09('0x1b')](function(_0x4c92d3){logger[_0x5f09('0x16')](_0x5f09('0x26'),_0x4c92d3[_0x5f09('0x18')],_0x1a24ef);_0x15a21f(_0x432e10['error'](0x1f4,_0x4c92d3[_0x5f09('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e5fdb25..a37f556 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 _0x9348=['faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2b5d6f,_0x4c7d9a){var _0x1d873c=function(_0x3e606b){while(--_0x3e606b){_0x2b5d6f['push'](_0x2b5d6f['shift']());}};_0x1d873c(++_0x4c7d9a);}(_0x9348,0x160));var _0x8934=function(_0x18c964,_0x3929bf){_0x18c964=_0x18c964-0x0;var _0x3c6672=_0x9348[_0x18c964];return _0x3c6672;};'use strict';var FaxQueueEvents=require(_0x8934('0x0'));var events=[_0x8934('0x1'),_0x8934('0x2'),_0x8934('0x3')];function createListener(_0xc7aa75,_0x48c51d){return function(_0x39979e){_0x48c51d[_0x8934('0x4')](_0xc7aa75,_0x39979e);};}function removeListener(_0x386b51,_0xed8e23){return function(){FaxQueueEvents[_0x8934('0x5')](_0x386b51,_0xed8e23);};}exports[_0x8934('0x6')]=function(_0x3bb404){for(var _0x5ae829=0x0,_0x4420a7=events[_0x8934('0x7')];_0x5ae829<_0x4420a7;_0x5ae829++){var _0x3fc698=events[_0x5ae829];var _0x533196=createListener(_0x8934('0x8')+_0x3fc698,_0x3bb404);FaxQueueEvents['on'](_0x3fc698,_0x533196);}}; \ No newline at end of file +var _0x7163=['removeListener','length','faxQueue:','./faxQueue.events','update','emit'];(function(_0x4b34a5,_0x45d59d){var _0x54b7f6=function(_0x199155){while(--_0x199155){_0x4b34a5['push'](_0x4b34a5['shift']());}};_0x54b7f6(++_0x45d59d);}(_0x7163,0x1ef));var _0x3716=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x7163[_0x622035];return _0x326cf2;};'use strict';var FaxQueueEvents=require(_0x3716('0x0'));var events=['save','remove',_0x3716('0x1')];function createListener(_0x396758,_0x138388){return function(_0x58e0ce){_0x138388[_0x3716('0x2')](_0x396758,_0x58e0ce);};}function removeListener(_0x3da057,_0x1ec9df){return function(){FaxQueueEvents[_0x3716('0x3')](_0x3da057,_0x1ec9df);};}exports['register']=function(_0x5c81bb){for(var _0x3112a7=0x0,_0x4549b2=events[_0x3716('0x4')];_0x3112a7<_0x4549b2;_0x3112a7++){var _0x14bfe0=events[_0x3112a7];var _0x3c84bf=createListener(_0x3716('0x5')+_0x14bfe0,_0x5c81bb);FaxQueueEvents['on'](_0x14bfe0,_0x3c84bf);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 80d334f..2e9c5e6 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 _0x7b84=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0x7b84,0x17c));var _0x47b8=function(_0x3873a8,_0x30b1b3){_0x3873a8=_0x3873a8-0x0;var _0x5d1bcb=_0x7b84[_0x3873a8];return _0x5d1bcb;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0xa')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0xa')](_0x47b8('0x15'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);router[_0x47b8('0x17')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x18')]);router[_0x47b8('0x17')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x19')]);router[_0x47b8('0x17')]('/:id/users',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1a')]);router[_0x47b8('0x1b')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1c')]);router[_0x47b8('0x1d')]('/:id',auth[_0x47b8('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1e')]);router[_0x47b8('0x1d')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x47b8('0x1f')]=router; \ No newline at end of file +var _0xde46=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x15098c,_0x55b5e4){var _0x6af41=function(_0x1eed08){while(--_0x1eed08){_0x15098c['push'](_0x15098c['shift']());}};_0x6af41(++_0x55b5e4);}(_0xde46,0x14e));var _0x6de4=function(_0x2ff9e3,_0x14f2be){_0x2ff9e3=_0x2ff9e3-0x0;var _0x2aba67=_0xde46[_0x2ff9e3];return _0x2aba67;};'use strict';var multer=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var path=require(_0x6de4('0x2'));var timeout=require(_0x6de4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6de4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6de4('0x5'));var config=require(_0x6de4('0x6'));var controller=require(_0x6de4('0x7'));router[_0x6de4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6de4('0x8')]('/describe',auth[_0x6de4('0x9')](),controller[_0x6de4('0xa')]);router['get'](_0x6de4('0xb'),auth[_0x6de4('0x9')](),controller[_0x6de4('0xc')]);router[_0x6de4('0x8')](_0x6de4('0xd'),auth[_0x6de4('0x9')](),controller[_0x6de4('0xe')]);router[_0x6de4('0x8')](_0x6de4('0xf'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x10')]);router['get'](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x12')]);router[_0x6de4('0x13')]('/',auth[_0x6de4('0x9')](),controller[_0x6de4('0x14')]);router[_0x6de4('0x13')](_0x6de4('0xf'),auth['isAuthenticated'](),controller[_0x6de4('0x15')]);router['post'](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x16')]);router['put'](_0x6de4('0xb'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x17')]);router[_0x6de4('0x18')]('/:id',auth[_0x6de4('0x9')](),controller['destroy']);router['delete'](_0x6de4('0xf'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x19')]);router[_0x6de4('0x18')](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x1a')]);module[_0x6de4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index adbf5ee..f01e2c3 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 _0xb7ed=['exports','STRING','DATE','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb7ed,0x1e7));var _0xdb7e=function(_0x52dace,_0x530aa7){_0x52dace=_0x52dace-0x0;var _0x4e43b6=_0xb7ed[_0x52dace];return _0x4e43b6;};'use strict';var moment=require(_0xdb7e('0x0'));var Sequelize=require('sequelize');module[_0xdb7e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdb7e('0x2')]},'joinAt':{'type':Sequelize[_0xdb7e('0x3')]},'leaveAt':{'type':Sequelize[_0xdb7e('0x3')]},'acceptAt':{'type':Sequelize[_0xdb7e('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xdb7e('0x2')]}}; \ No newline at end of file +var _0x62dd=['exports','STRING','DATE','moment','sequelize'];(function(_0x10d52b,_0xc6a4f1){var _0x2bf44a=function(_0x286009){while(--_0x286009){_0x10d52b['push'](_0x10d52b['shift']());}};_0x2bf44a(++_0xc6a4f1);}(_0x62dd,0x6c));var _0xd62d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x62dd[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0xd62d('0x0'));var Sequelize=require(_0xd62d('0x1'));module[_0xd62d('0x2')]={'uniqueid':{'type':Sequelize[_0xd62d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd62d('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd62d('0x4')]},'acceptAt':{'type':Sequelize[_0xd62d('0x4')]},'exitAt':{'type':Sequelize[_0xd62d('0x4')]},'reason':{'type':Sequelize[_0xd62d('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index c0d1a9e..573485a 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 _0x255f=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','FaxQueueReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format'];(function(_0x1553d0,_0x1f7093){var _0xd35bcd=function(_0x551d07){while(--_0x551d07){_0x1553d0['push'](_0x1553d0['shift']());}};_0xd35bcd(++_0x1f7093);}(_0x255f,0x185));var _0xf255=function(_0x486a17,_0x14c452){_0x486a17=_0x486a17-0x0;var _0x584cb4=_0x255f[_0x486a17];return _0x584cb4;};'use strict';var emlformat=require(_0xf255('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf255('0x1'));var jsonpatch=require(_0xf255('0x2'));var rp=require(_0xf255('0x3'));var moment=require('moment');var BPromise=require(_0xf255('0x4'));var Mustache=require(_0xf255('0x5'));var util=require(_0xf255('0x6'));var path=require(_0xf255('0x7'));var sox=require(_0xf255('0x8'));var csv=require(_0xf255('0x9'));var ejs=require(_0xf255('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf255('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf255('0xc'));var deskjs=require(_0xf255('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf255('0xe'));var Papa=require(_0xf255('0xf'));var Redis=require('ioredis');var authService=require(_0xf255('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf255('0x11'));var hardwareService=require(_0xf255('0x12'));var logger=require(_0xf255('0x13'))(_0xf255('0x14'));var utils=require(_0xf255('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf255('0x16'));var db=require(_0xf255('0x17'))['db'];function respondWithStatusCode(_0x35fe1b,_0x50c1ca){_0x50c1ca=_0x50c1ca||0xcc;return function(_0x395f0f){if(_0x395f0f){return _0x35fe1b[_0xf255('0x18')](_0x50c1ca);}return _0x35fe1b['status'](_0x50c1ca)[_0xf255('0x19')]();};}function respondWithResult(_0x266b73,_0x233853){_0x233853=_0x233853||0xc8;return function(_0x49240a){if(_0x49240a){return _0x266b73[_0xf255('0x1a')](_0x233853)[_0xf255('0x1b')](_0x49240a);}};}function respondWithFilteredResult(_0x4b8c8,_0x750c8a){return function(_0x194e28){if(_0x194e28){var _0x4d9a07=typeof _0x750c8a['offset']===_0xf255('0x1c')&&typeof _0x750c8a['limit']===_0xf255('0x1c');var _0x516b16=_0x194e28[_0xf255('0x1d')];var _0x426286=_0x4d9a07?0x0:_0x750c8a[_0xf255('0x1e')];var _0x43902c=_0x4d9a07?_0x194e28[_0xf255('0x1d')]:_0x750c8a[_0xf255('0x1e')]+_0x750c8a[_0xf255('0x1f')];var _0x422a19;if(_0x43902c>=_0x516b16){_0x43902c=_0x516b16;_0x422a19=0xc8;}else{_0x422a19=0xce;}_0x4b8c8[_0xf255('0x1a')](_0x422a19);return _0x4b8c8[_0xf255('0x20')](_0xf255('0x21'),_0x426286+'-'+_0x43902c+'/'+_0x516b16)['json'](_0x194e28);}return null;};}function patchUpdates(_0x2fe87d){return function(_0x1ed880){try{jsonpatch[_0xf255('0x22')](_0x1ed880,_0x2fe87d,!![]);}catch(_0x2c5fbc){return BPromise[_0xf255('0x23')](_0x2c5fbc);}return _0x1ed880[_0xf255('0x24')]();};}function saveUpdates(_0x31bde5,_0x5b9b5f){return function(_0x25d910){if(_0x25d910){return _0x25d910[_0xf255('0x25')](_0x31bde5)[_0xf255('0x26')](function(_0x1dad1e){return _0x1dad1e;});}return null;};}function removeEntity(_0x325ee8,_0x1b3b1a){return function(_0x25eca0){if(_0x25eca0){return _0x25eca0['destroy']()[_0xf255('0x26')](function(){_0x325ee8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d64c5,_0x3270d4){return function(_0x382084){if(!_0x382084){_0x3d64c5[_0xf255('0x18')](0x194);}return _0x382084;};}function handleError(_0x3c0c32,_0x54d391){_0x54d391=_0x54d391||0x1f4;return function(_0x1c3a8e){logger[_0xf255('0x27')](_0x1c3a8e[_0xf255('0x28')]);if(_0x1c3a8e['name']){delete _0x1c3a8e[_0xf255('0x29')];}_0x3c0c32[_0xf255('0x1a')](_0x54d391)[_0xf255('0x2a')](_0x1c3a8e);};}exports['index']=function(_0xa1827e,_0x12424d){var _0x3bc770={},_0x39aac5={},_0x1b6f56={'count':0x0,'rows':[]};var _0x1ca07f=_[_0xf255('0x2b')](db[_0xf255('0x2c')][_0xf255('0x2d')],function(_0x280dac){return{'name':_0x280dac['fieldName'],'type':_0x280dac[_0xf255('0x2e')][_0xf255('0x2f')]};});_0x39aac5[_0xf255('0x30')]=_[_0xf255('0x2b')](_0x1ca07f,_0xf255('0x29'));_0x39aac5[_0xf255('0x31')]=_[_0xf255('0x32')](_0xa1827e[_0xf255('0x31')]);_0x39aac5['filters']=_[_0xf255('0x33')](_0x39aac5['model'],_0x39aac5['query']);_0x3bc770[_0xf255('0x34')]=_[_0xf255('0x33')](_0x39aac5[_0xf255('0x30')],qs[_0xf255('0x35')](_0xa1827e[_0xf255('0x31')][_0xf255('0x35')]));_0x3bc770[_0xf255('0x34')]=_0x3bc770['attributes'][_0xf255('0x36')]?_0x3bc770[_0xf255('0x34')]:_0x39aac5[_0xf255('0x30')];if(!_0xa1827e[_0xf255('0x31')][_0xf255('0x37')](_0xf255('0x38'))){_0x3bc770['limit']=qs[_0xf255('0x1f')](_0xa1827e[_0xf255('0x31')][_0xf255('0x1f')]);_0x3bc770[_0xf255('0x1e')]=qs[_0xf255('0x1e')](_0xa1827e['query'][_0xf255('0x1e')]);}_0x3bc770[_0xf255('0x39')]=qs[_0xf255('0x3a')](_0xa1827e[_0xf255('0x31')][_0xf255('0x3a')]);_0x3bc770[_0xf255('0x3b')]=qs['filters'](_[_0xf255('0x3c')](_0xa1827e[_0xf255('0x31')],_0x39aac5[_0xf255('0x3d')]),_0x1ca07f);if(_0xa1827e[_0xf255('0x31')][_0xf255('0x3e')]){_0x3bc770['where']=_[_0xf255('0x3f')](_0x3bc770[_0xf255('0x3b')],{'$or':_[_0xf255('0x2b')](_0x1ca07f,function(_0x1fd628){if(_0x1fd628[_0xf255('0x2e')]!==_0xf255('0x40')){var _0x4b3733={};_0x4b3733[_0x1fd628['name']]={'$like':'%'+_0xa1827e[_0xf255('0x31')][_0xf255('0x3e')]+'%'};return _0x4b3733;}})});}_0x3bc770=_[_0xf255('0x3f')]({},_0x3bc770,_0xa1827e['options']);var _0x1aef9c={'where':_0x3bc770['where']};return db[_0xf255('0x2c')][_0xf255('0x1d')](_0x1aef9c)[_0xf255('0x26')](function(_0x4516c5){_0x1b6f56[_0xf255('0x1d')]=_0x4516c5;if(_0xa1827e[_0xf255('0x31')][_0xf255('0x41')]){_0x3bc770[_0xf255('0x42')]=[{'all':!![]}];}return db[_0xf255('0x2c')][_0xf255('0x43')](_0x3bc770);})[_0xf255('0x26')](function(_0x22fe5c){_0x1b6f56[_0xf255('0x44')]=_0x22fe5c;return _0x1b6f56;})[_0xf255('0x26')](respondWithFilteredResult(_0x12424d,_0x3bc770))[_0xf255('0x45')](handleError(_0x12424d,null));};exports[_0xf255('0x46')]=function(_0x40a775,_0x4f9d63){var _0x44ea98={'raw':!![],'where':{'id':_0x40a775[_0xf255('0x47')]['id']}},_0x5eedd8={};_0x5eedd8[_0xf255('0x30')]=_['keys'](db[_0xf255('0x2c')]['rawAttributes']);_0x5eedd8[_0xf255('0x31')]=_[_0xf255('0x32')](_0x40a775['query']);_0x5eedd8[_0xf255('0x3d')]=_['intersection'](_0x5eedd8['model'],_0x5eedd8['query']);_0x44ea98[_0xf255('0x34')]=_[_0xf255('0x33')](_0x5eedd8[_0xf255('0x30')],qs[_0xf255('0x35')](_0x40a775['query'][_0xf255('0x35')]));_0x44ea98[_0xf255('0x34')]=_0x44ea98[_0xf255('0x34')][_0xf255('0x36')]?_0x44ea98[_0xf255('0x34')]:_0x5eedd8['model'];if(_0x40a775[_0xf255('0x31')][_0xf255('0x41')]){_0x44ea98[_0xf255('0x42')]=[{'all':!![]}];}_0x44ea98=_[_0xf255('0x3f')]({},_0x44ea98,_0x40a775[_0xf255('0x48')]);return db[_0xf255('0x2c')][_0xf255('0x49')](_0x44ea98)[_0xf255('0x26')](handleEntityNotFound(_0x4f9d63,null))['then'](respondWithResult(_0x4f9d63,null))['catch'](handleError(_0x4f9d63,null));};exports['create']=function(_0x34cc13,_0x4b27e7){return db['FaxQueueReport'][_0xf255('0x4a')](_0x34cc13[_0xf255('0x4b')],{})[_0xf255('0x26')](respondWithResult(_0x4b27e7,0xc9))[_0xf255('0x45')](handleError(_0x4b27e7,null));};exports['update']=function(_0x5bf6e7,_0x1a893c){if(_0x5bf6e7['body']['id']){delete _0x5bf6e7['body']['id'];}return db[_0xf255('0x2c')]['find']({'where':{'id':_0x5bf6e7[_0xf255('0x47')]['id']}})[_0xf255('0x26')](handleEntityNotFound(_0x1a893c,null))[_0xf255('0x26')](saveUpdates(_0x5bf6e7[_0xf255('0x4b')],null))[_0xf255('0x26')](respondWithResult(_0x1a893c,null))[_0xf255('0x45')](handleError(_0x1a893c,null));};exports[_0xf255('0x4c')]=function(_0x392632,_0x271074){return db[_0xf255('0x2c')][_0xf255('0x49')]({'where':{'id':_0x392632[_0xf255('0x47')]['id']}})[_0xf255('0x26')](handleEntityNotFound(_0x271074,null))[_0xf255('0x26')](removeEntity(_0x271074,null))[_0xf255('0x45')](handleError(_0x271074,null));};exports['describe']=function(_0x2d86ea,_0x11ecbd){return db[_0xf255('0x2c')][_0xf255('0x4d')]()[_0xf255('0x26')](respondWithResult(_0x11ecbd,null))['catch'](handleError(_0x11ecbd,null));}; \ No newline at end of file +var _0xcd31=['util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','count','limit','set','Content-Range','reject','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','merge','FaxQueueReport','includeAll','include','rows','catch','intersection','options','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcd31,0x15d));var _0x1cd3=function(_0x53f51f,_0x208fe1){_0x53f51f=_0x53f51f-0x0;var _0x208c04=_0xcd31[_0x53f51f];return _0x208c04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cd3('0x0'));var zipdir=require(_0x1cd3('0x1'));var jsonpatch=require(_0x1cd3('0x2'));var rp=require('request-promise');var moment=require(_0x1cd3('0x3'));var BPromise=require(_0x1cd3('0x4'));var Mustache=require(_0x1cd3('0x5'));var util=require(_0x1cd3('0x6'));var path=require(_0x1cd3('0x7'));var sox=require(_0x1cd3('0x8'));var csv=require('to-csv');var ejs=require(_0x1cd3('0x9'));var fs=require('fs');var fs_extra=require(_0x1cd3('0xa'));var _=require(_0x1cd3('0xb'));var squel=require('squel');var crypto=require(_0x1cd3('0xc'));var jsforce=require(_0x1cd3('0xd'));var deskjs=require(_0x1cd3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1cd3('0xf'));var Papa=require(_0x1cd3('0x10'));var Redis=require(_0x1cd3('0x11'));var authService=require(_0x1cd3('0x12'));var qs=require(_0x1cd3('0x13'));var as=require(_0x1cd3('0x14'));var hardwareService=require(_0x1cd3('0x15'));var logger=require('../../config/logger')(_0x1cd3('0x16'));var utils=require(_0x1cd3('0x17'));var config=require(_0x1cd3('0x18'));var licenseUtil=require(_0x1cd3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe288e,_0x4c9c6d){_0x4c9c6d=_0x4c9c6d||0xcc;return function(_0x41016f){if(_0x41016f){return _0xfe288e[_0x1cd3('0x1a')](_0x4c9c6d);}return _0xfe288e[_0x1cd3('0x1b')](_0x4c9c6d)['end']();};}function respondWithResult(_0x5b885f,_0x1a874c){_0x1a874c=_0x1a874c||0xc8;return function(_0x1def57){if(_0x1def57){return _0x5b885f[_0x1cd3('0x1b')](_0x1a874c)['json'](_0x1def57);}};}function respondWithFilteredResult(_0x2b28cf,_0x40cbbf){return function(_0x5a2b84){if(_0x5a2b84){var _0x418da3=typeof _0x40cbbf['offset']==='undefined'&&typeof _0x40cbbf['limit']==='undefined';var _0x5ca15c=_0x5a2b84['count'];var _0x14c491=_0x418da3?0x0:_0x40cbbf[_0x1cd3('0x1c')];var _0xf82a46=_0x418da3?_0x5a2b84[_0x1cd3('0x1d')]:_0x40cbbf[_0x1cd3('0x1c')]+_0x40cbbf[_0x1cd3('0x1e')];var _0x35870b;if(_0xf82a46>=_0x5ca15c){_0xf82a46=_0x5ca15c;_0x35870b=0xc8;}else{_0x35870b=0xce;}_0x2b28cf[_0x1cd3('0x1b')](_0x35870b);return _0x2b28cf[_0x1cd3('0x1f')](_0x1cd3('0x20'),_0x14c491+'-'+_0xf82a46+'/'+_0x5ca15c)['json'](_0x5a2b84);}return null;};}function patchUpdates(_0x33fc72){return function(_0x2368b3){try{jsonpatch['apply'](_0x2368b3,_0x33fc72,!![]);}catch(_0x26b59a){return BPromise[_0x1cd3('0x21')](_0x26b59a);}return _0x2368b3['save']();};}function saveUpdates(_0x20cda5,_0x159d22){return function(_0x330741){if(_0x330741){return _0x330741[_0x1cd3('0x22')](_0x20cda5)['then'](function(_0x4f6920){return _0x4f6920;});}return null;};}function removeEntity(_0x29ff8c,_0x1a6dad){return function(_0x49c7b1){if(_0x49c7b1){return _0x49c7b1['destroy']()[_0x1cd3('0x23')](function(){_0x29ff8c[_0x1cd3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55aa9c,_0x34b15f){return function(_0x1589fa){if(!_0x1589fa){_0x55aa9c['sendStatus'](0x194);}return _0x1589fa;};}function handleError(_0x5635f9,_0x1c86f6){_0x1c86f6=_0x1c86f6||0x1f4;return function(_0xc311a9){logger[_0x1cd3('0x24')](_0xc311a9['stack']);if(_0xc311a9['name']){delete _0xc311a9[_0x1cd3('0x25')];}_0x5635f9['status'](_0x1c86f6)[_0x1cd3('0x26')](_0xc311a9);};}exports[_0x1cd3('0x27')]=function(_0x268501,_0x4b7c0b){var _0xae9d0c={},_0x53979a={},_0x47578c={'count':0x0,'rows':[]};var _0x3e3afb=_[_0x1cd3('0x28')](db['FaxQueueReport'][_0x1cd3('0x29')],function(_0x909bc6){return{'name':_0x909bc6[_0x1cd3('0x2a')],'type':_0x909bc6[_0x1cd3('0x2b')][_0x1cd3('0x2c')]};});_0x53979a['model']=_[_0x1cd3('0x28')](_0x3e3afb,_0x1cd3('0x25'));_0x53979a[_0x1cd3('0x2d')]=_[_0x1cd3('0x2e')](_0x268501[_0x1cd3('0x2d')]);_0x53979a[_0x1cd3('0x2f')]=_['intersection'](_0x53979a[_0x1cd3('0x30')],_0x53979a[_0x1cd3('0x2d')]);_0xae9d0c['attributes']=_['intersection'](_0x53979a[_0x1cd3('0x30')],qs[_0x1cd3('0x31')](_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x31')]));_0xae9d0c[_0x1cd3('0x32')]=_0xae9d0c['attributes'][_0x1cd3('0x33')]?_0xae9d0c['attributes']:_0x53979a['model'];if(!_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x34')](_0x1cd3('0x35'))){_0xae9d0c[_0x1cd3('0x1e')]=qs['limit'](_0x268501[_0x1cd3('0x2d')]['limit']);_0xae9d0c[_0x1cd3('0x1c')]=qs[_0x1cd3('0x1c')](_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x1c')]);}_0xae9d0c['order']=qs['sort'](_0x268501[_0x1cd3('0x2d')]['sort']);_0xae9d0c[_0x1cd3('0x36')]=qs[_0x1cd3('0x2f')](_[_0x1cd3('0x37')](_0x268501[_0x1cd3('0x2d')],_0x53979a[_0x1cd3('0x2f')]),_0x3e3afb);if(_0x268501['query']['filter']){_0xae9d0c['where']=_['merge'](_0xae9d0c[_0x1cd3('0x36')],{'$or':_['map'](_0x3e3afb,function(_0x285845){if(_0x285845['type']!==_0x1cd3('0x38')){var _0x1af9a6={};_0x1af9a6[_0x285845['name']]={'$like':'%'+_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x39')]+'%'};return _0x1af9a6;}})});}_0xae9d0c=_[_0x1cd3('0x3a')]({},_0xae9d0c,_0x268501['options']);var _0x53e2dd={'where':_0xae9d0c[_0x1cd3('0x36')]};return db[_0x1cd3('0x3b')][_0x1cd3('0x1d')](_0x53e2dd)[_0x1cd3('0x23')](function(_0x2cc3a3){_0x47578c[_0x1cd3('0x1d')]=_0x2cc3a3;if(_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x3c')]){_0xae9d0c[_0x1cd3('0x3d')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0xae9d0c);})['then'](function(_0x42a2ed){_0x47578c[_0x1cd3('0x3e')]=_0x42a2ed;return _0x47578c;})['then'](respondWithFilteredResult(_0x4b7c0b,_0xae9d0c))[_0x1cd3('0x3f')](handleError(_0x4b7c0b,null));};exports['show']=function(_0x40b662,_0x2f6a00){var _0x2109a2={'raw':!![],'where':{'id':_0x40b662['params']['id']}},_0x326f08={};_0x326f08['model']=_['keys'](db[_0x1cd3('0x3b')]['rawAttributes']);_0x326f08['query']=_[_0x1cd3('0x2e')](_0x40b662['query']);_0x326f08[_0x1cd3('0x2f')]=_[_0x1cd3('0x40')](_0x326f08[_0x1cd3('0x30')],_0x326f08[_0x1cd3('0x2d')]);_0x2109a2[_0x1cd3('0x32')]=_[_0x1cd3('0x40')](_0x326f08[_0x1cd3('0x30')],qs[_0x1cd3('0x31')](_0x40b662['query'][_0x1cd3('0x31')]));_0x2109a2[_0x1cd3('0x32')]=_0x2109a2[_0x1cd3('0x32')]['length']?_0x2109a2['attributes']:_0x326f08[_0x1cd3('0x30')];if(_0x40b662[_0x1cd3('0x2d')][_0x1cd3('0x3c')]){_0x2109a2[_0x1cd3('0x3d')]=[{'all':!![]}];}_0x2109a2=_[_0x1cd3('0x3a')]({},_0x2109a2,_0x40b662[_0x1cd3('0x41')]);return db[_0x1cd3('0x3b')]['find'](_0x2109a2)[_0x1cd3('0x23')](handleEntityNotFound(_0x2f6a00,null))[_0x1cd3('0x23')](respondWithResult(_0x2f6a00,null))[_0x1cd3('0x3f')](handleError(_0x2f6a00,null));};exports['create']=function(_0x57c84d,_0x2605c5){return db[_0x1cd3('0x3b')][_0x1cd3('0x42')](_0x57c84d[_0x1cd3('0x43')],{})[_0x1cd3('0x23')](respondWithResult(_0x2605c5,0xc9))['catch'](handleError(_0x2605c5,null));};exports['update']=function(_0x500fcf,_0x3cde0b){if(_0x500fcf[_0x1cd3('0x43')]['id']){delete _0x500fcf[_0x1cd3('0x43')]['id'];}return db[_0x1cd3('0x3b')][_0x1cd3('0x44')]({'where':{'id':_0x500fcf['params']['id']}})['then'](handleEntityNotFound(_0x3cde0b,null))[_0x1cd3('0x23')](saveUpdates(_0x500fcf[_0x1cd3('0x43')],null))['then'](respondWithResult(_0x3cde0b,null))[_0x1cd3('0x3f')](handleError(_0x3cde0b,null));};exports[_0x1cd3('0x45')]=function(_0x2542f6,_0x5c7d9c){return db['FaxQueueReport'][_0x1cd3('0x44')]({'where':{'id':_0x2542f6['params']['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0x5c7d9c,null))[_0x1cd3('0x23')](removeEntity(_0x5c7d9c,null))[_0x1cd3('0x3f')](handleError(_0x5c7d9c,null));};exports[_0x1cd3('0x46')]=function(_0x44037e,_0xfaecf0){return db[_0x1cd3('0x3b')][_0x1cd3('0x46')]()['then'](respondWithResult(_0xfaecf0,null))[_0x1cd3('0x3f')](handleError(_0xfaecf0,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 953260a..af21e0a 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 _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0xc2955b,_0x46cfa9){var _0x2be681=function(_0x2a0fd8){while(--_0x2a0fd8){_0xc2955b['push'](_0xc2955b['shift']());}};_0x2be681(++_0x46cfa9);}(_0x7a54,0x106));var _0x47a5=function(_0x279867,_0xea448a){_0x279867=_0x279867-0x0;var _0x593228=_0x7a54[_0x279867];return _0x593228;};'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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x55a057,_0x5df5c8){var _0x9187d4=function(_0x33f4ee){while(--_0x33f4ee){_0x55a057['push'](_0x55a057['shift']());}};_0x9187d4(++_0x5df5c8);}(_0xf494,0x1c6));var _0x4f49=function(_0x423fe7,_0x200e4e){_0x423fe7=_0x423fe7-0x0;var _0x50d618=_0xf494[_0x423fe7];return _0x50d618;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index a7b7778..195efe4 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 _0x23d7=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','raw','UpdateFaxQueueReport','update','options','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x23d7,0xbb));var _0x723d=function(_0x47087a,_0x5ef3c6){_0x47087a=_0x47087a-0x0;var _0x28fdf1=_0x23d7[_0x47087a];return _0x28fdf1;};'use strict';var _=require(_0x723d('0x0'));var util=require('util');var moment=require(_0x723d('0x1'));var BPromise=require(_0x723d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x723d('0x3'));var db=require(_0x723d('0x4'))['db'];var utils=require(_0x723d('0x5'));var logger=require(_0x723d('0x6'))(_0x723d('0x7'));var config=require(_0x723d('0x8'));var jayson=require(_0x723d('0x9'));var client=jayson[_0x723d('0xa')][_0x723d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58af13,_0x166bdf,_0x31859c){return new BPromise(function(_0x585f8e,_0x92a3d){return client[_0x723d('0xc')](_0x58af13,_0x31859c)[_0x723d('0xd')](function(_0x4cc10a){logger[_0x723d('0xe')](_0x723d('0xf'),_0x166bdf,_0x723d('0x10'));logger[_0x723d('0x11')](_0x723d('0x12'),_0x166bdf,'request\x20sent',JSON['stringify'](_0x4cc10a));if(_0x4cc10a['error']){if(_0x4cc10a[_0x723d('0x13')]['code']===0x1f4){logger[_0x723d('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x166bdf,_0x4cc10a['error']['message']);return _0x92a3d(_0x4cc10a['error'][_0x723d('0x14')]);}logger[_0x723d('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x166bdf,_0x4cc10a[_0x723d('0x13')][_0x723d('0x14')]);return _0x585f8e(_0x4cc10a['error'][_0x723d('0x14')]);}else{logger[_0x723d('0xe')](_0x723d('0xf'),_0x166bdf,_0x723d('0x10'));_0x585f8e(_0x4cc10a['result'][_0x723d('0x14')]);}})[_0x723d('0x15')](function(_0x58d926){logger['error'](_0x723d('0xf'),_0x166bdf,_0x58d926);_0x92a3d(_0x58d926);});});}exports[_0x723d('0x16')]=function(_0x2870fd){var _0x42bd16=this;return new Promise(function(_0x3a6462,_0x2be49e){return db[_0x723d('0x17')][_0x723d('0x18')](_0x2870fd[_0x723d('0x19')],{'raw':_0x2870fd['options']?_0x2870fd['options'][_0x723d('0x1a')]===undefined?!![]:![]:!![]})[_0x723d('0xd')](function(_0x2355bb){logger[_0x723d('0xe')](_0x723d('0x16'),_0x2870fd);logger['debug']('CreateFaxQueueReport',_0x2870fd,JSON['stringify'](_0x2355bb));_0x3a6462(_0x2355bb);})[_0x723d('0x15')](function(_0x26718a){logger[_0x723d('0x13')](_0x723d('0x16'),_0x26718a['message'],_0x2870fd);_0x2be49e(_0x42bd16['error'](0x1f4,_0x26718a[_0x723d('0x14')]));});});};exports[_0x723d('0x1b')]=function(_0x2ec5a8){var _0x32a512=this;return new Promise(function(_0x252d3c,_0x28f067){return db[_0x723d('0x17')][_0x723d('0x1c')](_0x2ec5a8[_0x723d('0x19')],{'raw':_0x2ec5a8['options']?_0x2ec5a8[_0x723d('0x1d')][_0x723d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ec5a8['options']?_0x2ec5a8[_0x723d('0x1d')][_0x723d('0x1e')]||null:null,'attributes':_0x2ec5a8[_0x723d('0x1d')]?_0x2ec5a8[_0x723d('0x1d')]['attributes']||null:null,'limit':_0x2ec5a8['options']?_0x2ec5a8[_0x723d('0x1d')][_0x723d('0x1f')]||null:null})[_0x723d('0xd')](function(_0x2ea054){logger[_0x723d('0xe')](_0x723d('0x1b'),_0x2ec5a8);logger['debug'](_0x723d('0x1b'),_0x2ec5a8,JSON['stringify'](_0x2ea054));_0x252d3c(_0x2ea054);})[_0x723d('0x15')](function(_0x2749ef){logger[_0x723d('0x13')](_0x723d('0x1b'),_0x2749ef[_0x723d('0x14')],_0x2ec5a8);_0x28f067(_0x32a512[_0x723d('0x13')](0x1f4,_0x2749ef['message']));});});}; \ No newline at end of file +var _0xc1df=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch','UpdateFaxQueueReport','where','attributes','limit','lodash','moment','bluebird'];(function(_0x1b776e,_0x1d341e){var _0x3b8294=function(_0x352b9a){while(--_0x352b9a){_0x1b776e['push'](_0x1b776e['shift']());}};_0x3b8294(++_0x1d341e);}(_0xc1df,0xfd));var _0xfc1d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc1df[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xfc1d('0x0'));var util=require('util');var moment=require(_0xfc1d('0x1'));var BPromise=require(_0xfc1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc1d('0x3'));var db=require(_0xfc1d('0x4'))['db'];var utils=require(_0xfc1d('0x5'));var logger=require(_0xfc1d('0x6'))(_0xfc1d('0x7'));var config=require('../../config/environment');var jayson=require(_0xfc1d('0x8'));var client=jayson[_0xfc1d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x460cf9,_0x569ff3,_0x21cec6){return new BPromise(function(_0x5a1258,_0x133d29){return client[_0xfc1d('0xa')](_0x460cf9,_0x21cec6)[_0xfc1d('0xb')](function(_0x53b0a4){logger['info'](_0xfc1d('0xc'),_0x569ff3,_0xfc1d('0xd'));logger[_0xfc1d('0xe')](_0xfc1d('0xf'),_0x569ff3,_0xfc1d('0xd'),JSON[_0xfc1d('0x10')](_0x53b0a4));if(_0x53b0a4[_0xfc1d('0x11')]){if(_0x53b0a4[_0xfc1d('0x11')][_0xfc1d('0x12')]===0x1f4){logger[_0xfc1d('0x11')](_0xfc1d('0xc'),_0x569ff3,_0x53b0a4['error'][_0xfc1d('0x13')]);return _0x133d29(_0x53b0a4[_0xfc1d('0x11')][_0xfc1d('0x13')]);}logger[_0xfc1d('0x11')](_0xfc1d('0xc'),_0x569ff3,_0x53b0a4[_0xfc1d('0x11')]['message']);return _0x5a1258(_0x53b0a4[_0xfc1d('0x11')][_0xfc1d('0x13')]);}else{logger[_0xfc1d('0x14')](_0xfc1d('0xc'),_0x569ff3,_0xfc1d('0xd'));_0x5a1258(_0x53b0a4['result'][_0xfc1d('0x13')]);}})['catch'](function(_0x346660){logger[_0xfc1d('0x11')](_0xfc1d('0xc'),_0x569ff3,_0x346660);_0x133d29(_0x346660);});});}exports[_0xfc1d('0x15')]=function(_0x3a9d3e){var _0xf0f528=this;return new Promise(function(_0x567547,_0x530499){return db[_0xfc1d('0x16')][_0xfc1d('0x17')](_0x3a9d3e[_0xfc1d('0x18')],{'raw':_0x3a9d3e['options']?_0x3a9d3e[_0xfc1d('0x19')][_0xfc1d('0x1a')]===undefined?!![]:![]:!![]})[_0xfc1d('0xb')](function(_0x3e53d5){logger[_0xfc1d('0x14')](_0xfc1d('0x15'),_0x3a9d3e);logger[_0xfc1d('0xe')](_0xfc1d('0x15'),_0x3a9d3e,JSON[_0xfc1d('0x10')](_0x3e53d5));_0x567547(_0x3e53d5);})[_0xfc1d('0x1b')](function(_0x167ac4){logger[_0xfc1d('0x11')](_0xfc1d('0x15'),_0x167ac4[_0xfc1d('0x13')],_0x3a9d3e);_0x530499(_0xf0f528[_0xfc1d('0x11')](0x1f4,_0x167ac4[_0xfc1d('0x13')]));});});};exports[_0xfc1d('0x1c')]=function(_0x3741e3){var _0x126188=this;return new Promise(function(_0x406e1c,_0x5f26e0){return db['FaxQueueReport']['update'](_0x3741e3[_0xfc1d('0x18')],{'raw':_0x3741e3[_0xfc1d('0x19')]?_0x3741e3[_0xfc1d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3741e3[_0xfc1d('0x19')]?_0x3741e3[_0xfc1d('0x19')][_0xfc1d('0x1d')]||null:null,'attributes':_0x3741e3[_0xfc1d('0x19')]?_0x3741e3[_0xfc1d('0x19')][_0xfc1d('0x1e')]||null:null,'limit':_0x3741e3[_0xfc1d('0x19')]?_0x3741e3[_0xfc1d('0x19')][_0xfc1d('0x1f')]||null:null})[_0xfc1d('0xb')](function(_0x563239){logger['info'](_0xfc1d('0x1c'),_0x3741e3);logger[_0xfc1d('0xe')](_0xfc1d('0x1c'),_0x3741e3,JSON[_0xfc1d('0x10')](_0x563239));_0x406e1c(_0x563239);})[_0xfc1d('0x1b')](function(_0x495b62){logger['error']('UpdateFaxQueueReport',_0x495b62[_0xfc1d('0x13')],_0x3741e3);_0x5f26e0(_0x126188[_0xfc1d('0x11')](0x1f4,_0x495b62['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index cc507bb..89d4870 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 _0x710f=['create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','show','post'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x710f,0xc3));var _0xf710=function(_0x9f221c,_0xbc16a8){_0x9f221c=_0x9f221c-0x0;var _0x548b0f=_0x710f[_0x9f221c];return _0x548b0f;};'use strict';var multer=require('multer');var util=require(_0xf710('0x0'));var path=require(_0xf710('0x1'));var timeout=require(_0xf710('0x2'));var express=require(_0xf710('0x3'));var router=express['Router']();var fs_extra=require(_0xf710('0x4'));var auth=require(_0xf710('0x5'));var interaction=require(_0xf710('0x6'));var config=require('../../config/environment');var controller=require(_0xf710('0x7'));router[_0xf710('0x8')]('/',auth[_0xf710('0x9')](),controller['index']);router['get'](_0xf710('0xa'),auth[_0xf710('0x9')](),controller[_0xf710('0xb')]);router[_0xf710('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf710('0xc')]);router[_0xf710('0xd')]('/',auth['isAuthenticated'](),controller[_0xf710('0xe')]);router[_0xf710('0xf')]('/:id',auth[_0xf710('0x9')](),controller['update']);router[_0xf710('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf710('0x11')]);module[_0xf710('0x12')]=router; \ No newline at end of file +var _0xda7b=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','describe','show','post','/:id','destroy'];(function(_0x623ba0,_0x54601b){var _0x55c115=function(_0xfeb9b8){while(--_0xfeb9b8){_0x623ba0['push'](_0x623ba0['shift']());}};_0x55c115(++_0x54601b);}(_0xda7b,0x191));var _0xbda7=function(_0x41cd5a,_0x591467){_0x41cd5a=_0x41cd5a-0x0;var _0x264696=_0xda7b[_0x41cd5a];return _0x264696;};'use strict';var multer=require('multer');var util=require(_0xbda7('0x0'));var path=require(_0xbda7('0x1'));var timeout=require(_0xbda7('0x2'));var express=require('express');var router=express[_0xbda7('0x3')]();var fs_extra=require(_0xbda7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbda7('0x5'));var config=require('../../config/environment');var controller=require(_0xbda7('0x6'));router[_0xbda7('0x7')]('/',auth[_0xbda7('0x8')](),controller[_0xbda7('0x9')]);router['get']('/describe',auth[_0xbda7('0x8')](),controller[_0xbda7('0xa')]);router[_0xbda7('0x7')]('/:id',auth[_0xbda7('0x8')](),controller[_0xbda7('0xb')]);router[_0xbda7('0xc')]('/',auth[_0xbda7('0x8')](),controller['create']);router['put'](_0xbda7('0xd'),auth[_0xbda7('0x8')](),controller['update']);router['delete'](_0xbda7('0xd'),auth[_0xbda7('0x8')](),controller[_0xbda7('0xe')]);module[_0xbda7('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 842e9fc..ed7e488 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4af859,_0x73b4ed){var _0x85d557=function(_0xb86211){while(--_0xb86211){_0x4af859['push'](_0x4af859['shift']());}};_0x85d557(++_0x73b4ed);}(_0x00bb,0x1d8));var _0xb00b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00bb[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x335f5c,_0xce622c){var _0x27458c=function(_0x108b7f){while(--_0x108b7f){_0x335f5c['push'](_0x335f5c['shift']());}};_0x27458c(++_0xce622c);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 8e10e5a..321689e 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 _0x97a2=['where','pick','filter','merge','VIRTUAL','name','includeAll','findAll','catch','params','keys','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','index','FaxTransferReport','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x49ca3a,_0x19691c){var _0x2087a3=function(_0x35e5bb){while(--_0x35e5bb){_0x49ca3a['push'](_0x49ca3a['shift']());}};_0x2087a3(++_0x19691c);}(_0x97a2,0xae));var _0x297a=function(_0x1a4b08,_0x2b432d){_0x1a4b08=_0x1a4b08-0x0;var _0x5249b1=_0x97a2[_0x1a4b08];return _0x5249b1;};'use strict';var emlformat=require(_0x297a('0x0'));var rimraf=require(_0x297a('0x1'));var zipdir=require(_0x297a('0x2'));var jsonpatch=require(_0x297a('0x3'));var rp=require(_0x297a('0x4'));var moment=require(_0x297a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x297a('0x6'));var util=require(_0x297a('0x7'));var path=require(_0x297a('0x8'));var sox=require(_0x297a('0x9'));var csv=require(_0x297a('0xa'));var ejs=require(_0x297a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x297a('0xc'));var crypto=require(_0x297a('0xd'));var jsforce=require(_0x297a('0xe'));var deskjs=require(_0x297a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x297a('0x10'));var Papa=require(_0x297a('0x11'));var Redis=require(_0x297a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x297a('0x13'));var as=require(_0x297a('0x14'));var hardwareService=require(_0x297a('0x15'));var logger=require(_0x297a('0x16'))(_0x297a('0x17'));var utils=require(_0x297a('0x18'));var config=require(_0x297a('0x19'));var licenseUtil=require(_0x297a('0x1a'));var db=require(_0x297a('0x1b'))['db'];function respondWithStatusCode(_0x5d5299,_0x2679b7){_0x2679b7=_0x2679b7||0xcc;return function(_0x454a2e){if(_0x454a2e){return _0x5d5299[_0x297a('0x1c')](_0x2679b7);}return _0x5d5299[_0x297a('0x1d')](_0x2679b7)[_0x297a('0x1e')]();};}function respondWithResult(_0x28b58d,_0x5f177a){_0x5f177a=_0x5f177a||0xc8;return function(_0xd955cd){if(_0xd955cd){return _0x28b58d[_0x297a('0x1d')](_0x5f177a)[_0x297a('0x1f')](_0xd955cd);}};}function respondWithFilteredResult(_0x11345d,_0x59db81){return function(_0x5c6f46){if(_0x5c6f46){var _0x3a13af=typeof _0x59db81[_0x297a('0x20')]===_0x297a('0x21')&&typeof _0x59db81[_0x297a('0x22')]==='undefined';var _0x121cc1=_0x5c6f46['count'];var _0x564576=_0x3a13af?0x0:_0x59db81[_0x297a('0x20')];var _0x27a79b=_0x3a13af?_0x5c6f46[_0x297a('0x23')]:_0x59db81[_0x297a('0x20')]+_0x59db81[_0x297a('0x22')];var _0x36f40f;if(_0x27a79b>=_0x121cc1){_0x27a79b=_0x121cc1;_0x36f40f=0xc8;}else{_0x36f40f=0xce;}_0x11345d[_0x297a('0x1d')](_0x36f40f);return _0x11345d[_0x297a('0x24')](_0x297a('0x25'),_0x564576+'-'+_0x27a79b+'/'+_0x121cc1)[_0x297a('0x1f')](_0x5c6f46);}return null;};}function patchUpdates(_0x4018e4){return function(_0x275cdb){try{jsonpatch[_0x297a('0x26')](_0x275cdb,_0x4018e4,!![]);}catch(_0x38d25d){return BPromise['reject'](_0x38d25d);}return _0x275cdb[_0x297a('0x27')]();};}function saveUpdates(_0x26767b,_0x15209e){return function(_0x11860f){if(_0x11860f){return _0x11860f[_0x297a('0x28')](_0x26767b)[_0x297a('0x29')](function(_0x476598){return _0x476598;});}return null;};}function removeEntity(_0x18d27d,_0x1a24aa){return function(_0x4fcd3d){if(_0x4fcd3d){return _0x4fcd3d['destroy']()[_0x297a('0x29')](function(){_0x18d27d[_0x297a('0x1d')](0xcc)[_0x297a('0x1e')]();});}};}function handleEntityNotFound(_0x40eb55,_0x4d752e){return function(_0xde69b4){if(!_0xde69b4){_0x40eb55[_0x297a('0x1c')](0x194);}return _0xde69b4;};}function handleError(_0x3f76ff,_0x14ba06){_0x14ba06=_0x14ba06||0x1f4;return function(_0x45d7fb){logger[_0x297a('0x2a')](_0x45d7fb['stack']);if(_0x45d7fb['name']){delete _0x45d7fb['name'];}_0x3f76ff[_0x297a('0x1d')](_0x14ba06)['send'](_0x45d7fb);};}exports[_0x297a('0x2b')]=function(_0x26defb,_0x32e142){var _0x1ac7f9={},_0x5ac7c1={},_0x6e1e63={'count':0x0,'rows':[]};var _0x30f353=_['map'](db[_0x297a('0x2c')][_0x297a('0x2d')],function(_0x5a9f30){return{'name':_0x5a9f30['fieldName'],'type':_0x5a9f30[_0x297a('0x2e')][_0x297a('0x2f')]};});_0x5ac7c1[_0x297a('0x30')]=_[_0x297a('0x31')](_0x30f353,'name');_0x5ac7c1[_0x297a('0x32')]=_['keys'](_0x26defb[_0x297a('0x32')]);_0x5ac7c1[_0x297a('0x33')]=_[_0x297a('0x34')](_0x5ac7c1[_0x297a('0x30')],_0x5ac7c1[_0x297a('0x32')]);_0x1ac7f9['attributes']=_[_0x297a('0x34')](_0x5ac7c1[_0x297a('0x30')],qs[_0x297a('0x35')](_0x26defb[_0x297a('0x32')][_0x297a('0x35')]));_0x1ac7f9[_0x297a('0x36')]=_0x1ac7f9[_0x297a('0x36')][_0x297a('0x37')]?_0x1ac7f9[_0x297a('0x36')]:_0x5ac7c1['model'];if(!_0x26defb['query'][_0x297a('0x38')](_0x297a('0x39'))){_0x1ac7f9[_0x297a('0x22')]=qs[_0x297a('0x22')](_0x26defb[_0x297a('0x32')][_0x297a('0x22')]);_0x1ac7f9[_0x297a('0x20')]=qs['offset'](_0x26defb[_0x297a('0x32')][_0x297a('0x20')]);}_0x1ac7f9[_0x297a('0x3a')]=qs[_0x297a('0x3b')](_0x26defb[_0x297a('0x32')][_0x297a('0x3b')]);_0x1ac7f9[_0x297a('0x3c')]=qs[_0x297a('0x33')](_[_0x297a('0x3d')](_0x26defb[_0x297a('0x32')],_0x5ac7c1['filters']),_0x30f353);if(_0x26defb[_0x297a('0x32')][_0x297a('0x3e')]){_0x1ac7f9[_0x297a('0x3c')]=_[_0x297a('0x3f')](_0x1ac7f9['where'],{'$or':_['map'](_0x30f353,function(_0x4482c5){if(_0x4482c5[_0x297a('0x2e')]!==_0x297a('0x40')){var _0x554da0={};_0x554da0[_0x4482c5[_0x297a('0x41')]]={'$like':'%'+_0x26defb[_0x297a('0x32')][_0x297a('0x3e')]+'%'};return _0x554da0;}})});}_0x1ac7f9=_['merge']({},_0x1ac7f9,_0x26defb['options']);var _0x32dbc8={'where':_0x1ac7f9[_0x297a('0x3c')]};return db[_0x297a('0x2c')]['count'](_0x32dbc8)[_0x297a('0x29')](function(_0x44e6af){_0x6e1e63['count']=_0x44e6af;if(_0x26defb[_0x297a('0x32')][_0x297a('0x42')]){_0x1ac7f9['include']=[{'all':!![]}];}return db[_0x297a('0x2c')][_0x297a('0x43')](_0x1ac7f9);})[_0x297a('0x29')](function(_0xda29a1){_0x6e1e63['rows']=_0xda29a1;return _0x6e1e63;})[_0x297a('0x29')](respondWithFilteredResult(_0x32e142,_0x1ac7f9))[_0x297a('0x44')](handleError(_0x32e142,null));};exports['show']=function(_0xb6675e,_0x50faf8){var _0x3d2b74={'raw':!![],'where':{'id':_0xb6675e[_0x297a('0x45')]['id']}},_0x4792d0={};_0x4792d0[_0x297a('0x30')]=_['keys'](db[_0x297a('0x2c')][_0x297a('0x2d')]);_0x4792d0[_0x297a('0x32')]=_[_0x297a('0x46')](_0xb6675e[_0x297a('0x32')]);_0x4792d0[_0x297a('0x33')]=_[_0x297a('0x34')](_0x4792d0['model'],_0x4792d0[_0x297a('0x32')]);_0x3d2b74[_0x297a('0x36')]=_['intersection'](_0x4792d0[_0x297a('0x30')],qs[_0x297a('0x35')](_0xb6675e[_0x297a('0x32')][_0x297a('0x35')]));_0x3d2b74['attributes']=_0x3d2b74[_0x297a('0x36')]['length']?_0x3d2b74[_0x297a('0x36')]:_0x4792d0[_0x297a('0x30')];if(_0xb6675e['query'][_0x297a('0x42')]){_0x3d2b74[_0x297a('0x47')]=[{'all':!![]}];}_0x3d2b74=_[_0x297a('0x3f')]({},_0x3d2b74,_0xb6675e[_0x297a('0x48')]);return db['FaxTransferReport'][_0x297a('0x49')](_0x3d2b74)['then'](handleEntityNotFound(_0x50faf8,null))[_0x297a('0x29')](respondWithResult(_0x50faf8,null))[_0x297a('0x44')](handleError(_0x50faf8,null));};exports[_0x297a('0x4a')]=function(_0x31b195,_0x30e4ac){return db[_0x297a('0x2c')][_0x297a('0x4a')](_0x31b195[_0x297a('0x4b')],{})[_0x297a('0x29')](respondWithResult(_0x30e4ac,0xc9))[_0x297a('0x44')](handleError(_0x30e4ac,null));};exports[_0x297a('0x28')]=function(_0x741a9c,_0x4e29f4){if(_0x741a9c[_0x297a('0x4b')]['id']){delete _0x741a9c[_0x297a('0x4b')]['id'];}return db[_0x297a('0x2c')][_0x297a('0x49')]({'where':{'id':_0x741a9c[_0x297a('0x45')]['id']}})[_0x297a('0x29')](handleEntityNotFound(_0x4e29f4,null))['then'](saveUpdates(_0x741a9c['body'],null))[_0x297a('0x29')](respondWithResult(_0x4e29f4,null))[_0x297a('0x44')](handleError(_0x4e29f4,null));};exports[_0x297a('0x4c')]=function(_0x403931,_0x179a10){return db[_0x297a('0x2c')][_0x297a('0x49')]({'where':{'id':_0x403931['params']['id']}})[_0x297a('0x29')](handleEntityNotFound(_0x179a10,null))['then'](removeEntity(_0x179a10,null))['catch'](handleError(_0x179a10,null));};exports[_0x297a('0x4d')]=function(_0x3e9c7d,_0x2ec31a){return db['FaxTransferReport'][_0x297a('0x4d')]()[_0x297a('0x29')](respondWithResult(_0x2ec31a,null))['catch'](handleError(_0x2ec31a,null));}; \ No newline at end of file +var _0x4d85=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','fields','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','FaxTransferReport','rawAttributes','key','query','keys','filters','intersection','model','attributes'];(function(_0x43d47b,_0x5e96d2){var _0x1d20a0=function(_0x5af880){while(--_0x5af880){_0x43d47b['push'](_0x43d47b['shift']());}};_0x1d20a0(++_0x5e96d2);}(_0x4d85,0x1cb));var _0x54d8=function(_0x136087,_0x34881c){_0x136087=_0x136087-0x0;var _0x2e750f=_0x4d85[_0x136087];return _0x2e750f;};'use strict';var emlformat=require(_0x54d8('0x0'));var rimraf=require(_0x54d8('0x1'));var zipdir=require(_0x54d8('0x2'));var jsonpatch=require(_0x54d8('0x3'));var rp=require('request-promise');var moment=require(_0x54d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x54d8('0x5'));var util=require(_0x54d8('0x6'));var path=require(_0x54d8('0x7'));var sox=require(_0x54d8('0x8'));var csv=require(_0x54d8('0x9'));var ejs=require(_0x54d8('0xa'));var fs=require('fs');var fs_extra=require(_0x54d8('0xb'));var _=require(_0x54d8('0xc'));var squel=require(_0x54d8('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x54d8('0x9'));var querystring=require(_0x54d8('0xe'));var Papa=require(_0x54d8('0xf'));var Redis=require('ioredis');var authService=require(_0x54d8('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54d8('0x11'));var logger=require(_0x54d8('0x12'))(_0x54d8('0x13'));var utils=require(_0x54d8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x54d8('0x15'));var db=require(_0x54d8('0x16'))['db'];function respondWithStatusCode(_0x3ebffe,_0x42af84){_0x42af84=_0x42af84||0xcc;return function(_0x536292){if(_0x536292){return _0x3ebffe['sendStatus'](_0x42af84);}return _0x3ebffe[_0x54d8('0x17')](_0x42af84)[_0x54d8('0x18')]();};}function respondWithResult(_0x5d4b72,_0x1b762d){_0x1b762d=_0x1b762d||0xc8;return function(_0x882796){if(_0x882796){return _0x5d4b72[_0x54d8('0x17')](_0x1b762d)[_0x54d8('0x19')](_0x882796);}};}function respondWithFilteredResult(_0x2f5062,_0x45cd0d){return function(_0x3b819e){if(_0x3b819e){var _0x468a5a=typeof _0x45cd0d[_0x54d8('0x1a')]==='undefined'&&typeof _0x45cd0d[_0x54d8('0x1b')]===_0x54d8('0x1c');var _0x34fd4d=_0x3b819e[_0x54d8('0x1d')];var _0x284cfa=_0x468a5a?0x0:_0x45cd0d[_0x54d8('0x1a')];var _0x29cbbf=_0x468a5a?_0x3b819e[_0x54d8('0x1d')]:_0x45cd0d[_0x54d8('0x1a')]+_0x45cd0d[_0x54d8('0x1b')];var _0x1f4232;if(_0x29cbbf>=_0x34fd4d){_0x29cbbf=_0x34fd4d;_0x1f4232=0xc8;}else{_0x1f4232=0xce;}_0x2f5062[_0x54d8('0x17')](_0x1f4232);return _0x2f5062[_0x54d8('0x1e')](_0x54d8('0x1f'),_0x284cfa+'-'+_0x29cbbf+'/'+_0x34fd4d)[_0x54d8('0x19')](_0x3b819e);}return null;};}function patchUpdates(_0x57d284){return function(_0x412f8a){try{jsonpatch[_0x54d8('0x20')](_0x412f8a,_0x57d284,!![]);}catch(_0x1bf3eb){return BPromise[_0x54d8('0x21')](_0x1bf3eb);}return _0x412f8a['save']();};}function saveUpdates(_0x546880,_0x70f7e1){return function(_0x3f25cb){if(_0x3f25cb){return _0x3f25cb[_0x54d8('0x22')](_0x546880)[_0x54d8('0x23')](function(_0x454756){return _0x454756;});}return null;};}function removeEntity(_0x4f94f8,_0x3350ff){return function(_0x2a3a67){if(_0x2a3a67){return _0x2a3a67[_0x54d8('0x24')]()['then'](function(){_0x4f94f8['status'](0xcc)[_0x54d8('0x18')]();});}};}function handleEntityNotFound(_0x28fe5e,_0x237fd3){return function(_0x260ed7){if(!_0x260ed7){_0x28fe5e[_0x54d8('0x25')](0x194);}return _0x260ed7;};}function handleError(_0x342822,_0x3dea23){_0x3dea23=_0x3dea23||0x1f4;return function(_0x3a11fa){logger['error'](_0x3a11fa[_0x54d8('0x26')]);if(_0x3a11fa['name']){delete _0x3a11fa[_0x54d8('0x27')];}_0x342822[_0x54d8('0x17')](_0x3dea23)[_0x54d8('0x28')](_0x3a11fa);};}exports[_0x54d8('0x29')]=function(_0x5bdb47,_0xaccc80){var _0x172205={},_0xb1dbb7={},_0x1f9cba={'count':0x0,'rows':[]};var _0x1b0cd3=_[_0x54d8('0x2a')](db[_0x54d8('0x2b')][_0x54d8('0x2c')],function(_0x8c7ee5){return{'name':_0x8c7ee5['fieldName'],'type':_0x8c7ee5['type'][_0x54d8('0x2d')]};});_0xb1dbb7['model']=_[_0x54d8('0x2a')](_0x1b0cd3,'name');_0xb1dbb7[_0x54d8('0x2e')]=_[_0x54d8('0x2f')](_0x5bdb47['query']);_0xb1dbb7[_0x54d8('0x30')]=_[_0x54d8('0x31')](_0xb1dbb7[_0x54d8('0x32')],_0xb1dbb7['query']);_0x172205['attributes']=_['intersection'](_0xb1dbb7[_0x54d8('0x32')],qs['fields'](_0x5bdb47[_0x54d8('0x2e')]['fields']));_0x172205[_0x54d8('0x33')]=_0x172205[_0x54d8('0x33')]['length']?_0x172205[_0x54d8('0x33')]:_0xb1dbb7[_0x54d8('0x32')];if(!_0x5bdb47[_0x54d8('0x2e')][_0x54d8('0x34')]('nolimit')){_0x172205[_0x54d8('0x1b')]=qs[_0x54d8('0x1b')](_0x5bdb47[_0x54d8('0x2e')][_0x54d8('0x1b')]);_0x172205[_0x54d8('0x1a')]=qs[_0x54d8('0x1a')](_0x5bdb47[_0x54d8('0x2e')][_0x54d8('0x1a')]);}_0x172205[_0x54d8('0x35')]=qs[_0x54d8('0x36')](_0x5bdb47[_0x54d8('0x2e')]['sort']);_0x172205[_0x54d8('0x37')]=qs[_0x54d8('0x30')](_[_0x54d8('0x38')](_0x5bdb47[_0x54d8('0x2e')],_0xb1dbb7[_0x54d8('0x30')]),_0x1b0cd3);if(_0x5bdb47[_0x54d8('0x2e')][_0x54d8('0x39')]){_0x172205[_0x54d8('0x37')]=_[_0x54d8('0x3a')](_0x172205[_0x54d8('0x37')],{'$or':_[_0x54d8('0x2a')](_0x1b0cd3,function(_0x2953b3){if(_0x2953b3[_0x54d8('0x3b')]!==_0x54d8('0x3c')){var _0x44100d={};_0x44100d[_0x2953b3[_0x54d8('0x27')]]={'$like':'%'+_0x5bdb47[_0x54d8('0x2e')][_0x54d8('0x39')]+'%'};return _0x44100d;}})});}_0x172205=_[_0x54d8('0x3a')]({},_0x172205,_0x5bdb47[_0x54d8('0x3d')]);var _0x2adafd={'where':_0x172205[_0x54d8('0x37')]};return db[_0x54d8('0x2b')]['count'](_0x2adafd)['then'](function(_0x43c51a){_0x1f9cba[_0x54d8('0x1d')]=_0x43c51a;if(_0x5bdb47['query'][_0x54d8('0x3e')]){_0x172205[_0x54d8('0x3f')]=[{'all':!![]}];}return db[_0x54d8('0x2b')][_0x54d8('0x40')](_0x172205);})[_0x54d8('0x23')](function(_0x323192){_0x1f9cba[_0x54d8('0x41')]=_0x323192;return _0x1f9cba;})[_0x54d8('0x23')](respondWithFilteredResult(_0xaccc80,_0x172205))[_0x54d8('0x42')](handleError(_0xaccc80,null));};exports['show']=function(_0x1617a9,_0x3b6f84){var _0x1e02c3={'raw':!![],'where':{'id':_0x1617a9['params']['id']}},_0x1c9d6f={};_0x1c9d6f[_0x54d8('0x32')]=_[_0x54d8('0x2f')](db['FaxTransferReport'][_0x54d8('0x2c')]);_0x1c9d6f[_0x54d8('0x2e')]=_[_0x54d8('0x2f')](_0x1617a9[_0x54d8('0x2e')]);_0x1c9d6f['filters']=_[_0x54d8('0x31')](_0x1c9d6f[_0x54d8('0x32')],_0x1c9d6f[_0x54d8('0x2e')]);_0x1e02c3[_0x54d8('0x33')]=_[_0x54d8('0x31')](_0x1c9d6f[_0x54d8('0x32')],qs[_0x54d8('0x43')](_0x1617a9[_0x54d8('0x2e')][_0x54d8('0x43')]));_0x1e02c3[_0x54d8('0x33')]=_0x1e02c3[_0x54d8('0x33')]['length']?_0x1e02c3['attributes']:_0x1c9d6f[_0x54d8('0x32')];if(_0x1617a9[_0x54d8('0x2e')]['includeAll']){_0x1e02c3[_0x54d8('0x3f')]=[{'all':!![]}];}_0x1e02c3=_[_0x54d8('0x3a')]({},_0x1e02c3,_0x1617a9['options']);return db['FaxTransferReport'][_0x54d8('0x44')](_0x1e02c3)[_0x54d8('0x23')](handleEntityNotFound(_0x3b6f84,null))[_0x54d8('0x23')](respondWithResult(_0x3b6f84,null))[_0x54d8('0x42')](handleError(_0x3b6f84,null));};exports[_0x54d8('0x45')]=function(_0x529fe5,_0x9be070){return db[_0x54d8('0x2b')][_0x54d8('0x45')](_0x529fe5['body'],{})[_0x54d8('0x23')](respondWithResult(_0x9be070,0xc9))[_0x54d8('0x42')](handleError(_0x9be070,null));};exports[_0x54d8('0x22')]=function(_0x40b06a,_0x2ddbba){if(_0x40b06a[_0x54d8('0x46')]['id']){delete _0x40b06a[_0x54d8('0x46')]['id'];}return db[_0x54d8('0x2b')][_0x54d8('0x44')]({'where':{'id':_0x40b06a[_0x54d8('0x47')]['id']}})['then'](handleEntityNotFound(_0x2ddbba,null))[_0x54d8('0x23')](saveUpdates(_0x40b06a[_0x54d8('0x46')],null))[_0x54d8('0x23')](respondWithResult(_0x2ddbba,null))['catch'](handleError(_0x2ddbba,null));};exports[_0x54d8('0x24')]=function(_0x191c12,_0x25c983){return db['FaxTransferReport']['find']({'where':{'id':_0x191c12['params']['id']}})['then'](handleEntityNotFound(_0x25c983,null))[_0x54d8('0x23')](removeEntity(_0x25c983,null))['catch'](handleError(_0x25c983,null));};exports[_0x54d8('0x48')]=function(_0xee5558,_0x4a326d){return db[_0x54d8('0x2b')][_0x54d8('0x48')]()['then'](respondWithResult(_0x4a326d,null))[_0x54d8('0x42')](handleError(_0x4a326d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 0f189a9..9d7fa80 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 _0xfff0=['../../config/environment','./faxTransferReport.attributes','define','report_fax_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xfff0,0x139));var _0x0fff=function(_0x3ed78e,_0x4991bb){_0x3ed78e=_0x3ed78e-0x0;var _0x214210=_0xfff0[_0x3ed78e];return _0x214210;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var logger=require(_0x0fff('0x1'))(_0x0fff('0x2'));var moment=require('moment');var BPromise=require(_0x0fff('0x3'));var rp=require(_0x0fff('0x4'));var fs=require('fs');var path=require(_0x0fff('0x5'));var rimraf=require('rimraf');var config=require(_0x0fff('0x6'));var attributes=require(_0x0fff('0x7'));module['exports']=function(_0x33c813,_0x4c2221){return _0x33c813[_0x0fff('0x8')]('FaxTransferReport',attributes,{'tableName':_0x0fff('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0fff('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f08=['util','../../config/logger','api','moment','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x9f08,0x8f));var _0x89f0=function(_0x2a6551,_0x1f6f40){_0x2a6551=_0x2a6551-0x0;var _0x58df1d=_0x9f08[_0x2a6551];return _0x58df1d;};'use strict';var _=require(_0x89f0('0x0'));var util=require(_0x89f0('0x1'));var logger=require(_0x89f0('0x2'))(_0x89f0('0x3'));var moment=require(_0x89f0('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(_0x89f0('0x5'));var attributes=require(_0x89f0('0x6'));module[_0x89f0('0x7')]=function(_0x43ab31,_0x33e629){return _0x43ab31[_0x89f0('0x8')](_0x89f0('0x9'),attributes,{'tableName':_0x89f0('0xa'),'paranoid':![],'indexes':[{'name':_0x89f0('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 2b65e89..30f86ee 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 _0x964e=['client','http','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','bluebird','randomstring','../../mysqldb','rpc','jayson/promise'];(function(_0xbb0ce8,_0xb63549){var _0x1a1b17=function(_0x171af3){while(--_0x171af3){_0xbb0ce8['push'](_0xbb0ce8['shift']());}};_0x1a1b17(++_0xb63549);}(_0x964e,0x1d6));var _0xe964=function(_0x3748e3,_0x4140b1){_0x3748e3=_0x3748e3-0x0;var _0x4982e2=_0x964e[_0x3748e3];return _0x4982e2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe964('0x0'));var rs=require(_0xe964('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe964('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe964('0x3'));var config=require('../../config/environment');var jayson=require(_0xe964('0x4'));var client=jayson[_0xe964('0x5')][_0xe964('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2b3853,_0xa9a973,_0x1285df){return new BPromise(function(_0x275f6f,_0x140664){return client['request'](_0x2b3853,_0x1285df)[_0xe964('0x7')](function(_0x10fa1a){logger['info'](_0xe964('0x8'),_0xa9a973,_0xe964('0x9'));logger[_0xe964('0xa')](_0xe964('0xb'),_0xa9a973,_0xe964('0x9'),JSON[_0xe964('0xc')](_0x10fa1a));if(_0x10fa1a[_0xe964('0xd')]){if(_0x10fa1a['error'][_0xe964('0xe')]===0x1f4){logger[_0xe964('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0xa9a973,_0x10fa1a['error'][_0xe964('0xf')]);return _0x140664(_0x10fa1a[_0xe964('0xd')][_0xe964('0xf')]);}logger[_0xe964('0xd')](_0xe964('0x8'),_0xa9a973,_0x10fa1a['error'][_0xe964('0xf')]);return _0x275f6f(_0x10fa1a[_0xe964('0xd')]['message']);}else{logger[_0xe964('0x10')](_0xe964('0x8'),_0xa9a973,_0xe964('0x9'));_0x275f6f(_0x10fa1a[_0xe964('0x11')][_0xe964('0xf')]);}})[_0xe964('0x12')](function(_0x5c752b){logger[_0xe964('0xd')](_0xe964('0x8'),_0xa9a973,_0x5c752b);_0x140664(_0x5c752b);});});} \ No newline at end of file +var _0x1651=['code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x33576b,_0x411759){var _0x199404=function(_0x416d80){while(--_0x416d80){_0x33576b['push'](_0x33576b['shift']());}};_0x199404(++_0x411759);}(_0x1651,0x191));var _0x1165=function(_0x277f59,_0x4aba20){_0x277f59=_0x277f59-0x0;var _0x494adf=_0x1651[_0x277f59];return _0x494adf;};'use strict';var _=require(_0x1165('0x0'));var util=require(_0x1165('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1165('0x2'));var fs=require('fs');var Redis=require(_0x1165('0x3'));var db=require(_0x1165('0x4'))['db'];var utils=require(_0x1165('0x5'));var logger=require(_0x1165('0x6'))(_0x1165('0x7'));var config=require(_0x1165('0x8'));var jayson=require(_0x1165('0x9'));var client=jayson[_0x1165('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3374cc,_0x17a4af,_0x23f998){return new BPromise(function(_0x38cfa0,_0x4b479a){return client['request'](_0x3374cc,_0x23f998)[_0x1165('0xb')](function(_0x51de4e){logger[_0x1165('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x17a4af,_0x1165('0xd'));logger['debug'](_0x1165('0xe'),_0x17a4af,'request\x20sent',JSON[_0x1165('0xf')](_0x51de4e));if(_0x51de4e['error']){if(_0x51de4e[_0x1165('0x10')][_0x1165('0x11')]===0x1f4){logger[_0x1165('0x10')](_0x1165('0x12'),_0x17a4af,_0x51de4e['error'][_0x1165('0x13')]);return _0x4b479a(_0x51de4e[_0x1165('0x10')][_0x1165('0x13')]);}logger[_0x1165('0x10')](_0x1165('0x12'),_0x17a4af,_0x51de4e[_0x1165('0x10')][_0x1165('0x13')]);return _0x38cfa0(_0x51de4e[_0x1165('0x10')][_0x1165('0x13')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x17a4af,_0x1165('0xd'));_0x38cfa0(_0x51de4e[_0x1165('0x14')][_0x1165('0x13')]);}})[_0x1165('0x15')](function(_0x1b6f1c){logger[_0x1165('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x17a4af,_0x1b6f1c);_0x4b479a(_0x1b6f1c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index c4eca59..c9bc8ec 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 _0x022f=['show','post','create','/:id','update','delete','destroy','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','/describe','isAuthenticated','get'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x022f,0xa0));var _0xf022=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x022f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf022('0x0'));var util=require(_0xf022('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf022('0x2'));var router=express['Router']();var fs_extra=require(_0xf022('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf022('0x4'));var config=require(_0xf022('0x5'));var controller=require(_0xf022('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf022('0x7'),auth[_0xf022('0x8')](),controller['describe']);router[_0xf022('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf022('0xa')]);router[_0xf022('0xb')]('/',auth[_0xf022('0x8')](),controller[_0xf022('0xc')]);router['put'](_0xf022('0xd'),auth[_0xf022('0x8')](),controller[_0xf022('0xe')]);router[_0xf022('0xf')](_0xf022('0xd'),auth['isAuthenticated'](),controller[_0xf022('0x10')]);module['exports']=router; \ No newline at end of file +var _0x38df=['get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','express','../../config/environment','./faxTransferReport.controller'];(function(_0x335348,_0x3f5544){var _0x188b9b=function(_0x50dfe7){while(--_0x50dfe7){_0x335348['push'](_0x335348['shift']());}};_0x188b9b(++_0x3f5544);}(_0x38df,0x1e1));var _0xf38d=function(_0x3ddbc4,_0xe5be24){_0x3ddbc4=_0x3ddbc4-0x0;var _0x4f51ff=_0x38df[_0x3ddbc4];return _0x4f51ff;};'use strict';var multer=require(_0xf38d('0x0'));var util=require(_0xf38d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf38d('0x2'));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(_0xf38d('0x3'));var controller=require(_0xf38d('0x4'));router[_0xf38d('0x5')]('/',auth['isAuthenticated'](),controller[_0xf38d('0x6')]);router[_0xf38d('0x5')](_0xf38d('0x7'),auth[_0xf38d('0x8')](),controller[_0xf38d('0x9')]);router[_0xf38d('0x5')](_0xf38d('0xa'),auth[_0xf38d('0x8')](),controller[_0xf38d('0xb')]);router[_0xf38d('0xc')]('/',auth[_0xf38d('0x8')](),controller[_0xf38d('0xd')]);router[_0xf38d('0xe')](_0xf38d('0xa'),auth[_0xf38d('0x8')](),controller['update']);router[_0xf38d('0xf')](_0xf38d('0xa'),auth[_0xf38d('0x8')](),controller[_0xf38d('0x10')]);module[_0xf38d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f4080f9..f1a1a68 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 _0x2429=['get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x1b9286,_0x408a07){var _0x2e9511=function(_0xcf7a89){while(--_0xcf7a89){_0x1b9286['push'](_0x1b9286['shift']());}};_0x2e9511(++_0x408a07);}(_0x2429,0x114));var _0x9242=function(_0x1fc356,_0x5de529){_0x1fc356=_0x1fc356-0x0;var _0x4b5c33=_0x2429[_0x1fc356];return _0x4b5c33;};'use strict';var multer=require('multer');var util=require(_0x9242('0x0'));var path=require(_0x9242('0x1'));var timeout=require(_0x9242('0x2'));var express=require(_0x9242('0x3'));var router=express[_0x9242('0x4')]();var fs_extra=require(_0x9242('0x5'));var auth=require(_0x9242('0x6'));var interaction=require(_0x9242('0x7'));var config=require(_0x9242('0x8'));var controller=require(_0x9242('0x9'));router[_0x9242('0xa')]('/',auth[_0x9242('0xb')](),controller['index']);router[_0x9242('0xa')](_0x9242('0xc'),auth[_0x9242('0xb')](),controller[_0x9242('0xd')]);router[_0x9242('0xa')](_0x9242('0xe'),auth[_0x9242('0xb')](),controller[_0x9242('0xf')]);router[_0x9242('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x9242('0x10')]);router[_0x9242('0x11')]('/',auth['isAuthenticated'](),controller[_0x9242('0x12')]);router[_0x9242('0x11')](_0x9242('0xe'),auth[_0x9242('0xb')](),controller[_0x9242('0x13')]);router['put'](_0x9242('0xc'),auth[_0x9242('0xb')](),controller['update']);router['delete'](_0x9242('0xc'),auth[_0x9242('0xb')](),controller[_0x9242('0x14')]);module[_0x9242('0x15')]=router; \ No newline at end of file +var _0x2c5e=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDeskAccount.controller','get'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0x2c5e,0x1ee));var _0xe2c5=function(_0x1499c4,_0x57c5c3){_0x1499c4=_0x1499c4-0x0;var _0x3cf45a=_0x2c5e[_0x1499c4];return _0x3cf45a;};'use strict';var multer=require(_0xe2c5('0x0'));var util=require(_0xe2c5('0x1'));var path=require(_0xe2c5('0x2'));var timeout=require(_0xe2c5('0x3'));var express=require(_0xe2c5('0x4'));var router=express[_0xe2c5('0x5')]();var fs_extra=require(_0xe2c5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe2c5('0x7'));var config=require('../../config/environment');var controller=require(_0xe2c5('0x8'));router[_0xe2c5('0x9')]('/',auth[_0xe2c5('0xa')](),controller['index']);router[_0xe2c5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe2c5('0xb')]);router[_0xe2c5('0x9')](_0xe2c5('0xc'),auth[_0xe2c5('0xa')](),controller[_0xe2c5('0xd')]);router[_0xe2c5('0x9')](_0xe2c5('0xe'),auth[_0xe2c5('0xa')](),controller[_0xe2c5('0xf')]);router[_0xe2c5('0x10')]('/',auth['isAuthenticated'](),controller[_0xe2c5('0x11')]);router[_0xe2c5('0x10')](_0xe2c5('0xc'),auth[_0xe2c5('0xa')](),controller[_0xe2c5('0x12')]);router[_0xe2c5('0x13')](_0xe2c5('0x14'),auth[_0xe2c5('0xa')](),controller[_0xe2c5('0x15')]);router[_0xe2c5('0x16')]('/:id',auth[_0xe2c5('0xa')](),controller['destroy']);module[_0xe2c5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index be304c7..7deea6d 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 _0x2e5a=['ENUM','basic','integrationTab','newTab','sequelize','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2e5a,0xb2));var _0xa2e5=function(_0x4e72fb,_0x5e8403){_0x4e72fb=_0x4e72fb-0x0;var _0x9272a4=_0x2e5a[_0x4e72fb];return _0x9272a4;};'use strict';var Sequelize=require(_0xa2e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xa2e5('0x1')]},'description':{'type':Sequelize[_0xa2e5('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xa2e5('0x2')]('basic'),'defaultValue':_0xa2e5('0x3')},'password':{'type':Sequelize[_0xa2e5('0x1')]},'consumerKey':{'type':Sequelize[_0xa2e5('0x1')]},'consumerSecret':{'type':Sequelize[_0xa2e5('0x1')]},'token':{'type':Sequelize[_0xa2e5('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa2e5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa2e5('0x2')](_0xa2e5('0x4'),_0xa2e5('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x9e41=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x250ae1,_0x44b348){var _0x2a5b4a=function(_0x3c3760){while(--_0x3c3760){_0x250ae1['push'](_0x250ae1['shift']());}};_0x2a5b4a(++_0x44b348);}(_0x9e41,0xca));var _0x19e4=function(_0x59f30e,_0x1bba87){_0x59f30e=_0x59f30e-0x0;var _0x300177=_0x9e41[_0x59f30e];return _0x300177;};'use strict';var Sequelize=require(_0x19e4('0x0'));module[_0x19e4('0x1')]={'name':{'type':Sequelize[_0x19e4('0x2')]},'description':{'type':Sequelize[_0x19e4('0x2')]},'username':{'type':Sequelize[_0x19e4('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x19e4('0x3')]('basic'),'defaultValue':_0x19e4('0x4')},'password':{'type':Sequelize[_0x19e4('0x2')]},'consumerKey':{'type':Sequelize[_0x19e4('0x2')]},'consumerSecret':{'type':Sequelize[_0x19e4('0x2')]},'token':{'type':Sequelize[_0x19e4('0x2')]},'tokenSecret':{'type':Sequelize[_0x19e4('0x2')]},'serverUrl':{'type':Sequelize[_0x19e4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x19e4('0x3')](_0x19e4('0x5'),_0x19e4('0x6')),'defaultValue':_0x19e4('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f483e84..37b0fd3 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 _0x247c=['rows','catch','show','keys','find','create','body','params','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','getSubjects','Descriptions','DeskField','getFields','priority','remoteUri','username','password','consumerSecret','token','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','authType','basic','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','test','statusCode','stringify','Wrong\x20credentials','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x403565,_0x180410){var _0x595e3a=function(_0x1d610f){while(--_0x1d610f){_0x403565['push'](_0x403565['shift']());}};_0x595e3a(++_0x180410);}(_0x247c,0x114));var _0xc247=function(_0x497642,_0x55c481){_0x497642=_0x497642-0x0;var _0x351a14=_0x247c[_0x497642];return _0x351a14;};'use strict';var emlformat=require(_0xc247('0x0'));var rimraf=require(_0xc247('0x1'));var zipdir=require(_0xc247('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc247('0x3'));var moment=require(_0xc247('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc247('0x5'));var util=require(_0xc247('0x6'));var path=require(_0xc247('0x7'));var sox=require(_0xc247('0x8'));var csv=require(_0xc247('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc247('0xa'));var _=require(_0xc247('0xb'));var squel=require(_0xc247('0xc'));var crypto=require(_0xc247('0xd'));var jsforce=require(_0xc247('0xe'));var deskjs=require(_0xc247('0xf'));var toCsv=require(_0xc247('0x9'));var querystring=require(_0xc247('0x10'));var Papa=require(_0xc247('0x11'));var Redis=require(_0xc247('0x12'));var authService=require(_0xc247('0x13'));var qs=require(_0xc247('0x14'));var as=require(_0xc247('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc247('0x16'))('api');var utils=require(_0xc247('0x17'));var config=require(_0xc247('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc247('0x19'))['db'];var integrations=require(_0xc247('0x1a'));function respondWithStatusCode(_0x18e543,_0x5e1574){_0x5e1574=_0x5e1574||0xcc;return function(_0x3dc735){if(_0x3dc735){return _0x18e543[_0xc247('0x1b')](_0x5e1574);}return _0x18e543[_0xc247('0x1c')](_0x5e1574)[_0xc247('0x1d')]();};}function respondWithResult(_0x14cf38,_0x535bb2){_0x535bb2=_0x535bb2||0xc8;return function(_0x263380){if(_0x263380){return _0x14cf38[_0xc247('0x1c')](_0x535bb2)[_0xc247('0x1e')](_0x263380);}};}function respondWithFilteredResult(_0x5934a7,_0x40bf65){return function(_0x1ec4c4){if(_0x1ec4c4){var _0x2b0894=typeof _0x40bf65[_0xc247('0x1f')]===_0xc247('0x20')&&typeof _0x40bf65[_0xc247('0x21')]===_0xc247('0x20');var _0x5aa4be=_0x1ec4c4[_0xc247('0x22')];var _0x1fcc9c=_0x2b0894?0x0:_0x40bf65[_0xc247('0x1f')];var _0x626ee=_0x2b0894?_0x1ec4c4['count']:_0x40bf65['offset']+_0x40bf65[_0xc247('0x21')];var _0x37984e;if(_0x626ee>=_0x5aa4be){_0x626ee=_0x5aa4be;_0x37984e=0xc8;}else{_0x37984e=0xce;}_0x5934a7[_0xc247('0x1c')](_0x37984e);return _0x5934a7[_0xc247('0x23')](_0xc247('0x24'),_0x1fcc9c+'-'+_0x626ee+'/'+_0x5aa4be)[_0xc247('0x1e')](_0x1ec4c4);}return null;};}function patchUpdates(_0x40a107){return function(_0x8541dc){try{jsonpatch[_0xc247('0x25')](_0x8541dc,_0x40a107,!![]);}catch(_0x290693){return BPromise[_0xc247('0x26')](_0x290693);}return _0x8541dc[_0xc247('0x27')]();};}function saveUpdates(_0x19acf5,_0x515377){return function(_0x4d3fcf){if(_0x4d3fcf){return _0x4d3fcf[_0xc247('0x28')](_0x19acf5)[_0xc247('0x29')](function(_0x374a42){return _0x374a42;});}return null;};}function removeEntity(_0x5dfce3,_0x1fb4ac){return function(_0x51bf73){if(_0x51bf73){return _0x51bf73[_0xc247('0x2a')]()['then'](function(){_0x5dfce3['status'](0xcc)[_0xc247('0x1d')]();});}};}function handleEntityNotFound(_0x31c2e5,_0x2db751){return function(_0x5660fe){if(!_0x5660fe){_0x31c2e5[_0xc247('0x1b')](0x194);}return _0x5660fe;};}function handleError(_0x4b6833,_0xd5dc23){_0xd5dc23=_0xd5dc23||0x1f4;return function(_0x286dd2){logger[_0xc247('0x2b')](_0x286dd2[_0xc247('0x2c')]);if(_0x286dd2['name']){delete _0x286dd2[_0xc247('0x2d')];}_0x4b6833[_0xc247('0x1c')](_0xd5dc23)[_0xc247('0x2e')](_0x286dd2);};}exports[_0xc247('0x2f')]=function(_0x59f66c,_0x4ab017){var _0x303d91={},_0x505ddb={},_0x4b5283={'count':0x0,'rows':[]};var _0x553d8d=_[_0xc247('0x30')](db[_0xc247('0x31')][_0xc247('0x32')],function(_0x2947d5){return{'name':_0x2947d5[_0xc247('0x33')],'type':_0x2947d5[_0xc247('0x34')][_0xc247('0x35')]};});_0x505ddb[_0xc247('0x36')]=_[_0xc247('0x30')](_0x553d8d,_0xc247('0x2d'));_0x505ddb[_0xc247('0x37')]=_['keys'](_0x59f66c[_0xc247('0x37')]);_0x505ddb['filters']=_[_0xc247('0x38')](_0x505ddb['model'],_0x505ddb[_0xc247('0x37')]);_0x303d91[_0xc247('0x39')]=_[_0xc247('0x38')](_0x505ddb['model'],qs['fields'](_0x59f66c[_0xc247('0x37')][_0xc247('0x3a')]));_0x303d91[_0xc247('0x39')]=_0x303d91[_0xc247('0x39')][_0xc247('0x3b')]?_0x303d91[_0xc247('0x39')]:_0x505ddb['model'];if(!_0x59f66c[_0xc247('0x37')][_0xc247('0x3c')](_0xc247('0x3d'))){_0x303d91[_0xc247('0x21')]=qs[_0xc247('0x21')](_0x59f66c['query'][_0xc247('0x21')]);_0x303d91[_0xc247('0x1f')]=qs[_0xc247('0x1f')](_0x59f66c[_0xc247('0x37')]['offset']);}_0x303d91['order']=qs[_0xc247('0x3e')](_0x59f66c[_0xc247('0x37')][_0xc247('0x3e')]);_0x303d91[_0xc247('0x3f')]=qs[_0xc247('0x40')](_[_0xc247('0x41')](_0x59f66c['query'],_0x505ddb['filters']),_0x553d8d);if(_0x59f66c['query'][_0xc247('0x42')]){_0x303d91[_0xc247('0x3f')]=_[_0xc247('0x43')](_0x303d91['where'],{'$or':_[_0xc247('0x30')](_0x553d8d,function(_0x4a4860){if(_0x4a4860[_0xc247('0x34')]!==_0xc247('0x44')){var _0x4669e3={};_0x4669e3[_0x4a4860[_0xc247('0x2d')]]={'$like':'%'+_0x59f66c[_0xc247('0x37')][_0xc247('0x42')]+'%'};return _0x4669e3;}})});}_0x303d91=_['merge']({},_0x303d91,_0x59f66c['options']);var _0x15d5a6={'where':_0x303d91[_0xc247('0x3f')]};return db[_0xc247('0x31')][_0xc247('0x22')](_0x15d5a6)[_0xc247('0x29')](function(_0x34f3cb){_0x4b5283[_0xc247('0x22')]=_0x34f3cb;if(_0x59f66c['query'][_0xc247('0x45')]){_0x303d91[_0xc247('0x46')]=[{'all':!![]}];}return db[_0xc247('0x31')][_0xc247('0x47')](_0x303d91);})[_0xc247('0x29')](function(_0x86ee53){_0x4b5283[_0xc247('0x48')]=_0x86ee53;return _0x4b5283;})[_0xc247('0x29')](respondWithFilteredResult(_0x4ab017,_0x303d91))[_0xc247('0x49')](handleError(_0x4ab017,null));};exports[_0xc247('0x4a')]=function(_0x10d6b9,_0xd87f2d){var _0x253eeb={'raw':![],'where':{'id':_0x10d6b9['params']['id']}},_0x4a55ef={};_0x4a55ef[_0xc247('0x36')]=_['keys'](db[_0xc247('0x31')][_0xc247('0x32')]);_0x4a55ef[_0xc247('0x37')]=_[_0xc247('0x4b')](_0x10d6b9['query']);_0x4a55ef[_0xc247('0x40')]=_[_0xc247('0x38')](_0x4a55ef[_0xc247('0x36')],_0x4a55ef[_0xc247('0x37')]);_0x253eeb[_0xc247('0x39')]=_[_0xc247('0x38')](_0x4a55ef[_0xc247('0x36')],qs[_0xc247('0x3a')](_0x10d6b9[_0xc247('0x37')][_0xc247('0x3a')]));_0x253eeb[_0xc247('0x39')]=_0x253eeb[_0xc247('0x39')][_0xc247('0x3b')]?_0x253eeb[_0xc247('0x39')]:_0x4a55ef[_0xc247('0x36')];if(_0x10d6b9[_0xc247('0x37')]['includeAll']){_0x253eeb[_0xc247('0x46')]=[{'all':!![]}];}_0x253eeb=_[_0xc247('0x43')]({},_0x253eeb,_0x10d6b9['options']);return db[_0xc247('0x31')][_0xc247('0x4c')](_0x253eeb)[_0xc247('0x29')](handleEntityNotFound(_0xd87f2d,null))['then'](respondWithResult(_0xd87f2d,null))['catch'](handleError(_0xd87f2d,null));};exports[_0xc247('0x4d')]=function(_0x557367,_0x2b1c05){return db[_0xc247('0x31')][_0xc247('0x4d')](_0x557367[_0xc247('0x4e')],{})[_0xc247('0x29')](respondWithResult(_0x2b1c05,0xc9))['catch'](handleError(_0x2b1c05,null));};exports[_0xc247('0x28')]=function(_0x280feb,_0x1618ef){if(_0x280feb[_0xc247('0x4e')]['id']){delete _0x280feb[_0xc247('0x4e')]['id'];}return db[_0xc247('0x31')][_0xc247('0x4c')]({'where':{'id':_0x280feb['params']['id']}})['then'](handleEntityNotFound(_0x1618ef,null))[_0xc247('0x29')](saveUpdates(_0x280feb[_0xc247('0x4e')],null))[_0xc247('0x29')](respondWithResult(_0x1618ef,null))[_0xc247('0x49')](handleError(_0x1618ef,null));};exports[_0xc247('0x2a')]=function(_0x28ac4a,_0x14aecd){return db[_0xc247('0x31')][_0xc247('0x4c')]({'where':{'id':_0x28ac4a[_0xc247('0x4f')]['id']}})[_0xc247('0x29')](handleEntityNotFound(_0x14aecd,null))[_0xc247('0x29')](removeEntity(_0x14aecd,null))[_0xc247('0x49')](handleError(_0x14aecd,null));};exports[_0xc247('0x50')]=function(_0x4cbc9d,_0x590eb2,_0x3d4dad){var _0x394970={};var _0x5c2da3={};var _0x4721c4;var _0x34d92f;return db[_0xc247('0x31')][_0xc247('0x51')]({'where':{'id':_0x4cbc9d['params']['id']}})[_0xc247('0x29')](handleEntityNotFound(_0x590eb2,null))['then'](function(_0x19c78a){if(_0x19c78a){_0x4721c4=_0x19c78a;_0x5c2da3[_0xc247('0x36')]=_[_0xc247('0x4b')](db[_0xc247('0x52')]['rawAttributes']);_0x5c2da3['query']=_[_0xc247('0x4b')](_0x4cbc9d[_0xc247('0x37')]);_0x5c2da3[_0xc247('0x40')]=_['intersection'](_0x5c2da3[_0xc247('0x36')],_0x5c2da3[_0xc247('0x37')]);_0x394970['attributes']=_['intersection'](_0x5c2da3[_0xc247('0x36')],qs['fields'](_0x4cbc9d[_0xc247('0x37')][_0xc247('0x3a')]));_0x394970[_0xc247('0x39')]=_0x394970['attributes'][_0xc247('0x3b')]?_0x394970[_0xc247('0x39')]:_0x5c2da3[_0xc247('0x36')];_0x394970['order']=qs[_0xc247('0x3e')](_0x4cbc9d[_0xc247('0x37')][_0xc247('0x3e')]);_0x394970[_0xc247('0x3f')]=qs[_0xc247('0x40')](_[_0xc247('0x41')](_0x4cbc9d['query'],_0x5c2da3['filters']));if(_0x4cbc9d[_0xc247('0x37')][_0xc247('0x42')]){_0x394970[_0xc247('0x3f')]=_[_0xc247('0x43')](_0x394970[_0xc247('0x3f')],{'$or':_[_0xc247('0x30')](_0x394970[_0xc247('0x39')],function(_0x59c9a2){var _0xda4f1f={};_0xda4f1f[_0x59c9a2]={'$like':'%'+_0x4cbc9d[_0xc247('0x37')][_0xc247('0x42')]+'%'};return _0xda4f1f;})});}_0x394970=_[_0xc247('0x43')]({},_0x394970,_0x4cbc9d['options']);return _0x4721c4[_0xc247('0x50')](_0x394970);}})[_0xc247('0x29')](function(_0x837936){if(_0x837936){_0x34d92f=_0x837936[_0xc247('0x3b')];if(!_0x4cbc9d[_0xc247('0x37')][_0xc247('0x3c')]('nolimit')){_0x394970['limit']=qs['limit'](_0x4cbc9d[_0xc247('0x37')][_0xc247('0x21')]);_0x394970['offset']=qs[_0xc247('0x1f')](_0x4cbc9d['query']['offset']);}return _0x4721c4[_0xc247('0x50')](_0x394970);}})['then'](function(_0x4ba582){if(_0x4ba582){return _0x4ba582?{'count':_0x34d92f,'rows':_0x4ba582}:null;}})[_0xc247('0x29')](respondWithResult(_0x590eb2,null))['catch'](handleError(_0x590eb2,null));};exports['addConfiguration']=function(_0x2ddf09,_0x41ed28,_0x41c530){if(_0x2ddf09[_0xc247('0x4e')]['id']){delete _0x2ddf09[_0xc247('0x4e')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x2ddf09[_0xc247('0x4f')]['id']}})['then'](handleEntityNotFound(_0x41ed28,null))[_0xc247('0x29')](function(_0x4d0ee0){if(_0x4d0ee0){_0x2ddf09[_0xc247('0x4e')][_0xc247('0x53')]=_0x4d0ee0['id'];_0x2ddf09[_0xc247('0x4e')][_0xc247('0x54')]=integrations[_0xc247('0x55')](_0x2ddf09[_0xc247('0x4e')]['channel'],_0x2ddf09[_0xc247('0x4e')]['type']);_0x2ddf09[_0xc247('0x4e')][_0xc247('0x56')]=integrations['getDescriptions'](_0x2ddf09[_0xc247('0x4e')]['channel'],_0x2ddf09[_0xc247('0x4e')]['type']);return db[_0xc247('0x52')]['create'](_0x2ddf09[_0xc247('0x4e')],{'include':[{'model':db[_0xc247('0x57')],'as':'Subjects'},{'model':db[_0xc247('0x57')],'as':_0xc247('0x56')}]});}return null;})['then'](respondWithResult(_0x41ed28,null))[_0xc247('0x49')](handleError(_0x41ed28,null));};exports[_0xc247('0x58')]=function(_0x3c828b,_0x5e7344,_0x5ab418){var _0x50978c=[{'name':'priority','label':_0xc247('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xd7ab29='';return db['DeskAccount'][_0xc247('0x51')]({'where':{'id':_0x3c828b[_0xc247('0x4f')]['id']},'attributes':['id',_0xc247('0x5a'),'authType',_0xc247('0x5b'),_0xc247('0x5c'),'consumerKey',_0xc247('0x5d'),_0xc247('0x5e'),'tokenSecret']})[_0xc247('0x29')](handleEntityNotFound(_0x5e7344,null))['then'](function(_0x42deef){if(_0x42deef){_0xd7ab29=_0x42deef['remoteUri'];var _0x3b79c0=_0xd7ab29[_0xc247('0x5f')](-0x1);if(_0x3b79c0==='/'){_0xd7ab29=_0xd7ab29[_0xc247('0x60')](0x0,_0xd7ab29[_0xc247('0x61')](_0x3b79c0));}var _0xab6ae2={'method':_0xc247('0x62'),'uri':util['format'](_0xc247('0x63'),_0xd7ab29),'headers':{'Content-Type':_0xc247('0x64'),'Accept':_0xc247('0x64')},'json':!![]};if(_0x42deef[_0xc247('0x65')]===_0xc247('0x66')){_0xab6ae2['headers'][_0xc247('0x67')]=util[_0xc247('0x68')](_0xc247('0x69'),new Buffer(util[_0xc247('0x68')](_0xc247('0x6a'),_0x42deef['username'],_0x42deef[_0xc247('0x5c')]))[_0xc247('0x6b')](_0xc247('0x6c')));}return rp(_0xab6ae2)['then'](function(_0x1c5a97){return _0x50978c[_0xc247('0x6d')](_['map'](_0x1c5a97[_0xc247('0x6e')]['entries'],function(_0x239cd4){return{'id':_0x239cd4['name'],'name':_0x239cd4[_0xc247('0x2d')],'type':_0x239cd4[_0xc247('0x34')],'active':_0x239cd4[_0xc247('0x6f')],'label':_0x239cd4['label'],'custom':!![]};}));});}})[_0xc247('0x29')](function(_0xda14c3){return{'count':_0xda14c3['length'],'rows':_0xda14c3};})[_0xc247('0x29')](respondWithResult(_0x5e7344,null))[_0xc247('0x49')](function(_0x5da585){var _0x1a1cec=_0x3c828b[_0xc247('0x37')][_0xc247('0x70')]?0x1f4:_0x5da585[_0xc247('0x71')]||0x1f4;logger[_0xc247('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0xc247('0x58'),_0x1a1cec,JSON[_0xc247('0x72')](_0x5da585));delete _0x5da585[_0xc247('0x2d')];if(_0x1a1cec===0x191){_0x1a1cec=0x190;}_0x5e7344[_0xc247('0x1c')](_0x1a1cec)['send'](_0x3c828b[_0xc247('0x37')]['test']?{'message':_0xc247('0x73'),'statusCode':_0x5da585[_0xc247('0x71')]}:_0x5da585);});}; \ No newline at end of file +var _0xe8e4=['substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','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','../../components/integrations/configuration','status','end','offset','undefined','count','set','Content-Range','json','apply','then','sendStatus','error','stack','name','send','index','DeskAccount','fieldName','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','show','params','keys','include','catch','create','body','destroy','getConfigurations','findOne','DeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','type','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xe8e4,0xfb));var _0x4e8e=function(_0x57f7a0,_0x208a9c){_0x57f7a0=_0x57f7a0-0x0;var _0x214331=_0xe8e4[_0x57f7a0];return _0x214331;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e8e('0x0'));var zipdir=require(_0x4e8e('0x1'));var jsonpatch=require(_0x4e8e('0x2'));var rp=require(_0x4e8e('0x3'));var moment=require(_0x4e8e('0x4'));var BPromise=require(_0x4e8e('0x5'));var Mustache=require(_0x4e8e('0x6'));var util=require(_0x4e8e('0x7'));var path=require(_0x4e8e('0x8'));var sox=require(_0x4e8e('0x9'));var csv=require('to-csv');var ejs=require(_0x4e8e('0xa'));var fs=require('fs');var fs_extra=require(_0x4e8e('0xb'));var _=require('lodash');var squel=require(_0x4e8e('0xc'));var crypto=require(_0x4e8e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4e8e('0xe'));var toCsv=require(_0x4e8e('0xf'));var querystring=require('querystring');var Papa=require(_0x4e8e('0x10'));var Redis=require(_0x4e8e('0x11'));var authService=require(_0x4e8e('0x12'));var qs=require(_0x4e8e('0x13'));var as=require(_0x4e8e('0x14'));var hardwareService=require(_0x4e8e('0x15'));var logger=require(_0x4e8e('0x16'))(_0x4e8e('0x17'));var utils=require(_0x4e8e('0x18'));var config=require(_0x4e8e('0x19'));var licenseUtil=require(_0x4e8e('0x1a'));var db=require(_0x4e8e('0x1b'))['db'];var integrations=require(_0x4e8e('0x1c'));function respondWithStatusCode(_0xfc271e,_0x377d6d){_0x377d6d=_0x377d6d||0xcc;return function(_0x256467){if(_0x256467){return _0xfc271e['sendStatus'](_0x377d6d);}return _0xfc271e[_0x4e8e('0x1d')](_0x377d6d)[_0x4e8e('0x1e')]();};}function respondWithResult(_0x2d4c00,_0xbef08c){_0xbef08c=_0xbef08c||0xc8;return function(_0x547f9c){if(_0x547f9c){return _0x2d4c00['status'](_0xbef08c)['json'](_0x547f9c);}};}function respondWithFilteredResult(_0x4fe61e,_0xfd0ee6){return function(_0x3cd028){if(_0x3cd028){var _0x287ed0=typeof _0xfd0ee6[_0x4e8e('0x1f')]==='undefined'&&typeof _0xfd0ee6['limit']===_0x4e8e('0x20');var _0xc07abd=_0x3cd028['count'];var _0xf8c3f2=_0x287ed0?0x0:_0xfd0ee6[_0x4e8e('0x1f')];var _0x35a1c7=_0x287ed0?_0x3cd028[_0x4e8e('0x21')]:_0xfd0ee6[_0x4e8e('0x1f')]+_0xfd0ee6['limit'];var _0xd8bf71;if(_0x35a1c7>=_0xc07abd){_0x35a1c7=_0xc07abd;_0xd8bf71=0xc8;}else{_0xd8bf71=0xce;}_0x4fe61e[_0x4e8e('0x1d')](_0xd8bf71);return _0x4fe61e[_0x4e8e('0x22')](_0x4e8e('0x23'),_0xf8c3f2+'-'+_0x35a1c7+'/'+_0xc07abd)[_0x4e8e('0x24')](_0x3cd028);}return null;};}function patchUpdates(_0x48d1fe){return function(_0x51a5bc){try{jsonpatch[_0x4e8e('0x25')](_0x51a5bc,_0x48d1fe,!![]);}catch(_0x54d08a){return BPromise['reject'](_0x54d08a);}return _0x51a5bc['save']();};}function saveUpdates(_0x12c182,_0x54e06c){return function(_0x2412b1){if(_0x2412b1){return _0x2412b1['update'](_0x12c182)[_0x4e8e('0x26')](function(_0x1cd99d){return _0x1cd99d;});}return null;};}function removeEntity(_0x14a3b4,_0x58fbbe){return function(_0x1765e0){if(_0x1765e0){return _0x1765e0['destroy']()[_0x4e8e('0x26')](function(){_0x14a3b4['status'](0xcc)[_0x4e8e('0x1e')]();});}};}function handleEntityNotFound(_0x39dbdc,_0x5a03b6){return function(_0x28c7f6){if(!_0x28c7f6){_0x39dbdc[_0x4e8e('0x27')](0x194);}return _0x28c7f6;};}function handleError(_0x2e683e,_0x3fb459){_0x3fb459=_0x3fb459||0x1f4;return function(_0x37a78b){logger[_0x4e8e('0x28')](_0x37a78b[_0x4e8e('0x29')]);if(_0x37a78b[_0x4e8e('0x2a')]){delete _0x37a78b['name'];}_0x2e683e['status'](_0x3fb459)[_0x4e8e('0x2b')](_0x37a78b);};}exports[_0x4e8e('0x2c')]=function(_0x13a325,_0x1a4130){var _0x1589db={},_0x42235f={},_0x1b2286={'count':0x0,'rows':[]};var _0x3b3aee=_['map'](db[_0x4e8e('0x2d')]['rawAttributes'],function(_0x537f86){return{'name':_0x537f86[_0x4e8e('0x2e')],'type':_0x537f86['type']['key']};});_0x42235f[_0x4e8e('0x2f')]=_[_0x4e8e('0x30')](_0x3b3aee,'name');_0x42235f[_0x4e8e('0x31')]=_['keys'](_0x13a325[_0x4e8e('0x31')]);_0x42235f[_0x4e8e('0x32')]=_[_0x4e8e('0x33')](_0x42235f[_0x4e8e('0x2f')],_0x42235f['query']);_0x1589db['attributes']=_[_0x4e8e('0x33')](_0x42235f[_0x4e8e('0x2f')],qs[_0x4e8e('0x34')](_0x13a325['query']['fields']));_0x1589db[_0x4e8e('0x35')]=_0x1589db['attributes'][_0x4e8e('0x36')]?_0x1589db[_0x4e8e('0x35')]:_0x42235f[_0x4e8e('0x2f')];if(!_0x13a325['query'][_0x4e8e('0x37')]('nolimit')){_0x1589db['limit']=qs[_0x4e8e('0x38')](_0x13a325[_0x4e8e('0x31')][_0x4e8e('0x38')]);_0x1589db[_0x4e8e('0x1f')]=qs[_0x4e8e('0x1f')](_0x13a325[_0x4e8e('0x31')]['offset']);}_0x1589db[_0x4e8e('0x39')]=qs['sort'](_0x13a325['query'][_0x4e8e('0x3a')]);_0x1589db[_0x4e8e('0x3b')]=qs[_0x4e8e('0x32')](_['pick'](_0x13a325[_0x4e8e('0x31')],_0x42235f[_0x4e8e('0x32')]),_0x3b3aee);if(_0x13a325['query'][_0x4e8e('0x3c')]){_0x1589db[_0x4e8e('0x3b')]=_['merge'](_0x1589db['where'],{'$or':_[_0x4e8e('0x30')](_0x3b3aee,function(_0x3a51e7){if(_0x3a51e7['type']!==_0x4e8e('0x3d')){var _0x3a8446={};_0x3a8446[_0x3a51e7['name']]={'$like':'%'+_0x13a325[_0x4e8e('0x31')]['filter']+'%'};return _0x3a8446;}})});}_0x1589db=_[_0x4e8e('0x3e')]({},_0x1589db,_0x13a325[_0x4e8e('0x3f')]);var _0x30021e={'where':_0x1589db[_0x4e8e('0x3b')]};return db[_0x4e8e('0x2d')][_0x4e8e('0x21')](_0x30021e)[_0x4e8e('0x26')](function(_0x1383c0){_0x1b2286[_0x4e8e('0x21')]=_0x1383c0;if(_0x13a325['query'][_0x4e8e('0x40')]){_0x1589db['include']=[{'all':!![]}];}return db[_0x4e8e('0x2d')][_0x4e8e('0x41')](_0x1589db);})[_0x4e8e('0x26')](function(_0x5c4520){_0x1b2286['rows']=_0x5c4520;return _0x1b2286;})[_0x4e8e('0x26')](respondWithFilteredResult(_0x1a4130,_0x1589db))['catch'](handleError(_0x1a4130,null));};exports[_0x4e8e('0x42')]=function(_0x55bd2d,_0x2b2c54){var _0x39863d={'raw':![],'where':{'id':_0x55bd2d[_0x4e8e('0x43')]['id']}},_0x114f3f={};_0x114f3f[_0x4e8e('0x2f')]=_[_0x4e8e('0x44')](db[_0x4e8e('0x2d')]['rawAttributes']);_0x114f3f['query']=_[_0x4e8e('0x44')](_0x55bd2d[_0x4e8e('0x31')]);_0x114f3f['filters']=_[_0x4e8e('0x33')](_0x114f3f['model'],_0x114f3f[_0x4e8e('0x31')]);_0x39863d[_0x4e8e('0x35')]=_[_0x4e8e('0x33')](_0x114f3f[_0x4e8e('0x2f')],qs['fields'](_0x55bd2d[_0x4e8e('0x31')][_0x4e8e('0x34')]));_0x39863d[_0x4e8e('0x35')]=_0x39863d['attributes']['length']?_0x39863d['attributes']:_0x114f3f[_0x4e8e('0x2f')];if(_0x55bd2d[_0x4e8e('0x31')][_0x4e8e('0x40')]){_0x39863d[_0x4e8e('0x45')]=[{'all':!![]}];}_0x39863d=_[_0x4e8e('0x3e')]({},_0x39863d,_0x55bd2d[_0x4e8e('0x3f')]);return db['DeskAccount']['find'](_0x39863d)[_0x4e8e('0x26')](handleEntityNotFound(_0x2b2c54,null))[_0x4e8e('0x26')](respondWithResult(_0x2b2c54,null))[_0x4e8e('0x46')](handleError(_0x2b2c54,null));};exports[_0x4e8e('0x47')]=function(_0x5aa3cd,_0x5df61b){return db[_0x4e8e('0x2d')][_0x4e8e('0x47')](_0x5aa3cd[_0x4e8e('0x48')],{})[_0x4e8e('0x26')](respondWithResult(_0x5df61b,0xc9))[_0x4e8e('0x46')](handleError(_0x5df61b,null));};exports['update']=function(_0x19a5f1,_0x28c11a){if(_0x19a5f1[_0x4e8e('0x48')]['id']){delete _0x19a5f1[_0x4e8e('0x48')]['id'];}return db[_0x4e8e('0x2d')]['find']({'where':{'id':_0x19a5f1[_0x4e8e('0x43')]['id']}})['then'](handleEntityNotFound(_0x28c11a,null))[_0x4e8e('0x26')](saveUpdates(_0x19a5f1['body'],null))['then'](respondWithResult(_0x28c11a,null))[_0x4e8e('0x46')](handleError(_0x28c11a,null));};exports[_0x4e8e('0x49')]=function(_0x5de5b1,_0x4c7068){return db[_0x4e8e('0x2d')]['find']({'where':{'id':_0x5de5b1[_0x4e8e('0x43')]['id']}})[_0x4e8e('0x26')](handleEntityNotFound(_0x4c7068,null))[_0x4e8e('0x26')](removeEntity(_0x4c7068,null))['catch'](handleError(_0x4c7068,null));};exports[_0x4e8e('0x4a')]=function(_0x34cc45,_0x790788,_0x8cc9b7){var _0x441053={};var _0x342d1a={};var _0x3fe2cf;var _0x43d32a;return db[_0x4e8e('0x2d')][_0x4e8e('0x4b')]({'where':{'id':_0x34cc45[_0x4e8e('0x43')]['id']}})[_0x4e8e('0x26')](handleEntityNotFound(_0x790788,null))[_0x4e8e('0x26')](function(_0x12b2a9){if(_0x12b2a9){_0x3fe2cf=_0x12b2a9;_0x342d1a[_0x4e8e('0x2f')]=_[_0x4e8e('0x44')](db[_0x4e8e('0x4c')]['rawAttributes']);_0x342d1a[_0x4e8e('0x31')]=_[_0x4e8e('0x44')](_0x34cc45[_0x4e8e('0x31')]);_0x342d1a['filters']=_[_0x4e8e('0x33')](_0x342d1a[_0x4e8e('0x2f')],_0x342d1a['query']);_0x441053[_0x4e8e('0x35')]=_['intersection'](_0x342d1a[_0x4e8e('0x2f')],qs[_0x4e8e('0x34')](_0x34cc45[_0x4e8e('0x31')][_0x4e8e('0x34')]));_0x441053[_0x4e8e('0x35')]=_0x441053['attributes']['length']?_0x441053['attributes']:_0x342d1a[_0x4e8e('0x2f')];_0x441053['order']=qs[_0x4e8e('0x3a')](_0x34cc45[_0x4e8e('0x31')]['sort']);_0x441053[_0x4e8e('0x3b')]=qs[_0x4e8e('0x32')](_[_0x4e8e('0x4d')](_0x34cc45[_0x4e8e('0x31')],_0x342d1a[_0x4e8e('0x32')]));if(_0x34cc45['query'][_0x4e8e('0x3c')]){_0x441053['where']=_[_0x4e8e('0x3e')](_0x441053[_0x4e8e('0x3b')],{'$or':_[_0x4e8e('0x30')](_0x441053['attributes'],function(_0x147d23){var _0x130373={};_0x130373[_0x147d23]={'$like':'%'+_0x34cc45[_0x4e8e('0x31')][_0x4e8e('0x3c')]+'%'};return _0x130373;})});}_0x441053=_[_0x4e8e('0x3e')]({},_0x441053,_0x34cc45[_0x4e8e('0x3f')]);return _0x3fe2cf[_0x4e8e('0x4a')](_0x441053);}})[_0x4e8e('0x26')](function(_0x4f6d74){if(_0x4f6d74){_0x43d32a=_0x4f6d74[_0x4e8e('0x36')];if(!_0x34cc45[_0x4e8e('0x31')][_0x4e8e('0x37')](_0x4e8e('0x4e'))){_0x441053[_0x4e8e('0x38')]=qs['limit'](_0x34cc45[_0x4e8e('0x31')][_0x4e8e('0x38')]);_0x441053[_0x4e8e('0x1f')]=qs['offset'](_0x34cc45[_0x4e8e('0x31')][_0x4e8e('0x1f')]);}return _0x3fe2cf['getConfigurations'](_0x441053);}})[_0x4e8e('0x26')](function(_0x49afe0){if(_0x49afe0){return _0x49afe0?{'count':_0x43d32a,'rows':_0x49afe0}:null;}})[_0x4e8e('0x26')](respondWithResult(_0x790788,null))['catch'](handleError(_0x790788,null));};exports[_0x4e8e('0x4f')]=function(_0x461391,_0x56d4e9,_0x13738b){if(_0x461391[_0x4e8e('0x48')]['id']){delete _0x461391['body']['id'];}return db[_0x4e8e('0x2d')][_0x4e8e('0x4b')]({'where':{'id':_0x461391[_0x4e8e('0x43')]['id']}})[_0x4e8e('0x26')](handleEntityNotFound(_0x56d4e9,null))[_0x4e8e('0x26')](function(_0x451feb){if(_0x451feb){_0x461391[_0x4e8e('0x48')][_0x4e8e('0x50')]=_0x451feb['id'];_0x461391[_0x4e8e('0x48')][_0x4e8e('0x51')]=integrations[_0x4e8e('0x52')](_0x461391[_0x4e8e('0x48')]['channel'],_0x461391[_0x4e8e('0x48')]['type']);_0x461391['body'][_0x4e8e('0x53')]=integrations[_0x4e8e('0x54')](_0x461391[_0x4e8e('0x48')][_0x4e8e('0x55')],_0x461391[_0x4e8e('0x48')][_0x4e8e('0x56')]);return db[_0x4e8e('0x4c')][_0x4e8e('0x47')](_0x461391[_0x4e8e('0x48')],{'include':[{'model':db[_0x4e8e('0x57')],'as':_0x4e8e('0x51')},{'model':db[_0x4e8e('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x56d4e9,null))[_0x4e8e('0x46')](handleError(_0x56d4e9,null));};exports[_0x4e8e('0x58')]=function(_0x3ab8ce,_0x51ab35,_0x4d3304){var _0x2d92f1=[{'name':_0x4e8e('0x59'),'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 _0x552081='';return db[_0x4e8e('0x2d')]['findOne']({'where':{'id':_0x3ab8ce['params']['id']},'attributes':['id',_0x4e8e('0x5a'),_0x4e8e('0x5b'),_0x4e8e('0x5c'),_0x4e8e('0x5d'),_0x4e8e('0x5e'),'consumerSecret',_0x4e8e('0x5f'),_0x4e8e('0x60')]})[_0x4e8e('0x26')](handleEntityNotFound(_0x51ab35,null))[_0x4e8e('0x26')](function(_0x5cd6db){if(_0x5cd6db){_0x552081=_0x5cd6db['remoteUri'];var _0x47d5c1=_0x552081['slice'](-0x1);if(_0x47d5c1==='/'){_0x552081=_0x552081[_0x4e8e('0x61')](0x0,_0x552081[_0x4e8e('0x62')](_0x47d5c1));}var _0x1a9f8c={'method':_0x4e8e('0x63'),'uri':util[_0x4e8e('0x64')](_0x4e8e('0x65'),_0x552081),'headers':{'Content-Type':_0x4e8e('0x66'),'Accept':_0x4e8e('0x66')},'json':!![]};if(_0x5cd6db[_0x4e8e('0x5b')]===_0x4e8e('0x67')){_0x1a9f8c['headers']['Authorization']=util[_0x4e8e('0x64')](_0x4e8e('0x68'),new Buffer(util[_0x4e8e('0x64')](_0x4e8e('0x69'),_0x5cd6db['username'],_0x5cd6db[_0x4e8e('0x5d')]))[_0x4e8e('0x6a')](_0x4e8e('0x6b')));}return rp(_0x1a9f8c)['then'](function(_0x390eee){return _0x2d92f1[_0x4e8e('0x6c')](_[_0x4e8e('0x30')](_0x390eee[_0x4e8e('0x6d')]['entries'],function(_0x4f301a){return{'id':_0x4f301a[_0x4e8e('0x2a')],'name':_0x4f301a[_0x4e8e('0x2a')],'type':_0x4f301a['type'],'active':_0x4f301a[_0x4e8e('0x6e')],'label':_0x4f301a[_0x4e8e('0x6f')],'custom':!![]};}));});}})['then'](function(_0x43c375){return{'count':_0x43c375[_0x4e8e('0x36')],'rows':_0x43c375};})[_0x4e8e('0x26')](respondWithResult(_0x51ab35,null))[_0x4e8e('0x46')](function(_0x4bc551){var _0x8bd4a6=_0x3ab8ce[_0x4e8e('0x31')]['test']?0x1f4:_0x4bc551[_0x4e8e('0x70')]||0x1f4;logger[_0x4e8e('0x28')](_0x4e8e('0x71'),'getFields',_0x8bd4a6,JSON[_0x4e8e('0x72')](_0x4bc551));delete _0x4bc551[_0x4e8e('0x2a')];if(_0x8bd4a6===0x191){_0x8bd4a6=0x190;}_0x51ab35[_0x4e8e('0x1d')](_0x8bd4a6)['send'](_0x3ab8ce[_0x4e8e('0x31')][_0x4e8e('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x4bc551[_0x4e8e('0x70')]}:_0x4bc551);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index c36e985..9ebb3c0 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 _0x5f9a=['moment','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','api'];(function(_0x2d9a7c,_0x435ac1){var _0x1045c6=function(_0x3ad70b){while(--_0x3ad70b){_0x2d9a7c['push'](_0x2d9a7c['shift']());}};_0x1045c6(++_0x435ac1);}(_0x5f9a,0x165));var _0xa5f9=function(_0x49fa6d,_0x44ffc3){_0x49fa6d=_0x49fa6d-0x0;var _0x13ce07=_0x5f9a[_0x49fa6d];return _0x13ce07;};'use strict';var _=require('lodash');var util=require(_0xa5f9('0x0'));var logger=require(_0xa5f9('0x1'))(_0xa5f9('0x2'));var moment=require(_0xa5f9('0x3'));var BPromise=require('bluebird');var rp=require(_0xa5f9('0x4'));var fs=require('fs');var path=require(_0xa5f9('0x5'));var rimraf=require('rimraf');var config=require(_0xa5f9('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xa5f9('0x7'));module[_0xa5f9('0x8')]=function(_0x4d297f,_0x40e3f8){return _0x4d297f[_0xa5f9('0x9')](_0xa5f9('0xa'),attributes,{'tableName':_0xa5f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb199=['./intDeskAccount.attributes','define','DeskAccount','int_desk_accounts','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xb199,0x72));var _0x9b19=function(_0x1c87fe,_0x43bdc8){_0x1c87fe=_0x1c87fe-0x0;var _0x4f19e5=_0xb199[_0x1c87fe];return _0x4f19e5;};'use strict';var _=require('lodash');var util=require(_0x9b19('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9b19('0x1'));var BPromise=require(_0x9b19('0x2'));var rp=require(_0x9b19('0x3'));var fs=require('fs');var path=require(_0x9b19('0x4'));var rimraf=require(_0x9b19('0x5'));var config=require('../../config/environment');var attributes=require(_0x9b19('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x130008,_0x2bdd74){return _0x130008[_0x9b19('0x7')](_0x9b19('0x8'),attributes,{'tableName':_0x9b19('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 5e06de6..4f54e32 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 _0x5778=['DeskAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDeskAccount','findAll','options','where','attributes','include','model','map','debug','stringify','ShowDeskAccount'];(function(_0xec3f5d,_0x37ae0c){var _0x6fdeff=function(_0x150256){while(--_0x150256){_0xec3f5d['push'](_0xec3f5d['shift']());}};_0x6fdeff(++_0x37ae0c);}(_0x5778,0x69));var _0x8577=function(_0x5a5bf9,_0x1179f1){_0x5a5bf9=_0x5a5bf9-0x0;var _0x221813=_0x5778[_0x5a5bf9];return _0x221813;};'use strict';var _=require(_0x8577('0x0'));var util=require(_0x8577('0x1'));var moment=require(_0x8577('0x2'));var BPromise=require('bluebird');var rs=require(_0x8577('0x3'));var fs=require('fs');var Redis=require(_0x8577('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8577('0x5'));var logger=require(_0x8577('0x6'))(_0x8577('0x7'));var config=require('../../config/environment');var jayson=require(_0x8577('0x8'));var client=jayson['client'][_0x8577('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e5c7c,_0x5ecc46,_0x2dfa58){return new BPromise(function(_0x1b8cf3,_0xf68762){return client[_0x8577('0xa')](_0x5e5c7c,_0x2dfa58)[_0x8577('0xb')](function(_0x559ee4){logger[_0x8577('0xc')](_0x8577('0xd'),_0x5ecc46,_0x8577('0xe'));logger['debug'](_0x8577('0xf'),_0x5ecc46,_0x8577('0xe'),JSON['stringify'](_0x559ee4));if(_0x559ee4[_0x8577('0x10')]){if(_0x559ee4['error'][_0x8577('0x11')]===0x1f4){logger[_0x8577('0x10')](_0x8577('0xd'),_0x5ecc46,_0x559ee4[_0x8577('0x10')][_0x8577('0x12')]);return _0xf68762(_0x559ee4[_0x8577('0x10')][_0x8577('0x12')]);}logger[_0x8577('0x10')](_0x8577('0xd'),_0x5ecc46,_0x559ee4['error']['message']);return _0x1b8cf3(_0x559ee4[_0x8577('0x10')][_0x8577('0x12')]);}else{logger[_0x8577('0xc')]('DeskAccount,\x20%s,\x20%s',_0x5ecc46,_0x8577('0xe'));_0x1b8cf3(_0x559ee4['result']['message']);}})[_0x8577('0x13')](function(_0x2eec59){logger[_0x8577('0x10')](_0x8577('0xd'),_0x5ecc46,_0x2eec59);_0xf68762(_0x2eec59);});});}exports[_0x8577('0x14')]=function(_0x8e48a5){var _0x1d8e59=this;return new Promise(function(_0x10d230,_0x594d0f){return db['DeskAccount'][_0x8577('0x15')]({'raw':_0x8e48a5[_0x8577('0x16')]?_0x8e48a5['options']['raw']===undefined?!![]:![]:!![],'where':_0x8e48a5[_0x8577('0x16')]?_0x8e48a5[_0x8577('0x16')][_0x8577('0x17')]||null:null,'attributes':_0x8e48a5[_0x8577('0x16')]?_0x8e48a5[_0x8577('0x16')][_0x8577('0x18')]||null:null,'limit':_0x8e48a5['options']?_0x8e48a5[_0x8577('0x16')]['limit']||null:null,'include':_0x8e48a5[_0x8577('0x16')]?_0x8e48a5[_0x8577('0x16')][_0x8577('0x19')]?_['map'](_0x8e48a5[_0x8577('0x16')][_0x8577('0x19')],function(_0x11a351){return{'model':db[_0x11a351[_0x8577('0x1a')]],'as':_0x11a351['as'],'attributes':_0x11a351['attributes'],'include':_0x11a351[_0x8577('0x19')]?_[_0x8577('0x1b')](_0x11a351[_0x8577('0x19')],function(_0x1d5bc7){return{'model':db[_0x1d5bc7['model']],'as':_0x1d5bc7['as'],'attributes':_0x1d5bc7[_0x8577('0x18')],'include':_0x1d5bc7[_0x8577('0x19')]?_[_0x8577('0x1b')](_0x1d5bc7[_0x8577('0x19')],function(_0x16e702){return{'model':db[_0x16e702[_0x8577('0x1a')]],'as':_0x16e702['as'],'attributes':_0x16e702[_0x8577('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8577('0xb')](function(_0x29de36){logger[_0x8577('0xc')](_0x8577('0x14'),_0x8e48a5);logger[_0x8577('0x1c')](_0x8577('0x14'),_0x8e48a5,JSON[_0x8577('0x1d')](_0x29de36));_0x10d230(_0x29de36);})['catch'](function(_0x11302b){logger[_0x8577('0x10')](_0x8577('0x14'),_0x11302b[_0x8577('0x12')],_0x8e48a5);_0x594d0f(_0x1d8e59[_0x8577('0x10')](0x1f4,_0x11302b[_0x8577('0x12')]));});});};exports[_0x8577('0x1e')]=function(_0x1144a1){var _0x5376f4=this;return new Promise(function(_0x542ac0,_0x45ff5c){return db[_0x8577('0x1f')][_0x8577('0x20')]({'raw':_0x1144a1['options']?_0x1144a1[_0x8577('0x16')][_0x8577('0x21')]===undefined?!![]:![]:!![],'where':_0x1144a1[_0x8577('0x16')]?_0x1144a1['options']['where']||null:null,'attributes':_0x1144a1[_0x8577('0x16')]?_0x1144a1[_0x8577('0x16')][_0x8577('0x18')]||null:null,'include':_0x1144a1[_0x8577('0x16')]?_0x1144a1[_0x8577('0x16')]['include']?_[_0x8577('0x1b')](_0x1144a1[_0x8577('0x16')][_0x8577('0x19')],function(_0x4ba8d0){return{'model':db[_0x4ba8d0[_0x8577('0x1a')]],'as':_0x4ba8d0['as'],'attributes':_0x4ba8d0[_0x8577('0x18')],'include':_0x4ba8d0['include']?_[_0x8577('0x1b')](_0x4ba8d0[_0x8577('0x19')],function(_0x5d3cba){return{'model':db[_0x5d3cba[_0x8577('0x1a')]],'as':_0x5d3cba['as'],'attributes':_0x5d3cba[_0x8577('0x18')],'include':_0x5d3cba[_0x8577('0x19')]?_[_0x8577('0x1b')](_0x5d3cba['include'],function(_0x225402){return{'model':db[_0x225402[_0x8577('0x1a')]],'as':_0x225402['as'],'attributes':_0x225402['attributes']};}):[]};}):[]};}):[]:[]})[_0x8577('0xb')](function(_0x2c1ab2){logger[_0x8577('0xc')]('ShowDeskAccount',_0x1144a1);logger[_0x8577('0x1c')]('ShowDeskAccount',_0x1144a1,JSON[_0x8577('0x1d')](_0x2c1ab2));_0x542ac0(_0x2c1ab2);})[_0x8577('0x13')](function(_0x18d9cb){logger[_0x8577('0x10')](_0x8577('0x1e'),_0x18d9cb[_0x8577('0x12')],_0x1144a1);_0x45ff5c(_0x5376f4['error'](0x1f4,_0x18d9cb['message']));});});}; \ No newline at end of file +var _0xc5fb=['findAll','options','where','attributes','limit','include','map','model','then','raw','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount'];(function(_0x4bc56e,_0x4f2fc0){var _0x29c230=function(_0x2068d2){while(--_0x2068d2){_0x4bc56e['push'](_0x4bc56e['shift']());}};_0x29c230(++_0x4f2fc0);}(_0xc5fb,0x115));var _0xbc5f=function(_0x3f3026,_0x35d62a){_0x3f3026=_0x3f3026-0x0;var _0x4e87bf=_0xc5fb[_0x3f3026];return _0x4e87bf;};'use strict';var _=require(_0xbc5f('0x0'));var util=require(_0xbc5f('0x1'));var moment=require(_0xbc5f('0x2'));var BPromise=require(_0xbc5f('0x3'));var rs=require(_0xbc5f('0x4'));var fs=require('fs');var Redis=require(_0xbc5f('0x5'));var db=require(_0xbc5f('0x6'))['db'];var utils=require(_0xbc5f('0x7'));var logger=require(_0xbc5f('0x8'))(_0xbc5f('0x9'));var config=require(_0xbc5f('0xa'));var jayson=require(_0xbc5f('0xb'));var client=jayson[_0xbc5f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18871a,_0x147418,_0x2e9282){return new BPromise(function(_0x3c4697,_0x212df0){return client[_0xbc5f('0xd')](_0x18871a,_0x2e9282)['then'](function(_0x38ba5b){logger[_0xbc5f('0xe')]('DeskAccount,\x20%s,\x20%s',_0x147418,_0xbc5f('0xf'));logger[_0xbc5f('0x10')](_0xbc5f('0x11'),_0x147418,'request\x20sent',JSON[_0xbc5f('0x12')](_0x38ba5b));if(_0x38ba5b[_0xbc5f('0x13')]){if(_0x38ba5b[_0xbc5f('0x13')][_0xbc5f('0x14')]===0x1f4){logger[_0xbc5f('0x13')](_0xbc5f('0x15'),_0x147418,_0x38ba5b[_0xbc5f('0x13')][_0xbc5f('0x16')]);return _0x212df0(_0x38ba5b['error'][_0xbc5f('0x16')]);}logger[_0xbc5f('0x13')]('DeskAccount,\x20%s,\x20%s',_0x147418,_0x38ba5b['error'][_0xbc5f('0x16')]);return _0x3c4697(_0x38ba5b[_0xbc5f('0x13')][_0xbc5f('0x16')]);}else{logger[_0xbc5f('0xe')](_0xbc5f('0x15'),_0x147418,'request\x20sent');_0x3c4697(_0x38ba5b[_0xbc5f('0x17')][_0xbc5f('0x16')]);}})[_0xbc5f('0x18')](function(_0x3ffee0){logger[_0xbc5f('0x13')]('DeskAccount,\x20%s,\x20%s',_0x147418,_0x3ffee0);_0x212df0(_0x3ffee0);});});}exports[_0xbc5f('0x19')]=function(_0x107b30){var _0x467b11=this;return new Promise(function(_0x172e97,_0x5e91a6){return db[_0xbc5f('0x1a')][_0xbc5f('0x1b')]({'raw':_0x107b30['options']?_0x107b30[_0xbc5f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x107b30['options']?_0x107b30[_0xbc5f('0x1c')][_0xbc5f('0x1d')]||null:null,'attributes':_0x107b30[_0xbc5f('0x1c')]?_0x107b30[_0xbc5f('0x1c')][_0xbc5f('0x1e')]||null:null,'limit':_0x107b30[_0xbc5f('0x1c')]?_0x107b30[_0xbc5f('0x1c')][_0xbc5f('0x1f')]||null:null,'include':_0x107b30[_0xbc5f('0x1c')]?_0x107b30['options'][_0xbc5f('0x20')]?_[_0xbc5f('0x21')](_0x107b30[_0xbc5f('0x1c')][_0xbc5f('0x20')],function(_0x9d57b5){return{'model':db[_0x9d57b5['model']],'as':_0x9d57b5['as'],'attributes':_0x9d57b5[_0xbc5f('0x1e')],'include':_0x9d57b5[_0xbc5f('0x20')]?_['map'](_0x9d57b5[_0xbc5f('0x20')],function(_0x1c0cd0){return{'model':db[_0x1c0cd0[_0xbc5f('0x22')]],'as':_0x1c0cd0['as'],'attributes':_0x1c0cd0[_0xbc5f('0x1e')],'include':_0x1c0cd0[_0xbc5f('0x20')]?_['map'](_0x1c0cd0['include'],function(_0x4b4756){return{'model':db[_0x4b4756[_0xbc5f('0x22')]],'as':_0x4b4756['as'],'attributes':_0x4b4756[_0xbc5f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbc5f('0x23')](function(_0x28e531){logger[_0xbc5f('0xe')](_0xbc5f('0x19'),_0x107b30);logger['debug'](_0xbc5f('0x19'),_0x107b30,JSON[_0xbc5f('0x12')](_0x28e531));_0x172e97(_0x28e531);})[_0xbc5f('0x18')](function(_0x534a30){logger['error'](_0xbc5f('0x19'),_0x534a30[_0xbc5f('0x16')],_0x107b30);_0x5e91a6(_0x467b11[_0xbc5f('0x13')](0x1f4,_0x534a30[_0xbc5f('0x16')]));});});};exports['ShowDeskAccount']=function(_0xe523d5){var _0x8622e=this;return new Promise(function(_0x581281,_0x2ab54e){return db['DeskAccount']['find']({'raw':_0xe523d5['options']?_0xe523d5['options'][_0xbc5f('0x24')]===undefined?!![]:![]:!![],'where':_0xe523d5[_0xbc5f('0x1c')]?_0xe523d5[_0xbc5f('0x1c')][_0xbc5f('0x1d')]||null:null,'attributes':_0xe523d5[_0xbc5f('0x1c')]?_0xe523d5[_0xbc5f('0x1c')]['attributes']||null:null,'include':_0xe523d5[_0xbc5f('0x1c')]?_0xe523d5[_0xbc5f('0x1c')][_0xbc5f('0x20')]?_[_0xbc5f('0x21')](_0xe523d5['options'][_0xbc5f('0x20')],function(_0x206322){return{'model':db[_0x206322[_0xbc5f('0x22')]],'as':_0x206322['as'],'attributes':_0x206322[_0xbc5f('0x1e')],'include':_0x206322[_0xbc5f('0x20')]?_[_0xbc5f('0x21')](_0x206322[_0xbc5f('0x20')],function(_0x4f8d81){return{'model':db[_0x4f8d81[_0xbc5f('0x22')]],'as':_0x4f8d81['as'],'attributes':_0x4f8d81[_0xbc5f('0x1e')],'include':_0x4f8d81[_0xbc5f('0x20')]?_['map'](_0x4f8d81[_0xbc5f('0x20')],function(_0x39030d){return{'model':db[_0x39030d[_0xbc5f('0x22')]],'as':_0x39030d['as'],'attributes':_0x39030d['attributes']};}):[]};}):[]};}):[]:[]})[_0xbc5f('0x23')](function(_0xe77d95){logger[_0xbc5f('0xe')](_0xbc5f('0x25'),_0xe523d5);logger[_0xbc5f('0x10')]('ShowDeskAccount',_0xe523d5,JSON[_0xbc5f('0x12')](_0xe77d95));_0x581281(_0xe77d95);})['catch'](function(_0xca4a34){logger[_0xbc5f('0x13')]('ShowDeskAccount',_0xca4a34[_0xbc5f('0x16')],_0xe523d5);_0x2ab54e(_0x8622e[_0xbc5f('0x13')](0x1f4,_0xca4a34['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index fe175b9..1823adb 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x55ca,0x126));var _0xa55c=function(_0x44769c,_0x4b2cc6){_0x44769c=_0x44769c-0x0;var _0x216eb5=_0x55ca[_0x44769c];return _0x216eb5;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x431c26,_0x4b8f47){var _0x3092fd=function(_0x4dca59){while(--_0x4dca59){_0x431c26['push'](_0x431c26['shift']());}};_0x3092fd(++_0x4b8f47);}(_0x55ca,0x126));var _0xa55c=function(_0x2c34ff,_0x1e8bee){_0x2c34ff=_0x2c34ff-0x0;var _0x476508=_0x55ca[_0x2c34ff];return _0x476508;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 842a337..6432248 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 _0x437c=['STRING','sequelize'];(function(_0x179d19,_0x3f63fc){var _0x1ca47f=function(_0x42ef71){while(--_0x42ef71){_0x179d19['push'](_0x179d19['shift']());}};_0x1ca47f(++_0x3f63fc);}(_0x437c,0x1cd));var _0xc437=function(_0x2f1069,_0x22d556){_0x2f1069=_0x2f1069-0x0;var _0x4a4cec=_0x437c[_0x2f1069];return _0x4a4cec;};'use strict';var Sequelize=require(_0xc437('0x0'));module['exports']={'name':{'type':Sequelize[_0xc437('0x1')]},'description':{'type':Sequelize[_0xc437('0x1')]}}; \ No newline at end of file +var _0x7a1e=['STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a1e,0x1a1));var _0xe7a1=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7a1e[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xe7a1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe7a1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1d19046..7e8caae 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 _0x15c3=['count','limit','set','reject','update','then','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','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'];(function(_0x17f101,_0x3ab54b){var _0x51ec3a=function(_0x20b8df){while(--_0x20b8df){_0x17f101['push'](_0x17f101['shift']());}};_0x51ec3a(++_0x3ab54b);}(_0x15c3,0xd1));var _0x315c=function(_0x14511f,_0x4c6b15){_0x14511f=_0x14511f-0x0;var _0x2b047c=_0x15c3[_0x14511f];return _0x2b047c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x315c('0x0'));var zipdir=require(_0x315c('0x1'));var jsonpatch=require(_0x315c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x315c('0x3'));var Mustache=require('mustache');var util=require(_0x315c('0x4'));var path=require(_0x315c('0x5'));var sox=require(_0x315c('0x6'));var csv=require('to-csv');var ejs=require(_0x315c('0x7'));var fs=require('fs');var fs_extra=require(_0x315c('0x8'));var _=require('lodash');var squel=require(_0x315c('0x9'));var crypto=require(_0x315c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x315c('0xb'));var toCsv=require(_0x315c('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x315c('0xd'));var authService=require(_0x315c('0xe'));var qs=require(_0x315c('0xf'));var as=require(_0x315c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x315c('0x11'))(_0x315c('0x12'));var utils=require(_0x315c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x315c('0x14'));var db=require(_0x315c('0x15'))['db'];function respondWithStatusCode(_0x2a5ce7,_0x9b9082){_0x9b9082=_0x9b9082||0xcc;return function(_0x1aca04){if(_0x1aca04){return _0x2a5ce7[_0x315c('0x16')](_0x9b9082);}return _0x2a5ce7[_0x315c('0x17')](_0x9b9082)[_0x315c('0x18')]();};}function respondWithResult(_0x3d3f00,_0x5b0035){_0x5b0035=_0x5b0035||0xc8;return function(_0x47539e){if(_0x47539e){return _0x3d3f00[_0x315c('0x17')](_0x5b0035)[_0x315c('0x19')](_0x47539e);}};}function respondWithFilteredResult(_0x3407f4,_0x4fece7){return function(_0x399c1b){if(_0x399c1b){var _0x3da817=typeof _0x4fece7[_0x315c('0x1a')]===_0x315c('0x1b')&&typeof _0x4fece7['limit']===_0x315c('0x1b');var _0x1d8756=_0x399c1b[_0x315c('0x1c')];var _0x54235f=_0x3da817?0x0:_0x4fece7['offset'];var _0x5c4522=_0x3da817?_0x399c1b[_0x315c('0x1c')]:_0x4fece7['offset']+_0x4fece7[_0x315c('0x1d')];var _0x35560f;if(_0x5c4522>=_0x1d8756){_0x5c4522=_0x1d8756;_0x35560f=0xc8;}else{_0x35560f=0xce;}_0x3407f4[_0x315c('0x17')](_0x35560f);return _0x3407f4[_0x315c('0x1e')]('Content-Range',_0x54235f+'-'+_0x5c4522+'/'+_0x1d8756)['json'](_0x399c1b);}return null;};}function patchUpdates(_0x15a27d){return function(_0x3da682){try{jsonpatch['apply'](_0x3da682,_0x15a27d,!![]);}catch(_0x20fbb0){return BPromise[_0x315c('0x1f')](_0x20fbb0);}return _0x3da682['save']();};}function saveUpdates(_0x1d2931,_0x3457e9){return function(_0x1e03d6){if(_0x1e03d6){return _0x1e03d6[_0x315c('0x20')](_0x1d2931)[_0x315c('0x21')](function(_0x20bb11){return _0x20bb11;});}return null;};}function removeEntity(_0x1e2d79,_0x1a0c68){return function(_0x52e5bf){if(_0x52e5bf){return _0x52e5bf[_0x315c('0x22')]()[_0x315c('0x21')](function(){_0x1e2d79[_0x315c('0x17')](0xcc)[_0x315c('0x18')]();});}};}function handleEntityNotFound(_0x4c6b47,_0xd0570){return function(_0x53084a){if(!_0x53084a){_0x4c6b47[_0x315c('0x16')](0x194);}return _0x53084a;};}function handleError(_0x5ae35c,_0x57bf5b){_0x57bf5b=_0x57bf5b||0x1f4;return function(_0x185a55){logger['error'](_0x185a55[_0x315c('0x23')]);if(_0x185a55[_0x315c('0x24')]){delete _0x185a55[_0x315c('0x24')];}_0x5ae35c[_0x315c('0x17')](_0x57bf5b)[_0x315c('0x25')](_0x185a55);};}exports[_0x315c('0x26')]=function(_0x3c7081,_0x5372e2){var _0xece99f={},_0xcbe56b={},_0x46e40f={'count':0x0,'rows':[]};var _0x27dba5=_[_0x315c('0x27')](db[_0x315c('0x28')][_0x315c('0x29')],function(_0x1546ec){return{'name':_0x1546ec['fieldName'],'type':_0x1546ec[_0x315c('0x2a')][_0x315c('0x2b')]};});_0xcbe56b[_0x315c('0x2c')]=_['map'](_0x27dba5,'name');_0xcbe56b[_0x315c('0x2d')]=_['keys'](_0x3c7081[_0x315c('0x2d')]);_0xcbe56b[_0x315c('0x2e')]=_[_0x315c('0x2f')](_0xcbe56b[_0x315c('0x2c')],_0xcbe56b[_0x315c('0x2d')]);_0xece99f[_0x315c('0x30')]=_[_0x315c('0x2f')](_0xcbe56b[_0x315c('0x2c')],qs[_0x315c('0x31')](_0x3c7081[_0x315c('0x2d')][_0x315c('0x31')]));_0xece99f[_0x315c('0x30')]=_0xece99f['attributes'][_0x315c('0x32')]?_0xece99f[_0x315c('0x30')]:_0xcbe56b['model'];if(!_0x3c7081[_0x315c('0x2d')][_0x315c('0x33')](_0x315c('0x34'))){_0xece99f[_0x315c('0x1d')]=qs[_0x315c('0x1d')](_0x3c7081[_0x315c('0x2d')][_0x315c('0x1d')]);_0xece99f[_0x315c('0x1a')]=qs['offset'](_0x3c7081[_0x315c('0x2d')][_0x315c('0x1a')]);}_0xece99f[_0x315c('0x35')]=qs[_0x315c('0x36')](_0x3c7081[_0x315c('0x2d')][_0x315c('0x36')]);_0xece99f[_0x315c('0x37')]=qs[_0x315c('0x2e')](_[_0x315c('0x38')](_0x3c7081['query'],_0xcbe56b[_0x315c('0x2e')]),_0x27dba5);if(_0x3c7081[_0x315c('0x2d')][_0x315c('0x39')]){_0xece99f[_0x315c('0x37')]=_[_0x315c('0x3a')](_0xece99f[_0x315c('0x37')],{'$or':_['map'](_0x27dba5,function(_0x3fd586){if(_0x3fd586[_0x315c('0x2a')]!==_0x315c('0x3b')){var _0x3ba0e3={};_0x3ba0e3[_0x3fd586[_0x315c('0x24')]]={'$like':'%'+_0x3c7081['query']['filter']+'%'};return _0x3ba0e3;}})});}_0xece99f=_[_0x315c('0x3a')]({},_0xece99f,_0x3c7081[_0x315c('0x3c')]);var _0x1d93c3={'where':_0xece99f[_0x315c('0x37')]};return db[_0x315c('0x28')][_0x315c('0x1c')](_0x1d93c3)['then'](function(_0x173ecf){_0x46e40f[_0x315c('0x1c')]=_0x173ecf;if(_0x3c7081['query'][_0x315c('0x3d')]){_0xece99f[_0x315c('0x3e')]=[{'all':!![]}];}return db[_0x315c('0x28')][_0x315c('0x3f')](_0xece99f);})['then'](function(_0x3af458){_0x46e40f['rows']=_0x3af458;return _0x46e40f;})[_0x315c('0x21')](respondWithFilteredResult(_0x5372e2,_0xece99f))[_0x315c('0x40')](handleError(_0x5372e2,null));};exports[_0x315c('0x41')]=function(_0x5b7617,_0xad27af){var _0x1a7590={'raw':![],'where':{'id':_0x5b7617[_0x315c('0x42')]['id']}},_0x2dea3f={};_0x2dea3f['model']=_[_0x315c('0x43')](db[_0x315c('0x28')][_0x315c('0x29')]);_0x2dea3f['query']=_[_0x315c('0x43')](_0x5b7617[_0x315c('0x2d')]);_0x2dea3f['filters']=_['intersection'](_0x2dea3f[_0x315c('0x2c')],_0x2dea3f[_0x315c('0x2d')]);_0x1a7590[_0x315c('0x30')]=_[_0x315c('0x2f')](_0x2dea3f[_0x315c('0x2c')],qs[_0x315c('0x31')](_0x5b7617[_0x315c('0x2d')][_0x315c('0x31')]));_0x1a7590[_0x315c('0x30')]=_0x1a7590[_0x315c('0x30')][_0x315c('0x32')]?_0x1a7590[_0x315c('0x30')]:_0x2dea3f[_0x315c('0x2c')];if(_0x5b7617[_0x315c('0x2d')][_0x315c('0x3d')]){_0x1a7590[_0x315c('0x3e')]=[{'all':!![]}];}_0x1a7590=_[_0x315c('0x3a')]({},_0x1a7590,_0x5b7617[_0x315c('0x3c')]);return db[_0x315c('0x28')][_0x315c('0x44')](_0x1a7590)[_0x315c('0x21')](handleEntityNotFound(_0xad27af,null))[_0x315c('0x21')](respondWithResult(_0xad27af,null))['catch'](handleError(_0xad27af,null));};exports[_0x315c('0x45')]=function(_0x18f701,_0x3b3ddd){return db[_0x315c('0x28')][_0x315c('0x45')](_0x18f701[_0x315c('0x46')],{})[_0x315c('0x21')](respondWithResult(_0x3b3ddd,0xc9))[_0x315c('0x40')](handleError(_0x3b3ddd,null));};exports[_0x315c('0x20')]=function(_0x1b19ee,_0x549612){if(_0x1b19ee[_0x315c('0x46')]['id']){delete _0x1b19ee['body']['id'];}return db[_0x315c('0x28')]['find']({'where':{'id':_0x1b19ee['params']['id']}})[_0x315c('0x21')](handleEntityNotFound(_0x549612,null))['then'](saveUpdates(_0x1b19ee[_0x315c('0x46')],null))[_0x315c('0x21')](respondWithResult(_0x549612,null))[_0x315c('0x40')](handleError(_0x549612,null));};exports['destroy']=function(_0x9a6149,_0x1e9432){return db[_0x315c('0x28')][_0x315c('0x44')]({'where':{'id':_0x9a6149[_0x315c('0x42')]['id']}})[_0x315c('0x21')](handleEntityNotFound(_0x1e9432,null))[_0x315c('0x21')](removeEntity(_0x1e9432,null))[_0x315c('0x40')](handleError(_0x1e9432,null));};exports[_0x315c('0x47')]=function(_0x11d750,_0x59d5c4,_0x6d6617){var _0x272914={};var _0x1929c4={};var _0x34a75d;var _0xf09b0c;return db[_0x315c('0x28')][_0x315c('0x48')]({'where':{'id':_0x11d750[_0x315c('0x42')]['id']}})[_0x315c('0x21')](handleEntityNotFound(_0x59d5c4,null))[_0x315c('0x21')](function(_0x497730){if(_0x497730){_0x34a75d=_0x497730;_0x1929c4['model']=_[_0x315c('0x43')](db[_0x315c('0x49')][_0x315c('0x29')]);_0x1929c4[_0x315c('0x2d')]=_[_0x315c('0x43')](_0x11d750['query']);_0x1929c4[_0x315c('0x2e')]=_['intersection'](_0x1929c4['model'],_0x1929c4[_0x315c('0x2d')]);_0x272914[_0x315c('0x30')]=_[_0x315c('0x2f')](_0x1929c4[_0x315c('0x2c')],qs[_0x315c('0x31')](_0x11d750[_0x315c('0x2d')][_0x315c('0x31')]));_0x272914[_0x315c('0x30')]=_0x272914['attributes']['length']?_0x272914[_0x315c('0x30')]:_0x1929c4[_0x315c('0x2c')];_0x272914[_0x315c('0x35')]=qs[_0x315c('0x36')](_0x11d750[_0x315c('0x2d')][_0x315c('0x36')]);_0x272914[_0x315c('0x37')]=qs[_0x315c('0x2e')](_[_0x315c('0x38')](_0x11d750['query'],_0x1929c4[_0x315c('0x2e')]));if(_0x11d750[_0x315c('0x2d')]['filter']){_0x272914[_0x315c('0x37')]=_['merge'](_0x272914[_0x315c('0x37')],{'$or':_[_0x315c('0x27')](_0x272914[_0x315c('0x30')],function(_0x2ffa2e){var _0x3f1aee={};_0x3f1aee[_0x2ffa2e]={'$like':'%'+_0x11d750[_0x315c('0x2d')][_0x315c('0x39')]+'%'};return _0x3f1aee;})});}_0x272914=_[_0x315c('0x3a')]({},_0x272914,_0x11d750['options']);return _0x34a75d[_0x315c('0x47')](_0x272914);}})[_0x315c('0x21')](function(_0x1a4e24){if(_0x1a4e24){_0xf09b0c=_0x1a4e24['length'];if(!_0x11d750['query'][_0x315c('0x33')](_0x315c('0x34'))){_0x272914[_0x315c('0x1d')]=qs[_0x315c('0x1d')](_0x11d750[_0x315c('0x2d')]['limit']);_0x272914[_0x315c('0x1a')]=qs['offset'](_0x11d750[_0x315c('0x2d')][_0x315c('0x1a')]);}return _0x34a75d[_0x315c('0x47')](_0x272914);}})[_0x315c('0x21')](function(_0x1dd3f3){if(_0x1dd3f3){return _0x1dd3f3?{'count':_0xf09b0c,'rows':_0x1dd3f3}:null;}})[_0x315c('0x21')](respondWithResult(_0x59d5c4,null))[_0x315c('0x40')](handleError(_0x59d5c4,null));};exports['getSubjects']=function(_0x306a16,_0x282fb4,_0x2fc7d0){var _0x5636ef={};var _0x215fe6={};var _0x4e8005;var _0x22b967;return db[_0x315c('0x28')][_0x315c('0x48')]({'where':{'id':_0x306a16[_0x315c('0x42')]['id']}})[_0x315c('0x21')](handleEntityNotFound(_0x282fb4,null))[_0x315c('0x21')](function(_0x359f7d){if(_0x359f7d){_0x4e8005=_0x359f7d;_0x215fe6[_0x315c('0x2c')]=_[_0x315c('0x43')](db[_0x315c('0x49')][_0x315c('0x29')]);_0x215fe6[_0x315c('0x2d')]=_[_0x315c('0x43')](_0x306a16[_0x315c('0x2d')]);_0x215fe6[_0x315c('0x2e')]=_[_0x315c('0x2f')](_0x215fe6[_0x315c('0x2c')],_0x215fe6[_0x315c('0x2d')]);_0x5636ef[_0x315c('0x30')]=_[_0x315c('0x2f')](_0x215fe6['model'],qs[_0x315c('0x31')](_0x306a16[_0x315c('0x2d')][_0x315c('0x31')]));_0x5636ef[_0x315c('0x30')]=_0x5636ef[_0x315c('0x30')][_0x315c('0x32')]?_0x5636ef[_0x315c('0x30')]:_0x215fe6[_0x315c('0x2c')];_0x5636ef['order']=qs[_0x315c('0x36')](_0x306a16['query'][_0x315c('0x36')]);_0x5636ef['where']=qs['filters'](_['pick'](_0x306a16[_0x315c('0x2d')],_0x215fe6[_0x315c('0x2e')]));if(_0x306a16['query'][_0x315c('0x39')]){_0x5636ef[_0x315c('0x37')]=_[_0x315c('0x3a')](_0x5636ef['where'],{'$or':_[_0x315c('0x27')](_0x5636ef[_0x315c('0x30')],function(_0x37aaba){var _0x3f5de5={};_0x3f5de5[_0x37aaba]={'$like':'%'+_0x306a16[_0x315c('0x2d')]['filter']+'%'};return _0x3f5de5;})});}_0x5636ef=_['merge']({},_0x5636ef,_0x306a16['options']);return _0x4e8005[_0x315c('0x4a')](_0x5636ef);}})[_0x315c('0x21')](function(_0x335c99){if(_0x335c99){_0x22b967=_0x335c99[_0x315c('0x32')];if(!_0x306a16[_0x315c('0x2d')][_0x315c('0x33')](_0x315c('0x34'))){_0x5636ef[_0x315c('0x1d')]=qs[_0x315c('0x1d')](_0x306a16[_0x315c('0x2d')][_0x315c('0x1d')]);_0x5636ef[_0x315c('0x1a')]=qs['offset'](_0x306a16['query'][_0x315c('0x1a')]);}return _0x4e8005[_0x315c('0x4a')](_0x5636ef);}})[_0x315c('0x21')](function(_0x15f7ac){if(_0x15f7ac){return _0x15f7ac?{'count':_0x22b967,'rows':_0x15f7ac}:null;}})[_0x315c('0x21')](respondWithResult(_0x282fb4,null))[_0x315c('0x40')](handleError(_0x282fb4,null));};exports[_0x315c('0x4b')]=function(_0x425588,_0x3f9e9b,_0x52d464){var _0x11ae65={};var _0x11fa79={};var _0x38ca2f;var _0x3b36f8;return db[_0x315c('0x28')]['findOne']({'where':{'id':_0x425588[_0x315c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f9e9b,null))['then'](function(_0x108c8f){if(_0x108c8f){_0x38ca2f=_0x108c8f;_0x11fa79[_0x315c('0x2c')]=_[_0x315c('0x43')](db[_0x315c('0x49')][_0x315c('0x29')]);_0x11fa79['query']=_[_0x315c('0x43')](_0x425588[_0x315c('0x2d')]);_0x11fa79[_0x315c('0x2e')]=_[_0x315c('0x2f')](_0x11fa79[_0x315c('0x2c')],_0x11fa79[_0x315c('0x2d')]);_0x11ae65[_0x315c('0x30')]=_[_0x315c('0x2f')](_0x11fa79['model'],qs[_0x315c('0x31')](_0x425588[_0x315c('0x2d')][_0x315c('0x31')]));_0x11ae65[_0x315c('0x30')]=_0x11ae65[_0x315c('0x30')][_0x315c('0x32')]?_0x11ae65[_0x315c('0x30')]:_0x11fa79[_0x315c('0x2c')];_0x11ae65[_0x315c('0x35')]=qs[_0x315c('0x36')](_0x425588[_0x315c('0x2d')][_0x315c('0x36')]);_0x11ae65['where']=qs[_0x315c('0x2e')](_[_0x315c('0x38')](_0x425588[_0x315c('0x2d')],_0x11fa79[_0x315c('0x2e')]));if(_0x425588[_0x315c('0x2d')][_0x315c('0x39')]){_0x11ae65[_0x315c('0x37')]=_[_0x315c('0x3a')](_0x11ae65[_0x315c('0x37')],{'$or':_[_0x315c('0x27')](_0x11ae65[_0x315c('0x30')],function(_0x40f96e){var _0xe9e4be={};_0xe9e4be[_0x40f96e]={'$like':'%'+_0x425588[_0x315c('0x2d')]['filter']+'%'};return _0xe9e4be;})});}_0x11ae65=_[_0x315c('0x3a')]({},_0x11ae65,_0x425588[_0x315c('0x3c')]);return _0x38ca2f['getDescriptions'](_0x11ae65);}})[_0x315c('0x21')](function(_0x5e2686){if(_0x5e2686){_0x3b36f8=_0x5e2686[_0x315c('0x32')];if(!_0x425588[_0x315c('0x2d')][_0x315c('0x33')](_0x315c('0x34'))){_0x11ae65[_0x315c('0x1d')]=qs['limit'](_0x425588[_0x315c('0x2d')]['limit']);_0x11ae65['offset']=qs[_0x315c('0x1a')](_0x425588[_0x315c('0x2d')][_0x315c('0x1a')]);}return _0x38ca2f[_0x315c('0x4b')](_0x11ae65);}})[_0x315c('0x21')](function(_0x50935a){if(_0x50935a){return _0x50935a?{'count':_0x3b36f8,'rows':_0x50935a}:null;}})[_0x315c('0x21')](respondWithResult(_0x3f9e9b,null))[_0x315c('0x40')](handleError(_0x3f9e9b,null));};exports[_0x315c('0x4c')]=function(_0x34189a,_0x3e9409,_0x486ac4){var _0x344c33={};var _0x257bb7={};var _0x8c92f5;var _0x139d21;return db['DeskConfiguration'][_0x315c('0x48')]({'where':{'id':_0x34189a['params']['id']}})[_0x315c('0x21')](handleEntityNotFound(_0x3e9409,null))[_0x315c('0x21')](function(_0x3b0844){if(_0x3b0844){_0x8c92f5=_0x3b0844;_0x257bb7[_0x315c('0x2c')]=_[_0x315c('0x43')](db['Tag']['rawAttributes']);_0x257bb7[_0x315c('0x2d')]=_[_0x315c('0x43')](_0x34189a['query']);_0x257bb7[_0x315c('0x2e')]=_[_0x315c('0x2f')](_0x257bb7['model'],_0x257bb7[_0x315c('0x2d')]);_0x344c33[_0x315c('0x30')]=_[_0x315c('0x2f')](_0x257bb7[_0x315c('0x2c')],qs[_0x315c('0x31')](_0x34189a[_0x315c('0x2d')]['fields']));_0x344c33[_0x315c('0x30')]=_0x344c33['attributes'][_0x315c('0x32')]?_0x344c33[_0x315c('0x30')]:_0x257bb7[_0x315c('0x2c')];_0x344c33[_0x315c('0x35')]=qs['sort'](_0x34189a['query'][_0x315c('0x36')]);_0x344c33[_0x315c('0x37')]=qs[_0x315c('0x2e')](_[_0x315c('0x38')](_0x34189a[_0x315c('0x2d')],_0x257bb7[_0x315c('0x2e')]));if(_0x34189a['query'][_0x315c('0x39')]){_0x344c33[_0x315c('0x37')]=_[_0x315c('0x3a')](_0x344c33[_0x315c('0x37')],{'$or':_['map'](_0x344c33['attributes'],function(_0x2bc197){var _0x452a01={};_0x452a01[_0x2bc197]={'$like':'%'+_0x34189a[_0x315c('0x2d')][_0x315c('0x39')]+'%'};return _0x452a01;})});}_0x344c33=_[_0x315c('0x3a')]({},_0x344c33,_0x34189a[_0x315c('0x3c')]);return _0x8c92f5['getTags'](_0x344c33);}})[_0x315c('0x21')](function(_0x891a1d){if(_0x891a1d){_0x139d21=_0x891a1d[_0x315c('0x32')];if(!_0x34189a[_0x315c('0x2d')][_0x315c('0x33')](_0x315c('0x34'))){_0x344c33[_0x315c('0x1d')]=qs['limit'](_0x34189a[_0x315c('0x2d')][_0x315c('0x1d')]);_0x344c33[_0x315c('0x1a')]=qs[_0x315c('0x1a')](_0x34189a[_0x315c('0x2d')]['offset']);}return _0x8c92f5[_0x315c('0x4c')](_0x344c33);}})[_0x315c('0x21')](function(_0x494413){if(_0x494413){return _0x494413?{'count':_0x139d21,'rows':_0x494413}:null;}})[_0x315c('0x21')](respondWithResult(_0x3e9409,null))[_0x315c('0x40')](handleError(_0x3e9409,null));};exports[_0x315c('0x4d')]=function(_0x5cc912,_0x28e110,_0x6d32f4){if(_0x5cc912[_0x315c('0x46')]['id']){delete _0x5cc912['body']['id'];}return db['DeskConfiguration'][_0x315c('0x48')]({'where':{'id':_0x5cc912[_0x315c('0x42')]['id']}})[_0x315c('0x21')](handleEntityNotFound(_0x28e110,null))[_0x315c('0x21')](function(_0x2048ed){if(_0x2048ed){return _0x2048ed[_0x315c('0x4d')](_0x5cc912[_0x315c('0x46')][_0x315c('0x4e')]||[]);}return null;})['then'](respondWithResult(_0x28e110,null))['catch'](handleError(_0x28e110,null));}; \ No newline at end of file +var _0x6a65=['find','create','body','getFields','DeskField','nolimit','getSubjects','findOne','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','map','DeskConfiguration','rawAttributes','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params'];(function(_0x1ef202,_0x56ed5c){var _0x2166ef=function(_0x280116){while(--_0x280116){_0x1ef202['push'](_0x1ef202['shift']());}};_0x2166ef(++_0x56ed5c);}(_0x6a65,0xf6));var _0x56a6=function(_0x4d6bc6,_0x1baffa){_0x4d6bc6=_0x4d6bc6-0x0;var _0x1c8865=_0x6a65[_0x4d6bc6];return _0x1c8865;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56a6('0x0'));var zipdir=require(_0x56a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x56a6('0x2'));var moment=require(_0x56a6('0x3'));var BPromise=require(_0x56a6('0x4'));var Mustache=require(_0x56a6('0x5'));var util=require(_0x56a6('0x6'));var path=require(_0x56a6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x56a6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x56a6('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x56a6('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56a6('0xb'));var Redis=require(_0x56a6('0xc'));var authService=require(_0x56a6('0xd'));var qs=require(_0x56a6('0xe'));var as=require(_0x56a6('0xf'));var hardwareService=require(_0x56a6('0x10'));var logger=require(_0x56a6('0x11'))(_0x56a6('0x12'));var utils=require(_0x56a6('0x13'));var config=require(_0x56a6('0x14'));var licenseUtil=require(_0x56a6('0x15'));var db=require(_0x56a6('0x16'))['db'];function respondWithStatusCode(_0x27e2ec,_0x3e532f){_0x3e532f=_0x3e532f||0xcc;return function(_0x433cf2){if(_0x433cf2){return _0x27e2ec[_0x56a6('0x17')](_0x3e532f);}return _0x27e2ec[_0x56a6('0x18')](_0x3e532f)[_0x56a6('0x19')]();};}function respondWithResult(_0x28d214,_0x58dfce){_0x58dfce=_0x58dfce||0xc8;return function(_0x23456a){if(_0x23456a){return _0x28d214[_0x56a6('0x18')](_0x58dfce)[_0x56a6('0x1a')](_0x23456a);}};}function respondWithFilteredResult(_0x1cb26f,_0x128094){return function(_0xa8efc5){if(_0xa8efc5){var _0x4b6a95=typeof _0x128094['offset']===_0x56a6('0x1b')&&typeof _0x128094['limit']===_0x56a6('0x1b');var _0x4e6c2b=_0xa8efc5[_0x56a6('0x1c')];var _0x3d7f29=_0x4b6a95?0x0:_0x128094[_0x56a6('0x1d')];var _0x4cf391=_0x4b6a95?_0xa8efc5[_0x56a6('0x1c')]:_0x128094[_0x56a6('0x1d')]+_0x128094[_0x56a6('0x1e')];var _0x3ae264;if(_0x4cf391>=_0x4e6c2b){_0x4cf391=_0x4e6c2b;_0x3ae264=0xc8;}else{_0x3ae264=0xce;}_0x1cb26f[_0x56a6('0x18')](_0x3ae264);return _0x1cb26f[_0x56a6('0x1f')](_0x56a6('0x20'),_0x3d7f29+'-'+_0x4cf391+'/'+_0x4e6c2b)[_0x56a6('0x1a')](_0xa8efc5);}return null;};}function patchUpdates(_0x57c92f){return function(_0x395163){try{jsonpatch[_0x56a6('0x21')](_0x395163,_0x57c92f,!![]);}catch(_0x8401d5){return BPromise[_0x56a6('0x22')](_0x8401d5);}return _0x395163['save']();};}function saveUpdates(_0x372c4e,_0x13760e){return function(_0x263802){if(_0x263802){return _0x263802[_0x56a6('0x23')](_0x372c4e)['then'](function(_0x4c439f){return _0x4c439f;});}return null;};}function removeEntity(_0xc8f6d8,_0x446890){return function(_0x4839c6){if(_0x4839c6){return _0x4839c6[_0x56a6('0x24')]()[_0x56a6('0x25')](function(){_0xc8f6d8[_0x56a6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cc905,_0x8260b4){return function(_0x18107e){if(!_0x18107e){_0x1cc905[_0x56a6('0x17')](0x194);}return _0x18107e;};}function handleError(_0x2225de,_0x4431fb){_0x4431fb=_0x4431fb||0x1f4;return function(_0x18ceb7){logger[_0x56a6('0x26')](_0x18ceb7['stack']);if(_0x18ceb7[_0x56a6('0x27')]){delete _0x18ceb7[_0x56a6('0x27')];}_0x2225de[_0x56a6('0x18')](_0x4431fb)['send'](_0x18ceb7);};}exports['index']=function(_0x1130ba,_0x27ccbd){var _0xe11ea2={},_0x299b45={},_0x4c1aff={'count':0x0,'rows':[]};var _0xeab7af=_[_0x56a6('0x28')](db[_0x56a6('0x29')][_0x56a6('0x2a')],function(_0x36da04){return{'name':_0x36da04['fieldName'],'type':_0x36da04[_0x56a6('0x2b')]['key']};});_0x299b45['model']=_[_0x56a6('0x28')](_0xeab7af,'name');_0x299b45[_0x56a6('0x2c')]=_[_0x56a6('0x2d')](_0x1130ba[_0x56a6('0x2c')]);_0x299b45['filters']=_[_0x56a6('0x2e')](_0x299b45[_0x56a6('0x2f')],_0x299b45[_0x56a6('0x2c')]);_0xe11ea2['attributes']=_[_0x56a6('0x2e')](_0x299b45[_0x56a6('0x2f')],qs['fields'](_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x30')]));_0xe11ea2[_0x56a6('0x31')]=_0xe11ea2[_0x56a6('0x31')][_0x56a6('0x32')]?_0xe11ea2['attributes']:_0x299b45[_0x56a6('0x2f')];if(!_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x33')]('nolimit')){_0xe11ea2[_0x56a6('0x1e')]=qs[_0x56a6('0x1e')](_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x1e')]);_0xe11ea2[_0x56a6('0x1d')]=qs[_0x56a6('0x1d')](_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x1d')]);}_0xe11ea2[_0x56a6('0x34')]=qs[_0x56a6('0x35')](_0x1130ba[_0x56a6('0x2c')]['sort']);_0xe11ea2[_0x56a6('0x36')]=qs[_0x56a6('0x37')](_[_0x56a6('0x38')](_0x1130ba[_0x56a6('0x2c')],_0x299b45[_0x56a6('0x37')]),_0xeab7af);if(_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x39')]){_0xe11ea2[_0x56a6('0x36')]=_[_0x56a6('0x3a')](_0xe11ea2[_0x56a6('0x36')],{'$or':_['map'](_0xeab7af,function(_0x9f8a71){if(_0x9f8a71[_0x56a6('0x2b')]!==_0x56a6('0x3b')){var _0x536512={};_0x536512[_0x9f8a71[_0x56a6('0x27')]]={'$like':'%'+_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x39')]+'%'};return _0x536512;}})});}_0xe11ea2=_['merge']({},_0xe11ea2,_0x1130ba[_0x56a6('0x3c')]);var _0x3127fa={'where':_0xe11ea2[_0x56a6('0x36')]};return db[_0x56a6('0x29')][_0x56a6('0x1c')](_0x3127fa)['then'](function(_0x477e2b){_0x4c1aff[_0x56a6('0x1c')]=_0x477e2b;if(_0x1130ba['query'][_0x56a6('0x3d')]){_0xe11ea2[_0x56a6('0x3e')]=[{'all':!![]}];}return db[_0x56a6('0x29')]['findAll'](_0xe11ea2);})[_0x56a6('0x25')](function(_0x579ae3){_0x4c1aff['rows']=_0x579ae3;return _0x4c1aff;})['then'](respondWithFilteredResult(_0x27ccbd,_0xe11ea2))[_0x56a6('0x3f')](handleError(_0x27ccbd,null));};exports[_0x56a6('0x40')]=function(_0x5b2eab,_0x3fdf28){var _0xed86b={'raw':![],'where':{'id':_0x5b2eab[_0x56a6('0x41')]['id']}},_0x28689b={};_0x28689b['model']=_['keys'](db[_0x56a6('0x29')][_0x56a6('0x2a')]);_0x28689b[_0x56a6('0x2c')]=_['keys'](_0x5b2eab[_0x56a6('0x2c')]);_0x28689b[_0x56a6('0x37')]=_['intersection'](_0x28689b['model'],_0x28689b[_0x56a6('0x2c')]);_0xed86b[_0x56a6('0x31')]=_[_0x56a6('0x2e')](_0x28689b[_0x56a6('0x2f')],qs[_0x56a6('0x30')](_0x5b2eab[_0x56a6('0x2c')][_0x56a6('0x30')]));_0xed86b['attributes']=_0xed86b['attributes']['length']?_0xed86b['attributes']:_0x28689b[_0x56a6('0x2f')];if(_0x5b2eab[_0x56a6('0x2c')][_0x56a6('0x3d')]){_0xed86b[_0x56a6('0x3e')]=[{'all':!![]}];}_0xed86b=_[_0x56a6('0x3a')]({},_0xed86b,_0x5b2eab[_0x56a6('0x3c')]);return db[_0x56a6('0x29')][_0x56a6('0x42')](_0xed86b)[_0x56a6('0x25')](handleEntityNotFound(_0x3fdf28,null))[_0x56a6('0x25')](respondWithResult(_0x3fdf28,null))[_0x56a6('0x3f')](handleError(_0x3fdf28,null));};exports[_0x56a6('0x43')]=function(_0x45ffe1,_0x3fdc90){return db[_0x56a6('0x29')][_0x56a6('0x43')](_0x45ffe1[_0x56a6('0x44')],{})[_0x56a6('0x25')](respondWithResult(_0x3fdc90,0xc9))['catch'](handleError(_0x3fdc90,null));};exports[_0x56a6('0x23')]=function(_0x2536fd,_0x292a0e){if(_0x2536fd['body']['id']){delete _0x2536fd[_0x56a6('0x44')]['id'];}return db[_0x56a6('0x29')][_0x56a6('0x42')]({'where':{'id':_0x2536fd[_0x56a6('0x41')]['id']}})[_0x56a6('0x25')](handleEntityNotFound(_0x292a0e,null))[_0x56a6('0x25')](saveUpdates(_0x2536fd[_0x56a6('0x44')],null))['then'](respondWithResult(_0x292a0e,null))[_0x56a6('0x3f')](handleError(_0x292a0e,null));};exports['destroy']=function(_0x2d0e67,_0x4a35bc){return db[_0x56a6('0x29')][_0x56a6('0x42')]({'where':{'id':_0x2d0e67[_0x56a6('0x41')]['id']}})[_0x56a6('0x25')](handleEntityNotFound(_0x4a35bc,null))['then'](removeEntity(_0x4a35bc,null))[_0x56a6('0x3f')](handleError(_0x4a35bc,null));};exports[_0x56a6('0x45')]=function(_0x1d82c8,_0x3d9a9c,_0x161188){var _0x1239f2={};var _0x4059b1={};var _0x3e74c8;var _0x2a9ee5;return db[_0x56a6('0x29')]['findOne']({'where':{'id':_0x1d82c8[_0x56a6('0x41')]['id']}})[_0x56a6('0x25')](handleEntityNotFound(_0x3d9a9c,null))[_0x56a6('0x25')](function(_0x12cc8e){if(_0x12cc8e){_0x3e74c8=_0x12cc8e;_0x4059b1[_0x56a6('0x2f')]=_[_0x56a6('0x2d')](db[_0x56a6('0x46')][_0x56a6('0x2a')]);_0x4059b1[_0x56a6('0x2c')]=_[_0x56a6('0x2d')](_0x1d82c8['query']);_0x4059b1[_0x56a6('0x37')]=_[_0x56a6('0x2e')](_0x4059b1[_0x56a6('0x2f')],_0x4059b1['query']);_0x1239f2[_0x56a6('0x31')]=_['intersection'](_0x4059b1[_0x56a6('0x2f')],qs[_0x56a6('0x30')](_0x1d82c8[_0x56a6('0x2c')]['fields']));_0x1239f2['attributes']=_0x1239f2[_0x56a6('0x31')][_0x56a6('0x32')]?_0x1239f2['attributes']:_0x4059b1['model'];_0x1239f2[_0x56a6('0x34')]=qs[_0x56a6('0x35')](_0x1d82c8['query']['sort']);_0x1239f2[_0x56a6('0x36')]=qs[_0x56a6('0x37')](_[_0x56a6('0x38')](_0x1d82c8['query'],_0x4059b1[_0x56a6('0x37')]));if(_0x1d82c8[_0x56a6('0x2c')][_0x56a6('0x39')]){_0x1239f2['where']=_[_0x56a6('0x3a')](_0x1239f2[_0x56a6('0x36')],{'$or':_[_0x56a6('0x28')](_0x1239f2[_0x56a6('0x31')],function(_0x30b26f){var _0x1f96b5={};_0x1f96b5[_0x30b26f]={'$like':'%'+_0x1d82c8[_0x56a6('0x2c')][_0x56a6('0x39')]+'%'};return _0x1f96b5;})});}_0x1239f2=_[_0x56a6('0x3a')]({},_0x1239f2,_0x1d82c8[_0x56a6('0x3c')]);return _0x3e74c8['getFields'](_0x1239f2);}})[_0x56a6('0x25')](function(_0x299a9e){if(_0x299a9e){_0x2a9ee5=_0x299a9e['length'];if(!_0x1d82c8[_0x56a6('0x2c')][_0x56a6('0x33')](_0x56a6('0x47'))){_0x1239f2['limit']=qs[_0x56a6('0x1e')](_0x1d82c8[_0x56a6('0x2c')][_0x56a6('0x1e')]);_0x1239f2[_0x56a6('0x1d')]=qs['offset'](_0x1d82c8[_0x56a6('0x2c')][_0x56a6('0x1d')]);}return _0x3e74c8[_0x56a6('0x45')](_0x1239f2);}})[_0x56a6('0x25')](function(_0xcd88cb){if(_0xcd88cb){return _0xcd88cb?{'count':_0x2a9ee5,'rows':_0xcd88cb}:null;}})[_0x56a6('0x25')](respondWithResult(_0x3d9a9c,null))[_0x56a6('0x3f')](handleError(_0x3d9a9c,null));};exports[_0x56a6('0x48')]=function(_0x2b253d,_0x1fa62,_0x5d4bd8){var _0x2a8642={};var _0x100fab={};var _0x720bd8;var _0x21b8a4;return db[_0x56a6('0x29')][_0x56a6('0x49')]({'where':{'id':_0x2b253d[_0x56a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x1fa62,null))[_0x56a6('0x25')](function(_0x5b7b59){if(_0x5b7b59){_0x720bd8=_0x5b7b59;_0x100fab['model']=_[_0x56a6('0x2d')](db[_0x56a6('0x46')][_0x56a6('0x2a')]);_0x100fab[_0x56a6('0x2c')]=_[_0x56a6('0x2d')](_0x2b253d[_0x56a6('0x2c')]);_0x100fab['filters']=_[_0x56a6('0x2e')](_0x100fab[_0x56a6('0x2f')],_0x100fab['query']);_0x2a8642['attributes']=_[_0x56a6('0x2e')](_0x100fab[_0x56a6('0x2f')],qs[_0x56a6('0x30')](_0x2b253d[_0x56a6('0x2c')]['fields']));_0x2a8642[_0x56a6('0x31')]=_0x2a8642[_0x56a6('0x31')]['length']?_0x2a8642[_0x56a6('0x31')]:_0x100fab[_0x56a6('0x2f')];_0x2a8642[_0x56a6('0x34')]=qs[_0x56a6('0x35')](_0x2b253d[_0x56a6('0x2c')][_0x56a6('0x35')]);_0x2a8642[_0x56a6('0x36')]=qs[_0x56a6('0x37')](_[_0x56a6('0x38')](_0x2b253d[_0x56a6('0x2c')],_0x100fab[_0x56a6('0x37')]));if(_0x2b253d['query'][_0x56a6('0x39')]){_0x2a8642[_0x56a6('0x36')]=_[_0x56a6('0x3a')](_0x2a8642['where'],{'$or':_['map'](_0x2a8642['attributes'],function(_0x1d5a41){var _0x43b74e={};_0x43b74e[_0x1d5a41]={'$like':'%'+_0x2b253d['query'][_0x56a6('0x39')]+'%'};return _0x43b74e;})});}_0x2a8642=_[_0x56a6('0x3a')]({},_0x2a8642,_0x2b253d[_0x56a6('0x3c')]);return _0x720bd8[_0x56a6('0x48')](_0x2a8642);}})[_0x56a6('0x25')](function(_0x544e81){if(_0x544e81){_0x21b8a4=_0x544e81[_0x56a6('0x32')];if(!_0x2b253d[_0x56a6('0x2c')]['hasOwnProperty']('nolimit')){_0x2a8642[_0x56a6('0x1e')]=qs[_0x56a6('0x1e')](_0x2b253d['query'][_0x56a6('0x1e')]);_0x2a8642[_0x56a6('0x1d')]=qs['offset'](_0x2b253d[_0x56a6('0x2c')][_0x56a6('0x1d')]);}return _0x720bd8['getSubjects'](_0x2a8642);}})['then'](function(_0x38502f){if(_0x38502f){return _0x38502f?{'count':_0x21b8a4,'rows':_0x38502f}:null;}})[_0x56a6('0x25')](respondWithResult(_0x1fa62,null))[_0x56a6('0x3f')](handleError(_0x1fa62,null));};exports['getDescriptions']=function(_0x39397f,_0x383670,_0x43a938){var _0x2a38dd={};var _0x56332a={};var _0x1aa679;var _0x42318c;return db['DeskConfiguration'][_0x56a6('0x49')]({'where':{'id':_0x39397f['params']['id']}})['then'](handleEntityNotFound(_0x383670,null))[_0x56a6('0x25')](function(_0x14b131){if(_0x14b131){_0x1aa679=_0x14b131;_0x56332a[_0x56a6('0x2f')]=_[_0x56a6('0x2d')](db[_0x56a6('0x46')]['rawAttributes']);_0x56332a[_0x56a6('0x2c')]=_['keys'](_0x39397f['query']);_0x56332a[_0x56a6('0x37')]=_[_0x56a6('0x2e')](_0x56332a[_0x56a6('0x2f')],_0x56332a[_0x56a6('0x2c')]);_0x2a38dd['attributes']=_[_0x56a6('0x2e')](_0x56332a[_0x56a6('0x2f')],qs[_0x56a6('0x30')](_0x39397f[_0x56a6('0x2c')][_0x56a6('0x30')]));_0x2a38dd[_0x56a6('0x31')]=_0x2a38dd['attributes'][_0x56a6('0x32')]?_0x2a38dd['attributes']:_0x56332a[_0x56a6('0x2f')];_0x2a38dd[_0x56a6('0x34')]=qs[_0x56a6('0x35')](_0x39397f[_0x56a6('0x2c')][_0x56a6('0x35')]);_0x2a38dd['where']=qs[_0x56a6('0x37')](_['pick'](_0x39397f[_0x56a6('0x2c')],_0x56332a[_0x56a6('0x37')]));if(_0x39397f[_0x56a6('0x2c')]['filter']){_0x2a38dd[_0x56a6('0x36')]=_[_0x56a6('0x3a')](_0x2a38dd['where'],{'$or':_[_0x56a6('0x28')](_0x2a38dd[_0x56a6('0x31')],function(_0x4555c0){var _0x498fb1={};_0x498fb1[_0x4555c0]={'$like':'%'+_0x39397f[_0x56a6('0x2c')][_0x56a6('0x39')]+'%'};return _0x498fb1;})});}_0x2a38dd=_[_0x56a6('0x3a')]({},_0x2a38dd,_0x39397f[_0x56a6('0x3c')]);return _0x1aa679[_0x56a6('0x4a')](_0x2a38dd);}})[_0x56a6('0x25')](function(_0x82ca59){if(_0x82ca59){_0x42318c=_0x82ca59[_0x56a6('0x32')];if(!_0x39397f['query'][_0x56a6('0x33')](_0x56a6('0x47'))){_0x2a38dd[_0x56a6('0x1e')]=qs[_0x56a6('0x1e')](_0x39397f['query'][_0x56a6('0x1e')]);_0x2a38dd[_0x56a6('0x1d')]=qs[_0x56a6('0x1d')](_0x39397f[_0x56a6('0x2c')][_0x56a6('0x1d')]);}return _0x1aa679[_0x56a6('0x4a')](_0x2a38dd);}})[_0x56a6('0x25')](function(_0x460507){if(_0x460507){return _0x460507?{'count':_0x42318c,'rows':_0x460507}:null;}})[_0x56a6('0x25')](respondWithResult(_0x383670,null))[_0x56a6('0x3f')](handleError(_0x383670,null));};exports[_0x56a6('0x4b')]=function(_0x18de0e,_0x435405,_0x301c35){var _0xdb6c3f={};var _0x4e9b9a={};var _0x4729e1;var _0x395f6b;return db[_0x56a6('0x29')][_0x56a6('0x49')]({'where':{'id':_0x18de0e[_0x56a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x435405,null))[_0x56a6('0x25')](function(_0x4f7540){if(_0x4f7540){_0x4729e1=_0x4f7540;_0x4e9b9a[_0x56a6('0x2f')]=_[_0x56a6('0x2d')](db['Tag']['rawAttributes']);_0x4e9b9a[_0x56a6('0x2c')]=_['keys'](_0x18de0e[_0x56a6('0x2c')]);_0x4e9b9a['filters']=_[_0x56a6('0x2e')](_0x4e9b9a[_0x56a6('0x2f')],_0x4e9b9a[_0x56a6('0x2c')]);_0xdb6c3f[_0x56a6('0x31')]=_['intersection'](_0x4e9b9a[_0x56a6('0x2f')],qs[_0x56a6('0x30')](_0x18de0e[_0x56a6('0x2c')]['fields']));_0xdb6c3f[_0x56a6('0x31')]=_0xdb6c3f['attributes']['length']?_0xdb6c3f[_0x56a6('0x31')]:_0x4e9b9a[_0x56a6('0x2f')];_0xdb6c3f[_0x56a6('0x34')]=qs[_0x56a6('0x35')](_0x18de0e[_0x56a6('0x2c')]['sort']);_0xdb6c3f['where']=qs[_0x56a6('0x37')](_[_0x56a6('0x38')](_0x18de0e[_0x56a6('0x2c')],_0x4e9b9a[_0x56a6('0x37')]));if(_0x18de0e[_0x56a6('0x2c')]['filter']){_0xdb6c3f[_0x56a6('0x36')]=_[_0x56a6('0x3a')](_0xdb6c3f[_0x56a6('0x36')],{'$or':_[_0x56a6('0x28')](_0xdb6c3f['attributes'],function(_0x20c4f2){var _0x1bae0f={};_0x1bae0f[_0x20c4f2]={'$like':'%'+_0x18de0e[_0x56a6('0x2c')][_0x56a6('0x39')]+'%'};return _0x1bae0f;})});}_0xdb6c3f=_[_0x56a6('0x3a')]({},_0xdb6c3f,_0x18de0e[_0x56a6('0x3c')]);return _0x4729e1['getTags'](_0xdb6c3f);}})['then'](function(_0x35b42a){if(_0x35b42a){_0x395f6b=_0x35b42a[_0x56a6('0x32')];if(!_0x18de0e['query']['hasOwnProperty'](_0x56a6('0x47'))){_0xdb6c3f[_0x56a6('0x1e')]=qs[_0x56a6('0x1e')](_0x18de0e[_0x56a6('0x2c')][_0x56a6('0x1e')]);_0xdb6c3f['offset']=qs[_0x56a6('0x1d')](_0x18de0e[_0x56a6('0x2c')]['offset']);}return _0x4729e1[_0x56a6('0x4b')](_0xdb6c3f);}})['then'](function(_0x1f1cb6){if(_0x1f1cb6){return _0x1f1cb6?{'count':_0x395f6b,'rows':_0x1f1cb6}:null;}})['then'](respondWithResult(_0x435405,null))[_0x56a6('0x3f')](handleError(_0x435405,null));};exports[_0x56a6('0x4c')]=function(_0x5a6338,_0x150ee1,_0x50affe){if(_0x5a6338[_0x56a6('0x44')]['id']){delete _0x5a6338[_0x56a6('0x44')]['id'];}return db[_0x56a6('0x29')][_0x56a6('0x49')]({'where':{'id':_0x5a6338[_0x56a6('0x41')]['id']}})[_0x56a6('0x25')](handleEntityNotFound(_0x150ee1,null))[_0x56a6('0x25')](function(_0x2f5a48){if(_0x2f5a48){return _0x2f5a48[_0x56a6('0x4c')](_0x5a6338[_0x56a6('0x44')][_0x56a6('0x4d')]||[]);}return null;})[_0x56a6('0x25')](respondWithResult(_0x150ee1,null))[_0x56a6('0x3f')](handleError(_0x150ee1,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index bb6deef..1e974ee 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 _0x128e=['request-promise','path','rimraf','../../config/environment','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','moment'];(function(_0x1759cb,_0x420e01){var _0x5b2f38=function(_0x24a452){while(--_0x24a452){_0x1759cb['push'](_0x1759cb['shift']());}};_0x5b2f38(++_0x420e01);}(_0x128e,0xfa));var _0xe128=function(_0x239c98,_0x48423e){_0x239c98=_0x239c98-0x0;var _0x13b564=_0x128e[_0x239c98];return _0x13b564;};'use strict';var _=require(_0xe128('0x0'));var util=require(_0xe128('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe128('0x2'));var BPromise=require('bluebird');var rp=require(_0xe128('0x3'));var fs=require('fs');var path=require(_0xe128('0x4'));var rimraf=require(_0xe128('0x5'));var config=require(_0xe128('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0xe128('0x7')]=function(_0x650c02,_0x37d558){return _0x650c02[_0xe128('0x8')](_0xe128('0x9'),attributes,{'tableName':_0xe128('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35d4=['exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x2ac187,_0x510b7c){var _0x1e8846=function(_0xc341da){while(--_0xc341da){_0x2ac187['push'](_0x2ac187['shift']());}};_0x1e8846(++_0x510b7c);}(_0x35d4,0x170));var _0x435d=function(_0x1ee0ed,_0x48798f){_0x1ee0ed=_0x1ee0ed-0x0;var _0x1a21a6=_0x35d4[_0x1ee0ed];return _0x1a21a6;};'use strict';var _=require(_0x435d('0x0'));var util=require(_0x435d('0x1'));var logger=require('../../config/logger')(_0x435d('0x2'));var moment=require(_0x435d('0x3'));var BPromise=require(_0x435d('0x4'));var rp=require(_0x435d('0x5'));var fs=require('fs');var path=require(_0x435d('0x6'));var rimraf=require(_0x435d('0x7'));var config=require(_0x435d('0x8'));var attributes=require(_0x435d('0x9'));module[_0x435d('0xa')]=function(_0x2ca508,_0x4cf66c){return _0x2ca508[_0x435d('0xb')](_0x435d('0xc'),attributes,{'tableName':_0x435d('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 a63309b..7ac724e 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 _0x6b19=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','moment','bluebird'];(function(_0xa2bc57,_0x3df0f4){var _0x509502=function(_0x380236){while(--_0x380236){_0xa2bc57['push'](_0xa2bc57['shift']());}};_0x509502(++_0x3df0f4);}(_0x6b19,0xf4));var _0x96b1=function(_0x43d1c0,_0x177755){_0x43d1c0=_0x43d1c0-0x0;var _0x49c553=_0x6b19[_0x43d1c0];return _0x49c553;};'use strict';var _=require(_0x96b1('0x0'));var util=require('util');var moment=require(_0x96b1('0x1'));var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96b1('0x3'));var db=require(_0x96b1('0x4'))['db'];var utils=require(_0x96b1('0x5'));var logger=require(_0x96b1('0x6'))('rpc');var config=require(_0x96b1('0x7'));var jayson=require(_0x96b1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x288d77,_0x2347c5,_0x519fbe){return new BPromise(function(_0x280b00,_0x2300ad){return client['request'](_0x288d77,_0x519fbe)[_0x96b1('0x9')](function(_0x6323a6){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x2347c5,_0x96b1('0xc'));logger['debug'](_0x96b1('0xd'),_0x2347c5,'request\x20sent',JSON['stringify'](_0x6323a6));if(_0x6323a6['error']){if(_0x6323a6['error'][_0x96b1('0xe')]===0x1f4){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x2300ad(_0x6323a6['error'][_0x96b1('0x10')]);}logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x280b00(_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x2347c5,'request\x20sent');_0x280b00(_0x6323a6[_0x96b1('0x11')][_0x96b1('0x10')]);}})[_0x96b1('0x12')](function(_0x350b2c){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x350b2c);_0x2300ad(_0x350b2c);});});} \ No newline at end of file +var _0xcbe2=['error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4db8bd,_0x1ddb2e){var _0x5db7ec=function(_0x9c98ec){while(--_0x9c98ec){_0x4db8bd['push'](_0x4db8bd['shift']());}};_0x5db7ec(++_0x1ddb2e);}(_0xcbe2,0x148));var _0x2cbe=function(_0x239528,_0x1efe70){_0x239528=_0x239528-0x0;var _0x4e355d=_0xcbe2[_0x239528];return _0x4e355d;};'use strict';var _=require(_0x2cbe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2cbe('0x1'));var rs=require(_0x2cbe('0x2'));var fs=require('fs');var Redis=require(_0x2cbe('0x3'));var db=require(_0x2cbe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cbe('0x5'))(_0x2cbe('0x6'));var config=require(_0x2cbe('0x7'));var jayson=require(_0x2cbe('0x8'));var client=jayson[_0x2cbe('0x9')][_0x2cbe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bb0ea,_0x267166,_0xcbecb0){return new BPromise(function(_0x3756d6,_0x230742){return client[_0x2cbe('0xb')](_0x4bb0ea,_0xcbecb0)['then'](function(_0x47b0fd){logger[_0x2cbe('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x267166,_0x2cbe('0xd'));logger[_0x2cbe('0xe')](_0x2cbe('0xf'),_0x267166,'request\x20sent',JSON[_0x2cbe('0x10')](_0x47b0fd));if(_0x47b0fd[_0x2cbe('0x11')]){if(_0x47b0fd[_0x2cbe('0x11')][_0x2cbe('0x12')]===0x1f4){logger[_0x2cbe('0x11')](_0x2cbe('0x13'),_0x267166,_0x47b0fd['error'][_0x2cbe('0x14')]);return _0x230742(_0x47b0fd[_0x2cbe('0x11')][_0x2cbe('0x14')]);}logger[_0x2cbe('0x11')](_0x2cbe('0x13'),_0x267166,_0x47b0fd[_0x2cbe('0x11')][_0x2cbe('0x14')]);return _0x3756d6(_0x47b0fd[_0x2cbe('0x11')]['message']);}else{logger[_0x2cbe('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x267166,'request\x20sent');_0x3756d6(_0x47b0fd[_0x2cbe('0x15')]['message']);}})[_0x2cbe('0x16')](function(_0x472aee){logger['error'](_0x2cbe('0x13'),_0x267166,_0x472aee);_0x230742(_0x472aee);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ea77432..f11ff5a 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 _0xd291=['show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x392ab8,_0x58e99e){var _0x49a8e2=function(_0x1eebe8){while(--_0x1eebe8){_0x392ab8['push'](_0x392ab8['shift']());}};_0x49a8e2(++_0x58e99e);}(_0xd291,0xae));var _0x1d29=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd291[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1d29('0x0'));var util=require(_0x1d29('0x1'));var path=require(_0x1d29('0x2'));var timeout=require(_0x1d29('0x3'));var express=require(_0x1d29('0x4'));var router=express[_0x1d29('0x5')]();var fs_extra=require(_0x1d29('0x6'));var auth=require(_0x1d29('0x7'));var interaction=require(_0x1d29('0x8'));var config=require(_0x1d29('0x9'));var controller=require(_0x1d29('0xa'));router[_0x1d29('0xb')]('/',auth[_0x1d29('0xc')](),controller[_0x1d29('0xd')]);router[_0x1d29('0xb')](_0x1d29('0xe'),auth['isAuthenticated'](),controller[_0x1d29('0xf')]);router[_0x1d29('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1d29('0x11')](_0x1d29('0xe'),auth[_0x1d29('0xc')](),controller['update']);router[_0x1d29('0x12')](_0x1d29('0xe'),auth[_0x1d29('0xc')](),controller[_0x1d29('0x13')]);module[_0x1d29('0x14')]=router; \ No newline at end of file +var _0xf960=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x39d1b8,_0x1ae09a){var _0x9b9e1c=function(_0x8aeb5f){while(--_0x8aeb5f){_0x39d1b8['push'](_0x39d1b8['shift']());}};_0x9b9e1c(++_0x1ae09a);}(_0xf960,0x190));var _0x0f96=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xf960[_0x101e7b];return _0x4995c0;};'use strict';var multer=require(_0x0f96('0x0'));var util=require(_0x0f96('0x1'));var path=require(_0x0f96('0x2'));var timeout=require(_0x0f96('0x3'));var express=require(_0x0f96('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0f96('0x5'));var interaction=require(_0x0f96('0x6'));var config=require(_0x0f96('0x7'));var controller=require(_0x0f96('0x8'));router[_0x0f96('0x9')]('/',auth[_0x0f96('0xa')](),controller[_0x0f96('0xb')]);router[_0x0f96('0x9')](_0x0f96('0xc'),auth[_0x0f96('0xa')](),controller[_0x0f96('0xd')]);router[_0x0f96('0xe')]('/',auth[_0x0f96('0xa')](),controller[_0x0f96('0xf')]);router[_0x0f96('0x10')]('/:id',auth[_0x0f96('0xa')](),controller['update']);router[_0x0f96('0x11')](_0x0f96('0xc'),auth[_0x0f96('0xa')](),controller[_0x0f96('0x12')]);module[_0x0f96('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 6cdf12c..279794a 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 _0x6d78=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x1c62d0,_0x1a7700){var _0x3b2ef0=function(_0x1b2823){while(--_0x1b2823){_0x1c62d0['push'](_0x1c62d0['shift']());}};_0x3b2ef0(++_0x1a7700);}(_0x6d78,0x92));var _0x86d7=function(_0x189406,_0x3ce38d){_0x189406=_0x189406-0x0;var _0x180d41=_0x6d78[_0x189406];return _0x180d41;};'use strict';var Sequelize=require('sequelize');module[_0x86d7('0x0')]={'type':{'type':Sequelize[_0x86d7('0x1')](_0x86d7('0x2'),_0x86d7('0x3'),_0x86d7('0x4'),_0x86d7('0x5'),_0x86d7('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x86d7('0x7')]},'key':{'type':Sequelize[_0x86d7('0x7')]},'keyType':{'type':Sequelize[_0x86d7('0x1')](_0x86d7('0x2'),'variable',_0x86d7('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x86d7('0x7')]},'nameField':{'type':Sequelize[_0x86d7('0x7')]},'customField':{'type':Sequelize[_0x86d7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x86d7('0x7')]}}; \ No newline at end of file +var _0xcd0e=['customVariable','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x494da7,_0x35652b){var _0x32fa83=function(_0x59485d){while(--_0x59485d){_0x494da7['push'](_0x494da7['shift']());}};_0x32fa83(++_0x35652b);}(_0xcd0e,0x9e));var _0xecd0=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xcd0e[_0x5d7227];return _0x15ac55;};'use strict';var Sequelize=require(_0xecd0('0x0'));module[_0xecd0('0x1')]={'type':{'type':Sequelize[_0xecd0('0x2')](_0xecd0('0x3'),'variable',_0xecd0('0x4'),'keyValue',_0xecd0('0x5')),'defaultValue':_0xecd0('0x3')},'content':{'type':Sequelize[_0xecd0('0x6')]},'key':{'type':Sequelize[_0xecd0('0x6')]},'keyType':{'type':Sequelize[_0xecd0('0x2')](_0xecd0('0x3'),_0xecd0('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xecd0('0x6')]},'idField':{'type':Sequelize[_0xecd0('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xecd0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xecd0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5a1b46c..61c2430 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 _0x3189=['order','sort','where','pick','filter','merge','VIRTUAL','options','DeskField','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','send','index','map','rawAttributes','fieldName','type','name','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit'];(function(_0x209e59,_0x5343c0){var _0x4fd0a3=function(_0x33726b){while(--_0x33726b){_0x209e59['push'](_0x209e59['shift']());}};_0x4fd0a3(++_0x5343c0);}(_0x3189,0x19a));var _0x9318=function(_0x36a12a,_0x596232){_0x36a12a=_0x36a12a-0x0;var _0x2bd556=_0x3189[_0x36a12a];return _0x2bd556;};'use strict';var emlformat=require(_0x9318('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9318('0x1'));var jsonpatch=require(_0x9318('0x2'));var rp=require(_0x9318('0x3'));var moment=require(_0x9318('0x4'));var BPromise=require(_0x9318('0x5'));var Mustache=require('mustache');var util=require(_0x9318('0x6'));var path=require(_0x9318('0x7'));var sox=require(_0x9318('0x8'));var csv=require(_0x9318('0x9'));var ejs=require(_0x9318('0xa'));var fs=require('fs');var fs_extra=require(_0x9318('0xb'));var _=require('lodash');var squel=require(_0x9318('0xc'));var crypto=require('crypto');var jsforce=require(_0x9318('0xd'));var deskjs=require(_0x9318('0xe'));var toCsv=require(_0x9318('0x9'));var querystring=require('querystring');var Papa=require(_0x9318('0xf'));var Redis=require(_0x9318('0x10'));var authService=require(_0x9318('0x11'));var qs=require(_0x9318('0x12'));var as=require(_0x9318('0x13'));var hardwareService=require(_0x9318('0x14'));var logger=require(_0x9318('0x15'))(_0x9318('0x16'));var utils=require('../../config/utils');var config=require(_0x9318('0x17'));var licenseUtil=require(_0x9318('0x18'));var db=require(_0x9318('0x19'))['db'];function respondWithStatusCode(_0xbb9434,_0x2e61af){_0x2e61af=_0x2e61af||0xcc;return function(_0x2cc3a5){if(_0x2cc3a5){return _0xbb9434[_0x9318('0x1a')](_0x2e61af);}return _0xbb9434['status'](_0x2e61af)['end']();};}function respondWithResult(_0x348f3e,_0x2f39da){_0x2f39da=_0x2f39da||0xc8;return function(_0x2ba5bd){if(_0x2ba5bd){return _0x348f3e[_0x9318('0x1b')](_0x2f39da)[_0x9318('0x1c')](_0x2ba5bd);}};}function respondWithFilteredResult(_0x296844,_0x1d38de){return function(_0x1113bf){if(_0x1113bf){var _0x15dc1f=typeof _0x1d38de[_0x9318('0x1d')]===_0x9318('0x1e')&&typeof _0x1d38de[_0x9318('0x1f')]==='undefined';var _0x1c66d2=_0x1113bf['count'];var _0x4db6e6=_0x15dc1f?0x0:_0x1d38de[_0x9318('0x1d')];var _0x254778=_0x15dc1f?_0x1113bf[_0x9318('0x20')]:_0x1d38de[_0x9318('0x1d')]+_0x1d38de['limit'];var _0x328cbd;if(_0x254778>=_0x1c66d2){_0x254778=_0x1c66d2;_0x328cbd=0xc8;}else{_0x328cbd=0xce;}_0x296844[_0x9318('0x1b')](_0x328cbd);return _0x296844['set'](_0x9318('0x21'),_0x4db6e6+'-'+_0x254778+'/'+_0x1c66d2)[_0x9318('0x1c')](_0x1113bf);}return null;};}function patchUpdates(_0x320b1d){return function(_0x3fd16c){try{jsonpatch[_0x9318('0x22')](_0x3fd16c,_0x320b1d,!![]);}catch(_0x242873){return BPromise[_0x9318('0x23')](_0x242873);}return _0x3fd16c['save']();};}function saveUpdates(_0x40a009,_0x543921){return function(_0x54a52f){if(_0x54a52f){return _0x54a52f[_0x9318('0x24')](_0x40a009)[_0x9318('0x25')](function(_0x13a4cb){return _0x13a4cb;});}return null;};}function removeEntity(_0x5aad82,_0x1b6809){return function(_0x4a42bf){if(_0x4a42bf){return _0x4a42bf[_0x9318('0x26')]()[_0x9318('0x25')](function(){_0x5aad82[_0x9318('0x1b')](0xcc)[_0x9318('0x27')]();});}};}function handleEntityNotFound(_0x1741ce,_0x27231d){return function(_0x1ce42b){if(!_0x1ce42b){_0x1741ce[_0x9318('0x1a')](0x194);}return _0x1ce42b;};}function handleError(_0x39141d,_0x30f2ce){_0x30f2ce=_0x30f2ce||0x1f4;return function(_0x21e25f){logger[_0x9318('0x28')](_0x21e25f[_0x9318('0x29')]);if(_0x21e25f['name']){delete _0x21e25f['name'];}_0x39141d['status'](_0x30f2ce)[_0x9318('0x2a')](_0x21e25f);};}exports[_0x9318('0x2b')]=function(_0x172477,_0x3a6931){var _0x5bcdea={},_0x347670={},_0x3879fb={'count':0x0,'rows':[]};var _0x2572a1=_[_0x9318('0x2c')](db['DeskField'][_0x9318('0x2d')],function(_0x4b66c0){return{'name':_0x4b66c0[_0x9318('0x2e')],'type':_0x4b66c0[_0x9318('0x2f')]['key']};});_0x347670['model']=_['map'](_0x2572a1,_0x9318('0x30'));_0x347670[_0x9318('0x31')]=_[_0x9318('0x32')](_0x172477[_0x9318('0x31')]);_0x347670[_0x9318('0x33')]=_[_0x9318('0x34')](_0x347670['model'],_0x347670[_0x9318('0x31')]);_0x5bcdea['attributes']=_['intersection'](_0x347670['model'],qs[_0x9318('0x35')](_0x172477[_0x9318('0x31')][_0x9318('0x35')]));_0x5bcdea[_0x9318('0x36')]=_0x5bcdea[_0x9318('0x36')]['length']?_0x5bcdea[_0x9318('0x36')]:_0x347670[_0x9318('0x37')];if(!_0x172477['query'][_0x9318('0x38')](_0x9318('0x39'))){_0x5bcdea[_0x9318('0x1f')]=qs[_0x9318('0x1f')](_0x172477['query']['limit']);_0x5bcdea[_0x9318('0x1d')]=qs[_0x9318('0x1d')](_0x172477[_0x9318('0x31')][_0x9318('0x1d')]);}_0x5bcdea[_0x9318('0x3a')]=qs[_0x9318('0x3b')](_0x172477[_0x9318('0x31')]['sort']);_0x5bcdea[_0x9318('0x3c')]=qs[_0x9318('0x33')](_[_0x9318('0x3d')](_0x172477[_0x9318('0x31')],_0x347670['filters']),_0x2572a1);if(_0x172477[_0x9318('0x31')][_0x9318('0x3e')]){_0x5bcdea[_0x9318('0x3c')]=_[_0x9318('0x3f')](_0x5bcdea[_0x9318('0x3c')],{'$or':_[_0x9318('0x2c')](_0x2572a1,function(_0x1f37de){if(_0x1f37de[_0x9318('0x2f')]!==_0x9318('0x40')){var _0x1cef1b={};_0x1cef1b[_0x1f37de[_0x9318('0x30')]]={'$like':'%'+_0x172477[_0x9318('0x31')][_0x9318('0x3e')]+'%'};return _0x1cef1b;}})});}_0x5bcdea=_[_0x9318('0x3f')]({},_0x5bcdea,_0x172477[_0x9318('0x41')]);var _0x4106bf={'where':_0x5bcdea[_0x9318('0x3c')]};return db[_0x9318('0x42')][_0x9318('0x20')](_0x4106bf)[_0x9318('0x25')](function(_0x2ad6e9){_0x3879fb[_0x9318('0x20')]=_0x2ad6e9;if(_0x172477['query'][_0x9318('0x43')]){_0x5bcdea[_0x9318('0x44')]=[{'all':!![]}];}return db[_0x9318('0x42')][_0x9318('0x45')](_0x5bcdea);})['then'](function(_0x2e5c45){_0x3879fb[_0x9318('0x46')]=_0x2e5c45;return _0x3879fb;})[_0x9318('0x25')](respondWithFilteredResult(_0x3a6931,_0x5bcdea))[_0x9318('0x47')](handleError(_0x3a6931,null));};exports[_0x9318('0x48')]=function(_0x54183b,_0x3cb79f){var _0x16ba61={'raw':!![],'where':{'id':_0x54183b[_0x9318('0x49')]['id']}},_0x488010={};_0x488010[_0x9318('0x37')]=_[_0x9318('0x32')](db[_0x9318('0x42')][_0x9318('0x2d')]);_0x488010[_0x9318('0x31')]=_[_0x9318('0x32')](_0x54183b['query']);_0x488010[_0x9318('0x33')]=_[_0x9318('0x34')](_0x488010[_0x9318('0x37')],_0x488010[_0x9318('0x31')]);_0x16ba61['attributes']=_[_0x9318('0x34')](_0x488010[_0x9318('0x37')],qs['fields'](_0x54183b[_0x9318('0x31')][_0x9318('0x35')]));_0x16ba61[_0x9318('0x36')]=_0x16ba61[_0x9318('0x36')][_0x9318('0x4a')]?_0x16ba61[_0x9318('0x36')]:_0x488010['model'];if(_0x54183b[_0x9318('0x31')][_0x9318('0x43')]){_0x16ba61[_0x9318('0x44')]=[{'all':!![]}];}_0x16ba61=_[_0x9318('0x3f')]({},_0x16ba61,_0x54183b[_0x9318('0x41')]);return db['DeskField'][_0x9318('0x4b')](_0x16ba61)['then'](handleEntityNotFound(_0x3cb79f,null))[_0x9318('0x25')](respondWithResult(_0x3cb79f,null))[_0x9318('0x47')](handleError(_0x3cb79f,null));};exports[_0x9318('0x4c')]=function(_0x17ec28,_0x4ca629){return db[_0x9318('0x42')]['create'](_0x17ec28[_0x9318('0x4d')],{})[_0x9318('0x25')](respondWithResult(_0x4ca629,0xc9))[_0x9318('0x47')](handleError(_0x4ca629,null));};exports[_0x9318('0x24')]=function(_0xa50d77,_0x4e3852){if(_0xa50d77[_0x9318('0x4d')]['id']){delete _0xa50d77[_0x9318('0x4d')]['id'];}return db['DeskField'][_0x9318('0x4b')]({'where':{'id':_0xa50d77[_0x9318('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e3852,null))[_0x9318('0x25')](saveUpdates(_0xa50d77[_0x9318('0x4d')],null))['then'](respondWithResult(_0x4e3852,null))[_0x9318('0x47')](handleError(_0x4e3852,null));};exports[_0x9318('0x26')]=function(_0x8cf3c1,_0x258811){return db[_0x9318('0x42')][_0x9318('0x4b')]({'where':{'id':_0x8cf3c1[_0x9318('0x49')]['id']}})[_0x9318('0x25')](handleEntityNotFound(_0x258811,null))['then'](removeEntity(_0x258811,null))[_0x9318('0x47')](handleError(_0x258811,null));}; \ No newline at end of file +var _0xfca0=['bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','reject','update','then','error','stack','name','index','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','catch','show','params','length','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5b835e,_0x3882cc){var _0x55572b=function(_0x4a3472){while(--_0x4a3472){_0x5b835e['push'](_0x5b835e['shift']());}};_0x55572b(++_0x3882cc);}(_0xfca0,0x171));var _0x0fca=function(_0x2a81aa,_0x557f0f){_0x2a81aa=_0x2a81aa-0x0;var _0x1a4a41=_0xfca0[_0x2a81aa];return _0x1a4a41;};'use strict';var emlformat=require(_0x0fca('0x0'));var rimraf=require(_0x0fca('0x1'));var zipdir=require(_0x0fca('0x2'));var jsonpatch=require(_0x0fca('0x3'));var rp=require(_0x0fca('0x4'));var moment=require(_0x0fca('0x5'));var BPromise=require(_0x0fca('0x6'));var Mustache=require(_0x0fca('0x7'));var util=require('util');var path=require(_0x0fca('0x8'));var sox=require(_0x0fca('0x9'));var csv=require(_0x0fca('0xa'));var ejs=require(_0x0fca('0xb'));var fs=require('fs');var fs_extra=require(_0x0fca('0xc'));var _=require(_0x0fca('0xd'));var squel=require(_0x0fca('0xe'));var crypto=require(_0x0fca('0xf'));var jsforce=require(_0x0fca('0x10'));var deskjs=require(_0x0fca('0x11'));var toCsv=require(_0x0fca('0xa'));var querystring=require(_0x0fca('0x12'));var Papa=require(_0x0fca('0x13'));var Redis=require(_0x0fca('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0fca('0x15'));var hardwareService=require(_0x0fca('0x16'));var logger=require('../../config/logger')(_0x0fca('0x17'));var utils=require('../../config/utils');var config=require(_0x0fca('0x18'));var licenseUtil=require(_0x0fca('0x19'));var db=require(_0x0fca('0x1a'))['db'];function respondWithStatusCode(_0x1ad9fa,_0x3b8bf2){_0x3b8bf2=_0x3b8bf2||0xcc;return function(_0x56c66f){if(_0x56c66f){return _0x1ad9fa[_0x0fca('0x1b')](_0x3b8bf2);}return _0x1ad9fa[_0x0fca('0x1c')](_0x3b8bf2)[_0x0fca('0x1d')]();};}function respondWithResult(_0x44a894,_0x2fe06c){_0x2fe06c=_0x2fe06c||0xc8;return function(_0x1b8277){if(_0x1b8277){return _0x44a894[_0x0fca('0x1c')](_0x2fe06c)[_0x0fca('0x1e')](_0x1b8277);}};}function respondWithFilteredResult(_0x19526f,_0x11fcfd){return function(_0x3e8387){if(_0x3e8387){var _0xe6c8fd=typeof _0x11fcfd[_0x0fca('0x1f')]===_0x0fca('0x20')&&typeof _0x11fcfd[_0x0fca('0x21')]===_0x0fca('0x20');var _0x5adc55=_0x3e8387[_0x0fca('0x22')];var _0x864681=_0xe6c8fd?0x0:_0x11fcfd[_0x0fca('0x1f')];var _0x387d53=_0xe6c8fd?_0x3e8387['count']:_0x11fcfd['offset']+_0x11fcfd[_0x0fca('0x21')];var _0x35aba9;if(_0x387d53>=_0x5adc55){_0x387d53=_0x5adc55;_0x35aba9=0xc8;}else{_0x35aba9=0xce;}_0x19526f[_0x0fca('0x1c')](_0x35aba9);return _0x19526f[_0x0fca('0x23')](_0x0fca('0x24'),_0x864681+'-'+_0x387d53+'/'+_0x5adc55)['json'](_0x3e8387);}return null;};}function patchUpdates(_0x4b6ff0){return function(_0xd7e72){try{jsonpatch[_0x0fca('0x25')](_0xd7e72,_0x4b6ff0,!![]);}catch(_0xc636a2){return BPromise[_0x0fca('0x26')](_0xc636a2);}return _0xd7e72['save']();};}function saveUpdates(_0x437859,_0x43ac51){return function(_0x401d4b){if(_0x401d4b){return _0x401d4b[_0x0fca('0x27')](_0x437859)[_0x0fca('0x28')](function(_0x395f84){return _0x395f84;});}return null;};}function removeEntity(_0xf20c39,_0x513997){return function(_0x465695){if(_0x465695){return _0x465695['destroy']()[_0x0fca('0x28')](function(){_0xf20c39[_0x0fca('0x1c')](0xcc)[_0x0fca('0x1d')]();});}};}function handleEntityNotFound(_0x1ed9b0,_0x21bd9b){return function(_0x2e5d05){if(!_0x2e5d05){_0x1ed9b0['sendStatus'](0x194);}return _0x2e5d05;};}function handleError(_0xb8bee6,_0x4defbb){_0x4defbb=_0x4defbb||0x1f4;return function(_0x39f02d){logger[_0x0fca('0x29')](_0x39f02d[_0x0fca('0x2a')]);if(_0x39f02d[_0x0fca('0x2b')]){delete _0x39f02d[_0x0fca('0x2b')];}_0xb8bee6[_0x0fca('0x1c')](_0x4defbb)['send'](_0x39f02d);};}exports[_0x0fca('0x2c')]=function(_0x1b7474,_0xd56047){var _0x1bcf6d={},_0x5b98fb={},_0x4313cf={'count':0x0,'rows':[]};var _0x51a464=_['map'](db[_0x0fca('0x2d')][_0x0fca('0x2e')],function(_0x64f0c9){return{'name':_0x64f0c9[_0x0fca('0x2f')],'type':_0x64f0c9[_0x0fca('0x30')][_0x0fca('0x31')]};});_0x5b98fb[_0x0fca('0x32')]=_['map'](_0x51a464,_0x0fca('0x2b'));_0x5b98fb['query']=_[_0x0fca('0x33')](_0x1b7474[_0x0fca('0x34')]);_0x5b98fb[_0x0fca('0x35')]=_[_0x0fca('0x36')](_0x5b98fb[_0x0fca('0x32')],_0x5b98fb['query']);_0x1bcf6d[_0x0fca('0x37')]=_[_0x0fca('0x36')](_0x5b98fb[_0x0fca('0x32')],qs['fields'](_0x1b7474[_0x0fca('0x34')][_0x0fca('0x38')]));_0x1bcf6d[_0x0fca('0x37')]=_0x1bcf6d['attributes']['length']?_0x1bcf6d[_0x0fca('0x37')]:_0x5b98fb['model'];if(!_0x1b7474[_0x0fca('0x34')]['hasOwnProperty'](_0x0fca('0x39'))){_0x1bcf6d[_0x0fca('0x21')]=qs[_0x0fca('0x21')](_0x1b7474[_0x0fca('0x34')]['limit']);_0x1bcf6d[_0x0fca('0x1f')]=qs[_0x0fca('0x1f')](_0x1b7474[_0x0fca('0x34')]['offset']);}_0x1bcf6d['order']=qs['sort'](_0x1b7474['query'][_0x0fca('0x3a')]);_0x1bcf6d['where']=qs['filters'](_[_0x0fca('0x3b')](_0x1b7474[_0x0fca('0x34')],_0x5b98fb[_0x0fca('0x35')]),_0x51a464);if(_0x1b7474[_0x0fca('0x34')][_0x0fca('0x3c')]){_0x1bcf6d[_0x0fca('0x3d')]=_[_0x0fca('0x3e')](_0x1bcf6d['where'],{'$or':_['map'](_0x51a464,function(_0x2bc9a1){if(_0x2bc9a1[_0x0fca('0x30')]!==_0x0fca('0x3f')){var _0x4f2bda={};_0x4f2bda[_0x2bc9a1['name']]={'$like':'%'+_0x1b7474[_0x0fca('0x34')]['filter']+'%'};return _0x4f2bda;}})});}_0x1bcf6d=_[_0x0fca('0x3e')]({},_0x1bcf6d,_0x1b7474[_0x0fca('0x40')]);var _0x318f24={'where':_0x1bcf6d['where']};return db[_0x0fca('0x2d')][_0x0fca('0x22')](_0x318f24)['then'](function(_0x19aa2f){_0x4313cf[_0x0fca('0x22')]=_0x19aa2f;if(_0x1b7474[_0x0fca('0x34')][_0x0fca('0x41')]){_0x1bcf6d['include']=[{'all':!![]}];}return db[_0x0fca('0x2d')]['findAll'](_0x1bcf6d);})['then'](function(_0x37b604){_0x4313cf['rows']=_0x37b604;return _0x4313cf;})['then'](respondWithFilteredResult(_0xd56047,_0x1bcf6d))[_0x0fca('0x42')](handleError(_0xd56047,null));};exports[_0x0fca('0x43')]=function(_0x2c71f2,_0x2efdb6){var _0x3211a6={'raw':!![],'where':{'id':_0x2c71f2[_0x0fca('0x44')]['id']}},_0xa3d3ff={};_0xa3d3ff[_0x0fca('0x32')]=_['keys'](db['DeskField'][_0x0fca('0x2e')]);_0xa3d3ff['query']=_['keys'](_0x2c71f2['query']);_0xa3d3ff[_0x0fca('0x35')]=_[_0x0fca('0x36')](_0xa3d3ff[_0x0fca('0x32')],_0xa3d3ff[_0x0fca('0x34')]);_0x3211a6[_0x0fca('0x37')]=_['intersection'](_0xa3d3ff[_0x0fca('0x32')],qs[_0x0fca('0x38')](_0x2c71f2[_0x0fca('0x34')][_0x0fca('0x38')]));_0x3211a6[_0x0fca('0x37')]=_0x3211a6[_0x0fca('0x37')][_0x0fca('0x45')]?_0x3211a6[_0x0fca('0x37')]:_0xa3d3ff[_0x0fca('0x32')];if(_0x2c71f2['query']['includeAll']){_0x3211a6[_0x0fca('0x46')]=[{'all':!![]}];}_0x3211a6=_[_0x0fca('0x3e')]({},_0x3211a6,_0x2c71f2[_0x0fca('0x40')]);return db[_0x0fca('0x2d')][_0x0fca('0x47')](_0x3211a6)[_0x0fca('0x28')](handleEntityNotFound(_0x2efdb6,null))[_0x0fca('0x28')](respondWithResult(_0x2efdb6,null))[_0x0fca('0x42')](handleError(_0x2efdb6,null));};exports[_0x0fca('0x48')]=function(_0x200496,_0x47971c){return db[_0x0fca('0x2d')][_0x0fca('0x48')](_0x200496[_0x0fca('0x49')],{})['then'](respondWithResult(_0x47971c,0xc9))[_0x0fca('0x42')](handleError(_0x47971c,null));};exports[_0x0fca('0x27')]=function(_0xcccfda,_0x5720ad){if(_0xcccfda[_0x0fca('0x49')]['id']){delete _0xcccfda[_0x0fca('0x49')]['id'];}return db[_0x0fca('0x2d')][_0x0fca('0x47')]({'where':{'id':_0xcccfda[_0x0fca('0x44')]['id']}})[_0x0fca('0x28')](handleEntityNotFound(_0x5720ad,null))[_0x0fca('0x28')](saveUpdates(_0xcccfda[_0x0fca('0x49')],null))[_0x0fca('0x28')](respondWithResult(_0x5720ad,null))[_0x0fca('0x42')](handleError(_0x5720ad,null));};exports[_0x0fca('0x4a')]=function(_0x37285e,_0x81b62f){return db[_0x0fca('0x2d')][_0x0fca('0x47')]({'where':{'id':_0x37285e['params']['id']}})[_0x0fca('0x28')](handleEntityNotFound(_0x81b62f,null))[_0x0fca('0x28')](removeEntity(_0x81b62f,null))[_0x0fca('0x42')](handleError(_0x81b62f,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index cc78d30..ee2c748 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 _0x4e0b=['api','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger'];(function(_0x307a28,_0x2bdd9f){var _0x523ac7=function(_0x173ff2){while(--_0x173ff2){_0x307a28['push'](_0x307a28['shift']());}};_0x523ac7(++_0x2bdd9f);}(_0x4e0b,0x1af));var _0xb4e0=function(_0x16de8f,_0x5d06ff){_0x16de8f=_0x16de8f-0x0;var _0x15975d=_0x4e0b[_0x16de8f];return _0x15975d;};'use strict';var _=require(_0xb4e0('0x0'));var util=require(_0xb4e0('0x1'));var logger=require(_0xb4e0('0x2'))(_0xb4e0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb4e0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4e0('0x5'));var config=require(_0xb4e0('0x6'));var attributes=require(_0xb4e0('0x7'));module[_0xb4e0('0x8')]=function(_0x548394,_0x5bce6b){return _0x548394[_0xb4e0('0x9')](_0xb4e0('0xa'),attributes,{'tableName':_0xb4e0('0xb'),'paranoid':![],'indexes':[{'name':_0xb4e0('0xc'),'fields':[_0xb4e0('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xecad=['request-promise','path','../../config/environment','define','int_desk_fields','desk_unique_index','idField','util','../../config/logger','moment','bluebird'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xecad,0x151));var _0xdeca=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xecad[_0x17406a];return _0x1501ff;};'use strict';var _=require('lodash');var util=require(_0xdeca('0x0'));var logger=require(_0xdeca('0x1'))('api');var moment=require(_0xdeca('0x2'));var BPromise=require(_0xdeca('0x3'));var rp=require(_0xdeca('0x4'));var fs=require('fs');var path=require(_0xdeca('0x5'));var rimraf=require('rimraf');var config=require(_0xdeca('0x6'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x5f50fc,_0x3aa953){return _0x5f50fc[_0xdeca('0x7')]('DeskField',attributes,{'tableName':_0xdeca('0x8'),'paranoid':![],'indexes':[{'name':_0xdeca('0x9'),'fields':[_0xdeca('0xa'),'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 1b12356..a65bb79 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 _0xd271=['code','message','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x34d864,_0x19defa){var _0x47f274=function(_0x2221b9){while(--_0x2221b9){_0x34d864['push'](_0x34d864['shift']());}};_0x47f274(++_0x19defa);}(_0xd271,0x1e8));var _0x1d27=function(_0x90e63c,_0xcdc8c3){_0x90e63c=_0x90e63c-0x0;var _0x185430=_0xd271[_0x90e63c];return _0x185430;};'use strict';var _=require(_0x1d27('0x0'));var util=require(_0x1d27('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d27('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d27('0x3'));var logger=require(_0x1d27('0x4'))(_0x1d27('0x5'));var config=require(_0x1d27('0x6'));var jayson=require(_0x1d27('0x7'));var client=jayson[_0x1d27('0x8')][_0x1d27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7a55e9,_0x2d5cf9,_0x4c5995){return new BPromise(function(_0x5be4aa,_0x2c2975){return client[_0x1d27('0xa')](_0x7a55e9,_0x4c5995)[_0x1d27('0xb')](function(_0x5b07e5){logger[_0x1d27('0xc')](_0x1d27('0xd'),_0x2d5cf9,_0x1d27('0xe'));logger[_0x1d27('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2d5cf9,_0x1d27('0xe'),JSON[_0x1d27('0x10')](_0x5b07e5));if(_0x5b07e5[_0x1d27('0x11')]){if(_0x5b07e5[_0x1d27('0x11')][_0x1d27('0x12')]===0x1f4){logger[_0x1d27('0x11')]('DeskField,\x20%s,\x20%s',_0x2d5cf9,_0x5b07e5[_0x1d27('0x11')][_0x1d27('0x13')]);return _0x2c2975(_0x5b07e5[_0x1d27('0x11')][_0x1d27('0x13')]);}logger[_0x1d27('0x11')]('DeskField,\x20%s,\x20%s',_0x2d5cf9,_0x5b07e5['error'][_0x1d27('0x13')]);return _0x5be4aa(_0x5b07e5[_0x1d27('0x11')][_0x1d27('0x13')]);}else{logger[_0x1d27('0xc')]('DeskField,\x20%s,\x20%s',_0x2d5cf9,'request\x20sent');_0x5be4aa(_0x5b07e5[_0x1d27('0x14')][_0x1d27('0x13')]);}})[_0x1d27('0x15')](function(_0x18f74d){logger[_0x1d27('0x11')](_0x1d27('0xd'),_0x2d5cf9,_0x18f74d);_0x2c2975(_0x18f74d);});});} \ No newline at end of file +var _0x085f=['DeskField,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xc0d066,_0xdcc6d1){var _0x33ef28=function(_0x195c9e){while(--_0x195c9e){_0xc0d066['push'](_0xc0d066['shift']());}};_0x33ef28(++_0xdcc6d1);}(_0x085f,0x17e));var _0xf085=function(_0x46071a,_0x32c3fa){_0x46071a=_0x46071a-0x0;var _0x2d04c8=_0x085f[_0x46071a];return _0x2d04c8;};'use strict';var _=require(_0xf085('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf085('0x1'));var fs=require('fs');var Redis=require(_0xf085('0x2'));var db=require(_0xf085('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf085('0x4'))(_0xf085('0x5'));var config=require(_0xf085('0x6'));var jayson=require(_0xf085('0x7'));var client=jayson[_0xf085('0x8')][_0xf085('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd64bf9,_0x2c0a10,_0x455b62){return new BPromise(function(_0x4eab66,_0x4e6907){return client[_0xf085('0xa')](_0xd64bf9,_0x455b62)[_0xf085('0xb')](function(_0x560127){logger[_0xf085('0xc')]('DeskField,\x20%s,\x20%s',_0x2c0a10,'request\x20sent');logger[_0xf085('0xd')](_0xf085('0xe'),_0x2c0a10,_0xf085('0xf'),JSON['stringify'](_0x560127));if(_0x560127[_0xf085('0x10')]){if(_0x560127[_0xf085('0x10')]['code']===0x1f4){logger[_0xf085('0x10')](_0xf085('0x11'),_0x2c0a10,_0x560127[_0xf085('0x10')][_0xf085('0x12')]);return _0x4e6907(_0x560127[_0xf085('0x10')][_0xf085('0x12')]);}logger[_0xf085('0x10')](_0xf085('0x11'),_0x2c0a10,_0x560127[_0xf085('0x10')][_0xf085('0x12')]);return _0x4eab66(_0x560127[_0xf085('0x10')]['message']);}else{logger[_0xf085('0xc')](_0xf085('0x11'),_0x2c0a10,_0xf085('0xf'));_0x4eab66(_0x560127[_0xf085('0x13')][_0xf085('0x12')]);}})[_0xf085('0x14')](function(_0x29e66d){logger['error'](_0xf085('0x11'),_0x2c0a10,_0x29e66d);_0x4e6907(_0x29e66d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a643cfc..255a7d3 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 _0xa89b=['update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intDynamics365Account.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xa89b,0x1ba));var _0xba89=function(_0x263a0a,_0x2aebeb){_0x263a0a=_0x263a0a-0x0;var _0x9fdcb=_0xa89b[_0x263a0a];return _0x9fdcb;};'use strict';var multer=require(_0xba89('0x0'));var util=require(_0xba89('0x1'));var path=require(_0xba89('0x2'));var timeout=require(_0xba89('0x3'));var express=require(_0xba89('0x4'));var router=express['Router']();var fs_extra=require(_0xba89('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xba89('0x6'));var config=require('../../config/environment');var controller=require(_0xba89('0x7'));router[_0xba89('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xba89('0x9'),auth[_0xba89('0xa')](),controller[_0xba89('0xb')]);router[_0xba89('0x8')](_0xba89('0xc'),auth['isAuthenticated'](),controller[_0xba89('0xd')]);router[_0xba89('0x8')](_0xba89('0xe'),auth[_0xba89('0xa')](),controller[_0xba89('0xf')]);router[_0xba89('0x10')]('/',auth['isAuthenticated'](),controller[_0xba89('0x11')]);router[_0xba89('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xba89('0x12')]);router[_0xba89('0x13')](_0xba89('0x9'),auth[_0xba89('0xa')](),controller[_0xba89('0x14')]);router[_0xba89('0x15')](_0xba89('0x9'),auth[_0xba89('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd212=['post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd212,0x90));var _0x2d21=function(_0x2550ce,_0x45209b){_0x2550ce=_0x2550ce-0x0;var _0x25748d=_0xd212[_0x2550ce];return _0x25748d;};'use strict';var multer=require(_0x2d21('0x0'));var util=require(_0x2d21('0x1'));var path=require(_0x2d21('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d21('0x3'));var router=express[_0x2d21('0x4')]();var fs_extra=require(_0x2d21('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2d21('0x6'));var config=require('../../config/environment');var controller=require(_0x2d21('0x7'));router[_0x2d21('0x8')]('/',auth['isAuthenticated'](),controller[_0x2d21('0x9')]);router[_0x2d21('0x8')](_0x2d21('0xa'),auth[_0x2d21('0xb')](),controller[_0x2d21('0xc')]);router[_0x2d21('0x8')](_0x2d21('0xd'),auth[_0x2d21('0xb')](),controller[_0x2d21('0xe')]);router[_0x2d21('0x8')](_0x2d21('0xf'),auth[_0x2d21('0xb')](),controller[_0x2d21('0x10')]);router[_0x2d21('0x11')]('/',auth['isAuthenticated'](),controller[_0x2d21('0x12')]);router[_0x2d21('0x11')](_0x2d21('0xd'),auth[_0x2d21('0xb')](),controller['addConfiguration']);router[_0x2d21('0x13')](_0x2d21('0xa'),auth[_0x2d21('0xb')](),controller[_0x2d21('0x14')]);router['delete'](_0x2d21('0xa'),auth[_0x2d21('0xb')](),controller[_0x2d21('0x15')]);module[_0x2d21('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 269311e..365c84d 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 _0xc963=['STRING','BOOLEAN','sequelize'];(function(_0x36fa72,_0x2db1de){var _0x30073d=function(_0x576907){while(--_0x576907){_0x36fa72['push'](_0x36fa72['shift']());}};_0x30073d(++_0x2db1de);}(_0xc963,0x17f));var _0x3c96=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0xc963[_0x285800];return _0x4b809e;};'use strict';var Sequelize=require(_0x3c96('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3c96('0x1')]},'password':{'type':Sequelize[_0x3c96('0x1')]},'remoteUri':{'type':Sequelize[_0x3c96('0x1')]},'tenantId':{'type':Sequelize[_0x3c96('0x1')]},'clientId':{'type':Sequelize[_0x3c96('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x3c96('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3c96('0x1')]},'modernAuthentication':{'type':Sequelize[_0x3c96('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x975f=['STRING','sequelize'];(function(_0xddbeac,_0x4280c){var _0x5b245b=function(_0x4149e9){while(--_0x4149e9){_0xddbeac['push'](_0xddbeac['shift']());}};_0x5b245b(++_0x4280c);}(_0x975f,0x191));var _0xf975=function(_0x59dccc,_0x184c1c){_0x59dccc=_0x59dccc-0x0;var _0xc97bcb=_0x975f[_0x59dccc];return _0xc97bcb;};'use strict';var Sequelize=require(_0xf975('0x0'));module['exports']={'name':{'type':Sequelize[_0xf975('0x1')]},'username':{'type':Sequelize[_0xf975('0x1')]},'password':{'type':Sequelize[_0xf975('0x1')]},'remoteUri':{'type':Sequelize[_0xf975('0x1')]},'tenantId':{'type':Sequelize[_0xf975('0x1')]},'clientId':{'type':Sequelize[_0xf975('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf975('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf975('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 6ce4a52..763aca7 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 _0xd873=['/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','send','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','DisplayName','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../components/integrations/configuration','status','offset','limit','undefined','count','set','Content-Range','then','destroy','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','Dynamics365Account','show','params','keys','includeAll','include','options','find','catch','create','body','update','findOne','Dynamics365Configuration','nolimit','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','substring','lastIndexOf','format','getFields','ticketType','Incident','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','tenantId','clientId','modernAuthentication','CloudProvider','data7','data5','POST','https://login.microsoftonline.com/'];(function(_0x39f5b,_0x224393){var _0x29c795=function(_0x16284b){while(--_0x16284b){_0x39f5b['push'](_0x39f5b['shift']());}};_0x29c795(++_0x224393);}(_0xd873,0xe6));var _0x3d87=function(_0xe41b0f,_0x6f824a){_0xe41b0f=_0xe41b0f-0x0;var _0x31b3ad=_0xd873[_0xe41b0f];return _0x31b3ad;};'use strict';var rp=require(_0x3d87('0x0'));var util=require(_0x3d87('0x1'));var _=require('lodash');var qs=require(_0x3d87('0x2'));var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];var integrations=require(_0x3d87('0x3'));function respondWithResult(_0x405a5b,_0x3e08e7){_0x3e08e7=_0x3e08e7||0xc8;return function(_0x3c0fea){if(_0x3c0fea){return _0x405a5b[_0x3d87('0x4')](_0x3e08e7)['json'](_0x3c0fea);}};}function respondWithFilteredResult(_0x568e36,_0x1c52b3){return function(_0x9d937){if(_0x9d937){var _0x41b4ed=typeof _0x1c52b3[_0x3d87('0x5')]==='undefined'&&typeof _0x1c52b3[_0x3d87('0x6')]===_0x3d87('0x7');var _0x49471d=_0x9d937[_0x3d87('0x8')];var _0x1ad359=_0x41b4ed?0x0:_0x1c52b3[_0x3d87('0x5')];var _0x376056=_0x41b4ed?_0x9d937[_0x3d87('0x8')]:_0x1c52b3['offset']+_0x1c52b3[_0x3d87('0x6')];var _0x3565ca;if(_0x376056>=_0x49471d){_0x376056=_0x49471d;_0x3565ca=0xc8;}else{_0x3565ca=0xce;}_0x568e36['status'](_0x3565ca);return _0x568e36[_0x3d87('0x9')](_0x3d87('0xa'),_0x1ad359+'-'+_0x376056+'/'+_0x49471d)['json'](_0x9d937);}return null;};}function saveUpdates(_0x55c829){return function(_0x5949e7){if(_0x5949e7){return _0x5949e7['update'](_0x55c829)[_0x3d87('0xb')](function(_0x5848f){return _0x5848f;});}return null;};}function removeEntity(_0x29dec8){return function(_0x3042ec){if(_0x3042ec){return _0x3042ec[_0x3d87('0xc')]()[_0x3d87('0xb')](function(){_0x29dec8[_0x3d87('0x4')](0xcc)[_0x3d87('0xd')]();});}};}function handleEntityNotFound(_0x3ba605){return function(_0x4c39a9){if(!_0x4c39a9){_0x3ba605[_0x3d87('0xe')](0x194);}return _0x4c39a9;};}function handleError(_0x32d20c,_0x51879d){_0x51879d=_0x51879d||0x1f4;return function(_0x33124d){logger[_0x3d87('0xf')](_0x33124d[_0x3d87('0x10')]);if(_0x33124d[_0x3d87('0x11')]){delete _0x33124d['name'];}_0x32d20c[_0x3d87('0x4')](_0x51879d)['send'](_0x33124d);};}exports[_0x3d87('0x12')]=function(_0x20f48c,_0xc3baa){var _0x318068={},_0x52b167={},_0x3b4b79={'count':0x0,'rows':[]};var _0x4d745a=_[_0x3d87('0x13')](db['Dynamics365Account'][_0x3d87('0x14')],function(_0x2a18ce){return{'name':_0x2a18ce[_0x3d87('0x15')],'type':_0x2a18ce['type'][_0x3d87('0x16')]};});_0x52b167[_0x3d87('0x17')]=_[_0x3d87('0x13')](_0x4d745a,_0x3d87('0x11'));_0x52b167[_0x3d87('0x18')]=_['keys'](_0x20f48c[_0x3d87('0x18')]);_0x52b167[_0x3d87('0x19')]=_[_0x3d87('0x1a')](_0x52b167['model'],_0x52b167[_0x3d87('0x18')]);_0x318068['attributes']=_[_0x3d87('0x1a')](_0x52b167[_0x3d87('0x17')],qs[_0x3d87('0x1b')](_0x20f48c[_0x3d87('0x18')][_0x3d87('0x1b')]));_0x318068[_0x3d87('0x1c')]=_0x318068['attributes'][_0x3d87('0x1d')]?_0x318068[_0x3d87('0x1c')]:_0x52b167[_0x3d87('0x17')];if(!_0x20f48c['query'][_0x3d87('0x1e')]('nolimit')){_0x318068[_0x3d87('0x6')]=qs['limit'](_0x20f48c[_0x3d87('0x18')]['limit']);_0x318068[_0x3d87('0x5')]=qs[_0x3d87('0x5')](_0x20f48c['query'][_0x3d87('0x5')]);}_0x318068[_0x3d87('0x1f')]=qs['sort'](_0x20f48c[_0x3d87('0x18')][_0x3d87('0x20')]);_0x318068[_0x3d87('0x21')]=qs['filters'](_[_0x3d87('0x22')](_0x20f48c[_0x3d87('0x18')],_0x52b167['filters']),_0x4d745a);if(_0x20f48c[_0x3d87('0x18')][_0x3d87('0x23')]){_0x318068['where']=_[_0x3d87('0x24')](_0x318068[_0x3d87('0x21')],{'$or':_[_0x3d87('0x13')](_0x4d745a,function(_0x10e31a){if(_0x10e31a[_0x3d87('0x25')]!==_0x3d87('0x26')){var _0x4e7e0d={};_0x4e7e0d[_0x10e31a[_0x3d87('0x11')]]={'$like':'%'+_0x20f48c['query'][_0x3d87('0x23')]+'%'};return _0x4e7e0d;}})});}_0x318068=_[_0x3d87('0x24')]({},_0x318068,_0x20f48c['options']);var _0x5ee50f={'where':_0x318068[_0x3d87('0x21')]};return db[_0x3d87('0x27')][_0x3d87('0x8')](_0x5ee50f)['then'](function(_0x5a31af){_0x3b4b79[_0x3d87('0x8')]=_0x5a31af;if(_0x20f48c['query']['includeAll']){_0x318068['include']=[{'all':!![]}];}return db[_0x3d87('0x27')]['findAll'](_0x318068);})[_0x3d87('0xb')](function(_0x3102c8){_0x3b4b79['rows']=_0x3102c8;return _0x3b4b79;})[_0x3d87('0xb')](respondWithFilteredResult(_0xc3baa,_0x318068))['catch'](handleError(_0xc3baa,null));};exports[_0x3d87('0x28')]=function(_0x404643,_0xe65f34){var _0x5d0324={'raw':![],'where':{'id':_0x404643[_0x3d87('0x29')]['id']}},_0xd88643={};_0xd88643['model']=_[_0x3d87('0x2a')](db[_0x3d87('0x27')]['rawAttributes']);_0xd88643['query']=_['keys'](_0x404643[_0x3d87('0x18')]);_0xd88643[_0x3d87('0x19')]=_[_0x3d87('0x1a')](_0xd88643[_0x3d87('0x17')],_0xd88643[_0x3d87('0x18')]);_0x5d0324[_0x3d87('0x1c')]=_[_0x3d87('0x1a')](_0xd88643[_0x3d87('0x17')],qs[_0x3d87('0x1b')](_0x404643[_0x3d87('0x18')][_0x3d87('0x1b')]));_0x5d0324['attributes']=_0x5d0324[_0x3d87('0x1c')][_0x3d87('0x1d')]?_0x5d0324['attributes']:_0xd88643[_0x3d87('0x17')];if(_0x404643[_0x3d87('0x18')][_0x3d87('0x2b')]){_0x5d0324[_0x3d87('0x2c')]=[{'all':!![]}];}_0x5d0324=_[_0x3d87('0x24')]({},_0x5d0324,_0x404643[_0x3d87('0x2d')]);return db[_0x3d87('0x27')][_0x3d87('0x2e')](_0x5d0324)[_0x3d87('0xb')](handleEntityNotFound(_0xe65f34,null))[_0x3d87('0xb')](respondWithResult(_0xe65f34,null))[_0x3d87('0x2f')](handleError(_0xe65f34,null));};exports[_0x3d87('0x30')]=function(_0x5b7ce8,_0x40b293){return db[_0x3d87('0x27')][_0x3d87('0x30')](_0x5b7ce8[_0x3d87('0x31')],{})[_0x3d87('0xb')](respondWithResult(_0x40b293,0xc9))[_0x3d87('0x2f')](handleError(_0x40b293,null));};exports[_0x3d87('0x32')]=function(_0xd66fee,_0xd870df){if(_0xd66fee[_0x3d87('0x31')]['id']){delete _0xd66fee['body']['id'];}return db[_0x3d87('0x27')][_0x3d87('0x2e')]({'where':{'id':_0xd66fee[_0x3d87('0x29')]['id']}})[_0x3d87('0xb')](handleEntityNotFound(_0xd870df,null))[_0x3d87('0xb')](saveUpdates(_0xd66fee[_0x3d87('0x31')],null))[_0x3d87('0xb')](respondWithResult(_0xd870df,null))['catch'](handleError(_0xd870df,null));};exports[_0x3d87('0xc')]=function(_0x22dd63,_0x51c269){return db[_0x3d87('0x27')]['find']({'where':{'id':_0x22dd63['params']['id']}})['then'](handleEntityNotFound(_0x51c269,null))[_0x3d87('0xb')](removeEntity(_0x51c269,null))[_0x3d87('0x2f')](handleError(_0x51c269,null));};exports['getConfigurations']=function(_0x19f802,_0x3fb7e2){var _0x2f0acf={};var _0x910263={};var _0x32b55e;var _0x387574;return db[_0x3d87('0x27')][_0x3d87('0x33')]({'where':{'id':_0x19f802[_0x3d87('0x29')]['id']}})[_0x3d87('0xb')](handleEntityNotFound(_0x3fb7e2,null))[_0x3d87('0xb')](function(_0x2c7685){if(_0x2c7685){_0x32b55e=_0x2c7685;_0x910263['model']=_['keys'](db[_0x3d87('0x34')]['rawAttributes']);_0x910263[_0x3d87('0x18')]=_[_0x3d87('0x2a')](_0x19f802[_0x3d87('0x18')]);_0x910263[_0x3d87('0x19')]=_[_0x3d87('0x1a')](_0x910263[_0x3d87('0x17')],_0x910263[_0x3d87('0x18')]);_0x2f0acf['attributes']=_[_0x3d87('0x1a')](_0x910263[_0x3d87('0x17')],qs[_0x3d87('0x1b')](_0x19f802[_0x3d87('0x18')][_0x3d87('0x1b')]));_0x2f0acf[_0x3d87('0x1c')]=_0x2f0acf[_0x3d87('0x1c')][_0x3d87('0x1d')]?_0x2f0acf['attributes']:_0x910263[_0x3d87('0x17')];_0x2f0acf[_0x3d87('0x1f')]=qs['sort'](_0x19f802[_0x3d87('0x18')][_0x3d87('0x20')]);_0x2f0acf[_0x3d87('0x21')]=qs[_0x3d87('0x19')](_[_0x3d87('0x22')](_0x19f802[_0x3d87('0x18')],_0x910263[_0x3d87('0x19')]));if(_0x19f802[_0x3d87('0x18')][_0x3d87('0x23')]){_0x2f0acf[_0x3d87('0x21')]=_['merge'](_0x2f0acf['where'],{'$or':_[_0x3d87('0x13')](_0x2f0acf[_0x3d87('0x1c')],function(_0x52f60a){var _0xfff3={};_0xfff3[_0x52f60a]={'$like':'%'+_0x19f802[_0x3d87('0x18')]['filter']+'%'};return _0xfff3;})});}_0x2f0acf=_[_0x3d87('0x24')]({},_0x2f0acf,_0x19f802['options']);return _0x32b55e['getConfigurations'](_0x2f0acf);}})[_0x3d87('0xb')](function(_0x965ed1){if(_0x965ed1){_0x387574=_0x965ed1['length'];if(!_0x19f802[_0x3d87('0x18')]['hasOwnProperty'](_0x3d87('0x35'))){_0x2f0acf[_0x3d87('0x6')]=qs[_0x3d87('0x6')](_0x19f802[_0x3d87('0x18')][_0x3d87('0x6')]);_0x2f0acf[_0x3d87('0x5')]=qs[_0x3d87('0x5')](_0x19f802['query'][_0x3d87('0x5')]);}return _0x32b55e[_0x3d87('0x36')](_0x2f0acf);}})['then'](function(_0x481405){if(_0x481405){return _0x481405?{'count':_0x387574,'rows':_0x481405}:null;}})[_0x3d87('0xb')](respondWithResult(_0x3fb7e2,null))[_0x3d87('0x2f')](handleError(_0x3fb7e2,null));};exports['addConfiguration']=function(_0x7dcd98,_0x219d48){if(_0x7dcd98[_0x3d87('0x31')]['id']){delete _0x7dcd98['body']['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x7dcd98[_0x3d87('0x29')]['id']}})['then'](handleEntityNotFound(_0x219d48,null))[_0x3d87('0xb')](function(_0x2ef5d8){if(_0x2ef5d8){_0x7dcd98[_0x3d87('0x31')][_0x3d87('0x37')]=_0x2ef5d8['id'];_0x7dcd98[_0x3d87('0x31')][_0x3d87('0x38')]=integrations[_0x3d87('0x39')](_0x7dcd98['body']['channel'],_0x7dcd98['body'][_0x3d87('0x25')]);_0x7dcd98[_0x3d87('0x31')][_0x3d87('0x3a')]=integrations[_0x3d87('0x3b')](_0x7dcd98[_0x3d87('0x31')][_0x3d87('0x3c')],_0x7dcd98[_0x3d87('0x31')][_0x3d87('0x25')]);return db[_0x3d87('0x34')][_0x3d87('0x30')](_0x7dcd98[_0x3d87('0x31')],{'include':[{'model':db[_0x3d87('0x3d')],'as':_0x3d87('0x38')},{'model':db[_0x3d87('0x3d')],'as':_0x3d87('0x3a')}]});}return null;})[_0x3d87('0xb')](respondWithResult(_0x219d48,null))[_0x3d87('0x2f')](handleError(_0x219d48,null));};function sanitizeRemoteUri(_0x347833){var _0x20b5fa=_0x347833['slice'](-0x1);if(_0x20b5fa==='/')return _0x347833[_0x3d87('0x3e')](0x0,_0x347833[_0x3d87('0x3f')](_0x20b5fa));return _0x347833;}function getWebApiUrl(_0x440e54){return util[_0x3d87('0x40')]('%s/api/data/v9.0/',_0x440e54);}exports[_0x3d87('0x41')]=function(_0xa95544,_0x4f9c0c){var _0x3364bc=_0xa95544[_0x3d87('0x18')][_0x3d87('0x42')];var _0x5a163d=_0x3364bc==='incident'?_0x3d87('0x43'):'PhoneCall';var _0x2d5e17='';var _0x4fd025='';var _0x3101df='';var _0x489261='';var _0x40d4bc='';var _0x539759='';var _0x172f0a='';var _0x197daf='';var _0x4e4cb5=[_0x3d87('0x44'),_0x3d87('0x45'),_0x3d87('0x46'),_0x3d87('0x47'),'caseorigincode',_0x3d87('0x48'),_0x3d87('0x49'),_0x3d87('0x4a'),_0x3d87('0x4b'),_0x3d87('0x4c')];var _0x456af6=['accountidname',_0x3d87('0x4d'),_0x3d87('0x4e'),_0x3d87('0x4f'),_0x3d87('0x50'),'contactidyominame',_0x3d87('0x51'),'contractidname',_0x3d87('0x52'),'createdbyexternalpartyyominame',_0x3d87('0x53'),_0x3d87('0x54'),_0x3d87('0x55'),_0x3d87('0x56'),_0x3d87('0x57'),_0x3d87('0x58'),_0x3d87('0x59'),_0x3d87('0x5a'),_0x3d87('0x5b'),'entitlementidname',_0x3d87('0x5c'),_0x3d87('0x5d'),_0x3d87('0x5e'),_0x3d87('0x5f'),_0x3d87('0x60'),'followupby',_0x3d87('0x61'),_0x3d87('0x62'),_0x3d87('0x63'),'lastonholdtime',_0x3d87('0x64'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x3d87('0x65'),_0x3d87('0x66'),_0x3d87('0x67'),_0x3d87('0x68'),'modifiedonbehalfbyyominame',_0x3d87('0x69'),_0x3d87('0x6a'),_0x3d87('0x6b'),_0x3d87('0x6c'),_0x3d87('0x6d'),_0x3d87('0x6e'),'owneridtype',_0x3d87('0x6f'),_0x3d87('0x70'),_0x3d87('0x71'),'primarycontactidyominame',_0x3d87('0x72'),'productidname','productserialnumber',_0x3d87('0x73'),_0x3d87('0x74'),_0x3d87('0x75'),_0x3d87('0x76'),_0x3d87('0x77'),_0x3d87('0x78'),'slainvokedidname',_0x3d87('0x79'),_0x3d87('0x7a'),_0x3d87('0x7b'),_0x3d87('0x7c'),_0x3d87('0x7d'),_0x3d87('0x7e'),_0x3d87('0x7f'),_0x3d87('0x80'),_0x3d87('0x81'),_0x3d87('0x82'),_0x3d87('0x83')];var _0xc37160=_0x4e4cb5['concat'](_0x456af6);return db[_0x3d87('0x27')][_0x3d87('0x33')]({'where':{'id':_0xa95544[_0x3d87('0x29')]['id']},'attributes':['id',_0x3d87('0x84'),_0x3d87('0x85'),'remoteUri',_0x3d87('0x86'),_0x3d87('0x87'),'clientSecret',_0x3d87('0x88')],'include':[{'model':db[_0x3d87('0x89')],'as':_0x3d87('0x89'),'attributes':['id','data5',_0x3d87('0x8a')]}]})[_0x3d87('0xb')](handleEntityNotFound(_0x4f9c0c,null))['then'](function(_0x527b58){if(_0x527b58){if(_0x527b58[_0x3d87('0x88')]){_0x527b58['access_token']=_0x527b58['CloudProvider'][_0x3d87('0x8b')];_0x197daf=sanitizeRemoteUri(_0x527b58[_0x3d87('0x89')][_0x3d87('0x8a')]);_0x172f0a=getWebApiUrl(_0x197daf);return _0x527b58;}_0x197daf=sanitizeRemoteUri(_0x527b58['remoteUri']);_0x172f0a=getWebApiUrl(_0x197daf);var _0xf86c95={'method':_0x3d87('0x8c'),'uri':_0x3d87('0x8d')+_0x527b58[_0x3d87('0x86')]+_0x3d87('0x8e'),'form':{'client_id':_0x527b58['clientId'],'resource':_0x197daf,'username':_0x527b58['username'],'password':_0x527b58[_0x3d87('0x85')],'grant_type':_0x3d87('0x85'),'client_secret':_0x527b58['clientSecret']},'json':!![]};return rp(_0xf86c95);}})[_0x3d87('0xb')](function(_0x3f1fb8){_0x539759=_0x3f1fb8[_0x3d87('0x8f')];var _0x13c474={'method':_0x3d87('0x90'),'uri':encodeURI(_0x172f0a+_0x3d87('0x91')+_0x5a163d+'\x27'),'headers':{'Authorization':_0x3d87('0x92')+_0x539759,'If-None-Match':null,'OData-Version':_0x3d87('0x93')},'json':!![]};return rp(_0x13c474);})[_0x3d87('0xb')](function(_0x3268c5){var _0x4607d1=_0x3268c5[_0x3d87('0x94')][0x0];var _0x417b37=_0x4607d1[_0x3d87('0x95')];var _0x4a81a9={'method':_0x3d87('0x90'),'uri':_0x172f0a+'EntityDefinitions('+_0x417b37+_0x3d87('0x96'),'headers':{'Authorization':'Bearer\x20'+_0x539759,'If-None-Match':null,'OData-Version':_0x3d87('0x93')},'json':!![]};return rp(_0x4a81a9);})[_0x3d87('0xb')](function(_0x2691ec){_0x2d5e17=_0x2691ec;_0x4fd025=_0x2d5e17['Attributes'];_0x4fd025=_[_0x3d87('0x97')](_0x4fd025,function(_0x580bf3){return!_0xc37160[_0x3d87('0x98')](_0x580bf3[_0x3d87('0x99')]);});var _0x481094=[];var _0x74327=[];_0x4fd025[_0x3d87('0x9a')](function(_0x4f26be){if(_0x4f26be['@odata.type']){var _0x33e8b4=_0x4f26be[_0x3d87('0x9b')][_0x3d87('0x3e')](_0x4f26be[_0x3d87('0x9b')][_0x3d87('0x3f')]('.')+0x1);if(_0x33e8b4===_0x3d87('0x9c')){_0x481094[_0x3d87('0x9d')](getSelectList(_0x172f0a,_0x3364bc,_0x74327,_0x2d5e17[_0x3d87('0x95')],_0x4f26be[_0x3d87('0x95')],_0x539759));}}});return Promise[_0x3d87('0x9e')](_0x481094);})['then'](function(_0x56ddb0){_0x3101df=_0x56ddb0[0x0];var _0xaa8751=[];var _0x49e202=[];_0x4fd025['forEach'](function(_0x45f95b){if(!_[_0x3d87('0x9f')](_0x45f95b[_0x3d87('0x9b')])){var _0xba6bd2=_0x45f95b[_0x3d87('0x9b')][_0x3d87('0x3e')](_0x45f95b[_0x3d87('0x9b')][_0x3d87('0x3f')]('.')+0x1);if(_0xba6bd2===_0x3d87('0xa0')){_0xaa8751[_0x3d87('0x9d')](getBooleanList(_0x172f0a,_0x3364bc,_0x49e202,_0x2d5e17[_0x3d87('0x95')],_0x45f95b[_0x3d87('0x95')],_0x539759));}}});return Promise[_0x3d87('0x9e')](_0xaa8751);})['then'](function(_0x4a320a){_0x489261=_0x4a320a[0x0];var _0x70efe0=[];var _0x59dcf8=[];_0x4fd025['forEach'](function(_0x202bd1){if(_0x202bd1[_0x3d87('0x9b')]){var _0x324967=_0x202bd1[_0x3d87('0x9b')][_0x3d87('0x3e')](_0x202bd1[_0x3d87('0x9b')][_0x3d87('0x3f')]('.')+0x1);if(_0x324967==='StringAttributeMetadata'||_0x324967===_0x3d87('0xa1')||_0x324967===_0x3d87('0xa2')||_0x324967===_0x3d87('0xa3')||_0x324967===_0x3d87('0xa4')||_0x324967===_0x3d87('0xa5')||_0x324967==='StatusAttributeMetadata'||_0x324967==='EntityNameAttributeMetadata'||_0x324967==='StateAttributeMetadata'||_0x324967===_0x3d87('0xa6')){_0x70efe0[_0x3d87('0x9d')](getInputList(_0x172f0a,_0x3364bc,_0x324967,_0x59dcf8,_0x2d5e17[_0x3d87('0x95')],_0x202bd1[_0x3d87('0x95')],_0x539759));}}});return Promise[_0x3d87('0x9e')](_0x70efe0);})['then'](function(_0x5c4129){_0x40d4bc=_0x5c4129[0x0];var _0x39f83a=_0x3101df[_0x3d87('0xa7')](_0x489261)['concat'](_0x40d4bc);var _0x4da3b4={'count':_0x39f83a[_0x3d87('0x1d')],'rows':_0x39f83a};return _0x4da3b4;})['then'](respondWithResult(_0x4f9c0c,null))[_0x3d87('0x2f')](function(_0x118cda){var _0xa35872=_0xa95544[_0x3d87('0x18')][_0x3d87('0xa8')]?0x1f4:_0x118cda[_0x3d87('0xa9')]||0x1f4;logger['error'](_0x118cda[_0x3d87('0x10')]);delete _0x118cda['name'];if(_0xa35872===0x191){_0xa35872=0x190;}_0x4f9c0c[_0x3d87('0x4')](_0xa35872)[_0x3d87('0xaa')](_0xa95544['query']['test']?{'message':_0x3d87('0xab'),'statusCode':_0x118cda['statusCode']}:_0x118cda);});};function getSelectList(_0x2e67fd,_0xa25563,_0x306564,_0x785e4e,_0x1401ae,_0x137419){var _0x598eed={'method':_0x3d87('0x90'),'uri':_0x2e67fd+_0x3d87('0xac')+_0x785e4e+_0x3d87('0xad')+_0x1401ae+_0x3d87('0xae')+_0x3d87('0xaf'),'headers':{'Authorization':_0x3d87('0x92')+_0x137419,'If-None-Match':null,'OData-Version':_0x3d87('0x93')},'json':!![]};return rp(_0x598eed)[_0x3d87('0xb')](function(_0x4ee75b){var _0x3d11fe=[];var _0x5b9455=_0x4ee75b[_0x3d87('0xb0')][_0x3d87('0xb1')];_0x5b9455['forEach'](function(_0x587180){_0x3d11fe[_0x3d87('0x9d')]({'name':_0x587180[_0x3d87('0xb2')][_0x3d87('0xb3')]['Label'],'value':String(_0x587180[_0x3d87('0xb4')])});});var _0x5435f6={'id':_0xa25563+'_'+_0x4ee75b[_0x3d87('0x99')],'name':_0x4ee75b['DisplayName'][_0x3d87('0xb3')]['Label'],'custom':![],'options':_0x3d11fe};_0x306564[_0x3d87('0x9d')](_0x5435f6);return _0x306564;});}function getBooleanList(_0x27ae19,_0x35325d,_0x262263,_0x4ee03d,_0x468687,_0x160a68){var _0x274818={'method':_0x3d87('0x90'),'uri':_0x27ae19+_0x3d87('0xac')+_0x4ee03d+_0x3d87('0xad')+_0x468687+_0x3d87('0xb5'),'headers':{'Authorization':_0x3d87('0x92')+_0x160a68,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x274818)[_0x3d87('0xb')](function(_0xee5a20){var _0x14189=[];_0x14189[_0x3d87('0x9d')]({'name':_0xee5a20[_0x3d87('0xb0')][_0x3d87('0xb6')]['Label']['UserLocalizedLabel'][_0x3d87('0xb2')],'value':'true'},{'name':_0xee5a20[_0x3d87('0xb0')][_0x3d87('0xb7')][_0x3d87('0xb2')]['UserLocalizedLabel'][_0x3d87('0xb2')],'value':'false'});var _0x1e4ad4={'id':_0x35325d+'_'+_0xee5a20[_0x3d87('0x99')],'name':_0xee5a20[_0x3d87('0xb8')][_0x3d87('0xb3')]['Label'],'custom':![],'options':_0x14189};_0x262263['push'](_0x1e4ad4);return _0x262263;});}function getInputList(_0x51b46c,_0x35ea50,_0x5c3dc3,_0x4a7c8e,_0x13716f,_0x248479,_0x24f0eb){var _0x4a9523={'method':_0x3d87('0x90'),'uri':_0x51b46c+_0x3d87('0xac')+_0x13716f+_0x3d87('0xad')+_0x248479+')/Microsoft.Dynamics.CRM.'+_0x5c3dc3+_0x3d87('0xb9'),'headers':{'Authorization':_0x3d87('0x92')+_0x24f0eb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4a9523)[_0x3d87('0xb')](function(_0x2e3a7a){var _0x2ae400={'id':_0x35ea50+'_'+_0x2e3a7a[_0x3d87('0x99')],'name':_0x2e3a7a['DisplayName'][_0x3d87('0xb3')]?_0x2e3a7a[_0x3d87('0xb8')][_0x3d87('0xb3')][_0x3d87('0xb2')]:_0x2e3a7a[_0x3d87('0x99')],'custom':![],'options':[]};_0x4a7c8e[_0x3d87('0x9d')](_0x2ae400);return _0x4a7c8e;});} \ No newline at end of file +var _0x04bc=['clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','/oauth2/token','username','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','Dynamics365Account','include','rows','catch','show','params','includeAll','find','create','body','getConfigurations','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','remoteUri','tenantId','clientId'];(function(_0x2bc78d,_0x31a288){var _0x5d96c9=function(_0x3099e1){while(--_0x3099e1){_0x2bc78d['push'](_0x2bc78d['shift']());}};_0x5d96c9(++_0x31a288);}(_0x04bc,0xeb));var _0xc04b=function(_0x5ec58d,_0x4d64c9){_0x5ec58d=_0x5ec58d-0x0;var _0x78615=_0x04bc[_0x5ec58d];return _0x78615;};'use strict';var rp=require(_0xc04b('0x0'));var util=require(_0xc04b('0x1'));var _=require(_0xc04b('0x2'));var qs=require(_0xc04b('0x3'));var logger=require(_0xc04b('0x4'))('api');var db=require(_0xc04b('0x5'))['db'];var integrations=require(_0xc04b('0x6'));function respondWithResult(_0x289eaf,_0x5b1916){_0x5b1916=_0x5b1916||0xc8;return function(_0x2d3ac3){if(_0x2d3ac3){return _0x289eaf[_0xc04b('0x7')](_0x5b1916)['json'](_0x2d3ac3);}};}function respondWithFilteredResult(_0x1ec00d,_0x12817a){return function(_0x15948d){if(_0x15948d){var _0x279e5c=typeof _0x12817a[_0xc04b('0x8')]===_0xc04b('0x9')&&typeof _0x12817a[_0xc04b('0xa')]==='undefined';var _0x4bd72a=_0x15948d['count'];var _0x121c50=_0x279e5c?0x0:_0x12817a['offset'];var _0x3742b8=_0x279e5c?_0x15948d[_0xc04b('0xb')]:_0x12817a[_0xc04b('0x8')]+_0x12817a[_0xc04b('0xa')];var _0x1ea890;if(_0x3742b8>=_0x4bd72a){_0x3742b8=_0x4bd72a;_0x1ea890=0xc8;}else{_0x1ea890=0xce;}_0x1ec00d[_0xc04b('0x7')](_0x1ea890);return _0x1ec00d[_0xc04b('0xc')](_0xc04b('0xd'),_0x121c50+'-'+_0x3742b8+'/'+_0x4bd72a)[_0xc04b('0xe')](_0x15948d);}return null;};}function saveUpdates(_0x3d7ec0){return function(_0xd9c01d){if(_0xd9c01d){return _0xd9c01d[_0xc04b('0xf')](_0x3d7ec0)[_0xc04b('0x10')](function(_0x42d77c){return _0x42d77c;});}return null;};}function removeEntity(_0x1f5cb7){return function(_0x699cd){if(_0x699cd){return _0x699cd[_0xc04b('0x11')]()[_0xc04b('0x10')](function(){_0x1f5cb7[_0xc04b('0x7')](0xcc)[_0xc04b('0x12')]();});}};}function handleEntityNotFound(_0x39b3dc){return function(_0x7b257f){if(!_0x7b257f){_0x39b3dc[_0xc04b('0x13')](0x194);}return _0x7b257f;};}function handleError(_0x5f55a0,_0x5474c9){_0x5474c9=_0x5474c9||0x1f4;return function(_0x13c500){logger[_0xc04b('0x14')](_0x13c500[_0xc04b('0x15')]);if(_0x13c500[_0xc04b('0x16')]){delete _0x13c500[_0xc04b('0x16')];}_0x5f55a0[_0xc04b('0x7')](_0x5474c9)[_0xc04b('0x17')](_0x13c500);};}exports['index']=function(_0x41e17e,_0x5a8bf7){var _0xc0815a={},_0x11859b={},_0xea6c61={'count':0x0,'rows':[]};var _0x486abc=_[_0xc04b('0x18')](db['Dynamics365Account'][_0xc04b('0x19')],function(_0x65d2d1){return{'name':_0x65d2d1[_0xc04b('0x1a')],'type':_0x65d2d1[_0xc04b('0x1b')][_0xc04b('0x1c')]};});_0x11859b['model']=_['map'](_0x486abc,_0xc04b('0x16'));_0x11859b[_0xc04b('0x1d')]=_[_0xc04b('0x1e')](_0x41e17e[_0xc04b('0x1d')]);_0x11859b['filters']=_[_0xc04b('0x1f')](_0x11859b[_0xc04b('0x20')],_0x11859b[_0xc04b('0x1d')]);_0xc0815a[_0xc04b('0x21')]=_[_0xc04b('0x1f')](_0x11859b['model'],qs[_0xc04b('0x22')](_0x41e17e[_0xc04b('0x1d')]['fields']));_0xc0815a[_0xc04b('0x21')]=_0xc0815a[_0xc04b('0x21')][_0xc04b('0x23')]?_0xc0815a['attributes']:_0x11859b[_0xc04b('0x20')];if(!_0x41e17e[_0xc04b('0x1d')][_0xc04b('0x24')](_0xc04b('0x25'))){_0xc0815a[_0xc04b('0xa')]=qs[_0xc04b('0xa')](_0x41e17e['query'][_0xc04b('0xa')]);_0xc0815a[_0xc04b('0x8')]=qs[_0xc04b('0x8')](_0x41e17e[_0xc04b('0x1d')]['offset']);}_0xc0815a[_0xc04b('0x26')]=qs[_0xc04b('0x27')](_0x41e17e[_0xc04b('0x1d')]['sort']);_0xc0815a[_0xc04b('0x28')]=qs[_0xc04b('0x29')](_['pick'](_0x41e17e[_0xc04b('0x1d')],_0x11859b[_0xc04b('0x29')]),_0x486abc);if(_0x41e17e[_0xc04b('0x1d')][_0xc04b('0x2a')]){_0xc0815a[_0xc04b('0x28')]=_['merge'](_0xc0815a[_0xc04b('0x28')],{'$or':_[_0xc04b('0x18')](_0x486abc,function(_0x27aee4){if(_0x27aee4[_0xc04b('0x1b')]!=='VIRTUAL'){var _0x2d1aef={};_0x2d1aef[_0x27aee4[_0xc04b('0x16')]]={'$like':'%'+_0x41e17e[_0xc04b('0x1d')][_0xc04b('0x2a')]+'%'};return _0x2d1aef;}})});}_0xc0815a=_[_0xc04b('0x2b')]({},_0xc0815a,_0x41e17e[_0xc04b('0x2c')]);var _0x291414={'where':_0xc0815a[_0xc04b('0x28')]};return db[_0xc04b('0x2d')][_0xc04b('0xb')](_0x291414)['then'](function(_0x217e2d){_0xea6c61[_0xc04b('0xb')]=_0x217e2d;if(_0x41e17e[_0xc04b('0x1d')]['includeAll']){_0xc0815a[_0xc04b('0x2e')]=[{'all':!![]}];}return db[_0xc04b('0x2d')]['findAll'](_0xc0815a);})['then'](function(_0x300ceb){_0xea6c61[_0xc04b('0x2f')]=_0x300ceb;return _0xea6c61;})[_0xc04b('0x10')](respondWithFilteredResult(_0x5a8bf7,_0xc0815a))[_0xc04b('0x30')](handleError(_0x5a8bf7,null));};exports[_0xc04b('0x31')]=function(_0x11abdc,_0x525026){var _0x3f0496={'raw':![],'where':{'id':_0x11abdc[_0xc04b('0x32')]['id']}},_0x30b2ca={};_0x30b2ca[_0xc04b('0x20')]=_['keys'](db[_0xc04b('0x2d')][_0xc04b('0x19')]);_0x30b2ca['query']=_[_0xc04b('0x1e')](_0x11abdc[_0xc04b('0x1d')]);_0x30b2ca[_0xc04b('0x29')]=_[_0xc04b('0x1f')](_0x30b2ca[_0xc04b('0x20')],_0x30b2ca[_0xc04b('0x1d')]);_0x3f0496[_0xc04b('0x21')]=_[_0xc04b('0x1f')](_0x30b2ca[_0xc04b('0x20')],qs[_0xc04b('0x22')](_0x11abdc['query'][_0xc04b('0x22')]));_0x3f0496[_0xc04b('0x21')]=_0x3f0496[_0xc04b('0x21')][_0xc04b('0x23')]?_0x3f0496[_0xc04b('0x21')]:_0x30b2ca[_0xc04b('0x20')];if(_0x11abdc[_0xc04b('0x1d')][_0xc04b('0x33')]){_0x3f0496[_0xc04b('0x2e')]=[{'all':!![]}];}_0x3f0496=_['merge']({},_0x3f0496,_0x11abdc[_0xc04b('0x2c')]);return db[_0xc04b('0x2d')][_0xc04b('0x34')](_0x3f0496)[_0xc04b('0x10')](handleEntityNotFound(_0x525026,null))[_0xc04b('0x10')](respondWithResult(_0x525026,null))[_0xc04b('0x30')](handleError(_0x525026,null));};exports[_0xc04b('0x35')]=function(_0x460cbd,_0x2ec258){return db['Dynamics365Account'][_0xc04b('0x35')](_0x460cbd['body'],{})[_0xc04b('0x10')](respondWithResult(_0x2ec258,0xc9))[_0xc04b('0x30')](handleError(_0x2ec258,null));};exports[_0xc04b('0xf')]=function(_0x4f8ffd,_0x27681f){if(_0x4f8ffd[_0xc04b('0x36')]['id']){delete _0x4f8ffd[_0xc04b('0x36')]['id'];}return db[_0xc04b('0x2d')][_0xc04b('0x34')]({'where':{'id':_0x4f8ffd[_0xc04b('0x32')]['id']}})[_0xc04b('0x10')](handleEntityNotFound(_0x27681f,null))['then'](saveUpdates(_0x4f8ffd[_0xc04b('0x36')],null))[_0xc04b('0x10')](respondWithResult(_0x27681f,null))[_0xc04b('0x30')](handleError(_0x27681f,null));};exports[_0xc04b('0x11')]=function(_0x4d5a43,_0x184374){return db['Dynamics365Account']['find']({'where':{'id':_0x4d5a43['params']['id']}})[_0xc04b('0x10')](handleEntityNotFound(_0x184374,null))['then'](removeEntity(_0x184374,null))['catch'](handleError(_0x184374,null));};exports[_0xc04b('0x37')]=function(_0x3852c4,_0x4a0c7b){var _0x458ae1={};var _0x144780={};var _0x3bdc92;var _0x3a496e;return db[_0xc04b('0x2d')]['findOne']({'where':{'id':_0x3852c4[_0xc04b('0x32')]['id']}})[_0xc04b('0x10')](handleEntityNotFound(_0x4a0c7b,null))['then'](function(_0x11b939){if(_0x11b939){_0x3bdc92=_0x11b939;_0x144780['model']=_[_0xc04b('0x1e')](db['Dynamics365Configuration'][_0xc04b('0x19')]);_0x144780[_0xc04b('0x1d')]=_['keys'](_0x3852c4[_0xc04b('0x1d')]);_0x144780['filters']=_[_0xc04b('0x1f')](_0x144780[_0xc04b('0x20')],_0x144780['query']);_0x458ae1[_0xc04b('0x21')]=_[_0xc04b('0x1f')](_0x144780[_0xc04b('0x20')],qs[_0xc04b('0x22')](_0x3852c4[_0xc04b('0x1d')][_0xc04b('0x22')]));_0x458ae1['attributes']=_0x458ae1[_0xc04b('0x21')][_0xc04b('0x23')]?_0x458ae1[_0xc04b('0x21')]:_0x144780[_0xc04b('0x20')];_0x458ae1[_0xc04b('0x26')]=qs['sort'](_0x3852c4['query'][_0xc04b('0x27')]);_0x458ae1[_0xc04b('0x28')]=qs[_0xc04b('0x29')](_[_0xc04b('0x38')](_0x3852c4[_0xc04b('0x1d')],_0x144780[_0xc04b('0x29')]));if(_0x3852c4[_0xc04b('0x1d')]['filter']){_0x458ae1[_0xc04b('0x28')]=_['merge'](_0x458ae1[_0xc04b('0x28')],{'$or':_[_0xc04b('0x18')](_0x458ae1[_0xc04b('0x21')],function(_0xb7ce8f){var _0x17e32c={};_0x17e32c[_0xb7ce8f]={'$like':'%'+_0x3852c4['query']['filter']+'%'};return _0x17e32c;})});}_0x458ae1=_[_0xc04b('0x2b')]({},_0x458ae1,_0x3852c4['options']);return _0x3bdc92[_0xc04b('0x37')](_0x458ae1);}})['then'](function(_0x2ff473){if(_0x2ff473){_0x3a496e=_0x2ff473[_0xc04b('0x23')];if(!_0x3852c4[_0xc04b('0x1d')]['hasOwnProperty'](_0xc04b('0x25'))){_0x458ae1[_0xc04b('0xa')]=qs[_0xc04b('0xa')](_0x3852c4['query'][_0xc04b('0xa')]);_0x458ae1[_0xc04b('0x8')]=qs['offset'](_0x3852c4[_0xc04b('0x1d')]['offset']);}return _0x3bdc92[_0xc04b('0x37')](_0x458ae1);}})[_0xc04b('0x10')](function(_0x4c8c2b){if(_0x4c8c2b){return _0x4c8c2b?{'count':_0x3a496e,'rows':_0x4c8c2b}:null;}})[_0xc04b('0x10')](respondWithResult(_0x4a0c7b,null))[_0xc04b('0x30')](handleError(_0x4a0c7b,null));};exports[_0xc04b('0x39')]=function(_0x1a4a48,_0x2f6384){if(_0x1a4a48[_0xc04b('0x36')]['id']){delete _0x1a4a48[_0xc04b('0x36')]['id'];}return db[_0xc04b('0x2d')]['findOne']({'where':{'id':_0x1a4a48[_0xc04b('0x32')]['id']}})[_0xc04b('0x10')](handleEntityNotFound(_0x2f6384,null))[_0xc04b('0x10')](function(_0x194740){if(_0x194740){_0x1a4a48[_0xc04b('0x36')][_0xc04b('0x3a')]=_0x194740['id'];_0x1a4a48['body'][_0xc04b('0x3b')]=integrations[_0xc04b('0x3c')](_0x1a4a48[_0xc04b('0x36')][_0xc04b('0x3d')],_0x1a4a48['body'][_0xc04b('0x1b')]);_0x1a4a48[_0xc04b('0x36')][_0xc04b('0x3e')]=integrations['getDescriptions'](_0x1a4a48['body'][_0xc04b('0x3d')],_0x1a4a48['body'][_0xc04b('0x1b')]);return db[_0xc04b('0x3f')][_0xc04b('0x35')](_0x1a4a48[_0xc04b('0x36')],{'include':[{'model':db[_0xc04b('0x40')],'as':_0xc04b('0x3b')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xc04b('0x10')](respondWithResult(_0x2f6384,null))[_0xc04b('0x30')](handleError(_0x2f6384,null));};function sanitizeRemoteUri(_0x38baee){var _0x3dafac=_0x38baee[_0xc04b('0x41')](-0x1);if(_0x3dafac==='/')return _0x38baee[_0xc04b('0x42')](0x0,_0x38baee[_0xc04b('0x43')](_0x3dafac));return _0x38baee;}function getWebApiUrl(_0x3e082e){return util['format'](_0xc04b('0x44'),_0x3e082e);}exports[_0xc04b('0x45')]=function(_0x1246b3,_0x4fb804){var _0x3f2366=_0x1246b3[_0xc04b('0x1d')][_0xc04b('0x46')];var _0x2d01ed=_0x3f2366===_0xc04b('0x47')?'Incident':'PhoneCall';var _0x360f84='';var _0x3a3bef='';var _0x4b6f41='';var _0x1f4e44='';var _0x4d9911='';var _0x4d0d7f='';var _0x1e147f='';var _0x1bdcfe='';var _0x57454e=['title',_0xc04b('0x48'),_0xc04b('0x49'),'ownerid',_0xc04b('0x4a'),_0xc04b('0x4b'),_0xc04b('0x4c'),_0xc04b('0x4d'),'directioncode',_0xc04b('0x4e')];var _0x1f5302=[_0xc04b('0x4f'),_0xc04b('0x50'),'actualserviceunits',_0xc04b('0x51'),'contactidname',_0xc04b('0x52'),_0xc04b('0x53'),_0xc04b('0x54'),_0xc04b('0x55'),_0xc04b('0x56'),_0xc04b('0x57'),'createdbyyominame',_0xc04b('0x58'),'createdonbehalfbyname',_0xc04b('0x59'),_0xc04b('0x5a'),_0xc04b('0x5b'),'customeridyominame','emailaddress',_0xc04b('0x5c'),_0xc04b('0x5d'),_0xc04b('0x5e'),_0xc04b('0x5f'),_0xc04b('0x60'),_0xc04b('0x61'),_0xc04b('0x62'),_0xc04b('0x63'),'influencescore',_0xc04b('0x64'),_0xc04b('0x65'),'masteridname',_0xc04b('0x66'),_0xc04b('0x67'),_0xc04b('0x68'),'modifiedbyyominame',_0xc04b('0x69'),_0xc04b('0x6a'),_0xc04b('0x6b'),_0xc04b('0x6c'),_0xc04b('0x6d'),'numberofchildincidents',_0xc04b('0x6e'),_0xc04b('0x6f'),'owneridname','owneridtype','owneridyominame',_0xc04b('0x70'),_0xc04b('0x71'),_0xc04b('0x72'),_0xc04b('0x73'),_0xc04b('0x74'),_0xc04b('0x75'),_0xc04b('0x76'),_0xc04b('0x77'),'responseby',_0xc04b('0x78'),_0xc04b('0x79'),_0xc04b('0x7a'),_0xc04b('0x7b'),_0xc04b('0x7c'),'socialprofileidname',_0xc04b('0x7d'),_0xc04b('0x7e'),'subjectidname',_0xc04b('0x7f'),_0xc04b('0x80'),_0xc04b('0x81'),'traversedpath',_0xc04b('0x82'),'versionnumber'];var _0x472b02=_0x57454e[_0xc04b('0x83')](_0x1f5302);return db[_0xc04b('0x2d')]['findOne']({'where':{'id':_0x1246b3[_0xc04b('0x32')]['id']},'attributes':['id','username','password',_0xc04b('0x84'),_0xc04b('0x85'),_0xc04b('0x86'),_0xc04b('0x87'),_0xc04b('0x88')],'include':[{'model':db[_0xc04b('0x89')],'as':_0xc04b('0x89'),'attributes':['id',_0xc04b('0x8a'),_0xc04b('0x8b')]}]})[_0xc04b('0x10')](handleEntityNotFound(_0x4fb804,null))['then'](function(_0x52b838){if(_0x52b838){if(_0x52b838[_0xc04b('0x88')]){_0x52b838['access_token']=_0x52b838[_0xc04b('0x89')][_0xc04b('0x8a')];_0x1bdcfe=sanitizeRemoteUri(_0x52b838['CloudProvider']['data7']);_0x1e147f=getWebApiUrl(_0x1bdcfe);return _0x52b838;}_0x1bdcfe=sanitizeRemoteUri(_0x52b838[_0xc04b('0x84')]);_0x1e147f=getWebApiUrl(_0x1bdcfe);var _0x519b28={'method':'POST','uri':_0xc04b('0x8c')+_0x52b838[_0xc04b('0x85')]+_0xc04b('0x8d'),'form':{'client_id':_0x52b838['clientId'],'resource':_0x1bdcfe,'username':_0x52b838[_0xc04b('0x8e')],'password':_0x52b838[_0xc04b('0x8f')],'grant_type':_0xc04b('0x8f'),'client_secret':_0x52b838['clientSecret']},'json':!![]};return rp(_0x519b28);}})[_0xc04b('0x10')](function(_0x2aa806){_0x4d0d7f=_0x2aa806[_0xc04b('0x90')];var _0x11a499={'method':'GET','uri':encodeURI(_0x1e147f+_0xc04b('0x91')+_0x2d01ed+'\x27'),'headers':{'Authorization':_0xc04b('0x92')+_0x4d0d7f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x11a499);})[_0xc04b('0x10')](function(_0x19fee0){var _0x1d1f6b=_0x19fee0[_0xc04b('0x93')][0x0];var _0x9598cc=_0x1d1f6b[_0xc04b('0x94')];var _0x5782d0={'method':_0xc04b('0x95'),'uri':_0x1e147f+_0xc04b('0x96')+_0x9598cc+_0xc04b('0x97'),'headers':{'Authorization':_0xc04b('0x92')+_0x4d0d7f,'If-None-Match':null,'OData-Version':_0xc04b('0x98')},'json':!![]};return rp(_0x5782d0);})[_0xc04b('0x10')](function(_0x5e66e8){_0x360f84=_0x5e66e8;_0x3a3bef=_0x360f84[_0xc04b('0x99')];_0x3a3bef=_['remove'](_0x3a3bef,function(_0x3c31ea){return!_0x472b02[_0xc04b('0x9a')](_0x3c31ea[_0xc04b('0x9b')]);});var _0x3a34c3=[];var _0xf21440=[];_0x3a3bef[_0xc04b('0x9c')](function(_0x361217){if(_0x361217[_0xc04b('0x9d')]){var _0x154601=_0x361217[_0xc04b('0x9d')][_0xc04b('0x42')](_0x361217['@odata.type'][_0xc04b('0x43')]('.')+0x1);if(_0x154601===_0xc04b('0x9e')){_0x3a34c3[_0xc04b('0x9f')](getSelectList(_0x1e147f,_0x3f2366,_0xf21440,_0x360f84[_0xc04b('0x94')],_0x361217[_0xc04b('0x94')],_0x4d0d7f));}}});return Promise[_0xc04b('0xa0')](_0x3a34c3);})[_0xc04b('0x10')](function(_0x4bb061){_0x4b6f41=_0x4bb061[0x0];var _0x10552c=[];var _0x3ded3f=[];_0x3a3bef[_0xc04b('0x9c')](function(_0x41eae3){if(!_[_0xc04b('0xa1')](_0x41eae3[_0xc04b('0x9d')])){var _0x2304ef=_0x41eae3['@odata.type'][_0xc04b('0x42')](_0x41eae3[_0xc04b('0x9d')][_0xc04b('0x43')]('.')+0x1);if(_0x2304ef===_0xc04b('0xa2')){_0x10552c[_0xc04b('0x9f')](getBooleanList(_0x1e147f,_0x3f2366,_0x3ded3f,_0x360f84[_0xc04b('0x94')],_0x41eae3['MetadataId'],_0x4d0d7f));}}});return Promise[_0xc04b('0xa0')](_0x10552c);})['then'](function(_0x46595e){_0x1f4e44=_0x46595e[0x0];var _0x8d3835=[];var _0x1d08da=[];_0x3a3bef[_0xc04b('0x9c')](function(_0x1714a4){if(_0x1714a4[_0xc04b('0x9d')]){var _0x4dfad1=_0x1714a4['@odata.type'][_0xc04b('0x42')](_0x1714a4[_0xc04b('0x9d')][_0xc04b('0x43')]('.')+0x1);if(_0x4dfad1==='StringAttributeMetadata'||_0x4dfad1===_0xc04b('0xa3')||_0x4dfad1===_0xc04b('0xa4')||_0x4dfad1===_0xc04b('0xa5')||_0x4dfad1===_0xc04b('0xa6')||_0x4dfad1===_0xc04b('0xa7')||_0x4dfad1===_0xc04b('0xa8')||_0x4dfad1==='EntityNameAttributeMetadata'||_0x4dfad1===_0xc04b('0xa9')||_0x4dfad1===_0xc04b('0xaa')){_0x8d3835[_0xc04b('0x9f')](getInputList(_0x1e147f,_0x3f2366,_0x4dfad1,_0x1d08da,_0x360f84[_0xc04b('0x94')],_0x1714a4[_0xc04b('0x94')],_0x4d0d7f));}}});return Promise[_0xc04b('0xa0')](_0x8d3835);})['then'](function(_0x3d6fab){_0x4d9911=_0x3d6fab[0x0];var _0xc5fa2d=_0x4b6f41[_0xc04b('0x83')](_0x1f4e44)[_0xc04b('0x83')](_0x4d9911);var _0x531dcf={'count':_0xc5fa2d[_0xc04b('0x23')],'rows':_0xc5fa2d};return _0x531dcf;})[_0xc04b('0x10')](respondWithResult(_0x4fb804,null))[_0xc04b('0x30')](function(_0x28f764){var _0x5c3b5a=_0x1246b3[_0xc04b('0x1d')][_0xc04b('0xab')]?0x1f4:_0x28f764[_0xc04b('0xac')]||0x1f4;logger[_0xc04b('0x14')](_0x28f764[_0xc04b('0x15')]);delete _0x28f764[_0xc04b('0x16')];if(_0x5c3b5a===0x191){_0x5c3b5a=0x190;}_0x4fb804[_0xc04b('0x7')](_0x5c3b5a)[_0xc04b('0x17')](_0x1246b3[_0xc04b('0x1d')][_0xc04b('0xab')]?{'message':_0xc04b('0xad'),'statusCode':_0x28f764[_0xc04b('0xac')]}:_0x28f764);});};function getSelectList(_0x65b521,_0x567ccf,_0x108f02,_0x221def,_0x3815f6,_0x49af93){var _0x336f9b={'method':_0xc04b('0x95'),'uri':_0x65b521+_0xc04b('0x96')+_0x221def+_0xc04b('0xae')+_0x3815f6+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xc04b('0x92')+_0x49af93,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x336f9b)['then'](function(_0x2fd576){var _0x5407af=[];var _0xc1c29b=_0x2fd576[_0xc04b('0xaf')][_0xc04b('0xb0')];_0xc1c29b[_0xc04b('0x9c')](function(_0x16e2d9){_0x5407af[_0xc04b('0x9f')]({'name':_0x16e2d9['Label'][_0xc04b('0xb1')][_0xc04b('0xb2')],'value':String(_0x16e2d9[_0xc04b('0xb3')])});});var _0x5ed1f4={'id':_0x567ccf+'_'+_0x2fd576[_0xc04b('0x9b')],'name':_0x2fd576[_0xc04b('0xb4')][_0xc04b('0xb1')][_0xc04b('0xb2')],'custom':![],'options':_0x5407af};_0x108f02['push'](_0x5ed1f4);return _0x108f02;});}function getBooleanList(_0x185f0,_0x35601b,_0x1ea5de,_0xa96475,_0x5aa45a,_0x154c2d){var _0x4117a8={'method':_0xc04b('0x95'),'uri':_0x185f0+'EntityDefinitions('+_0xa96475+')/Attributes('+_0x5aa45a+_0xc04b('0xb5'),'headers':{'Authorization':_0xc04b('0x92')+_0x154c2d,'If-None-Match':null,'OData-Version':_0xc04b('0x98')},'json':!![]};return rp(_0x4117a8)[_0xc04b('0x10')](function(_0x1cc1e9){var _0x17a01b=[];_0x17a01b[_0xc04b('0x9f')]({'name':_0x1cc1e9[_0xc04b('0xaf')]['TrueOption'][_0xc04b('0xb2')][_0xc04b('0xb1')][_0xc04b('0xb2')],'value':_0xc04b('0xb6')},{'name':_0x1cc1e9[_0xc04b('0xaf')][_0xc04b('0xb7')][_0xc04b('0xb2')]['UserLocalizedLabel']['Label'],'value':'false'});var _0x372c91={'id':_0x35601b+'_'+_0x1cc1e9[_0xc04b('0x9b')],'name':_0x1cc1e9[_0xc04b('0xb4')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x17a01b};_0x1ea5de[_0xc04b('0x9f')](_0x372c91);return _0x1ea5de;});}function getInputList(_0x544684,_0x45c8ea,_0x2a8d38,_0x4b45a5,_0x46ccdb,_0x3d4a61,_0x5511f5){var _0x1db9aa={'method':_0xc04b('0x95'),'uri':_0x544684+'EntityDefinitions('+_0x46ccdb+_0xc04b('0xae')+_0x3d4a61+_0xc04b('0xb8')+_0x2a8d38+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xc04b('0x92')+_0x5511f5,'If-None-Match':null,'OData-Version':_0xc04b('0x98')},'json':!![]};return rp(_0x1db9aa)[_0xc04b('0x10')](function(_0x541d53){var _0x721686={'id':_0x45c8ea+'_'+_0x541d53['LogicalName'],'name':_0x541d53[_0xc04b('0xb4')][_0xc04b('0xb1')]?_0x541d53[_0xc04b('0xb4')][_0xc04b('0xb1')][_0xc04b('0xb2')]:_0x541d53[_0xc04b('0x9b')],'custom':![],'options':[]};_0x4b45a5['push'](_0x721686);return _0x4b45a5;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 32b8614..a086c51 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x4adb15,_0x1aac5b){var _0x3f4905=function(_0x3cb040){while(--_0x3cb040){_0x4adb15['push'](_0x4adb15['shift']());}};_0x3f4905(++_0x1aac5b);}(_0x757a,0xde));var _0xa757=function(_0x590fab,_0x588c02){_0x590fab=_0x590fab-0x0;var _0x30395a=_0x757a[_0x590fab];return _0x30395a;};'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'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x2738da,_0x4a6ac4){var _0x3005f7=function(_0x34a9e3){while(--_0x34a9e3){_0x2738da['push'](_0x2738da['shift']());}};_0x3005f7(++_0x4a6ac4);}(_0xb7e7,0x121));var _0x7b7e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb7e7[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 7f555f9..e8121f2 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 _0x6f6a=['jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','Dynamics365Account','findAll','options','raw','attributes','include','map','model','GetDynamics365Account','stringify','ShowDynamics365Account','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f6a,0x143));var _0xa6f6=function(_0x4e843e,_0x1a2e9d){_0x4e843e=_0x4e843e-0x0;var _0x495585=_0x6f6a[_0x4e843e];return _0x495585;};'use strict';var _=require(_0xa6f6('0x0'));var util=require(_0xa6f6('0x1'));var moment=require(_0xa6f6('0x2'));var BPromise=require(_0xa6f6('0x3'));var rs=require(_0xa6f6('0x4'));var fs=require('fs');var Redis=require(_0xa6f6('0x5'));var db=require(_0xa6f6('0x6'))['db'];var utils=require(_0xa6f6('0x7'));var logger=require('../../config/logger')(_0xa6f6('0x8'));var config=require(_0xa6f6('0x9'));var jayson=require(_0xa6f6('0xa'));var client=jayson[_0xa6f6('0xb')][_0xa6f6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5421a6,_0x202513,_0x57df6b){return new BPromise(function(_0x104a0d,_0x4569d9){return client[_0xa6f6('0xd')](_0x5421a6,_0x57df6b)[_0xa6f6('0xe')](function(_0xab8ba){logger[_0xa6f6('0xf')](_0xa6f6('0x10'),_0x202513,'request\x20sent');logger[_0xa6f6('0x11')](_0xa6f6('0x12'),_0x202513,_0xa6f6('0x13'),JSON['stringify'](_0xab8ba));if(_0xab8ba[_0xa6f6('0x14')]){if(_0xab8ba[_0xa6f6('0x14')]['code']===0x1f4){logger[_0xa6f6('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x202513,_0xab8ba['error'][_0xa6f6('0x15')]);return _0x4569d9(_0xab8ba[_0xa6f6('0x14')][_0xa6f6('0x15')]);}logger[_0xa6f6('0x14')](_0xa6f6('0x10'),_0x202513,_0xab8ba[_0xa6f6('0x14')][_0xa6f6('0x15')]);return _0x104a0d(_0xab8ba[_0xa6f6('0x14')][_0xa6f6('0x15')]);}else{logger[_0xa6f6('0xf')](_0xa6f6('0x10'),_0x202513,_0xa6f6('0x13'));_0x104a0d(_0xab8ba[_0xa6f6('0x16')][_0xa6f6('0x15')]);}})[_0xa6f6('0x17')](function(_0x38b237){logger['error'](_0xa6f6('0x10'),_0x202513,_0x38b237);_0x4569d9(_0x38b237);});});}exports['GetDynamics365Account']=function(_0x274a34){var _0x298e96=this;return new Promise(function(_0x16f1b8,_0x333930){return db[_0xa6f6('0x18')][_0xa6f6('0x19')]({'raw':_0x274a34[_0xa6f6('0x1a')]?_0x274a34[_0xa6f6('0x1a')][_0xa6f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x274a34['options']?_0x274a34[_0xa6f6('0x1a')]['where']||null:null,'attributes':_0x274a34['options']?_0x274a34[_0xa6f6('0x1a')][_0xa6f6('0x1c')]||null:null,'limit':_0x274a34[_0xa6f6('0x1a')]?_0x274a34[_0xa6f6('0x1a')]['limit']||null:null,'include':_0x274a34['options']?_0x274a34[_0xa6f6('0x1a')][_0xa6f6('0x1d')]?_[_0xa6f6('0x1e')](_0x274a34[_0xa6f6('0x1a')][_0xa6f6('0x1d')],function(_0x9d5930){return{'model':db[_0x9d5930['model']],'as':_0x9d5930['as'],'attributes':_0x9d5930[_0xa6f6('0x1c')],'include':_0x9d5930[_0xa6f6('0x1d')]?_[_0xa6f6('0x1e')](_0x9d5930[_0xa6f6('0x1d')],function(_0x36222c){return{'model':db[_0x36222c[_0xa6f6('0x1f')]],'as':_0x36222c['as'],'attributes':_0x36222c[_0xa6f6('0x1c')],'include':_0x36222c[_0xa6f6('0x1d')]?_[_0xa6f6('0x1e')](_0x36222c[_0xa6f6('0x1d')],function(_0x1879a9){return{'model':db[_0x1879a9[_0xa6f6('0x1f')]],'as':_0x1879a9['as'],'attributes':_0x1879a9['attributes']};}):[]};}):[]};}):[]:[]})[_0xa6f6('0xe')](function(_0x5f1ccd){logger['info'](_0xa6f6('0x20'),_0x274a34);logger[_0xa6f6('0x11')]('GetDynamics365Account',_0x274a34,JSON[_0xa6f6('0x21')](_0x5f1ccd));_0x16f1b8(_0x5f1ccd);})['catch'](function(_0x559cab){logger[_0xa6f6('0x14')](_0xa6f6('0x20'),_0x559cab[_0xa6f6('0x15')],_0x274a34);_0x333930(_0x298e96[_0xa6f6('0x14')](0x1f4,_0x559cab[_0xa6f6('0x15')]));});});};exports[_0xa6f6('0x22')]=function(_0x560233){var _0x429c16=this;return new Promise(function(_0x5c711a,_0x70d5e0){return db[_0xa6f6('0x18')][_0xa6f6('0x23')]({'raw':_0x560233[_0xa6f6('0x1a')]?_0x560233[_0xa6f6('0x1a')][_0xa6f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x560233[_0xa6f6('0x1a')]?_0x560233[_0xa6f6('0x1a')][_0xa6f6('0x24')]||null:null,'attributes':_0x560233['options']?_0x560233[_0xa6f6('0x1a')][_0xa6f6('0x1c')]||null:null,'include':_0x560233[_0xa6f6('0x1a')]?_0x560233[_0xa6f6('0x1a')][_0xa6f6('0x1d')]?_[_0xa6f6('0x1e')](_0x560233[_0xa6f6('0x1a')][_0xa6f6('0x1d')],function(_0xd199ce){return{'model':db[_0xd199ce[_0xa6f6('0x1f')]],'as':_0xd199ce['as'],'attributes':_0xd199ce[_0xa6f6('0x1c')],'include':_0xd199ce[_0xa6f6('0x1d')]?_[_0xa6f6('0x1e')](_0xd199ce[_0xa6f6('0x1d')],function(_0x163e5b){return{'model':db[_0x163e5b[_0xa6f6('0x1f')]],'as':_0x163e5b['as'],'attributes':_0x163e5b[_0xa6f6('0x1c')],'include':_0x163e5b[_0xa6f6('0x1d')]?_[_0xa6f6('0x1e')](_0x163e5b[_0xa6f6('0x1d')],function(_0x33526d){return{'model':db[_0x33526d[_0xa6f6('0x1f')]],'as':_0x33526d['as'],'attributes':_0x33526d[_0xa6f6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa6f6('0xe')](function(_0x5a7c21){logger[_0xa6f6('0xf')](_0xa6f6('0x22'),_0x560233);logger[_0xa6f6('0x11')]('ShowDynamics365Account',_0x560233,JSON[_0xa6f6('0x21')](_0x5a7c21));_0x5c711a(_0x5a7c21);})[_0xa6f6('0x17')](function(_0x1bba0e){logger[_0xa6f6('0x14')](_0xa6f6('0x22'),_0x1bba0e['message'],_0x560233);_0x70d5e0(_0x429c16[_0xa6f6('0x14')](0x1f4,_0x1bba0e[_0xa6f6('0x15')]));});});}; \ No newline at end of file +var _0xf28a=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','info','find','ShowDynamics365Account','catch','lodash','util','moment','randomstring'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0xf28a,0x1c4));var _0xaf28=function(_0x2ef903,_0x523283){_0x2ef903=_0x2ef903-0x0;var _0x32d9dc=_0xf28a[_0x2ef903];return _0x32d9dc;};'use strict';var _=require(_0xaf28('0x0'));var util=require(_0xaf28('0x1'));var moment=require(_0xaf28('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf28('0x3'));var fs=require('fs');var Redis=require(_0xaf28('0x4'));var db=require(_0xaf28('0x5'))['db'];var utils=require(_0xaf28('0x6'));var logger=require('../../config/logger')(_0xaf28('0x7'));var config=require(_0xaf28('0x8'));var jayson=require(_0xaf28('0x9'));var client=jayson[_0xaf28('0xa')][_0xaf28('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30ac19,_0x47f567,_0x224d61){return new BPromise(function(_0x12e14c,_0x216b51){return client[_0xaf28('0xc')](_0x30ac19,_0x224d61)[_0xaf28('0xd')](function(_0x4e1109){logger['info'](_0xaf28('0xe'),_0x47f567,_0xaf28('0xf'));logger[_0xaf28('0x10')](_0xaf28('0x11'),_0x47f567,_0xaf28('0xf'),JSON[_0xaf28('0x12')](_0x4e1109));if(_0x4e1109[_0xaf28('0x13')]){if(_0x4e1109[_0xaf28('0x13')][_0xaf28('0x14')]===0x1f4){logger[_0xaf28('0x13')](_0xaf28('0xe'),_0x47f567,_0x4e1109['error'][_0xaf28('0x15')]);return _0x216b51(_0x4e1109[_0xaf28('0x13')][_0xaf28('0x15')]);}logger[_0xaf28('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x47f567,_0x4e1109['error'][_0xaf28('0x15')]);return _0x12e14c(_0x4e1109['error']['message']);}else{logger['info'](_0xaf28('0xe'),_0x47f567,'request\x20sent');_0x12e14c(_0x4e1109[_0xaf28('0x16')]['message']);}})['catch'](function(_0xacd136){logger['error'](_0xaf28('0xe'),_0x47f567,_0xacd136);_0x216b51(_0xacd136);});});}exports[_0xaf28('0x17')]=function(_0xd019b7){var _0x224057=this;return new Promise(function(_0x80ee72,_0x3b0378){return db[_0xaf28('0x18')][_0xaf28('0x19')]({'raw':_0xd019b7[_0xaf28('0x1a')]?_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1b')]===undefined?!![]:![]:!![],'where':_0xd019b7[_0xaf28('0x1a')]?_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1c')]||null:null,'attributes':_0xd019b7[_0xaf28('0x1a')]?_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1d')]||null:null,'limit':_0xd019b7[_0xaf28('0x1a')]?_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1e')]||null:null,'include':_0xd019b7[_0xaf28('0x1a')]?_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1f')]?_[_0xaf28('0x20')](_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1f')],function(_0x29fe80){return{'model':db[_0x29fe80['model']],'as':_0x29fe80['as'],'attributes':_0x29fe80[_0xaf28('0x1d')],'include':_0x29fe80[_0xaf28('0x1f')]?_[_0xaf28('0x20')](_0x29fe80['include'],function(_0x2d4640){return{'model':db[_0x2d4640['model']],'as':_0x2d4640['as'],'attributes':_0x2d4640[_0xaf28('0x1d')],'include':_0x2d4640[_0xaf28('0x1f')]?_[_0xaf28('0x20')](_0x2d4640['include'],function(_0x2a3aab){return{'model':db[_0x2a3aab[_0xaf28('0x21')]],'as':_0x2a3aab['as'],'attributes':_0x2a3aab['attributes']};}):[]};}):[]};}):[]:[]})[_0xaf28('0xd')](function(_0x53033d){logger[_0xaf28('0x22')](_0xaf28('0x17'),_0xd019b7);logger[_0xaf28('0x10')]('GetDynamics365Account',_0xd019b7,JSON['stringify'](_0x53033d));_0x80ee72(_0x53033d);})['catch'](function(_0x4a22e1){logger[_0xaf28('0x13')](_0xaf28('0x17'),_0x4a22e1['message'],_0xd019b7);_0x3b0378(_0x224057[_0xaf28('0x13')](0x1f4,_0x4a22e1[_0xaf28('0x15')]));});});};exports['ShowDynamics365Account']=function(_0x1564d5){var _0x3fe544=this;return new Promise(function(_0x146948,_0x12cd39){return db[_0xaf28('0x18')][_0xaf28('0x23')]({'raw':_0x1564d5[_0xaf28('0x1a')]?_0x1564d5[_0xaf28('0x1a')][_0xaf28('0x1b')]===undefined?!![]:![]:!![],'where':_0x1564d5['options']?_0x1564d5[_0xaf28('0x1a')][_0xaf28('0x1c')]||null:null,'attributes':_0x1564d5[_0xaf28('0x1a')]?_0x1564d5[_0xaf28('0x1a')][_0xaf28('0x1d')]||null:null,'include':_0x1564d5[_0xaf28('0x1a')]?_0x1564d5[_0xaf28('0x1a')][_0xaf28('0x1f')]?_[_0xaf28('0x20')](_0x1564d5[_0xaf28('0x1a')][_0xaf28('0x1f')],function(_0x18db33){return{'model':db[_0x18db33['model']],'as':_0x18db33['as'],'attributes':_0x18db33['attributes'],'include':_0x18db33['include']?_[_0xaf28('0x20')](_0x18db33[_0xaf28('0x1f')],function(_0x3103d3){return{'model':db[_0x3103d3[_0xaf28('0x21')]],'as':_0x3103d3['as'],'attributes':_0x3103d3['attributes'],'include':_0x3103d3[_0xaf28('0x1f')]?_[_0xaf28('0x20')](_0x3103d3[_0xaf28('0x1f')],function(_0x401d4a){return{'model':db[_0x401d4a[_0xaf28('0x21')]],'as':_0x401d4a['as'],'attributes':_0x401d4a['attributes']};}):[]};}):[]};}):[]:[]})[_0xaf28('0xd')](function(_0x182a6c){logger[_0xaf28('0x22')](_0xaf28('0x24'),_0x1564d5);logger['debug'](_0xaf28('0x24'),_0x1564d5,JSON[_0xaf28('0x12')](_0x182a6c));_0x146948(_0x182a6c);})[_0xaf28('0x25')](function(_0x4aa740){logger['error'](_0xaf28('0x24'),_0x4aa740['message'],_0x1564d5);_0x12cd39(_0x3fe544[_0xaf28('0x13')](0x1f4,_0x4aa740[_0xaf28('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9354b8b..e5b71d9 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 _0x7df3=['connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','delete','exports','multer','util'];(function(_0x48546c,_0x53a940){var _0x17394e=function(_0xa03725){while(--_0xa03725){_0x48546c['push'](_0x48546c['shift']());}};_0x17394e(++_0x53a940);}(_0x7df3,0x1cc));var _0x37df=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7df3[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x37df('0x0'));var util=require(_0x37df('0x1'));var path=require('path');var timeout=require(_0x37df('0x2'));var express=require('express');var router=express[_0x37df('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x37df('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x37df('0x5'));var controller=require(_0x37df('0x6'));router[_0x37df('0x7')]('/',auth[_0x37df('0x8')](),controller[_0x37df('0x9')]);router[_0x37df('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x37df('0x7')](_0x37df('0xa'),auth[_0x37df('0x8')](),controller[_0x37df('0xb')]);router['get'](_0x37df('0xc'),auth[_0x37df('0x8')](),controller[_0x37df('0xd')]);router['get'](_0x37df('0xe'),auth[_0x37df('0x8')](),controller[_0x37df('0xf')]);router['post']('/',auth[_0x37df('0x8')](),controller[_0x37df('0x10')]);router[_0x37df('0x11')](_0x37df('0x12'),auth[_0x37df('0x8')](),controller['update']);router[_0x37df('0x13')](_0x37df('0x12'),auth[_0x37df('0x8')](),controller['destroy']);module[_0x37df('0x14')]=router; \ No newline at end of file +var _0x69af=['fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x123420,_0x3cf331){var _0x3a1789=function(_0x4c9f0b){while(--_0x4c9f0b){_0x123420['push'](_0x123420['shift']());}};_0x3a1789(++_0x3cf331);}(_0x69af,0x17b));var _0xf69a=function(_0x3bb92b,_0x705df2){_0x3bb92b=_0x3bb92b-0x0;var _0x1b28d6=_0x69af[_0x3bb92b];return _0x1b28d6;};'use strict';var multer=require('multer');var util=require(_0xf69a('0x0'));var path=require(_0xf69a('0x1'));var timeout=require(_0xf69a('0x2'));var express=require(_0xf69a('0x3'));var router=express[_0xf69a('0x4')]();var fs_extra=require(_0xf69a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf69a('0x6'));var config=require(_0xf69a('0x7'));var controller=require(_0xf69a('0x8'));router[_0xf69a('0x9')]('/',auth[_0xf69a('0xa')](),controller['index']);router[_0xf69a('0x9')](_0xf69a('0xb'),auth[_0xf69a('0xa')](),controller['show']);router['get'](_0xf69a('0xc'),auth[_0xf69a('0xa')](),controller[_0xf69a('0xd')]);router[_0xf69a('0x9')](_0xf69a('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xf69a('0xf'),auth[_0xf69a('0xa')](),controller[_0xf69a('0x10')]);router[_0xf69a('0x11')]('/',auth['isAuthenticated'](),controller[_0xf69a('0x12')]);router[_0xf69a('0x13')](_0xf69a('0xb'),auth[_0xf69a('0xa')](),controller[_0xf69a('0x14')]);router[_0xf69a('0x15')](_0xf69a('0xb'),auth[_0xf69a('0xa')](),controller[_0xf69a('0x16')]);module[_0xf69a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index cbaba55..b90b12b 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 _0xdf69=['nothing','BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM','contact'];(function(_0x1ac0d4,_0x406801){var _0x5af864=function(_0x4b7966){while(--_0x4b7966){_0x1ac0d4['push'](_0x1ac0d4['shift']());}};_0x5af864(++_0x406801);}(_0xdf69,0x89));var _0x9df6=function(_0x271897,_0x25d6ec){_0x271897=_0x271897-0x0;var _0x2ef405=_0xdf69[_0x271897];return _0x2ef405;};'use strict';var Sequelize=require(_0x9df6('0x0'));module[_0x9df6('0x1')]={'name':{'type':Sequelize[_0x9df6('0x2')]},'description':{'type':Sequelize[_0x9df6('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x9df6('0x3'),_0x9df6('0x4')),'defaultValue':_0x9df6('0x3')},'moduleCreate':{'type':Sequelize[_0x9df6('0x5')](_0x9df6('0x6'),_0x9df6('0x7')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9df6('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x9df6('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb081=['STRING','ENUM','incident','contact','nothing','sequelize'];(function(_0xceeecc,_0x2c8bd0){var _0x41bf68=function(_0x3ebe92){while(--_0x3ebe92){_0xceeecc['push'](_0xceeecc['shift']());}};_0x41bf68(++_0x2c8bd0);}(_0xb081,0x1e5));var _0x1b08=function(_0x10a12a,_0xee7529){_0x10a12a=_0x10a12a-0x0;var _0x1905af=_0xb081[_0x10a12a];return _0x1905af;};'use strict';var Sequelize=require(_0x1b08('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1b08('0x1')]},'ticketType':{'type':Sequelize[_0x1b08('0x2')](_0x1b08('0x3'),'phonecall'),'defaultValue':_0x1b08('0x3')},'moduleCreate':{'type':Sequelize[_0x1b08('0x2')](_0x1b08('0x4'),_0x1b08('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x1b08('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 0f8f63c..4b31316 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 _0xbad4=['reject','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0xbad4,0xd0));var _0x4bad=function(_0x30940d,_0x2bc090){_0x30940d=_0x30940d-0x0;var _0x5c50c4=_0xbad4[_0x30940d];return _0x5c50c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4bad('0x0'));var zipdir=require(_0x4bad('0x1'));var jsonpatch=require(_0x4bad('0x2'));var rp=require(_0x4bad('0x3'));var moment=require(_0x4bad('0x4'));var BPromise=require(_0x4bad('0x5'));var Mustache=require('mustache');var util=require(_0x4bad('0x6'));var path=require(_0x4bad('0x7'));var sox=require(_0x4bad('0x8'));var csv=require(_0x4bad('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4bad('0xa'));var _=require(_0x4bad('0xb'));var squel=require(_0x4bad('0xc'));var crypto=require(_0x4bad('0xd'));var jsforce=require(_0x4bad('0xe'));var deskjs=require(_0x4bad('0xf'));var toCsv=require(_0x4bad('0x9'));var querystring=require(_0x4bad('0x10'));var Papa=require(_0x4bad('0x11'));var Redis=require(_0x4bad('0x12'));var authService=require(_0x4bad('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4bad('0x14'));var hardwareService=require(_0x4bad('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4bad('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4bad('0x17'))['db'];function respondWithStatusCode(_0x7e1901,_0x54cb42){_0x54cb42=_0x54cb42||0xcc;return function(_0x555687){if(_0x555687){return _0x7e1901[_0x4bad('0x18')](_0x54cb42);}return _0x7e1901[_0x4bad('0x19')](_0x54cb42)[_0x4bad('0x1a')]();};}function respondWithResult(_0x115873,_0x43225f){_0x43225f=_0x43225f||0xc8;return function(_0x123622){if(_0x123622){return _0x115873[_0x4bad('0x19')](_0x43225f)[_0x4bad('0x1b')](_0x123622);}};}function respondWithFilteredResult(_0x27c92f,_0x59649a){return function(_0x509903){if(_0x509903){var _0x32a988=typeof _0x59649a[_0x4bad('0x1c')]==='undefined'&&typeof _0x59649a[_0x4bad('0x1d')]===_0x4bad('0x1e');var _0x2e5dde=_0x509903[_0x4bad('0x1f')];var _0xbb8e0=_0x32a988?0x0:_0x59649a[_0x4bad('0x1c')];var _0x29f278=_0x32a988?_0x509903[_0x4bad('0x1f')]:_0x59649a[_0x4bad('0x1c')]+_0x59649a[_0x4bad('0x1d')];var _0x53584d;if(_0x29f278>=_0x2e5dde){_0x29f278=_0x2e5dde;_0x53584d=0xc8;}else{_0x53584d=0xce;}_0x27c92f[_0x4bad('0x19')](_0x53584d);return _0x27c92f[_0x4bad('0x20')](_0x4bad('0x21'),_0xbb8e0+'-'+_0x29f278+'/'+_0x2e5dde)[_0x4bad('0x1b')](_0x509903);}return null;};}function patchUpdates(_0x5124c1){return function(_0x40a95c){try{jsonpatch[_0x4bad('0x22')](_0x40a95c,_0x5124c1,!![]);}catch(_0x4fcc84){return BPromise[_0x4bad('0x23')](_0x4fcc84);}return _0x40a95c['save']();};}function saveUpdates(_0x1aabd0,_0x618c01){return function(_0x1c4400){if(_0x1c4400){return _0x1c4400[_0x4bad('0x24')](_0x1aabd0)[_0x4bad('0x25')](function(_0xbd48c2){return _0xbd48c2;});}return null;};}function removeEntity(_0x5df7fb,_0x8ff140){return function(_0x4df859){if(_0x4df859){return _0x4df859[_0x4bad('0x26')]()[_0x4bad('0x25')](function(){_0x5df7fb[_0x4bad('0x19')](0xcc)[_0x4bad('0x1a')]();});}};}function handleEntityNotFound(_0x459e67,_0x4161e2){return function(_0xe6fb26){if(!_0xe6fb26){_0x459e67[_0x4bad('0x18')](0x194);}return _0xe6fb26;};}function handleError(_0x3e8aca,_0xcfd0e3){_0xcfd0e3=_0xcfd0e3||0x1f4;return function(_0x5048f7){logger[_0x4bad('0x27')](_0x5048f7[_0x4bad('0x28')]);if(_0x5048f7[_0x4bad('0x29')]){delete _0x5048f7[_0x4bad('0x29')];}_0x3e8aca['status'](_0xcfd0e3)[_0x4bad('0x2a')](_0x5048f7);};}exports[_0x4bad('0x2b')]=function(_0x595fa7,_0x31e1a9){var _0x10d24e={},_0x2a2fe1={},_0x4147c7={'count':0x0,'rows':[]};var _0x3056fd=_[_0x4bad('0x2c')](db[_0x4bad('0x2d')][_0x4bad('0x2e')],function(_0xa124d6){return{'name':_0xa124d6['fieldName'],'type':_0xa124d6[_0x4bad('0x2f')][_0x4bad('0x30')]};});_0x2a2fe1[_0x4bad('0x31')]=_[_0x4bad('0x2c')](_0x3056fd,'name');_0x2a2fe1[_0x4bad('0x32')]=_[_0x4bad('0x33')](_0x595fa7[_0x4bad('0x32')]);_0x2a2fe1[_0x4bad('0x34')]=_[_0x4bad('0x35')](_0x2a2fe1['model'],_0x2a2fe1['query']);_0x10d24e[_0x4bad('0x36')]=_[_0x4bad('0x35')](_0x2a2fe1[_0x4bad('0x31')],qs[_0x4bad('0x37')](_0x595fa7[_0x4bad('0x32')][_0x4bad('0x37')]));_0x10d24e[_0x4bad('0x36')]=_0x10d24e[_0x4bad('0x36')]['length']?_0x10d24e[_0x4bad('0x36')]:_0x2a2fe1['model'];if(!_0x595fa7[_0x4bad('0x32')][_0x4bad('0x38')](_0x4bad('0x39'))){_0x10d24e[_0x4bad('0x1d')]=qs['limit'](_0x595fa7[_0x4bad('0x32')][_0x4bad('0x1d')]);_0x10d24e['offset']=qs[_0x4bad('0x1c')](_0x595fa7['query'][_0x4bad('0x1c')]);}_0x10d24e[_0x4bad('0x3a')]=qs[_0x4bad('0x3b')](_0x595fa7[_0x4bad('0x32')][_0x4bad('0x3b')]);_0x10d24e[_0x4bad('0x3c')]=qs[_0x4bad('0x34')](_[_0x4bad('0x3d')](_0x595fa7['query'],_0x2a2fe1['filters']),_0x3056fd);if(_0x595fa7[_0x4bad('0x32')][_0x4bad('0x3e')]){_0x10d24e['where']=_[_0x4bad('0x3f')](_0x10d24e['where'],{'$or':_[_0x4bad('0x2c')](_0x3056fd,function(_0x1865c5){if(_0x1865c5[_0x4bad('0x2f')]!==_0x4bad('0x40')){var _0x181f6e={};_0x181f6e[_0x1865c5[_0x4bad('0x29')]]={'$like':'%'+_0x595fa7['query'][_0x4bad('0x3e')]+'%'};return _0x181f6e;}})});}_0x10d24e=_[_0x4bad('0x3f')]({},_0x10d24e,_0x595fa7[_0x4bad('0x41')]);var _0xcd612c={'where':_0x10d24e[_0x4bad('0x3c')]};return db[_0x4bad('0x2d')][_0x4bad('0x1f')](_0xcd612c)[_0x4bad('0x25')](function(_0x463a2c){_0x4147c7['count']=_0x463a2c;if(_0x595fa7[_0x4bad('0x32')][_0x4bad('0x42')]){_0x10d24e['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x10d24e);})['then'](function(_0x2a1d01){_0x4147c7[_0x4bad('0x43')]=_0x2a1d01;return _0x4147c7;})[_0x4bad('0x25')](respondWithFilteredResult(_0x31e1a9,_0x10d24e))[_0x4bad('0x44')](handleError(_0x31e1a9,null));};exports[_0x4bad('0x45')]=function(_0x8ab369,_0x243973){var _0x278e0e={'raw':![],'where':{'id':_0x8ab369[_0x4bad('0x46')]['id']}},_0x58303e={};_0x58303e[_0x4bad('0x31')]=_[_0x4bad('0x33')](db['Dynamics365Configuration']['rawAttributes']);_0x58303e[_0x4bad('0x32')]=_[_0x4bad('0x33')](_0x8ab369[_0x4bad('0x32')]);_0x58303e[_0x4bad('0x34')]=_[_0x4bad('0x35')](_0x58303e[_0x4bad('0x31')],_0x58303e[_0x4bad('0x32')]);_0x278e0e[_0x4bad('0x36')]=_[_0x4bad('0x35')](_0x58303e[_0x4bad('0x31')],qs[_0x4bad('0x37')](_0x8ab369[_0x4bad('0x32')][_0x4bad('0x37')]));_0x278e0e[_0x4bad('0x36')]=_0x278e0e['attributes'][_0x4bad('0x47')]?_0x278e0e[_0x4bad('0x36')]:_0x58303e[_0x4bad('0x31')];if(_0x8ab369[_0x4bad('0x32')]['includeAll']){_0x278e0e[_0x4bad('0x48')]=[{'all':!![]}];}_0x278e0e=_['merge']({},_0x278e0e,_0x8ab369[_0x4bad('0x41')]);return db[_0x4bad('0x2d')][_0x4bad('0x49')](_0x278e0e)[_0x4bad('0x25')](handleEntityNotFound(_0x243973,null))[_0x4bad('0x25')](respondWithResult(_0x243973,null))['catch'](handleError(_0x243973,null));};exports[_0x4bad('0x4a')]=function(_0x445973,_0x5a8950){return db[_0x4bad('0x2d')]['create'](_0x445973[_0x4bad('0x4b')],{})[_0x4bad('0x25')](respondWithResult(_0x5a8950,0xc9))[_0x4bad('0x44')](handleError(_0x5a8950,null));};exports[_0x4bad('0x24')]=function(_0x209ef7,_0x44d2d7){if(_0x209ef7[_0x4bad('0x4b')]['id']){delete _0x209ef7['body']['id'];}return db['Dynamics365Configuration'][_0x4bad('0x49')]({'where':{'id':_0x209ef7[_0x4bad('0x46')]['id']}})[_0x4bad('0x25')](handleEntityNotFound(_0x44d2d7,null))[_0x4bad('0x25')](saveUpdates(_0x209ef7[_0x4bad('0x4b')],null))[_0x4bad('0x25')](respondWithResult(_0x44d2d7,null))['catch'](handleError(_0x44d2d7,null));};exports['destroy']=function(_0x23c4b9,_0x5892b4){return db['Dynamics365Configuration'][_0x4bad('0x49')]({'where':{'id':_0x23c4b9[_0x4bad('0x46')]['id']}})[_0x4bad('0x25')](handleEntityNotFound(_0x5892b4,null))[_0x4bad('0x25')](removeEntity(_0x5892b4,null))[_0x4bad('0x44')](handleError(_0x5892b4,null));};exports[_0x4bad('0x4c')]=function(_0x4a012f,_0x2abd75,_0x18d87b){var _0x38c08d={};var _0x11dfaf={};var _0x40caa8;var _0x47c3a4;return db[_0x4bad('0x2d')][_0x4bad('0x4d')]({'where':{'id':_0x4a012f[_0x4bad('0x46')]['id']}})[_0x4bad('0x25')](handleEntityNotFound(_0x2abd75,null))[_0x4bad('0x25')](function(_0x18da45){if(_0x18da45){_0x40caa8=_0x18da45;_0x11dfaf['model']=_['keys'](db[_0x4bad('0x4e')][_0x4bad('0x2e')]);_0x11dfaf['query']=_['keys'](_0x4a012f['query']);_0x11dfaf[_0x4bad('0x34')]=_[_0x4bad('0x35')](_0x11dfaf['model'],_0x11dfaf[_0x4bad('0x32')]);_0x38c08d[_0x4bad('0x36')]=_[_0x4bad('0x35')](_0x11dfaf[_0x4bad('0x31')],qs[_0x4bad('0x37')](_0x4a012f[_0x4bad('0x32')][_0x4bad('0x37')]));_0x38c08d[_0x4bad('0x36')]=_0x38c08d['attributes'][_0x4bad('0x47')]?_0x38c08d[_0x4bad('0x36')]:_0x11dfaf['model'];_0x38c08d[_0x4bad('0x3a')]=qs['sort'](_0x4a012f['query'][_0x4bad('0x3b')]);_0x38c08d[_0x4bad('0x3c')]=qs[_0x4bad('0x34')](_['pick'](_0x4a012f[_0x4bad('0x32')],_0x11dfaf['filters']));if(_0x4a012f[_0x4bad('0x32')][_0x4bad('0x3e')]){_0x38c08d['where']=_[_0x4bad('0x3f')](_0x38c08d[_0x4bad('0x3c')],{'$or':_['map'](_0x38c08d[_0x4bad('0x36')],function(_0x54c292){var _0x5c46b4={};_0x5c46b4[_0x54c292]={'$like':'%'+_0x4a012f[_0x4bad('0x32')][_0x4bad('0x3e')]+'%'};return _0x5c46b4;})});}_0x38c08d=_[_0x4bad('0x3f')]({},_0x38c08d,_0x4a012f['options']);return _0x40caa8['getFields'](_0x38c08d);}})[_0x4bad('0x25')](function(_0x18e2f4){if(_0x18e2f4){_0x47c3a4=_0x18e2f4[_0x4bad('0x47')];if(!_0x4a012f[_0x4bad('0x32')][_0x4bad('0x38')](_0x4bad('0x39'))){_0x38c08d[_0x4bad('0x1d')]=qs['limit'](_0x4a012f['query'][_0x4bad('0x1d')]);_0x38c08d[_0x4bad('0x1c')]=qs[_0x4bad('0x1c')](_0x4a012f['query'][_0x4bad('0x1c')]);}return _0x40caa8[_0x4bad('0x4c')](_0x38c08d);}})[_0x4bad('0x25')](function(_0x4a81ed){if(_0x4a81ed){return _0x4a81ed?{'count':_0x47c3a4,'rows':_0x4a81ed}:null;}})['then'](respondWithResult(_0x2abd75,null))[_0x4bad('0x44')](handleError(_0x2abd75,null));};exports['getSubjects']=function(_0x5bb47b,_0x2903dd,_0x48a61a){var _0x1503c3={};var _0x54fd15={};var _0x3528b0;var _0x2bd8cd;return db[_0x4bad('0x2d')]['findOne']({'where':{'id':_0x5bb47b[_0x4bad('0x46')]['id']}})[_0x4bad('0x25')](handleEntityNotFound(_0x2903dd,null))[_0x4bad('0x25')](function(_0x1b8bce){if(_0x1b8bce){_0x3528b0=_0x1b8bce;_0x54fd15[_0x4bad('0x31')]=_[_0x4bad('0x33')](db[_0x4bad('0x4e')]['rawAttributes']);_0x54fd15[_0x4bad('0x32')]=_[_0x4bad('0x33')](_0x5bb47b['query']);_0x54fd15[_0x4bad('0x34')]=_[_0x4bad('0x35')](_0x54fd15[_0x4bad('0x31')],_0x54fd15[_0x4bad('0x32')]);_0x1503c3[_0x4bad('0x36')]=_[_0x4bad('0x35')](_0x54fd15['model'],qs[_0x4bad('0x37')](_0x5bb47b['query'][_0x4bad('0x37')]));_0x1503c3[_0x4bad('0x36')]=_0x1503c3[_0x4bad('0x36')]['length']?_0x1503c3[_0x4bad('0x36')]:_0x54fd15[_0x4bad('0x31')];_0x1503c3[_0x4bad('0x3a')]=qs[_0x4bad('0x3b')](_0x5bb47b[_0x4bad('0x32')]['sort']);_0x1503c3[_0x4bad('0x3c')]=qs['filters'](_[_0x4bad('0x3d')](_0x5bb47b[_0x4bad('0x32')],_0x54fd15[_0x4bad('0x34')]));if(_0x5bb47b['query']['filter']){_0x1503c3[_0x4bad('0x3c')]=_['merge'](_0x1503c3[_0x4bad('0x3c')],{'$or':_[_0x4bad('0x2c')](_0x1503c3[_0x4bad('0x36')],function(_0x590e2f){var _0x586c7a={};_0x586c7a[_0x590e2f]={'$like':'%'+_0x5bb47b[_0x4bad('0x32')][_0x4bad('0x3e')]+'%'};return _0x586c7a;})});}_0x1503c3=_[_0x4bad('0x3f')]({},_0x1503c3,_0x5bb47b[_0x4bad('0x41')]);return _0x3528b0[_0x4bad('0x4f')](_0x1503c3);}})['then'](function(_0xb9c6c){if(_0xb9c6c){_0x2bd8cd=_0xb9c6c[_0x4bad('0x47')];if(!_0x5bb47b[_0x4bad('0x32')][_0x4bad('0x38')]('nolimit')){_0x1503c3[_0x4bad('0x1d')]=qs[_0x4bad('0x1d')](_0x5bb47b['query']['limit']);_0x1503c3[_0x4bad('0x1c')]=qs['offset'](_0x5bb47b['query'][_0x4bad('0x1c')]);}return _0x3528b0[_0x4bad('0x4f')](_0x1503c3);}})[_0x4bad('0x25')](function(_0x158c4c){if(_0x158c4c){return _0x158c4c?{'count':_0x2bd8cd,'rows':_0x158c4c}:null;}})[_0x4bad('0x25')](respondWithResult(_0x2903dd,null))[_0x4bad('0x44')](handleError(_0x2903dd,null));};exports[_0x4bad('0x50')]=function(_0x7a75cd,_0x44ce58,_0x5a512a){var _0x1ce124={};var _0x492a1c={};var _0x3cd41d;var _0x4e8180;return db[_0x4bad('0x2d')][_0x4bad('0x4d')]({'where':{'id':_0x7a75cd[_0x4bad('0x46')]['id']}})[_0x4bad('0x25')](handleEntityNotFound(_0x44ce58,null))[_0x4bad('0x25')](function(_0x42a164){if(_0x42a164){_0x3cd41d=_0x42a164;_0x492a1c[_0x4bad('0x31')]=_[_0x4bad('0x33')](db[_0x4bad('0x4e')][_0x4bad('0x2e')]);_0x492a1c['query']=_[_0x4bad('0x33')](_0x7a75cd[_0x4bad('0x32')]);_0x492a1c['filters']=_[_0x4bad('0x35')](_0x492a1c['model'],_0x492a1c[_0x4bad('0x32')]);_0x1ce124[_0x4bad('0x36')]=_[_0x4bad('0x35')](_0x492a1c['model'],qs[_0x4bad('0x37')](_0x7a75cd[_0x4bad('0x32')][_0x4bad('0x37')]));_0x1ce124[_0x4bad('0x36')]=_0x1ce124[_0x4bad('0x36')]['length']?_0x1ce124[_0x4bad('0x36')]:_0x492a1c['model'];_0x1ce124[_0x4bad('0x3a')]=qs[_0x4bad('0x3b')](_0x7a75cd['query'][_0x4bad('0x3b')]);_0x1ce124[_0x4bad('0x3c')]=qs[_0x4bad('0x34')](_[_0x4bad('0x3d')](_0x7a75cd[_0x4bad('0x32')],_0x492a1c[_0x4bad('0x34')]));if(_0x7a75cd[_0x4bad('0x32')][_0x4bad('0x3e')]){_0x1ce124['where']=_[_0x4bad('0x3f')](_0x1ce124[_0x4bad('0x3c')],{'$or':_['map'](_0x1ce124[_0x4bad('0x36')],function(_0x493b00){var _0x3dd91b={};_0x3dd91b[_0x493b00]={'$like':'%'+_0x7a75cd[_0x4bad('0x32')][_0x4bad('0x3e')]+'%'};return _0x3dd91b;})});}_0x1ce124=_[_0x4bad('0x3f')]({},_0x1ce124,_0x7a75cd['options']);return _0x3cd41d[_0x4bad('0x50')](_0x1ce124);}})['then'](function(_0x177b44){if(_0x177b44){_0x4e8180=_0x177b44[_0x4bad('0x47')];if(!_0x7a75cd[_0x4bad('0x32')]['hasOwnProperty']('nolimit')){_0x1ce124[_0x4bad('0x1d')]=qs[_0x4bad('0x1d')](_0x7a75cd[_0x4bad('0x32')][_0x4bad('0x1d')]);_0x1ce124['offset']=qs[_0x4bad('0x1c')](_0x7a75cd[_0x4bad('0x32')][_0x4bad('0x1c')]);}return _0x3cd41d[_0x4bad('0x50')](_0x1ce124);}})[_0x4bad('0x25')](function(_0x11d485){if(_0x11d485){return _0x11d485?{'count':_0x4e8180,'rows':_0x11d485}:null;}})['then'](respondWithResult(_0x44ce58,null))[_0x4bad('0x44')](handleError(_0x44ce58,null));}; \ No newline at end of file +var _0x3764=['options','find','catch','create','body','params','destroy','getFields','findOne','Dynamics365Field','order','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','then','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','show'];(function(_0x13ada7,_0x55c43a){var _0x448b60=function(_0x16f75b){while(--_0x16f75b){_0x13ada7['push'](_0x13ada7['shift']());}};_0x448b60(++_0x55c43a);}(_0x3764,0xab));var _0x4376=function(_0x10db5b,_0x5481d3){_0x10db5b=_0x10db5b-0x0;var _0x3091e7=_0x3764[_0x10db5b];return _0x3091e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4376('0x0'));var zipdir=require(_0x4376('0x1'));var jsonpatch=require(_0x4376('0x2'));var rp=require('request-promise');var moment=require(_0x4376('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4376('0x4'));var util=require(_0x4376('0x5'));var path=require(_0x4376('0x6'));var sox=require(_0x4376('0x7'));var csv=require(_0x4376('0x8'));var ejs=require(_0x4376('0x9'));var fs=require('fs');var fs_extra=require(_0x4376('0xa'));var _=require(_0x4376('0xb'));var squel=require('squel');var crypto=require(_0x4376('0xc'));var jsforce=require(_0x4376('0xd'));var deskjs=require(_0x4376('0xe'));var toCsv=require(_0x4376('0x8'));var querystring=require(_0x4376('0xf'));var Papa=require(_0x4376('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4376('0x11'));var as=require(_0x4376('0x12'));var hardwareService=require(_0x4376('0x13'));var logger=require(_0x4376('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4376('0x15'));var licenseUtil=require(_0x4376('0x16'));var db=require(_0x4376('0x17'))['db'];function respondWithStatusCode(_0x5cbc64,_0x2839e5){_0x2839e5=_0x2839e5||0xcc;return function(_0x5e7817){if(_0x5e7817){return _0x5cbc64[_0x4376('0x18')](_0x2839e5);}return _0x5cbc64[_0x4376('0x19')](_0x2839e5)['end']();};}function respondWithResult(_0x4dfa13,_0x335943){_0x335943=_0x335943||0xc8;return function(_0x546ca){if(_0x546ca){return _0x4dfa13[_0x4376('0x19')](_0x335943)[_0x4376('0x1a')](_0x546ca);}};}function respondWithFilteredResult(_0x24bdc5,_0x3aabf1){return function(_0x448b91){if(_0x448b91){var _0x598202=typeof _0x3aabf1[_0x4376('0x1b')]===_0x4376('0x1c')&&typeof _0x3aabf1['limit']===_0x4376('0x1c');var _0x1e503c=_0x448b91[_0x4376('0x1d')];var _0x39662a=_0x598202?0x0:_0x3aabf1[_0x4376('0x1b')];var _0x5e7254=_0x598202?_0x448b91[_0x4376('0x1d')]:_0x3aabf1[_0x4376('0x1b')]+_0x3aabf1[_0x4376('0x1e')];var _0x29f501;if(_0x5e7254>=_0x1e503c){_0x5e7254=_0x1e503c;_0x29f501=0xc8;}else{_0x29f501=0xce;}_0x24bdc5['status'](_0x29f501);return _0x24bdc5[_0x4376('0x1f')]('Content-Range',_0x39662a+'-'+_0x5e7254+'/'+_0x1e503c)[_0x4376('0x1a')](_0x448b91);}return null;};}function patchUpdates(_0x35c74b){return function(_0x22a302){try{jsonpatch['apply'](_0x22a302,_0x35c74b,!![]);}catch(_0x301643){return BPromise[_0x4376('0x20')](_0x301643);}return _0x22a302[_0x4376('0x21')]();};}function saveUpdates(_0x2a2344,_0xacd4f2){return function(_0x73ebcd){if(_0x73ebcd){return _0x73ebcd[_0x4376('0x22')](_0x2a2344)[_0x4376('0x23')](function(_0x5026fe){return _0x5026fe;});}return null;};}function removeEntity(_0x59aa45,_0x548913){return function(_0x56848f){if(_0x56848f){return _0x56848f['destroy']()[_0x4376('0x23')](function(){_0x59aa45[_0x4376('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5716d8,_0x38cc19){return function(_0x552000){if(!_0x552000){_0x5716d8[_0x4376('0x18')](0x194);}return _0x552000;};}function handleError(_0x88e683,_0x4328e3){_0x4328e3=_0x4328e3||0x1f4;return function(_0x43ddd5){logger['error'](_0x43ddd5[_0x4376('0x24')]);if(_0x43ddd5[_0x4376('0x25')]){delete _0x43ddd5[_0x4376('0x25')];}_0x88e683[_0x4376('0x19')](_0x4328e3)[_0x4376('0x26')](_0x43ddd5);};}exports[_0x4376('0x27')]=function(_0x33ed21,_0x3d6350){var _0x4f9476={},_0x3e4d75={},_0x32d4e4={'count':0x0,'rows':[]};var _0x335bd4=_[_0x4376('0x28')](db[_0x4376('0x29')][_0x4376('0x2a')],function(_0x2fa457){return{'name':_0x2fa457[_0x4376('0x2b')],'type':_0x2fa457['type']['key']};});_0x3e4d75[_0x4376('0x2c')]=_['map'](_0x335bd4,_0x4376('0x25'));_0x3e4d75[_0x4376('0x2d')]=_[_0x4376('0x2e')](_0x33ed21['query']);_0x3e4d75['filters']=_['intersection'](_0x3e4d75[_0x4376('0x2c')],_0x3e4d75[_0x4376('0x2d')]);_0x4f9476[_0x4376('0x2f')]=_[_0x4376('0x30')](_0x3e4d75[_0x4376('0x2c')],qs[_0x4376('0x31')](_0x33ed21['query'][_0x4376('0x31')]));_0x4f9476[_0x4376('0x2f')]=_0x4f9476[_0x4376('0x2f')][_0x4376('0x32')]?_0x4f9476[_0x4376('0x2f')]:_0x3e4d75[_0x4376('0x2c')];if(!_0x33ed21[_0x4376('0x2d')][_0x4376('0x33')](_0x4376('0x34'))){_0x4f9476[_0x4376('0x1e')]=qs[_0x4376('0x1e')](_0x33ed21[_0x4376('0x2d')]['limit']);_0x4f9476[_0x4376('0x1b')]=qs['offset'](_0x33ed21[_0x4376('0x2d')][_0x4376('0x1b')]);}_0x4f9476['order']=qs['sort'](_0x33ed21[_0x4376('0x2d')][_0x4376('0x35')]);_0x4f9476['where']=qs[_0x4376('0x36')](_[_0x4376('0x37')](_0x33ed21[_0x4376('0x2d')],_0x3e4d75[_0x4376('0x36')]),_0x335bd4);if(_0x33ed21[_0x4376('0x2d')][_0x4376('0x38')]){_0x4f9476[_0x4376('0x39')]=_['merge'](_0x4f9476[_0x4376('0x39')],{'$or':_[_0x4376('0x28')](_0x335bd4,function(_0x612fbe){if(_0x612fbe[_0x4376('0x3a')]!==_0x4376('0x3b')){var _0xd0431f={};_0xd0431f[_0x612fbe[_0x4376('0x25')]]={'$like':'%'+_0x33ed21[_0x4376('0x2d')][_0x4376('0x38')]+'%'};return _0xd0431f;}})});}_0x4f9476=_[_0x4376('0x3c')]({},_0x4f9476,_0x33ed21['options']);var _0x1f88df={'where':_0x4f9476['where']};return db[_0x4376('0x29')][_0x4376('0x1d')](_0x1f88df)[_0x4376('0x23')](function(_0x1b61a3){_0x32d4e4['count']=_0x1b61a3;if(_0x33ed21['query'][_0x4376('0x3d')]){_0x4f9476[_0x4376('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x4376('0x3f')](_0x4f9476);})[_0x4376('0x23')](function(_0xea6e8d){_0x32d4e4[_0x4376('0x40')]=_0xea6e8d;return _0x32d4e4;})['then'](respondWithFilteredResult(_0x3d6350,_0x4f9476))['catch'](handleError(_0x3d6350,null));};exports[_0x4376('0x41')]=function(_0x1cd568,_0x455887){var _0x2a8df7={'raw':![],'where':{'id':_0x1cd568['params']['id']}},_0x437122={};_0x437122['model']=_[_0x4376('0x2e')](db[_0x4376('0x29')]['rawAttributes']);_0x437122[_0x4376('0x2d')]=_['keys'](_0x1cd568[_0x4376('0x2d')]);_0x437122[_0x4376('0x36')]=_[_0x4376('0x30')](_0x437122['model'],_0x437122[_0x4376('0x2d')]);_0x2a8df7[_0x4376('0x2f')]=_[_0x4376('0x30')](_0x437122['model'],qs[_0x4376('0x31')](_0x1cd568[_0x4376('0x2d')]['fields']));_0x2a8df7[_0x4376('0x2f')]=_0x2a8df7[_0x4376('0x2f')][_0x4376('0x32')]?_0x2a8df7[_0x4376('0x2f')]:_0x437122[_0x4376('0x2c')];if(_0x1cd568[_0x4376('0x2d')][_0x4376('0x3d')]){_0x2a8df7[_0x4376('0x3e')]=[{'all':!![]}];}_0x2a8df7=_[_0x4376('0x3c')]({},_0x2a8df7,_0x1cd568[_0x4376('0x42')]);return db[_0x4376('0x29')][_0x4376('0x43')](_0x2a8df7)[_0x4376('0x23')](handleEntityNotFound(_0x455887,null))[_0x4376('0x23')](respondWithResult(_0x455887,null))[_0x4376('0x44')](handleError(_0x455887,null));};exports[_0x4376('0x45')]=function(_0x5171a3,_0x5c6685){return db[_0x4376('0x29')]['create'](_0x5171a3[_0x4376('0x46')],{})[_0x4376('0x23')](respondWithResult(_0x5c6685,0xc9))['catch'](handleError(_0x5c6685,null));};exports[_0x4376('0x22')]=function(_0x873740,_0x42c31f){if(_0x873740[_0x4376('0x46')]['id']){delete _0x873740[_0x4376('0x46')]['id'];}return db[_0x4376('0x29')][_0x4376('0x43')]({'where':{'id':_0x873740[_0x4376('0x47')]['id']}})[_0x4376('0x23')](handleEntityNotFound(_0x42c31f,null))[_0x4376('0x23')](saveUpdates(_0x873740[_0x4376('0x46')],null))[_0x4376('0x23')](respondWithResult(_0x42c31f,null))['catch'](handleError(_0x42c31f,null));};exports[_0x4376('0x48')]=function(_0x2100b0,_0x484bdc){return db[_0x4376('0x29')][_0x4376('0x43')]({'where':{'id':_0x2100b0[_0x4376('0x47')]['id']}})[_0x4376('0x23')](handleEntityNotFound(_0x484bdc,null))[_0x4376('0x23')](removeEntity(_0x484bdc,null))[_0x4376('0x44')](handleError(_0x484bdc,null));};exports[_0x4376('0x49')]=function(_0x14a2b4,_0x1df5c7,_0x15e723){var _0x41f024={};var _0x34c2dd={};var _0x5a9381;var _0xa6615d;return db[_0x4376('0x29')][_0x4376('0x4a')]({'where':{'id':_0x14a2b4[_0x4376('0x47')]['id']}})[_0x4376('0x23')](handleEntityNotFound(_0x1df5c7,null))['then'](function(_0x8b196a){if(_0x8b196a){_0x5a9381=_0x8b196a;_0x34c2dd['model']=_[_0x4376('0x2e')](db[_0x4376('0x4b')]['rawAttributes']);_0x34c2dd[_0x4376('0x2d')]=_[_0x4376('0x2e')](_0x14a2b4[_0x4376('0x2d')]);_0x34c2dd[_0x4376('0x36')]=_['intersection'](_0x34c2dd[_0x4376('0x2c')],_0x34c2dd['query']);_0x41f024[_0x4376('0x2f')]=_[_0x4376('0x30')](_0x34c2dd[_0x4376('0x2c')],qs[_0x4376('0x31')](_0x14a2b4[_0x4376('0x2d')][_0x4376('0x31')]));_0x41f024[_0x4376('0x2f')]=_0x41f024[_0x4376('0x2f')][_0x4376('0x32')]?_0x41f024[_0x4376('0x2f')]:_0x34c2dd[_0x4376('0x2c')];_0x41f024[_0x4376('0x4c')]=qs['sort'](_0x14a2b4['query']['sort']);_0x41f024['where']=qs['filters'](_['pick'](_0x14a2b4['query'],_0x34c2dd[_0x4376('0x36')]));if(_0x14a2b4[_0x4376('0x2d')][_0x4376('0x38')]){_0x41f024[_0x4376('0x39')]=_['merge'](_0x41f024[_0x4376('0x39')],{'$or':_[_0x4376('0x28')](_0x41f024['attributes'],function(_0x500e8c){var _0x367416={};_0x367416[_0x500e8c]={'$like':'%'+_0x14a2b4[_0x4376('0x2d')][_0x4376('0x38')]+'%'};return _0x367416;})});}_0x41f024=_[_0x4376('0x3c')]({},_0x41f024,_0x14a2b4['options']);return _0x5a9381['getFields'](_0x41f024);}})[_0x4376('0x23')](function(_0x2e8daa){if(_0x2e8daa){_0xa6615d=_0x2e8daa[_0x4376('0x32')];if(!_0x14a2b4['query'][_0x4376('0x33')](_0x4376('0x34'))){_0x41f024[_0x4376('0x1e')]=qs[_0x4376('0x1e')](_0x14a2b4[_0x4376('0x2d')]['limit']);_0x41f024['offset']=qs['offset'](_0x14a2b4['query'][_0x4376('0x1b')]);}return _0x5a9381[_0x4376('0x49')](_0x41f024);}})['then'](function(_0x47bc27){if(_0x47bc27){return _0x47bc27?{'count':_0xa6615d,'rows':_0x47bc27}:null;}})[_0x4376('0x23')](respondWithResult(_0x1df5c7,null))[_0x4376('0x44')](handleError(_0x1df5c7,null));};exports['getSubjects']=function(_0x1d7d82,_0x4c4d2c,_0x35c2a9){var _0x33656e={};var _0x178992={};var _0x50f52a;var _0x1347f1;return db[_0x4376('0x29')][_0x4376('0x4a')]({'where':{'id':_0x1d7d82['params']['id']}})[_0x4376('0x23')](handleEntityNotFound(_0x4c4d2c,null))['then'](function(_0x208d4a){if(_0x208d4a){_0x50f52a=_0x208d4a;_0x178992[_0x4376('0x2c')]=_[_0x4376('0x2e')](db[_0x4376('0x4b')][_0x4376('0x2a')]);_0x178992[_0x4376('0x2d')]=_[_0x4376('0x2e')](_0x1d7d82['query']);_0x178992[_0x4376('0x36')]=_['intersection'](_0x178992[_0x4376('0x2c')],_0x178992['query']);_0x33656e['attributes']=_[_0x4376('0x30')](_0x178992[_0x4376('0x2c')],qs[_0x4376('0x31')](_0x1d7d82[_0x4376('0x2d')][_0x4376('0x31')]));_0x33656e[_0x4376('0x2f')]=_0x33656e[_0x4376('0x2f')][_0x4376('0x32')]?_0x33656e[_0x4376('0x2f')]:_0x178992['model'];_0x33656e[_0x4376('0x4c')]=qs[_0x4376('0x35')](_0x1d7d82['query']['sort']);_0x33656e[_0x4376('0x39')]=qs['filters'](_[_0x4376('0x37')](_0x1d7d82[_0x4376('0x2d')],_0x178992[_0x4376('0x36')]));if(_0x1d7d82[_0x4376('0x2d')]['filter']){_0x33656e[_0x4376('0x39')]=_[_0x4376('0x3c')](_0x33656e['where'],{'$or':_[_0x4376('0x28')](_0x33656e['attributes'],function(_0x490eb6){var _0x15b433={};_0x15b433[_0x490eb6]={'$like':'%'+_0x1d7d82[_0x4376('0x2d')][_0x4376('0x38')]+'%'};return _0x15b433;})});}_0x33656e=_['merge']({},_0x33656e,_0x1d7d82['options']);return _0x50f52a[_0x4376('0x4d')](_0x33656e);}})[_0x4376('0x23')](function(_0x2bd76c){if(_0x2bd76c){_0x1347f1=_0x2bd76c[_0x4376('0x32')];if(!_0x1d7d82[_0x4376('0x2d')]['hasOwnProperty']('nolimit')){_0x33656e['limit']=qs[_0x4376('0x1e')](_0x1d7d82[_0x4376('0x2d')][_0x4376('0x1e')]);_0x33656e[_0x4376('0x1b')]=qs[_0x4376('0x1b')](_0x1d7d82[_0x4376('0x2d')][_0x4376('0x1b')]);}return _0x50f52a[_0x4376('0x4d')](_0x33656e);}})[_0x4376('0x23')](function(_0x51191a){if(_0x51191a){return _0x51191a?{'count':_0x1347f1,'rows':_0x51191a}:null;}})[_0x4376('0x23')](respondWithResult(_0x4c4d2c,null))[_0x4376('0x44')](handleError(_0x4c4d2c,null));};exports[_0x4376('0x4e')]=function(_0x11e2af,_0x57f023,_0x5c1bc5){var _0x3541c1={};var _0x1ae5b3={};var _0x22030c;var _0x32e101;return db[_0x4376('0x29')][_0x4376('0x4a')]({'where':{'id':_0x11e2af[_0x4376('0x47')]['id']}})['then'](handleEntityNotFound(_0x57f023,null))[_0x4376('0x23')](function(_0x4ead3b){if(_0x4ead3b){_0x22030c=_0x4ead3b;_0x1ae5b3[_0x4376('0x2c')]=_['keys'](db[_0x4376('0x4b')][_0x4376('0x2a')]);_0x1ae5b3[_0x4376('0x2d')]=_[_0x4376('0x2e')](_0x11e2af['query']);_0x1ae5b3[_0x4376('0x36')]=_[_0x4376('0x30')](_0x1ae5b3[_0x4376('0x2c')],_0x1ae5b3[_0x4376('0x2d')]);_0x3541c1['attributes']=_[_0x4376('0x30')](_0x1ae5b3['model'],qs[_0x4376('0x31')](_0x11e2af[_0x4376('0x2d')][_0x4376('0x31')]));_0x3541c1[_0x4376('0x2f')]=_0x3541c1[_0x4376('0x2f')][_0x4376('0x32')]?_0x3541c1['attributes']:_0x1ae5b3[_0x4376('0x2c')];_0x3541c1[_0x4376('0x4c')]=qs[_0x4376('0x35')](_0x11e2af['query'][_0x4376('0x35')]);_0x3541c1['where']=qs[_0x4376('0x36')](_[_0x4376('0x37')](_0x11e2af['query'],_0x1ae5b3[_0x4376('0x36')]));if(_0x11e2af[_0x4376('0x2d')][_0x4376('0x38')]){_0x3541c1['where']=_[_0x4376('0x3c')](_0x3541c1[_0x4376('0x39')],{'$or':_[_0x4376('0x28')](_0x3541c1[_0x4376('0x2f')],function(_0x2fa6e4){var _0x34b809={};_0x34b809[_0x2fa6e4]={'$like':'%'+_0x11e2af[_0x4376('0x2d')][_0x4376('0x38')]+'%'};return _0x34b809;})});}_0x3541c1=_[_0x4376('0x3c')]({},_0x3541c1,_0x11e2af[_0x4376('0x42')]);return _0x22030c['getDescriptions'](_0x3541c1);}})[_0x4376('0x23')](function(_0x4a3506){if(_0x4a3506){_0x32e101=_0x4a3506[_0x4376('0x32')];if(!_0x11e2af[_0x4376('0x2d')]['hasOwnProperty'](_0x4376('0x34'))){_0x3541c1['limit']=qs['limit'](_0x11e2af[_0x4376('0x2d')][_0x4376('0x1e')]);_0x3541c1[_0x4376('0x1b')]=qs[_0x4376('0x1b')](_0x11e2af[_0x4376('0x2d')][_0x4376('0x1b')]);}return _0x22030c[_0x4376('0x4e')](_0x3541c1);}})[_0x4376('0x23')](function(_0x3a35a3){if(_0x3a35a3){return _0x3a35a3?{'count':_0x32e101,'rows':_0x3a35a3}:null;}})[_0x4376('0x23')](respondWithResult(_0x57f023,null))[_0x4376('0x44')](handleError(_0x57f023,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 5b0de9e..041d422 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x5b64a1,_0x2ec810){var _0x4b6f55=function(_0x44dd84){while(--_0x44dd84){_0x5b64a1['push'](_0x5b64a1['shift']());}};_0x4b6f55(++_0x2ec810);}(_0x3e74,0x175));var _0x43e7=function(_0xa2fcb5,_0x556a3f){_0xa2fcb5=_0xa2fcb5-0x0;var _0x3e7bf9=_0x3e74[_0xa2fcb5];return _0x3e7bf9;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x3336aa,_0x1d61a6){var _0x71dd96=function(_0x38f561){while(--_0x38f561){_0x3336aa['push'](_0x3336aa['shift']());}};_0x71dd96(++_0x1d61a6);}(_0xaa88,0x137));var _0x8aa8=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0xaa88[_0x27bd2c];return _0x3784ea;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('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 4c3c5cf..8fc26cb 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 _0x346c=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x346c,0x171));var _0xc346=function(_0xa9526,_0x3bc599){_0xa9526=_0xa9526-0x0;var _0x1c6b9b=_0x346c[_0xa9526];return _0x1c6b9b;};'use strict';var _=require(_0xc346('0x0'));var util=require(_0xc346('0x1'));var moment=require(_0xc346('0x2'));var BPromise=require('bluebird');var rs=require(_0xc346('0x3'));var fs=require('fs');var Redis=require(_0xc346('0x4'));var db=require(_0xc346('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc346('0x6'));var config=require('../../config/environment');var jayson=require(_0xc346('0x7'));var client=jayson[_0xc346('0x8')][_0xc346('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x148045,_0x505f19,_0x26b3bd){return new BPromise(function(_0x5d0421,_0x5de091){return client[_0xc346('0xa')](_0x148045,_0x26b3bd)[_0xc346('0xb')](function(_0x18e62a){logger['info'](_0xc346('0xc'),_0x505f19,_0xc346('0xd'));logger[_0xc346('0xe')](_0xc346('0xf'),_0x505f19,_0xc346('0xd'),JSON[_0xc346('0x10')](_0x18e62a));if(_0x18e62a[_0xc346('0x11')]){if(_0x18e62a[_0xc346('0x11')][_0xc346('0x12')]===0x1f4){logger['error'](_0xc346('0xc'),_0x505f19,_0x18e62a[_0xc346('0x11')][_0xc346('0x13')]);return _0x5de091(_0x18e62a[_0xc346('0x11')][_0xc346('0x13')]);}logger['error'](_0xc346('0xc'),_0x505f19,_0x18e62a[_0xc346('0x11')][_0xc346('0x13')]);return _0x5d0421(_0x18e62a[_0xc346('0x11')][_0xc346('0x13')]);}else{logger[_0xc346('0x14')](_0xc346('0xc'),_0x505f19,_0xc346('0xd'));_0x5d0421(_0x18e62a[_0xc346('0x15')]['message']);}})[_0xc346('0x16')](function(_0xc4b6a4){logger[_0xc346('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x505f19,_0xc4b6a4);_0x5de091(_0xc4b6a4);});});} \ No newline at end of file +var _0x57bb=['request\x20sent','debug','stringify','code','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x57bb,0x8b));var _0xb57b=function(_0x56f92a,_0x1db612){_0x56f92a=_0x56f92a-0x0;var _0x36c063=_0x57bb[_0x56f92a];return _0x36c063;};'use strict';var _=require('lodash');var util=require(_0xb57b('0x0'));var moment=require(_0xb57b('0x1'));var BPromise=require(_0xb57b('0x2'));var rs=require(_0xb57b('0x3'));var fs=require('fs');var Redis=require(_0xb57b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb57b('0x5'));var logger=require(_0xb57b('0x6'))(_0xb57b('0x7'));var config=require(_0xb57b('0x8'));var jayson=require(_0xb57b('0x9'));var client=jayson[_0xb57b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x350293,_0x3a067c,_0x354bc6){return new BPromise(function(_0x390e6f,_0xfcd8b2){return client[_0xb57b('0xb')](_0x350293,_0x354bc6)[_0xb57b('0xc')](function(_0x316877){logger[_0xb57b('0xd')](_0xb57b('0xe'),_0x3a067c,_0xb57b('0xf'));logger[_0xb57b('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3a067c,_0xb57b('0xf'),JSON[_0xb57b('0x11')](_0x316877));if(_0x316877['error']){if(_0x316877['error'][_0xb57b('0x12')]===0x1f4){logger['error'](_0xb57b('0xe'),_0x3a067c,_0x316877[_0xb57b('0x13')][_0xb57b('0x14')]);return _0xfcd8b2(_0x316877[_0xb57b('0x13')][_0xb57b('0x14')]);}logger[_0xb57b('0x13')](_0xb57b('0xe'),_0x3a067c,_0x316877[_0xb57b('0x13')]['message']);return _0x390e6f(_0x316877[_0xb57b('0x13')][_0xb57b('0x14')]);}else{logger[_0xb57b('0xd')](_0xb57b('0xe'),_0x3a067c,'request\x20sent');_0x390e6f(_0x316877['result']['message']);}})[_0xb57b('0x15')](function(_0x25501b){logger['error'](_0xb57b('0xe'),_0x3a067c,_0x25501b);_0xfcd8b2(_0x25501b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 29c282f..b35e400 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 _0xb54f=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1b18d2,_0x1a93ed){var _0x184557=function(_0x4a4ac0){while(--_0x4a4ac0){_0x1b18d2['push'](_0x1b18d2['shift']());}};_0x184557(++_0x1a93ed);}(_0xb54f,0x10a));var _0xfb54=function(_0x134685,_0x246fbc){_0x134685=_0x134685-0x0;var _0x182b2f=_0xb54f[_0x134685];return _0x182b2f;};'use strict';var multer=require(_0xfb54('0x0'));var util=require(_0xfb54('0x1'));var path=require(_0xfb54('0x2'));var timeout=require(_0xfb54('0x3'));var express=require(_0xfb54('0x4'));var router=express[_0xfb54('0x5')]();var fs_extra=require(_0xfb54('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfb54('0x7'));var config=require(_0xfb54('0x8'));var controller=require('./intDynamics365Field.controller');router[_0xfb54('0x9')]('/',auth[_0xfb54('0xa')](),controller['index']);router['get'](_0xfb54('0xb'),auth[_0xfb54('0xa')](),controller[_0xfb54('0xc')]);router[_0xfb54('0xd')]('/',auth[_0xfb54('0xa')](),controller['create']);router[_0xfb54('0xe')](_0xfb54('0xb'),auth[_0xfb54('0xa')](),controller['update']);router[_0xfb54('0xf')](_0xfb54('0xb'),auth['isAuthenticated'](),controller[_0xfb54('0x10')]);module[_0xfb54('0x11')]=router; \ No newline at end of file +var _0xee86=['exports','multer','util','connect-timeout','fs-extra','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','put','delete'];(function(_0x23521f,_0x661e98){var _0x3db7ff=function(_0x1aeb70){while(--_0x1aeb70){_0x23521f['push'](_0x23521f['shift']());}};_0x3db7ff(++_0x661e98);}(_0xee86,0x151));var _0x6ee8=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xee86[_0x341e0f];return _0x59555a;};'use strict';var multer=require(_0x6ee8('0x0'));var util=require(_0x6ee8('0x1'));var path=require('path');var timeout=require(_0x6ee8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6ee8('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ee8('0x4'));var controller=require(_0x6ee8('0x5'));router[_0x6ee8('0x6')]('/',auth[_0x6ee8('0x7')](),controller[_0x6ee8('0x8')]);router['get'](_0x6ee8('0x9'),auth[_0x6ee8('0x7')](),controller['show']);router[_0x6ee8('0xa')]('/',auth[_0x6ee8('0x7')](),controller['create']);router[_0x6ee8('0xb')](_0x6ee8('0x9'),auth[_0x6ee8('0x7')](),controller['update']);router[_0x6ee8('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6ee8('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a0088b2..5230b11 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 _0x5b48=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x381c31,_0x556f1c){var _0x4afb9f=function(_0x16eb3f){while(--_0x16eb3f){_0x381c31['push'](_0x381c31['shift']());}};_0x4afb9f(++_0x556f1c);}(_0x5b48,0x15b));var _0x85b4=function(_0x4cda40,_0x56b16c){_0x4cda40=_0x4cda40-0x0;var _0x46090f=_0x5b48[_0x4cda40];return _0x46090f;};'use strict';var Sequelize=require(_0x85b4('0x0'));module[_0x85b4('0x1')]={'type':{'type':Sequelize[_0x85b4('0x2')](_0x85b4('0x3'),_0x85b4('0x4'),_0x85b4('0x5'),_0x85b4('0x6'),_0x85b4('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x85b4('0x8')]},'key':{'type':Sequelize[_0x85b4('0x8')]},'keyType':{'type':Sequelize[_0x85b4('0x2')](_0x85b4('0x3'),_0x85b4('0x4'),_0x85b4('0x5'))},'keyContent':{'type':Sequelize[_0x85b4('0x8')]},'idField':{'type':Sequelize[_0x85b4('0x8')]},'nameField':{'type':Sequelize[_0x85b4('0x8')]},'customField':{'type':Sequelize[_0x85b4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x85b4('0x8')]}}; \ No newline at end of file +var _0xe14f=['string','variable','keyValue','STRING','BOOLEAN','ENUM'];(function(_0x559953,_0x356e8c){var _0x5b821b=function(_0x44b78c){while(--_0x44b78c){_0x559953['push'](_0x559953['shift']());}};_0x5b821b(++_0x356e8c);}(_0xe14f,0x101));var _0xfe14=function(_0x5583f5,_0x2c648e){_0x5583f5=_0x5583f5-0x0;var _0x19c333=_0xe14f[_0x5583f5];return _0x19c333;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xfe14('0x0')](_0xfe14('0x1'),_0xfe14('0x2'),'customVariable',_0xfe14('0x3'),'picklist'),'defaultValue':_0xfe14('0x1')},'content':{'type':Sequelize[_0xfe14('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfe14('0x0')](_0xfe14('0x1'),_0xfe14('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xfe14('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfe14('0x4')]},'customField':{'type':Sequelize[_0xfe14('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 940b715..1a05751 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 _0xd459=['send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','Dynamics365Field','includeAll','findAll','catch','show','params','include','merge','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','name'];(function(_0x4cb027,_0x1ed336){var _0x172d36=function(_0x5d4c16){while(--_0x5d4c16){_0x4cb027['push'](_0x4cb027['shift']());}};_0x172d36(++_0x1ed336);}(_0xd459,0x1ce));var _0x9d45=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xd459[_0x397cfb];return _0x15fed9;};'use strict';var emlformat=require(_0x9d45('0x0'));var rimraf=require(_0x9d45('0x1'));var zipdir=require(_0x9d45('0x2'));var jsonpatch=require(_0x9d45('0x3'));var rp=require('request-promise');var moment=require(_0x9d45('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9d45('0x5'));var csv=require(_0x9d45('0x6'));var ejs=require(_0x9d45('0x7'));var fs=require('fs');var fs_extra=require(_0x9d45('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9d45('0x9'));var toCsv=require(_0x9d45('0x6'));var querystring=require(_0x9d45('0xa'));var Papa=require(_0x9d45('0xb'));var Redis=require(_0x9d45('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9d45('0xd'));var as=require(_0x9d45('0xe'));var hardwareService=require(_0x9d45('0xf'));var logger=require(_0x9d45('0x10'))('api');var utils=require(_0x9d45('0x11'));var config=require(_0x9d45('0x12'));var licenseUtil=require(_0x9d45('0x13'));var db=require(_0x9d45('0x14'))['db'];function respondWithStatusCode(_0x377153,_0x4c2726){_0x4c2726=_0x4c2726||0xcc;return function(_0x2d81cc){if(_0x2d81cc){return _0x377153[_0x9d45('0x15')](_0x4c2726);}return _0x377153['status'](_0x4c2726)['end']();};}function respondWithResult(_0x59afab,_0x493805){_0x493805=_0x493805||0xc8;return function(_0xcc71c9){if(_0xcc71c9){return _0x59afab[_0x9d45('0x16')](_0x493805)[_0x9d45('0x17')](_0xcc71c9);}};}function respondWithFilteredResult(_0x1e325d,_0x2578b4){return function(_0x3bda22){if(_0x3bda22){var _0x500d72=typeof _0x2578b4[_0x9d45('0x18')]===_0x9d45('0x19')&&typeof _0x2578b4[_0x9d45('0x1a')]===_0x9d45('0x19');var _0xb41fa8=_0x3bda22[_0x9d45('0x1b')];var _0x51f870=_0x500d72?0x0:_0x2578b4[_0x9d45('0x18')];var _0x1003e1=_0x500d72?_0x3bda22['count']:_0x2578b4[_0x9d45('0x18')]+_0x2578b4[_0x9d45('0x1a')];var _0x39f632;if(_0x1003e1>=_0xb41fa8){_0x1003e1=_0xb41fa8;_0x39f632=0xc8;}else{_0x39f632=0xce;}_0x1e325d[_0x9d45('0x16')](_0x39f632);return _0x1e325d[_0x9d45('0x1c')]('Content-Range',_0x51f870+'-'+_0x1003e1+'/'+_0xb41fa8)[_0x9d45('0x17')](_0x3bda22);}return null;};}function patchUpdates(_0x33ca8e){return function(_0x74873c){try{jsonpatch[_0x9d45('0x1d')](_0x74873c,_0x33ca8e,!![]);}catch(_0x3580d7){return BPromise[_0x9d45('0x1e')](_0x3580d7);}return _0x74873c[_0x9d45('0x1f')]();};}function saveUpdates(_0x288d28,_0x2bdabd){return function(_0x527160){if(_0x527160){return _0x527160[_0x9d45('0x20')](_0x288d28)[_0x9d45('0x21')](function(_0x2dd22e){return _0x2dd22e;});}return null;};}function removeEntity(_0x430f58,_0x29f616){return function(_0x1f60a4){if(_0x1f60a4){return _0x1f60a4['destroy']()[_0x9d45('0x21')](function(){_0x430f58[_0x9d45('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcde9ca,_0x3eb627){return function(_0x2a6fa8){if(!_0x2a6fa8){_0xcde9ca[_0x9d45('0x15')](0x194);}return _0x2a6fa8;};}function handleError(_0x397600,_0x23fb49){_0x23fb49=_0x23fb49||0x1f4;return function(_0x26fd9a){logger['error'](_0x26fd9a['stack']);if(_0x26fd9a[_0x9d45('0x22')]){delete _0x26fd9a[_0x9d45('0x22')];}_0x397600['status'](_0x23fb49)[_0x9d45('0x23')](_0x26fd9a);};}exports[_0x9d45('0x24')]=function(_0x114ad1,_0x13dec1){var _0x5a8260={},_0x1db1ef={},_0x57a56d={'count':0x0,'rows':[]};var _0x63c04a=_[_0x9d45('0x25')](db['Dynamics365Field'][_0x9d45('0x26')],function(_0x4e810b){return{'name':_0x4e810b[_0x9d45('0x27')],'type':_0x4e810b[_0x9d45('0x28')][_0x9d45('0x29')]};});_0x1db1ef[_0x9d45('0x2a')]=_['map'](_0x63c04a,_0x9d45('0x22'));_0x1db1ef['query']=_[_0x9d45('0x2b')](_0x114ad1[_0x9d45('0x2c')]);_0x1db1ef[_0x9d45('0x2d')]=_[_0x9d45('0x2e')](_0x1db1ef[_0x9d45('0x2a')],_0x1db1ef['query']);_0x5a8260['attributes']=_['intersection'](_0x1db1ef[_0x9d45('0x2a')],qs[_0x9d45('0x2f')](_0x114ad1[_0x9d45('0x2c')]['fields']));_0x5a8260[_0x9d45('0x30')]=_0x5a8260['attributes'][_0x9d45('0x31')]?_0x5a8260[_0x9d45('0x30')]:_0x1db1ef['model'];if(!_0x114ad1[_0x9d45('0x2c')][_0x9d45('0x32')](_0x9d45('0x33'))){_0x5a8260[_0x9d45('0x1a')]=qs['limit'](_0x114ad1['query'][_0x9d45('0x1a')]);_0x5a8260[_0x9d45('0x18')]=qs[_0x9d45('0x18')](_0x114ad1['query'][_0x9d45('0x18')]);}_0x5a8260[_0x9d45('0x34')]=qs[_0x9d45('0x35')](_0x114ad1[_0x9d45('0x2c')][_0x9d45('0x35')]);_0x5a8260['where']=qs[_0x9d45('0x2d')](_[_0x9d45('0x36')](_0x114ad1[_0x9d45('0x2c')],_0x1db1ef[_0x9d45('0x2d')]),_0x63c04a);if(_0x114ad1['query'][_0x9d45('0x37')]){_0x5a8260[_0x9d45('0x38')]=_['merge'](_0x5a8260[_0x9d45('0x38')],{'$or':_[_0x9d45('0x25')](_0x63c04a,function(_0x1b7b35){if(_0x1b7b35[_0x9d45('0x28')]!==_0x9d45('0x39')){var _0x179c3b={};_0x179c3b[_0x1b7b35['name']]={'$like':'%'+_0x114ad1[_0x9d45('0x2c')][_0x9d45('0x37')]+'%'};return _0x179c3b;}})});}_0x5a8260=_['merge']({},_0x5a8260,_0x114ad1[_0x9d45('0x3a')]);var _0x5e6c9f={'where':_0x5a8260[_0x9d45('0x38')]};return db[_0x9d45('0x3b')]['count'](_0x5e6c9f)['then'](function(_0x40541b){_0x57a56d[_0x9d45('0x1b')]=_0x40541b;if(_0x114ad1[_0x9d45('0x2c')][_0x9d45('0x3c')]){_0x5a8260['include']=[{'all':!![]}];}return db[_0x9d45('0x3b')][_0x9d45('0x3d')](_0x5a8260);})[_0x9d45('0x21')](function(_0xfd2081){_0x57a56d['rows']=_0xfd2081;return _0x57a56d;})[_0x9d45('0x21')](respondWithFilteredResult(_0x13dec1,_0x5a8260))[_0x9d45('0x3e')](handleError(_0x13dec1,null));};exports[_0x9d45('0x3f')]=function(_0x3f0a81,_0x48608d){var _0x12388f={'raw':!![],'where':{'id':_0x3f0a81[_0x9d45('0x40')]['id']}},_0x1322f8={};_0x1322f8['model']=_[_0x9d45('0x2b')](db[_0x9d45('0x3b')]['rawAttributes']);_0x1322f8['query']=_[_0x9d45('0x2b')](_0x3f0a81[_0x9d45('0x2c')]);_0x1322f8[_0x9d45('0x2d')]=_[_0x9d45('0x2e')](_0x1322f8['model'],_0x1322f8['query']);_0x12388f['attributes']=_['intersection'](_0x1322f8[_0x9d45('0x2a')],qs['fields'](_0x3f0a81[_0x9d45('0x2c')][_0x9d45('0x2f')]));_0x12388f[_0x9d45('0x30')]=_0x12388f['attributes'][_0x9d45('0x31')]?_0x12388f[_0x9d45('0x30')]:_0x1322f8[_0x9d45('0x2a')];if(_0x3f0a81[_0x9d45('0x2c')][_0x9d45('0x3c')]){_0x12388f[_0x9d45('0x41')]=[{'all':!![]}];}_0x12388f=_[_0x9d45('0x42')]({},_0x12388f,_0x3f0a81[_0x9d45('0x3a')]);return db[_0x9d45('0x3b')]['find'](_0x12388f)[_0x9d45('0x21')](handleEntityNotFound(_0x48608d,null))[_0x9d45('0x21')](respondWithResult(_0x48608d,null))[_0x9d45('0x3e')](handleError(_0x48608d,null));};exports[_0x9d45('0x43')]=function(_0x1ac914,_0x5c8402){return db[_0x9d45('0x3b')]['create'](_0x1ac914[_0x9d45('0x44')],{})[_0x9d45('0x21')](respondWithResult(_0x5c8402,0xc9))[_0x9d45('0x3e')](handleError(_0x5c8402,null));};exports[_0x9d45('0x20')]=function(_0x17088c,_0x55fbbd){if(_0x17088c[_0x9d45('0x44')]['id']){delete _0x17088c['body']['id'];}return db[_0x9d45('0x3b')][_0x9d45('0x45')]({'where':{'id':_0x17088c[_0x9d45('0x40')]['id']}})['then'](handleEntityNotFound(_0x55fbbd,null))['then'](saveUpdates(_0x17088c[_0x9d45('0x44')],null))[_0x9d45('0x21')](respondWithResult(_0x55fbbd,null))[_0x9d45('0x3e')](handleError(_0x55fbbd,null));};exports[_0x9d45('0x46')]=function(_0x386d0f,_0xc10427){return db['Dynamics365Field']['find']({'where':{'id':_0x386d0f[_0x9d45('0x40')]['id']}})[_0x9d45('0x21')](handleEntityNotFound(_0xc10427,null))[_0x9d45('0x21')](removeEntity(_0xc10427,null))[_0x9d45('0x3e')](handleError(_0xc10427,null));}; \ No newline at end of file +var _0x2b7c=['fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','update','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','index','Dynamics365Field','fieldName','type','model','map','query','filters','intersection','attributes'];(function(_0x304e27,_0x475f41){var _0x5f1953=function(_0x4511d7){while(--_0x4511d7){_0x304e27['push'](_0x304e27['shift']());}};_0x5f1953(++_0x475f41);}(_0x2b7c,0x146));var _0xc2b7=function(_0x18c9a6,_0xafde82){_0x18c9a6=_0x18c9a6-0x0;var _0x1f2b1e=_0x2b7c[_0x18c9a6];return _0x1f2b1e;};'use strict';var emlformat=require(_0xc2b7('0x0'));var rimraf=require(_0xc2b7('0x1'));var zipdir=require(_0xc2b7('0x2'));var jsonpatch=require(_0xc2b7('0x3'));var rp=require(_0xc2b7('0x4'));var moment=require('moment');var BPromise=require(_0xc2b7('0x5'));var Mustache=require(_0xc2b7('0x6'));var util=require(_0xc2b7('0x7'));var path=require(_0xc2b7('0x8'));var sox=require(_0xc2b7('0x9'));var csv=require(_0xc2b7('0xa'));var ejs=require(_0xc2b7('0xb'));var fs=require('fs');var fs_extra=require(_0xc2b7('0xc'));var _=require(_0xc2b7('0xd'));var squel=require(_0xc2b7('0xe'));var crypto=require(_0xc2b7('0xf'));var jsforce=require(_0xc2b7('0x10'));var deskjs=require(_0xc2b7('0x11'));var toCsv=require(_0xc2b7('0xa'));var querystring=require(_0xc2b7('0x12'));var Papa=require(_0xc2b7('0x13'));var Redis=require(_0xc2b7('0x14'));var authService=require(_0xc2b7('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xc2b7('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2b7('0x17'))(_0xc2b7('0x18'));var utils=require('../../config/utils');var config=require(_0xc2b7('0x19'));var licenseUtil=require(_0xc2b7('0x1a'));var db=require(_0xc2b7('0x1b'))['db'];function respondWithStatusCode(_0x2380c9,_0x2e2999){_0x2e2999=_0x2e2999||0xcc;return function(_0x4097cc){if(_0x4097cc){return _0x2380c9['sendStatus'](_0x2e2999);}return _0x2380c9[_0xc2b7('0x1c')](_0x2e2999)[_0xc2b7('0x1d')]();};}function respondWithResult(_0x491d67,_0x42f82a){_0x42f82a=_0x42f82a||0xc8;return function(_0x4a68f5){if(_0x4a68f5){return _0x491d67[_0xc2b7('0x1c')](_0x42f82a)[_0xc2b7('0x1e')](_0x4a68f5);}};}function respondWithFilteredResult(_0x1c5e31,_0x1246f9){return function(_0x5716a2){if(_0x5716a2){var _0x53fef0=typeof _0x1246f9[_0xc2b7('0x1f')]===_0xc2b7('0x20')&&typeof _0x1246f9['limit']===_0xc2b7('0x20');var _0x52d307=_0x5716a2[_0xc2b7('0x21')];var _0x43fb0c=_0x53fef0?0x0:_0x1246f9['offset'];var _0x4291cf=_0x53fef0?_0x5716a2['count']:_0x1246f9['offset']+_0x1246f9[_0xc2b7('0x22')];var _0x1a62b2;if(_0x4291cf>=_0x52d307){_0x4291cf=_0x52d307;_0x1a62b2=0xc8;}else{_0x1a62b2=0xce;}_0x1c5e31['status'](_0x1a62b2);return _0x1c5e31[_0xc2b7('0x23')](_0xc2b7('0x24'),_0x43fb0c+'-'+_0x4291cf+'/'+_0x52d307)[_0xc2b7('0x1e')](_0x5716a2);}return null;};}function patchUpdates(_0x5a8c2d){return function(_0x5dcab){try{jsonpatch[_0xc2b7('0x25')](_0x5dcab,_0x5a8c2d,!![]);}catch(_0x487ca0){return BPromise['reject'](_0x487ca0);}return _0x5dcab[_0xc2b7('0x26')]();};}function saveUpdates(_0x58f715,_0x541e74){return function(_0x4158ed){if(_0x4158ed){return _0x4158ed['update'](_0x58f715)[_0xc2b7('0x27')](function(_0x58bdb2){return _0x58bdb2;});}return null;};}function removeEntity(_0x1ef49d,_0x95d417){return function(_0xb5fdb2){if(_0xb5fdb2){return _0xb5fdb2[_0xc2b7('0x28')]()[_0xc2b7('0x27')](function(){_0x1ef49d['status'](0xcc)[_0xc2b7('0x1d')]();});}};}function handleEntityNotFound(_0x33d885,_0x11db6f){return function(_0x4247b6){if(!_0x4247b6){_0x33d885['sendStatus'](0x194);}return _0x4247b6;};}function handleError(_0xd19614,_0x1cf410){_0x1cf410=_0x1cf410||0x1f4;return function(_0x47e774){logger[_0xc2b7('0x29')](_0x47e774[_0xc2b7('0x2a')]);if(_0x47e774[_0xc2b7('0x2b')]){delete _0x47e774['name'];}_0xd19614[_0xc2b7('0x1c')](_0x1cf410)['send'](_0x47e774);};}exports[_0xc2b7('0x2c')]=function(_0x47bb08,_0x5cb8f1){var _0x4f920b={},_0x47f942={},_0x20d4d0={'count':0x0,'rows':[]};var _0x2d86da=_['map'](db[_0xc2b7('0x2d')]['rawAttributes'],function(_0x338829){return{'name':_0x338829[_0xc2b7('0x2e')],'type':_0x338829[_0xc2b7('0x2f')]['key']};});_0x47f942[_0xc2b7('0x30')]=_[_0xc2b7('0x31')](_0x2d86da,_0xc2b7('0x2b'));_0x47f942['query']=_['keys'](_0x47bb08[_0xc2b7('0x32')]);_0x47f942[_0xc2b7('0x33')]=_[_0xc2b7('0x34')](_0x47f942[_0xc2b7('0x30')],_0x47f942[_0xc2b7('0x32')]);_0x4f920b[_0xc2b7('0x35')]=_[_0xc2b7('0x34')](_0x47f942['model'],qs[_0xc2b7('0x36')](_0x47bb08[_0xc2b7('0x32')]['fields']));_0x4f920b[_0xc2b7('0x35')]=_0x4f920b[_0xc2b7('0x35')][_0xc2b7('0x37')]?_0x4f920b['attributes']:_0x47f942[_0xc2b7('0x30')];if(!_0x47bb08[_0xc2b7('0x32')][_0xc2b7('0x38')]('nolimit')){_0x4f920b[_0xc2b7('0x22')]=qs[_0xc2b7('0x22')](_0x47bb08[_0xc2b7('0x32')][_0xc2b7('0x22')]);_0x4f920b[_0xc2b7('0x1f')]=qs[_0xc2b7('0x1f')](_0x47bb08[_0xc2b7('0x32')][_0xc2b7('0x1f')]);}_0x4f920b[_0xc2b7('0x39')]=qs[_0xc2b7('0x3a')](_0x47bb08['query'][_0xc2b7('0x3a')]);_0x4f920b['where']=qs[_0xc2b7('0x33')](_[_0xc2b7('0x3b')](_0x47bb08[_0xc2b7('0x32')],_0x47f942['filters']),_0x2d86da);if(_0x47bb08[_0xc2b7('0x32')][_0xc2b7('0x3c')]){_0x4f920b[_0xc2b7('0x3d')]=_[_0xc2b7('0x3e')](_0x4f920b[_0xc2b7('0x3d')],{'$or':_[_0xc2b7('0x31')](_0x2d86da,function(_0x584420){if(_0x584420['type']!=='VIRTUAL'){var _0x5a6ec4={};_0x5a6ec4[_0x584420['name']]={'$like':'%'+_0x47bb08['query'][_0xc2b7('0x3c')]+'%'};return _0x5a6ec4;}})});}_0x4f920b=_[_0xc2b7('0x3e')]({},_0x4f920b,_0x47bb08[_0xc2b7('0x3f')]);var _0x38e4d9={'where':_0x4f920b[_0xc2b7('0x3d')]};return db[_0xc2b7('0x2d')][_0xc2b7('0x21')](_0x38e4d9)[_0xc2b7('0x27')](function(_0x423ed0){_0x20d4d0[_0xc2b7('0x21')]=_0x423ed0;if(_0x47bb08[_0xc2b7('0x32')]['includeAll']){_0x4f920b[_0xc2b7('0x40')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x4f920b);})['then'](function(_0x4e3b7c){_0x20d4d0[_0xc2b7('0x41')]=_0x4e3b7c;return _0x20d4d0;})[_0xc2b7('0x27')](respondWithFilteredResult(_0x5cb8f1,_0x4f920b))['catch'](handleError(_0x5cb8f1,null));};exports[_0xc2b7('0x42')]=function(_0x3a0298,_0x172230){var _0x4faba7={'raw':!![],'where':{'id':_0x3a0298[_0xc2b7('0x43')]['id']}},_0x48e93d={};_0x48e93d[_0xc2b7('0x30')]=_[_0xc2b7('0x44')](db[_0xc2b7('0x2d')][_0xc2b7('0x45')]);_0x48e93d[_0xc2b7('0x32')]=_[_0xc2b7('0x44')](_0x3a0298[_0xc2b7('0x32')]);_0x48e93d[_0xc2b7('0x33')]=_[_0xc2b7('0x34')](_0x48e93d['model'],_0x48e93d[_0xc2b7('0x32')]);_0x4faba7[_0xc2b7('0x35')]=_[_0xc2b7('0x34')](_0x48e93d[_0xc2b7('0x30')],qs['fields'](_0x3a0298[_0xc2b7('0x32')]['fields']));_0x4faba7[_0xc2b7('0x35')]=_0x4faba7[_0xc2b7('0x35')]['length']?_0x4faba7[_0xc2b7('0x35')]:_0x48e93d[_0xc2b7('0x30')];if(_0x3a0298[_0xc2b7('0x32')][_0xc2b7('0x46')]){_0x4faba7[_0xc2b7('0x40')]=[{'all':!![]}];}_0x4faba7=_[_0xc2b7('0x3e')]({},_0x4faba7,_0x3a0298[_0xc2b7('0x3f')]);return db[_0xc2b7('0x2d')][_0xc2b7('0x47')](_0x4faba7)[_0xc2b7('0x27')](handleEntityNotFound(_0x172230,null))[_0xc2b7('0x27')](respondWithResult(_0x172230,null))[_0xc2b7('0x48')](handleError(_0x172230,null));};exports[_0xc2b7('0x49')]=function(_0x265bde,_0xe0b540){return db[_0xc2b7('0x2d')][_0xc2b7('0x49')](_0x265bde[_0xc2b7('0x4a')],{})[_0xc2b7('0x27')](respondWithResult(_0xe0b540,0xc9))[_0xc2b7('0x48')](handleError(_0xe0b540,null));};exports[_0xc2b7('0x4b')]=function(_0x1263f1,_0x321893){if(_0x1263f1[_0xc2b7('0x4a')]['id']){delete _0x1263f1[_0xc2b7('0x4a')]['id'];}return db[_0xc2b7('0x2d')][_0xc2b7('0x47')]({'where':{'id':_0x1263f1['params']['id']}})[_0xc2b7('0x27')](handleEntityNotFound(_0x321893,null))[_0xc2b7('0x27')](saveUpdates(_0x1263f1[_0xc2b7('0x4a')],null))['then'](respondWithResult(_0x321893,null))[_0xc2b7('0x48')](handleError(_0x321893,null));};exports[_0xc2b7('0x28')]=function(_0x19ffc0,_0x4ac1c2){return db[_0xc2b7('0x2d')]['find']({'where':{'id':_0x19ffc0[_0xc2b7('0x43')]['id']}})[_0xc2b7('0x27')](handleEntityNotFound(_0x4ac1c2,null))[_0xc2b7('0x27')](removeEntity(_0x4ac1c2,null))[_0xc2b7('0x48')](handleError(_0x4ac1c2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 9850d6d..9a11ab4 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 _0xa19d=['FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0xa19d,0x79));var _0xda19=function(_0x4402b3,_0x5efbe5){_0x4402b3=_0x4402b3-0x0;var _0x384383=_0xa19d[_0x4402b3];return _0x384383;};'use strict';var _=require(_0xda19('0x0'));var util=require('util');var logger=require(_0xda19('0x1'))(_0xda19('0x2'));var moment=require('moment');var BPromise=require(_0xda19('0x3'));var rp=require(_0xda19('0x4'));var fs=require('fs');var path=require(_0xda19('0x5'));var rimraf=require(_0xda19('0x6'));var config=require('../../config/environment');var attributes=require(_0xda19('0x7'));module['exports']=function(_0x259fca,_0x16961f){return _0x259fca[_0xda19('0x8')](_0xda19('0x9'),attributes,{'tableName':_0xda19('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xda19('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c86=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define'];(function(_0x1808b2,_0x35f5a6){var _0x498147=function(_0x17d30a){while(--_0x17d30a){_0x1808b2['push'](_0x1808b2['shift']());}};_0x498147(++_0x35f5a6);}(_0x5c86,0x93));var _0x65c8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5c86[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x65c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x65c8('0x1'));var moment=require(_0x65c8('0x2'));var BPromise=require(_0x65c8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x65c8('0x4'));var config=require(_0x65c8('0x5'));var attributes=require(_0x65c8('0x6'));module[_0x65c8('0x7')]=function(_0x54fef2,_0x5edf29){return _0x54fef2[_0x65c8('0x8')](_0x65c8('0x9'),attributes,{'tableName':_0x65c8('0xa'),'paranoid':![],'indexes':[{'name':_0x65c8('0xb'),'fields':[_0x65c8('0xc'),'FieldId'],'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 9ec7734..6daeca8 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 _0x64dd=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x64dd,0xd8));var _0xd64d=function(_0x5c71ef,_0x36d669){_0x5c71ef=_0x5c71ef-0x0;var _0x484096=_0x64dd[_0x5c71ef];return _0x484096;};'use strict';var _=require(_0xd64d('0x0'));var util=require(_0xd64d('0x1'));var moment=require(_0xd64d('0x2'));var BPromise=require(_0xd64d('0x3'));var rs=require(_0xd64d('0x4'));var fs=require('fs');var Redis=require(_0xd64d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd64d('0x6'));var logger=require('../../config/logger')(_0xd64d('0x7'));var config=require(_0xd64d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd64d('0x9')][_0xd64d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d2d4f,_0x530405,_0x3a4438){return new BPromise(function(_0x299f64,_0x2b2f66){return client[_0xd64d('0xb')](_0x4d2d4f,_0x3a4438)[_0xd64d('0xc')](function(_0x811525){logger[_0xd64d('0xd')](_0xd64d('0xe'),_0x530405,_0xd64d('0xf'));logger[_0xd64d('0x10')](_0xd64d('0x11'),_0x530405,_0xd64d('0xf'),JSON['stringify'](_0x811525));if(_0x811525[_0xd64d('0x12')]){if(_0x811525[_0xd64d('0x12')][_0xd64d('0x13')]===0x1f4){logger[_0xd64d('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x530405,_0x811525[_0xd64d('0x12')][_0xd64d('0x14')]);return _0x2b2f66(_0x811525[_0xd64d('0x12')][_0xd64d('0x14')]);}logger[_0xd64d('0x12')](_0xd64d('0xe'),_0x530405,_0x811525[_0xd64d('0x12')][_0xd64d('0x14')]);return _0x299f64(_0x811525[_0xd64d('0x12')][_0xd64d('0x14')]);}else{logger[_0xd64d('0xd')](_0xd64d('0xe'),_0x530405,_0xd64d('0xf'));_0x299f64(_0x811525['result'][_0xd64d('0x14')]);}})[_0xd64d('0x15')](function(_0x19f2ed){logger[_0xd64d('0x12')](_0xd64d('0xe'),_0x530405,_0x19f2ed);_0x2b2f66(_0x19f2ed);});});} \ No newline at end of file +var _0x4616=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','result','moment','bluebird'];(function(_0xac947d,_0x2f26de){var _0x1d9c87=function(_0x121a36){while(--_0x121a36){_0xac947d['push'](_0xac947d['shift']());}};_0x1d9c87(++_0x2f26de);}(_0x4616,0xfa));var _0x6461=function(_0xd0868c,_0x4d3f80){_0xd0868c=_0xd0868c-0x0;var _0x1eb994=_0x4616[_0xd0868c];return _0x1eb994;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6461('0x0'));var BPromise=require(_0x6461('0x1'));var rs=require(_0x6461('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6461('0x3'))['db'];var utils=require(_0x6461('0x4'));var logger=require(_0x6461('0x5'))(_0x6461('0x6'));var config=require(_0x6461('0x7'));var jayson=require(_0x6461('0x8'));var client=jayson['client'][_0x6461('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1962b8,_0x1b3f4a,_0x1fbe29){return new BPromise(function(_0x341056,_0x11479a){return client[_0x6461('0xa')](_0x1962b8,_0x1fbe29)[_0x6461('0xb')](function(_0x5bc09a){logger[_0x6461('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x1b3f4a,_0x6461('0xd'));logger[_0x6461('0xe')](_0x6461('0xf'),_0x1b3f4a,_0x6461('0xd'),JSON[_0x6461('0x10')](_0x5bc09a));if(_0x5bc09a[_0x6461('0x11')]){if(_0x5bc09a['error']['code']===0x1f4){logger[_0x6461('0x11')](_0x6461('0x12'),_0x1b3f4a,_0x5bc09a['error'][_0x6461('0x13')]);return _0x11479a(_0x5bc09a[_0x6461('0x11')]['message']);}logger[_0x6461('0x11')](_0x6461('0x12'),_0x1b3f4a,_0x5bc09a[_0x6461('0x11')][_0x6461('0x13')]);return _0x341056(_0x5bc09a[_0x6461('0x11')][_0x6461('0x13')]);}else{logger[_0x6461('0xc')](_0x6461('0x12'),_0x1b3f4a,'request\x20sent');_0x341056(_0x5bc09a[_0x6461('0x14')][_0x6461('0x13')]);}})['catch'](function(_0x27635b){logger[_0x6461('0x11')](_0x6461('0x12'),_0x1b3f4a,_0x27635b);_0x11479a(_0x27635b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 19036ff..f024a1f 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 _0xf065=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0xf065,0x151));var _0x5f06=function(_0x59c6a1,_0x27b198){_0x59c6a1=_0x59c6a1-0x0;var _0x1f6560=_0xf065[_0x59c6a1];return _0x1f6560;};'use strict';var multer=require(_0x5f06('0x0'));var util=require(_0x5f06('0x1'));var path=require(_0x5f06('0x2'));var timeout=require(_0x5f06('0x3'));var express=require(_0x5f06('0x4'));var router=express[_0x5f06('0x5')]();var fs_extra=require(_0x5f06('0x6'));var auth=require(_0x5f06('0x7'));var interaction=require(_0x5f06('0x8'));var config=require(_0x5f06('0x9'));var controller=require(_0x5f06('0xa'));router[_0x5f06('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5f06('0xb')](_0x5f06('0xc'),auth[_0x5f06('0xd')](),controller[_0x5f06('0xe')]);router[_0x5f06('0xb')](_0x5f06('0xf'),auth[_0x5f06('0xd')](),controller[_0x5f06('0x10')]);router[_0x5f06('0xb')](_0x5f06('0x11'),auth[_0x5f06('0xd')](),controller[_0x5f06('0x12')]);router[_0x5f06('0x13')]('/',auth[_0x5f06('0xd')](),controller[_0x5f06('0x14')]);router[_0x5f06('0x13')](_0x5f06('0xf'),auth[_0x5f06('0xd')](),controller[_0x5f06('0x15')]);router[_0x5f06('0x16')](_0x5f06('0xc'),auth[_0x5f06('0xd')](),controller['update']);router[_0x5f06('0x17')]('/:id',auth[_0x5f06('0xd')](),controller[_0x5f06('0x18')]);module[_0x5f06('0x19')]=router; \ No newline at end of file +var _0x29b2=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x176e9e,_0x3dfe11){var _0x1b675f=function(_0x508167){while(--_0x508167){_0x176e9e['push'](_0x176e9e['shift']());}};_0x1b675f(++_0x3dfe11);}(_0x29b2,0x95));var _0x229b=function(_0x2ac298,_0x52179d){_0x2ac298=_0x2ac298-0x0;var _0x50d9f8=_0x29b2[_0x2ac298];return _0x50d9f8;};'use strict';var multer=require('multer');var util=require(_0x229b('0x0'));var path=require('path');var timeout=require(_0x229b('0x1'));var express=require(_0x229b('0x2'));var router=express['Router']();var fs_extra=require(_0x229b('0x3'));var auth=require(_0x229b('0x4'));var interaction=require(_0x229b('0x5'));var config=require(_0x229b('0x6'));var controller=require(_0x229b('0x7'));router[_0x229b('0x8')]('/',auth[_0x229b('0x9')](),controller[_0x229b('0xa')]);router['get'](_0x229b('0xb'),auth[_0x229b('0x9')](),controller['show']);router[_0x229b('0x8')](_0x229b('0xc'),auth[_0x229b('0x9')](),controller[_0x229b('0xd')]);router[_0x229b('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x229b('0xe')]);router[_0x229b('0xf')]('/',auth[_0x229b('0x9')](),controller[_0x229b('0x10')]);router['post'](_0x229b('0xc'),auth[_0x229b('0x9')](),controller[_0x229b('0x11')]);router[_0x229b('0x12')](_0x229b('0xb'),auth[_0x229b('0x9')](),controller['update']);router[_0x229b('0x13')](_0x229b('0xb'),auth[_0x229b('0x9')](),controller[_0x229b('0x14')]);module[_0x229b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index f665de0..906b951 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 _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0xadb5,0xad));var _0x5adb=function(_0x1812c9,_0x3b57f1){_0x1812c9=_0x1812c9-0x0;var _0x4a5b6a=_0xadb5[_0x1812c9];return _0x4a5b6a;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7096=['exports','STRING','username','remoteUri'];(function(_0x5d8d1a,_0x1fda6b){var _0x462ab1=function(_0x4a02b8){while(--_0x4a02b8){_0x5d8d1a['push'](_0x5d8d1a['shift']());}};_0x462ab1(++_0x1fda6b);}(_0x7096,0x10c));var _0x6709=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7096[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'apiKey':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'serverUrl':{'type':Sequelize[_0x6709('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 1ec1d16..1326b1d 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 _0x720e=['default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','stack','name','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','FreshdeskAccount','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','remoteUri','apiKey','slice','GET','format','Basic\x20%s','%s:X','toString','requester','agent','description','priority','source','group','company','includes'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x720e,0x1cb));var _0xe720=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0x720e[_0x49c68e];return _0x33032b;};'use strict';var emlformat=require(_0xe720('0x0'));var rimraf=require(_0xe720('0x1'));var zipdir=require(_0xe720('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe720('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe720('0x4'));var util=require(_0xe720('0x5'));var path=require(_0xe720('0x6'));var sox=require(_0xe720('0x7'));var csv=require(_0xe720('0x8'));var ejs=require(_0xe720('0x9'));var fs=require('fs');var fs_extra=require(_0xe720('0xa'));var _=require('lodash');var squel=require(_0xe720('0xb'));var crypto=require(_0xe720('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe720('0xd'));var Papa=require(_0xe720('0xe'));var Redis=require(_0xe720('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe720('0x10'));var as=require(_0xe720('0x11'));var hardwareService=require(_0xe720('0x12'));var logger=require(_0xe720('0x13'))(_0xe720('0x14'));var utils=require(_0xe720('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe720('0x16'))['db'];var integrations=require(_0xe720('0x17'));function respondWithStatusCode(_0x1a82cc,_0xac0320){_0xac0320=_0xac0320||0xcc;return function(_0xea1a0a){if(_0xea1a0a){return _0x1a82cc[_0xe720('0x18')](_0xac0320);}return _0x1a82cc[_0xe720('0x19')](_0xac0320)[_0xe720('0x1a')]();};}function respondWithResult(_0x3b25e5,_0x4f85fe){_0x4f85fe=_0x4f85fe||0xc8;return function(_0x47e7e9){if(_0x47e7e9){return _0x3b25e5[_0xe720('0x19')](_0x4f85fe)[_0xe720('0x1b')](_0x47e7e9);}};}function respondWithFilteredResult(_0x49a04a,_0x312c36){return function(_0x2fd06d){if(_0x2fd06d){var _0x539231=typeof _0x312c36[_0xe720('0x1c')]==='undefined'&&typeof _0x312c36[_0xe720('0x1d')]===_0xe720('0x1e');var _0x59ea77=_0x2fd06d[_0xe720('0x1f')];var _0x5e4a0c=_0x539231?0x0:_0x312c36[_0xe720('0x1c')];var _0x113590=_0x539231?_0x2fd06d[_0xe720('0x1f')]:_0x312c36['offset']+_0x312c36[_0xe720('0x1d')];var _0x5ef9a6;if(_0x113590>=_0x59ea77){_0x113590=_0x59ea77;_0x5ef9a6=0xc8;}else{_0x5ef9a6=0xce;}_0x49a04a[_0xe720('0x19')](_0x5ef9a6);return _0x49a04a[_0xe720('0x20')](_0xe720('0x21'),_0x5e4a0c+'-'+_0x113590+'/'+_0x59ea77)['json'](_0x2fd06d);}return null;};}function patchUpdates(_0x5b9779){return function(_0x1e2196){try{jsonpatch['apply'](_0x1e2196,_0x5b9779,!![]);}catch(_0x305438){return BPromise[_0xe720('0x22')](_0x305438);}return _0x1e2196[_0xe720('0x23')]();};}function saveUpdates(_0xaa596f,_0xdb9b6){return function(_0x3c1420){if(_0x3c1420){return _0x3c1420['update'](_0xaa596f)[_0xe720('0x24')](function(_0x72c24d){return _0x72c24d;});}return null;};}function removeEntity(_0x4309a5,_0x47b367){return function(_0x210a27){if(_0x210a27){return _0x210a27[_0xe720('0x25')]()[_0xe720('0x24')](function(){_0x4309a5[_0xe720('0x19')](0xcc)[_0xe720('0x1a')]();});}};}function handleEntityNotFound(_0x1bca96,_0x2c38ea){return function(_0x45d9ec){if(!_0x45d9ec){_0x1bca96[_0xe720('0x18')](0x194);}return _0x45d9ec;};}function handleError(_0xa49196,_0x8c0bd8){_0x8c0bd8=_0x8c0bd8||0x1f4;return function(_0x1fd9a1){logger['error'](_0x1fd9a1[_0xe720('0x26')]);if(_0x1fd9a1[_0xe720('0x27')]){delete _0x1fd9a1[_0xe720('0x27')];}_0xa49196[_0xe720('0x19')](_0x8c0bd8)['send'](_0x1fd9a1);};}exports[_0xe720('0x28')]=function(_0x3e9611,_0x2a7233){var _0x1ca67d={},_0x45496f={},_0x1ec4b0={'count':0x0,'rows':[]};var _0x388421=_[_0xe720('0x29')](db['FreshdeskAccount'][_0xe720('0x2a')],function(_0x3d1c3a){return{'name':_0x3d1c3a['fieldName'],'type':_0x3d1c3a['type'][_0xe720('0x2b')]};});_0x45496f[_0xe720('0x2c')]=_[_0xe720('0x29')](_0x388421,'name');_0x45496f['query']=_[_0xe720('0x2d')](_0x3e9611[_0xe720('0x2e')]);_0x45496f[_0xe720('0x2f')]=_[_0xe720('0x30')](_0x45496f['model'],_0x45496f[_0xe720('0x2e')]);_0x1ca67d[_0xe720('0x31')]=_[_0xe720('0x30')](_0x45496f[_0xe720('0x2c')],qs[_0xe720('0x32')](_0x3e9611[_0xe720('0x2e')][_0xe720('0x32')]));_0x1ca67d[_0xe720('0x31')]=_0x1ca67d[_0xe720('0x31')]['length']?_0x1ca67d['attributes']:_0x45496f[_0xe720('0x2c')];if(!_0x3e9611['query'][_0xe720('0x33')](_0xe720('0x34'))){_0x1ca67d[_0xe720('0x1d')]=qs[_0xe720('0x1d')](_0x3e9611[_0xe720('0x2e')]['limit']);_0x1ca67d[_0xe720('0x1c')]=qs['offset'](_0x3e9611[_0xe720('0x2e')][_0xe720('0x1c')]);}_0x1ca67d[_0xe720('0x35')]=qs['sort'](_0x3e9611['query'][_0xe720('0x36')]);_0x1ca67d[_0xe720('0x37')]=qs[_0xe720('0x2f')](_[_0xe720('0x38')](_0x3e9611[_0xe720('0x2e')],_0x45496f['filters']),_0x388421);if(_0x3e9611[_0xe720('0x2e')]['filter']){_0x1ca67d['where']=_[_0xe720('0x39')](_0x1ca67d[_0xe720('0x37')],{'$or':_['map'](_0x388421,function(_0x6567ca){if(_0x6567ca[_0xe720('0x3a')]!==_0xe720('0x3b')){var _0x45de56={};_0x45de56[_0x6567ca[_0xe720('0x27')]]={'$like':'%'+_0x3e9611['query'][_0xe720('0x3c')]+'%'};return _0x45de56;}})});}_0x1ca67d=_[_0xe720('0x39')]({},_0x1ca67d,_0x3e9611[_0xe720('0x3d')]);var _0x4023ec={'where':_0x1ca67d[_0xe720('0x37')]};return db[_0xe720('0x3e')][_0xe720('0x1f')](_0x4023ec)[_0xe720('0x24')](function(_0x66ed78){_0x1ec4b0[_0xe720('0x1f')]=_0x66ed78;if(_0x3e9611[_0xe720('0x2e')][_0xe720('0x3f')]){_0x1ca67d[_0xe720('0x40')]=[{'all':!![]}];}return db[_0xe720('0x3e')][_0xe720('0x41')](_0x1ca67d);})[_0xe720('0x24')](function(_0x5290e3){_0x1ec4b0[_0xe720('0x42')]=_0x5290e3;return _0x1ec4b0;})[_0xe720('0x24')](respondWithFilteredResult(_0x2a7233,_0x1ca67d))[_0xe720('0x43')](handleError(_0x2a7233,null));};exports[_0xe720('0x44')]=function(_0x2c3b22,_0x1b9259){var _0x6508bf={'raw':![],'where':{'id':_0x2c3b22[_0xe720('0x45')]['id']}},_0x1b6ea5={};_0x1b6ea5[_0xe720('0x2c')]=_[_0xe720('0x2d')](db['FreshdeskAccount']['rawAttributes']);_0x1b6ea5[_0xe720('0x2e')]=_[_0xe720('0x2d')](_0x2c3b22[_0xe720('0x2e')]);_0x1b6ea5['filters']=_[_0xe720('0x30')](_0x1b6ea5['model'],_0x1b6ea5[_0xe720('0x2e')]);_0x6508bf[_0xe720('0x31')]=_['intersection'](_0x1b6ea5[_0xe720('0x2c')],qs[_0xe720('0x32')](_0x2c3b22['query'][_0xe720('0x32')]));_0x6508bf[_0xe720('0x31')]=_0x6508bf[_0xe720('0x31')][_0xe720('0x46')]?_0x6508bf[_0xe720('0x31')]:_0x1b6ea5['model'];if(_0x2c3b22[_0xe720('0x2e')]['includeAll']){_0x6508bf[_0xe720('0x40')]=[{'all':!![]}];}_0x6508bf=_[_0xe720('0x39')]({},_0x6508bf,_0x2c3b22[_0xe720('0x3d')]);return db[_0xe720('0x3e')]['find'](_0x6508bf)[_0xe720('0x24')](handleEntityNotFound(_0x1b9259,null))[_0xe720('0x24')](respondWithResult(_0x1b9259,null))[_0xe720('0x43')](handleError(_0x1b9259,null));};exports[_0xe720('0x47')]=function(_0x41f93c,_0x409a3b){return db['FreshdeskAccount'][_0xe720('0x47')](_0x41f93c[_0xe720('0x48')],{})['then'](respondWithResult(_0x409a3b,0xc9))[_0xe720('0x43')](handleError(_0x409a3b,null));};exports[_0xe720('0x49')]=function(_0x36271,_0x485739){if(_0x36271[_0xe720('0x48')]['id']){delete _0x36271[_0xe720('0x48')]['id'];}return db[_0xe720('0x3e')][_0xe720('0x4a')]({'where':{'id':_0x36271[_0xe720('0x45')]['id']}})['then'](handleEntityNotFound(_0x485739,null))[_0xe720('0x24')](saveUpdates(_0x36271['body'],null))[_0xe720('0x24')](respondWithResult(_0x485739,null))[_0xe720('0x43')](handleError(_0x485739,null));};exports['destroy']=function(_0x10946b,_0x2216c9){return db[_0xe720('0x3e')][_0xe720('0x4a')]({'where':{'id':_0x10946b[_0xe720('0x45')]['id']}})[_0xe720('0x24')](handleEntityNotFound(_0x2216c9,null))['then'](removeEntity(_0x2216c9,null))[_0xe720('0x43')](handleError(_0x2216c9,null));};exports['getConfigurations']=function(_0x119d2a,_0x56228d,_0x1b600e){var _0x245b05={};var _0x2c56c2={};var _0x5ab965;var _0x5c1e87;return db[_0xe720('0x3e')][_0xe720('0x4b')]({'where':{'id':_0x119d2a[_0xe720('0x45')]['id']}})[_0xe720('0x24')](handleEntityNotFound(_0x56228d,null))[_0xe720('0x24')](function(_0x10b50d){if(_0x10b50d){_0x5ab965=_0x10b50d;_0x2c56c2[_0xe720('0x2c')]=_[_0xe720('0x2d')](db[_0xe720('0x4c')]['rawAttributes']);_0x2c56c2[_0xe720('0x2e')]=_[_0xe720('0x2d')](_0x119d2a['query']);_0x2c56c2[_0xe720('0x2f')]=_[_0xe720('0x30')](_0x2c56c2[_0xe720('0x2c')],_0x2c56c2[_0xe720('0x2e')]);_0x245b05[_0xe720('0x31')]=_['intersection'](_0x2c56c2[_0xe720('0x2c')],qs['fields'](_0x119d2a[_0xe720('0x2e')][_0xe720('0x32')]));_0x245b05['attributes']=_0x245b05[_0xe720('0x31')][_0xe720('0x46')]?_0x245b05[_0xe720('0x31')]:_0x2c56c2[_0xe720('0x2c')];_0x245b05[_0xe720('0x35')]=qs[_0xe720('0x36')](_0x119d2a[_0xe720('0x2e')]['sort']);_0x245b05[_0xe720('0x37')]=qs[_0xe720('0x2f')](_[_0xe720('0x38')](_0x119d2a['query'],_0x2c56c2['filters']));if(_0x119d2a[_0xe720('0x2e')][_0xe720('0x3c')]){_0x245b05[_0xe720('0x37')]=_[_0xe720('0x39')](_0x245b05[_0xe720('0x37')],{'$or':_[_0xe720('0x29')](_0x245b05[_0xe720('0x31')],function(_0xd6edfb){var _0x3b349a={};_0x3b349a[_0xd6edfb]={'$like':'%'+_0x119d2a[_0xe720('0x2e')][_0xe720('0x3c')]+'%'};return _0x3b349a;})});}_0x245b05=_['merge']({},_0x245b05,_0x119d2a[_0xe720('0x3d')]);return _0x5ab965[_0xe720('0x4d')](_0x245b05);}})[_0xe720('0x24')](function(_0x198ad1){if(_0x198ad1){_0x5c1e87=_0x198ad1[_0xe720('0x46')];if(!_0x119d2a[_0xe720('0x2e')]['hasOwnProperty'](_0xe720('0x34'))){_0x245b05['limit']=qs[_0xe720('0x1d')](_0x119d2a[_0xe720('0x2e')]['limit']);_0x245b05['offset']=qs[_0xe720('0x1c')](_0x119d2a[_0xe720('0x2e')][_0xe720('0x1c')]);}return _0x5ab965[_0xe720('0x4d')](_0x245b05);}})[_0xe720('0x24')](function(_0x1375da){if(_0x1375da){return _0x1375da?{'count':_0x5c1e87,'rows':_0x1375da}:null;}})['then'](respondWithResult(_0x56228d,null))[_0xe720('0x43')](handleError(_0x56228d,null));};exports[_0xe720('0x4e')]=function(_0x326346,_0x1bfc50,_0x300c73){if(_0x326346[_0xe720('0x48')]['id']){delete _0x326346[_0xe720('0x48')]['id'];}return db[_0xe720('0x3e')][_0xe720('0x4b')]({'where':{'id':_0x326346[_0xe720('0x45')]['id']}})['then'](handleEntityNotFound(_0x1bfc50,null))[_0xe720('0x24')](function(_0xb0b313){if(_0xb0b313){_0x326346[_0xe720('0x48')][_0xe720('0x4f')]=_0xb0b313['id'];_0x326346[_0xe720('0x48')][_0xe720('0x50')]=integrations[_0xe720('0x51')](_0x326346['body'][_0xe720('0x52')],_0x326346['body'][_0xe720('0x3a')]);_0x326346[_0xe720('0x48')][_0xe720('0x53')]=integrations['getDescriptions'](_0x326346[_0xe720('0x48')][_0xe720('0x52')],_0x326346['body']['type']);return db[_0xe720('0x4c')][_0xe720('0x47')](_0x326346[_0xe720('0x48')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0xe720('0x53')}]});}return null;})[_0xe720('0x24')](respondWithResult(_0x1bfc50,null))['catch'](handleError(_0x1bfc50,null));};exports[_0xe720('0x54')]=function(_0x57209e,_0x3de0be,_0x52f6a5){var _0x2fab72='';return db[_0xe720('0x3e')][_0xe720('0x4b')]({'where':{'id':_0x57209e[_0xe720('0x45')]['id']},'attributes':['id',_0xe720('0x55'),_0xe720('0x56')]})['then'](handleEntityNotFound(_0x3de0be,null))['then'](function(_0x440d91){if(_0x440d91){_0x2fab72=_0x440d91[_0xe720('0x55')];var _0x337f4e=_0x2fab72[_0xe720('0x57')](-0x1);if(_0x337f4e==='/'){_0x2fab72=_0x2fab72['substring'](0x0,_0x2fab72['lastIndexOf'](_0x337f4e));}return rp({'method':_0xe720('0x58'),'uri':util[_0xe720('0x59')]('%s/%s',_0x2fab72,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xe720('0x59')](_0xe720('0x5a'),new Buffer(util[_0xe720('0x59')](_0xe720('0x5b'),_0x440d91[_0xe720('0x56')]))[_0xe720('0x5c')]('base64'))},'json':!![]});}})[_0xe720('0x24')](function(_0x21a9a4){if(_0x21a9a4){var _0x5b0a85=[_0xe720('0x5d'),'subject',_0xe720('0x5e'),_0xe720('0x5f'),_0xe720('0x19'),_0xe720('0x60'),'group',_0xe720('0x61'),'ticket_type',_0xe720('0x62'),_0xe720('0x63')];_['remove'](_0x21a9a4,function(_0x18dd4f){return _0x5b0a85[_0xe720('0x64')](_0x18dd4f[_0xe720('0x27')])||!_0x18dd4f[_0xe720('0x65')]&&_0x18dd4f[_0xe720('0x3a')]!==_0xe720('0x66')&&_0x18dd4f['type']!==_0xe720('0x67');});return{'count':_0x21a9a4[_0xe720('0x46')],'rows':_[_0xe720('0x29')](_0x21a9a4,function(_0x5a1b13){return{'id':_0x5a1b13[_0xe720('0x27')],'name':_0x5a1b13[_0xe720('0x68')],'custom':!_0x5a1b13[_0xe720('0x65')],'options':_0x5a1b13[_0xe720('0x69')]?_[_0xe720('0x29')](_0x5a1b13[_0xe720('0x69')],function(_0x196871){return{'name':_[_0xe720('0x6a')](_0x196871),'value':_0x196871};}):[]};})};}})[_0xe720('0x24')](respondWithResult(_0x3de0be,null))[_0xe720('0x43')](function(_0x20e147){var _0x5b1341=_0x57209e[_0xe720('0x2e')][_0xe720('0x6b')]?0x1f4:_0x20e147[_0xe720('0x6c')]||0x1f4;logger[_0xe720('0x6d')]('getFields,\x20%s,\x20%s,\x20%s',_0xe720('0x54'),_0x5b1341,JSON['stringify'](_0x20e147));delete _0x20e147['name'];if(_0x5b1341===0x191){_0x5b1341=0x190;}_0x3de0be['status'](_0x5b1341)[_0xe720('0x6e')](_0x57209e[_0xe720('0x2e')][_0xe720('0x6b')]?{'message':_0xe720('0x6f'),'statusCode':_0x20e147[_0xe720('0x6c')]}:_0x20e147);});}; \ No newline at end of file +var _0x477a=['getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','priority','group','source','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa477('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa477('0x1'));var jsonpatch=require(_0xa477('0x2'));var rp=require('request-promise');var moment=require(_0xa477('0x3'));var BPromise=require(_0xa477('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa477('0x5'));var sox=require(_0xa477('0x6'));var csv=require('to-csv');var ejs=require(_0xa477('0x7'));var fs=require('fs');var fs_extra=require(_0xa477('0x8'));var _=require(_0xa477('0x9'));var squel=require(_0xa477('0xa'));var crypto=require(_0xa477('0xb'));var jsforce=require(_0xa477('0xc'));var deskjs=require(_0xa477('0xd'));var toCsv=require(_0xa477('0xe'));var querystring=require(_0xa477('0xf'));var Papa=require('papaparse');var Redis=require(_0xa477('0x10'));var authService=require(_0xa477('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa477('0x12'));var config=require(_0xa477('0x13'));var licenseUtil=require(_0xa477('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa477('0x15'));function respondWithStatusCode(_0x3d2a17,_0x70e1c1){_0x70e1c1=_0x70e1c1||0xcc;return function(_0x5e09ef){if(_0x5e09ef){return _0x3d2a17[_0xa477('0x16')](_0x70e1c1);}return _0x3d2a17[_0xa477('0x17')](_0x70e1c1)[_0xa477('0x18')]();};}function respondWithResult(_0x185c76,_0xe878a){_0xe878a=_0xe878a||0xc8;return function(_0x484706){if(_0x484706){return _0x185c76[_0xa477('0x17')](_0xe878a)[_0xa477('0x19')](_0x484706);}};}function respondWithFilteredResult(_0xa607d0,_0x45ecc1){return function(_0x22a156){if(_0x22a156){var _0x1659cb=typeof _0x45ecc1[_0xa477('0x1a')]===_0xa477('0x1b')&&typeof _0x45ecc1[_0xa477('0x1c')]===_0xa477('0x1b');var _0xc21f88=_0x22a156[_0xa477('0x1d')];var _0xd9cdae=_0x1659cb?0x0:_0x45ecc1['offset'];var _0x6d645=_0x1659cb?_0x22a156[_0xa477('0x1d')]:_0x45ecc1[_0xa477('0x1a')]+_0x45ecc1[_0xa477('0x1c')];var _0x4596bd;if(_0x6d645>=_0xc21f88){_0x6d645=_0xc21f88;_0x4596bd=0xc8;}else{_0x4596bd=0xce;}_0xa607d0[_0xa477('0x17')](_0x4596bd);return _0xa607d0[_0xa477('0x1e')](_0xa477('0x1f'),_0xd9cdae+'-'+_0x6d645+'/'+_0xc21f88)['json'](_0x22a156);}return null;};}function patchUpdates(_0x434ef1){return function(_0x240956){try{jsonpatch[_0xa477('0x20')](_0x240956,_0x434ef1,!![]);}catch(_0x5ed526){return BPromise['reject'](_0x5ed526);}return _0x240956['save']();};}function saveUpdates(_0x14d01e,_0x2debae){return function(_0x571501){if(_0x571501){return _0x571501[_0xa477('0x21')](_0x14d01e)['then'](function(_0x5b6e98){return _0x5b6e98;});}return null;};}function removeEntity(_0x7aa4ac,_0x166694){return function(_0x1bb568){if(_0x1bb568){return _0x1bb568[_0xa477('0x22')]()[_0xa477('0x23')](function(){_0x7aa4ac[_0xa477('0x17')](0xcc)[_0xa477('0x18')]();});}};}function handleEntityNotFound(_0x48209e,_0x3cafd9){return function(_0x1e444e){if(!_0x1e444e){_0x48209e[_0xa477('0x16')](0x194);}return _0x1e444e;};}function handleError(_0x236416,_0x18e8c3){_0x18e8c3=_0x18e8c3||0x1f4;return function(_0x27ec39){logger[_0xa477('0x24')](_0x27ec39['stack']);if(_0x27ec39[_0xa477('0x25')]){delete _0x27ec39[_0xa477('0x25')];}_0x236416[_0xa477('0x17')](_0x18e8c3)[_0xa477('0x26')](_0x27ec39);};}exports[_0xa477('0x27')]=function(_0xdb15a9,_0x14b0e8){var _0x5aed5d={},_0x169089={},_0x5819c8={'count':0x0,'rows':[]};var _0x599371=_[_0xa477('0x28')](db[_0xa477('0x29')]['rawAttributes'],function(_0x15e476){return{'name':_0x15e476[_0xa477('0x2a')],'type':_0x15e476[_0xa477('0x2b')][_0xa477('0x2c')]};});_0x169089[_0xa477('0x2d')]=_[_0xa477('0x28')](_0x599371,_0xa477('0x25'));_0x169089[_0xa477('0x2e')]=_[_0xa477('0x2f')](_0xdb15a9[_0xa477('0x2e')]);_0x169089[_0xa477('0x30')]=_[_0xa477('0x31')](_0x169089[_0xa477('0x2d')],_0x169089['query']);_0x5aed5d[_0xa477('0x32')]=_[_0xa477('0x31')](_0x169089[_0xa477('0x2d')],qs[_0xa477('0x33')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x33')]));_0x5aed5d[_0xa477('0x32')]=_0x5aed5d[_0xa477('0x32')]['length']?_0x5aed5d[_0xa477('0x32')]:_0x169089[_0xa477('0x2d')];if(!_0xdb15a9[_0xa477('0x2e')][_0xa477('0x34')](_0xa477('0x35'))){_0x5aed5d[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x1c')]);_0x5aed5d[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x1a')]);}_0x5aed5d[_0xa477('0x36')]=qs[_0xa477('0x37')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x37')]);_0x5aed5d[_0xa477('0x38')]=qs[_0xa477('0x30')](_['pick'](_0xdb15a9[_0xa477('0x2e')],_0x169089[_0xa477('0x30')]),_0x599371);if(_0xdb15a9[_0xa477('0x2e')][_0xa477('0x39')]){_0x5aed5d[_0xa477('0x38')]=_[_0xa477('0x3a')](_0x5aed5d['where'],{'$or':_['map'](_0x599371,function(_0x3065e7){if(_0x3065e7[_0xa477('0x2b')]!==_0xa477('0x3b')){var _0x764cef={};_0x764cef[_0x3065e7['name']]={'$like':'%'+_0xdb15a9['query'][_0xa477('0x39')]+'%'};return _0x764cef;}})});}_0x5aed5d=_[_0xa477('0x3a')]({},_0x5aed5d,_0xdb15a9[_0xa477('0x3c')]);var _0x3db1a6={'where':_0x5aed5d[_0xa477('0x38')]};return db[_0xa477('0x29')][_0xa477('0x1d')](_0x3db1a6)[_0xa477('0x23')](function(_0x365f1a){_0x5819c8['count']=_0x365f1a;if(_0xdb15a9[_0xa477('0x2e')][_0xa477('0x3d')]){_0x5aed5d[_0xa477('0x3e')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xa477('0x3f')](_0x5aed5d);})['then'](function(_0x3d9ba0){_0x5819c8[_0xa477('0x40')]=_0x3d9ba0;return _0x5819c8;})['then'](respondWithFilteredResult(_0x14b0e8,_0x5aed5d))[_0xa477('0x41')](handleError(_0x14b0e8,null));};exports[_0xa477('0x42')]=function(_0x5c1e58,_0x240ad9){var _0x37f18c={'raw':![],'where':{'id':_0x5c1e58[_0xa477('0x43')]['id']}},_0x289080={};_0x289080[_0xa477('0x2d')]=_[_0xa477('0x2f')](db[_0xa477('0x29')][_0xa477('0x44')]);_0x289080[_0xa477('0x2e')]=_[_0xa477('0x2f')](_0x5c1e58['query']);_0x289080[_0xa477('0x30')]=_[_0xa477('0x31')](_0x289080[_0xa477('0x2d')],_0x289080[_0xa477('0x2e')]);_0x37f18c[_0xa477('0x32')]=_['intersection'](_0x289080[_0xa477('0x2d')],qs['fields'](_0x5c1e58[_0xa477('0x2e')][_0xa477('0x33')]));_0x37f18c[_0xa477('0x32')]=_0x37f18c['attributes'][_0xa477('0x45')]?_0x37f18c[_0xa477('0x32')]:_0x289080[_0xa477('0x2d')];if(_0x5c1e58[_0xa477('0x2e')][_0xa477('0x3d')]){_0x37f18c[_0xa477('0x3e')]=[{'all':!![]}];}_0x37f18c=_[_0xa477('0x3a')]({},_0x37f18c,_0x5c1e58[_0xa477('0x3c')]);return db[_0xa477('0x29')][_0xa477('0x46')](_0x37f18c)[_0xa477('0x23')](handleEntityNotFound(_0x240ad9,null))['then'](respondWithResult(_0x240ad9,null))[_0xa477('0x41')](handleError(_0x240ad9,null));};exports[_0xa477('0x47')]=function(_0xeacd33,_0x545410){return db[_0xa477('0x29')][_0xa477('0x47')](_0xeacd33['body'],{})[_0xa477('0x23')](respondWithResult(_0x545410,0xc9))[_0xa477('0x41')](handleError(_0x545410,null));};exports[_0xa477('0x21')]=function(_0x543a19,_0xcb8c41){if(_0x543a19['body']['id']){delete _0x543a19[_0xa477('0x48')]['id'];}return db['FreshdeskAccount'][_0xa477('0x46')]({'where':{'id':_0x543a19[_0xa477('0x43')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0xcb8c41,null))[_0xa477('0x23')](saveUpdates(_0x543a19['body'],null))[_0xa477('0x23')](respondWithResult(_0xcb8c41,null))[_0xa477('0x41')](handleError(_0xcb8c41,null));};exports[_0xa477('0x22')]=function(_0x59b17a,_0x4fb38b){return db[_0xa477('0x29')][_0xa477('0x46')]({'where':{'id':_0x59b17a[_0xa477('0x43')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x4fb38b,null))[_0xa477('0x23')](removeEntity(_0x4fb38b,null))[_0xa477('0x41')](handleError(_0x4fb38b,null));};exports[_0xa477('0x49')]=function(_0x3f03c0,_0x596eb5,_0x53e55e){var _0x4052e0={};var _0x16f491={};var _0x2c1d27;var _0xadf7b9;return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x3f03c0['params']['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x596eb5,null))[_0xa477('0x23')](function(_0x219417){if(_0x219417){_0x2c1d27=_0x219417;_0x16f491[_0xa477('0x2d')]=_[_0xa477('0x2f')](db[_0xa477('0x4b')][_0xa477('0x44')]);_0x16f491['query']=_['keys'](_0x3f03c0[_0xa477('0x2e')]);_0x16f491[_0xa477('0x30')]=_[_0xa477('0x31')](_0x16f491['model'],_0x16f491[_0xa477('0x2e')]);_0x4052e0[_0xa477('0x32')]=_[_0xa477('0x31')](_0x16f491['model'],qs[_0xa477('0x33')](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x33')]));_0x4052e0[_0xa477('0x32')]=_0x4052e0[_0xa477('0x32')][_0xa477('0x45')]?_0x4052e0[_0xa477('0x32')]:_0x16f491[_0xa477('0x2d')];_0x4052e0['order']=qs['sort'](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x37')]);_0x4052e0[_0xa477('0x38')]=qs[_0xa477('0x30')](_['pick'](_0x3f03c0['query'],_0x16f491[_0xa477('0x30')]));if(_0x3f03c0[_0xa477('0x2e')][_0xa477('0x39')]){_0x4052e0[_0xa477('0x38')]=_['merge'](_0x4052e0[_0xa477('0x38')],{'$or':_['map'](_0x4052e0['attributes'],function(_0x460ccf){var _0x2e20ca={};_0x2e20ca[_0x460ccf]={'$like':'%'+_0x3f03c0[_0xa477('0x2e')]['filter']+'%'};return _0x2e20ca;})});}_0x4052e0=_[_0xa477('0x3a')]({},_0x4052e0,_0x3f03c0['options']);return _0x2c1d27[_0xa477('0x49')](_0x4052e0);}})['then'](function(_0x1a0b6b){if(_0x1a0b6b){_0xadf7b9=_0x1a0b6b[_0xa477('0x45')];if(!_0x3f03c0[_0xa477('0x2e')]['hasOwnProperty'](_0xa477('0x35'))){_0x4052e0[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x1c')]);_0x4052e0[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0x3f03c0[_0xa477('0x2e')]['offset']);}return _0x2c1d27[_0xa477('0x49')](_0x4052e0);}})[_0xa477('0x23')](function(_0x31cde3){if(_0x31cde3){return _0x31cde3?{'count':_0xadf7b9,'rows':_0x31cde3}:null;}})[_0xa477('0x23')](respondWithResult(_0x596eb5,null))['catch'](handleError(_0x596eb5,null));};exports[_0xa477('0x4c')]=function(_0x5a4eb2,_0x48189b,_0x3df3bf){if(_0x5a4eb2[_0xa477('0x48')]['id']){delete _0x5a4eb2['body']['id'];}return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x5a4eb2[_0xa477('0x43')]['id']}})['then'](handleEntityNotFound(_0x48189b,null))[_0xa477('0x23')](function(_0x578d64){if(_0x578d64){_0x5a4eb2[_0xa477('0x48')][_0xa477('0x4d')]=_0x578d64['id'];_0x5a4eb2[_0xa477('0x48')][_0xa477('0x4e')]=integrations[_0xa477('0x4f')](_0x5a4eb2['body']['channel'],_0x5a4eb2[_0xa477('0x48')][_0xa477('0x2b')]);_0x5a4eb2[_0xa477('0x48')]['Descriptions']=integrations[_0xa477('0x50')](_0x5a4eb2['body']['channel'],_0x5a4eb2[_0xa477('0x48')]['type']);return db['FreshdeskConfiguration']['create'](_0x5a4eb2[_0xa477('0x48')],{'include':[{'model':db[_0xa477('0x51')],'as':_0xa477('0x4e')},{'model':db[_0xa477('0x51')],'as':_0xa477('0x52')}]});}return null;})[_0xa477('0x23')](respondWithResult(_0x48189b,null))['catch'](handleError(_0x48189b,null));};exports[_0xa477('0x53')]=function(_0x3378a1,_0x1254fd,_0x4eb045){var _0x2b9139='';return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x3378a1['params']['id']},'attributes':['id','remoteUri','apiKey']})['then'](handleEntityNotFound(_0x1254fd,null))[_0xa477('0x23')](function(_0x452834){if(_0x452834){_0x2b9139=_0x452834[_0xa477('0x54')];var _0x1a48a4=_0x2b9139[_0xa477('0x55')](-0x1);if(_0x1a48a4==='/'){_0x2b9139=_0x2b9139[_0xa477('0x56')](0x0,_0x2b9139['lastIndexOf'](_0x1a48a4));}return rp({'method':_0xa477('0x57'),'uri':util['format'](_0xa477('0x58'),_0x2b9139,_0xa477('0x59')),'headers':{'Authorization':util[_0xa477('0x5a')](_0xa477('0x5b'),new Buffer(util[_0xa477('0x5a')](_0xa477('0x5c'),_0x452834[_0xa477('0x5d')]))[_0xa477('0x5e')](_0xa477('0x5f')))},'json':!![]});}})['then'](function(_0x16fcec){if(_0x16fcec){var _0x47be0a=[_0xa477('0x60'),'subject',_0xa477('0x61'),'description',_0xa477('0x17'),_0xa477('0x62'),_0xa477('0x63'),_0xa477('0x64'),'ticket_type',_0xa477('0x63'),'company'];_[_0xa477('0x65')](_0x16fcec,function(_0x3c8b35){return _0x47be0a['includes'](_0x3c8b35[_0xa477('0x25')])||!_0x3c8b35[_0xa477('0x66')]&&_0x3c8b35[_0xa477('0x2b')]!==_0xa477('0x67')&&_0x3c8b35['type']!==_0xa477('0x68');});return{'count':_0x16fcec[_0xa477('0x45')],'rows':_[_0xa477('0x28')](_0x16fcec,function(_0x4596ce){return{'id':_0x4596ce[_0xa477('0x25')],'name':_0x4596ce[_0xa477('0x69')],'custom':!_0x4596ce[_0xa477('0x66')],'options':_0x4596ce['choices']?_[_0xa477('0x28')](_0x4596ce[_0xa477('0x6a')],function(_0x7a28a7){return{'name':_[_0xa477('0x6b')](_0x7a28a7),'value':_0x7a28a7};}):[]};})};}})['then'](respondWithResult(_0x1254fd,null))[_0xa477('0x41')](function(_0x23dd79){var _0xa25710=_0x3378a1[_0xa477('0x2e')][_0xa477('0x6c')]?0x1f4:_0x23dd79[_0xa477('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xa477('0x53'),_0xa25710,JSON['stringify'](_0x23dd79));delete _0x23dd79['name'];if(_0xa25710===0x191){_0xa25710=0x190;}_0x1254fd[_0xa477('0x17')](_0xa25710)[_0xa477('0x26')](_0x3378a1[_0xa477('0x2e')][_0xa477('0x6c')]?{'message':_0xa477('0x6e'),'statusCode':_0x23dd79[_0xa477('0x6d')]}:_0x23dd79);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 5071f44..0a7d296 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 _0xaeec=['define','FreshdeskAccount','int_freshdesk_accounts','util','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xaeec,0x10b));var _0xcaee=function(_0xb40e72,_0x5f41e8){_0xb40e72=_0xb40e72-0x0;var _0x24da29=_0xaeec[_0xb40e72];return _0x24da29;};'use strict';var _=require('lodash');var util=require(_0xcaee('0x0'));var logger=require('../../config/logger')(_0xcaee('0x1'));var moment=require(_0xcaee('0x2'));var BPromise=require('bluebird');var rp=require(_0xcaee('0x3'));var fs=require('fs');var path=require(_0xcaee('0x4'));var rimraf=require(_0xcaee('0x5'));var config=require(_0xcaee('0x6'));var attributes=require(_0xcaee('0x7'));var integrations=require(_0xcaee('0x8'));module['exports']=function(_0x2baaab,_0x51effe){return _0x2baaab[_0xcaee('0x9')](_0xcaee('0xa'),attributes,{'tableName':_0xcaee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ba1=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2162e0,_0xd18181){var _0x162d05=function(_0x421403){while(--_0x421403){_0x2162e0['push'](_0x2162e0['shift']());}};_0x162d05(++_0xd18181);}(_0x5ba1,0x1d1));var _0x15ba=function(_0x13d4db,_0x1fdc98){_0x13d4db=_0x13d4db-0x0;var _0x149258=_0x5ba1[_0x13d4db];return _0x149258;};'use strict';var _=require(_0x15ba('0x0'));var util=require(_0x15ba('0x1'));var logger=require(_0x15ba('0x2'))('api');var moment=require('moment');var BPromise=require(_0x15ba('0x3'));var rp=require(_0x15ba('0x4'));var fs=require('fs');var path=require(_0x15ba('0x5'));var rimraf=require(_0x15ba('0x6'));var config=require(_0x15ba('0x7'));var attributes=require(_0x15ba('0x8'));var integrations=require(_0x15ba('0x9'));module[_0x15ba('0xa')]=function(_0x100c4c,_0x557e14){return _0x100c4c[_0x15ba('0xb')](_0x15ba('0xc'),attributes,{'tableName':_0x15ba('0xd'),'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 1538771..8108ffd 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 _0x5a78=['debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5a78,0x19b));var _0x85a7=function(_0x138d01,_0x2a2629){_0x138d01=_0x138d01-0x0;var _0x5b14ce=_0x5a78[_0x138d01];return _0x5b14ce;};'use strict';var _=require(_0x85a7('0x0'));var util=require(_0x85a7('0x1'));var moment=require(_0x85a7('0x2'));var BPromise=require(_0x85a7('0x3'));var rs=require(_0x85a7('0x4'));var fs=require('fs');var Redis=require(_0x85a7('0x5'));var db=require(_0x85a7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x85a7('0x7'))(_0x85a7('0x8'));var config=require(_0x85a7('0x9'));var jayson=require(_0x85a7('0xa'));var client=jayson[_0x85a7('0xb')][_0x85a7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x559dc4,_0x984ed4,_0x377ccb){return new BPromise(function(_0x371901,_0x6c7207){return client[_0x85a7('0xd')](_0x559dc4,_0x377ccb)[_0x85a7('0xe')](function(_0x5eb30a){logger[_0x85a7('0xf')](_0x85a7('0x10'),_0x984ed4,_0x85a7('0x11'));logger[_0x85a7('0x12')](_0x85a7('0x13'),_0x984ed4,_0x85a7('0x11'),JSON[_0x85a7('0x14')](_0x5eb30a));if(_0x5eb30a[_0x85a7('0x15')]){if(_0x5eb30a[_0x85a7('0x15')][_0x85a7('0x16')]===0x1f4){logger[_0x85a7('0x15')](_0x85a7('0x10'),_0x984ed4,_0x5eb30a['error'][_0x85a7('0x17')]);return _0x6c7207(_0x5eb30a[_0x85a7('0x15')][_0x85a7('0x17')]);}logger[_0x85a7('0x15')](_0x85a7('0x10'),_0x984ed4,_0x5eb30a[_0x85a7('0x15')][_0x85a7('0x17')]);return _0x371901(_0x5eb30a[_0x85a7('0x15')]['message']);}else{logger[_0x85a7('0xf')](_0x85a7('0x10'),_0x984ed4,'request\x20sent');_0x371901(_0x5eb30a[_0x85a7('0x18')][_0x85a7('0x17')]);}})['catch'](function(_0xb7cb38){logger['error'](_0x85a7('0x10'),_0x984ed4,_0xb7cb38);_0x6c7207(_0xb7cb38);});});}exports[_0x85a7('0x19')]=function(_0x95e275){var _0x3ba1a5=this;return new Promise(function(_0x4c8517,_0x361ed4){return db[_0x85a7('0x1a')][_0x85a7('0x1b')]({'raw':_0x95e275[_0x85a7('0x1c')]?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x1d')]===undefined?!![]:![]:!![],'where':_0x95e275['options']?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x1e')]||null:null,'attributes':_0x95e275['options']?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x1f')]||null:null,'limit':_0x95e275['options']?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x20')]||null:null,'include':_0x95e275[_0x85a7('0x1c')]?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x95e275['options'][_0x85a7('0x21')],function(_0x570f38){return{'model':db[_0x570f38[_0x85a7('0x23')]],'as':_0x570f38['as'],'attributes':_0x570f38[_0x85a7('0x1f')],'include':_0x570f38[_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x570f38['include'],function(_0x5423c5){return{'model':db[_0x5423c5[_0x85a7('0x23')]],'as':_0x5423c5['as'],'attributes':_0x5423c5['attributes'],'include':_0x5423c5[_0x85a7('0x21')]?_['map'](_0x5423c5['include'],function(_0x2d0003){return{'model':db[_0x2d0003['model']],'as':_0x2d0003['as'],'attributes':_0x2d0003[_0x85a7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34aae7){logger[_0x85a7('0xf')](_0x85a7('0x19'),_0x95e275);logger[_0x85a7('0x12')](_0x85a7('0x19'),_0x95e275,JSON[_0x85a7('0x14')](_0x34aae7));_0x4c8517(_0x34aae7);})[_0x85a7('0x24')](function(_0x3550b5){logger[_0x85a7('0x15')](_0x85a7('0x19'),_0x3550b5['message'],_0x95e275);_0x361ed4(_0x3ba1a5[_0x85a7('0x15')](0x1f4,_0x3550b5['message']));});});};exports[_0x85a7('0x25')]=function(_0x554175){var _0x48877e=this;return new Promise(function(_0x4030c2,_0x99be5a){return db[_0x85a7('0x1a')][_0x85a7('0x26')]({'raw':_0x554175[_0x85a7('0x1c')]?_0x554175[_0x85a7('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x554175['options']?_0x554175[_0x85a7('0x1c')][_0x85a7('0x1e')]||null:null,'attributes':_0x554175[_0x85a7('0x1c')]?_0x554175[_0x85a7('0x1c')]['attributes']||null:null,'include':_0x554175[_0x85a7('0x1c')]?_0x554175['options'][_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x554175[_0x85a7('0x1c')]['include'],function(_0x1fe1e5){return{'model':db[_0x1fe1e5[_0x85a7('0x23')]],'as':_0x1fe1e5['as'],'attributes':_0x1fe1e5[_0x85a7('0x1f')],'include':_0x1fe1e5[_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x1fe1e5['include'],function(_0x39e7ac){return{'model':db[_0x39e7ac[_0x85a7('0x23')]],'as':_0x39e7ac['as'],'attributes':_0x39e7ac['attributes'],'include':_0x39e7ac[_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x39e7ac[_0x85a7('0x21')],function(_0x4b443a){return{'model':db[_0x4b443a[_0x85a7('0x23')]],'as':_0x4b443a['as'],'attributes':_0x4b443a[_0x85a7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x85a7('0xe')](function(_0x4def00){logger[_0x85a7('0xf')](_0x85a7('0x25'),_0x554175);logger[_0x85a7('0x12')](_0x85a7('0x25'),_0x554175,JSON['stringify'](_0x4def00));_0x4030c2(_0x4def00);})[_0x85a7('0x24')](function(_0x2f39b9){logger[_0x85a7('0x15')](_0x85a7('0x25'),_0x2f39b9['message'],_0x554175);_0x99be5a(_0x48877e[_0x85a7('0x15')](0x1f4,_0x2f39b9[_0x85a7('0x17')]));});});}; \ No newline at end of file +var _0x8530=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','limit','map','include','model','attributes','then','GetFreshdeskAccount','ShowFreshdeskAccount','where','lodash','util'];(function(_0x28d624,_0xbf2056){var _0x198bc7=function(_0x67bf81){while(--_0x67bf81){_0x28d624['push'](_0x28d624['shift']());}};_0x198bc7(++_0xbf2056);}(_0x8530,0x1ae));var _0x0853=function(_0x1abf76,_0x5112c1){_0x1abf76=_0x1abf76-0x0;var _0x5e6837=_0x8530[_0x1abf76];return _0x5e6837;};'use strict';var _=require(_0x0853('0x0'));var util=require(_0x0853('0x1'));var moment=require(_0x0853('0x2'));var BPromise=require('bluebird');var rs=require(_0x0853('0x3'));var fs=require('fs');var Redis=require(_0x0853('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0853('0x5'));var logger=require(_0x0853('0x6'))('rpc');var config=require(_0x0853('0x7'));var jayson=require(_0x0853('0x8'));var client=jayson[_0x0853('0x9')][_0x0853('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34899b,_0x1f6168,_0x16fa40){return new BPromise(function(_0xfc0790,_0x4da1de){return client[_0x0853('0xb')](_0x34899b,_0x16fa40)['then'](function(_0x4d9516){logger[_0x0853('0xc')](_0x0853('0xd'),_0x1f6168,_0x0853('0xe'));logger[_0x0853('0xf')](_0x0853('0x10'),_0x1f6168,'request\x20sent',JSON[_0x0853('0x11')](_0x4d9516));if(_0x4d9516[_0x0853('0x12')]){if(_0x4d9516[_0x0853('0x12')][_0x0853('0x13')]===0x1f4){logger[_0x0853('0x12')](_0x0853('0xd'),_0x1f6168,_0x4d9516[_0x0853('0x12')][_0x0853('0x14')]);return _0x4da1de(_0x4d9516[_0x0853('0x12')][_0x0853('0x14')]);}logger[_0x0853('0x12')](_0x0853('0xd'),_0x1f6168,_0x4d9516[_0x0853('0x12')]['message']);return _0xfc0790(_0x4d9516[_0x0853('0x12')]['message']);}else{logger[_0x0853('0xc')](_0x0853('0xd'),_0x1f6168,'request\x20sent');_0xfc0790(_0x4d9516[_0x0853('0x15')][_0x0853('0x14')]);}})[_0x0853('0x16')](function(_0x4d2812){logger[_0x0853('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x1f6168,_0x4d2812);_0x4da1de(_0x4d2812);});});}exports['GetFreshdeskAccount']=function(_0x40bdef){var _0x4e64c4=this;return new Promise(function(_0x4de6e9,_0x191599){return db[_0x0853('0x17')][_0x0853('0x18')]({'raw':_0x40bdef[_0x0853('0x19')]?_0x40bdef[_0x0853('0x19')][_0x0853('0x1a')]===undefined?!![]:![]:!![],'where':_0x40bdef[_0x0853('0x19')]?_0x40bdef[_0x0853('0x19')]['where']||null:null,'attributes':_0x40bdef[_0x0853('0x19')]?_0x40bdef['options']['attributes']||null:null,'limit':_0x40bdef[_0x0853('0x19')]?_0x40bdef[_0x0853('0x19')][_0x0853('0x1b')]||null:null,'include':_0x40bdef[_0x0853('0x19')]?_0x40bdef[_0x0853('0x19')]['include']?_[_0x0853('0x1c')](_0x40bdef['options'][_0x0853('0x1d')],function(_0x51e0bd){return{'model':db[_0x51e0bd[_0x0853('0x1e')]],'as':_0x51e0bd['as'],'attributes':_0x51e0bd[_0x0853('0x1f')],'include':_0x51e0bd[_0x0853('0x1d')]?_[_0x0853('0x1c')](_0x51e0bd[_0x0853('0x1d')],function(_0x2d12e9){return{'model':db[_0x2d12e9[_0x0853('0x1e')]],'as':_0x2d12e9['as'],'attributes':_0x2d12e9['attributes'],'include':_0x2d12e9['include']?_[_0x0853('0x1c')](_0x2d12e9[_0x0853('0x1d')],function(_0x102f47){return{'model':db[_0x102f47[_0x0853('0x1e')]],'as':_0x102f47['as'],'attributes':_0x102f47['attributes']};}):[]};}):[]};}):[]:[]})[_0x0853('0x20')](function(_0x3596dc){logger[_0x0853('0xc')](_0x0853('0x21'),_0x40bdef);logger[_0x0853('0xf')](_0x0853('0x21'),_0x40bdef,JSON[_0x0853('0x11')](_0x3596dc));_0x4de6e9(_0x3596dc);})[_0x0853('0x16')](function(_0x4bb23c){logger[_0x0853('0x12')]('GetFreshdeskAccount',_0x4bb23c[_0x0853('0x14')],_0x40bdef);_0x191599(_0x4e64c4[_0x0853('0x12')](0x1f4,_0x4bb23c['message']));});});};exports[_0x0853('0x22')]=function(_0x23369f){var _0x68a96b=this;return new Promise(function(_0x505b6c,_0x3e3adb){return db[_0x0853('0x17')]['find']({'raw':_0x23369f[_0x0853('0x19')]?_0x23369f[_0x0853('0x19')][_0x0853('0x1a')]===undefined?!![]:![]:!![],'where':_0x23369f['options']?_0x23369f[_0x0853('0x19')][_0x0853('0x23')]||null:null,'attributes':_0x23369f[_0x0853('0x19')]?_0x23369f['options'][_0x0853('0x1f')]||null:null,'include':_0x23369f[_0x0853('0x19')]?_0x23369f['options']['include']?_['map'](_0x23369f[_0x0853('0x19')][_0x0853('0x1d')],function(_0x51c04d){return{'model':db[_0x51c04d['model']],'as':_0x51c04d['as'],'attributes':_0x51c04d[_0x0853('0x1f')],'include':_0x51c04d[_0x0853('0x1d')]?_[_0x0853('0x1c')](_0x51c04d[_0x0853('0x1d')],function(_0x27d0de){return{'model':db[_0x27d0de[_0x0853('0x1e')]],'as':_0x27d0de['as'],'attributes':_0x27d0de[_0x0853('0x1f')],'include':_0x27d0de[_0x0853('0x1d')]?_[_0x0853('0x1c')](_0x27d0de[_0x0853('0x1d')],function(_0x460b86){return{'model':db[_0x460b86[_0x0853('0x1e')]],'as':_0x460b86['as'],'attributes':_0x460b86[_0x0853('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0853('0x20')](function(_0x15f5d5){logger['info'](_0x0853('0x22'),_0x23369f);logger[_0x0853('0xf')]('ShowFreshdeskAccount',_0x23369f,JSON[_0x0853('0x11')](_0x15f5d5));_0x505b6c(_0x15f5d5);})[_0x0853('0x16')](function(_0x16b842){logger[_0x0853('0x12')]('ShowFreshdeskAccount',_0x16b842[_0x0853('0x14')],_0x23369f);_0x3e3adb(_0x68a96b['error'](0x1f4,_0x16b842['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index a40290d..3b7a5b0 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 _0xc265=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','getTags','post','create','/:id/tags','put','update','/:id','destroy','exports','multer','path'];(function(_0xd6a247,_0x1279bd){var _0x34887d=function(_0x3b509d){while(--_0x3b509d){_0xd6a247['push'](_0xd6a247['shift']());}};_0x34887d(++_0x1279bd);}(_0xc265,0x1d2));var _0x5c26=function(_0x775017,_0x39daa8){_0x775017=_0x775017-0x0;var _0x2459f0=_0xc265[_0x775017];return _0x2459f0;};'use strict';var multer=require(_0x5c26('0x0'));var util=require('util');var path=require(_0x5c26('0x1'));var timeout=require(_0x5c26('0x2'));var express=require(_0x5c26('0x3'));var router=express[_0x5c26('0x4')]();var fs_extra=require(_0x5c26('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5c26('0x6'));var config=require(_0x5c26('0x7'));var controller=require(_0x5c26('0x8'));router[_0x5c26('0x9')]('/',auth[_0x5c26('0xa')](),controller[_0x5c26('0xb')]);router['get']('/:id',auth[_0x5c26('0xa')](),controller[_0x5c26('0xc')]);router[_0x5c26('0x9')](_0x5c26('0xd'),auth[_0x5c26('0xa')](),controller[_0x5c26('0xe')]);router[_0x5c26('0x9')](_0x5c26('0xf'),auth[_0x5c26('0xa')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x5c26('0xa')](),controller[_0x5c26('0x10')]);router[_0x5c26('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x5c26('0x11')]);router[_0x5c26('0x12')]('/',auth[_0x5c26('0xa')](),controller[_0x5c26('0x13')]);router[_0x5c26('0x12')](_0x5c26('0x14'),auth[_0x5c26('0xa')](),controller['setTags']);router[_0x5c26('0x15')]('/:id',auth[_0x5c26('0xa')](),controller[_0x5c26('0x16')]);router['delete'](_0x5c26('0x17'),auth[_0x5c26('0xa')](),controller[_0x5c26('0x18')]);module[_0x5c26('0x19')]=router; \ No newline at end of file +var _0x12ae=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','create','post','setTags','update'];(function(_0x57a98d,_0x472f08){var _0x553630=function(_0x542b76){while(--_0x542b76){_0x57a98d['push'](_0x57a98d['shift']());}};_0x553630(++_0x472f08);}(_0x12ae,0x17d));var _0xe12a=function(_0x2aa0e6,_0x4880fa){_0x2aa0e6=_0x2aa0e6-0x0;var _0x2e45ff=_0x12ae[_0x2aa0e6];return _0x2e45ff;};'use strict';var multer=require(_0xe12a('0x0'));var util=require(_0xe12a('0x1'));var path=require(_0xe12a('0x2'));var timeout=require(_0xe12a('0x3'));var express=require(_0xe12a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe12a('0x5'));var config=require(_0xe12a('0x6'));var controller=require(_0xe12a('0x7'));router['get']('/',auth[_0xe12a('0x8')](),controller[_0xe12a('0x9')]);router[_0xe12a('0xa')](_0xe12a('0xb'),auth['isAuthenticated'](),controller[_0xe12a('0xc')]);router[_0xe12a('0xa')](_0xe12a('0xd'),auth[_0xe12a('0x8')](),controller[_0xe12a('0xe')]);router[_0xe12a('0xa')](_0xe12a('0xf'),auth[_0xe12a('0x8')](),controller[_0xe12a('0x10')]);router[_0xe12a('0xa')]('/:id/descriptions',auth[_0xe12a('0x8')](),controller[_0xe12a('0x11')]);router[_0xe12a('0xa')](_0xe12a('0x12'),auth[_0xe12a('0x8')](),controller[_0xe12a('0x13')]);router['post']('/',auth[_0xe12a('0x8')](),controller[_0xe12a('0x14')]);router[_0xe12a('0x15')](_0xe12a('0x12'),auth[_0xe12a('0x8')](),controller[_0xe12a('0x16')]);router['put'](_0xe12a('0xb'),auth['isAuthenticated'](),controller[_0xe12a('0x17')]);router[_0xe12a('0x18')](_0xe12a('0xb'),auth[_0xe12a('0x8')](),controller[_0xe12a('0x19')]);module[_0xe12a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d3db04c..275960b 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 _0xb5b3=['STRING','exports'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0xb5b3,0x1e7));var _0x3b5b=function(_0x56dfa5,_0xfaa178){_0x56dfa5=_0x56dfa5-0x0;var _0x5eb3e2=_0xb5b3[_0x56dfa5];return _0x5eb3e2;};'use strict';var Sequelize=require('sequelize');module[_0x3b5b('0x0')]={'name':{'type':Sequelize[_0x3b5b('0x1')]},'description':{'type':Sequelize[_0x3b5b('0x1')]}}; \ No newline at end of file +var _0x5375=['exports','STRING'];(function(_0x59803f,_0x4c9f86){var _0x22929d=function(_0x24e1ce){while(--_0x24e1ce){_0x59803f['push'](_0x59803f['shift']());}};_0x22929d(++_0x4c9f86);}(_0x5375,0x17c));var _0x5537=function(_0x3a905d,_0x1ca0d6){_0x3a905d=_0x3a905d-0x0;var _0x4889cd=_0x5375[_0x3a905d];return _0x4889cd;};'use strict';var Sequelize=require('sequelize');module[_0x5537('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5537('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 50373b5..c29d3eb 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 _0x8512=['setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','index','map','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','FreshdeskConfiguration','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','findOne','params','FreshdeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags'];(function(_0x5a7cfe,_0x25f9cf){var _0x5079bd=function(_0x4649a2){while(--_0x4649a2){_0x5a7cfe['push'](_0x5a7cfe['shift']());}};_0x5079bd(++_0x25f9cf);}(_0x8512,0xaa));var _0x2851=function(_0x54a785,_0x161c15){_0x54a785=_0x54a785-0x0;var _0xb689e9=_0x8512[_0x54a785];return _0xb689e9;};'use strict';var emlformat=require(_0x2851('0x0'));var rimraf=require(_0x2851('0x1'));var zipdir=require(_0x2851('0x2'));var jsonpatch=require(_0x2851('0x3'));var rp=require(_0x2851('0x4'));var moment=require(_0x2851('0x5'));var BPromise=require(_0x2851('0x6'));var Mustache=require(_0x2851('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2851('0x8'));var fs=require('fs');var fs_extra=require(_0x2851('0x9'));var _=require('lodash');var squel=require(_0x2851('0xa'));var crypto=require(_0x2851('0xb'));var jsforce=require(_0x2851('0xc'));var deskjs=require(_0x2851('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2851('0xe'));var Papa=require(_0x2851('0xf'));var Redis=require(_0x2851('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2851('0x11'));var as=require(_0x2851('0x12'));var hardwareService=require(_0x2851('0x13'));var logger=require(_0x2851('0x14'))(_0x2851('0x15'));var utils=require('../../config/utils');var config=require(_0x2851('0x16'));var licenseUtil=require(_0x2851('0x17'));var db=require(_0x2851('0x18'))['db'];function respondWithStatusCode(_0x2cbc25,_0x263639){_0x263639=_0x263639||0xcc;return function(_0x15ba09){if(_0x15ba09){return _0x2cbc25[_0x2851('0x19')](_0x263639);}return _0x2cbc25[_0x2851('0x1a')](_0x263639)[_0x2851('0x1b')]();};}function respondWithResult(_0x234dcb,_0x29604d){_0x29604d=_0x29604d||0xc8;return function(_0x30a697){if(_0x30a697){return _0x234dcb['status'](_0x29604d)['json'](_0x30a697);}};}function respondWithFilteredResult(_0x162ccd,_0x1c043a){return function(_0xf8fdc4){if(_0xf8fdc4){var _0x36eb23=typeof _0x1c043a['offset']==='undefined'&&typeof _0x1c043a['limit']==='undefined';var _0x375c23=_0xf8fdc4[_0x2851('0x1c')];var _0x2d33bd=_0x36eb23?0x0:_0x1c043a['offset'];var _0x28d95c=_0x36eb23?_0xf8fdc4[_0x2851('0x1c')]:_0x1c043a[_0x2851('0x1d')]+_0x1c043a['limit'];var _0x4ea32c;if(_0x28d95c>=_0x375c23){_0x28d95c=_0x375c23;_0x4ea32c=0xc8;}else{_0x4ea32c=0xce;}_0x162ccd[_0x2851('0x1a')](_0x4ea32c);return _0x162ccd[_0x2851('0x1e')](_0x2851('0x1f'),_0x2d33bd+'-'+_0x28d95c+'/'+_0x375c23)[_0x2851('0x20')](_0xf8fdc4);}return null;};}function patchUpdates(_0x400ffe){return function(_0x4a0edf){try{jsonpatch[_0x2851('0x21')](_0x4a0edf,_0x400ffe,!![]);}catch(_0x1a0de6){return BPromise[_0x2851('0x22')](_0x1a0de6);}return _0x4a0edf['save']();};}function saveUpdates(_0x3114ca,_0xd6a7b7){return function(_0x3a246a){if(_0x3a246a){return _0x3a246a['update'](_0x3114ca)[_0x2851('0x23')](function(_0x2cf068){return _0x2cf068;});}return null;};}function removeEntity(_0xcecc88,_0x1e129e){return function(_0x16f126){if(_0x16f126){return _0x16f126[_0x2851('0x24')]()[_0x2851('0x23')](function(){_0xcecc88[_0x2851('0x1a')](0xcc)[_0x2851('0x1b')]();});}};}function handleEntityNotFound(_0x2e9ca6,_0x3ab7b9){return function(_0x376a14){if(!_0x376a14){_0x2e9ca6[_0x2851('0x19')](0x194);}return _0x376a14;};}function handleError(_0x32c52b,_0x4fb6a8){_0x4fb6a8=_0x4fb6a8||0x1f4;return function(_0xe6b415){logger[_0x2851('0x25')](_0xe6b415[_0x2851('0x26')]);if(_0xe6b415[_0x2851('0x27')]){delete _0xe6b415[_0x2851('0x27')];}_0x32c52b[_0x2851('0x1a')](_0x4fb6a8)[_0x2851('0x28')](_0xe6b415);};}exports[_0x2851('0x29')]=function(_0x5c7fce,_0x89b203){var _0x218abc={},_0x5d7a09={},_0x415d7d={'count':0x0,'rows':[]};var _0x142592=_[_0x2851('0x2a')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x5f1475){return{'name':_0x5f1475['fieldName'],'type':_0x5f1475[_0x2851('0x2b')]['key']};});_0x5d7a09[_0x2851('0x2c')]=_[_0x2851('0x2a')](_0x142592,_0x2851('0x27'));_0x5d7a09[_0x2851('0x2d')]=_[_0x2851('0x2e')](_0x5c7fce['query']);_0x5d7a09[_0x2851('0x2f')]=_['intersection'](_0x5d7a09[_0x2851('0x2c')],_0x5d7a09[_0x2851('0x2d')]);_0x218abc['attributes']=_[_0x2851('0x30')](_0x5d7a09['model'],qs[_0x2851('0x31')](_0x5c7fce[_0x2851('0x2d')][_0x2851('0x31')]));_0x218abc[_0x2851('0x32')]=_0x218abc['attributes'][_0x2851('0x33')]?_0x218abc[_0x2851('0x32')]:_0x5d7a09[_0x2851('0x2c')];if(!_0x5c7fce[_0x2851('0x2d')]['hasOwnProperty'](_0x2851('0x34'))){_0x218abc['limit']=qs[_0x2851('0x35')](_0x5c7fce['query'][_0x2851('0x35')]);_0x218abc['offset']=qs[_0x2851('0x1d')](_0x5c7fce[_0x2851('0x2d')][_0x2851('0x1d')]);}_0x218abc[_0x2851('0x36')]=qs['sort'](_0x5c7fce[_0x2851('0x2d')][_0x2851('0x37')]);_0x218abc[_0x2851('0x38')]=qs[_0x2851('0x2f')](_[_0x2851('0x39')](_0x5c7fce[_0x2851('0x2d')],_0x5d7a09[_0x2851('0x2f')]),_0x142592);if(_0x5c7fce[_0x2851('0x2d')]['filter']){_0x218abc['where']=_['merge'](_0x218abc['where'],{'$or':_[_0x2851('0x2a')](_0x142592,function(_0x598c40){if(_0x598c40['type']!==_0x2851('0x3a')){var _0x3f67dc={};_0x3f67dc[_0x598c40[_0x2851('0x27')]]={'$like':'%'+_0x5c7fce[_0x2851('0x2d')][_0x2851('0x3b')]+'%'};return _0x3f67dc;}})});}_0x218abc=_[_0x2851('0x3c')]({},_0x218abc,_0x5c7fce[_0x2851('0x3d')]);var _0x3f0329={'where':_0x218abc['where']};return db[_0x2851('0x3e')][_0x2851('0x1c')](_0x3f0329)[_0x2851('0x23')](function(_0x4be7a2){_0x415d7d['count']=_0x4be7a2;if(_0x5c7fce[_0x2851('0x2d')][_0x2851('0x3f')]){_0x218abc[_0x2851('0x40')]=[{'all':!![]}];}return db[_0x2851('0x3e')][_0x2851('0x41')](_0x218abc);})[_0x2851('0x23')](function(_0x499204){_0x415d7d[_0x2851('0x42')]=_0x499204;return _0x415d7d;})[_0x2851('0x23')](respondWithFilteredResult(_0x89b203,_0x218abc))[_0x2851('0x43')](handleError(_0x89b203,null));};exports[_0x2851('0x44')]=function(_0x45026e,_0x1b968d){var _0x2f1087={'raw':![],'where':{'id':_0x45026e['params']['id']}},_0x46614a={};_0x46614a[_0x2851('0x2c')]=_[_0x2851('0x2e')](db['FreshdeskConfiguration'][_0x2851('0x45')]);_0x46614a['query']=_[_0x2851('0x2e')](_0x45026e[_0x2851('0x2d')]);_0x46614a[_0x2851('0x2f')]=_[_0x2851('0x30')](_0x46614a[_0x2851('0x2c')],_0x46614a[_0x2851('0x2d')]);_0x2f1087['attributes']=_['intersection'](_0x46614a[_0x2851('0x2c')],qs[_0x2851('0x31')](_0x45026e[_0x2851('0x2d')][_0x2851('0x31')]));_0x2f1087[_0x2851('0x32')]=_0x2f1087[_0x2851('0x32')]['length']?_0x2f1087[_0x2851('0x32')]:_0x46614a['model'];if(_0x45026e[_0x2851('0x2d')][_0x2851('0x3f')]){_0x2f1087[_0x2851('0x40')]=[{'all':!![]}];}_0x2f1087=_[_0x2851('0x3c')]({},_0x2f1087,_0x45026e[_0x2851('0x3d')]);return db[_0x2851('0x3e')]['find'](_0x2f1087)['then'](handleEntityNotFound(_0x1b968d,null))[_0x2851('0x23')](respondWithResult(_0x1b968d,null))[_0x2851('0x43')](handleError(_0x1b968d,null));};exports[_0x2851('0x46')]=function(_0x1f6e3c,_0x2b324){return db['FreshdeskConfiguration'][_0x2851('0x46')](_0x1f6e3c[_0x2851('0x47')],{})[_0x2851('0x23')](respondWithResult(_0x2b324,0xc9))[_0x2851('0x43')](handleError(_0x2b324,null));};exports['update']=function(_0x2d5e3b,_0x5213fa){if(_0x2d5e3b['body']['id']){delete _0x2d5e3b[_0x2851('0x47')]['id'];}return db[_0x2851('0x3e')]['find']({'where':{'id':_0x2d5e3b['params']['id']}})[_0x2851('0x23')](handleEntityNotFound(_0x5213fa,null))[_0x2851('0x23')](saveUpdates(_0x2d5e3b['body'],null))['then'](respondWithResult(_0x5213fa,null))['catch'](handleError(_0x5213fa,null));};exports[_0x2851('0x24')]=function(_0x57fa47,_0x611592){return db[_0x2851('0x3e')][_0x2851('0x48')]({'where':{'id':_0x57fa47['params']['id']}})[_0x2851('0x23')](handleEntityNotFound(_0x611592,null))[_0x2851('0x23')](removeEntity(_0x611592,null))[_0x2851('0x43')](handleError(_0x611592,null));};exports['getFields']=function(_0x3b59b5,_0x3dfa83,_0x2d7aa5){var _0x3ae19c={};var _0x32adb2={};var _0x105c91;var _0x17e13c;return db[_0x2851('0x3e')][_0x2851('0x49')]({'where':{'id':_0x3b59b5[_0x2851('0x4a')]['id']}})[_0x2851('0x23')](handleEntityNotFound(_0x3dfa83,null))[_0x2851('0x23')](function(_0x29c01e){if(_0x29c01e){_0x105c91=_0x29c01e;_0x32adb2[_0x2851('0x2c')]=_[_0x2851('0x2e')](db[_0x2851('0x4b')][_0x2851('0x45')]);_0x32adb2[_0x2851('0x2d')]=_['keys'](_0x3b59b5[_0x2851('0x2d')]);_0x32adb2[_0x2851('0x2f')]=_[_0x2851('0x30')](_0x32adb2[_0x2851('0x2c')],_0x32adb2['query']);_0x3ae19c[_0x2851('0x32')]=_[_0x2851('0x30')](_0x32adb2[_0x2851('0x2c')],qs[_0x2851('0x31')](_0x3b59b5[_0x2851('0x2d')][_0x2851('0x31')]));_0x3ae19c[_0x2851('0x32')]=_0x3ae19c[_0x2851('0x32')][_0x2851('0x33')]?_0x3ae19c[_0x2851('0x32')]:_0x32adb2[_0x2851('0x2c')];_0x3ae19c[_0x2851('0x36')]=qs[_0x2851('0x37')](_0x3b59b5[_0x2851('0x2d')][_0x2851('0x37')]);_0x3ae19c[_0x2851('0x38')]=qs[_0x2851('0x2f')](_['pick'](_0x3b59b5[_0x2851('0x2d')],_0x32adb2[_0x2851('0x2f')]));if(_0x3b59b5[_0x2851('0x2d')][_0x2851('0x3b')]){_0x3ae19c[_0x2851('0x38')]=_[_0x2851('0x3c')](_0x3ae19c['where'],{'$or':_[_0x2851('0x2a')](_0x3ae19c['attributes'],function(_0x517e31){var _0x38fba5={};_0x38fba5[_0x517e31]={'$like':'%'+_0x3b59b5[_0x2851('0x2d')][_0x2851('0x3b')]+'%'};return _0x38fba5;})});}_0x3ae19c=_['merge']({},_0x3ae19c,_0x3b59b5[_0x2851('0x3d')]);return _0x105c91[_0x2851('0x4c')](_0x3ae19c);}})['then'](function(_0x569e71){if(_0x569e71){_0x17e13c=_0x569e71[_0x2851('0x33')];if(!_0x3b59b5[_0x2851('0x2d')][_0x2851('0x4d')](_0x2851('0x34'))){_0x3ae19c[_0x2851('0x35')]=qs[_0x2851('0x35')](_0x3b59b5['query']['limit']);_0x3ae19c[_0x2851('0x1d')]=qs[_0x2851('0x1d')](_0x3b59b5[_0x2851('0x2d')][_0x2851('0x1d')]);}return _0x105c91[_0x2851('0x4c')](_0x3ae19c);}})[_0x2851('0x23')](function(_0x14e35b){if(_0x14e35b){return _0x14e35b?{'count':_0x17e13c,'rows':_0x14e35b}:null;}})[_0x2851('0x23')](respondWithResult(_0x3dfa83,null))[_0x2851('0x43')](handleError(_0x3dfa83,null));};exports[_0x2851('0x4e')]=function(_0x2311ef,_0x47ca6e,_0x519ec3){var _0x56bacf={};var _0x5a504f={};var _0x45823c;var _0x3f163f;return db[_0x2851('0x3e')]['findOne']({'where':{'id':_0x2311ef[_0x2851('0x4a')]['id']}})[_0x2851('0x23')](handleEntityNotFound(_0x47ca6e,null))[_0x2851('0x23')](function(_0x2c65ba){if(_0x2c65ba){_0x45823c=_0x2c65ba;_0x5a504f[_0x2851('0x2c')]=_['keys'](db[_0x2851('0x4b')][_0x2851('0x45')]);_0x5a504f[_0x2851('0x2d')]=_['keys'](_0x2311ef['query']);_0x5a504f[_0x2851('0x2f')]=_[_0x2851('0x30')](_0x5a504f[_0x2851('0x2c')],_0x5a504f[_0x2851('0x2d')]);_0x56bacf[_0x2851('0x32')]=_['intersection'](_0x5a504f['model'],qs[_0x2851('0x31')](_0x2311ef['query'][_0x2851('0x31')]));_0x56bacf[_0x2851('0x32')]=_0x56bacf[_0x2851('0x32')][_0x2851('0x33')]?_0x56bacf[_0x2851('0x32')]:_0x5a504f[_0x2851('0x2c')];_0x56bacf[_0x2851('0x36')]=qs[_0x2851('0x37')](_0x2311ef['query'][_0x2851('0x37')]);_0x56bacf['where']=qs[_0x2851('0x2f')](_[_0x2851('0x39')](_0x2311ef[_0x2851('0x2d')],_0x5a504f['filters']));if(_0x2311ef[_0x2851('0x2d')][_0x2851('0x3b')]){_0x56bacf[_0x2851('0x38')]=_[_0x2851('0x3c')](_0x56bacf[_0x2851('0x38')],{'$or':_[_0x2851('0x2a')](_0x56bacf['attributes'],function(_0x174e81){var _0x2d8b91={};_0x2d8b91[_0x174e81]={'$like':'%'+_0x2311ef[_0x2851('0x2d')][_0x2851('0x3b')]+'%'};return _0x2d8b91;})});}_0x56bacf=_[_0x2851('0x3c')]({},_0x56bacf,_0x2311ef['options']);return _0x45823c[_0x2851('0x4e')](_0x56bacf);}})['then'](function(_0x5530c0){if(_0x5530c0){_0x3f163f=_0x5530c0[_0x2851('0x33')];if(!_0x2311ef[_0x2851('0x2d')][_0x2851('0x4d')](_0x2851('0x34'))){_0x56bacf['limit']=qs[_0x2851('0x35')](_0x2311ef[_0x2851('0x2d')][_0x2851('0x35')]);_0x56bacf[_0x2851('0x1d')]=qs[_0x2851('0x1d')](_0x2311ef[_0x2851('0x2d')][_0x2851('0x1d')]);}return _0x45823c[_0x2851('0x4e')](_0x56bacf);}})[_0x2851('0x23')](function(_0x52231b){if(_0x52231b){return _0x52231b?{'count':_0x3f163f,'rows':_0x52231b}:null;}})[_0x2851('0x23')](respondWithResult(_0x47ca6e,null))[_0x2851('0x43')](handleError(_0x47ca6e,null));};exports[_0x2851('0x4f')]=function(_0x26a25a,_0x5a612f,_0x2d0ce1){var _0x13442d={};var _0x29db86={};var _0x33110f;var _0x56429f;return db[_0x2851('0x3e')]['findOne']({'where':{'id':_0x26a25a[_0x2851('0x4a')]['id']}})[_0x2851('0x23')](handleEntityNotFound(_0x5a612f,null))[_0x2851('0x23')](function(_0x34e93a){if(_0x34e93a){_0x33110f=_0x34e93a;_0x29db86[_0x2851('0x2c')]=_[_0x2851('0x2e')](db['FreshdeskField'][_0x2851('0x45')]);_0x29db86[_0x2851('0x2d')]=_[_0x2851('0x2e')](_0x26a25a[_0x2851('0x2d')]);_0x29db86[_0x2851('0x2f')]=_[_0x2851('0x30')](_0x29db86['model'],_0x29db86['query']);_0x13442d[_0x2851('0x32')]=_[_0x2851('0x30')](_0x29db86[_0x2851('0x2c')],qs[_0x2851('0x31')](_0x26a25a[_0x2851('0x2d')][_0x2851('0x31')]));_0x13442d[_0x2851('0x32')]=_0x13442d[_0x2851('0x32')][_0x2851('0x33')]?_0x13442d['attributes']:_0x29db86[_0x2851('0x2c')];_0x13442d[_0x2851('0x36')]=qs[_0x2851('0x37')](_0x26a25a[_0x2851('0x2d')][_0x2851('0x37')]);_0x13442d[_0x2851('0x38')]=qs['filters'](_[_0x2851('0x39')](_0x26a25a[_0x2851('0x2d')],_0x29db86['filters']));if(_0x26a25a[_0x2851('0x2d')][_0x2851('0x3b')]){_0x13442d[_0x2851('0x38')]=_['merge'](_0x13442d['where'],{'$or':_['map'](_0x13442d[_0x2851('0x32')],function(_0xc955d3){var _0x2bf678={};_0x2bf678[_0xc955d3]={'$like':'%'+_0x26a25a[_0x2851('0x2d')][_0x2851('0x3b')]+'%'};return _0x2bf678;})});}_0x13442d=_[_0x2851('0x3c')]({},_0x13442d,_0x26a25a[_0x2851('0x3d')]);return _0x33110f[_0x2851('0x4f')](_0x13442d);}})['then'](function(_0x37bdf9){if(_0x37bdf9){_0x56429f=_0x37bdf9[_0x2851('0x33')];if(!_0x26a25a['query']['hasOwnProperty']('nolimit')){_0x13442d[_0x2851('0x35')]=qs[_0x2851('0x35')](_0x26a25a[_0x2851('0x2d')][_0x2851('0x35')]);_0x13442d[_0x2851('0x1d')]=qs[_0x2851('0x1d')](_0x26a25a[_0x2851('0x2d')][_0x2851('0x1d')]);}return _0x33110f[_0x2851('0x4f')](_0x13442d);}})[_0x2851('0x23')](function(_0x1bc8af){if(_0x1bc8af){return _0x1bc8af?{'count':_0x56429f,'rows':_0x1bc8af}:null;}})[_0x2851('0x23')](respondWithResult(_0x5a612f,null))[_0x2851('0x43')](handleError(_0x5a612f,null));};exports['getTags']=function(_0x2940b1,_0x4ddfa2,_0x224613){var _0x5a96e9={};var _0x5ca128={};var _0x2b00ef;var _0x532309;return db[_0x2851('0x3e')][_0x2851('0x49')]({'where':{'id':_0x2940b1[_0x2851('0x4a')]['id']}})[_0x2851('0x23')](handleEntityNotFound(_0x4ddfa2,null))[_0x2851('0x23')](function(_0x26a59c){if(_0x26a59c){_0x2b00ef=_0x26a59c;_0x5ca128['model']=_[_0x2851('0x2e')](db[_0x2851('0x50')][_0x2851('0x45')]);_0x5ca128[_0x2851('0x2d')]=_[_0x2851('0x2e')](_0x2940b1['query']);_0x5ca128[_0x2851('0x2f')]=_[_0x2851('0x30')](_0x5ca128[_0x2851('0x2c')],_0x5ca128[_0x2851('0x2d')]);_0x5a96e9[_0x2851('0x32')]=_[_0x2851('0x30')](_0x5ca128['model'],qs[_0x2851('0x31')](_0x2940b1['query'][_0x2851('0x31')]));_0x5a96e9[_0x2851('0x32')]=_0x5a96e9['attributes'][_0x2851('0x33')]?_0x5a96e9[_0x2851('0x32')]:_0x5ca128[_0x2851('0x2c')];_0x5a96e9['order']=qs[_0x2851('0x37')](_0x2940b1[_0x2851('0x2d')][_0x2851('0x37')]);_0x5a96e9[_0x2851('0x38')]=qs[_0x2851('0x2f')](_[_0x2851('0x39')](_0x2940b1[_0x2851('0x2d')],_0x5ca128[_0x2851('0x2f')]));if(_0x2940b1[_0x2851('0x2d')][_0x2851('0x3b')]){_0x5a96e9[_0x2851('0x38')]=_['merge'](_0x5a96e9[_0x2851('0x38')],{'$or':_[_0x2851('0x2a')](_0x5a96e9['attributes'],function(_0x262e34){var _0x1fe52e={};_0x1fe52e[_0x262e34]={'$like':'%'+_0x2940b1['query'][_0x2851('0x3b')]+'%'};return _0x1fe52e;})});}_0x5a96e9=_['merge']({},_0x5a96e9,_0x2940b1[_0x2851('0x3d')]);return _0x2b00ef[_0x2851('0x51')](_0x5a96e9);}})[_0x2851('0x23')](function(_0x1c2535){if(_0x1c2535){_0x532309=_0x1c2535[_0x2851('0x33')];if(!_0x2940b1[_0x2851('0x2d')][_0x2851('0x4d')]('nolimit')){_0x5a96e9[_0x2851('0x35')]=qs[_0x2851('0x35')](_0x2940b1[_0x2851('0x2d')][_0x2851('0x35')]);_0x5a96e9['offset']=qs['offset'](_0x2940b1['query'][_0x2851('0x1d')]);}return _0x2b00ef[_0x2851('0x51')](_0x5a96e9);}})['then'](function(_0x231c7d){if(_0x231c7d){return _0x231c7d?{'count':_0x532309,'rows':_0x231c7d}:null;}})['then'](respondWithResult(_0x4ddfa2,null))['catch'](handleError(_0x4ddfa2,null));};exports['setTags']=function(_0x1f70e7,_0x4dc128,_0xba8e){if(_0x1f70e7['body']['id']){delete _0x1f70e7['body']['id'];}return db[_0x2851('0x3e')][_0x2851('0x49')]({'where':{'id':_0x1f70e7[_0x2851('0x4a')]['id']}})[_0x2851('0x23')](handleEntityNotFound(_0x4dc128,null))[_0x2851('0x23')](function(_0x237b92){if(_0x237b92){return _0x237b92[_0x2851('0x52')](_0x1f70e7[_0x2851('0x47')][_0x2851('0x53')]||[]);}return null;})['then'](respondWithResult(_0x4dc128,null))[_0x2851('0x43')](handleError(_0x4dc128,null));}; \ No newline at end of file +var _0xf4ee=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','FreshdeskConfiguration','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','getFields','FreshdeskField','findOne','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf4ee,0x146));var _0xef4e=function(_0x1434e6,_0x31ba96){_0x1434e6=_0x1434e6-0x0;var _0x2866ee=_0xf4ee[_0x1434e6];return _0x2866ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef4e('0x0'));var zipdir=require(_0xef4e('0x1'));var jsonpatch=require(_0xef4e('0x2'));var rp=require(_0xef4e('0x3'));var moment=require(_0xef4e('0x4'));var BPromise=require(_0xef4e('0x5'));var Mustache=require(_0xef4e('0x6'));var util=require('util');var path=require(_0xef4e('0x7'));var sox=require('sox');var csv=require(_0xef4e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef4e('0x9'));var _=require(_0xef4e('0xa'));var squel=require(_0xef4e('0xb'));var crypto=require(_0xef4e('0xc'));var jsforce=require(_0xef4e('0xd'));var deskjs=require(_0xef4e('0xe'));var toCsv=require(_0xef4e('0x8'));var querystring=require(_0xef4e('0xf'));var Papa=require(_0xef4e('0x10'));var Redis=require('ioredis');var authService=require(_0xef4e('0x11'));var qs=require(_0xef4e('0x12'));var as=require(_0xef4e('0x13'));var hardwareService=require(_0xef4e('0x14'));var logger=require(_0xef4e('0x15'))(_0xef4e('0x16'));var utils=require(_0xef4e('0x17'));var config=require(_0xef4e('0x18'));var licenseUtil=require(_0xef4e('0x19'));var db=require(_0xef4e('0x1a'))['db'];function respondWithStatusCode(_0x58edc5,_0xbf651a){_0xbf651a=_0xbf651a||0xcc;return function(_0x284428){if(_0x284428){return _0x58edc5[_0xef4e('0x1b')](_0xbf651a);}return _0x58edc5[_0xef4e('0x1c')](_0xbf651a)[_0xef4e('0x1d')]();};}function respondWithResult(_0x59b2f7,_0x190a43){_0x190a43=_0x190a43||0xc8;return function(_0x510d99){if(_0x510d99){return _0x59b2f7[_0xef4e('0x1c')](_0x190a43)[_0xef4e('0x1e')](_0x510d99);}};}function respondWithFilteredResult(_0xc4b9ba,_0x5dce04){return function(_0x47c69a){if(_0x47c69a){var _0x474436=typeof _0x5dce04['offset']==='undefined'&&typeof _0x5dce04[_0xef4e('0x1f')]===_0xef4e('0x20');var _0x4c0e76=_0x47c69a[_0xef4e('0x21')];var _0x203dbb=_0x474436?0x0:_0x5dce04['offset'];var _0x49bd42=_0x474436?_0x47c69a[_0xef4e('0x21')]:_0x5dce04['offset']+_0x5dce04[_0xef4e('0x1f')];var _0xd5d5d4;if(_0x49bd42>=_0x4c0e76){_0x49bd42=_0x4c0e76;_0xd5d5d4=0xc8;}else{_0xd5d5d4=0xce;}_0xc4b9ba[_0xef4e('0x1c')](_0xd5d5d4);return _0xc4b9ba[_0xef4e('0x22')]('Content-Range',_0x203dbb+'-'+_0x49bd42+'/'+_0x4c0e76)['json'](_0x47c69a);}return null;};}function patchUpdates(_0x966d97){return function(_0x4e1ce6){try{jsonpatch[_0xef4e('0x23')](_0x4e1ce6,_0x966d97,!![]);}catch(_0x186c6a){return BPromise[_0xef4e('0x24')](_0x186c6a);}return _0x4e1ce6[_0xef4e('0x25')]();};}function saveUpdates(_0x303ca0,_0x401e3e){return function(_0x48ada1){if(_0x48ada1){return _0x48ada1[_0xef4e('0x26')](_0x303ca0)[_0xef4e('0x27')](function(_0x4e0206){return _0x4e0206;});}return null;};}function removeEntity(_0x20c12c,_0x5eadcb){return function(_0x1aa0b0){if(_0x1aa0b0){return _0x1aa0b0['destroy']()[_0xef4e('0x27')](function(){_0x20c12c[_0xef4e('0x1c')](0xcc)[_0xef4e('0x1d')]();});}};}function handleEntityNotFound(_0x2424a5,_0xe986b8){return function(_0x3d6d0f){if(!_0x3d6d0f){_0x2424a5['sendStatus'](0x194);}return _0x3d6d0f;};}function handleError(_0x78e85c,_0x4171){_0x4171=_0x4171||0x1f4;return function(_0x4a69c9){logger['error'](_0x4a69c9[_0xef4e('0x28')]);if(_0x4a69c9[_0xef4e('0x29')]){delete _0x4a69c9[_0xef4e('0x29')];}_0x78e85c['status'](_0x4171)[_0xef4e('0x2a')](_0x4a69c9);};}exports[_0xef4e('0x2b')]=function(_0x1f1233,_0x1b26f1){var _0x127850={},_0x3b2e60={},_0x39013e={'count':0x0,'rows':[]};var _0x2f6fd9=_[_0xef4e('0x2c')](db['FreshdeskConfiguration'][_0xef4e('0x2d')],function(_0x187764){return{'name':_0x187764[_0xef4e('0x2e')],'type':_0x187764[_0xef4e('0x2f')][_0xef4e('0x30')]};});_0x3b2e60[_0xef4e('0x31')]=_[_0xef4e('0x2c')](_0x2f6fd9,_0xef4e('0x29'));_0x3b2e60['query']=_['keys'](_0x1f1233[_0xef4e('0x32')]);_0x3b2e60['filters']=_['intersection'](_0x3b2e60[_0xef4e('0x31')],_0x3b2e60[_0xef4e('0x32')]);_0x127850['attributes']=_[_0xef4e('0x33')](_0x3b2e60[_0xef4e('0x31')],qs[_0xef4e('0x34')](_0x1f1233[_0xef4e('0x32')][_0xef4e('0x34')]));_0x127850[_0xef4e('0x35')]=_0x127850[_0xef4e('0x35')][_0xef4e('0x36')]?_0x127850[_0xef4e('0x35')]:_0x3b2e60[_0xef4e('0x31')];if(!_0x1f1233['query'][_0xef4e('0x37')](_0xef4e('0x38'))){_0x127850['limit']=qs[_0xef4e('0x1f')](_0x1f1233[_0xef4e('0x32')][_0xef4e('0x1f')]);_0x127850['offset']=qs[_0xef4e('0x39')](_0x1f1233[_0xef4e('0x32')][_0xef4e('0x39')]);}_0x127850[_0xef4e('0x3a')]=qs[_0xef4e('0x3b')](_0x1f1233['query']['sort']);_0x127850[_0xef4e('0x3c')]=qs[_0xef4e('0x3d')](_[_0xef4e('0x3e')](_0x1f1233[_0xef4e('0x32')],_0x3b2e60[_0xef4e('0x3d')]),_0x2f6fd9);if(_0x1f1233[_0xef4e('0x32')][_0xef4e('0x3f')]){_0x127850[_0xef4e('0x3c')]=_['merge'](_0x127850[_0xef4e('0x3c')],{'$or':_['map'](_0x2f6fd9,function(_0x35d7e5){if(_0x35d7e5[_0xef4e('0x2f')]!==_0xef4e('0x40')){var _0xf50201={};_0xf50201[_0x35d7e5[_0xef4e('0x29')]]={'$like':'%'+_0x1f1233['query'][_0xef4e('0x3f')]+'%'};return _0xf50201;}})});}_0x127850=_[_0xef4e('0x41')]({},_0x127850,_0x1f1233[_0xef4e('0x42')]);var _0x187331={'where':_0x127850[_0xef4e('0x3c')]};return db[_0xef4e('0x43')][_0xef4e('0x21')](_0x187331)[_0xef4e('0x27')](function(_0x5928f5){_0x39013e[_0xef4e('0x21')]=_0x5928f5;if(_0x1f1233[_0xef4e('0x32')]['includeAll']){_0x127850[_0xef4e('0x44')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xef4e('0x45')](_0x127850);})[_0xef4e('0x27')](function(_0x3110fa){_0x39013e[_0xef4e('0x46')]=_0x3110fa;return _0x39013e;})[_0xef4e('0x27')](respondWithFilteredResult(_0x1b26f1,_0x127850))[_0xef4e('0x47')](handleError(_0x1b26f1,null));};exports[_0xef4e('0x48')]=function(_0x36f74c,_0x3ab48e){var _0x5e0f8a={'raw':![],'where':{'id':_0x36f74c['params']['id']}},_0xb4c87={};_0xb4c87['model']=_[_0xef4e('0x49')](db[_0xef4e('0x43')][_0xef4e('0x2d')]);_0xb4c87['query']=_[_0xef4e('0x49')](_0x36f74c['query']);_0xb4c87[_0xef4e('0x3d')]=_[_0xef4e('0x33')](_0xb4c87['model'],_0xb4c87[_0xef4e('0x32')]);_0x5e0f8a[_0xef4e('0x35')]=_['intersection'](_0xb4c87[_0xef4e('0x31')],qs['fields'](_0x36f74c['query'][_0xef4e('0x34')]));_0x5e0f8a[_0xef4e('0x35')]=_0x5e0f8a[_0xef4e('0x35')][_0xef4e('0x36')]?_0x5e0f8a[_0xef4e('0x35')]:_0xb4c87[_0xef4e('0x31')];if(_0x36f74c[_0xef4e('0x32')][_0xef4e('0x4a')]){_0x5e0f8a[_0xef4e('0x44')]=[{'all':!![]}];}_0x5e0f8a=_[_0xef4e('0x41')]({},_0x5e0f8a,_0x36f74c[_0xef4e('0x42')]);return db[_0xef4e('0x43')][_0xef4e('0x4b')](_0x5e0f8a)[_0xef4e('0x27')](handleEntityNotFound(_0x3ab48e,null))[_0xef4e('0x27')](respondWithResult(_0x3ab48e,null))['catch'](handleError(_0x3ab48e,null));};exports[_0xef4e('0x4c')]=function(_0x1b09b9,_0x4bfbac){return db['FreshdeskConfiguration'][_0xef4e('0x4c')](_0x1b09b9[_0xef4e('0x4d')],{})[_0xef4e('0x27')](respondWithResult(_0x4bfbac,0xc9))[_0xef4e('0x47')](handleError(_0x4bfbac,null));};exports['update']=function(_0x54c3fb,_0x3b3076){if(_0x54c3fb[_0xef4e('0x4d')]['id']){delete _0x54c3fb['body']['id'];}return db[_0xef4e('0x43')][_0xef4e('0x4b')]({'where':{'id':_0x54c3fb['params']['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0x3b3076,null))[_0xef4e('0x27')](saveUpdates(_0x54c3fb['body'],null))[_0xef4e('0x27')](respondWithResult(_0x3b3076,null))['catch'](handleError(_0x3b3076,null));};exports['destroy']=function(_0x62c091,_0x1a50c5){return db[_0xef4e('0x43')][_0xef4e('0x4b')]({'where':{'id':_0x62c091[_0xef4e('0x4e')]['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0x1a50c5,null))[_0xef4e('0x27')](removeEntity(_0x1a50c5,null))[_0xef4e('0x47')](handleError(_0x1a50c5,null));};exports[_0xef4e('0x4f')]=function(_0x25dc35,_0xab8c88,_0x37ee30){var _0x16f407={};var _0x1d692c={};var _0x94c406;var _0x5cddcc;return db[_0xef4e('0x43')]['findOne']({'where':{'id':_0x25dc35[_0xef4e('0x4e')]['id']}})['then'](handleEntityNotFound(_0xab8c88,null))[_0xef4e('0x27')](function(_0x36bcb0){if(_0x36bcb0){_0x94c406=_0x36bcb0;_0x1d692c[_0xef4e('0x31')]=_[_0xef4e('0x49')](db[_0xef4e('0x50')]['rawAttributes']);_0x1d692c[_0xef4e('0x32')]=_[_0xef4e('0x49')](_0x25dc35['query']);_0x1d692c['filters']=_['intersection'](_0x1d692c[_0xef4e('0x31')],_0x1d692c[_0xef4e('0x32')]);_0x16f407[_0xef4e('0x35')]=_['intersection'](_0x1d692c[_0xef4e('0x31')],qs[_0xef4e('0x34')](_0x25dc35['query']['fields']));_0x16f407[_0xef4e('0x35')]=_0x16f407[_0xef4e('0x35')][_0xef4e('0x36')]?_0x16f407[_0xef4e('0x35')]:_0x1d692c[_0xef4e('0x31')];_0x16f407[_0xef4e('0x3a')]=qs[_0xef4e('0x3b')](_0x25dc35['query'][_0xef4e('0x3b')]);_0x16f407['where']=qs[_0xef4e('0x3d')](_['pick'](_0x25dc35[_0xef4e('0x32')],_0x1d692c['filters']));if(_0x25dc35[_0xef4e('0x32')]['filter']){_0x16f407[_0xef4e('0x3c')]=_[_0xef4e('0x41')](_0x16f407[_0xef4e('0x3c')],{'$or':_[_0xef4e('0x2c')](_0x16f407[_0xef4e('0x35')],function(_0x74faf0){var _0x3482f9={};_0x3482f9[_0x74faf0]={'$like':'%'+_0x25dc35[_0xef4e('0x32')][_0xef4e('0x3f')]+'%'};return _0x3482f9;})});}_0x16f407=_[_0xef4e('0x41')]({},_0x16f407,_0x25dc35[_0xef4e('0x42')]);return _0x94c406[_0xef4e('0x4f')](_0x16f407);}})[_0xef4e('0x27')](function(_0x48d497){if(_0x48d497){_0x5cddcc=_0x48d497[_0xef4e('0x36')];if(!_0x25dc35[_0xef4e('0x32')][_0xef4e('0x37')](_0xef4e('0x38'))){_0x16f407['limit']=qs[_0xef4e('0x1f')](_0x25dc35[_0xef4e('0x32')][_0xef4e('0x1f')]);_0x16f407[_0xef4e('0x39')]=qs['offset'](_0x25dc35[_0xef4e('0x32')]['offset']);}return _0x94c406[_0xef4e('0x4f')](_0x16f407);}})[_0xef4e('0x27')](function(_0x54c0c5){if(_0x54c0c5){return _0x54c0c5?{'count':_0x5cddcc,'rows':_0x54c0c5}:null;}})[_0xef4e('0x27')](respondWithResult(_0xab8c88,null))[_0xef4e('0x47')](handleError(_0xab8c88,null));};exports['getSubjects']=function(_0x30ef9e,_0xda720c,_0x2be7a8){var _0x32be12={};var _0x59e9ff={};var _0x2b0ff5;var _0x5b6ee0;return db['FreshdeskConfiguration'][_0xef4e('0x51')]({'where':{'id':_0x30ef9e[_0xef4e('0x4e')]['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0xda720c,null))[_0xef4e('0x27')](function(_0x4aab4b){if(_0x4aab4b){_0x2b0ff5=_0x4aab4b;_0x59e9ff[_0xef4e('0x31')]=_[_0xef4e('0x49')](db['FreshdeskField'][_0xef4e('0x2d')]);_0x59e9ff[_0xef4e('0x32')]=_[_0xef4e('0x49')](_0x30ef9e['query']);_0x59e9ff['filters']=_[_0xef4e('0x33')](_0x59e9ff[_0xef4e('0x31')],_0x59e9ff['query']);_0x32be12['attributes']=_[_0xef4e('0x33')](_0x59e9ff[_0xef4e('0x31')],qs[_0xef4e('0x34')](_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x34')]));_0x32be12[_0xef4e('0x35')]=_0x32be12[_0xef4e('0x35')][_0xef4e('0x36')]?_0x32be12[_0xef4e('0x35')]:_0x59e9ff[_0xef4e('0x31')];_0x32be12[_0xef4e('0x3a')]=qs[_0xef4e('0x3b')](_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x3b')]);_0x32be12['where']=qs[_0xef4e('0x3d')](_[_0xef4e('0x3e')](_0x30ef9e[_0xef4e('0x32')],_0x59e9ff[_0xef4e('0x3d')]));if(_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x3f')]){_0x32be12[_0xef4e('0x3c')]=_['merge'](_0x32be12['where'],{'$or':_[_0xef4e('0x2c')](_0x32be12[_0xef4e('0x35')],function(_0x275152){var _0x69291d={};_0x69291d[_0x275152]={'$like':'%'+_0x30ef9e['query']['filter']+'%'};return _0x69291d;})});}_0x32be12=_[_0xef4e('0x41')]({},_0x32be12,_0x30ef9e[_0xef4e('0x42')]);return _0x2b0ff5[_0xef4e('0x52')](_0x32be12);}})[_0xef4e('0x27')](function(_0x178636){if(_0x178636){_0x5b6ee0=_0x178636['length'];if(!_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x37')](_0xef4e('0x38'))){_0x32be12['limit']=qs[_0xef4e('0x1f')](_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x1f')]);_0x32be12[_0xef4e('0x39')]=qs[_0xef4e('0x39')](_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x39')]);}return _0x2b0ff5[_0xef4e('0x52')](_0x32be12);}})[_0xef4e('0x27')](function(_0x5a77c0){if(_0x5a77c0){return _0x5a77c0?{'count':_0x5b6ee0,'rows':_0x5a77c0}:null;}})[_0xef4e('0x27')](respondWithResult(_0xda720c,null))[_0xef4e('0x47')](handleError(_0xda720c,null));};exports[_0xef4e('0x53')]=function(_0x25ff54,_0x26d28c,_0x30b4c8){var _0x16ff0d={};var _0x46aac4={};var _0x38b406;var _0x276fda;return db['FreshdeskConfiguration'][_0xef4e('0x51')]({'where':{'id':_0x25ff54['params']['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0x26d28c,null))[_0xef4e('0x27')](function(_0xf3c631){if(_0xf3c631){_0x38b406=_0xf3c631;_0x46aac4[_0xef4e('0x31')]=_['keys'](db[_0xef4e('0x50')][_0xef4e('0x2d')]);_0x46aac4[_0xef4e('0x32')]=_['keys'](_0x25ff54[_0xef4e('0x32')]);_0x46aac4[_0xef4e('0x3d')]=_[_0xef4e('0x33')](_0x46aac4['model'],_0x46aac4['query']);_0x16ff0d['attributes']=_[_0xef4e('0x33')](_0x46aac4[_0xef4e('0x31')],qs[_0xef4e('0x34')](_0x25ff54[_0xef4e('0x32')][_0xef4e('0x34')]));_0x16ff0d[_0xef4e('0x35')]=_0x16ff0d[_0xef4e('0x35')][_0xef4e('0x36')]?_0x16ff0d[_0xef4e('0x35')]:_0x46aac4[_0xef4e('0x31')];_0x16ff0d['order']=qs[_0xef4e('0x3b')](_0x25ff54['query']['sort']);_0x16ff0d[_0xef4e('0x3c')]=qs[_0xef4e('0x3d')](_['pick'](_0x25ff54[_0xef4e('0x32')],_0x46aac4[_0xef4e('0x3d')]));if(_0x25ff54[_0xef4e('0x32')][_0xef4e('0x3f')]){_0x16ff0d[_0xef4e('0x3c')]=_[_0xef4e('0x41')](_0x16ff0d['where'],{'$or':_[_0xef4e('0x2c')](_0x16ff0d[_0xef4e('0x35')],function(_0x2c4d87){var _0x35f969={};_0x35f969[_0x2c4d87]={'$like':'%'+_0x25ff54[_0xef4e('0x32')][_0xef4e('0x3f')]+'%'};return _0x35f969;})});}_0x16ff0d=_[_0xef4e('0x41')]({},_0x16ff0d,_0x25ff54['options']);return _0x38b406['getDescriptions'](_0x16ff0d);}})[_0xef4e('0x27')](function(_0x4160b7){if(_0x4160b7){_0x276fda=_0x4160b7[_0xef4e('0x36')];if(!_0x25ff54['query']['hasOwnProperty'](_0xef4e('0x38'))){_0x16ff0d[_0xef4e('0x1f')]=qs[_0xef4e('0x1f')](_0x25ff54['query'][_0xef4e('0x1f')]);_0x16ff0d[_0xef4e('0x39')]=qs[_0xef4e('0x39')](_0x25ff54[_0xef4e('0x32')]['offset']);}return _0x38b406[_0xef4e('0x53')](_0x16ff0d);}})[_0xef4e('0x27')](function(_0x5a80d0){if(_0x5a80d0){return _0x5a80d0?{'count':_0x276fda,'rows':_0x5a80d0}:null;}})[_0xef4e('0x27')](respondWithResult(_0x26d28c,null))['catch'](handleError(_0x26d28c,null));};exports[_0xef4e('0x54')]=function(_0x2fc170,_0x4788b4,_0x10d1a7){var _0x3aff6a={};var _0x58cbd7={};var _0x55b640;var _0x3aa331;return db[_0xef4e('0x43')][_0xef4e('0x51')]({'where':{'id':_0x2fc170[_0xef4e('0x4e')]['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0x4788b4,null))['then'](function(_0x466970){if(_0x466970){_0x55b640=_0x466970;_0x58cbd7['model']=_[_0xef4e('0x49')](db['Tag'][_0xef4e('0x2d')]);_0x58cbd7[_0xef4e('0x32')]=_[_0xef4e('0x49')](_0x2fc170[_0xef4e('0x32')]);_0x58cbd7[_0xef4e('0x3d')]=_['intersection'](_0x58cbd7[_0xef4e('0x31')],_0x58cbd7[_0xef4e('0x32')]);_0x3aff6a[_0xef4e('0x35')]=_[_0xef4e('0x33')](_0x58cbd7['model'],qs['fields'](_0x2fc170[_0xef4e('0x32')][_0xef4e('0x34')]));_0x3aff6a[_0xef4e('0x35')]=_0x3aff6a[_0xef4e('0x35')][_0xef4e('0x36')]?_0x3aff6a[_0xef4e('0x35')]:_0x58cbd7[_0xef4e('0x31')];_0x3aff6a[_0xef4e('0x3a')]=qs[_0xef4e('0x3b')](_0x2fc170[_0xef4e('0x32')]['sort']);_0x3aff6a[_0xef4e('0x3c')]=qs[_0xef4e('0x3d')](_['pick'](_0x2fc170[_0xef4e('0x32')],_0x58cbd7[_0xef4e('0x3d')]));if(_0x2fc170['query'][_0xef4e('0x3f')]){_0x3aff6a['where']=_[_0xef4e('0x41')](_0x3aff6a['where'],{'$or':_[_0xef4e('0x2c')](_0x3aff6a['attributes'],function(_0x24b2eb){var _0xd93365={};_0xd93365[_0x24b2eb]={'$like':'%'+_0x2fc170[_0xef4e('0x32')][_0xef4e('0x3f')]+'%'};return _0xd93365;})});}_0x3aff6a=_[_0xef4e('0x41')]({},_0x3aff6a,_0x2fc170[_0xef4e('0x42')]);return _0x55b640[_0xef4e('0x54')](_0x3aff6a);}})['then'](function(_0x588357){if(_0x588357){_0x3aa331=_0x588357[_0xef4e('0x36')];if(!_0x2fc170[_0xef4e('0x32')]['hasOwnProperty'](_0xef4e('0x38'))){_0x3aff6a[_0xef4e('0x1f')]=qs[_0xef4e('0x1f')](_0x2fc170[_0xef4e('0x32')][_0xef4e('0x1f')]);_0x3aff6a[_0xef4e('0x39')]=qs[_0xef4e('0x39')](_0x2fc170[_0xef4e('0x32')]['offset']);}return _0x55b640[_0xef4e('0x54')](_0x3aff6a);}})['then'](function(_0x2b341e){if(_0x2b341e){return _0x2b341e?{'count':_0x3aa331,'rows':_0x2b341e}:null;}})[_0xef4e('0x27')](respondWithResult(_0x4788b4,null))[_0xef4e('0x47')](handleError(_0x4788b4,null));};exports[_0xef4e('0x55')]=function(_0x379882,_0x249dde,_0x83224a){if(_0x379882['body']['id']){delete _0x379882[_0xef4e('0x4d')]['id'];}return db[_0xef4e('0x43')][_0xef4e('0x51')]({'where':{'id':_0x379882[_0xef4e('0x4e')]['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0x249dde,null))[_0xef4e('0x27')](function(_0x5371fa){if(_0x5371fa){return _0x5371fa['setTags'](_0x379882[_0xef4e('0x4d')][_0xef4e('0x56')]||[]);}return null;})[_0xef4e('0x27')](respondWithResult(_0x249dde,null))[_0xef4e('0x47')](handleError(_0x249dde,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7a78da3..6676079 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 _0xeb6e=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0xeb6e,0x138));var _0xeeb6=function(_0x20b68e,_0x5b5374){_0x20b68e=_0x20b68e-0x0;var _0xfb6b33=_0xeb6e[_0x20b68e];return _0xfb6b33;};'use strict';var _=require('lodash');var util=require(_0xeeb6('0x0'));var logger=require(_0xeeb6('0x1'))(_0xeeb6('0x2'));var moment=require(_0xeeb6('0x3'));var BPromise=require(_0xeeb6('0x4'));var rp=require(_0xeeb6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeeb6('0x6'));var config=require(_0xeeb6('0x7'));var attributes=require(_0xeeb6('0x8'));module[_0xeeb6('0x9')]=function(_0x4e442b,_0x404d9b){return _0x4e442b[_0xeeb6('0xa')](_0xeeb6('0xb'),attributes,{'tableName':_0xeeb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a87=['api','bluebird','rimraf','FreshdeskConfiguration','../../config/logger'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x0a87,0x13f));var _0x70a8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a87[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x70a8('0x0'))(_0x70a8('0x1'));var moment=require('moment');var BPromise=require(_0x70a8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x70a8('0x3'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x11ccae,_0xc17241){return _0x11ccae['define'](_0x70a8('0x4'),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 d941581..d6be7b3 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 _0x24b5=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird'];(function(_0x3624c1,_0x2c9395){var _0x2bcfd4=function(_0x2fc39e){while(--_0x2fc39e){_0x3624c1['push'](_0x3624c1['shift']());}};_0x2bcfd4(++_0x2c9395);}(_0x24b5,0x66));var _0x524b=function(_0x31f364,_0x564cd6){_0x31f364=_0x31f364-0x0;var _0x2bacdc=_0x24b5[_0x31f364];return _0x2bacdc;};'use strict';var _=require(_0x524b('0x0'));var util=require('util');var moment=require(_0x524b('0x1'));var BPromise=require(_0x524b('0x2'));var rs=require(_0x524b('0x3'));var fs=require('fs');var Redis=require(_0x524b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x524b('0x5'));var logger=require(_0x524b('0x6'))(_0x524b('0x7'));var config=require(_0x524b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x524b('0x9')][_0x524b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fe5d,_0x8af2ba,_0x2e5ced){return new BPromise(function(_0x25b924,_0x118cdd){return client['request'](_0x44fe5d,_0x2e5ced)[_0x524b('0xb')](function(_0x2db55a){logger[_0x524b('0xc')](_0x524b('0xd'),_0x8af2ba,_0x524b('0xe'));logger[_0x524b('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x8af2ba,_0x524b('0xe'),JSON[_0x524b('0x10')](_0x2db55a));if(_0x2db55a[_0x524b('0x11')]){if(_0x2db55a[_0x524b('0x11')][_0x524b('0x12')]===0x1f4){logger[_0x524b('0x11')](_0x524b('0xd'),_0x8af2ba,_0x2db55a[_0x524b('0x11')]['message']);return _0x118cdd(_0x2db55a[_0x524b('0x11')]['message']);}logger[_0x524b('0x11')](_0x524b('0xd'),_0x8af2ba,_0x2db55a[_0x524b('0x11')][_0x524b('0x13')]);return _0x25b924(_0x2db55a[_0x524b('0x11')][_0x524b('0x13')]);}else{logger[_0x524b('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x8af2ba,_0x524b('0xe'));_0x25b924(_0x2db55a['result']['message']);}})[_0x524b('0x14')](function(_0x2300e9){logger[_0x524b('0x11')](_0x524b('0xd'),_0x8af2ba,_0x2300e9);_0x118cdd(_0x2300e9);});});} \ No newline at end of file +var _0x0f88=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0f88,0x114));var _0x80f8=function(_0x3a7368,_0x185789){_0x3a7368=_0x3a7368-0x0;var _0x1aa883=_0x0f88[_0x3a7368];return _0x1aa883;};'use strict';var _=require(_0x80f8('0x0'));var util=require(_0x80f8('0x1'));var moment=require(_0x80f8('0x2'));var BPromise=require(_0x80f8('0x3'));var rs=require(_0x80f8('0x4'));var fs=require('fs');var Redis=require(_0x80f8('0x5'));var db=require(_0x80f8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x80f8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x80f8('0x8')][_0x80f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310415,_0x2a4a04,_0x428ce4){return new BPromise(function(_0x59943b,_0x554a6f){return client[_0x80f8('0xa')](_0x310415,_0x428ce4)[_0x80f8('0xb')](function(_0xa5dd9d){logger[_0x80f8('0xc')](_0x80f8('0xd'),_0x2a4a04,_0x80f8('0xe'));logger[_0x80f8('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2a4a04,_0x80f8('0xe'),JSON[_0x80f8('0x10')](_0xa5dd9d));if(_0xa5dd9d[_0x80f8('0x11')]){if(_0xa5dd9d['error']['code']===0x1f4){logger[_0x80f8('0x11')](_0x80f8('0xd'),_0x2a4a04,_0xa5dd9d['error'][_0x80f8('0x12')]);return _0x554a6f(_0xa5dd9d[_0x80f8('0x11')][_0x80f8('0x12')]);}logger['error'](_0x80f8('0xd'),_0x2a4a04,_0xa5dd9d[_0x80f8('0x11')][_0x80f8('0x12')]);return _0x59943b(_0xa5dd9d[_0x80f8('0x11')]['message']);}else{logger['info'](_0x80f8('0xd'),_0x2a4a04,_0x80f8('0xe'));_0x59943b(_0xa5dd9d['result'][_0x80f8('0x12')]);}})['catch'](function(_0x3695a8){logger[_0x80f8('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2a4a04,_0x3695a8);_0x554a6f(_0x3695a8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 5408e11..f74b326 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 _0xc3f3=['../../components/interaction/service','isAuthenticated','get','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x3645cc,_0x25ba47){var _0x351979=function(_0x5829a0){while(--_0x5829a0){_0x3645cc['push'](_0x3645cc['shift']());}};_0x351979(++_0x25ba47);}(_0xc3f3,0xeb));var _0x3c3f=function(_0x5c2030,_0x232e33){_0x5c2030=_0x5c2030-0x0;var _0x239125=_0xc3f3[_0x5c2030];return _0x239125;};'use strict';var multer=require(_0x3c3f('0x0'));var util=require('util');var path=require(_0x3c3f('0x1'));var timeout=require(_0x3c3f('0x2'));var express=require(_0x3c3f('0x3'));var router=express['Router']();var fs_extra=require(_0x3c3f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3c3f('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x3c3f('0x6')](),controller['index']);router[_0x3c3f('0x7')](_0x3c3f('0x8'),auth['isAuthenticated'](),controller[_0x3c3f('0x9')]);router[_0x3c3f('0xa')]('/',auth[_0x3c3f('0x6')](),controller[_0x3c3f('0xb')]);router[_0x3c3f('0xc')](_0x3c3f('0x8'),auth[_0x3c3f('0x6')](),controller['update']);router[_0x3c3f('0xd')]('/:id',auth[_0x3c3f('0x6')](),controller[_0x3c3f('0xe')]);module[_0x3c3f('0xf')]=router; \ No newline at end of file +var _0xb228=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports'];(function(_0x1d045a,_0x5c6778){var _0x24ce3b=function(_0x234d3a){while(--_0x234d3a){_0x1d045a['push'](_0x1d045a['shift']());}};_0x24ce3b(++_0x5c6778);}(_0xb228,0x17c));var _0x8b22=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb228[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0x8b22('0x0'));var util=require(_0x8b22('0x1'));var path=require('path');var timeout=require(_0x8b22('0x2'));var express=require(_0x8b22('0x3'));var router=express[_0x8b22('0x4')]();var fs_extra=require(_0x8b22('0x5'));var auth=require(_0x8b22('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b22('0x7'));var controller=require(_0x8b22('0x8'));router[_0x8b22('0x9')]('/',auth[_0x8b22('0xa')](),controller[_0x8b22('0xb')]);router[_0x8b22('0x9')](_0x8b22('0xc'),auth[_0x8b22('0xa')](),controller[_0x8b22('0xd')]);router[_0x8b22('0xe')]('/',auth[_0x8b22('0xa')](),controller[_0x8b22('0xf')]);router[_0x8b22('0x10')](_0x8b22('0xc'),auth[_0x8b22('0xa')](),controller[_0x8b22('0x11')]);router[_0x8b22('0x12')](_0x8b22('0xc'),auth[_0x8b22('0xa')](),controller['destroy']);module[_0x8b22('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 89213f7..5d87673 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 _0x3153=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x51eb91,_0x4799d5){var _0x1c4fc4=function(_0x1fd807){while(--_0x1fd807){_0x51eb91['push'](_0x51eb91['shift']());}};_0x1c4fc4(++_0x4799d5);}(_0x3153,0x17b));var _0x3315=function(_0x5e52bf,_0x99b40e){_0x5e52bf=_0x5e52bf-0x0;var _0x4d9f24=_0x3153[_0x5e52bf];return _0x4d9f24;};'use strict';var Sequelize=require(_0x3315('0x0'));module[_0x3315('0x1')]={'type':{'type':Sequelize[_0x3315('0x2')]('string',_0x3315('0x3'),_0x3315('0x4'),_0x3315('0x5'),_0x3315('0x6')),'defaultValue':_0x3315('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3315('0x8')]},'keyType':{'type':Sequelize[_0x3315('0x2')]('string','variable',_0x3315('0x4'))},'keyContent':{'type':Sequelize[_0x3315('0x8')]},'idField':{'type':Sequelize[_0x3315('0x8')]},'nameField':{'type':Sequelize[_0x3315('0x8')]},'customField':{'type':Sequelize[_0x3315('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3315('0x8')]}}; \ No newline at end of file +var _0x3700=['picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue'];(function(_0x24d5a0,_0x54ed3a){var _0x2b6d87=function(_0x488cfb){while(--_0x488cfb){_0x24d5a0['push'](_0x24d5a0['shift']());}};_0x2b6d87(++_0x54ed3a);}(_0x3700,0xe1));var _0x0370=function(_0x4a96d2,_0x689504){_0x4a96d2=_0x4a96d2-0x0;var _0x38af04=_0x3700[_0x4a96d2];return _0x38af04;};'use strict';var Sequelize=require(_0x0370('0x0'));module[_0x0370('0x1')]={'type':{'type':Sequelize[_0x0370('0x2')](_0x0370('0x3'),'variable','customVariable',_0x0370('0x4'),_0x0370('0x5')),'defaultValue':_0x0370('0x3')},'content':{'type':Sequelize[_0x0370('0x6')]},'key':{'type':Sequelize[_0x0370('0x6')]},'keyType':{'type':Sequelize[_0x0370('0x2')]('string',_0x0370('0x7'),_0x0370('0x8'))},'keyContent':{'type':Sequelize[_0x0370('0x6')]},'idField':{'type':Sequelize[_0x0370('0x6')]},'nameField':{'type':Sequelize[_0x0370('0x6')]},'customField':{'type':Sequelize[_0x0370('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index a638855..793aa0f 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 _0xaaa2=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','type','key'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xaaa2,0xac));var _0x2aaa=function(_0x2e02ba,_0x46d8f7){_0x2e02ba=_0x2e02ba-0x0;var _0x5b3892=_0xaaa2[_0x2e02ba];return _0x5b3892;};'use strict';var emlformat=require(_0x2aaa('0x0'));var rimraf=require(_0x2aaa('0x1'));var zipdir=require(_0x2aaa('0x2'));var jsonpatch=require(_0x2aaa('0x3'));var rp=require(_0x2aaa('0x4'));var moment=require(_0x2aaa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2aaa('0x6'));var util=require('util');var path=require(_0x2aaa('0x7'));var sox=require(_0x2aaa('0x8'));var csv=require(_0x2aaa('0x9'));var ejs=require(_0x2aaa('0xa'));var fs=require('fs');var fs_extra=require(_0x2aaa('0xb'));var _=require(_0x2aaa('0xc'));var squel=require('squel');var crypto=require(_0x2aaa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2aaa('0x9'));var querystring=require('querystring');var Papa=require(_0x2aaa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2aaa('0xf'));var as=require(_0x2aaa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aaa('0x11'))(_0x2aaa('0x12'));var utils=require(_0x2aaa('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2aaa('0x14'));var db=require(_0x2aaa('0x15'))['db'];function respondWithStatusCode(_0x8a5be3,_0x2b51f0){_0x2b51f0=_0x2b51f0||0xcc;return function(_0xd38d6d){if(_0xd38d6d){return _0x8a5be3[_0x2aaa('0x16')](_0x2b51f0);}return _0x8a5be3[_0x2aaa('0x17')](_0x2b51f0)[_0x2aaa('0x18')]();};}function respondWithResult(_0x32dfbf,_0xe22151){_0xe22151=_0xe22151||0xc8;return function(_0x314366){if(_0x314366){return _0x32dfbf[_0x2aaa('0x17')](_0xe22151)['json'](_0x314366);}};}function respondWithFilteredResult(_0x166321,_0x4df56b){return function(_0x35fbc1){if(_0x35fbc1){var _0x1a5573=typeof _0x4df56b['offset']==='undefined'&&typeof _0x4df56b['limit']===_0x2aaa('0x19');var _0x1dc0ba=_0x35fbc1[_0x2aaa('0x1a')];var _0x3b94bf=_0x1a5573?0x0:_0x4df56b[_0x2aaa('0x1b')];var _0xdaa445=_0x1a5573?_0x35fbc1[_0x2aaa('0x1a')]:_0x4df56b['offset']+_0x4df56b[_0x2aaa('0x1c')];var _0x30951c;if(_0xdaa445>=_0x1dc0ba){_0xdaa445=_0x1dc0ba;_0x30951c=0xc8;}else{_0x30951c=0xce;}_0x166321['status'](_0x30951c);return _0x166321[_0x2aaa('0x1d')]('Content-Range',_0x3b94bf+'-'+_0xdaa445+'/'+_0x1dc0ba)['json'](_0x35fbc1);}return null;};}function patchUpdates(_0x1ec32e){return function(_0x5052eb){try{jsonpatch[_0x2aaa('0x1e')](_0x5052eb,_0x1ec32e,!![]);}catch(_0x3e7649){return BPromise[_0x2aaa('0x1f')](_0x3e7649);}return _0x5052eb[_0x2aaa('0x20')]();};}function saveUpdates(_0x2c255f,_0x24da1e){return function(_0x4f581f){if(_0x4f581f){return _0x4f581f[_0x2aaa('0x21')](_0x2c255f)[_0x2aaa('0x22')](function(_0x4836b2){return _0x4836b2;});}return null;};}function removeEntity(_0x4d35aa,_0x19153e){return function(_0x4d7151){if(_0x4d7151){return _0x4d7151[_0x2aaa('0x23')]()[_0x2aaa('0x22')](function(){_0x4d35aa['status'](0xcc)[_0x2aaa('0x18')]();});}};}function handleEntityNotFound(_0x3b99d8,_0x4e1c0f){return function(_0x2ab888){if(!_0x2ab888){_0x3b99d8[_0x2aaa('0x16')](0x194);}return _0x2ab888;};}function handleError(_0x41253c,_0x5371cd){_0x5371cd=_0x5371cd||0x1f4;return function(_0x1f626b){logger[_0x2aaa('0x24')](_0x1f626b['stack']);if(_0x1f626b['name']){delete _0x1f626b[_0x2aaa('0x25')];}_0x41253c[_0x2aaa('0x17')](_0x5371cd)[_0x2aaa('0x26')](_0x1f626b);};}exports[_0x2aaa('0x27')]=function(_0x3a6a63,_0x292297){var _0x2f8305={},_0x166dc0={},_0x12cd47={'count':0x0,'rows':[]};var _0x19472b=_[_0x2aaa('0x28')](db[_0x2aaa('0x29')]['rawAttributes'],function(_0x101b6e){return{'name':_0x101b6e['fieldName'],'type':_0x101b6e[_0x2aaa('0x2a')][_0x2aaa('0x2b')]};});_0x166dc0[_0x2aaa('0x2c')]=_[_0x2aaa('0x28')](_0x19472b,_0x2aaa('0x25'));_0x166dc0[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x3a6a63[_0x2aaa('0x2d')]);_0x166dc0[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x166dc0['model'],_0x166dc0['query']);_0x2f8305['attributes']=_['intersection'](_0x166dc0['model'],qs[_0x2aaa('0x31')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x31')]));_0x2f8305[_0x2aaa('0x32')]=_0x2f8305[_0x2aaa('0x32')][_0x2aaa('0x33')]?_0x2f8305[_0x2aaa('0x32')]:_0x166dc0[_0x2aaa('0x2c')];if(!_0x3a6a63['query'][_0x2aaa('0x34')](_0x2aaa('0x35'))){_0x2f8305['limit']=qs[_0x2aaa('0x1c')](_0x3a6a63[_0x2aaa('0x2d')]['limit']);_0x2f8305[_0x2aaa('0x1b')]=qs[_0x2aaa('0x1b')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x1b')]);}_0x2f8305[_0x2aaa('0x36')]=qs[_0x2aaa('0x37')](_0x3a6a63[_0x2aaa('0x2d')]['sort']);_0x2f8305['where']=qs[_0x2aaa('0x2f')](_['pick'](_0x3a6a63[_0x2aaa('0x2d')],_0x166dc0[_0x2aaa('0x2f')]),_0x19472b);if(_0x3a6a63['query'][_0x2aaa('0x38')]){_0x2f8305[_0x2aaa('0x39')]=_[_0x2aaa('0x3a')](_0x2f8305['where'],{'$or':_[_0x2aaa('0x28')](_0x19472b,function(_0x337ae8){if(_0x337ae8[_0x2aaa('0x2a')]!==_0x2aaa('0x3b')){var _0x5023d2={};_0x5023d2[_0x337ae8[_0x2aaa('0x25')]]={'$like':'%'+_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x38')]+'%'};return _0x5023d2;}})});}_0x2f8305=_[_0x2aaa('0x3a')]({},_0x2f8305,_0x3a6a63[_0x2aaa('0x3c')]);var _0x362060={'where':_0x2f8305[_0x2aaa('0x39')]};return db[_0x2aaa('0x29')][_0x2aaa('0x1a')](_0x362060)[_0x2aaa('0x22')](function(_0x127f7e){_0x12cd47[_0x2aaa('0x1a')]=_0x127f7e;if(_0x3a6a63[_0x2aaa('0x2d')]['includeAll']){_0x2f8305[_0x2aaa('0x3d')]=[{'all':!![]}];}return db[_0x2aaa('0x29')][_0x2aaa('0x3e')](_0x2f8305);})['then'](function(_0x17042f){_0x12cd47[_0x2aaa('0x3f')]=_0x17042f;return _0x12cd47;})[_0x2aaa('0x22')](respondWithFilteredResult(_0x292297,_0x2f8305))['catch'](handleError(_0x292297,null));};exports[_0x2aaa('0x40')]=function(_0x1bb225,_0x25b932){var _0x4ad537={'raw':!![],'where':{'id':_0x1bb225[_0x2aaa('0x41')]['id']}},_0x57554e={};_0x57554e[_0x2aaa('0x2c')]=_[_0x2aaa('0x2e')](db['FreshdeskField'][_0x2aaa('0x42')]);_0x57554e[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x1bb225[_0x2aaa('0x2d')]);_0x57554e[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x57554e[_0x2aaa('0x2c')],_0x57554e[_0x2aaa('0x2d')]);_0x4ad537['attributes']=_['intersection'](_0x57554e[_0x2aaa('0x2c')],qs['fields'](_0x1bb225[_0x2aaa('0x2d')]['fields']));_0x4ad537['attributes']=_0x4ad537['attributes'][_0x2aaa('0x33')]?_0x4ad537[_0x2aaa('0x32')]:_0x57554e['model'];if(_0x1bb225[_0x2aaa('0x2d')][_0x2aaa('0x43')]){_0x4ad537['include']=[{'all':!![]}];}_0x4ad537=_[_0x2aaa('0x3a')]({},_0x4ad537,_0x1bb225['options']);return db[_0x2aaa('0x29')][_0x2aaa('0x44')](_0x4ad537)['then'](handleEntityNotFound(_0x25b932,null))[_0x2aaa('0x22')](respondWithResult(_0x25b932,null))[_0x2aaa('0x45')](handleError(_0x25b932,null));};exports[_0x2aaa('0x46')]=function(_0x367a63,_0x745414){return db['FreshdeskField']['create'](_0x367a63['body'],{})[_0x2aaa('0x22')](respondWithResult(_0x745414,0xc9))[_0x2aaa('0x45')](handleError(_0x745414,null));};exports[_0x2aaa('0x21')]=function(_0x393073,_0x23290d){if(_0x393073[_0x2aaa('0x47')]['id']){delete _0x393073[_0x2aaa('0x47')]['id'];}return db[_0x2aaa('0x29')][_0x2aaa('0x44')]({'where':{'id':_0x393073['params']['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x23290d,null))[_0x2aaa('0x22')](saveUpdates(_0x393073[_0x2aaa('0x47')],null))[_0x2aaa('0x22')](respondWithResult(_0x23290d,null))['catch'](handleError(_0x23290d,null));};exports[_0x2aaa('0x23')]=function(_0xe935c3,_0x3906f8){return db['FreshdeskField']['find']({'where':{'id':_0xe935c3[_0x2aaa('0x41')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x3906f8,null))[_0x2aaa('0x22')](removeEntity(_0x3906f8,null))[_0x2aaa('0x45')](handleError(_0x3906f8,null));}; \ No newline at end of file +var _0xaaa2=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','type','key'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xaaa2,0xac));var _0x2aaa=function(_0x5e7693,_0x44aae1){_0x5e7693=_0x5e7693-0x0;var _0x3701e3=_0xaaa2[_0x5e7693];return _0x3701e3;};'use strict';var emlformat=require(_0x2aaa('0x0'));var rimraf=require(_0x2aaa('0x1'));var zipdir=require(_0x2aaa('0x2'));var jsonpatch=require(_0x2aaa('0x3'));var rp=require(_0x2aaa('0x4'));var moment=require(_0x2aaa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2aaa('0x6'));var util=require('util');var path=require(_0x2aaa('0x7'));var sox=require(_0x2aaa('0x8'));var csv=require(_0x2aaa('0x9'));var ejs=require(_0x2aaa('0xa'));var fs=require('fs');var fs_extra=require(_0x2aaa('0xb'));var _=require(_0x2aaa('0xc'));var squel=require('squel');var crypto=require(_0x2aaa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2aaa('0x9'));var querystring=require('querystring');var Papa=require(_0x2aaa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2aaa('0xf'));var as=require(_0x2aaa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aaa('0x11'))(_0x2aaa('0x12'));var utils=require(_0x2aaa('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2aaa('0x14'));var db=require(_0x2aaa('0x15'))['db'];function respondWithStatusCode(_0x8a5be3,_0x2b51f0){_0x2b51f0=_0x2b51f0||0xcc;return function(_0xd38d6d){if(_0xd38d6d){return _0x8a5be3[_0x2aaa('0x16')](_0x2b51f0);}return _0x8a5be3[_0x2aaa('0x17')](_0x2b51f0)[_0x2aaa('0x18')]();};}function respondWithResult(_0x32dfbf,_0xe22151){_0xe22151=_0xe22151||0xc8;return function(_0x314366){if(_0x314366){return _0x32dfbf[_0x2aaa('0x17')](_0xe22151)['json'](_0x314366);}};}function respondWithFilteredResult(_0x166321,_0x4df56b){return function(_0x35fbc1){if(_0x35fbc1){var _0x1a5573=typeof _0x4df56b['offset']==='undefined'&&typeof _0x4df56b['limit']===_0x2aaa('0x19');var _0x1dc0ba=_0x35fbc1[_0x2aaa('0x1a')];var _0x3b94bf=_0x1a5573?0x0:_0x4df56b[_0x2aaa('0x1b')];var _0xdaa445=_0x1a5573?_0x35fbc1[_0x2aaa('0x1a')]:_0x4df56b['offset']+_0x4df56b[_0x2aaa('0x1c')];var _0x30951c;if(_0xdaa445>=_0x1dc0ba){_0xdaa445=_0x1dc0ba;_0x30951c=0xc8;}else{_0x30951c=0xce;}_0x166321['status'](_0x30951c);return _0x166321[_0x2aaa('0x1d')]('Content-Range',_0x3b94bf+'-'+_0xdaa445+'/'+_0x1dc0ba)['json'](_0x35fbc1);}return null;};}function patchUpdates(_0x1ec32e){return function(_0x5052eb){try{jsonpatch[_0x2aaa('0x1e')](_0x5052eb,_0x1ec32e,!![]);}catch(_0x3e7649){return BPromise[_0x2aaa('0x1f')](_0x3e7649);}return _0x5052eb[_0x2aaa('0x20')]();};}function saveUpdates(_0x2c255f,_0x24da1e){return function(_0x4f581f){if(_0x4f581f){return _0x4f581f[_0x2aaa('0x21')](_0x2c255f)[_0x2aaa('0x22')](function(_0x4836b2){return _0x4836b2;});}return null;};}function removeEntity(_0x4d35aa,_0x19153e){return function(_0x4d7151){if(_0x4d7151){return _0x4d7151[_0x2aaa('0x23')]()[_0x2aaa('0x22')](function(){_0x4d35aa['status'](0xcc)[_0x2aaa('0x18')]();});}};}function handleEntityNotFound(_0x3b99d8,_0x4e1c0f){return function(_0x2ab888){if(!_0x2ab888){_0x3b99d8[_0x2aaa('0x16')](0x194);}return _0x2ab888;};}function handleError(_0x41253c,_0x5371cd){_0x5371cd=_0x5371cd||0x1f4;return function(_0x1f626b){logger[_0x2aaa('0x24')](_0x1f626b['stack']);if(_0x1f626b['name']){delete _0x1f626b[_0x2aaa('0x25')];}_0x41253c[_0x2aaa('0x17')](_0x5371cd)[_0x2aaa('0x26')](_0x1f626b);};}exports[_0x2aaa('0x27')]=function(_0x3a6a63,_0x292297){var _0x2f8305={},_0x166dc0={},_0x12cd47={'count':0x0,'rows':[]};var _0x19472b=_[_0x2aaa('0x28')](db[_0x2aaa('0x29')]['rawAttributes'],function(_0x101b6e){return{'name':_0x101b6e['fieldName'],'type':_0x101b6e[_0x2aaa('0x2a')][_0x2aaa('0x2b')]};});_0x166dc0[_0x2aaa('0x2c')]=_[_0x2aaa('0x28')](_0x19472b,_0x2aaa('0x25'));_0x166dc0[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x3a6a63[_0x2aaa('0x2d')]);_0x166dc0[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x166dc0['model'],_0x166dc0['query']);_0x2f8305['attributes']=_['intersection'](_0x166dc0['model'],qs[_0x2aaa('0x31')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x31')]));_0x2f8305[_0x2aaa('0x32')]=_0x2f8305[_0x2aaa('0x32')][_0x2aaa('0x33')]?_0x2f8305[_0x2aaa('0x32')]:_0x166dc0[_0x2aaa('0x2c')];if(!_0x3a6a63['query'][_0x2aaa('0x34')](_0x2aaa('0x35'))){_0x2f8305['limit']=qs[_0x2aaa('0x1c')](_0x3a6a63[_0x2aaa('0x2d')]['limit']);_0x2f8305[_0x2aaa('0x1b')]=qs[_0x2aaa('0x1b')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x1b')]);}_0x2f8305[_0x2aaa('0x36')]=qs[_0x2aaa('0x37')](_0x3a6a63[_0x2aaa('0x2d')]['sort']);_0x2f8305['where']=qs[_0x2aaa('0x2f')](_['pick'](_0x3a6a63[_0x2aaa('0x2d')],_0x166dc0[_0x2aaa('0x2f')]),_0x19472b);if(_0x3a6a63['query'][_0x2aaa('0x38')]){_0x2f8305[_0x2aaa('0x39')]=_[_0x2aaa('0x3a')](_0x2f8305['where'],{'$or':_[_0x2aaa('0x28')](_0x19472b,function(_0x337ae8){if(_0x337ae8[_0x2aaa('0x2a')]!==_0x2aaa('0x3b')){var _0x5023d2={};_0x5023d2[_0x337ae8[_0x2aaa('0x25')]]={'$like':'%'+_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x38')]+'%'};return _0x5023d2;}})});}_0x2f8305=_[_0x2aaa('0x3a')]({},_0x2f8305,_0x3a6a63[_0x2aaa('0x3c')]);var _0x362060={'where':_0x2f8305[_0x2aaa('0x39')]};return db[_0x2aaa('0x29')][_0x2aaa('0x1a')](_0x362060)[_0x2aaa('0x22')](function(_0x127f7e){_0x12cd47[_0x2aaa('0x1a')]=_0x127f7e;if(_0x3a6a63[_0x2aaa('0x2d')]['includeAll']){_0x2f8305[_0x2aaa('0x3d')]=[{'all':!![]}];}return db[_0x2aaa('0x29')][_0x2aaa('0x3e')](_0x2f8305);})['then'](function(_0x17042f){_0x12cd47[_0x2aaa('0x3f')]=_0x17042f;return _0x12cd47;})[_0x2aaa('0x22')](respondWithFilteredResult(_0x292297,_0x2f8305))['catch'](handleError(_0x292297,null));};exports[_0x2aaa('0x40')]=function(_0x1bb225,_0x25b932){var _0x4ad537={'raw':!![],'where':{'id':_0x1bb225[_0x2aaa('0x41')]['id']}},_0x57554e={};_0x57554e[_0x2aaa('0x2c')]=_[_0x2aaa('0x2e')](db['FreshdeskField'][_0x2aaa('0x42')]);_0x57554e[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x1bb225[_0x2aaa('0x2d')]);_0x57554e[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x57554e[_0x2aaa('0x2c')],_0x57554e[_0x2aaa('0x2d')]);_0x4ad537['attributes']=_['intersection'](_0x57554e[_0x2aaa('0x2c')],qs['fields'](_0x1bb225[_0x2aaa('0x2d')]['fields']));_0x4ad537['attributes']=_0x4ad537['attributes'][_0x2aaa('0x33')]?_0x4ad537[_0x2aaa('0x32')]:_0x57554e['model'];if(_0x1bb225[_0x2aaa('0x2d')][_0x2aaa('0x43')]){_0x4ad537['include']=[{'all':!![]}];}_0x4ad537=_[_0x2aaa('0x3a')]({},_0x4ad537,_0x1bb225['options']);return db[_0x2aaa('0x29')][_0x2aaa('0x44')](_0x4ad537)['then'](handleEntityNotFound(_0x25b932,null))[_0x2aaa('0x22')](respondWithResult(_0x25b932,null))[_0x2aaa('0x45')](handleError(_0x25b932,null));};exports[_0x2aaa('0x46')]=function(_0x367a63,_0x745414){return db['FreshdeskField']['create'](_0x367a63['body'],{})[_0x2aaa('0x22')](respondWithResult(_0x745414,0xc9))[_0x2aaa('0x45')](handleError(_0x745414,null));};exports[_0x2aaa('0x21')]=function(_0x393073,_0x23290d){if(_0x393073[_0x2aaa('0x47')]['id']){delete _0x393073[_0x2aaa('0x47')]['id'];}return db[_0x2aaa('0x29')][_0x2aaa('0x44')]({'where':{'id':_0x393073['params']['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x23290d,null))[_0x2aaa('0x22')](saveUpdates(_0x393073[_0x2aaa('0x47')],null))[_0x2aaa('0x22')](respondWithResult(_0x23290d,null))['catch'](handleError(_0x23290d,null));};exports[_0x2aaa('0x23')]=function(_0xe935c3,_0x3906f8){return db['FreshdeskField']['find']({'where':{'id':_0xe935c3[_0x2aaa('0x41')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x3906f8,null))[_0x2aaa('0x22')](removeEntity(_0x3906f8,null))[_0x2aaa('0x45')](handleError(_0x3906f8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 90a2c4c..714c8e4 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 _0x3329=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x3329,0x96));var _0x9332=function(_0xfabbf7,_0x1f3e92){_0xfabbf7=_0xfabbf7-0x0;var _0x38b2fe=_0x3329[_0xfabbf7];return _0x38b2fe;};'use strict';var _=require(_0x9332('0x0'));var util=require(_0x9332('0x1'));var logger=require(_0x9332('0x2'))('api');var moment=require(_0x9332('0x3'));var BPromise=require(_0x9332('0x4'));var rp=require(_0x9332('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9332('0x6'));var config=require(_0x9332('0x7'));var attributes=require(_0x9332('0x8'));module[_0x9332('0x9')]=function(_0x4b0ff0,_0xfb4d0d){return _0x4b0ff0[_0x9332('0xa')](_0x9332('0xb'),attributes,{'tableName':_0x9332('0xc'),'paranoid':![],'indexes':[{'name':_0x9332('0xd'),'fields':[_0x9332('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe852=['moment','bluebird','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xe852,0x123));var _0x2e85=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe852[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0x2e85('0x0'));var logger=require(_0x2e85('0x1'))(_0x2e85('0x2'));var moment=require(_0x2e85('0x3'));var BPromise=require(_0x2e85('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e85('0x5'));var config=require(_0x2e85('0x6'));var attributes=require(_0x2e85('0x7'));module[_0x2e85('0x8')]=function(_0x2ca9f5,_0x26cc44){return _0x2ca9f5[_0x2e85('0x9')](_0x2e85('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x2e85('0xb'),'fields':[_0x2e85('0xc'),_0x2e85('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index e109162..32ed2d7 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 _0x8b59=['then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5cbb32,_0x233ace){var _0x49363c=function(_0x4649d1){while(--_0x4649d1){_0x5cbb32['push'](_0x5cbb32['shift']());}};_0x49363c(++_0x233ace);}(_0x8b59,0x1d7));var _0x98b5=function(_0x491b84,_0x5dd817){_0x491b84=_0x491b84-0x0;var _0x20f81c=_0x8b59[_0x491b84];return _0x20f81c;};'use strict';var _=require(_0x98b5('0x0'));var util=require(_0x98b5('0x1'));var moment=require('moment');var BPromise=require(_0x98b5('0x2'));var rs=require(_0x98b5('0x3'));var fs=require('fs');var Redis=require(_0x98b5('0x4'));var db=require(_0x98b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x98b5('0x6'))(_0x98b5('0x7'));var config=require(_0x98b5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x98b5('0x9')][_0x98b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x552386,_0x58ed31,_0xeab5d4){return new BPromise(function(_0xa596cd,_0x4bf99c){return client[_0x98b5('0xb')](_0x552386,_0xeab5d4)[_0x98b5('0xc')](function(_0x15198e){logger[_0x98b5('0xd')](_0x98b5('0xe'),_0x58ed31,_0x98b5('0xf'));logger[_0x98b5('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x58ed31,_0x98b5('0xf'),JSON['stringify'](_0x15198e));if(_0x15198e[_0x98b5('0x11')]){if(_0x15198e[_0x98b5('0x11')][_0x98b5('0x12')]===0x1f4){logger[_0x98b5('0x11')](_0x98b5('0xe'),_0x58ed31,_0x15198e['error'][_0x98b5('0x13')]);return _0x4bf99c(_0x15198e[_0x98b5('0x11')][_0x98b5('0x13')]);}logger[_0x98b5('0x11')](_0x98b5('0xe'),_0x58ed31,_0x15198e['error'][_0x98b5('0x13')]);return _0xa596cd(_0x15198e[_0x98b5('0x11')][_0x98b5('0x13')]);}else{logger[_0x98b5('0xd')](_0x98b5('0xe'),_0x58ed31,_0x98b5('0xf'));_0xa596cd(_0x15198e['result'][_0x98b5('0x13')]);}})[_0x98b5('0x14')](function(_0xf00878){logger[_0x98b5('0x11')](_0x98b5('0xe'),_0x58ed31,_0xf00878);_0x4bf99c(_0xf00878);});});} \ No newline at end of file +var _0x3b59=['lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x342030,_0xf3d901){var _0x31fdfb=function(_0x443457){while(--_0x443457){_0x342030['push'](_0x342030['shift']());}};_0x31fdfb(++_0xf3d901);}(_0x3b59,0x64));var _0x93b5=function(_0x1083f0,_0x190add){_0x1083f0=_0x1083f0-0x0;var _0x3e671f=_0x3b59[_0x1083f0];return _0x3e671f;};'use strict';var _=require(_0x93b5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x93b5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93b5('0x2'))['db'];var utils=require(_0x93b5('0x3'));var logger=require('../../config/logger')(_0x93b5('0x4'));var config=require(_0x93b5('0x5'));var jayson=require(_0x93b5('0x6'));var client=jayson[_0x93b5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35385b,_0x771590,_0x313345){return new BPromise(function(_0x28d3a7,_0x14de92){return client[_0x93b5('0x8')](_0x35385b,_0x313345)[_0x93b5('0x9')](function(_0xda8527){logger[_0x93b5('0xa')](_0x93b5('0xb'),_0x771590,_0x93b5('0xc'));logger[_0x93b5('0xd')](_0x93b5('0xe'),_0x771590,'request\x20sent',JSON['stringify'](_0xda8527));if(_0xda8527[_0x93b5('0xf')]){if(_0xda8527['error'][_0x93b5('0x10')]===0x1f4){logger[_0x93b5('0xf')](_0x93b5('0xb'),_0x771590,_0xda8527[_0x93b5('0xf')][_0x93b5('0x11')]);return _0x14de92(_0xda8527[_0x93b5('0xf')][_0x93b5('0x11')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x771590,_0xda8527['error']['message']);return _0x28d3a7(_0xda8527['error'][_0x93b5('0x11')]);}else{logger[_0x93b5('0xa')]('FreshdeskField,\x20%s,\x20%s',_0x771590,'request\x20sent');_0x28d3a7(_0xda8527[_0x93b5('0x12')][_0x93b5('0x11')]);}})[_0x93b5('0x13')](function(_0x12c77a){logger[_0x93b5('0xf')](_0x93b5('0xb'),_0x771590,_0x12c77a);_0x14de92(_0x12c77a);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a61801d..db0552e 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 _0xaa88=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','/:id','isAuthenticated','show','get','getConfigurations','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa88,0x137));var _0x8aa8=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0xaa88[_0x1a37e3];return _0x4db78a;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id/configurations',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0xe')]('/:id/fields',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x11')]('/',auth[_0x8aa8('0xc')](),controller['create']);router[_0x8aa8('0x11')](_0x8aa8('0x12'),auth['isAuthenticated'](),controller[_0x8aa8('0x13')]);router[_0x8aa8('0x14')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);router[_0x8aa8('0x16')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe205=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xe205,0xa7));var _0x5e20=function(_0x1d40b3,_0x35397f){_0x1d40b3=_0x1d40b3-0x0;var _0x18129d=_0xe205[_0x1d40b3];return _0x18129d;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/:id',auth[_0x5e20('0xb')](),controller['show']);router['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['getConfigurations']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0x10')]);router[_0x5e20('0x11')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller[_0x5e20('0x12')]);router['put'](_0x5e20('0x13'),auth[_0x5e20('0xb')](),controller[_0x5e20('0x14')]);router['delete'](_0x5e20('0x13'),auth['isAuthenticated'](),controller[_0x5e20('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 491b245..1f12b07 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 _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x2265da,_0xfbbd2e){var _0x430c2b=function(_0x20d671){while(--_0x20d671){_0x2265da['push'](_0x2265da['shift']());}};_0x430c2b(++_0xfbbd2e);}(_0xadb5,0xad));var _0x5adb=function(_0x57907a,_0x238adc){_0x57907a=_0x57907a-0x0;var _0x5f5423=_0xadb5[_0x57907a];return _0x5f5423;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x77d4=['exports','STRING','username'];(function(_0x3c719e,_0x19719d){var _0x2d09af=function(_0x5b1e8a){while(--_0x5b1e8a){_0x3c719e['push'](_0x3c719e['shift']());}};_0x2d09af(++_0x19719d);}(_0x77d4,0x108));var _0x477d=function(_0x2bd66c,_0x4c3f5d){_0x2bd66c=_0x2bd66c-0x0;var _0x2cdcf5=_0x77d4[_0x2bd66c];return _0x2cdcf5;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x477d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x477d('0x2')},'apiKey':{'type':Sequelize[_0x477d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x477d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index de3a850..3e29fd9 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 _0x8377=['username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s%s','Token\x20token=','Requested\x20Resource\x20not\x20Found','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','merge','filter','FreshsalesAccount','include','rows','params','includeAll','options','catch','create','body','find','destroy','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','getDescriptions','FreshsalesField','Subjects'];(function(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0x8377,0x138));var _0x7837=function(_0x20945a,_0x1c99ad){_0x20945a=_0x20945a-0x0;var _0x260522=_0x8377[_0x20945a];return _0x260522;};'use strict';var emlformat=require(_0x7837('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7837('0x1'));var rp=require(_0x7837('0x2'));var moment=require(_0x7837('0x3'));var BPromise=require(_0x7837('0x4'));var Mustache=require('mustache');var util=require(_0x7837('0x5'));var path=require('path');var sox=require(_0x7837('0x6'));var csv=require(_0x7837('0x7'));var ejs=require(_0x7837('0x8'));var fs=require('fs');var fs_extra=require(_0x7837('0x9'));var _=require('lodash');var squel=require(_0x7837('0xa'));var crypto=require(_0x7837('0xb'));var jsforce=require(_0x7837('0xc'));var deskjs=require(_0x7837('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7837('0xe'));var Papa=require(_0x7837('0xf'));var Redis=require(_0x7837('0x10'));var authService=require(_0x7837('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7837('0x12'));var hardwareService=require(_0x7837('0x13'));var logger=require(_0x7837('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7837('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7837('0x16'))['db'];var integrations=require(_0x7837('0x17'));function respondWithStatusCode(_0x40ebc9,_0x55b17a){_0x55b17a=_0x55b17a||0xcc;return function(_0x4c6b36){if(_0x4c6b36){return _0x40ebc9['sendStatus'](_0x55b17a);}return _0x40ebc9['status'](_0x55b17a)[_0x7837('0x18')]();};}function respondWithResult(_0x327dc1,_0x51fb07){_0x51fb07=_0x51fb07||0xc8;return function(_0x57f449){if(_0x57f449){return _0x327dc1[_0x7837('0x19')](_0x51fb07)[_0x7837('0x1a')](_0x57f449);}};}function respondWithFilteredResult(_0x53ac98,_0x25485d){return function(_0x175c62){if(_0x175c62){var _0x4a4a99=typeof _0x25485d[_0x7837('0x1b')]===_0x7837('0x1c')&&typeof _0x25485d[_0x7837('0x1d')]===_0x7837('0x1c');var _0x49c3bf=_0x175c62[_0x7837('0x1e')];var _0x273bff=_0x4a4a99?0x0:_0x25485d['offset'];var _0xf526c8=_0x4a4a99?_0x175c62['count']:_0x25485d[_0x7837('0x1b')]+_0x25485d['limit'];var _0x3a0533;if(_0xf526c8>=_0x49c3bf){_0xf526c8=_0x49c3bf;_0x3a0533=0xc8;}else{_0x3a0533=0xce;}_0x53ac98[_0x7837('0x19')](_0x3a0533);return _0x53ac98['set'](_0x7837('0x1f'),_0x273bff+'-'+_0xf526c8+'/'+_0x49c3bf)['json'](_0x175c62);}return null;};}function patchUpdates(_0x1ae04e){return function(_0x290d2b){try{jsonpatch[_0x7837('0x20')](_0x290d2b,_0x1ae04e,!![]);}catch(_0xa3e78a){return BPromise[_0x7837('0x21')](_0xa3e78a);}return _0x290d2b[_0x7837('0x22')]();};}function saveUpdates(_0x3d3807,_0x45a924){return function(_0x22ca36){if(_0x22ca36){return _0x22ca36[_0x7837('0x23')](_0x3d3807)[_0x7837('0x24')](function(_0x3a6487){return _0x3a6487;});}return null;};}function removeEntity(_0x1b6b41,_0x57d53f){return function(_0x585311){if(_0x585311){return _0x585311['destroy']()[_0x7837('0x24')](function(){_0x1b6b41[_0x7837('0x19')](0xcc)[_0x7837('0x18')]();});}};}function handleEntityNotFound(_0x544a86,_0x5bdb2e){return function(_0x35c9cd){if(!_0x35c9cd){_0x544a86[_0x7837('0x25')](0x194);}return _0x35c9cd;};}function handleError(_0x3137fc,_0xfeb3da){_0xfeb3da=_0xfeb3da||0x1f4;return function(_0x3acb94){logger['error'](_0x3acb94[_0x7837('0x26')]);if(_0x3acb94[_0x7837('0x27')]){delete _0x3acb94[_0x7837('0x27')];}_0x3137fc[_0x7837('0x19')](_0xfeb3da)[_0x7837('0x28')](_0x3acb94);};}exports[_0x7837('0x29')]=function(_0x901307,_0x1f6d0b){var _0x286439={},_0x40d5f0={},_0x48b4bf={'count':0x0,'rows':[]};var _0x19f8ff=_[_0x7837('0x2a')](db['FreshsalesAccount'][_0x7837('0x2b')],function(_0x595925){return{'name':_0x595925[_0x7837('0x2c')],'type':_0x595925[_0x7837('0x2d')][_0x7837('0x2e')]};});_0x40d5f0[_0x7837('0x2f')]=_[_0x7837('0x2a')](_0x19f8ff,_0x7837('0x27'));_0x40d5f0[_0x7837('0x30')]=_[_0x7837('0x31')](_0x901307[_0x7837('0x30')]);_0x40d5f0['filters']=_['intersection'](_0x40d5f0[_0x7837('0x2f')],_0x40d5f0[_0x7837('0x30')]);_0x286439['attributes']=_[_0x7837('0x32')](_0x40d5f0[_0x7837('0x2f')],qs['fields'](_0x901307[_0x7837('0x30')][_0x7837('0x33')]));_0x286439[_0x7837('0x34')]=_0x286439[_0x7837('0x34')][_0x7837('0x35')]?_0x286439[_0x7837('0x34')]:_0x40d5f0[_0x7837('0x2f')];if(!_0x901307[_0x7837('0x30')]['hasOwnProperty'](_0x7837('0x36'))){_0x286439[_0x7837('0x1d')]=qs[_0x7837('0x1d')](_0x901307[_0x7837('0x30')][_0x7837('0x1d')]);_0x286439['offset']=qs[_0x7837('0x1b')](_0x901307[_0x7837('0x30')][_0x7837('0x1b')]);}_0x286439[_0x7837('0x37')]=qs[_0x7837('0x38')](_0x901307[_0x7837('0x30')][_0x7837('0x38')]);_0x286439[_0x7837('0x39')]=qs['filters'](_[_0x7837('0x3a')](_0x901307['query'],_0x40d5f0[_0x7837('0x3b')]),_0x19f8ff);if(_0x901307[_0x7837('0x30')]['filter']){_0x286439[_0x7837('0x39')]=_[_0x7837('0x3c')](_0x286439[_0x7837('0x39')],{'$or':_[_0x7837('0x2a')](_0x19f8ff,function(_0x3f3c27){if(_0x3f3c27[_0x7837('0x2d')]!=='VIRTUAL'){var _0x28ac0f={};_0x28ac0f[_0x3f3c27[_0x7837('0x27')]]={'$like':'%'+_0x901307[_0x7837('0x30')][_0x7837('0x3d')]+'%'};return _0x28ac0f;}})});}_0x286439=_[_0x7837('0x3c')]({},_0x286439,_0x901307['options']);var _0x3265fa={'where':_0x286439[_0x7837('0x39')]};return db[_0x7837('0x3e')]['count'](_0x3265fa)['then'](function(_0x4d6d9c){_0x48b4bf['count']=_0x4d6d9c;if(_0x901307[_0x7837('0x30')]['includeAll']){_0x286439[_0x7837('0x3f')]=[{'all':!![]}];}return db[_0x7837('0x3e')]['findAll'](_0x286439);})[_0x7837('0x24')](function(_0x373e7b){_0x48b4bf[_0x7837('0x40')]=_0x373e7b;return _0x48b4bf;})['then'](respondWithFilteredResult(_0x1f6d0b,_0x286439))['catch'](handleError(_0x1f6d0b,null));};exports['show']=function(_0x516cc3,_0x48a3e7){var _0x2839f5={'raw':![],'where':{'id':_0x516cc3[_0x7837('0x41')]['id']}},_0x1914b2={};_0x1914b2[_0x7837('0x2f')]=_[_0x7837('0x31')](db['FreshsalesAccount'][_0x7837('0x2b')]);_0x1914b2[_0x7837('0x30')]=_[_0x7837('0x31')](_0x516cc3[_0x7837('0x30')]);_0x1914b2[_0x7837('0x3b')]=_[_0x7837('0x32')](_0x1914b2[_0x7837('0x2f')],_0x1914b2['query']);_0x2839f5[_0x7837('0x34')]=_[_0x7837('0x32')](_0x1914b2[_0x7837('0x2f')],qs[_0x7837('0x33')](_0x516cc3['query'][_0x7837('0x33')]));_0x2839f5[_0x7837('0x34')]=_0x2839f5[_0x7837('0x34')][_0x7837('0x35')]?_0x2839f5[_0x7837('0x34')]:_0x1914b2[_0x7837('0x2f')];if(_0x516cc3[_0x7837('0x30')][_0x7837('0x42')]){_0x2839f5[_0x7837('0x3f')]=[{'all':!![]}];}_0x2839f5=_[_0x7837('0x3c')]({},_0x2839f5,_0x516cc3[_0x7837('0x43')]);return db['FreshsalesAccount']['find'](_0x2839f5)[_0x7837('0x24')](handleEntityNotFound(_0x48a3e7,null))['then'](respondWithResult(_0x48a3e7,null))[_0x7837('0x44')](handleError(_0x48a3e7,null));};exports[_0x7837('0x45')]=function(_0x2cc225,_0x59ee9e){return db[_0x7837('0x3e')][_0x7837('0x45')](_0x2cc225['body'],{})[_0x7837('0x24')](respondWithResult(_0x59ee9e,0xc9))[_0x7837('0x44')](handleError(_0x59ee9e,null));};exports['update']=function(_0x286bcc,_0x2d191c){if(_0x286bcc[_0x7837('0x46')]['id']){delete _0x286bcc['body']['id'];}return db[_0x7837('0x3e')][_0x7837('0x47')]({'where':{'id':_0x286bcc[_0x7837('0x41')]['id']}})[_0x7837('0x24')](handleEntityNotFound(_0x2d191c,null))['then'](saveUpdates(_0x286bcc[_0x7837('0x46')],null))[_0x7837('0x24')](respondWithResult(_0x2d191c,null))['catch'](handleError(_0x2d191c,null));};exports[_0x7837('0x48')]=function(_0x108e08,_0x484573){return db[_0x7837('0x3e')]['find']({'where':{'id':_0x108e08[_0x7837('0x41')]['id']}})[_0x7837('0x24')](handleEntityNotFound(_0x484573,null))[_0x7837('0x24')](removeEntity(_0x484573,null))[_0x7837('0x44')](handleError(_0x484573,null));};exports[_0x7837('0x49')]=function(_0x26d9cb,_0x120c57,_0x5156e9){var _0x24e0cf={};var _0x25bf67={};var _0x14aabc;var _0xe8c2dd;return db['FreshsalesAccount'][_0x7837('0x4a')]({'where':{'id':_0x26d9cb[_0x7837('0x41')]['id']}})[_0x7837('0x24')](handleEntityNotFound(_0x120c57,null))[_0x7837('0x24')](function(_0x2b4934){if(_0x2b4934){_0x14aabc=_0x2b4934;_0x25bf67[_0x7837('0x2f')]=_['keys'](db[_0x7837('0x4b')]['rawAttributes']);_0x25bf67['query']=_[_0x7837('0x31')](_0x26d9cb[_0x7837('0x30')]);_0x25bf67['filters']=_['intersection'](_0x25bf67[_0x7837('0x2f')],_0x25bf67[_0x7837('0x30')]);_0x24e0cf[_0x7837('0x34')]=_[_0x7837('0x32')](_0x25bf67[_0x7837('0x2f')],qs['fields'](_0x26d9cb[_0x7837('0x30')][_0x7837('0x33')]));_0x24e0cf[_0x7837('0x34')]=_0x24e0cf[_0x7837('0x34')][_0x7837('0x35')]?_0x24e0cf[_0x7837('0x34')]:_0x25bf67['model'];_0x24e0cf[_0x7837('0x37')]=qs[_0x7837('0x38')](_0x26d9cb[_0x7837('0x30')]['sort']);_0x24e0cf[_0x7837('0x39')]=qs[_0x7837('0x3b')](_[_0x7837('0x3a')](_0x26d9cb['query'],_0x25bf67[_0x7837('0x3b')]));if(_0x26d9cb[_0x7837('0x30')][_0x7837('0x3d')]){_0x24e0cf[_0x7837('0x39')]=_[_0x7837('0x3c')](_0x24e0cf[_0x7837('0x39')],{'$or':_['map'](_0x24e0cf[_0x7837('0x34')],function(_0x36003e){var _0x13751a={};_0x13751a[_0x36003e]={'$like':'%'+_0x26d9cb['query'][_0x7837('0x3d')]+'%'};return _0x13751a;})});}_0x24e0cf=_[_0x7837('0x3c')]({},_0x24e0cf,_0x26d9cb['options']);return _0x14aabc[_0x7837('0x49')](_0x24e0cf);}})[_0x7837('0x24')](function(_0x57b9bb){if(_0x57b9bb){_0xe8c2dd=_0x57b9bb['length'];if(!_0x26d9cb['query'][_0x7837('0x4c')](_0x7837('0x36'))){_0x24e0cf[_0x7837('0x1d')]=qs['limit'](_0x26d9cb[_0x7837('0x30')][_0x7837('0x1d')]);_0x24e0cf[_0x7837('0x1b')]=qs[_0x7837('0x1b')](_0x26d9cb[_0x7837('0x30')][_0x7837('0x1b')]);}return _0x14aabc[_0x7837('0x49')](_0x24e0cf);}})['then'](function(_0xaabd40){if(_0xaabd40){return _0xaabd40?{'count':_0xe8c2dd,'rows':_0xaabd40}:null;}})['then'](respondWithResult(_0x120c57,null))[_0x7837('0x44')](handleError(_0x120c57,null));};exports[_0x7837('0x4d')]=function(_0x166509,_0x3efca3,_0x323516){if(_0x166509[_0x7837('0x46')]['id']){delete _0x166509[_0x7837('0x46')]['id'];}return db[_0x7837('0x3e')]['findOne']({'where':{'id':_0x166509[_0x7837('0x41')]['id']}})['then'](handleEntityNotFound(_0x3efca3,null))['then'](function(_0x14ff2a){if(_0x14ff2a){_0x166509[_0x7837('0x46')][_0x7837('0x4e')]=_0x14ff2a['id'];_0x166509['body']['Subjects']=integrations['getSubjects'](_0x166509[_0x7837('0x46')][_0x7837('0x4f')],_0x166509[_0x7837('0x46')][_0x7837('0x2d')]);_0x166509[_0x7837('0x46')][_0x7837('0x50')]=integrations[_0x7837('0x51')](_0x166509[_0x7837('0x46')][_0x7837('0x4f')],_0x166509['body'][_0x7837('0x2d')]);return db[_0x7837('0x4b')][_0x7837('0x45')](_0x166509[_0x7837('0x46')],{'include':[{'model':db[_0x7837('0x52')],'as':_0x7837('0x53')},{'model':db[_0x7837('0x52')],'as':_0x7837('0x50')}]});}return null;})[_0x7837('0x24')](respondWithResult(_0x3efca3,null))[_0x7837('0x44')](handleError(_0x3efca3,null));};exports['getFields']=function(_0x348078,_0xc5c2e2,_0x53a8ce){var _0x37bd00='';var _0x338623='';return db[_0x7837('0x3e')][_0x7837('0x4a')]({'where':{'id':_0x348078[_0x7837('0x41')]['id']},'attributes':['id',_0x7837('0x54'),_0x7837('0x55'),_0x7837('0x56')]})[_0x7837('0x24')](handleEntityNotFound(_0xc5c2e2,null))[_0x7837('0x24')](function(_0x18228c){if(_0x18228c){_0x338623=_0x18228c[_0x7837('0x54')];_0x37bd00=_0x18228c[_0x7837('0x55')];var _0x23e07c=_0x18228c[_0x7837('0x55')][_0x7837('0x57')](-0x1);if(_0x23e07c==='/'){_0x37bd00=_0x37bd00[_0x7837('0x58')](0x0,_0x37bd00[_0x7837('0x59')](_0x23e07c));}return rp({'method':_0x7837('0x5a'),'uri':util['format'](_0x7837('0x5b'),_0x37bd00,'/api/selector/owners'),'headers':{'Authorization':_0x7837('0x5c')+_0x18228c[_0x7837('0x56')]},'json':!![]});}})[_0x7837('0x24')](function(_0x2ebf4a){if(_0x2ebf4a){var _0x3b36a5=_0x2ebf4a['users'];var _0x2e6198=![];var _0x1746d8=null;for(_0x1746d8=0x0;_0x1746d8<_0x3b36a5[_0x7837('0x35')];_0x1746d8++){if(_0x3b36a5[_0x1746d8]['email']===_0x338623){_0x2e6198=!![];}}if(_0x2e6198){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7837('0x5d')});}}})['then'](respondWithResult(_0xc5c2e2,null))['catch'](function(_0x534a1d){var _0x40ed68=_0x348078[_0x7837('0x30')][_0x7837('0x5e')]?0x1f4:_0x534a1d[_0x7837('0x5f')]||0x1f4;logger[_0x7837('0x60')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x40ed68,JSON[_0x7837('0x61')](_0x534a1d));delete _0x534a1d[_0x7837('0x27')];if(_0x40ed68===0x191){_0x40ed68=0x190;}_0xc5c2e2[_0x7837('0x19')](_0x40ed68)['send'](_0x348078['query'][_0x7837('0x5e')]?{'message':_0x7837('0x62'),'statusCode':_0x534a1d['statusCode']}:_0x534a1d);});}; \ No newline at end of file +var _0x9b5a=['mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','includeAll','options','find','create','catch','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshsalesConfiguration','FreshsalesField','Descriptions','getFields','username','remoteUri','substring','GET','format','%s%s','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x38b78b,_0x110ea6){var _0x55a5ce=function(_0x23d241){while(--_0x23d241){_0x38b78b['push'](_0x38b78b['shift']());}};_0x55a5ce(++_0x110ea6);}(_0x9b5a,0x129));var _0xa9b5=function(_0x22b398,_0x28095d){_0x22b398=_0x22b398-0x0;var _0x34276f=_0x9b5a[_0x22b398];return _0x34276f;};'use strict';var emlformat=require(_0xa9b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9b5('0x1'));var jsonpatch=require(_0xa9b5('0x2'));var rp=require(_0xa9b5('0x3'));var moment=require(_0xa9b5('0x4'));var BPromise=require(_0xa9b5('0x5'));var Mustache=require(_0xa9b5('0x6'));var util=require(_0xa9b5('0x7'));var path=require(_0xa9b5('0x8'));var sox=require(_0xa9b5('0x9'));var csv=require(_0xa9b5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa9b5('0xb'));var squel=require(_0xa9b5('0xc'));var crypto=require(_0xa9b5('0xd'));var jsforce=require(_0xa9b5('0xe'));var deskjs=require(_0xa9b5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa9b5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9b5('0x11'));var logger=require(_0xa9b5('0x12'))('api');var utils=require(_0xa9b5('0x13'));var config=require(_0xa9b5('0x14'));var licenseUtil=require(_0xa9b5('0x15'));var db=require(_0xa9b5('0x16'))['db'];var integrations=require(_0xa9b5('0x17'));function respondWithStatusCode(_0x42656c,_0x491828){_0x491828=_0x491828||0xcc;return function(_0x7f532a){if(_0x7f532a){return _0x42656c[_0xa9b5('0x18')](_0x491828);}return _0x42656c[_0xa9b5('0x19')](_0x491828)[_0xa9b5('0x1a')]();};}function respondWithResult(_0x319547,_0x328c39){_0x328c39=_0x328c39||0xc8;return function(_0x37afe6){if(_0x37afe6){return _0x319547[_0xa9b5('0x19')](_0x328c39)[_0xa9b5('0x1b')](_0x37afe6);}};}function respondWithFilteredResult(_0x584e19,_0x3c992e){return function(_0x136127){if(_0x136127){var _0xd6a1b7=typeof _0x3c992e['offset']===_0xa9b5('0x1c')&&typeof _0x3c992e[_0xa9b5('0x1d')]===_0xa9b5('0x1c');var _0x3aabab=_0x136127['count'];var _0x20cb7f=_0xd6a1b7?0x0:_0x3c992e['offset'];var _0x13b981=_0xd6a1b7?_0x136127[_0xa9b5('0x1e')]:_0x3c992e[_0xa9b5('0x1f')]+_0x3c992e['limit'];var _0x1b5b77;if(_0x13b981>=_0x3aabab){_0x13b981=_0x3aabab;_0x1b5b77=0xc8;}else{_0x1b5b77=0xce;}_0x584e19[_0xa9b5('0x19')](_0x1b5b77);return _0x584e19[_0xa9b5('0x20')](_0xa9b5('0x21'),_0x20cb7f+'-'+_0x13b981+'/'+_0x3aabab)[_0xa9b5('0x1b')](_0x136127);}return null;};}function patchUpdates(_0x58746c){return function(_0xd50c5b){try{jsonpatch['apply'](_0xd50c5b,_0x58746c,!![]);}catch(_0x3e1f36){return BPromise[_0xa9b5('0x22')](_0x3e1f36);}return _0xd50c5b[_0xa9b5('0x23')]();};}function saveUpdates(_0x4df124,_0x1e2627){return function(_0xdce162){if(_0xdce162){return _0xdce162[_0xa9b5('0x24')](_0x4df124)[_0xa9b5('0x25')](function(_0x2501b3){return _0x2501b3;});}return null;};}function removeEntity(_0x1490ea,_0x2f5b5e){return function(_0x577b26){if(_0x577b26){return _0x577b26['destroy']()[_0xa9b5('0x25')](function(){_0x1490ea[_0xa9b5('0x19')](0xcc)[_0xa9b5('0x1a')]();});}};}function handleEntityNotFound(_0x33c33f,_0x5c8b69){return function(_0x3b2acf){if(!_0x3b2acf){_0x33c33f[_0xa9b5('0x18')](0x194);}return _0x3b2acf;};}function handleError(_0x3afbea,_0x56a1fd){_0x56a1fd=_0x56a1fd||0x1f4;return function(_0x304f3d){logger[_0xa9b5('0x26')](_0x304f3d[_0xa9b5('0x27')]);if(_0x304f3d[_0xa9b5('0x28')]){delete _0x304f3d[_0xa9b5('0x28')];}_0x3afbea[_0xa9b5('0x19')](_0x56a1fd)[_0xa9b5('0x29')](_0x304f3d);};}exports[_0xa9b5('0x2a')]=function(_0x2b4f34,_0xef4807){var _0x24aa5f={},_0x3d9014={},_0x477d31={'count':0x0,'rows':[]};var _0x39791e=_[_0xa9b5('0x2b')](db[_0xa9b5('0x2c')][_0xa9b5('0x2d')],function(_0x636d6e){return{'name':_0x636d6e[_0xa9b5('0x2e')],'type':_0x636d6e[_0xa9b5('0x2f')][_0xa9b5('0x30')]};});_0x3d9014[_0xa9b5('0x31')]=_['map'](_0x39791e,'name');_0x3d9014[_0xa9b5('0x32')]=_[_0xa9b5('0x33')](_0x2b4f34[_0xa9b5('0x32')]);_0x3d9014['filters']=_[_0xa9b5('0x34')](_0x3d9014[_0xa9b5('0x31')],_0x3d9014[_0xa9b5('0x32')]);_0x24aa5f[_0xa9b5('0x35')]=_[_0xa9b5('0x34')](_0x3d9014[_0xa9b5('0x31')],qs[_0xa9b5('0x36')](_0x2b4f34[_0xa9b5('0x32')][_0xa9b5('0x36')]));_0x24aa5f['attributes']=_0x24aa5f[_0xa9b5('0x35')][_0xa9b5('0x37')]?_0x24aa5f[_0xa9b5('0x35')]:_0x3d9014[_0xa9b5('0x31')];if(!_0x2b4f34[_0xa9b5('0x32')][_0xa9b5('0x38')]('nolimit')){_0x24aa5f[_0xa9b5('0x1d')]=qs[_0xa9b5('0x1d')](_0x2b4f34[_0xa9b5('0x32')]['limit']);_0x24aa5f[_0xa9b5('0x1f')]=qs['offset'](_0x2b4f34[_0xa9b5('0x32')][_0xa9b5('0x1f')]);}_0x24aa5f[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_0x2b4f34[_0xa9b5('0x32')][_0xa9b5('0x3a')]);_0x24aa5f[_0xa9b5('0x3b')]=qs[_0xa9b5('0x3c')](_[_0xa9b5('0x3d')](_0x2b4f34[_0xa9b5('0x32')],_0x3d9014[_0xa9b5('0x3c')]),_0x39791e);if(_0x2b4f34['query'][_0xa9b5('0x3e')]){_0x24aa5f[_0xa9b5('0x3b')]=_['merge'](_0x24aa5f['where'],{'$or':_[_0xa9b5('0x2b')](_0x39791e,function(_0x4a49b0){if(_0x4a49b0[_0xa9b5('0x2f')]!==_0xa9b5('0x3f')){var _0x3f4dbf={};_0x3f4dbf[_0x4a49b0['name']]={'$like':'%'+_0x2b4f34[_0xa9b5('0x32')][_0xa9b5('0x3e')]+'%'};return _0x3f4dbf;}})});}_0x24aa5f=_[_0xa9b5('0x40')]({},_0x24aa5f,_0x2b4f34['options']);var _0x3b1e37={'where':_0x24aa5f['where']};return db['FreshsalesAccount'][_0xa9b5('0x1e')](_0x3b1e37)[_0xa9b5('0x25')](function(_0x4e4e53){_0x477d31[_0xa9b5('0x1e')]=_0x4e4e53;if(_0x2b4f34[_0xa9b5('0x32')]['includeAll']){_0x24aa5f[_0xa9b5('0x41')]=[{'all':!![]}];}return db[_0xa9b5('0x2c')][_0xa9b5('0x42')](_0x24aa5f);})[_0xa9b5('0x25')](function(_0x536b94){_0x477d31[_0xa9b5('0x43')]=_0x536b94;return _0x477d31;})[_0xa9b5('0x25')](respondWithFilteredResult(_0xef4807,_0x24aa5f))['catch'](handleError(_0xef4807,null));};exports[_0xa9b5('0x44')]=function(_0x224447,_0x3f376b){var _0x344026={'raw':![],'where':{'id':_0x224447[_0xa9b5('0x45')]['id']}},_0x3874ec={};_0x3874ec[_0xa9b5('0x31')]=_[_0xa9b5('0x33')](db[_0xa9b5('0x2c')][_0xa9b5('0x2d')]);_0x3874ec['query']=_[_0xa9b5('0x33')](_0x224447[_0xa9b5('0x32')]);_0x3874ec[_0xa9b5('0x3c')]=_[_0xa9b5('0x34')](_0x3874ec[_0xa9b5('0x31')],_0x3874ec[_0xa9b5('0x32')]);_0x344026[_0xa9b5('0x35')]=_[_0xa9b5('0x34')](_0x3874ec[_0xa9b5('0x31')],qs[_0xa9b5('0x36')](_0x224447[_0xa9b5('0x32')][_0xa9b5('0x36')]));_0x344026[_0xa9b5('0x35')]=_0x344026['attributes'][_0xa9b5('0x37')]?_0x344026[_0xa9b5('0x35')]:_0x3874ec[_0xa9b5('0x31')];if(_0x224447[_0xa9b5('0x32')][_0xa9b5('0x46')]){_0x344026[_0xa9b5('0x41')]=[{'all':!![]}];}_0x344026=_[_0xa9b5('0x40')]({},_0x344026,_0x224447[_0xa9b5('0x47')]);return db['FreshsalesAccount'][_0xa9b5('0x48')](_0x344026)[_0xa9b5('0x25')](handleEntityNotFound(_0x3f376b,null))[_0xa9b5('0x25')](respondWithResult(_0x3f376b,null))['catch'](handleError(_0x3f376b,null));};exports[_0xa9b5('0x49')]=function(_0x14d68d,_0x3ea06b){return db[_0xa9b5('0x2c')][_0xa9b5('0x49')](_0x14d68d['body'],{})['then'](respondWithResult(_0x3ea06b,0xc9))[_0xa9b5('0x4a')](handleError(_0x3ea06b,null));};exports[_0xa9b5('0x24')]=function(_0x5313fc,_0x3a75bc){if(_0x5313fc[_0xa9b5('0x4b')]['id']){delete _0x5313fc['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x5313fc[_0xa9b5('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a75bc,null))['then'](saveUpdates(_0x5313fc[_0xa9b5('0x4b')],null))[_0xa9b5('0x25')](respondWithResult(_0x3a75bc,null))['catch'](handleError(_0x3a75bc,null));};exports['destroy']=function(_0x2be3b6,_0x28580c){return db[_0xa9b5('0x2c')][_0xa9b5('0x48')]({'where':{'id':_0x2be3b6['params']['id']}})['then'](handleEntityNotFound(_0x28580c,null))[_0xa9b5('0x25')](removeEntity(_0x28580c,null))[_0xa9b5('0x4a')](handleError(_0x28580c,null));};exports[_0xa9b5('0x4c')]=function(_0x34c7c9,_0x24ca91,_0x19c37b){var _0x4a29d7={};var _0x5bb65f={};var _0x5ee9fa;var _0x50a3d1;return db[_0xa9b5('0x2c')][_0xa9b5('0x4d')]({'where':{'id':_0x34c7c9[_0xa9b5('0x45')]['id']}})['then'](handleEntityNotFound(_0x24ca91,null))[_0xa9b5('0x25')](function(_0x33bed8){if(_0x33bed8){_0x5ee9fa=_0x33bed8;_0x5bb65f['model']=_[_0xa9b5('0x33')](db['FreshsalesConfiguration']['rawAttributes']);_0x5bb65f[_0xa9b5('0x32')]=_[_0xa9b5('0x33')](_0x34c7c9[_0xa9b5('0x32')]);_0x5bb65f[_0xa9b5('0x3c')]=_[_0xa9b5('0x34')](_0x5bb65f[_0xa9b5('0x31')],_0x5bb65f[_0xa9b5('0x32')]);_0x4a29d7[_0xa9b5('0x35')]=_[_0xa9b5('0x34')](_0x5bb65f['model'],qs['fields'](_0x34c7c9[_0xa9b5('0x32')][_0xa9b5('0x36')]));_0x4a29d7[_0xa9b5('0x35')]=_0x4a29d7[_0xa9b5('0x35')][_0xa9b5('0x37')]?_0x4a29d7[_0xa9b5('0x35')]:_0x5bb65f[_0xa9b5('0x31')];_0x4a29d7[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_0x34c7c9['query']['sort']);_0x4a29d7[_0xa9b5('0x3b')]=qs[_0xa9b5('0x3c')](_[_0xa9b5('0x3d')](_0x34c7c9['query'],_0x5bb65f[_0xa9b5('0x3c')]));if(_0x34c7c9[_0xa9b5('0x32')][_0xa9b5('0x3e')]){_0x4a29d7[_0xa9b5('0x3b')]=_[_0xa9b5('0x40')](_0x4a29d7[_0xa9b5('0x3b')],{'$or':_[_0xa9b5('0x2b')](_0x4a29d7[_0xa9b5('0x35')],function(_0x203f13){var _0x525c53={};_0x525c53[_0x203f13]={'$like':'%'+_0x34c7c9[_0xa9b5('0x32')][_0xa9b5('0x3e')]+'%'};return _0x525c53;})});}_0x4a29d7=_[_0xa9b5('0x40')]({},_0x4a29d7,_0x34c7c9[_0xa9b5('0x47')]);return _0x5ee9fa[_0xa9b5('0x4c')](_0x4a29d7);}})['then'](function(_0x5c8560){if(_0x5c8560){_0x50a3d1=_0x5c8560[_0xa9b5('0x37')];if(!_0x34c7c9['query'][_0xa9b5('0x38')]('nolimit')){_0x4a29d7['limit']=qs[_0xa9b5('0x1d')](_0x34c7c9[_0xa9b5('0x32')][_0xa9b5('0x1d')]);_0x4a29d7['offset']=qs[_0xa9b5('0x1f')](_0x34c7c9[_0xa9b5('0x32')]['offset']);}return _0x5ee9fa[_0xa9b5('0x4c')](_0x4a29d7);}})[_0xa9b5('0x25')](function(_0x352d03){if(_0x352d03){return _0x352d03?{'count':_0x50a3d1,'rows':_0x352d03}:null;}})[_0xa9b5('0x25')](respondWithResult(_0x24ca91,null))[_0xa9b5('0x4a')](handleError(_0x24ca91,null));};exports[_0xa9b5('0x4e')]=function(_0x3d0a21,_0x200960,_0x4767c2){if(_0x3d0a21[_0xa9b5('0x4b')]['id']){delete _0x3d0a21[_0xa9b5('0x4b')]['id'];}return db[_0xa9b5('0x2c')][_0xa9b5('0x4d')]({'where':{'id':_0x3d0a21['params']['id']}})[_0xa9b5('0x25')](handleEntityNotFound(_0x200960,null))[_0xa9b5('0x25')](function(_0x3d23ae){if(_0x3d23ae){_0x3d0a21[_0xa9b5('0x4b')][_0xa9b5('0x4f')]=_0x3d23ae['id'];_0x3d0a21[_0xa9b5('0x4b')][_0xa9b5('0x50')]=integrations[_0xa9b5('0x51')](_0x3d0a21[_0xa9b5('0x4b')][_0xa9b5('0x52')],_0x3d0a21['body']['type']);_0x3d0a21[_0xa9b5('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x3d0a21[_0xa9b5('0x4b')][_0xa9b5('0x52')],_0x3d0a21['body'][_0xa9b5('0x2f')]);return db[_0xa9b5('0x53')][_0xa9b5('0x49')](_0x3d0a21[_0xa9b5('0x4b')],{'include':[{'model':db[_0xa9b5('0x54')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0xa9b5('0x55')}]});}return null;})[_0xa9b5('0x25')](respondWithResult(_0x200960,null))['catch'](handleError(_0x200960,null));};exports[_0xa9b5('0x56')]=function(_0x1ad68f,_0x4d7b83,_0xe9558e){var _0x58946f='';var _0x1f370a='';return db[_0xa9b5('0x2c')]['findOne']({'where':{'id':_0x1ad68f['params']['id']},'attributes':['id',_0xa9b5('0x57'),_0xa9b5('0x58'),'apiKey']})[_0xa9b5('0x25')](handleEntityNotFound(_0x4d7b83,null))[_0xa9b5('0x25')](function(_0x4c93ac){if(_0x4c93ac){_0x1f370a=_0x4c93ac[_0xa9b5('0x57')];_0x58946f=_0x4c93ac[_0xa9b5('0x58')];var _0x4ad354=_0x4c93ac[_0xa9b5('0x58')]['slice'](-0x1);if(_0x4ad354==='/'){_0x58946f=_0x58946f[_0xa9b5('0x59')](0x0,_0x58946f['lastIndexOf'](_0x4ad354));}return rp({'method':_0xa9b5('0x5a'),'uri':util[_0xa9b5('0x5b')](_0xa9b5('0x5c'),_0x58946f,'/api/selector/owners'),'headers':{'Authorization':_0xa9b5('0x5d')+_0x4c93ac[_0xa9b5('0x5e')]},'json':!![]});}})[_0xa9b5('0x25')](function(_0x3968f1){if(_0x3968f1){var _0x5211f0=_0x3968f1['users'];var _0x570398=![];var _0x63416c=null;for(_0x63416c=0x0;_0x63416c<_0x5211f0[_0xa9b5('0x37')];_0x63416c++){if(_0x5211f0[_0x63416c][_0xa9b5('0x5f')]===_0x1f370a){_0x570398=!![];}}if(_0x570398){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa9b5('0x60')});}}})[_0xa9b5('0x25')](respondWithResult(_0x4d7b83,null))[_0xa9b5('0x4a')](function(_0x591888){var _0x5f16ae=_0x1ad68f[_0xa9b5('0x32')][_0xa9b5('0x61')]?0x1f4:_0x591888[_0xa9b5('0x62')]||0x1f4;logger['error'](_0xa9b5('0x63'),_0xa9b5('0x56'),_0x5f16ae,JSON[_0xa9b5('0x64')](_0x591888));delete _0x591888['name'];if(_0x5f16ae===0x191){_0x5f16ae=0x190;}_0x4d7b83['status'](_0x5f16ae)['send'](_0x1ad68f[_0xa9b5('0x32')][_0xa9b5('0x61')]?{'message':'Wrong\x20credentials','statusCode':_0x591888[_0xa9b5('0x62')]}:_0x591888);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 401a0c4..c8e4d04 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 _0x781d=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','moment','bluebird','request-promise','path'];(function(_0xbefcc9,_0x3d3166){var _0x2a54b5=function(_0x712b3a){while(--_0x712b3a){_0xbefcc9['push'](_0xbefcc9['shift']());}};_0x2a54b5(++_0x3d3166);}(_0x781d,0x14a));var _0xd781=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x781d[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd781('0x2'));var BPromise=require(_0xd781('0x3'));var rp=require(_0xd781('0x4'));var fs=require('fs');var path=require(_0xd781('0x5'));var rimraf=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var attributes=require(_0xd781('0x8'));var integrations=require(_0xd781('0x9'));module[_0xd781('0xa')]=function(_0x2f98ee,_0x5a07f0){return _0x2f98ee[_0xd781('0xb')](_0xd781('0xc'),attributes,{'tableName':_0xd781('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['exports','lodash','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x0295,0x1f0));var _0x5029=function(_0x11ce46,_0x7a1715){_0x11ce46=_0x11ce46-0x0;var _0x272001=_0x0295[_0x11ce46];return _0x272001;};'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'));var integrations=require(_0x5029('0x7'));module[_0x5029('0x8')]=function(_0x215955,_0x5b3cd){return _0x215955['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','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 1fdec05..fa18242 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 _0xbbbc=['attributes','limit','include','map','model','stringify','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x5516c7,_0x3d46e4){_0x5516c7=_0x5516c7-0x0;var _0x314076=_0xbbbc[_0x5516c7];return _0x314076;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['FreshsalesAccount'][_0xcbbb('0x16')]({'raw':_0x3436af[_0xcbbb('0x17')]?_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x18')]===undefined?!![]:![]:!![],'where':_0x3436af[_0xcbbb('0x17')]?_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x19')]||null:null,'attributes':_0x3436af[_0xcbbb('0x17')]?_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x1a')]||null:null,'limit':_0x3436af['options']?_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x1b')]||null:null,'include':_0x3436af[_0xcbbb('0x17')]?_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x1c')]?_[_0xcbbb('0x1d')](_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x1c')],function(_0x3ca570){return{'model':db[_0x3ca570['model']],'as':_0x3ca570['as'],'attributes':_0x3ca570[_0xcbbb('0x1a')],'include':_0x3ca570[_0xcbbb('0x1c')]?_['map'](_0x3ca570[_0xcbbb('0x1c')],function(_0x4ffa80){return{'model':db[_0x4ffa80['model']],'as':_0x4ffa80['as'],'attributes':_0x4ffa80[_0xcbbb('0x1a')],'include':_0x4ffa80[_0xcbbb('0x1c')]?_['map'](_0x4ffa80['include'],function(_0x5499a1){return{'model':db[_0x5499a1[_0xcbbb('0x1e')]],'as':_0x5499a1['as'],'attributes':_0x5499a1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21e3b1){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')](_0xcbbb('0x15'),_0x3436af,JSON[_0xcbbb('0x1f')](_0x21e3b1));_0x5052df(_0x21e3b1);})[_0xcbbb('0x14')](function(_0x1c986d){logger[_0xcbbb('0x11')](_0xcbbb('0x15'),_0x1c986d[_0xcbbb('0x12')],_0x3436af);_0x57c5e9(_0x3572bb[_0xcbbb('0x11')](0x1f4,_0x1c986d[_0xcbbb('0x12')]));});});};exports[_0xcbbb('0x20')]=function(_0x2a9639){var _0xcae72c=this;return new Promise(function(_0x117739,_0x21c560){return db['FreshsalesAccount'][_0xcbbb('0x21')]({'raw':_0x2a9639[_0xcbbb('0x17')]?_0x2a9639['options'][_0xcbbb('0x18')]===undefined?!![]:![]:!![],'where':_0x2a9639['options']?_0x2a9639[_0xcbbb('0x17')][_0xcbbb('0x19')]||null:null,'attributes':_0x2a9639[_0xcbbb('0x17')]?_0x2a9639['options'][_0xcbbb('0x1a')]||null:null,'include':_0x2a9639[_0xcbbb('0x17')]?_0x2a9639[_0xcbbb('0x17')][_0xcbbb('0x1c')]?_[_0xcbbb('0x1d')](_0x2a9639[_0xcbbb('0x17')][_0xcbbb('0x1c')],function(_0x1ac1a2){return{'model':db[_0x1ac1a2[_0xcbbb('0x1e')]],'as':_0x1ac1a2['as'],'attributes':_0x1ac1a2[_0xcbbb('0x1a')],'include':_0x1ac1a2['include']?_['map'](_0x1ac1a2['include'],function(_0x4ed7e8){return{'model':db[_0x4ed7e8[_0xcbbb('0x1e')]],'as':_0x4ed7e8['as'],'attributes':_0x4ed7e8[_0xcbbb('0x1a')],'include':_0x4ed7e8[_0xcbbb('0x1c')]?_[_0xcbbb('0x1d')](_0x4ed7e8[_0xcbbb('0x1c')],function(_0x358537){return{'model':db[_0x358537[_0xcbbb('0x1e')]],'as':_0x358537['as'],'attributes':_0x358537[_0xcbbb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcbbb('0xd')](function(_0x198178){logger[_0xcbbb('0xe')](_0xcbbb('0x20'),_0x2a9639);logger['debug']('ShowFreshsalesAccount',_0x2a9639,JSON[_0xcbbb('0x1f')](_0x198178));_0x117739(_0x198178);})['catch'](function(_0x4919ad){logger['error'](_0xcbbb('0x20'),_0x4919ad[_0xcbbb('0x12')],_0x2a9639);_0x21c560(_0xcae72c[_0xcbbb('0x11')](0x1f4,_0x4919ad[_0xcbbb('0x12')]));});});}; \ No newline at end of file +var _0x323f=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','FreshsalesAccount','options','where','attributes','include','map','model','catch','ShowFreshsalesAccount','find','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x9995c4,_0x2cee6a){var _0x213e4c=function(_0x17ba8f){while(--_0x17ba8f){_0x9995c4['push'](_0x9995c4['shift']());}};_0x213e4c(++_0x2cee6a);}(_0x323f,0x1ee));var _0xf323=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x323f[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require(_0xf323('0x5'));var logger=require(_0xf323('0x6'))(_0xf323('0x7'));var config=require(_0xf323('0x8'));var jayson=require(_0xf323('0x9'));var client=jayson[_0xf323('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb9a667,_0x444cba,_0x1af70d){return new BPromise(function(_0x2c8271,_0x8abeac){return client[_0xf323('0xb')](_0xb9a667,_0x1af70d)[_0xf323('0xc')](function(_0x2b24a2){logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));logger[_0xf323('0x10')](_0xf323('0x11'),_0x444cba,_0xf323('0xf'),JSON[_0xf323('0x12')](_0x2b24a2));if(_0x2b24a2[_0xf323('0x13')]){if(_0x2b24a2[_0xf323('0x13')]['code']===0x1f4){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')]['message']);return _0x8abeac(_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);}logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);return _0x2c8271(_0x2b24a2['error']['message']);}else{logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));_0x2c8271(_0x2b24a2[_0xf323('0x15')][_0xf323('0x14')]);}})['catch'](function(_0xd6c25){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0xd6c25);_0x8abeac(_0xd6c25);});});}exports[_0xf323('0x16')]=function(_0x49b115){var _0x2db977=this;return new Promise(function(_0x272aec,_0x1a459d){return db[_0xf323('0x17')]['findAll']({'raw':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')][_0xf323('0x19')]||null:null,'attributes':_0x49b115[_0xf323('0x18')]?_0x49b115['options'][_0xf323('0x1a')]||null:null,'limit':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')]['limit']||null:null,'include':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')][_0xf323('0x1b')]?_[_0xf323('0x1c')](_0x49b115[_0xf323('0x18')][_0xf323('0x1b')],function(_0x189b23){return{'model':db[_0x189b23[_0xf323('0x1d')]],'as':_0x189b23['as'],'attributes':_0x189b23[_0xf323('0x1a')],'include':_0x189b23['include']?_[_0xf323('0x1c')](_0x189b23[_0xf323('0x1b')],function(_0x33dc52){return{'model':db[_0x33dc52[_0xf323('0x1d')]],'as':_0x33dc52['as'],'attributes':_0x33dc52[_0xf323('0x1a')],'include':_0x33dc52[_0xf323('0x1b')]?_['map'](_0x33dc52[_0xf323('0x1b')],function(_0x56ce33){return{'model':db[_0x56ce33[_0xf323('0x1d')]],'as':_0x56ce33['as'],'attributes':_0x56ce33[_0xf323('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46663b){logger[_0xf323('0xd')](_0xf323('0x16'),_0x49b115);logger[_0xf323('0x10')](_0xf323('0x16'),_0x49b115,JSON['stringify'](_0x46663b));_0x272aec(_0x46663b);})[_0xf323('0x1e')](function(_0x34b536){logger[_0xf323('0x13')](_0xf323('0x16'),_0x34b536[_0xf323('0x14')],_0x49b115);_0x1a459d(_0x2db977[_0xf323('0x13')](0x1f4,_0x34b536[_0xf323('0x14')]));});});};exports[_0xf323('0x1f')]=function(_0x139adc){var _0x52300b=this;return new Promise(function(_0x3f23cf,_0x15187c){return db[_0xf323('0x17')][_0xf323('0x20')]({'raw':_0x139adc[_0xf323('0x18')]?_0x139adc['options'][_0xf323('0x21')]===undefined?!![]:![]:!![],'where':_0x139adc[_0xf323('0x18')]?_0x139adc[_0xf323('0x18')][_0xf323('0x19')]||null:null,'attributes':_0x139adc[_0xf323('0x18')]?_0x139adc['options'][_0xf323('0x1a')]||null:null,'include':_0x139adc[_0xf323('0x18')]?_0x139adc[_0xf323('0x18')][_0xf323('0x1b')]?_['map'](_0x139adc[_0xf323('0x18')]['include'],function(_0x372c47){return{'model':db[_0x372c47[_0xf323('0x1d')]],'as':_0x372c47['as'],'attributes':_0x372c47['attributes'],'include':_0x372c47[_0xf323('0x1b')]?_['map'](_0x372c47[_0xf323('0x1b')],function(_0x4a49d2){return{'model':db[_0x4a49d2[_0xf323('0x1d')]],'as':_0x4a49d2['as'],'attributes':_0x4a49d2['attributes'],'include':_0x4a49d2[_0xf323('0x1b')]?_[_0xf323('0x1c')](_0x4a49d2['include'],function(_0x4964a5){return{'model':db[_0x4964a5['model']],'as':_0x4964a5['as'],'attributes':_0x4964a5[_0xf323('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf323('0xc')](function(_0x79e636){logger[_0xf323('0xd')](_0xf323('0x1f'),_0x139adc);logger['debug']('ShowFreshsalesAccount',_0x139adc,JSON['stringify'](_0x79e636));_0x3f23cf(_0x79e636);})[_0xf323('0x1e')](function(_0x59fee2){logger[_0xf323('0x13')]('ShowFreshsalesAccount',_0x59fee2[_0xf323('0x14')],_0x139adc);_0x15187c(_0x52300b[_0xf323('0x13')](0x1f4,_0x59fee2[_0xf323('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 1f52974..00e3210 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 _0xc0ee=['getSubjects','getDescriptions','post','create','put','delete','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','/:id/subjects','isAuthenticated'];(function(_0x22f829,_0x32ca2d){var _0x515eb9=function(_0x51239a){while(--_0x51239a){_0x22f829['push'](_0x22f829['shift']());}};_0x515eb9(++_0x32ca2d);}(_0xc0ee,0xa8));var _0xec0e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc0ee[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0xec0e('0x0'));var path=require('path');var timeout=require(_0xec0e('0x1'));var express=require(_0xec0e('0x2'));var router=express['Router']();var fs_extra=require(_0xec0e('0x3'));var auth=require(_0xec0e('0x4'));var interaction=require(_0xec0e('0x5'));var config=require(_0xec0e('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xec0e('0x7')]('/',auth['isAuthenticated'](),controller[_0xec0e('0x8')]);router[_0xec0e('0x7')](_0xec0e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xec0e('0x7')](_0xec0e('0xa'),auth[_0xec0e('0xb')](),controller[_0xec0e('0xc')]);router[_0xec0e('0x7')]('/:id/descriptions',auth[_0xec0e('0xb')](),controller[_0xec0e('0xd')]);router[_0xec0e('0x7')]('/:id/fields',auth[_0xec0e('0xb')](),controller['getFields']);router[_0xec0e('0xe')]('/',auth[_0xec0e('0xb')](),controller[_0xec0e('0xf')]);router[_0xec0e('0x10')](_0xec0e('0x9'),auth[_0xec0e('0xb')](),controller['update']);router[_0xec0e('0x11')]('/:id',auth[_0xec0e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x53ff=['./intFreshsalesConfiguration.controller','isAuthenticated','index','get','show','/:id/subjects','/:id/fields','post','update','/:id','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x53ff,0x19a));var _0xf53f=function(_0x5172a3,_0x1a1e39){_0x5172a3=_0x5172a3-0x0;var _0x50c69b=_0x53ff[_0x5172a3];return _0x50c69b;};'use strict';var multer=require(_0xf53f('0x0'));var util=require(_0xf53f('0x1'));var path=require(_0xf53f('0x2'));var timeout=require(_0xf53f('0x3'));var express=require(_0xf53f('0x4'));var router=express['Router']();var fs_extra=require(_0xf53f('0x5'));var auth=require(_0xf53f('0x6'));var interaction=require(_0xf53f('0x7'));var config=require('../../config/environment');var controller=require(_0xf53f('0x8'));router['get']('/',auth[_0xf53f('0x9')](),controller[_0xf53f('0xa')]);router[_0xf53f('0xb')]('/:id',auth[_0xf53f('0x9')](),controller[_0xf53f('0xc')]);router[_0xf53f('0xb')](_0xf53f('0xd'),auth[_0xf53f('0x9')](),controller['getSubjects']);router[_0xf53f('0xb')]('/:id/descriptions',auth[_0xf53f('0x9')](),controller['getDescriptions']);router[_0xf53f('0xb')](_0xf53f('0xe'),auth[_0xf53f('0x9')](),controller['getFields']);router[_0xf53f('0xf')]('/',auth[_0xf53f('0x9')](),controller['create']);router['put']('/:id',auth[_0xf53f('0x9')](),controller[_0xf53f('0x10')]);router['delete'](_0xf53f('0x11'),auth['isAuthenticated'](),controller[_0xf53f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1862f91..df49dd5 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 _0x0f9a=['exports','STRING','sequelize'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x0f9a,0x65));var _0xa0f9=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x0f9a[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xa0f9('0x0'));module[_0xa0f9('0x1')]={'name':{'type':Sequelize[_0xa0f9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8241=['exports','STRING'];(function(_0x1ef13a,_0xea5b02){var _0x22aa5b=function(_0x5c1bfe){while(--_0x5c1bfe){_0x1ef13a['push'](_0x1ef13a['shift']());}};_0x22aa5b(++_0xea5b02);}(_0x8241,0xa4));var _0x1824=function(_0x40d308,_0x52c7c0){_0x40d308=_0x40d308-0x0;var _0x106283=_0x8241[_0x40d308];return _0x106283;};'use strict';var Sequelize=require('sequelize');module[_0x1824('0x0')]={'name':{'type':Sequelize[_0x1824('0x1')]},'description':{'type':Sequelize[_0x1824('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 6ae70ba..cb66311 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 _0xb56e=['model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','getSubjects','findOne','FreshsalesField','length','nolimit','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key'];(function(_0x262ee7,_0x52ee92){var _0x1dc842=function(_0x4bf54a){while(--_0x4bf54a){_0x262ee7['push'](_0x262ee7['shift']());}};_0x1dc842(++_0x52ee92);}(_0xb56e,0x1d0));var _0xeb56=function(_0x5a1a68,_0x39cb7a){_0x5a1a68=_0x5a1a68-0x0;var _0x584e5d=_0xb56e[_0x5a1a68];return _0x584e5d;};'use strict';var emlformat=require(_0xeb56('0x0'));var rimraf=require(_0xeb56('0x1'));var zipdir=require(_0xeb56('0x2'));var jsonpatch=require(_0xeb56('0x3'));var rp=require(_0xeb56('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb56('0x5'));var util=require('util');var path=require(_0xeb56('0x6'));var sox=require(_0xeb56('0x7'));var csv=require('to-csv');var ejs=require(_0xeb56('0x8'));var fs=require('fs');var fs_extra=require(_0xeb56('0x9'));var _=require(_0xeb56('0xa'));var squel=require(_0xeb56('0xb'));var crypto=require(_0xeb56('0xc'));var jsforce=require(_0xeb56('0xd'));var deskjs=require(_0xeb56('0xe'));var toCsv=require(_0xeb56('0xf'));var querystring=require(_0xeb56('0x10'));var Papa=require('papaparse');var Redis=require(_0xeb56('0x11'));var authService=require(_0xeb56('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xeb56('0x13'));var hardwareService=require(_0xeb56('0x14'));var logger=require('../../config/logger')(_0xeb56('0x15'));var utils=require(_0xeb56('0x16'));var config=require(_0xeb56('0x17'));var licenseUtil=require(_0xeb56('0x18'));var db=require(_0xeb56('0x19'))['db'];function respondWithStatusCode(_0xa6536e,_0x48d03b){_0x48d03b=_0x48d03b||0xcc;return function(_0x3e58e0){if(_0x3e58e0){return _0xa6536e[_0xeb56('0x1a')](_0x48d03b);}return _0xa6536e[_0xeb56('0x1b')](_0x48d03b)[_0xeb56('0x1c')]();};}function respondWithResult(_0x1f47dc,_0x1c84f4){_0x1c84f4=_0x1c84f4||0xc8;return function(_0x4e278c){if(_0x4e278c){return _0x1f47dc['status'](_0x1c84f4)[_0xeb56('0x1d')](_0x4e278c);}};}function respondWithFilteredResult(_0x2ab3a6,_0x10f7ac){return function(_0xe0152c){if(_0xe0152c){var _0x283318=typeof _0x10f7ac[_0xeb56('0x1e')]===_0xeb56('0x1f')&&typeof _0x10f7ac[_0xeb56('0x20')]===_0xeb56('0x1f');var _0x487b8f=_0xe0152c['count'];var _0xe044a=_0x283318?0x0:_0x10f7ac[_0xeb56('0x1e')];var _0x260e04=_0x283318?_0xe0152c[_0xeb56('0x21')]:_0x10f7ac['offset']+_0x10f7ac[_0xeb56('0x20')];var _0xade8c3;if(_0x260e04>=_0x487b8f){_0x260e04=_0x487b8f;_0xade8c3=0xc8;}else{_0xade8c3=0xce;}_0x2ab3a6[_0xeb56('0x1b')](_0xade8c3);return _0x2ab3a6[_0xeb56('0x22')](_0xeb56('0x23'),_0xe044a+'-'+_0x260e04+'/'+_0x487b8f)['json'](_0xe0152c);}return null;};}function patchUpdates(_0x22abd1){return function(_0x3daef5){try{jsonpatch[_0xeb56('0x24')](_0x3daef5,_0x22abd1,!![]);}catch(_0x4d62db){return BPromise[_0xeb56('0x25')](_0x4d62db);}return _0x3daef5[_0xeb56('0x26')]();};}function saveUpdates(_0x593ba7,_0x28f0db){return function(_0x3fba1b){if(_0x3fba1b){return _0x3fba1b[_0xeb56('0x27')](_0x593ba7)['then'](function(_0x366cc9){return _0x366cc9;});}return null;};}function removeEntity(_0x7cebc5,_0x1de701){return function(_0x127f46){if(_0x127f46){return _0x127f46[_0xeb56('0x28')]()[_0xeb56('0x29')](function(){_0x7cebc5['status'](0xcc)[_0xeb56('0x1c')]();});}};}function handleEntityNotFound(_0x31d87f,_0x419526){return function(_0x3bae33){if(!_0x3bae33){_0x31d87f[_0xeb56('0x1a')](0x194);}return _0x3bae33;};}function handleError(_0x389456,_0x388941){_0x388941=_0x388941||0x1f4;return function(_0x1b8dae){logger[_0xeb56('0x2a')](_0x1b8dae[_0xeb56('0x2b')]);if(_0x1b8dae[_0xeb56('0x2c')]){delete _0x1b8dae[_0xeb56('0x2c')];}_0x389456[_0xeb56('0x1b')](_0x388941)[_0xeb56('0x2d')](_0x1b8dae);};}exports[_0xeb56('0x2e')]=function(_0x516f81,_0x5ba291){var _0x293c31={},_0x44dd0c={},_0x5b20d8={'count':0x0,'rows':[]};var _0x39fef8=_[_0xeb56('0x2f')](db[_0xeb56('0x30')]['rawAttributes'],function(_0xa8c17b){return{'name':_0xa8c17b[_0xeb56('0x31')],'type':_0xa8c17b[_0xeb56('0x32')][_0xeb56('0x33')]};});_0x44dd0c[_0xeb56('0x34')]=_[_0xeb56('0x2f')](_0x39fef8,_0xeb56('0x2c'));_0x44dd0c['query']=_[_0xeb56('0x35')](_0x516f81[_0xeb56('0x36')]);_0x44dd0c['filters']=_[_0xeb56('0x37')](_0x44dd0c['model'],_0x44dd0c[_0xeb56('0x36')]);_0x293c31[_0xeb56('0x38')]=_['intersection'](_0x44dd0c['model'],qs[_0xeb56('0x39')](_0x516f81[_0xeb56('0x36')][_0xeb56('0x39')]));_0x293c31[_0xeb56('0x38')]=_0x293c31['attributes']['length']?_0x293c31[_0xeb56('0x38')]:_0x44dd0c[_0xeb56('0x34')];if(!_0x516f81[_0xeb56('0x36')][_0xeb56('0x3a')]('nolimit')){_0x293c31['limit']=qs[_0xeb56('0x20')](_0x516f81[_0xeb56('0x36')][_0xeb56('0x20')]);_0x293c31[_0xeb56('0x1e')]=qs[_0xeb56('0x1e')](_0x516f81[_0xeb56('0x36')][_0xeb56('0x1e')]);}_0x293c31[_0xeb56('0x3b')]=qs[_0xeb56('0x3c')](_0x516f81['query'][_0xeb56('0x3c')]);_0x293c31['where']=qs['filters'](_[_0xeb56('0x3d')](_0x516f81[_0xeb56('0x36')],_0x44dd0c[_0xeb56('0x3e')]),_0x39fef8);if(_0x516f81['query'][_0xeb56('0x3f')]){_0x293c31[_0xeb56('0x40')]=_[_0xeb56('0x41')](_0x293c31[_0xeb56('0x40')],{'$or':_[_0xeb56('0x2f')](_0x39fef8,function(_0x2b7897){if(_0x2b7897[_0xeb56('0x32')]!==_0xeb56('0x42')){var _0x148d7f={};_0x148d7f[_0x2b7897[_0xeb56('0x2c')]]={'$like':'%'+_0x516f81[_0xeb56('0x36')][_0xeb56('0x3f')]+'%'};return _0x148d7f;}})});}_0x293c31=_[_0xeb56('0x41')]({},_0x293c31,_0x516f81[_0xeb56('0x43')]);var _0xb7eb2f={'where':_0x293c31['where']};return db[_0xeb56('0x30')][_0xeb56('0x21')](_0xb7eb2f)[_0xeb56('0x29')](function(_0x2bc6dd){_0x5b20d8[_0xeb56('0x21')]=_0x2bc6dd;if(_0x516f81[_0xeb56('0x36')][_0xeb56('0x44')]){_0x293c31[_0xeb56('0x45')]=[{'all':!![]}];}return db[_0xeb56('0x30')][_0xeb56('0x46')](_0x293c31);})['then'](function(_0x212d26){_0x5b20d8[_0xeb56('0x47')]=_0x212d26;return _0x5b20d8;})['then'](respondWithFilteredResult(_0x5ba291,_0x293c31))['catch'](handleError(_0x5ba291,null));};exports[_0xeb56('0x48')]=function(_0x4e683b,_0x948306){var _0x5c47d4={'raw':![],'where':{'id':_0x4e683b[_0xeb56('0x49')]['id']}},_0x40b8b1={};_0x40b8b1['model']=_[_0xeb56('0x35')](db[_0xeb56('0x30')][_0xeb56('0x4a')]);_0x40b8b1['query']=_[_0xeb56('0x35')](_0x4e683b[_0xeb56('0x36')]);_0x40b8b1[_0xeb56('0x3e')]=_[_0xeb56('0x37')](_0x40b8b1[_0xeb56('0x34')],_0x40b8b1[_0xeb56('0x36')]);_0x5c47d4[_0xeb56('0x38')]=_[_0xeb56('0x37')](_0x40b8b1[_0xeb56('0x34')],qs[_0xeb56('0x39')](_0x4e683b[_0xeb56('0x36')][_0xeb56('0x39')]));_0x5c47d4[_0xeb56('0x38')]=_0x5c47d4[_0xeb56('0x38')]['length']?_0x5c47d4['attributes']:_0x40b8b1[_0xeb56('0x34')];if(_0x4e683b[_0xeb56('0x36')][_0xeb56('0x44')]){_0x5c47d4[_0xeb56('0x45')]=[{'all':!![]}];}_0x5c47d4=_[_0xeb56('0x41')]({},_0x5c47d4,_0x4e683b[_0xeb56('0x43')]);return db[_0xeb56('0x30')][_0xeb56('0x4b')](_0x5c47d4)[_0xeb56('0x29')](handleEntityNotFound(_0x948306,null))[_0xeb56('0x29')](respondWithResult(_0x948306,null))[_0xeb56('0x4c')](handleError(_0x948306,null));};exports[_0xeb56('0x4d')]=function(_0x5513d7,_0xd48907){return db[_0xeb56('0x30')][_0xeb56('0x4d')](_0x5513d7[_0xeb56('0x4e')],{})[_0xeb56('0x29')](respondWithResult(_0xd48907,0xc9))[_0xeb56('0x4c')](handleError(_0xd48907,null));};exports[_0xeb56('0x27')]=function(_0x5e5726,_0x1876a6){if(_0x5e5726[_0xeb56('0x4e')]['id']){delete _0x5e5726[_0xeb56('0x4e')]['id'];}return db[_0xeb56('0x30')][_0xeb56('0x4b')]({'where':{'id':_0x5e5726[_0xeb56('0x49')]['id']}})[_0xeb56('0x29')](handleEntityNotFound(_0x1876a6,null))['then'](saveUpdates(_0x5e5726[_0xeb56('0x4e')],null))[_0xeb56('0x29')](respondWithResult(_0x1876a6,null))[_0xeb56('0x4c')](handleError(_0x1876a6,null));};exports[_0xeb56('0x28')]=function(_0x12fec3,_0x379227){return db[_0xeb56('0x30')]['find']({'where':{'id':_0x12fec3[_0xeb56('0x49')]['id']}})['then'](handleEntityNotFound(_0x379227,null))['then'](removeEntity(_0x379227,null))[_0xeb56('0x4c')](handleError(_0x379227,null));};exports[_0xeb56('0x4f')]=function(_0xed89b7,_0x3f0ed5,_0x8c2551){var _0x9b0c18={};var _0x595370={};var _0xf9b7b0;var _0x41257f;return db[_0xeb56('0x30')][_0xeb56('0x50')]({'where':{'id':_0xed89b7['params']['id']}})[_0xeb56('0x29')](handleEntityNotFound(_0x3f0ed5,null))[_0xeb56('0x29')](function(_0x202792){if(_0x202792){_0xf9b7b0=_0x202792;_0x595370['model']=_[_0xeb56('0x35')](db[_0xeb56('0x51')][_0xeb56('0x4a')]);_0x595370[_0xeb56('0x36')]=_[_0xeb56('0x35')](_0xed89b7['query']);_0x595370[_0xeb56('0x3e')]=_['intersection'](_0x595370[_0xeb56('0x34')],_0x595370[_0xeb56('0x36')]);_0x9b0c18['attributes']=_[_0xeb56('0x37')](_0x595370[_0xeb56('0x34')],qs[_0xeb56('0x39')](_0xed89b7[_0xeb56('0x36')][_0xeb56('0x39')]));_0x9b0c18[_0xeb56('0x38')]=_0x9b0c18[_0xeb56('0x38')][_0xeb56('0x52')]?_0x9b0c18['attributes']:_0x595370[_0xeb56('0x34')];_0x9b0c18['order']=qs[_0xeb56('0x3c')](_0xed89b7['query'][_0xeb56('0x3c')]);_0x9b0c18[_0xeb56('0x40')]=qs['filters'](_['pick'](_0xed89b7['query'],_0x595370[_0xeb56('0x3e')]));if(_0xed89b7[_0xeb56('0x36')]['filter']){_0x9b0c18[_0xeb56('0x40')]=_['merge'](_0x9b0c18['where'],{'$or':_[_0xeb56('0x2f')](_0x9b0c18[_0xeb56('0x38')],function(_0x55a776){var _0x347f90={};_0x347f90[_0x55a776]={'$like':'%'+_0xed89b7['query']['filter']+'%'};return _0x347f90;})});}_0x9b0c18=_[_0xeb56('0x41')]({},_0x9b0c18,_0xed89b7[_0xeb56('0x43')]);return _0xf9b7b0['getSubjects'](_0x9b0c18);}})[_0xeb56('0x29')](function(_0x5cdab0){if(_0x5cdab0){_0x41257f=_0x5cdab0[_0xeb56('0x52')];if(!_0xed89b7[_0xeb56('0x36')][_0xeb56('0x3a')](_0xeb56('0x53'))){_0x9b0c18[_0xeb56('0x20')]=qs[_0xeb56('0x20')](_0xed89b7[_0xeb56('0x36')]['limit']);_0x9b0c18['offset']=qs[_0xeb56('0x1e')](_0xed89b7['query'][_0xeb56('0x1e')]);}return _0xf9b7b0[_0xeb56('0x4f')](_0x9b0c18);}})[_0xeb56('0x29')](function(_0x4afa60){if(_0x4afa60){return _0x4afa60?{'count':_0x41257f,'rows':_0x4afa60}:null;}})['then'](respondWithResult(_0x3f0ed5,null))[_0xeb56('0x4c')](handleError(_0x3f0ed5,null));};exports['getDescriptions']=function(_0x5764a0,_0x1abf0c,_0x27d598){var _0x17199a={};var _0x2e73a9={};var _0x1271bb;var _0x3fba71;return db[_0xeb56('0x30')]['findOne']({'where':{'id':_0x5764a0[_0xeb56('0x49')]['id']}})[_0xeb56('0x29')](handleEntityNotFound(_0x1abf0c,null))[_0xeb56('0x29')](function(_0x382a37){if(_0x382a37){_0x1271bb=_0x382a37;_0x2e73a9[_0xeb56('0x34')]=_[_0xeb56('0x35')](db['FreshsalesField']['rawAttributes']);_0x2e73a9['query']=_[_0xeb56('0x35')](_0x5764a0[_0xeb56('0x36')]);_0x2e73a9['filters']=_[_0xeb56('0x37')](_0x2e73a9[_0xeb56('0x34')],_0x2e73a9[_0xeb56('0x36')]);_0x17199a[_0xeb56('0x38')]=_[_0xeb56('0x37')](_0x2e73a9[_0xeb56('0x34')],qs[_0xeb56('0x39')](_0x5764a0[_0xeb56('0x36')]['fields']));_0x17199a[_0xeb56('0x38')]=_0x17199a[_0xeb56('0x38')]['length']?_0x17199a[_0xeb56('0x38')]:_0x2e73a9[_0xeb56('0x34')];_0x17199a['order']=qs[_0xeb56('0x3c')](_0x5764a0[_0xeb56('0x36')][_0xeb56('0x3c')]);_0x17199a['where']=qs['filters'](_[_0xeb56('0x3d')](_0x5764a0[_0xeb56('0x36')],_0x2e73a9['filters']));if(_0x5764a0['query'][_0xeb56('0x3f')]){_0x17199a['where']=_[_0xeb56('0x41')](_0x17199a[_0xeb56('0x40')],{'$or':_[_0xeb56('0x2f')](_0x17199a[_0xeb56('0x38')],function(_0x5fab1){var _0x5672f8={};_0x5672f8[_0x5fab1]={'$like':'%'+_0x5764a0['query'][_0xeb56('0x3f')]+'%'};return _0x5672f8;})});}_0x17199a=_[_0xeb56('0x41')]({},_0x17199a,_0x5764a0['options']);return _0x1271bb[_0xeb56('0x54')](_0x17199a);}})[_0xeb56('0x29')](function(_0xd0af07){if(_0xd0af07){_0x3fba71=_0xd0af07[_0xeb56('0x52')];if(!_0x5764a0[_0xeb56('0x36')]['hasOwnProperty'](_0xeb56('0x53'))){_0x17199a[_0xeb56('0x20')]=qs[_0xeb56('0x20')](_0x5764a0[_0xeb56('0x36')][_0xeb56('0x20')]);_0x17199a[_0xeb56('0x1e')]=qs[_0xeb56('0x1e')](_0x5764a0[_0xeb56('0x36')]['offset']);}return _0x1271bb['getDescriptions'](_0x17199a);}})['then'](function(_0x53aae0){if(_0x53aae0){return _0x53aae0?{'count':_0x3fba71,'rows':_0x53aae0}:null;}})[_0xeb56('0x29')](respondWithResult(_0x1abf0c,null))[_0xeb56('0x4c')](handleError(_0x1abf0c,null));};exports[_0xeb56('0x55')]=function(_0x49ec38,_0x55b54b,_0x316ada){var _0x318bd5={};var _0x3638c5={};var _0x294492;var _0x211731;return db[_0xeb56('0x30')][_0xeb56('0x50')]({'where':{'id':_0x49ec38[_0xeb56('0x49')]['id']}})[_0xeb56('0x29')](handleEntityNotFound(_0x55b54b,null))[_0xeb56('0x29')](function(_0xe4b021){if(_0xe4b021){_0x294492=_0xe4b021;_0x3638c5[_0xeb56('0x34')]=_[_0xeb56('0x35')](db[_0xeb56('0x51')]['rawAttributes']);_0x3638c5[_0xeb56('0x36')]=_[_0xeb56('0x35')](_0x49ec38[_0xeb56('0x36')]);_0x3638c5['filters']=_[_0xeb56('0x37')](_0x3638c5[_0xeb56('0x34')],_0x3638c5[_0xeb56('0x36')]);_0x318bd5[_0xeb56('0x38')]=_['intersection'](_0x3638c5[_0xeb56('0x34')],qs['fields'](_0x49ec38['query'][_0xeb56('0x39')]));_0x318bd5[_0xeb56('0x38')]=_0x318bd5[_0xeb56('0x38')][_0xeb56('0x52')]?_0x318bd5[_0xeb56('0x38')]:_0x3638c5[_0xeb56('0x34')];_0x318bd5[_0xeb56('0x3b')]=qs[_0xeb56('0x3c')](_0x49ec38[_0xeb56('0x36')][_0xeb56('0x3c')]);_0x318bd5[_0xeb56('0x40')]=qs['filters'](_[_0xeb56('0x3d')](_0x49ec38[_0xeb56('0x36')],_0x3638c5[_0xeb56('0x3e')]));if(_0x49ec38[_0xeb56('0x36')]['filter']){_0x318bd5[_0xeb56('0x40')]=_['merge'](_0x318bd5[_0xeb56('0x40')],{'$or':_[_0xeb56('0x2f')](_0x318bd5[_0xeb56('0x38')],function(_0x2d1426){var _0x20858d={};_0x20858d[_0x2d1426]={'$like':'%'+_0x49ec38[_0xeb56('0x36')][_0xeb56('0x3f')]+'%'};return _0x20858d;})});}_0x318bd5=_[_0xeb56('0x41')]({},_0x318bd5,_0x49ec38[_0xeb56('0x43')]);return _0x294492[_0xeb56('0x55')](_0x318bd5);}})[_0xeb56('0x29')](function(_0x9e989a){if(_0x9e989a){_0x211731=_0x9e989a[_0xeb56('0x52')];if(!_0x49ec38['query'][_0xeb56('0x3a')](_0xeb56('0x53'))){_0x318bd5[_0xeb56('0x20')]=qs['limit'](_0x49ec38['query'][_0xeb56('0x20')]);_0x318bd5[_0xeb56('0x1e')]=qs[_0xeb56('0x1e')](_0x49ec38[_0xeb56('0x36')][_0xeb56('0x1e')]);}return _0x294492[_0xeb56('0x55')](_0x318bd5);}})['then'](function(_0xf9a27d){if(_0xf9a27d){return _0xf9a27d?{'count':_0x211731,'rows':_0xf9a27d}:null;}})['then'](respondWithResult(_0x55b54b,null))['catch'](handleError(_0x55b54b,null));}; \ No newline at end of file +var _0x3abc=['find','destroy','getSubjects','findOne','nolimit','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','create','body'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x3abc,0xfe));var _0xc3ab=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x3abc[_0x186376];return _0x2dbdd9;};'use strict';var emlformat=require(_0xc3ab('0x0'));var rimraf=require(_0xc3ab('0x1'));var zipdir=require(_0xc3ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc3ab('0x3'));var BPromise=require(_0xc3ab('0x4'));var Mustache=require('mustache');var util=require(_0xc3ab('0x5'));var path=require(_0xc3ab('0x6'));var sox=require(_0xc3ab('0x7'));var csv=require('to-csv');var ejs=require(_0xc3ab('0x8'));var fs=require('fs');var fs_extra=require(_0xc3ab('0x9'));var _=require(_0xc3ab('0xa'));var squel=require(_0xc3ab('0xb'));var crypto=require(_0xc3ab('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc3ab('0xd'));var Papa=require(_0xc3ab('0xe'));var Redis=require(_0xc3ab('0xf'));var authService=require(_0xc3ab('0x10'));var qs=require(_0xc3ab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3ab('0x12'));var logger=require(_0xc3ab('0x13'))(_0xc3ab('0x14'));var utils=require(_0xc3ab('0x15'));var config=require(_0xc3ab('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3ab('0x17'))['db'];function respondWithStatusCode(_0x1f4820,_0x53d0bb){_0x53d0bb=_0x53d0bb||0xcc;return function(_0x10c2ce){if(_0x10c2ce){return _0x1f4820[_0xc3ab('0x18')](_0x53d0bb);}return _0x1f4820[_0xc3ab('0x19')](_0x53d0bb)[_0xc3ab('0x1a')]();};}function respondWithResult(_0x44b12f,_0x3f5f44){_0x3f5f44=_0x3f5f44||0xc8;return function(_0x1d146a){if(_0x1d146a){return _0x44b12f[_0xc3ab('0x19')](_0x3f5f44)[_0xc3ab('0x1b')](_0x1d146a);}};}function respondWithFilteredResult(_0x1e79dd,_0x2815a0){return function(_0x47ac10){if(_0x47ac10){var _0x3c0cfc=typeof _0x2815a0[_0xc3ab('0x1c')]===_0xc3ab('0x1d')&&typeof _0x2815a0[_0xc3ab('0x1e')]==='undefined';var _0x480524=_0x47ac10[_0xc3ab('0x1f')];var _0x4fe7ab=_0x3c0cfc?0x0:_0x2815a0[_0xc3ab('0x1c')];var _0x1a012e=_0x3c0cfc?_0x47ac10[_0xc3ab('0x1f')]:_0x2815a0[_0xc3ab('0x1c')]+_0x2815a0[_0xc3ab('0x1e')];var _0x305bda;if(_0x1a012e>=_0x480524){_0x1a012e=_0x480524;_0x305bda=0xc8;}else{_0x305bda=0xce;}_0x1e79dd[_0xc3ab('0x19')](_0x305bda);return _0x1e79dd[_0xc3ab('0x20')]('Content-Range',_0x4fe7ab+'-'+_0x1a012e+'/'+_0x480524)[_0xc3ab('0x1b')](_0x47ac10);}return null;};}function patchUpdates(_0x2b8a16){return function(_0x33ad49){try{jsonpatch[_0xc3ab('0x21')](_0x33ad49,_0x2b8a16,!![]);}catch(_0x211d3b){return BPromise[_0xc3ab('0x22')](_0x211d3b);}return _0x33ad49[_0xc3ab('0x23')]();};}function saveUpdates(_0x5cfa48,_0x14b66b){return function(_0x85e463){if(_0x85e463){return _0x85e463[_0xc3ab('0x24')](_0x5cfa48)[_0xc3ab('0x25')](function(_0x42a2f7){return _0x42a2f7;});}return null;};}function removeEntity(_0x20d8ae,_0x33f4b7){return function(_0x3dc8f7){if(_0x3dc8f7){return _0x3dc8f7['destroy']()[_0xc3ab('0x25')](function(){_0x20d8ae['status'](0xcc)[_0xc3ab('0x1a')]();});}};}function handleEntityNotFound(_0x1448d7,_0x34e3a0){return function(_0x282a3c){if(!_0x282a3c){_0x1448d7[_0xc3ab('0x18')](0x194);}return _0x282a3c;};}function handleError(_0x4a36b3,_0x56b27d){_0x56b27d=_0x56b27d||0x1f4;return function(_0x346008){logger[_0xc3ab('0x26')](_0x346008[_0xc3ab('0x27')]);if(_0x346008[_0xc3ab('0x28')]){delete _0x346008[_0xc3ab('0x28')];}_0x4a36b3[_0xc3ab('0x19')](_0x56b27d)[_0xc3ab('0x29')](_0x346008);};}exports[_0xc3ab('0x2a')]=function(_0xf0f1d6,_0x41b979){var _0x3d2953={},_0x27062a={},_0x371c21={'count':0x0,'rows':[]};var _0x38ec7c=_[_0xc3ab('0x2b')](db[_0xc3ab('0x2c')][_0xc3ab('0x2d')],function(_0x4d4d33){return{'name':_0x4d4d33[_0xc3ab('0x2e')],'type':_0x4d4d33['type'][_0xc3ab('0x2f')]};});_0x27062a[_0xc3ab('0x30')]=_[_0xc3ab('0x2b')](_0x38ec7c,'name');_0x27062a[_0xc3ab('0x31')]=_[_0xc3ab('0x32')](_0xf0f1d6[_0xc3ab('0x31')]);_0x27062a['filters']=_['intersection'](_0x27062a['model'],_0x27062a[_0xc3ab('0x31')]);_0x3d2953[_0xc3ab('0x33')]=_[_0xc3ab('0x34')](_0x27062a['model'],qs[_0xc3ab('0x35')](_0xf0f1d6['query'][_0xc3ab('0x35')]));_0x3d2953[_0xc3ab('0x33')]=_0x3d2953['attributes'][_0xc3ab('0x36')]?_0x3d2953[_0xc3ab('0x33')]:_0x27062a[_0xc3ab('0x30')];if(!_0xf0f1d6[_0xc3ab('0x31')][_0xc3ab('0x37')]('nolimit')){_0x3d2953['limit']=qs[_0xc3ab('0x1e')](_0xf0f1d6[_0xc3ab('0x31')][_0xc3ab('0x1e')]);_0x3d2953['offset']=qs[_0xc3ab('0x1c')](_0xf0f1d6[_0xc3ab('0x31')]['offset']);}_0x3d2953[_0xc3ab('0x38')]=qs['sort'](_0xf0f1d6[_0xc3ab('0x31')][_0xc3ab('0x39')]);_0x3d2953[_0xc3ab('0x3a')]=qs[_0xc3ab('0x3b')](_[_0xc3ab('0x3c')](_0xf0f1d6[_0xc3ab('0x31')],_0x27062a[_0xc3ab('0x3b')]),_0x38ec7c);if(_0xf0f1d6['query']['filter']){_0x3d2953[_0xc3ab('0x3a')]=_[_0xc3ab('0x3d')](_0x3d2953[_0xc3ab('0x3a')],{'$or':_[_0xc3ab('0x2b')](_0x38ec7c,function(_0x1638c8){if(_0x1638c8[_0xc3ab('0x3e')]!==_0xc3ab('0x3f')){var _0x4266d1={};_0x4266d1[_0x1638c8[_0xc3ab('0x28')]]={'$like':'%'+_0xf0f1d6[_0xc3ab('0x31')][_0xc3ab('0x40')]+'%'};return _0x4266d1;}})});}_0x3d2953=_[_0xc3ab('0x3d')]({},_0x3d2953,_0xf0f1d6[_0xc3ab('0x41')]);var _0x30779a={'where':_0x3d2953[_0xc3ab('0x3a')]};return db[_0xc3ab('0x2c')][_0xc3ab('0x1f')](_0x30779a)[_0xc3ab('0x25')](function(_0x42368d){_0x371c21[_0xc3ab('0x1f')]=_0x42368d;if(_0xf0f1d6[_0xc3ab('0x31')][_0xc3ab('0x42')]){_0x3d2953['include']=[{'all':!![]}];}return db[_0xc3ab('0x2c')][_0xc3ab('0x43')](_0x3d2953);})[_0xc3ab('0x25')](function(_0x28eb44){_0x371c21[_0xc3ab('0x44')]=_0x28eb44;return _0x371c21;})[_0xc3ab('0x25')](respondWithFilteredResult(_0x41b979,_0x3d2953))[_0xc3ab('0x45')](handleError(_0x41b979,null));};exports[_0xc3ab('0x46')]=function(_0x17a085,_0x585203){var _0x35e39d={'raw':![],'where':{'id':_0x17a085[_0xc3ab('0x47')]['id']}},_0x2ec6e5={};_0x2ec6e5[_0xc3ab('0x30')]=_[_0xc3ab('0x32')](db['FreshsalesConfiguration'][_0xc3ab('0x2d')]);_0x2ec6e5[_0xc3ab('0x31')]=_[_0xc3ab('0x32')](_0x17a085['query']);_0x2ec6e5[_0xc3ab('0x3b')]=_['intersection'](_0x2ec6e5['model'],_0x2ec6e5[_0xc3ab('0x31')]);_0x35e39d[_0xc3ab('0x33')]=_[_0xc3ab('0x34')](_0x2ec6e5['model'],qs[_0xc3ab('0x35')](_0x17a085[_0xc3ab('0x31')][_0xc3ab('0x35')]));_0x35e39d[_0xc3ab('0x33')]=_0x35e39d[_0xc3ab('0x33')]['length']?_0x35e39d[_0xc3ab('0x33')]:_0x2ec6e5[_0xc3ab('0x30')];if(_0x17a085[_0xc3ab('0x31')]['includeAll']){_0x35e39d['include']=[{'all':!![]}];}_0x35e39d=_['merge']({},_0x35e39d,_0x17a085[_0xc3ab('0x41')]);return db['FreshsalesConfiguration']['find'](_0x35e39d)[_0xc3ab('0x25')](handleEntityNotFound(_0x585203,null))[_0xc3ab('0x25')](respondWithResult(_0x585203,null))[_0xc3ab('0x45')](handleError(_0x585203,null));};exports[_0xc3ab('0x48')]=function(_0x1b3b8f,_0x17ae7d){return db[_0xc3ab('0x2c')][_0xc3ab('0x48')](_0x1b3b8f[_0xc3ab('0x49')],{})[_0xc3ab('0x25')](respondWithResult(_0x17ae7d,0xc9))[_0xc3ab('0x45')](handleError(_0x17ae7d,null));};exports[_0xc3ab('0x24')]=function(_0x315eaf,_0xbeff99){if(_0x315eaf[_0xc3ab('0x49')]['id']){delete _0x315eaf['body']['id'];}return db['FreshsalesConfiguration'][_0xc3ab('0x4a')]({'where':{'id':_0x315eaf['params']['id']}})[_0xc3ab('0x25')](handleEntityNotFound(_0xbeff99,null))['then'](saveUpdates(_0x315eaf['body'],null))[_0xc3ab('0x25')](respondWithResult(_0xbeff99,null))[_0xc3ab('0x45')](handleError(_0xbeff99,null));};exports[_0xc3ab('0x4b')]=function(_0xb6f645,_0x261251){return db['FreshsalesConfiguration'][_0xc3ab('0x4a')]({'where':{'id':_0xb6f645[_0xc3ab('0x47')]['id']}})[_0xc3ab('0x25')](handleEntityNotFound(_0x261251,null))[_0xc3ab('0x25')](removeEntity(_0x261251,null))[_0xc3ab('0x45')](handleError(_0x261251,null));};exports[_0xc3ab('0x4c')]=function(_0xe2fa89,_0x5ca4b3,_0x256b5e){var _0x5ecb91={};var _0x9fd999={};var _0x7b35ca;var _0x53c416;return db[_0xc3ab('0x2c')][_0xc3ab('0x4d')]({'where':{'id':_0xe2fa89[_0xc3ab('0x47')]['id']}})[_0xc3ab('0x25')](handleEntityNotFound(_0x5ca4b3,null))['then'](function(_0x2bf316){if(_0x2bf316){_0x7b35ca=_0x2bf316;_0x9fd999[_0xc3ab('0x30')]=_[_0xc3ab('0x32')](db['FreshsalesField']['rawAttributes']);_0x9fd999[_0xc3ab('0x31')]=_[_0xc3ab('0x32')](_0xe2fa89[_0xc3ab('0x31')]);_0x9fd999[_0xc3ab('0x3b')]=_['intersection'](_0x9fd999['model'],_0x9fd999[_0xc3ab('0x31')]);_0x5ecb91[_0xc3ab('0x33')]=_['intersection'](_0x9fd999[_0xc3ab('0x30')],qs[_0xc3ab('0x35')](_0xe2fa89['query'][_0xc3ab('0x35')]));_0x5ecb91[_0xc3ab('0x33')]=_0x5ecb91[_0xc3ab('0x33')][_0xc3ab('0x36')]?_0x5ecb91[_0xc3ab('0x33')]:_0x9fd999[_0xc3ab('0x30')];_0x5ecb91[_0xc3ab('0x38')]=qs[_0xc3ab('0x39')](_0xe2fa89['query'][_0xc3ab('0x39')]);_0x5ecb91[_0xc3ab('0x3a')]=qs[_0xc3ab('0x3b')](_['pick'](_0xe2fa89['query'],_0x9fd999['filters']));if(_0xe2fa89[_0xc3ab('0x31')][_0xc3ab('0x40')]){_0x5ecb91[_0xc3ab('0x3a')]=_[_0xc3ab('0x3d')](_0x5ecb91[_0xc3ab('0x3a')],{'$or':_[_0xc3ab('0x2b')](_0x5ecb91[_0xc3ab('0x33')],function(_0x34533f){var _0x738796={};_0x738796[_0x34533f]={'$like':'%'+_0xe2fa89[_0xc3ab('0x31')][_0xc3ab('0x40')]+'%'};return _0x738796;})});}_0x5ecb91=_[_0xc3ab('0x3d')]({},_0x5ecb91,_0xe2fa89[_0xc3ab('0x41')]);return _0x7b35ca[_0xc3ab('0x4c')](_0x5ecb91);}})[_0xc3ab('0x25')](function(_0x3aa8b8){if(_0x3aa8b8){_0x53c416=_0x3aa8b8[_0xc3ab('0x36')];if(!_0xe2fa89['query'][_0xc3ab('0x37')](_0xc3ab('0x4e'))){_0x5ecb91[_0xc3ab('0x1e')]=qs[_0xc3ab('0x1e')](_0xe2fa89['query']['limit']);_0x5ecb91[_0xc3ab('0x1c')]=qs[_0xc3ab('0x1c')](_0xe2fa89[_0xc3ab('0x31')][_0xc3ab('0x1c')]);}return _0x7b35ca['getSubjects'](_0x5ecb91);}})[_0xc3ab('0x25')](function(_0x14feab){if(_0x14feab){return _0x14feab?{'count':_0x53c416,'rows':_0x14feab}:null;}})[_0xc3ab('0x25')](respondWithResult(_0x5ca4b3,null))['catch'](handleError(_0x5ca4b3,null));};exports[_0xc3ab('0x4f')]=function(_0x558da9,_0x77cb9,_0x542999){var _0x2669a0={};var _0x41998c={};var _0x3fd17d;var _0x4074dc;return db['FreshsalesConfiguration'][_0xc3ab('0x4d')]({'where':{'id':_0x558da9[_0xc3ab('0x47')]['id']}})[_0xc3ab('0x25')](handleEntityNotFound(_0x77cb9,null))[_0xc3ab('0x25')](function(_0x206099){if(_0x206099){_0x3fd17d=_0x206099;_0x41998c[_0xc3ab('0x30')]=_[_0xc3ab('0x32')](db[_0xc3ab('0x50')][_0xc3ab('0x2d')]);_0x41998c[_0xc3ab('0x31')]=_[_0xc3ab('0x32')](_0x558da9['query']);_0x41998c[_0xc3ab('0x3b')]=_['intersection'](_0x41998c[_0xc3ab('0x30')],_0x41998c['query']);_0x2669a0['attributes']=_['intersection'](_0x41998c[_0xc3ab('0x30')],qs[_0xc3ab('0x35')](_0x558da9['query'][_0xc3ab('0x35')]));_0x2669a0[_0xc3ab('0x33')]=_0x2669a0[_0xc3ab('0x33')]['length']?_0x2669a0[_0xc3ab('0x33')]:_0x41998c[_0xc3ab('0x30')];_0x2669a0['order']=qs[_0xc3ab('0x39')](_0x558da9[_0xc3ab('0x31')][_0xc3ab('0x39')]);_0x2669a0[_0xc3ab('0x3a')]=qs[_0xc3ab('0x3b')](_[_0xc3ab('0x3c')](_0x558da9[_0xc3ab('0x31')],_0x41998c['filters']));if(_0x558da9['query'][_0xc3ab('0x40')]){_0x2669a0['where']=_['merge'](_0x2669a0[_0xc3ab('0x3a')],{'$or':_[_0xc3ab('0x2b')](_0x2669a0['attributes'],function(_0x1fee86){var _0x1cf7b2={};_0x1cf7b2[_0x1fee86]={'$like':'%'+_0x558da9[_0xc3ab('0x31')][_0xc3ab('0x40')]+'%'};return _0x1cf7b2;})});}_0x2669a0=_['merge']({},_0x2669a0,_0x558da9[_0xc3ab('0x41')]);return _0x3fd17d[_0xc3ab('0x4f')](_0x2669a0);}})[_0xc3ab('0x25')](function(_0x3e508e){if(_0x3e508e){_0x4074dc=_0x3e508e[_0xc3ab('0x36')];if(!_0x558da9['query']['hasOwnProperty'](_0xc3ab('0x4e'))){_0x2669a0[_0xc3ab('0x1e')]=qs[_0xc3ab('0x1e')](_0x558da9[_0xc3ab('0x31')][_0xc3ab('0x1e')]);_0x2669a0['offset']=qs[_0xc3ab('0x1c')](_0x558da9[_0xc3ab('0x31')][_0xc3ab('0x1c')]);}return _0x3fd17d[_0xc3ab('0x4f')](_0x2669a0);}})[_0xc3ab('0x25')](function(_0x69d002){if(_0x69d002){return _0x69d002?{'count':_0x4074dc,'rows':_0x69d002}:null;}})[_0xc3ab('0x25')](respondWithResult(_0x77cb9,null))[_0xc3ab('0x45')](handleError(_0x77cb9,null));};exports[_0xc3ab('0x51')]=function(_0x3570e5,_0x267129,_0x4b165a){var _0x1790b9={};var _0x459412={};var _0x10d177;var _0x13b58e;return db[_0xc3ab('0x2c')]['findOne']({'where':{'id':_0x3570e5[_0xc3ab('0x47')]['id']}})[_0xc3ab('0x25')](handleEntityNotFound(_0x267129,null))[_0xc3ab('0x25')](function(_0x3ad6e6){if(_0x3ad6e6){_0x10d177=_0x3ad6e6;_0x459412[_0xc3ab('0x30')]=_[_0xc3ab('0x32')](db[_0xc3ab('0x50')][_0xc3ab('0x2d')]);_0x459412[_0xc3ab('0x31')]=_[_0xc3ab('0x32')](_0x3570e5[_0xc3ab('0x31')]);_0x459412[_0xc3ab('0x3b')]=_[_0xc3ab('0x34')](_0x459412['model'],_0x459412[_0xc3ab('0x31')]);_0x1790b9[_0xc3ab('0x33')]=_[_0xc3ab('0x34')](_0x459412['model'],qs[_0xc3ab('0x35')](_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x35')]));_0x1790b9['attributes']=_0x1790b9[_0xc3ab('0x33')][_0xc3ab('0x36')]?_0x1790b9[_0xc3ab('0x33')]:_0x459412[_0xc3ab('0x30')];_0x1790b9[_0xc3ab('0x38')]=qs['sort'](_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x39')]);_0x1790b9[_0xc3ab('0x3a')]=qs[_0xc3ab('0x3b')](_[_0xc3ab('0x3c')](_0x3570e5[_0xc3ab('0x31')],_0x459412['filters']));if(_0x3570e5['query'][_0xc3ab('0x40')]){_0x1790b9[_0xc3ab('0x3a')]=_['merge'](_0x1790b9[_0xc3ab('0x3a')],{'$or':_['map'](_0x1790b9[_0xc3ab('0x33')],function(_0x33f8f9){var _0x4f8234={};_0x4f8234[_0x33f8f9]={'$like':'%'+_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x40')]+'%'};return _0x4f8234;})});}_0x1790b9=_['merge']({},_0x1790b9,_0x3570e5['options']);return _0x10d177[_0xc3ab('0x51')](_0x1790b9);}})[_0xc3ab('0x25')](function(_0x309df8){if(_0x309df8){_0x13b58e=_0x309df8['length'];if(!_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x37')](_0xc3ab('0x4e'))){_0x1790b9['limit']=qs[_0xc3ab('0x1e')](_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x1e')]);_0x1790b9[_0xc3ab('0x1c')]=qs[_0xc3ab('0x1c')](_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x1c')]);}return _0x10d177[_0xc3ab('0x51')](_0x1790b9);}})[_0xc3ab('0x25')](function(_0x5abcbe){if(_0x5abcbe){return _0x5abcbe?{'count':_0x13b58e,'rows':_0x5abcbe}:null;}})[_0xc3ab('0x25')](respondWithResult(_0x267129,null))[_0xc3ab('0x45')](handleError(_0x267129,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 0596e67..c1d798f 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 _0xb3e0=['./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x126a30,_0x1429e9){var _0x3e95e8=function(_0xb77edc){while(--_0xb77edc){_0x126a30['push'](_0x126a30['shift']());}};_0x3e95e8(++_0x1429e9);}(_0xb3e0,0x171));var _0x0b3e=function(_0x30e751,_0x1d2c30){_0x30e751=_0x30e751-0x0;var _0x351e04=_0xb3e0[_0x30e751];return _0x351e04;};'use strict';var _=require(_0x0b3e('0x0'));var util=require(_0x0b3e('0x1'));var logger=require(_0x0b3e('0x2'))(_0x0b3e('0x3'));var moment=require(_0x0b3e('0x4'));var BPromise=require(_0x0b3e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b3e('0x6'));var rimraf=require(_0x0b3e('0x7'));var config=require(_0x0b3e('0x8'));var attributes=require(_0x0b3e('0x9'));module[_0x0b3e('0xa')]=function(_0x1381e3,_0x4874d0){return _0x1381e3[_0x0b3e('0xb')](_0x0b3e('0xc'),attributes,{'tableName':_0x0b3e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd1=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x365cc6,_0x188bf4){var _0x20a95c=function(_0x4b74d1){while(--_0x4b74d1){_0x365cc6['push'](_0x365cc6['shift']());}};_0x20a95c(++_0x188bf4);}(_0xcdd1,0xf1));var _0x1cdd=function(_0x50c599,_0x21de75){_0x50c599=_0x50c599-0x0;var _0x245ca1=_0xcdd1[_0x50c599];return _0x245ca1;};'use strict';var _=require(_0x1cdd('0x0'));var util=require(_0x1cdd('0x1'));var logger=require(_0x1cdd('0x2'))('api');var moment=require(_0x1cdd('0x3'));var BPromise=require(_0x1cdd('0x4'));var rp=require(_0x1cdd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1cdd('0x6'));var config=require(_0x1cdd('0x7'));var attributes=require(_0x1cdd('0x8'));module[_0x1cdd('0x9')]=function(_0x344af1,_0x1ceb5e){return _0x344af1[_0x1cdd('0xa')](_0x1cdd('0xb'),attributes,{'tableName':_0x1cdd('0xc'),'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 6d0ca6c..817087a 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 _0x8ca9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x533ccf,_0x26e994){var _0x257dc6=function(_0x5f43be){while(--_0x5f43be){_0x533ccf['push'](_0x533ccf['shift']());}};_0x257dc6(++_0x26e994);}(_0x8ca9,0x171));var _0x98ca=function(_0x3b2635,_0xb06ae8){_0x3b2635=_0x3b2635-0x0;var _0x794df4=_0x8ca9[_0x3b2635];return _0x794df4;};'use strict';var _=require('lodash');var util=require(_0x98ca('0x0'));var moment=require(_0x98ca('0x1'));var BPromise=require(_0x98ca('0x2'));var rs=require(_0x98ca('0x3'));var fs=require('fs');var Redis=require(_0x98ca('0x4'));var db=require(_0x98ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x98ca('0x6'))(_0x98ca('0x7'));var config=require(_0x98ca('0x8'));var jayson=require(_0x98ca('0x9'));var client=jayson[_0x98ca('0xa')][_0x98ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae2be,_0x222d87,_0x2fc4b9){return new BPromise(function(_0x560d2e,_0xe1d384){return client[_0x98ca('0xc')](_0x1ae2be,_0x2fc4b9)[_0x98ca('0xd')](function(_0x119a08){logger['info'](_0x98ca('0xe'),_0x222d87,_0x98ca('0xf'));logger[_0x98ca('0x10')](_0x98ca('0x11'),_0x222d87,_0x98ca('0xf'),JSON[_0x98ca('0x12')](_0x119a08));if(_0x119a08[_0x98ca('0x13')]){if(_0x119a08[_0x98ca('0x13')][_0x98ca('0x14')]===0x1f4){logger[_0x98ca('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x222d87,_0x119a08[_0x98ca('0x13')][_0x98ca('0x15')]);return _0xe1d384(_0x119a08[_0x98ca('0x13')]['message']);}logger['error'](_0x98ca('0xe'),_0x222d87,_0x119a08[_0x98ca('0x13')][_0x98ca('0x15')]);return _0x560d2e(_0x119a08[_0x98ca('0x13')][_0x98ca('0x15')]);}else{logger[_0x98ca('0x16')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x222d87,_0x98ca('0xf'));_0x560d2e(_0x119a08[_0x98ca('0x17')][_0x98ca('0x15')]);}})[_0x98ca('0x18')](function(_0x195975){logger['error'](_0x98ca('0xe'),_0x222d87,_0x195975);_0xe1d384(_0x195975);});});} \ No newline at end of file +var _0x03f1=['../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','ioredis','../../config/logger'];(function(_0x5a89f4,_0x1bf871){var _0x3921c9=function(_0x4c9b29){while(--_0x4c9b29){_0x5a89f4['push'](_0x5a89f4['shift']());}};_0x3921c9(++_0x1bf871);}(_0x03f1,0x10d));var _0x103f=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x03f1[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0x103f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x103f('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x103f('0x2'))('rpc');var config=require(_0x103f('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x103f('0x4')][_0x103f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x87cbb9,_0x2b5770,_0x5301dc){return new BPromise(function(_0x2b9bbf,_0x360fbc){return client[_0x103f('0x6')](_0x87cbb9,_0x5301dc)[_0x103f('0x7')](function(_0x15501b){logger[_0x103f('0x8')](_0x103f('0x9'),_0x2b5770,_0x103f('0xa'));logger['debug'](_0x103f('0xb'),_0x2b5770,'request\x20sent',JSON[_0x103f('0xc')](_0x15501b));if(_0x15501b[_0x103f('0xd')]){if(_0x15501b[_0x103f('0xd')]['code']===0x1f4){logger[_0x103f('0xd')](_0x103f('0x9'),_0x2b5770,_0x15501b['error'][_0x103f('0xe')]);return _0x360fbc(_0x15501b[_0x103f('0xd')]['message']);}logger[_0x103f('0xd')](_0x103f('0x9'),_0x2b5770,_0x15501b[_0x103f('0xd')][_0x103f('0xe')]);return _0x2b9bbf(_0x15501b['error'][_0x103f('0xe')]);}else{logger[_0x103f('0x8')](_0x103f('0x9'),_0x2b5770,_0x103f('0xa'));_0x2b9bbf(_0x15501b[_0x103f('0xf')][_0x103f('0xe')]);}})[_0x103f('0x10')](function(_0x147ac7){logger[_0x103f('0xd')](_0x103f('0x9'),_0x2b5770,_0x147ac7);_0x360fbc(_0x147ac7);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 8bdbd4a..3f0dacb 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 _0x2cc1=['isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshsalesField.controller','get','/:id'];(function(_0x54d206,_0x1afe7d){var _0x2f46ee=function(_0x7ed2c3){while(--_0x7ed2c3){_0x54d206['push'](_0x54d206['shift']());}};_0x2f46ee(++_0x1afe7d);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x312940,_0x27d5aa){_0x312940=_0x312940-0x0;var _0x4c2cc5=_0x2cc1[_0x312940];return _0x4c2cc5;};'use strict';var multer=require(_0x12cc('0x0'));var util=require(_0x12cc('0x1'));var path=require(_0x12cc('0x2'));var timeout=require(_0x12cc('0x3'));var express=require(_0x12cc('0x4'));var router=express[_0x12cc('0x5')]();var fs_extra=require(_0x12cc('0x6'));var auth=require(_0x12cc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x12cc('0x8'));router[_0x12cc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x12cc('0x9')](_0x12cc('0xa'),auth[_0x12cc('0xb')](),controller[_0x12cc('0xc')]);router[_0x12cc('0xd')]('/',auth[_0x12cc('0xb')](),controller[_0x12cc('0xe')]);router[_0x12cc('0xf')](_0x12cc('0xa'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x10')]);router[_0x12cc('0x11')](_0x12cc('0xa'),auth['isAuthenticated'](),controller[_0x12cc('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd382=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','post','put','/:id','delete','destroy','exports','multer','util'];(function(_0x4fb9b1,_0x3025e8){var _0x5f0ccf=function(_0x1c60be){while(--_0x1c60be){_0x4fb9b1['push'](_0x4fb9b1['shift']());}};_0x5f0ccf(++_0x3025e8);}(_0xd382,0x1b6));var _0x2d38=function(_0x26b594,_0x3f7732){_0x26b594=_0x26b594-0x0;var _0x13ec71=_0xd382[_0x26b594];return _0x13ec71;};'use strict';var multer=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var path=require(_0x2d38('0x2'));var timeout=require(_0x2d38('0x3'));var express=require(_0x2d38('0x4'));var router=express[_0x2d38('0x5')]();var fs_extra=require(_0x2d38('0x6'));var auth=require(_0x2d38('0x7'));var interaction=require(_0x2d38('0x8'));var config=require(_0x2d38('0x9'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2d38('0xa')]);router[_0x2d38('0xb')]('/:id',auth[_0x2d38('0xc')](),controller[_0x2d38('0xd')]);router[_0x2d38('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d38('0xf')](_0x2d38('0x10'),auth[_0x2d38('0xc')](),controller['update']);router[_0x2d38('0x11')]('/:id',auth[_0x2d38('0xc')](),controller[_0x2d38('0x12')]);module[_0x2d38('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 781c4ff..36af0e8 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 _0x319e=['string','STRING','customVariable','BOOLEAN','sequelize','ENUM','variable','keyValue','picklist'];(function(_0x513c4d,_0x4ec02f){var _0x15d4f4=function(_0x24e5b3){while(--_0x24e5b3){_0x513c4d['push'](_0x513c4d['shift']());}};_0x15d4f4(++_0x4ec02f);}(_0x319e,0x79));var _0xe319=function(_0x284f27,_0x2f8eb2){_0x284f27=_0x284f27-0x0;var _0x396f95=_0x319e[_0x284f27];return _0x396f95;};'use strict';var Sequelize=require(_0xe319('0x0'));module['exports']={'type':{'type':Sequelize[_0xe319('0x1')]('string',_0xe319('0x2'),'customVariable',_0xe319('0x3'),_0xe319('0x4')),'defaultValue':_0xe319('0x5')},'content':{'type':Sequelize[_0xe319('0x6')]},'key':{'type':Sequelize[_0xe319('0x6')]},'keyType':{'type':Sequelize[_0xe319('0x1')](_0xe319('0x5'),_0xe319('0x2'),_0xe319('0x7'))},'keyContent':{'type':Sequelize[_0xe319('0x6')]},'idField':{'type':Sequelize[_0xe319('0x6')]},'nameField':{'type':Sequelize[_0xe319('0x6')]},'customField':{'type':Sequelize[_0xe319('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe319('0x6')]}}; \ No newline at end of file +var _0xbb5f=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xbb5f,0x150));var _0xfbb5=function(_0x53a9fb,_0x359190){_0x53a9fb=_0x53a9fb-0x0;var _0x529ad0=_0xbb5f[_0x53a9fb];return _0x529ad0;};'use strict';var Sequelize=require(_0xfbb5('0x0'));module[_0xfbb5('0x1')]={'type':{'type':Sequelize[_0xfbb5('0x2')](_0xfbb5('0x3'),_0xfbb5('0x4'),_0xfbb5('0x5'),_0xfbb5('0x6'),_0xfbb5('0x7')),'defaultValue':_0xfbb5('0x3')},'content':{'type':Sequelize[_0xfbb5('0x8')]},'key':{'type':Sequelize[_0xfbb5('0x8')]},'keyType':{'type':Sequelize[_0xfbb5('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xfbb5('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfbb5('0x8')]},'customField':{'type':Sequelize[_0xfbb5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfbb5('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 51a1a42..490fb97 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 _0xac45=['VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','reject','save','update','then','destroy','error','stack','name','send','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x9c6e38,_0x1fc24e){var _0x148e08=function(_0x415b66){while(--_0x415b66){_0x9c6e38['push'](_0x9c6e38['shift']());}};_0x148e08(++_0x1fc24e);}(_0xac45,0xdc));var _0x5ac4=function(_0x4d2775,_0x4cfd21){_0x4d2775=_0x4d2775-0x0;var _0x2df0a2=_0xac45[_0x4d2775];return _0x2df0a2;};'use strict';var emlformat=require(_0x5ac4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ac4('0x1'));var jsonpatch=require(_0x5ac4('0x2'));var rp=require(_0x5ac4('0x3'));var moment=require(_0x5ac4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5ac4('0x5'));var util=require(_0x5ac4('0x6'));var path=require('path');var sox=require(_0x5ac4('0x7'));var csv=require(_0x5ac4('0x8'));var ejs=require(_0x5ac4('0x9'));var fs=require('fs');var fs_extra=require(_0x5ac4('0xa'));var _=require('lodash');var squel=require(_0x5ac4('0xb'));var crypto=require(_0x5ac4('0xc'));var jsforce=require(_0x5ac4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5ac4('0x8'));var querystring=require('querystring');var Papa=require(_0x5ac4('0xe'));var Redis=require(_0x5ac4('0xf'));var authService=require(_0x5ac4('0x10'));var qs=require(_0x5ac4('0x11'));var as=require(_0x5ac4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ac4('0x13'))(_0x5ac4('0x14'));var utils=require(_0x5ac4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5ac4('0x16'))['db'];function respondWithStatusCode(_0x5b4eaf,_0x24d8a6){_0x24d8a6=_0x24d8a6||0xcc;return function(_0x206f5f){if(_0x206f5f){return _0x5b4eaf[_0x5ac4('0x17')](_0x24d8a6);}return _0x5b4eaf[_0x5ac4('0x18')](_0x24d8a6)[_0x5ac4('0x19')]();};}function respondWithResult(_0x4b13fb,_0x1a2370){_0x1a2370=_0x1a2370||0xc8;return function(_0x55a18f){if(_0x55a18f){return _0x4b13fb[_0x5ac4('0x18')](_0x1a2370)['json'](_0x55a18f);}};}function respondWithFilteredResult(_0x331c0a,_0x505591){return function(_0x43843e){if(_0x43843e){var _0x5925fa=typeof _0x505591['offset']===_0x5ac4('0x1a')&&typeof _0x505591[_0x5ac4('0x1b')]===_0x5ac4('0x1a');var _0x2fbdf1=_0x43843e[_0x5ac4('0x1c')];var _0x10a040=_0x5925fa?0x0:_0x505591[_0x5ac4('0x1d')];var _0x1bcea0=_0x5925fa?_0x43843e[_0x5ac4('0x1c')]:_0x505591[_0x5ac4('0x1d')]+_0x505591[_0x5ac4('0x1b')];var _0x76c1da;if(_0x1bcea0>=_0x2fbdf1){_0x1bcea0=_0x2fbdf1;_0x76c1da=0xc8;}else{_0x76c1da=0xce;}_0x331c0a[_0x5ac4('0x18')](_0x76c1da);return _0x331c0a[_0x5ac4('0x1e')]('Content-Range',_0x10a040+'-'+_0x1bcea0+'/'+_0x2fbdf1)['json'](_0x43843e);}return null;};}function patchUpdates(_0x2cd690){return function(_0x3cefe4){try{jsonpatch['apply'](_0x3cefe4,_0x2cd690,!![]);}catch(_0x13a046){return BPromise[_0x5ac4('0x1f')](_0x13a046);}return _0x3cefe4[_0x5ac4('0x20')]();};}function saveUpdates(_0x56e1dc,_0x24a71e){return function(_0x427255){if(_0x427255){return _0x427255[_0x5ac4('0x21')](_0x56e1dc)[_0x5ac4('0x22')](function(_0x1f2744){return _0x1f2744;});}return null;};}function removeEntity(_0xf0db64,_0x39506b){return function(_0x233b3b){if(_0x233b3b){return _0x233b3b[_0x5ac4('0x23')]()[_0x5ac4('0x22')](function(){_0xf0db64[_0x5ac4('0x18')](0xcc)[_0x5ac4('0x19')]();});}};}function handleEntityNotFound(_0x590e42,_0xf81336){return function(_0x21e7af){if(!_0x21e7af){_0x590e42[_0x5ac4('0x17')](0x194);}return _0x21e7af;};}function handleError(_0x4a2fe5,_0x2ded8b){_0x2ded8b=_0x2ded8b||0x1f4;return function(_0x4ea084){logger[_0x5ac4('0x24')](_0x4ea084[_0x5ac4('0x25')]);if(_0x4ea084[_0x5ac4('0x26')]){delete _0x4ea084[_0x5ac4('0x26')];}_0x4a2fe5[_0x5ac4('0x18')](_0x2ded8b)[_0x5ac4('0x27')](_0x4ea084);};}exports['index']=function(_0x2f9a2b,_0x3f145d){var _0x484085={},_0xacb8c0={},_0x356f6a={'count':0x0,'rows':[]};var _0x2e75e2=_['map'](db[_0x5ac4('0x28')][_0x5ac4('0x29')],function(_0x26d51c){return{'name':_0x26d51c[_0x5ac4('0x2a')],'type':_0x26d51c[_0x5ac4('0x2b')][_0x5ac4('0x2c')]};});_0xacb8c0[_0x5ac4('0x2d')]=_[_0x5ac4('0x2e')](_0x2e75e2,_0x5ac4('0x26'));_0xacb8c0[_0x5ac4('0x2f')]=_[_0x5ac4('0x30')](_0x2f9a2b[_0x5ac4('0x2f')]);_0xacb8c0[_0x5ac4('0x31')]=_['intersection'](_0xacb8c0[_0x5ac4('0x2d')],_0xacb8c0[_0x5ac4('0x2f')]);_0x484085['attributes']=_[_0x5ac4('0x32')](_0xacb8c0[_0x5ac4('0x2d')],qs[_0x5ac4('0x33')](_0x2f9a2b[_0x5ac4('0x2f')][_0x5ac4('0x33')]));_0x484085[_0x5ac4('0x34')]=_0x484085[_0x5ac4('0x34')][_0x5ac4('0x35')]?_0x484085[_0x5ac4('0x34')]:_0xacb8c0[_0x5ac4('0x2d')];if(!_0x2f9a2b[_0x5ac4('0x2f')][_0x5ac4('0x36')]('nolimit')){_0x484085['limit']=qs[_0x5ac4('0x1b')](_0x2f9a2b[_0x5ac4('0x2f')][_0x5ac4('0x1b')]);_0x484085['offset']=qs['offset'](_0x2f9a2b[_0x5ac4('0x2f')][_0x5ac4('0x1d')]);}_0x484085[_0x5ac4('0x37')]=qs[_0x5ac4('0x38')](_0x2f9a2b[_0x5ac4('0x2f')][_0x5ac4('0x38')]);_0x484085[_0x5ac4('0x39')]=qs[_0x5ac4('0x31')](_[_0x5ac4('0x3a')](_0x2f9a2b[_0x5ac4('0x2f')],_0xacb8c0[_0x5ac4('0x31')]),_0x2e75e2);if(_0x2f9a2b[_0x5ac4('0x2f')][_0x5ac4('0x3b')]){_0x484085[_0x5ac4('0x39')]=_['merge'](_0x484085[_0x5ac4('0x39')],{'$or':_['map'](_0x2e75e2,function(_0x53b31b){if(_0x53b31b[_0x5ac4('0x2b')]!==_0x5ac4('0x3c')){var _0x455134={};_0x455134[_0x53b31b['name']]={'$like':'%'+_0x2f9a2b[_0x5ac4('0x2f')][_0x5ac4('0x3b')]+'%'};return _0x455134;}})});}_0x484085=_['merge']({},_0x484085,_0x2f9a2b[_0x5ac4('0x3d')]);var _0xc37a9a={'where':_0x484085[_0x5ac4('0x39')]};return db[_0x5ac4('0x28')][_0x5ac4('0x1c')](_0xc37a9a)['then'](function(_0x558546){_0x356f6a['count']=_0x558546;if(_0x2f9a2b[_0x5ac4('0x2f')][_0x5ac4('0x3e')]){_0x484085[_0x5ac4('0x3f')]=[{'all':!![]}];}return db[_0x5ac4('0x28')][_0x5ac4('0x40')](_0x484085);})['then'](function(_0x560ac4){_0x356f6a['rows']=_0x560ac4;return _0x356f6a;})[_0x5ac4('0x22')](respondWithFilteredResult(_0x3f145d,_0x484085))[_0x5ac4('0x41')](handleError(_0x3f145d,null));};exports['show']=function(_0x2e5a77,_0x3b1836){var _0x386b5d={'raw':!![],'where':{'id':_0x2e5a77[_0x5ac4('0x42')]['id']}},_0x30c21d={};_0x30c21d[_0x5ac4('0x2d')]=_[_0x5ac4('0x30')](db[_0x5ac4('0x28')][_0x5ac4('0x29')]);_0x30c21d[_0x5ac4('0x2f')]=_['keys'](_0x2e5a77[_0x5ac4('0x2f')]);_0x30c21d['filters']=_[_0x5ac4('0x32')](_0x30c21d['model'],_0x30c21d['query']);_0x386b5d[_0x5ac4('0x34')]=_[_0x5ac4('0x32')](_0x30c21d[_0x5ac4('0x2d')],qs[_0x5ac4('0x33')](_0x2e5a77[_0x5ac4('0x2f')]['fields']));_0x386b5d[_0x5ac4('0x34')]=_0x386b5d[_0x5ac4('0x34')][_0x5ac4('0x35')]?_0x386b5d[_0x5ac4('0x34')]:_0x30c21d[_0x5ac4('0x2d')];if(_0x2e5a77['query']['includeAll']){_0x386b5d['include']=[{'all':!![]}];}_0x386b5d=_['merge']({},_0x386b5d,_0x2e5a77['options']);return db[_0x5ac4('0x28')][_0x5ac4('0x43')](_0x386b5d)[_0x5ac4('0x22')](handleEntityNotFound(_0x3b1836,null))[_0x5ac4('0x22')](respondWithResult(_0x3b1836,null))['catch'](handleError(_0x3b1836,null));};exports[_0x5ac4('0x44')]=function(_0x1fd3bd,_0x3e385a){return db[_0x5ac4('0x28')][_0x5ac4('0x44')](_0x1fd3bd[_0x5ac4('0x45')],{})[_0x5ac4('0x22')](respondWithResult(_0x3e385a,0xc9))[_0x5ac4('0x41')](handleError(_0x3e385a,null));};exports['update']=function(_0x133177,_0x4adf01){if(_0x133177['body']['id']){delete _0x133177[_0x5ac4('0x45')]['id'];}return db[_0x5ac4('0x28')][_0x5ac4('0x43')]({'where':{'id':_0x133177[_0x5ac4('0x42')]['id']}})['then'](handleEntityNotFound(_0x4adf01,null))[_0x5ac4('0x22')](saveUpdates(_0x133177['body'],null))[_0x5ac4('0x22')](respondWithResult(_0x4adf01,null))[_0x5ac4('0x41')](handleError(_0x4adf01,null));};exports[_0x5ac4('0x23')]=function(_0x1e36dc,_0x1dd7a3){return db[_0x5ac4('0x28')][_0x5ac4('0x43')]({'where':{'id':_0x1e36dc['params']['id']}})['then'](handleEntityNotFound(_0x1dd7a3,null))[_0x5ac4('0x22')](removeEntity(_0x1dd7a3,null))[_0x5ac4('0x41')](handleError(_0x1dd7a3,null));}; \ No newline at end of file +var _0x6078=['hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','FreshsalesField','include','rows','catch','show','includeAll','merge','find','create','body','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length'];(function(_0x5403ec,_0x285bbf){var _0x14fbd4=function(_0x12a29f){while(--_0x12a29f){_0x5403ec['push'](_0x5403ec['shift']());}};_0x14fbd4(++_0x285bbf);}(_0x6078,0x150));var _0x8607=function(_0x510e91,_0x5bf2d9){_0x510e91=_0x510e91-0x0;var _0x369221=_0x6078[_0x510e91];return _0x369221;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8607('0x0'));var zipdir=require(_0x8607('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8607('0x2'));var moment=require(_0x8607('0x3'));var BPromise=require(_0x8607('0x4'));var Mustache=require(_0x8607('0x5'));var util=require(_0x8607('0x6'));var path=require(_0x8607('0x7'));var sox=require('sox');var csv=require(_0x8607('0x8'));var ejs=require(_0x8607('0x9'));var fs=require('fs');var fs_extra=require(_0x8607('0xa'));var _=require(_0x8607('0xb'));var squel=require(_0x8607('0xc'));var crypto=require(_0x8607('0xd'));var jsforce=require(_0x8607('0xe'));var deskjs=require(_0x8607('0xf'));var toCsv=require(_0x8607('0x8'));var querystring=require(_0x8607('0x10'));var Papa=require(_0x8607('0x11'));var Redis=require(_0x8607('0x12'));var authService=require(_0x8607('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8607('0x14'));var logger=require(_0x8607('0x15'))(_0x8607('0x16'));var utils=require(_0x8607('0x17'));var config=require(_0x8607('0x18'));var licenseUtil=require(_0x8607('0x19'));var db=require(_0x8607('0x1a'))['db'];function respondWithStatusCode(_0x272b06,_0x3302b5){_0x3302b5=_0x3302b5||0xcc;return function(_0x1ae9ad){if(_0x1ae9ad){return _0x272b06['sendStatus'](_0x3302b5);}return _0x272b06[_0x8607('0x1b')](_0x3302b5)[_0x8607('0x1c')]();};}function respondWithResult(_0x8e853a,_0x3dd9c5){_0x3dd9c5=_0x3dd9c5||0xc8;return function(_0x523769){if(_0x523769){return _0x8e853a[_0x8607('0x1b')](_0x3dd9c5)[_0x8607('0x1d')](_0x523769);}};}function respondWithFilteredResult(_0x33c7dd,_0xdc64c){return function(_0x58fbab){if(_0x58fbab){var _0x528bde=typeof _0xdc64c[_0x8607('0x1e')]===_0x8607('0x1f')&&typeof _0xdc64c[_0x8607('0x20')]===_0x8607('0x1f');var _0xbd62db=_0x58fbab[_0x8607('0x21')];var _0x3ae624=_0x528bde?0x0:_0xdc64c[_0x8607('0x1e')];var _0x31df04=_0x528bde?_0x58fbab[_0x8607('0x21')]:_0xdc64c[_0x8607('0x1e')]+_0xdc64c['limit'];var _0x12c35d;if(_0x31df04>=_0xbd62db){_0x31df04=_0xbd62db;_0x12c35d=0xc8;}else{_0x12c35d=0xce;}_0x33c7dd['status'](_0x12c35d);return _0x33c7dd[_0x8607('0x22')](_0x8607('0x23'),_0x3ae624+'-'+_0x31df04+'/'+_0xbd62db)[_0x8607('0x1d')](_0x58fbab);}return null;};}function patchUpdates(_0x4778b9){return function(_0x1cf6f6){try{jsonpatch[_0x8607('0x24')](_0x1cf6f6,_0x4778b9,!![]);}catch(_0x29a6a5){return BPromise[_0x8607('0x25')](_0x29a6a5);}return _0x1cf6f6[_0x8607('0x26')]();};}function saveUpdates(_0x295268,_0xcda4e){return function(_0x4b6ea6){if(_0x4b6ea6){return _0x4b6ea6[_0x8607('0x27')](_0x295268)[_0x8607('0x28')](function(_0xb105b3){return _0xb105b3;});}return null;};}function removeEntity(_0x584f7d,_0x458781){return function(_0x21a82b){if(_0x21a82b){return _0x21a82b[_0x8607('0x29')]()['then'](function(){_0x584f7d[_0x8607('0x1b')](0xcc)[_0x8607('0x1c')]();});}};}function handleEntityNotFound(_0x480b26,_0xb50668){return function(_0x29b9d0){if(!_0x29b9d0){_0x480b26[_0x8607('0x2a')](0x194);}return _0x29b9d0;};}function handleError(_0x44382c,_0x16c6b4){_0x16c6b4=_0x16c6b4||0x1f4;return function(_0x2efaef){logger['error'](_0x2efaef[_0x8607('0x2b')]);if(_0x2efaef[_0x8607('0x2c')]){delete _0x2efaef['name'];}_0x44382c[_0x8607('0x1b')](_0x16c6b4)[_0x8607('0x2d')](_0x2efaef);};}exports[_0x8607('0x2e')]=function(_0x5f1248,_0x7db202){var _0x3e9b4d={},_0x177c5a={},_0x475301={'count':0x0,'rows':[]};var _0x76622d=_['map'](db['FreshsalesField'][_0x8607('0x2f')],function(_0x49d0b2){return{'name':_0x49d0b2['fieldName'],'type':_0x49d0b2[_0x8607('0x30')][_0x8607('0x31')]};});_0x177c5a[_0x8607('0x32')]=_[_0x8607('0x33')](_0x76622d,'name');_0x177c5a['query']=_[_0x8607('0x34')](_0x5f1248[_0x8607('0x35')]);_0x177c5a[_0x8607('0x36')]=_[_0x8607('0x37')](_0x177c5a[_0x8607('0x32')],_0x177c5a[_0x8607('0x35')]);_0x3e9b4d[_0x8607('0x38')]=_[_0x8607('0x37')](_0x177c5a[_0x8607('0x32')],qs[_0x8607('0x39')](_0x5f1248[_0x8607('0x35')][_0x8607('0x39')]));_0x3e9b4d[_0x8607('0x38')]=_0x3e9b4d[_0x8607('0x38')][_0x8607('0x3a')]?_0x3e9b4d[_0x8607('0x38')]:_0x177c5a[_0x8607('0x32')];if(!_0x5f1248[_0x8607('0x35')][_0x8607('0x3b')](_0x8607('0x3c'))){_0x3e9b4d['limit']=qs['limit'](_0x5f1248[_0x8607('0x35')]['limit']);_0x3e9b4d[_0x8607('0x1e')]=qs[_0x8607('0x1e')](_0x5f1248[_0x8607('0x35')][_0x8607('0x1e')]);}_0x3e9b4d[_0x8607('0x3d')]=qs[_0x8607('0x3e')](_0x5f1248[_0x8607('0x35')][_0x8607('0x3e')]);_0x3e9b4d['where']=qs[_0x8607('0x36')](_[_0x8607('0x3f')](_0x5f1248[_0x8607('0x35')],_0x177c5a[_0x8607('0x36')]),_0x76622d);if(_0x5f1248[_0x8607('0x35')][_0x8607('0x40')]){_0x3e9b4d[_0x8607('0x41')]=_['merge'](_0x3e9b4d[_0x8607('0x41')],{'$or':_['map'](_0x76622d,function(_0x143018){if(_0x143018[_0x8607('0x30')]!==_0x8607('0x42')){var _0x4a19a4={};_0x4a19a4[_0x143018[_0x8607('0x2c')]]={'$like':'%'+_0x5f1248[_0x8607('0x35')][_0x8607('0x40')]+'%'};return _0x4a19a4;}})});}_0x3e9b4d=_['merge']({},_0x3e9b4d,_0x5f1248[_0x8607('0x43')]);var _0x2de8be={'where':_0x3e9b4d[_0x8607('0x41')]};return db[_0x8607('0x44')][_0x8607('0x21')](_0x2de8be)['then'](function(_0x477b3c){_0x475301[_0x8607('0x21')]=_0x477b3c;if(_0x5f1248[_0x8607('0x35')]['includeAll']){_0x3e9b4d[_0x8607('0x45')]=[{'all':!![]}];}return db[_0x8607('0x44')]['findAll'](_0x3e9b4d);})[_0x8607('0x28')](function(_0x34e9ed){_0x475301[_0x8607('0x46')]=_0x34e9ed;return _0x475301;})[_0x8607('0x28')](respondWithFilteredResult(_0x7db202,_0x3e9b4d))[_0x8607('0x47')](handleError(_0x7db202,null));};exports[_0x8607('0x48')]=function(_0x176800,_0x5a89fe){var _0x36f57f={'raw':!![],'where':{'id':_0x176800['params']['id']}},_0xf53d89={};_0xf53d89[_0x8607('0x32')]=_['keys'](db[_0x8607('0x44')][_0x8607('0x2f')]);_0xf53d89[_0x8607('0x35')]=_[_0x8607('0x34')](_0x176800[_0x8607('0x35')]);_0xf53d89[_0x8607('0x36')]=_[_0x8607('0x37')](_0xf53d89[_0x8607('0x32')],_0xf53d89[_0x8607('0x35')]);_0x36f57f['attributes']=_['intersection'](_0xf53d89[_0x8607('0x32')],qs[_0x8607('0x39')](_0x176800[_0x8607('0x35')]['fields']));_0x36f57f[_0x8607('0x38')]=_0x36f57f[_0x8607('0x38')][_0x8607('0x3a')]?_0x36f57f[_0x8607('0x38')]:_0xf53d89[_0x8607('0x32')];if(_0x176800[_0x8607('0x35')][_0x8607('0x49')]){_0x36f57f[_0x8607('0x45')]=[{'all':!![]}];}_0x36f57f=_[_0x8607('0x4a')]({},_0x36f57f,_0x176800[_0x8607('0x43')]);return db['FreshsalesField'][_0x8607('0x4b')](_0x36f57f)['then'](handleEntityNotFound(_0x5a89fe,null))[_0x8607('0x28')](respondWithResult(_0x5a89fe,null))[_0x8607('0x47')](handleError(_0x5a89fe,null));};exports[_0x8607('0x4c')]=function(_0x187742,_0x3f11f3){return db[_0x8607('0x44')][_0x8607('0x4c')](_0x187742[_0x8607('0x4d')],{})[_0x8607('0x28')](respondWithResult(_0x3f11f3,0xc9))['catch'](handleError(_0x3f11f3,null));};exports['update']=function(_0x1a3956,_0x1f47a6){if(_0x1a3956[_0x8607('0x4d')]['id']){delete _0x1a3956['body']['id'];}return db[_0x8607('0x44')][_0x8607('0x4b')]({'where':{'id':_0x1a3956[_0x8607('0x4e')]['id']}})[_0x8607('0x28')](handleEntityNotFound(_0x1f47a6,null))[_0x8607('0x28')](saveUpdates(_0x1a3956['body'],null))[_0x8607('0x28')](respondWithResult(_0x1f47a6,null))[_0x8607('0x47')](handleError(_0x1f47a6,null));};exports[_0x8607('0x29')]=function(_0x2f583a,_0x1d1771){return db[_0x8607('0x44')][_0x8607('0x4b')]({'where':{'id':_0x2f583a[_0x8607('0x4e')]['id']}})[_0x8607('0x28')](handleEntityNotFound(_0x1d1771,null))[_0x8607('0x28')](removeEntity(_0x1d1771,null))['catch'](handleError(_0x1d1771,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 58fafdb..bcd333e 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 _0x5ea2=['bluebird','request-promise','path','../../config/environment','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ea2,0x99));var _0x25ea=function(_0x5440e6,_0x22fe0d){_0x5440e6=_0x5440e6-0x0;var _0x26e8c1=_0x5ea2[_0x5440e6];return _0x26e8c1;};'use strict';var _=require(_0x25ea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x25ea('0x1'));var moment=require(_0x25ea('0x2'));var BPromise=require(_0x25ea('0x3'));var rp=require(_0x25ea('0x4'));var fs=require('fs');var path=require(_0x25ea('0x5'));var rimraf=require('rimraf');var config=require(_0x25ea('0x6'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x3e32e9,_0x310a27){return _0x3e32e9[_0x25ea('0x7')](_0x25ea('0x8'),attributes,{'tableName':_0x25ea('0x9'),'paranoid':![],'indexes':[{'name':_0x25ea('0xa'),'fields':[_0x25ea('0xb'),_0x25ea('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ff5=['../../config/environment','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4be3e7,_0x3a7f05){var _0x4d44a0=function(_0x3eafee){while(--_0x3eafee){_0x4be3e7['push'](_0x4be3e7['shift']());}};_0x4d44a0(++_0x3a7f05);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x1d92ff,_0x21fc6a){_0x1d92ff=_0x1d92ff-0x0;var _0x4ac46b=_0x2ff5[_0x1d92ff];return _0x4ac46b;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var logger=require(_0x52ff('0x1'))('api');var moment=require(_0x52ff('0x2'));var BPromise=require(_0x52ff('0x3'));var rp=require(_0x52ff('0x4'));var fs=require('fs');var path=require(_0x52ff('0x5'));var rimraf=require(_0x52ff('0x6'));var config=require(_0x52ff('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0x52ff('0x8')]=function(_0x285f60,_0x26906c){return _0x285f60['define'](_0x52ff('0x9'),attributes,{'tableName':_0x52ff('0xa'),'paranoid':![],'indexes':[{'name':_0x52ff('0xb'),'fields':[_0x52ff('0xc'),_0x52ff('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 806ad5e..115adb0 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 _0x90b1=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x452c1c,_0x4221a5){var _0x3f0c13=function(_0x4a0fed){while(--_0x4a0fed){_0x452c1c['push'](_0x452c1c['shift']());}};_0x3f0c13(++_0x4221a5);}(_0x90b1,0x1bb));var _0x190b=function(_0x2f6237,_0x14872c){_0x2f6237=_0x2f6237-0x0;var _0x449203=_0x90b1[_0x2f6237];return _0x449203;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});} \ No newline at end of file +var _0x7c09=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0xdf5452,_0x19af67){var _0xf35e7b=function(_0x4a4ad8){while(--_0x4a4ad8){_0xdf5452['push'](_0xdf5452['shift']());}};_0xf35e7b(++_0x19af67);}(_0x7c09,0x102));var _0x97c0=function(_0x49a5c2,_0x1f0b88){_0x49a5c2=_0x49a5c2-0x0;var _0x5172a6=_0x7c09[_0x49a5c2];return _0x5172a6;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var moment=require(_0x97c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x97c0('0x2'));var fs=require('fs');var Redis=require(_0x97c0('0x3'));var db=require(_0x97c0('0x4'))['db'];var utils=require(_0x97c0('0x5'));var logger=require(_0x97c0('0x6'))(_0x97c0('0x7'));var config=require(_0x97c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){return client['request'](_0x46fdd9,_0x2c19fa)[_0x97c0('0x9')](function(_0x4ac5f1){logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,'request\x20sent');logger['debug'](_0x97c0('0xc'),_0x42c6c7,_0x97c0('0xd'),JSON[_0x97c0('0xe')](_0x4ac5f1));if(_0x4ac5f1[_0x97c0('0xf')]){if(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x10')]===0x1f4){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x293785(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);}logger[_0x97c0('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x109bc8(_0x4ac5f1[_0x97c0('0xf')]['message']);}else{logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,_0x97c0('0xd'));_0x109bc8(_0x4ac5f1[_0x97c0('0x12')][_0x97c0('0x11')]);}})[_0x97c0('0x13')](function(_0x49c0d9){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x49c0d9);_0x293785(_0x49c0d9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c18bb90..dccb580 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(_0x2652d5,_0x3ceda5){var _0x31196a=function(_0x5e9404){while(--_0x5e9404){_0x2652d5['push'](_0x2652d5['shift']());}};_0x31196a(++_0x3ceda5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 _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(_0x11ac91,_0x20c725){var _0x5a63dc=function(_0x157380){while(--_0x157380){_0x11ac91['push'](_0x11ac91['shift']());}};_0x5a63dc(++_0x20c725);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 7a03008..86d100f 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 _0x5630=['sequelize','exports','STRING','newTab','integrationTab'];(function(_0x5e67d6,_0x27bc58){var _0x471bf4=function(_0x4b583e){while(--_0x4b583e){_0x5e67d6['push'](_0x5e67d6['shift']());}};_0x471bf4(++_0x27bc58);}(_0x5630,0xc3));var _0x0563=function(_0x4078e5,_0x4a1db2){_0x4078e5=_0x4078e5-0x0;var _0xf466b=_0x5630[_0x4078e5];return _0xf466b;};'use strict';var Sequelize=require(_0x0563('0x0'));module[_0x0563('0x1')]={'name':{'type':Sequelize[_0x0563('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x0563('0x2')]},'password':{'type':Sequelize[_0x0563('0x2')]},'clientId':{'type':Sequelize[_0x0563('0x2')]},'clientSecret':{'type':Sequelize[_0x0563('0x2')]},'securityToken':{'type':Sequelize[_0x0563('0x2')]},'serverUrl':{'type':Sequelize[_0x0563('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x0563('0x3')),'defaultValue':_0x0563('0x4')}}; \ No newline at end of file +var _0x27eb=['STRING','username','integrationTab','newTab','sequelize','exports'];(function(_0x56a485,_0x3a7460){var _0x251950=function(_0x4f0588){while(--_0x4f0588){_0x56a485['push'](_0x56a485['shift']());}};_0x251950(++_0x3a7460);}(_0x27eb,0xd0));var _0xb27e=function(_0x58b665,_0x277208){_0x58b665=_0x58b665-0x0;var _0x4e1311=_0x27eb[_0x58b665];return _0x4e1311;};'use strict';var Sequelize=require(_0xb27e('0x0'));module[_0xb27e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb27e('0x2')],'unique':_0xb27e('0x3')},'remoteUri':{'type':Sequelize[_0xb27e('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb27e('0x2')]},'clientSecret':{'type':Sequelize[_0xb27e('0x2')]},'securityToken':{'type':Sequelize[_0xb27e('0x2')]},'serverUrl':{'type':Sequelize[_0xb27e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb27e('0x4'),_0xb27e('0x5')),'defaultValue':_0xb27e('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d9d9c74..840310a 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 _0xac95=['addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','boolean','email','textarea','phone','remove','includes','custom','picklistValues','value','true','false','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','SalesforceAccount','intersection','find','catch','create','body','update','getConfigurations','findOne'];(function(_0x1001cc,_0x266f35){var _0x219976=function(_0x2e6d59){while(--_0x2e6d59){_0x1001cc['push'](_0x1001cc['shift']());}};_0x219976(++_0x266f35);}(_0xac95,0xa8));var _0x5ac9=function(_0x3cab04,_0x2009ee){_0x3cab04=_0x3cab04-0x0;var _0x4a0432=_0xac95[_0x3cab04];return _0x4a0432;};'use strict';var emlformat=require(_0x5ac9('0x0'));var rimraf=require(_0x5ac9('0x1'));var zipdir=require(_0x5ac9('0x2'));var jsonpatch=require(_0x5ac9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ac9('0x4'));var Mustache=require(_0x5ac9('0x5'));var util=require('util');var path=require(_0x5ac9('0x6'));var sox=require(_0x5ac9('0x7'));var csv=require('to-csv');var ejs=require(_0x5ac9('0x8'));var fs=require('fs');var fs_extra=require(_0x5ac9('0x9'));var _=require(_0x5ac9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ac9('0xb'));var deskjs=require(_0x5ac9('0xc'));var toCsv=require(_0x5ac9('0xd'));var querystring=require(_0x5ac9('0xe'));var Papa=require(_0x5ac9('0xf'));var Redis=require(_0x5ac9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5ac9('0x11'));var as=require(_0x5ac9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ac9('0x13'))('api');var utils=require(_0x5ac9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5ac9('0x15'));var db=require(_0x5ac9('0x16'))['db'];var integrations=require(_0x5ac9('0x17'));function respondWithStatusCode(_0x40eb62,_0x4f9a04){_0x4f9a04=_0x4f9a04||0xcc;return function(_0x517409){if(_0x517409){return _0x40eb62[_0x5ac9('0x18')](_0x4f9a04);}return _0x40eb62['status'](_0x4f9a04)[_0x5ac9('0x19')]();};}function respondWithResult(_0x364007,_0x50658c){_0x50658c=_0x50658c||0xc8;return function(_0x3dcc9e){if(_0x3dcc9e){return _0x364007[_0x5ac9('0x1a')](_0x50658c)[_0x5ac9('0x1b')](_0x3dcc9e);}};}function respondWithFilteredResult(_0x122590,_0x456ed9){return function(_0x2fe47e){if(_0x2fe47e){var _0x44a5b1=typeof _0x456ed9[_0x5ac9('0x1c')]===_0x5ac9('0x1d')&&typeof _0x456ed9['limit']==='undefined';var _0x352874=_0x2fe47e[_0x5ac9('0x1e')];var _0x102c85=_0x44a5b1?0x0:_0x456ed9[_0x5ac9('0x1c')];var _0x91823f=_0x44a5b1?_0x2fe47e[_0x5ac9('0x1e')]:_0x456ed9[_0x5ac9('0x1c')]+_0x456ed9[_0x5ac9('0x1f')];var _0x293e4e;if(_0x91823f>=_0x352874){_0x91823f=_0x352874;_0x293e4e=0xc8;}else{_0x293e4e=0xce;}_0x122590[_0x5ac9('0x1a')](_0x293e4e);return _0x122590[_0x5ac9('0x20')](_0x5ac9('0x21'),_0x102c85+'-'+_0x91823f+'/'+_0x352874)[_0x5ac9('0x1b')](_0x2fe47e);}return null;};}function patchUpdates(_0x479c6b){return function(_0xdf630){try{jsonpatch[_0x5ac9('0x22')](_0xdf630,_0x479c6b,!![]);}catch(_0x1a983d){return BPromise[_0x5ac9('0x23')](_0x1a983d);}return _0xdf630[_0x5ac9('0x24')]();};}function saveUpdates(_0x492679,_0x45417d){return function(_0xdd1487){if(_0xdd1487){return _0xdd1487['update'](_0x492679)['then'](function(_0x5a4664){return _0x5a4664;});}return null;};}function removeEntity(_0xc36d2,_0x2e666b){return function(_0x4e3b64){if(_0x4e3b64){return _0x4e3b64['destroy']()[_0x5ac9('0x25')](function(){_0xc36d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1bb5,_0x505acc){return function(_0x12f725){if(!_0x12f725){_0x2d1bb5[_0x5ac9('0x18')](0x194);}return _0x12f725;};}function handleError(_0x770c48,_0x3a7f68){_0x3a7f68=_0x3a7f68||0x1f4;return function(_0x34c273){logger[_0x5ac9('0x26')](_0x34c273[_0x5ac9('0x27')]);if(_0x34c273[_0x5ac9('0x28')]){delete _0x34c273[_0x5ac9('0x28')];}_0x770c48['status'](_0x3a7f68)[_0x5ac9('0x29')](_0x34c273);};}exports[_0x5ac9('0x2a')]=function(_0x2a7db9,_0x3a536c){var _0x3d51ab={},_0x58c9be={},_0x47f6ad={'count':0x0,'rows':[]};var _0x2e5b69=_[_0x5ac9('0x2b')](db['SalesforceAccount'][_0x5ac9('0x2c')],function(_0x53d54e){return{'name':_0x53d54e[_0x5ac9('0x2d')],'type':_0x53d54e[_0x5ac9('0x2e')][_0x5ac9('0x2f')]};});_0x58c9be['model']=_[_0x5ac9('0x2b')](_0x2e5b69,_0x5ac9('0x28'));_0x58c9be[_0x5ac9('0x30')]=_[_0x5ac9('0x31')](_0x2a7db9[_0x5ac9('0x30')]);_0x58c9be[_0x5ac9('0x32')]=_['intersection'](_0x58c9be['model'],_0x58c9be[_0x5ac9('0x30')]);_0x3d51ab['attributes']=_['intersection'](_0x58c9be[_0x5ac9('0x33')],qs[_0x5ac9('0x34')](_0x2a7db9[_0x5ac9('0x30')][_0x5ac9('0x34')]));_0x3d51ab[_0x5ac9('0x35')]=_0x3d51ab[_0x5ac9('0x35')][_0x5ac9('0x36')]?_0x3d51ab[_0x5ac9('0x35')]:_0x58c9be[_0x5ac9('0x33')];if(!_0x2a7db9['query'][_0x5ac9('0x37')](_0x5ac9('0x38'))){_0x3d51ab['limit']=qs['limit'](_0x2a7db9[_0x5ac9('0x30')][_0x5ac9('0x1f')]);_0x3d51ab[_0x5ac9('0x1c')]=qs[_0x5ac9('0x1c')](_0x2a7db9['query'][_0x5ac9('0x1c')]);}_0x3d51ab['order']=qs[_0x5ac9('0x39')](_0x2a7db9[_0x5ac9('0x30')][_0x5ac9('0x39')]);_0x3d51ab[_0x5ac9('0x3a')]=qs[_0x5ac9('0x32')](_[_0x5ac9('0x3b')](_0x2a7db9[_0x5ac9('0x30')],_0x58c9be[_0x5ac9('0x32')]),_0x2e5b69);if(_0x2a7db9[_0x5ac9('0x30')][_0x5ac9('0x3c')]){_0x3d51ab[_0x5ac9('0x3a')]=_[_0x5ac9('0x3d')](_0x3d51ab['where'],{'$or':_['map'](_0x2e5b69,function(_0x37a7e1){if(_0x37a7e1[_0x5ac9('0x2e')]!==_0x5ac9('0x3e')){var _0x1adf44={};_0x1adf44[_0x37a7e1[_0x5ac9('0x28')]]={'$like':'%'+_0x2a7db9[_0x5ac9('0x30')]['filter']+'%'};return _0x1adf44;}})});}_0x3d51ab=_[_0x5ac9('0x3d')]({},_0x3d51ab,_0x2a7db9[_0x5ac9('0x3f')]);var _0x5640c4={'where':_0x3d51ab['where']};return db['SalesforceAccount'][_0x5ac9('0x1e')](_0x5640c4)[_0x5ac9('0x25')](function(_0x46a9fe){_0x47f6ad[_0x5ac9('0x1e')]=_0x46a9fe;if(_0x2a7db9['query'][_0x5ac9('0x40')]){_0x3d51ab['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x5ac9('0x41')](_0x3d51ab);})[_0x5ac9('0x25')](function(_0x57488d){_0x47f6ad[_0x5ac9('0x42')]=_0x57488d;return _0x47f6ad;})[_0x5ac9('0x25')](respondWithFilteredResult(_0x3a536c,_0x3d51ab))['catch'](handleError(_0x3a536c,null));};exports[_0x5ac9('0x43')]=function(_0xba7c84,_0x433634){var _0x1caf84={'raw':![],'where':{'id':_0xba7c84[_0x5ac9('0x44')]['id']}},_0x230daa={};_0x230daa[_0x5ac9('0x33')]=_[_0x5ac9('0x31')](db[_0x5ac9('0x45')][_0x5ac9('0x2c')]);_0x230daa[_0x5ac9('0x30')]=_[_0x5ac9('0x31')](_0xba7c84['query']);_0x230daa[_0x5ac9('0x32')]=_[_0x5ac9('0x46')](_0x230daa[_0x5ac9('0x33')],_0x230daa['query']);_0x1caf84[_0x5ac9('0x35')]=_[_0x5ac9('0x46')](_0x230daa[_0x5ac9('0x33')],qs['fields'](_0xba7c84[_0x5ac9('0x30')][_0x5ac9('0x34')]));_0x1caf84[_0x5ac9('0x35')]=_0x1caf84[_0x5ac9('0x35')][_0x5ac9('0x36')]?_0x1caf84[_0x5ac9('0x35')]:_0x230daa['model'];if(_0xba7c84['query'][_0x5ac9('0x40')]){_0x1caf84['include']=[{'all':!![]}];}_0x1caf84=_[_0x5ac9('0x3d')]({},_0x1caf84,_0xba7c84['options']);return db[_0x5ac9('0x45')][_0x5ac9('0x47')](_0x1caf84)[_0x5ac9('0x25')](handleEntityNotFound(_0x433634,null))[_0x5ac9('0x25')](respondWithResult(_0x433634,null))[_0x5ac9('0x48')](handleError(_0x433634,null));};exports[_0x5ac9('0x49')]=function(_0x324b7d,_0x20b55b){return db[_0x5ac9('0x45')][_0x5ac9('0x49')](_0x324b7d[_0x5ac9('0x4a')],{})['then'](respondWithResult(_0x20b55b,0xc9))[_0x5ac9('0x48')](handleError(_0x20b55b,null));};exports[_0x5ac9('0x4b')]=function(_0x482df4,_0x5909a4){if(_0x482df4[_0x5ac9('0x4a')]['id']){delete _0x482df4[_0x5ac9('0x4a')]['id'];}return db[_0x5ac9('0x45')]['find']({'where':{'id':_0x482df4[_0x5ac9('0x44')]['id']}})[_0x5ac9('0x25')](handleEntityNotFound(_0x5909a4,null))[_0x5ac9('0x25')](saveUpdates(_0x482df4[_0x5ac9('0x4a')],null))[_0x5ac9('0x25')](respondWithResult(_0x5909a4,null))[_0x5ac9('0x48')](handleError(_0x5909a4,null));};exports['destroy']=function(_0x47a7b8,_0xcc5418){return db[_0x5ac9('0x45')]['find']({'where':{'id':_0x47a7b8[_0x5ac9('0x44')]['id']}})[_0x5ac9('0x25')](handleEntityNotFound(_0xcc5418,null))[_0x5ac9('0x25')](removeEntity(_0xcc5418,null))[_0x5ac9('0x48')](handleError(_0xcc5418,null));};exports[_0x5ac9('0x4c')]=function(_0x575a3f,_0x449ca6,_0x26846f){var _0xcd1c75={};var _0x52e811={};var _0x16b248;var _0x17c9c7;return db[_0x5ac9('0x45')][_0x5ac9('0x4d')]({'where':{'id':_0x575a3f[_0x5ac9('0x44')]['id']}})['then'](handleEntityNotFound(_0x449ca6,null))['then'](function(_0x37ec9a){if(_0x37ec9a){_0x16b248=_0x37ec9a;_0x52e811['model']=_[_0x5ac9('0x31')](db['SalesforceConfiguration'][_0x5ac9('0x2c')]);_0x52e811['query']=_[_0x5ac9('0x31')](_0x575a3f[_0x5ac9('0x30')]);_0x52e811['filters']=_['intersection'](_0x52e811[_0x5ac9('0x33')],_0x52e811[_0x5ac9('0x30')]);_0xcd1c75[_0x5ac9('0x35')]=_[_0x5ac9('0x46')](_0x52e811[_0x5ac9('0x33')],qs[_0x5ac9('0x34')](_0x575a3f[_0x5ac9('0x30')][_0x5ac9('0x34')]));_0xcd1c75['attributes']=_0xcd1c75[_0x5ac9('0x35')]['length']?_0xcd1c75[_0x5ac9('0x35')]:_0x52e811[_0x5ac9('0x33')];_0xcd1c75['order']=qs[_0x5ac9('0x39')](_0x575a3f['query'][_0x5ac9('0x39')]);_0xcd1c75[_0x5ac9('0x3a')]=qs[_0x5ac9('0x32')](_[_0x5ac9('0x3b')](_0x575a3f[_0x5ac9('0x30')],_0x52e811['filters']));if(_0x575a3f[_0x5ac9('0x30')][_0x5ac9('0x3c')]){_0xcd1c75[_0x5ac9('0x3a')]=_['merge'](_0xcd1c75[_0x5ac9('0x3a')],{'$or':_[_0x5ac9('0x2b')](_0xcd1c75[_0x5ac9('0x35')],function(_0x4e3154){var _0x1bdb84={};_0x1bdb84[_0x4e3154]={'$like':'%'+_0x575a3f['query'][_0x5ac9('0x3c')]+'%'};return _0x1bdb84;})});}_0xcd1c75=_[_0x5ac9('0x3d')]({},_0xcd1c75,_0x575a3f['options']);return _0x16b248['getConfigurations'](_0xcd1c75);}})[_0x5ac9('0x25')](function(_0x92fae7){if(_0x92fae7){_0x17c9c7=_0x92fae7[_0x5ac9('0x36')];if(!_0x575a3f[_0x5ac9('0x30')][_0x5ac9('0x37')](_0x5ac9('0x38'))){_0xcd1c75[_0x5ac9('0x1f')]=qs[_0x5ac9('0x1f')](_0x575a3f['query'][_0x5ac9('0x1f')]);_0xcd1c75[_0x5ac9('0x1c')]=qs['offset'](_0x575a3f['query'][_0x5ac9('0x1c')]);}return _0x16b248[_0x5ac9('0x4c')](_0xcd1c75);}})['then'](function(_0x1fd466){if(_0x1fd466){return _0x1fd466?{'count':_0x17c9c7,'rows':_0x1fd466}:null;}})[_0x5ac9('0x25')](respondWithResult(_0x449ca6,null))[_0x5ac9('0x48')](handleError(_0x449ca6,null));};exports[_0x5ac9('0x4e')]=function(_0x3da33b,_0x24dbd5,_0x2e6777){if(_0x3da33b[_0x5ac9('0x4a')]['id']){delete _0x3da33b[_0x5ac9('0x4a')]['id'];}return db[_0x5ac9('0x45')][_0x5ac9('0x4d')]({'where':{'id':_0x3da33b[_0x5ac9('0x44')]['id']}})[_0x5ac9('0x25')](handleEntityNotFound(_0x24dbd5,null))[_0x5ac9('0x25')](function(_0x3b5233){if(_0x3b5233){_0x3da33b['body'][_0x5ac9('0x4f')]=_0x3b5233['id'];_0x3da33b['body'][_0x5ac9('0x50')]=integrations[_0x5ac9('0x51')](_0x3da33b[_0x5ac9('0x4a')]['channel'],_0x3da33b['body'][_0x5ac9('0x2e')]);_0x3da33b[_0x5ac9('0x4a')][_0x5ac9('0x52')]=integrations['getDescriptions'](_0x3da33b[_0x5ac9('0x4a')][_0x5ac9('0x53')],_0x3da33b['body']['type']);return db[_0x5ac9('0x54')]['create'](_0x3da33b[_0x5ac9('0x4a')],{'include':[{'model':db[_0x5ac9('0x55')],'as':_0x5ac9('0x50')},{'model':db['SalesforceField'],'as':_0x5ac9('0x52')}]});}return null;})[_0x5ac9('0x25')](respondWithResult(_0x24dbd5,null))['catch'](handleError(_0x24dbd5,null));};exports[_0x5ac9('0x56')]=function(_0x3af258,_0x598aff,_0x3c2ab0){var _0x12e4a2;var _0x5655bd='';var _0x2d1757=_0x5ac9('0x57');return db['SalesforceAccount'][_0x5ac9('0x4d')]({'where':{'id':_0x3af258[_0x5ac9('0x44')]['id']},'attributes':['id',_0x5ac9('0x58'),'clientId',_0x5ac9('0x59'),_0x5ac9('0x5a'),_0x5ac9('0x5b'),_0x5ac9('0x5c')]})[_0x5ac9('0x25')](handleEntityNotFound(_0x598aff,null))[_0x5ac9('0x25')](function(_0xaa6626){if(_0xaa6626){_0x5655bd=_0xaa6626[_0x5ac9('0x58')];var _0x549bab=_0x5655bd[_0x5ac9('0x5d')](-0x1);if(_0x549bab==='/'){_0x5655bd=_0x5655bd[_0x5ac9('0x5e')](0x0,_0x5655bd[_0x5ac9('0x5f')](_0x549bab));}_0x12e4a2=new jsforce[(_0x5ac9('0x60'))]({'oauth2':{'loginUrl':_0x5655bd,'clientId':_0xaa6626['clientId'],'clientSecret':_0xaa6626[_0x5ac9('0x59')]}});return _0x12e4a2['login'](_0xaa6626[_0x5ac9('0x5a')],_0xaa6626[_0x5ac9('0x5b')][_0x5ac9('0x61')](_0xaa6626[_0x5ac9('0x5c')]));}})[_0x5ac9('0x25')](function(_0x5db9a3){if(_0x5db9a3){if(!_['isNil'](_0x3af258[_0x5ac9('0x30')]['ticketType'])){_0x2d1757=_0x3af258[_0x5ac9('0x30')][_0x5ac9('0x62')];}return _0x12e4a2[_0x5ac9('0x63')](_0x2d1757)[_0x5ac9('0x64')]();}})['then'](function(_0x171afb){var _0x5ba657=[_0x5ac9('0x65'),_0x5ac9('0x66'),_0x5ac9('0x67'),_0x5ac9('0x68'),_0x5ac9('0x69'),_0x5ac9('0x6a')];var _0x466bf3=['string',_0x5ac9('0x6b'),'picklist',_0x5ac9('0x6c'),_0x5ac9('0x6d'),_0x5ac9('0x6e'),_0x5ac9('0x6f')];if(_0x171afb){_[_0x5ac9('0x70')](_0x171afb['fields'],function(_0xb58372){return _0x5ba657[_0x5ac9('0x71')](_0xb58372[_0x5ac9('0x28')])||!_0x466bf3['includes'](_0xb58372[_0x5ac9('0x2e')]);});return{'count':_0x171afb['fields']['length'],'rows':_[_0x5ac9('0x2b')](_0x171afb[_0x5ac9('0x34')],function(_0x435acb){return{'id':_0x435acb[_0x5ac9('0x28')],'name':_0x435acb['label'],'custom':_0x435acb[_0x5ac9('0x72')],'options':_0x435acb[_0x5ac9('0x73')][_0x5ac9('0x36')]>0x0?_[_0x5ac9('0x2b')](_0x435acb[_0x5ac9('0x73')],function(_0x49caac){return{'name':_0x49caac['label'],'value':_0x49caac[_0x5ac9('0x74')]};}):_0x435acb[_0x5ac9('0x2e')]==_0x5ac9('0x6c')?[{'name':'True','value':_0x5ac9('0x75')},{'name':'False','value':_0x5ac9('0x76')}]:[]};})};}})[_0x5ac9('0x25')](respondWithResult(_0x598aff,null))['catch'](function(_0x2219d6){var _0x11d00e=_0x3af258['query'][_0x5ac9('0x77')]?0x1f4:_0x2219d6[_0x5ac9('0x78')]||0x1f4;logger[_0x5ac9('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x5ac9('0x56'),_0x11d00e,JSON[_0x5ac9('0x79')](_0x2219d6));delete _0x2219d6[_0x5ac9('0x28')];if(_0x11d00e===0x191){_0x11d00e=0x190;}_0x598aff[_0x5ac9('0x1a')](_0x11d00e)[_0x5ac9('0x29')](_0x3af258[_0x5ac9('0x30')][_0x5ac9('0x77')]?{'message':_0x5ac9('0x7a'),'statusCode':_0x2219d6[_0x5ac9('0x78')]}:_0x2219d6);});}; \ No newline at end of file +var _0x7cb5=['Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','value','True','true','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','include','SalesforceAccount','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceConfiguration','SalesforceField','Descriptions'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x7cb5,0x1a2));var _0x57cb=function(_0x36fbfe,_0xadb2f7){_0x36fbfe=_0x36fbfe-0x0;var _0x1a69be=_0x7cb5[_0x36fbfe];return _0x1a69be;};'use strict';var emlformat=require(_0x57cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57cb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x57cb('0x2'));var BPromise=require(_0x57cb('0x3'));var Mustache=require('mustache');var util=require(_0x57cb('0x4'));var path=require(_0x57cb('0x5'));var sox=require(_0x57cb('0x6'));var csv=require(_0x57cb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57cb('0x8'));var _=require(_0x57cb('0x9'));var squel=require(_0x57cb('0xa'));var crypto=require('crypto');var jsforce=require(_0x57cb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x57cb('0x7'));var querystring=require(_0x57cb('0xc'));var Papa=require(_0x57cb('0xd'));var Redis=require(_0x57cb('0xe'));var authService=require(_0x57cb('0xf'));var qs=require(_0x57cb('0x10'));var as=require(_0x57cb('0x11'));var hardwareService=require(_0x57cb('0x12'));var logger=require('../../config/logger')(_0x57cb('0x13'));var utils=require(_0x57cb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x57cb('0x15'));var db=require(_0x57cb('0x16'))['db'];var integrations=require(_0x57cb('0x17'));function respondWithStatusCode(_0x2db155,_0x5c473e){_0x5c473e=_0x5c473e||0xcc;return function(_0x14e858){if(_0x14e858){return _0x2db155[_0x57cb('0x18')](_0x5c473e);}return _0x2db155[_0x57cb('0x19')](_0x5c473e)[_0x57cb('0x1a')]();};}function respondWithResult(_0x16c146,_0x406d0c){_0x406d0c=_0x406d0c||0xc8;return function(_0x146a10){if(_0x146a10){return _0x16c146['status'](_0x406d0c)[_0x57cb('0x1b')](_0x146a10);}};}function respondWithFilteredResult(_0x59d3f1,_0x5d2eb4){return function(_0x4ba80){if(_0x4ba80){var _0x3fbd63=typeof _0x5d2eb4[_0x57cb('0x1c')]===_0x57cb('0x1d')&&typeof _0x5d2eb4[_0x57cb('0x1e')]==='undefined';var _0x193f5e=_0x4ba80['count'];var _0x2450e2=_0x3fbd63?0x0:_0x5d2eb4['offset'];var _0x918a3a=_0x3fbd63?_0x4ba80[_0x57cb('0x1f')]:_0x5d2eb4[_0x57cb('0x1c')]+_0x5d2eb4[_0x57cb('0x1e')];var _0xc416a9;if(_0x918a3a>=_0x193f5e){_0x918a3a=_0x193f5e;_0xc416a9=0xc8;}else{_0xc416a9=0xce;}_0x59d3f1[_0x57cb('0x19')](_0xc416a9);return _0x59d3f1[_0x57cb('0x20')](_0x57cb('0x21'),_0x2450e2+'-'+_0x918a3a+'/'+_0x193f5e)[_0x57cb('0x1b')](_0x4ba80);}return null;};}function patchUpdates(_0x483042){return function(_0x5d0c2a){try{jsonpatch[_0x57cb('0x22')](_0x5d0c2a,_0x483042,!![]);}catch(_0x2bf349){return BPromise[_0x57cb('0x23')](_0x2bf349);}return _0x5d0c2a[_0x57cb('0x24')]();};}function saveUpdates(_0x52ac14,_0xcb0848){return function(_0x132cc2){if(_0x132cc2){return _0x132cc2[_0x57cb('0x25')](_0x52ac14)[_0x57cb('0x26')](function(_0x29d5da){return _0x29d5da;});}return null;};}function removeEntity(_0x2457fc,_0x718e43){return function(_0xa4bd63){if(_0xa4bd63){return _0xa4bd63[_0x57cb('0x27')]()['then'](function(){_0x2457fc[_0x57cb('0x19')](0xcc)[_0x57cb('0x1a')]();});}};}function handleEntityNotFound(_0x540e8c,_0x4f406c){return function(_0x4f9172){if(!_0x4f9172){_0x540e8c['sendStatus'](0x194);}return _0x4f9172;};}function handleError(_0x2fddee,_0x5de497){_0x5de497=_0x5de497||0x1f4;return function(_0x30d263){logger['error'](_0x30d263[_0x57cb('0x28')]);if(_0x30d263[_0x57cb('0x29')]){delete _0x30d263[_0x57cb('0x29')];}_0x2fddee[_0x57cb('0x19')](_0x5de497)[_0x57cb('0x2a')](_0x30d263);};}exports['index']=function(_0x13dbd0,_0x281f18){var _0x33d760={},_0x4a1a36={},_0x40817e={'count':0x0,'rows':[]};var _0x322642=_[_0x57cb('0x2b')](db['SalesforceAccount'][_0x57cb('0x2c')],function(_0x8f830b){return{'name':_0x8f830b['fieldName'],'type':_0x8f830b['type'][_0x57cb('0x2d')]};});_0x4a1a36[_0x57cb('0x2e')]=_[_0x57cb('0x2b')](_0x322642,_0x57cb('0x29'));_0x4a1a36['query']=_[_0x57cb('0x2f')](_0x13dbd0[_0x57cb('0x30')]);_0x4a1a36[_0x57cb('0x31')]=_[_0x57cb('0x32')](_0x4a1a36[_0x57cb('0x2e')],_0x4a1a36[_0x57cb('0x30')]);_0x33d760['attributes']=_[_0x57cb('0x32')](_0x4a1a36[_0x57cb('0x2e')],qs[_0x57cb('0x33')](_0x13dbd0[_0x57cb('0x30')][_0x57cb('0x33')]));_0x33d760[_0x57cb('0x34')]=_0x33d760[_0x57cb('0x34')][_0x57cb('0x35')]?_0x33d760[_0x57cb('0x34')]:_0x4a1a36['model'];if(!_0x13dbd0['query']['hasOwnProperty'](_0x57cb('0x36'))){_0x33d760[_0x57cb('0x1e')]=qs[_0x57cb('0x1e')](_0x13dbd0[_0x57cb('0x30')]['limit']);_0x33d760['offset']=qs['offset'](_0x13dbd0[_0x57cb('0x30')][_0x57cb('0x1c')]);}_0x33d760[_0x57cb('0x37')]=qs[_0x57cb('0x38')](_0x13dbd0[_0x57cb('0x30')][_0x57cb('0x38')]);_0x33d760[_0x57cb('0x39')]=qs[_0x57cb('0x31')](_['pick'](_0x13dbd0[_0x57cb('0x30')],_0x4a1a36[_0x57cb('0x31')]),_0x322642);if(_0x13dbd0[_0x57cb('0x30')][_0x57cb('0x3a')]){_0x33d760[_0x57cb('0x39')]=_['merge'](_0x33d760[_0x57cb('0x39')],{'$or':_[_0x57cb('0x2b')](_0x322642,function(_0x3000b1){if(_0x3000b1[_0x57cb('0x3b')]!==_0x57cb('0x3c')){var _0x2de70f={};_0x2de70f[_0x3000b1[_0x57cb('0x29')]]={'$like':'%'+_0x13dbd0['query']['filter']+'%'};return _0x2de70f;}})});}_0x33d760=_[_0x57cb('0x3d')]({},_0x33d760,_0x13dbd0[_0x57cb('0x3e')]);var _0x65d5d0={'where':_0x33d760[_0x57cb('0x39')]};return db['SalesforceAccount']['count'](_0x65d5d0)['then'](function(_0x67fb5f){_0x40817e[_0x57cb('0x1f')]=_0x67fb5f;if(_0x13dbd0[_0x57cb('0x30')]['includeAll']){_0x33d760[_0x57cb('0x3f')]=[{'all':!![]}];}return db[_0x57cb('0x40')]['findAll'](_0x33d760);})['then'](function(_0xaf5127){_0x40817e[_0x57cb('0x41')]=_0xaf5127;return _0x40817e;})[_0x57cb('0x26')](respondWithFilteredResult(_0x281f18,_0x33d760))[_0x57cb('0x42')](handleError(_0x281f18,null));};exports[_0x57cb('0x43')]=function(_0x3ff6a3,_0x5f004e){var _0x4bec79={'raw':![],'where':{'id':_0x3ff6a3[_0x57cb('0x44')]['id']}},_0x5de6ce={};_0x5de6ce[_0x57cb('0x2e')]=_[_0x57cb('0x2f')](db['SalesforceAccount']['rawAttributes']);_0x5de6ce[_0x57cb('0x30')]=_[_0x57cb('0x2f')](_0x3ff6a3[_0x57cb('0x30')]);_0x5de6ce[_0x57cb('0x31')]=_[_0x57cb('0x32')](_0x5de6ce[_0x57cb('0x2e')],_0x5de6ce[_0x57cb('0x30')]);_0x4bec79[_0x57cb('0x34')]=_['intersection'](_0x5de6ce[_0x57cb('0x2e')],qs['fields'](_0x3ff6a3['query']['fields']));_0x4bec79['attributes']=_0x4bec79['attributes']['length']?_0x4bec79[_0x57cb('0x34')]:_0x5de6ce[_0x57cb('0x2e')];if(_0x3ff6a3[_0x57cb('0x30')][_0x57cb('0x45')]){_0x4bec79['include']=[{'all':!![]}];}_0x4bec79=_[_0x57cb('0x3d')]({},_0x4bec79,_0x3ff6a3['options']);return db[_0x57cb('0x40')]['find'](_0x4bec79)[_0x57cb('0x26')](handleEntityNotFound(_0x5f004e,null))[_0x57cb('0x26')](respondWithResult(_0x5f004e,null))[_0x57cb('0x42')](handleError(_0x5f004e,null));};exports[_0x57cb('0x46')]=function(_0x1a5e77,_0x32c1b5){return db['SalesforceAccount'][_0x57cb('0x46')](_0x1a5e77[_0x57cb('0x47')],{})[_0x57cb('0x26')](respondWithResult(_0x32c1b5,0xc9))[_0x57cb('0x42')](handleError(_0x32c1b5,null));};exports['update']=function(_0x40a54a,_0x58cd6b){if(_0x40a54a[_0x57cb('0x47')]['id']){delete _0x40a54a[_0x57cb('0x47')]['id'];}return db[_0x57cb('0x40')][_0x57cb('0x48')]({'where':{'id':_0x40a54a[_0x57cb('0x44')]['id']}})['then'](handleEntityNotFound(_0x58cd6b,null))[_0x57cb('0x26')](saveUpdates(_0x40a54a[_0x57cb('0x47')],null))[_0x57cb('0x26')](respondWithResult(_0x58cd6b,null))['catch'](handleError(_0x58cd6b,null));};exports[_0x57cb('0x27')]=function(_0x854b97,_0x19f863){return db['SalesforceAccount'][_0x57cb('0x48')]({'where':{'id':_0x854b97[_0x57cb('0x44')]['id']}})[_0x57cb('0x26')](handleEntityNotFound(_0x19f863,null))[_0x57cb('0x26')](removeEntity(_0x19f863,null))[_0x57cb('0x42')](handleError(_0x19f863,null));};exports[_0x57cb('0x49')]=function(_0x1d3d60,_0x37f972,_0x41e59e){var _0x49db1e={};var _0x3a6f44={};var _0x1e979a;var _0x4276bc;return db[_0x57cb('0x40')][_0x57cb('0x4a')]({'where':{'id':_0x1d3d60[_0x57cb('0x44')]['id']}})[_0x57cb('0x26')](handleEntityNotFound(_0x37f972,null))[_0x57cb('0x26')](function(_0x2263fa){if(_0x2263fa){_0x1e979a=_0x2263fa;_0x3a6f44[_0x57cb('0x2e')]=_[_0x57cb('0x2f')](db['SalesforceConfiguration'][_0x57cb('0x2c')]);_0x3a6f44[_0x57cb('0x30')]=_[_0x57cb('0x2f')](_0x1d3d60[_0x57cb('0x30')]);_0x3a6f44[_0x57cb('0x31')]=_[_0x57cb('0x32')](_0x3a6f44[_0x57cb('0x2e')],_0x3a6f44['query']);_0x49db1e[_0x57cb('0x34')]=_['intersection'](_0x3a6f44[_0x57cb('0x2e')],qs[_0x57cb('0x33')](_0x1d3d60['query']['fields']));_0x49db1e['attributes']=_0x49db1e[_0x57cb('0x34')]['length']?_0x49db1e[_0x57cb('0x34')]:_0x3a6f44[_0x57cb('0x2e')];_0x49db1e[_0x57cb('0x37')]=qs[_0x57cb('0x38')](_0x1d3d60[_0x57cb('0x30')][_0x57cb('0x38')]);_0x49db1e[_0x57cb('0x39')]=qs[_0x57cb('0x31')](_[_0x57cb('0x4b')](_0x1d3d60[_0x57cb('0x30')],_0x3a6f44[_0x57cb('0x31')]));if(_0x1d3d60[_0x57cb('0x30')]['filter']){_0x49db1e[_0x57cb('0x39')]=_[_0x57cb('0x3d')](_0x49db1e['where'],{'$or':_[_0x57cb('0x2b')](_0x49db1e['attributes'],function(_0x6fc6b1){var _0x2e76f4={};_0x2e76f4[_0x6fc6b1]={'$like':'%'+_0x1d3d60['query'][_0x57cb('0x3a')]+'%'};return _0x2e76f4;})});}_0x49db1e=_[_0x57cb('0x3d')]({},_0x49db1e,_0x1d3d60['options']);return _0x1e979a[_0x57cb('0x49')](_0x49db1e);}})['then'](function(_0x484c6a){if(_0x484c6a){_0x4276bc=_0x484c6a[_0x57cb('0x35')];if(!_0x1d3d60[_0x57cb('0x30')][_0x57cb('0x4c')](_0x57cb('0x36'))){_0x49db1e[_0x57cb('0x1e')]=qs[_0x57cb('0x1e')](_0x1d3d60['query'][_0x57cb('0x1e')]);_0x49db1e[_0x57cb('0x1c')]=qs['offset'](_0x1d3d60[_0x57cb('0x30')]['offset']);}return _0x1e979a[_0x57cb('0x49')](_0x49db1e);}})[_0x57cb('0x26')](function(_0x52d834){if(_0x52d834){return _0x52d834?{'count':_0x4276bc,'rows':_0x52d834}:null;}})['then'](respondWithResult(_0x37f972,null))['catch'](handleError(_0x37f972,null));};exports[_0x57cb('0x4d')]=function(_0x59f23e,_0x1ea126,_0x27536c){if(_0x59f23e[_0x57cb('0x47')]['id']){delete _0x59f23e[_0x57cb('0x47')]['id'];}return db[_0x57cb('0x40')][_0x57cb('0x4a')]({'where':{'id':_0x59f23e[_0x57cb('0x44')]['id']}})[_0x57cb('0x26')](handleEntityNotFound(_0x1ea126,null))[_0x57cb('0x26')](function(_0x3d8e5c){if(_0x3d8e5c){_0x59f23e[_0x57cb('0x47')][_0x57cb('0x4e')]=_0x3d8e5c['id'];_0x59f23e[_0x57cb('0x47')][_0x57cb('0x4f')]=integrations[_0x57cb('0x50')](_0x59f23e[_0x57cb('0x47')][_0x57cb('0x51')],_0x59f23e[_0x57cb('0x47')][_0x57cb('0x3b')]);_0x59f23e[_0x57cb('0x47')]['Descriptions']=integrations[_0x57cb('0x52')](_0x59f23e[_0x57cb('0x47')][_0x57cb('0x51')],_0x59f23e[_0x57cb('0x47')][_0x57cb('0x3b')]);return db[_0x57cb('0x53')][_0x57cb('0x46')](_0x59f23e[_0x57cb('0x47')],{'include':[{'model':db['SalesforceField'],'as':_0x57cb('0x4f')},{'model':db[_0x57cb('0x54')],'as':_0x57cb('0x55')}]});}return null;})[_0x57cb('0x26')](respondWithResult(_0x1ea126,null))[_0x57cb('0x42')](handleError(_0x1ea126,null));};exports['getFields']=function(_0x3b304a,_0x432c46,_0x2ba09d){var _0x516cc4;var _0xc59160='';var _0x1823d7=_0x57cb('0x56');return db[_0x57cb('0x40')][_0x57cb('0x4a')]({'where':{'id':_0x3b304a[_0x57cb('0x44')]['id']},'attributes':['id',_0x57cb('0x57'),_0x57cb('0x58'),_0x57cb('0x59'),_0x57cb('0x5a'),_0x57cb('0x5b'),_0x57cb('0x5c')]})['then'](handleEntityNotFound(_0x432c46,null))[_0x57cb('0x26')](function(_0x46cf9e){if(_0x46cf9e){_0xc59160=_0x46cf9e['remoteUri'];var _0xc16210=_0xc59160[_0x57cb('0x5d')](-0x1);if(_0xc16210==='/'){_0xc59160=_0xc59160['substring'](0x0,_0xc59160[_0x57cb('0x5e')](_0xc16210));}_0x516cc4=new jsforce['Connection']({'oauth2':{'loginUrl':_0xc59160,'clientId':_0x46cf9e[_0x57cb('0x58')],'clientSecret':_0x46cf9e[_0x57cb('0x59')]}});return _0x516cc4['login'](_0x46cf9e[_0x57cb('0x5a')],_0x46cf9e[_0x57cb('0x5b')][_0x57cb('0x5f')](_0x46cf9e[_0x57cb('0x5c')]));}})['then'](function(_0xbb9bc){if(_0xbb9bc){if(!_[_0x57cb('0x60')](_0x3b304a[_0x57cb('0x30')]['ticketType'])){_0x1823d7=_0x3b304a['query'][_0x57cb('0x61')];}return _0x516cc4[_0x57cb('0x62')](_0x1823d7)[_0x57cb('0x63')]();}})[_0x57cb('0x26')](function(_0x2e1142){var _0x831761=['OwnerId',_0x57cb('0x64'),_0x57cb('0x65'),_0x57cb('0x66'),_0x57cb('0x67'),_0x57cb('0x68')];var _0x7ea325=[_0x57cb('0x69'),'int',_0x57cb('0x6a'),_0x57cb('0x6b'),_0x57cb('0x6c'),_0x57cb('0x6d'),_0x57cb('0x6e')];if(_0x2e1142){_[_0x57cb('0x6f')](_0x2e1142[_0x57cb('0x33')],function(_0x1a4d1e){return _0x831761['includes'](_0x1a4d1e['name'])||!_0x7ea325[_0x57cb('0x70')](_0x1a4d1e[_0x57cb('0x3b')]);});return{'count':_0x2e1142[_0x57cb('0x33')][_0x57cb('0x35')],'rows':_[_0x57cb('0x2b')](_0x2e1142[_0x57cb('0x33')],function(_0x40acf7){return{'id':_0x40acf7[_0x57cb('0x29')],'name':_0x40acf7['label'],'custom':_0x40acf7[_0x57cb('0x71')],'options':_0x40acf7[_0x57cb('0x72')][_0x57cb('0x35')]>0x0?_[_0x57cb('0x2b')](_0x40acf7[_0x57cb('0x72')],function(_0x5e3f8a){return{'name':_0x5e3f8a[_0x57cb('0x73')],'value':_0x5e3f8a[_0x57cb('0x74')]};}):_0x40acf7[_0x57cb('0x3b')]=='boolean'?[{'name':_0x57cb('0x75'),'value':_0x57cb('0x76')},{'name':'False','value':_0x57cb('0x77')}]:[]};})};}})[_0x57cb('0x26')](respondWithResult(_0x432c46,null))[_0x57cb('0x42')](function(_0x3c2c00){var _0x12dfcb=_0x3b304a['query'][_0x57cb('0x78')]?0x1f4:_0x3c2c00[_0x57cb('0x79')]||0x1f4;logger[_0x57cb('0x7a')](_0x57cb('0x7b'),'getFields',_0x12dfcb,JSON[_0x57cb('0x7c')](_0x3c2c00));delete _0x3c2c00[_0x57cb('0x29')];if(_0x12dfcb===0x191){_0x12dfcb=0x190;}_0x432c46['status'](_0x12dfcb)['send'](_0x3b304a[_0x57cb('0x30')][_0x57cb('0x78')]?{'message':_0x57cb('0x7d'),'statusCode':_0x3c2c00[_0x57cb('0x79')]}:_0x3c2c00);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ef37004..90a0a6a 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 _0x8ab5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x2c1652,_0x33487f){var _0x30100a=function(_0x21184d){while(--_0x21184d){_0x2c1652['push'](_0x2c1652['shift']());}};_0x30100a(++_0x33487f);}(_0x8ab5,0xff));var _0x58ab=function(_0x2e37dc,_0x162ea8){_0x2e37dc=_0x2e37dc-0x0;var _0x32c451=_0x8ab5[_0x2e37dc];return _0x32c451;};'use strict';var _=require(_0x58ab('0x0'));var util=require(_0x58ab('0x1'));var logger=require(_0x58ab('0x2'))(_0x58ab('0x3'));var moment=require(_0x58ab('0x4'));var BPromise=require(_0x58ab('0x5'));var rp=require(_0x58ab('0x6'));var fs=require('fs');var path=require(_0x58ab('0x7'));var rimraf=require(_0x58ab('0x8'));var config=require(_0x58ab('0x9'));var attributes=require(_0x58ab('0xa'));var integrations=require(_0x58ab('0xb'));module[_0x58ab('0xc')]=function(_0x40f9bf,_0x45dfa1){return _0x40f9bf[_0x58ab('0xd')](_0x58ab('0xe'),attributes,{'tableName':_0x58ab('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3f8=['rimraf','../../config/environment','exports','define','SalesforceAccount','lodash','util','api','moment','bluebird'];(function(_0x5b2c7e,_0x3d22f0){var _0x5ec399=function(_0x1a87ad){while(--_0x1a87ad){_0x5b2c7e['push'](_0x5b2c7e['shift']());}};_0x5ec399(++_0x3d22f0);}(_0xf3f8,0x109));var _0x8f3f=function(_0x1560fa,_0x1a7154){_0x1560fa=_0x1560fa-0x0;var _0x2f3ca1=_0xf3f8[_0x1560fa];return _0x2f3ca1;};'use strict';var _=require(_0x8f3f('0x0'));var util=require(_0x8f3f('0x1'));var logger=require('../../config/logger')(_0x8f3f('0x2'));var moment=require(_0x8f3f('0x3'));var BPromise=require(_0x8f3f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8f3f('0x5'));var config=require(_0x8f3f('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x8f3f('0x7')]=function(_0x390ca6,_0x5e1c24){return _0x390ca6[_0x8f3f('0x8')](_0x8f3f('0x9'),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 a023f46..bcabcef 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 _0x3fd5=['moment','ioredis','../../mysqldb','../../config/utils','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','include','map','model','attributes','ShowSalesforceAccount','find','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3fd5,0x12b));var _0x53fd=function(_0x5e9ed3,_0x53f82e){_0x5e9ed3=_0x5e9ed3-0x0;var _0x2241c9=_0x3fd5[_0x5e9ed3];return _0x2241c9;};'use strict';var _=require(_0x53fd('0x0'));var util=require('util');var moment=require(_0x53fd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x53fd('0x2'));var db=require(_0x53fd('0x3'))['db'];var utils=require(_0x53fd('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x53fd('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57ce47,_0x16831c,_0x14db03){return new BPromise(function(_0x90bf3e,_0x162bdc){return client[_0x53fd('0x6')](_0x57ce47,_0x14db03)[_0x53fd('0x7')](function(_0x315b3c){logger[_0x53fd('0x8')](_0x53fd('0x9'),_0x16831c,'request\x20sent');logger[_0x53fd('0xa')](_0x53fd('0xb'),_0x16831c,'request\x20sent',JSON[_0x53fd('0xc')](_0x315b3c));if(_0x315b3c[_0x53fd('0xd')]){if(_0x315b3c['error'][_0x53fd('0xe')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x16831c,_0x315b3c['error']['message']);return _0x162bdc(_0x315b3c[_0x53fd('0xd')][_0x53fd('0xf')]);}logger[_0x53fd('0xd')](_0x53fd('0x9'),_0x16831c,_0x315b3c['error']['message']);return _0x90bf3e(_0x315b3c['error'][_0x53fd('0xf')]);}else{logger[_0x53fd('0x8')]('SalesforceAccount,\x20%s,\x20%s',_0x16831c,_0x53fd('0x10'));_0x90bf3e(_0x315b3c[_0x53fd('0x11')][_0x53fd('0xf')]);}})[_0x53fd('0x12')](function(_0x44683e){logger[_0x53fd('0xd')](_0x53fd('0x9'),_0x16831c,_0x44683e);_0x162bdc(_0x44683e);});});}exports[_0x53fd('0x13')]=function(_0x1b1f14){var _0x2c7938=this;return new Promise(function(_0x54dcf9,_0xa19df0){return db[_0x53fd('0x14')]['findAll']({'raw':_0x1b1f14['options']?_0x1b1f14[_0x53fd('0x15')][_0x53fd('0x16')]===undefined?!![]:![]:!![],'where':_0x1b1f14[_0x53fd('0x15')]?_0x1b1f14[_0x53fd('0x15')][_0x53fd('0x17')]||null:null,'attributes':_0x1b1f14[_0x53fd('0x15')]?_0x1b1f14[_0x53fd('0x15')]['attributes']||null:null,'limit':_0x1b1f14[_0x53fd('0x15')]?_0x1b1f14[_0x53fd('0x15')]['limit']||null:null,'include':_0x1b1f14[_0x53fd('0x15')]?_0x1b1f14[_0x53fd('0x15')][_0x53fd('0x18')]?_[_0x53fd('0x19')](_0x1b1f14[_0x53fd('0x15')][_0x53fd('0x18')],function(_0x55337d){return{'model':db[_0x55337d[_0x53fd('0x1a')]],'as':_0x55337d['as'],'attributes':_0x55337d[_0x53fd('0x1b')],'include':_0x55337d['include']?_[_0x53fd('0x19')](_0x55337d[_0x53fd('0x18')],function(_0x59663d){return{'model':db[_0x59663d['model']],'as':_0x59663d['as'],'attributes':_0x59663d[_0x53fd('0x1b')],'include':_0x59663d[_0x53fd('0x18')]?_[_0x53fd('0x19')](_0x59663d[_0x53fd('0x18')],function(_0xf0f02a){return{'model':db[_0xf0f02a[_0x53fd('0x1a')]],'as':_0xf0f02a['as'],'attributes':_0xf0f02a[_0x53fd('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e2de6){logger[_0x53fd('0x8')]('GetSalesforceAccount',_0x1b1f14);logger[_0x53fd('0xa')](_0x53fd('0x13'),_0x1b1f14,JSON[_0x53fd('0xc')](_0x3e2de6));_0x54dcf9(_0x3e2de6);})[_0x53fd('0x12')](function(_0x5bd10f){logger['error'](_0x53fd('0x13'),_0x5bd10f['message'],_0x1b1f14);_0xa19df0(_0x2c7938[_0x53fd('0xd')](0x1f4,_0x5bd10f[_0x53fd('0xf')]));});});};exports[_0x53fd('0x1c')]=function(_0x2879c4){var _0x176ea3=this;return new Promise(function(_0x17df94,_0x18d2fe){return db[_0x53fd('0x14')][_0x53fd('0x1d')]({'raw':_0x2879c4[_0x53fd('0x15')]?_0x2879c4[_0x53fd('0x15')][_0x53fd('0x16')]===undefined?!![]:![]:!![],'where':_0x2879c4[_0x53fd('0x15')]?_0x2879c4[_0x53fd('0x15')][_0x53fd('0x17')]||null:null,'attributes':_0x2879c4[_0x53fd('0x15')]?_0x2879c4['options'][_0x53fd('0x1b')]||null:null,'include':_0x2879c4['options']?_0x2879c4['options']['include']?_[_0x53fd('0x19')](_0x2879c4[_0x53fd('0x15')][_0x53fd('0x18')],function(_0x519f20){return{'model':db[_0x519f20['model']],'as':_0x519f20['as'],'attributes':_0x519f20[_0x53fd('0x1b')],'include':_0x519f20[_0x53fd('0x18')]?_['map'](_0x519f20[_0x53fd('0x18')],function(_0x6ed9c3){return{'model':db[_0x6ed9c3[_0x53fd('0x1a')]],'as':_0x6ed9c3['as'],'attributes':_0x6ed9c3['attributes'],'include':_0x6ed9c3[_0x53fd('0x18')]?_[_0x53fd('0x19')](_0x6ed9c3[_0x53fd('0x18')],function(_0x19a651){return{'model':db[_0x19a651['model']],'as':_0x19a651['as'],'attributes':_0x19a651[_0x53fd('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfd34d7){logger[_0x53fd('0x8')](_0x53fd('0x1c'),_0x2879c4);logger[_0x53fd('0xa')]('ShowSalesforceAccount',_0x2879c4,JSON[_0x53fd('0xc')](_0xfd34d7));_0x17df94(_0xfd34d7);})['catch'](function(_0x3f8ec4){logger[_0x53fd('0xd')]('ShowSalesforceAccount',_0x3f8ec4[_0x53fd('0xf')],_0x2879c4);_0x18d2fe(_0x176ea3[_0x53fd('0xd')](0x1f4,_0x3f8ec4[_0x53fd('0xf')]));});});}; \ No newline at end of file +var _0xc6a6=['catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','map','include','debug','stringify','ShowSalesforceAccount','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0xc6a6,0x1a6));var _0x6c6a=function(_0x551708,_0x450cd4){_0x551708=_0x551708-0x0;var _0x3dbda2=_0xc6a6[_0x551708];return _0x3dbda2;};'use strict';var _=require('lodash');var util=require(_0x6c6a('0x0'));var moment=require(_0x6c6a('0x1'));var BPromise=require('bluebird');var rs=require(_0x6c6a('0x2'));var fs=require('fs');var Redis=require(_0x6c6a('0x3'));var db=require(_0x6c6a('0x4'))['db'];var utils=require(_0x6c6a('0x5'));var logger=require(_0x6c6a('0x6'))(_0x6c6a('0x7'));var config=require(_0x6c6a('0x8'));var jayson=require(_0x6c6a('0x9'));var client=jayson[_0x6c6a('0xa')][_0x6c6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x454dc9,_0x387961,_0x35605f){return new BPromise(function(_0x52eb3c,_0x22671e){return client[_0x6c6a('0xc')](_0x454dc9,_0x35605f)[_0x6c6a('0xd')](function(_0x35940a){logger[_0x6c6a('0xe')](_0x6c6a('0xf'),_0x387961,_0x6c6a('0x10'));logger['debug'](_0x6c6a('0x11'),_0x387961,_0x6c6a('0x10'),JSON['stringify'](_0x35940a));if(_0x35940a[_0x6c6a('0x12')]){if(_0x35940a[_0x6c6a('0x12')]['code']===0x1f4){logger[_0x6c6a('0x12')](_0x6c6a('0xf'),_0x387961,_0x35940a[_0x6c6a('0x12')]['message']);return _0x22671e(_0x35940a[_0x6c6a('0x12')][_0x6c6a('0x13')]);}logger['error'](_0x6c6a('0xf'),_0x387961,_0x35940a['error'][_0x6c6a('0x13')]);return _0x52eb3c(_0x35940a[_0x6c6a('0x12')][_0x6c6a('0x13')]);}else{logger['info'](_0x6c6a('0xf'),_0x387961,_0x6c6a('0x10'));_0x52eb3c(_0x35940a['result'][_0x6c6a('0x13')]);}})[_0x6c6a('0x14')](function(_0xdb9b0a){logger[_0x6c6a('0x12')](_0x6c6a('0xf'),_0x387961,_0xdb9b0a);_0x22671e(_0xdb9b0a);});});}exports[_0x6c6a('0x15')]=function(_0x2ee948){var _0x5e4d22=this;return new Promise(function(_0x5083bc,_0x1a3355){return db[_0x6c6a('0x16')][_0x6c6a('0x17')]({'raw':_0x2ee948[_0x6c6a('0x18')]?_0x2ee948[_0x6c6a('0x18')][_0x6c6a('0x19')]===undefined?!![]:![]:!![],'where':_0x2ee948['options']?_0x2ee948[_0x6c6a('0x18')][_0x6c6a('0x1a')]||null:null,'attributes':_0x2ee948[_0x6c6a('0x18')]?_0x2ee948[_0x6c6a('0x18')][_0x6c6a('0x1b')]||null:null,'limit':_0x2ee948['options']?_0x2ee948[_0x6c6a('0x18')]['limit']||null:null,'include':_0x2ee948[_0x6c6a('0x18')]?_0x2ee948[_0x6c6a('0x18')]['include']?_[_0x6c6a('0x1c')](_0x2ee948[_0x6c6a('0x18')][_0x6c6a('0x1d')],function(_0x2a541a){return{'model':db[_0x2a541a['model']],'as':_0x2a541a['as'],'attributes':_0x2a541a[_0x6c6a('0x1b')],'include':_0x2a541a[_0x6c6a('0x1d')]?_[_0x6c6a('0x1c')](_0x2a541a[_0x6c6a('0x1d')],function(_0x4360a4){return{'model':db[_0x4360a4['model']],'as':_0x4360a4['as'],'attributes':_0x4360a4[_0x6c6a('0x1b')],'include':_0x4360a4[_0x6c6a('0x1d')]?_[_0x6c6a('0x1c')](_0x4360a4[_0x6c6a('0x1d')],function(_0xd3802f){return{'model':db[_0xd3802f['model']],'as':_0xd3802f['as'],'attributes':_0xd3802f[_0x6c6a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6c6a('0xd')](function(_0x4a77f7){logger['info'](_0x6c6a('0x15'),_0x2ee948);logger[_0x6c6a('0x1e')](_0x6c6a('0x15'),_0x2ee948,JSON[_0x6c6a('0x1f')](_0x4a77f7));_0x5083bc(_0x4a77f7);})['catch'](function(_0x38db3a){logger[_0x6c6a('0x12')](_0x6c6a('0x15'),_0x38db3a[_0x6c6a('0x13')],_0x2ee948);_0x1a3355(_0x5e4d22[_0x6c6a('0x12')](0x1f4,_0x38db3a[_0x6c6a('0x13')]));});});};exports[_0x6c6a('0x20')]=function(_0x4a2ace){var _0x1c04b5=this;return new Promise(function(_0x24ac52,_0x35ffdc){return db[_0x6c6a('0x16')]['find']({'raw':_0x4a2ace['options']?_0x4a2ace['options'][_0x6c6a('0x19')]===undefined?!![]:![]:!![],'where':_0x4a2ace[_0x6c6a('0x18')]?_0x4a2ace[_0x6c6a('0x18')][_0x6c6a('0x1a')]||null:null,'attributes':_0x4a2ace[_0x6c6a('0x18')]?_0x4a2ace[_0x6c6a('0x18')]['attributes']||null:null,'include':_0x4a2ace[_0x6c6a('0x18')]?_0x4a2ace[_0x6c6a('0x18')]['include']?_['map'](_0x4a2ace[_0x6c6a('0x18')]['include'],function(_0xbe5ded){return{'model':db[_0xbe5ded[_0x6c6a('0x21')]],'as':_0xbe5ded['as'],'attributes':_0xbe5ded[_0x6c6a('0x1b')],'include':_0xbe5ded[_0x6c6a('0x1d')]?_[_0x6c6a('0x1c')](_0xbe5ded['include'],function(_0x4d8cb3){return{'model':db[_0x4d8cb3[_0x6c6a('0x21')]],'as':_0x4d8cb3['as'],'attributes':_0x4d8cb3['attributes'],'include':_0x4d8cb3[_0x6c6a('0x1d')]?_[_0x6c6a('0x1c')](_0x4d8cb3[_0x6c6a('0x1d')],function(_0x504e95){return{'model':db[_0x504e95[_0x6c6a('0x21')]],'as':_0x504e95['as'],'attributes':_0x504e95[_0x6c6a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6c6a('0xd')](function(_0x73cbdf){logger[_0x6c6a('0xe')](_0x6c6a('0x20'),_0x4a2ace);logger[_0x6c6a('0x1e')]('ShowSalesforceAccount',_0x4a2ace,JSON[_0x6c6a('0x1f')](_0x73cbdf));_0x24ac52(_0x73cbdf);})[_0x6c6a('0x14')](function(_0x43a065){logger[_0x6c6a('0x12')](_0x6c6a('0x20'),_0x43a065['message'],_0x4a2ace);_0x35ffdc(_0x1c04b5[_0x6c6a('0x12')](0x1f4,_0x43a065[_0x6c6a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 33f2dd2..9efb7a6 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x368ce4,_0x5730cb){var _0x339f6f=function(_0x677d18){while(--_0x677d18){_0x368ce4['push'](_0x368ce4['shift']());}};_0x339f6f(++_0x5730cb);}(_0xadb5,0xad));var _0x5adb=function(_0x11dd45,_0x4f859e){_0x11dd45=_0x11dd45-0x0;var _0x308e18=_0xadb5[_0x11dd45];return _0x308e18;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +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(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x323c7e,_0x3d16ec){_0x323c7e=_0x323c7e-0x0;var _0x2b0f72=_0x0b0e[_0x323c7e];return _0x2b0f72;};'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 e23ee55..d09d36e 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 _0xc65f=['STRING','ENUM','Case','Task','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports'];(function(_0x17d0ea,_0x227e5e){var _0x36f095=function(_0x3037d1){while(--_0x3037d1){_0x17d0ea['push'](_0x17d0ea['shift']());}};_0x36f095(++_0x227e5e);}(_0xc65f,0x76));var _0xfc65=function(_0x8ae408,_0x363b00){_0x8ae408=_0x8ae408-0x0;var _0x38991b=_0xc65f[_0x8ae408];return _0x38991b;};'use strict';var Sequelize=require(_0xfc65('0x0'));module[_0xfc65('0x1')]={'name':{'type':Sequelize[_0xfc65('0x2')]},'description':{'type':Sequelize[_0xfc65('0x2')]},'ticketType':{'type':Sequelize[_0xfc65('0x3')]('Task',_0xfc65('0x4')),'defaultValue':_0xfc65('0x5')},'moduleSearch':{'type':Sequelize[_0xfc65('0x3')](_0xfc65('0x6'),_0xfc65('0x7'),_0xfc65('0x8'),_0xfc65('0x9'),_0xfc65('0xa')),'defaultValue':_0xfc65('0x6')},'moduleCreate':{'type':Sequelize[_0xfc65('0x3')](_0xfc65('0xb'),_0xfc65('0x7'),'lead',_0xfc65('0xa')),'defaultValue':_0xfc65('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xfc65('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xfc65('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xfc65('0x2')]}}; \ No newline at end of file +var _0x105c=['contact','lead','account_contact_lead','account','nothing','exports','STRING','ENUM','Task','contact_lead'];(function(_0x5dc14c,_0x21645d){var _0x2fa297=function(_0x39d945){while(--_0x39d945){_0x5dc14c['push'](_0x5dc14c['shift']());}};_0x2fa297(++_0x21645d);}(_0x105c,0x87));var _0xc105=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x105c[_0x261e29];return _0x25ef43;};'use strict';var Sequelize=require('sequelize');module[_0xc105('0x0')]={'name':{'type':Sequelize[_0xc105('0x1')]},'description':{'type':Sequelize[_0xc105('0x1')]},'ticketType':{'type':Sequelize[_0xc105('0x2')]('Task','Case'),'defaultValue':_0xc105('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xc105('0x4'),_0xc105('0x5'),_0xc105('0x6'),_0xc105('0x7'),_0xc105('0x8')),'defaultValue':_0xc105('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0xc105('0x9'),_0xc105('0x5'),_0xc105('0x6'),_0xc105('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xc105('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xc105('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index fe9e0ab..78b6c37 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 _0x3b8b=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','then','catch','params','keys','intersection','fields','include','find','create','body','getFields','SalesforceField','getSubjects','findOne','getDescriptions','eml-format','rimraf'];(function(_0x1b45a0,_0x5b1374){var _0xbab14b=function(_0x34283b){while(--_0x34283b){_0x1b45a0['push'](_0x1b45a0['shift']());}};_0xbab14b(++_0x5b1374);}(_0x3b8b,0x146));var _0xb3b8=function(_0x4a96ca,_0x13754e){_0x4a96ca=_0x4a96ca-0x0;var _0x2aed48=_0x3b8b[_0x4a96ca];return _0x2aed48;};'use strict';var emlformat=require(_0xb3b8('0x0'));var rimraf=require(_0xb3b8('0x1'));var zipdir=require(_0xb3b8('0x2'));var jsonpatch=require(_0xb3b8('0x3'));var rp=require(_0xb3b8('0x4'));var moment=require(_0xb3b8('0x5'));var BPromise=require(_0xb3b8('0x6'));var Mustache=require(_0xb3b8('0x7'));var util=require(_0xb3b8('0x8'));var path=require(_0xb3b8('0x9'));var sox=require(_0xb3b8('0xa'));var csv=require(_0xb3b8('0xb'));var ejs=require(_0xb3b8('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3b8('0xd'));var squel=require('squel');var crypto=require(_0xb3b8('0xe'));var jsforce=require(_0xb3b8('0xf'));var deskjs=require(_0xb3b8('0x10'));var toCsv=require(_0xb3b8('0xb'));var querystring=require(_0xb3b8('0x11'));var Papa=require(_0xb3b8('0x12'));var Redis=require(_0xb3b8('0x13'));var authService=require(_0xb3b8('0x14'));var qs=require(_0xb3b8('0x15'));var as=require(_0xb3b8('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb3b8('0x17'));var utils=require(_0xb3b8('0x18'));var config=require(_0xb3b8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3b8('0x1a'))['db'];function respondWithStatusCode(_0x5669f7,_0x56a465){_0x56a465=_0x56a465||0xcc;return function(_0x144a46){if(_0x144a46){return _0x5669f7[_0xb3b8('0x1b')](_0x56a465);}return _0x5669f7['status'](_0x56a465)[_0xb3b8('0x1c')]();};}function respondWithResult(_0x364c04,_0x131b9f){_0x131b9f=_0x131b9f||0xc8;return function(_0x2a0c92){if(_0x2a0c92){return _0x364c04[_0xb3b8('0x1d')](_0x131b9f)[_0xb3b8('0x1e')](_0x2a0c92);}};}function respondWithFilteredResult(_0x5cf218,_0x5159fd){return function(_0x1cabe5){if(_0x1cabe5){var _0x27bd80=typeof _0x5159fd[_0xb3b8('0x1f')]===_0xb3b8('0x20')&&typeof _0x5159fd[_0xb3b8('0x21')]===_0xb3b8('0x20');var _0x566b8f=_0x1cabe5[_0xb3b8('0x22')];var _0x5dc6fc=_0x27bd80?0x0:_0x5159fd[_0xb3b8('0x1f')];var _0x2cabe8=_0x27bd80?_0x1cabe5[_0xb3b8('0x22')]:_0x5159fd['offset']+_0x5159fd[_0xb3b8('0x21')];var _0x3427ce;if(_0x2cabe8>=_0x566b8f){_0x2cabe8=_0x566b8f;_0x3427ce=0xc8;}else{_0x3427ce=0xce;}_0x5cf218['status'](_0x3427ce);return _0x5cf218[_0xb3b8('0x23')](_0xb3b8('0x24'),_0x5dc6fc+'-'+_0x2cabe8+'/'+_0x566b8f)[_0xb3b8('0x1e')](_0x1cabe5);}return null;};}function patchUpdates(_0x1f618c){return function(_0x18ffa0){try{jsonpatch[_0xb3b8('0x25')](_0x18ffa0,_0x1f618c,!![]);}catch(_0x22ea10){return BPromise[_0xb3b8('0x26')](_0x22ea10);}return _0x18ffa0[_0xb3b8('0x27')]();};}function saveUpdates(_0x564a6f,_0x32b9e1){return function(_0x5cd83c){if(_0x5cd83c){return _0x5cd83c[_0xb3b8('0x28')](_0x564a6f)['then'](function(_0x28dd8f){return _0x28dd8f;});}return null;};}function removeEntity(_0x394c95,_0x184863){return function(_0x5c7823){if(_0x5c7823){return _0x5c7823[_0xb3b8('0x29')]()['then'](function(){_0x394c95[_0xb3b8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249048,_0x2efcb3){return function(_0x4e0278){if(!_0x4e0278){_0x249048['sendStatus'](0x194);}return _0x4e0278;};}function handleError(_0x23fb72,_0x1c7f8b){_0x1c7f8b=_0x1c7f8b||0x1f4;return function(_0x1ec03c){logger['error'](_0x1ec03c[_0xb3b8('0x2a')]);if(_0x1ec03c[_0xb3b8('0x2b')]){delete _0x1ec03c['name'];}_0x23fb72[_0xb3b8('0x1d')](_0x1c7f8b)[_0xb3b8('0x2c')](_0x1ec03c);};}exports[_0xb3b8('0x2d')]=function(_0x982747,_0x26ab14){var _0x6bacbf={},_0x349a97={},_0x127556={'count':0x0,'rows':[]};var _0x2fdd41=_['map'](db[_0xb3b8('0x2e')][_0xb3b8('0x2f')],function(_0x43b4d9){return{'name':_0x43b4d9[_0xb3b8('0x30')],'type':_0x43b4d9[_0xb3b8('0x31')][_0xb3b8('0x32')]};});_0x349a97[_0xb3b8('0x33')]=_[_0xb3b8('0x34')](_0x2fdd41,_0xb3b8('0x2b'));_0x349a97[_0xb3b8('0x35')]=_['keys'](_0x982747[_0xb3b8('0x35')]);_0x349a97[_0xb3b8('0x36')]=_['intersection'](_0x349a97['model'],_0x349a97[_0xb3b8('0x35')]);_0x6bacbf[_0xb3b8('0x37')]=_['intersection'](_0x349a97[_0xb3b8('0x33')],qs['fields'](_0x982747[_0xb3b8('0x35')]['fields']));_0x6bacbf[_0xb3b8('0x37')]=_0x6bacbf[_0xb3b8('0x37')][_0xb3b8('0x38')]?_0x6bacbf['attributes']:_0x349a97[_0xb3b8('0x33')];if(!_0x982747[_0xb3b8('0x35')][_0xb3b8('0x39')](_0xb3b8('0x3a'))){_0x6bacbf[_0xb3b8('0x21')]=qs[_0xb3b8('0x21')](_0x982747[_0xb3b8('0x35')][_0xb3b8('0x21')]);_0x6bacbf[_0xb3b8('0x1f')]=qs[_0xb3b8('0x1f')](_0x982747[_0xb3b8('0x35')][_0xb3b8('0x1f')]);}_0x6bacbf[_0xb3b8('0x3b')]=qs[_0xb3b8('0x3c')](_0x982747[_0xb3b8('0x35')][_0xb3b8('0x3c')]);_0x6bacbf[_0xb3b8('0x3d')]=qs['filters'](_[_0xb3b8('0x3e')](_0x982747[_0xb3b8('0x35')],_0x349a97[_0xb3b8('0x36')]),_0x2fdd41);if(_0x982747[_0xb3b8('0x35')][_0xb3b8('0x3f')]){_0x6bacbf['where']=_['merge'](_0x6bacbf[_0xb3b8('0x3d')],{'$or':_[_0xb3b8('0x34')](_0x2fdd41,function(_0x1fc0e8){if(_0x1fc0e8[_0xb3b8('0x31')]!=='VIRTUAL'){var _0xac00eb={};_0xac00eb[_0x1fc0e8[_0xb3b8('0x2b')]]={'$like':'%'+_0x982747[_0xb3b8('0x35')]['filter']+'%'};return _0xac00eb;}})});}_0x6bacbf=_[_0xb3b8('0x40')]({},_0x6bacbf,_0x982747[_0xb3b8('0x41')]);var _0x48682e={'where':_0x6bacbf[_0xb3b8('0x3d')]};return db[_0xb3b8('0x2e')][_0xb3b8('0x22')](_0x48682e)['then'](function(_0x1c07ea){_0x127556['count']=_0x1c07ea;if(_0x982747[_0xb3b8('0x35')]['includeAll']){_0x6bacbf['include']=[{'all':!![]}];}return db[_0xb3b8('0x2e')][_0xb3b8('0x42')](_0x6bacbf);})['then'](function(_0x36b2ba){_0x127556['rows']=_0x36b2ba;return _0x127556;})[_0xb3b8('0x43')](respondWithFilteredResult(_0x26ab14,_0x6bacbf))[_0xb3b8('0x44')](handleError(_0x26ab14,null));};exports['show']=function(_0x4d8d8b,_0xf55e37){var _0x3bf250={'raw':![],'where':{'id':_0x4d8d8b[_0xb3b8('0x45')]['id']}},_0x408757={};_0x408757['model']=_[_0xb3b8('0x46')](db[_0xb3b8('0x2e')]['rawAttributes']);_0x408757[_0xb3b8('0x35')]=_[_0xb3b8('0x46')](_0x4d8d8b[_0xb3b8('0x35')]);_0x408757[_0xb3b8('0x36')]=_[_0xb3b8('0x47')](_0x408757[_0xb3b8('0x33')],_0x408757[_0xb3b8('0x35')]);_0x3bf250['attributes']=_['intersection'](_0x408757[_0xb3b8('0x33')],qs[_0xb3b8('0x48')](_0x4d8d8b[_0xb3b8('0x35')]['fields']));_0x3bf250[_0xb3b8('0x37')]=_0x3bf250['attributes'][_0xb3b8('0x38')]?_0x3bf250[_0xb3b8('0x37')]:_0x408757['model'];if(_0x4d8d8b[_0xb3b8('0x35')]['includeAll']){_0x3bf250[_0xb3b8('0x49')]=[{'all':!![]}];}_0x3bf250=_['merge']({},_0x3bf250,_0x4d8d8b[_0xb3b8('0x41')]);return db[_0xb3b8('0x2e')][_0xb3b8('0x4a')](_0x3bf250)['then'](handleEntityNotFound(_0xf55e37,null))['then'](respondWithResult(_0xf55e37,null))[_0xb3b8('0x44')](handleError(_0xf55e37,null));};exports['create']=function(_0x41bb79,_0x467d0f){return db[_0xb3b8('0x2e')][_0xb3b8('0x4b')](_0x41bb79[_0xb3b8('0x4c')],{})[_0xb3b8('0x43')](respondWithResult(_0x467d0f,0xc9))[_0xb3b8('0x44')](handleError(_0x467d0f,null));};exports[_0xb3b8('0x28')]=function(_0x53bda0,_0x524ac0){if(_0x53bda0['body']['id']){delete _0x53bda0[_0xb3b8('0x4c')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x53bda0[_0xb3b8('0x45')]['id']}})[_0xb3b8('0x43')](handleEntityNotFound(_0x524ac0,null))[_0xb3b8('0x43')](saveUpdates(_0x53bda0[_0xb3b8('0x4c')],null))[_0xb3b8('0x43')](respondWithResult(_0x524ac0,null))['catch'](handleError(_0x524ac0,null));};exports['destroy']=function(_0x1683d3,_0x40f601){return db[_0xb3b8('0x2e')][_0xb3b8('0x4a')]({'where':{'id':_0x1683d3[_0xb3b8('0x45')]['id']}})['then'](handleEntityNotFound(_0x40f601,null))[_0xb3b8('0x43')](removeEntity(_0x40f601,null))['catch'](handleError(_0x40f601,null));};exports[_0xb3b8('0x4d')]=function(_0x29ea41,_0x1beaf6,_0x38f605){var _0x915f06={};var _0x472ad1={};var _0x2fb953;var _0x54d1ef;return db[_0xb3b8('0x2e')]['findOne']({'where':{'id':_0x29ea41['params']['id']}})['then'](handleEntityNotFound(_0x1beaf6,null))['then'](function(_0x304bf7){if(_0x304bf7){_0x2fb953=_0x304bf7;_0x472ad1[_0xb3b8('0x33')]=_[_0xb3b8('0x46')](db[_0xb3b8('0x4e')]['rawAttributes']);_0x472ad1['query']=_['keys'](_0x29ea41[_0xb3b8('0x35')]);_0x472ad1[_0xb3b8('0x36')]=_[_0xb3b8('0x47')](_0x472ad1[_0xb3b8('0x33')],_0x472ad1[_0xb3b8('0x35')]);_0x915f06[_0xb3b8('0x37')]=_[_0xb3b8('0x47')](_0x472ad1[_0xb3b8('0x33')],qs[_0xb3b8('0x48')](_0x29ea41[_0xb3b8('0x35')][_0xb3b8('0x48')]));_0x915f06[_0xb3b8('0x37')]=_0x915f06['attributes'][_0xb3b8('0x38')]?_0x915f06[_0xb3b8('0x37')]:_0x472ad1[_0xb3b8('0x33')];_0x915f06[_0xb3b8('0x3b')]=qs[_0xb3b8('0x3c')](_0x29ea41[_0xb3b8('0x35')][_0xb3b8('0x3c')]);_0x915f06[_0xb3b8('0x3d')]=qs['filters'](_['pick'](_0x29ea41['query'],_0x472ad1[_0xb3b8('0x36')]));if(_0x29ea41['query']['filter']){_0x915f06[_0xb3b8('0x3d')]=_[_0xb3b8('0x40')](_0x915f06['where'],{'$or':_[_0xb3b8('0x34')](_0x915f06[_0xb3b8('0x37')],function(_0x53c371){var _0x42fd7c={};_0x42fd7c[_0x53c371]={'$like':'%'+_0x29ea41[_0xb3b8('0x35')][_0xb3b8('0x3f')]+'%'};return _0x42fd7c;})});}_0x915f06=_['merge']({},_0x915f06,_0x29ea41[_0xb3b8('0x41')]);return _0x2fb953['getFields'](_0x915f06);}})[_0xb3b8('0x43')](function(_0x2dc7d0){if(_0x2dc7d0){_0x54d1ef=_0x2dc7d0[_0xb3b8('0x38')];if(!_0x29ea41[_0xb3b8('0x35')][_0xb3b8('0x39')](_0xb3b8('0x3a'))){_0x915f06[_0xb3b8('0x21')]=qs[_0xb3b8('0x21')](_0x29ea41['query'][_0xb3b8('0x21')]);_0x915f06[_0xb3b8('0x1f')]=qs['offset'](_0x29ea41[_0xb3b8('0x35')][_0xb3b8('0x1f')]);}return _0x2fb953['getFields'](_0x915f06);}})['then'](function(_0x5051f7){if(_0x5051f7){return _0x5051f7?{'count':_0x54d1ef,'rows':_0x5051f7}:null;}})[_0xb3b8('0x43')](respondWithResult(_0x1beaf6,null))[_0xb3b8('0x44')](handleError(_0x1beaf6,null));};exports[_0xb3b8('0x4f')]=function(_0x570db6,_0x105a51,_0x2a95f0){var _0x22be50={};var _0xaf7692={};var _0x746076;var _0x46de46;return db[_0xb3b8('0x2e')][_0xb3b8('0x50')]({'where':{'id':_0x570db6[_0xb3b8('0x45')]['id']}})[_0xb3b8('0x43')](handleEntityNotFound(_0x105a51,null))[_0xb3b8('0x43')](function(_0x173f30){if(_0x173f30){_0x746076=_0x173f30;_0xaf7692['model']=_[_0xb3b8('0x46')](db[_0xb3b8('0x4e')][_0xb3b8('0x2f')]);_0xaf7692['query']=_[_0xb3b8('0x46')](_0x570db6['query']);_0xaf7692[_0xb3b8('0x36')]=_[_0xb3b8('0x47')](_0xaf7692[_0xb3b8('0x33')],_0xaf7692['query']);_0x22be50[_0xb3b8('0x37')]=_[_0xb3b8('0x47')](_0xaf7692[_0xb3b8('0x33')],qs['fields'](_0x570db6[_0xb3b8('0x35')][_0xb3b8('0x48')]));_0x22be50[_0xb3b8('0x37')]=_0x22be50[_0xb3b8('0x37')][_0xb3b8('0x38')]?_0x22be50[_0xb3b8('0x37')]:_0xaf7692['model'];_0x22be50['order']=qs['sort'](_0x570db6[_0xb3b8('0x35')][_0xb3b8('0x3c')]);_0x22be50['where']=qs[_0xb3b8('0x36')](_[_0xb3b8('0x3e')](_0x570db6[_0xb3b8('0x35')],_0xaf7692[_0xb3b8('0x36')]));if(_0x570db6[_0xb3b8('0x35')][_0xb3b8('0x3f')]){_0x22be50[_0xb3b8('0x3d')]=_['merge'](_0x22be50['where'],{'$or':_[_0xb3b8('0x34')](_0x22be50[_0xb3b8('0x37')],function(_0x21406b){var _0x1dc054={};_0x1dc054[_0x21406b]={'$like':'%'+_0x570db6[_0xb3b8('0x35')]['filter']+'%'};return _0x1dc054;})});}_0x22be50=_[_0xb3b8('0x40')]({},_0x22be50,_0x570db6['options']);return _0x746076['getSubjects'](_0x22be50);}})['then'](function(_0x1e99bc){if(_0x1e99bc){_0x46de46=_0x1e99bc[_0xb3b8('0x38')];if(!_0x570db6[_0xb3b8('0x35')][_0xb3b8('0x39')](_0xb3b8('0x3a'))){_0x22be50[_0xb3b8('0x21')]=qs['limit'](_0x570db6[_0xb3b8('0x35')][_0xb3b8('0x21')]);_0x22be50[_0xb3b8('0x1f')]=qs[_0xb3b8('0x1f')](_0x570db6[_0xb3b8('0x35')][_0xb3b8('0x1f')]);}return _0x746076['getSubjects'](_0x22be50);}})[_0xb3b8('0x43')](function(_0x1e04c1){if(_0x1e04c1){return _0x1e04c1?{'count':_0x46de46,'rows':_0x1e04c1}:null;}})[_0xb3b8('0x43')](respondWithResult(_0x105a51,null))[_0xb3b8('0x44')](handleError(_0x105a51,null));};exports['getDescriptions']=function(_0x450ced,_0x181e3c,_0x3a161a){var _0x41fa20={};var _0x21428e={};var _0x386c65;var _0x39c92a;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x450ced['params']['id']}})[_0xb3b8('0x43')](handleEntityNotFound(_0x181e3c,null))[_0xb3b8('0x43')](function(_0x32a10e){if(_0x32a10e){_0x386c65=_0x32a10e;_0x21428e['model']=_['keys'](db['SalesforceField'][_0xb3b8('0x2f')]);_0x21428e[_0xb3b8('0x35')]=_[_0xb3b8('0x46')](_0x450ced[_0xb3b8('0x35')]);_0x21428e[_0xb3b8('0x36')]=_[_0xb3b8('0x47')](_0x21428e[_0xb3b8('0x33')],_0x21428e[_0xb3b8('0x35')]);_0x41fa20[_0xb3b8('0x37')]=_['intersection'](_0x21428e[_0xb3b8('0x33')],qs['fields'](_0x450ced['query'][_0xb3b8('0x48')]));_0x41fa20['attributes']=_0x41fa20[_0xb3b8('0x37')]['length']?_0x41fa20['attributes']:_0x21428e['model'];_0x41fa20[_0xb3b8('0x3b')]=qs[_0xb3b8('0x3c')](_0x450ced[_0xb3b8('0x35')][_0xb3b8('0x3c')]);_0x41fa20['where']=qs[_0xb3b8('0x36')](_[_0xb3b8('0x3e')](_0x450ced[_0xb3b8('0x35')],_0x21428e[_0xb3b8('0x36')]));if(_0x450ced[_0xb3b8('0x35')][_0xb3b8('0x3f')]){_0x41fa20[_0xb3b8('0x3d')]=_['merge'](_0x41fa20[_0xb3b8('0x3d')],{'$or':_[_0xb3b8('0x34')](_0x41fa20[_0xb3b8('0x37')],function(_0x2eb439){var _0xff01b1={};_0xff01b1[_0x2eb439]={'$like':'%'+_0x450ced[_0xb3b8('0x35')][_0xb3b8('0x3f')]+'%'};return _0xff01b1;})});}_0x41fa20=_[_0xb3b8('0x40')]({},_0x41fa20,_0x450ced[_0xb3b8('0x41')]);return _0x386c65[_0xb3b8('0x51')](_0x41fa20);}})['then'](function(_0x31d23f){if(_0x31d23f){_0x39c92a=_0x31d23f['length'];if(!_0x450ced['query'][_0xb3b8('0x39')](_0xb3b8('0x3a'))){_0x41fa20[_0xb3b8('0x21')]=qs['limit'](_0x450ced[_0xb3b8('0x35')][_0xb3b8('0x21')]);_0x41fa20[_0xb3b8('0x1f')]=qs['offset'](_0x450ced['query'][_0xb3b8('0x1f')]);}return _0x386c65[_0xb3b8('0x51')](_0x41fa20);}})[_0xb3b8('0x43')](function(_0x2f4ec2){if(_0x2f4ec2){return _0x2f4ec2?{'count':_0x39c92a,'rows':_0x2f4ec2}:null;}})[_0xb3b8('0x43')](respondWithResult(_0x181e3c,null))[_0xb3b8('0x44')](handleError(_0x181e3c,null));}; \ No newline at end of file +var _0xee87=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL','SalesforceConfiguration','then','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','getFields','findOne','sort','hasOwnProperty','getSubjects','getDescriptions','SalesforceField','rimraf','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee87,0x193));var _0x7ee8=function(_0x91c9b5,_0x4ad31a){_0x91c9b5=_0x91c9b5-0x0;var _0x1e267e=_0xee87[_0x91c9b5];return _0x1e267e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ee8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ee8('0x1'));var BPromise=require(_0x7ee8('0x2'));var Mustache=require(_0x7ee8('0x3'));var util=require('util');var path=require(_0x7ee8('0x4'));var sox=require(_0x7ee8('0x5'));var csv=require('to-csv');var ejs=require(_0x7ee8('0x6'));var fs=require('fs');var fs_extra=require(_0x7ee8('0x7'));var _=require(_0x7ee8('0x8'));var squel=require(_0x7ee8('0x9'));var crypto=require(_0x7ee8('0xa'));var jsforce=require(_0x7ee8('0xb'));var deskjs=require(_0x7ee8('0xc'));var toCsv=require(_0x7ee8('0xd'));var querystring=require(_0x7ee8('0xe'));var Papa=require(_0x7ee8('0xf'));var Redis=require(_0x7ee8('0x10'));var authService=require(_0x7ee8('0x11'));var qs=require(_0x7ee8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ee8('0x13'));var logger=require(_0x7ee8('0x14'))(_0x7ee8('0x15'));var utils=require(_0x7ee8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7ee8('0x17'));var db=require(_0x7ee8('0x18'))['db'];function respondWithStatusCode(_0x322707,_0x16ab62){_0x16ab62=_0x16ab62||0xcc;return function(_0x14a856){if(_0x14a856){return _0x322707[_0x7ee8('0x19')](_0x16ab62);}return _0x322707[_0x7ee8('0x1a')](_0x16ab62)[_0x7ee8('0x1b')]();};}function respondWithResult(_0x19dcd2,_0x170d84){_0x170d84=_0x170d84||0xc8;return function(_0x24d5e8){if(_0x24d5e8){return _0x19dcd2[_0x7ee8('0x1a')](_0x170d84)[_0x7ee8('0x1c')](_0x24d5e8);}};}function respondWithFilteredResult(_0x3ff469,_0x3a3b48){return function(_0xd275fb){if(_0xd275fb){var _0x1ddb6a=typeof _0x3a3b48[_0x7ee8('0x1d')]===_0x7ee8('0x1e')&&typeof _0x3a3b48[_0x7ee8('0x1f')]==='undefined';var _0x3b167c=_0xd275fb[_0x7ee8('0x20')];var _0x20fc7c=_0x1ddb6a?0x0:_0x3a3b48[_0x7ee8('0x1d')];var _0x2ef79f=_0x1ddb6a?_0xd275fb[_0x7ee8('0x20')]:_0x3a3b48[_0x7ee8('0x1d')]+_0x3a3b48['limit'];var _0x359da2;if(_0x2ef79f>=_0x3b167c){_0x2ef79f=_0x3b167c;_0x359da2=0xc8;}else{_0x359da2=0xce;}_0x3ff469['status'](_0x359da2);return _0x3ff469[_0x7ee8('0x21')]('Content-Range',_0x20fc7c+'-'+_0x2ef79f+'/'+_0x3b167c)[_0x7ee8('0x1c')](_0xd275fb);}return null;};}function patchUpdates(_0x1e3f04){return function(_0x37ca34){try{jsonpatch[_0x7ee8('0x22')](_0x37ca34,_0x1e3f04,!![]);}catch(_0x391035){return BPromise[_0x7ee8('0x23')](_0x391035);}return _0x37ca34[_0x7ee8('0x24')]();};}function saveUpdates(_0x13c3a7,_0x2ce7b5){return function(_0xb160a1){if(_0xb160a1){return _0xb160a1[_0x7ee8('0x25')](_0x13c3a7)['then'](function(_0x7d8f2f){return _0x7d8f2f;});}return null;};}function removeEntity(_0x3870d7,_0x252dde){return function(_0x314663){if(_0x314663){return _0x314663[_0x7ee8('0x26')]()['then'](function(){_0x3870d7[_0x7ee8('0x1a')](0xcc)[_0x7ee8('0x1b')]();});}};}function handleEntityNotFound(_0x1aaa8f,_0x330d08){return function(_0x411181){if(!_0x411181){_0x1aaa8f[_0x7ee8('0x19')](0x194);}return _0x411181;};}function handleError(_0x5698bd,_0x331966){_0x331966=_0x331966||0x1f4;return function(_0x57cf44){logger[_0x7ee8('0x27')](_0x57cf44[_0x7ee8('0x28')]);if(_0x57cf44[_0x7ee8('0x29')]){delete _0x57cf44[_0x7ee8('0x29')];}_0x5698bd['status'](_0x331966)[_0x7ee8('0x2a')](_0x57cf44);};}exports[_0x7ee8('0x2b')]=function(_0x3792fa,_0x43fe07){var _0x4a5e5c={},_0x1b604c={},_0x322cff={'count':0x0,'rows':[]};var _0x53c97e=_[_0x7ee8('0x2c')](db['SalesforceConfiguration'][_0x7ee8('0x2d')],function(_0x2b67ba){return{'name':_0x2b67ba[_0x7ee8('0x2e')],'type':_0x2b67ba[_0x7ee8('0x2f')][_0x7ee8('0x30')]};});_0x1b604c['model']=_['map'](_0x53c97e,_0x7ee8('0x29'));_0x1b604c[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0x3792fa['query']);_0x1b604c[_0x7ee8('0x33')]=_[_0x7ee8('0x34')](_0x1b604c[_0x7ee8('0x35')],_0x1b604c['query']);_0x4a5e5c['attributes']=_['intersection'](_0x1b604c[_0x7ee8('0x35')],qs['fields'](_0x3792fa['query'][_0x7ee8('0x36')]));_0x4a5e5c[_0x7ee8('0x37')]=_0x4a5e5c[_0x7ee8('0x37')][_0x7ee8('0x38')]?_0x4a5e5c[_0x7ee8('0x37')]:_0x1b604c[_0x7ee8('0x35')];if(!_0x3792fa[_0x7ee8('0x31')]['hasOwnProperty'](_0x7ee8('0x39'))){_0x4a5e5c[_0x7ee8('0x1f')]=qs[_0x7ee8('0x1f')](_0x3792fa['query'][_0x7ee8('0x1f')]);_0x4a5e5c[_0x7ee8('0x1d')]=qs[_0x7ee8('0x1d')](_0x3792fa[_0x7ee8('0x31')][_0x7ee8('0x1d')]);}_0x4a5e5c[_0x7ee8('0x3a')]=qs['sort'](_0x3792fa['query']['sort']);_0x4a5e5c[_0x7ee8('0x3b')]=qs[_0x7ee8('0x33')](_[_0x7ee8('0x3c')](_0x3792fa[_0x7ee8('0x31')],_0x1b604c[_0x7ee8('0x33')]),_0x53c97e);if(_0x3792fa[_0x7ee8('0x31')][_0x7ee8('0x3d')]){_0x4a5e5c[_0x7ee8('0x3b')]=_[_0x7ee8('0x3e')](_0x4a5e5c['where'],{'$or':_[_0x7ee8('0x2c')](_0x53c97e,function(_0x320c8c){if(_0x320c8c[_0x7ee8('0x2f')]!==_0x7ee8('0x3f')){var _0x11dc71={};_0x11dc71[_0x320c8c[_0x7ee8('0x29')]]={'$like':'%'+_0x3792fa[_0x7ee8('0x31')][_0x7ee8('0x3d')]+'%'};return _0x11dc71;}})});}_0x4a5e5c=_[_0x7ee8('0x3e')]({},_0x4a5e5c,_0x3792fa['options']);var _0x9255f3={'where':_0x4a5e5c[_0x7ee8('0x3b')]};return db[_0x7ee8('0x40')][_0x7ee8('0x20')](_0x9255f3)[_0x7ee8('0x41')](function(_0xfce36a){_0x322cff['count']=_0xfce36a;if(_0x3792fa[_0x7ee8('0x31')]['includeAll']){_0x4a5e5c[_0x7ee8('0x42')]=[{'all':!![]}];}return db[_0x7ee8('0x40')][_0x7ee8('0x43')](_0x4a5e5c);})['then'](function(_0x4ce466){_0x322cff[_0x7ee8('0x44')]=_0x4ce466;return _0x322cff;})[_0x7ee8('0x41')](respondWithFilteredResult(_0x43fe07,_0x4a5e5c))[_0x7ee8('0x45')](handleError(_0x43fe07,null));};exports[_0x7ee8('0x46')]=function(_0x790d32,_0x685490){var _0x16b91f={'raw':![],'where':{'id':_0x790d32['params']['id']}},_0x128ad6={};_0x128ad6[_0x7ee8('0x35')]=_['keys'](db['SalesforceConfiguration']['rawAttributes']);_0x128ad6[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0x790d32[_0x7ee8('0x31')]);_0x128ad6[_0x7ee8('0x33')]=_[_0x7ee8('0x34')](_0x128ad6[_0x7ee8('0x35')],_0x128ad6[_0x7ee8('0x31')]);_0x16b91f['attributes']=_[_0x7ee8('0x34')](_0x128ad6[_0x7ee8('0x35')],qs[_0x7ee8('0x36')](_0x790d32[_0x7ee8('0x31')][_0x7ee8('0x36')]));_0x16b91f['attributes']=_0x16b91f[_0x7ee8('0x37')][_0x7ee8('0x38')]?_0x16b91f[_0x7ee8('0x37')]:_0x128ad6[_0x7ee8('0x35')];if(_0x790d32[_0x7ee8('0x31')][_0x7ee8('0x47')]){_0x16b91f[_0x7ee8('0x42')]=[{'all':!![]}];}_0x16b91f=_['merge']({},_0x16b91f,_0x790d32[_0x7ee8('0x48')]);return db[_0x7ee8('0x40')][_0x7ee8('0x49')](_0x16b91f)[_0x7ee8('0x41')](handleEntityNotFound(_0x685490,null))[_0x7ee8('0x41')](respondWithResult(_0x685490,null))[_0x7ee8('0x45')](handleError(_0x685490,null));};exports[_0x7ee8('0x4a')]=function(_0x162049,_0x51e205){return db[_0x7ee8('0x40')][_0x7ee8('0x4a')](_0x162049[_0x7ee8('0x4b')],{})['then'](respondWithResult(_0x51e205,0xc9))[_0x7ee8('0x45')](handleError(_0x51e205,null));};exports['update']=function(_0x4d6b40,_0x379943){if(_0x4d6b40[_0x7ee8('0x4b')]['id']){delete _0x4d6b40[_0x7ee8('0x4b')]['id'];}return db[_0x7ee8('0x40')][_0x7ee8('0x49')]({'where':{'id':_0x4d6b40[_0x7ee8('0x4c')]['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x379943,null))[_0x7ee8('0x41')](saveUpdates(_0x4d6b40[_0x7ee8('0x4b')],null))[_0x7ee8('0x41')](respondWithResult(_0x379943,null))[_0x7ee8('0x45')](handleError(_0x379943,null));};exports[_0x7ee8('0x26')]=function(_0x4ce4d6,_0x4b38e7){return db[_0x7ee8('0x40')][_0x7ee8('0x49')]({'where':{'id':_0x4ce4d6['params']['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x4b38e7,null))[_0x7ee8('0x41')](removeEntity(_0x4b38e7,null))['catch'](handleError(_0x4b38e7,null));};exports[_0x7ee8('0x4d')]=function(_0xb3c3ee,_0x405a6b,_0x4b733d){var _0x5cc124={};var _0x30eda0={};var _0x5ab564;var _0x3fa83f;return db[_0x7ee8('0x40')][_0x7ee8('0x4e')]({'where':{'id':_0xb3c3ee['params']['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x405a6b,null))[_0x7ee8('0x41')](function(_0xe0a576){if(_0xe0a576){_0x5ab564=_0xe0a576;_0x30eda0[_0x7ee8('0x35')]=_[_0x7ee8('0x32')](db['SalesforceField']['rawAttributes']);_0x30eda0[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0xb3c3ee[_0x7ee8('0x31')]);_0x30eda0['filters']=_[_0x7ee8('0x34')](_0x30eda0[_0x7ee8('0x35')],_0x30eda0[_0x7ee8('0x31')]);_0x5cc124[_0x7ee8('0x37')]=_[_0x7ee8('0x34')](_0x30eda0['model'],qs[_0x7ee8('0x36')](_0xb3c3ee['query']['fields']));_0x5cc124[_0x7ee8('0x37')]=_0x5cc124[_0x7ee8('0x37')][_0x7ee8('0x38')]?_0x5cc124[_0x7ee8('0x37')]:_0x30eda0[_0x7ee8('0x35')];_0x5cc124[_0x7ee8('0x3a')]=qs[_0x7ee8('0x4f')](_0xb3c3ee[_0x7ee8('0x31')][_0x7ee8('0x4f')]);_0x5cc124[_0x7ee8('0x3b')]=qs[_0x7ee8('0x33')](_['pick'](_0xb3c3ee[_0x7ee8('0x31')],_0x30eda0[_0x7ee8('0x33')]));if(_0xb3c3ee[_0x7ee8('0x31')][_0x7ee8('0x3d')]){_0x5cc124[_0x7ee8('0x3b')]=_[_0x7ee8('0x3e')](_0x5cc124[_0x7ee8('0x3b')],{'$or':_[_0x7ee8('0x2c')](_0x5cc124[_0x7ee8('0x37')],function(_0xaffd8e){var _0x1dc80b={};_0x1dc80b[_0xaffd8e]={'$like':'%'+_0xb3c3ee[_0x7ee8('0x31')][_0x7ee8('0x3d')]+'%'};return _0x1dc80b;})});}_0x5cc124=_['merge']({},_0x5cc124,_0xb3c3ee[_0x7ee8('0x48')]);return _0x5ab564['getFields'](_0x5cc124);}})[_0x7ee8('0x41')](function(_0x12dcbf){if(_0x12dcbf){_0x3fa83f=_0x12dcbf[_0x7ee8('0x38')];if(!_0xb3c3ee['query'][_0x7ee8('0x50')](_0x7ee8('0x39'))){_0x5cc124[_0x7ee8('0x1f')]=qs['limit'](_0xb3c3ee[_0x7ee8('0x31')][_0x7ee8('0x1f')]);_0x5cc124[_0x7ee8('0x1d')]=qs['offset'](_0xb3c3ee['query']['offset']);}return _0x5ab564[_0x7ee8('0x4d')](_0x5cc124);}})[_0x7ee8('0x41')](function(_0x3330fd){if(_0x3330fd){return _0x3330fd?{'count':_0x3fa83f,'rows':_0x3330fd}:null;}})[_0x7ee8('0x41')](respondWithResult(_0x405a6b,null))[_0x7ee8('0x45')](handleError(_0x405a6b,null));};exports[_0x7ee8('0x51')]=function(_0x6848e1,_0x34c43a,_0x4d0243){var _0x492e77={};var _0x1c83a6={};var _0x3a7a3c;var _0x4febf7;return db[_0x7ee8('0x40')]['findOne']({'where':{'id':_0x6848e1['params']['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x34c43a,null))[_0x7ee8('0x41')](function(_0x14ee81){if(_0x14ee81){_0x3a7a3c=_0x14ee81;_0x1c83a6[_0x7ee8('0x35')]=_[_0x7ee8('0x32')](db['SalesforceField']['rawAttributes']);_0x1c83a6[_0x7ee8('0x31')]=_['keys'](_0x6848e1[_0x7ee8('0x31')]);_0x1c83a6[_0x7ee8('0x33')]=_['intersection'](_0x1c83a6[_0x7ee8('0x35')],_0x1c83a6['query']);_0x492e77['attributes']=_['intersection'](_0x1c83a6[_0x7ee8('0x35')],qs['fields'](_0x6848e1[_0x7ee8('0x31')][_0x7ee8('0x36')]));_0x492e77[_0x7ee8('0x37')]=_0x492e77[_0x7ee8('0x37')][_0x7ee8('0x38')]?_0x492e77[_0x7ee8('0x37')]:_0x1c83a6['model'];_0x492e77[_0x7ee8('0x3a')]=qs[_0x7ee8('0x4f')](_0x6848e1[_0x7ee8('0x31')][_0x7ee8('0x4f')]);_0x492e77[_0x7ee8('0x3b')]=qs[_0x7ee8('0x33')](_[_0x7ee8('0x3c')](_0x6848e1[_0x7ee8('0x31')],_0x1c83a6['filters']));if(_0x6848e1['query'][_0x7ee8('0x3d')]){_0x492e77['where']=_[_0x7ee8('0x3e')](_0x492e77[_0x7ee8('0x3b')],{'$or':_[_0x7ee8('0x2c')](_0x492e77[_0x7ee8('0x37')],function(_0x4f47cd){var _0x4282df={};_0x4282df[_0x4f47cd]={'$like':'%'+_0x6848e1[_0x7ee8('0x31')][_0x7ee8('0x3d')]+'%'};return _0x4282df;})});}_0x492e77=_[_0x7ee8('0x3e')]({},_0x492e77,_0x6848e1['options']);return _0x3a7a3c[_0x7ee8('0x51')](_0x492e77);}})[_0x7ee8('0x41')](function(_0x5f4ab3){if(_0x5f4ab3){_0x4febf7=_0x5f4ab3['length'];if(!_0x6848e1[_0x7ee8('0x31')][_0x7ee8('0x50')](_0x7ee8('0x39'))){_0x492e77[_0x7ee8('0x1f')]=qs['limit'](_0x6848e1[_0x7ee8('0x31')][_0x7ee8('0x1f')]);_0x492e77[_0x7ee8('0x1d')]=qs[_0x7ee8('0x1d')](_0x6848e1[_0x7ee8('0x31')]['offset']);}return _0x3a7a3c[_0x7ee8('0x51')](_0x492e77);}})['then'](function(_0x7f0181){if(_0x7f0181){return _0x7f0181?{'count':_0x4febf7,'rows':_0x7f0181}:null;}})[_0x7ee8('0x41')](respondWithResult(_0x34c43a,null))['catch'](handleError(_0x34c43a,null));};exports[_0x7ee8('0x52')]=function(_0x1b4124,_0x493bdf,_0x236c1b){var _0x3e82e7={};var _0x164ce6={};var _0xd9c0ed;var _0x28f06a;return db['SalesforceConfiguration'][_0x7ee8('0x4e')]({'where':{'id':_0x1b4124[_0x7ee8('0x4c')]['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x493bdf,null))[_0x7ee8('0x41')](function(_0x37810a){if(_0x37810a){_0xd9c0ed=_0x37810a;_0x164ce6[_0x7ee8('0x35')]=_[_0x7ee8('0x32')](db[_0x7ee8('0x53')][_0x7ee8('0x2d')]);_0x164ce6[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0x1b4124[_0x7ee8('0x31')]);_0x164ce6[_0x7ee8('0x33')]=_[_0x7ee8('0x34')](_0x164ce6[_0x7ee8('0x35')],_0x164ce6[_0x7ee8('0x31')]);_0x3e82e7[_0x7ee8('0x37')]=_[_0x7ee8('0x34')](_0x164ce6[_0x7ee8('0x35')],qs[_0x7ee8('0x36')](_0x1b4124[_0x7ee8('0x31')][_0x7ee8('0x36')]));_0x3e82e7[_0x7ee8('0x37')]=_0x3e82e7['attributes'][_0x7ee8('0x38')]?_0x3e82e7[_0x7ee8('0x37')]:_0x164ce6[_0x7ee8('0x35')];_0x3e82e7[_0x7ee8('0x3a')]=qs['sort'](_0x1b4124[_0x7ee8('0x31')][_0x7ee8('0x4f')]);_0x3e82e7[_0x7ee8('0x3b')]=qs[_0x7ee8('0x33')](_[_0x7ee8('0x3c')](_0x1b4124[_0x7ee8('0x31')],_0x164ce6[_0x7ee8('0x33')]));if(_0x1b4124[_0x7ee8('0x31')][_0x7ee8('0x3d')]){_0x3e82e7[_0x7ee8('0x3b')]=_['merge'](_0x3e82e7['where'],{'$or':_[_0x7ee8('0x2c')](_0x3e82e7['attributes'],function(_0x45659e){var _0x2518e2={};_0x2518e2[_0x45659e]={'$like':'%'+_0x1b4124['query'][_0x7ee8('0x3d')]+'%'};return _0x2518e2;})});}_0x3e82e7=_[_0x7ee8('0x3e')]({},_0x3e82e7,_0x1b4124[_0x7ee8('0x48')]);return _0xd9c0ed[_0x7ee8('0x52')](_0x3e82e7);}})[_0x7ee8('0x41')](function(_0x1b4e6d){if(_0x1b4e6d){_0x28f06a=_0x1b4e6d[_0x7ee8('0x38')];if(!_0x1b4124[_0x7ee8('0x31')]['hasOwnProperty']('nolimit')){_0x3e82e7[_0x7ee8('0x1f')]=qs[_0x7ee8('0x1f')](_0x1b4124['query'][_0x7ee8('0x1f')]);_0x3e82e7[_0x7ee8('0x1d')]=qs['offset'](_0x1b4124[_0x7ee8('0x31')]['offset']);}return _0xd9c0ed[_0x7ee8('0x52')](_0x3e82e7);}})[_0x7ee8('0x41')](function(_0x26549a){if(_0x26549a){return _0x26549a?{'count':_0x28f06a,'rows':_0x26549a}:null;}})[_0x7ee8('0x41')](respondWithResult(_0x493bdf,null))[_0x7ee8('0x45')](handleError(_0x493bdf,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index fb09265..e1a9a62 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 _0xbaad=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xbaad,0x1e6));var _0xdbaa=function(_0x377620,_0x20c96c){_0x377620=_0x377620-0x0;var _0x915f43=_0xbaad[_0x377620];return _0x915f43;};'use strict';var _=require(_0xdbaa('0x0'));var util=require(_0xdbaa('0x1'));var logger=require(_0xdbaa('0x2'))(_0xdbaa('0x3'));var moment=require(_0xdbaa('0x4'));var BPromise=require(_0xdbaa('0x5'));var rp=require(_0xdbaa('0x6'));var fs=require('fs');var path=require(_0xdbaa('0x7'));var rimraf=require(_0xdbaa('0x8'));var config=require(_0xdbaa('0x9'));var attributes=require(_0xdbaa('0xa'));module[_0xdbaa('0xb')]=function(_0x3dc0aa,_0x3ede80){return _0x3dc0aa[_0xdbaa('0xc')]('SalesforceConfiguration',attributes,{'tableName':_0xdbaa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97e4=['moment','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','lodash','../../config/logger','api'];(function(_0x45c262,_0x2e3ce5){var _0x4f2ba6=function(_0x4912d1){while(--_0x4912d1){_0x45c262['push'](_0x45c262['shift']());}};_0x4f2ba6(++_0x2e3ce5);}(_0x97e4,0x1a1));var _0x497e=function(_0x5b2433,_0x55e16e){_0x5b2433=_0x5b2433-0x0;var _0x43dfe0=_0x97e4[_0x5b2433];return _0x43dfe0;};'use strict';var _=require(_0x497e('0x0'));var util=require('util');var logger=require(_0x497e('0x1'))(_0x497e('0x2'));var moment=require(_0x497e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x497e('0x4'));var rimraf=require(_0x497e('0x5'));var config=require(_0x497e('0x6'));var attributes=require(_0x497e('0x7'));module[_0x497e('0x8')]=function(_0x3d6dfd,_0x270a8d){return _0x3d6dfd['define']('SalesforceConfiguration',attributes,{'tableName':_0x497e('0x9'),'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 281172e..e7f90ea 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 _0x2e95=['debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x5cf2d4,_0x36aa91){var _0x5ba66f=function(_0x31b09a){while(--_0x31b09a){_0x5cf2d4['push'](_0x5cf2d4['shift']());}};_0x5ba66f(++_0x36aa91);}(_0x2e95,0xee));var _0x52e9=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x2e95[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x52e9('0x0'));var util=require('util');var moment=require(_0x52e9('0x1'));var BPromise=require('bluebird');var rs=require(_0x52e9('0x2'));var fs=require('fs');var Redis=require(_0x52e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x52e9('0x4'));var logger=require(_0x52e9('0x5'))(_0x52e9('0x6'));var config=require(_0x52e9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x52e9('0x8')][_0x52e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x349e5a,_0x3950ee,_0x31a479){return new BPromise(function(_0x45cd53,_0x5ede3f){return client[_0x52e9('0xa')](_0x349e5a,_0x31a479)['then'](function(_0x19f26a){logger[_0x52e9('0xb')](_0x52e9('0xc'),_0x3950ee,_0x52e9('0xd'));logger[_0x52e9('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3950ee,_0x52e9('0xd'),JSON[_0x52e9('0xf')](_0x19f26a));if(_0x19f26a[_0x52e9('0x10')]){if(_0x19f26a['error'][_0x52e9('0x11')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x3950ee,_0x19f26a[_0x52e9('0x10')]['message']);return _0x5ede3f(_0x19f26a[_0x52e9('0x10')][_0x52e9('0x12')]);}logger[_0x52e9('0x10')](_0x52e9('0xc'),_0x3950ee,_0x19f26a['error'][_0x52e9('0x12')]);return _0x45cd53(_0x19f26a[_0x52e9('0x10')][_0x52e9('0x12')]);}else{logger['info'](_0x52e9('0xc'),_0x3950ee,_0x52e9('0xd'));_0x45cd53(_0x19f26a[_0x52e9('0x13')][_0x52e9('0x12')]);}})[_0x52e9('0x14')](function(_0x16030a){logger[_0x52e9('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3950ee,_0x16030a);_0x5ede3f(_0x16030a);});});} \ No newline at end of file +var _0x4803=['debug','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x42d5ae,_0x5350a7){var _0x14a05a=function(_0x506154){while(--_0x506154){_0x42d5ae['push'](_0x42d5ae['shift']());}};_0x14a05a(++_0x5350a7);}(_0x4803,0x1e5));var _0x3480=function(_0x47ed1a,_0x34e1d8){_0x47ed1a=_0x47ed1a-0x0;var _0x23b059=_0x4803[_0x47ed1a];return _0x23b059;};'use strict';var _=require(_0x3480('0x0'));var util=require(_0x3480('0x1'));var moment=require('moment');var BPromise=require(_0x3480('0x2'));var rs=require(_0x3480('0x3'));var fs=require('fs');var Redis=require(_0x3480('0x4'));var db=require(_0x3480('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3480('0x6'))(_0x3480('0x7'));var config=require(_0x3480('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3480('0x9')][_0x3480('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46168e,_0x4f54ca,_0xb57a9e){return new BPromise(function(_0x507a8c,_0x2b3e4f){return client[_0x3480('0xb')](_0x46168e,_0xb57a9e)[_0x3480('0xc')](function(_0x27d6b2){logger['info'](_0x3480('0xd'),_0x4f54ca,_0x3480('0xe'));logger[_0x3480('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x4f54ca,'request\x20sent',JSON[_0x3480('0x10')](_0x27d6b2));if(_0x27d6b2[_0x3480('0x11')]){if(_0x27d6b2[_0x3480('0x11')]['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4f54ca,_0x27d6b2[_0x3480('0x11')][_0x3480('0x12')]);return _0x2b3e4f(_0x27d6b2['error'][_0x3480('0x12')]);}logger[_0x3480('0x11')](_0x3480('0xd'),_0x4f54ca,_0x27d6b2[_0x3480('0x11')][_0x3480('0x12')]);return _0x507a8c(_0x27d6b2[_0x3480('0x11')][_0x3480('0x12')]);}else{logger['info'](_0x3480('0xd'),_0x4f54ca,_0x3480('0xe'));_0x507a8c(_0x27d6b2['result']['message']);}})[_0x3480('0x13')](function(_0x49a4a1){logger[_0x3480('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f54ca,_0x49a4a1);_0x2b3e4f(_0x49a4a1);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 41c4bba..3dfc670 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 _0x73de=['isAuthenticated','show','create','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x73de,0x181));var _0xe73d=function(_0x18b168,_0x2f51ee){_0x18b168=_0x18b168-0x0;var _0x249cbd=_0x73de[_0x18b168];return _0x249cbd;};'use strict';var multer=require('multer');var util=require(_0xe73d('0x0'));var path=require(_0xe73d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe73d('0x2')]();var fs_extra=require(_0xe73d('0x3'));var auth=require(_0xe73d('0x4'));var interaction=require(_0xe73d('0x5'));var config=require(_0xe73d('0x6'));var controller=require(_0xe73d('0x7'));router[_0xe73d('0x8')]('/',auth['isAuthenticated'](),controller[_0xe73d('0x9')]);router[_0xe73d('0x8')](_0xe73d('0xa'),auth[_0xe73d('0xb')](),controller[_0xe73d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe73d('0xd')]);router[_0xe73d('0xe')]('/:id',auth[_0xe73d('0xb')](),controller[_0xe73d('0xf')]);router[_0xe73d('0x10')]('/:id',auth[_0xe73d('0xb')](),controller['destroy']);module[_0xe73d('0x11')]=router; \ No newline at end of file +var _0x8818=['create','put','/:id','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','show','post'];(function(_0x214b04,_0x4ecd10){var _0x1a3a3e=function(_0x5bff2a){while(--_0x5bff2a){_0x214b04['push'](_0x214b04['shift']());}};_0x1a3a3e(++_0x4ecd10);}(_0x8818,0xea));var _0x8881=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8818[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0x8881('0x0'));var util=require(_0x8881('0x1'));var path=require(_0x8881('0x2'));var timeout=require('connect-timeout');var express=require(_0x8881('0x3'));var router=express['Router']();var fs_extra=require(_0x8881('0x4'));var auth=require(_0x8881('0x5'));var interaction=require(_0x8881('0x6'));var config=require(_0x8881('0x7'));var controller=require(_0x8881('0x8'));router[_0x8881('0x9')]('/',auth[_0x8881('0xa')](),controller['index']);router[_0x8881('0x9')]('/:id',auth[_0x8881('0xa')](),controller[_0x8881('0xb')]);router[_0x8881('0xc')]('/',auth[_0x8881('0xa')](),controller[_0x8881('0xd')]);router[_0x8881('0xe')](_0x8881('0xf'),auth[_0x8881('0xa')](),controller[_0x8881('0x10')]);router[_0x8881('0x11')](_0x8881('0xf'),auth[_0x8881('0xa')](),controller['destroy']);module[_0x8881('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 950c7ff..bdac62f 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 _0xe4e8=['string','variable','customVariable','keyValue','STRING','sequelize','ENUM'];(function(_0x192973,_0x277bda){var _0x3e693a=function(_0x36d3d3){while(--_0x36d3d3){_0x192973['push'](_0x192973['shift']());}};_0x3e693a(++_0x277bda);}(_0xe4e8,0x19b));var _0x8e4e=function(_0x24c6cf,_0x4d121c){_0x24c6cf=_0x24c6cf-0x0;var _0x117d76=_0xe4e8[_0x24c6cf];return _0x117d76;};'use strict';var Sequelize=require(_0x8e4e('0x0'));module['exports']={'type':{'type':Sequelize[_0x8e4e('0x1')](_0x8e4e('0x2'),_0x8e4e('0x3'),_0x8e4e('0x4'),_0x8e4e('0x5'),'picklist'),'defaultValue':_0x8e4e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8e4e('0x6')]},'keyType':{'type':Sequelize[_0x8e4e('0x1')]('string',_0x8e4e('0x3'),_0x8e4e('0x4'))},'keyContent':{'type':Sequelize[_0x8e4e('0x6')]},'idField':{'type':Sequelize[_0x8e4e('0x6')]},'variableName':{'type':Sequelize[_0x8e4e('0x6')]}}; \ No newline at end of file +var _0x832a=['ENUM','string','customVariable','STRING','variable','sequelize','exports'];(function(_0x17a057,_0x51ef19){var _0x5b34d2=function(_0x3f69f0){while(--_0x3f69f0){_0x17a057['push'](_0x17a057['shift']());}};_0x5b34d2(++_0x51ef19);}(_0x832a,0x1c5));var _0xa832=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0x832a[_0x5c6994];return _0x1d5c84;};'use strict';var Sequelize=require(_0xa832('0x0'));module[_0xa832('0x1')]={'type':{'type':Sequelize[_0xa832('0x2')](_0xa832('0x3'),'variable',_0xa832('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa832('0x5')]},'key':{'type':Sequelize[_0xa832('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xa832('0x3'),_0xa832('0x6'),_0xa832('0x4'))},'keyContent':{'type':Sequelize[_0xa832('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xa832('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ffd75d8..39b7ae1 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 _0xf393=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','SalesforceField','rawAttributes','fieldName','type'];(function(_0x33229c,_0x181f84){var _0x4c8e1c=function(_0x3be512){while(--_0x3be512){_0x33229c['push'](_0x33229c['shift']());}};_0x4c8e1c(++_0x181f84);}(_0xf393,0x189));var _0x3f39=function(_0x52a46f,_0x19a79e){_0x52a46f=_0x52a46f-0x0;var _0x1b6739=_0xf393[_0x52a46f];return _0x1b6739;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f39('0x0'));var zipdir=require(_0x3f39('0x1'));var jsonpatch=require(_0x3f39('0x2'));var rp=require(_0x3f39('0x3'));var moment=require(_0x3f39('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f39('0x5'));var util=require(_0x3f39('0x6'));var path=require(_0x3f39('0x7'));var sox=require(_0x3f39('0x8'));var csv=require(_0x3f39('0x9'));var ejs=require(_0x3f39('0xa'));var fs=require('fs');var fs_extra=require(_0x3f39('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3f39('0xc'));var jsforce=require(_0x3f39('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3f39('0x9'));var querystring=require(_0x3f39('0xe'));var Papa=require(_0x3f39('0xf'));var Redis=require(_0x3f39('0x10'));var authService=require(_0x3f39('0x11'));var qs=require(_0x3f39('0x12'));var as=require(_0x3f39('0x13'));var hardwareService=require(_0x3f39('0x14'));var logger=require('../../config/logger')(_0x3f39('0x15'));var utils=require(_0x3f39('0x16'));var config=require(_0x3f39('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f39('0x18'))['db'];function respondWithStatusCode(_0xd83339,_0x2eaac8){_0x2eaac8=_0x2eaac8||0xcc;return function(_0x50cabb){if(_0x50cabb){return _0xd83339['sendStatus'](_0x2eaac8);}return _0xd83339[_0x3f39('0x19')](_0x2eaac8)[_0x3f39('0x1a')]();};}function respondWithResult(_0x5d2c41,_0x2ef83d){_0x2ef83d=_0x2ef83d||0xc8;return function(_0x42588f){if(_0x42588f){return _0x5d2c41[_0x3f39('0x19')](_0x2ef83d)[_0x3f39('0x1b')](_0x42588f);}};}function respondWithFilteredResult(_0x2c8aa6,_0x3f1596){return function(_0x1fb34c){if(_0x1fb34c){var _0x487f5b=typeof _0x3f1596[_0x3f39('0x1c')]===_0x3f39('0x1d')&&typeof _0x3f1596[_0x3f39('0x1e')]==='undefined';var _0x5493f7=_0x1fb34c[_0x3f39('0x1f')];var _0x1b59fb=_0x487f5b?0x0:_0x3f1596['offset'];var _0x128cf6=_0x487f5b?_0x1fb34c['count']:_0x3f1596[_0x3f39('0x1c')]+_0x3f1596[_0x3f39('0x1e')];var _0x33efd1;if(_0x128cf6>=_0x5493f7){_0x128cf6=_0x5493f7;_0x33efd1=0xc8;}else{_0x33efd1=0xce;}_0x2c8aa6[_0x3f39('0x19')](_0x33efd1);return _0x2c8aa6[_0x3f39('0x20')](_0x3f39('0x21'),_0x1b59fb+'-'+_0x128cf6+'/'+_0x5493f7)['json'](_0x1fb34c);}return null;};}function patchUpdates(_0x2018ff){return function(_0x4661ae){try{jsonpatch[_0x3f39('0x22')](_0x4661ae,_0x2018ff,!![]);}catch(_0x1f3367){return BPromise[_0x3f39('0x23')](_0x1f3367);}return _0x4661ae[_0x3f39('0x24')]();};}function saveUpdates(_0x41dd50,_0x3522c7){return function(_0x7240fe){if(_0x7240fe){return _0x7240fe[_0x3f39('0x25')](_0x41dd50)['then'](function(_0x12023a){return _0x12023a;});}return null;};}function removeEntity(_0x4196de,_0x1a98f2){return function(_0x37f510){if(_0x37f510){return _0x37f510['destroy']()[_0x3f39('0x26')](function(){_0x4196de[_0x3f39('0x19')](0xcc)[_0x3f39('0x1a')]();});}};}function handleEntityNotFound(_0xa943f0,_0x4cb211){return function(_0x590006){if(!_0x590006){_0xa943f0['sendStatus'](0x194);}return _0x590006;};}function handleError(_0x562d2e,_0xb8a021){_0xb8a021=_0xb8a021||0x1f4;return function(_0x3c60c8){logger[_0x3f39('0x27')](_0x3c60c8['stack']);if(_0x3c60c8[_0x3f39('0x28')]){delete _0x3c60c8[_0x3f39('0x28')];}_0x562d2e[_0x3f39('0x19')](_0xb8a021)['send'](_0x3c60c8);};}exports['index']=function(_0x38a757,_0xa5b5cf){var _0xdc82b5={},_0x195b3f={},_0x16009a={'count':0x0,'rows':[]};var _0x5e5018=_['map'](db[_0x3f39('0x29')][_0x3f39('0x2a')],function(_0x30fba2){return{'name':_0x30fba2[_0x3f39('0x2b')],'type':_0x30fba2[_0x3f39('0x2c')]['key']};});_0x195b3f[_0x3f39('0x2d')]=_[_0x3f39('0x2e')](_0x5e5018,_0x3f39('0x28'));_0x195b3f[_0x3f39('0x2f')]=_[_0x3f39('0x30')](_0x38a757[_0x3f39('0x2f')]);_0x195b3f[_0x3f39('0x31')]=_[_0x3f39('0x32')](_0x195b3f[_0x3f39('0x2d')],_0x195b3f[_0x3f39('0x2f')]);_0xdc82b5[_0x3f39('0x33')]=_[_0x3f39('0x32')](_0x195b3f[_0x3f39('0x2d')],qs[_0x3f39('0x34')](_0x38a757[_0x3f39('0x2f')][_0x3f39('0x34')]));_0xdc82b5['attributes']=_0xdc82b5[_0x3f39('0x33')][_0x3f39('0x35')]?_0xdc82b5['attributes']:_0x195b3f[_0x3f39('0x2d')];if(!_0x38a757['query'][_0x3f39('0x36')](_0x3f39('0x37'))){_0xdc82b5['limit']=qs['limit'](_0x38a757[_0x3f39('0x2f')][_0x3f39('0x1e')]);_0xdc82b5[_0x3f39('0x1c')]=qs[_0x3f39('0x1c')](_0x38a757['query'][_0x3f39('0x1c')]);}_0xdc82b5[_0x3f39('0x38')]=qs[_0x3f39('0x39')](_0x38a757[_0x3f39('0x2f')]['sort']);_0xdc82b5[_0x3f39('0x3a')]=qs[_0x3f39('0x31')](_['pick'](_0x38a757[_0x3f39('0x2f')],_0x195b3f['filters']),_0x5e5018);if(_0x38a757['query'][_0x3f39('0x3b')]){_0xdc82b5['where']=_[_0x3f39('0x3c')](_0xdc82b5['where'],{'$or':_[_0x3f39('0x2e')](_0x5e5018,function(_0x340e73){if(_0x340e73[_0x3f39('0x2c')]!=='VIRTUAL'){var _0x51b3de={};_0x51b3de[_0x340e73[_0x3f39('0x28')]]={'$like':'%'+_0x38a757['query'][_0x3f39('0x3b')]+'%'};return _0x51b3de;}})});}_0xdc82b5=_['merge']({},_0xdc82b5,_0x38a757[_0x3f39('0x3d')]);var _0x5a0120={'where':_0xdc82b5[_0x3f39('0x3a')]};return db[_0x3f39('0x29')]['count'](_0x5a0120)[_0x3f39('0x26')](function(_0x5a5407){_0x16009a['count']=_0x5a5407;if(_0x38a757[_0x3f39('0x2f')][_0x3f39('0x3e')]){_0xdc82b5[_0x3f39('0x3f')]=[{'all':!![]}];}return db[_0x3f39('0x29')][_0x3f39('0x40')](_0xdc82b5);})[_0x3f39('0x26')](function(_0x39f913){_0x16009a[_0x3f39('0x41')]=_0x39f913;return _0x16009a;})['then'](respondWithFilteredResult(_0xa5b5cf,_0xdc82b5))[_0x3f39('0x42')](handleError(_0xa5b5cf,null));};exports[_0x3f39('0x43')]=function(_0x354ce9,_0x31576b){var _0x504e0c={'raw':!![],'where':{'id':_0x354ce9[_0x3f39('0x44')]['id']}},_0x469cc0={};_0x469cc0[_0x3f39('0x2d')]=_[_0x3f39('0x30')](db[_0x3f39('0x29')][_0x3f39('0x2a')]);_0x469cc0['query']=_[_0x3f39('0x30')](_0x354ce9['query']);_0x469cc0[_0x3f39('0x31')]=_['intersection'](_0x469cc0['model'],_0x469cc0[_0x3f39('0x2f')]);_0x504e0c['attributes']=_[_0x3f39('0x32')](_0x469cc0['model'],qs[_0x3f39('0x34')](_0x354ce9[_0x3f39('0x2f')][_0x3f39('0x34')]));_0x504e0c['attributes']=_0x504e0c[_0x3f39('0x33')][_0x3f39('0x35')]?_0x504e0c[_0x3f39('0x33')]:_0x469cc0['model'];if(_0x354ce9['query']['includeAll']){_0x504e0c[_0x3f39('0x3f')]=[{'all':!![]}];}_0x504e0c=_[_0x3f39('0x3c')]({},_0x504e0c,_0x354ce9[_0x3f39('0x3d')]);return db[_0x3f39('0x29')][_0x3f39('0x45')](_0x504e0c)['then'](handleEntityNotFound(_0x31576b,null))[_0x3f39('0x26')](respondWithResult(_0x31576b,null))[_0x3f39('0x42')](handleError(_0x31576b,null));};exports[_0x3f39('0x46')]=function(_0x173777,_0x491d8f){return db[_0x3f39('0x29')][_0x3f39('0x46')](_0x173777[_0x3f39('0x47')],{})[_0x3f39('0x26')](respondWithResult(_0x491d8f,0xc9))[_0x3f39('0x42')](handleError(_0x491d8f,null));};exports[_0x3f39('0x25')]=function(_0x15ccce,_0x3b6295){if(_0x15ccce[_0x3f39('0x47')]['id']){delete _0x15ccce[_0x3f39('0x47')]['id'];}return db[_0x3f39('0x29')][_0x3f39('0x45')]({'where':{'id':_0x15ccce[_0x3f39('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b6295,null))[_0x3f39('0x26')](saveUpdates(_0x15ccce[_0x3f39('0x47')],null))[_0x3f39('0x26')](respondWithResult(_0x3b6295,null))[_0x3f39('0x42')](handleError(_0x3b6295,null));};exports[_0x3f39('0x48')]=function(_0x3bd919,_0x33264b){return db[_0x3f39('0x29')][_0x3f39('0x45')]({'where':{'id':_0x3bd919['params']['id']}})['then'](handleEntityNotFound(_0x33264b,null))['then'](removeEntity(_0x33264b,null))[_0x3f39('0x42')](handleError(_0x33264b,null));}; \ No newline at end of file +var _0x0875=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','params','keys','include','find','create','body','catch','eml-format','rimraf','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4b076f,_0x2dee19){var _0xae69a=function(_0x55eb99){while(--_0x55eb99){_0x4b076f['push'](_0x4b076f['shift']());}};_0xae69a(++_0x2dee19);}(_0x0875,0x192));var _0x5087=function(_0x28a048,_0x5eca74){_0x28a048=_0x28a048-0x0;var _0x4cc1de=_0x0875[_0x28a048];return _0x4cc1de;};'use strict';var emlformat=require(_0x5087('0x0'));var rimraf=require(_0x5087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5087('0x2'));var Mustache=require(_0x5087('0x3'));var util=require('util');var path=require(_0x5087('0x4'));var sox=require(_0x5087('0x5'));var csv=require(_0x5087('0x6'));var ejs=require(_0x5087('0x7'));var fs=require('fs');var fs_extra=require(_0x5087('0x8'));var _=require(_0x5087('0x9'));var squel=require(_0x5087('0xa'));var crypto=require('crypto');var jsforce=require(_0x5087('0xb'));var deskjs=require(_0x5087('0xc'));var toCsv=require(_0x5087('0x6'));var querystring=require(_0x5087('0xd'));var Papa=require(_0x5087('0xe'));var Redis=require(_0x5087('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5087('0x10'));var as=require(_0x5087('0x11'));var hardwareService=require(_0x5087('0x12'));var logger=require(_0x5087('0x13'))(_0x5087('0x14'));var utils=require(_0x5087('0x15'));var config=require(_0x5087('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5087('0x17'))['db'];function respondWithStatusCode(_0x41be95,_0x45fd5c){_0x45fd5c=_0x45fd5c||0xcc;return function(_0xad8cac){if(_0xad8cac){return _0x41be95[_0x5087('0x18')](_0x45fd5c);}return _0x41be95[_0x5087('0x19')](_0x45fd5c)[_0x5087('0x1a')]();};}function respondWithResult(_0x28876a,_0x18d81d){_0x18d81d=_0x18d81d||0xc8;return function(_0x3d65dc){if(_0x3d65dc){return _0x28876a[_0x5087('0x19')](_0x18d81d)[_0x5087('0x1b')](_0x3d65dc);}};}function respondWithFilteredResult(_0xdbbb8e,_0x22dac6){return function(_0x2d653a){if(_0x2d653a){var _0x2b9cef=typeof _0x22dac6[_0x5087('0x1c')]===_0x5087('0x1d')&&typeof _0x22dac6[_0x5087('0x1e')]==='undefined';var _0x10403a=_0x2d653a['count'];var _0x4eea19=_0x2b9cef?0x0:_0x22dac6['offset'];var _0x55534b=_0x2b9cef?_0x2d653a[_0x5087('0x1f')]:_0x22dac6['offset']+_0x22dac6[_0x5087('0x1e')];var _0x4d1bb8;if(_0x55534b>=_0x10403a){_0x55534b=_0x10403a;_0x4d1bb8=0xc8;}else{_0x4d1bb8=0xce;}_0xdbbb8e[_0x5087('0x19')](_0x4d1bb8);return _0xdbbb8e[_0x5087('0x20')](_0x5087('0x21'),_0x4eea19+'-'+_0x55534b+'/'+_0x10403a)[_0x5087('0x1b')](_0x2d653a);}return null;};}function patchUpdates(_0x9e7b7b){return function(_0x13a0d8){try{jsonpatch['apply'](_0x13a0d8,_0x9e7b7b,!![]);}catch(_0x2859de){return BPromise[_0x5087('0x22')](_0x2859de);}return _0x13a0d8[_0x5087('0x23')]();};}function saveUpdates(_0xc101a1,_0x297c94){return function(_0x14bf14){if(_0x14bf14){return _0x14bf14[_0x5087('0x24')](_0xc101a1)[_0x5087('0x25')](function(_0xcbaa43){return _0xcbaa43;});}return null;};}function removeEntity(_0x4eac3b,_0x409ad6){return function(_0x1c185c){if(_0x1c185c){return _0x1c185c[_0x5087('0x26')]()[_0x5087('0x25')](function(){_0x4eac3b[_0x5087('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c0743,_0x5d55e9){return function(_0x353208){if(!_0x353208){_0x5c0743[_0x5087('0x18')](0x194);}return _0x353208;};}function handleError(_0x32bbf6,_0x3604f9){_0x3604f9=_0x3604f9||0x1f4;return function(_0x882def){logger[_0x5087('0x27')](_0x882def[_0x5087('0x28')]);if(_0x882def[_0x5087('0x29')]){delete _0x882def[_0x5087('0x29')];}_0x32bbf6[_0x5087('0x19')](_0x3604f9)['send'](_0x882def);};}exports[_0x5087('0x2a')]=function(_0x2afe13,_0x23240a){var _0x588106={},_0x56d570={},_0x4288fd={'count':0x0,'rows':[]};var _0x4e502f=_[_0x5087('0x2b')](db[_0x5087('0x2c')][_0x5087('0x2d')],function(_0x467cde){return{'name':_0x467cde[_0x5087('0x2e')],'type':_0x467cde['type'][_0x5087('0x2f')]};});_0x56d570[_0x5087('0x30')]=_[_0x5087('0x2b')](_0x4e502f,_0x5087('0x29'));_0x56d570[_0x5087('0x31')]=_['keys'](_0x2afe13['query']);_0x56d570[_0x5087('0x32')]=_[_0x5087('0x33')](_0x56d570[_0x5087('0x30')],_0x56d570[_0x5087('0x31')]);_0x588106['attributes']=_[_0x5087('0x33')](_0x56d570[_0x5087('0x30')],qs['fields'](_0x2afe13[_0x5087('0x31')][_0x5087('0x34')]));_0x588106['attributes']=_0x588106[_0x5087('0x35')][_0x5087('0x36')]?_0x588106['attributes']:_0x56d570['model'];if(!_0x2afe13['query'][_0x5087('0x37')](_0x5087('0x38'))){_0x588106[_0x5087('0x1e')]=qs[_0x5087('0x1e')](_0x2afe13[_0x5087('0x31')][_0x5087('0x1e')]);_0x588106[_0x5087('0x1c')]=qs[_0x5087('0x1c')](_0x2afe13[_0x5087('0x31')][_0x5087('0x1c')]);}_0x588106['order']=qs[_0x5087('0x39')](_0x2afe13[_0x5087('0x31')][_0x5087('0x39')]);_0x588106[_0x5087('0x3a')]=qs[_0x5087('0x32')](_['pick'](_0x2afe13['query'],_0x56d570[_0x5087('0x32')]),_0x4e502f);if(_0x2afe13[_0x5087('0x31')][_0x5087('0x3b')]){_0x588106[_0x5087('0x3a')]=_[_0x5087('0x3c')](_0x588106[_0x5087('0x3a')],{'$or':_[_0x5087('0x2b')](_0x4e502f,function(_0x25f73c){if(_0x25f73c['type']!=='VIRTUAL'){var _0x2203cc={};_0x2203cc[_0x25f73c[_0x5087('0x29')]]={'$like':'%'+_0x2afe13[_0x5087('0x31')][_0x5087('0x3b')]+'%'};return _0x2203cc;}})});}_0x588106=_[_0x5087('0x3c')]({},_0x588106,_0x2afe13[_0x5087('0x3d')]);var _0x276c6a={'where':_0x588106[_0x5087('0x3a')]};return db[_0x5087('0x2c')][_0x5087('0x1f')](_0x276c6a)[_0x5087('0x25')](function(_0x466a24){_0x4288fd['count']=_0x466a24;if(_0x2afe13[_0x5087('0x31')][_0x5087('0x3e')]){_0x588106['include']=[{'all':!![]}];}return db[_0x5087('0x2c')][_0x5087('0x3f')](_0x588106);})['then'](function(_0x2cbda3){_0x4288fd['rows']=_0x2cbda3;return _0x4288fd;})[_0x5087('0x25')](respondWithFilteredResult(_0x23240a,_0x588106))['catch'](handleError(_0x23240a,null));};exports['show']=function(_0x5c591d,_0x3ff1cc){var _0x271fd6={'raw':!![],'where':{'id':_0x5c591d[_0x5087('0x40')]['id']}},_0x398c6a={};_0x398c6a[_0x5087('0x30')]=_[_0x5087('0x41')](db[_0x5087('0x2c')][_0x5087('0x2d')]);_0x398c6a[_0x5087('0x31')]=_['keys'](_0x5c591d['query']);_0x398c6a[_0x5087('0x32')]=_[_0x5087('0x33')](_0x398c6a['model'],_0x398c6a[_0x5087('0x31')]);_0x271fd6[_0x5087('0x35')]=_['intersection'](_0x398c6a['model'],qs[_0x5087('0x34')](_0x5c591d['query'][_0x5087('0x34')]));_0x271fd6[_0x5087('0x35')]=_0x271fd6[_0x5087('0x35')][_0x5087('0x36')]?_0x271fd6['attributes']:_0x398c6a[_0x5087('0x30')];if(_0x5c591d[_0x5087('0x31')][_0x5087('0x3e')]){_0x271fd6[_0x5087('0x42')]=[{'all':!![]}];}_0x271fd6=_[_0x5087('0x3c')]({},_0x271fd6,_0x5c591d[_0x5087('0x3d')]);return db[_0x5087('0x2c')][_0x5087('0x43')](_0x271fd6)[_0x5087('0x25')](handleEntityNotFound(_0x3ff1cc,null))[_0x5087('0x25')](respondWithResult(_0x3ff1cc,null))['catch'](handleError(_0x3ff1cc,null));};exports['create']=function(_0x116269,_0x2d13bd){return db['SalesforceField'][_0x5087('0x44')](_0x116269[_0x5087('0x45')],{})[_0x5087('0x25')](respondWithResult(_0x2d13bd,0xc9))[_0x5087('0x46')](handleError(_0x2d13bd,null));};exports[_0x5087('0x24')]=function(_0x4a7d70,_0x40dda3){if(_0x4a7d70['body']['id']){delete _0x4a7d70['body']['id'];}return db['SalesforceField'][_0x5087('0x43')]({'where':{'id':_0x4a7d70[_0x5087('0x40')]['id']}})[_0x5087('0x25')](handleEntityNotFound(_0x40dda3,null))['then'](saveUpdates(_0x4a7d70[_0x5087('0x45')],null))[_0x5087('0x25')](respondWithResult(_0x40dda3,null))[_0x5087('0x46')](handleError(_0x40dda3,null));};exports[_0x5087('0x26')]=function(_0x11c8c8,_0x12a40f){return db[_0x5087('0x2c')][_0x5087('0x43')]({'where':{'id':_0x11c8c8[_0x5087('0x40')]['id']}})[_0x5087('0x25')](handleEntityNotFound(_0x12a40f,null))['then'](removeEntity(_0x12a40f,null))[_0x5087('0x46')](handleError(_0x12a40f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 3b6593c..bdac0f7 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 _0x1c62=['util','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId'];(function(_0x3f4d65,_0x26b3af){var _0x2dacb3=function(_0x55916f){while(--_0x55916f){_0x3f4d65['push'](_0x3f4d65['shift']());}};_0x2dacb3(++_0x26b3af);}(_0x1c62,0x1b2));var _0x21c6=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x1c62[_0x2300f2];return _0x6bd508;};'use strict';var _=require('lodash');var util=require(_0x21c6('0x0'));var logger=require('../../config/logger')(_0x21c6('0x1'));var moment=require(_0x21c6('0x2'));var BPromise=require(_0x21c6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x21c6('0x4'));var rimraf=require(_0x21c6('0x5'));var config=require(_0x21c6('0x6'));var attributes=require(_0x21c6('0x7'));module[_0x21c6('0x8')]=function(_0x102364,_0x2cefd9){return _0x102364[_0x21c6('0x9')](_0x21c6('0xa'),attributes,{'tableName':_0x21c6('0xb'),'paranoid':![],'indexes':[{'name':_0x21c6('0xc'),'fields':['idField',_0x21c6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7405=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','util'];(function(_0x5116c3,_0x52b21c){var _0x832dfe=function(_0x1cbe1a){while(--_0x1cbe1a){_0x5116c3['push'](_0x5116c3['shift']());}};_0x832dfe(++_0x52b21c);}(_0x7405,0xbf));var _0x5740=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7405[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var util=require(_0x5740('0x0'));var logger=require(_0x5740('0x1'))(_0x5740('0x2'));var moment=require(_0x5740('0x3'));var BPromise=require(_0x5740('0x4'));var rp=require(_0x5740('0x5'));var fs=require('fs');var path=require(_0x5740('0x6'));var rimraf=require(_0x5740('0x7'));var config=require(_0x5740('0x8'));var attributes=require(_0x5740('0x9'));module[_0x5740('0xa')]=function(_0x5f099d,_0x398301){return _0x5f099d[_0x5740('0xb')](_0x5740('0xc'),attributes,{'tableName':_0x5740('0xd'),'paranoid':![],'indexes':[{'name':_0x5740('0xe'),'fields':[_0x5740('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index b39bfe7..80c1d6e 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 _0x0db1=['jayson/promise','request','info','request\x20sent','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x18446a,_0x1edaf9){var _0x441cd2=function(_0x4ed900){while(--_0x4ed900){_0x18446a['push'](_0x18446a['shift']());}};_0x441cd2(++_0x1edaf9);}(_0x0db1,0x106));var _0x10db=function(_0xa161b8,_0x2c1214){_0xa161b8=_0xa161b8-0x0;var _0x477729=_0x0db1[_0xa161b8];return _0x477729;};'use strict';var _=require('lodash');var util=require(_0x10db('0x0'));var moment=require('moment');var BPromise=require(_0x10db('0x1'));var rs=require(_0x10db('0x2'));var fs=require('fs');var Redis=require(_0x10db('0x3'));var db=require(_0x10db('0x4'))['db'];var utils=require(_0x10db('0x5'));var logger=require(_0x10db('0x6'))('rpc');var config=require(_0x10db('0x7'));var jayson=require(_0x10db('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24b661,_0x2b37d0,_0x18f80e){return new BPromise(function(_0x4bea6a,_0x2bcfd2){return client[_0x10db('0x9')](_0x24b661,_0x18f80e)['then'](function(_0xe3fced){logger[_0x10db('0xa')]('SalesforceField,\x20%s,\x20%s',_0x2b37d0,_0x10db('0xb'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2b37d0,_0x10db('0xb'),JSON['stringify'](_0xe3fced));if(_0xe3fced[_0x10db('0xc')]){if(_0xe3fced[_0x10db('0xc')][_0x10db('0xd')]===0x1f4){logger['error'](_0x10db('0xe'),_0x2b37d0,_0xe3fced['error']['message']);return _0x2bcfd2(_0xe3fced[_0x10db('0xc')]['message']);}logger['error'](_0x10db('0xe'),_0x2b37d0,_0xe3fced[_0x10db('0xc')][_0x10db('0xf')]);return _0x4bea6a(_0xe3fced['error']['message']);}else{logger[_0x10db('0xa')](_0x10db('0xe'),_0x2b37d0,_0x10db('0xb'));_0x4bea6a(_0xe3fced[_0x10db('0x10')][_0x10db('0xf')]);}})[_0x10db('0x11')](function(_0x5dc0dc){logger['error'](_0x10db('0xe'),_0x2b37d0,_0x5dc0dc);_0x2bcfd2(_0x5dc0dc);});});} \ No newline at end of file +var _0x627b=['info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3a321d,_0x4e66d5){var _0x27aeb5=function(_0x51688d){while(--_0x51688d){_0x3a321d['push'](_0x3a321d['shift']());}};_0x27aeb5(++_0x4e66d5);}(_0x627b,0x13e));var _0xb627=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x627b[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0xb627('0x0'));var util=require(_0xb627('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb627('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb627('0x3'))['db'];var utils=require(_0xb627('0x4'));var logger=require(_0xb627('0x5'))('rpc');var config=require(_0xb627('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb627('0x7')][_0xb627('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10cc74,_0x4be3d9,_0x23cf91){return new BPromise(function(_0x10dda6,_0x522359){return client[_0xb627('0x9')](_0x10cc74,_0x23cf91)[_0xb627('0xa')](function(_0xf96c62){logger['info'](_0xb627('0xb'),_0x4be3d9,_0xb627('0xc'));logger[_0xb627('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4be3d9,_0xb627('0xc'),JSON[_0xb627('0xe')](_0xf96c62));if(_0xf96c62[_0xb627('0xf')]){if(_0xf96c62[_0xb627('0xf')][_0xb627('0x10')]===0x1f4){logger[_0xb627('0xf')](_0xb627('0xb'),_0x4be3d9,_0xf96c62[_0xb627('0xf')]['message']);return _0x522359(_0xf96c62['error']['message']);}logger['error'](_0xb627('0xb'),_0x4be3d9,_0xf96c62[_0xb627('0xf')][_0xb627('0x11')]);return _0x10dda6(_0xf96c62[_0xb627('0xf')][_0xb627('0x11')]);}else{logger[_0xb627('0x12')](_0xb627('0xb'),_0x4be3d9,_0xb627('0xc'));_0x10dda6(_0xf96c62[_0xb627('0x13')][_0xb627('0x11')]);}})[_0xb627('0x14')](function(_0x463aaa){logger['error'](_0xb627('0xb'),_0x4be3d9,_0x463aaa);_0x522359(_0x463aaa);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 14fca0c..285d047 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 _0xbe2d=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intServicenowAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put'];(function(_0xa8485e,_0x3a744a){var _0x2d9f20=function(_0x16d883){while(--_0x16d883){_0xa8485e['push'](_0xa8485e['shift']());}};_0x2d9f20(++_0x3a744a);}(_0xbe2d,0x17b));var _0xdbe2=function(_0x11c3d9,_0x20207a){_0x11c3d9=_0x11c3d9-0x0;var _0x68f66b=_0xbe2d[_0x11c3d9];return _0x68f66b;};'use strict';var multer=require(_0xdbe2('0x0'));var util=require('util');var path=require(_0xdbe2('0x1'));var timeout=require(_0xdbe2('0x2'));var express=require(_0xdbe2('0x3'));var router=express[_0xdbe2('0x4')]();var fs_extra=require(_0xdbe2('0x5'));var auth=require(_0xdbe2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdbe2('0x7'));router[_0xdbe2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xdbe2('0x9')](),controller[_0xdbe2('0xa')]);router[_0xdbe2('0x8')](_0xdbe2('0xb'),auth[_0xdbe2('0x9')](),controller[_0xdbe2('0xc')]);router[_0xdbe2('0x8')]('/:id/fields',auth[_0xdbe2('0x9')](),controller['getFields']);router[_0xdbe2('0xd')]('/',auth[_0xdbe2('0x9')](),controller[_0xdbe2('0xe')]);router[_0xdbe2('0xd')](_0xdbe2('0xb'),auth['isAuthenticated'](),controller[_0xdbe2('0xf')]);router[_0xdbe2('0x10')](_0xdbe2('0x11'),auth[_0xdbe2('0x9')](),controller[_0xdbe2('0x12')]);router[_0xdbe2('0x13')]('/:id',auth[_0xdbe2('0x9')](),controller[_0xdbe2('0x14')]);module[_0xdbe2('0x15')]=router; \ No newline at end of file +var _0x2043=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x1790ab,_0x59eff1){var _0x556669=function(_0x4c18a8){while(--_0x4c18a8){_0x1790ab['push'](_0x1790ab['shift']());}};_0x556669(++_0x59eff1);}(_0x2043,0x122));var _0x3204=function(_0x3a98f0,_0x185d41){_0x3a98f0=_0x3a98f0-0x0;var _0x296191=_0x2043[_0x3a98f0];return _0x296191;};'use strict';var multer=require(_0x3204('0x0'));var util=require(_0x3204('0x1'));var path=require(_0x3204('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3204('0x3')]();var fs_extra=require(_0x3204('0x4'));var auth=require(_0x3204('0x5'));var interaction=require(_0x3204('0x6'));var config=require(_0x3204('0x7'));var controller=require(_0x3204('0x8'));router[_0x3204('0x9')]('/',auth[_0x3204('0xa')](),controller[_0x3204('0xb')]);router[_0x3204('0x9')](_0x3204('0xc'),auth['isAuthenticated'](),controller[_0x3204('0xd')]);router['get'](_0x3204('0xe'),auth[_0x3204('0xa')](),controller[_0x3204('0xf')]);router[_0x3204('0x9')](_0x3204('0x10'),auth[_0x3204('0xa')](),controller[_0x3204('0x11')]);router[_0x3204('0x12')]('/',auth[_0x3204('0xa')](),controller[_0x3204('0x13')]);router[_0x3204('0x12')]('/:id/configurations',auth[_0x3204('0xa')](),controller[_0x3204('0x14')]);router[_0x3204('0x15')]('/:id',auth[_0x3204('0xa')](),controller[_0x3204('0x16')]);router[_0x3204('0x17')](_0x3204('0xc'),auth[_0x3204('0xa')](),controller['destroy']);module[_0x3204('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 3ffe44d..b400b5f 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 _0xd602=['STRING','username','remoteUri','sequelize'];(function(_0x450689,_0x3b857c){var _0x46ffb0=function(_0x5d3679){while(--_0x5d3679){_0x450689['push'](_0x450689['shift']());}};_0x46ffb0(++_0x3b857c);}(_0xd602,0xa7));var _0x2d60=function(_0x1ccfbb,_0x1e417a){_0x1ccfbb=_0x1ccfbb-0x0;var _0x2e7185=_0xd602[_0x1ccfbb];return _0x2e7185;};'use strict';var Sequelize=require(_0x2d60('0x0'));module['exports']={'name':{'type':Sequelize[_0x2d60('0x1')]},'description':{'type':Sequelize[_0x2d60('0x1')]},'username':{'type':Sequelize[_0x2d60('0x1')],'unique':_0x2d60('0x2')},'password':{'type':Sequelize[_0x2d60('0x1')]},'email':{'type':Sequelize[_0x2d60('0x1')]},'remoteUri':{'type':Sequelize[_0x2d60('0x1')],'unique':_0x2d60('0x3')},'serverUrl':{'type':Sequelize[_0x2d60('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xfe59=['exports','STRING','username','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe59,0x144));var _0x9fe5=function(_0x451f14,_0x4cb3d6){_0x451f14=_0x451f14-0x0;var _0x510cd4=_0xfe59[_0x451f14];return _0x510cd4;};'use strict';var Sequelize=require('sequelize');module[_0x9fe5('0x0')]={'name':{'type':Sequelize[_0x9fe5('0x1')]},'description':{'type':Sequelize[_0x9fe5('0x1')]},'username':{'type':Sequelize[_0x9fe5('0x1')],'unique':_0x9fe5('0x2')},'password':{'type':Sequelize[_0x9fe5('0x1')]},'email':{'type':Sequelize[_0x9fe5('0x1')]},'remoteUri':{'type':Sequelize[_0x9fe5('0x1')],'unique':_0x9fe5('0x3')},'serverUrl':{'type':Sequelize[_0x9fe5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a443140..e05e17a 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 _0x62e8=['include','findAll','catch','params','keys','includeAll','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','AccountId','channel','getDescriptions','ServicenowField','Subjects','getFields','hold_reason','knowledge','close_code','notify','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','remove','includes','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','test','statusCode','Wrong\x20credentials','boolean','true','False','false','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','ServicenowAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options'];(function(_0x239f52,_0x538b5e){var _0x4dc779=function(_0x18edb1){while(--_0x18edb1){_0x239f52['push'](_0x239f52['shift']());}};_0x4dc779(++_0x538b5e);}(_0x62e8,0x130));var _0x862e=function(_0x5cad22,_0x49e589){_0x5cad22=_0x5cad22-0x0;var _0x59eb55=_0x62e8[_0x5cad22];return _0x59eb55;};'use strict';var emlformat=require(_0x862e('0x0'));var rimraf=require(_0x862e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x862e('0x2'));var rp=require(_0x862e('0x3'));var moment=require(_0x862e('0x4'));var BPromise=require(_0x862e('0x5'));var Mustache=require(_0x862e('0x6'));var util=require(_0x862e('0x7'));var path=require(_0x862e('0x8'));var sox=require(_0x862e('0x9'));var csv=require('to-csv');var ejs=require(_0x862e('0xa'));var fs=require('fs');var fs_extra=require(_0x862e('0xb'));var _=require(_0x862e('0xc'));var squel=require('squel');var crypto=require(_0x862e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x862e('0xe'));var Papa=require('papaparse');var Redis=require(_0x862e('0xf'));var authService=require(_0x862e('0x10'));var qs=require(_0x862e('0x11'));var as=require(_0x862e('0x12'));var hardwareService=require(_0x862e('0x13'));var logger=require('../../config/logger')(_0x862e('0x14'));var utils=require(_0x862e('0x15'));var config=require(_0x862e('0x16'));var licenseUtil=require(_0x862e('0x17'));var db=require(_0x862e('0x18'))['db'];var integrations=require(_0x862e('0x19'));function respondWithStatusCode(_0x7a2c4a,_0x412b41){_0x412b41=_0x412b41||0xcc;return function(_0x14f72e){if(_0x14f72e){return _0x7a2c4a[_0x862e('0x1a')](_0x412b41);}return _0x7a2c4a[_0x862e('0x1b')](_0x412b41)[_0x862e('0x1c')]();};}function respondWithResult(_0x4f3a29,_0x43e8e9){_0x43e8e9=_0x43e8e9||0xc8;return function(_0x24e64f){if(_0x24e64f){return _0x4f3a29[_0x862e('0x1b')](_0x43e8e9)['json'](_0x24e64f);}};}function respondWithFilteredResult(_0x3bf3b0,_0x5c5ffd){return function(_0x292ea1){if(_0x292ea1){var _0x241073=typeof _0x5c5ffd[_0x862e('0x1d')]===_0x862e('0x1e')&&typeof _0x5c5ffd['limit']===_0x862e('0x1e');var _0x526601=_0x292ea1[_0x862e('0x1f')];var _0x24279a=_0x241073?0x0:_0x5c5ffd[_0x862e('0x1d')];var _0x24a1f8=_0x241073?_0x292ea1[_0x862e('0x1f')]:_0x5c5ffd['offset']+_0x5c5ffd[_0x862e('0x20')];var _0x216eda;if(_0x24a1f8>=_0x526601){_0x24a1f8=_0x526601;_0x216eda=0xc8;}else{_0x216eda=0xce;}_0x3bf3b0['status'](_0x216eda);return _0x3bf3b0[_0x862e('0x21')](_0x862e('0x22'),_0x24279a+'-'+_0x24a1f8+'/'+_0x526601)[_0x862e('0x23')](_0x292ea1);}return null;};}function patchUpdates(_0x3c22fa){return function(_0x277c44){try{jsonpatch[_0x862e('0x24')](_0x277c44,_0x3c22fa,!![]);}catch(_0x460e15){return BPromise[_0x862e('0x25')](_0x460e15);}return _0x277c44[_0x862e('0x26')]();};}function saveUpdates(_0x39589b,_0x120a46){return function(_0xa09572){if(_0xa09572){return _0xa09572[_0x862e('0x27')](_0x39589b)[_0x862e('0x28')](function(_0x654439){return _0x654439;});}return null;};}function removeEntity(_0x30b2ca,_0x5a69ae){return function(_0x131db0){if(_0x131db0){return _0x131db0['destroy']()[_0x862e('0x28')](function(){_0x30b2ca['status'](0xcc)[_0x862e('0x1c')]();});}};}function handleEntityNotFound(_0x1309ad,_0x179d6c){return function(_0x1ab7f0){if(!_0x1ab7f0){_0x1309ad['sendStatus'](0x194);}return _0x1ab7f0;};}function handleError(_0x8ab059,_0x3a9e0a){_0x3a9e0a=_0x3a9e0a||0x1f4;return function(_0x302d58){logger[_0x862e('0x29')](_0x302d58[_0x862e('0x2a')]);if(_0x302d58['name']){delete _0x302d58[_0x862e('0x2b')];}_0x8ab059[_0x862e('0x1b')](_0x3a9e0a)[_0x862e('0x2c')](_0x302d58);};}exports['index']=function(_0x2a9af2,_0x414c66){var _0xa074b8={},_0x3f06fc={},_0x2f14ad={'count':0x0,'rows':[]};var _0xc91fbb=_[_0x862e('0x2d')](db[_0x862e('0x2e')][_0x862e('0x2f')],function(_0x56f95a){return{'name':_0x56f95a['fieldName'],'type':_0x56f95a[_0x862e('0x30')]['key']};});_0x3f06fc[_0x862e('0x31')]=_[_0x862e('0x2d')](_0xc91fbb,_0x862e('0x2b'));_0x3f06fc[_0x862e('0x32')]=_['keys'](_0x2a9af2['query']);_0x3f06fc[_0x862e('0x33')]=_[_0x862e('0x34')](_0x3f06fc['model'],_0x3f06fc[_0x862e('0x32')]);_0xa074b8[_0x862e('0x35')]=_[_0x862e('0x34')](_0x3f06fc['model'],qs[_0x862e('0x36')](_0x2a9af2[_0x862e('0x32')][_0x862e('0x36')]));_0xa074b8[_0x862e('0x35')]=_0xa074b8[_0x862e('0x35')][_0x862e('0x37')]?_0xa074b8[_0x862e('0x35')]:_0x3f06fc[_0x862e('0x31')];if(!_0x2a9af2[_0x862e('0x32')]['hasOwnProperty'](_0x862e('0x38'))){_0xa074b8['limit']=qs[_0x862e('0x20')](_0x2a9af2[_0x862e('0x32')][_0x862e('0x20')]);_0xa074b8['offset']=qs['offset'](_0x2a9af2['query'][_0x862e('0x1d')]);}_0xa074b8[_0x862e('0x39')]=qs[_0x862e('0x3a')](_0x2a9af2['query'][_0x862e('0x3a')]);_0xa074b8[_0x862e('0x3b')]=qs['filters'](_['pick'](_0x2a9af2['query'],_0x3f06fc[_0x862e('0x33')]),_0xc91fbb);if(_0x2a9af2[_0x862e('0x32')][_0x862e('0x3c')]){_0xa074b8['where']=_['merge'](_0xa074b8[_0x862e('0x3b')],{'$or':_[_0x862e('0x2d')](_0xc91fbb,function(_0x1f7b56){if(_0x1f7b56['type']!==_0x862e('0x3d')){var _0x1b4193={};_0x1b4193[_0x1f7b56[_0x862e('0x2b')]]={'$like':'%'+_0x2a9af2[_0x862e('0x32')]['filter']+'%'};return _0x1b4193;}})});}_0xa074b8=_[_0x862e('0x3e')]({},_0xa074b8,_0x2a9af2[_0x862e('0x3f')]);var _0x260d9f={'where':_0xa074b8[_0x862e('0x3b')]};return db[_0x862e('0x2e')][_0x862e('0x1f')](_0x260d9f)[_0x862e('0x28')](function(_0x54e1f3){_0x2f14ad['count']=_0x54e1f3;if(_0x2a9af2[_0x862e('0x32')]['includeAll']){_0xa074b8[_0x862e('0x40')]=[{'all':!![]}];}return db[_0x862e('0x2e')][_0x862e('0x41')](_0xa074b8);})[_0x862e('0x28')](function(_0x3b98d2){_0x2f14ad['rows']=_0x3b98d2;return _0x2f14ad;})[_0x862e('0x28')](respondWithFilteredResult(_0x414c66,_0xa074b8))[_0x862e('0x42')](handleError(_0x414c66,null));};exports['show']=function(_0x98d85b,_0x39fc2b){var _0x33514a={'raw':![],'where':{'id':_0x98d85b[_0x862e('0x43')]['id']}},_0x237dff={};_0x237dff[_0x862e('0x31')]=_[_0x862e('0x44')](db[_0x862e('0x2e')][_0x862e('0x2f')]);_0x237dff[_0x862e('0x32')]=_['keys'](_0x98d85b[_0x862e('0x32')]);_0x237dff[_0x862e('0x33')]=_[_0x862e('0x34')](_0x237dff[_0x862e('0x31')],_0x237dff[_0x862e('0x32')]);_0x33514a['attributes']=_[_0x862e('0x34')](_0x237dff['model'],qs[_0x862e('0x36')](_0x98d85b[_0x862e('0x32')][_0x862e('0x36')]));_0x33514a[_0x862e('0x35')]=_0x33514a['attributes'][_0x862e('0x37')]?_0x33514a[_0x862e('0x35')]:_0x237dff[_0x862e('0x31')];if(_0x98d85b[_0x862e('0x32')][_0x862e('0x45')]){_0x33514a['include']=[{'all':!![]}];}_0x33514a=_['merge']({},_0x33514a,_0x98d85b[_0x862e('0x3f')]);return db[_0x862e('0x2e')][_0x862e('0x46')](_0x33514a)[_0x862e('0x28')](handleEntityNotFound(_0x39fc2b,null))[_0x862e('0x28')](respondWithResult(_0x39fc2b,null))[_0x862e('0x42')](handleError(_0x39fc2b,null));};exports['create']=function(_0x57a1b7,_0x1109db){return db[_0x862e('0x2e')][_0x862e('0x47')](_0x57a1b7[_0x862e('0x48')],{})[_0x862e('0x28')](respondWithResult(_0x1109db,0xc9))[_0x862e('0x42')](handleError(_0x1109db,null));};exports[_0x862e('0x27')]=function(_0x2ec3f2,_0xfba176){if(_0x2ec3f2['body']['id']){delete _0x2ec3f2[_0x862e('0x48')]['id'];}return db[_0x862e('0x2e')]['find']({'where':{'id':_0x2ec3f2[_0x862e('0x43')]['id']}})[_0x862e('0x28')](handleEntityNotFound(_0xfba176,null))[_0x862e('0x28')](saveUpdates(_0x2ec3f2['body'],null))[_0x862e('0x28')](respondWithResult(_0xfba176,null))['catch'](handleError(_0xfba176,null));};exports[_0x862e('0x49')]=function(_0x99f7be,_0x1e8c6f){return db['ServicenowAccount'][_0x862e('0x46')]({'where':{'id':_0x99f7be[_0x862e('0x43')]['id']}})[_0x862e('0x28')](handleEntityNotFound(_0x1e8c6f,null))[_0x862e('0x28')](removeEntity(_0x1e8c6f,null))[_0x862e('0x42')](handleError(_0x1e8c6f,null));};exports[_0x862e('0x4a')]=function(_0x226f94,_0x4b992f,_0x4b94aa){var _0x47001b={};var _0x42bda2={};var _0x2650bd;var _0x3faeb0;return db['ServicenowAccount'][_0x862e('0x4b')]({'where':{'id':_0x226f94[_0x862e('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b992f,null))[_0x862e('0x28')](function(_0x278da6){if(_0x278da6){_0x2650bd=_0x278da6;_0x42bda2[_0x862e('0x31')]=_[_0x862e('0x44')](db[_0x862e('0x4c')][_0x862e('0x2f')]);_0x42bda2[_0x862e('0x32')]=_[_0x862e('0x44')](_0x226f94[_0x862e('0x32')]);_0x42bda2[_0x862e('0x33')]=_[_0x862e('0x34')](_0x42bda2[_0x862e('0x31')],_0x42bda2[_0x862e('0x32')]);_0x47001b[_0x862e('0x35')]=_[_0x862e('0x34')](_0x42bda2[_0x862e('0x31')],qs[_0x862e('0x36')](_0x226f94[_0x862e('0x32')][_0x862e('0x36')]));_0x47001b[_0x862e('0x35')]=_0x47001b[_0x862e('0x35')]['length']?_0x47001b['attributes']:_0x42bda2['model'];_0x47001b['order']=qs[_0x862e('0x3a')](_0x226f94[_0x862e('0x32')][_0x862e('0x3a')]);_0x47001b[_0x862e('0x3b')]=qs['filters'](_[_0x862e('0x4d')](_0x226f94[_0x862e('0x32')],_0x42bda2[_0x862e('0x33')]));if(_0x226f94[_0x862e('0x32')][_0x862e('0x3c')]){_0x47001b[_0x862e('0x3b')]=_[_0x862e('0x3e')](_0x47001b['where'],{'$or':_['map'](_0x47001b['attributes'],function(_0x31b3b3){var _0x1f0c1b={};_0x1f0c1b[_0x31b3b3]={'$like':'%'+_0x226f94[_0x862e('0x32')][_0x862e('0x3c')]+'%'};return _0x1f0c1b;})});}_0x47001b=_['merge']({},_0x47001b,_0x226f94['options']);return _0x2650bd[_0x862e('0x4a')](_0x47001b);}})['then'](function(_0x15e330){if(_0x15e330){_0x3faeb0=_0x15e330[_0x862e('0x37')];if(!_0x226f94[_0x862e('0x32')][_0x862e('0x4e')](_0x862e('0x38'))){_0x47001b[_0x862e('0x20')]=qs[_0x862e('0x20')](_0x226f94['query']['limit']);_0x47001b[_0x862e('0x1d')]=qs[_0x862e('0x1d')](_0x226f94[_0x862e('0x32')][_0x862e('0x1d')]);}return _0x2650bd[_0x862e('0x4a')](_0x47001b);}})['then'](function(_0x4f6098){if(_0x4f6098){return _0x4f6098?{'count':_0x3faeb0,'rows':_0x4f6098}:null;}})[_0x862e('0x28')](respondWithResult(_0x4b992f,null))[_0x862e('0x42')](handleError(_0x4b992f,null));};exports['addConfiguration']=function(_0x1039de,_0x355976,_0x770ae2){if(_0x1039de[_0x862e('0x48')]['id']){delete _0x1039de[_0x862e('0x48')]['id'];}return db[_0x862e('0x2e')]['findOne']({'where':{'id':_0x1039de[_0x862e('0x43')]['id']}})['then'](handleEntityNotFound(_0x355976,null))[_0x862e('0x28')](function(_0x442ddf){if(_0x442ddf){_0x1039de[_0x862e('0x48')][_0x862e('0x4f')]=_0x442ddf['id'];_0x1039de['body']['Subjects']=integrations['getSubjects'](_0x1039de[_0x862e('0x48')][_0x862e('0x50')],_0x1039de['body'][_0x862e('0x30')]);_0x1039de[_0x862e('0x48')]['Descriptions']=integrations[_0x862e('0x51')](_0x1039de['body'][_0x862e('0x50')],_0x1039de[_0x862e('0x48')][_0x862e('0x30')]);return db['ServicenowConfiguration']['create'](_0x1039de[_0x862e('0x48')],{'include':[{'model':db[_0x862e('0x52')],'as':_0x862e('0x53')},{'model':db[_0x862e('0x52')],'as':'Descriptions'}]});}return null;})[_0x862e('0x28')](respondWithResult(_0x355976,null))[_0x862e('0x42')](handleError(_0x355976,null));};exports[_0x862e('0x54')]=function(_0x22f99f,_0x57ed6a,_0xf321f){var _0x418d54=['made_sla',_0x862e('0x55'),_0x862e('0x56'),'subcategory',_0x862e('0x57'),_0x862e('0x58'),'incident_state','severity',_0x862e('0x59')];var _0x4aaf2b=[_0x862e('0x5a'),_0x862e('0x5b'),_0x862e('0x5c'),_0x862e('0x5d'),_0x862e('0x5e'),_0x862e('0x5f'),_0x862e('0x60'),_0x862e('0x55'),_0x862e('0x61'),_0x862e('0x62'),'resolved_by',_0x862e('0x63'),_0x862e('0x64'),_0x862e('0x65'),_0x862e('0x66'),_0x862e('0x67'),_0x862e('0x68'),_0x862e('0x69'),_0x862e('0x56'),_0x862e('0x39'),_0x862e('0x6a'),_0x862e('0x6b'),_0x862e('0x6c'),_0x862e('0x6d'),_0x862e('0x6e'),_0x862e('0x6f'),_0x862e('0x70'),'business_service','priority',_0x862e('0x71'),_0x862e('0x72'),_0x862e('0x73'),_0x862e('0x74'),_0x862e('0x75'),'business_duration',_0x862e('0x76'),_0x862e('0x77'),_0x862e('0x78'),_0x862e('0x79'),_0x862e('0x7a'),'approval_set','subcategory',_0x862e('0x7b'),_0x862e('0x7c'),_0x862e('0x57'),_0x862e('0x7d'),_0x862e('0x7e'),_0x862e('0x7f'),_0x862e('0x80'),'business_stc','additional_assignee_list','description',_0x862e('0x81'),_0x862e('0x58'),_0x862e('0x82'),_0x862e('0x83'),_0x862e('0x84'),_0x862e('0x85'),_0x862e('0x86'),_0x862e('0x87'),_0x862e('0x88'),_0x862e('0x89'),_0x862e('0x8a'),_0x862e('0x8b'),_0x862e('0x8c'),_0x862e('0x8d'),_0x862e('0x8e'),'activity_due',_0x862e('0x8f'),'severity','comments',_0x862e('0x90'),_0x862e('0x91'),_0x862e('0x92'),_0x862e('0x93'),_0x862e('0x94'),'reopen_count',_0x862e('0x95'),_0x862e('0x96'),_0x862e('0x97'),_0x862e('0x98'),_0x862e('0x99'),_0x862e('0x59')];var _0x172120='';var _0xaea3a='';var _0x59e0b3=[];var _0x2b98d2='';var _0x1c224c='';var _0x2a1889=[];var _0x2dba8b='';var _0x332055='';var _0x2f18f9={};var _0x389778='';return db[_0x862e('0x2e')][_0x862e('0x4b')]({'where':{'id':_0x22f99f[_0x862e('0x43')]['id']},'attributes':['id',_0x862e('0x9a'),'password',_0x862e('0x9b'),_0x862e('0x9c'),_0x862e('0x9d')]})[_0x862e('0x28')](handleEntityNotFound(_0x57ed6a,null))[_0x862e('0x28')](function(_0x236ab6){if(_0x236ab6){_0x389778=_0x236ab6[_0x862e('0x9c')];var _0x10ed8b=_0x389778['slice'](-0x1);if(_0x10ed8b==='/'){_0x389778=_0x389778['substring'](0x0,_0x389778['lastIndexOf'](_0x10ed8b));}_0x332055=util['format'](_0x862e('0x9e'),_0x389778);_0x2dba8b=util[_0x862e('0x9f')](_0x862e('0xa0'),_0x389778);_0x2f18f9={'user':_0x236ab6[_0x862e('0x9a')],'pass':_0x236ab6['password']};var _0x2af1c6={'method':_0x862e('0xa1'),'uri':_0x332055+'incident?sysparm_display_value=all','auth':_0x2f18f9,'json':!![]};return rp(_0x2af1c6);}})[_0x862e('0x28')](function(_0x17fb9a){if(_0x17fb9a[_0x862e('0xa2')][_0x862e('0x37')]>0x0){_0x172120=_0x17fb9a[_0x862e('0xa2')];}console[_0x862e('0xa3')](_0x862e('0xa4'),_0x172120);_0x2a1889=[];_0xaea3a=Object['assign']([],_0x172120);_[_0x862e('0xa5')](_0xaea3a,function(_0x26037e){return!_0x418d54[_0x862e('0xa6')](_0x26037e[_0x862e('0x2b')]);});_0xaea3a['forEach'](function(_0x29082d){var _0x447f9b=createFieldObject(_0x2dba8b,_0x2f18f9,_0x29082d[_0x862e('0xa7')],_0x29082d[_0x862e('0x2b')],_0x29082d[_0x862e('0xa8')],![]);_0x2a1889[_0x862e('0xa9')](_0x447f9b);});return Promise[_0x862e('0xaa')](_0x2a1889);})[_0x862e('0x28')](function(_0x1ae2ac){_0x59e0b3=_0x1ae2ac;_0x2b98d2=Object['assign']([],_0x172120);console['log'](_0x862e('0xab'),_0x172120);_[_0x862e('0xa5')](_0x2b98d2,function(_0x6d497d){return _0x4aaf2b[_0x862e('0xa6')](_0x6d497d[_0x862e('0x2b')]);});console[_0x862e('0xa3')](_0x862e('0xac'),_0x2b98d2);_0x2a1889=[];_0x2b98d2[_0x862e('0xad')](function(_0x4242c4){var _0xb9cf41=createFieldObject(_0x2dba8b,_0x2f18f9,_0x4242c4[_0x862e('0xa7')],_0x4242c4[_0x862e('0x2b')],_0x4242c4[_0x862e('0xa8')],!![]);_0x2a1889[_0x862e('0xa9')](_0xb9cf41);});return Promise[_0x862e('0xaa')](_0x2a1889);})[_0x862e('0x28')](function(_0x184086){_0x1c224c=_0x184086;var _0x63b9f=_0x59e0b3[_0x862e('0xae')](_0x1c224c);return{'count':_0x63b9f[_0x862e('0x37')],'rows':_0x63b9f};})[_0x862e('0x28')](respondWithResult(_0x57ed6a,null))[_0x862e('0x42')](function(_0x2b8e5a){console['log']('ServiceNow\x20error:\x20'+_0x2b8e5a);var _0x4ab5e6=_0x22f99f['query'][_0x862e('0xaf')]?0x1f4:_0x2b8e5a[_0x862e('0xb0')]||0x1f4;logger[_0x862e('0x29')](_0x2b8e5a['stack']);delete _0x2b8e5a['name'];if(_0x4ab5e6===0x191){_0x4ab5e6=0x190;}_0x57ed6a['status'](_0x4ab5e6)[_0x862e('0x2c')](_0x22f99f['query']['test']?{'message':_0x862e('0xb1'),'statusCode':_0x2b8e5a['statusCode']}:_0x2b8e5a);});};function createFieldObject(_0x2c68c1,_0x9e3665,_0x4a262a,_0x5c490b,_0x4f13c7,_0x3b93f6){return new Promise(function(_0x63dcc3,_0x2b0627){var _0x587f7b={'id':_0x5c490b,'name':_0x4f13c7,'custom':_0x3b93f6};if(_0x4a262a===_0x862e('0xb2')){_0x587f7b[_0x862e('0x3f')]=[{'name':'True','value':_0x862e('0xb3')},{'name':_0x862e('0xb4'),'value':_0x862e('0xb5')}];_0x63dcc3(_0x587f7b);}else{var _0x733293={'method':_0x862e('0xa1'),'uri':_0x2c68c1+'sys_choice?sysparm_query=name=incident^element='+_0x5c490b,'auth':_0x9e3665,'json':!![]};return rp(_0x733293)['then'](function(_0x23faca){var _0x3b7e18=[];if(_0x23faca[_0x862e('0xa2')][_0x862e('0x37')]>0x0){_0x23faca[_0x862e('0xa2')][_0x862e('0xad')](function(_0x396f8a){if(_0x396f8a[_0x862e('0xb6')]===_0x862e('0xb5')){var _0x1002c3={'name':_0x396f8a[_0x862e('0xa8')],'value':_0x396f8a[_0x862e('0xb7')]};_0x3b7e18[_0x862e('0xa9')](_0x1002c3);}});}_0x587f7b[_0x862e('0x3f')]=_0x3b7e18;if(_0x587f7b[_0x862e('0x3f')]['length']>0x0){_0x63dcc3(_0x587f7b);}else{if(_0x3b93f6==![]){_0x63dcc3();}else{_0x63dcc3(_0x587f7b);}}});}});} \ No newline at end of file +var _0x20e6=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','map','keys','filters','intersection','attributes','model','fields','length','query','hasOwnProperty','order','sort','where','pick','filter','merge','ServicenowAccount','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','hold_reason','subcategory','close_code','notify','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','active','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','escalation','upon_approval','correlation_id','location','username','password','email','serverUrl','slice','substring','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','log','push','all','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','zip-dir'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x20e6,0x169));var _0x620e=function(_0x334bf4,_0x530067){_0x334bf4=_0x334bf4-0x0;var _0x37de01=_0x20e6[_0x334bf4];return _0x37de01;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x620e('0x0'));var jsonpatch=require(_0x620e('0x1'));var rp=require(_0x620e('0x2'));var moment=require(_0x620e('0x3'));var BPromise=require(_0x620e('0x4'));var Mustache=require(_0x620e('0x5'));var util=require(_0x620e('0x6'));var path=require(_0x620e('0x7'));var sox=require(_0x620e('0x8'));var csv=require('to-csv');var ejs=require(_0x620e('0x9'));var fs=require('fs');var fs_extra=require(_0x620e('0xa'));var _=require(_0x620e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x620e('0xc'));var deskjs=require(_0x620e('0xd'));var toCsv=require(_0x620e('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x620e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x620e('0x10'));var hardwareService=require(_0x620e('0x11'));var logger=require(_0x620e('0x12'))(_0x620e('0x13'));var utils=require(_0x620e('0x14'));var config=require(_0x620e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x620e('0x16'))['db'];var integrations=require(_0x620e('0x17'));function respondWithStatusCode(_0x2edf15,_0x55d1ac){_0x55d1ac=_0x55d1ac||0xcc;return function(_0x18e6d8){if(_0x18e6d8){return _0x2edf15[_0x620e('0x18')](_0x55d1ac);}return _0x2edf15[_0x620e('0x19')](_0x55d1ac)['end']();};}function respondWithResult(_0x1bb783,_0x3c09c6){_0x3c09c6=_0x3c09c6||0xc8;return function(_0x22c759){if(_0x22c759){return _0x1bb783['status'](_0x3c09c6)['json'](_0x22c759);}};}function respondWithFilteredResult(_0x1dffdf,_0x1ddcb1){return function(_0x14d5bc){if(_0x14d5bc){var _0x456a4d=typeof _0x1ddcb1[_0x620e('0x1a')]===_0x620e('0x1b')&&typeof _0x1ddcb1[_0x620e('0x1c')]===_0x620e('0x1b');var _0x4bc892=_0x14d5bc[_0x620e('0x1d')];var _0xdbfa89=_0x456a4d?0x0:_0x1ddcb1[_0x620e('0x1a')];var _0x5d5e0b=_0x456a4d?_0x14d5bc[_0x620e('0x1d')]:_0x1ddcb1['offset']+_0x1ddcb1[_0x620e('0x1c')];var _0xc4c5f9;if(_0x5d5e0b>=_0x4bc892){_0x5d5e0b=_0x4bc892;_0xc4c5f9=0xc8;}else{_0xc4c5f9=0xce;}_0x1dffdf[_0x620e('0x19')](_0xc4c5f9);return _0x1dffdf[_0x620e('0x1e')](_0x620e('0x1f'),_0xdbfa89+'-'+_0x5d5e0b+'/'+_0x4bc892)[_0x620e('0x20')](_0x14d5bc);}return null;};}function patchUpdates(_0x313e0a){return function(_0x5e1693){try{jsonpatch['apply'](_0x5e1693,_0x313e0a,!![]);}catch(_0x5bcbfd){return BPromise['reject'](_0x5bcbfd);}return _0x5e1693[_0x620e('0x21')]();};}function saveUpdates(_0x30c4cc,_0xc7bc9b){return function(_0x2ed58e){if(_0x2ed58e){return _0x2ed58e[_0x620e('0x22')](_0x30c4cc)[_0x620e('0x23')](function(_0x10465a){return _0x10465a;});}return null;};}function removeEntity(_0x521c46,_0x3eafaa){return function(_0x1b0b35){if(_0x1b0b35){return _0x1b0b35[_0x620e('0x24')]()[_0x620e('0x23')](function(){_0x521c46[_0x620e('0x19')](0xcc)[_0x620e('0x25')]();});}};}function handleEntityNotFound(_0x28223f,_0x5ebc88){return function(_0x18b044){if(!_0x18b044){_0x28223f[_0x620e('0x18')](0x194);}return _0x18b044;};}function handleError(_0x3efec7,_0x554fdc){_0x554fdc=_0x554fdc||0x1f4;return function(_0x4bafb2){logger[_0x620e('0x26')](_0x4bafb2[_0x620e('0x27')]);if(_0x4bafb2[_0x620e('0x28')]){delete _0x4bafb2[_0x620e('0x28')];}_0x3efec7[_0x620e('0x19')](_0x554fdc)[_0x620e('0x29')](_0x4bafb2);};}exports[_0x620e('0x2a')]=function(_0xae358f,_0x368e5a){var _0x361cdb={},_0x48ef98={},_0x30cf9d={'count':0x0,'rows':[]};var _0x46ae87=_['map'](db['ServicenowAccount'][_0x620e('0x2b')],function(_0x1fcfb5){return{'name':_0x1fcfb5[_0x620e('0x2c')],'type':_0x1fcfb5['type']['key']};});_0x48ef98['model']=_[_0x620e('0x2d')](_0x46ae87,_0x620e('0x28'));_0x48ef98['query']=_[_0x620e('0x2e')](_0xae358f['query']);_0x48ef98[_0x620e('0x2f')]=_[_0x620e('0x30')](_0x48ef98['model'],_0x48ef98['query']);_0x361cdb[_0x620e('0x31')]=_[_0x620e('0x30')](_0x48ef98[_0x620e('0x32')],qs['fields'](_0xae358f['query'][_0x620e('0x33')]));_0x361cdb['attributes']=_0x361cdb[_0x620e('0x31')][_0x620e('0x34')]?_0x361cdb['attributes']:_0x48ef98['model'];if(!_0xae358f[_0x620e('0x35')][_0x620e('0x36')]('nolimit')){_0x361cdb[_0x620e('0x1c')]=qs[_0x620e('0x1c')](_0xae358f[_0x620e('0x35')][_0x620e('0x1c')]);_0x361cdb[_0x620e('0x1a')]=qs['offset'](_0xae358f[_0x620e('0x35')][_0x620e('0x1a')]);}_0x361cdb[_0x620e('0x37')]=qs[_0x620e('0x38')](_0xae358f[_0x620e('0x35')]['sort']);_0x361cdb[_0x620e('0x39')]=qs[_0x620e('0x2f')](_[_0x620e('0x3a')](_0xae358f[_0x620e('0x35')],_0x48ef98[_0x620e('0x2f')]),_0x46ae87);if(_0xae358f[_0x620e('0x35')][_0x620e('0x3b')]){_0x361cdb[_0x620e('0x39')]=_['merge'](_0x361cdb[_0x620e('0x39')],{'$or':_[_0x620e('0x2d')](_0x46ae87,function(_0x3a5fbe){if(_0x3a5fbe['type']!=='VIRTUAL'){var _0x38a8f1={};_0x38a8f1[_0x3a5fbe[_0x620e('0x28')]]={'$like':'%'+_0xae358f['query']['filter']+'%'};return _0x38a8f1;}})});}_0x361cdb=_[_0x620e('0x3c')]({},_0x361cdb,_0xae358f['options']);var _0x2fc3f0={'where':_0x361cdb[_0x620e('0x39')]};return db[_0x620e('0x3d')][_0x620e('0x1d')](_0x2fc3f0)[_0x620e('0x23')](function(_0x3aae12){_0x30cf9d['count']=_0x3aae12;if(_0xae358f[_0x620e('0x35')]['includeAll']){_0x361cdb[_0x620e('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x620e('0x3f')](_0x361cdb);})[_0x620e('0x23')](function(_0x3b8863){_0x30cf9d[_0x620e('0x40')]=_0x3b8863;return _0x30cf9d;})['then'](respondWithFilteredResult(_0x368e5a,_0x361cdb))[_0x620e('0x41')](handleError(_0x368e5a,null));};exports[_0x620e('0x42')]=function(_0x14dc30,_0x504c0b){var _0x2cc5fb={'raw':![],'where':{'id':_0x14dc30['params']['id']}},_0x4c361b={};_0x4c361b[_0x620e('0x32')]=_['keys'](db['ServicenowAccount'][_0x620e('0x2b')]);_0x4c361b[_0x620e('0x35')]=_[_0x620e('0x2e')](_0x14dc30[_0x620e('0x35')]);_0x4c361b[_0x620e('0x2f')]=_['intersection'](_0x4c361b[_0x620e('0x32')],_0x4c361b[_0x620e('0x35')]);_0x2cc5fb[_0x620e('0x31')]=_[_0x620e('0x30')](_0x4c361b['model'],qs[_0x620e('0x33')](_0x14dc30['query'][_0x620e('0x33')]));_0x2cc5fb[_0x620e('0x31')]=_0x2cc5fb[_0x620e('0x31')]['length']?_0x2cc5fb[_0x620e('0x31')]:_0x4c361b[_0x620e('0x32')];if(_0x14dc30[_0x620e('0x35')][_0x620e('0x43')]){_0x2cc5fb[_0x620e('0x3e')]=[{'all':!![]}];}_0x2cc5fb=_[_0x620e('0x3c')]({},_0x2cc5fb,_0x14dc30[_0x620e('0x44')]);return db[_0x620e('0x3d')][_0x620e('0x45')](_0x2cc5fb)[_0x620e('0x23')](handleEntityNotFound(_0x504c0b,null))[_0x620e('0x23')](respondWithResult(_0x504c0b,null))[_0x620e('0x41')](handleError(_0x504c0b,null));};exports[_0x620e('0x46')]=function(_0x393e14,_0x350f37){return db[_0x620e('0x3d')][_0x620e('0x46')](_0x393e14['body'],{})[_0x620e('0x23')](respondWithResult(_0x350f37,0xc9))['catch'](handleError(_0x350f37,null));};exports['update']=function(_0x51aac8,_0x2bbce7){if(_0x51aac8[_0x620e('0x47')]['id']){delete _0x51aac8['body']['id'];}return db[_0x620e('0x3d')][_0x620e('0x45')]({'where':{'id':_0x51aac8[_0x620e('0x48')]['id']}})[_0x620e('0x23')](handleEntityNotFound(_0x2bbce7,null))[_0x620e('0x23')](saveUpdates(_0x51aac8['body'],null))[_0x620e('0x23')](respondWithResult(_0x2bbce7,null))[_0x620e('0x41')](handleError(_0x2bbce7,null));};exports[_0x620e('0x24')]=function(_0x2ea253,_0x410163){return db[_0x620e('0x3d')][_0x620e('0x45')]({'where':{'id':_0x2ea253['params']['id']}})['then'](handleEntityNotFound(_0x410163,null))['then'](removeEntity(_0x410163,null))[_0x620e('0x41')](handleError(_0x410163,null));};exports[_0x620e('0x49')]=function(_0x299472,_0x228cc1,_0x4cd626){var _0x26e758={};var _0x32da9b={};var _0x4c1022;var _0x3faf99;return db[_0x620e('0x3d')][_0x620e('0x4a')]({'where':{'id':_0x299472['params']['id']}})[_0x620e('0x23')](handleEntityNotFound(_0x228cc1,null))['then'](function(_0x12e5a7){if(_0x12e5a7){_0x4c1022=_0x12e5a7;_0x32da9b[_0x620e('0x32')]=_[_0x620e('0x2e')](db['ServicenowConfiguration'][_0x620e('0x2b')]);_0x32da9b[_0x620e('0x35')]=_[_0x620e('0x2e')](_0x299472['query']);_0x32da9b['filters']=_[_0x620e('0x30')](_0x32da9b[_0x620e('0x32')],_0x32da9b[_0x620e('0x35')]);_0x26e758[_0x620e('0x31')]=_[_0x620e('0x30')](_0x32da9b[_0x620e('0x32')],qs[_0x620e('0x33')](_0x299472[_0x620e('0x35')][_0x620e('0x33')]));_0x26e758[_0x620e('0x31')]=_0x26e758[_0x620e('0x31')][_0x620e('0x34')]?_0x26e758[_0x620e('0x31')]:_0x32da9b[_0x620e('0x32')];_0x26e758[_0x620e('0x37')]=qs[_0x620e('0x38')](_0x299472[_0x620e('0x35')][_0x620e('0x38')]);_0x26e758[_0x620e('0x39')]=qs['filters'](_[_0x620e('0x3a')](_0x299472[_0x620e('0x35')],_0x32da9b[_0x620e('0x2f')]));if(_0x299472['query'][_0x620e('0x3b')]){_0x26e758[_0x620e('0x39')]=_[_0x620e('0x3c')](_0x26e758['where'],{'$or':_['map'](_0x26e758[_0x620e('0x31')],function(_0x4862f4){var _0x1812a4={};_0x1812a4[_0x4862f4]={'$like':'%'+_0x299472[_0x620e('0x35')]['filter']+'%'};return _0x1812a4;})});}_0x26e758=_['merge']({},_0x26e758,_0x299472[_0x620e('0x44')]);return _0x4c1022[_0x620e('0x49')](_0x26e758);}})[_0x620e('0x23')](function(_0x35c389){if(_0x35c389){_0x3faf99=_0x35c389['length'];if(!_0x299472[_0x620e('0x35')][_0x620e('0x36')](_0x620e('0x4b'))){_0x26e758[_0x620e('0x1c')]=qs[_0x620e('0x1c')](_0x299472[_0x620e('0x35')][_0x620e('0x1c')]);_0x26e758[_0x620e('0x1a')]=qs['offset'](_0x299472[_0x620e('0x35')][_0x620e('0x1a')]);}return _0x4c1022['getConfigurations'](_0x26e758);}})[_0x620e('0x23')](function(_0x167581){if(_0x167581){return _0x167581?{'count':_0x3faf99,'rows':_0x167581}:null;}})[_0x620e('0x23')](respondWithResult(_0x228cc1,null))[_0x620e('0x41')](handleError(_0x228cc1,null));};exports[_0x620e('0x4c')]=function(_0x1d0b9d,_0x3aba13,_0xd0cf33){if(_0x1d0b9d[_0x620e('0x47')]['id']){delete _0x1d0b9d[_0x620e('0x47')]['id'];}return db[_0x620e('0x3d')]['findOne']({'where':{'id':_0x1d0b9d[_0x620e('0x48')]['id']}})[_0x620e('0x23')](handleEntityNotFound(_0x3aba13,null))[_0x620e('0x23')](function(_0x55faa0){if(_0x55faa0){_0x1d0b9d[_0x620e('0x47')][_0x620e('0x4d')]=_0x55faa0['id'];_0x1d0b9d[_0x620e('0x47')][_0x620e('0x4e')]=integrations[_0x620e('0x4f')](_0x1d0b9d['body'][_0x620e('0x50')],_0x1d0b9d[_0x620e('0x47')][_0x620e('0x51')]);_0x1d0b9d[_0x620e('0x47')][_0x620e('0x52')]=integrations[_0x620e('0x53')](_0x1d0b9d[_0x620e('0x47')][_0x620e('0x50')],_0x1d0b9d[_0x620e('0x47')][_0x620e('0x51')]);return db[_0x620e('0x54')][_0x620e('0x46')](_0x1d0b9d[_0x620e('0x47')],{'include':[{'model':db[_0x620e('0x55')],'as':_0x620e('0x4e')},{'model':db[_0x620e('0x55')],'as':_0x620e('0x52')}]});}return null;})[_0x620e('0x23')](respondWithResult(_0x3aba13,null))[_0x620e('0x41')](handleError(_0x3aba13,null));};exports['getFields']=function(_0x19faf3,_0x54418f,_0x46741d){var _0x182f9f=['made_sla',_0x620e('0x56'),'knowledge',_0x620e('0x57'),_0x620e('0x58'),_0x620e('0x59'),'incident_state',_0x620e('0x5a'),_0x620e('0x5b')];var _0x3c5018=[_0x620e('0x5c'),'made_sla',_0x620e('0x5d'),_0x620e('0x5e'),'upon_reject',_0x620e('0x5f'),_0x620e('0x60'),'hold_reason',_0x620e('0x61'),'number',_0x620e('0x62'),_0x620e('0x63'),_0x620e('0x64'),_0x620e('0x65'),_0x620e('0x66'),_0x620e('0x67'),_0x620e('0x68'),_0x620e('0x69'),'knowledge',_0x620e('0x37'),_0x620e('0x6a'),_0x620e('0x6b'),'cmdb_ci','delivery_plan','impact',_0x620e('0x6c'),'work_notes_list',_0x620e('0x6d'),'priority',_0x620e('0x6e'),_0x620e('0x6f'),_0x620e('0x70'),_0x620e('0x71'),_0x620e('0x72'),_0x620e('0x73'),_0x620e('0x74'),_0x620e('0x75'),_0x620e('0x76'),_0x620e('0x77'),'caller_id',_0x620e('0x78'),_0x620e('0x57'),_0x620e('0x79'),_0x620e('0x7a'),_0x620e('0x58'),_0x620e('0x7b'),_0x620e('0x7c'),_0x620e('0x7d'),_0x620e('0x7e'),'business_stc','additional_assignee_list',_0x620e('0x7f'),_0x620e('0x80'),_0x620e('0x59'),'sys_class_name',_0x620e('0x81'),_0x620e('0x82'),_0x620e('0x83'),_0x620e('0x84'),'sys_id',_0x620e('0x85'),_0x620e('0x86'),'incident_state',_0x620e('0x87'),_0x620e('0x88'),'company',_0x620e('0x89'),_0x620e('0x8a'),'assigned_to',_0x620e('0x5a'),_0x620e('0x8b'),_0x620e('0x8c'),_0x620e('0x8d'),_0x620e('0x8e'),_0x620e('0x8f'),'sys_mod_count','reopen_count','sys_tags',_0x620e('0x90'),_0x620e('0x91'),_0x620e('0x92'),_0x620e('0x93'),_0x620e('0x5b')];var _0x177fc6='';var _0x540245='';var _0x29a081=[];var _0x3cf1ea='';var _0x546678='';var _0x50eb7a=[];var _0x218936='';var _0x21d560='';var _0x2ac658={};var _0x3ebfc1='';return db[_0x620e('0x3d')][_0x620e('0x4a')]({'where':{'id':_0x19faf3[_0x620e('0x48')]['id']},'attributes':['id',_0x620e('0x94'),_0x620e('0x95'),_0x620e('0x96'),'remoteUri',_0x620e('0x97')]})[_0x620e('0x23')](handleEntityNotFound(_0x54418f,null))[_0x620e('0x23')](function(_0x4a10ee){if(_0x4a10ee){_0x3ebfc1=_0x4a10ee['remoteUri'];var _0x38fc15=_0x3ebfc1[_0x620e('0x98')](-0x1);if(_0x38fc15==='/'){_0x3ebfc1=_0x3ebfc1[_0x620e('0x99')](0x0,_0x3ebfc1['lastIndexOf'](_0x38fc15));}_0x21d560=util['format']('%s/api/now/doc/table/schema/',_0x3ebfc1);_0x218936=util[_0x620e('0x9a')](_0x620e('0x9b'),_0x3ebfc1);_0x2ac658={'user':_0x4a10ee['username'],'pass':_0x4a10ee[_0x620e('0x95')]};var _0x5e3f61={'method':_0x620e('0x9c'),'uri':_0x21d560+_0x620e('0x9d'),'auth':_0x2ac658,'json':!![]};return rp(_0x5e3f61);}})[_0x620e('0x23')](function(_0x64a5af){if(_0x64a5af[_0x620e('0x9e')][_0x620e('0x34')]>0x0){_0x177fc6=_0x64a5af[_0x620e('0x9e')];}console['log'](_0x620e('0x9f'),_0x177fc6);_0x50eb7a=[];_0x540245=Object[_0x620e('0xa0')]([],_0x177fc6);_[_0x620e('0xa1')](_0x540245,function(_0x19d034){return!_0x182f9f[_0x620e('0xa2')](_0x19d034[_0x620e('0x28')]);});_0x540245[_0x620e('0xa3')](function(_0x22464b){var _0xe7f7d4=createFieldObject(_0x218936,_0x2ac658,_0x22464b[_0x620e('0xa4')],_0x22464b[_0x620e('0x28')],_0x22464b[_0x620e('0xa5')],![]);_0x50eb7a['push'](_0xe7f7d4);});return Promise['all'](_0x50eb7a);})[_0x620e('0x23')](function(_0x499109){_0x29a081=_0x499109;_0x3cf1ea=Object[_0x620e('0xa0')]([],_0x177fc6);console[_0x620e('0xa6')]('TCL:\x20_object',_0x177fc6);_[_0x620e('0xa1')](_0x3cf1ea,function(_0x473d44){return _0x3c5018['includes'](_0x473d44[_0x620e('0x28')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3cf1ea);_0x50eb7a=[];_0x3cf1ea['forEach'](function(_0x311571){var _0x4e2cd4=createFieldObject(_0x218936,_0x2ac658,_0x311571[_0x620e('0xa4')],_0x311571['name'],_0x311571['label'],!![]);_0x50eb7a[_0x620e('0xa7')](_0x4e2cd4);});return Promise[_0x620e('0xa8')](_0x50eb7a);})['then'](function(_0x2dd20a){_0x546678=_0x2dd20a;var _0x319ba1=_0x29a081[_0x620e('0xa9')](_0x546678);return{'count':_0x319ba1['length'],'rows':_0x319ba1};})[_0x620e('0x23')](respondWithResult(_0x54418f,null))[_0x620e('0x41')](function(_0x210558){console[_0x620e('0xa6')](_0x620e('0xaa')+_0x210558);var _0x3ccc86=_0x19faf3[_0x620e('0x35')][_0x620e('0xab')]?0x1f4:_0x210558[_0x620e('0xac')]||0x1f4;logger['error'](_0x210558[_0x620e('0x27')]);delete _0x210558['name'];if(_0x3ccc86===0x191){_0x3ccc86=0x190;}_0x54418f['status'](_0x3ccc86)[_0x620e('0x29')](_0x19faf3[_0x620e('0x35')][_0x620e('0xab')]?{'message':_0x620e('0xad'),'statusCode':_0x210558[_0x620e('0xac')]}:_0x210558);});};function createFieldObject(_0x249e6a,_0x4b3a5a,_0x247864,_0x33de4c,_0x626f30,_0x53c34c){return new Promise(function(_0x2f9e5b,_0xddf62c){var _0x170fe2={'id':_0x33de4c,'name':_0x626f30,'custom':_0x53c34c};if(_0x247864==='boolean'){_0x170fe2['options']=[{'name':_0x620e('0xae'),'value':_0x620e('0xaf')},{'name':_0x620e('0xb0'),'value':_0x620e('0xb1')}];_0x2f9e5b(_0x170fe2);}else{var _0x34501c={'method':_0x620e('0x9c'),'uri':_0x249e6a+_0x620e('0xb2')+_0x33de4c,'auth':_0x4b3a5a,'json':!![]};return rp(_0x34501c)['then'](function(_0x528b49){var _0x5da781=[];if(_0x528b49[_0x620e('0x9e')][_0x620e('0x34')]>0x0){_0x528b49[_0x620e('0x9e')][_0x620e('0xa3')](function(_0xac9e19){if(_0xac9e19[_0x620e('0xb3')]==='false'){var _0x426658={'name':_0xac9e19[_0x620e('0xa5')],'value':_0xac9e19[_0x620e('0xb4')]};_0x5da781[_0x620e('0xa7')](_0x426658);}});}_0x170fe2[_0x620e('0x44')]=_0x5da781;if(_0x170fe2[_0x620e('0x44')][_0x620e('0x34')]>0x0){_0x2f9e5b(_0x170fe2);}else{if(_0x53c34c==![]){_0x2f9e5b();}else{_0x2f9e5b(_0x170fe2);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 15bf463..46b3ec2 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util'];(function(_0x5d9325,_0x4c6aa2){var _0x430ce6=function(_0x4ff95d){while(--_0x4ff95d){_0x5d9325['push'](_0x5d9325['shift']());}};_0x430ce6(++_0x4c6aa2);}(_0x814b,0x1a2));var _0xb814=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x814b[_0x204eb7];return _0x37e444;};'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'));var integrations=require(_0xb814('0xa'));module[_0xb814('0xb')]=function(_0x53e507,_0x3b0829){return _0x53e507[_0xb814('0xc')]('ServicenowAccount',attributes,{'tableName':_0xb814('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0xabce,0x103));var _0xeabc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xabce[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xeabc('0x8')]=function(_0x52a4d7,_0x229ba4){return _0x52a4d7['define'](_0xeabc('0x9'),attributes,{'tableName':_0xeabc('0xa'),'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 0731ac5..a54e8bf 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 _0xff65=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','include','map','model','find','ShowServicenowAccount','util','randomstring','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xff65,0x10b));var _0x5ff6=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xff65[_0x176329];return _0x31997c;};'use strict';var _=require('lodash');var util=require(_0x5ff6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5ff6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ff6('0x2'))['db'];var utils=require(_0x5ff6('0x3'));var logger=require('../../config/logger')(_0x5ff6('0x4'));var config=require(_0x5ff6('0x5'));var jayson=require(_0x5ff6('0x6'));var client=jayson[_0x5ff6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ecdfc,_0x2473bd,_0x1fccfd){return new BPromise(function(_0x2629a6,_0x49545b){return client[_0x5ff6('0x8')](_0x2ecdfc,_0x1fccfd)['then'](function(_0xced50a){logger[_0x5ff6('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x2473bd,_0x5ff6('0xa'));logger[_0x5ff6('0xb')](_0x5ff6('0xc'),_0x2473bd,_0x5ff6('0xa'),JSON[_0x5ff6('0xd')](_0xced50a));if(_0xced50a[_0x5ff6('0xe')]){if(_0xced50a[_0x5ff6('0xe')]['code']===0x1f4){logger['error'](_0x5ff6('0xf'),_0x2473bd,_0xced50a[_0x5ff6('0xe')]['message']);return _0x49545b(_0xced50a[_0x5ff6('0xe')][_0x5ff6('0x10')]);}logger['error'](_0x5ff6('0xf'),_0x2473bd,_0xced50a[_0x5ff6('0xe')][_0x5ff6('0x10')]);return _0x2629a6(_0xced50a[_0x5ff6('0xe')][_0x5ff6('0x10')]);}else{logger[_0x5ff6('0x9')](_0x5ff6('0xf'),_0x2473bd,_0x5ff6('0xa'));_0x2629a6(_0xced50a[_0x5ff6('0x11')][_0x5ff6('0x10')]);}})[_0x5ff6('0x12')](function(_0x47ca29){logger[_0x5ff6('0xe')](_0x5ff6('0xf'),_0x2473bd,_0x47ca29);_0x49545b(_0x47ca29);});});}exports[_0x5ff6('0x13')]=function(_0x347128){var _0x31ffdf=this;return new Promise(function(_0x42561a,_0x4974bc){return db[_0x5ff6('0x14')][_0x5ff6('0x15')]({'raw':_0x347128[_0x5ff6('0x16')]?_0x347128[_0x5ff6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x347128[_0x5ff6('0x16')]?_0x347128['options'][_0x5ff6('0x17')]||null:null,'attributes':_0x347128[_0x5ff6('0x16')]?_0x347128[_0x5ff6('0x16')][_0x5ff6('0x18')]||null:null,'limit':_0x347128[_0x5ff6('0x16')]?_0x347128[_0x5ff6('0x16')]['limit']||null:null,'include':_0x347128[_0x5ff6('0x16')]?_0x347128[_0x5ff6('0x16')][_0x5ff6('0x19')]?_[_0x5ff6('0x1a')](_0x347128[_0x5ff6('0x16')]['include'],function(_0xc8b3fe){return{'model':db[_0xc8b3fe[_0x5ff6('0x1b')]],'as':_0xc8b3fe['as'],'attributes':_0xc8b3fe[_0x5ff6('0x18')],'include':_0xc8b3fe[_0x5ff6('0x19')]?_[_0x5ff6('0x1a')](_0xc8b3fe['include'],function(_0x3d06b8){return{'model':db[_0x3d06b8[_0x5ff6('0x1b')]],'as':_0x3d06b8['as'],'attributes':_0x3d06b8[_0x5ff6('0x18')],'include':_0x3d06b8['include']?_[_0x5ff6('0x1a')](_0x3d06b8[_0x5ff6('0x19')],function(_0x38a059){return{'model':db[_0x38a059[_0x5ff6('0x1b')]],'as':_0x38a059['as'],'attributes':_0x38a059[_0x5ff6('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d3c28){logger[_0x5ff6('0x9')]('GetServicenowAccount',_0x347128);logger['debug']('GetServicenowAccount',_0x347128,JSON['stringify'](_0x2d3c28));_0x42561a(_0x2d3c28);})[_0x5ff6('0x12')](function(_0x5719ca){logger[_0x5ff6('0xe')]('GetServicenowAccount',_0x5719ca[_0x5ff6('0x10')],_0x347128);_0x4974bc(_0x31ffdf[_0x5ff6('0xe')](0x1f4,_0x5719ca[_0x5ff6('0x10')]));});});};exports['ShowServicenowAccount']=function(_0x4a588f){var _0x2babb5=this;return new Promise(function(_0x542551,_0x559bb4){return db[_0x5ff6('0x14')][_0x5ff6('0x1c')]({'raw':_0x4a588f[_0x5ff6('0x16')]?_0x4a588f[_0x5ff6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4a588f[_0x5ff6('0x16')]?_0x4a588f['options'][_0x5ff6('0x17')]||null:null,'attributes':_0x4a588f[_0x5ff6('0x16')]?_0x4a588f[_0x5ff6('0x16')]['attributes']||null:null,'include':_0x4a588f[_0x5ff6('0x16')]?_0x4a588f[_0x5ff6('0x16')]['include']?_[_0x5ff6('0x1a')](_0x4a588f['options']['include'],function(_0x187c66){return{'model':db[_0x187c66[_0x5ff6('0x1b')]],'as':_0x187c66['as'],'attributes':_0x187c66['attributes'],'include':_0x187c66['include']?_[_0x5ff6('0x1a')](_0x187c66[_0x5ff6('0x19')],function(_0x197279){return{'model':db[_0x197279[_0x5ff6('0x1b')]],'as':_0x197279['as'],'attributes':_0x197279['attributes'],'include':_0x197279[_0x5ff6('0x19')]?_['map'](_0x197279['include'],function(_0x878c34){return{'model':db[_0x878c34[_0x5ff6('0x1b')]],'as':_0x878c34['as'],'attributes':_0x878c34[_0x5ff6('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36397b){logger[_0x5ff6('0x9')](_0x5ff6('0x1d'),_0x4a588f);logger[_0x5ff6('0xb')]('ShowServicenowAccount',_0x4a588f,JSON[_0x5ff6('0xd')](_0x36397b));_0x542551(_0x36397b);})[_0x5ff6('0x12')](function(_0xb3d3b3){logger[_0x5ff6('0xe')](_0x5ff6('0x1d'),_0xb3d3b3[_0x5ff6('0x10')],_0x4a588f);_0x559bb4(_0x2babb5[_0x5ff6('0xe')](0x1f4,_0xb3d3b3[_0x5ff6('0x10')]));});});}; \ No newline at end of file +var _0xa410=['code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowServicenowAccount','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3341a1,_0x11500b){var _0x53753b=function(_0x560edc){while(--_0x560edc){_0x3341a1['push'](_0x3341a1['shift']());}};_0x53753b(++_0x11500b);}(_0xa410,0xe3));var _0x0a41=function(_0x76ad19,_0x17a73d){_0x76ad19=_0x76ad19-0x0;var _0x3595b5=_0xa410[_0x76ad19];return _0x3595b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0a41('0x0'));var rs=require(_0x0a41('0x1'));var fs=require('fs');var Redis=require(_0x0a41('0x2'));var db=require(_0x0a41('0x3'))['db'];var utils=require(_0x0a41('0x4'));var logger=require(_0x0a41('0x5'))(_0x0a41('0x6'));var config=require(_0x0a41('0x7'));var jayson=require(_0x0a41('0x8'));var client=jayson['client'][_0x0a41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3aa3a3,_0x4f59fa,_0x11666c){return new BPromise(function(_0x18fa3f,_0x2c66b6){return client['request'](_0x3aa3a3,_0x11666c)[_0x0a41('0xa')](function(_0x408a77){logger[_0x0a41('0xb')](_0x0a41('0xc'),_0x4f59fa,'request\x20sent');logger[_0x0a41('0xd')](_0x0a41('0xe'),_0x4f59fa,_0x0a41('0xf'),JSON[_0x0a41('0x10')](_0x408a77));if(_0x408a77[_0x0a41('0x11')]){if(_0x408a77[_0x0a41('0x11')][_0x0a41('0x12')]===0x1f4){logger[_0x0a41('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x4f59fa,_0x408a77[_0x0a41('0x11')][_0x0a41('0x13')]);return _0x2c66b6(_0x408a77[_0x0a41('0x11')][_0x0a41('0x13')]);}logger[_0x0a41('0x11')](_0x0a41('0xc'),_0x4f59fa,_0x408a77[_0x0a41('0x11')]['message']);return _0x18fa3f(_0x408a77['error'][_0x0a41('0x13')]);}else{logger['info'](_0x0a41('0xc'),_0x4f59fa,_0x0a41('0xf'));_0x18fa3f(_0x408a77[_0x0a41('0x14')][_0x0a41('0x13')]);}})[_0x0a41('0x15')](function(_0x975708){logger[_0x0a41('0x11')](_0x0a41('0xc'),_0x4f59fa,_0x975708);_0x2c66b6(_0x975708);});});}exports[_0x0a41('0x16')]=function(_0x44d0ba){var _0x75fa33=this;return new Promise(function(_0x57e58f,_0x5d96a4){return db[_0x0a41('0x17')][_0x0a41('0x18')]({'raw':_0x44d0ba[_0x0a41('0x19')]?_0x44d0ba[_0x0a41('0x19')][_0x0a41('0x1a')]===undefined?!![]:![]:!![],'where':_0x44d0ba[_0x0a41('0x19')]?_0x44d0ba['options'][_0x0a41('0x1b')]||null:null,'attributes':_0x44d0ba[_0x0a41('0x19')]?_0x44d0ba[_0x0a41('0x19')][_0x0a41('0x1c')]||null:null,'limit':_0x44d0ba[_0x0a41('0x19')]?_0x44d0ba[_0x0a41('0x19')][_0x0a41('0x1d')]||null:null,'include':_0x44d0ba[_0x0a41('0x19')]?_0x44d0ba[_0x0a41('0x19')]['include']?_['map'](_0x44d0ba[_0x0a41('0x19')][_0x0a41('0x1e')],function(_0x93ec3d){return{'model':db[_0x93ec3d[_0x0a41('0x1f')]],'as':_0x93ec3d['as'],'attributes':_0x93ec3d['attributes'],'include':_0x93ec3d[_0x0a41('0x1e')]?_['map'](_0x93ec3d[_0x0a41('0x1e')],function(_0x11d732){return{'model':db[_0x11d732[_0x0a41('0x1f')]],'as':_0x11d732['as'],'attributes':_0x11d732['attributes'],'include':_0x11d732[_0x0a41('0x1e')]?_[_0x0a41('0x20')](_0x11d732[_0x0a41('0x1e')],function(_0x94f718){return{'model':db[_0x94f718[_0x0a41('0x1f')]],'as':_0x94f718['as'],'attributes':_0x94f718[_0x0a41('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x487be6){logger[_0x0a41('0xb')](_0x0a41('0x16'),_0x44d0ba);logger[_0x0a41('0xd')](_0x0a41('0x16'),_0x44d0ba,JSON[_0x0a41('0x10')](_0x487be6));_0x57e58f(_0x487be6);})[_0x0a41('0x15')](function(_0x297891){logger[_0x0a41('0x11')](_0x0a41('0x16'),_0x297891['message'],_0x44d0ba);_0x5d96a4(_0x75fa33['error'](0x1f4,_0x297891[_0x0a41('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x7d8ac4){var _0x8d36c6=this;return new Promise(function(_0x5e68f8,_0x221f2f){return db['ServicenowAccount'][_0x0a41('0x21')]({'raw':_0x7d8ac4['options']?_0x7d8ac4[_0x0a41('0x19')][_0x0a41('0x1a')]===undefined?!![]:![]:!![],'where':_0x7d8ac4[_0x0a41('0x19')]?_0x7d8ac4[_0x0a41('0x19')][_0x0a41('0x1b')]||null:null,'attributes':_0x7d8ac4[_0x0a41('0x19')]?_0x7d8ac4[_0x0a41('0x19')][_0x0a41('0x1c')]||null:null,'include':_0x7d8ac4[_0x0a41('0x19')]?_0x7d8ac4[_0x0a41('0x19')][_0x0a41('0x1e')]?_[_0x0a41('0x20')](_0x7d8ac4[_0x0a41('0x19')][_0x0a41('0x1e')],function(_0x5be6d9){return{'model':db[_0x5be6d9['model']],'as':_0x5be6d9['as'],'attributes':_0x5be6d9[_0x0a41('0x1c')],'include':_0x5be6d9[_0x0a41('0x1e')]?_[_0x0a41('0x20')](_0x5be6d9[_0x0a41('0x1e')],function(_0x5200d7){return{'model':db[_0x5200d7['model']],'as':_0x5200d7['as'],'attributes':_0x5200d7[_0x0a41('0x1c')],'include':_0x5200d7['include']?_[_0x0a41('0x20')](_0x5200d7[_0x0a41('0x1e')],function(_0x38a329){return{'model':db[_0x38a329['model']],'as':_0x38a329['as'],'attributes':_0x38a329[_0x0a41('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0a41('0xa')](function(_0x2e3e28){logger[_0x0a41('0xb')](_0x0a41('0x22'),_0x7d8ac4);logger[_0x0a41('0xd')]('ShowServicenowAccount',_0x7d8ac4,JSON[_0x0a41('0x10')](_0x2e3e28));_0x5e68f8(_0x2e3e28);})[_0x0a41('0x15')](function(_0xfdf301){logger[_0x0a41('0x11')](_0x0a41('0x22'),_0xfdf301[_0x0a41('0x13')],_0x7d8ac4);_0x221f2f(_0x8d36c6[_0x0a41('0x11')](0x1f4,_0xfdf301[_0x0a41('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 0e01167..08331b2 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 _0x4227=['get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x4227,0x8c));var _0x7422=function(_0x364ffd,_0xb44265){_0x364ffd=_0x364ffd-0x0;var _0x57b733=_0x4227[_0x364ffd];return _0x57b733;};'use strict';var multer=require(_0x7422('0x0'));var util=require(_0x7422('0x1'));var path=require(_0x7422('0x2'));var timeout=require(_0x7422('0x3'));var express=require(_0x7422('0x4'));var router=express['Router']();var fs_extra=require(_0x7422('0x5'));var auth=require(_0x7422('0x6'));var interaction=require(_0x7422('0x7'));var config=require(_0x7422('0x8'));var controller=require(_0x7422('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7422('0xa')](_0x7422('0xb'),auth[_0x7422('0xc')](),controller[_0x7422('0xd')]);router[_0x7422('0xa')](_0x7422('0xe'),auth[_0x7422('0xc')](),controller[_0x7422('0xf')]);router[_0x7422('0xa')](_0x7422('0x10'),auth['isAuthenticated'](),controller[_0x7422('0x11')]);router[_0x7422('0xa')]('/:id/descriptions',auth[_0x7422('0xc')](),controller[_0x7422('0x12')]);router[_0x7422('0x13')]('/',auth['isAuthenticated'](),controller[_0x7422('0x14')]);router[_0x7422('0x15')](_0x7422('0xb'),auth[_0x7422('0xc')](),controller[_0x7422('0x16')]);router[_0x7422('0x17')](_0x7422('0xb'),auth[_0x7422('0xc')](),controller[_0x7422('0x18')]);module['exports']=router; \ No newline at end of file +var _0xbd38=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd38,0x130));var _0x8bd3=function(_0x10ddfa,_0x2a8311){_0x10ddfa=_0x10ddfa-0x0;var _0x3dce4b=_0xbd38[_0x10ddfa];return _0x3dce4b;};'use strict';var multer=require('multer');var util=require(_0x8bd3('0x0'));var path=require(_0x8bd3('0x1'));var timeout=require(_0x8bd3('0x2'));var express=require(_0x8bd3('0x3'));var router=express[_0x8bd3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8bd3('0x5'));var interaction=require(_0x8bd3('0x6'));var config=require('../../config/environment');var controller=require(_0x8bd3('0x7'));router[_0x8bd3('0x8')]('/',auth[_0x8bd3('0x9')](),controller[_0x8bd3('0xa')]);router[_0x8bd3('0x8')](_0x8bd3('0xb'),auth[_0x8bd3('0x9')](),controller[_0x8bd3('0xc')]);router[_0x8bd3('0x8')]('/:id/fields',auth[_0x8bd3('0x9')](),controller['getFields']);router[_0x8bd3('0x8')](_0x8bd3('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8bd3('0x8')](_0x8bd3('0xe'),auth[_0x8bd3('0x9')](),controller[_0x8bd3('0xf')]);router[_0x8bd3('0x10')]('/',auth['isAuthenticated'](),controller[_0x8bd3('0x11')]);router[_0x8bd3('0x12')](_0x8bd3('0xb'),auth[_0x8bd3('0x9')](),controller[_0x8bd3('0x13')]);router[_0x8bd3('0x14')](_0x8bd3('0xb'),auth[_0x8bd3('0x9')](),controller[_0x8bd3('0x15')]);module[_0x8bd3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 1867916..c5fc32f 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 _0xc387=['exports','STRING'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0xc387,0x1b4));var _0x7c38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc387[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x7c38('0x0')]={'name':{'type':Sequelize[_0x7c38('0x1')]},'description':{'type':Sequelize[_0x7c38('0x1')]}}; \ No newline at end of file +var _0x666d=['STRING','sequelize','exports'];(function(_0x2e41e8,_0x4180f1){var _0xc80793=function(_0x5965eb){while(--_0x5965eb){_0x2e41e8['push'](_0x2e41e8['shift']());}};_0xc80793(++_0x4180f1);}(_0x666d,0x130));var _0xd666=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x666d[_0x1c8c28];return _0x1f59b4;};'use strict';var Sequelize=require(_0xd666('0x0'));module[_0xd666('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd666('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 77bb166..4f5b367 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 _0xd83c=['end','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','length','order','sort','where','type','VIRTUAL','filter','merge','options','rows','catch','params','fields','find','create','body','destroy','getFields','ServicenowField','pick','hasOwnProperty','getSubjects','findOne','nolimit','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then'];(function(_0x327b65,_0x32cddf){var _0x2b8a27=function(_0x247e6c){while(--_0x247e6c){_0x327b65['push'](_0x327b65['shift']());}};_0x2b8a27(++_0x32cddf);}(_0xd83c,0x150));var _0xcd83=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xd83c[_0x1ca9e9];return _0x309f3c;};'use strict';var emlformat=require(_0xcd83('0x0'));var rimraf=require(_0xcd83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd83('0x2'));var rp=require('request-promise');var moment=require(_0xcd83('0x3'));var BPromise=require(_0xcd83('0x4'));var Mustache=require('mustache');var util=require(_0xcd83('0x5'));var path=require('path');var sox=require(_0xcd83('0x6'));var csv=require(_0xcd83('0x7'));var ejs=require(_0xcd83('0x8'));var fs=require('fs');var fs_extra=require(_0xcd83('0x9'));var _=require('lodash');var squel=require(_0xcd83('0xa'));var crypto=require('crypto');var jsforce=require(_0xcd83('0xb'));var deskjs=require(_0xcd83('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcd83('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd83('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd83('0xf'));var logger=require(_0xcd83('0x10'))(_0xcd83('0x11'));var utils=require('../../config/utils');var config=require(_0xcd83('0x12'));var licenseUtil=require(_0xcd83('0x13'));var db=require(_0xcd83('0x14'))['db'];function respondWithStatusCode(_0x223d9,_0x12581e){_0x12581e=_0x12581e||0xcc;return function(_0x35b8ab){if(_0x35b8ab){return _0x223d9[_0xcd83('0x15')](_0x12581e);}return _0x223d9[_0xcd83('0x16')](_0x12581e)['end']();};}function respondWithResult(_0x4763b8,_0x447e72){_0x447e72=_0x447e72||0xc8;return function(_0x1bdba9){if(_0x1bdba9){return _0x4763b8[_0xcd83('0x16')](_0x447e72)[_0xcd83('0x17')](_0x1bdba9);}};}function respondWithFilteredResult(_0x2fed61,_0x4a0003){return function(_0x118fe0){if(_0x118fe0){var _0x5e4520=typeof _0x4a0003[_0xcd83('0x18')]===_0xcd83('0x19')&&typeof _0x4a0003['limit']===_0xcd83('0x19');var _0x9e2dd=_0x118fe0[_0xcd83('0x1a')];var _0x5dd9db=_0x5e4520?0x0:_0x4a0003[_0xcd83('0x18')];var _0x14f329=_0x5e4520?_0x118fe0[_0xcd83('0x1a')]:_0x4a0003[_0xcd83('0x18')]+_0x4a0003[_0xcd83('0x1b')];var _0x3d6a93;if(_0x14f329>=_0x9e2dd){_0x14f329=_0x9e2dd;_0x3d6a93=0xc8;}else{_0x3d6a93=0xce;}_0x2fed61[_0xcd83('0x16')](_0x3d6a93);return _0x2fed61[_0xcd83('0x1c')](_0xcd83('0x1d'),_0x5dd9db+'-'+_0x14f329+'/'+_0x9e2dd)[_0xcd83('0x17')](_0x118fe0);}return null;};}function patchUpdates(_0x369239){return function(_0x3e66f7){try{jsonpatch[_0xcd83('0x1e')](_0x3e66f7,_0x369239,!![]);}catch(_0x56fd3a){return BPromise[_0xcd83('0x1f')](_0x56fd3a);}return _0x3e66f7['save']();};}function saveUpdates(_0x5cd38e,_0x27cf16){return function(_0x30006f){if(_0x30006f){return _0x30006f[_0xcd83('0x20')](_0x5cd38e)['then'](function(_0x4db617){return _0x4db617;});}return null;};}function removeEntity(_0x3aae30,_0x4ffb39){return function(_0x103276){if(_0x103276){return _0x103276['destroy']()[_0xcd83('0x21')](function(){_0x3aae30[_0xcd83('0x16')](0xcc)[_0xcd83('0x22')]();});}};}function handleEntityNotFound(_0x42e520,_0x135ee7){return function(_0x877f8e){if(!_0x877f8e){_0x42e520[_0xcd83('0x15')](0x194);}return _0x877f8e;};}function handleError(_0x56a116,_0x214e43){_0x214e43=_0x214e43||0x1f4;return function(_0x277b48){logger[_0xcd83('0x23')](_0x277b48[_0xcd83('0x24')]);if(_0x277b48['name']){delete _0x277b48[_0xcd83('0x25')];}_0x56a116[_0xcd83('0x16')](_0x214e43)[_0xcd83('0x26')](_0x277b48);};}exports['index']=function(_0xc73217,_0x223d76){var _0xc9e070={},_0x1773dd={},_0x24f3d0={'count':0x0,'rows':[]};var _0x3b2b53=_[_0xcd83('0x27')](db[_0xcd83('0x28')][_0xcd83('0x29')],function(_0xb799af){return{'name':_0xb799af[_0xcd83('0x2a')],'type':_0xb799af['type']['key']};});_0x1773dd['model']=_[_0xcd83('0x27')](_0x3b2b53,_0xcd83('0x25'));_0x1773dd[_0xcd83('0x2b')]=_[_0xcd83('0x2c')](_0xc73217[_0xcd83('0x2b')]);_0x1773dd[_0xcd83('0x2d')]=_[_0xcd83('0x2e')](_0x1773dd[_0xcd83('0x2f')],_0x1773dd['query']);_0xc9e070[_0xcd83('0x30')]=_[_0xcd83('0x2e')](_0x1773dd[_0xcd83('0x2f')],qs['fields'](_0xc73217[_0xcd83('0x2b')]['fields']));_0xc9e070[_0xcd83('0x30')]=_0xc9e070[_0xcd83('0x30')][_0xcd83('0x31')]?_0xc9e070[_0xcd83('0x30')]:_0x1773dd[_0xcd83('0x2f')];if(!_0xc73217[_0xcd83('0x2b')]['hasOwnProperty']('nolimit')){_0xc9e070['limit']=qs[_0xcd83('0x1b')](_0xc73217[_0xcd83('0x2b')][_0xcd83('0x1b')]);_0xc9e070[_0xcd83('0x18')]=qs[_0xcd83('0x18')](_0xc73217['query']['offset']);}_0xc9e070[_0xcd83('0x32')]=qs[_0xcd83('0x33')](_0xc73217['query'][_0xcd83('0x33')]);_0xc9e070[_0xcd83('0x34')]=qs['filters'](_['pick'](_0xc73217[_0xcd83('0x2b')],_0x1773dd[_0xcd83('0x2d')]),_0x3b2b53);if(_0xc73217[_0xcd83('0x2b')]['filter']){_0xc9e070[_0xcd83('0x34')]=_['merge'](_0xc9e070['where'],{'$or':_[_0xcd83('0x27')](_0x3b2b53,function(_0x3c2d8a){if(_0x3c2d8a[_0xcd83('0x35')]!==_0xcd83('0x36')){var _0x1d958a={};_0x1d958a[_0x3c2d8a[_0xcd83('0x25')]]={'$like':'%'+_0xc73217[_0xcd83('0x2b')][_0xcd83('0x37')]+'%'};return _0x1d958a;}})});}_0xc9e070=_[_0xcd83('0x38')]({},_0xc9e070,_0xc73217[_0xcd83('0x39')]);var _0x43ee8c={'where':_0xc9e070[_0xcd83('0x34')]};return db[_0xcd83('0x28')][_0xcd83('0x1a')](_0x43ee8c)['then'](function(_0xc84e67){_0x24f3d0[_0xcd83('0x1a')]=_0xc84e67;if(_0xc73217[_0xcd83('0x2b')]['includeAll']){_0xc9e070['include']=[{'all':!![]}];}return db[_0xcd83('0x28')]['findAll'](_0xc9e070);})[_0xcd83('0x21')](function(_0x281504){_0x24f3d0[_0xcd83('0x3a')]=_0x281504;return _0x24f3d0;})[_0xcd83('0x21')](respondWithFilteredResult(_0x223d76,_0xc9e070))[_0xcd83('0x3b')](handleError(_0x223d76,null));};exports['show']=function(_0x410651,_0x4945bf){var _0x1375ea={'raw':![],'where':{'id':_0x410651[_0xcd83('0x3c')]['id']}},_0x4e2de1={};_0x4e2de1['model']=_[_0xcd83('0x2c')](db[_0xcd83('0x28')][_0xcd83('0x29')]);_0x4e2de1[_0xcd83('0x2b')]=_[_0xcd83('0x2c')](_0x410651['query']);_0x4e2de1[_0xcd83('0x2d')]=_[_0xcd83('0x2e')](_0x4e2de1[_0xcd83('0x2f')],_0x4e2de1['query']);_0x1375ea[_0xcd83('0x30')]=_['intersection'](_0x4e2de1[_0xcd83('0x2f')],qs[_0xcd83('0x3d')](_0x410651[_0xcd83('0x2b')][_0xcd83('0x3d')]));_0x1375ea[_0xcd83('0x30')]=_0x1375ea[_0xcd83('0x30')]['length']?_0x1375ea[_0xcd83('0x30')]:_0x4e2de1['model'];if(_0x410651[_0xcd83('0x2b')]['includeAll']){_0x1375ea['include']=[{'all':!![]}];}_0x1375ea=_['merge']({},_0x1375ea,_0x410651[_0xcd83('0x39')]);return db['ServicenowConfiguration'][_0xcd83('0x3e')](_0x1375ea)[_0xcd83('0x21')](handleEntityNotFound(_0x4945bf,null))['then'](respondWithResult(_0x4945bf,null))['catch'](handleError(_0x4945bf,null));};exports[_0xcd83('0x3f')]=function(_0x42aa5e,_0x3a1801){return db[_0xcd83('0x28')]['create'](_0x42aa5e[_0xcd83('0x40')],{})[_0xcd83('0x21')](respondWithResult(_0x3a1801,0xc9))['catch'](handleError(_0x3a1801,null));};exports['update']=function(_0xae4330,_0x4baef7){if(_0xae4330['body']['id']){delete _0xae4330[_0xcd83('0x40')]['id'];}return db[_0xcd83('0x28')][_0xcd83('0x3e')]({'where':{'id':_0xae4330['params']['id']}})[_0xcd83('0x21')](handleEntityNotFound(_0x4baef7,null))['then'](saveUpdates(_0xae4330['body'],null))[_0xcd83('0x21')](respondWithResult(_0x4baef7,null))[_0xcd83('0x3b')](handleError(_0x4baef7,null));};exports[_0xcd83('0x41')]=function(_0x24182f,_0x538938){return db[_0xcd83('0x28')][_0xcd83('0x3e')]({'where':{'id':_0x24182f[_0xcd83('0x3c')]['id']}})['then'](handleEntityNotFound(_0x538938,null))[_0xcd83('0x21')](removeEntity(_0x538938,null))['catch'](handleError(_0x538938,null));};exports[_0xcd83('0x42')]=function(_0x35a066,_0x35a54c,_0x710756){var _0x125190={};var _0x10bcd5={};var _0x4efa89;var _0x2a994b;return db[_0xcd83('0x28')]['findOne']({'where':{'id':_0x35a066[_0xcd83('0x3c')]['id']}})[_0xcd83('0x21')](handleEntityNotFound(_0x35a54c,null))['then'](function(_0x534ba6){if(_0x534ba6){_0x4efa89=_0x534ba6;_0x10bcd5[_0xcd83('0x2f')]=_[_0xcd83('0x2c')](db[_0xcd83('0x43')]['rawAttributes']);_0x10bcd5[_0xcd83('0x2b')]=_['keys'](_0x35a066[_0xcd83('0x2b')]);_0x10bcd5['filters']=_['intersection'](_0x10bcd5[_0xcd83('0x2f')],_0x10bcd5['query']);_0x125190[_0xcd83('0x30')]=_[_0xcd83('0x2e')](_0x10bcd5[_0xcd83('0x2f')],qs[_0xcd83('0x3d')](_0x35a066['query'][_0xcd83('0x3d')]));_0x125190[_0xcd83('0x30')]=_0x125190['attributes'][_0xcd83('0x31')]?_0x125190[_0xcd83('0x30')]:_0x10bcd5[_0xcd83('0x2f')];_0x125190[_0xcd83('0x32')]=qs[_0xcd83('0x33')](_0x35a066[_0xcd83('0x2b')]['sort']);_0x125190['where']=qs['filters'](_[_0xcd83('0x44')](_0x35a066[_0xcd83('0x2b')],_0x10bcd5[_0xcd83('0x2d')]));if(_0x35a066[_0xcd83('0x2b')][_0xcd83('0x37')]){_0x125190[_0xcd83('0x34')]=_['merge'](_0x125190[_0xcd83('0x34')],{'$or':_['map'](_0x125190[_0xcd83('0x30')],function(_0x18414d){var _0x5603c3={};_0x5603c3[_0x18414d]={'$like':'%'+_0x35a066[_0xcd83('0x2b')]['filter']+'%'};return _0x5603c3;})});}_0x125190=_[_0xcd83('0x38')]({},_0x125190,_0x35a066['options']);return _0x4efa89[_0xcd83('0x42')](_0x125190);}})[_0xcd83('0x21')](function(_0x1c0b85){if(_0x1c0b85){_0x2a994b=_0x1c0b85[_0xcd83('0x31')];if(!_0x35a066[_0xcd83('0x2b')][_0xcd83('0x45')]('nolimit')){_0x125190[_0xcd83('0x1b')]=qs['limit'](_0x35a066[_0xcd83('0x2b')][_0xcd83('0x1b')]);_0x125190[_0xcd83('0x18')]=qs[_0xcd83('0x18')](_0x35a066[_0xcd83('0x2b')]['offset']);}return _0x4efa89[_0xcd83('0x42')](_0x125190);}})['then'](function(_0x35c475){if(_0x35c475){return _0x35c475?{'count':_0x2a994b,'rows':_0x35c475}:null;}})['then'](respondWithResult(_0x35a54c,null))[_0xcd83('0x3b')](handleError(_0x35a54c,null));};exports[_0xcd83('0x46')]=function(_0x1ea112,_0x45c2c6,_0x83201c){var _0x351beb={};var _0x32c3aa={};var _0xbaa519;var _0x19a1b4;return db['ServicenowConfiguration'][_0xcd83('0x47')]({'where':{'id':_0x1ea112[_0xcd83('0x3c')]['id']}})[_0xcd83('0x21')](handleEntityNotFound(_0x45c2c6,null))[_0xcd83('0x21')](function(_0x237d78){if(_0x237d78){_0xbaa519=_0x237d78;_0x32c3aa[_0xcd83('0x2f')]=_[_0xcd83('0x2c')](db['ServicenowField'][_0xcd83('0x29')]);_0x32c3aa['query']=_[_0xcd83('0x2c')](_0x1ea112[_0xcd83('0x2b')]);_0x32c3aa[_0xcd83('0x2d')]=_['intersection'](_0x32c3aa['model'],_0x32c3aa[_0xcd83('0x2b')]);_0x351beb[_0xcd83('0x30')]=_[_0xcd83('0x2e')](_0x32c3aa[_0xcd83('0x2f')],qs[_0xcd83('0x3d')](_0x1ea112[_0xcd83('0x2b')]['fields']));_0x351beb['attributes']=_0x351beb[_0xcd83('0x30')][_0xcd83('0x31')]?_0x351beb[_0xcd83('0x30')]:_0x32c3aa[_0xcd83('0x2f')];_0x351beb[_0xcd83('0x32')]=qs[_0xcd83('0x33')](_0x1ea112[_0xcd83('0x2b')]['sort']);_0x351beb[_0xcd83('0x34')]=qs[_0xcd83('0x2d')](_[_0xcd83('0x44')](_0x1ea112[_0xcd83('0x2b')],_0x32c3aa[_0xcd83('0x2d')]));if(_0x1ea112[_0xcd83('0x2b')][_0xcd83('0x37')]){_0x351beb[_0xcd83('0x34')]=_[_0xcd83('0x38')](_0x351beb['where'],{'$or':_[_0xcd83('0x27')](_0x351beb[_0xcd83('0x30')],function(_0x4c9f11){var _0x2df07a={};_0x2df07a[_0x4c9f11]={'$like':'%'+_0x1ea112[_0xcd83('0x2b')][_0xcd83('0x37')]+'%'};return _0x2df07a;})});}_0x351beb=_[_0xcd83('0x38')]({},_0x351beb,_0x1ea112[_0xcd83('0x39')]);return _0xbaa519[_0xcd83('0x46')](_0x351beb);}})[_0xcd83('0x21')](function(_0x165fb6){if(_0x165fb6){_0x19a1b4=_0x165fb6[_0xcd83('0x31')];if(!_0x1ea112[_0xcd83('0x2b')][_0xcd83('0x45')](_0xcd83('0x48'))){_0x351beb[_0xcd83('0x1b')]=qs['limit'](_0x1ea112[_0xcd83('0x2b')][_0xcd83('0x1b')]);_0x351beb[_0xcd83('0x18')]=qs[_0xcd83('0x18')](_0x1ea112[_0xcd83('0x2b')]['offset']);}return _0xbaa519[_0xcd83('0x46')](_0x351beb);}})[_0xcd83('0x21')](function(_0x552bf9){if(_0x552bf9){return _0x552bf9?{'count':_0x19a1b4,'rows':_0x552bf9}:null;}})[_0xcd83('0x21')](respondWithResult(_0x45c2c6,null))[_0xcd83('0x3b')](handleError(_0x45c2c6,null));};exports[_0xcd83('0x49')]=function(_0x30ed85,_0x2aa360,_0x4e1592){var _0x1bdfa4={};var _0x33a165={};var _0x2be9d3;var _0x524a58;return db['ServicenowConfiguration'][_0xcd83('0x47')]({'where':{'id':_0x30ed85[_0xcd83('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2aa360,null))[_0xcd83('0x21')](function(_0x460480){if(_0x460480){_0x2be9d3=_0x460480;_0x33a165[_0xcd83('0x2f')]=_[_0xcd83('0x2c')](db[_0xcd83('0x43')][_0xcd83('0x29')]);_0x33a165['query']=_[_0xcd83('0x2c')](_0x30ed85[_0xcd83('0x2b')]);_0x33a165['filters']=_[_0xcd83('0x2e')](_0x33a165[_0xcd83('0x2f')],_0x33a165['query']);_0x1bdfa4[_0xcd83('0x30')]=_[_0xcd83('0x2e')](_0x33a165[_0xcd83('0x2f')],qs[_0xcd83('0x3d')](_0x30ed85[_0xcd83('0x2b')]['fields']));_0x1bdfa4[_0xcd83('0x30')]=_0x1bdfa4['attributes'][_0xcd83('0x31')]?_0x1bdfa4['attributes']:_0x33a165[_0xcd83('0x2f')];_0x1bdfa4[_0xcd83('0x32')]=qs[_0xcd83('0x33')](_0x30ed85[_0xcd83('0x2b')][_0xcd83('0x33')]);_0x1bdfa4[_0xcd83('0x34')]=qs[_0xcd83('0x2d')](_[_0xcd83('0x44')](_0x30ed85[_0xcd83('0x2b')],_0x33a165['filters']));if(_0x30ed85['query'][_0xcd83('0x37')]){_0x1bdfa4[_0xcd83('0x34')]=_['merge'](_0x1bdfa4[_0xcd83('0x34')],{'$or':_[_0xcd83('0x27')](_0x1bdfa4['attributes'],function(_0x32eaf7){var _0x3d1e58={};_0x3d1e58[_0x32eaf7]={'$like':'%'+_0x30ed85['query'][_0xcd83('0x37')]+'%'};return _0x3d1e58;})});}_0x1bdfa4=_['merge']({},_0x1bdfa4,_0x30ed85[_0xcd83('0x39')]);return _0x2be9d3[_0xcd83('0x49')](_0x1bdfa4);}})[_0xcd83('0x21')](function(_0x5b4fca){if(_0x5b4fca){_0x524a58=_0x5b4fca['length'];if(!_0x30ed85[_0xcd83('0x2b')]['hasOwnProperty'](_0xcd83('0x48'))){_0x1bdfa4[_0xcd83('0x1b')]=qs[_0xcd83('0x1b')](_0x30ed85[_0xcd83('0x2b')][_0xcd83('0x1b')]);_0x1bdfa4[_0xcd83('0x18')]=qs['offset'](_0x30ed85[_0xcd83('0x2b')]['offset']);}return _0x2be9d3[_0xcd83('0x49')](_0x1bdfa4);}})[_0xcd83('0x21')](function(_0x14d740){if(_0x14d740){return _0x14d740?{'count':_0x524a58,'rows':_0x14d740}:null;}})['then'](respondWithResult(_0x2aa360,null))[_0xcd83('0x3b')](handleError(_0x2aa360,null));}; \ No newline at end of file +var _0xb6dc=['api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','length','find','catch','create','body','params','findOne','ServicenowField','getFields','hasOwnProperty','getSubjects','order','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3a57b0,_0x23145a){var _0x2b8f3e=function(_0x1c721a){while(--_0x1c721a){_0x3a57b0['push'](_0x3a57b0['shift']());}};_0x2b8f3e(++_0x23145a);}(_0xb6dc,0x1d9));var _0xcb6d=function(_0x3b98d5,_0x31167c){_0x3b98d5=_0x3b98d5-0x0;var _0x3054dc=_0xb6dc[_0x3b98d5];return _0x3054dc;};'use strict';var emlformat=require(_0xcb6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb6d('0x1'));var jsonpatch=require(_0xcb6d('0x2'));var rp=require(_0xcb6d('0x3'));var moment=require('moment');var BPromise=require(_0xcb6d('0x4'));var Mustache=require(_0xcb6d('0x5'));var util=require(_0xcb6d('0x6'));var path=require('path');var sox=require(_0xcb6d('0x7'));var csv=require(_0xcb6d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb6d('0x9'));var _=require(_0xcb6d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcb6d('0xb'));var deskjs=require(_0xcb6d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcb6d('0xd'));var Papa=require(_0xcb6d('0xe'));var Redis=require(_0xcb6d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcb6d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb6d('0x11'));var logger=require(_0xcb6d('0x12'))(_0xcb6d('0x13'));var utils=require(_0xcb6d('0x14'));var config=require(_0xcb6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb6d('0x16'))['db'];function respondWithStatusCode(_0x1ae5ba,_0x38da4f){_0x38da4f=_0x38da4f||0xcc;return function(_0x1e6f87){if(_0x1e6f87){return _0x1ae5ba['sendStatus'](_0x38da4f);}return _0x1ae5ba['status'](_0x38da4f)[_0xcb6d('0x17')]();};}function respondWithResult(_0x3b10a1,_0x58a89c){_0x58a89c=_0x58a89c||0xc8;return function(_0x408e97){if(_0x408e97){return _0x3b10a1['status'](_0x58a89c)[_0xcb6d('0x18')](_0x408e97);}};}function respondWithFilteredResult(_0x3e6ece,_0x367b60){return function(_0x2d392c){if(_0x2d392c){var _0x530a60=typeof _0x367b60[_0xcb6d('0x19')]===_0xcb6d('0x1a')&&typeof _0x367b60[_0xcb6d('0x1b')]===_0xcb6d('0x1a');var _0x5d4a1d=_0x2d392c[_0xcb6d('0x1c')];var _0x2e2d1c=_0x530a60?0x0:_0x367b60[_0xcb6d('0x19')];var _0x2c5e46=_0x530a60?_0x2d392c[_0xcb6d('0x1c')]:_0x367b60[_0xcb6d('0x19')]+_0x367b60[_0xcb6d('0x1b')];var _0x3c1ad5;if(_0x2c5e46>=_0x5d4a1d){_0x2c5e46=_0x5d4a1d;_0x3c1ad5=0xc8;}else{_0x3c1ad5=0xce;}_0x3e6ece[_0xcb6d('0x1d')](_0x3c1ad5);return _0x3e6ece[_0xcb6d('0x1e')](_0xcb6d('0x1f'),_0x2e2d1c+'-'+_0x2c5e46+'/'+_0x5d4a1d)[_0xcb6d('0x18')](_0x2d392c);}return null;};}function patchUpdates(_0x16dd2e){return function(_0x35b648){try{jsonpatch[_0xcb6d('0x20')](_0x35b648,_0x16dd2e,!![]);}catch(_0x41a284){return BPromise[_0xcb6d('0x21')](_0x41a284);}return _0x35b648[_0xcb6d('0x22')]();};}function saveUpdates(_0xf7dbda,_0xa9763b){return function(_0x3d3b59){if(_0x3d3b59){return _0x3d3b59[_0xcb6d('0x23')](_0xf7dbda)[_0xcb6d('0x24')](function(_0x3c5183){return _0x3c5183;});}return null;};}function removeEntity(_0x29552c,_0x1be487){return function(_0x320b76){if(_0x320b76){return _0x320b76[_0xcb6d('0x25')]()[_0xcb6d('0x24')](function(){_0x29552c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42cbdf,_0x27cb53){return function(_0x488f4d){if(!_0x488f4d){_0x42cbdf[_0xcb6d('0x26')](0x194);}return _0x488f4d;};}function handleError(_0x284990,_0x5d3604){_0x5d3604=_0x5d3604||0x1f4;return function(_0x196aab){logger[_0xcb6d('0x27')](_0x196aab[_0xcb6d('0x28')]);if(_0x196aab[_0xcb6d('0x29')]){delete _0x196aab[_0xcb6d('0x29')];}_0x284990[_0xcb6d('0x1d')](_0x5d3604)[_0xcb6d('0x2a')](_0x196aab);};}exports[_0xcb6d('0x2b')]=function(_0x2f89dd,_0x5309bb){var _0x3cadf3={},_0x2c2fc9={},_0x507f8c={'count':0x0,'rows':[]};var _0x3a22a1=_['map'](db[_0xcb6d('0x2c')][_0xcb6d('0x2d')],function(_0x592bcf){return{'name':_0x592bcf[_0xcb6d('0x2e')],'type':_0x592bcf[_0xcb6d('0x2f')][_0xcb6d('0x30')]};});_0x2c2fc9['model']=_['map'](_0x3a22a1,_0xcb6d('0x29'));_0x2c2fc9[_0xcb6d('0x31')]=_[_0xcb6d('0x32')](_0x2f89dd[_0xcb6d('0x31')]);_0x2c2fc9[_0xcb6d('0x33')]=_[_0xcb6d('0x34')](_0x2c2fc9['model'],_0x2c2fc9[_0xcb6d('0x31')]);_0x3cadf3['attributes']=_['intersection'](_0x2c2fc9[_0xcb6d('0x35')],qs['fields'](_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x36')]));_0x3cadf3[_0xcb6d('0x37')]=_0x3cadf3[_0xcb6d('0x37')]['length']?_0x3cadf3[_0xcb6d('0x37')]:_0x2c2fc9[_0xcb6d('0x35')];if(!_0x2f89dd[_0xcb6d('0x31')]['hasOwnProperty'](_0xcb6d('0x38'))){_0x3cadf3[_0xcb6d('0x1b')]=qs[_0xcb6d('0x1b')](_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x1b')]);_0x3cadf3[_0xcb6d('0x19')]=qs[_0xcb6d('0x19')](_0x2f89dd['query'][_0xcb6d('0x19')]);}_0x3cadf3['order']=qs[_0xcb6d('0x39')](_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x39')]);_0x3cadf3[_0xcb6d('0x3a')]=qs[_0xcb6d('0x33')](_[_0xcb6d('0x3b')](_0x2f89dd[_0xcb6d('0x31')],_0x2c2fc9[_0xcb6d('0x33')]),_0x3a22a1);if(_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x3c')]){_0x3cadf3[_0xcb6d('0x3a')]=_[_0xcb6d('0x3d')](_0x3cadf3['where'],{'$or':_[_0xcb6d('0x3e')](_0x3a22a1,function(_0x199a08){if(_0x199a08[_0xcb6d('0x2f')]!==_0xcb6d('0x3f')){var _0x21c8db={};_0x21c8db[_0x199a08[_0xcb6d('0x29')]]={'$like':'%'+_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x3c')]+'%'};return _0x21c8db;}})});}_0x3cadf3=_[_0xcb6d('0x3d')]({},_0x3cadf3,_0x2f89dd[_0xcb6d('0x40')]);var _0x2a2cd6={'where':_0x3cadf3[_0xcb6d('0x3a')]};return db['ServicenowConfiguration'][_0xcb6d('0x1c')](_0x2a2cd6)[_0xcb6d('0x24')](function(_0x28a902){_0x507f8c[_0xcb6d('0x1c')]=_0x28a902;if(_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x41')]){_0x3cadf3[_0xcb6d('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x3cadf3);})['then'](function(_0x857152){_0x507f8c[_0xcb6d('0x43')]=_0x857152;return _0x507f8c;})['then'](respondWithFilteredResult(_0x5309bb,_0x3cadf3))['catch'](handleError(_0x5309bb,null));};exports[_0xcb6d('0x44')]=function(_0x162a55,_0x114ed4){var _0x3e30a3={'raw':![],'where':{'id':_0x162a55['params']['id']}},_0x528002={};_0x528002[_0xcb6d('0x35')]=_[_0xcb6d('0x32')](db['ServicenowConfiguration'][_0xcb6d('0x2d')]);_0x528002['query']=_['keys'](_0x162a55[_0xcb6d('0x31')]);_0x528002[_0xcb6d('0x33')]=_['intersection'](_0x528002[_0xcb6d('0x35')],_0x528002['query']);_0x3e30a3[_0xcb6d('0x37')]=_['intersection'](_0x528002[_0xcb6d('0x35')],qs[_0xcb6d('0x36')](_0x162a55['query'][_0xcb6d('0x36')]));_0x3e30a3['attributes']=_0x3e30a3[_0xcb6d('0x37')][_0xcb6d('0x45')]?_0x3e30a3['attributes']:_0x528002[_0xcb6d('0x35')];if(_0x162a55[_0xcb6d('0x31')]['includeAll']){_0x3e30a3['include']=[{'all':!![]}];}_0x3e30a3=_[_0xcb6d('0x3d')]({},_0x3e30a3,_0x162a55[_0xcb6d('0x40')]);return db['ServicenowConfiguration'][_0xcb6d('0x46')](_0x3e30a3)[_0xcb6d('0x24')](handleEntityNotFound(_0x114ed4,null))[_0xcb6d('0x24')](respondWithResult(_0x114ed4,null))[_0xcb6d('0x47')](handleError(_0x114ed4,null));};exports['create']=function(_0x40cbc3,_0x1a76cd){return db[_0xcb6d('0x2c')][_0xcb6d('0x48')](_0x40cbc3[_0xcb6d('0x49')],{})[_0xcb6d('0x24')](respondWithResult(_0x1a76cd,0xc9))['catch'](handleError(_0x1a76cd,null));};exports['update']=function(_0x50ecd4,_0x1d9bfb){if(_0x50ecd4['body']['id']){delete _0x50ecd4[_0xcb6d('0x49')]['id'];}return db[_0xcb6d('0x2c')][_0xcb6d('0x46')]({'where':{'id':_0x50ecd4[_0xcb6d('0x4a')]['id']}})[_0xcb6d('0x24')](handleEntityNotFound(_0x1d9bfb,null))[_0xcb6d('0x24')](saveUpdates(_0x50ecd4[_0xcb6d('0x49')],null))[_0xcb6d('0x24')](respondWithResult(_0x1d9bfb,null))['catch'](handleError(_0x1d9bfb,null));};exports[_0xcb6d('0x25')]=function(_0x1ccf12,_0x4fb26f){return db[_0xcb6d('0x2c')][_0xcb6d('0x46')]({'where':{'id':_0x1ccf12['params']['id']}})[_0xcb6d('0x24')](handleEntityNotFound(_0x4fb26f,null))[_0xcb6d('0x24')](removeEntity(_0x4fb26f,null))[_0xcb6d('0x47')](handleError(_0x4fb26f,null));};exports['getFields']=function(_0x49b11b,_0x5256de,_0x24a4d0){var _0x2ca54b={};var _0x5e1188={};var _0x41eebc;var _0x23f8a9;return db[_0xcb6d('0x2c')][_0xcb6d('0x4b')]({'where':{'id':_0x49b11b[_0xcb6d('0x4a')]['id']}})[_0xcb6d('0x24')](handleEntityNotFound(_0x5256de,null))[_0xcb6d('0x24')](function(_0xbb44e7){if(_0xbb44e7){_0x41eebc=_0xbb44e7;_0x5e1188[_0xcb6d('0x35')]=_[_0xcb6d('0x32')](db[_0xcb6d('0x4c')][_0xcb6d('0x2d')]);_0x5e1188[_0xcb6d('0x31')]=_[_0xcb6d('0x32')](_0x49b11b[_0xcb6d('0x31')]);_0x5e1188['filters']=_[_0xcb6d('0x34')](_0x5e1188[_0xcb6d('0x35')],_0x5e1188[_0xcb6d('0x31')]);_0x2ca54b[_0xcb6d('0x37')]=_[_0xcb6d('0x34')](_0x5e1188[_0xcb6d('0x35')],qs[_0xcb6d('0x36')](_0x49b11b['query'][_0xcb6d('0x36')]));_0x2ca54b[_0xcb6d('0x37')]=_0x2ca54b[_0xcb6d('0x37')][_0xcb6d('0x45')]?_0x2ca54b[_0xcb6d('0x37')]:_0x5e1188[_0xcb6d('0x35')];_0x2ca54b['order']=qs[_0xcb6d('0x39')](_0x49b11b[_0xcb6d('0x31')][_0xcb6d('0x39')]);_0x2ca54b['where']=qs[_0xcb6d('0x33')](_[_0xcb6d('0x3b')](_0x49b11b[_0xcb6d('0x31')],_0x5e1188[_0xcb6d('0x33')]));if(_0x49b11b[_0xcb6d('0x31')][_0xcb6d('0x3c')]){_0x2ca54b['where']=_['merge'](_0x2ca54b['where'],{'$or':_[_0xcb6d('0x3e')](_0x2ca54b[_0xcb6d('0x37')],function(_0x231aec){var _0x2d3ad2={};_0x2d3ad2[_0x231aec]={'$like':'%'+_0x49b11b[_0xcb6d('0x31')][_0xcb6d('0x3c')]+'%'};return _0x2d3ad2;})});}_0x2ca54b=_[_0xcb6d('0x3d')]({},_0x2ca54b,_0x49b11b[_0xcb6d('0x40')]);return _0x41eebc[_0xcb6d('0x4d')](_0x2ca54b);}})[_0xcb6d('0x24')](function(_0xbbe69a){if(_0xbbe69a){_0x23f8a9=_0xbbe69a[_0xcb6d('0x45')];if(!_0x49b11b['query'][_0xcb6d('0x4e')](_0xcb6d('0x38'))){_0x2ca54b[_0xcb6d('0x1b')]=qs[_0xcb6d('0x1b')](_0x49b11b['query'][_0xcb6d('0x1b')]);_0x2ca54b['offset']=qs['offset'](_0x49b11b[_0xcb6d('0x31')][_0xcb6d('0x19')]);}return _0x41eebc[_0xcb6d('0x4d')](_0x2ca54b);}})[_0xcb6d('0x24')](function(_0x8be9d2){if(_0x8be9d2){return _0x8be9d2?{'count':_0x23f8a9,'rows':_0x8be9d2}:null;}})[_0xcb6d('0x24')](respondWithResult(_0x5256de,null))[_0xcb6d('0x47')](handleError(_0x5256de,null));};exports[_0xcb6d('0x4f')]=function(_0x1b91ce,_0x4222bb,_0xe67655){var _0x38ff00={};var _0xcc6cee={};var _0x5116a5;var _0x2e8288;return db[_0xcb6d('0x2c')][_0xcb6d('0x4b')]({'where':{'id':_0x1b91ce['params']['id']}})[_0xcb6d('0x24')](handleEntityNotFound(_0x4222bb,null))[_0xcb6d('0x24')](function(_0x437b1a){if(_0x437b1a){_0x5116a5=_0x437b1a;_0xcc6cee[_0xcb6d('0x35')]=_[_0xcb6d('0x32')](db[_0xcb6d('0x4c')]['rawAttributes']);_0xcc6cee[_0xcb6d('0x31')]=_[_0xcb6d('0x32')](_0x1b91ce[_0xcb6d('0x31')]);_0xcc6cee['filters']=_[_0xcb6d('0x34')](_0xcc6cee[_0xcb6d('0x35')],_0xcc6cee[_0xcb6d('0x31')]);_0x38ff00[_0xcb6d('0x37')]=_[_0xcb6d('0x34')](_0xcc6cee['model'],qs['fields'](_0x1b91ce[_0xcb6d('0x31')][_0xcb6d('0x36')]));_0x38ff00[_0xcb6d('0x37')]=_0x38ff00[_0xcb6d('0x37')]['length']?_0x38ff00[_0xcb6d('0x37')]:_0xcc6cee[_0xcb6d('0x35')];_0x38ff00[_0xcb6d('0x50')]=qs[_0xcb6d('0x39')](_0x1b91ce[_0xcb6d('0x31')][_0xcb6d('0x39')]);_0x38ff00[_0xcb6d('0x3a')]=qs['filters'](_['pick'](_0x1b91ce[_0xcb6d('0x31')],_0xcc6cee[_0xcb6d('0x33')]));if(_0x1b91ce['query']['filter']){_0x38ff00[_0xcb6d('0x3a')]=_[_0xcb6d('0x3d')](_0x38ff00[_0xcb6d('0x3a')],{'$or':_[_0xcb6d('0x3e')](_0x38ff00['attributes'],function(_0x5a3879){var _0x1c0273={};_0x1c0273[_0x5a3879]={'$like':'%'+_0x1b91ce[_0xcb6d('0x31')][_0xcb6d('0x3c')]+'%'};return _0x1c0273;})});}_0x38ff00=_[_0xcb6d('0x3d')]({},_0x38ff00,_0x1b91ce['options']);return _0x5116a5['getSubjects'](_0x38ff00);}})[_0xcb6d('0x24')](function(_0x2d4079){if(_0x2d4079){_0x2e8288=_0x2d4079[_0xcb6d('0x45')];if(!_0x1b91ce[_0xcb6d('0x31')][_0xcb6d('0x4e')](_0xcb6d('0x38'))){_0x38ff00[_0xcb6d('0x1b')]=qs['limit'](_0x1b91ce[_0xcb6d('0x31')][_0xcb6d('0x1b')]);_0x38ff00[_0xcb6d('0x19')]=qs[_0xcb6d('0x19')](_0x1b91ce['query'][_0xcb6d('0x19')]);}return _0x5116a5[_0xcb6d('0x4f')](_0x38ff00);}})[_0xcb6d('0x24')](function(_0x233293){if(_0x233293){return _0x233293?{'count':_0x2e8288,'rows':_0x233293}:null;}})['then'](respondWithResult(_0x4222bb,null))[_0xcb6d('0x47')](handleError(_0x4222bb,null));};exports[_0xcb6d('0x51')]=function(_0x320315,_0x46df46,_0x1c0637){var _0x374977={};var _0x5bfced={};var _0x2919d5;var _0x3ddfc8;return db[_0xcb6d('0x2c')]['findOne']({'where':{'id':_0x320315[_0xcb6d('0x4a')]['id']}})[_0xcb6d('0x24')](handleEntityNotFound(_0x46df46,null))['then'](function(_0x544cf5){if(_0x544cf5){_0x2919d5=_0x544cf5;_0x5bfced[_0xcb6d('0x35')]=_[_0xcb6d('0x32')](db[_0xcb6d('0x4c')]['rawAttributes']);_0x5bfced['query']=_[_0xcb6d('0x32')](_0x320315[_0xcb6d('0x31')]);_0x5bfced[_0xcb6d('0x33')]=_[_0xcb6d('0x34')](_0x5bfced['model'],_0x5bfced[_0xcb6d('0x31')]);_0x374977[_0xcb6d('0x37')]=_['intersection'](_0x5bfced['model'],qs[_0xcb6d('0x36')](_0x320315[_0xcb6d('0x31')][_0xcb6d('0x36')]));_0x374977[_0xcb6d('0x37')]=_0x374977[_0xcb6d('0x37')]['length']?_0x374977['attributes']:_0x5bfced[_0xcb6d('0x35')];_0x374977[_0xcb6d('0x50')]=qs['sort'](_0x320315[_0xcb6d('0x31')][_0xcb6d('0x39')]);_0x374977['where']=qs['filters'](_[_0xcb6d('0x3b')](_0x320315[_0xcb6d('0x31')],_0x5bfced[_0xcb6d('0x33')]));if(_0x320315[_0xcb6d('0x31')][_0xcb6d('0x3c')]){_0x374977['where']=_[_0xcb6d('0x3d')](_0x374977['where'],{'$or':_[_0xcb6d('0x3e')](_0x374977['attributes'],function(_0x3647df){var _0x36bc64={};_0x36bc64[_0x3647df]={'$like':'%'+_0x320315['query'][_0xcb6d('0x3c')]+'%'};return _0x36bc64;})});}_0x374977=_[_0xcb6d('0x3d')]({},_0x374977,_0x320315['options']);return _0x2919d5[_0xcb6d('0x51')](_0x374977);}})[_0xcb6d('0x24')](function(_0x3ad8b4){if(_0x3ad8b4){_0x3ddfc8=_0x3ad8b4[_0xcb6d('0x45')];if(!_0x320315[_0xcb6d('0x31')][_0xcb6d('0x4e')](_0xcb6d('0x38'))){_0x374977[_0xcb6d('0x1b')]=qs[_0xcb6d('0x1b')](_0x320315[_0xcb6d('0x31')][_0xcb6d('0x1b')]);_0x374977[_0xcb6d('0x19')]=qs[_0xcb6d('0x19')](_0x320315[_0xcb6d('0x31')][_0xcb6d('0x19')]);}return _0x2919d5['getDescriptions'](_0x374977);}})[_0xcb6d('0x24')](function(_0x2640f7){if(_0x2640f7){return _0x2640f7?{'count':_0x3ddfc8,'rows':_0x2640f7}:null;}})[_0xcb6d('0x24')](respondWithResult(_0x46df46,null))['catch'](handleError(_0x46df46,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2524b0e..80088fa 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 _0x6d2d=['int_servicenow_configurations','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration'];(function(_0x304b51,_0x4429f3){var _0x260c19=function(_0x501fd8){while(--_0x501fd8){_0x304b51['push'](_0x304b51['shift']());}};_0x260c19(++_0x4429f3);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x50170e,_0x5f2796){_0x50170e=_0x50170e-0x0;var _0x2dfe57=_0x6d2d[_0x50170e];return _0x2dfe57;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd6d2('0x0'))(_0xd6d2('0x1'));var moment=require(_0xd6d2('0x2'));var BPromise=require('bluebird');var rp=require(_0xd6d2('0x3'));var fs=require('fs');var path=require(_0xd6d2('0x4'));var rimraf=require(_0xd6d2('0x5'));var config=require(_0xd6d2('0x6'));var attributes=require(_0xd6d2('0x7'));module[_0xd6d2('0x8')]=function(_0x32ebf,_0x2265d5){return _0x32ebf['define'](_0xd6d2('0x9'),attributes,{'tableName':_0xd6d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x726f=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','request-promise','path','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x726f,0xa2));var _0xf726=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x726f[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xf726('0x0'));var util=require(_0xf726('0x1'));var logger=require('../../config/logger')(_0xf726('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf726('0x3'));var fs=require('fs');var path=require(_0xf726('0x4'));var rimraf=require(_0xf726('0x5'));var config=require(_0xf726('0x6'));var attributes=require(_0xf726('0x7'));module[_0xf726('0x8')]=function(_0x26ba00,_0x1cae3f){return _0x26ba00[_0xf726('0x9')](_0xf726('0xa'),attributes,{'tableName':_0xf726('0xb'),'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 8f7a157..25e8b22 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 _0x7636=['debug','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x12b1cb,_0x258104){var _0x54297f=function(_0xb17fa){while(--_0xb17fa){_0x12b1cb['push'](_0x12b1cb['shift']());}};_0x54297f(++_0x258104);}(_0x7636,0x1e1));var _0x6763=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x7636[_0x2bbc07];return _0x6879e4;};'use strict';var _=require(_0x6763('0x0'));var util=require('util');var moment=require(_0x6763('0x1'));var BPromise=require('bluebird');var rs=require(_0x6763('0x2'));var fs=require('fs');var Redis=require(_0x6763('0x3'));var db=require(_0x6763('0x4'))['db'];var utils=require(_0x6763('0x5'));var logger=require('../../config/logger')(_0x6763('0x6'));var config=require('../../config/environment');var jayson=require(_0x6763('0x7'));var client=jayson[_0x6763('0x8')][_0x6763('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4199a8,_0x531c0b,_0x518c50){return new BPromise(function(_0x176d38,_0x454c43){return client['request'](_0x4199a8,_0x518c50)['then'](function(_0x5f5243){logger[_0x6763('0xa')](_0x6763('0xb'),_0x531c0b,_0x6763('0xc'));logger[_0x6763('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x531c0b,'request\x20sent',JSON[_0x6763('0xe')](_0x5f5243));if(_0x5f5243[_0x6763('0xf')]){if(_0x5f5243[_0x6763('0xf')][_0x6763('0x10')]===0x1f4){logger[_0x6763('0xf')](_0x6763('0xb'),_0x531c0b,_0x5f5243['error'][_0x6763('0x11')]);return _0x454c43(_0x5f5243[_0x6763('0xf')]['message']);}logger['error'](_0x6763('0xb'),_0x531c0b,_0x5f5243[_0x6763('0xf')][_0x6763('0x11')]);return _0x176d38(_0x5f5243['error'][_0x6763('0x11')]);}else{logger[_0x6763('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x531c0b,_0x6763('0xc'));_0x176d38(_0x5f5243[_0x6763('0x12')][_0x6763('0x11')]);}})['catch'](function(_0x1e86e2){logger[_0x6763('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x531c0b,_0x1e86e2);_0x454c43(_0x1e86e2);});});} \ No newline at end of file +var _0x21ff=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','error','code','ServicenowConfiguration,\x20%s,\x20%s','message'];(function(_0x4ffb4f,_0x4b73af){var _0x1e28b8=function(_0x211420){while(--_0x211420){_0x4ffb4f['push'](_0x4ffb4f['shift']());}};_0x1e28b8(++_0x4b73af);}(_0x21ff,0x8c));var _0xf21f=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0x21ff[_0x56fb33];return _0x435ee4;};'use strict';var _=require(_0xf21f('0x0'));var util=require(_0xf21f('0x1'));var moment=require(_0xf21f('0x2'));var BPromise=require(_0xf21f('0x3'));var rs=require(_0xf21f('0x4'));var fs=require('fs');var Redis=require(_0xf21f('0x5'));var db=require(_0xf21f('0x6'))['db'];var utils=require(_0xf21f('0x7'));var logger=require(_0xf21f('0x8'))(_0xf21f('0x9'));var config=require(_0xf21f('0xa'));var jayson=require(_0xf21f('0xb'));var client=jayson[_0xf21f('0xc')][_0xf21f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5d82be,_0x4d3a6c,_0x2b5312){return new BPromise(function(_0x3d1f0f,_0x30fa7f){return client[_0xf21f('0xe')](_0x5d82be,_0x2b5312)['then'](function(_0x4a26c4){logger[_0xf21f('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4d3a6c,_0xf21f('0x10'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4d3a6c,_0xf21f('0x10'),JSON['stringify'](_0x4a26c4));if(_0x4a26c4[_0xf21f('0x11')]){if(_0x4a26c4[_0xf21f('0x11')][_0xf21f('0x12')]===0x1f4){logger[_0xf21f('0x11')](_0xf21f('0x13'),_0x4d3a6c,_0x4a26c4[_0xf21f('0x11')][_0xf21f('0x14')]);return _0x30fa7f(_0x4a26c4[_0xf21f('0x11')]['message']);}logger[_0xf21f('0x11')](_0xf21f('0x13'),_0x4d3a6c,_0x4a26c4[_0xf21f('0x11')]['message']);return _0x3d1f0f(_0x4a26c4[_0xf21f('0x11')][_0xf21f('0x14')]);}else{logger['info'](_0xf21f('0x13'),_0x4d3a6c,_0xf21f('0x10'));_0x3d1f0f(_0x4a26c4[_0xf21f('0x15')]['message']);}})[_0xf21f('0x16')](function(_0x92f6fb){logger[_0xf21f('0x11')](_0xf21f('0x13'),_0x4d3a6c,_0x92f6fb);_0x30fa7f(_0x92f6fb);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e7385b5..f3b2bec 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 _0x2774=['Router','fs-extra','../../config/environment','./intServicenowField.controller','get','index','isAuthenticated','show','create','put','/:id','update','delete','exports','util','path','connect-timeout','express'];(function(_0xe167b6,_0x551391){var _0x507735=function(_0x2ee0c3){while(--_0x2ee0c3){_0xe167b6['push'](_0xe167b6['shift']());}};_0x507735(++_0x551391);}(_0x2774,0x1ac));var _0x4277=function(_0xdc5d31,_0xa136b6){_0xdc5d31=_0xdc5d31-0x0;var _0x26254b=_0x2774[_0xdc5d31];return _0x26254b;};'use strict';var multer=require('multer');var util=require(_0x4277('0x0'));var path=require(_0x4277('0x1'));var timeout=require(_0x4277('0x2'));var express=require(_0x4277('0x3'));var router=express[_0x4277('0x4')]();var fs_extra=require(_0x4277('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4277('0x6'));var controller=require(_0x4277('0x7'));router[_0x4277('0x8')]('/',auth['isAuthenticated'](),controller[_0x4277('0x9')]);router[_0x4277('0x8')]('/:id',auth[_0x4277('0xa')](),controller[_0x4277('0xb')]);router['post']('/',auth[_0x4277('0xa')](),controller[_0x4277('0xc')]);router[_0x4277('0xd')](_0x4277('0xe'),auth[_0x4277('0xa')](),controller[_0x4277('0xf')]);router[_0x4277('0x10')](_0x4277('0xe'),auth[_0x4277('0xa')](),controller['destroy']);module[_0x4277('0x11')]=router; \ No newline at end of file +var _0xdd92=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','create','put','update','destroy','exports'];(function(_0x4eb20a,_0x289be0){var _0x4f625b=function(_0x5124af){while(--_0x5124af){_0x4eb20a['push'](_0x4eb20a['shift']());}};_0x4f625b(++_0x289be0);}(_0xdd92,0xd8));var _0x2dd9=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xdd92[_0x1573ea];return _0x51c0e2;};'use strict';var multer=require('multer');var util=require(_0x2dd9('0x0'));var path=require(_0x2dd9('0x1'));var timeout=require(_0x2dd9('0x2'));var express=require(_0x2dd9('0x3'));var router=express[_0x2dd9('0x4')]();var fs_extra=require(_0x2dd9('0x5'));var auth=require(_0x2dd9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2dd9('0x7'));var controller=require(_0x2dd9('0x8'));router[_0x2dd9('0x9')]('/',auth['isAuthenticated'](),controller[_0x2dd9('0xa')]);router[_0x2dd9('0x9')](_0x2dd9('0xb'),auth[_0x2dd9('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2dd9('0xd')]);router[_0x2dd9('0xe')](_0x2dd9('0xb'),auth['isAuthenticated'](),controller[_0x2dd9('0xf')]);router['delete'](_0x2dd9('0xb'),auth[_0x2dd9('0xc')](),controller[_0x2dd9('0x10')]);module[_0x2dd9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 273f700..227377d 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 _0x4e47=['variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','exports'];(function(_0x2ca5e9,_0x178e3f){var _0x4bf6ae=function(_0x386463){while(--_0x386463){_0x2ca5e9['push'](_0x2ca5e9['shift']());}};_0x4bf6ae(++_0x178e3f);}(_0x4e47,0xd7));var _0x74e4=function(_0x198e34,_0x22f156){_0x198e34=_0x198e34-0x0;var _0xe77cfd=_0x4e47[_0x198e34];return _0xe77cfd;};'use strict';var Sequelize=require('sequelize');module[_0x74e4('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x74e4('0x1'),_0x74e4('0x2'),_0x74e4('0x3'),_0x74e4('0x4')),'defaultValue':_0x74e4('0x5')},'content':{'type':Sequelize[_0x74e4('0x6')]},'key':{'type':Sequelize[_0x74e4('0x6')]},'keyType':{'type':Sequelize[_0x74e4('0x7')](_0x74e4('0x5'),_0x74e4('0x1'),_0x74e4('0x2'))},'keyContent':{'type':Sequelize[_0x74e4('0x6')]},'idField':{'type':Sequelize[_0x74e4('0x6')]},'nameField':{'type':Sequelize[_0x74e4('0x6')]},'customField':{'type':Sequelize[_0x74e4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x89b7=['STRING','ENUM','BOOLEAN','string','variable','keyValue','picklist'];(function(_0x2bb8ee,_0x442912){var _0xb597e7=function(_0x8e55d6){while(--_0x8e55d6){_0x2bb8ee['push'](_0x2bb8ee['shift']());}};_0xb597e7(++_0x442912);}(_0x89b7,0x129));var _0x789b=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x89b7[_0x3fe393];return _0x534d14;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x789b('0x0'),_0x789b('0x1'),'customVariable',_0x789b('0x2'),_0x789b('0x3')),'defaultValue':_0x789b('0x0')},'content':{'type':Sequelize[_0x789b('0x4')]},'key':{'type':Sequelize[_0x789b('0x4')]},'keyType':{'type':Sequelize[_0x789b('0x5')](_0x789b('0x0'),_0x789b('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x789b('0x4')]},'idField':{'type':Sequelize[_0x789b('0x4')]},'nameField':{'type':Sequelize[_0x789b('0x4')]},'customField':{'type':Sequelize[_0x789b('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x789b('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a8a87f3..2ebd963 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 _0xce9e=['rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','count','set','apply','save','update','then','error','send','index','map','ServicenowField'];(function(_0x2ad921,_0x10d50d){var _0x3aef83=function(_0x377e3a){while(--_0x377e3a){_0x2ad921['push'](_0x2ad921['shift']());}};_0x3aef83(++_0x10d50d);}(_0xce9e,0x142));var _0xece9=function(_0x14de91,_0x18abe0){_0x14de91=_0x14de91-0x0;var _0x46fee0=_0xce9e[_0x14de91];return _0x46fee0;};'use strict';var emlformat=require(_0xece9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xece9('0x1'));var jsonpatch=require(_0xece9('0x2'));var rp=require(_0xece9('0x3'));var moment=require(_0xece9('0x4'));var BPromise=require(_0xece9('0x5'));var Mustache=require(_0xece9('0x6'));var util=require(_0xece9('0x7'));var path=require(_0xece9('0x8'));var sox=require(_0xece9('0x9'));var csv=require(_0xece9('0xa'));var ejs=require(_0xece9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xece9('0xc'));var squel=require(_0xece9('0xd'));var crypto=require(_0xece9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xece9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xece9('0x10'));var Papa=require('papaparse');var Redis=require(_0xece9('0x11'));var authService=require(_0xece9('0x12'));var qs=require(_0xece9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xece9('0x14'));var logger=require(_0xece9('0x15'))(_0xece9('0x16'));var utils=require(_0xece9('0x17'));var config=require(_0xece9('0x18'));var licenseUtil=require(_0xece9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x62d312,_0x443d2f){_0x443d2f=_0x443d2f||0xcc;return function(_0x2c2417){if(_0x2c2417){return _0x62d312[_0xece9('0x1a')](_0x443d2f);}return _0x62d312['status'](_0x443d2f)[_0xece9('0x1b')]();};}function respondWithResult(_0x1eb738,_0x5e3e79){_0x5e3e79=_0x5e3e79||0xc8;return function(_0x3be0f6){if(_0x3be0f6){return _0x1eb738[_0xece9('0x1c')](_0x5e3e79)[_0xece9('0x1d')](_0x3be0f6);}};}function respondWithFilteredResult(_0x4b3ec3,_0xb91ba){return function(_0x5b443c){if(_0x5b443c){var _0xbb9ce5=typeof _0xb91ba[_0xece9('0x1e')]==='undefined'&&typeof _0xb91ba[_0xece9('0x1f')]==='undefined';var _0x199adc=_0x5b443c[_0xece9('0x20')];var _0x2df72e=_0xbb9ce5?0x0:_0xb91ba[_0xece9('0x1e')];var _0x5e6e26=_0xbb9ce5?_0x5b443c['count']:_0xb91ba[_0xece9('0x1e')]+_0xb91ba['limit'];var _0x119690;if(_0x5e6e26>=_0x199adc){_0x5e6e26=_0x199adc;_0x119690=0xc8;}else{_0x119690=0xce;}_0x4b3ec3[_0xece9('0x1c')](_0x119690);return _0x4b3ec3[_0xece9('0x21')]('Content-Range',_0x2df72e+'-'+_0x5e6e26+'/'+_0x199adc)['json'](_0x5b443c);}return null;};}function patchUpdates(_0xbbaf81){return function(_0x7f4c4e){try{jsonpatch[_0xece9('0x22')](_0x7f4c4e,_0xbbaf81,!![]);}catch(_0x57da12){return BPromise['reject'](_0x57da12);}return _0x7f4c4e[_0xece9('0x23')]();};}function saveUpdates(_0x5ec81c,_0x5be871){return function(_0x2d1e20){if(_0x2d1e20){return _0x2d1e20[_0xece9('0x24')](_0x5ec81c)[_0xece9('0x25')](function(_0xadff6b){return _0xadff6b;});}return null;};}function removeEntity(_0x1060c7,_0x34ab36){return function(_0x2de9a1){if(_0x2de9a1){return _0x2de9a1['destroy']()[_0xece9('0x25')](function(){_0x1060c7[_0xece9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c3cc7,_0x5353f5){return function(_0xbc8ef7){if(!_0xbc8ef7){_0x3c3cc7[_0xece9('0x1a')](0x194);}return _0xbc8ef7;};}function handleError(_0x47df00,_0x307a56){_0x307a56=_0x307a56||0x1f4;return function(_0x69ac8b){logger[_0xece9('0x26')](_0x69ac8b['stack']);if(_0x69ac8b['name']){delete _0x69ac8b['name'];}_0x47df00[_0xece9('0x1c')](_0x307a56)[_0xece9('0x27')](_0x69ac8b);};}exports[_0xece9('0x28')]=function(_0x56fbab,_0x143fa0){var _0x503a0b={},_0x3ca540={},_0x274525={'count':0x0,'rows':[]};var _0x1ac659=_[_0xece9('0x29')](db[_0xece9('0x2a')][_0xece9('0x2b')],function(_0x59b463){return{'name':_0x59b463[_0xece9('0x2c')],'type':_0x59b463[_0xece9('0x2d')][_0xece9('0x2e')]};});_0x3ca540[_0xece9('0x2f')]=_[_0xece9('0x29')](_0x1ac659,_0xece9('0x30'));_0x3ca540[_0xece9('0x31')]=_[_0xece9('0x32')](_0x56fbab['query']);_0x3ca540['filters']=_[_0xece9('0x33')](_0x3ca540[_0xece9('0x2f')],_0x3ca540[_0xece9('0x31')]);_0x503a0b[_0xece9('0x34')]=_['intersection'](_0x3ca540[_0xece9('0x2f')],qs[_0xece9('0x35')](_0x56fbab[_0xece9('0x31')]['fields']));_0x503a0b['attributes']=_0x503a0b[_0xece9('0x34')][_0xece9('0x36')]?_0x503a0b[_0xece9('0x34')]:_0x3ca540['model'];if(!_0x56fbab[_0xece9('0x31')]['hasOwnProperty'](_0xece9('0x37'))){_0x503a0b[_0xece9('0x1f')]=qs[_0xece9('0x1f')](_0x56fbab[_0xece9('0x31')]['limit']);_0x503a0b['offset']=qs[_0xece9('0x1e')](_0x56fbab[_0xece9('0x31')][_0xece9('0x1e')]);}_0x503a0b['order']=qs[_0xece9('0x38')](_0x56fbab[_0xece9('0x31')][_0xece9('0x38')]);_0x503a0b[_0xece9('0x39')]=qs[_0xece9('0x3a')](_[_0xece9('0x3b')](_0x56fbab['query'],_0x3ca540[_0xece9('0x3a')]),_0x1ac659);if(_0x56fbab[_0xece9('0x31')][_0xece9('0x3c')]){_0x503a0b[_0xece9('0x39')]=_[_0xece9('0x3d')](_0x503a0b['where'],{'$or':_[_0xece9('0x29')](_0x1ac659,function(_0x2f0e14){if(_0x2f0e14[_0xece9('0x2d')]!==_0xece9('0x3e')){var _0x3c029a={};_0x3c029a[_0x2f0e14[_0xece9('0x30')]]={'$like':'%'+_0x56fbab[_0xece9('0x31')]['filter']+'%'};return _0x3c029a;}})});}_0x503a0b=_[_0xece9('0x3d')]({},_0x503a0b,_0x56fbab[_0xece9('0x3f')]);var _0x250d54={'where':_0x503a0b[_0xece9('0x39')]};return db['ServicenowField'][_0xece9('0x20')](_0x250d54)[_0xece9('0x25')](function(_0x32d2e9){_0x274525[_0xece9('0x20')]=_0x32d2e9;if(_0x56fbab[_0xece9('0x31')][_0xece9('0x40')]){_0x503a0b[_0xece9('0x41')]=[{'all':!![]}];}return db['ServicenowField'][_0xece9('0x42')](_0x503a0b);})[_0xece9('0x25')](function(_0x465ee2){_0x274525[_0xece9('0x43')]=_0x465ee2;return _0x274525;})[_0xece9('0x25')](respondWithFilteredResult(_0x143fa0,_0x503a0b))[_0xece9('0x44')](handleError(_0x143fa0,null));};exports['show']=function(_0x2114ad,_0x1bc7e9){var _0x527577={'raw':!![],'where':{'id':_0x2114ad[_0xece9('0x45')]['id']}},_0x48e155={};_0x48e155[_0xece9('0x2f')]=_[_0xece9('0x32')](db['ServicenowField'][_0xece9('0x2b')]);_0x48e155['query']=_[_0xece9('0x32')](_0x2114ad[_0xece9('0x31')]);_0x48e155['filters']=_['intersection'](_0x48e155[_0xece9('0x2f')],_0x48e155[_0xece9('0x31')]);_0x527577[_0xece9('0x34')]=_['intersection'](_0x48e155[_0xece9('0x2f')],qs[_0xece9('0x35')](_0x2114ad['query']['fields']));_0x527577['attributes']=_0x527577[_0xece9('0x34')][_0xece9('0x36')]?_0x527577[_0xece9('0x34')]:_0x48e155[_0xece9('0x2f')];if(_0x2114ad[_0xece9('0x31')][_0xece9('0x40')]){_0x527577[_0xece9('0x41')]=[{'all':!![]}];}_0x527577=_[_0xece9('0x3d')]({},_0x527577,_0x2114ad[_0xece9('0x3f')]);return db[_0xece9('0x2a')][_0xece9('0x46')](_0x527577)[_0xece9('0x25')](handleEntityNotFound(_0x1bc7e9,null))[_0xece9('0x25')](respondWithResult(_0x1bc7e9,null))[_0xece9('0x44')](handleError(_0x1bc7e9,null));};exports[_0xece9('0x47')]=function(_0x206fe5,_0x4bedf6){return db[_0xece9('0x2a')][_0xece9('0x47')](_0x206fe5[_0xece9('0x48')],{})[_0xece9('0x25')](respondWithResult(_0x4bedf6,0xc9))[_0xece9('0x44')](handleError(_0x4bedf6,null));};exports[_0xece9('0x24')]=function(_0x3fcc97,_0x33ff80){if(_0x3fcc97[_0xece9('0x48')]['id']){delete _0x3fcc97['body']['id'];}return db['ServicenowField'][_0xece9('0x46')]({'where':{'id':_0x3fcc97[_0xece9('0x45')]['id']}})[_0xece9('0x25')](handleEntityNotFound(_0x33ff80,null))[_0xece9('0x25')](saveUpdates(_0x3fcc97[_0xece9('0x48')],null))[_0xece9('0x25')](respondWithResult(_0x33ff80,null))[_0xece9('0x44')](handleError(_0x33ff80,null));};exports['destroy']=function(_0x42eb66,_0x559fc8){return db[_0xece9('0x2a')]['find']({'where':{'id':_0x42eb66[_0xece9('0x45')]['id']}})[_0xece9('0x25')](handleEntityNotFound(_0x559fc8,null))[_0xece9('0x25')](removeEntity(_0x559fc8,null))['catch'](handleError(_0x559fc8,null));}; \ No newline at end of file +var _0xcee8=['send','index','map','ServicenowField','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','findAll','rows','catch','show','params','keys','rawAttributes','include','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name'];(function(_0x328052,_0x1f13b2){var _0x2cce53=function(_0x3140ad){while(--_0x3140ad){_0x328052['push'](_0x328052['shift']());}};_0x2cce53(++_0x1f13b2);}(_0xcee8,0x6d));var _0x8cee=function(_0x3059e8,_0x282ba8){_0x3059e8=_0x3059e8-0x0;var _0x389011=_0xcee8[_0x3059e8];return _0x389011;};'use strict';var emlformat=require(_0x8cee('0x0'));var rimraf=require(_0x8cee('0x1'));var zipdir=require(_0x8cee('0x2'));var jsonpatch=require(_0x8cee('0x3'));var rp=require('request-promise');var moment=require(_0x8cee('0x4'));var BPromise=require(_0x8cee('0x5'));var Mustache=require(_0x8cee('0x6'));var util=require(_0x8cee('0x7'));var path=require(_0x8cee('0x8'));var sox=require('sox');var csv=require(_0x8cee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8cee('0xa'));var _=require(_0x8cee('0xb'));var squel=require('squel');var crypto=require(_0x8cee('0xc'));var jsforce=require(_0x8cee('0xd'));var deskjs=require(_0x8cee('0xe'));var toCsv=require(_0x8cee('0x9'));var querystring=require('querystring');var Papa=require(_0x8cee('0xf'));var Redis=require(_0x8cee('0x10'));var authService=require(_0x8cee('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8cee('0x12'));var hardwareService=require(_0x8cee('0x13'));var logger=require(_0x8cee('0x14'))(_0x8cee('0x15'));var utils=require(_0x8cee('0x16'));var config=require(_0x8cee('0x17'));var licenseUtil=require(_0x8cee('0x18'));var db=require(_0x8cee('0x19'))['db'];function respondWithStatusCode(_0x39c12c,_0x418dab){_0x418dab=_0x418dab||0xcc;return function(_0xe03ec1){if(_0xe03ec1){return _0x39c12c[_0x8cee('0x1a')](_0x418dab);}return _0x39c12c[_0x8cee('0x1b')](_0x418dab)[_0x8cee('0x1c')]();};}function respondWithResult(_0x4fded0,_0x4d3072){_0x4d3072=_0x4d3072||0xc8;return function(_0x4f5143){if(_0x4f5143){return _0x4fded0[_0x8cee('0x1b')](_0x4d3072)[_0x8cee('0x1d')](_0x4f5143);}};}function respondWithFilteredResult(_0x2cfbba,_0x3c9793){return function(_0x3c0cef){if(_0x3c0cef){var _0xd03d89=typeof _0x3c9793[_0x8cee('0x1e')]==='undefined'&&typeof _0x3c9793['limit']==='undefined';var _0x4ed712=_0x3c0cef[_0x8cee('0x1f')];var _0x557f5f=_0xd03d89?0x0:_0x3c9793['offset'];var _0x2b246b=_0xd03d89?_0x3c0cef['count']:_0x3c9793[_0x8cee('0x1e')]+_0x3c9793[_0x8cee('0x20')];var _0x3831e5;if(_0x2b246b>=_0x4ed712){_0x2b246b=_0x4ed712;_0x3831e5=0xc8;}else{_0x3831e5=0xce;}_0x2cfbba[_0x8cee('0x1b')](_0x3831e5);return _0x2cfbba[_0x8cee('0x21')](_0x8cee('0x22'),_0x557f5f+'-'+_0x2b246b+'/'+_0x4ed712)['json'](_0x3c0cef);}return null;};}function patchUpdates(_0x3f470f){return function(_0xdd026e){try{jsonpatch[_0x8cee('0x23')](_0xdd026e,_0x3f470f,!![]);}catch(_0x4e55d6){return BPromise[_0x8cee('0x24')](_0x4e55d6);}return _0xdd026e[_0x8cee('0x25')]();};}function saveUpdates(_0x3f77b5,_0x5f17a6){return function(_0x2c2bce){if(_0x2c2bce){return _0x2c2bce[_0x8cee('0x26')](_0x3f77b5)[_0x8cee('0x27')](function(_0x49c14c){return _0x49c14c;});}return null;};}function removeEntity(_0x5cb840,_0x1a900f){return function(_0x2829da){if(_0x2829da){return _0x2829da[_0x8cee('0x28')]()[_0x8cee('0x27')](function(){_0x5cb840[_0x8cee('0x1b')](0xcc)[_0x8cee('0x1c')]();});}};}function handleEntityNotFound(_0x539a41,_0xaced8d){return function(_0xbeb761){if(!_0xbeb761){_0x539a41[_0x8cee('0x1a')](0x194);}return _0xbeb761;};}function handleError(_0x40a9d5,_0x40db9a){_0x40db9a=_0x40db9a||0x1f4;return function(_0x3ddb8d){logger['error'](_0x3ddb8d[_0x8cee('0x29')]);if(_0x3ddb8d[_0x8cee('0x2a')]){delete _0x3ddb8d[_0x8cee('0x2a')];}_0x40a9d5[_0x8cee('0x1b')](_0x40db9a)[_0x8cee('0x2b')](_0x3ddb8d);};}exports[_0x8cee('0x2c')]=function(_0x54d871,_0x5adce8){var _0x54b807={},_0x54c62f={},_0x1611ee={'count':0x0,'rows':[]};var _0x3745ed=_[_0x8cee('0x2d')](db[_0x8cee('0x2e')]['rawAttributes'],function(_0x24ff4f){return{'name':_0x24ff4f[_0x8cee('0x2f')],'type':_0x24ff4f[_0x8cee('0x30')][_0x8cee('0x31')]};});_0x54c62f['model']=_['map'](_0x3745ed,'name');_0x54c62f[_0x8cee('0x32')]=_['keys'](_0x54d871[_0x8cee('0x32')]);_0x54c62f[_0x8cee('0x33')]=_['intersection'](_0x54c62f[_0x8cee('0x34')],_0x54c62f[_0x8cee('0x32')]);_0x54b807['attributes']=_[_0x8cee('0x35')](_0x54c62f['model'],qs[_0x8cee('0x36')](_0x54d871[_0x8cee('0x32')][_0x8cee('0x36')]));_0x54b807[_0x8cee('0x37')]=_0x54b807['attributes'][_0x8cee('0x38')]?_0x54b807[_0x8cee('0x37')]:_0x54c62f['model'];if(!_0x54d871['query'][_0x8cee('0x39')](_0x8cee('0x3a'))){_0x54b807[_0x8cee('0x20')]=qs[_0x8cee('0x20')](_0x54d871[_0x8cee('0x32')][_0x8cee('0x20')]);_0x54b807[_0x8cee('0x1e')]=qs[_0x8cee('0x1e')](_0x54d871['query'][_0x8cee('0x1e')]);}_0x54b807[_0x8cee('0x3b')]=qs[_0x8cee('0x3c')](_0x54d871[_0x8cee('0x32')][_0x8cee('0x3c')]);_0x54b807[_0x8cee('0x3d')]=qs['filters'](_[_0x8cee('0x3e')](_0x54d871[_0x8cee('0x32')],_0x54c62f[_0x8cee('0x33')]),_0x3745ed);if(_0x54d871['query']['filter']){_0x54b807[_0x8cee('0x3d')]=_[_0x8cee('0x3f')](_0x54b807[_0x8cee('0x3d')],{'$or':_[_0x8cee('0x2d')](_0x3745ed,function(_0x23845e){if(_0x23845e[_0x8cee('0x30')]!=='VIRTUAL'){var _0x4860fb={};_0x4860fb[_0x23845e['name']]={'$like':'%'+_0x54d871[_0x8cee('0x32')][_0x8cee('0x40')]+'%'};return _0x4860fb;}})});}_0x54b807=_[_0x8cee('0x3f')]({},_0x54b807,_0x54d871['options']);var _0x226d82={'where':_0x54b807[_0x8cee('0x3d')]};return db[_0x8cee('0x2e')][_0x8cee('0x1f')](_0x226d82)['then'](function(_0x45dd65){_0x1611ee['count']=_0x45dd65;if(_0x54d871[_0x8cee('0x32')]['includeAll']){_0x54b807['include']=[{'all':!![]}];}return db[_0x8cee('0x2e')][_0x8cee('0x41')](_0x54b807);})[_0x8cee('0x27')](function(_0x2fa7d2){_0x1611ee[_0x8cee('0x42')]=_0x2fa7d2;return _0x1611ee;})[_0x8cee('0x27')](respondWithFilteredResult(_0x5adce8,_0x54b807))[_0x8cee('0x43')](handleError(_0x5adce8,null));};exports[_0x8cee('0x44')]=function(_0x32b5c5,_0xf1f872){var _0x1ca061={'raw':!![],'where':{'id':_0x32b5c5[_0x8cee('0x45')]['id']}},_0x3d2a28={};_0x3d2a28[_0x8cee('0x34')]=_[_0x8cee('0x46')](db[_0x8cee('0x2e')][_0x8cee('0x47')]);_0x3d2a28['query']=_[_0x8cee('0x46')](_0x32b5c5[_0x8cee('0x32')]);_0x3d2a28[_0x8cee('0x33')]=_[_0x8cee('0x35')](_0x3d2a28[_0x8cee('0x34')],_0x3d2a28[_0x8cee('0x32')]);_0x1ca061[_0x8cee('0x37')]=_[_0x8cee('0x35')](_0x3d2a28[_0x8cee('0x34')],qs[_0x8cee('0x36')](_0x32b5c5['query'][_0x8cee('0x36')]));_0x1ca061['attributes']=_0x1ca061[_0x8cee('0x37')]['length']?_0x1ca061[_0x8cee('0x37')]:_0x3d2a28[_0x8cee('0x34')];if(_0x32b5c5[_0x8cee('0x32')]['includeAll']){_0x1ca061[_0x8cee('0x48')]=[{'all':!![]}];}_0x1ca061=_['merge']({},_0x1ca061,_0x32b5c5[_0x8cee('0x49')]);return db[_0x8cee('0x2e')][_0x8cee('0x4a')](_0x1ca061)[_0x8cee('0x27')](handleEntityNotFound(_0xf1f872,null))[_0x8cee('0x27')](respondWithResult(_0xf1f872,null))['catch'](handleError(_0xf1f872,null));};exports['create']=function(_0x5b6e6c,_0x5116c8){return db[_0x8cee('0x2e')]['create'](_0x5b6e6c[_0x8cee('0x4b')],{})[_0x8cee('0x27')](respondWithResult(_0x5116c8,0xc9))[_0x8cee('0x43')](handleError(_0x5116c8,null));};exports[_0x8cee('0x26')]=function(_0x4442c4,_0x2c6124){if(_0x4442c4[_0x8cee('0x4b')]['id']){delete _0x4442c4[_0x8cee('0x4b')]['id'];}return db[_0x8cee('0x2e')][_0x8cee('0x4a')]({'where':{'id':_0x4442c4[_0x8cee('0x45')]['id']}})[_0x8cee('0x27')](handleEntityNotFound(_0x2c6124,null))['then'](saveUpdates(_0x4442c4['body'],null))[_0x8cee('0x27')](respondWithResult(_0x2c6124,null))[_0x8cee('0x43')](handleError(_0x2c6124,null));};exports[_0x8cee('0x28')]=function(_0x30436d,_0x4836e3){return db['ServicenowField'][_0x8cee('0x4a')]({'where':{'id':_0x30436d[_0x8cee('0x45')]['id']}})['then'](handleEntityNotFound(_0x4836e3,null))[_0x8cee('0x27')](removeEntity(_0x4836e3,null))[_0x8cee('0x43')](handleError(_0x4836e3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index fe6c834..d4b75d1 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 _0x9303=['./intServicenowField.attributes','exports','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','api','bluebird','rimraf','../../config/environment'];(function(_0x24c712,_0x27ab32){var _0x47ebe5=function(_0x24c73f){while(--_0x24c73f){_0x24c712['push'](_0x24c712['shift']());}};_0x47ebe5(++_0x27ab32);}(_0x9303,0xd7));var _0x3930=function(_0x36f5ae,_0x53960b){_0x36f5ae=_0x36f5ae-0x0;var _0x10c86c=_0x9303[_0x36f5ae];return _0x10c86c;};'use strict';var _=require(_0x3930('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3930('0x1'));var moment=require('moment');var BPromise=require(_0x3930('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3930('0x3'));var config=require(_0x3930('0x4'));var attributes=require(_0x3930('0x5'));module[_0x3930('0x6')]=function(_0x57e19d,_0x44949e){return _0x57e19d['define']('ServicenowField',attributes,{'tableName':_0x3930('0x7'),'paranoid':![],'indexes':[{'name':_0x3930('0x8'),'fields':[_0x3930('0x9'),_0x3930('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe305=['rimraf','../../config/environment','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x521f7d,_0x2febe1){var _0x5a63da=function(_0x51f559){while(--_0x51f559){_0x521f7d['push'](_0x521f7d['shift']());}};_0x5a63da(++_0x2febe1);}(_0xe305,0x11f));var _0x5e30=function(_0x362c6a,_0xa80cbc){_0x362c6a=_0x362c6a-0x0;var _0x4231d9=_0xe305[_0x362c6a];return _0x4231d9;};'use strict';var _=require(_0x5e30('0x0'));var util=require(_0x5e30('0x1'));var logger=require(_0x5e30('0x2'))(_0x5e30('0x3'));var moment=require('moment');var BPromise=require(_0x5e30('0x4'));var rp=require(_0x5e30('0x5'));var fs=require('fs');var path=require(_0x5e30('0x6'));var rimraf=require(_0x5e30('0x7'));var config=require(_0x5e30('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x5e30('0x9')]=function(_0x297dab,_0xea1d72){return _0x297dab['define'](_0x5e30('0xa'),attributes,{'tableName':_0x5e30('0xb'),'paranoid':![],'indexes':[{'name':_0x5e30('0xc'),'fields':['idField',_0x5e30('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 4926f1e..ab31b8c 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 _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x5ca298,_0x11e51b){var _0x3b3391=function(_0x2c16f3){while(--_0x2c16f3){_0x5ca298['push'](_0x5ca298['shift']());}};_0x3b3391(++_0x11e51b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 _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(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xda3f,0xec));var _0xfda3=function(_0xa89337,_0x417099){_0xa89337=_0xa89337-0x0;var _0xf6410d=_0xda3f[_0xa89337];return _0xf6410d;};'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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 641b451..72d59ee 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(_0x5ed4be,_0x11c96b){var _0x16a4ad=function(_0x3d08b7){while(--_0x3d08b7){_0x5ed4be['push'](_0x5ed4be['shift']());}};_0x16a4ad(++_0x11c96b);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x309f70,_0x4209e9){var _0x5578dc=function(_0x28159b){while(--_0x28159b){_0x309f70['push'](_0x309f70['shift']());}};_0x5578dc(++_0x4209e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 1d452f1..3713fa5 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(_0x24c31d,_0xf069f8){var _0x1f4d9f=function(_0x41c17c){while(--_0x41c17c){_0x24c31d['push'](_0x24c31d['shift']());}};_0x1f4d9f(++_0xf069f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x193a10,_0xb4fb8e){var _0x3a16ab=function(_0x9b5254){while(--_0x9b5254){_0x193a10['push'](_0x193a10['shift']());}};_0x3a16ab(++_0xb4fb8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 e518081..48012d0 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 _0x16c0=['duration_hours','duration_minutes','parent_id','direction','password','remoteUri','slice','substring','lastIndexOf','format','JSON','stringify','username','PLAIN','Invalid\x20Login','POST','%s%s','/service/v4_1/rest.php','Calls','values','module_fields','remove','includes','label','endsWith','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','mustache','to-csv','ejs','fs-extra','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','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','SugarcrmAccount','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','find','create','body','getConfigurations','SugarcrmConfiguration','nolimit','addConfiguration','findOne','AccountId','getSubjects','channel','SugarcrmField','Subjects','Descriptions','assigned_user_id','created_by','description','date_start'];(function(_0x2b66ed,_0x3ece7f){var _0x860fe6=function(_0x5a2ff7){while(--_0x5a2ff7){_0x2b66ed['push'](_0x2b66ed['shift']());}};_0x860fe6(++_0x3ece7f);}(_0x16c0,0x181));var _0x016c=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x16c0[_0x59ee41];return _0x3ecd3e;};'use strict';var emlformat=require(_0x016c('0x0'));var rimraf=require(_0x016c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x016c('0x2'));var rp=require('request-promise');var moment=require(_0x016c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x016c('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x016c('0x5'));var ejs=require(_0x016c('0x6'));var fs=require('fs');var fs_extra=require(_0x016c('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x016c('0x8'));var deskjs=require(_0x016c('0x9'));var toCsv=require(_0x016c('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x016c('0xa'));var authService=require(_0x016c('0xb'));var qs=require(_0x016c('0xc'));var as=require(_0x016c('0xd'));var hardwareService=require(_0x016c('0xe'));var logger=require(_0x016c('0xf'))(_0x016c('0x10'));var utils=require(_0x016c('0x11'));var config=require(_0x016c('0x12'));var licenseUtil=require(_0x016c('0x13'));var db=require(_0x016c('0x14'))['db'];var integrations=require(_0x016c('0x15'));function respondWithStatusCode(_0x205493,_0x555d5e){_0x555d5e=_0x555d5e||0xcc;return function(_0x5a5322){if(_0x5a5322){return _0x205493[_0x016c('0x16')](_0x555d5e);}return _0x205493['status'](_0x555d5e)[_0x016c('0x17')]();};}function respondWithResult(_0x112c81,_0x5dd38b){_0x5dd38b=_0x5dd38b||0xc8;return function(_0x39a01b){if(_0x39a01b){return _0x112c81[_0x016c('0x18')](_0x5dd38b)[_0x016c('0x19')](_0x39a01b);}};}function respondWithFilteredResult(_0x407319,_0x2b6b16){return function(_0x42f109){if(_0x42f109){var _0x257d15=typeof _0x2b6b16['offset']===_0x016c('0x1a')&&typeof _0x2b6b16[_0x016c('0x1b')]===_0x016c('0x1a');var _0x3ec690=_0x42f109['count'];var _0x32c9e8=_0x257d15?0x0:_0x2b6b16[_0x016c('0x1c')];var _0x5a9cbe=_0x257d15?_0x42f109[_0x016c('0x1d')]:_0x2b6b16[_0x016c('0x1c')]+_0x2b6b16[_0x016c('0x1b')];var _0x20952e;if(_0x5a9cbe>=_0x3ec690){_0x5a9cbe=_0x3ec690;_0x20952e=0xc8;}else{_0x20952e=0xce;}_0x407319[_0x016c('0x18')](_0x20952e);return _0x407319[_0x016c('0x1e')](_0x016c('0x1f'),_0x32c9e8+'-'+_0x5a9cbe+'/'+_0x3ec690)[_0x016c('0x19')](_0x42f109);}return null;};}function patchUpdates(_0x3c4bbf){return function(_0x44930d){try{jsonpatch[_0x016c('0x20')](_0x44930d,_0x3c4bbf,!![]);}catch(_0x119925){return BPromise[_0x016c('0x21')](_0x119925);}return _0x44930d[_0x016c('0x22')]();};}function saveUpdates(_0x51cf22,_0x7cfb26){return function(_0x118d5e){if(_0x118d5e){return _0x118d5e[_0x016c('0x23')](_0x51cf22)['then'](function(_0x2ebd1f){return _0x2ebd1f;});}return null;};}function removeEntity(_0x1a218f,_0x310e3e){return function(_0x1b5826){if(_0x1b5826){return _0x1b5826[_0x016c('0x24')]()[_0x016c('0x25')](function(){_0x1a218f[_0x016c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f25e5,_0x5a684d){return function(_0x536b77){if(!_0x536b77){_0x4f25e5[_0x016c('0x16')](0x194);}return _0x536b77;};}function handleError(_0x3d8ea6,_0xe4c101){_0xe4c101=_0xe4c101||0x1f4;return function(_0x37ef01){logger['error'](_0x37ef01[_0x016c('0x26')]);if(_0x37ef01['name']){delete _0x37ef01[_0x016c('0x27')];}_0x3d8ea6[_0x016c('0x18')](_0xe4c101)[_0x016c('0x28')](_0x37ef01);};}exports[_0x016c('0x29')]=function(_0x2fc6c5,_0x52b7d7){var _0x5e878b={},_0x2b0857={},_0x13cc3a={'count':0x0,'rows':[]};var _0x1c4ea1=_[_0x016c('0x2a')](db[_0x016c('0x2b')]['rawAttributes'],function(_0x524f45){return{'name':_0x524f45[_0x016c('0x2c')],'type':_0x524f45['type'][_0x016c('0x2d')]};});_0x2b0857[_0x016c('0x2e')]=_[_0x016c('0x2a')](_0x1c4ea1,_0x016c('0x27'));_0x2b0857['query']=_[_0x016c('0x2f')](_0x2fc6c5[_0x016c('0x30')]);_0x2b0857[_0x016c('0x31')]=_[_0x016c('0x32')](_0x2b0857[_0x016c('0x2e')],_0x2b0857[_0x016c('0x30')]);_0x5e878b[_0x016c('0x33')]=_[_0x016c('0x32')](_0x2b0857[_0x016c('0x2e')],qs[_0x016c('0x34')](_0x2fc6c5[_0x016c('0x30')]['fields']));_0x5e878b[_0x016c('0x33')]=_0x5e878b[_0x016c('0x33')][_0x016c('0x35')]?_0x5e878b['attributes']:_0x2b0857[_0x016c('0x2e')];if(!_0x2fc6c5[_0x016c('0x30')][_0x016c('0x36')]('nolimit')){_0x5e878b[_0x016c('0x1b')]=qs[_0x016c('0x1b')](_0x2fc6c5[_0x016c('0x30')][_0x016c('0x1b')]);_0x5e878b[_0x016c('0x1c')]=qs[_0x016c('0x1c')](_0x2fc6c5['query'][_0x016c('0x1c')]);}_0x5e878b[_0x016c('0x37')]=qs[_0x016c('0x38')](_0x2fc6c5[_0x016c('0x30')][_0x016c('0x38')]);_0x5e878b[_0x016c('0x39')]=qs[_0x016c('0x31')](_[_0x016c('0x3a')](_0x2fc6c5[_0x016c('0x30')],_0x2b0857[_0x016c('0x31')]),_0x1c4ea1);if(_0x2fc6c5[_0x016c('0x30')][_0x016c('0x3b')]){_0x5e878b['where']=_[_0x016c('0x3c')](_0x5e878b[_0x016c('0x39')],{'$or':_[_0x016c('0x2a')](_0x1c4ea1,function(_0x2dd68b){if(_0x2dd68b[_0x016c('0x3d')]!==_0x016c('0x3e')){var _0x451428={};_0x451428[_0x2dd68b[_0x016c('0x27')]]={'$like':'%'+_0x2fc6c5[_0x016c('0x30')][_0x016c('0x3b')]+'%'};return _0x451428;}})});}_0x5e878b=_['merge']({},_0x5e878b,_0x2fc6c5[_0x016c('0x3f')]);var _0x4f0399={'where':_0x5e878b[_0x016c('0x39')]};return db['SugarcrmAccount']['count'](_0x4f0399)[_0x016c('0x25')](function(_0x5ed825){_0x13cc3a['count']=_0x5ed825;if(_0x2fc6c5['query'][_0x016c('0x40')]){_0x5e878b['include']=[{'all':!![]}];}return db[_0x016c('0x2b')]['findAll'](_0x5e878b);})[_0x016c('0x25')](function(_0x3e2ba5){_0x13cc3a['rows']=_0x3e2ba5;return _0x13cc3a;})[_0x016c('0x25')](respondWithFilteredResult(_0x52b7d7,_0x5e878b))[_0x016c('0x41')](handleError(_0x52b7d7,null));};exports[_0x016c('0x42')]=function(_0x3421e2,_0x2f5a8c){var _0x1cb922={'raw':![],'where':{'id':_0x3421e2[_0x016c('0x43')]['id']}},_0x6123a5={};_0x6123a5['model']=_[_0x016c('0x2f')](db[_0x016c('0x2b')][_0x016c('0x44')]);_0x6123a5[_0x016c('0x30')]=_[_0x016c('0x2f')](_0x3421e2[_0x016c('0x30')]);_0x6123a5[_0x016c('0x31')]=_['intersection'](_0x6123a5[_0x016c('0x2e')],_0x6123a5[_0x016c('0x30')]);_0x1cb922['attributes']=_['intersection'](_0x6123a5[_0x016c('0x2e')],qs[_0x016c('0x34')](_0x3421e2[_0x016c('0x30')][_0x016c('0x34')]));_0x1cb922[_0x016c('0x33')]=_0x1cb922[_0x016c('0x33')]['length']?_0x1cb922['attributes']:_0x6123a5[_0x016c('0x2e')];if(_0x3421e2[_0x016c('0x30')]['includeAll']){_0x1cb922['include']=[{'all':!![]}];}_0x1cb922=_[_0x016c('0x3c')]({},_0x1cb922,_0x3421e2[_0x016c('0x3f')]);return db['SugarcrmAccount'][_0x016c('0x45')](_0x1cb922)['then'](handleEntityNotFound(_0x2f5a8c,null))[_0x016c('0x25')](respondWithResult(_0x2f5a8c,null))['catch'](handleError(_0x2f5a8c,null));};exports[_0x016c('0x46')]=function(_0x3f954a,_0x2d9fa5){return db[_0x016c('0x2b')][_0x016c('0x46')](_0x3f954a[_0x016c('0x47')],{})[_0x016c('0x25')](respondWithResult(_0x2d9fa5,0xc9))['catch'](handleError(_0x2d9fa5,null));};exports['update']=function(_0x24856e,_0x54b7b3){if(_0x24856e[_0x016c('0x47')]['id']){delete _0x24856e[_0x016c('0x47')]['id'];}return db[_0x016c('0x2b')][_0x016c('0x45')]({'where':{'id':_0x24856e['params']['id']}})[_0x016c('0x25')](handleEntityNotFound(_0x54b7b3,null))['then'](saveUpdates(_0x24856e[_0x016c('0x47')],null))[_0x016c('0x25')](respondWithResult(_0x54b7b3,null))[_0x016c('0x41')](handleError(_0x54b7b3,null));};exports[_0x016c('0x24')]=function(_0x2609bd,_0x248fac){return db[_0x016c('0x2b')]['find']({'where':{'id':_0x2609bd[_0x016c('0x43')]['id']}})[_0x016c('0x25')](handleEntityNotFound(_0x248fac,null))[_0x016c('0x25')](removeEntity(_0x248fac,null))['catch'](handleError(_0x248fac,null));};exports[_0x016c('0x48')]=function(_0x24c97d,_0x2cb543,_0x48b695){var _0x4e90c9={};var _0x51c2ae={};var _0x3dd979;var _0x5b4371;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x24c97d[_0x016c('0x43')]['id']}})[_0x016c('0x25')](handleEntityNotFound(_0x2cb543,null))[_0x016c('0x25')](function(_0x35e737){if(_0x35e737){_0x3dd979=_0x35e737;_0x51c2ae[_0x016c('0x2e')]=_[_0x016c('0x2f')](db[_0x016c('0x49')][_0x016c('0x44')]);_0x51c2ae['query']=_[_0x016c('0x2f')](_0x24c97d[_0x016c('0x30')]);_0x51c2ae['filters']=_['intersection'](_0x51c2ae[_0x016c('0x2e')],_0x51c2ae[_0x016c('0x30')]);_0x4e90c9[_0x016c('0x33')]=_[_0x016c('0x32')](_0x51c2ae[_0x016c('0x2e')],qs[_0x016c('0x34')](_0x24c97d[_0x016c('0x30')][_0x016c('0x34')]));_0x4e90c9[_0x016c('0x33')]=_0x4e90c9[_0x016c('0x33')][_0x016c('0x35')]?_0x4e90c9[_0x016c('0x33')]:_0x51c2ae[_0x016c('0x2e')];_0x4e90c9[_0x016c('0x37')]=qs[_0x016c('0x38')](_0x24c97d[_0x016c('0x30')][_0x016c('0x38')]);_0x4e90c9[_0x016c('0x39')]=qs[_0x016c('0x31')](_['pick'](_0x24c97d[_0x016c('0x30')],_0x51c2ae['filters']));if(_0x24c97d[_0x016c('0x30')][_0x016c('0x3b')]){_0x4e90c9[_0x016c('0x39')]=_[_0x016c('0x3c')](_0x4e90c9['where'],{'$or':_[_0x016c('0x2a')](_0x4e90c9['attributes'],function(_0x51271b){var _0x615138={};_0x615138[_0x51271b]={'$like':'%'+_0x24c97d['query'][_0x016c('0x3b')]+'%'};return _0x615138;})});}_0x4e90c9=_['merge']({},_0x4e90c9,_0x24c97d[_0x016c('0x3f')]);return _0x3dd979[_0x016c('0x48')](_0x4e90c9);}})['then'](function(_0x1986ef){if(_0x1986ef){_0x5b4371=_0x1986ef['length'];if(!_0x24c97d[_0x016c('0x30')][_0x016c('0x36')](_0x016c('0x4a'))){_0x4e90c9['limit']=qs[_0x016c('0x1b')](_0x24c97d[_0x016c('0x30')][_0x016c('0x1b')]);_0x4e90c9[_0x016c('0x1c')]=qs['offset'](_0x24c97d[_0x016c('0x30')]['offset']);}return _0x3dd979[_0x016c('0x48')](_0x4e90c9);}})[_0x016c('0x25')](function(_0x120700){if(_0x120700){return _0x120700?{'count':_0x5b4371,'rows':_0x120700}:null;}})[_0x016c('0x25')](respondWithResult(_0x2cb543,null))[_0x016c('0x41')](handleError(_0x2cb543,null));};exports[_0x016c('0x4b')]=function(_0x1d16b8,_0x2143ff,_0x599f1a){if(_0x1d16b8[_0x016c('0x47')]['id']){delete _0x1d16b8['body']['id'];}return db[_0x016c('0x2b')][_0x016c('0x4c')]({'where':{'id':_0x1d16b8[_0x016c('0x43')]['id']}})[_0x016c('0x25')](handleEntityNotFound(_0x2143ff,null))[_0x016c('0x25')](function(_0x1618ee){if(_0x1618ee){_0x1d16b8[_0x016c('0x47')][_0x016c('0x4d')]=_0x1618ee['id'];_0x1d16b8[_0x016c('0x47')]['Subjects']=integrations[_0x016c('0x4e')](_0x1d16b8['body'][_0x016c('0x4f')],_0x1d16b8[_0x016c('0x47')][_0x016c('0x3d')]);_0x1d16b8['body']['Descriptions']=integrations['getDescriptions'](_0x1d16b8[_0x016c('0x47')][_0x016c('0x4f')],_0x1d16b8[_0x016c('0x47')][_0x016c('0x3d')]);return db[_0x016c('0x49')][_0x016c('0x46')](_0x1d16b8['body'],{'include':[{'model':db[_0x016c('0x50')],'as':_0x016c('0x51')},{'model':db[_0x016c('0x50')],'as':_0x016c('0x52')}]});}return null;})[_0x016c('0x25')](respondWithResult(_0x2143ff,null))[_0x016c('0x41')](handleError(_0x2143ff,null));};exports['getFields']=function(_0x26f7d7,_0xb6018e,_0x141d31){var _0x2a2372='';var _0x534231=['id',_0x016c('0x27'),_0x016c('0x53'),_0x016c('0x54'),_0x016c('0x55'),_0x016c('0x56'),_0x016c('0x57'),_0x016c('0x58'),_0x016c('0x59'),'parent_type','parent_name',_0x016c('0x5a')];return db['SugarcrmAccount'][_0x016c('0x4c')]({'where':{'id':_0x26f7d7['params']['id']},'attributes':['id','username',_0x016c('0x5b'),_0x016c('0x5c')]})[_0x016c('0x25')](handleEntityNotFound(_0xb6018e,null))[_0x016c('0x25')](function(_0x41fd24){if(_0x41fd24){_0x2a2372=_0x41fd24['remoteUri'];var _0x182a92=_0x2a2372[_0x016c('0x5d')](-0x1);if(_0x182a92==='/'){_0x2a2372=_0x2a2372[_0x016c('0x5e')](0x0,_0x2a2372[_0x016c('0x5f')](_0x182a92));}return rp({'method':'POST','uri':util[_0x016c('0x60')]('%s%s',_0x2a2372,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x016c('0x61'),'response_type':_0x016c('0x61'),'rest_data':JSON[_0x016c('0x62')]({'user_auth':{'user_name':_0x41fd24[_0x016c('0x63')],'password':_0x41fd24[_0x016c('0x5b')],'encryption':_0x016c('0x64')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x016c('0x25')](function(_0x3c4871){if(_0x3c4871&&_0x3c4871['name']!==_0x016c('0x65')&&_0x3c4871[_0x016c('0x27')]!=='Password\x20Expired'){return rp({'method':_0x016c('0x66'),'uri':util[_0x016c('0x60')](_0x016c('0x67'),_0x2a2372,_0x016c('0x68')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x016c('0x61'),'response_type':_0x016c('0x61'),'rest_data':JSON[_0x016c('0x62')]({'session':_0x3c4871['id'],'module_name':_0x016c('0x69')})}})[_0x016c('0x25')](function(_0x25bde2){if(_0x25bde2){var _0x1ee28e=_[_0x016c('0x6a')](_0x25bde2[_0x016c('0x6b')]);_[_0x016c('0x6c')](_0x1ee28e,function(_0x41cbb5){return _0x534231[_0x016c('0x6d')](_0x41cbb5[_0x016c('0x27')]);});return{'count':_0x1ee28e[_0x016c('0x35')],'rows':_['map'](_0x1ee28e,function(_0x273c57){return{'id':_0x273c57[_0x016c('0x27')],'name':_0x273c57[_0x016c('0x6e')],'custom':_[_0x016c('0x6f')](_0x273c57[_0x016c('0x27')],'_c')?!![]:![],'options':_0x273c57[_0x016c('0x3f')]?_[_0x016c('0x2a')](_['values'](_0x273c57[_0x016c('0x3f')]),function(_0x4713dc){return{'name':_0x4713dc['value'],'value':_0x4713dc[_0x016c('0x27')]};}):[]};})};}})[_0x016c('0x25')](respondWithResult(_0xb6018e,null))[_0x016c('0x41')](function(_0x567280){var _0x5c0a12=_0x26f7d7[_0x016c('0x30')]['test']?0x1f4:_0x567280[_0x016c('0x70')]||0x1f4;logger[_0x016c('0x71')](_0x016c('0x72'),_0x016c('0x73'),_0x5c0a12,JSON['stringify'](_0x567280));delete _0x567280[_0x016c('0x27')];if(_0x5c0a12===0x191){_0x5c0a12=0x190;}_0xb6018e[_0x016c('0x18')](_0x5c0a12)[_0x016c('0x28')](_0x26f7d7[_0x016c('0x30')][_0x016c('0x74')]?{'message':_0x016c('0x75'),'statusCode':_0x567280['statusCode']}:_0x567280);});}else{var _0x5ad3bb=0x1f4;_0xb6018e[_0x016c('0x18')](_0x5ad3bb)[_0x016c('0x28')]({'message':_0x016c('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xf421=['limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','rawAttributes','length','find','create','body','params','findOne','SugarcrmConfiguration','filter','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','JSON','values','module_fields','remove','includes','label','value','statusCode','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined'];(function(_0x523da0,_0x22623f){var _0x4d04b9=function(_0x185640){while(--_0x185640){_0x523da0['push'](_0x523da0['shift']());}};_0x4d04b9(++_0x22623f);}(_0xf421,0xd2));var _0x1f42=function(_0x39758d,_0x346423){_0x39758d=_0x39758d-0x0;var _0x44ac11=_0xf421[_0x39758d];return _0x44ac11;};'use strict';var emlformat=require(_0x1f42('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f42('0x1'));var rp=require(_0x1f42('0x2'));var moment=require(_0x1f42('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1f42('0x4'));var util=require(_0x1f42('0x5'));var path=require('path');var sox=require(_0x1f42('0x6'));var csv=require(_0x1f42('0x7'));var ejs=require(_0x1f42('0x8'));var fs=require('fs');var fs_extra=require(_0x1f42('0x9'));var _=require(_0x1f42('0xa'));var squel=require(_0x1f42('0xb'));var crypto=require(_0x1f42('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1f42('0xd'));var Papa=require(_0x1f42('0xe'));var Redis=require('ioredis');var authService=require(_0x1f42('0xf'));var qs=require(_0x1f42('0x10'));var as=require(_0x1f42('0x11'));var hardwareService=require(_0x1f42('0x12'));var logger=require(_0x1f42('0x13'))(_0x1f42('0x14'));var utils=require(_0x1f42('0x15'));var config=require(_0x1f42('0x16'));var licenseUtil=require(_0x1f42('0x17'));var db=require(_0x1f42('0x18'))['db'];var integrations=require(_0x1f42('0x19'));function respondWithStatusCode(_0x16a952,_0x17e5d7){_0x17e5d7=_0x17e5d7||0xcc;return function(_0x236ea1){if(_0x236ea1){return _0x16a952[_0x1f42('0x1a')](_0x17e5d7);}return _0x16a952['status'](_0x17e5d7)[_0x1f42('0x1b')]();};}function respondWithResult(_0x3f9abc,_0x48b1e5){_0x48b1e5=_0x48b1e5||0xc8;return function(_0xa4f3b8){if(_0xa4f3b8){return _0x3f9abc[_0x1f42('0x1c')](_0x48b1e5)[_0x1f42('0x1d')](_0xa4f3b8);}};}function respondWithFilteredResult(_0x459da8,_0x4073ef){return function(_0x2155ac){if(_0x2155ac){var _0x53a4ea=typeof _0x4073ef[_0x1f42('0x1e')]===_0x1f42('0x1f')&&typeof _0x4073ef[_0x1f42('0x20')]===_0x1f42('0x1f');var _0x5d933c=_0x2155ac[_0x1f42('0x21')];var _0x1ebe26=_0x53a4ea?0x0:_0x4073ef['offset'];var _0x131291=_0x53a4ea?_0x2155ac[_0x1f42('0x21')]:_0x4073ef[_0x1f42('0x1e')]+_0x4073ef[_0x1f42('0x20')];var _0x368a40;if(_0x131291>=_0x5d933c){_0x131291=_0x5d933c;_0x368a40=0xc8;}else{_0x368a40=0xce;}_0x459da8[_0x1f42('0x1c')](_0x368a40);return _0x459da8[_0x1f42('0x22')](_0x1f42('0x23'),_0x1ebe26+'-'+_0x131291+'/'+_0x5d933c)[_0x1f42('0x1d')](_0x2155ac);}return null;};}function patchUpdates(_0x1f937e){return function(_0x4ce11f){try{jsonpatch['apply'](_0x4ce11f,_0x1f937e,!![]);}catch(_0x486dbb){return BPromise[_0x1f42('0x24')](_0x486dbb);}return _0x4ce11f[_0x1f42('0x25')]();};}function saveUpdates(_0x584b98,_0x56f82f){return function(_0x3997b0){if(_0x3997b0){return _0x3997b0[_0x1f42('0x26')](_0x584b98)[_0x1f42('0x27')](function(_0x1ecc4f){return _0x1ecc4f;});}return null;};}function removeEntity(_0x28a97d,_0x1a024b){return function(_0x3def34){if(_0x3def34){return _0x3def34[_0x1f42('0x28')]()[_0x1f42('0x27')](function(){_0x28a97d[_0x1f42('0x1c')](0xcc)[_0x1f42('0x1b')]();});}};}function handleEntityNotFound(_0x2ef756,_0x5ac79d){return function(_0x15c76b){if(!_0x15c76b){_0x2ef756[_0x1f42('0x1a')](0x194);}return _0x15c76b;};}function handleError(_0x4af6d7,_0x20cfe1){_0x20cfe1=_0x20cfe1||0x1f4;return function(_0x55f03c){logger[_0x1f42('0x29')](_0x55f03c[_0x1f42('0x2a')]);if(_0x55f03c[_0x1f42('0x2b')]){delete _0x55f03c[_0x1f42('0x2b')];}_0x4af6d7['status'](_0x20cfe1)[_0x1f42('0x2c')](_0x55f03c);};}exports['index']=function(_0x4e6492,_0x54718c){var _0x49e559={},_0x2fc423={},_0x1b6f53={'count':0x0,'rows':[]};var _0x4cfb57=_[_0x1f42('0x2d')](db['SugarcrmAccount']['rawAttributes'],function(_0x99362e){return{'name':_0x99362e[_0x1f42('0x2e')],'type':_0x99362e['type'][_0x1f42('0x2f')]};});_0x2fc423[_0x1f42('0x30')]=_[_0x1f42('0x2d')](_0x4cfb57,_0x1f42('0x2b'));_0x2fc423[_0x1f42('0x31')]=_[_0x1f42('0x32')](_0x4e6492[_0x1f42('0x31')]);_0x2fc423[_0x1f42('0x33')]=_[_0x1f42('0x34')](_0x2fc423[_0x1f42('0x30')],_0x2fc423[_0x1f42('0x31')]);_0x49e559[_0x1f42('0x35')]=_[_0x1f42('0x34')](_0x2fc423['model'],qs['fields'](_0x4e6492[_0x1f42('0x31')][_0x1f42('0x36')]));_0x49e559[_0x1f42('0x35')]=_0x49e559[_0x1f42('0x35')]['length']?_0x49e559['attributes']:_0x2fc423[_0x1f42('0x30')];if(!_0x4e6492[_0x1f42('0x31')][_0x1f42('0x37')](_0x1f42('0x38'))){_0x49e559[_0x1f42('0x20')]=qs[_0x1f42('0x20')](_0x4e6492[_0x1f42('0x31')][_0x1f42('0x20')]);_0x49e559['offset']=qs[_0x1f42('0x1e')](_0x4e6492[_0x1f42('0x31')][_0x1f42('0x1e')]);}_0x49e559[_0x1f42('0x39')]=qs[_0x1f42('0x3a')](_0x4e6492[_0x1f42('0x31')][_0x1f42('0x3a')]);_0x49e559['where']=qs[_0x1f42('0x33')](_[_0x1f42('0x3b')](_0x4e6492[_0x1f42('0x31')],_0x2fc423['filters']),_0x4cfb57);if(_0x4e6492[_0x1f42('0x31')]['filter']){_0x49e559[_0x1f42('0x3c')]=_[_0x1f42('0x3d')](_0x49e559[_0x1f42('0x3c')],{'$or':_[_0x1f42('0x2d')](_0x4cfb57,function(_0xa2572f){if(_0xa2572f[_0x1f42('0x3e')]!==_0x1f42('0x3f')){var _0x49c1b6={};_0x49c1b6[_0xa2572f[_0x1f42('0x2b')]]={'$like':'%'+_0x4e6492[_0x1f42('0x31')]['filter']+'%'};return _0x49c1b6;}})});}_0x49e559=_[_0x1f42('0x3d')]({},_0x49e559,_0x4e6492[_0x1f42('0x40')]);var _0x36c2a5={'where':_0x49e559[_0x1f42('0x3c')]};return db[_0x1f42('0x41')][_0x1f42('0x21')](_0x36c2a5)[_0x1f42('0x27')](function(_0x2218a8){_0x1b6f53[_0x1f42('0x21')]=_0x2218a8;if(_0x4e6492['query'][_0x1f42('0x42')]){_0x49e559[_0x1f42('0x43')]=[{'all':!![]}];}return db[_0x1f42('0x41')][_0x1f42('0x44')](_0x49e559);})['then'](function(_0x1a7194){_0x1b6f53[_0x1f42('0x45')]=_0x1a7194;return _0x1b6f53;})[_0x1f42('0x27')](respondWithFilteredResult(_0x54718c,_0x49e559))[_0x1f42('0x46')](handleError(_0x54718c,null));};exports['show']=function(_0x5dd9ac,_0x9abde7){var _0x2608bc={'raw':![],'where':{'id':_0x5dd9ac['params']['id']}},_0x3b7b4f={};_0x3b7b4f[_0x1f42('0x30')]=_['keys'](db['SugarcrmAccount'][_0x1f42('0x47')]);_0x3b7b4f[_0x1f42('0x31')]=_[_0x1f42('0x32')](_0x5dd9ac['query']);_0x3b7b4f['filters']=_['intersection'](_0x3b7b4f['model'],_0x3b7b4f[_0x1f42('0x31')]);_0x2608bc[_0x1f42('0x35')]=_['intersection'](_0x3b7b4f[_0x1f42('0x30')],qs[_0x1f42('0x36')](_0x5dd9ac['query']['fields']));_0x2608bc['attributes']=_0x2608bc[_0x1f42('0x35')][_0x1f42('0x48')]?_0x2608bc[_0x1f42('0x35')]:_0x3b7b4f[_0x1f42('0x30')];if(_0x5dd9ac['query'][_0x1f42('0x42')]){_0x2608bc[_0x1f42('0x43')]=[{'all':!![]}];}_0x2608bc=_[_0x1f42('0x3d')]({},_0x2608bc,_0x5dd9ac[_0x1f42('0x40')]);return db[_0x1f42('0x41')][_0x1f42('0x49')](_0x2608bc)[_0x1f42('0x27')](handleEntityNotFound(_0x9abde7,null))[_0x1f42('0x27')](respondWithResult(_0x9abde7,null))[_0x1f42('0x46')](handleError(_0x9abde7,null));};exports[_0x1f42('0x4a')]=function(_0x43afa3,_0x2691a4){return db[_0x1f42('0x41')][_0x1f42('0x4a')](_0x43afa3[_0x1f42('0x4b')],{})[_0x1f42('0x27')](respondWithResult(_0x2691a4,0xc9))[_0x1f42('0x46')](handleError(_0x2691a4,null));};exports[_0x1f42('0x26')]=function(_0x383107,_0x4f3be6){if(_0x383107[_0x1f42('0x4b')]['id']){delete _0x383107[_0x1f42('0x4b')]['id'];}return db['SugarcrmAccount'][_0x1f42('0x49')]({'where':{'id':_0x383107[_0x1f42('0x4c')]['id']}})[_0x1f42('0x27')](handleEntityNotFound(_0x4f3be6,null))[_0x1f42('0x27')](saveUpdates(_0x383107[_0x1f42('0x4b')],null))[_0x1f42('0x27')](respondWithResult(_0x4f3be6,null))[_0x1f42('0x46')](handleError(_0x4f3be6,null));};exports[_0x1f42('0x28')]=function(_0x165dce,_0x37ed46){return db['SugarcrmAccount']['find']({'where':{'id':_0x165dce[_0x1f42('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37ed46,null))['then'](removeEntity(_0x37ed46,null))[_0x1f42('0x46')](handleError(_0x37ed46,null));};exports['getConfigurations']=function(_0x3df92a,_0x52f396,_0x41ce52){var _0x14bfbd={};var _0x4c5dd3={};var _0x328691;var _0x1b18c5;return db['SugarcrmAccount'][_0x1f42('0x4d')]({'where':{'id':_0x3df92a['params']['id']}})[_0x1f42('0x27')](handleEntityNotFound(_0x52f396,null))[_0x1f42('0x27')](function(_0x3d615a){if(_0x3d615a){_0x328691=_0x3d615a;_0x4c5dd3['model']=_[_0x1f42('0x32')](db[_0x1f42('0x4e')][_0x1f42('0x47')]);_0x4c5dd3[_0x1f42('0x31')]=_['keys'](_0x3df92a[_0x1f42('0x31')]);_0x4c5dd3[_0x1f42('0x33')]=_['intersection'](_0x4c5dd3[_0x1f42('0x30')],_0x4c5dd3[_0x1f42('0x31')]);_0x14bfbd[_0x1f42('0x35')]=_[_0x1f42('0x34')](_0x4c5dd3[_0x1f42('0x30')],qs[_0x1f42('0x36')](_0x3df92a[_0x1f42('0x31')]['fields']));_0x14bfbd[_0x1f42('0x35')]=_0x14bfbd[_0x1f42('0x35')][_0x1f42('0x48')]?_0x14bfbd[_0x1f42('0x35')]:_0x4c5dd3[_0x1f42('0x30')];_0x14bfbd[_0x1f42('0x39')]=qs['sort'](_0x3df92a[_0x1f42('0x31')]['sort']);_0x14bfbd['where']=qs[_0x1f42('0x33')](_[_0x1f42('0x3b')](_0x3df92a[_0x1f42('0x31')],_0x4c5dd3['filters']));if(_0x3df92a[_0x1f42('0x31')][_0x1f42('0x4f')]){_0x14bfbd[_0x1f42('0x3c')]=_['merge'](_0x14bfbd[_0x1f42('0x3c')],{'$or':_[_0x1f42('0x2d')](_0x14bfbd['attributes'],function(_0x5448cf){var _0x5c1aa5={};_0x5c1aa5[_0x5448cf]={'$like':'%'+_0x3df92a[_0x1f42('0x31')][_0x1f42('0x4f')]+'%'};return _0x5c1aa5;})});}_0x14bfbd=_['merge']({},_0x14bfbd,_0x3df92a['options']);return _0x328691[_0x1f42('0x50')](_0x14bfbd);}})[_0x1f42('0x27')](function(_0x5028b8){if(_0x5028b8){_0x1b18c5=_0x5028b8[_0x1f42('0x48')];if(!_0x3df92a['query'][_0x1f42('0x37')](_0x1f42('0x38'))){_0x14bfbd['limit']=qs[_0x1f42('0x20')](_0x3df92a[_0x1f42('0x31')][_0x1f42('0x20')]);_0x14bfbd[_0x1f42('0x1e')]=qs['offset'](_0x3df92a[_0x1f42('0x31')][_0x1f42('0x1e')]);}return _0x328691['getConfigurations'](_0x14bfbd);}})['then'](function(_0x446203){if(_0x446203){return _0x446203?{'count':_0x1b18c5,'rows':_0x446203}:null;}})[_0x1f42('0x27')](respondWithResult(_0x52f396,null))[_0x1f42('0x46')](handleError(_0x52f396,null));};exports['addConfiguration']=function(_0x2d22aa,_0x2e3f51,_0x30aa84){if(_0x2d22aa[_0x1f42('0x4b')]['id']){delete _0x2d22aa[_0x1f42('0x4b')]['id'];}return db[_0x1f42('0x41')][_0x1f42('0x4d')]({'where':{'id':_0x2d22aa[_0x1f42('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e3f51,null))[_0x1f42('0x27')](function(_0x22d964){if(_0x22d964){_0x2d22aa[_0x1f42('0x4b')][_0x1f42('0x51')]=_0x22d964['id'];_0x2d22aa[_0x1f42('0x4b')][_0x1f42('0x52')]=integrations[_0x1f42('0x53')](_0x2d22aa['body']['channel'],_0x2d22aa[_0x1f42('0x4b')][_0x1f42('0x3e')]);_0x2d22aa[_0x1f42('0x4b')][_0x1f42('0x54')]=integrations[_0x1f42('0x55')](_0x2d22aa[_0x1f42('0x4b')][_0x1f42('0x56')],_0x2d22aa['body'][_0x1f42('0x3e')]);return db[_0x1f42('0x4e')][_0x1f42('0x4a')](_0x2d22aa[_0x1f42('0x4b')],{'include':[{'model':db[_0x1f42('0x57')],'as':_0x1f42('0x52')},{'model':db['SugarcrmField'],'as':_0x1f42('0x54')}]});}return null;})[_0x1f42('0x27')](respondWithResult(_0x2e3f51,null))[_0x1f42('0x46')](handleError(_0x2e3f51,null));};exports[_0x1f42('0x58')]=function(_0x21ef6e,_0x5168f4,_0x71a10b){var _0x5dc135='';var _0x29e28c=['id',_0x1f42('0x2b'),'assigned_user_id','created_by','description',_0x1f42('0x59'),_0x1f42('0x5a'),_0x1f42('0x5b'),_0x1f42('0x5c'),_0x1f42('0x5d'),'parent_name',_0x1f42('0x5e')];return db[_0x1f42('0x41')][_0x1f42('0x4d')]({'where':{'id':_0x21ef6e[_0x1f42('0x4c')]['id']},'attributes':['id',_0x1f42('0x5f'),_0x1f42('0x60'),_0x1f42('0x61')]})['then'](handleEntityNotFound(_0x5168f4,null))[_0x1f42('0x27')](function(_0x36a659){if(_0x36a659){_0x5dc135=_0x36a659[_0x1f42('0x61')];var _0x5d8f2b=_0x5dc135[_0x1f42('0x62')](-0x1);if(_0x5d8f2b==='/'){_0x5dc135=_0x5dc135[_0x1f42('0x63')](0x0,_0x5dc135[_0x1f42('0x64')](_0x5d8f2b));}return rp({'method':_0x1f42('0x65'),'uri':util[_0x1f42('0x66')](_0x1f42('0x67'),_0x5dc135,_0x1f42('0x68')),'json':!![],'form':{'method':_0x1f42('0x69'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1f42('0x6a')]({'user_auth':{'user_name':_0x36a659[_0x1f42('0x5f')],'password':_0x36a659[_0x1f42('0x60')],'encryption':_0x1f42('0x6b')},'application':_0x1f42('0x6c')})}});}})[_0x1f42('0x27')](function(_0x37239a){if(_0x37239a&&_0x37239a[_0x1f42('0x2b')]!==_0x1f42('0x6d')&&_0x37239a[_0x1f42('0x2b')]!==_0x1f42('0x6e')){return rp({'method':'POST','uri':util[_0x1f42('0x66')](_0x1f42('0x67'),_0x5dc135,_0x1f42('0x68')),'json':!![],'form':{'method':_0x1f42('0x6f'),'input_type':_0x1f42('0x70'),'response_type':_0x1f42('0x70'),'rest_data':JSON['stringify']({'session':_0x37239a['id'],'module_name':'Calls'})}})[_0x1f42('0x27')](function(_0x72a8da){if(_0x72a8da){var _0x2a075f=_[_0x1f42('0x71')](_0x72a8da[_0x1f42('0x72')]);_[_0x1f42('0x73')](_0x2a075f,function(_0x4a3d62){return _0x29e28c[_0x1f42('0x74')](_0x4a3d62[_0x1f42('0x2b')]);});return{'count':_0x2a075f[_0x1f42('0x48')],'rows':_['map'](_0x2a075f,function(_0x4e23ec){return{'id':_0x4e23ec[_0x1f42('0x2b')],'name':_0x4e23ec[_0x1f42('0x75')],'custom':_['endsWith'](_0x4e23ec[_0x1f42('0x2b')],'_c')?!![]:![],'options':_0x4e23ec[_0x1f42('0x40')]?_[_0x1f42('0x2d')](_[_0x1f42('0x71')](_0x4e23ec[_0x1f42('0x40')]),function(_0x5e2432){return{'name':_0x5e2432[_0x1f42('0x76')],'value':_0x5e2432[_0x1f42('0x2b')]};}):[]};})};}})[_0x1f42('0x27')](respondWithResult(_0x5168f4,null))[_0x1f42('0x46')](function(_0x59724e){var _0x49c6aa=_0x21ef6e['query']['test']?0x1f4:_0x59724e[_0x1f42('0x77')]||0x1f4;logger[_0x1f42('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x49c6aa,JSON[_0x1f42('0x6a')](_0x59724e));delete _0x59724e['name'];if(_0x49c6aa===0x191){_0x49c6aa=0x190;}_0x5168f4['status'](_0x49c6aa)['send'](_0x21ef6e[_0x1f42('0x31')]['test']?{'message':_0x1f42('0x78'),'statusCode':_0x59724e['statusCode']}:_0x59724e);});}else{var _0x47202e=0x1f4;_0x5168f4[_0x1f42('0x1c')](_0x47202e)['send']({'message':'Wrong\x20credentials','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 5149785..89dc092 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 _0xb40d=['bluebird','path','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment'];(function(_0x3ea998,_0x5bb1ed){var _0x143326=function(_0xc7d1bb){while(--_0xc7d1bb){_0x3ea998['push'](_0x3ea998['shift']());}};_0x143326(++_0x5bb1ed);}(_0xb40d,0xc8));var _0xdb40=function(_0xb4a93f,_0x38e46e){_0xb4a93f=_0xb4a93f-0x0;var _0x20ac21=_0xb40d[_0xb4a93f];return _0x20ac21;};'use strict';var _=require(_0xdb40('0x0'));var util=require(_0xdb40('0x1'));var logger=require('../../config/logger')(_0xdb40('0x2'));var moment=require(_0xdb40('0x3'));var BPromise=require(_0xdb40('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb40('0x5'));var rimraf=require('rimraf');var config=require(_0xdb40('0x6'));var attributes=require(_0xdb40('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xdb40('0x8')]=function(_0x3c0b2f,_0x1e7a64){return _0x3c0b2f[_0xdb40('0x9')](_0xdb40('0xa'),attributes,{'tableName':_0xdb40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1472=['request-promise','path','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1472,0x166));var _0x2147=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0x1472[_0x45b1ba];return _0x145ddb;};'use strict';var _=require(_0x2147('0x0'));var util=require(_0x2147('0x1'));var logger=require(_0x2147('0x2'))(_0x2147('0x3'));var moment=require(_0x2147('0x4'));var BPromise=require(_0x2147('0x5'));var rp=require(_0x2147('0x6'));var fs=require('fs');var path=require(_0x2147('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2147('0x8'));var integrations=require(_0x2147('0x9'));module[_0x2147('0xa')]=function(_0x5593f4,_0x4b8324){return _0x5593f4[_0x2147('0xb')]('SugarcrmAccount',attributes,{'tableName':_0x2147('0xc'),'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 fee87f3..fdcd561 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 _0x9484=['../../config/logger','rpc','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SugarcrmAccount','findAll','options','raw','attributes','include','map','model','debug','GetSugarcrmAccount','catch','ShowSugarcrmAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3f4450,_0xfaf1a8){var _0x492655=function(_0x355887){while(--_0x355887){_0x3f4450['push'](_0x3f4450['shift']());}};_0x492655(++_0xfaf1a8);}(_0x9484,0xca));var _0x4948=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x9484[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x4948('0x0'));var util=require(_0x4948('0x1'));var moment=require(_0x4948('0x2'));var BPromise=require(_0x4948('0x3'));var rs=require(_0x4948('0x4'));var fs=require('fs');var Redis=require(_0x4948('0x5'));var db=require(_0x4948('0x6'))['db'];var utils=require(_0x4948('0x7'));var logger=require(_0x4948('0x8'))(_0x4948('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4948('0xa')][_0x4948('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7041ce,_0x19b3ce,_0x33f9d5){return new BPromise(function(_0xa09ceb,_0x1874f5){return client[_0x4948('0xc')](_0x7041ce,_0x33f9d5)[_0x4948('0xd')](function(_0x30d7d2){logger[_0x4948('0xe')](_0x4948('0xf'),_0x19b3ce,_0x4948('0x10'));logger['debug'](_0x4948('0x11'),_0x19b3ce,_0x4948('0x10'),JSON[_0x4948('0x12')](_0x30d7d2));if(_0x30d7d2[_0x4948('0x13')]){if(_0x30d7d2[_0x4948('0x13')]['code']===0x1f4){logger[_0x4948('0x13')](_0x4948('0xf'),_0x19b3ce,_0x30d7d2[_0x4948('0x13')][_0x4948('0x14')]);return _0x1874f5(_0x30d7d2[_0x4948('0x13')]['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x19b3ce,_0x30d7d2[_0x4948('0x13')][_0x4948('0x14')]);return _0xa09ceb(_0x30d7d2[_0x4948('0x13')][_0x4948('0x14')]);}else{logger[_0x4948('0xe')](_0x4948('0xf'),_0x19b3ce,'request\x20sent');_0xa09ceb(_0x30d7d2[_0x4948('0x15')][_0x4948('0x14')]);}})['catch'](function(_0x420d86){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x19b3ce,_0x420d86);_0x1874f5(_0x420d86);});});}exports['GetSugarcrmAccount']=function(_0x3ee5b9){var _0x32db4a=this;return new Promise(function(_0x520c37,_0x59d0d7){return db[_0x4948('0x16')][_0x4948('0x17')]({'raw':_0x3ee5b9[_0x4948('0x18')]?_0x3ee5b9[_0x4948('0x18')][_0x4948('0x19')]===undefined?!![]:![]:!![],'where':_0x3ee5b9[_0x4948('0x18')]?_0x3ee5b9[_0x4948('0x18')]['where']||null:null,'attributes':_0x3ee5b9['options']?_0x3ee5b9['options'][_0x4948('0x1a')]||null:null,'limit':_0x3ee5b9[_0x4948('0x18')]?_0x3ee5b9[_0x4948('0x18')]['limit']||null:null,'include':_0x3ee5b9[_0x4948('0x18')]?_0x3ee5b9['options'][_0x4948('0x1b')]?_[_0x4948('0x1c')](_0x3ee5b9[_0x4948('0x18')]['include'],function(_0x5a7be4){return{'model':db[_0x5a7be4[_0x4948('0x1d')]],'as':_0x5a7be4['as'],'attributes':_0x5a7be4[_0x4948('0x1a')],'include':_0x5a7be4[_0x4948('0x1b')]?_[_0x4948('0x1c')](_0x5a7be4['include'],function(_0x16f433){return{'model':db[_0x16f433[_0x4948('0x1d')]],'as':_0x16f433['as'],'attributes':_0x16f433['attributes'],'include':_0x16f433['include']?_[_0x4948('0x1c')](_0x16f433[_0x4948('0x1b')],function(_0xfcceca){return{'model':db[_0xfcceca['model']],'as':_0xfcceca['as'],'attributes':_0xfcceca[_0x4948('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4948('0xd')](function(_0x3c9c7d){logger[_0x4948('0xe')]('GetSugarcrmAccount',_0x3ee5b9);logger[_0x4948('0x1e')](_0x4948('0x1f'),_0x3ee5b9,JSON[_0x4948('0x12')](_0x3c9c7d));_0x520c37(_0x3c9c7d);})[_0x4948('0x20')](function(_0x408fe3){logger['error'](_0x4948('0x1f'),_0x408fe3[_0x4948('0x14')],_0x3ee5b9);_0x59d0d7(_0x32db4a[_0x4948('0x13')](0x1f4,_0x408fe3[_0x4948('0x14')]));});});};exports[_0x4948('0x21')]=function(_0x11d0d6){var _0xca547=this;return new Promise(function(_0x236093,_0x2ba45c){return db[_0x4948('0x16')]['find']({'raw':_0x11d0d6[_0x4948('0x18')]?_0x11d0d6[_0x4948('0x18')][_0x4948('0x19')]===undefined?!![]:![]:!![],'where':_0x11d0d6[_0x4948('0x18')]?_0x11d0d6[_0x4948('0x18')][_0x4948('0x22')]||null:null,'attributes':_0x11d0d6['options']?_0x11d0d6[_0x4948('0x18')]['attributes']||null:null,'include':_0x11d0d6[_0x4948('0x18')]?_0x11d0d6[_0x4948('0x18')]['include']?_[_0x4948('0x1c')](_0x11d0d6[_0x4948('0x18')]['include'],function(_0x447c48){return{'model':db[_0x447c48[_0x4948('0x1d')]],'as':_0x447c48['as'],'attributes':_0x447c48[_0x4948('0x1a')],'include':_0x447c48[_0x4948('0x1b')]?_['map'](_0x447c48[_0x4948('0x1b')],function(_0xcf3c7f){return{'model':db[_0xcf3c7f[_0x4948('0x1d')]],'as':_0xcf3c7f['as'],'attributes':_0xcf3c7f[_0x4948('0x1a')],'include':_0xcf3c7f['include']?_['map'](_0xcf3c7f[_0x4948('0x1b')],function(_0x12e7ef){return{'model':db[_0x12e7ef['model']],'as':_0x12e7ef['as'],'attributes':_0x12e7ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x4948('0xd')](function(_0x4f692f){logger[_0x4948('0xe')](_0x4948('0x21'),_0x11d0d6);logger[_0x4948('0x1e')](_0x4948('0x21'),_0x11d0d6,JSON[_0x4948('0x12')](_0x4f692f));_0x236093(_0x4f692f);})[_0x4948('0x20')](function(_0x20493a){logger[_0x4948('0x13')](_0x4948('0x21'),_0x20493a[_0x4948('0x14')],_0x11d0d6);_0x2ba45c(_0xca547['error'](0x1f4,_0x20493a[_0x4948('0x14')]));});});}; \ No newline at end of file +var _0xfc1c=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','limit','map','include','model','find','raw','ShowSugarcrmAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x290d3a,_0x2e1b44){var _0x39f0cf=function(_0x4f4d01){while(--_0x4f4d01){_0x290d3a['push'](_0x290d3a['shift']());}};_0x39f0cf(++_0x2e1b44);}(_0xfc1c,0x18c));var _0xcfc1=function(_0x2158a8,_0x335f85){_0x2158a8=_0x2158a8-0x0;var _0x4b1071=_0xfc1c[_0x2158a8];return _0x4b1071;};'use strict';var _=require('lodash');var util=require(_0xcfc1('0x0'));var moment=require(_0xcfc1('0x1'));var BPromise=require(_0xcfc1('0x2'));var rs=require(_0xcfc1('0x3'));var fs=require('fs');var Redis=require(_0xcfc1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfc1('0x5'));var logger=require(_0xcfc1('0x6'))(_0xcfc1('0x7'));var config=require(_0xcfc1('0x8'));var jayson=require(_0xcfc1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x114901,_0xbac019,_0x4efced){return new BPromise(function(_0x4dca8a,_0x31f2ca){return client[_0xcfc1('0xa')](_0x114901,_0x4efced)[_0xcfc1('0xb')](function(_0x3f99af){logger['info'](_0xcfc1('0xc'),_0xbac019,_0xcfc1('0xd'));logger[_0xcfc1('0xe')](_0xcfc1('0xf'),_0xbac019,_0xcfc1('0xd'),JSON[_0xcfc1('0x10')](_0x3f99af));if(_0x3f99af[_0xcfc1('0x11')]){if(_0x3f99af[_0xcfc1('0x11')]['code']===0x1f4){logger[_0xcfc1('0x11')](_0xcfc1('0xc'),_0xbac019,_0x3f99af['error'][_0xcfc1('0x12')]);return _0x31f2ca(_0x3f99af['error'][_0xcfc1('0x12')]);}logger[_0xcfc1('0x11')](_0xcfc1('0xc'),_0xbac019,_0x3f99af[_0xcfc1('0x11')][_0xcfc1('0x12')]);return _0x4dca8a(_0x3f99af[_0xcfc1('0x11')][_0xcfc1('0x12')]);}else{logger[_0xcfc1('0x13')](_0xcfc1('0xc'),_0xbac019,_0xcfc1('0xd'));_0x4dca8a(_0x3f99af[_0xcfc1('0x14')][_0xcfc1('0x12')]);}})[_0xcfc1('0x15')](function(_0x536264){logger[_0xcfc1('0x11')](_0xcfc1('0xc'),_0xbac019,_0x536264);_0x31f2ca(_0x536264);});});}exports[_0xcfc1('0x16')]=function(_0xfb5528){var _0x3c4b91=this;return new Promise(function(_0x2f7f4c,_0x4a5ee7){return db[_0xcfc1('0x17')]['findAll']({'raw':_0xfb5528[_0xcfc1('0x18')]?_0xfb5528[_0xcfc1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xfb5528[_0xcfc1('0x18')]?_0xfb5528[_0xcfc1('0x18')][_0xcfc1('0x19')]||null:null,'attributes':_0xfb5528['options']?_0xfb5528[_0xcfc1('0x18')][_0xcfc1('0x1a')]||null:null,'limit':_0xfb5528['options']?_0xfb5528[_0xcfc1('0x18')][_0xcfc1('0x1b')]||null:null,'include':_0xfb5528[_0xcfc1('0x18')]?_0xfb5528['options']['include']?_[_0xcfc1('0x1c')](_0xfb5528[_0xcfc1('0x18')][_0xcfc1('0x1d')],function(_0x49e6b0){return{'model':db[_0x49e6b0[_0xcfc1('0x1e')]],'as':_0x49e6b0['as'],'attributes':_0x49e6b0[_0xcfc1('0x1a')],'include':_0x49e6b0[_0xcfc1('0x1d')]?_[_0xcfc1('0x1c')](_0x49e6b0[_0xcfc1('0x1d')],function(_0x56fe29){return{'model':db[_0x56fe29['model']],'as':_0x56fe29['as'],'attributes':_0x56fe29[_0xcfc1('0x1a')],'include':_0x56fe29[_0xcfc1('0x1d')]?_['map'](_0x56fe29[_0xcfc1('0x1d')],function(_0x5cfbb7){return{'model':db[_0x5cfbb7[_0xcfc1('0x1e')]],'as':_0x5cfbb7['as'],'attributes':_0x5cfbb7[_0xcfc1('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x189d9a){logger[_0xcfc1('0x13')]('GetSugarcrmAccount',_0xfb5528);logger['debug']('GetSugarcrmAccount',_0xfb5528,JSON[_0xcfc1('0x10')](_0x189d9a));_0x2f7f4c(_0x189d9a);})['catch'](function(_0x46d591){logger[_0xcfc1('0x11')](_0xcfc1('0x16'),_0x46d591[_0xcfc1('0x12')],_0xfb5528);_0x4a5ee7(_0x3c4b91[_0xcfc1('0x11')](0x1f4,_0x46d591[_0xcfc1('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x28f3ec){var _0x350b85=this;return new Promise(function(_0x11d747,_0x9b2954){return db[_0xcfc1('0x17')][_0xcfc1('0x1f')]({'raw':_0x28f3ec[_0xcfc1('0x18')]?_0x28f3ec[_0xcfc1('0x18')][_0xcfc1('0x20')]===undefined?!![]:![]:!![],'where':_0x28f3ec[_0xcfc1('0x18')]?_0x28f3ec[_0xcfc1('0x18')][_0xcfc1('0x19')]||null:null,'attributes':_0x28f3ec[_0xcfc1('0x18')]?_0x28f3ec[_0xcfc1('0x18')][_0xcfc1('0x1a')]||null:null,'include':_0x28f3ec[_0xcfc1('0x18')]?_0x28f3ec[_0xcfc1('0x18')][_0xcfc1('0x1d')]?_[_0xcfc1('0x1c')](_0x28f3ec['options']['include'],function(_0x35c717){return{'model':db[_0x35c717[_0xcfc1('0x1e')]],'as':_0x35c717['as'],'attributes':_0x35c717[_0xcfc1('0x1a')],'include':_0x35c717[_0xcfc1('0x1d')]?_[_0xcfc1('0x1c')](_0x35c717[_0xcfc1('0x1d')],function(_0x524fac){return{'model':db[_0x524fac[_0xcfc1('0x1e')]],'as':_0x524fac['as'],'attributes':_0x524fac[_0xcfc1('0x1a')],'include':_0x524fac['include']?_[_0xcfc1('0x1c')](_0x524fac[_0xcfc1('0x1d')],function(_0x5cad08){return{'model':db[_0x5cad08[_0xcfc1('0x1e')]],'as':_0x5cad08['as'],'attributes':_0x5cad08[_0xcfc1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcfc1('0xb')](function(_0x19fd9d){logger['info'](_0xcfc1('0x21'),_0x28f3ec);logger[_0xcfc1('0xe')]('ShowSugarcrmAccount',_0x28f3ec,JSON[_0xcfc1('0x10')](_0x19fd9d));_0x11d747(_0x19fd9d);})[_0xcfc1('0x15')](function(_0x351a0e){logger[_0xcfc1('0x11')](_0xcfc1('0x21'),_0x351a0e[_0xcfc1('0x12')],_0x28f3ec);_0x9b2954(_0x350b85['error'](0x1f4,_0x351a0e[_0xcfc1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 73ae002..b2c8ee1 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 _0x8ee4=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x30e6c2,_0x35f625){var _0x4e3afe=function(_0x4a1337){while(--_0x4a1337){_0x30e6c2['push'](_0x30e6c2['shift']());}};_0x4e3afe(++_0x35f625);}(_0x8ee4,0x115));var _0x48ee=function(_0x3f07d3,_0x2a0466){_0x3f07d3=_0x3f07d3-0x0;var _0x2ee062=_0x8ee4[_0x3f07d3];return _0x2ee062;};'use strict';var multer=require(_0x48ee('0x0'));var util=require('util');var path=require(_0x48ee('0x1'));var timeout=require(_0x48ee('0x2'));var express=require('express');var router=express[_0x48ee('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x48ee('0x4'));var interaction=require(_0x48ee('0x5'));var config=require(_0x48ee('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x48ee('0x7')]('/',auth[_0x48ee('0x8')](),controller['index']);router[_0x48ee('0x7')](_0x48ee('0x9'),auth[_0x48ee('0x8')](),controller[_0x48ee('0xa')]);router['get'](_0x48ee('0xb'),auth[_0x48ee('0x8')](),controller[_0x48ee('0xc')]);router[_0x48ee('0x7')](_0x48ee('0xd'),auth[_0x48ee('0x8')](),controller[_0x48ee('0xe')]);router['get'](_0x48ee('0xf'),auth[_0x48ee('0x8')](),controller[_0x48ee('0x10')]);router[_0x48ee('0x11')]('/',auth[_0x48ee('0x8')](),controller[_0x48ee('0x12')]);router[_0x48ee('0x13')](_0x48ee('0x9'),auth[_0x48ee('0x8')](),controller[_0x48ee('0x14')]);router[_0x48ee('0x15')](_0x48ee('0x9'),auth[_0x48ee('0x8')](),controller[_0x48ee('0x16')]);module[_0x48ee('0x17')]=router; \ No newline at end of file +var _0xb504=['getDescriptions','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb504,0xbd));var _0x4b50=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb504[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x4b50('0x0'));var util=require(_0x4b50('0x1'));var path=require(_0x4b50('0x2'));var timeout=require(_0x4b50('0x3'));var express=require(_0x4b50('0x4'));var router=express[_0x4b50('0x5')]();var fs_extra=require(_0x4b50('0x6'));var auth=require(_0x4b50('0x7'));var interaction=require(_0x4b50('0x8'));var config=require(_0x4b50('0x9'));var controller=require(_0x4b50('0xa'));router[_0x4b50('0xb')]('/',auth['isAuthenticated'](),controller[_0x4b50('0xc')]);router['get']('/:id',auth[_0x4b50('0xd')](),controller[_0x4b50('0xe')]);router[_0x4b50('0xb')](_0x4b50('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x4b50('0xb')](_0x4b50('0x10'),auth['isAuthenticated'](),controller[_0x4b50('0x11')]);router[_0x4b50('0xb')](_0x4b50('0x12'),auth[_0x4b50('0xd')](),controller[_0x4b50('0x13')]);router[_0x4b50('0x14')]('/',auth[_0x4b50('0xd')](),controller[_0x4b50('0x15')]);router[_0x4b50('0x16')](_0x4b50('0x17'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4b50('0x17'),auth['isAuthenticated'](),controller[_0x4b50('0x18')]);module[_0x4b50('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 1c011bc..6f318fd 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 _0x443f=['exports','sequelize'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x443f,0x169));var _0xf443=function(_0x1c944b,_0x4f54b0){_0x1c944b=_0x1c944b-0x0;var _0x7b42b6=_0x443f[_0x1c944b];return _0x7b42b6;};'use strict';var Sequelize=require(_0xf443('0x0'));module[_0xf443('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe987=['sequelize','exports','STRING'];(function(_0x598375,_0x3bedf8){var _0x119579=function(_0x352053){while(--_0x352053){_0x598375['push'](_0x598375['shift']());}};_0x119579(++_0x3bedf8);}(_0xe987,0xc9));var _0x7e98=function(_0x4845bc,_0x25e144){_0x4845bc=_0x4845bc-0x0;var _0x82713d=_0xe987[_0x4845bc];return _0x82713d;};'use strict';var Sequelize=require(_0x7e98('0x0'));module[_0x7e98('0x1')]={'name':{'type':Sequelize[_0x7e98('0x2')]},'description':{'type':Sequelize[_0x7e98('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9a24a5b..86948f0 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 _0x05a6=['nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','includeAll','include','rows','catch','show','params','options','create','body','update','find','getFields','findOne','SugarcrmField'];(function(_0xb554e9,_0x11490a){var _0x592459=function(_0xa05e72){while(--_0xa05e72){_0xb554e9['push'](_0xb554e9['shift']());}};_0x592459(++_0x11490a);}(_0x05a6,0x14f));var _0x605a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x05a6[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require(_0x605a('0x0'));var rimraf=require(_0x605a('0x1'));var zipdir=require(_0x605a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x605a('0x3'));var moment=require(_0x605a('0x4'));var BPromise=require(_0x605a('0x5'));var Mustache=require(_0x605a('0x6'));var util=require(_0x605a('0x7'));var path=require(_0x605a('0x8'));var sox=require(_0x605a('0x9'));var csv=require('to-csv');var ejs=require(_0x605a('0xa'));var fs=require('fs');var fs_extra=require(_0x605a('0xb'));var _=require(_0x605a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x605a('0xd'));var deskjs=require(_0x605a('0xe'));var toCsv=require(_0x605a('0xf'));var querystring=require(_0x605a('0x10'));var Papa=require(_0x605a('0x11'));var Redis=require(_0x605a('0x12'));var authService=require(_0x605a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x605a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x605a('0x15'));var utils=require(_0x605a('0x16'));var config=require(_0x605a('0x17'));var licenseUtil=require(_0x605a('0x18'));var db=require(_0x605a('0x19'))['db'];function respondWithStatusCode(_0x32cc47,_0x4223da){_0x4223da=_0x4223da||0xcc;return function(_0x6cf8e3){if(_0x6cf8e3){return _0x32cc47[_0x605a('0x1a')](_0x4223da);}return _0x32cc47[_0x605a('0x1b')](_0x4223da)[_0x605a('0x1c')]();};}function respondWithResult(_0x743492,_0x509964){_0x509964=_0x509964||0xc8;return function(_0x30b698){if(_0x30b698){return _0x743492[_0x605a('0x1b')](_0x509964)[_0x605a('0x1d')](_0x30b698);}};}function respondWithFilteredResult(_0x59f1b0,_0x1aa73f){return function(_0x44bc74){if(_0x44bc74){var _0x5604f9=typeof _0x1aa73f[_0x605a('0x1e')]===_0x605a('0x1f')&&typeof _0x1aa73f[_0x605a('0x20')]===_0x605a('0x1f');var _0x1b5925=_0x44bc74[_0x605a('0x21')];var _0x34c7ee=_0x5604f9?0x0:_0x1aa73f['offset'];var _0x2ddf6c=_0x5604f9?_0x44bc74[_0x605a('0x21')]:_0x1aa73f[_0x605a('0x1e')]+_0x1aa73f['limit'];var _0x49f816;if(_0x2ddf6c>=_0x1b5925){_0x2ddf6c=_0x1b5925;_0x49f816=0xc8;}else{_0x49f816=0xce;}_0x59f1b0[_0x605a('0x1b')](_0x49f816);return _0x59f1b0[_0x605a('0x22')](_0x605a('0x23'),_0x34c7ee+'-'+_0x2ddf6c+'/'+_0x1b5925)[_0x605a('0x1d')](_0x44bc74);}return null;};}function patchUpdates(_0x2ffa1e){return function(_0x3e76c7){try{jsonpatch['apply'](_0x3e76c7,_0x2ffa1e,!![]);}catch(_0xc549a6){return BPromise['reject'](_0xc549a6);}return _0x3e76c7[_0x605a('0x24')]();};}function saveUpdates(_0x2e4ccb,_0x53ac9c){return function(_0xf837e2){if(_0xf837e2){return _0xf837e2['update'](_0x2e4ccb)[_0x605a('0x25')](function(_0x1faedc){return _0x1faedc;});}return null;};}function removeEntity(_0x31eee2,_0x4e9bc9){return function(_0x2b0162){if(_0x2b0162){return _0x2b0162[_0x605a('0x26')]()['then'](function(){_0x31eee2[_0x605a('0x1b')](0xcc)[_0x605a('0x1c')]();});}};}function handleEntityNotFound(_0x442e39,_0x3ba89f){return function(_0x71d698){if(!_0x71d698){_0x442e39[_0x605a('0x1a')](0x194);}return _0x71d698;};}function handleError(_0x801dfa,_0x160651){_0x160651=_0x160651||0x1f4;return function(_0x1ddbd2){logger[_0x605a('0x27')](_0x1ddbd2[_0x605a('0x28')]);if(_0x1ddbd2[_0x605a('0x29')]){delete _0x1ddbd2[_0x605a('0x29')];}_0x801dfa[_0x605a('0x1b')](_0x160651)[_0x605a('0x2a')](_0x1ddbd2);};}exports[_0x605a('0x2b')]=function(_0x1798fe,_0x360653){var _0x4c502a={},_0x5c9519={},_0x4ae921={'count':0x0,'rows':[]};var _0x3d701e=_['map'](db[_0x605a('0x2c')][_0x605a('0x2d')],function(_0x315426){return{'name':_0x315426[_0x605a('0x2e')],'type':_0x315426[_0x605a('0x2f')][_0x605a('0x30')]};});_0x5c9519[_0x605a('0x31')]=_['map'](_0x3d701e,_0x605a('0x29'));_0x5c9519[_0x605a('0x32')]=_[_0x605a('0x33')](_0x1798fe[_0x605a('0x32')]);_0x5c9519['filters']=_[_0x605a('0x34')](_0x5c9519[_0x605a('0x31')],_0x5c9519[_0x605a('0x32')]);_0x4c502a[_0x605a('0x35')]=_['intersection'](_0x5c9519[_0x605a('0x31')],qs['fields'](_0x1798fe[_0x605a('0x32')][_0x605a('0x36')]));_0x4c502a['attributes']=_0x4c502a['attributes'][_0x605a('0x37')]?_0x4c502a[_0x605a('0x35')]:_0x5c9519['model'];if(!_0x1798fe[_0x605a('0x32')][_0x605a('0x38')]('nolimit')){_0x4c502a['limit']=qs[_0x605a('0x20')](_0x1798fe['query'][_0x605a('0x20')]);_0x4c502a[_0x605a('0x1e')]=qs[_0x605a('0x1e')](_0x1798fe[_0x605a('0x32')][_0x605a('0x1e')]);}_0x4c502a[_0x605a('0x39')]=qs[_0x605a('0x3a')](_0x1798fe[_0x605a('0x32')][_0x605a('0x3a')]);_0x4c502a[_0x605a('0x3b')]=qs['filters'](_[_0x605a('0x3c')](_0x1798fe[_0x605a('0x32')],_0x5c9519[_0x605a('0x3d')]),_0x3d701e);if(_0x1798fe[_0x605a('0x32')][_0x605a('0x3e')]){_0x4c502a[_0x605a('0x3b')]=_[_0x605a('0x3f')](_0x4c502a[_0x605a('0x3b')],{'$or':_[_0x605a('0x40')](_0x3d701e,function(_0x529e79){if(_0x529e79[_0x605a('0x2f')]!==_0x605a('0x41')){var _0x214ffa={};_0x214ffa[_0x529e79[_0x605a('0x29')]]={'$like':'%'+_0x1798fe['query'][_0x605a('0x3e')]+'%'};return _0x214ffa;}})});}_0x4c502a=_[_0x605a('0x3f')]({},_0x4c502a,_0x1798fe['options']);var _0x1b77d1={'where':_0x4c502a[_0x605a('0x3b')]};return db[_0x605a('0x2c')][_0x605a('0x21')](_0x1b77d1)[_0x605a('0x25')](function(_0x2dbdcd){_0x4ae921[_0x605a('0x21')]=_0x2dbdcd;if(_0x1798fe[_0x605a('0x32')][_0x605a('0x42')]){_0x4c502a[_0x605a('0x43')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x4c502a);})['then'](function(_0x52bbdb){_0x4ae921[_0x605a('0x44')]=_0x52bbdb;return _0x4ae921;})[_0x605a('0x25')](respondWithFilteredResult(_0x360653,_0x4c502a))[_0x605a('0x45')](handleError(_0x360653,null));};exports[_0x605a('0x46')]=function(_0x5a4479,_0x23bde3){var _0x2f30d7={'raw':![],'where':{'id':_0x5a4479[_0x605a('0x47')]['id']}},_0x439217={};_0x439217[_0x605a('0x31')]=_[_0x605a('0x33')](db[_0x605a('0x2c')][_0x605a('0x2d')]);_0x439217['query']=_['keys'](_0x5a4479['query']);_0x439217[_0x605a('0x3d')]=_[_0x605a('0x34')](_0x439217[_0x605a('0x31')],_0x439217[_0x605a('0x32')]);_0x2f30d7[_0x605a('0x35')]=_[_0x605a('0x34')](_0x439217[_0x605a('0x31')],qs[_0x605a('0x36')](_0x5a4479[_0x605a('0x32')]['fields']));_0x2f30d7['attributes']=_0x2f30d7[_0x605a('0x35')][_0x605a('0x37')]?_0x2f30d7[_0x605a('0x35')]:_0x439217[_0x605a('0x31')];if(_0x5a4479[_0x605a('0x32')][_0x605a('0x42')]){_0x2f30d7[_0x605a('0x43')]=[{'all':!![]}];}_0x2f30d7=_[_0x605a('0x3f')]({},_0x2f30d7,_0x5a4479[_0x605a('0x48')]);return db[_0x605a('0x2c')]['find'](_0x2f30d7)[_0x605a('0x25')](handleEntityNotFound(_0x23bde3,null))[_0x605a('0x25')](respondWithResult(_0x23bde3,null))[_0x605a('0x45')](handleError(_0x23bde3,null));};exports[_0x605a('0x49')]=function(_0x223a37,_0x1c212b){return db[_0x605a('0x2c')]['create'](_0x223a37[_0x605a('0x4a')],{})[_0x605a('0x25')](respondWithResult(_0x1c212b,0xc9))['catch'](handleError(_0x1c212b,null));};exports[_0x605a('0x4b')]=function(_0x4442f0,_0x31eb00){if(_0x4442f0[_0x605a('0x4a')]['id']){delete _0x4442f0[_0x605a('0x4a')]['id'];}return db[_0x605a('0x2c')][_0x605a('0x4c')]({'where':{'id':_0x4442f0['params']['id']}})[_0x605a('0x25')](handleEntityNotFound(_0x31eb00,null))[_0x605a('0x25')](saveUpdates(_0x4442f0['body'],null))[_0x605a('0x25')](respondWithResult(_0x31eb00,null))['catch'](handleError(_0x31eb00,null));};exports['destroy']=function(_0x35d536,_0x58463c){return db[_0x605a('0x2c')]['find']({'where':{'id':_0x35d536[_0x605a('0x47')]['id']}})[_0x605a('0x25')](handleEntityNotFound(_0x58463c,null))[_0x605a('0x25')](removeEntity(_0x58463c,null))['catch'](handleError(_0x58463c,null));};exports[_0x605a('0x4d')]=function(_0x56097a,_0x43569d,_0x329f68){var _0x251390={};var _0x2a2ac7={};var _0x1d463e;var _0x1edf7a;return db[_0x605a('0x2c')][_0x605a('0x4e')]({'where':{'id':_0x56097a[_0x605a('0x47')]['id']}})[_0x605a('0x25')](handleEntityNotFound(_0x43569d,null))[_0x605a('0x25')](function(_0x272228){if(_0x272228){_0x1d463e=_0x272228;_0x2a2ac7[_0x605a('0x31')]=_[_0x605a('0x33')](db[_0x605a('0x4f')][_0x605a('0x2d')]);_0x2a2ac7[_0x605a('0x32')]=_[_0x605a('0x33')](_0x56097a[_0x605a('0x32')]);_0x2a2ac7[_0x605a('0x3d')]=_['intersection'](_0x2a2ac7[_0x605a('0x31')],_0x2a2ac7[_0x605a('0x32')]);_0x251390['attributes']=_[_0x605a('0x34')](_0x2a2ac7[_0x605a('0x31')],qs[_0x605a('0x36')](_0x56097a[_0x605a('0x32')][_0x605a('0x36')]));_0x251390[_0x605a('0x35')]=_0x251390['attributes']['length']?_0x251390[_0x605a('0x35')]:_0x2a2ac7['model'];_0x251390[_0x605a('0x39')]=qs[_0x605a('0x3a')](_0x56097a[_0x605a('0x32')][_0x605a('0x3a')]);_0x251390[_0x605a('0x3b')]=qs[_0x605a('0x3d')](_[_0x605a('0x3c')](_0x56097a[_0x605a('0x32')],_0x2a2ac7[_0x605a('0x3d')]));if(_0x56097a[_0x605a('0x32')][_0x605a('0x3e')]){_0x251390['where']=_['merge'](_0x251390[_0x605a('0x3b')],{'$or':_[_0x605a('0x40')](_0x251390[_0x605a('0x35')],function(_0xe412eb){var _0x14f57b={};_0x14f57b[_0xe412eb]={'$like':'%'+_0x56097a[_0x605a('0x32')][_0x605a('0x3e')]+'%'};return _0x14f57b;})});}_0x251390=_[_0x605a('0x3f')]({},_0x251390,_0x56097a[_0x605a('0x48')]);return _0x1d463e['getFields'](_0x251390);}})[_0x605a('0x25')](function(_0x3bccd6){if(_0x3bccd6){_0x1edf7a=_0x3bccd6[_0x605a('0x37')];if(!_0x56097a['query']['hasOwnProperty'](_0x605a('0x50'))){_0x251390[_0x605a('0x20')]=qs[_0x605a('0x20')](_0x56097a[_0x605a('0x32')][_0x605a('0x20')]);_0x251390['offset']=qs[_0x605a('0x1e')](_0x56097a[_0x605a('0x32')][_0x605a('0x1e')]);}return _0x1d463e[_0x605a('0x4d')](_0x251390);}})['then'](function(_0x1b0f9f){if(_0x1b0f9f){return _0x1b0f9f?{'count':_0x1edf7a,'rows':_0x1b0f9f}:null;}})[_0x605a('0x25')](respondWithResult(_0x43569d,null))['catch'](handleError(_0x43569d,null));};exports[_0x605a('0x51')]=function(_0xc36a58,_0x564ca5,_0x6091af){var _0x5e6ac7={};var _0x100e65={};var _0x36583a;var _0x20fa31;return db[_0x605a('0x2c')][_0x605a('0x4e')]({'where':{'id':_0xc36a58[_0x605a('0x47')]['id']}})[_0x605a('0x25')](handleEntityNotFound(_0x564ca5,null))[_0x605a('0x25')](function(_0x4150e4){if(_0x4150e4){_0x36583a=_0x4150e4;_0x100e65['model']=_['keys'](db['SugarcrmField']['rawAttributes']);_0x100e65['query']=_[_0x605a('0x33')](_0xc36a58['query']);_0x100e65[_0x605a('0x3d')]=_['intersection'](_0x100e65['model'],_0x100e65[_0x605a('0x32')]);_0x5e6ac7[_0x605a('0x35')]=_[_0x605a('0x34')](_0x100e65[_0x605a('0x31')],qs[_0x605a('0x36')](_0xc36a58[_0x605a('0x32')][_0x605a('0x36')]));_0x5e6ac7[_0x605a('0x35')]=_0x5e6ac7[_0x605a('0x35')][_0x605a('0x37')]?_0x5e6ac7['attributes']:_0x100e65[_0x605a('0x31')];_0x5e6ac7['order']=qs[_0x605a('0x3a')](_0xc36a58[_0x605a('0x32')][_0x605a('0x3a')]);_0x5e6ac7[_0x605a('0x3b')]=qs[_0x605a('0x3d')](_[_0x605a('0x3c')](_0xc36a58[_0x605a('0x32')],_0x100e65[_0x605a('0x3d')]));if(_0xc36a58['query'][_0x605a('0x3e')]){_0x5e6ac7[_0x605a('0x3b')]=_[_0x605a('0x3f')](_0x5e6ac7[_0x605a('0x3b')],{'$or':_[_0x605a('0x40')](_0x5e6ac7[_0x605a('0x35')],function(_0x4cf489){var _0x171884={};_0x171884[_0x4cf489]={'$like':'%'+_0xc36a58['query'][_0x605a('0x3e')]+'%'};return _0x171884;})});}_0x5e6ac7=_[_0x605a('0x3f')]({},_0x5e6ac7,_0xc36a58[_0x605a('0x48')]);return _0x36583a[_0x605a('0x51')](_0x5e6ac7);}})[_0x605a('0x25')](function(_0x4cca6d){if(_0x4cca6d){_0x20fa31=_0x4cca6d[_0x605a('0x37')];if(!_0xc36a58['query']['hasOwnProperty'](_0x605a('0x50'))){_0x5e6ac7[_0x605a('0x20')]=qs[_0x605a('0x20')](_0xc36a58['query'][_0x605a('0x20')]);_0x5e6ac7[_0x605a('0x1e')]=qs[_0x605a('0x1e')](_0xc36a58[_0x605a('0x32')][_0x605a('0x1e')]);}return _0x36583a[_0x605a('0x51')](_0x5e6ac7);}})[_0x605a('0x25')](function(_0x3cc66e){if(_0x3cc66e){return _0x3cc66e?{'count':_0x20fa31,'rows':_0x3cc66e}:null;}})[_0x605a('0x25')](respondWithResult(_0x564ca5,null))[_0x605a('0x45')](handleError(_0x564ca5,null));};exports[_0x605a('0x52')]=function(_0x4dbea4,_0x5d6c0e,_0x1b8cc9){var _0x20f439={};var _0x6d293a={};var _0x3f7987;var _0x10ad77;return db['SugarcrmConfiguration'][_0x605a('0x4e')]({'where':{'id':_0x4dbea4[_0x605a('0x47')]['id']}})[_0x605a('0x25')](handleEntityNotFound(_0x5d6c0e,null))[_0x605a('0x25')](function(_0x5a800a){if(_0x5a800a){_0x3f7987=_0x5a800a;_0x6d293a[_0x605a('0x31')]=_[_0x605a('0x33')](db['SugarcrmField'][_0x605a('0x2d')]);_0x6d293a[_0x605a('0x32')]=_[_0x605a('0x33')](_0x4dbea4[_0x605a('0x32')]);_0x6d293a[_0x605a('0x3d')]=_[_0x605a('0x34')](_0x6d293a['model'],_0x6d293a[_0x605a('0x32')]);_0x20f439[_0x605a('0x35')]=_[_0x605a('0x34')](_0x6d293a[_0x605a('0x31')],qs[_0x605a('0x36')](_0x4dbea4[_0x605a('0x32')][_0x605a('0x36')]));_0x20f439[_0x605a('0x35')]=_0x20f439[_0x605a('0x35')][_0x605a('0x37')]?_0x20f439[_0x605a('0x35')]:_0x6d293a[_0x605a('0x31')];_0x20f439[_0x605a('0x39')]=qs[_0x605a('0x3a')](_0x4dbea4[_0x605a('0x32')][_0x605a('0x3a')]);_0x20f439[_0x605a('0x3b')]=qs[_0x605a('0x3d')](_['pick'](_0x4dbea4['query'],_0x6d293a[_0x605a('0x3d')]));if(_0x4dbea4['query']['filter']){_0x20f439[_0x605a('0x3b')]=_[_0x605a('0x3f')](_0x20f439[_0x605a('0x3b')],{'$or':_[_0x605a('0x40')](_0x20f439[_0x605a('0x35')],function(_0x3fc2cf){var _0x1a529f={};_0x1a529f[_0x3fc2cf]={'$like':'%'+_0x4dbea4['query'][_0x605a('0x3e')]+'%'};return _0x1a529f;})});}_0x20f439=_[_0x605a('0x3f')]({},_0x20f439,_0x4dbea4['options']);return _0x3f7987['getDescriptions'](_0x20f439);}})['then'](function(_0x2811b5){if(_0x2811b5){_0x10ad77=_0x2811b5[_0x605a('0x37')];if(!_0x4dbea4[_0x605a('0x32')]['hasOwnProperty'](_0x605a('0x50'))){_0x20f439[_0x605a('0x20')]=qs['limit'](_0x4dbea4['query'][_0x605a('0x20')]);_0x20f439[_0x605a('0x1e')]=qs[_0x605a('0x1e')](_0x4dbea4[_0x605a('0x32')]['offset']);}return _0x3f7987[_0x605a('0x52')](_0x20f439);}})['then'](function(_0x547807){if(_0x547807){return _0x547807?{'count':_0x10ad77,'rows':_0x547807}:null;}})[_0x605a('0x25')](respondWithResult(_0x5d6c0e,null))['catch'](handleError(_0x5d6c0e,null));}; \ No newline at end of file +var _0xc40e=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','getFields','findOne','params','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','apply','reject','save','update','destroy','then','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0xc40e,0x1a2));var _0xec40=function(_0xf974f4,_0x4c3f1c){_0xf974f4=_0xf974f4-0x0;var _0x1a1e47=_0xc40e[_0xf974f4];return _0x1a1e47;};'use strict';var emlformat=require(_0xec40('0x0'));var rimraf=require(_0xec40('0x1'));var zipdir=require(_0xec40('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec40('0x3'));var moment=require(_0xec40('0x4'));var BPromise=require(_0xec40('0x5'));var Mustache=require(_0xec40('0x6'));var util=require(_0xec40('0x7'));var path=require(_0xec40('0x8'));var sox=require(_0xec40('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec40('0xa'));var _=require(_0xec40('0xb'));var squel=require(_0xec40('0xc'));var crypto=require(_0xec40('0xd'));var jsforce=require(_0xec40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xec40('0xf'));var querystring=require('querystring');var Papa=require(_0xec40('0x10'));var Redis=require('ioredis');var authService=require(_0xec40('0x11'));var qs=require(_0xec40('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec40('0x13'));var logger=require(_0xec40('0x14'))(_0xec40('0x15'));var utils=require('../../config/utils');var config=require(_0xec40('0x16'));var licenseUtil=require(_0xec40('0x17'));var db=require(_0xec40('0x18'))['db'];function respondWithStatusCode(_0x354468,_0x25b9c4){_0x25b9c4=_0x25b9c4||0xcc;return function(_0xecb835){if(_0xecb835){return _0x354468[_0xec40('0x19')](_0x25b9c4);}return _0x354468[_0xec40('0x1a')](_0x25b9c4)['end']();};}function respondWithResult(_0x1268e6,_0x19575a){_0x19575a=_0x19575a||0xc8;return function(_0x4eea2e){if(_0x4eea2e){return _0x1268e6[_0xec40('0x1a')](_0x19575a)[_0xec40('0x1b')](_0x4eea2e);}};}function respondWithFilteredResult(_0x1c8914,_0x4b4a37){return function(_0x47ab59){if(_0x47ab59){var _0x1de5ac=typeof _0x4b4a37[_0xec40('0x1c')]===_0xec40('0x1d')&&typeof _0x4b4a37['limit']===_0xec40('0x1d');var _0x475111=_0x47ab59[_0xec40('0x1e')];var _0x205f60=_0x1de5ac?0x0:_0x4b4a37[_0xec40('0x1c')];var _0xffc8dd=_0x1de5ac?_0x47ab59['count']:_0x4b4a37[_0xec40('0x1c')]+_0x4b4a37['limit'];var _0x370be5;if(_0xffc8dd>=_0x475111){_0xffc8dd=_0x475111;_0x370be5=0xc8;}else{_0x370be5=0xce;}_0x1c8914[_0xec40('0x1a')](_0x370be5);return _0x1c8914['set']('Content-Range',_0x205f60+'-'+_0xffc8dd+'/'+_0x475111)[_0xec40('0x1b')](_0x47ab59);}return null;};}function patchUpdates(_0x53b2b8){return function(_0x5b72af){try{jsonpatch[_0xec40('0x1f')](_0x5b72af,_0x53b2b8,!![]);}catch(_0x36b2b0){return BPromise[_0xec40('0x20')](_0x36b2b0);}return _0x5b72af[_0xec40('0x21')]();};}function saveUpdates(_0x560d53,_0x206704){return function(_0x3bfbbb){if(_0x3bfbbb){return _0x3bfbbb[_0xec40('0x22')](_0x560d53)['then'](function(_0x5a3d87){return _0x5a3d87;});}return null;};}function removeEntity(_0x5a4e62,_0x1471f6){return function(_0x57a69e){if(_0x57a69e){return _0x57a69e[_0xec40('0x23')]()[_0xec40('0x24')](function(){_0x5a4e62['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x264796,_0x328db8){return function(_0x1d036d){if(!_0x1d036d){_0x264796['sendStatus'](0x194);}return _0x1d036d;};}function handleError(_0x31b465,_0x3f2ce8){_0x3f2ce8=_0x3f2ce8||0x1f4;return function(_0x2bf315){logger['error'](_0x2bf315['stack']);if(_0x2bf315[_0xec40('0x25')]){delete _0x2bf315['name'];}_0x31b465[_0xec40('0x1a')](_0x3f2ce8)[_0xec40('0x26')](_0x2bf315);};}exports[_0xec40('0x27')]=function(_0x42e1a5,_0x8e7c91){var _0x33ffc4={},_0x348e74={},_0xc95c6d={'count':0x0,'rows':[]};var _0x8d9884=_[_0xec40('0x28')](db[_0xec40('0x29')][_0xec40('0x2a')],function(_0x52fe8c){return{'name':_0x52fe8c[_0xec40('0x2b')],'type':_0x52fe8c[_0xec40('0x2c')]['key']};});_0x348e74[_0xec40('0x2d')]=_[_0xec40('0x28')](_0x8d9884,'name');_0x348e74[_0xec40('0x2e')]=_[_0xec40('0x2f')](_0x42e1a5[_0xec40('0x2e')]);_0x348e74[_0xec40('0x30')]=_[_0xec40('0x31')](_0x348e74[_0xec40('0x2d')],_0x348e74[_0xec40('0x2e')]);_0x33ffc4[_0xec40('0x32')]=_[_0xec40('0x31')](_0x348e74[_0xec40('0x2d')],qs[_0xec40('0x33')](_0x42e1a5[_0xec40('0x2e')][_0xec40('0x33')]));_0x33ffc4[_0xec40('0x32')]=_0x33ffc4[_0xec40('0x32')][_0xec40('0x34')]?_0x33ffc4[_0xec40('0x32')]:_0x348e74[_0xec40('0x2d')];if(!_0x42e1a5[_0xec40('0x2e')][_0xec40('0x35')](_0xec40('0x36'))){_0x33ffc4[_0xec40('0x37')]=qs[_0xec40('0x37')](_0x42e1a5['query'][_0xec40('0x37')]);_0x33ffc4['offset']=qs['offset'](_0x42e1a5['query'][_0xec40('0x1c')]);}_0x33ffc4[_0xec40('0x38')]=qs[_0xec40('0x39')](_0x42e1a5[_0xec40('0x2e')][_0xec40('0x39')]);_0x33ffc4[_0xec40('0x3a')]=qs[_0xec40('0x30')](_[_0xec40('0x3b')](_0x42e1a5[_0xec40('0x2e')],_0x348e74[_0xec40('0x30')]),_0x8d9884);if(_0x42e1a5[_0xec40('0x2e')][_0xec40('0x3c')]){_0x33ffc4[_0xec40('0x3a')]=_['merge'](_0x33ffc4[_0xec40('0x3a')],{'$or':_[_0xec40('0x28')](_0x8d9884,function(_0x2247d0){if(_0x2247d0[_0xec40('0x2c')]!==_0xec40('0x3d')){var _0x13e2b5={};_0x13e2b5[_0x2247d0[_0xec40('0x25')]]={'$like':'%'+_0x42e1a5[_0xec40('0x2e')][_0xec40('0x3c')]+'%'};return _0x13e2b5;}})});}_0x33ffc4=_[_0xec40('0x3e')]({},_0x33ffc4,_0x42e1a5[_0xec40('0x3f')]);var _0x33af87={'where':_0x33ffc4[_0xec40('0x3a')]};return db['SugarcrmConfiguration'][_0xec40('0x1e')](_0x33af87)['then'](function(_0x43368a){_0xc95c6d['count']=_0x43368a;if(_0x42e1a5[_0xec40('0x2e')][_0xec40('0x40')]){_0x33ffc4[_0xec40('0x41')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xec40('0x42')](_0x33ffc4);})[_0xec40('0x24')](function(_0x33665f){_0xc95c6d[_0xec40('0x43')]=_0x33665f;return _0xc95c6d;})[_0xec40('0x24')](respondWithFilteredResult(_0x8e7c91,_0x33ffc4))[_0xec40('0x44')](handleError(_0x8e7c91,null));};exports[_0xec40('0x45')]=function(_0x52d801,_0x64cb09){var _0x57c7df={'raw':![],'where':{'id':_0x52d801['params']['id']}},_0x26a50b={};_0x26a50b[_0xec40('0x2d')]=_[_0xec40('0x2f')](db['SugarcrmConfiguration'][_0xec40('0x2a')]);_0x26a50b[_0xec40('0x2e')]=_[_0xec40('0x2f')](_0x52d801[_0xec40('0x2e')]);_0x26a50b[_0xec40('0x30')]=_[_0xec40('0x31')](_0x26a50b[_0xec40('0x2d')],_0x26a50b[_0xec40('0x2e')]);_0x57c7df[_0xec40('0x32')]=_[_0xec40('0x31')](_0x26a50b[_0xec40('0x2d')],qs['fields'](_0x52d801['query']['fields']));_0x57c7df[_0xec40('0x32')]=_0x57c7df[_0xec40('0x32')][_0xec40('0x34')]?_0x57c7df[_0xec40('0x32')]:_0x26a50b['model'];if(_0x52d801[_0xec40('0x2e')][_0xec40('0x40')]){_0x57c7df['include']=[{'all':!![]}];}_0x57c7df=_[_0xec40('0x3e')]({},_0x57c7df,_0x52d801[_0xec40('0x3f')]);return db[_0xec40('0x29')][_0xec40('0x46')](_0x57c7df)[_0xec40('0x24')](handleEntityNotFound(_0x64cb09,null))[_0xec40('0x24')](respondWithResult(_0x64cb09,null))[_0xec40('0x44')](handleError(_0x64cb09,null));};exports[_0xec40('0x47')]=function(_0x37cf3e,_0x2e9f06){return db[_0xec40('0x29')][_0xec40('0x47')](_0x37cf3e[_0xec40('0x48')],{})[_0xec40('0x24')](respondWithResult(_0x2e9f06,0xc9))['catch'](handleError(_0x2e9f06,null));};exports[_0xec40('0x22')]=function(_0x54923f,_0x282793){if(_0x54923f[_0xec40('0x48')]['id']){delete _0x54923f['body']['id'];}return db[_0xec40('0x29')][_0xec40('0x46')]({'where':{'id':_0x54923f['params']['id']}})[_0xec40('0x24')](handleEntityNotFound(_0x282793,null))[_0xec40('0x24')](saveUpdates(_0x54923f[_0xec40('0x48')],null))[_0xec40('0x24')](respondWithResult(_0x282793,null))['catch'](handleError(_0x282793,null));};exports[_0xec40('0x23')]=function(_0x366bb1,_0x4ccd84){return db[_0xec40('0x29')][_0xec40('0x46')]({'where':{'id':_0x366bb1['params']['id']}})[_0xec40('0x24')](handleEntityNotFound(_0x4ccd84,null))[_0xec40('0x24')](removeEntity(_0x4ccd84,null))[_0xec40('0x44')](handleError(_0x4ccd84,null));};exports[_0xec40('0x49')]=function(_0x1f21e0,_0x5b10f3,_0x12b0c5){var _0x4ac962={};var _0x4c6d18={};var _0x31f887;var _0x103a8d;return db[_0xec40('0x29')][_0xec40('0x4a')]({'where':{'id':_0x1f21e0[_0xec40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b10f3,null))[_0xec40('0x24')](function(_0x1b397d){if(_0x1b397d){_0x31f887=_0x1b397d;_0x4c6d18[_0xec40('0x2d')]=_[_0xec40('0x2f')](db[_0xec40('0x4c')]['rawAttributes']);_0x4c6d18[_0xec40('0x2e')]=_['keys'](_0x1f21e0[_0xec40('0x2e')]);_0x4c6d18[_0xec40('0x30')]=_[_0xec40('0x31')](_0x4c6d18[_0xec40('0x2d')],_0x4c6d18['query']);_0x4ac962['attributes']=_[_0xec40('0x31')](_0x4c6d18[_0xec40('0x2d')],qs[_0xec40('0x33')](_0x1f21e0[_0xec40('0x2e')]['fields']));_0x4ac962[_0xec40('0x32')]=_0x4ac962[_0xec40('0x32')]['length']?_0x4ac962[_0xec40('0x32')]:_0x4c6d18[_0xec40('0x2d')];_0x4ac962[_0xec40('0x38')]=qs[_0xec40('0x39')](_0x1f21e0[_0xec40('0x2e')][_0xec40('0x39')]);_0x4ac962['where']=qs[_0xec40('0x30')](_['pick'](_0x1f21e0[_0xec40('0x2e')],_0x4c6d18[_0xec40('0x30')]));if(_0x1f21e0[_0xec40('0x2e')][_0xec40('0x3c')]){_0x4ac962['where']=_[_0xec40('0x3e')](_0x4ac962[_0xec40('0x3a')],{'$or':_[_0xec40('0x28')](_0x4ac962['attributes'],function(_0x60d131){var _0x576be4={};_0x576be4[_0x60d131]={'$like':'%'+_0x1f21e0[_0xec40('0x2e')][_0xec40('0x3c')]+'%'};return _0x576be4;})});}_0x4ac962=_[_0xec40('0x3e')]({},_0x4ac962,_0x1f21e0[_0xec40('0x3f')]);return _0x31f887[_0xec40('0x49')](_0x4ac962);}})[_0xec40('0x24')](function(_0x345157){if(_0x345157){_0x103a8d=_0x345157[_0xec40('0x34')];if(!_0x1f21e0[_0xec40('0x2e')][_0xec40('0x35')](_0xec40('0x36'))){_0x4ac962[_0xec40('0x37')]=qs[_0xec40('0x37')](_0x1f21e0[_0xec40('0x2e')][_0xec40('0x37')]);_0x4ac962['offset']=qs[_0xec40('0x1c')](_0x1f21e0[_0xec40('0x2e')][_0xec40('0x1c')]);}return _0x31f887[_0xec40('0x49')](_0x4ac962);}})[_0xec40('0x24')](function(_0x279461){if(_0x279461){return _0x279461?{'count':_0x103a8d,'rows':_0x279461}:null;}})[_0xec40('0x24')](respondWithResult(_0x5b10f3,null))[_0xec40('0x44')](handleError(_0x5b10f3,null));};exports[_0xec40('0x4d')]=function(_0x5e494d,_0x47309f,_0x46d0a8){var _0x304c99={};var _0x383e9e={};var _0x2c0335;var _0x30993d;return db[_0xec40('0x29')][_0xec40('0x4a')]({'where':{'id':_0x5e494d[_0xec40('0x4b')]['id']}})[_0xec40('0x24')](handleEntityNotFound(_0x47309f,null))[_0xec40('0x24')](function(_0x38caae){if(_0x38caae){_0x2c0335=_0x38caae;_0x383e9e[_0xec40('0x2d')]=_['keys'](db[_0xec40('0x4c')][_0xec40('0x2a')]);_0x383e9e[_0xec40('0x2e')]=_[_0xec40('0x2f')](_0x5e494d[_0xec40('0x2e')]);_0x383e9e[_0xec40('0x30')]=_[_0xec40('0x31')](_0x383e9e[_0xec40('0x2d')],_0x383e9e[_0xec40('0x2e')]);_0x304c99['attributes']=_[_0xec40('0x31')](_0x383e9e[_0xec40('0x2d')],qs[_0xec40('0x33')](_0x5e494d['query']['fields']));_0x304c99[_0xec40('0x32')]=_0x304c99['attributes'][_0xec40('0x34')]?_0x304c99[_0xec40('0x32')]:_0x383e9e['model'];_0x304c99[_0xec40('0x38')]=qs[_0xec40('0x39')](_0x5e494d[_0xec40('0x2e')][_0xec40('0x39')]);_0x304c99[_0xec40('0x3a')]=qs[_0xec40('0x30')](_[_0xec40('0x3b')](_0x5e494d[_0xec40('0x2e')],_0x383e9e[_0xec40('0x30')]));if(_0x5e494d[_0xec40('0x2e')][_0xec40('0x3c')]){_0x304c99['where']=_['merge'](_0x304c99[_0xec40('0x3a')],{'$or':_['map'](_0x304c99[_0xec40('0x32')],function(_0xa508f4){var _0x2c9028={};_0x2c9028[_0xa508f4]={'$like':'%'+_0x5e494d[_0xec40('0x2e')][_0xec40('0x3c')]+'%'};return _0x2c9028;})});}_0x304c99=_[_0xec40('0x3e')]({},_0x304c99,_0x5e494d[_0xec40('0x3f')]);return _0x2c0335[_0xec40('0x4d')](_0x304c99);}})[_0xec40('0x24')](function(_0x1a29b1){if(_0x1a29b1){_0x30993d=_0x1a29b1[_0xec40('0x34')];if(!_0x5e494d['query']['hasOwnProperty'](_0xec40('0x36'))){_0x304c99[_0xec40('0x37')]=qs[_0xec40('0x37')](_0x5e494d[_0xec40('0x2e')][_0xec40('0x37')]);_0x304c99[_0xec40('0x1c')]=qs[_0xec40('0x1c')](_0x5e494d[_0xec40('0x2e')]['offset']);}return _0x2c0335[_0xec40('0x4d')](_0x304c99);}})[_0xec40('0x24')](function(_0x489b6f){if(_0x489b6f){return _0x489b6f?{'count':_0x30993d,'rows':_0x489b6f}:null;}})['then'](respondWithResult(_0x47309f,null))[_0xec40('0x44')](handleError(_0x47309f,null));};exports[_0xec40('0x4e')]=function(_0x130118,_0x1d377c,_0x58a528){var _0x2370a5={};var _0x1bd113={};var _0x271084;var _0x45412d;return db['SugarcrmConfiguration'][_0xec40('0x4a')]({'where':{'id':_0x130118[_0xec40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1d377c,null))['then'](function(_0x274743){if(_0x274743){_0x271084=_0x274743;_0x1bd113[_0xec40('0x2d')]=_[_0xec40('0x2f')](db[_0xec40('0x4c')][_0xec40('0x2a')]);_0x1bd113[_0xec40('0x2e')]=_['keys'](_0x130118['query']);_0x1bd113['filters']=_['intersection'](_0x1bd113['model'],_0x1bd113[_0xec40('0x2e')]);_0x2370a5[_0xec40('0x32')]=_[_0xec40('0x31')](_0x1bd113[_0xec40('0x2d')],qs[_0xec40('0x33')](_0x130118[_0xec40('0x2e')][_0xec40('0x33')]));_0x2370a5[_0xec40('0x32')]=_0x2370a5['attributes'][_0xec40('0x34')]?_0x2370a5['attributes']:_0x1bd113[_0xec40('0x2d')];_0x2370a5[_0xec40('0x38')]=qs[_0xec40('0x39')](_0x130118[_0xec40('0x2e')][_0xec40('0x39')]);_0x2370a5[_0xec40('0x3a')]=qs[_0xec40('0x30')](_[_0xec40('0x3b')](_0x130118['query'],_0x1bd113['filters']));if(_0x130118[_0xec40('0x2e')]['filter']){_0x2370a5[_0xec40('0x3a')]=_[_0xec40('0x3e')](_0x2370a5[_0xec40('0x3a')],{'$or':_[_0xec40('0x28')](_0x2370a5[_0xec40('0x32')],function(_0x54d039){var _0x3a8c16={};_0x3a8c16[_0x54d039]={'$like':'%'+_0x130118[_0xec40('0x2e')][_0xec40('0x3c')]+'%'};return _0x3a8c16;})});}_0x2370a5=_[_0xec40('0x3e')]({},_0x2370a5,_0x130118['options']);return _0x271084['getDescriptions'](_0x2370a5);}})[_0xec40('0x24')](function(_0x193aec){if(_0x193aec){_0x45412d=_0x193aec[_0xec40('0x34')];if(!_0x130118[_0xec40('0x2e')][_0xec40('0x35')](_0xec40('0x36'))){_0x2370a5[_0xec40('0x37')]=qs[_0xec40('0x37')](_0x130118[_0xec40('0x2e')]['limit']);_0x2370a5[_0xec40('0x1c')]=qs[_0xec40('0x1c')](_0x130118[_0xec40('0x2e')][_0xec40('0x1c')]);}return _0x271084[_0xec40('0x4e')](_0x2370a5);}})[_0xec40('0x24')](function(_0x591a33){if(_0x591a33){return _0x591a33?{'count':_0x45412d,'rows':_0x591a33}:null;}})[_0xec40('0x24')](respondWithResult(_0x1d377c,null))[_0xec40('0x44')](handleError(_0x1d377c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ec5e43a..cc6fde4 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 _0x1958=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define'];(function(_0x4ecd76,_0x79f1f3){var _0x240f34=function(_0x563f79){while(--_0x563f79){_0x4ecd76['push'](_0x4ecd76['shift']());}};_0x240f34(++_0x79f1f3);}(_0x1958,0x6a));var _0x8195=function(_0x391154,_0x40fb12){_0x391154=_0x391154-0x0;var _0x4b7767=_0x1958[_0x391154];return _0x4b7767;};'use strict';var _=require(_0x8195('0x0'));var util=require(_0x8195('0x1'));var logger=require(_0x8195('0x2'))(_0x8195('0x3'));var moment=require('moment');var BPromise=require(_0x8195('0x4'));var rp=require(_0x8195('0x5'));var fs=require('fs');var path=require(_0x8195('0x6'));var rimraf=require(_0x8195('0x7'));var config=require(_0x8195('0x8'));var attributes=require(_0x8195('0x9'));module['exports']=function(_0x5e230f,_0x41a72a){return _0x5e230f[_0x8195('0xa')](_0x8195('0xb'),attributes,{'tableName':_0x8195('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5954=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x53e1ae,_0x2e4b5b){var _0x3d4827=function(_0xc9a82a){while(--_0xc9a82a){_0x53e1ae['push'](_0x53e1ae['shift']());}};_0x3d4827(++_0x2e4b5b);}(_0x5954,0x16e));var _0x4595=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5954[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x4595('0x0'));var util=require(_0x4595('0x1'));var logger=require(_0x4595('0x2'))(_0x4595('0x3'));var moment=require(_0x4595('0x4'));var BPromise=require(_0x4595('0x5'));var rp=require(_0x4595('0x6'));var fs=require('fs');var path=require(_0x4595('0x7'));var rimraf=require(_0x4595('0x8'));var config=require(_0x4595('0x9'));var attributes=require(_0x4595('0xa'));module[_0x4595('0xb')]=function(_0xa2e720,_0x1ce84c){return _0xa2e720[_0x4595('0xc')](_0x4595('0xd'),attributes,{'tableName':_0x4595('0xe'),'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 9ce1cb5..37533a3 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 _0x55ce=['request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x452e8a,_0x583a42){var _0x430960=function(_0x146a9f){while(--_0x146a9f){_0x452e8a['push'](_0x452e8a['shift']());}};_0x430960(++_0x583a42);}(_0x55ce,0x91));var _0xe55c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x55ce[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe55c('0x0'));var util=require(_0xe55c('0x1'));var moment=require('moment');var BPromise=require(_0xe55c('0x2'));var rs=require(_0xe55c('0x3'));var fs=require('fs');var Redis=require(_0xe55c('0x4'));var db=require(_0xe55c('0x5'))['db'];var utils=require(_0xe55c('0x6'));var logger=require(_0xe55c('0x7'))(_0xe55c('0x8'));var config=require('../../config/environment');var jayson=require(_0xe55c('0x9'));var client=jayson[_0xe55c('0xa')][_0xe55c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30a9a0,_0x10d47e,_0xbc192f){return new BPromise(function(_0x1b5934,_0x267f96){return client[_0xe55c('0xc')](_0x30a9a0,_0xbc192f)[_0xe55c('0xd')](function(_0x4e2429){logger[_0xe55c('0xe')](_0xe55c('0xf'),_0x10d47e,_0xe55c('0x10'));logger['debug'](_0xe55c('0x11'),_0x10d47e,'request\x20sent',JSON[_0xe55c('0x12')](_0x4e2429));if(_0x4e2429[_0xe55c('0x13')]){if(_0x4e2429[_0xe55c('0x13')][_0xe55c('0x14')]===0x1f4){logger['error'](_0xe55c('0xf'),_0x10d47e,_0x4e2429[_0xe55c('0x13')][_0xe55c('0x15')]);return _0x267f96(_0x4e2429['error']['message']);}logger['error'](_0xe55c('0xf'),_0x10d47e,_0x4e2429[_0xe55c('0x13')][_0xe55c('0x15')]);return _0x1b5934(_0x4e2429[_0xe55c('0x13')][_0xe55c('0x15')]);}else{logger[_0xe55c('0xe')](_0xe55c('0xf'),_0x10d47e,_0xe55c('0x10'));_0x1b5934(_0x4e2429[_0xe55c('0x16')][_0xe55c('0x15')]);}})['catch'](function(_0x299e03){logger[_0xe55c('0x13')](_0xe55c('0xf'),_0x10d47e,_0x299e03);_0x267f96(_0x299e03);});});} \ No newline at end of file +var _0x7811=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x7811,0xea));var _0x1781=function(_0x3c86dc,_0x5d22fc){_0x3c86dc=_0x3c86dc-0x0;var _0x4aeb79=_0x7811[_0x3c86dc];return _0x4aeb79;};'use strict';var _=require(_0x1781('0x0'));var util=require(_0x1781('0x1'));var moment=require(_0x1781('0x2'));var BPromise=require(_0x1781('0x3'));var rs=require(_0x1781('0x4'));var fs=require('fs');var Redis=require(_0x1781('0x5'));var db=require(_0x1781('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1781('0x7'))(_0x1781('0x8'));var config=require(_0x1781('0x9'));var jayson=require(_0x1781('0xa'));var client=jayson['client'][_0x1781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3aadf0,_0x185758,_0x1d3dc8){return new BPromise(function(_0x43b4ff,_0x46f5a2){return client[_0x1781('0xc')](_0x3aadf0,_0x1d3dc8)[_0x1781('0xd')](function(_0x52fd69){logger[_0x1781('0xe')](_0x1781('0xf'),_0x185758,_0x1781('0x10'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x185758,'request\x20sent',JSON[_0x1781('0x11')](_0x52fd69));if(_0x52fd69[_0x1781('0x12')]){if(_0x52fd69[_0x1781('0x12')]['code']===0x1f4){logger['error'](_0x1781('0xf'),_0x185758,_0x52fd69[_0x1781('0x12')][_0x1781('0x13')]);return _0x46f5a2(_0x52fd69[_0x1781('0x12')][_0x1781('0x13')]);}logger[_0x1781('0x12')](_0x1781('0xf'),_0x185758,_0x52fd69['error'][_0x1781('0x13')]);return _0x43b4ff(_0x52fd69['error'][_0x1781('0x13')]);}else{logger[_0x1781('0xe')](_0x1781('0xf'),_0x185758,'request\x20sent');_0x43b4ff(_0x52fd69['result'][_0x1781('0x13')]);}})[_0x1781('0x14')](function(_0x2286c7){logger[_0x1781('0x12')](_0x1781('0xf'),_0x185758,_0x2286c7);_0x46f5a2(_0x2286c7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index d41b3ed..2019184 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 _0x5d38=['isAuthenticated','post','create','put','/:id','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','get'];(function(_0x291a25,_0x31ae01){var _0x380fab=function(_0x205298){while(--_0x205298){_0x291a25['push'](_0x291a25['shift']());}};_0x380fab(++_0x31ae01);}(_0x5d38,0x94));var _0x85d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d38[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85d3('0x0'));var timeout=require(_0x85d3('0x1'));var express=require(_0x85d3('0x2'));var router=express[_0x85d3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x85d3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x85d3('0x5')]('/',auth[_0x85d3('0x6')](),controller['index']);router[_0x85d3('0x5')]('/:id',auth[_0x85d3('0x6')](),controller['show']);router[_0x85d3('0x7')]('/',auth[_0x85d3('0x6')](),controller[_0x85d3('0x8')]);router[_0x85d3('0x9')](_0x85d3('0xa'),auth[_0x85d3('0x6')](),controller[_0x85d3('0xb')]);router['delete'](_0x85d3('0xa'),auth[_0x85d3('0x6')](),controller[_0x85d3('0xc')]);module[_0x85d3('0xd')]=router; \ No newline at end of file +var _0x3cbe=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','util'];(function(_0x108d48,_0x5c174b){var _0x241f2c=function(_0x20f8af){while(--_0x20f8af){_0x108d48['push'](_0x108d48['shift']());}};_0x241f2c(++_0x5c174b);}(_0x3cbe,0xfb));var _0xe3cb=function(_0x23a8ba,_0xab5848){_0x23a8ba=_0x23a8ba-0x0;var _0x468389=_0x3cbe[_0x23a8ba];return _0x468389;};'use strict';var multer=require('multer');var util=require(_0xe3cb('0x0'));var path=require('path');var timeout=require(_0xe3cb('0x1'));var express=require(_0xe3cb('0x2'));var router=express[_0xe3cb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe3cb('0x4'));var interaction=require(_0xe3cb('0x5'));var config=require('../../config/environment');var controller=require(_0xe3cb('0x6'));router['get']('/',auth[_0xe3cb('0x7')](),controller[_0xe3cb('0x8')]);router[_0xe3cb('0x9')](_0xe3cb('0xa'),auth['isAuthenticated'](),controller[_0xe3cb('0xb')]);router[_0xe3cb('0xc')]('/',auth[_0xe3cb('0x7')](),controller[_0xe3cb('0xd')]);router[_0xe3cb('0xe')](_0xe3cb('0xa'),auth[_0xe3cb('0x7')](),controller['update']);router[_0xe3cb('0xf')]('/:id',auth[_0xe3cb('0x7')](),controller[_0xe3cb('0x10')]);module[_0xe3cb('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 66e7a6a..545e868 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 _0x7334=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0xa83f06,_0x752ffa){var _0x333ad0=function(_0x5132d1){while(--_0x5132d1){_0xa83f06['push'](_0xa83f06['shift']());}};_0x333ad0(++_0x752ffa);}(_0x7334,0xdf));var _0x4733=function(_0x1f0945,_0x3c46ed){_0x1f0945=_0x1f0945-0x0;var _0x3ef86b=_0x7334[_0x1f0945];return _0x3ef86b;};'use strict';var Sequelize=require(_0x4733('0x0'));module[_0x4733('0x1')]={'type':{'type':Sequelize[_0x4733('0x2')](_0x4733('0x3'),_0x4733('0x4'),_0x4733('0x5'),_0x4733('0x6'),_0x4733('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4733('0x8')]},'key':{'type':Sequelize[_0x4733('0x8')]},'keyType':{'type':Sequelize[_0x4733('0x2')]('string',_0x4733('0x4'),_0x4733('0x5'))},'keyContent':{'type':Sequelize[_0x4733('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4733('0x8')]},'customField':{'type':Sequelize[_0x4733('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4733('0x8')]}}; \ No newline at end of file +var _0x53dd=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x407ae2,_0x3f15a6){var _0x397ab3=function(_0x53643d){while(--_0x53643d){_0x407ae2['push'](_0x407ae2['shift']());}};_0x397ab3(++_0x3f15a6);}(_0x53dd,0x81));var _0xd53d=function(_0x45c3a3,_0x310ada){_0x45c3a3=_0x45c3a3-0x0;var _0x62c7a5=_0x53dd[_0x45c3a3];return _0x62c7a5;};'use strict';var Sequelize=require(_0xd53d('0x0'));module[_0xd53d('0x1')]={'type':{'type':Sequelize[_0xd53d('0x2')](_0xd53d('0x3'),_0xd53d('0x4'),_0xd53d('0x5'),_0xd53d('0x6'),_0xd53d('0x7')),'defaultValue':_0xd53d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd53d('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xd53d('0x3'),'variable',_0xd53d('0x5'))},'keyContent':{'type':Sequelize[_0xd53d('0x8')]},'idField':{'type':Sequelize[_0xd53d('0x8')]},'nameField':{'type':Sequelize[_0xd53d('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd53d('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 3ca04d9..158abe6 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 _0x8af1=['include','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','stack','name','send','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmField','includeAll','findAll','rows','show','params','keys','rawAttributes'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8af1,0xa3));var _0x18af=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x8af1[_0x376b45];return _0x2341b3;};'use strict';var emlformat=require(_0x18af('0x0'));var rimraf=require(_0x18af('0x1'));var zipdir=require(_0x18af('0x2'));var jsonpatch=require(_0x18af('0x3'));var rp=require(_0x18af('0x4'));var moment=require(_0x18af('0x5'));var BPromise=require(_0x18af('0x6'));var Mustache=require(_0x18af('0x7'));var util=require(_0x18af('0x8'));var path=require(_0x18af('0x9'));var sox=require(_0x18af('0xa'));var csv=require(_0x18af('0xb'));var ejs=require(_0x18af('0xc'));var fs=require('fs');var fs_extra=require(_0x18af('0xd'));var _=require(_0x18af('0xe'));var squel=require(_0x18af('0xf'));var crypto=require(_0x18af('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x18af('0x11'));var toCsv=require(_0x18af('0xb'));var querystring=require(_0x18af('0x12'));var Papa=require(_0x18af('0x13'));var Redis=require(_0x18af('0x14'));var authService=require(_0x18af('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x18af('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x18af('0x17'))(_0x18af('0x18'));var utils=require(_0x18af('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x18af('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ab26a,_0x2be959){_0x2be959=_0x2be959||0xcc;return function(_0x5b7746){if(_0x5b7746){return _0x4ab26a[_0x18af('0x1b')](_0x2be959);}return _0x4ab26a['status'](_0x2be959)[_0x18af('0x1c')]();};}function respondWithResult(_0x4ba277,_0x4c249a){_0x4c249a=_0x4c249a||0xc8;return function(_0x24aa28){if(_0x24aa28){return _0x4ba277[_0x18af('0x1d')](_0x4c249a)['json'](_0x24aa28);}};}function respondWithFilteredResult(_0x5109c9,_0x569b83){return function(_0x4eddc8){if(_0x4eddc8){var _0x3db0a3=typeof _0x569b83[_0x18af('0x1e')]===_0x18af('0x1f')&&typeof _0x569b83[_0x18af('0x20')]===_0x18af('0x1f');var _0x1f6103=_0x4eddc8[_0x18af('0x21')];var _0x78ce81=_0x3db0a3?0x0:_0x569b83[_0x18af('0x1e')];var _0x338333=_0x3db0a3?_0x4eddc8['count']:_0x569b83[_0x18af('0x1e')]+_0x569b83['limit'];var _0x30e633;if(_0x338333>=_0x1f6103){_0x338333=_0x1f6103;_0x30e633=0xc8;}else{_0x30e633=0xce;}_0x5109c9[_0x18af('0x1d')](_0x30e633);return _0x5109c9[_0x18af('0x22')](_0x18af('0x23'),_0x78ce81+'-'+_0x338333+'/'+_0x1f6103)[_0x18af('0x24')](_0x4eddc8);}return null;};}function patchUpdates(_0x12e034){return function(_0xaa0feb){try{jsonpatch[_0x18af('0x25')](_0xaa0feb,_0x12e034,!![]);}catch(_0x59e75b){return BPromise[_0x18af('0x26')](_0x59e75b);}return _0xaa0feb['save']();};}function saveUpdates(_0x563e8d,_0x6aa4f6){return function(_0x179e54){if(_0x179e54){return _0x179e54['update'](_0x563e8d)[_0x18af('0x27')](function(_0x2e2a2f){return _0x2e2a2f;});}return null;};}function removeEntity(_0x8c7714,_0x28c9d4){return function(_0x291669){if(_0x291669){return _0x291669['destroy']()['then'](function(){_0x8c7714[_0x18af('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c8577,_0x72cbc2){return function(_0x44c1c0){if(!_0x44c1c0){_0x1c8577['sendStatus'](0x194);}return _0x44c1c0;};}function handleError(_0x3f42c9,_0x1b84a7){_0x1b84a7=_0x1b84a7||0x1f4;return function(_0x6851a3){logger['error'](_0x6851a3[_0x18af('0x28')]);if(_0x6851a3[_0x18af('0x29')]){delete _0x6851a3[_0x18af('0x29')];}_0x3f42c9[_0x18af('0x1d')](_0x1b84a7)[_0x18af('0x2a')](_0x6851a3);};}exports['index']=function(_0x482fc6,_0x411071){var _0x42c768={},_0x255a45={},_0x129916={'count':0x0,'rows':[]};var _0x110f38=_[_0x18af('0x2b')](db['SugarcrmField']['rawAttributes'],function(_0x1f1b79){return{'name':_0x1f1b79[_0x18af('0x2c')],'type':_0x1f1b79[_0x18af('0x2d')]['key']};});_0x255a45[_0x18af('0x2e')]=_[_0x18af('0x2b')](_0x110f38,_0x18af('0x29'));_0x255a45[_0x18af('0x2f')]=_['keys'](_0x482fc6[_0x18af('0x2f')]);_0x255a45[_0x18af('0x30')]=_[_0x18af('0x31')](_0x255a45['model'],_0x255a45[_0x18af('0x2f')]);_0x42c768[_0x18af('0x32')]=_['intersection'](_0x255a45[_0x18af('0x2e')],qs[_0x18af('0x33')](_0x482fc6[_0x18af('0x2f')][_0x18af('0x33')]));_0x42c768[_0x18af('0x32')]=_0x42c768[_0x18af('0x32')][_0x18af('0x34')]?_0x42c768[_0x18af('0x32')]:_0x255a45[_0x18af('0x2e')];if(!_0x482fc6[_0x18af('0x2f')][_0x18af('0x35')](_0x18af('0x36'))){_0x42c768[_0x18af('0x20')]=qs[_0x18af('0x20')](_0x482fc6['query']['limit']);_0x42c768[_0x18af('0x1e')]=qs['offset'](_0x482fc6['query'][_0x18af('0x1e')]);}_0x42c768[_0x18af('0x37')]=qs[_0x18af('0x38')](_0x482fc6[_0x18af('0x2f')][_0x18af('0x38')]);_0x42c768[_0x18af('0x39')]=qs[_0x18af('0x30')](_[_0x18af('0x3a')](_0x482fc6[_0x18af('0x2f')],_0x255a45[_0x18af('0x30')]),_0x110f38);if(_0x482fc6['query'][_0x18af('0x3b')]){_0x42c768['where']=_[_0x18af('0x3c')](_0x42c768[_0x18af('0x39')],{'$or':_[_0x18af('0x2b')](_0x110f38,function(_0x348fbb){if(_0x348fbb[_0x18af('0x2d')]!==_0x18af('0x3d')){var _0x31f9c2={};_0x31f9c2[_0x348fbb[_0x18af('0x29')]]={'$like':'%'+_0x482fc6[_0x18af('0x2f')][_0x18af('0x3b')]+'%'};return _0x31f9c2;}})});}_0x42c768=_[_0x18af('0x3c')]({},_0x42c768,_0x482fc6[_0x18af('0x3e')]);var _0x16ed04={'where':_0x42c768[_0x18af('0x39')]};return db[_0x18af('0x3f')][_0x18af('0x21')](_0x16ed04)[_0x18af('0x27')](function(_0xa75018){_0x129916[_0x18af('0x21')]=_0xa75018;if(_0x482fc6[_0x18af('0x2f')][_0x18af('0x40')]){_0x42c768['include']=[{'all':!![]}];}return db[_0x18af('0x3f')][_0x18af('0x41')](_0x42c768);})[_0x18af('0x27')](function(_0x1b0c6d){_0x129916[_0x18af('0x42')]=_0x1b0c6d;return _0x129916;})[_0x18af('0x27')](respondWithFilteredResult(_0x411071,_0x42c768))['catch'](handleError(_0x411071,null));};exports[_0x18af('0x43')]=function(_0x2bcde4,_0x3501e6){var _0x345f34={'raw':!![],'where':{'id':_0x2bcde4[_0x18af('0x44')]['id']}},_0x45d759={};_0x45d759[_0x18af('0x2e')]=_[_0x18af('0x45')](db[_0x18af('0x3f')][_0x18af('0x46')]);_0x45d759[_0x18af('0x2f')]=_[_0x18af('0x45')](_0x2bcde4[_0x18af('0x2f')]);_0x45d759[_0x18af('0x30')]=_[_0x18af('0x31')](_0x45d759[_0x18af('0x2e')],_0x45d759['query']);_0x345f34[_0x18af('0x32')]=_[_0x18af('0x31')](_0x45d759[_0x18af('0x2e')],qs[_0x18af('0x33')](_0x2bcde4['query']['fields']));_0x345f34['attributes']=_0x345f34['attributes'][_0x18af('0x34')]?_0x345f34['attributes']:_0x45d759['model'];if(_0x2bcde4['query']['includeAll']){_0x345f34[_0x18af('0x47')]=[{'all':!![]}];}_0x345f34=_[_0x18af('0x3c')]({},_0x345f34,_0x2bcde4['options']);return db['SugarcrmField'][_0x18af('0x48')](_0x345f34)[_0x18af('0x27')](handleEntityNotFound(_0x3501e6,null))['then'](respondWithResult(_0x3501e6,null))[_0x18af('0x49')](handleError(_0x3501e6,null));};exports[_0x18af('0x4a')]=function(_0x5cb2d6,_0x2ca5c2){return db[_0x18af('0x3f')][_0x18af('0x4a')](_0x5cb2d6[_0x18af('0x4b')],{})[_0x18af('0x27')](respondWithResult(_0x2ca5c2,0xc9))[_0x18af('0x49')](handleError(_0x2ca5c2,null));};exports[_0x18af('0x4c')]=function(_0x3d220e,_0xa01e05){if(_0x3d220e[_0x18af('0x4b')]['id']){delete _0x3d220e[_0x18af('0x4b')]['id'];}return db['SugarcrmField'][_0x18af('0x48')]({'where':{'id':_0x3d220e[_0x18af('0x44')]['id']}})[_0x18af('0x27')](handleEntityNotFound(_0xa01e05,null))[_0x18af('0x27')](saveUpdates(_0x3d220e['body'],null))['then'](respondWithResult(_0xa01e05,null))[_0x18af('0x49')](handleError(_0xa01e05,null));};exports[_0x18af('0x4d')]=function(_0x18e2a8,_0x234d65){return db[_0x18af('0x3f')][_0x18af('0x48')]({'where':{'id':_0x18e2a8[_0x18af('0x44')]['id']}})[_0x18af('0x27')](handleEntityNotFound(_0x234d65,null))[_0x18af('0x27')](removeEntity(_0x234d65,null))[_0x18af('0x49')](handleError(_0x234d65,null));}; \ No newline at end of file +var _0xed7b=['includeAll','options','find','create','body','catch','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','apply','reject','then','destroy','error','name','send','map','SugarcrmField','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','rows','show','params','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed7b,0x11f));var _0xbed7=function(_0xf91cf6,_0x53a695){_0xf91cf6=_0xf91cf6-0x0;var _0x47ae5b=_0xed7b[_0xf91cf6];return _0x47ae5b;};'use strict';var emlformat=require(_0xbed7('0x0'));var rimraf=require(_0xbed7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbed7('0x2'));var rp=require(_0xbed7('0x3'));var moment=require(_0xbed7('0x4'));var BPromise=require(_0xbed7('0x5'));var Mustache=require(_0xbed7('0x6'));var util=require(_0xbed7('0x7'));var path=require('path');var sox=require(_0xbed7('0x8'));var csv=require(_0xbed7('0x9'));var ejs=require(_0xbed7('0xa'));var fs=require('fs');var fs_extra=require(_0xbed7('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbed7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbed7('0x9'));var querystring=require(_0xbed7('0xd'));var Papa=require(_0xbed7('0xe'));var Redis=require('ioredis');var authService=require(_0xbed7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbed7('0x10'));var hardwareService=require(_0xbed7('0x11'));var logger=require(_0xbed7('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xbed7('0x13'));var licenseUtil=require(_0xbed7('0x14'));var db=require(_0xbed7('0x15'))['db'];function respondWithStatusCode(_0x3935ee,_0x249596){_0x249596=_0x249596||0xcc;return function(_0xd746d5){if(_0xd746d5){return _0x3935ee[_0xbed7('0x16')](_0x249596);}return _0x3935ee[_0xbed7('0x17')](_0x249596)[_0xbed7('0x18')]();};}function respondWithResult(_0x5e0d5f,_0x222a93){_0x222a93=_0x222a93||0xc8;return function(_0x1e4d42){if(_0x1e4d42){return _0x5e0d5f[_0xbed7('0x17')](_0x222a93)['json'](_0x1e4d42);}};}function respondWithFilteredResult(_0x547e09,_0x159cbc){return function(_0x3d441c){if(_0x3d441c){var _0x1e6fa8=typeof _0x159cbc['offset']==='undefined'&&typeof _0x159cbc['limit']===_0xbed7('0x19');var _0x17077d=_0x3d441c['count'];var _0x23de00=_0x1e6fa8?0x0:_0x159cbc[_0xbed7('0x1a')];var _0x4cc333=_0x1e6fa8?_0x3d441c[_0xbed7('0x1b')]:_0x159cbc['offset']+_0x159cbc[_0xbed7('0x1c')];var _0x4bdfac;if(_0x4cc333>=_0x17077d){_0x4cc333=_0x17077d;_0x4bdfac=0xc8;}else{_0x4bdfac=0xce;}_0x547e09[_0xbed7('0x17')](_0x4bdfac);return _0x547e09[_0xbed7('0x1d')](_0xbed7('0x1e'),_0x23de00+'-'+_0x4cc333+'/'+_0x17077d)[_0xbed7('0x1f')](_0x3d441c);}return null;};}function patchUpdates(_0xefa115){return function(_0x4d17d7){try{jsonpatch[_0xbed7('0x20')](_0x4d17d7,_0xefa115,!![]);}catch(_0x35f1b3){return BPromise[_0xbed7('0x21')](_0x35f1b3);}return _0x4d17d7['save']();};}function saveUpdates(_0x3634e6,_0x3510d9){return function(_0x1ece83){if(_0x1ece83){return _0x1ece83['update'](_0x3634e6)[_0xbed7('0x22')](function(_0x40288e){return _0x40288e;});}return null;};}function removeEntity(_0x471218,_0x59326c){return function(_0x33dc3e){if(_0x33dc3e){return _0x33dc3e[_0xbed7('0x23')]()['then'](function(){_0x471218[_0xbed7('0x17')](0xcc)[_0xbed7('0x18')]();});}};}function handleEntityNotFound(_0x4b1ad5,_0x19c289){return function(_0x31a3d8){if(!_0x31a3d8){_0x4b1ad5[_0xbed7('0x16')](0x194);}return _0x31a3d8;};}function handleError(_0x1dfba9,_0x5bd75b){_0x5bd75b=_0x5bd75b||0x1f4;return function(_0x50383a){logger[_0xbed7('0x24')](_0x50383a['stack']);if(_0x50383a[_0xbed7('0x25')]){delete _0x50383a[_0xbed7('0x25')];}_0x1dfba9[_0xbed7('0x17')](_0x5bd75b)[_0xbed7('0x26')](_0x50383a);};}exports['index']=function(_0xb55008,_0xedbe0a){var _0x5c8a69={},_0x4814d7={},_0x27a916={'count':0x0,'rows':[]};var _0x3923b5=_[_0xbed7('0x27')](db[_0xbed7('0x28')][_0xbed7('0x29')],function(_0x5eda3c){return{'name':_0x5eda3c['fieldName'],'type':_0x5eda3c[_0xbed7('0x2a')][_0xbed7('0x2b')]};});_0x4814d7['model']=_[_0xbed7('0x27')](_0x3923b5,_0xbed7('0x25'));_0x4814d7[_0xbed7('0x2c')]=_['keys'](_0xb55008['query']);_0x4814d7[_0xbed7('0x2d')]=_[_0xbed7('0x2e')](_0x4814d7[_0xbed7('0x2f')],_0x4814d7[_0xbed7('0x2c')]);_0x5c8a69['attributes']=_[_0xbed7('0x2e')](_0x4814d7[_0xbed7('0x2f')],qs[_0xbed7('0x30')](_0xb55008[_0xbed7('0x2c')][_0xbed7('0x30')]));_0x5c8a69['attributes']=_0x5c8a69[_0xbed7('0x31')][_0xbed7('0x32')]?_0x5c8a69[_0xbed7('0x31')]:_0x4814d7[_0xbed7('0x2f')];if(!_0xb55008[_0xbed7('0x2c')]['hasOwnProperty'](_0xbed7('0x33'))){_0x5c8a69[_0xbed7('0x1c')]=qs['limit'](_0xb55008[_0xbed7('0x2c')]['limit']);_0x5c8a69['offset']=qs[_0xbed7('0x1a')](_0xb55008[_0xbed7('0x2c')][_0xbed7('0x1a')]);}_0x5c8a69[_0xbed7('0x34')]=qs[_0xbed7('0x35')](_0xb55008[_0xbed7('0x2c')][_0xbed7('0x35')]);_0x5c8a69[_0xbed7('0x36')]=qs[_0xbed7('0x2d')](_[_0xbed7('0x37')](_0xb55008[_0xbed7('0x2c')],_0x4814d7[_0xbed7('0x2d')]),_0x3923b5);if(_0xb55008[_0xbed7('0x2c')]['filter']){_0x5c8a69[_0xbed7('0x36')]=_[_0xbed7('0x38')](_0x5c8a69[_0xbed7('0x36')],{'$or':_[_0xbed7('0x27')](_0x3923b5,function(_0x2139c5){if(_0x2139c5[_0xbed7('0x2a')]!==_0xbed7('0x39')){var _0x15df59={};_0x15df59[_0x2139c5['name']]={'$like':'%'+_0xb55008[_0xbed7('0x2c')][_0xbed7('0x3a')]+'%'};return _0x15df59;}})});}_0x5c8a69=_[_0xbed7('0x38')]({},_0x5c8a69,_0xb55008['options']);var _0x88bd8a={'where':_0x5c8a69[_0xbed7('0x36')]};return db[_0xbed7('0x28')][_0xbed7('0x1b')](_0x88bd8a)[_0xbed7('0x22')](function(_0x2872eb){_0x27a916[_0xbed7('0x1b')]=_0x2872eb;if(_0xb55008[_0xbed7('0x2c')]['includeAll']){_0x5c8a69['include']=[{'all':!![]}];}return db[_0xbed7('0x28')]['findAll'](_0x5c8a69);})['then'](function(_0x5d78dd){_0x27a916[_0xbed7('0x3b')]=_0x5d78dd;return _0x27a916;})[_0xbed7('0x22')](respondWithFilteredResult(_0xedbe0a,_0x5c8a69))['catch'](handleError(_0xedbe0a,null));};exports[_0xbed7('0x3c')]=function(_0x2793b3,_0x254c73){var _0x1bc59c={'raw':!![],'where':{'id':_0x2793b3[_0xbed7('0x3d')]['id']}},_0x186001={};_0x186001['model']=_[_0xbed7('0x3e')](db[_0xbed7('0x28')][_0xbed7('0x29')]);_0x186001[_0xbed7('0x2c')]=_[_0xbed7('0x3e')](_0x2793b3['query']);_0x186001[_0xbed7('0x2d')]=_[_0xbed7('0x2e')](_0x186001[_0xbed7('0x2f')],_0x186001[_0xbed7('0x2c')]);_0x1bc59c[_0xbed7('0x31')]=_[_0xbed7('0x2e')](_0x186001['model'],qs[_0xbed7('0x30')](_0x2793b3[_0xbed7('0x2c')][_0xbed7('0x30')]));_0x1bc59c[_0xbed7('0x31')]=_0x1bc59c['attributes'][_0xbed7('0x32')]?_0x1bc59c[_0xbed7('0x31')]:_0x186001[_0xbed7('0x2f')];if(_0x2793b3[_0xbed7('0x2c')][_0xbed7('0x3f')]){_0x1bc59c['include']=[{'all':!![]}];}_0x1bc59c=_[_0xbed7('0x38')]({},_0x1bc59c,_0x2793b3[_0xbed7('0x40')]);return db[_0xbed7('0x28')][_0xbed7('0x41')](_0x1bc59c)[_0xbed7('0x22')](handleEntityNotFound(_0x254c73,null))[_0xbed7('0x22')](respondWithResult(_0x254c73,null))['catch'](handleError(_0x254c73,null));};exports[_0xbed7('0x42')]=function(_0x57ae13,_0x462ded){return db[_0xbed7('0x28')]['create'](_0x57ae13[_0xbed7('0x43')],{})['then'](respondWithResult(_0x462ded,0xc9))[_0xbed7('0x44')](handleError(_0x462ded,null));};exports[_0xbed7('0x45')]=function(_0x719855,_0x4bb627){if(_0x719855['body']['id']){delete _0x719855[_0xbed7('0x43')]['id'];}return db[_0xbed7('0x28')][_0xbed7('0x41')]({'where':{'id':_0x719855[_0xbed7('0x3d')]['id']}})[_0xbed7('0x22')](handleEntityNotFound(_0x4bb627,null))[_0xbed7('0x22')](saveUpdates(_0x719855[_0xbed7('0x43')],null))['then'](respondWithResult(_0x4bb627,null))[_0xbed7('0x44')](handleError(_0x4bb627,null));};exports['destroy']=function(_0x19e424,_0x507af0){return db[_0xbed7('0x28')][_0xbed7('0x41')]({'where':{'id':_0x19e424[_0xbed7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x507af0,null))['then'](removeEntity(_0x507af0,null))['catch'](handleError(_0x507af0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a1f49bf..4bfcbfd 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 _0x8996=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId'];(function(_0x345e90,_0x4be2af){var _0x3213cd=function(_0x492598){while(--_0x492598){_0x345e90['push'](_0x345e90['shift']());}};_0x3213cd(++_0x4be2af);}(_0x8996,0x87));var _0x6899=function(_0xe6a648,_0x323b05){_0xe6a648=_0xe6a648-0x0;var _0x528ffc=_0x8996[_0xe6a648];return _0x528ffc;};'use strict';var _=require(_0x6899('0x0'));var util=require(_0x6899('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6899('0x2'));var BPromise=require(_0x6899('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6899('0x4'));var rimraf=require(_0x6899('0x5'));var config=require(_0x6899('0x6'));var attributes=require(_0x6899('0x7'));module[_0x6899('0x8')]=function(_0x35c0bf,_0x52a7a7){return _0x35c0bf[_0x6899('0x9')](_0x6899('0xa'),attributes,{'tableName':_0x6899('0xb'),'paranoid':![],'indexes':[{'name':_0x6899('0xc'),'fields':[_0x6899('0xd'),_0x6899('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x566e=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','util','moment','bluebird','path'];(function(_0x52af16,_0x59cb6f){var _0x7e642c=function(_0x2c0ccc){while(--_0x2c0ccc){_0x52af16['push'](_0x52af16['shift']());}};_0x7e642c(++_0x59cb6f);}(_0x566e,0xee));var _0xe566=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x566e[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require('lodash');var util=require(_0xe566('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe566('0x1'));var BPromise=require(_0xe566('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe566('0x3'));var rimraf=require(_0xe566('0x4'));var config=require(_0xe566('0x5'));var attributes=require(_0xe566('0x6'));module[_0xe566('0x7')]=function(_0x25d2d3,_0x4caa4b){return _0x25d2d3[_0xe566('0x8')](_0xe566('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xe566('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index fed5a89..acf7194 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 _0x0029=['request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s'];(function(_0x4ef300,_0x5c9060){var _0x5ea852=function(_0x563a28){while(--_0x563a28){_0x4ef300['push'](_0x4ef300['shift']());}};_0x5ea852(++_0x5c9060);}(_0x0029,0x104));var _0x9002=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x0029[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x9002('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9002('0x1'));var rs=require(_0x9002('0x2'));var fs=require('fs');var Redis=require(_0x9002('0x3'));var db=require(_0x9002('0x4'))['db'];var utils=require(_0x9002('0x5'));var logger=require(_0x9002('0x6'))(_0x9002('0x7'));var config=require(_0x9002('0x8'));var jayson=require(_0x9002('0x9'));var client=jayson[_0x9002('0xa')][_0x9002('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42e8fc,_0xb8ce22,_0x3bd0a5){return new BPromise(function(_0x47bb41,_0x3e6e3d){return client[_0x9002('0xc')](_0x42e8fc,_0x3bd0a5)[_0x9002('0xd')](function(_0x1a1d68){logger[_0x9002('0xe')](_0x9002('0xf'),_0xb8ce22,_0x9002('0x10'));logger[_0x9002('0x11')](_0x9002('0x12'),_0xb8ce22,_0x9002('0x10'),JSON[_0x9002('0x13')](_0x1a1d68));if(_0x1a1d68[_0x9002('0x14')]){if(_0x1a1d68[_0x9002('0x14')]['code']===0x1f4){logger['error'](_0x9002('0xf'),_0xb8ce22,_0x1a1d68[_0x9002('0x14')]['message']);return _0x3e6e3d(_0x1a1d68[_0x9002('0x14')][_0x9002('0x15')]);}logger['error'](_0x9002('0xf'),_0xb8ce22,_0x1a1d68[_0x9002('0x14')]['message']);return _0x47bb41(_0x1a1d68['error']['message']);}else{logger[_0x9002('0xe')](_0x9002('0xf'),_0xb8ce22,'request\x20sent');_0x47bb41(_0x1a1d68['result'][_0x9002('0x15')]);}})[_0x9002('0x16')](function(_0x472997){logger[_0x9002('0x14')](_0x9002('0xf'),_0xb8ce22,_0x472997);_0x3e6e3d(_0x472997);});});} \ No newline at end of file +var _0xa067=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x42607c,_0x57dc3b){var _0x1c4e31=function(_0x2a00b3){while(--_0x2a00b3){_0x42607c['push'](_0x42607c['shift']());}};_0x1c4e31(++_0x57dc3b);}(_0xa067,0x166));var _0x7a06=function(_0xd8e052,_0x49f18a){_0xd8e052=_0xd8e052-0x0;var _0x38a04b=_0xa067[_0xd8e052];return _0x38a04b;};'use strict';var _=require(_0x7a06('0x0'));var util=require(_0x7a06('0x1'));var moment=require(_0x7a06('0x2'));var BPromise=require(_0x7a06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a06('0x4'));var db=require(_0x7a06('0x5'))['db'];var utils=require(_0x7a06('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7a06('0x7'));var client=jayson['client'][_0x7a06('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52ba41,_0xdaea36,_0x3f8147){return new BPromise(function(_0x2b4df8,_0x490e4d){return client[_0x7a06('0x9')](_0x52ba41,_0x3f8147)[_0x7a06('0xa')](function(_0x1ecde0){logger['info'](_0x7a06('0xb'),_0xdaea36,_0x7a06('0xc'));logger[_0x7a06('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xdaea36,'request\x20sent',JSON[_0x7a06('0xe')](_0x1ecde0));if(_0x1ecde0[_0x7a06('0xf')]){if(_0x1ecde0['error'][_0x7a06('0x10')]===0x1f4){logger[_0x7a06('0xf')](_0x7a06('0xb'),_0xdaea36,_0x1ecde0['error'][_0x7a06('0x11')]);return _0x490e4d(_0x1ecde0[_0x7a06('0xf')][_0x7a06('0x11')]);}logger[_0x7a06('0xf')](_0x7a06('0xb'),_0xdaea36,_0x1ecde0['error'][_0x7a06('0x11')]);return _0x2b4df8(_0x1ecde0['error']['message']);}else{logger[_0x7a06('0x12')](_0x7a06('0xb'),_0xdaea36,'request\x20sent');_0x2b4df8(_0x1ecde0[_0x7a06('0x13')][_0x7a06('0x11')]);}})[_0x7a06('0x14')](function(_0x21cf85){logger['error'](_0x7a06('0xb'),_0xdaea36,_0x21cf85);_0x490e4d(_0x21cf85);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 321ceb8..0c31d40 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 _0x117d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x117d,0xac));var _0xd117=function(_0x2c5340,_0x5c86e5){_0x2c5340=_0x2c5340-0x0;var _0x3c505e=_0x117d[_0x2c5340];return _0x3c505e;};'use strict';var multer=require(_0xd117('0x0'));var util=require(_0xd117('0x1'));var path=require(_0xd117('0x2'));var timeout=require('connect-timeout');var express=require(_0xd117('0x3'));var router=express[_0xd117('0x4')]();var fs_extra=require(_0xd117('0x5'));var auth=require(_0xd117('0x6'));var interaction=require(_0xd117('0x7'));var config=require('../../config/environment');var controller=require(_0xd117('0x8'));router[_0xd117('0x9')]('/',auth[_0xd117('0xa')](),controller[_0xd117('0xb')]);router['get']('/:id',auth[_0xd117('0xa')](),controller[_0xd117('0xc')]);router[_0xd117('0x9')](_0xd117('0xd'),auth[_0xd117('0xa')](),controller[_0xd117('0xe')]);router[_0xd117('0x9')](_0xd117('0xf'),auth[_0xd117('0xa')](),controller[_0xd117('0x10')]);router[_0xd117('0x11')]('/',auth[_0xd117('0xa')](),controller[_0xd117('0x12')]);router['post'](_0xd117('0xd'),auth[_0xd117('0xa')](),controller[_0xd117('0x13')]);router[_0xd117('0x14')](_0xd117('0x15'),auth['isAuthenticated'](),controller['update']);router[_0xd117('0x16')]('/:id',auth[_0xd117('0xa')](),controller[_0xd117('0x17')]);module[_0xd117('0x18')]=router; \ No newline at end of file +var _0x3645=['/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x3645,0x157));var _0x5364=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x3645[_0x8a7e38];return _0x228609;};'use strict';var multer=require(_0x5364('0x0'));var util=require('util');var path=require(_0x5364('0x1'));var timeout=require('connect-timeout');var express=require(_0x5364('0x2'));var router=express[_0x5364('0x3')]();var fs_extra=require(_0x5364('0x4'));var auth=require(_0x5364('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5364('0x6'));var controller=require(_0x5364('0x7'));router[_0x5364('0x8')]('/',auth[_0x5364('0x9')](),controller[_0x5364('0xa')]);router['get'](_0x5364('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5364('0x8')](_0x5364('0xc'),auth[_0x5364('0x9')](),controller[_0x5364('0xd')]);router[_0x5364('0x8')](_0x5364('0xe'),auth[_0x5364('0x9')](),controller['getFields']);router[_0x5364('0xf')]('/',auth[_0x5364('0x9')](),controller[_0x5364('0x10')]);router[_0x5364('0xf')]('/:id/configurations',auth[_0x5364('0x9')](),controller[_0x5364('0x11')]);router[_0x5364('0x12')](_0x5364('0xb'),auth[_0x5364('0x9')](),controller['update']);router['delete'](_0x5364('0xb'),auth['isAuthenticated'](),controller[_0x5364('0x13')]);module[_0x5364('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 8164f12..aef9327 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 _0x350f=['sequelize','exports','STRING'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x350f,0xc6));var _0xf350=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x350f[_0x2181b1];return _0x530548;};'use strict';var Sequelize=require(_0xf350('0x0'));module[_0xf350('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf350('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf350('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf350('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8ebe=['sequelize','exports','STRING','HelpDesk'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x8ebe,0xf0));var _0xe8eb=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x8ebe[_0x3c04ef];return _0x6a3a69;};'use strict';var Sequelize=require(_0xe8eb('0x0'));module[_0xe8eb('0x1')]={'name':{'type':Sequelize[_0xe8eb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe8eb('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe8eb('0x2')],'allowNull':![],'defaultValue':_0xe8eb('0x3')},'remoteUri':{'type':Sequelize[_0xe8eb('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe8eb('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xe8eb('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 8ee3d77..6996d98 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 _0x9aea=['token','describe','result','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','model','query','keys','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','options','VtigerAccount','include','findAll','catch','show','params','filters','includeAll','create','body','find','getConfigurations','VtigerConfiguration','hasOwnProperty','nolimit','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0x9aea,0x93));var _0xa9ae=function(_0x4a05b2,_0x469657){_0x4a05b2=_0x4a05b2-0x0;var _0xafeaaa=_0x9aea[_0x4a05b2];return _0xafeaaa;};'use strict';var emlformat=require(_0xa9ae('0x0'));var rimraf=require(_0xa9ae('0x1'));var zipdir=require(_0xa9ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa9ae('0x3'));var BPromise=require(_0xa9ae('0x4'));var Mustache=require('mustache');var util=require(_0xa9ae('0x5'));var path=require(_0xa9ae('0x6'));var sox=require(_0xa9ae('0x7'));var csv=require(_0xa9ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9ae('0x9'));var _=require(_0xa9ae('0xa'));var squel=require(_0xa9ae('0xb'));var crypto=require(_0xa9ae('0xc'));var jsforce=require(_0xa9ae('0xd'));var deskjs=require(_0xa9ae('0xe'));var toCsv=require(_0xa9ae('0x8'));var querystring=require(_0xa9ae('0xf'));var Papa=require(_0xa9ae('0x10'));var Redis=require(_0xa9ae('0x11'));var authService=require(_0xa9ae('0x12'));var qs=require(_0xa9ae('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9ae('0x14'));var logger=require(_0xa9ae('0x15'))(_0xa9ae('0x16'));var utils=require('../../config/utils');var config=require(_0xa9ae('0x17'));var licenseUtil=require(_0xa9ae('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa9ae('0x19'));function respondWithStatusCode(_0x5e3493,_0xdab0a4){_0xdab0a4=_0xdab0a4||0xcc;return function(_0x3ee095){if(_0x3ee095){return _0x5e3493[_0xa9ae('0x1a')](_0xdab0a4);}return _0x5e3493[_0xa9ae('0x1b')](_0xdab0a4)[_0xa9ae('0x1c')]();};}function respondWithResult(_0x337265,_0x2e8302){_0x2e8302=_0x2e8302||0xc8;return function(_0x19c55a){if(_0x19c55a){return _0x337265[_0xa9ae('0x1b')](_0x2e8302)[_0xa9ae('0x1d')](_0x19c55a);}};}function respondWithFilteredResult(_0x45dec0,_0xd2188f){return function(_0x2a96ab){if(_0x2a96ab){var _0x5da7af=typeof _0xd2188f[_0xa9ae('0x1e')]===_0xa9ae('0x1f')&&typeof _0xd2188f[_0xa9ae('0x20')]===_0xa9ae('0x1f');var _0xc5b597=_0x2a96ab['count'];var _0x171314=_0x5da7af?0x0:_0xd2188f['offset'];var _0x5a9309=_0x5da7af?_0x2a96ab[_0xa9ae('0x21')]:_0xd2188f[_0xa9ae('0x1e')]+_0xd2188f[_0xa9ae('0x20')];var _0x548054;if(_0x5a9309>=_0xc5b597){_0x5a9309=_0xc5b597;_0x548054=0xc8;}else{_0x548054=0xce;}_0x45dec0['status'](_0x548054);return _0x45dec0[_0xa9ae('0x22')](_0xa9ae('0x23'),_0x171314+'-'+_0x5a9309+'/'+_0xc5b597)[_0xa9ae('0x1d')](_0x2a96ab);}return null;};}function patchUpdates(_0x6dc831){return function(_0x1dcbac){try{jsonpatch[_0xa9ae('0x24')](_0x1dcbac,_0x6dc831,!![]);}catch(_0x31a493){return BPromise[_0xa9ae('0x25')](_0x31a493);}return _0x1dcbac[_0xa9ae('0x26')]();};}function saveUpdates(_0x147716,_0x3bdf21){return function(_0x19c288){if(_0x19c288){return _0x19c288[_0xa9ae('0x27')](_0x147716)[_0xa9ae('0x28')](function(_0x2c6f8d){return _0x2c6f8d;});}return null;};}function removeEntity(_0x182b05,_0x2aa6c9){return function(_0x3b7e49){if(_0x3b7e49){return _0x3b7e49[_0xa9ae('0x29')]()['then'](function(){_0x182b05[_0xa9ae('0x1b')](0xcc)[_0xa9ae('0x1c')]();});}};}function handleEntityNotFound(_0x29e65c,_0x392995){return function(_0x439d3a){if(!_0x439d3a){_0x29e65c[_0xa9ae('0x1a')](0x194);}return _0x439d3a;};}function handleError(_0x1a8ef6,_0x335627){_0x335627=_0x335627||0x1f4;return function(_0xe70f95){logger['error'](_0xe70f95['stack']);if(_0xe70f95[_0xa9ae('0x2a')]){delete _0xe70f95['name'];}_0x1a8ef6[_0xa9ae('0x1b')](_0x335627)[_0xa9ae('0x2b')](_0xe70f95);};}exports[_0xa9ae('0x2c')]=function(_0x4d5d09,_0x439eeb){var _0x5f06f9={},_0xe69aab={},_0x467d51={'count':0x0,'rows':[]};var _0x10b493=_[_0xa9ae('0x2d')](db['VtigerAccount'][_0xa9ae('0x2e')],function(_0x4d933d){return{'name':_0x4d933d['fieldName'],'type':_0x4d933d['type']['key']};});_0xe69aab[_0xa9ae('0x2f')]=_[_0xa9ae('0x2d')](_0x10b493,_0xa9ae('0x2a'));_0xe69aab[_0xa9ae('0x30')]=_[_0xa9ae('0x31')](_0x4d5d09[_0xa9ae('0x30')]);_0xe69aab['filters']=_[_0xa9ae('0x32')](_0xe69aab[_0xa9ae('0x2f')],_0xe69aab[_0xa9ae('0x30')]);_0x5f06f9[_0xa9ae('0x33')]=_[_0xa9ae('0x32')](_0xe69aab[_0xa9ae('0x2f')],qs[_0xa9ae('0x34')](_0x4d5d09[_0xa9ae('0x30')][_0xa9ae('0x34')]));_0x5f06f9['attributes']=_0x5f06f9[_0xa9ae('0x33')][_0xa9ae('0x35')]?_0x5f06f9[_0xa9ae('0x33')]:_0xe69aab[_0xa9ae('0x2f')];if(!_0x4d5d09[_0xa9ae('0x30')]['hasOwnProperty']('nolimit')){_0x5f06f9[_0xa9ae('0x20')]=qs[_0xa9ae('0x20')](_0x4d5d09[_0xa9ae('0x30')][_0xa9ae('0x20')]);_0x5f06f9[_0xa9ae('0x1e')]=qs[_0xa9ae('0x1e')](_0x4d5d09['query'][_0xa9ae('0x1e')]);}_0x5f06f9[_0xa9ae('0x36')]=qs[_0xa9ae('0x37')](_0x4d5d09[_0xa9ae('0x30')][_0xa9ae('0x37')]);_0x5f06f9[_0xa9ae('0x38')]=qs['filters'](_[_0xa9ae('0x39')](_0x4d5d09[_0xa9ae('0x30')],_0xe69aab['filters']),_0x10b493);if(_0x4d5d09[_0xa9ae('0x30')]['filter']){_0x5f06f9[_0xa9ae('0x38')]=_[_0xa9ae('0x3a')](_0x5f06f9[_0xa9ae('0x38')],{'$or':_[_0xa9ae('0x2d')](_0x10b493,function(_0x8eff5a){if(_0x8eff5a[_0xa9ae('0x3b')]!==_0xa9ae('0x3c')){var _0x5037f0={};_0x5037f0[_0x8eff5a[_0xa9ae('0x2a')]]={'$like':'%'+_0x4d5d09[_0xa9ae('0x30')][_0xa9ae('0x3d')]+'%'};return _0x5037f0;}})});}_0x5f06f9=_['merge']({},_0x5f06f9,_0x4d5d09[_0xa9ae('0x3e')]);var _0x1009a7={'where':_0x5f06f9[_0xa9ae('0x38')]};return db[_0xa9ae('0x3f')]['count'](_0x1009a7)[_0xa9ae('0x28')](function(_0x111c7e){_0x467d51[_0xa9ae('0x21')]=_0x111c7e;if(_0x4d5d09[_0xa9ae('0x30')]['includeAll']){_0x5f06f9[_0xa9ae('0x40')]=[{'all':!![]}];}return db[_0xa9ae('0x3f')][_0xa9ae('0x41')](_0x5f06f9);})[_0xa9ae('0x28')](function(_0xb4a479){_0x467d51['rows']=_0xb4a479;return _0x467d51;})[_0xa9ae('0x28')](respondWithFilteredResult(_0x439eeb,_0x5f06f9))[_0xa9ae('0x42')](handleError(_0x439eeb,null));};exports[_0xa9ae('0x43')]=function(_0x2481d4,_0x38bde1){var _0x7cdeb={'raw':![],'where':{'id':_0x2481d4[_0xa9ae('0x44')]['id']}},_0x307aac={};_0x307aac[_0xa9ae('0x2f')]=_[_0xa9ae('0x31')](db['VtigerAccount'][_0xa9ae('0x2e')]);_0x307aac['query']=_[_0xa9ae('0x31')](_0x2481d4['query']);_0x307aac[_0xa9ae('0x45')]=_[_0xa9ae('0x32')](_0x307aac[_0xa9ae('0x2f')],_0x307aac['query']);_0x7cdeb[_0xa9ae('0x33')]=_[_0xa9ae('0x32')](_0x307aac[_0xa9ae('0x2f')],qs[_0xa9ae('0x34')](_0x2481d4[_0xa9ae('0x30')][_0xa9ae('0x34')]));_0x7cdeb[_0xa9ae('0x33')]=_0x7cdeb[_0xa9ae('0x33')]['length']?_0x7cdeb[_0xa9ae('0x33')]:_0x307aac['model'];if(_0x2481d4[_0xa9ae('0x30')][_0xa9ae('0x46')]){_0x7cdeb[_0xa9ae('0x40')]=[{'all':!![]}];}_0x7cdeb=_[_0xa9ae('0x3a')]({},_0x7cdeb,_0x2481d4[_0xa9ae('0x3e')]);return db[_0xa9ae('0x3f')]['find'](_0x7cdeb)['then'](handleEntityNotFound(_0x38bde1,null))['then'](respondWithResult(_0x38bde1,null))[_0xa9ae('0x42')](handleError(_0x38bde1,null));};exports['create']=function(_0x5c5953,_0x2dbb5d){return db[_0xa9ae('0x3f')][_0xa9ae('0x47')](_0x5c5953[_0xa9ae('0x48')],{})['then'](respondWithResult(_0x2dbb5d,0xc9))[_0xa9ae('0x42')](handleError(_0x2dbb5d,null));};exports[_0xa9ae('0x27')]=function(_0x320f51,_0x1f2af3){if(_0x320f51['body']['id']){delete _0x320f51[_0xa9ae('0x48')]['id'];}return db[_0xa9ae('0x3f')][_0xa9ae('0x49')]({'where':{'id':_0x320f51[_0xa9ae('0x44')]['id']}})[_0xa9ae('0x28')](handleEntityNotFound(_0x1f2af3,null))['then'](saveUpdates(_0x320f51[_0xa9ae('0x48')],null))['then'](respondWithResult(_0x1f2af3,null))[_0xa9ae('0x42')](handleError(_0x1f2af3,null));};exports[_0xa9ae('0x29')]=function(_0x2df934,_0x565dcb){return db[_0xa9ae('0x3f')][_0xa9ae('0x49')]({'where':{'id':_0x2df934['params']['id']}})['then'](handleEntityNotFound(_0x565dcb,null))['then'](removeEntity(_0x565dcb,null))[_0xa9ae('0x42')](handleError(_0x565dcb,null));};exports[_0xa9ae('0x4a')]=function(_0x4b8685,_0x8a2bd4,_0x1fcb28){var _0x967b0c={};var _0x253de1={};var _0x3c8ffe;var _0x1eee07;return db[_0xa9ae('0x3f')]['findOne']({'where':{'id':_0x4b8685[_0xa9ae('0x44')]['id']}})[_0xa9ae('0x28')](handleEntityNotFound(_0x8a2bd4,null))[_0xa9ae('0x28')](function(_0x563a78){if(_0x563a78){_0x3c8ffe=_0x563a78;_0x253de1['model']=_[_0xa9ae('0x31')](db[_0xa9ae('0x4b')][_0xa9ae('0x2e')]);_0x253de1['query']=_['keys'](_0x4b8685['query']);_0x253de1[_0xa9ae('0x45')]=_[_0xa9ae('0x32')](_0x253de1[_0xa9ae('0x2f')],_0x253de1[_0xa9ae('0x30')]);_0x967b0c[_0xa9ae('0x33')]=_[_0xa9ae('0x32')](_0x253de1[_0xa9ae('0x2f')],qs['fields'](_0x4b8685[_0xa9ae('0x30')][_0xa9ae('0x34')]));_0x967b0c[_0xa9ae('0x33')]=_0x967b0c['attributes'][_0xa9ae('0x35')]?_0x967b0c[_0xa9ae('0x33')]:_0x253de1[_0xa9ae('0x2f')];_0x967b0c[_0xa9ae('0x36')]=qs[_0xa9ae('0x37')](_0x4b8685['query']['sort']);_0x967b0c['where']=qs[_0xa9ae('0x45')](_[_0xa9ae('0x39')](_0x4b8685[_0xa9ae('0x30')],_0x253de1[_0xa9ae('0x45')]));if(_0x4b8685[_0xa9ae('0x30')][_0xa9ae('0x3d')]){_0x967b0c[_0xa9ae('0x38')]=_['merge'](_0x967b0c[_0xa9ae('0x38')],{'$or':_[_0xa9ae('0x2d')](_0x967b0c[_0xa9ae('0x33')],function(_0x29b940){var _0x3d995c={};_0x3d995c[_0x29b940]={'$like':'%'+_0x4b8685[_0xa9ae('0x30')][_0xa9ae('0x3d')]+'%'};return _0x3d995c;})});}_0x967b0c=_['merge']({},_0x967b0c,_0x4b8685[_0xa9ae('0x3e')]);return _0x3c8ffe['getConfigurations'](_0x967b0c);}})[_0xa9ae('0x28')](function(_0x252801){if(_0x252801){_0x1eee07=_0x252801[_0xa9ae('0x35')];if(!_0x4b8685['query'][_0xa9ae('0x4c')](_0xa9ae('0x4d'))){_0x967b0c['limit']=qs['limit'](_0x4b8685[_0xa9ae('0x30')]['limit']);_0x967b0c[_0xa9ae('0x1e')]=qs[_0xa9ae('0x1e')](_0x4b8685['query'][_0xa9ae('0x1e')]);}return _0x3c8ffe[_0xa9ae('0x4a')](_0x967b0c);}})['then'](function(_0x13d6f4){if(_0x13d6f4){return _0x13d6f4?{'count':_0x1eee07,'rows':_0x13d6f4}:null;}})['then'](respondWithResult(_0x8a2bd4,null))[_0xa9ae('0x42')](handleError(_0x8a2bd4,null));};exports['addConfiguration']=function(_0x1043c9,_0xd6baee,_0x1f02c9){if(_0x1043c9['body']['id']){delete _0x1043c9['body']['id'];}return db[_0xa9ae('0x3f')][_0xa9ae('0x4e')]({'where':{'id':_0x1043c9['params']['id']}})[_0xa9ae('0x28')](handleEntityNotFound(_0xd6baee,null))[_0xa9ae('0x28')](function(_0x158095){if(_0x158095){_0x1043c9[_0xa9ae('0x48')][_0xa9ae('0x4f')]=_0x158095['id'];_0x1043c9[_0xa9ae('0x48')][_0xa9ae('0x50')]=integrations[_0xa9ae('0x51')](_0x1043c9[_0xa9ae('0x48')][_0xa9ae('0x52')],_0x1043c9['body']['type']);_0x1043c9[_0xa9ae('0x48')][_0xa9ae('0x53')]=integrations[_0xa9ae('0x54')](_0x1043c9[_0xa9ae('0x48')]['channel'],_0x1043c9['body'][_0xa9ae('0x3b')]);return db[_0xa9ae('0x4b')][_0xa9ae('0x47')](_0x1043c9[_0xa9ae('0x48')],{'include':[{'model':db[_0xa9ae('0x55')],'as':_0xa9ae('0x50')},{'model':db[_0xa9ae('0x55')],'as':_0xa9ae('0x53')}]});}return null;})[_0xa9ae('0x28')](respondWithResult(_0xd6baee,null))[_0xa9ae('0x42')](handleError(_0xd6baee,null));};var md5=require(_0xa9ae('0x56'));exports[_0xa9ae('0x57')]=function(_0x31d046,_0x12ab93,_0x5b5226){var _0x49eb7b=null;var _0x3da865=null;var _0x33416d=null;var _0x4012b8=null;var _0x3d24c0='';return db[_0xa9ae('0x3f')][_0xa9ae('0x4e')]({'where':{'id':_0x31d046[_0xa9ae('0x44')]['id']},'attributes':['id',_0xa9ae('0x2a'),_0xa9ae('0x58'),_0xa9ae('0x59'),'moduleName',_0xa9ae('0x5a'),_0xa9ae('0x5b'),_0xa9ae('0x5c')]})['then'](handleEntityNotFound(_0x12ab93,null))[_0xa9ae('0x28')](function(_0xc745c2){if(_0xc745c2){_0x49eb7b=_0xc745c2[_0xa9ae('0x58')];_0x3da865=_0xc745c2[_0xa9ae('0x5c')];_0x33416d=_0xc745c2[_0xa9ae('0x5d')];_0x3d24c0=_0xc745c2[_0xa9ae('0x5a')];var _0x28e8e9=_0x3d24c0[_0xa9ae('0x5e')](-0x1);if(_0x28e8e9==='/'){_0x3d24c0=_0x3d24c0[_0xa9ae('0x5f')](0x0,_0x3d24c0[_0xa9ae('0x60')](_0x28e8e9));}_0x4012b8=util[_0xa9ae('0x61')](_0xa9ae('0x62'),_0x3d24c0);var _0x1b8f30={'method':_0xa9ae('0x63'),'uri':_0x4012b8,'qs':{'operation':_0xa9ae('0x64'),'username':_0xc745c2[_0xa9ae('0x58')]},'json':!![]};return rp(_0x1b8f30);}})[_0xa9ae('0x28')](function(_0x542035){if(_0x542035[_0xa9ae('0x65')]){var _0x1f06c1={'method':'POST','uri':_0x4012b8,'form':{'operation':_0xa9ae('0x66'),'username':_0x49eb7b,'accessKey':md5(_0x542035['result'][_0xa9ae('0x67')]+_0x3da865)},'json':!![]};return rp(_0x1f06c1);}})['then'](function(_0xf27fc2){if(_0xf27fc2['success']){var _0x1856c7={'method':'GET','uri':_0x4012b8,'qs':{'operation':_0xa9ae('0x68'),'username':_0x49eb7b,'sessionName':_0xf27fc2[_0xa9ae('0x69')][_0xa9ae('0x6a')],'elementType':_0x33416d},'json':!![]};return rp(_0x1856c7);}})[_0xa9ae('0x28')](function(_0x1a1dcd){if(_0x1a1dcd[_0xa9ae('0x65')]){var _0x95de9d=[_0xa9ae('0x6b'),_0xa9ae('0x6c'),_0xa9ae('0x6d')];_[_0xa9ae('0x6e')](_0x1a1dcd[_0xa9ae('0x69')][_0xa9ae('0x34')],function(_0x4e456b){return _0x95de9d[_0xa9ae('0x6f')](_0x4e456b[_0xa9ae('0x3b')][_0xa9ae('0x2a')]);});_[_0xa9ae('0x6e')](_0x1a1dcd[_0xa9ae('0x69')][_0xa9ae('0x34')],function(_0x4f75fc){return _0x4f75fc[_0xa9ae('0x70')]===_0xa9ae('0x71');});return{'count':_0x1a1dcd[_0xa9ae('0x69')][_0xa9ae('0x34')][_0xa9ae('0x35')],'rows':_[_0xa9ae('0x2d')](_0x1a1dcd[_0xa9ae('0x69')][_0xa9ae('0x34')],function(_0x987c0b){return{'id':_0x987c0b[_0xa9ae('0x2a')],'name':_0x987c0b[_0xa9ae('0x72')],'custom':_[_0xa9ae('0x73')](_0x987c0b[_0xa9ae('0x2a')],'cf_')?!![]:![],'options':_0x987c0b[_0xa9ae('0x3b')][_0xa9ae('0x2a')]===_0xa9ae('0x74')&&_0x987c0b['type'][_0xa9ae('0x75')][_0xa9ae('0x35')]>0x0?_[_0xa9ae('0x2d')](_0x987c0b[_0xa9ae('0x3b')][_0xa9ae('0x75')],function(_0x4f50cb){return{'name':_0x4f50cb[_0xa9ae('0x72')],'value':_0x4f50cb[_0xa9ae('0x76')]};}):[]};})};}})['then'](respondWithResult(_0x12ab93,null))[_0xa9ae('0x42')](function(_0x4d022c){console[_0xa9ae('0x77')](_0xa9ae('0x78')+_0x4d022c);var _0x24f2fb=_0x31d046[_0xa9ae('0x30')][_0xa9ae('0x79')]?0x1f4:_0x4d022c[_0xa9ae('0x7a')]||0x1f4;logger[_0xa9ae('0x7b')](_0xa9ae('0x7c'),_0xa9ae('0x57'),_0x24f2fb,JSON['stringify'](_0x4d022c));delete _0x4d022c['name'];if(_0x24f2fb===0x191){_0x24f2fb=0x190;}_0x12ab93[_0xa9ae('0x1b')](_0x24f2fb)[_0xa9ae('0x2b')](_0x31d046['query'][_0xa9ae('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x4d022c[_0xa9ae('0x7a')]}:_0x4d022c);});}; \ No newline at end of file +var _0xb112=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','Content-Range','reject','save','update','then','error','stack','name','send','map','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','VtigerAccount','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','editable','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','fs-extra','lodash','squel','crypto'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0xb112,0x6e));var _0x2b11=function(_0x257f93,_0x2bba7a){_0x257f93=_0x257f93-0x0;var _0x36a03c=_0xb112[_0x257f93];return _0x36a03c;};'use strict';var emlformat=require(_0x2b11('0x0'));var rimraf=require(_0x2b11('0x1'));var zipdir=require(_0x2b11('0x2'));var jsonpatch=require(_0x2b11('0x3'));var rp=require(_0x2b11('0x4'));var moment=require('moment');var BPromise=require(_0x2b11('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2b11('0x6'));var sox=require(_0x2b11('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b11('0x8'));var _=require(_0x2b11('0x9'));var squel=require(_0x2b11('0xa'));var crypto=require(_0x2b11('0xb'));var jsforce=require(_0x2b11('0xc'));var deskjs=require(_0x2b11('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2b11('0xe'));var Papa=require(_0x2b11('0xf'));var Redis=require(_0x2b11('0x10'));var authService=require(_0x2b11('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2b11('0x12'));var hardwareService=require(_0x2b11('0x13'));var logger=require(_0x2b11('0x14'))(_0x2b11('0x15'));var utils=require(_0x2b11('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2b11('0x17'))['db'];var integrations=require(_0x2b11('0x18'));function respondWithStatusCode(_0xb14268,_0x24b4f1){_0x24b4f1=_0x24b4f1||0xcc;return function(_0x3045a1){if(_0x3045a1){return _0xb14268[_0x2b11('0x19')](_0x24b4f1);}return _0xb14268[_0x2b11('0x1a')](_0x24b4f1)[_0x2b11('0x1b')]();};}function respondWithResult(_0x55be86,_0x3eaa82){_0x3eaa82=_0x3eaa82||0xc8;return function(_0x555f07){if(_0x555f07){return _0x55be86['status'](_0x3eaa82)[_0x2b11('0x1c')](_0x555f07);}};}function respondWithFilteredResult(_0x5df4c4,_0x58efb9){return function(_0x941485){if(_0x941485){var _0x52a58e=typeof _0x58efb9[_0x2b11('0x1d')]==='undefined'&&typeof _0x58efb9[_0x2b11('0x1e')]===_0x2b11('0x1f');var _0x342ad9=_0x941485['count'];var _0x46e2b7=_0x52a58e?0x0:_0x58efb9['offset'];var _0x49bc8d=_0x52a58e?_0x941485['count']:_0x58efb9[_0x2b11('0x1d')]+_0x58efb9[_0x2b11('0x1e')];var _0x321a9a;if(_0x49bc8d>=_0x342ad9){_0x49bc8d=_0x342ad9;_0x321a9a=0xc8;}else{_0x321a9a=0xce;}_0x5df4c4[_0x2b11('0x1a')](_0x321a9a);return _0x5df4c4['set'](_0x2b11('0x20'),_0x46e2b7+'-'+_0x49bc8d+'/'+_0x342ad9)['json'](_0x941485);}return null;};}function patchUpdates(_0x87e895){return function(_0xb70113){try{jsonpatch['apply'](_0xb70113,_0x87e895,!![]);}catch(_0x4ab7fc){return BPromise[_0x2b11('0x21')](_0x4ab7fc);}return _0xb70113[_0x2b11('0x22')]();};}function saveUpdates(_0x5b6cf7,_0x1e38ed){return function(_0x33263e){if(_0x33263e){return _0x33263e[_0x2b11('0x23')](_0x5b6cf7)[_0x2b11('0x24')](function(_0x17bd1c){return _0x17bd1c;});}return null;};}function removeEntity(_0x5e44d7,_0x27bb75){return function(_0x29dd2c){if(_0x29dd2c){return _0x29dd2c['destroy']()[_0x2b11('0x24')](function(){_0x5e44d7[_0x2b11('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13c961,_0x33bb50){return function(_0x911277){if(!_0x911277){_0x13c961[_0x2b11('0x19')](0x194);}return _0x911277;};}function handleError(_0x34629a,_0x1810a7){_0x1810a7=_0x1810a7||0x1f4;return function(_0x61b76e){logger[_0x2b11('0x25')](_0x61b76e[_0x2b11('0x26')]);if(_0x61b76e[_0x2b11('0x27')]){delete _0x61b76e[_0x2b11('0x27')];}_0x34629a[_0x2b11('0x1a')](_0x1810a7)[_0x2b11('0x28')](_0x61b76e);};}exports['index']=function(_0x5b6d2e,_0x2819e7){var _0x463416={},_0x4e1ebf={},_0x425959={'count':0x0,'rows':[]};var _0x3e3d2f=_[_0x2b11('0x29')](db['VtigerAccount']['rawAttributes'],function(_0x33e610){return{'name':_0x33e610['fieldName'],'type':_0x33e610[_0x2b11('0x2a')][_0x2b11('0x2b')]};});_0x4e1ebf['model']=_['map'](_0x3e3d2f,'name');_0x4e1ebf['query']=_[_0x2b11('0x2c')](_0x5b6d2e[_0x2b11('0x2d')]);_0x4e1ebf[_0x2b11('0x2e')]=_[_0x2b11('0x2f')](_0x4e1ebf[_0x2b11('0x30')],_0x4e1ebf[_0x2b11('0x2d')]);_0x463416['attributes']=_['intersection'](_0x4e1ebf[_0x2b11('0x30')],qs[_0x2b11('0x31')](_0x5b6d2e[_0x2b11('0x2d')][_0x2b11('0x31')]));_0x463416[_0x2b11('0x32')]=_0x463416[_0x2b11('0x32')][_0x2b11('0x33')]?_0x463416[_0x2b11('0x32')]:_0x4e1ebf[_0x2b11('0x30')];if(!_0x5b6d2e['query'][_0x2b11('0x34')](_0x2b11('0x35'))){_0x463416[_0x2b11('0x1e')]=qs[_0x2b11('0x1e')](_0x5b6d2e['query'][_0x2b11('0x1e')]);_0x463416[_0x2b11('0x1d')]=qs[_0x2b11('0x1d')](_0x5b6d2e[_0x2b11('0x2d')]['offset']);}_0x463416[_0x2b11('0x36')]=qs[_0x2b11('0x37')](_0x5b6d2e['query'][_0x2b11('0x37')]);_0x463416[_0x2b11('0x38')]=qs[_0x2b11('0x2e')](_[_0x2b11('0x39')](_0x5b6d2e[_0x2b11('0x2d')],_0x4e1ebf[_0x2b11('0x2e')]),_0x3e3d2f);if(_0x5b6d2e[_0x2b11('0x2d')]['filter']){_0x463416[_0x2b11('0x38')]=_['merge'](_0x463416['where'],{'$or':_[_0x2b11('0x29')](_0x3e3d2f,function(_0x2563cb){if(_0x2563cb[_0x2b11('0x2a')]!==_0x2b11('0x3a')){var _0x5d531e={};_0x5d531e[_0x2563cb[_0x2b11('0x27')]]={'$like':'%'+_0x5b6d2e[_0x2b11('0x2d')][_0x2b11('0x3b')]+'%'};return _0x5d531e;}})});}_0x463416=_[_0x2b11('0x3c')]({},_0x463416,_0x5b6d2e[_0x2b11('0x3d')]);var _0x42cbba={'where':_0x463416[_0x2b11('0x38')]};return db[_0x2b11('0x3e')][_0x2b11('0x3f')](_0x42cbba)['then'](function(_0x4e1f08){_0x425959[_0x2b11('0x3f')]=_0x4e1f08;if(_0x5b6d2e[_0x2b11('0x2d')][_0x2b11('0x40')]){_0x463416[_0x2b11('0x41')]=[{'all':!![]}];}return db[_0x2b11('0x3e')][_0x2b11('0x42')](_0x463416);})['then'](function(_0x49f891){_0x425959[_0x2b11('0x43')]=_0x49f891;return _0x425959;})[_0x2b11('0x24')](respondWithFilteredResult(_0x2819e7,_0x463416))[_0x2b11('0x44')](handleError(_0x2819e7,null));};exports[_0x2b11('0x45')]=function(_0x200227,_0x341256){var _0x451d64={'raw':![],'where':{'id':_0x200227[_0x2b11('0x46')]['id']}},_0x16a34a={};_0x16a34a[_0x2b11('0x30')]=_['keys'](db['VtigerAccount'][_0x2b11('0x47')]);_0x16a34a[_0x2b11('0x2d')]=_[_0x2b11('0x2c')](_0x200227[_0x2b11('0x2d')]);_0x16a34a[_0x2b11('0x2e')]=_[_0x2b11('0x2f')](_0x16a34a['model'],_0x16a34a[_0x2b11('0x2d')]);_0x451d64['attributes']=_[_0x2b11('0x2f')](_0x16a34a[_0x2b11('0x30')],qs[_0x2b11('0x31')](_0x200227[_0x2b11('0x2d')][_0x2b11('0x31')]));_0x451d64['attributes']=_0x451d64[_0x2b11('0x32')][_0x2b11('0x33')]?_0x451d64[_0x2b11('0x32')]:_0x16a34a[_0x2b11('0x30')];if(_0x200227[_0x2b11('0x2d')][_0x2b11('0x40')]){_0x451d64[_0x2b11('0x41')]=[{'all':!![]}];}_0x451d64=_['merge']({},_0x451d64,_0x200227[_0x2b11('0x3d')]);return db[_0x2b11('0x3e')][_0x2b11('0x48')](_0x451d64)[_0x2b11('0x24')](handleEntityNotFound(_0x341256,null))[_0x2b11('0x24')](respondWithResult(_0x341256,null))[_0x2b11('0x44')](handleError(_0x341256,null));};exports[_0x2b11('0x49')]=function(_0x492ebd,_0x5ca492){return db[_0x2b11('0x3e')][_0x2b11('0x49')](_0x492ebd[_0x2b11('0x4a')],{})['then'](respondWithResult(_0x5ca492,0xc9))[_0x2b11('0x44')](handleError(_0x5ca492,null));};exports[_0x2b11('0x23')]=function(_0x39018d,_0x3940f6){if(_0x39018d[_0x2b11('0x4a')]['id']){delete _0x39018d[_0x2b11('0x4a')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x39018d[_0x2b11('0x46')]['id']}})[_0x2b11('0x24')](handleEntityNotFound(_0x3940f6,null))[_0x2b11('0x24')](saveUpdates(_0x39018d[_0x2b11('0x4a')],null))['then'](respondWithResult(_0x3940f6,null))[_0x2b11('0x44')](handleError(_0x3940f6,null));};exports[_0x2b11('0x4b')]=function(_0x11ac20,_0x20e3ef){return db['VtigerAccount']['find']({'where':{'id':_0x11ac20[_0x2b11('0x46')]['id']}})[_0x2b11('0x24')](handleEntityNotFound(_0x20e3ef,null))[_0x2b11('0x24')](removeEntity(_0x20e3ef,null))[_0x2b11('0x44')](handleError(_0x20e3ef,null));};exports[_0x2b11('0x4c')]=function(_0x40094d,_0x3a8625,_0x1881bd){var _0x51a23c={};var _0x5caca5={};var _0x21ca84;var _0x493706;return db[_0x2b11('0x3e')][_0x2b11('0x4d')]({'where':{'id':_0x40094d['params']['id']}})[_0x2b11('0x24')](handleEntityNotFound(_0x3a8625,null))[_0x2b11('0x24')](function(_0x1c7498){if(_0x1c7498){_0x21ca84=_0x1c7498;_0x5caca5[_0x2b11('0x30')]=_[_0x2b11('0x2c')](db[_0x2b11('0x4e')][_0x2b11('0x47')]);_0x5caca5['query']=_['keys'](_0x40094d[_0x2b11('0x2d')]);_0x5caca5[_0x2b11('0x2e')]=_['intersection'](_0x5caca5[_0x2b11('0x30')],_0x5caca5[_0x2b11('0x2d')]);_0x51a23c[_0x2b11('0x32')]=_[_0x2b11('0x2f')](_0x5caca5[_0x2b11('0x30')],qs[_0x2b11('0x31')](_0x40094d[_0x2b11('0x2d')][_0x2b11('0x31')]));_0x51a23c[_0x2b11('0x32')]=_0x51a23c[_0x2b11('0x32')][_0x2b11('0x33')]?_0x51a23c[_0x2b11('0x32')]:_0x5caca5['model'];_0x51a23c[_0x2b11('0x36')]=qs[_0x2b11('0x37')](_0x40094d[_0x2b11('0x2d')][_0x2b11('0x37')]);_0x51a23c[_0x2b11('0x38')]=qs[_0x2b11('0x2e')](_[_0x2b11('0x39')](_0x40094d[_0x2b11('0x2d')],_0x5caca5['filters']));if(_0x40094d[_0x2b11('0x2d')]['filter']){_0x51a23c['where']=_['merge'](_0x51a23c['where'],{'$or':_[_0x2b11('0x29')](_0x51a23c[_0x2b11('0x32')],function(_0x400ad4){var _0x373830={};_0x373830[_0x400ad4]={'$like':'%'+_0x40094d[_0x2b11('0x2d')][_0x2b11('0x3b')]+'%'};return _0x373830;})});}_0x51a23c=_[_0x2b11('0x3c')]({},_0x51a23c,_0x40094d[_0x2b11('0x3d')]);return _0x21ca84['getConfigurations'](_0x51a23c);}})[_0x2b11('0x24')](function(_0x12e4e4){if(_0x12e4e4){_0x493706=_0x12e4e4['length'];if(!_0x40094d[_0x2b11('0x2d')]['hasOwnProperty'](_0x2b11('0x35'))){_0x51a23c[_0x2b11('0x1e')]=qs[_0x2b11('0x1e')](_0x40094d[_0x2b11('0x2d')]['limit']);_0x51a23c[_0x2b11('0x1d')]=qs[_0x2b11('0x1d')](_0x40094d[_0x2b11('0x2d')]['offset']);}return _0x21ca84[_0x2b11('0x4c')](_0x51a23c);}})[_0x2b11('0x24')](function(_0x5ef0dc){if(_0x5ef0dc){return _0x5ef0dc?{'count':_0x493706,'rows':_0x5ef0dc}:null;}})[_0x2b11('0x24')](respondWithResult(_0x3a8625,null))[_0x2b11('0x44')](handleError(_0x3a8625,null));};exports['addConfiguration']=function(_0x1edb3c,_0x1ef0ea,_0x122028){if(_0x1edb3c['body']['id']){delete _0x1edb3c['body']['id'];}return db['VtigerAccount'][_0x2b11('0x4d')]({'where':{'id':_0x1edb3c['params']['id']}})['then'](handleEntityNotFound(_0x1ef0ea,null))['then'](function(_0x374285){if(_0x374285){_0x1edb3c[_0x2b11('0x4a')][_0x2b11('0x4f')]=_0x374285['id'];_0x1edb3c[_0x2b11('0x4a')][_0x2b11('0x50')]=integrations[_0x2b11('0x51')](_0x1edb3c['body'][_0x2b11('0x52')],_0x1edb3c[_0x2b11('0x4a')][_0x2b11('0x2a')]);_0x1edb3c['body']['Descriptions']=integrations[_0x2b11('0x53')](_0x1edb3c[_0x2b11('0x4a')][_0x2b11('0x52')],_0x1edb3c[_0x2b11('0x4a')]['type']);return db[_0x2b11('0x4e')][_0x2b11('0x49')](_0x1edb3c[_0x2b11('0x4a')],{'include':[{'model':db[_0x2b11('0x54')],'as':'Subjects'},{'model':db[_0x2b11('0x54')],'as':_0x2b11('0x55')}]});}return null;})[_0x2b11('0x24')](respondWithResult(_0x1ef0ea,null))[_0x2b11('0x44')](handleError(_0x1ef0ea,null));};var md5=require(_0x2b11('0x56'));exports['getFields']=function(_0x2ccb0d,_0x1f2d9c,_0x29746f){var _0x4b47cb=null;var _0x3c240f=null;var _0x3d4f83=null;var _0x1520b2=null;var _0x469c3a='';return db[_0x2b11('0x3e')][_0x2b11('0x4d')]({'where':{'id':_0x2ccb0d[_0x2b11('0x46')]['id']},'attributes':['id',_0x2b11('0x27'),'username','description',_0x2b11('0x57'),_0x2b11('0x58'),_0x2b11('0x59'),_0x2b11('0x5a')]})[_0x2b11('0x24')](handleEntityNotFound(_0x1f2d9c,null))[_0x2b11('0x24')](function(_0x376174){if(_0x376174){_0x4b47cb=_0x376174[_0x2b11('0x5b')];_0x3c240f=_0x376174[_0x2b11('0x5a')];_0x3d4f83=_0x376174[_0x2b11('0x57')];_0x469c3a=_0x376174[_0x2b11('0x58')];var _0x1fefac=_0x469c3a[_0x2b11('0x5c')](-0x1);if(_0x1fefac==='/'){_0x469c3a=_0x469c3a[_0x2b11('0x5d')](0x0,_0x469c3a[_0x2b11('0x5e')](_0x1fefac));}_0x1520b2=util[_0x2b11('0x5f')](_0x2b11('0x60'),_0x469c3a);var _0x562bc2={'method':_0x2b11('0x61'),'uri':_0x1520b2,'qs':{'operation':'getchallenge','username':_0x376174['username']},'json':!![]};return rp(_0x562bc2);}})[_0x2b11('0x24')](function(_0x392a00){if(_0x392a00[_0x2b11('0x62')]){var _0x68bc61={'method':_0x2b11('0x63'),'uri':_0x1520b2,'form':{'operation':_0x2b11('0x64'),'username':_0x4b47cb,'accessKey':md5(_0x392a00[_0x2b11('0x65')][_0x2b11('0x66')]+_0x3c240f)},'json':!![]};return rp(_0x68bc61);}})['then'](function(_0x5ce425){if(_0x5ce425[_0x2b11('0x62')]){var _0x48b371={'method':_0x2b11('0x61'),'uri':_0x1520b2,'qs':{'operation':_0x2b11('0x67'),'username':_0x4b47cb,'sessionName':_0x5ce425[_0x2b11('0x65')][_0x2b11('0x68')],'elementType':_0x3d4f83},'json':!![]};return rp(_0x48b371);}})['then'](function(_0x7f32fb){if(_0x7f32fb[_0x2b11('0x62')]){var _0x324493=[_0x2b11('0x69'),_0x2b11('0x6a'),_0x2b11('0x6b')];_[_0x2b11('0x6c')](_0x7f32fb['result']['fields'],function(_0x15dd2e){return _0x324493['includes'](_0x15dd2e[_0x2b11('0x2a')][_0x2b11('0x27')]);});_['remove'](_0x7f32fb[_0x2b11('0x65')]['fields'],function(_0x11bbd9){return _0x11bbd9[_0x2b11('0x6d')]==='false';});return{'count':_0x7f32fb[_0x2b11('0x65')]['fields']['length'],'rows':_[_0x2b11('0x29')](_0x7f32fb['result'][_0x2b11('0x31')],function(_0x5057e6){return{'id':_0x5057e6[_0x2b11('0x27')],'name':_0x5057e6[_0x2b11('0x6e')],'custom':_[_0x2b11('0x6f')](_0x5057e6[_0x2b11('0x27')],_0x2b11('0x70'))?!![]:![],'options':_0x5057e6[_0x2b11('0x2a')][_0x2b11('0x27')]===_0x2b11('0x71')&&_0x5057e6[_0x2b11('0x2a')][_0x2b11('0x72')][_0x2b11('0x33')]>0x0?_[_0x2b11('0x29')](_0x5057e6[_0x2b11('0x2a')]['picklistValues'],function(_0x4f6a30){return{'name':_0x4f6a30[_0x2b11('0x6e')],'value':_0x4f6a30[_0x2b11('0x73')]};}):[]};})};}})[_0x2b11('0x24')](respondWithResult(_0x1f2d9c,null))[_0x2b11('0x44')](function(_0x40c714){console['log'](_0x2b11('0x74')+_0x40c714);var _0x14cfca=_0x2ccb0d['query'][_0x2b11('0x75')]?0x1f4:_0x40c714[_0x2b11('0x76')]||0x1f4;logger[_0x2b11('0x25')](_0x2b11('0x77'),_0x2b11('0x78'),_0x14cfca,JSON[_0x2b11('0x79')](_0x40c714));delete _0x40c714[_0x2b11('0x27')];if(_0x14cfca===0x191){_0x14cfca=0x190;}_0x1f2d9c[_0x2b11('0x1a')](_0x14cfca)[_0x2b11('0x28')](_0x2ccb0d[_0x2b11('0x2d')][_0x2b11('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x40c714[_0x2b11('0x76')]}:_0x40c714);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f4969aa..520084f 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 _0xb320=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x54c908,_0x300b41){var _0xaa6bca=function(_0x2073f3){while(--_0x2073f3){_0x54c908['push'](_0x54c908['shift']());}};_0xaa6bca(++_0x300b41);}(_0xb320,0x1b4));var _0x0b32=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0xb320[_0x3299d1];return _0x44356e;};'use strict';var _=require(_0x0b32('0x0'));var util=require(_0x0b32('0x1'));var logger=require(_0x0b32('0x2'))('api');var moment=require(_0x0b32('0x3'));var BPromise=require(_0x0b32('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b32('0x5'));var rimraf=require(_0x0b32('0x6'));var config=require(_0x0b32('0x7'));var attributes=require(_0x0b32('0x8'));var integrations=require(_0x0b32('0x9'));module[_0x0b32('0xa')]=function(_0x189529,_0x19f1c0){return _0x189529[_0x0b32('0xb')]('VtigerAccount',attributes,{'tableName':_0x0b32('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc9d=['VtigerAccount','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x86379c,_0x4e179b){var _0x1126f2=function(_0x544b61){while(--_0x544b61){_0x86379c['push'](_0x86379c['shift']());}};_0x1126f2(++_0x4e179b);}(_0xfc9d,0x191));var _0xdfc9=function(_0x5bf0f8,_0x5d316b){_0x5bf0f8=_0x5bf0f8-0x0;var _0x236a0c=_0xfc9d[_0x5bf0f8];return _0x236a0c;};'use strict';var _=require('lodash');var util=require(_0xdfc9('0x0'));var logger=require(_0xdfc9('0x1'))('api');var moment=require(_0xdfc9('0x2'));var BPromise=require('bluebird');var rp=require(_0xdfc9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdfc9('0x4'));var config=require(_0xdfc9('0x5'));var attributes=require(_0xdfc9('0x6'));var integrations=require(_0xdfc9('0x7'));module[_0xdfc9('0x8')]=function(_0x4499b0,_0x66becd){return _0x4499b0['define'](_0xdfc9('0x9'),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 d458adc..268ca55 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 _0xf45e=['options','raw','where','attributes','limit','include','model','map','VtigerAccount','find','ShowVtigerAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','findAll'];(function(_0x53f8c3,_0x34f4d9){var _0x1b382e=function(_0x2df94e){while(--_0x2df94e){_0x53f8c3['push'](_0x53f8c3['shift']());}};_0x1b382e(++_0x34f4d9);}(_0xf45e,0x115));var _0xef45=function(_0x515b24,_0x509a43){_0x515b24=_0x515b24-0x0;var _0x20de36=_0xf45e[_0x515b24];return _0x20de36;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});}exports[_0xef45('0x19')]=function(_0x219778){var _0x3ba1f4=this;return new Promise(function(_0x258785,_0x4ca902){return db['VtigerAccount'][_0xef45('0x1a')]({'raw':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1c')]===undefined?!![]:![]:!![],'where':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x219778['options']?_0x219778[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'limit':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1f')]||null:null,'include':_0x219778['options']?_0x219778[_0xef45('0x1b')]['include']?_['map'](_0x219778[_0xef45('0x1b')][_0xef45('0x20')],function(_0xbb859b){return{'model':db[_0xbb859b[_0xef45('0x21')]],'as':_0xbb859b['as'],'attributes':_0xbb859b[_0xef45('0x1e')],'include':_0xbb859b[_0xef45('0x20')]?_[_0xef45('0x22')](_0xbb859b['include'],function(_0x208b35){return{'model':db[_0x208b35['model']],'as':_0x208b35['as'],'attributes':_0x208b35[_0xef45('0x1e')],'include':_0x208b35[_0xef45('0x20')]?_['map'](_0x208b35[_0xef45('0x20')],function(_0x2c356d){return{'model':db[_0x2c356d['model']],'as':_0x2c356d['as'],'attributes':_0x2c356d[_0xef45('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550e18){logger['info']('GetVtigerAccount',_0x219778);logger[_0xef45('0x10')](_0xef45('0x19'),_0x219778,JSON[_0xef45('0x12')](_0x550e18));_0x258785(_0x550e18);})[_0xef45('0x18')](function(_0x5782d0){logger[_0xef45('0x13')]('GetVtigerAccount',_0x5782d0[_0xef45('0x16')],_0x219778);_0x4ca902(_0x3ba1f4['error'](0x1f4,_0x5782d0[_0xef45('0x16')]));});});};exports['ShowVtigerAccount']=function(_0x575734){var _0x14ce5a=this;return new Promise(function(_0x3e45de,_0x390a7a){return db[_0xef45('0x23')][_0xef45('0x24')]({'raw':_0x575734['options']?_0x575734['options']['raw']===undefined?!![]:![]:!![],'where':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'include':_0x575734[_0xef45('0x1b')]?_0x575734['options']['include']?_[_0xef45('0x22')](_0x575734['options'][_0xef45('0x20')],function(_0x5116b0){return{'model':db[_0x5116b0[_0xef45('0x21')]],'as':_0x5116b0['as'],'attributes':_0x5116b0[_0xef45('0x1e')],'include':_0x5116b0[_0xef45('0x20')]?_[_0xef45('0x22')](_0x5116b0[_0xef45('0x20')],function(_0x5b7d73){return{'model':db[_0x5b7d73[_0xef45('0x21')]],'as':_0x5b7d73['as'],'attributes':_0x5b7d73[_0xef45('0x1e')],'include':_0x5b7d73[_0xef45('0x20')]?_['map'](_0x5b7d73['include'],function(_0x787387){return{'model':db[_0x787387[_0xef45('0x21')]],'as':_0x787387['as'],'attributes':_0x787387['attributes']};}):[]};}):[]};}):[]:[]})[_0xef45('0xd')](function(_0x501eb3){logger['info'](_0xef45('0x25'),_0x575734);logger[_0xef45('0x10')](_0xef45('0x25'),_0x575734,JSON['stringify'](_0x501eb3));_0x3e45de(_0x501eb3);})[_0xef45('0x18')](function(_0x3a1bcc){logger[_0xef45('0x13')](_0xef45('0x25'),_0x3a1bcc['message'],_0x575734);_0x390a7a(_0x14ce5a['error'](0x1f4,_0x3a1bcc[_0xef45('0x16')]));});});}; \ No newline at end of file +var _0x7072=['model','then','ShowVtigerAccount','VtigerAccount','find','map','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','options','raw','where','attributes','limit','include'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x7072,0x138));var _0x2707=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x7072[_0x231e16];return _0x570a7c;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});}exports[_0x2707('0x15')]=function(_0x4a8b7f){var _0x119ac4=this;return new Promise(function(_0x449a61,_0x4009f3){return db['VtigerAccount']['findAll']({'raw':_0x4a8b7f['options']?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x17')]===undefined?!![]:![]:!![],'where':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x18')]||null:null,'attributes':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x19')]||null:null,'limit':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1a')]||null:null,'include':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1b')]?_['map'](_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1b')],function(_0x46259e){return{'model':db[_0x46259e[_0x2707('0x1c')]],'as':_0x46259e['as'],'attributes':_0x46259e[_0x2707('0x19')],'include':_0x46259e[_0x2707('0x1b')]?_['map'](_0x46259e[_0x2707('0x1b')],function(_0x3f6976){return{'model':db[_0x3f6976[_0x2707('0x1c')]],'as':_0x3f6976['as'],'attributes':_0x3f6976[_0x2707('0x19')],'include':_0x3f6976[_0x2707('0x1b')]?_['map'](_0x3f6976[_0x2707('0x1b')],function(_0x4ca05d){return{'model':db[_0x4ca05d[_0x2707('0x1c')]],'as':_0x4ca05d['as'],'attributes':_0x4ca05d[_0x2707('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2707('0x1d')](function(_0x57da26){logger[_0x2707('0xb')](_0x2707('0x15'),_0x4a8b7f);logger[_0x2707('0xe')]('GetVtigerAccount',_0x4a8b7f,JSON[_0x2707('0x10')](_0x57da26));_0x449a61(_0x57da26);})[_0x2707('0x14')](function(_0x4a99ce){logger[_0x2707('0x11')]('GetVtigerAccount',_0x4a99ce['message'],_0x4a8b7f);_0x4009f3(_0x119ac4[_0x2707('0x11')](0x1f4,_0x4a99ce['message']));});});};exports[_0x2707('0x1e')]=function(_0x3f153d){var _0x417a97=this;return new Promise(function(_0x36b2e9,_0x48832b){return db[_0x2707('0x1f')][_0x2707('0x20')]({'raw':_0x3f153d[_0x2707('0x16')]?_0x3f153d[_0x2707('0x16')][_0x2707('0x17')]===undefined?!![]:![]:!![],'where':_0x3f153d[_0x2707('0x16')]?_0x3f153d[_0x2707('0x16')][_0x2707('0x18')]||null:null,'attributes':_0x3f153d[_0x2707('0x16')]?_0x3f153d['options'][_0x2707('0x19')]||null:null,'include':_0x3f153d[_0x2707('0x16')]?_0x3f153d['options']['include']?_['map'](_0x3f153d['options']['include'],function(_0x137e04){return{'model':db[_0x137e04['model']],'as':_0x137e04['as'],'attributes':_0x137e04['attributes'],'include':_0x137e04[_0x2707('0x1b')]?_[_0x2707('0x21')](_0x137e04['include'],function(_0x473954){return{'model':db[_0x473954[_0x2707('0x1c')]],'as':_0x473954['as'],'attributes':_0x473954['attributes'],'include':_0x473954['include']?_[_0x2707('0x21')](_0x473954[_0x2707('0x1b')],function(_0x521edb){return{'model':db[_0x521edb['model']],'as':_0x521edb['as'],'attributes':_0x521edb[_0x2707('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2707('0x1d')](function(_0x5a18b0){logger[_0x2707('0xb')](_0x2707('0x1e'),_0x3f153d);logger[_0x2707('0xe')](_0x2707('0x1e'),_0x3f153d,JSON[_0x2707('0x10')](_0x5a18b0));_0x36b2e9(_0x5a18b0);})[_0x2707('0x14')](function(_0x5bd2e5){logger[_0x2707('0x11')](_0x2707('0x1e'),_0x5bd2e5[_0x2707('0x13')],_0x3f153d);_0x48832b(_0x417a97[_0x2707('0x11')](0x1f4,_0x5bd2e5[_0x2707('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6f858e5..f03bbc6 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 _0x98cd=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','create','update','delete','destroy','exports'];(function(_0x1502e3,_0x5aeca5){var _0x19b624=function(_0xda2557){while(--_0xda2557){_0x1502e3['push'](_0x1502e3['shift']());}};_0x19b624(++_0x5aeca5);}(_0x98cd,0x130));var _0xd98c=function(_0x2dcca6,_0x29a8a6){_0x2dcca6=_0x2dcca6-0x0;var _0x512333=_0x98cd[_0x2dcca6];return _0x512333;};'use strict';var multer=require('multer');var util=require(_0xd98c('0x0'));var path=require(_0xd98c('0x1'));var timeout=require(_0xd98c('0x2'));var express=require(_0xd98c('0x3'));var router=express['Router']();var fs_extra=require(_0xd98c('0x4'));var auth=require(_0xd98c('0x5'));var interaction=require(_0xd98c('0x6'));var config=require('../../config/environment');var controller=require(_0xd98c('0x7'));router[_0xd98c('0x8')]('/',auth[_0xd98c('0x9')](),controller[_0xd98c('0xa')]);router[_0xd98c('0x8')](_0xd98c('0xb'),auth['isAuthenticated'](),controller[_0xd98c('0xc')]);router[_0xd98c('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0xd98c('0xd'),auth[_0xd98c('0x9')](),controller['getSubjects']);router[_0xd98c('0x8')]('/:id/descriptions',auth[_0xd98c('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xd98c('0x9')](),controller[_0xd98c('0xe')]);router['put'](_0xd98c('0xb'),auth[_0xd98c('0x9')](),controller[_0xd98c('0xf')]);router[_0xd98c('0x10')](_0xd98c('0xb'),auth[_0xd98c('0x9')](),controller[_0xd98c('0x11')]);module[_0xd98c('0x12')]=router; \ No newline at end of file +var _0x49c1=['fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x444a08,_0x55bbf7){var _0x3440ae=function(_0x49c24e){while(--_0x49c24e){_0x444a08['push'](_0x444a08['shift']());}};_0x3440ae(++_0x55bbf7);}(_0x49c1,0xff));var _0x149c=function(_0x1753db,_0x38ec8c){_0x1753db=_0x1753db-0x0;var _0xd90cfb=_0x49c1[_0x1753db];return _0xd90cfb;};'use strict';var multer=require(_0x149c('0x0'));var util=require(_0x149c('0x1'));var path=require(_0x149c('0x2'));var timeout=require('connect-timeout');var express=require(_0x149c('0x3'));var router=express[_0x149c('0x4')]();var fs_extra=require(_0x149c('0x5'));var auth=require(_0x149c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x149c('0x7'));router[_0x149c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x149c('0x9')](),controller['show']);router[_0x149c('0x8')](_0x149c('0xa'),auth[_0x149c('0x9')](),controller[_0x149c('0xb')]);router['get'](_0x149c('0xc'),auth[_0x149c('0x9')](),controller['getSubjects']);router['get'](_0x149c('0xd'),auth[_0x149c('0x9')](),controller[_0x149c('0xe')]);router[_0x149c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x149c('0x10')]('/:id',auth[_0x149c('0x9')](),controller[_0x149c('0x11')]);router[_0x149c('0x12')]('/:id',auth[_0x149c('0x9')](),controller['destroy']);module[_0x149c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 07f9fa1..9505f74 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 _0x2aa5=['STRING','sequelize','exports'];(function(_0x47e1f2,_0x31f86a){var _0x2ff5ec=function(_0x2ee3b2){while(--_0x2ee3b2){_0x47e1f2['push'](_0x47e1f2['shift']());}};_0x2ff5ec(++_0x31f86a);}(_0x2aa5,0x82));var _0x52aa=function(_0x12d6ad,_0x2a179e){_0x12d6ad=_0x12d6ad-0x0;var _0xdcc5a8=_0x2aa5[_0x12d6ad];return _0xdcc5a8;};'use strict';var Sequelize=require(_0x52aa('0x0'));module[_0x52aa('0x1')]={'name':{'type':Sequelize[_0x52aa('0x2')]},'description':{'type':Sequelize[_0x52aa('0x2')]}}; \ No newline at end of file +var _0xa412=['sequelize','STRING'];(function(_0x857282,_0x396f1a){var _0x412164=function(_0x1a31c1){while(--_0x1a31c1){_0x857282['push'](_0x857282['shift']());}};_0x412164(++_0x396f1a);}(_0xa412,0x1c2));var _0x2a41=function(_0x368772,_0x59ae74){_0x368772=_0x368772-0x0;var _0x1acd0d=_0xa412[_0x368772];return _0x1acd0d;};'use strict';var Sequelize=require(_0x2a41('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a41('0x1')]},'description':{'type':Sequelize[_0x2a41('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 6922069..a5513eb 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 _0x0044=['includeAll','options','find','create','update','body','getFields','findOne','VtigerField','filter','getSubjects','params','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','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','then','destroy','stack','name','send','map','rawAttributes','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VtigerConfiguration','include','findAll','catch','keys','intersection'];(function(_0x4499d9,_0x503c15){var _0x3e8837=function(_0x2df45e){while(--_0x2df45e){_0x4499d9['push'](_0x4499d9['shift']());}};_0x3e8837(++_0x503c15);}(_0x0044,0xfa));var _0x4004=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x0044[_0x1b70e3];return _0x1452ab;};'use strict';var emlformat=require(_0x4004('0x0'));var rimraf=require(_0x4004('0x1'));var zipdir=require(_0x4004('0x2'));var jsonpatch=require(_0x4004('0x3'));var rp=require(_0x4004('0x4'));var moment=require(_0x4004('0x5'));var BPromise=require(_0x4004('0x6'));var Mustache=require(_0x4004('0x7'));var util=require(_0x4004('0x8'));var path=require(_0x4004('0x9'));var sox=require(_0x4004('0xa'));var csv=require(_0x4004('0xb'));var ejs=require(_0x4004('0xc'));var fs=require('fs');var fs_extra=require(_0x4004('0xd'));var _=require(_0x4004('0xe'));var squel=require(_0x4004('0xf'));var crypto=require(_0x4004('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4004('0xb'));var querystring=require(_0x4004('0x11'));var Papa=require(_0x4004('0x12'));var Redis=require(_0x4004('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4004('0x14'));var as=require(_0x4004('0x15'));var hardwareService=require(_0x4004('0x16'));var logger=require(_0x4004('0x17'))('api');var utils=require(_0x4004('0x18'));var config=require(_0x4004('0x19'));var licenseUtil=require(_0x4004('0x1a'));var db=require(_0x4004('0x1b'))['db'];function respondWithStatusCode(_0xee1868,_0x26862f){_0x26862f=_0x26862f||0xcc;return function(_0x185dec){if(_0x185dec){return _0xee1868[_0x4004('0x1c')](_0x26862f);}return _0xee1868[_0x4004('0x1d')](_0x26862f)[_0x4004('0x1e')]();};}function respondWithResult(_0x4463e3,_0xdd3a59){_0xdd3a59=_0xdd3a59||0xc8;return function(_0x313fac){if(_0x313fac){return _0x4463e3[_0x4004('0x1d')](_0xdd3a59)[_0x4004('0x1f')](_0x313fac);}};}function respondWithFilteredResult(_0xf9059e,_0x1e4432){return function(_0x40a675){if(_0x40a675){var _0x56e01c=typeof _0x1e4432['offset']===_0x4004('0x20')&&typeof _0x1e4432['limit']===_0x4004('0x20');var _0x1589a1=_0x40a675['count'];var _0x50b78e=_0x56e01c?0x0:_0x1e4432[_0x4004('0x21')];var _0x39fbd9=_0x56e01c?_0x40a675[_0x4004('0x22')]:_0x1e4432[_0x4004('0x21')]+_0x1e4432[_0x4004('0x23')];var _0x1e785a;if(_0x39fbd9>=_0x1589a1){_0x39fbd9=_0x1589a1;_0x1e785a=0xc8;}else{_0x1e785a=0xce;}_0xf9059e[_0x4004('0x1d')](_0x1e785a);return _0xf9059e[_0x4004('0x24')](_0x4004('0x25'),_0x50b78e+'-'+_0x39fbd9+'/'+_0x1589a1)['json'](_0x40a675);}return null;};}function patchUpdates(_0x3a0752){return function(_0x4be1f4){try{jsonpatch[_0x4004('0x26')](_0x4be1f4,_0x3a0752,!![]);}catch(_0x391f2f){return BPromise['reject'](_0x391f2f);}return _0x4be1f4['save']();};}function saveUpdates(_0x1e89f3,_0x2db069){return function(_0x400c33){if(_0x400c33){return _0x400c33['update'](_0x1e89f3)[_0x4004('0x27')](function(_0x4256d7){return _0x4256d7;});}return null;};}function removeEntity(_0x7a99a8,_0x3af87d){return function(_0xdf24db){if(_0xdf24db){return _0xdf24db[_0x4004('0x28')]()['then'](function(){_0x7a99a8[_0x4004('0x1d')](0xcc)[_0x4004('0x1e')]();});}};}function handleEntityNotFound(_0x213f6a,_0x3f212c){return function(_0x424dc0){if(!_0x424dc0){_0x213f6a[_0x4004('0x1c')](0x194);}return _0x424dc0;};}function handleError(_0x29f88f,_0xbd5b82){_0xbd5b82=_0xbd5b82||0x1f4;return function(_0x2052aa){logger['error'](_0x2052aa[_0x4004('0x29')]);if(_0x2052aa['name']){delete _0x2052aa[_0x4004('0x2a')];}_0x29f88f[_0x4004('0x1d')](_0xbd5b82)[_0x4004('0x2b')](_0x2052aa);};}exports['index']=function(_0x3dc825,_0x400190){var _0x58638f={},_0x10cb2d={},_0x2da3c8={'count':0x0,'rows':[]};var _0x5f22ab=_[_0x4004('0x2c')](db['VtigerConfiguration'][_0x4004('0x2d')],function(_0x2e1b63){return{'name':_0x2e1b63['fieldName'],'type':_0x2e1b63[_0x4004('0x2e')]['key']};});_0x10cb2d[_0x4004('0x2f')]=_[_0x4004('0x2c')](_0x5f22ab,_0x4004('0x2a'));_0x10cb2d[_0x4004('0x30')]=_['keys'](_0x3dc825[_0x4004('0x30')]);_0x10cb2d[_0x4004('0x31')]=_['intersection'](_0x10cb2d[_0x4004('0x2f')],_0x10cb2d[_0x4004('0x30')]);_0x58638f[_0x4004('0x32')]=_['intersection'](_0x10cb2d[_0x4004('0x2f')],qs[_0x4004('0x33')](_0x3dc825[_0x4004('0x30')][_0x4004('0x33')]));_0x58638f[_0x4004('0x32')]=_0x58638f[_0x4004('0x32')][_0x4004('0x34')]?_0x58638f[_0x4004('0x32')]:_0x10cb2d['model'];if(!_0x3dc825[_0x4004('0x30')][_0x4004('0x35')](_0x4004('0x36'))){_0x58638f[_0x4004('0x23')]=qs[_0x4004('0x23')](_0x3dc825[_0x4004('0x30')]['limit']);_0x58638f[_0x4004('0x21')]=qs[_0x4004('0x21')](_0x3dc825[_0x4004('0x30')][_0x4004('0x21')]);}_0x58638f[_0x4004('0x37')]=qs[_0x4004('0x38')](_0x3dc825[_0x4004('0x30')]['sort']);_0x58638f[_0x4004('0x39')]=qs['filters'](_[_0x4004('0x3a')](_0x3dc825[_0x4004('0x30')],_0x10cb2d[_0x4004('0x31')]),_0x5f22ab);if(_0x3dc825['query']['filter']){_0x58638f[_0x4004('0x39')]=_[_0x4004('0x3b')](_0x58638f[_0x4004('0x39')],{'$or':_[_0x4004('0x2c')](_0x5f22ab,function(_0x2d0bc3){if(_0x2d0bc3[_0x4004('0x2e')]!=='VIRTUAL'){var _0x161868={};_0x161868[_0x2d0bc3[_0x4004('0x2a')]]={'$like':'%'+_0x3dc825['query']['filter']+'%'};return _0x161868;}})});}_0x58638f=_['merge']({},_0x58638f,_0x3dc825['options']);var _0x142f6c={'where':_0x58638f[_0x4004('0x39')]};return db[_0x4004('0x3c')][_0x4004('0x22')](_0x142f6c)['then'](function(_0x9b9559){_0x2da3c8[_0x4004('0x22')]=_0x9b9559;if(_0x3dc825[_0x4004('0x30')]['includeAll']){_0x58638f[_0x4004('0x3d')]=[{'all':!![]}];}return db[_0x4004('0x3c')][_0x4004('0x3e')](_0x58638f);})[_0x4004('0x27')](function(_0x477f4e){_0x2da3c8['rows']=_0x477f4e;return _0x2da3c8;})['then'](respondWithFilteredResult(_0x400190,_0x58638f))[_0x4004('0x3f')](handleError(_0x400190,null));};exports['show']=function(_0x53bca7,_0x3a25ac){var _0x2fdc5a={'raw':![],'where':{'id':_0x53bca7['params']['id']}},_0x401e7b={};_0x401e7b[_0x4004('0x2f')]=_[_0x4004('0x40')](db[_0x4004('0x3c')][_0x4004('0x2d')]);_0x401e7b[_0x4004('0x30')]=_[_0x4004('0x40')](_0x53bca7['query']);_0x401e7b[_0x4004('0x31')]=_[_0x4004('0x41')](_0x401e7b[_0x4004('0x2f')],_0x401e7b[_0x4004('0x30')]);_0x2fdc5a['attributes']=_[_0x4004('0x41')](_0x401e7b[_0x4004('0x2f')],qs[_0x4004('0x33')](_0x53bca7[_0x4004('0x30')][_0x4004('0x33')]));_0x2fdc5a['attributes']=_0x2fdc5a['attributes'][_0x4004('0x34')]?_0x2fdc5a[_0x4004('0x32')]:_0x401e7b[_0x4004('0x2f')];if(_0x53bca7['query'][_0x4004('0x42')]){_0x2fdc5a[_0x4004('0x3d')]=[{'all':!![]}];}_0x2fdc5a=_[_0x4004('0x3b')]({},_0x2fdc5a,_0x53bca7[_0x4004('0x43')]);return db[_0x4004('0x3c')][_0x4004('0x44')](_0x2fdc5a)[_0x4004('0x27')](handleEntityNotFound(_0x3a25ac,null))[_0x4004('0x27')](respondWithResult(_0x3a25ac,null))['catch'](handleError(_0x3a25ac,null));};exports[_0x4004('0x45')]=function(_0x591acf,_0x4e138a){return db['VtigerConfiguration']['create'](_0x591acf['body'],{})[_0x4004('0x27')](respondWithResult(_0x4e138a,0xc9))[_0x4004('0x3f')](handleError(_0x4e138a,null));};exports[_0x4004('0x46')]=function(_0x5b69f4,_0x597385){if(_0x5b69f4[_0x4004('0x47')]['id']){delete _0x5b69f4['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x5b69f4['params']['id']}})['then'](handleEntityNotFound(_0x597385,null))[_0x4004('0x27')](saveUpdates(_0x5b69f4[_0x4004('0x47')],null))[_0x4004('0x27')](respondWithResult(_0x597385,null))[_0x4004('0x3f')](handleError(_0x597385,null));};exports[_0x4004('0x28')]=function(_0x1831ae,_0x2b33e3){return db[_0x4004('0x3c')][_0x4004('0x44')]({'where':{'id':_0x1831ae['params']['id']}})[_0x4004('0x27')](handleEntityNotFound(_0x2b33e3,null))[_0x4004('0x27')](removeEntity(_0x2b33e3,null))[_0x4004('0x3f')](handleError(_0x2b33e3,null));};exports[_0x4004('0x48')]=function(_0x1814ec,_0x5030dd,_0x46b589){var _0x5c54d5={};var _0x5b2cd6={};var _0x3ab330;var _0x22182e;return db[_0x4004('0x3c')][_0x4004('0x49')]({'where':{'id':_0x1814ec['params']['id']}})[_0x4004('0x27')](handleEntityNotFound(_0x5030dd,null))['then'](function(_0x5a41be){if(_0x5a41be){_0x3ab330=_0x5a41be;_0x5b2cd6[_0x4004('0x2f')]=_[_0x4004('0x40')](db[_0x4004('0x4a')]['rawAttributes']);_0x5b2cd6[_0x4004('0x30')]=_[_0x4004('0x40')](_0x1814ec[_0x4004('0x30')]);_0x5b2cd6[_0x4004('0x31')]=_[_0x4004('0x41')](_0x5b2cd6['model'],_0x5b2cd6[_0x4004('0x30')]);_0x5c54d5[_0x4004('0x32')]=_[_0x4004('0x41')](_0x5b2cd6[_0x4004('0x2f')],qs[_0x4004('0x33')](_0x1814ec[_0x4004('0x30')][_0x4004('0x33')]));_0x5c54d5['attributes']=_0x5c54d5['attributes'][_0x4004('0x34')]?_0x5c54d5[_0x4004('0x32')]:_0x5b2cd6[_0x4004('0x2f')];_0x5c54d5['order']=qs[_0x4004('0x38')](_0x1814ec['query'][_0x4004('0x38')]);_0x5c54d5[_0x4004('0x39')]=qs['filters'](_[_0x4004('0x3a')](_0x1814ec['query'],_0x5b2cd6[_0x4004('0x31')]));if(_0x1814ec[_0x4004('0x30')][_0x4004('0x4b')]){_0x5c54d5[_0x4004('0x39')]=_['merge'](_0x5c54d5[_0x4004('0x39')],{'$or':_['map'](_0x5c54d5['attributes'],function(_0x20d4f7){var _0x22c589={};_0x22c589[_0x20d4f7]={'$like':'%'+_0x1814ec[_0x4004('0x30')]['filter']+'%'};return _0x22c589;})});}_0x5c54d5=_[_0x4004('0x3b')]({},_0x5c54d5,_0x1814ec[_0x4004('0x43')]);return _0x3ab330[_0x4004('0x48')](_0x5c54d5);}})[_0x4004('0x27')](function(_0x3c0e28){if(_0x3c0e28){_0x22182e=_0x3c0e28[_0x4004('0x34')];if(!_0x1814ec[_0x4004('0x30')][_0x4004('0x35')](_0x4004('0x36'))){_0x5c54d5[_0x4004('0x23')]=qs['limit'](_0x1814ec['query']['limit']);_0x5c54d5[_0x4004('0x21')]=qs[_0x4004('0x21')](_0x1814ec[_0x4004('0x30')][_0x4004('0x21')]);}return _0x3ab330[_0x4004('0x48')](_0x5c54d5);}})[_0x4004('0x27')](function(_0x3a1eb9){if(_0x3a1eb9){return _0x3a1eb9?{'count':_0x22182e,'rows':_0x3a1eb9}:null;}})[_0x4004('0x27')](respondWithResult(_0x5030dd,null))['catch'](handleError(_0x5030dd,null));};exports[_0x4004('0x4c')]=function(_0x51ede7,_0x3664b8,_0x3fc39b){var _0x188f94={};var _0x1b21ae={};var _0xea497b;var _0x2c2b3a;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x51ede7[_0x4004('0x4d')]['id']}})[_0x4004('0x27')](handleEntityNotFound(_0x3664b8,null))[_0x4004('0x27')](function(_0x544107){if(_0x544107){_0xea497b=_0x544107;_0x1b21ae[_0x4004('0x2f')]=_[_0x4004('0x40')](db[_0x4004('0x4a')][_0x4004('0x2d')]);_0x1b21ae[_0x4004('0x30')]=_[_0x4004('0x40')](_0x51ede7[_0x4004('0x30')]);_0x1b21ae[_0x4004('0x31')]=_[_0x4004('0x41')](_0x1b21ae['model'],_0x1b21ae[_0x4004('0x30')]);_0x188f94['attributes']=_[_0x4004('0x41')](_0x1b21ae[_0x4004('0x2f')],qs[_0x4004('0x33')](_0x51ede7[_0x4004('0x30')][_0x4004('0x33')]));_0x188f94[_0x4004('0x32')]=_0x188f94['attributes'][_0x4004('0x34')]?_0x188f94[_0x4004('0x32')]:_0x1b21ae['model'];_0x188f94[_0x4004('0x37')]=qs[_0x4004('0x38')](_0x51ede7['query'][_0x4004('0x38')]);_0x188f94[_0x4004('0x39')]=qs['filters'](_[_0x4004('0x3a')](_0x51ede7[_0x4004('0x30')],_0x1b21ae['filters']));if(_0x51ede7[_0x4004('0x30')][_0x4004('0x4b')]){_0x188f94[_0x4004('0x39')]=_[_0x4004('0x3b')](_0x188f94[_0x4004('0x39')],{'$or':_['map'](_0x188f94[_0x4004('0x32')],function(_0x4abc0d){var _0x4eb72d={};_0x4eb72d[_0x4abc0d]={'$like':'%'+_0x51ede7['query']['filter']+'%'};return _0x4eb72d;})});}_0x188f94=_[_0x4004('0x3b')]({},_0x188f94,_0x51ede7[_0x4004('0x43')]);return _0xea497b['getSubjects'](_0x188f94);}})[_0x4004('0x27')](function(_0x280780){if(_0x280780){_0x2c2b3a=_0x280780[_0x4004('0x34')];if(!_0x51ede7['query'][_0x4004('0x35')]('nolimit')){_0x188f94[_0x4004('0x23')]=qs[_0x4004('0x23')](_0x51ede7[_0x4004('0x30')]['limit']);_0x188f94[_0x4004('0x21')]=qs['offset'](_0x51ede7[_0x4004('0x30')][_0x4004('0x21')]);}return _0xea497b[_0x4004('0x4c')](_0x188f94);}})[_0x4004('0x27')](function(_0x44fba1){if(_0x44fba1){return _0x44fba1?{'count':_0x2c2b3a,'rows':_0x44fba1}:null;}})[_0x4004('0x27')](respondWithResult(_0x3664b8,null))['catch'](handleError(_0x3664b8,null));};exports[_0x4004('0x4e')]=function(_0x5a1fda,_0x713a81,_0x444815){var _0x5961ea={};var _0xd10529={};var _0x16106f;var _0x307f1b;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x5a1fda[_0x4004('0x4d')]['id']}})[_0x4004('0x27')](handleEntityNotFound(_0x713a81,null))[_0x4004('0x27')](function(_0x11a555){if(_0x11a555){_0x16106f=_0x11a555;_0xd10529[_0x4004('0x2f')]=_[_0x4004('0x40')](db['VtigerField'][_0x4004('0x2d')]);_0xd10529['query']=_[_0x4004('0x40')](_0x5a1fda[_0x4004('0x30')]);_0xd10529[_0x4004('0x31')]=_[_0x4004('0x41')](_0xd10529['model'],_0xd10529['query']);_0x5961ea[_0x4004('0x32')]=_[_0x4004('0x41')](_0xd10529['model'],qs['fields'](_0x5a1fda[_0x4004('0x30')]['fields']));_0x5961ea[_0x4004('0x32')]=_0x5961ea['attributes']['length']?_0x5961ea[_0x4004('0x32')]:_0xd10529[_0x4004('0x2f')];_0x5961ea[_0x4004('0x37')]=qs[_0x4004('0x38')](_0x5a1fda[_0x4004('0x30')][_0x4004('0x38')]);_0x5961ea[_0x4004('0x39')]=qs[_0x4004('0x31')](_[_0x4004('0x3a')](_0x5a1fda['query'],_0xd10529[_0x4004('0x31')]));if(_0x5a1fda[_0x4004('0x30')][_0x4004('0x4b')]){_0x5961ea[_0x4004('0x39')]=_[_0x4004('0x3b')](_0x5961ea['where'],{'$or':_[_0x4004('0x2c')](_0x5961ea[_0x4004('0x32')],function(_0x1fce5b){var _0x178f29={};_0x178f29[_0x1fce5b]={'$like':'%'+_0x5a1fda[_0x4004('0x30')][_0x4004('0x4b')]+'%'};return _0x178f29;})});}_0x5961ea=_['merge']({},_0x5961ea,_0x5a1fda[_0x4004('0x43')]);return _0x16106f[_0x4004('0x4e')](_0x5961ea);}})[_0x4004('0x27')](function(_0x3ebceb){if(_0x3ebceb){_0x307f1b=_0x3ebceb['length'];if(!_0x5a1fda[_0x4004('0x30')][_0x4004('0x35')](_0x4004('0x36'))){_0x5961ea[_0x4004('0x23')]=qs[_0x4004('0x23')](_0x5a1fda[_0x4004('0x30')]['limit']);_0x5961ea[_0x4004('0x21')]=qs[_0x4004('0x21')](_0x5a1fda[_0x4004('0x30')][_0x4004('0x21')]);}return _0x16106f['getDescriptions'](_0x5961ea);}})['then'](function(_0x285884){if(_0x285884){return _0x285884?{'count':_0x307f1b,'rows':_0x285884}:null;}})[_0x4004('0x27')](respondWithResult(_0x713a81,null))['catch'](handleError(_0x713a81,null));}; \ No newline at end of file +var _0xa1aa=['json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','name','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','update','getFields','findOne','VtigerField','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1aa,0x81));var _0xaa1a=function(_0x419722,_0x43ced3){_0x419722=_0x419722-0x0;var _0x45fbee=_0xa1aa[_0x419722];return _0x45fbee;};'use strict';var emlformat=require(_0xaa1a('0x0'));var rimraf=require(_0xaa1a('0x1'));var zipdir=require(_0xaa1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa1a('0x3'));var moment=require(_0xaa1a('0x4'));var BPromise=require(_0xaa1a('0x5'));var Mustache=require(_0xaa1a('0x6'));var util=require(_0xaa1a('0x7'));var path=require('path');var sox=require(_0xaa1a('0x8'));var csv=require(_0xaa1a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa1a('0xa'));var _=require(_0xaa1a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaa1a('0xc'));var deskjs=require(_0xaa1a('0xd'));var toCsv=require(_0xaa1a('0x9'));var querystring=require('querystring');var Papa=require(_0xaa1a('0xe'));var Redis=require(_0xaa1a('0xf'));var authService=require(_0xaa1a('0x10'));var qs=require(_0xaa1a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa1a('0x12'));var logger=require(_0xaa1a('0x13'))(_0xaa1a('0x14'));var utils=require(_0xaa1a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa1a('0x16'))['db'];function respondWithStatusCode(_0x11c5cf,_0x58a39e){_0x58a39e=_0x58a39e||0xcc;return function(_0x5e978e){if(_0x5e978e){return _0x11c5cf[_0xaa1a('0x17')](_0x58a39e);}return _0x11c5cf['status'](_0x58a39e)['end']();};}function respondWithResult(_0x4c80ef,_0x535d7d){_0x535d7d=_0x535d7d||0xc8;return function(_0x4c152c){if(_0x4c152c){return _0x4c80ef[_0xaa1a('0x18')](_0x535d7d)[_0xaa1a('0x19')](_0x4c152c);}};}function respondWithFilteredResult(_0x4d619c,_0x49b190){return function(_0x615231){if(_0x615231){var _0x47e263=typeof _0x49b190[_0xaa1a('0x1a')]===_0xaa1a('0x1b')&&typeof _0x49b190[_0xaa1a('0x1c')]===_0xaa1a('0x1b');var _0x166a23=_0x615231[_0xaa1a('0x1d')];var _0x5e9e97=_0x47e263?0x0:_0x49b190[_0xaa1a('0x1a')];var _0x18571d=_0x47e263?_0x615231[_0xaa1a('0x1d')]:_0x49b190[_0xaa1a('0x1a')]+_0x49b190[_0xaa1a('0x1c')];var _0x2b165c;if(_0x18571d>=_0x166a23){_0x18571d=_0x166a23;_0x2b165c=0xc8;}else{_0x2b165c=0xce;}_0x4d619c[_0xaa1a('0x18')](_0x2b165c);return _0x4d619c['set'](_0xaa1a('0x1e'),_0x5e9e97+'-'+_0x18571d+'/'+_0x166a23)[_0xaa1a('0x19')](_0x615231);}return null;};}function patchUpdates(_0x5b0f2f){return function(_0x43c9ba){try{jsonpatch[_0xaa1a('0x1f')](_0x43c9ba,_0x5b0f2f,!![]);}catch(_0x97f631){return BPromise[_0xaa1a('0x20')](_0x97f631);}return _0x43c9ba['save']();};}function saveUpdates(_0x218155,_0x475bdb){return function(_0x259669){if(_0x259669){return _0x259669['update'](_0x218155)[_0xaa1a('0x21')](function(_0x4a75dd){return _0x4a75dd;});}return null;};}function removeEntity(_0x1cf05b,_0x52763e){return function(_0x78c1fa){if(_0x78c1fa){return _0x78c1fa[_0xaa1a('0x22')]()['then'](function(){_0x1cf05b[_0xaa1a('0x18')](0xcc)[_0xaa1a('0x23')]();});}};}function handleEntityNotFound(_0x22cffe,_0x1ee88f){return function(_0x3b931e){if(!_0x3b931e){_0x22cffe[_0xaa1a('0x17')](0x194);}return _0x3b931e;};}function handleError(_0x5aacec,_0x4b99c1){_0x4b99c1=_0x4b99c1||0x1f4;return function(_0x5abcd6){logger[_0xaa1a('0x24')](_0x5abcd6['stack']);if(_0x5abcd6[_0xaa1a('0x25')]){delete _0x5abcd6[_0xaa1a('0x25')];}_0x5aacec[_0xaa1a('0x18')](_0x4b99c1)['send'](_0x5abcd6);};}exports[_0xaa1a('0x26')]=function(_0x470fcf,_0x39dd97){var _0x591a37={},_0x40d85d={},_0xe959f9={'count':0x0,'rows':[]};var _0x47cc9f=_['map'](db[_0xaa1a('0x27')][_0xaa1a('0x28')],function(_0x583f8f){return{'name':_0x583f8f[_0xaa1a('0x29')],'type':_0x583f8f[_0xaa1a('0x2a')][_0xaa1a('0x2b')]};});_0x40d85d[_0xaa1a('0x2c')]=_[_0xaa1a('0x2d')](_0x47cc9f,'name');_0x40d85d[_0xaa1a('0x2e')]=_[_0xaa1a('0x2f')](_0x470fcf[_0xaa1a('0x2e')]);_0x40d85d['filters']=_[_0xaa1a('0x30')](_0x40d85d[_0xaa1a('0x2c')],_0x40d85d[_0xaa1a('0x2e')]);_0x591a37[_0xaa1a('0x31')]=_[_0xaa1a('0x30')](_0x40d85d[_0xaa1a('0x2c')],qs[_0xaa1a('0x32')](_0x470fcf[_0xaa1a('0x2e')]['fields']));_0x591a37[_0xaa1a('0x31')]=_0x591a37[_0xaa1a('0x31')]['length']?_0x591a37[_0xaa1a('0x31')]:_0x40d85d[_0xaa1a('0x2c')];if(!_0x470fcf['query']['hasOwnProperty']('nolimit')){_0x591a37['limit']=qs[_0xaa1a('0x1c')](_0x470fcf['query'][_0xaa1a('0x1c')]);_0x591a37[_0xaa1a('0x1a')]=qs[_0xaa1a('0x1a')](_0x470fcf[_0xaa1a('0x2e')][_0xaa1a('0x1a')]);}_0x591a37[_0xaa1a('0x33')]=qs[_0xaa1a('0x34')](_0x470fcf[_0xaa1a('0x2e')][_0xaa1a('0x34')]);_0x591a37[_0xaa1a('0x35')]=qs[_0xaa1a('0x36')](_[_0xaa1a('0x37')](_0x470fcf[_0xaa1a('0x2e')],_0x40d85d[_0xaa1a('0x36')]),_0x47cc9f);if(_0x470fcf[_0xaa1a('0x2e')][_0xaa1a('0x38')]){_0x591a37[_0xaa1a('0x35')]=_[_0xaa1a('0x39')](_0x591a37[_0xaa1a('0x35')],{'$or':_[_0xaa1a('0x2d')](_0x47cc9f,function(_0x594be0){if(_0x594be0['type']!==_0xaa1a('0x3a')){var _0x1b55d5={};_0x1b55d5[_0x594be0[_0xaa1a('0x25')]]={'$like':'%'+_0x470fcf['query'][_0xaa1a('0x38')]+'%'};return _0x1b55d5;}})});}_0x591a37=_['merge']({},_0x591a37,_0x470fcf[_0xaa1a('0x3b')]);var _0x415c47={'where':_0x591a37[_0xaa1a('0x35')]};return db[_0xaa1a('0x27')][_0xaa1a('0x1d')](_0x415c47)['then'](function(_0x21ea50){_0xe959f9[_0xaa1a('0x1d')]=_0x21ea50;if(_0x470fcf[_0xaa1a('0x2e')][_0xaa1a('0x3c')]){_0x591a37[_0xaa1a('0x3d')]=[{'all':!![]}];}return db[_0xaa1a('0x27')]['findAll'](_0x591a37);})[_0xaa1a('0x21')](function(_0x247fdc){_0xe959f9[_0xaa1a('0x3e')]=_0x247fdc;return _0xe959f9;})['then'](respondWithFilteredResult(_0x39dd97,_0x591a37))[_0xaa1a('0x3f')](handleError(_0x39dd97,null));};exports[_0xaa1a('0x40')]=function(_0x565dc9,_0x156588){var _0x268948={'raw':![],'where':{'id':_0x565dc9[_0xaa1a('0x41')]['id']}},_0x56fabf={};_0x56fabf[_0xaa1a('0x2c')]=_[_0xaa1a('0x2f')](db[_0xaa1a('0x27')][_0xaa1a('0x28')]);_0x56fabf['query']=_[_0xaa1a('0x2f')](_0x565dc9['query']);_0x56fabf[_0xaa1a('0x36')]=_['intersection'](_0x56fabf[_0xaa1a('0x2c')],_0x56fabf['query']);_0x268948['attributes']=_[_0xaa1a('0x30')](_0x56fabf[_0xaa1a('0x2c')],qs[_0xaa1a('0x32')](_0x565dc9[_0xaa1a('0x2e')]['fields']));_0x268948[_0xaa1a('0x31')]=_0x268948['attributes'][_0xaa1a('0x42')]?_0x268948[_0xaa1a('0x31')]:_0x56fabf[_0xaa1a('0x2c')];if(_0x565dc9['query'][_0xaa1a('0x3c')]){_0x268948[_0xaa1a('0x3d')]=[{'all':!![]}];}_0x268948=_['merge']({},_0x268948,_0x565dc9['options']);return db[_0xaa1a('0x27')][_0xaa1a('0x43')](_0x268948)[_0xaa1a('0x21')](handleEntityNotFound(_0x156588,null))[_0xaa1a('0x21')](respondWithResult(_0x156588,null))['catch'](handleError(_0x156588,null));};exports[_0xaa1a('0x44')]=function(_0x5281a4,_0x51e8ae){return db[_0xaa1a('0x27')][_0xaa1a('0x44')](_0x5281a4['body'],{})[_0xaa1a('0x21')](respondWithResult(_0x51e8ae,0xc9))[_0xaa1a('0x3f')](handleError(_0x51e8ae,null));};exports[_0xaa1a('0x45')]=function(_0x35ac07,_0x932673){if(_0x35ac07['body']['id']){delete _0x35ac07['body']['id'];}return db[_0xaa1a('0x27')][_0xaa1a('0x43')]({'where':{'id':_0x35ac07['params']['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x932673,null))[_0xaa1a('0x21')](saveUpdates(_0x35ac07['body'],null))[_0xaa1a('0x21')](respondWithResult(_0x932673,null))['catch'](handleError(_0x932673,null));};exports[_0xaa1a('0x22')]=function(_0x4de0b3,_0x28a485){return db[_0xaa1a('0x27')][_0xaa1a('0x43')]({'where':{'id':_0x4de0b3[_0xaa1a('0x41')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x28a485,null))[_0xaa1a('0x21')](removeEntity(_0x28a485,null))['catch'](handleError(_0x28a485,null));};exports[_0xaa1a('0x46')]=function(_0x78a098,_0x27b132,_0x1d1084){var _0x1d0bf5={};var _0x325955={};var _0x6eeb91;var _0x3561b1;return db[_0xaa1a('0x27')][_0xaa1a('0x47')]({'where':{'id':_0x78a098[_0xaa1a('0x41')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x27b132,null))[_0xaa1a('0x21')](function(_0x5b936b){if(_0x5b936b){_0x6eeb91=_0x5b936b;_0x325955[_0xaa1a('0x2c')]=_['keys'](db[_0xaa1a('0x48')][_0xaa1a('0x28')]);_0x325955[_0xaa1a('0x2e')]=_[_0xaa1a('0x2f')](_0x78a098['query']);_0x325955[_0xaa1a('0x36')]=_['intersection'](_0x325955[_0xaa1a('0x2c')],_0x325955[_0xaa1a('0x2e')]);_0x1d0bf5['attributes']=_[_0xaa1a('0x30')](_0x325955[_0xaa1a('0x2c')],qs[_0xaa1a('0x32')](_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0x1d0bf5[_0xaa1a('0x31')]=_0x1d0bf5[_0xaa1a('0x31')][_0xaa1a('0x42')]?_0x1d0bf5[_0xaa1a('0x31')]:_0x325955['model'];_0x1d0bf5[_0xaa1a('0x33')]=qs[_0xaa1a('0x34')](_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x34')]);_0x1d0bf5[_0xaa1a('0x35')]=qs[_0xaa1a('0x36')](_[_0xaa1a('0x37')](_0x78a098[_0xaa1a('0x2e')],_0x325955[_0xaa1a('0x36')]));if(_0x78a098[_0xaa1a('0x2e')]['filter']){_0x1d0bf5['where']=_[_0xaa1a('0x39')](_0x1d0bf5['where'],{'$or':_[_0xaa1a('0x2d')](_0x1d0bf5['attributes'],function(_0x14d842){var _0x2a7f03={};_0x2a7f03[_0x14d842]={'$like':'%'+_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x38')]+'%'};return _0x2a7f03;})});}_0x1d0bf5=_['merge']({},_0x1d0bf5,_0x78a098[_0xaa1a('0x3b')]);return _0x6eeb91[_0xaa1a('0x46')](_0x1d0bf5);}})[_0xaa1a('0x21')](function(_0x17f324){if(_0x17f324){_0x3561b1=_0x17f324['length'];if(!_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x49')](_0xaa1a('0x4a'))){_0x1d0bf5[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x1c')]);_0x1d0bf5[_0xaa1a('0x1a')]=qs[_0xaa1a('0x1a')](_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x1a')]);}return _0x6eeb91[_0xaa1a('0x46')](_0x1d0bf5);}})['then'](function(_0x2fd2c2){if(_0x2fd2c2){return _0x2fd2c2?{'count':_0x3561b1,'rows':_0x2fd2c2}:null;}})['then'](respondWithResult(_0x27b132,null))[_0xaa1a('0x3f')](handleError(_0x27b132,null));};exports[_0xaa1a('0x4b')]=function(_0x3930f2,_0x557134,_0x1534a8){var _0x12a912={};var _0xa20561={};var _0x1aa866;var _0x504f5d;return db['VtigerConfiguration'][_0xaa1a('0x47')]({'where':{'id':_0x3930f2['params']['id']}})['then'](handleEntityNotFound(_0x557134,null))[_0xaa1a('0x21')](function(_0x2bfd8e){if(_0x2bfd8e){_0x1aa866=_0x2bfd8e;_0xa20561[_0xaa1a('0x2c')]=_['keys'](db[_0xaa1a('0x48')]['rawAttributes']);_0xa20561[_0xaa1a('0x2e')]=_[_0xaa1a('0x2f')](_0x3930f2[_0xaa1a('0x2e')]);_0xa20561[_0xaa1a('0x36')]=_[_0xaa1a('0x30')](_0xa20561[_0xaa1a('0x2c')],_0xa20561[_0xaa1a('0x2e')]);_0x12a912[_0xaa1a('0x31')]=_[_0xaa1a('0x30')](_0xa20561[_0xaa1a('0x2c')],qs[_0xaa1a('0x32')](_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0x12a912[_0xaa1a('0x31')]=_0x12a912['attributes']['length']?_0x12a912[_0xaa1a('0x31')]:_0xa20561['model'];_0x12a912['order']=qs[_0xaa1a('0x34')](_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x34')]);_0x12a912[_0xaa1a('0x35')]=qs[_0xaa1a('0x36')](_[_0xaa1a('0x37')](_0x3930f2[_0xaa1a('0x2e')],_0xa20561[_0xaa1a('0x36')]));if(_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x38')]){_0x12a912['where']=_[_0xaa1a('0x39')](_0x12a912[_0xaa1a('0x35')],{'$or':_[_0xaa1a('0x2d')](_0x12a912[_0xaa1a('0x31')],function(_0x9640bf){var _0x1d8054={};_0x1d8054[_0x9640bf]={'$like':'%'+_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x38')]+'%'};return _0x1d8054;})});}_0x12a912=_[_0xaa1a('0x39')]({},_0x12a912,_0x3930f2['options']);return _0x1aa866[_0xaa1a('0x4b')](_0x12a912);}})[_0xaa1a('0x21')](function(_0x3a094d){if(_0x3a094d){_0x504f5d=_0x3a094d[_0xaa1a('0x42')];if(!_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x49')](_0xaa1a('0x4a'))){_0x12a912[_0xaa1a('0x1c')]=qs['limit'](_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x1c')]);_0x12a912[_0xaa1a('0x1a')]=qs[_0xaa1a('0x1a')](_0x3930f2[_0xaa1a('0x2e')]['offset']);}return _0x1aa866['getSubjects'](_0x12a912);}})[_0xaa1a('0x21')](function(_0x34adde){if(_0x34adde){return _0x34adde?{'count':_0x504f5d,'rows':_0x34adde}:null;}})[_0xaa1a('0x21')](respondWithResult(_0x557134,null))[_0xaa1a('0x3f')](handleError(_0x557134,null));};exports['getDescriptions']=function(_0x11f4a1,_0x11716b,_0x2e160d){var _0x31c478={};var _0x48d8c2={};var _0x5b6da4;var _0x41144a;return db[_0xaa1a('0x27')][_0xaa1a('0x47')]({'where':{'id':_0x11f4a1[_0xaa1a('0x41')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x11716b,null))['then'](function(_0x5a4e05){if(_0x5a4e05){_0x5b6da4=_0x5a4e05;_0x48d8c2[_0xaa1a('0x2c')]=_[_0xaa1a('0x2f')](db[_0xaa1a('0x48')][_0xaa1a('0x28')]);_0x48d8c2[_0xaa1a('0x2e')]=_[_0xaa1a('0x2f')](_0x11f4a1[_0xaa1a('0x2e')]);_0x48d8c2[_0xaa1a('0x36')]=_[_0xaa1a('0x30')](_0x48d8c2[_0xaa1a('0x2c')],_0x48d8c2[_0xaa1a('0x2e')]);_0x31c478[_0xaa1a('0x31')]=_[_0xaa1a('0x30')](_0x48d8c2[_0xaa1a('0x2c')],qs[_0xaa1a('0x32')](_0x11f4a1[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0x31c478[_0xaa1a('0x31')]=_0x31c478[_0xaa1a('0x31')]['length']?_0x31c478[_0xaa1a('0x31')]:_0x48d8c2[_0xaa1a('0x2c')];_0x31c478[_0xaa1a('0x33')]=qs[_0xaa1a('0x34')](_0x11f4a1[_0xaa1a('0x2e')]['sort']);_0x31c478[_0xaa1a('0x35')]=qs[_0xaa1a('0x36')](_[_0xaa1a('0x37')](_0x11f4a1[_0xaa1a('0x2e')],_0x48d8c2[_0xaa1a('0x36')]));if(_0x11f4a1['query'][_0xaa1a('0x38')]){_0x31c478[_0xaa1a('0x35')]=_[_0xaa1a('0x39')](_0x31c478[_0xaa1a('0x35')],{'$or':_['map'](_0x31c478[_0xaa1a('0x31')],function(_0x2517cb){var _0x316f67={};_0x316f67[_0x2517cb]={'$like':'%'+_0x11f4a1[_0xaa1a('0x2e')]['filter']+'%'};return _0x316f67;})});}_0x31c478=_[_0xaa1a('0x39')]({},_0x31c478,_0x11f4a1['options']);return _0x5b6da4[_0xaa1a('0x4c')](_0x31c478);}})['then'](function(_0xbda37){if(_0xbda37){_0x41144a=_0xbda37[_0xaa1a('0x42')];if(!_0x11f4a1[_0xaa1a('0x2e')][_0xaa1a('0x49')](_0xaa1a('0x4a'))){_0x31c478[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x11f4a1['query']['limit']);_0x31c478[_0xaa1a('0x1a')]=qs[_0xaa1a('0x1a')](_0x11f4a1['query'][_0xaa1a('0x1a')]);}return _0x5b6da4[_0xaa1a('0x4c')](_0x31c478);}})[_0xaa1a('0x21')](function(_0x1a8b39){if(_0x1a8b39){return _0x1a8b39?{'count':_0x41144a,'rows':_0x1a8b39}:null;}})[_0xaa1a('0x21')](respondWithResult(_0x11716b,null))[_0xaa1a('0x3f')](handleError(_0x11716b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 8d4bd26..4586dd9 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 _0x1d21=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','lodash','util'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0x1d21,0xfa));var _0x11d2=function(_0x29733c,_0x2da30b){_0x29733c=_0x29733c-0x0;var _0x49e72f=_0x1d21[_0x29733c];return _0x49e72f;};'use strict';var _=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var logger=require(_0x11d2('0x2'))('api');var moment=require(_0x11d2('0x3'));var BPromise=require(_0x11d2('0x4'));var rp=require(_0x11d2('0x5'));var fs=require('fs');var path=require(_0x11d2('0x6'));var rimraf=require(_0x11d2('0x7'));var config=require(_0x11d2('0x8'));var attributes=require(_0x11d2('0x9'));module[_0x11d2('0xa')]=function(_0x56a350,_0x33148a){return _0x56a350[_0x11d2('0xb')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ae0=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','../../config/logger','moment'];(function(_0x351736,_0x33a314){var _0x4f5a31=function(_0x17f005){while(--_0x17f005){_0x351736['push'](_0x351736['shift']());}};_0x4f5a31(++_0x33a314);}(_0x6ae0,0xe6));var _0x06ae=function(_0x5b9252,_0x4bc2f8){_0x5b9252=_0x5b9252-0x0;var _0x1a4284=_0x6ae0[_0x5b9252];return _0x1a4284;};'use strict';var _=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var logger=require(_0x06ae('0x2'))('api');var moment=require(_0x06ae('0x3'));var BPromise=require(_0x06ae('0x4'));var rp=require(_0x06ae('0x5'));var fs=require('fs');var path=require(_0x06ae('0x6'));var rimraf=require(_0x06ae('0x7'));var config=require(_0x06ae('0x8'));var attributes=require(_0x06ae('0x9'));module[_0x06ae('0xa')]=function(_0x115610,_0x578308){return _0x115610[_0x06ae('0xb')](_0x06ae('0xc'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 0ce1008..f53568a 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 _0x37f1=['VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x17cabc,_0x191c38){var _0x33de1c=function(_0x231acf){while(--_0x231acf){_0x17cabc['push'](_0x17cabc['shift']());}};_0x33de1c(++_0x191c38);}(_0x37f1,0x1c1));var _0x137f=function(_0x5088c9,_0x245e61){_0x5088c9=_0x5088c9-0x0;var _0x12c85e=_0x37f1[_0x5088c9];return _0x12c85e;};'use strict';var _=require(_0x137f('0x0'));var util=require(_0x137f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x137f('0x2'));var fs=require('fs');var Redis=require(_0x137f('0x3'));var db=require(_0x137f('0x4'))['db'];var utils=require(_0x137f('0x5'));var logger=require(_0x137f('0x6'))(_0x137f('0x7'));var config=require(_0x137f('0x8'));var jayson=require(_0x137f('0x9'));var client=jayson[_0x137f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x379364,_0x16a1a0,_0x116267){return new BPromise(function(_0x474da5,_0x3670c1){return client[_0x137f('0xb')](_0x379364,_0x116267)[_0x137f('0xc')](function(_0x736918){logger['info'](_0x137f('0xd'),_0x16a1a0,'request\x20sent');logger[_0x137f('0xe')](_0x137f('0xf'),_0x16a1a0,_0x137f('0x10'),JSON[_0x137f('0x11')](_0x736918));if(_0x736918[_0x137f('0x12')]){if(_0x736918[_0x137f('0x12')]['code']===0x1f4){logger[_0x137f('0x12')](_0x137f('0xd'),_0x16a1a0,_0x736918[_0x137f('0x12')][_0x137f('0x13')]);return _0x3670c1(_0x736918[_0x137f('0x12')][_0x137f('0x13')]);}logger[_0x137f('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x16a1a0,_0x736918['error'][_0x137f('0x13')]);return _0x474da5(_0x736918['error'][_0x137f('0x13')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x16a1a0,'request\x20sent');_0x474da5(_0x736918[_0x137f('0x14')][_0x137f('0x13')]);}})[_0x137f('0x15')](function(_0x60c7a3){logger[_0x137f('0x12')](_0x137f('0xd'),_0x16a1a0,_0x60c7a3);_0x3670c1(_0x60c7a3);});});} \ No newline at end of file +var _0x5ac3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5ac3,0x13d));var _0x35ac=function(_0x426f98,_0x2546da){_0x426f98=_0x426f98-0x0;var _0x525500=_0x5ac3[_0x426f98];return _0x525500;};'use strict';var _=require('lodash');var util=require(_0x35ac('0x0'));var moment=require(_0x35ac('0x1'));var BPromise=require(_0x35ac('0x2'));var rs=require(_0x35ac('0x3'));var fs=require('fs');var Redis=require(_0x35ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x35ac('0x5'));var logger=require(_0x35ac('0x6'))(_0x35ac('0x7'));var config=require(_0x35ac('0x8'));var jayson=require(_0x35ac('0x9'));var client=jayson[_0x35ac('0xa')][_0x35ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x185753,_0x1c28be,_0x17c5a4){return new BPromise(function(_0x37d385,_0x3a6bd0){return client['request'](_0x185753,_0x17c5a4)['then'](function(_0x1557d1){logger[_0x35ac('0xc')](_0x35ac('0xd'),_0x1c28be,_0x35ac('0xe'));logger[_0x35ac('0xf')](_0x35ac('0x10'),_0x1c28be,_0x35ac('0xe'),JSON[_0x35ac('0x11')](_0x1557d1));if(_0x1557d1[_0x35ac('0x12')]){if(_0x1557d1[_0x35ac('0x12')][_0x35ac('0x13')]===0x1f4){logger[_0x35ac('0x12')](_0x35ac('0xd'),_0x1c28be,_0x1557d1[_0x35ac('0x12')][_0x35ac('0x14')]);return _0x3a6bd0(_0x1557d1[_0x35ac('0x12')][_0x35ac('0x14')]);}logger[_0x35ac('0x12')](_0x35ac('0xd'),_0x1c28be,_0x1557d1['error']['message']);return _0x37d385(_0x1557d1[_0x35ac('0x12')][_0x35ac('0x14')]);}else{logger[_0x35ac('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x1c28be,_0x35ac('0xe'));_0x37d385(_0x1557d1[_0x35ac('0x15')]['message']);}})[_0x35ac('0x16')](function(_0x2ef1df){logger[_0x35ac('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x1c28be,_0x2ef1df);_0x3a6bd0(_0x2ef1df);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 66cd1a2..ad39334 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 _0x0c5d=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update'];(function(_0x4ea0f3,_0x50768c){var _0x52f02b=function(_0x45a511){while(--_0x45a511){_0x4ea0f3['push'](_0x4ea0f3['shift']());}};_0x52f02b(++_0x50768c);}(_0x0c5d,0x17d));var _0xd0c5=function(_0x5beb3b,_0x301a74){_0x5beb3b=_0x5beb3b-0x0;var _0x108f38=_0x0c5d[_0x5beb3b];return _0x108f38;};'use strict';var multer=require('multer');var util=require(_0xd0c5('0x0'));var path=require(_0xd0c5('0x1'));var timeout=require(_0xd0c5('0x2'));var express=require(_0xd0c5('0x3'));var router=express[_0xd0c5('0x4')]();var fs_extra=require(_0xd0c5('0x5'));var auth=require(_0xd0c5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0c5('0x7'));var controller=require('./intVtigerField.controller');router[_0xd0c5('0x8')]('/',auth[_0xd0c5('0x9')](),controller[_0xd0c5('0xa')]);router[_0xd0c5('0x8')](_0xd0c5('0xb'),auth[_0xd0c5('0x9')](),controller['show']);router[_0xd0c5('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd0c5('0xd')]('/:id',auth[_0xd0c5('0x9')](),controller[_0xd0c5('0xe')]);router[_0xd0c5('0xf')](_0xd0c5('0xb'),auth[_0xd0c5('0x9')](),controller[_0xd0c5('0x10')]);module[_0xd0c5('0x11')]=router; \ No newline at end of file +var _0x1ec6=['show','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id'];(function(_0x4d3230,_0x26e969){var _0x29dbc7=function(_0x30f47b){while(--_0x30f47b){_0x4d3230['push'](_0x4d3230['shift']());}};_0x29dbc7(++_0x26e969);}(_0x1ec6,0xe9));var _0x61ec=function(_0x51d585,_0x1da116){_0x51d585=_0x51d585-0x0;var _0x362f08=_0x1ec6[_0x51d585];return _0x362f08;};'use strict';var multer=require(_0x61ec('0x0'));var util=require(_0x61ec('0x1'));var path=require(_0x61ec('0x2'));var timeout=require(_0x61ec('0x3'));var express=require(_0x61ec('0x4'));var router=express[_0x61ec('0x5')]();var fs_extra=require(_0x61ec('0x6'));var auth=require(_0x61ec('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x61ec('0x8'));var controller=require(_0x61ec('0x9'));router[_0x61ec('0xa')]('/',auth[_0x61ec('0xb')](),controller[_0x61ec('0xc')]);router[_0x61ec('0xa')](_0x61ec('0xd'),auth[_0x61ec('0xb')](),controller[_0x61ec('0xe')]);router['post']('/',auth[_0x61ec('0xb')](),controller[_0x61ec('0xf')]);router[_0x61ec('0x10')](_0x61ec('0xd'),auth['isAuthenticated'](),controller[_0x61ec('0x11')]);router[_0x61ec('0x12')](_0x61ec('0xd'),auth[_0x61ec('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 085dfaf..4256e50 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 _0x7c74=['string','keyValue','picklist','STRING','variable','customVariable','BOOLEAN','sequelize','ENUM'];(function(_0x43c3f9,_0x1861cb){var _0x4f4f54=function(_0x53ac81){while(--_0x53ac81){_0x43c3f9['push'](_0x43c3f9['shift']());}};_0x4f4f54(++_0x1861cb);}(_0x7c74,0x10c));var _0x47c7=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0x7c74[_0x3b4b1d];return _0x488c36;};'use strict';var Sequelize=require(_0x47c7('0x0'));module['exports']={'type':{'type':Sequelize[_0x47c7('0x1')](_0x47c7('0x2'),'variable','customVariable',_0x47c7('0x3'),_0x47c7('0x4')),'defaultValue':_0x47c7('0x2')},'content':{'type':Sequelize[_0x47c7('0x5')]},'key':{'type':Sequelize[_0x47c7('0x5')]},'keyType':{'type':Sequelize[_0x47c7('0x1')](_0x47c7('0x2'),_0x47c7('0x6'),_0x47c7('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x47c7('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x47c7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x47c7('0x5')]}}; \ No newline at end of file +var _0x8d1b=['keyValue','string','STRING','sequelize','ENUM','variable','customVariable'];(function(_0x24e185,_0x4563bf){var _0x3b1910=function(_0x592bd8){while(--_0x592bd8){_0x24e185['push'](_0x24e185['shift']());}};_0x3b1910(++_0x4563bf);}(_0x8d1b,0x73));var _0xb8d1=function(_0x30e0cc,_0x3dd556){_0x30e0cc=_0x30e0cc-0x0;var _0xb085d7=_0x8d1b[_0x30e0cc];return _0xb085d7;};'use strict';var Sequelize=require(_0xb8d1('0x0'));module['exports']={'type':{'type':Sequelize[_0xb8d1('0x1')]('string',_0xb8d1('0x2'),_0xb8d1('0x3'),_0xb8d1('0x4'),'picklist'),'defaultValue':_0xb8d1('0x5')},'content':{'type':Sequelize[_0xb8d1('0x6')]},'key':{'type':Sequelize[_0xb8d1('0x6')]},'keyType':{'type':Sequelize[_0xb8d1('0x1')](_0xb8d1('0x5'),_0xb8d1('0x2'),_0xb8d1('0x3'))},'keyContent':{'type':Sequelize[_0xb8d1('0x6')]},'idField':{'type':Sequelize[_0xb8d1('0x6')]},'nameField':{'type':Sequelize[_0xb8d1('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb8d1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 50cee7b..625e276 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 _0x19ac=['index','map','VtigerField','rawAttributes','fieldName','type','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send'];(function(_0x14e220,_0x57056){var _0x746d60=function(_0x376042){while(--_0x376042){_0x14e220['push'](_0x14e220['shift']());}};_0x746d60(++_0x57056);}(_0x19ac,0x13f));var _0xc19a=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x19ac[_0x1589dd];return _0x1bddd1;};'use strict';var emlformat=require(_0xc19a('0x0'));var rimraf=require(_0xc19a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc19a('0x2'));var rp=require(_0xc19a('0x3'));var moment=require(_0xc19a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc19a('0x5'));var util=require(_0xc19a('0x6'));var path=require(_0xc19a('0x7'));var sox=require('sox');var csv=require(_0xc19a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc19a('0x9'));var _=require(_0xc19a('0xa'));var squel=require(_0xc19a('0xb'));var crypto=require('crypto');var jsforce=require(_0xc19a('0xc'));var deskjs=require(_0xc19a('0xd'));var toCsv=require(_0xc19a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc19a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc19a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc19a('0x10'))(_0xc19a('0x11'));var utils=require(_0xc19a('0x12'));var config=require(_0xc19a('0x13'));var licenseUtil=require(_0xc19a('0x14'));var db=require(_0xc19a('0x15'))['db'];function respondWithStatusCode(_0x295022,_0x6b2d29){_0x6b2d29=_0x6b2d29||0xcc;return function(_0x5c3d92){if(_0x5c3d92){return _0x295022[_0xc19a('0x16')](_0x6b2d29);}return _0x295022[_0xc19a('0x17')](_0x6b2d29)[_0xc19a('0x18')]();};}function respondWithResult(_0x2842dc,_0x28b71a){_0x28b71a=_0x28b71a||0xc8;return function(_0xf1f0fb){if(_0xf1f0fb){return _0x2842dc[_0xc19a('0x17')](_0x28b71a)[_0xc19a('0x19')](_0xf1f0fb);}};}function respondWithFilteredResult(_0x5266b3,_0x1029ad){return function(_0x37d8e8){if(_0x37d8e8){var _0x11f6c7=typeof _0x1029ad[_0xc19a('0x1a')]==='undefined'&&typeof _0x1029ad['limit']===_0xc19a('0x1b');var _0x1a6b2b=_0x37d8e8[_0xc19a('0x1c')];var _0xa5581f=_0x11f6c7?0x0:_0x1029ad[_0xc19a('0x1a')];var _0x388992=_0x11f6c7?_0x37d8e8[_0xc19a('0x1c')]:_0x1029ad[_0xc19a('0x1a')]+_0x1029ad[_0xc19a('0x1d')];var _0x58a45c;if(_0x388992>=_0x1a6b2b){_0x388992=_0x1a6b2b;_0x58a45c=0xc8;}else{_0x58a45c=0xce;}_0x5266b3['status'](_0x58a45c);return _0x5266b3[_0xc19a('0x1e')](_0xc19a('0x1f'),_0xa5581f+'-'+_0x388992+'/'+_0x1a6b2b)[_0xc19a('0x19')](_0x37d8e8);}return null;};}function patchUpdates(_0x4329e9){return function(_0x301478){try{jsonpatch[_0xc19a('0x20')](_0x301478,_0x4329e9,!![]);}catch(_0x24cb6d){return BPromise[_0xc19a('0x21')](_0x24cb6d);}return _0x301478[_0xc19a('0x22')]();};}function saveUpdates(_0x25169b,_0x4d1a90){return function(_0x1492bb){if(_0x1492bb){return _0x1492bb[_0xc19a('0x23')](_0x25169b)[_0xc19a('0x24')](function(_0x319d56){return _0x319d56;});}return null;};}function removeEntity(_0x2bfb2f,_0x1efb0e){return function(_0x216b47){if(_0x216b47){return _0x216b47[_0xc19a('0x25')]()[_0xc19a('0x24')](function(){_0x2bfb2f[_0xc19a('0x17')](0xcc)[_0xc19a('0x18')]();});}};}function handleEntityNotFound(_0x2573ec,_0x4f4428){return function(_0x493db0){if(!_0x493db0){_0x2573ec['sendStatus'](0x194);}return _0x493db0;};}function handleError(_0x4ee78d,_0x5c60b0){_0x5c60b0=_0x5c60b0||0x1f4;return function(_0x4ce9d5){logger[_0xc19a('0x26')](_0x4ce9d5['stack']);if(_0x4ce9d5[_0xc19a('0x27')]){delete _0x4ce9d5[_0xc19a('0x27')];}_0x4ee78d[_0xc19a('0x17')](_0x5c60b0)[_0xc19a('0x28')](_0x4ce9d5);};}exports[_0xc19a('0x29')]=function(_0x575d74,_0x592238){var _0x497a84={},_0x529056={},_0x29e228={'count':0x0,'rows':[]};var _0x4672ac=_[_0xc19a('0x2a')](db[_0xc19a('0x2b')][_0xc19a('0x2c')],function(_0x26867e){return{'name':_0x26867e[_0xc19a('0x2d')],'type':_0x26867e[_0xc19a('0x2e')]['key']};});_0x529056['model']=_['map'](_0x4672ac,_0xc19a('0x27'));_0x529056[_0xc19a('0x2f')]=_['keys'](_0x575d74[_0xc19a('0x2f')]);_0x529056['filters']=_['intersection'](_0x529056[_0xc19a('0x30')],_0x529056[_0xc19a('0x2f')]);_0x497a84[_0xc19a('0x31')]=_[_0xc19a('0x32')](_0x529056[_0xc19a('0x30')],qs[_0xc19a('0x33')](_0x575d74[_0xc19a('0x2f')][_0xc19a('0x33')]));_0x497a84[_0xc19a('0x31')]=_0x497a84['attributes'][_0xc19a('0x34')]?_0x497a84['attributes']:_0x529056[_0xc19a('0x30')];if(!_0x575d74[_0xc19a('0x2f')][_0xc19a('0x35')](_0xc19a('0x36'))){_0x497a84[_0xc19a('0x1d')]=qs[_0xc19a('0x1d')](_0x575d74['query'][_0xc19a('0x1d')]);_0x497a84['offset']=qs['offset'](_0x575d74[_0xc19a('0x2f')][_0xc19a('0x1a')]);}_0x497a84['order']=qs[_0xc19a('0x37')](_0x575d74[_0xc19a('0x2f')][_0xc19a('0x37')]);_0x497a84[_0xc19a('0x38')]=qs[_0xc19a('0x39')](_[_0xc19a('0x3a')](_0x575d74['query'],_0x529056[_0xc19a('0x39')]),_0x4672ac);if(_0x575d74[_0xc19a('0x2f')][_0xc19a('0x3b')]){_0x497a84['where']=_['merge'](_0x497a84['where'],{'$or':_[_0xc19a('0x2a')](_0x4672ac,function(_0x339eee){if(_0x339eee[_0xc19a('0x2e')]!==_0xc19a('0x3c')){var _0x1d0e21={};_0x1d0e21[_0x339eee[_0xc19a('0x27')]]={'$like':'%'+_0x575d74[_0xc19a('0x2f')][_0xc19a('0x3b')]+'%'};return _0x1d0e21;}})});}_0x497a84=_[_0xc19a('0x3d')]({},_0x497a84,_0x575d74[_0xc19a('0x3e')]);var _0x3eb460={'where':_0x497a84['where']};return db['VtigerField'][_0xc19a('0x1c')](_0x3eb460)['then'](function(_0x4b0c1f){_0x29e228['count']=_0x4b0c1f;if(_0x575d74['query']['includeAll']){_0x497a84[_0xc19a('0x3f')]=[{'all':!![]}];}return db['VtigerField'][_0xc19a('0x40')](_0x497a84);})['then'](function(_0x4208da){_0x29e228[_0xc19a('0x41')]=_0x4208da;return _0x29e228;})['then'](respondWithFilteredResult(_0x592238,_0x497a84))[_0xc19a('0x42')](handleError(_0x592238,null));};exports['show']=function(_0x243335,_0x1db6af){var _0x5cb5e6={'raw':!![],'where':{'id':_0x243335[_0xc19a('0x43')]['id']}},_0x28db5e={};_0x28db5e[_0xc19a('0x30')]=_[_0xc19a('0x44')](db['VtigerField']['rawAttributes']);_0x28db5e[_0xc19a('0x2f')]=_[_0xc19a('0x44')](_0x243335['query']);_0x28db5e[_0xc19a('0x39')]=_[_0xc19a('0x32')](_0x28db5e['model'],_0x28db5e['query']);_0x5cb5e6[_0xc19a('0x31')]=_[_0xc19a('0x32')](_0x28db5e[_0xc19a('0x30')],qs[_0xc19a('0x33')](_0x243335[_0xc19a('0x2f')][_0xc19a('0x33')]));_0x5cb5e6[_0xc19a('0x31')]=_0x5cb5e6[_0xc19a('0x31')][_0xc19a('0x34')]?_0x5cb5e6[_0xc19a('0x31')]:_0x28db5e[_0xc19a('0x30')];if(_0x243335[_0xc19a('0x2f')]['includeAll']){_0x5cb5e6[_0xc19a('0x3f')]=[{'all':!![]}];}_0x5cb5e6=_[_0xc19a('0x3d')]({},_0x5cb5e6,_0x243335['options']);return db[_0xc19a('0x2b')][_0xc19a('0x45')](_0x5cb5e6)[_0xc19a('0x24')](handleEntityNotFound(_0x1db6af,null))[_0xc19a('0x24')](respondWithResult(_0x1db6af,null))[_0xc19a('0x42')](handleError(_0x1db6af,null));};exports[_0xc19a('0x46')]=function(_0x55c908,_0x5e2ab0){return db[_0xc19a('0x2b')][_0xc19a('0x46')](_0x55c908[_0xc19a('0x47')],{})['then'](respondWithResult(_0x5e2ab0,0xc9))['catch'](handleError(_0x5e2ab0,null));};exports['update']=function(_0x1f0d64,_0x1f8b5f){if(_0x1f0d64[_0xc19a('0x47')]['id']){delete _0x1f0d64[_0xc19a('0x47')]['id'];}return db['VtigerField'][_0xc19a('0x45')]({'where':{'id':_0x1f0d64[_0xc19a('0x43')]['id']}})[_0xc19a('0x24')](handleEntityNotFound(_0x1f8b5f,null))[_0xc19a('0x24')](saveUpdates(_0x1f0d64['body'],null))[_0xc19a('0x24')](respondWithResult(_0x1f8b5f,null))[_0xc19a('0x42')](handleError(_0x1f8b5f,null));};exports[_0xc19a('0x25')]=function(_0x982289,_0x328765){return db[_0xc19a('0x2b')]['find']({'where':{'id':_0x982289[_0xc19a('0x43')]['id']}})[_0xc19a('0x24')](handleEntityNotFound(_0x328765,null))[_0xc19a('0x24')](removeEntity(_0x328765,null))[_0xc19a('0x42')](handleError(_0x328765,null));}; \ No newline at end of file +var _0xc36f=['limit','set','Content-Range','reject','save','then','destroy','end','error','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0x215f2c,_0x4dbda1){var _0x193f9d=function(_0x4f3b3f){while(--_0x4f3b3f){_0x215f2c['push'](_0x215f2c['shift']());}};_0x193f9d(++_0x4dbda1);}(_0xc36f,0x15b));var _0xfc36=function(_0x35e0d0,_0x49e69e){_0x35e0d0=_0x35e0d0-0x0;var _0x2f7dd0=_0xc36f[_0x35e0d0];return _0x2f7dd0;};'use strict';var emlformat=require(_0xfc36('0x0'));var rimraf=require(_0xfc36('0x1'));var zipdir=require(_0xfc36('0x2'));var jsonpatch=require(_0xfc36('0x3'));var rp=require(_0xfc36('0x4'));var moment=require(_0xfc36('0x5'));var BPromise=require(_0xfc36('0x6'));var Mustache=require(_0xfc36('0x7'));var util=require(_0xfc36('0x8'));var path=require(_0xfc36('0x9'));var sox=require(_0xfc36('0xa'));var csv=require(_0xfc36('0xb'));var ejs=require(_0xfc36('0xc'));var fs=require('fs');var fs_extra=require(_0xfc36('0xd'));var _=require(_0xfc36('0xe'));var squel=require(_0xfc36('0xf'));var crypto=require(_0xfc36('0x10'));var jsforce=require(_0xfc36('0x11'));var deskjs=require(_0xfc36('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfc36('0x13'));var Redis=require('ioredis');var authService=require(_0xfc36('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfc36('0x15'));var hardwareService=require(_0xfc36('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xfc36('0x17'));var config=require(_0xfc36('0x18'));var licenseUtil=require(_0xfc36('0x19'));var db=require(_0xfc36('0x1a'))['db'];function respondWithStatusCode(_0x320dc5,_0x155edd){_0x155edd=_0x155edd||0xcc;return function(_0x47dbe9){if(_0x47dbe9){return _0x320dc5[_0xfc36('0x1b')](_0x155edd);}return _0x320dc5[_0xfc36('0x1c')](_0x155edd)['end']();};}function respondWithResult(_0x55ed8f,_0x504f9a){_0x504f9a=_0x504f9a||0xc8;return function(_0x529eb4){if(_0x529eb4){return _0x55ed8f[_0xfc36('0x1c')](_0x504f9a)[_0xfc36('0x1d')](_0x529eb4);}};}function respondWithFilteredResult(_0x1efa1d,_0x50c7f0){return function(_0x34aa67){if(_0x34aa67){var _0x482397=typeof _0x50c7f0[_0xfc36('0x1e')]===_0xfc36('0x1f')&&typeof _0x50c7f0['limit']===_0xfc36('0x1f');var _0x486cdd=_0x34aa67['count'];var _0x1e0f48=_0x482397?0x0:_0x50c7f0[_0xfc36('0x1e')];var _0x4a002c=_0x482397?_0x34aa67[_0xfc36('0x20')]:_0x50c7f0[_0xfc36('0x1e')]+_0x50c7f0[_0xfc36('0x21')];var _0x5cb7ea;if(_0x4a002c>=_0x486cdd){_0x4a002c=_0x486cdd;_0x5cb7ea=0xc8;}else{_0x5cb7ea=0xce;}_0x1efa1d[_0xfc36('0x1c')](_0x5cb7ea);return _0x1efa1d[_0xfc36('0x22')](_0xfc36('0x23'),_0x1e0f48+'-'+_0x4a002c+'/'+_0x486cdd)['json'](_0x34aa67);}return null;};}function patchUpdates(_0xe86989){return function(_0x270aa2){try{jsonpatch['apply'](_0x270aa2,_0xe86989,!![]);}catch(_0xe841bb){return BPromise[_0xfc36('0x24')](_0xe841bb);}return _0x270aa2[_0xfc36('0x25')]();};}function saveUpdates(_0x280d94,_0x7583b0){return function(_0x2977c9){if(_0x2977c9){return _0x2977c9['update'](_0x280d94)[_0xfc36('0x26')](function(_0x40ba88){return _0x40ba88;});}return null;};}function removeEntity(_0x5c2cf6,_0x109f00){return function(_0x99c87d){if(_0x99c87d){return _0x99c87d[_0xfc36('0x27')]()[_0xfc36('0x26')](function(){_0x5c2cf6['status'](0xcc)[_0xfc36('0x28')]();});}};}function handleEntityNotFound(_0x207ee9,_0x4cc4bd){return function(_0x138e28){if(!_0x138e28){_0x207ee9['sendStatus'](0x194);}return _0x138e28;};}function handleError(_0x582df,_0x483126){_0x483126=_0x483126||0x1f4;return function(_0x5f1927){logger[_0xfc36('0x29')](_0x5f1927['stack']);if(_0x5f1927[_0xfc36('0x2a')]){delete _0x5f1927[_0xfc36('0x2a')];}_0x582df['status'](_0x483126)[_0xfc36('0x2b')](_0x5f1927);};}exports[_0xfc36('0x2c')]=function(_0x1eaa74,_0x370ff5){var _0x13db89={},_0x577e75={},_0xa97b75={'count':0x0,'rows':[]};var _0x3b2801=_[_0xfc36('0x2d')](db[_0xfc36('0x2e')][_0xfc36('0x2f')],function(_0x101e22){return{'name':_0x101e22[_0xfc36('0x30')],'type':_0x101e22['type'][_0xfc36('0x31')]};});_0x577e75[_0xfc36('0x32')]=_[_0xfc36('0x2d')](_0x3b2801,_0xfc36('0x2a'));_0x577e75[_0xfc36('0x33')]=_[_0xfc36('0x34')](_0x1eaa74[_0xfc36('0x33')]);_0x577e75[_0xfc36('0x35')]=_[_0xfc36('0x36')](_0x577e75[_0xfc36('0x32')],_0x577e75[_0xfc36('0x33')]);_0x13db89[_0xfc36('0x37')]=_[_0xfc36('0x36')](_0x577e75['model'],qs[_0xfc36('0x38')](_0x1eaa74[_0xfc36('0x33')][_0xfc36('0x38')]));_0x13db89[_0xfc36('0x37')]=_0x13db89[_0xfc36('0x37')][_0xfc36('0x39')]?_0x13db89['attributes']:_0x577e75[_0xfc36('0x32')];if(!_0x1eaa74[_0xfc36('0x33')]['hasOwnProperty'](_0xfc36('0x3a'))){_0x13db89[_0xfc36('0x21')]=qs['limit'](_0x1eaa74[_0xfc36('0x33')][_0xfc36('0x21')]);_0x13db89[_0xfc36('0x1e')]=qs[_0xfc36('0x1e')](_0x1eaa74[_0xfc36('0x33')][_0xfc36('0x1e')]);}_0x13db89[_0xfc36('0x3b')]=qs[_0xfc36('0x3c')](_0x1eaa74[_0xfc36('0x33')]['sort']);_0x13db89[_0xfc36('0x3d')]=qs['filters'](_[_0xfc36('0x3e')](_0x1eaa74[_0xfc36('0x33')],_0x577e75['filters']),_0x3b2801);if(_0x1eaa74[_0xfc36('0x33')][_0xfc36('0x3f')]){_0x13db89[_0xfc36('0x3d')]=_[_0xfc36('0x40')](_0x13db89[_0xfc36('0x3d')],{'$or':_[_0xfc36('0x2d')](_0x3b2801,function(_0x21f389){if(_0x21f389[_0xfc36('0x41')]!=='VIRTUAL'){var _0x4de22c={};_0x4de22c[_0x21f389['name']]={'$like':'%'+_0x1eaa74[_0xfc36('0x33')]['filter']+'%'};return _0x4de22c;}})});}_0x13db89=_[_0xfc36('0x40')]({},_0x13db89,_0x1eaa74[_0xfc36('0x42')]);var _0x312964={'where':_0x13db89[_0xfc36('0x3d')]};return db[_0xfc36('0x2e')][_0xfc36('0x20')](_0x312964)[_0xfc36('0x26')](function(_0x53b23c){_0xa97b75[_0xfc36('0x20')]=_0x53b23c;if(_0x1eaa74[_0xfc36('0x33')]['includeAll']){_0x13db89['include']=[{'all':!![]}];}return db[_0xfc36('0x2e')][_0xfc36('0x43')](_0x13db89);})[_0xfc36('0x26')](function(_0x2eb692){_0xa97b75[_0xfc36('0x44')]=_0x2eb692;return _0xa97b75;})[_0xfc36('0x26')](respondWithFilteredResult(_0x370ff5,_0x13db89))[_0xfc36('0x45')](handleError(_0x370ff5,null));};exports[_0xfc36('0x46')]=function(_0x5f3e40,_0x2f4478){var _0x5d7534={'raw':!![],'where':{'id':_0x5f3e40[_0xfc36('0x47')]['id']}},_0x22db24={};_0x22db24[_0xfc36('0x32')]=_[_0xfc36('0x34')](db[_0xfc36('0x2e')][_0xfc36('0x2f')]);_0x22db24[_0xfc36('0x33')]=_[_0xfc36('0x34')](_0x5f3e40[_0xfc36('0x33')]);_0x22db24[_0xfc36('0x35')]=_[_0xfc36('0x36')](_0x22db24['model'],_0x22db24['query']);_0x5d7534[_0xfc36('0x37')]=_[_0xfc36('0x36')](_0x22db24[_0xfc36('0x32')],qs[_0xfc36('0x38')](_0x5f3e40['query'][_0xfc36('0x38')]));_0x5d7534[_0xfc36('0x37')]=_0x5d7534[_0xfc36('0x37')][_0xfc36('0x39')]?_0x5d7534[_0xfc36('0x37')]:_0x22db24[_0xfc36('0x32')];if(_0x5f3e40[_0xfc36('0x33')][_0xfc36('0x48')]){_0x5d7534['include']=[{'all':!![]}];}_0x5d7534=_['merge']({},_0x5d7534,_0x5f3e40[_0xfc36('0x42')]);return db[_0xfc36('0x2e')][_0xfc36('0x49')](_0x5d7534)[_0xfc36('0x26')](handleEntityNotFound(_0x2f4478,null))[_0xfc36('0x26')](respondWithResult(_0x2f4478,null))['catch'](handleError(_0x2f4478,null));};exports['create']=function(_0x3f7cb4,_0x4a97d4){return db['VtigerField'][_0xfc36('0x4a')](_0x3f7cb4[_0xfc36('0x4b')],{})[_0xfc36('0x26')](respondWithResult(_0x4a97d4,0xc9))[_0xfc36('0x45')](handleError(_0x4a97d4,null));};exports['update']=function(_0x121296,_0x2da37f){if(_0x121296[_0xfc36('0x4b')]['id']){delete _0x121296[_0xfc36('0x4b')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x121296[_0xfc36('0x47')]['id']}})['then'](handleEntityNotFound(_0x2da37f,null))[_0xfc36('0x26')](saveUpdates(_0x121296[_0xfc36('0x4b')],null))[_0xfc36('0x26')](respondWithResult(_0x2da37f,null))[_0xfc36('0x45')](handleError(_0x2da37f,null));};exports[_0xfc36('0x27')]=function(_0x18f3c1,_0x3c16dd){return db[_0xfc36('0x2e')][_0xfc36('0x49')]({'where':{'id':_0x18f3c1[_0xfc36('0x47')]['id']}})[_0xfc36('0x26')](handleEntityNotFound(_0x3c16dd,null))[_0xfc36('0x26')](removeEntity(_0x3c16dd,null))[_0xfc36('0x45')](handleError(_0x3c16dd,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index aff1b5f..1e53e34 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 _0x27df=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x30387a,_0x58c188){var _0x31d201=function(_0x1e2f01){while(--_0x1e2f01){_0x30387a['push'](_0x30387a['shift']());}};_0x31d201(++_0x58c188);}(_0x27df,0x6d));var _0xf27d=function(_0x21d705,_0xc1d44e){_0x21d705=_0x21d705-0x0;var _0x72a9a6=_0x27df[_0x21d705];return _0x72a9a6;};'use strict';var _=require(_0xf27d('0x0'));var util=require(_0xf27d('0x1'));var logger=require(_0xf27d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf27d('0x3'));var rp=require(_0xf27d('0x4'));var fs=require('fs');var path=require(_0xf27d('0x5'));var rimraf=require(_0xf27d('0x6'));var config=require(_0xf27d('0x7'));var attributes=require('./intVtigerField.attributes');module[_0xf27d('0x8')]=function(_0x576756,_0x5eaf75){return _0x576756[_0xf27d('0x9')](_0xf27d('0xa'),attributes,{'tableName':_0xf27d('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xf27d('0xc'),_0xf27d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9cf9=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x1e8d5a,_0x12229a){var _0x5ebdb8=function(_0x403f36){while(--_0x403f36){_0x1e8d5a['push'](_0x1e8d5a['shift']());}};_0x5ebdb8(++_0x12229a);}(_0x9cf9,0x14e));var _0x99cf=function(_0x5526b8,_0x353f11){_0x5526b8=_0x5526b8-0x0;var _0x2e202d=_0x9cf9[_0x5526b8];return _0x2e202d;};'use strict';var _=require(_0x99cf('0x0'));var util=require(_0x99cf('0x1'));var logger=require(_0x99cf('0x2'))(_0x99cf('0x3'));var moment=require(_0x99cf('0x4'));var BPromise=require(_0x99cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99cf('0x6'));var rimraf=require(_0x99cf('0x7'));var config=require(_0x99cf('0x8'));var attributes=require('./intVtigerField.attributes');module[_0x99cf('0x9')]=function(_0x156ca1,_0x1c6c9e){return _0x156ca1[_0x99cf('0xa')](_0x99cf('0xb'),attributes,{'tableName':_0x99cf('0xc'),'paranoid':![],'indexes':[{'name':_0x99cf('0xd'),'fields':[_0x99cf('0xe'),_0x99cf('0xf')],'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 b23aaa1..b816319 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 _0x30a3=['request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x30ae46,_0x64d163){var _0x5111bb=function(_0x32e870){while(--_0x32e870){_0x30ae46['push'](_0x30ae46['shift']());}};_0x5111bb(++_0x64d163);}(_0x30a3,0x1ee));var _0x330a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x30a3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x330a('0x0'));var util=require(_0x330a('0x1'));var moment=require('moment');var BPromise=require(_0x330a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x330a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x330a('0x4'));var logger=require('../../config/logger')(_0x330a('0x5'));var config=require(_0x330a('0x6'));var jayson=require(_0x330a('0x7'));var client=jayson[_0x330a('0x8')][_0x330a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9499,_0x4279c6,_0x3d89df){return new BPromise(function(_0x45d669,_0x5b3d6e){return client[_0x330a('0xa')](_0x2a9499,_0x3d89df)['then'](function(_0x30655d){logger[_0x330a('0xb')](_0x330a('0xc'),_0x4279c6,_0x330a('0xd'));logger[_0x330a('0xe')](_0x330a('0xf'),_0x4279c6,_0x330a('0xd'),JSON[_0x330a('0x10')](_0x30655d));if(_0x30655d[_0x330a('0x11')]){if(_0x30655d[_0x330a('0x11')][_0x330a('0x12')]===0x1f4){logger[_0x330a('0x11')](_0x330a('0xc'),_0x4279c6,_0x30655d[_0x330a('0x11')]['message']);return _0x5b3d6e(_0x30655d[_0x330a('0x11')][_0x330a('0x13')]);}logger['error'](_0x330a('0xc'),_0x4279c6,_0x30655d['error']['message']);return _0x45d669(_0x30655d['error'][_0x330a('0x13')]);}else{logger[_0x330a('0xb')](_0x330a('0xc'),_0x4279c6,_0x330a('0xd'));_0x45d669(_0x30655d[_0x330a('0x14')][_0x330a('0x13')]);}})['catch'](function(_0x4c10fa){logger[_0x330a('0x11')](_0x330a('0xc'),_0x4279c6,_0x4c10fa);_0x5b3d6e(_0x4c10fa);});});} \ No newline at end of file +var _0xe01b=['request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VtigerField,\x20%s,\x20%s'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xe01b,0x64));var _0xbe01=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xe01b[_0x543084];return _0x306a57;};'use strict';var _=require(_0xbe01('0x0'));var util=require(_0xbe01('0x1'));var moment=require(_0xbe01('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe01('0x3'));var fs=require('fs');var Redis=require(_0xbe01('0x4'));var db=require(_0xbe01('0x5'))['db'];var utils=require(_0xbe01('0x6'));var logger=require(_0xbe01('0x7'))(_0xbe01('0x8'));var config=require(_0xbe01('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe01('0xa')][_0xbe01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1aefaa,_0xec2b8e,_0x3007d6){return new BPromise(function(_0x55cf64,_0x587698){return client['request'](_0x1aefaa,_0x3007d6)[_0xbe01('0xc')](function(_0x238985){logger[_0xbe01('0xd')](_0xbe01('0xe'),_0xec2b8e,_0xbe01('0xf'));logger[_0xbe01('0x10')](_0xbe01('0x11'),_0xec2b8e,_0xbe01('0xf'),JSON[_0xbe01('0x12')](_0x238985));if(_0x238985['error']){if(_0x238985['error'][_0xbe01('0x13')]===0x1f4){logger[_0xbe01('0x14')]('VtigerField,\x20%s,\x20%s',_0xec2b8e,_0x238985[_0xbe01('0x14')][_0xbe01('0x15')]);return _0x587698(_0x238985[_0xbe01('0x14')][_0xbe01('0x15')]);}logger[_0xbe01('0x14')](_0xbe01('0xe'),_0xec2b8e,_0x238985[_0xbe01('0x14')]['message']);return _0x55cf64(_0x238985['error'][_0xbe01('0x15')]);}else{logger[_0xbe01('0xd')](_0xbe01('0xe'),_0xec2b8e,'request\x20sent');_0x55cf64(_0x238985[_0xbe01('0x16')][_0xbe01('0x15')]);}})['catch'](function(_0x119450){logger[_0xbe01('0x14')](_0xbe01('0xe'),_0xec2b8e,_0x119450);_0x587698(_0x119450);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0662089..545d020 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 _0xdb7c=['create','addConfiguration','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','post'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xdb7c,0x1d2));var _0xcdb7=function(_0x3bee55,_0x4e25c8){_0x3bee55=_0x3bee55-0x0;var _0x5649d2=_0xdb7c[_0x3bee55];return _0x5649d2;};'use strict';var multer=require(_0xcdb7('0x0'));var util=require(_0xcdb7('0x1'));var path=require(_0xcdb7('0x2'));var timeout=require('connect-timeout');var express=require(_0xcdb7('0x3'));var router=express[_0xcdb7('0x4')]();var fs_extra=require(_0xcdb7('0x5'));var auth=require(_0xcdb7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcdb7('0x7'));var controller=require(_0xcdb7('0x8'));router['get']('/',auth[_0xcdb7('0x9')](),controller[_0xcdb7('0xa')]);router[_0xcdb7('0xb')](_0xcdb7('0xc'),auth['isAuthenticated'](),controller[_0xcdb7('0xd')]);router[_0xcdb7('0xb')](_0xcdb7('0xe'),auth[_0xcdb7('0x9')](),controller['getConfigurations']);router['get'](_0xcdb7('0xf'),auth[_0xcdb7('0x9')](),controller['getFields']);router[_0xcdb7('0x10')]('/',auth[_0xcdb7('0x9')](),controller[_0xcdb7('0x11')]);router[_0xcdb7('0x10')](_0xcdb7('0xe'),auth[_0xcdb7('0x9')](),controller[_0xcdb7('0x12')]);router['put'](_0xcdb7('0xc'),auth[_0xcdb7('0x9')](),controller[_0xcdb7('0x13')]);router[_0xcdb7('0x14')]('/:id',auth[_0xcdb7('0x9')](),controller[_0xcdb7('0x15')]);module[_0xcdb7('0x16')]=router; \ No newline at end of file +var _0x6e64=['../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x2359c5,_0x27c819){var _0x4f8179=function(_0x165a89){while(--_0x165a89){_0x2359c5['push'](_0x2359c5['shift']());}};_0x4f8179(++_0x27c819);}(_0x6e64,0x10f));var _0x46e6=function(_0x256513,_0x433740){_0x256513=_0x256513-0x0;var _0x226fa9=_0x6e64[_0x256513];return _0x226fa9;};'use strict';var multer=require(_0x46e6('0x0'));var util=require(_0x46e6('0x1'));var path=require(_0x46e6('0x2'));var timeout=require(_0x46e6('0x3'));var express=require('express');var router=express[_0x46e6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46e6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x46e6('0x6'));var controller=require(_0x46e6('0x7'));router[_0x46e6('0x8')]('/',auth[_0x46e6('0x9')](),controller[_0x46e6('0xa')]);router[_0x46e6('0x8')]('/:id',auth[_0x46e6('0x9')](),controller[_0x46e6('0xb')]);router[_0x46e6('0x8')](_0x46e6('0xc'),auth[_0x46e6('0x9')](),controller[_0x46e6('0xd')]);router[_0x46e6('0x8')](_0x46e6('0xe'),auth[_0x46e6('0x9')](),controller[_0x46e6('0xf')]);router['post']('/',auth[_0x46e6('0x9')](),controller['create']);router['post'](_0x46e6('0xc'),auth[_0x46e6('0x9')](),controller[_0x46e6('0x10')]);router[_0x46e6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x46e6('0x12')]);router[_0x46e6('0x13')](_0x46e6('0x14'),auth[_0x46e6('0x9')](),controller[_0x46e6('0x15')]);module[_0x46e6('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 7404042..d35b562 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 _0xadb5=['integrationTab','newTab','exports','STRING','username','remoteUri','password','token','ENUM'];(function(_0x4804cd,_0x299994){var _0x9caa09=function(_0x40a5fb){while(--_0x40a5fb){_0x4804cd['push'](_0x4804cd['shift']());}};_0x9caa09(++_0x299994);}(_0xadb5,0xad));var _0x5adb=function(_0x5b1405,_0x2a9c59){_0x5b1405=_0x5b1405-0x0;var _0x123e42=_0xadb5[_0x5b1405];return _0x123e42;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x5adb('0x1')]},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'authType':{'type':Sequelize['ENUM'](_0x5adb('0x4'),_0x5adb('0x5')),'defaultValue':_0x5adb('0x4')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5adb('0x6')](_0x5adb('0x7'),_0x5adb('0x8')),'defaultValue':_0x5adb('0x7')}}; \ No newline at end of file +var _0x7ea9=['password','token','integrationTab','newTab','exports','STRING','username','remoteUri'];(function(_0x5933f6,_0x10c665){var _0x14ce1e=function(_0xeba59a){while(--_0xeba59a){_0x5933f6['push'](_0x5933f6['shift']());}};_0x14ce1e(++_0x10c665);}(_0x7ea9,0xec));var _0x97ea=function(_0x593e87,_0x3678e2){_0x593e87=_0x593e87-0x0;var _0x59235b=_0x7ea9[_0x593e87];return _0x59235b;};'use strict';var Sequelize=require('sequelize');module[_0x97ea('0x0')]={'name':{'type':Sequelize[_0x97ea('0x1')]},'description':{'type':Sequelize[_0x97ea('0x1')]},'username':{'type':Sequelize[_0x97ea('0x1')],'unique':_0x97ea('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x97ea('0x1')]},'remoteUri':{'type':Sequelize[_0x97ea('0x1')],'unique':_0x97ea('0x3')},'authType':{'type':Sequelize['ENUM'](_0x97ea('0x4'),_0x97ea('0x5')),'defaultValue':_0x97ea('0x4')},'serverUrl':{'type':Sequelize[_0x97ea('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x97ea('0x6'),_0x97ea('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index fa0b6aa..73cb020 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 _0x7af2=['pick','VIRTUAL','filter','merge','options','includeAll','findAll','params','rawAttributes','include','catch','create','body','find','getConfigurations','findOne','ZendeskConfiguration','length','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Unknown\x20authentication\x20type','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters'];(function(_0x3b8367,_0x23a596){var _0x17683a=function(_0x3f2e92){while(--_0x3f2e92){_0x3b8367['push'](_0x3b8367['shift']());}};_0x17683a(++_0x23a596);}(_0x7af2,0x119));var _0x27af=function(_0x41d34a,_0x5a2190){_0x41d34a=_0x41d34a-0x0;var _0x26d8d5=_0x7af2[_0x41d34a];return _0x26d8d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x406340,_0x203501){_0x203501=_0x203501||0xcc;return function(_0x1fd964){if(_0x1fd964){return _0x406340[_0x27af('0x17')](_0x203501);}return _0x406340[_0x27af('0x18')](_0x203501)[_0x27af('0x19')]();};}function respondWithResult(_0x234825,_0x3da435){_0x3da435=_0x3da435||0xc8;return function(_0x423222){if(_0x423222){return _0x234825[_0x27af('0x18')](_0x3da435)[_0x27af('0x1a')](_0x423222);}};}function respondWithFilteredResult(_0x9c2d4b,_0x2d7800){return function(_0x3102c4){if(_0x3102c4){var _0x2bfc9=typeof _0x2d7800[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x2d7800[_0x27af('0x1d')]==='undefined';var _0x315661=_0x3102c4[_0x27af('0x1e')];var _0x5997ae=_0x2bfc9?0x0:_0x2d7800['offset'];var _0x20a6d7=_0x2bfc9?_0x3102c4[_0x27af('0x1e')]:_0x2d7800[_0x27af('0x1b')]+_0x2d7800[_0x27af('0x1d')];var _0xec699a;if(_0x20a6d7>=_0x315661){_0x20a6d7=_0x315661;_0xec699a=0xc8;}else{_0xec699a=0xce;}_0x9c2d4b['status'](_0xec699a);return _0x9c2d4b[_0x27af('0x1f')](_0x27af('0x20'),_0x5997ae+'-'+_0x20a6d7+'/'+_0x315661)[_0x27af('0x1a')](_0x3102c4);}return null;};}function patchUpdates(_0x5e7c19){return function(_0x19afb1){try{jsonpatch[_0x27af('0x21')](_0x19afb1,_0x5e7c19,!![]);}catch(_0x2ae47e){return BPromise['reject'](_0x2ae47e);}return _0x19afb1[_0x27af('0x22')]();};}function saveUpdates(_0x2460f4,_0x30720b){return function(_0x2af76d){if(_0x2af76d){return _0x2af76d[_0x27af('0x23')](_0x2460f4)[_0x27af('0x24')](function(_0x43dd9e){return _0x43dd9e;});}return null;};}function removeEntity(_0x35b36d,_0x2e1bb0){return function(_0x49780b){if(_0x49780b){return _0x49780b['destroy']()['then'](function(){_0x35b36d[_0x27af('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12625c,_0x396326){return function(_0x4ba49f){if(!_0x4ba49f){_0x12625c[_0x27af('0x17')](0x194);}return _0x4ba49f;};}function handleError(_0x1d9341,_0x463e36){_0x463e36=_0x463e36||0x1f4;return function(_0x424490){logger[_0x27af('0x25')](_0x424490[_0x27af('0x26')]);if(_0x424490[_0x27af('0x27')]){delete _0x424490['name'];}_0x1d9341[_0x27af('0x18')](_0x463e36)[_0x27af('0x28')](_0x424490);};}exports[_0x27af('0x29')]=function(_0xe009a,_0x25d65a){var _0xa08dd9={},_0x42a5b7={},_0x2b26ac={'count':0x0,'rows':[]};var _0x4406e2=_[_0x27af('0x2a')](db[_0x27af('0x2b')]['rawAttributes'],function(_0x15e867){return{'name':_0x15e867[_0x27af('0x2c')],'type':_0x15e867[_0x27af('0x2d')][_0x27af('0x2e')]};});_0x42a5b7[_0x27af('0x2f')]=_[_0x27af('0x2a')](_0x4406e2,'name');_0x42a5b7['query']=_[_0x27af('0x30')](_0xe009a[_0x27af('0x31')]);_0x42a5b7['filters']=_[_0x27af('0x32')](_0x42a5b7[_0x27af('0x2f')],_0x42a5b7[_0x27af('0x31')]);_0xa08dd9[_0x27af('0x33')]=_[_0x27af('0x32')](_0x42a5b7[_0x27af('0x2f')],qs[_0x27af('0x34')](_0xe009a[_0x27af('0x31')][_0x27af('0x34')]));_0xa08dd9[_0x27af('0x33')]=_0xa08dd9[_0x27af('0x33')]['length']?_0xa08dd9['attributes']:_0x42a5b7[_0x27af('0x2f')];if(!_0xe009a[_0x27af('0x31')]['hasOwnProperty'](_0x27af('0x35'))){_0xa08dd9[_0x27af('0x1d')]=qs['limit'](_0xe009a[_0x27af('0x31')][_0x27af('0x1d')]);_0xa08dd9[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0xe009a[_0x27af('0x31')]['offset']);}_0xa08dd9[_0x27af('0x36')]=qs[_0x27af('0x37')](_0xe009a['query']['sort']);_0xa08dd9[_0x27af('0x38')]=qs[_0x27af('0x39')](_[_0x27af('0x3a')](_0xe009a[_0x27af('0x31')],_0x42a5b7[_0x27af('0x39')]),_0x4406e2);if(_0xe009a[_0x27af('0x31')]['filter']){_0xa08dd9[_0x27af('0x38')]=_['merge'](_0xa08dd9[_0x27af('0x38')],{'$or':_[_0x27af('0x2a')](_0x4406e2,function(_0x2a6b14){if(_0x2a6b14[_0x27af('0x2d')]!==_0x27af('0x3b')){var _0x5f5504={};_0x5f5504[_0x2a6b14[_0x27af('0x27')]]={'$like':'%'+_0xe009a[_0x27af('0x31')][_0x27af('0x3c')]+'%'};return _0x5f5504;}})});}_0xa08dd9=_[_0x27af('0x3d')]({},_0xa08dd9,_0xe009a[_0x27af('0x3e')]);var _0x32b558={'where':_0xa08dd9[_0x27af('0x38')]};return db[_0x27af('0x2b')][_0x27af('0x1e')](_0x32b558)[_0x27af('0x24')](function(_0xda424e){_0x2b26ac[_0x27af('0x1e')]=_0xda424e;if(_0xe009a[_0x27af('0x31')][_0x27af('0x3f')]){_0xa08dd9['include']=[{'all':!![]}];}return db[_0x27af('0x2b')][_0x27af('0x40')](_0xa08dd9);})[_0x27af('0x24')](function(_0x373c05){_0x2b26ac['rows']=_0x373c05;return _0x2b26ac;})[_0x27af('0x24')](respondWithFilteredResult(_0x25d65a,_0xa08dd9))['catch'](handleError(_0x25d65a,null));};exports['show']=function(_0x2425dd,_0x3c9c81){var _0x279f99={'raw':![],'where':{'id':_0x2425dd[_0x27af('0x41')]['id']}},_0x17efd6={};_0x17efd6[_0x27af('0x2f')]=_[_0x27af('0x30')](db[_0x27af('0x2b')][_0x27af('0x42')]);_0x17efd6[_0x27af('0x31')]=_[_0x27af('0x30')](_0x2425dd[_0x27af('0x31')]);_0x17efd6['filters']=_[_0x27af('0x32')](_0x17efd6[_0x27af('0x2f')],_0x17efd6['query']);_0x279f99['attributes']=_[_0x27af('0x32')](_0x17efd6[_0x27af('0x2f')],qs[_0x27af('0x34')](_0x2425dd[_0x27af('0x31')][_0x27af('0x34')]));_0x279f99['attributes']=_0x279f99[_0x27af('0x33')]['length']?_0x279f99[_0x27af('0x33')]:_0x17efd6[_0x27af('0x2f')];if(_0x2425dd[_0x27af('0x31')][_0x27af('0x3f')]){_0x279f99[_0x27af('0x43')]=[{'all':!![]}];}_0x279f99=_[_0x27af('0x3d')]({},_0x279f99,_0x2425dd[_0x27af('0x3e')]);return db['ZendeskAccount']['find'](_0x279f99)[_0x27af('0x24')](handleEntityNotFound(_0x3c9c81,null))['then'](respondWithResult(_0x3c9c81,null))[_0x27af('0x44')](handleError(_0x3c9c81,null));};exports[_0x27af('0x45')]=function(_0x226025,_0x389962){return db[_0x27af('0x2b')][_0x27af('0x45')](_0x226025[_0x27af('0x46')],{})['then'](respondWithResult(_0x389962,0xc9))[_0x27af('0x44')](handleError(_0x389962,null));};exports[_0x27af('0x23')]=function(_0x20e180,_0x3fdc0e){if(_0x20e180[_0x27af('0x46')]['id']){delete _0x20e180['body']['id'];}return db[_0x27af('0x2b')][_0x27af('0x47')]({'where':{'id':_0x20e180[_0x27af('0x41')]['id']}})['then'](handleEntityNotFound(_0x3fdc0e,null))['then'](saveUpdates(_0x20e180[_0x27af('0x46')],null))[_0x27af('0x24')](respondWithResult(_0x3fdc0e,null))[_0x27af('0x44')](handleError(_0x3fdc0e,null));};exports['destroy']=function(_0x495794,_0x2fad23){return db['ZendeskAccount'][_0x27af('0x47')]({'where':{'id':_0x495794[_0x27af('0x41')]['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x2fad23,null))[_0x27af('0x24')](removeEntity(_0x2fad23,null))[_0x27af('0x44')](handleError(_0x2fad23,null));};exports[_0x27af('0x48')]=function(_0x123533,_0x374794,_0x1b6d94){var _0x24d8bf={};var _0x23369a={};var _0x5c02c1;var _0x76ed78;return db[_0x27af('0x2b')][_0x27af('0x49')]({'where':{'id':_0x123533[_0x27af('0x41')]['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x374794,null))[_0x27af('0x24')](function(_0x20c155){if(_0x20c155){_0x5c02c1=_0x20c155;_0x23369a[_0x27af('0x2f')]=_['keys'](db[_0x27af('0x4a')]['rawAttributes']);_0x23369a[_0x27af('0x31')]=_[_0x27af('0x30')](_0x123533[_0x27af('0x31')]);_0x23369a['filters']=_[_0x27af('0x32')](_0x23369a['model'],_0x23369a[_0x27af('0x31')]);_0x24d8bf[_0x27af('0x33')]=_[_0x27af('0x32')](_0x23369a['model'],qs[_0x27af('0x34')](_0x123533['query'][_0x27af('0x34')]));_0x24d8bf['attributes']=_0x24d8bf[_0x27af('0x33')][_0x27af('0x4b')]?_0x24d8bf[_0x27af('0x33')]:_0x23369a['model'];_0x24d8bf['order']=qs[_0x27af('0x37')](_0x123533[_0x27af('0x31')][_0x27af('0x37')]);_0x24d8bf[_0x27af('0x38')]=qs['filters'](_[_0x27af('0x3a')](_0x123533[_0x27af('0x31')],_0x23369a[_0x27af('0x39')]));if(_0x123533[_0x27af('0x31')][_0x27af('0x3c')]){_0x24d8bf[_0x27af('0x38')]=_['merge'](_0x24d8bf[_0x27af('0x38')],{'$or':_[_0x27af('0x2a')](_0x24d8bf[_0x27af('0x33')],function(_0x2401c7){var _0x49eb46={};_0x49eb46[_0x2401c7]={'$like':'%'+_0x123533[_0x27af('0x31')]['filter']+'%'};return _0x49eb46;})});}_0x24d8bf=_[_0x27af('0x3d')]({},_0x24d8bf,_0x123533[_0x27af('0x3e')]);return _0x5c02c1['getConfigurations'](_0x24d8bf);}})[_0x27af('0x24')](function(_0x13a5a8){if(_0x13a5a8){_0x76ed78=_0x13a5a8['length'];if(!_0x123533['query'][_0x27af('0x4c')](_0x27af('0x35'))){_0x24d8bf[_0x27af('0x1d')]=qs['limit'](_0x123533[_0x27af('0x31')][_0x27af('0x1d')]);_0x24d8bf['offset']=qs[_0x27af('0x1b')](_0x123533[_0x27af('0x31')]['offset']);}return _0x5c02c1['getConfigurations'](_0x24d8bf);}})[_0x27af('0x24')](function(_0x1fa50b){if(_0x1fa50b){return _0x1fa50b?{'count':_0x76ed78,'rows':_0x1fa50b}:null;}})['then'](respondWithResult(_0x374794,null))['catch'](handleError(_0x374794,null));};exports[_0x27af('0x4d')]=function(_0xf97695,_0x2a8534,_0x266220){if(_0xf97695[_0x27af('0x46')]['id']){delete _0xf97695[_0x27af('0x46')]['id'];}return db[_0x27af('0x2b')]['findOne']({'where':{'id':_0xf97695['params']['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x2a8534,null))[_0x27af('0x24')](function(_0xa692f6){if(_0xa692f6){_0xf97695[_0x27af('0x46')][_0x27af('0x4e')]=_0xa692f6['id'];_0xf97695[_0x27af('0x46')][_0x27af('0x4f')]=integrations[_0x27af('0x50')](_0xf97695[_0x27af('0x46')][_0x27af('0x51')],_0xf97695[_0x27af('0x46')][_0x27af('0x2d')]);_0xf97695[_0x27af('0x46')][_0x27af('0x52')]=integrations[_0x27af('0x53')](_0xf97695[_0x27af('0x46')][_0x27af('0x51')],_0xf97695['body'][_0x27af('0x2d')]);return db[_0x27af('0x4a')]['create'](_0xf97695[_0x27af('0x46')],{'include':[{'model':db[_0x27af('0x54')],'as':_0x27af('0x4f')},{'model':db[_0x27af('0x54')],'as':_0x27af('0x52')}]});}return null;})[_0x27af('0x24')](respondWithResult(_0x2a8534,null))['catch'](handleError(_0x2a8534,null));};exports[_0x27af('0x55')]=function(_0x31a595,_0x3a2958,_0x4ab463){var _0x5d7af4='';return db[_0x27af('0x2b')]['findOne']({'where':{'id':_0x31a595[_0x27af('0x41')]['id']},'attributes':['id',_0x27af('0x56'),_0x27af('0x57'),_0x27af('0x58'),_0x27af('0x59'),'remoteUri']})[_0x27af('0x24')](handleEntityNotFound(_0x3a2958,null))[_0x27af('0x24')](function(_0x4ac2a3){if(_0x4ac2a3){_0x5d7af4=_0x4ac2a3[_0x27af('0x5a')];var _0xc0a98c=_0x5d7af4['slice'](-0x1);if(_0xc0a98c==='/'){_0x5d7af4=_0x5d7af4['substring'](0x0,_0x5d7af4[_0x27af('0x5b')](_0xc0a98c));}var _0x287f7c={'method':_0x27af('0x5c'),'uri':util[_0x27af('0x5d')](_0x27af('0x5e'),_0x5d7af4,_0x27af('0x5f')),'json':!![]};switch(_0x4ac2a3[_0x27af('0x59')]){case'password':_0x287f7c[_0x27af('0x60')]={'Authorization':util[_0x27af('0x5d')](_0x27af('0x61'),new Buffer(util[_0x27af('0x5d')]('%s:%s',_0x4ac2a3['username'],_0x4ac2a3[_0x27af('0x57')]))[_0x27af('0x62')](_0x27af('0x63')))};break;case _0x27af('0x58'):_0x287f7c['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x27af('0x5d')](_0x27af('0x64'),_0x4ac2a3[_0x27af('0x56')],_0x4ac2a3[_0x27af('0x58')]))[_0x27af('0x62')](_0x27af('0x63')))};break;default:throw new db['Sequelize']['ValidationError'](_0x27af('0x65'));}return rp(_0x287f7c);}})[_0x27af('0x24')](function(_0x55637f){if(_0x55637f){var _0x2c3d30=['subject','description',_0x27af('0x66'),_0x27af('0x67')];_[_0x27af('0x68')](_0x55637f[_0x27af('0x5f')],function(_0x2b7e18){return _0x2c3d30[_0x27af('0x69')](_0x2b7e18[_0x27af('0x2d')]);});return{'count':_0x55637f[_0x27af('0x5f')][_0x27af('0x4b')],'rows':_[_0x27af('0x2a')](_0x55637f[_0x27af('0x5f')],function(_0x4dd124){return{'id':_0x4dd124['id'],'name':_0x4dd124[_0x27af('0x6a')]>0x7?_0x4dd124[_0x27af('0x6b')]:_0x4dd124[_0x27af('0x2d')],'custom':_0x4dd124['position']>0x7?!![]:![],'options':_0x4dd124[_0x27af('0x6c')]?_0x4dd124[_0x27af('0x6c')]:_0x4dd124[_0x27af('0x6d')]?_0x4dd124['custom_field_options']:[]};})};}})[_0x27af('0x24')](respondWithResult(_0x3a2958,null))['catch'](function(_0x118d06){var _0x9350fa=_0x31a595[_0x27af('0x31')][_0x27af('0x6e')]?0x1f4:_0x118d06[_0x27af('0x6f')]||0x1f4;logger[_0x27af('0x25')](_0x27af('0x70'),_0x27af('0x55'),_0x9350fa,JSON['stringify'](_0x118d06));delete _0x118d06[_0x27af('0x27')];if(_0x9350fa===0x191){_0x9350fa=0x190;}_0x3a2958['status'](_0x9350fa)[_0x27af('0x28')](_0x31a595[_0x27af('0x31')][_0x27af('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x118d06['statusCode']}:_0x118d06);});}; \ No newline at end of file +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(_0x255765,_0x458859){var _0x17d578=function(_0x14678a){while(--_0x14678a){_0x255765['push'](_0x255765['shift']());}};_0x17d578(++_0x458859);}(_0x84a0,0x66));var _0x084a=function(_0x30ba78,_0x3b3808){_0x30ba78=_0x30ba78-0x0;var _0x4806b3=_0x84a0[_0x30ba78];return _0x4806b3;};'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 diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 2a3c9b2..c0e39f1 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 _0x208e=['exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','../../components/integrations/configuration'];(function(_0x3f1296,_0x465519){var _0x4a71f8=function(_0xc7343d){while(--_0xc7343d){_0x3f1296['push'](_0x3f1296['shift']());}};_0x4a71f8(++_0x465519);}(_0x208e,0x1a8));var _0xe208=function(_0x20a68a,_0x54502e){_0x20a68a=_0x20a68a-0x0;var _0x56c5d4=_0x208e[_0x20a68a];return _0x56c5d4;};'use strict';var _=require(_0xe208('0x0'));var util=require(_0xe208('0x1'));var logger=require(_0xe208('0x2'))(_0xe208('0x3'));var moment=require(_0xe208('0x4'));var BPromise=require('bluebird');var rp=require(_0xe208('0x5'));var fs=require('fs');var path=require(_0xe208('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xe208('0x7'));module[_0xe208('0x8')]=function(_0x52e805,_0x3cc6b0){return _0x52e805[_0xe208('0x9')](_0xe208('0xa'),attributes,{'tableName':_0xe208('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf460=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xf460,0xf6));var _0x0f46=function(_0x439ee3,_0x1af8c1){_0x439ee3=_0x439ee3-0x0;var _0x174204=_0xf460[_0x439ee3];return _0x174204;};'use strict';var _=require('lodash');var util=require(_0x0f46('0x0'));var logger=require(_0x0f46('0x1'))(_0x0f46('0x2'));var moment=require(_0x0f46('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f46('0x4'));var config=require(_0x0f46('0x5'));var attributes=require(_0x0f46('0x6'));var integrations=require(_0x0f46('0x7'));module[_0x0f46('0x8')]=function(_0x29a082,_0x1ac4d2){return _0x29a082[_0x0f46('0x9')](_0x0f46('0xa'),attributes,{'tableName':_0x0f46('0xb'),'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 ee67e2c..d40425d 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 _0xdba3=['stringify','error','code','message','info','result','catch','findAll','options','raw','limit','map','model','include','attributes','GetZendeskAccount','ShowZendeskAccount','ZendeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x25c988,_0xce8221){var _0x45fcc2=function(_0x47fba5){while(--_0x47fba5){_0x25c988['push'](_0x25c988['shift']());}};_0x45fcc2(++_0xce8221);}(_0xdba3,0x19f));var _0x3dba=function(_0x1ee0a9,_0x18a19e){_0x1ee0a9=_0x1ee0a9-0x0;var _0x46ad6f=_0xdba3[_0x1ee0a9];return _0x46ad6f;};'use strict';var _=require(_0x3dba('0x0'));var util=require(_0x3dba('0x1'));var moment=require('moment');var BPromise=require(_0x3dba('0x2'));var rs=require(_0x3dba('0x3'));var fs=require('fs');var Redis=require(_0x3dba('0x4'));var db=require(_0x3dba('0x5'))['db'];var utils=require(_0x3dba('0x6'));var logger=require(_0x3dba('0x7'))(_0x3dba('0x8'));var config=require(_0x3dba('0x9'));var jayson=require(_0x3dba('0xa'));var client=jayson[_0x3dba('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa6f5ad,_0x3b040a,_0x4ed4f8){return new BPromise(function(_0x5c1f2a,_0x4b33d8){return client[_0x3dba('0xc')](_0xa6f5ad,_0x4ed4f8)[_0x3dba('0xd')](function(_0x434cf4){logger['info'](_0x3dba('0xe'),_0x3b040a,_0x3dba('0xf'));logger[_0x3dba('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x3b040a,'request\x20sent',JSON[_0x3dba('0x11')](_0x434cf4));if(_0x434cf4['error']){if(_0x434cf4[_0x3dba('0x12')][_0x3dba('0x13')]===0x1f4){logger[_0x3dba('0x12')](_0x3dba('0xe'),_0x3b040a,_0x434cf4['error']['message']);return _0x4b33d8(_0x434cf4[_0x3dba('0x12')][_0x3dba('0x14')]);}logger['error'](_0x3dba('0xe'),_0x3b040a,_0x434cf4['error'][_0x3dba('0x14')]);return _0x5c1f2a(_0x434cf4['error'][_0x3dba('0x14')]);}else{logger[_0x3dba('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x3b040a,'request\x20sent');_0x5c1f2a(_0x434cf4[_0x3dba('0x16')]['message']);}})[_0x3dba('0x17')](function(_0x5c9885){logger[_0x3dba('0x12')](_0x3dba('0xe'),_0x3b040a,_0x5c9885);_0x4b33d8(_0x5c9885);});});}exports['GetZendeskAccount']=function(_0x328f5f){var _0x5574c1=this;return new Promise(function(_0x543c40,_0x4d76cc){return db['ZendeskAccount'][_0x3dba('0x18')]({'raw':_0x328f5f[_0x3dba('0x19')]?_0x328f5f[_0x3dba('0x19')][_0x3dba('0x1a')]===undefined?!![]:![]:!![],'where':_0x328f5f[_0x3dba('0x19')]?_0x328f5f[_0x3dba('0x19')]['where']||null:null,'attributes':_0x328f5f[_0x3dba('0x19')]?_0x328f5f['options']['attributes']||null:null,'limit':_0x328f5f[_0x3dba('0x19')]?_0x328f5f[_0x3dba('0x19')][_0x3dba('0x1b')]||null:null,'include':_0x328f5f['options']?_0x328f5f[_0x3dba('0x19')]['include']?_[_0x3dba('0x1c')](_0x328f5f[_0x3dba('0x19')]['include'],function(_0x3d3229){return{'model':db[_0x3d3229[_0x3dba('0x1d')]],'as':_0x3d3229['as'],'attributes':_0x3d3229['attributes'],'include':_0x3d3229['include']?_[_0x3dba('0x1c')](_0x3d3229[_0x3dba('0x1e')],function(_0x51b15c){return{'model':db[_0x51b15c['model']],'as':_0x51b15c['as'],'attributes':_0x51b15c[_0x3dba('0x1f')],'include':_0x51b15c[_0x3dba('0x1e')]?_['map'](_0x51b15c[_0x3dba('0x1e')],function(_0x2ff2c4){return{'model':db[_0x2ff2c4[_0x3dba('0x1d')]],'as':_0x2ff2c4['as'],'attributes':_0x2ff2c4[_0x3dba('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3dba('0xd')](function(_0x2a2b3a){logger[_0x3dba('0x15')]('GetZendeskAccount',_0x328f5f);logger[_0x3dba('0x10')](_0x3dba('0x20'),_0x328f5f,JSON[_0x3dba('0x11')](_0x2a2b3a));_0x543c40(_0x2a2b3a);})['catch'](function(_0x28d11c){logger[_0x3dba('0x12')]('GetZendeskAccount',_0x28d11c[_0x3dba('0x14')],_0x328f5f);_0x4d76cc(_0x5574c1[_0x3dba('0x12')](0x1f4,_0x28d11c[_0x3dba('0x14')]));});});};exports[_0x3dba('0x21')]=function(_0x14799b){var _0x56f581=this;return new Promise(function(_0xc0fcc6,_0xbecb91){return db[_0x3dba('0x22')][_0x3dba('0x23')]({'raw':_0x14799b[_0x3dba('0x19')]?_0x14799b[_0x3dba('0x19')][_0x3dba('0x1a')]===undefined?!![]:![]:!![],'where':_0x14799b[_0x3dba('0x19')]?_0x14799b['options']['where']||null:null,'attributes':_0x14799b[_0x3dba('0x19')]?_0x14799b[_0x3dba('0x19')][_0x3dba('0x1f')]||null:null,'include':_0x14799b[_0x3dba('0x19')]?_0x14799b[_0x3dba('0x19')][_0x3dba('0x1e')]?_[_0x3dba('0x1c')](_0x14799b['options'][_0x3dba('0x1e')],function(_0x57fc2b){return{'model':db[_0x57fc2b[_0x3dba('0x1d')]],'as':_0x57fc2b['as'],'attributes':_0x57fc2b[_0x3dba('0x1f')],'include':_0x57fc2b[_0x3dba('0x1e')]?_['map'](_0x57fc2b[_0x3dba('0x1e')],function(_0x32ca69){return{'model':db[_0x32ca69[_0x3dba('0x1d')]],'as':_0x32ca69['as'],'attributes':_0x32ca69[_0x3dba('0x1f')],'include':_0x32ca69[_0x3dba('0x1e')]?_[_0x3dba('0x1c')](_0x32ca69[_0x3dba('0x1e')],function(_0x22eb2a){return{'model':db[_0x22eb2a[_0x3dba('0x1d')]],'as':_0x22eb2a['as'],'attributes':_0x22eb2a[_0x3dba('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26c996){logger[_0x3dba('0x15')](_0x3dba('0x21'),_0x14799b);logger['debug'](_0x3dba('0x21'),_0x14799b,JSON[_0x3dba('0x11')](_0x26c996));_0xc0fcc6(_0x26c996);})[_0x3dba('0x17')](function(_0x130812){logger[_0x3dba('0x12')](_0x3dba('0x21'),_0x130812[_0x3dba('0x14')],_0x14799b);_0xbecb91(_0x56f581[_0x3dba('0x12')](0x1f4,_0x130812['message']));});});}; \ No newline at end of file +var _0x0500=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZendeskAccount','options','raw','where','attributes','limit','map','include','model','ShowZendeskAccount','ZendeskAccount','then','lodash'];(function(_0xf7a1d8,_0x322ba2){var _0x52e28d=function(_0x561293){while(--_0x561293){_0xf7a1d8['push'](_0xf7a1d8['shift']());}};_0x52e28d(++_0x322ba2);}(_0x0500,0x1db));var _0x0050=function(_0x28d6e1,_0x3bd067){_0x28d6e1=_0x28d6e1-0x0;var _0x529cf3=_0x0500[_0x28d6e1];return _0x529cf3;};'use strict';var _=require(_0x0050('0x0'));var util=require('util');var moment=require(_0x0050('0x1'));var BPromise=require(_0x0050('0x2'));var rs=require(_0x0050('0x3'));var fs=require('fs');var Redis=require(_0x0050('0x4'));var db=require(_0x0050('0x5'))['db'];var utils=require(_0x0050('0x6'));var logger=require(_0x0050('0x7'))(_0x0050('0x8'));var config=require(_0x0050('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0050('0xa')][_0x0050('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x249ee2,_0x5b0c26,_0x14b977){return new BPromise(function(_0x2798fa,_0x171228){return client[_0x0050('0xc')](_0x249ee2,_0x14b977)['then'](function(_0x529f7f){logger[_0x0050('0xd')](_0x0050('0xe'),_0x5b0c26,_0x0050('0xf'));logger[_0x0050('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x5b0c26,_0x0050('0xf'),JSON[_0x0050('0x11')](_0x529f7f));if(_0x529f7f['error']){if(_0x529f7f[_0x0050('0x12')][_0x0050('0x13')]===0x1f4){logger[_0x0050('0x12')](_0x0050('0xe'),_0x5b0c26,_0x529f7f[_0x0050('0x12')][_0x0050('0x14')]);return _0x171228(_0x529f7f['error'][_0x0050('0x14')]);}logger[_0x0050('0x12')](_0x0050('0xe'),_0x5b0c26,_0x529f7f[_0x0050('0x12')][_0x0050('0x14')]);return _0x2798fa(_0x529f7f[_0x0050('0x12')][_0x0050('0x14')]);}else{logger['info'](_0x0050('0xe'),_0x5b0c26,_0x0050('0xf'));_0x2798fa(_0x529f7f['result']['message']);}})[_0x0050('0x15')](function(_0x4694ea){logger[_0x0050('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x5b0c26,_0x4694ea);_0x171228(_0x4694ea);});});}exports[_0x0050('0x16')]=function(_0x5948a6){var _0x241277=this;return new Promise(function(_0x2726d1,_0x15fd37){return db['ZendeskAccount']['findAll']({'raw':_0x5948a6['options']?_0x5948a6[_0x0050('0x17')][_0x0050('0x18')]===undefined?!![]:![]:!![],'where':_0x5948a6[_0x0050('0x17')]?_0x5948a6['options'][_0x0050('0x19')]||null:null,'attributes':_0x5948a6['options']?_0x5948a6['options'][_0x0050('0x1a')]||null:null,'limit':_0x5948a6[_0x0050('0x17')]?_0x5948a6['options'][_0x0050('0x1b')]||null:null,'include':_0x5948a6['options']?_0x5948a6[_0x0050('0x17')]['include']?_[_0x0050('0x1c')](_0x5948a6[_0x0050('0x17')][_0x0050('0x1d')],function(_0x382a47){return{'model':db[_0x382a47[_0x0050('0x1e')]],'as':_0x382a47['as'],'attributes':_0x382a47[_0x0050('0x1a')],'include':_0x382a47[_0x0050('0x1d')]?_[_0x0050('0x1c')](_0x382a47[_0x0050('0x1d')],function(_0x80b062){return{'model':db[_0x80b062[_0x0050('0x1e')]],'as':_0x80b062['as'],'attributes':_0x80b062[_0x0050('0x1a')],'include':_0x80b062['include']?_[_0x0050('0x1c')](_0x80b062[_0x0050('0x1d')],function(_0x550ee){return{'model':db[_0x550ee[_0x0050('0x1e')]],'as':_0x550ee['as'],'attributes':_0x550ee[_0x0050('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xefefdd){logger[_0x0050('0xd')](_0x0050('0x16'),_0x5948a6);logger[_0x0050('0x10')](_0x0050('0x16'),_0x5948a6,JSON[_0x0050('0x11')](_0xefefdd));_0x2726d1(_0xefefdd);})[_0x0050('0x15')](function(_0x3ee69a){logger[_0x0050('0x12')](_0x0050('0x16'),_0x3ee69a[_0x0050('0x14')],_0x5948a6);_0x15fd37(_0x241277[_0x0050('0x12')](0x1f4,_0x3ee69a['message']));});});};exports[_0x0050('0x1f')]=function(_0x3edfeb){var _0x52e8c1=this;return new Promise(function(_0x43b8ac,_0x5c80bd){return db[_0x0050('0x20')]['find']({'raw':_0x3edfeb['options']?_0x3edfeb[_0x0050('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3edfeb[_0x0050('0x17')]?_0x3edfeb[_0x0050('0x17')][_0x0050('0x19')]||null:null,'attributes':_0x3edfeb[_0x0050('0x17')]?_0x3edfeb[_0x0050('0x17')]['attributes']||null:null,'include':_0x3edfeb[_0x0050('0x17')]?_0x3edfeb[_0x0050('0x17')][_0x0050('0x1d')]?_[_0x0050('0x1c')](_0x3edfeb['options']['include'],function(_0x5586a2){return{'model':db[_0x5586a2[_0x0050('0x1e')]],'as':_0x5586a2['as'],'attributes':_0x5586a2[_0x0050('0x1a')],'include':_0x5586a2[_0x0050('0x1d')]?_['map'](_0x5586a2[_0x0050('0x1d')],function(_0x40bac4){return{'model':db[_0x40bac4['model']],'as':_0x40bac4['as'],'attributes':_0x40bac4['attributes'],'include':_0x40bac4[_0x0050('0x1d')]?_[_0x0050('0x1c')](_0x40bac4[_0x0050('0x1d')],function(_0x21a0fe){return{'model':db[_0x21a0fe[_0x0050('0x1e')]],'as':_0x21a0fe['as'],'attributes':_0x21a0fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x0050('0x21')](function(_0x2b8e55){logger[_0x0050('0xd')](_0x0050('0x1f'),_0x3edfeb);logger['debug']('ShowZendeskAccount',_0x3edfeb,JSON[_0x0050('0x11')](_0x2b8e55));_0x43b8ac(_0x2b8e55);})[_0x0050('0x15')](function(_0x18dc8c){logger['error'](_0x0050('0x1f'),_0x18dc8c[_0x0050('0x14')],_0x3edfeb);_0x5c80bd(_0x52e8c1[_0x0050('0x12')](0x1f4,_0x18dc8c[_0x0050('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 6b40fa4..91c9024 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 _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x18a0cd,_0x3c8958){var _0x14b94f=function(_0xc79605){while(--_0xc79605){_0x18a0cd['push'](_0x18a0cd['shift']());}};_0x14b94f(++_0x3c8958);}(_0xa571,0x107));var _0x1a57=function(_0x4bac73,_0x140bd6){_0x4bac73=_0x4bac73-0x0;var _0x15f994=_0xa571[_0x4bac73];return _0x15f994;};'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('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file +var _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x5e9fc1,_0x55da46){var _0x185f78=function(_0x50c23a){while(--_0x50c23a){_0x5e9fc1['push'](_0x5e9fc1['shift']());}};_0x185f78(++_0x55da46);}(_0x91a7,0xe7));var _0x791a=function(_0x310227,_0x25eb57){_0x310227=_0x310227-0x0;var _0x4a3da3=_0x91a7[_0x310227];return _0x4a3da3;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4baceb3..8972b8b 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 _0xb839=['sequelize','exports','STRING'];(function(_0x5f1979,_0x19567c){var _0xca1c19=function(_0x1e2760){while(--_0x1e2760){_0x5f1979['push'](_0x5f1979['shift']());}};_0xca1c19(++_0x19567c);}(_0xb839,0xcf));var _0x9b83=function(_0x2d8fcb,_0x57429f){_0x2d8fcb=_0x2d8fcb-0x0;var _0x4f417c=_0xb839[_0x2d8fcb];return _0x4f417c;};'use strict';var Sequelize=require(_0x9b83('0x0'));module[_0x9b83('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9b83('0x2')]}}; \ No newline at end of file +var _0x5c1c=['STRING','sequelize'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x5c1c,0x1cd));var _0xc5c1=function(_0x2ccde1,_0x517b95){_0x2ccde1=_0x2ccde1-0x0;var _0x5ace01=_0x5c1c[_0x2ccde1];return _0x5ace01;};'use strict';var Sequelize=require(_0xc5c1('0x0'));module['exports']={'name':{'type':Sequelize[_0xc5c1('0x1')]},'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 913d0fb..b3a6e38 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 _0xccf8=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','params','rawAttributes','includeAll','find','catch','create','body','destroy','findOne','getFields','nolimit','getSubjects','ZendeskField','getDescriptions','getTags','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','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','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','end','stack','name','index','map','ZendeskConfiguration','fieldName','type','key','model'];(function(_0x419d15,_0x135a88){var _0x5e8150=function(_0x20fb2e){while(--_0x20fb2e){_0x419d15['push'](_0x419d15['shift']());}};_0x5e8150(++_0x135a88);}(_0xccf8,0x167));var _0x8ccf=function(_0x101553,_0x4ff636){_0x101553=_0x101553-0x0;var _0x4620ae=_0xccf8[_0x101553];return _0x4620ae;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8ccf('0x0'));var jsonpatch=require(_0x8ccf('0x1'));var rp=require(_0x8ccf('0x2'));var moment=require(_0x8ccf('0x3'));var BPromise=require(_0x8ccf('0x4'));var Mustache=require('mustache');var util=require(_0x8ccf('0x5'));var path=require(_0x8ccf('0x6'));var sox=require('sox');var csv=require(_0x8ccf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ccf('0x8'));var _=require('lodash');var squel=require(_0x8ccf('0x9'));var crypto=require(_0x8ccf('0xa'));var jsforce=require(_0x8ccf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8ccf('0x7'));var querystring=require(_0x8ccf('0xc'));var Papa=require(_0x8ccf('0xd'));var Redis=require(_0x8ccf('0xe'));var authService=require(_0x8ccf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8ccf('0x10'));var hardwareService=require(_0x8ccf('0x11'));var logger=require(_0x8ccf('0x12'))(_0x8ccf('0x13'));var utils=require('../../config/utils');var config=require(_0x8ccf('0x14'));var licenseUtil=require(_0x8ccf('0x15'));var db=require(_0x8ccf('0x16'))['db'];function respondWithStatusCode(_0x573b96,_0x598ecd){_0x598ecd=_0x598ecd||0xcc;return function(_0x2f3bb6){if(_0x2f3bb6){return _0x573b96[_0x8ccf('0x17')](_0x598ecd);}return _0x573b96[_0x8ccf('0x18')](_0x598ecd)['end']();};}function respondWithResult(_0x55156d,_0x439e37){_0x439e37=_0x439e37||0xc8;return function(_0x300820){if(_0x300820){return _0x55156d[_0x8ccf('0x18')](_0x439e37)[_0x8ccf('0x19')](_0x300820);}};}function respondWithFilteredResult(_0x59cc30,_0x4c8796){return function(_0x538051){if(_0x538051){var _0x184322=typeof _0x4c8796[_0x8ccf('0x1a')]==='undefined'&&typeof _0x4c8796[_0x8ccf('0x1b')]===_0x8ccf('0x1c');var _0x3c8053=_0x538051[_0x8ccf('0x1d')];var _0x20720e=_0x184322?0x0:_0x4c8796[_0x8ccf('0x1a')];var _0x25ac0f=_0x184322?_0x538051[_0x8ccf('0x1d')]:_0x4c8796[_0x8ccf('0x1a')]+_0x4c8796[_0x8ccf('0x1b')];var _0x259022;if(_0x25ac0f>=_0x3c8053){_0x25ac0f=_0x3c8053;_0x259022=0xc8;}else{_0x259022=0xce;}_0x59cc30[_0x8ccf('0x18')](_0x259022);return _0x59cc30[_0x8ccf('0x1e')](_0x8ccf('0x1f'),_0x20720e+'-'+_0x25ac0f+'/'+_0x3c8053)[_0x8ccf('0x19')](_0x538051);}return null;};}function patchUpdates(_0x2f0e13){return function(_0x4e9ecb){try{jsonpatch[_0x8ccf('0x20')](_0x4e9ecb,_0x2f0e13,!![]);}catch(_0xd10ea){return BPromise[_0x8ccf('0x21')](_0xd10ea);}return _0x4e9ecb['save']();};}function saveUpdates(_0x37f11d,_0x33b0df){return function(_0x5a0925){if(_0x5a0925){return _0x5a0925[_0x8ccf('0x22')](_0x37f11d)[_0x8ccf('0x23')](function(_0x2044dc){return _0x2044dc;});}return null;};}function removeEntity(_0x35a039,_0x59cddb){return function(_0x5d0988){if(_0x5d0988){return _0x5d0988['destroy']()[_0x8ccf('0x23')](function(){_0x35a039[_0x8ccf('0x18')](0xcc)[_0x8ccf('0x24')]();});}};}function handleEntityNotFound(_0xe6a3b2,_0x4bf5a4){return function(_0x39371a){if(!_0x39371a){_0xe6a3b2['sendStatus'](0x194);}return _0x39371a;};}function handleError(_0x5ba32a,_0x29d1f4){_0x29d1f4=_0x29d1f4||0x1f4;return function(_0x245db4){logger['error'](_0x245db4[_0x8ccf('0x25')]);if(_0x245db4[_0x8ccf('0x26')]){delete _0x245db4['name'];}_0x5ba32a[_0x8ccf('0x18')](_0x29d1f4)['send'](_0x245db4);};}exports[_0x8ccf('0x27')]=function(_0x5c72eb,_0x2e65b9){var _0x5b30b1={},_0x3734ac={},_0x5610ad={'count':0x0,'rows':[]};var _0x5666f5=_[_0x8ccf('0x28')](db[_0x8ccf('0x29')]['rawAttributes'],function(_0x527540){return{'name':_0x527540[_0x8ccf('0x2a')],'type':_0x527540[_0x8ccf('0x2b')][_0x8ccf('0x2c')]};});_0x3734ac[_0x8ccf('0x2d')]=_[_0x8ccf('0x28')](_0x5666f5,_0x8ccf('0x26'));_0x3734ac[_0x8ccf('0x2e')]=_[_0x8ccf('0x2f')](_0x5c72eb[_0x8ccf('0x2e')]);_0x3734ac[_0x8ccf('0x30')]=_[_0x8ccf('0x31')](_0x3734ac['model'],_0x3734ac[_0x8ccf('0x2e')]);_0x5b30b1['attributes']=_[_0x8ccf('0x31')](_0x3734ac[_0x8ccf('0x2d')],qs[_0x8ccf('0x32')](_0x5c72eb[_0x8ccf('0x2e')][_0x8ccf('0x32')]));_0x5b30b1['attributes']=_0x5b30b1[_0x8ccf('0x33')][_0x8ccf('0x34')]?_0x5b30b1['attributes']:_0x3734ac[_0x8ccf('0x2d')];if(!_0x5c72eb[_0x8ccf('0x2e')][_0x8ccf('0x35')]('nolimit')){_0x5b30b1[_0x8ccf('0x1b')]=qs[_0x8ccf('0x1b')](_0x5c72eb[_0x8ccf('0x2e')][_0x8ccf('0x1b')]);_0x5b30b1[_0x8ccf('0x1a')]=qs['offset'](_0x5c72eb[_0x8ccf('0x2e')]['offset']);}_0x5b30b1[_0x8ccf('0x36')]=qs[_0x8ccf('0x37')](_0x5c72eb[_0x8ccf('0x2e')][_0x8ccf('0x37')]);_0x5b30b1[_0x8ccf('0x38')]=qs[_0x8ccf('0x30')](_[_0x8ccf('0x39')](_0x5c72eb[_0x8ccf('0x2e')],_0x3734ac[_0x8ccf('0x30')]),_0x5666f5);if(_0x5c72eb[_0x8ccf('0x2e')][_0x8ccf('0x3a')]){_0x5b30b1[_0x8ccf('0x38')]=_[_0x8ccf('0x3b')](_0x5b30b1[_0x8ccf('0x38')],{'$or':_['map'](_0x5666f5,function(_0x3bbee1){if(_0x3bbee1[_0x8ccf('0x2b')]!==_0x8ccf('0x3c')){var _0x4a61d4={};_0x4a61d4[_0x3bbee1[_0x8ccf('0x26')]]={'$like':'%'+_0x5c72eb[_0x8ccf('0x2e')][_0x8ccf('0x3a')]+'%'};return _0x4a61d4;}})});}_0x5b30b1=_[_0x8ccf('0x3b')]({},_0x5b30b1,_0x5c72eb[_0x8ccf('0x3d')]);var _0x300e52={'where':_0x5b30b1[_0x8ccf('0x38')]};return db[_0x8ccf('0x29')]['count'](_0x300e52)['then'](function(_0x48e252){_0x5610ad[_0x8ccf('0x1d')]=_0x48e252;if(_0x5c72eb[_0x8ccf('0x2e')]['includeAll']){_0x5b30b1[_0x8ccf('0x3e')]=[{'all':!![]}];}return db[_0x8ccf('0x29')][_0x8ccf('0x3f')](_0x5b30b1);})[_0x8ccf('0x23')](function(_0x31e172){_0x5610ad['rows']=_0x31e172;return _0x5610ad;})[_0x8ccf('0x23')](respondWithFilteredResult(_0x2e65b9,_0x5b30b1))['catch'](handleError(_0x2e65b9,null));};exports['show']=function(_0x24fee4,_0x18e3e6){var _0x5585df={'raw':![],'where':{'id':_0x24fee4[_0x8ccf('0x40')]['id']}},_0x25e06b={};_0x25e06b['model']=_[_0x8ccf('0x2f')](db[_0x8ccf('0x29')][_0x8ccf('0x41')]);_0x25e06b[_0x8ccf('0x2e')]=_[_0x8ccf('0x2f')](_0x24fee4['query']);_0x25e06b['filters']=_[_0x8ccf('0x31')](_0x25e06b['model'],_0x25e06b[_0x8ccf('0x2e')]);_0x5585df[_0x8ccf('0x33')]=_[_0x8ccf('0x31')](_0x25e06b[_0x8ccf('0x2d')],qs[_0x8ccf('0x32')](_0x24fee4[_0x8ccf('0x2e')][_0x8ccf('0x32')]));_0x5585df[_0x8ccf('0x33')]=_0x5585df[_0x8ccf('0x33')][_0x8ccf('0x34')]?_0x5585df['attributes']:_0x25e06b[_0x8ccf('0x2d')];if(_0x24fee4[_0x8ccf('0x2e')][_0x8ccf('0x42')]){_0x5585df[_0x8ccf('0x3e')]=[{'all':!![]}];}_0x5585df=_[_0x8ccf('0x3b')]({},_0x5585df,_0x24fee4[_0x8ccf('0x3d')]);return db[_0x8ccf('0x29')][_0x8ccf('0x43')](_0x5585df)[_0x8ccf('0x23')](handleEntityNotFound(_0x18e3e6,null))['then'](respondWithResult(_0x18e3e6,null))[_0x8ccf('0x44')](handleError(_0x18e3e6,null));};exports['create']=function(_0x78cbca,_0x4a2022){return db[_0x8ccf('0x29')][_0x8ccf('0x45')](_0x78cbca['body'],{})['then'](respondWithResult(_0x4a2022,0xc9))[_0x8ccf('0x44')](handleError(_0x4a2022,null));};exports[_0x8ccf('0x22')]=function(_0x659ad5,_0x236ef7){if(_0x659ad5['body']['id']){delete _0x659ad5[_0x8ccf('0x46')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x659ad5[_0x8ccf('0x40')]['id']}})[_0x8ccf('0x23')](handleEntityNotFound(_0x236ef7,null))[_0x8ccf('0x23')](saveUpdates(_0x659ad5[_0x8ccf('0x46')],null))[_0x8ccf('0x23')](respondWithResult(_0x236ef7,null))[_0x8ccf('0x44')](handleError(_0x236ef7,null));};exports[_0x8ccf('0x47')]=function(_0x37576a,_0x286956){return db[_0x8ccf('0x29')][_0x8ccf('0x43')]({'where':{'id':_0x37576a['params']['id']}})[_0x8ccf('0x23')](handleEntityNotFound(_0x286956,null))[_0x8ccf('0x23')](removeEntity(_0x286956,null))[_0x8ccf('0x44')](handleError(_0x286956,null));};exports['getFields']=function(_0x123d7a,_0x5569ea,_0x1e6940){var _0x1b6954={};var _0x211121={};var _0x1934d3;var _0x1c608e;return db[_0x8ccf('0x29')][_0x8ccf('0x48')]({'where':{'id':_0x123d7a['params']['id']}})[_0x8ccf('0x23')](handleEntityNotFound(_0x5569ea,null))[_0x8ccf('0x23')](function(_0x19ed0a){if(_0x19ed0a){_0x1934d3=_0x19ed0a;_0x211121[_0x8ccf('0x2d')]=_[_0x8ccf('0x2f')](db['ZendeskField']['rawAttributes']);_0x211121[_0x8ccf('0x2e')]=_['keys'](_0x123d7a[_0x8ccf('0x2e')]);_0x211121[_0x8ccf('0x30')]=_['intersection'](_0x211121[_0x8ccf('0x2d')],_0x211121[_0x8ccf('0x2e')]);_0x1b6954[_0x8ccf('0x33')]=_[_0x8ccf('0x31')](_0x211121[_0x8ccf('0x2d')],qs[_0x8ccf('0x32')](_0x123d7a[_0x8ccf('0x2e')][_0x8ccf('0x32')]));_0x1b6954['attributes']=_0x1b6954[_0x8ccf('0x33')]['length']?_0x1b6954[_0x8ccf('0x33')]:_0x211121[_0x8ccf('0x2d')];_0x1b6954[_0x8ccf('0x36')]=qs[_0x8ccf('0x37')](_0x123d7a[_0x8ccf('0x2e')][_0x8ccf('0x37')]);_0x1b6954['where']=qs[_0x8ccf('0x30')](_[_0x8ccf('0x39')](_0x123d7a[_0x8ccf('0x2e')],_0x211121[_0x8ccf('0x30')]));if(_0x123d7a['query']['filter']){_0x1b6954[_0x8ccf('0x38')]=_['merge'](_0x1b6954[_0x8ccf('0x38')],{'$or':_[_0x8ccf('0x28')](_0x1b6954[_0x8ccf('0x33')],function(_0xc5a042){var _0x472a4e={};_0x472a4e[_0xc5a042]={'$like':'%'+_0x123d7a[_0x8ccf('0x2e')][_0x8ccf('0x3a')]+'%'};return _0x472a4e;})});}_0x1b6954=_[_0x8ccf('0x3b')]({},_0x1b6954,_0x123d7a[_0x8ccf('0x3d')]);return _0x1934d3[_0x8ccf('0x49')](_0x1b6954);}})[_0x8ccf('0x23')](function(_0x44e06f){if(_0x44e06f){_0x1c608e=_0x44e06f[_0x8ccf('0x34')];if(!_0x123d7a[_0x8ccf('0x2e')][_0x8ccf('0x35')](_0x8ccf('0x4a'))){_0x1b6954[_0x8ccf('0x1b')]=qs[_0x8ccf('0x1b')](_0x123d7a[_0x8ccf('0x2e')][_0x8ccf('0x1b')]);_0x1b6954[_0x8ccf('0x1a')]=qs['offset'](_0x123d7a[_0x8ccf('0x2e')][_0x8ccf('0x1a')]);}return _0x1934d3[_0x8ccf('0x49')](_0x1b6954);}})[_0x8ccf('0x23')](function(_0x11e283){if(_0x11e283){return _0x11e283?{'count':_0x1c608e,'rows':_0x11e283}:null;}})[_0x8ccf('0x23')](respondWithResult(_0x5569ea,null))[_0x8ccf('0x44')](handleError(_0x5569ea,null));};exports[_0x8ccf('0x4b')]=function(_0x22d6bf,_0x2f19b8,_0x55b5ed){var _0x107360={};var _0x448de4={};var _0x4a8767;var _0x9493b2;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x22d6bf['params']['id']}})[_0x8ccf('0x23')](handleEntityNotFound(_0x2f19b8,null))['then'](function(_0x3a894f){if(_0x3a894f){_0x4a8767=_0x3a894f;_0x448de4[_0x8ccf('0x2d')]=_[_0x8ccf('0x2f')](db[_0x8ccf('0x4c')][_0x8ccf('0x41')]);_0x448de4[_0x8ccf('0x2e')]=_[_0x8ccf('0x2f')](_0x22d6bf[_0x8ccf('0x2e')]);_0x448de4[_0x8ccf('0x30')]=_[_0x8ccf('0x31')](_0x448de4['model'],_0x448de4[_0x8ccf('0x2e')]);_0x107360[_0x8ccf('0x33')]=_[_0x8ccf('0x31')](_0x448de4[_0x8ccf('0x2d')],qs[_0x8ccf('0x32')](_0x22d6bf[_0x8ccf('0x2e')][_0x8ccf('0x32')]));_0x107360['attributes']=_0x107360[_0x8ccf('0x33')][_0x8ccf('0x34')]?_0x107360[_0x8ccf('0x33')]:_0x448de4[_0x8ccf('0x2d')];_0x107360[_0x8ccf('0x36')]=qs[_0x8ccf('0x37')](_0x22d6bf[_0x8ccf('0x2e')][_0x8ccf('0x37')]);_0x107360[_0x8ccf('0x38')]=qs[_0x8ccf('0x30')](_[_0x8ccf('0x39')](_0x22d6bf['query'],_0x448de4[_0x8ccf('0x30')]));if(_0x22d6bf[_0x8ccf('0x2e')]['filter']){_0x107360[_0x8ccf('0x38')]=_[_0x8ccf('0x3b')](_0x107360['where'],{'$or':_[_0x8ccf('0x28')](_0x107360['attributes'],function(_0x140a75){var _0x56234b={};_0x56234b[_0x140a75]={'$like':'%'+_0x22d6bf[_0x8ccf('0x2e')][_0x8ccf('0x3a')]+'%'};return _0x56234b;})});}_0x107360=_[_0x8ccf('0x3b')]({},_0x107360,_0x22d6bf[_0x8ccf('0x3d')]);return _0x4a8767[_0x8ccf('0x4b')](_0x107360);}})[_0x8ccf('0x23')](function(_0x3d81a7){if(_0x3d81a7){_0x9493b2=_0x3d81a7['length'];if(!_0x22d6bf[_0x8ccf('0x2e')][_0x8ccf('0x35')](_0x8ccf('0x4a'))){_0x107360[_0x8ccf('0x1b')]=qs[_0x8ccf('0x1b')](_0x22d6bf['query'][_0x8ccf('0x1b')]);_0x107360[_0x8ccf('0x1a')]=qs[_0x8ccf('0x1a')](_0x22d6bf['query'][_0x8ccf('0x1a')]);}return _0x4a8767[_0x8ccf('0x4b')](_0x107360);}})[_0x8ccf('0x23')](function(_0x2e4b53){if(_0x2e4b53){return _0x2e4b53?{'count':_0x9493b2,'rows':_0x2e4b53}:null;}})[_0x8ccf('0x23')](respondWithResult(_0x2f19b8,null))[_0x8ccf('0x44')](handleError(_0x2f19b8,null));};exports[_0x8ccf('0x4d')]=function(_0x225ba4,_0x3a0df9,_0x50ad3f){var _0x16aae9={};var _0x5b56fc={};var _0x2536c5;var _0x12f72f;return db[_0x8ccf('0x29')][_0x8ccf('0x48')]({'where':{'id':_0x225ba4[_0x8ccf('0x40')]['id']}})[_0x8ccf('0x23')](handleEntityNotFound(_0x3a0df9,null))['then'](function(_0xad15ca){if(_0xad15ca){_0x2536c5=_0xad15ca;_0x5b56fc[_0x8ccf('0x2d')]=_[_0x8ccf('0x2f')](db[_0x8ccf('0x4c')]['rawAttributes']);_0x5b56fc[_0x8ccf('0x2e')]=_[_0x8ccf('0x2f')](_0x225ba4[_0x8ccf('0x2e')]);_0x5b56fc['filters']=_[_0x8ccf('0x31')](_0x5b56fc[_0x8ccf('0x2d')],_0x5b56fc[_0x8ccf('0x2e')]);_0x16aae9[_0x8ccf('0x33')]=_['intersection'](_0x5b56fc['model'],qs['fields'](_0x225ba4[_0x8ccf('0x2e')][_0x8ccf('0x32')]));_0x16aae9['attributes']=_0x16aae9[_0x8ccf('0x33')][_0x8ccf('0x34')]?_0x16aae9[_0x8ccf('0x33')]:_0x5b56fc[_0x8ccf('0x2d')];_0x16aae9['order']=qs[_0x8ccf('0x37')](_0x225ba4[_0x8ccf('0x2e')][_0x8ccf('0x37')]);_0x16aae9[_0x8ccf('0x38')]=qs[_0x8ccf('0x30')](_['pick'](_0x225ba4[_0x8ccf('0x2e')],_0x5b56fc[_0x8ccf('0x30')]));if(_0x225ba4[_0x8ccf('0x2e')][_0x8ccf('0x3a')]){_0x16aae9[_0x8ccf('0x38')]=_[_0x8ccf('0x3b')](_0x16aae9[_0x8ccf('0x38')],{'$or':_[_0x8ccf('0x28')](_0x16aae9['attributes'],function(_0xc9ebf4){var _0x14b2b2={};_0x14b2b2[_0xc9ebf4]={'$like':'%'+_0x225ba4[_0x8ccf('0x2e')][_0x8ccf('0x3a')]+'%'};return _0x14b2b2;})});}_0x16aae9=_[_0x8ccf('0x3b')]({},_0x16aae9,_0x225ba4['options']);return _0x2536c5[_0x8ccf('0x4d')](_0x16aae9);}})[_0x8ccf('0x23')](function(_0x470dfe){if(_0x470dfe){_0x12f72f=_0x470dfe[_0x8ccf('0x34')];if(!_0x225ba4['query'][_0x8ccf('0x35')](_0x8ccf('0x4a'))){_0x16aae9[_0x8ccf('0x1b')]=qs[_0x8ccf('0x1b')](_0x225ba4[_0x8ccf('0x2e')]['limit']);_0x16aae9[_0x8ccf('0x1a')]=qs[_0x8ccf('0x1a')](_0x225ba4[_0x8ccf('0x2e')]['offset']);}return _0x2536c5['getDescriptions'](_0x16aae9);}})[_0x8ccf('0x23')](function(_0xd0f2b7){if(_0xd0f2b7){return _0xd0f2b7?{'count':_0x12f72f,'rows':_0xd0f2b7}:null;}})[_0x8ccf('0x23')](respondWithResult(_0x3a0df9,null))['catch'](handleError(_0x3a0df9,null));};exports[_0x8ccf('0x4e')]=function(_0x1a8cc5,_0x5e58f1,_0x33ceab){var _0x1d54cb={};var _0x5069f9={};var _0x49610c;var _0x2b2b4f;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1a8cc5[_0x8ccf('0x40')]['id']}})[_0x8ccf('0x23')](handleEntityNotFound(_0x5e58f1,null))[_0x8ccf('0x23')](function(_0xae7a56){if(_0xae7a56){_0x49610c=_0xae7a56;_0x5069f9[_0x8ccf('0x2d')]=_['keys'](db['Tag']['rawAttributes']);_0x5069f9[_0x8ccf('0x2e')]=_[_0x8ccf('0x2f')](_0x1a8cc5[_0x8ccf('0x2e')]);_0x5069f9[_0x8ccf('0x30')]=_[_0x8ccf('0x31')](_0x5069f9[_0x8ccf('0x2d')],_0x5069f9[_0x8ccf('0x2e')]);_0x1d54cb[_0x8ccf('0x33')]=_[_0x8ccf('0x31')](_0x5069f9['model'],qs['fields'](_0x1a8cc5['query']['fields']));_0x1d54cb['attributes']=_0x1d54cb[_0x8ccf('0x33')][_0x8ccf('0x34')]?_0x1d54cb[_0x8ccf('0x33')]:_0x5069f9[_0x8ccf('0x2d')];_0x1d54cb[_0x8ccf('0x36')]=qs[_0x8ccf('0x37')](_0x1a8cc5['query']['sort']);_0x1d54cb[_0x8ccf('0x38')]=qs[_0x8ccf('0x30')](_[_0x8ccf('0x39')](_0x1a8cc5[_0x8ccf('0x2e')],_0x5069f9[_0x8ccf('0x30')]));if(_0x1a8cc5['query'][_0x8ccf('0x3a')]){_0x1d54cb[_0x8ccf('0x38')]=_[_0x8ccf('0x3b')](_0x1d54cb[_0x8ccf('0x38')],{'$or':_['map'](_0x1d54cb['attributes'],function(_0xedcce0){var _0x2cf5a6={};_0x2cf5a6[_0xedcce0]={'$like':'%'+_0x1a8cc5[_0x8ccf('0x2e')][_0x8ccf('0x3a')]+'%'};return _0x2cf5a6;})});}_0x1d54cb=_[_0x8ccf('0x3b')]({},_0x1d54cb,_0x1a8cc5[_0x8ccf('0x3d')]);return _0x49610c[_0x8ccf('0x4e')](_0x1d54cb);}})[_0x8ccf('0x23')](function(_0x39a0e0){if(_0x39a0e0){_0x2b2b4f=_0x39a0e0[_0x8ccf('0x34')];if(!_0x1a8cc5[_0x8ccf('0x2e')][_0x8ccf('0x35')](_0x8ccf('0x4a'))){_0x1d54cb[_0x8ccf('0x1b')]=qs[_0x8ccf('0x1b')](_0x1a8cc5[_0x8ccf('0x2e')]['limit']);_0x1d54cb[_0x8ccf('0x1a')]=qs[_0x8ccf('0x1a')](_0x1a8cc5[_0x8ccf('0x2e')][_0x8ccf('0x1a')]);}return _0x49610c['getTags'](_0x1d54cb);}})[_0x8ccf('0x23')](function(_0x2211e4){if(_0x2211e4){return _0x2211e4?{'count':_0x2b2b4f,'rows':_0x2211e4}:null;}})[_0x8ccf('0x23')](respondWithResult(_0x5e58f1,null))[_0x8ccf('0x44')](handleError(_0x5e58f1,null));};exports[_0x8ccf('0x4f')]=function(_0x4424e0,_0xaa08e6,_0x37a2e0){if(_0x4424e0[_0x8ccf('0x46')]['id']){delete _0x4424e0[_0x8ccf('0x46')]['id'];}return db['ZendeskConfiguration'][_0x8ccf('0x48')]({'where':{'id':_0x4424e0[_0x8ccf('0x40')]['id']}})[_0x8ccf('0x23')](handleEntityNotFound(_0xaa08e6,null))[_0x8ccf('0x23')](function(_0x30e010){if(_0x30e010){return _0x30e010[_0x8ccf('0x4f')](_0x4424e0[_0x8ccf('0x46')][_0x8ccf('0x50')]||[]);}return null;})['then'](respondWithResult(_0xaa08e6,null))[_0x8ccf('0x44')](handleError(_0xaa08e6,null));}; \ No newline at end of file +var _0xa1bc=['../../config/license/util','status','json','offset','undefined','limit','count','set','apply','destroy','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','findAll','rows','then','catch','show','params','include','options','find','create','body','getFields','findOne','pick','ZendeskField','getSubjects','getDescriptions','getTags','Tag','nolimit','setTags','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x59e21c,_0x4d77b9){var _0x199b4c=function(_0x3034f0){while(--_0x3034f0){_0x59e21c['push'](_0x59e21c['shift']());}};_0x199b4c(++_0x4d77b9);}(_0xa1bc,0x1be));var _0xca1b=function(_0x3d5988,_0x241784){_0x3d5988=_0x3d5988-0x0;var _0x1f30a2=_0xa1bc[_0x3d5988];return _0x1f30a2;};'use strict';var emlformat=require(_0xca1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca1b('0x1'));var jsonpatch=require(_0xca1b('0x2'));var rp=require('request-promise');var moment=require(_0xca1b('0x3'));var BPromise=require(_0xca1b('0x4'));var Mustache=require('mustache');var util=require(_0xca1b('0x5'));var path=require(_0xca1b('0x6'));var sox=require(_0xca1b('0x7'));var csv=require('to-csv');var ejs=require(_0xca1b('0x8'));var fs=require('fs');var fs_extra=require(_0xca1b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xca1b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xca1b('0xb'));var toCsv=require(_0xca1b('0xc'));var querystring=require(_0xca1b('0xd'));var Papa=require(_0xca1b('0xe'));var Redis=require(_0xca1b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xca1b('0x10'));var hardwareService=require(_0xca1b('0x11'));var logger=require(_0xca1b('0x12'))(_0xca1b('0x13'));var utils=require(_0xca1b('0x14'));var config=require(_0xca1b('0x15'));var licenseUtil=require(_0xca1b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x90a9c1,_0xabd88c){_0xabd88c=_0xabd88c||0xcc;return function(_0x212912){if(_0x212912){return _0x90a9c1['sendStatus'](_0xabd88c);}return _0x90a9c1[_0xca1b('0x17')](_0xabd88c)['end']();};}function respondWithResult(_0x1e876e,_0x3dc614){_0x3dc614=_0x3dc614||0xc8;return function(_0x1c9a9d){if(_0x1c9a9d){return _0x1e876e[_0xca1b('0x17')](_0x3dc614)[_0xca1b('0x18')](_0x1c9a9d);}};}function respondWithFilteredResult(_0x3659f3,_0x221e2f){return function(_0x1bf453){if(_0x1bf453){var _0x3b1b02=typeof _0x221e2f[_0xca1b('0x19')]===_0xca1b('0x1a')&&typeof _0x221e2f[_0xca1b('0x1b')]==='undefined';var _0x4033e2=_0x1bf453[_0xca1b('0x1c')];var _0x13301e=_0x3b1b02?0x0:_0x221e2f[_0xca1b('0x19')];var _0x562bd2=_0x3b1b02?_0x1bf453[_0xca1b('0x1c')]:_0x221e2f[_0xca1b('0x19')]+_0x221e2f[_0xca1b('0x1b')];var _0x37c4d8;if(_0x562bd2>=_0x4033e2){_0x562bd2=_0x4033e2;_0x37c4d8=0xc8;}else{_0x37c4d8=0xce;}_0x3659f3[_0xca1b('0x17')](_0x37c4d8);return _0x3659f3[_0xca1b('0x1d')]('Content-Range',_0x13301e+'-'+_0x562bd2+'/'+_0x4033e2)[_0xca1b('0x18')](_0x1bf453);}return null;};}function patchUpdates(_0x177b40){return function(_0x23e406){try{jsonpatch[_0xca1b('0x1e')](_0x23e406,_0x177b40,!![]);}catch(_0x5d2386){return BPromise['reject'](_0x5d2386);}return _0x23e406['save']();};}function saveUpdates(_0x415207,_0x46a067){return function(_0x19e528){if(_0x19e528){return _0x19e528['update'](_0x415207)['then'](function(_0x430bfa){return _0x430bfa;});}return null;};}function removeEntity(_0x58d3fb,_0x4ec176){return function(_0x1cb20d){if(_0x1cb20d){return _0x1cb20d[_0xca1b('0x1f')]()['then'](function(){_0x58d3fb[_0xca1b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6a96,_0x5083b3){return function(_0x5586bf){if(!_0x5586bf){_0x1e6a96['sendStatus'](0x194);}return _0x5586bf;};}function handleError(_0x25fdf5,_0x3daf6f){_0x3daf6f=_0x3daf6f||0x1f4;return function(_0x5af9fe){logger[_0xca1b('0x20')](_0x5af9fe[_0xca1b('0x21')]);if(_0x5af9fe['name']){delete _0x5af9fe[_0xca1b('0x22')];}_0x25fdf5[_0xca1b('0x17')](_0x3daf6f)['send'](_0x5af9fe);};}exports[_0xca1b('0x23')]=function(_0x15323a,_0x201b58){var _0x422179={},_0x4d2b00={},_0x1fc19f={'count':0x0,'rows':[]};var _0x63357e=_[_0xca1b('0x24')](db[_0xca1b('0x25')][_0xca1b('0x26')],function(_0x14a55d){return{'name':_0x14a55d[_0xca1b('0x27')],'type':_0x14a55d[_0xca1b('0x28')][_0xca1b('0x29')]};});_0x4d2b00[_0xca1b('0x2a')]=_['map'](_0x63357e,_0xca1b('0x22'));_0x4d2b00[_0xca1b('0x2b')]=_[_0xca1b('0x2c')](_0x15323a[_0xca1b('0x2b')]);_0x4d2b00[_0xca1b('0x2d')]=_[_0xca1b('0x2e')](_0x4d2b00[_0xca1b('0x2a')],_0x4d2b00['query']);_0x422179[_0xca1b('0x2f')]=_['intersection'](_0x4d2b00['model'],qs[_0xca1b('0x30')](_0x15323a[_0xca1b('0x2b')][_0xca1b('0x30')]));_0x422179[_0xca1b('0x2f')]=_0x422179[_0xca1b('0x2f')][_0xca1b('0x31')]?_0x422179['attributes']:_0x4d2b00['model'];if(!_0x15323a[_0xca1b('0x2b')][_0xca1b('0x32')]('nolimit')){_0x422179[_0xca1b('0x1b')]=qs[_0xca1b('0x1b')](_0x15323a['query']['limit']);_0x422179['offset']=qs[_0xca1b('0x19')](_0x15323a[_0xca1b('0x2b')][_0xca1b('0x19')]);}_0x422179[_0xca1b('0x33')]=qs[_0xca1b('0x34')](_0x15323a['query']['sort']);_0x422179[_0xca1b('0x35')]=qs[_0xca1b('0x2d')](_['pick'](_0x15323a['query'],_0x4d2b00[_0xca1b('0x2d')]),_0x63357e);if(_0x15323a[_0xca1b('0x2b')][_0xca1b('0x36')]){_0x422179['where']=_[_0xca1b('0x37')](_0x422179['where'],{'$or':_[_0xca1b('0x24')](_0x63357e,function(_0x4eba9c){if(_0x4eba9c[_0xca1b('0x28')]!=='VIRTUAL'){var _0x422b31={};_0x422b31[_0x4eba9c[_0xca1b('0x22')]]={'$like':'%'+_0x15323a['query'][_0xca1b('0x36')]+'%'};return _0x422b31;}})});}_0x422179=_[_0xca1b('0x37')]({},_0x422179,_0x15323a['options']);var _0xa5ca12={'where':_0x422179[_0xca1b('0x35')]};return db['ZendeskConfiguration'][_0xca1b('0x1c')](_0xa5ca12)['then'](function(_0xf43548){_0x1fc19f[_0xca1b('0x1c')]=_0xf43548;if(_0x15323a[_0xca1b('0x2b')][_0xca1b('0x38')]){_0x422179['include']=[{'all':!![]}];}return db[_0xca1b('0x25')][_0xca1b('0x39')](_0x422179);})['then'](function(_0x24e387){_0x1fc19f[_0xca1b('0x3a')]=_0x24e387;return _0x1fc19f;})[_0xca1b('0x3b')](respondWithFilteredResult(_0x201b58,_0x422179))[_0xca1b('0x3c')](handleError(_0x201b58,null));};exports[_0xca1b('0x3d')]=function(_0x40c46f,_0x74496f){var _0x389ac3={'raw':![],'where':{'id':_0x40c46f[_0xca1b('0x3e')]['id']}},_0x151f9d={};_0x151f9d['model']=_[_0xca1b('0x2c')](db[_0xca1b('0x25')][_0xca1b('0x26')]);_0x151f9d[_0xca1b('0x2b')]=_[_0xca1b('0x2c')](_0x40c46f[_0xca1b('0x2b')]);_0x151f9d[_0xca1b('0x2d')]=_['intersection'](_0x151f9d['model'],_0x151f9d[_0xca1b('0x2b')]);_0x389ac3['attributes']=_['intersection'](_0x151f9d['model'],qs[_0xca1b('0x30')](_0x40c46f[_0xca1b('0x2b')][_0xca1b('0x30')]));_0x389ac3['attributes']=_0x389ac3[_0xca1b('0x2f')][_0xca1b('0x31')]?_0x389ac3['attributes']:_0x151f9d[_0xca1b('0x2a')];if(_0x40c46f[_0xca1b('0x2b')][_0xca1b('0x38')]){_0x389ac3[_0xca1b('0x3f')]=[{'all':!![]}];}_0x389ac3=_[_0xca1b('0x37')]({},_0x389ac3,_0x40c46f[_0xca1b('0x40')]);return db[_0xca1b('0x25')][_0xca1b('0x41')](_0x389ac3)[_0xca1b('0x3b')](handleEntityNotFound(_0x74496f,null))[_0xca1b('0x3b')](respondWithResult(_0x74496f,null))['catch'](handleError(_0x74496f,null));};exports['create']=function(_0x1754f4,_0x1aaed0){return db[_0xca1b('0x25')][_0xca1b('0x42')](_0x1754f4[_0xca1b('0x43')],{})['then'](respondWithResult(_0x1aaed0,0xc9))[_0xca1b('0x3c')](handleError(_0x1aaed0,null));};exports['update']=function(_0x17e990,_0x330bee){if(_0x17e990['body']['id']){delete _0x17e990['body']['id'];}return db[_0xca1b('0x25')][_0xca1b('0x41')]({'where':{'id':_0x17e990[_0xca1b('0x3e')]['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0x330bee,null))['then'](saveUpdates(_0x17e990['body'],null))['then'](respondWithResult(_0x330bee,null))[_0xca1b('0x3c')](handleError(_0x330bee,null));};exports[_0xca1b('0x1f')]=function(_0x170238,_0x2595a6){return db[_0xca1b('0x25')][_0xca1b('0x41')]({'where':{'id':_0x170238[_0xca1b('0x3e')]['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0x2595a6,null))[_0xca1b('0x3b')](removeEntity(_0x2595a6,null))[_0xca1b('0x3c')](handleError(_0x2595a6,null));};exports[_0xca1b('0x44')]=function(_0xe2417c,_0x4ff6ce,_0x344caa){var _0x323929={};var _0x20a4ed={};var _0x238865;var _0x373c33;return db[_0xca1b('0x25')][_0xca1b('0x45')]({'where':{'id':_0xe2417c[_0xca1b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4ff6ce,null))['then'](function(_0x217861){if(_0x217861){_0x238865=_0x217861;_0x20a4ed[_0xca1b('0x2a')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x20a4ed[_0xca1b('0x2b')]=_[_0xca1b('0x2c')](_0xe2417c[_0xca1b('0x2b')]);_0x20a4ed[_0xca1b('0x2d')]=_[_0xca1b('0x2e')](_0x20a4ed[_0xca1b('0x2a')],_0x20a4ed[_0xca1b('0x2b')]);_0x323929[_0xca1b('0x2f')]=_[_0xca1b('0x2e')](_0x20a4ed[_0xca1b('0x2a')],qs[_0xca1b('0x30')](_0xe2417c[_0xca1b('0x2b')][_0xca1b('0x30')]));_0x323929[_0xca1b('0x2f')]=_0x323929['attributes']['length']?_0x323929[_0xca1b('0x2f')]:_0x20a4ed['model'];_0x323929[_0xca1b('0x33')]=qs['sort'](_0xe2417c[_0xca1b('0x2b')][_0xca1b('0x34')]);_0x323929['where']=qs[_0xca1b('0x2d')](_[_0xca1b('0x46')](_0xe2417c['query'],_0x20a4ed[_0xca1b('0x2d')]));if(_0xe2417c[_0xca1b('0x2b')][_0xca1b('0x36')]){_0x323929[_0xca1b('0x35')]=_['merge'](_0x323929[_0xca1b('0x35')],{'$or':_[_0xca1b('0x24')](_0x323929[_0xca1b('0x2f')],function(_0x2d3ac0){var _0x597231={};_0x597231[_0x2d3ac0]={'$like':'%'+_0xe2417c['query']['filter']+'%'};return _0x597231;})});}_0x323929=_[_0xca1b('0x37')]({},_0x323929,_0xe2417c['options']);return _0x238865['getFields'](_0x323929);}})['then'](function(_0x5dc450){if(_0x5dc450){_0x373c33=_0x5dc450[_0xca1b('0x31')];if(!_0xe2417c[_0xca1b('0x2b')][_0xca1b('0x32')]('nolimit')){_0x323929[_0xca1b('0x1b')]=qs['limit'](_0xe2417c['query'][_0xca1b('0x1b')]);_0x323929['offset']=qs[_0xca1b('0x19')](_0xe2417c[_0xca1b('0x2b')][_0xca1b('0x19')]);}return _0x238865[_0xca1b('0x44')](_0x323929);}})['then'](function(_0x2fc220){if(_0x2fc220){return _0x2fc220?{'count':_0x373c33,'rows':_0x2fc220}:null;}})[_0xca1b('0x3b')](respondWithResult(_0x4ff6ce,null))[_0xca1b('0x3c')](handleError(_0x4ff6ce,null));};exports['getSubjects']=function(_0x1d3baa,_0x423100,_0x3945c4){var _0x4ce132={};var _0x3576b9={};var _0x15d412;var _0x3b350c;return db['ZendeskConfiguration'][_0xca1b('0x45')]({'where':{'id':_0x1d3baa[_0xca1b('0x3e')]['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0x423100,null))['then'](function(_0x51496f){if(_0x51496f){_0x15d412=_0x51496f;_0x3576b9[_0xca1b('0x2a')]=_['keys'](db[_0xca1b('0x47')][_0xca1b('0x26')]);_0x3576b9[_0xca1b('0x2b')]=_[_0xca1b('0x2c')](_0x1d3baa[_0xca1b('0x2b')]);_0x3576b9[_0xca1b('0x2d')]=_[_0xca1b('0x2e')](_0x3576b9['model'],_0x3576b9[_0xca1b('0x2b')]);_0x4ce132[_0xca1b('0x2f')]=_['intersection'](_0x3576b9[_0xca1b('0x2a')],qs[_0xca1b('0x30')](_0x1d3baa[_0xca1b('0x2b')][_0xca1b('0x30')]));_0x4ce132[_0xca1b('0x2f')]=_0x4ce132[_0xca1b('0x2f')][_0xca1b('0x31')]?_0x4ce132[_0xca1b('0x2f')]:_0x3576b9[_0xca1b('0x2a')];_0x4ce132['order']=qs[_0xca1b('0x34')](_0x1d3baa[_0xca1b('0x2b')]['sort']);_0x4ce132[_0xca1b('0x35')]=qs[_0xca1b('0x2d')](_[_0xca1b('0x46')](_0x1d3baa[_0xca1b('0x2b')],_0x3576b9[_0xca1b('0x2d')]));if(_0x1d3baa[_0xca1b('0x2b')]['filter']){_0x4ce132[_0xca1b('0x35')]=_[_0xca1b('0x37')](_0x4ce132[_0xca1b('0x35')],{'$or':_['map'](_0x4ce132[_0xca1b('0x2f')],function(_0x5a3714){var _0x3085a3={};_0x3085a3[_0x5a3714]={'$like':'%'+_0x1d3baa[_0xca1b('0x2b')][_0xca1b('0x36')]+'%'};return _0x3085a3;})});}_0x4ce132=_['merge']({},_0x4ce132,_0x1d3baa[_0xca1b('0x40')]);return _0x15d412['getSubjects'](_0x4ce132);}})[_0xca1b('0x3b')](function(_0x496537){if(_0x496537){_0x3b350c=_0x496537[_0xca1b('0x31')];if(!_0x1d3baa['query']['hasOwnProperty']('nolimit')){_0x4ce132[_0xca1b('0x1b')]=qs['limit'](_0x1d3baa[_0xca1b('0x2b')]['limit']);_0x4ce132['offset']=qs[_0xca1b('0x19')](_0x1d3baa[_0xca1b('0x2b')][_0xca1b('0x19')]);}return _0x15d412[_0xca1b('0x48')](_0x4ce132);}})[_0xca1b('0x3b')](function(_0xf62435){if(_0xf62435){return _0xf62435?{'count':_0x3b350c,'rows':_0xf62435}:null;}})[_0xca1b('0x3b')](respondWithResult(_0x423100,null))['catch'](handleError(_0x423100,null));};exports[_0xca1b('0x49')]=function(_0x214019,_0x292d3b,_0x46eb26){var _0x46fa8c={};var _0x54056b={};var _0x3db795;var _0x2e4498;return db[_0xca1b('0x25')][_0xca1b('0x45')]({'where':{'id':_0x214019[_0xca1b('0x3e')]['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0x292d3b,null))[_0xca1b('0x3b')](function(_0xf0bf31){if(_0xf0bf31){_0x3db795=_0xf0bf31;_0x54056b[_0xca1b('0x2a')]=_[_0xca1b('0x2c')](db[_0xca1b('0x47')][_0xca1b('0x26')]);_0x54056b[_0xca1b('0x2b')]=_['keys'](_0x214019[_0xca1b('0x2b')]);_0x54056b[_0xca1b('0x2d')]=_[_0xca1b('0x2e')](_0x54056b['model'],_0x54056b['query']);_0x46fa8c[_0xca1b('0x2f')]=_[_0xca1b('0x2e')](_0x54056b[_0xca1b('0x2a')],qs[_0xca1b('0x30')](_0x214019['query'][_0xca1b('0x30')]));_0x46fa8c[_0xca1b('0x2f')]=_0x46fa8c[_0xca1b('0x2f')][_0xca1b('0x31')]?_0x46fa8c[_0xca1b('0x2f')]:_0x54056b['model'];_0x46fa8c[_0xca1b('0x33')]=qs[_0xca1b('0x34')](_0x214019[_0xca1b('0x2b')][_0xca1b('0x34')]);_0x46fa8c[_0xca1b('0x35')]=qs['filters'](_[_0xca1b('0x46')](_0x214019[_0xca1b('0x2b')],_0x54056b[_0xca1b('0x2d')]));if(_0x214019[_0xca1b('0x2b')][_0xca1b('0x36')]){_0x46fa8c['where']=_[_0xca1b('0x37')](_0x46fa8c[_0xca1b('0x35')],{'$or':_[_0xca1b('0x24')](_0x46fa8c[_0xca1b('0x2f')],function(_0x13a747){var _0x53b9c4={};_0x53b9c4[_0x13a747]={'$like':'%'+_0x214019['query'][_0xca1b('0x36')]+'%'};return _0x53b9c4;})});}_0x46fa8c=_['merge']({},_0x46fa8c,_0x214019[_0xca1b('0x40')]);return _0x3db795[_0xca1b('0x49')](_0x46fa8c);}})[_0xca1b('0x3b')](function(_0x423638){if(_0x423638){_0x2e4498=_0x423638[_0xca1b('0x31')];if(!_0x214019['query']['hasOwnProperty']('nolimit')){_0x46fa8c[_0xca1b('0x1b')]=qs['limit'](_0x214019[_0xca1b('0x2b')][_0xca1b('0x1b')]);_0x46fa8c[_0xca1b('0x19')]=qs[_0xca1b('0x19')](_0x214019[_0xca1b('0x2b')]['offset']);}return _0x3db795['getDescriptions'](_0x46fa8c);}})['then'](function(_0x4efacb){if(_0x4efacb){return _0x4efacb?{'count':_0x2e4498,'rows':_0x4efacb}:null;}})['then'](respondWithResult(_0x292d3b,null))[_0xca1b('0x3c')](handleError(_0x292d3b,null));};exports[_0xca1b('0x4a')]=function(_0xe06cf9,_0xec8601,_0x44ea91){var _0x4a3abf={};var _0x252053={};var _0x1721b6;var _0x55506a;return db['ZendeskConfiguration'][_0xca1b('0x45')]({'where':{'id':_0xe06cf9[_0xca1b('0x3e')]['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0xec8601,null))[_0xca1b('0x3b')](function(_0x43565a){if(_0x43565a){_0x1721b6=_0x43565a;_0x252053[_0xca1b('0x2a')]=_[_0xca1b('0x2c')](db[_0xca1b('0x4b')][_0xca1b('0x26')]);_0x252053[_0xca1b('0x2b')]=_[_0xca1b('0x2c')](_0xe06cf9[_0xca1b('0x2b')]);_0x252053[_0xca1b('0x2d')]=_[_0xca1b('0x2e')](_0x252053[_0xca1b('0x2a')],_0x252053['query']);_0x4a3abf[_0xca1b('0x2f')]=_[_0xca1b('0x2e')](_0x252053[_0xca1b('0x2a')],qs[_0xca1b('0x30')](_0xe06cf9[_0xca1b('0x2b')][_0xca1b('0x30')]));_0x4a3abf[_0xca1b('0x2f')]=_0x4a3abf['attributes'][_0xca1b('0x31')]?_0x4a3abf['attributes']:_0x252053[_0xca1b('0x2a')];_0x4a3abf[_0xca1b('0x33')]=qs['sort'](_0xe06cf9[_0xca1b('0x2b')][_0xca1b('0x34')]);_0x4a3abf[_0xca1b('0x35')]=qs[_0xca1b('0x2d')](_[_0xca1b('0x46')](_0xe06cf9['query'],_0x252053[_0xca1b('0x2d')]));if(_0xe06cf9[_0xca1b('0x2b')][_0xca1b('0x36')]){_0x4a3abf['where']=_['merge'](_0x4a3abf[_0xca1b('0x35')],{'$or':_[_0xca1b('0x24')](_0x4a3abf[_0xca1b('0x2f')],function(_0x179774){var _0x20d9c1={};_0x20d9c1[_0x179774]={'$like':'%'+_0xe06cf9[_0xca1b('0x2b')]['filter']+'%'};return _0x20d9c1;})});}_0x4a3abf=_[_0xca1b('0x37')]({},_0x4a3abf,_0xe06cf9[_0xca1b('0x40')]);return _0x1721b6[_0xca1b('0x4a')](_0x4a3abf);}})[_0xca1b('0x3b')](function(_0x3d9889){if(_0x3d9889){_0x55506a=_0x3d9889[_0xca1b('0x31')];if(!_0xe06cf9[_0xca1b('0x2b')][_0xca1b('0x32')](_0xca1b('0x4c'))){_0x4a3abf[_0xca1b('0x1b')]=qs[_0xca1b('0x1b')](_0xe06cf9[_0xca1b('0x2b')][_0xca1b('0x1b')]);_0x4a3abf[_0xca1b('0x19')]=qs[_0xca1b('0x19')](_0xe06cf9[_0xca1b('0x2b')]['offset']);}return _0x1721b6[_0xca1b('0x4a')](_0x4a3abf);}})[_0xca1b('0x3b')](function(_0x1940b6){if(_0x1940b6){return _0x1940b6?{'count':_0x55506a,'rows':_0x1940b6}:null;}})['then'](respondWithResult(_0xec8601,null))[_0xca1b('0x3c')](handleError(_0xec8601,null));};exports[_0xca1b('0x4d')]=function(_0x5cf916,_0x7dd06c,_0x124e2d){if(_0x5cf916[_0xca1b('0x43')]['id']){delete _0x5cf916[_0xca1b('0x43')]['id'];}return db[_0xca1b('0x25')][_0xca1b('0x45')]({'where':{'id':_0x5cf916['params']['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0x7dd06c,null))[_0xca1b('0x3b')](function(_0x21d0db){if(_0x21d0db){return _0x21d0db[_0xca1b('0x4d')](_0x5cf916[_0xca1b('0x43')]['ids']||[]);}return null;})[_0xca1b('0x3b')](respondWithResult(_0x7dd06c,null))[_0xca1b('0x3c')](handleError(_0x7dd06c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index f2c8d57..ad9f91a 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 _0x351d=['../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x32a006,_0x15a256){var _0x376bd4=function(_0x5bcdf2){while(--_0x5bcdf2){_0x32a006['push'](_0x32a006['shift']());}};_0x376bd4(++_0x15a256);}(_0x351d,0x90));var _0xd351=function(_0x3ed6df,_0x2177e4){_0x3ed6df=_0x3ed6df-0x0;var _0x286b2c=_0x351d[_0x3ed6df];return _0x286b2c;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var BPromise=require('bluebird');var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xd351('0x7')]=function(_0x45e9e5,_0x88bd2b){return _0x45e9e5['define'](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x373d=['define','ZendeskConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x373d,0x1e2));var _0xd373=function(_0x3145af,_0x53a1d5){_0x3145af=_0x3145af-0x0;var _0x37758a=_0x373d[_0x3145af];return _0x37758a;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var logger=require(_0xd373('0x1'))(_0xd373('0x2'));var moment=require(_0xd373('0x3'));var BPromise=require(_0xd373('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd373('0x5'));var rimraf=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x31a0fb,_0x3e4443){return _0x31a0fb[_0xd373('0x8')](_0xd373('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 8d6a0fb..3e679f2 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 _0xb270=['then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x38c0bf,_0x263eed){var _0x4f49c7=function(_0xe6dd63){while(--_0xe6dd63){_0x38c0bf['push'](_0x38c0bf['shift']());}};_0x4f49c7(++_0x263eed);}(_0xb270,0x16b));var _0x0b27=function(_0x3612eb,_0x1f07a9){_0x3612eb=_0x3612eb-0x0;var _0x1a13ab=_0xb270[_0x3612eb];return _0x1a13ab;};'use strict';var _=require(_0x0b27('0x0'));var util=require(_0x0b27('0x1'));var moment=require(_0x0b27('0x2'));var BPromise=require(_0x0b27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b27('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b27('0x5'));var logger=require(_0x0b27('0x6'))(_0x0b27('0x7'));var config=require(_0x0b27('0x8'));var jayson=require(_0x0b27('0x9'));var client=jayson[_0x0b27('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x469321,_0x513aa3,_0xde91f9){return new BPromise(function(_0x271f15,_0x368b73){return client['request'](_0x469321,_0xde91f9)[_0x0b27('0xb')](function(_0x30c9b8){logger[_0x0b27('0xc')](_0x0b27('0xd'),_0x513aa3,'request\x20sent');logger[_0x0b27('0xe')](_0x0b27('0xf'),_0x513aa3,'request\x20sent',JSON[_0x0b27('0x10')](_0x30c9b8));if(_0x30c9b8[_0x0b27('0x11')]){if(_0x30c9b8['error'][_0x0b27('0x12')]===0x1f4){logger[_0x0b27('0x11')](_0x0b27('0xd'),_0x513aa3,_0x30c9b8[_0x0b27('0x11')][_0x0b27('0x13')]);return _0x368b73(_0x30c9b8['error'][_0x0b27('0x13')]);}logger[_0x0b27('0x11')](_0x0b27('0xd'),_0x513aa3,_0x30c9b8[_0x0b27('0x11')][_0x0b27('0x13')]);return _0x271f15(_0x30c9b8[_0x0b27('0x11')][_0x0b27('0x13')]);}else{logger['info'](_0x0b27('0xd'),_0x513aa3,'request\x20sent');_0x271f15(_0x30c9b8[_0x0b27('0x14')][_0x0b27('0x13')]);}})[_0x0b27('0x15')](function(_0x3cec18){logger[_0x0b27('0x11')](_0x0b27('0xd'),_0x513aa3,_0x3cec18);_0x368b73(_0x3cec18);});});} \ No newline at end of file +var _0xaf0e=['ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug'];(function(_0x25b429,_0x44d90d){var _0x3e634c=function(_0x99ca6b){while(--_0x99ca6b){_0x25b429['push'](_0x25b429['shift']());}};_0x3e634c(++_0x44d90d);}(_0xaf0e,0xa2));var _0xeaf0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaf0e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xeaf0('0x0'));var util=require(_0xeaf0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeaf0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeaf0('0x3'));var logger=require(_0xeaf0('0x4'))(_0xeaf0('0x5'));var config=require(_0xeaf0('0x6'));var jayson=require(_0xeaf0('0x7'));var client=jayson['client'][_0xeaf0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f1054,_0xfbeb58,_0x4b3f0f){return new BPromise(function(_0x56419f,_0x33202c){return client[_0xeaf0('0x9')](_0x4f1054,_0x4b3f0f)[_0xeaf0('0xa')](function(_0x13f11d){logger[_0xeaf0('0xb')](_0xeaf0('0xc'),_0xfbeb58,'request\x20sent');logger[_0xeaf0('0xd')](_0xeaf0('0xe'),_0xfbeb58,_0xeaf0('0xf'),JSON[_0xeaf0('0x10')](_0x13f11d));if(_0x13f11d['error']){if(_0x13f11d['error'][_0xeaf0('0x11')]===0x1f4){logger[_0xeaf0('0x12')](_0xeaf0('0xc'),_0xfbeb58,_0x13f11d[_0xeaf0('0x12')][_0xeaf0('0x13')]);return _0x33202c(_0x13f11d[_0xeaf0('0x12')][_0xeaf0('0x13')]);}logger['error'](_0xeaf0('0xc'),_0xfbeb58,_0x13f11d[_0xeaf0('0x12')][_0xeaf0('0x13')]);return _0x56419f(_0x13f11d[_0xeaf0('0x12')][_0xeaf0('0x13')]);}else{logger[_0xeaf0('0xb')](_0xeaf0('0xc'),_0xfbeb58,_0xeaf0('0xf'));_0x56419f(_0x13f11d[_0xeaf0('0x14')]['message']);}})[_0xeaf0('0x15')](function(_0x1fc05a){logger[_0xeaf0('0x12')](_0xeaf0('0xc'),_0xfbeb58,_0x1fc05a);_0x33202c(_0x1fc05a);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1d5ed29..c34e891 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 _0x761a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x761a,0xf5));var _0xa761=function(_0x3c7810,_0x274437){_0x3c7810=_0x3c7810-0x0;var _0x2645bc=_0x761a[_0x3c7810];return _0x2645bc;};'use strict';var multer=require(_0xa761('0x0'));var util=require(_0xa761('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa761('0x2'));var router=express[_0xa761('0x3')]();var fs_extra=require(_0xa761('0x4'));var auth=require(_0xa761('0x5'));var interaction=require(_0xa761('0x6'));var config=require(_0xa761('0x7'));var controller=require(_0xa761('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa761('0x9')](_0xa761('0xa'),auth[_0xa761('0xb')](),controller[_0xa761('0xc')]);router['post']('/',auth[_0xa761('0xb')](),controller[_0xa761('0xd')]);router[_0xa761('0xe')](_0xa761('0xa'),auth[_0xa761('0xb')](),controller[_0xa761('0xf')]);router[_0xa761('0x10')](_0xa761('0xa'),auth[_0xa761('0xb')](),controller[_0xa761('0x11')]);module[_0xa761('0x12')]=router; \ No newline at end of file +var _0x88e9=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','multer','util','path'];(function(_0x2cac24,_0x5cb546){var _0x3f8b07=function(_0x395adb){while(--_0x395adb){_0x2cac24['push'](_0x2cac24['shift']());}};_0x3f8b07(++_0x5cb546);}(_0x88e9,0x189));var _0x988e=function(_0x3715de,_0x4db6bd){_0x3715de=_0x3715de-0x0;var _0x392a26=_0x88e9[_0x3715de];return _0x392a26;};'use strict';var multer=require(_0x988e('0x0'));var util=require(_0x988e('0x1'));var path=require(_0x988e('0x2'));var timeout=require(_0x988e('0x3'));var express=require('express');var router=express[_0x988e('0x4')]();var fs_extra=require(_0x988e('0x5'));var auth=require(_0x988e('0x6'));var interaction=require(_0x988e('0x7'));var config=require('../../config/environment');var controller=require(_0x988e('0x8'));router[_0x988e('0x9')]('/',auth[_0x988e('0xa')](),controller[_0x988e('0xb')]);router[_0x988e('0x9')](_0x988e('0xc'),auth[_0x988e('0xa')](),controller[_0x988e('0xd')]);router[_0x988e('0xe')]('/',auth[_0x988e('0xa')](),controller['create']);router[_0x988e('0xf')](_0x988e('0xc'),auth[_0x988e('0xa')](),controller[_0x988e('0x10')]);router[_0x988e('0x11')](_0x988e('0xc'),auth[_0x988e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index cbaf363..d124cc7 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 _0xe0e2=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x2348c8,_0x5cce5d){var _0x2c5177=function(_0x2a6073){while(--_0x2a6073){_0x2348c8['push'](_0x2348c8['shift']());}};_0x2c5177(++_0x5cce5d);}(_0xe0e2,0x7f));var _0x2e0e=function(_0xf94618,_0x114c5e){_0xf94618=_0xf94618-0x0;var _0x3b550f=_0xe0e2[_0xf94618];return _0x3b550f;};'use strict';var Sequelize=require(_0x2e0e('0x0'));module[_0x2e0e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2e0e('0x2'),_0x2e0e('0x3'),_0x2e0e('0x4'),_0x2e0e('0x5'),_0x2e0e('0x6')),'defaultValue':_0x2e0e('0x2')},'content':{'type':Sequelize[_0x2e0e('0x7')]},'key':{'type':Sequelize[_0x2e0e('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x2e0e('0x2'),_0x2e0e('0x3'),_0x2e0e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2e0e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2e0e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2e0e('0x7')]}}; \ No newline at end of file +var _0x193a=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x111b29,_0x57139e){var _0x56fe78=function(_0x4a9673){while(--_0x4a9673){_0x111b29['push'](_0x111b29['shift']());}};_0x56fe78(++_0x57139e);}(_0x193a,0x13c));var _0xa193=function(_0x59be65,_0x5ce713){_0x59be65=_0x59be65-0x0;var _0x458a07=_0x193a[_0x59be65];return _0x458a07;};'use strict';var Sequelize=require(_0xa193('0x0'));module[_0xa193('0x1')]={'type':{'type':Sequelize[_0xa193('0x2')](_0xa193('0x3'),_0xa193('0x4'),_0xa193('0x5'),'keyValue',_0xa193('0x6')),'defaultValue':_0xa193('0x3')},'content':{'type':Sequelize[_0xa193('0x7')]},'key':{'type':Sequelize[_0xa193('0x7')]},'keyType':{'type':Sequelize[_0xa193('0x2')](_0xa193('0x3'),_0xa193('0x4'),_0xa193('0x5'))},'keyContent':{'type':Sequelize[_0xa193('0x7')]},'idField':{'type':Sequelize[_0xa193('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa193('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 6535062..896a660 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 _0x802c=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','end','stack','name','index','ZendeskField','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x25a4a2,_0x354563){var _0x46016b=function(_0x3f4e1c){while(--_0x3f4e1c){_0x25a4a2['push'](_0x25a4a2['shift']());}};_0x46016b(++_0x354563);}(_0x802c,0xd1));var _0xc802=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0x802c[_0x178f52];return _0x556f99;};'use strict';var emlformat=require(_0xc802('0x0'));var rimraf=require(_0xc802('0x1'));var zipdir=require(_0xc802('0x2'));var jsonpatch=require(_0xc802('0x3'));var rp=require(_0xc802('0x4'));var moment=require(_0xc802('0x5'));var BPromise=require(_0xc802('0x6'));var Mustache=require(_0xc802('0x7'));var util=require(_0xc802('0x8'));var path=require('path');var sox=require(_0xc802('0x9'));var csv=require(_0xc802('0xa'));var ejs=require(_0xc802('0xb'));var fs=require('fs');var fs_extra=require(_0xc802('0xc'));var _=require('lodash');var squel=require(_0xc802('0xd'));var crypto=require(_0xc802('0xe'));var jsforce=require(_0xc802('0xf'));var deskjs=require(_0xc802('0x10'));var toCsv=require(_0xc802('0xa'));var querystring=require(_0xc802('0x11'));var Papa=require(_0xc802('0x12'));var Redis=require(_0xc802('0x13'));var authService=require(_0xc802('0x14'));var qs=require(_0xc802('0x15'));var as=require(_0xc802('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc802('0x17'))(_0xc802('0x18'));var utils=require(_0xc802('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc802('0x1a'));var db=require(_0xc802('0x1b'))['db'];function respondWithStatusCode(_0xb49d2e,_0xe8ddd2){_0xe8ddd2=_0xe8ddd2||0xcc;return function(_0x4783a9){if(_0x4783a9){return _0xb49d2e[_0xc802('0x1c')](_0xe8ddd2);}return _0xb49d2e[_0xc802('0x1d')](_0xe8ddd2)['end']();};}function respondWithResult(_0x1932c0,_0x20677c){_0x20677c=_0x20677c||0xc8;return function(_0x36b8f4){if(_0x36b8f4){return _0x1932c0[_0xc802('0x1d')](_0x20677c)['json'](_0x36b8f4);}};}function respondWithFilteredResult(_0x3d4ae,_0x59c4bf){return function(_0x1696d7){if(_0x1696d7){var _0x397f95=typeof _0x59c4bf[_0xc802('0x1e')]===_0xc802('0x1f')&&typeof _0x59c4bf[_0xc802('0x20')]===_0xc802('0x1f');var _0x3eeda1=_0x1696d7[_0xc802('0x21')];var _0x1c93d5=_0x397f95?0x0:_0x59c4bf['offset'];var _0x3a5bc6=_0x397f95?_0x1696d7[_0xc802('0x21')]:_0x59c4bf['offset']+_0x59c4bf['limit'];var _0x35754a;if(_0x3a5bc6>=_0x3eeda1){_0x3a5bc6=_0x3eeda1;_0x35754a=0xc8;}else{_0x35754a=0xce;}_0x3d4ae[_0xc802('0x1d')](_0x35754a);return _0x3d4ae[_0xc802('0x22')](_0xc802('0x23'),_0x1c93d5+'-'+_0x3a5bc6+'/'+_0x3eeda1)[_0xc802('0x24')](_0x1696d7);}return null;};}function patchUpdates(_0xc8e86c){return function(_0x226ef9){try{jsonpatch[_0xc802('0x25')](_0x226ef9,_0xc8e86c,!![]);}catch(_0x526418){return BPromise[_0xc802('0x26')](_0x526418);}return _0x226ef9['save']();};}function saveUpdates(_0x5cb342,_0x38f319){return function(_0x38a236){if(_0x38a236){return _0x38a236['update'](_0x5cb342)[_0xc802('0x27')](function(_0xa01645){return _0xa01645;});}return null;};}function removeEntity(_0x2058b3,_0x160201){return function(_0xad2f94){if(_0xad2f94){return _0xad2f94['destroy']()[_0xc802('0x27')](function(){_0x2058b3[_0xc802('0x1d')](0xcc)[_0xc802('0x28')]();});}};}function handleEntityNotFound(_0x1cd2d5,_0x5014a8){return function(_0x51a720){if(!_0x51a720){_0x1cd2d5[_0xc802('0x1c')](0x194);}return _0x51a720;};}function handleError(_0x3c6603,_0x7e96ab){_0x7e96ab=_0x7e96ab||0x1f4;return function(_0x53ce48){logger['error'](_0x53ce48[_0xc802('0x29')]);if(_0x53ce48[_0xc802('0x2a')]){delete _0x53ce48[_0xc802('0x2a')];}_0x3c6603[_0xc802('0x1d')](_0x7e96ab)['send'](_0x53ce48);};}exports[_0xc802('0x2b')]=function(_0x48ecf6,_0x20cba9){var _0x402297={},_0x43aab1={},_0x33235d={'count':0x0,'rows':[]};var _0x100d85=_['map'](db[_0xc802('0x2c')][_0xc802('0x2d')],function(_0x3bdb85){return{'name':_0x3bdb85[_0xc802('0x2e')],'type':_0x3bdb85[_0xc802('0x2f')]['key']};});_0x43aab1['model']=_[_0xc802('0x30')](_0x100d85,_0xc802('0x2a'));_0x43aab1[_0xc802('0x31')]=_[_0xc802('0x32')](_0x48ecf6[_0xc802('0x31')]);_0x43aab1[_0xc802('0x33')]=_[_0xc802('0x34')](_0x43aab1[_0xc802('0x35')],_0x43aab1[_0xc802('0x31')]);_0x402297['attributes']=_[_0xc802('0x34')](_0x43aab1[_0xc802('0x35')],qs[_0xc802('0x36')](_0x48ecf6[_0xc802('0x31')][_0xc802('0x36')]));_0x402297[_0xc802('0x37')]=_0x402297[_0xc802('0x37')][_0xc802('0x38')]?_0x402297['attributes']:_0x43aab1['model'];if(!_0x48ecf6[_0xc802('0x31')][_0xc802('0x39')]('nolimit')){_0x402297[_0xc802('0x20')]=qs[_0xc802('0x20')](_0x48ecf6[_0xc802('0x31')]['limit']);_0x402297[_0xc802('0x1e')]=qs[_0xc802('0x1e')](_0x48ecf6[_0xc802('0x31')][_0xc802('0x1e')]);}_0x402297[_0xc802('0x3a')]=qs['sort'](_0x48ecf6[_0xc802('0x31')]['sort']);_0x402297['where']=qs[_0xc802('0x33')](_[_0xc802('0x3b')](_0x48ecf6[_0xc802('0x31')],_0x43aab1[_0xc802('0x33')]),_0x100d85);if(_0x48ecf6[_0xc802('0x31')][_0xc802('0x3c')]){_0x402297[_0xc802('0x3d')]=_[_0xc802('0x3e')](_0x402297['where'],{'$or':_[_0xc802('0x30')](_0x100d85,function(_0x5dac89){if(_0x5dac89[_0xc802('0x2f')]!==_0xc802('0x3f')){var _0x380a87={};_0x380a87[_0x5dac89[_0xc802('0x2a')]]={'$like':'%'+_0x48ecf6[_0xc802('0x31')][_0xc802('0x3c')]+'%'};return _0x380a87;}})});}_0x402297=_[_0xc802('0x3e')]({},_0x402297,_0x48ecf6['options']);var _0x3b436a={'where':_0x402297[_0xc802('0x3d')]};return db[_0xc802('0x2c')][_0xc802('0x21')](_0x3b436a)[_0xc802('0x27')](function(_0x504754){_0x33235d[_0xc802('0x21')]=_0x504754;if(_0x48ecf6['query'][_0xc802('0x40')]){_0x402297['include']=[{'all':!![]}];}return db[_0xc802('0x2c')][_0xc802('0x41')](_0x402297);})[_0xc802('0x27')](function(_0x404fa0){_0x33235d[_0xc802('0x42')]=_0x404fa0;return _0x33235d;})[_0xc802('0x27')](respondWithFilteredResult(_0x20cba9,_0x402297))[_0xc802('0x43')](handleError(_0x20cba9,null));};exports['show']=function(_0x31a8e2,_0x57406b){var _0x44d3fe={'raw':!![],'where':{'id':_0x31a8e2[_0xc802('0x44')]['id']}},_0x4d6309={};_0x4d6309[_0xc802('0x35')]=_[_0xc802('0x32')](db[_0xc802('0x2c')][_0xc802('0x2d')]);_0x4d6309[_0xc802('0x31')]=_[_0xc802('0x32')](_0x31a8e2['query']);_0x4d6309[_0xc802('0x33')]=_['intersection'](_0x4d6309[_0xc802('0x35')],_0x4d6309[_0xc802('0x31')]);_0x44d3fe[_0xc802('0x37')]=_[_0xc802('0x34')](_0x4d6309[_0xc802('0x35')],qs[_0xc802('0x36')](_0x31a8e2[_0xc802('0x31')][_0xc802('0x36')]));_0x44d3fe[_0xc802('0x37')]=_0x44d3fe['attributes'][_0xc802('0x38')]?_0x44d3fe[_0xc802('0x37')]:_0x4d6309[_0xc802('0x35')];if(_0x31a8e2['query'][_0xc802('0x40')]){_0x44d3fe[_0xc802('0x45')]=[{'all':!![]}];}_0x44d3fe=_[_0xc802('0x3e')]({},_0x44d3fe,_0x31a8e2[_0xc802('0x46')]);return db[_0xc802('0x2c')][_0xc802('0x47')](_0x44d3fe)[_0xc802('0x27')](handleEntityNotFound(_0x57406b,null))['then'](respondWithResult(_0x57406b,null))[_0xc802('0x43')](handleError(_0x57406b,null));};exports[_0xc802('0x48')]=function(_0x4a26d0,_0x5e8215){return db[_0xc802('0x2c')][_0xc802('0x48')](_0x4a26d0['body'],{})['then'](respondWithResult(_0x5e8215,0xc9))['catch'](handleError(_0x5e8215,null));};exports[_0xc802('0x49')]=function(_0x590847,_0x559b1a){if(_0x590847[_0xc802('0x4a')]['id']){delete _0x590847[_0xc802('0x4a')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x590847[_0xc802('0x44')]['id']}})[_0xc802('0x27')](handleEntityNotFound(_0x559b1a,null))[_0xc802('0x27')](saveUpdates(_0x590847['body'],null))['then'](respondWithResult(_0x559b1a,null))[_0xc802('0x43')](handleError(_0x559b1a,null));};exports[_0xc802('0x4b')]=function(_0x5eaaf6,_0x242fff){return db[_0xc802('0x2c')][_0xc802('0x47')]({'where':{'id':_0x5eaaf6[_0xc802('0x44')]['id']}})['then'](handleEntityNotFound(_0x242fff,null))['then'](removeEntity(_0x242fff,null))[_0xc802('0x43')](handleError(_0x242fff,null));}; \ No newline at end of file +var _0x81a9=['../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','ZendeskField','fieldName','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x59e9ff,_0x5080c3){var _0xa71d5e=function(_0x7d1718){while(--_0x7d1718){_0x59e9ff['push'](_0x59e9ff['shift']());}};_0xa71d5e(++_0x5080c3);}(_0x81a9,0x81));var _0x981a=function(_0x5e4009,_0x491526){_0x5e4009=_0x5e4009-0x0;var _0x5e5f5c=_0x81a9[_0x5e4009];return _0x5e5f5c;};'use strict';var emlformat=require(_0x981a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x981a('0x1'));var jsonpatch=require(_0x981a('0x2'));var rp=require(_0x981a('0x3'));var moment=require(_0x981a('0x4'));var BPromise=require(_0x981a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x981a('0x6'));var csv=require(_0x981a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x981a('0x8'));var _=require(_0x981a('0x9'));var squel=require(_0x981a('0xa'));var crypto=require(_0x981a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x981a('0x7'));var querystring=require(_0x981a('0xc'));var Papa=require(_0x981a('0xd'));var Redis=require(_0x981a('0xe'));var authService=require(_0x981a('0xf'));var qs=require(_0x981a('0x10'));var as=require(_0x981a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x981a('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x981a('0x13'));var licenseUtil=require(_0x981a('0x14'));var db=require(_0x981a('0x15'))['db'];function respondWithStatusCode(_0x36843a,_0x47cbd4){_0x47cbd4=_0x47cbd4||0xcc;return function(_0x5db4e8){if(_0x5db4e8){return _0x36843a[_0x981a('0x16')](_0x47cbd4);}return _0x36843a[_0x981a('0x17')](_0x47cbd4)['end']();};}function respondWithResult(_0x31df7c,_0x809245){_0x809245=_0x809245||0xc8;return function(_0x1d8593){if(_0x1d8593){return _0x31df7c[_0x981a('0x17')](_0x809245)[_0x981a('0x18')](_0x1d8593);}};}function respondWithFilteredResult(_0x23a73a,_0x531b77){return function(_0x28f864){if(_0x28f864){var _0xe0c0ea=typeof _0x531b77[_0x981a('0x19')]===_0x981a('0x1a')&&typeof _0x531b77['limit']==='undefined';var _0x52baa3=_0x28f864[_0x981a('0x1b')];var _0x261e60=_0xe0c0ea?0x0:_0x531b77['offset'];var _0xcb617a=_0xe0c0ea?_0x28f864[_0x981a('0x1b')]:_0x531b77[_0x981a('0x19')]+_0x531b77[_0x981a('0x1c')];var _0x59be66;if(_0xcb617a>=_0x52baa3){_0xcb617a=_0x52baa3;_0x59be66=0xc8;}else{_0x59be66=0xce;}_0x23a73a[_0x981a('0x17')](_0x59be66);return _0x23a73a[_0x981a('0x1d')](_0x981a('0x1e'),_0x261e60+'-'+_0xcb617a+'/'+_0x52baa3)[_0x981a('0x18')](_0x28f864);}return null;};}function patchUpdates(_0x88474a){return function(_0x412d68){try{jsonpatch[_0x981a('0x1f')](_0x412d68,_0x88474a,!![]);}catch(_0x5f169c){return BPromise[_0x981a('0x20')](_0x5f169c);}return _0x412d68[_0x981a('0x21')]();};}function saveUpdates(_0x3cf1f6,_0x3ea2db){return function(_0x3c315f){if(_0x3c315f){return _0x3c315f[_0x981a('0x22')](_0x3cf1f6)['then'](function(_0x3f8b39){return _0x3f8b39;});}return null;};}function removeEntity(_0x2c2569,_0x5b42c2){return function(_0x56fa7d){if(_0x56fa7d){return _0x56fa7d[_0x981a('0x23')]()[_0x981a('0x24')](function(){_0x2c2569['status'](0xcc)[_0x981a('0x25')]();});}};}function handleEntityNotFound(_0x249ebb,_0x479371){return function(_0x36a0fc){if(!_0x36a0fc){_0x249ebb[_0x981a('0x16')](0x194);}return _0x36a0fc;};}function handleError(_0x17f994,_0x11dd66){_0x11dd66=_0x11dd66||0x1f4;return function(_0x9d600a){logger['error'](_0x9d600a[_0x981a('0x26')]);if(_0x9d600a[_0x981a('0x27')]){delete _0x9d600a[_0x981a('0x27')];}_0x17f994[_0x981a('0x17')](_0x11dd66)[_0x981a('0x28')](_0x9d600a);};}exports[_0x981a('0x29')]=function(_0x41b031,_0x4a91d4){var _0x41be00={},_0x1ddc7f={},_0x4dba5c={'count':0x0,'rows':[]};var _0x381d11=_['map'](db[_0x981a('0x2a')]['rawAttributes'],function(_0x394bdb){return{'name':_0x394bdb[_0x981a('0x2b')],'type':_0x394bdb['type'][_0x981a('0x2c')]};});_0x1ddc7f[_0x981a('0x2d')]=_[_0x981a('0x2e')](_0x381d11,_0x981a('0x27'));_0x1ddc7f[_0x981a('0x2f')]=_['keys'](_0x41b031['query']);_0x1ddc7f[_0x981a('0x30')]=_['intersection'](_0x1ddc7f[_0x981a('0x2d')],_0x1ddc7f['query']);_0x41be00[_0x981a('0x31')]=_[_0x981a('0x32')](_0x1ddc7f[_0x981a('0x2d')],qs[_0x981a('0x33')](_0x41b031['query'][_0x981a('0x33')]));_0x41be00[_0x981a('0x31')]=_0x41be00['attributes'][_0x981a('0x34')]?_0x41be00[_0x981a('0x31')]:_0x1ddc7f['model'];if(!_0x41b031['query'][_0x981a('0x35')](_0x981a('0x36'))){_0x41be00['limit']=qs[_0x981a('0x1c')](_0x41b031['query'][_0x981a('0x1c')]);_0x41be00[_0x981a('0x19')]=qs[_0x981a('0x19')](_0x41b031[_0x981a('0x2f')][_0x981a('0x19')]);}_0x41be00[_0x981a('0x37')]=qs['sort'](_0x41b031[_0x981a('0x2f')][_0x981a('0x38')]);_0x41be00[_0x981a('0x39')]=qs[_0x981a('0x30')](_[_0x981a('0x3a')](_0x41b031[_0x981a('0x2f')],_0x1ddc7f['filters']),_0x381d11);if(_0x41b031[_0x981a('0x2f')][_0x981a('0x3b')]){_0x41be00['where']=_[_0x981a('0x3c')](_0x41be00['where'],{'$or':_[_0x981a('0x2e')](_0x381d11,function(_0x117a51){if(_0x117a51['type']!==_0x981a('0x3d')){var _0x37afa3={};_0x37afa3[_0x117a51[_0x981a('0x27')]]={'$like':'%'+_0x41b031[_0x981a('0x2f')][_0x981a('0x3b')]+'%'};return _0x37afa3;}})});}_0x41be00=_[_0x981a('0x3c')]({},_0x41be00,_0x41b031[_0x981a('0x3e')]);var _0x1e074f={'where':_0x41be00[_0x981a('0x39')]};return db['ZendeskField'][_0x981a('0x1b')](_0x1e074f)['then'](function(_0x1992df){_0x4dba5c['count']=_0x1992df;if(_0x41b031[_0x981a('0x2f')]['includeAll']){_0x41be00[_0x981a('0x3f')]=[{'all':!![]}];}return db[_0x981a('0x2a')][_0x981a('0x40')](_0x41be00);})[_0x981a('0x24')](function(_0x42f195){_0x4dba5c[_0x981a('0x41')]=_0x42f195;return _0x4dba5c;})[_0x981a('0x24')](respondWithFilteredResult(_0x4a91d4,_0x41be00))[_0x981a('0x42')](handleError(_0x4a91d4,null));};exports['show']=function(_0x200b01,_0x3348ef){var _0x5a184a={'raw':!![],'where':{'id':_0x200b01[_0x981a('0x43')]['id']}},_0xf15cc6={};_0xf15cc6[_0x981a('0x2d')]=_[_0x981a('0x44')](db[_0x981a('0x2a')]['rawAttributes']);_0xf15cc6['query']=_[_0x981a('0x44')](_0x200b01[_0x981a('0x2f')]);_0xf15cc6[_0x981a('0x30')]=_[_0x981a('0x32')](_0xf15cc6[_0x981a('0x2d')],_0xf15cc6[_0x981a('0x2f')]);_0x5a184a[_0x981a('0x31')]=_[_0x981a('0x32')](_0xf15cc6[_0x981a('0x2d')],qs[_0x981a('0x33')](_0x200b01[_0x981a('0x2f')][_0x981a('0x33')]));_0x5a184a[_0x981a('0x31')]=_0x5a184a[_0x981a('0x31')]['length']?_0x5a184a[_0x981a('0x31')]:_0xf15cc6[_0x981a('0x2d')];if(_0x200b01['query'][_0x981a('0x45')]){_0x5a184a[_0x981a('0x3f')]=[{'all':!![]}];}_0x5a184a=_[_0x981a('0x3c')]({},_0x5a184a,_0x200b01[_0x981a('0x3e')]);return db['ZendeskField'][_0x981a('0x46')](_0x5a184a)['then'](handleEntityNotFound(_0x3348ef,null))[_0x981a('0x24')](respondWithResult(_0x3348ef,null))[_0x981a('0x42')](handleError(_0x3348ef,null));};exports[_0x981a('0x47')]=function(_0x1d38ac,_0x9500a3){return db['ZendeskField'][_0x981a('0x47')](_0x1d38ac[_0x981a('0x48')],{})[_0x981a('0x24')](respondWithResult(_0x9500a3,0xc9))[_0x981a('0x42')](handleError(_0x9500a3,null));};exports[_0x981a('0x22')]=function(_0x5412d8,_0x4dd8a0){if(_0x5412d8[_0x981a('0x48')]['id']){delete _0x5412d8['body']['id'];}return db[_0x981a('0x2a')][_0x981a('0x46')]({'where':{'id':_0x5412d8[_0x981a('0x43')]['id']}})[_0x981a('0x24')](handleEntityNotFound(_0x4dd8a0,null))[_0x981a('0x24')](saveUpdates(_0x5412d8[_0x981a('0x48')],null))['then'](respondWithResult(_0x4dd8a0,null))['catch'](handleError(_0x4dd8a0,null));};exports[_0x981a('0x23')]=function(_0x369d2f,_0x5d17a0){return db[_0x981a('0x2a')][_0x981a('0x46')]({'where':{'id':_0x369d2f['params']['id']}})['then'](handleEntityNotFound(_0x5d17a0,null))[_0x981a('0x24')](removeEntity(_0x5d17a0,null))[_0x981a('0x42')](handleError(_0x5d17a0,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 97a68cb..6b930c8 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 _0xd143=['lodash','../../config/logger','api','request-promise','path','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xd143,0x1ec));var _0x3d14=function(_0x5b69e3,_0x2aabaa){_0x5b69e3=_0x5b69e3-0x0;var _0x35b163=_0xd143[_0x5b69e3];return _0x35b163;};'use strict';var _=require(_0x3d14('0x0'));var util=require('util');var logger=require(_0x3d14('0x1'))(_0x3d14('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3d14('0x3'));var fs=require('fs');var path=require(_0x3d14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3d14('0x5'));module[_0x3d14('0x6')]=function(_0x410b46,_0x116834){return _0x410b46[_0x3d14('0x7')](_0x3d14('0x8'),attributes,{'tableName':_0x3d14('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x3d14('0xa'),_0x3d14('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a28=['int_zendesk_fields','zendesk_unique_index','FieldId','util','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5a28,0x1bb));var _0x85a2=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x5a28[_0x3b231a];return _0x18d67a;};'use strict';var _=require('lodash');var util=require(_0x85a2('0x0'));var logger=require('../../config/logger')(_0x85a2('0x1'));var moment=require(_0x85a2('0x2'));var BPromise=require(_0x85a2('0x3'));var rp=require(_0x85a2('0x4'));var fs=require('fs');var path=require(_0x85a2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x85a2('0x6')]=function(_0x2be423,_0x3f2cdc){return _0x2be423[_0x85a2('0x7')]('ZendeskField',attributes,{'tableName':_0x85a2('0x8'),'paranoid':![],'indexes':[{'name':_0x85a2('0x9'),'fields':['idField',_0x85a2('0xa')],'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 2adcd2f..f69fcd5 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 _0x3052=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x21c94f,_0x1dbf3f){var _0x4f2f0e=function(_0x2761c9){while(--_0x2761c9){_0x21c94f['push'](_0x21c94f['shift']());}};_0x4f2f0e(++_0x1dbf3f);}(_0x3052,0xb9));var _0x2305=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3052[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2305('0x0'));var util=require(_0x2305('0x1'));var moment=require(_0x2305('0x2'));var BPromise=require(_0x2305('0x3'));var rs=require(_0x2305('0x4'));var fs=require('fs');var Redis=require(_0x2305('0x5'));var db=require(_0x2305('0x6'))['db'];var utils=require(_0x2305('0x7'));var logger=require(_0x2305('0x8'))(_0x2305('0x9'));var config=require(_0x2305('0xa'));var jayson=require(_0x2305('0xb'));var client=jayson['client'][_0x2305('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e6bf7,_0x59e4fe,_0x34a7fa){return new BPromise(function(_0x1ef47d,_0x130472){return client[_0x2305('0xd')](_0x4e6bf7,_0x34a7fa)[_0x2305('0xe')](function(_0xae0484){logger[_0x2305('0xf')](_0x2305('0x10'),_0x59e4fe,'request\x20sent');logger['debug'](_0x2305('0x11'),_0x59e4fe,_0x2305('0x12'),JSON[_0x2305('0x13')](_0xae0484));if(_0xae0484[_0x2305('0x14')]){if(_0xae0484[_0x2305('0x14')][_0x2305('0x15')]===0x1f4){logger[_0x2305('0x14')](_0x2305('0x10'),_0x59e4fe,_0xae0484[_0x2305('0x14')][_0x2305('0x16')]);return _0x130472(_0xae0484[_0x2305('0x14')][_0x2305('0x16')]);}logger[_0x2305('0x14')]('ZendeskField,\x20%s,\x20%s',_0x59e4fe,_0xae0484[_0x2305('0x14')][_0x2305('0x16')]);return _0x1ef47d(_0xae0484[_0x2305('0x14')][_0x2305('0x16')]);}else{logger[_0x2305('0xf')]('ZendeskField,\x20%s,\x20%s',_0x59e4fe,_0x2305('0x12'));_0x1ef47d(_0xae0484['result']['message']);}})[_0x2305('0x17')](function(_0x479866){logger['error'](_0x2305('0x10'),_0x59e4fe,_0x479866);_0x130472(_0x479866);});});} \ No newline at end of file +var _0x0033=['catch','lodash','util','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x4e4154,_0x1ffe63){var _0x53a194=function(_0x42bea1){while(--_0x42bea1){_0x4e4154['push'](_0x4e4154['shift']());}};_0x53a194(++_0x1ffe63);}(_0x0033,0x121));var _0x3003=function(_0x253476,_0x16b31a){_0x253476=_0x253476-0x0;var _0x134271=_0x0033[_0x253476];return _0x134271;};'use strict';var _=require(_0x3003('0x0'));var util=require(_0x3003('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3003('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3003('0x3'))(_0x3003('0x4'));var config=require('../../config/environment');var jayson=require(_0x3003('0x5'));var client=jayson[_0x3003('0x6')][_0x3003('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x327e67,_0x12c830,_0x345912){return new BPromise(function(_0x435e55,_0x194e8a){return client['request'](_0x327e67,_0x345912)['then'](function(_0xe7a207){logger['info'](_0x3003('0x8'),_0x12c830,_0x3003('0x9'));logger[_0x3003('0xa')](_0x3003('0xb'),_0x12c830,'request\x20sent',JSON[_0x3003('0xc')](_0xe7a207));if(_0xe7a207[_0x3003('0xd')]){if(_0xe7a207[_0x3003('0xd')]['code']===0x1f4){logger[_0x3003('0xd')](_0x3003('0x8'),_0x12c830,_0xe7a207[_0x3003('0xd')][_0x3003('0xe')]);return _0x194e8a(_0xe7a207[_0x3003('0xd')][_0x3003('0xe')]);}logger[_0x3003('0xd')](_0x3003('0x8'),_0x12c830,_0xe7a207[_0x3003('0xd')]['message']);return _0x435e55(_0xe7a207[_0x3003('0xd')][_0x3003('0xe')]);}else{logger[_0x3003('0xf')](_0x3003('0x8'),_0x12c830,_0x3003('0x9'));_0x435e55(_0xe7a207[_0x3003('0x10')][_0x3003('0xe')]);}})[_0x3003('0x11')](function(_0x2337f){logger['error'](_0x3003('0x8'),_0x12c830,_0x2337f);_0x194e8a(_0x2337f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index e07c30b..edee8b6 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 _0x1792=['post','addConfiguration','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x34e4cb,_0x493560){var _0x170ef1=function(_0x35d3ca){while(--_0x35d3ca){_0x34e4cb['push'](_0x34e4cb['shift']());}};_0x170ef1(++_0x493560);}(_0x1792,0xf9));var _0x2179=function(_0xe5530b,_0x4477ea){_0xe5530b=_0xe5530b-0x0;var _0x549c66=_0x1792[_0xe5530b];return _0x549c66;};'use strict';var multer=require('multer');var util=require(_0x2179('0x0'));var path=require(_0x2179('0x1'));var timeout=require(_0x2179('0x2'));var express=require(_0x2179('0x3'));var router=express[_0x2179('0x4')]();var fs_extra=require(_0x2179('0x5'));var auth=require(_0x2179('0x6'));var interaction=require(_0x2179('0x7'));var config=require('../../config/environment');var controller=require(_0x2179('0x8'));router[_0x2179('0x9')]('/',auth['isAuthenticated'](),controller[_0x2179('0xa')]);router[_0x2179('0x9')]('/:id',auth[_0x2179('0xb')](),controller[_0x2179('0xc')]);router[_0x2179('0x9')](_0x2179('0xd'),auth['isAuthenticated'](),controller[_0x2179('0xe')]);router[_0x2179('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x2179('0xf')]('/',auth[_0x2179('0xb')](),controller['create']);router[_0x2179('0xf')](_0x2179('0xd'),auth[_0x2179('0xb')](),controller[_0x2179('0x10')]);router[_0x2179('0x11')](_0x2179('0x12'),auth[_0x2179('0xb')](),controller['update']);router[_0x2179('0x13')](_0x2179('0x12'),auth[_0x2179('0xb')](),controller[_0x2179('0x14')]);module[_0x2179('0x15')]=router; \ No newline at end of file +var _0x4cec=['get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','update','destroy','multer','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1da08f,_0x4c155d){var _0x35856b=function(_0xe6fb31){while(--_0xe6fb31){_0x1da08f['push'](_0x1da08f['shift']());}};_0x35856b(++_0x4c155d);}(_0x4cec,0xdb));var _0xc4ce=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x4cec[_0x25e7cb];return _0x375d92;};'use strict';var multer=require(_0xc4ce('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc4ce('0x1')]();var fs_extra=require(_0xc4ce('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xc4ce('0x3'));var config=require(_0xc4ce('0x4'));var controller=require('./intZohoAccount.controller');router[_0xc4ce('0x5')]('/',auth[_0xc4ce('0x6')](),controller['index']);router[_0xc4ce('0x5')](_0xc4ce('0x7'),auth[_0xc4ce('0x6')](),controller['show']);router[_0xc4ce('0x5')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xc4ce('0x8')]);router['get'](_0xc4ce('0x9'),auth['isAuthenticated'](),controller[_0xc4ce('0xa')]);router[_0xc4ce('0xb')]('/',auth[_0xc4ce('0x6')](),controller['create']);router['post'](_0xc4ce('0xc'),auth[_0xc4ce('0x6')](),controller[_0xc4ce('0xd')]);router['put'](_0xc4ce('0x7'),auth[_0xc4ce('0x6')](),controller[_0xc4ce('0xe')]);router['delete'](_0xc4ce('0x7'),auth[_0xc4ce('0x6')](),controller[_0xc4ce('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index e545436..b09b384 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 _0x9bde=['STRING','exports'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x303dca,_0x119338){_0x303dca=_0x303dca-0x0;var _0x4074a6=_0x9bde[_0x303dca];return _0x4074a6;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe9bd('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xe9bd('0x1')]},'clientId':{'type':Sequelize[_0xe9bd('0x1')]},'clientSecret':{'type':Sequelize[_0xe9bd('0x1')]},'serverUrl':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe9bd('0x1')]},'refreshToken':{'type':Sequelize[_0xe9bd('0x1')]}}; \ No newline at end of file +var _0xd64b=['STRING','sequelize'];(function(_0x407fcd,_0x25afa6){var _0x1d724e=function(_0x2c04fa){while(--_0x2c04fa){_0x407fcd['push'](_0x407fcd['shift']());}};_0x1d724e(++_0x25afa6);}(_0xd64b,0xc1));var _0xbd64=function(_0x3b83ad,_0x51290d){_0x3b83ad=_0x3b83ad-0x0;var _0x20e6fd=_0xd64b[_0x3b83ad];return _0x20e6fd;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd64('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd64('0x1')]},'zone':{'type':Sequelize[_0xbd64('0x1')]},'clientId':{'type':Sequelize[_0xbd64('0x1')]},'clientSecret':{'type':Sequelize[_0xbd64('0x1')]},'serverUrl':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index e83009c..bd29a78 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 _0x8f35=['where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','destroy','getConfigurations','ZohoConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zoho.eu','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Description','WhoId','Call_Duration','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../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','limit','undefined','apply','reject','save','update','then','error','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','model','fields','length','attributes','order','sort','pick','filter'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x8f35,0x1d3));var _0x58f3=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x8f35[_0x2283dc];return _0x16db90;};'use strict';var emlformat=require(_0x58f3('0x0'));var rimraf=require(_0x58f3('0x1'));var zipdir=require(_0x58f3('0x2'));var jsonpatch=require(_0x58f3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x58f3('0x4'));var Mustache=require(_0x58f3('0x5'));var util=require('util');var path=require(_0x58f3('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x58f3('0x7'));var fs=require('fs');var fs_extra=require(_0x58f3('0x8'));var _=require(_0x58f3('0x9'));var squel=require(_0x58f3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x58f3('0xb'));var toCsv=require(_0x58f3('0xc'));var querystring=require(_0x58f3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x58f3('0xe'));var hardwareService=require(_0x58f3('0xf'));var logger=require(_0x58f3('0x10'))(_0x58f3('0x11'));var utils=require(_0x58f3('0x12'));var config=require(_0x58f3('0x13'));var licenseUtil=require(_0x58f3('0x14'));var db=require(_0x58f3('0x15'))['db'];var integrations=require(_0x58f3('0x16'));function respondWithStatusCode(_0x494106,_0x1a0a46){_0x1a0a46=_0x1a0a46||0xcc;return function(_0x5513fe){if(_0x5513fe){return _0x494106[_0x58f3('0x17')](_0x1a0a46);}return _0x494106[_0x58f3('0x18')](_0x1a0a46)[_0x58f3('0x19')]();};}function respondWithResult(_0x4336f7,_0x20913c){_0x20913c=_0x20913c||0xc8;return function(_0x199066){if(_0x199066){return _0x4336f7['status'](_0x20913c)[_0x58f3('0x1a')](_0x199066);}};}function respondWithFilteredResult(_0x1756ed,_0x38ad48){return function(_0x5d2ccb){if(_0x5d2ccb){var _0x13a6e8=typeof _0x38ad48[_0x58f3('0x1b')]==='undefined'&&typeof _0x38ad48[_0x58f3('0x1c')]===_0x58f3('0x1d');var _0x472762=_0x5d2ccb['count'];var _0x15c0b3=_0x13a6e8?0x0:_0x38ad48[_0x58f3('0x1b')];var _0x40ca4b=_0x13a6e8?_0x5d2ccb['count']:_0x38ad48[_0x58f3('0x1b')]+_0x38ad48[_0x58f3('0x1c')];var _0x28a674;if(_0x40ca4b>=_0x472762){_0x40ca4b=_0x472762;_0x28a674=0xc8;}else{_0x28a674=0xce;}_0x1756ed[_0x58f3('0x18')](_0x28a674);return _0x1756ed['set']('Content-Range',_0x15c0b3+'-'+_0x40ca4b+'/'+_0x472762)[_0x58f3('0x1a')](_0x5d2ccb);}return null;};}function patchUpdates(_0x2c8b1b){return function(_0x44793d){try{jsonpatch[_0x58f3('0x1e')](_0x44793d,_0x2c8b1b,!![]);}catch(_0xa52af9){return BPromise[_0x58f3('0x1f')](_0xa52af9);}return _0x44793d[_0x58f3('0x20')]();};}function saveUpdates(_0x42efcd,_0x13b734){return function(_0xe248f){if(_0xe248f){return _0xe248f[_0x58f3('0x21')](_0x42efcd)['then'](function(_0x27e1c3){return _0x27e1c3;});}return null;};}function removeEntity(_0x492770,_0x19bbfe){return function(_0x3e29b7){if(_0x3e29b7){return _0x3e29b7['destroy']()[_0x58f3('0x22')](function(){_0x492770[_0x58f3('0x18')](0xcc)[_0x58f3('0x19')]();});}};}function handleEntityNotFound(_0x5dd6a9,_0x9eac){return function(_0x5d4fa0){if(!_0x5d4fa0){_0x5dd6a9[_0x58f3('0x17')](0x194);}return _0x5d4fa0;};}function handleError(_0x2dde41,_0xc931b2){_0xc931b2=_0xc931b2||0x1f4;return function(_0x57a6a6){logger[_0x58f3('0x23')](_0x57a6a6[_0x58f3('0x24')]);if(_0x57a6a6[_0x58f3('0x25')]){delete _0x57a6a6['name'];}_0x2dde41[_0x58f3('0x18')](_0xc931b2)[_0x58f3('0x26')](_0x57a6a6);};}exports[_0x58f3('0x27')]=function(_0x3f67ee,_0x2af613){var _0x1f235d={},_0x25908c={},_0x23a65e={'count':0x0,'rows':[]};var _0x130615=_['map'](db[_0x58f3('0x28')][_0x58f3('0x29')],function(_0x36e1e3){return{'name':_0x36e1e3[_0x58f3('0x2a')],'type':_0x36e1e3[_0x58f3('0x2b')][_0x58f3('0x2c')]};});_0x25908c['model']=_[_0x58f3('0x2d')](_0x130615,_0x58f3('0x25'));_0x25908c[_0x58f3('0x2e')]=_[_0x58f3('0x2f')](_0x3f67ee['query']);_0x25908c[_0x58f3('0x30')]=_['intersection'](_0x25908c['model'],_0x25908c[_0x58f3('0x2e')]);_0x1f235d['attributes']=_['intersection'](_0x25908c[_0x58f3('0x31')],qs[_0x58f3('0x32')](_0x3f67ee['query']['fields']));_0x1f235d['attributes']=_0x1f235d['attributes'][_0x58f3('0x33')]?_0x1f235d[_0x58f3('0x34')]:_0x25908c[_0x58f3('0x31')];if(!_0x3f67ee[_0x58f3('0x2e')]['hasOwnProperty']('nolimit')){_0x1f235d[_0x58f3('0x1c')]=qs[_0x58f3('0x1c')](_0x3f67ee['query'][_0x58f3('0x1c')]);_0x1f235d[_0x58f3('0x1b')]=qs[_0x58f3('0x1b')](_0x3f67ee[_0x58f3('0x2e')]['offset']);}_0x1f235d[_0x58f3('0x35')]=qs[_0x58f3('0x36')](_0x3f67ee[_0x58f3('0x2e')][_0x58f3('0x36')]);_0x1f235d['where']=qs[_0x58f3('0x30')](_[_0x58f3('0x37')](_0x3f67ee[_0x58f3('0x2e')],_0x25908c['filters']),_0x130615);if(_0x3f67ee[_0x58f3('0x2e')][_0x58f3('0x38')]){_0x1f235d[_0x58f3('0x39')]=_[_0x58f3('0x3a')](_0x1f235d['where'],{'$or':_['map'](_0x130615,function(_0x4ff857){if(_0x4ff857['type']!==_0x58f3('0x3b')){var _0x5a33c7={};_0x5a33c7[_0x4ff857[_0x58f3('0x25')]]={'$like':'%'+_0x3f67ee[_0x58f3('0x2e')][_0x58f3('0x38')]+'%'};return _0x5a33c7;}})});}_0x1f235d=_[_0x58f3('0x3a')]({},_0x1f235d,_0x3f67ee[_0x58f3('0x3c')]);var _0x388919={'where':_0x1f235d['where']};return db[_0x58f3('0x28')][_0x58f3('0x3d')](_0x388919)[_0x58f3('0x22')](function(_0x4d4465){_0x23a65e[_0x58f3('0x3d')]=_0x4d4465;if(_0x3f67ee[_0x58f3('0x2e')][_0x58f3('0x3e')]){_0x1f235d[_0x58f3('0x3f')]=[{'all':!![]}];}return db[_0x58f3('0x28')][_0x58f3('0x40')](_0x1f235d);})[_0x58f3('0x22')](function(_0x35c9e8){_0x23a65e[_0x58f3('0x41')]=_0x35c9e8;return _0x23a65e;})['then'](respondWithFilteredResult(_0x2af613,_0x1f235d))[_0x58f3('0x42')](handleError(_0x2af613,null));};exports['show']=function(_0x445f70,_0xc9b1bd){var _0x41e836={'raw':![],'where':{'id':_0x445f70[_0x58f3('0x43')]['id']}},_0x2f18c5={};_0x2f18c5[_0x58f3('0x31')]=_[_0x58f3('0x2f')](db['ZohoAccount'][_0x58f3('0x29')]);_0x2f18c5['query']=_[_0x58f3('0x2f')](_0x445f70[_0x58f3('0x2e')]);_0x2f18c5['filters']=_[_0x58f3('0x44')](_0x2f18c5[_0x58f3('0x31')],_0x2f18c5[_0x58f3('0x2e')]);_0x41e836[_0x58f3('0x34')]=_[_0x58f3('0x44')](_0x2f18c5[_0x58f3('0x31')],qs[_0x58f3('0x32')](_0x445f70[_0x58f3('0x2e')][_0x58f3('0x32')]));_0x41e836['attributes']=_0x41e836[_0x58f3('0x34')]['length']?_0x41e836[_0x58f3('0x34')]:_0x2f18c5[_0x58f3('0x31')];if(_0x445f70[_0x58f3('0x2e')][_0x58f3('0x3e')]){_0x41e836['include']=[{'all':!![]}];}_0x41e836=_[_0x58f3('0x3a')]({},_0x41e836,_0x445f70[_0x58f3('0x3c')]);return db[_0x58f3('0x28')][_0x58f3('0x45')](_0x41e836)['then'](handleEntityNotFound(_0xc9b1bd,null))[_0x58f3('0x22')](respondWithResult(_0xc9b1bd,null))[_0x58f3('0x42')](handleError(_0xc9b1bd,null));};exports[_0x58f3('0x46')]=function(_0x16f650,_0x4de26b){return db[_0x58f3('0x28')][_0x58f3('0x46')](_0x16f650['body'],{})[_0x58f3('0x22')](respondWithResult(_0x4de26b,0xc9))[_0x58f3('0x42')](handleError(_0x4de26b,null));};exports[_0x58f3('0x21')]=function(_0x56da15,_0x1abdac){if(_0x56da15['body']['id']){delete _0x56da15[_0x58f3('0x47')]['id'];}return db[_0x58f3('0x28')][_0x58f3('0x45')]({'where':{'id':_0x56da15[_0x58f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x1abdac,null))[_0x58f3('0x22')](saveUpdates(_0x56da15[_0x58f3('0x47')],null))[_0x58f3('0x22')](respondWithResult(_0x1abdac,null))[_0x58f3('0x42')](handleError(_0x1abdac,null));};exports[_0x58f3('0x48')]=function(_0x1f1a7d,_0x2eee57){return db[_0x58f3('0x28')]['find']({'where':{'id':_0x1f1a7d[_0x58f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x2eee57,null))[_0x58f3('0x22')](removeEntity(_0x2eee57,null))[_0x58f3('0x42')](handleError(_0x2eee57,null));};exports[_0x58f3('0x49')]=function(_0x17d99b,_0x357501,_0x2726e0){var _0x1ffbca={};var _0xaf114f={};var _0x1543be;var _0x4f96fe;return db['ZohoAccount']['findOne']({'where':{'id':_0x17d99b[_0x58f3('0x43')]['id']}})[_0x58f3('0x22')](handleEntityNotFound(_0x357501,null))[_0x58f3('0x22')](function(_0x18c061){if(_0x18c061){_0x1543be=_0x18c061;_0xaf114f[_0x58f3('0x31')]=_['keys'](db[_0x58f3('0x4a')][_0x58f3('0x29')]);_0xaf114f[_0x58f3('0x2e')]=_['keys'](_0x17d99b['query']);_0xaf114f[_0x58f3('0x30')]=_[_0x58f3('0x44')](_0xaf114f[_0x58f3('0x31')],_0xaf114f[_0x58f3('0x2e')]);_0x1ffbca[_0x58f3('0x34')]=_[_0x58f3('0x44')](_0xaf114f[_0x58f3('0x31')],qs[_0x58f3('0x32')](_0x17d99b[_0x58f3('0x2e')][_0x58f3('0x32')]));_0x1ffbca['attributes']=_0x1ffbca['attributes'][_0x58f3('0x33')]?_0x1ffbca[_0x58f3('0x34')]:_0xaf114f[_0x58f3('0x31')];_0x1ffbca['order']=qs['sort'](_0x17d99b[_0x58f3('0x2e')][_0x58f3('0x36')]);_0x1ffbca[_0x58f3('0x39')]=qs['filters'](_[_0x58f3('0x37')](_0x17d99b['query'],_0xaf114f[_0x58f3('0x30')]));if(_0x17d99b[_0x58f3('0x2e')]['filter']){_0x1ffbca[_0x58f3('0x39')]=_[_0x58f3('0x3a')](_0x1ffbca[_0x58f3('0x39')],{'$or':_['map'](_0x1ffbca[_0x58f3('0x34')],function(_0x4974d8){var _0x1094d9={};_0x1094d9[_0x4974d8]={'$like':'%'+_0x17d99b[_0x58f3('0x2e')][_0x58f3('0x38')]+'%'};return _0x1094d9;})});}_0x1ffbca=_[_0x58f3('0x3a')]({},_0x1ffbca,_0x17d99b['options']);return _0x1543be[_0x58f3('0x49')](_0x1ffbca);}})[_0x58f3('0x22')](function(_0x1d9e7e){if(_0x1d9e7e){_0x4f96fe=_0x1d9e7e[_0x58f3('0x33')];if(!_0x17d99b[_0x58f3('0x2e')][_0x58f3('0x4b')]('nolimit')){_0x1ffbca[_0x58f3('0x1c')]=qs['limit'](_0x17d99b[_0x58f3('0x2e')][_0x58f3('0x1c')]);_0x1ffbca[_0x58f3('0x1b')]=qs[_0x58f3('0x1b')](_0x17d99b[_0x58f3('0x2e')][_0x58f3('0x1b')]);}return _0x1543be[_0x58f3('0x49')](_0x1ffbca);}})[_0x58f3('0x22')](function(_0x54b570){if(_0x54b570){return _0x54b570?{'count':_0x4f96fe,'rows':_0x54b570}:null;}})[_0x58f3('0x22')](respondWithResult(_0x357501,null))[_0x58f3('0x42')](handleError(_0x357501,null));};exports[_0x58f3('0x4c')]=function(_0x1cea23,_0x1392f9,_0x3fb948){if(_0x1cea23[_0x58f3('0x47')]['id']){delete _0x1cea23[_0x58f3('0x47')]['id'];}return db['ZohoAccount'][_0x58f3('0x4d')]({'where':{'id':_0x1cea23[_0x58f3('0x43')]['id']}})[_0x58f3('0x22')](handleEntityNotFound(_0x1392f9,null))['then'](function(_0x57ed2e){if(_0x57ed2e){_0x1cea23[_0x58f3('0x47')][_0x58f3('0x4e')]=_0x57ed2e['id'];_0x1cea23[_0x58f3('0x47')]['Subjects']=integrations[_0x58f3('0x4f')](_0x1cea23['body'][_0x58f3('0x50')],_0x1cea23[_0x58f3('0x47')][_0x58f3('0x2b')]);_0x1cea23[_0x58f3('0x47')][_0x58f3('0x51')]=integrations[_0x58f3('0x52')](_0x1cea23[_0x58f3('0x47')]['channel'],_0x1cea23[_0x58f3('0x47')][_0x58f3('0x2b')]);return db[_0x58f3('0x4a')][_0x58f3('0x46')](_0x1cea23[_0x58f3('0x47')],{'include':[{'model':db[_0x58f3('0x53')],'as':_0x58f3('0x54')},{'model':db[_0x58f3('0x53')],'as':_0x58f3('0x51')}]});}return null;})[_0x58f3('0x22')](respondWithResult(_0x1392f9,null))[_0x58f3('0x42')](handleError(_0x1392f9,null));};function getAccessToken(_0x20837e){return new Promise(function(_0x2218b8,_0x345018){var _0x240943;switch(_0x20837e[_0x58f3('0x55')]){case'US':_0x240943=_0x58f3('0x56');break;case'AU':_0x240943=_0x58f3('0x57');break;case'EU':_0x240943=_0x58f3('0x58');break;case'IN':_0x240943=_0x58f3('0x59');break;case'CN':_0x240943=_0x58f3('0x5a');break;default:_0x240943='https://accounts.zoho.eu';break;}var _0x135166={'method':_0x58f3('0x5b'),'uri':_0x240943+'/oauth/v2/token','qs':{'refresh_token':_0x20837e[_0x58f3('0x5c')],'client_id':_0x20837e[_0x58f3('0x5d')],'client_secret':_0x20837e[_0x58f3('0x5e')],'grant_type':_0x58f3('0x5f')},'json':!![]};return rp(_0x135166)[_0x58f3('0x22')](function(_0x53467d){if(_0x53467d['access_token']){_0x2218b8(_0x53467d[_0x58f3('0x60')]);}else{_0x345018(_0x58f3('0x61'));}})[_0x58f3('0x42')](function(_0x49948f){_0x345018(_0x49948f);});});}exports['getFields']=function(_0x4ae6ff,_0x4508ae,_0x457c4a){var _0x1be7e8,_0x48b121,_0x525ff0,_0x43bc76,_0x44c9ef;return db[_0x58f3('0x28')][_0x58f3('0x4d')]({'where':{'id':_0x4ae6ff['params']['id']},'attributes':['id','host',_0x58f3('0x55'),_0x58f3('0x5d'),_0x58f3('0x5e'),'serverUrl','code',_0x58f3('0x5c')]})[_0x58f3('0x22')](handleEntityNotFound(_0x4508ae,null))['then'](function(_0x2984b1){_0x44c9ef=_0x2984b1;_0x1be7e8=_0x44c9ef[_0x58f3('0x62')];_0x48b121=_0x1be7e8===_0x58f3('0x63')?'eu':'com';_0x525ff0=_0x44c9ef[_0x58f3('0x64')];var _0x596fda=_0x525ff0[_0x58f3('0x65')](-0x1);if(_0x596fda==='/'||_0x596fda==='\x5c'||_0x596fda===':'){_0x525ff0=_0x525ff0[_0x58f3('0x66')](0x0,_0x525ff0[_0x58f3('0x67')](_0x596fda));}if(!_0x44c9ef[_0x58f3('0x5c')]){throw new Error(_0x58f3('0x68'));}return getAccessToken(_0x44c9ef);})[_0x58f3('0x22')](function(_0xfefe6f){if(_0xfefe6f){return rp({'method':'GET','uri':util[_0x58f3('0x69')](_0x58f3('0x6a'),_0x48b121),'qs':{'module':_0x58f3('0x6b')},'headers':{'Authorization':_0x58f3('0x6c')+_0xfefe6f},'json':!![]});}})['then'](function(_0x54ef2f){if(_0x54ef2f){if(_0x54ef2f[_0x58f3('0x6d')]&&_0x54ef2f[_0x58f3('0x6d')][_0x58f3('0x23')]){throw new Error(_0x54ef2f[_0x58f3('0x6d')][_0x58f3('0x23')][_0x58f3('0x6e')]);}var _0x184ce8=[];var _0xb2a75a=[];var _0x51151a=[_0x58f3('0x6f'),'Subject',_0x58f3('0x70'),_0x58f3('0x71'),_0x58f3('0x72'),'Call_Result',_0x58f3('0x73'),'Call_Type'];_0xb2a75a=_[_0x58f3('0x74')](_0x54ef2f[_0x58f3('0x32')],function(_0x595e6d){return _0x51151a[_0x58f3('0x75')](_0x595e6d[_0x58f3('0x76')]);});for(var _0x47b0bc=0x0;_0x47b0bc<_0xb2a75a[_0x58f3('0x33')];_0x47b0bc++){if(_0xb2a75a[_0x47b0bc][_0x58f3('0x77')]===![]){_0x184ce8[_0x58f3('0x78')]({'id':_0xb2a75a[_0x47b0bc]['id'],'name':_0xb2a75a[_0x47b0bc][_0x58f3('0x79')],'custom':_0xb2a75a[_0x47b0bc][_0x58f3('0x7a')],'options':_0xb2a75a[_0x47b0bc][_0x58f3('0x7b')]===_0x58f3('0x7c')&&_0xb2a75a[_0x47b0bc][_0x58f3('0x7d')][_0x58f3('0x33')]>-0x1?_[_0x58f3('0x2d')](_0xb2a75a[_0x47b0bc][_0x58f3('0x7d')],function(_0x9aeb00){return{'name':_0x9aeb00,'value':_0x9aeb00};}):[]});}}return{'count':_0x184ce8[_0x58f3('0x33')],'rows':_0x184ce8};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4508ae,null))[_0x58f3('0x42')](function(_0xd37a0c){var _0x2641f8=_0x4ae6ff[_0x58f3('0x2e')][_0x58f3('0x7e')]?0x1f4:_0xd37a0c[_0x58f3('0x7f')]||0x1f4;logger[_0x58f3('0x23')](_0x58f3('0x80'),_0x58f3('0x81'),_0x2641f8,JSON['stringify'](_0xd37a0c));delete _0xd37a0c[_0x58f3('0x25')];if(_0x2641f8===0x191){_0x2641f8=0x190;}_0x4508ae[_0x58f3('0x18')](_0x2641f8)['send'](_0x4ae6ff[_0x58f3('0x2e')]['test']?{'message':_0x58f3('0x82'),'statusCode':_0xd37a0c[_0x58f3('0x7f')]}:_0xd37a0c);});}; \ No newline at end of file +var _0x9c6d=['json','offset','undefined','count','set','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','filter','includeAll','findAll','rows','catch','params','include','options','find','create','body','findOne','pick','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','zoho.eu','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','remove','includes','api_name','system_mandatory','custom_field','picklist','pick_list_values','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status'];(function(_0x2b63c9,_0x9b77ef){var _0x5928c6=function(_0x557c53){while(--_0x557c53){_0x2b63c9['push'](_0x2b63c9['shift']());}};_0x5928c6(++_0x9b77ef);}(_0x9c6d,0x16a));var _0xd9c6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9c6d[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xd9c6('0x0'));var rimraf=require(_0xd9c6('0x1'));var zipdir=require(_0xd9c6('0x2'));var jsonpatch=require(_0xd9c6('0x3'));var rp=require(_0xd9c6('0x4'));var moment=require(_0xd9c6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd9c6('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd9c6('0x7'));var fs=require('fs');var fs_extra=require(_0xd9c6('0x8'));var _=require(_0xd9c6('0x9'));var squel=require('squel');var crypto=require(_0xd9c6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd9c6('0xb'));var Papa=require(_0xd9c6('0xc'));var Redis=require(_0xd9c6('0xd'));var authService=require(_0xd9c6('0xe'));var qs=require(_0xd9c6('0xf'));var as=require(_0xd9c6('0x10'));var hardwareService=require(_0xd9c6('0x11'));var logger=require(_0xd9c6('0x12'))('api');var utils=require(_0xd9c6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd9c6('0x14'));var db=require(_0xd9c6('0x15'))['db'];var integrations=require(_0xd9c6('0x16'));function respondWithStatusCode(_0x58c137,_0x1c8311){_0x1c8311=_0x1c8311||0xcc;return function(_0x42a5b4){if(_0x42a5b4){return _0x58c137[_0xd9c6('0x17')](_0x1c8311);}return _0x58c137[_0xd9c6('0x18')](_0x1c8311)['end']();};}function respondWithResult(_0xb58da5,_0x1330cc){_0x1330cc=_0x1330cc||0xc8;return function(_0x11098d){if(_0x11098d){return _0xb58da5[_0xd9c6('0x18')](_0x1330cc)[_0xd9c6('0x19')](_0x11098d);}};}function respondWithFilteredResult(_0x5e81a7,_0x43fec9){return function(_0x4affd9){if(_0x4affd9){var _0x1b104c=typeof _0x43fec9[_0xd9c6('0x1a')]===_0xd9c6('0x1b')&&typeof _0x43fec9['limit']===_0xd9c6('0x1b');var _0x48c542=_0x4affd9[_0xd9c6('0x1c')];var _0x55241b=_0x1b104c?0x0:_0x43fec9[_0xd9c6('0x1a')];var _0x3da000=_0x1b104c?_0x4affd9[_0xd9c6('0x1c')]:_0x43fec9[_0xd9c6('0x1a')]+_0x43fec9['limit'];var _0xfee936;if(_0x3da000>=_0x48c542){_0x3da000=_0x48c542;_0xfee936=0xc8;}else{_0xfee936=0xce;}_0x5e81a7[_0xd9c6('0x18')](_0xfee936);return _0x5e81a7[_0xd9c6('0x1d')]('Content-Range',_0x55241b+'-'+_0x3da000+'/'+_0x48c542)[_0xd9c6('0x19')](_0x4affd9);}return null;};}function patchUpdates(_0x51bdde){return function(_0x4418db){try{jsonpatch[_0xd9c6('0x1e')](_0x4418db,_0x51bdde,!![]);}catch(_0xe2a3ba){return BPromise[_0xd9c6('0x1f')](_0xe2a3ba);}return _0x4418db[_0xd9c6('0x20')]();};}function saveUpdates(_0x47610a,_0x26fcdf){return function(_0xad17a6){if(_0xad17a6){return _0xad17a6[_0xd9c6('0x21')](_0x47610a)['then'](function(_0x23ef11){return _0x23ef11;});}return null;};}function removeEntity(_0x5d0545,_0x49a08d){return function(_0x36df88){if(_0x36df88){return _0x36df88[_0xd9c6('0x22')]()[_0xd9c6('0x23')](function(){_0x5d0545['status'](0xcc)[_0xd9c6('0x24')]();});}};}function handleEntityNotFound(_0x57cc8d,_0x2b70ef){return function(_0x4bb5f3){if(!_0x4bb5f3){_0x57cc8d['sendStatus'](0x194);}return _0x4bb5f3;};}function handleError(_0x2aaecd,_0x5399ef){_0x5399ef=_0x5399ef||0x1f4;return function(_0xaee79c){logger['error'](_0xaee79c[_0xd9c6('0x25')]);if(_0xaee79c['name']){delete _0xaee79c[_0xd9c6('0x26')];}_0x2aaecd[_0xd9c6('0x18')](_0x5399ef)[_0xd9c6('0x27')](_0xaee79c);};}exports[_0xd9c6('0x28')]=function(_0x3db7bc,_0x5b4a58){var _0x298150={},_0x18f74a={},_0x43d6fd={'count':0x0,'rows':[]};var _0xc47ad=_[_0xd9c6('0x29')](db[_0xd9c6('0x2a')][_0xd9c6('0x2b')],function(_0x4bc49e){return{'name':_0x4bc49e[_0xd9c6('0x2c')],'type':_0x4bc49e[_0xd9c6('0x2d')]['key']};});_0x18f74a[_0xd9c6('0x2e')]=_[_0xd9c6('0x29')](_0xc47ad,_0xd9c6('0x26'));_0x18f74a[_0xd9c6('0x2f')]=_[_0xd9c6('0x30')](_0x3db7bc[_0xd9c6('0x2f')]);_0x18f74a[_0xd9c6('0x31')]=_[_0xd9c6('0x32')](_0x18f74a['model'],_0x18f74a['query']);_0x298150['attributes']=_['intersection'](_0x18f74a[_0xd9c6('0x2e')],qs[_0xd9c6('0x33')](_0x3db7bc[_0xd9c6('0x2f')]['fields']));_0x298150[_0xd9c6('0x34')]=_0x298150[_0xd9c6('0x34')][_0xd9c6('0x35')]?_0x298150['attributes']:_0x18f74a[_0xd9c6('0x2e')];if(!_0x3db7bc['query'][_0xd9c6('0x36')](_0xd9c6('0x37'))){_0x298150[_0xd9c6('0x38')]=qs[_0xd9c6('0x38')](_0x3db7bc['query'][_0xd9c6('0x38')]);_0x298150[_0xd9c6('0x1a')]=qs['offset'](_0x3db7bc['query'][_0xd9c6('0x1a')]);}_0x298150[_0xd9c6('0x39')]=qs[_0xd9c6('0x3a')](_0x3db7bc[_0xd9c6('0x2f')][_0xd9c6('0x3a')]);_0x298150['where']=qs[_0xd9c6('0x31')](_['pick'](_0x3db7bc[_0xd9c6('0x2f')],_0x18f74a[_0xd9c6('0x31')]),_0xc47ad);if(_0x3db7bc['query']['filter']){_0x298150['where']=_[_0xd9c6('0x3b')](_0x298150[_0xd9c6('0x3c')],{'$or':_['map'](_0xc47ad,function(_0xce3025){if(_0xce3025['type']!==_0xd9c6('0x3d')){var _0x16d832={};_0x16d832[_0xce3025['name']]={'$like':'%'+_0x3db7bc[_0xd9c6('0x2f')][_0xd9c6('0x3e')]+'%'};return _0x16d832;}})});}_0x298150=_['merge']({},_0x298150,_0x3db7bc['options']);var _0x4cfc4d={'where':_0x298150[_0xd9c6('0x3c')]};return db['ZohoAccount']['count'](_0x4cfc4d)[_0xd9c6('0x23')](function(_0x435d9a){_0x43d6fd['count']=_0x435d9a;if(_0x3db7bc[_0xd9c6('0x2f')][_0xd9c6('0x3f')]){_0x298150['include']=[{'all':!![]}];}return db[_0xd9c6('0x2a')][_0xd9c6('0x40')](_0x298150);})[_0xd9c6('0x23')](function(_0x170240){_0x43d6fd[_0xd9c6('0x41')]=_0x170240;return _0x43d6fd;})[_0xd9c6('0x23')](respondWithFilteredResult(_0x5b4a58,_0x298150))[_0xd9c6('0x42')](handleError(_0x5b4a58,null));};exports['show']=function(_0x3a95ed,_0x5aa457){var _0x1b958a={'raw':![],'where':{'id':_0x3a95ed[_0xd9c6('0x43')]['id']}},_0x5c2332={};_0x5c2332['model']=_['keys'](db[_0xd9c6('0x2a')][_0xd9c6('0x2b')]);_0x5c2332['query']=_[_0xd9c6('0x30')](_0x3a95ed[_0xd9c6('0x2f')]);_0x5c2332[_0xd9c6('0x31')]=_['intersection'](_0x5c2332[_0xd9c6('0x2e')],_0x5c2332[_0xd9c6('0x2f')]);_0x1b958a[_0xd9c6('0x34')]=_['intersection'](_0x5c2332[_0xd9c6('0x2e')],qs[_0xd9c6('0x33')](_0x3a95ed[_0xd9c6('0x2f')][_0xd9c6('0x33')]));_0x1b958a[_0xd9c6('0x34')]=_0x1b958a[_0xd9c6('0x34')]['length']?_0x1b958a[_0xd9c6('0x34')]:_0x5c2332[_0xd9c6('0x2e')];if(_0x3a95ed['query'][_0xd9c6('0x3f')]){_0x1b958a[_0xd9c6('0x44')]=[{'all':!![]}];}_0x1b958a=_[_0xd9c6('0x3b')]({},_0x1b958a,_0x3a95ed[_0xd9c6('0x45')]);return db[_0xd9c6('0x2a')][_0xd9c6('0x46')](_0x1b958a)[_0xd9c6('0x23')](handleEntityNotFound(_0x5aa457,null))[_0xd9c6('0x23')](respondWithResult(_0x5aa457,null))[_0xd9c6('0x42')](handleError(_0x5aa457,null));};exports[_0xd9c6('0x47')]=function(_0x33c5eb,_0x2d15f1){return db['ZohoAccount']['create'](_0x33c5eb[_0xd9c6('0x48')],{})[_0xd9c6('0x23')](respondWithResult(_0x2d15f1,0xc9))[_0xd9c6('0x42')](handleError(_0x2d15f1,null));};exports[_0xd9c6('0x21')]=function(_0x5cb8fc,_0x1696d8){if(_0x5cb8fc['body']['id']){delete _0x5cb8fc[_0xd9c6('0x48')]['id'];}return db['ZohoAccount'][_0xd9c6('0x46')]({'where':{'id':_0x5cb8fc[_0xd9c6('0x43')]['id']}})[_0xd9c6('0x23')](handleEntityNotFound(_0x1696d8,null))[_0xd9c6('0x23')](saveUpdates(_0x5cb8fc[_0xd9c6('0x48')],null))[_0xd9c6('0x23')](respondWithResult(_0x1696d8,null))[_0xd9c6('0x42')](handleError(_0x1696d8,null));};exports['destroy']=function(_0x3ef1c5,_0x26f3c8){return db[_0xd9c6('0x2a')][_0xd9c6('0x46')]({'where':{'id':_0x3ef1c5[_0xd9c6('0x43')]['id']}})[_0xd9c6('0x23')](handleEntityNotFound(_0x26f3c8,null))['then'](removeEntity(_0x26f3c8,null))[_0xd9c6('0x42')](handleError(_0x26f3c8,null));};exports['getConfigurations']=function(_0x194170,_0x5031d7,_0x3ffac7){var _0x296baf={};var _0xdb6df9={};var _0x5f1d78;var _0x1b1578;return db[_0xd9c6('0x2a')][_0xd9c6('0x49')]({'where':{'id':_0x194170[_0xd9c6('0x43')]['id']}})['then'](handleEntityNotFound(_0x5031d7,null))[_0xd9c6('0x23')](function(_0x5551bb){if(_0x5551bb){_0x5f1d78=_0x5551bb;_0xdb6df9[_0xd9c6('0x2e')]=_[_0xd9c6('0x30')](db['ZohoConfiguration'][_0xd9c6('0x2b')]);_0xdb6df9['query']=_[_0xd9c6('0x30')](_0x194170[_0xd9c6('0x2f')]);_0xdb6df9[_0xd9c6('0x31')]=_[_0xd9c6('0x32')](_0xdb6df9[_0xd9c6('0x2e')],_0xdb6df9[_0xd9c6('0x2f')]);_0x296baf[_0xd9c6('0x34')]=_[_0xd9c6('0x32')](_0xdb6df9[_0xd9c6('0x2e')],qs[_0xd9c6('0x33')](_0x194170[_0xd9c6('0x2f')][_0xd9c6('0x33')]));_0x296baf[_0xd9c6('0x34')]=_0x296baf[_0xd9c6('0x34')][_0xd9c6('0x35')]?_0x296baf[_0xd9c6('0x34')]:_0xdb6df9[_0xd9c6('0x2e')];_0x296baf['order']=qs[_0xd9c6('0x3a')](_0x194170['query'][_0xd9c6('0x3a')]);_0x296baf[_0xd9c6('0x3c')]=qs['filters'](_[_0xd9c6('0x4a')](_0x194170[_0xd9c6('0x2f')],_0xdb6df9['filters']));if(_0x194170[_0xd9c6('0x2f')][_0xd9c6('0x3e')]){_0x296baf[_0xd9c6('0x3c')]=_[_0xd9c6('0x3b')](_0x296baf[_0xd9c6('0x3c')],{'$or':_[_0xd9c6('0x29')](_0x296baf[_0xd9c6('0x34')],function(_0x300348){var _0x9f1d69={};_0x9f1d69[_0x300348]={'$like':'%'+_0x194170[_0xd9c6('0x2f')][_0xd9c6('0x3e')]+'%'};return _0x9f1d69;})});}_0x296baf=_[_0xd9c6('0x3b')]({},_0x296baf,_0x194170[_0xd9c6('0x45')]);return _0x5f1d78[_0xd9c6('0x4b')](_0x296baf);}})[_0xd9c6('0x23')](function(_0xae3852){if(_0xae3852){_0x1b1578=_0xae3852[_0xd9c6('0x35')];if(!_0x194170[_0xd9c6('0x2f')]['hasOwnProperty'](_0xd9c6('0x37'))){_0x296baf[_0xd9c6('0x38')]=qs[_0xd9c6('0x38')](_0x194170[_0xd9c6('0x2f')][_0xd9c6('0x38')]);_0x296baf[_0xd9c6('0x1a')]=qs[_0xd9c6('0x1a')](_0x194170[_0xd9c6('0x2f')][_0xd9c6('0x1a')]);}return _0x5f1d78[_0xd9c6('0x4b')](_0x296baf);}})[_0xd9c6('0x23')](function(_0x4b8d29){if(_0x4b8d29){return _0x4b8d29?{'count':_0x1b1578,'rows':_0x4b8d29}:null;}})['then'](respondWithResult(_0x5031d7,null))[_0xd9c6('0x42')](handleError(_0x5031d7,null));};exports[_0xd9c6('0x4c')]=function(_0x35bf91,_0x14ed6f,_0x3b3987){if(_0x35bf91[_0xd9c6('0x48')]['id']){delete _0x35bf91['body']['id'];}return db['ZohoAccount'][_0xd9c6('0x49')]({'where':{'id':_0x35bf91['params']['id']}})['then'](handleEntityNotFound(_0x14ed6f,null))[_0xd9c6('0x23')](function(_0x129e95){if(_0x129e95){_0x35bf91[_0xd9c6('0x48')][_0xd9c6('0x4d')]=_0x129e95['id'];_0x35bf91['body']['Subjects']=integrations[_0xd9c6('0x4e')](_0x35bf91[_0xd9c6('0x48')][_0xd9c6('0x4f')],_0x35bf91[_0xd9c6('0x48')][_0xd9c6('0x2d')]);_0x35bf91['body'][_0xd9c6('0x50')]=integrations[_0xd9c6('0x51')](_0x35bf91['body'][_0xd9c6('0x4f')],_0x35bf91[_0xd9c6('0x48')][_0xd9c6('0x2d')]);return db['ZohoConfiguration']['create'](_0x35bf91[_0xd9c6('0x48')],{'include':[{'model':db[_0xd9c6('0x52')],'as':_0xd9c6('0x53')},{'model':db[_0xd9c6('0x52')],'as':_0xd9c6('0x50')}]});}return null;})[_0xd9c6('0x23')](respondWithResult(_0x14ed6f,null))[_0xd9c6('0x42')](handleError(_0x14ed6f,null));};function getAccessToken(_0x6a2b48){return new Promise(function(_0x5b96aa,_0x17ab93){var _0x190f72;switch(_0x6a2b48[_0xd9c6('0x54')]){case'US':_0x190f72=_0xd9c6('0x55');break;case'AU':_0x190f72=_0xd9c6('0x56');break;case'EU':_0x190f72=_0xd9c6('0x57');break;case'IN':_0x190f72=_0xd9c6('0x58');break;case'CN':_0x190f72='https://accounts.zoho.com.cn';break;default:_0x190f72=_0xd9c6('0x57');break;}var _0x30439b={'method':_0xd9c6('0x59'),'uri':_0x190f72+'/oauth/v2/token','qs':{'refresh_token':_0x6a2b48[_0xd9c6('0x5a')],'client_id':_0x6a2b48[_0xd9c6('0x5b')],'client_secret':_0x6a2b48[_0xd9c6('0x5c')],'grant_type':_0xd9c6('0x5d')},'json':!![]};return rp(_0x30439b)['then'](function(_0x6255c9){if(_0x6255c9[_0xd9c6('0x5e')]){_0x5b96aa(_0x6255c9[_0xd9c6('0x5e')]);}else{_0x17ab93(_0xd9c6('0x5f'));}})[_0xd9c6('0x42')](function(_0xc8cc14){_0x17ab93(_0xc8cc14);});});}exports[_0xd9c6('0x60')]=function(_0x2bd04a,_0x52b3e5,_0x3a0551){var _0x354bfa,_0x5259f2,_0x233cc3,_0x29031f,_0x536f88;return db['ZohoAccount'][_0xd9c6('0x49')]({'where':{'id':_0x2bd04a[_0xd9c6('0x43')]['id']},'attributes':['id',_0xd9c6('0x61'),_0xd9c6('0x54'),_0xd9c6('0x5b'),_0xd9c6('0x5c'),'serverUrl',_0xd9c6('0x62'),_0xd9c6('0x5a')]})[_0xd9c6('0x23')](handleEntityNotFound(_0x52b3e5,null))['then'](function(_0x150953){_0x536f88=_0x150953;_0x354bfa=_0x536f88[_0xd9c6('0x61')];_0x5259f2=_0x354bfa===_0xd9c6('0x63')?'eu':'com';_0x233cc3=_0x536f88[_0xd9c6('0x64')];var _0x404790=_0x233cc3[_0xd9c6('0x65')](-0x1);if(_0x404790==='/'||_0x404790==='\x5c'||_0x404790===':'){_0x233cc3=_0x233cc3[_0xd9c6('0x66')](0x0,_0x233cc3[_0xd9c6('0x67')](_0x404790));}if(!_0x536f88[_0xd9c6('0x5a')]){throw new Error(_0xd9c6('0x68'));}return getAccessToken(_0x536f88);})['then'](function(_0x289b09){if(_0x289b09){return rp({'method':_0xd9c6('0x69'),'uri':util[_0xd9c6('0x6a')](_0xd9c6('0x6b'),_0x5259f2),'qs':{'module':'Calls'},'headers':{'Authorization':_0xd9c6('0x6c')+_0x289b09},'json':!![]});}})[_0xd9c6('0x23')](function(_0x3f6eda){if(_0x3f6eda){if(_0x3f6eda[_0xd9c6('0x6d')]&&_0x3f6eda[_0xd9c6('0x6d')][_0xd9c6('0x6e')]){throw new Error(_0x3f6eda[_0xd9c6('0x6d')][_0xd9c6('0x6e')][_0xd9c6('0x6f')]);}var _0x289f4c=[];var _0x17df88=[];var _0x3fe60d=[_0xd9c6('0x70'),_0xd9c6('0x71'),_0xd9c6('0x72'),_0xd9c6('0x73'),_0xd9c6('0x74'),'Call_Result',_0xd9c6('0x75'),'Call_Type'];_0x17df88=_[_0xd9c6('0x76')](_0x3f6eda[_0xd9c6('0x33')],function(_0x7a6063){return _0x3fe60d[_0xd9c6('0x77')](_0x7a6063[_0xd9c6('0x78')]);});for(var _0x48b892=0x0;_0x48b892<_0x17df88[_0xd9c6('0x35')];_0x48b892++){if(_0x17df88[_0x48b892][_0xd9c6('0x79')]===![]){_0x289f4c['push']({'id':_0x17df88[_0x48b892]['id'],'name':_0x17df88[_0x48b892]['display_label'],'custom':_0x17df88[_0x48b892][_0xd9c6('0x7a')],'options':_0x17df88[_0x48b892]['data_type']===_0xd9c6('0x7b')&&_0x17df88[_0x48b892][_0xd9c6('0x7c')][_0xd9c6('0x35')]>-0x1?_[_0xd9c6('0x29')](_0x17df88[_0x48b892][_0xd9c6('0x7c')],function(_0x75bbec){return{'name':_0x75bbec,'value':_0x75bbec};}):[]});}}return{'count':_0x289f4c['length'],'rows':_0x289f4c};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x52b3e5,null))[_0xd9c6('0x42')](function(_0x423150){var _0xb9b486=_0x2bd04a[_0xd9c6('0x2f')]['test']?0x1f4:_0x423150[_0xd9c6('0x7d')]||0x1f4;logger[_0xd9c6('0x6e')]('getFields,\x20%s,\x20%s,\x20%s',_0xd9c6('0x60'),_0xb9b486,JSON[_0xd9c6('0x7e')](_0x423150));delete _0x423150[_0xd9c6('0x26')];if(_0xb9b486===0x191){_0xb9b486=0x190;}_0x52b3e5[_0xd9c6('0x18')](_0xb9b486)[_0xd9c6('0x27')](_0x2bd04a[_0xd9c6('0x2f')][_0xd9c6('0x7f')]?{'message':_0xd9c6('0x80'),'statusCode':_0x423150[_0xd9c6('0x7d')]}:_0x423150);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1ab0fc0..e2bfb3e 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 _0x7648=['api','moment','path','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','code','host','slice','substring','https://accounts.zoho.com','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','../../config/logger'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x7648,0x117));var _0x8764=function(_0x29fbd2,_0x1f8006){_0x29fbd2=_0x29fbd2-0x0;var _0x565f1e=_0x7648[_0x29fbd2];return _0x565f1e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8764('0x0'))(_0x8764('0x1'));var moment=require(_0x8764('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8764('0x3'));var rimraf=require('rimraf');var config=require(_0x8764('0x4'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x8764('0x5'));module[_0x8764('0x6')]=function(_0x11d38f,_0x257481){return _0x11d38f['define'](_0x8764('0x7'),attributes,{'tableName':_0x8764('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x38ddd8,_0x10ff31,_0x109672){if(_0x38ddd8[_0x8764('0x9')](_0x8764('0xa'))||_0x38ddd8['changed'](_0x8764('0xb'))||_0x38ddd8[_0x8764('0x9')]('clientId')||_0x38ddd8[_0x8764('0x9')](_0x8764('0xc'))||_0x38ddd8[_0x8764('0x9')](_0x8764('0xd'))||_0x38ddd8[_0x8764('0x9')](_0x8764('0xe'))){var _0x1538a7,_0x2e1b0a;_0x1538a7=_0x38ddd8['serverUrl'];var _0x244240=_0x1538a7[_0x8764('0xf')](-0x1);if(_0x244240==='/'||_0x244240==='\x5c'||_0x244240===':'){_0x1538a7=_0x1538a7[_0x8764('0x10')](0x0,_0x1538a7['lastIndexOf'](_0x244240));}switch(_0x38ddd8['zone']){case'US':_0x2e1b0a=_0x8764('0x11');break;case'AU':_0x2e1b0a='https://accounts.zoho.com.au';break;case'IN':_0x2e1b0a='https://accounts.zoho.in';break;case'CN':_0x2e1b0a='https://accounts.zoho.com.cn';break;default:_0x2e1b0a='https://accounts.zoho.eu';break;}var _0x29d014={'method':_0x8764('0x12'),'uri':_0x2e1b0a+_0x8764('0x13'),'form':{'grant_type':_0x8764('0x14'),'client_id':_0x38ddd8[_0x8764('0x15')],'client_secret':_0x38ddd8[_0x8764('0xc')],'redirect_uri':_0x38ddd8[_0x8764('0xb')],'code':_0x38ddd8[_0x8764('0xd')]},'headers':{'Content-Type':_0x8764('0x16')}};return rp(_0x29d014)[_0x8764('0x17')](function(_0x1615cd){var _0x3f0a89=JSON[_0x8764('0x18')](_0x1615cd);if(_0x3f0a89[_0x8764('0x19')]){_0x38ddd8[_0x8764('0x1a')]=_0x3f0a89[_0x8764('0x19')];logger[_0x8764('0x1b')](util[_0x8764('0x1c')](_0x8764('0x1d'),_0x38ddd8['name'],_0x38ddd8['id']));}else{logger[_0x8764('0x1e')](util[_0x8764('0x1c')](_0x8764('0x1f'),_0x38ddd8[_0x8764('0x20')],_0x38ddd8['id']),util[_0x8764('0x21')](_0x3f0a89,{'showHidden':![],'depth':null}));}return _0x109672(null,_0x10ff31);})[_0x8764('0x22')](function(_0x2cc95d){logger[_0x8764('0x1e')](util['format'](_0x8764('0x1f'),_0x38ddd8['name'],_0x38ddd8['id']),util[_0x8764('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x109672(_0x2cc95d);});}else{return _0x109672(null,_0x10ff31);}},'beforeUpdate':function(_0x9dda83,_0x2f9ed8,_0x37b6f4){if(_0x9dda83[_0x8764('0x9')](_0x8764('0xa'))||_0x9dda83[_0x8764('0x9')](_0x8764('0xb'))||_0x9dda83['changed'](_0x8764('0x15'))||_0x9dda83[_0x8764('0x9')]('clientSecret')||_0x9dda83[_0x8764('0x9')](_0x8764('0xd'))||_0x9dda83[_0x8764('0x9')](_0x8764('0xe'))){var _0x36f718,_0x3b67ea;_0x36f718=_0x9dda83[_0x8764('0xb')];var _0x4d0843=_0x36f718['slice'](-0x1);if(_0x4d0843==='/'||_0x4d0843==='\x5c'||_0x4d0843===':'){_0x36f718=_0x36f718[_0x8764('0x10')](0x0,_0x36f718[_0x8764('0x23')](_0x4d0843));}switch(_0x9dda83[_0x8764('0xa')]){case'US':_0x3b67ea='https://accounts.zoho.com';break;case'AU':_0x3b67ea=_0x8764('0x24');break;case'IN':_0x3b67ea=_0x8764('0x25');break;case'CN':_0x3b67ea=_0x8764('0x26');break;default:_0x3b67ea=_0x8764('0x27');break;}var _0x23fc5c={'method':_0x8764('0x12'),'uri':_0x3b67ea+_0x8764('0x13'),'form':{'grant_type':_0x8764('0x14'),'client_id':_0x9dda83[_0x8764('0x15')],'client_secret':_0x9dda83[_0x8764('0xc')],'redirect_uri':_0x9dda83[_0x8764('0xb')],'code':_0x9dda83['code']},'headers':{'Content-Type':_0x8764('0x16')}};return rp(_0x23fc5c)[_0x8764('0x17')](function(_0x52d3d8){var _0x5e56ad=JSON['parse'](_0x52d3d8);if(_0x5e56ad[_0x8764('0x19')]){_0x9dda83[_0x8764('0x1a')]=_0x5e56ad['refresh_token'];logger[_0x8764('0x1b')](util[_0x8764('0x1c')](_0x8764('0x1d'),_0x9dda83[_0x8764('0x20')],_0x9dda83['id']));}else{logger[_0x8764('0x1e')](util['format'](_0x8764('0x1f'),_0x9dda83[_0x8764('0x20')],_0x9dda83['id']),util['inspect'](_0x5e56ad,{'showHidden':![],'depth':null}));}return _0x37b6f4(null,_0x2f9ed8);})[_0x8764('0x22')](function(_0x59e422){logger[_0x8764('0x1e')](util['format'](_0x8764('0x1f'),_0x9dda83[_0x8764('0x20')],_0x9dda83['id']),util[_0x8764('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x37b6f4(_0x59e422);});}else{return _0x37b6f4(null,_0x2f9ed8);}}}});}; \ No newline at end of file +var _0xeca5=['https://accounts.zoho.eu','authorization_code','clientSecret','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','code','https://accounts.zoho.com.au','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','changed','zone','serverUrl','clientId','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x4801bd,_0x368071){var _0x3cf6fc=function(_0x4d376c){while(--_0x4d376c){_0x4801bd['push'](_0x4801bd['shift']());}};_0x3cf6fc(++_0x368071);}(_0xeca5,0xe4));var _0x5eca=function(_0x5da3c6,_0x536542){_0x5da3c6=_0x5da3c6-0x0;var _0xc7a243=_0xeca5[_0x5da3c6];return _0xc7a243;};'use strict';var _=require(_0x5eca('0x0'));var util=require(_0x5eca('0x1'));var logger=require(_0x5eca('0x2'))(_0x5eca('0x3'));var moment=require(_0x5eca('0x4'));var BPromise=require(_0x5eca('0x5'));var rp=require(_0x5eca('0x6'));var fs=require('fs');var path=require(_0x5eca('0x7'));var rimraf=require(_0x5eca('0x8'));var config=require(_0x5eca('0x9'));var attributes=require(_0x5eca('0xa'));var integrations=require(_0x5eca('0xb'));module['exports']=function(_0x471d83,_0x25933d){return _0x471d83[_0x5eca('0xc')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x838731,_0xe88781,_0x107459){if(_0x838731[_0x5eca('0xd')](_0x5eca('0xe'))||_0x838731[_0x5eca('0xd')](_0x5eca('0xf'))||_0x838731[_0x5eca('0xd')](_0x5eca('0x10'))||_0x838731['changed']('clientSecret')||_0x838731[_0x5eca('0xd')]('code')||_0x838731[_0x5eca('0xd')](_0x5eca('0x11'))){var _0x492aa4,_0xee31ac;_0x492aa4=_0x838731[_0x5eca('0xf')];var _0x112ada=_0x492aa4[_0x5eca('0x12')](-0x1);if(_0x112ada==='/'||_0x112ada==='\x5c'||_0x112ada===':'){_0x492aa4=_0x492aa4[_0x5eca('0x13')](0x0,_0x492aa4[_0x5eca('0x14')](_0x112ada));}switch(_0x838731[_0x5eca('0xe')]){case'US':_0xee31ac=_0x5eca('0x15');break;case'AU':_0xee31ac='https://accounts.zoho.com.au';break;case'IN':_0xee31ac=_0x5eca('0x16');break;case'CN':_0xee31ac=_0x5eca('0x17');break;default:_0xee31ac=_0x5eca('0x18');break;}var _0x243dd6={'method':'POST','uri':_0xee31ac+'/oauth/v2/token','form':{'grant_type':_0x5eca('0x19'),'client_id':_0x838731['clientId'],'client_secret':_0x838731[_0x5eca('0x1a')],'redirect_uri':_0x838731[_0x5eca('0xf')],'code':_0x838731['code']},'headers':{'Content-Type':_0x5eca('0x1b')}};return rp(_0x243dd6)[_0x5eca('0x1c')](function(_0x5854c3){var _0x32bad4=JSON['parse'](_0x5854c3);if(_0x32bad4[_0x5eca('0x1d')]){_0x838731[_0x5eca('0x1e')]=_0x32bad4[_0x5eca('0x1d')];logger[_0x5eca('0x1f')](util[_0x5eca('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x838731[_0x5eca('0x21')],_0x838731['id']));}else{logger[_0x5eca('0x22')](util[_0x5eca('0x20')](_0x5eca('0x23'),_0x838731['name'],_0x838731['id']),util[_0x5eca('0x24')](_0x32bad4,{'showHidden':![],'depth':null}));}return _0x107459(null,_0xe88781);})[_0x5eca('0x25')](function(_0x2f8bc8){logger[_0x5eca('0x22')](util[_0x5eca('0x20')](_0x5eca('0x23'),_0x838731[_0x5eca('0x21')],_0x838731['id']),util[_0x5eca('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x107459(_0x2f8bc8);});}else{return _0x107459(null,_0xe88781);}},'beforeUpdate':function(_0x31098b,_0x585648,_0x23e463){if(_0x31098b[_0x5eca('0xd')](_0x5eca('0xe'))||_0x31098b['changed'](_0x5eca('0xf'))||_0x31098b[_0x5eca('0xd')](_0x5eca('0x10'))||_0x31098b[_0x5eca('0xd')](_0x5eca('0x1a'))||_0x31098b['changed'](_0x5eca('0x26'))||_0x31098b[_0x5eca('0xd')]('host')){var _0x1b7667,_0xfe6df5;_0x1b7667=_0x31098b[_0x5eca('0xf')];var _0x1a7ef8=_0x1b7667[_0x5eca('0x12')](-0x1);if(_0x1a7ef8==='/'||_0x1a7ef8==='\x5c'||_0x1a7ef8===':'){_0x1b7667=_0x1b7667[_0x5eca('0x13')](0x0,_0x1b7667[_0x5eca('0x14')](_0x1a7ef8));}switch(_0x31098b[_0x5eca('0xe')]){case'US':_0xfe6df5=_0x5eca('0x15');break;case'AU':_0xfe6df5=_0x5eca('0x27');break;case'IN':_0xfe6df5='https://accounts.zoho.in';break;case'CN':_0xfe6df5='https://accounts.zoho.com.cn';break;default:_0xfe6df5='https://accounts.zoho.eu';break;}var _0x58133b={'method':'POST','uri':_0xfe6df5+'/oauth/v2/token','form':{'grant_type':_0x5eca('0x19'),'client_id':_0x31098b['clientId'],'client_secret':_0x31098b[_0x5eca('0x1a')],'redirect_uri':_0x31098b[_0x5eca('0xf')],'code':_0x31098b[_0x5eca('0x26')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x58133b)[_0x5eca('0x1c')](function(_0x46c648){var _0x3ab3a1=JSON[_0x5eca('0x28')](_0x46c648);if(_0x3ab3a1[_0x5eca('0x1d')]){_0x31098b['refreshToken']=_0x3ab3a1[_0x5eca('0x1d')];logger[_0x5eca('0x1f')](util[_0x5eca('0x20')](_0x5eca('0x29'),_0x31098b[_0x5eca('0x21')],_0x31098b['id']));}else{logger['error'](util['format'](_0x5eca('0x23'),_0x31098b[_0x5eca('0x21')],_0x31098b['id']),util['inspect'](_0x3ab3a1,{'showHidden':![],'depth':null}));}return _0x23e463(null,_0x585648);})[_0x5eca('0x25')](function(_0x2a3c80){logger['error'](util[_0x5eca('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31098b[_0x5eca('0x21')],_0x31098b['id']),util[_0x5eca('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x23e463(_0x2a3c80);});}else{return _0x23e463(null,_0x585648);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index bea1a4a..44df6f2 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 _0x25e7=['find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x25e7,0x1d6));var _0x725e=function(_0x18847a,_0xd6898e){_0x18847a=_0x18847a-0x0;var _0x5b68ca=_0x25e7[_0x18847a];return _0x5b68ca;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});}exports[_0x725e('0x16')]=function(_0x397e33){var _0x268438=this;return new Promise(function(_0x2811e7,_0x528e7d){return db[_0x725e('0x17')][_0x725e('0x18')]({'raw':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x397e33[_0x725e('0x19')]?_0x397e33['options'][_0x725e('0x1b')]||null:null,'attributes':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1c')]||null:null,'limit':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1d')]||null:null,'include':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')]['include']?_[_0x725e('0x1e')](_0x397e33[_0x725e('0x19')][_0x725e('0x1f')],function(_0x3facae){return{'model':db[_0x3facae['model']],'as':_0x3facae['as'],'attributes':_0x3facae[_0x725e('0x1c')],'include':_0x3facae['include']?_['map'](_0x3facae['include'],function(_0x2aad7b){return{'model':db[_0x2aad7b[_0x725e('0x20')]],'as':_0x2aad7b['as'],'attributes':_0x2aad7b[_0x725e('0x1c')],'include':_0x2aad7b['include']?_[_0x725e('0x1e')](_0x2aad7b[_0x725e('0x1f')],function(_0x5a5bef){return{'model':db[_0x5a5bef[_0x725e('0x20')]],'as':_0x5a5bef['as'],'attributes':_0x5a5bef[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x378ace){logger['info']('GetZohoAccount',_0x397e33);logger[_0x725e('0x10')]('GetZohoAccount',_0x397e33,JSON[_0x725e('0x21')](_0x378ace));_0x2811e7(_0x378ace);})['catch'](function(_0x4de2e0){logger[_0x725e('0x12')](_0x725e('0x16'),_0x4de2e0[_0x725e('0x13')],_0x397e33);_0x528e7d(_0x268438['error'](0x1f4,_0x4de2e0[_0x725e('0x13')]));});});};exports['ShowZohoAccount']=function(_0x85d29c){var _0x1ce9c8=this;return new Promise(function(_0x39932f,_0x28951f){return db[_0x725e('0x17')][_0x725e('0x22')]({'raw':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['where']||null:null,'attributes':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['attributes']||null:null,'include':_0x85d29c[_0x725e('0x19')]?_0x85d29c['options'][_0x725e('0x1f')]?_['map'](_0x85d29c[_0x725e('0x19')][_0x725e('0x1f')],function(_0x1f2898){return{'model':db[_0x1f2898[_0x725e('0x20')]],'as':_0x1f2898['as'],'attributes':_0x1f2898[_0x725e('0x1c')],'include':_0x1f2898[_0x725e('0x1f')]?_['map'](_0x1f2898['include'],function(_0x35e5e7){return{'model':db[_0x35e5e7[_0x725e('0x20')]],'as':_0x35e5e7['as'],'attributes':_0x35e5e7[_0x725e('0x1c')],'include':_0x35e5e7['include']?_[_0x725e('0x1e')](_0x35e5e7['include'],function(_0x3ce327){return{'model':db[_0x3ce327[_0x725e('0x20')]],'as':_0x3ce327['as'],'attributes':_0x3ce327[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x725e('0xc')](function(_0x4f15f3){logger['info'](_0x725e('0x23'),_0x85d29c);logger[_0x725e('0x10')](_0x725e('0x23'),_0x85d29c,JSON['stringify'](_0x4f15f3));_0x39932f(_0x4f15f3);})[_0x725e('0x15')](function(_0xec3b9d){logger[_0x725e('0x12')]('ShowZohoAccount',_0xec3b9d[_0x725e('0x13')],_0x85d29c);_0x28951f(_0x1ce9c8['error'](0x1f4,_0xec3b9d[_0x725e('0x13')]));});});}; \ No newline at end of file +var _0x0a05=['ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','then','info','GetZohoAccount','stringify','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request'];(function(_0x48502d,_0x96d535){var _0x46c771=function(_0x111ff5){while(--_0x111ff5){_0x48502d['push'](_0x48502d['shift']());}};_0x46c771(++_0x96d535);}(_0x0a05,0x9e));var _0x50a0=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x0a05[_0x31295c];return _0x2c150e;};'use strict';var _=require(_0x50a0('0x0'));var util=require(_0x50a0('0x1'));var moment=require(_0x50a0('0x2'));var BPromise=require(_0x50a0('0x3'));var rs=require(_0x50a0('0x4'));var fs=require('fs');var Redis=require(_0x50a0('0x5'));var db=require(_0x50a0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x50a0('0x7'))('rpc');var config=require(_0x50a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x50a0('0x9')][_0x50a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b976d,_0x56503f,_0x12c64c){return new BPromise(function(_0x3af2de,_0x294081){return client[_0x50a0('0xb')](_0x4b976d,_0x12c64c)['then'](function(_0x1edead){logger['info'](_0x50a0('0xc'),_0x56503f,_0x50a0('0xd'));logger[_0x50a0('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x56503f,_0x50a0('0xd'),JSON['stringify'](_0x1edead));if(_0x1edead[_0x50a0('0xf')]){if(_0x1edead['error']['code']===0x1f4){logger[_0x50a0('0xf')](_0x50a0('0xc'),_0x56503f,_0x1edead[_0x50a0('0xf')][_0x50a0('0x10')]);return _0x294081(_0x1edead[_0x50a0('0xf')]['message']);}logger[_0x50a0('0xf')](_0x50a0('0xc'),_0x56503f,_0x1edead[_0x50a0('0xf')][_0x50a0('0x10')]);return _0x3af2de(_0x1edead[_0x50a0('0xf')]['message']);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x56503f,'request\x20sent');_0x3af2de(_0x1edead[_0x50a0('0x11')][_0x50a0('0x10')]);}})[_0x50a0('0x12')](function(_0x3a0e4d){logger[_0x50a0('0xf')](_0x50a0('0xc'),_0x56503f,_0x3a0e4d);_0x294081(_0x3a0e4d);});});}exports['GetZohoAccount']=function(_0x4e2e05){var _0x4303b1=this;return new Promise(function(_0x2433e0,_0x195a58){return db[_0x50a0('0x13')][_0x50a0('0x14')]({'raw':_0x4e2e05['options']?_0x4e2e05[_0x50a0('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4e2e05[_0x50a0('0x15')]?_0x4e2e05[_0x50a0('0x15')][_0x50a0('0x16')]||null:null,'attributes':_0x4e2e05[_0x50a0('0x15')]?_0x4e2e05['options'][_0x50a0('0x17')]||null:null,'limit':_0x4e2e05['options']?_0x4e2e05[_0x50a0('0x15')][_0x50a0('0x18')]||null:null,'include':_0x4e2e05['options']?_0x4e2e05[_0x50a0('0x15')][_0x50a0('0x19')]?_[_0x50a0('0x1a')](_0x4e2e05[_0x50a0('0x15')][_0x50a0('0x19')],function(_0x10ec8b){return{'model':db[_0x10ec8b[_0x50a0('0x1b')]],'as':_0x10ec8b['as'],'attributes':_0x10ec8b[_0x50a0('0x17')],'include':_0x10ec8b['include']?_['map'](_0x10ec8b[_0x50a0('0x19')],function(_0x44958b){return{'model':db[_0x44958b[_0x50a0('0x1b')]],'as':_0x44958b['as'],'attributes':_0x44958b['attributes'],'include':_0x44958b[_0x50a0('0x19')]?_[_0x50a0('0x1a')](_0x44958b[_0x50a0('0x19')],function(_0x4a36da){return{'model':db[_0x4a36da[_0x50a0('0x1b')]],'as':_0x4a36da['as'],'attributes':_0x4a36da['attributes']};}):[]};}):[]};}):[]:[]})[_0x50a0('0x1c')](function(_0xf174f5){logger[_0x50a0('0x1d')]('GetZohoAccount',_0x4e2e05);logger[_0x50a0('0xe')](_0x50a0('0x1e'),_0x4e2e05,JSON[_0x50a0('0x1f')](_0xf174f5));_0x2433e0(_0xf174f5);})['catch'](function(_0x3b5eb8){logger[_0x50a0('0xf')](_0x50a0('0x1e'),_0x3b5eb8[_0x50a0('0x10')],_0x4e2e05);_0x195a58(_0x4303b1['error'](0x1f4,_0x3b5eb8['message']));});});};exports['ShowZohoAccount']=function(_0x5524ae){var _0x271aa3=this;return new Promise(function(_0x269d68,_0xd5c166){return db[_0x50a0('0x13')][_0x50a0('0x20')]({'raw':_0x5524ae[_0x50a0('0x15')]?_0x5524ae[_0x50a0('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5524ae['options']?_0x5524ae[_0x50a0('0x15')]['where']||null:null,'attributes':_0x5524ae[_0x50a0('0x15')]?_0x5524ae['options'][_0x50a0('0x17')]||null:null,'include':_0x5524ae[_0x50a0('0x15')]?_0x5524ae[_0x50a0('0x15')][_0x50a0('0x19')]?_[_0x50a0('0x1a')](_0x5524ae[_0x50a0('0x15')][_0x50a0('0x19')],function(_0x10993f){return{'model':db[_0x10993f[_0x50a0('0x1b')]],'as':_0x10993f['as'],'attributes':_0x10993f[_0x50a0('0x17')],'include':_0x10993f[_0x50a0('0x19')]?_[_0x50a0('0x1a')](_0x10993f['include'],function(_0x35b6f1){return{'model':db[_0x35b6f1['model']],'as':_0x35b6f1['as'],'attributes':_0x35b6f1['attributes'],'include':_0x35b6f1[_0x50a0('0x19')]?_[_0x50a0('0x1a')](_0x35b6f1['include'],function(_0x3d473f){return{'model':db[_0x3d473f[_0x50a0('0x1b')]],'as':_0x3d473f['as'],'attributes':_0x3d473f[_0x50a0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x50a0('0x1c')](function(_0x234778){logger[_0x50a0('0x1d')](_0x50a0('0x21'),_0x5524ae);logger[_0x50a0('0xe')](_0x50a0('0x21'),_0x5524ae,JSON[_0x50a0('0x1f')](_0x234778));_0x269d68(_0x234778);})[_0x50a0('0x12')](function(_0x15ca93){logger[_0x50a0('0xf')]('ShowZohoAccount',_0x15ca93[_0x50a0('0x10')],_0x5524ae);_0xd5c166(_0x271aa3[_0x50a0('0xf')](0x1f4,_0x15ca93[_0x50a0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 08a23d2..96d977a 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 _0xd441=['../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd441,0xd3));var _0x1d44=function(_0x368bbe,_0x22d3d2){_0x368bbe=_0x368bbe-0x0;var _0x4c4615=_0xd441[_0x368bbe];return _0x4c4615;};'use strict';var multer=require(_0x1d44('0x0'));var util=require('util');var path=require(_0x1d44('0x1'));var timeout=require(_0x1d44('0x2'));var express=require('express');var router=express[_0x1d44('0x3')]();var fs_extra=require(_0x1d44('0x4'));var auth=require(_0x1d44('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1d44('0x6'));var controller=require(_0x1d44('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1d44('0x8')]);router[_0x1d44('0x9')](_0x1d44('0xa'),auth['isAuthenticated'](),controller[_0x1d44('0xb')]);router[_0x1d44('0x9')](_0x1d44('0xc'),auth[_0x1d44('0xd')](),controller[_0x1d44('0xe')]);router[_0x1d44('0x9')](_0x1d44('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x1d44('0x9')](_0x1d44('0x10'),auth['isAuthenticated'](),controller[_0x1d44('0x11')]);router[_0x1d44('0x12')]('/',auth[_0x1d44('0xd')](),controller[_0x1d44('0x13')]);router[_0x1d44('0x14')]('/:id',auth[_0x1d44('0xd')](),controller[_0x1d44('0x15')]);router[_0x1d44('0x16')](_0x1d44('0xa'),auth[_0x1d44('0xd')](),controller[_0x1d44('0x17')]);module['exports']=router; \ No newline at end of file +var _0xde23=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields'];(function(_0x33cab6,_0x144dcf){var _0x24d490=function(_0x360705){while(--_0x360705){_0x33cab6['push'](_0x33cab6['shift']());}};_0x24d490(++_0x144dcf);}(_0xde23,0xba));var _0x3de2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xde23[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x3de2('0x0'));var path=require(_0x3de2('0x1'));var timeout=require(_0x3de2('0x2'));var express=require(_0x3de2('0x3'));var router=express[_0x3de2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3de2('0x5'));var controller=require(_0x3de2('0x6'));router[_0x3de2('0x7')]('/',auth[_0x3de2('0x8')](),controller[_0x3de2('0x9')]);router[_0x3de2('0x7')](_0x3de2('0xa'),auth[_0x3de2('0x8')](),controller['show']);router[_0x3de2('0x7')](_0x3de2('0xb'),auth[_0x3de2('0x8')](),controller['getFields']);router[_0x3de2('0x7')](_0x3de2('0xc'),auth['isAuthenticated'](),controller[_0x3de2('0xd')]);router[_0x3de2('0x7')](_0x3de2('0xe'),auth[_0x3de2('0x8')](),controller[_0x3de2('0xf')]);router[_0x3de2('0x10')]('/',auth[_0x3de2('0x8')](),controller[_0x3de2('0x11')]);router[_0x3de2('0x12')](_0x3de2('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x3de2('0x13')]('/:id',auth[_0x3de2('0x8')](),controller[_0x3de2('0x14')]);module[_0x3de2('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 07e0d5b..482e39a 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 _0x95e6=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize','exports'];(function(_0x332756,_0x648c8f){var _0x3e6670=function(_0x2d9ddb){while(--_0x2d9ddb){_0x332756['push'](_0x332756['shift']());}};_0x3e6670(++_0x648c8f);}(_0x95e6,0x15e));var _0x695e=function(_0x1e00ef,_0xb693c0){_0x1e00ef=_0x1e00ef-0x0;var _0x4142c9=_0x95e6[_0x1e00ef];return _0x4142c9;};'use strict';var Sequelize=require(_0x695e('0x0'));module[_0x695e('0x1')]={'name':{'type':Sequelize[_0x695e('0x2')]},'moduleCreate':{'type':Sequelize[_0x695e('0x3')](_0x695e('0x4'),_0x695e('0x5'),_0x695e('0x6')),'defaultValue':_0x695e('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x695e('0x7'),_0x695e('0x5'),_0x695e('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x695e('0x2')]}}; \ No newline at end of file +var _0x6efc=['STRING','ENUM','nothing','contact','contact_lead','sequelize','exports'];(function(_0x1a49fc,_0x527071){var _0x5589fc=function(_0x1bf972){while(--_0x1bf972){_0x1a49fc['push'](_0x1a49fc['shift']());}};_0x5589fc(++_0x527071);}(_0x6efc,0xec));var _0xc6ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6efc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc6ef('0x0'));module[_0xc6ef('0x1')]={'name':{'type':Sequelize[_0xc6ef('0x2')]},'moduleCreate':{'type':Sequelize[_0xc6ef('0x3')]('lead','contact',_0xc6ef('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xc6ef('0x3')]('contact_lead',_0xc6ef('0x5'),'lead'),'defaultValue':_0xc6ef('0x6')},'description':{'type':Sequelize[_0xc6ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 6112e85..22641b8 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 _0x860f=['getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','ZohoConfiguration','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','rawAttributes','keys','find','catch','create','body','findOne','ZohoField','getFields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x860f,0xef));var _0xf860=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x860f[_0x16d10f];return _0x50c823;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf860('0x0'));var zipdir=require(_0xf860('0x1'));var jsonpatch=require(_0xf860('0x2'));var rp=require(_0xf860('0x3'));var moment=require(_0xf860('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf860('0x5'));var util=require(_0xf860('0x6'));var path=require(_0xf860('0x7'));var sox=require(_0xf860('0x8'));var csv=require(_0xf860('0x9'));var ejs=require(_0xf860('0xa'));var fs=require('fs');var fs_extra=require(_0xf860('0xb'));var _=require(_0xf860('0xc'));var squel=require('squel');var crypto=require(_0xf860('0xd'));var jsforce=require(_0xf860('0xe'));var deskjs=require(_0xf860('0xf'));var toCsv=require(_0xf860('0x9'));var querystring=require('querystring');var Papa=require(_0xf860('0x10'));var Redis=require(_0xf860('0x11'));var authService=require(_0xf860('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf860('0x13'));var logger=require(_0xf860('0x14'))('api');var utils=require(_0xf860('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf860('0x16'));var db=require(_0xf860('0x17'))['db'];function respondWithStatusCode(_0x109cbe,_0x524b95){_0x524b95=_0x524b95||0xcc;return function(_0x49ecce){if(_0x49ecce){return _0x109cbe[_0xf860('0x18')](_0x524b95);}return _0x109cbe[_0xf860('0x19')](_0x524b95)['end']();};}function respondWithResult(_0x4611de,_0x147aa6){_0x147aa6=_0x147aa6||0xc8;return function(_0x4ee0f3){if(_0x4ee0f3){return _0x4611de['status'](_0x147aa6)[_0xf860('0x1a')](_0x4ee0f3);}};}function respondWithFilteredResult(_0x42403a,_0x3fdeb9){return function(_0x3a3b17){if(_0x3a3b17){var _0x5820e2=typeof _0x3fdeb9[_0xf860('0x1b')]==='undefined'&&typeof _0x3fdeb9[_0xf860('0x1c')]===_0xf860('0x1d');var _0x2a1deb=_0x3a3b17[_0xf860('0x1e')];var _0x2d7d21=_0x5820e2?0x0:_0x3fdeb9[_0xf860('0x1b')];var _0x10c7ed=_0x5820e2?_0x3a3b17[_0xf860('0x1e')]:_0x3fdeb9[_0xf860('0x1b')]+_0x3fdeb9[_0xf860('0x1c')];var _0x1d4312;if(_0x10c7ed>=_0x2a1deb){_0x10c7ed=_0x2a1deb;_0x1d4312=0xc8;}else{_0x1d4312=0xce;}_0x42403a[_0xf860('0x19')](_0x1d4312);return _0x42403a['set'](_0xf860('0x1f'),_0x2d7d21+'-'+_0x10c7ed+'/'+_0x2a1deb)['json'](_0x3a3b17);}return null;};}function patchUpdates(_0x4e89e5){return function(_0x353214){try{jsonpatch[_0xf860('0x20')](_0x353214,_0x4e89e5,!![]);}catch(_0x4ceae8){return BPromise[_0xf860('0x21')](_0x4ceae8);}return _0x353214[_0xf860('0x22')]();};}function saveUpdates(_0x54e528,_0x4cb285){return function(_0x36c550){if(_0x36c550){return _0x36c550[_0xf860('0x23')](_0x54e528)[_0xf860('0x24')](function(_0x39706e){return _0x39706e;});}return null;};}function removeEntity(_0x26caa8,_0x122610){return function(_0x4eee26){if(_0x4eee26){return _0x4eee26[_0xf860('0x25')]()['then'](function(){_0x26caa8[_0xf860('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10f50e,_0x33c878){return function(_0xae059a){if(!_0xae059a){_0x10f50e[_0xf860('0x18')](0x194);}return _0xae059a;};}function handleError(_0x41e976,_0x3866de){_0x3866de=_0x3866de||0x1f4;return function(_0x1b7e0d){logger[_0xf860('0x26')](_0x1b7e0d['stack']);if(_0x1b7e0d[_0xf860('0x27')]){delete _0x1b7e0d['name'];}_0x41e976[_0xf860('0x19')](_0x3866de)[_0xf860('0x28')](_0x1b7e0d);};}exports[_0xf860('0x29')]=function(_0x26ab3c,_0x2da95b){var _0x1e5ccb={},_0x3a9866={},_0x1cd50d={'count':0x0,'rows':[]};var _0x59d9c8=_['map'](db[_0xf860('0x2a')]['rawAttributes'],function(_0x32b23f){return{'name':_0x32b23f[_0xf860('0x2b')],'type':_0x32b23f[_0xf860('0x2c')][_0xf860('0x2d')]};});_0x3a9866[_0xf860('0x2e')]=_[_0xf860('0x2f')](_0x59d9c8,_0xf860('0x27'));_0x3a9866[_0xf860('0x30')]=_['keys'](_0x26ab3c[_0xf860('0x30')]);_0x3a9866['filters']=_['intersection'](_0x3a9866[_0xf860('0x2e')],_0x3a9866[_0xf860('0x30')]);_0x1e5ccb[_0xf860('0x31')]=_[_0xf860('0x32')](_0x3a9866[_0xf860('0x2e')],qs[_0xf860('0x33')](_0x26ab3c['query'][_0xf860('0x33')]));_0x1e5ccb[_0xf860('0x31')]=_0x1e5ccb[_0xf860('0x31')][_0xf860('0x34')]?_0x1e5ccb[_0xf860('0x31')]:_0x3a9866[_0xf860('0x2e')];if(!_0x26ab3c[_0xf860('0x30')][_0xf860('0x35')](_0xf860('0x36'))){_0x1e5ccb[_0xf860('0x1c')]=qs[_0xf860('0x1c')](_0x26ab3c[_0xf860('0x30')][_0xf860('0x1c')]);_0x1e5ccb[_0xf860('0x1b')]=qs[_0xf860('0x1b')](_0x26ab3c[_0xf860('0x30')][_0xf860('0x1b')]);}_0x1e5ccb[_0xf860('0x37')]=qs['sort'](_0x26ab3c[_0xf860('0x30')][_0xf860('0x38')]);_0x1e5ccb[_0xf860('0x39')]=qs[_0xf860('0x3a')](_[_0xf860('0x3b')](_0x26ab3c['query'],_0x3a9866[_0xf860('0x3a')]),_0x59d9c8);if(_0x26ab3c['query']['filter']){_0x1e5ccb['where']=_[_0xf860('0x3c')](_0x1e5ccb[_0xf860('0x39')],{'$or':_['map'](_0x59d9c8,function(_0x16af10){if(_0x16af10[_0xf860('0x2c')]!==_0xf860('0x3d')){var _0x2feb54={};_0x2feb54[_0x16af10['name']]={'$like':'%'+_0x26ab3c['query'][_0xf860('0x3e')]+'%'};return _0x2feb54;}})});}_0x1e5ccb=_[_0xf860('0x3c')]({},_0x1e5ccb,_0x26ab3c[_0xf860('0x3f')]);var _0x33460e={'where':_0x1e5ccb[_0xf860('0x39')]};return db['ZohoConfiguration']['count'](_0x33460e)[_0xf860('0x24')](function(_0x525153){_0x1cd50d[_0xf860('0x1e')]=_0x525153;if(_0x26ab3c[_0xf860('0x30')][_0xf860('0x40')]){_0x1e5ccb[_0xf860('0x41')]=[{'all':!![]}];}return db[_0xf860('0x2a')][_0xf860('0x42')](_0x1e5ccb);})[_0xf860('0x24')](function(_0x1206d3){_0x1cd50d['rows']=_0x1206d3;return _0x1cd50d;})['then'](respondWithFilteredResult(_0x2da95b,_0x1e5ccb))['catch'](handleError(_0x2da95b,null));};exports['show']=function(_0x5a90c8,_0x4bd986){var _0x52f43e={'raw':![],'where':{'id':_0x5a90c8[_0xf860('0x43')]['id']}},_0x21ac95={};_0x21ac95['model']=_['keys'](db[_0xf860('0x2a')][_0xf860('0x44')]);_0x21ac95[_0xf860('0x30')]=_[_0xf860('0x45')](_0x5a90c8['query']);_0x21ac95[_0xf860('0x3a')]=_[_0xf860('0x32')](_0x21ac95[_0xf860('0x2e')],_0x21ac95[_0xf860('0x30')]);_0x52f43e[_0xf860('0x31')]=_[_0xf860('0x32')](_0x21ac95[_0xf860('0x2e')],qs['fields'](_0x5a90c8[_0xf860('0x30')]['fields']));_0x52f43e[_0xf860('0x31')]=_0x52f43e[_0xf860('0x31')][_0xf860('0x34')]?_0x52f43e['attributes']:_0x21ac95['model'];if(_0x5a90c8[_0xf860('0x30')][_0xf860('0x40')]){_0x52f43e[_0xf860('0x41')]=[{'all':!![]}];}_0x52f43e=_[_0xf860('0x3c')]({},_0x52f43e,_0x5a90c8[_0xf860('0x3f')]);return db[_0xf860('0x2a')][_0xf860('0x46')](_0x52f43e)[_0xf860('0x24')](handleEntityNotFound(_0x4bd986,null))[_0xf860('0x24')](respondWithResult(_0x4bd986,null))[_0xf860('0x47')](handleError(_0x4bd986,null));};exports['create']=function(_0x5933b2,_0x265973){return db['ZohoConfiguration'][_0xf860('0x48')](_0x5933b2[_0xf860('0x49')],{})[_0xf860('0x24')](respondWithResult(_0x265973,0xc9))[_0xf860('0x47')](handleError(_0x265973,null));};exports[_0xf860('0x23')]=function(_0x34ec11,_0x2e8b4c){if(_0x34ec11[_0xf860('0x49')]['id']){delete _0x34ec11['body']['id'];}return db[_0xf860('0x2a')][_0xf860('0x46')]({'where':{'id':_0x34ec11[_0xf860('0x43')]['id']}})[_0xf860('0x24')](handleEntityNotFound(_0x2e8b4c,null))[_0xf860('0x24')](saveUpdates(_0x34ec11[_0xf860('0x49')],null))[_0xf860('0x24')](respondWithResult(_0x2e8b4c,null))[_0xf860('0x47')](handleError(_0x2e8b4c,null));};exports['destroy']=function(_0x37680e,_0x3aca11){return db[_0xf860('0x2a')][_0xf860('0x46')]({'where':{'id':_0x37680e[_0xf860('0x43')]['id']}})[_0xf860('0x24')](handleEntityNotFound(_0x3aca11,null))['then'](removeEntity(_0x3aca11,null))[_0xf860('0x47')](handleError(_0x3aca11,null));};exports['getFields']=function(_0x47ec50,_0xbca2b4,_0x395268){var _0x31e61d={};var _0x1241c9={};var _0x5b320e;var _0x59a200;return db[_0xf860('0x2a')][_0xf860('0x4a')]({'where':{'id':_0x47ec50[_0xf860('0x43')]['id']}})[_0xf860('0x24')](handleEntityNotFound(_0xbca2b4,null))[_0xf860('0x24')](function(_0x4d0786){if(_0x4d0786){_0x5b320e=_0x4d0786;_0x1241c9[_0xf860('0x2e')]=_['keys'](db[_0xf860('0x4b')]['rawAttributes']);_0x1241c9['query']=_[_0xf860('0x45')](_0x47ec50[_0xf860('0x30')]);_0x1241c9[_0xf860('0x3a')]=_[_0xf860('0x32')](_0x1241c9['model'],_0x1241c9['query']);_0x31e61d[_0xf860('0x31')]=_[_0xf860('0x32')](_0x1241c9['model'],qs[_0xf860('0x33')](_0x47ec50[_0xf860('0x30')]['fields']));_0x31e61d[_0xf860('0x31')]=_0x31e61d[_0xf860('0x31')][_0xf860('0x34')]?_0x31e61d[_0xf860('0x31')]:_0x1241c9[_0xf860('0x2e')];_0x31e61d[_0xf860('0x37')]=qs['sort'](_0x47ec50[_0xf860('0x30')]['sort']);_0x31e61d['where']=qs[_0xf860('0x3a')](_[_0xf860('0x3b')](_0x47ec50[_0xf860('0x30')],_0x1241c9[_0xf860('0x3a')]));if(_0x47ec50['query'][_0xf860('0x3e')]){_0x31e61d['where']=_['merge'](_0x31e61d['where'],{'$or':_[_0xf860('0x2f')](_0x31e61d['attributes'],function(_0x477f61){var _0x3d7113={};_0x3d7113[_0x477f61]={'$like':'%'+_0x47ec50[_0xf860('0x30')][_0xf860('0x3e')]+'%'};return _0x3d7113;})});}_0x31e61d=_[_0xf860('0x3c')]({},_0x31e61d,_0x47ec50[_0xf860('0x3f')]);return _0x5b320e[_0xf860('0x4c')](_0x31e61d);}})['then'](function(_0x2b3b98){if(_0x2b3b98){_0x59a200=_0x2b3b98[_0xf860('0x34')];if(!_0x47ec50[_0xf860('0x30')][_0xf860('0x35')](_0xf860('0x36'))){_0x31e61d[_0xf860('0x1c')]=qs[_0xf860('0x1c')](_0x47ec50[_0xf860('0x30')]['limit']);_0x31e61d[_0xf860('0x1b')]=qs[_0xf860('0x1b')](_0x47ec50[_0xf860('0x30')][_0xf860('0x1b')]);}return _0x5b320e[_0xf860('0x4c')](_0x31e61d);}})[_0xf860('0x24')](function(_0x12a0a5){if(_0x12a0a5){return _0x12a0a5?{'count':_0x59a200,'rows':_0x12a0a5}:null;}})[_0xf860('0x24')](respondWithResult(_0xbca2b4,null))['catch'](handleError(_0xbca2b4,null));};exports[_0xf860('0x4d')]=function(_0x5383e8,_0x406483,_0x5512fc){var _0x168481={};var _0x3d6955={};var _0x5c87d3;var _0x2f9724;return db[_0xf860('0x2a')]['findOne']({'where':{'id':_0x5383e8['params']['id']}})[_0xf860('0x24')](handleEntityNotFound(_0x406483,null))[_0xf860('0x24')](function(_0x4be4b2){if(_0x4be4b2){_0x5c87d3=_0x4be4b2;_0x3d6955[_0xf860('0x2e')]=_[_0xf860('0x45')](db['ZohoField'][_0xf860('0x44')]);_0x3d6955[_0xf860('0x30')]=_[_0xf860('0x45')](_0x5383e8[_0xf860('0x30')]);_0x3d6955[_0xf860('0x3a')]=_[_0xf860('0x32')](_0x3d6955[_0xf860('0x2e')],_0x3d6955[_0xf860('0x30')]);_0x168481[_0xf860('0x31')]=_['intersection'](_0x3d6955[_0xf860('0x2e')],qs[_0xf860('0x33')](_0x5383e8[_0xf860('0x30')][_0xf860('0x33')]));_0x168481[_0xf860('0x31')]=_0x168481[_0xf860('0x31')][_0xf860('0x34')]?_0x168481[_0xf860('0x31')]:_0x3d6955[_0xf860('0x2e')];_0x168481[_0xf860('0x37')]=qs[_0xf860('0x38')](_0x5383e8[_0xf860('0x30')]['sort']);_0x168481['where']=qs[_0xf860('0x3a')](_['pick'](_0x5383e8[_0xf860('0x30')],_0x3d6955['filters']));if(_0x5383e8[_0xf860('0x30')]['filter']){_0x168481[_0xf860('0x39')]=_[_0xf860('0x3c')](_0x168481[_0xf860('0x39')],{'$or':_[_0xf860('0x2f')](_0x168481[_0xf860('0x31')],function(_0x5e8f97){var _0x58ca32={};_0x58ca32[_0x5e8f97]={'$like':'%'+_0x5383e8[_0xf860('0x30')]['filter']+'%'};return _0x58ca32;})});}_0x168481=_[_0xf860('0x3c')]({},_0x168481,_0x5383e8[_0xf860('0x3f')]);return _0x5c87d3['getSubjects'](_0x168481);}})[_0xf860('0x24')](function(_0x5e9c55){if(_0x5e9c55){_0x2f9724=_0x5e9c55[_0xf860('0x34')];if(!_0x5383e8[_0xf860('0x30')][_0xf860('0x35')](_0xf860('0x36'))){_0x168481['limit']=qs['limit'](_0x5383e8[_0xf860('0x30')][_0xf860('0x1c')]);_0x168481[_0xf860('0x1b')]=qs[_0xf860('0x1b')](_0x5383e8['query'][_0xf860('0x1b')]);}return _0x5c87d3[_0xf860('0x4d')](_0x168481);}})['then'](function(_0x3bda4c){if(_0x3bda4c){return _0x3bda4c?{'count':_0x2f9724,'rows':_0x3bda4c}:null;}})[_0xf860('0x24')](respondWithResult(_0x406483,null))[_0xf860('0x47')](handleError(_0x406483,null));};exports[_0xf860('0x4e')]=function(_0x5120c7,_0x2f3fd1,_0x32cb56){var _0x5e1b47={};var _0x7bd78a={};var _0x1360de;var _0x2a3ec5;return db[_0xf860('0x2a')][_0xf860('0x4a')]({'where':{'id':_0x5120c7[_0xf860('0x43')]['id']}})[_0xf860('0x24')](handleEntityNotFound(_0x2f3fd1,null))['then'](function(_0x519f65){if(_0x519f65){_0x1360de=_0x519f65;_0x7bd78a['model']=_['keys'](db['ZohoField'][_0xf860('0x44')]);_0x7bd78a['query']=_[_0xf860('0x45')](_0x5120c7['query']);_0x7bd78a['filters']=_[_0xf860('0x32')](_0x7bd78a[_0xf860('0x2e')],_0x7bd78a['query']);_0x5e1b47[_0xf860('0x31')]=_[_0xf860('0x32')](_0x7bd78a['model'],qs['fields'](_0x5120c7[_0xf860('0x30')][_0xf860('0x33')]));_0x5e1b47[_0xf860('0x31')]=_0x5e1b47['attributes'][_0xf860('0x34')]?_0x5e1b47['attributes']:_0x7bd78a['model'];_0x5e1b47['order']=qs[_0xf860('0x38')](_0x5120c7[_0xf860('0x30')][_0xf860('0x38')]);_0x5e1b47['where']=qs[_0xf860('0x3a')](_[_0xf860('0x3b')](_0x5120c7['query'],_0x7bd78a['filters']));if(_0x5120c7[_0xf860('0x30')]['filter']){_0x5e1b47[_0xf860('0x39')]=_['merge'](_0x5e1b47['where'],{'$or':_[_0xf860('0x2f')](_0x5e1b47[_0xf860('0x31')],function(_0x5b26c9){var _0x366e75={};_0x366e75[_0x5b26c9]={'$like':'%'+_0x5120c7[_0xf860('0x30')][_0xf860('0x3e')]+'%'};return _0x366e75;})});}_0x5e1b47=_[_0xf860('0x3c')]({},_0x5e1b47,_0x5120c7[_0xf860('0x3f')]);return _0x1360de[_0xf860('0x4e')](_0x5e1b47);}})[_0xf860('0x24')](function(_0x1c2d1e){if(_0x1c2d1e){_0x2a3ec5=_0x1c2d1e[_0xf860('0x34')];if(!_0x5120c7[_0xf860('0x30')][_0xf860('0x35')]('nolimit')){_0x5e1b47[_0xf860('0x1c')]=qs[_0xf860('0x1c')](_0x5120c7[_0xf860('0x30')][_0xf860('0x1c')]);_0x5e1b47[_0xf860('0x1b')]=qs['offset'](_0x5120c7[_0xf860('0x30')][_0xf860('0x1b')]);}return _0x1360de[_0xf860('0x4e')](_0x5e1b47);}})[_0xf860('0x24')](function(_0x70be3){if(_0x70be3){return _0x70be3?{'count':_0x2a3ec5,'rows':_0x70be3}:null;}})[_0xf860('0x24')](respondWithResult(_0x2f3fd1,null))[_0xf860('0x47')](handleError(_0x2f3fd1,null));}; \ No newline at end of file +var _0xf688=['sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','name','send','index','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','ZohoConfiguration','find','create','body','findOne','ZohoField','rawAttributes','order','pick','options','getFields','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf688,0x1ad));var _0x8f68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf688[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f68('0x0'));var zipdir=require(_0x8f68('0x1'));var jsonpatch=require(_0x8f68('0x2'));var rp=require(_0x8f68('0x3'));var moment=require(_0x8f68('0x4'));var BPromise=require(_0x8f68('0x5'));var Mustache=require('mustache');var util=require(_0x8f68('0x6'));var path=require(_0x8f68('0x7'));var sox=require(_0x8f68('0x8'));var csv=require(_0x8f68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f68('0xa'));var squel=require(_0x8f68('0xb'));var crypto=require(_0x8f68('0xc'));var jsforce=require(_0x8f68('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8f68('0x9'));var querystring=require('querystring');var Papa=require(_0x8f68('0xe'));var Redis=require(_0x8f68('0xf'));var authService=require(_0x8f68('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8f68('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8f68('0x12'));var config=require(_0x8f68('0x13'));var licenseUtil=require(_0x8f68('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59b33c,_0x2c8920){_0x2c8920=_0x2c8920||0xcc;return function(_0x51bd92){if(_0x51bd92){return _0x59b33c[_0x8f68('0x15')](_0x2c8920);}return _0x59b33c['status'](_0x2c8920)[_0x8f68('0x16')]();};}function respondWithResult(_0x6cbff9,_0x1f935c){_0x1f935c=_0x1f935c||0xc8;return function(_0x207a7d){if(_0x207a7d){return _0x6cbff9[_0x8f68('0x17')](_0x1f935c)[_0x8f68('0x18')](_0x207a7d);}};}function respondWithFilteredResult(_0x21bd35,_0x22ce84){return function(_0x4520e7){if(_0x4520e7){var _0x1eb1ab=typeof _0x22ce84[_0x8f68('0x19')]===_0x8f68('0x1a')&&typeof _0x22ce84[_0x8f68('0x1b')]===_0x8f68('0x1a');var _0x469a7b=_0x4520e7[_0x8f68('0x1c')];var _0x3ee8fa=_0x1eb1ab?0x0:_0x22ce84['offset'];var _0xdc58db=_0x1eb1ab?_0x4520e7['count']:_0x22ce84[_0x8f68('0x19')]+_0x22ce84[_0x8f68('0x1b')];var _0x252c78;if(_0xdc58db>=_0x469a7b){_0xdc58db=_0x469a7b;_0x252c78=0xc8;}else{_0x252c78=0xce;}_0x21bd35[_0x8f68('0x17')](_0x252c78);return _0x21bd35[_0x8f68('0x1d')]('Content-Range',_0x3ee8fa+'-'+_0xdc58db+'/'+_0x469a7b)[_0x8f68('0x18')](_0x4520e7);}return null;};}function patchUpdates(_0x2f5b1e){return function(_0x36965e){try{jsonpatch[_0x8f68('0x1e')](_0x36965e,_0x2f5b1e,!![]);}catch(_0xf61a57){return BPromise['reject'](_0xf61a57);}return _0x36965e[_0x8f68('0x1f')]();};}function saveUpdates(_0x48bb47,_0x4d5853){return function(_0x59e22e){if(_0x59e22e){return _0x59e22e[_0x8f68('0x20')](_0x48bb47)[_0x8f68('0x21')](function(_0x115ab0){return _0x115ab0;});}return null;};}function removeEntity(_0x1ff914,_0x54f824){return function(_0x523b5d){if(_0x523b5d){return _0x523b5d[_0x8f68('0x22')]()[_0x8f68('0x21')](function(){_0x1ff914[_0x8f68('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249c0b,_0x4f0405){return function(_0x48aea5){if(!_0x48aea5){_0x249c0b['sendStatus'](0x194);}return _0x48aea5;};}function handleError(_0x350822,_0x507484){_0x507484=_0x507484||0x1f4;return function(_0x12e4fc){logger['error'](_0x12e4fc['stack']);if(_0x12e4fc[_0x8f68('0x23')]){delete _0x12e4fc['name'];}_0x350822[_0x8f68('0x17')](_0x507484)[_0x8f68('0x24')](_0x12e4fc);};}exports[_0x8f68('0x25')]=function(_0x40eb2b,_0x186aca){var _0x5955e7={},_0x195144={},_0x4bd177={'count':0x0,'rows':[]};var _0x47e4ac=_['map'](db['ZohoConfiguration']['rawAttributes'],function(_0x33ce27){return{'name':_0x33ce27[_0x8f68('0x26')],'type':_0x33ce27[_0x8f68('0x27')][_0x8f68('0x28')]};});_0x195144['model']=_[_0x8f68('0x29')](_0x47e4ac,_0x8f68('0x23'));_0x195144['query']=_[_0x8f68('0x2a')](_0x40eb2b[_0x8f68('0x2b')]);_0x195144[_0x8f68('0x2c')]=_[_0x8f68('0x2d')](_0x195144[_0x8f68('0x2e')],_0x195144[_0x8f68('0x2b')]);_0x5955e7[_0x8f68('0x2f')]=_[_0x8f68('0x2d')](_0x195144[_0x8f68('0x2e')],qs[_0x8f68('0x30')](_0x40eb2b[_0x8f68('0x2b')][_0x8f68('0x30')]));_0x5955e7[_0x8f68('0x2f')]=_0x5955e7[_0x8f68('0x2f')][_0x8f68('0x31')]?_0x5955e7['attributes']:_0x195144['model'];if(!_0x40eb2b[_0x8f68('0x2b')][_0x8f68('0x32')]('nolimit')){_0x5955e7[_0x8f68('0x1b')]=qs[_0x8f68('0x1b')](_0x40eb2b[_0x8f68('0x2b')][_0x8f68('0x1b')]);_0x5955e7[_0x8f68('0x19')]=qs[_0x8f68('0x19')](_0x40eb2b[_0x8f68('0x2b')]['offset']);}_0x5955e7['order']=qs[_0x8f68('0x33')](_0x40eb2b[_0x8f68('0x2b')]['sort']);_0x5955e7[_0x8f68('0x34')]=qs[_0x8f68('0x2c')](_['pick'](_0x40eb2b[_0x8f68('0x2b')],_0x195144[_0x8f68('0x2c')]),_0x47e4ac);if(_0x40eb2b['query'][_0x8f68('0x35')]){_0x5955e7[_0x8f68('0x34')]=_[_0x8f68('0x36')](_0x5955e7[_0x8f68('0x34')],{'$or':_[_0x8f68('0x29')](_0x47e4ac,function(_0x420309){if(_0x420309[_0x8f68('0x27')]!==_0x8f68('0x37')){var _0x4cdeca={};_0x4cdeca[_0x420309['name']]={'$like':'%'+_0x40eb2b[_0x8f68('0x2b')][_0x8f68('0x35')]+'%'};return _0x4cdeca;}})});}_0x5955e7=_[_0x8f68('0x36')]({},_0x5955e7,_0x40eb2b['options']);var _0x18ea0e={'where':_0x5955e7['where']};return db['ZohoConfiguration'][_0x8f68('0x1c')](_0x18ea0e)['then'](function(_0x16b5ef){_0x4bd177[_0x8f68('0x1c')]=_0x16b5ef;if(_0x40eb2b[_0x8f68('0x2b')][_0x8f68('0x38')]){_0x5955e7[_0x8f68('0x39')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x8f68('0x3a')](_0x5955e7);})['then'](function(_0x39ac36){_0x4bd177['rows']=_0x39ac36;return _0x4bd177;})[_0x8f68('0x21')](respondWithFilteredResult(_0x186aca,_0x5955e7))[_0x8f68('0x3b')](handleError(_0x186aca,null));};exports['show']=function(_0xcf182e,_0x787263){var _0x5d32f7={'raw':![],'where':{'id':_0xcf182e[_0x8f68('0x3c')]['id']}},_0x1054c4={};_0x1054c4[_0x8f68('0x2e')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x1054c4['query']=_[_0x8f68('0x2a')](_0xcf182e[_0x8f68('0x2b')]);_0x1054c4[_0x8f68('0x2c')]=_[_0x8f68('0x2d')](_0x1054c4[_0x8f68('0x2e')],_0x1054c4[_0x8f68('0x2b')]);_0x5d32f7[_0x8f68('0x2f')]=_['intersection'](_0x1054c4[_0x8f68('0x2e')],qs['fields'](_0xcf182e[_0x8f68('0x2b')][_0x8f68('0x30')]));_0x5d32f7['attributes']=_0x5d32f7[_0x8f68('0x2f')][_0x8f68('0x31')]?_0x5d32f7[_0x8f68('0x2f')]:_0x1054c4[_0x8f68('0x2e')];if(_0xcf182e[_0x8f68('0x2b')][_0x8f68('0x38')]){_0x5d32f7[_0x8f68('0x39')]=[{'all':!![]}];}_0x5d32f7=_[_0x8f68('0x36')]({},_0x5d32f7,_0xcf182e['options']);return db[_0x8f68('0x3d')][_0x8f68('0x3e')](_0x5d32f7)[_0x8f68('0x21')](handleEntityNotFound(_0x787263,null))[_0x8f68('0x21')](respondWithResult(_0x787263,null))['catch'](handleError(_0x787263,null));};exports['create']=function(_0x20d52c,_0x5d52c7){return db[_0x8f68('0x3d')][_0x8f68('0x3f')](_0x20d52c[_0x8f68('0x40')],{})[_0x8f68('0x21')](respondWithResult(_0x5d52c7,0xc9))['catch'](handleError(_0x5d52c7,null));};exports['update']=function(_0x3752b6,_0x59d2a9){if(_0x3752b6[_0x8f68('0x40')]['id']){delete _0x3752b6['body']['id'];}return db[_0x8f68('0x3d')][_0x8f68('0x3e')]({'where':{'id':_0x3752b6[_0x8f68('0x3c')]['id']}})['then'](handleEntityNotFound(_0x59d2a9,null))[_0x8f68('0x21')](saveUpdates(_0x3752b6[_0x8f68('0x40')],null))[_0x8f68('0x21')](respondWithResult(_0x59d2a9,null))[_0x8f68('0x3b')](handleError(_0x59d2a9,null));};exports[_0x8f68('0x22')]=function(_0x3634d3,_0x26eb4a){return db[_0x8f68('0x3d')][_0x8f68('0x3e')]({'where':{'id':_0x3634d3['params']['id']}})['then'](handleEntityNotFound(_0x26eb4a,null))['then'](removeEntity(_0x26eb4a,null))[_0x8f68('0x3b')](handleError(_0x26eb4a,null));};exports['getFields']=function(_0x3b1c3b,_0x163ab9,_0x45d4fa){var _0x529052={};var _0x1917cf={};var _0xf59a88;var _0x4604f1;return db['ZohoConfiguration'][_0x8f68('0x41')]({'where':{'id':_0x3b1c3b[_0x8f68('0x3c')]['id']}})[_0x8f68('0x21')](handleEntityNotFound(_0x163ab9,null))[_0x8f68('0x21')](function(_0x54bd21){if(_0x54bd21){_0xf59a88=_0x54bd21;_0x1917cf[_0x8f68('0x2e')]=_[_0x8f68('0x2a')](db[_0x8f68('0x42')][_0x8f68('0x43')]);_0x1917cf[_0x8f68('0x2b')]=_[_0x8f68('0x2a')](_0x3b1c3b[_0x8f68('0x2b')]);_0x1917cf['filters']=_[_0x8f68('0x2d')](_0x1917cf['model'],_0x1917cf[_0x8f68('0x2b')]);_0x529052['attributes']=_[_0x8f68('0x2d')](_0x1917cf[_0x8f68('0x2e')],qs['fields'](_0x3b1c3b[_0x8f68('0x2b')][_0x8f68('0x30')]));_0x529052[_0x8f68('0x2f')]=_0x529052['attributes'][_0x8f68('0x31')]?_0x529052[_0x8f68('0x2f')]:_0x1917cf[_0x8f68('0x2e')];_0x529052[_0x8f68('0x44')]=qs['sort'](_0x3b1c3b[_0x8f68('0x2b')][_0x8f68('0x33')]);_0x529052['where']=qs[_0x8f68('0x2c')](_[_0x8f68('0x45')](_0x3b1c3b[_0x8f68('0x2b')],_0x1917cf[_0x8f68('0x2c')]));if(_0x3b1c3b[_0x8f68('0x2b')][_0x8f68('0x35')]){_0x529052[_0x8f68('0x34')]=_[_0x8f68('0x36')](_0x529052[_0x8f68('0x34')],{'$or':_['map'](_0x529052[_0x8f68('0x2f')],function(_0x534dad){var _0x339e43={};_0x339e43[_0x534dad]={'$like':'%'+_0x3b1c3b[_0x8f68('0x2b')]['filter']+'%'};return _0x339e43;})});}_0x529052=_['merge']({},_0x529052,_0x3b1c3b[_0x8f68('0x46')]);return _0xf59a88[_0x8f68('0x47')](_0x529052);}})[_0x8f68('0x21')](function(_0x5ddc33){if(_0x5ddc33){_0x4604f1=_0x5ddc33['length'];if(!_0x3b1c3b[_0x8f68('0x2b')]['hasOwnProperty'](_0x8f68('0x48'))){_0x529052[_0x8f68('0x1b')]=qs[_0x8f68('0x1b')](_0x3b1c3b['query']['limit']);_0x529052['offset']=qs[_0x8f68('0x19')](_0x3b1c3b[_0x8f68('0x2b')][_0x8f68('0x19')]);}return _0xf59a88[_0x8f68('0x47')](_0x529052);}})['then'](function(_0x5c5d62){if(_0x5c5d62){return _0x5c5d62?{'count':_0x4604f1,'rows':_0x5c5d62}:null;}})[_0x8f68('0x21')](respondWithResult(_0x163ab9,null))[_0x8f68('0x3b')](handleError(_0x163ab9,null));};exports[_0x8f68('0x49')]=function(_0x5c3822,_0x32737,_0x26b695){var _0x179f1e={};var _0x3a4e35={};var _0xcc561b;var _0x378de7;return db[_0x8f68('0x3d')][_0x8f68('0x41')]({'where':{'id':_0x5c3822[_0x8f68('0x3c')]['id']}})[_0x8f68('0x21')](handleEntityNotFound(_0x32737,null))[_0x8f68('0x21')](function(_0x496d43){if(_0x496d43){_0xcc561b=_0x496d43;_0x3a4e35[_0x8f68('0x2e')]=_['keys'](db[_0x8f68('0x42')][_0x8f68('0x43')]);_0x3a4e35[_0x8f68('0x2b')]=_[_0x8f68('0x2a')](_0x5c3822[_0x8f68('0x2b')]);_0x3a4e35['filters']=_['intersection'](_0x3a4e35[_0x8f68('0x2e')],_0x3a4e35[_0x8f68('0x2b')]);_0x179f1e[_0x8f68('0x2f')]=_['intersection'](_0x3a4e35[_0x8f68('0x2e')],qs[_0x8f68('0x30')](_0x5c3822[_0x8f68('0x2b')][_0x8f68('0x30')]));_0x179f1e['attributes']=_0x179f1e[_0x8f68('0x2f')]['length']?_0x179f1e[_0x8f68('0x2f')]:_0x3a4e35[_0x8f68('0x2e')];_0x179f1e['order']=qs[_0x8f68('0x33')](_0x5c3822[_0x8f68('0x2b')][_0x8f68('0x33')]);_0x179f1e[_0x8f68('0x34')]=qs['filters'](_['pick'](_0x5c3822[_0x8f68('0x2b')],_0x3a4e35[_0x8f68('0x2c')]));if(_0x5c3822[_0x8f68('0x2b')][_0x8f68('0x35')]){_0x179f1e[_0x8f68('0x34')]=_['merge'](_0x179f1e[_0x8f68('0x34')],{'$or':_['map'](_0x179f1e[_0x8f68('0x2f')],function(_0x1f22b3){var _0x446980={};_0x446980[_0x1f22b3]={'$like':'%'+_0x5c3822['query'][_0x8f68('0x35')]+'%'};return _0x446980;})});}_0x179f1e=_[_0x8f68('0x36')]({},_0x179f1e,_0x5c3822[_0x8f68('0x46')]);return _0xcc561b[_0x8f68('0x49')](_0x179f1e);}})[_0x8f68('0x21')](function(_0x3ca34d){if(_0x3ca34d){_0x378de7=_0x3ca34d['length'];if(!_0x5c3822[_0x8f68('0x2b')][_0x8f68('0x32')](_0x8f68('0x48'))){_0x179f1e[_0x8f68('0x1b')]=qs[_0x8f68('0x1b')](_0x5c3822[_0x8f68('0x2b')]['limit']);_0x179f1e['offset']=qs[_0x8f68('0x19')](_0x5c3822[_0x8f68('0x2b')][_0x8f68('0x19')]);}return _0xcc561b[_0x8f68('0x49')](_0x179f1e);}})[_0x8f68('0x21')](function(_0x3e8193){if(_0x3e8193){return _0x3e8193?{'count':_0x378de7,'rows':_0x3e8193}:null;}})['then'](respondWithResult(_0x32737,null))[_0x8f68('0x3b')](handleError(_0x32737,null));};exports[_0x8f68('0x4a')]=function(_0x5f45bd,_0x3a3b8c,_0x495f03){var _0x4cfc5d={};var _0x214fba={};var _0x3ea9ca;var _0x34adcc;return db['ZohoConfiguration'][_0x8f68('0x41')]({'where':{'id':_0x5f45bd[_0x8f68('0x3c')]['id']}})[_0x8f68('0x21')](handleEntityNotFound(_0x3a3b8c,null))[_0x8f68('0x21')](function(_0x2b5ed1){if(_0x2b5ed1){_0x3ea9ca=_0x2b5ed1;_0x214fba[_0x8f68('0x2e')]=_[_0x8f68('0x2a')](db[_0x8f68('0x42')][_0x8f68('0x43')]);_0x214fba[_0x8f68('0x2b')]=_['keys'](_0x5f45bd[_0x8f68('0x2b')]);_0x214fba['filters']=_[_0x8f68('0x2d')](_0x214fba[_0x8f68('0x2e')],_0x214fba[_0x8f68('0x2b')]);_0x4cfc5d['attributes']=_[_0x8f68('0x2d')](_0x214fba[_0x8f68('0x2e')],qs[_0x8f68('0x30')](_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x30')]));_0x4cfc5d[_0x8f68('0x2f')]=_0x4cfc5d['attributes'][_0x8f68('0x31')]?_0x4cfc5d['attributes']:_0x214fba[_0x8f68('0x2e')];_0x4cfc5d[_0x8f68('0x44')]=qs['sort'](_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x33')]);_0x4cfc5d[_0x8f68('0x34')]=qs['filters'](_[_0x8f68('0x45')](_0x5f45bd[_0x8f68('0x2b')],_0x214fba[_0x8f68('0x2c')]));if(_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x35')]){_0x4cfc5d['where']=_[_0x8f68('0x36')](_0x4cfc5d[_0x8f68('0x34')],{'$or':_[_0x8f68('0x29')](_0x4cfc5d['attributes'],function(_0x70e2a5){var _0x54bc9d={};_0x54bc9d[_0x70e2a5]={'$like':'%'+_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x35')]+'%'};return _0x54bc9d;})});}_0x4cfc5d=_[_0x8f68('0x36')]({},_0x4cfc5d,_0x5f45bd[_0x8f68('0x46')]);return _0x3ea9ca[_0x8f68('0x4a')](_0x4cfc5d);}})[_0x8f68('0x21')](function(_0x2da16b){if(_0x2da16b){_0x34adcc=_0x2da16b[_0x8f68('0x31')];if(!_0x5f45bd[_0x8f68('0x2b')]['hasOwnProperty'](_0x8f68('0x48'))){_0x4cfc5d[_0x8f68('0x1b')]=qs[_0x8f68('0x1b')](_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x1b')]);_0x4cfc5d[_0x8f68('0x19')]=qs[_0x8f68('0x19')](_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x19')]);}return _0x3ea9ca[_0x8f68('0x4a')](_0x4cfc5d);}})['then'](function(_0xefc963){if(_0xefc963){return _0xefc963?{'count':_0x34adcc,'rows':_0xefc963}:null;}})[_0x8f68('0x21')](respondWithResult(_0x3a3b8c,null))[_0x8f68('0x3b')](handleError(_0x3a3b8c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index dae86d2..625a787 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 _0xde22=['util','api','moment','bluebird','path','rimraf','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0x34c553,_0x3e7dfc){var _0x1357d2=function(_0x3b509f){while(--_0x3b509f){_0x34c553['push'](_0x34c553['shift']());}};_0x1357d2(++_0x3e7dfc);}(_0xde22,0xc5));var _0x2de2=function(_0x1262ec,_0x864ee2){_0x1262ec=_0x1262ec-0x0;var _0x342d5c=_0xde22[_0x1262ec];return _0x342d5c;};'use strict';var _=require(_0x2de2('0x0'));var util=require(_0x2de2('0x1'));var logger=require('../../config/logger')(_0x2de2('0x2'));var moment=require(_0x2de2('0x3'));var BPromise=require(_0x2de2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2de2('0x5'));var rimraf=require(_0x2de2('0x6'));var config=require('../../config/environment');var attributes=require(_0x2de2('0x7'));module[_0x2de2('0x8')]=function(_0x1d4bf4,_0x118fd8){return _0x1d4bf4['define'](_0x2de2('0x9'),attributes,{'tableName':_0x2de2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x172f=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x489b95,_0x548b2b){var _0x469850=function(_0x11484d){while(--_0x11484d){_0x489b95['push'](_0x489b95['shift']());}};_0x469850(++_0x548b2b);}(_0x172f,0xec));var _0xf172=function(_0x2d37d6,_0x11f9e8){_0x2d37d6=_0x2d37d6-0x0;var _0x4595b5=_0x172f[_0x2d37d6];return _0x4595b5;};'use strict';var _=require(_0xf172('0x0'));var util=require(_0xf172('0x1'));var logger=require(_0xf172('0x2'))(_0xf172('0x3'));var moment=require('moment');var BPromise=require(_0xf172('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf172('0x5'));var rimraf=require(_0xf172('0x6'));var config=require(_0xf172('0x7'));var attributes=require(_0xf172('0x8'));module[_0xf172('0x9')]=function(_0x284ef4,_0x465e89){return _0x284ef4[_0xf172('0xa')](_0xf172('0xb'),attributes,{'tableName':_0xf172('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 36b866b..fc5bf64 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 _0x74c6=['http','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0x74c6,0xb3));var _0x674c=function(_0x59ba46,_0x47d7df){_0x59ba46=_0x59ba46-0x0;var _0x2c22fc=_0x74c6[_0x59ba46];return _0x2c22fc;};'use strict';var _=require(_0x674c('0x0'));var util=require('util');var moment=require(_0x674c('0x1'));var BPromise=require(_0x674c('0x2'));var rs=require(_0x674c('0x3'));var fs=require('fs');var Redis=require(_0x674c('0x4'));var db=require(_0x674c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x674c('0x6'));var config=require(_0x674c('0x7'));var jayson=require(_0x674c('0x8'));var client=jayson[_0x674c('0x9')][_0x674c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x389501,_0x23c6a2,_0x5775fa){return new BPromise(function(_0x28ee9e,_0x506f4c){return client['request'](_0x389501,_0x5775fa)['then'](function(_0x301557){logger['info'](_0x674c('0xb'),_0x23c6a2,_0x674c('0xc'));logger[_0x674c('0xd')](_0x674c('0xe'),_0x23c6a2,_0x674c('0xc'),JSON[_0x674c('0xf')](_0x301557));if(_0x301557[_0x674c('0x10')]){if(_0x301557[_0x674c('0x10')][_0x674c('0x11')]===0x1f4){logger[_0x674c('0x10')](_0x674c('0xb'),_0x23c6a2,_0x301557['error'][_0x674c('0x12')]);return _0x506f4c(_0x301557[_0x674c('0x10')][_0x674c('0x12')]);}logger[_0x674c('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x23c6a2,_0x301557[_0x674c('0x10')][_0x674c('0x12')]);return _0x28ee9e(_0x301557['error']['message']);}else{logger[_0x674c('0x13')](_0x674c('0xb'),_0x23c6a2,'request\x20sent');_0x28ee9e(_0x301557['result']['message']);}})[_0x674c('0x14')](function(_0x194e9b){logger[_0x674c('0x10')](_0x674c('0xb'),_0x23c6a2,_0x194e9b);_0x506f4c(_0x194e9b);});});} \ No newline at end of file +var _0xbc2f=['rpc','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc2f,0xd4));var _0xfbc2=function(_0x135c44,_0xe65e71){_0x135c44=_0x135c44-0x0;var _0x4ece8a=_0xbc2f[_0x135c44];return _0x4ece8a;};'use strict';var _=require(_0xfbc2('0x0'));var util=require(_0xfbc2('0x1'));var moment=require(_0xfbc2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbc2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfbc2('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xfbc2('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5545ad,_0xcddd79,_0x3478f1){return new BPromise(function(_0x208e47,_0x159db8){return client[_0xfbc2('0x6')](_0x5545ad,_0x3478f1)[_0xfbc2('0x7')](function(_0x1f3ccc){logger['info'](_0xfbc2('0x8'),_0xcddd79,_0xfbc2('0x9'));logger[_0xfbc2('0xa')](_0xfbc2('0xb'),_0xcddd79,_0xfbc2('0x9'),JSON[_0xfbc2('0xc')](_0x1f3ccc));if(_0x1f3ccc[_0xfbc2('0xd')]){if(_0x1f3ccc[_0xfbc2('0xd')][_0xfbc2('0xe')]===0x1f4){logger[_0xfbc2('0xd')](_0xfbc2('0x8'),_0xcddd79,_0x1f3ccc[_0xfbc2('0xd')][_0xfbc2('0xf')]);return _0x159db8(_0x1f3ccc[_0xfbc2('0xd')][_0xfbc2('0xf')]);}logger[_0xfbc2('0xd')](_0xfbc2('0x8'),_0xcddd79,_0x1f3ccc['error'][_0xfbc2('0xf')]);return _0x208e47(_0x1f3ccc['error'][_0xfbc2('0xf')]);}else{logger[_0xfbc2('0x10')](_0xfbc2('0x8'),_0xcddd79,_0xfbc2('0x9'));_0x208e47(_0x1f3ccc['result']['message']);}})[_0xfbc2('0x11')](function(_0x2e2755){logger[_0xfbc2('0xd')](_0xfbc2('0x8'),_0xcddd79,_0x2e2755);_0x159db8(_0x2e2755);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c98e7dc..ca1917b 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 _0xc034=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','post','create','update','delete'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xc034,0xbc));var _0x4c03=function(_0x4336d3,_0x5d17f0){_0x4336d3=_0x4336d3-0x0;var _0x209e02=_0xc034[_0x4336d3];return _0x209e02;};'use strict';var multer=require(_0x4c03('0x0'));var util=require(_0x4c03('0x1'));var path=require('path');var timeout=require(_0x4c03('0x2'));var express=require(_0x4c03('0x3'));var router=express[_0x4c03('0x4')]();var fs_extra=require(_0x4c03('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4c03('0x6'));var config=require(_0x4c03('0x7'));var controller=require(_0x4c03('0x8'));router[_0x4c03('0x9')]('/',auth[_0x4c03('0xa')](),controller['index']);router[_0x4c03('0x9')](_0x4c03('0xb'),auth[_0x4c03('0xa')](),controller['show']);router[_0x4c03('0xc')]('/',auth[_0x4c03('0xa')](),controller[_0x4c03('0xd')]);router['put'](_0x4c03('0xb'),auth['isAuthenticated'](),controller[_0x4c03('0xe')]);router[_0x4c03('0xf')](_0x4c03('0xb'),auth[_0x4c03('0xa')](),controller['destroy']);module[_0x4c03('0x10')]=router; \ No newline at end of file +var _0xae31=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','exports'];(function(_0x490b21,_0x27b88d){var _0x306fe4=function(_0x3d8c36){while(--_0x3d8c36){_0x490b21['push'](_0x490b21['shift']());}};_0x306fe4(++_0x27b88d);}(_0xae31,0x100));var _0x1ae3=function(_0x454e59,_0x29181d){_0x454e59=_0x454e59-0x0;var _0x34b913=_0xae31[_0x454e59];return _0x34b913;};'use strict';var multer=require('multer');var util=require(_0x1ae3('0x0'));var path=require(_0x1ae3('0x1'));var timeout=require(_0x1ae3('0x2'));var express=require('express');var router=express[_0x1ae3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ae3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1ae3('0x5'));var controller=require(_0x1ae3('0x6'));router[_0x1ae3('0x7')]('/',auth[_0x1ae3('0x8')](),controller[_0x1ae3('0x9')]);router[_0x1ae3('0x7')](_0x1ae3('0xa'),auth[_0x1ae3('0x8')](),controller[_0x1ae3('0xb')]);router['post']('/',auth[_0x1ae3('0x8')](),controller[_0x1ae3('0xc')]);router[_0x1ae3('0xd')]('/:id',auth[_0x1ae3('0x8')](),controller['update']);router[_0x1ae3('0xe')]('/:id',auth[_0x1ae3('0x8')](),controller['destroy']);module[_0x1ae3('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index b47bebe..84e6638 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 _0x1709=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','string'];(function(_0xf613f0,_0x6ae8ea){var _0x94898d=function(_0x5c8b41){while(--_0x5c8b41){_0xf613f0['push'](_0xf613f0['shift']());}};_0x94898d(++_0x6ae8ea);}(_0x1709,0x105));var _0x9170=function(_0x48f62f,_0x585cf7){_0x48f62f=_0x48f62f-0x0;var _0x158dfb=_0x1709[_0x48f62f];return _0x158dfb;};'use strict';var Sequelize=require(_0x9170('0x0'));module[_0x9170('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9170('0x2'),_0x9170('0x3'),_0x9170('0x4'),_0x9170('0x5'),_0x9170('0x6')),'defaultValue':_0x9170('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9170('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9170('0x2'),_0x9170('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9170('0x7')]},'idField':{'type':Sequelize[_0x9170('0x7')]},'nameField':{'type':Sequelize[_0x9170('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9170('0x7')]}}; \ No newline at end of file +var _0x260d=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x2a4938,_0x29f76f){var _0x51d753=function(_0x1df0fa){while(--_0x1df0fa){_0x2a4938['push'](_0x2a4938['shift']());}};_0x51d753(++_0x29f76f);}(_0x260d,0xff));var _0xd260=function(_0x11cd4a,_0x293e80){_0x11cd4a=_0x11cd4a-0x0;var _0x1ca30c=_0x260d[_0x11cd4a];return _0x1ca30c;};'use strict';var Sequelize=require(_0xd260('0x0'));module['exports']={'type':{'type':Sequelize[_0xd260('0x1')](_0xd260('0x2'),_0xd260('0x3'),_0xd260('0x4'),'keyValue',_0xd260('0x5')),'defaultValue':_0xd260('0x2')},'content':{'type':Sequelize[_0xd260('0x6')]},'key':{'type':Sequelize[_0xd260('0x6')]},'keyType':{'type':Sequelize[_0xd260('0x1')](_0xd260('0x2'),_0xd260('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd260('0x6')]},'idField':{'type':Sequelize[_0xd260('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd260('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd260('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 44ba732..48c5793 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 _0x7e56=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','ZohoField','fieldName','type','key','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','then','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb'];(function(_0x4d3329,_0x53e55b){var _0x3abb35=function(_0x10e135){while(--_0x10e135){_0x4d3329['push'](_0x4d3329['shift']());}};_0x3abb35(++_0x53e55b);}(_0x7e56,0x107));var _0x67e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e56[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x67e5('0x0'));var rimraf=require(_0x67e5('0x1'));var zipdir=require(_0x67e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x67e5('0x3'));var moment=require(_0x67e5('0x4'));var BPromise=require(_0x67e5('0x5'));var Mustache=require(_0x67e5('0x6'));var util=require(_0x67e5('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x67e5('0x8'));var ejs=require(_0x67e5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x67e5('0xa'));var squel=require('squel');var crypto=require(_0x67e5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x67e5('0x8'));var querystring=require(_0x67e5('0xc'));var Papa=require(_0x67e5('0xd'));var Redis=require(_0x67e5('0xe'));var authService=require(_0x67e5('0xf'));var qs=require(_0x67e5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x67e5('0x11'))(_0x67e5('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x67e5('0x13'));var db=require(_0x67e5('0x14'))['db'];function respondWithStatusCode(_0x4cd2fe,_0x18d733){_0x18d733=_0x18d733||0xcc;return function(_0x57e4ed){if(_0x57e4ed){return _0x4cd2fe[_0x67e5('0x15')](_0x18d733);}return _0x4cd2fe[_0x67e5('0x16')](_0x18d733)[_0x67e5('0x17')]();};}function respondWithResult(_0x4503ce,_0xfdd6e6){_0xfdd6e6=_0xfdd6e6||0xc8;return function(_0x3b9715){if(_0x3b9715){return _0x4503ce['status'](_0xfdd6e6)['json'](_0x3b9715);}};}function respondWithFilteredResult(_0x2b1496,_0x17a86b){return function(_0x2c0155){if(_0x2c0155){var _0x524ab3=typeof _0x17a86b[_0x67e5('0x18')]===_0x67e5('0x19')&&typeof _0x17a86b[_0x67e5('0x1a')]===_0x67e5('0x19');var _0x2680a6=_0x2c0155[_0x67e5('0x1b')];var _0x10a903=_0x524ab3?0x0:_0x17a86b[_0x67e5('0x18')];var _0x5e8afd=_0x524ab3?_0x2c0155[_0x67e5('0x1b')]:_0x17a86b[_0x67e5('0x18')]+_0x17a86b[_0x67e5('0x1a')];var _0x41e337;if(_0x5e8afd>=_0x2680a6){_0x5e8afd=_0x2680a6;_0x41e337=0xc8;}else{_0x41e337=0xce;}_0x2b1496[_0x67e5('0x16')](_0x41e337);return _0x2b1496['set'](_0x67e5('0x1c'),_0x10a903+'-'+_0x5e8afd+'/'+_0x2680a6)['json'](_0x2c0155);}return null;};}function patchUpdates(_0x2143ff){return function(_0x2bd2f2){try{jsonpatch[_0x67e5('0x1d')](_0x2bd2f2,_0x2143ff,!![]);}catch(_0x486365){return BPromise[_0x67e5('0x1e')](_0x486365);}return _0x2bd2f2['save']();};}function saveUpdates(_0x2a139b,_0x3136ae){return function(_0x9ba496){if(_0x9ba496){return _0x9ba496[_0x67e5('0x1f')](_0x2a139b)['then'](function(_0x2c979c){return _0x2c979c;});}return null;};}function removeEntity(_0x24effe,_0x27355e){return function(_0x434d11){if(_0x434d11){return _0x434d11[_0x67e5('0x20')]()['then'](function(){_0x24effe['status'](0xcc)[_0x67e5('0x17')]();});}};}function handleEntityNotFound(_0x2144e8,_0x38c083){return function(_0x4b3120){if(!_0x4b3120){_0x2144e8[_0x67e5('0x15')](0x194);}return _0x4b3120;};}function handleError(_0x5dca8d,_0x33f050){_0x33f050=_0x33f050||0x1f4;return function(_0x4bcf5){logger[_0x67e5('0x21')](_0x4bcf5[_0x67e5('0x22')]);if(_0x4bcf5[_0x67e5('0x23')]){delete _0x4bcf5[_0x67e5('0x23')];}_0x5dca8d[_0x67e5('0x16')](_0x33f050)[_0x67e5('0x24')](_0x4bcf5);};}exports[_0x67e5('0x25')]=function(_0x55c7f2,_0x42ece2){var _0xe9ec82={},_0x4463ce={},_0x33c506={'count':0x0,'rows':[]};var _0x14fb15=_['map'](db[_0x67e5('0x26')]['rawAttributes'],function(_0x22abaf){return{'name':_0x22abaf[_0x67e5('0x27')],'type':_0x22abaf[_0x67e5('0x28')][_0x67e5('0x29')]};});_0x4463ce['model']=_['map'](_0x14fb15,_0x67e5('0x23'));_0x4463ce['query']=_[_0x67e5('0x2a')](_0x55c7f2['query']);_0x4463ce[_0x67e5('0x2b')]=_[_0x67e5('0x2c')](_0x4463ce['model'],_0x4463ce[_0x67e5('0x2d')]);_0xe9ec82[_0x67e5('0x2e')]=_[_0x67e5('0x2c')](_0x4463ce[_0x67e5('0x2f')],qs[_0x67e5('0x30')](_0x55c7f2['query'][_0x67e5('0x30')]));_0xe9ec82['attributes']=_0xe9ec82[_0x67e5('0x2e')][_0x67e5('0x31')]?_0xe9ec82[_0x67e5('0x2e')]:_0x4463ce['model'];if(!_0x55c7f2['query'][_0x67e5('0x32')](_0x67e5('0x33'))){_0xe9ec82[_0x67e5('0x1a')]=qs[_0x67e5('0x1a')](_0x55c7f2[_0x67e5('0x2d')][_0x67e5('0x1a')]);_0xe9ec82['offset']=qs[_0x67e5('0x18')](_0x55c7f2['query'][_0x67e5('0x18')]);}_0xe9ec82[_0x67e5('0x34')]=qs['sort'](_0x55c7f2['query'][_0x67e5('0x35')]);_0xe9ec82[_0x67e5('0x36')]=qs[_0x67e5('0x2b')](_[_0x67e5('0x37')](_0x55c7f2[_0x67e5('0x2d')],_0x4463ce[_0x67e5('0x2b')]),_0x14fb15);if(_0x55c7f2[_0x67e5('0x2d')][_0x67e5('0x38')]){_0xe9ec82[_0x67e5('0x36')]=_[_0x67e5('0x39')](_0xe9ec82[_0x67e5('0x36')],{'$or':_[_0x67e5('0x3a')](_0x14fb15,function(_0x46a2c6){if(_0x46a2c6[_0x67e5('0x28')]!=='VIRTUAL'){var _0x2c3d98={};_0x2c3d98[_0x46a2c6['name']]={'$like':'%'+_0x55c7f2[_0x67e5('0x2d')][_0x67e5('0x38')]+'%'};return _0x2c3d98;}})});}_0xe9ec82=_[_0x67e5('0x39')]({},_0xe9ec82,_0x55c7f2[_0x67e5('0x3b')]);var _0x9cf061={'where':_0xe9ec82[_0x67e5('0x36')]};return db[_0x67e5('0x26')]['count'](_0x9cf061)['then'](function(_0x73021d){_0x33c506['count']=_0x73021d;if(_0x55c7f2['query'][_0x67e5('0x3c')]){_0xe9ec82[_0x67e5('0x3d')]=[{'all':!![]}];}return db[_0x67e5('0x26')]['findAll'](_0xe9ec82);})[_0x67e5('0x3e')](function(_0x140076){_0x33c506[_0x67e5('0x3f')]=_0x140076;return _0x33c506;})[_0x67e5('0x3e')](respondWithFilteredResult(_0x42ece2,_0xe9ec82))[_0x67e5('0x40')](handleError(_0x42ece2,null));};exports[_0x67e5('0x41')]=function(_0x454a95,_0x3772cf){var _0x177253={'raw':!![],'where':{'id':_0x454a95[_0x67e5('0x42')]['id']}},_0x481b91={};_0x481b91['model']=_[_0x67e5('0x2a')](db[_0x67e5('0x26')][_0x67e5('0x43')]);_0x481b91['query']=_['keys'](_0x454a95[_0x67e5('0x2d')]);_0x481b91[_0x67e5('0x2b')]=_['intersection'](_0x481b91[_0x67e5('0x2f')],_0x481b91['query']);_0x177253[_0x67e5('0x2e')]=_['intersection'](_0x481b91['model'],qs[_0x67e5('0x30')](_0x454a95[_0x67e5('0x2d')][_0x67e5('0x30')]));_0x177253['attributes']=_0x177253[_0x67e5('0x2e')][_0x67e5('0x31')]?_0x177253[_0x67e5('0x2e')]:_0x481b91[_0x67e5('0x2f')];if(_0x454a95['query'][_0x67e5('0x3c')]){_0x177253['include']=[{'all':!![]}];}_0x177253=_[_0x67e5('0x39')]({},_0x177253,_0x454a95['options']);return db[_0x67e5('0x26')][_0x67e5('0x44')](_0x177253)[_0x67e5('0x3e')](handleEntityNotFound(_0x3772cf,null))[_0x67e5('0x3e')](respondWithResult(_0x3772cf,null))[_0x67e5('0x40')](handleError(_0x3772cf,null));};exports[_0x67e5('0x45')]=function(_0x4312e5,_0x177a0e){return db['ZohoField'][_0x67e5('0x45')](_0x4312e5[_0x67e5('0x46')],{})[_0x67e5('0x3e')](respondWithResult(_0x177a0e,0xc9))['catch'](handleError(_0x177a0e,null));};exports[_0x67e5('0x1f')]=function(_0x4818fb,_0x20d318){if(_0x4818fb[_0x67e5('0x46')]['id']){delete _0x4818fb[_0x67e5('0x46')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x4818fb[_0x67e5('0x42')]['id']}})[_0x67e5('0x3e')](handleEntityNotFound(_0x20d318,null))[_0x67e5('0x3e')](saveUpdates(_0x4818fb[_0x67e5('0x46')],null))[_0x67e5('0x3e')](respondWithResult(_0x20d318,null))[_0x67e5('0x40')](handleError(_0x20d318,null));};exports['destroy']=function(_0x48b198,_0x1a60ea){return db[_0x67e5('0x26')][_0x67e5('0x44')]({'where':{'id':_0x48b198[_0x67e5('0x42')]['id']}})[_0x67e5('0x3e')](handleEntityNotFound(_0x1a60ea,null))[_0x67e5('0x3e')](removeEntity(_0x1a60ea,null))[_0x67e5('0x40')](handleError(_0x1a60ea,null));}; \ No newline at end of file +var _0x9a86=['stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','options','include','ZohoField','findAll','show','params','includeAll','create','body','find','catch','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error'];(function(_0x3244a8,_0x113d30){var _0x510ed4=function(_0xe7485a){while(--_0xe7485a){_0x3244a8['push'](_0x3244a8['shift']());}};_0x510ed4(++_0x113d30);}(_0x9a86,0xae));var _0x69a8=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x9a86[_0x34bc6c];return _0x168820;};'use strict';var emlformat=require(_0x69a8('0x0'));var rimraf=require(_0x69a8('0x1'));var zipdir=require(_0x69a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x69a8('0x3'));var BPromise=require(_0x69a8('0x4'));var Mustache=require(_0x69a8('0x5'));var util=require(_0x69a8('0x6'));var path=require(_0x69a8('0x7'));var sox=require(_0x69a8('0x8'));var csv=require(_0x69a8('0x9'));var ejs=require(_0x69a8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x69a8('0xb'));var squel=require(_0x69a8('0xc'));var crypto=require(_0x69a8('0xd'));var jsforce=require(_0x69a8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x69a8('0x9'));var querystring=require('querystring');var Papa=require(_0x69a8('0xf'));var Redis=require(_0x69a8('0x10'));var authService=require(_0x69a8('0x11'));var qs=require(_0x69a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x69a8('0x13'));var logger=require(_0x69a8('0x14'))('api');var utils=require(_0x69a8('0x15'));var config=require(_0x69a8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x69a8('0x17'))['db'];function respondWithStatusCode(_0x2520f8,_0x3e6b54){_0x3e6b54=_0x3e6b54||0xcc;return function(_0x236c1d){if(_0x236c1d){return _0x2520f8[_0x69a8('0x18')](_0x3e6b54);}return _0x2520f8['status'](_0x3e6b54)['end']();};}function respondWithResult(_0x5af70a,_0x24563b){_0x24563b=_0x24563b||0xc8;return function(_0x4ec32b){if(_0x4ec32b){return _0x5af70a[_0x69a8('0x19')](_0x24563b)[_0x69a8('0x1a')](_0x4ec32b);}};}function respondWithFilteredResult(_0x23125c,_0x15967a){return function(_0x3ee08c){if(_0x3ee08c){var _0x5dab23=typeof _0x15967a[_0x69a8('0x1b')]==='undefined'&&typeof _0x15967a['limit']==='undefined';var _0x41a22a=_0x3ee08c[_0x69a8('0x1c')];var _0x225e0b=_0x5dab23?0x0:_0x15967a['offset'];var _0x5234f7=_0x5dab23?_0x3ee08c[_0x69a8('0x1c')]:_0x15967a['offset']+_0x15967a[_0x69a8('0x1d')];var _0x8daa2b;if(_0x5234f7>=_0x41a22a){_0x5234f7=_0x41a22a;_0x8daa2b=0xc8;}else{_0x8daa2b=0xce;}_0x23125c[_0x69a8('0x19')](_0x8daa2b);return _0x23125c[_0x69a8('0x1e')](_0x69a8('0x1f'),_0x225e0b+'-'+_0x5234f7+'/'+_0x41a22a)[_0x69a8('0x1a')](_0x3ee08c);}return null;};}function patchUpdates(_0x42365b){return function(_0x493ef9){try{jsonpatch['apply'](_0x493ef9,_0x42365b,!![]);}catch(_0x50fbf6){return BPromise[_0x69a8('0x20')](_0x50fbf6);}return _0x493ef9[_0x69a8('0x21')]();};}function saveUpdates(_0x5a7935,_0x21f9a8){return function(_0x3ae9d9){if(_0x3ae9d9){return _0x3ae9d9[_0x69a8('0x22')](_0x5a7935)[_0x69a8('0x23')](function(_0xa2cc45){return _0xa2cc45;});}return null;};}function removeEntity(_0x1263e4,_0x3f9602){return function(_0x1f50a9){if(_0x1f50a9){return _0x1f50a9[_0x69a8('0x24')]()[_0x69a8('0x23')](function(){_0x1263e4[_0x69a8('0x19')](0xcc)[_0x69a8('0x25')]();});}};}function handleEntityNotFound(_0x4db10d,_0x3b7757){return function(_0x7dccc3){if(!_0x7dccc3){_0x4db10d[_0x69a8('0x18')](0x194);}return _0x7dccc3;};}function handleError(_0x515e59,_0x466201){_0x466201=_0x466201||0x1f4;return function(_0x47a259){logger[_0x69a8('0x26')](_0x47a259[_0x69a8('0x27')]);if(_0x47a259['name']){delete _0x47a259[_0x69a8('0x28')];}_0x515e59[_0x69a8('0x19')](_0x466201)[_0x69a8('0x29')](_0x47a259);};}exports['index']=function(_0x4d7e11,_0x5e923b){var _0x45853d={},_0x52fa00={},_0x3e72d1={'count':0x0,'rows':[]};var _0x29443a=_[_0x69a8('0x2a')](db['ZohoField'][_0x69a8('0x2b')],function(_0xbe7da3){return{'name':_0xbe7da3[_0x69a8('0x2c')],'type':_0xbe7da3[_0x69a8('0x2d')][_0x69a8('0x2e')]};});_0x52fa00[_0x69a8('0x2f')]=_[_0x69a8('0x2a')](_0x29443a,_0x69a8('0x28'));_0x52fa00['query']=_[_0x69a8('0x30')](_0x4d7e11[_0x69a8('0x31')]);_0x52fa00[_0x69a8('0x32')]=_['intersection'](_0x52fa00[_0x69a8('0x2f')],_0x52fa00[_0x69a8('0x31')]);_0x45853d[_0x69a8('0x33')]=_[_0x69a8('0x34')](_0x52fa00[_0x69a8('0x2f')],qs['fields'](_0x4d7e11[_0x69a8('0x31')][_0x69a8('0x35')]));_0x45853d[_0x69a8('0x33')]=_0x45853d[_0x69a8('0x33')][_0x69a8('0x36')]?_0x45853d[_0x69a8('0x33')]:_0x52fa00[_0x69a8('0x2f')];if(!_0x4d7e11[_0x69a8('0x31')]['hasOwnProperty']('nolimit')){_0x45853d[_0x69a8('0x1d')]=qs['limit'](_0x4d7e11[_0x69a8('0x31')]['limit']);_0x45853d[_0x69a8('0x1b')]=qs[_0x69a8('0x1b')](_0x4d7e11[_0x69a8('0x31')][_0x69a8('0x1b')]);}_0x45853d['order']=qs['sort'](_0x4d7e11['query'][_0x69a8('0x37')]);_0x45853d[_0x69a8('0x38')]=qs[_0x69a8('0x32')](_[_0x69a8('0x39')](_0x4d7e11[_0x69a8('0x31')],_0x52fa00[_0x69a8('0x32')]),_0x29443a);if(_0x4d7e11['query'][_0x69a8('0x3a')]){_0x45853d[_0x69a8('0x38')]=_['merge'](_0x45853d[_0x69a8('0x38')],{'$or':_[_0x69a8('0x2a')](_0x29443a,function(_0x55608a){if(_0x55608a['type']!=='VIRTUAL'){var _0x97a545={};_0x97a545[_0x55608a[_0x69a8('0x28')]]={'$like':'%'+_0x4d7e11[_0x69a8('0x31')][_0x69a8('0x3a')]+'%'};return _0x97a545;}})});}_0x45853d=_[_0x69a8('0x3b')]({},_0x45853d,_0x4d7e11[_0x69a8('0x3c')]);var _0x308cdf={'where':_0x45853d[_0x69a8('0x38')]};return db['ZohoField'][_0x69a8('0x1c')](_0x308cdf)['then'](function(_0x3727bf){_0x3e72d1[_0x69a8('0x1c')]=_0x3727bf;if(_0x4d7e11[_0x69a8('0x31')]['includeAll']){_0x45853d[_0x69a8('0x3d')]=[{'all':!![]}];}return db[_0x69a8('0x3e')][_0x69a8('0x3f')](_0x45853d);})[_0x69a8('0x23')](function(_0x2c93a2){_0x3e72d1['rows']=_0x2c93a2;return _0x3e72d1;})[_0x69a8('0x23')](respondWithFilteredResult(_0x5e923b,_0x45853d))['catch'](handleError(_0x5e923b,null));};exports[_0x69a8('0x40')]=function(_0x43f2ac,_0x253a41){var _0x136a95={'raw':!![],'where':{'id':_0x43f2ac[_0x69a8('0x41')]['id']}},_0x342162={};_0x342162[_0x69a8('0x2f')]=_[_0x69a8('0x30')](db[_0x69a8('0x3e')]['rawAttributes']);_0x342162[_0x69a8('0x31')]=_[_0x69a8('0x30')](_0x43f2ac['query']);_0x342162[_0x69a8('0x32')]=_[_0x69a8('0x34')](_0x342162[_0x69a8('0x2f')],_0x342162[_0x69a8('0x31')]);_0x136a95[_0x69a8('0x33')]=_['intersection'](_0x342162['model'],qs[_0x69a8('0x35')](_0x43f2ac[_0x69a8('0x31')][_0x69a8('0x35')]));_0x136a95[_0x69a8('0x33')]=_0x136a95[_0x69a8('0x33')][_0x69a8('0x36')]?_0x136a95[_0x69a8('0x33')]:_0x342162[_0x69a8('0x2f')];if(_0x43f2ac[_0x69a8('0x31')][_0x69a8('0x42')]){_0x136a95[_0x69a8('0x3d')]=[{'all':!![]}];}_0x136a95=_[_0x69a8('0x3b')]({},_0x136a95,_0x43f2ac[_0x69a8('0x3c')]);return db[_0x69a8('0x3e')]['find'](_0x136a95)[_0x69a8('0x23')](handleEntityNotFound(_0x253a41,null))[_0x69a8('0x23')](respondWithResult(_0x253a41,null))['catch'](handleError(_0x253a41,null));};exports[_0x69a8('0x43')]=function(_0x4094c5,_0x44fb5b){return db[_0x69a8('0x3e')]['create'](_0x4094c5[_0x69a8('0x44')],{})[_0x69a8('0x23')](respondWithResult(_0x44fb5b,0xc9))['catch'](handleError(_0x44fb5b,null));};exports[_0x69a8('0x22')]=function(_0x2b4dc,_0x2f0a64){if(_0x2b4dc[_0x69a8('0x44')]['id']){delete _0x2b4dc[_0x69a8('0x44')]['id'];}return db['ZohoField'][_0x69a8('0x45')]({'where':{'id':_0x2b4dc[_0x69a8('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f0a64,null))[_0x69a8('0x23')](saveUpdates(_0x2b4dc['body'],null))[_0x69a8('0x23')](respondWithResult(_0x2f0a64,null))[_0x69a8('0x46')](handleError(_0x2f0a64,null));};exports[_0x69a8('0x24')]=function(_0x2a0aff,_0x1e24b5){return db[_0x69a8('0x3e')]['find']({'where':{'id':_0x2a0aff['params']['id']}})[_0x69a8('0x23')](handleEntityNotFound(_0x1e24b5,null))[_0x69a8('0x23')](removeEntity(_0x1e24b5,null))['catch'](handleError(_0x1e24b5,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d9e0c5b..74ab001 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 _0x6050=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','zoho_unique_index','idField','FieldId','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6050,0x196));var _0x0605=function(_0x13d8b7,_0x853ad8){_0x13d8b7=_0x13d8b7-0x0;var _0x521f14=_0x6050[_0x13d8b7];return _0x521f14;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x4aca21,_0xd78d96){return _0x4aca21['define']('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x0605('0x9'),'fields':[_0x0605('0xa'),_0x0605('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','idField','FieldId','lodash','moment','bluebird'];(function(_0x387274,_0x5d43b5){var _0x2bccd8=function(_0x56bb78){while(--_0x56bb78){_0x387274['push'](_0x387274['shift']());}};_0x2bccd8(++_0x5d43b5);}(_0x7ee1,0x8d));var _0x17ee=function(_0x267481,_0x5ad01d){_0x267481=_0x267481-0x0;var _0x112984=_0x7ee1[_0x267481];return _0x112984;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('ZohoField',attributes,{'tableName':_0x17ee('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x17ee('0xa'),_0x17ee('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 58229bb..5b81d7c 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 _0xd469=['jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5e9011,_0xd11be6){var _0x124e38=function(_0x223fc1){while(--_0x223fc1){_0x5e9011['push'](_0x5e9011['shift']());}};_0x124e38(++_0xd11be6);}(_0xd469,0x8b));var _0x9d46=function(_0x1eab29,_0x392366){_0x1eab29=_0x1eab29-0x0;var _0x22a0d6=_0xd469[_0x1eab29];return _0x22a0d6;};'use strict';var _=require(_0x9d46('0x0'));var util=require(_0x9d46('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d46('0x2'));var fs=require('fs');var Redis=require(_0x9d46('0x3'));var db=require(_0x9d46('0x4'))['db'];var utils=require(_0x9d46('0x5'));var logger=require('../../config/logger')(_0x9d46('0x6'));var config=require(_0x9d46('0x7'));var jayson=require(_0x9d46('0x8'));var client=jayson[_0x9d46('0x9')][_0x9d46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33d130,_0x2d5ee1,_0x3f4f07){return new BPromise(function(_0x4f39bd,_0xd20fed){return client['request'](_0x33d130,_0x3f4f07)[_0x9d46('0xb')](function(_0x334faf){logger[_0x9d46('0xc')](_0x9d46('0xd'),_0x2d5ee1,'request\x20sent');logger[_0x9d46('0xe')](_0x9d46('0xf'),_0x2d5ee1,_0x9d46('0x10'),JSON['stringify'](_0x334faf));if(_0x334faf[_0x9d46('0x11')]){if(_0x334faf[_0x9d46('0x11')]['code']===0x1f4){logger[_0x9d46('0x11')](_0x9d46('0xd'),_0x2d5ee1,_0x334faf['error'][_0x9d46('0x12')]);return _0xd20fed(_0x334faf[_0x9d46('0x11')][_0x9d46('0x12')]);}logger['error'](_0x9d46('0xd'),_0x2d5ee1,_0x334faf['error'][_0x9d46('0x12')]);return _0x4f39bd(_0x334faf[_0x9d46('0x11')]['message']);}else{logger[_0x9d46('0xc')](_0x9d46('0xd'),_0x2d5ee1,_0x9d46('0x10'));_0x4f39bd(_0x334faf[_0x9d46('0x13')][_0x9d46('0x12')]);}})[_0x9d46('0x14')](function(_0x4d117e){logger[_0x9d46('0x11')](_0x9d46('0xd'),_0x2d5ee1,_0x4d117e);_0xd20fed(_0x4d117e);});});} \ No newline at end of file +var _0x6cad=['then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x6cad,0xe5));var _0xd6ca=function(_0x4fc216,_0x393bbb){_0x4fc216=_0x4fc216-0x0;var _0x410b63=_0x6cad[_0x4fc216];return _0x410b63;};'use strict';var _=require('lodash');var util=require(_0xd6ca('0x0'));var moment=require(_0xd6ca('0x1'));var BPromise=require(_0xd6ca('0x2'));var rs=require(_0xd6ca('0x3'));var fs=require('fs');var Redis=require(_0xd6ca('0x4'));var db=require(_0xd6ca('0x5'))['db'];var utils=require(_0xd6ca('0x6'));var logger=require('../../config/logger')(_0xd6ca('0x7'));var config=require('../../config/environment');var jayson=require(_0xd6ca('0x8'));var client=jayson[_0xd6ca('0x9')][_0xd6ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x536e40,_0x426623,_0x3ed044){return new BPromise(function(_0x21ca89,_0x123ac6){return client['request'](_0x536e40,_0x3ed044)[_0xd6ca('0xb')](function(_0x3a4e7c){logger[_0xd6ca('0xc')](_0xd6ca('0xd'),_0x426623,_0xd6ca('0xe'));logger['debug'](_0xd6ca('0xf'),_0x426623,_0xd6ca('0xe'),JSON['stringify'](_0x3a4e7c));if(_0x3a4e7c['error']){if(_0x3a4e7c[_0xd6ca('0x10')][_0xd6ca('0x11')]===0x1f4){logger[_0xd6ca('0x10')](_0xd6ca('0xd'),_0x426623,_0x3a4e7c[_0xd6ca('0x10')][_0xd6ca('0x12')]);return _0x123ac6(_0x3a4e7c['error'][_0xd6ca('0x12')]);}logger[_0xd6ca('0x10')](_0xd6ca('0xd'),_0x426623,_0x3a4e7c['error'][_0xd6ca('0x12')]);return _0x21ca89(_0x3a4e7c[_0xd6ca('0x10')]['message']);}else{logger[_0xd6ca('0xc')](_0xd6ca('0xd'),_0x426623,_0xd6ca('0xe'));_0x21ca89(_0x3a4e7c[_0xd6ca('0x13')][_0xd6ca('0x12')]);}})['catch'](function(_0x5c79a0){logger[_0xd6ca('0x10')]('ZohoField,\x20%s,\x20%s',_0x426623,_0x5c79a0);_0x123ac6(_0x5c79a0);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 303a22f..b47ce82 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x579c64,_0x522989){var _0x5e5efa=function(_0x5e8a3a){while(--_0x5e8a3a){_0x579c64['push'](_0x579c64['shift']());}};_0x5e5efa(++_0x522989);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1c8489,_0x80368c){var _0x16a60f=function(_0x9629e8){while(--_0x9629e8){_0x1c8489['push'](_0x1c8489['shift']());}};_0x16a60f(++_0x80368c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 4491724..e5c873d 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 _0xb37b=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x182e61,_0x170cac){var _0x34fb86=function(_0x47a368){while(--_0x47a368){_0x182e61['push'](_0x182e61['shift']());}};_0x34fb86(++_0x170cac);}(_0xb37b,0x1de));var _0xbb37=function(_0x33fe34,_0x452b90){_0x33fe34=_0x33fe34-0x0;var _0x4daa3b=_0xb37b[_0x33fe34];return _0x4daa3b;};'use strict';var Sequelize=require(_0xbb37('0x0'));module[_0xbb37('0x1')]={'name':{'type':Sequelize[_0xbb37('0x2')],'allowNull':![],'unique':_0xbb37('0x3')},'version':{'type':Sequelize[_0xbb37('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0xbb37('0x4')},'filename':{'type':Sequelize[_0xbb37('0x2')]},'path':{'type':Sequelize[_0xbb37('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xbb37('0x5')]},'active':{'type':Sequelize[_0xbb37('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xbb37('0x2')]},'logo':{'type':Sequelize[_0xbb37('0x2')]},'state':{'type':Sequelize[_0xbb37('0x2')],'unique':_0xbb37('0x7')},'description':{'type':Sequelize[_0xbb37('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xbb37('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x8b9d=['state','sequelize','exports','STRING','unique_name_and_version','INTEGER','BOOLEAN'];(function(_0x5e16ba,_0x24eb73){var _0x536a76=function(_0x1cc4b3){while(--_0x1cc4b3){_0x5e16ba['push'](_0x5e16ba['shift']());}};_0x536a76(++_0x24eb73);}(_0x8b9d,0x6a));var _0xd8b9=function(_0x5a23e5,_0x235f58){_0x5a23e5=_0x5a23e5-0x0;var _0x4f4e67=_0x8b9d[_0x5a23e5];return _0x4f4e67;};'use strict';var Sequelize=require(_0xd8b9('0x0'));module[_0xd8b9('0x1')]={'name':{'type':Sequelize[_0xd8b9('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd8b9('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xd8b9('0x2')]},'path':{'type':Sequelize[_0xd8b9('0x2')]},'type':{'type':Sequelize[_0xd8b9('0x2')]},'size':{'type':Sequelize[_0xd8b9('0x4')]},'active':{'type':Sequelize[_0xd8b9('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xd8b9('0x2')]},'logo':{'type':Sequelize[_0xd8b9('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xd8b9('0x6')},'description':{'type':Sequelize[_0xd8b9('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd8b9('0x2')]},'link':{'type':Sequelize[_0xd8b9('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index d56cee2..1227e5c 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 _0x4991=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','Integration','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters'];(function(_0x1a9bdf,_0x43130a){var _0x61a042=function(_0x13fdf5){while(--_0x13fdf5){_0x1a9bdf['push'](_0x1a9bdf['shift']());}};_0x61a042(++_0x43130a);}(_0x4991,0xf7));var _0x1499=function(_0x21dfc4,_0x1ccdc9){_0x21dfc4=_0x21dfc4-0x0;var _0x597f64=_0x4991[_0x21dfc4];return _0x597f64;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['Integration'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));}; \ No newline at end of file +var _0xacf4=['VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type'];(function(_0x3630dd,_0x4cf50a){var _0x2a213c=function(_0x1a3d1a){while(--_0x1a3d1a){_0x3630dd['push'](_0x3630dd['shift']());}};_0x2a213c(++_0x4cf50a);}(_0xacf4,0xe7));var _0x4acf=function(_0x521a45,_0x5734bd){_0x521a45=_0x521a45-0x0;var _0x25dfa4=_0xacf4[_0x521a45];return _0x25dfa4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['Integration'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['Integration']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index a7be52c..cc511ae 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 _0xae8b=['integrations','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x591d1f,_0x1da826){var _0x1a9cba=function(_0x5b2807){while(--_0x5b2807){_0x591d1f['push'](_0x591d1f['shift']());}};_0x1a9cba(++_0x1da826);}(_0xae8b,0x64));var _0xbae8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xae8b[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xbae8('0x0'));var util=require('util');var logger=require(_0xbae8('0x1'))('api');var moment=require(_0xbae8('0x2'));var BPromise=require(_0xbae8('0x3'));var rp=require(_0xbae8('0x4'));var fs=require('fs');var path=require(_0xbae8('0x5'));var rimraf=require(_0xbae8('0x6'));var config=require(_0xbae8('0x7'));var attributes=require('./integration.attributes');module[_0xbae8('0x8')]=function(_0x8a6e47,_0x517192){return _0x8a6e47[_0xbae8('0x9')]('Integration',attributes,{'tableName':_0xbae8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebd2=['rimraf','../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5cce57,_0x3cbadd){var _0x114fc2=function(_0x5776de){while(--_0x5776de){_0x5cce57['push'](_0x5cce57['shift']());}};_0x114fc2(++_0x3cbadd);}(_0xebd2,0x162));var _0x2ebd=function(_0x1852cd,_0x4f3c3d){_0x1852cd=_0x1852cd-0x0;var _0x40b35d=_0xebd2[_0x1852cd];return _0x40b35d;};'use strict';var _=require(_0x2ebd('0x0'));var util=require(_0x2ebd('0x1'));var logger=require(_0x2ebd('0x2'))('api');var moment=require(_0x2ebd('0x3'));var BPromise=require(_0x2ebd('0x4'));var rp=require(_0x2ebd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ebd('0x6'));var config=require(_0x2ebd('0x7'));var attributes=require('./integration.attributes');module[_0x2ebd('0x8')]=function(_0x507e05,_0x4a72ed){return _0x507e05[_0x2ebd('0x9')](_0x2ebd('0xa'),attributes,{'tableName':_0x2ebd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 1d4b0fe..62b2b39 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x94b5be,_0x45265e){var _0x55655f=function(_0x1a6d44){while(--_0x1a6d44){_0x94b5be['push'](_0x94b5be['shift']());}};_0x55655f(++_0x45265e);}(_0x2ef3,0xba));var _0x32ef=function(_0x1abcae,_0x148854){_0x1abcae=_0x1abcae-0x0;var _0x3371df=_0x2ef3[_0x1abcae];return _0x3371df;};'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')]('Integration,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('Integration,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x568719,_0x7fdc9c){var _0xcb6e38=function(_0x3449da){while(--_0x3449da){_0x568719['push'](_0x568719['shift']());}};_0xcb6e38(++_0x7fdc9c);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 687e351..1401893 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 _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ecd6d,_0x2fd9cd){var _0xea1eb8=function(_0x3fd2fd){while(--_0x3fd2fd){_0x1ecd6d['push'](_0x1ecd6d['shift']());}};_0xea1eb8(++_0x2fd9cd);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x195724,_0xbe4fde){_0x195724=_0x195724-0x0;var _0x56a86f=_0xc6ac[_0x195724];return _0x56a86f;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xadb5=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0xadb5,0xad));var _0x5adb=function(_0x3eb369,_0x23a65e){_0x3eb369=_0x3eb369-0x0;var _0x303596=_0xadb5[_0x3eb369];return _0x303596;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./integrationReport.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['put']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller['destroy']);module[_0x5adb('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 9b991ff..a05a0c3 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 _0xa5d8=['BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x2ccf96,_0x4019a1){var _0x25d083=function(_0x129b14){while(--_0x129b14){_0x2ccf96['push'](_0x2ccf96['shift']());}};_0x25d083(++_0x4019a1);}(_0xa5d8,0x69));var _0x8a5d=function(_0x193d58,_0x574634){_0x193d58=_0x193d58-0x0;var _0x2552d9=_0xa5d8[_0x193d58];return _0x2552d9;};'use strict';var Sequelize=require(_0x8a5d('0x0'));module[_0x8a5d('0x1')]={'integration':{'type':Sequelize[_0x8a5d('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x8a5d('0x2')]},'ticketId':{'type':Sequelize[_0x8a5d('0x2')]},'integrationId':{'type':Sequelize[_0x8a5d('0x3')]},'contacts':{'type':Sequelize[_0x8a5d('0x2')]},'uniqueid':{'type':Sequelize[_0x8a5d('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8a5d('0x2')]},'queue':{'type':Sequelize[_0x8a5d('0x2')]},'interface':{'type':Sequelize[_0x8a5d('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x8a5d('0x4')]},'agentconnectAt':{'type':Sequelize[_0x8a5d('0x4')]},'holdtime':{'type':Sequelize[_0x8a5d('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8a5d('0x4')]},'talktime':{'type':Sequelize[_0x8a5d('0x3')]},'agentacw':{'type':Sequelize[_0x8a5d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8a5d('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x8a5d('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8a5d('0x4')]},'agentdump':{'type':Sequelize[_0x8a5d('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8a5d('0x4')]},'lastevent':{'type':Sequelize[_0x8a5d('0x2')]},'channel':{'type':Sequelize[_0x8a5d('0x2')]},'channelstate':{'type':Sequelize[_0x8a5d('0x3')]},'channelstatedesc':{'type':Sequelize[_0x8a5d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8a5d('0x2')]},'connectedlinename':{'type':Sequelize[_0x8a5d('0x2')]},'language':{'type':Sequelize[_0x8a5d('0x2')]},'accountcode':{'type':Sequelize[_0x8a5d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x8a5d('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8a5d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x8a5d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8a5d('0x2')]},'destcalleridname':{'type':Sequelize[_0x8a5d('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x8a5d('0x2')]},'destlanguage':{'type':Sequelize[_0x8a5d('0x2')]},'destaccountcode':{'type':Sequelize[_0x8a5d('0x2')]},'destcontext':{'type':Sequelize[_0x8a5d('0x2')]},'destexten':{'type':Sequelize[_0x8a5d('0x2')]},'destpriority':{'type':Sequelize[_0x8a5d('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x8a5d('0x2')]},'inReplyTo':{'type':Sequelize[_0x8a5d('0x2')]},'subject':{'type':Sequelize[_0x8a5d('0x2')]},'from':{'type':Sequelize[_0x8a5d('0x2')]},'to':{'type':Sequelize[_0x8a5d('0x2')]},'cc':{'type':Sequelize[_0x8a5d('0x2')]},'attachment':{'type':Sequelize[_0x8a5d('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x8a5d('0x6')]},'status':{'type':Sequelize[_0x8a5d('0x7')]('SENT',_0x8a5d('0x8'),_0x8a5d('0x9'),_0x8a5d('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x8a5d('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x8a5d('0x3')]}}; \ No newline at end of file +var _0x4f39=['DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER'];(function(_0xb12c26,_0x26a2f5){var _0x2e8295=function(_0x207e55){while(--_0x207e55){_0xb12c26['push'](_0xb12c26['shift']());}};_0x2e8295(++_0x26a2f5);}(_0x4f39,0x126));var _0x94f3=function(_0x479137,_0x433ebd){_0x479137=_0x479137-0x0;var _0x2ec14f=_0x4f39[_0x479137];return _0x2ec14f;};'use strict';var Sequelize=require(_0x94f3('0x0'));module['exports']={'integration':{'type':Sequelize[_0x94f3('0x1')]},'eventChannel':{'type':Sequelize[_0x94f3('0x1')]},'exitStatus':{'type':Sequelize[_0x94f3('0x1')]},'ticketId':{'type':Sequelize[_0x94f3('0x1')]},'integrationId':{'type':Sequelize[_0x94f3('0x2')]},'contacts':{'type':Sequelize[_0x94f3('0x1')]},'uniqueid':{'type':Sequelize[_0x94f3('0x1')]},'calleridnum':{'type':Sequelize[_0x94f3('0x1')]},'calleridname':{'type':Sequelize[_0x94f3('0x1')]},'queue':{'type':Sequelize[_0x94f3('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x94f3('0x3')]},'agentconnectAt':{'type':Sequelize[_0x94f3('0x3')]},'holdtime':{'type':Sequelize[_0x94f3('0x2')]},'agentcomplete':{'type':Sequelize[_0x94f3('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x94f3('0x3')]},'talktime':{'type':Sequelize[_0x94f3('0x2')]},'agentacw':{'type':Sequelize[_0x94f3('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x94f3('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x94f3('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x94f3('0x3')]},'agentdump':{'type':Sequelize[_0x94f3('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x94f3('0x3')]},'lastevent':{'type':Sequelize[_0x94f3('0x1')]},'channel':{'type':Sequelize[_0x94f3('0x1')]},'channelstate':{'type':Sequelize[_0x94f3('0x2')]},'channelstatedesc':{'type':Sequelize[_0x94f3('0x1')]},'connectedlinenum':{'type':Sequelize[_0x94f3('0x1')]},'connectedlinename':{'type':Sequelize[_0x94f3('0x1')]},'language':{'type':Sequelize[_0x94f3('0x1')]},'accountcode':{'type':Sequelize[_0x94f3('0x1')]},'context':{'type':Sequelize[_0x94f3('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x94f3('0x1')]},'destchannel':{'type':Sequelize[_0x94f3('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x94f3('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x94f3('0x1')]},'destlanguage':{'type':Sequelize[_0x94f3('0x1')]},'destaccountcode':{'type':Sequelize[_0x94f3('0x1')]},'destcontext':{'type':Sequelize[_0x94f3('0x1')]},'destexten':{'type':Sequelize[_0x94f3('0x1')]},'destpriority':{'type':Sequelize[_0x94f3('0x1')]},'destuniqueid':{'type':Sequelize[_0x94f3('0x1')]},'messageId':{'type':Sequelize[_0x94f3('0x1')]},'inReplyTo':{'type':Sequelize[_0x94f3('0x1')]},'subject':{'type':Sequelize[_0x94f3('0x1')]},'from':{'type':Sequelize[_0x94f3('0x1')]},'to':{'type':Sequelize[_0x94f3('0x1')]},'cc':{'type':Sequelize[_0x94f3('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x94f3('0x5')]},'text':{'type':Sequelize[_0x94f3('0x5')]},'status':{'type':Sequelize[_0x94f3('0x6')](_0x94f3('0x7'),_0x94f3('0x8'),_0x94f3('0x9'),_0x94f3('0xa'))},'url':{'type':Sequelize[_0x94f3('0x1')]},'app':{'type':Sequelize[_0x94f3('0x1')]},'appdata':{'type':Sequelize[_0x94f3('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 7154099..0c32cd6 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 _0x1d28=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','IntegrationReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','show','find','catch','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x1d28,0x19f));var _0x81d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d28[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x81d2('0x0'));var rimraf=require(_0x81d2('0x1'));var zipdir=require(_0x81d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81d2('0x3'));var moment=require(_0x81d2('0x4'));var BPromise=require(_0x81d2('0x5'));var Mustache=require(_0x81d2('0x6'));var util=require(_0x81d2('0x7'));var path=require('path');var sox=require(_0x81d2('0x8'));var csv=require(_0x81d2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81d2('0xa'));var _=require(_0x81d2('0xb'));var squel=require(_0x81d2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x81d2('0xd'));var Papa=require(_0x81d2('0xe'));var Redis=require(_0x81d2('0xf'));var authService=require(_0x81d2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x81d2('0x11'));var hardwareService=require(_0x81d2('0x12'));var logger=require(_0x81d2('0x13'))(_0x81d2('0x14'));var utils=require(_0x81d2('0x15'));var config=require(_0x81d2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x81d2('0x17'))['db'];function respondWithStatusCode(_0x28a947,_0xb9d02c){_0xb9d02c=_0xb9d02c||0xcc;return function(_0x265a1a){if(_0x265a1a){return _0x28a947[_0x81d2('0x18')](_0xb9d02c);}return _0x28a947[_0x81d2('0x19')](_0xb9d02c)[_0x81d2('0x1a')]();};}function respondWithResult(_0x397e1e,_0xa964){_0xa964=_0xa964||0xc8;return function(_0x1894ed){if(_0x1894ed){return _0x397e1e[_0x81d2('0x19')](_0xa964)[_0x81d2('0x1b')](_0x1894ed);}};}function respondWithFilteredResult(_0x1ff568,_0x3deff6){return function(_0x4a9781){if(_0x4a9781){var _0x47e426=typeof _0x3deff6[_0x81d2('0x1c')]===_0x81d2('0x1d')&&typeof _0x3deff6[_0x81d2('0x1e')]===_0x81d2('0x1d');var _0x2a1992=_0x4a9781[_0x81d2('0x1f')];var _0x3192b6=_0x47e426?0x0:_0x3deff6[_0x81d2('0x1c')];var _0x193d00=_0x47e426?_0x4a9781[_0x81d2('0x1f')]:_0x3deff6[_0x81d2('0x1c')]+_0x3deff6['limit'];var _0x49946a;if(_0x193d00>=_0x2a1992){_0x193d00=_0x2a1992;_0x49946a=0xc8;}else{_0x49946a=0xce;}_0x1ff568[_0x81d2('0x19')](_0x49946a);return _0x1ff568[_0x81d2('0x20')](_0x81d2('0x21'),_0x3192b6+'-'+_0x193d00+'/'+_0x2a1992)[_0x81d2('0x1b')](_0x4a9781);}return null;};}function patchUpdates(_0x111640){return function(_0xddd539){try{jsonpatch[_0x81d2('0x22')](_0xddd539,_0x111640,!![]);}catch(_0x3404d5){return BPromise[_0x81d2('0x23')](_0x3404d5);}return _0xddd539[_0x81d2('0x24')]();};}function saveUpdates(_0x295485,_0x3e8b47){return function(_0x1dda45){if(_0x1dda45){return _0x1dda45[_0x81d2('0x25')](_0x295485)[_0x81d2('0x26')](function(_0x29771f){return _0x29771f;});}return null;};}function removeEntity(_0x23ac96,_0x2348b9){return function(_0xb6dc31){if(_0xb6dc31){return _0xb6dc31[_0x81d2('0x27')]()['then'](function(){_0x23ac96[_0x81d2('0x19')](0xcc)[_0x81d2('0x1a')]();});}};}function handleEntityNotFound(_0x52e64b,_0x8ea56e){return function(_0x13eb6c){if(!_0x13eb6c){_0x52e64b[_0x81d2('0x18')](0x194);}return _0x13eb6c;};}function handleError(_0x456f19,_0x5de740){_0x5de740=_0x5de740||0x1f4;return function(_0x248eb1){logger[_0x81d2('0x28')](_0x248eb1[_0x81d2('0x29')]);if(_0x248eb1[_0x81d2('0x2a')]){delete _0x248eb1[_0x81d2('0x2a')];}_0x456f19[_0x81d2('0x19')](_0x5de740)[_0x81d2('0x2b')](_0x248eb1);};}exports['index']=function(_0xf6369c,_0x2b9773){var _0xd562={},_0x34ff87={},_0x444f46={'count':0x0,'rows':[]};var _0x2f55ae=_['map'](db[_0x81d2('0x2c')][_0x81d2('0x2d')],function(_0x2372c0){return{'name':_0x2372c0[_0x81d2('0x2e')],'type':_0x2372c0[_0x81d2('0x2f')]['key']};});_0x34ff87[_0x81d2('0x30')]=_[_0x81d2('0x31')](_0x2f55ae,_0x81d2('0x2a'));_0x34ff87[_0x81d2('0x32')]=_[_0x81d2('0x33')](_0xf6369c[_0x81d2('0x32')]);_0x34ff87[_0x81d2('0x34')]=_[_0x81d2('0x35')](_0x34ff87[_0x81d2('0x30')],_0x34ff87[_0x81d2('0x32')]);_0xd562[_0x81d2('0x36')]=_[_0x81d2('0x35')](_0x34ff87[_0x81d2('0x30')],qs[_0x81d2('0x37')](_0xf6369c[_0x81d2('0x32')]['fields']));_0xd562[_0x81d2('0x36')]=_0xd562[_0x81d2('0x36')][_0x81d2('0x38')]?_0xd562[_0x81d2('0x36')]:_0x34ff87[_0x81d2('0x30')];if(!_0xf6369c[_0x81d2('0x32')][_0x81d2('0x39')](_0x81d2('0x3a'))){_0xd562[_0x81d2('0x1e')]=qs['limit'](_0xf6369c[_0x81d2('0x32')][_0x81d2('0x1e')]);_0xd562[_0x81d2('0x1c')]=qs[_0x81d2('0x1c')](_0xf6369c['query']['offset']);}_0xd562[_0x81d2('0x3b')]=qs[_0x81d2('0x3c')](_0xf6369c[_0x81d2('0x32')][_0x81d2('0x3c')]);_0xd562[_0x81d2('0x3d')]=qs['filters'](_['pick'](_0xf6369c[_0x81d2('0x32')],_0x34ff87[_0x81d2('0x34')]),_0x2f55ae);if(_0xf6369c[_0x81d2('0x32')][_0x81d2('0x3e')]){_0xd562[_0x81d2('0x3d')]=_[_0x81d2('0x3f')](_0xd562[_0x81d2('0x3d')],{'$or':_[_0x81d2('0x31')](_0x2f55ae,function(_0x5e4b71){if(_0x5e4b71[_0x81d2('0x2f')]!=='VIRTUAL'){var _0x1afb9e={};_0x1afb9e[_0x5e4b71[_0x81d2('0x2a')]]={'$like':'%'+_0xf6369c[_0x81d2('0x32')]['filter']+'%'};return _0x1afb9e;}})});}_0xd562=_[_0x81d2('0x3f')]({},_0xd562,_0xf6369c[_0x81d2('0x40')]);var _0x4a39c9={'where':_0xd562['where']};return db['IntegrationReport'][_0x81d2('0x1f')](_0x4a39c9)['then'](function(_0x5c0afd){_0x444f46[_0x81d2('0x1f')]=_0x5c0afd;if(_0xf6369c[_0x81d2('0x32')][_0x81d2('0x41')]){_0xd562[_0x81d2('0x42')]=[{'all':!![]}];}return db[_0x81d2('0x2c')][_0x81d2('0x43')](_0xd562);})[_0x81d2('0x26')](function(_0x7a6eb){_0x444f46['rows']=_0x7a6eb;return _0x444f46;})[_0x81d2('0x26')](respondWithFilteredResult(_0x2b9773,_0xd562))['catch'](handleError(_0x2b9773,null));};exports[_0x81d2('0x44')]=function(_0x477866,_0x4e310a){var _0x4a46db={'raw':![],'where':{'id':_0x477866['params']['id']}},_0x1a6dd7={};_0x1a6dd7[_0x81d2('0x30')]=_['keys'](db[_0x81d2('0x2c')]['rawAttributes']);_0x1a6dd7[_0x81d2('0x32')]=_[_0x81d2('0x33')](_0x477866[_0x81d2('0x32')]);_0x1a6dd7[_0x81d2('0x34')]=_['intersection'](_0x1a6dd7['model'],_0x1a6dd7[_0x81d2('0x32')]);_0x4a46db['attributes']=_[_0x81d2('0x35')](_0x1a6dd7[_0x81d2('0x30')],qs[_0x81d2('0x37')](_0x477866[_0x81d2('0x32')][_0x81d2('0x37')]));_0x4a46db[_0x81d2('0x36')]=_0x4a46db[_0x81d2('0x36')][_0x81d2('0x38')]?_0x4a46db[_0x81d2('0x36')]:_0x1a6dd7[_0x81d2('0x30')];if(_0x477866[_0x81d2('0x32')]['includeAll']){_0x4a46db['include']=[{'all':!![]}];}_0x4a46db=_[_0x81d2('0x3f')]({},_0x4a46db,_0x477866[_0x81d2('0x40')]);return db[_0x81d2('0x2c')][_0x81d2('0x45')](_0x4a46db)[_0x81d2('0x26')](handleEntityNotFound(_0x4e310a,null))[_0x81d2('0x26')](respondWithResult(_0x4e310a,null))[_0x81d2('0x46')](handleError(_0x4e310a,null));};exports[_0x81d2('0x47')]=function(_0x10d30b,_0x1cfca3){return db[_0x81d2('0x2c')]['create'](_0x10d30b[_0x81d2('0x48')],{})['then'](respondWithResult(_0x1cfca3,0xc9))[_0x81d2('0x46')](handleError(_0x1cfca3,null));};exports['update']=function(_0x5a45ab,_0x3b4598){if(_0x5a45ab[_0x81d2('0x48')]['id']){delete _0x5a45ab['body']['id'];}return db[_0x81d2('0x2c')]['find']({'where':{'id':_0x5a45ab[_0x81d2('0x49')]['id']}})[_0x81d2('0x26')](handleEntityNotFound(_0x3b4598,null))[_0x81d2('0x26')](saveUpdates(_0x5a45ab['body'],null))[_0x81d2('0x26')](respondWithResult(_0x3b4598,null))[_0x81d2('0x46')](handleError(_0x3b4598,null));};exports[_0x81d2('0x27')]=function(_0x3041ce,_0x48941a){return db['IntegrationReport'][_0x81d2('0x45')]({'where':{'id':_0x3041ce[_0x81d2('0x49')]['id']}})[_0x81d2('0x26')](handleEntityNotFound(_0x48941a,null))[_0x81d2('0x26')](removeEntity(_0x48941a,null))[_0x81d2('0x46')](handleError(_0x48941a,null));};exports['describe']=function(_0x28cd32,_0x52869d){return db[_0x81d2('0x2c')]['describe']()['then'](respondWithResult(_0x52869d,null))[_0x81d2('0x46')](handleError(_0x52869d,null));}; \ No newline at end of file +var _0x711a=['mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','stack','name','index','map','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','type','filter','options','where','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x711a,0x1cd));var _0xa711=function(_0x576fe9,_0x558e03){_0x576fe9=_0x576fe9-0x0;var _0x120c93=_0x711a[_0x576fe9];return _0x120c93;};'use strict';var emlformat=require(_0xa711('0x0'));var rimraf=require(_0xa711('0x1'));var zipdir=require(_0xa711('0x2'));var jsonpatch=require(_0xa711('0x3'));var rp=require(_0xa711('0x4'));var moment=require(_0xa711('0x5'));var BPromise=require(_0xa711('0x6'));var Mustache=require(_0xa711('0x7'));var util=require('util');var path=require(_0xa711('0x8'));var sox=require('sox');var csv=require(_0xa711('0x9'));var ejs=require(_0xa711('0xa'));var fs=require('fs');var fs_extra=require(_0xa711('0xb'));var _=require(_0xa711('0xc'));var squel=require(_0xa711('0xd'));var crypto=require(_0xa711('0xe'));var jsforce=require(_0xa711('0xf'));var deskjs=require(_0xa711('0x10'));var toCsv=require(_0xa711('0x9'));var querystring=require(_0xa711('0x11'));var Papa=require(_0xa711('0x12'));var Redis=require(_0xa711('0x13'));var authService=require(_0xa711('0x14'));var qs=require(_0xa711('0x15'));var as=require(_0xa711('0x16'));var hardwareService=require(_0xa711('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xa711('0x18'));var config=require(_0xa711('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa711('0x1a'))['db'];function respondWithStatusCode(_0xbba66d,_0x541f34){_0x541f34=_0x541f34||0xcc;return function(_0x157323){if(_0x157323){return _0xbba66d[_0xa711('0x1b')](_0x541f34);}return _0xbba66d[_0xa711('0x1c')](_0x541f34)[_0xa711('0x1d')]();};}function respondWithResult(_0x319218,_0x3bf7d0){_0x3bf7d0=_0x3bf7d0||0xc8;return function(_0x1f74ca){if(_0x1f74ca){return _0x319218[_0xa711('0x1c')](_0x3bf7d0)[_0xa711('0x1e')](_0x1f74ca);}};}function respondWithFilteredResult(_0x5f499c,_0x5cbf08){return function(_0x2c3409){if(_0x2c3409){var _0x4affd0=typeof _0x5cbf08[_0xa711('0x1f')]===_0xa711('0x20')&&typeof _0x5cbf08['limit']==='undefined';var _0x3ad1eb=_0x2c3409[_0xa711('0x21')];var _0x2bb0d4=_0x4affd0?0x0:_0x5cbf08['offset'];var _0x32a6a8=_0x4affd0?_0x2c3409[_0xa711('0x21')]:_0x5cbf08['offset']+_0x5cbf08[_0xa711('0x22')];var _0x4fde32;if(_0x32a6a8>=_0x3ad1eb){_0x32a6a8=_0x3ad1eb;_0x4fde32=0xc8;}else{_0x4fde32=0xce;}_0x5f499c[_0xa711('0x1c')](_0x4fde32);return _0x5f499c[_0xa711('0x23')](_0xa711('0x24'),_0x2bb0d4+'-'+_0x32a6a8+'/'+_0x3ad1eb)[_0xa711('0x1e')](_0x2c3409);}return null;};}function patchUpdates(_0x162663){return function(_0xcbf26e){try{jsonpatch[_0xa711('0x25')](_0xcbf26e,_0x162663,!![]);}catch(_0x208698){return BPromise['reject'](_0x208698);}return _0xcbf26e[_0xa711('0x26')]();};}function saveUpdates(_0x2bbda2,_0x58524e){return function(_0x11a376){if(_0x11a376){return _0x11a376['update'](_0x2bbda2)['then'](function(_0x11f780){return _0x11f780;});}return null;};}function removeEntity(_0x1391a1,_0x36bdbb){return function(_0x21b9c6){if(_0x21b9c6){return _0x21b9c6[_0xa711('0x27')]()[_0xa711('0x28')](function(){_0x1391a1[_0xa711('0x1c')](0xcc)[_0xa711('0x1d')]();});}};}function handleEntityNotFound(_0x386538,_0x3c91c2){return function(_0x124a1d){if(!_0x124a1d){_0x386538[_0xa711('0x1b')](0x194);}return _0x124a1d;};}function handleError(_0x414ee0,_0x1de545){_0x1de545=_0x1de545||0x1f4;return function(_0x333e75){logger['error'](_0x333e75[_0xa711('0x29')]);if(_0x333e75[_0xa711('0x2a')]){delete _0x333e75[_0xa711('0x2a')];}_0x414ee0[_0xa711('0x1c')](_0x1de545)['send'](_0x333e75);};}exports[_0xa711('0x2b')]=function(_0x1c584c,_0x3b9003){var _0x3348b8={},_0x49f50d={},_0x514c68={'count':0x0,'rows':[]};var _0x4b3a5a=_[_0xa711('0x2c')](db['IntegrationReport']['rawAttributes'],function(_0x13fec4){return{'name':_0x13fec4['fieldName'],'type':_0x13fec4['type'][_0xa711('0x2d')]};});_0x49f50d[_0xa711('0x2e')]=_[_0xa711('0x2c')](_0x4b3a5a,_0xa711('0x2a'));_0x49f50d[_0xa711('0x2f')]=_[_0xa711('0x30')](_0x1c584c[_0xa711('0x2f')]);_0x49f50d[_0xa711('0x31')]=_['intersection'](_0x49f50d[_0xa711('0x2e')],_0x49f50d[_0xa711('0x2f')]);_0x3348b8[_0xa711('0x32')]=_['intersection'](_0x49f50d[_0xa711('0x2e')],qs[_0xa711('0x33')](_0x1c584c[_0xa711('0x2f')]['fields']));_0x3348b8[_0xa711('0x32')]=_0x3348b8['attributes'][_0xa711('0x34')]?_0x3348b8[_0xa711('0x32')]:_0x49f50d['model'];if(!_0x1c584c[_0xa711('0x2f')][_0xa711('0x35')](_0xa711('0x36'))){_0x3348b8[_0xa711('0x22')]=qs[_0xa711('0x22')](_0x1c584c['query']['limit']);_0x3348b8['offset']=qs[_0xa711('0x1f')](_0x1c584c[_0xa711('0x2f')][_0xa711('0x1f')]);}_0x3348b8[_0xa711('0x37')]=qs[_0xa711('0x38')](_0x1c584c[_0xa711('0x2f')][_0xa711('0x38')]);_0x3348b8['where']=qs['filters'](_[_0xa711('0x39')](_0x1c584c[_0xa711('0x2f')],_0x49f50d[_0xa711('0x31')]),_0x4b3a5a);if(_0x1c584c[_0xa711('0x2f')]['filter']){_0x3348b8['where']=_[_0xa711('0x3a')](_0x3348b8['where'],{'$or':_[_0xa711('0x2c')](_0x4b3a5a,function(_0xa6fecb){if(_0xa6fecb[_0xa711('0x3b')]!=='VIRTUAL'){var _0x4d793e={};_0x4d793e[_0xa6fecb[_0xa711('0x2a')]]={'$like':'%'+_0x1c584c[_0xa711('0x2f')][_0xa711('0x3c')]+'%'};return _0x4d793e;}})});}_0x3348b8=_[_0xa711('0x3a')]({},_0x3348b8,_0x1c584c[_0xa711('0x3d')]);var _0xcf61b2={'where':_0x3348b8[_0xa711('0x3e')]};return db[_0xa711('0x3f')][_0xa711('0x21')](_0xcf61b2)[_0xa711('0x28')](function(_0x52c5e8){_0x514c68[_0xa711('0x21')]=_0x52c5e8;if(_0x1c584c['query'][_0xa711('0x40')]){_0x3348b8[_0xa711('0x41')]=[{'all':!![]}];}return db[_0xa711('0x3f')][_0xa711('0x42')](_0x3348b8);})[_0xa711('0x28')](function(_0x3392c8){_0x514c68[_0xa711('0x43')]=_0x3392c8;return _0x514c68;})['then'](respondWithFilteredResult(_0x3b9003,_0x3348b8))[_0xa711('0x44')](handleError(_0x3b9003,null));};exports[_0xa711('0x45')]=function(_0x90f26a,_0x35349e){var _0x52a561={'raw':![],'where':{'id':_0x90f26a[_0xa711('0x46')]['id']}},_0x1745fa={};_0x1745fa[_0xa711('0x2e')]=_['keys'](db[_0xa711('0x3f')][_0xa711('0x47')]);_0x1745fa['query']=_[_0xa711('0x30')](_0x90f26a[_0xa711('0x2f')]);_0x1745fa[_0xa711('0x31')]=_['intersection'](_0x1745fa[_0xa711('0x2e')],_0x1745fa[_0xa711('0x2f')]);_0x52a561[_0xa711('0x32')]=_[_0xa711('0x48')](_0x1745fa['model'],qs[_0xa711('0x33')](_0x90f26a['query'][_0xa711('0x33')]));_0x52a561['attributes']=_0x52a561[_0xa711('0x32')]['length']?_0x52a561[_0xa711('0x32')]:_0x1745fa['model'];if(_0x90f26a['query']['includeAll']){_0x52a561[_0xa711('0x41')]=[{'all':!![]}];}_0x52a561=_[_0xa711('0x3a')]({},_0x52a561,_0x90f26a[_0xa711('0x3d')]);return db[_0xa711('0x3f')][_0xa711('0x49')](_0x52a561)[_0xa711('0x28')](handleEntityNotFound(_0x35349e,null))['then'](respondWithResult(_0x35349e,null))[_0xa711('0x44')](handleError(_0x35349e,null));};exports[_0xa711('0x4a')]=function(_0x46c8aa,_0x1c70cd){return db[_0xa711('0x3f')][_0xa711('0x4a')](_0x46c8aa[_0xa711('0x4b')],{})[_0xa711('0x28')](respondWithResult(_0x1c70cd,0xc9))[_0xa711('0x44')](handleError(_0x1c70cd,null));};exports[_0xa711('0x4c')]=function(_0x173724,_0xa164b2){if(_0x173724[_0xa711('0x4b')]['id']){delete _0x173724[_0xa711('0x4b')]['id'];}return db[_0xa711('0x3f')][_0xa711('0x49')]({'where':{'id':_0x173724[_0xa711('0x46')]['id']}})[_0xa711('0x28')](handleEntityNotFound(_0xa164b2,null))['then'](saveUpdates(_0x173724[_0xa711('0x4b')],null))[_0xa711('0x28')](respondWithResult(_0xa164b2,null))[_0xa711('0x44')](handleError(_0xa164b2,null));};exports[_0xa711('0x27')]=function(_0x3f06ee,_0x10056a){return db['IntegrationReport'][_0xa711('0x49')]({'where':{'id':_0x3f06ee['params']['id']}})[_0xa711('0x28')](handleEntityNotFound(_0x10056a,null))[_0xa711('0x28')](removeEntity(_0x10056a,null))[_0xa711('0x44')](handleError(_0x10056a,null));};exports['describe']=function(_0x4a88a1,_0x2419ae){return db[_0xa711('0x3f')][_0xa711('0x4d')]()[_0xa711('0x28')](respondWithResult(_0x2419ae,null))[_0xa711('0x44')](handleError(_0x2419ae,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0ff5607..3bd784a 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 _0x4240=['path','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x37ad30,_0x204a61){var _0x2a0654=function(_0x4e0558){while(--_0x4e0558){_0x37ad30['push'](_0x37ad30['shift']());}};_0x2a0654(++_0x204a61);}(_0x4240,0x7e));var _0x0424=function(_0x304e5a,_0x44f683){_0x304e5a=_0x304e5a-0x0;var _0x39cccf=_0x4240[_0x304e5a];return _0x39cccf;};'use strict';var _=require(_0x0424('0x0'));var util=require(_0x0424('0x1'));var logger=require(_0x0424('0x2'))(_0x0424('0x3'));var moment=require('moment');var BPromise=require(_0x0424('0x4'));var rp=require(_0x0424('0x5'));var fs=require('fs');var path=require(_0x0424('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0424('0x7'));module['exports']=function(_0x464dcc,_0x2da402){return _0x464dcc[_0x0424('0x8')](_0x0424('0x9'),attributes,{'tableName':_0x0424('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd711=['../../config/environment','./integrationReport.attributes','exports','util','../../config/logger','api','moment','request-promise'];(function(_0x4adbd4,_0xf8d7cb){var _0x4535a7=function(_0x5873fa){while(--_0x5873fa){_0x4adbd4['push'](_0x4adbd4['shift']());}};_0x4535a7(++_0xf8d7cb);}(_0xd711,0x173));var _0x1d71=function(_0x10eed1,_0x177cc1){_0x10eed1=_0x10eed1-0x0;var _0x42c493=_0xd711[_0x10eed1];return _0x42c493;};'use strict';var _=require('lodash');var util=require(_0x1d71('0x0'));var logger=require(_0x1d71('0x1'))(_0x1d71('0x2'));var moment=require(_0x1d71('0x3'));var BPromise=require('bluebird');var rp=require(_0x1d71('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1d71('0x5'));var attributes=require(_0x1d71('0x6'));module[_0x1d71('0x7')]=function(_0x191554,_0x13c76d){return _0x191554['define']('IntegrationReport',attributes,{'tableName':'report_integration','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 4e205fc..3b07980 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 _0x31f0=['../../config/environment','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x700428,_0x4b8500){var _0x19bbc4=function(_0x312b72){while(--_0x312b72){_0x700428['push'](_0x700428['shift']());}};_0x19bbc4(++_0x4b8500);}(_0x31f0,0xb7));var _0x031f=function(_0x232c6c,_0x372df4){_0x232c6c=_0x232c6c-0x0;var _0x42f98a=_0x31f0[_0x232c6c];return _0x42f98a;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xc2c7,0x134));var _0x7c2c=function(_0x8a222b,_0x4e3660){_0x8a222b=_0x8a222b-0x0;var _0x2b6252=_0xc2c7[_0x8a222b];return _0x2b6252;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 47799c2..2d60c4b 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 _0x8289=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addIntervals','put','update','delete','destroy','exports','multer','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8289,0xf8));var _0x9828=function(_0x39bce0,_0x4e5f61){_0x39bce0=_0x39bce0-0x0;var _0xdf7819=_0x8289[_0x39bce0];return _0xdf7819;};'use strict';var multer=require(_0x9828('0x0'));var util=require(_0x9828('0x1'));var path=require(_0x9828('0x2'));var timeout=require(_0x9828('0x3'));var express=require(_0x9828('0x4'));var router=express[_0x9828('0x5')]();var fs_extra=require(_0x9828('0x6'));var auth=require(_0x9828('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9828('0x8'));var controller=require(_0x9828('0x9'));router[_0x9828('0xa')]('/',auth[_0x9828('0xb')](),controller[_0x9828('0xc')]);router[_0x9828('0xa')](_0x9828('0xd'),auth[_0x9828('0xb')](),controller[_0x9828('0xe')]);router[_0x9828('0xa')](_0x9828('0xf'),auth[_0x9828('0xb')](),controller[_0x9828('0x10')]);router[_0x9828('0x11')]('/',auth[_0x9828('0xb')](),controller[_0x9828('0x12')]);router[_0x9828('0x11')](_0x9828('0xf'),auth[_0x9828('0xb')](),controller['addInterval']);router[_0x9828('0x11')]('/:id/sub_intervals/create_many',auth[_0x9828('0xb')](),controller[_0x9828('0x13')]);router[_0x9828('0x14')](_0x9828('0xd'),auth[_0x9828('0xb')](),controller[_0x9828('0x15')]);router[_0x9828('0x16')](_0x9828('0xd'),auth[_0x9828('0xb')](),controller[_0x9828('0x17')]);module[_0x9828('0x18')]=router; \ No newline at end of file +var _0x2f74=['post','create','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/sub_intervals'];(function(_0x4b6165,_0x167c5a){var _0x723b63=function(_0x23175a){while(--_0x23175a){_0x4b6165['push'](_0x4b6165['shift']());}};_0x723b63(++_0x167c5a);}(_0x2f74,0x7b));var _0x42f7=function(_0x3ebb04,_0x1a63a6){_0x3ebb04=_0x3ebb04-0x0;var _0x535db0=_0x2f74[_0x3ebb04];return _0x535db0;};'use strict';var multer=require(_0x42f7('0x0'));var util=require('util');var path=require(_0x42f7('0x1'));var timeout=require(_0x42f7('0x2'));var express=require(_0x42f7('0x3'));var router=express[_0x42f7('0x4')]();var fs_extra=require(_0x42f7('0x5'));var auth=require(_0x42f7('0x6'));var interaction=require(_0x42f7('0x7'));var config=require(_0x42f7('0x8'));var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x42f7('0x9')]);router[_0x42f7('0xa')](_0x42f7('0xb'),auth[_0x42f7('0xc')](),controller[_0x42f7('0xd')]);router[_0x42f7('0xa')](_0x42f7('0xe'),auth[_0x42f7('0xc')](),controller['getIntervals']);router[_0x42f7('0xf')]('/',auth[_0x42f7('0xc')](),controller[_0x42f7('0x10')]);router[_0x42f7('0xf')](_0x42f7('0xe'),auth[_0x42f7('0xc')](),controller['addInterval']);router[_0x42f7('0xf')](_0x42f7('0x11'),auth[_0x42f7('0xc')](),controller[_0x42f7('0x12')]);router[_0x42f7('0x13')](_0x42f7('0xb'),auth[_0x42f7('0xc')](),controller[_0x42f7('0x14')]);router['delete']('/:id',auth[_0x42f7('0xc')](),controller[_0x42f7('0x15')]);module[_0x42f7('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 40a97b4..46d16ab 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 _0xa5e6=['sequelize','STRING'];(function(_0x10b59a,_0x5a0ed4){var _0x435565=function(_0x235a88){while(--_0x235a88){_0x10b59a['push'](_0x10b59a['shift']());}};_0x435565(++_0x5a0ed4);}(_0xa5e6,0xb0));var _0x6a5e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa5e6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6a5e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a5e('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6a5e('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x95f4=['sequelize'];(function(_0x4fafac,_0x3a1c4d){var _0x3d2b43=function(_0x7fa4fe){while(--_0x7fa4fe){_0x4fafac['push'](_0x4fafac['shift']());}};_0x3d2b43(++_0x3a1c4d);}(_0x95f4,0x114));var _0x495f=function(_0x2e45f4,_0x58d3af){_0x2e45f4=_0x2e45f4-0x0;var _0x1c9bac=_0x95f4[_0x2e45f4];return _0x1c9bac;};'use strict';var Sequelize=require(_0x495f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 9f6ab97..23ba78d 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 _0x6460=['name','send','index','map','Interval','type','key','model','keys','filters','intersection','attributes','fields','length','query','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','includeAll','merge','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','eml-format','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Intervals','UserProfileResource','destroy','then','error','stack'];(function(_0x876e0,_0x2a5357){var _0x17ec80=function(_0x1d9444){while(--_0x1d9444){_0x876e0['push'](_0x876e0['shift']());}};_0x17ec80(++_0x2a5357);}(_0x6460,0x19c));var _0x0646=function(_0x3f5395,_0x5189ef){_0x3f5395=_0x3f5395-0x0;var _0x1bb11e=_0x6460[_0x3f5395];return _0x1bb11e;};'use strict';var emlformat=require(_0x0646('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0646('0x1'));var jsonpatch=require(_0x0646('0x2'));var rp=require(_0x0646('0x3'));var moment=require(_0x0646('0x4'));var BPromise=require(_0x0646('0x5'));var Mustache=require(_0x0646('0x6'));var util=require(_0x0646('0x7'));var path=require(_0x0646('0x8'));var sox=require(_0x0646('0x9'));var csv=require(_0x0646('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0646('0xb'));var _=require(_0x0646('0xc'));var squel=require(_0x0646('0xd'));var crypto=require(_0x0646('0xe'));var jsforce=require(_0x0646('0xf'));var deskjs=require(_0x0646('0x10'));var toCsv=require(_0x0646('0xa'));var querystring=require(_0x0646('0x11'));var Papa=require(_0x0646('0x12'));var Redis=require(_0x0646('0x13'));var authService=require(_0x0646('0x14'));var qs=require(_0x0646('0x15'));var as=require(_0x0646('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0646('0x17'))(_0x0646('0x18'));var utils=require(_0x0646('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0646('0x1a'));var db=require(_0x0646('0x1b'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x44ab51,_0x32ff29){_0x32ff29=_0x32ff29||0xcc;return function(_0xf341ba){if(_0xf341ba){return _0x44ab51['sendStatus'](_0x32ff29);}return _0x44ab51[_0x0646('0x1c')](_0x32ff29)[_0x0646('0x1d')]();};}function respondWithResult(_0x29cbf9,_0x4e630d){_0x4e630d=_0x4e630d||0xc8;return function(_0x4727fc){if(_0x4727fc){return _0x29cbf9['status'](_0x4e630d)[_0x0646('0x1e')](_0x4727fc);}};}function respondWithFilteredResult(_0x5387a6,_0x4eeb49){return function(_0x490be2){if(_0x490be2){var _0x5a0c71=typeof _0x4eeb49[_0x0646('0x1f')]===_0x0646('0x20')&&typeof _0x4eeb49[_0x0646('0x21')]===_0x0646('0x20');var _0x4fdd20=_0x490be2[_0x0646('0x22')];var _0x14627c=_0x5a0c71?0x0:_0x4eeb49[_0x0646('0x1f')];var _0x8b0f42=_0x5a0c71?_0x490be2[_0x0646('0x22')]:_0x4eeb49[_0x0646('0x1f')]+_0x4eeb49[_0x0646('0x21')];var _0x2dacad;if(_0x8b0f42>=_0x4fdd20){_0x8b0f42=_0x4fdd20;_0x2dacad=0xc8;}else{_0x2dacad=0xce;}_0x5387a6['status'](_0x2dacad);return _0x5387a6[_0x0646('0x23')](_0x0646('0x24'),_0x14627c+'-'+_0x8b0f42+'/'+_0x4fdd20)['json'](_0x490be2);}return null;};}function patchUpdates(_0xc32525){return function(_0x294bb0){try{jsonpatch[_0x0646('0x25')](_0x294bb0,_0xc32525,!![]);}catch(_0x4998b8){return BPromise[_0x0646('0x26')](_0x4998b8);}return _0x294bb0[_0x0646('0x27')]();};}function saveUpdates(_0x9c8005,_0x267ca5){return function(_0x39f28c){if(_0x39f28c){return _0x39f28c[_0x0646('0x28')](_0x9c8005)['then'](function(_0x3e7139){return _0x3e7139;});}return null;};}function removeEntity(_0x97bb3a,_0x2860c0){return function(_0x2349ec){if(_0x2349ec){return _0x2349ec['destroy']()['then'](function(){var _0x3eab12=_0x2349ec[_0x0646('0x29')]({'plain':!![]});var _0x8c1756=_0x0646('0x2a');return db[_0x0646('0x2b')][_0x0646('0x2c')]({'where':{'type':_0x8c1756,'resourceId':_0x3eab12['id']}})[_0x0646('0x2d')](function(){return _0x2349ec;});})[_0x0646('0x2d')](function(){_0x97bb3a[_0x0646('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x74d76a,_0x29250c){return function(_0x1c0914){if(!_0x1c0914){_0x74d76a['sendStatus'](0x194);}return _0x1c0914;};}function handleError(_0x5aadf1,_0x26b872){_0x26b872=_0x26b872||0x1f4;return function(_0x174dff){logger[_0x0646('0x2e')](_0x174dff[_0x0646('0x2f')]);if(_0x174dff[_0x0646('0x30')]){delete _0x174dff['name'];}_0x5aadf1['status'](_0x26b872)[_0x0646('0x31')](_0x174dff);};}exports[_0x0646('0x32')]=function(_0x2f8e11,_0x5733af){var _0x4e79a7={},_0x15a268={},_0x7cacbf={'count':0x0,'rows':[]};var _0x4fda33=_[_0x0646('0x33')](db[_0x0646('0x34')]['rawAttributes'],function(_0x2e5b76){return{'name':_0x2e5b76['fieldName'],'type':_0x2e5b76[_0x0646('0x35')][_0x0646('0x36')]};});_0x15a268[_0x0646('0x37')]=_[_0x0646('0x33')](_0x4fda33,_0x0646('0x30'));_0x15a268['query']=_[_0x0646('0x38')](_0x2f8e11['query']);_0x15a268[_0x0646('0x39')]=_[_0x0646('0x3a')](_0x15a268[_0x0646('0x37')],_0x15a268['query']);_0x4e79a7[_0x0646('0x3b')]=_['intersection'](_0x15a268[_0x0646('0x37')],qs[_0x0646('0x3c')](_0x2f8e11['query'][_0x0646('0x3c')]));_0x4e79a7['attributes']=_0x4e79a7[_0x0646('0x3b')][_0x0646('0x3d')]?_0x4e79a7['attributes']:_0x15a268['model'];if(!_0x2f8e11[_0x0646('0x3e')]['hasOwnProperty']('nolimit')){_0x4e79a7[_0x0646('0x21')]=qs[_0x0646('0x21')](_0x2f8e11[_0x0646('0x3e')][_0x0646('0x21')]);_0x4e79a7[_0x0646('0x1f')]=qs['offset'](_0x2f8e11['query'][_0x0646('0x1f')]);}_0x4e79a7[_0x0646('0x3f')]=qs['sort'](_0x2f8e11[_0x0646('0x3e')][_0x0646('0x40')]);_0x4e79a7[_0x0646('0x41')]=qs[_0x0646('0x39')](_[_0x0646('0x42')](_0x2f8e11[_0x0646('0x3e')],_0x15a268['filters']),_0x4fda33);if(_0x2f8e11[_0x0646('0x3e')][_0x0646('0x43')]){_0x4e79a7['where']=_['merge'](_0x4e79a7[_0x0646('0x41')],{'$or':_[_0x0646('0x33')](_0x4fda33,function(_0x19aa44){if(_0x19aa44['type']!==_0x0646('0x44')){var _0x3c2b75={};_0x3c2b75[_0x19aa44[_0x0646('0x30')]]={'$like':'%'+_0x2f8e11['query'][_0x0646('0x43')]+'%'};return _0x3c2b75;}})});}_0x4e79a7=_['merge']({},_0x4e79a7,_0x2f8e11[_0x0646('0x45')]);var _0x3c6f49={'where':_0x4e79a7['where']};return db[_0x0646('0x34')][_0x0646('0x22')](_0x3c6f49)[_0x0646('0x2d')](function(_0x16f633){_0x7cacbf[_0x0646('0x22')]=_0x16f633;if(_0x2f8e11[_0x0646('0x3e')]['includeAll']){_0x4e79a7[_0x0646('0x46')]=[{'all':!![]}];}return db[_0x0646('0x34')][_0x0646('0x47')](_0x4e79a7);})[_0x0646('0x2d')](function(_0x2d1a02){_0x7cacbf['rows']=_0x2d1a02;return _0x7cacbf;})[_0x0646('0x2d')](respondWithFilteredResult(_0x5733af,_0x4e79a7))[_0x0646('0x48')](handleError(_0x5733af,null));};exports[_0x0646('0x49')]=function(_0x59e67a,_0x41ec67){var _0x661f55={'raw':!![],'where':{'id':_0x59e67a[_0x0646('0x4a')]['id']}},_0x918d31={};_0x918d31[_0x0646('0x37')]=_[_0x0646('0x38')](db['Interval'][_0x0646('0x4b')]);_0x918d31[_0x0646('0x3e')]=_[_0x0646('0x38')](_0x59e67a['query']);_0x918d31[_0x0646('0x39')]=_[_0x0646('0x3a')](_0x918d31['model'],_0x918d31[_0x0646('0x3e')]);_0x661f55[_0x0646('0x3b')]=_[_0x0646('0x3a')](_0x918d31[_0x0646('0x37')],qs[_0x0646('0x3c')](_0x59e67a[_0x0646('0x3e')][_0x0646('0x3c')]));_0x661f55['attributes']=_0x661f55[_0x0646('0x3b')][_0x0646('0x3d')]?_0x661f55[_0x0646('0x3b')]:_0x918d31['model'];if(_0x59e67a[_0x0646('0x3e')][_0x0646('0x4c')]){_0x661f55[_0x0646('0x46')]=[{'all':!![]}];}_0x661f55=_[_0x0646('0x4d')]({},_0x661f55,_0x59e67a['options']);return db['Interval']['find'](_0x661f55)[_0x0646('0x2d')](handleEntityNotFound(_0x41ec67,null))[_0x0646('0x2d')](respondWithResult(_0x41ec67,null))[_0x0646('0x48')](handleError(_0x41ec67,null));};exports[_0x0646('0x4e')]=function(_0x2f5191,_0x3bce8c){return db['Interval']['create'](_0x2f5191[_0x0646('0x4f')],{})[_0x0646('0x2d')](function(_0x3b0e47){var _0x5a676b=_0x2f5191[_0x0646('0x50')][_0x0646('0x29')]({'plain':!![]});if(!_0x5a676b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a676b['role']===_0x0646('0x50')){var _0x2b3304=_0x3b0e47['get']({'plain':!![]});var _0x163434='Intervals';return db[_0x0646('0x51')][_0x0646('0x52')]({'where':{'name':_0x163434,'userProfileId':_0x5a676b[_0x0646('0x53')]},'raw':!![]})[_0x0646('0x2d')](function(_0x39bc05){if(_0x39bc05&&_0x39bc05[_0x0646('0x54')]===0x0){return db[_0x0646('0x2b')]['create']({'name':_0x2b3304[_0x0646('0x30')],'resourceId':_0x2b3304['id'],'type':_0x39bc05['name'],'sectionId':_0x39bc05['id']},{})[_0x0646('0x2d')](function(){return _0x3b0e47;});}else{return _0x3b0e47;}})['catch'](function(_0x39d625){logger[_0x0646('0x2e')](_0x0646('0x55'),_0x39d625);throw _0x39d625;});}return _0x3b0e47;})[_0x0646('0x2d')](respondWithResult(_0x3bce8c,0xc9))['catch'](handleError(_0x3bce8c,null));};exports[_0x0646('0x28')]=function(_0x361fe2,_0x4a01ff){if(_0x361fe2[_0x0646('0x4f')]['id']){delete _0x361fe2['body']['id'];}return db[_0x0646('0x34')]['find']({'where':{'id':_0x361fe2[_0x0646('0x4a')]['id']}})[_0x0646('0x2d')](handleEntityNotFound(_0x4a01ff,null))['then'](saveUpdates(_0x361fe2[_0x0646('0x4f')],null))['then'](respondWithResult(_0x4a01ff,null))[_0x0646('0x48')](handleError(_0x4a01ff,null));};exports[_0x0646('0x2c')]=function(_0x428401,_0x10cd2d){return db['Interval'][_0x0646('0x52')]({'where':{'id':_0x428401[_0x0646('0x4a')]['id']}})[_0x0646('0x2d')](handleEntityNotFound(_0x10cd2d,null))['then'](removeEntity(_0x10cd2d,null))[_0x0646('0x48')](handleError(_0x10cd2d,null));};exports[_0x0646('0x56')]=function(_0x330663,_0x16a3e7,_0x4e1cbe){if(_0x330663['body']['id']){delete _0x330663['body']['id'];}return db[_0x0646('0x34')][_0x0646('0x52')]({'where':{'id':_0x330663[_0x0646('0x4a')]['id']}})[_0x0646('0x2d')](handleEntityNotFound(_0x16a3e7,null))[_0x0646('0x2d')](function(_0x45c9db){if(_0x45c9db){_0x330663[_0x0646('0x4f')][_0x0646('0x57')]=_0x45c9db['id'];return db[_0x0646('0x34')][_0x0646('0x4e')](_0x330663[_0x0646('0x4f')]);}})[_0x0646('0x2d')](respondWithResult(_0x16a3e7,null))['catch'](handleError(_0x16a3e7,null));};exports[_0x0646('0x58')]=function(_0x2340ce,_0x50ba0d,_0x468b35){var _0x593a4f={};var _0x314345={};var _0x46989a;var _0x39b30e;return db[_0x0646('0x34')][_0x0646('0x59')]({'where':{'id':_0x2340ce[_0x0646('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50ba0d,null))[_0x0646('0x2d')](function(_0x3fdcc7){if(_0x3fdcc7){_0x46989a=_0x3fdcc7;_0x314345[_0x0646('0x37')]=_['keys'](db[_0x0646('0x34')][_0x0646('0x4b')]);_0x314345['query']=_[_0x0646('0x38')](_0x2340ce['query']);_0x314345[_0x0646('0x39')]=_[_0x0646('0x3a')](_0x314345[_0x0646('0x37')],_0x314345[_0x0646('0x3e')]);_0x593a4f[_0x0646('0x3b')]=_['intersection'](_0x314345[_0x0646('0x37')],qs[_0x0646('0x3c')](_0x2340ce[_0x0646('0x3e')][_0x0646('0x3c')]));_0x593a4f[_0x0646('0x3b')]=_0x593a4f[_0x0646('0x3b')][_0x0646('0x3d')]?_0x593a4f[_0x0646('0x3b')]:_0x314345['model'];_0x593a4f[_0x0646('0x3f')]=qs['sort'](_0x2340ce['query'][_0x0646('0x40')]);_0x593a4f['where']=qs[_0x0646('0x39')](_[_0x0646('0x42')](_0x2340ce[_0x0646('0x3e')],_0x314345[_0x0646('0x39')]));if(_0x2340ce[_0x0646('0x3e')]['filter']){_0x593a4f['where']=_[_0x0646('0x4d')](_0x593a4f['where'],{'$or':_[_0x0646('0x33')](_0x593a4f[_0x0646('0x3b')],function(_0x49939e){var _0x196ab2={};_0x196ab2[_0x49939e]={'$like':'%'+_0x2340ce[_0x0646('0x3e')][_0x0646('0x43')]+'%'};return _0x196ab2;})});}_0x593a4f=_['merge']({},_0x593a4f,_0x2340ce[_0x0646('0x45')]);return _0x46989a[_0x0646('0x58')](_0x593a4f);}})['then'](function(_0x13053a){if(_0x13053a){_0x39b30e=_0x13053a['length'];if(!_0x2340ce[_0x0646('0x3e')]['hasOwnProperty'](_0x0646('0x5a'))){_0x593a4f['limit']=qs['limit'](_0x2340ce['query'][_0x0646('0x21')]);_0x593a4f[_0x0646('0x1f')]=qs['offset'](_0x2340ce[_0x0646('0x3e')][_0x0646('0x1f')]);}return _0x46989a[_0x0646('0x58')](_0x593a4f);}})[_0x0646('0x2d')](function(_0x17081a){if(_0x17081a){return _0x17081a?{'count':_0x39b30e,'rows':_0x17081a}:null;}})[_0x0646('0x2d')](respondWithResult(_0x50ba0d,null))[_0x0646('0x48')](handleError(_0x50ba0d,null));};exports[_0x0646('0x5b')]=function(_0x91ac8e,_0x2e2c4c,_0x2132be){return db['Interval'][_0x0646('0x59')]({'where':{'id':_0x91ac8e['params']['id']}})[_0x0646('0x2d')](handleEntityNotFound(_0x2e2c4c,null))[_0x0646('0x2d')](function(_0x3d12b7){if(_0x3d12b7){return db['sequelize']['transaction'](function(_0x18738b){return db['Interval'][_0x0646('0x2c')]({'where':{'IntervalId':_0x91ac8e[_0x0646('0x4a')]['id']},'transaction':_0x18738b})[_0x0646('0x2d')](function(_0x1a0cc5){var _0x393b13=_['map'](_0x91ac8e['body'],function(_0x264c24){delete _0x264c24['id'];_0x264c24['IntervalId']=_0x91ac8e[_0x0646('0x4a')]['id'];return _0x264c24;});return db['Interval']['bulkCreate'](_0x393b13,{'transaction':_0x18738b});});})['then'](function(){return db[_0x0646('0x34')]['findAll']({'where':{'IntervalId':_0x91ac8e['params']['id']}});});}})[_0x0646('0x2d')](respondWithResult(_0x2e2c4c,null))[_0x0646('0x48')](handleError(_0x2e2c4c,null));}; \ No newline at end of file +var _0x21fd=['body','user','UserProfileSection','autoAssociation','create','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','addIntervals','sequelize','bulkCreate','findAll','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','json','undefined','offset','count','limit','status','set','apply','update','then','destroy','get','Intervals','UserProfileResource','name','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','rows','catch','params','options','find'];(function(_0x509083,_0xa6676b){var _0x4b2495=function(_0x2a14f5){while(--_0x2a14f5){_0x509083['push'](_0x509083['shift']());}};_0x4b2495(++_0xa6676b);}(_0x21fd,0xfe));var _0xd21f=function(_0x3d1ec3,_0x5e2d7c){_0x3d1ec3=_0x3d1ec3-0x0;var _0x998c76=_0x21fd[_0x3d1ec3];return _0x998c76;};'use strict';var emlformat=require(_0xd21f('0x0'));var rimraf=require(_0xd21f('0x1'));var zipdir=require(_0xd21f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd21f('0x3'));var moment=require(_0xd21f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd21f('0x5'));var util=require(_0xd21f('0x6'));var path=require(_0xd21f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd21f('0x8'));var _=require('lodash');var squel=require(_0xd21f('0x9'));var crypto=require('crypto');var jsforce=require(_0xd21f('0xa'));var deskjs=require(_0xd21f('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd21f('0xc'));var Papa=require('papaparse');var Redis=require(_0xd21f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd21f('0xe'));var as=require(_0xd21f('0xf'));var hardwareService=require(_0xd21f('0x10'));var logger=require(_0xd21f('0x11'))(_0xd21f('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd21f('0x13'));var db=require(_0xd21f('0x14'))['db'];var extensions=require(_0xd21f('0x15'));function respondWithStatusCode(_0x519982,_0xfd9f5d){_0xfd9f5d=_0xfd9f5d||0xcc;return function(_0x472de8){if(_0x472de8){return _0x519982[_0xd21f('0x16')](_0xfd9f5d);}return _0x519982['status'](_0xfd9f5d)[_0xd21f('0x17')]();};}function respondWithResult(_0x1b6da9,_0x2b24e9){_0x2b24e9=_0x2b24e9||0xc8;return function(_0x5b4636){if(_0x5b4636){return _0x1b6da9['status'](_0x2b24e9)[_0xd21f('0x18')](_0x5b4636);}};}function respondWithFilteredResult(_0x297ac2,_0x1b01dc){return function(_0x1c51e3){if(_0x1c51e3){var _0x17c7a1=typeof _0x1b01dc['offset']===_0xd21f('0x19')&&typeof _0x1b01dc['limit']===_0xd21f('0x19');var _0x1c9b74=_0x1c51e3['count'];var _0x13cef7=_0x17c7a1?0x0:_0x1b01dc[_0xd21f('0x1a')];var _0x47d38d=_0x17c7a1?_0x1c51e3[_0xd21f('0x1b')]:_0x1b01dc[_0xd21f('0x1a')]+_0x1b01dc[_0xd21f('0x1c')];var _0x1ba7c9;if(_0x47d38d>=_0x1c9b74){_0x47d38d=_0x1c9b74;_0x1ba7c9=0xc8;}else{_0x1ba7c9=0xce;}_0x297ac2[_0xd21f('0x1d')](_0x1ba7c9);return _0x297ac2[_0xd21f('0x1e')]('Content-Range',_0x13cef7+'-'+_0x47d38d+'/'+_0x1c9b74)[_0xd21f('0x18')](_0x1c51e3);}return null;};}function patchUpdates(_0x4fac28){return function(_0x20f73d){try{jsonpatch[_0xd21f('0x1f')](_0x20f73d,_0x4fac28,!![]);}catch(_0x4fed0d){return BPromise['reject'](_0x4fed0d);}return _0x20f73d['save']();};}function saveUpdates(_0x12c5d9,_0x55b3ae){return function(_0x3eaec8){if(_0x3eaec8){return _0x3eaec8[_0xd21f('0x20')](_0x12c5d9)[_0xd21f('0x21')](function(_0x1844b3){return _0x1844b3;});}return null;};}function removeEntity(_0x26c299,_0x3f81de){return function(_0x490f46){if(_0x490f46){return _0x490f46[_0xd21f('0x22')]()[_0xd21f('0x21')](function(){var _0x4694c9=_0x490f46[_0xd21f('0x23')]({'plain':!![]});var _0xea93ba=_0xd21f('0x24');return db[_0xd21f('0x25')]['destroy']({'where':{'type':_0xea93ba,'resourceId':_0x4694c9['id']}})[_0xd21f('0x21')](function(){return _0x490f46;});})['then'](function(){_0x26c299['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c6d95,_0x16f5d8){return function(_0x5732b7){if(!_0x5732b7){_0x2c6d95['sendStatus'](0x194);}return _0x5732b7;};}function handleError(_0x390c35,_0x5f5671){_0x5f5671=_0x5f5671||0x1f4;return function(_0x18f8a){logger['error'](_0x18f8a['stack']);if(_0x18f8a[_0xd21f('0x26')]){delete _0x18f8a['name'];}_0x390c35[_0xd21f('0x1d')](_0x5f5671)['send'](_0x18f8a);};}exports['index']=function(_0x33b82a,_0x3cc0f7){var _0x5ce062={},_0x2aa45e={},_0x4b95ae={'count':0x0,'rows':[]};var _0x3173f5=_[_0xd21f('0x27')](db[_0xd21f('0x28')][_0xd21f('0x29')],function(_0x463695){return{'name':_0x463695[_0xd21f('0x2a')],'type':_0x463695[_0xd21f('0x2b')][_0xd21f('0x2c')]};});_0x2aa45e[_0xd21f('0x2d')]=_[_0xd21f('0x27')](_0x3173f5,_0xd21f('0x26'));_0x2aa45e[_0xd21f('0x2e')]=_[_0xd21f('0x2f')](_0x33b82a[_0xd21f('0x2e')]);_0x2aa45e['filters']=_[_0xd21f('0x30')](_0x2aa45e['model'],_0x2aa45e[_0xd21f('0x2e')]);_0x5ce062[_0xd21f('0x31')]=_[_0xd21f('0x30')](_0x2aa45e[_0xd21f('0x2d')],qs[_0xd21f('0x32')](_0x33b82a[_0xd21f('0x2e')]['fields']));_0x5ce062[_0xd21f('0x31')]=_0x5ce062[_0xd21f('0x31')][_0xd21f('0x33')]?_0x5ce062[_0xd21f('0x31')]:_0x2aa45e['model'];if(!_0x33b82a['query']['hasOwnProperty']('nolimit')){_0x5ce062[_0xd21f('0x1c')]=qs[_0xd21f('0x1c')](_0x33b82a[_0xd21f('0x2e')]['limit']);_0x5ce062['offset']=qs['offset'](_0x33b82a[_0xd21f('0x2e')][_0xd21f('0x1a')]);}_0x5ce062[_0xd21f('0x34')]=qs[_0xd21f('0x35')](_0x33b82a[_0xd21f('0x2e')][_0xd21f('0x35')]);_0x5ce062[_0xd21f('0x36')]=qs['filters'](_[_0xd21f('0x37')](_0x33b82a['query'],_0x2aa45e[_0xd21f('0x38')]),_0x3173f5);if(_0x33b82a['query'][_0xd21f('0x39')]){_0x5ce062[_0xd21f('0x36')]=_[_0xd21f('0x3a')](_0x5ce062[_0xd21f('0x36')],{'$or':_[_0xd21f('0x27')](_0x3173f5,function(_0x2c0dc3){if(_0x2c0dc3[_0xd21f('0x2b')]!==_0xd21f('0x3b')){var _0xc64f47={};_0xc64f47[_0x2c0dc3[_0xd21f('0x26')]]={'$like':'%'+_0x33b82a['query'][_0xd21f('0x39')]+'%'};return _0xc64f47;}})});}_0x5ce062=_[_0xd21f('0x3a')]({},_0x5ce062,_0x33b82a['options']);var _0x1eb359={'where':_0x5ce062[_0xd21f('0x36')]};return db[_0xd21f('0x28')][_0xd21f('0x1b')](_0x1eb359)[_0xd21f('0x21')](function(_0x4a0d7a){_0x4b95ae[_0xd21f('0x1b')]=_0x4a0d7a;if(_0x33b82a[_0xd21f('0x2e')][_0xd21f('0x3c')]){_0x5ce062['include']=[{'all':!![]}];}return db[_0xd21f('0x28')]['findAll'](_0x5ce062);})[_0xd21f('0x21')](function(_0x5c08d3){_0x4b95ae[_0xd21f('0x3d')]=_0x5c08d3;return _0x4b95ae;})[_0xd21f('0x21')](respondWithFilteredResult(_0x3cc0f7,_0x5ce062))[_0xd21f('0x3e')](handleError(_0x3cc0f7,null));};exports['show']=function(_0x46a449,_0x3d0845){var _0x4ebca5={'raw':!![],'where':{'id':_0x46a449[_0xd21f('0x3f')]['id']}},_0x412995={};_0x412995[_0xd21f('0x2d')]=_['keys'](db[_0xd21f('0x28')][_0xd21f('0x29')]);_0x412995[_0xd21f('0x2e')]=_[_0xd21f('0x2f')](_0x46a449[_0xd21f('0x2e')]);_0x412995[_0xd21f('0x38')]=_['intersection'](_0x412995[_0xd21f('0x2d')],_0x412995['query']);_0x4ebca5[_0xd21f('0x31')]=_[_0xd21f('0x30')](_0x412995[_0xd21f('0x2d')],qs['fields'](_0x46a449[_0xd21f('0x2e')][_0xd21f('0x32')]));_0x4ebca5[_0xd21f('0x31')]=_0x4ebca5[_0xd21f('0x31')][_0xd21f('0x33')]?_0x4ebca5['attributes']:_0x412995[_0xd21f('0x2d')];if(_0x46a449[_0xd21f('0x2e')]['includeAll']){_0x4ebca5['include']=[{'all':!![]}];}_0x4ebca5=_[_0xd21f('0x3a')]({},_0x4ebca5,_0x46a449[_0xd21f('0x40')]);return db[_0xd21f('0x28')][_0xd21f('0x41')](_0x4ebca5)[_0xd21f('0x21')](handleEntityNotFound(_0x3d0845,null))[_0xd21f('0x21')](respondWithResult(_0x3d0845,null))[_0xd21f('0x3e')](handleError(_0x3d0845,null));};exports['create']=function(_0x4d0177,_0x5aff4b){return db['Interval']['create'](_0x4d0177[_0xd21f('0x42')],{})[_0xd21f('0x21')](function(_0x16d2be){var _0x234141=_0x4d0177['user'][_0xd21f('0x23')]({'plain':!![]});if(!_0x234141)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x234141['role']===_0xd21f('0x43')){var _0x28d53b=_0x16d2be[_0xd21f('0x23')]({'plain':!![]});var _0x27be4c='Intervals';return db[_0xd21f('0x44')][_0xd21f('0x41')]({'where':{'name':_0x27be4c,'userProfileId':_0x234141['userProfileId']},'raw':!![]})[_0xd21f('0x21')](function(_0x3d94b1){if(_0x3d94b1&&_0x3d94b1[_0xd21f('0x45')]===0x0){return db['UserProfileResource'][_0xd21f('0x46')]({'name':_0x28d53b[_0xd21f('0x26')],'resourceId':_0x28d53b['id'],'type':_0x3d94b1[_0xd21f('0x26')],'sectionId':_0x3d94b1['id']},{})[_0xd21f('0x21')](function(){return _0x16d2be;});}else{return _0x16d2be;}})[_0xd21f('0x3e')](function(_0x2bbf63){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bbf63);throw _0x2bbf63;});}return _0x16d2be;})['then'](respondWithResult(_0x5aff4b,0xc9))[_0xd21f('0x3e')](handleError(_0x5aff4b,null));};exports[_0xd21f('0x20')]=function(_0x514ae2,_0x16097c){if(_0x514ae2['body']['id']){delete _0x514ae2['body']['id'];}return db[_0xd21f('0x28')][_0xd21f('0x41')]({'where':{'id':_0x514ae2[_0xd21f('0x3f')]['id']}})[_0xd21f('0x21')](handleEntityNotFound(_0x16097c,null))[_0xd21f('0x21')](saveUpdates(_0x514ae2[_0xd21f('0x42')],null))['then'](respondWithResult(_0x16097c,null))[_0xd21f('0x3e')](handleError(_0x16097c,null));};exports[_0xd21f('0x22')]=function(_0x3c3c65,_0x3c6755){return db[_0xd21f('0x28')][_0xd21f('0x41')]({'where':{'id':_0x3c3c65[_0xd21f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3c6755,null))[_0xd21f('0x21')](removeEntity(_0x3c6755,null))[_0xd21f('0x3e')](handleError(_0x3c6755,null));};exports[_0xd21f('0x47')]=function(_0x3a8b26,_0x12f432,_0x66c8db){if(_0x3a8b26[_0xd21f('0x42')]['id']){delete _0x3a8b26['body']['id'];}return db[_0xd21f('0x28')][_0xd21f('0x41')]({'where':{'id':_0x3a8b26[_0xd21f('0x3f')]['id']}})[_0xd21f('0x21')](handleEntityNotFound(_0x12f432,null))['then'](function(_0x10768a){if(_0x10768a){_0x3a8b26[_0xd21f('0x42')][_0xd21f('0x48')]=_0x10768a['id'];return db[_0xd21f('0x28')][_0xd21f('0x46')](_0x3a8b26['body']);}})[_0xd21f('0x21')](respondWithResult(_0x12f432,null))[_0xd21f('0x3e')](handleError(_0x12f432,null));};exports[_0xd21f('0x49')]=function(_0x244e5f,_0x64137c,_0x2cea75){var _0x278ddb={};var _0x5c3ec9={};var _0x2d5689;var _0x52b1dc;return db[_0xd21f('0x28')][_0xd21f('0x4a')]({'where':{'id':_0x244e5f['params']['id']}})[_0xd21f('0x21')](handleEntityNotFound(_0x64137c,null))['then'](function(_0x1676d9){if(_0x1676d9){_0x2d5689=_0x1676d9;_0x5c3ec9['model']=_[_0xd21f('0x2f')](db[_0xd21f('0x28')]['rawAttributes']);_0x5c3ec9[_0xd21f('0x2e')]=_[_0xd21f('0x2f')](_0x244e5f['query']);_0x5c3ec9['filters']=_[_0xd21f('0x30')](_0x5c3ec9['model'],_0x5c3ec9[_0xd21f('0x2e')]);_0x278ddb[_0xd21f('0x31')]=_[_0xd21f('0x30')](_0x5c3ec9[_0xd21f('0x2d')],qs['fields'](_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x32')]));_0x278ddb['attributes']=_0x278ddb[_0xd21f('0x31')][_0xd21f('0x33')]?_0x278ddb[_0xd21f('0x31')]:_0x5c3ec9[_0xd21f('0x2d')];_0x278ddb[_0xd21f('0x34')]=qs[_0xd21f('0x35')](_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x35')]);_0x278ddb['where']=qs['filters'](_[_0xd21f('0x37')](_0x244e5f[_0xd21f('0x2e')],_0x5c3ec9[_0xd21f('0x38')]));if(_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x39')]){_0x278ddb['where']=_[_0xd21f('0x3a')](_0x278ddb[_0xd21f('0x36')],{'$or':_[_0xd21f('0x27')](_0x278ddb[_0xd21f('0x31')],function(_0x34fce7){var _0x4da540={};_0x4da540[_0x34fce7]={'$like':'%'+_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x39')]+'%'};return _0x4da540;})});}_0x278ddb=_[_0xd21f('0x3a')]({},_0x278ddb,_0x244e5f[_0xd21f('0x40')]);return _0x2d5689[_0xd21f('0x49')](_0x278ddb);}})[_0xd21f('0x21')](function(_0x53a79d){if(_0x53a79d){_0x52b1dc=_0x53a79d[_0xd21f('0x33')];if(!_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x4b')]('nolimit')){_0x278ddb['limit']=qs[_0xd21f('0x1c')](_0x244e5f[_0xd21f('0x2e')]['limit']);_0x278ddb[_0xd21f('0x1a')]=qs['offset'](_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x1a')]);}return _0x2d5689['getIntervals'](_0x278ddb);}})[_0xd21f('0x21')](function(_0x8046e7){if(_0x8046e7){return _0x8046e7?{'count':_0x52b1dc,'rows':_0x8046e7}:null;}})[_0xd21f('0x21')](respondWithResult(_0x64137c,null))['catch'](handleError(_0x64137c,null));};exports[_0xd21f('0x4c')]=function(_0x3df3ad,_0x5a59ae,_0x195cf7){return db[_0xd21f('0x28')][_0xd21f('0x4a')]({'where':{'id':_0x3df3ad['params']['id']}})[_0xd21f('0x21')](handleEntityNotFound(_0x5a59ae,null))[_0xd21f('0x21')](function(_0x4a86be){if(_0x4a86be){return db[_0xd21f('0x4d')]['transaction'](function(_0x152874){return db['Interval']['destroy']({'where':{'IntervalId':_0x3df3ad[_0xd21f('0x3f')]['id']},'transaction':_0x152874})[_0xd21f('0x21')](function(_0x55f53b){var _0x4fa30e=_[_0xd21f('0x27')](_0x3df3ad['body'],function(_0x1becbf){delete _0x1becbf['id'];_0x1becbf[_0xd21f('0x48')]=_0x3df3ad['params']['id'];return _0x1becbf;});return db[_0xd21f('0x28')][_0xd21f('0x4e')](_0x4fa30e,{'transaction':_0x152874});});})[_0xd21f('0x21')](function(){return db[_0xd21f('0x28')][_0xd21f('0x4f')]({'where':{'IntervalId':_0x3df3ad[_0xd21f('0x3f')]['id']}});});}})['then'](respondWithResult(_0x5a59ae,null))[_0xd21f('0x3e')](handleError(_0x5a59ae,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index f2881e5..44e9230 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 _0x67ca=['Interval','tools_intervals','rewrite','interval','string','getIntervals','all','map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','iftime','exports','define'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0x67ca,0x7b));var _0xa67c=function(_0x4c4f5c,_0x4b209e){_0x4c4f5c=_0x4c4f5c-0x0;var _0xdfd773=_0x67ca[_0x4c4f5c];return _0xdfd773;};'use strict';var attributes=require(_0xa67c('0x0'));var extensions=require(_0xa67c('0x1'));var iftime=require('../../utils/iftime')[_0xa67c('0x2')];module[_0xa67c('0x3')]=function(_0x5c3008){return _0x5c3008[_0xa67c('0x4')](_0xa67c('0x5'),attributes,{'tableName':_0xa67c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bd01e){extensions[_0xa67c('0x7')](_0x5c3008,_0x1bd01e);},'afterBulkCreate':function(_0x52d374,_0x1255d5,_0x3c7fd8){_0x3c7fd8();extensions[_0xa67c('0x7')](_0x5c3008,_0x52d374[0x0]);},'afterUpdate':function(_0x335e6d){extensions['rewrite'](_0x5c3008,_0x335e6d);},'afterDestroy':function(_0x1f8b93){extensions[_0xa67c('0x7')](_0x5c3008,_0x1f8b93);}},'instanceMethods':{'ifTime':function(_0x459e63=undefined,_0x3701a8=new Date()){if(typeof this[_0xa67c('0x8')]===_0xa67c('0x9')){return iftime(this['interval'],_0x459e63,_0x3701a8);}else{return this[_0xa67c('0xa')]()['then'](function(_0x404ba0){return Promise[_0xa67c('0xb')](_0x404ba0[_0xa67c('0xc')](function(_0x2da717){return _0x2da717[_0xa67c('0xd')](_0x459e63,_0x3701a8);}));})[_0xa67c('0xe')](function(_0x243800){return _0x243800[_0xa67c('0xf')](function(_0x36ea2f,_0x476f4b){return _0x36ea2f||_0x476f4b;},![]);});}}}});}; \ No newline at end of file +var _0x13ea=['define','Interval','tools_intervals','rewrite','string','then','all','map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','exports'];(function(_0x130899,_0x47bc29){var _0x253db1=function(_0x248011){while(--_0x248011){_0x130899['push'](_0x130899['shift']());}};_0x253db1(++_0x47bc29);}(_0x13ea,0x88));var _0xa13e=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x13ea[_0x565c49];return _0x20ca34;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xa13e('0x0'));var iftime=require(_0xa13e('0x1'))[_0xa13e('0x2')];module[_0xa13e('0x3')]=function(_0x1b5fc6){return _0x1b5fc6[_0xa13e('0x4')](_0xa13e('0x5'),attributes,{'tableName':_0xa13e('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a20e2){extensions[_0xa13e('0x7')](_0x1b5fc6,_0x3a20e2);},'afterBulkCreate':function(_0x249cee,_0x22889f,_0x56dd49){_0x56dd49();extensions[_0xa13e('0x7')](_0x1b5fc6,_0x249cee[0x0]);},'afterUpdate':function(_0x31a33e){extensions[_0xa13e('0x7')](_0x1b5fc6,_0x31a33e);},'afterDestroy':function(_0x2e5bba){extensions[_0xa13e('0x7')](_0x1b5fc6,_0x2e5bba);}},'instanceMethods':{'ifTime':function(_0x1b396e=undefined,_0x32a0af=new Date()){if(typeof this['interval']===_0xa13e('0x8')){return iftime(this['interval'],_0x1b396e,_0x32a0af);}else{return this['getIntervals']()[_0xa13e('0x9')](function(_0x1ec645){return Promise[_0xa13e('0xa')](_0x1ec645[_0xa13e('0xb')](function(_0x1b2533){return _0x1b2533[_0xa13e('0xc')](_0x1b396e,_0x32a0af);}));})[_0xa13e('0x9')](function(_0xcee063){return _0xcee063[_0xa13e('0xd')](function(_0x561158,_0x19832b){return _0x561158||_0x19832b;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index be5c402..5347e01 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 _0x5792=['IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime','intervals','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','format','IntervalIftime:\x20timezone\x20=\x20%s','silly','reduce','lodash','util','../../mysqldb','iftime','../../config/logger','rpc','GetInterval','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','stringify','message','error','ShowInterval','find','catch','Interval','all','ifTime'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0x5792,0x14c));var _0x2579=function(_0x2e6c6f,_0x306238){_0x2e6c6f=_0x2e6c6f-0x0;var _0x5525db=_0x5792[_0x2e6c6f];return _0x5525db;};'use strict';var _=require(_0x2579('0x0'));var util=require(_0x2579('0x1'));var db=require(_0x2579('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x2579('0x3')];var logger=require(_0x2579('0x4'))(_0x2579('0x5'));exports[_0x2579('0x6')]=function(_0x13a7bc){var _0x5856b3=this;return new Promise(function(_0x1fae15,_0x8cb8f){return db['Interval'][_0x2579('0x7')]({'raw':_0x13a7bc[_0x2579('0x8')]?_0x13a7bc[_0x2579('0x8')][_0x2579('0x9')]===undefined?!![]:![]:!![],'where':_0x13a7bc[_0x2579('0x8')]?_0x13a7bc[_0x2579('0x8')][_0x2579('0xa')]||null:null,'attributes':_0x13a7bc[_0x2579('0x8')]?_0x13a7bc[_0x2579('0x8')]['attributes']||null:null,'limit':_0x13a7bc['options']?_0x13a7bc[_0x2579('0x8')][_0x2579('0xb')]||null:null,'include':_0x13a7bc[_0x2579('0x8')]?_0x13a7bc[_0x2579('0x8')][_0x2579('0xc')]?_[_0x2579('0xd')](_0x13a7bc[_0x2579('0x8')][_0x2579('0xc')],function(_0x11e5c4){return{'model':db[_0x11e5c4[_0x2579('0xe')]],'as':_0x11e5c4['as'],'attributes':_0x11e5c4[_0x2579('0xf')],'include':_0x11e5c4[_0x2579('0xc')]?_[_0x2579('0xd')](_0x11e5c4[_0x2579('0xc')],function(_0x31bf3a){return{'model':db[_0x31bf3a[_0x2579('0xe')]],'as':_0x31bf3a['as'],'attributes':_0x31bf3a[_0x2579('0xf')],'include':_0x31bf3a[_0x2579('0xc')]?_[_0x2579('0xd')](_0x31bf3a[_0x2579('0xc')],function(_0x38e392){return{'model':db[_0x38e392['model']],'as':_0x38e392['as'],'attributes':_0x38e392[_0x2579('0xf')]};}):[]};}):[]};}):[]:[]})[_0x2579('0x10')](function(_0x1a5b56){logger[_0x2579('0x11')](_0x2579('0x6'),_0x13a7bc);logger[_0x2579('0x12')](_0x2579('0x6'),_0x13a7bc,JSON[_0x2579('0x13')](_0x1a5b56));_0x1fae15(_0x1a5b56);})['catch'](function(_0x2bd5ee){logger['error'](_0x2579('0x6'),_0x2bd5ee[_0x2579('0x14')],_0x13a7bc);_0x8cb8f(_0x5856b3[_0x2579('0x15')](0x1f4,_0x2bd5ee['message']));});});};exports[_0x2579('0x16')]=function(_0x3aab42){var _0x4977b4=this;return new Promise(function(_0x39bd1b,_0x44f1d9){return db['Interval'][_0x2579('0x17')]({'raw':_0x3aab42[_0x2579('0x8')]?_0x3aab42[_0x2579('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x3aab42[_0x2579('0x8')]?_0x3aab42[_0x2579('0x8')]['where']||null:null,'attributes':_0x3aab42[_0x2579('0x8')]?_0x3aab42[_0x2579('0x8')]['attributes']||null:null,'include':_0x3aab42[_0x2579('0x8')]?_0x3aab42[_0x2579('0x8')][_0x2579('0xc')]?_[_0x2579('0xd')](_0x3aab42['options'][_0x2579('0xc')],function(_0x11bddf){return{'model':db[_0x11bddf['model']],'as':_0x11bddf['as'],'attributes':_0x11bddf[_0x2579('0xf')],'include':_0x11bddf[_0x2579('0xc')]?_[_0x2579('0xd')](_0x11bddf['include'],function(_0x3780bc){return{'model':db[_0x3780bc[_0x2579('0xe')]],'as':_0x3780bc['as'],'attributes':_0x3780bc[_0x2579('0xf')],'include':_0x3780bc['include']?_[_0x2579('0xd')](_0x3780bc['include'],function(_0x3f73e6){return{'model':db[_0x3f73e6[_0x2579('0xe')]],'as':_0x3f73e6['as'],'attributes':_0x3f73e6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f5637){logger[_0x2579('0x11')](_0x2579('0x16'),_0x3aab42);logger[_0x2579('0x12')](_0x2579('0x16'),_0x3aab42,JSON[_0x2579('0x13')](_0x3f5637));_0x39bd1b(_0x3f5637);})[_0x2579('0x18')](function(_0x2ade9){logger[_0x2579('0x15')](_0x2579('0x16'),_0x2ade9[_0x2579('0x14')],_0x3aab42);_0x44f1d9(_0x4977b4['error'](0x1f4,_0x2ade9[_0x2579('0x14')]));});});};function checkArrayOfIntervals(_0x29f2a1,_0x38e2a2){var _0x57c558=[];return db[_0x2579('0x19')][_0x2579('0x7')]({'where':{'id':_0x29f2a1}})[_0x2579('0x10')](function(_0x462cf3){_0x57c558=_0x462cf3;return Promise[_0x2579('0x1a')](_0x57c558[_0x2579('0xd')](function(_0x7c9b49){return _0x7c9b49[_0x2579('0x1b')](_0x38e2a2);}));})['then'](function(_0x2d606a){var _0x106f21=_0x2d606a['reduce'](function(_0x106ca8,_0x57d6c7){return _0x106ca8||_0x57d6c7;},![]);logger[_0x2579('0x11')](util['format'](_0x2579('0x1c'),_0x57c558[_0x2579('0xd')](function(_0x231fb4){return _0x231fb4[_0x2579('0x1d')];})[_0x2579('0x1e')](',\x20'),_0x57c558[_0x2579('0xd')](function(_0x54561f){return _0x54561f['id'];})[_0x2579('0x1e')](',\x20')));return _0x106f21;});}function checkSingleInterval(_0x2930e3,_0x58852e){return db[_0x2579('0x19')][_0x2579('0x1f')](_0x2930e3)[_0x2579('0x10')](function(_0x447746){if(_0x447746){logger[_0x2579('0x11')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x447746[_0x2579('0x1d')],_0x447746['id']));return _0x447746[_0x2579('0x1b')](_0x58852e);}});}exports[_0x2579('0x20')]=function(_0xd8c9a8){var _0x11ebbf=_0xd8c9a8['intervalIds'];var _0x4e580f=Array['isArray'](_0xd8c9a8[_0x2579('0x21')])?_0xd8c9a8[_0x2579('0x21')]:typeof _0xd8c9a8[_0x2579('0x21')]==='string'?[_0xd8c9a8[_0x2579('0x21')]]:[];var _0x2ef12a=_0xd8c9a8['timezone']||undefined;var _0x3fe525=![];if(_0x4e580f[_0x2579('0x22')]){logger['info'](util['format'](_0x2579('0x23'),_0x4e580f[_0x2579('0x1e')](';\x20')));}if(_0x2ef12a){logger[_0x2579('0x11')](util[_0x2579('0x24')](_0x2579('0x25'),_0x2ef12a));}logger[_0x2579('0x12')]('Iftime',_0x3fe525);logger[_0x2579('0x26')](_0x2579('0x20'),_0xd8c9a8);return Promise['resolve']()[_0x2579('0x10')](function(){if(Array['isArray'](_0x11ebbf)){return checkArrayOfIntervals(_0x11ebbf,_0x2ef12a);}else if(_0x11ebbf){return checkSingleInterval(_0x11ebbf,_0x2ef12a);}})[_0x2579('0x10')](function(_0xeba0be){var _0x11ce54=_0x4e580f[_0x2579('0x27')](function(_0x48b640,_0x31b6b0){return _0x48b640||iftime(_0x31b6b0,_0x2ef12a);},![]);_0x3fe525=_0xeba0be||_0x11ce54;return _0x3fe525;})[_0x2579('0x18')](function(_0x3467f3){logger[_0x2579('0x15')](_0x2579('0x20'),_0xd8c9a8,_0x3467f3);throw this[_0x2579('0x15')](0x1f4,_0x3467f3['message']);});}; \ No newline at end of file +var _0x31b7=['length','Iftime','silly','IntervalIftime','lodash','../../utils/iftime','iftime','../../config/logger','rpc','Interval','findAll','options','raw','where','limit','map','include','model','attributes','then','GetInterval','debug','stringify','message','error','info','ShowInterval','catch','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','intervalIds','isArray','intervals','string','timezone'];(function(_0x147e24,_0x5a5716){var _0x585211=function(_0x5031f9){while(--_0x5031f9){_0x147e24['push'](_0x147e24['shift']());}};_0x585211(++_0x5a5716);}(_0x31b7,0xa8));var _0x731b=function(_0xd39a12,_0x52711b){_0xd39a12=_0xd39a12-0x0;var _0x19b6d2=_0x31b7[_0xd39a12];return _0x19b6d2;};'use strict';var _=require(_0x731b('0x0'));var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require(_0x731b('0x1'))[_0x731b('0x2')];var logger=require(_0x731b('0x3'))(_0x731b('0x4'));exports['GetInterval']=function(_0x571be3){var _0x6e304b=this;return new Promise(function(_0x457cdf,_0x1d8873){return db[_0x731b('0x5')][_0x731b('0x6')]({'raw':_0x571be3['options']?_0x571be3[_0x731b('0x7')][_0x731b('0x8')]===undefined?!![]:![]:!![],'where':_0x571be3['options']?_0x571be3[_0x731b('0x7')][_0x731b('0x9')]||null:null,'attributes':_0x571be3['options']?_0x571be3[_0x731b('0x7')]['attributes']||null:null,'limit':_0x571be3[_0x731b('0x7')]?_0x571be3[_0x731b('0x7')][_0x731b('0xa')]||null:null,'include':_0x571be3[_0x731b('0x7')]?_0x571be3[_0x731b('0x7')]['include']?_['map'](_0x571be3['options']['include'],function(_0x14af39){return{'model':db[_0x14af39['model']],'as':_0x14af39['as'],'attributes':_0x14af39['attributes'],'include':_0x14af39['include']?_[_0x731b('0xb')](_0x14af39[_0x731b('0xc')],function(_0x5e6028){return{'model':db[_0x5e6028[_0x731b('0xd')]],'as':_0x5e6028['as'],'attributes':_0x5e6028[_0x731b('0xe')],'include':_0x5e6028['include']?_[_0x731b('0xb')](_0x5e6028[_0x731b('0xc')],function(_0x568a13){return{'model':db[_0x568a13[_0x731b('0xd')]],'as':_0x568a13['as'],'attributes':_0x568a13[_0x731b('0xe')]};}):[]};}):[]};}):[]:[]})[_0x731b('0xf')](function(_0x5b5967){logger['info'](_0x731b('0x10'),_0x571be3);logger[_0x731b('0x11')](_0x731b('0x10'),_0x571be3,JSON[_0x731b('0x12')](_0x5b5967));_0x457cdf(_0x5b5967);})['catch'](function(_0x50b925){logger['error']('GetInterval',_0x50b925[_0x731b('0x13')],_0x571be3);_0x1d8873(_0x6e304b[_0x731b('0x14')](0x1f4,_0x50b925['message']));});});};exports['ShowInterval']=function(_0x596b49){var _0x31e9ab=this;return new Promise(function(_0x42ec23,_0x4bc2f1){return db[_0x731b('0x5')]['find']({'raw':_0x596b49['options']?_0x596b49['options'][_0x731b('0x8')]===undefined?!![]:![]:!![],'where':_0x596b49['options']?_0x596b49[_0x731b('0x7')][_0x731b('0x9')]||null:null,'attributes':_0x596b49[_0x731b('0x7')]?_0x596b49[_0x731b('0x7')][_0x731b('0xe')]||null:null,'include':_0x596b49[_0x731b('0x7')]?_0x596b49[_0x731b('0x7')][_0x731b('0xc')]?_[_0x731b('0xb')](_0x596b49['options'][_0x731b('0xc')],function(_0x452c71){return{'model':db[_0x452c71['model']],'as':_0x452c71['as'],'attributes':_0x452c71['attributes'],'include':_0x452c71[_0x731b('0xc')]?_[_0x731b('0xb')](_0x452c71['include'],function(_0x2bf1f8){return{'model':db[_0x2bf1f8[_0x731b('0xd')]],'as':_0x2bf1f8['as'],'attributes':_0x2bf1f8[_0x731b('0xe')],'include':_0x2bf1f8[_0x731b('0xc')]?_[_0x731b('0xb')](_0x2bf1f8['include'],function(_0x3419a0){return{'model':db[_0x3419a0['model']],'as':_0x3419a0['as'],'attributes':_0x3419a0[_0x731b('0xe')]};}):[]};}):[]};}):[]:[]})[_0x731b('0xf')](function(_0xf2fe9a){logger[_0x731b('0x15')](_0x731b('0x16'),_0x596b49);logger['debug']('ShowInterval',_0x596b49,JSON[_0x731b('0x12')](_0xf2fe9a));_0x42ec23(_0xf2fe9a);})[_0x731b('0x17')](function(_0x325d6f){logger[_0x731b('0x14')](_0x731b('0x16'),_0x325d6f['message'],_0x596b49);_0x4bc2f1(_0x31e9ab[_0x731b('0x14')](0x1f4,_0x325d6f[_0x731b('0x13')]));});});};function checkArrayOfIntervals(_0x57ff2b,_0x3ec556){var _0x4795ea=[];return db[_0x731b('0x5')][_0x731b('0x6')]({'where':{'id':_0x57ff2b}})[_0x731b('0xf')](function(_0x36ac25){_0x4795ea=_0x36ac25;return Promise['all'](_0x4795ea[_0x731b('0xb')](function(_0x4304c9){return _0x4304c9['ifTime'](_0x3ec556);}));})[_0x731b('0xf')](function(_0x1e7e87){var _0x1610fb=_0x1e7e87[_0x731b('0x18')](function(_0x79c91,_0x1c0a1c){return _0x79c91||_0x1c0a1c;},![]);logger[_0x731b('0x15')](util['format'](_0x731b('0x19'),_0x4795ea['map'](function(_0x826243){return _0x826243[_0x731b('0x1a')];})[_0x731b('0x1b')](',\x20'),_0x4795ea[_0x731b('0xb')](function(_0x190a42){return _0x190a42['id'];})[_0x731b('0x1b')](',\x20')));return _0x1610fb;});}function checkSingleInterval(_0x4f1c35,_0x2a595b){return db[_0x731b('0x5')][_0x731b('0x1c')](_0x4f1c35)[_0x731b('0xf')](function(_0x19d404){if(_0x19d404){logger[_0x731b('0x15')](util[_0x731b('0x1d')](_0x731b('0x1e'),_0x19d404[_0x731b('0x1a')],_0x19d404['id']));return _0x19d404[_0x731b('0x1f')](_0x2a595b);}});}exports['IntervalIftime']=function(_0xf01398){var _0x375c19=_0xf01398[_0x731b('0x20')];var _0x5c7147=Array[_0x731b('0x21')](_0xf01398['intervals'])?_0xf01398['intervals']:typeof _0xf01398[_0x731b('0x22')]===_0x731b('0x23')?[_0xf01398[_0x731b('0x22')]]:[];var _0x41bcae=_0xf01398[_0x731b('0x24')]||undefined;var _0x3d6445=![];if(_0x5c7147[_0x731b('0x25')]){logger[_0x731b('0x15')](util[_0x731b('0x1d')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x5c7147[_0x731b('0x1b')](';\x20')));}if(_0x41bcae){logger[_0x731b('0x15')](util[_0x731b('0x1d')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x41bcae));}logger['debug'](_0x731b('0x26'),_0x3d6445);logger[_0x731b('0x27')](_0x731b('0x28'),_0xf01398);return Promise['resolve']()[_0x731b('0xf')](function(){if(Array[_0x731b('0x21')](_0x375c19)){return checkArrayOfIntervals(_0x375c19,_0x41bcae);}else if(_0x375c19){return checkSingleInterval(_0x375c19,_0x41bcae);}})[_0x731b('0xf')](function(_0x443ccc){var _0x3f78c9=_0x5c7147['reduce'](function(_0x4c773f,_0x1a56f2){return _0x4c773f||iftime(_0x1a56f2,_0x41bcae);},![]);_0x3d6445=_0x443ccc||_0x3f78c9;return _0x3d6445;})[_0x731b('0x17')](function(_0x10cbc5){logger[_0x731b('0x14')](_0x731b('0x28'),_0xf01398,_0x10cbc5);throw this[_0x731b('0x14')](0x1f4,_0x10cbc5['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e425ab9..8643de6 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(_0x48c77f,_0x449b47){var _0x45bce5=function(_0x1664f1){while(--_0x1664f1){_0x48c77f['push'](_0x48c77f['shift']());}};_0x45bce5(++_0x449b47);}(_0xadb5,0xad));var _0x5adb=function(_0xe63d21,_0x54b053){_0xe63d21=_0xe63d21-0x0;var _0x3cc6c0=_0xadb5[_0xe63d21];return _0x3cc6c0;};'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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x48fe4b,_0x294a8c){var _0x49048b=function(_0x4134fe){while(--_0x4134fe){_0x48fe4b['push'](_0x48fe4b['shift']());}};_0x49048b(++_0x294a8c);}(_0xadb5,0xad));var _0x5adb=function(_0x4d378a,_0x17fb02){_0x4d378a=_0x4d378a-0x0;var _0x5e83a2=_0xadb5[_0x4d378a];return _0x5e83a2;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a01cf88..fb67aff 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 _0x5fa5=['Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','end','status','statusCode','parse','error','json','write','openIssue','body','headers','x-forwarded-for','remoteAddress','connection','socket','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0x5fa5,0x81));var _0x55fa=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x5fa5[_0x36c5b0];return _0xf19333;};'use strict';var BPromise=require(_0x55fa('0x0'));var https=require(_0x55fa('0x1'));var logger=require('../../config/logger')(_0x55fa('0x2'));var USERNAME=_0x55fa('0x3');var PASSWORD=_0x55fa('0x4');function openIssue(_0x3d0b77,_0x23fe21){var _0x5b9ca6={'fields':{'project':{'key':_0x3d0b77[_0x55fa('0x5')]||_0x55fa('0x6')},'summary':(_0x3d0b77[_0x55fa('0x7')]||_0x55fa('0x8'))+'\x20from\x20'+_0x3d0b77['ip'],'description':_0x3d0b77[_0x55fa('0x9')]||JSON[_0x55fa('0xa')](_0x3d0b77),'issuetype':{'name':_0x3d0b77[_0x55fa('0xb')]||_0x55fa('0xc')}}};_0x5b9ca6[_0x55fa('0xd')][_0x55fa('0xe')]=_0x3d0b77[_0x55fa('0xf')];_0x5b9ca6[_0x55fa('0xd')]['customfield_11501']=_0x3d0b77[_0x55fa('0x10')];_0x5b9ca6[_0x55fa('0xd')][_0x55fa('0x11')]=_0x3d0b77[_0x55fa('0x12')];_0x5b9ca6[_0x55fa('0xd')]['customfield_11503']=_0x3d0b77[_0x55fa('0x13')];_0x5b9ca6[_0x55fa('0xd')][_0x55fa('0x14')]=_0x3d0b77[_0x55fa('0x15')];_0x5b9ca6['fields'][_0x55fa('0x16')]=_0x3d0b77['ip'];var _0x2844ca={'host':_0x55fa('0x17'),'port':0x1bb,'path':_0x55fa('0x18'),'method':_0x55fa('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x55fa('0x1a'),'Authorization':_0x55fa('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0x55fa('0x1c')](_0x55fa('0x1d'))}};var _0x99b427=JSON[_0x55fa('0xa')](_0x5b9ca6);var _0x1ea6c6=https[_0x55fa('0x1e')](_0x2844ca,function(_0x2ada06){_0x2ada06[_0x55fa('0x1f')](_0x55fa('0x20'));var _0x36964a='';_0x2ada06['on']('data',function(_0xa31b76){_0x36964a+=_0xa31b76;});_0x2ada06['on'](_0x55fa('0x21'),function(){if(_0x23fe21){return _0x23fe21[_0x55fa('0x22')](_0x2ada06[_0x55fa('0x23')])['json'](JSON[_0x55fa('0x24')](_0x36964a));}});});_0x1ea6c6['on'](_0x55fa('0x25'),function(_0x5dcf89){if(_0x23fe21){return _0x23fe21[_0x55fa('0x22')](0x1f4)[_0x55fa('0x26')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x1ea6c6[_0x55fa('0x27')](_0x99b427);_0x1ea6c6['end']();}exports[_0x55fa('0x28')]=openIssue;exports['send']=function(_0xd1431f,_0x4a31e5){_0xd1431f[_0x55fa('0x29')]['ip']=_0xd1431f[_0x55fa('0x2a')][_0x55fa('0x2b')]||_0xd1431f['connection']['remoteAddress']||_0xd1431f['socket'][_0x55fa('0x2c')]||_0xd1431f[_0x55fa('0x2d')][_0x55fa('0x2e')][_0x55fa('0x2c')];return openIssue(_0xd1431f['body'],_0x4a31e5);}; \ No newline at end of file +var _0x8c42=['api.jira','write','end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','issuetype','customfield_11500','email','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','base64','request','utf8','status','statusCode','json','parse','error'];(function(_0xe6ae34,_0x234589){var _0x4c5f04=function(_0x29bd0d){while(--_0x29bd0d){_0xe6ae34['push'](_0xe6ae34['shift']());}};_0x4c5f04(++_0x234589);}(_0x8c42,0x19b));var _0x28c4=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0x8c42[_0x3f2a90];return _0xb46279;};'use strict';var BPromise=require(_0x28c4('0x0'));var https=require(_0x28c4('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0x28c4('0x2');function openIssue(_0x53763e,_0x411c68){var _0x3b2f60={'fields':{'project':{'key':_0x53763e['key']||_0x28c4('0x3')},'summary':(_0x53763e[_0x28c4('0x4')]||'Report')+_0x28c4('0x5')+_0x53763e['ip'],'description':_0x53763e['description']||JSON['stringify'](_0x53763e),'issuetype':{'name':_0x53763e[_0x28c4('0x6')]||'Bug'}}};_0x3b2f60['fields'][_0x28c4('0x7')]=_0x53763e[_0x28c4('0x8')];_0x3b2f60[_0x28c4('0x9')]['customfield_11501']=_0x53763e['oldToken'];_0x3b2f60[_0x28c4('0x9')][_0x28c4('0xa')]=_0x53763e[_0x28c4('0xb')];_0x3b2f60[_0x28c4('0x9')][_0x28c4('0xc')]=_0x53763e[_0x28c4('0xd')];_0x3b2f60[_0x28c4('0x9')][_0x28c4('0xe')]=_0x53763e[_0x28c4('0xf')];_0x3b2f60[_0x28c4('0x9')][_0x28c4('0x10')]=_0x53763e['ip'];var _0x3b9d5d={'host':_0x28c4('0x11'),'port':0x1bb,'path':_0x28c4('0x12'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x28c4('0x13'),'Authorization':_0x28c4('0x14')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x28c4('0x15'))}};var _0x67e29a=JSON['stringify'](_0x3b2f60);var _0x38cb75=https[_0x28c4('0x16')](_0x3b9d5d,function(_0x5da94){_0x5da94['setEncoding'](_0x28c4('0x17'));var _0x95e364='';_0x5da94['on']('data',function(_0x34e394){_0x95e364+=_0x34e394;});_0x5da94['on']('end',function(){if(_0x411c68){return _0x411c68[_0x28c4('0x18')](_0x5da94[_0x28c4('0x19')])[_0x28c4('0x1a')](JSON[_0x28c4('0x1b')](_0x95e364));}});});_0x38cb75['on'](_0x28c4('0x1c'),function(_0x5f21ce){if(_0x411c68){return _0x411c68[_0x28c4('0x18')](0x1f4)[_0x28c4('0x1a')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x28c4('0x1d')}]});}});_0x38cb75[_0x28c4('0x1e')](_0x67e29a);_0x38cb75[_0x28c4('0x1f')]();}exports[_0x28c4('0x20')]=openIssue;exports[_0x28c4('0x21')]=function(_0x42dc0d,_0x3d4551){_0x42dc0d[_0x28c4('0x22')]['ip']=_0x42dc0d[_0x28c4('0x23')][_0x28c4('0x24')]||_0x42dc0d[_0x28c4('0x25')][_0x28c4('0x26')]||_0x42dc0d[_0x28c4('0x27')][_0x28c4('0x26')]||_0x42dc0d[_0x28c4('0x25')]['socket'][_0x28c4('0x26')];return openIssue(_0x42dc0d[_0x28c4('0x22')],_0x3d4551);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3bf1533..c89e9a6 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 _0xd2ea=['./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xefa9d8,_0x1cc998){var _0x533d1d=function(_0x590efc){while(--_0x590efc){_0xefa9d8['push'](_0xefa9d8['shift']());}};_0x533d1d(++_0x1cc998);}(_0xd2ea,0x15f));var _0xad2e=function(_0x56d6c0,_0x321c09){_0x56d6c0=_0x56d6c0-0x0;var _0x32d5c8=_0xd2ea[_0x56d6c0];return _0x32d5c8;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),auth[_0xad2e('0xb')](),controller['describe']);router[_0xad2e('0xa')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0xe')]);router['post']('/',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);router[_0xad2e('0x10')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0x11')]);router['delete'](_0xad2e('0xd'),auth[_0xad2e('0xb')](),controller[_0xad2e('0x12')]);module[_0xad2e('0x13')]=router; \ No newline at end of file +var _0x6f7a=['isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x320019,_0x18352c){var _0x5e36ea=function(_0x559611){while(--_0x559611){_0x320019['push'](_0x320019['shift']());}};_0x5e36ea(++_0x18352c);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x93f659,_0x16aaac){_0x93f659=_0x93f659-0x0;var _0x4e5a07=_0x6f7a[_0x93f659];return _0x4e5a07;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var fs_extra=require(_0xa6f7('0x5'));var auth=require(_0xa6f7('0x6'));var interaction=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var controller=require(_0xa6f7('0x9'));router[_0xa6f7('0xa')]('/',auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xc')]);router[_0xa6f7('0xa')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xa6f7('0xa')](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xf')]);router[_0xa6f7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6f7('0x11')](_0xa6f7('0xe'),auth['isAuthenticated'](),controller[_0xa6f7('0x12')]);router['delete'](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0x13')]);module[_0xa6f7('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 3fdca2e..f4f3a96 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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7a54,0x106));var _0x47a5=function(_0x2643ef,_0x659e2a){_0x2643ef=_0x2643ef-0x0;var _0x3e9664=_0x7a54[_0x2643ef];return _0x3e9664;};'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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x3f9214,_0x2fe21a){_0x3f9214=_0x3f9214-0x0;var _0x3c7175=_0x7a54[_0x3f9214];return _0x3c7175;};'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 4803ce9..7d34500 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 _0x2d72=['model','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','rows','params','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection'];(function(_0x46def4,_0x580f28){var _0x40dabe=function(_0x498e64){while(--_0x498e64){_0x46def4['push'](_0x46def4['shift']());}};_0x40dabe(++_0x580f28);}(_0x2d72,0xa8));var _0x22d7=function(_0x3e5bae,_0x14a69e){_0x3e5bae=_0x3e5bae-0x0;var _0x1a3904=_0x2d72[_0x3e5bae];return _0x1a3904;};'use strict';var emlformat=require(_0x22d7('0x0'));var rimraf=require(_0x22d7('0x1'));var zipdir=require(_0x22d7('0x2'));var jsonpatch=require(_0x22d7('0x3'));var rp=require(_0x22d7('0x4'));var moment=require(_0x22d7('0x5'));var BPromise=require(_0x22d7('0x6'));var Mustache=require(_0x22d7('0x7'));var util=require(_0x22d7('0x8'));var path=require(_0x22d7('0x9'));var sox=require(_0x22d7('0xa'));var csv=require(_0x22d7('0xb'));var ejs=require(_0x22d7('0xc'));var fs=require('fs');var fs_extra=require(_0x22d7('0xd'));var _=require('lodash');var squel=require(_0x22d7('0xe'));var crypto=require(_0x22d7('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x22d7('0x10'));var toCsv=require(_0x22d7('0xb'));var querystring=require(_0x22d7('0x11'));var Papa=require(_0x22d7('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x22d7('0x13'));var as=require(_0x22d7('0x14'));var hardwareService=require(_0x22d7('0x15'));var logger=require(_0x22d7('0x16'))(_0x22d7('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x22d7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b725c,_0xec6659){_0xec6659=_0xec6659||0xcc;return function(_0x58bdca){if(_0x58bdca){return _0x3b725c[_0x22d7('0x19')](_0xec6659);}return _0x3b725c[_0x22d7('0x1a')](_0xec6659)[_0x22d7('0x1b')]();};}function respondWithResult(_0x3c443c,_0x1c5c19){_0x1c5c19=_0x1c5c19||0xc8;return function(_0x1b654c){if(_0x1b654c){return _0x3c443c[_0x22d7('0x1a')](_0x1c5c19)[_0x22d7('0x1c')](_0x1b654c);}};}function respondWithFilteredResult(_0x534223,_0x352a78){return function(_0x442ce4){if(_0x442ce4){var _0x3c5f4e=typeof _0x352a78['offset']==='undefined'&&typeof _0x352a78['limit']===_0x22d7('0x1d');var _0x20e157=_0x442ce4[_0x22d7('0x1e')];var _0x3dcca4=_0x3c5f4e?0x0:_0x352a78[_0x22d7('0x1f')];var _0x5b32c0=_0x3c5f4e?_0x442ce4[_0x22d7('0x1e')]:_0x352a78[_0x22d7('0x1f')]+_0x352a78[_0x22d7('0x20')];var _0x5ac2f7;if(_0x5b32c0>=_0x20e157){_0x5b32c0=_0x20e157;_0x5ac2f7=0xc8;}else{_0x5ac2f7=0xce;}_0x534223[_0x22d7('0x1a')](_0x5ac2f7);return _0x534223[_0x22d7('0x21')](_0x22d7('0x22'),_0x3dcca4+'-'+_0x5b32c0+'/'+_0x20e157)[_0x22d7('0x1c')](_0x442ce4);}return null;};}function patchUpdates(_0x6be49e){return function(_0x577400){try{jsonpatch['apply'](_0x577400,_0x6be49e,!![]);}catch(_0x219f7c){return BPromise[_0x22d7('0x23')](_0x219f7c);}return _0x577400[_0x22d7('0x24')]();};}function saveUpdates(_0x4172d3,_0x4f9bc7){return function(_0x3f0148){if(_0x3f0148){return _0x3f0148[_0x22d7('0x25')](_0x4172d3)[_0x22d7('0x26')](function(_0x5b6502){return _0x5b6502;});}return null;};}function removeEntity(_0x459827,_0x523409){return function(_0x219507){if(_0x219507){return _0x219507[_0x22d7('0x27')]()[_0x22d7('0x26')](function(){_0x459827['status'](0xcc)[_0x22d7('0x1b')]();});}};}function handleEntityNotFound(_0x5e4c87,_0x582fe6){return function(_0x238604){if(!_0x238604){_0x5e4c87[_0x22d7('0x19')](0x194);}return _0x238604;};}function handleError(_0x1720f0,_0x27998a){_0x27998a=_0x27998a||0x1f4;return function(_0x2f7e98){logger['error'](_0x2f7e98[_0x22d7('0x28')]);if(_0x2f7e98[_0x22d7('0x29')]){delete _0x2f7e98[_0x22d7('0x29')];}_0x1720f0[_0x22d7('0x1a')](_0x27998a)[_0x22d7('0x2a')](_0x2f7e98);};}exports['index']=function(_0x2606bd,_0x2ec96b){var _0x33c621={},_0x2c0b24={},_0x539ba0={'count':0x0,'rows':[]};var _0x1195bc=_[_0x22d7('0x2b')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x595796){return{'name':_0x595796[_0x22d7('0x2c')],'type':_0x595796[_0x22d7('0x2d')][_0x22d7('0x2e')]};});_0x2c0b24['model']=_[_0x22d7('0x2b')](_0x1195bc,'name');_0x2c0b24[_0x22d7('0x2f')]=_[_0x22d7('0x30')](_0x2606bd[_0x22d7('0x2f')]);_0x2c0b24[_0x22d7('0x31')]=_[_0x22d7('0x32')](_0x2c0b24[_0x22d7('0x33')],_0x2c0b24['query']);_0x33c621['attributes']=_[_0x22d7('0x32')](_0x2c0b24['model'],qs[_0x22d7('0x34')](_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x34')]));_0x33c621[_0x22d7('0x35')]=_0x33c621[_0x22d7('0x35')]['length']?_0x33c621['attributes']:_0x2c0b24[_0x22d7('0x33')];if(!_0x2606bd['query']['hasOwnProperty'](_0x22d7('0x36'))){_0x33c621['limit']=qs[_0x22d7('0x20')](_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x20')]);_0x33c621['offset']=qs[_0x22d7('0x1f')](_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x1f')]);}_0x33c621[_0x22d7('0x37')]=qs[_0x22d7('0x38')](_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x38')]);_0x33c621[_0x22d7('0x39')]=qs['filters'](_['pick'](_0x2606bd[_0x22d7('0x2f')],_0x2c0b24[_0x22d7('0x31')]),_0x1195bc);if(_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x3a')]){_0x33c621['where']=_[_0x22d7('0x3b')](_0x33c621['where'],{'$or':_['map'](_0x1195bc,function(_0x220824){if(_0x220824[_0x22d7('0x2d')]!==_0x22d7('0x3c')){var _0x431592={};_0x431592[_0x220824[_0x22d7('0x29')]]={'$like':'%'+_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x3a')]+'%'};return _0x431592;}})});}_0x33c621=_[_0x22d7('0x3b')]({},_0x33c621,_0x2606bd[_0x22d7('0x3d')]);var _0x61fab={'where':_0x33c621[_0x22d7('0x39')]};return db[_0x22d7('0x3e')][_0x22d7('0x1e')](_0x61fab)['then'](function(_0x3f2cdb){_0x539ba0[_0x22d7('0x1e')]=_0x3f2cdb;if(_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x3f')]){_0x33c621[_0x22d7('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x33c621);})[_0x22d7('0x26')](function(_0x123af1){_0x539ba0[_0x22d7('0x41')]=_0x123af1;return _0x539ba0;})[_0x22d7('0x26')](respondWithFilteredResult(_0x2ec96b,_0x33c621))['catch'](handleError(_0x2ec96b,null));};exports['show']=function(_0x336269,_0x4613b2){var _0x4d1da2={'raw':!![],'where':{'id':_0x336269[_0x22d7('0x42')]['id']}},_0x233852={};_0x233852[_0x22d7('0x33')]=_[_0x22d7('0x30')](db[_0x22d7('0x3e')]['rawAttributes']);_0x233852['query']=_['keys'](_0x336269[_0x22d7('0x2f')]);_0x233852[_0x22d7('0x31')]=_[_0x22d7('0x32')](_0x233852[_0x22d7('0x33')],_0x233852[_0x22d7('0x2f')]);_0x4d1da2[_0x22d7('0x35')]=_[_0x22d7('0x32')](_0x233852[_0x22d7('0x33')],qs['fields'](_0x336269[_0x22d7('0x2f')]['fields']));_0x4d1da2[_0x22d7('0x35')]=_0x4d1da2[_0x22d7('0x35')][_0x22d7('0x43')]?_0x4d1da2[_0x22d7('0x35')]:_0x233852['model'];if(_0x336269['query'][_0x22d7('0x3f')]){_0x4d1da2[_0x22d7('0x40')]=[{'all':!![]}];}_0x4d1da2=_[_0x22d7('0x3b')]({},_0x4d1da2,_0x336269[_0x22d7('0x3d')]);return db['JscriptyAnswerReport']['find'](_0x4d1da2)[_0x22d7('0x26')](handleEntityNotFound(_0x4613b2,null))['then'](respondWithResult(_0x4613b2,null))[_0x22d7('0x44')](handleError(_0x4613b2,null));};exports[_0x22d7('0x45')]=function(_0x5c0709,_0x36847f){return db[_0x22d7('0x3e')][_0x22d7('0x45')](_0x5c0709[_0x22d7('0x46')],{})[_0x22d7('0x26')](respondWithResult(_0x36847f,0xc9))['catch'](handleError(_0x36847f,null));};exports[_0x22d7('0x25')]=function(_0x3cae9c,_0x43edb0){if(_0x3cae9c[_0x22d7('0x46')]['id']){delete _0x3cae9c[_0x22d7('0x46')]['id'];}return db[_0x22d7('0x3e')][_0x22d7('0x47')]({'where':{'id':_0x3cae9c[_0x22d7('0x42')]['id']}})[_0x22d7('0x26')](handleEntityNotFound(_0x43edb0,null))[_0x22d7('0x26')](saveUpdates(_0x3cae9c[_0x22d7('0x46')],null))['then'](respondWithResult(_0x43edb0,null))[_0x22d7('0x44')](handleError(_0x43edb0,null));};exports[_0x22d7('0x27')]=function(_0xdc630a,_0x266978){return db[_0x22d7('0x3e')][_0x22d7('0x47')]({'where':{'id':_0xdc630a[_0x22d7('0x42')]['id']}})[_0x22d7('0x26')](handleEntityNotFound(_0x266978,null))[_0x22d7('0x26')](removeEntity(_0x266978,null))['catch'](handleError(_0x266978,null));};exports[_0x22d7('0x48')]=function(_0x1858cb,_0x243f2c){return db['JscriptyAnswerReport'][_0x22d7('0x48')]()['then'](respondWithResult(_0x243f2c,null))[_0x22d7('0x44')](handleError(_0x243f2c,null));}; \ No newline at end of file +var _0xcb66=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','end','name','send','index','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','find','create','body','catch','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0xcb66,0x19f));var _0x6cb6=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0xcb66[_0x350343];return _0x9afc1c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6cb6('0x0'));var zipdir=require(_0x6cb6('0x1'));var jsonpatch=require(_0x6cb6('0x2'));var rp=require(_0x6cb6('0x3'));var moment=require(_0x6cb6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6cb6('0x5'));var util=require(_0x6cb6('0x6'));var path=require(_0x6cb6('0x7'));var sox=require(_0x6cb6('0x8'));var csv=require(_0x6cb6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6cb6('0xa'));var squel=require(_0x6cb6('0xb'));var crypto=require(_0x6cb6('0xc'));var jsforce=require(_0x6cb6('0xd'));var deskjs=require(_0x6cb6('0xe'));var toCsv=require(_0x6cb6('0x9'));var querystring=require(_0x6cb6('0xf'));var Papa=require(_0x6cb6('0x10'));var Redis=require(_0x6cb6('0x11'));var authService=require(_0x6cb6('0x12'));var qs=require(_0x6cb6('0x13'));var as=require(_0x6cb6('0x14'));var hardwareService=require(_0x6cb6('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6cb6('0x16'));var db=require(_0x6cb6('0x17'))['db'];function respondWithStatusCode(_0xad49d9,_0x2604e7){_0x2604e7=_0x2604e7||0xcc;return function(_0x585233){if(_0x585233){return _0xad49d9[_0x6cb6('0x18')](_0x2604e7);}return _0xad49d9[_0x6cb6('0x19')](_0x2604e7)['end']();};}function respondWithResult(_0x1e5468,_0x14a581){_0x14a581=_0x14a581||0xc8;return function(_0x5af476){if(_0x5af476){return _0x1e5468[_0x6cb6('0x19')](_0x14a581)[_0x6cb6('0x1a')](_0x5af476);}};}function respondWithFilteredResult(_0x492629,_0x5ab865){return function(_0x505b4d){if(_0x505b4d){var _0x5dd4cd=typeof _0x5ab865[_0x6cb6('0x1b')]===_0x6cb6('0x1c')&&typeof _0x5ab865[_0x6cb6('0x1d')]===_0x6cb6('0x1c');var _0x432e48=_0x505b4d[_0x6cb6('0x1e')];var _0x5b8a17=_0x5dd4cd?0x0:_0x5ab865[_0x6cb6('0x1b')];var _0xc0bdea=_0x5dd4cd?_0x505b4d['count']:_0x5ab865['offset']+_0x5ab865['limit'];var _0x5b5dab;if(_0xc0bdea>=_0x432e48){_0xc0bdea=_0x432e48;_0x5b5dab=0xc8;}else{_0x5b5dab=0xce;}_0x492629['status'](_0x5b5dab);return _0x492629['set'](_0x6cb6('0x1f'),_0x5b8a17+'-'+_0xc0bdea+'/'+_0x432e48)[_0x6cb6('0x1a')](_0x505b4d);}return null;};}function patchUpdates(_0x407455){return function(_0x2d41c4){try{jsonpatch[_0x6cb6('0x20')](_0x2d41c4,_0x407455,!![]);}catch(_0x5e14c8){return BPromise['reject'](_0x5e14c8);}return _0x2d41c4[_0x6cb6('0x21')]();};}function saveUpdates(_0x1d35d1,_0x1c4bcd){return function(_0x153915){if(_0x153915){return _0x153915['update'](_0x1d35d1)[_0x6cb6('0x22')](function(_0x19837e){return _0x19837e;});}return null;};}function removeEntity(_0x58a6ed,_0x5ad4f2){return function(_0xea5ee5){if(_0xea5ee5){return _0xea5ee5['destroy']()[_0x6cb6('0x22')](function(){_0x58a6ed[_0x6cb6('0x19')](0xcc)[_0x6cb6('0x23')]();});}};}function handleEntityNotFound(_0x18ecb9,_0x299830){return function(_0x16db1d){if(!_0x16db1d){_0x18ecb9[_0x6cb6('0x18')](0x194);}return _0x16db1d;};}function handleError(_0xcae6af,_0x1cc1ed){_0x1cc1ed=_0x1cc1ed||0x1f4;return function(_0x112e47){logger['error'](_0x112e47['stack']);if(_0x112e47['name']){delete _0x112e47[_0x6cb6('0x24')];}_0xcae6af[_0x6cb6('0x19')](_0x1cc1ed)[_0x6cb6('0x25')](_0x112e47);};}exports[_0x6cb6('0x26')]=function(_0x1f8c9d,_0x3b62e6){var _0x57cd74={},_0x124291={},_0x4d4ad9={'count':0x0,'rows':[]};var _0x2b2c4b=_['map'](db[_0x6cb6('0x27')][_0x6cb6('0x28')],function(_0x32c373){return{'name':_0x32c373['fieldName'],'type':_0x32c373[_0x6cb6('0x29')][_0x6cb6('0x2a')]};});_0x124291[_0x6cb6('0x2b')]=_['map'](_0x2b2c4b,_0x6cb6('0x24'));_0x124291[_0x6cb6('0x2c')]=_[_0x6cb6('0x2d')](_0x1f8c9d['query']);_0x124291[_0x6cb6('0x2e')]=_[_0x6cb6('0x2f')](_0x124291['model'],_0x124291[_0x6cb6('0x2c')]);_0x57cd74[_0x6cb6('0x30')]=_[_0x6cb6('0x2f')](_0x124291[_0x6cb6('0x2b')],qs[_0x6cb6('0x31')](_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x31')]));_0x57cd74[_0x6cb6('0x30')]=_0x57cd74[_0x6cb6('0x30')][_0x6cb6('0x32')]?_0x57cd74['attributes']:_0x124291[_0x6cb6('0x2b')];if(!_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x33')](_0x6cb6('0x34'))){_0x57cd74['limit']=qs['limit'](_0x1f8c9d['query'][_0x6cb6('0x1d')]);_0x57cd74[_0x6cb6('0x1b')]=qs[_0x6cb6('0x1b')](_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x1b')]);}_0x57cd74[_0x6cb6('0x35')]=qs[_0x6cb6('0x36')](_0x1f8c9d[_0x6cb6('0x2c')]['sort']);_0x57cd74[_0x6cb6('0x37')]=qs['filters'](_[_0x6cb6('0x38')](_0x1f8c9d[_0x6cb6('0x2c')],_0x124291[_0x6cb6('0x2e')]),_0x2b2c4b);if(_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x39')]){_0x57cd74[_0x6cb6('0x37')]=_[_0x6cb6('0x3a')](_0x57cd74['where'],{'$or':_[_0x6cb6('0x3b')](_0x2b2c4b,function(_0x58a304){if(_0x58a304[_0x6cb6('0x29')]!==_0x6cb6('0x3c')){var _0x3bb13d={};_0x3bb13d[_0x58a304['name']]={'$like':'%'+_0x1f8c9d['query'][_0x6cb6('0x39')]+'%'};return _0x3bb13d;}})});}_0x57cd74=_['merge']({},_0x57cd74,_0x1f8c9d[_0x6cb6('0x3d')]);var _0x296a3b={'where':_0x57cd74[_0x6cb6('0x37')]};return db[_0x6cb6('0x27')][_0x6cb6('0x1e')](_0x296a3b)[_0x6cb6('0x22')](function(_0x3652ca){_0x4d4ad9['count']=_0x3652ca;if(_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x3e')]){_0x57cd74['include']=[{'all':!![]}];}return db[_0x6cb6('0x27')][_0x6cb6('0x3f')](_0x57cd74);})[_0x6cb6('0x22')](function(_0x31a391){_0x4d4ad9[_0x6cb6('0x40')]=_0x31a391;return _0x4d4ad9;})[_0x6cb6('0x22')](respondWithFilteredResult(_0x3b62e6,_0x57cd74))['catch'](handleError(_0x3b62e6,null));};exports['show']=function(_0x1f4e94,_0x5d3770){var _0x588ea4={'raw':!![],'where':{'id':_0x1f4e94['params']['id']}},_0x605673={};_0x605673[_0x6cb6('0x2b')]=_[_0x6cb6('0x2d')](db['JscriptyAnswerReport']['rawAttributes']);_0x605673[_0x6cb6('0x2c')]=_['keys'](_0x1f4e94[_0x6cb6('0x2c')]);_0x605673[_0x6cb6('0x2e')]=_['intersection'](_0x605673[_0x6cb6('0x2b')],_0x605673[_0x6cb6('0x2c')]);_0x588ea4['attributes']=_[_0x6cb6('0x2f')](_0x605673['model'],qs[_0x6cb6('0x31')](_0x1f4e94[_0x6cb6('0x2c')]['fields']));_0x588ea4[_0x6cb6('0x30')]=_0x588ea4[_0x6cb6('0x30')]['length']?_0x588ea4['attributes']:_0x605673[_0x6cb6('0x2b')];if(_0x1f4e94[_0x6cb6('0x2c')][_0x6cb6('0x3e')]){_0x588ea4['include']=[{'all':!![]}];}_0x588ea4=_[_0x6cb6('0x3a')]({},_0x588ea4,_0x1f4e94[_0x6cb6('0x3d')]);return db['JscriptyAnswerReport'][_0x6cb6('0x41')](_0x588ea4)[_0x6cb6('0x22')](handleEntityNotFound(_0x5d3770,null))[_0x6cb6('0x22')](respondWithResult(_0x5d3770,null))['catch'](handleError(_0x5d3770,null));};exports[_0x6cb6('0x42')]=function(_0x4444a4,_0x42dc72){return db[_0x6cb6('0x27')][_0x6cb6('0x42')](_0x4444a4[_0x6cb6('0x43')],{})['then'](respondWithResult(_0x42dc72,0xc9))[_0x6cb6('0x44')](handleError(_0x42dc72,null));};exports['update']=function(_0x4c3a3a,_0x29cb39){if(_0x4c3a3a[_0x6cb6('0x43')]['id']){delete _0x4c3a3a['body']['id'];}return db[_0x6cb6('0x27')]['find']({'where':{'id':_0x4c3a3a[_0x6cb6('0x45')]['id']}})[_0x6cb6('0x22')](handleEntityNotFound(_0x29cb39,null))[_0x6cb6('0x22')](saveUpdates(_0x4c3a3a['body'],null))[_0x6cb6('0x22')](respondWithResult(_0x29cb39,null))[_0x6cb6('0x44')](handleError(_0x29cb39,null));};exports[_0x6cb6('0x46')]=function(_0x567d52,_0x2668a3){return db['JscriptyAnswerReport'][_0x6cb6('0x41')]({'where':{'id':_0x567d52[_0x6cb6('0x45')]['id']}})[_0x6cb6('0x22')](handleEntityNotFound(_0x2668a3,null))['then'](removeEntity(_0x2668a3,null))['catch'](handleError(_0x2668a3,null));};exports[_0x6cb6('0x47')]=function(_0x3dca6c,_0x1d12da){return db['JscriptyAnswerReport'][_0x6cb6('0x47')]()[_0x6cb6('0x22')](respondWithResult(_0x1d12da,null))[_0x6cb6('0x44')](handleError(_0x1d12da,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index bc1647f..9e34f65 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 _0xda9e=['api','bluebird','path','rimraf','../../config/environment','exports','define','util','../../config/logger'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0xda9e,0xd6));var _0xeda9=function(_0x175f6f,_0x1a4a05){_0x175f6f=_0x175f6f-0x0;var _0x1aa501=_0xda9e[_0x175f6f];return _0x1aa501;};'use strict';var _=require('lodash');var util=require(_0xeda9('0x0'));var logger=require(_0xeda9('0x1'))(_0xeda9('0x2'));var moment=require('moment');var BPromise=require(_0xeda9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeda9('0x4'));var rimraf=require(_0xeda9('0x5'));var config=require(_0xeda9('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xeda9('0x7')]=function(_0x4872a0,_0x1aeac6){return _0x4872a0[_0xeda9('0x8')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9af=['bluebird','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x560baf,_0x574319){var _0xbdd6e2=function(_0x1ece6d){while(--_0x1ece6d){_0x560baf['push'](_0x560baf['shift']());}};_0xbdd6e2(++_0x574319);}(_0xc9af,0x163));var _0xfc9a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc9af[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xfc9a('0x0'));var util=require(_0xfc9a('0x1'));var logger=require(_0xfc9a('0x2'))(_0xfc9a('0x3'));var moment=require(_0xfc9a('0x4'));var BPromise=require(_0xfc9a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc9a('0x6'));var config=require(_0xfc9a('0x7'));var attributes=require(_0xfc9a('0x8'));module[_0xfc9a('0x9')]=function(_0x42ba33,_0x26cb3d){return _0x42ba33[_0xfc9a('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0xfc9a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index f6862af..f314cab 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 _0x8020=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment'];(function(_0x2c65c6,_0x4621c5){var _0x4f76f6=function(_0x4d8e91){while(--_0x4d8e91){_0x2c65c6['push'](_0x2c65c6['shift']());}};_0x4f76f6(++_0x4621c5);}(_0x8020,0x152));var _0x0802=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8020[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x0802('0x0'));var util=require('util');var moment=require(_0x0802('0x1'));var BPromise=require(_0x0802('0x2'));var rs=require(_0x0802('0x3'));var fs=require('fs');var Redis=require(_0x0802('0x4'));var db=require(_0x0802('0x5'))['db'];var utils=require(_0x0802('0x6'));var logger=require('../../config/logger')(_0x0802('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0802('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x498af5,_0x416ef7,_0x2dc9cd){return new BPromise(function(_0x5baad1,_0x189d98){return client['request'](_0x498af5,_0x2dc9cd)[_0x0802('0x9')](function(_0x41de6d){logger['info'](_0x0802('0xa'),_0x416ef7,_0x0802('0xb'));logger[_0x0802('0xc')](_0x0802('0xd'),_0x416ef7,'request\x20sent',JSON['stringify'](_0x41de6d));if(_0x41de6d[_0x0802('0xe')]){if(_0x41de6d[_0x0802('0xe')][_0x0802('0xf')]===0x1f4){logger[_0x0802('0xe')](_0x0802('0xa'),_0x416ef7,_0x41de6d[_0x0802('0xe')]['message']);return _0x189d98(_0x41de6d[_0x0802('0xe')][_0x0802('0x10')]);}logger['error'](_0x0802('0xa'),_0x416ef7,_0x41de6d[_0x0802('0xe')][_0x0802('0x10')]);return _0x5baad1(_0x41de6d[_0x0802('0xe')][_0x0802('0x10')]);}else{logger[_0x0802('0x11')](_0x0802('0xa'),_0x416ef7,_0x0802('0xb'));_0x5baad1(_0x41de6d[_0x0802('0x12')]['message']);}})[_0x0802('0x13')](function(_0x567037){logger['error'](_0x0802('0xa'),_0x416ef7,_0x567037);_0x189d98(_0x567037);});});} \ No newline at end of file +var _0xb291=['JscriptyAnswerReport,\x20%s,\x20%s','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','stringify','error','message'];(function(_0x228d7c,_0xf01e7d){var _0x1ffa97=function(_0x5418dd){while(--_0x5418dd){_0x228d7c['push'](_0x228d7c['shift']());}};_0x1ffa97(++_0xf01e7d);}(_0xb291,0xde));var _0x1b29=function(_0x1c8ce3,_0x3bab0f){_0x1c8ce3=_0x1c8ce3-0x0;var _0x417035=_0xb291[_0x1c8ce3];return _0x417035;};'use strict';var _=require(_0x1b29('0x0'));var util=require(_0x1b29('0x1'));var moment=require('moment');var BPromise=require(_0x1b29('0x2'));var rs=require(_0x1b29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b29('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b29('0x5'))(_0x1b29('0x6'));var config=require(_0x1b29('0x7'));var jayson=require(_0x1b29('0x8'));var client=jayson[_0x1b29('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4647a3,_0x5e24cd,_0x4e2440){return new BPromise(function(_0x3bc6ae,_0x2eeac4){return client['request'](_0x4647a3,_0x4e2440)['then'](function(_0x2a2779){logger[_0x1b29('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5e24cd,_0x1b29('0xb'));logger[_0x1b29('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5e24cd,_0x1b29('0xb'),JSON[_0x1b29('0xd')](_0x2a2779));if(_0x2a2779[_0x1b29('0xe')]){if(_0x2a2779['error']['code']===0x1f4){logger[_0x1b29('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5e24cd,_0x2a2779[_0x1b29('0xe')][_0x1b29('0xf')]);return _0x2eeac4(_0x2a2779[_0x1b29('0xe')][_0x1b29('0xf')]);}logger[_0x1b29('0xe')](_0x1b29('0x10'),_0x5e24cd,_0x2a2779['error'][_0x1b29('0xf')]);return _0x3bc6ae(_0x2a2779[_0x1b29('0xe')]['message']);}else{logger[_0x1b29('0xa')](_0x1b29('0x10'),_0x5e24cd,_0x1b29('0xb'));_0x3bc6ae(_0x2a2779['result'][_0x1b29('0xf')]);}})['catch'](function(_0x1cf9c0){logger['error'](_0x1b29('0x10'),_0x5e24cd,_0x1cf9c0);_0x2eeac4(_0x1cf9c0);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 3a16f2e..3d95766 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 _0xa8c8=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','/:id/summary','getSummary','post','create','/:id/clone','clone','put'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xa8c8,0xc1));var _0x8a8c=function(_0x5313c9,_0x566343){_0x5313c9=_0x5313c9-0x0;var _0xe509a1=_0xa8c8[_0x5313c9];return _0xe509a1;};'use strict';var multer=require('multer');var util=require(_0x8a8c('0x0'));var path=require('path');var timeout=require(_0x8a8c('0x1'));var express=require(_0x8a8c('0x2'));var router=express[_0x8a8c('0x3')]();var fs_extra=require(_0x8a8c('0x4'));var auth=require(_0x8a8c('0x5'));var interaction=require(_0x8a8c('0x6'));var config=require(_0x8a8c('0x7'));var controller=require(_0x8a8c('0x8'));router[_0x8a8c('0x9')]('/',auth[_0x8a8c('0xa')](),controller[_0x8a8c('0xb')]);router[_0x8a8c('0x9')](_0x8a8c('0xc'),auth[_0x8a8c('0xa')](),controller['show']);router['get'](_0x8a8c('0xd'),auth[_0x8a8c('0xa')](),controller[_0x8a8c('0xe')]);router[_0x8a8c('0x9')](_0x8a8c('0xf'),auth[_0x8a8c('0xa')](),controller['getAnswers']);router[_0x8a8c('0x9')](_0x8a8c('0x10'),auth[_0x8a8c('0xa')](),timeout('30s'),controller[_0x8a8c('0x11')]);router[_0x8a8c('0x12')]('/',auth[_0x8a8c('0xa')](),controller[_0x8a8c('0x13')]);router[_0x8a8c('0x12')](_0x8a8c('0x14'),auth[_0x8a8c('0xa')](),controller[_0x8a8c('0x15')]);router[_0x8a8c('0x16')](_0x8a8c('0xc'),auth[_0x8a8c('0xa')](),controller['update']);router['delete']('/:id',auth[_0x8a8c('0xa')](),controller['destroy']);module[_0x8a8c('0x17')]=router; \ No newline at end of file +var _0x01f7=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','update','delete','destroy','exports','multer'];(function(_0x3c5a6d,_0x21c507){var _0x33fe8e=function(_0x327cf7){while(--_0x327cf7){_0x3c5a6d['push'](_0x3c5a6d['shift']());}};_0x33fe8e(++_0x21c507);}(_0x01f7,0xae));var _0x701f=function(_0x373f3c,_0x44e12b){_0x373f3c=_0x373f3c-0x0;var _0x555326=_0x01f7[_0x373f3c];return _0x555326;};'use strict';var multer=require(_0x701f('0x0'));var util=require('util');var path=require(_0x701f('0x1'));var timeout=require(_0x701f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x701f('0x3'));var auth=require(_0x701f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x701f('0x5'));var controller=require('./jscriptyProject.controller');router[_0x701f('0x6')]('/',auth['isAuthenticated'](),controller[_0x701f('0x7')]);router[_0x701f('0x6')](_0x701f('0x8'),auth[_0x701f('0x9')](),controller[_0x701f('0xa')]);router[_0x701f('0x6')](_0x701f('0xb'),auth[_0x701f('0x9')](),controller[_0x701f('0xc')]);router[_0x701f('0x6')]('/:id/answers',auth[_0x701f('0x9')](),controller[_0x701f('0xd')]);router['get'](_0x701f('0xe'),auth['isAuthenticated'](),timeout(_0x701f('0xf')),controller[_0x701f('0x10')]);router[_0x701f('0x11')]('/',auth[_0x701f('0x9')](),controller[_0x701f('0x12')]);router[_0x701f('0x11')](_0x701f('0x13'),auth[_0x701f('0x9')](),controller[_0x701f('0x14')]);router['put'](_0x701f('0x8'),auth[_0x701f('0x9')](),controller[_0x701f('0x15')]);router[_0x701f('0x16')](_0x701f('0x8'),auth[_0x701f('0x9')](),controller[_0x701f('0x17')]);module[_0x701f('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index bce5215..d710518 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 _0x3d05=['setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','isObjectLike'];(function(_0x471178,_0x1f554c){var _0xd0d30a=function(_0xe23c1b){while(--_0xe23c1b){_0x471178['push'](_0x471178['shift']());}};_0xd0d30a(++_0x1f554c);}(_0x3d05,0x16e));var _0x53d0=function(_0x561049,_0x330926){_0x561049=_0x561049-0x0;var _0x52f109=_0x3d05[_0x561049];return _0x52f109;};'use strict';var Sequelize=require(_0x53d0('0x0'));var _=require(_0x53d0('0x1'));var util=require(_0x53d0('0x2'));module[_0x53d0('0x3')]={'name':{'type':Sequelize[_0x53d0('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x53d0('0x4')]},'formData':{'type':Sequelize[_0x53d0('0x5')](_0x53d0('0x6')),'set':function(_0x19d572){if(_[_0x53d0('0x7')](_0x19d572)){this[_0x53d0('0x8')]('formData',JSON[_0x53d0('0x9')](_0x19d572));}else if(_[_0x53d0('0xa')](_0x19d572)){this[_0x53d0('0x8')]('formData',_0x19d572);}else{this[_0x53d0('0x8')](_0x53d0('0xb'),util[_0x53d0('0xc')](_0x53d0('0xd'),this[_0x53d0('0xe')]('name')||'',this['getDataValue'](_0x53d0('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x53d0('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0xf862=['sequelize','lodash','exports','STRING','name','TEXT','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xf862,0x1c0));var _0x2f86=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0xf862[_0x46c1d5];return _0x40fe7b;};'use strict';var Sequelize=require(_0x2f86('0x0'));var _=require(_0x2f86('0x1'));var util=require('util');module[_0x2f86('0x2')]={'name':{'type':Sequelize[_0x2f86('0x3')],'unique':_0x2f86('0x4')},'description':{'type':Sequelize[_0x2f86('0x3')]},'formData':{'type':Sequelize[_0x2f86('0x5')]('long'),'set':function(_0x39d65c){if(_[_0x2f86('0x6')](_0x39d65c)){this[_0x2f86('0x7')]('formData',JSON[_0x2f86('0x8')](_0x39d65c));}else if(_[_0x2f86('0x9')](_0x39d65c)){this[_0x2f86('0x7')](_0x2f86('0xa'),_0x39d65c);}else{this[_0x2f86('0x7')]('formData',util[_0x2f86('0xb')](_0x2f86('0xc'),this['getDataValue'](_0x2f86('0x4'))||'',this[_0x2f86('0xd')](_0x2f86('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2f86('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index e46b3e4..041076e 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 _0xceab=['indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','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','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','get','Projects','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','JscriptyProject','includeAll','include','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','clone','omit','createdAt','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','options','findAll','rows','getAnswers','JscriptyAnswerReport','toString'];(function(_0x44cbe1,_0x57188d){var _0x213803=function(_0x3134e8){while(--_0x3134e8){_0x44cbe1['push'](_0x44cbe1['shift']());}};_0x213803(++_0x57188d);}(_0xceab,0x106));var _0xbcea=function(_0x4fc20f,_0x42ee8f){_0x4fc20f=_0x4fc20f-0x0;var _0x21f433=_0xceab[_0x4fc20f];return _0x21f433;};'use strict';var emlformat=require(_0xbcea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcea('0x1'));var jsonpatch=require(_0xbcea('0x2'));var rp=require('request-promise');var moment=require(_0xbcea('0x3'));var BPromise=require(_0xbcea('0x4'));var Mustache=require('mustache');var util=require(_0xbcea('0x5'));var path=require(_0xbcea('0x6'));var sox=require('sox');var csv=require(_0xbcea('0x7'));var ejs=require(_0xbcea('0x8'));var fs=require('fs');var fs_extra=require(_0xbcea('0x9'));var _=require(_0xbcea('0xa'));var squel=require(_0xbcea('0xb'));var crypto=require('crypto');var jsforce=require(_0xbcea('0xc'));var deskjs=require(_0xbcea('0xd'));var toCsv=require(_0xbcea('0x7'));var querystring=require(_0xbcea('0xe'));var Papa=require(_0xbcea('0xf'));var Redis=require('ioredis');var authService=require(_0xbcea('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbcea('0x11'));var hardwareService=require(_0xbcea('0x12'));var logger=require(_0xbcea('0x13'))(_0xbcea('0x14'));var utils=require(_0xbcea('0x15'));var config=require(_0xbcea('0x16'));var licenseUtil=require(_0xbcea('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24822a,_0x365160){_0x365160=_0x365160||0xcc;return function(_0x39dde5){if(_0x39dde5){return _0x24822a['sendStatus'](_0x365160);}return _0x24822a[_0xbcea('0x18')](_0x365160)['end']();};}function respondWithResult(_0x47b444,_0xd2be3c){_0xd2be3c=_0xd2be3c||0xc8;return function(_0x3ae03e){if(_0x3ae03e){return _0x47b444[_0xbcea('0x18')](_0xd2be3c)[_0xbcea('0x19')](_0x3ae03e);}};}function respondWithFilteredResult(_0x419364,_0x326814){return function(_0x4f205f){if(_0x4f205f){var _0x407cda=typeof _0x326814['offset']==='undefined'&&typeof _0x326814['limit']===_0xbcea('0x1a');var _0x1487d8=_0x4f205f['count'];var _0x3d68f0=_0x407cda?0x0:_0x326814[_0xbcea('0x1b')];var _0x356754=_0x407cda?_0x4f205f[_0xbcea('0x1c')]:_0x326814[_0xbcea('0x1b')]+_0x326814[_0xbcea('0x1d')];var _0x3466bb;if(_0x356754>=_0x1487d8){_0x356754=_0x1487d8;_0x3466bb=0xc8;}else{_0x3466bb=0xce;}_0x419364[_0xbcea('0x18')](_0x3466bb);return _0x419364[_0xbcea('0x1e')](_0xbcea('0x1f'),_0x3d68f0+'-'+_0x356754+'/'+_0x1487d8)[_0xbcea('0x19')](_0x4f205f);}return null;};}function patchUpdates(_0x4bae81){return function(_0x2f133b){try{jsonpatch[_0xbcea('0x20')](_0x2f133b,_0x4bae81,!![]);}catch(_0x5c3c29){return BPromise[_0xbcea('0x21')](_0x5c3c29);}return _0x2f133b[_0xbcea('0x22')]();};}function saveUpdates(_0x4350a8,_0x3eb213){return function(_0x4cb14f){if(_0x4cb14f){return _0x4cb14f['update'](_0x4350a8)[_0xbcea('0x23')](function(_0x2465bc){return _0x2465bc;});}return null;};}function removeEntity(_0x805c0,_0x56f7fb){return function(_0xb58516){if(_0xb58516){return _0xb58516['destroy']()['then'](function(){var _0x5f1f1e=_0xb58516[_0xbcea('0x24')]({'plain':!![]});var _0x17aeac=_0xbcea('0x25');return db[_0xbcea('0x26')][_0xbcea('0x27')]({'where':{'type':_0x17aeac,'resourceId':_0x5f1f1e['id']}})[_0xbcea('0x23')](function(){return _0xb58516;});})[_0xbcea('0x23')](function(){_0x805c0[_0xbcea('0x18')](0xcc)[_0xbcea('0x28')]();});}};}function handleEntityNotFound(_0x4eeb4c,_0x11cf9f){return function(_0x2df4d6){if(!_0x2df4d6){_0x4eeb4c[_0xbcea('0x29')](0x194);}return _0x2df4d6;};}function handleError(_0x53f9a0,_0x4e956f){_0x4e956f=_0x4e956f||0x1f4;return function(_0x2358e8){logger[_0xbcea('0x2a')](_0x2358e8[_0xbcea('0x2b')]);if(_0x2358e8['name']){delete _0x2358e8[_0xbcea('0x2c')];}_0x53f9a0[_0xbcea('0x18')](_0x4e956f)[_0xbcea('0x2d')](_0x2358e8);};}exports[_0xbcea('0x2e')]=function(_0x1393a5,_0x2a7468){var _0x2ddaee={},_0x32d3cd={},_0x34ccdc={'count':0x0,'rows':[]};var _0x3abfae=_['map'](db['JscriptyProject'][_0xbcea('0x2f')],function(_0x266ca5){return{'name':_0x266ca5[_0xbcea('0x30')],'type':_0x266ca5[_0xbcea('0x31')][_0xbcea('0x32')]};});_0x32d3cd[_0xbcea('0x33')]=_['map'](_0x3abfae,'name');_0x32d3cd['query']=_[_0xbcea('0x34')](_0x1393a5[_0xbcea('0x35')]);_0x32d3cd[_0xbcea('0x36')]=_[_0xbcea('0x37')](_0x32d3cd[_0xbcea('0x33')],_0x32d3cd[_0xbcea('0x35')]);_0x2ddaee[_0xbcea('0x38')]=_[_0xbcea('0x37')](_0x32d3cd['model'],qs['fields'](_0x1393a5['query'][_0xbcea('0x39')]));_0x2ddaee['attributes']=_0x2ddaee[_0xbcea('0x38')]['length']?_0x2ddaee['attributes']:_0x32d3cd[_0xbcea('0x33')];if(!_0x1393a5[_0xbcea('0x35')]['hasOwnProperty'](_0xbcea('0x3a'))){_0x2ddaee[_0xbcea('0x1d')]=qs[_0xbcea('0x1d')](_0x1393a5['query'][_0xbcea('0x1d')]);_0x2ddaee['offset']=qs[_0xbcea('0x1b')](_0x1393a5[_0xbcea('0x35')][_0xbcea('0x1b')]);}_0x2ddaee[_0xbcea('0x3b')]=qs[_0xbcea('0x3c')](_0x1393a5[_0xbcea('0x35')][_0xbcea('0x3c')]);_0x2ddaee['where']=qs['filters'](_[_0xbcea('0x3d')](_0x1393a5['query'],_0x32d3cd[_0xbcea('0x36')]),_0x3abfae);if(_0x1393a5['query'][_0xbcea('0x3e')]){_0x2ddaee[_0xbcea('0x3f')]=_[_0xbcea('0x40')](_0x2ddaee[_0xbcea('0x3f')],{'$or':_[_0xbcea('0x41')](_0x3abfae,function(_0x169136){if(_0x169136['type']!==_0xbcea('0x42')){var _0x232ea4={};_0x232ea4[_0x169136[_0xbcea('0x2c')]]={'$like':'%'+_0x1393a5[_0xbcea('0x35')]['filter']+'%'};return _0x232ea4;}})});}_0x2ddaee=_[_0xbcea('0x40')]({},_0x2ddaee,_0x1393a5['options']);var _0x12d0ba={'where':_0x2ddaee[_0xbcea('0x3f')]};return db[_0xbcea('0x43')]['count'](_0x12d0ba)[_0xbcea('0x23')](function(_0x4ba3eb){_0x34ccdc[_0xbcea('0x1c')]=_0x4ba3eb;if(_0x1393a5[_0xbcea('0x35')][_0xbcea('0x44')]){_0x2ddaee[_0xbcea('0x45')]=[{'all':!![]}];}return db[_0xbcea('0x43')]['findAll'](_0x2ddaee);})['then'](function(_0x3f5b33){_0x34ccdc['rows']=_0x3f5b33;return _0x34ccdc;})[_0xbcea('0x23')](respondWithFilteredResult(_0x2a7468,_0x2ddaee))[_0xbcea('0x46')](handleError(_0x2a7468,null));};exports[_0xbcea('0x47')]=function(_0x31bab8,_0x274299){var _0x31a1bc={'raw':![],'where':{'id':_0x31bab8[_0xbcea('0x48')]['id']}},_0x1f5680={};_0x1f5680[_0xbcea('0x33')]=_[_0xbcea('0x34')](db[_0xbcea('0x43')][_0xbcea('0x2f')]);_0x1f5680[_0xbcea('0x35')]=_['keys'](_0x31bab8['query']);_0x1f5680[_0xbcea('0x36')]=_[_0xbcea('0x37')](_0x1f5680[_0xbcea('0x33')],_0x1f5680[_0xbcea('0x35')]);_0x31a1bc[_0xbcea('0x38')]=_[_0xbcea('0x37')](_0x1f5680[_0xbcea('0x33')],qs[_0xbcea('0x39')](_0x31bab8[_0xbcea('0x35')][_0xbcea('0x39')]));_0x31a1bc[_0xbcea('0x38')]=_0x31a1bc[_0xbcea('0x38')][_0xbcea('0x49')]?_0x31a1bc[_0xbcea('0x38')]:_0x1f5680[_0xbcea('0x33')];if(_0x31bab8['query'][_0xbcea('0x44')]){_0x31a1bc[_0xbcea('0x45')]=[{'all':!![]}];}_0x31a1bc=_['merge']({},_0x31a1bc,_0x31bab8['options']);return db[_0xbcea('0x43')][_0xbcea('0x4a')](_0x31a1bc)['then'](handleEntityNotFound(_0x274299,null))[_0xbcea('0x23')](respondWithResult(_0x274299,null))[_0xbcea('0x46')](handleError(_0x274299,null));};exports['create']=function(_0x3f83f1,_0x4bcce3){return db[_0xbcea('0x43')][_0xbcea('0x4b')](_0x3f83f1[_0xbcea('0x4c')],{})[_0xbcea('0x23')](function(_0x464c66){var _0x5cb081=_0x3f83f1['user'][_0xbcea('0x24')]({'plain':!![]});if(!_0x5cb081)throw new Error(_0xbcea('0x4d'));if(_0x5cb081['role']===_0xbcea('0x4e')){var _0x5ec50a=_0x464c66[_0xbcea('0x24')]({'plain':!![]});var _0x3ee0bd=_0xbcea('0x25');return db[_0xbcea('0x4f')][_0xbcea('0x4a')]({'where':{'name':_0x3ee0bd,'userProfileId':_0x5cb081['userProfileId']},'raw':!![]})['then'](function(_0x259262){if(_0x259262&&_0x259262[_0xbcea('0x50')]===0x0){return db['UserProfileResource'][_0xbcea('0x4b')]({'name':_0x5ec50a[_0xbcea('0x2c')],'resourceId':_0x5ec50a['id'],'type':_0x259262[_0xbcea('0x2c')],'sectionId':_0x259262['id']},{})[_0xbcea('0x23')](function(){return _0x464c66;});}else{return _0x464c66;}})[_0xbcea('0x46')](function(_0x41569b){logger[_0xbcea('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41569b);throw _0x41569b;});}return _0x464c66;})[_0xbcea('0x23')](respondWithResult(_0x4bcce3,0xc9))['catch'](handleError(_0x4bcce3,null));};exports[_0xbcea('0x51')]=function(_0x2637c1,_0x50dcc3){var _0x43a5da={'where':{'id':_0x2637c1[_0xbcea('0x48')]['id']}},_0x305545={};_0x305545[_0xbcea('0x33')]=_[_0xbcea('0x34')](db[_0xbcea('0x43')]['rawAttributes']);_0x43a5da[_0xbcea('0x38')]=_[_0xbcea('0x37')](_0x305545['model'],qs[_0xbcea('0x39')](_0x2637c1[_0xbcea('0x35')]['fields']));_0x43a5da[_0xbcea('0x38')]=_0x43a5da['attributes'][_0xbcea('0x49')]?_0x43a5da[_0xbcea('0x38')]:_0x305545[_0xbcea('0x33')];if(_0x2637c1[_0xbcea('0x35')][_0xbcea('0x44')]){_0x43a5da[_0xbcea('0x45')]=[{'all':!![]}];}_0x43a5da=_[_0xbcea('0x40')]({},_0x43a5da,_0x2637c1['options']);return db['JscriptyProject'][_0xbcea('0x4a')](_0x43a5da)[_0xbcea('0x23')](handleEntityNotFound(_0x50dcc3,null))[_0xbcea('0x23')](function(_0x19c645){if(_0x19c645){var _0x5c8c7d=_0x19c645[_0xbcea('0x24')]({'plain':!![]});_0x5c8c7d=qs[_0xbcea('0x52')](_0x5c8c7d,['id',_0xbcea('0x53'),'updatedAt']);_0x2637c1['body']=_[_0xbcea('0x52')](_0x2637c1[_0xbcea('0x4c')],['id',_0xbcea('0x53'),_0xbcea('0x54')]);return db[_0xbcea('0x43')][_0xbcea('0x4b')](_[_0xbcea('0x40')](_0x5c8c7d,_0x2637c1[_0xbcea('0x4c')]),{'include':_0x2637c1[_0xbcea('0x35')][_0xbcea('0x44')]?[{'all':!![]}]:undefined})[_0xbcea('0x23')](function(_0x394c86){var _0x159b95=_0x2637c1['user']['get']({'plain':!![]});if(!_0x159b95)throw new Error(_0xbcea('0x4d'));if(_0x159b95[_0xbcea('0x55')]==='user'){var _0x4e6973=_0x394c86[_0xbcea('0x24')]({'plain':!![]});var _0x260b57=_0xbcea('0x25');return db[_0xbcea('0x4f')][_0xbcea('0x4a')]({'where':{'name':_0x260b57,'userProfileId':_0x159b95['userProfileId']},'raw':!![]})[_0xbcea('0x23')](function(_0x1731e9){if(_0x1731e9&&_0x1731e9[_0xbcea('0x50')]===0x0){return db[_0xbcea('0x26')][_0xbcea('0x4b')]({'name':_0x4e6973[_0xbcea('0x2c')],'resourceId':_0x4e6973['id'],'type':_0x1731e9[_0xbcea('0x2c')],'sectionId':_0x1731e9['id']},{})[_0xbcea('0x23')](function(){return _0x394c86;});}else{return _0x394c86;}})[_0xbcea('0x46')](function(_0x1814fe){logger['error'](_0xbcea('0x56'),_0x1814fe);throw _0x1814fe;});}return _0x394c86;});}})['then'](respondWithResult(_0x50dcc3,0xc9))[_0xbcea('0x46')](handleError(_0x50dcc3,null));};exports[_0xbcea('0x57')]=function(_0x1c0191,_0x3bf9cc){if(_0x1c0191['body']['id']){delete _0x1c0191[_0xbcea('0x4c')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x1c0191[_0xbcea('0x48')]['id']}})[_0xbcea('0x23')](handleEntityNotFound(_0x3bf9cc,null))[_0xbcea('0x23')](saveUpdates(_0x1c0191[_0xbcea('0x4c')],null))[_0xbcea('0x23')](respondWithResult(_0x3bf9cc,null))[_0xbcea('0x46')](handleError(_0x3bf9cc,null));};exports[_0xbcea('0x27')]=function(_0x2b8b93,_0x13c7ff){return db[_0xbcea('0x43')]['find']({'where':{'id':_0x2b8b93[_0xbcea('0x48')]['id']}})[_0xbcea('0x23')](handleEntityNotFound(_0x13c7ff,null))[_0xbcea('0x23')](removeEntity(_0x13c7ff,null))[_0xbcea('0x46')](handleError(_0x13c7ff,null));};exports['getSessions']=function(_0x262c25,_0x549ac0,_0x412c62){var _0x23114c={'raw':!![],'where':{}};var _0x24422c={};var _0x1f4960={'count':0x0,'rows':[]};return db[_0xbcea('0x43')][_0xbcea('0x58')]({'where':{'id':_0x262c25[_0xbcea('0x48')]['id']}})['then'](handleEntityNotFound(_0x549ac0,null))['then'](function(_0x187491){if(_0x187491){_0x24422c['model']=_[_0xbcea('0x34')](db[_0xbcea('0x59')][_0xbcea('0x2f')]);_0x24422c[_0xbcea('0x35')]=_['keys'](_0x262c25[_0xbcea('0x35')]);_0x24422c[_0xbcea('0x36')]=_[_0xbcea('0x37')](_0x24422c['model'],_0x24422c[_0xbcea('0x35')]);_0x23114c['attributes']=_[_0xbcea('0x37')](_0x24422c[_0xbcea('0x33')],qs[_0xbcea('0x39')](_0x262c25[_0xbcea('0x35')][_0xbcea('0x39')]));_0x23114c[_0xbcea('0x38')]=_0x23114c[_0xbcea('0x38')][_0xbcea('0x49')]?_0x23114c[_0xbcea('0x38')]:_0x24422c[_0xbcea('0x33')];if(!_0x262c25[_0xbcea('0x35')][_0xbcea('0x5a')](_0xbcea('0x3a'))){_0x23114c[_0xbcea('0x1d')]=qs[_0xbcea('0x1d')](_0x262c25[_0xbcea('0x35')][_0xbcea('0x1d')]);_0x23114c[_0xbcea('0x1b')]=qs[_0xbcea('0x1b')](_0x262c25[_0xbcea('0x35')]['offset']);}_0x23114c['order']=qs['sort'](_0x262c25[_0xbcea('0x35')]['sort']);_0x23114c[_0xbcea('0x3f')]=qs['filters'](_[_0xbcea('0x3d')](_0x262c25[_0xbcea('0x35')],_0x24422c[_0xbcea('0x36')]));_0x23114c[_0xbcea('0x3f')][_0xbcea('0x5b')]=_0x187491['id'];if(_0x262c25['query']['filter']){_0x23114c[_0xbcea('0x3f')]=_[_0xbcea('0x40')](_0x23114c['where'],{'$or':_[_0xbcea('0x41')](_0x23114c['attributes'],function(_0x47c2cb){var _0x48b040={};_0x48b040[_0x47c2cb]={'$like':'%'+_0x262c25[_0xbcea('0x35')]['filter']+'%'};return _0x48b040;})});}_0x23114c=_[_0xbcea('0x40')]({},_0x23114c,_0x262c25[_0xbcea('0x5c')]);return db['JscriptySessionReport'][_0xbcea('0x1c')]({'where':_0x23114c[_0xbcea('0x3f')]})['then'](function(_0x1ad7ad){_0x1f4960['count']=_0x1ad7ad;if(_0x262c25[_0xbcea('0x35')][_0xbcea('0x44')]){_0x23114c[_0xbcea('0x45')]=[{'all':!![]}];}return db[_0xbcea('0x59')][_0xbcea('0x5d')](_0x23114c);})[_0xbcea('0x23')](function(_0x43a316){_0x1f4960[_0xbcea('0x5e')]=_0x43a316;return _0x1f4960;});}})['then'](respondWithFilteredResult(_0x549ac0,_0x23114c))[_0xbcea('0x46')](handleError(_0x549ac0,null));};exports[_0xbcea('0x5f')]=function(_0x24d3c3,_0x21c421,_0x510078){var _0x14e6c0={'raw':!![],'where':{}};var _0x601bf1={};var _0x3b979c={'count':0x0,'rows':[]};return db[_0xbcea('0x43')][_0xbcea('0x58')]({'where':{'id':_0x24d3c3[_0xbcea('0x48')]['id']}})['then'](handleEntityNotFound(_0x21c421,null))['then'](function(_0x46ca41){if(_0x46ca41){_0x601bf1[_0xbcea('0x33')]=_[_0xbcea('0x34')](db[_0xbcea('0x60')][_0xbcea('0x2f')]);_0x601bf1['query']=_['keys'](_0x24d3c3[_0xbcea('0x35')]);_0x601bf1[_0xbcea('0x36')]=_['intersection'](_0x601bf1[_0xbcea('0x33')],_0x601bf1[_0xbcea('0x35')]);_0x14e6c0[_0xbcea('0x38')]=_[_0xbcea('0x37')](_0x601bf1[_0xbcea('0x33')],qs[_0xbcea('0x39')](_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x39')]));_0x14e6c0[_0xbcea('0x38')]=_0x14e6c0[_0xbcea('0x38')][_0xbcea('0x49')]?_0x14e6c0[_0xbcea('0x38')]:_0x601bf1[_0xbcea('0x33')];if(!_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x5a')](_0xbcea('0x3a'))){_0x14e6c0[_0xbcea('0x1d')]=qs[_0xbcea('0x1d')](_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x1d')]);_0x14e6c0[_0xbcea('0x1b')]=qs[_0xbcea('0x1b')](_0x24d3c3['query'][_0xbcea('0x1b')]);}_0x14e6c0[_0xbcea('0x3b')]=qs['sort'](_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x3c')]);_0x14e6c0[_0xbcea('0x3f')]=qs[_0xbcea('0x36')](_[_0xbcea('0x3d')](_0x24d3c3['query'],_0x601bf1['filters']));_0x14e6c0[_0xbcea('0x3f')][_0xbcea('0x5b')]=_0x46ca41['id'];if(_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x3e')]){_0x14e6c0['where']=_[_0xbcea('0x40')](_0x14e6c0[_0xbcea('0x3f')],{'$or':_[_0xbcea('0x41')](_0x14e6c0['attributes'],function(_0x3f7159){var _0xabc3a0={};_0xabc3a0[_0x3f7159]={'$like':'%'+_0x24d3c3['query']['filter']+'%'};return _0xabc3a0;})});}_0x14e6c0=_[_0xbcea('0x40')]({},_0x14e6c0,_0x24d3c3['options']);return db[_0xbcea('0x60')]['count']({'where':_0x14e6c0[_0xbcea('0x3f')]})[_0xbcea('0x23')](function(_0x99ed2d){_0x3b979c['count']=_0x99ed2d;if(_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x44')]){_0x14e6c0['include']=[{'all':!![]}];}return db[_0xbcea('0x60')][_0xbcea('0x5d')](_0x14e6c0);})[_0xbcea('0x23')](function(_0x47709a){_0x3b979c[_0xbcea('0x5e')]=_0x47709a;return _0x3b979c;});}})[_0xbcea('0x23')](respondWithFilteredResult(_0x21c421,_0x14e6c0))[_0xbcea('0x46')](handleError(_0x21c421,null));};function char(_0x35cde9){return'number'===typeof _0x35cde9?String['fromCharCode'][_0xbcea('0x20')](null,arguments):_0x35cde9;}function needsEncapsulation(_0xdc026e){return!!_0xdc026e&&(_0xdc026e[_0xbcea('0x61')]()['indexOf'](char(0xd))>=0x0||_0xdc026e[_0xbcea('0x61')]()[_0xbcea('0x62')](char(0xa))>=0x0||_0xdc026e[_0xbcea('0x61')]()['indexOf'](char(0x2c))>=0x0||_0xdc026e[_0xbcea('0x61')]()[_0xbcea('0x62')](char(0x22))>=0x0);}function encapsulate(_0x26737a){var _0xf1791c=char(0x22),_0x6d0cac='\x5c'+char(0x22),_0x449970=_0x26737a['toString']()[_0xbcea('0x63')](new RegExp(_0xf1791c,'g'),_0x6d0cac);return _0xf1791c+_0x449970+_0xf1791c;}exports['getSummary']=function(_0x2183ac,_0x1715b5,_0x3d6304){var _0x1c9b13,_0x3ae4ba;var _0x3ed87a={'where':{'ProjectId':_0x2183ac[_0xbcea('0x48')]['id']}};if(_0x2183ac[_0xbcea('0x35')][_0xbcea('0x64')]){_0x3ed87a['where'][_0xbcea('0x65')]=JSON[_0xbcea('0x66')](_0x2183ac[_0xbcea('0x35')][_0xbcea('0x64')]);}return db[_0xbcea('0x59')][_0xbcea('0x5d')](_0x3ed87a)[_0xbcea('0x23')](handleEntityNotFound(_0x1715b5,null))[_0xbcea('0x23')](function(_0x2bc249){if(_0x2bc249){_0x1c9b13=_0x2bc249;return db[_0xbcea('0x67')][_0xbcea('0x5d')]({'where':{'SessionId':{'$in':_[_0xbcea('0x41')](_0x1c9b13,'id')},'ProjectId':_0x2183ac[_0xbcea('0x48')]['id']},'order':_0xbcea('0x68')});}})[_0xbcea('0x23')](handleEntityNotFound(_0x1715b5,null))[_0xbcea('0x23')](function(_0x57f62b){if(_0x57f62b){_0x3ae4ba=_0x57f62b;var _0x3ef315={};for(var _0x2daf89=0x0,_0xa4e3b4=_0x3ae4ba[_0xbcea('0x49')];_0x2daf89<_0xa4e3b4;_0x2daf89++){if(!_0x3ef315[_0xbcea('0x5a')](_0x3ae4ba[_0x2daf89]['questionId'])){_0x3ef315[_0x3ae4ba[_0x2daf89]['questionId']]=needsEncapsulation(_0x3ae4ba[_0x2daf89][_0xbcea('0x69')])?encapsulate(_0x3ae4ba[_0x2daf89][_0xbcea('0x69')]):_0x3ae4ba[_0x2daf89][_0xbcea('0x69')];}}var _0x38d412=[],_0x1aee28={};for(var _0x4fe7ec=0x0,_0x3eecc1=_0x1c9b13['length'];_0x4fe7ec<_0x3eecc1;_0x4fe7ec++){_0x1aee28={'ProjectId':_0x2183ac[_0xbcea('0x48')]['id'],'SessionId':_0x1c9b13[_0x4fe7ec]['id'],'StartTime':moment(_0x1c9b13[_0x4fe7ec][_0xbcea('0x65')])['format'](_0xbcea('0x6a'))};for(var _0x329ebf=0x0,_0x246002=_0x3ae4ba[_0xbcea('0x49')];_0x329ebf<_0x246002;_0x329ebf++){if(_0x3ae4ba[_0x329ebf][_0xbcea('0x6b')]==_0x1c9b13[_0x4fe7ec]['id']&&_0x3ef315[_0xbcea('0x5a')](_0x3ae4ba[_0x329ebf][_0xbcea('0x6c')])){_0x1aee28[_0x3ef315[_0x3ae4ba[_0x329ebf][_0xbcea('0x6c')]]]=_0x3ae4ba[_0x329ebf]['answer'];}}for(var _0x43aeb0 in _0x3ef315){if(!_0x1aee28[_0xbcea('0x5a')](_0x3ef315[_0x43aeb0])){_0x1aee28[_0x3ef315[_0x43aeb0]]=null;}}_0x38d412[_0xbcea('0x6d')](_0x1aee28);}return _0x38d412;}})[_0xbcea('0x23')](function(_0x344cc6){if(!_[_0xbcea('0x6e')](_0x344cc6)){var _0x1028a9=toCsv(_0x344cc6);var _0x191217=Date['now']();fs[_0xbcea('0x6f')](util['format'](_0xbcea('0x70'),_0x2183ac[_0xbcea('0x48')]['id'],_0x191217),_0x1028a9);_0x1715b5[_0xbcea('0x71')](_0xbcea('0x72'),_0xbcea('0x73')+util[_0xbcea('0x74')](_0xbcea('0x75'),_0x2183ac[_0xbcea('0x48')]['id'],_0x191217));_0x1715b5['setHeader']('Content-type',_0xbcea('0x76'));return _0x1715b5[_0xbcea('0x77')](util[_0xbcea('0x74')](_0xbcea('0x70'),_0x2183ac[_0xbcea('0x48')]['id'],_0x191217));}else{return _0x1715b5[_0xbcea('0x29')](0xcc);}})[_0xbcea('0x46')](handleError(_0x1715b5,null));}; \ No newline at end of file +var _0x1364=['indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','count','offset','status','set','apply','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','merge','JscriptyProject','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','options','omit','createdAt','updatedAt','UserProfileSection','getSessions','findOne','JscriptySessionReport','hasOwnProperty','pick','ProjectId','filter','getAnswers','JscriptyAnswerReport','fromCharCode','toString'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x1364,0x1eb));var _0x4136=function(_0x38d947,_0x2522ce){_0x38d947=_0x38d947-0x0;var _0x1f0af9=_0x1364[_0x38d947];return _0x1f0af9;};'use strict';var emlformat=require(_0x4136('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4136('0x1'));var jsonpatch=require(_0x4136('0x2'));var rp=require('request-promise');var moment=require(_0x4136('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4136('0x4'));var util=require(_0x4136('0x5'));var path=require(_0x4136('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4136('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4136('0x8'));var squel=require(_0x4136('0x9'));var crypto=require(_0x4136('0xa'));var jsforce=require(_0x4136('0xb'));var deskjs=require(_0x4136('0xc'));var toCsv=require(_0x4136('0xd'));var querystring=require('querystring');var Papa=require(_0x4136('0xe'));var Redis=require(_0x4136('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4136('0x10'));var as=require(_0x4136('0x11'));var hardwareService=require(_0x4136('0x12'));var logger=require(_0x4136('0x13'))(_0x4136('0x14'));var utils=require('../../config/utils');var config=require(_0x4136('0x15'));var licenseUtil=require(_0x4136('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x541de0,_0x1535db){_0x1535db=_0x1535db||0xcc;return function(_0x2d7db8){if(_0x2d7db8){return _0x541de0[_0x4136('0x17')](_0x1535db);}return _0x541de0['status'](_0x1535db)[_0x4136('0x18')]();};}function respondWithResult(_0x319c9e,_0x40ccf5){_0x40ccf5=_0x40ccf5||0xc8;return function(_0x1ef62d){if(_0x1ef62d){return _0x319c9e['status'](_0x40ccf5)[_0x4136('0x19')](_0x1ef62d);}};}function respondWithFilteredResult(_0x2ecd6d,_0x3089ed){return function(_0x2b0d5c){if(_0x2b0d5c){var _0x3b3292=typeof _0x3089ed['offset']===_0x4136('0x1a')&&typeof _0x3089ed['limit']==='undefined';var _0x348bb2=_0x2b0d5c[_0x4136('0x1b')];var _0x566544=_0x3b3292?0x0:_0x3089ed['offset'];var _0x55f05a=_0x3b3292?_0x2b0d5c[_0x4136('0x1b')]:_0x3089ed[_0x4136('0x1c')]+_0x3089ed['limit'];var _0x196c07;if(_0x55f05a>=_0x348bb2){_0x55f05a=_0x348bb2;_0x196c07=0xc8;}else{_0x196c07=0xce;}_0x2ecd6d[_0x4136('0x1d')](_0x196c07);return _0x2ecd6d[_0x4136('0x1e')]('Content-Range',_0x566544+'-'+_0x55f05a+'/'+_0x348bb2)['json'](_0x2b0d5c);}return null;};}function patchUpdates(_0x13a1db){return function(_0x5c5cd7){try{jsonpatch[_0x4136('0x1f')](_0x5c5cd7,_0x13a1db,!![]);}catch(_0x994ac3){return BPromise['reject'](_0x994ac3);}return _0x5c5cd7[_0x4136('0x20')]();};}function saveUpdates(_0x44568b,_0x55f4df){return function(_0x2e6a48){if(_0x2e6a48){return _0x2e6a48[_0x4136('0x21')](_0x44568b)[_0x4136('0x22')](function(_0x46ab04){return _0x46ab04;});}return null;};}function removeEntity(_0x308b1c,_0x14ca0b){return function(_0x4155ea){if(_0x4155ea){return _0x4155ea[_0x4136('0x23')]()[_0x4136('0x22')](function(){var _0x49229b=_0x4155ea[_0x4136('0x24')]({'plain':!![]});var _0x5a59f6=_0x4136('0x25');return db[_0x4136('0x26')]['destroy']({'where':{'type':_0x5a59f6,'resourceId':_0x49229b['id']}})[_0x4136('0x22')](function(){return _0x4155ea;});})[_0x4136('0x22')](function(){_0x308b1c['status'](0xcc)[_0x4136('0x18')]();});}};}function handleEntityNotFound(_0x492d89,_0x7ce50){return function(_0x4b54df){if(!_0x4b54df){_0x492d89[_0x4136('0x17')](0x194);}return _0x4b54df;};}function handleError(_0x31ea19,_0x5bf046){_0x5bf046=_0x5bf046||0x1f4;return function(_0x270cd4){logger[_0x4136('0x27')](_0x270cd4[_0x4136('0x28')]);if(_0x270cd4[_0x4136('0x29')]){delete _0x270cd4['name'];}_0x31ea19[_0x4136('0x1d')](_0x5bf046)[_0x4136('0x2a')](_0x270cd4);};}exports['index']=function(_0x473a73,_0x4801f0){var _0x1d1e61={},_0x3f33b3={},_0x2577f8={'count':0x0,'rows':[]};var _0x45f657=_[_0x4136('0x2b')](db['JscriptyProject'][_0x4136('0x2c')],function(_0x468a5d){return{'name':_0x468a5d[_0x4136('0x2d')],'type':_0x468a5d[_0x4136('0x2e')][_0x4136('0x2f')]};});_0x3f33b3[_0x4136('0x30')]=_[_0x4136('0x2b')](_0x45f657,_0x4136('0x29'));_0x3f33b3[_0x4136('0x31')]=_[_0x4136('0x32')](_0x473a73['query']);_0x3f33b3[_0x4136('0x33')]=_[_0x4136('0x34')](_0x3f33b3[_0x4136('0x30')],_0x3f33b3[_0x4136('0x31')]);_0x1d1e61[_0x4136('0x35')]=_[_0x4136('0x34')](_0x3f33b3[_0x4136('0x30')],qs[_0x4136('0x36')](_0x473a73[_0x4136('0x31')][_0x4136('0x36')]));_0x1d1e61[_0x4136('0x35')]=_0x1d1e61['attributes'][_0x4136('0x37')]?_0x1d1e61[_0x4136('0x35')]:_0x3f33b3[_0x4136('0x30')];if(!_0x473a73[_0x4136('0x31')]['hasOwnProperty'](_0x4136('0x38'))){_0x1d1e61[_0x4136('0x39')]=qs[_0x4136('0x39')](_0x473a73[_0x4136('0x31')][_0x4136('0x39')]);_0x1d1e61[_0x4136('0x1c')]=qs[_0x4136('0x1c')](_0x473a73[_0x4136('0x31')][_0x4136('0x1c')]);}_0x1d1e61[_0x4136('0x3a')]=qs[_0x4136('0x3b')](_0x473a73[_0x4136('0x31')][_0x4136('0x3b')]);_0x1d1e61[_0x4136('0x3c')]=qs[_0x4136('0x33')](_['pick'](_0x473a73[_0x4136('0x31')],_0x3f33b3['filters']),_0x45f657);if(_0x473a73[_0x4136('0x31')]['filter']){_0x1d1e61[_0x4136('0x3c')]=_[_0x4136('0x3d')](_0x1d1e61[_0x4136('0x3c')],{'$or':_[_0x4136('0x2b')](_0x45f657,function(_0xbdfd5f){if(_0xbdfd5f[_0x4136('0x2e')]!=='VIRTUAL'){var _0x153d5d={};_0x153d5d[_0xbdfd5f['name']]={'$like':'%'+_0x473a73[_0x4136('0x31')]['filter']+'%'};return _0x153d5d;}})});}_0x1d1e61=_[_0x4136('0x3d')]({},_0x1d1e61,_0x473a73['options']);var _0x434252={'where':_0x1d1e61[_0x4136('0x3c')]};return db[_0x4136('0x3e')][_0x4136('0x1b')](_0x434252)[_0x4136('0x22')](function(_0x238524){_0x2577f8['count']=_0x238524;if(_0x473a73['query'][_0x4136('0x3f')]){_0x1d1e61[_0x4136('0x40')]=[{'all':!![]}];}return db[_0x4136('0x3e')][_0x4136('0x41')](_0x1d1e61);})[_0x4136('0x22')](function(_0x2f6183){_0x2577f8[_0x4136('0x42')]=_0x2f6183;return _0x2577f8;})[_0x4136('0x22')](respondWithFilteredResult(_0x4801f0,_0x1d1e61))[_0x4136('0x43')](handleError(_0x4801f0,null));};exports['show']=function(_0x373030,_0x5de6e0){var _0xb6d7ca={'raw':![],'where':{'id':_0x373030[_0x4136('0x44')]['id']}},_0x5b9891={};_0x5b9891['model']=_[_0x4136('0x32')](db[_0x4136('0x3e')][_0x4136('0x2c')]);_0x5b9891['query']=_['keys'](_0x373030[_0x4136('0x31')]);_0x5b9891[_0x4136('0x33')]=_[_0x4136('0x34')](_0x5b9891[_0x4136('0x30')],_0x5b9891[_0x4136('0x31')]);_0xb6d7ca[_0x4136('0x35')]=_[_0x4136('0x34')](_0x5b9891[_0x4136('0x30')],qs[_0x4136('0x36')](_0x373030[_0x4136('0x31')][_0x4136('0x36')]));_0xb6d7ca['attributes']=_0xb6d7ca[_0x4136('0x35')]['length']?_0xb6d7ca[_0x4136('0x35')]:_0x5b9891[_0x4136('0x30')];if(_0x373030[_0x4136('0x31')][_0x4136('0x3f')]){_0xb6d7ca[_0x4136('0x40')]=[{'all':!![]}];}_0xb6d7ca=_[_0x4136('0x3d')]({},_0xb6d7ca,_0x373030['options']);return db['JscriptyProject'][_0x4136('0x45')](_0xb6d7ca)[_0x4136('0x22')](handleEntityNotFound(_0x5de6e0,null))[_0x4136('0x22')](respondWithResult(_0x5de6e0,null))[_0x4136('0x43')](handleError(_0x5de6e0,null));};exports[_0x4136('0x46')]=function(_0x10e0bf,_0x41d62a){return db[_0x4136('0x3e')][_0x4136('0x46')](_0x10e0bf[_0x4136('0x47')],{})['then'](function(_0x15a27f){var _0x29ef9d=_0x10e0bf[_0x4136('0x48')][_0x4136('0x24')]({'plain':!![]});if(!_0x29ef9d)throw new Error(_0x4136('0x49'));if(_0x29ef9d[_0x4136('0x4a')]===_0x4136('0x48')){var _0x16c780=_0x15a27f['get']({'plain':!![]});var _0x12df69=_0x4136('0x25');return db['UserProfileSection'][_0x4136('0x45')]({'where':{'name':_0x12df69,'userProfileId':_0x29ef9d[_0x4136('0x4b')]},'raw':!![]})[_0x4136('0x22')](function(_0x2f0bf8){if(_0x2f0bf8&&_0x2f0bf8[_0x4136('0x4c')]===0x0){return db['UserProfileResource'][_0x4136('0x46')]({'name':_0x16c780[_0x4136('0x29')],'resourceId':_0x16c780['id'],'type':_0x2f0bf8['name'],'sectionId':_0x2f0bf8['id']},{})[_0x4136('0x22')](function(){return _0x15a27f;});}else{return _0x15a27f;}})[_0x4136('0x43')](function(_0x1153b6){logger[_0x4136('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1153b6);throw _0x1153b6;});}return _0x15a27f;})[_0x4136('0x22')](respondWithResult(_0x41d62a,0xc9))[_0x4136('0x43')](handleError(_0x41d62a,null));};exports[_0x4136('0x4d')]=function(_0x4d43bf,_0x561c34){var _0x44c254={'where':{'id':_0x4d43bf['params']['id']}},_0x48f0cc={};_0x48f0cc['model']=_[_0x4136('0x32')](db[_0x4136('0x3e')][_0x4136('0x2c')]);_0x44c254[_0x4136('0x35')]=_[_0x4136('0x34')](_0x48f0cc[_0x4136('0x30')],qs[_0x4136('0x36')](_0x4d43bf[_0x4136('0x31')][_0x4136('0x36')]));_0x44c254['attributes']=_0x44c254['attributes'][_0x4136('0x37')]?_0x44c254[_0x4136('0x35')]:_0x48f0cc['model'];if(_0x4d43bf[_0x4136('0x31')][_0x4136('0x3f')]){_0x44c254[_0x4136('0x40')]=[{'all':!![]}];}_0x44c254=_['merge']({},_0x44c254,_0x4d43bf[_0x4136('0x4e')]);return db['JscriptyProject'][_0x4136('0x45')](_0x44c254)[_0x4136('0x22')](handleEntityNotFound(_0x561c34,null))[_0x4136('0x22')](function(_0x4df6ae){if(_0x4df6ae){var _0x2e4de6=_0x4df6ae[_0x4136('0x24')]({'plain':!![]});_0x2e4de6=qs[_0x4136('0x4f')](_0x2e4de6,['id',_0x4136('0x50'),_0x4136('0x51')]);_0x4d43bf['body']=_[_0x4136('0x4f')](_0x4d43bf[_0x4136('0x47')],['id','createdAt',_0x4136('0x51')]);return db['JscriptyProject']['create'](_[_0x4136('0x3d')](_0x2e4de6,_0x4d43bf[_0x4136('0x47')]),{'include':_0x4d43bf[_0x4136('0x31')][_0x4136('0x3f')]?[{'all':!![]}]:undefined})[_0x4136('0x22')](function(_0x1199c1){var _0x36d580=_0x4d43bf[_0x4136('0x48')][_0x4136('0x24')]({'plain':!![]});if(!_0x36d580)throw new Error(_0x4136('0x49'));if(_0x36d580['role']===_0x4136('0x48')){var _0x255a33=_0x1199c1[_0x4136('0x24')]({'plain':!![]});var _0x46d3b7=_0x4136('0x25');return db[_0x4136('0x52')][_0x4136('0x45')]({'where':{'name':_0x46d3b7,'userProfileId':_0x36d580[_0x4136('0x4b')]},'raw':!![]})[_0x4136('0x22')](function(_0x28ee6f){if(_0x28ee6f&&_0x28ee6f[_0x4136('0x4c')]===0x0){return db[_0x4136('0x26')][_0x4136('0x46')]({'name':_0x255a33[_0x4136('0x29')],'resourceId':_0x255a33['id'],'type':_0x28ee6f[_0x4136('0x29')],'sectionId':_0x28ee6f['id']},{})[_0x4136('0x22')](function(){return _0x1199c1;});}else{return _0x1199c1;}})[_0x4136('0x43')](function(_0xce9712){logger[_0x4136('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xce9712);throw _0xce9712;});}return _0x1199c1;});}})[_0x4136('0x22')](respondWithResult(_0x561c34,0xc9))['catch'](handleError(_0x561c34,null));};exports[_0x4136('0x21')]=function(_0x336436,_0x2d3f9c){if(_0x336436[_0x4136('0x47')]['id']){delete _0x336436[_0x4136('0x47')]['id'];}return db['JscriptyProject'][_0x4136('0x45')]({'where':{'id':_0x336436[_0x4136('0x44')]['id']}})[_0x4136('0x22')](handleEntityNotFound(_0x2d3f9c,null))[_0x4136('0x22')](saveUpdates(_0x336436[_0x4136('0x47')],null))[_0x4136('0x22')](respondWithResult(_0x2d3f9c,null))[_0x4136('0x43')](handleError(_0x2d3f9c,null));};exports[_0x4136('0x23')]=function(_0x2c5846,_0x1e2959){return db[_0x4136('0x3e')][_0x4136('0x45')]({'where':{'id':_0x2c5846[_0x4136('0x44')]['id']}})[_0x4136('0x22')](handleEntityNotFound(_0x1e2959,null))['then'](removeEntity(_0x1e2959,null))[_0x4136('0x43')](handleError(_0x1e2959,null));};exports[_0x4136('0x53')]=function(_0x379c85,_0x5847d5,_0x3e873b){var _0x3c9004={'raw':!![],'where':{}};var _0x461c00={};var _0x6482f={'count':0x0,'rows':[]};return db[_0x4136('0x3e')][_0x4136('0x54')]({'where':{'id':_0x379c85[_0x4136('0x44')]['id']}})[_0x4136('0x22')](handleEntityNotFound(_0x5847d5,null))[_0x4136('0x22')](function(_0x296f23){if(_0x296f23){_0x461c00[_0x4136('0x30')]=_[_0x4136('0x32')](db[_0x4136('0x55')][_0x4136('0x2c')]);_0x461c00['query']=_[_0x4136('0x32')](_0x379c85['query']);_0x461c00[_0x4136('0x33')]=_[_0x4136('0x34')](_0x461c00[_0x4136('0x30')],_0x461c00[_0x4136('0x31')]);_0x3c9004['attributes']=_[_0x4136('0x34')](_0x461c00[_0x4136('0x30')],qs['fields'](_0x379c85[_0x4136('0x31')][_0x4136('0x36')]));_0x3c9004['attributes']=_0x3c9004['attributes'][_0x4136('0x37')]?_0x3c9004[_0x4136('0x35')]:_0x461c00[_0x4136('0x30')];if(!_0x379c85[_0x4136('0x31')][_0x4136('0x56')](_0x4136('0x38'))){_0x3c9004[_0x4136('0x39')]=qs['limit'](_0x379c85['query'][_0x4136('0x39')]);_0x3c9004[_0x4136('0x1c')]=qs[_0x4136('0x1c')](_0x379c85[_0x4136('0x31')][_0x4136('0x1c')]);}_0x3c9004[_0x4136('0x3a')]=qs[_0x4136('0x3b')](_0x379c85[_0x4136('0x31')][_0x4136('0x3b')]);_0x3c9004[_0x4136('0x3c')]=qs[_0x4136('0x33')](_[_0x4136('0x57')](_0x379c85[_0x4136('0x31')],_0x461c00[_0x4136('0x33')]));_0x3c9004[_0x4136('0x3c')][_0x4136('0x58')]=_0x296f23['id'];if(_0x379c85['query'][_0x4136('0x59')]){_0x3c9004['where']=_[_0x4136('0x3d')](_0x3c9004[_0x4136('0x3c')],{'$or':_[_0x4136('0x2b')](_0x3c9004['attributes'],function(_0x5f38bf){var _0x49fb5f={};_0x49fb5f[_0x5f38bf]={'$like':'%'+_0x379c85[_0x4136('0x31')][_0x4136('0x59')]+'%'};return _0x49fb5f;})});}_0x3c9004=_['merge']({},_0x3c9004,_0x379c85['options']);return db[_0x4136('0x55')][_0x4136('0x1b')]({'where':_0x3c9004['where']})[_0x4136('0x22')](function(_0x1b3411){_0x6482f[_0x4136('0x1b')]=_0x1b3411;if(_0x379c85[_0x4136('0x31')]['includeAll']){_0x3c9004[_0x4136('0x40')]=[{'all':!![]}];}return db[_0x4136('0x55')][_0x4136('0x41')](_0x3c9004);})[_0x4136('0x22')](function(_0x42c9a2){_0x6482f[_0x4136('0x42')]=_0x42c9a2;return _0x6482f;});}})[_0x4136('0x22')](respondWithFilteredResult(_0x5847d5,_0x3c9004))[_0x4136('0x43')](handleError(_0x5847d5,null));};exports[_0x4136('0x5a')]=function(_0x34567f,_0x3de663,_0x49d744){var _0x4daa7a={'raw':!![],'where':{}};var _0x3ab949={};var _0xc7069={'count':0x0,'rows':[]};return db[_0x4136('0x3e')][_0x4136('0x54')]({'where':{'id':_0x34567f['params']['id']}})[_0x4136('0x22')](handleEntityNotFound(_0x3de663,null))[_0x4136('0x22')](function(_0x5ab8c7){if(_0x5ab8c7){_0x3ab949[_0x4136('0x30')]=_[_0x4136('0x32')](db[_0x4136('0x5b')][_0x4136('0x2c')]);_0x3ab949[_0x4136('0x31')]=_[_0x4136('0x32')](_0x34567f['query']);_0x3ab949['filters']=_[_0x4136('0x34')](_0x3ab949['model'],_0x3ab949[_0x4136('0x31')]);_0x4daa7a[_0x4136('0x35')]=_[_0x4136('0x34')](_0x3ab949[_0x4136('0x30')],qs[_0x4136('0x36')](_0x34567f[_0x4136('0x31')][_0x4136('0x36')]));_0x4daa7a['attributes']=_0x4daa7a[_0x4136('0x35')]['length']?_0x4daa7a[_0x4136('0x35')]:_0x3ab949['model'];if(!_0x34567f[_0x4136('0x31')][_0x4136('0x56')]('nolimit')){_0x4daa7a[_0x4136('0x39')]=qs['limit'](_0x34567f[_0x4136('0x31')]['limit']);_0x4daa7a[_0x4136('0x1c')]=qs['offset'](_0x34567f['query'][_0x4136('0x1c')]);}_0x4daa7a[_0x4136('0x3a')]=qs[_0x4136('0x3b')](_0x34567f[_0x4136('0x31')][_0x4136('0x3b')]);_0x4daa7a['where']=qs[_0x4136('0x33')](_[_0x4136('0x57')](_0x34567f[_0x4136('0x31')],_0x3ab949['filters']));_0x4daa7a[_0x4136('0x3c')]['ProjectId']=_0x5ab8c7['id'];if(_0x34567f[_0x4136('0x31')][_0x4136('0x59')]){_0x4daa7a[_0x4136('0x3c')]=_['merge'](_0x4daa7a['where'],{'$or':_['map'](_0x4daa7a[_0x4136('0x35')],function(_0x41b80d){var _0x52b782={};_0x52b782[_0x41b80d]={'$like':'%'+_0x34567f[_0x4136('0x31')][_0x4136('0x59')]+'%'};return _0x52b782;})});}_0x4daa7a=_['merge']({},_0x4daa7a,_0x34567f[_0x4136('0x4e')]);return db[_0x4136('0x5b')]['count']({'where':_0x4daa7a[_0x4136('0x3c')]})[_0x4136('0x22')](function(_0x5e2fe6){_0xc7069[_0x4136('0x1b')]=_0x5e2fe6;if(_0x34567f[_0x4136('0x31')][_0x4136('0x3f')]){_0x4daa7a['include']=[{'all':!![]}];}return db[_0x4136('0x5b')][_0x4136('0x41')](_0x4daa7a);})[_0x4136('0x22')](function(_0x5c4d0e){_0xc7069[_0x4136('0x42')]=_0x5c4d0e;return _0xc7069;});}})[_0x4136('0x22')](respondWithFilteredResult(_0x3de663,_0x4daa7a))['catch'](handleError(_0x3de663,null));};function char(_0x391914){return'number'===typeof _0x391914?String[_0x4136('0x5c')][_0x4136('0x1f')](null,arguments):_0x391914;}function needsEncapsulation(_0x1c2336){return!!_0x1c2336&&(_0x1c2336[_0x4136('0x5d')]()[_0x4136('0x5e')](char(0xd))>=0x0||_0x1c2336['toString']()['indexOf'](char(0xa))>=0x0||_0x1c2336[_0x4136('0x5d')]()[_0x4136('0x5e')](char(0x2c))>=0x0||_0x1c2336[_0x4136('0x5d')]()[_0x4136('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x1e5c30){var _0x2b0d66=char(0x22),_0xb5ce9e='\x5c'+char(0x22),_0x560e7d=_0x1e5c30[_0x4136('0x5d')]()[_0x4136('0x5f')](new RegExp(_0x2b0d66,'g'),_0xb5ce9e);return _0x2b0d66+_0x560e7d+_0x2b0d66;}exports[_0x4136('0x60')]=function(_0x175b30,_0x526ff8,_0x1df346){var _0x215405,_0x3898c0;var _0xee0402={'where':{'ProjectId':_0x175b30[_0x4136('0x44')]['id']}};if(_0x175b30[_0x4136('0x31')]['startTime']){_0xee0402[_0x4136('0x3c')][_0x4136('0x61')]=JSON[_0x4136('0x62')](_0x175b30[_0x4136('0x31')][_0x4136('0x63')]);}return db[_0x4136('0x55')][_0x4136('0x41')](_0xee0402)[_0x4136('0x22')](handleEntityNotFound(_0x526ff8,null))[_0x4136('0x22')](function(_0x4d54d7){if(_0x4d54d7){_0x215405=_0x4d54d7;return db[_0x4136('0x64')]['findAll']({'where':{'SessionId':{'$in':_[_0x4136('0x2b')](_0x215405,'id')},'ProjectId':_0x175b30[_0x4136('0x44')]['id']},'order':_0x4136('0x65')});}})[_0x4136('0x22')](handleEntityNotFound(_0x526ff8,null))['then'](function(_0x11d089){if(_0x11d089){_0x3898c0=_0x11d089;var _0x1a91ca={};for(var _0x237bcf=0x0,_0x97f1c5=_0x3898c0[_0x4136('0x37')];_0x237bcf<_0x97f1c5;_0x237bcf++){if(!_0x1a91ca[_0x4136('0x56')](_0x3898c0[_0x237bcf][_0x4136('0x66')])){_0x1a91ca[_0x3898c0[_0x237bcf]['questionId']]=needsEncapsulation(_0x3898c0[_0x237bcf][_0x4136('0x67')])?encapsulate(_0x3898c0[_0x237bcf][_0x4136('0x67')]):_0x3898c0[_0x237bcf][_0x4136('0x67')];}}var _0x57979f=[],_0x2e1908={};for(var _0x205bac=0x0,_0x5c6145=_0x215405['length'];_0x205bac<_0x5c6145;_0x205bac++){_0x2e1908={'ProjectId':_0x175b30['params']['id'],'SessionId':_0x215405[_0x205bac]['id'],'StartTime':moment(_0x215405[_0x205bac][_0x4136('0x61')])['format'](_0x4136('0x68'))};for(var _0x440dff=0x0,_0x8d33ca=_0x3898c0[_0x4136('0x37')];_0x440dff<_0x8d33ca;_0x440dff++){if(_0x3898c0[_0x440dff][_0x4136('0x69')]==_0x215405[_0x205bac]['id']&&_0x1a91ca[_0x4136('0x56')](_0x3898c0[_0x440dff][_0x4136('0x66')])){_0x2e1908[_0x1a91ca[_0x3898c0[_0x440dff][_0x4136('0x66')]]]=_0x3898c0[_0x440dff][_0x4136('0x6a')];}}for(var _0x548742 in _0x1a91ca){if(!_0x2e1908[_0x4136('0x56')](_0x1a91ca[_0x548742])){_0x2e1908[_0x1a91ca[_0x548742]]=null;}}_0x57979f[_0x4136('0x6b')](_0x2e1908);}return _0x57979f;}})[_0x4136('0x22')](function(_0x5239b6){if(!_[_0x4136('0x6c')](_0x5239b6)){var _0x13183d=toCsv(_0x5239b6);var _0x3f4cf3=Date['now']();fs[_0x4136('0x6d')](util[_0x4136('0x6e')](_0x4136('0x6f'),_0x175b30[_0x4136('0x44')]['id'],_0x3f4cf3),_0x13183d);_0x526ff8[_0x4136('0x70')](_0x4136('0x71'),'attachment;\x20filename='+util[_0x4136('0x6e')](_0x4136('0x72'),_0x175b30['params']['id'],_0x3f4cf3));_0x526ff8[_0x4136('0x70')]('Content-type',_0x4136('0x73'));return _0x526ff8[_0x4136('0x74')](util[_0x4136('0x6e')](_0x4136('0x6f'),_0x175b30['params']['id'],_0x3f4cf3));}else{return _0x526ff8[_0x4136('0x17')](0xcc);}})[_0x4136('0x43')](handleError(_0x526ff8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c77105e..378d946 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 _0xc090=['jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports','define'];(function(_0x104aa3,_0x31d93c){var _0x2e97a6=function(_0x3ba83d){while(--_0x3ba83d){_0x104aa3['push'](_0x104aa3['shift']());}};_0x2e97a6(++_0x31d93c);}(_0xc090,0x112));var _0x0c09=function(_0x5a3d4c,_0x32b043){_0x5a3d4c=_0x5a3d4c-0x0;var _0x5ddc7e=_0xc090[_0x5a3d4c];return _0x5ddc7e;};'use strict';var _=require(_0x0c09('0x0'));var util=require(_0x0c09('0x1'));var logger=require(_0x0c09('0x2'))(_0x0c09('0x3'));var moment=require(_0x0c09('0x4'));var BPromise=require(_0x0c09('0x5'));var rp=require(_0x0c09('0x6'));var fs=require('fs');var path=require(_0x0c09('0x7'));var rimraf=require(_0x0c09('0x8'));var config=require('../../config/environment');var attributes=require(_0x0c09('0x9'));module[_0x0c09('0xa')]=function(_0x4f3f48,_0x49a403){return _0x4f3f48[_0x0c09('0xb')]('JscriptyProject',attributes,{'tableName':_0x0c09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd0=['api','bluebird','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x200d3c,_0x360dc6){var _0x250736=function(_0x2dccdf){while(--_0x2dccdf){_0x200d3c['push'](_0x200d3c['shift']());}};_0x250736(++_0x360dc6);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xcdd0[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var logger=require(_0x0cdd('0x2'))(_0x0cdd('0x3'));var moment=require('moment');var BPromise=require(_0x0cdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0cdd('0x5'));var config=require('../../config/environment');var attributes=require(_0x0cdd('0x6'));module[_0x0cdd('0x7')]=function(_0xe80a73,_0x5ca0f9){return _0xe80a73[_0x0cdd('0x8')](_0x0cdd('0x9'),attributes,{'tableName':_0x0cdd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 8304a41..306d469 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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4d5c37,_0x60f4e7){var _0x432a84=function(_0x3fc923){while(--_0x3fc923){_0x4d5c37['push'](_0x4d5c37['shift']());}};_0x432a84(++_0x60f4e7);}(_0x70e0,0x17b));var _0x070e=function(_0x490c67,_0x1a5141){_0x490c67=_0x490c67-0x0;var _0x1b7444=_0x70e0[_0x490c67];return _0x1b7444;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x22cbc7,_0x7e43c9){var _0x26d9fd=function(_0x2fd176){while(--_0x2fd176){_0x22cbc7['push'](_0x22cbc7['shift']());}};_0x26d9fd(++_0x7e43c9);}(_0x70e0,0x17b));var _0x070e=function(_0x109bc4,_0x1164b8){_0x109bc4=_0x109bc4-0x0;var _0x541037=_0x70e0[_0x109bc4];return _0x541037;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 2a220f0..c106c4c 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 _0x74d3=['update','delete','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','put'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x74d3,0x9c));var _0x374d=function(_0x5d99c6,_0x2447af){_0x5d99c6=_0x5d99c6-0x0;var _0x2d2c9a=_0x74d3[_0x5d99c6];return _0x2d2c9a;};'use strict';var multer=require(_0x374d('0x0'));var util=require(_0x374d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x374d('0x2'));var router=express['Router']();var fs_extra=require(_0x374d('0x3'));var auth=require(_0x374d('0x4'));var interaction=require(_0x374d('0x5'));var config=require('../../config/environment');var controller=require(_0x374d('0x6'));router['get']('/',auth[_0x374d('0x7')](),controller[_0x374d('0x8')]);router[_0x374d('0x9')](_0x374d('0xa'),auth[_0x374d('0x7')](),controller[_0x374d('0xb')]);router[_0x374d('0x9')](_0x374d('0xc'),auth[_0x374d('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x374d('0xd')](_0x374d('0xc'),auth[_0x374d('0x7')](),controller[_0x374d('0xe')]);router[_0x374d('0xf')](_0x374d('0xc'),auth[_0x374d('0x7')](),controller['destroy']);module[_0x374d('0x10')]=router; \ No newline at end of file +var _0x9572=['/describe','isAuthenticated','show','post','create','/:id','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index'];(function(_0x37ed6e,_0x40a32c){var _0x12dc35=function(_0x3a824f){while(--_0x3a824f){_0x37ed6e['push'](_0x37ed6e['shift']());}};_0x12dc35(++_0x40a32c);}(_0x9572,0xf8));var _0x2957=function(_0x15b4a2,_0x24c946){_0x15b4a2=_0x15b4a2-0x0;var _0x4f6b52=_0x9572[_0x15b4a2];return _0x4f6b52;};'use strict';var multer=require(_0x2957('0x0'));var util=require(_0x2957('0x1'));var path=require(_0x2957('0x2'));var timeout=require('connect-timeout');var express=require(_0x2957('0x3'));var router=express[_0x2957('0x4')]();var fs_extra=require(_0x2957('0x5'));var auth=require(_0x2957('0x6'));var interaction=require(_0x2957('0x7'));var config=require(_0x2957('0x8'));var controller=require(_0x2957('0x9'));router[_0x2957('0xa')]('/',auth['isAuthenticated'](),controller[_0x2957('0xb')]);router[_0x2957('0xa')](_0x2957('0xc'),auth[_0x2957('0xd')](),controller['describe']);router[_0x2957('0xa')]('/:id',auth[_0x2957('0xd')](),controller[_0x2957('0xe')]);router[_0x2957('0xf')]('/',auth[_0x2957('0xd')](),controller[_0x2957('0x10')]);router['put'](_0x2957('0x11'),auth[_0x2957('0xd')](),controller[_0x2957('0x12')]);router[_0x2957('0x13')](_0x2957('0x11'),auth[_0x2957('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index b0bfe77..012d8f5 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(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x53b10a,_0x36771d){_0x53b10a=_0x53b10a-0x0;var _0x3fc655=_0x7a54[_0x53b10a];return _0x3fc655;};'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(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7a54,0x106));var _0x47a5=function(_0x46d122,_0x449ac9){_0x46d122=_0x46d122-0x0;var _0x1bd733=_0x7a54[_0x46d122];return _0x1bd733;};'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 e44e15a..440079e 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 _0xb923=['merge','type','VIRTUAL','includeAll','include','JscriptyQuestionReport','findAll','rows','catch','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','rawAttributes','fieldName','map','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x254eff,_0x262026){var _0x17a957=function(_0x50a600){while(--_0x50a600){_0x254eff['push'](_0x254eff['shift']());}};_0x17a957(++_0x262026);}(_0xb923,0xa2));var _0x3b92=function(_0x26cf90,_0x50702d){_0x26cf90=_0x26cf90-0x0;var _0x3e13f6=_0xb923[_0x26cf90];return _0x3e13f6;};'use strict';var emlformat=require(_0x3b92('0x0'));var rimraf=require(_0x3b92('0x1'));var zipdir=require(_0x3b92('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b92('0x3'));var moment=require(_0x3b92('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3b92('0x5'));var sox=require(_0x3b92('0x6'));var csv=require(_0x3b92('0x7'));var ejs=require(_0x3b92('0x8'));var fs=require('fs');var fs_extra=require(_0x3b92('0x9'));var _=require(_0x3b92('0xa'));var squel=require(_0x3b92('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b92('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3b92('0xd'));var Papa=require(_0x3b92('0xe'));var Redis=require('ioredis');var authService=require(_0x3b92('0xf'));var qs=require(_0x3b92('0x10'));var as=require(_0x3b92('0x11'));var hardwareService=require(_0x3b92('0x12'));var logger=require(_0x3b92('0x13'))('api');var utils=require(_0x3b92('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3b92('0x15'))['db'];function respondWithStatusCode(_0xdcd2b6,_0x2c4dcc){_0x2c4dcc=_0x2c4dcc||0xcc;return function(_0x3ae230){if(_0x3ae230){return _0xdcd2b6['sendStatus'](_0x2c4dcc);}return _0xdcd2b6['status'](_0x2c4dcc)[_0x3b92('0x16')]();};}function respondWithResult(_0x5524e8,_0x51143b){_0x51143b=_0x51143b||0xc8;return function(_0x10545c){if(_0x10545c){return _0x5524e8[_0x3b92('0x17')](_0x51143b)[_0x3b92('0x18')](_0x10545c);}};}function respondWithFilteredResult(_0x2470b7,_0x38bcd7){return function(_0x59bdfd){if(_0x59bdfd){var _0xd7995d=typeof _0x38bcd7[_0x3b92('0x19')]==='undefined'&&typeof _0x38bcd7['limit']===_0x3b92('0x1a');var _0x16dc44=_0x59bdfd[_0x3b92('0x1b')];var _0x1859b4=_0xd7995d?0x0:_0x38bcd7[_0x3b92('0x19')];var _0xc2cd15=_0xd7995d?_0x59bdfd[_0x3b92('0x1b')]:_0x38bcd7[_0x3b92('0x19')]+_0x38bcd7[_0x3b92('0x1c')];var _0x17225b;if(_0xc2cd15>=_0x16dc44){_0xc2cd15=_0x16dc44;_0x17225b=0xc8;}else{_0x17225b=0xce;}_0x2470b7[_0x3b92('0x17')](_0x17225b);return _0x2470b7[_0x3b92('0x1d')](_0x3b92('0x1e'),_0x1859b4+'-'+_0xc2cd15+'/'+_0x16dc44)['json'](_0x59bdfd);}return null;};}function patchUpdates(_0x35a3b1){return function(_0x237de3){try{jsonpatch[_0x3b92('0x1f')](_0x237de3,_0x35a3b1,!![]);}catch(_0x95e51c){return BPromise[_0x3b92('0x20')](_0x95e51c);}return _0x237de3[_0x3b92('0x21')]();};}function saveUpdates(_0x52b452,_0x14fbe0){return function(_0x26fc01){if(_0x26fc01){return _0x26fc01['update'](_0x52b452)['then'](function(_0x51efee){return _0x51efee;});}return null;};}function removeEntity(_0x54ac98,_0x450f2e){return function(_0x4715b6){if(_0x4715b6){return _0x4715b6[_0x3b92('0x22')]()[_0x3b92('0x23')](function(){_0x54ac98[_0x3b92('0x17')](0xcc)[_0x3b92('0x16')]();});}};}function handleEntityNotFound(_0x427a90,_0x5642b1){return function(_0x37c844){if(!_0x37c844){_0x427a90['sendStatus'](0x194);}return _0x37c844;};}function handleError(_0x2f1f58,_0x5381c3){_0x5381c3=_0x5381c3||0x1f4;return function(_0x24a15f){logger[_0x3b92('0x24')](_0x24a15f[_0x3b92('0x25')]);if(_0x24a15f[_0x3b92('0x26')]){delete _0x24a15f[_0x3b92('0x26')];}_0x2f1f58[_0x3b92('0x17')](_0x5381c3)['send'](_0x24a15f);};}exports[_0x3b92('0x27')]=function(_0xd3b5ce,_0x1299e0){var _0x56cc59={},_0x4ac7b4={},_0x1c5a18={'count':0x0,'rows':[]};var _0x3d96d5=_['map'](db['JscriptyQuestionReport'][_0x3b92('0x28')],function(_0x5f3763){return{'name':_0x5f3763[_0x3b92('0x29')],'type':_0x5f3763['type']['key']};});_0x4ac7b4['model']=_[_0x3b92('0x2a')](_0x3d96d5,_0x3b92('0x26'));_0x4ac7b4['query']=_[_0x3b92('0x2b')](_0xd3b5ce[_0x3b92('0x2c')]);_0x4ac7b4['filters']=_[_0x3b92('0x2d')](_0x4ac7b4[_0x3b92('0x2e')],_0x4ac7b4[_0x3b92('0x2c')]);_0x56cc59['attributes']=_['intersection'](_0x4ac7b4[_0x3b92('0x2e')],qs[_0x3b92('0x2f')](_0xd3b5ce[_0x3b92('0x2c')]['fields']));_0x56cc59['attributes']=_0x56cc59[_0x3b92('0x30')]['length']?_0x56cc59[_0x3b92('0x30')]:_0x4ac7b4[_0x3b92('0x2e')];if(!_0xd3b5ce[_0x3b92('0x2c')][_0x3b92('0x31')](_0x3b92('0x32'))){_0x56cc59[_0x3b92('0x1c')]=qs[_0x3b92('0x1c')](_0xd3b5ce['query'][_0x3b92('0x1c')]);_0x56cc59[_0x3b92('0x19')]=qs[_0x3b92('0x19')](_0xd3b5ce['query'][_0x3b92('0x19')]);}_0x56cc59[_0x3b92('0x33')]=qs[_0x3b92('0x34')](_0xd3b5ce[_0x3b92('0x2c')][_0x3b92('0x34')]);_0x56cc59[_0x3b92('0x35')]=qs[_0x3b92('0x36')](_[_0x3b92('0x37')](_0xd3b5ce[_0x3b92('0x2c')],_0x4ac7b4[_0x3b92('0x36')]),_0x3d96d5);if(_0xd3b5ce[_0x3b92('0x2c')][_0x3b92('0x38')]){_0x56cc59[_0x3b92('0x35')]=_[_0x3b92('0x39')](_0x56cc59[_0x3b92('0x35')],{'$or':_[_0x3b92('0x2a')](_0x3d96d5,function(_0x407c54){if(_0x407c54[_0x3b92('0x3a')]!==_0x3b92('0x3b')){var _0x40dcb8={};_0x40dcb8[_0x407c54[_0x3b92('0x26')]]={'$like':'%'+_0xd3b5ce[_0x3b92('0x2c')][_0x3b92('0x38')]+'%'};return _0x40dcb8;}})});}_0x56cc59=_[_0x3b92('0x39')]({},_0x56cc59,_0xd3b5ce['options']);var _0x4423cb={'where':_0x56cc59[_0x3b92('0x35')]};return db['JscriptyQuestionReport'][_0x3b92('0x1b')](_0x4423cb)[_0x3b92('0x23')](function(_0x422415){_0x1c5a18[_0x3b92('0x1b')]=_0x422415;if(_0xd3b5ce[_0x3b92('0x2c')][_0x3b92('0x3c')]){_0x56cc59[_0x3b92('0x3d')]=[{'all':!![]}];}return db[_0x3b92('0x3e')][_0x3b92('0x3f')](_0x56cc59);})['then'](function(_0xe94b3b){_0x1c5a18[_0x3b92('0x40')]=_0xe94b3b;return _0x1c5a18;})['then'](respondWithFilteredResult(_0x1299e0,_0x56cc59))[_0x3b92('0x41')](handleError(_0x1299e0,null));};exports['show']=function(_0x23c17e,_0x5906f0){var _0x18e6f4={'raw':!![],'where':{'id':_0x23c17e[_0x3b92('0x42')]['id']}},_0xf54dd1={};_0xf54dd1[_0x3b92('0x2e')]=_[_0x3b92('0x2b')](db['JscriptyQuestionReport'][_0x3b92('0x28')]);_0xf54dd1[_0x3b92('0x2c')]=_[_0x3b92('0x2b')](_0x23c17e[_0x3b92('0x2c')]);_0xf54dd1[_0x3b92('0x36')]=_[_0x3b92('0x2d')](_0xf54dd1[_0x3b92('0x2e')],_0xf54dd1['query']);_0x18e6f4[_0x3b92('0x30')]=_[_0x3b92('0x2d')](_0xf54dd1[_0x3b92('0x2e')],qs['fields'](_0x23c17e[_0x3b92('0x2c')]['fields']));_0x18e6f4[_0x3b92('0x30')]=_0x18e6f4[_0x3b92('0x30')][_0x3b92('0x43')]?_0x18e6f4[_0x3b92('0x30')]:_0xf54dd1[_0x3b92('0x2e')];if(_0x23c17e['query']['includeAll']){_0x18e6f4[_0x3b92('0x3d')]=[{'all':!![]}];}_0x18e6f4=_['merge']({},_0x18e6f4,_0x23c17e[_0x3b92('0x44')]);return db['JscriptyQuestionReport'][_0x3b92('0x45')](_0x18e6f4)['then'](handleEntityNotFound(_0x5906f0,null))[_0x3b92('0x23')](respondWithResult(_0x5906f0,null))[_0x3b92('0x41')](handleError(_0x5906f0,null));};exports['create']=function(_0x2624db,_0x22b7a4){return db[_0x3b92('0x3e')][_0x3b92('0x46')](_0x2624db[_0x3b92('0x47')],{})[_0x3b92('0x23')](respondWithResult(_0x22b7a4,0xc9))['catch'](handleError(_0x22b7a4,null));};exports['update']=function(_0x45e4ce,_0x2c1d45){if(_0x45e4ce[_0x3b92('0x47')]['id']){delete _0x45e4ce[_0x3b92('0x47')]['id'];}return db[_0x3b92('0x3e')][_0x3b92('0x45')]({'where':{'id':_0x45e4ce[_0x3b92('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c1d45,null))[_0x3b92('0x23')](saveUpdates(_0x45e4ce[_0x3b92('0x47')],null))[_0x3b92('0x23')](respondWithResult(_0x2c1d45,null))[_0x3b92('0x41')](handleError(_0x2c1d45,null));};exports[_0x3b92('0x22')]=function(_0x120713,_0xdf0884){return db[_0x3b92('0x3e')][_0x3b92('0x45')]({'where':{'id':_0x120713[_0x3b92('0x42')]['id']}})[_0x3b92('0x23')](handleEntityNotFound(_0xdf0884,null))['then'](removeEntity(_0xdf0884,null))[_0x3b92('0x41')](handleError(_0xdf0884,null));};exports['describe']=function(_0x8ebf48,_0x2e0b55){return db[_0x3b92('0x3e')][_0x3b92('0x48')]()[_0x3b92('0x23')](respondWithResult(_0x2e0b55,null))[_0x3b92('0x41')](handleError(_0x2e0b55,null));}; \ No newline at end of file +var _0x5074=['name','map','JscriptyQuestionReport','fieldName','key','keys','query','intersection','attributes','length','model','hasOwnProperty','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','destroy','describe','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error'];(function(_0x5c81b2,_0x46590a){var _0x4cbed6=function(_0x221f19){while(--_0x221f19){_0x5c81b2['push'](_0x5c81b2['shift']());}};_0x4cbed6(++_0x46590a);}(_0x5074,0x6e));var _0x4507=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x5074[_0x1627ae];return _0x34b38f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4507('0x0'));var jsonpatch=require(_0x4507('0x1'));var rp=require(_0x4507('0x2'));var moment=require(_0x4507('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4507('0x4'));var util=require(_0x4507('0x5'));var path=require(_0x4507('0x6'));var sox=require(_0x4507('0x7'));var csv=require(_0x4507('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4507('0x9'));var _=require(_0x4507('0xa'));var squel=require(_0x4507('0xb'));var crypto=require(_0x4507('0xc'));var jsforce=require(_0x4507('0xd'));var deskjs=require(_0x4507('0xe'));var toCsv=require(_0x4507('0x8'));var querystring=require(_0x4507('0xf'));var Papa=require(_0x4507('0x10'));var Redis=require(_0x4507('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4507('0x12'));var as=require(_0x4507('0x13'));var hardwareService=require(_0x4507('0x14'));var logger=require(_0x4507('0x15'))(_0x4507('0x16'));var utils=require(_0x4507('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4507('0x18'));var db=require(_0x4507('0x19'))['db'];function respondWithStatusCode(_0x2e50b8,_0xcc64b1){_0xcc64b1=_0xcc64b1||0xcc;return function(_0x52ae3b){if(_0x52ae3b){return _0x2e50b8[_0x4507('0x1a')](_0xcc64b1);}return _0x2e50b8['status'](_0xcc64b1)['end']();};}function respondWithResult(_0x1ab82b,_0x5375a7){_0x5375a7=_0x5375a7||0xc8;return function(_0x5378ec){if(_0x5378ec){return _0x1ab82b[_0x4507('0x1b')](_0x5375a7)[_0x4507('0x1c')](_0x5378ec);}};}function respondWithFilteredResult(_0x4c4fce,_0x483739){return function(_0x1b15b8){if(_0x1b15b8){var _0xc72652=typeof _0x483739[_0x4507('0x1d')]==='undefined'&&typeof _0x483739[_0x4507('0x1e')]===_0x4507('0x1f');var _0x2f338b=_0x1b15b8['count'];var _0x422644=_0xc72652?0x0:_0x483739[_0x4507('0x1d')];var _0x1a7fca=_0xc72652?_0x1b15b8[_0x4507('0x20')]:_0x483739[_0x4507('0x1d')]+_0x483739[_0x4507('0x1e')];var _0x327a0a;if(_0x1a7fca>=_0x2f338b){_0x1a7fca=_0x2f338b;_0x327a0a=0xc8;}else{_0x327a0a=0xce;}_0x4c4fce[_0x4507('0x1b')](_0x327a0a);return _0x4c4fce[_0x4507('0x21')](_0x4507('0x22'),_0x422644+'-'+_0x1a7fca+'/'+_0x2f338b)[_0x4507('0x1c')](_0x1b15b8);}return null;};}function patchUpdates(_0x4035b8){return function(_0x1742d8){try{jsonpatch[_0x4507('0x23')](_0x1742d8,_0x4035b8,!![]);}catch(_0x4a412f){return BPromise[_0x4507('0x24')](_0x4a412f);}return _0x1742d8[_0x4507('0x25')]();};}function saveUpdates(_0x40bb7e,_0x4845dd){return function(_0x1e60f7){if(_0x1e60f7){return _0x1e60f7[_0x4507('0x26')](_0x40bb7e)[_0x4507('0x27')](function(_0x543c6f){return _0x543c6f;});}return null;};}function removeEntity(_0x7e1106,_0x396558){return function(_0x4ef590){if(_0x4ef590){return _0x4ef590['destroy']()[_0x4507('0x27')](function(){_0x7e1106[_0x4507('0x1b')](0xcc)[_0x4507('0x28')]();});}};}function handleEntityNotFound(_0x173460,_0x12ad48){return function(_0x2e2c00){if(!_0x2e2c00){_0x173460[_0x4507('0x1a')](0x194);}return _0x2e2c00;};}function handleError(_0x5b91dc,_0x3239ae){_0x3239ae=_0x3239ae||0x1f4;return function(_0x2cd2c6){logger[_0x4507('0x29')](_0x2cd2c6['stack']);if(_0x2cd2c6[_0x4507('0x2a')]){delete _0x2cd2c6[_0x4507('0x2a')];}_0x5b91dc[_0x4507('0x1b')](_0x3239ae)['send'](_0x2cd2c6);};}exports['index']=function(_0x515b0c,_0x517e22){var _0x1f4a9c={},_0x36aac8={},_0x32c7fb={'count':0x0,'rows':[]};var _0x3cc44f=_[_0x4507('0x2b')](db[_0x4507('0x2c')]['rawAttributes'],function(_0xd21d9a){return{'name':_0xd21d9a[_0x4507('0x2d')],'type':_0xd21d9a['type'][_0x4507('0x2e')]};});_0x36aac8['model']=_[_0x4507('0x2b')](_0x3cc44f,_0x4507('0x2a'));_0x36aac8['query']=_[_0x4507('0x2f')](_0x515b0c[_0x4507('0x30')]);_0x36aac8['filters']=_[_0x4507('0x31')](_0x36aac8['model'],_0x36aac8[_0x4507('0x30')]);_0x1f4a9c[_0x4507('0x32')]=_[_0x4507('0x31')](_0x36aac8['model'],qs['fields'](_0x515b0c[_0x4507('0x30')]['fields']));_0x1f4a9c[_0x4507('0x32')]=_0x1f4a9c['attributes'][_0x4507('0x33')]?_0x1f4a9c['attributes']:_0x36aac8[_0x4507('0x34')];if(!_0x515b0c[_0x4507('0x30')][_0x4507('0x35')]('nolimit')){_0x1f4a9c[_0x4507('0x1e')]=qs[_0x4507('0x1e')](_0x515b0c['query']['limit']);_0x1f4a9c[_0x4507('0x1d')]=qs[_0x4507('0x1d')](_0x515b0c[_0x4507('0x30')][_0x4507('0x1d')]);}_0x1f4a9c['order']=qs[_0x4507('0x36')](_0x515b0c[_0x4507('0x30')][_0x4507('0x36')]);_0x1f4a9c[_0x4507('0x37')]=qs[_0x4507('0x38')](_[_0x4507('0x39')](_0x515b0c[_0x4507('0x30')],_0x36aac8[_0x4507('0x38')]),_0x3cc44f);if(_0x515b0c[_0x4507('0x30')][_0x4507('0x3a')]){_0x1f4a9c[_0x4507('0x37')]=_[_0x4507('0x3b')](_0x1f4a9c['where'],{'$or':_['map'](_0x3cc44f,function(_0x2b5c90){if(_0x2b5c90[_0x4507('0x3c')]!==_0x4507('0x3d')){var _0x2dd400={};_0x2dd400[_0x2b5c90[_0x4507('0x2a')]]={'$like':'%'+_0x515b0c[_0x4507('0x30')][_0x4507('0x3a')]+'%'};return _0x2dd400;}})});}_0x1f4a9c=_[_0x4507('0x3b')]({},_0x1f4a9c,_0x515b0c[_0x4507('0x3e')]);var _0x320b10={'where':_0x1f4a9c[_0x4507('0x37')]};return db[_0x4507('0x2c')][_0x4507('0x20')](_0x320b10)[_0x4507('0x27')](function(_0x2d6f32){_0x32c7fb[_0x4507('0x20')]=_0x2d6f32;if(_0x515b0c['query'][_0x4507('0x3f')]){_0x1f4a9c[_0x4507('0x40')]=[{'all':!![]}];}return db[_0x4507('0x2c')][_0x4507('0x41')](_0x1f4a9c);})['then'](function(_0x40edc4){_0x32c7fb[_0x4507('0x42')]=_0x40edc4;return _0x32c7fb;})[_0x4507('0x27')](respondWithFilteredResult(_0x517e22,_0x1f4a9c))[_0x4507('0x43')](handleError(_0x517e22,null));};exports[_0x4507('0x44')]=function(_0x2e7d03,_0x442ae0){var _0x5aa991={'raw':!![],'where':{'id':_0x2e7d03[_0x4507('0x45')]['id']}},_0x5ddf92={};_0x5ddf92[_0x4507('0x34')]=_[_0x4507('0x2f')](db[_0x4507('0x2c')]['rawAttributes']);_0x5ddf92[_0x4507('0x30')]=_['keys'](_0x2e7d03[_0x4507('0x30')]);_0x5ddf92[_0x4507('0x38')]=_[_0x4507('0x31')](_0x5ddf92[_0x4507('0x34')],_0x5ddf92[_0x4507('0x30')]);_0x5aa991['attributes']=_[_0x4507('0x31')](_0x5ddf92[_0x4507('0x34')],qs[_0x4507('0x46')](_0x2e7d03[_0x4507('0x30')][_0x4507('0x46')]));_0x5aa991[_0x4507('0x32')]=_0x5aa991['attributes'][_0x4507('0x33')]?_0x5aa991[_0x4507('0x32')]:_0x5ddf92[_0x4507('0x34')];if(_0x2e7d03['query'][_0x4507('0x3f')]){_0x5aa991['include']=[{'all':!![]}];}_0x5aa991=_[_0x4507('0x3b')]({},_0x5aa991,_0x2e7d03[_0x4507('0x3e')]);return db[_0x4507('0x2c')][_0x4507('0x47')](_0x5aa991)[_0x4507('0x27')](handleEntityNotFound(_0x442ae0,null))[_0x4507('0x27')](respondWithResult(_0x442ae0,null))['catch'](handleError(_0x442ae0,null));};exports[_0x4507('0x48')]=function(_0x2c79ef,_0x27aa7d){return db[_0x4507('0x2c')][_0x4507('0x48')](_0x2c79ef[_0x4507('0x49')],{})[_0x4507('0x27')](respondWithResult(_0x27aa7d,0xc9))[_0x4507('0x43')](handleError(_0x27aa7d,null));};exports[_0x4507('0x26')]=function(_0x59a993,_0x504506){if(_0x59a993[_0x4507('0x49')]['id']){delete _0x59a993[_0x4507('0x49')]['id'];}return db[_0x4507('0x2c')][_0x4507('0x47')]({'where':{'id':_0x59a993[_0x4507('0x45')]['id']}})[_0x4507('0x27')](handleEntityNotFound(_0x504506,null))[_0x4507('0x27')](saveUpdates(_0x59a993[_0x4507('0x49')],null))[_0x4507('0x27')](respondWithResult(_0x504506,null))['catch'](handleError(_0x504506,null));};exports[_0x4507('0x4a')]=function(_0x15ece4,_0x4a0f37){return db[_0x4507('0x2c')][_0x4507('0x47')]({'where':{'id':_0x15ece4['params']['id']}})['then'](handleEntityNotFound(_0x4a0f37,null))[_0x4507('0x27')](removeEntity(_0x4a0f37,null))[_0x4507('0x43')](handleError(_0x4a0f37,null));};exports['describe']=function(_0x42a9f2,_0x50e892){return db[_0x4507('0x2c')][_0x4507('0x4b')]()[_0x4507('0x27')](respondWithResult(_0x50e892,null))[_0x4507('0x43')](handleError(_0x50e892,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a11a0e1..79c94d2 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 _0xe724=['./jscriptyQuestionReport.attributes','define','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x132d12,_0x2c9799){var _0x1c3163=function(_0x7d9136){while(--_0x7d9136){_0x132d12['push'](_0x132d12['shift']());}};_0x1c3163(++_0x2c9799);}(_0xe724,0x185));var _0x4e72=function(_0x45b29d,_0x44ce43){_0x45b29d=_0x45b29d-0x0;var _0x32d74=_0xe724[_0x45b29d];return _0x32d74;};'use strict';var _=require('lodash');var util=require(_0x4e72('0x0'));var logger=require(_0x4e72('0x1'))(_0x4e72('0x2'));var moment=require('moment');var BPromise=require(_0x4e72('0x3'));var rp=require(_0x4e72('0x4'));var fs=require('fs');var path=require(_0x4e72('0x5'));var rimraf=require('rimraf');var config=require(_0x4e72('0x6'));var attributes=require(_0x4e72('0x7'));module['exports']=function(_0x49f9dd,_0x22b36c){return _0x49f9dd[_0x4e72('0x8')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3e4=['moment','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x8333c3,_0x4dc628){var _0x46a701=function(_0x592d50){while(--_0x592d50){_0x8333c3['push'](_0x8333c3['shift']());}};_0x46a701(++_0x4dc628);}(_0xa3e4,0x107));var _0x4a3e=function(_0x5826da,_0x4ffb7f){_0x5826da=_0x5826da-0x0;var _0x127236=_0xa3e4[_0x5826da];return _0x127236;};'use strict';var _=require(_0x4a3e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4a3e('0x1'));var BPromise=require(_0x4a3e('0x2'));var rp=require(_0x4a3e('0x3'));var fs=require('fs');var path=require(_0x4a3e('0x4'));var rimraf=require(_0x4a3e('0x5'));var config=require('../../config/environment');var attributes=require(_0x4a3e('0x6'));module[_0x4a3e('0x7')]=function(_0x3e312d,_0xbb9ea){return _0x3e312d[_0x4a3e('0x8')](_0x4a3e('0x9'),attributes,{'tableName':_0x4a3e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 3adefd4..befc59a 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 _0x4a4e=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3a63db,_0x7ae92d){var _0x588e67=function(_0x12c287){while(--_0x12c287){_0x3a63db['push'](_0x3a63db['shift']());}};_0x588e67(++_0x7ae92d);}(_0x4a4e,0x191));var _0xe4a4=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x4a4e[_0x5cbace];return _0x6de5b8;};'use strict';var _=require(_0xe4a4('0x0'));var util=require(_0xe4a4('0x1'));var moment=require(_0xe4a4('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4a4('0x3'));var fs=require('fs');var Redis=require(_0xe4a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4a4('0x5'));var logger=require('../../config/logger')(_0xe4a4('0x6'));var config=require(_0xe4a4('0x7'));var jayson=require(_0xe4a4('0x8'));var client=jayson[_0xe4a4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24d3f2,_0x15ce43,_0x182a44){return new BPromise(function(_0x2aabce,_0x10872){return client['request'](_0x24d3f2,_0x182a44)[_0xe4a4('0xa')](function(_0x269108){logger[_0xe4a4('0xb')](_0xe4a4('0xc'),_0x15ce43,'request\x20sent');logger['debug'](_0xe4a4('0xd'),_0x15ce43,'request\x20sent',JSON[_0xe4a4('0xe')](_0x269108));if(_0x269108[_0xe4a4('0xf')]){if(_0x269108[_0xe4a4('0xf')][_0xe4a4('0x10')]===0x1f4){logger['error'](_0xe4a4('0xc'),_0x15ce43,_0x269108['error'][_0xe4a4('0x11')]);return _0x10872(_0x269108[_0xe4a4('0xf')][_0xe4a4('0x11')]);}logger[_0xe4a4('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x15ce43,_0x269108[_0xe4a4('0xf')][_0xe4a4('0x11')]);return _0x2aabce(_0x269108[_0xe4a4('0xf')][_0xe4a4('0x11')]);}else{logger['info'](_0xe4a4('0xc'),_0x15ce43,'request\x20sent');_0x2aabce(_0x269108[_0xe4a4('0x12')]['message']);}})[_0xe4a4('0x13')](function(_0x202b4d){logger['error'](_0xe4a4('0xc'),_0x15ce43,_0x202b4d);_0x10872(_0x202b4d);});});} \ No newline at end of file +var _0x4a57=['randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x4a57,0xcb));var _0x74a5=function(_0x23402b,_0x421ac9){_0x23402b=_0x23402b-0x0;var _0x3a21c7=_0x4a57[_0x23402b];return _0x3a21c7;};'use strict';var _=require(_0x74a5('0x0'));var util=require(_0x74a5('0x1'));var moment=require(_0x74a5('0x2'));var BPromise=require(_0x74a5('0x3'));var rs=require(_0x74a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74a5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x74a5('0x6'))('rpc');var config=require(_0x74a5('0x7'));var jayson=require(_0x74a5('0x8'));var client=jayson[_0x74a5('0x9')][_0x74a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92d3f4,_0x315b49,_0x55672f){return new BPromise(function(_0x3e3f3c,_0x2fd5b5){return client[_0x74a5('0xb')](_0x92d3f4,_0x55672f)[_0x74a5('0xc')](function(_0x1669fe){logger['info'](_0x74a5('0xd'),_0x315b49,_0x74a5('0xe'));logger[_0x74a5('0xf')](_0x74a5('0x10'),_0x315b49,_0x74a5('0xe'),JSON[_0x74a5('0x11')](_0x1669fe));if(_0x1669fe[_0x74a5('0x12')]){if(_0x1669fe[_0x74a5('0x12')][_0x74a5('0x13')]===0x1f4){logger[_0x74a5('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x315b49,_0x1669fe['error'][_0x74a5('0x14')]);return _0x2fd5b5(_0x1669fe[_0x74a5('0x12')][_0x74a5('0x14')]);}logger[_0x74a5('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x315b49,_0x1669fe[_0x74a5('0x12')][_0x74a5('0x14')]);return _0x3e3f3c(_0x1669fe[_0x74a5('0x12')][_0x74a5('0x14')]);}else{logger[_0x74a5('0x15')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x315b49,'request\x20sent');_0x3e3f3c(_0x1669fe['result']['message']);}})[_0x74a5('0x16')](function(_0x289a2f){logger['error'](_0x74a5('0xd'),_0x315b49,_0x289a2f);_0x2fd5b5(_0x289a2f);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index fa6fac6..e4ae76a 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 _0x22ef=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/questions','getQuestions','post','put','update','destroy','exports'];(function(_0x131cce,_0x5beb30){var _0x38f709=function(_0x3f8e0c){while(--_0x3f8e0c){_0x131cce['push'](_0x131cce['shift']());}};_0x38f709(++_0x5beb30);}(_0x22ef,0x111));var _0xf22e=function(_0x4914b3,_0x9569f1){_0x4914b3=_0x4914b3-0x0;var _0x1cad8b=_0x22ef[_0x4914b3];return _0x1cad8b;};'use strict';var multer=require(_0xf22e('0x0'));var util=require('util');var path=require(_0xf22e('0x1'));var timeout=require(_0xf22e('0x2'));var express=require(_0xf22e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf22e('0x4'));var interaction=require(_0xf22e('0x5'));var config=require(_0xf22e('0x6'));var controller=require(_0xf22e('0x7'));router[_0xf22e('0x8')]('/',auth[_0xf22e('0x9')](),controller[_0xf22e('0xa')]);router['get'](_0xf22e('0xb'),auth['isAuthenticated'](),controller[_0xf22e('0xc')]);router['get'](_0xf22e('0xd'),auth[_0xf22e('0x9')](),controller['show']);router[_0xf22e('0x8')](_0xf22e('0xe'),auth['isAuthenticated'](),controller[_0xf22e('0xf')]);router[_0xf22e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf22e('0x11')](_0xf22e('0xd'),auth[_0xf22e('0x9')](),controller[_0xf22e('0x12')]);router['delete'](_0xf22e('0xd'),auth[_0xf22e('0x9')](),controller[_0xf22e('0x13')]);module[_0xf22e('0x14')]=router; \ No newline at end of file +var _0x17fe=['get','index','/describe','describe','/:id','isAuthenticated','show','/:id/questions','getQuestions','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x17fe,0x199));var _0xe17f=function(_0x333326,_0x305ddb){_0x333326=_0x333326-0x0;var _0x3d4223=_0x17fe[_0x333326];return _0x3d4223;};'use strict';var multer=require(_0xe17f('0x0'));var util=require(_0xe17f('0x1'));var path=require(_0xe17f('0x2'));var timeout=require(_0xe17f('0x3'));var express=require('express');var router=express[_0xe17f('0x4')]();var fs_extra=require(_0xe17f('0x5'));var auth=require(_0xe17f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe17f('0x7'));var controller=require(_0xe17f('0x8'));router[_0xe17f('0x9')]('/',auth['isAuthenticated'](),controller[_0xe17f('0xa')]);router[_0xe17f('0x9')](_0xe17f('0xb'),auth['isAuthenticated'](),controller[_0xe17f('0xc')]);router['get'](_0xe17f('0xd'),auth[_0xe17f('0xe')](),controller[_0xe17f('0xf')]);router['get'](_0xe17f('0x10'),auth['isAuthenticated'](),controller[_0xe17f('0x11')]);router['post']('/',auth[_0xe17f('0xe')](),controller['create']);router[_0xe17f('0x12')](_0xe17f('0xd'),auth['isAuthenticated'](),controller[_0xe17f('0x13')]);router['delete'](_0xe17f('0xd'),auth[_0xe17f('0xe')](),controller[_0xe17f('0x14')]);module[_0xe17f('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 0c2e970..952609d 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 _0x4ab6=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize'];(function(_0x30dae0,_0x57caa0){var _0x292e6d=function(_0x399317){while(--_0x399317){_0x30dae0['push'](_0x30dae0['shift']());}};_0x292e6d(++_0x57caa0);}(_0x4ab6,0x1a6));var _0x64ab=function(_0x13d2a5,_0x5016a4){_0x13d2a5=_0x13d2a5-0x0;var _0x437a87=_0x4ab6[_0x13d2a5];return _0x437a87;};'use strict';var moment=require('moment');var Sequelize=require(_0x64ab('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x64ab('0x1')],'set':function(_0x5e5505){this[_0x64ab('0x2')](_0x64ab('0x3'),_0x5e5505);this[_0x64ab('0x2')](_0x64ab('0x4'),moment()[_0x64ab('0x5')](_0x64ab('0x6')));}},'endtime':{'type':Sequelize[_0x64ab('0x1')]},'membername':{'type':Sequelize[_0x64ab('0x7')]},'projectname':{'type':Sequelize[_0x64ab('0x7')]},'queue':{'type':Sequelize[_0x64ab('0x7')]},'uniqueid':{'type':Sequelize[_0x64ab('0x7')]},'calleridname':{'type':Sequelize[_0x64ab('0x7')]},'calleridnum':{'type':Sequelize[_0x64ab('0x7')]},'completed':{'type':Sequelize[_0x64ab('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x9333=['STRING','BOOLEAN','moment','sequelize','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x3e19b9,_0xe2b180){var _0x81c052=function(_0x1010dd){while(--_0x1010dd){_0x3e19b9['push'](_0x3e19b9['shift']());}};_0x81c052(++_0xe2b180);}(_0x9333,0x122));var _0x3933=function(_0x248fd5,_0x13e9a0){_0x248fd5=_0x248fd5-0x0;var _0x56bb6e=_0x9333[_0x248fd5];return _0x56bb6e;};'use strict';var moment=require(_0x3933('0x0'));var Sequelize=require(_0x3933('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1ea0b1){this[_0x3933('0x2')]('starttime',_0x1ea0b1);this['setDataValue'](_0x3933('0x3'),moment()[_0x3933('0x4')](_0x3933('0x5')));}},'endtime':{'type':Sequelize[_0x3933('0x6')]},'membername':{'type':Sequelize[_0x3933('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3933('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x3933('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 3a9d22f..15dea55 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 _0x71bd=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','end','sendStatus','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','where','merge','type','VIRTUAL','filter','options','JscriptySessionReport','includeAll','include','rows','catch','params','length','find','create','body','destroy','describe','getQuestions','order','sort','pick','SessionId','JscriptyQuestionReport','findAll','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x5910a1,_0x29785){var _0x5b64c3=function(_0x45c1a0){while(--_0x45c1a0){_0x5910a1['push'](_0x5910a1['shift']());}};_0x5b64c3(++_0x29785);}(_0x71bd,0x8b));var _0xd71b=function(_0x223ca3,_0x4953b6){_0x223ca3=_0x223ca3-0x0;var _0x84179d=_0x71bd[_0x223ca3];return _0x84179d;};'use strict';var emlformat=require(_0xd71b('0x0'));var rimraf=require(_0xd71b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd71b('0x2'));var rp=require('request-promise');var moment=require(_0xd71b('0x3'));var BPromise=require(_0xd71b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd71b('0x5'));var csv=require(_0xd71b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd71b('0x7'));var squel=require(_0xd71b('0x8'));var crypto=require(_0xd71b('0x9'));var jsforce=require(_0xd71b('0xa'));var deskjs=require(_0xd71b('0xb'));var toCsv=require(_0xd71b('0x6'));var querystring=require(_0xd71b('0xc'));var Papa=require(_0xd71b('0xd'));var Redis=require('ioredis');var authService=require(_0xd71b('0xe'));var qs=require(_0xd71b('0xf'));var as=require(_0xd71b('0x10'));var hardwareService=require(_0xd71b('0x11'));var logger=require(_0xd71b('0x12'))(_0xd71b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd71b('0x14'))['db'];function respondWithStatusCode(_0x5f36c9,_0x553c4a){_0x553c4a=_0x553c4a||0xcc;return function(_0x2dd4ed){if(_0x2dd4ed){return _0x5f36c9['sendStatus'](_0x553c4a);}return _0x5f36c9[_0xd71b('0x15')](_0x553c4a)['end']();};}function respondWithResult(_0x3a188e,_0x55263a){_0x55263a=_0x55263a||0xc8;return function(_0x113ef5){if(_0x113ef5){return _0x3a188e[_0xd71b('0x15')](_0x55263a)[_0xd71b('0x16')](_0x113ef5);}};}function respondWithFilteredResult(_0x525e8a,_0x3cd925){return function(_0x1137ed){if(_0x1137ed){var _0xa2a21e=typeof _0x3cd925[_0xd71b('0x17')]==='undefined'&&typeof _0x3cd925['limit']===_0xd71b('0x18');var _0x20eefe=_0x1137ed[_0xd71b('0x19')];var _0x22813f=_0xa2a21e?0x0:_0x3cd925[_0xd71b('0x17')];var _0x1a1764=_0xa2a21e?_0x1137ed[_0xd71b('0x19')]:_0x3cd925[_0xd71b('0x17')]+_0x3cd925['limit'];var _0x578a78;if(_0x1a1764>=_0x20eefe){_0x1a1764=_0x20eefe;_0x578a78=0xc8;}else{_0x578a78=0xce;}_0x525e8a['status'](_0x578a78);return _0x525e8a[_0xd71b('0x1a')](_0xd71b('0x1b'),_0x22813f+'-'+_0x1a1764+'/'+_0x20eefe)[_0xd71b('0x16')](_0x1137ed);}return null;};}function patchUpdates(_0x4ca162){return function(_0x3ad468){try{jsonpatch[_0xd71b('0x1c')](_0x3ad468,_0x4ca162,!![]);}catch(_0xa638c6){return BPromise[_0xd71b('0x1d')](_0xa638c6);}return _0x3ad468['save']();};}function saveUpdates(_0x33584a,_0x5e35ff){return function(_0x4100e1){if(_0x4100e1){return _0x4100e1[_0xd71b('0x1e')](_0x33584a)['then'](function(_0x487d3c){return _0x487d3c;});}return null;};}function removeEntity(_0x5e50ff,_0x21c6ee){return function(_0x1afbdf){if(_0x1afbdf){return _0x1afbdf['destroy']()[_0xd71b('0x1f')](function(){_0x5e50ff[_0xd71b('0x15')](0xcc)[_0xd71b('0x20')]();});}};}function handleEntityNotFound(_0x350221,_0x35a5c9){return function(_0x4e7814){if(!_0x4e7814){_0x350221[_0xd71b('0x21')](0x194);}return _0x4e7814;};}function handleError(_0x4a47a8,_0x1dc21e){_0x1dc21e=_0x1dc21e||0x1f4;return function(_0x5b9368){logger['error'](_0x5b9368[_0xd71b('0x22')]);if(_0x5b9368[_0xd71b('0x23')]){delete _0x5b9368['name'];}_0x4a47a8[_0xd71b('0x15')](_0x1dc21e)['send'](_0x5b9368);};}exports['index']=function(_0xf35610,_0x324b0b){var _0x10580f={},_0x431dc8={},_0x2c5ad5={'count':0x0,'rows':[]};var _0x5e1d3c=_[_0xd71b('0x24')](db['JscriptySessionReport'][_0xd71b('0x25')],function(_0x39b9b3){return{'name':_0x39b9b3[_0xd71b('0x26')],'type':_0x39b9b3['type'][_0xd71b('0x27')]};});_0x431dc8[_0xd71b('0x28')]=_[_0xd71b('0x24')](_0x5e1d3c,'name');_0x431dc8[_0xd71b('0x29')]=_[_0xd71b('0x2a')](_0xf35610[_0xd71b('0x29')]);_0x431dc8[_0xd71b('0x2b')]=_['intersection'](_0x431dc8[_0xd71b('0x28')],_0x431dc8[_0xd71b('0x29')]);_0x10580f[_0xd71b('0x2c')]=_[_0xd71b('0x2d')](_0x431dc8[_0xd71b('0x28')],qs[_0xd71b('0x2e')](_0xf35610[_0xd71b('0x29')][_0xd71b('0x2e')]));_0x10580f[_0xd71b('0x2c')]=_0x10580f[_0xd71b('0x2c')]['length']?_0x10580f[_0xd71b('0x2c')]:_0x431dc8[_0xd71b('0x28')];if(!_0xf35610[_0xd71b('0x29')][_0xd71b('0x2f')](_0xd71b('0x30'))){_0x10580f['limit']=qs[_0xd71b('0x31')](_0xf35610['query'][_0xd71b('0x31')]);_0x10580f[_0xd71b('0x17')]=qs[_0xd71b('0x17')](_0xf35610[_0xd71b('0x29')][_0xd71b('0x17')]);}_0x10580f['order']=qs['sort'](_0xf35610[_0xd71b('0x29')]['sort']);_0x10580f[_0xd71b('0x32')]=qs['filters'](_['pick'](_0xf35610[_0xd71b('0x29')],_0x431dc8[_0xd71b('0x2b')]),_0x5e1d3c);if(_0xf35610[_0xd71b('0x29')]['filter']){_0x10580f[_0xd71b('0x32')]=_[_0xd71b('0x33')](_0x10580f['where'],{'$or':_[_0xd71b('0x24')](_0x5e1d3c,function(_0x59d86f){if(_0x59d86f[_0xd71b('0x34')]!==_0xd71b('0x35')){var _0x2fd264={};_0x2fd264[_0x59d86f[_0xd71b('0x23')]]={'$like':'%'+_0xf35610[_0xd71b('0x29')][_0xd71b('0x36')]+'%'};return _0x2fd264;}})});}_0x10580f=_['merge']({},_0x10580f,_0xf35610[_0xd71b('0x37')]);var _0x504b8d={'where':_0x10580f[_0xd71b('0x32')]};return db[_0xd71b('0x38')][_0xd71b('0x19')](_0x504b8d)[_0xd71b('0x1f')](function(_0x39d542){_0x2c5ad5[_0xd71b('0x19')]=_0x39d542;if(_0xf35610[_0xd71b('0x29')][_0xd71b('0x39')]){_0x10580f[_0xd71b('0x3a')]=[{'all':!![]}];}return db[_0xd71b('0x38')]['findAll'](_0x10580f);})['then'](function(_0xb0d4b7){_0x2c5ad5[_0xd71b('0x3b')]=_0xb0d4b7;return _0x2c5ad5;})[_0xd71b('0x1f')](respondWithFilteredResult(_0x324b0b,_0x10580f))[_0xd71b('0x3c')](handleError(_0x324b0b,null));};exports['show']=function(_0x4af2b1,_0x5b86ee){var _0x11bddb={'raw':!![],'where':{'id':_0x4af2b1[_0xd71b('0x3d')]['id']}},_0x498461={};_0x498461['model']=_[_0xd71b('0x2a')](db[_0xd71b('0x38')]['rawAttributes']);_0x498461[_0xd71b('0x29')]=_[_0xd71b('0x2a')](_0x4af2b1[_0xd71b('0x29')]);_0x498461[_0xd71b('0x2b')]=_[_0xd71b('0x2d')](_0x498461[_0xd71b('0x28')],_0x498461['query']);_0x11bddb[_0xd71b('0x2c')]=_['intersection'](_0x498461['model'],qs['fields'](_0x4af2b1[_0xd71b('0x29')]['fields']));_0x11bddb['attributes']=_0x11bddb[_0xd71b('0x2c')][_0xd71b('0x3e')]?_0x11bddb[_0xd71b('0x2c')]:_0x498461[_0xd71b('0x28')];if(_0x4af2b1[_0xd71b('0x29')]['includeAll']){_0x11bddb[_0xd71b('0x3a')]=[{'all':!![]}];}_0x11bddb=_[_0xd71b('0x33')]({},_0x11bddb,_0x4af2b1[_0xd71b('0x37')]);return db['JscriptySessionReport'][_0xd71b('0x3f')](_0x11bddb)[_0xd71b('0x1f')](handleEntityNotFound(_0x5b86ee,null))[_0xd71b('0x1f')](respondWithResult(_0x5b86ee,null))['catch'](handleError(_0x5b86ee,null));};exports[_0xd71b('0x40')]=function(_0x16b49e,_0x1b8b26){return db[_0xd71b('0x38')][_0xd71b('0x40')](_0x16b49e[_0xd71b('0x41')],{})[_0xd71b('0x1f')](respondWithResult(_0x1b8b26,0xc9))[_0xd71b('0x3c')](handleError(_0x1b8b26,null));};exports[_0xd71b('0x1e')]=function(_0x54df90,_0x4f70fe){if(_0x54df90[_0xd71b('0x41')]['id']){delete _0x54df90[_0xd71b('0x41')]['id'];}return db[_0xd71b('0x38')]['find']({'where':{'id':_0x54df90[_0xd71b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4f70fe,null))['then'](saveUpdates(_0x54df90[_0xd71b('0x41')],null))[_0xd71b('0x1f')](respondWithResult(_0x4f70fe,null))[_0xd71b('0x3c')](handleError(_0x4f70fe,null));};exports[_0xd71b('0x42')]=function(_0x14b78c,_0x5e6023){return db[_0xd71b('0x38')][_0xd71b('0x3f')]({'where':{'id':_0x14b78c[_0xd71b('0x3d')]['id']}})[_0xd71b('0x1f')](handleEntityNotFound(_0x5e6023,null))['then'](removeEntity(_0x5e6023,null))['catch'](handleError(_0x5e6023,null));};exports[_0xd71b('0x43')]=function(_0x46e134,_0x274af0){return db[_0xd71b('0x38')]['describe']()[_0xd71b('0x1f')](respondWithResult(_0x274af0,null))[_0xd71b('0x3c')](handleError(_0x274af0,null));};exports[_0xd71b('0x44')]=function(_0x21b09a,_0x3881ef,_0x16bdb2){var _0x1144f3={'raw':!![],'where':{}};var _0x49aa7d={};var _0x51e060={'count':0x0,'rows':[]};return db[_0xd71b('0x38')]['findOne']({'where':{'id':_0x21b09a[_0xd71b('0x3d')]['id']}})[_0xd71b('0x1f')](handleEntityNotFound(_0x3881ef,null))[_0xd71b('0x1f')](function(_0x3458de){if(_0x3458de){_0x49aa7d['model']=_[_0xd71b('0x2a')](db['JscriptyQuestionReport'][_0xd71b('0x25')]);_0x49aa7d['query']=_[_0xd71b('0x2a')](_0x21b09a['query']);_0x49aa7d[_0xd71b('0x2b')]=_[_0xd71b('0x2d')](_0x49aa7d[_0xd71b('0x28')],_0x49aa7d[_0xd71b('0x29')]);_0x1144f3['attributes']=_[_0xd71b('0x2d')](_0x49aa7d[_0xd71b('0x28')],qs[_0xd71b('0x2e')](_0x21b09a['query'][_0xd71b('0x2e')]));_0x1144f3[_0xd71b('0x2c')]=_0x1144f3['attributes'][_0xd71b('0x3e')]?_0x1144f3[_0xd71b('0x2c')]:_0x49aa7d[_0xd71b('0x28')];if(!_0x21b09a['query'][_0xd71b('0x2f')]('nolimit')){_0x1144f3['limit']=qs[_0xd71b('0x31')](_0x21b09a[_0xd71b('0x29')]['limit']);_0x1144f3[_0xd71b('0x17')]=qs[_0xd71b('0x17')](_0x21b09a['query'][_0xd71b('0x17')]);}_0x1144f3[_0xd71b('0x45')]=qs['sort'](_0x21b09a['query'][_0xd71b('0x46')]);_0x1144f3['where']=qs['filters'](_[_0xd71b('0x47')](_0x21b09a['query'],_0x49aa7d[_0xd71b('0x2b')]));_0x1144f3[_0xd71b('0x32')][_0xd71b('0x48')]=_0x3458de['id'];if(_0x21b09a[_0xd71b('0x29')][_0xd71b('0x36')]){_0x1144f3[_0xd71b('0x32')]=_[_0xd71b('0x33')](_0x1144f3['where'],{'$or':_['map'](_0x1144f3[_0xd71b('0x2c')],function(_0x2b0c00){var _0x1c9986={};_0x1c9986[_0x2b0c00]={'$like':'%'+_0x21b09a['query'][_0xd71b('0x36')]+'%'};return _0x1c9986;})});}_0x1144f3=_[_0xd71b('0x33')]({},_0x1144f3,_0x21b09a[_0xd71b('0x37')]);return db['JscriptyQuestionReport'][_0xd71b('0x19')]({'where':_0x1144f3['where']})[_0xd71b('0x1f')](function(_0x9fb3b2){_0x51e060[_0xd71b('0x19')]=_0x9fb3b2;if(_0x21b09a['query'][_0xd71b('0x39')]){_0x1144f3['include']=[{'all':!![]}];}return db[_0xd71b('0x49')][_0xd71b('0x4a')](_0x1144f3);})[_0xd71b('0x1f')](function(_0x55a226){_0x51e060[_0xd71b('0x3b')]=_0x55a226;return _0x51e060;});}})[_0xd71b('0x1f')](respondWithFilteredResult(_0x3881ef,_0x1144f3))[_0xd71b('0x3c')](handleError(_0x3881ef,null));}; \ No newline at end of file +var _0xae65=['order','sort','SessionId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','index','JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','body','update','find','describe','getQuestions','JscriptyQuestionReport'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0xae65,0x18e));var _0x5ae6=function(_0x47b262,_0x45a382){_0x47b262=_0x47b262-0x0;var _0x223475=_0xae65[_0x47b262];return _0x223475;};'use strict';var emlformat=require(_0x5ae6('0x0'));var rimraf=require(_0x5ae6('0x1'));var zipdir=require(_0x5ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ae6('0x3'));var moment=require(_0x5ae6('0x4'));var BPromise=require(_0x5ae6('0x5'));var Mustache=require(_0x5ae6('0x6'));var util=require(_0x5ae6('0x7'));var path=require(_0x5ae6('0x8'));var sox=require(_0x5ae6('0x9'));var csv=require('to-csv');var ejs=require(_0x5ae6('0xa'));var fs=require('fs');var fs_extra=require(_0x5ae6('0xb'));var _=require('lodash');var squel=require(_0x5ae6('0xc'));var crypto=require(_0x5ae6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5ae6('0xe'));var toCsv=require(_0x5ae6('0xf'));var querystring=require(_0x5ae6('0x10'));var Papa=require(_0x5ae6('0x11'));var Redis=require(_0x5ae6('0x12'));var authService=require(_0x5ae6('0x13'));var qs=require(_0x5ae6('0x14'));var as=require(_0x5ae6('0x15'));var hardwareService=require(_0x5ae6('0x16'));var logger=require('../../config/logger')(_0x5ae6('0x17'));var utils=require(_0x5ae6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5ae6('0x19'));var db=require(_0x5ae6('0x1a'))['db'];function respondWithStatusCode(_0x4e4dc5,_0x1433e0){_0x1433e0=_0x1433e0||0xcc;return function(_0x1d0f78){if(_0x1d0f78){return _0x4e4dc5['sendStatus'](_0x1433e0);}return _0x4e4dc5[_0x5ae6('0x1b')](_0x1433e0)['end']();};}function respondWithResult(_0x270118,_0x1698a5){_0x1698a5=_0x1698a5||0xc8;return function(_0x52e703){if(_0x52e703){return _0x270118[_0x5ae6('0x1b')](_0x1698a5)['json'](_0x52e703);}};}function respondWithFilteredResult(_0x47a62e,_0x345d90){return function(_0x1ba222){if(_0x1ba222){var _0x3cd933=typeof _0x345d90[_0x5ae6('0x1c')]===_0x5ae6('0x1d')&&typeof _0x345d90[_0x5ae6('0x1e')]==='undefined';var _0xc8ba28=_0x1ba222[_0x5ae6('0x1f')];var _0x676369=_0x3cd933?0x0:_0x345d90[_0x5ae6('0x1c')];var _0x57bf55=_0x3cd933?_0x1ba222[_0x5ae6('0x1f')]:_0x345d90[_0x5ae6('0x1c')]+_0x345d90[_0x5ae6('0x1e')];var _0x132ff7;if(_0x57bf55>=_0xc8ba28){_0x57bf55=_0xc8ba28;_0x132ff7=0xc8;}else{_0x132ff7=0xce;}_0x47a62e[_0x5ae6('0x1b')](_0x132ff7);return _0x47a62e[_0x5ae6('0x20')](_0x5ae6('0x21'),_0x676369+'-'+_0x57bf55+'/'+_0xc8ba28)['json'](_0x1ba222);}return null;};}function patchUpdates(_0x5e3f52){return function(_0x34e68f){try{jsonpatch[_0x5ae6('0x22')](_0x34e68f,_0x5e3f52,!![]);}catch(_0x186fee){return BPromise[_0x5ae6('0x23')](_0x186fee);}return _0x34e68f['save']();};}function saveUpdates(_0x24da77,_0x11d406){return function(_0x3bce66){if(_0x3bce66){return _0x3bce66['update'](_0x24da77)[_0x5ae6('0x24')](function(_0x4f4ecc){return _0x4f4ecc;});}return null;};}function removeEntity(_0x2256c2,_0x117567){return function(_0x1ff030){if(_0x1ff030){return _0x1ff030[_0x5ae6('0x25')]()[_0x5ae6('0x24')](function(){_0x2256c2[_0x5ae6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6d65,_0x3fffe8){return function(_0x4227f0){if(!_0x4227f0){_0x1e6d65['sendStatus'](0x194);}return _0x4227f0;};}function handleError(_0x7da868,_0x2fdedc){_0x2fdedc=_0x2fdedc||0x1f4;return function(_0x4887ad){logger['error'](_0x4887ad[_0x5ae6('0x26')]);if(_0x4887ad[_0x5ae6('0x27')]){delete _0x4887ad[_0x5ae6('0x27')];}_0x7da868[_0x5ae6('0x1b')](_0x2fdedc)['send'](_0x4887ad);};}exports[_0x5ae6('0x28')]=function(_0x5f2533,_0x140fe2){var _0x31aedd={},_0x4fde8f={},_0x468b95={'count':0x0,'rows':[]};var _0x13aa06=_['map'](db[_0x5ae6('0x29')][_0x5ae6('0x2a')],function(_0x4176de){return{'name':_0x4176de[_0x5ae6('0x2b')],'type':_0x4176de['type'][_0x5ae6('0x2c')]};});_0x4fde8f[_0x5ae6('0x2d')]=_['map'](_0x13aa06,_0x5ae6('0x27'));_0x4fde8f[_0x5ae6('0x2e')]=_[_0x5ae6('0x2f')](_0x5f2533[_0x5ae6('0x2e')]);_0x4fde8f['filters']=_[_0x5ae6('0x30')](_0x4fde8f[_0x5ae6('0x2d')],_0x4fde8f[_0x5ae6('0x2e')]);_0x31aedd[_0x5ae6('0x31')]=_['intersection'](_0x4fde8f[_0x5ae6('0x2d')],qs[_0x5ae6('0x32')](_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x32')]));_0x31aedd['attributes']=_0x31aedd['attributes'][_0x5ae6('0x33')]?_0x31aedd[_0x5ae6('0x31')]:_0x4fde8f[_0x5ae6('0x2d')];if(!_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x34')](_0x5ae6('0x35'))){_0x31aedd['limit']=qs[_0x5ae6('0x1e')](_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x1e')]);_0x31aedd[_0x5ae6('0x1c')]=qs[_0x5ae6('0x1c')](_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x1c')]);}_0x31aedd['order']=qs['sort'](_0x5f2533[_0x5ae6('0x2e')]['sort']);_0x31aedd[_0x5ae6('0x36')]=qs[_0x5ae6('0x37')](_[_0x5ae6('0x38')](_0x5f2533['query'],_0x4fde8f['filters']),_0x13aa06);if(_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x39')]){_0x31aedd[_0x5ae6('0x36')]=_['merge'](_0x31aedd[_0x5ae6('0x36')],{'$or':_[_0x5ae6('0x3a')](_0x13aa06,function(_0x45d85e){if(_0x45d85e[_0x5ae6('0x3b')]!==_0x5ae6('0x3c')){var _0x2f5dc6={};_0x2f5dc6[_0x45d85e[_0x5ae6('0x27')]]={'$like':'%'+_0x5f2533[_0x5ae6('0x2e')]['filter']+'%'};return _0x2f5dc6;}})});}_0x31aedd=_[_0x5ae6('0x3d')]({},_0x31aedd,_0x5f2533[_0x5ae6('0x3e')]);var _0x44f9b9={'where':_0x31aedd[_0x5ae6('0x36')]};return db['JscriptySessionReport']['count'](_0x44f9b9)['then'](function(_0x2f68fe){_0x468b95[_0x5ae6('0x1f')]=_0x2f68fe;if(_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x3f')]){_0x31aedd[_0x5ae6('0x40')]=[{'all':!![]}];}return db[_0x5ae6('0x29')][_0x5ae6('0x41')](_0x31aedd);})[_0x5ae6('0x24')](function(_0x41661b){_0x468b95[_0x5ae6('0x42')]=_0x41661b;return _0x468b95;})[_0x5ae6('0x24')](respondWithFilteredResult(_0x140fe2,_0x31aedd))[_0x5ae6('0x43')](handleError(_0x140fe2,null));};exports[_0x5ae6('0x44')]=function(_0x12b6ba,_0x3f7cba){var _0x3a70fd={'raw':!![],'where':{'id':_0x12b6ba[_0x5ae6('0x45')]['id']}},_0x3b606d={};_0x3b606d[_0x5ae6('0x2d')]=_['keys'](db[_0x5ae6('0x29')][_0x5ae6('0x2a')]);_0x3b606d[_0x5ae6('0x2e')]=_[_0x5ae6('0x2f')](_0x12b6ba[_0x5ae6('0x2e')]);_0x3b606d[_0x5ae6('0x37')]=_[_0x5ae6('0x30')](_0x3b606d['model'],_0x3b606d[_0x5ae6('0x2e')]);_0x3a70fd[_0x5ae6('0x31')]=_[_0x5ae6('0x30')](_0x3b606d[_0x5ae6('0x2d')],qs[_0x5ae6('0x32')](_0x12b6ba[_0x5ae6('0x2e')][_0x5ae6('0x32')]));_0x3a70fd['attributes']=_0x3a70fd['attributes'][_0x5ae6('0x33')]?_0x3a70fd[_0x5ae6('0x31')]:_0x3b606d['model'];if(_0x12b6ba[_0x5ae6('0x2e')][_0x5ae6('0x3f')]){_0x3a70fd[_0x5ae6('0x40')]=[{'all':!![]}];}_0x3a70fd=_[_0x5ae6('0x3d')]({},_0x3a70fd,_0x12b6ba['options']);return db[_0x5ae6('0x29')]['find'](_0x3a70fd)[_0x5ae6('0x24')](handleEntityNotFound(_0x3f7cba,null))[_0x5ae6('0x24')](respondWithResult(_0x3f7cba,null))[_0x5ae6('0x43')](handleError(_0x3f7cba,null));};exports['create']=function(_0x2f93bf,_0x28a65f){return db[_0x5ae6('0x29')]['create'](_0x2f93bf[_0x5ae6('0x46')],{})[_0x5ae6('0x24')](respondWithResult(_0x28a65f,0xc9))['catch'](handleError(_0x28a65f,null));};exports[_0x5ae6('0x47')]=function(_0xe13252,_0x115fe7){if(_0xe13252[_0x5ae6('0x46')]['id']){delete _0xe13252[_0x5ae6('0x46')]['id'];}return db[_0x5ae6('0x29')][_0x5ae6('0x48')]({'where':{'id':_0xe13252['params']['id']}})['then'](handleEntityNotFound(_0x115fe7,null))['then'](saveUpdates(_0xe13252[_0x5ae6('0x46')],null))['then'](respondWithResult(_0x115fe7,null))[_0x5ae6('0x43')](handleError(_0x115fe7,null));};exports[_0x5ae6('0x25')]=function(_0x43e4ad,_0x5d666b){return db[_0x5ae6('0x29')]['find']({'where':{'id':_0x43e4ad['params']['id']}})[_0x5ae6('0x24')](handleEntityNotFound(_0x5d666b,null))[_0x5ae6('0x24')](removeEntity(_0x5d666b,null))[_0x5ae6('0x43')](handleError(_0x5d666b,null));};exports[_0x5ae6('0x49')]=function(_0x36fda8,_0x33921d){return db['JscriptySessionReport'][_0x5ae6('0x49')]()['then'](respondWithResult(_0x33921d,null))[_0x5ae6('0x43')](handleError(_0x33921d,null));};exports[_0x5ae6('0x4a')]=function(_0x249180,_0x130bea,_0xe2f943){var _0x3877f3={'raw':!![],'where':{}};var _0x29a082={};var _0x13b80d={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x249180[_0x5ae6('0x45')]['id']}})[_0x5ae6('0x24')](handleEntityNotFound(_0x130bea,null))[_0x5ae6('0x24')](function(_0x2e3d30){if(_0x2e3d30){_0x29a082['model']=_[_0x5ae6('0x2f')](db[_0x5ae6('0x4b')][_0x5ae6('0x2a')]);_0x29a082['query']=_[_0x5ae6('0x2f')](_0x249180[_0x5ae6('0x2e')]);_0x29a082[_0x5ae6('0x37')]=_[_0x5ae6('0x30')](_0x29a082['model'],_0x29a082['query']);_0x3877f3['attributes']=_[_0x5ae6('0x30')](_0x29a082['model'],qs[_0x5ae6('0x32')](_0x249180['query']['fields']));_0x3877f3[_0x5ae6('0x31')]=_0x3877f3[_0x5ae6('0x31')]['length']?_0x3877f3[_0x5ae6('0x31')]:_0x29a082[_0x5ae6('0x2d')];if(!_0x249180[_0x5ae6('0x2e')]['hasOwnProperty'](_0x5ae6('0x35'))){_0x3877f3['limit']=qs[_0x5ae6('0x1e')](_0x249180['query'][_0x5ae6('0x1e')]);_0x3877f3[_0x5ae6('0x1c')]=qs['offset'](_0x249180[_0x5ae6('0x2e')][_0x5ae6('0x1c')]);}_0x3877f3[_0x5ae6('0x4c')]=qs['sort'](_0x249180[_0x5ae6('0x2e')][_0x5ae6('0x4d')]);_0x3877f3[_0x5ae6('0x36')]=qs['filters'](_[_0x5ae6('0x38')](_0x249180[_0x5ae6('0x2e')],_0x29a082['filters']));_0x3877f3[_0x5ae6('0x36')][_0x5ae6('0x4e')]=_0x2e3d30['id'];if(_0x249180[_0x5ae6('0x2e')]['filter']){_0x3877f3[_0x5ae6('0x36')]=_[_0x5ae6('0x3d')](_0x3877f3['where'],{'$or':_[_0x5ae6('0x3a')](_0x3877f3[_0x5ae6('0x31')],function(_0x118a99){var _0x3bbca4={};_0x3bbca4[_0x118a99]={'$like':'%'+_0x249180[_0x5ae6('0x2e')][_0x5ae6('0x39')]+'%'};return _0x3bbca4;})});}_0x3877f3=_['merge']({},_0x3877f3,_0x249180[_0x5ae6('0x3e')]);return db[_0x5ae6('0x4b')][_0x5ae6('0x1f')]({'where':_0x3877f3[_0x5ae6('0x36')]})['then'](function(_0x553e6d){_0x13b80d[_0x5ae6('0x1f')]=_0x553e6d;if(_0x249180[_0x5ae6('0x2e')][_0x5ae6('0x3f')]){_0x3877f3[_0x5ae6('0x40')]=[{'all':!![]}];}return db[_0x5ae6('0x4b')][_0x5ae6('0x41')](_0x3877f3);})[_0x5ae6('0x24')](function(_0x458bd1){_0x13b80d['rows']=_0x458bd1;return _0x13b80d;});}})[_0x5ae6('0x24')](respondWithFilteredResult(_0x130bea,_0x3877f3))[_0x5ae6('0x43')](handleError(_0x130bea,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ced4a6e..84ac7c2 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 _0x326f=['report_jscripty_sessions','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x364321,_0xff220f){var _0x57e785=function(_0x1975e2){while(--_0x1975e2){_0x364321['push'](_0x364321['shift']());}};_0x57e785(++_0xff220f);}(_0x326f,0xd1));var _0xf326=function(_0x582961,_0x5587f3){_0x582961=_0x582961-0x0;var _0x3e9b00=_0x326f[_0x582961];return _0x3e9b00;};'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 _0xa46e=['api','moment','bluebird','path','../../config/environment','exports','define','report_jscripty_sessions','lodash','util'];(function(_0x40be86,_0x68fe5d){var _0xda3c3b=function(_0x39deab){while(--_0x39deab){_0x40be86['push'](_0x40be86['shift']());}};_0xda3c3b(++_0x68fe5d);}(_0xa46e,0x8a));var _0xea46=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa46e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./jscriptySessionReport.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('JscriptySessionReport',attributes,{'tableName':_0xea46('0x9'),'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 0ac3899..17b3025 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 _0x77d4=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x77d4,0x108));var _0x477d=function(_0x24dfd2,_0x504fac){_0x24dfd2=_0x24dfd2-0x0;var _0x3abda1=_0x77d4[_0x24dfd2];return _0x3abda1;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});} \ No newline at end of file +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(_0x345adf,_0x436de3){var _0x494cb9=function(_0x1c8ac6){while(--_0x1c8ac6){_0x345adf['push'](_0x345adf['shift']());}};_0x494cb9(++_0x436de3);}(_0x7b84,0x17c));var _0x47b8=function(_0x930774,_0x38c07f){_0x930774=_0x930774-0x0;var _0x43de76=_0x7b84[_0x930774];return _0x43de76;};'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 diff --git a/server/api/license/index.js b/server/api/license/index.js index c8dece9..44c1ca6 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 _0x8344=['./license.controller','get','index','put','/:id','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x54db70,_0x2febcd){var _0x1d58a2=function(_0x59cb03){while(--_0x59cb03){_0x54db70['push'](_0x54db70['shift']());}};_0x1d58a2(++_0x2febcd);}(_0x8344,0xd5));var _0x4834=function(_0x3f4a40,_0x31e7bf){_0x3f4a40=_0x3f4a40-0x0;var _0x528709=_0x8344[_0x3f4a40];return _0x528709;};'use strict';var multer=require(_0x4834('0x0'));var util=require(_0x4834('0x1'));var path=require(_0x4834('0x2'));var timeout=require(_0x4834('0x3'));var express=require(_0x4834('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4834('0x5'));var interaction=require(_0x4834('0x6'));var config=require(_0x4834('0x7'));var controller=require(_0x4834('0x8'));router[_0x4834('0x9')]('/',controller[_0x4834('0xa')]);router[_0x4834('0xb')](_0x4834('0xc'),auth['isAuthenticated'](),controller['update']);router['get'](_0x4834('0xd'),auth[_0x4834('0xe')](),controller[_0x4834('0xf')]);module[_0x4834('0x10')]=router; \ No newline at end of file +var _0x1380=['../../components/interaction/service','./license.controller','get','index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','path','connect-timeout','express'];(function(_0x157eb6,_0x39d9c0){var _0x5da78c=function(_0x38418c){while(--_0x38418c){_0x157eb6['push'](_0x157eb6['shift']());}};_0x5da78c(++_0x39d9c0);}(_0x1380,0x182));var _0x0138=function(_0x495cb0,_0x534076){_0x495cb0=_0x495cb0-0x0;var _0x2601d9=_0x1380[_0x495cb0];return _0x2601d9;};'use strict';var multer=require(_0x0138('0x0'));var util=require('util');var path=require(_0x0138('0x1'));var timeout=require(_0x0138('0x2'));var express=require(_0x0138('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0138('0x4'));var config=require('../../config/environment');var controller=require(_0x0138('0x5'));router[_0x0138('0x6')]('/',controller[_0x0138('0x7')]);router[_0x0138('0x8')](_0x0138('0x9'),auth['isAuthenticated'](),controller[_0x0138('0xa')]);router[_0x0138('0x6')](_0x0138('0xb'),auth[_0x0138('0xc')](),controller[_0x0138('0xd')]);module[_0x0138('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index cf515d1..fdc3063 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 _0x9b4b=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x9b4b,0x1ca));var _0xb9b4=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0x9b4b[_0x52ea08];return _0x28d546;};'use strict';var Sequelize=require(_0xb9b4('0x0'));module[_0xb9b4('0x1')]={'license':{'type':Sequelize[_0xb9b4('0x2')]},'data1':{'type':Sequelize[_0xb9b4('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xb9b4('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x74f1=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0xb8c217,_0x3ce564){var _0x1f3aad=function(_0x20e644){while(--_0x20e644){_0xb8c217['push'](_0xb8c217['shift']());}};_0x1f3aad(++_0x3ce564);}(_0x74f1,0x11f));var _0x174f=function(_0x590b71,_0xf2162b){_0x590b71=_0x590b71-0x0;var _0x4bbc59=_0x74f1[_0x590b71];return _0x4bbc59;};'use strict';var Sequelize=require(_0x174f('0x0'));module[_0x174f('0x1')]={'license':{'type':Sequelize[_0x174f('0x2')]},'data1':{'type':Sequelize[_0x174f('0x3')]},'data2':{'type':Sequelize[_0x174f('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x174f('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 90d6b23..d067b43 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 _0x9f78=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','name','send','../../config/license/util','model','keys','query','intersection','attributes','fields','length','getLicense','body','params','get','checkLicense','demo','catch','downloadLogFile','license-info.log','join','/var','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x4bff04,_0x369bdc){var _0x3a1955=function(_0x538346){while(--_0x538346){_0x4bff04['push'](_0x4bff04['shift']());}};_0x3a1955(++_0x369bdc);}(_0x9f78,0xa6));var _0x89f7=function(_0x32d466,_0x80b652){_0x32d466=_0x32d466-0x0;var _0x2256a8=_0x9f78[_0x32d466];return _0x2256a8;};'use strict';var emlformat=require(_0x89f7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x89f7('0x1'));var moment=require('moment');var BPromise=require(_0x89f7('0x2'));var Mustache=require(_0x89f7('0x3'));var util=require(_0x89f7('0x4'));var path=require(_0x89f7('0x5'));var sox=require(_0x89f7('0x6'));var csv=require(_0x89f7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x89f7('0x8'));var _=require(_0x89f7('0x9'));var squel=require('squel');var crypto=require(_0x89f7('0xa'));var jsforce=require(_0x89f7('0xb'));var deskjs=require(_0x89f7('0xc'));var toCsv=require(_0x89f7('0x7'));var querystring=require(_0x89f7('0xd'));var Papa=require(_0x89f7('0xe'));var Redis=require(_0x89f7('0xf'));var authService=require(_0x89f7('0x10'));var qs=require(_0x89f7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89f7('0x12'));var logger=require(_0x89f7('0x13'))('api');var utils=require(_0x89f7('0x14'));var config=require(_0x89f7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x89f7('0x16'))['db'];function respondWithStatusCode(_0x30a2eb,_0x44d29a){_0x44d29a=_0x44d29a||0xcc;return function(_0x56b482){if(_0x56b482){return _0x30a2eb[_0x89f7('0x17')](_0x44d29a);}return _0x30a2eb[_0x89f7('0x18')](_0x44d29a)[_0x89f7('0x19')]();};}function respondWithResult(_0x1a8e4b,_0x4c4d3f){_0x4c4d3f=_0x4c4d3f||0xc8;return function(_0x39a852){if(_0x39a852){return _0x1a8e4b[_0x89f7('0x18')](_0x4c4d3f)[_0x89f7('0x1a')](_0x39a852);}};}function respondWithFilteredResult(_0x42e60b,_0x1be72e){return function(_0x486dbf){if(_0x486dbf){var _0x13158e=typeof _0x1be72e[_0x89f7('0x1b')]===_0x89f7('0x1c')&&typeof _0x1be72e[_0x89f7('0x1d')]===_0x89f7('0x1c');var _0x4b8bfb=_0x486dbf[_0x89f7('0x1e')];var _0x4a2b09=_0x13158e?0x0:_0x1be72e['offset'];var _0x22d09b=_0x13158e?_0x486dbf['count']:_0x1be72e[_0x89f7('0x1b')]+_0x1be72e[_0x89f7('0x1d')];var _0x4e6ed5;if(_0x22d09b>=_0x4b8bfb){_0x22d09b=_0x4b8bfb;_0x4e6ed5=0xc8;}else{_0x4e6ed5=0xce;}_0x42e60b[_0x89f7('0x18')](_0x4e6ed5);return _0x42e60b[_0x89f7('0x1f')](_0x89f7('0x20'),_0x4a2b09+'-'+_0x22d09b+'/'+_0x4b8bfb)[_0x89f7('0x1a')](_0x486dbf);}return null;};}function patchUpdates(_0x2336fb){return function(_0x128219){try{jsonpatch[_0x89f7('0x21')](_0x128219,_0x2336fb,!![]);}catch(_0x10fb19){return BPromise['reject'](_0x10fb19);}return _0x128219['save']();};}function saveUpdates(_0x5a88a5,_0x54c542){return function(_0x2a8d62){if(_0x2a8d62){return _0x2a8d62['update'](_0x5a88a5)[_0x89f7('0x22')](function(_0x4188ef){return _0x4188ef;});}return null;};}function removeEntity(_0x68a40e,_0x1bf58a){return function(_0x212dcd){if(_0x212dcd){return _0x212dcd[_0x89f7('0x23')]()[_0x89f7('0x22')](function(){_0x68a40e[_0x89f7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc1bf76,_0x1ecfcb){return function(_0x112d7a){if(!_0x112d7a){_0xc1bf76[_0x89f7('0x17')](0x194);}return _0x112d7a;};}function handleError(_0x4ba2c3,_0x2e43e8){_0x2e43e8=_0x2e43e8||0x1f4;return function(_0x349573){logger['error'](_0x349573['stack']);if(_0x349573[_0x89f7('0x24')]){delete _0x349573[_0x89f7('0x24')];}_0x4ba2c3[_0x89f7('0x18')](_0x2e43e8)[_0x89f7('0x25')](_0x349573);};}var utilLicense=require(_0x89f7('0x26'));exports['index']=function(_0x112dd2,_0x50a37b){var _0x1cebd7={'raw':!![],'where':{'id':0x1}},_0x4d8924={};_0x4d8924[_0x89f7('0x27')]=_[_0x89f7('0x28')](db['License']['rawAttributes']);_0x4d8924[_0x89f7('0x29')]=_[_0x89f7('0x28')](_0x112dd2[_0x89f7('0x29')]);_0x4d8924['filters']=_[_0x89f7('0x2a')](_0x4d8924['model'],_0x4d8924[_0x89f7('0x29')]);_0x1cebd7[_0x89f7('0x2b')]=_[_0x89f7('0x2a')](_0x4d8924[_0x89f7('0x27')],qs[_0x89f7('0x2c')](_0x112dd2['query'][_0x89f7('0x2c')]));_0x1cebd7[_0x89f7('0x2b')]=_0x1cebd7['attributes'][_0x89f7('0x2d')]?_0x1cebd7[_0x89f7('0x2b')]:_0x4d8924[_0x89f7('0x27')];_0x1cebd7=_['merge']({},_0x1cebd7,_0x112dd2['options']);return utilLicense[_0x89f7('0x2e')](_0x1cebd7)[_0x89f7('0x22')](respondWithResult(_0x50a37b,null))['catch'](handleError(_0x50a37b,null));};exports['update']=function(_0x5cd44d,_0x2f4005){if(_0x5cd44d['body']['id']){delete _0x5cd44d[_0x89f7('0x2f')]['id'];}return db['License']['find']({'where':{'id':_0x5cd44d[_0x89f7('0x30')]['id']}})[_0x89f7('0x22')](handleEntityNotFound(_0x2f4005,null))['then'](function(_0x391060){var _0x48b629=_0x391060[_0x89f7('0x31')]({'plain':!![]});return utilLicense[_0x89f7('0x32')](_0x48b629,_0x5cd44d[_0x89f7('0x2f')]['key']);})[_0x89f7('0x22')](function(_0x3c7894){if(!_0x3c7894[_0x89f7('0x33')]){return saveUpdates(_0x5cd44d['body'],null);}return _0x3c7894;})['then'](respondWithResult(_0x2f4005,null))[_0x89f7('0x34')](handleError(_0x2f4005,null));};exports[_0x89f7('0x35')]=function(_0x2d5d2c,_0x4f77be){var _0x446364=_0x89f7('0x36');var _0x49c373=path[_0x89f7('0x37')](_0x89f7('0x38'),'log','xcally',_0x446364);_0x4f77be[_0x89f7('0x39')](_0x89f7('0x3a'),_0x89f7('0x3b')+_0x446364);_0x4f77be[_0x89f7('0x1f')]('Content-Type',_0x89f7('0x3c'));_0x4f77be[_0x89f7('0x3d')](_0x49c373);}; \ No newline at end of file +var _0xd54e=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','options','getLicense','body','find','get','catch','downloadLogFile','license-info.log','join','log','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd54e,0x107));var _0xed54=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd54e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed54('0x0'));var zipdir=require(_0xed54('0x1'));var jsonpatch=require(_0xed54('0x2'));var rp=require('request-promise');var moment=require(_0xed54('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xed54('0x4'));var util=require(_0xed54('0x5'));var path=require(_0xed54('0x6'));var sox=require(_0xed54('0x7'));var csv=require(_0xed54('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed54('0x9'));var squel=require(_0xed54('0xa'));var crypto=require(_0xed54('0xb'));var jsforce=require(_0xed54('0xc'));var deskjs=require(_0xed54('0xd'));var toCsv=require(_0xed54('0x8'));var querystring=require(_0xed54('0xe'));var Papa=require('papaparse');var Redis=require(_0xed54('0xf'));var authService=require(_0xed54('0x10'));var qs=require(_0xed54('0x11'));var as=require(_0xed54('0x12'));var hardwareService=require(_0xed54('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xed54('0x14'));var licenseUtil=require(_0xed54('0x15'));var db=require(_0xed54('0x16'))['db'];function respondWithStatusCode(_0x3f5974,_0x53194a){_0x53194a=_0x53194a||0xcc;return function(_0x214289){if(_0x214289){return _0x3f5974[_0xed54('0x17')](_0x53194a);}return _0x3f5974['status'](_0x53194a)[_0xed54('0x18')]();};}function respondWithResult(_0x46f756,_0x22b72f){_0x22b72f=_0x22b72f||0xc8;return function(_0x237528){if(_0x237528){return _0x46f756[_0xed54('0x19')](_0x22b72f)[_0xed54('0x1a')](_0x237528);}};}function respondWithFilteredResult(_0x13fd5a,_0x386e3d){return function(_0x4d1a0a){if(_0x4d1a0a){var _0x385484=typeof _0x386e3d[_0xed54('0x1b')]===_0xed54('0x1c')&&typeof _0x386e3d[_0xed54('0x1d')]==='undefined';var _0x136514=_0x4d1a0a['count'];var _0x44d55c=_0x385484?0x0:_0x386e3d[_0xed54('0x1b')];var _0x17d19e=_0x385484?_0x4d1a0a[_0xed54('0x1e')]:_0x386e3d['offset']+_0x386e3d[_0xed54('0x1d')];var _0x165adb;if(_0x17d19e>=_0x136514){_0x17d19e=_0x136514;_0x165adb=0xc8;}else{_0x165adb=0xce;}_0x13fd5a[_0xed54('0x19')](_0x165adb);return _0x13fd5a[_0xed54('0x1f')](_0xed54('0x20'),_0x44d55c+'-'+_0x17d19e+'/'+_0x136514)[_0xed54('0x1a')](_0x4d1a0a);}return null;};}function patchUpdates(_0xae972e){return function(_0x4b0bac){try{jsonpatch[_0xed54('0x21')](_0x4b0bac,_0xae972e,!![]);}catch(_0x59832b){return BPromise[_0xed54('0x22')](_0x59832b);}return _0x4b0bac[_0xed54('0x23')]();};}function saveUpdates(_0x2d389a,_0x22c450){return function(_0x2516f6){if(_0x2516f6){return _0x2516f6[_0xed54('0x24')](_0x2d389a)[_0xed54('0x25')](function(_0xca2dc4){return _0xca2dc4;});}return null;};}function removeEntity(_0x2ae161,_0x34d45e){return function(_0x2b7f5a){if(_0x2b7f5a){return _0x2b7f5a[_0xed54('0x26')]()['then'](function(){_0x2ae161[_0xed54('0x19')](0xcc)[_0xed54('0x18')]();});}};}function handleEntityNotFound(_0x145341,_0x58cd0a){return function(_0x176e25){if(!_0x176e25){_0x145341[_0xed54('0x17')](0x194);}return _0x176e25;};}function handleError(_0x241b4d,_0x5b545f){_0x5b545f=_0x5b545f||0x1f4;return function(_0x26fedc){logger['error'](_0x26fedc[_0xed54('0x27')]);if(_0x26fedc[_0xed54('0x28')]){delete _0x26fedc[_0xed54('0x28')];}_0x241b4d[_0xed54('0x19')](_0x5b545f)['send'](_0x26fedc);};}var utilLicense=require(_0xed54('0x15'));exports[_0xed54('0x29')]=function(_0x21a723,_0x31b3e9){var _0x1fc9e0={'raw':!![],'where':{'id':0x1}},_0x14ddb7={};_0x14ddb7['model']=_[_0xed54('0x2a')](db['License'][_0xed54('0x2b')]);_0x14ddb7[_0xed54('0x2c')]=_[_0xed54('0x2a')](_0x21a723[_0xed54('0x2c')]);_0x14ddb7[_0xed54('0x2d')]=_[_0xed54('0x2e')](_0x14ddb7[_0xed54('0x2f')],_0x14ddb7[_0xed54('0x2c')]);_0x1fc9e0[_0xed54('0x30')]=_[_0xed54('0x2e')](_0x14ddb7[_0xed54('0x2f')],qs[_0xed54('0x31')](_0x21a723[_0xed54('0x2c')][_0xed54('0x31')]));_0x1fc9e0[_0xed54('0x30')]=_0x1fc9e0[_0xed54('0x30')][_0xed54('0x32')]?_0x1fc9e0[_0xed54('0x30')]:_0x14ddb7[_0xed54('0x2f')];_0x1fc9e0=_['merge']({},_0x1fc9e0,_0x21a723[_0xed54('0x33')]);return utilLicense[_0xed54('0x34')](_0x1fc9e0)['then'](respondWithResult(_0x31b3e9,null))['catch'](handleError(_0x31b3e9,null));};exports[_0xed54('0x24')]=function(_0x6ab092,_0x3277b1){if(_0x6ab092[_0xed54('0x35')]['id']){delete _0x6ab092[_0xed54('0x35')]['id'];}return db['License'][_0xed54('0x36')]({'where':{'id':_0x6ab092['params']['id']}})[_0xed54('0x25')](handleEntityNotFound(_0x3277b1,null))[_0xed54('0x25')](function(_0xe38deb){var _0x214b1f=_0xe38deb[_0xed54('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x214b1f,_0x6ab092[_0xed54('0x35')]['key']);})[_0xed54('0x25')](function(_0x417417){if(!_0x417417['demo']){return saveUpdates(_0x6ab092['body'],null);}return _0x417417;})[_0xed54('0x25')](respondWithResult(_0x3277b1,null))[_0xed54('0x38')](handleError(_0x3277b1,null));};exports[_0xed54('0x39')]=function(_0x18c7dd,_0x55c05e){var _0x3a15ac=_0xed54('0x3a');var _0x59d2aa=path[_0xed54('0x3b')]('/var',_0xed54('0x3c'),'xcally',_0x3a15ac);_0x55c05e[_0xed54('0x3d')]('Content-disposition',_0xed54('0x3e')+_0x3a15ac);_0x55c05e['set'](_0xed54('0x3f'),_0xed54('0x40'));_0x55c05e[_0xed54('0x41')](_0x59d2aa);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 9261dd1..cb453a9 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 _0xf4a3=['rimraf','../../config/environment','./license.attributes','exports','License','license','util','api','request-promise','path'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xf4a3,0x11e));var _0x3f4a=function(_0x111c9c,_0x1d1185){_0x111c9c=_0x111c9c-0x0;var _0x27a963=_0xf4a3[_0x111c9c];return _0x27a963;};'use strict';var _=require('lodash');var util=require(_0x3f4a('0x0'));var logger=require('../../config/logger')(_0x3f4a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3f4a('0x2'));var fs=require('fs');var path=require(_0x3f4a('0x3'));var rimraf=require(_0x3f4a('0x4'));var config=require(_0x3f4a('0x5'));var attributes=require(_0x3f4a('0x6'));module[_0x3f4a('0x7')]=function(_0x1a4908,_0x1fdd26){return _0x1a4908['define'](_0x3f4a('0x8'),attributes,{'tableName':_0x3f4a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7b3=['api','moment','bluebird','request-promise','path','rimraf','./license.attributes','exports','define','License','lodash','util'];(function(_0x56df75,_0x3b68f2){var _0x19feee=function(_0x4f950c){while(--_0x4f950c){_0x56df75['push'](_0x56df75['shift']());}};_0x19feee(++_0x3b68f2);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc7b3[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x3c7b('0x0'));var util=require(_0x3c7b('0x1'));var logger=require('../../config/logger')(_0x3c7b('0x2'));var moment=require(_0x3c7b('0x3'));var BPromise=require(_0x3c7b('0x4'));var rp=require(_0x3c7b('0x5'));var fs=require('fs');var path=require(_0x3c7b('0x6'));var rimraf=require(_0x3c7b('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c7b('0x8'));module[_0x3c7b('0x9')]=function(_0x1fa371,_0x55975f){return _0x1fa371[_0x3c7b('0xa')](_0x3c7b('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 0d92d78..5c87767 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 _0x4278=['http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0x4278,0x1ab));var _0x8427=function(_0x30b70e,_0x4a6997){_0x30b70e=_0x30b70e-0x0;var _0x1c681e=_0x4278[_0x30b70e];return _0x1c681e;};'use strict';var _=require('lodash');var util=require(_0x8427('0x0'));var moment=require(_0x8427('0x1'));var BPromise=require(_0x8427('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8427('0x3'));var db=require(_0x8427('0x4'))['db'];var utils=require(_0x8427('0x5'));var logger=require('../../config/logger')(_0x8427('0x6'));var config=require(_0x8427('0x7'));var jayson=require(_0x8427('0x8'));var client=jayson[_0x8427('0x9')][_0x8427('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x187971,_0x3fc315,_0x4caf3c){return new BPromise(function(_0x252d1e,_0x1a2a85){return client[_0x8427('0xb')](_0x187971,_0x4caf3c)[_0x8427('0xc')](function(_0x6e0466){logger[_0x8427('0xd')](_0x8427('0xe'),_0x3fc315,_0x8427('0xf'));logger['debug'](_0x8427('0x10'),_0x3fc315,_0x8427('0xf'),JSON[_0x8427('0x11')](_0x6e0466));if(_0x6e0466['error']){if(_0x6e0466[_0x8427('0x12')][_0x8427('0x13')]===0x1f4){logger['error'](_0x8427('0xe'),_0x3fc315,_0x6e0466[_0x8427('0x12')][_0x8427('0x14')]);return _0x1a2a85(_0x6e0466[_0x8427('0x12')][_0x8427('0x14')]);}logger[_0x8427('0x12')](_0x8427('0xe'),_0x3fc315,_0x6e0466[_0x8427('0x12')]['message']);return _0x252d1e(_0x6e0466[_0x8427('0x12')][_0x8427('0x14')]);}else{logger[_0x8427('0xd')]('License,\x20%s,\x20%s',_0x3fc315,_0x8427('0xf'));_0x252d1e(_0x6e0466[_0x8427('0x15')][_0x8427('0x14')]);}})[_0x8427('0x16')](function(_0x50d434){logger[_0x8427('0x12')]('License,\x20%s,\x20%s',_0x3fc315,_0x50d434);_0x1a2a85(_0x50d434);});});} \ No newline at end of file +var _0xd536=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x242225,_0x23e175){var _0x272125=function(_0x494143){while(--_0x494143){_0x242225['push'](_0x242225['shift']());}};_0x272125(++_0x23e175);}(_0xd536,0x105));var _0x6d53=function(_0x26de3f,_0x503295){_0x26de3f=_0x26de3f-0x0;var _0x22fed9=_0xd536[_0x26de3f];return _0x22fed9;};'use strict';var _=require(_0x6d53('0x0'));var util=require(_0x6d53('0x1'));var moment=require(_0x6d53('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d53('0x3'));var fs=require('fs');var Redis=require(_0x6d53('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d53('0x5'));var logger=require(_0x6d53('0x6'))(_0x6d53('0x7'));var config=require(_0x6d53('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d53('0x9')][_0x6d53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x269d24,_0x42c6c1,_0x2dccc9){return new BPromise(function(_0x2d56d1,_0x53f626){return client['request'](_0x269d24,_0x2dccc9)['then'](function(_0x376018){logger[_0x6d53('0xb')]('License,\x20%s,\x20%s',_0x42c6c1,'request\x20sent');logger[_0x6d53('0xc')](_0x6d53('0xd'),_0x42c6c1,_0x6d53('0xe'),JSON[_0x6d53('0xf')](_0x376018));if(_0x376018[_0x6d53('0x10')]){if(_0x376018['error'][_0x6d53('0x11')]===0x1f4){logger['error'](_0x6d53('0x12'),_0x42c6c1,_0x376018[_0x6d53('0x10')][_0x6d53('0x13')]);return _0x53f626(_0x376018[_0x6d53('0x10')][_0x6d53('0x13')]);}logger[_0x6d53('0x10')](_0x6d53('0x12'),_0x42c6c1,_0x376018[_0x6d53('0x10')][_0x6d53('0x13')]);return _0x2d56d1(_0x376018[_0x6d53('0x10')][_0x6d53('0x13')]);}else{logger['info'](_0x6d53('0x12'),_0x42c6c1,_0x6d53('0xe'));_0x2d56d1(_0x376018[_0x6d53('0x14')]['message']);}})[_0x6d53('0x15')](function(_0x572f9e){logger[_0x6d53('0x10')]('License,\x20%s,\x20%s',_0x42c6c1,_0x572f9e);_0x53f626(_0x572f9e);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 04b920e..16c32b2 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 _0xa704=['/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addAnswer','create','addImap','addInteraction','addApplications','/:id/send','/:id/users','put','update','delete','removeImap','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa704,0xff));var _0x4a70=function(_0x28d71d,_0x3f8321){_0x28d71d=_0x28d71d-0x0;var _0x4c5c0e=_0xa704[_0x28d71d];return _0x4c5c0e;};'use strict';var multer=require('multer');var util=require(_0x4a70('0x0'));var path=require(_0x4a70('0x1'));var timeout=require(_0x4a70('0x2'));var express=require(_0x4a70('0x3'));var router=express[_0x4a70('0x4')]();var fs_extra=require(_0x4a70('0x5'));var auth=require(_0x4a70('0x6'));var interaction=require(_0x4a70('0x7'));var config=require(_0x4a70('0x8'));var controller=require('./mailAccount.controller');router[_0x4a70('0x9')]('/',auth[_0x4a70('0xa')](),controller[_0x4a70('0xb')]);router['get'](_0x4a70('0xc'),auth[_0x4a70('0xa')](),controller[_0x4a70('0xd')]);router['get'](_0x4a70('0xe'),auth[_0x4a70('0xa')](),controller[_0x4a70('0xf')]);router[_0x4a70('0x9')](_0x4a70('0x10'),auth[_0x4a70('0xa')](),controller['getDispositions']);router['get'](_0x4a70('0x11'),auth[_0x4a70('0xa')](),controller[_0x4a70('0x12')]);router['get'](_0x4a70('0x13'),auth[_0x4a70('0xa')](),controller[_0x4a70('0x14')]);router[_0x4a70('0x9')](_0x4a70('0x15'),auth['isAuthenticated'](),controller[_0x4a70('0x16')]);router[_0x4a70('0x9')](_0x4a70('0x17'),auth[_0x4a70('0xa')](),controller[_0x4a70('0x18')]);router['get'](_0x4a70('0x19'),auth[_0x4a70('0xa')](),controller[_0x4a70('0x1a')]);router[_0x4a70('0x9')](_0x4a70('0x1b'),auth[_0x4a70('0xa')](),controller[_0x4a70('0x1c')]);router['get'](_0x4a70('0x1d'),auth[_0x4a70('0xa')](),controller[_0x4a70('0x1e')]);router['get']('/:id/users',auth[_0x4a70('0xa')](),controller[_0x4a70('0x1f')]);router[_0x4a70('0x20')]('/:id/dispositions',auth[_0x4a70('0xa')](),controller['addDisposition']);router[_0x4a70('0x20')](_0x4a70('0x11'),auth[_0x4a70('0xa')](),controller[_0x4a70('0x21')]);router[_0x4a70('0x20')]('/',auth[_0x4a70('0xa')](),controller[_0x4a70('0x22')]);router[_0x4a70('0x20')]('/:id/in_servers',auth[_0x4a70('0xa')](),controller[_0x4a70('0x23')]);router[_0x4a70('0x20')](_0x4a70('0x15'),auth[_0x4a70('0xa')](),controller['addSmtp']);router['post'](_0x4a70('0x17'),auth[_0x4a70('0xa')](),controller[_0x4a70('0x24')]);router[_0x4a70('0x20')](_0x4a70('0x19'),auth[_0x4a70('0xa')](),controller[_0x4a70('0x25')]);router[_0x4a70('0x20')](_0x4a70('0x26'),auth[_0x4a70('0xa')](),controller['send']);router['post'](_0x4a70('0x27'),auth[_0x4a70('0xa')](),controller['addAgents']);router[_0x4a70('0x28')](_0x4a70('0xe'),auth[_0x4a70('0xa')](),controller[_0x4a70('0x29')]);router[_0x4a70('0x2a')](_0x4a70('0x10'),auth[_0x4a70('0xa')](),controller['removeDispositions']);router[_0x4a70('0x2a')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x4a70('0x2a')]('/:id/in_servers',auth[_0x4a70('0xa')](),controller[_0x4a70('0x2b')]);router['delete'](_0x4a70('0x15'),auth[_0x4a70('0xa')](),controller['removeSmtp']);router[_0x4a70('0x2a')](_0x4a70('0xe'),auth[_0x4a70('0xa')](),controller[_0x4a70('0x2c')]);router[_0x4a70('0x2a')]('/:id/users',auth[_0x4a70('0xa')](),controller[_0x4a70('0x2d')]);module[_0x4a70('0x2e')]=router; \ No newline at end of file +var _0x6db6=['addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','describe','/:id','isAuthenticated','show','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','/:id/interactions','getInteractions','getApplications','getMessages','/:id/verify','/:id/users','getAgents','/:id/dispositions','addDisposition','create','post','/:id/in_servers','addSmtp'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0x6db6,0xce));var _0x66db=function(_0x3293ff,_0x5892a0){_0x3293ff=_0x3293ff-0x0;var _0x5173ce=_0x6db6[_0x3293ff];return _0x5173ce;};'use strict';var multer=require(_0x66db('0x0'));var util=require(_0x66db('0x1'));var path=require(_0x66db('0x2'));var timeout=require(_0x66db('0x3'));var express=require(_0x66db('0x4'));var router=express[_0x66db('0x5')]();var fs_extra=require(_0x66db('0x6'));var auth=require(_0x66db('0x7'));var interaction=require(_0x66db('0x8'));var config=require(_0x66db('0x9'));var controller=require('./mailAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x66db('0xa')]);router[_0x66db('0xb')](_0x66db('0xc'),auth['isAuthenticated'](),controller[_0x66db('0xd')]);router[_0x66db('0xb')](_0x66db('0xe'),auth[_0x66db('0xf')](),controller[_0x66db('0x10')]);router[_0x66db('0xb')]('/:id/dispositions',auth[_0x66db('0xf')](),controller[_0x66db('0x11')]);router[_0x66db('0xb')](_0x66db('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x66db('0xb')]('/:id/in_servers',auth[_0x66db('0xf')](),controller[_0x66db('0x13')]);router['get'](_0x66db('0x14'),auth[_0x66db('0xf')](),controller['getSmtp']);router['get'](_0x66db('0x15'),auth['isAuthenticated'](),controller[_0x66db('0x16')]);router[_0x66db('0xb')]('/:id/applications',auth[_0x66db('0xf')](),controller[_0x66db('0x17')]);router[_0x66db('0xb')]('/:id/messages',auth[_0x66db('0xf')](),controller[_0x66db('0x18')]);router[_0x66db('0xb')](_0x66db('0x19'),auth[_0x66db('0xf')](),controller['verifySmtp']);router['get'](_0x66db('0x1a'),auth[_0x66db('0xf')](),controller[_0x66db('0x1b')]);router['post'](_0x66db('0x1c'),auth[_0x66db('0xf')](),controller[_0x66db('0x1d')]);router['post'](_0x66db('0x12'),auth[_0x66db('0xf')](),controller['addAnswer']);router['post']('/',auth['isAuthenticated'](),controller[_0x66db('0x1e')]);router[_0x66db('0x1f')](_0x66db('0x20'),auth['isAuthenticated'](),controller['addImap']);router[_0x66db('0x1f')](_0x66db('0x14'),auth[_0x66db('0xf')](),controller[_0x66db('0x21')]);router[_0x66db('0x1f')](_0x66db('0x15'),auth[_0x66db('0xf')](),controller[_0x66db('0x22')]);router['post'](_0x66db('0x23'),auth[_0x66db('0xf')](),controller[_0x66db('0x24')]);router['post'](_0x66db('0x25'),auth[_0x66db('0xf')](),controller[_0x66db('0x26')]);router[_0x66db('0x1f')](_0x66db('0x1a'),auth['isAuthenticated'](),controller[_0x66db('0x27')]);router[_0x66db('0x28')](_0x66db('0xe'),auth[_0x66db('0xf')](),controller[_0x66db('0x29')]);router[_0x66db('0x2a')](_0x66db('0x1c'),auth[_0x66db('0xf')](),controller[_0x66db('0x2b')]);router[_0x66db('0x2a')](_0x66db('0x12'),auth[_0x66db('0xf')](),controller['removeAnswers']);router[_0x66db('0x2a')](_0x66db('0x20'),auth['isAuthenticated'](),controller[_0x66db('0x2c')]);router[_0x66db('0x2a')]('/:id/out_servers',auth[_0x66db('0xf')](),controller[_0x66db('0x2d')]);router[_0x66db('0x2a')](_0x66db('0xe'),auth[_0x66db('0xf')](),controller['destroy']);router['delete'](_0x66db('0x1a'),auth[_0x66db('0xf')](),controller[_0x66db('0x2e')]);module[_0x66db('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 1c556c3..763f11b 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 _0xaf58=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','hotmail','yahoo','provider','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x1a95c6,_0x4689cc){var _0x51e065=function(_0x272aa3){while(--_0x272aa3){_0x1a95c6['push'](_0x1a95c6['shift']());}};_0x51e065(++_0x4689cc);}(_0xaf58,0xf0));var _0x8af5=function(_0x3d323a,_0x53ee8d){_0x3d323a=_0x3d323a-0x0;var _0x137de3=_0xaf58[_0x3d323a];return _0x137de3;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x8af5('0x0')]},'name':{'type':Sequelize[_0x8af5('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x8af5('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x8af5('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8af5('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x8af5('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x8af5('0x2')]},'markAsUnread':{'type':Sequelize[_0x8af5('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8af5('0x0')],'allowNull':![],'defaultValue':_0x8af5('0x3')},'fontSize':{'type':Sequelize[_0x8af5('0x4')](0x2)[_0x8af5('0x5')],'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['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8af5('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8af5('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8af5('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8af5('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8af5('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8af5('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x8af5('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x8af5('0x1')],'defaultValue':![],'comment':_0x8af5('0x7'),'set':function(_0x30f060){if(!_0x30f060)this[_0x8af5('0x8')]('mandatoryDispositionPauseId',null);this[_0x8af5('0x8')](_0x8af5('0x9'),_0x30f060);}},'provider':{'type':Sequelize['ENUM']('gmail',_0x8af5('0xa'),_0x8af5('0xb'),'outlook365'),'defaultValue':null,'get':function(){var _0x397808=this['getDataValue'](_0x8af5('0xc'));return _0x397808||'custom';},'set':function(_0x1846cc){if(_0x1846cc==='custom'){_0x1846cc=null;}return this[_0x8af5('0x8')]('provider',_0x1846cc);}}}; \ No newline at end of file +var _0x2007=['mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x269fd4,_0x190536){var _0x346145=function(_0x4e1722){while(--_0x4e1722){_0x269fd4['push'](_0x269fd4['shift']());}};_0x346145(++_0x190536);}(_0x2007,0x9b));var _0x7200=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2007[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7200('0x0'));module[_0x7200('0x1')]={'description':{'type':Sequelize[_0x7200('0x2')]},'name':{'type':Sequelize[_0x7200('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7200('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7200('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7200('0x4')]},'markAsUnread':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7200('0x2')],'allowNull':![],'defaultValue':_0x7200('0x5')},'fontSize':{'type':Sequelize[_0x7200('0x6')](0x2)[_0x7200('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7200('0x8');}},'notificationSound':{'type':Sequelize[_0x7200('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7200('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7200('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x7200('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![],'comment':_0x7200('0xa'),'set':function(_0x543b1d){if(!_0x543b1d)this['setDataValue'](_0x7200('0xb'),null);this[_0x7200('0xc')](_0x7200('0xd'),_0x543b1d);}},'provider':{'type':Sequelize[_0x7200('0xe')](_0x7200('0xf'),_0x7200('0x10'),_0x7200('0x11'),'outlook365'),'defaultValue':null,'get':function(){var _0x5645c7=this[_0x7200('0x12')]('provider');return _0x5645c7||_0x7200('0x13');},'set':function(_0x2ba17c){if(_0x2ba17c===_0x7200('0x13')){_0x2ba17c=null;}return this[_0x7200('0xc')](_0x7200('0x14'),_0x2ba17c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index fd4da8a..708c7a1 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 _0x490d=['setSmtp','addInteraction','MailInteraction','CmContact','Contact','User','Owner','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','format','inlineCss','true','split','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','VerifySmtp','Sequelize','ValidationError','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','get','MailAccounts','UserProfileResource','end','stack','name','send','gmail','imap.gmail.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','MailAccount','includeAll','include','findAll','show','keys','length','update','body','provider','custom','find','params','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','findOne','nolimit','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','create','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp'];(function(_0x7d3566,_0x322612){var _0x1bfa91=function(_0x5e82ea){while(--_0x5e82ea){_0x7d3566['push'](_0x7d3566['shift']());}};_0x1bfa91(++_0x322612);}(_0x490d,0x1c9));var _0xd490=function(_0x4928d7,_0x4030e5){_0x4928d7=_0x4928d7-0x0;var _0xb9eac3=_0x490d[_0x4928d7];return _0xb9eac3;};'use strict';var moment=require(_0xd490('0x0'));var BPromise=require(_0xd490('0x1'));var util=require('util');var path=require(_0xd490('0x2'));var _=require(_0xd490('0x3'));var juice=require(_0xd490('0x4'));var Redis=require('ioredis');var qs=require(_0xd490('0x5'));var logger=require('../../config/logger')(_0xd490('0x6'));var config=require(_0xd490('0x7'));var db=require(_0xd490('0x8'))['db'];config[_0xd490('0x9')]=_[_0xd490('0xa')](config[_0xd490('0x9')],{'host':_0xd490('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd490('0xc'))[_0xd490('0xd')](socket);var jayson=require(_0xd490('0xe'));var client=jayson[_0xd490('0xf')]['http']({'port':0x232b});function respondWithRpcPromise(_0x319778,_0x24493a,_0x4e6fc1,_0xbe1c10){return new BPromise(function(_0x7b6987,_0x36e155){var _0x26ced4=_0xbe1c10||client;return _0x26ced4['request'](_0x319778,_0x4e6fc1)[_0xd490('0x10')](function(_0x55f718){logger[_0xd490('0x11')]('MailAccount,\x20%s,\x20%s',_0x24493a,_0xd490('0x12'));logger[_0xd490('0x13')](_0xd490('0x14'),_0x24493a,_0xd490('0x12'),JSON[_0xd490('0x15')](_0x55f718));if(_0x55f718['error']){if(_0x55f718[_0xd490('0x16')][_0xd490('0x17')]===0x1f4){logger[_0xd490('0x16')](_0xd490('0x18'),_0x24493a,_0x55f718['error'][_0xd490('0x19')]);return _0x36e155(_0x55f718[_0xd490('0x16')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x24493a,_0x55f718[_0xd490('0x16')]['message']);return _0x7b6987(_0x55f718['error'][_0xd490('0x19')]);}else{logger[_0xd490('0x11')](_0xd490('0x18'),_0x24493a,_0xd490('0x12'));_0x7b6987(_0x55f718[_0xd490('0x1a')]['message']);}})[_0xd490('0x1b')](function(_0x1d4216){logger[_0xd490('0x16')]('MailAccount,\x20%s,\x20%s',_0x24493a,_0x1d4216);_0x36e155(_0x1d4216);});});}function respondWithStatusCode(_0x58ec3b,_0x11fc26){_0x11fc26=_0x11fc26||0xcc;return function(_0x5ef731){if(_0x5ef731){return _0x58ec3b[_0xd490('0x1c')](_0x11fc26);}return _0x58ec3b[_0xd490('0x1d')](_0x11fc26)['end']();};}function respondWithResult(_0x187957,_0x5d9a10){_0x5d9a10=_0x5d9a10||0xc8;return function(_0x5cfd96){if(_0x5cfd96){return _0x187957[_0xd490('0x1d')](_0x5d9a10)[_0xd490('0x1e')](_0x5cfd96);}};}function respondWithFilteredResult(_0x505bfd,_0x24e150){return function(_0x226303){if(_0x226303){var _0x29680e=typeof _0x24e150[_0xd490('0x1f')]===_0xd490('0x20')&&typeof _0x24e150[_0xd490('0x21')]===_0xd490('0x20');var _0x106184=_0x226303['count'];var _0x4beff0=_0x29680e?0x0:_0x24e150[_0xd490('0x1f')];var _0x18a6d8=_0x29680e?_0x226303[_0xd490('0x22')]:_0x24e150[_0xd490('0x1f')]+_0x24e150['limit'];var _0x4a71f6;if(_0x18a6d8>=_0x106184){_0x18a6d8=_0x106184;_0x4a71f6=0xc8;}else{_0x4a71f6=0xce;}_0x505bfd[_0xd490('0x1d')](_0x4a71f6);return _0x505bfd[_0xd490('0x23')](_0xd490('0x24'),_0x4beff0+'-'+_0x18a6d8+'/'+_0x106184)[_0xd490('0x1e')](_0x226303);}return null;};}function saveUpdates(_0x3d5b8b){return function(_0x1bd848){if(_0x1bd848){return _0x1bd848['update'](_0x3d5b8b)[_0xd490('0x10')](function(_0x57b04a){return _0x57b04a;});}return null;};}function removeEntity(_0x479290){return function(_0x4c2496){if(_0x4c2496){return _0x4c2496[_0xd490('0x25')]()[_0xd490('0x10')](function(){var _0x470175=_0x4c2496[_0xd490('0x26')]({'plain':!![]});var _0x506669=_0xd490('0x27');return db[_0xd490('0x28')][_0xd490('0x25')]({'where':{'type':_0x506669,'resourceId':_0x470175['id']}})[_0xd490('0x10')](function(){return _0x4c2496;});})['then'](function(){_0x479290[_0xd490('0x1d')](0xcc)[_0xd490('0x29')]();});}};}function handleEntityNotFound(_0x361a37){return function(_0x32d0b3){if(!_0x32d0b3){_0x361a37[_0xd490('0x1c')](0x194);}return _0x32d0b3;};}function handleError(_0x5e9e23,_0x25d5c7){_0x25d5c7=_0x25d5c7||0x1f4;return function(_0x1655f6){logger[_0xd490('0x16')](_0x1655f6[_0xd490('0x2a')]);if(_0x1655f6['name']){delete _0x1655f6[_0xd490('0x2b')];}_0x5e9e23[_0xd490('0x1d')](_0x25d5c7)[_0xd490('0x2c')](_0x1655f6);};}function getImapHost(_0x57c49f){switch(_0x57c49f){case _0xd490('0x2d'):return _0xd490('0x2e');case'yahoo':return'imap.mail.yahoo.com';case _0xd490('0x2f'):return _0xd490('0x30');case _0xd490('0x31'):return _0xd490('0x32');}throw new Error(_0xd490('0x33'),_0x57c49f);}function getSmtpHost(_0x2167f8){switch(_0x2167f8){case _0xd490('0x2d'):return _0xd490('0x34');case _0xd490('0x35'):return _0xd490('0x36');case _0xd490('0x2f'):return _0xd490('0x37');case _0xd490('0x31'):return'smtp.office365.com';}throw new Error(_0xd490('0x33'),_0x2167f8);}function getAuthenticationOptions(_0x594f97,_0x465ed8){var _0x50e66b={};var _0x3b28f6={};if(_0x594f97){_0x50e66b[_0xd490('0x38')]=_0x3b28f6['user']=_0x465ed8[_0xd490('0x39')];_0x50e66b[_0xd490('0x3a')]=_0x3b28f6[_0xd490('0x3b')]=_0x465ed8[_0xd490('0x3a')];if(_0x465ed8[_0xd490('0x3c')]){_0x50e66b[_0xd490('0x3c')]=_0x3b28f6['modernAuthentication']=!![];_0x50e66b[_0xd490('0x3d')]=_0x3b28f6[_0xd490('0x3d')]=_0x465ed8[_0xd490('0x3d')];_0x50e66b[_0xd490('0x3a')]=_0x3b28f6[_0xd490('0x3b')]=null;}else{_0x50e66b[_0xd490('0x3d')]=_0x3b28f6['CloudProviderId']=null;}_0x50e66b[_0xd490('0x3e')]=getImapHost(_0x594f97);_0x50e66b[_0xd490('0x3f')]=0x3e1;_0x3b28f6[_0xd490('0x3e')]=getSmtpHost(_0x594f97);_0x3b28f6[_0xd490('0x3f')]=0x24b;_0x3b28f6[_0xd490('0x40')]=![];_0x50e66b['service']=_0x3b28f6[_0xd490('0x41')]=null;}else{if(_0x465ed8[_0xd490('0x42')]){_0x50e66b['user']=_0x3b28f6[_0xd490('0x38')]=_0x465ed8['username'];_0x50e66b[_0xd490('0x3a')]=_0x3b28f6[_0xd490('0x3b')]=_0x465ed8[_0xd490('0x3a')];}else{_0x50e66b[_0xd490('0x42')]=_0x3b28f6[_0xd490('0x42')]=![];_0x50e66b[_0xd490('0x38')]=_0x3b28f6[_0xd490('0x38')]=null;_0x50e66b[_0xd490('0x3a')]=_0x3b28f6['pass']=null;}_0x50e66b[_0xd490('0x3e')]=_0x465ed8['Imap'][_0xd490('0x3e')];_0x50e66b[_0xd490('0x3f')]=_0x465ed8[_0xd490('0x43')][_0xd490('0x3f')];_0x3b28f6[_0xd490('0x3e')]=_0x465ed8[_0xd490('0x44')][_0xd490('0x3e')];_0x3b28f6[_0xd490('0x3f')]=_0x465ed8[_0xd490('0x44')]['port'];}return{'Imap':_0x50e66b,'Smtp':_0x3b28f6};}exports[_0xd490('0x45')]=function(_0x22d756,_0x2a0193){var _0x4b15c0={'include':[{'model':db[_0xd490('0x46')],'as':_0xd490('0x43')},{'model':db[_0xd490('0x47')],'as':_0xd490('0x44')},{'model':db[_0xd490('0x48')],'as':_0xd490('0x49')}]},_0xecffb5={},_0x303614={'count':0x0,'rows':[]};var _0x4dd8d8=_['map'](db['MailAccount'][_0xd490('0x4a')],function(_0x55eaee){return{'name':_0x55eaee[_0xd490('0x4b')],'type':_0x55eaee[_0xd490('0x4c')][_0xd490('0x4d')]};});_0xecffb5[_0xd490('0x4e')]=_[_0xd490('0x4f')](_0x4dd8d8,'name');_0xecffb5['query']=_['keys'](_0x22d756[_0xd490('0x50')]);_0xecffb5[_0xd490('0x51')]=_[_0xd490('0x52')](_0xecffb5[_0xd490('0x4e')],_0xecffb5[_0xd490('0x50')]);_0x4b15c0[_0xd490('0x53')]=_[_0xd490('0x52')](_0xecffb5[_0xd490('0x4e')],qs[_0xd490('0x54')](_0x22d756[_0xd490('0x50')]['fields']));_0x4b15c0[_0xd490('0x53')]=_0x4b15c0['attributes']['length']?_0x4b15c0[_0xd490('0x53')]:_0xecffb5[_0xd490('0x4e')];if(!_0x22d756['query'][_0xd490('0x55')]('nolimit')){_0x4b15c0[_0xd490('0x21')]=qs[_0xd490('0x21')](_0x22d756['query'][_0xd490('0x21')]);_0x4b15c0['offset']=qs[_0xd490('0x1f')](_0x22d756[_0xd490('0x50')][_0xd490('0x1f')]);}_0x4b15c0[_0xd490('0x56')]=qs[_0xd490('0x57')](_0x22d756[_0xd490('0x50')][_0xd490('0x57')]);_0x4b15c0[_0xd490('0x58')]=qs[_0xd490('0x51')](_[_0xd490('0x59')](_0x22d756[_0xd490('0x50')],_0xecffb5['filters']),_0x4dd8d8);if(_0x22d756[_0xd490('0x50')]['filter']){_0x4b15c0['where']=_[_0xd490('0x5a')](_0x4b15c0[_0xd490('0x58')],{'$or':_[_0xd490('0x4f')](_0x4dd8d8,function(_0x39e7b1){if(_0x39e7b1[_0xd490('0x4c')]!==_0xd490('0x5b')){var _0x4387a3={};_0x4387a3[_0x39e7b1[_0xd490('0x2b')]]={'$like':'%'+_0x22d756[_0xd490('0x50')]['filter']+'%'};return _0x4387a3;}})});}_0x4b15c0=_['merge']({},_0x4b15c0,_0x22d756[_0xd490('0x5c')]);var _0x2182c4={'where':_0x4b15c0[_0xd490('0x58')]};return db[_0xd490('0x5d')]['count'](_0x2182c4)[_0xd490('0x10')](function(_0x592a67){_0x303614[_0xd490('0x22')]=_0x592a67;if(_0x22d756[_0xd490('0x50')][_0xd490('0x5e')]){_0x4b15c0[_0xd490('0x5f')]=[{'all':!![]}];}return db[_0xd490('0x5d')][_0xd490('0x60')](_0x4b15c0);})['then'](function(_0x4c71e9){_0x303614['rows']=_0x4c71e9;return _0x303614;})[_0xd490('0x10')](respondWithFilteredResult(_0x2a0193,_0x4b15c0))[_0xd490('0x1b')](handleError(_0x2a0193,null));};exports[_0xd490('0x61')]=function(_0x4da932,_0x23e632){var _0x5c2f7d={'raw':![],'where':{'id':_0x4da932['params']['id']},'include':[{'model':db[_0xd490('0x46')],'as':_0xd490('0x43')},{'model':db[_0xd490('0x47')],'as':'Smtp'},{'model':db['Pause'],'as':_0xd490('0x49')}]},_0x5885ae={};_0x5885ae[_0xd490('0x4e')]=_['keys'](db[_0xd490('0x5d')][_0xd490('0x4a')]);_0x5885ae[_0xd490('0x50')]=_[_0xd490('0x62')](_0x4da932[_0xd490('0x50')]);_0x5885ae[_0xd490('0x51')]=_[_0xd490('0x52')](_0x5885ae[_0xd490('0x4e')],_0x5885ae[_0xd490('0x50')]);_0x5c2f7d[_0xd490('0x53')]=_[_0xd490('0x52')](_0x5885ae[_0xd490('0x4e')],qs[_0xd490('0x54')](_0x4da932[_0xd490('0x50')]['fields']));_0x5c2f7d[_0xd490('0x53')]=_0x5c2f7d[_0xd490('0x53')][_0xd490('0x63')]?_0x5c2f7d[_0xd490('0x53')]:_0x5885ae[_0xd490('0x4e')];if(_0x4da932[_0xd490('0x50')][_0xd490('0x5e')]){_0x5c2f7d[_0xd490('0x5f')]=[{'all':!![]}];}_0x5c2f7d=_[_0xd490('0x5a')]({},_0x5c2f7d,_0x4da932['options']);return db[_0xd490('0x5d')]['find'](_0x5c2f7d)['then'](handleEntityNotFound(_0x23e632,null))[_0xd490('0x10')](respondWithResult(_0x23e632,null))['catch'](handleError(_0x23e632,null));};exports[_0xd490('0x64')]=function(_0x2208ad,_0x1b600f){if(_0x2208ad[_0xd490('0x65')]['id']){delete _0x2208ad['body']['id'];}var _0x1b5b49=_0x2208ad[_0xd490('0x65')][_0xd490('0x66')]===_0xd490('0x67')?null:_0x2208ad['body'][_0xd490('0x66')];var _0x4d8f97=_0x2208ad[_0xd490('0x65')]['Imap']||{};var _0x3828e5=_0x2208ad['body'][_0xd490('0x44')]||{};if(_0x1b5b49){_0x4d8f97['host']=getImapHost(_0x1b5b49);_0x4d8f97[_0xd490('0x3f')]=0x3e1;_0x3828e5[_0xd490('0x3e')]=getSmtpHost(_0x1b5b49);_0x3828e5[_0xd490('0x3f')]=0x24b;_0x3828e5[_0xd490('0x40')]=![];}if(_0x3828e5[_0xd490('0x3c')]){_0x3828e5['secure']=![];}else{_0x3828e5[_0xd490('0x3d')]=null;}if(!_0x4d8f97['modernAuthentication'])_0x4d8f97[_0xd490('0x3d')]=null;_0x2208ad[_0xd490('0x65')]['Imap']=_0x4d8f97;_0x2208ad[_0xd490('0x65')][_0xd490('0x44')]=_0x3828e5;return db[_0xd490('0x5d')][_0xd490('0x68')]({'where':{'id':_0x2208ad[_0xd490('0x69')]['id']},'include':[{'model':db[_0xd490('0x46')],'as':'Imap'},{'model':db[_0xd490('0x47')],'as':_0xd490('0x44')},{'model':db[_0xd490('0x48')],'as':'mandatoryDispositionPause'}]})[_0xd490('0x10')](handleEntityNotFound(_0x1b600f,null))[_0xd490('0x10')](function(_0x5d0b24){if(!_0x5d0b24)throw new Error(_0xd490('0x6a'));if(_0x5d0b24['service'])delete _0x2208ad[_0xd490('0x65')][_0xd490('0x43')];return _0x5d0b24;})[_0xd490('0x10')](saveUpdates(_0x2208ad['body'],null))[_0xd490('0x10')](function(_0x518714){if(!_0x2208ad[_0xd490('0x65')][_0xd490('0x43')])return _0x518714;return db[_0xd490('0x46')]['update'](_0x2208ad[_0xd490('0x65')]['Imap'],{'where':{'MailAccountId':_0x518714['id']}})[_0xd490('0x10')](function(){return _0x518714;});})['then'](function(_0x556447){if(!_0x2208ad[_0xd490('0x65')][_0xd490('0x44')])return _0x556447;return db['MailServerOut']['update'](_0x2208ad['body']['Smtp'],{'where':{'MailAccountId':_0x556447['id']}})[_0xd490('0x10')](function(){return _0x556447;});})['then'](respondWithResult(_0x1b600f,null))[_0xd490('0x1b')](handleError(_0x1b600f,null));};exports[_0xd490('0x6b')]=function(_0x10c232,_0x589f5e){return db[_0xd490('0x5d')]['describe']()[_0xd490('0x10')](respondWithResult(_0x589f5e,null))[_0xd490('0x1b')](handleError(_0x589f5e,null));};exports[_0xd490('0x6c')]=function(_0x4da781,_0xf43d6f){if(_0x4da781['body']['id']){delete _0x4da781[_0xd490('0x65')]['id'];}return db['MailAccount'][_0xd490('0x68')]({'where':{'id':_0x4da781['params']['id']}})[_0xd490('0x10')](handleEntityNotFound(_0xf43d6f,null))[_0xd490('0x10')](function(_0x5ce84f){if(_0x5ce84f){_0x4da781[_0xd490('0x65')][_0xd490('0x6d')]=_0x5ce84f['id'];return db[_0xd490('0x6e')]['create'](_0x4da781[_0xd490('0x65')]);}})['then'](respondWithResult(_0xf43d6f,null))[_0xd490('0x1b')](handleError(_0xf43d6f,null));};exports['getDispositions']=function(_0x8f9296,_0x7a91a){var _0x1fd14b={'raw':![],'where':{}};var _0x1d9163={};var _0x3101b5={'count':0x0,'rows':[]};return db[_0xd490('0x5d')][_0xd490('0x6f')]({'where':{'id':_0x8f9296['params']['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x7a91a,null))[_0xd490('0x10')](function(_0x516583){if(_0x516583){_0x1d9163[_0xd490('0x4e')]=_[_0xd490('0x62')](db[_0xd490('0x6e')][_0xd490('0x4a')]);_0x1d9163[_0xd490('0x50')]=_[_0xd490('0x62')](_0x8f9296[_0xd490('0x50')]);_0x1d9163[_0xd490('0x51')]=_[_0xd490('0x52')](_0x1d9163[_0xd490('0x4e')],_0x1d9163['query']);_0x1fd14b[_0xd490('0x53')]=_[_0xd490('0x52')](_0x1d9163['model'],qs[_0xd490('0x54')](_0x8f9296[_0xd490('0x50')][_0xd490('0x54')]));_0x1fd14b[_0xd490('0x53')]=_0x1fd14b[_0xd490('0x53')][_0xd490('0x63')]?_0x1fd14b['attributes']:_0x1d9163[_0xd490('0x4e')];if(!_0x8f9296['query'][_0xd490('0x55')](_0xd490('0x70'))){_0x1fd14b[_0xd490('0x21')]=qs[_0xd490('0x21')](_0x8f9296[_0xd490('0x50')]['limit']);_0x1fd14b[_0xd490('0x1f')]=qs[_0xd490('0x1f')](_0x8f9296[_0xd490('0x50')][_0xd490('0x1f')]);}_0x1fd14b['order']=qs['sort'](_0x8f9296[_0xd490('0x50')][_0xd490('0x57')]);_0x1fd14b['where']=qs[_0xd490('0x51')](_['pick'](_0x8f9296[_0xd490('0x50')],_0x1d9163[_0xd490('0x51')]));_0x1fd14b[_0xd490('0x58')][_0xd490('0x6d')]=_0x516583['id'];if(_0x8f9296[_0xd490('0x50')][_0xd490('0x71')]){_0x1fd14b[_0xd490('0x58')]=_[_0xd490('0x5a')](_0x1fd14b[_0xd490('0x58')],{'$or':_[_0xd490('0x4f')](_0x1fd14b['attributes'],function(_0x4ea366){var _0x683885={};_0x683885[_0x4ea366]={'$like':'%'+_0x8f9296[_0xd490('0x50')]['filter']+'%'};return _0x683885;})});}_0x1fd14b=_[_0xd490('0x5a')]({},_0x1fd14b,_0x8f9296[_0xd490('0x5c')]);return db['Disposition'][_0xd490('0x22')]({'where':_0x1fd14b['where']})[_0xd490('0x10')](function(_0x2153e8){_0x3101b5[_0xd490('0x22')]=_0x2153e8;if(_0x8f9296[_0xd490('0x50')]['includeAll']){_0x1fd14b[_0xd490('0x5f')]=[{'all':!![]}];}return db['Disposition'][_0xd490('0x60')](_0x1fd14b);})[_0xd490('0x10')](function(_0x9e3c23){_0x3101b5['rows']=_0x9e3c23;return _0x3101b5;});}})[_0xd490('0x10')](respondWithFilteredResult(_0x7a91a,_0x1fd14b))[_0xd490('0x1b')](handleError(_0x7a91a,null));};exports[_0xd490('0x72')]=function(_0xfb19,_0x265950){return db[_0xd490('0x5d')]['find']({'where':{'id':_0xfb19[_0xd490('0x69')]['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x265950,null))[_0xd490('0x10')](function(_0x2ad644){if(_0x2ad644){return _0x2ad644[_0xd490('0x72')](_0xfb19[_0xd490('0x50')][_0xd490('0x73')]);}})[_0xd490('0x10')](respondWithStatusCode(_0x265950,null))['catch'](handleError(_0x265950,null));};exports[_0xd490('0x74')]=function(_0x1c3c35,_0x27ede2){if(_0x1c3c35[_0xd490('0x65')]['id']){delete _0x1c3c35['body']['id'];}return db[_0xd490('0x5d')][_0xd490('0x68')]({'where':{'id':_0x1c3c35[_0xd490('0x69')]['id']}})['then'](handleEntityNotFound(_0x27ede2,null))[_0xd490('0x10')](function(_0x21c0f2){if(_0x21c0f2){_0x1c3c35[_0xd490('0x65')][_0xd490('0x6d')]=_0x21c0f2['id'];return db[_0xd490('0x75')]['create'](_0x1c3c35['body']);}})[_0xd490('0x10')](respondWithResult(_0x27ede2,null))[_0xd490('0x1b')](handleError(_0x27ede2,null));};exports[_0xd490('0x76')]=function(_0x47ea75,_0x1c3438){var _0x619cd5={'raw':![],'where':{}};var _0x488d6d={};var _0x5d4381={'count':0x0,'rows':[]};return db['MailAccount'][_0xd490('0x6f')]({'where':{'id':_0x47ea75['params']['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x1c3438,null))[_0xd490('0x10')](function(_0x37c3a9){if(_0x37c3a9){_0x488d6d['model']=_['keys'](db[_0xd490('0x75')][_0xd490('0x4a')]);_0x488d6d[_0xd490('0x50')]=_[_0xd490('0x62')](_0x47ea75[_0xd490('0x50')]);_0x488d6d[_0xd490('0x51')]=_['intersection'](_0x488d6d[_0xd490('0x4e')],_0x488d6d[_0xd490('0x50')]);_0x619cd5[_0xd490('0x53')]=_[_0xd490('0x52')](_0x488d6d[_0xd490('0x4e')],qs[_0xd490('0x54')](_0x47ea75[_0xd490('0x50')][_0xd490('0x54')]));_0x619cd5['attributes']=_0x619cd5[_0xd490('0x53')]['length']?_0x619cd5[_0xd490('0x53')]:_0x488d6d[_0xd490('0x4e')];if(!_0x47ea75[_0xd490('0x50')][_0xd490('0x55')](_0xd490('0x70'))){_0x619cd5[_0xd490('0x21')]=qs['limit'](_0x47ea75[_0xd490('0x50')][_0xd490('0x21')]);_0x619cd5[_0xd490('0x1f')]=qs[_0xd490('0x1f')](_0x47ea75[_0xd490('0x50')][_0xd490('0x1f')]);}_0x619cd5[_0xd490('0x56')]=qs[_0xd490('0x57')](_0x47ea75[_0xd490('0x50')][_0xd490('0x57')]);_0x619cd5[_0xd490('0x58')]=qs[_0xd490('0x51')](_[_0xd490('0x59')](_0x47ea75[_0xd490('0x50')],_0x488d6d[_0xd490('0x51')]));_0x619cd5[_0xd490('0x58')][_0xd490('0x6d')]=_0x37c3a9['id'];if(_0x47ea75[_0xd490('0x50')]['filter']){_0x619cd5[_0xd490('0x58')]=_['merge'](_0x619cd5[_0xd490('0x58')],{'$or':_['map'](_0x619cd5[_0xd490('0x53')],function(_0x574d40){var _0x10658c={};_0x10658c[_0x574d40]={'$like':'%'+_0x47ea75[_0xd490('0x50')]['filter']+'%'};return _0x10658c;})});}_0x619cd5=_[_0xd490('0x5a')]({},_0x619cd5,_0x47ea75[_0xd490('0x5c')]);return db[_0xd490('0x75')][_0xd490('0x22')]({'where':_0x619cd5[_0xd490('0x58')]})[_0xd490('0x10')](function(_0x3a66ac){_0x5d4381[_0xd490('0x22')]=_0x3a66ac;if(_0x47ea75[_0xd490('0x50')][_0xd490('0x5e')]){_0x619cd5[_0xd490('0x5f')]=[{'all':!![]}];}return db[_0xd490('0x75')][_0xd490('0x60')](_0x619cd5);})[_0xd490('0x10')](function(_0x28e64d){_0x5d4381[_0xd490('0x77')]=_0x28e64d;return _0x5d4381;});}})['then'](respondWithFilteredResult(_0x1c3438,_0x619cd5))[_0xd490('0x1b')](handleError(_0x1c3438,null));};exports[_0xd490('0x78')]=function(_0x46457d,_0x569836){return db[_0xd490('0x5d')][_0xd490('0x68')]({'where':{'id':_0x46457d[_0xd490('0x69')]['id']}})['then'](handleEntityNotFound(_0x569836,null))[_0xd490('0x10')](function(_0x15850d){if(_0x15850d){return _0x15850d['removeAnswers'](_0x46457d[_0xd490('0x50')][_0xd490('0x73')]);}})[_0xd490('0x10')](respondWithStatusCode(_0x569836,null))[_0xd490('0x1b')](handleError(_0x569836,null));};exports[_0xd490('0x79')]=function(_0x46f23c,_0x54f72c){var _0x1fb684={'name':_0x46f23c['body'][_0xd490('0x2b')],'key':_0x46f23c[_0xd490('0x65')]['key'],'provider':_0x46f23c[_0xd490('0x65')][_0xd490('0x66')]===_0xd490('0x67')?null:_0x46f23c['body'][_0xd490('0x66')],'email':_0x46f23c[_0xd490('0x65')][_0xd490('0x7a')],'ListId':_0x46f23c[_0xd490('0x65')][_0xd490('0x7b')],'active':!_[_0xd490('0x7c')](_0x46f23c['body'][_0xd490('0x7d')])?_0x46f23c[_0xd490('0x65')][_0xd490('0x7d')]:!![],'description':_0x46f23c[_0xd490('0x65')]['description']||null};var _0x43b07d=getAuthenticationOptions(_0x1fb684[_0xd490('0x66')],_0x46f23c[_0xd490('0x65')]);_0x1fb684[_0xd490('0x43')]=_0x43b07d[_0xd490('0x43')];_0x1fb684['Smtp']=_0x43b07d[_0xd490('0x44')];return db[_0xd490('0x5d')]['create'](_0x1fb684,{'include':[{'model':db[_0xd490('0x47')],'as':_0xd490('0x44')},{'model':db['MailServerIn'],'as':_0xd490('0x43')}]})[_0xd490('0x10')](function(_0x818cb5){var _0x3d4060=_0x46f23c[_0xd490('0x38')][_0xd490('0x26')]({'plain':!![]});if(!_0x3d4060)throw new Error(_0xd490('0x7e'));if(_0x3d4060[_0xd490('0x7f')]===_0xd490('0x38')){var _0x2fd8ed=_0x818cb5['get']({'plain':!![]});return db[_0xd490('0x80')][_0xd490('0x68')]({'where':{'name':_0xd490('0x27'),'userProfileId':_0x3d4060['userProfileId']},'raw':!![]})[_0xd490('0x10')](function(_0x41b2bb){if(_0x41b2bb&&_0x41b2bb[_0xd490('0x81')]===0x0){return db['UserProfileResource'][_0xd490('0x79')]({'name':_0x2fd8ed[_0xd490('0x2b')],'resourceId':_0x2fd8ed['id'],'type':_0x41b2bb[_0xd490('0x2b')],'sectionId':_0x41b2bb['id']},{})[_0xd490('0x10')](function(){return _0x818cb5;});}else{return _0x818cb5;}})[_0xd490('0x1b')](function(_0x38f12c){logger[_0xd490('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38f12c);throw _0x38f12c;});}return _0x818cb5;})['then'](respondWithResult(_0x54f72c,0xc9))[_0xd490('0x1b')](handleError(_0x54f72c,null));};exports['getImap']=function(_0x577168,_0x5e41c7){return db[_0xd490('0x5d')]['findOne']({'where':{'id':_0x577168[_0xd490('0x69')]['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x5e41c7,null))[_0xd490('0x10')](function(_0x2b36dc){if(_0x2b36dc){return _0x2b36dc[_0xd490('0x82')]();}return null;})[_0xd490('0x10')](respondWithResult(_0x5e41c7,null))[_0xd490('0x1b')](handleError(_0x5e41c7,null));};exports[_0xd490('0x83')]=function(_0x21765c,_0x28a158){if(_0x21765c['body']['id']){delete _0x21765c['body']['id'];}return db[_0xd490('0x5d')][_0xd490('0x68')]({'where':{'id':_0x21765c[_0xd490('0x69')]['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x28a158,null))[_0xd490('0x10')](function(_0x2f2787){if(_0x2f2787){_0x21765c['body'][_0xd490('0x6d')]=_0x2f2787['id'];return db['MailServerIn'][_0xd490('0x79')](_0x21765c[_0xd490('0x65')]);}})[_0xd490('0x10')](respondWithResult(_0x28a158,null))['catch'](handleError(_0x28a158,null));};exports[_0xd490('0x84')]=function(_0x16646e,_0x49f998){return db[_0xd490('0x5d')][_0xd490('0x6f')]({'where':{'id':_0x16646e[_0xd490('0x69')]['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x49f998,null))['then'](function(_0x4c535f){if(_0x4c535f){return _0x4c535f[_0xd490('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x49f998,null))['catch'](handleError(_0x49f998,null));};exports['getSmtp']=function(_0x1a8181,_0x453e52){return db[_0xd490('0x5d')][_0xd490('0x6f')]({'where':{'id':_0x1a8181['params']['id']}})['then'](handleEntityNotFound(_0x453e52,null))[_0xd490('0x10')](function(_0x1eb66d){if(_0x1eb66d){return _0x1eb66d[_0xd490('0x86')]();}return null;})[_0xd490('0x10')](respondWithResult(_0x453e52,null))[_0xd490('0x1b')](handleError(_0x453e52,null));};exports[_0xd490('0x87')]=function(_0x285b10,_0x4deedd){if(_0x285b10[_0xd490('0x65')]['id']){delete _0x285b10[_0xd490('0x65')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x285b10[_0xd490('0x69')]['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x4deedd,null))[_0xd490('0x10')](function(_0x4ef731){if(_0x4ef731){_0x285b10['body'][_0xd490('0x6d')]=_0x4ef731['id'];return db[_0xd490('0x47')][_0xd490('0x79')](_0x285b10[_0xd490('0x65')]);}})[_0xd490('0x10')](respondWithResult(_0x4deedd,null))[_0xd490('0x1b')](handleError(_0x4deedd,null));};exports[_0xd490('0x88')]=function(_0x5203ff,_0xc0c831){return db[_0xd490('0x5d')][_0xd490('0x6f')]({'where':{'id':_0x5203ff[_0xd490('0x69')]['id']}})['then'](handleEntityNotFound(_0xc0c831,null))[_0xd490('0x10')](function(_0x18dd4e){if(_0x18dd4e){return _0x18dd4e[_0xd490('0x89')](null);}return null;})[_0xd490('0x10')](respondWithStatusCode(_0xc0c831,null))['catch'](handleError(_0xc0c831,null));};exports[_0xd490('0x8a')]=function(_0x4d44e1,_0x4c0d99){return db[_0xd490('0x8b')][_0xd490('0x68')]({'where':{'id':_0x4d44e1[_0xd490('0x69')]['id']}})['then'](handleEntityNotFound(_0x4c0d99,null))[_0xd490('0x10')](function(_0x5d6a71){if(_0x5d6a71){return _0x5d6a71[_0xd490('0x8a')](_0x4d44e1[_0xd490('0x65')]['ids'],_['omit'](_0x4d44e1[_0xd490('0x65')],['ids','id'])||{});}})[_0xd490('0x10')](respondWithResult(_0x4c0d99,null))[_0xd490('0x1b')](handleError(_0x4c0d99,null));};exports['getInteractions']=function(_0x8f8a93,_0x14c4c0){var _0x3382ca={'raw':![],'where':{}};var _0x3831c0={};var _0x2927f4={'count':0x0,'rows':[]};return db[_0xd490('0x5d')]['findOne']({'where':{'id':_0x8f8a93[_0xd490('0x69')]['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x14c4c0,null))[_0xd490('0x10')](function(_0x40119e){if(_0x40119e){_0x3831c0[_0xd490('0x4e')]=_['keys'](db[_0xd490('0x8b')]['rawAttributes']);_0x3831c0[_0xd490('0x50')]=_[_0xd490('0x62')](_0x8f8a93[_0xd490('0x50')]);_0x3831c0[_0xd490('0x51')]=_[_0xd490('0x52')](_0x3831c0[_0xd490('0x4e')],_0x3831c0[_0xd490('0x50')]);_0x3382ca[_0xd490('0x53')]=_['intersection'](_0x3831c0['model'],qs[_0xd490('0x54')](_0x8f8a93[_0xd490('0x50')]['fields']));_0x3382ca[_0xd490('0x53')]=_0x3382ca[_0xd490('0x53')]['length']?_0x3382ca['attributes']:_0x3831c0[_0xd490('0x4e')];if(!_0x8f8a93['query'][_0xd490('0x55')]('nolimit')){_0x3382ca[_0xd490('0x21')]=qs[_0xd490('0x21')](_0x8f8a93[_0xd490('0x50')][_0xd490('0x21')]);_0x3382ca[_0xd490('0x1f')]=qs[_0xd490('0x1f')](_0x8f8a93[_0xd490('0x50')][_0xd490('0x1f')]);}_0x3382ca[_0xd490('0x56')]=qs['sort'](_0x8f8a93[_0xd490('0x50')]['sort']);_0x3382ca[_0xd490('0x58')]=qs[_0xd490('0x51')](_[_0xd490('0x59')](_0x8f8a93[_0xd490('0x50')],_0x3831c0[_0xd490('0x51')]));_0x3382ca[_0xd490('0x58')]['MailAccountId']=_0x40119e['id'];if(_0x8f8a93[_0xd490('0x50')][_0xd490('0x71')]){_0x3382ca[_0xd490('0x58')]=_[_0xd490('0x5a')](_0x3382ca['where'],{'$or':_[_0xd490('0x4f')](_0x3382ca[_0xd490('0x53')],function(_0x2b7f85){var _0x517112={};_0x517112[_0x2b7f85]={'$like':'%'+_0x8f8a93[_0xd490('0x50')]['filter']+'%'};return _0x517112;})});}_0x3382ca=_[_0xd490('0x5a')]({},_0x3382ca,_0x8f8a93[_0xd490('0x5c')]);return db[_0xd490('0x8b')][_0xd490('0x22')]({'where':_0x3382ca[_0xd490('0x58')]})[_0xd490('0x10')](function(_0x1c3755){_0x2927f4[_0xd490('0x22')]=_0x1c3755;if(_0x8f8a93['query'][_0xd490('0x5e')]){_0x3382ca[_0xd490('0x5f')]=[{'model':db[_0xd490('0x8c')],'as':_0xd490('0x8d'),'required':![]},{'model':db[_0xd490('0x8e')],'as':_0xd490('0x8f'),'attributes':[_0xd490('0x2b'),'fullname',_0xd490('0x90')],'required':![]},{'model':db['Tag'],'as':_0xd490('0x91'),'attributes':['id',_0xd490('0x2b'),_0xd490('0x92')],'where':_0x8f8a93['query'][_0xd490('0x93')]?{'id':_0x8f8a93[_0xd490('0x50')][_0xd490('0x93')]}:undefined,'required':_0x8f8a93['query'][_0xd490('0x93')]?!![]:![]}];}return db[_0xd490('0x8b')][_0xd490('0x60')](_0x3382ca);})[_0xd490('0x10')](function(_0x436a4e){_0x2927f4['rows']=_0x436a4e;return _0x2927f4;});}})[_0xd490('0x10')](respondWithFilteredResult(_0x14c4c0,_0x3382ca))[_0xd490('0x1b')](handleError(_0x14c4c0,null));};exports[_0xd490('0x94')]=function addApplications(_0x426e09,_0x5f59fa){var _0x261e61=_0x426e09[_0xd490('0x69')]['id'];var _0x2475e1=_0x426e09['body'];var _0x519c77=0xc8;var _0x483202=null;return db[_0xd490('0x95')][_0xd490('0x96')]({'isolationLevel':db[_0xd490('0x95')][_0xd490('0x97')]['ISOLATION_LEVELS'][_0xd490('0x98')]},function(_0x984196){return db[_0xd490('0x5d')][_0xd490('0x6f')]({'where':{'id':_0x261e61},'transaction':_0x984196})[_0xd490('0x10')](function(_0x338bf6){if(_0x338bf6){return db[_0xd490('0x99')][_0xd490('0x25')]({'where':{'MailAccountId':_0x261e61},'transaction':_0x984196})[_0xd490('0x10')](function(){var _0x20064b=_['map'](_0x2475e1,function(_0x136533){_0x136533[_0xd490('0x6d')]=_0x261e61;return _0x136533;});return db[_0xd490('0x99')]['bulkCreate'](_0x20064b,{'transaction':_0x984196});});}else{_0x519c77=0x194;_0x483202=[];}});})['then'](function(){if(_0x519c77!==0x194){return db['MailApplication'][_0xd490('0x9a')]({'where':{'MailAccountId':_0x261e61},'order':_0xd490('0x9b')})[_0xd490('0x10')](function(_0x504ea2){_0x483202=_0x504ea2;});}})[_0xd490('0x1b')](function(_0x45d0fd){_0x519c77=0x1f4;logger['error'](_0x45d0fd[_0xd490('0x2a')]);if(_0x45d0fd[_0xd490('0x2b')]){delete _0x45d0fd['name'];}_0x483202=_0x45d0fd;})[_0xd490('0x9c')](function(){if(_0x483202===null){_0x5f59fa[_0xd490('0x1c')](_0x519c77);}else{if(_0x519c77===0x1f4){_0x5f59fa['status'](_0x519c77)[_0xd490('0x2c')](_0x483202);}else{_0x5f59fa[_0xd490('0x1d')](_0x519c77)['json'](_0x483202);}}});};exports[_0xd490('0x9d')]=function(_0x4c3dca,_0x337f05){var _0x5e25ef={};var _0x50811e={};var _0x2d43b2;var _0x4a402e;return db['MailAccount'][_0xd490('0x6f')]({'where':{'id':_0x4c3dca[_0xd490('0x69')]['id']}})['then'](handleEntityNotFound(_0x337f05,null))[_0xd490('0x10')](function(_0x1771b4){if(_0x1771b4){_0x2d43b2=_0x1771b4;_0x50811e['model']=_[_0xd490('0x62')](db['MailApplication'][_0xd490('0x4a')]);_0x50811e[_0xd490('0x50')]=_[_0xd490('0x62')](_0x4c3dca[_0xd490('0x50')]);_0x50811e['filters']=_[_0xd490('0x52')](_0x50811e[_0xd490('0x4e')],_0x50811e[_0xd490('0x50')]);_0x5e25ef[_0xd490('0x53')]=_[_0xd490('0x52')](_0x50811e[_0xd490('0x4e')],qs[_0xd490('0x54')](_0x4c3dca[_0xd490('0x50')][_0xd490('0x54')]));_0x5e25ef[_0xd490('0x53')]=_0x5e25ef[_0xd490('0x53')][_0xd490('0x63')]?_0x5e25ef[_0xd490('0x53')]:_0x50811e['model'];_0x5e25ef[_0xd490('0x56')]=qs[_0xd490('0x57')](_0x4c3dca[_0xd490('0x50')][_0xd490('0x57')]);_0x5e25ef[_0xd490('0x58')]=qs['filters'](_[_0xd490('0x59')](_0x4c3dca[_0xd490('0x50')],_0x50811e[_0xd490('0x51')]));if(_0x4c3dca['query'][_0xd490('0x71')]){_0x5e25ef[_0xd490('0x58')]=_[_0xd490('0x5a')](_0x5e25ef[_0xd490('0x58')],{'$or':_['map'](_0x5e25ef[_0xd490('0x53')],function(_0x443631){var _0x4eeda7={};_0x4eeda7[_0x443631]={'$like':'%'+_0x4c3dca[_0xd490('0x50')][_0xd490('0x71')]+'%'};return _0x4eeda7;})});}_0x5e25ef=_[_0xd490('0x5a')]({},_0x5e25ef,_0x4c3dca[_0xd490('0x5c')]);return _0x2d43b2[_0xd490('0x9d')](_0x5e25ef);}})['then'](function(_0x269617){if(_0x269617){_0x4a402e=_0x269617[_0xd490('0x63')];if(!_0x4c3dca[_0xd490('0x50')]['hasOwnProperty'](_0xd490('0x70'))){_0x5e25ef['limit']=qs['limit'](_0x4c3dca[_0xd490('0x50')][_0xd490('0x21')]);_0x5e25ef[_0xd490('0x1f')]=qs[_0xd490('0x1f')](_0x4c3dca[_0xd490('0x50')][_0xd490('0x1f')]);}return _0x2d43b2[_0xd490('0x9d')](_0x5e25ef);}})[_0xd490('0x10')](function(_0x26bb24){if(_0x26bb24){return _0x26bb24?{'count':_0x4a402e,'rows':_0x26bb24}:null;}})[_0xd490('0x10')](respondWithResult(_0x337f05,null))['catch'](handleError(_0x337f05,null));};exports['getMessages']=function(_0x6a149f,_0x3e1fc8){var _0x1acd07={'raw':!![],'where':{}};var _0x3ace90={};var _0x2d6ac2={'count':0x0,'rows':[]};return db[_0xd490('0x5d')][_0xd490('0x6f')]({'where':{'id':_0x6a149f[_0xd490('0x69')]['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x3e1fc8,null))[_0xd490('0x10')](function(_0x4cd750){if(_0x4cd750){_0x3ace90[_0xd490('0x4e')]=_['keys'](db[_0xd490('0x9e')][_0xd490('0x4a')]);_0x3ace90[_0xd490('0x50')]=_[_0xd490('0x62')](_0x6a149f[_0xd490('0x50')]);_0x3ace90[_0xd490('0x51')]=_[_0xd490('0x52')](_0x3ace90[_0xd490('0x4e')],_0x3ace90[_0xd490('0x50')]);_0x1acd07['attributes']=_['intersection'](_0x3ace90[_0xd490('0x4e')],qs['fields'](_0x6a149f['query'][_0xd490('0x54')]));_0x1acd07['attributes']=_0x1acd07[_0xd490('0x53')][_0xd490('0x63')]?_0x1acd07[_0xd490('0x53')]:_0x3ace90[_0xd490('0x4e')];if(!_0x6a149f[_0xd490('0x50')][_0xd490('0x55')](_0xd490('0x70'))){_0x1acd07[_0xd490('0x21')]=qs['limit'](_0x6a149f[_0xd490('0x50')]['limit']);_0x1acd07[_0xd490('0x1f')]=qs[_0xd490('0x1f')](_0x6a149f[_0xd490('0x50')]['offset']);}_0x1acd07[_0xd490('0x56')]=qs['sort'](_0x6a149f['query']['sort']);_0x1acd07[_0xd490('0x58')]=qs['filters'](_[_0xd490('0x59')](_0x6a149f[_0xd490('0x50')],_0x3ace90['filters']));_0x1acd07[_0xd490('0x58')][_0xd490('0x6d')]=_0x4cd750['id'];if(_0x6a149f[_0xd490('0x50')]['filter']){_0x1acd07[_0xd490('0x58')]=_['merge'](_0x1acd07[_0xd490('0x58')],{'$or':_[_0xd490('0x4f')](_0x1acd07[_0xd490('0x53')],function(_0xc1d78e){var _0x36c737={};_0x36c737[_0xc1d78e]={'$like':'%'+_0x6a149f[_0xd490('0x50')][_0xd490('0x71')]+'%'};return _0x36c737;})});}if(_0x6a149f[_0xd490('0x50')][_0xd490('0x9f')]){var _0x611d86=_0x6a149f[_0xd490('0x50')][_0xd490('0x9f')]['split'](',');var _0x5e664b={};_0x5e664b[_0x611d86[0x0]]={'$gte':moment(_0x611d86[0x1])[_0xd490('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1acd07[_0xd490('0x58')]=_[_0xd490('0x5a')](_0x1acd07[_0xd490('0x58')],_0x5e664b);}_0x1acd07=_[_0xd490('0x5a')]({},_0x1acd07,_0x6a149f[_0xd490('0x5c')]);return db[_0xd490('0x9e')][_0xd490('0x22')]({'where':_0x1acd07[_0xd490('0x58')]})['then'](function(_0x2a591a){_0x2d6ac2[_0xd490('0x22')]=_0x2a591a;if(_0x6a149f['query'][_0xd490('0x5e')]){_0x1acd07[_0xd490('0x5f')]=[{'all':!![]}];}return db[_0xd490('0x9e')][_0xd490('0x60')](_0x1acd07);})['then'](function(_0x2e60dc){if(_0x6a149f[_0xd490('0x50')][_0xd490('0xa1')]===_0xd490('0xa2')){for(var _0x3790c0=0x0;_0x3790c0<_0x2e60dc['length'];_0x3790c0++){_0x2e60dc[_0x3790c0]['body']=juice(_0x2e60dc[_0x3790c0]['body']);}}_0x2d6ac2[_0xd490('0x77')]=_0x2e60dc;return _0x2d6ac2;});}})[_0xd490('0x10')](respondWithFilteredResult(_0x3e1fc8,_0x1acd07))[_0xd490('0x1b')](handleError(_0x3e1fc8,null));};exports[_0xd490('0x2c')]=function(_0x46696c,_0xb3b48){var _0x1d7540,_0x3d464d={},_0x50947d;if(_0x46696c[_0xd490('0x65')]['to']){_0x50947d=_0x46696c[_0xd490('0x65')]['to'][_0xd490('0xa3')](',')[0x0];}return db[_0xd490('0x5d')]['find']({'where':{'id':_0x46696c[_0xd490('0x69')]['id']},'include':[{'model':db[_0xd490('0xa4')],'as':_0xd490('0xa5'),'include':[{'model':db[_0xd490('0x8c')],'as':_0xd490('0xa6'),'where':{'email':_0x50947d},'limit':0x1,'order':[[_0xd490('0xa7'),_0xd490('0xa8')]]}]},{'model':db[_0xd490('0x47')],'as':_0xd490('0x44'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xd490('0xa9'),'raw':!![]}]}]})[_0xd490('0x10')](handleEntityNotFound(_0xb3b48,null))['then'](function(_0x58b9c5){if(!_0x58b9c5)return;_0x1d7540=_0x58b9c5;if(!_0x58b9c5[_0xd490('0x44')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xd490('0x7c')](_0x46696c['body'][_0xd490('0xaa')])){_0x46696c[_0xd490('0x65')][_0xd490('0xaa')]=util[_0xd490('0xa0')](_0xd490('0xab'),_0x58b9c5[_0xd490('0x2b')],_0x58b9c5[_0xd490('0x7a')]||_0x58b9c5['Smtp'][_0xd490('0x38')]);}if(_0x46696c[_0xd490('0x65')]['attachments']&&_0x46696c['body'][_0xd490('0xac')][_0xd490('0x63')]){for(var _0x461677=0x0;_0x461677<_0x46696c[_0xd490('0x65')][_0xd490('0xac')][_0xd490('0x63')];_0x461677+=0x1){_0x46696c[_0xd490('0x65')]['attachments'][_0x461677]={'filename':_0x46696c[_0xd490('0x65')][_0xd490('0xac')][_0x461677]['name'],'path':path['join'](config['root'],_0xd490('0xad'),_0x46696c[_0xd490('0x65')]['attachments'][_0x461677][_0xd490('0xae')])};}}var _0x22c798=_0x58b9c5[_0xd490('0xaf')]();return respondWithRpcPromise(_0xd490('0xb0'),_0xd490('0xb1'),{'account':_0x22c798,'message':_0x46696c[_0xd490('0x65')]});})[_0xd490('0x10')](function(_0x1496b5){if(!_0x1496b5)return;_0x3d464d=_0x1496b5;if(!_0x1d7540[_0xd490('0xa5')])throw new Error(_0xd490('0xb2'));if(_0x1d7540[_0xd490('0xa5')]['Contacts'][_0xd490('0x63')])return _0x1d7540['List'][_0xd490('0xa6')][0x0];return db[_0xd490('0x8c')][_0xd490('0x79')](_[_0xd490('0xa')](_0x46696c[_0xd490('0x65')],{'firstName':_0x46696c['body']['to'],'email':_0x46696c[_0xd490('0x65')]['to'],'phone':_0x46696c[_0xd490('0x65')]['to'],'ListId':_0x1d7540['ListId']}));})[_0xd490('0x10')](function(_0x51ec00){if(!_0x51ec00)return;var _0x2d3d17={'UserId':_0x46696c[_0xd490('0x38')]['id'],'ContactId':_0x51ec00['id'],'MailAccountId':_0x1d7540['id'],'inReplyTo':_0x3d464d['messageId'],'to':_0x46696c['body'][_0xd490('0xaa')],'cc':_0x46696c[_0xd490('0x65')]['cc'],'subject':_0x46696c[_0xd490('0x65')][_0xd490('0xb3')],'attach':_0x46696c['body'][_0xd490('0xb4')],'firstMsgDirection':_0xd490('0xb5'),'lastMsgAt':moment()[_0xd490('0xa0')](_0xd490('0xb6')),'lastMsgDirection':_0xd490('0xb5'),'Messages':[_[_0xd490('0x5a')](_0x46696c[_0xd490('0x65')],{'messageId':_0x3d464d[_0xd490('0xb7')],'sentAt':moment()[_0xd490('0xa0')](_0xd490('0xb6')),'read':!![],'MailAccountId':_0x1d7540['id'],'UserId':_0x46696c['user']['id'],'ContactId':_0x51ec00['id']})]};if(_0x46696c[_0xd490('0x65')][_0xd490('0xb8')]){_0x2d3d17=_[_0xd490('0x5a')](_0x2d3d17,_0x46696c[_0xd490('0x65')]['Interaction']);}return db[_0xd490('0x8b')][_0xd490('0x79')](_0x2d3d17,{'include':[{'model':db[_0xd490('0x9e')],'as':_0xd490('0xb9')}]});})['then'](respondWithResult(_0xb3b48,null))[_0xd490('0x1b')](handleError(_0xb3b48,null));};exports['verifySmtp']=function(_0x1e6658,_0x4203f4){return db[_0xd490('0x5d')][_0xd490('0x68')]({'where':{'id':_0x1e6658[_0xd490('0x69')]['id']},'include':[{'model':db[_0xd490('0x47')],'as':_0xd490('0x44'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xd490('0x10')](handleEntityNotFound(_0x4203f4,null))['then'](function(_0x46f323){if(!_0x46f323[_0xd490('0x44')])return;var _0x47d540=_0x46f323['getSmtpOptions']();return respondWithRpcPromise(_0xd490('0xba'),'verifySmtp',{'account':_0x47d540});})[_0xd490('0x10')](respondWithResult(_0x4203f4,null))[_0xd490('0x1b')](handleError(_0x4203f4,null));};exports[_0xd490('0x25')]=function(_0xab18bd,_0x2c1570){return db[_0xd490('0x5d')][_0xd490('0x68')]({'where':{'id':_0xab18bd[_0xd490('0x69')]['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x2c1570,null))['then'](function(_0x32bdc7){if(_0x32bdc7&&_0x32bdc7[_0xd490('0x41')]){throw new db[(_0xd490('0xbb'))][(_0xd490('0xbc'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x32bdc7;})['then'](removeEntity(_0x2c1570,null))[_0xd490('0x1b')](handleError(_0x2c1570,null));};exports[_0xd490('0xbd')]=function(_0x426f8a,_0x1143fe){return db[_0xd490('0x5d')][_0xd490('0x68')]({'where':{'id':_0x426f8a[_0xd490('0x69')]['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x1143fe,null))[_0xd490('0x10')](function(_0x3d2064){if(_0x3d2064){return _0x3d2064[_0xd490('0xbd')](_0x426f8a[_0xd490('0x65')][_0xd490('0x73')],_[_0xd490('0xbe')](_0x426f8a['body'],[_0xd490('0x73'),'id'])||{})[_0xd490('0xbf')](function(_0x5bdc6f){for(var _0x413cd9=0x0;_0x413cd9<_0x426f8a[_0xd490('0x65')][_0xd490('0x73')][_0xd490('0x63')];_0x413cd9+=0x1){socket['emit'](_0xd490('0xc0'),{'UserId':Number(_0x426f8a['body'][_0xd490('0x73')][_0x413cd9]),'MailAccountId':Number(_0x426f8a[_0xd490('0x69')]['id'])});}return _0x5bdc6f;});}})[_0xd490('0x10')](respondWithResult(_0x1143fe,null))[_0xd490('0x1b')](handleError(_0x1143fe,null));};exports[_0xd490('0xc1')]=function(_0x43d92c,_0x4d188f){return db['MailAccount'][_0xd490('0x68')]({'where':{'id':_0x43d92c['params']['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x4d188f,null))[_0xd490('0x10')](function(_0x30ad24){if(_0x30ad24){return _0x30ad24['removeAgents'](_0x43d92c[_0xd490('0x50')][_0xd490('0x73')])[_0xd490('0x10')](function(){if(_[_0xd490('0xc2')](_0x43d92c[_0xd490('0x50')][_0xd490('0x73')])){for(var _0x1fea41=0x0;_0x1fea41<_0x43d92c[_0xd490('0x50')][_0xd490('0x73')][_0xd490('0x63')];_0x1fea41+=0x1){socket[_0xd490('0xc3')]('userMailAccount:remove',{'UserId':Number(_0x43d92c[_0xd490('0x50')][_0xd490('0x73')][_0x1fea41]),'MailAccountId':Number(_0x43d92c[_0xd490('0x69')]['id'])});}}else{socket[_0xd490('0xc3')](_0xd490('0xc4'),{'UserId':Number(_0x43d92c[_0xd490('0x50')][_0xd490('0x73')]),'MailAccountId':Number(_0x43d92c[_0xd490('0x69')]['id'])});}});}})['then'](respondWithStatusCode(_0x4d188f,null))[_0xd490('0x1b')](handleError(_0x4d188f,null));};exports[_0xd490('0xc5')]=function(_0x234f23,_0x1a7a17){var _0x4d7228={};var _0x4d0a4e={};var _0x1526c0;var _0x4f83a2;return db[_0xd490('0x5d')][_0xd490('0x6f')]({'where':{'id':_0x234f23[_0xd490('0x69')]['id']}})[_0xd490('0x10')](handleEntityNotFound(_0x1a7a17,null))['then'](function(_0x42fa99){if(_0x42fa99){_0x1526c0=_0x42fa99;_0x4d0a4e[_0xd490('0x4e')]=_[_0xd490('0x62')](db[_0xd490('0x8e')][_0xd490('0x4a')]);_0x4d0a4e[_0xd490('0x50')]=_[_0xd490('0x62')](_0x234f23[_0xd490('0x50')]);_0x4d0a4e[_0xd490('0x51')]=_['intersection'](_0x4d0a4e[_0xd490('0x4e')],_0x4d0a4e[_0xd490('0x50')]);_0x4d7228[_0xd490('0x53')]=_[_0xd490('0x52')](_0x4d0a4e[_0xd490('0x4e')],qs['fields'](_0x234f23['query'][_0xd490('0x54')]));_0x4d7228['attributes']=_0x4d7228[_0xd490('0x53')][_0xd490('0x63')]?_0x4d7228['attributes']:_0x4d0a4e[_0xd490('0x4e')];_0x4d7228[_0xd490('0x56')]=qs[_0xd490('0x57')](_0x234f23['query'][_0xd490('0x57')]);_0x4d7228[_0xd490('0x58')]=qs[_0xd490('0x51')](_['pick'](_0x234f23['query'],_0x4d0a4e[_0xd490('0x51')]));if(_0x234f23[_0xd490('0x50')][_0xd490('0x71')]){_0x4d7228['where']=_[_0xd490('0x5a')](_0x4d7228[_0xd490('0x58')],{'$or':_[_0xd490('0x4f')](_0x4d7228[_0xd490('0x53')],function(_0x56d306){var _0x210e45={};_0x210e45[_0x56d306]={'$like':'%'+_0x234f23[_0xd490('0x50')][_0xd490('0x71')]+'%'};return _0x210e45;})});}_0x4d7228=_[_0xd490('0x5a')]({},_0x4d7228,_0x234f23['options']);return _0x1526c0['getAgents'](_0x4d7228);}})[_0xd490('0x10')](function(_0x2a5271){if(_0x2a5271){_0x4f83a2=_0x2a5271[_0xd490('0x63')];if(!_0x234f23['query'][_0xd490('0x55')]('nolimit')){_0x4d7228[_0xd490('0x21')]=qs[_0xd490('0x21')](_0x234f23['query']['limit']);_0x4d7228[_0xd490('0x1f')]=qs[_0xd490('0x1f')](_0x234f23[_0xd490('0x50')]['offset']);}return _0x1526c0[_0xd490('0xc5')](_0x4d7228);}})[_0xd490('0x10')](function(_0x4973ef){if(_0x4973ef){return _0x4973ef?{'count':_0x4f83a2,'rows':_0x4973ef}:null;}})['then'](respondWithResult(_0x1a7a17,null))[_0xd490('0x1b')](handleError(_0x1a7a17,null));}; \ No newline at end of file +var _0xdee4=['intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','Pause','options','find','update','body','provider','params','Mail\x20Account\x20not\x20found','service','describe','addDisposition','Disposition','create','getDispositions','findOne','rawAttributes','hasOwnProperty','MailAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','MailApplication','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','bluebird','util','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','catch','status','end','json','offset','undefined','limit','count','destroy','get','MailAccounts','sendStatus','stack','name','send','hotmail','imap-mail.outlook.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','MailAccount','fieldName','type','key','model','map','query','keys','filters'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0xdee4,0x137));var _0x4dee=function(_0x5391ef,_0x3c8788){_0x5391ef=_0x5391ef-0x0;var _0x136499=_0xdee4[_0x5391ef];return _0x136499;};'use strict';var moment=require('moment');var BPromise=require(_0x4dee('0x0'));var util=require(_0x4dee('0x1'));var path=require('path');var _=require('lodash');var juice=require(_0x4dee('0x2'));var Redis=require('ioredis');var qs=require(_0x4dee('0x3'));var logger=require(_0x4dee('0x4'))(_0x4dee('0x5'));var config=require(_0x4dee('0x6'));var db=require(_0x4dee('0x7'))['db'];config[_0x4dee('0x8')]=_[_0x4dee('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4dee('0xa'))(new Redis(config['redis']));require(_0x4dee('0xb'))[_0x4dee('0xc')](socket);var jayson=require(_0x4dee('0xd'));var client=jayson['client'][_0x4dee('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x13c47d,_0x3a84ec,_0x666103,_0x2e56e2){return new BPromise(function(_0x283043,_0x31e781){var _0x3357f0=_0x2e56e2||client;return _0x3357f0[_0x4dee('0xf')](_0x13c47d,_0x666103)[_0x4dee('0x10')](function(_0x492a04){logger[_0x4dee('0x11')]('MailAccount,\x20%s,\x20%s',_0x3a84ec,_0x4dee('0x12'));logger[_0x4dee('0x13')](_0x4dee('0x14'),_0x3a84ec,'request\x20sent',JSON['stringify'](_0x492a04));if(_0x492a04['error']){if(_0x492a04[_0x4dee('0x15')][_0x4dee('0x16')]===0x1f4){logger[_0x4dee('0x15')](_0x4dee('0x17'),_0x3a84ec,_0x492a04[_0x4dee('0x15')][_0x4dee('0x18')]);return _0x31e781(_0x492a04[_0x4dee('0x15')]['message']);}logger['error'](_0x4dee('0x17'),_0x3a84ec,_0x492a04[_0x4dee('0x15')][_0x4dee('0x18')]);return _0x283043(_0x492a04[_0x4dee('0x15')][_0x4dee('0x18')]);}else{logger[_0x4dee('0x11')]('MailAccount,\x20%s,\x20%s',_0x3a84ec,_0x4dee('0x12'));_0x283043(_0x492a04['result'][_0x4dee('0x18')]);}})[_0x4dee('0x19')](function(_0x363f23){logger[_0x4dee('0x15')](_0x4dee('0x17'),_0x3a84ec,_0x363f23);_0x31e781(_0x363f23);});});}function respondWithStatusCode(_0x95c345,_0xe86e40){_0xe86e40=_0xe86e40||0xcc;return function(_0x379320){if(_0x379320){return _0x95c345['sendStatus'](_0xe86e40);}return _0x95c345[_0x4dee('0x1a')](_0xe86e40)[_0x4dee('0x1b')]();};}function respondWithResult(_0x4de30b,_0x26515c){_0x26515c=_0x26515c||0xc8;return function(_0x311198){if(_0x311198){return _0x4de30b[_0x4dee('0x1a')](_0x26515c)[_0x4dee('0x1c')](_0x311198);}};}function respondWithFilteredResult(_0x35dda8,_0x17ef4b){return function(_0x1f7385){if(_0x1f7385){var _0x19c8c0=typeof _0x17ef4b[_0x4dee('0x1d')]===_0x4dee('0x1e')&&typeof _0x17ef4b[_0x4dee('0x1f')]===_0x4dee('0x1e');var _0x3f5477=_0x1f7385['count'];var _0x5582b9=_0x19c8c0?0x0:_0x17ef4b['offset'];var _0x10f6ca=_0x19c8c0?_0x1f7385[_0x4dee('0x20')]:_0x17ef4b['offset']+_0x17ef4b[_0x4dee('0x1f')];var _0xa4452f;if(_0x10f6ca>=_0x3f5477){_0x10f6ca=_0x3f5477;_0xa4452f=0xc8;}else{_0xa4452f=0xce;}_0x35dda8[_0x4dee('0x1a')](_0xa4452f);return _0x35dda8['set']('Content-Range',_0x5582b9+'-'+_0x10f6ca+'/'+_0x3f5477)['json'](_0x1f7385);}return null;};}function saveUpdates(_0x4dbf2d){return function(_0x41db3c){if(_0x41db3c){return _0x41db3c['update'](_0x4dbf2d)[_0x4dee('0x10')](function(_0x4634a0){return _0x4634a0;});}return null;};}function removeEntity(_0x3e1dac){return function(_0x2125f7){if(_0x2125f7){return _0x2125f7[_0x4dee('0x21')]()[_0x4dee('0x10')](function(){var _0x266173=_0x2125f7[_0x4dee('0x22')]({'plain':!![]});var _0x27ac12=_0x4dee('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x27ac12,'resourceId':_0x266173['id']}})['then'](function(){return _0x2125f7;});})[_0x4dee('0x10')](function(){_0x3e1dac['status'](0xcc)[_0x4dee('0x1b')]();});}};}function handleEntityNotFound(_0x20ba07){return function(_0xc660ed){if(!_0xc660ed){_0x20ba07[_0x4dee('0x24')](0x194);}return _0xc660ed;};}function handleError(_0x5680c0,_0x127602){_0x127602=_0x127602||0x1f4;return function(_0x1af7e1){logger[_0x4dee('0x15')](_0x1af7e1[_0x4dee('0x25')]);if(_0x1af7e1[_0x4dee('0x26')]){delete _0x1af7e1[_0x4dee('0x26')];}_0x5680c0[_0x4dee('0x1a')](_0x127602)[_0x4dee('0x27')](_0x1af7e1);};}function getImapHost(_0x407444){switch(_0x407444){case'gmail':return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0x4dee('0x28'):return _0x4dee('0x29');case'outlook365':return'outlook.office365.com';}throw new Error(_0x4dee('0x2a'),_0x407444);}function getSmtpHost(_0x41ff37){switch(_0x41ff37){case'gmail':return _0x4dee('0x2b');case _0x4dee('0x2c'):return _0x4dee('0x2d');case _0x4dee('0x28'):return _0x4dee('0x2e');case'outlook365':return'smtp.office365.com';}throw new Error(_0x4dee('0x2a'),_0x41ff37);}function getAuthenticationOptions(_0x1dba04,_0x3ef50d){var _0x289b3c={};var _0x3b6d71={};if(_0x1dba04){_0x289b3c[_0x4dee('0x2f')]=_0x3b6d71[_0x4dee('0x2f')]=_0x3ef50d[_0x4dee('0x30')];_0x289b3c[_0x4dee('0x31')]=_0x3b6d71[_0x4dee('0x32')]=_0x3ef50d[_0x4dee('0x31')];if(_0x3ef50d[_0x4dee('0x33')]){_0x289b3c[_0x4dee('0x33')]=_0x3b6d71[_0x4dee('0x33')]=!![];_0x289b3c[_0x4dee('0x34')]=_0x3b6d71[_0x4dee('0x34')]=_0x3ef50d[_0x4dee('0x34')];_0x289b3c[_0x4dee('0x31')]=_0x3b6d71[_0x4dee('0x32')]=null;}else{_0x289b3c[_0x4dee('0x34')]=_0x3b6d71['CloudProviderId']=null;}_0x289b3c[_0x4dee('0x35')]=getImapHost(_0x1dba04);_0x289b3c[_0x4dee('0x36')]=0x3e1;_0x3b6d71[_0x4dee('0x35')]=getSmtpHost(_0x1dba04);_0x3b6d71[_0x4dee('0x36')]=0x24b;_0x3b6d71['secure']=![];_0x289b3c['service']=_0x3b6d71['service']=null;}else{if(_0x3ef50d[_0x4dee('0x37')]){_0x289b3c[_0x4dee('0x2f')]=_0x3b6d71['user']=_0x3ef50d[_0x4dee('0x30')];_0x289b3c[_0x4dee('0x31')]=_0x3b6d71[_0x4dee('0x32')]=_0x3ef50d[_0x4dee('0x31')];}else{_0x289b3c['authentication']=_0x3b6d71[_0x4dee('0x37')]=![];_0x289b3c[_0x4dee('0x2f')]=_0x3b6d71[_0x4dee('0x2f')]=null;_0x289b3c['password']=_0x3b6d71['pass']=null;}_0x289b3c['host']=_0x3ef50d[_0x4dee('0x38')][_0x4dee('0x35')];_0x289b3c[_0x4dee('0x36')]=_0x3ef50d['Imap'][_0x4dee('0x36')];_0x3b6d71[_0x4dee('0x35')]=_0x3ef50d[_0x4dee('0x39')][_0x4dee('0x35')];_0x3b6d71[_0x4dee('0x36')]=_0x3ef50d[_0x4dee('0x39')]['port'];}return{'Imap':_0x289b3c,'Smtp':_0x3b6d71};}exports[_0x4dee('0x3a')]=function(_0x5afc6c,_0x45bc02){var _0x47af25={'include':[{'model':db[_0x4dee('0x3b')],'as':_0x4dee('0x38')},{'model':db[_0x4dee('0x3c')],'as':_0x4dee('0x39')},{'model':db['Pause'],'as':_0x4dee('0x3d')}]},_0x165fa5={},_0x38f086={'count':0x0,'rows':[]};var _0x2f1518=_['map'](db[_0x4dee('0x3e')]['rawAttributes'],function(_0x11b5ac){return{'name':_0x11b5ac[_0x4dee('0x3f')],'type':_0x11b5ac[_0x4dee('0x40')][_0x4dee('0x41')]};});_0x165fa5[_0x4dee('0x42')]=_[_0x4dee('0x43')](_0x2f1518,_0x4dee('0x26'));_0x165fa5[_0x4dee('0x44')]=_[_0x4dee('0x45')](_0x5afc6c[_0x4dee('0x44')]);_0x165fa5[_0x4dee('0x46')]=_[_0x4dee('0x47')](_0x165fa5[_0x4dee('0x42')],_0x165fa5['query']);_0x47af25[_0x4dee('0x48')]=_[_0x4dee('0x47')](_0x165fa5['model'],qs[_0x4dee('0x49')](_0x5afc6c[_0x4dee('0x44')]['fields']));_0x47af25[_0x4dee('0x48')]=_0x47af25[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x47af25[_0x4dee('0x48')]:_0x165fa5[_0x4dee('0x42')];if(!_0x5afc6c['query']['hasOwnProperty'](_0x4dee('0x4b'))){_0x47af25[_0x4dee('0x1f')]=qs['limit'](_0x5afc6c[_0x4dee('0x44')]['limit']);_0x47af25['offset']=qs[_0x4dee('0x1d')](_0x5afc6c['query']['offset']);}_0x47af25[_0x4dee('0x4c')]=qs['sort'](_0x5afc6c[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x47af25[_0x4dee('0x4e')]=qs[_0x4dee('0x46')](_[_0x4dee('0x4f')](_0x5afc6c[_0x4dee('0x44')],_0x165fa5[_0x4dee('0x46')]),_0x2f1518);if(_0x5afc6c['query']['filter']){_0x47af25[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x47af25[_0x4dee('0x4e')],{'$or':_[_0x4dee('0x43')](_0x2f1518,function(_0x30c511){if(_0x30c511[_0x4dee('0x40')]!==_0x4dee('0x51')){var _0x1fa9ef={};_0x1fa9ef[_0x30c511['name']]={'$like':'%'+_0x5afc6c['query'][_0x4dee('0x52')]+'%'};return _0x1fa9ef;}})});}_0x47af25=_['merge']({},_0x47af25,_0x5afc6c['options']);var _0x353360={'where':_0x47af25['where']};return db[_0x4dee('0x3e')][_0x4dee('0x20')](_0x353360)[_0x4dee('0x10')](function(_0xc9630f){_0x38f086[_0x4dee('0x20')]=_0xc9630f;if(_0x5afc6c[_0x4dee('0x44')][_0x4dee('0x53')]){_0x47af25[_0x4dee('0x54')]=[{'all':!![]}];}return db['MailAccount'][_0x4dee('0x55')](_0x47af25);})[_0x4dee('0x10')](function(_0x5a3525){_0x38f086['rows']=_0x5a3525;return _0x38f086;})[_0x4dee('0x10')](respondWithFilteredResult(_0x45bc02,_0x47af25))[_0x4dee('0x19')](handleError(_0x45bc02,null));};exports[_0x4dee('0x56')]=function(_0x3539cd,_0x4eb3a2){var _0x597cc9={'raw':![],'where':{'id':_0x3539cd['params']['id']},'include':[{'model':db[_0x4dee('0x3b')],'as':_0x4dee('0x38')},{'model':db[_0x4dee('0x3c')],'as':_0x4dee('0x39')},{'model':db[_0x4dee('0x57')],'as':'mandatoryDispositionPause'}]},_0x3057d9={};_0x3057d9[_0x4dee('0x42')]=_['keys'](db['MailAccount']['rawAttributes']);_0x3057d9[_0x4dee('0x44')]=_['keys'](_0x3539cd[_0x4dee('0x44')]);_0x3057d9[_0x4dee('0x46')]=_[_0x4dee('0x47')](_0x3057d9[_0x4dee('0x42')],_0x3057d9[_0x4dee('0x44')]);_0x597cc9['attributes']=_['intersection'](_0x3057d9[_0x4dee('0x42')],qs['fields'](_0x3539cd['query'][_0x4dee('0x49')]));_0x597cc9[_0x4dee('0x48')]=_0x597cc9['attributes'][_0x4dee('0x4a')]?_0x597cc9[_0x4dee('0x48')]:_0x3057d9[_0x4dee('0x42')];if(_0x3539cd[_0x4dee('0x44')][_0x4dee('0x53')]){_0x597cc9['include']=[{'all':!![]}];}_0x597cc9=_['merge']({},_0x597cc9,_0x3539cd[_0x4dee('0x58')]);return db['MailAccount'][_0x4dee('0x59')](_0x597cc9)[_0x4dee('0x10')](handleEntityNotFound(_0x4eb3a2,null))[_0x4dee('0x10')](respondWithResult(_0x4eb3a2,null))[_0x4dee('0x19')](handleError(_0x4eb3a2,null));};exports[_0x4dee('0x5a')]=function(_0x3fdbb3,_0x1867df){if(_0x3fdbb3[_0x4dee('0x5b')]['id']){delete _0x3fdbb3[_0x4dee('0x5b')]['id'];}var _0x266c1e=_0x3fdbb3['body'][_0x4dee('0x5c')]==='custom'?null:_0x3fdbb3[_0x4dee('0x5b')][_0x4dee('0x5c')];var _0x1ee901=_0x3fdbb3[_0x4dee('0x5b')]['Imap']||{};var _0xac566c=_0x3fdbb3['body']['Smtp']||{};if(_0x266c1e){_0x1ee901['host']=getImapHost(_0x266c1e);_0x1ee901['port']=0x3e1;_0xac566c[_0x4dee('0x35')]=getSmtpHost(_0x266c1e);_0xac566c[_0x4dee('0x36')]=0x24b;_0xac566c['secure']=![];}if(_0xac566c[_0x4dee('0x33')]){_0xac566c['secure']=![];}else{_0xac566c[_0x4dee('0x34')]=null;}if(!_0x1ee901['modernAuthentication'])_0x1ee901[_0x4dee('0x34')]=null;_0x3fdbb3['body']['Imap']=_0x1ee901;_0x3fdbb3[_0x4dee('0x5b')][_0x4dee('0x39')]=_0xac566c;return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x3fdbb3[_0x4dee('0x5d')]['id']},'include':[{'model':db[_0x4dee('0x3b')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x4dee('0x39')},{'model':db[_0x4dee('0x57')],'as':_0x4dee('0x3d')}]})[_0x4dee('0x10')](handleEntityNotFound(_0x1867df,null))[_0x4dee('0x10')](function(_0x526e1e){if(!_0x526e1e)throw new Error(_0x4dee('0x5e'));if(_0x526e1e[_0x4dee('0x5f')])delete _0x3fdbb3[_0x4dee('0x5b')][_0x4dee('0x38')];return _0x526e1e;})[_0x4dee('0x10')](saveUpdates(_0x3fdbb3['body'],null))[_0x4dee('0x10')](function(_0x486ef8){if(!_0x3fdbb3[_0x4dee('0x5b')][_0x4dee('0x38')])return _0x486ef8;return db['MailServerIn'][_0x4dee('0x5a')](_0x3fdbb3[_0x4dee('0x5b')][_0x4dee('0x38')],{'where':{'MailAccountId':_0x486ef8['id']}})[_0x4dee('0x10')](function(){return _0x486ef8;});})[_0x4dee('0x10')](function(_0x344f1f){if(!_0x3fdbb3[_0x4dee('0x5b')]['Smtp'])return _0x344f1f;return db[_0x4dee('0x3c')][_0x4dee('0x5a')](_0x3fdbb3['body']['Smtp'],{'where':{'MailAccountId':_0x344f1f['id']}})[_0x4dee('0x10')](function(){return _0x344f1f;});})[_0x4dee('0x10')](respondWithResult(_0x1867df,null))[_0x4dee('0x19')](handleError(_0x1867df,null));};exports[_0x4dee('0x60')]=function(_0x4a0821,_0x3e31a5){return db[_0x4dee('0x3e')][_0x4dee('0x60')]()['then'](respondWithResult(_0x3e31a5,null))[_0x4dee('0x19')](handleError(_0x3e31a5,null));};exports[_0x4dee('0x61')]=function(_0xd70f92,_0x197f1a){if(_0xd70f92['body']['id']){delete _0xd70f92[_0x4dee('0x5b')]['id'];}return db[_0x4dee('0x3e')]['find']({'where':{'id':_0xd70f92[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x197f1a,null))['then'](function(_0x42fa08){if(_0x42fa08){_0xd70f92[_0x4dee('0x5b')]['MailAccountId']=_0x42fa08['id'];return db[_0x4dee('0x62')][_0x4dee('0x63')](_0xd70f92[_0x4dee('0x5b')]);}})['then'](respondWithResult(_0x197f1a,null))['catch'](handleError(_0x197f1a,null));};exports[_0x4dee('0x64')]=function(_0x2d3e9c,_0x3ad22e){var _0x33613f={'raw':![],'where':{}};var _0x2d1442={};var _0x4e2875={'count':0x0,'rows':[]};return db['MailAccount'][_0x4dee('0x65')]({'where':{'id':_0x2d3e9c['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x3ad22e,null))[_0x4dee('0x10')](function(_0x4d182d){if(_0x4d182d){_0x2d1442[_0x4dee('0x42')]=_[_0x4dee('0x45')](db[_0x4dee('0x62')][_0x4dee('0x66')]);_0x2d1442[_0x4dee('0x44')]=_['keys'](_0x2d3e9c[_0x4dee('0x44')]);_0x2d1442['filters']=_[_0x4dee('0x47')](_0x2d1442[_0x4dee('0x42')],_0x2d1442[_0x4dee('0x44')]);_0x33613f[_0x4dee('0x48')]=_[_0x4dee('0x47')](_0x2d1442[_0x4dee('0x42')],qs[_0x4dee('0x49')](_0x2d3e9c[_0x4dee('0x44')][_0x4dee('0x49')]));_0x33613f[_0x4dee('0x48')]=_0x33613f[_0x4dee('0x48')]['length']?_0x33613f[_0x4dee('0x48')]:_0x2d1442[_0x4dee('0x42')];if(!_0x2d3e9c[_0x4dee('0x44')][_0x4dee('0x67')]('nolimit')){_0x33613f[_0x4dee('0x1f')]=qs[_0x4dee('0x1f')](_0x2d3e9c[_0x4dee('0x44')][_0x4dee('0x1f')]);_0x33613f[_0x4dee('0x1d')]=qs['offset'](_0x2d3e9c['query'][_0x4dee('0x1d')]);}_0x33613f['order']=qs[_0x4dee('0x4d')](_0x2d3e9c['query'][_0x4dee('0x4d')]);_0x33613f[_0x4dee('0x4e')]=qs['filters'](_[_0x4dee('0x4f')](_0x2d3e9c[_0x4dee('0x44')],_0x2d1442['filters']));_0x33613f[_0x4dee('0x4e')][_0x4dee('0x68')]=_0x4d182d['id'];if(_0x2d3e9c['query']['filter']){_0x33613f[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x33613f[_0x4dee('0x4e')],{'$or':_['map'](_0x33613f[_0x4dee('0x48')],function(_0x1e1ee3){var _0x1e3b9c={};_0x1e3b9c[_0x1e1ee3]={'$like':'%'+_0x2d3e9c[_0x4dee('0x44')]['filter']+'%'};return _0x1e3b9c;})});}_0x33613f=_[_0x4dee('0x50')]({},_0x33613f,_0x2d3e9c[_0x4dee('0x58')]);return db[_0x4dee('0x62')][_0x4dee('0x20')]({'where':_0x33613f[_0x4dee('0x4e')]})[_0x4dee('0x10')](function(_0x2557ff){_0x4e2875[_0x4dee('0x20')]=_0x2557ff;if(_0x2d3e9c[_0x4dee('0x44')][_0x4dee('0x53')]){_0x33613f[_0x4dee('0x54')]=[{'all':!![]}];}return db[_0x4dee('0x62')]['findAll'](_0x33613f);})[_0x4dee('0x10')](function(_0x1d8d87){_0x4e2875[_0x4dee('0x69')]=_0x1d8d87;return _0x4e2875;});}})['then'](respondWithFilteredResult(_0x3ad22e,_0x33613f))[_0x4dee('0x19')](handleError(_0x3ad22e,null));};exports[_0x4dee('0x6a')]=function(_0x2f11f3,_0x4582f2){return db['MailAccount'][_0x4dee('0x59')]({'where':{'id':_0x2f11f3[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x4582f2,null))[_0x4dee('0x10')](function(_0x197de2){if(_0x197de2){return _0x197de2['removeDispositions'](_0x2f11f3['query'][_0x4dee('0x6b')]);}})['then'](respondWithStatusCode(_0x4582f2,null))['catch'](handleError(_0x4582f2,null));};exports[_0x4dee('0x6c')]=function(_0x429adf,_0x13514c){if(_0x429adf[_0x4dee('0x5b')]['id']){delete _0x429adf[_0x4dee('0x5b')]['id'];}return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x429adf[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x13514c,null))[_0x4dee('0x10')](function(_0x2ae874){if(_0x2ae874){_0x429adf['body']['MailAccountId']=_0x2ae874['id'];return db[_0x4dee('0x6d')][_0x4dee('0x63')](_0x429adf[_0x4dee('0x5b')]);}})[_0x4dee('0x10')](respondWithResult(_0x13514c,null))[_0x4dee('0x19')](handleError(_0x13514c,null));};exports[_0x4dee('0x6e')]=function(_0x5000ba,_0x14b8d9){var _0x2bdf71={'raw':![],'where':{}};var _0x380a44={};var _0x4aa9d1={'count':0x0,'rows':[]};return db[_0x4dee('0x3e')][_0x4dee('0x65')]({'where':{'id':_0x5000ba['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x14b8d9,null))['then'](function(_0x5e7bf2){if(_0x5e7bf2){_0x380a44['model']=_[_0x4dee('0x45')](db[_0x4dee('0x6d')][_0x4dee('0x66')]);_0x380a44[_0x4dee('0x44')]=_['keys'](_0x5000ba[_0x4dee('0x44')]);_0x380a44[_0x4dee('0x46')]=_[_0x4dee('0x47')](_0x380a44[_0x4dee('0x42')],_0x380a44['query']);_0x2bdf71[_0x4dee('0x48')]=_[_0x4dee('0x47')](_0x380a44['model'],qs['fields'](_0x5000ba[_0x4dee('0x44')][_0x4dee('0x49')]));_0x2bdf71[_0x4dee('0x48')]=_0x2bdf71[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x2bdf71[_0x4dee('0x48')]:_0x380a44['model'];if(!_0x5000ba['query'][_0x4dee('0x67')](_0x4dee('0x4b'))){_0x2bdf71['limit']=qs[_0x4dee('0x1f')](_0x5000ba[_0x4dee('0x44')]['limit']);_0x2bdf71['offset']=qs['offset'](_0x5000ba[_0x4dee('0x44')][_0x4dee('0x1d')]);}_0x2bdf71[_0x4dee('0x4c')]=qs['sort'](_0x5000ba[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x2bdf71[_0x4dee('0x4e')]=qs[_0x4dee('0x46')](_[_0x4dee('0x4f')](_0x5000ba[_0x4dee('0x44')],_0x380a44[_0x4dee('0x46')]));_0x2bdf71[_0x4dee('0x4e')][_0x4dee('0x68')]=_0x5e7bf2['id'];if(_0x5000ba[_0x4dee('0x44')][_0x4dee('0x52')]){_0x2bdf71[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x2bdf71[_0x4dee('0x4e')],{'$or':_[_0x4dee('0x43')](_0x2bdf71[_0x4dee('0x48')],function(_0x249be2){var _0x11f6c6={};_0x11f6c6[_0x249be2]={'$like':'%'+_0x5000ba['query'][_0x4dee('0x52')]+'%'};return _0x11f6c6;})});}_0x2bdf71=_[_0x4dee('0x50')]({},_0x2bdf71,_0x5000ba[_0x4dee('0x58')]);return db[_0x4dee('0x6d')][_0x4dee('0x20')]({'where':_0x2bdf71[_0x4dee('0x4e')]})[_0x4dee('0x10')](function(_0x6b0c06){_0x4aa9d1['count']=_0x6b0c06;if(_0x5000ba[_0x4dee('0x44')][_0x4dee('0x53')]){_0x2bdf71['include']=[{'all':!![]}];}return db[_0x4dee('0x6d')]['findAll'](_0x2bdf71);})[_0x4dee('0x10')](function(_0x14fdc3){_0x4aa9d1['rows']=_0x14fdc3;return _0x4aa9d1;});}})[_0x4dee('0x10')](respondWithFilteredResult(_0x14b8d9,_0x2bdf71))[_0x4dee('0x19')](handleError(_0x14b8d9,null));};exports[_0x4dee('0x6f')]=function(_0x14f12d,_0x44a200){return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x14f12d['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x44a200,null))[_0x4dee('0x10')](function(_0xec3afe){if(_0xec3afe){return _0xec3afe['removeAnswers'](_0x14f12d[_0x4dee('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x44a200,null))[_0x4dee('0x19')](handleError(_0x44a200,null));};exports[_0x4dee('0x63')]=function(_0x2ad292,_0x45c309){var _0x55bcc0={'name':_0x2ad292[_0x4dee('0x5b')]['name'],'key':_0x2ad292[_0x4dee('0x5b')]['key'],'provider':_0x2ad292[_0x4dee('0x5b')][_0x4dee('0x5c')]==='custom'?null:_0x2ad292['body'][_0x4dee('0x5c')],'email':_0x2ad292[_0x4dee('0x5b')][_0x4dee('0x70')],'ListId':_0x2ad292[_0x4dee('0x5b')][_0x4dee('0x71')],'active':!_[_0x4dee('0x72')](_0x2ad292['body']['active'])?_0x2ad292[_0x4dee('0x5b')][_0x4dee('0x73')]:!![],'description':_0x2ad292[_0x4dee('0x5b')]['description']||null};var _0x2bc148=getAuthenticationOptions(_0x55bcc0['provider'],_0x2ad292['body']);_0x55bcc0[_0x4dee('0x38')]=_0x2bc148[_0x4dee('0x38')];_0x55bcc0[_0x4dee('0x39')]=_0x2bc148[_0x4dee('0x39')];return db[_0x4dee('0x3e')][_0x4dee('0x63')](_0x55bcc0,{'include':[{'model':db[_0x4dee('0x3c')],'as':_0x4dee('0x39')},{'model':db[_0x4dee('0x3b')],'as':'Imap'}]})[_0x4dee('0x10')](function(_0x262385){var _0x22b665=_0x2ad292[_0x4dee('0x2f')][_0x4dee('0x22')]({'plain':!![]});if(!_0x22b665)throw new Error(_0x4dee('0x74'));if(_0x22b665[_0x4dee('0x75')]==='user'){var _0x2daf9d=_0x262385[_0x4dee('0x22')]({'plain':!![]});return db[_0x4dee('0x76')]['find']({'where':{'name':_0x4dee('0x23'),'userProfileId':_0x22b665[_0x4dee('0x77')]},'raw':!![]})[_0x4dee('0x10')](function(_0x5b032c){if(_0x5b032c&&_0x5b032c[_0x4dee('0x78')]===0x0){return db[_0x4dee('0x79')][_0x4dee('0x63')]({'name':_0x2daf9d['name'],'resourceId':_0x2daf9d['id'],'type':_0x5b032c[_0x4dee('0x26')],'sectionId':_0x5b032c['id']},{})[_0x4dee('0x10')](function(){return _0x262385;});}else{return _0x262385;}})[_0x4dee('0x19')](function(_0x2a8de1){logger[_0x4dee('0x15')](_0x4dee('0x7a'),_0x2a8de1);throw _0x2a8de1;});}return _0x262385;})['then'](respondWithResult(_0x45c309,0xc9))[_0x4dee('0x19')](handleError(_0x45c309,null));};exports[_0x4dee('0x7b')]=function(_0x590627,_0x43c9f1){return db['MailAccount'][_0x4dee('0x65')]({'where':{'id':_0x590627[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x43c9f1,null))[_0x4dee('0x10')](function(_0x1ddceb){if(_0x1ddceb){return _0x1ddceb['getImap']();}return null;})['then'](respondWithResult(_0x43c9f1,null))['catch'](handleError(_0x43c9f1,null));};exports[_0x4dee('0x7c')]=function(_0xa227cf,_0x3aebfe){if(_0xa227cf[_0x4dee('0x5b')]['id']){delete _0xa227cf['body']['id'];}return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0xa227cf[_0x4dee('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3aebfe,null))['then'](function(_0x40623a){if(_0x40623a){_0xa227cf[_0x4dee('0x5b')][_0x4dee('0x68')]=_0x40623a['id'];return db[_0x4dee('0x3b')][_0x4dee('0x63')](_0xa227cf[_0x4dee('0x5b')]);}})[_0x4dee('0x10')](respondWithResult(_0x3aebfe,null))[_0x4dee('0x19')](handleError(_0x3aebfe,null));};exports[_0x4dee('0x7d')]=function(_0x26fa67,_0x1585ae){return db[_0x4dee('0x3e')][_0x4dee('0x65')]({'where':{'id':_0x26fa67['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x1585ae,null))[_0x4dee('0x10')](function(_0x264347){if(_0x264347){return _0x264347[_0x4dee('0x7e')](null);}return null;})[_0x4dee('0x10')](respondWithStatusCode(_0x1585ae,null))[_0x4dee('0x19')](handleError(_0x1585ae,null));};exports[_0x4dee('0x7f')]=function(_0x476f34,_0x48c318){return db[_0x4dee('0x3e')][_0x4dee('0x65')]({'where':{'id':_0x476f34['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x48c318,null))[_0x4dee('0x10')](function(_0x197bd7){if(_0x197bd7){return _0x197bd7[_0x4dee('0x7f')]();}return null;})[_0x4dee('0x10')](respondWithResult(_0x48c318,null))[_0x4dee('0x19')](handleError(_0x48c318,null));};exports[_0x4dee('0x80')]=function(_0x34b8d2,_0xffab25){if(_0x34b8d2[_0x4dee('0x5b')]['id']){delete _0x34b8d2[_0x4dee('0x5b')]['id'];}return db[_0x4dee('0x3e')]['find']({'where':{'id':_0x34b8d2[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0xffab25,null))[_0x4dee('0x10')](function(_0x31882f){if(_0x31882f){_0x34b8d2[_0x4dee('0x5b')][_0x4dee('0x68')]=_0x31882f['id'];return db[_0x4dee('0x3c')][_0x4dee('0x63')](_0x34b8d2[_0x4dee('0x5b')]);}})['then'](respondWithResult(_0xffab25,null))[_0x4dee('0x19')](handleError(_0xffab25,null));};exports[_0x4dee('0x81')]=function(_0x3568eb,_0x3ca50c){return db['MailAccount'][_0x4dee('0x65')]({'where':{'id':_0x3568eb[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x3ca50c,null))[_0x4dee('0x10')](function(_0x29e2a5){if(_0x29e2a5){return _0x29e2a5['setSmtp'](null);}return null;})[_0x4dee('0x10')](respondWithStatusCode(_0x3ca50c,null))[_0x4dee('0x19')](handleError(_0x3ca50c,null));};exports[_0x4dee('0x82')]=function(_0x58968e,_0x9418a){return db[_0x4dee('0x83')][_0x4dee('0x59')]({'where':{'id':_0x58968e[_0x4dee('0x5d')]['id']}})['then'](handleEntityNotFound(_0x9418a,null))[_0x4dee('0x10')](function(_0x5c6a53){if(_0x5c6a53){return _0x5c6a53['addInteraction'](_0x58968e[_0x4dee('0x5b')][_0x4dee('0x6b')],_[_0x4dee('0x84')](_0x58968e[_0x4dee('0x5b')],[_0x4dee('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x9418a,null))['catch'](handleError(_0x9418a,null));};exports[_0x4dee('0x85')]=function(_0x426fc6,_0x2f2065){var _0x33904d={'raw':![],'where':{}};var _0x128cf2={};var _0x52e466={'count':0x0,'rows':[]};return db[_0x4dee('0x3e')]['findOne']({'where':{'id':_0x426fc6[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x2f2065,null))[_0x4dee('0x10')](function(_0x570d17){if(_0x570d17){_0x128cf2['model']=_[_0x4dee('0x45')](db[_0x4dee('0x83')][_0x4dee('0x66')]);_0x128cf2[_0x4dee('0x44')]=_['keys'](_0x426fc6['query']);_0x128cf2[_0x4dee('0x46')]=_[_0x4dee('0x47')](_0x128cf2['model'],_0x128cf2[_0x4dee('0x44')]);_0x33904d[_0x4dee('0x48')]=_['intersection'](_0x128cf2[_0x4dee('0x42')],qs[_0x4dee('0x49')](_0x426fc6[_0x4dee('0x44')]['fields']));_0x33904d['attributes']=_0x33904d[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x33904d[_0x4dee('0x48')]:_0x128cf2[_0x4dee('0x42')];if(!_0x426fc6[_0x4dee('0x44')][_0x4dee('0x67')](_0x4dee('0x4b'))){_0x33904d['limit']=qs[_0x4dee('0x1f')](_0x426fc6[_0x4dee('0x44')][_0x4dee('0x1f')]);_0x33904d[_0x4dee('0x1d')]=qs[_0x4dee('0x1d')](_0x426fc6[_0x4dee('0x44')][_0x4dee('0x1d')]);}_0x33904d[_0x4dee('0x4c')]=qs['sort'](_0x426fc6[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x33904d[_0x4dee('0x4e')]=qs[_0x4dee('0x46')](_[_0x4dee('0x4f')](_0x426fc6[_0x4dee('0x44')],_0x128cf2[_0x4dee('0x46')]));_0x33904d[_0x4dee('0x4e')][_0x4dee('0x68')]=_0x570d17['id'];if(_0x426fc6[_0x4dee('0x44')]['filter']){_0x33904d[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x33904d[_0x4dee('0x4e')],{'$or':_[_0x4dee('0x43')](_0x33904d[_0x4dee('0x48')],function(_0x502c96){var _0xf02ee0={};_0xf02ee0[_0x502c96]={'$like':'%'+_0x426fc6[_0x4dee('0x44')]['filter']+'%'};return _0xf02ee0;})});}_0x33904d=_[_0x4dee('0x50')]({},_0x33904d,_0x426fc6[_0x4dee('0x58')]);return db[_0x4dee('0x83')][_0x4dee('0x20')]({'where':_0x33904d[_0x4dee('0x4e')]})[_0x4dee('0x10')](function(_0x44b772){_0x52e466['count']=_0x44b772;if(_0x426fc6[_0x4dee('0x44')][_0x4dee('0x53')]){_0x33904d[_0x4dee('0x54')]=[{'model':db[_0x4dee('0x86')],'as':_0x4dee('0x87'),'required':![]},{'model':db[_0x4dee('0x88')],'as':'Owner','attributes':[_0x4dee('0x26'),_0x4dee('0x89'),_0x4dee('0x8a')],'required':![]},{'model':db[_0x4dee('0x8b')],'as':_0x4dee('0x8c'),'attributes':['id',_0x4dee('0x26'),_0x4dee('0x8d')],'where':_0x426fc6[_0x4dee('0x44')][_0x4dee('0x8e')]?{'id':_0x426fc6[_0x4dee('0x44')][_0x4dee('0x8e')]}:undefined,'required':_0x426fc6[_0x4dee('0x44')][_0x4dee('0x8e')]?!![]:![]}];}return db[_0x4dee('0x83')][_0x4dee('0x55')](_0x33904d);})[_0x4dee('0x10')](function(_0x1398ce){_0x52e466[_0x4dee('0x69')]=_0x1398ce;return _0x52e466;});}})['then'](respondWithFilteredResult(_0x2f2065,_0x33904d))[_0x4dee('0x19')](handleError(_0x2f2065,null));};exports[_0x4dee('0x8f')]=function addApplications(_0xeb7162,_0x4c9eb4){var _0xab1fd3=_0xeb7162[_0x4dee('0x5d')]['id'];var _0x4bab7e=_0xeb7162['body'];var _0x8cc1bd=0xc8;var _0x5e4c9e=null;return db[_0x4dee('0x90')][_0x4dee('0x91')]({'isolationLevel':db[_0x4dee('0x90')]['Transaction'][_0x4dee('0x92')]['READ_COMMITTED']},function(_0x35da46){return db['MailAccount'][_0x4dee('0x65')]({'where':{'id':_0xab1fd3},'transaction':_0x35da46})[_0x4dee('0x10')](function(_0x513e10){if(_0x513e10){return db['MailApplication'][_0x4dee('0x21')]({'where':{'MailAccountId':_0xab1fd3},'transaction':_0x35da46})[_0x4dee('0x10')](function(){var _0x24ff3d=_[_0x4dee('0x43')](_0x4bab7e,function(_0x177321){_0x177321[_0x4dee('0x68')]=_0xab1fd3;return _0x177321;});return db[_0x4dee('0x93')]['bulkCreate'](_0x24ff3d,{'transaction':_0x35da46});});}else{_0x8cc1bd=0x194;_0x5e4c9e=[];}});})[_0x4dee('0x10')](function(){if(_0x8cc1bd!==0x194){return db[_0x4dee('0x93')][_0x4dee('0x94')]({'where':{'MailAccountId':_0xab1fd3},'order':_0x4dee('0x95')})[_0x4dee('0x10')](function(_0x239b5d){_0x5e4c9e=_0x239b5d;});}})[_0x4dee('0x19')](function(_0x253904){_0x8cc1bd=0x1f4;logger[_0x4dee('0x15')](_0x253904[_0x4dee('0x25')]);if(_0x253904[_0x4dee('0x26')]){delete _0x253904[_0x4dee('0x26')];}_0x5e4c9e=_0x253904;})[_0x4dee('0x96')](function(){if(_0x5e4c9e===null){_0x4c9eb4[_0x4dee('0x24')](_0x8cc1bd);}else{if(_0x8cc1bd===0x1f4){_0x4c9eb4[_0x4dee('0x1a')](_0x8cc1bd)['send'](_0x5e4c9e);}else{_0x4c9eb4[_0x4dee('0x1a')](_0x8cc1bd)[_0x4dee('0x1c')](_0x5e4c9e);}}});};exports[_0x4dee('0x97')]=function(_0xd71d7d,_0x17cbe8){var _0x553a78={};var _0xdc8070={};var _0x170b10;var _0x1116ec;return db[_0x4dee('0x3e')][_0x4dee('0x65')]({'where':{'id':_0xd71d7d['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x17cbe8,null))[_0x4dee('0x10')](function(_0x2bc7e3){if(_0x2bc7e3){_0x170b10=_0x2bc7e3;_0xdc8070[_0x4dee('0x42')]=_['keys'](db[_0x4dee('0x93')][_0x4dee('0x66')]);_0xdc8070[_0x4dee('0x44')]=_[_0x4dee('0x45')](_0xd71d7d[_0x4dee('0x44')]);_0xdc8070[_0x4dee('0x46')]=_['intersection'](_0xdc8070[_0x4dee('0x42')],_0xdc8070[_0x4dee('0x44')]);_0x553a78[_0x4dee('0x48')]=_['intersection'](_0xdc8070[_0x4dee('0x42')],qs[_0x4dee('0x49')](_0xd71d7d[_0x4dee('0x44')][_0x4dee('0x49')]));_0x553a78[_0x4dee('0x48')]=_0x553a78[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x553a78[_0x4dee('0x48')]:_0xdc8070[_0x4dee('0x42')];_0x553a78[_0x4dee('0x4c')]=qs[_0x4dee('0x4d')](_0xd71d7d[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x553a78['where']=qs[_0x4dee('0x46')](_[_0x4dee('0x4f')](_0xd71d7d[_0x4dee('0x44')],_0xdc8070[_0x4dee('0x46')]));if(_0xd71d7d['query'][_0x4dee('0x52')]){_0x553a78[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x553a78[_0x4dee('0x4e')],{'$or':_[_0x4dee('0x43')](_0x553a78[_0x4dee('0x48')],function(_0x2bafcb){var _0x53393b={};_0x53393b[_0x2bafcb]={'$like':'%'+_0xd71d7d[_0x4dee('0x44')]['filter']+'%'};return _0x53393b;})});}_0x553a78=_[_0x4dee('0x50')]({},_0x553a78,_0xd71d7d[_0x4dee('0x58')]);return _0x170b10[_0x4dee('0x97')](_0x553a78);}})[_0x4dee('0x10')](function(_0x3353f6){if(_0x3353f6){_0x1116ec=_0x3353f6[_0x4dee('0x4a')];if(!_0xd71d7d[_0x4dee('0x44')][_0x4dee('0x67')](_0x4dee('0x4b'))){_0x553a78[_0x4dee('0x1f')]=qs['limit'](_0xd71d7d[_0x4dee('0x44')][_0x4dee('0x1f')]);_0x553a78[_0x4dee('0x1d')]=qs[_0x4dee('0x1d')](_0xd71d7d[_0x4dee('0x44')]['offset']);}return _0x170b10[_0x4dee('0x97')](_0x553a78);}})[_0x4dee('0x10')](function(_0x5e1c73){if(_0x5e1c73){return _0x5e1c73?{'count':_0x1116ec,'rows':_0x5e1c73}:null;}})[_0x4dee('0x10')](respondWithResult(_0x17cbe8,null))[_0x4dee('0x19')](handleError(_0x17cbe8,null));};exports['getMessages']=function(_0x54fd1f,_0x9b1a82){var _0x12eb44={'raw':!![],'where':{}};var _0x56b268={};var _0x202d10={'count':0x0,'rows':[]};return db[_0x4dee('0x3e')]['findOne']({'where':{'id':_0x54fd1f[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x9b1a82,null))['then'](function(_0x20df04){if(_0x20df04){_0x56b268[_0x4dee('0x42')]=_[_0x4dee('0x45')](db[_0x4dee('0x98')]['rawAttributes']);_0x56b268[_0x4dee('0x44')]=_[_0x4dee('0x45')](_0x54fd1f[_0x4dee('0x44')]);_0x56b268['filters']=_[_0x4dee('0x47')](_0x56b268['model'],_0x56b268[_0x4dee('0x44')]);_0x12eb44['attributes']=_[_0x4dee('0x47')](_0x56b268[_0x4dee('0x42')],qs[_0x4dee('0x49')](_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x49')]));_0x12eb44[_0x4dee('0x48')]=_0x12eb44[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x12eb44[_0x4dee('0x48')]:_0x56b268[_0x4dee('0x42')];if(!_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x67')](_0x4dee('0x4b'))){_0x12eb44['limit']=qs[_0x4dee('0x1f')](_0x54fd1f[_0x4dee('0x44')]['limit']);_0x12eb44[_0x4dee('0x1d')]=qs['offset'](_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x1d')]);}_0x12eb44[_0x4dee('0x4c')]=qs['sort'](_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x12eb44[_0x4dee('0x4e')]=qs['filters'](_[_0x4dee('0x4f')](_0x54fd1f[_0x4dee('0x44')],_0x56b268[_0x4dee('0x46')]));_0x12eb44[_0x4dee('0x4e')][_0x4dee('0x68')]=_0x20df04['id'];if(_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x52')]){_0x12eb44[_0x4dee('0x4e')]=_['merge'](_0x12eb44[_0x4dee('0x4e')],{'$or':_[_0x4dee('0x43')](_0x12eb44['attributes'],function(_0x4877ec){var _0x1f1b0b={};_0x1f1b0b[_0x4877ec]={'$like':'%'+_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x52')]+'%'};return _0x1f1b0b;})});}if(_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x99')]){var _0x424e26=_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x99')][_0x4dee('0x9a')](',');var _0x38dff2={};_0x38dff2[_0x424e26[0x0]]={'$gte':moment(_0x424e26[0x1])[_0x4dee('0x9b')](_0x4dee('0x9c'))};_0x12eb44[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x12eb44[_0x4dee('0x4e')],_0x38dff2);}_0x12eb44=_[_0x4dee('0x50')]({},_0x12eb44,_0x54fd1f['options']);return db['MailMessage']['count']({'where':_0x12eb44['where']})['then'](function(_0x17fba3){_0x202d10['count']=_0x17fba3;if(_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x53')]){_0x12eb44[_0x4dee('0x54')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x12eb44);})[_0x4dee('0x10')](function(_0x21f596){if(_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x9d')]===_0x4dee('0x9e')){for(var _0x32dcf4=0x0;_0x32dcf4<_0x21f596[_0x4dee('0x4a')];_0x32dcf4++){_0x21f596[_0x32dcf4][_0x4dee('0x5b')]=juice(_0x21f596[_0x32dcf4][_0x4dee('0x5b')]);}}_0x202d10[_0x4dee('0x69')]=_0x21f596;return _0x202d10;});}})[_0x4dee('0x10')](respondWithFilteredResult(_0x9b1a82,_0x12eb44))[_0x4dee('0x19')](handleError(_0x9b1a82,null));};exports[_0x4dee('0x27')]=function(_0xddcd85,_0x586d9a){var _0x1097ba,_0x1fbdef={},_0x180d2a;if(_0xddcd85['body']['to']){_0x180d2a=_0xddcd85['body']['to']['split'](',')[0x0];}return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0xddcd85[_0x4dee('0x5d')]['id']},'include':[{'model':db[_0x4dee('0x9f')],'as':_0x4dee('0xa0'),'include':[{'model':db[_0x4dee('0x86')],'as':_0x4dee('0xa1'),'where':{'email':_0x180d2a},'limit':0x1,'order':[[_0x4dee('0xa2'),'DESC']]}]},{'model':db[_0x4dee('0x3c')],'as':_0x4dee('0x39'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x4dee('0xa3'),'raw':!![]}]}]})[_0x4dee('0x10')](handleEntityNotFound(_0x586d9a,null))[_0x4dee('0x10')](function(_0x11ea2e){if(!_0x11ea2e)return;_0x1097ba=_0x11ea2e;if(!_0x11ea2e[_0x4dee('0x39')])throw new Error(_0x4dee('0xa4'));if(_[_0x4dee('0x72')](_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa5')])){_0xddcd85['body']['from']=util[_0x4dee('0x9b')](_0x4dee('0xa6'),_0x11ea2e[_0x4dee('0x26')],_0x11ea2e['email']||_0x11ea2e[_0x4dee('0x39')][_0x4dee('0x2f')]);}if(_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa7')]&&_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa7')][_0x4dee('0x4a')]){for(var _0x633dd8=0x0;_0x633dd8<_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa7')][_0x4dee('0x4a')];_0x633dd8+=0x1){_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa7')][_0x633dd8]={'filename':_0xddcd85['body'][_0x4dee('0xa7')][_0x633dd8][_0x4dee('0x26')],'path':path[_0x4dee('0xa8')](config[_0x4dee('0xa9')],_0x4dee('0xaa'),_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa7')][_0x633dd8][_0x4dee('0xab')])};}}var _0x595aff=_0x11ea2e[_0x4dee('0xac')]();return respondWithRpcPromise(_0x4dee('0xad'),_0x4dee('0xae'),{'account':_0x595aff,'message':_0xddcd85[_0x4dee('0x5b')]});})[_0x4dee('0x10')](function(_0x4478bb){if(!_0x4478bb)return;_0x1fbdef=_0x4478bb;if(!_0x1097ba['List'])throw new Error(_0x4dee('0xaf'));if(_0x1097ba[_0x4dee('0xa0')][_0x4dee('0xa1')][_0x4dee('0x4a')])return _0x1097ba[_0x4dee('0xa0')][_0x4dee('0xa1')][0x0];return db[_0x4dee('0x86')][_0x4dee('0x63')](_[_0x4dee('0x9')](_0xddcd85[_0x4dee('0x5b')],{'firstName':_0xddcd85['body']['to'],'email':_0xddcd85[_0x4dee('0x5b')]['to'],'phone':_0xddcd85[_0x4dee('0x5b')]['to'],'ListId':_0x1097ba[_0x4dee('0x71')]}));})[_0x4dee('0x10')](function(_0xde5863){if(!_0xde5863)return;var _0x88624d={'UserId':_0xddcd85[_0x4dee('0x2f')]['id'],'ContactId':_0xde5863['id'],'MailAccountId':_0x1097ba['id'],'inReplyTo':_0x1fbdef[_0x4dee('0xb0')],'to':_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa5')],'cc':_0xddcd85[_0x4dee('0x5b')]['cc'],'subject':_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xb1')],'attach':_0xddcd85['body']['attach'],'firstMsgDirection':_0x4dee('0xb2'),'lastMsgAt':moment()['format'](_0x4dee('0x9c')),'lastMsgDirection':'out','Messages':[_[_0x4dee('0x50')](_0xddcd85[_0x4dee('0x5b')],{'messageId':_0x1fbdef[_0x4dee('0xb0')],'sentAt':moment()[_0x4dee('0x9b')](_0x4dee('0x9c')),'read':!![],'MailAccountId':_0x1097ba['id'],'UserId':_0xddcd85[_0x4dee('0x2f')]['id'],'ContactId':_0xde5863['id']})]};if(_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xb3')]){_0x88624d=_['merge'](_0x88624d,_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xb3')]);}return db[_0x4dee('0x83')][_0x4dee('0x63')](_0x88624d,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0x4dee('0x10')](respondWithResult(_0x586d9a,null))[_0x4dee('0x19')](handleError(_0x586d9a,null));};exports[_0x4dee('0xb4')]=function(_0x56b7e6,_0x462439){return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x56b7e6[_0x4dee('0x5d')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x4dee('0x39'),'raw':!![],'include':[{'model':db[_0x4dee('0xa3')],'as':_0x4dee('0xa3'),'raw':!![]}]}]})[_0x4dee('0x10')](handleEntityNotFound(_0x462439,null))[_0x4dee('0x10')](function(_0x9ebc58){if(!_0x9ebc58[_0x4dee('0x39')])return;var _0x5ce427=_0x9ebc58[_0x4dee('0xac')]();return respondWithRpcPromise(_0x4dee('0xb5'),_0x4dee('0xb4'),{'account':_0x5ce427});})['then'](respondWithResult(_0x462439,null))[_0x4dee('0x19')](handleError(_0x462439,null));};exports[_0x4dee('0x21')]=function(_0x470733,_0x379791){return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x470733[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x379791,null))[_0x4dee('0x10')](function(_0x229abf){if(_0x229abf&&_0x229abf[_0x4dee('0x5f')]){throw new db[(_0x4dee('0xb6'))]['ValidationError'](_0x4dee('0xb7'));}return _0x229abf;})[_0x4dee('0x10')](removeEntity(_0x379791,null))['catch'](handleError(_0x379791,null));};exports[_0x4dee('0xb8')]=function(_0x5c1d8c,_0x203d2f){return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x5c1d8c[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x203d2f,null))[_0x4dee('0x10')](function(_0x56b9e0){if(_0x56b9e0){return _0x56b9e0[_0x4dee('0xb8')](_0x5c1d8c['body'][_0x4dee('0x6b')],_[_0x4dee('0x84')](_0x5c1d8c[_0x4dee('0x5b')],[_0x4dee('0x6b'),'id'])||{})[_0x4dee('0xb9')](function(_0x279437){for(var _0x16fee2=0x0;_0x16fee2<_0x5c1d8c[_0x4dee('0x5b')][_0x4dee('0x6b')][_0x4dee('0x4a')];_0x16fee2+=0x1){socket[_0x4dee('0xba')](_0x4dee('0xbb'),{'UserId':Number(_0x5c1d8c[_0x4dee('0x5b')]['ids'][_0x16fee2]),'MailAccountId':Number(_0x5c1d8c[_0x4dee('0x5d')]['id'])});}return _0x279437;});}})[_0x4dee('0x10')](respondWithResult(_0x203d2f,null))[_0x4dee('0x19')](handleError(_0x203d2f,null));};exports['removeAgents']=function(_0x176dc3,_0xa80262){return db['MailAccount']['find']({'where':{'id':_0x176dc3[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0xa80262,null))[_0x4dee('0x10')](function(_0x268550){if(_0x268550){return _0x268550['removeAgents'](_0x176dc3[_0x4dee('0x44')][_0x4dee('0x6b')])[_0x4dee('0x10')](function(){if(_[_0x4dee('0xbc')](_0x176dc3[_0x4dee('0x44')][_0x4dee('0x6b')])){for(var _0x46c742=0x0;_0x46c742<_0x176dc3[_0x4dee('0x44')][_0x4dee('0x6b')][_0x4dee('0x4a')];_0x46c742+=0x1){socket[_0x4dee('0xba')](_0x4dee('0xbd'),{'UserId':Number(_0x176dc3['query'][_0x4dee('0x6b')][_0x46c742]),'MailAccountId':Number(_0x176dc3[_0x4dee('0x5d')]['id'])});}}else{socket[_0x4dee('0xba')](_0x4dee('0xbd'),{'UserId':Number(_0x176dc3['query'][_0x4dee('0x6b')]),'MailAccountId':Number(_0x176dc3[_0x4dee('0x5d')]['id'])});}});}})[_0x4dee('0x10')](respondWithStatusCode(_0xa80262,null))[_0x4dee('0x19')](handleError(_0xa80262,null));};exports[_0x4dee('0xbe')]=function(_0xbfd50c,_0x333ad6){var _0x13a86f={};var _0x266a65={};var _0x19e202;var _0x568ceb;return db[_0x4dee('0x3e')][_0x4dee('0x65')]({'where':{'id':_0xbfd50c[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x333ad6,null))[_0x4dee('0x10')](function(_0x5aed79){if(_0x5aed79){_0x19e202=_0x5aed79;_0x266a65['model']=_['keys'](db[_0x4dee('0x88')][_0x4dee('0x66')]);_0x266a65[_0x4dee('0x44')]=_[_0x4dee('0x45')](_0xbfd50c['query']);_0x266a65[_0x4dee('0x46')]=_[_0x4dee('0x47')](_0x266a65[_0x4dee('0x42')],_0x266a65[_0x4dee('0x44')]);_0x13a86f['attributes']=_[_0x4dee('0x47')](_0x266a65[_0x4dee('0x42')],qs[_0x4dee('0x49')](_0xbfd50c['query']['fields']));_0x13a86f[_0x4dee('0x48')]=_0x13a86f[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x13a86f[_0x4dee('0x48')]:_0x266a65[_0x4dee('0x42')];_0x13a86f['order']=qs['sort'](_0xbfd50c[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x13a86f[_0x4dee('0x4e')]=qs[_0x4dee('0x46')](_[_0x4dee('0x4f')](_0xbfd50c[_0x4dee('0x44')],_0x266a65[_0x4dee('0x46')]));if(_0xbfd50c['query']['filter']){_0x13a86f[_0x4dee('0x4e')]=_['merge'](_0x13a86f['where'],{'$or':_[_0x4dee('0x43')](_0x13a86f[_0x4dee('0x48')],function(_0x1ab7fd){var _0x3f69f6={};_0x3f69f6[_0x1ab7fd]={'$like':'%'+_0xbfd50c['query'][_0x4dee('0x52')]+'%'};return _0x3f69f6;})});}_0x13a86f=_[_0x4dee('0x50')]({},_0x13a86f,_0xbfd50c[_0x4dee('0x58')]);return _0x19e202[_0x4dee('0xbe')](_0x13a86f);}})[_0x4dee('0x10')](function(_0x2b4317){if(_0x2b4317){_0x568ceb=_0x2b4317[_0x4dee('0x4a')];if(!_0xbfd50c[_0x4dee('0x44')]['hasOwnProperty']('nolimit')){_0x13a86f[_0x4dee('0x1f')]=qs[_0x4dee('0x1f')](_0xbfd50c[_0x4dee('0x44')]['limit']);_0x13a86f[_0x4dee('0x1d')]=qs[_0x4dee('0x1d')](_0xbfd50c[_0x4dee('0x44')][_0x4dee('0x1d')]);}return _0x19e202[_0x4dee('0xbe')](_0x13a86f);}})[_0x4dee('0x10')](function(_0x177fc3){if(_0x177fc3){return _0x177fc3?{'count':_0x568ceb,'rows':_0x177fc3}:null;}})[_0x4dee('0x10')](respondWithResult(_0x333ad6,null))[_0x4dee('0x19')](handleError(_0x333ad6,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index c6a64aa..fec8fde 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 _0x9a18=['exports','events','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x189d3c,_0x5efebf){var _0x485959=function(_0x1161da){while(--_0x1161da){_0x189d3c['push'](_0x189d3c['shift']());}};_0x485959(++_0x5efebf);}(_0x9a18,0x187));var _0x89a1=function(_0x30a140,_0x271bae){_0x30a140=_0x30a140-0x0;var _0x70f501=_0x9a18[_0x30a140];return _0x70f501;};'use strict';var EventEmitter=require(_0x89a1('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x89a1('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x89a1('0x2')](0x0);var events={'afterCreate':_0x89a1('0x3'),'afterUpdate':_0x89a1('0x4'),'afterDestroy':_0x89a1('0x5')};function emitEvent(_0x48a67a){return function(_0x33e91b,_0x2b7678,_0x287f38){MailAccountEvents[_0x89a1('0x6')](_0x48a67a+':'+_0x33e91b['id'],_0x33e91b);MailAccountEvents[_0x89a1('0x6')](_0x48a67a,_0x33e91b);_0x287f38(null);};}for(var e in events){if(events[_0x89a1('0x7')](e)){var event=events[e];MailAccount[_0x89a1('0x8')](e,emitEvent(event));}}module[_0x89a1('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x1a54=['save','update','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x47d804,_0x5cc88f){var _0x284c47=function(_0x271c22){while(--_0x271c22){_0x47d804['push'](_0x47d804['shift']());}};_0x284c47(++_0x5cc88f);}(_0x1a54,0x12e));var _0x41a5=function(_0x39e338,_0x1cd155){_0x39e338=_0x39e338-0x0;var _0x5da81f=_0x1a54[_0x39e338];return _0x5da81f;};'use strict';var EventEmitter=require(_0x41a5('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x41a5('0x1')](0x0);var events={'afterCreate':_0x41a5('0x2'),'afterUpdate':_0x41a5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x217f68){return function(_0x3ba60a,_0x39fe63,_0x3b3d6e){MailAccountEvents[_0x41a5('0x4')](_0x217f68+':'+_0x3ba60a['id'],_0x3ba60a);MailAccountEvents['emit'](_0x217f68,_0x3ba60a);_0x3b3d6e(null);};}for(var e in events){if(events[_0x41a5('0x5')](e)){var event=events[e];MailAccount[_0x41a5('0x6')](e,emitEvent(event));}}module[_0x41a5('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 5ab116f..c66d2cd 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 _0x7b62=['exports','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','authentication','CloudProvider','auth','OAuth2','data5','user','pass','./mailAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b62,0x197));var _0x27b6=function(_0x36a9bf,_0x2edc43){_0x36a9bf=_0x36a9bf-0x0;var _0x24b93c=_0x7b62[_0x36a9bf];return _0x24b93c;};'use strict';var attributes=require(_0x27b6('0x0'));module[_0x27b6('0x1')]=function(_0x3d21fc){return _0x3d21fc['define'](_0x27b6('0x2'),attributes,{'tableName':_0x27b6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x44c0ac=this;var _0x3112a8={'id':_0x44c0ac['id'],'tls':{'rejectUnauthorized':![]}};if(_0x44c0ac[_0x27b6('0x4')]!==_0x27b6('0x5')){_0x3112a8[_0x27b6('0x6')]=_0x44c0ac[_0x27b6('0x4')];}else{_0x3112a8[_0x27b6('0x7')]=_0x44c0ac[_0x27b6('0x8')]['host'];_0x3112a8[_0x27b6('0x9')]=_0x44c0ac['Smtp'][_0x27b6('0x9')];_0x3112a8['secure']=_0x44c0ac['Smtp']['secure'];}if(_0x44c0ac[_0x27b6('0x8')][_0x27b6('0xa')]){if(_0x44c0ac[_0x27b6('0x8')]['modernAuthentication']){if(!_0x44c0ac[_0x27b6('0x8')][_0x27b6('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x3112a8[_0x27b6('0xc')]={'type':_0x27b6('0xd'),'user':_0x44c0ac[_0x27b6('0x8')]['user'],'accessToken':_0x44c0ac[_0x27b6('0x8')][_0x27b6('0xb')][_0x27b6('0xe')]};}else{_0x3112a8[_0x27b6('0xc')]={'user':_0x44c0ac[_0x27b6('0x8')][_0x27b6('0xf')],'pass':_0x44c0ac[_0x27b6('0x8')][_0x27b6('0x10')]};}}return _0x3112a8;}}});}; \ No newline at end of file +var _0xf556=['modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','CloudProvider','data5','pass','exports','mail_accounts','provider','custom','service','host','Smtp','port','secure'];(function(_0x4a26e7,_0x232272){var _0x13c81b=function(_0x15c69f){while(--_0x15c69f){_0x4a26e7['push'](_0x4a26e7['shift']());}};_0x13c81b(++_0x232272);}(_0xf556,0xc3));var _0x6f55=function(_0x4c82af,_0x362c51){_0x4c82af=_0x4c82af-0x0;var _0x21d4ec=_0xf556[_0x4c82af];return _0x21d4ec;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x6f55('0x0')]=function(_0x1a16fb){return _0x1a16fb['define']('MailAccount',attributes,{'tableName':_0x6f55('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x97cad1=this;var _0x74740a={'id':_0x97cad1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x97cad1[_0x6f55('0x2')]!==_0x6f55('0x3')){_0x74740a[_0x6f55('0x4')]=_0x97cad1[_0x6f55('0x2')];}else{_0x74740a[_0x6f55('0x5')]=_0x97cad1[_0x6f55('0x6')][_0x6f55('0x5')];_0x74740a['port']=_0x97cad1['Smtp'][_0x6f55('0x7')];_0x74740a[_0x6f55('0x8')]=_0x97cad1['Smtp'][_0x6f55('0x8')];}if(_0x97cad1[_0x6f55('0x6')]['authentication']){if(_0x97cad1['Smtp'][_0x6f55('0x9')]){if(!_0x97cad1[_0x6f55('0x6')]['CloudProvider'])throw new Error(_0x6f55('0xa'));_0x74740a[_0x6f55('0xb')]={'type':_0x6f55('0xc'),'user':_0x97cad1['Smtp'][_0x6f55('0xd')],'accessToken':_0x97cad1['Smtp'][_0x6f55('0xe')][_0x6f55('0xf')]};}else{_0x74740a[_0x6f55('0xb')]={'user':_0x97cad1[_0x6f55('0x6')][_0x6f55('0xd')],'pass':_0x97cad1[_0x6f55('0x6')][_0x6f55('0x10')]};}}return _0x74740a;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index e9782f4..5d2e64d 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 _0xef17=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','error','code','message','MailAccount','options','raw','where','limit','include','map','model','attributes','info','GetMailAccount','stringify','catch','ShowMailAccount','find','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','Contacts','Applications','MailServerOut','CloudProvider','omit','applications','list','priority','push','close','autoclose','length','defaults','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','get','created','bcc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','unshift','agent','queueId','MailQueue','waitForTheAssignedQueue','*,*,*,*','Start','lodash','moment'];(function(_0x50d33e,_0x4bc0be){var _0x442871=function(_0x10b535){while(--_0x10b535){_0x50d33e['push'](_0x50d33e['shift']());}};_0x442871(++_0x4bc0be);}(_0xef17,0x136));var _0x7ef1=function(_0xb9eb0c,_0x3896f8){_0xb9eb0c=_0xb9eb0c-0x0;var _0x54be81=_0xef17[_0xb9eb0c];return _0x54be81;};'use strict';var _=require(_0x7ef1('0x0'));var moment=require(_0x7ef1('0x1'));var BPromise=require(_0x7ef1('0x2'));var rs=require(_0x7ef1('0x3'));var Redis=require(_0x7ef1('0x4'));var db=require(_0x7ef1('0x5'))['db'];var logger=require(_0x7ef1('0x6'))(_0x7ef1('0x7'));var config=require(_0x7ef1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7ef1('0x9')]['http']({'port':0x232c});config[_0x7ef1('0xa')]=_['defaults'](config[_0x7ef1('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ef1('0xa')]));require(_0x7ef1('0xb'))['register'](socket);function respondWithRpcPromise(_0xeb10e9,_0x1d5b33,_0x4534fc){return new BPromise(function(_0x3d47e2,_0x2cb9b0){return client[_0x7ef1('0xc')](_0xeb10e9,_0x4534fc)[_0x7ef1('0xd')](function(_0x4bedd1){logger['info'](_0x7ef1('0xe'),_0x1d5b33,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x1d5b33,_0x7ef1('0xf'),JSON['stringify'](_0x4bedd1));if(_0x4bedd1[_0x7ef1('0x10')]){if(_0x4bedd1[_0x7ef1('0x10')][_0x7ef1('0x11')]===0x1f4){logger[_0x7ef1('0x10')](_0x7ef1('0xe'),_0x1d5b33,_0x4bedd1[_0x7ef1('0x10')][_0x7ef1('0x12')]);return _0x2cb9b0(_0x4bedd1[_0x7ef1('0x10')]['message']);}logger['error'](_0x7ef1('0xe'),_0x1d5b33,_0x4bedd1['error'][_0x7ef1('0x12')]);return _0x3d47e2(_0x4bedd1[_0x7ef1('0x10')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x1d5b33,_0x7ef1('0xf'));_0x3d47e2(_0x4bedd1['result'][_0x7ef1('0x12')]);}})['catch'](function(_0x5a7b2b){logger['error'](_0x7ef1('0xe'),_0x1d5b33,_0x5a7b2b);_0x2cb9b0(_0x5a7b2b);});});}exports['GetMailAccount']=function(_0x38c5a7){var _0x2a8fab=this;return new Promise(function(_0x5291b0,_0x568d0a){return db[_0x7ef1('0x13')]['findAll']({'raw':_0x38c5a7[_0x7ef1('0x14')]?_0x38c5a7[_0x7ef1('0x14')][_0x7ef1('0x15')]===undefined?!![]:![]:!![],'where':_0x38c5a7[_0x7ef1('0x14')]?_0x38c5a7[_0x7ef1('0x14')][_0x7ef1('0x16')]||null:null,'attributes':_0x38c5a7[_0x7ef1('0x14')]?_0x38c5a7[_0x7ef1('0x14')]['attributes']||null:null,'limit':_0x38c5a7[_0x7ef1('0x14')]?_0x38c5a7[_0x7ef1('0x14')][_0x7ef1('0x17')]||null:null,'include':_0x38c5a7[_0x7ef1('0x14')]?_0x38c5a7[_0x7ef1('0x14')][_0x7ef1('0x18')]?_[_0x7ef1('0x19')](_0x38c5a7[_0x7ef1('0x14')]['include'],function(_0x4b1ace){return{'model':db[_0x4b1ace[_0x7ef1('0x1a')]],'as':_0x4b1ace['as'],'attributes':_0x4b1ace[_0x7ef1('0x1b')],'include':_0x4b1ace[_0x7ef1('0x18')]?_[_0x7ef1('0x19')](_0x4b1ace[_0x7ef1('0x18')],function(_0x4cfa16){return{'model':db[_0x4cfa16[_0x7ef1('0x1a')]],'as':_0x4cfa16['as'],'attributes':_0x4cfa16[_0x7ef1('0x1b')],'include':_0x4cfa16[_0x7ef1('0x18')]?_[_0x7ef1('0x19')](_0x4cfa16[_0x7ef1('0x18')],function(_0x238fdc){return{'model':db[_0x238fdc[_0x7ef1('0x1a')]],'as':_0x238fdc['as'],'attributes':_0x238fdc['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ef1('0xd')](function(_0x4b0380){logger[_0x7ef1('0x1c')](_0x7ef1('0x1d'),_0x38c5a7);logger['debug']('GetMailAccount',_0x38c5a7,JSON[_0x7ef1('0x1e')](_0x4b0380));_0x5291b0(_0x4b0380);})[_0x7ef1('0x1f')](function(_0x5ab3a5){logger[_0x7ef1('0x10')]('GetMailAccount',_0x5ab3a5[_0x7ef1('0x12')],_0x38c5a7);_0x568d0a(_0x2a8fab['error'](0x1f4,_0x5ab3a5[_0x7ef1('0x12')]));});});};exports[_0x7ef1('0x20')]=function(_0x585238){var _0x536083=this;return new Promise(function(_0x4e5831,_0x5f2976){return db[_0x7ef1('0x13')][_0x7ef1('0x21')]({'raw':_0x585238['options']?_0x585238[_0x7ef1('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x585238['options']?_0x585238[_0x7ef1('0x14')]['where']||null:null,'attributes':_0x585238[_0x7ef1('0x14')]?_0x585238[_0x7ef1('0x14')][_0x7ef1('0x1b')]||null:null,'include':_0x585238[_0x7ef1('0x14')]?_0x585238['options'][_0x7ef1('0x18')]?_[_0x7ef1('0x19')](_0x585238['options']['include'],function(_0x4b8e6f){return{'model':db[_0x4b8e6f['model']],'as':_0x4b8e6f['as'],'attributes':_0x4b8e6f[_0x7ef1('0x1b')],'include':_0x4b8e6f['include']?_[_0x7ef1('0x19')](_0x4b8e6f[_0x7ef1('0x18')],function(_0xebaf65){return{'model':db[_0xebaf65[_0x7ef1('0x1a')]],'as':_0xebaf65['as'],'attributes':_0xebaf65[_0x7ef1('0x1b')],'include':_0xebaf65[_0x7ef1('0x18')]?_[_0x7ef1('0x19')](_0xebaf65[_0x7ef1('0x18')],function(_0x236dfa){return{'model':db[_0x236dfa[_0x7ef1('0x1a')]],'as':_0x236dfa['as'],'attributes':_0x236dfa[_0x7ef1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a45df){if(_0x585238[_0x7ef1('0x14')]['smtp']===!![])_0x3a45df[_0x7ef1('0x22')](_0x7ef1('0x23'),_0x3a45df[_0x7ef1('0x24')]());logger[_0x7ef1('0x1c')](_0x7ef1('0x20'),_0x585238);logger['debug'](_0x7ef1('0x20'),_0x585238,JSON[_0x7ef1('0x1e')](_0x3a45df));_0x4e5831(_0x3a45df);})[_0x7ef1('0x1f')](function(_0x1ef635){logger[_0x7ef1('0x10')](_0x7ef1('0x20'),_0x1ef635[_0x7ef1('0x12')],_0x585238);_0x5f2976(_0x536083[_0x7ef1('0x10')](0x1f4,_0x1ef635[_0x7ef1('0x12')]));});});};exports[_0x7ef1('0x25')]=function(_0x252176){var _0x40977b=this;return new Promise(function(_0x2da912,_0x39b280){var _0x25c44f={'body':_0x252176['body'],'channel':_0x7ef1('0x26')};var _0x1e3d07=_[_0x7ef1('0x27')](_[_0x7ef1('0x28')](db[_0x7ef1('0x29')][_0x7ef1('0x2a')]),[_0x7ef1('0x2b'),_0x7ef1('0x2c'),_0x7ef1('0x2d'),_0x7ef1('0x2e')]);var _0x3e5ecd=![];if(_0x252176[_0x7ef1('0x2f')]['id']){delete _0x252176[_0x7ef1('0x2f')]['id'];}if(_['isNil'](_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x30')])){return _0x39b280(_0x40977b[_0x7ef1('0x10')](0x1f4,_0x7ef1('0x31')));}if(_[_0x7ef1('0x32')](_0x252176[_0x7ef1('0x2f')]['body'])||_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x2f')]===''){return _0x39b280(_0x40977b[_0x7ef1('0x10')](0x1f4,_0x7ef1('0x33')));}if(_[_0x7ef1('0x32')](_0x252176[_0x7ef1('0x2f')]['mapKey'])){return _0x39b280(_0x40977b[_0x7ef1('0x10')](0x1f4,_0x7ef1('0x34')+_0x1e3d07));}if(!_[_0x7ef1('0x35')](_0x1e3d07,_0x252176[_0x7ef1('0x2f')]['mapKey'])){return _0x39b280(_0x40977b[_0x7ef1('0x10')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1e3d07));}var _0x4db6bf={};_0x4db6bf[_0x252176[_0x7ef1('0x2f')]['mapKey']]=_0x252176[_0x7ef1('0x2f')]['from'];return db[_0x7ef1('0x13')][_0x7ef1('0x21')]({'where':{'id':_0x252176[_0x7ef1('0x36')]['id']},'include':[{'model':db[_0x7ef1('0x37')],'as':_0x7ef1('0x38'),'include':[{'model':db[_0x7ef1('0x29')],'as':_0x7ef1('0x39'),'where':_0x4db6bf,'limit':0x1,'order':[[_0x7ef1('0x2c'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x7ef1('0x3a')},{'model':db[_0x7ef1('0x3b')],'as':'Smtp','include':[{'model':db[_0x7ef1('0x3c')],'as':_0x7ef1('0x3c')}]}]})[_0x7ef1('0xd')](function(_0x5ce876){if(_0x5ce876&&_0x5ce876['List']){var _0x29c25a=_0x5ce876['get']({'plain':!![]});_0x25c44f['account']=_[_0x7ef1('0x3d')](_0x29c25a,[_0x7ef1('0x3a'),_0x7ef1('0x38')]);_0x25c44f[_0x7ef1('0x36')][_0x7ef1('0x23')]=_0x5ce876['getSmtpOptions']();_0x25c44f[_0x7ef1('0x3e')]=_0x29c25a['Applications'];_0x25c44f[_0x7ef1('0x3f')]=_0x29c25a['List'];_0x25c44f[_0x7ef1('0x3e')]=_['orderBy'](_0x25c44f['applications'],[_0x7ef1('0x40')],['asc']);if(_0x25c44f[_0x7ef1('0x36')]&&_0x25c44f[_0x7ef1('0x36')]['autoclose']){_0x25c44f[_0x7ef1('0x3e')][_0x7ef1('0x41')]({'id':0x0,'priority':_0x25c44f[_0x7ef1('0x3e')]['length']+0x1,'app':_0x7ef1('0x42'),'appdata':_0x7ef1('0x43'),'interval':'*,*,*,*'});}if(_0x25c44f[_0x7ef1('0x36')][_0x7ef1('0x3a')]){delete _0x25c44f[_0x7ef1('0x36')][_0x7ef1('0x3a')];}if(_0x25c44f[_0x7ef1('0x36')][_0x7ef1('0x38')]){delete _0x25c44f[_0x7ef1('0x36')]['List'];}if(_0x29c25a['List'][_0x7ef1('0x39')][_0x7ef1('0x44')]){return _0x29c25a[_0x7ef1('0x38')][_0x7ef1('0x39')][0x0];}var _0x129ed9=_[_0x7ef1('0x45')](_0x252176[_0x7ef1('0x2f')],{'firstName':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x30')],'ListId':_0x29c25a[_0x7ef1('0x2e')]});_0x129ed9[_0x252176[_0x7ef1('0x2f')]['mapKey']]=_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x30')];return db[_0x7ef1('0x29')][_0x7ef1('0x46')](_0x129ed9);}else{throw new Error(_0x7ef1('0x47'));}})['then'](function(_0x37ceff){_0x25c44f[_0x7ef1('0x48')]=_0x37ceff;if(_0x37ceff){if(!_0x252176[_0x7ef1('0x2f')]['message'][_0x7ef1('0x49')]){_0x252176[_0x7ef1('0x2f')]['message'][_0x7ef1('0x49')]=rs[_0x7ef1('0x4a')]()+'\x20'+_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x30')];}var _0x2bf639={'ContactId':_0x37ceff['id'],'MailAccountId':_0x252176[_0x7ef1('0x36')]['id'],'inReplyTo':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x49')],'to':_0x252176[_0x7ef1('0x2f')]['message'][_0x7ef1('0x30')],'cc':_0x252176[_0x7ef1('0x2f')]['message']['cc'],'subject':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x4b')],'attach':_0x252176['body'][_0x7ef1('0x12')][_0x7ef1('0x4c')],'lastMsgAt':moment()['format'](_0x7ef1('0x4d')),'lastMsgDirection':'in'};return db[_0x7ef1('0x4e')][_0x7ef1('0x21')]({'where':{'closed':![],'MailAccountId':_0x252176['account']['id']},'include':[{'model':db[_0x7ef1('0x4f')],'as':_0x7ef1('0x50'),'attributes':[_0x7ef1('0x49')],'where':{'messageId':_0x252176['body'][_0x7ef1('0x12')][_0x7ef1('0x51')]}}]})[_0x7ef1('0xd')](function(_0x499783){if(_0x499783){return[_0x499783,![]];}return db[_0x7ef1('0x4e')][_0x7ef1('0x46')](_0x2bf639)['then'](function(_0x341024){return[_0x341024,!![]];});});}else{throw new Error(_0x7ef1('0x52'));}})[_0x7ef1('0x53')](function(_0x3f2800,_0x431844){if(_0x3f2800){_0x3e5ecd=_0x431844;if(!_0x431844){return _0x3f2800[_0x7ef1('0x54')]({'inReplyTo':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x49')],'to':_0x252176['body'][_0x7ef1('0x12')]['from'],'cc':_0x252176[_0x7ef1('0x2f')]['message']['cc'],'subject':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x4b')],'attach':_0x3f2800[_0x7ef1('0x4c')]?_0x3f2800['attach']:_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x4c')],'substatus':null,'substatusAt':moment()[_0x7ef1('0x55')](_0x7ef1('0x4d')),'lastMsgAt':moment()['format'](_0x7ef1('0x4d')),'lastMsgDirection':'in'});}else{return _0x3f2800;}}})['then'](function(_0x4876c7){_0x25c44f[_0x7ef1('0x56')]=_0x4876c7[_0x7ef1('0x57')]({'plain':!![]});_0x25c44f[_0x7ef1('0x56')][_0x7ef1('0x58')]=_0x3e5ecd;return db[_0x7ef1('0x4f')]['create']({'body':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x2f')],'MailAccountId':_0x252176['account']['id'],'MailInteractionId':_0x4876c7['id'],'direction':'in','ContactId':_0x25c44f[_0x7ef1('0x48')]['id'],'messageId':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x49')],'from':_0x252176['body'][_0x7ef1('0x12')][_0x7ef1('0x30')],'to':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')]['to'],'cc':_0x252176['body']['message']['cc'],'subject':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x4b')],'attach':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x4c')],'Attachments':_0x252176['body']['message']['attachments'],'originTo':_0x252176[_0x7ef1('0x2f')]['message']['originTo'],'originCc':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')]['originCc'],'bcc':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x59')],'ChatWebsiteId':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x5a')]||null,'originChannel':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')][_0x7ef1('0x5b')]||_0x7ef1('0x5c'),'ChatOfflineMessageId':_0x252176[_0x7ef1('0x2f')][_0x7ef1('0x12')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x7ef1('0x5d')],'as':'Attachments'}]});})[_0x7ef1('0xd')](function(_0x5194e7){_0x25c44f['message']=_0x5194e7;if(!_0x25c44f[_0x7ef1('0x56')][_0x7ef1('0x5e')]){return;}return db[_0x7ef1('0x5f')][_0x7ef1('0x21')]({'attributes':['id',_0x7ef1('0x60')],'where':{'id':_0x25c44f[_0x7ef1('0x56')]['UserId']}});})[_0x7ef1('0xd')](function(_0x3afee0){if(_0x3afee0){_0x25c44f[_0x7ef1('0x3e')][_0x7ef1('0x61')]({'id':0x0,'priority':0x0,'app':_0x7ef1('0x62'),'appdata':_0x3afee0[_0x7ef1('0x60')]+','+(_0x25c44f[_0x7ef1('0x36')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x25c44f[_0x7ef1('0x56')][_0x7ef1('0x63')]){return;}return db[_0x7ef1('0x64')][_0x7ef1('0x21')]({'attributes':['id',_0x7ef1('0x60')],'where':{'id':_0x25c44f[_0x7ef1('0x56')][_0x7ef1('0x63')]}});})['then'](function(_0x1f274a){if(_0x1f274a){_0x25c44f[_0x7ef1('0x3e')][_0x7ef1('0x61')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1f274a['name']+','+(_0x25c44f[_0x7ef1('0x36')][_0x7ef1('0x65')]||0x12c),'interval':_0x7ef1('0x66')});}return respondWithRpcPromise(_0x7ef1('0x67'),'startRouting',_0x25c44f);})[_0x7ef1('0xd')](function(_0x246dea){_0x2da912(_0x246dea);})[_0x7ef1('0x1f')](function(_0x516bf5){_0x39b280(_0x40977b['error'](0x1f4,_0x516bf5['message']));});});}; \ No newline at end of file +var _0xf987=['autoclose','push','length','close','*,*,*,*','List\x20not\x20found','contact','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','messageId','inReplyTo','create','Contact\x20not\x20found','update','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','GetMailAccount','debug','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','difference','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','body','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','from','account','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','CloudProvider','get','omit','list','applications','orderBy','priority','asc'];(function(_0x438ddc,_0x3fc4ac){var _0x1483e7=function(_0x38f90a){while(--_0x38f90a){_0x438ddc['push'](_0x438ddc['shift']());}};_0x1483e7(++_0x3fc4ac);}(_0xf987,0x18a));var _0x7f98=function(_0x2798d7,_0x1bd381){_0x2798d7=_0x2798d7-0x0;var _0x129d8f=_0xf987[_0x2798d7];return _0x129d8f;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x7f98('0x0'));var rs=require(_0x7f98('0x1'));var Redis=require('ioredis');var db=require(_0x7f98('0x2'))['db'];var logger=require(_0x7f98('0x3'))(_0x7f98('0x4'));var config=require(_0x7f98('0x5'));var jayson=require(_0x7f98('0x6'));var client=jayson[_0x7f98('0x7')][_0x7f98('0x8')]({'port':0x232c});config[_0x7f98('0x9')]=_[_0x7f98('0xa')](config[_0x7f98('0x9')],{'host':_0x7f98('0xb'),'port':0x18eb});var socket=require(_0x7f98('0xc'))(new Redis(config['redis']));require(_0x7f98('0xd'))[_0x7f98('0xe')](socket);function respondWithRpcPromise(_0x229951,_0xc579d0,_0x3c21a1){return new BPromise(function(_0x5c6389,_0x256256){return client['request'](_0x229951,_0x3c21a1)['then'](function(_0x2b425d){logger[_0x7f98('0xf')](_0x7f98('0x10'),_0xc579d0,_0x7f98('0x11'));logger['debug'](_0x7f98('0x12'),_0xc579d0,'request\x20sent',JSON[_0x7f98('0x13')](_0x2b425d));if(_0x2b425d[_0x7f98('0x14')]){if(_0x2b425d[_0x7f98('0x14')][_0x7f98('0x15')]===0x1f4){logger[_0x7f98('0x14')](_0x7f98('0x10'),_0xc579d0,_0x2b425d[_0x7f98('0x14')][_0x7f98('0x16')]);return _0x256256(_0x2b425d[_0x7f98('0x14')][_0x7f98('0x16')]);}logger[_0x7f98('0x14')](_0x7f98('0x10'),_0xc579d0,_0x2b425d['error'][_0x7f98('0x16')]);return _0x5c6389(_0x2b425d['error']['message']);}else{logger[_0x7f98('0xf')](_0x7f98('0x10'),_0xc579d0,'request\x20sent');_0x5c6389(_0x2b425d['result']['message']);}})['catch'](function(_0x111385){logger[_0x7f98('0x14')]('MailAccount,\x20%s,\x20%s',_0xc579d0,_0x111385);_0x256256(_0x111385);});});}exports['GetMailAccount']=function(_0x4f3ac0){var _0x364377=this;return new Promise(function(_0x5e45a2,_0xe3e55a){return db[_0x7f98('0x17')][_0x7f98('0x18')]({'raw':_0x4f3ac0[_0x7f98('0x19')]?_0x4f3ac0[_0x7f98('0x19')][_0x7f98('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f3ac0[_0x7f98('0x19')]?_0x4f3ac0[_0x7f98('0x19')][_0x7f98('0x1b')]||null:null,'attributes':_0x4f3ac0['options']?_0x4f3ac0['options'][_0x7f98('0x1c')]||null:null,'limit':_0x4f3ac0['options']?_0x4f3ac0[_0x7f98('0x19')][_0x7f98('0x1d')]||null:null,'include':_0x4f3ac0['options']?_0x4f3ac0[_0x7f98('0x19')][_0x7f98('0x1e')]?_['map'](_0x4f3ac0[_0x7f98('0x19')][_0x7f98('0x1e')],function(_0x1d6bdb){return{'model':db[_0x1d6bdb[_0x7f98('0x1f')]],'as':_0x1d6bdb['as'],'attributes':_0x1d6bdb[_0x7f98('0x1c')],'include':_0x1d6bdb[_0x7f98('0x1e')]?_[_0x7f98('0x20')](_0x1d6bdb[_0x7f98('0x1e')],function(_0x1d086f){return{'model':db[_0x1d086f[_0x7f98('0x1f')]],'as':_0x1d086f['as'],'attributes':_0x1d086f[_0x7f98('0x1c')],'include':_0x1d086f[_0x7f98('0x1e')]?_[_0x7f98('0x20')](_0x1d086f['include'],function(_0x4c9809){return{'model':db[_0x4c9809[_0x7f98('0x1f')]],'as':_0x4c9809['as'],'attributes':_0x4c9809[_0x7f98('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7f98('0x21')](function(_0x1dd8d5){logger[_0x7f98('0xf')](_0x7f98('0x22'),_0x4f3ac0);logger[_0x7f98('0x23')](_0x7f98('0x22'),_0x4f3ac0,JSON[_0x7f98('0x13')](_0x1dd8d5));_0x5e45a2(_0x1dd8d5);})[_0x7f98('0x24')](function(_0x544bae){logger[_0x7f98('0x14')](_0x7f98('0x22'),_0x544bae['message'],_0x4f3ac0);_0xe3e55a(_0x364377[_0x7f98('0x14')](0x1f4,_0x544bae[_0x7f98('0x16')]));});});};exports[_0x7f98('0x25')]=function(_0x4e86fd){var _0x23acb7=this;return new Promise(function(_0x5182d9,_0x400ff3){return db['MailAccount'][_0x7f98('0x26')]({'raw':_0x4e86fd[_0x7f98('0x19')]?_0x4e86fd[_0x7f98('0x19')][_0x7f98('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e86fd[_0x7f98('0x19')]?_0x4e86fd[_0x7f98('0x19')][_0x7f98('0x1b')]||null:null,'attributes':_0x4e86fd['options']?_0x4e86fd['options'][_0x7f98('0x1c')]||null:null,'include':_0x4e86fd[_0x7f98('0x19')]?_0x4e86fd[_0x7f98('0x19')][_0x7f98('0x1e')]?_[_0x7f98('0x20')](_0x4e86fd[_0x7f98('0x19')][_0x7f98('0x1e')],function(_0x51a15d){return{'model':db[_0x51a15d['model']],'as':_0x51a15d['as'],'attributes':_0x51a15d[_0x7f98('0x1c')],'include':_0x51a15d['include']?_[_0x7f98('0x20')](_0x51a15d['include'],function(_0x376dd3){return{'model':db[_0x376dd3[_0x7f98('0x1f')]],'as':_0x376dd3['as'],'attributes':_0x376dd3[_0x7f98('0x1c')],'include':_0x376dd3[_0x7f98('0x1e')]?_[_0x7f98('0x20')](_0x376dd3[_0x7f98('0x1e')],function(_0x172d5){return{'model':db[_0x172d5[_0x7f98('0x1f')]],'as':_0x172d5['as'],'attributes':_0x172d5[_0x7f98('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7f98('0x21')](function(_0x1595d0){if(_0x4e86fd[_0x7f98('0x19')][_0x7f98('0x27')]===!![])_0x1595d0[_0x7f98('0x28')](_0x7f98('0x29'),_0x1595d0[_0x7f98('0x2a')]());logger[_0x7f98('0xf')](_0x7f98('0x25'),_0x4e86fd);logger[_0x7f98('0x23')](_0x7f98('0x25'),_0x4e86fd,JSON[_0x7f98('0x13')](_0x1595d0));_0x5182d9(_0x1595d0);})[_0x7f98('0x24')](function(_0x3f7f50){logger['error'](_0x7f98('0x25'),_0x3f7f50[_0x7f98('0x16')],_0x4e86fd);_0x400ff3(_0x23acb7[_0x7f98('0x14')](0x1f4,_0x3f7f50[_0x7f98('0x16')]));});});};exports['NotifyMailAccount']=function(_0x55c9a0){var _0x1fdeeb=this;return new Promise(function(_0x24bbdc,_0x491cba){var _0x7d4998={'body':_0x55c9a0['body'],'channel':'mail'};var _0x4e4e35=_[_0x7f98('0x2b')](_['keys'](db[_0x7f98('0x2c')]['rawAttributes']),[_0x7f98('0x2d'),_0x7f98('0x2e'),_0x7f98('0x2f'),_0x7f98('0x30')]);var _0x48ede9=![];if(_0x55c9a0['body']['id']){delete _0x55c9a0['body']['id'];}if(_[_0x7f98('0x31')](_0x55c9a0[_0x7f98('0x32')]['from'])){return _0x491cba(_0x1fdeeb['error'](0x1f4,_0x7f98('0x33')));}if(_[_0x7f98('0x31')](_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x32')])||_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x32')]===''){return _0x491cba(_0x1fdeeb['error'](0x1f4,_0x7f98('0x34')));}if(_[_0x7f98('0x31')](_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x35')])){return _0x491cba(_0x1fdeeb[_0x7f98('0x14')](0x1f4,_0x7f98('0x36')+_0x4e4e35));}if(!_[_0x7f98('0x37')](_0x4e4e35,_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x35')])){return _0x491cba(_0x1fdeeb[_0x7f98('0x14')](0x1f4,_0x7f98('0x38')+_0x4e4e35));}var _0x3b3210={};_0x3b3210[_0x55c9a0['body']['mapKey']]=_0x55c9a0['body'][_0x7f98('0x39')];return db[_0x7f98('0x17')]['find']({'where':{'id':_0x55c9a0[_0x7f98('0x3a')]['id']},'include':[{'model':db[_0x7f98('0x3b')],'as':_0x7f98('0x3c'),'include':[{'model':db[_0x7f98('0x2c')],'as':_0x7f98('0x3d'),'where':_0x3b3210,'limit':0x1,'order':[[_0x7f98('0x2e'),_0x7f98('0x3e')]]}]},{'model':db[_0x7f98('0x3f')],'as':_0x7f98('0x40')},{'model':db['MailServerOut'],'as':_0x7f98('0x41'),'include':[{'model':db[_0x7f98('0x42')],'as':_0x7f98('0x42')}]}]})[_0x7f98('0x21')](function(_0x3396a7){if(_0x3396a7&&_0x3396a7['List']){var _0x414b85=_0x3396a7[_0x7f98('0x43')]({'plain':!![]});_0x7d4998['account']=_[_0x7f98('0x44')](_0x414b85,[_0x7f98('0x40'),_0x7f98('0x3c')]);_0x7d4998[_0x7f98('0x3a')]['smtpOptions']=_0x3396a7[_0x7f98('0x2a')]();_0x7d4998['applications']=_0x414b85['Applications'];_0x7d4998[_0x7f98('0x45')]=_0x414b85[_0x7f98('0x3c')];_0x7d4998[_0x7f98('0x46')]=_[_0x7f98('0x47')](_0x7d4998[_0x7f98('0x46')],[_0x7f98('0x48')],[_0x7f98('0x49')]);if(_0x7d4998[_0x7f98('0x3a')]&&_0x7d4998[_0x7f98('0x3a')][_0x7f98('0x4a')]){_0x7d4998['applications'][_0x7f98('0x4b')]({'id':0x0,'priority':_0x7d4998[_0x7f98('0x46')][_0x7f98('0x4c')]+0x1,'app':_0x7f98('0x4d'),'appdata':_0x7f98('0x4a'),'interval':_0x7f98('0x4e')});}if(_0x7d4998[_0x7f98('0x3a')][_0x7f98('0x40')]){delete _0x7d4998[_0x7f98('0x3a')][_0x7f98('0x40')];}if(_0x7d4998[_0x7f98('0x3a')]['List']){delete _0x7d4998[_0x7f98('0x3a')][_0x7f98('0x3c')];}if(_0x414b85[_0x7f98('0x3c')]['Contacts']['length']){return _0x414b85['List']['Contacts'][0x0];}var _0x53a94d=_[_0x7f98('0xa')](_0x55c9a0[_0x7f98('0x32')],{'firstName':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x39')],'ListId':_0x414b85['ListId']});_0x53a94d[_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x35')]]=_0x55c9a0['body'][_0x7f98('0x39')];return db[_0x7f98('0x2c')]['create'](_0x53a94d);}else{throw new Error(_0x7f98('0x4f'));}})[_0x7f98('0x21')](function(_0x273de9){_0x7d4998[_0x7f98('0x50')]=_0x273de9;if(_0x273de9){if(!_0x55c9a0[_0x7f98('0x32')]['message']['messageId']){_0x55c9a0[_0x7f98('0x32')]['message']['messageId']=rs[_0x7f98('0x51')]()+'\x20'+_0x55c9a0[_0x7f98('0x32')]['message']['from'];}var _0x560d18={'ContactId':_0x273de9['id'],'MailAccountId':_0x55c9a0['account']['id'],'inReplyTo':_0x55c9a0['body'][_0x7f98('0x16')]['messageId'],'to':_0x55c9a0['body'][_0x7f98('0x16')][_0x7f98('0x39')],'cc':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['cc'],'subject':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x52')],'attach':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['attach'],'lastMsgAt':moment()[_0x7f98('0x53')](_0x7f98('0x54')),'lastMsgDirection':'in'};return db[_0x7f98('0x55')]['find']({'where':{'closed':![],'MailAccountId':_0x55c9a0[_0x7f98('0x3a')]['id']},'include':[{'model':db[_0x7f98('0x56')],'as':_0x7f98('0x57'),'attributes':[_0x7f98('0x58')],'where':{'messageId':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x59')]}}]})[_0x7f98('0x21')](function(_0x46fb9b){if(_0x46fb9b){return[_0x46fb9b,![]];}return db[_0x7f98('0x55')][_0x7f98('0x5a')](_0x560d18)[_0x7f98('0x21')](function(_0x3cb03a){return[_0x3cb03a,!![]];});});}else{throw new Error(_0x7f98('0x5b'));}})['spread'](function(_0x2e4f7e,_0x297508){if(_0x2e4f7e){_0x48ede9=_0x297508;if(!_0x297508){return _0x2e4f7e[_0x7f98('0x5c')]({'inReplyTo':_0x55c9a0['body']['message'][_0x7f98('0x58')],'to':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x39')],'cc':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['cc'],'subject':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['subject'],'attach':_0x2e4f7e[_0x7f98('0x5d')]?_0x2e4f7e[_0x7f98('0x5d')]:_0x55c9a0[_0x7f98('0x32')]['message'][_0x7f98('0x5d')],'substatus':null,'substatusAt':moment()[_0x7f98('0x53')](_0x7f98('0x54')),'lastMsgAt':moment()['format'](_0x7f98('0x54')),'lastMsgDirection':'in'});}else{return _0x2e4f7e;}}})[_0x7f98('0x21')](function(_0x2f155b){_0x7d4998[_0x7f98('0x5e')]=_0x2f155b[_0x7f98('0x43')]({'plain':!![]});_0x7d4998[_0x7f98('0x5e')][_0x7f98('0x5f')]=_0x48ede9;return db['MailMessage'][_0x7f98('0x5a')]({'body':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x32')],'MailAccountId':_0x55c9a0[_0x7f98('0x3a')]['id'],'MailInteractionId':_0x2f155b['id'],'direction':'in','ContactId':_0x7d4998[_0x7f98('0x50')]['id'],'messageId':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x58')],'from':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['from'],'to':_0x55c9a0[_0x7f98('0x32')]['message']['to'],'cc':_0x55c9a0[_0x7f98('0x32')]['message']['cc'],'subject':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['subject'],'attach':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['attach'],'Attachments':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x60')],'originTo':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x61')],'originCc':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x62')],'bcc':_0x55c9a0['body'][_0x7f98('0x16')][_0x7f98('0x63')],'ChatWebsiteId':_0x55c9a0['body'][_0x7f98('0x16')][_0x7f98('0x64')]||null,'originChannel':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x65')]||_0x7f98('0x66'),'ChatOfflineMessageId':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x67')]||null},{'include':[{'model':db[_0x7f98('0x68')],'as':'Attachments'}]});})[_0x7f98('0x21')](function(_0x240f5a){_0x7d4998['message']=_0x240f5a;if(!_0x7d4998[_0x7f98('0x5e')][_0x7f98('0x69')]){return;}return db[_0x7f98('0x6a')][_0x7f98('0x26')]({'attributes':['id',_0x7f98('0x6b')],'where':{'id':_0x7d4998[_0x7f98('0x5e')][_0x7f98('0x69')]}});})[_0x7f98('0x21')](function(_0x2c9f0a){if(_0x2c9f0a){_0x7d4998[_0x7f98('0x46')][_0x7f98('0x6c')]({'id':0x0,'priority':0x0,'app':_0x7f98('0x6d'),'appdata':_0x2c9f0a[_0x7f98('0x6b')]+','+(_0x7d4998['account'][_0x7f98('0x6e')]||0xa),'interval':_0x7f98('0x4e')});}if(!_0x7d4998[_0x7f98('0x5e')][_0x7f98('0x6f')]){return;}return db[_0x7f98('0x70')]['find']({'attributes':['id','name'],'where':{'id':_0x7d4998[_0x7f98('0x5e')][_0x7f98('0x6f')]}});})[_0x7f98('0x21')](function(_0x35c7ab){if(_0x35c7ab){_0x7d4998[_0x7f98('0x46')][_0x7f98('0x6c')]({'id':0x0,'priority':0x1,'app':_0x7f98('0x71'),'appdata':_0x35c7ab[_0x7f98('0x6b')]+','+(_0x7d4998[_0x7f98('0x3a')][_0x7f98('0x72')]||0x12c),'interval':_0x7f98('0x4e')});}return respondWithRpcPromise(_0x7f98('0x73'),_0x7f98('0x74'),_0x7d4998);})[_0x7f98('0x21')](function(_0x535373){_0x24bbdc(_0x535373);})['catch'](function(_0x5947fa){_0x491cba(_0x1fdeeb[_0x7f98('0x14')](0x1f4,_0x5947fa[_0x7f98('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 54ed673..dec3b88 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 _0x5713=['length','mailAccount:','remove','emit','removeListener','register'];(function(_0x323f46,_0x2f8545){var _0x359a7c=function(_0x2eea10){while(--_0x2eea10){_0x323f46['push'](_0x323f46['shift']());}};_0x359a7c(++_0x2f8545);}(_0x5713,0xfe));var _0x3571=function(_0xa78e5e,_0x31f44d){_0xa78e5e=_0xa78e5e-0x0;var _0x392c24=_0x5713[_0xa78e5e];return _0x392c24;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0x3571('0x0'),'update'];function createListener(_0x6c7fdd,_0x248172){return function(_0x413f0d){_0x248172[_0x3571('0x1')](_0x6c7fdd,_0x413f0d);};}function removeListener(_0x45e169,_0x3fd543){return function(){MailAccountEvents[_0x3571('0x2')](_0x45e169,_0x3fd543);};}exports[_0x3571('0x3')]=function(_0x16eb4b){for(var _0x461a44=0x0,_0x11f4a6=events[_0x3571('0x4')];_0x461a44<_0x11f4a6;_0x461a44++){var _0x417379=events[_0x461a44];var _0x814df7=createListener(_0x3571('0x5')+_0x417379,_0x16eb4b);MailAccountEvents['on'](_0x417379,_0x814df7);}}; \ No newline at end of file +var _0x0bf7=['./mailAccount.events','remove','update','emit','length','mailAccount:'];(function(_0x39e717,_0x3061e3){var _0x19b182=function(_0x599889){while(--_0x599889){_0x39e717['push'](_0x39e717['shift']());}};_0x19b182(++_0x3061e3);}(_0x0bf7,0x14a));var _0x70bf=function(_0x228a5c,_0x345739){_0x228a5c=_0x228a5c-0x0;var _0x8f90b1=_0x0bf7[_0x228a5c];return _0x8f90b1;};'use strict';var MailAccountEvents=require(_0x70bf('0x0'));var events=['save',_0x70bf('0x1'),_0x70bf('0x2')];function createListener(_0x214a6f,_0x448f57){return function(_0xee2152){_0x448f57[_0x70bf('0x3')](_0x214a6f,_0xee2152);};}function removeListener(_0x4f6e52,_0x1cad23){return function(){MailAccountEvents['removeListener'](_0x4f6e52,_0x1cad23);};}exports['register']=function(_0x57a9d3){for(var _0x4179e4=0x0,_0x410444=events[_0x70bf('0x4')];_0x4179e4<_0x410444;_0x4179e4++){var _0x24b8b0=events[_0x4179e4];var _0x2ba2ce=createListener(_0x70bf('0x5')+_0x24b8b0,_0x57a9d3);MailAccountEvents['on'](_0x24b8b0,_0x2ba2ce);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 0dc2b5c..ea3e359 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 _0x2fe7=['../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x4119b9,_0x2135b6){var _0x421d6a=function(_0xb050c3){while(--_0xb050c3){_0x4119b9['push'](_0x4119b9['shift']());}};_0x421d6a(++_0x2135b6);}(_0x2fe7,0x6a));var _0x72fe=function(_0x54d74a,_0x5ad0ea){_0x54d74a=_0x54d74a-0x0;var _0x36c7cc=_0x2fe7[_0x54d74a];return _0x36c7cc;};'use strict';var multer=require(_0x72fe('0x0'));var util=require(_0x72fe('0x1'));var path=require(_0x72fe('0x2'));var timeout=require(_0x72fe('0x3'));var express=require(_0x72fe('0x4'));var router=express['Router']();var fs_extra=require(_0x72fe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x72fe('0x6'));var config=require(_0x72fe('0x7'));var controller=require('./mailApplication.controller');router['get'](_0x72fe('0x8'),auth[_0x72fe('0x9')](),controller[_0x72fe('0xa')]);router[_0x72fe('0xb')](_0x72fe('0x8'),auth[_0x72fe('0x9')](),controller[_0x72fe('0xc')]);router[_0x72fe('0xd')]('/:id',auth[_0x72fe('0x9')](),controller[_0x72fe('0xe')]);module[_0x72fe('0xf')]=router; \ No newline at end of file +var _0x5718=['/:id','isAuthenticated','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get'];(function(_0x3b2e0a,_0x49a3f9){var _0x4a84bd=function(_0x3aa487){while(--_0x3aa487){_0x3b2e0a['push'](_0x3b2e0a['shift']());}};_0x4a84bd(++_0x49a3f9);}(_0x5718,0x130));var _0x8571=function(_0xe4d310,_0x420e38){_0xe4d310=_0xe4d310-0x0;var _0x407706=_0x5718[_0xe4d310];return _0x407706;};'use strict';var multer=require('multer');var util=require(_0x8571('0x0'));var path=require('path');var timeout=require(_0x8571('0x1'));var express=require('express');var router=express[_0x8571('0x2')]();var fs_extra=require(_0x8571('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8571('0x4'));var config=require(_0x8571('0x5'));var controller=require(_0x8571('0x6'));router[_0x8571('0x7')](_0x8571('0x8'),auth[_0x8571('0x9')](),controller['show']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8571('0xa')](_0x8571('0x8'),auth[_0x8571('0x9')](),controller[_0x8571('0xb')]);module[_0x8571('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 2580142..8d6f76c 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 _0x4eb1=['INTEGER','STRING','noop','sequelize','exports'];(function(_0x4c8e4b,_0x3d9642){var _0x30fb38=function(_0x28c375){while(--_0x28c375){_0x4c8e4b['push'](_0x4c8e4b['shift']());}};_0x30fb38(++_0x3d9642);}(_0x4eb1,0x71));var _0x14eb=function(_0x13c29d,_0x4eb61b){_0x13c29d=_0x13c29d-0x0;var _0x5dc835=_0x4eb1[_0x13c29d];return _0x5dc835;};'use strict';var Sequelize=require(_0x14eb('0x0'));module[_0x14eb('0x1')]={'priority':{'type':Sequelize[_0x14eb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x14eb('0x3')],'allowNull':![],'defaultValue':_0x14eb('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x14eb('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1ee6=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0xc7ff2e,_0x4a9dac){var _0x2cc041=function(_0x1e3288){while(--_0x1e3288){_0xc7ff2e['push'](_0xc7ff2e['shift']());}};_0x2cc041(++_0x4a9dac);}(_0x1ee6,0xd0));var _0x61ee=function(_0x473c81,_0x305907){_0x473c81=_0x473c81-0x0;var _0x336fdd=_0x1ee6[_0x473c81];return _0x336fdd;};'use strict';var Sequelize=require(_0x61ee('0x0'));module[_0x61ee('0x1')]={'priority':{'type':Sequelize[_0x61ee('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x61ee('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x61ee('0x4')]()},'description':{'type':Sequelize[_0x61ee('0x3')]},'interval':{'type':Sequelize[_0x61ee('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 35e491e..d290e5d 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x3c5304,_0x4fb045){var _0xf2c65=function(_0x3de6fd){while(--_0x3de6fd){_0x3c5304['push'](_0x3c5304['shift']());}};_0xf2c65(++_0x4fb045);}(_0xda3f,0xec));var _0xfda3=function(_0x3c0a93,_0x1af92f){_0x3c0a93=_0x3c0a93-0x0;var _0x2b6454=_0xda3f[_0x3c0a93];return _0x2b6454;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x396e4d,_0x5f32f1){var _0x272d39=function(_0x539e92){while(--_0x539e92){_0x396e4d['push'](_0x396e4d['shift']());}};_0x272d39(++_0x5f32f1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 4e96efd..c71ef66 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 _0x57d7=['./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x593356,_0x4a9d14){var _0xfd7d5e=function(_0x10357e){while(--_0x10357e){_0x593356['push'](_0x593356['shift']());}};_0xfd7d5e(++_0x4a9d14);}(_0x57d7,0x172));var _0x757d=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0x57d7[_0x50f392];return _0x5926f2;};'use strict';var _=require(_0x757d('0x0'));var util=require(_0x757d('0x1'));var logger=require(_0x757d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x757d('0x3'));var rp=require(_0x757d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x757d('0x5'));var config=require(_0x757d('0x6'));var attributes=require(_0x757d('0x7'));module[_0x757d('0x8')]=function(_0x2f3dbe,_0x120075){return _0x2f3dbe[_0x757d('0x9')](_0x757d('0xa'),attributes,{'tableName':_0x757d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x757d('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb8f9=['bluebird','path','rimraf','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','../../config/logger','api','moment'];(function(_0x3bc15b,_0x299ccc){var _0x389630=function(_0xe9686){while(--_0xe9686){_0x3bc15b['push'](_0x3bc15b['shift']());}};_0x389630(++_0x299ccc);}(_0xb8f9,0x81));var _0x9b8f=function(_0x507965,_0x4944f4){_0x507965=_0x507965-0x0;var _0x3608fc=_0xb8f9[_0x507965];return _0x3608fc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9b8f('0x0'))(_0x9b8f('0x1'));var moment=require(_0x9b8f('0x2'));var BPromise=require(_0x9b8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b8f('0x4'));var rimraf=require(_0x9b8f('0x5'));var config=require('../../config/environment');var attributes=require(_0x9b8f('0x6'));module[_0x9b8f('0x7')]=function(_0x16c072,_0x5c7415){return _0x16c072[_0x9b8f('0x8')](_0x9b8f('0x9'),attributes,{'tableName':_0x9b8f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9b8f('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 21a2f18..0824af1 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 _0xfd12=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','limit','lodash','util','bluebird','ioredis'];(function(_0x2f4173,_0x1f5d89){var _0x1f9f8d=function(_0x4080c6){while(--_0x4080c6){_0x2f4173['push'](_0x2f4173['shift']());}};_0x1f9f8d(++_0x1f5d89);}(_0xfd12,0x182));var _0x2fd1=function(_0x5c619e,_0x1bccdf){_0x5c619e=_0x5c619e-0x0;var _0x445cf8=_0xfd12[_0x5c619e];return _0x445cf8;};'use strict';var _=require(_0x2fd1('0x0'));var util=require(_0x2fd1('0x1'));var moment=require('moment');var BPromise=require(_0x2fd1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fd1('0x3'));var db=require(_0x2fd1('0x4'))['db'];var utils=require(_0x2fd1('0x5'));var logger=require(_0x2fd1('0x6'))(_0x2fd1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2fd1('0x8')][_0x2fd1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cfb78,_0x369d42,_0x5926ec){return new BPromise(function(_0x560868,_0x91d9c3){return client[_0x2fd1('0xa')](_0x3cfb78,_0x5926ec)[_0x2fd1('0xb')](function(_0x286c12){logger[_0x2fd1('0xc')](_0x2fd1('0xd'),_0x369d42,_0x2fd1('0xe'));logger[_0x2fd1('0xf')](_0x2fd1('0x10'),_0x369d42,_0x2fd1('0xe'),JSON[_0x2fd1('0x11')](_0x286c12));if(_0x286c12['error']){if(_0x286c12['error']['code']===0x1f4){logger[_0x2fd1('0x12')](_0x2fd1('0xd'),_0x369d42,_0x286c12[_0x2fd1('0x12')][_0x2fd1('0x13')]);return _0x91d9c3(_0x286c12[_0x2fd1('0x12')][_0x2fd1('0x13')]);}logger[_0x2fd1('0x12')](_0x2fd1('0xd'),_0x369d42,_0x286c12[_0x2fd1('0x12')]['message']);return _0x560868(_0x286c12[_0x2fd1('0x12')][_0x2fd1('0x13')]);}else{logger[_0x2fd1('0xc')]('MailApplication,\x20%s,\x20%s',_0x369d42,_0x2fd1('0xe'));_0x560868(_0x286c12[_0x2fd1('0x14')]['message']);}})[_0x2fd1('0x15')](function(_0x34236b){logger['error'](_0x2fd1('0xd'),_0x369d42,_0x34236b);_0x91d9c3(_0x34236b);});});}exports[_0x2fd1('0x16')]=function(_0x57df73){var _0x440667=this;return new Promise(function(_0x4c190d,_0x5be0bb){return db[_0x2fd1('0x17')][_0x2fd1('0x18')](_0x57df73[_0x2fd1('0x19')],{'raw':_0x57df73[_0x2fd1('0x1a')]?_0x57df73[_0x2fd1('0x1a')][_0x2fd1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57df73[_0x2fd1('0x1a')]?_0x57df73[_0x2fd1('0x1a')]['where']||null:null,'attributes':_0x57df73[_0x2fd1('0x1a')]?_0x57df73[_0x2fd1('0x1a')][_0x2fd1('0x1c')]||null:null,'limit':_0x57df73['options']?_0x57df73[_0x2fd1('0x1a')][_0x2fd1('0x1d')]||null:null})['then'](function(_0x4fcadd){logger[_0x2fd1('0xc')]('UpdateMailApplication',_0x57df73);logger['debug']('UpdateMailApplication',_0x57df73,JSON[_0x2fd1('0x11')](_0x4fcadd));_0x4c190d(_0x4fcadd);})[_0x2fd1('0x15')](function(_0x2a61e7){logger[_0x2fd1('0x12')](_0x2fd1('0x16'),_0x2a61e7[_0x2fd1('0x13')],_0x57df73);_0x5be0bb(_0x440667[_0x2fd1('0x12')](0x1f4,_0x2a61e7['message']));});});}; \ No newline at end of file +var _0x5f39=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','MailApplication','body','options','raw','where','attributes','limit','then','UpdateMailApplication','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','info'];(function(_0x3fbfbc,_0x166a27){var _0x5f5121=function(_0x7cef3){while(--_0x7cef3){_0x3fbfbc['push'](_0x3fbfbc['shift']());}};_0x5f5121(++_0x166a27);}(_0x5f39,0x6a));var _0x95f3=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5f39[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x95f3('0x0'));var moment=require(_0x95f3('0x1'));var BPromise=require(_0x95f3('0x2'));var rs=require(_0x95f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x95f3('0x5'))(_0x95f3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x95f3('0x7')][_0x95f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x514c04,_0x236f6d,_0x58dd7d){return new BPromise(function(_0x28792a,_0x333666){return client['request'](_0x514c04,_0x58dd7d)['then'](function(_0xc79df4){logger[_0x95f3('0x9')]('MailApplication,\x20%s,\x20%s',_0x236f6d,_0x95f3('0xa'));logger[_0x95f3('0xb')](_0x95f3('0xc'),_0x236f6d,'request\x20sent',JSON[_0x95f3('0xd')](_0xc79df4));if(_0xc79df4[_0x95f3('0xe')]){if(_0xc79df4[_0x95f3('0xe')][_0x95f3('0xf')]===0x1f4){logger[_0x95f3('0xe')](_0x95f3('0x10'),_0x236f6d,_0xc79df4[_0x95f3('0xe')][_0x95f3('0x11')]);return _0x333666(_0xc79df4['error'][_0x95f3('0x11')]);}logger[_0x95f3('0xe')](_0x95f3('0x10'),_0x236f6d,_0xc79df4[_0x95f3('0xe')][_0x95f3('0x11')]);return _0x28792a(_0xc79df4[_0x95f3('0xe')][_0x95f3('0x11')]);}else{logger[_0x95f3('0x9')](_0x95f3('0x10'),_0x236f6d,_0x95f3('0xa'));_0x28792a(_0xc79df4[_0x95f3('0x12')][_0x95f3('0x11')]);}})[_0x95f3('0x13')](function(_0xe8919d){logger[_0x95f3('0xe')](_0x95f3('0x10'),_0x236f6d,_0xe8919d);_0x333666(_0xe8919d);});});}exports['UpdateMailApplication']=function(_0x317815){var _0x44bbcc=this;return new Promise(function(_0x43435f,_0x59e18a){return db[_0x95f3('0x14')]['update'](_0x317815[_0x95f3('0x15')],{'raw':_0x317815['options']?_0x317815[_0x95f3('0x16')][_0x95f3('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x317815['options']?_0x317815[_0x95f3('0x16')][_0x95f3('0x18')]||null:null,'attributes':_0x317815[_0x95f3('0x16')]?_0x317815[_0x95f3('0x16')][_0x95f3('0x19')]||null:null,'limit':_0x317815[_0x95f3('0x16')]?_0x317815[_0x95f3('0x16')][_0x95f3('0x1a')]||null:null})[_0x95f3('0x1b')](function(_0x35edad){logger[_0x95f3('0x9')](_0x95f3('0x1c'),_0x317815);logger[_0x95f3('0xb')](_0x95f3('0x1c'),_0x317815,JSON[_0x95f3('0xd')](_0x35edad));_0x43435f(_0x35edad);})['catch'](function(_0x338082){logger[_0x95f3('0xe')]('UpdateMailApplication',_0x338082['message'],_0x317815);_0x59e18a(_0x44bbcc[_0x95f3('0xe')](0x1f4,_0x338082['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 03191fc..80002f0 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 _0x3168=['removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy'];(function(_0x8cb724,_0x5e78d5){var _0x348d6f=function(_0x7b70ea){while(--_0x7b70ea){_0x8cb724['push'](_0x8cb724['shift']());}};_0x348d6f(++_0x5e78d5);}(_0x3168,0x6a));var _0x8316=function(_0x219bab,_0x55edef){_0x219bab=_0x219bab-0x0;var _0x14eb0f=_0x3168[_0x219bab];return _0x14eb0f;};'use strict';var express=require(_0x8316('0x0'));var router=express[_0x8316('0x1')]();var auth=require(_0x8316('0x2'));var interaction=require(_0x8316('0x3'));var controller=require(_0x8316('0x4'));router[_0x8316('0x5')]('/',auth[_0x8316('0x6')](),controller[_0x8316('0x7')]);router[_0x8316('0x5')](_0x8316('0x8'),auth[_0x8316('0x6')](),controller[_0x8316('0x9')]);router['get'](_0x8316('0xa'),auth[_0x8316('0x6')](),controller['show']);router['get'](_0x8316('0xb'),auth[_0x8316('0x6')](),controller[_0x8316('0xc')]);router[_0x8316('0x5')](_0x8316('0xd'),auth[_0x8316('0x6')](),controller[_0x8316('0xe')]);router[_0x8316('0xf')]('/',auth[_0x8316('0x6')](),controller[_0x8316('0x10')]);router[_0x8316('0xf')](_0x8316('0xb'),auth[_0x8316('0x6')](),controller['addMessage']);router[_0x8316('0xf')](_0x8316('0x11'),auth[_0x8316('0x6')](),interaction['tracked']('mail','mailinteraction:addtags'),controller['addTags']);router['put'](_0x8316('0xa'),auth[_0x8316('0x6')](),interaction[_0x8316('0x12')](_0x8316('0x13'),_0x8316('0x14')),controller['update']);router[_0x8316('0x15')]('/:id',auth[_0x8316('0x6')](),interaction[_0x8316('0x12')]('mail',_0x8316('0x16')),controller[_0x8316('0x17')]);router[_0x8316('0x15')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8316('0x18')]);module[_0x8316('0x19')]=router; \ No newline at end of file +var _0x27b3=['Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','create','addMessage','post','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','delete','destroy','removeTags'];(function(_0x10e8ed,_0x384a0d){var _0x4aea4a=function(_0x486ad1){while(--_0x486ad1){_0x10e8ed['push'](_0x10e8ed['shift']());}};_0x4aea4a(++_0x384a0d);}(_0x27b3,0xc8));var _0x327b=function(_0xb87c9d,_0x149fa2){_0xb87c9d=_0xb87c9d-0x0;var _0x31ba11=_0x27b3[_0xb87c9d];return _0x31ba11;};'use strict';var express=require('express');var router=express[_0x327b('0x0')]();var auth=require(_0x327b('0x1'));var interaction=require(_0x327b('0x2'));var controller=require(_0x327b('0x3'));router[_0x327b('0x4')]('/',auth[_0x327b('0x5')](),controller[_0x327b('0x6')]);router[_0x327b('0x4')](_0x327b('0x7'),auth[_0x327b('0x5')](),controller[_0x327b('0x8')]);router[_0x327b('0x4')](_0x327b('0x9'),auth[_0x327b('0x5')](),controller['show']);router['get'](_0x327b('0xa'),auth[_0x327b('0x5')](),controller[_0x327b('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x327b('0xc')]);router['post']('/',auth[_0x327b('0x5')](),controller[_0x327b('0xd')]);router['post'](_0x327b('0xa'),auth[_0x327b('0x5')](),controller[_0x327b('0xe')]);router[_0x327b('0xf')](_0x327b('0x10'),auth['isAuthenticated'](),interaction[_0x327b('0x11')](_0x327b('0x12'),'mailinteraction:addtags'),controller[_0x327b('0x13')]);router[_0x327b('0x14')](_0x327b('0x9'),auth[_0x327b('0x5')](),interaction['tracked'](_0x327b('0x12'),_0x327b('0x15')),controller['update']);router[_0x327b('0x16')](_0x327b('0x9'),auth[_0x327b('0x5')](),interaction['tracked'](_0x327b('0x12'),'mailinteraction:destroy'),controller[_0x327b('0x17')]);router[_0x327b('0x16')]('/:id/tags',auth[_0x327b('0x5')](),controller[_0x327b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index a69bed4..bc28a03 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 _0xec98=['sequelize','BOOLEAN','DATE','STRING','long','TEXT','out','ENUM'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xec98,0x70));var _0x8ec9=function(_0x1731a8,_0x266040){_0x1731a8=_0x1731a8-0x0;var _0x11b625=_0xec98[_0x1731a8];return _0x11b625;};'use strict';var Sequelize=require(_0x8ec9('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x8ec9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8ec9('0x2')]},'disposition':{'type':Sequelize[_0x8ec9('0x3')]},'secondDisposition':{'type':Sequelize[_0x8ec9('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8ec9('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x8ec9('0x3')](0x1fe)},'to':{'type':Sequelize[_0x8ec9('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x8ec9('0x4'))},'subject':{'type':Sequelize[_0x8ec9('0x5')]()},'attach':{'type':Sequelize[_0x8ec9('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8ec9('0x2')]},'substatus':{'type':Sequelize[_0x8ec9('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8ec9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8ec9('0x7')]('in',_0x8ec9('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8ec9('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5759=['TEXT','ENUM','out','INTEGER','sequelize','BOOLEAN','DATE','STRING'];(function(_0x3d3e41,_0x225a72){var _0x1ad548=function(_0x3b5cde){while(--_0x3b5cde){_0x3d3e41['push'](_0x3d3e41['shift']());}};_0x1ad548(++_0x225a72);}(_0x5759,0x174));var _0x9575=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5759[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x9575('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x9575('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9575('0x2')]},'disposition':{'type':Sequelize[_0x9575('0x3')]},'secondDisposition':{'type':Sequelize[_0x9575('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9575('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x9575('0x3')](0x1fe)},'to':{'type':Sequelize[_0x9575('0x3')]},'cc':{'type':Sequelize[_0x9575('0x4')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x9575('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9575('0x2')]},'substatus':{'type':Sequelize[_0x9575('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9575('0x5')]('in',_0x9575('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9575('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9575('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9575('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9575('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 8b9fb5c..ad4710b 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 _0x437a=['rows','addTags','setTags','spread','Tag','color','emit','removeTags','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','createdAt','get','mkdirSync','each','from','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Bcc','push','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','update','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','then','catch','show','params','model','keys','query','filters','attributes','intersection','length','includeAll','include','options','create','body','find','destroy','describe','MailMessage','addMessage','ids','omit','getMessages','fields','nolimit','order','sort','where','pick','MailInteractionId','merge','filter','$gte','split','format','inlineCss','true'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x437a,0x113));var _0xa437=function(_0x4f1afe,_0x29a790){_0x4f1afe=_0x4f1afe-0x0;var _0x552767=_0x437a[_0x4f1afe];return _0x552767;};'use strict';var emlformat=require(_0xa437('0x0'));var rimraf=require(_0xa437('0x1'));var zipdir=require(_0xa437('0x2'));var moment=require(_0xa437('0x3'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xa437('0x4'));var fs=require('fs');var _=require(_0xa437('0x5'));var juice=require(_0xa437('0x6'));var Redis=require(_0xa437('0x7'));var interaction=require(_0xa437('0x8'));var qs=require(_0xa437('0x9'));var logger=require(_0xa437('0xa'))(_0xa437('0xb'));var config=require(_0xa437('0xc'));var db=require(_0xa437('0xd'))['db'];var htmlEntities=require(_0xa437('0xe'));config[_0xa437('0xf')]=_['defaults'](config['redis'],{'host':_0xa437('0x10'),'port':0x18eb});var socket=require(_0xa437('0x11'))(new Redis(config['redis']));require(_0xa437('0x12'))[_0xa437('0x13')](socket);function respondWithStatusCode(_0xd1f85c,_0x56e3cb){_0x56e3cb=_0x56e3cb||0xcc;return function(_0x2c8b82){if(_0x2c8b82){return _0xd1f85c[_0xa437('0x14')](_0x56e3cb);}return _0xd1f85c['status'](_0x56e3cb)['end']();};}function respondWithResult(_0x388bdb,_0xc17bb6){_0xc17bb6=_0xc17bb6||0xc8;return function(_0x3ae17b){if(_0x3ae17b){return _0x388bdb['status'](_0xc17bb6)[_0xa437('0x15')](_0x3ae17b);}};}function respondWithFilteredResult(_0x5f031d,_0x9d9549){return function(_0x496eeb){if(_0x496eeb){var _0x4175ab=typeof _0x9d9549[_0xa437('0x16')]===_0xa437('0x17')&&typeof _0x9d9549[_0xa437('0x18')]===_0xa437('0x17');var _0x562dfc=_0x496eeb[_0xa437('0x19')];var _0x3efc94=_0x4175ab?0x0:_0x9d9549[_0xa437('0x16')];var _0x3a047a=_0x4175ab?_0x496eeb[_0xa437('0x19')]:_0x9d9549['offset']+_0x9d9549[_0xa437('0x18')];var _0x3b6d46;if(_0x3a047a>=_0x562dfc){_0x3a047a=_0x562dfc;_0x3b6d46=0xc8;}else{_0x3b6d46=0xce;}_0x5f031d[_0xa437('0x1a')](_0x3b6d46);return _0x5f031d[_0xa437('0x1b')](_0xa437('0x1c'),_0x3efc94+'-'+_0x3a047a+'/'+_0x562dfc)[_0xa437('0x15')](_0x496eeb);}return null;};}function saveUpdates(_0x4e0470){return function(_0x57bb9b){if(_0x57bb9b){return _0x57bb9b[_0xa437('0x1d')](_0x4e0470)['then'](function(_0x451d4a){return _0x451d4a;});}return null;};}function removeEntity(_0x277465){return function(_0x4ee335){if(_0x4ee335){return _0x4ee335['destroy']()['then'](function(){_0x277465[_0xa437('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x116217){return function(_0x22b52b){if(!_0x22b52b){_0x116217['sendStatus'](0x194);}return _0x22b52b;};}function handleError(_0x33e1ee,_0x22f3ff){_0x22f3ff=_0x22f3ff||0x1f4;return function(_0x13b70a){logger[_0xa437('0x1e')](_0x13b70a[_0xa437('0x1f')]);if(_0x13b70a[_0xa437('0x20')]){delete _0x13b70a[_0xa437('0x20')];}_0x33e1ee[_0xa437('0x1a')](_0x22f3ff)[_0xa437('0x21')](_0x13b70a);};}exports[_0xa437('0x22')]=function(_0x423a00,_0x3b9481){var _0x1bf1e9={};var _0x45f3e2=_[_0xa437('0x23')](db[_0xa437('0x24')][_0xa437('0x25')],function(_0xcf945e){return{'name':_0xcf945e[_0xa437('0x26')],'type':_0xcf945e[_0xa437('0x27')][_0xa437('0x28')]};});_0x1bf1e9=qs[_0xa437('0x29')](_0x45f3e2,_0x423a00);return interaction[_0xa437('0x2a')](_0xa437('0x2b'),_0x423a00['query'],_0x423a00['user'],_0x1bf1e9,_0x45f3e2)[_0xa437('0x2c')](respondWithFilteredResult(_0x3b9481,_0x1bf1e9))[_0xa437('0x2d')](handleError(_0x3b9481,null));};exports[_0xa437('0x2e')]=function(_0x13127b,_0x2d7945){var _0x493d4e={'raw':![],'where':{'id':_0x13127b[_0xa437('0x2f')]['id']}},_0x195896={};_0x195896[_0xa437('0x30')]=_[_0xa437('0x31')](db[_0xa437('0x24')][_0xa437('0x25')]);_0x195896[_0xa437('0x32')]=_[_0xa437('0x31')](_0x13127b[_0xa437('0x32')]);_0x195896[_0xa437('0x33')]=_['intersection'](_0x195896[_0xa437('0x30')],_0x195896[_0xa437('0x32')]);_0x493d4e[_0xa437('0x34')]=_[_0xa437('0x35')](_0x195896[_0xa437('0x30')],qs['fields'](_0x13127b['query']['fields']));_0x493d4e['attributes']=_0x493d4e[_0xa437('0x34')][_0xa437('0x36')]?_0x493d4e['attributes']:_0x195896['model'];if(_0x13127b['query'][_0xa437('0x37')]){_0x493d4e[_0xa437('0x38')]=[{'all':!![]}];}_0x493d4e=_['merge']({},_0x493d4e,_0x13127b[_0xa437('0x39')]);return db[_0xa437('0x24')]['find'](_0x493d4e)[_0xa437('0x2c')](handleEntityNotFound(_0x2d7945,null))[_0xa437('0x2c')](respondWithResult(_0x2d7945,null))[_0xa437('0x2d')](handleError(_0x2d7945,null));};exports[_0xa437('0x3a')]=function(_0x364b86,_0xea17ca){return db[_0xa437('0x24')][_0xa437('0x3a')](_0x364b86[_0xa437('0x3b')],{})[_0xa437('0x2c')](respondWithResult(_0xea17ca,0xc9))['catch'](handleError(_0xea17ca,null));};exports[_0xa437('0x1d')]=function(_0x33082e,_0x303a47){if(_0x33082e[_0xa437('0x3b')]['id']){delete _0x33082e[_0xa437('0x3b')]['id'];}return db['MailInteraction'][_0xa437('0x3c')]({'where':{'id':_0x33082e[_0xa437('0x2f')]['id']}})[_0xa437('0x2c')](handleEntityNotFound(_0x303a47,null))[_0xa437('0x2c')](saveUpdates(_0x33082e[_0xa437('0x3b')],null))['then'](respondWithResult(_0x303a47,null))[_0xa437('0x2d')](handleError(_0x303a47,null));};exports[_0xa437('0x3d')]=function(_0x2257b8,_0xedfd2){return db[_0xa437('0x24')][_0xa437('0x3c')]({'where':{'id':_0x2257b8[_0xa437('0x2f')]['id']}})['then'](handleEntityNotFound(_0xedfd2,null))[_0xa437('0x2c')](removeEntity(_0xedfd2,null))[_0xa437('0x2d')](handleError(_0xedfd2,null));};exports['describe']=function(_0xa998e6,_0x250171){return db[_0xa437('0x24')][_0xa437('0x3e')]()[_0xa437('0x2c')](respondWithResult(_0x250171,null))[_0xa437('0x2d')](handleError(_0x250171,null));};exports['addMessage']=function(_0x15f114,_0x5c7ef0){return db[_0xa437('0x3f')][_0xa437('0x3c')]({'where':{'id':_0x15f114['params']['id']}})[_0xa437('0x2c')](handleEntityNotFound(_0x5c7ef0,null))[_0xa437('0x2c')](function(_0x4bb2e3){if(_0x4bb2e3){return _0x4bb2e3[_0xa437('0x40')](_0x15f114[_0xa437('0x3b')][_0xa437('0x41')],_[_0xa437('0x42')](_0x15f114[_0xa437('0x3b')],[_0xa437('0x41'),'id'])||{});}})[_0xa437('0x2c')](respondWithResult(_0x5c7ef0,null))[_0xa437('0x2d')](handleError(_0x5c7ef0,null));};exports[_0xa437('0x43')]=function(_0x2564fc,_0x3c19ff){var _0x80c015={'raw':![],'where':{}};var _0x2e6c92={};var _0x356842={'count':0x0,'rows':[]};return db[_0xa437('0x24')]['findOne']({'where':{'id':_0x2564fc[_0xa437('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3c19ff,null))['then'](function(_0x42dee8){if(_0x42dee8){_0x2e6c92['model']=_['keys'](db[_0xa437('0x3f')][_0xa437('0x25')]);_0x2e6c92['query']=_[_0xa437('0x31')](_0x2564fc[_0xa437('0x32')]);_0x2e6c92[_0xa437('0x33')]=_[_0xa437('0x35')](_0x2e6c92[_0xa437('0x30')],_0x2e6c92[_0xa437('0x32')]);_0x80c015['attributes']=_[_0xa437('0x35')](_0x2e6c92[_0xa437('0x30')],qs[_0xa437('0x44')](_0x2564fc[_0xa437('0x32')][_0xa437('0x44')]));_0x80c015['attributes']=_0x80c015[_0xa437('0x34')]['length']?_0x80c015[_0xa437('0x34')]:_0x2e6c92[_0xa437('0x30')];if(!_0x2564fc[_0xa437('0x32')]['hasOwnProperty'](_0xa437('0x45'))){_0x80c015[_0xa437('0x18')]=qs[_0xa437('0x18')](_0x2564fc[_0xa437('0x32')][_0xa437('0x18')]);_0x80c015[_0xa437('0x16')]=qs['offset'](_0x2564fc[_0xa437('0x32')][_0xa437('0x16')]);}_0x80c015[_0xa437('0x46')]=qs[_0xa437('0x47')](_0x2564fc[_0xa437('0x32')][_0xa437('0x47')]);_0x80c015[_0xa437('0x48')]=qs[_0xa437('0x33')](_[_0xa437('0x49')](_0x2564fc[_0xa437('0x32')],_0x2e6c92[_0xa437('0x33')]));_0x80c015['where'][_0xa437('0x4a')]=_0x42dee8['id'];if(_0x2564fc[_0xa437('0x32')]['filter']){_0x80c015['where']=_[_0xa437('0x4b')](_0x80c015[_0xa437('0x48')],{'$or':_[_0xa437('0x23')](_0x80c015[_0xa437('0x34')],function(_0x3df083){var _0xf1d9f4={};_0xf1d9f4[_0x3df083]={'$like':'%'+_0x2564fc[_0xa437('0x32')][_0xa437('0x4c')]+'%'};return _0xf1d9f4;})});}if(_0x2564fc['query'][_0xa437('0x4d')]){var _0x36e32e=_0x2564fc['query'][_0xa437('0x4d')][_0xa437('0x4e')](',');var _0x2772bd={};_0x2772bd[_0x36e32e[0x0]]={'$gte':moment(_0x36e32e[0x1])[_0xa437('0x4f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x80c015[_0xa437('0x48')]=_[_0xa437('0x4b')](_0x80c015[_0xa437('0x48')],_0x2772bd);}_0x80c015=_[_0xa437('0x4b')]({},_0x80c015,_0x2564fc['options']);return db[_0xa437('0x3f')][_0xa437('0x19')]({'where':_0x80c015[_0xa437('0x48')]})['then'](function(_0x5d653e){_0x356842[_0xa437('0x19')]=_0x5d653e;if(_0x2564fc[_0xa437('0x32')][_0xa437('0x37')]){_0x80c015['include']=[{'all':!![]}];}return db[_0xa437('0x3f')][_0xa437('0x2a')](_0x80c015);})[_0xa437('0x2c')](function(_0x358bf3){if(_0x2564fc[_0xa437('0x32')][_0xa437('0x50')]===_0xa437('0x51')){for(var _0x11273b=0x0;_0x11273b<_0x358bf3[_0xa437('0x36')];_0x11273b++){_0x358bf3[_0x11273b][_0xa437('0x3b')]=juice(_0x358bf3[_0x11273b][_0xa437('0x3b')]);}}_0x356842[_0xa437('0x52')]=_0x358bf3;return _0x356842;});}})['then'](respondWithFilteredResult(_0x3c19ff,_0x80c015))[_0xa437('0x2d')](handleError(_0x3c19ff,null));};exports[_0xa437('0x53')]=function(_0x4411e9,_0x1052c7){return db[_0xa437('0x24')][_0xa437('0x3c')]({'where':{'id':_0x4411e9[_0xa437('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1052c7,null))['then'](function(_0x2a69b6){if(_0x2a69b6){return _0x2a69b6[_0xa437('0x54')](_0x4411e9[_0xa437('0x3b')][_0xa437('0x41')],_[_0xa437('0x42')](_0x4411e9['body'],['ids','id'])||{})[_0xa437('0x55')](function(){return db[_0xa437('0x56')]['findAll']({'attributes':['id',_0xa437('0x20'),_0xa437('0x57')],'where':{'id':_0x4411e9[_0xa437('0x3b')][_0xa437('0x41')]}});})[_0xa437('0x2c')](function(_0x77dea1){socket[_0xa437('0x58')]('mailInteractionTags:save',{'id':Number(_0x4411e9[_0xa437('0x2f')]['id']),'tags':_0x77dea1||[]});return{'id':Number(_0x4411e9['params']['id']),'tags':_0x77dea1||[]};});}})[_0xa437('0x2c')](respondWithResult(_0x1052c7,null))[_0xa437('0x2d')](handleError(_0x1052c7,null));};exports[_0xa437('0x59')]=function(_0x2acd85,_0xfe68d1){return db['MailInteraction'][_0xa437('0x3c')]({'where':{'id':_0x2acd85['params']['id']}})[_0xa437('0x2c')](handleEntityNotFound(_0xfe68d1,null))[_0xa437('0x2c')](function(_0x3955fd){if(_0x3955fd){return _0x3955fd[_0xa437('0x59')](_0x2acd85['query'][_0xa437('0x41')]);}})[_0xa437('0x2c')](respondWithStatusCode(_0xfe68d1,null))[_0xa437('0x2d')](handleError(_0xfe68d1,null));};exports['download']=function(_0x3c0f26,_0x33b21f){var _0x321eec=moment()['unix']()['toString']();var _0x36f8d3=path[_0xa437('0x5a')](config[_0xa437('0x5b')],_0xa437('0x5c'),_0xa437('0x5d'),_0xa437('0x5e'));var _0x29d41c=path[_0xa437('0x5a')](config[_0xa437('0x5b')],_0xa437('0x5c'),'files',_0xa437('0x5f'));var _0x260040=path['join'](_0x36f8d3,_0x321eec);var _0x5c743d=util['format'](_0xa437('0x60'),_0x3c0f26['params']['id'],_0x321eec);var _0x27354d=path[_0xa437('0x5a')](_0x36f8d3,_0x5c743d);var _0x593b82=[];if(_0x3c0f26[_0xa437('0x32')][_0xa437('0x5f')]){_0x593b82['push']({'model':db[_0xa437('0x61')],'as':_0xa437('0x62'),'raw':!![]});}var _0x331d41=[{'model':db[_0xa437('0x3f')],'as':_0xa437('0x63'),'attributes':['id',_0xa437('0x3b'),'from','to','cc','bcc',_0xa437('0x64'),_0xa437('0x65')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x593b82}];return db[_0xa437('0x24')]['find']({'where':{'id':_0x3c0f26[_0xa437('0x2f')]['id']},'include':_0x331d41})[_0xa437('0x2c')](handleEntityNotFound(_0x33b21f,null))[_0xa437('0x2c')](function(_0x155677){if(_0x155677&&_0x155677[_0xa437('0x63')]){var _0x126c3b=_0x155677[_0xa437('0x66')]({'plain':!![]});fs[_0xa437('0x67')](_0x260040);return BPromise[_0xa437('0x68')](_0x126c3b[_0xa437('0x63')],function(_0x57962c,_0x45747b){var _0x34e9b3={'from':_0x57962c[_0xa437('0x69')],'to':_0x57962c['to']||_0xa437('0x6a'),'subject':_0x57962c[_0xa437('0x64')],'html':htmlEntities[_0xa437('0x6b')](_0x57962c[_0xa437('0x3b')]),'headers':{'Date':moment(_0x57962c[_0xa437('0x65')])[_0xa437('0x4f')](_0xa437('0x6c'))},'attachments':[]};if(_0x57962c['cc']){_0x34e9b3['headers']['Cc']=_0x57962c['cc'];}if(_0x57962c[_0xa437('0x6d')]){_0x34e9b3[_0xa437('0x6e')][_0xa437('0x6f')]=_0x57962c[_0xa437('0x6d')];}return new BPromise(function(_0xda0fbb,_0x22fd89){if(_0x57962c[_0xa437('0x62')]){for(var _0x5e2017=0x0;_0x5e2017<_0x57962c[_0xa437('0x62')][_0xa437('0x36')];_0x5e2017++){var _0x4dcd06=_0x57962c['Attachments'][_0x5e2017];var _0x34b59d=path[_0xa437('0x5a')](_0x29d41c,_0x4dcd06['basename']);if(fs['existsSync'](_0x34b59d)){_0x34e9b3[_0xa437('0x5f')][_0xa437('0x70')]({'name':_0x4dcd06[_0xa437('0x20')],'contentType':_0x4dcd06[_0xa437('0x27')],'data':fs[_0xa437('0x71')](_0x34b59d)});}}}emlformat[_0xa437('0x72')](_0x34e9b3,function(_0x1368c3,_0x2cc889){if(_0x1368c3)return _0x22fd89(_0x1368c3);fs[_0xa437('0x73')](path[_0xa437('0x5a')](_0x260040,util[_0xa437('0x4f')](_0xa437('0x74'),_0x45747b)),_0x2cc889);return _0xda0fbb(_0x2cc889);});});})[_0xa437('0x2c')](function(){return new BPromise(function(_0x9203bd,_0x3b6ef8){zipdir(_0x260040,{'saveTo':_0x27354d},function(_0x2f04b5,_0x20168f){if(_0x2f04b5)return _0x3b6ef8(_0x2f04b5);return _0x9203bd(_0x20168f);});})[_0xa437('0x2c')](function(){return new BPromise(function(_0x410baa,_0x391980){rimraf(_0x260040,function(_0x2dfa98){if(_0x2dfa98)_0x391980(_0x2dfa98);return _0x410baa();});});})['then'](function(){return _0x33b21f[_0xa437('0x75')](_0x27354d,_0x5c743d,function(_0x57fc8b){if(!_0x57fc8b)fs[_0xa437('0x76')](_0x27354d);});});});}else{return _0x33b21f['sendStatus'](0xc8);}})['catch'](handleError(_0x33b21f,null));}; \ No newline at end of file +var _0xb7b8=['toString','root','server','tmp','join','files','attachments','push','Attachment','Attachments','Messages','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','json','update','then','error','name','send','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','user','catch','show','params','model','query','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','destroy','describe','addMessage','MailMessage','ids','nolimit','sort','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','rows','addTags','setTags','omit','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix'];(function(_0x25fef3,_0x2238b0){var _0x5d9ea1=function(_0x1b469e){while(--_0x1b469e){_0x25fef3['push'](_0x25fef3['shift']());}};_0x5d9ea1(++_0x2238b0);}(_0xb7b8,0x8a));var _0x8b7b=function(_0x5dd434,_0x3ae8c9){_0x5dd434=_0x5dd434-0x0;var _0x3f5a7a=_0xb7b8[_0x5dd434];return _0x3f5a7a;};'use strict';var emlformat=require(_0x8b7b('0x0'));var rimraf=require(_0x8b7b('0x1'));var zipdir=require(_0x8b7b('0x2'));var moment=require(_0x8b7b('0x3'));var BPromise=require(_0x8b7b('0x4'));var util=require('util');var path=require(_0x8b7b('0x5'));var fs=require('fs');var _=require(_0x8b7b('0x6'));var juice=require(_0x8b7b('0x7'));var Redis=require(_0x8b7b('0x8'));var interaction=require(_0x8b7b('0x9'));var qs=require(_0x8b7b('0xa'));var logger=require(_0x8b7b('0xb'))('api');var config=require(_0x8b7b('0xc'));var db=require(_0x8b7b('0xd'))['db'];var htmlEntities=require(_0x8b7b('0xe'));config[_0x8b7b('0xf')]=_[_0x8b7b('0x10')](config[_0x8b7b('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b7b('0xf')]));require(_0x8b7b('0x11'))[_0x8b7b('0x12')](socket);function respondWithStatusCode(_0x428d9d,_0xe59f71){_0xe59f71=_0xe59f71||0xcc;return function(_0x26830a){if(_0x26830a){return _0x428d9d[_0x8b7b('0x13')](_0xe59f71);}return _0x428d9d[_0x8b7b('0x14')](_0xe59f71)[_0x8b7b('0x15')]();};}function respondWithResult(_0x4e3e18,_0x2aec62){_0x2aec62=_0x2aec62||0xc8;return function(_0x85b8f){if(_0x85b8f){return _0x4e3e18[_0x8b7b('0x14')](_0x2aec62)['json'](_0x85b8f);}};}function respondWithFilteredResult(_0x2adfec,_0x320e83){return function(_0x3436f8){if(_0x3436f8){var _0xe277fa=typeof _0x320e83[_0x8b7b('0x16')]===_0x8b7b('0x17')&&typeof _0x320e83[_0x8b7b('0x18')]===_0x8b7b('0x17');var _0x2220ff=_0x3436f8[_0x8b7b('0x19')];var _0x6b7b87=_0xe277fa?0x0:_0x320e83[_0x8b7b('0x16')];var _0x7e3e83=_0xe277fa?_0x3436f8[_0x8b7b('0x19')]:_0x320e83['offset']+_0x320e83[_0x8b7b('0x18')];var _0xd87412;if(_0x7e3e83>=_0x2220ff){_0x7e3e83=_0x2220ff;_0xd87412=0xc8;}else{_0xd87412=0xce;}_0x2adfec[_0x8b7b('0x14')](_0xd87412);return _0x2adfec['set']('Content-Range',_0x6b7b87+'-'+_0x7e3e83+'/'+_0x2220ff)[_0x8b7b('0x1a')](_0x3436f8);}return null;};}function saveUpdates(_0x44584b){return function(_0x45d416){if(_0x45d416){return _0x45d416[_0x8b7b('0x1b')](_0x44584b)[_0x8b7b('0x1c')](function(_0x59620d){return _0x59620d;});}return null;};}function removeEntity(_0x4b7247){return function(_0x157e12){if(_0x157e12){return _0x157e12['destroy']()[_0x8b7b('0x1c')](function(){_0x4b7247[_0x8b7b('0x14')](0xcc)[_0x8b7b('0x15')]();});}};}function handleEntityNotFound(_0x48461e){return function(_0x1cbc5e){if(!_0x1cbc5e){_0x48461e['sendStatus'](0x194);}return _0x1cbc5e;};}function handleError(_0x32c150,_0x2ccf24){_0x2ccf24=_0x2ccf24||0x1f4;return function(_0x40dc80){logger[_0x8b7b('0x1d')](_0x40dc80['stack']);if(_0x40dc80[_0x8b7b('0x1e')]){delete _0x40dc80[_0x8b7b('0x1e')];}_0x32c150[_0x8b7b('0x14')](_0x2ccf24)[_0x8b7b('0x1f')](_0x40dc80);};}exports['index']=function(_0x2bedf7,_0x5c93f6){var _0x3f896b={};var _0x27ea7d=_[_0x8b7b('0x20')](db[_0x8b7b('0x21')][_0x8b7b('0x22')],function(_0x56a037){return{'name':_0x56a037[_0x8b7b('0x23')],'type':_0x56a037[_0x8b7b('0x24')][_0x8b7b('0x25')]};});_0x3f896b=qs['getOptions'](_0x27ea7d,_0x2bedf7);return interaction[_0x8b7b('0x26')](_0x8b7b('0x27'),_0x2bedf7['query'],_0x2bedf7[_0x8b7b('0x28')],_0x3f896b,_0x27ea7d)[_0x8b7b('0x1c')](respondWithFilteredResult(_0x5c93f6,_0x3f896b))[_0x8b7b('0x29')](handleError(_0x5c93f6,null));};exports[_0x8b7b('0x2a')]=function(_0xb169ac,_0x2b90f8){var _0x3d7dc7={'raw':![],'where':{'id':_0xb169ac[_0x8b7b('0x2b')]['id']}},_0x75c6db={};_0x75c6db[_0x8b7b('0x2c')]=_['keys'](db[_0x8b7b('0x21')]['rawAttributes']);_0x75c6db[_0x8b7b('0x2d')]=_[_0x8b7b('0x2e')](_0xb169ac['query']);_0x75c6db[_0x8b7b('0x2f')]=_[_0x8b7b('0x30')](_0x75c6db[_0x8b7b('0x2c')],_0x75c6db['query']);_0x3d7dc7[_0x8b7b('0x31')]=_[_0x8b7b('0x30')](_0x75c6db[_0x8b7b('0x2c')],qs[_0x8b7b('0x32')](_0xb169ac[_0x8b7b('0x2d')][_0x8b7b('0x32')]));_0x3d7dc7[_0x8b7b('0x31')]=_0x3d7dc7['attributes'][_0x8b7b('0x33')]?_0x3d7dc7[_0x8b7b('0x31')]:_0x75c6db['model'];if(_0xb169ac[_0x8b7b('0x2d')][_0x8b7b('0x34')]){_0x3d7dc7['include']=[{'all':!![]}];}_0x3d7dc7=_[_0x8b7b('0x35')]({},_0x3d7dc7,_0xb169ac[_0x8b7b('0x36')]);return db[_0x8b7b('0x21')][_0x8b7b('0x37')](_0x3d7dc7)[_0x8b7b('0x1c')](handleEntityNotFound(_0x2b90f8,null))[_0x8b7b('0x1c')](respondWithResult(_0x2b90f8,null))[_0x8b7b('0x29')](handleError(_0x2b90f8,null));};exports[_0x8b7b('0x38')]=function(_0x346f9a,_0x35a0ca){return db[_0x8b7b('0x21')][_0x8b7b('0x38')](_0x346f9a['body'],{})[_0x8b7b('0x1c')](respondWithResult(_0x35a0ca,0xc9))[_0x8b7b('0x29')](handleError(_0x35a0ca,null));};exports[_0x8b7b('0x1b')]=function(_0x5456b9,_0x3f0157){if(_0x5456b9[_0x8b7b('0x39')]['id']){delete _0x5456b9[_0x8b7b('0x39')]['id'];}return db[_0x8b7b('0x21')]['find']({'where':{'id':_0x5456b9[_0x8b7b('0x2b')]['id']}})[_0x8b7b('0x1c')](handleEntityNotFound(_0x3f0157,null))[_0x8b7b('0x1c')](saveUpdates(_0x5456b9[_0x8b7b('0x39')],null))['then'](respondWithResult(_0x3f0157,null))[_0x8b7b('0x29')](handleError(_0x3f0157,null));};exports[_0x8b7b('0x3a')]=function(_0x4e1de7,_0xa9ab2a){return db['MailInteraction'][_0x8b7b('0x37')]({'where':{'id':_0x4e1de7[_0x8b7b('0x2b')]['id']}})[_0x8b7b('0x1c')](handleEntityNotFound(_0xa9ab2a,null))[_0x8b7b('0x1c')](removeEntity(_0xa9ab2a,null))[_0x8b7b('0x29')](handleError(_0xa9ab2a,null));};exports[_0x8b7b('0x3b')]=function(_0x8e7fe7,_0xb8cc30){return db[_0x8b7b('0x21')][_0x8b7b('0x3b')]()[_0x8b7b('0x1c')](respondWithResult(_0xb8cc30,null))[_0x8b7b('0x29')](handleError(_0xb8cc30,null));};exports[_0x8b7b('0x3c')]=function(_0x56220f,_0x13cbbd){return db[_0x8b7b('0x3d')][_0x8b7b('0x37')]({'where':{'id':_0x56220f['params']['id']}})['then'](handleEntityNotFound(_0x13cbbd,null))['then'](function(_0x1eeaae){if(_0x1eeaae){return _0x1eeaae[_0x8b7b('0x3c')](_0x56220f[_0x8b7b('0x39')][_0x8b7b('0x3e')],_['omit'](_0x56220f[_0x8b7b('0x39')],[_0x8b7b('0x3e'),'id'])||{});}})[_0x8b7b('0x1c')](respondWithResult(_0x13cbbd,null))['catch'](handleError(_0x13cbbd,null));};exports['getMessages']=function(_0x38203c,_0x248883){var _0x9c12dc={'raw':![],'where':{}};var _0x53b930={};var _0x45ac88={'count':0x0,'rows':[]};return db[_0x8b7b('0x21')]['findOne']({'where':{'id':_0x38203c[_0x8b7b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x248883,null))[_0x8b7b('0x1c')](function(_0x3993cf){if(_0x3993cf){_0x53b930['model']=_['keys'](db[_0x8b7b('0x3d')][_0x8b7b('0x22')]);_0x53b930['query']=_[_0x8b7b('0x2e')](_0x38203c[_0x8b7b('0x2d')]);_0x53b930[_0x8b7b('0x2f')]=_[_0x8b7b('0x30')](_0x53b930[_0x8b7b('0x2c')],_0x53b930[_0x8b7b('0x2d')]);_0x9c12dc[_0x8b7b('0x31')]=_['intersection'](_0x53b930[_0x8b7b('0x2c')],qs[_0x8b7b('0x32')](_0x38203c[_0x8b7b('0x2d')]['fields']));_0x9c12dc['attributes']=_0x9c12dc[_0x8b7b('0x31')][_0x8b7b('0x33')]?_0x9c12dc['attributes']:_0x53b930[_0x8b7b('0x2c')];if(!_0x38203c['query']['hasOwnProperty'](_0x8b7b('0x3f'))){_0x9c12dc['limit']=qs[_0x8b7b('0x18')](_0x38203c['query'][_0x8b7b('0x18')]);_0x9c12dc['offset']=qs['offset'](_0x38203c[_0x8b7b('0x2d')][_0x8b7b('0x16')]);}_0x9c12dc['order']=qs[_0x8b7b('0x40')](_0x38203c[_0x8b7b('0x2d')]['sort']);_0x9c12dc[_0x8b7b('0x41')]=qs[_0x8b7b('0x2f')](_['pick'](_0x38203c[_0x8b7b('0x2d')],_0x53b930[_0x8b7b('0x2f')]));_0x9c12dc['where'][_0x8b7b('0x42')]=_0x3993cf['id'];if(_0x38203c[_0x8b7b('0x2d')][_0x8b7b('0x43')]){_0x9c12dc['where']=_[_0x8b7b('0x35')](_0x9c12dc[_0x8b7b('0x41')],{'$or':_[_0x8b7b('0x20')](_0x9c12dc[_0x8b7b('0x31')],function(_0x33888f){var _0x18bc3e={};_0x18bc3e[_0x33888f]={'$like':'%'+_0x38203c[_0x8b7b('0x2d')][_0x8b7b('0x43')]+'%'};return _0x18bc3e;})});}if(_0x38203c['query']['$gte']){var _0x2cc4ef=_0x38203c[_0x8b7b('0x2d')][_0x8b7b('0x44')][_0x8b7b('0x45')](',');var _0x222020={};_0x222020[_0x2cc4ef[0x0]]={'$gte':moment(_0x2cc4ef[0x1])[_0x8b7b('0x46')](_0x8b7b('0x47'))};_0x9c12dc['where']=_[_0x8b7b('0x35')](_0x9c12dc[_0x8b7b('0x41')],_0x222020);}_0x9c12dc=_['merge']({},_0x9c12dc,_0x38203c[_0x8b7b('0x36')]);return db['MailMessage'][_0x8b7b('0x19')]({'where':_0x9c12dc[_0x8b7b('0x41')]})[_0x8b7b('0x1c')](function(_0x3dea34){_0x45ac88[_0x8b7b('0x19')]=_0x3dea34;if(_0x38203c[_0x8b7b('0x2d')][_0x8b7b('0x34')]){_0x9c12dc[_0x8b7b('0x48')]=[{'all':!![]}];}return db[_0x8b7b('0x3d')][_0x8b7b('0x26')](_0x9c12dc);})['then'](function(_0x5dcbd7){if(_0x38203c['query'][_0x8b7b('0x49')]==='true'){for(var _0x7d29d=0x0;_0x7d29d<_0x5dcbd7[_0x8b7b('0x33')];_0x7d29d++){_0x5dcbd7[_0x7d29d][_0x8b7b('0x39')]=juice(_0x5dcbd7[_0x7d29d]['body']);}}_0x45ac88[_0x8b7b('0x4a')]=_0x5dcbd7;return _0x45ac88;});}})[_0x8b7b('0x1c')](respondWithFilteredResult(_0x248883,_0x9c12dc))[_0x8b7b('0x29')](handleError(_0x248883,null));};exports[_0x8b7b('0x4b')]=function(_0xaa993f,_0x4d4fba){return db['MailInteraction'][_0x8b7b('0x37')]({'where':{'id':_0xaa993f['params']['id']}})[_0x8b7b('0x1c')](handleEntityNotFound(_0x4d4fba,null))[_0x8b7b('0x1c')](function(_0x3bb419){if(_0x3bb419){return _0x3bb419[_0x8b7b('0x4c')](_0xaa993f[_0x8b7b('0x39')][_0x8b7b('0x3e')],_[_0x8b7b('0x4d')](_0xaa993f[_0x8b7b('0x39')],[_0x8b7b('0x3e'),'id'])||{})[_0x8b7b('0x4e')](function(){return db[_0x8b7b('0x4f')]['findAll']({'attributes':['id','name',_0x8b7b('0x50')],'where':{'id':_0xaa993f['body']['ids']}});})[_0x8b7b('0x1c')](function(_0xdab480){socket[_0x8b7b('0x51')](_0x8b7b('0x52'),{'id':Number(_0xaa993f[_0x8b7b('0x2b')]['id']),'tags':_0xdab480||[]});return{'id':Number(_0xaa993f[_0x8b7b('0x2b')]['id']),'tags':_0xdab480||[]};});}})[_0x8b7b('0x1c')](respondWithResult(_0x4d4fba,null))['catch'](handleError(_0x4d4fba,null));};exports['removeTags']=function(_0x12135c,_0x2ff25b){return db[_0x8b7b('0x21')][_0x8b7b('0x37')]({'where':{'id':_0x12135c[_0x8b7b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2ff25b,null))[_0x8b7b('0x1c')](function(_0x5e0fee){if(_0x5e0fee){return _0x5e0fee[_0x8b7b('0x53')](_0x12135c[_0x8b7b('0x2d')][_0x8b7b('0x3e')]);}})[_0x8b7b('0x1c')](respondWithStatusCode(_0x2ff25b,null))[_0x8b7b('0x29')](handleError(_0x2ff25b,null));};exports[_0x8b7b('0x54')]=function(_0x36980f,_0x331812){var _0x3c0f6f=moment()[_0x8b7b('0x55')]()[_0x8b7b('0x56')]();var _0x5e1dac=path['join'](config[_0x8b7b('0x57')],_0x8b7b('0x58'),'files',_0x8b7b('0x59'));var _0x4879e7=path[_0x8b7b('0x5a')](config[_0x8b7b('0x57')],_0x8b7b('0x58'),_0x8b7b('0x5b'),_0x8b7b('0x5c'));var _0x24d517=path[_0x8b7b('0x5a')](_0x5e1dac,_0x3c0f6f);var _0x2197b4=util[_0x8b7b('0x46')]('transcript-%d-%s.zip',_0x36980f[_0x8b7b('0x2b')]['id'],_0x3c0f6f);var _0x42734b=path[_0x8b7b('0x5a')](_0x5e1dac,_0x2197b4);var _0x14cd36=[];if(_0x36980f[_0x8b7b('0x2d')][_0x8b7b('0x5c')]){_0x14cd36[_0x8b7b('0x5d')]({'model':db[_0x8b7b('0x5e')],'as':_0x8b7b('0x5f'),'raw':!![]});}var _0x55bc58=[{'model':db[_0x8b7b('0x3d')],'as':_0x8b7b('0x60'),'attributes':['id',_0x8b7b('0x39'),'from','to','cc','bcc',_0x8b7b('0x61'),_0x8b7b('0x62')],'where':{'secret':![]},'order':qs[_0x8b7b('0x40')]('id'),'include':_0x14cd36}];return db[_0x8b7b('0x21')][_0x8b7b('0x37')]({'where':{'id':_0x36980f[_0x8b7b('0x2b')]['id']},'include':_0x55bc58})[_0x8b7b('0x1c')](handleEntityNotFound(_0x331812,null))[_0x8b7b('0x1c')](function(_0x42c53b){if(_0x42c53b&&_0x42c53b[_0x8b7b('0x60')]){var _0x2bed85=_0x42c53b[_0x8b7b('0x63')]({'plain':!![]});fs[_0x8b7b('0x64')](_0x24d517);return BPromise[_0x8b7b('0x65')](_0x2bed85['Messages'],function(_0x986fb8,_0x22880e){var _0x30756b={'from':_0x986fb8['from'],'to':_0x986fb8['to']||_0x8b7b('0x66'),'subject':_0x986fb8['subject'],'html':htmlEntities['decode'](_0x986fb8['body']),'headers':{'Date':moment(_0x986fb8[_0x8b7b('0x62')])[_0x8b7b('0x46')](_0x8b7b('0x67'))},'attachments':[]};if(_0x986fb8['cc']){_0x30756b[_0x8b7b('0x68')]['Cc']=_0x986fb8['cc'];}if(_0x986fb8[_0x8b7b('0x69')]){_0x30756b[_0x8b7b('0x68')]['Bcc']=_0x986fb8['bcc'];}return new BPromise(function(_0x34d037,_0x1d1785){if(_0x986fb8[_0x8b7b('0x5f')]){for(var _0x22d932=0x0;_0x22d932<_0x986fb8[_0x8b7b('0x5f')][_0x8b7b('0x33')];_0x22d932++){var _0x1a7204=_0x986fb8['Attachments'][_0x22d932];var _0x40ca8d=path[_0x8b7b('0x5a')](_0x4879e7,_0x1a7204[_0x8b7b('0x6a')]);if(fs[_0x8b7b('0x6b')](_0x40ca8d)){_0x30756b[_0x8b7b('0x5c')]['push']({'name':_0x1a7204[_0x8b7b('0x1e')],'contentType':_0x1a7204[_0x8b7b('0x24')],'data':fs[_0x8b7b('0x6c')](_0x40ca8d)});}}}emlformat[_0x8b7b('0x6d')](_0x30756b,function(_0x1a2275,_0x3ba2ed){if(_0x1a2275)return _0x1d1785(_0x1a2275);fs[_0x8b7b('0x6e')](path[_0x8b7b('0x5a')](_0x24d517,util[_0x8b7b('0x46')](_0x8b7b('0x6f'),_0x22880e)),_0x3ba2ed);return _0x34d037(_0x3ba2ed);});});})[_0x8b7b('0x1c')](function(){return new BPromise(function(_0x5ea4e2,_0x46c51c){zipdir(_0x24d517,{'saveTo':_0x42734b},function(_0x291ddd,_0x32ca54){if(_0x291ddd)return _0x46c51c(_0x291ddd);return _0x5ea4e2(_0x32ca54);});})[_0x8b7b('0x1c')](function(){return new BPromise(function(_0x3eb72c,_0x40b849){rimraf(_0x24d517,function(_0x13dee4){if(_0x13dee4)_0x40b849(_0x13dee4);return _0x3eb72c();});});})[_0x8b7b('0x1c')](function(){return _0x331812[_0x8b7b('0x54')](_0x42734b,_0x2197b4,function(_0x7b8640){if(!_0x7b8640)fs['unlinkSync'](_0x42734b);});});});}else{return _0x331812[_0x8b7b('0x13')](0xc8);}})[_0x8b7b('0x29')](handleError(_0x331812,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index cf37083..c1a4f15 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 _0x4e5b=['findAll','unreadMessages','emit','catch','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','remove','then','setDataValue','Users','map'];(function(_0x14f56d,_0x40e5a0){var _0x537dde=function(_0x35dc0d){while(--_0x35dc0d){_0x14f56d['push'](_0x14f56d['shift']());}};_0x537dde(++_0x40e5a0);}(_0x4e5b,0x17c));var _0xb4e5=function(_0x11e48c,_0x296bde){_0x11e48c=_0x11e48c-0x0;var _0x2b6bb9=_0x4e5b[_0x11e48c];return _0x2b6bb9;};'use strict';var EventEmitter=require(_0xb4e5('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xb4e5('0x1')];var MailMessage=require(_0xb4e5('0x2'))['db'][_0xb4e5('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xb4e5('0x4')](0x0);var events={'afterCreate':_0xb4e5('0x5'),'afterUpdate':'update','afterDestroy':_0xb4e5('0x6')};function emitEvent(_0x441373){return function(_0x39815f,_0x4b3f9c,_0x4023c5){_0x39815f['getUsers']({'attributes':['id'],'raw':!![]})[_0xb4e5('0x7')](function(_0x953539){_0x39815f[_0xb4e5('0x8')](_0xb4e5('0x9'),_0x953539[_0xb4e5('0xa')](function(_0x40a23d){return{'id':_0x40a23d['id']};}));return MailMessage[_0xb4e5('0xb')]({'where':{'MailInteractionId':_0x39815f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb4e5('0x7')](function(_0x414776){_0x39815f['setDataValue'](_0xb4e5('0xc'),_0x414776['length']);MailInteractionEvents[_0xb4e5('0xd')](_0x441373+':'+_0x39815f['id'],_0x39815f);MailInteractionEvents[_0xb4e5('0xd')](_0x441373,_0x39815f);_0x4023c5(null);})[_0xb4e5('0xe')](_0x4023c5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xb4e5('0xf')](e,emitEvent(event));}}module[_0xb4e5('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x255d=['update','remove','getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x4ecedb,_0x2dffa3){var _0x3544cc=function(_0x107383){while(--_0x107383){_0x4ecedb['push'](_0x4ecedb['shift']());}};_0x3544cc(++_0x2dffa3);}(_0x255d,0xc1));var _0xd255=function(_0xd67296,_0x2cbbc9){_0xd67296=_0xd67296-0x0;var _0x45cd4e=_0x255d[_0xd67296];return _0x45cd4e;};'use strict';var EventEmitter=require(_0xd255('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xd255('0x1')];var MailMessage=require(_0xd255('0x2'))['db'][_0xd255('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd255('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd255('0x5'),'afterDestroy':_0xd255('0x6')};function emitEvent(_0x419f45){return function(_0x39548b,_0x176c51,_0x20c5bb){_0x39548b[_0xd255('0x7')]({'attributes':['id'],'raw':!![]})[_0xd255('0x8')](function(_0xf3facd){_0x39548b[_0xd255('0x9')](_0xd255('0xa'),_0xf3facd['map'](function(_0x2c7ba2){return{'id':_0x2c7ba2['id']};}));return MailMessage[_0xd255('0xb')]({'where':{'MailInteractionId':_0x39548b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd255('0x8')](function(_0x2635a2){_0x39548b[_0xd255('0x9')]('unreadMessages',_0x2635a2[_0xd255('0xc')]);MailInteractionEvents['emit'](_0x419f45+':'+_0x39548b['id'],_0x39548b);MailInteractionEvents[_0xd255('0xd')](_0x419f45,_0x39548b);_0x20c5bb(null);})[_0xd255('0xe')](_0x20c5bb(null));};}for(var e in events){if(events[_0xd255('0xf')](e)){var event=events[e];MailInteraction[_0xd255('0x10')](e,emitEvent(event));}}module[_0xd255('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index f8ba11d..ac07a8e 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 _0x2cfb=['changed','closedAt','models','MailMessage','update','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','format'];(function(_0x57ac3b,_0x32e884){var _0x4204c9=function(_0x54a70e){while(--_0x54a70e){_0x57ac3b['push'](_0x57ac3b['shift']());}};_0x4204c9(++_0x32e884);}(_0x2cfb,0x156));var _0xb2cf=function(_0xa016f6,_0x3a8863){_0xa016f6=_0xa016f6-0x0;var _0x313949=_0x2cfb[_0xa016f6];return _0x313949;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb2cf('0x0'))(_0xb2cf('0x1'));var moment=require(_0xb2cf('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2cf('0x3'));var rimraf=require(_0xb2cf('0x4'));var config=require(_0xb2cf('0x5'));var attributes=require('./mailInteraction.attributes');module[_0xb2cf('0x6')]=function(_0x461c5b,_0x36e1a1){return _0x461c5b[_0xb2cf('0x7')](_0xb2cf('0x8'),attributes,{'tableName':_0xb2cf('0x9'),'paranoid':![],'indexes':[{'name':_0xb2cf('0xa'),'fields':[_0xb2cf('0xb'),'to'],'type':_0xb2cf('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4be14a,_0x14c685,_0x4e3b3b){if(_0x4be14a[_0xb2cf('0xd')]){_0x4be14a[_0xb2cf('0xe')]=moment()['format'](_0xb2cf('0xf'));}if(_0x4be14a[_0xb2cf('0x10')]){_0x4be14a['closedAt']=moment()[_0xb2cf('0x11')](_0xb2cf('0xf'));}_0x4e3b3b(null,_0x14c685);},'beforeUpdate':function(_0x114974,_0x37c2df,_0x3c40f1){if(_0x114974['changed'](_0xb2cf('0xd'))){_0x114974[_0xb2cf('0xe')]=_0x114974[_0xb2cf('0xd')]?moment()['format'](_0xb2cf('0xf')):null;}if(_0x114974[_0xb2cf('0x12')](_0xb2cf('0x10'))){_0x114974[_0xb2cf('0x13')]=moment()[_0xb2cf('0x11')](_0xb2cf('0xf'));_0x114974['substatus']=null;_0x114974[_0xb2cf('0xe')]=null;}_0x3c40f1(null,_0x114974);},'afterUpdate':function(_0x50859f,_0x36ea68,_0x57477b){var _0x311dfa=_0x461c5b[_0xb2cf('0x14')];var _0x33020f=_0x50859f['get']({'plain':!![]});if(_0x33020f['closed']){return _0x311dfa[_0xb2cf('0x15')][_0xb2cf('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x33020f['id']}})['then'](function(){_0x57477b();})['catch'](function(_0x96f783){_0x57477b(_0x96f783);});}else{_0x57477b();}}},'charset':'utf8mb4','collate':_0xb2cf('0x17')});}; \ No newline at end of file +var _0x000d=['closed','closedAt','models','get','MailMessage','update','catch','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','MailInteraction','mail_interactions','FULLTEXT','substatus','substatusAt','format','changed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x000d,0xc8));var _0xd000=function(_0x53a696,_0x580053){_0x53a696=_0x53a696-0x0;var _0x81db7a=_0x000d[_0x53a696];return _0x81db7a;};'use strict';var _=require(_0xd000('0x0'));var util=require('util');var logger=require(_0xd000('0x1'))(_0xd000('0x2'));var moment=require('moment');var BPromise=require(_0xd000('0x3'));var rp=require(_0xd000('0x4'));var fs=require('fs');var path=require(_0xd000('0x5'));var rimraf=require(_0xd000('0x6'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0xd000('0x7')]=function(_0x1eed34,_0x4b0984){return _0x1eed34['define'](_0xd000('0x8'),attributes,{'tableName':_0xd000('0x9'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0xd000('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53d8e2,_0x5b9048,_0x4d72d9){if(_0x53d8e2[_0xd000('0xb')]){_0x53d8e2[_0xd000('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x53d8e2['closed']){_0x53d8e2['closedAt']=moment()[_0xd000('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4d72d9(null,_0x5b9048);},'beforeUpdate':function(_0x5c224c,_0x1fb984,_0x3980cc){if(_0x5c224c[_0xd000('0xe')]('substatus')){_0x5c224c[_0xd000('0xc')]=_0x5c224c[_0xd000('0xb')]?moment()[_0xd000('0xd')](_0xd000('0xf')):null;}if(_0x5c224c[_0xd000('0xe')](_0xd000('0x10'))){_0x5c224c[_0xd000('0x11')]=moment()[_0xd000('0xd')](_0xd000('0xf'));_0x5c224c['substatus']=null;_0x5c224c['substatusAt']=null;}_0x3980cc(null,_0x5c224c);},'afterUpdate':function(_0x558091,_0x2b5abb,_0x59d2e5){var _0xf46db6=_0x1eed34[_0xd000('0x12')];var _0x46cc9e=_0x558091[_0xd000('0x13')]({'plain':!![]});if(_0x46cc9e['closed']){return _0xf46db6[_0xd000('0x14')][_0xd000('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x46cc9e['id']}})['then'](function(){_0x59d2e5();})[_0xd000('0x16')](function(_0x2eacc1){_0x59d2e5(_0x2eacc1);});}else{_0x59d2e5();}}},'charset':_0xd000('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 9160a36..4eefd58 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 _0x0b68=['UpdateMailInteraction','MailInteraction','update','body','options','limit','debug','AddTagsToMailInteraction','find','where','addTags','ids','AddTags','stringify','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','error','code','MailInteraction,\x20%s,\x20%s','message','catch'];(function(_0x49d947,_0x30190e){var _0x17abdf=function(_0x445d19){while(--_0x445d19){_0x49d947['push'](_0x49d947['shift']());}};_0x17abdf(++_0x30190e);}(_0x0b68,0xa2));var _0x80b6=function(_0x1186d6,_0x1f1401){_0x1186d6=_0x1186d6-0x0;var _0x3d0ff6=_0x0b68[_0x1186d6];return _0x3d0ff6;};'use strict';var _=require(_0x80b6('0x0'));var util=require(_0x80b6('0x1'));var moment=require(_0x80b6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80b6('0x3'))['db'];var utils=require(_0x80b6('0x4'));var logger=require('../../config/logger')(_0x80b6('0x5'));var config=require(_0x80b6('0x6'));var jayson=require(_0x80b6('0x7'));var client=jayson['client'][_0x80b6('0x8')]({'port':0x232a});config[_0x80b6('0x9')]=_['defaults'](config[_0x80b6('0x9')],{'host':_0x80b6('0xa'),'port':0x18eb});var socket=require(_0x80b6('0xb'))(new Redis(config[_0x80b6('0x9')]));require(_0x80b6('0xc'))[_0x80b6('0xd')](socket);function respondWithRpcPromise(_0x42b054,_0x44c8bf,_0x25b392){return new BPromise(function(_0x3c9e9c,_0x5232fc){return client[_0x80b6('0xe')](_0x42b054,_0x25b392)[_0x80b6('0xf')](function(_0x117f67){logger[_0x80b6('0x10')]('MailInteraction,\x20%s,\x20%s',_0x44c8bf,_0x80b6('0x11'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x44c8bf,'request\x20sent',JSON['stringify'](_0x117f67));if(_0x117f67[_0x80b6('0x12')]){if(_0x117f67[_0x80b6('0x12')][_0x80b6('0x13')]===0x1f4){logger[_0x80b6('0x12')](_0x80b6('0x14'),_0x44c8bf,_0x117f67[_0x80b6('0x12')][_0x80b6('0x15')]);return _0x5232fc(_0x117f67['error'][_0x80b6('0x15')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x44c8bf,_0x117f67['error']['message']);return _0x3c9e9c(_0x117f67[_0x80b6('0x12')][_0x80b6('0x15')]);}else{logger[_0x80b6('0x10')]('MailInteraction,\x20%s,\x20%s',_0x44c8bf,_0x80b6('0x11'));_0x3c9e9c(_0x117f67['result']['message']);}})[_0x80b6('0x16')](function(_0x1b3613){logger[_0x80b6('0x12')](_0x80b6('0x14'),_0x44c8bf,_0x1b3613);_0x5232fc(_0x1b3613);});});}exports[_0x80b6('0x17')]=function(_0x56c14d){var _0x527aa2=this;return new Promise(function(_0x5794fd,_0x97be12){return db[_0x80b6('0x18')][_0x80b6('0x19')](_0x56c14d[_0x80b6('0x1a')],{'raw':_0x56c14d[_0x80b6('0x1b')]?_0x56c14d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56c14d[_0x80b6('0x1b')]?_0x56c14d[_0x80b6('0x1b')]['where']||null:null,'attributes':_0x56c14d['options']?_0x56c14d['options']['attributes']||null:null,'limit':_0x56c14d[_0x80b6('0x1b')]?_0x56c14d[_0x80b6('0x1b')][_0x80b6('0x1c')]||null:null})[_0x80b6('0xf')](function(_0x2faf74){logger['info'](_0x80b6('0x17'),_0x56c14d);logger[_0x80b6('0x1d')](_0x80b6('0x17'),_0x56c14d,JSON['stringify'](_0x2faf74));_0x5794fd(_0x2faf74);})[_0x80b6('0x16')](function(_0x5a6ded){logger['error']('UpdateMailInteraction',_0x5a6ded[_0x80b6('0x15')],_0x56c14d);_0x97be12(_0x527aa2[_0x80b6('0x12')](0x1f4,_0x5a6ded['message']));});});};exports[_0x80b6('0x1e')]=function(_0x402c22){return new Promise(function(_0x3f6bf4,_0xb348c4){return db['MailInteraction'][_0x80b6('0x1f')]({'where':_0x402c22[_0x80b6('0x1b')]?_0x402c22[_0x80b6('0x1b')][_0x80b6('0x20')]||null:null})[_0x80b6('0xf')](function(_0x2bbb26){if(_0x2bbb26){return _0x2bbb26[_0x80b6('0x21')](_0x402c22[_0x80b6('0x1a')][_0x80b6('0x22')],_['omit'](_0x402c22[_0x80b6('0x1a')],[_0x80b6('0x22'),'id'])||{});}})['spread'](function(_0x31c95e){logger['info'](_0x80b6('0x23'),_0x402c22);logger['debug'](_0x80b6('0x23'),_0x402c22,JSON[_0x80b6('0x24')](_0x31c95e));_0x3f6bf4(_0x31c95e);})[_0x80b6('0x16')](function(_0x5ec9cc){logger[_0x80b6('0x12')](_0x80b6('0x23'),_0x5ec9cc[_0x80b6('0x15')],_0x402c22);_0xb348c4(_this[_0x80b6('0x12')](0x1f4,_0x5ec9cc['message']));});});}; \ No newline at end of file +var _0x07d7=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','limit','debug','catch','AddTagsToMailInteraction','find','omit','ids','spread'];(function(_0x5a13d9,_0x322a85){var _0x3dd00d=function(_0x50d74c){while(--_0x50d74c){_0x5a13d9['push'](_0x5a13d9['shift']());}};_0x3dd00d(++_0x322a85);}(_0x07d7,0x85));var _0x707d=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0x07d7[_0x442f02];return _0xab6ef1;};'use strict';var _=require(_0x707d('0x0'));var util=require(_0x707d('0x1'));var moment=require(_0x707d('0x2'));var BPromise=require(_0x707d('0x3'));var rs=require(_0x707d('0x4'));var fs=require('fs');var Redis=require(_0x707d('0x5'));var db=require(_0x707d('0x6'))['db'];var utils=require(_0x707d('0x7'));var logger=require(_0x707d('0x8'))(_0x707d('0x9'));var config=require(_0x707d('0xa'));var jayson=require(_0x707d('0xb'));var client=jayson[_0x707d('0xc')][_0x707d('0xd')]({'port':0x232a});config[_0x707d('0xe')]=_[_0x707d('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x707d('0x10'))(new Redis(config[_0x707d('0xe')]));require(_0x707d('0x11'))[_0x707d('0x12')](socket);function respondWithRpcPromise(_0x51750,_0x5af425,_0x3f45f5){return new BPromise(function(_0x107bc3,_0xd87d5d){return client['request'](_0x51750,_0x3f45f5)[_0x707d('0x13')](function(_0x355ce4){logger[_0x707d('0x14')]('MailInteraction,\x20%s,\x20%s',_0x5af425,'request\x20sent');logger['debug'](_0x707d('0x15'),_0x5af425,_0x707d('0x16'),JSON[_0x707d('0x17')](_0x355ce4));if(_0x355ce4['error']){if(_0x355ce4[_0x707d('0x18')]['code']===0x1f4){logger[_0x707d('0x18')](_0x707d('0x19'),_0x5af425,_0x355ce4['error']['message']);return _0xd87d5d(_0x355ce4[_0x707d('0x18')]['message']);}logger[_0x707d('0x18')](_0x707d('0x19'),_0x5af425,_0x355ce4[_0x707d('0x18')][_0x707d('0x1a')]);return _0x107bc3(_0x355ce4[_0x707d('0x18')][_0x707d('0x1a')]);}else{logger[_0x707d('0x14')]('MailInteraction,\x20%s,\x20%s',_0x5af425,_0x707d('0x16'));_0x107bc3(_0x355ce4[_0x707d('0x1b')][_0x707d('0x1a')]);}})['catch'](function(_0x291864){logger[_0x707d('0x18')](_0x707d('0x19'),_0x5af425,_0x291864);_0xd87d5d(_0x291864);});});}exports[_0x707d('0x1c')]=function(_0x81f93f){var _0x178be9=this;return new Promise(function(_0xb7171a,_0x446629){return db[_0x707d('0x1d')][_0x707d('0x1e')](_0x81f93f[_0x707d('0x1f')],{'raw':_0x81f93f[_0x707d('0x20')]?_0x81f93f[_0x707d('0x20')][_0x707d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x81f93f[_0x707d('0x20')]?_0x81f93f[_0x707d('0x20')][_0x707d('0x22')]||null:null,'attributes':_0x81f93f['options']?_0x81f93f[_0x707d('0x20')]['attributes']||null:null,'limit':_0x81f93f[_0x707d('0x20')]?_0x81f93f[_0x707d('0x20')][_0x707d('0x23')]||null:null})[_0x707d('0x13')](function(_0x12d4da){logger['info'](_0x707d('0x1c'),_0x81f93f);logger[_0x707d('0x24')](_0x707d('0x1c'),_0x81f93f,JSON[_0x707d('0x17')](_0x12d4da));_0xb7171a(_0x12d4da);})[_0x707d('0x25')](function(_0x26d4ee){logger[_0x707d('0x18')](_0x707d('0x1c'),_0x26d4ee[_0x707d('0x1a')],_0x81f93f);_0x446629(_0x178be9[_0x707d('0x18')](0x1f4,_0x26d4ee[_0x707d('0x1a')]));});});};exports[_0x707d('0x26')]=function(_0x2c5ace){return new Promise(function(_0x4274e9,_0x38b44b){return db[_0x707d('0x1d')][_0x707d('0x27')]({'where':_0x2c5ace[_0x707d('0x20')]?_0x2c5ace['options'][_0x707d('0x22')]||null:null})[_0x707d('0x13')](function(_0x1784ce){if(_0x1784ce){return _0x1784ce['addTags'](_0x2c5ace['body']['ids'],_[_0x707d('0x28')](_0x2c5ace[_0x707d('0x1f')],[_0x707d('0x29'),'id'])||{});}})[_0x707d('0x2a')](function(_0x177524){logger[_0x707d('0x14')](_0x707d('0x2b'),_0x2c5ace);logger[_0x707d('0x24')](_0x707d('0x2b'),_0x2c5ace,JSON[_0x707d('0x17')](_0x177524));_0x4274e9(_0x177524);})[_0x707d('0x25')](function(_0x455841){logger['error'](_0x707d('0x2b'),_0x455841[_0x707d('0x1a')],_0x2c5ace);_0x38b44b(_this[_0x707d('0x18')](0x1f4,_0x455841[_0x707d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index fef574f..93ff706 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 _0x8f78=['length','./mailInteraction.events','save','remove','update','removeListener','register'];(function(_0xcf4569,_0x1ce755){var _0x7fef=function(_0x374ab8){while(--_0x374ab8){_0xcf4569['push'](_0xcf4569['shift']());}};_0x7fef(++_0x1ce755);}(_0x8f78,0xe1));var _0x88f7=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8f78[_0x2b10c6];return _0x3789d2;};'use strict';var MailInteractionEvents=require(_0x88f7('0x0'));var events=[_0x88f7('0x1'),_0x88f7('0x2'),_0x88f7('0x3')];function createListener(_0x4ec57b,_0x3a9b24){return function(_0x57e426){_0x3a9b24['emit'](_0x4ec57b,_0x57e426);};}function removeListener(_0x2855c4,_0x2649f2){return function(){MailInteractionEvents[_0x88f7('0x4')](_0x2855c4,_0x2649f2);};}exports[_0x88f7('0x5')]=function(_0x358a77){for(var _0x393f28=0x0,_0x34b41e=events[_0x88f7('0x6')];_0x393f28<_0x34b41e;_0x393f28++){var _0x415d20=events[_0x393f28];var _0x9dac25=createListener('mailInteraction:'+_0x415d20,_0x358a77);MailInteractionEvents['on'](_0x415d20,_0x9dac25);}}; \ No newline at end of file +var _0xd58a=['length','mailInteraction:','./mailInteraction.events','save','emit','removeListener'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0xd58a,0x14c));var _0xad58=function(_0x2f79ab,_0x177978){_0x2f79ab=_0x2f79ab-0x0;var _0x22d41c=_0xd58a[_0x2f79ab];return _0x22d41c;};'use strict';var MailInteractionEvents=require(_0xad58('0x0'));var events=[_0xad58('0x1'),'remove','update'];function createListener(_0x32b8f1,_0x16c69a){return function(_0x5106a7){_0x16c69a[_0xad58('0x2')](_0x32b8f1,_0x5106a7);};}function removeListener(_0x30be3d,_0x1f672d){return function(){MailInteractionEvents[_0xad58('0x3')](_0x30be3d,_0x1f672d);};}exports['register']=function(_0x2adcf9){for(var _0x1f6e77=0x0,_0x354ed7=events[_0xad58('0x4')];_0x1f6e77<_0x354ed7;_0x1f6e77++){var _0x3f21af=events[_0x1f6e77];var _0x1c237c=createListener(_0xad58('0x5')+_0x3f21af,_0x2adcf9);MailInteractionEvents['on'](_0x3f21af,_0x1c237c);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 7135947..1f16bdc 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe54=['./mailInteractionHasTag.controller','/describe','express','Router'];(function(_0xb02f42,_0x5b6adc){var _0x4d6686=function(_0x498f0d){while(--_0x498f0d){_0xb02f42['push'](_0xb02f42['shift']());}};_0x4d6686(++_0x5b6adc);}(_0xbe54,0x9e));var _0x4be5=function(_0x56de2d,_0x2dcbb8){_0x56de2d=_0x56de2d-0x0;var _0x5deb49=_0xbe54[_0x56de2d];return _0x5deb49;};'use strict';var express=require(_0x4be5('0x0'));var router=express[_0x4be5('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x4be5('0x2'));router['get'](_0x4be5('0x3'),auth['isAuthenticated'](),controller['describe']);module['exports']=router; \ No newline at end of file +var _0x89b8=['Router','../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','describe','exports','express'];(function(_0x1b975d,_0x3e78fc){var _0x1b7993=function(_0x396729){while(--_0x396729){_0x1b975d['push'](_0x1b975d['shift']());}};_0x1b7993(++_0x3e78fc);}(_0x89b8,0x19f));var _0x889b=function(_0x4cfc11,_0x18bb97){_0x4cfc11=_0x4cfc11-0x0;var _0x47b97f=_0x89b8[_0x4cfc11];return _0x47b97f;};'use strict';var express=require(_0x889b('0x0'));var router=express[_0x889b('0x1')]();var auth=require(_0x889b('0x2'));var controller=require(_0x889b('0x3'));router[_0x889b('0x4')](_0x889b('0x5'),auth['isAuthenticated'](),controller[_0x889b('0x6')]);module[_0x889b('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 7ba090b..c8f53ec 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x2e6e0d,_0x98990e){var _0x486aed=function(_0x50118a){while(--_0x50118a){_0x2e6e0d['push'](_0x2e6e0d['shift']());}};_0x486aed(++_0x98990e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x3e8098,_0xccabfc){var _0x4a72f9=function(_0x30d02d){while(--_0x30d02d){_0x3e8098['push'](_0x3e8098['shift']());}};_0x4a72f9(++_0xccabfc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index c45d8a7..9b0dec5 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7112=['sequelize','exports','INTEGER'];(function(_0x2fdee1,_0x466858){var _0x2c5533=function(_0x1f34de){while(--_0x1f34de){_0x2fdee1['push'](_0x2fdee1['shift']());}};_0x2c5533(++_0x466858);}(_0x7112,0xc3));var _0x2711=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7112[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x2711('0x0'));module[_0x2711('0x1')]={'MailInteractionId':{'type':Sequelize[_0x2711('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x2711('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xbb82=['INTEGER','sequelize'];(function(_0x1e7482,_0x5c6d65){var _0x43f4f6=function(_0x4c9aef){while(--_0x4c9aef){_0x1e7482['push'](_0x1e7482['shift']());}};_0x43f4f6(++_0x5c6d65);}(_0xbb82,0x143));var _0x2bb8=function(_0x315add,_0x5e9ace){_0x315add=_0x315add-0x0;var _0x40956b=_0xbb82[_0x315add];return _0x40956b;};'use strict';var Sequelize=require(_0x2bb8('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0x2bb8('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x2bb8('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 1df0fc6..80a582b 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bf8=['./mailInteractionHasTag','exports'];(function(_0x2678d6,_0x4e2001){var _0x475503=function(_0x34b23d){while(--_0x34b23d){_0x2678d6['push'](_0x2678d6['shift']());}};_0x475503(++_0x4e2001);}(_0x3bf8,0xe8));var _0x83bf=function(_0x214914,_0x91a62e){_0x214914=_0x214914-0x0;var _0x308846=_0x3bf8[_0x214914];return _0x308846;};'use strict';var attributes=require(_0x83bf('0x0'));module[_0x83bf('0x1')]=function(_0x26b406){return _0x26b406['define']('MailInteractionHasTag',attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90bb=['define','mail_interaction_has_tags','./mailInteractionHasTag','exports'];(function(_0x2eb35d,_0x4a7a45){var _0x1f9854=function(_0x5eb6f9){while(--_0x5eb6f9){_0x2eb35d['push'](_0x2eb35d['shift']());}};_0x1f9854(++_0x4a7a45);}(_0x90bb,0xf6));var _0xb90b=function(_0x924de0,_0x196369){_0x924de0=_0x924de0-0x0;var _0x480228=_0x90bb[_0x924de0];return _0x480228;};'use strict';var attributes=require(_0xb90b('0x0'));module[_0xb90b('0x1')]=function(_0x46bfdd){return _0x46bfdd[_0xb90b('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0xb90b('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index d4bfadf..8555ff1 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 _0x9e8e=['reject','delete','destroy','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/describe','/:id','download','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x1015a9,_0x78aff6){var _0x53a509=function(_0xfbd2d3){while(--_0xfbd2d3){_0x1015a9['push'](_0x1015a9['shift']());}};_0x53a509(++_0x78aff6);}(_0x9e8e,0x179));var _0xe9e8=function(_0x571201,_0x2a787a){_0x571201=_0x571201-0x0;var _0x385e67=_0x9e8e[_0x571201];return _0x385e67;};'use strict';var multer=require(_0xe9e8('0x0'));var util=require(_0xe9e8('0x1'));var path=require(_0xe9e8('0x2'));var timeout=require(_0xe9e8('0x3'));var express=require('express');var router=express[_0xe9e8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe9e8('0x5'));var controller=require('./mailMessage.controller');router[_0xe9e8('0x6')]('/',auth[_0xe9e8('0x7')](),controller[_0xe9e8('0x8')]);router['get'](_0xe9e8('0x9'),auth[_0xe9e8('0x7')](),controller['describe']);router[_0xe9e8('0x6')](_0xe9e8('0xa'),auth[_0xe9e8('0x7')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xe9e8('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('mail',_0xe9e8('0xc')),controller[_0xe9e8('0xd')]);router[_0xe9e8('0xe')](_0xe9e8('0xa'),auth['isAuthenticated'](),controller[_0xe9e8('0xf')]);router[_0xe9e8('0xe')](_0xe9e8('0x10'),auth['isAuthenticated'](),controller[_0xe9e8('0x11')]);router['put'](_0xe9e8('0x12'),auth[_0xe9e8('0x7')](),controller[_0xe9e8('0x13')]);router[_0xe9e8('0x14')](_0xe9e8('0xa'),auth['isAuthenticated'](),controller[_0xe9e8('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8aa7=['update','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mailmessage:create','create'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x8aa7,0xb6));var _0x78aa=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x8aa7[_0x49d41c];return _0xb64c5f;};'use strict';var multer=require('multer');var util=require(_0x78aa('0x0'));var path=require(_0x78aa('0x1'));var timeout=require(_0x78aa('0x2'));var express=require(_0x78aa('0x3'));var router=express[_0x78aa('0x4')]();var fs_extra=require(_0x78aa('0x5'));var auth=require(_0x78aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x78aa('0x7'));var controller=require(_0x78aa('0x8'));router[_0x78aa('0x9')]('/',auth[_0x78aa('0xa')](),controller[_0x78aa('0xb')]);router[_0x78aa('0x9')](_0x78aa('0xc'),auth[_0x78aa('0xa')](),controller[_0x78aa('0xd')]);router[_0x78aa('0x9')](_0x78aa('0xe'),auth[_0x78aa('0xa')](),controller[_0x78aa('0xf')]);router[_0x78aa('0x9')](_0x78aa('0x10'),auth[_0x78aa('0xa')](),controller[_0x78aa('0x11')]);router[_0x78aa('0x12')]('/',auth[_0x78aa('0xa')](),interaction['tracked']('mail',_0x78aa('0x13')),controller[_0x78aa('0x14')]);router['put'](_0x78aa('0xe'),auth[_0x78aa('0xa')](),controller[_0x78aa('0x15')]);router[_0x78aa('0x16')](_0x78aa('0x17'),auth['isAuthenticated'](),controller[_0x78aa('0x18')]);router[_0x78aa('0x16')](_0x78aa('0x19'),auth[_0x78aa('0xa')](),controller[_0x78aa('0x1a')]);router['delete'](_0x78aa('0xe'),auth[_0x78aa('0xa')](),controller[_0x78aa('0x1b')]);module[_0x78aa('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 6cca6f7..e13538d 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 _0xc93a=['exports','TEXT','ENUM','out','STRING','long','DATE','INTEGER','BOOLEAN','Email','Chat','sequelize'];(function(_0x2ae47b,_0x2e18b6){var _0x3feeab=function(_0x503f94){while(--_0x503f94){_0x2ae47b['push'](_0x2ae47b['shift']());}};_0x3feeab(++_0x2e18b6);}(_0xc93a,0x1af));var _0xac93=function(_0x301991,_0x59c936){_0x301991=_0x301991-0x0;var _0x55c6f8=_0xc93a[_0x301991];return _0x55c6f8;};'use strict';var Sequelize=require(_0xac93('0x0'));var _=require('lodash');module[_0xac93('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xac93('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xac93('0x3')]('in','out'),'defaultValue':_0xac93('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xac93('0x5')](0x1fe)},'from':{'type':Sequelize[_0xac93('0x5')]},'to':{'type':Sequelize[_0xac93('0x2')]('long')},'cc':{'type':Sequelize[_0xac93('0x2')](_0xac93('0x6'))},'bcc':{'type':Sequelize['TEXT'](_0xac93('0x6'))},'subject':{'type':Sequelize[_0xac93('0x2')]},'sentAt':{'type':Sequelize[_0xac93('0x7')]},'attach':{'type':Sequelize[_0xac93('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xac93('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xac93('0x7')]},'originTo':{'type':Sequelize[_0xac93('0x2')](_0xac93('0x6'))},'originCc':{'type':Sequelize[_0xac93('0x2')](_0xac93('0x6'))},'originChannel':{'type':Sequelize['ENUM'](_0xac93('0xa'),_0xac93('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xbdb0=['out','STRING','INTEGER','DATE','Email','sequelize','lodash','TEXT','long','medium','ENUM'];(function(_0xdbb7cd,_0x25d816){var _0x2a50c1=function(_0x36910a){while(--_0x36910a){_0xdbb7cd['push'](_0xdbb7cd['shift']());}};_0x2a50c1(++_0x25d816);}(_0xbdb0,0x165));var _0x0bdb=function(_0x99facc,_0x548cd6){_0x99facc=_0x99facc-0x0;var _0xd39ed0=_0xbdb0[_0x99facc];return _0xd39ed0;};'use strict';var Sequelize=require(_0x0bdb('0x0'));var _=require(_0x0bdb('0x1'));module['exports']={'body':{'type':Sequelize[_0x0bdb('0x2')](_0x0bdb('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0bdb('0x2')](_0x0bdb('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0bdb('0x5')]('in',_0x0bdb('0x6')),'defaultValue':_0x0bdb('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0bdb('0x7')](0x1fe)},'from':{'type':Sequelize[_0x0bdb('0x7')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x0bdb('0x2')](_0x0bdb('0x3'))},'bcc':{'type':Sequelize[_0x0bdb('0x2')](_0x0bdb('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x0bdb('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x0bdb('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x0bdb('0x3'))},'originCc':{'type':Sequelize[_0x0bdb('0x2')](_0x0bdb('0x3'))},'originChannel':{'type':Sequelize[_0x0bdb('0x5')](_0x0bdb('0xa'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 30db418..dc12609 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 _0xc040=['get','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','User','internal','motionChannel','rejectmessage','download','toString','server','files','bcc','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','build','writeFileSync','unlinkSync','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','info','result','catch','json','undefined','limit','count','offset','status','set','Content-Range','update','then','destroy','end','stack','name','send','map','MailMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','show','includeAll','options','find','body','params','describe','out','secret','split','MailAccount','findOne','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','create','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','read','readAt','UserId','user','agent','MailInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','fullname','email','manual','interface','SIP/%s','channel','event','accept','fromString','EventManager','acceptmessage','reject','mail'];(function(_0x19e838,_0x45adab){var _0x415a89=function(_0x5cea69){while(--_0x5cea69){_0x19e838['push'](_0x19e838['shift']());}};_0x415a89(++_0x45adab);}(_0xc040,0xbe));var _0x0c04=function(_0x16c75e,_0x193ef9){_0x16c75e=_0x16c75e-0x0;var _0x35bbb1=_0xc040[_0x16c75e];return _0x35bbb1;};'use strict';var emlformat=require('eml-format');var moment=require(_0x0c04('0x0'));var BPromise=require(_0x0c04('0x1'));var util=require(_0x0c04('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x0c04('0x3'));var Redis=require(_0x0c04('0x4'));var htmlToText=require(_0x0c04('0x5'));var qs=require(_0x0c04('0x6'));var logger=require(_0x0c04('0x7'))('api');var interaction_log=require(_0x0c04('0x7'))(_0x0c04('0x8'));var config=require(_0x0c04('0x9'));var db=require(_0x0c04('0xa'))['db'];config[_0x0c04('0xb')]=_[_0x0c04('0xc')](config[_0x0c04('0xb')],{'host':_0x0c04('0xd'),'port':0x18eb});var socket=require(_0x0c04('0xe'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require('./mailMessage.socket')['register'](socket);var jayson=require(_0x0c04('0xf'));var client=jayson[_0x0c04('0x10')][_0x0c04('0x11')]({'port':0x232c});var client9003=jayson[_0x0c04('0x10')]['http']({'port':0x232b});var client9002=jayson[_0x0c04('0x10')][_0x0c04('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x16b5ec,_0x34ca9c,_0x4ff204,_0x46d7fb){return new BPromise(function(_0x37dd4a,_0x27557b){var _0x100603=_0x46d7fb||client;return _0x100603['request'](_0x16b5ec,_0x4ff204)['then'](function(_0x4d3db4){logger['info']('MailMessage,\x20%s,\x20%s',_0x34ca9c,_0x0c04('0x12'));logger[_0x0c04('0x13')](_0x0c04('0x14'),_0x34ca9c,'request\x20sent',JSON[_0x0c04('0x15')](_0x4d3db4));if(_0x4d3db4[_0x0c04('0x16')]){if(_0x4d3db4['error']['code']===0x1f4){logger[_0x0c04('0x16')](_0x0c04('0x17'),_0x34ca9c,_0x4d3db4[_0x0c04('0x16')][_0x0c04('0x18')]);return _0x27557b(_0x4d3db4['error']['message']);}logger[_0x0c04('0x16')](_0x0c04('0x17'),_0x34ca9c,_0x4d3db4['error'][_0x0c04('0x18')]);return _0x37dd4a(_0x4d3db4['error'][_0x0c04('0x18')]);}else{logger[_0x0c04('0x19')](_0x0c04('0x17'),_0x34ca9c,_0x0c04('0x12'));_0x37dd4a(_0x4d3db4[_0x0c04('0x1a')]['message']);}})[_0x0c04('0x1b')](function(_0x3da552){logger[_0x0c04('0x16')]('MailMessage,\x20%s,\x20%s',_0x34ca9c,_0x3da552);_0x27557b(_0x3da552);});});}function respondWithResult(_0x3f0083,_0x4a0433){_0x4a0433=_0x4a0433||0xc8;return function(_0x3e0492){if(_0x3e0492){return _0x3f0083['status'](_0x4a0433)[_0x0c04('0x1c')](_0x3e0492);}};}function respondWithFilteredResult(_0x4232d7,_0x4e7a61){return function(_0x26a3cc){if(_0x26a3cc){var _0x43d331=typeof _0x4e7a61['offset']===_0x0c04('0x1d')&&typeof _0x4e7a61[_0x0c04('0x1e')]===_0x0c04('0x1d');var _0x40adb7=_0x26a3cc[_0x0c04('0x1f')];var _0x4e9e04=_0x43d331?0x0:_0x4e7a61[_0x0c04('0x20')];var _0x5b6a54=_0x43d331?_0x26a3cc[_0x0c04('0x1f')]:_0x4e7a61[_0x0c04('0x20')]+_0x4e7a61[_0x0c04('0x1e')];var _0x17fb7b;if(_0x5b6a54>=_0x40adb7){_0x5b6a54=_0x40adb7;_0x17fb7b=0xc8;}else{_0x17fb7b=0xce;}_0x4232d7[_0x0c04('0x21')](_0x17fb7b);return _0x4232d7[_0x0c04('0x22')](_0x0c04('0x23'),_0x4e9e04+'-'+_0x5b6a54+'/'+_0x40adb7)['json'](_0x26a3cc);}return null;};}function saveUpdates(_0x3c57c4){return function(_0x3e5abd){if(_0x3e5abd){return _0x3e5abd[_0x0c04('0x24')](_0x3c57c4)[_0x0c04('0x25')](function(_0x1a25ec){return _0x1a25ec;});}return null;};}function removeEntity(_0x1a0dde){return function(_0x4e611c){if(_0x4e611c){return _0x4e611c[_0x0c04('0x26')]()['then'](function(){_0x1a0dde[_0x0c04('0x21')](0xcc)[_0x0c04('0x27')]();});}};}function handleEntityNotFound(_0x5e9b56){return function(_0x3a96f6){if(!_0x3a96f6){_0x5e9b56['sendStatus'](0x194);}return _0x3a96f6;};}function handleError(_0x55108e,_0x5b6f30){_0x5b6f30=_0x5b6f30||0x1f4;return function(_0x5800c9){logger['error'](_0x5800c9[_0x0c04('0x28')]);if(_0x5800c9[_0x0c04('0x29')]){delete _0x5800c9[_0x0c04('0x29')];}_0x55108e[_0x0c04('0x21')](_0x5b6f30)[_0x0c04('0x2a')](_0x5800c9);};}exports['index']=function(_0x3ddfa9,_0x4abda3){var _0x4654fc={},_0xeca207={},_0x27222c={'count':0x0,'rows':[]};var _0x687318=_[_0x0c04('0x2b')](db[_0x0c04('0x2c')][_0x0c04('0x2d')],function(_0x4be846){return{'name':_0x4be846[_0x0c04('0x2e')],'type':_0x4be846['type'][_0x0c04('0x2f')]};});_0xeca207[_0x0c04('0x30')]=_[_0x0c04('0x2b')](_0x687318,_0x0c04('0x29'));_0xeca207[_0x0c04('0x31')]=_[_0x0c04('0x32')](_0x3ddfa9['query']);_0xeca207[_0x0c04('0x33')]=_[_0x0c04('0x34')](_0xeca207[_0x0c04('0x30')],_0xeca207[_0x0c04('0x31')]);_0x4654fc['attributes']=_[_0x0c04('0x34')](_0xeca207[_0x0c04('0x30')],qs[_0x0c04('0x35')](_0x3ddfa9[_0x0c04('0x31')][_0x0c04('0x35')]));_0x4654fc[_0x0c04('0x36')]=_0x4654fc[_0x0c04('0x36')][_0x0c04('0x37')]?_0x4654fc[_0x0c04('0x36')]:_0xeca207[_0x0c04('0x30')];if(!_0x3ddfa9['query'][_0x0c04('0x38')]('nolimit')){_0x4654fc['limit']=qs[_0x0c04('0x1e')](_0x3ddfa9[_0x0c04('0x31')][_0x0c04('0x1e')]);_0x4654fc['offset']=qs[_0x0c04('0x20')](_0x3ddfa9[_0x0c04('0x31')][_0x0c04('0x20')]);}_0x4654fc[_0x0c04('0x39')]=qs[_0x0c04('0x3a')](_0x3ddfa9['query']['sort']);_0x4654fc[_0x0c04('0x3b')]=qs[_0x0c04('0x33')](_[_0x0c04('0x3c')](_0x3ddfa9[_0x0c04('0x31')],_0xeca207[_0x0c04('0x33')]),_0x687318);if(_0x3ddfa9['query'][_0x0c04('0x3d')]){_0x4654fc[_0x0c04('0x3b')]=_[_0x0c04('0x3e')](_0x4654fc[_0x0c04('0x3b')],{'$or':_['map'](_0x687318,function(_0x3b0cca){if(_0x3b0cca[_0x0c04('0x3f')]!==_0x0c04('0x40')){var _0x11bdb2={};_0x11bdb2[_0x3b0cca[_0x0c04('0x29')]]={'$like':'%'+_0x3ddfa9[_0x0c04('0x31')][_0x0c04('0x3d')]+'%'};return _0x11bdb2;}})});}_0x4654fc=_[_0x0c04('0x3e')]({},_0x4654fc,_0x3ddfa9['options']);var _0x4674c9={'where':_0x4654fc[_0x0c04('0x3b')]};return db[_0x0c04('0x2c')][_0x0c04('0x1f')](_0x4674c9)[_0x0c04('0x25')](function(_0x23b8de){_0x27222c['count']=_0x23b8de;if(_0x3ddfa9['query']['includeAll']){_0x4654fc['include']=[{'all':!![]}];}return db[_0x0c04('0x2c')][_0x0c04('0x41')](_0x4654fc);})[_0x0c04('0x25')](function(_0x172eaa){_0x27222c[_0x0c04('0x42')]=_0x172eaa;return _0x27222c;})[_0x0c04('0x25')](respondWithFilteredResult(_0x4abda3,_0x4654fc))[_0x0c04('0x1b')](handleError(_0x4abda3,null));};exports[_0x0c04('0x43')]=function(_0x1e1f67,_0x189064){var _0x484bf0={'raw':!![],'where':{'id':_0x1e1f67['params']['id']}},_0x11d91b={};_0x11d91b[_0x0c04('0x30')]=_[_0x0c04('0x32')](db[_0x0c04('0x2c')]['rawAttributes']);_0x11d91b[_0x0c04('0x31')]=_[_0x0c04('0x32')](_0x1e1f67[_0x0c04('0x31')]);_0x11d91b[_0x0c04('0x33')]=_[_0x0c04('0x34')](_0x11d91b['model'],_0x11d91b[_0x0c04('0x31')]);_0x484bf0[_0x0c04('0x36')]=_[_0x0c04('0x34')](_0x11d91b[_0x0c04('0x30')],qs[_0x0c04('0x35')](_0x1e1f67[_0x0c04('0x31')][_0x0c04('0x35')]));_0x484bf0[_0x0c04('0x36')]=_0x484bf0['attributes'][_0x0c04('0x37')]?_0x484bf0[_0x0c04('0x36')]:_0x11d91b['model'];if(_0x1e1f67[_0x0c04('0x31')][_0x0c04('0x44')]){_0x484bf0['include']=[{'all':!![]}];}_0x484bf0=_[_0x0c04('0x3e')]({},_0x484bf0,_0x1e1f67[_0x0c04('0x45')]);return db['MailMessage'][_0x0c04('0x46')](_0x484bf0)[_0x0c04('0x25')](handleEntityNotFound(_0x189064,null))['then'](respondWithResult(_0x189064,null))[_0x0c04('0x1b')](handleError(_0x189064,null));};exports[_0x0c04('0x24')]=function(_0x5e5dab,_0x138389){if(_0x5e5dab['body']['id']){delete _0x5e5dab[_0x0c04('0x47')]['id'];}return db[_0x0c04('0x2c')][_0x0c04('0x46')]({'where':{'id':_0x5e5dab['params']['id']}})['then'](handleEntityNotFound(_0x138389,null))['then'](saveUpdates(_0x5e5dab[_0x0c04('0x47')],null))[_0x0c04('0x25')](respondWithResult(_0x138389,null))[_0x0c04('0x1b')](handleError(_0x138389,null));};exports[_0x0c04('0x26')]=function(_0x25e7fb,_0x38bb2a){return db[_0x0c04('0x2c')][_0x0c04('0x46')]({'where':{'id':_0x25e7fb[_0x0c04('0x48')]['id']}})['then'](handleEntityNotFound(_0x38bb2a,null))[_0x0c04('0x25')](removeEntity(_0x38bb2a,null))[_0x0c04('0x1b')](handleError(_0x38bb2a,null));};exports[_0x0c04('0x49')]=function(_0x49a135,_0x3ecf25){return db[_0x0c04('0x2c')][_0x0c04('0x49')]()[_0x0c04('0x25')](respondWithResult(_0x3ecf25,null))[_0x0c04('0x1b')](handleError(_0x3ecf25,null));};exports['create']=function(_0x242d1d,_0x5dfa0c){return db['MailMessage']['create'](_0x242d1d[_0x0c04('0x47')])[_0x0c04('0x25')](function(_0x35a96c){if(_0x35a96c){if(_0x35a96c['direction']===_0x0c04('0x4a')&&!_0x35a96c[_0x0c04('0x4b')]){var _0x410a91,_0x385fb5,_0x1d9f7c;if(_0x242d1d[_0x0c04('0x47')]['to']){_0x385fb5=_0x242d1d['body']['to'][_0x0c04('0x4c')](',')[0x0];}return db[_0x0c04('0x4d')][_0x0c04('0x4e')]({'where':{'id':_0x35a96c['MailAccountId']},'include':[{'model':db[_0x0c04('0x4f')],'as':_0x0c04('0x50'),'include':[{'model':db[_0x0c04('0x51')],'as':_0x0c04('0x52'),'where':{'email':_0x385fb5},'limit':0x1,'order':[['updatedAt',_0x0c04('0x53')]]}]},{'model':db[_0x0c04('0x54')],'as':_0x0c04('0x55'),'raw':!![],'include':[{'model':db[_0x0c04('0x56')],'as':_0x0c04('0x56'),'raw':!![]}]}]})['then'](function(_0x5dd5ae){_0x410a91=_0x5dd5ae;if(!_0x410a91||!_0x410a91[_0x0c04('0x55')])return;var _0x4c7291=_0x410a91[_0x0c04('0x57')]();if(_0x242d1d[_0x0c04('0x47')][_0x0c04('0x58')]&&_0x242d1d[_0x0c04('0x47')][_0x0c04('0x58')]['length']){for(var _0x395a95=0x0;_0x395a95<_0x242d1d[_0x0c04('0x47')][_0x0c04('0x58')][_0x0c04('0x37')];_0x395a95+=0x1){_0x242d1d['body'][_0x0c04('0x58')][_0x395a95]={'filename':_0x242d1d[_0x0c04('0x47')][_0x0c04('0x58')][_0x395a95]['name'],'path':path[_0x0c04('0x59')](config[_0x0c04('0x5a')],_0x0c04('0x5b'),_0x242d1d[_0x0c04('0x47')][_0x0c04('0x58')][_0x395a95]['basename'])};}}_0x1d9f7c={'account':_0x4c7291,'message':_0x242d1d[_0x0c04('0x47')]};return;})[_0x0c04('0x25')](function(){if(_0x410a91['List']){if(_0x410a91[_0x0c04('0x50')][_0x0c04('0x52')][_0x0c04('0x37')]){return _0x410a91[_0x0c04('0x50')][_0x0c04('0x52')][0x0];}else{return db['CmContact'][_0x0c04('0x5c')](_[_0x0c04('0xc')](_0x242d1d[_0x0c04('0x47')],{'firstName':_0x242d1d[_0x0c04('0x47')]['to'],'email':_0x242d1d[_0x0c04('0x47')]['to'],'phone':_0x242d1d[_0x0c04('0x47')]['to'],'ListId':_0x410a91['ListId']}));}}else{throw new Error(_0x0c04('0x5d'));}})['then'](function(){if(_0x1d9f7c){return respondWithRpcPromise('SendMail',_0x0c04('0x5e'),_0x1d9f7c,client9003)[_0x0c04('0x25')](function(_0xf7b292){return _0x35a96c['update']({'read':!![],'messageId':_0xf7b292[_0x0c04('0x5f')],'sentAt':moment()[_0x0c04('0x60')](_0x0c04('0x61'))});})[_0x0c04('0x1b')](function(_0x5b4b6c){logger[_0x0c04('0x16')]('%s',JSON[_0x0c04('0x15')](_0x5b4b6c));return _0x35a96c;});}return _0x35a96c;});}return _0x35a96c;}})[_0x0c04('0x25')](respondWithResult(_0x5dfa0c,0xc9))[_0x0c04('0x1b')](handleError(_0x5dfa0c,null));};exports['accept']=function(_0x2bac9d,_0x2d3d9c){var _0x150ca1={'agent':{},'channel':'mail'};if(_0x2bac9d[_0x0c04('0x47')]['id']){delete _0x2bac9d[_0x0c04('0x47')]['id'];}_0x2bac9d['body'][_0x0c04('0x62')]=!![];_0x2bac9d[_0x0c04('0x47')][_0x0c04('0x63')]=moment()['format'](_0x0c04('0x61'));_0x2bac9d[_0x0c04('0x47')]['UserId']=_0x2bac9d['body'][_0x0c04('0x64')]||_0x2bac9d[_0x0c04('0x65')]['id'];_0x150ca1[_0x0c04('0x66')]['id']=_0x2bac9d[_0x0c04('0x47')][_0x0c04('0x64')];return db[_0x0c04('0x2c')][_0x0c04('0x46')]({'where':{'id':_0x2bac9d['params']['id'],'UserId':null}})[_0x0c04('0x25')](handleEntityNotFound(_0x2d3d9c,null))['then'](saveUpdates(_0x2bac9d['body'],null))[_0x0c04('0x25')](function(_0x54f729){if(_0x54f729){_0x150ca1[_0x0c04('0x18')]=_0x54f729['get']({'plain':!![]});return db['MailInteraction'][_0x0c04('0x46')]({'where':{'id':_0x54f729[_0x0c04('0x67')]}});}return null;})[_0x0c04('0x25')](handleEntityNotFound(_0x2d3d9c,null))[_0x0c04('0x25')](function(_0x3c4bdc){if(_0x3c4bdc){return _0x3c4bdc['update']({'UserId':_0x2bac9d[_0x0c04('0x47')][_0x0c04('0x64')],'read1stAt':_[_0x0c04('0x68')](_0x3c4bdc[_0x0c04('0x69')])?moment()[_0x0c04('0x60')](_0x0c04('0x61')):undefined});}return null;})[_0x0c04('0x25')](function(_0x86dd5f){if(_0x86dd5f){_0x150ca1[_0x0c04('0x6a')]=_0x86dd5f['get']({'plain':!![]});interaction_log[_0x0c04('0x19')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2bac9d[_0x0c04('0x65')]['id'],_0x2bac9d[_0x0c04('0x65')][_0x0c04('0x29')],_0x2bac9d['user'][_0x0c04('0x6b')],_0x150ca1[_0x0c04('0x6a')]['id'],_0x2bac9d[_0x0c04('0x47')]?JSON[_0x0c04('0x15')](_0x2bac9d[_0x0c04('0x47')]):_0x0c04('0x6c'));return respondWithRpcPromise(_0x0c04('0x6d'),_0x0c04('0x6e'),_0x150ca1);}return null;})[_0x0c04('0x25')](function(_0x333dd2){var _0x27cbaa=_0x0c04('0x6f')+_0x333dd2['message']['ContactId'];return db[_0x0c04('0x70')][_0x0c04('0x31')](_0x27cbaa,{'type':db[_0x0c04('0x71')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x22e4e2){return _0x22e4e2;});})['then'](function(_0xf0ceff){if(_0xf0ceff){_0x150ca1['message'][_0x0c04('0x72')]=_0xf0ceff[0x0];if(!_0x2bac9d['body'][_0x0c04('0x64')])return;return db['User'][_0x0c04('0x46')]({'where':{'id':_0x2bac9d[_0x0c04('0x47')][_0x0c04('0x64')],'role':_0x0c04('0x66')},'attributes':['id',_0x0c04('0x29'),_0x0c04('0x73'),_0x0c04('0x74'),'internal'],'raw':!![]});}return null;})[_0x0c04('0x25')](function(_0x153510){if(!_0x153510)return null;_0x150ca1[_0x0c04('0x18')][_0x0c04('0x66')]=_0x153510;return _0x150ca1;})[_0x0c04('0x25')](function(_0x3631a9){if(_0x3631a9){if(_0x2bac9d['body'][_0x0c04('0x75')]){_0x150ca1[_0x0c04('0x18')][_0x0c04('0x76')]=util[_0x0c04('0x60')](_0x0c04('0x77'),_0x2bac9d[_0x0c04('0x65')][_0x0c04('0x29')]);_0x150ca1[_0x0c04('0x18')]['channel']=_0x150ca1[_0x0c04('0x78')];_0x150ca1['message']['motionChannel']=_0x150ca1[_0x0c04('0x78')];_0x150ca1[_0x0c04('0x18')][_0x0c04('0x79')]=_0x0c04('0x7a');_0x150ca1[_0x0c04('0x18')][_0x0c04('0x47')]=htmlToText[_0x0c04('0x7b')](_0x150ca1['message'][_0x0c04('0x47')]);return respondWithRpcPromise(_0x0c04('0x7c'),_0x0c04('0x7c'),{'event':_0x0c04('0x7d'),'message':_0x150ca1[_0x0c04('0x18')]},client9002)[_0x0c04('0x25')](function(){return _0x150ca1;});}return _0x150ca1;}return null;})['then'](respondWithResult(_0x2d3d9c,null))[_0x0c04('0x1b')](handleError(_0x2d3d9c,null));};exports[_0x0c04('0x7e')]=function(_0x3cfc63,_0x584e96){var _0x549245={'agent':{},'channel':_0x0c04('0x7f')};if(_0x3cfc63[_0x0c04('0x47')]['id']){delete _0x3cfc63[_0x0c04('0x47')]['id'];}_0x3cfc63[_0x0c04('0x47')][_0x0c04('0x64')]=_0x3cfc63[_0x0c04('0x47')]['UserId']||_0x3cfc63[_0x0c04('0x65')]['id'];_0x549245[_0x0c04('0x66')]['id']=_0x3cfc63[_0x0c04('0x47')][_0x0c04('0x64')];return db[_0x0c04('0x2c')]['find']({'where':{'id':_0x3cfc63[_0x0c04('0x48')]['id'],'UserId':null}})[_0x0c04('0x25')](handleEntityNotFound(_0x584e96,null))[_0x0c04('0x25')](function(_0x3da47f){if(_0x3da47f){_0x549245['message']=_0x3da47f[_0x0c04('0x80')]({'plain':!![]});return db[_0x0c04('0x81')][_0x0c04('0x46')]({'where':{'id':_0x3da47f[_0x0c04('0x67')]}});}return null;})[_0x0c04('0x25')](handleEntityNotFound(_0x584e96,null))[_0x0c04('0x25')](function(_0x2cc008){if(_0x2cc008){_0x549245[_0x0c04('0x6a')]=_0x2cc008['get']({'plain':!![]});interaction_log[_0x0c04('0x19')](_0x0c04('0x82'),_0x3cfc63[_0x0c04('0x65')]['id'],_0x3cfc63[_0x0c04('0x65')][_0x0c04('0x29')],_0x3cfc63['user'][_0x0c04('0x6b')],_0x549245[_0x0c04('0x6a')]['id'],_0x3cfc63[_0x0c04('0x47')]?JSON[_0x0c04('0x15')](_0x3cfc63[_0x0c04('0x47')]):_0x0c04('0x6c'));return respondWithRpcPromise(_0x0c04('0x83'),_0x0c04('0x84'),_0x549245);}return null;})[_0x0c04('0x25')](function(_0x1e1925){var _0x5b1c45='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1e1925['message'][_0x0c04('0x85')];return db['sequelize'][_0x0c04('0x31')](_0x5b1c45,{'type':db['Sequelize']['QueryTypes'][_0x0c04('0x86')],'raw':!![]})[_0x0c04('0x25')](function(_0x1dbfe1){return _0x1dbfe1;});})[_0x0c04('0x25')](function(_0x36ab3e){if(_0x36ab3e){_0x549245['message'][_0x0c04('0x72')]=_0x36ab3e[0x0];if(!_0x3cfc63['body'][_0x0c04('0x64')])return;return db[_0x0c04('0x87')][_0x0c04('0x46')]({'where':{'id':_0x3cfc63['body']['UserId'],'role':_0x0c04('0x66')},'attributes':['id','name','fullname','email',_0x0c04('0x88')],'raw':!![]});}return null;})[_0x0c04('0x25')](function(_0x4014de){if(!_0x4014de)return null;_0x549245[_0x0c04('0x18')][_0x0c04('0x66')]=_0x4014de;return _0x549245;})[_0x0c04('0x25')](function(_0x5f0e8b){if(_0x5f0e8b){_0x5f0e8b[_0x0c04('0x18')]['interface']=util[_0x0c04('0x60')]('SIP/%s',_0x3cfc63['user'][_0x0c04('0x29')]);_0x5f0e8b[_0x0c04('0x18')][_0x0c04('0x78')]=_0x549245[_0x0c04('0x78')];_0x5f0e8b[_0x0c04('0x18')][_0x0c04('0x89')]=_0x549245['channel'];_0x5f0e8b[_0x0c04('0x18')][_0x0c04('0x79')]=_0x0c04('0x7e');_0x5f0e8b['message'][_0x0c04('0x47')]=htmlToText[_0x0c04('0x7b')](_0x549245[_0x0c04('0x18')][_0x0c04('0x47')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0x0c04('0x8a'),'message':_0x5f0e8b[_0x0c04('0x18')]},client9002);return _0x549245;}return null;})[_0x0c04('0x25')](respondWithResult(_0x584e96,null))['catch'](handleError(_0x584e96,null));};exports[_0x0c04('0x8b')]=function(_0x5b31c3,_0x3e0ddf){var _0x31252e=moment()['unix']()[_0x0c04('0x8c')]();var _0x1ce3d1=path[_0x0c04('0x59')](config[_0x0c04('0x5a')],_0x0c04('0x8d'),_0x0c04('0x8e'),'tmp');var _0x318150=path['join'](config['root'],'server','files',_0x0c04('0x58'));var _0x2937f2=util['format']('message-%s.eml',_0x31252e);return db[_0x0c04('0x2c')]['find']({'where':{'id':_0x5b31c3[_0x0c04('0x48')]['id']},'attributes':['id','body','from','to','cc',_0x0c04('0x8f'),_0x0c04('0x90'),_0x0c04('0x91')],'include':_0x5b31c3[_0x0c04('0x31')][_0x0c04('0x58')]?[{'model':db[_0x0c04('0x92')],'as':_0x0c04('0x93')}]:undefined})[_0x0c04('0x25')](handleEntityNotFound(_0x3e0ddf,null))['then'](function(_0x583132){if(_0x583132){var _0x3271db=_0x583132;var _0x380f16={'from':_0x3271db[_0x0c04('0x94')],'to':_0x3271db['to'],'subject':_0x3271db[_0x0c04('0x90')],'html':htmlEntities[_0x0c04('0x95')](_0x3271db[_0x0c04('0x47')]),'headers':{'Date':moment(_0x3271db[_0x0c04('0x91')])['format'](_0x0c04('0x96'))},'attachments':[]};if(_0x583132['cc']){_0x380f16[_0x0c04('0x97')]['Cc']=_0x583132['cc'];}if(_0x583132[_0x0c04('0x8f')]){_0x380f16[_0x0c04('0x97')][_0x0c04('0x98')]=_0x583132['bcc'];}return new BPromise(function(_0x4eafb5,_0x491ec6){if(_0x583132[_0x0c04('0x93')]){for(var _0x53674b=0x0;_0x53674b<_0x583132[_0x0c04('0x93')]['length'];_0x53674b++){var _0x500c48=_0x583132[_0x0c04('0x93')][_0x53674b];var _0x35da7e=path[_0x0c04('0x59')](_0x318150,_0x500c48[_0x0c04('0x99')]);if(fs[_0x0c04('0x9a')](_0x35da7e)){_0x380f16[_0x0c04('0x58')][_0x0c04('0x9b')]({'name':_0x500c48[_0x0c04('0x29')],'contentType':_0x500c48[_0x0c04('0x3f')],'data':fs['readFileSync'](_0x35da7e)});}}}emlformat[_0x0c04('0x9c')](_0x380f16,function(_0x14daa9,_0x598fbe){if(_0x14daa9)return _0x491ec6(_0x14daa9);fs[_0x0c04('0x9d')](path[_0x0c04('0x59')](_0x1ce3d1,_0x2937f2),_0x598fbe);return _0x4eafb5(_0x598fbe);});});}})[_0x0c04('0x25')](function(_0x11215f){if(_0x11215f){return _0x3e0ddf[_0x0c04('0x8b')](path[_0x0c04('0x59')](_0x1ce3d1,_0x2937f2),_0x2937f2,function(_0x1e0c2e){if(!_0x1e0c2e)fs[_0x0c04('0x9e')](path[_0x0c04('0x59')](_0x1ce3d1,_0x2937f2));});}})[_0x0c04('0x1b')](handleError(_0x3e0ddf,null));}; \ No newline at end of file +var _0x7119=['http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','catch','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','show','params','length','find','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','List','CmContact','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','Contacts','ListId','List\x20not\x20found','messageId','stringify','accept','mail','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','interface','SIP/%s','channel','event','fromString','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','User','internal','motionChannel','EventManager','download','toString','root','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','client'];(function(_0x2ad833,_0x3fa5b9){var _0x4ec259=function(_0x1f8772){while(--_0x1f8772){_0x2ad833['push'](_0x2ad833['shift']());}};_0x4ec259(++_0x3fa5b9);}(_0x7119,0x126));var _0x9711=function(_0x248fc8,_0x121ebf){_0x248fc8=_0x248fc8-0x0;var _0x1ec5d1=_0x7119[_0x248fc8];return _0x1ec5d1;};'use strict';var emlformat=require(_0x9711('0x0'));var moment=require(_0x9711('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x9711('0x2'));var Redis=require(_0x9711('0x3'));var htmlToText=require(_0x9711('0x4'));var qs=require(_0x9711('0x5'));var logger=require('../../config/logger')(_0x9711('0x6'));var interaction_log=require(_0x9711('0x7'))('mail-interactions');var config=require(_0x9711('0x8'));var db=require(_0x9711('0x9'))['db'];config[_0x9711('0xa')]=_[_0x9711('0xb')](config[_0x9711('0xa')],{'host':_0x9711('0xc'),'port':0x18eb});var socket=require(_0x9711('0xd'))(new Redis(config[_0x9711('0xa')]));var htmlEntities=require(_0x9711('0xe'));require(_0x9711('0xf'))[_0x9711('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9711('0x11')][_0x9711('0x12')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x9711('0x11')][_0x9711('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x39c38f,_0x3462cd,_0x5b9705,_0x4e09c1){return new BPromise(function(_0x5a371c,_0x11d2df){var _0x5915aa=_0x4e09c1||client;return _0x5915aa['request'](_0x39c38f,_0x5b9705)[_0x9711('0x13')](function(_0x24b14b){logger[_0x9711('0x14')]('MailMessage,\x20%s,\x20%s',_0x3462cd,_0x9711('0x15'));logger[_0x9711('0x16')](_0x9711('0x17'),_0x3462cd,_0x9711('0x15'),JSON['stringify'](_0x24b14b));if(_0x24b14b[_0x9711('0x18')]){if(_0x24b14b[_0x9711('0x18')]['code']===0x1f4){logger[_0x9711('0x18')](_0x9711('0x19'),_0x3462cd,_0x24b14b['error'][_0x9711('0x1a')]);return _0x11d2df(_0x24b14b[_0x9711('0x18')][_0x9711('0x1a')]);}logger[_0x9711('0x18')](_0x9711('0x19'),_0x3462cd,_0x24b14b['error'][_0x9711('0x1a')]);return _0x5a371c(_0x24b14b[_0x9711('0x18')][_0x9711('0x1a')]);}else{logger[_0x9711('0x14')]('MailMessage,\x20%s,\x20%s',_0x3462cd,_0x9711('0x15'));_0x5a371c(_0x24b14b['result']['message']);}})[_0x9711('0x1b')](function(_0x531751){logger[_0x9711('0x18')]('MailMessage,\x20%s,\x20%s',_0x3462cd,_0x531751);_0x11d2df(_0x531751);});});}function respondWithResult(_0x5343d7,_0x22de3b){_0x22de3b=_0x22de3b||0xc8;return function(_0x1a02c5){if(_0x1a02c5){return _0x5343d7[_0x9711('0x1c')](_0x22de3b)['json'](_0x1a02c5);}};}function respondWithFilteredResult(_0x3bd033,_0x1fbbb6){return function(_0x3feebd){if(_0x3feebd){var _0x3b7940=typeof _0x1fbbb6[_0x9711('0x1d')]===_0x9711('0x1e')&&typeof _0x1fbbb6['limit']==='undefined';var _0x9ec7b8=_0x3feebd[_0x9711('0x1f')];var _0x1926d4=_0x3b7940?0x0:_0x1fbbb6[_0x9711('0x1d')];var _0xafa5=_0x3b7940?_0x3feebd[_0x9711('0x1f')]:_0x1fbbb6[_0x9711('0x1d')]+_0x1fbbb6[_0x9711('0x20')];var _0x423a82;if(_0xafa5>=_0x9ec7b8){_0xafa5=_0x9ec7b8;_0x423a82=0xc8;}else{_0x423a82=0xce;}_0x3bd033[_0x9711('0x1c')](_0x423a82);return _0x3bd033[_0x9711('0x21')](_0x9711('0x22'),_0x1926d4+'-'+_0xafa5+'/'+_0x9ec7b8)[_0x9711('0x23')](_0x3feebd);}return null;};}function saveUpdates(_0x199bec){return function(_0x314c53){if(_0x314c53){return _0x314c53[_0x9711('0x24')](_0x199bec)[_0x9711('0x13')](function(_0x8ebae3){return _0x8ebae3;});}return null;};}function removeEntity(_0x1da4a8){return function(_0x105faa){if(_0x105faa){return _0x105faa[_0x9711('0x25')]()['then'](function(){_0x1da4a8[_0x9711('0x1c')](0xcc)[_0x9711('0x26')]();});}};}function handleEntityNotFound(_0x5a6b94){return function(_0x2066e6){if(!_0x2066e6){_0x5a6b94[_0x9711('0x27')](0x194);}return _0x2066e6;};}function handleError(_0x4c07df,_0x44a4d9){_0x44a4d9=_0x44a4d9||0x1f4;return function(_0x5da093){logger[_0x9711('0x18')](_0x5da093[_0x9711('0x28')]);if(_0x5da093[_0x9711('0x29')]){delete _0x5da093[_0x9711('0x29')];}_0x4c07df[_0x9711('0x1c')](_0x44a4d9)[_0x9711('0x2a')](_0x5da093);};}exports[_0x9711('0x2b')]=function(_0x12b5fb,_0x76c128){var _0x4a8406={},_0x5b4dfb={},_0x448ae6={'count':0x0,'rows':[]};var _0xeb3939=_['map'](db[_0x9711('0x2c')][_0x9711('0x2d')],function(_0x4eb538){return{'name':_0x4eb538[_0x9711('0x2e')],'type':_0x4eb538['type'][_0x9711('0x2f')]};});_0x5b4dfb[_0x9711('0x30')]=_[_0x9711('0x31')](_0xeb3939,'name');_0x5b4dfb[_0x9711('0x32')]=_[_0x9711('0x33')](_0x12b5fb[_0x9711('0x32')]);_0x5b4dfb[_0x9711('0x34')]=_[_0x9711('0x35')](_0x5b4dfb[_0x9711('0x30')],_0x5b4dfb[_0x9711('0x32')]);_0x4a8406['attributes']=_['intersection'](_0x5b4dfb['model'],qs[_0x9711('0x36')](_0x12b5fb[_0x9711('0x32')][_0x9711('0x36')]));_0x4a8406['attributes']=_0x4a8406['attributes']['length']?_0x4a8406[_0x9711('0x37')]:_0x5b4dfb[_0x9711('0x30')];if(!_0x12b5fb['query'][_0x9711('0x38')](_0x9711('0x39'))){_0x4a8406[_0x9711('0x20')]=qs['limit'](_0x12b5fb[_0x9711('0x32')][_0x9711('0x20')]);_0x4a8406[_0x9711('0x1d')]=qs['offset'](_0x12b5fb[_0x9711('0x32')][_0x9711('0x1d')]);}_0x4a8406[_0x9711('0x3a')]=qs[_0x9711('0x3b')](_0x12b5fb['query'][_0x9711('0x3b')]);_0x4a8406[_0x9711('0x3c')]=qs[_0x9711('0x34')](_[_0x9711('0x3d')](_0x12b5fb[_0x9711('0x32')],_0x5b4dfb[_0x9711('0x34')]),_0xeb3939);if(_0x12b5fb['query'][_0x9711('0x3e')]){_0x4a8406['where']=_['merge'](_0x4a8406[_0x9711('0x3c')],{'$or':_['map'](_0xeb3939,function(_0x198c71){if(_0x198c71['type']!==_0x9711('0x3f')){var _0x3f6652={};_0x3f6652[_0x198c71['name']]={'$like':'%'+_0x12b5fb[_0x9711('0x32')][_0x9711('0x3e')]+'%'};return _0x3f6652;}})});}_0x4a8406=_[_0x9711('0x40')]({},_0x4a8406,_0x12b5fb['options']);var _0x1498a9={'where':_0x4a8406[_0x9711('0x3c')]};return db[_0x9711('0x2c')][_0x9711('0x1f')](_0x1498a9)['then'](function(_0x557fcb){_0x448ae6[_0x9711('0x1f')]=_0x557fcb;if(_0x12b5fb[_0x9711('0x32')][_0x9711('0x41')]){_0x4a8406[_0x9711('0x42')]=[{'all':!![]}];}return db[_0x9711('0x2c')]['findAll'](_0x4a8406);})[_0x9711('0x13')](function(_0xa00a05){_0x448ae6[_0x9711('0x43')]=_0xa00a05;return _0x448ae6;})['then'](respondWithFilteredResult(_0x76c128,_0x4a8406))[_0x9711('0x1b')](handleError(_0x76c128,null));};exports[_0x9711('0x44')]=function(_0x52707c,_0x5d96ea){var _0x278c83={'raw':!![],'where':{'id':_0x52707c[_0x9711('0x45')]['id']}},_0x1c523f={};_0x1c523f['model']=_['keys'](db[_0x9711('0x2c')][_0x9711('0x2d')]);_0x1c523f['query']=_[_0x9711('0x33')](_0x52707c[_0x9711('0x32')]);_0x1c523f[_0x9711('0x34')]=_[_0x9711('0x35')](_0x1c523f['model'],_0x1c523f[_0x9711('0x32')]);_0x278c83[_0x9711('0x37')]=_['intersection'](_0x1c523f[_0x9711('0x30')],qs[_0x9711('0x36')](_0x52707c[_0x9711('0x32')]['fields']));_0x278c83[_0x9711('0x37')]=_0x278c83[_0x9711('0x37')][_0x9711('0x46')]?_0x278c83['attributes']:_0x1c523f['model'];if(_0x52707c[_0x9711('0x32')][_0x9711('0x41')]){_0x278c83[_0x9711('0x42')]=[{'all':!![]}];}_0x278c83=_[_0x9711('0x40')]({},_0x278c83,_0x52707c['options']);return db[_0x9711('0x2c')][_0x9711('0x47')](_0x278c83)[_0x9711('0x13')](handleEntityNotFound(_0x5d96ea,null))['then'](respondWithResult(_0x5d96ea,null))[_0x9711('0x1b')](handleError(_0x5d96ea,null));};exports[_0x9711('0x24')]=function(_0x26a4cf,_0x54f2dc){if(_0x26a4cf[_0x9711('0x48')]['id']){delete _0x26a4cf[_0x9711('0x48')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x26a4cf[_0x9711('0x45')]['id']}})['then'](handleEntityNotFound(_0x54f2dc,null))[_0x9711('0x13')](saveUpdates(_0x26a4cf[_0x9711('0x48')],null))[_0x9711('0x13')](respondWithResult(_0x54f2dc,null))['catch'](handleError(_0x54f2dc,null));};exports['destroy']=function(_0x52e633,_0x8cb625){return db[_0x9711('0x2c')][_0x9711('0x47')]({'where':{'id':_0x52e633[_0x9711('0x45')]['id']}})[_0x9711('0x13')](handleEntityNotFound(_0x8cb625,null))[_0x9711('0x13')](removeEntity(_0x8cb625,null))[_0x9711('0x1b')](handleError(_0x8cb625,null));};exports[_0x9711('0x49')]=function(_0x43097c,_0x3e79bb){return db[_0x9711('0x2c')][_0x9711('0x49')]()[_0x9711('0x13')](respondWithResult(_0x3e79bb,null))[_0x9711('0x1b')](handleError(_0x3e79bb,null));};exports[_0x9711('0x4a')]=function(_0x52a7bb,_0x139eb2){return db[_0x9711('0x2c')][_0x9711('0x4a')](_0x52a7bb[_0x9711('0x48')])[_0x9711('0x13')](function(_0x45f63f){if(_0x45f63f){if(_0x45f63f[_0x9711('0x4b')]===_0x9711('0x4c')&&!_0x45f63f[_0x9711('0x4d')]){var _0x22256a,_0x3dbaaf,_0x45fc0d;if(_0x52a7bb[_0x9711('0x48')]['to']){_0x3dbaaf=_0x52a7bb['body']['to'][_0x9711('0x4e')](',')[0x0];}return db[_0x9711('0x4f')]['findOne']({'where':{'id':_0x45f63f[_0x9711('0x50')]},'include':[{'model':db['CmList'],'as':_0x9711('0x51'),'include':[{'model':db[_0x9711('0x52')],'as':'Contacts','where':{'email':_0x3dbaaf},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x9711('0x53')],'as':_0x9711('0x54'),'raw':!![],'include':[{'model':db[_0x9711('0x55')],'as':_0x9711('0x55'),'raw':!![]}]}]})[_0x9711('0x13')](function(_0x2a97a8){_0x22256a=_0x2a97a8;if(!_0x22256a||!_0x22256a[_0x9711('0x54')])return;var _0x43d7d9=_0x22256a[_0x9711('0x56')]();if(_0x52a7bb[_0x9711('0x48')][_0x9711('0x57')]&&_0x52a7bb[_0x9711('0x48')][_0x9711('0x57')]['length']){for(var _0x13acd8=0x0;_0x13acd8<_0x52a7bb[_0x9711('0x48')]['attachments'][_0x9711('0x46')];_0x13acd8+=0x1){_0x52a7bb[_0x9711('0x48')]['attachments'][_0x13acd8]={'filename':_0x52a7bb[_0x9711('0x48')][_0x9711('0x57')][_0x13acd8][_0x9711('0x29')],'path':path[_0x9711('0x58')](config['root'],_0x9711('0x59'),_0x52a7bb[_0x9711('0x48')][_0x9711('0x57')][_0x13acd8]['basename'])};}}_0x45fc0d={'account':_0x43d7d9,'message':_0x52a7bb[_0x9711('0x48')]};return;})[_0x9711('0x13')](function(){if(_0x22256a['List']){if(_0x22256a['List']['Contacts']['length']){return _0x22256a[_0x9711('0x51')][_0x9711('0x5a')][0x0];}else{return db[_0x9711('0x52')][_0x9711('0x4a')](_['defaults'](_0x52a7bb['body'],{'firstName':_0x52a7bb[_0x9711('0x48')]['to'],'email':_0x52a7bb[_0x9711('0x48')]['to'],'phone':_0x52a7bb[_0x9711('0x48')]['to'],'ListId':_0x22256a[_0x9711('0x5b')]}));}}else{throw new Error(_0x9711('0x5c'));}})[_0x9711('0x13')](function(){if(_0x45fc0d){return respondWithRpcPromise('SendMail','sendMail',_0x45fc0d,client9003)[_0x9711('0x13')](function(_0x2eaeee){return _0x45f63f[_0x9711('0x24')]({'read':!![],'messageId':_0x2eaeee[_0x9711('0x5d')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x3f3102){logger['error']('%s',JSON[_0x9711('0x5e')](_0x3f3102));return _0x45f63f;});}return _0x45f63f;});}return _0x45f63f;}})[_0x9711('0x13')](respondWithResult(_0x139eb2,0xc9))[_0x9711('0x1b')](handleError(_0x139eb2,null));};exports[_0x9711('0x5f')]=function(_0x8daa32,_0x3cf293){var _0x26eaa3={'agent':{},'channel':_0x9711('0x60')};if(_0x8daa32[_0x9711('0x48')]['id']){delete _0x8daa32['body']['id'];}_0x8daa32[_0x9711('0x48')]['read']=!![];_0x8daa32['body']['readAt']=moment()[_0x9711('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x8daa32[_0x9711('0x48')]['UserId']=_0x8daa32[_0x9711('0x48')][_0x9711('0x62')]||_0x8daa32[_0x9711('0x63')]['id'];_0x26eaa3[_0x9711('0x64')]['id']=_0x8daa32[_0x9711('0x48')]['UserId'];return db['MailMessage'][_0x9711('0x47')]({'where':{'id':_0x8daa32[_0x9711('0x45')]['id'],'UserId':null}})[_0x9711('0x13')](handleEntityNotFound(_0x3cf293,null))['then'](saveUpdates(_0x8daa32['body'],null))[_0x9711('0x13')](function(_0x5b041f){if(_0x5b041f){_0x26eaa3[_0x9711('0x1a')]=_0x5b041f[_0x9711('0x65')]({'plain':!![]});return db[_0x9711('0x66')]['find']({'where':{'id':_0x5b041f[_0x9711('0x67')]}});}return null;})[_0x9711('0x13')](handleEntityNotFound(_0x3cf293,null))[_0x9711('0x13')](function(_0x1c70be){if(_0x1c70be){return _0x1c70be['update']({'UserId':_0x8daa32[_0x9711('0x48')][_0x9711('0x62')],'read1stAt':_[_0x9711('0x68')](_0x1c70be[_0x9711('0x69')])?moment()[_0x9711('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9711('0x13')](function(_0x179791){if(_0x179791){_0x26eaa3[_0x9711('0x6a')]=_0x179791[_0x9711('0x65')]({'plain':!![]});interaction_log[_0x9711('0x14')](_0x9711('0x6b'),_0x8daa32[_0x9711('0x63')]['id'],_0x8daa32[_0x9711('0x63')]['name'],_0x8daa32[_0x9711('0x63')][_0x9711('0x6c')],_0x26eaa3['interaction']['id'],_0x8daa32[_0x9711('0x48')]?JSON[_0x9711('0x5e')](_0x8daa32[_0x9711('0x48')]):_0x9711('0x6d'));return respondWithRpcPromise(_0x9711('0x6e'),_0x9711('0x6f'),_0x26eaa3);}return null;})[_0x9711('0x13')](function(_0x573cb3){var _0x3c22eb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x573cb3[_0x9711('0x1a')][_0x9711('0x70')];return db[_0x9711('0x71')][_0x9711('0x32')](_0x3c22eb,{'type':db['Sequelize'][_0x9711('0x72')][_0x9711('0x73')],'raw':!![]})[_0x9711('0x13')](function(_0x14e627){return _0x14e627;});})['then'](function(_0x345c35){if(_0x345c35){_0x26eaa3[_0x9711('0x1a')][_0x9711('0x74')]=_0x345c35[0x0];if(!_0x8daa32['body']['UserId'])return;return db['User'][_0x9711('0x47')]({'where':{'id':_0x8daa32[_0x9711('0x48')]['UserId'],'role':_0x9711('0x64')},'attributes':['id',_0x9711('0x29'),_0x9711('0x75'),_0x9711('0x76'),'internal'],'raw':!![]});}return null;})[_0x9711('0x13')](function(_0x2040a0){if(!_0x2040a0)return null;_0x26eaa3[_0x9711('0x1a')][_0x9711('0x64')]=_0x2040a0;return _0x26eaa3;})[_0x9711('0x13')](function(_0x4d8cb1){if(_0x4d8cb1){if(_0x8daa32[_0x9711('0x48')]['manual']){_0x26eaa3[_0x9711('0x1a')][_0x9711('0x77')]=util[_0x9711('0x61')](_0x9711('0x78'),_0x8daa32[_0x9711('0x63')]['name']);_0x26eaa3[_0x9711('0x1a')][_0x9711('0x79')]=_0x26eaa3[_0x9711('0x79')];_0x26eaa3[_0x9711('0x1a')]['motionChannel']=_0x26eaa3[_0x9711('0x79')];_0x26eaa3['message'][_0x9711('0x7a')]=_0x9711('0x5f');_0x26eaa3['message'][_0x9711('0x48')]=htmlToText[_0x9711('0x7b')](_0x26eaa3[_0x9711('0x1a')]['body']);return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x26eaa3['message']},client9002)[_0x9711('0x13')](function(){return _0x26eaa3;});}return _0x26eaa3;}return null;})[_0x9711('0x13')](respondWithResult(_0x3cf293,null))[_0x9711('0x1b')](handleError(_0x3cf293,null));};exports[_0x9711('0x7c')]=function(_0x5917c0,_0xf0b042){var _0x3cbfd5={'agent':{},'channel':_0x9711('0x60')};if(_0x5917c0[_0x9711('0x48')]['id']){delete _0x5917c0[_0x9711('0x48')]['id'];}_0x5917c0[_0x9711('0x48')][_0x9711('0x62')]=_0x5917c0[_0x9711('0x48')][_0x9711('0x62')]||_0x5917c0[_0x9711('0x63')]['id'];_0x3cbfd5['agent']['id']=_0x5917c0[_0x9711('0x48')][_0x9711('0x62')];return db[_0x9711('0x2c')][_0x9711('0x47')]({'where':{'id':_0x5917c0[_0x9711('0x45')]['id'],'UserId':null}})[_0x9711('0x13')](handleEntityNotFound(_0xf0b042,null))[_0x9711('0x13')](function(_0x2b7d66){if(_0x2b7d66){_0x3cbfd5[_0x9711('0x1a')]=_0x2b7d66[_0x9711('0x65')]({'plain':!![]});return db[_0x9711('0x66')][_0x9711('0x47')]({'where':{'id':_0x2b7d66[_0x9711('0x67')]}});}return null;})[_0x9711('0x13')](handleEntityNotFound(_0xf0b042,null))[_0x9711('0x13')](function(_0x39526a){if(_0x39526a){_0x3cbfd5[_0x9711('0x6a')]=_0x39526a[_0x9711('0x65')]({'plain':!![]});interaction_log['info'](_0x9711('0x7d'),_0x5917c0[_0x9711('0x63')]['id'],_0x5917c0[_0x9711('0x63')][_0x9711('0x29')],_0x5917c0[_0x9711('0x63')][_0x9711('0x6c')],_0x3cbfd5['interaction']['id'],_0x5917c0['body']?JSON['stringify'](_0x5917c0['body']):_0x9711('0x6d'));return respondWithRpcPromise(_0x9711('0x7e'),_0x9711('0x7f'),_0x3cbfd5);}return null;})[_0x9711('0x13')](function(_0x496afe){var _0x1c0880=_0x9711('0x80')+_0x496afe['message'][_0x9711('0x70')];return db[_0x9711('0x71')][_0x9711('0x32')](_0x1c0880,{'type':db[_0x9711('0x81')][_0x9711('0x72')][_0x9711('0x73')],'raw':!![]})[_0x9711('0x13')](function(_0xc37036){return _0xc37036;});})[_0x9711('0x13')](function(_0x151911){if(_0x151911){_0x3cbfd5[_0x9711('0x1a')][_0x9711('0x74')]=_0x151911[0x0];if(!_0x5917c0[_0x9711('0x48')][_0x9711('0x62')])return;return db[_0x9711('0x82')]['find']({'where':{'id':_0x5917c0[_0x9711('0x48')][_0x9711('0x62')],'role':_0x9711('0x64')},'attributes':['id',_0x9711('0x29'),_0x9711('0x75'),_0x9711('0x76'),_0x9711('0x83')],'raw':!![]});}return null;})['then'](function(_0x954772){if(!_0x954772)return null;_0x3cbfd5[_0x9711('0x1a')][_0x9711('0x64')]=_0x954772;return _0x3cbfd5;})[_0x9711('0x13')](function(_0x1011c6){if(_0x1011c6){_0x1011c6[_0x9711('0x1a')][_0x9711('0x77')]=util['format']('SIP/%s',_0x5917c0[_0x9711('0x63')][_0x9711('0x29')]);_0x1011c6[_0x9711('0x1a')][_0x9711('0x79')]=_0x3cbfd5[_0x9711('0x79')];_0x1011c6[_0x9711('0x1a')][_0x9711('0x84')]=_0x3cbfd5[_0x9711('0x79')];_0x1011c6[_0x9711('0x1a')][_0x9711('0x7a')]=_0x9711('0x7c');_0x1011c6[_0x9711('0x1a')][_0x9711('0x48')]=htmlToText[_0x9711('0x7b')](_0x3cbfd5['message'][_0x9711('0x48')]);respondWithRpcPromise(_0x9711('0x85'),'EventManager',{'event':'rejectmessage','message':_0x1011c6[_0x9711('0x1a')]},client9002);return _0x3cbfd5;}return null;})['then'](respondWithResult(_0xf0b042,null))[_0x9711('0x1b')](handleError(_0xf0b042,null));};exports[_0x9711('0x86')]=function(_0x12a1fc,_0x583f5e){var _0x4a1470=moment()['unix']()[_0x9711('0x87')]();var _0x368d8b=path[_0x9711('0x58')](config[_0x9711('0x88')],_0x9711('0x89'),_0x9711('0x8a'),'tmp');var _0x1564d8=path[_0x9711('0x58')](config['root'],_0x9711('0x89'),_0x9711('0x8a'),_0x9711('0x57'));var _0x4caf24=util[_0x9711('0x61')](_0x9711('0x8b'),_0x4a1470);return db[_0x9711('0x2c')][_0x9711('0x47')]({'where':{'id':_0x12a1fc[_0x9711('0x45')]['id']},'attributes':['id','body',_0x9711('0x8c'),'to','cc',_0x9711('0x8d'),_0x9711('0x8e'),_0x9711('0x8f')],'include':_0x12a1fc[_0x9711('0x32')][_0x9711('0x57')]?[{'model':db[_0x9711('0x90')],'as':_0x9711('0x91')}]:undefined})[_0x9711('0x13')](handleEntityNotFound(_0x583f5e,null))[_0x9711('0x13')](function(_0x31dc66){if(_0x31dc66){var _0x479c30=_0x31dc66;var _0x3395ee={'from':_0x479c30[_0x9711('0x8c')],'to':_0x479c30['to'],'subject':_0x479c30[_0x9711('0x8e')],'html':htmlEntities[_0x9711('0x92')](_0x479c30[_0x9711('0x48')]),'headers':{'Date':moment(_0x479c30[_0x9711('0x8f')])[_0x9711('0x61')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x31dc66['cc']){_0x3395ee[_0x9711('0x93')]['Cc']=_0x31dc66['cc'];}if(_0x31dc66[_0x9711('0x8d')]){_0x3395ee[_0x9711('0x93')][_0x9711('0x94')]=_0x31dc66[_0x9711('0x8d')];}return new BPromise(function(_0x306e25,_0x3c4820){if(_0x31dc66[_0x9711('0x91')]){for(var _0x31c55a=0x0;_0x31c55a<_0x31dc66[_0x9711('0x91')][_0x9711('0x46')];_0x31c55a++){var _0x4de483=_0x31dc66['Attachments'][_0x31c55a];var _0x131d64=path[_0x9711('0x58')](_0x1564d8,_0x4de483[_0x9711('0x95')]);if(fs[_0x9711('0x96')](_0x131d64)){_0x3395ee[_0x9711('0x57')][_0x9711('0x97')]({'name':_0x4de483[_0x9711('0x29')],'contentType':_0x4de483['type'],'data':fs[_0x9711('0x98')](_0x131d64)});}}}emlformat[_0x9711('0x99')](_0x3395ee,function(_0x525c57,_0xa720b2){if(_0x525c57)return _0x3c4820(_0x525c57);fs[_0x9711('0x9a')](path[_0x9711('0x58')](_0x368d8b,_0x4caf24),_0xa720b2);return _0x306e25(_0xa720b2);});});}})[_0x9711('0x13')](function(_0x3d3958){if(_0x3d3958){return _0x583f5e[_0x9711('0x86')](path['join'](_0x368d8b,_0x4caf24),_0x4caf24,function(_0x46abe3){if(!_0x46abe3)fs[_0x9711('0x9b')](path[_0x9711('0x58')](_0x368d8b,_0x4caf24));});}})[_0x9711('0x1b')](handleError(_0x583f5e,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index bbbf647..d09450a 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 _0x1de8=['exports','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x5ad44d,_0x30eee8){var _0x258cbd=function(_0x1b9c18){while(--_0x1b9c18){_0x5ad44d['push'](_0x5ad44d['shift']());}};_0x258cbd(++_0x30eee8);}(_0x1de8,0x131));var _0x81de=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x1de8[_0x72a33d];return _0x2621d5;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x81de('0x0'))['db'][_0x81de('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x81de('0x2')](0x0);var events={'afterCreate':_0x81de('0x3'),'afterUpdate':'update','afterDestroy':_0x81de('0x4')};function emitEvent(_0x968533){return function(_0x2f556d,_0x420167,_0x141513){MailMessageEvents[_0x81de('0x5')](_0x968533+':'+_0x2f556d['id'],_0x2f556d);MailMessageEvents[_0x81de('0x5')](_0x968533,_0x2f556d);_0x141513(null);};}for(var e in events){if(events[_0x81de('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x81de('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xfb54=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x425dbc,_0x3f9342){var _0x1a5f1e=function(_0x401b59){while(--_0x401b59){_0x425dbc['push'](_0x425dbc['shift']());}};_0x1a5f1e(++_0x3f9342);}(_0xfb54,0xa0));var _0x4fb5=function(_0x354a6f,_0x1b674e){_0x354a6f=_0x354a6f-0x0;var _0x3d2468=_0xfb54[_0x354a6f];return _0x3d2468;};'use strict';var EventEmitter=require(_0x4fb5('0x0'));var MailMessage=require(_0x4fb5('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4fb5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4fb5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x540822){return function(_0x10fe45,_0x135e4d,_0x4b9a90){MailMessageEvents[_0x4fb5('0x4')](_0x540822+':'+_0x10fe45['id'],_0x10fe45);MailMessageEvents[_0x4fb5('0x4')](_0x540822,_0x10fe45);_0x4b9a90(null);};}for(var e in events){if(events[_0x4fb5('0x5')](e)){var event=events[e];MailMessage[_0x4fb5('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 1f5f31a..f299449 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 _0x7469=['update','catch','error','lodash','../../config/logger','bluebird','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','models','get','toLowerCase','direction','out','isNil','findOne','MailInteractionId','then'];(function(_0x9c06ff,_0x33da86){var _0x368b93=function(_0x24f4e7){while(--_0x24f4e7){_0x9c06ff['push'](_0x9c06ff['shift']());}};_0x368b93(++_0x33da86);}(_0x7469,0x1df));var _0x9746=function(_0x2a6538,_0x304c58){_0x2a6538=_0x2a6538-0x0;var _0x3af8e9=_0x7469[_0x2a6538];return _0x3af8e9;};'use strict';var _=require(_0x9746('0x0'));var util=require('util');var logger=require(_0x9746('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9746('0x2'));var rp=require('request-promise');var htmlToText=require(_0x9746('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9746('0x4'));var config=require(_0x9746('0x5'));var attributes=require(_0x9746('0x6'));module[_0x9746('0x7')]=function(_0x552717,_0x8d2307){return _0x552717[_0x9746('0x8')](_0x9746('0x9'),attributes,{'tableName':_0x9746('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x9746('0xb')]},{'name':'fti_mail_messages','fields':[_0x9746('0xc'),_0x9746('0xd')],'type':_0x9746('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x581745,_0x34ef2e,_0x45e7a1){if(_0x581745[_0x9746('0xf')]){_0x581745['plainBody']=htmlToText['fromString'](_0x581745[_0x9746('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x45e7a1(null,_0x34ef2e);},'afterCreate':function(_0x4b3c32,_0x2c5fd7,_0xa51e01){var _0x50a62e=_0x552717[_0x9746('0x10')];var _0x19084d=_0x4b3c32[_0x9746('0x11')]({'plain':!![]});if(_0x19084d['direction'][_0x9746('0x12')]()==='in'||_0x19084d[_0x9746('0x13')][_0x9746('0x12')]()===_0x9746('0x14')&&!_0x19084d['secret']&&!_[_0x9746('0x15')](_0x19084d['UserId'])){_0x50a62e['MailInteraction'][_0x9746('0x16')]({'where':{'id':_0x19084d[_0x9746('0x17')]}})[_0x9746('0x18')](function(_0x4aec4c){if(_0x4aec4c){_0x4aec4c[_0x9746('0x19')]({'lastMsgAt':_0x19084d['createdAt'],'lastMsgDirection':_0x19084d[_0x9746('0x13')][_0x9746('0x12')]()});}})[_0x9746('0x1a')](function(_0x5dfeb5){console[_0x9746('0x1b')](_0x5dfeb5);});}_0xa51e01();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3861=['messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x3861,0xbb));var _0x1386=function(_0x5e638f,_0x3aad42){_0x5e638f=_0x5e638f-0x0;var _0xf7a0cc=_0x3861[_0x5e638f];return _0xf7a0cc;};'use strict';var _=require(_0x1386('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1386('0x1'));var moment=require('moment');var BPromise=require(_0x1386('0x2'));var rp=require(_0x1386('0x3'));var htmlToText=require(_0x1386('0x4'));var fs=require('fs');var path=require(_0x1386('0x5'));var rimraf=require(_0x1386('0x6'));var config=require(_0x1386('0x7'));var attributes=require(_0x1386('0x8'));module[_0x1386('0x9')]=function(_0x5030f5,_0xc11bb2){return _0x5030f5[_0x1386('0xa')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x1386('0xb')]},{'name':_0x1386('0xc'),'fields':['plainBody',_0x1386('0xd')],'type':_0x1386('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x309e42,_0x3436c0,_0x127026){if(_0x309e42[_0x1386('0xf')]){_0x309e42[_0x1386('0x10')]=htmlToText[_0x1386('0x11')](_0x309e42[_0x1386('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x127026(null,_0x3436c0);},'afterCreate':function(_0x2dbb0a,_0x1ab5ef,_0xfcfe5a){var _0x2be6d0=_0x5030f5[_0x1386('0x12')];var _0x8aac76=_0x2dbb0a[_0x1386('0x13')]({'plain':!![]});if(_0x8aac76['direction']['toLowerCase']()==='in'||_0x8aac76[_0x1386('0x14')][_0x1386('0x15')]()===_0x1386('0x16')&&!_0x8aac76[_0x1386('0x17')]&&!_[_0x1386('0x18')](_0x8aac76['UserId'])){_0x2be6d0[_0x1386('0x19')][_0x1386('0x1a')]({'where':{'id':_0x8aac76['MailInteractionId']}})[_0x1386('0x1b')](function(_0x485abe){if(_0x485abe){_0x485abe[_0x1386('0x1c')]({'lastMsgAt':_0x8aac76[_0x1386('0x1d')],'lastMsgDirection':_0x8aac76[_0x1386('0x14')][_0x1386('0x15')]()});}})[_0x1386('0x1e')](function(_0x41ed38){console[_0x1386('0x1f')](_0x41ed38);});}_0xfcfe5a();}},'charset':'utf8mb4','collate':_0x1386('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 4858a92..4fac2bc 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 _0x3423=['./mailMessage.socket','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','CreateMailMessage','MailMessage','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x30b886,_0x37708b){var _0x1d0e8a=function(_0xfa6edc){while(--_0xfa6edc){_0x30b886['push'](_0x30b886['shift']());}};_0x1d0e8a(++_0x37708b);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3342('0x0'));var BPromise=require(_0x3342('0x1'));var rs=require(_0x3342('0x2'));var fs=require('fs');var Redis=require(_0x3342('0x3'));var db=require(_0x3342('0x4'))['db'];var utils=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var config=require(_0x3342('0x8'));var jayson=require(_0x3342('0x9'));var client=jayson[_0x3342('0xa')][_0x3342('0xb')]({'port':0x232a});config[_0x3342('0xc')]=_[_0x3342('0xd')](config[_0x3342('0xc')],{'host':_0x3342('0xe'),'port':0x18eb});var socket=require(_0x3342('0xf'))(new Redis(config[_0x3342('0xc')]));require(_0x3342('0x10'))['register'](socket);function respondWithRpcPromise(_0x582c37,_0x2d0cb0,_0x481a17){return new BPromise(function(_0x5a1fba,_0x51b276){return client['request'](_0x582c37,_0x481a17)[_0x3342('0x11')](function(_0x2f3c47){logger['info'](_0x3342('0x12'),_0x2d0cb0,'request\x20sent');logger[_0x3342('0x13')](_0x3342('0x14'),_0x2d0cb0,'request\x20sent',JSON[_0x3342('0x15')](_0x2f3c47));if(_0x2f3c47[_0x3342('0x16')]){if(_0x2f3c47[_0x3342('0x16')][_0x3342('0x17')]===0x1f4){logger[_0x3342('0x16')](_0x3342('0x12'),_0x2d0cb0,_0x2f3c47[_0x3342('0x16')]['message']);return _0x51b276(_0x2f3c47[_0x3342('0x16')][_0x3342('0x18')]);}logger['error'](_0x3342('0x12'),_0x2d0cb0,_0x2f3c47[_0x3342('0x16')]['message']);return _0x5a1fba(_0x2f3c47['error'][_0x3342('0x18')]);}else{logger[_0x3342('0x19')](_0x3342('0x12'),_0x2d0cb0,_0x3342('0x1a'));_0x5a1fba(_0x2f3c47[_0x3342('0x1b')][_0x3342('0x18')]);}})[_0x3342('0x1c')](function(_0x3ebf6b){logger[_0x3342('0x16')]('MailMessage,\x20%s,\x20%s',_0x2d0cb0,_0x3ebf6b);_0x51b276(_0x3ebf6b);});});}exports[_0x3342('0x1d')]=function(_0xda235a){var _0x2f6395=this;return new Promise(function(_0x5e05f5,_0x3cb86f){return db[_0x3342('0x1e')]['create'](_0xda235a[_0x3342('0x1f')],{'raw':_0xda235a[_0x3342('0x20')]?_0xda235a['options'][_0x3342('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x3f271c){logger[_0x3342('0x19')](_0x3342('0x1d'),_0xda235a);logger[_0x3342('0x13')](_0x3342('0x1d'),_0xda235a,JSON[_0x3342('0x15')](_0x3f271c));_0x5e05f5(_0x3f271c);})[_0x3342('0x1c')](function(_0x2d8622){logger['error'](_0x3342('0x1d'),_0x2d8622['message'],_0xda235a);_0x3cb86f(_0x2f6395['error'](0x1f4,_0x2d8622[_0x3342('0x18')]));});});}; \ No newline at end of file +var _0x958a=['./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2dc35d,_0x2ef6f9){var _0x484204=function(_0x52267e){while(--_0x52267e){_0x2dc35d['push'](_0x2dc35d['shift']());}};_0x484204(++_0x2ef6f9);}(_0x958a,0x128));var _0xa958=function(_0x495adc,_0x1edd2a){_0x495adc=_0x495adc-0x0;var _0x4494c2=_0x958a[_0x495adc];return _0x4494c2;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});config[_0xa958('0xb')]=_[_0xa958('0xc')](config[_0xa958('0xb')],{'host':_0xa958('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa958('0xe'))[_0xa958('0xf')](socket);function respondWithRpcPromise(_0x11f090,_0x44b66e,_0x37afa0){return new BPromise(function(_0x94caac,_0xebb1c6){return client[_0xa958('0x10')](_0x11f090,_0x37afa0)[_0xa958('0x11')](function(_0x250999){logger[_0xa958('0x12')](_0xa958('0x13'),_0x44b66e,_0xa958('0x14'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x44b66e,'request\x20sent',JSON[_0xa958('0x15')](_0x250999));if(_0x250999[_0xa958('0x16')]){if(_0x250999[_0xa958('0x16')]['code']===0x1f4){logger[_0xa958('0x16')]('MailMessage,\x20%s,\x20%s',_0x44b66e,_0x250999['error']['message']);return _0xebb1c6(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0x250999[_0xa958('0x16')][_0xa958('0x17')]);return _0x94caac(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}else{logger['info'](_0xa958('0x13'),_0x44b66e,'request\x20sent');_0x94caac(_0x250999[_0xa958('0x18')][_0xa958('0x17')]);}})['catch'](function(_0xe4129a){logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0xe4129a);_0xebb1c6(_0xe4129a);});});}exports[_0xa958('0x19')]=function(_0x2759ad){var _0x1f82aa=this;return new Promise(function(_0x56314b,_0x4a90c2){return db[_0xa958('0x1a')][_0xa958('0x1b')](_0x2759ad[_0xa958('0x1c')],{'raw':_0x2759ad['options']?_0x2759ad[_0xa958('0x1d')][_0xa958('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x28cf12){logger[_0xa958('0x12')]('CreateMailMessage',_0x2759ad);logger['debug'](_0xa958('0x19'),_0x2759ad,JSON[_0xa958('0x15')](_0x28cf12));_0x56314b(_0x28cf12);})['catch'](function(_0x25f461){logger[_0xa958('0x16')](_0xa958('0x19'),_0x25f461[_0xa958('0x17')],_0x2759ad);_0x4a90c2(_0x1f82aa[_0xa958('0x16')](0x1f4,_0x25f461[_0xa958('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ff4879e..a85b39e 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 _0xb05c=['remove','update','removeListener','register','mailMessage:'];(function(_0xf03ffe,_0x43e4fe){var _0x30c268=function(_0x580951){while(--_0x580951){_0xf03ffe['push'](_0xf03ffe['shift']());}};_0x30c268(++_0x43e4fe);}(_0xb05c,0x1cc));var _0xcb05=function(_0x1fbde3,_0x59da39){_0x1fbde3=_0x1fbde3-0x0;var _0x2b092f=_0xb05c[_0x1fbde3];return _0x2b092f;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0xcb05('0x0'),_0xcb05('0x1')];function createListener(_0x395675,_0x49e343){return function(_0x40d948){_0x49e343['emit'](_0x395675,_0x40d948);};}function removeListener(_0x17abb0,_0x184025){return function(){MailMessageEvents[_0xcb05('0x2')](_0x17abb0,_0x184025);};}exports[_0xcb05('0x3')]=function(_0x6fe3b6){for(var _0x4c71ec=0x0,_0x579ade=events['length'];_0x4c71ec<_0x579ade;_0x4c71ec++){var _0xb4e403=events[_0x4c71ec];var _0x72103d=createListener(_0xcb05('0x4')+_0xb4e403,_0x6fe3b6);MailMessageEvents['on'](_0xb4e403,_0x72103d);}}; \ No newline at end of file +var _0x9ba9=['emit','removeListener','length','save','remove'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0x9ba9,0xb2));var _0x99ba=function(_0x4816b3,_0x10e8cb){_0x4816b3=_0x4816b3-0x0;var _0x2e6b77=_0x9ba9[_0x4816b3];return _0x2e6b77;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x99ba('0x0'),_0x99ba('0x1'),'update'];function createListener(_0x240be0,_0x49ec68){return function(_0x47d494){_0x49ec68[_0x99ba('0x2')](_0x240be0,_0x47d494);};}function removeListener(_0xe39c35,_0x5dfb1e){return function(){MailMessageEvents[_0x99ba('0x3')](_0xe39c35,_0x5dfb1e);};}exports['register']=function(_0x42c538){for(var _0x323f0c=0x0,_0x2c4f8b=events[_0x99ba('0x4')];_0x323f0c<_0x2c4f8b;_0x323f0c++){var _0x245aa4=events[_0x323f0c];var _0x29a914=createListener('mailMessage:'+_0x245aa4,_0x42c538);MailMessageEvents['on'](_0x245aa4,_0x29a914);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 61e3822..eb860e0 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 _0x2e68=['post','addTeams','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./mailQueue.controller','isAuthenticated','get','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create'];(function(_0x36437d,_0x20f128){var _0x53dd0c=function(_0x3f70aa){while(--_0x3f70aa){_0x36437d['push'](_0x36437d['shift']());}};_0x53dd0c(++_0x20f128);}(_0x2e68,0xe9));var _0x82e6=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x2e68[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0x82e6('0x0'));var util=require(_0x82e6('0x1'));var path=require(_0x82e6('0x2'));var timeout=require(_0x82e6('0x3'));var express=require('express');var router=express[_0x82e6('0x4')]();var fs_extra=require(_0x82e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x82e6('0x6'));var config=require('../../config/environment');var controller=require(_0x82e6('0x7'));router['get']('/',auth[_0x82e6('0x8')](),controller['index']);router[_0x82e6('0x9')](_0x82e6('0xa'),auth['isAuthenticated'](),controller[_0x82e6('0xb')]);router[_0x82e6('0x9')]('/:id',auth[_0x82e6('0x8')](),controller[_0x82e6('0xc')]);router[_0x82e6('0x9')](_0x82e6('0xd'),auth[_0x82e6('0x8')](),controller[_0x82e6('0xe')]);router[_0x82e6('0x9')](_0x82e6('0xf'),auth[_0x82e6('0x8')](),controller[_0x82e6('0x10')]);router[_0x82e6('0x9')](_0x82e6('0x11'),auth[_0x82e6('0x8')](),controller['getAgents']);router['post']('/',auth[_0x82e6('0x8')](),controller[_0x82e6('0x12')]);router[_0x82e6('0x13')](_0x82e6('0xf'),auth[_0x82e6('0x8')](),controller[_0x82e6('0x14')]);router[_0x82e6('0x13')](_0x82e6('0x11'),auth[_0x82e6('0x8')](),controller['addAgents']);router['put'](_0x82e6('0x15'),auth[_0x82e6('0x8')](),controller[_0x82e6('0x16')]);router[_0x82e6('0x17')](_0x82e6('0x15'),auth[_0x82e6('0x8')](),controller[_0x82e6('0x18')]);router[_0x82e6('0x17')](_0x82e6('0xf'),auth[_0x82e6('0x8')](),controller[_0x82e6('0x19')]);router[_0x82e6('0x17')]('/:id/users',auth[_0x82e6('0x8')](),controller[_0x82e6('0x1a')]);module[_0x82e6('0x1b')]=router; \ No newline at end of file +var _0x2493=['removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/users','create','/:id/teams','addTeams','post','addAgents','put','update','delete','destroy'];(function(_0x24169e,_0x4d07b1){var _0xa3b342=function(_0x5d234d){while(--_0x5d234d){_0x24169e['push'](_0x24169e['shift']());}};_0xa3b342(++_0x4d07b1);}(_0x2493,0x18a));var _0x3249=function(_0x4e7276,_0x2f9d62){_0x4e7276=_0x4e7276-0x0;var _0x2d35a4=_0x2493[_0x4e7276];return _0x2d35a4;};'use strict';var multer=require(_0x3249('0x0'));var util=require('util');var path=require(_0x3249('0x1'));var timeout=require(_0x3249('0x2'));var express=require(_0x3249('0x3'));var router=express[_0x3249('0x4')]();var fs_extra=require(_0x3249('0x5'));var auth=require(_0x3249('0x6'));var interaction=require(_0x3249('0x7'));var config=require(_0x3249('0x8'));var controller=require(_0x3249('0x9'));router[_0x3249('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3249('0xa')]('/describe',auth[_0x3249('0xb')](),controller[_0x3249('0xc')]);router[_0x3249('0xa')](_0x3249('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x3249('0xa')](_0x3249('0xe'),auth['isAuthenticated'](),controller[_0x3249('0xf')]);router[_0x3249('0xa')]('/:id/teams',auth[_0x3249('0xb')](),controller['getTeams']);router[_0x3249('0xa')](_0x3249('0x10'),auth[_0x3249('0xb')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x3249('0x11')]);router['post'](_0x3249('0x12'),auth['isAuthenticated'](),controller[_0x3249('0x13')]);router[_0x3249('0x14')]('/:id/users',auth[_0x3249('0xb')](),controller[_0x3249('0x15')]);router[_0x3249('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x3249('0x17')]);router[_0x3249('0x18')]('/:id',auth[_0x3249('0xb')](),controller[_0x3249('0x19')]);router[_0x3249('0x18')](_0x3249('0x12'),auth[_0x3249('0xb')](),controller['removeTeams']);router[_0x3249('0x18')](_0x3249('0x10'),auth[_0x3249('0xb')](),controller[_0x3249('0x1a')]);module[_0x3249('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 90fafda..1515f9b 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 _0x197f=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','name','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x197f,0xe5));var _0xf197=function(_0x23d17c,_0x1ed1fd){_0x23d17c=_0x23d17c-0x0;var _0x2b2e47=_0x197f[_0x23d17c];return _0x2b2e47;};'use strict';var Sequelize=require(_0xf197('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf197('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf197('0x2')]},'timeout':{'type':Sequelize[_0xf197('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf197('0x4')](_0xf197('0x5'),_0xf197('0x6'),_0xf197('0x7'))}}; \ No newline at end of file +var _0x32cc=['roundrobin','sequelize','exports','STRING','ENUM','beepall'];(function(_0x57c358,_0x250258){var _0x3b299c=function(_0x41b2de){while(--_0x41b2de){_0x57c358['push'](_0x57c358['shift']());}};_0x3b299c(++_0x250258);}(_0x32cc,0x85));var _0xc32c=function(_0x137842,_0x319515){_0x137842=_0x137842-0x0;var _0x505945=_0x32cc[_0x137842];return _0x505945;};'use strict';var Sequelize=require(_0xc32c('0x0'));module[_0xc32c('0x1')]={'name':{'type':Sequelize[_0xc32c('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc32c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc32c('0x3')]('rrmemory',_0xc32c('0x4'),_0xc32c('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 66e248c..c064b0b 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 _0xb2f2=['removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','nolimit','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','./mailQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','getOptions','findAll','catch','show','params','model','keys','MailQueue','query','intersection','length','attributes','includeAll','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserMailQueue','filters','fields','hasOwnProperty','sort','MailQueueId','filter','where','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','findOne','Team','order','pick','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','isEmpty'];(function(_0x4a0392,_0x4197a9){var _0x4c3c42=function(_0x103441){while(--_0x103441){_0x4a0392['push'](_0x4a0392['shift']());}};_0x4c3c42(++_0x4197a9);}(_0xb2f2,0x87));var _0x2b2f=function(_0x2ec7d4,_0x49050c){_0x2ec7d4=_0x2ec7d4-0x0;var _0x596308=_0xb2f2[_0x2ec7d4];return _0x596308;};'use strict';var BPromise=require(_0x2b2f('0x0'));var util=require(_0x2b2f('0x1'));var _=require(_0x2b2f('0x2'));var squel=require(_0x2b2f('0x3'));var Redis=require('ioredis');var qs=require(_0x2b2f('0x4'));var logger=require(_0x2b2f('0x5'))(_0x2b2f('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2b2f('0x7')]=_[_0x2b2f('0x8')](config[_0x2b2f('0x7')],{'host':_0x2b2f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b2f('0x7')]));require(_0x2b2f('0xa'))['register'](socket);function respondWithStatusCode(_0x2a47fb,_0x35e9d2){_0x35e9d2=_0x35e9d2||0xcc;return function(_0x3c0bbc){if(_0x3c0bbc){return _0x2a47fb[_0x2b2f('0xb')](_0x35e9d2);}return _0x2a47fb['status'](_0x35e9d2)[_0x2b2f('0xc')]();};}function respondWithResult(_0x247904,_0x2b2f12){_0x2b2f12=_0x2b2f12||0xc8;return function(_0x323643){if(_0x323643){return _0x247904[_0x2b2f('0xd')](_0x2b2f12)[_0x2b2f('0xe')](_0x323643);}};}function respondWithFilteredResult(_0xc69750,_0x582b72){return function(_0x1d6cb2){if(_0x1d6cb2){var _0x1335a1=typeof _0x582b72[_0x2b2f('0xf')]===_0x2b2f('0x10')&&typeof _0x582b72[_0x2b2f('0x11')]===_0x2b2f('0x10');var _0x87fb3b=_0x1d6cb2['count'];var _0x233222=_0x1335a1?0x0:_0x582b72[_0x2b2f('0xf')];var _0x3365f2=_0x1335a1?_0x1d6cb2[_0x2b2f('0x12')]:_0x582b72[_0x2b2f('0xf')]+_0x582b72[_0x2b2f('0x11')];var _0x34c867;if(_0x3365f2>=_0x87fb3b){_0x3365f2=_0x87fb3b;_0x34c867=0xc8;}else{_0x34c867=0xce;}_0xc69750['status'](_0x34c867);return _0xc69750[_0x2b2f('0x13')](_0x2b2f('0x14'),_0x233222+'-'+_0x3365f2+'/'+_0x87fb3b)[_0x2b2f('0xe')](_0x1d6cb2);}return null;};}function saveUpdates(_0x39c275){return function(_0x542fab){if(_0x542fab){return _0x542fab['update'](_0x39c275)[_0x2b2f('0x15')](function(_0x497728){return _0x497728;});}return null;};}function removeEntity(_0x230dd7){return function(_0x59798c){if(_0x59798c){return _0x59798c[_0x2b2f('0x16')]()[_0x2b2f('0x15')](function(){var _0x17a67b=_0x59798c[_0x2b2f('0x17')]({'plain':!![]});var _0x3b3d80='MailQueues';return db[_0x2b2f('0x18')][_0x2b2f('0x16')]({'where':{'type':_0x3b3d80,'resourceId':_0x17a67b['id']}})['then'](function(){return _0x59798c;});})[_0x2b2f('0x15')](function(){_0x230dd7[_0x2b2f('0xd')](0xcc)[_0x2b2f('0xc')]();});}};}function handleEntityNotFound(_0x41a9ba){return function(_0x96f972){if(!_0x96f972){_0x41a9ba[_0x2b2f('0xb')](0x194);}return _0x96f972;};}function handleError(_0x5b315b,_0x575426){_0x575426=_0x575426||0x1f4;return function(_0xfd2c81){logger[_0x2b2f('0x19')](_0xfd2c81['stack']);if(_0xfd2c81[_0x2b2f('0x1a')]){delete _0xfd2c81['name'];}_0x5b315b['status'](_0x575426)[_0x2b2f('0x1b')](_0xfd2c81);};}exports[_0x2b2f('0x1c')]=function(_0x2d71d5,_0xf290c){var _0x3bb586={};var _0x31020b={'count':0x0,'rows':[]};var _0x3e4423=_[_0x2b2f('0x1d')](db['MailQueue'][_0x2b2f('0x1e')],function(_0x334367){return{'name':_0x334367['fieldName'],'type':_0x334367[_0x2b2f('0x1f')][_0x2b2f('0x20')]};});_0x3bb586=qs[_0x2b2f('0x21')](_0x3e4423,_0x2d71d5);var _0x583a49={'where':_0x3bb586['where']};return db['MailQueue'][_0x2b2f('0x12')](_0x583a49)['then'](function(_0x1c38a5){_0x31020b['count']=_0x1c38a5;_0x3bb586['include']=qs['include'](_0x2d71d5['query']);return db['MailQueue'][_0x2b2f('0x22')](_0x3bb586);})[_0x2b2f('0x15')](function(_0x4529a4){_0x31020b['rows']=_0x4529a4;return _0x31020b;})[_0x2b2f('0x15')](respondWithFilteredResult(_0xf290c,_0x3bb586))[_0x2b2f('0x23')](handleError(_0xf290c,null));};exports[_0x2b2f('0x24')]=function(_0xb9c2e2,_0x362dd7){var _0x56420c={'raw':!![],'where':{'id':_0xb9c2e2[_0x2b2f('0x25')]['id']}},_0xf4a417={};_0xf4a417[_0x2b2f('0x26')]=_[_0x2b2f('0x27')](db[_0x2b2f('0x28')]['rawAttributes']);_0xf4a417[_0x2b2f('0x29')]=_[_0x2b2f('0x27')](_0xb9c2e2['query']);_0xf4a417['filters']=_['intersection'](_0xf4a417[_0x2b2f('0x26')],_0xf4a417[_0x2b2f('0x29')]);_0x56420c['attributes']=_[_0x2b2f('0x2a')](_0xf4a417[_0x2b2f('0x26')],qs['fields'](_0xb9c2e2[_0x2b2f('0x29')]['fields']));_0x56420c['attributes']=_0x56420c['attributes'][_0x2b2f('0x2b')]?_0x56420c[_0x2b2f('0x2c')]:_0xf4a417['model'];if(_0xb9c2e2[_0x2b2f('0x29')][_0x2b2f('0x2d')]){_0x56420c[_0x2b2f('0x2e')]=[{'all':!![]}];}_0x56420c=_[_0x2b2f('0x2f')]({},_0x56420c,_0xb9c2e2[_0x2b2f('0x30')]);return db[_0x2b2f('0x28')][_0x2b2f('0x31')](_0x56420c)[_0x2b2f('0x15')](handleEntityNotFound(_0x362dd7,null))[_0x2b2f('0x15')](respondWithResult(_0x362dd7,null))[_0x2b2f('0x23')](handleError(_0x362dd7,null));};exports[_0x2b2f('0x32')]=function(_0x374150,_0x5afe95){return db['MailQueue'][_0x2b2f('0x32')](_0x374150[_0x2b2f('0x33')],{})[_0x2b2f('0x15')](function(_0xf8701b){var _0x6de205=_0x374150[_0x2b2f('0x34')]['get']({'plain':!![]});if(!_0x6de205)throw new Error(_0x2b2f('0x35'));if(_0x6de205[_0x2b2f('0x36')]===_0x2b2f('0x34')){var _0x236752=_0xf8701b[_0x2b2f('0x17')]({'plain':!![]});var _0xa188b3=_0x2b2f('0x37');return db[_0x2b2f('0x38')][_0x2b2f('0x31')]({'where':{'name':_0xa188b3,'userProfileId':_0x6de205[_0x2b2f('0x39')]},'raw':!![]})[_0x2b2f('0x15')](function(_0x3c43e4){if(_0x3c43e4&&_0x3c43e4[_0x2b2f('0x3a')]===0x0){return db['UserProfileResource'][_0x2b2f('0x32')]({'name':_0x236752[_0x2b2f('0x1a')],'resourceId':_0x236752['id'],'type':_0x3c43e4[_0x2b2f('0x1a')],'sectionId':_0x3c43e4['id']},{})[_0x2b2f('0x15')](function(){return _0xf8701b;});}else{return _0xf8701b;}})['catch'](function(_0x3076a3){logger[_0x2b2f('0x19')](_0x2b2f('0x3b'),_0x3076a3);throw _0x3076a3;});}return _0xf8701b;})[_0x2b2f('0x15')](respondWithResult(_0x5afe95,0xc9))[_0x2b2f('0x23')](handleError(_0x5afe95,null));};exports[_0x2b2f('0x3c')]=function(_0x30e8f5,_0x2d1673){if(_0x30e8f5['body']['id']){delete _0x30e8f5[_0x2b2f('0x33')]['id'];}return db[_0x2b2f('0x28')][_0x2b2f('0x31')]({'where':{'id':_0x30e8f5['params']['id']}})['then'](handleEntityNotFound(_0x2d1673,null))[_0x2b2f('0x15')](saveUpdates(_0x30e8f5[_0x2b2f('0x33')],null))['then'](respondWithResult(_0x2d1673,null))[_0x2b2f('0x23')](handleError(_0x2d1673,null));};exports[_0x2b2f('0x16')]=function(_0x4421e3,_0x17845c){return db[_0x2b2f('0x28')][_0x2b2f('0x31')]({'where':{'id':_0x4421e3[_0x2b2f('0x25')]['id']}})['then'](handleEntityNotFound(_0x17845c,null))[_0x2b2f('0x15')](removeEntity(_0x17845c,null))[_0x2b2f('0x23')](handleError(_0x17845c,null));};exports[_0x2b2f('0x3d')]=function(_0x34cf25,_0x2ffe71){return db['MailQueue'][_0x2b2f('0x3d')]()[_0x2b2f('0x15')](respondWithResult(_0x2ffe71,null))[_0x2b2f('0x23')](handleError(_0x2ffe71,null));};exports[_0x2b2f('0x3e')]=function(_0x9de5e6,_0x2beadc){var _0x226008={'raw':!![],'where':{}},_0x13b32b={},_0x17df98;return db['MailQueue']['findOne']({'where':{'id':_0x9de5e6[_0x2b2f('0x25')]['id']}})[_0x2b2f('0x15')](handleEntityNotFound(_0x2beadc,null))[_0x2b2f('0x15')](function(_0x321c00){if(_0x321c00){_0x17df98=_0x321c00[_0x2b2f('0x17')]({'plain':!![]});_0x13b32b['model']=_['keys'](db[_0x2b2f('0x3f')]['rawAttributes']);_0x13b32b['query']=_[_0x2b2f('0x27')](_0x9de5e6[_0x2b2f('0x29')]);_0x13b32b[_0x2b2f('0x40')]=_['intersection'](_0x13b32b['model'],_0x13b32b[_0x2b2f('0x29')]);_0x226008[_0x2b2f('0x2c')]=_[_0x2b2f('0x2a')](_0x13b32b[_0x2b2f('0x26')],qs[_0x2b2f('0x41')](_0x9de5e6[_0x2b2f('0x29')][_0x2b2f('0x41')]));_0x226008[_0x2b2f('0x2c')]=_0x226008[_0x2b2f('0x2c')][_0x2b2f('0x2b')]?_0x226008['attributes']:_0x13b32b[_0x2b2f('0x26')];if(!_0x9de5e6[_0x2b2f('0x29')][_0x2b2f('0x42')]('nolimit')){_0x226008[_0x2b2f('0x11')]=qs['limit'](_0x9de5e6[_0x2b2f('0x29')][_0x2b2f('0x11')]);_0x226008['offset']=qs[_0x2b2f('0xf')](_0x9de5e6[_0x2b2f('0x29')][_0x2b2f('0xf')]);}_0x226008['order']=qs['sort'](_0x9de5e6[_0x2b2f('0x29')][_0x2b2f('0x43')]);_0x226008['where']=qs['filters'](_['pick'](_0x9de5e6[_0x2b2f('0x29')],_0x13b32b[_0x2b2f('0x40')]));_0x226008['where'][_0x2b2f('0x44')]=_0x321c00['id'];if(_0x9de5e6['query'][_0x2b2f('0x45')]){_0x226008[_0x2b2f('0x46')]=_[_0x2b2f('0x2f')](_0x226008[_0x2b2f('0x46')],{'$or':_[_0x2b2f('0x1d')](_0x226008[_0x2b2f('0x2c')],function(_0x45faf1){var _0x16270b={};_0x16270b[_0x45faf1]={'$like':'%'+_0x9de5e6[_0x2b2f('0x29')][_0x2b2f('0x45')]+'%'};return _0x16270b;})});}_0x226008=_[_0x2b2f('0x2f')]({},_0x226008,_0x9de5e6[_0x2b2f('0x30')]);return db[_0x2b2f('0x3f')][_0x2b2f('0x22')](_0x226008);}})[_0x2b2f('0x15')](function(_0x51783a){if(_0x51783a){return db[_0x2b2f('0x47')][_0x2b2f('0x48')]({'where':{'id':_[_0x2b2f('0x1d')](_0x51783a,_0x2b2f('0x49')),'role':'agent'},'attributes':['id',_0x2b2f('0x1a'),_0x2b2f('0x4a'),_0x2b2f('0x4b'),_0x2b2f('0x4c')]});}})[_0x2b2f('0x15')](function(_0x10e736){if(_0x10e736){return{'count':_0x10e736[_0x2b2f('0x12')],'rows':_[_0x2b2f('0x1d')](_0x10e736[_0x2b2f('0x4d')],function(_0x4fea9b){return{'membername':_0x4fea9b[_0x2b2f('0x1a')],'UserId':_0x4fea9b['id'],'queue_name':_0x17df98[_0x2b2f('0x1a')],'MailQueueId':_0x17df98['id'],'interface':util[_0x2b2f('0x4e')](_0x2b2f('0x4f'),_0x2b2f('0x50'),_0x4fea9b[_0x2b2f('0x1a')]),'penalty':0x0,'paused':_0x4fea9b[_0x2b2f('0x4a')],'createdAt':_0x4fea9b[_0x2b2f('0x4c')],'updatedAt':_0x4fea9b[_0x2b2f('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2b2f('0x15')](respondWithFilteredResult(_0x2beadc,_0x226008))[_0x2b2f('0x23')](handleError(_0x2beadc,null));};exports['getTeams']=function(_0x3af23c,_0xf56db9){var _0xf16b32={};var _0x2472f7={};var _0x426235;var _0x5cbb0b;return db[_0x2b2f('0x28')][_0x2b2f('0x51')]({'where':{'id':_0x3af23c[_0x2b2f('0x25')]['id']}})[_0x2b2f('0x15')](handleEntityNotFound(_0xf56db9,null))[_0x2b2f('0x15')](function(_0x5ce3d2){if(_0x5ce3d2){_0x426235=_0x5ce3d2;_0x2472f7['model']=_['keys'](db[_0x2b2f('0x52')][_0x2b2f('0x1e')]);_0x2472f7[_0x2b2f('0x29')]=_[_0x2b2f('0x27')](_0x3af23c['query']);_0x2472f7[_0x2b2f('0x40')]=_['intersection'](_0x2472f7[_0x2b2f('0x26')],_0x2472f7['query']);_0xf16b32[_0x2b2f('0x2c')]=_[_0x2b2f('0x2a')](_0x2472f7[_0x2b2f('0x26')],qs['fields'](_0x3af23c[_0x2b2f('0x29')][_0x2b2f('0x41')]));_0xf16b32['attributes']=_0xf16b32[_0x2b2f('0x2c')][_0x2b2f('0x2b')]?_0xf16b32[_0x2b2f('0x2c')]:_0x2472f7[_0x2b2f('0x26')];_0xf16b32[_0x2b2f('0x53')]=qs[_0x2b2f('0x43')](_0x3af23c['query']['sort']);_0xf16b32[_0x2b2f('0x46')]=qs[_0x2b2f('0x40')](_[_0x2b2f('0x54')](_0x3af23c[_0x2b2f('0x29')],_0x2472f7[_0x2b2f('0x40')]));if(_0x3af23c[_0x2b2f('0x29')]['filter']){_0xf16b32[_0x2b2f('0x46')]=_[_0x2b2f('0x2f')](_0xf16b32[_0x2b2f('0x46')],{'$or':_['map'](_0xf16b32[_0x2b2f('0x2c')],function(_0x218ecf){var _0x5395a7={};_0x5395a7[_0x218ecf]={'$like':'%'+_0x3af23c[_0x2b2f('0x29')][_0x2b2f('0x45')]+'%'};return _0x5395a7;})});}_0xf16b32=_[_0x2b2f('0x2f')]({},_0xf16b32,_0x3af23c[_0x2b2f('0x30')]);return _0x426235[_0x2b2f('0x55')](_0xf16b32);}})[_0x2b2f('0x15')](function(_0x55dd71){if(_0x55dd71){_0x5cbb0b=_0x55dd71['length'];if(!_0x3af23c[_0x2b2f('0x29')][_0x2b2f('0x42')]('nolimit')){_0xf16b32[_0x2b2f('0x11')]=qs[_0x2b2f('0x11')](_0x3af23c[_0x2b2f('0x29')][_0x2b2f('0x11')]);_0xf16b32['offset']=qs[_0x2b2f('0xf')](_0x3af23c['query']['offset']);}return _0x426235[_0x2b2f('0x55')](_0xf16b32);}})['then'](function(_0x9a5c42){if(_0x9a5c42){return _0x9a5c42?{'count':_0x5cbb0b,'rows':_0x9a5c42}:null;}})['then'](respondWithResult(_0xf56db9,null))[_0x2b2f('0x23')](handleError(_0xf56db9,null));};exports[_0x2b2f('0x56')]=function(_0x4c408b,_0x825057){var _0x42b847=_0x4c408b[_0x2b2f('0x33')][_0x2b2f('0x57')];return db[_0x2b2f('0x52')]['findAll']({'where':{'id':_0x42b847},'attributes':['id'],'include':[{'model':db[_0x2b2f('0x47')],'as':_0x2b2f('0x58'),'attributes':['id',_0x2b2f('0x1a'),_0x2b2f('0x59'),_0x2b2f('0x5a'),_0x2b2f('0x5b')],'raw':!![]}]})[_0x2b2f('0x15')](function(_0x192a9e){if(_0x192a9e){var _0x931265=_[_0x2b2f('0x5c')](_0x192a9e,function(_0x2d12aa){var _0xf4bf2=_0x2d12aa[_0x2b2f('0x17')]({'plain':!![]});return _0xf4bf2[_0x2b2f('0x58')];});return db[_0x2b2f('0x28')][_0x2b2f('0x31')]({'where':{'id':_0x4c408b[_0x2b2f('0x25')]['id']}})['then'](function(_0x10f15f){return db[_0x2b2f('0x5d')]['transaction'](function(_0x45366d){return _0x10f15f[_0x2b2f('0x56')](_0x42b847,{'transaction':_0x45366d})[_0x2b2f('0x15')](function(){return BPromise[_0x2b2f('0x5e')](_0x931265,function(_0x5b6b7b){return db[_0x2b2f('0x3f')]['findOrCreate']({'where':{'UserId':_0x5b6b7b['id'],'MailQueueId':_0x4c408b[_0x2b2f('0x25')]['id']},'transaction':_0x45366d});});})[_0x2b2f('0x15')](function(){_0x931265['forEach'](function(_0x53efc4){socket[_0x2b2f('0x5f')](_0x2b2f('0x60'),{'UserId':_0x53efc4['id'],'MailQueueId':_0x10f15f['id']});});});});});}})['then'](respondWithStatusCode(_0x825057,null))[_0x2b2f('0x23')](handleError(_0x825057,null));};exports[_0x2b2f('0x61')]=function(_0x2e9ef2,_0x273f67){return db[_0x2b2f('0x52')][_0x2b2f('0x22')]({'where':{'id':_0x2e9ef2[_0x2b2f('0x29')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2b2f('0x47')],'as':_0x2b2f('0x58'),'attributes':['id'],'raw':!![]}]})[_0x2b2f('0x15')](handleEntityNotFound(_0x273f67,null))[_0x2b2f('0x15')](function(_0x412d37){var _0x12b799=_['map'](_0x412d37,'id');var _0x8c41f1=[];var _0x4fb79f=[];var _0x42eb2f=squel[_0x2b2f('0x62')]();_0x42eb2f[_0x2b2f('0x63')](_0x2b2f('0x64'))[_0x2b2f('0x65')](_0x2b2f('0x66'),'tq')[_0x2b2f('0x67')](_0x2b2f('0x68'),'ut',_0x2b2f('0x69'))[_0x2b2f('0x46')]('MailQueueId\x20=\x20?',_0x2e9ef2[_0x2b2f('0x25')]['id']);for(var _0x20d9eb=0x0;_0x20d9eb<_0x412d37[_0x2b2f('0x2b')];_0x20d9eb+=0x1){let _0x497614=_0x412d37[_0x20d9eb];for(var _0x107c17=0x0;_0x107c17<_0x497614['Agents'][_0x2b2f('0x2b')];_0x107c17+=0x1){let _0xc8cf2e=_0x497614[_0x2b2f('0x58')][_0x107c17];var _0x1010bd=_0x42eb2f[_0x2b2f('0x6a')]();_0x1010bd[_0x2b2f('0x46')](_0x2b2f('0x6b'),_0xc8cf2e['id']);_0x4fb79f[_0x2b2f('0x6c')](db[_0x2b2f('0x5d')]['query'](_0x1010bd[_0x2b2f('0x6d')](),{'type':db['sequelize'][_0x2b2f('0x6e')][_0x2b2f('0x6f')]})[_0x2b2f('0x15')](function(_0xbb2576){if(_0xbb2576[_0x2b2f('0x2b')]===0x1){return _0xc8cf2e['id'];}else{var _0x397326=_[_0x2b2f('0x70')](_[_0x2b2f('0x1d')](_0xbb2576,_0x2b2f('0x71')),function(_0x148b3e){return _['includes'](_0x12b799,_0x148b3e);});if(_0x397326){return _0xc8cf2e['id'];}}}));}}return BPromise[_0x2b2f('0x72')](_0x4fb79f)[_0x2b2f('0x15')](function(_0x15c011){_0x8c41f1=_(_0x8c41f1)['union'](_0x15c011)[_0x2b2f('0x73')]()['value']();return db[_0x2b2f('0x28')][_0x2b2f('0x31')]({'where':{'id':_0x2e9ef2['params']['id']}})[_0x2b2f('0x15')](function(_0x1ec116){return db[_0x2b2f('0x5d')]['transaction'](function(_0x29105c){return _0x1ec116['removeTeams'](_0x2e9ef2[_0x2b2f('0x29')][_0x2b2f('0x57')],{'transaction':_0x29105c})[_0x2b2f('0x15')](function(){if(!_[_0x2b2f('0x74')](_0x8c41f1)){return _0x1ec116[_0x2b2f('0x75')](_0x8c41f1,{'transaction':_0x29105c});}})[_0x2b2f('0x15')](function(){_0x8c41f1[_0x2b2f('0x76')](function(_0x24074e){socket[_0x2b2f('0x5f')](_0x2b2f('0x77'),{'UserId':_0x24074e,'MailQueueId':_0x1ec116['id']});});});});});});})[_0x2b2f('0x15')](respondWithStatusCode(_0x273f67,null))[_0x2b2f('0x23')](handleError(_0x273f67,null));};exports[_0x2b2f('0x78')]=function(_0x4d2626,_0x115fe4){return db[_0x2b2f('0x28')][_0x2b2f('0x31')]({'where':{'id':_0x4d2626['params']['id']}})[_0x2b2f('0x15')](handleEntityNotFound(_0x115fe4,null))['then'](function(_0x217aeb){if(_0x217aeb){return _0x217aeb[_0x2b2f('0x78')](_0x4d2626[_0x2b2f('0x33')][_0x2b2f('0x57')],_[_0x2b2f('0x79')](_0x4d2626[_0x2b2f('0x33')],['ids','id'])||{})[_0x2b2f('0x7a')](function(_0x49fb8c){for(var _0x42be2e=0x0;_0x42be2e<_0x4d2626['body'][_0x2b2f('0x57')]['length'];_0x42be2e+=0x1){socket[_0x2b2f('0x5f')](_0x2b2f('0x60'),{'UserId':Number(_0x4d2626[_0x2b2f('0x33')][_0x2b2f('0x57')][_0x42be2e]),'MailQueueId':Number(_0x4d2626[_0x2b2f('0x25')]['id'])});}return _0x49fb8c;});}})[_0x2b2f('0x15')](respondWithResult(_0x115fe4,null))[_0x2b2f('0x23')](handleError(_0x115fe4,null));};exports['removeAgents']=function(_0x4e5f3c,_0x5a9a26){return db[_0x2b2f('0x28')]['find']({'where':{'id':_0x4e5f3c[_0x2b2f('0x25')]['id']}})[_0x2b2f('0x15')](handleEntityNotFound(_0x5a9a26,null))[_0x2b2f('0x15')](function(_0x423b29){if(_0x423b29){return _0x423b29[_0x2b2f('0x75')](_0x4e5f3c[_0x2b2f('0x29')][_0x2b2f('0x57')])[_0x2b2f('0x15')](function(){if(_[_0x2b2f('0x7b')](_0x4e5f3c['query'][_0x2b2f('0x57')])){for(var _0x3ae4b7=0x0;_0x3ae4b7<_0x4e5f3c['query'][_0x2b2f('0x57')][_0x2b2f('0x2b')];_0x3ae4b7+=0x1){socket['emit'](_0x2b2f('0x77'),{'UserId':Number(_0x4e5f3c['query'][_0x2b2f('0x57')][_0x3ae4b7]),'MailQueueId':Number(_0x4e5f3c[_0x2b2f('0x25')]['id'])});}}else{socket[_0x2b2f('0x5f')](_0x2b2f('0x77'),{'UserId':Number(_0x4e5f3c[_0x2b2f('0x29')][_0x2b2f('0x57')]),'MailQueueId':Number(_0x4e5f3c[_0x2b2f('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x5a9a26,null))['catch'](handleError(_0x5a9a26,null));};exports[_0x2b2f('0x7c')]=function(_0x31375a,_0x13ed8b){var _0x19fb8e={};var _0x367bd9={};var _0x2728a1;var _0x47f3d8;return db[_0x2b2f('0x28')][_0x2b2f('0x51')]({'where':{'id':_0x31375a['params']['id']}})[_0x2b2f('0x15')](handleEntityNotFound(_0x13ed8b,null))[_0x2b2f('0x15')](function(_0x2223c5){if(_0x2223c5){_0x2728a1=_0x2223c5;_0x367bd9['model']=_[_0x2b2f('0x27')](db[_0x2b2f('0x47')][_0x2b2f('0x1e')]);_0x367bd9[_0x2b2f('0x29')]=_[_0x2b2f('0x27')](_0x31375a[_0x2b2f('0x29')]);_0x367bd9[_0x2b2f('0x40')]=_[_0x2b2f('0x2a')](_0x367bd9[_0x2b2f('0x26')],_0x367bd9[_0x2b2f('0x29')]);_0x19fb8e[_0x2b2f('0x2c')]=_[_0x2b2f('0x2a')](_0x367bd9[_0x2b2f('0x26')],qs[_0x2b2f('0x41')](_0x31375a['query'][_0x2b2f('0x41')]));_0x19fb8e['attributes']=_0x19fb8e[_0x2b2f('0x2c')][_0x2b2f('0x2b')]?_0x19fb8e['attributes']:_0x367bd9['model'];_0x19fb8e['order']=qs[_0x2b2f('0x43')](_0x31375a[_0x2b2f('0x29')][_0x2b2f('0x43')]);_0x19fb8e['where']=qs[_0x2b2f('0x40')](_[_0x2b2f('0x54')](_0x31375a[_0x2b2f('0x29')],_0x367bd9['filters']));if(_0x31375a[_0x2b2f('0x29')]['filter']){_0x19fb8e[_0x2b2f('0x46')]=_[_0x2b2f('0x2f')](_0x19fb8e[_0x2b2f('0x46')],{'$or':_[_0x2b2f('0x1d')](_0x19fb8e[_0x2b2f('0x2c')],function(_0x201f88){var _0x39d082={};_0x39d082[_0x201f88]={'$like':'%'+_0x31375a[_0x2b2f('0x29')][_0x2b2f('0x45')]+'%'};return _0x39d082;})});}_0x19fb8e=_[_0x2b2f('0x2f')]({},_0x19fb8e,_0x31375a['options']);return _0x2728a1[_0x2b2f('0x7c')](_0x19fb8e);}})[_0x2b2f('0x15')](function(_0x244d33){if(_0x244d33){_0x47f3d8=_0x244d33['length'];if(!_0x31375a[_0x2b2f('0x29')]['hasOwnProperty'](_0x2b2f('0x7d'))){_0x19fb8e[_0x2b2f('0x11')]=qs['limit'](_0x31375a['query'][_0x2b2f('0x11')]);_0x19fb8e['offset']=qs['offset'](_0x31375a[_0x2b2f('0x29')][_0x2b2f('0xf')]);}return _0x2728a1['getAgents'](_0x19fb8e);}})[_0x2b2f('0x15')](function(_0x336636){if(_0x336636){return _0x336636?{'count':_0x47f3d8,'rows':_0x336636}:null;}})['then'](respondWithResult(_0x13ed8b,null))[_0x2b2f('0x23')](handleError(_0x13ed8b,null));}; \ No newline at end of file +var _0x9d0d=['order','sort','MailQueueId','filter','merge','findAll','User','findAndCountAll','UserId','mailPause','updatedAt','format','SIP','createdAt','getTeams','Team','hasOwnProperty','nolimit','addTeams','ids','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','Agents','select','field','tq.TeamId','team_has_mail_queues','user_has_teams','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','pick','bluebird','lodash','squel','ioredis','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','end','status','json','offset','undefined','count','limit','set','update','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','index','map','MailQueue','rawAttributes','type','key','getOptions','where','include','query','rows','show','model','keys','filters','intersection','attributes','fields','length','options','find','catch','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserMailQueue'];(function(_0x4fabbe,_0xc514f3){var _0x5510dd=function(_0x1e7d23){while(--_0x1e7d23){_0x4fabbe['push'](_0x4fabbe['shift']());}};_0x5510dd(++_0xc514f3);}(_0x9d0d,0xaa));var _0xd9d0=function(_0x4eff1d,_0x44a9f2){_0x4eff1d=_0x4eff1d-0x0;var _0x38173a=_0x9d0d[_0x4eff1d];return _0x38173a;};'use strict';var BPromise=require(_0xd9d0('0x0'));var util=require('util');var _=require(_0xd9d0('0x1'));var squel=require(_0xd9d0('0x2'));var Redis=require(_0xd9d0('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xd9d0('0x4'));var db=require(_0xd9d0('0x5'))['db'];config[_0xd9d0('0x6')]=_['defaults'](config[_0xd9d0('0x6')],{'host':_0xd9d0('0x7'),'port':0x18eb});var socket=require(_0xd9d0('0x8'))(new Redis(config[_0xd9d0('0x6')]));require(_0xd9d0('0x9'))[_0xd9d0('0xa')](socket);function respondWithStatusCode(_0x238bc6,_0x49851d){_0x49851d=_0x49851d||0xcc;return function(_0x40e3f1){if(_0x40e3f1){return _0x238bc6['sendStatus'](_0x49851d);}return _0x238bc6['status'](_0x49851d)[_0xd9d0('0xb')]();};}function respondWithResult(_0xe2918a,_0x3a2a22){_0x3a2a22=_0x3a2a22||0xc8;return function(_0x30f632){if(_0x30f632){return _0xe2918a[_0xd9d0('0xc')](_0x3a2a22)[_0xd9d0('0xd')](_0x30f632);}};}function respondWithFilteredResult(_0x1f0ec2,_0x5b45b0){return function(_0x3264d){if(_0x3264d){var _0x358d25=typeof _0x5b45b0[_0xd9d0('0xe')]===_0xd9d0('0xf')&&typeof _0x5b45b0['limit']===_0xd9d0('0xf');var _0x3ede6f=_0x3264d['count'];var _0x30e3ef=_0x358d25?0x0:_0x5b45b0['offset'];var _0x8d755a=_0x358d25?_0x3264d[_0xd9d0('0x10')]:_0x5b45b0['offset']+_0x5b45b0[_0xd9d0('0x11')];var _0x3d5f31;if(_0x8d755a>=_0x3ede6f){_0x8d755a=_0x3ede6f;_0x3d5f31=0xc8;}else{_0x3d5f31=0xce;}_0x1f0ec2[_0xd9d0('0xc')](_0x3d5f31);return _0x1f0ec2[_0xd9d0('0x12')]('Content-Range',_0x30e3ef+'-'+_0x8d755a+'/'+_0x3ede6f)[_0xd9d0('0xd')](_0x3264d);}return null;};}function saveUpdates(_0x382b1c){return function(_0x1e72e4){if(_0x1e72e4){return _0x1e72e4[_0xd9d0('0x13')](_0x382b1c)[_0xd9d0('0x14')](function(_0x53cc99){return _0x53cc99;});}return null;};}function removeEntity(_0x4bae96){return function(_0x1e9f02){if(_0x1e9f02){return _0x1e9f02['destroy']()[_0xd9d0('0x14')](function(){var _0x324e2f=_0x1e9f02[_0xd9d0('0x15')]({'plain':!![]});var _0x567160=_0xd9d0('0x16');return db[_0xd9d0('0x17')][_0xd9d0('0x18')]({'where':{'type':_0x567160,'resourceId':_0x324e2f['id']}})['then'](function(){return _0x1e9f02;});})[_0xd9d0('0x14')](function(){_0x4bae96['status'](0xcc)[_0xd9d0('0xb')]();});}};}function handleEntityNotFound(_0x1772ca){return function(_0x1cda6c){if(!_0x1cda6c){_0x1772ca['sendStatus'](0x194);}return _0x1cda6c;};}function handleError(_0x147e8e,_0x5ea1a0){_0x5ea1a0=_0x5ea1a0||0x1f4;return function(_0x3de6da){logger[_0xd9d0('0x19')](_0x3de6da[_0xd9d0('0x1a')]);if(_0x3de6da[_0xd9d0('0x1b')]){delete _0x3de6da[_0xd9d0('0x1b')];}_0x147e8e['status'](_0x5ea1a0)['send'](_0x3de6da);};}exports[_0xd9d0('0x1c')]=function(_0x208a91,_0x413135){var _0x5d9a19={};var _0x161c36={'count':0x0,'rows':[]};var _0x5c64f3=_[_0xd9d0('0x1d')](db[_0xd9d0('0x1e')][_0xd9d0('0x1f')],function(_0x17b222){return{'name':_0x17b222['fieldName'],'type':_0x17b222[_0xd9d0('0x20')][_0xd9d0('0x21')]};});_0x5d9a19=qs[_0xd9d0('0x22')](_0x5c64f3,_0x208a91);var _0x43053d={'where':_0x5d9a19[_0xd9d0('0x23')]};return db[_0xd9d0('0x1e')][_0xd9d0('0x10')](_0x43053d)[_0xd9d0('0x14')](function(_0x3f4fa3){_0x161c36['count']=_0x3f4fa3;_0x5d9a19[_0xd9d0('0x24')]=qs[_0xd9d0('0x24')](_0x208a91[_0xd9d0('0x25')]);return db[_0xd9d0('0x1e')]['findAll'](_0x5d9a19);})[_0xd9d0('0x14')](function(_0x5ac041){_0x161c36[_0xd9d0('0x26')]=_0x5ac041;return _0x161c36;})[_0xd9d0('0x14')](respondWithFilteredResult(_0x413135,_0x5d9a19))['catch'](handleError(_0x413135,null));};exports[_0xd9d0('0x27')]=function(_0xa5ee82,_0x4cc0c7){var _0x20e2ab={'raw':!![],'where':{'id':_0xa5ee82['params']['id']}},_0x9cdcf0={};_0x9cdcf0[_0xd9d0('0x28')]=_[_0xd9d0('0x29')](db[_0xd9d0('0x1e')][_0xd9d0('0x1f')]);_0x9cdcf0[_0xd9d0('0x25')]=_[_0xd9d0('0x29')](_0xa5ee82[_0xd9d0('0x25')]);_0x9cdcf0[_0xd9d0('0x2a')]=_[_0xd9d0('0x2b')](_0x9cdcf0[_0xd9d0('0x28')],_0x9cdcf0[_0xd9d0('0x25')]);_0x20e2ab[_0xd9d0('0x2c')]=_[_0xd9d0('0x2b')](_0x9cdcf0['model'],qs[_0xd9d0('0x2d')](_0xa5ee82['query'][_0xd9d0('0x2d')]));_0x20e2ab['attributes']=_0x20e2ab[_0xd9d0('0x2c')][_0xd9d0('0x2e')]?_0x20e2ab[_0xd9d0('0x2c')]:_0x9cdcf0[_0xd9d0('0x28')];if(_0xa5ee82[_0xd9d0('0x25')]['includeAll']){_0x20e2ab[_0xd9d0('0x24')]=[{'all':!![]}];}_0x20e2ab=_['merge']({},_0x20e2ab,_0xa5ee82[_0xd9d0('0x2f')]);return db[_0xd9d0('0x1e')][_0xd9d0('0x30')](_0x20e2ab)[_0xd9d0('0x14')](handleEntityNotFound(_0x4cc0c7,null))['then'](respondWithResult(_0x4cc0c7,null))[_0xd9d0('0x31')](handleError(_0x4cc0c7,null));};exports['create']=function(_0x346209,_0x2794b3){return db[_0xd9d0('0x1e')][_0xd9d0('0x32')](_0x346209['body'],{})[_0xd9d0('0x14')](function(_0x535fc5){var _0x1ad11d=_0x346209[_0xd9d0('0x33')][_0xd9d0('0x15')]({'plain':!![]});if(!_0x1ad11d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ad11d[_0xd9d0('0x34')]===_0xd9d0('0x33')){var _0x57370d=_0x535fc5[_0xd9d0('0x15')]({'plain':!![]});var _0x4d348f=_0xd9d0('0x16');return db[_0xd9d0('0x35')]['find']({'where':{'name':_0x4d348f,'userProfileId':_0x1ad11d['userProfileId']},'raw':!![]})[_0xd9d0('0x14')](function(_0x1cb561){if(_0x1cb561&&_0x1cb561[_0xd9d0('0x36')]===0x0){return db[_0xd9d0('0x17')][_0xd9d0('0x32')]({'name':_0x57370d[_0xd9d0('0x1b')],'resourceId':_0x57370d['id'],'type':_0x1cb561[_0xd9d0('0x1b')],'sectionId':_0x1cb561['id']},{})[_0xd9d0('0x14')](function(){return _0x535fc5;});}else{return _0x535fc5;}})[_0xd9d0('0x31')](function(_0x2fa75b){logger['error'](_0xd9d0('0x37'),_0x2fa75b);throw _0x2fa75b;});}return _0x535fc5;})[_0xd9d0('0x14')](respondWithResult(_0x2794b3,0xc9))['catch'](handleError(_0x2794b3,null));};exports[_0xd9d0('0x13')]=function(_0x49770f,_0x46cf1f){if(_0x49770f['body']['id']){delete _0x49770f[_0xd9d0('0x38')]['id'];}return db[_0xd9d0('0x1e')][_0xd9d0('0x30')]({'where':{'id':_0x49770f[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x46cf1f,null))['then'](saveUpdates(_0x49770f[_0xd9d0('0x38')],null))[_0xd9d0('0x14')](respondWithResult(_0x46cf1f,null))[_0xd9d0('0x31')](handleError(_0x46cf1f,null));};exports['destroy']=function(_0x229f7f,_0x21dd6c){return db['MailQueue']['find']({'where':{'id':_0x229f7f[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x21dd6c,null))[_0xd9d0('0x14')](removeEntity(_0x21dd6c,null))[_0xd9d0('0x31')](handleError(_0x21dd6c,null));};exports[_0xd9d0('0x3a')]=function(_0x28e8a5,_0x19286b){return db[_0xd9d0('0x1e')]['describe']()[_0xd9d0('0x14')](respondWithResult(_0x19286b,null))[_0xd9d0('0x31')](handleError(_0x19286b,null));};exports[_0xd9d0('0x3b')]=function(_0x395c47,_0x48b2e3){var _0x42c275={'raw':!![],'where':{}},_0x2f5345={},_0x739024;return db['MailQueue'][_0xd9d0('0x3c')]({'where':{'id':_0x395c47[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x48b2e3,null))[_0xd9d0('0x14')](function(_0x2d3516){if(_0x2d3516){_0x739024=_0x2d3516['get']({'plain':!![]});_0x2f5345[_0xd9d0('0x28')]=_[_0xd9d0('0x29')](db[_0xd9d0('0x3d')]['rawAttributes']);_0x2f5345['query']=_[_0xd9d0('0x29')](_0x395c47['query']);_0x2f5345['filters']=_['intersection'](_0x2f5345[_0xd9d0('0x28')],_0x2f5345[_0xd9d0('0x25')]);_0x42c275[_0xd9d0('0x2c')]=_[_0xd9d0('0x2b')](_0x2f5345[_0xd9d0('0x28')],qs['fields'](_0x395c47[_0xd9d0('0x25')][_0xd9d0('0x2d')]));_0x42c275['attributes']=_0x42c275[_0xd9d0('0x2c')][_0xd9d0('0x2e')]?_0x42c275['attributes']:_0x2f5345[_0xd9d0('0x28')];if(!_0x395c47[_0xd9d0('0x25')]['hasOwnProperty']('nolimit')){_0x42c275[_0xd9d0('0x11')]=qs['limit'](_0x395c47[_0xd9d0('0x25')][_0xd9d0('0x11')]);_0x42c275[_0xd9d0('0xe')]=qs['offset'](_0x395c47['query'][_0xd9d0('0xe')]);}_0x42c275[_0xd9d0('0x3e')]=qs[_0xd9d0('0x3f')](_0x395c47[_0xd9d0('0x25')][_0xd9d0('0x3f')]);_0x42c275[_0xd9d0('0x23')]=qs[_0xd9d0('0x2a')](_['pick'](_0x395c47[_0xd9d0('0x25')],_0x2f5345[_0xd9d0('0x2a')]));_0x42c275[_0xd9d0('0x23')][_0xd9d0('0x40')]=_0x2d3516['id'];if(_0x395c47[_0xd9d0('0x25')][_0xd9d0('0x41')]){_0x42c275[_0xd9d0('0x23')]=_[_0xd9d0('0x42')](_0x42c275[_0xd9d0('0x23')],{'$or':_[_0xd9d0('0x1d')](_0x42c275[_0xd9d0('0x2c')],function(_0x4f8de7){var _0x117e33={};_0x117e33[_0x4f8de7]={'$like':'%'+_0x395c47['query'][_0xd9d0('0x41')]+'%'};return _0x117e33;})});}_0x42c275=_['merge']({},_0x42c275,_0x395c47[_0xd9d0('0x2f')]);return db[_0xd9d0('0x3d')][_0xd9d0('0x43')](_0x42c275);}})[_0xd9d0('0x14')](function(_0x3eb230){if(_0x3eb230){return db[_0xd9d0('0x44')][_0xd9d0('0x45')]({'where':{'id':_['map'](_0x3eb230,_0xd9d0('0x46')),'role':'agent'},'attributes':['id',_0xd9d0('0x1b'),_0xd9d0('0x47'),_0xd9d0('0x48'),'createdAt']});}})[_0xd9d0('0x14')](function(_0x360a40){if(_0x360a40){return{'count':_0x360a40['count'],'rows':_[_0xd9d0('0x1d')](_0x360a40[_0xd9d0('0x26')],function(_0x4c58f6){return{'membername':_0x4c58f6['name'],'UserId':_0x4c58f6['id'],'queue_name':_0x739024[_0xd9d0('0x1b')],'MailQueueId':_0x739024['id'],'interface':util[_0xd9d0('0x49')]('%s/%s',_0xd9d0('0x4a'),_0x4c58f6[_0xd9d0('0x1b')]),'penalty':0x0,'paused':_0x4c58f6[_0xd9d0('0x47')],'createdAt':_0x4c58f6[_0xd9d0('0x4b')],'updatedAt':_0x4c58f6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9d0('0x14')](respondWithFilteredResult(_0x48b2e3,_0x42c275))['catch'](handleError(_0x48b2e3,null));};exports[_0xd9d0('0x4c')]=function(_0x4b6ced,_0x17edca){var _0x25359e={};var _0x29298b={};var _0x1e3a3d;var _0x5a80e2;return db[_0xd9d0('0x1e')][_0xd9d0('0x3c')]({'where':{'id':_0x4b6ced[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x17edca,null))[_0xd9d0('0x14')](function(_0x1a972c){if(_0x1a972c){_0x1e3a3d=_0x1a972c;_0x29298b[_0xd9d0('0x28')]=_[_0xd9d0('0x29')](db[_0xd9d0('0x4d')]['rawAttributes']);_0x29298b[_0xd9d0('0x25')]=_[_0xd9d0('0x29')](_0x4b6ced[_0xd9d0('0x25')]);_0x29298b['filters']=_[_0xd9d0('0x2b')](_0x29298b[_0xd9d0('0x28')],_0x29298b[_0xd9d0('0x25')]);_0x25359e[_0xd9d0('0x2c')]=_['intersection'](_0x29298b[_0xd9d0('0x28')],qs[_0xd9d0('0x2d')](_0x4b6ced[_0xd9d0('0x25')][_0xd9d0('0x2d')]));_0x25359e[_0xd9d0('0x2c')]=_0x25359e[_0xd9d0('0x2c')][_0xd9d0('0x2e')]?_0x25359e[_0xd9d0('0x2c')]:_0x29298b[_0xd9d0('0x28')];_0x25359e[_0xd9d0('0x3e')]=qs[_0xd9d0('0x3f')](_0x4b6ced['query'][_0xd9d0('0x3f')]);_0x25359e[_0xd9d0('0x23')]=qs[_0xd9d0('0x2a')](_['pick'](_0x4b6ced[_0xd9d0('0x25')],_0x29298b['filters']));if(_0x4b6ced[_0xd9d0('0x25')]['filter']){_0x25359e[_0xd9d0('0x23')]=_[_0xd9d0('0x42')](_0x25359e['where'],{'$or':_[_0xd9d0('0x1d')](_0x25359e[_0xd9d0('0x2c')],function(_0x188ad1){var _0x42dc0c={};_0x42dc0c[_0x188ad1]={'$like':'%'+_0x4b6ced[_0xd9d0('0x25')][_0xd9d0('0x41')]+'%'};return _0x42dc0c;})});}_0x25359e=_[_0xd9d0('0x42')]({},_0x25359e,_0x4b6ced[_0xd9d0('0x2f')]);return _0x1e3a3d['getTeams'](_0x25359e);}})[_0xd9d0('0x14')](function(_0x1c3c6b){if(_0x1c3c6b){_0x5a80e2=_0x1c3c6b[_0xd9d0('0x2e')];if(!_0x4b6ced[_0xd9d0('0x25')][_0xd9d0('0x4e')](_0xd9d0('0x4f'))){_0x25359e[_0xd9d0('0x11')]=qs['limit'](_0x4b6ced[_0xd9d0('0x25')][_0xd9d0('0x11')]);_0x25359e[_0xd9d0('0xe')]=qs['offset'](_0x4b6ced[_0xd9d0('0x25')][_0xd9d0('0xe')]);}return _0x1e3a3d['getTeams'](_0x25359e);}})['then'](function(_0x4cb032){if(_0x4cb032){return _0x4cb032?{'count':_0x5a80e2,'rows':_0x4cb032}:null;}})[_0xd9d0('0x14')](respondWithResult(_0x17edca,null))['catch'](handleError(_0x17edca,null));};exports[_0xd9d0('0x50')]=function(_0x49bafa,_0x5a6e7f){var _0x192e31=_0x49bafa[_0xd9d0('0x38')][_0xd9d0('0x51')];return db[_0xd9d0('0x4d')]['findAll']({'where':{'id':_0x192e31},'attributes':['id'],'include':[{'model':db[_0xd9d0('0x44')],'as':'Agents','attributes':['id',_0xd9d0('0x1b'),'online',_0xd9d0('0x52'),'interface'],'raw':!![]}]})[_0xd9d0('0x14')](function(_0x2f67b1){if(_0x2f67b1){var _0x24481b=_[_0xd9d0('0x53')](_0x2f67b1,function(_0x33d579){var _0x563c9d=_0x33d579[_0xd9d0('0x15')]({'plain':!![]});return _0x563c9d['Agents'];});return db['MailQueue'][_0xd9d0('0x30')]({'where':{'id':_0x49bafa[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](function(_0x4f1a4a){return db[_0xd9d0('0x54')][_0xd9d0('0x55')](function(_0x17736d){return _0x4f1a4a['addTeams'](_0x192e31,{'transaction':_0x17736d})[_0xd9d0('0x14')](function(){return BPromise[_0xd9d0('0x56')](_0x24481b,function(_0x42fa10){return db[_0xd9d0('0x3d')][_0xd9d0('0x57')]({'where':{'UserId':_0x42fa10['id'],'MailQueueId':_0x49bafa[_0xd9d0('0x39')]['id']},'transaction':_0x17736d});});})[_0xd9d0('0x14')](function(){_0x24481b[_0xd9d0('0x58')](function(_0x2c189b){socket[_0xd9d0('0x59')]('userMailQueue:save',{'UserId':_0x2c189b['id'],'MailQueueId':_0x4f1a4a['id']});});});});});}})[_0xd9d0('0x14')](respondWithStatusCode(_0x5a6e7f,null))['catch'](handleError(_0x5a6e7f,null));};exports[_0xd9d0('0x5a')]=function(_0x1c3576,_0x349a04){return db['Team']['findAll']({'where':{'id':_0x1c3576[_0xd9d0('0x25')][_0xd9d0('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd9d0('0x5b'),'attributes':['id'],'raw':!![]}]})[_0xd9d0('0x14')](handleEntityNotFound(_0x349a04,null))[_0xd9d0('0x14')](function(_0x25e4f4){var _0x248511=_[_0xd9d0('0x1d')](_0x25e4f4,'id');var _0x2753d8=[];var _0x34aa11=[];var _0x171848=squel[_0xd9d0('0x5c')]();_0x171848[_0xd9d0('0x5d')](_0xd9d0('0x5e'))['from'](_0xd9d0('0x5f'),'tq')['join'](_0xd9d0('0x60'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd9d0('0x61'),_0x1c3576[_0xd9d0('0x39')]['id']);for(var _0x3d720a=0x0;_0x3d720a<_0x25e4f4[_0xd9d0('0x2e')];_0x3d720a+=0x1){let _0x3df714=_0x25e4f4[_0x3d720a];for(var _0x225b50=0x0;_0x225b50<_0x3df714['Agents'][_0xd9d0('0x2e')];_0x225b50+=0x1){let _0x5cdfd7=_0x3df714[_0xd9d0('0x5b')][_0x225b50];var _0xf7f359=_0x171848[_0xd9d0('0x62')]();_0xf7f359[_0xd9d0('0x23')]('ut.UserId\x20=\x20?',_0x5cdfd7['id']);_0x34aa11[_0xd9d0('0x63')](db['sequelize'][_0xd9d0('0x25')](_0xf7f359[_0xd9d0('0x64')](),{'type':db[_0xd9d0('0x54')][_0xd9d0('0x65')][_0xd9d0('0x66')]})['then'](function(_0x3f46b3){if(_0x3f46b3[_0xd9d0('0x2e')]===0x1){return _0x5cdfd7['id'];}else{var _0x5b2ac4=_['every'](_[_0xd9d0('0x1d')](_0x3f46b3,_0xd9d0('0x67')),function(_0x27fda1){return _['includes'](_0x248511,_0x27fda1);});if(_0x5b2ac4){return _0x5cdfd7['id'];}}}));}}return BPromise['all'](_0x34aa11)[_0xd9d0('0x14')](function(_0x1bd974){_0x2753d8=_(_0x2753d8)[_0xd9d0('0x68')](_0x1bd974)[_0xd9d0('0x69')]()[_0xd9d0('0x6a')]();return db[_0xd9d0('0x1e')]['find']({'where':{'id':_0x1c3576[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](function(_0x5e17a4){return db['sequelize'][_0xd9d0('0x55')](function(_0x570285){return _0x5e17a4[_0xd9d0('0x5a')](_0x1c3576[_0xd9d0('0x25')][_0xd9d0('0x51')],{'transaction':_0x570285})[_0xd9d0('0x14')](function(){if(!_[_0xd9d0('0x6b')](_0x2753d8)){return _0x5e17a4[_0xd9d0('0x6c')](_0x2753d8,{'transaction':_0x570285});}})[_0xd9d0('0x14')](function(){_0x2753d8['forEach'](function(_0x42b176){socket[_0xd9d0('0x59')](_0xd9d0('0x6d'),{'UserId':_0x42b176,'MailQueueId':_0x5e17a4['id']});});});});});});})[_0xd9d0('0x14')](respondWithStatusCode(_0x349a04,null))['catch'](handleError(_0x349a04,null));};exports[_0xd9d0('0x6e')]=function(_0x4a4302,_0x3d69da){return db['MailQueue'][_0xd9d0('0x30')]({'where':{'id':_0x4a4302[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x3d69da,null))[_0xd9d0('0x14')](function(_0x295a76){if(_0x295a76){return _0x295a76[_0xd9d0('0x6e')](_0x4a4302[_0xd9d0('0x38')][_0xd9d0('0x51')],_[_0xd9d0('0x6f')](_0x4a4302[_0xd9d0('0x38')],['ids','id'])||{})[_0xd9d0('0x70')](function(_0x293d62){for(var _0x20c188=0x0;_0x20c188<_0x4a4302[_0xd9d0('0x38')][_0xd9d0('0x51')][_0xd9d0('0x2e')];_0x20c188+=0x1){socket[_0xd9d0('0x59')]('userMailQueue:save',{'UserId':Number(_0x4a4302[_0xd9d0('0x38')][_0xd9d0('0x51')][_0x20c188]),'MailQueueId':Number(_0x4a4302['params']['id'])});}return _0x293d62;});}})[_0xd9d0('0x14')](respondWithResult(_0x3d69da,null))['catch'](handleError(_0x3d69da,null));};exports[_0xd9d0('0x6c')]=function(_0x58a3ce,_0x2cb3cc){return db[_0xd9d0('0x1e')][_0xd9d0('0x30')]({'where':{'id':_0x58a3ce[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x2cb3cc,null))['then'](function(_0x2baa40){if(_0x2baa40){return _0x2baa40[_0xd9d0('0x6c')](_0x58a3ce[_0xd9d0('0x25')]['ids'])[_0xd9d0('0x14')](function(){if(_[_0xd9d0('0x71')](_0x58a3ce[_0xd9d0('0x25')][_0xd9d0('0x51')])){for(var _0x5b36b1=0x0;_0x5b36b1<_0x58a3ce[_0xd9d0('0x25')][_0xd9d0('0x51')]['length'];_0x5b36b1+=0x1){socket[_0xd9d0('0x59')](_0xd9d0('0x6d'),{'UserId':Number(_0x58a3ce['query'][_0xd9d0('0x51')][_0x5b36b1]),'MailQueueId':Number(_0x58a3ce['params']['id'])});}}else{socket[_0xd9d0('0x59')](_0xd9d0('0x6d'),{'UserId':Number(_0x58a3ce[_0xd9d0('0x25')][_0xd9d0('0x51')]),'MailQueueId':Number(_0x58a3ce[_0xd9d0('0x39')]['id'])});}});}})[_0xd9d0('0x14')](respondWithStatusCode(_0x2cb3cc,null))[_0xd9d0('0x31')](handleError(_0x2cb3cc,null));};exports[_0xd9d0('0x72')]=function(_0x5865e7,_0x5f1985){var _0x33b056={};var _0x3a8902={};var _0x3f3def;var _0x30e404;return db[_0xd9d0('0x1e')][_0xd9d0('0x3c')]({'where':{'id':_0x5865e7[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x5f1985,null))[_0xd9d0('0x14')](function(_0x596600){if(_0x596600){_0x3f3def=_0x596600;_0x3a8902['model']=_[_0xd9d0('0x29')](db[_0xd9d0('0x44')][_0xd9d0('0x1f')]);_0x3a8902[_0xd9d0('0x25')]=_['keys'](_0x5865e7[_0xd9d0('0x25')]);_0x3a8902[_0xd9d0('0x2a')]=_[_0xd9d0('0x2b')](_0x3a8902[_0xd9d0('0x28')],_0x3a8902[_0xd9d0('0x25')]);_0x33b056[_0xd9d0('0x2c')]=_[_0xd9d0('0x2b')](_0x3a8902[_0xd9d0('0x28')],qs['fields'](_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0x2d')]));_0x33b056['attributes']=_0x33b056[_0xd9d0('0x2c')]['length']?_0x33b056[_0xd9d0('0x2c')]:_0x3a8902['model'];_0x33b056[_0xd9d0('0x3e')]=qs[_0xd9d0('0x3f')](_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0x3f')]);_0x33b056[_0xd9d0('0x23')]=qs['filters'](_[_0xd9d0('0x73')](_0x5865e7[_0xd9d0('0x25')],_0x3a8902[_0xd9d0('0x2a')]));if(_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0x41')]){_0x33b056[_0xd9d0('0x23')]=_[_0xd9d0('0x42')](_0x33b056[_0xd9d0('0x23')],{'$or':_['map'](_0x33b056[_0xd9d0('0x2c')],function(_0x4ef84f){var _0x1c8879={};_0x1c8879[_0x4ef84f]={'$like':'%'+_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0x41')]+'%'};return _0x1c8879;})});}_0x33b056=_['merge']({},_0x33b056,_0x5865e7[_0xd9d0('0x2f')]);return _0x3f3def[_0xd9d0('0x72')](_0x33b056);}})[_0xd9d0('0x14')](function(_0x27b209){if(_0x27b209){_0x30e404=_0x27b209['length'];if(!_0x5865e7['query']['hasOwnProperty'](_0xd9d0('0x4f'))){_0x33b056[_0xd9d0('0x11')]=qs[_0xd9d0('0x11')](_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0x11')]);_0x33b056['offset']=qs[_0xd9d0('0xe')](_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0xe')]);}return _0x3f3def[_0xd9d0('0x72')](_0x33b056);}})[_0xd9d0('0x14')](function(_0x5530cd){if(_0x5530cd){return _0x5530cd?{'count':_0x30e404,'rows':_0x5530cd}:null;}})['then'](respondWithResult(_0x5f1985,null))[_0xd9d0('0x31')](handleError(_0x5f1985,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 691de4e..50fefee 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 _0x0931=['MailQueue','setMaxListeners','save','update','emit','hook','events','../../mysqldb'];(function(_0x31659b,_0x3f07a1){var _0x48b140=function(_0x3b295c){while(--_0x3b295c){_0x31659b['push'](_0x31659b['shift']());}};_0x48b140(++_0x3f07a1);}(_0x0931,0x66));var _0x1093=function(_0x413167,_0xe84671){_0x413167=_0x413167-0x0;var _0x2a93be=_0x0931[_0x413167];return _0x2a93be;};'use strict';var EventEmitter=require(_0x1093('0x0'));var MailQueue=require(_0x1093('0x1'))['db'][_0x1093('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1093('0x3')](0x0);var events={'afterCreate':_0x1093('0x4'),'afterUpdate':_0x1093('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4228d7){return function(_0x2915ad,_0x270dcd,_0x2c2e60){MailQueueEvents[_0x1093('0x6')](_0x4228d7+':'+_0x2915ad['id'],_0x2915ad);MailQueueEvents['emit'](_0x4228d7,_0x2915ad);_0x2c2e60(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x1093('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xbfef=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','save','update'];(function(_0x390791,_0x473075){var _0x24f773=function(_0x325907){while(--_0x325907){_0x390791['push'](_0x390791['shift']());}};_0x24f773(++_0x473075);}(_0xbfef,0x13f));var _0xfbfe=function(_0x5413cb,_0x2303e1){_0x5413cb=_0x5413cb-0x0;var _0x1b4346=_0xbfef[_0x5413cb];return _0x1b4346;};'use strict';var EventEmitter=require(_0xfbfe('0x0'));var MailQueue=require(_0xfbfe('0x1'))['db'][_0xfbfe('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfbfe('0x3'),'afterUpdate':_0xfbfe('0x4'),'afterDestroy':_0xfbfe('0x5')};function emitEvent(_0x2429f1){return function(_0x90a31e,_0x2c9b01,_0x28a965){MailQueueEvents[_0xfbfe('0x6')](_0x2429f1+':'+_0x90a31e['id'],_0x90a31e);MailQueueEvents[_0xfbfe('0x6')](_0x2429f1,_0x90a31e);_0x28a965(null);};}for(var e in events){if(events[_0xfbfe('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xfbfe('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index d9a400a..30aab1c 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 _0xa3f3=['lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xa3f3,0x186));var _0x3a3f=function(_0x27677d,_0x296c99){_0x27677d=_0x27677d-0x0;var _0xc5754e=_0xa3f3[_0x27677d];return _0xc5754e;};'use strict';var _=require(_0x3a3f('0x0'));var util=require('util');var logger=require(_0x3a3f('0x1'))(_0x3a3f('0x2'));var moment=require(_0x3a3f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a3f('0x4'));var rimraf=require(_0x3a3f('0x5'));var config=require(_0x3a3f('0x6'));var attributes=require(_0x3a3f('0x7'));module[_0x3a3f('0x8')]=function(_0x41c9ce,_0x4d3c39){return _0x41c9ce['define'](_0x3a3f('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ca9=['mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0xc1a251,_0x1a2bdf){var _0x3860f0=function(_0xd6573c){while(--_0xd6573c){_0xc1a251['push'](_0xc1a251['shift']());}};_0x3860f0(++_0x1a2bdf);}(_0x4ca9,0xa6));var _0x94ca=function(_0x2adf30,_0x4c0ae8){_0x2adf30=_0x2adf30-0x0;var _0x5a1545=_0x4ca9[_0x2adf30];return _0x5a1545;};'use strict';var _=require(_0x94ca('0x0'));var util=require(_0x94ca('0x1'));var logger=require(_0x94ca('0x2'))(_0x94ca('0x3'));var moment=require(_0x94ca('0x4'));var BPromise=require(_0x94ca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94ca('0x6'));var rimraf=require(_0x94ca('0x7'));var config=require(_0x94ca('0x8'));var attributes=require(_0x94ca('0x9'));module['exports']=function(_0x25bb67,_0x190c2f){return _0x25bb67['define']('MailQueue',attributes,{'tableName':_0x94ca('0xa'),'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 d838f7f..fb2ece5 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 _0x7f4b=['localhost','socket.io-emitter','register','request','then','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','lodash','util','moment','randomstring','../../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);}(_0x7f4b,0x6b));var _0xb7f4=function(_0x4cd22f,_0x57c3ea){_0x4cd22f=_0x4cd22f-0x0;var _0x2342d3=_0x7f4b[_0x4cd22f];return _0x2342d3;};'use strict';var _=require(_0xb7f4('0x0'));var util=require(_0xb7f4('0x1'));var moment=require(_0xb7f4('0x2'));var BPromise=require('bluebird');var rs=require(_0xb7f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7f4('0x4'))['db'];var utils=require(_0xb7f4('0x5'));var logger=require(_0xb7f4('0x6'))(_0xb7f4('0x7'));var config=require(_0xb7f4('0x8'));var jayson=require(_0xb7f4('0x9'));var client=jayson[_0xb7f4('0xa')][_0xb7f4('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb7f4('0xc')],{'host':_0xb7f4('0xd'),'port':0x18eb});var socket=require(_0xb7f4('0xe'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xb7f4('0xf')](socket);function respondWithRpcPromise(_0x394c3a,_0x16de47,_0x5a1968){return new BPromise(function(_0x1a77ae,_0x4e324c){return client[_0xb7f4('0x10')](_0x394c3a,_0x5a1968)[_0xb7f4('0x11')](function(_0x12ddf2){logger['info'](_0xb7f4('0x12'),_0x16de47,'request\x20sent');logger[_0xb7f4('0x13')](_0xb7f4('0x14'),_0x16de47,'request\x20sent',JSON[_0xb7f4('0x15')](_0x12ddf2));if(_0x12ddf2['error']){if(_0x12ddf2[_0xb7f4('0x16')][_0xb7f4('0x17')]===0x1f4){logger[_0xb7f4('0x16')]('MailQueue,\x20%s,\x20%s',_0x16de47,_0x12ddf2[_0xb7f4('0x16')][_0xb7f4('0x18')]);return _0x4e324c(_0x12ddf2[_0xb7f4('0x16')][_0xb7f4('0x18')]);}logger[_0xb7f4('0x16')]('MailQueue,\x20%s,\x20%s',_0x16de47,_0x12ddf2[_0xb7f4('0x16')][_0xb7f4('0x18')]);return _0x1a77ae(_0x12ddf2[_0xb7f4('0x16')]['message']);}else{logger[_0xb7f4('0x19')](_0xb7f4('0x12'),_0x16de47,_0xb7f4('0x1a'));_0x1a77ae(_0x12ddf2['result'][_0xb7f4('0x18')]);}})[_0xb7f4('0x1b')](function(_0x2c27ec){logger[_0xb7f4('0x16')](_0xb7f4('0x12'),_0x16de47,_0x2c27ec);_0x4e324c(_0x2c27ec);});});}exports[_0xb7f4('0x1c')]=function(_0x20067c){var _0x3718b7=this;return new Promise(function(_0xc1e64f,_0x4b617a){return db['MailQueue'][_0xb7f4('0x1d')]({'raw':_0x20067c[_0xb7f4('0x1e')]?_0x20067c[_0xb7f4('0x1e')][_0xb7f4('0x1f')]===undefined?!![]:![]:!![],'where':_0x20067c['options']?_0x20067c[_0xb7f4('0x1e')][_0xb7f4('0x20')]||null:null,'attributes':_0x20067c[_0xb7f4('0x1e')]?_0x20067c[_0xb7f4('0x1e')][_0xb7f4('0x21')]||null:null,'limit':_0x20067c[_0xb7f4('0x1e')]?_0x20067c['options'][_0xb7f4('0x22')]||null:null,'include':_0x20067c['options']?_0x20067c[_0xb7f4('0x1e')][_0xb7f4('0x23')]?_[_0xb7f4('0x24')](_0x20067c[_0xb7f4('0x1e')][_0xb7f4('0x23')],function(_0x2eb1c7){return{'model':db[_0x2eb1c7[_0xb7f4('0x25')]],'as':_0x2eb1c7['as'],'attributes':_0x2eb1c7[_0xb7f4('0x21')],'include':_0x2eb1c7[_0xb7f4('0x23')]?_[_0xb7f4('0x24')](_0x2eb1c7[_0xb7f4('0x23')],function(_0x41fbe1){return{'model':db[_0x41fbe1[_0xb7f4('0x25')]],'as':_0x41fbe1['as'],'attributes':_0x41fbe1[_0xb7f4('0x21')],'include':_0x41fbe1[_0xb7f4('0x23')]?_[_0xb7f4('0x24')](_0x41fbe1[_0xb7f4('0x23')],function(_0x58936c){return{'model':db[_0x58936c[_0xb7f4('0x25')]],'as':_0x58936c['as'],'attributes':_0x58936c[_0xb7f4('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb7f4('0x11')](function(_0x5db973){logger[_0xb7f4('0x19')](_0xb7f4('0x1c'),_0x20067c);logger[_0xb7f4('0x13')](_0xb7f4('0x1c'),_0x20067c,JSON[_0xb7f4('0x15')](_0x5db973));_0xc1e64f(_0x5db973);})[_0xb7f4('0x1b')](function(_0x38e32a){logger[_0xb7f4('0x16')](_0xb7f4('0x1c'),_0x38e32a[_0xb7f4('0x18')],_0x20067c);_0x4b617a(_0x3718b7[_0xb7f4('0x16')](0x1f4,_0x38e32a[_0xb7f4('0x18')]));});});};exports[_0xb7f4('0x26')]=function(_0x3aef90){var _0x2685b2=this;return new Promise(function(_0x5d42c5,_0x5f3c83){return db['MailQueue'][_0xb7f4('0x27')]({'raw':_0x3aef90[_0xb7f4('0x1e')]?_0x3aef90[_0xb7f4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3aef90['options']?_0x3aef90[_0xb7f4('0x1e')][_0xb7f4('0x20')]||null:null,'attributes':_0x3aef90[_0xb7f4('0x1e')]?_0x3aef90['options'][_0xb7f4('0x21')]||null:null,'include':_0x3aef90[_0xb7f4('0x1e')]?_0x3aef90[_0xb7f4('0x1e')][_0xb7f4('0x23')]?_[_0xb7f4('0x24')](_0x3aef90[_0xb7f4('0x1e')]['include'],function(_0x2a0ea9){return{'model':db[_0x2a0ea9[_0xb7f4('0x25')]],'as':_0x2a0ea9['as'],'attributes':_0x2a0ea9[_0xb7f4('0x21')],'include':_0x2a0ea9[_0xb7f4('0x23')]?_[_0xb7f4('0x24')](_0x2a0ea9[_0xb7f4('0x23')],function(_0xac1bdc){return{'model':db[_0xac1bdc['model']],'as':_0xac1bdc['as'],'attributes':_0xac1bdc[_0xb7f4('0x21')],'include':_0xac1bdc['include']?_[_0xb7f4('0x24')](_0xac1bdc['include'],function(_0x31a177){return{'model':db[_0x31a177[_0xb7f4('0x25')]],'as':_0x31a177['as'],'attributes':_0x31a177['attributes']};}):[]};}):[]};}):[]:[]})[_0xb7f4('0x11')](function(_0x22a96e){logger[_0xb7f4('0x19')]('ShowMailQueue',_0x3aef90);logger['debug'](_0xb7f4('0x26'),_0x3aef90,JSON[_0xb7f4('0x15')](_0x22a96e));_0x5d42c5(_0x22a96e);})[_0xb7f4('0x1b')](function(_0x153900){logger['error'](_0xb7f4('0x26'),_0x153900[_0xb7f4('0x18')],_0x3aef90);_0x5f3c83(_0x2685b2[_0xb7f4('0x16')](0x1f4,_0x153900['message']));});});}; \ No newline at end of file +var _0x5a97=['code','message','findAll','options','where','attributes','limit','include','map','model','then','GetMailQueue','ShowMailQueue','MailQueue','find','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x116e2f,_0x5811f9){var _0x546a80=function(_0x4b9138){while(--_0x4b9138){_0x116e2f['push'](_0x116e2f['shift']());}};_0x546a80(++_0x5811f9);}(_0x5a97,0x69));var _0x75a9=function(_0x13068f,_0x1da78d){_0x13068f=_0x13068f-0x0;var _0x4fc6f3=_0x5a97[_0x13068f];return _0x4fc6f3;};'use strict';var _=require(_0x75a9('0x0'));var util=require(_0x75a9('0x1'));var moment=require('moment');var BPromise=require(_0x75a9('0x2'));var rs=require(_0x75a9('0x3'));var fs=require('fs');var Redis=require(_0x75a9('0x4'));var db=require(_0x75a9('0x5'))['db'];var utils=require(_0x75a9('0x6'));var logger=require(_0x75a9('0x7'))(_0x75a9('0x8'));var config=require(_0x75a9('0x9'));var jayson=require(_0x75a9('0xa'));var client=jayson[_0x75a9('0xb')][_0x75a9('0xc')]({'port':0x232a});config[_0x75a9('0xd')]=_[_0x75a9('0xe')](config[_0x75a9('0xd')],{'host':_0x75a9('0xf'),'port':0x18eb});var socket=require(_0x75a9('0x10'))(new Redis(config[_0x75a9('0xd')]));require(_0x75a9('0x11'))[_0x75a9('0x12')](socket);function respondWithRpcPromise(_0x284562,_0x42a953,_0x57205c){return new BPromise(function(_0x308744,_0x3003be){return client[_0x75a9('0x13')](_0x284562,_0x57205c)['then'](function(_0x4ba90b){logger[_0x75a9('0x14')](_0x75a9('0x15'),_0x42a953,_0x75a9('0x16'));logger[_0x75a9('0x17')](_0x75a9('0x18'),_0x42a953,_0x75a9('0x16'),JSON[_0x75a9('0x19')](_0x4ba90b));if(_0x4ba90b[_0x75a9('0x1a')]){if(_0x4ba90b['error'][_0x75a9('0x1b')]===0x1f4){logger[_0x75a9('0x1a')](_0x75a9('0x15'),_0x42a953,_0x4ba90b[_0x75a9('0x1a')][_0x75a9('0x1c')]);return _0x3003be(_0x4ba90b[_0x75a9('0x1a')][_0x75a9('0x1c')]);}logger[_0x75a9('0x1a')](_0x75a9('0x15'),_0x42a953,_0x4ba90b[_0x75a9('0x1a')][_0x75a9('0x1c')]);return _0x308744(_0x4ba90b[_0x75a9('0x1a')][_0x75a9('0x1c')]);}else{logger[_0x75a9('0x14')](_0x75a9('0x15'),_0x42a953,_0x75a9('0x16'));_0x308744(_0x4ba90b['result'][_0x75a9('0x1c')]);}})['catch'](function(_0x46cc5a){logger[_0x75a9('0x1a')](_0x75a9('0x15'),_0x42a953,_0x46cc5a);_0x3003be(_0x46cc5a);});});}exports['GetMailQueue']=function(_0x1ff9eb){var _0x40865f=this;return new Promise(function(_0x475ce9,_0x37c307){return db['MailQueue'][_0x75a9('0x1d')]({'raw':_0x1ff9eb[_0x75a9('0x1e')]?_0x1ff9eb[_0x75a9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1ff9eb['options']?_0x1ff9eb['options'][_0x75a9('0x1f')]||null:null,'attributes':_0x1ff9eb['options']?_0x1ff9eb[_0x75a9('0x1e')][_0x75a9('0x20')]||null:null,'limit':_0x1ff9eb[_0x75a9('0x1e')]?_0x1ff9eb[_0x75a9('0x1e')][_0x75a9('0x21')]||null:null,'include':_0x1ff9eb[_0x75a9('0x1e')]?_0x1ff9eb[_0x75a9('0x1e')][_0x75a9('0x22')]?_[_0x75a9('0x23')](_0x1ff9eb[_0x75a9('0x1e')][_0x75a9('0x22')],function(_0x4189fd){return{'model':db[_0x4189fd[_0x75a9('0x24')]],'as':_0x4189fd['as'],'attributes':_0x4189fd[_0x75a9('0x20')],'include':_0x4189fd[_0x75a9('0x22')]?_[_0x75a9('0x23')](_0x4189fd['include'],function(_0x38550b){return{'model':db[_0x38550b[_0x75a9('0x24')]],'as':_0x38550b['as'],'attributes':_0x38550b[_0x75a9('0x20')],'include':_0x38550b['include']?_[_0x75a9('0x23')](_0x38550b[_0x75a9('0x22')],function(_0x13062a){return{'model':db[_0x13062a[_0x75a9('0x24')]],'as':_0x13062a['as'],'attributes':_0x13062a[_0x75a9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x75a9('0x25')](function(_0x1bea9b){logger[_0x75a9('0x14')](_0x75a9('0x26'),_0x1ff9eb);logger['debug'](_0x75a9('0x26'),_0x1ff9eb,JSON[_0x75a9('0x19')](_0x1bea9b));_0x475ce9(_0x1bea9b);})['catch'](function(_0x23f285){logger[_0x75a9('0x1a')](_0x75a9('0x26'),_0x23f285['message'],_0x1ff9eb);_0x37c307(_0x40865f[_0x75a9('0x1a')](0x1f4,_0x23f285['message']));});});};exports[_0x75a9('0x27')]=function(_0x388e6a){var _0x2bba5b=this;return new Promise(function(_0x4dead3,_0x4ec2fb){return db[_0x75a9('0x28')][_0x75a9('0x29')]({'raw':_0x388e6a[_0x75a9('0x1e')]?_0x388e6a['options'][_0x75a9('0x2a')]===undefined?!![]:![]:!![],'where':_0x388e6a[_0x75a9('0x1e')]?_0x388e6a['options'][_0x75a9('0x1f')]||null:null,'attributes':_0x388e6a[_0x75a9('0x1e')]?_0x388e6a[_0x75a9('0x1e')][_0x75a9('0x20')]||null:null,'include':_0x388e6a[_0x75a9('0x1e')]?_0x388e6a[_0x75a9('0x1e')][_0x75a9('0x22')]?_['map'](_0x388e6a[_0x75a9('0x1e')][_0x75a9('0x22')],function(_0x18dbae){return{'model':db[_0x18dbae[_0x75a9('0x24')]],'as':_0x18dbae['as'],'attributes':_0x18dbae['attributes'],'include':_0x18dbae['include']?_[_0x75a9('0x23')](_0x18dbae[_0x75a9('0x22')],function(_0x14c9ec){return{'model':db[_0x14c9ec[_0x75a9('0x24')]],'as':_0x14c9ec['as'],'attributes':_0x14c9ec[_0x75a9('0x20')],'include':_0x14c9ec[_0x75a9('0x22')]?_['map'](_0x14c9ec[_0x75a9('0x22')],function(_0x315d78){return{'model':db[_0x315d78[_0x75a9('0x24')]],'as':_0x315d78['as'],'attributes':_0x315d78['attributes']};}):[]};}):[]};}):[]:[]})[_0x75a9('0x25')](function(_0x3fd70e){logger['info'](_0x75a9('0x27'),_0x388e6a);logger[_0x75a9('0x17')](_0x75a9('0x27'),_0x388e6a,JSON['stringify'](_0x3fd70e));_0x4dead3(_0x3fd70e);})[_0x75a9('0x2b')](function(_0x22e92c){logger[_0x75a9('0x1a')]('ShowMailQueue',_0x22e92c['message'],_0x388e6a);_0x4ec2fb(_0x2bba5b[_0x75a9('0x1a')](0x1f4,_0x22e92c[_0x75a9('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 98d7049..3d1995a 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 _0x2dd3=['./mailQueue.events','save','remove','update','emit','removeListener','register','length','mailQueue:'];(function(_0x5f0196,_0x7a742b){var _0x5e960f=function(_0x2d806e){while(--_0x2d806e){_0x5f0196['push'](_0x5f0196['shift']());}};_0x5e960f(++_0x7a742b);}(_0x2dd3,0x99));var _0x32dd=function(_0xdd8982,_0x466f73){_0xdd8982=_0xdd8982-0x0;var _0x1ea678=_0x2dd3[_0xdd8982];return _0x1ea678;};'use strict';var MailQueueEvents=require(_0x32dd('0x0'));var events=[_0x32dd('0x1'),_0x32dd('0x2'),_0x32dd('0x3')];function createListener(_0x1d54b2,_0x2172b2){return function(_0x3b01e5){_0x2172b2[_0x32dd('0x4')](_0x1d54b2,_0x3b01e5);};}function removeListener(_0x23730f,_0x3706ef){return function(){MailQueueEvents[_0x32dd('0x5')](_0x23730f,_0x3706ef);};}exports[_0x32dd('0x6')]=function(_0x5ecea6){for(var _0x142edc=0x0,_0x37edb0=events[_0x32dd('0x7')];_0x142edc<_0x37edb0;_0x142edc++){var _0x4e95ee=events[_0x142edc];var _0x5d7793=createListener(_0x32dd('0x8')+_0x4e95ee,_0x5ecea6);MailQueueEvents['on'](_0x4e95ee,_0x5d7793);}}; \ No newline at end of file +var _0x2100=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0x2100,0x9f));var _0x0210=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x2100[_0x135904];return _0x1ce7d5;};'use strict';var MailQueueEvents=require(_0x0210('0x0'));var events=[_0x0210('0x1'),_0x0210('0x2'),_0x0210('0x3')];function createListener(_0x12537c,_0x5c50fd){return function(_0x47e2d3){_0x5c50fd[_0x0210('0x4')](_0x12537c,_0x47e2d3);};}function removeListener(_0x213479,_0x2a498b){return function(){MailQueueEvents[_0x0210('0x5')](_0x213479,_0x2a498b);};}exports[_0x0210('0x6')]=function(_0x32c075){for(var _0x32db9c=0x0,_0x1e4f85=events[_0x0210('0x7')];_0x32db9c<_0x1e4f85;_0x32db9c++){var _0x36a008=events[_0x32db9c];var _0x48faf4=createListener(_0x0210('0x8')+_0x36a008,_0x32c075);MailQueueEvents['on'](_0x36a008,_0x48faf4);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index cc36cd3..4d92a60 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 _0x1958=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailQueueReport.controller','get','index','/describe','isAuthenticated','post','create','/:id','update','destroy','multer','util','path'];(function(_0x5aeb36,_0x9d55c2){var _0x1bae92=function(_0x2fca00){while(--_0x2fca00){_0x5aeb36['push'](_0x5aeb36['shift']());}};_0x1bae92(++_0x9d55c2);}(_0x1958,0xb1));var _0x8195=function(_0x578a80,_0x412698){_0x578a80=_0x578a80-0x0;var _0x4b4ba8=_0x1958[_0x578a80];return _0x4b4ba8;};'use strict';var multer=require(_0x8195('0x0'));var util=require(_0x8195('0x1'));var path=require(_0x8195('0x2'));var timeout=require(_0x8195('0x3'));var express=require(_0x8195('0x4'));var router=express[_0x8195('0x5')]();var fs_extra=require(_0x8195('0x6'));var auth=require(_0x8195('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8195('0x8'));router[_0x8195('0x9')]('/',auth['isAuthenticated'](),controller[_0x8195('0xa')]);router[_0x8195('0x9')](_0x8195('0xb'),auth[_0x8195('0xc')](),controller['describe']);router['get']('/:id',auth[_0x8195('0xc')](),controller['show']);router[_0x8195('0xd')]('/',auth[_0x8195('0xc')](),controller[_0x8195('0xe')]);router['put'](_0x8195('0xf'),auth[_0x8195('0xc')](),controller[_0x8195('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8195('0x11')]);module['exports']=router; \ No newline at end of file +var _0x55f5=['describe','/:id','post','create','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','get','/describe'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x55f5,0x167));var _0x555f=function(_0x415cf7,_0x1d3ca0){_0x415cf7=_0x415cf7-0x0;var _0x533c40=_0x55f5[_0x415cf7];return _0x533c40;};'use strict';var multer=require(_0x555f('0x0'));var util=require('util');var path=require(_0x555f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x555f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x555f('0x3'));var interaction=require(_0x555f('0x4'));var config=require('../../config/environment');var controller=require(_0x555f('0x5'));router['get']('/',auth[_0x555f('0x6')](),controller['index']);router[_0x555f('0x7')](_0x555f('0x8'),auth['isAuthenticated'](),controller[_0x555f('0x9')]);router[_0x555f('0x7')](_0x555f('0xa'),auth[_0x555f('0x6')](),controller['show']);router[_0x555f('0xb')]('/',auth[_0x555f('0x6')](),controller[_0x555f('0xc')]);router['put'](_0x555f('0xa'),auth[_0x555f('0x6')](),controller[_0x555f('0xd')]);router[_0x555f('0xe')](_0x555f('0xa'),auth[_0x555f('0x6')](),controller['destroy']);module[_0x555f('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index bb542b4..9035d96 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 _0xa9b3=['sequelize','exports','STRING','DATE'];(function(_0x28f37b,_0x3eb120){var _0x38c358=function(_0x1a8306){while(--_0x1a8306){_0x28f37b['push'](_0x28f37b['shift']());}};_0x38c358(++_0x3eb120);}(_0xa9b3,0x110));var _0x3a9b=function(_0x2b2094,_0x59e69d){_0x2b2094=_0x2b2094-0x0;var _0x3d56ff=_0xa9b3[_0x2b2094];return _0x3d56ff;};'use strict';var moment=require('moment');var Sequelize=require(_0x3a9b('0x0'));module[_0x3a9b('0x1')]={'uniqueid':{'type':Sequelize[_0x3a9b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3a9b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3a9b('0x3')]},'acceptAt':{'type':Sequelize[_0x3a9b('0x3')]},'exitAt':{'type':Sequelize[_0x3a9b('0x3')]},'reason':{'type':Sequelize[_0x3a9b('0x2')]}}; \ No newline at end of file +var _0x8828=['moment','exports','STRING','DATE'];(function(_0x535780,_0x5d5d47){var _0x1a03fb=function(_0x3c9eaa){while(--_0x3c9eaa){_0x535780['push'](_0x535780['shift']());}};_0x1a03fb(++_0x5d5d47);}(_0x8828,0x184));var _0x8882=function(_0x361cfe,_0x600901){_0x361cfe=_0x361cfe-0x0;var _0x43951c=_0x8828[_0x361cfe];return _0x43951c;};'use strict';var moment=require(_0x8882('0x0'));var Sequelize=require('sequelize');module[_0x8882('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8882('0x2')]},'joinAt':{'type':Sequelize[_0x8882('0x3')]},'leaveAt':{'type':Sequelize[_0x8882('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8882('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index d2a3f28..4ac05ed 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 _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','MailQueueReport','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0xe8d31b,_0x1ab3f0){var _0x4e8ad7=function(_0x36b4bb){while(--_0x36b4bb){_0xe8d31b['push'](_0xe8d31b['shift']());}};_0x4e8ad7(++_0x1ab3f0);}(_0xef0f,0x168));var _0xfef0=function(_0x5d3a11,_0x4ac110){_0x5d3a11=_0x5d3a11-0x0;var _0x5110b8=_0xef0f[_0x5d3a11];return _0x5110b8;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['MailQueueReport']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':!![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file +var _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','MailQueueReport','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack'];(function(_0x1a7aec,_0x17d0d0){var _0x101926=function(_0x4332b5){while(--_0x4332b5){_0x1a7aec['push'](_0x1a7aec['shift']());}};_0x101926(++_0x17d0d0);}(_0x2ef3,0xba));var _0x32ef=function(_0x407611,_0x3de779){_0x407611=_0x407611-0x0;var _0x9151a4=_0x2ef3[_0x407611];return _0x9151a4;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['MailQueueReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['MailQueueReport'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['MailQueueReport']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 80d1011..9d2bab3 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 _0x2bbb=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','MailQueueReport','uniqueid'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x2bbb,0x1d9));var _0xb2bb=function(_0x13ff2f,_0x316336){_0x13ff2f=_0x13ff2f-0x0;var _0x1fa23f=_0x2bbb[_0x13ff2f];return _0x1fa23f;};'use strict';var _=require(_0xb2bb('0x0'));var util=require(_0xb2bb('0x1'));var logger=require(_0xb2bb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb2bb('0x3'));var rp=require(_0xb2bb('0x4'));var fs=require('fs');var path=require(_0xb2bb('0x5'));var rimraf=require(_0xb2bb('0x6'));var config=require(_0xb2bb('0x7'));var attributes=require(_0xb2bb('0x8'));module['exports']=function(_0x425aca,_0x2718b7){return _0x425aca['define'](_0xb2bb('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xb2bb('0xa'),'fields':[_0xb2bb('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c3d=['exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x553579,_0x269bd9){var _0x156ea3=function(_0x3bd6bb){while(--_0x3bd6bb){_0x553579['push'](_0x553579['shift']());}};_0x156ea3(++_0x269bd9);}(_0x8c3d,0x16a));var _0xd8c3=function(_0x4e8401,_0x51b328){_0x4e8401=_0x4e8401-0x0;var _0x17269f=_0x8c3d[_0x4e8401];return _0x17269f;};'use strict';var _=require(_0xd8c3('0x0'));var util=require(_0xd8c3('0x1'));var logger=require(_0xd8c3('0x2'))('api');var moment=require(_0xd8c3('0x3'));var BPromise=require(_0xd8c3('0x4'));var rp=require(_0xd8c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8c3('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xd8c3('0x7')]=function(_0x117b77,_0x153554){return _0x117b77[_0xd8c3('0x8')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 6225b4d..3fc2106 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2c47c7,_0x573036){var _0x1bfeea=function(_0x588e6f){while(--_0x588e6f){_0x2c47c7['push'](_0x2c47c7['shift']());}};_0x1bfeea(++_0x573036);}(_0x1261,0x144));var _0x1126=function(_0x33e93d,_0x1a8423){_0x33e93d=_0x33e93d-0x0;var _0x19e99d=_0x1261[_0x33e93d];return _0x19e99d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x1d312c,_0x40ffb2){var _0x32fc37=function(_0x11db86){while(--_0x11db86){_0x1d312c['push'](_0x1d312c['shift']());}};_0x32fc37(++_0x40ffb2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f364bde..b393a8e 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x422890,_0x434494){var _0x202cf0=function(_0x10e9f0){while(--_0x10e9f0){_0x422890['push'](_0x422890['shift']());}};_0x202cf0(++_0x434494);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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(_0x438075,_0x59ca9e){var _0x3c2ff0=function(_0x305e6e){while(--_0x305e6e){_0x438075['push'](_0x438075['shift']());}};_0x3c2ff0(++_0x59ca9e);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index ba6a661..68afaa7 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 _0xb99f=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x36b686,_0x3b0e82){var _0x4d1a91=function(_0x5c0020){while(--_0x5c0020){_0x36b686['push'](_0x36b686['shift']());}};_0x4d1a91(++_0x3b0e82);}(_0xb99f,0x95));var _0xfb99=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xb99f[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0xfb99('0x0'));module[_0xfb99('0x1')]={'description':{'type':Sequelize[_0xfb99('0x2')]},'host':{'type':Sequelize[_0xfb99('0x2')]},'authentication':{'type':Sequelize[_0xfb99('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xfb99('0x2')]},'password':{'type':Sequelize[_0xfb99('0x2')]},'port':{'type':Sequelize[_0xfb99('0x4')]},'tls':{'type':Sequelize[_0xfb99('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xfb99('0x5')},'connTimeout':{'type':Sequelize[_0xfb99('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xfb99('0x2')]},'modernAuthentication':{'type':Sequelize[_0xfb99('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa77e=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x2a4d7f,_0x3d0d40){var _0x36f0c7=function(_0xcf4aed){while(--_0xcf4aed){_0x2a4d7f['push'](_0x2a4d7f['shift']());}};_0x36f0c7(++_0x3d0d40);}(_0xa77e,0x197));var _0xea77=function(_0x1cefc2,_0x3cd675){_0x1cefc2=_0x1cefc2-0x0;var _0x5c1b6e=_0xa77e[_0x1cefc2];return _0x5c1b6e;};'use strict';var Sequelize=require(_0xea77('0x0'));module[_0xea77('0x1')]={'description':{'type':Sequelize[_0xea77('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xea77('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xea77('0x2')]},'password':{'type':Sequelize[_0xea77('0x2')]},'port':{'type':Sequelize[_0xea77('0x4')]},'tls':{'type':Sequelize[_0xea77('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xea77('0x2')],'defaultValue':_0xea77('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xea77('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xea77('0x2')]},'modernAuthentication':{'type':Sequelize[_0xea77('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index cb56a3d..924f407 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 _0x2529=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','MailServerIn'];(function(_0x3d42fc,_0x85b11b){var _0x5a592d=function(_0xeac2cc){while(--_0xeac2cc){_0x3d42fc['push'](_0x3d42fc['shift']());}};_0x5a592d(++_0x85b11b);}(_0x2529,0xb4));var _0x9252=function(_0x355c67,_0x2cc275){_0x355c67=_0x355c67-0x0;var _0x36f2f7=_0x2529[_0x355c67];return _0x36f2f7;};'use strict';var _=require(_0x9252('0x0'));var util=require(_0x9252('0x1'));var logger=require(_0x9252('0x2'))(_0x9252('0x3'));var moment=require(_0x9252('0x4'));var BPromise=require(_0x9252('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9252('0x6'));var rimraf=require(_0x9252('0x7'));var config=require(_0x9252('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x9252('0x9')]=function(_0x4ec0e8,_0x5cc810){return _0x4ec0e8[_0x9252('0xa')](_0x9252('0xb'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc248=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in'];(function(_0x1f0bb3,_0x3a34f3){var _0x37c7c3=function(_0x9a157e){while(--_0x9a157e){_0x1f0bb3['push'](_0x1f0bb3['shift']());}};_0x37c7c3(++_0x3a34f3);}(_0xc248,0xfc));var _0x8c24=function(_0x1230e6,_0x1031ce){_0x1230e6=_0x1230e6-0x0;var _0x4e7cc5=_0xc248[_0x1230e6];return _0x4e7cc5;};'use strict';var _=require(_0x8c24('0x0'));var util=require(_0x8c24('0x1'));var logger=require(_0x8c24('0x2'))(_0x8c24('0x3'));var moment=require('moment');var BPromise=require(_0x8c24('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c24('0x5'));var rimraf=require(_0x8c24('0x6'));var config=require(_0x8c24('0x7'));var attributes=require(_0x8c24('0x8'));module[_0x8c24('0x9')]=function(_0xa54a12,_0x34f040){return _0xa54a12[_0x8c24('0xa')]('MailServerIn',attributes,{'tableName':_0x8c24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index b9a4931..afa699e 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 _0x9498=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','info','result','MailServerIn','options','attributes','limit','map','model','include','GetMailServerIn','catch','lodash','util','moment'];(function(_0x46b1fd,_0x4215ba){var _0x2faf32=function(_0x2471eb){while(--_0x2471eb){_0x46b1fd['push'](_0x46b1fd['shift']());}};_0x2faf32(++_0x4215ba);}(_0x9498,0x105));var _0x8949=function(_0x1cc519,_0xcf9f3){_0x1cc519=_0x1cc519-0x0;var _0x51ca1e=_0x9498[_0x1cc519];return _0x51ca1e;};'use strict';var _=require(_0x8949('0x0'));var util=require(_0x8949('0x1'));var moment=require(_0x8949('0x2'));var BPromise=require(_0x8949('0x3'));var rs=require(_0x8949('0x4'));var fs=require('fs');var Redis=require(_0x8949('0x5'));var db=require(_0x8949('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8949('0x7'))('rpc');var config=require(_0x8949('0x8'));var jayson=require(_0x8949('0x9'));var client=jayson[_0x8949('0xa')][_0x8949('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16b877,_0x1a699e,_0x1f7b6d){return new BPromise(function(_0x4cf13f,_0x459b2c){return client[_0x8949('0xc')](_0x16b877,_0x1f7b6d)[_0x8949('0xd')](function(_0x19948f){logger['info']('MailServerIn,\x20%s,\x20%s',_0x1a699e,_0x8949('0xe'));logger[_0x8949('0xf')](_0x8949('0x10'),_0x1a699e,'request\x20sent',JSON[_0x8949('0x11')](_0x19948f));if(_0x19948f['error']){if(_0x19948f[_0x8949('0x12')][_0x8949('0x13')]===0x1f4){logger['error'](_0x8949('0x14'),_0x1a699e,_0x19948f[_0x8949('0x12')][_0x8949('0x15')]);return _0x459b2c(_0x19948f[_0x8949('0x12')][_0x8949('0x15')]);}logger[_0x8949('0x12')](_0x8949('0x14'),_0x1a699e,_0x19948f[_0x8949('0x12')][_0x8949('0x15')]);return _0x4cf13f(_0x19948f[_0x8949('0x12')][_0x8949('0x15')]);}else{logger[_0x8949('0x16')](_0x8949('0x14'),_0x1a699e,_0x8949('0xe'));_0x4cf13f(_0x19948f[_0x8949('0x17')][_0x8949('0x15')]);}})['catch'](function(_0x5e4bc8){logger[_0x8949('0x12')](_0x8949('0x14'),_0x1a699e,_0x5e4bc8);_0x459b2c(_0x5e4bc8);});});}exports['GetMailServerIn']=function(_0x529eba){var _0x22ea12=this;return new Promise(function(_0x5c26f0,_0x1b5f23){return db[_0x8949('0x18')]['findAll']({'raw':_0x529eba[_0x8949('0x19')]?_0x529eba['options']['raw']===undefined?!![]:![]:!![],'where':_0x529eba[_0x8949('0x19')]?_0x529eba['options']['where']||null:null,'attributes':_0x529eba[_0x8949('0x19')]?_0x529eba['options'][_0x8949('0x1a')]||null:null,'limit':_0x529eba[_0x8949('0x19')]?_0x529eba[_0x8949('0x19')][_0x8949('0x1b')]||null:null,'include':_0x529eba['options']?_0x529eba[_0x8949('0x19')]['include']?_[_0x8949('0x1c')](_0x529eba['options']['include'],function(_0xdc1c){return{'model':db[_0xdc1c[_0x8949('0x1d')]],'as':_0xdc1c['as'],'attributes':_0xdc1c['attributes'],'include':_0xdc1c['include']?_['map'](_0xdc1c['include'],function(_0x219339){return{'model':db[_0x219339[_0x8949('0x1d')]],'as':_0x219339['as'],'attributes':_0x219339[_0x8949('0x1a')],'include':_0x219339['include']?_[_0x8949('0x1c')](_0x219339[_0x8949('0x1e')],function(_0x29622f){return{'model':db[_0x29622f['model']],'as':_0x29622f['as'],'attributes':_0x29622f[_0x8949('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18e5f9){logger[_0x8949('0x16')](_0x8949('0x1f'),_0x529eba);logger[_0x8949('0xf')](_0x8949('0x1f'),_0x529eba,JSON['stringify'](_0x18e5f9));_0x5c26f0(_0x18e5f9);})[_0x8949('0x20')](function(_0x1282c1){logger[_0x8949('0x12')]('GetMailServerIn',_0x1282c1[_0x8949('0x15')],_0x529eba);_0x1b5f23(_0x22ea12[_0x8949('0x12')](0x1f4,_0x1282c1[_0x8949('0x15')]));});});}; \ No newline at end of file +var _0x2720=['http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailServerIn','MailServerIn','options','raw','where','include','map','model','attributes','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5e352d,_0x32cafd){var _0x10c2b9=function(_0xe1e05d){while(--_0xe1e05d){_0x5e352d['push'](_0x5e352d['shift']());}};_0x10c2b9(++_0x32cafd);}(_0x2720,0xc1));var _0x0272=function(_0x55aab3,_0x50b5e1){_0x55aab3=_0x55aab3-0x0;var _0x5baa84=_0x2720[_0x55aab3];return _0x5baa84;};'use strict';var _=require(_0x0272('0x0'));var util=require(_0x0272('0x1'));var moment=require('moment');var BPromise=require(_0x0272('0x2'));var rs=require(_0x0272('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0272('0x4'))['db'];var utils=require(_0x0272('0x5'));var logger=require(_0x0272('0x6'))(_0x0272('0x7'));var config=require(_0x0272('0x8'));var jayson=require(_0x0272('0x9'));var client=jayson[_0x0272('0xa')][_0x0272('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45448c,_0x4a0420,_0x56afad){return new BPromise(function(_0x1d2b37,_0x51cebc){return client[_0x0272('0xc')](_0x45448c,_0x56afad)[_0x0272('0xd')](function(_0x198871){logger[_0x0272('0xe')](_0x0272('0xf'),_0x4a0420,_0x0272('0x10'));logger[_0x0272('0x11')](_0x0272('0x12'),_0x4a0420,_0x0272('0x10'),JSON[_0x0272('0x13')](_0x198871));if(_0x198871[_0x0272('0x14')]){if(_0x198871[_0x0272('0x14')][_0x0272('0x15')]===0x1f4){logger[_0x0272('0x14')]('MailServerIn,\x20%s,\x20%s',_0x4a0420,_0x198871[_0x0272('0x14')][_0x0272('0x16')]);return _0x51cebc(_0x198871[_0x0272('0x14')][_0x0272('0x16')]);}logger[_0x0272('0x14')]('MailServerIn,\x20%s,\x20%s',_0x4a0420,_0x198871[_0x0272('0x14')][_0x0272('0x16')]);return _0x1d2b37(_0x198871[_0x0272('0x14')][_0x0272('0x16')]);}else{logger[_0x0272('0xe')](_0x0272('0xf'),_0x4a0420,'request\x20sent');_0x1d2b37(_0x198871[_0x0272('0x17')]['message']);}})['catch'](function(_0x4ffd4a){logger['error'](_0x0272('0xf'),_0x4a0420,_0x4ffd4a);_0x51cebc(_0x4ffd4a);});});}exports[_0x0272('0x18')]=function(_0x2b9c50){var _0x4f0f07=this;return new Promise(function(_0x3816b4,_0x5bf735){return db[_0x0272('0x19')]['findAll']({'raw':_0x2b9c50[_0x0272('0x1a')]?_0x2b9c50[_0x0272('0x1a')][_0x0272('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b9c50['options']?_0x2b9c50[_0x0272('0x1a')][_0x0272('0x1c')]||null:null,'attributes':_0x2b9c50[_0x0272('0x1a')]?_0x2b9c50[_0x0272('0x1a')]['attributes']||null:null,'limit':_0x2b9c50['options']?_0x2b9c50[_0x0272('0x1a')]['limit']||null:null,'include':_0x2b9c50['options']?_0x2b9c50[_0x0272('0x1a')][_0x0272('0x1d')]?_[_0x0272('0x1e')](_0x2b9c50[_0x0272('0x1a')]['include'],function(_0x3d22cb){return{'model':db[_0x3d22cb[_0x0272('0x1f')]],'as':_0x3d22cb['as'],'attributes':_0x3d22cb[_0x0272('0x20')],'include':_0x3d22cb[_0x0272('0x1d')]?_[_0x0272('0x1e')](_0x3d22cb[_0x0272('0x1d')],function(_0x1ed4d6){return{'model':db[_0x1ed4d6[_0x0272('0x1f')]],'as':_0x1ed4d6['as'],'attributes':_0x1ed4d6[_0x0272('0x20')],'include':_0x1ed4d6['include']?_[_0x0272('0x1e')](_0x1ed4d6[_0x0272('0x1d')],function(_0x50af7f){return{'model':db[_0x50af7f[_0x0272('0x1f')]],'as':_0x50af7f['as'],'attributes':_0x50af7f[_0x0272('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f7a28){logger[_0x0272('0xe')]('GetMailServerIn',_0x2b9c50);logger[_0x0272('0x11')]('GetMailServerIn',_0x2b9c50,JSON[_0x0272('0x13')](_0x3f7a28));_0x3816b4(_0x3f7a28);})[_0x0272('0x21')](function(_0x5a6a0e){logger[_0x0272('0x14')]('GetMailServerIn',_0x5a6a0e[_0x0272('0x16')],_0x2b9c50);_0x5bf735(_0x4f0f07['error'](0x1f4,_0x5a6a0e[_0x0272('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 39249ca..9604652 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7a54,0x106));var _0x47a5=function(_0x194163,_0x3e3f4c){_0x194163=_0x194163-0x0;var _0x2e9254=_0x7a54[_0x194163];return _0x2e9254;};'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 895ba78..7b02da1 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 _0xefda=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x14d676,_0x433920){var _0x3636e9=function(_0x2f61e5){while(--_0x2f61e5){_0x14d676['push'](_0x14d676['shift']());}};_0x3636e9(++_0x433920);}(_0xefda,0x96));var _0xaefd=function(_0x56e478,_0x207138){_0x56e478=_0x56e478-0x0;var _0x96ec21=_0xefda[_0x56e478];return _0x96ec21;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xaefd('0x1')]},'user':{'type':Sequelize[_0xaefd('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaefd('0x2')]},'secure':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xaefd('0x1')]},'authentication':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6cb4=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x4f7ebd,_0x14fa97){var _0x279d40=function(_0x5a2770){while(--_0x5a2770){_0x4f7ebd['push'](_0x4f7ebd['shift']());}};_0x279d40(++_0x14fa97);}(_0x6cb4,0xff));var _0x46cb=function(_0x2375ba,_0x4a32fb){_0x2375ba=_0x2375ba-0x0;var _0x42e8b6=_0x6cb4[_0x2375ba];return _0x42e8b6;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'description':{'type':Sequelize[_0x46cb('0x2')]},'host':{'type':Sequelize[_0x46cb('0x2')]},'user':{'type':Sequelize[_0x46cb('0x2')]},'pass':{'type':Sequelize[_0x46cb('0x2')]},'port':{'type':Sequelize[_0x46cb('0x3')]},'secure':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x46cb('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 5f95218..4b992b2 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 _0xc28b=['filter','merge','VIRTUAL','options','MailServerOut','includeAll','include','rows','catch','params','find','create','body','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','destroy','then','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x2d807b,_0x14e08b){var _0x51fccc=function(_0x3e6490){while(--_0x3e6490){_0x2d807b['push'](_0x2d807b['shift']());}};_0x51fccc(++_0x14e08b);}(_0xc28b,0x1f0));var _0xbc28=function(_0x596e29,_0x29a9a4){_0x596e29=_0x596e29-0x0;var _0x5c966e=_0xc28b[_0x596e29];return _0x5c966e;};'use strict';var emlformat=require(_0xbc28('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbc28('0x1'));var rp=require('request-promise');var moment=require(_0xbc28('0x2'));var BPromise=require(_0xbc28('0x3'));var Mustache=require(_0xbc28('0x4'));var util=require(_0xbc28('0x5'));var path=require('path');var sox=require(_0xbc28('0x6'));var csv=require(_0xbc28('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc28('0x8'));var _=require(_0xbc28('0x9'));var squel=require('squel');var crypto=require(_0xbc28('0xa'));var jsforce=require(_0xbc28('0xb'));var deskjs=require(_0xbc28('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbc28('0xd'));var Papa=require('papaparse');var Redis=require(_0xbc28('0xe'));var authService=require(_0xbc28('0xf'));var qs=require(_0xbc28('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc28('0x11'));var logger=require(_0xbc28('0x12'))(_0xbc28('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbc28('0x14'));var db=require(_0xbc28('0x15'))['db'];function respondWithStatusCode(_0x115c39,_0x42a765){_0x42a765=_0x42a765||0xcc;return function(_0x37b1bb){if(_0x37b1bb){return _0x115c39[_0xbc28('0x16')](_0x42a765);}return _0x115c39[_0xbc28('0x17')](_0x42a765)['end']();};}function respondWithResult(_0x1e3141,_0x56d252){_0x56d252=_0x56d252||0xc8;return function(_0x5085cc){if(_0x5085cc){return _0x1e3141[_0xbc28('0x17')](_0x56d252)[_0xbc28('0x18')](_0x5085cc);}};}function respondWithFilteredResult(_0x38060d,_0x276a79){return function(_0x58659c){if(_0x58659c){var _0x32fe31=typeof _0x276a79[_0xbc28('0x19')]===_0xbc28('0x1a')&&typeof _0x276a79[_0xbc28('0x1b')]===_0xbc28('0x1a');var _0x3efbce=_0x58659c[_0xbc28('0x1c')];var _0x382852=_0x32fe31?0x0:_0x276a79[_0xbc28('0x19')];var _0x126f08=_0x32fe31?_0x58659c['count']:_0x276a79[_0xbc28('0x19')]+_0x276a79[_0xbc28('0x1b')];var _0x4a736a;if(_0x126f08>=_0x3efbce){_0x126f08=_0x3efbce;_0x4a736a=0xc8;}else{_0x4a736a=0xce;}_0x38060d[_0xbc28('0x17')](_0x4a736a);return _0x38060d[_0xbc28('0x1d')]('Content-Range',_0x382852+'-'+_0x126f08+'/'+_0x3efbce)[_0xbc28('0x18')](_0x58659c);}return null;};}function patchUpdates(_0xcac121){return function(_0x276ce0){try{jsonpatch['apply'](_0x276ce0,_0xcac121,!![]);}catch(_0xb98ce0){return BPromise[_0xbc28('0x1e')](_0xb98ce0);}return _0x276ce0['save']();};}function saveUpdates(_0x2f141d,_0x1b0286){return function(_0x113452){if(_0x113452){return _0x113452['update'](_0x2f141d)['then'](function(_0x48e89a){return _0x48e89a;});}return null;};}function removeEntity(_0x47bf96,_0x4a8e7a){return function(_0x1eb081){if(_0x1eb081){return _0x1eb081[_0xbc28('0x1f')]()[_0xbc28('0x20')](function(){_0x47bf96[_0xbc28('0x17')](0xcc)[_0xbc28('0x21')]();});}};}function handleEntityNotFound(_0x2cd528,_0x5e175e){return function(_0x150782){if(!_0x150782){_0x2cd528[_0xbc28('0x16')](0x194);}return _0x150782;};}function handleError(_0xc2b4af,_0x43a9aa){_0x43a9aa=_0x43a9aa||0x1f4;return function(_0x496b37){logger[_0xbc28('0x22')](_0x496b37['stack']);if(_0x496b37[_0xbc28('0x23')]){delete _0x496b37['name'];}_0xc2b4af[_0xbc28('0x17')](_0x43a9aa)[_0xbc28('0x24')](_0x496b37);};}exports['index']=function(_0x47aad0,_0x16f2cd){var _0x4270ae={},_0x6a5fa0={},_0x443003={'count':0x0,'rows':[]};var _0x2b272e=_[_0xbc28('0x25')](db['MailServerOut'][_0xbc28('0x26')],function(_0x505b1a){return{'name':_0x505b1a[_0xbc28('0x27')],'type':_0x505b1a[_0xbc28('0x28')][_0xbc28('0x29')]};});_0x6a5fa0[_0xbc28('0x2a')]=_[_0xbc28('0x25')](_0x2b272e,'name');_0x6a5fa0[_0xbc28('0x2b')]=_[_0xbc28('0x2c')](_0x47aad0[_0xbc28('0x2b')]);_0x6a5fa0['filters']=_[_0xbc28('0x2d')](_0x6a5fa0['model'],_0x6a5fa0[_0xbc28('0x2b')]);_0x4270ae['attributes']=_['intersection'](_0x6a5fa0[_0xbc28('0x2a')],qs[_0xbc28('0x2e')](_0x47aad0[_0xbc28('0x2b')][_0xbc28('0x2e')]));_0x4270ae['attributes']=_0x4270ae[_0xbc28('0x2f')][_0xbc28('0x30')]?_0x4270ae[_0xbc28('0x2f')]:_0x6a5fa0[_0xbc28('0x2a')];if(!_0x47aad0[_0xbc28('0x2b')][_0xbc28('0x31')](_0xbc28('0x32'))){_0x4270ae[_0xbc28('0x1b')]=qs[_0xbc28('0x1b')](_0x47aad0[_0xbc28('0x2b')][_0xbc28('0x1b')]);_0x4270ae[_0xbc28('0x19')]=qs['offset'](_0x47aad0[_0xbc28('0x2b')][_0xbc28('0x19')]);}_0x4270ae[_0xbc28('0x33')]=qs['sort'](_0x47aad0['query'][_0xbc28('0x34')]);_0x4270ae[_0xbc28('0x35')]=qs[_0xbc28('0x36')](_[_0xbc28('0x37')](_0x47aad0[_0xbc28('0x2b')],_0x6a5fa0[_0xbc28('0x36')]),_0x2b272e);if(_0x47aad0[_0xbc28('0x2b')][_0xbc28('0x38')]){_0x4270ae[_0xbc28('0x35')]=_[_0xbc28('0x39')](_0x4270ae[_0xbc28('0x35')],{'$or':_[_0xbc28('0x25')](_0x2b272e,function(_0x366601){if(_0x366601['type']!==_0xbc28('0x3a')){var _0x151865={};_0x151865[_0x366601['name']]={'$like':'%'+_0x47aad0[_0xbc28('0x2b')][_0xbc28('0x38')]+'%'};return _0x151865;}})});}_0x4270ae=_[_0xbc28('0x39')]({},_0x4270ae,_0x47aad0[_0xbc28('0x3b')]);var _0x2a9028={'where':_0x4270ae['where']};return db[_0xbc28('0x3c')][_0xbc28('0x1c')](_0x2a9028)[_0xbc28('0x20')](function(_0x7ec09c){_0x443003[_0xbc28('0x1c')]=_0x7ec09c;if(_0x47aad0['query'][_0xbc28('0x3d')]){_0x4270ae[_0xbc28('0x3e')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x4270ae);})[_0xbc28('0x20')](function(_0x19cad2){_0x443003[_0xbc28('0x3f')]=_0x19cad2;return _0x443003;})['then'](respondWithFilteredResult(_0x16f2cd,_0x4270ae))[_0xbc28('0x40')](handleError(_0x16f2cd,null));};exports['show']=function(_0x32b772,_0x3d99e4){var _0x594782={'raw':!![],'where':{'id':_0x32b772[_0xbc28('0x41')]['id']}},_0x11599e={};_0x11599e['model']=_['keys'](db[_0xbc28('0x3c')][_0xbc28('0x26')]);_0x11599e['query']=_[_0xbc28('0x2c')](_0x32b772[_0xbc28('0x2b')]);_0x11599e[_0xbc28('0x36')]=_[_0xbc28('0x2d')](_0x11599e[_0xbc28('0x2a')],_0x11599e[_0xbc28('0x2b')]);_0x594782['attributes']=_[_0xbc28('0x2d')](_0x11599e[_0xbc28('0x2a')],qs[_0xbc28('0x2e')](_0x32b772['query'][_0xbc28('0x2e')]));_0x594782[_0xbc28('0x2f')]=_0x594782[_0xbc28('0x2f')]['length']?_0x594782[_0xbc28('0x2f')]:_0x11599e[_0xbc28('0x2a')];if(_0x32b772[_0xbc28('0x2b')][_0xbc28('0x3d')]){_0x594782[_0xbc28('0x3e')]=[{'all':!![]}];}_0x594782=_[_0xbc28('0x39')]({},_0x594782,_0x32b772[_0xbc28('0x3b')]);return db['MailServerOut'][_0xbc28('0x42')](_0x594782)[_0xbc28('0x20')](handleEntityNotFound(_0x3d99e4,null))[_0xbc28('0x20')](respondWithResult(_0x3d99e4,null))['catch'](handleError(_0x3d99e4,null));};exports[_0xbc28('0x43')]=function(_0x5458cc,_0x304a6c){return db[_0xbc28('0x3c')]['create'](_0x5458cc[_0xbc28('0x44')],{})['then'](respondWithResult(_0x304a6c,0xc9))['catch'](handleError(_0x304a6c,null));};exports['update']=function(_0x54969d,_0x328f42){if(_0x54969d[_0xbc28('0x44')]['id']){delete _0x54969d[_0xbc28('0x44')]['id'];}return db[_0xbc28('0x3c')][_0xbc28('0x42')]({'where':{'id':_0x54969d[_0xbc28('0x41')]['id']}})[_0xbc28('0x20')](handleEntityNotFound(_0x328f42,null))[_0xbc28('0x20')](saveUpdates(_0x54969d[_0xbc28('0x44')],null))[_0xbc28('0x20')](respondWithResult(_0x328f42,null))[_0xbc28('0x40')](handleError(_0x328f42,null));};exports['destroy']=function(_0x4a8a38,_0x3b1192){return db[_0xbc28('0x3c')][_0xbc28('0x42')]({'where':{'id':_0x4a8a38['params']['id']}})[_0xbc28('0x20')](handleEntityNotFound(_0x3b1192,null))[_0xbc28('0x20')](removeEntity(_0x3b1192,null))[_0xbc28('0x40')](handleError(_0x3b1192,null));}; \ No newline at end of file +var _0x57be=['bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','MailServerOut','include','findAll','rows','show','fields','includeAll','find','catch','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0xa559be,_0x32f7c3){var _0x3cfa4a=function(_0x312a15){while(--_0x312a15){_0xa559be['push'](_0xa559be['shift']());}};_0x3cfa4a(++_0x32f7c3);}(_0x57be,0xdf));var _0xe57b=function(_0x238135,_0x510dc2){_0x238135=_0x238135-0x0;var _0x567521=_0x57be[_0x238135];return _0x567521;};'use strict';var emlformat=require(_0xe57b('0x0'));var rimraf=require(_0xe57b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe57b('0x2'));var rp=require(_0xe57b('0x3'));var moment=require(_0xe57b('0x4'));var BPromise=require(_0xe57b('0x5'));var Mustache=require(_0xe57b('0x6'));var util=require(_0xe57b('0x7'));var path=require(_0xe57b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe57b('0x9'));var fs=require('fs');var fs_extra=require(_0xe57b('0xa'));var _=require('lodash');var squel=require(_0xe57b('0xb'));var crypto=require(_0xe57b('0xc'));var jsforce=require(_0xe57b('0xd'));var deskjs=require(_0xe57b('0xe'));var toCsv=require(_0xe57b('0xf'));var querystring=require(_0xe57b('0x10'));var Papa=require(_0xe57b('0x11'));var Redis=require(_0xe57b('0x12'));var authService=require(_0xe57b('0x13'));var qs=require(_0xe57b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe57b('0x15'))(_0xe57b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe57b('0x17'));var db=require(_0xe57b('0x18'))['db'];function respondWithStatusCode(_0x509740,_0x6ea28c){_0x6ea28c=_0x6ea28c||0xcc;return function(_0x117dcc){if(_0x117dcc){return _0x509740[_0xe57b('0x19')](_0x6ea28c);}return _0x509740[_0xe57b('0x1a')](_0x6ea28c)[_0xe57b('0x1b')]();};}function respondWithResult(_0x43e0ee,_0x46e02a){_0x46e02a=_0x46e02a||0xc8;return function(_0x40e7f3){if(_0x40e7f3){return _0x43e0ee[_0xe57b('0x1a')](_0x46e02a)[_0xe57b('0x1c')](_0x40e7f3);}};}function respondWithFilteredResult(_0x1df8fe,_0x493534){return function(_0x407c7a){if(_0x407c7a){var _0x3adfee=typeof _0x493534[_0xe57b('0x1d')]===_0xe57b('0x1e')&&typeof _0x493534[_0xe57b('0x1f')]===_0xe57b('0x1e');var _0x4bdd80=_0x407c7a[_0xe57b('0x20')];var _0x13b357=_0x3adfee?0x0:_0x493534['offset'];var _0x10de0f=_0x3adfee?_0x407c7a['count']:_0x493534[_0xe57b('0x1d')]+_0x493534[_0xe57b('0x1f')];var _0x113d3b;if(_0x10de0f>=_0x4bdd80){_0x10de0f=_0x4bdd80;_0x113d3b=0xc8;}else{_0x113d3b=0xce;}_0x1df8fe[_0xe57b('0x1a')](_0x113d3b);return _0x1df8fe[_0xe57b('0x21')](_0xe57b('0x22'),_0x13b357+'-'+_0x10de0f+'/'+_0x4bdd80)['json'](_0x407c7a);}return null;};}function patchUpdates(_0x1adf0d){return function(_0x200145){try{jsonpatch[_0xe57b('0x23')](_0x200145,_0x1adf0d,!![]);}catch(_0x420763){return BPromise['reject'](_0x420763);}return _0x200145[_0xe57b('0x24')]();};}function saveUpdates(_0x3e4aef,_0x589f0e){return function(_0x31cd02){if(_0x31cd02){return _0x31cd02['update'](_0x3e4aef)[_0xe57b('0x25')](function(_0x45d82b){return _0x45d82b;});}return null;};}function removeEntity(_0x3c1a39,_0xbb0607){return function(_0x51dce3){if(_0x51dce3){return _0x51dce3[_0xe57b('0x26')]()[_0xe57b('0x25')](function(){_0x3c1a39[_0xe57b('0x1a')](0xcc)[_0xe57b('0x1b')]();});}};}function handleEntityNotFound(_0x33b0ea,_0x5ce67d){return function(_0x57c853){if(!_0x57c853){_0x33b0ea[_0xe57b('0x19')](0x194);}return _0x57c853;};}function handleError(_0x50f511,_0x59cea9){_0x59cea9=_0x59cea9||0x1f4;return function(_0x498f30){logger[_0xe57b('0x27')](_0x498f30[_0xe57b('0x28')]);if(_0x498f30['name']){delete _0x498f30[_0xe57b('0x29')];}_0x50f511[_0xe57b('0x1a')](_0x59cea9)[_0xe57b('0x2a')](_0x498f30);};}exports[_0xe57b('0x2b')]=function(_0x2d9e9c,_0x4cfcc5){var _0x3b22e7={},_0x562277={},_0x138a43={'count':0x0,'rows':[]};var _0x4956df=_['map'](db['MailServerOut'][_0xe57b('0x2c')],function(_0x1a2657){return{'name':_0x1a2657[_0xe57b('0x2d')],'type':_0x1a2657['type']['key']};});_0x562277[_0xe57b('0x2e')]=_[_0xe57b('0x2f')](_0x4956df,_0xe57b('0x29'));_0x562277[_0xe57b('0x30')]=_[_0xe57b('0x31')](_0x2d9e9c[_0xe57b('0x30')]);_0x562277[_0xe57b('0x32')]=_[_0xe57b('0x33')](_0x562277[_0xe57b('0x2e')],_0x562277['query']);_0x3b22e7[_0xe57b('0x34')]=_[_0xe57b('0x33')](_0x562277[_0xe57b('0x2e')],qs['fields'](_0x2d9e9c[_0xe57b('0x30')]['fields']));_0x3b22e7[_0xe57b('0x34')]=_0x3b22e7['attributes'][_0xe57b('0x35')]?_0x3b22e7['attributes']:_0x562277[_0xe57b('0x2e')];if(!_0x2d9e9c[_0xe57b('0x30')][_0xe57b('0x36')](_0xe57b('0x37'))){_0x3b22e7[_0xe57b('0x1f')]=qs[_0xe57b('0x1f')](_0x2d9e9c[_0xe57b('0x30')][_0xe57b('0x1f')]);_0x3b22e7[_0xe57b('0x1d')]=qs[_0xe57b('0x1d')](_0x2d9e9c[_0xe57b('0x30')][_0xe57b('0x1d')]);}_0x3b22e7['order']=qs[_0xe57b('0x38')](_0x2d9e9c['query'][_0xe57b('0x38')]);_0x3b22e7[_0xe57b('0x39')]=qs[_0xe57b('0x32')](_[_0xe57b('0x3a')](_0x2d9e9c[_0xe57b('0x30')],_0x562277[_0xe57b('0x32')]),_0x4956df);if(_0x2d9e9c[_0xe57b('0x30')][_0xe57b('0x3b')]){_0x3b22e7[_0xe57b('0x39')]=_[_0xe57b('0x3c')](_0x3b22e7[_0xe57b('0x39')],{'$or':_[_0xe57b('0x2f')](_0x4956df,function(_0x20b491){if(_0x20b491['type']!==_0xe57b('0x3d')){var _0x15f2fc={};_0x15f2fc[_0x20b491[_0xe57b('0x29')]]={'$like':'%'+_0x2d9e9c[_0xe57b('0x30')][_0xe57b('0x3b')]+'%'};return _0x15f2fc;}})});}_0x3b22e7=_[_0xe57b('0x3c')]({},_0x3b22e7,_0x2d9e9c[_0xe57b('0x3e')]);var _0x3226a6={'where':_0x3b22e7[_0xe57b('0x39')]};return db[_0xe57b('0x3f')]['count'](_0x3226a6)[_0xe57b('0x25')](function(_0x35f5a2){_0x138a43[_0xe57b('0x20')]=_0x35f5a2;if(_0x2d9e9c['query']['includeAll']){_0x3b22e7[_0xe57b('0x40')]=[{'all':!![]}];}return db[_0xe57b('0x3f')][_0xe57b('0x41')](_0x3b22e7);})[_0xe57b('0x25')](function(_0x4c0e5d){_0x138a43[_0xe57b('0x42')]=_0x4c0e5d;return _0x138a43;})[_0xe57b('0x25')](respondWithFilteredResult(_0x4cfcc5,_0x3b22e7))['catch'](handleError(_0x4cfcc5,null));};exports[_0xe57b('0x43')]=function(_0x21d49a,_0x3c3ca0){var _0x10e61b={'raw':!![],'where':{'id':_0x21d49a['params']['id']}},_0x1303e9={};_0x1303e9[_0xe57b('0x2e')]=_[_0xe57b('0x31')](db[_0xe57b('0x3f')][_0xe57b('0x2c')]);_0x1303e9[_0xe57b('0x30')]=_[_0xe57b('0x31')](_0x21d49a[_0xe57b('0x30')]);_0x1303e9[_0xe57b('0x32')]=_['intersection'](_0x1303e9[_0xe57b('0x2e')],_0x1303e9[_0xe57b('0x30')]);_0x10e61b[_0xe57b('0x34')]=_[_0xe57b('0x33')](_0x1303e9[_0xe57b('0x2e')],qs['fields'](_0x21d49a[_0xe57b('0x30')][_0xe57b('0x44')]));_0x10e61b[_0xe57b('0x34')]=_0x10e61b[_0xe57b('0x34')][_0xe57b('0x35')]?_0x10e61b['attributes']:_0x1303e9[_0xe57b('0x2e')];if(_0x21d49a[_0xe57b('0x30')][_0xe57b('0x45')]){_0x10e61b['include']=[{'all':!![]}];}_0x10e61b=_['merge']({},_0x10e61b,_0x21d49a[_0xe57b('0x3e')]);return db['MailServerOut'][_0xe57b('0x46')](_0x10e61b)[_0xe57b('0x25')](handleEntityNotFound(_0x3c3ca0,null))['then'](respondWithResult(_0x3c3ca0,null))[_0xe57b('0x47')](handleError(_0x3c3ca0,null));};exports[_0xe57b('0x48')]=function(_0xdb9181,_0x57e314){return db[_0xe57b('0x3f')][_0xe57b('0x48')](_0xdb9181[_0xe57b('0x49')],{})[_0xe57b('0x25')](respondWithResult(_0x57e314,0xc9))[_0xe57b('0x47')](handleError(_0x57e314,null));};exports[_0xe57b('0x4a')]=function(_0x3a6f1c,_0x19fac9){if(_0x3a6f1c[_0xe57b('0x49')]['id']){delete _0x3a6f1c[_0xe57b('0x49')]['id'];}return db[_0xe57b('0x3f')][_0xe57b('0x46')]({'where':{'id':_0x3a6f1c[_0xe57b('0x4b')]['id']}})[_0xe57b('0x25')](handleEntityNotFound(_0x19fac9,null))[_0xe57b('0x25')](saveUpdates(_0x3a6f1c[_0xe57b('0x49')],null))['then'](respondWithResult(_0x19fac9,null))[_0xe57b('0x47')](handleError(_0x19fac9,null));};exports[_0xe57b('0x26')]=function(_0x12be73,_0x428484){return db[_0xe57b('0x3f')]['find']({'where':{'id':_0x12be73['params']['id']}})['then'](handleEntityNotFound(_0x428484,null))[_0xe57b('0x25')](removeEntity(_0x428484,null))['catch'](handleError(_0x428484,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index eddf749..c579995 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 _0xe9a0=['../../config/environment','exports','define','mail_servers_out','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0xe9a0,0x143));var _0x0e9a=function(_0xc0880e,_0x5c7736){_0xc0880e=_0xc0880e-0x0;var _0x2298d8=_0xe9a0[_0xc0880e];return _0x2298d8;};'use strict';var _=require(_0x0e9a('0x0'));var util=require('util');var logger=require(_0x0e9a('0x1'))('api');var moment=require(_0x0e9a('0x2'));var BPromise=require(_0x0e9a('0x3'));var rp=require(_0x0e9a('0x4'));var fs=require('fs');var path=require(_0x0e9a('0x5'));var rimraf=require(_0x0e9a('0x6'));var config=require(_0x0e9a('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x0e9a('0x8')]=function(_0x2b4a7e,_0x11f243){return _0x2b4a7e[_0x0e9a('0x9')]('MailServerOut',attributes,{'tableName':_0x0e9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x296d=['request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x1c5c8d,_0x298f71){var _0x34a831=function(_0x111fd1){while(--_0x111fd1){_0x1c5c8d['push'](_0x1c5c8d['shift']());}};_0x34a831(++_0x298f71);}(_0x296d,0x1cf));var _0xd296=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0x296d[_0x17784a];return _0x41aded;};'use strict';var _=require(_0xd296('0x0'));var util=require(_0xd296('0x1'));var logger=require(_0xd296('0x2'))(_0xd296('0x3'));var moment=require(_0xd296('0x4'));var BPromise=require('bluebird');var rp=require(_0xd296('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd296('0x6'));var config=require(_0xd296('0x7'));var attributes=require(_0xd296('0x8'));module[_0xd296('0x9')]=function(_0x10e1c1,_0x1e8a4d){return _0x10e1c1[_0xd296('0xa')](_0xd296('0xb'),attributes,{'tableName':_0xd296('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 df9ddd9..2b24356 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x4b1af7,_0x9f0a12){var _0x89a574=function(_0x50f2a0){while(--_0x50f2a0){_0x4b1af7['push'](_0x4b1af7['shift']());}};_0x89a574(++_0x9f0a12);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x236470,_0x29d279){var _0xf885b7=function(_0x392a3b){while(--_0x392a3b){_0x236470['push'](_0x236470['shift']());}};_0xf885b7(++_0x29d279);}(_0xdb28,0x106));var _0x8db2=function(_0x84a38a,_0x2f750a){_0x84a38a=_0x84a38a-0x0;var _0x58bf93=_0xdb28[_0x84a38a];return _0x58bf93;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 983ebc0..1807835 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 _0xaa88=['update','delete','exports','multer','connect-timeout','express','Router','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xaa88,0x1e9));var _0x8aa8=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0xaa88[_0x3f8743];return _0x1f844c;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8aa8('0x1'));var express=require(_0x8aa8('0x2'));var router=express[_0x8aa8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8aa8('0x4'));var config=require('../../config/environment');var controller=require(_0x8aa8('0x5'));router[_0x8aa8('0x6')]('/',auth[_0x8aa8('0x7')](),controller[_0x8aa8('0x8')]);router[_0x8aa8('0x6')](_0x8aa8('0x9'),auth[_0x8aa8('0x7')](),controller[_0x8aa8('0xa')]);router[_0x8aa8('0x6')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8aa8('0xc')]('/',auth[_0x8aa8('0x7')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x10')](_0x8aa8('0xb'),auth[_0x8aa8('0x7')](),controller['destroy']);module[_0x8aa8('0x11')]=router; \ No newline at end of file +var _0x6c01=['get','isAuthenticated','/describe','describe','/:id','show','post','create','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0xcdff08,_0x17513a){var _0x1bb21b=function(_0x2bf3b0){while(--_0x2bf3b0){_0xcdff08['push'](_0xcdff08['shift']());}};_0x1bb21b(++_0x17513a);}(_0x6c01,0xa3));var _0x16c0=function(_0x5e347d,_0x2cc3fa){_0x5e347d=_0x5e347d-0x0;var _0x423647=_0x6c01[_0x5e347d];return _0x423647;};'use strict';var multer=require(_0x16c0('0x0'));var util=require(_0x16c0('0x1'));var path=require('path');var timeout=require(_0x16c0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x16c0('0x3'));var interaction=require(_0x16c0('0x4'));var config=require(_0x16c0('0x5'));var controller=require(_0x16c0('0x6'));router[_0x16c0('0x7')]('/',auth[_0x16c0('0x8')](),controller['index']);router[_0x16c0('0x7')](_0x16c0('0x9'),auth[_0x16c0('0x8')](),controller[_0x16c0('0xa')]);router[_0x16c0('0x7')](_0x16c0('0xb'),auth['isAuthenticated'](),controller[_0x16c0('0xc')]);router[_0x16c0('0xd')]('/',auth[_0x16c0('0x8')](),controller[_0x16c0('0xe')]);router['put'](_0x16c0('0xb'),auth[_0x16c0('0x8')](),controller['update']);router['delete'](_0x16c0('0xb'),auth['isAuthenticated'](),controller[_0x16c0('0xf')]);module[_0x16c0('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 463b6b2..25befed 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 _0xb138=['name','sequelize','exports','STRING'];(function(_0x5323c2,_0xc6ca57){var _0x38e9dd=function(_0x50d603){while(--_0x50d603){_0x5323c2['push'](_0x5323c2['shift']());}};_0x38e9dd(++_0xc6ca57);}(_0xb138,0x1dd));var _0x8b13=function(_0x1af00c,_0x3924f6){_0x1af00c=_0x1af00c-0x0;var _0x1de5e6=_0xb138[_0x1af00c];return _0x1de5e6;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'unique':_0x8b13('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8b13('0x2')]}}; \ No newline at end of file +var _0x0e4b=['STRING','sequelize','exports'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x5a516a,_0x541200){_0x5a516a=_0x5a516a-0x0;var _0x38c0d9=_0x0e4b[_0x5a516a];return _0x38c0d9;};'use strict';var Sequelize=require(_0xb0e4('0x0'));module[_0xb0e4('0x1')]={'name':{'type':Sequelize[_0xb0e4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb0e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 879e774..c763c30 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 _0x7085=['describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','save','update','then','name','index','MailSubstatus','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','includeAll','include','create','body','find','params'];(function(_0x296f49,_0x2c165c){var _0x6fe085=function(_0x2fd76d){while(--_0x2fd76d){_0x296f49['push'](_0x296f49['shift']());}};_0x6fe085(++_0x2c165c);}(_0x7085,0x125));var _0x5708=function(_0x4a4a43,_0x115ccf){_0x4a4a43=_0x4a4a43-0x0;var _0x5893a6=_0x7085[_0x4a4a43];return _0x5893a6;};'use strict';var emlformat=require(_0x5708('0x0'));var rimraf=require(_0x5708('0x1'));var zipdir=require(_0x5708('0x2'));var jsonpatch=require(_0x5708('0x3'));var rp=require('request-promise');var moment=require(_0x5708('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5708('0x5'));var util=require('util');var path=require(_0x5708('0x6'));var sox=require(_0x5708('0x7'));var csv=require(_0x5708('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5708('0x9'));var _=require(_0x5708('0xa'));var squel=require(_0x5708('0xb'));var crypto=require(_0x5708('0xc'));var jsforce=require(_0x5708('0xd'));var deskjs=require(_0x5708('0xe'));var toCsv=require(_0x5708('0x8'));var querystring=require(_0x5708('0xf'));var Papa=require(_0x5708('0x10'));var Redis=require(_0x5708('0x11'));var authService=require(_0x5708('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5708('0x13'));var logger=require(_0x5708('0x14'))(_0x5708('0x15'));var utils=require(_0x5708('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5708('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31a006,_0x3309fe){_0x3309fe=_0x3309fe||0xcc;return function(_0x5642b4){if(_0x5642b4){return _0x31a006[_0x5708('0x18')](_0x3309fe);}return _0x31a006['status'](_0x3309fe)[_0x5708('0x19')]();};}function respondWithResult(_0x1c09b4,_0x34e4b1){_0x34e4b1=_0x34e4b1||0xc8;return function(_0x9d4f77){if(_0x9d4f77){return _0x1c09b4['status'](_0x34e4b1)[_0x5708('0x1a')](_0x9d4f77);}};}function respondWithFilteredResult(_0x397622,_0x2928a9){return function(_0xefb7d){if(_0xefb7d){var _0x11b21d=typeof _0x2928a9['offset']==='undefined'&&typeof _0x2928a9[_0x5708('0x1b')]===_0x5708('0x1c');var _0x122ae4=_0xefb7d[_0x5708('0x1d')];var _0x4801d6=_0x11b21d?0x0:_0x2928a9[_0x5708('0x1e')];var _0x4671e1=_0x11b21d?_0xefb7d['count']:_0x2928a9[_0x5708('0x1e')]+_0x2928a9[_0x5708('0x1b')];var _0x256489;if(_0x4671e1>=_0x122ae4){_0x4671e1=_0x122ae4;_0x256489=0xc8;}else{_0x256489=0xce;}_0x397622[_0x5708('0x1f')](_0x256489);return _0x397622[_0x5708('0x20')](_0x5708('0x21'),_0x4801d6+'-'+_0x4671e1+'/'+_0x122ae4)[_0x5708('0x1a')](_0xefb7d);}return null;};}function patchUpdates(_0x452fac){return function(_0x50e1a7){try{jsonpatch['apply'](_0x50e1a7,_0x452fac,!![]);}catch(_0x469c63){return BPromise['reject'](_0x469c63);}return _0x50e1a7[_0x5708('0x22')]();};}function saveUpdates(_0x172126,_0x572239){return function(_0x548740){if(_0x548740){return _0x548740[_0x5708('0x23')](_0x172126)[_0x5708('0x24')](function(_0x3c3d8d){return _0x3c3d8d;});}return null;};}function removeEntity(_0x56a155,_0x4b8ff0){return function(_0x20c041){if(_0x20c041){return _0x20c041['destroy']()[_0x5708('0x24')](function(){_0x56a155['status'](0xcc)[_0x5708('0x19')]();});}};}function handleEntityNotFound(_0x48bbc0,_0x1ee90c){return function(_0x28a755){if(!_0x28a755){_0x48bbc0[_0x5708('0x18')](0x194);}return _0x28a755;};}function handleError(_0x289129,_0x3888a7){_0x3888a7=_0x3888a7||0x1f4;return function(_0x294e35){logger['error'](_0x294e35['stack']);if(_0x294e35[_0x5708('0x25')]){delete _0x294e35[_0x5708('0x25')];}_0x289129[_0x5708('0x1f')](_0x3888a7)['send'](_0x294e35);};}exports[_0x5708('0x26')]=function(_0x3942aa,_0x5a3378){var _0x2d11d9={},_0x2e0aab={},_0x30669a={'count':0x0,'rows':[]};var _0x1f1a03=_['map'](db[_0x5708('0x27')][_0x5708('0x28')],function(_0x3924aa){return{'name':_0x3924aa[_0x5708('0x29')],'type':_0x3924aa[_0x5708('0x2a')][_0x5708('0x2b')]};});_0x2e0aab['model']=_[_0x5708('0x2c')](_0x1f1a03,_0x5708('0x25'));_0x2e0aab[_0x5708('0x2d')]=_[_0x5708('0x2e')](_0x3942aa['query']);_0x2e0aab[_0x5708('0x2f')]=_[_0x5708('0x30')](_0x2e0aab['model'],_0x2e0aab[_0x5708('0x2d')]);_0x2d11d9['attributes']=_[_0x5708('0x30')](_0x2e0aab[_0x5708('0x31')],qs['fields'](_0x3942aa['query'][_0x5708('0x32')]));_0x2d11d9[_0x5708('0x33')]=_0x2d11d9[_0x5708('0x33')][_0x5708('0x34')]?_0x2d11d9['attributes']:_0x2e0aab['model'];if(!_0x3942aa[_0x5708('0x2d')][_0x5708('0x35')](_0x5708('0x36'))){_0x2d11d9['limit']=qs['limit'](_0x3942aa[_0x5708('0x2d')][_0x5708('0x1b')]);_0x2d11d9[_0x5708('0x1e')]=qs[_0x5708('0x1e')](_0x3942aa[_0x5708('0x2d')][_0x5708('0x1e')]);}_0x2d11d9[_0x5708('0x37')]=qs[_0x5708('0x38')](_0x3942aa['query'][_0x5708('0x38')]);_0x2d11d9['where']=qs[_0x5708('0x2f')](_[_0x5708('0x39')](_0x3942aa[_0x5708('0x2d')],_0x2e0aab[_0x5708('0x2f')]),_0x1f1a03);if(_0x3942aa[_0x5708('0x2d')][_0x5708('0x3a')]){_0x2d11d9['where']=_[_0x5708('0x3b')](_0x2d11d9[_0x5708('0x3c')],{'$or':_[_0x5708('0x2c')](_0x1f1a03,function(_0x41a082){if(_0x41a082[_0x5708('0x2a')]!==_0x5708('0x3d')){var _0x24e7d4={};_0x24e7d4[_0x41a082[_0x5708('0x25')]]={'$like':'%'+_0x3942aa[_0x5708('0x2d')][_0x5708('0x3a')]+'%'};return _0x24e7d4;}})});}_0x2d11d9=_[_0x5708('0x3b')]({},_0x2d11d9,_0x3942aa[_0x5708('0x3e')]);var _0x45d042={'where':_0x2d11d9['where']};return db['MailSubstatus'][_0x5708('0x1d')](_0x45d042)['then'](function(_0x15a6ce){_0x30669a[_0x5708('0x1d')]=_0x15a6ce;if(_0x3942aa[_0x5708('0x2d')]['includeAll']){_0x2d11d9['include']=[{'all':!![]}];}return db[_0x5708('0x27')][_0x5708('0x3f')](_0x2d11d9);})[_0x5708('0x24')](function(_0x484150){_0x30669a[_0x5708('0x40')]=_0x484150;return _0x30669a;})[_0x5708('0x24')](respondWithFilteredResult(_0x5a3378,_0x2d11d9))[_0x5708('0x41')](handleError(_0x5a3378,null));};exports['show']=function(_0x15ed79,_0x3592f2){var _0x36986e={'raw':!![],'where':{'id':_0x15ed79['params']['id']}},_0x49dd00={};_0x49dd00['model']=_['keys'](db[_0x5708('0x27')][_0x5708('0x28')]);_0x49dd00[_0x5708('0x2d')]=_['keys'](_0x15ed79['query']);_0x49dd00['filters']=_[_0x5708('0x30')](_0x49dd00[_0x5708('0x31')],_0x49dd00[_0x5708('0x2d')]);_0x36986e['attributes']=_[_0x5708('0x30')](_0x49dd00['model'],qs[_0x5708('0x32')](_0x15ed79[_0x5708('0x2d')][_0x5708('0x32')]));_0x36986e[_0x5708('0x33')]=_0x36986e[_0x5708('0x33')][_0x5708('0x34')]?_0x36986e[_0x5708('0x33')]:_0x49dd00[_0x5708('0x31')];if(_0x15ed79[_0x5708('0x2d')][_0x5708('0x42')]){_0x36986e[_0x5708('0x43')]=[{'all':!![]}];}_0x36986e=_[_0x5708('0x3b')]({},_0x36986e,_0x15ed79[_0x5708('0x3e')]);return db[_0x5708('0x27')]['find'](_0x36986e)['then'](handleEntityNotFound(_0x3592f2,null))[_0x5708('0x24')](respondWithResult(_0x3592f2,null))[_0x5708('0x41')](handleError(_0x3592f2,null));};exports['create']=function(_0x466d3a,_0x23096e){return db[_0x5708('0x27')][_0x5708('0x44')](_0x466d3a[_0x5708('0x45')],{})[_0x5708('0x24')](respondWithResult(_0x23096e,0xc9))[_0x5708('0x41')](handleError(_0x23096e,null));};exports[_0x5708('0x23')]=function(_0x59fa5d,_0x26aa8a){if(_0x59fa5d[_0x5708('0x45')]['id']){delete _0x59fa5d[_0x5708('0x45')]['id'];}return db[_0x5708('0x27')][_0x5708('0x46')]({'where':{'id':_0x59fa5d[_0x5708('0x47')]['id']}})['then'](handleEntityNotFound(_0x26aa8a,null))['then'](saveUpdates(_0x59fa5d[_0x5708('0x45')],null))[_0x5708('0x24')](respondWithResult(_0x26aa8a,null))[_0x5708('0x41')](handleError(_0x26aa8a,null));};exports['destroy']=function(_0x25b222,_0x2fcf21){return db[_0x5708('0x27')]['find']({'where':{'id':_0x25b222[_0x5708('0x47')]['id']}})[_0x5708('0x24')](handleEntityNotFound(_0x2fcf21,null))['then'](removeEntity(_0x2fcf21,null))[_0x5708('0x41')](handleError(_0x2fcf21,null));};exports[_0x5708('0x48')]=function(_0x4d56b2,_0x1a366b){return db[_0x5708('0x27')][_0x5708('0x48')]()[_0x5708('0x24')](respondWithResult(_0x1a366b,null))[_0x5708('0x41')](handleError(_0x1a366b,null));}; \ No newline at end of file +var _0xf9d3=['path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x787995,_0x5dbdc7){var _0x4a75d6=function(_0x39a7e3){while(--_0x39a7e3){_0x787995['push'](_0x787995['shift']());}};_0x4a75d6(++_0x5dbdc7);}(_0xf9d3,0x1bf));var _0x3f9d=function(_0x29c76b,_0x4a6a17){_0x29c76b=_0x29c76b-0x0;var _0x6cda21=_0xf9d3[_0x29c76b];return _0x6cda21;};'use strict';var emlformat=require(_0x3f9d('0x0'));var rimraf=require(_0x3f9d('0x1'));var zipdir=require(_0x3f9d('0x2'));var jsonpatch=require(_0x3f9d('0x3'));var rp=require(_0x3f9d('0x4'));var moment=require(_0x3f9d('0x5'));var BPromise=require(_0x3f9d('0x6'));var Mustache=require(_0x3f9d('0x7'));var util=require(_0x3f9d('0x8'));var path=require(_0x3f9d('0x9'));var sox=require(_0x3f9d('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f9d('0xb'));var _=require(_0x3f9d('0xc'));var squel=require('squel');var crypto=require(_0x3f9d('0xd'));var jsforce=require(_0x3f9d('0xe'));var deskjs=require(_0x3f9d('0xf'));var toCsv=require(_0x3f9d('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f9d('0x11'));var authService=require(_0x3f9d('0x12'));var qs=require(_0x3f9d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f9d('0x14'))(_0x3f9d('0x15'));var utils=require(_0x3f9d('0x16'));var config=require(_0x3f9d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f9d('0x18'))['db'];function respondWithStatusCode(_0x2c8aa0,_0xdc35ba){_0xdc35ba=_0xdc35ba||0xcc;return function(_0x1f89cf){if(_0x1f89cf){return _0x2c8aa0[_0x3f9d('0x19')](_0xdc35ba);}return _0x2c8aa0['status'](_0xdc35ba)[_0x3f9d('0x1a')]();};}function respondWithResult(_0x139f36,_0x2a93c9){_0x2a93c9=_0x2a93c9||0xc8;return function(_0xa0d345){if(_0xa0d345){return _0x139f36[_0x3f9d('0x1b')](_0x2a93c9)[_0x3f9d('0x1c')](_0xa0d345);}};}function respondWithFilteredResult(_0x51ac23,_0x57e169){return function(_0x5a58bb){if(_0x5a58bb){var _0x17138c=typeof _0x57e169[_0x3f9d('0x1d')]===_0x3f9d('0x1e')&&typeof _0x57e169['limit']==='undefined';var _0x47159f=_0x5a58bb[_0x3f9d('0x1f')];var _0x2d669c=_0x17138c?0x0:_0x57e169[_0x3f9d('0x1d')];var _0x55aabc=_0x17138c?_0x5a58bb[_0x3f9d('0x1f')]:_0x57e169['offset']+_0x57e169[_0x3f9d('0x20')];var _0x2f9609;if(_0x55aabc>=_0x47159f){_0x55aabc=_0x47159f;_0x2f9609=0xc8;}else{_0x2f9609=0xce;}_0x51ac23[_0x3f9d('0x1b')](_0x2f9609);return _0x51ac23[_0x3f9d('0x21')](_0x3f9d('0x22'),_0x2d669c+'-'+_0x55aabc+'/'+_0x47159f)[_0x3f9d('0x1c')](_0x5a58bb);}return null;};}function patchUpdates(_0x43789e){return function(_0x42e9d4){try{jsonpatch[_0x3f9d('0x23')](_0x42e9d4,_0x43789e,!![]);}catch(_0x489429){return BPromise[_0x3f9d('0x24')](_0x489429);}return _0x42e9d4[_0x3f9d('0x25')]();};}function saveUpdates(_0x547f9f,_0x418b91){return function(_0x4c42b1){if(_0x4c42b1){return _0x4c42b1[_0x3f9d('0x26')](_0x547f9f)[_0x3f9d('0x27')](function(_0x5aac45){return _0x5aac45;});}return null;};}function removeEntity(_0x3ec3ad,_0x532c1a){return function(_0x950f27){if(_0x950f27){return _0x950f27[_0x3f9d('0x28')]()[_0x3f9d('0x27')](function(){_0x3ec3ad[_0x3f9d('0x1b')](0xcc)[_0x3f9d('0x1a')]();});}};}function handleEntityNotFound(_0xa34b69,_0x56c68a){return function(_0x2b8d8b){if(!_0x2b8d8b){_0xa34b69[_0x3f9d('0x19')](0x194);}return _0x2b8d8b;};}function handleError(_0xb5d0a8,_0x3d46b0){_0x3d46b0=_0x3d46b0||0x1f4;return function(_0x5a0a2d){logger['error'](_0x5a0a2d[_0x3f9d('0x29')]);if(_0x5a0a2d[_0x3f9d('0x2a')]){delete _0x5a0a2d[_0x3f9d('0x2a')];}_0xb5d0a8[_0x3f9d('0x1b')](_0x3d46b0)['send'](_0x5a0a2d);};}exports[_0x3f9d('0x2b')]=function(_0x217a29,_0x1b4bfd){var _0x5001b6={},_0x4a5b7b={},_0x43641e={'count':0x0,'rows':[]};var _0x636e9a=_[_0x3f9d('0x2c')](db[_0x3f9d('0x2d')][_0x3f9d('0x2e')],function(_0x6e4fd1){return{'name':_0x6e4fd1[_0x3f9d('0x2f')],'type':_0x6e4fd1[_0x3f9d('0x30')]['key']};});_0x4a5b7b['model']=_[_0x3f9d('0x2c')](_0x636e9a,'name');_0x4a5b7b[_0x3f9d('0x31')]=_[_0x3f9d('0x32')](_0x217a29[_0x3f9d('0x31')]);_0x4a5b7b[_0x3f9d('0x33')]=_[_0x3f9d('0x34')](_0x4a5b7b[_0x3f9d('0x35')],_0x4a5b7b[_0x3f9d('0x31')]);_0x5001b6[_0x3f9d('0x36')]=_[_0x3f9d('0x34')](_0x4a5b7b[_0x3f9d('0x35')],qs['fields'](_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x37')]));_0x5001b6['attributes']=_0x5001b6[_0x3f9d('0x36')][_0x3f9d('0x38')]?_0x5001b6[_0x3f9d('0x36')]:_0x4a5b7b[_0x3f9d('0x35')];if(!_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x39')](_0x3f9d('0x3a'))){_0x5001b6['limit']=qs['limit'](_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x20')]);_0x5001b6[_0x3f9d('0x1d')]=qs[_0x3f9d('0x1d')](_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x1d')]);}_0x5001b6[_0x3f9d('0x3b')]=qs[_0x3f9d('0x3c')](_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x3c')]);_0x5001b6['where']=qs['filters'](_[_0x3f9d('0x3d')](_0x217a29[_0x3f9d('0x31')],_0x4a5b7b[_0x3f9d('0x33')]),_0x636e9a);if(_0x217a29['query'][_0x3f9d('0x3e')]){_0x5001b6['where']=_['merge'](_0x5001b6[_0x3f9d('0x3f')],{'$or':_[_0x3f9d('0x2c')](_0x636e9a,function(_0x403aaa){if(_0x403aaa[_0x3f9d('0x30')]!=='VIRTUAL'){var _0x1215b3={};_0x1215b3[_0x403aaa[_0x3f9d('0x2a')]]={'$like':'%'+_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x3e')]+'%'};return _0x1215b3;}})});}_0x5001b6=_[_0x3f9d('0x40')]({},_0x5001b6,_0x217a29[_0x3f9d('0x41')]);var _0xa2d0a1={'where':_0x5001b6[_0x3f9d('0x3f')]};return db[_0x3f9d('0x2d')][_0x3f9d('0x1f')](_0xa2d0a1)[_0x3f9d('0x27')](function(_0x4460d8){_0x43641e['count']=_0x4460d8;if(_0x217a29[_0x3f9d('0x31')]['includeAll']){_0x5001b6[_0x3f9d('0x42')]=[{'all':!![]}];}return db[_0x3f9d('0x2d')][_0x3f9d('0x43')](_0x5001b6);})[_0x3f9d('0x27')](function(_0x50e914){_0x43641e[_0x3f9d('0x44')]=_0x50e914;return _0x43641e;})[_0x3f9d('0x27')](respondWithFilteredResult(_0x1b4bfd,_0x5001b6))[_0x3f9d('0x45')](handleError(_0x1b4bfd,null));};exports[_0x3f9d('0x46')]=function(_0xb5bb04,_0x597d36){var _0x5e96ad={'raw':!![],'where':{'id':_0xb5bb04[_0x3f9d('0x47')]['id']}},_0x1a888d={};_0x1a888d[_0x3f9d('0x35')]=_[_0x3f9d('0x32')](db[_0x3f9d('0x2d')]['rawAttributes']);_0x1a888d[_0x3f9d('0x31')]=_[_0x3f9d('0x32')](_0xb5bb04[_0x3f9d('0x31')]);_0x1a888d[_0x3f9d('0x33')]=_[_0x3f9d('0x34')](_0x1a888d[_0x3f9d('0x35')],_0x1a888d['query']);_0x5e96ad['attributes']=_[_0x3f9d('0x34')](_0x1a888d[_0x3f9d('0x35')],qs[_0x3f9d('0x37')](_0xb5bb04[_0x3f9d('0x31')]['fields']));_0x5e96ad[_0x3f9d('0x36')]=_0x5e96ad['attributes'][_0x3f9d('0x38')]?_0x5e96ad['attributes']:_0x1a888d['model'];if(_0xb5bb04[_0x3f9d('0x31')]['includeAll']){_0x5e96ad[_0x3f9d('0x42')]=[{'all':!![]}];}_0x5e96ad=_[_0x3f9d('0x40')]({},_0x5e96ad,_0xb5bb04['options']);return db[_0x3f9d('0x2d')][_0x3f9d('0x48')](_0x5e96ad)[_0x3f9d('0x27')](handleEntityNotFound(_0x597d36,null))[_0x3f9d('0x27')](respondWithResult(_0x597d36,null))[_0x3f9d('0x45')](handleError(_0x597d36,null));};exports['create']=function(_0x320343,_0x29b7cb){return db[_0x3f9d('0x2d')][_0x3f9d('0x49')](_0x320343[_0x3f9d('0x4a')],{})[_0x3f9d('0x27')](respondWithResult(_0x29b7cb,0xc9))['catch'](handleError(_0x29b7cb,null));};exports[_0x3f9d('0x26')]=function(_0x42d3a2,_0x207ac1){if(_0x42d3a2['body']['id']){delete _0x42d3a2[_0x3f9d('0x4a')]['id'];}return db[_0x3f9d('0x2d')][_0x3f9d('0x48')]({'where':{'id':_0x42d3a2[_0x3f9d('0x47')]['id']}})[_0x3f9d('0x27')](handleEntityNotFound(_0x207ac1,null))['then'](saveUpdates(_0x42d3a2[_0x3f9d('0x4a')],null))[_0x3f9d('0x27')](respondWithResult(_0x207ac1,null))['catch'](handleError(_0x207ac1,null));};exports[_0x3f9d('0x28')]=function(_0x193d04,_0x5e878c){return db[_0x3f9d('0x2d')][_0x3f9d('0x48')]({'where':{'id':_0x193d04[_0x3f9d('0x47')]['id']}})[_0x3f9d('0x27')](handleEntityNotFound(_0x5e878c,null))[_0x3f9d('0x27')](removeEntity(_0x5e878c,null))[_0x3f9d('0x45')](handleError(_0x5e878c,null));};exports[_0x3f9d('0x4b')]=function(_0x26cb49,_0x5bc035){return db[_0x3f9d('0x2d')][_0x3f9d('0x4b')]()['then'](respondWithResult(_0x5bc035,null))[_0x3f9d('0x45')](handleError(_0x5bc035,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index d6d9a21..7bfc7c2 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 _0x7143=['setMaxListeners','emit','hasOwnProperty','hook','exports','events'];(function(_0x37944c,_0x56763c){var _0x2e3f76=function(_0x571760){while(--_0x571760){_0x37944c['push'](_0x37944c['shift']());}};_0x2e3f76(++_0x56763c);}(_0x7143,0x14f));var _0x3714=function(_0x497840,_0x57fc29){_0x497840=_0x497840-0x0;var _0x3dcc3b=_0x7143[_0x497840];return _0x3dcc3b;};'use strict';var EventEmitter=require(_0x3714('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3714('0x1')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x578c47){return function(_0x1b3f31,_0x301ae6,_0x45b0db){MailSubstatusEvents[_0x3714('0x2')](_0x578c47+':'+_0x1b3f31['id'],_0x1b3f31);MailSubstatusEvents['emit'](_0x578c47,_0x1b3f31);_0x45b0db(null);};}for(var e in events){if(events[_0x3714('0x3')](e)){var event=events[e];MailSubstatus[_0x3714('0x4')](e,emitEvent(event));}}module[_0x3714('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0xbf79=['hook','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xbf79,0x1d1));var _0x9bf7=function(_0x7ee85f,_0x1a7be0){_0x7ee85f=_0x7ee85f-0x0;var _0x243ce1=_0xbf79[_0x7ee85f];return _0x243ce1;};'use strict';var EventEmitter=require(_0x9bf7('0x0'));var MailSubstatus=require(_0x9bf7('0x1'))['db'][_0x9bf7('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x9bf7('0x3')](0x0);var events={'afterUpdate':_0x9bf7('0x4')};function emitEvent(_0x521aab){return function(_0x13cc1c,_0x1350b2,_0x286ef8){MailSubstatusEvents[_0x9bf7('0x5')](_0x521aab+':'+_0x13cc1c['id'],_0x13cc1c);MailSubstatusEvents[_0x9bf7('0x5')](_0x521aab,_0x13cc1c);_0x286ef8(null);};}for(var e in events){if(events[_0x9bf7('0x6')](e)){var event=events[e];MailSubstatus[_0x9bf7('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 1743584..c0a337b 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 _0x8c7d=['Condition','update','_previousDataValues','name','catch','./mailSubstatus.attributes','models','define','MailSubstatus','mail_substatuses'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c7d,0xe1));var _0xd8c7=function(_0xc2972,_0x3a044f){_0xc2972=_0xc2972-0x0;var _0x21f5ae=_0x8c7d[_0xc2972];return _0x21f5ae;};'use strict';var attributes=require(_0xd8c7('0x0'));module['exports']=function(_0x1c5e0e){var _0x4d0a14=_0x1c5e0e[_0xd8c7('0x1')];return _0x1c5e0e[_0xd8c7('0x2')](_0xd8c7('0x3'),attributes,{'tableName':_0xd8c7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x27fc03,_0x39ca48,_0x2db587){return _0x4d0a14[_0xd8c7('0x5')][_0xd8c7('0x6')]({'value':_0x27fc03['name']},{'where':{'field':'mailSubstatus','value':_0x27fc03[_0xd8c7('0x7')][_0xd8c7('0x8')]}})['then'](function(){_0x2db587();})[_0xd8c7('0x9')](function(_0x4e2f05){_0x2db587(_0x4e2f05);});}}});}; \ No newline at end of file +var _0xc397=['_previousDataValues','name','then','catch','exports','models','define','MailSubstatus','Condition','update'];(function(_0x23bfd7,_0x289f3f){var _0x2631a1=function(_0x3c6d14){while(--_0x3c6d14){_0x23bfd7['push'](_0x23bfd7['shift']());}};_0x2631a1(++_0x289f3f);}(_0xc397,0x18a));var _0x7c39=function(_0x1f7c6d,_0x4faefb){_0x1f7c6d=_0x1f7c6d-0x0;var _0x564949=_0xc397[_0x1f7c6d];return _0x564949;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x7c39('0x0')]=function(_0x406984){var _0x1e7508=_0x406984[_0x7c39('0x1')];return _0x406984[_0x7c39('0x2')](_0x7c39('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x576cb8,_0x88ae5b,_0x5cdebc){return _0x1e7508[_0x7c39('0x4')][_0x7c39('0x5')]({'value':_0x576cb8['name']},{'where':{'field':'mailSubstatus','value':_0x576cb8[_0x7c39('0x6')][_0x7c39('0x7')]}})[_0x7c39('0x8')](function(){_0x5cdebc();})[_0x7c39('0x9')](function(_0x5958d7){_0x5cdebc(_0x5958d7);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 53f4891..d4c3fd3 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 _0x2350=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x469f97,_0x1d2bd0){var _0x557d30=function(_0xe4d2a5){while(--_0xe4d2a5){_0x469f97['push'](_0x469f97['shift']());}};_0x557d30(++_0x1d2bd0);}(_0x2350,0xf1));var _0x0235=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x2350[_0x53afe9];return _0x396396;};'use strict';var _=require(_0x0235('0x0'));var util=require(_0x0235('0x1'));var moment=require('moment');var BPromise=require(_0x0235('0x2'));var rs=require(_0x0235('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0235('0x4'))['db'];var utils=require(_0x0235('0x5'));var logger=require(_0x0235('0x6'))('rpc');var config=require(_0x0235('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0235('0x8')][_0x0235('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x153bda,_0x4ea0b7,_0x291a48){return new BPromise(function(_0x2df17f,_0x50ace4){return client[_0x0235('0xa')](_0x153bda,_0x291a48)[_0x0235('0xb')](function(_0x3a608e){logger[_0x0235('0xc')](_0x0235('0xd'),_0x4ea0b7,'request\x20sent');logger['debug'](_0x0235('0xe'),_0x4ea0b7,'request\x20sent',JSON[_0x0235('0xf')](_0x3a608e));if(_0x3a608e['error']){if(_0x3a608e[_0x0235('0x10')][_0x0235('0x11')]===0x1f4){logger['error'](_0x0235('0xd'),_0x4ea0b7,_0x3a608e[_0x0235('0x10')]['message']);return _0x50ace4(_0x3a608e[_0x0235('0x10')][_0x0235('0x12')]);}logger[_0x0235('0x10')](_0x0235('0xd'),_0x4ea0b7,_0x3a608e['error'][_0x0235('0x12')]);return _0x2df17f(_0x3a608e['error']['message']);}else{logger[_0x0235('0xc')](_0x0235('0xd'),_0x4ea0b7,_0x0235('0x13'));_0x2df17f(_0x3a608e[_0x0235('0x14')][_0x0235('0x12')]);}})[_0x0235('0x15')](function(_0x498958){logger[_0x0235('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x4ea0b7,_0x498958);_0x50ace4(_0x498958);});});} \ No newline at end of file +var _0x1a14=['request','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x172692,_0x34dea2){var _0x4632f4=function(_0xd41a47){while(--_0xd41a47){_0x172692['push'](_0x172692['shift']());}};_0x4632f4(++_0x34dea2);}(_0x1a14,0x88));var _0x41a1=function(_0x5af293,_0x535fbb){_0x5af293=_0x5af293-0x0;var _0x482c50=_0x1a14[_0x5af293];return _0x482c50;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x41a1('0x0'));var BPromise=require(_0x41a1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41a1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x41a1('0x3'));var logger=require('../../config/logger')(_0x41a1('0x4'));var config=require(_0x41a1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x41a1('0x6')][_0x41a1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c10bd,_0x2bfead,_0x3fd9ef){return new BPromise(function(_0x9a2c70,_0x3b0e85){return client[_0x41a1('0x8')](_0x2c10bd,_0x3fd9ef)['then'](function(_0x3f7ec1){logger['info'](_0x41a1('0x9'),_0x2bfead,_0x41a1('0xa'));logger[_0x41a1('0xb')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x2bfead,_0x41a1('0xa'),JSON['stringify'](_0x3f7ec1));if(_0x3f7ec1[_0x41a1('0xc')]){if(_0x3f7ec1['error'][_0x41a1('0xd')]===0x1f4){logger[_0x41a1('0xc')](_0x41a1('0x9'),_0x2bfead,_0x3f7ec1[_0x41a1('0xc')][_0x41a1('0xe')]);return _0x3b0e85(_0x3f7ec1[_0x41a1('0xc')][_0x41a1('0xe')]);}logger[_0x41a1('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x2bfead,_0x3f7ec1[_0x41a1('0xc')][_0x41a1('0xe')]);return _0x9a2c70(_0x3f7ec1[_0x41a1('0xc')][_0x41a1('0xe')]);}else{logger[_0x41a1('0xf')](_0x41a1('0x9'),_0x2bfead,'request\x20sent');_0x9a2c70(_0x3f7ec1[_0x41a1('0x10')][_0x41a1('0xe')]);}})[_0x41a1('0x11')](function(_0x501f87){logger[_0x41a1('0xc')](_0x41a1('0x9'),_0x2bfead,_0x501f87);_0x3b0e85(_0x501f87);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 438dfa2..6775fa5 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 _0x8edb=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./mailTransferReport.controller','isAuthenticated','/describe','describe','/:id'];(function(_0x355c2d,_0x4da481){var _0xf39fe=function(_0x4e0df0){while(--_0x4e0df0){_0x355c2d['push'](_0x355c2d['shift']());}};_0xf39fe(++_0x4da481);}(_0x8edb,0xeb));var _0xb8ed=function(_0x10a60b,_0x1fb75e){_0x10a60b=_0x10a60b-0x0;var _0x491e28=_0x8edb[_0x10a60b];return _0x491e28;};'use strict';var multer=require(_0xb8ed('0x0'));var util=require(_0xb8ed('0x1'));var path=require(_0xb8ed('0x2'));var timeout=require(_0xb8ed('0x3'));var express=require(_0xb8ed('0x4'));var router=express[_0xb8ed('0x5')]();var fs_extra=require(_0xb8ed('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb8ed('0x7'));router['get']('/',auth[_0xb8ed('0x8')](),controller['index']);router['get'](_0xb8ed('0x9'),auth[_0xb8ed('0x8')](),controller[_0xb8ed('0xa')]);router['get'](_0xb8ed('0xb'),auth[_0xb8ed('0x8')](),controller[_0xb8ed('0xc')]);router[_0xb8ed('0xd')]('/',auth['isAuthenticated'](),controller[_0xb8ed('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb8ed('0xf')]);router[_0xb8ed('0x10')](_0xb8ed('0xb'),auth[_0xb8ed('0x8')](),controller[_0xb8ed('0x11')]);module[_0xb8ed('0x12')]=router; \ No newline at end of file +var _0xf547=['isAuthenticated','index','/describe','/:id','post','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0xe6e3bd,_0x12f283){var _0x3dc6a7=function(_0x19c720){while(--_0x19c720){_0xe6e3bd['push'](_0xe6e3bd['shift']());}};_0x3dc6a7(++_0x12f283);}(_0xf547,0xa1));var _0x7f54=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xf547[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x7f54('0x0'));var util=require('util');var path=require(_0x7f54('0x1'));var timeout=require(_0x7f54('0x2'));var express=require(_0x7f54('0x3'));var router=express[_0x7f54('0x4')]();var fs_extra=require(_0x7f54('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7f54('0x6'));var config=require(_0x7f54('0x7'));var controller=require('./mailTransferReport.controller');router[_0x7f54('0x8')]('/',auth[_0x7f54('0x9')](),controller[_0x7f54('0xa')]);router[_0x7f54('0x8')](_0x7f54('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7f54('0x8')](_0x7f54('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7f54('0xd')]('/',auth[_0x7f54('0x9')](),controller['create']);router[_0x7f54('0xe')]('/:id',auth[_0x7f54('0x9')](),controller[_0x7f54('0xf')]);router[_0x7f54('0x10')](_0x7f54('0xc'),auth[_0x7f54('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c7213ae..2bfb62d 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x107fda,_0x2ca1ac){var _0xcc07c3=function(_0x4d81eb){while(--_0x4d81eb){_0x107fda['push'](_0x107fda['shift']());}};_0xcc07c3(++_0x2ca1ac);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0xcb91[_0x393500];return _0x120d3b;};'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 +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x27828f,_0x2617e2){var _0x4c8b4f=function(_0x18c0b2){while(--_0x18c0b2){_0x27828f['push'](_0x27828f['shift']());}};_0x4c8b4f(++_0x2617e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ac931f9..812bc2b 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 _0x234b=['body','describe','eml-format','rimraf','request-promise','moment','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create'];(function(_0x307734,_0x318fb6){var _0x296bb1=function(_0x40dd64){while(--_0x40dd64){_0x307734['push'](_0x307734['shift']());}};_0x296bb1(++_0x318fb6);}(_0x234b,0x17e));var _0xb234=function(_0x1a2179,_0xc9805b){_0x1a2179=_0x1a2179-0x0;var _0x281c32=_0x234b[_0x1a2179];return _0x281c32;};'use strict';var emlformat=require(_0xb234('0x0'));var rimraf=require(_0xb234('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb234('0x2'));var moment=require(_0xb234('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb234('0x4'));var util=require(_0xb234('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb234('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb234('0x7'));var squel=require(_0xb234('0x8'));var crypto=require(_0xb234('0x9'));var jsforce=require(_0xb234('0xa'));var deskjs=require(_0xb234('0xb'));var toCsv=require(_0xb234('0xc'));var querystring=require(_0xb234('0xd'));var Papa=require('papaparse');var Redis=require(_0xb234('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb234('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb234('0x10'));var logger=require(_0xb234('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xb234('0x12'));var licenseUtil=require(_0xb234('0x13'));var db=require(_0xb234('0x14'))['db'];function respondWithStatusCode(_0x112a5d,_0x3d1ea4){_0x3d1ea4=_0x3d1ea4||0xcc;return function(_0x569650){if(_0x569650){return _0x112a5d[_0xb234('0x15')](_0x3d1ea4);}return _0x112a5d[_0xb234('0x16')](_0x3d1ea4)[_0xb234('0x17')]();};}function respondWithResult(_0x1821ce,_0x3723db){_0x3723db=_0x3723db||0xc8;return function(_0x55b994){if(_0x55b994){return _0x1821ce[_0xb234('0x16')](_0x3723db)[_0xb234('0x18')](_0x55b994);}};}function respondWithFilteredResult(_0x17e4d5,_0xb989ac){return function(_0x9ff0b){if(_0x9ff0b){var _0x41a362=typeof _0xb989ac[_0xb234('0x19')]===_0xb234('0x1a')&&typeof _0xb989ac[_0xb234('0x1b')]==='undefined';var _0x266bd6=_0x9ff0b[_0xb234('0x1c')];var _0x449765=_0x41a362?0x0:_0xb989ac[_0xb234('0x19')];var _0x149345=_0x41a362?_0x9ff0b['count']:_0xb989ac[_0xb234('0x19')]+_0xb989ac[_0xb234('0x1b')];var _0xf247dc;if(_0x149345>=_0x266bd6){_0x149345=_0x266bd6;_0xf247dc=0xc8;}else{_0xf247dc=0xce;}_0x17e4d5['status'](_0xf247dc);return _0x17e4d5[_0xb234('0x1d')](_0xb234('0x1e'),_0x449765+'-'+_0x149345+'/'+_0x266bd6)[_0xb234('0x18')](_0x9ff0b);}return null;};}function patchUpdates(_0x13608b){return function(_0x4ec944){try{jsonpatch[_0xb234('0x1f')](_0x4ec944,_0x13608b,!![]);}catch(_0x23b1de){return BPromise[_0xb234('0x20')](_0x23b1de);}return _0x4ec944[_0xb234('0x21')]();};}function saveUpdates(_0x410a61,_0x418bbf){return function(_0x8f878c){if(_0x8f878c){return _0x8f878c[_0xb234('0x22')](_0x410a61)['then'](function(_0x31c745){return _0x31c745;});}return null;};}function removeEntity(_0x242016,_0x45ea5e){return function(_0x1ee164){if(_0x1ee164){return _0x1ee164[_0xb234('0x23')]()[_0xb234('0x24')](function(){_0x242016['status'](0xcc)[_0xb234('0x17')]();});}};}function handleEntityNotFound(_0x335831,_0x122da9){return function(_0x41e2f2){if(!_0x41e2f2){_0x335831[_0xb234('0x15')](0x194);}return _0x41e2f2;};}function handleError(_0x51f952,_0x519e8b){_0x519e8b=_0x519e8b||0x1f4;return function(_0x13dcd8){logger[_0xb234('0x25')](_0x13dcd8[_0xb234('0x26')]);if(_0x13dcd8[_0xb234('0x27')]){delete _0x13dcd8[_0xb234('0x27')];}_0x51f952[_0xb234('0x16')](_0x519e8b)[_0xb234('0x28')](_0x13dcd8);};}exports[_0xb234('0x29')]=function(_0x3dead7,_0x4e2a58){var _0x4dab0b={},_0x316102={},_0x164a8e={'count':0x0,'rows':[]};var _0x28709c=_[_0xb234('0x2a')](db[_0xb234('0x2b')][_0xb234('0x2c')],function(_0x5ca6cc){return{'name':_0x5ca6cc[_0xb234('0x2d')],'type':_0x5ca6cc['type'][_0xb234('0x2e')]};});_0x316102['model']=_['map'](_0x28709c,_0xb234('0x27'));_0x316102[_0xb234('0x2f')]=_[_0xb234('0x30')](_0x3dead7[_0xb234('0x2f')]);_0x316102['filters']=_[_0xb234('0x31')](_0x316102[_0xb234('0x32')],_0x316102['query']);_0x4dab0b[_0xb234('0x33')]=_['intersection'](_0x316102[_0xb234('0x32')],qs[_0xb234('0x34')](_0x3dead7[_0xb234('0x2f')][_0xb234('0x34')]));_0x4dab0b['attributes']=_0x4dab0b['attributes'][_0xb234('0x35')]?_0x4dab0b[_0xb234('0x33')]:_0x316102[_0xb234('0x32')];if(!_0x3dead7[_0xb234('0x2f')][_0xb234('0x36')](_0xb234('0x37'))){_0x4dab0b[_0xb234('0x1b')]=qs[_0xb234('0x1b')](_0x3dead7['query'][_0xb234('0x1b')]);_0x4dab0b[_0xb234('0x19')]=qs[_0xb234('0x19')](_0x3dead7['query'][_0xb234('0x19')]);}_0x4dab0b[_0xb234('0x38')]=qs[_0xb234('0x39')](_0x3dead7['query'][_0xb234('0x39')]);_0x4dab0b['where']=qs[_0xb234('0x3a')](_[_0xb234('0x3b')](_0x3dead7[_0xb234('0x2f')],_0x316102[_0xb234('0x3a')]),_0x28709c);if(_0x3dead7[_0xb234('0x2f')][_0xb234('0x3c')]){_0x4dab0b[_0xb234('0x3d')]=_[_0xb234('0x3e')](_0x4dab0b[_0xb234('0x3d')],{'$or':_[_0xb234('0x2a')](_0x28709c,function(_0x50c3ef){if(_0x50c3ef[_0xb234('0x3f')]!==_0xb234('0x40')){var _0x427f67={};_0x427f67[_0x50c3ef['name']]={'$like':'%'+_0x3dead7['query'][_0xb234('0x3c')]+'%'};return _0x427f67;}})});}_0x4dab0b=_['merge']({},_0x4dab0b,_0x3dead7[_0xb234('0x41')]);var _0x27e2a5={'where':_0x4dab0b[_0xb234('0x3d')]};return db[_0xb234('0x2b')][_0xb234('0x1c')](_0x27e2a5)[_0xb234('0x24')](function(_0x78c33a){_0x164a8e[_0xb234('0x1c')]=_0x78c33a;if(_0x3dead7[_0xb234('0x2f')][_0xb234('0x42')]){_0x4dab0b['include']=[{'all':!![]}];}return db[_0xb234('0x2b')][_0xb234('0x43')](_0x4dab0b);})['then'](function(_0x5408f6){_0x164a8e[_0xb234('0x44')]=_0x5408f6;return _0x164a8e;})['then'](respondWithFilteredResult(_0x4e2a58,_0x4dab0b))[_0xb234('0x45')](handleError(_0x4e2a58,null));};exports['show']=function(_0x28547c,_0x245ba1){var _0x39840b={'raw':!![],'where':{'id':_0x28547c[_0xb234('0x46')]['id']}},_0x5be531={};_0x5be531['model']=_['keys'](db['MailTransferReport'][_0xb234('0x2c')]);_0x5be531['query']=_[_0xb234('0x30')](_0x28547c[_0xb234('0x2f')]);_0x5be531[_0xb234('0x3a')]=_[_0xb234('0x31')](_0x5be531[_0xb234('0x32')],_0x5be531[_0xb234('0x2f')]);_0x39840b[_0xb234('0x33')]=_[_0xb234('0x31')](_0x5be531[_0xb234('0x32')],qs['fields'](_0x28547c[_0xb234('0x2f')][_0xb234('0x34')]));_0x39840b[_0xb234('0x33')]=_0x39840b[_0xb234('0x33')][_0xb234('0x35')]?_0x39840b[_0xb234('0x33')]:_0x5be531['model'];if(_0x28547c[_0xb234('0x2f')]['includeAll']){_0x39840b[_0xb234('0x47')]=[{'all':!![]}];}_0x39840b=_[_0xb234('0x3e')]({},_0x39840b,_0x28547c[_0xb234('0x41')]);return db[_0xb234('0x2b')][_0xb234('0x48')](_0x39840b)[_0xb234('0x24')](handleEntityNotFound(_0x245ba1,null))['then'](respondWithResult(_0x245ba1,null))[_0xb234('0x45')](handleError(_0x245ba1,null));};exports[_0xb234('0x49')]=function(_0x51ca8e,_0x4c1f25){return db['MailTransferReport'][_0xb234('0x49')](_0x51ca8e['body'],{})[_0xb234('0x24')](respondWithResult(_0x4c1f25,0xc9))[_0xb234('0x45')](handleError(_0x4c1f25,null));};exports['update']=function(_0x1a2f7e,_0x54af60){if(_0x1a2f7e[_0xb234('0x4a')]['id']){delete _0x1a2f7e[_0xb234('0x4a')]['id'];}return db[_0xb234('0x2b')]['find']({'where':{'id':_0x1a2f7e['params']['id']}})[_0xb234('0x24')](handleEntityNotFound(_0x54af60,null))['then'](saveUpdates(_0x1a2f7e[_0xb234('0x4a')],null))['then'](respondWithResult(_0x54af60,null))[_0xb234('0x45')](handleError(_0x54af60,null));};exports[_0xb234('0x23')]=function(_0x2d86b3,_0x3a0c1d){return db[_0xb234('0x2b')][_0xb234('0x48')]({'where':{'id':_0x2d86b3['params']['id']}})[_0xb234('0x24')](handleEntityNotFound(_0x3a0c1d,null))[_0xb234('0x24')](removeEntity(_0x3a0c1d,null))[_0xb234('0x45')](handleError(_0x3a0c1d,null));};exports[_0xb234('0x4b')]=function(_0x7aceb1,_0x406490){return db[_0xb234('0x2b')][_0xb234('0x4b')]()['then'](respondWithResult(_0x406490,null))[_0xb234('0x45')](handleError(_0x406490,null));}; \ No newline at end of file +var _0xa73c=['json','undefined','limit','offset','count','set','apply','save','update','then','destroy','stack','name','MailTransferReport','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x53ee09,_0x1ba9c4){var _0x138758=function(_0x24376d){while(--_0x24376d){_0x53ee09['push'](_0x53ee09['shift']());}};_0x138758(++_0x1ba9c4);}(_0xa73c,0x1c9));var _0xca73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa73c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca73('0x0'));var zipdir=require(_0xca73('0x1'));var jsonpatch=require(_0xca73('0x2'));var rp=require('request-promise');var moment=require(_0xca73('0x3'));var BPromise=require(_0xca73('0x4'));var Mustache=require(_0xca73('0x5'));var util=require('util');var path=require('path');var sox=require(_0xca73('0x6'));var csv=require(_0xca73('0x7'));var ejs=require(_0xca73('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca73('0x9'));var squel=require(_0xca73('0xa'));var crypto=require(_0xca73('0xb'));var jsforce=require(_0xca73('0xc'));var deskjs=require(_0xca73('0xd'));var toCsv=require(_0xca73('0x7'));var querystring=require(_0xca73('0xe'));var Papa=require(_0xca73('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xca73('0x10'));var as=require(_0xca73('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xca73('0x12'));var utils=require(_0xca73('0x13'));var config=require(_0xca73('0x14'));var licenseUtil=require(_0xca73('0x15'));var db=require(_0xca73('0x16'))['db'];function respondWithStatusCode(_0x5d0d1f,_0x225f65){_0x225f65=_0x225f65||0xcc;return function(_0x4fddcf){if(_0x4fddcf){return _0x5d0d1f[_0xca73('0x17')](_0x225f65);}return _0x5d0d1f['status'](_0x225f65)[_0xca73('0x18')]();};}function respondWithResult(_0x109480,_0x5c27aa){_0x5c27aa=_0x5c27aa||0xc8;return function(_0x2e6e8){if(_0x2e6e8){return _0x109480[_0xca73('0x19')](_0x5c27aa)[_0xca73('0x1a')](_0x2e6e8);}};}function respondWithFilteredResult(_0x364093,_0x26c08f){return function(_0x2fe893){if(_0x2fe893){var _0x4ddc2a=typeof _0x26c08f['offset']===_0xca73('0x1b')&&typeof _0x26c08f[_0xca73('0x1c')]===_0xca73('0x1b');var _0x258188=_0x2fe893['count'];var _0x112b4a=_0x4ddc2a?0x0:_0x26c08f[_0xca73('0x1d')];var _0x2d1f6f=_0x4ddc2a?_0x2fe893[_0xca73('0x1e')]:_0x26c08f[_0xca73('0x1d')]+_0x26c08f[_0xca73('0x1c')];var _0x5ba928;if(_0x2d1f6f>=_0x258188){_0x2d1f6f=_0x258188;_0x5ba928=0xc8;}else{_0x5ba928=0xce;}_0x364093[_0xca73('0x19')](_0x5ba928);return _0x364093[_0xca73('0x1f')]('Content-Range',_0x112b4a+'-'+_0x2d1f6f+'/'+_0x258188)[_0xca73('0x1a')](_0x2fe893);}return null;};}function patchUpdates(_0x14000d){return function(_0x299b90){try{jsonpatch[_0xca73('0x20')](_0x299b90,_0x14000d,!![]);}catch(_0x4754e1){return BPromise['reject'](_0x4754e1);}return _0x299b90[_0xca73('0x21')]();};}function saveUpdates(_0x526d3d,_0x4f6bcc){return function(_0xe55ac8){if(_0xe55ac8){return _0xe55ac8[_0xca73('0x22')](_0x526d3d)[_0xca73('0x23')](function(_0x373f10){return _0x373f10;});}return null;};}function removeEntity(_0x1c6fdd,_0x37df6b){return function(_0x39ed12){if(_0x39ed12){return _0x39ed12[_0xca73('0x24')]()['then'](function(){_0x1c6fdd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f95af,_0x4f2fc2){return function(_0x27c565){if(!_0x27c565){_0x1f95af[_0xca73('0x17')](0x194);}return _0x27c565;};}function handleError(_0x43938b,_0x282213){_0x282213=_0x282213||0x1f4;return function(_0x49ee1e){logger['error'](_0x49ee1e[_0xca73('0x25')]);if(_0x49ee1e[_0xca73('0x26')]){delete _0x49ee1e[_0xca73('0x26')];}_0x43938b[_0xca73('0x19')](_0x282213)['send'](_0x49ee1e);};}exports['index']=function(_0x4b7696,_0x579425){var _0x2cfb25={},_0x18e862={},_0x459495={'count':0x0,'rows':[]};var _0x546a3a=_['map'](db[_0xca73('0x27')][_0xca73('0x28')],function(_0x2c0283){return{'name':_0x2c0283['fieldName'],'type':_0x2c0283[_0xca73('0x29')][_0xca73('0x2a')]};});_0x18e862[_0xca73('0x2b')]=_[_0xca73('0x2c')](_0x546a3a,_0xca73('0x26'));_0x18e862[_0xca73('0x2d')]=_[_0xca73('0x2e')](_0x4b7696[_0xca73('0x2d')]);_0x18e862[_0xca73('0x2f')]=_['intersection'](_0x18e862[_0xca73('0x2b')],_0x18e862[_0xca73('0x2d')]);_0x2cfb25[_0xca73('0x30')]=_['intersection'](_0x18e862[_0xca73('0x2b')],qs[_0xca73('0x31')](_0x4b7696['query'][_0xca73('0x31')]));_0x2cfb25[_0xca73('0x30')]=_0x2cfb25['attributes'][_0xca73('0x32')]?_0x2cfb25['attributes']:_0x18e862[_0xca73('0x2b')];if(!_0x4b7696[_0xca73('0x2d')][_0xca73('0x33')](_0xca73('0x34'))){_0x2cfb25[_0xca73('0x1c')]=qs[_0xca73('0x1c')](_0x4b7696['query'][_0xca73('0x1c')]);_0x2cfb25[_0xca73('0x1d')]=qs[_0xca73('0x1d')](_0x4b7696[_0xca73('0x2d')][_0xca73('0x1d')]);}_0x2cfb25[_0xca73('0x35')]=qs[_0xca73('0x36')](_0x4b7696['query'][_0xca73('0x36')]);_0x2cfb25[_0xca73('0x37')]=qs[_0xca73('0x2f')](_[_0xca73('0x38')](_0x4b7696[_0xca73('0x2d')],_0x18e862[_0xca73('0x2f')]),_0x546a3a);if(_0x4b7696[_0xca73('0x2d')][_0xca73('0x39')]){_0x2cfb25[_0xca73('0x37')]=_[_0xca73('0x3a')](_0x2cfb25[_0xca73('0x37')],{'$or':_[_0xca73('0x2c')](_0x546a3a,function(_0x7114){if(_0x7114[_0xca73('0x29')]!==_0xca73('0x3b')){var _0x517220={};_0x517220[_0x7114[_0xca73('0x26')]]={'$like':'%'+_0x4b7696[_0xca73('0x2d')][_0xca73('0x39')]+'%'};return _0x517220;}})});}_0x2cfb25=_[_0xca73('0x3a')]({},_0x2cfb25,_0x4b7696[_0xca73('0x3c')]);var _0x4e27f8={'where':_0x2cfb25['where']};return db[_0xca73('0x27')][_0xca73('0x1e')](_0x4e27f8)[_0xca73('0x23')](function(_0x2c2013){_0x459495[_0xca73('0x1e')]=_0x2c2013;if(_0x4b7696[_0xca73('0x2d')][_0xca73('0x3d')]){_0x2cfb25[_0xca73('0x3e')]=[{'all':!![]}];}return db[_0xca73('0x27')]['findAll'](_0x2cfb25);})[_0xca73('0x23')](function(_0x3b2ac6){_0x459495[_0xca73('0x3f')]=_0x3b2ac6;return _0x459495;})['then'](respondWithFilteredResult(_0x579425,_0x2cfb25))[_0xca73('0x40')](handleError(_0x579425,null));};exports['show']=function(_0x51deff,_0x314855){var _0x4e9c7e={'raw':!![],'where':{'id':_0x51deff[_0xca73('0x41')]['id']}},_0x2cea02={};_0x2cea02[_0xca73('0x2b')]=_[_0xca73('0x2e')](db[_0xca73('0x27')][_0xca73('0x28')]);_0x2cea02['query']=_[_0xca73('0x2e')](_0x51deff['query']);_0x2cea02[_0xca73('0x2f')]=_['intersection'](_0x2cea02[_0xca73('0x2b')],_0x2cea02['query']);_0x4e9c7e['attributes']=_['intersection'](_0x2cea02[_0xca73('0x2b')],qs[_0xca73('0x31')](_0x51deff['query']['fields']));_0x4e9c7e[_0xca73('0x30')]=_0x4e9c7e['attributes'][_0xca73('0x32')]?_0x4e9c7e[_0xca73('0x30')]:_0x2cea02[_0xca73('0x2b')];if(_0x51deff[_0xca73('0x2d')]['includeAll']){_0x4e9c7e[_0xca73('0x3e')]=[{'all':!![]}];}_0x4e9c7e=_[_0xca73('0x3a')]({},_0x4e9c7e,_0x51deff[_0xca73('0x3c')]);return db[_0xca73('0x27')][_0xca73('0x42')](_0x4e9c7e)[_0xca73('0x23')](handleEntityNotFound(_0x314855,null))[_0xca73('0x23')](respondWithResult(_0x314855,null))[_0xca73('0x40')](handleError(_0x314855,null));};exports[_0xca73('0x43')]=function(_0x277ca6,_0x5e8c8d){return db[_0xca73('0x27')][_0xca73('0x43')](_0x277ca6[_0xca73('0x44')],{})[_0xca73('0x23')](respondWithResult(_0x5e8c8d,0xc9))[_0xca73('0x40')](handleError(_0x5e8c8d,null));};exports['update']=function(_0x76a00,_0xd0ff8c){if(_0x76a00[_0xca73('0x44')]['id']){delete _0x76a00['body']['id'];}return db[_0xca73('0x27')][_0xca73('0x42')]({'where':{'id':_0x76a00[_0xca73('0x41')]['id']}})['then'](handleEntityNotFound(_0xd0ff8c,null))['then'](saveUpdates(_0x76a00['body'],null))[_0xca73('0x23')](respondWithResult(_0xd0ff8c,null))[_0xca73('0x40')](handleError(_0xd0ff8c,null));};exports[_0xca73('0x24')]=function(_0x21a5e6,_0x509deb){return db[_0xca73('0x27')][_0xca73('0x42')]({'where':{'id':_0x21a5e6['params']['id']}})[_0xca73('0x23')](handleEntityNotFound(_0x509deb,null))[_0xca73('0x23')](removeEntity(_0x509deb,null))[_0xca73('0x40')](handleError(_0x509deb,null));};exports['describe']=function(_0x33c22f,_0x4574e6){return db[_0xca73('0x27')]['describe']()[_0xca73('0x23')](respondWithResult(_0x4574e6,null))[_0xca73('0x40')](handleError(_0x4574e6,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index cde216e..654f132 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 _0x1e14=['util','../../config/logger','api','path','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x5c7c31,_0x22aa86){var _0x193fdf=function(_0x271ade){while(--_0x271ade){_0x5c7c31['push'](_0x5c7c31['shift']());}};_0x193fdf(++_0x22aa86);}(_0x1e14,0xef));var _0x41e1=function(_0x3dfd18,_0x4b7fac){_0x3dfd18=_0x3dfd18-0x0;var _0x9c0fd=_0x1e14[_0x3dfd18];return _0x9c0fd;};'use strict';var _=require(_0x41e1('0x0'));var util=require(_0x41e1('0x1'));var logger=require(_0x41e1('0x2'))(_0x41e1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x41e1('0x4'));var rimraf=require('rimraf');var config=require(_0x41e1('0x5'));var attributes=require(_0x41e1('0x6'));module[_0x41e1('0x7')]=function(_0xd3a2bf,_0x362862){return _0xd3a2bf[_0x41e1('0x8')](_0x41e1('0x9'),attributes,{'tableName':_0x41e1('0xa'),'paranoid':![],'indexes':[{'name':_0x41e1('0xb'),'fields':[_0x41e1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf483=['report_mail_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','MailTransferReport'];(function(_0x1dafd7,_0xab3534){var _0x3b20fa=function(_0x465a27){while(--_0x465a27){_0x1dafd7['push'](_0x1dafd7['shift']());}};_0x3b20fa(++_0xab3534);}(_0xf483,0xf2));var _0x3f48=function(_0x5666e0,_0x1524d1){_0x5666e0=_0x5666e0-0x0;var _0x130fcb=_0xf483[_0x5666e0];return _0x130fcb;};'use strict';var _=require('lodash');var util=require(_0x3f48('0x0'));var logger=require('../../config/logger')(_0x3f48('0x1'));var moment=require(_0x3f48('0x2'));var BPromise=require(_0x3f48('0x3'));var rp=require(_0x3f48('0x4'));var fs=require('fs');var path=require(_0x3f48('0x5'));var rimraf=require(_0x3f48('0x6'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x1a3447,_0x16905e){return _0x1a3447['define'](_0x3f48('0x7'),attributes,{'tableName':_0x3f48('0x8'),'paranoid':![],'indexes':[{'name':_0x3f48('0x9'),'fields':[_0x3f48('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 119604c..c8a3b8d 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 _0x5fae=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','MailTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x5fae,0x82));var _0xe5fa=function(_0x3681e4,_0x164471){_0x3681e4=_0x3681e4-0x0;var _0x3b81ec=_0x5fae[_0x3681e4];return _0x3b81ec;};'use strict';var _=require(_0xe5fa('0x0'));var util=require(_0xe5fa('0x1'));var moment=require(_0xe5fa('0x2'));var BPromise=require(_0xe5fa('0x3'));var rs=require(_0xe5fa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe5fa('0x5'));var logger=require(_0xe5fa('0x6'))(_0xe5fa('0x7'));var config=require(_0xe5fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe5fa('0x9')][_0xe5fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1696e3,_0x1fefc1,_0x24446d){return new BPromise(function(_0x50ed5a,_0xb5b70f){return client['request'](_0x1696e3,_0x24446d)['then'](function(_0x427f3d){logger[_0xe5fa('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x1fefc1,_0xe5fa('0xc'));logger['debug'](_0xe5fa('0xd'),_0x1fefc1,_0xe5fa('0xc'),JSON['stringify'](_0x427f3d));if(_0x427f3d[_0xe5fa('0xe')]){if(_0x427f3d['error'][_0xe5fa('0xf')]===0x1f4){logger[_0xe5fa('0xe')](_0xe5fa('0x10'),_0x1fefc1,_0x427f3d[_0xe5fa('0xe')]['message']);return _0xb5b70f(_0x427f3d[_0xe5fa('0xe')][_0xe5fa('0x11')]);}logger[_0xe5fa('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x1fefc1,_0x427f3d[_0xe5fa('0xe')][_0xe5fa('0x11')]);return _0x50ed5a(_0x427f3d[_0xe5fa('0xe')]['message']);}else{logger[_0xe5fa('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x1fefc1,'request\x20sent');_0x50ed5a(_0x427f3d[_0xe5fa('0x12')][_0xe5fa('0x11')]);}})['catch'](function(_0x5f3cb6){logger['error'](_0xe5fa('0x10'),_0x1fefc1,_0x5f3cb6);_0xb5b70f(_0x5f3cb6);});});} \ No newline at end of file +var _0x5f09=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x5f09,0x1df));var _0x95f0=function(_0x4b2bda,_0x261630){_0x4b2bda=_0x4b2bda-0x0;var _0x30a7d0=_0x5f09[_0x4b2bda];return _0x30a7d0;};'use strict';var _=require(_0x95f0('0x0'));var util=require(_0x95f0('0x1'));var moment=require('moment');var BPromise=require(_0x95f0('0x2'));var rs=require(_0x95f0('0x3'));var fs=require('fs');var Redis=require(_0x95f0('0x4'));var db=require(_0x95f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95f0('0x6'))(_0x95f0('0x7'));var config=require('../../config/environment');var jayson=require(_0x95f0('0x8'));var client=jayson[_0x95f0('0x9')][_0x95f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f1b0b,_0x917174,_0x25db45){return new BPromise(function(_0x5a35e1,_0x526b40){return client[_0x95f0('0xb')](_0x1f1b0b,_0x25db45)[_0x95f0('0xc')](function(_0x258811){logger[_0x95f0('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x917174,_0x95f0('0xe'));logger['debug'](_0x95f0('0xf'),_0x917174,_0x95f0('0xe'),JSON[_0x95f0('0x10')](_0x258811));if(_0x258811[_0x95f0('0x11')]){if(_0x258811[_0x95f0('0x11')][_0x95f0('0x12')]===0x1f4){logger[_0x95f0('0x11')](_0x95f0('0x13'),_0x917174,_0x258811['error']['message']);return _0x526b40(_0x258811[_0x95f0('0x11')]['message']);}logger[_0x95f0('0x11')](_0x95f0('0x13'),_0x917174,_0x258811['error'][_0x95f0('0x14')]);return _0x5a35e1(_0x258811[_0x95f0('0x11')][_0x95f0('0x14')]);}else{logger[_0x95f0('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x917174,_0x95f0('0xe'));_0x5a35e1(_0x258811[_0x95f0('0x15')][_0x95f0('0x14')]);}})[_0x95f0('0x16')](function(_0x28853d){logger[_0x95f0('0x11')](_0x95f0('0x13'),_0x917174,_0x28853d);_0x526b40(_0x28853d);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 8020cd6..46e7dbd 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 _0xe507=['multer','util','express','Router','fs-extra','../../components/auth/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x2c68cf,_0x42e6b0){var _0x83af86=function(_0x55e77a){while(--_0x55e77a){_0x2c68cf['push'](_0x2c68cf['shift']());}};_0x83af86(++_0x42e6b0);}(_0xe507,0x1b9));var _0x7e50=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0xe507[_0xeff2c3];return _0x2cade6;};'use strict';var multer=require(_0x7e50('0x0'));var util=require(_0x7e50('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7e50('0x2'));var router=express[_0x7e50('0x3')]();var fs_extra=require(_0x7e50('0x4'));var auth=require(_0x7e50('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7e50('0x6'));router[_0x7e50('0x7')]('/',auth[_0x7e50('0x8')](),controller[_0x7e50('0x9')]);router[_0x7e50('0x7')](_0x7e50('0xa'),auth['isAuthenticated'](),controller[_0x7e50('0xb')]);router['get'](_0x7e50('0xc'),auth[_0x7e50('0x8')](),controller[_0x7e50('0xd')]);router[_0x7e50('0xe')]('/',auth[_0x7e50('0x8')](),controller[_0x7e50('0xf')]);router[_0x7e50('0x10')](_0x7e50('0xc'),auth[_0x7e50('0x8')](),controller[_0x7e50('0x11')]);router[_0x7e50('0x12')](_0x7e50('0xc'),auth[_0x7e50('0x8')](),controller[_0x7e50('0x13')]);module[_0x7e50('0x14')]=router; \ No newline at end of file +var _0xb921=['isAuthenticated','/:id','show','post','update','destroy','exports','connect-timeout','express','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x5edaaa,_0x67916a){var _0x49097b=function(_0x2de377){while(--_0x2de377){_0x5edaaa['push'](_0x5edaaa['shift']());}};_0x49097b(++_0x67916a);}(_0xb921,0x1ce));var _0x1b92=function(_0x448cb3,_0x203c7b){_0x448cb3=_0x448cb3-0x0;var _0x1df8a7=_0xb921[_0x448cb3];return _0x1df8a7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1b92('0x0'));var express=require(_0x1b92('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b92('0x2'));var config=require(_0x1b92('0x3'));var controller=require(_0x1b92('0x4'));router[_0x1b92('0x5')]('/',auth[_0x1b92('0x6')](),controller['index']);router[_0x1b92('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1b92('0x5')](_0x1b92('0x7'),auth[_0x1b92('0x6')](),controller[_0x1b92('0x8')]);router[_0x1b92('0x9')]('/',auth[_0x1b92('0x6')](),controller['create']);router['put'](_0x1b92('0x7'),auth['isAuthenticated'](),controller[_0x1b92('0xa')]);router['delete']('/:id',auth[_0x1b92('0x6')](),controller[_0x1b92('0xb')]);module[_0x1b92('0xc')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index acddfb2..27ed1a8 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 _0xe8b5=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x31d867,_0x2c2156){var _0x567e4f=function(_0x46eb26){while(--_0x46eb26){_0x31d867['push'](_0x31d867['shift']());}};_0x567e4f(++_0x2c2156);}(_0xe8b5,0x136));var _0x5e8b=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0xe8b5[_0x1385dc];return _0x2f6469;};'use strict';var Sequelize=require(_0x5e8b('0x0'));var moment=require(_0x5e8b('0x1'));module[_0x5e8b('0x2')]={'channel':{'type':Sequelize[_0x5e8b('0x3')]},'membername':{'type':Sequelize[_0x5e8b('0x3')]},'interface':{'type':Sequelize[_0x5e8b('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x5e8b('0x4')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x5a963c){var _0x3cf73d=moment(_0x5a963c);var _0x141e23=moment(this['getDataValue'](_0x5e8b('0x5')));var _0x1d776c=_0x3cf73d[_0x5e8b('0x6')](_0x141e23,_0x5e8b('0x7'));this[_0x5e8b('0x8')](_0x5e8b('0x9'),_0x5a963c);this['setDataValue'](_0x5e8b('0xa'),_0x1d776c>=0x0?_0x1d776c:null);}},'data1':{'type':Sequelize[_0x5e8b('0x3')],'comment':_0x5e8b('0xb')},'data2':{'type':Sequelize[_0x5e8b('0x3')],'comment':_0x5e8b('0xc')},'data3':{'type':Sequelize[_0x5e8b('0x3')],'comment':_0x5e8b('0xd')},'data4':{'type':Sequelize[_0x5e8b('0x3')],'comment':_0x5e8b('0xe')},'data5':{'type':Sequelize[_0x5e8b('0x3')],'comment':_0x5e8b('0xf')},'role':{'type':Sequelize[_0x5e8b('0x3')]},'internal':{'type':Sequelize[_0x5e8b('0x10')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8683=['DATE','getDataValue','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x269c1d,_0x5a31c5){var _0x53f863=function(_0x1c7a5d){while(--_0x1c7a5d){_0x269c1d['push'](_0x269c1d['shift']());}};_0x53f863(++_0x5a31c5);}(_0x8683,0x14e));var _0x3868=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x8683[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x3868('0x0'));var moment=require('moment');module[_0x3868('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3868('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3868('0x2')],'defaultValue':_0x3868('0x3'),'comment':_0x3868('0x4')},'duration':{'type':Sequelize[_0x3868('0x5')]},'enterAt':{'type':Sequelize[_0x3868('0x6')]},'exitAt':{'type':Sequelize[_0x3868('0x6')],'set':function(_0x35c9a5){var _0x50aa16=moment(_0x35c9a5);var _0x2c30ef=moment(this[_0x3868('0x7')]('enterAt'));var _0x9bdb06=_0x50aa16[_0x3868('0x8')](_0x2c30ef,_0x3868('0x9'));this[_0x3868('0xa')](_0x3868('0xb'),_0x35c9a5);this[_0x3868('0xa')]('duration',_0x9bdb06>=0x0?_0x9bdb06:null);}},'data1':{'type':Sequelize[_0x3868('0x2')],'comment':_0x3868('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0x3868('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0x3868('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0x3868('0xf')},'data5':{'type':Sequelize[_0x3868('0x2')],'comment':_0x3868('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x3868('0x5')]},'uniqueid':{'type':Sequelize[_0x3868('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 30426a7..b91b1ce 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 _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x351666,_0x453ec6){var _0x2e007b=function(_0x1f26d5){while(--_0x1f26d5){_0x351666['push'](_0x351666['shift']());}};_0x2e007b(++_0x453ec6);}(_0x7217,0x19e));var _0x7721=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x7217[_0x9aada2];return _0x196dff;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,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(_0x3c4bcd,_0x59f4c3){var _0x335bce=function(_0x43405b){while(--_0x43405b){_0x3c4bcd['push'](_0x3c4bcd['shift']());}};_0x335bce(++_0x59f4c3);}(_0x3e74,0x175));var _0x43e7=function(_0x571949,_0x527d94){_0x571949=_0x571949-0x0;var _0x4b2e83=_0x3e74[_0x571949];return _0x4b2e83;};'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 27a4249..00939be 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 _0x68cf=['rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x68cf,0xe9));var _0xf68c=function(_0x5c74ab,_0x5ed6bb){_0x5c74ab=_0x5c74ab-0x0;var _0x500ea5=_0x68cf[_0x5c74ab];return _0x500ea5;};'use strict';var _=require(_0xf68c('0x0'));var util=require(_0xf68c('0x1'));var logger=require(_0xf68c('0x2'))(_0xf68c('0x3'));var moment=require(_0xf68c('0x4'));var BPromise=require('bluebird');var rp=require(_0xf68c('0x5'));var fs=require('fs');var path=require(_0xf68c('0x6'));var rimraf=require(_0xf68c('0x7'));var config=require('../../config/environment');var attributes=require(_0xf68c('0x8'));module[_0xf68c('0x9')]=function(_0xdf14e5,_0xf87c90){return _0xdf14e5[_0xf68c('0xa')](_0xf68c('0xb'),attributes,{'tableName':_0xf68c('0xc'),'paranoid':![],'indexes':[{'name':_0xf68c('0xd'),'fields':[_0xf68c('0xe'),_0xf68c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf35d=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','MemberReport','report_member','membername_interface','membername','interface'];(function(_0x827aa0,_0x26f731){var _0x5a8a43=function(_0x6dff55){while(--_0x6dff55){_0x827aa0['push'](_0x827aa0['shift']());}};_0x5a8a43(++_0x26f731);}(_0xf35d,0xcc));var _0xdf35=function(_0x2460a4,_0x5c1042){_0x2460a4=_0x2460a4-0x0;var _0x2c5154=_0xf35d[_0x2460a4];return _0x2c5154;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdf35('0x0'))('api');var moment=require('moment');var BPromise=require(_0xdf35('0x1'));var rp=require(_0xdf35('0x2'));var fs=require('fs');var path=require(_0xdf35('0x3'));var rimraf=require(_0xdf35('0x4'));var config=require(_0xdf35('0x5'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x3a4750,_0x1070e6){return _0x3a4750[_0xdf35('0x6')](_0xdf35('0x7'),attributes,{'tableName':_0xdf35('0x8'),'paranoid':![],'indexes':[{'name':_0xdf35('0x9'),'fields':[_0xdf35('0xa'),_0xdf35('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 8ce393f..5eb523b 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 _0x0d4d=['map','model','attributes','GetMemberReport','catch','CreateMemberReport','body','raw','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','MemberReport','options','where','limit','include'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0x0d4d,0x132));var _0xd0d4=function(_0x3b2290,_0x3c8104){_0x3b2290=_0x3b2290-0x0;var _0x55ba1c=_0x0d4d[_0x3b2290];return _0x55ba1c;};'use strict';var _=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var moment=require(_0xd0d4('0x2'));var BPromise=require(_0xd0d4('0x3'));var rs=require(_0xd0d4('0x4'));var fs=require('fs');var Redis=require(_0xd0d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd0d4('0x6'));var logger=require('../../config/logger')(_0xd0d4('0x7'));var config=require(_0xd0d4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd0d4('0x9')][_0xd0d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c5d01,_0x5c8c7b,_0x5bfae8){return new BPromise(function(_0x5403c0,_0x3fdd50){return client['request'](_0x1c5d01,_0x5bfae8)[_0xd0d4('0xb')](function(_0x314cd5){logger[_0xd0d4('0xc')]('MemberReport,\x20%s,\x20%s',_0x5c8c7b,_0xd0d4('0xd'));logger[_0xd0d4('0xe')](_0xd0d4('0xf'),_0x5c8c7b,_0xd0d4('0xd'),JSON[_0xd0d4('0x10')](_0x314cd5));if(_0x314cd5[_0xd0d4('0x11')]){if(_0x314cd5['error'][_0xd0d4('0x12')]===0x1f4){logger[_0xd0d4('0x11')](_0xd0d4('0x13'),_0x5c8c7b,_0x314cd5[_0xd0d4('0x11')][_0xd0d4('0x14')]);return _0x3fdd50(_0x314cd5[_0xd0d4('0x11')]['message']);}logger[_0xd0d4('0x11')](_0xd0d4('0x13'),_0x5c8c7b,_0x314cd5[_0xd0d4('0x11')]['message']);return _0x5403c0(_0x314cd5['error'][_0xd0d4('0x14')]);}else{logger[_0xd0d4('0xc')]('MemberReport,\x20%s,\x20%s',_0x5c8c7b,_0xd0d4('0xd'));_0x5403c0(_0x314cd5[_0xd0d4('0x15')]['message']);}})['catch'](function(_0x1b64f){logger[_0xd0d4('0x11')](_0xd0d4('0x13'),_0x5c8c7b,_0x1b64f);_0x3fdd50(_0x1b64f);});});}exports['GetMemberReport']=function(_0x5cf4c6){var _0x5eb5e4=this;return new Promise(function(_0x407cda,_0x1e46db){return db[_0xd0d4('0x16')]['findAll']({'raw':_0x5cf4c6['options']?_0x5cf4c6[_0xd0d4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5cf4c6[_0xd0d4('0x17')]?_0x5cf4c6[_0xd0d4('0x17')][_0xd0d4('0x18')]||null:null,'attributes':_0x5cf4c6['options']?_0x5cf4c6[_0xd0d4('0x17')]['attributes']||null:null,'limit':_0x5cf4c6['options']?_0x5cf4c6[_0xd0d4('0x17')][_0xd0d4('0x19')]||null:null,'include':_0x5cf4c6['options']?_0x5cf4c6['options'][_0xd0d4('0x1a')]?_[_0xd0d4('0x1b')](_0x5cf4c6[_0xd0d4('0x17')][_0xd0d4('0x1a')],function(_0x1d8033){return{'model':db[_0x1d8033[_0xd0d4('0x1c')]],'as':_0x1d8033['as'],'attributes':_0x1d8033['attributes'],'include':_0x1d8033[_0xd0d4('0x1a')]?_['map'](_0x1d8033[_0xd0d4('0x1a')],function(_0x1b03ef){return{'model':db[_0x1b03ef[_0xd0d4('0x1c')]],'as':_0x1b03ef['as'],'attributes':_0x1b03ef['attributes'],'include':_0x1b03ef['include']?_[_0xd0d4('0x1b')](_0x1b03ef['include'],function(_0x50e7f0){return{'model':db[_0x50e7f0[_0xd0d4('0x1c')]],'as':_0x50e7f0['as'],'attributes':_0x50e7f0[_0xd0d4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd0d4('0xb')](function(_0x320efe){logger['info'](_0xd0d4('0x1e'),_0x5cf4c6);logger[_0xd0d4('0xe')](_0xd0d4('0x1e'),_0x5cf4c6,JSON[_0xd0d4('0x10')](_0x320efe));_0x407cda(_0x320efe);})[_0xd0d4('0x1f')](function(_0xefce4f){logger[_0xd0d4('0x11')](_0xd0d4('0x1e'),_0xefce4f[_0xd0d4('0x14')],_0x5cf4c6);_0x1e46db(_0x5eb5e4['error'](0x1f4,_0xefce4f[_0xd0d4('0x14')]));});});};exports[_0xd0d4('0x20')]=function(_0x192f43){var _0x18096a=this;return new Promise(function(_0x2ea5d9,_0x198991){return db['MemberReport']['create'](_0x192f43[_0xd0d4('0x21')],{'raw':_0x192f43['options']?_0x192f43[_0xd0d4('0x17')][_0xd0d4('0x22')]===undefined?!![]:![]:!![]})[_0xd0d4('0xb')](function(_0x446763){logger[_0xd0d4('0xc')](_0xd0d4('0x20'),_0x192f43);logger[_0xd0d4('0xe')]('CreateMemberReport',_0x192f43,JSON['stringify'](_0x446763));_0x2ea5d9(_0x446763);})[_0xd0d4('0x1f')](function(_0x161d17){logger['error'](_0xd0d4('0x20'),_0x161d17['message'],_0x192f43);_0x198991(_0x18096a['error'](0x1f4,_0x161d17[_0xd0d4('0x14')]));});});};exports[_0xd0d4('0x23')]=function(_0x3fd1b1){var _0x26a080=this;return new Promise(function(_0x5011dd,_0x47e4c5){return db[_0xd0d4('0x16')][_0xd0d4('0x24')](_0x3fd1b1[_0xd0d4('0x21')],{'raw':_0x3fd1b1['options']?_0x3fd1b1[_0xd0d4('0x17')][_0xd0d4('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fd1b1[_0xd0d4('0x17')]?_0x3fd1b1[_0xd0d4('0x17')][_0xd0d4('0x18')]||null:null,'attributes':_0x3fd1b1[_0xd0d4('0x17')]?_0x3fd1b1[_0xd0d4('0x17')][_0xd0d4('0x1d')]||null:null,'limit':_0x3fd1b1['options']?_0x3fd1b1[_0xd0d4('0x17')]['limit']||null:null})['then'](function(_0x29434a){logger['info'](_0xd0d4('0x23'),_0x3fd1b1);logger[_0xd0d4('0xe')](_0xd0d4('0x23'),_0x3fd1b1,JSON[_0xd0d4('0x10')](_0x29434a));_0x5011dd(_0x29434a);})[_0xd0d4('0x1f')](function(_0x3b24c8){logger['error'](_0xd0d4('0x23'),_0x3b24c8[_0xd0d4('0x14')],_0x3fd1b1);_0x47e4c5(_0x26a080['error'](0x1f4,_0x3b24c8['message']));});});}; \ No newline at end of file +var _0x00cd=['info','result','catch','GetMemberReport','MemberReport','options','raw','where','limit','include','model','attributes','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x23e0fd,_0x9765e2){var _0xa76872=function(_0xe2e03){while(--_0xe2e03){_0x23e0fd['push'](_0x23e0fd['shift']());}};_0xa76872(++_0x9765e2);}(_0x00cd,0xee));var _0xd00c=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0x00cd[_0x4d337e];return _0x247963;};'use strict';var _=require(_0xd00c('0x0'));var util=require(_0xd00c('0x1'));var moment=require(_0xd00c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd00c('0x3'));var db=require(_0xd00c('0x4'))['db'];var utils=require(_0xd00c('0x5'));var logger=require(_0xd00c('0x6'))(_0xd00c('0x7'));var config=require('../../config/environment');var jayson=require(_0xd00c('0x8'));var client=jayson[_0xd00c('0x9')][_0xd00c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6af060,_0x32bead,_0x751801){return new BPromise(function(_0x40c5ad,_0x11092f){return client[_0xd00c('0xb')](_0x6af060,_0x751801)[_0xd00c('0xc')](function(_0x51a639){logger['info'](_0xd00c('0xd'),_0x32bead,_0xd00c('0xe'));logger[_0xd00c('0xf')](_0xd00c('0x10'),_0x32bead,'request\x20sent',JSON[_0xd00c('0x11')](_0x51a639));if(_0x51a639['error']){if(_0x51a639[_0xd00c('0x12')][_0xd00c('0x13')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x32bead,_0x51a639['error']['message']);return _0x11092f(_0x51a639[_0xd00c('0x12')][_0xd00c('0x14')]);}logger[_0xd00c('0x12')]('MemberReport,\x20%s,\x20%s',_0x32bead,_0x51a639[_0xd00c('0x12')]['message']);return _0x40c5ad(_0x51a639[_0xd00c('0x12')][_0xd00c('0x14')]);}else{logger[_0xd00c('0x15')]('MemberReport,\x20%s,\x20%s',_0x32bead,'request\x20sent');_0x40c5ad(_0x51a639[_0xd00c('0x16')][_0xd00c('0x14')]);}})[_0xd00c('0x17')](function(_0x1d7728){logger[_0xd00c('0x12')](_0xd00c('0xd'),_0x32bead,_0x1d7728);_0x11092f(_0x1d7728);});});}exports[_0xd00c('0x18')]=function(_0x3864a9){var _0x4e21ac=this;return new Promise(function(_0x2b167a,_0x2b5243){return db[_0xd00c('0x19')]['findAll']({'raw':_0x3864a9['options']?_0x3864a9[_0xd00c('0x1a')][_0xd00c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3864a9[_0xd00c('0x1a')]?_0x3864a9[_0xd00c('0x1a')][_0xd00c('0x1c')]||null:null,'attributes':_0x3864a9[_0xd00c('0x1a')]?_0x3864a9[_0xd00c('0x1a')]['attributes']||null:null,'limit':_0x3864a9[_0xd00c('0x1a')]?_0x3864a9[_0xd00c('0x1a')][_0xd00c('0x1d')]||null:null,'include':_0x3864a9[_0xd00c('0x1a')]?_0x3864a9[_0xd00c('0x1a')]['include']?_['map'](_0x3864a9[_0xd00c('0x1a')][_0xd00c('0x1e')],function(_0x5bcf19){return{'model':db[_0x5bcf19['model']],'as':_0x5bcf19['as'],'attributes':_0x5bcf19['attributes'],'include':_0x5bcf19[_0xd00c('0x1e')]?_['map'](_0x5bcf19[_0xd00c('0x1e')],function(_0x4a918f){return{'model':db[_0x4a918f[_0xd00c('0x1f')]],'as':_0x4a918f['as'],'attributes':_0x4a918f[_0xd00c('0x20')],'include':_0x4a918f['include']?_['map'](_0x4a918f[_0xd00c('0x1e')],function(_0x32e998){return{'model':db[_0x32e998[_0xd00c('0x1f')]],'as':_0x32e998['as'],'attributes':_0x32e998[_0xd00c('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f8853){logger[_0xd00c('0x15')](_0xd00c('0x18'),_0x3864a9);logger[_0xd00c('0xf')]('GetMemberReport',_0x3864a9,JSON[_0xd00c('0x11')](_0x2f8853));_0x2b167a(_0x2f8853);})['catch'](function(_0x3e7e2c){logger[_0xd00c('0x12')](_0xd00c('0x18'),_0x3e7e2c[_0xd00c('0x14')],_0x3864a9);_0x2b5243(_0x4e21ac[_0xd00c('0x12')](0x1f4,_0x3e7e2c[_0xd00c('0x14')]));});});};exports[_0xd00c('0x21')]=function(_0x2a4fa4){var _0x1345dd=this;return new Promise(function(_0x4ad9b0,_0x12759f){return db[_0xd00c('0x19')][_0xd00c('0x22')](_0x2a4fa4[_0xd00c('0x23')],{'raw':_0x2a4fa4[_0xd00c('0x1a')]?_0x2a4fa4[_0xd00c('0x1a')][_0xd00c('0x1b')]===undefined?!![]:![]:!![]})[_0xd00c('0xc')](function(_0x4af28e){logger['info'](_0xd00c('0x21'),_0x2a4fa4);logger['debug'](_0xd00c('0x21'),_0x2a4fa4,JSON[_0xd00c('0x11')](_0x4af28e));_0x4ad9b0(_0x4af28e);})[_0xd00c('0x17')](function(_0x1af90a){logger[_0xd00c('0x12')]('CreateMemberReport',_0x1af90a[_0xd00c('0x14')],_0x2a4fa4);_0x12759f(_0x1345dd[_0xd00c('0x12')](0x1f4,_0x1af90a['message']));});});};exports[_0xd00c('0x24')]=function(_0x400ca1){var _0xd3ce8b=this;return new Promise(function(_0x183207,_0x217867){return db[_0xd00c('0x19')]['update'](_0x400ca1[_0xd00c('0x23')],{'raw':_0x400ca1['options']?_0x400ca1[_0xd00c('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x400ca1['options']?_0x400ca1['options'][_0xd00c('0x1c')]||null:null,'attributes':_0x400ca1[_0xd00c('0x1a')]?_0x400ca1[_0xd00c('0x1a')]['attributes']||null:null,'limit':_0x400ca1[_0xd00c('0x1a')]?_0x400ca1[_0xd00c('0x1a')][_0xd00c('0x1d')]||null:null})['then'](function(_0x3ffd0a){logger[_0xd00c('0x15')](_0xd00c('0x24'),_0x400ca1);logger[_0xd00c('0xf')](_0xd00c('0x24'),_0x400ca1,JSON[_0xd00c('0x11')](_0x3ffd0a));_0x183207(_0x3ffd0a);})[_0xd00c('0x17')](function(_0x324f7a){logger[_0xd00c('0x12')](_0xd00c('0x24'),_0x324f7a['message'],_0x400ca1);_0x217867(_0xd3ce8b[_0xd00c('0x12')](0x1f4,_0x324f7a[_0xd00c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 04a0a16..6657b36 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 _0x12ff=['fs-extra','../../components/auth/service','../../config/environment','./migration.controller','index','util','connect-timeout','express'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x12ff,0x165));var _0xf12f=function(_0x2ff359,_0x173237){_0x2ff359=_0x2ff359-0x0;var _0x15df72=_0x12ff[_0x2ff359];return _0x15df72;};'use strict';var multer=require('multer');var util=require(_0xf12f('0x0'));var path=require('path');var timeout=require(_0xf12f('0x1'));var express=require(_0xf12f('0x2'));var router=express['Router']();var fs_extra=require(_0xf12f('0x3'));var auth=require(_0xf12f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf12f('0x5'));var controller=require(_0xf12f('0x6'));router['get']('/',controller[_0xf12f('0x7')]);module['exports']=router; \ No newline at end of file +var _0xd983=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','express','Router'];(function(_0x3eb4a9,_0x359d73){var _0x48dbad=function(_0x3a3ca6){while(--_0x3a3ca6){_0x3eb4a9['push'](_0x3eb4a9['shift']());}};_0x48dbad(++_0x359d73);}(_0xd983,0x7d));var _0x3d98=function(_0x41fde2,_0x179e55){_0x41fde2=_0x41fde2-0x0;var _0x31a386=_0xd983[_0x41fde2];return _0x31a386;};'use strict';var multer=require(_0x3d98('0x0'));var util=require(_0x3d98('0x1'));var path=require(_0x3d98('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d98('0x3'));var router=express[_0x3d98('0x4')]();var fs_extra=require(_0x3d98('0x5'));var auth=require(_0x3d98('0x6'));var interaction=require(_0x3d98('0x7'));var config=require(_0x3d98('0x8'));var controller=require(_0x3d98('0x9'));router[_0x3d98('0xa')]('/',controller[_0x3d98('0xb')]);module[_0x3d98('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 62971d6..d49e8bd 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 _0x7a54=['STRING','version','sequelize','exports'];(function(_0x1a813e,_0x341d1c){var _0x3fae84=function(_0x5d0ad4){while(--_0x5d0ad4){_0x1a813e['push'](_0x1a813e['shift']());}};_0x3fae84(++_0x341d1c);}(_0x7a54,0x96));var _0x47a5=function(_0x36515d,_0x15741d){_0x36515d=_0x36515d-0x0;var _0x18dc18=_0x7a54[_0x36515d];return _0x18dc18;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'version':{'type':Sequelize[_0x47a5('0x2')],'unique':_0x47a5('0x3')}}; \ No newline at end of file +var _0xb9aa=['exports','STRING','version'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xb9aa,0x111));var _0xab9a=function(_0x485bdb,_0x1f64e6){_0x485bdb=_0x485bdb-0x0;var _0x2848c4=_0xb9aa[_0x485bdb];return _0x2848c4;};'use strict';var Sequelize=require('sequelize');module[_0xab9a('0x0')]={'version':{'type':Sequelize[_0xab9a('0x1')],'unique':_0xab9a('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index c2c8676..d8a0866 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 _0x5fdd=['includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','Content-Range','apply','save','update','then','destroy','status','error','stack','name','send','Migration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x5fdd,0xd1));var _0xd5fd=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x5fdd[_0x445101];return _0x3c3d04;};'use strict';var emlformat=require(_0xd5fd('0x0'));var rimraf=require(_0xd5fd('0x1'));var zipdir=require(_0xd5fd('0x2'));var jsonpatch=require(_0xd5fd('0x3'));var rp=require('request-promise');var moment=require(_0xd5fd('0x4'));var BPromise=require(_0xd5fd('0x5'));var Mustache=require('mustache');var util=require(_0xd5fd('0x6'));var path=require(_0xd5fd('0x7'));var sox=require(_0xd5fd('0x8'));var csv=require(_0xd5fd('0x9'));var ejs=require(_0xd5fd('0xa'));var fs=require('fs');var fs_extra=require(_0xd5fd('0xb'));var _=require(_0xd5fd('0xc'));var squel=require('squel');var crypto=require(_0xd5fd('0xd'));var jsforce=require(_0xd5fd('0xe'));var deskjs=require(_0xd5fd('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd5fd('0x10'));var Papa=require(_0xd5fd('0x11'));var Redis=require('ioredis');var authService=require(_0xd5fd('0x12'));var qs=require(_0xd5fd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5fd('0x14'))(_0xd5fd('0x15'));var utils=require(_0xd5fd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd5fd('0x17'));var db=require(_0xd5fd('0x18'))['db'];function respondWithStatusCode(_0x14a6f2,_0x6a27ff){_0x6a27ff=_0x6a27ff||0xcc;return function(_0x2a34d7){if(_0x2a34d7){return _0x14a6f2[_0xd5fd('0x19')](_0x6a27ff);}return _0x14a6f2['status'](_0x6a27ff)[_0xd5fd('0x1a')]();};}function respondWithResult(_0xc9e279,_0x98fc68){_0x98fc68=_0x98fc68||0xc8;return function(_0x4f1c8e){if(_0x4f1c8e){return _0xc9e279['status'](_0x98fc68)[_0xd5fd('0x1b')](_0x4f1c8e);}};}function respondWithFilteredResult(_0x2e90fa,_0x554374){return function(_0x5b5a75){if(_0x5b5a75){var _0x19f1ff=typeof _0x554374[_0xd5fd('0x1c')]==='undefined'&&typeof _0x554374[_0xd5fd('0x1d')]==='undefined';var _0x4d5747=_0x5b5a75[_0xd5fd('0x1e')];var _0x2e9cc5=_0x19f1ff?0x0:_0x554374[_0xd5fd('0x1c')];var _0x1ca650=_0x19f1ff?_0x5b5a75[_0xd5fd('0x1e')]:_0x554374[_0xd5fd('0x1c')]+_0x554374[_0xd5fd('0x1d')];var _0x3508d0;if(_0x1ca650>=_0x4d5747){_0x1ca650=_0x4d5747;_0x3508d0=0xc8;}else{_0x3508d0=0xce;}_0x2e90fa['status'](_0x3508d0);return _0x2e90fa['set'](_0xd5fd('0x1f'),_0x2e9cc5+'-'+_0x1ca650+'/'+_0x4d5747)[_0xd5fd('0x1b')](_0x5b5a75);}return null;};}function patchUpdates(_0x3a3b3b){return function(_0x5610e8){try{jsonpatch[_0xd5fd('0x20')](_0x5610e8,_0x3a3b3b,!![]);}catch(_0x18cd8b){return BPromise['reject'](_0x18cd8b);}return _0x5610e8[_0xd5fd('0x21')]();};}function saveUpdates(_0xb1e615,_0x4f5f31){return function(_0x3846ab){if(_0x3846ab){return _0x3846ab[_0xd5fd('0x22')](_0xb1e615)[_0xd5fd('0x23')](function(_0x44dc95){return _0x44dc95;});}return null;};}function removeEntity(_0x157fcb,_0x510586){return function(_0x1b04a4){if(_0x1b04a4){return _0x1b04a4[_0xd5fd('0x24')]()[_0xd5fd('0x23')](function(){_0x157fcb[_0xd5fd('0x25')](0xcc)[_0xd5fd('0x1a')]();});}};}function handleEntityNotFound(_0x5b4b23,_0x24e6c8){return function(_0x58f321){if(!_0x58f321){_0x5b4b23[_0xd5fd('0x19')](0x194);}return _0x58f321;};}function handleError(_0x14154a,_0x5de075){_0x5de075=_0x5de075||0x1f4;return function(_0x2c5ffe){logger[_0xd5fd('0x26')](_0x2c5ffe[_0xd5fd('0x27')]);if(_0x2c5ffe['name']){delete _0x2c5ffe[_0xd5fd('0x28')];}_0x14154a['status'](_0x5de075)[_0xd5fd('0x29')](_0x2c5ffe);};}exports['index']=function(_0x17f01a,_0x40cf8f){var _0xb263ab={},_0xc3ea69={},_0x1d730a={'count':0x0,'rows':[]};var _0x566b5f=_['map'](db[_0xd5fd('0x2a')][_0xd5fd('0x2b')],function(_0x183e76){return{'name':_0x183e76[_0xd5fd('0x2c')],'type':_0x183e76[_0xd5fd('0x2d')][_0xd5fd('0x2e')]};});_0xc3ea69[_0xd5fd('0x2f')]=_['map'](_0x566b5f,'name');_0xc3ea69[_0xd5fd('0x30')]=_[_0xd5fd('0x31')](_0x17f01a['query']);_0xc3ea69['filters']=_[_0xd5fd('0x32')](_0xc3ea69[_0xd5fd('0x2f')],_0xc3ea69['query']);_0xb263ab[_0xd5fd('0x33')]=_[_0xd5fd('0x32')](_0xc3ea69[_0xd5fd('0x2f')],qs['fields'](_0x17f01a[_0xd5fd('0x30')][_0xd5fd('0x34')]));_0xb263ab[_0xd5fd('0x33')]=_0xb263ab[_0xd5fd('0x33')]['length']?_0xb263ab[_0xd5fd('0x33')]:_0xc3ea69['model'];if(!_0x17f01a[_0xd5fd('0x30')][_0xd5fd('0x35')](_0xd5fd('0x36'))){_0xb263ab['limit']=qs[_0xd5fd('0x1d')](_0x17f01a[_0xd5fd('0x30')][_0xd5fd('0x1d')]);_0xb263ab['offset']=qs[_0xd5fd('0x1c')](_0x17f01a['query']['offset']);}_0xb263ab[_0xd5fd('0x37')]=qs[_0xd5fd('0x38')](_0x17f01a['query'][_0xd5fd('0x38')]);_0xb263ab[_0xd5fd('0x39')]=qs[_0xd5fd('0x3a')](_[_0xd5fd('0x3b')](_0x17f01a[_0xd5fd('0x30')],_0xc3ea69['filters']),_0x566b5f);if(_0x17f01a['query'][_0xd5fd('0x3c')]){_0xb263ab['where']=_['merge'](_0xb263ab['where'],{'$or':_[_0xd5fd('0x3d')](_0x566b5f,function(_0x2699b8){if(_0x2699b8['type']!==_0xd5fd('0x3e')){var _0x4fa48e={};_0x4fa48e[_0x2699b8[_0xd5fd('0x28')]]={'$like':'%'+_0x17f01a['query']['filter']+'%'};return _0x4fa48e;}})});}_0xb263ab=_['merge']({},_0xb263ab,_0x17f01a['options']);var _0x1f757={'where':_0xb263ab[_0xd5fd('0x39')]};return db['Migration'][_0xd5fd('0x1e')](_0x1f757)[_0xd5fd('0x23')](function(_0x2493ae){_0x1d730a[_0xd5fd('0x1e')]=_0x2493ae;if(_0x17f01a[_0xd5fd('0x30')][_0xd5fd('0x3f')]){_0xb263ab[_0xd5fd('0x40')]=[{'all':!![]}];}return db[_0xd5fd('0x2a')][_0xd5fd('0x41')](_0xb263ab);})[_0xd5fd('0x23')](function(_0x13bb7a){_0x1d730a[_0xd5fd('0x42')]=_0x13bb7a;return _0x1d730a;})[_0xd5fd('0x23')](respondWithFilteredResult(_0x40cf8f,_0xb263ab))[_0xd5fd('0x43')](handleError(_0x40cf8f,null));}; \ No newline at end of file +var _0x1895=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','end','offset','limit','undefined','count','Content-Range','apply','update','then','sendStatus','error','stack','status','send','index','map','Migration','fieldName','key','model','name','keys','query','filters'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0x1895,0x111));var _0x5189=function(_0x401f01,_0x4e0b18){_0x401f01=_0x401f01-0x0;var _0x2be648=_0x1895[_0x401f01];return _0x2be648;};'use strict';var emlformat=require(_0x5189('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5189('0x1'));var rp=require(_0x5189('0x2'));var moment=require(_0x5189('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5189('0x4'));var util=require('util');var path=require(_0x5189('0x5'));var sox=require(_0x5189('0x6'));var csv=require('to-csv');var ejs=require(_0x5189('0x7'));var fs=require('fs');var fs_extra=require(_0x5189('0x8'));var _=require(_0x5189('0x9'));var squel=require(_0x5189('0xa'));var crypto=require(_0x5189('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5189('0xc'));var toCsv=require(_0x5189('0xd'));var querystring=require(_0x5189('0xe'));var Papa=require(_0x5189('0xf'));var Redis=require('ioredis');var authService=require(_0x5189('0x10'));var qs=require(_0x5189('0x11'));var as=require(_0x5189('0x12'));var hardwareService=require(_0x5189('0x13'));var logger=require(_0x5189('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5189('0x15'));var licenseUtil=require(_0x5189('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x488e75,_0x1df281){_0x1df281=_0x1df281||0xcc;return function(_0x43be93){if(_0x43be93){return _0x488e75['sendStatus'](_0x1df281);}return _0x488e75['status'](_0x1df281)[_0x5189('0x17')]();};}function respondWithResult(_0x4409d8,_0x95338b){_0x95338b=_0x95338b||0xc8;return function(_0x170466){if(_0x170466){return _0x4409d8['status'](_0x95338b)['json'](_0x170466);}};}function respondWithFilteredResult(_0x3be70d,_0x44f73c){return function(_0x119dbf){if(_0x119dbf){var _0x3f7d16=typeof _0x44f73c[_0x5189('0x18')]==='undefined'&&typeof _0x44f73c[_0x5189('0x19')]===_0x5189('0x1a');var _0x1a1262=_0x119dbf[_0x5189('0x1b')];var _0x2ba964=_0x3f7d16?0x0:_0x44f73c[_0x5189('0x18')];var _0x1211cb=_0x3f7d16?_0x119dbf[_0x5189('0x1b')]:_0x44f73c[_0x5189('0x18')]+_0x44f73c[_0x5189('0x19')];var _0x5c57af;if(_0x1211cb>=_0x1a1262){_0x1211cb=_0x1a1262;_0x5c57af=0xc8;}else{_0x5c57af=0xce;}_0x3be70d['status'](_0x5c57af);return _0x3be70d['set'](_0x5189('0x1c'),_0x2ba964+'-'+_0x1211cb+'/'+_0x1a1262)['json'](_0x119dbf);}return null;};}function patchUpdates(_0x2a3040){return function(_0x3ba344){try{jsonpatch[_0x5189('0x1d')](_0x3ba344,_0x2a3040,!![]);}catch(_0x4c698){return BPromise['reject'](_0x4c698);}return _0x3ba344['save']();};}function saveUpdates(_0x49e262,_0x87bf5c){return function(_0x52e5af){if(_0x52e5af){return _0x52e5af[_0x5189('0x1e')](_0x49e262)['then'](function(_0x3e069c){return _0x3e069c;});}return null;};}function removeEntity(_0x5691a5,_0x283278){return function(_0x2b5576){if(_0x2b5576){return _0x2b5576['destroy']()[_0x5189('0x1f')](function(){_0x5691a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa313e5,_0x50233e){return function(_0x2abd93){if(!_0x2abd93){_0xa313e5[_0x5189('0x20')](0x194);}return _0x2abd93;};}function handleError(_0x8308f5,_0x49d677){_0x49d677=_0x49d677||0x1f4;return function(_0x54fe7c){logger[_0x5189('0x21')](_0x54fe7c[_0x5189('0x22')]);if(_0x54fe7c['name']){delete _0x54fe7c['name'];}_0x8308f5[_0x5189('0x23')](_0x49d677)[_0x5189('0x24')](_0x54fe7c);};}exports[_0x5189('0x25')]=function(_0x55101f,_0x474fd6){var _0x40fba4={},_0x289b94={},_0x51debd={'count':0x0,'rows':[]};var _0xbef7c5=_[_0x5189('0x26')](db[_0x5189('0x27')]['rawAttributes'],function(_0x343cfb){return{'name':_0x343cfb[_0x5189('0x28')],'type':_0x343cfb['type'][_0x5189('0x29')]};});_0x289b94[_0x5189('0x2a')]=_[_0x5189('0x26')](_0xbef7c5,_0x5189('0x2b'));_0x289b94['query']=_[_0x5189('0x2c')](_0x55101f[_0x5189('0x2d')]);_0x289b94[_0x5189('0x2e')]=_[_0x5189('0x2f')](_0x289b94[_0x5189('0x2a')],_0x289b94[_0x5189('0x2d')]);_0x40fba4[_0x5189('0x30')]=_[_0x5189('0x2f')](_0x289b94[_0x5189('0x2a')],qs[_0x5189('0x31')](_0x55101f[_0x5189('0x2d')][_0x5189('0x31')]));_0x40fba4[_0x5189('0x30')]=_0x40fba4[_0x5189('0x30')]['length']?_0x40fba4[_0x5189('0x30')]:_0x289b94[_0x5189('0x2a')];if(!_0x55101f[_0x5189('0x2d')][_0x5189('0x32')](_0x5189('0x33'))){_0x40fba4[_0x5189('0x19')]=qs[_0x5189('0x19')](_0x55101f[_0x5189('0x2d')][_0x5189('0x19')]);_0x40fba4[_0x5189('0x18')]=qs[_0x5189('0x18')](_0x55101f[_0x5189('0x2d')]['offset']);}_0x40fba4['order']=qs[_0x5189('0x34')](_0x55101f[_0x5189('0x2d')][_0x5189('0x34')]);_0x40fba4[_0x5189('0x35')]=qs['filters'](_[_0x5189('0x36')](_0x55101f[_0x5189('0x2d')],_0x289b94['filters']),_0xbef7c5);if(_0x55101f[_0x5189('0x2d')]['filter']){_0x40fba4[_0x5189('0x35')]=_[_0x5189('0x37')](_0x40fba4[_0x5189('0x35')],{'$or':_['map'](_0xbef7c5,function(_0x5afa23){if(_0x5afa23['type']!==_0x5189('0x38')){var _0x480279={};_0x480279[_0x5afa23[_0x5189('0x2b')]]={'$like':'%'+_0x55101f[_0x5189('0x2d')][_0x5189('0x39')]+'%'};return _0x480279;}})});}_0x40fba4=_[_0x5189('0x37')]({},_0x40fba4,_0x55101f[_0x5189('0x3a')]);var _0x3629da={'where':_0x40fba4[_0x5189('0x35')]};return db['Migration'][_0x5189('0x1b')](_0x3629da)[_0x5189('0x1f')](function(_0x1a17ad){_0x51debd[_0x5189('0x1b')]=_0x1a17ad;if(_0x55101f[_0x5189('0x2d')][_0x5189('0x3b')]){_0x40fba4[_0x5189('0x3c')]=[{'all':!![]}];}return db['Migration'][_0x5189('0x3d')](_0x40fba4);})[_0x5189('0x1f')](function(_0x5ea52d){_0x51debd[_0x5189('0x3e')]=_0x5ea52d;return _0x51debd;})[_0x5189('0x1f')](respondWithFilteredResult(_0x474fd6,_0x40fba4))[_0x5189('0x3f')](handleError(_0x474fd6,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index cfe5d0f..9ad624d 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 _0xd586=['api','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger'];(function(_0x3434a2,_0xe3c256){var _0x58b35d=function(_0x39893d){while(--_0x39893d){_0x3434a2['push'](_0x3434a2['shift']());}};_0x58b35d(++_0xe3c256);}(_0xd586,0xc1));var _0x6d58=function(_0x58f36f,_0x3f8bda){_0x58f36f=_0x58f36f-0x0;var _0x50115e=_0xd586[_0x58f36f];return _0x50115e;};'use strict';var _=require(_0x6d58('0x0'));var util=require(_0x6d58('0x1'));var logger=require(_0x6d58('0x2'))(_0x6d58('0x3'));var moment=require('moment');var BPromise=require(_0x6d58('0x4'));var rp=require(_0x6d58('0x5'));var fs=require('fs');var path=require(_0x6d58('0x6'));var rimraf=require(_0x6d58('0x7'));var config=require(_0x6d58('0x8'));var attributes=require(_0x6d58('0x9'));module[_0x6d58('0xa')]=function(_0x109126,_0x59b565){return _0x109126[_0x6d58('0xb')](_0x6d58('0xc'),attributes,{'tableName':_0x6d58('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6749=['moment','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger'];(function(_0x24bec0,_0x15707f){var _0x358562=function(_0x37c7af){while(--_0x37c7af){_0x24bec0['push'](_0x24bec0['shift']());}};_0x358562(++_0x15707f);}(_0x6749,0x19d));var _0x9674=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6749[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9674('0x0'));var util=require(_0x9674('0x1'));var logger=require(_0x9674('0x2'))('api');var moment=require(_0x9674('0x3'));var BPromise=require(_0x9674('0x4'));var rp=require(_0x9674('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9674('0x6'));var config=require(_0x9674('0x7'));var attributes=require(_0x9674('0x8'));module[_0x9674('0x9')]=function(_0x601b95,_0x229f4f){return _0x601b95[_0x9674('0xa')](_0x9674('0xb'),attributes,{'tableName':_0x9674('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 8f51345..8c5b7d4 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 _0x9780=['request\x20sent','Migration,\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','request','then','info','Migration,\x20%s,\x20%s'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x9780,0x1d4));var _0x0978=function(_0x3e130f,_0x309c01){_0x3e130f=_0x3e130f-0x0;var _0xf4d530=_0x9780[_0x3e130f];return _0xf4d530;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0978('0x0'));var BPromise=require(_0x0978('0x1'));var rs=require(_0x0978('0x2'));var fs=require('fs');var Redis=require(_0x0978('0x3'));var db=require(_0x0978('0x4'))['db'];var utils=require(_0x0978('0x5'));var logger=require(_0x0978('0x6'))(_0x0978('0x7'));var config=require(_0x0978('0x8'));var jayson=require(_0x0978('0x9'));var client=jayson[_0x0978('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x422038,_0xdb9e6c,_0x3e4d16){return new BPromise(function(_0xefd03b,_0x34fe92){return client[_0x0978('0xb')](_0x422038,_0x3e4d16)[_0x0978('0xc')](function(_0x34081e){logger[_0x0978('0xd')](_0x0978('0xe'),_0xdb9e6c,_0x0978('0xf'));logger['debug'](_0x0978('0x10'),_0xdb9e6c,'request\x20sent',JSON[_0x0978('0x11')](_0x34081e));if(_0x34081e[_0x0978('0x12')]){if(_0x34081e[_0x0978('0x12')][_0x0978('0x13')]===0x1f4){logger['error'](_0x0978('0xe'),_0xdb9e6c,_0x34081e['error'][_0x0978('0x14')]);return _0x34fe92(_0x34081e[_0x0978('0x12')][_0x0978('0x14')]);}logger[_0x0978('0x12')](_0x0978('0xe'),_0xdb9e6c,_0x34081e[_0x0978('0x12')][_0x0978('0x14')]);return _0xefd03b(_0x34081e[_0x0978('0x12')]['message']);}else{logger[_0x0978('0xd')](_0x0978('0xe'),_0xdb9e6c,_0x0978('0xf'));_0xefd03b(_0x34081e[_0x0978('0x15')][_0x0978('0x14')]);}})[_0x0978('0x16')](function(_0xb41163){logger[_0x0978('0x12')](_0x0978('0xe'),_0xdb9e6c,_0xb41163);_0x34fe92(_0xb41163);});});} \ No newline at end of file +var _0x0f88=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x0f88,0x1d9));var _0x80f8=function(_0x3588ba,_0x5c49f3){_0x3588ba=_0x3588ba-0x0;var _0x3695a2=_0x0f88[_0x3588ba];return _0x3695a2;};'use strict';var _=require(_0x80f8('0x0'));var util=require(_0x80f8('0x1'));var moment=require(_0x80f8('0x2'));var BPromise=require(_0x80f8('0x3'));var rs=require(_0x80f8('0x4'));var fs=require('fs');var Redis=require(_0x80f8('0x5'));var db=require(_0x80f8('0x6'))['db'];var utils=require(_0x80f8('0x7'));var logger=require('../../config/logger')(_0x80f8('0x8'));var config=require('../../config/environment');var jayson=require(_0x80f8('0x9'));var client=jayson[_0x80f8('0xa')][_0x80f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18cd5e,_0x3db34c,_0x279479){return new BPromise(function(_0x3d6ad3,_0x2bb7aa){return client[_0x80f8('0xc')](_0x18cd5e,_0x279479)[_0x80f8('0xd')](function(_0x26c259){logger[_0x80f8('0xe')](_0x80f8('0xf'),_0x3db34c,_0x80f8('0x10'));logger[_0x80f8('0x11')](_0x80f8('0x12'),_0x3db34c,_0x80f8('0x10'),JSON[_0x80f8('0x13')](_0x26c259));if(_0x26c259[_0x80f8('0x14')]){if(_0x26c259[_0x80f8('0x14')]['code']===0x1f4){logger[_0x80f8('0x14')](_0x80f8('0xf'),_0x3db34c,_0x26c259[_0x80f8('0x14')]['message']);return _0x2bb7aa(_0x26c259[_0x80f8('0x14')][_0x80f8('0x15')]);}logger[_0x80f8('0x14')]('Migration,\x20%s,\x20%s',_0x3db34c,_0x26c259['error']['message']);return _0x3d6ad3(_0x26c259['error'][_0x80f8('0x15')]);}else{logger['info'](_0x80f8('0xf'),_0x3db34c,_0x80f8('0x10'));_0x3d6ad3(_0x26c259[_0x80f8('0x16')][_0x80f8('0x15')]);}})[_0x80f8('0x17')](function(_0x12e53c){logger[_0x80f8('0x14')](_0x80f8('0xf'),_0x3db34c,_0x12e53c);_0x2bb7aa(_0x12e53c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f90d9ce..c314377 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 _0x9199=['./network.controller','get','index','/:id','show','isAuthenticated','put','update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x413032,_0x4f1a47){var _0x548b60=function(_0x55fbcd){while(--_0x55fbcd){_0x413032['push'](_0x413032['shift']());}};_0x548b60(++_0x4f1a47);}(_0x9199,0x1e9));var _0x9919=function(_0x155a36,_0x4bf39){_0x155a36=_0x155a36-0x0;var _0x3c99d0=_0x9199[_0x155a36];return _0x3c99d0;};'use strict';var multer=require(_0x9919('0x0'));var util=require(_0x9919('0x1'));var path=require('path');var timeout=require(_0x9919('0x2'));var express=require('express');var router=express[_0x9919('0x3')]();var fs_extra=require(_0x9919('0x4'));var auth=require(_0x9919('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9919('0x6'));var controller=require(_0x9919('0x7'));router[_0x9919('0x8')]('/',auth['isAuthenticated'](),controller[_0x9919('0x9')]);router[_0x9919('0x8')](_0x9919('0xa'),auth['isAuthenticated'](),controller[_0x9919('0xb')]);router['post']('/',auth[_0x9919('0xc')](),controller['create']);router[_0x9919('0xd')]('/:id',auth[_0x9919('0xc')](),controller[_0x9919('0xe')]);router['delete'](_0x9919('0xa'),auth[_0x9919('0xc')](),controller['destroy']);module[_0x9919('0xf')]=router; \ No newline at end of file +var _0xb758=['show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id'];(function(_0x21233e,_0x2d39c1){var _0x3752c9=function(_0x1201f3){while(--_0x1201f3){_0x21233e['push'](_0x21233e['shift']());}};_0x3752c9(++_0x2d39c1);}(_0xb758,0x14a));var _0x8b75=function(_0x6aad74,_0x32ecf4){_0x6aad74=_0x6aad74-0x0;var _0x5b1c38=_0xb758[_0x6aad74];return _0x5b1c38;};'use strict';var multer=require(_0x8b75('0x0'));var util=require(_0x8b75('0x1'));var path=require(_0x8b75('0x2'));var timeout=require(_0x8b75('0x3'));var express=require('express');var router=express[_0x8b75('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8b75('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b75('0x6'));var controller=require(_0x8b75('0x7'));router['get']('/',auth[_0x8b75('0x8')](),controller[_0x8b75('0x9')]);router[_0x8b75('0xa')](_0x8b75('0xb'),auth[_0x8b75('0x8')](),controller[_0x8b75('0xc')]);router[_0x8b75('0xd')]('/',auth[_0x8b75('0x8')](),controller[_0x8b75('0xe')]);router[_0x8b75('0xf')](_0x8b75('0xb'),auth[_0x8b75('0x8')](),controller['update']);router[_0x8b75('0x10')](_0x8b75('0xb'),auth[_0x8b75('0x8')](),controller[_0x8b75('0x11')]);module[_0x8b75('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2d31ab6..fcaf56b 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 _0xcafa=['exports','localnet','stun','STRING','sequelize'];(function(_0x3036bd,_0x39a050){var _0x2394ae=function(_0xb70c76){while(--_0xb70c76){_0x3036bd['push'](_0x3036bd['shift']());}};_0x2394ae(++_0x39a050);}(_0xcafa,0x185));var _0xacaf=function(_0x1de0a1,_0x2e63db){_0x1de0a1=_0x1de0a1-0x0;var _0x51a5ee=_0xcafa[_0x1de0a1];return _0x51a5ee;};'use strict';var Sequelize=require(_0xacaf('0x0'));module[_0xacaf('0x1')]={'type':{'type':Sequelize['ENUM'](_0xacaf('0x2'),'externip',_0xacaf('0x3'),'turn')},'value':{'type':Sequelize[_0xacaf('0x4')]},'username':{'type':Sequelize[_0xacaf('0x4')]},'password':{'type':Sequelize[_0xacaf('0x4')]}}; \ No newline at end of file +var _0xd8f3=['ENUM','localnet','stun','STRING','exports'];(function(_0xe34243,_0x2744e5){var _0x3db09d=function(_0xeef42b){while(--_0xeef42b){_0xe34243['push'](_0xe34243['shift']());}};_0x3db09d(++_0x2744e5);}(_0xd8f3,0xe0));var _0x3d8f=function(_0x26231c,_0xa8344a){_0x26231c=_0x26231c-0x0;var _0x33e4f4=_0xd8f3[_0x26231c];return _0x33e4f4;};'use strict';var Sequelize=require('sequelize');module[_0x3d8f('0x0')]={'type':{'type':Sequelize[_0x3d8f('0x1')](_0x3d8f('0x2'),'externip',_0x3d8f('0x3'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3d8f('0x4')]},'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 deb3856..4560cf8 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 _0x57e5=['body','findAll','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','toLowerCase','chan_sip.so','find','/etc/asterisk/stun_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','util','ejs','lodash','../../components/parsers/qs','api','../../mysqldb','jayson/promise','http','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Network,\x20%s,\x20%s','catch','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','end','sendStatus','name','send','index','map','Network','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','includeAll','include','params','rawAttributes','create'];(function(_0x313c13,_0x287646){var _0x2c4859=function(_0x4bb463){while(--_0x4bb463){_0x313c13['push'](_0x313c13['shift']());}};_0x2c4859(++_0x287646);}(_0x57e5,0x1bb));var _0x557e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x57e5[_0x243b2f];return _0xcb3c2d;};'use strict';var util=require(_0x557e('0x0'));var path=require('path');var ejs=require(_0x557e('0x1'));var fs=require('fs');var _=require(_0x557e('0x2'));var qs=require(_0x557e('0x3'));var logger=require('../../config/logger')(_0x557e('0x4'));var config=require('../../config/environment');var db=require(_0x557e('0x5'))['db'];var jayson=require(_0x557e('0x6'));var client=jayson['client'][_0x557e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x37ce34,_0x187432,_0x54f880,_0x540c07){return new Promise(function(_0x467866,_0x501825){var _0x237f69=_0x540c07||client;return _0x237f69['request'](_0x37ce34,_0x54f880)['then'](function(_0x3a54b3){logger[_0x557e('0x8')]('Network,\x20%s,\x20%s',_0x187432,_0x557e('0x9'));logger[_0x557e('0xa')](_0x557e('0xb'),_0x187432,_0x557e('0x9'),JSON[_0x557e('0xc')](_0x3a54b3));if(_0x3a54b3[_0x557e('0xd')]){if(_0x3a54b3[_0x557e('0xd')][_0x557e('0xe')]===0x1f4){logger[_0x557e('0xd')]('Network,\x20%s,\x20%s',_0x187432,_0x3a54b3[_0x557e('0xd')][_0x557e('0xf')]);return _0x501825(_0x3a54b3[_0x557e('0xd')][_0x557e('0xf')]);}logger[_0x557e('0xd')]('Network,\x20%s,\x20%s',_0x187432,_0x3a54b3[_0x557e('0xd')][_0x557e('0xf')]);return _0x467866(_0x3a54b3[_0x557e('0xd')]['message']);}else{logger[_0x557e('0x8')](_0x557e('0x10'),_0x187432,'request\x20sent');_0x467866(_0x3a54b3['result'][_0x557e('0xf')]);}})[_0x557e('0x11')](function(_0x25c62e){logger[_0x557e('0xd')](_0x557e('0x10'),_0x187432,_0x25c62e);_0x501825(_0x25c62e);});});}function respondWithResult(_0x6bd164,_0x403678){_0x403678=_0x403678||0xc8;return function(_0x516d28){if(_0x516d28){return _0x6bd164[_0x557e('0x12')](_0x403678)['json'](_0x516d28);}};}function respondWithFilteredResult(_0x19d808,_0x19ba5f){return function(_0x1d857b){if(_0x1d857b){var _0x7788eb=typeof _0x19ba5f[_0x557e('0x13')]===_0x557e('0x14')&&typeof _0x19ba5f['limit']===_0x557e('0x14');var _0xe513d9=_0x1d857b[_0x557e('0x15')];var _0x4ab901=_0x7788eb?0x0:_0x19ba5f[_0x557e('0x13')];var _0x380f28=_0x7788eb?_0x1d857b[_0x557e('0x15')]:_0x19ba5f[_0x557e('0x13')]+_0x19ba5f[_0x557e('0x16')];var _0x13ef0e;if(_0x380f28>=_0xe513d9){_0x380f28=_0xe513d9;_0x13ef0e=0xc8;}else{_0x13ef0e=0xce;}_0x19d808['status'](_0x13ef0e);return _0x19d808[_0x557e('0x17')](_0x557e('0x18'),_0x4ab901+'-'+_0x380f28+'/'+_0xe513d9)[_0x557e('0x19')](_0x1d857b);}return null;};}function saveUpdates(_0x57bbd8){return function(_0x4645c3){if(_0x4645c3){return _0x4645c3[_0x557e('0x1a')](_0x57bbd8)[_0x557e('0x1b')](function(_0x29c71d){return _0x29c71d;});}return null;};}function removeEntity(_0x560524){return function(_0x3209a3){if(_0x3209a3){return _0x3209a3[_0x557e('0x1c')]()[_0x557e('0x1b')](function(){_0x560524[_0x557e('0x12')](0xcc)[_0x557e('0x1d')]();});}};}function handleEntityNotFound(_0x1b86f5){return function(_0x5d9fc0){if(!_0x5d9fc0){_0x1b86f5[_0x557e('0x1e')](0x194);}return _0x5d9fc0;};}function handleError(_0x4f18a0,_0x2c7636){_0x2c7636=_0x2c7636||0x1f4;return function(_0x493018){logger[_0x557e('0xd')](_0x493018['stack']);if(_0x493018[_0x557e('0x1f')]){delete _0x493018[_0x557e('0x1f')];}_0x4f18a0['status'](_0x2c7636)[_0x557e('0x20')](_0x493018);};}exports[_0x557e('0x21')]=function(_0xf9d96c,_0x557501){var _0xc6ab={},_0x51d288={},_0x161fb2={'count':0x0,'rows':[]};var _0x2f7596=_[_0x557e('0x22')](db[_0x557e('0x23')]['rawAttributes'],function(_0x28040d){return{'name':_0x28040d[_0x557e('0x24')],'type':_0x28040d[_0x557e('0x25')][_0x557e('0x26')]};});_0x51d288[_0x557e('0x27')]=_[_0x557e('0x22')](_0x2f7596,_0x557e('0x1f'));_0x51d288['query']=_[_0x557e('0x28')](_0xf9d96c['query']);_0x51d288[_0x557e('0x29')]=_[_0x557e('0x2a')](_0x51d288['model'],_0x51d288[_0x557e('0x2b')]);_0xc6ab['attributes']=_[_0x557e('0x2a')](_0x51d288['model'],qs[_0x557e('0x2c')](_0xf9d96c[_0x557e('0x2b')]['fields']));_0xc6ab[_0x557e('0x2d')]=_0xc6ab[_0x557e('0x2d')][_0x557e('0x2e')]?_0xc6ab[_0x557e('0x2d')]:_0x51d288[_0x557e('0x27')];if(!_0xf9d96c['query'][_0x557e('0x2f')](_0x557e('0x30'))){_0xc6ab[_0x557e('0x16')]=qs[_0x557e('0x16')](_0xf9d96c[_0x557e('0x2b')][_0x557e('0x16')]);_0xc6ab['offset']=qs['offset'](_0xf9d96c[_0x557e('0x2b')]['offset']);}_0xc6ab[_0x557e('0x31')]=qs['sort'](_0xf9d96c[_0x557e('0x2b')][_0x557e('0x32')]);_0xc6ab['where']=qs[_0x557e('0x29')](_[_0x557e('0x33')](_0xf9d96c['query'],_0x51d288['filters']),_0x2f7596);if(_0xf9d96c[_0x557e('0x2b')]['filter']){_0xc6ab['where']=_[_0x557e('0x34')](_0xc6ab[_0x557e('0x35')],{'$or':_['map'](_0x2f7596,function(_0x5dc873){if(_0x5dc873[_0x557e('0x25')]!==_0x557e('0x36')){var _0x3609dd={};_0x3609dd[_0x5dc873[_0x557e('0x1f')]]={'$like':'%'+_0xf9d96c[_0x557e('0x2b')]['filter']+'%'};return _0x3609dd;}})});}_0xc6ab=_[_0x557e('0x34')]({},_0xc6ab,_0xf9d96c[_0x557e('0x37')]);var _0x2bcb1c={'where':_0xc6ab['where']};return db[_0x557e('0x23')]['count'](_0x2bcb1c)['then'](function(_0x3141d0){_0x161fb2[_0x557e('0x15')]=_0x3141d0;if(_0xf9d96c[_0x557e('0x2b')][_0x557e('0x38')]){_0xc6ab[_0x557e('0x39')]=[{'all':!![]}];}return db[_0x557e('0x23')]['findAll'](_0xc6ab);})[_0x557e('0x1b')](function(_0x2a0f57){_0x161fb2['rows']=_0x2a0f57;return _0x161fb2;})['then'](respondWithFilteredResult(_0x557501,_0xc6ab))[_0x557e('0x11')](handleError(_0x557501,null));};exports['show']=function(_0x1ea5a4,_0x39628a){var _0x45662b={'raw':!![],'where':{'id':_0x1ea5a4[_0x557e('0x3a')]['id']}},_0xa99a26={};_0xa99a26[_0x557e('0x27')]=_[_0x557e('0x28')](db[_0x557e('0x23')][_0x557e('0x3b')]);_0xa99a26[_0x557e('0x2b')]=_['keys'](_0x1ea5a4[_0x557e('0x2b')]);_0xa99a26['filters']=_[_0x557e('0x2a')](_0xa99a26[_0x557e('0x27')],_0xa99a26[_0x557e('0x2b')]);_0x45662b[_0x557e('0x2d')]=_[_0x557e('0x2a')](_0xa99a26['model'],qs[_0x557e('0x2c')](_0x1ea5a4[_0x557e('0x2b')][_0x557e('0x2c')]));_0x45662b[_0x557e('0x2d')]=_0x45662b[_0x557e('0x2d')][_0x557e('0x2e')]?_0x45662b['attributes']:_0xa99a26['model'];if(_0x1ea5a4[_0x557e('0x2b')][_0x557e('0x38')]){_0x45662b[_0x557e('0x39')]=[{'all':!![]}];}_0x45662b=_[_0x557e('0x34')]({},_0x45662b,_0x1ea5a4[_0x557e('0x37')]);return db['Network']['find'](_0x45662b)['then'](handleEntityNotFound(_0x39628a,null))[_0x557e('0x1b')](respondWithResult(_0x39628a,null))[_0x557e('0x11')](handleError(_0x39628a,null));};exports['create']=function(_0x1497c5,_0x1b4b43){var _0x1855ac;return db[_0x557e('0x23')][_0x557e('0x3c')](_0x1497c5[_0x557e('0x3d')],{'raw':!![]})[_0x557e('0x1b')](function(_0x52f737){_0x1855ac=_0x52f737;return db[_0x557e('0x23')][_0x557e('0x3e')]({'where':{'type':_0x1497c5[_0x557e('0x3d')][_0x557e('0x25')]},'raw':!![]});})['then'](function(_0x14382a){if(_0x1855ac[_0x557e('0x25')][_0x557e('0x3f')]()==_0x557e('0x40')){var _0x5ee22d=fs[_0x557e('0x41')](path['join'](config[_0x557e('0x42')],_0x557e('0x43')),_0x557e('0x44'));var _0xd1f36f=ejs[_0x557e('0x45')](_0x5ee22d,{'networks':_0x14382a||[]});fs[_0x557e('0x46')]('/etc/asterisk/stun_xcally.conf',_0xd1f36f);return respondWithRpcPromise(_0x557e('0x47'),_0x557e('0x3c'),{'module':_0x557e('0x48')});}else if(_0x1855ac[_0x557e('0x25')][_0x557e('0x3f')]()==_0x557e('0x49')){var _0x3c82e2=fs[_0x557e('0x41')](path[_0x557e('0x4a')](config[_0x557e('0x42')],_0x557e('0x4b')),'utf8');var _0x2537be=ejs['render'](_0x3c82e2,{'networks':_0x14382a||[]});fs[_0x557e('0x46')](_0x557e('0x4c'),_0x2537be);return respondWithRpcPromise(_0x557e('0x47'),_0x557e('0x3c'),{'module':_0x557e('0x48')});}else{var _0x20dc99=fs[_0x557e('0x41')](path[_0x557e('0x4a')](config[_0x557e('0x42')],'server/files/templates/network.ejs'),_0x557e('0x44'));var _0x277064=ejs[_0x557e('0x45')](_0x20dc99,{'networks':_0x14382a||[]});fs[_0x557e('0x46')](util[_0x557e('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x1497c5[_0x557e('0x3d')][_0x557e('0x25')][_0x557e('0x4e')]()),_0x277064);return respondWithRpcPromise(_0x557e('0x47'),'create',{'module':_0x557e('0x4f')});}})['then'](function(){return _0x1855ac;})[_0x557e('0x1b')](respondWithResult(_0x1b4b43,0xc9))['catch'](handleError(_0x1b4b43,null));};exports[_0x557e('0x1a')]=function(_0x5c0c69,_0x57fb6f){var _0x5c2c01;return db[_0x557e('0x23')][_0x557e('0x50')]({'where':{'id':_0x5c0c69[_0x557e('0x3a')]['id']}})[_0x557e('0x1b')](handleEntityNotFound(_0x57fb6f,null))['then'](saveUpdates(_0x5c0c69['body'],null))[_0x557e('0x1b')](function(_0x559690){if(_0x559690){_0x5c2c01=_0x559690;return db[_0x557e('0x23')][_0x557e('0x3e')]({'where':{'type':_0x5c2c01[_0x557e('0x25')]},'raw':!![]});}return null;})['then'](function(_0xeffd2){if(_0x5c2c01[_0x557e('0x25')][_0x557e('0x3f')]()==_0x557e('0x40')){var _0x38ce94=fs[_0x557e('0x41')](path['join'](config['root'],_0x557e('0x43')),'utf8');var _0x4d7cb4=ejs[_0x557e('0x45')](_0x38ce94,{'networks':_0xeffd2||[]});fs['writeFileSync'](_0x557e('0x51'),_0x4d7cb4);return respondWithRpcPromise(_0x557e('0x47'),_0x557e('0x1a'),{'module':_0x557e('0x48')});}else if(_0x5c2c01[_0x557e('0x25')][_0x557e('0x3f')]()=='TURN'){var _0x2a6bc3=fs[_0x557e('0x41')](path['join'](config[_0x557e('0x42')],_0x557e('0x4b')),_0x557e('0x44'));var _0x202b09=ejs[_0x557e('0x45')](_0x2a6bc3,{'networks':_0xeffd2||[]});fs['writeFileSync'](_0x557e('0x4c'),_0x202b09);return respondWithRpcPromise(_0x557e('0x47'),'update',{'module':_0x557e('0x48')});}else{var _0x57f2b2=fs['readFileSync'](path[_0x557e('0x4a')](config['root'],_0x557e('0x52')),_0x557e('0x44'));var _0x2b93ce=ejs[_0x557e('0x45')](_0x57f2b2,{'networks':_0xeffd2||[]});fs[_0x557e('0x46')](util[_0x557e('0x4d')](_0x557e('0x53'),_0x5c0c69[_0x557e('0x3d')][_0x557e('0x25')][_0x557e('0x4e')]()),_0x2b93ce);return respondWithRpcPromise(_0x557e('0x47'),_0x557e('0x1a'),{'module':_0x557e('0x4f')});}})[_0x557e('0x1b')](function(_0x3bb4de){if(_0x3bb4de){return _0x5c2c01;}return null;})[_0x557e('0x1b')](respondWithResult(_0x57fb6f,null))[_0x557e('0x11')](handleError(_0x57fb6f,null));};exports[_0x557e('0x1c')]=function(_0x1dabd2,_0x4188b0){var _0x49282e;return db[_0x557e('0x23')]['find']({'where':{'id':_0x1dabd2['params']['id']}})['then'](function(_0x27c3e5){_0x49282e=_0x27c3e5;return _0x27c3e5;})['then'](handleEntityNotFound(_0x4188b0,null))[_0x557e('0x1b')](removeEntity(_0x4188b0,null))['then'](function(){if(_0x49282e){return db[_0x557e('0x23')][_0x557e('0x3e')]({'where':{'type':_0x49282e[_0x557e('0x25')]},'raw':!![]});}})[_0x557e('0x1b')](function(_0x172ada){if(_0x49282e[_0x557e('0x25')][_0x557e('0x3f')]()==_0x557e('0x40')){var _0x37dfa8=fs[_0x557e('0x41')](path[_0x557e('0x4a')](config[_0x557e('0x42')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x4e33b2=ejs[_0x557e('0x45')](_0x37dfa8,{'networks':_0x172ada||[]});fs[_0x557e('0x46')](_0x557e('0x51'),_0x4e33b2);return respondWithRpcPromise(_0x557e('0x47'),_0x557e('0x1c'),{'module':_0x557e('0x48')});}else if(_0x49282e[_0x557e('0x25')][_0x557e('0x3f')]()==_0x557e('0x49')){var _0x214b94=fs[_0x557e('0x41')](path[_0x557e('0x4a')](config[_0x557e('0x42')],'server/files/templates/turn_multiple.ejs'),_0x557e('0x44'));var _0xc8bcab=ejs[_0x557e('0x45')](_0x214b94,{'networks':_0x172ada||[]});fs['writeFileSync'](_0x557e('0x4c'),_0xc8bcab);return respondWithRpcPromise('Reload',_0x557e('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x12c9d6=fs['readFileSync'](path[_0x557e('0x4a')](config['root'],_0x557e('0x52')),'utf8');var _0x5b304d=ejs['render'](_0x12c9d6,{'networks':_0x172ada||[]});fs['writeFileSync'](util[_0x557e('0x4d')](_0x557e('0x53'),_0x49282e[_0x557e('0x25')][_0x557e('0x4e')]()),_0x5b304d);return respondWithRpcPromise('Reload',_0x557e('0x1c'),{'module':_0x557e('0x4f')});}})['catch'](handleError(_0x4188b0,null));}; \ No newline at end of file +var _0x15a0=['chan_sip.so','util','path','ejs','lodash','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','undefined','limit','count','status','set','update','destroy','end','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Network','includeAll','include','findAll','rows','show','params','find','create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','toUpperCase'];(function(_0x5ad190,_0xd39c9e){var _0x518ed3=function(_0x57f03a){while(--_0x57f03a){_0x5ad190['push'](_0x5ad190['shift']());}};_0x518ed3(++_0xd39c9e);}(_0x15a0,0x1aa));var _0x015a=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x15a0[_0x186d17];return _0x5d4b89;};'use strict';var util=require(_0x015a('0x0'));var path=require(_0x015a('0x1'));var ejs=require(_0x015a('0x2'));var fs=require('fs');var _=require(_0x015a('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x015a('0x4'))(_0x015a('0x5'));var config=require('../../config/environment');var db=require(_0x015a('0x6'))['db'];var jayson=require(_0x015a('0x7'));var client=jayson[_0x015a('0x8')][_0x015a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49f95d,_0x4e3f07,_0x352be2,_0x5639fb){return new Promise(function(_0x39c587,_0x2e4d72){var _0x2e6346=_0x5639fb||client;return _0x2e6346[_0x015a('0xa')](_0x49f95d,_0x352be2)[_0x015a('0xb')](function(_0x1f253f){logger[_0x015a('0xc')](_0x015a('0xd'),_0x4e3f07,_0x015a('0xe'));logger[_0x015a('0xf')](_0x015a('0x10'),_0x4e3f07,_0x015a('0xe'),JSON[_0x015a('0x11')](_0x1f253f));if(_0x1f253f[_0x015a('0x12')]){if(_0x1f253f[_0x015a('0x12')][_0x015a('0x13')]===0x1f4){logger[_0x015a('0x12')](_0x015a('0xd'),_0x4e3f07,_0x1f253f[_0x015a('0x12')][_0x015a('0x14')]);return _0x2e4d72(_0x1f253f[_0x015a('0x12')][_0x015a('0x14')]);}logger[_0x015a('0x12')](_0x015a('0xd'),_0x4e3f07,_0x1f253f[_0x015a('0x12')][_0x015a('0x14')]);return _0x39c587(_0x1f253f[_0x015a('0x12')]['message']);}else{logger[_0x015a('0xc')]('Network,\x20%s,\x20%s',_0x4e3f07,'request\x20sent');_0x39c587(_0x1f253f[_0x015a('0x15')]['message']);}})[_0x015a('0x16')](function(_0x1b919e){logger[_0x015a('0x12')](_0x015a('0xd'),_0x4e3f07,_0x1b919e);_0x2e4d72(_0x1b919e);});});}function respondWithResult(_0x2a89ac,_0x48fbaf){_0x48fbaf=_0x48fbaf||0xc8;return function(_0x299270){if(_0x299270){return _0x2a89ac['status'](_0x48fbaf)[_0x015a('0x17')](_0x299270);}};}function respondWithFilteredResult(_0x4ee227,_0x550146){return function(_0x10b9cb){if(_0x10b9cb){var _0x2a1eed=typeof _0x550146[_0x015a('0x18')]===_0x015a('0x19')&&typeof _0x550146[_0x015a('0x1a')]===_0x015a('0x19');var _0x23435d=_0x10b9cb[_0x015a('0x1b')];var _0xdff349=_0x2a1eed?0x0:_0x550146['offset'];var _0x255d57=_0x2a1eed?_0x10b9cb[_0x015a('0x1b')]:_0x550146[_0x015a('0x18')]+_0x550146[_0x015a('0x1a')];var _0x32c010;if(_0x255d57>=_0x23435d){_0x255d57=_0x23435d;_0x32c010=0xc8;}else{_0x32c010=0xce;}_0x4ee227[_0x015a('0x1c')](_0x32c010);return _0x4ee227[_0x015a('0x1d')]('Content-Range',_0xdff349+'-'+_0x255d57+'/'+_0x23435d)[_0x015a('0x17')](_0x10b9cb);}return null;};}function saveUpdates(_0xea474b){return function(_0x3b2257){if(_0x3b2257){return _0x3b2257[_0x015a('0x1e')](_0xea474b)[_0x015a('0xb')](function(_0x295ec0){return _0x295ec0;});}return null;};}function removeEntity(_0x204ce3){return function(_0x229e40){if(_0x229e40){return _0x229e40[_0x015a('0x1f')]()[_0x015a('0xb')](function(){_0x204ce3[_0x015a('0x1c')](0xcc)[_0x015a('0x20')]();});}};}function handleEntityNotFound(_0x2910d6){return function(_0x7fc1cc){if(!_0x7fc1cc){_0x2910d6['sendStatus'](0x194);}return _0x7fc1cc;};}function handleError(_0x49ae2b,_0x441fcf){_0x441fcf=_0x441fcf||0x1f4;return function(_0x2f1066){logger['error'](_0x2f1066['stack']);if(_0x2f1066[_0x015a('0x21')]){delete _0x2f1066['name'];}_0x49ae2b[_0x015a('0x1c')](_0x441fcf)['send'](_0x2f1066);};}exports['index']=function(_0x5c50a9,_0x18d712){var _0xe831f4={},_0x348114={},_0x53ebc8={'count':0x0,'rows':[]};var _0x1a2544=_[_0x015a('0x22')](db['Network'][_0x015a('0x23')],function(_0x144e57){return{'name':_0x144e57[_0x015a('0x24')],'type':_0x144e57[_0x015a('0x25')][_0x015a('0x26')]};});_0x348114[_0x015a('0x27')]=_[_0x015a('0x22')](_0x1a2544,_0x015a('0x21'));_0x348114[_0x015a('0x28')]=_[_0x015a('0x29')](_0x5c50a9[_0x015a('0x28')]);_0x348114[_0x015a('0x2a')]=_[_0x015a('0x2b')](_0x348114[_0x015a('0x27')],_0x348114[_0x015a('0x28')]);_0xe831f4[_0x015a('0x2c')]=_[_0x015a('0x2b')](_0x348114[_0x015a('0x27')],qs[_0x015a('0x2d')](_0x5c50a9['query'][_0x015a('0x2d')]));_0xe831f4[_0x015a('0x2c')]=_0xe831f4[_0x015a('0x2c')][_0x015a('0x2e')]?_0xe831f4['attributes']:_0x348114['model'];if(!_0x5c50a9[_0x015a('0x28')][_0x015a('0x2f')](_0x015a('0x30'))){_0xe831f4[_0x015a('0x1a')]=qs[_0x015a('0x1a')](_0x5c50a9['query']['limit']);_0xe831f4[_0x015a('0x18')]=qs['offset'](_0x5c50a9[_0x015a('0x28')][_0x015a('0x18')]);}_0xe831f4[_0x015a('0x31')]=qs[_0x015a('0x32')](_0x5c50a9[_0x015a('0x28')][_0x015a('0x32')]);_0xe831f4[_0x015a('0x33')]=qs['filters'](_['pick'](_0x5c50a9['query'],_0x348114[_0x015a('0x2a')]),_0x1a2544);if(_0x5c50a9['query']['filter']){_0xe831f4[_0x015a('0x33')]=_['merge'](_0xe831f4[_0x015a('0x33')],{'$or':_[_0x015a('0x22')](_0x1a2544,function(_0x2bfdd2){if(_0x2bfdd2[_0x015a('0x25')]!=='VIRTUAL'){var _0x4f74d6={};_0x4f74d6[_0x2bfdd2[_0x015a('0x21')]]={'$like':'%'+_0x5c50a9['query'][_0x015a('0x34')]+'%'};return _0x4f74d6;}})});}_0xe831f4=_[_0x015a('0x35')]({},_0xe831f4,_0x5c50a9[_0x015a('0x36')]);var _0x550e9f={'where':_0xe831f4['where']};return db[_0x015a('0x37')][_0x015a('0x1b')](_0x550e9f)[_0x015a('0xb')](function(_0x1d64c3){_0x53ebc8[_0x015a('0x1b')]=_0x1d64c3;if(_0x5c50a9[_0x015a('0x28')][_0x015a('0x38')]){_0xe831f4[_0x015a('0x39')]=[{'all':!![]}];}return db[_0x015a('0x37')][_0x015a('0x3a')](_0xe831f4);})['then'](function(_0x43f0fc){_0x53ebc8[_0x015a('0x3b')]=_0x43f0fc;return _0x53ebc8;})[_0x015a('0xb')](respondWithFilteredResult(_0x18d712,_0xe831f4))[_0x015a('0x16')](handleError(_0x18d712,null));};exports[_0x015a('0x3c')]=function(_0x5ddd94,_0x3a4dce){var _0x484051={'raw':!![],'where':{'id':_0x5ddd94[_0x015a('0x3d')]['id']}},_0x30db32={};_0x30db32['model']=_[_0x015a('0x29')](db[_0x015a('0x37')]['rawAttributes']);_0x30db32['query']=_[_0x015a('0x29')](_0x5ddd94['query']);_0x30db32[_0x015a('0x2a')]=_['intersection'](_0x30db32[_0x015a('0x27')],_0x30db32[_0x015a('0x28')]);_0x484051[_0x015a('0x2c')]=_[_0x015a('0x2b')](_0x30db32[_0x015a('0x27')],qs[_0x015a('0x2d')](_0x5ddd94[_0x015a('0x28')][_0x015a('0x2d')]));_0x484051[_0x015a('0x2c')]=_0x484051[_0x015a('0x2c')]['length']?_0x484051[_0x015a('0x2c')]:_0x30db32[_0x015a('0x27')];if(_0x5ddd94[_0x015a('0x28')]['includeAll']){_0x484051[_0x015a('0x39')]=[{'all':!![]}];}_0x484051=_[_0x015a('0x35')]({},_0x484051,_0x5ddd94[_0x015a('0x36')]);return db[_0x015a('0x37')][_0x015a('0x3e')](_0x484051)['then'](handleEntityNotFound(_0x3a4dce,null))['then'](respondWithResult(_0x3a4dce,null))[_0x015a('0x16')](handleError(_0x3a4dce,null));};exports['create']=function(_0x5b14d3,_0x412b3f){var _0x11fc52;return db[_0x015a('0x37')][_0x015a('0x3f')](_0x5b14d3[_0x015a('0x40')],{'raw':!![]})[_0x015a('0xb')](function(_0x458571){_0x11fc52=_0x458571;return db[_0x015a('0x37')][_0x015a('0x3a')]({'where':{'type':_0x5b14d3[_0x015a('0x40')]['type']},'raw':!![]});})['then'](function(_0x3a1c7c){if(_0x11fc52[_0x015a('0x25')]['toUpperCase']()==_0x015a('0x41')){var _0x540be3=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x45')),_0x015a('0x46'));var _0x59dbef=ejs[_0x015a('0x47')](_0x540be3,{'networks':_0x3a1c7c||[]});fs[_0x015a('0x48')](_0x015a('0x49'),_0x59dbef);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x3f'),{'module':_0x015a('0x4b')});}else if(_0x11fc52[_0x015a('0x25')]['toUpperCase']()==_0x015a('0x4c')){var _0x479e9f=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x4d')),_0x015a('0x46'));var _0x5af999=ejs[_0x015a('0x47')](_0x479e9f,{'networks':_0x3a1c7c||[]});fs[_0x015a('0x48')](_0x015a('0x4e'),_0x5af999);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x3f'),{'module':_0x015a('0x4b')});}else{var _0x31ce57=fs['readFileSync'](path[_0x015a('0x43')](config['root'],_0x015a('0x4f')),_0x015a('0x46'));var _0x423366=ejs[_0x015a('0x47')](_0x31ce57,{'networks':_0x3a1c7c||[]});fs[_0x015a('0x48')](util[_0x015a('0x50')](_0x015a('0x51'),_0x5b14d3[_0x015a('0x40')][_0x015a('0x25')][_0x015a('0x52')]()),_0x423366);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x3f'),{'module':'chan_sip.so'});}})['then'](function(){return _0x11fc52;})[_0x015a('0xb')](respondWithResult(_0x412b3f,0xc9))[_0x015a('0x16')](handleError(_0x412b3f,null));};exports[_0x015a('0x1e')]=function(_0x12601d,_0x6b83a){var _0x3c770e;return db['Network'][_0x015a('0x3e')]({'where':{'id':_0x12601d[_0x015a('0x3d')]['id']}})[_0x015a('0xb')](handleEntityNotFound(_0x6b83a,null))[_0x015a('0xb')](saveUpdates(_0x12601d['body'],null))[_0x015a('0xb')](function(_0x2a560f){if(_0x2a560f){_0x3c770e=_0x2a560f;return db['Network'][_0x015a('0x3a')]({'where':{'type':_0x3c770e[_0x015a('0x25')]},'raw':!![]});}return null;})[_0x015a('0xb')](function(_0x4723f7){if(_0x3c770e[_0x015a('0x25')][_0x015a('0x53')]()==_0x015a('0x41')){var _0x24b897=fs['readFileSync'](path['join'](config[_0x015a('0x44')],'server/files/templates/stun_multiple.ejs'),_0x015a('0x46'));var _0x2dd86b=ejs['render'](_0x24b897,{'networks':_0x4723f7||[]});fs[_0x015a('0x48')]('/etc/asterisk/stun_xcally.conf',_0x2dd86b);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x1e'),{'module':_0x015a('0x4b')});}else if(_0x3c770e[_0x015a('0x25')][_0x015a('0x53')]()=='TURN'){var _0x846f03=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x4d')),_0x015a('0x46'));var _0x55d6ff=ejs[_0x015a('0x47')](_0x846f03,{'networks':_0x4723f7||[]});fs[_0x015a('0x48')]('/etc/asterisk/turn_xcally.conf',_0x55d6ff);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x1e'),{'module':_0x015a('0x4b')});}else{var _0x186f2d=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x4f')),_0x015a('0x46'));var _0x51fdec=ejs[_0x015a('0x47')](_0x186f2d,{'networks':_0x4723f7||[]});fs[_0x015a('0x48')](util['format'](_0x015a('0x51'),_0x12601d[_0x015a('0x40')]['type']['toLowerCase']()),_0x51fdec);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x1e'),{'module':'chan_sip.so'});}})[_0x015a('0xb')](function(_0xe6bac3){if(_0xe6bac3){return _0x3c770e;}return null;})[_0x015a('0xb')](respondWithResult(_0x6b83a,null))[_0x015a('0x16')](handleError(_0x6b83a,null));};exports[_0x015a('0x1f')]=function(_0x518040,_0x5a9c05){var _0x1cf8c8;return db['Network'][_0x015a('0x3e')]({'where':{'id':_0x518040[_0x015a('0x3d')]['id']}})[_0x015a('0xb')](function(_0x19fadc){_0x1cf8c8=_0x19fadc;return _0x19fadc;})[_0x015a('0xb')](handleEntityNotFound(_0x5a9c05,null))[_0x015a('0xb')](removeEntity(_0x5a9c05,null))[_0x015a('0xb')](function(){if(_0x1cf8c8){return db[_0x015a('0x37')]['findAll']({'where':{'type':_0x1cf8c8[_0x015a('0x25')]},'raw':!![]});}})[_0x015a('0xb')](function(_0x556d5b){if(_0x1cf8c8['type']['toUpperCase']()==_0x015a('0x41')){var _0x2e6773=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x45')),_0x015a('0x46'));var _0x3f5dcd=ejs[_0x015a('0x47')](_0x2e6773,{'networks':_0x556d5b||[]});fs[_0x015a('0x48')](_0x015a('0x49'),_0x3f5dcd);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x1f'),{'module':_0x015a('0x4b')});}else if(_0x1cf8c8[_0x015a('0x25')]['toUpperCase']()=='TURN'){var _0x547761=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x4d')),_0x015a('0x46'));var _0x10d9b0=ejs['render'](_0x547761,{'networks':_0x556d5b||[]});fs[_0x015a('0x48')]('/etc/asterisk/turn_xcally.conf',_0x10d9b0);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x1f'),{'module':_0x015a('0x4b')});}else{var _0x4bee53=fs[_0x015a('0x42')](path['join'](config[_0x015a('0x44')],_0x015a('0x4f')),'utf8');var _0x54bc40=ejs['render'](_0x4bee53,{'networks':_0x556d5b||[]});fs['writeFileSync'](util[_0x015a('0x50')](_0x015a('0x51'),_0x1cf8c8[_0x015a('0x25')][_0x015a('0x52')]()),_0x54bc40);return respondWithRpcPromise('Reload',_0x015a('0x1f'),{'module':_0x015a('0x54')});}})[_0x015a('0x16')](handleError(_0x5a9c05,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 0d9119a..219a638 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 _0x5db8=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./network.attributes','exports','Network','network'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5db8,0xbb));var _0x85db=function(_0x1e8f35,_0x3db390){_0x1e8f35=_0x1e8f35-0x0;var _0x446c13=_0x5db8[_0x1e8f35];return _0x446c13;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var logger=require(_0x85db('0x2'))('api');var moment=require(_0x85db('0x3'));var BPromise=require(_0x85db('0x4'));var rp=require(_0x85db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85db('0x6'));var attributes=require(_0x85db('0x7'));module[_0x85db('0x8')]=function(_0x34d71f,_0x48bf16){return _0x34d71f['define'](_0x85db('0x9'),attributes,{'tableName':_0x85db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','moment','bluebird'];(function(_0x180d60,_0x2627f8){var _0x1056d6=function(_0x5dcf41){while(--_0x5dcf41){_0x180d60['push'](_0x180d60['shift']());}};_0x1056d6(++_0x2627f8);}(_0xe706,0xa3));var _0x6e70=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0xe706[_0x1ac6e5];return _0x5877dc;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 9b4ee78..992ef5f 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x51a642,_0x4aa06f){var _0x4a5780=function(_0x5d0d6c){while(--_0x5d0d6c){_0x51a642['push'](_0x51a642['shift']());}};_0x4a5780(++_0x4aa06f);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +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(_0x59a630,_0x44cb9a){var _0x411814=function(_0x176a8f){while(--_0x176a8f){_0x59a630['push'](_0x59a630['shift']());}};_0x411814(++_0x44cb9a);}(_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});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 95271b5..a932b86 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 _0x3d04=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','/:id/dispositions','addAnswer','/:id/notify','/:id/applications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports'];(function(_0x3478c7,_0x3fdfb6){var _0x4704f9=function(_0x525c34){while(--_0x525c34){_0x3478c7['push'](_0x3478c7['shift']());}};_0x4704f9(++_0x3fdfb6);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xa')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router['get']('/:id/dispositions',auth[_0x43d0('0xb')](),controller['getDispositions']);router['get'](_0x43d0('0xf'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x10')]);router[_0x43d0('0xa')]('/:id/applications',auth[_0x43d0('0xb')](),controller[_0x43d0('0x11')]);router['get'](_0x43d0('0x12'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x13')]);router['get'](_0x43d0('0x14'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x15')]);router['post']('/',auth[_0x43d0('0xb')](),controller[_0x43d0('0x16')]);router[_0x43d0('0x17')](_0x43d0('0x18'),auth[_0x43d0('0xb')](),controller['addDisposition']);router['post'](_0x43d0('0xf'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x19')]);router['post'](_0x43d0('0x1a'),controller['notify']);router[_0x43d0('0x17')](_0x43d0('0x1b'),auth[_0x43d0('0xb')](),controller['addApplications']);router[_0x43d0('0x17')](_0x43d0('0x14'),auth['isAuthenticated'](),controller[_0x43d0('0x1c')]);router[_0x43d0('0x17')](_0x43d0('0x1d'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x1e')]);router[_0x43d0('0x1f')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x20')]);router[_0x43d0('0x21')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x22')]);router[_0x43d0('0x21')](_0x43d0('0x18'),auth['isAuthenticated'](),controller[_0x43d0('0x23')]);router[_0x43d0('0x21')]('/:id/canned_answers',auth[_0x43d0('0xb')](),controller['removeAnswers']);router[_0x43d0('0x21')](_0x43d0('0x14'),auth['isAuthenticated'](),controller[_0x43d0('0x24')]);module[_0x43d0('0x25')]=router; \ No newline at end of file +var _0xd4a2=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2d3c51,_0x44c7af){_0x2d3c51=_0x2d3c51-0x0;var _0x1d3300=_0xd4a2[_0x2d3c51];return _0x1d3300;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0x6')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2d4a('0xf')]);router['get'](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x11')]);router[_0x2d4a('0x6')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x13')]);router[_0x2d4a('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x2d4a('0x14')]);router['post']('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x15')]);router[_0x2d4a('0x16')](_0x2d4a('0xd'),auth['isAuthenticated'](),controller[_0x2d4a('0x17')]);router['post'](_0x2d4a('0x18'),auth['isAuthenticated'](),controller[_0x2d4a('0x19')]);router[_0x2d4a('0x16')](_0x2d4a('0x1a'),controller[_0x2d4a('0x1b')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x2d4a('0x1c')]);router[_0x2d4a('0x16')](_0x2d4a('0x1d'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1e')]);router[_0x2d4a('0x16')]('/:id/send',auth['isAuthenticated'](),controller[_0x2d4a('0x1f')]);router[_0x2d4a('0x20')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x21')]);router[_0x2d4a('0x22')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller['destroy']);router[_0x2d4a('0x22')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x23')]);router[_0x2d4a('0x22')](_0x2d4a('0x18'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x24')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x2d4a('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 6abc421..582ea3f 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 _0x5f43=['sequelize','randomstring','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDisposition'];(function(_0x155890,_0x21813e){var _0x3f156d=function(_0x3edc20){while(--_0x3edc20){_0x155890['push'](_0x155890['shift']());}};_0x3f156d(++_0x21813e);}(_0x5f43,0x154));var _0x35f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f43[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x35f4('0x0'));var rs=require(_0x35f4('0x1'));module['exports']={'name':{'type':Sequelize[_0x35f4('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x35f4('0x2')],'defaultValue':function(){return rs[_0x35f4('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x35f4('0x4')],'defaultValue':function(){return _0x35f4('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x35f4('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x35f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x35f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x35f4('0x2')]},'queueTransfer':{'type':Sequelize[_0x35f4('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x35f4('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x35f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x35f4('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x35f4('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5ee7e4){if(!_0x5ee7e4)this[_0x35f4('0x8')]('mandatoryDispositionPauseId',null);this[_0x35f4('0x8')](_0x35f4('0x9'),_0x5ee7e4);}}}; \ No newline at end of file +var _0x867a=['randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x53b6ae,_0x3cb9f4){var _0x34f4b2=function(_0x4b3169){while(--_0x4b3169){_0x53b6ae['push'](_0x53b6ae['shift']());}};_0x34f4b2(++_0x3cb9f4);}(_0x867a,0x151));var _0xa867=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x867a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa867('0x0'));var rs=require(_0xa867('0x1'));module[_0xa867('0x2')]={'name':{'type':Sequelize[_0xa867('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xa867('0x3')]},'token':{'type':Sequelize[_0xa867('0x3')],'defaultValue':function(){return rs[_0xa867('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa867('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa867('0x5')],'defaultValue':function(){return _0xa867('0x6');}},'notificationSound':{'type':Sequelize[_0xa867('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa867('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa867('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa867('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa867('0x3')]},'queueTransfer':{'type':Sequelize[_0xa867('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa867('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa867('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa867('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa867('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xa867('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa867('0x7')],'defaultValue':![],'comment':_0xa867('0xa'),'set':function(_0x59c511){if(!_0x59c511)this[_0xa867('0xb')]('mandatoryDispositionPauseId',null);this[_0xa867('0xb')](_0xa867('0xc'),_0x59c511);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 3e72833..ddd9bd8 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 _0x99fd=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','rows','catch','show','params','mandatoryDispositionPause','find','create','body','get','role','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','include','findAll','removeDispositions','ids','getAnswers','findOne','CannedAnswer','nolimit','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','account','firstName','threadId','externalUrl','ContactId','spread','contact','lastName','messageId','update','interaction','created','push','*,*,*,*','User','unshift','agent','waitForTheAssignedAgent','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','stack','finally','getInteractions','OpenchannelInteraction','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','updatedAt','user','out','OpenchannelMessage','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','destroy','OpenchannelAccounts','UserProfileResource','send','index','Pause','map','OpenchannelAccount','rawAttributes','type','key','model','query'];(function(_0x458966,_0x33eb1f){var _0x3deafd=function(_0x30d5f7){while(--_0x30d5f7){_0x458966['push'](_0x458966['shift']());}};_0x3deafd(++_0x33eb1f);}(_0x99fd,0x1e0));var _0xd99f=function(_0xa1b05f,_0x12f899){_0xa1b05f=_0xa1b05f-0x0;var _0x29daa0=_0x99fd[_0xa1b05f];return _0x29daa0;};'use strict';var emlformat=require(_0xd99f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd99f('0x1'));var jsonpatch=require(_0xd99f('0x2'));var rp=require(_0xd99f('0x3'));var moment=require(_0xd99f('0x4'));var BPromise=require(_0xd99f('0x5'));var Mustache=require('mustache');var util=require(_0xd99f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd99f('0x7'));var ejs=require(_0xd99f('0x8'));var fs=require('fs');var fs_extra=require(_0xd99f('0x9'));var _=require(_0xd99f('0xa'));var squel=require('squel');var crypto=require(_0xd99f('0xb'));var jsforce=require(_0xd99f('0xc'));var deskjs=require(_0xd99f('0xd'));var toCsv=require(_0xd99f('0x7'));var querystring=require('querystring');var Papa=require(_0xd99f('0xe'));var Redis=require(_0xd99f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd99f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd99f('0x11'));var logger=require(_0xd99f('0x12'))(_0xd99f('0x13'));var utils=require(_0xd99f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd99f('0x15'));var db=require(_0xd99f('0x16'))['db'];config[_0xd99f('0x17')]=_[_0xd99f('0x18')](config['redis'],{'host':_0xd99f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd99f('0x1a'))[_0xd99f('0x1b')](socket);var jayson=require(_0xd99f('0x1c'));var client=jayson['client'][_0xd99f('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xd99f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5e4e50,_0xea8765,_0x3b442c,_0x4281ac){return new BPromise(function(_0x1a1e0c,_0x23f38a){var _0x15c3c3=_0x4281ac||client;return _0x15c3c3[_0xd99f('0x1e')](_0x5e4e50,_0x3b442c)[_0xd99f('0x1f')](function(_0x2f014a){logger[_0xd99f('0x20')](_0xd99f('0x21'),_0xea8765,'request\x20sent');logger['debug'](_0xd99f('0x22'),_0xea8765,_0xd99f('0x23'),JSON[_0xd99f('0x24')](_0x2f014a));if(_0x2f014a[_0xd99f('0x25')]){if(_0x2f014a[_0xd99f('0x25')]['code']===0x1f4){logger[_0xd99f('0x25')](_0xd99f('0x21'),_0xea8765,_0x2f014a[_0xd99f('0x25')][_0xd99f('0x26')]);return _0x23f38a(_0x2f014a['error']['message']);}logger[_0xd99f('0x25')](_0xd99f('0x21'),_0xea8765,_0x2f014a[_0xd99f('0x25')][_0xd99f('0x26')]);return _0x1a1e0c(_0x2f014a['error'][_0xd99f('0x26')]);}else{logger[_0xd99f('0x20')](_0xd99f('0x21'),_0xea8765,_0xd99f('0x23'));_0x1a1e0c(_0x2f014a[_0xd99f('0x27')][_0xd99f('0x26')]);}})['catch'](function(_0x4b2956){logger[_0xd99f('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0xea8765,_0x4b2956);_0x23f38a(_0x4b2956);});});}function respondWithStatusCode(_0x4870cd,_0x1cf8b3){_0x1cf8b3=_0x1cf8b3||0xcc;return function(_0x167631){if(_0x167631){return _0x4870cd[_0xd99f('0x28')](_0x1cf8b3);}return _0x4870cd[_0xd99f('0x29')](_0x1cf8b3)[_0xd99f('0x2a')]();};}function respondWithResult(_0x4038f3,_0x1bdaf3){_0x1bdaf3=_0x1bdaf3||0xc8;return function(_0x9d2df5){if(_0x9d2df5){return _0x4038f3['status'](_0x1bdaf3)[_0xd99f('0x2b')](_0x9d2df5);}};}function respondWithFilteredResult(_0x55e3fd,_0x150d68){return function(_0x41ec05){if(_0x41ec05){var _0xb5665d=typeof _0x150d68['offset']===_0xd99f('0x2c')&&typeof _0x150d68['limit']===_0xd99f('0x2c');var _0x1469b0=_0x41ec05[_0xd99f('0x2d')];var _0x55342f=_0xb5665d?0x0:_0x150d68[_0xd99f('0x2e')];var _0x33201d=_0xb5665d?_0x41ec05['count']:_0x150d68[_0xd99f('0x2e')]+_0x150d68[_0xd99f('0x2f')];var _0xbfbd6b;if(_0x33201d>=_0x1469b0){_0x33201d=_0x1469b0;_0xbfbd6b=0xc8;}else{_0xbfbd6b=0xce;}_0x55e3fd[_0xd99f('0x29')](_0xbfbd6b);return _0x55e3fd[_0xd99f('0x30')]('Content-Range',_0x55342f+'-'+_0x33201d+'/'+_0x1469b0)[_0xd99f('0x2b')](_0x41ec05);}return null;};}function patchUpdates(_0x43d35e){return function(_0x59b7af){try{jsonpatch[_0xd99f('0x31')](_0x59b7af,_0x43d35e,!![]);}catch(_0x5b9102){return BPromise['reject'](_0x5b9102);}return _0x59b7af['save']();};}function saveUpdates(_0x1922c8,_0x512b19){return function(_0x51d732){if(_0x51d732){return _0x51d732['update'](_0x1922c8)[_0xd99f('0x1f')](function(_0x245725){return _0x245725;});}return null;};}function removeEntity(_0x1eb9ba,_0x1db464){return function(_0x413e60){if(_0x413e60){return _0x413e60[_0xd99f('0x32')]()[_0xd99f('0x1f')](function(){var _0x268a32=_0x413e60['get']({'plain':!![]});var _0x286dd2=_0xd99f('0x33');return db[_0xd99f('0x34')][_0xd99f('0x32')]({'where':{'type':_0x286dd2,'resourceId':_0x268a32['id']}})['then'](function(){return _0x413e60;});})[_0xd99f('0x1f')](function(){_0x1eb9ba['status'](0xcc)[_0xd99f('0x2a')]();});}};}function handleEntityNotFound(_0x14b6cc,_0xff8965){return function(_0x239d42){if(!_0x239d42){_0x14b6cc[_0xd99f('0x28')](0x194);}return _0x239d42;};}function handleError(_0x569d92,_0x1c9d71){_0x1c9d71=_0x1c9d71||0x1f4;return function(_0x4f7a70){logger[_0xd99f('0x25')](_0x4f7a70['stack']);if(_0x4f7a70['name']){delete _0x4f7a70['name'];}_0x569d92[_0xd99f('0x29')](_0x1c9d71)[_0xd99f('0x35')](_0x4f7a70);};}exports[_0xd99f('0x36')]=function(_0x52b6c8,_0x6fd5f1){var _0x2e7849={'include':[{'model':db[_0xd99f('0x37')],'as':'mandatoryDispositionPause'}]},_0x421922={},_0x34e7ee={'count':0x0,'rows':[]};var _0x5ef974=_[_0xd99f('0x38')](db[_0xd99f('0x39')][_0xd99f('0x3a')],function(_0x1bf882){return{'name':_0x1bf882['fieldName'],'type':_0x1bf882[_0xd99f('0x3b')][_0xd99f('0x3c')]};});_0x421922[_0xd99f('0x3d')]=_[_0xd99f('0x38')](_0x5ef974,'name');_0x421922[_0xd99f('0x3e')]=_[_0xd99f('0x3f')](_0x52b6c8[_0xd99f('0x3e')]);_0x421922[_0xd99f('0x40')]=_[_0xd99f('0x41')](_0x421922[_0xd99f('0x3d')],_0x421922[_0xd99f('0x3e')]);_0x2e7849[_0xd99f('0x42')]=_[_0xd99f('0x41')](_0x421922[_0xd99f('0x3d')],qs[_0xd99f('0x43')](_0x52b6c8[_0xd99f('0x3e')][_0xd99f('0x43')]));_0x2e7849['attributes']=_0x2e7849[_0xd99f('0x42')][_0xd99f('0x44')]?_0x2e7849['attributes']:_0x421922[_0xd99f('0x3d')];if(!_0x52b6c8[_0xd99f('0x3e')][_0xd99f('0x45')]('nolimit')){_0x2e7849[_0xd99f('0x2f')]=qs[_0xd99f('0x2f')](_0x52b6c8[_0xd99f('0x3e')]['limit']);_0x2e7849['offset']=qs['offset'](_0x52b6c8[_0xd99f('0x3e')][_0xd99f('0x2e')]);}_0x2e7849[_0xd99f('0x46')]=qs['sort'](_0x52b6c8[_0xd99f('0x3e')][_0xd99f('0x47')]);_0x2e7849[_0xd99f('0x48')]=qs[_0xd99f('0x40')](_[_0xd99f('0x49')](_0x52b6c8[_0xd99f('0x3e')],_0x421922[_0xd99f('0x40')]),_0x5ef974);if(_0x52b6c8['query'][_0xd99f('0x4a')]){_0x2e7849[_0xd99f('0x48')]=_[_0xd99f('0x4b')](_0x2e7849[_0xd99f('0x48')],{'$or':_[_0xd99f('0x38')](_0x5ef974,function(_0x3429a0){if(_0x3429a0[_0xd99f('0x3b')]!==_0xd99f('0x4c')){var _0x56e542={};_0x56e542[_0x3429a0[_0xd99f('0x4d')]]={'$like':'%'+_0x52b6c8['query'][_0xd99f('0x4a')]+'%'};return _0x56e542;}})});}_0x2e7849=_['merge']({},_0x2e7849,_0x52b6c8[_0xd99f('0x4e')]);var _0x3955b6={'where':_0x2e7849[_0xd99f('0x48')]};return db['OpenchannelAccount'][_0xd99f('0x2d')](_0x3955b6)[_0xd99f('0x1f')](function(_0x416de1){_0x34e7ee['count']=_0x416de1;if(_0x52b6c8[_0xd99f('0x3e')][_0xd99f('0x4f')]){_0x2e7849['include']=[{'all':!![]}];}return db[_0xd99f('0x39')]['findAll'](_0x2e7849);})['then'](function(_0x405dc6){_0x34e7ee[_0xd99f('0x50')]=_0x405dc6;return _0x34e7ee;})[_0xd99f('0x1f')](respondWithFilteredResult(_0x6fd5f1,_0x2e7849))[_0xd99f('0x51')](handleError(_0x6fd5f1,null));};exports[_0xd99f('0x52')]=function(_0x30c9db,_0x3ae6c0){var _0x56e5b9={'raw':![],'where':{'id':_0x30c9db[_0xd99f('0x53')]['id']},'include':[{'model':db[_0xd99f('0x37')],'as':_0xd99f('0x54')}]},_0x4cd0f7={};_0x4cd0f7['model']=_[_0xd99f('0x3f')](db[_0xd99f('0x39')][_0xd99f('0x3a')]);_0x4cd0f7[_0xd99f('0x3e')]=_[_0xd99f('0x3f')](_0x30c9db['query']);_0x4cd0f7['filters']=_[_0xd99f('0x41')](_0x4cd0f7[_0xd99f('0x3d')],_0x4cd0f7['query']);_0x56e5b9[_0xd99f('0x42')]=_[_0xd99f('0x41')](_0x4cd0f7[_0xd99f('0x3d')],qs['fields'](_0x30c9db['query'][_0xd99f('0x43')]));_0x56e5b9['attributes']=_0x56e5b9['attributes']['length']?_0x56e5b9[_0xd99f('0x42')]:_0x4cd0f7[_0xd99f('0x3d')];if(_0x30c9db[_0xd99f('0x3e')][_0xd99f('0x4f')]){_0x56e5b9['include']=[{'all':!![]}];}_0x56e5b9=_[_0xd99f('0x4b')]({},_0x56e5b9,_0x30c9db[_0xd99f('0x4e')]);return db[_0xd99f('0x39')][_0xd99f('0x55')](_0x56e5b9)['then'](handleEntityNotFound(_0x3ae6c0,null))[_0xd99f('0x1f')](respondWithResult(_0x3ae6c0,null))[_0xd99f('0x51')](handleError(_0x3ae6c0,null));};exports[_0xd99f('0x56')]=function(_0x49488e,_0x4df5a6){return db['OpenchannelAccount']['create'](_0x49488e[_0xd99f('0x57')],{})[_0xd99f('0x1f')](function(_0x390c40){var _0x49686b=_0x49488e['user'][_0xd99f('0x58')]({'plain':!![]});if(!_0x49686b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49686b[_0xd99f('0x59')]==='user'){var _0xc0ef42=_0x390c40[_0xd99f('0x58')]({'plain':!![]});var _0x29f77c=_0xd99f('0x33');return db['UserProfileSection'][_0xd99f('0x55')]({'where':{'name':_0x29f77c,'userProfileId':_0x49686b['userProfileId']},'raw':!![]})['then'](function(_0x21abae){if(_0x21abae&&_0x21abae['autoAssociation']===0x0){return db[_0xd99f('0x34')][_0xd99f('0x56')]({'name':_0xc0ef42['name'],'resourceId':_0xc0ef42['id'],'type':_0x21abae['name'],'sectionId':_0x21abae['id']},{})[_0xd99f('0x1f')](function(){return _0x390c40;});}else{return _0x390c40;}})[_0xd99f('0x51')](function(_0x4d79be){logger[_0xd99f('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d79be);throw _0x4d79be;});}return _0x390c40;})[_0xd99f('0x1f')](respondWithResult(_0x4df5a6,0xc9))['catch'](handleError(_0x4df5a6,null));};exports['update']=function(_0x239700,_0x4e6683){if(_0x239700[_0xd99f('0x57')]['id']){delete _0x239700[_0xd99f('0x57')]['id'];}return db[_0xd99f('0x39')][_0xd99f('0x55')]({'where':{'id':_0x239700[_0xd99f('0x53')]['id']},'include':[{'model':db[_0xd99f('0x37')],'as':_0xd99f('0x54')}]})[_0xd99f('0x1f')](handleEntityNotFound(_0x4e6683,null))['then'](saveUpdates(_0x239700['body'],null))[_0xd99f('0x1f')](respondWithResult(_0x4e6683,null))[_0xd99f('0x51')](handleError(_0x4e6683,null));};exports[_0xd99f('0x32')]=function(_0x29b7f7,_0x441e18){return db[_0xd99f('0x39')][_0xd99f('0x55')]({'where':{'id':_0x29b7f7['params']['id']}})[_0xd99f('0x1f')](handleEntityNotFound(_0x441e18,null))[_0xd99f('0x1f')](removeEntity(_0x441e18,null))[_0xd99f('0x51')](handleError(_0x441e18,null));};exports[_0xd99f('0x5a')]=function(_0x422a6d,_0x45b897){return db[_0xd99f('0x39')]['describe']()['then'](respondWithResult(_0x45b897,null))[_0xd99f('0x51')](handleError(_0x45b897,null));};exports[_0xd99f('0x5b')]=function(_0x4e814d,_0x446f24,_0x2c3732){if(_0x4e814d[_0xd99f('0x57')]['id']){delete _0x4e814d[_0xd99f('0x57')]['id'];}return db['OpenchannelAccount'][_0xd99f('0x55')]({'where':{'id':_0x4e814d[_0xd99f('0x53')]['id']}})[_0xd99f('0x1f')](handleEntityNotFound(_0x446f24,null))[_0xd99f('0x1f')](function(_0x105483){if(_0x105483){_0x4e814d[_0xd99f('0x57')][_0xd99f('0x5c')]=_0x105483['id'];return db['Disposition'][_0xd99f('0x56')](_0x4e814d[_0xd99f('0x57')]);}})[_0xd99f('0x1f')](respondWithResult(_0x446f24,null))['catch'](handleError(_0x446f24,null));};exports[_0xd99f('0x5d')]=function(_0x107289,_0x3c73a0,_0x2ca2fe){var _0x3b8392={'raw':![],'where':{}};var _0x3fd167={};var _0x492405={'count':0x0,'rows':[]};return db[_0xd99f('0x39')]['findOne']({'where':{'id':_0x107289[_0xd99f('0x53')]['id']}})['then'](handleEntityNotFound(_0x3c73a0,null))['then'](function(_0x1bc0bb){if(_0x1bc0bb){_0x3fd167[_0xd99f('0x3d')]=_[_0xd99f('0x3f')](db['Disposition']['rawAttributes']);_0x3fd167['query']=_[_0xd99f('0x3f')](_0x107289['query']);_0x3fd167[_0xd99f('0x40')]=_['intersection'](_0x3fd167[_0xd99f('0x3d')],_0x3fd167[_0xd99f('0x3e')]);_0x3b8392[_0xd99f('0x42')]=_[_0xd99f('0x41')](_0x3fd167[_0xd99f('0x3d')],qs[_0xd99f('0x43')](_0x107289[_0xd99f('0x3e')][_0xd99f('0x43')]));_0x3b8392[_0xd99f('0x42')]=_0x3b8392[_0xd99f('0x42')][_0xd99f('0x44')]?_0x3b8392[_0xd99f('0x42')]:_0x3fd167[_0xd99f('0x3d')];if(!_0x107289[_0xd99f('0x3e')][_0xd99f('0x45')]('nolimit')){_0x3b8392[_0xd99f('0x2f')]=qs[_0xd99f('0x2f')](_0x107289[_0xd99f('0x3e')]['limit']);_0x3b8392[_0xd99f('0x2e')]=qs[_0xd99f('0x2e')](_0x107289['query'][_0xd99f('0x2e')]);}_0x3b8392[_0xd99f('0x46')]=qs[_0xd99f('0x47')](_0x107289[_0xd99f('0x3e')][_0xd99f('0x47')]);_0x3b8392['where']=qs['filters'](_[_0xd99f('0x49')](_0x107289['query'],_0x3fd167[_0xd99f('0x40')]));_0x3b8392[_0xd99f('0x48')][_0xd99f('0x5c')]=_0x1bc0bb['id'];if(_0x107289[_0xd99f('0x3e')][_0xd99f('0x4a')]){_0x3b8392[_0xd99f('0x48')]=_[_0xd99f('0x4b')](_0x3b8392[_0xd99f('0x48')],{'$or':_[_0xd99f('0x38')](_0x3b8392[_0xd99f('0x42')],function(_0x108667){var _0x2361e7={};_0x2361e7[_0x108667]={'$like':'%'+_0x107289[_0xd99f('0x3e')][_0xd99f('0x4a')]+'%'};return _0x2361e7;})});}_0x3b8392=_[_0xd99f('0x4b')]({},_0x3b8392,_0x107289['options']);return db[_0xd99f('0x5e')][_0xd99f('0x2d')]({'where':_0x3b8392[_0xd99f('0x48')]})[_0xd99f('0x1f')](function(_0x3130f9){_0x492405[_0xd99f('0x2d')]=_0x3130f9;if(_0x107289[_0xd99f('0x3e')]['includeAll']){_0x3b8392[_0xd99f('0x5f')]=[{'all':!![]}];}return db[_0xd99f('0x5e')][_0xd99f('0x60')](_0x3b8392);})[_0xd99f('0x1f')](function(_0x59b74f){_0x492405[_0xd99f('0x50')]=_0x59b74f;return _0x492405;});}})[_0xd99f('0x1f')](respondWithFilteredResult(_0x3c73a0,_0x3b8392))[_0xd99f('0x51')](handleError(_0x3c73a0,null));};exports[_0xd99f('0x61')]=function(_0x37b5be,_0x2d81b3,_0x3f2b42){return db['OpenchannelAccount'][_0xd99f('0x55')]({'where':{'id':_0x37b5be[_0xd99f('0x53')]['id']}})['then'](handleEntityNotFound(_0x2d81b3,null))[_0xd99f('0x1f')](function(_0x3af10a){if(_0x3af10a){return _0x3af10a[_0xd99f('0x61')](_0x37b5be[_0xd99f('0x3e')][_0xd99f('0x62')]);}})[_0xd99f('0x1f')](respondWithStatusCode(_0x2d81b3,null))[_0xd99f('0x51')](handleError(_0x2d81b3,null));};exports['addAnswer']=function(_0x1bf4ed,_0xf5138c,_0x562f1a){if(_0x1bf4ed['body']['id']){delete _0x1bf4ed[_0xd99f('0x57')]['id'];}return db[_0xd99f('0x39')][_0xd99f('0x55')]({'where':{'id':_0x1bf4ed[_0xd99f('0x53')]['id']}})[_0xd99f('0x1f')](handleEntityNotFound(_0xf5138c,null))[_0xd99f('0x1f')](function(_0x79c32f){if(_0x79c32f){_0x1bf4ed['body'][_0xd99f('0x5c')]=_0x79c32f['id'];return db['CannedAnswer'][_0xd99f('0x56')](_0x1bf4ed[_0xd99f('0x57')]);}})[_0xd99f('0x1f')](respondWithResult(_0xf5138c,null))['catch'](handleError(_0xf5138c,null));};exports[_0xd99f('0x63')]=function(_0x513ed2,_0x50512d,_0x239ba7){var _0x3d3574={'raw':![],'where':{}};var _0x235ce9={};var _0x27d3ed={'count':0x0,'rows':[]};return db[_0xd99f('0x39')][_0xd99f('0x64')]({'where':{'id':_0x513ed2['params']['id']}})[_0xd99f('0x1f')](handleEntityNotFound(_0x50512d,null))[_0xd99f('0x1f')](function(_0x40f876){if(_0x40f876){_0x235ce9[_0xd99f('0x3d')]=_[_0xd99f('0x3f')](db[_0xd99f('0x65')][_0xd99f('0x3a')]);_0x235ce9[_0xd99f('0x3e')]=_['keys'](_0x513ed2['query']);_0x235ce9[_0xd99f('0x40')]=_[_0xd99f('0x41')](_0x235ce9[_0xd99f('0x3d')],_0x235ce9[_0xd99f('0x3e')]);_0x3d3574[_0xd99f('0x42')]=_[_0xd99f('0x41')](_0x235ce9[_0xd99f('0x3d')],qs['fields'](_0x513ed2[_0xd99f('0x3e')]['fields']));_0x3d3574['attributes']=_0x3d3574[_0xd99f('0x42')]['length']?_0x3d3574[_0xd99f('0x42')]:_0x235ce9['model'];if(!_0x513ed2[_0xd99f('0x3e')][_0xd99f('0x45')](_0xd99f('0x66'))){_0x3d3574['limit']=qs['limit'](_0x513ed2[_0xd99f('0x3e')][_0xd99f('0x2f')]);_0x3d3574[_0xd99f('0x2e')]=qs['offset'](_0x513ed2['query'][_0xd99f('0x2e')]);}_0x3d3574[_0xd99f('0x46')]=qs[_0xd99f('0x47')](_0x513ed2[_0xd99f('0x3e')]['sort']);_0x3d3574['where']=qs[_0xd99f('0x40')](_[_0xd99f('0x49')](_0x513ed2[_0xd99f('0x3e')],_0x235ce9[_0xd99f('0x40')]));_0x3d3574[_0xd99f('0x48')]['OpenchannelAccountId']=_0x40f876['id'];if(_0x513ed2[_0xd99f('0x3e')]['filter']){_0x3d3574[_0xd99f('0x48')]=_['merge'](_0x3d3574[_0xd99f('0x48')],{'$or':_[_0xd99f('0x38')](_0x3d3574[_0xd99f('0x42')],function(_0x2f0cd4){var _0x36de43={};_0x36de43[_0x2f0cd4]={'$like':'%'+_0x513ed2[_0xd99f('0x3e')][_0xd99f('0x4a')]+'%'};return _0x36de43;})});}_0x3d3574=_['merge']({},_0x3d3574,_0x513ed2[_0xd99f('0x4e')]);return db['CannedAnswer'][_0xd99f('0x2d')]({'where':_0x3d3574['where']})[_0xd99f('0x1f')](function(_0x42a5bf){_0x27d3ed[_0xd99f('0x2d')]=_0x42a5bf;if(_0x513ed2[_0xd99f('0x3e')][_0xd99f('0x4f')]){_0x3d3574[_0xd99f('0x5f')]=[{'all':!![]}];}return db[_0xd99f('0x65')][_0xd99f('0x60')](_0x3d3574);})[_0xd99f('0x1f')](function(_0x1a222b){_0x27d3ed[_0xd99f('0x50')]=_0x1a222b;return _0x27d3ed;});}})['then'](respondWithFilteredResult(_0x50512d,_0x3d3574))[_0xd99f('0x51')](handleError(_0x50512d,null));};exports[_0xd99f('0x67')]=function(_0x207ac8,_0x5c6667,_0x1760b9){return db[_0xd99f('0x39')][_0xd99f('0x55')]({'where':{'id':_0x207ac8[_0xd99f('0x53')]['id']}})[_0xd99f('0x1f')](handleEntityNotFound(_0x5c6667,null))[_0xd99f('0x1f')](function(_0x51ee8d){if(_0x51ee8d){return _0x51ee8d[_0xd99f('0x67')](_0x207ac8[_0xd99f('0x3e')][_0xd99f('0x62')]);}})[_0xd99f('0x1f')](respondWithStatusCode(_0x5c6667,null))[_0xd99f('0x51')](handleError(_0x5c6667,null));};exports[_0xd99f('0x68')]=function(_0x1abee5,_0x53042b,_0x127bc3){var _0x5a7384={'body':_0x1abee5[_0xd99f('0x57')],'channel':_0xd99f('0x69')};var _0x43748b=[];var _0xea5a62=[];var _0x5207d={};var _0xdb5ebe=![];return db[_0xd99f('0x6a')][_0xd99f('0x5a')]()[_0xd99f('0x1f')](function(_0x3888c6){if(!_0x3888c6){throw new db[(_0xd99f('0x6b'))][(_0xd99f('0x6c'))](_0xd99f('0x6d'));}_0x43748b=_[_0xd99f('0x6e')](_[_0xd99f('0x3f')](_0x3888c6),[_0xd99f('0x6f'),'updatedAt']);_0xea5a62=_[_0xd99f('0x6e')](_['keys'](_0x3888c6),[_0xd99f('0x6f'),'updatedAt','CompanyId',_0xd99f('0x70')]);if(_0x1abee5['body']['id']){delete _0x1abee5[_0xd99f('0x57')]['id'];}if(_[_0xd99f('0x71')](_0x1abee5['body'][_0xd99f('0x72')])){throw new db[(_0xd99f('0x6b'))][(_0xd99f('0x6c'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1abee5['body'][_0xd99f('0x57')])||_0x1abee5[_0xd99f('0x57')][_0xd99f('0x57')]===''){throw new db[(_0xd99f('0x6b'))][(_0xd99f('0x6c'))](_0xd99f('0x73'));}if(_[_0xd99f('0x71')](_0x1abee5[_0xd99f('0x57')][_0xd99f('0x74')])){throw new db[(_0xd99f('0x6b'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xea5a62);}if(!_['includes'](_0xea5a62,_0x1abee5[_0xd99f('0x57')][_0xd99f('0x74')])){throw new db[(_0xd99f('0x6b'))][(_0xd99f('0x6c'))](_0xd99f('0x75')+_0xea5a62);}_0x5207d[_0x1abee5[_0xd99f('0x57')][_0xd99f('0x74')]]=_0x1abee5[_0xd99f('0x57')][_0xd99f('0x72')];})[_0xd99f('0x1f')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x1abee5[_0xd99f('0x53')]['id']},'include':[{'model':db[_0xd99f('0x76')],'as':_0xd99f('0x77'),'include':[{'model':db[_0xd99f('0x6a')],'as':_0xd99f('0x78'),'where':_0x5207d,'limit':0x1,'order':[['updatedAt',_0xd99f('0x79')]]}]},{'model':db[_0xd99f('0x7a')],'as':_0xd99f('0x7b')}]});})[_0xd99f('0x1f')](handleEntityNotFound(_0x53042b,null))[_0xd99f('0x1f')](function(_0xea3212){if(_0xea3212&&_0xea3212['List']){_0x5a7384['account']=_0xea3212;_0x5a7384[_0xd99f('0x7c')]=_0xea3212[_0xd99f('0x7b')];_0x5a7384['list']=_0xea3212[_0xd99f('0x77')];_0x5a7384['applications']=_['orderBy'](_0x5a7384[_0xd99f('0x7c')],['priority'],['asc']);if(_0x5a7384['account'][_0xd99f('0x7b')]){delete _0x5a7384[_0xd99f('0x7d')][_0xd99f('0x7b')];}if(_0x5a7384[_0xd99f('0x7d')][_0xd99f('0x77')]&&_0x5a7384[_0xd99f('0x7d')][_0xd99f('0x77')][_0xd99f('0x78')]['length']){return _0x5a7384[_0xd99f('0x7d')][_0xd99f('0x77')][_0xd99f('0x78')][0x0];}var _0x5af621=_[_0xd99f('0x18')](_0x1abee5[_0xd99f('0x57')],{'firstName':_0x1abee5[_0xd99f('0x57')][_0xd99f('0x72')],'ListId':_0xea3212[_0xd99f('0x70')]});_0x5af621[_0x1abee5[_0xd99f('0x57')]['mapKey']]=_0x1abee5[_0xd99f('0x57')]['from'];return db[_0xd99f('0x6a')][_0xd99f('0x56')](_0x5af621,{'fields':_0x43748b,'raw':!![]});}})[_0xd99f('0x1f')](handleEntityNotFound(_0x53042b,null))[_0xd99f('0x1f')](function(_0x253a8c){_0x5a7384['contact']=_0x253a8c;if(_0x253a8c){var _0xffd253={'ContactId':_0x253a8c['id'],'OpenchannelAccountId':_0x1abee5[_0xd99f('0x53')]['id'],'from':(_0x253a8c[_0xd99f('0x7e')]||'')+'\x20'+(_0x253a8c['lastName']||'')};var _0x54fa0c={'OpenchannelAccountId':_0x1abee5['params']['id'],'closed':![]};if(_0x1abee5[_0xd99f('0x57')][_0xd99f('0x7f')]){_0x54fa0c[_0xd99f('0x7f')]=_0x1abee5[_0xd99f('0x57')]['threadId'];return db['OpenchannelInteraction']['find']({'where':_0x54fa0c})[_0xd99f('0x1f')](function(_0x422243){if(_0x422243){return[_0x422243,![]];}_0xffd253[_0xd99f('0x7f')]=_0x1abee5[_0xd99f('0x57')][_0xd99f('0x7f')];_0xffd253[_0xd99f('0x80')]=_0x1abee5[_0xd99f('0x57')]['externalUrl'];return db['OpenchannelInteraction'][_0xd99f('0x56')](_0xffd253)[_0xd99f('0x1f')](function(_0x5b6109){return[_0x5b6109,!![]];});});}else{_0x54fa0c['threadId']=null;}_0x54fa0c[_0xd99f('0x81')]=_0x253a8c['id'];return db['OpenchannelInteraction'][_0xd99f('0x55')]({'where':_0x54fa0c})[_0xd99f('0x1f')](function(_0xff3fce){if(_0xff3fce){return[_0xff3fce,![]];}return db['OpenchannelInteraction']['create'](_0xffd253)['then'](function(_0x5bd4d6){return[_0x5bd4d6,!![]];});});}})[_0xd99f('0x82')](function(_0x2f41c9,_0xfd898e){if(_0x2f41c9){_0xdb5ebe=_0xfd898e;if(!_0xfd898e){var _0x291ef8={'from':(_0x5a7384['contact'][_0xd99f('0x7e')]||'')+'\x20'+(_0x5a7384[_0xd99f('0x83')][_0xd99f('0x84')]||'')};if(_0x1abee5['body'][_0xd99f('0x7f')]&&_0x1abee5[_0xd99f('0x57')][_0xd99f('0x85')]&&_0x1abee5[_0xd99f('0x57')][_0xd99f('0x7f')]!=_0x1abee5[_0xd99f('0x57')]['messageId']){_0x291ef8['threadId']=_0x1abee5[_0xd99f('0x57')]['messageId'];}return _0x2f41c9[_0xd99f('0x86')](_0x291ef8);}else{return _0x2f41c9;}}})['then'](function(_0x1b21fc){_0x5a7384[_0xd99f('0x87')]=_0x1b21fc[_0xd99f('0x58')]({'plain':!![]});_0x5a7384[_0xd99f('0x87')]['created']=_0xdb5ebe;if(_0x5a7384['interaction'][_0xd99f('0x88')]){if(_0x5a7384['account']['autoclose']){_0x5a7384[_0xd99f('0x7c')][_0xd99f('0x89')]({'id':0x0,'priority':_0x5a7384['applications'][_0xd99f('0x44')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xd99f('0x8a')});}}return db['OpenchannelMessage'][_0xd99f('0x56')]({'body':_0x1abee5[_0xd99f('0x57')][_0xd99f('0x57')],'OpenchannelAccountId':_0x1abee5[_0xd99f('0x53')]['id'],'OpenchannelInteractionId':_0x1b21fc['id'],'direction':'in','ContactId':_0x5a7384['contact']['id'],'AttachmentId':_0x1abee5[_0xd99f('0x57')]['AttachmentId']});})[_0xd99f('0x1f')](function(_0x5a5e14){_0x5a7384[_0xd99f('0x26')]=_0x5a5e14;if(!_0x5a7384['interaction']['UserId'])return;return db[_0xd99f('0x8b')][_0xd99f('0x55')]({'attributes':['id','name'],'where':{'id':_0x5a7384['interaction']['UserId']}});})[_0xd99f('0x1f')](function(_0x4f8f81){if(_0x4f8f81){_0x5a7384[_0xd99f('0x7c')][_0xd99f('0x8c')]({'id':0x0,'priority':0x0,'app':_0xd99f('0x8d'),'appdata':_0x4f8f81[_0xd99f('0x4d')]+','+(_0x5a7384['account'][_0xd99f('0x8e')]||0xa),'interval':_0xd99f('0x8a')});}if(!_0x5a7384[_0xd99f('0x87')]['queueId'])return;return db[_0xd99f('0x8f')][_0xd99f('0x55')]({'attributes':['id',_0xd99f('0x4d')],'where':{'id':_0x5a7384[_0xd99f('0x87')]['queueId']}});})[_0xd99f('0x1f')](function(_0x515209){if(_0x515209){_0x5a7384[_0xd99f('0x7c')]['unshift']({'id':0x0,'priority':0x1,'app':_0xd99f('0x90'),'appdata':_0x515209[_0xd99f('0x4d')]+','+(_0x5a7384[_0xd99f('0x7d')][_0xd99f('0x91')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd99f('0x92'),_0xd99f('0x93'),_0x5a7384);})[_0xd99f('0x1f')](function(_0x47e81d){respondWithRpcPromise('EventManager','EventManager',{'event':_0xd99f('0x68'),'message':_0x47e81d},client9002);return _0x47e81d;})[_0xd99f('0x1f')](respondWithResult(_0x53042b,null))[_0xd99f('0x51')](handleError(_0x53042b,null));};exports['addApplications']=function(_0x5047e8,_0x44377a){var _0x1e6c32=_0x5047e8[_0xd99f('0x53')]['id'];var _0x1b8ffa=_0x5047e8[_0xd99f('0x57')];var _0x408c85=0xc8;var _0x14706a=null;return db[_0xd99f('0x94')][_0xd99f('0x95')]({'isolationLevel':db[_0xd99f('0x94')][_0xd99f('0x96')][_0xd99f('0x97')][_0xd99f('0x98')]},function(_0x183ed6){return db['OpenchannelAccount'][_0xd99f('0x64')]({'where':{'id':_0x1e6c32},'transaction':_0x183ed6})[_0xd99f('0x1f')](function(_0x3f9763){if(_0x3f9763){return db['OpenchannelApplication'][_0xd99f('0x32')]({'where':{'OpenchannelAccountId':_0x1e6c32},'transaction':_0x183ed6})[_0xd99f('0x1f')](function(){var _0x5c76b7=_['map'](_0x1b8ffa,function(_0x1ae9be){_0x1ae9be['OpenchannelAccountId']=_0x1e6c32;return _0x1ae9be;});return db[_0xd99f('0x7a')][_0xd99f('0x99')](_0x5c76b7,{'transaction':_0x183ed6});});}else{_0x408c85=0x194;_0x14706a=[];}});})[_0xd99f('0x1f')](function(){if(_0x408c85!==0x194){return db['OpenchannelApplication'][_0xd99f('0x9a')]({'where':{'OpenchannelAccountId':_0x1e6c32},'order':_0xd99f('0x9b')})[_0xd99f('0x1f')](function(_0x4c7121){_0x14706a=_0x4c7121;});}})['catch'](function(_0x2660f6){_0x408c85=0x1f4;logger['error'](_0x2660f6[_0xd99f('0x9c')]);if(_0x2660f6[_0xd99f('0x4d')]){delete _0x2660f6['name'];}_0x14706a=_0x2660f6;})[_0xd99f('0x9d')](function(){if(_0x14706a===null){_0x44377a[_0xd99f('0x28')](_0x408c85);}else{if(_0x408c85===0x1f4){_0x44377a[_0xd99f('0x29')](_0x408c85)[_0xd99f('0x35')](_0x14706a);}else{_0x44377a['status'](_0x408c85)[_0xd99f('0x2b')](_0x14706a);}}});};exports['getApplications']=function(_0x9ac534,_0x4fbede,_0x27ec04){var _0x144c33={};var _0x4d8b9a={};var _0x1159e8;var _0x25c584;return db[_0xd99f('0x39')][_0xd99f('0x64')]({'where':{'id':_0x9ac534[_0xd99f('0x53')]['id']}})[_0xd99f('0x1f')](handleEntityNotFound(_0x4fbede,null))[_0xd99f('0x1f')](function(_0x46b501){if(_0x46b501){_0x1159e8=_0x46b501;_0x4d8b9a[_0xd99f('0x3d')]=_[_0xd99f('0x3f')](db[_0xd99f('0x7a')][_0xd99f('0x3a')]);_0x4d8b9a[_0xd99f('0x3e')]=_[_0xd99f('0x3f')](_0x9ac534[_0xd99f('0x3e')]);_0x4d8b9a[_0xd99f('0x40')]=_[_0xd99f('0x41')](_0x4d8b9a['model'],_0x4d8b9a['query']);_0x144c33[_0xd99f('0x42')]=_[_0xd99f('0x41')](_0x4d8b9a[_0xd99f('0x3d')],qs[_0xd99f('0x43')](_0x9ac534[_0xd99f('0x3e')][_0xd99f('0x43')]));_0x144c33[_0xd99f('0x42')]=_0x144c33['attributes'][_0xd99f('0x44')]?_0x144c33[_0xd99f('0x42')]:_0x4d8b9a['model'];_0x144c33[_0xd99f('0x46')]=qs[_0xd99f('0x47')](_0x9ac534['query'][_0xd99f('0x47')]);_0x144c33[_0xd99f('0x48')]=qs[_0xd99f('0x40')](_[_0xd99f('0x49')](_0x9ac534[_0xd99f('0x3e')],_0x4d8b9a['filters']));if(_0x9ac534[_0xd99f('0x3e')][_0xd99f('0x4a')]){_0x144c33['where']=_['merge'](_0x144c33[_0xd99f('0x48')],{'$or':_[_0xd99f('0x38')](_0x144c33[_0xd99f('0x42')],function(_0x5d318f){var _0x57ca75={};_0x57ca75[_0x5d318f]={'$like':'%'+_0x9ac534[_0xd99f('0x3e')][_0xd99f('0x4a')]+'%'};return _0x57ca75;})});}_0x144c33=_['merge']({},_0x144c33,_0x9ac534[_0xd99f('0x4e')]);return _0x1159e8['getApplications'](_0x144c33);}})['then'](function(_0x2b4762){if(_0x2b4762){_0x25c584=_0x2b4762['length'];if(!_0x9ac534['query']['hasOwnProperty'](_0xd99f('0x66'))){_0x144c33[_0xd99f('0x2f')]=qs[_0xd99f('0x2f')](_0x9ac534['query'][_0xd99f('0x2f')]);_0x144c33[_0xd99f('0x2e')]=qs[_0xd99f('0x2e')](_0x9ac534[_0xd99f('0x3e')][_0xd99f('0x2e')]);}return _0x1159e8['getApplications'](_0x144c33);}})['then'](function(_0x3840a7){if(_0x3840a7){return _0x3840a7?{'count':_0x25c584,'rows':_0x3840a7}:null;}})[_0xd99f('0x1f')](respondWithResult(_0x4fbede,null))[_0xd99f('0x51')](handleError(_0x4fbede,null));};exports[_0xd99f('0x9e')]=function(_0x5e4a16,_0x52da4e,_0x205a9a){var _0x4073ba={'raw':![],'where':{}};var _0x4258ce={};var _0x3422f8={'count':0x0,'rows':[]};return db[_0xd99f('0x39')][_0xd99f('0x64')]({'where':{'id':_0x5e4a16[_0xd99f('0x53')]['id']}})[_0xd99f('0x1f')](handleEntityNotFound(_0x52da4e,null))[_0xd99f('0x1f')](function(_0x105a7e){if(_0x105a7e){_0x4258ce[_0xd99f('0x3d')]=_['keys'](db['OpenchannelInteraction'][_0xd99f('0x3a')]);_0x4258ce[_0xd99f('0x3e')]=_[_0xd99f('0x3f')](_0x5e4a16[_0xd99f('0x3e')]);_0x4258ce[_0xd99f('0x40')]=_[_0xd99f('0x41')](_0x4258ce[_0xd99f('0x3d')],_0x4258ce[_0xd99f('0x3e')]);_0x4073ba[_0xd99f('0x42')]=_[_0xd99f('0x41')](_0x4258ce[_0xd99f('0x3d')],qs[_0xd99f('0x43')](_0x5e4a16[_0xd99f('0x3e')][_0xd99f('0x43')]));_0x4073ba[_0xd99f('0x42')]=_0x4073ba[_0xd99f('0x42')]['length']?_0x4073ba['attributes']:_0x4258ce[_0xd99f('0x3d')];if(!_0x5e4a16[_0xd99f('0x3e')]['hasOwnProperty']('nolimit')){_0x4073ba[_0xd99f('0x2f')]=qs['limit'](_0x5e4a16['query'][_0xd99f('0x2f')]);_0x4073ba[_0xd99f('0x2e')]=qs[_0xd99f('0x2e')](_0x5e4a16[_0xd99f('0x3e')][_0xd99f('0x2e')]);}_0x4073ba[_0xd99f('0x46')]=qs[_0xd99f('0x47')](_0x5e4a16[_0xd99f('0x3e')][_0xd99f('0x47')]);_0x4073ba[_0xd99f('0x48')]=qs['filters'](_[_0xd99f('0x49')](_0x5e4a16[_0xd99f('0x3e')],_0x4258ce['filters']));_0x4073ba[_0xd99f('0x48')][_0xd99f('0x5c')]=_0x105a7e['id'];if(_0x5e4a16['query']['filter']){_0x4073ba[_0xd99f('0x48')]=_[_0xd99f('0x4b')](_0x4073ba[_0xd99f('0x48')],{'$or':_[_0xd99f('0x38')](_0x4073ba[_0xd99f('0x42')],function(_0x5561a7){var _0x428821={};_0x428821[_0x5561a7]={'$like':'%'+_0x5e4a16['query'][_0xd99f('0x4a')]+'%'};return _0x428821;})});}_0x4073ba=_[_0xd99f('0x4b')]({},_0x4073ba,_0x5e4a16[_0xd99f('0x4e')]);return db[_0xd99f('0x9f')][_0xd99f('0x2d')]({'where':_0x4073ba[_0xd99f('0x48')]})[_0xd99f('0x1f')](function(_0x5a7b5d){_0x3422f8['count']=_0x5a7b5d;if(_0x5e4a16[_0xd99f('0x3e')]['includeAll']){_0x4073ba[_0xd99f('0x5f')]=[{'model':db[_0xd99f('0x6a')],'as':_0xd99f('0xa0'),'required':![]},{'model':db[_0xd99f('0x8b')],'as':_0xd99f('0xa1'),'attributes':['name',_0xd99f('0xa2'),'internal'],'required':![]},{'model':db[_0xd99f('0xa3')],'as':_0xd99f('0xa4'),'attributes':['id',_0xd99f('0x4d'),_0xd99f('0xa5')],'where':_0x5e4a16[_0xd99f('0x3e')]['tag']?{'id':_0x5e4a16[_0xd99f('0x3e')][_0xd99f('0xa6')]}:undefined,'required':_0x5e4a16[_0xd99f('0x3e')][_0xd99f('0xa6')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x4073ba);})[_0xd99f('0x1f')](function(_0x32ad6c){_0x3422f8[_0xd99f('0x50')]=_0x32ad6c;return _0x3422f8;});}})[_0xd99f('0x1f')](respondWithFilteredResult(_0x52da4e,_0x4073ba))[_0xd99f('0x51')](handleError(_0x52da4e,null));};exports[_0xd99f('0xa7')]=function(_0xbf9bfa,_0x515e73,_0xd1257b){return db['OpenchannelAccount']['find']({'where':{'id':_0xbf9bfa[_0xd99f('0x53')]['id']}})[_0xd99f('0x1f')](handleEntityNotFound(_0x515e73,null))['then'](function(_0x4b8d25){if(_0x4b8d25){return _0x4b8d25['addAgents'](_0xbf9bfa['body'][_0xd99f('0x62')],_[_0xd99f('0xa8')](_0xbf9bfa[_0xd99f('0x57')],['ids','id'])||{})[_0xd99f('0x82')](function(_0x2b79e2){for(var _0x40a163=0x0;_0x40a163<_0xbf9bfa[_0xd99f('0x57')][_0xd99f('0x62')]['length'];_0x40a163+=0x1){socket[_0xd99f('0xa9')](_0xd99f('0xaa'),{'UserId':Number(_0xbf9bfa[_0xd99f('0x57')][_0xd99f('0x62')][_0x40a163]),'OpenchannelAccountId':Number(_0xbf9bfa[_0xd99f('0x53')]['id'])});}return _0x2b79e2;});}})['then'](respondWithResult(_0x515e73,null))['catch'](handleError(_0x515e73,null));};exports[_0xd99f('0xab')]=function(_0x7eafd6,_0x1ff788,_0x38168e){return db['OpenchannelAccount'][_0xd99f('0x55')]({'where':{'id':_0x7eafd6[_0xd99f('0x53')]['id']}})['then'](handleEntityNotFound(_0x1ff788,null))['then'](function(_0x4c84b5){if(_0x4c84b5){return _0x4c84b5[_0xd99f('0xab')](_0x7eafd6[_0xd99f('0x3e')][_0xd99f('0x62')])['then'](function(){if(_[_0xd99f('0xac')](_0x7eafd6[_0xd99f('0x3e')]['ids'])){for(var _0x48e1ea=0x0;_0x48e1ea<_0x7eafd6[_0xd99f('0x3e')]['ids'][_0xd99f('0x44')];_0x48e1ea+=0x1){socket[_0xd99f('0xa9')](_0xd99f('0xad'),{'UserId':Number(_0x7eafd6['query'][_0xd99f('0x62')][_0x48e1ea]),'OpenchannelAccountId':Number(_0x7eafd6[_0xd99f('0x53')]['id'])});}}else{socket[_0xd99f('0xa9')](_0xd99f('0xad'),{'UserId':Number(_0x7eafd6[_0xd99f('0x3e')]['ids']),'OpenchannelAccountId':Number(_0x7eafd6['params']['id'])});}});}})[_0xd99f('0x1f')](respondWithStatusCode(_0x1ff788,null))[_0xd99f('0x51')](handleError(_0x1ff788,null));};exports[_0xd99f('0xae')]=function(_0xe90150,_0x1c2951,_0x3222e0){var _0x392e26={};var _0x20a4c0={};var _0x8fe09e;var _0x3eba48;return db['OpenchannelAccount'][_0xd99f('0x64')]({'where':{'id':_0xe90150[_0xd99f('0x53')]['id']}})[_0xd99f('0x1f')](handleEntityNotFound(_0x1c2951,null))[_0xd99f('0x1f')](function(_0x51a0f3){if(_0x51a0f3){_0x8fe09e=_0x51a0f3;_0x20a4c0['model']=_['keys'](db[_0xd99f('0x8b')][_0xd99f('0x3a')]);_0x20a4c0['query']=_[_0xd99f('0x3f')](_0xe90150['query']);_0x20a4c0[_0xd99f('0x40')]=_[_0xd99f('0x41')](_0x20a4c0[_0xd99f('0x3d')],_0x20a4c0[_0xd99f('0x3e')]);_0x392e26[_0xd99f('0x42')]=_[_0xd99f('0x41')](_0x20a4c0['model'],qs[_0xd99f('0x43')](_0xe90150[_0xd99f('0x3e')][_0xd99f('0x43')]));_0x392e26['attributes']=_0x392e26[_0xd99f('0x42')]['length']?_0x392e26[_0xd99f('0x42')]:_0x20a4c0[_0xd99f('0x3d')];_0x392e26['order']=qs[_0xd99f('0x47')](_0xe90150[_0xd99f('0x3e')][_0xd99f('0x47')]);_0x392e26['where']=qs[_0xd99f('0x40')](_['pick'](_0xe90150[_0xd99f('0x3e')],_0x20a4c0[_0xd99f('0x40')]));if(_0xe90150[_0xd99f('0x3e')][_0xd99f('0x4a')]){_0x392e26[_0xd99f('0x48')]=_[_0xd99f('0x4b')](_0x392e26[_0xd99f('0x48')],{'$or':_[_0xd99f('0x38')](_0x392e26['attributes'],function(_0x3f88a9){var _0x1ad961={};_0x1ad961[_0x3f88a9]={'$like':'%'+_0xe90150[_0xd99f('0x3e')]['filter']+'%'};return _0x1ad961;})});}_0x392e26=_[_0xd99f('0x4b')]({},_0x392e26,_0xe90150[_0xd99f('0x4e')]);return _0x8fe09e['getAgents'](_0x392e26);}})[_0xd99f('0x1f')](function(_0x360a69){if(_0x360a69){_0x3eba48=_0x360a69[_0xd99f('0x44')];if(!_0xe90150[_0xd99f('0x3e')][_0xd99f('0x45')]('nolimit')){_0x392e26[_0xd99f('0x2f')]=qs[_0xd99f('0x2f')](_0xe90150['query']['limit']);_0x392e26[_0xd99f('0x2e')]=qs['offset'](_0xe90150[_0xd99f('0x3e')][_0xd99f('0x2e')]);}return _0x8fe09e[_0xd99f('0xae')](_0x392e26);}})[_0xd99f('0x1f')](function(_0x2b8765){if(_0x2b8765){return _0x2b8765?{'count':_0x3eba48,'rows':_0x2b8765}:null;}})[_0xd99f('0x1f')](respondWithResult(_0x1c2951,null))['catch'](handleError(_0x1c2951,null));};exports[_0xd99f('0x35')]=function(_0x2f435b,_0x2ec9e8,_0x2a2d90){var _0x1351e7,_0x45db38,_0x2b211c;if(_[_0xd99f('0x71')](_0x2f435b['body'][_0xd99f('0x57')])||_0x2f435b[_0xd99f('0x57')]['body']===''){throw new db[(_0xd99f('0x6b'))][(_0xd99f('0x6c'))](_0xd99f('0x73'));}if(_[_0xd99f('0x71')](_0x2f435b['body']['to'])){}_0x1351e7=_0x2f435b[_0xd99f('0x57')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2f435b[_0xd99f('0x53')]['id']}})[_0xd99f('0x1f')](handleEntityNotFound(_0x2ec9e8,null))['then'](function(_0x47da58){if(_0x47da58){return db[_0xd99f('0x39')][_0xd99f('0x55')]({'where':{'id':_0x47da58['id']},'include':[{'model':db[_0xd99f('0x76')],'as':'List','include':[{'model':db[_0xd99f('0x6a')],'as':_0xd99f('0x78'),'where':{[_0x47da58[_0xd99f('0x74')]]:_0x1351e7},'limit':0x1,'order':[[_0xd99f('0xaf'),'DESC']]}]}]})[_0xd99f('0x1f')](handleEntityNotFound(_0x2ec9e8,null))['then'](function(_0xc9a397){if(_0xc9a397&&_0xc9a397[_0xd99f('0x77')]){_0x45db38=_0xc9a397['get']({'plain':!![]});if(_0x45db38['List']&&_0x45db38[_0xd99f('0x77')]['Contacts']['length']){return _0x45db38[_0xd99f('0x77')][_0xd99f('0x78')][0x0];}return db[_0xd99f('0x6a')]['create'](_['defaults'](_0x2f435b['body'],{'firstName':_0x1351e7,[_0xc9a397['mapKey']]:_0x1351e7,'phone':_0x1351e7,'ListId':_0x45db38[_0xd99f('0x70')]}));}})[_0xd99f('0x1f')](handleEntityNotFound(_0x2ec9e8,null))[_0xd99f('0x1f')](function(_0x258a4a){if(_0x258a4a){_0x2b211c=_0x258a4a;return db[_0xd99f('0x9f')][_0xd99f('0x55')]({'where':{'ContactId':_0x2b211c['id'],'closed':![],'OpenchannelAccountId':_0x45db38['id']}})[_0xd99f('0x1f')](function(_0x135614){if(_0x135614){return[_0x135614,![]];}return db[_0xd99f('0x9f')][_0xd99f('0x56')]({'UserId':_0x2f435b[_0xd99f('0xb0')]['id'],'ContactId':_0x2b211c['id'],'OpenchannelAccountId':_0x45db38['id'],'lastMsgDirection':_0xd99f('0xb1'),'firstMsgDirection':_0xd99f('0xb1'),'Messages':[_[_0xd99f('0x4b')](_0x2f435b['body'],{'read':![],'body':_0x2f435b['body'][_0xd99f('0x57')],'OpenchannelAccountId':_0x45db38['id'],'UserId':_0x2f435b['user']['id'],'ContactId':_0x2b211c['id']})]},{'include':[{'model':db[_0xd99f('0xb2')],'as':_0xd99f('0xb3')}]})[_0xd99f('0x1f')](function(_0x20e61b){return[_0x20e61b,!![]];});});}})['spread'](function(_0x1b5c59,_0x175255){if(_0x175255){return _0x1b5c59;}return db[_0xd99f('0xb2')]['create'](_[_0xd99f('0x4b')](_0x2f435b['body'],{'read':![],'body':_0x2f435b[_0xd99f('0x57')][_0xd99f('0x57')],'OpenchannelAccountId':_0x45db38['id'],'OpenchannelInteractionId':_0x1b5c59['id'],'UserId':_0x2f435b[_0xd99f('0xb0')]['id'],'ContactId':_0x2b211c['id']}))[_0xd99f('0x1f')](function(_0x3e9e55){_0x1b5c59[_0xd99f('0xb4')][_0xd99f('0xb3')]=[];_0x1b5c59[_0xd99f('0xb4')][_0xd99f('0xb3')][_0xd99f('0x89')](_0x3e9e55['dataValues']);return _0x1b5c59;});});}})[_0xd99f('0x1f')](respondWithResult(_0x2ec9e8,null))[_0xd99f('0x51')](handleError(_0x2ec9e8,null));}; \ No newline at end of file +var _0xe928=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','Pause','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','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','CmList','List','DESC','Applications','account','applications','list','orderBy','Contacts','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','update','interaction','created','autoclose','close','unmanaged','AttachmentId','UserId','agent','*,*,*,*','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','priority','finally','getApplications','getInteractions','User','fullname','Tags','color','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','out','OpenchannelMessage','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','UserProfileResource','stack','name','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','query','keys'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe928,0x145));var _0x8e92=function(_0x49d033,_0x99e25a){_0x49d033=_0x49d033-0x0;var _0xaf160c=_0xe928[_0x49d033];return _0xaf160c;};'use strict';var emlformat=require(_0x8e92('0x0'));var rimraf=require(_0x8e92('0x1'));var zipdir=require(_0x8e92('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e92('0x3'));var moment=require('moment');var BPromise=require(_0x8e92('0x4'));var Mustache=require(_0x8e92('0x5'));var util=require(_0x8e92('0x6'));var path=require(_0x8e92('0x7'));var sox=require('sox');var csv=require(_0x8e92('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e92('0x9'));var _=require(_0x8e92('0xa'));var squel=require(_0x8e92('0xb'));var crypto=require(_0x8e92('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e92('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8e92('0xe'));var Papa=require(_0x8e92('0xf'));var Redis=require(_0x8e92('0x10'));var authService=require(_0x8e92('0x11'));var qs=require(_0x8e92('0x12'));var as=require(_0x8e92('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e92('0x14'))(_0x8e92('0x15'));var utils=require(_0x8e92('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8e92('0x17'));var db=require(_0x8e92('0x18'))['db'];config[_0x8e92('0x19')]=_[_0x8e92('0x1a')](config[_0x8e92('0x19')],{'host':_0x8e92('0x1b'),'port':0x18eb});var socket=require(_0x8e92('0x1c'))(new Redis(config['redis']));require(_0x8e92('0x1d'))['register'](socket);var jayson=require(_0x8e92('0x1e'));var client=jayson[_0x8e92('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x8e92('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d866f,_0x26cce1,_0x43b20e,_0x1380ef){return new BPromise(function(_0x1c4b12,_0x1a80d2){var _0x182e05=_0x1380ef||client;return _0x182e05[_0x8e92('0x20')](_0x1d866f,_0x43b20e)['then'](function(_0x3dfb4c){logger[_0x8e92('0x21')](_0x8e92('0x22'),_0x26cce1,_0x8e92('0x23'));logger[_0x8e92('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x26cce1,_0x8e92('0x23'),JSON[_0x8e92('0x25')](_0x3dfb4c));if(_0x3dfb4c['error']){if(_0x3dfb4c['error']['code']===0x1f4){logger[_0x8e92('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x26cce1,_0x3dfb4c[_0x8e92('0x26')][_0x8e92('0x27')]);return _0x1a80d2(_0x3dfb4c[_0x8e92('0x26')][_0x8e92('0x27')]);}logger[_0x8e92('0x26')](_0x8e92('0x22'),_0x26cce1,_0x3dfb4c['error']['message']);return _0x1c4b12(_0x3dfb4c['error']['message']);}else{logger[_0x8e92('0x21')](_0x8e92('0x22'),_0x26cce1,_0x8e92('0x23'));_0x1c4b12(_0x3dfb4c[_0x8e92('0x28')][_0x8e92('0x27')]);}})[_0x8e92('0x29')](function(_0x585adb){logger[_0x8e92('0x26')](_0x8e92('0x22'),_0x26cce1,_0x585adb);_0x1a80d2(_0x585adb);});});}function respondWithStatusCode(_0x12eba1,_0x127fff){_0x127fff=_0x127fff||0xcc;return function(_0x40b576){if(_0x40b576){return _0x12eba1[_0x8e92('0x2a')](_0x127fff);}return _0x12eba1['status'](_0x127fff)['end']();};}function respondWithResult(_0x510349,_0x1d3df5){_0x1d3df5=_0x1d3df5||0xc8;return function(_0x59b173){if(_0x59b173){return _0x510349[_0x8e92('0x2b')](_0x1d3df5)['json'](_0x59b173);}};}function respondWithFilteredResult(_0x3bfb1e,_0x492c89){return function(_0x208384){if(_0x208384){var _0x57c4de=typeof _0x492c89[_0x8e92('0x2c')]===_0x8e92('0x2d')&&typeof _0x492c89[_0x8e92('0x2e')]===_0x8e92('0x2d');var _0x4dd47f=_0x208384[_0x8e92('0x2f')];var _0x405df5=_0x57c4de?0x0:_0x492c89['offset'];var _0x2dbd8f=_0x57c4de?_0x208384['count']:_0x492c89[_0x8e92('0x2c')]+_0x492c89[_0x8e92('0x2e')];var _0x4fb57b;if(_0x2dbd8f>=_0x4dd47f){_0x2dbd8f=_0x4dd47f;_0x4fb57b=0xc8;}else{_0x4fb57b=0xce;}_0x3bfb1e[_0x8e92('0x2b')](_0x4fb57b);return _0x3bfb1e[_0x8e92('0x30')](_0x8e92('0x31'),_0x405df5+'-'+_0x2dbd8f+'/'+_0x4dd47f)[_0x8e92('0x32')](_0x208384);}return null;};}function patchUpdates(_0x158fb2){return function(_0x2c8d24){try{jsonpatch[_0x8e92('0x33')](_0x2c8d24,_0x158fb2,!![]);}catch(_0x29d16e){return BPromise[_0x8e92('0x34')](_0x29d16e);}return _0x2c8d24['save']();};}function saveUpdates(_0x5c6609,_0x456914){return function(_0x4ca7c7){if(_0x4ca7c7){return _0x4ca7c7['update'](_0x5c6609)[_0x8e92('0x35')](function(_0x2b0030){return _0x2b0030;});}return null;};}function removeEntity(_0x3cea2c,_0x537313){return function(_0x2fdbe5){if(_0x2fdbe5){return _0x2fdbe5[_0x8e92('0x36')]()[_0x8e92('0x35')](function(){var _0x5c462b=_0x2fdbe5['get']({'plain':!![]});var _0x42789b='OpenchannelAccounts';return db[_0x8e92('0x37')][_0x8e92('0x36')]({'where':{'type':_0x42789b,'resourceId':_0x5c462b['id']}})[_0x8e92('0x35')](function(){return _0x2fdbe5;});})[_0x8e92('0x35')](function(){_0x3cea2c[_0x8e92('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4456da,_0x207d94){return function(_0x131754){if(!_0x131754){_0x4456da['sendStatus'](0x194);}return _0x131754;};}function handleError(_0x5a5d8c,_0xa2a8a2){_0xa2a8a2=_0xa2a8a2||0x1f4;return function(_0x54e964){logger[_0x8e92('0x26')](_0x54e964[_0x8e92('0x38')]);if(_0x54e964[_0x8e92('0x39')]){delete _0x54e964[_0x8e92('0x39')];}_0x5a5d8c['status'](_0xa2a8a2)['send'](_0x54e964);};}exports['index']=function(_0x206534,_0x5c5f5d){var _0x5fa2d9={'include':[{'model':db['Pause'],'as':_0x8e92('0x3a')}]},_0x502690={},_0x4c1cc6={'count':0x0,'rows':[]};var _0x3c3d83=_[_0x8e92('0x3b')](db[_0x8e92('0x3c')][_0x8e92('0x3d')],function(_0x3f1b3b){return{'name':_0x3f1b3b['fieldName'],'type':_0x3f1b3b[_0x8e92('0x3e')][_0x8e92('0x3f')]};});_0x502690[_0x8e92('0x40')]=_[_0x8e92('0x3b')](_0x3c3d83,'name');_0x502690[_0x8e92('0x41')]=_[_0x8e92('0x42')](_0x206534['query']);_0x502690[_0x8e92('0x43')]=_[_0x8e92('0x44')](_0x502690['model'],_0x502690['query']);_0x5fa2d9[_0x8e92('0x45')]=_['intersection'](_0x502690['model'],qs[_0x8e92('0x46')](_0x206534[_0x8e92('0x41')][_0x8e92('0x46')]));_0x5fa2d9['attributes']=_0x5fa2d9[_0x8e92('0x45')][_0x8e92('0x47')]?_0x5fa2d9[_0x8e92('0x45')]:_0x502690[_0x8e92('0x40')];if(!_0x206534['query'][_0x8e92('0x48')]('nolimit')){_0x5fa2d9[_0x8e92('0x2e')]=qs[_0x8e92('0x2e')](_0x206534['query'][_0x8e92('0x2e')]);_0x5fa2d9[_0x8e92('0x2c')]=qs[_0x8e92('0x2c')](_0x206534[_0x8e92('0x41')][_0x8e92('0x2c')]);}_0x5fa2d9[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x206534[_0x8e92('0x41')][_0x8e92('0x4a')]);_0x5fa2d9[_0x8e92('0x4b')]=qs[_0x8e92('0x43')](_[_0x8e92('0x4c')](_0x206534['query'],_0x502690[_0x8e92('0x43')]),_0x3c3d83);if(_0x206534[_0x8e92('0x41')][_0x8e92('0x4d')]){_0x5fa2d9[_0x8e92('0x4b')]=_['merge'](_0x5fa2d9[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x3c3d83,function(_0x3a1003){if(_0x3a1003['type']!==_0x8e92('0x4e')){var _0x268f4c={};_0x268f4c[_0x3a1003[_0x8e92('0x39')]]={'$like':'%'+_0x206534[_0x8e92('0x41')][_0x8e92('0x4d')]+'%'};return _0x268f4c;}})});}_0x5fa2d9=_[_0x8e92('0x4f')]({},_0x5fa2d9,_0x206534[_0x8e92('0x50')]);var _0x399047={'where':_0x5fa2d9[_0x8e92('0x4b')]};return db[_0x8e92('0x3c')][_0x8e92('0x2f')](_0x399047)[_0x8e92('0x35')](function(_0x5bbe17){_0x4c1cc6[_0x8e92('0x2f')]=_0x5bbe17;if(_0x206534[_0x8e92('0x41')][_0x8e92('0x51')]){_0x5fa2d9[_0x8e92('0x52')]=[{'all':!![]}];}return db[_0x8e92('0x3c')][_0x8e92('0x53')](_0x5fa2d9);})['then'](function(_0x2baafa){_0x4c1cc6[_0x8e92('0x54')]=_0x2baafa;return _0x4c1cc6;})[_0x8e92('0x35')](respondWithFilteredResult(_0x5c5f5d,_0x5fa2d9))[_0x8e92('0x29')](handleError(_0x5c5f5d,null));};exports[_0x8e92('0x55')]=function(_0x2a7ffe,_0x2197e7){var _0x389d80={'raw':![],'where':{'id':_0x2a7ffe[_0x8e92('0x56')]['id']},'include':[{'model':db[_0x8e92('0x57')],'as':_0x8e92('0x3a')}]},_0xe37dfe={};_0xe37dfe[_0x8e92('0x40')]=_[_0x8e92('0x42')](db['OpenchannelAccount'][_0x8e92('0x3d')]);_0xe37dfe['query']=_['keys'](_0x2a7ffe[_0x8e92('0x41')]);_0xe37dfe[_0x8e92('0x43')]=_['intersection'](_0xe37dfe['model'],_0xe37dfe[_0x8e92('0x41')]);_0x389d80[_0x8e92('0x45')]=_[_0x8e92('0x44')](_0xe37dfe[_0x8e92('0x40')],qs[_0x8e92('0x46')](_0x2a7ffe[_0x8e92('0x41')][_0x8e92('0x46')]));_0x389d80[_0x8e92('0x45')]=_0x389d80[_0x8e92('0x45')][_0x8e92('0x47')]?_0x389d80[_0x8e92('0x45')]:_0xe37dfe[_0x8e92('0x40')];if(_0x2a7ffe[_0x8e92('0x41')][_0x8e92('0x51')]){_0x389d80[_0x8e92('0x52')]=[{'all':!![]}];}_0x389d80=_[_0x8e92('0x4f')]({},_0x389d80,_0x2a7ffe['options']);return db[_0x8e92('0x3c')][_0x8e92('0x58')](_0x389d80)['then'](handleEntityNotFound(_0x2197e7,null))['then'](respondWithResult(_0x2197e7,null))[_0x8e92('0x29')](handleError(_0x2197e7,null));};exports[_0x8e92('0x59')]=function(_0x2bbc65,_0x37a56b){return db[_0x8e92('0x3c')]['create'](_0x2bbc65[_0x8e92('0x5a')],{})['then'](function(_0x46b717){var _0x5d7685=_0x2bbc65[_0x8e92('0x5b')][_0x8e92('0x5c')]({'plain':!![]});if(!_0x5d7685)throw new Error(_0x8e92('0x5d'));if(_0x5d7685[_0x8e92('0x5e')]===_0x8e92('0x5b')){var _0x649e06=_0x46b717[_0x8e92('0x5c')]({'plain':!![]});var _0x38adde='OpenchannelAccounts';return db[_0x8e92('0x5f')][_0x8e92('0x58')]({'where':{'name':_0x38adde,'userProfileId':_0x5d7685[_0x8e92('0x60')]},'raw':!![]})['then'](function(_0x408e5b){if(_0x408e5b&&_0x408e5b[_0x8e92('0x61')]===0x0){return db[_0x8e92('0x37')][_0x8e92('0x59')]({'name':_0x649e06[_0x8e92('0x39')],'resourceId':_0x649e06['id'],'type':_0x408e5b[_0x8e92('0x39')],'sectionId':_0x408e5b['id']},{})[_0x8e92('0x35')](function(){return _0x46b717;});}else{return _0x46b717;}})['catch'](function(_0x20654f){logger[_0x8e92('0x26')](_0x8e92('0x62'),_0x20654f);throw _0x20654f;});}return _0x46b717;})['then'](respondWithResult(_0x37a56b,0xc9))['catch'](handleError(_0x37a56b,null));};exports['update']=function(_0x111f0a,_0x1d9ee5){if(_0x111f0a[_0x8e92('0x5a')]['id']){delete _0x111f0a[_0x8e92('0x5a')]['id'];}return db[_0x8e92('0x3c')][_0x8e92('0x58')]({'where':{'id':_0x111f0a[_0x8e92('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x8e92('0x3a')}]})[_0x8e92('0x35')](handleEntityNotFound(_0x1d9ee5,null))[_0x8e92('0x35')](saveUpdates(_0x111f0a[_0x8e92('0x5a')],null))[_0x8e92('0x35')](respondWithResult(_0x1d9ee5,null))[_0x8e92('0x29')](handleError(_0x1d9ee5,null));};exports['destroy']=function(_0x22770c,_0x12895a){return db['OpenchannelAccount'][_0x8e92('0x58')]({'where':{'id':_0x22770c['params']['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x12895a,null))[_0x8e92('0x35')](removeEntity(_0x12895a,null))[_0x8e92('0x29')](handleError(_0x12895a,null));};exports['describe']=function(_0x41cbe0,_0x389d65){return db[_0x8e92('0x3c')]['describe']()[_0x8e92('0x35')](respondWithResult(_0x389d65,null))[_0x8e92('0x29')](handleError(_0x389d65,null));};exports[_0x8e92('0x63')]=function(_0x53111a,_0x63bb98,_0x5f451e){if(_0x53111a[_0x8e92('0x5a')]['id']){delete _0x53111a[_0x8e92('0x5a')]['id'];}return db['OpenchannelAccount'][_0x8e92('0x58')]({'where':{'id':_0x53111a[_0x8e92('0x56')]['id']}})['then'](handleEntityNotFound(_0x63bb98,null))[_0x8e92('0x35')](function(_0x403d00){if(_0x403d00){_0x53111a[_0x8e92('0x5a')]['OpenchannelAccountId']=_0x403d00['id'];return db[_0x8e92('0x64')][_0x8e92('0x59')](_0x53111a[_0x8e92('0x5a')]);}})['then'](respondWithResult(_0x63bb98,null))['catch'](handleError(_0x63bb98,null));};exports[_0x8e92('0x65')]=function(_0x401087,_0x227ef4,_0x4745e6){var _0x1d4d26={'raw':![],'where':{}};var _0x5ee152={};var _0x8f07c5={'count':0x0,'rows':[]};return db[_0x8e92('0x3c')][_0x8e92('0x66')]({'where':{'id':_0x401087[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x227ef4,null))['then'](function(_0x253d61){if(_0x253d61){_0x5ee152[_0x8e92('0x40')]=_[_0x8e92('0x42')](db[_0x8e92('0x64')][_0x8e92('0x3d')]);_0x5ee152[_0x8e92('0x41')]=_[_0x8e92('0x42')](_0x401087[_0x8e92('0x41')]);_0x5ee152['filters']=_[_0x8e92('0x44')](_0x5ee152[_0x8e92('0x40')],_0x5ee152[_0x8e92('0x41')]);_0x1d4d26[_0x8e92('0x45')]=_[_0x8e92('0x44')](_0x5ee152['model'],qs[_0x8e92('0x46')](_0x401087[_0x8e92('0x41')][_0x8e92('0x46')]));_0x1d4d26[_0x8e92('0x45')]=_0x1d4d26[_0x8e92('0x45')][_0x8e92('0x47')]?_0x1d4d26[_0x8e92('0x45')]:_0x5ee152['model'];if(!_0x401087['query']['hasOwnProperty'](_0x8e92('0x67'))){_0x1d4d26[_0x8e92('0x2e')]=qs[_0x8e92('0x2e')](_0x401087[_0x8e92('0x41')][_0x8e92('0x2e')]);_0x1d4d26[_0x8e92('0x2c')]=qs[_0x8e92('0x2c')](_0x401087[_0x8e92('0x41')][_0x8e92('0x2c')]);}_0x1d4d26[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x401087['query'][_0x8e92('0x4a')]);_0x1d4d26[_0x8e92('0x4b')]=qs[_0x8e92('0x43')](_[_0x8e92('0x4c')](_0x401087[_0x8e92('0x41')],_0x5ee152[_0x8e92('0x43')]));_0x1d4d26[_0x8e92('0x4b')]['OpenchannelAccountId']=_0x253d61['id'];if(_0x401087[_0x8e92('0x41')][_0x8e92('0x4d')]){_0x1d4d26[_0x8e92('0x4b')]=_[_0x8e92('0x4f')](_0x1d4d26[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x1d4d26[_0x8e92('0x45')],function(_0x27e766){var _0xf6187={};_0xf6187[_0x27e766]={'$like':'%'+_0x401087['query'][_0x8e92('0x4d')]+'%'};return _0xf6187;})});}_0x1d4d26=_[_0x8e92('0x4f')]({},_0x1d4d26,_0x401087[_0x8e92('0x50')]);return db[_0x8e92('0x64')][_0x8e92('0x2f')]({'where':_0x1d4d26[_0x8e92('0x4b')]})[_0x8e92('0x35')](function(_0x4815c4){_0x8f07c5[_0x8e92('0x2f')]=_0x4815c4;if(_0x401087[_0x8e92('0x41')]['includeAll']){_0x1d4d26[_0x8e92('0x52')]=[{'all':!![]}];}return db[_0x8e92('0x64')]['findAll'](_0x1d4d26);})[_0x8e92('0x35')](function(_0x4d4b58){_0x8f07c5[_0x8e92('0x54')]=_0x4d4b58;return _0x8f07c5;});}})[_0x8e92('0x35')](respondWithFilteredResult(_0x227ef4,_0x1d4d26))['catch'](handleError(_0x227ef4,null));};exports['removeDispositions']=function(_0x4a79d8,_0x40508b,_0x3c46ff){return db[_0x8e92('0x3c')]['find']({'where':{'id':_0x4a79d8[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x40508b,null))['then'](function(_0x449d3a){if(_0x449d3a){return _0x449d3a[_0x8e92('0x68')](_0x4a79d8[_0x8e92('0x41')][_0x8e92('0x69')]);}})[_0x8e92('0x35')](respondWithStatusCode(_0x40508b,null))[_0x8e92('0x29')](handleError(_0x40508b,null));};exports[_0x8e92('0x6a')]=function(_0x43b423,_0x4e19c1,_0x2c9e0f){if(_0x43b423[_0x8e92('0x5a')]['id']){delete _0x43b423[_0x8e92('0x5a')]['id'];}return db['OpenchannelAccount'][_0x8e92('0x58')]({'where':{'id':_0x43b423[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x4e19c1,null))['then'](function(_0x257229){if(_0x257229){_0x43b423[_0x8e92('0x5a')][_0x8e92('0x6b')]=_0x257229['id'];return db[_0x8e92('0x6c')][_0x8e92('0x59')](_0x43b423[_0x8e92('0x5a')]);}})[_0x8e92('0x35')](respondWithResult(_0x4e19c1,null))[_0x8e92('0x29')](handleError(_0x4e19c1,null));};exports[_0x8e92('0x6d')]=function(_0x256d1a,_0x3c7c50,_0x2467b1){var _0x47a6dc={'raw':![],'where':{}};var _0x5a02e2={};var _0x5f1a68={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x8e92('0x66')]({'where':{'id':_0x256d1a[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x3c7c50,null))[_0x8e92('0x35')](function(_0x1462d8){if(_0x1462d8){_0x5a02e2[_0x8e92('0x40')]=_['keys'](db[_0x8e92('0x6c')][_0x8e92('0x3d')]);_0x5a02e2['query']=_[_0x8e92('0x42')](_0x256d1a[_0x8e92('0x41')]);_0x5a02e2[_0x8e92('0x43')]=_['intersection'](_0x5a02e2[_0x8e92('0x40')],_0x5a02e2[_0x8e92('0x41')]);_0x47a6dc[_0x8e92('0x45')]=_['intersection'](_0x5a02e2[_0x8e92('0x40')],qs[_0x8e92('0x46')](_0x256d1a[_0x8e92('0x41')][_0x8e92('0x46')]));_0x47a6dc['attributes']=_0x47a6dc[_0x8e92('0x45')][_0x8e92('0x47')]?_0x47a6dc[_0x8e92('0x45')]:_0x5a02e2[_0x8e92('0x40')];if(!_0x256d1a[_0x8e92('0x41')][_0x8e92('0x48')](_0x8e92('0x67'))){_0x47a6dc[_0x8e92('0x2e')]=qs[_0x8e92('0x2e')](_0x256d1a[_0x8e92('0x41')][_0x8e92('0x2e')]);_0x47a6dc[_0x8e92('0x2c')]=qs[_0x8e92('0x2c')](_0x256d1a[_0x8e92('0x41')][_0x8e92('0x2c')]);}_0x47a6dc[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x256d1a[_0x8e92('0x41')][_0x8e92('0x4a')]);_0x47a6dc[_0x8e92('0x4b')]=qs['filters'](_[_0x8e92('0x4c')](_0x256d1a['query'],_0x5a02e2[_0x8e92('0x43')]));_0x47a6dc[_0x8e92('0x4b')][_0x8e92('0x6b')]=_0x1462d8['id'];if(_0x256d1a['query']['filter']){_0x47a6dc[_0x8e92('0x4b')]=_['merge'](_0x47a6dc[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x47a6dc[_0x8e92('0x45')],function(_0x4eb28c){var _0x927d2b={};_0x927d2b[_0x4eb28c]={'$like':'%'+_0x256d1a['query'][_0x8e92('0x4d')]+'%'};return _0x927d2b;})});}_0x47a6dc=_[_0x8e92('0x4f')]({},_0x47a6dc,_0x256d1a['options']);return db[_0x8e92('0x6c')][_0x8e92('0x2f')]({'where':_0x47a6dc['where']})[_0x8e92('0x35')](function(_0x597efe){_0x5f1a68[_0x8e92('0x2f')]=_0x597efe;if(_0x256d1a[_0x8e92('0x41')][_0x8e92('0x51')]){_0x47a6dc[_0x8e92('0x52')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x47a6dc);})[_0x8e92('0x35')](function(_0x404b0d){_0x5f1a68['rows']=_0x404b0d;return _0x5f1a68;});}})['then'](respondWithFilteredResult(_0x3c7c50,_0x47a6dc))[_0x8e92('0x29')](handleError(_0x3c7c50,null));};exports['removeAnswers']=function(_0xd321e2,_0x358808,_0x1552ce){return db[_0x8e92('0x3c')][_0x8e92('0x58')]({'where':{'id':_0xd321e2['params']['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x358808,null))[_0x8e92('0x35')](function(_0x4fa4bf){if(_0x4fa4bf){return _0x4fa4bf[_0x8e92('0x6e')](_0xd321e2[_0x8e92('0x41')]['ids']);}})[_0x8e92('0x35')](respondWithStatusCode(_0x358808,null))[_0x8e92('0x29')](handleError(_0x358808,null));};exports[_0x8e92('0x6f')]=function(_0x4c1426,_0x4d43c4,_0x15cd97){var _0x4de8f={'body':_0x4c1426[_0x8e92('0x5a')],'channel':_0x8e92('0x70')};var _0x2568b7=[];var _0x474d29=[];var _0xf0507e={};var _0x655a29=![];return db[_0x8e92('0x71')][_0x8e92('0x72')]()[_0x8e92('0x35')](function(_0x2b2b3f){if(!_0x2b2b3f){throw new db[(_0x8e92('0x73'))][(_0x8e92('0x74'))](_0x8e92('0x75'));}_0x2568b7=_[_0x8e92('0x76')](_['keys'](_0x2b2b3f),['createdAt',_0x8e92('0x77')]);_0x474d29=_[_0x8e92('0x76')](_['keys'](_0x2b2b3f),[_0x8e92('0x78'),_0x8e92('0x77'),_0x8e92('0x79'),_0x8e92('0x7a')]);if(_0x4c1426['body']['id']){delete _0x4c1426[_0x8e92('0x5a')]['id'];}if(_[_0x8e92('0x7b')](_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x7c')])){throw new db[(_0x8e92('0x73'))]['ValidationError'](_0x8e92('0x7d'));}if(_[_0x8e92('0x7b')](_0x4c1426[_0x8e92('0x5a')]['body'])||_0x4c1426[_0x8e92('0x5a')]['body']===''){throw new db[(_0x8e92('0x73'))][(_0x8e92('0x74'))](_0x8e92('0x7e'));}if(_[_0x8e92('0x7b')](_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x7f')])){throw new db['Sequelize'][(_0x8e92('0x74'))](_0x8e92('0x80')+_0x474d29);}if(!_[_0x8e92('0x81')](_0x474d29,_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x7f')])){throw new db[(_0x8e92('0x73'))]['ValidationError'](_0x8e92('0x82')+_0x474d29);}_0xf0507e[_0x4c1426['body'][_0x8e92('0x7f')]]=_0x4c1426['body']['from'];})[_0x8e92('0x35')](function(){return db[_0x8e92('0x3c')][_0x8e92('0x58')]({'where':{'id':_0x4c1426[_0x8e92('0x56')]['id']},'include':[{'model':db[_0x8e92('0x83')],'as':_0x8e92('0x84'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xf0507e,'limit':0x1,'order':[[_0x8e92('0x77'),_0x8e92('0x85')]]}]},{'model':db['OpenchannelApplication'],'as':_0x8e92('0x86')}]});})['then'](handleEntityNotFound(_0x4d43c4,null))[_0x8e92('0x35')](function(_0x47a717){if(_0x47a717&&_0x47a717[_0x8e92('0x84')]){_0x4de8f[_0x8e92('0x87')]=_0x47a717;_0x4de8f[_0x8e92('0x88')]=_0x47a717[_0x8e92('0x86')];_0x4de8f[_0x8e92('0x89')]=_0x47a717[_0x8e92('0x84')];_0x4de8f[_0x8e92('0x88')]=_[_0x8e92('0x8a')](_0x4de8f[_0x8e92('0x88')],['priority'],['asc']);if(_0x4de8f[_0x8e92('0x87')][_0x8e92('0x86')]){delete _0x4de8f['account']['Applications'];}if(_0x4de8f[_0x8e92('0x87')]['List']&&_0x4de8f[_0x8e92('0x87')][_0x8e92('0x84')][_0x8e92('0x8b')]['length']){return _0x4de8f[_0x8e92('0x87')]['List'][_0x8e92('0x8b')][0x0];}var _0x2cfcfc=_[_0x8e92('0x1a')](_0x4c1426['body'],{'firstName':_0x4c1426[_0x8e92('0x5a')]['from'],'ListId':_0x47a717['ListId']});_0x2cfcfc[_0x4c1426['body'][_0x8e92('0x7f')]]=_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x7c')];return db['CmContact'][_0x8e92('0x59')](_0x2cfcfc,{'fields':_0x2568b7,'raw':!![]});}})[_0x8e92('0x35')](handleEntityNotFound(_0x4d43c4,null))[_0x8e92('0x35')](function(_0x5880ea){_0x4de8f['contact']=_0x5880ea;if(_0x5880ea){var _0x3841fc={'ContactId':_0x5880ea['id'],'OpenchannelAccountId':_0x4c1426[_0x8e92('0x56')]['id'],'from':(_0x5880ea[_0x8e92('0x8c')]||'')+'\x20'+(_0x5880ea[_0x8e92('0x8d')]||'')};var _0x20e50a={'OpenchannelAccountId':_0x4c1426[_0x8e92('0x56')]['id'],'closed':![]};if(_0x4c1426['body'][_0x8e92('0x8e')]){_0x20e50a[_0x8e92('0x8e')]=_0x4c1426['body'][_0x8e92('0x8e')];return db[_0x8e92('0x8f')][_0x8e92('0x58')]({'where':_0x20e50a})[_0x8e92('0x35')](function(_0x86bd10){if(_0x86bd10){return[_0x86bd10,![]];}_0x3841fc[_0x8e92('0x8e')]=_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x8e')];_0x3841fc[_0x8e92('0x90')]=_0x4c1426[_0x8e92('0x5a')]['externalUrl'];return db[_0x8e92('0x8f')][_0x8e92('0x59')](_0x3841fc)[_0x8e92('0x35')](function(_0x253362){return[_0x253362,!![]];});});}else{_0x20e50a[_0x8e92('0x8e')]=null;}_0x20e50a[_0x8e92('0x91')]=_0x5880ea['id'];return db[_0x8e92('0x8f')][_0x8e92('0x58')]({'where':_0x20e50a})['then'](function(_0x4c3b0f){if(_0x4c3b0f){return[_0x4c3b0f,![]];}return db[_0x8e92('0x8f')][_0x8e92('0x59')](_0x3841fc)[_0x8e92('0x35')](function(_0x4c61a7){return[_0x4c61a7,!![]];});});}})[_0x8e92('0x92')](function(_0x2e6119,_0x45a39d){if(_0x2e6119){_0x655a29=_0x45a39d;if(!_0x45a39d){var _0x1f86a2={'from':(_0x4de8f[_0x8e92('0x93')][_0x8e92('0x8c')]||'')+'\x20'+(_0x4de8f['contact'][_0x8e92('0x8d')]||'')};if(_0x4c1426['body'][_0x8e92('0x8e')]&&_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x94')]&&_0x4c1426['body'][_0x8e92('0x8e')]!=_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x94')]){_0x1f86a2[_0x8e92('0x8e')]=_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x94')];}return _0x2e6119[_0x8e92('0x95')](_0x1f86a2);}else{return _0x2e6119;}}})[_0x8e92('0x35')](function(_0x3af9d8){_0x4de8f[_0x8e92('0x96')]=_0x3af9d8['get']({'plain':!![]});_0x4de8f['interaction'][_0x8e92('0x97')]=_0x655a29;if(_0x4de8f[_0x8e92('0x96')][_0x8e92('0x97')]){if(_0x4de8f[_0x8e92('0x87')][_0x8e92('0x98')]){_0x4de8f[_0x8e92('0x88')]['push']({'id':0x0,'priority':_0x4de8f[_0x8e92('0x88')][_0x8e92('0x47')]+0x1,'app':_0x8e92('0x99'),'appdata':_0x8e92('0x9a'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x8e92('0x59')]({'body':_0x4c1426['body'][_0x8e92('0x5a')],'OpenchannelAccountId':_0x4c1426[_0x8e92('0x56')]['id'],'OpenchannelInteractionId':_0x3af9d8['id'],'direction':'in','ContactId':_0x4de8f[_0x8e92('0x93')]['id'],'AttachmentId':_0x4c1426['body'][_0x8e92('0x9b')]});})['then'](function(_0x5ea555){_0x4de8f[_0x8e92('0x27')]=_0x5ea555;if(!_0x4de8f['interaction'][_0x8e92('0x9c')])return;return db['User'][_0x8e92('0x58')]({'attributes':['id',_0x8e92('0x39')],'where':{'id':_0x4de8f[_0x8e92('0x96')][_0x8e92('0x9c')]}});})['then'](function(_0x14e746){if(_0x14e746){_0x4de8f[_0x8e92('0x88')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8e92('0x9d'),'appdata':_0x14e746[_0x8e92('0x39')]+','+(_0x4de8f[_0x8e92('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0x8e92('0x9e')});}if(!_0x4de8f[_0x8e92('0x96')][_0x8e92('0x9f')])return;return db[_0x8e92('0xa0')]['find']({'attributes':['id',_0x8e92('0x39')],'where':{'id':_0x4de8f[_0x8e92('0x96')][_0x8e92('0x9f')]}});})['then'](function(_0x52d2){if(_0x52d2){_0x4de8f['applications'][_0x8e92('0xa1')]({'id':0x0,'priority':0x1,'app':_0x8e92('0xa2'),'appdata':_0x52d2[_0x8e92('0x39')]+','+(_0x4de8f[_0x8e92('0x87')][_0x8e92('0xa3')]||0x12c),'interval':_0x8e92('0x9e')});}return respondWithRpcPromise(_0x8e92('0xa4'),_0x8e92('0xa5'),_0x4de8f);})[_0x8e92('0x35')](function(_0x3a5d78){respondWithRpcPromise(_0x8e92('0xa6'),_0x8e92('0xa6'),{'event':_0x8e92('0x6f'),'message':_0x3a5d78},client9002);return _0x3a5d78;})[_0x8e92('0x35')](respondWithResult(_0x4d43c4,null))[_0x8e92('0x29')](handleError(_0x4d43c4,null));};exports[_0x8e92('0xa7')]=function(_0xb9587,_0x2dfe61){var _0x3aa962=_0xb9587[_0x8e92('0x56')]['id'];var _0x3ac70c=_0xb9587[_0x8e92('0x5a')];var _0xab7bf5=0xc8;var _0x41b5f=null;return db['sequelize'][_0x8e92('0xa8')]({'isolationLevel':db[_0x8e92('0xa9')][_0x8e92('0xaa')][_0x8e92('0xab')][_0x8e92('0xac')]},function(_0x2d1cd4){return db[_0x8e92('0x3c')]['findOne']({'where':{'id':_0x3aa962},'transaction':_0x2d1cd4})[_0x8e92('0x35')](function(_0x2c8411){if(_0x2c8411){return db[_0x8e92('0xad')][_0x8e92('0x36')]({'where':{'OpenchannelAccountId':_0x3aa962},'transaction':_0x2d1cd4})[_0x8e92('0x35')](function(){var _0x1f8513=_[_0x8e92('0x3b')](_0x3ac70c,function(_0x391be3){_0x391be3[_0x8e92('0x6b')]=_0x3aa962;return _0x391be3;});return db[_0x8e92('0xad')]['bulkCreate'](_0x1f8513,{'transaction':_0x2d1cd4});});}else{_0xab7bf5=0x194;_0x41b5f=[];}});})['then'](function(){if(_0xab7bf5!==0x194){return db['OpenchannelApplication'][_0x8e92('0xae')]({'where':{'OpenchannelAccountId':_0x3aa962},'order':_0x8e92('0xaf')})[_0x8e92('0x35')](function(_0x1de4a3){_0x41b5f=_0x1de4a3;});}})['catch'](function(_0x2ba2f2){_0xab7bf5=0x1f4;logger['error'](_0x2ba2f2['stack']);if(_0x2ba2f2[_0x8e92('0x39')]){delete _0x2ba2f2[_0x8e92('0x39')];}_0x41b5f=_0x2ba2f2;})[_0x8e92('0xb0')](function(){if(_0x41b5f===null){_0x2dfe61[_0x8e92('0x2a')](_0xab7bf5);}else{if(_0xab7bf5===0x1f4){_0x2dfe61['status'](_0xab7bf5)['send'](_0x41b5f);}else{_0x2dfe61[_0x8e92('0x2b')](_0xab7bf5)['json'](_0x41b5f);}}});};exports[_0x8e92('0xb1')]=function(_0x19b911,_0x33e1ac,_0x6b7118){var _0x57d52a={};var _0x17d031={};var _0x1ca0e5;var _0x41fee4;return db[_0x8e92('0x3c')][_0x8e92('0x66')]({'where':{'id':_0x19b911[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x33e1ac,null))[_0x8e92('0x35')](function(_0x46d558){if(_0x46d558){_0x1ca0e5=_0x46d558;_0x17d031[_0x8e92('0x40')]=_[_0x8e92('0x42')](db['OpenchannelApplication']['rawAttributes']);_0x17d031['query']=_[_0x8e92('0x42')](_0x19b911[_0x8e92('0x41')]);_0x17d031[_0x8e92('0x43')]=_[_0x8e92('0x44')](_0x17d031[_0x8e92('0x40')],_0x17d031[_0x8e92('0x41')]);_0x57d52a[_0x8e92('0x45')]=_[_0x8e92('0x44')](_0x17d031[_0x8e92('0x40')],qs[_0x8e92('0x46')](_0x19b911['query'][_0x8e92('0x46')]));_0x57d52a[_0x8e92('0x45')]=_0x57d52a[_0x8e92('0x45')][_0x8e92('0x47')]?_0x57d52a['attributes']:_0x17d031[_0x8e92('0x40')];_0x57d52a[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x19b911[_0x8e92('0x41')]['sort']);_0x57d52a[_0x8e92('0x4b')]=qs[_0x8e92('0x43')](_['pick'](_0x19b911[_0x8e92('0x41')],_0x17d031[_0x8e92('0x43')]));if(_0x19b911['query'][_0x8e92('0x4d')]){_0x57d52a[_0x8e92('0x4b')]=_['merge'](_0x57d52a[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x57d52a[_0x8e92('0x45')],function(_0x3f4c7e){var _0x2b1c7a={};_0x2b1c7a[_0x3f4c7e]={'$like':'%'+_0x19b911[_0x8e92('0x41')][_0x8e92('0x4d')]+'%'};return _0x2b1c7a;})});}_0x57d52a=_['merge']({},_0x57d52a,_0x19b911[_0x8e92('0x50')]);return _0x1ca0e5[_0x8e92('0xb1')](_0x57d52a);}})[_0x8e92('0x35')](function(_0x5ccf89){if(_0x5ccf89){_0x41fee4=_0x5ccf89[_0x8e92('0x47')];if(!_0x19b911[_0x8e92('0x41')][_0x8e92('0x48')]('nolimit')){_0x57d52a[_0x8e92('0x2e')]=qs['limit'](_0x19b911[_0x8e92('0x41')][_0x8e92('0x2e')]);_0x57d52a[_0x8e92('0x2c')]=qs[_0x8e92('0x2c')](_0x19b911['query'][_0x8e92('0x2c')]);}return _0x1ca0e5[_0x8e92('0xb1')](_0x57d52a);}})[_0x8e92('0x35')](function(_0xd5f67c){if(_0xd5f67c){return _0xd5f67c?{'count':_0x41fee4,'rows':_0xd5f67c}:null;}})['then'](respondWithResult(_0x33e1ac,null))[_0x8e92('0x29')](handleError(_0x33e1ac,null));};exports[_0x8e92('0xb2')]=function(_0x33e535,_0x2c5f16,_0xacd1c4){var _0x103b88={'raw':![],'where':{}};var _0x4aaef4={};var _0x585c65={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x33e535[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x2c5f16,null))[_0x8e92('0x35')](function(_0x5b2018){if(_0x5b2018){_0x4aaef4['model']=_[_0x8e92('0x42')](db[_0x8e92('0x8f')][_0x8e92('0x3d')]);_0x4aaef4[_0x8e92('0x41')]=_['keys'](_0x33e535[_0x8e92('0x41')]);_0x4aaef4['filters']=_[_0x8e92('0x44')](_0x4aaef4[_0x8e92('0x40')],_0x4aaef4[_0x8e92('0x41')]);_0x103b88[_0x8e92('0x45')]=_[_0x8e92('0x44')](_0x4aaef4['model'],qs['fields'](_0x33e535['query'][_0x8e92('0x46')]));_0x103b88[_0x8e92('0x45')]=_0x103b88[_0x8e92('0x45')][_0x8e92('0x47')]?_0x103b88[_0x8e92('0x45')]:_0x4aaef4[_0x8e92('0x40')];if(!_0x33e535[_0x8e92('0x41')]['hasOwnProperty']('nolimit')){_0x103b88['limit']=qs[_0x8e92('0x2e')](_0x33e535[_0x8e92('0x41')]['limit']);_0x103b88['offset']=qs['offset'](_0x33e535[_0x8e92('0x41')]['offset']);}_0x103b88[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x33e535[_0x8e92('0x41')][_0x8e92('0x4a')]);_0x103b88[_0x8e92('0x4b')]=qs[_0x8e92('0x43')](_['pick'](_0x33e535['query'],_0x4aaef4[_0x8e92('0x43')]));_0x103b88[_0x8e92('0x4b')][_0x8e92('0x6b')]=_0x5b2018['id'];if(_0x33e535[_0x8e92('0x41')][_0x8e92('0x4d')]){_0x103b88['where']=_[_0x8e92('0x4f')](_0x103b88[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x103b88[_0x8e92('0x45')],function(_0x224685){var _0x4e62ae={};_0x4e62ae[_0x224685]={'$like':'%'+_0x33e535[_0x8e92('0x41')]['filter']+'%'};return _0x4e62ae;})});}_0x103b88=_[_0x8e92('0x4f')]({},_0x103b88,_0x33e535[_0x8e92('0x50')]);return db[_0x8e92('0x8f')]['count']({'where':_0x103b88['where']})[_0x8e92('0x35')](function(_0x5010ab){_0x585c65[_0x8e92('0x2f')]=_0x5010ab;if(_0x33e535[_0x8e92('0x41')][_0x8e92('0x51')]){_0x103b88['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x8e92('0xb3')],'as':'Owner','attributes':['name',_0x8e92('0xb4'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x8e92('0xb5'),'attributes':['id',_0x8e92('0x39'),_0x8e92('0xb6')],'where':_0x33e535['query'][_0x8e92('0xb7')]?{'id':_0x33e535[_0x8e92('0x41')][_0x8e92('0xb7')]}:undefined,'required':_0x33e535[_0x8e92('0x41')][_0x8e92('0xb7')]?!![]:![]}];}return db[_0x8e92('0x8f')]['findAll'](_0x103b88);})[_0x8e92('0x35')](function(_0x4a105e){_0x585c65[_0x8e92('0x54')]=_0x4a105e;return _0x585c65;});}})[_0x8e92('0x35')](respondWithFilteredResult(_0x2c5f16,_0x103b88))[_0x8e92('0x29')](handleError(_0x2c5f16,null));};exports[_0x8e92('0xb8')]=function(_0x153f63,_0x351579,_0x1b6186){return db[_0x8e92('0x3c')][_0x8e92('0x58')]({'where':{'id':_0x153f63[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x351579,null))[_0x8e92('0x35')](function(_0x596fd0){if(_0x596fd0){return _0x596fd0['addAgents'](_0x153f63[_0x8e92('0x5a')]['ids'],_['omit'](_0x153f63[_0x8e92('0x5a')],[_0x8e92('0x69'),'id'])||{})[_0x8e92('0x92')](function(_0x4e5439){for(var _0x302c28=0x0;_0x302c28<_0x153f63[_0x8e92('0x5a')][_0x8e92('0x69')]['length'];_0x302c28+=0x1){socket[_0x8e92('0xb9')]('userOpenchannelAccount:save',{'UserId':Number(_0x153f63['body']['ids'][_0x302c28]),'OpenchannelAccountId':Number(_0x153f63[_0x8e92('0x56')]['id'])});}return _0x4e5439;});}})[_0x8e92('0x35')](respondWithResult(_0x351579,null))[_0x8e92('0x29')](handleError(_0x351579,null));};exports[_0x8e92('0xba')]=function(_0x5d7bf4,_0x34f9e3,_0x5abbba){return db[_0x8e92('0x3c')]['find']({'where':{'id':_0x5d7bf4[_0x8e92('0x56')]['id']}})['then'](handleEntityNotFound(_0x34f9e3,null))[_0x8e92('0x35')](function(_0xd0999a){if(_0xd0999a){return _0xd0999a['removeAgents'](_0x5d7bf4[_0x8e92('0x41')]['ids'])[_0x8e92('0x35')](function(){if(_[_0x8e92('0xbb')](_0x5d7bf4['query'][_0x8e92('0x69')])){for(var _0x4f15a4=0x0;_0x4f15a4<_0x5d7bf4['query'][_0x8e92('0x69')][_0x8e92('0x47')];_0x4f15a4+=0x1){socket[_0x8e92('0xb9')](_0x8e92('0xbc'),{'UserId':Number(_0x5d7bf4[_0x8e92('0x41')][_0x8e92('0x69')][_0x4f15a4]),'OpenchannelAccountId':Number(_0x5d7bf4[_0x8e92('0x56')]['id'])});}}else{socket['emit'](_0x8e92('0xbc'),{'UserId':Number(_0x5d7bf4[_0x8e92('0x41')][_0x8e92('0x69')]),'OpenchannelAccountId':Number(_0x5d7bf4[_0x8e92('0x56')]['id'])});}});}})[_0x8e92('0x35')](respondWithStatusCode(_0x34f9e3,null))[_0x8e92('0x29')](handleError(_0x34f9e3,null));};exports[_0x8e92('0xbd')]=function(_0x42ef51,_0x862c72,_0x5ccdd9){var _0x2ea8a7={};var _0x3f7175={};var _0x43d4c9;var _0x541b04;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x42ef51[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x862c72,null))['then'](function(_0x27a0c1){if(_0x27a0c1){_0x43d4c9=_0x27a0c1;_0x3f7175[_0x8e92('0x40')]=_['keys'](db['User'][_0x8e92('0x3d')]);_0x3f7175['query']=_[_0x8e92('0x42')](_0x42ef51['query']);_0x3f7175['filters']=_[_0x8e92('0x44')](_0x3f7175['model'],_0x3f7175[_0x8e92('0x41')]);_0x2ea8a7[_0x8e92('0x45')]=_[_0x8e92('0x44')](_0x3f7175['model'],qs[_0x8e92('0x46')](_0x42ef51[_0x8e92('0x41')]['fields']));_0x2ea8a7[_0x8e92('0x45')]=_0x2ea8a7[_0x8e92('0x45')][_0x8e92('0x47')]?_0x2ea8a7[_0x8e92('0x45')]:_0x3f7175[_0x8e92('0x40')];_0x2ea8a7[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x42ef51['query'][_0x8e92('0x4a')]);_0x2ea8a7['where']=qs[_0x8e92('0x43')](_['pick'](_0x42ef51[_0x8e92('0x41')],_0x3f7175['filters']));if(_0x42ef51['query'][_0x8e92('0x4d')]){_0x2ea8a7[_0x8e92('0x4b')]=_['merge'](_0x2ea8a7[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x2ea8a7[_0x8e92('0x45')],function(_0xf6a729){var _0x522c97={};_0x522c97[_0xf6a729]={'$like':'%'+_0x42ef51['query']['filter']+'%'};return _0x522c97;})});}_0x2ea8a7=_[_0x8e92('0x4f')]({},_0x2ea8a7,_0x42ef51[_0x8e92('0x50')]);return _0x43d4c9[_0x8e92('0xbd')](_0x2ea8a7);}})[_0x8e92('0x35')](function(_0x45b10c){if(_0x45b10c){_0x541b04=_0x45b10c[_0x8e92('0x47')];if(!_0x42ef51[_0x8e92('0x41')]['hasOwnProperty'](_0x8e92('0x67'))){_0x2ea8a7[_0x8e92('0x2e')]=qs[_0x8e92('0x2e')](_0x42ef51[_0x8e92('0x41')][_0x8e92('0x2e')]);_0x2ea8a7[_0x8e92('0x2c')]=qs[_0x8e92('0x2c')](_0x42ef51['query'][_0x8e92('0x2c')]);}return _0x43d4c9[_0x8e92('0xbd')](_0x2ea8a7);}})['then'](function(_0x2ad425){if(_0x2ad425){return _0x2ad425?{'count':_0x541b04,'rows':_0x2ad425}:null;}})[_0x8e92('0x35')](respondWithResult(_0x862c72,null))[_0x8e92('0x29')](handleError(_0x862c72,null));};exports[_0x8e92('0xbe')]=function(_0x79664b,_0x52e93a,_0x56ce24){var _0x2aaa95,_0x4b41e6,_0x48e96e;if(_[_0x8e92('0x7b')](_0x79664b[_0x8e92('0x5a')][_0x8e92('0x5a')])||_0x79664b[_0x8e92('0x5a')]['body']===''){throw new db[(_0x8e92('0x73'))][(_0x8e92('0x74'))](_0x8e92('0x7e'));}if(_[_0x8e92('0x7b')](_0x79664b[_0x8e92('0x5a')]['to'])){}_0x2aaa95=_0x79664b[_0x8e92('0x5a')]['to'];return db[_0x8e92('0x3c')][_0x8e92('0x66')]({'where':{'id':_0x79664b['params']['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x52e93a,null))[_0x8e92('0x35')](function(_0x55a85f){if(_0x55a85f){return db['OpenchannelAccount'][_0x8e92('0x58')]({'where':{'id':_0x55a85f['id']},'include':[{'model':db[_0x8e92('0x83')],'as':'List','include':[{'model':db['CmContact'],'as':_0x8e92('0x8b'),'where':{[_0x55a85f[_0x8e92('0x7f')]]:_0x2aaa95},'limit':0x1,'order':[['updatedAt',_0x8e92('0x85')]]}]}]})[_0x8e92('0x35')](handleEntityNotFound(_0x52e93a,null))[_0x8e92('0x35')](function(_0x24dc00){if(_0x24dc00&&_0x24dc00['List']){_0x4b41e6=_0x24dc00[_0x8e92('0x5c')]({'plain':!![]});if(_0x4b41e6[_0x8e92('0x84')]&&_0x4b41e6[_0x8e92('0x84')][_0x8e92('0x8b')][_0x8e92('0x47')]){return _0x4b41e6[_0x8e92('0x84')][_0x8e92('0x8b')][0x0];}return db[_0x8e92('0x71')][_0x8e92('0x59')](_[_0x8e92('0x1a')](_0x79664b[_0x8e92('0x5a')],{'firstName':_0x2aaa95,[_0x24dc00[_0x8e92('0x7f')]]:_0x2aaa95,'phone':_0x2aaa95,'ListId':_0x4b41e6[_0x8e92('0x7a')]}));}})[_0x8e92('0x35')](handleEntityNotFound(_0x52e93a,null))[_0x8e92('0x35')](function(_0x4a1b8f){if(_0x4a1b8f){_0x48e96e=_0x4a1b8f;return db['OpenchannelInteraction'][_0x8e92('0x58')]({'where':{'ContactId':_0x48e96e['id'],'closed':![],'OpenchannelAccountId':_0x4b41e6['id']}})['then'](function(_0x13698f){if(_0x13698f){return[_0x13698f,![]];}return db[_0x8e92('0x8f')][_0x8e92('0x59')]({'UserId':_0x79664b[_0x8e92('0x5b')]['id'],'ContactId':_0x48e96e['id'],'OpenchannelAccountId':_0x4b41e6['id'],'lastMsgDirection':_0x8e92('0xbf'),'firstMsgDirection':'out','Messages':[_['merge'](_0x79664b[_0x8e92('0x5a')],{'read':![],'body':_0x79664b[_0x8e92('0x5a')][_0x8e92('0x5a')],'OpenchannelAccountId':_0x4b41e6['id'],'UserId':_0x79664b['user']['id'],'ContactId':_0x48e96e['id']})]},{'include':[{'model':db[_0x8e92('0xc0')],'as':_0x8e92('0xc1')}]})[_0x8e92('0x35')](function(_0x32bcbd){return[_0x32bcbd,!![]];});});}})[_0x8e92('0x92')](function(_0x5b8b9c,_0x41ce38){if(_0x41ce38){return _0x5b8b9c;}return db[_0x8e92('0xc0')][_0x8e92('0x59')](_[_0x8e92('0x4f')](_0x79664b[_0x8e92('0x5a')],{'read':![],'body':_0x79664b[_0x8e92('0x5a')][_0x8e92('0x5a')],'OpenchannelAccountId':_0x4b41e6['id'],'OpenchannelInteractionId':_0x5b8b9c['id'],'UserId':_0x79664b[_0x8e92('0x5b')]['id'],'ContactId':_0x48e96e['id']}))[_0x8e92('0x35')](function(_0x45ac36){_0x5b8b9c[_0x8e92('0xc2')]['Messages']=[];_0x5b8b9c[_0x8e92('0xc2')][_0x8e92('0xc1')][_0x8e92('0xc3')](_0x45ac36[_0x8e92('0xc2')]);return _0x5b8b9c;});});}})[_0x8e92('0x35')](respondWithResult(_0x52e93a,null))['catch'](handleError(_0x52e93a,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 91711c5..ec08007 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 _0x5ff3=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','update','remove'];(function(_0x2c5a74,_0x16d9b5){var _0x4aad9f=function(_0x3639f1){while(--_0x3639f1){_0x2c5a74['push'](_0x2c5a74['shift']());}};_0x4aad9f(++_0x16d9b5);}(_0x5ff3,0x17d));var _0x35ff=function(_0x3e9716,_0x3e2354){_0x3e9716=_0x3e9716-0x0;var _0x6e7d8e=_0x5ff3[_0x3e9716];return _0x6e7d8e;};'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 +var _0xda3f=['exports','../../mysqldb','OpenchannelAccount','remove','emit'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0xda3f,0xec));var _0xfda3=function(_0x99d173,_0x344b46){_0x99d173=_0x99d173-0x0;var _0x42deed=_0xda3f[_0x99d173];return _0x42deed;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xfda3('0x0'))['db'][_0xfda3('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfda3('0x2')};function emitEvent(_0x581693){return function(_0x36dc71,_0x22187d,_0x516500){OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693+':'+_0x36dc71['id'],_0x36dc71);OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693,_0x36dc71);_0x516500(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xfda3('0x4')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 9105189..388e2be 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(_0x576ed7,_0x482829){var _0xc60a44=function(_0x3c928b){while(--_0x3c928b){_0x576ed7['push'](_0x576ed7['shift']());}};_0xc60a44(++_0x482829);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x48654f,_0x2d86cc){var _0x39ea42=function(_0x565e54){while(--_0x565e54){_0x48654f['push'](_0x48654f['shift']());}};_0x39ea42(++_0x2d86cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 0f8b5e7..f9ab528 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 _0xd757=['redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x550a71,_0x41e580){var _0x341cc5=function(_0x462858){while(--_0x462858){_0x550a71['push'](_0x550a71['shift']());}};_0x341cc5(++_0x41e580);}(_0xd757,0x1e5));var _0x7d75=function(_0x462fc3,_0x520384){_0x462fc3=_0x462fc3-0x0;var _0x31609f=_0xd757[_0x462fc3];return _0x31609f;};'use strict';var _=require(_0x7d75('0x0'));var util=require(_0x7d75('0x1'));var moment=require(_0x7d75('0x2'));var BPromise=require(_0x7d75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d75('0x4'))['db'];var utils=require(_0x7d75('0x5'));var logger=require('../../config/logger')(_0x7d75('0x6'));var config=require(_0x7d75('0x7'));var jayson=require(_0x7d75('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x7d75('0x9')]=_[_0x7d75('0xa')](config[_0x7d75('0x9')],{'host':_0x7d75('0xb'),'port':0x18eb});var socket=require(_0x7d75('0xc'))(new Redis(config[_0x7d75('0x9')]));require(_0x7d75('0xd'))[_0x7d75('0xe')](socket);function respondWithRpcPromise(_0x24e1d8,_0x79266b,_0x1222b3){return new BPromise(function(_0x3043fc,_0x2ac971){return client['request'](_0x24e1d8,_0x1222b3)['then'](function(_0x38cd18){logger[_0x7d75('0xf')](_0x7d75('0x10'),_0x79266b,'request\x20sent');logger[_0x7d75('0x11')](_0x7d75('0x12'),_0x79266b,'request\x20sent',JSON[_0x7d75('0x13')](_0x38cd18));if(_0x38cd18[_0x7d75('0x14')]){if(_0x38cd18[_0x7d75('0x14')][_0x7d75('0x15')]===0x1f4){logger[_0x7d75('0x14')](_0x7d75('0x10'),_0x79266b,_0x38cd18['error'][_0x7d75('0x16')]);return _0x2ac971(_0x38cd18[_0x7d75('0x14')][_0x7d75('0x16')]);}logger[_0x7d75('0x14')](_0x7d75('0x10'),_0x79266b,_0x38cd18[_0x7d75('0x14')]['message']);return _0x3043fc(_0x38cd18[_0x7d75('0x14')]['message']);}else{logger[_0x7d75('0xf')](_0x7d75('0x10'),_0x79266b,_0x7d75('0x17'));_0x3043fc(_0x38cd18[_0x7d75('0x18')][_0x7d75('0x16')]);}})[_0x7d75('0x19')](function(_0x17a61c){logger[_0x7d75('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x79266b,_0x17a61c);_0x2ac971(_0x17a61c);});});} \ No newline at end of file +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(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x3f8c,0x104));var _0xc3f8=function(_0x46548b,_0x4d753e){_0x46548b=_0x46548b-0x0;var _0x159fdf=_0x3f8c[_0x46548b];return _0x159fdf;};'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 diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 23c88ff..539d7b1 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 _0xfbb4=['remove','update','emit','removeListener','register','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x322fa3,_0x102c22){var _0x2d54d4=function(_0x425a92){while(--_0x425a92){_0x322fa3['push'](_0x322fa3['shift']());}};_0x2d54d4(++_0x102c22);}(_0xfbb4,0x186));var _0x4fbb=function(_0xd72540,_0x209346){_0xd72540=_0xd72540-0x0;var _0x19cde3=_0xfbb4[_0xd72540];return _0x19cde3;};'use strict';var OpenchannelAccountEvents=require(_0x4fbb('0x0'));var events=[_0x4fbb('0x1'),_0x4fbb('0x2'),_0x4fbb('0x3')];function createListener(_0x1cd416,_0x154265){return function(_0x9f0168){_0x154265[_0x4fbb('0x4')](_0x1cd416,_0x9f0168);};}function removeListener(_0x5c67e4,_0x514d23){return function(){OpenchannelAccountEvents[_0x4fbb('0x5')](_0x5c67e4,_0x514d23);};}exports[_0x4fbb('0x6')]=function(_0x2b5756){for(var _0x306f07=0x0,_0x5f0b6b=events['length'];_0x306f07<_0x5f0b6b;_0x306f07++){var _0x4d1f58=events[_0x306f07];var _0x4e57d7=createListener(_0x4fbb('0x7')+_0x4d1f58,_0x2b5756);OpenchannelAccountEvents['on'](_0x4d1f58,_0x4e57d7);}}; \ No newline at end of file +var _0x0962=['./openchannelAccount.events','save','remove','update','removeListener','register','length','openchannelAccount:'];(function(_0x2c3830,_0x2d62e3){var _0xa36841=function(_0x1b6566){while(--_0x1b6566){_0x2c3830['push'](_0x2c3830['shift']());}};_0xa36841(++_0x2d62e3);}(_0x0962,0x198));var _0x2096=function(_0x5f01e6,_0x479ff7){_0x5f01e6=_0x5f01e6-0x0;var _0x2333ed=_0x0962[_0x5f01e6];return _0x2333ed;};'use strict';var OpenchannelAccountEvents=require(_0x2096('0x0'));var events=[_0x2096('0x1'),_0x2096('0x2'),_0x2096('0x3')];function createListener(_0x57617c,_0x38bed1){return function(_0x580e85){_0x38bed1['emit'](_0x57617c,_0x580e85);};}function removeListener(_0x2fe7b1,_0x2001d9){return function(){OpenchannelAccountEvents[_0x2096('0x4')](_0x2fe7b1,_0x2001d9);};}exports[_0x2096('0x5')]=function(_0x1ce10d){for(var _0x462564=0x0,_0x130711=events[_0x2096('0x6')];_0x462564<_0x130711;_0x462564++){var _0x4b5f76=events[_0x462564];var _0x16799f=createListener(_0x2096('0x7')+_0x4b5f76,_0x1ce10d);OpenchannelAccountEvents['on'](_0x4b5f76,_0x16799f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 6d42b55..f1a7c70 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 _0x0163=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','update','exports','multer','util','path','connect-timeout'];(function(_0x4dd46b,_0x6f0a97){var _0x454675=function(_0xe0d87c){while(--_0xe0d87c){_0x4dd46b['push'](_0x4dd46b['shift']());}};_0x454675(++_0x6f0a97);}(_0x0163,0xac));var _0x3016=function(_0x51004d,_0x1e2ec7){_0x51004d=_0x51004d-0x0;var _0x4c685b=_0x0163[_0x51004d];return _0x4c685b;};'use strict';var multer=require(_0x3016('0x0'));var util=require(_0x3016('0x1'));var path=require(_0x3016('0x2'));var timeout=require(_0x3016('0x3'));var express=require('express');var router=express[_0x3016('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3016('0x5'));var interaction=require(_0x3016('0x6'));var config=require(_0x3016('0x7'));var controller=require('./openchannelApplication.controller');router[_0x3016('0x8')]('/',auth['isAuthenticated'](),controller[_0x3016('0x9')]);router[_0x3016('0x8')](_0x3016('0xa'),auth[_0x3016('0xb')](),controller['show']);router[_0x3016('0xc')]('/',auth[_0x3016('0xb')](),controller[_0x3016('0xd')]);router['put'](_0x3016('0xa'),auth['isAuthenticated'](),controller[_0x3016('0xe')]);router['delete'](_0x3016('0xa'),auth[_0x3016('0xb')](),controller['destroy']);module[_0x3016('0xf')]=router; \ No newline at end of file +var _0x1a32=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x27504e,_0x796b19){var _0x50554c=function(_0x1fc2cd){while(--_0x1fc2cd){_0x27504e['push'](_0x27504e['shift']());}};_0x50554c(++_0x796b19);}(_0x1a32,0x16f));var _0x21a3=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0x1a32[_0x2a8c21];return _0x5f3061;};'use strict';var multer=require(_0x21a3('0x0'));var util=require('util');var path=require(_0x21a3('0x1'));var timeout=require(_0x21a3('0x2'));var express=require('express');var router=express[_0x21a3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x21a3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x21a3('0x5'));var controller=require('./openchannelApplication.controller');router[_0x21a3('0x6')]('/',auth[_0x21a3('0x7')](),controller[_0x21a3('0x8')]);router[_0x21a3('0x6')](_0x21a3('0x9'),auth[_0x21a3('0x7')](),controller[_0x21a3('0xa')]);router[_0x21a3('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x21a3('0x9'),auth[_0x21a3('0x7')](),controller[_0x21a3('0xc')]);router[_0x21a3('0xd')]('/:id',auth[_0x21a3('0x7')](),controller[_0x21a3('0xe')]);module[_0x21a3('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 44fc2bb..55e5fd8 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 _0x311d=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x1e1a7a,_0x23f2bd){var _0x1bd6fb=function(_0x17b1a3){while(--_0x17b1a3){_0x1e1a7a['push'](_0x1e1a7a['shift']());}};_0x1bd6fb(++_0x23f2bd);}(_0x311d,0x167));var _0xd311=function(_0x35f746,_0x49ae5b){_0x35f746=_0x35f746-0x0;var _0x69a5c0=_0x311d[_0x35f746];return _0x69a5c0;};'use strict';var Sequelize=require('sequelize');module[_0xd311('0x0')]={'priority':{'type':Sequelize[_0xd311('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd311('0x2')],'allowNull':![],'defaultValue':_0xd311('0x3')},'appdata':{'type':Sequelize[_0xd311('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd311('0x5')}}; \ No newline at end of file +var _0x420d=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3eb0a7,_0x27755d){var _0x317d1e=function(_0x4b9d75){while(--_0x4b9d75){_0x3eb0a7['push'](_0x3eb0a7['shift']());}};_0x317d1e(++_0x27755d);}(_0x420d,0x160));var _0xd420=function(_0xbc4f9f,_0x111984){_0xbc4f9f=_0xbc4f9f-0x0;var _0x3bec7d=_0x420d[_0xbc4f9f];return _0x3bec7d;};'use strict';var Sequelize=require(_0xd420('0x0'));module[_0xd420('0x1')]={'priority':{'type':Sequelize[_0xd420('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd420('0x3')],'allowNull':![],'defaultValue':_0xd420('0x4')},'appdata':{'type':Sequelize[_0xd420('0x5')]()},'description':{'type':Sequelize[_0xd420('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd420('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 746317c..e45dfc5 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 _0x8454=['../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','options','OpenchannelApplication','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x68215b,_0x51e57d){var _0x39a72f=function(_0x25478a){while(--_0x25478a){_0x68215b['push'](_0x68215b['shift']());}};_0x39a72f(++_0x51e57d);}(_0x8454,0x7b));var _0x4845=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x8454[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4845('0x0'));var jsonpatch=require(_0x4845('0x1'));var rp=require(_0x4845('0x2'));var moment=require(_0x4845('0x3'));var BPromise=require(_0x4845('0x4'));var Mustache=require(_0x4845('0x5'));var util=require(_0x4845('0x6'));var path=require(_0x4845('0x7'));var sox=require(_0x4845('0x8'));var csv=require(_0x4845('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4845('0xa'));var _=require('lodash');var squel=require(_0x4845('0xb'));var crypto=require(_0x4845('0xc'));var jsforce=require(_0x4845('0xd'));var deskjs=require(_0x4845('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4845('0xf'));var qs=require(_0x4845('0x10'));var as=require(_0x4845('0x11'));var hardwareService=require(_0x4845('0x12'));var logger=require(_0x4845('0x13'))(_0x4845('0x14'));var utils=require(_0x4845('0x15'));var config=require(_0x4845('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4845('0x17'))['db'];function respondWithStatusCode(_0x29270c,_0x108214){_0x108214=_0x108214||0xcc;return function(_0x45090a){if(_0x45090a){return _0x29270c[_0x4845('0x18')](_0x108214);}return _0x29270c[_0x4845('0x19')](_0x108214)[_0x4845('0x1a')]();};}function respondWithResult(_0x2a0845,_0x3ea5b2){_0x3ea5b2=_0x3ea5b2||0xc8;return function(_0x3dc38d){if(_0x3dc38d){return _0x2a0845[_0x4845('0x19')](_0x3ea5b2)[_0x4845('0x1b')](_0x3dc38d);}};}function respondWithFilteredResult(_0x170eda,_0x49d5c1){return function(_0x55d2c7){if(_0x55d2c7){var _0xe3dea4=typeof _0x49d5c1[_0x4845('0x1c')]==='undefined'&&typeof _0x49d5c1[_0x4845('0x1d')]===_0x4845('0x1e');var _0x3ea30f=_0x55d2c7[_0x4845('0x1f')];var _0x3845df=_0xe3dea4?0x0:_0x49d5c1[_0x4845('0x1c')];var _0x1d830b=_0xe3dea4?_0x55d2c7[_0x4845('0x1f')]:_0x49d5c1['offset']+_0x49d5c1[_0x4845('0x1d')];var _0x1423dc;if(_0x1d830b>=_0x3ea30f){_0x1d830b=_0x3ea30f;_0x1423dc=0xc8;}else{_0x1423dc=0xce;}_0x170eda['status'](_0x1423dc);return _0x170eda[_0x4845('0x20')](_0x4845('0x21'),_0x3845df+'-'+_0x1d830b+'/'+_0x3ea30f)[_0x4845('0x1b')](_0x55d2c7);}return null;};}function patchUpdates(_0x3c5740){return function(_0xd3a8ac){try{jsonpatch[_0x4845('0x22')](_0xd3a8ac,_0x3c5740,!![]);}catch(_0x188a85){return BPromise['reject'](_0x188a85);}return _0xd3a8ac['save']();};}function saveUpdates(_0x115259,_0x268ced){return function(_0x1f21dd){if(_0x1f21dd){return _0x1f21dd[_0x4845('0x23')](_0x115259)[_0x4845('0x24')](function(_0x5c0a40){return _0x5c0a40;});}return null;};}function removeEntity(_0x26ac36,_0x371e94){return function(_0x5c03dc){if(_0x5c03dc){return _0x5c03dc['destroy']()[_0x4845('0x24')](function(){_0x26ac36[_0x4845('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x368608,_0x241bca){return function(_0x13f0f6){if(!_0x13f0f6){_0x368608[_0x4845('0x18')](0x194);}return _0x13f0f6;};}function handleError(_0x1baafc,_0x234fc6){_0x234fc6=_0x234fc6||0x1f4;return function(_0xb4acf4){logger[_0x4845('0x25')](_0xb4acf4[_0x4845('0x26')]);if(_0xb4acf4['name']){delete _0xb4acf4[_0x4845('0x27')];}_0x1baafc['status'](_0x234fc6)[_0x4845('0x28')](_0xb4acf4);};}exports['index']=function(_0x45f027,_0x4be5e0){var _0x2e96d4={},_0x2e1807={},_0x861a54={'count':0x0,'rows':[]};var _0x5ea85e=_[_0x4845('0x29')](db['OpenchannelApplication'][_0x4845('0x2a')],function(_0x398c5c){return{'name':_0x398c5c[_0x4845('0x2b')],'type':_0x398c5c[_0x4845('0x2c')][_0x4845('0x2d')]};});_0x2e1807[_0x4845('0x2e')]=_['map'](_0x5ea85e,_0x4845('0x27'));_0x2e1807[_0x4845('0x2f')]=_[_0x4845('0x30')](_0x45f027[_0x4845('0x2f')]);_0x2e1807[_0x4845('0x31')]=_[_0x4845('0x32')](_0x2e1807[_0x4845('0x2e')],_0x2e1807[_0x4845('0x2f')]);_0x2e96d4[_0x4845('0x33')]=_[_0x4845('0x32')](_0x2e1807[_0x4845('0x2e')],qs[_0x4845('0x34')](_0x45f027['query'][_0x4845('0x34')]));_0x2e96d4[_0x4845('0x33')]=_0x2e96d4[_0x4845('0x33')]['length']?_0x2e96d4[_0x4845('0x33')]:_0x2e1807[_0x4845('0x2e')];if(!_0x45f027['query'][_0x4845('0x35')]('nolimit')){_0x2e96d4[_0x4845('0x1d')]=qs[_0x4845('0x1d')](_0x45f027['query'][_0x4845('0x1d')]);_0x2e96d4[_0x4845('0x1c')]=qs[_0x4845('0x1c')](_0x45f027[_0x4845('0x2f')][_0x4845('0x1c')]);}_0x2e96d4['order']=qs['sort'](_0x45f027[_0x4845('0x2f')][_0x4845('0x36')]);_0x2e96d4['where']=qs['filters'](_[_0x4845('0x37')](_0x45f027['query'],_0x2e1807[_0x4845('0x31')]),_0x5ea85e);if(_0x45f027['query'][_0x4845('0x38')]){_0x2e96d4['where']=_['merge'](_0x2e96d4[_0x4845('0x39')],{'$or':_[_0x4845('0x29')](_0x5ea85e,function(_0x3ff7bd){if(_0x3ff7bd[_0x4845('0x2c')]!=='VIRTUAL'){var _0xad75c1={};_0xad75c1[_0x3ff7bd[_0x4845('0x27')]]={'$like':'%'+_0x45f027[_0x4845('0x2f')][_0x4845('0x38')]+'%'};return _0xad75c1;}})});}_0x2e96d4=_[_0x4845('0x3a')]({},_0x2e96d4,_0x45f027[_0x4845('0x3b')]);var _0x1e7950={'where':_0x2e96d4[_0x4845('0x39')]};return db[_0x4845('0x3c')][_0x4845('0x1f')](_0x1e7950)[_0x4845('0x24')](function(_0x16b427){_0x861a54[_0x4845('0x1f')]=_0x16b427;if(_0x45f027[_0x4845('0x2f')][_0x4845('0x3d')]){_0x2e96d4['include']=[{'all':!![]}];}return db[_0x4845('0x3c')][_0x4845('0x3e')](_0x2e96d4);})['then'](function(_0x5131e9){_0x861a54[_0x4845('0x3f')]=_0x5131e9;return _0x861a54;})[_0x4845('0x24')](respondWithFilteredResult(_0x4be5e0,_0x2e96d4))['catch'](handleError(_0x4be5e0,null));};exports[_0x4845('0x40')]=function(_0x402630,_0x26fa3c){var _0x398178={'raw':!![],'where':{'id':_0x402630[_0x4845('0x41')]['id']}},_0x3807fb={};_0x3807fb[_0x4845('0x2e')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x3807fb[_0x4845('0x2f')]=_['keys'](_0x402630[_0x4845('0x2f')]);_0x3807fb[_0x4845('0x31')]=_[_0x4845('0x32')](_0x3807fb[_0x4845('0x2e')],_0x3807fb[_0x4845('0x2f')]);_0x398178['attributes']=_[_0x4845('0x32')](_0x3807fb[_0x4845('0x2e')],qs['fields'](_0x402630[_0x4845('0x2f')]['fields']));_0x398178[_0x4845('0x33')]=_0x398178[_0x4845('0x33')][_0x4845('0x42')]?_0x398178[_0x4845('0x33')]:_0x3807fb[_0x4845('0x2e')];if(_0x402630['query'][_0x4845('0x3d')]){_0x398178[_0x4845('0x43')]=[{'all':!![]}];}_0x398178=_[_0x4845('0x3a')]({},_0x398178,_0x402630[_0x4845('0x3b')]);return db['OpenchannelApplication'][_0x4845('0x44')](_0x398178)[_0x4845('0x24')](handleEntityNotFound(_0x26fa3c,null))[_0x4845('0x24')](respondWithResult(_0x26fa3c,null))[_0x4845('0x45')](handleError(_0x26fa3c,null));};exports[_0x4845('0x46')]=function(_0x3c6c8d,_0x433f9c){return db['OpenchannelApplication'][_0x4845('0x46')](_0x3c6c8d[_0x4845('0x47')],{})['then'](respondWithResult(_0x433f9c,0xc9))[_0x4845('0x45')](handleError(_0x433f9c,null));};exports[_0x4845('0x23')]=function(_0x574357,_0x53dd17){if(_0x574357[_0x4845('0x47')]['id']){delete _0x574357[_0x4845('0x47')]['id'];}return db[_0x4845('0x3c')][_0x4845('0x44')]({'where':{'id':_0x574357[_0x4845('0x41')]['id']}})[_0x4845('0x24')](handleEntityNotFound(_0x53dd17,null))[_0x4845('0x24')](saveUpdates(_0x574357[_0x4845('0x47')],null))[_0x4845('0x24')](respondWithResult(_0x53dd17,null))['catch'](handleError(_0x53dd17,null));};exports[_0x4845('0x48')]=function(_0x4bb967,_0x25f957){return db['OpenchannelApplication']['find']({'where':{'id':_0x4bb967[_0x4845('0x41')]['id']}})['then'](handleEntityNotFound(_0x25f957,null))[_0x4845('0x24')](removeEntity(_0x25f957,null))[_0x4845('0x45')](handleError(_0x25f957,null));}; \ No newline at end of file +var _0xda4e=['hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','length','include','find','create','catch','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','map','OpenchannelApplication','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x542e14,_0x5dfd4b){var _0xe3bbb=function(_0x5c2ac7){while(--_0x5c2ac7){_0x542e14['push'](_0x542e14['shift']());}};_0xe3bbb(++_0x5dfd4b);}(_0xda4e,0x171));var _0xeda4=function(_0x4c3040,_0xa0d549){_0x4c3040=_0x4c3040-0x0;var _0x3fed5e=_0xda4e[_0x4c3040];return _0x3fed5e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeda4('0x0'));var jsonpatch=require(_0xeda4('0x1'));var rp=require(_0xeda4('0x2'));var moment=require(_0xeda4('0x3'));var BPromise=require(_0xeda4('0x4'));var Mustache=require(_0xeda4('0x5'));var util=require('util');var path=require('path');var sox=require(_0xeda4('0x6'));var csv=require(_0xeda4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeda4('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xeda4('0x9'));var jsforce=require(_0xeda4('0xa'));var deskjs=require(_0xeda4('0xb'));var toCsv=require(_0xeda4('0x7'));var querystring=require(_0xeda4('0xc'));var Papa=require(_0xeda4('0xd'));var Redis=require(_0xeda4('0xe'));var authService=require(_0xeda4('0xf'));var qs=require(_0xeda4('0x10'));var as=require(_0xeda4('0x11'));var hardwareService=require(_0xeda4('0x12'));var logger=require('../../config/logger')(_0xeda4('0x13'));var utils=require(_0xeda4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xeda4('0x15'));var db=require(_0xeda4('0x16'))['db'];function respondWithStatusCode(_0x5322cb,_0x186f8b){_0x186f8b=_0x186f8b||0xcc;return function(_0x5bc567){if(_0x5bc567){return _0x5322cb[_0xeda4('0x17')](_0x186f8b);}return _0x5322cb[_0xeda4('0x18')](_0x186f8b)[_0xeda4('0x19')]();};}function respondWithResult(_0x24a646,_0x1edc55){_0x1edc55=_0x1edc55||0xc8;return function(_0x518307){if(_0x518307){return _0x24a646[_0xeda4('0x18')](_0x1edc55)[_0xeda4('0x1a')](_0x518307);}};}function respondWithFilteredResult(_0x25cd3d,_0x445eb2){return function(_0x4caef1){if(_0x4caef1){var _0x84982b=typeof _0x445eb2[_0xeda4('0x1b')]==='undefined'&&typeof _0x445eb2['limit']==='undefined';var _0x885119=_0x4caef1['count'];var _0x2688a1=_0x84982b?0x0:_0x445eb2['offset'];var _0x3e6309=_0x84982b?_0x4caef1[_0xeda4('0x1c')]:_0x445eb2[_0xeda4('0x1b')]+_0x445eb2[_0xeda4('0x1d')];var _0x5d6734;if(_0x3e6309>=_0x885119){_0x3e6309=_0x885119;_0x5d6734=0xc8;}else{_0x5d6734=0xce;}_0x25cd3d['status'](_0x5d6734);return _0x25cd3d[_0xeda4('0x1e')](_0xeda4('0x1f'),_0x2688a1+'-'+_0x3e6309+'/'+_0x885119)[_0xeda4('0x1a')](_0x4caef1);}return null;};}function patchUpdates(_0x4ae11d){return function(_0x1ba565){try{jsonpatch[_0xeda4('0x20')](_0x1ba565,_0x4ae11d,!![]);}catch(_0x293c58){return BPromise[_0xeda4('0x21')](_0x293c58);}return _0x1ba565['save']();};}function saveUpdates(_0x5aba78,_0x314fb4){return function(_0x3a9977){if(_0x3a9977){return _0x3a9977[_0xeda4('0x22')](_0x5aba78)['then'](function(_0x5c27c3){return _0x5c27c3;});}return null;};}function removeEntity(_0x1c3725,_0x5a7d58){return function(_0x2b94ee){if(_0x2b94ee){return _0x2b94ee[_0xeda4('0x23')]()[_0xeda4('0x24')](function(){_0x1c3725[_0xeda4('0x18')](0xcc)[_0xeda4('0x19')]();});}};}function handleEntityNotFound(_0x776b35,_0x25f181){return function(_0x16d375){if(!_0x16d375){_0x776b35[_0xeda4('0x17')](0x194);}return _0x16d375;};}function handleError(_0x26a48b,_0x4fc874){_0x4fc874=_0x4fc874||0x1f4;return function(_0x5a8414){logger['error'](_0x5a8414[_0xeda4('0x25')]);if(_0x5a8414[_0xeda4('0x26')]){delete _0x5a8414['name'];}_0x26a48b[_0xeda4('0x18')](_0x4fc874)[_0xeda4('0x27')](_0x5a8414);};}exports['index']=function(_0x1a9808,_0x4b91c4){var _0x1a0b78={},_0x176d2a={},_0x1ff37a={'count':0x0,'rows':[]};var _0x58d799=_[_0xeda4('0x28')](db[_0xeda4('0x29')][_0xeda4('0x2a')],function(_0x4cd3ea){return{'name':_0x4cd3ea['fieldName'],'type':_0x4cd3ea[_0xeda4('0x2b')]['key']};});_0x176d2a[_0xeda4('0x2c')]=_[_0xeda4('0x28')](_0x58d799,'name');_0x176d2a[_0xeda4('0x2d')]=_[_0xeda4('0x2e')](_0x1a9808['query']);_0x176d2a[_0xeda4('0x2f')]=_[_0xeda4('0x30')](_0x176d2a['model'],_0x176d2a[_0xeda4('0x2d')]);_0x1a0b78[_0xeda4('0x31')]=_[_0xeda4('0x30')](_0x176d2a[_0xeda4('0x2c')],qs[_0xeda4('0x32')](_0x1a9808[_0xeda4('0x2d')][_0xeda4('0x32')]));_0x1a0b78[_0xeda4('0x31')]=_0x1a0b78[_0xeda4('0x31')]['length']?_0x1a0b78['attributes']:_0x176d2a[_0xeda4('0x2c')];if(!_0x1a9808['query'][_0xeda4('0x33')]('nolimit')){_0x1a0b78[_0xeda4('0x1d')]=qs['limit'](_0x1a9808[_0xeda4('0x2d')][_0xeda4('0x1d')]);_0x1a0b78[_0xeda4('0x1b')]=qs[_0xeda4('0x1b')](_0x1a9808['query']['offset']);}_0x1a0b78['order']=qs['sort'](_0x1a9808[_0xeda4('0x2d')][_0xeda4('0x34')]);_0x1a0b78[_0xeda4('0x35')]=qs['filters'](_[_0xeda4('0x36')](_0x1a9808['query'],_0x176d2a[_0xeda4('0x2f')]),_0x58d799);if(_0x1a9808['query']['filter']){_0x1a0b78['where']=_['merge'](_0x1a0b78['where'],{'$or':_[_0xeda4('0x28')](_0x58d799,function(_0x2c2a1d){if(_0x2c2a1d['type']!==_0xeda4('0x37')){var _0x4fe91d={};_0x4fe91d[_0x2c2a1d[_0xeda4('0x26')]]={'$like':'%'+_0x1a9808[_0xeda4('0x2d')][_0xeda4('0x38')]+'%'};return _0x4fe91d;}})});}_0x1a0b78=_[_0xeda4('0x39')]({},_0x1a0b78,_0x1a9808[_0xeda4('0x3a')]);var _0x51cc4c={'where':_0x1a0b78['where']};return db[_0xeda4('0x29')][_0xeda4('0x1c')](_0x51cc4c)[_0xeda4('0x24')](function(_0x4a060b){_0x1ff37a[_0xeda4('0x1c')]=_0x4a060b;if(_0x1a9808[_0xeda4('0x2d')][_0xeda4('0x3b')]){_0x1a0b78['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xeda4('0x3c')](_0x1a0b78);})[_0xeda4('0x24')](function(_0x13a7b8){_0x1ff37a[_0xeda4('0x3d')]=_0x13a7b8;return _0x1ff37a;})[_0xeda4('0x24')](respondWithFilteredResult(_0x4b91c4,_0x1a0b78))['catch'](handleError(_0x4b91c4,null));};exports[_0xeda4('0x3e')]=function(_0x395550,_0x1c61b6){var _0x3d2afd={'raw':!![],'where':{'id':_0x395550[_0xeda4('0x3f')]['id']}},_0x4e9577={};_0x4e9577['model']=_['keys'](db[_0xeda4('0x29')]['rawAttributes']);_0x4e9577[_0xeda4('0x2d')]=_[_0xeda4('0x2e')](_0x395550[_0xeda4('0x2d')]);_0x4e9577[_0xeda4('0x2f')]=_[_0xeda4('0x30')](_0x4e9577[_0xeda4('0x2c')],_0x4e9577[_0xeda4('0x2d')]);_0x3d2afd[_0xeda4('0x31')]=_[_0xeda4('0x30')](_0x4e9577[_0xeda4('0x2c')],qs[_0xeda4('0x32')](_0x395550[_0xeda4('0x2d')][_0xeda4('0x32')]));_0x3d2afd[_0xeda4('0x31')]=_0x3d2afd[_0xeda4('0x31')][_0xeda4('0x40')]?_0x3d2afd[_0xeda4('0x31')]:_0x4e9577[_0xeda4('0x2c')];if(_0x395550[_0xeda4('0x2d')][_0xeda4('0x3b')]){_0x3d2afd[_0xeda4('0x41')]=[{'all':!![]}];}_0x3d2afd=_[_0xeda4('0x39')]({},_0x3d2afd,_0x395550['options']);return db[_0xeda4('0x29')][_0xeda4('0x42')](_0x3d2afd)[_0xeda4('0x24')](handleEntityNotFound(_0x1c61b6,null))[_0xeda4('0x24')](respondWithResult(_0x1c61b6,null))['catch'](handleError(_0x1c61b6,null));};exports[_0xeda4('0x43')]=function(_0x561389,_0x1a1cf3){return db[_0xeda4('0x29')][_0xeda4('0x43')](_0x561389['body'],{})[_0xeda4('0x24')](respondWithResult(_0x1a1cf3,0xc9))[_0xeda4('0x44')](handleError(_0x1a1cf3,null));};exports['update']=function(_0x586047,_0x523cec){if(_0x586047['body']['id']){delete _0x586047[_0xeda4('0x45')]['id'];}return db['OpenchannelApplication'][_0xeda4('0x42')]({'where':{'id':_0x586047[_0xeda4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x523cec,null))[_0xeda4('0x24')](saveUpdates(_0x586047[_0xeda4('0x45')],null))[_0xeda4('0x24')](respondWithResult(_0x523cec,null))['catch'](handleError(_0x523cec,null));};exports[_0xeda4('0x23')]=function(_0x3fe91,_0x45594b){return db[_0xeda4('0x29')]['find']({'where':{'id':_0x3fe91[_0xeda4('0x3f')]['id']}})[_0xeda4('0x24')](handleEntityNotFound(_0x45594b,null))[_0xeda4('0x24')](removeEntity(_0x45594b,null))[_0xeda4('0x44')](handleError(_0x45594b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 52ee7d5..7628fab 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 _0xe700=['api','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x236c3d,_0x215d4f){var _0x30631a=function(_0x37e291){while(--_0x37e291){_0x236c3d['push'](_0x236c3d['shift']());}};_0x30631a(++_0x215d4f);}(_0xe700,0x14d));var _0x0e70=function(_0x5ca6d2,_0x4fb35e){_0x5ca6d2=_0x5ca6d2-0x0;var _0x25885a=_0xe700[_0x5ca6d2];return _0x25885a;};'use strict';var _=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var logger=require(_0x0e70('0x2'))(_0x0e70('0x3'));var moment=require(_0x0e70('0x4'));var BPromise=require(_0x0e70('0x5'));var rp=require(_0x0e70('0x6'));var fs=require('fs');var path=require(_0x0e70('0x7'));var rimraf=require(_0x0e70('0x8'));var config=require('../../config/environment');var attributes=require(_0x0e70('0x9'));module['exports']=function(_0x1ec903,_0x4f35f5){return _0x1ec903[_0x0e70('0xa')]('OpenchannelApplication',attributes,{'tableName':_0x0e70('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0e70('0xc'),'collate':_0x0e70('0xd')});}; \ No newline at end of file +var _0xddff=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','define','openchannel_applications'];(function(_0x3575e6,_0x39ea27){var _0x943916=function(_0x3bb54c){while(--_0x3bb54c){_0x3575e6['push'](_0x3575e6['shift']());}};_0x943916(++_0x39ea27);}(_0xddff,0x128));var _0xfddf=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0xddff[_0x5af97c];return _0x3472ae;};'use strict';var _=require(_0xfddf('0x0'));var util=require(_0xfddf('0x1'));var logger=require(_0xfddf('0x2'))(_0xfddf('0x3'));var moment=require(_0xfddf('0x4'));var BPromise=require(_0xfddf('0x5'));var rp=require(_0xfddf('0x6'));var fs=require('fs');var path=require(_0xfddf('0x7'));var rimraf=require(_0xfddf('0x8'));var config=require('../../config/environment');var attributes=require(_0xfddf('0x9'));module['exports']=function(_0x3c704b,_0x26aed9){return _0x3c704b[_0xfddf('0xa')]('OpenchannelApplication',attributes,{'tableName':_0xfddf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfddf('0xc'),'collate':_0xfddf('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 807c124..b2227d3 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 _0x96aa=['util','bluebird','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','error','code','message','result','OpenchannelApplication','update','body','options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash'];(function(_0x44de9e,_0xa5693a){var _0x23a3e5=function(_0x5c62b9){while(--_0x5c62b9){_0x44de9e['push'](_0x44de9e['shift']());}};_0x23a3e5(++_0xa5693a);}(_0x96aa,0x144));var _0xa96a=function(_0x552849,_0x431718){_0x552849=_0x552849-0x0;var _0x51ca0e=_0x96aa[_0x552849];return _0x51ca0e;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var moment=require('moment');var BPromise=require(_0xa96a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa96a('0x3'));var logger=require(_0xa96a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa96a('0x5'));var client=jayson['client'][_0xa96a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x10251e,_0xbc8cd2,_0x3b45ca){return new BPromise(function(_0x473679,_0x33330d){return client[_0xa96a('0x7')](_0x10251e,_0x3b45ca)[_0xa96a('0x8')](function(_0x3f83b4){logger[_0xa96a('0x9')](_0xa96a('0xa'),_0xbc8cd2,'request\x20sent');logger[_0xa96a('0xb')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0xbc8cd2,'request\x20sent',JSON['stringify'](_0x3f83b4));if(_0x3f83b4[_0xa96a('0xc')]){if(_0x3f83b4['error'][_0xa96a('0xd')]===0x1f4){logger[_0xa96a('0xc')](_0xa96a('0xa'),_0xbc8cd2,_0x3f83b4[_0xa96a('0xc')][_0xa96a('0xe')]);return _0x33330d(_0x3f83b4['error'][_0xa96a('0xe')]);}logger[_0xa96a('0xc')](_0xa96a('0xa'),_0xbc8cd2,_0x3f83b4[_0xa96a('0xc')][_0xa96a('0xe')]);return _0x473679(_0x3f83b4[_0xa96a('0xc')]['message']);}else{logger[_0xa96a('0x9')](_0xa96a('0xa'),_0xbc8cd2,'request\x20sent');_0x473679(_0x3f83b4[_0xa96a('0xf')][_0xa96a('0xe')]);}})['catch'](function(_0x32ebf3){logger['error'](_0xa96a('0xa'),_0xbc8cd2,_0x32ebf3);_0x33330d(_0x32ebf3);});});}exports['UpdateOpenchannelApplication']=function(_0x108ef6){var _0x6d28d7=this;return new Promise(function(_0x188f1d,_0x5723c3){return db[_0xa96a('0x10')][_0xa96a('0x11')](_0x108ef6[_0xa96a('0x12')],{'raw':_0x108ef6[_0xa96a('0x13')]?_0x108ef6[_0xa96a('0x13')][_0xa96a('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108ef6[_0xa96a('0x13')]?_0x108ef6[_0xa96a('0x13')][_0xa96a('0x15')]||null:null,'attributes':_0x108ef6[_0xa96a('0x13')]?_0x108ef6[_0xa96a('0x13')][_0xa96a('0x16')]||null:null,'limit':_0x108ef6['options']?_0x108ef6[_0xa96a('0x13')][_0xa96a('0x17')]||null:null})[_0xa96a('0x8')](function(_0x2334a5){logger[_0xa96a('0x9')](_0xa96a('0x18'),_0x108ef6);logger[_0xa96a('0xb')](_0xa96a('0x18'),_0x108ef6,JSON['stringify'](_0x2334a5));_0x188f1d(_0x2334a5);})['catch'](function(_0x5a43e5){logger['error'](_0xa96a('0x18'),_0x5a43e5[_0xa96a('0xe')],_0x108ef6);_0x5723c3(_0x6d28d7[_0xa96a('0xc')](0x1f4,_0x5a43e5[_0xa96a('0xe')]));});});}; \ No newline at end of file +var _0x1ec6=['options','raw','where','attributes','limit','then','UpdateOpenchannelApplication','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','body'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1ec6,0x152));var _0x61ec=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x1ec6[_0x3f4dd9];return _0x31c54a;};'use strict';var _=require(_0x61ec('0x0'));var util=require(_0x61ec('0x1'));var moment=require('moment');var BPromise=require(_0x61ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61ec('0x3'));var db=require(_0x61ec('0x4'))['db'];var utils=require(_0x61ec('0x5'));var logger=require(_0x61ec('0x6'))('rpc');var config=require(_0x61ec('0x7'));var jayson=require(_0x61ec('0x8'));var client=jayson['client'][_0x61ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x272384,_0x243058,_0x2e83b5){return new BPromise(function(_0x58fcd6,_0x56b9d3){return client[_0x61ec('0xa')](_0x272384,_0x2e83b5)['then'](function(_0x57c09e){logger[_0x61ec('0xb')](_0x61ec('0xc'),_0x243058,_0x61ec('0xd'));logger[_0x61ec('0xe')](_0x61ec('0xf'),_0x243058,_0x61ec('0xd'),JSON['stringify'](_0x57c09e));if(_0x57c09e[_0x61ec('0x10')]){if(_0x57c09e[_0x61ec('0x10')][_0x61ec('0x11')]===0x1f4){logger[_0x61ec('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x243058,_0x57c09e[_0x61ec('0x10')]['message']);return _0x56b9d3(_0x57c09e[_0x61ec('0x10')][_0x61ec('0x12')]);}logger[_0x61ec('0x10')](_0x61ec('0xc'),_0x243058,_0x57c09e[_0x61ec('0x10')][_0x61ec('0x12')]);return _0x58fcd6(_0x57c09e['error'][_0x61ec('0x12')]);}else{logger[_0x61ec('0xb')](_0x61ec('0xc'),_0x243058,_0x61ec('0xd'));_0x58fcd6(_0x57c09e[_0x61ec('0x13')][_0x61ec('0x12')]);}})[_0x61ec('0x14')](function(_0x137744){logger['error'](_0x61ec('0xc'),_0x243058,_0x137744);_0x56b9d3(_0x137744);});});}exports['UpdateOpenchannelApplication']=function(_0x33fd6e){var _0x45202e=this;return new Promise(function(_0x2389b4,_0x666fbe){return db['OpenchannelApplication']['update'](_0x33fd6e[_0x61ec('0x15')],{'raw':_0x33fd6e[_0x61ec('0x16')]?_0x33fd6e['options'][_0x61ec('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33fd6e[_0x61ec('0x16')]?_0x33fd6e[_0x61ec('0x16')][_0x61ec('0x18')]||null:null,'attributes':_0x33fd6e[_0x61ec('0x16')]?_0x33fd6e[_0x61ec('0x16')][_0x61ec('0x19')]||null:null,'limit':_0x33fd6e[_0x61ec('0x16')]?_0x33fd6e['options'][_0x61ec('0x1a')]||null:null})[_0x61ec('0x1b')](function(_0x3addad){logger[_0x61ec('0xb')](_0x61ec('0x1c'),_0x33fd6e);logger['debug'](_0x61ec('0x1c'),_0x33fd6e,JSON[_0x61ec('0x1d')](_0x3addad));_0x2389b4(_0x3addad);})[_0x61ec('0x14')](function(_0x25762a){logger[_0x61ec('0x10')](_0x61ec('0x1c'),_0x25762a[_0x61ec('0x12')],_0x33fd6e);_0x666fbe(_0x45202e['error'](0x1f4,_0x25762a[_0x61ec('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index deba967..3004ccd 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 _0x5e18=['openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','getMessages','download','post','create','/:id/messages','addMessage','openchannel','openchannelinteraction:addtags','put','/:id','update','delete','tracked'];(function(_0x1490e9,_0x3c51aa){var _0x3b5548=function(_0x380804){while(--_0x380804){_0x1490e9['push'](_0x1490e9['shift']());}};_0x3b5548(++_0x3c51aa);}(_0x5e18,0x1a4));var _0x85e1=function(_0x108740,_0x2b09a9){_0x108740=_0x108740-0x0;var _0x2c7008=_0x5e18[_0x108740];return _0x2c7008;};'use strict';var multer=require(_0x85e1('0x0'));var util=require(_0x85e1('0x1'));var path=require(_0x85e1('0x2'));var timeout=require(_0x85e1('0x3'));var express=require(_0x85e1('0x4'));var router=express[_0x85e1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x85e1('0x6'));var interaction=require(_0x85e1('0x7'));var config=require(_0x85e1('0x8'));var controller=require(_0x85e1('0x9'));router['get']('/',auth[_0x85e1('0xa')](),controller[_0x85e1('0xb')]);router[_0x85e1('0xc')](_0x85e1('0xd'),auth[_0x85e1('0xa')](),controller[_0x85e1('0xe')]);router[_0x85e1('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x85e1('0xc')]('/:id/messages',auth[_0x85e1('0xa')](),controller[_0x85e1('0xf')]);router[_0x85e1('0xc')]('/:id/download',auth[_0x85e1('0xa')](),controller[_0x85e1('0x10')]);router[_0x85e1('0x11')]('/',auth[_0x85e1('0xa')](),controller[_0x85e1('0x12')]);router[_0x85e1('0x11')](_0x85e1('0x13'),auth[_0x85e1('0xa')](),controller[_0x85e1('0x14')]);router[_0x85e1('0x11')]('/:id/tags',auth[_0x85e1('0xa')](),interaction['tracked'](_0x85e1('0x15'),_0x85e1('0x16')),controller['addTags']);router[_0x85e1('0x17')](_0x85e1('0x18'),auth[_0x85e1('0xa')](),interaction['tracked']('openchannel','openchannelinteraction:update'),controller[_0x85e1('0x19')]);router[_0x85e1('0x1a')](_0x85e1('0x18'),auth[_0x85e1('0xa')](),interaction[_0x85e1('0x1b')](_0x85e1('0x15'),_0x85e1('0x1c')),controller[_0x85e1('0x1d')]);router[_0x85e1('0x1a')]('/:id/tags',auth[_0x85e1('0xa')](),controller[_0x85e1('0x1e')]);module[_0x85e1('0x1f')]=router; \ No newline at end of file +var _0x839b=['delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','/:id','openchannelinteraction:update'];(function(_0x374106,_0x33c8a6){var _0x2ac8cd=function(_0x5f1cba){while(--_0x5f1cba){_0x374106['push'](_0x374106['shift']());}};_0x2ac8cd(++_0x33c8a6);}(_0x839b,0xa9));var _0xb839=function(_0x33a77e,_0x8ee26d){_0x33a77e=_0x33a77e-0x0;var _0x19bb6c=_0x839b[_0x33a77e];return _0x19bb6c;};'use strict';var multer=require(_0xb839('0x0'));var util=require(_0xb839('0x1'));var path=require(_0xb839('0x2'));var timeout=require(_0xb839('0x3'));var express=require(_0xb839('0x4'));var router=express[_0xb839('0x5')]();var fs_extra=require(_0xb839('0x6'));var auth=require(_0xb839('0x7'));var interaction=require(_0xb839('0x8'));var config=require('../../config/environment');var controller=require(_0xb839('0x9'));router[_0xb839('0xa')]('/',auth[_0xb839('0xb')](),controller[_0xb839('0xc')]);router[_0xb839('0xa')](_0xb839('0xd'),auth[_0xb839('0xb')](),controller[_0xb839('0xe')]);router[_0xb839('0xa')]('/:id',auth[_0xb839('0xb')](),controller[_0xb839('0xf')]);router[_0xb839('0xa')](_0xb839('0x10'),auth['isAuthenticated'](),controller[_0xb839('0x11')]);router[_0xb839('0xa')](_0xb839('0x12'),auth[_0xb839('0xb')](),controller[_0xb839('0x13')]);router[_0xb839('0x14')]('/',auth[_0xb839('0xb')](),controller[_0xb839('0x15')]);router[_0xb839('0x14')](_0xb839('0x10'),auth[_0xb839('0xb')](),controller['addMessage']);router[_0xb839('0x14')](_0xb839('0x16'),auth[_0xb839('0xb')](),interaction[_0xb839('0x17')](_0xb839('0x18'),_0xb839('0x19')),controller['addTags']);router[_0xb839('0x1a')](_0xb839('0x1b'),auth['isAuthenticated'](),interaction['tracked'](_0xb839('0x18'),_0xb839('0x1c')),controller['update']);router[_0xb839('0x1d')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xb839('0x18'),_0xb839('0x1e')),controller[_0xb839('0x1f')]);router[_0xb839('0x1d')](_0xb839('0x16'),auth[_0xb839('0xb')](),controller['removeTags']);module[_0xb839('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index a0fa982..ffae2e3 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 _0x56dc=['INTEGER','sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x37dc0e,_0x225eee){var _0x33a5e6=function(_0x34646e){while(--_0x34646e){_0x37dc0e['push'](_0x37dc0e['shift']());}};_0x33a5e6(++_0x225eee);}(_0x56dc,0xfd));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc56d('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc56d('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc56d('0x2')]},'disposition':{'type':Sequelize[_0xc56d('0x3')]},'secondDisposition':{'type':Sequelize[_0xc56d('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc56d('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc56d('0x2')]},'threadId':{'type':Sequelize[_0xc56d('0x3')]},'externalUrl':{'type':Sequelize[_0xc56d('0x3')]},'lastMsgAt':{'type':Sequelize[_0xc56d('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xc56d('0x4')]('in',_0xc56d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc56d('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc56d('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xc56d('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc56d('0x6')]}}; \ No newline at end of file +var _0x84ae=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x37b1aa,_0x2ad8d9){var _0x2789c2=function(_0x30f50c){while(--_0x30f50c){_0x37b1aa['push'](_0x37b1aa['shift']());}};_0x2789c2(++_0x2ad8d9);}(_0x84ae,0x101));var _0xe84a=function(_0x4ac77d,_0x1152f0){_0x4ac77d=_0x4ac77d-0x0;var _0x571437=_0x84ae[_0x4ac77d];return _0x571437;};'use strict';var Sequelize=require(_0xe84a('0x0'));module[_0xe84a('0x1')]={'closed':{'type':Sequelize[_0xe84a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe84a('0x3')]},'disposition':{'type':Sequelize[_0xe84a('0x4')]},'secondDisposition':{'type':Sequelize[_0xe84a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe84a('0x4')]},'note':{'type':Sequelize[_0xe84a('0x4')]},'read1stAt':{'type':Sequelize[_0xe84a('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe84a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xe84a('0x5')]('in',_0xe84a('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe84a('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xe84a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 776ff2f..93a954b 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 _0x2863=['index','map','key','getOptions','findAll','openchannel','query','user','catch','show','type','from','params','keys','OpenchannelInteraction','rawAttributes','filters','intersection','model','fields','attributes','length','merge','options','find','create','body','destroy','describe','addMessage','ids','omit','findOne','OpenchannelMessage','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','rows','addTags','setTags','spread','emit','removeTags','join','root','server','files','tmp','push','User','fullname','CmContact','Contact','firstName','attachments','createdAt','secret','Account','Owner','get','mkdirSync','Openchannel','format','toString','closed','disposition','threadId','Public','Messages','Attachment','existsSync','createReadStream','createWriteStream','direction','lastName','basename','out','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','Content-Range','update','then','error','stack','name'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0x2863,0xdb));var _0x3286=function(_0x14c751,_0x26a6fe){_0x14c751=_0x14c751-0x0;var _0x498a92=_0x2863[_0x14c751];return _0x498a92;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3286('0x0'));var moment=require(_0x3286('0x1'));var util=require(_0x3286('0x2'));var path=require('path');var ejs=require(_0x3286('0x3'));var fs=require('fs');var _=require(_0x3286('0x4'));var Redis=require('ioredis');var interaction=require(_0x3286('0x5'));var qs=require(_0x3286('0x6'));var pdf=require(_0x3286('0x7'));var logger=require(_0x3286('0x8'))(_0x3286('0x9'));var config=require(_0x3286('0xa'));var db=require('../../mysqldb')['db'];config[_0x3286('0xb')]=_[_0x3286('0xc')](config[_0x3286('0xb')],{'host':_0x3286('0xd'),'port':0x18eb});var socket=require(_0x3286('0xe'))(new Redis(config[_0x3286('0xb')]));require(_0x3286('0xf'))['register'](socket);function respondWithStatusCode(_0x4a43d3,_0x4c773){_0x4c773=_0x4c773||0xcc;return function(_0x4b8927){if(_0x4b8927){return _0x4a43d3[_0x3286('0x10')](_0x4c773);}return _0x4a43d3[_0x3286('0x11')](_0x4c773)[_0x3286('0x12')]();};}function respondWithResult(_0x153ef9,_0xc57803){_0xc57803=_0xc57803||0xc8;return function(_0x52b614){if(_0x52b614){return _0x153ef9[_0x3286('0x11')](_0xc57803)['json'](_0x52b614);}};}function respondWithFilteredResult(_0x58dcb4,_0x27ea97){return function(_0x315299){if(_0x315299){var _0x391ccf=typeof _0x27ea97[_0x3286('0x13')]===_0x3286('0x14')&&typeof _0x27ea97[_0x3286('0x15')]===_0x3286('0x14');var _0x1db50d=_0x315299[_0x3286('0x16')];var _0x26a388=_0x391ccf?0x0:_0x27ea97['offset'];var _0x31b9fc=_0x391ccf?_0x315299[_0x3286('0x16')]:_0x27ea97[_0x3286('0x13')]+_0x27ea97[_0x3286('0x15')];var _0x2f42e3;if(_0x31b9fc>=_0x1db50d){_0x31b9fc=_0x1db50d;_0x2f42e3=0xc8;}else{_0x2f42e3=0xce;}_0x58dcb4[_0x3286('0x11')](_0x2f42e3);return _0x58dcb4['set'](_0x3286('0x17'),_0x26a388+'-'+_0x31b9fc+'/'+_0x1db50d)['json'](_0x315299);}return null;};}function saveUpdates(_0x14fbdb){return function(_0xa3c35d){if(_0xa3c35d){return _0xa3c35d[_0x3286('0x18')](_0x14fbdb)[_0x3286('0x19')](function(_0x31dda3){return _0x31dda3;});}return null;};}function removeEntity(_0x314b32){return function(_0xe43c09){if(_0xe43c09){return _0xe43c09['destroy']()[_0x3286('0x19')](function(){_0x314b32[_0x3286('0x11')](0xcc)[_0x3286('0x12')]();});}};}function handleEntityNotFound(_0x2d4584){return function(_0xd3eb1f){if(!_0xd3eb1f){_0x2d4584[_0x3286('0x10')](0x194);}return _0xd3eb1f;};}function handleError(_0x4859fc,_0x1567da){_0x1567da=_0x1567da||0x1f4;return function(_0x1928a3){logger[_0x3286('0x1a')](_0x1928a3[_0x3286('0x1b')]);if(_0x1928a3['name']){delete _0x1928a3[_0x3286('0x1c')];}_0x4859fc['status'](_0x1567da)['send'](_0x1928a3);};}exports[_0x3286('0x1d')]=function(_0x220107,_0x3337b1){var _0x16c05a={};var _0xd17f9a=_[_0x3286('0x1e')](db['OpenchannelInteraction']['rawAttributes'],function(_0x40430f){return{'name':_0x40430f['fieldName'],'type':_0x40430f['type'][_0x3286('0x1f')]};});_0x16c05a=qs[_0x3286('0x20')](_0xd17f9a,_0x220107);return interaction[_0x3286('0x21')](_0x3286('0x22'),_0x220107[_0x3286('0x23')],_0x220107[_0x3286('0x24')],_0x16c05a,_0xd17f9a)[_0x3286('0x19')](respondWithFilteredResult(_0x3337b1,_0x16c05a))[_0x3286('0x25')](handleError(_0x3337b1,null));};exports[_0x3286('0x26')]=function(_0x2e82f1,_0x18c953){var _0x205643={};if(_0x2e82f1[_0x3286('0x23')][_0x3286('0x27')]&&_0x2e82f1['query'][_0x3286('0x27')]==='from'){_0x205643[_0x3286('0x28')]=_0x2e82f1[_0x3286('0x29')]['id'];}else{_0x205643['id']=_0x2e82f1['params']['id'];}var _0x569edd={'raw':![],'where':_0x205643},_0x1ffbca={};_0x1ffbca['model']=_[_0x3286('0x2a')](db[_0x3286('0x2b')][_0x3286('0x2c')]);_0x1ffbca['query']=_[_0x3286('0x2a')](_0x2e82f1[_0x3286('0x23')]);_0x1ffbca[_0x3286('0x2d')]=_[_0x3286('0x2e')](_0x1ffbca['model'],_0x1ffbca[_0x3286('0x23')]);_0x569edd['attributes']=_[_0x3286('0x2e')](_0x1ffbca[_0x3286('0x2f')],qs[_0x3286('0x30')](_0x2e82f1[_0x3286('0x23')][_0x3286('0x30')]));_0x569edd['attributes']=_0x569edd[_0x3286('0x31')][_0x3286('0x32')]?_0x569edd[_0x3286('0x31')]:_0x1ffbca[_0x3286('0x2f')];if(_0x2e82f1[_0x3286('0x23')]['includeAll']){_0x569edd['include']=[{'all':!![]}];}_0x569edd=_[_0x3286('0x33')]({},_0x569edd,_0x2e82f1[_0x3286('0x34')]);return db['OpenchannelInteraction'][_0x3286('0x35')](_0x569edd)[_0x3286('0x19')](handleEntityNotFound(_0x18c953,null))[_0x3286('0x19')](respondWithResult(_0x18c953,null))[_0x3286('0x25')](handleError(_0x18c953,null));};exports['create']=function(_0x51ff81,_0x262d42){return db['OpenchannelInteraction'][_0x3286('0x36')](_0x51ff81['body'],{})[_0x3286('0x19')](respondWithResult(_0x262d42,0xc9))[_0x3286('0x25')](handleError(_0x262d42,null));};exports[_0x3286('0x18')]=function(_0x2f7fea,_0x47fb5d){if(_0x2f7fea[_0x3286('0x37')]['id']){delete _0x2f7fea[_0x3286('0x37')]['id'];}return db[_0x3286('0x2b')][_0x3286('0x35')]({'where':{'id':_0x2f7fea['params']['id']}})[_0x3286('0x19')](handleEntityNotFound(_0x47fb5d,null))['then'](saveUpdates(_0x2f7fea[_0x3286('0x37')],null))[_0x3286('0x19')](respondWithResult(_0x47fb5d,null))[_0x3286('0x25')](handleError(_0x47fb5d,null));};exports[_0x3286('0x38')]=function(_0x4588bd,_0xf785a4){return db[_0x3286('0x2b')][_0x3286('0x35')]({'where':{'id':_0x4588bd[_0x3286('0x29')]['id']}})['then'](handleEntityNotFound(_0xf785a4,null))[_0x3286('0x19')](removeEntity(_0xf785a4,null))[_0x3286('0x25')](handleError(_0xf785a4,null));};exports[_0x3286('0x39')]=function(_0x372265,_0x8c8571){return db[_0x3286('0x2b')][_0x3286('0x39')]()['then'](respondWithResult(_0x8c8571,null))[_0x3286('0x25')](handleError(_0x8c8571,null));};exports[_0x3286('0x3a')]=function(_0x229f57,_0x4e3a3d){return db['OpenchannelMessage'][_0x3286('0x35')]({'where':{'id':_0x229f57[_0x3286('0x29')]['id']}})['then'](handleEntityNotFound(_0x4e3a3d,null))[_0x3286('0x19')](function(_0x13b457){if(_0x13b457){return _0x13b457[_0x3286('0x3a')](_0x229f57[_0x3286('0x37')][_0x3286('0x3b')],_[_0x3286('0x3c')](_0x229f57[_0x3286('0x37')],[_0x3286('0x3b'),'id'])||{});}})[_0x3286('0x19')](respondWithResult(_0x4e3a3d,null))[_0x3286('0x25')](handleError(_0x4e3a3d,null));};exports['getMessages']=function(_0x4793d1,_0x38ff66){var _0x423526={'raw':![],'where':{}};var _0x12b923={};var _0x50f858={'count':0x0,'rows':[]};return db[_0x3286('0x2b')][_0x3286('0x3d')]({'where':{'id':_0x4793d1[_0x3286('0x29')]['id']}})[_0x3286('0x19')](handleEntityNotFound(_0x38ff66,null))[_0x3286('0x19')](function(_0x3d6f9b){if(_0x3d6f9b){_0x12b923['model']=_[_0x3286('0x2a')](db[_0x3286('0x3e')][_0x3286('0x2c')]);_0x12b923[_0x3286('0x23')]=_[_0x3286('0x2a')](_0x4793d1['query']);_0x12b923[_0x3286('0x2d')]=_[_0x3286('0x2e')](_0x12b923[_0x3286('0x2f')],_0x12b923[_0x3286('0x23')]);_0x423526[_0x3286('0x31')]=_[_0x3286('0x2e')](_0x12b923[_0x3286('0x2f')],qs[_0x3286('0x30')](_0x4793d1['query'][_0x3286('0x30')]));_0x423526[_0x3286('0x31')]=_0x423526['attributes'][_0x3286('0x32')]?_0x423526[_0x3286('0x31')]:_0x12b923[_0x3286('0x2f')];if(!_0x4793d1[_0x3286('0x23')]['hasOwnProperty'](_0x3286('0x3f'))){_0x423526[_0x3286('0x15')]=qs[_0x3286('0x15')](_0x4793d1[_0x3286('0x23')][_0x3286('0x15')]);_0x423526['offset']=qs[_0x3286('0x13')](_0x4793d1[_0x3286('0x23')]['offset']);}_0x423526[_0x3286('0x40')]=qs['sort'](_0x4793d1[_0x3286('0x23')][_0x3286('0x41')]);_0x423526[_0x3286('0x42')]=qs[_0x3286('0x2d')](_[_0x3286('0x43')](_0x4793d1['query'],_0x12b923[_0x3286('0x2d')]));_0x423526[_0x3286('0x42')]['OpenchannelInteractionId']=_0x3d6f9b['id'];if(_0x4793d1[_0x3286('0x23')][_0x3286('0x44')]){_0x423526['where']=_[_0x3286('0x33')](_0x423526[_0x3286('0x42')],{'$or':_[_0x3286('0x1e')](_0x423526[_0x3286('0x31')],function(_0x1465ee){var _0x22d0f9={};_0x22d0f9[_0x1465ee]={'$like':'%'+_0x4793d1[_0x3286('0x23')][_0x3286('0x44')]+'%'};return _0x22d0f9;})});}if(_0x4793d1[_0x3286('0x23')][_0x3286('0x45')]){var _0x574a7b=_0x4793d1[_0x3286('0x23')][_0x3286('0x45')][_0x3286('0x46')](',');var _0x4f7987={};_0x4f7987[_0x574a7b[0x0]]={'$gte':moment(_0x574a7b[0x1])['format'](_0x3286('0x47'))};_0x423526[_0x3286('0x42')]=_[_0x3286('0x33')](_0x423526[_0x3286('0x42')],_0x4f7987);}_0x423526=_[_0x3286('0x33')]({},_0x423526,_0x4793d1[_0x3286('0x34')]);return db[_0x3286('0x3e')][_0x3286('0x16')]({'where':_0x423526[_0x3286('0x42')]})[_0x3286('0x19')](function(_0x460639){_0x50f858['count']=_0x460639;if(_0x4793d1['query'][_0x3286('0x48')]){_0x423526[_0x3286('0x49')]=[{'all':!![]}];}return db[_0x3286('0x3e')][_0x3286('0x21')](_0x423526);})['then'](function(_0x4807d1){_0x50f858[_0x3286('0x4a')]=_0x4807d1;return _0x50f858;});}})[_0x3286('0x19')](respondWithFilteredResult(_0x38ff66,_0x423526))[_0x3286('0x25')](handleError(_0x38ff66,null));};exports[_0x3286('0x4b')]=function(_0x28fe5f,_0x1417ba){return db[_0x3286('0x2b')]['find']({'where':{'id':_0x28fe5f[_0x3286('0x29')]['id']}})[_0x3286('0x19')](handleEntityNotFound(_0x1417ba,null))[_0x3286('0x19')](function(_0xe41608){if(_0xe41608){return _0xe41608[_0x3286('0x4c')](_0x28fe5f[_0x3286('0x37')][_0x3286('0x3b')],_[_0x3286('0x3c')](_0x28fe5f[_0x3286('0x37')],['ids','id'])||{})[_0x3286('0x4d')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x28fe5f[_0x3286('0x37')][_0x3286('0x3b')]}});})['then'](function(_0x507fe1){socket[_0x3286('0x4e')]('openchannelInteractionTags:save',{'id':Number(_0x28fe5f[_0x3286('0x29')]['id']),'tags':_0x507fe1||[]});return{'id':Number(_0x28fe5f[_0x3286('0x29')]['id']),'tags':_0x507fe1||[]};});}})[_0x3286('0x19')](respondWithResult(_0x1417ba,null))[_0x3286('0x25')](handleError(_0x1417ba,null));};exports[_0x3286('0x4f')]=function(_0x4e2bf5,_0x27a04c){return db['OpenchannelInteraction'][_0x3286('0x35')]({'where':{'id':_0x4e2bf5['params']['id']}})[_0x3286('0x19')](handleEntityNotFound(_0x27a04c,null))[_0x3286('0x19')](function(_0x332c1a){if(_0x332c1a){return _0x332c1a[_0x3286('0x4f')](_0x4e2bf5[_0x3286('0x23')]['ids']);}})[_0x3286('0x19')](respondWithStatusCode(_0x27a04c,null))[_0x3286('0x25')](handleError(_0x27a04c,null));};exports['download']=function(_0x209160,_0x5c00e0){var _0x585d55=moment()['unix']()['toString']();var _0x5c3b49=path[_0x3286('0x50')](config[_0x3286('0x51')],_0x3286('0x52'),_0x3286('0x53'),_0x3286('0x54'));var _0x462d08=path[_0x3286('0x50')](config['root'],_0x3286('0x52'),_0x3286('0x53'),'attachments');var _0x1d2b8e=path[_0x3286('0x50')](_0x5c3b49,_0x585d55);var _0x539c19=util['format']('transcript-%d-%s.zip',_0x209160[_0x3286('0x29')]['id'],_0x585d55);var _0x30d14d=path['join'](_0x5c3b49,_0x539c19);var _0x3179ad=[];_0x3179ad[_0x3286('0x55')]({'model':db[_0x3286('0x56')],'as':_0x3286('0x56'),'attributes':['id',_0x3286('0x57')],'raw':!![]});_0x3179ad['push']({'model':db[_0x3286('0x58')],'as':_0x3286('0x59'),'attributes':['id',_0x3286('0x5a'),'lastName'],'raw':!![]});if(_0x209160['query'][_0x3286('0x5b')]){_0x3179ad['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x4f2aa4=[{'model':db[_0x3286('0x3e')],'as':'Messages','attributes':['id',_0x3286('0x37'),_0x3286('0x5c'),'direction',_0x3286('0x5d'),'read'],'include':_0x3179ad}];_0x4f2aa4[_0x3286('0x55')]({'model':db['OpenchannelAccount'],'as':_0x3286('0x5e'),'attributes':['id',_0x3286('0x1c')]});_0x4f2aa4[_0x3286('0x55')]({'model':db[_0x3286('0x56')],'as':_0x3286('0x5f'),'attributes':['id',_0x3286('0x57')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x209160[_0x3286('0x29')]['id']},'include':_0x4f2aa4})[_0x3286('0x19')](handleEntityNotFound(_0x5c00e0,null))[_0x3286('0x19')](function(_0x5e380e){if(_0x5e380e){var _0x3c7760=_0x5e380e[_0x3286('0x60')]({'plain':!![]});fs[_0x3286('0x61')](_0x1d2b8e);var _0x46d68c={'channel':_0x3286('0x62'),'account':_0x3c7760[_0x3286('0x5e')][_0x3286('0x1c')],'agent':_0x3c7760[_0x3286('0x5f')]?_0x3c7760['Owner'][_0x3286('0x57')]:'N.A.','createdAt':moment(_0x3c7760['createdAt'])[_0x3286('0x63')](_0x3286('0x47'))[_0x3286('0x64')](),'closedAt':_0x3c7760[_0x3286('0x65')]?moment(_0x3c7760['closedAt'])[_0x3286('0x63')](_0x3286('0x47'))[_0x3286('0x64')]():'','disposition':_0x3c7760[_0x3286('0x66')],'visibility':_0x3c7760[_0x3286('0x67')]?_0x3286('0x68'):'Private','messages':_(_0x3c7760[_0x3286('0x69')])[_0x3286('0x44')]({'secret':![]})[_0x3286('0x1e')](function(_0x45efee){if(_0x45efee[_0x3286('0x6a')]){var _0x4352b0=path[_0x3286('0x50')](_0x462d08,_0x45efee[_0x3286('0x6a')]['basename']);if(fs[_0x3286('0x6b')](_0x4352b0)){fs[_0x3286('0x6c')](_0x4352b0)['pipe'](fs[_0x3286('0x6d')](path['join'](_0x1d2b8e,_0x45efee[_0x3286('0x6a')]['basename'])));}}return{'date':moment(_0x45efee['createdAt'])['format'](_0x3286('0x47'))['toString'](),'sender':_0x45efee[_0x3286('0x6e')]==='out'?_0x45efee[_0x3286('0x56')]?_0x45efee[_0x3286('0x56')][_0x3286('0x57')]:'System':_0x45efee[_0x3286('0x59')]['firstName']+(_0x45efee['Contact'][_0x3286('0x6f')]?'\x20'+_0x45efee[_0x3286('0x59')]['lastName']:''),'body':_0x45efee[_0x3286('0x6a')]?_0x45efee[_0x3286('0x6a')][_0x3286('0x70')]:_0x45efee['body'],'direction':_0x45efee[_0x3286('0x6e')]===_0x3286('0x71')?'A':'C','secret':_0x45efee['secret'],'read':_0x45efee[_0x3286('0x72')],'attachment':_0x45efee[_0x3286('0x6a')]};})[_0x3286('0x73')]()};return ejs[_0x3286('0x74')](path[_0x3286('0x50')](config[_0x3286('0x51')],_0x3286('0x52'),_0x3286('0x75'),_0x3286('0x76')),{'interaction':_0x46d68c})[_0x3286('0x19')](function(_0x3711c5){var _0x3839a4=path['join'](_0x1d2b8e,_0x3286('0x77')+_0x3c7760['id']+'-'+_0x585d55+_0x3286('0x78'));var _0x28fa3f={'path':_0x3839a4,'channel':_0x3286('0x62'),'interactionId':_0x3c7760['id']};return pdf['createPdfFromHTML'](_0x3711c5,_0x28fa3f);})[_0x3286('0x19')](function(){return new Promise(function(_0x126d4a,_0x24b8cb){zipdir(_0x1d2b8e,{'saveTo':_0x30d14d},function(_0x2edc9d,_0x512e38){if(_0x2edc9d)return _0x24b8cb(_0x2edc9d);return _0x126d4a(_0x512e38);});})[_0x3286('0x19')](function(){return new Promise(function(_0x21fa21,_0x3b6fd9){rimraf(_0x1d2b8e,function(_0x50494e){if(_0x50494e)_0x3b6fd9(_0x50494e);return _0x21fa21();});});})['then'](function(){return _0x5c00e0[_0x3286('0x79')](_0x30d14d,_0x539c19,function(_0xdfc090){if(_0xdfc090){logger[_0x3286('0x1a')](_0x3286('0x7a'),_0xdfc090);}else{fs[_0x3286('0x7b')](_0x30d14d);}});});});}else{return _0x5c00e0[_0x3286('0x10')](0xc8);}})[_0x3286('0x25')](handleError(_0x5c00e0,null));}; \ No newline at end of file +var _0x5e6c=['params','model','rawAttributes','keys','intersection','attributes','fields','length','include','merge','options','find','create','body','destroy','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','filters','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','files','server','join','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','secret','read','push','Account','mkdirSync','Openchannel','Owner','N.A.','toString','closed','closedAt','threadId','Private','createReadStream','pipe','createWriteStream','basename','out','System','Contact','direction','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','error','stack','name','send','index','map','OpenchannelInteraction','type','key','getOptions','openchannel','query','user','catch','show','from'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5e6c,0x1ce));var _0xc5e6=function(_0x5a720c,_0x20c926){_0x5a720c=_0x5a720c-0x0;var _0xf7bdfc=_0x5e6c[_0x5a720c];return _0xf7bdfc;};'use strict';var rimraf=require(_0xc5e6('0x0'));var zipdir=require(_0xc5e6('0x1'));var moment=require(_0xc5e6('0x2'));var util=require(_0xc5e6('0x3'));var path=require(_0xc5e6('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xc5e6('0x5'));var qs=require(_0xc5e6('0x6'));var pdf=require(_0xc5e6('0x7'));var logger=require(_0xc5e6('0x8'))('api');var config=require('../../config/environment');var db=require(_0xc5e6('0x9'))['db'];config[_0xc5e6('0xa')]=_[_0xc5e6('0xb')](config['redis'],{'host':_0xc5e6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5e6('0xa')]));require(_0xc5e6('0xd'))['register'](socket);function respondWithStatusCode(_0x26337f,_0x22eb1b){_0x22eb1b=_0x22eb1b||0xcc;return function(_0x137bfc){if(_0x137bfc){return _0x26337f[_0xc5e6('0xe')](_0x22eb1b);}return _0x26337f[_0xc5e6('0xf')](_0x22eb1b)[_0xc5e6('0x10')]();};}function respondWithResult(_0xee8bdc,_0x37a583){_0x37a583=_0x37a583||0xc8;return function(_0x35a532){if(_0x35a532){return _0xee8bdc[_0xc5e6('0xf')](_0x37a583)[_0xc5e6('0x11')](_0x35a532);}};}function respondWithFilteredResult(_0x411669,_0x315d97){return function(_0x3aef03){if(_0x3aef03){var _0x1fa057=typeof _0x315d97['offset']===_0xc5e6('0x12')&&typeof _0x315d97[_0xc5e6('0x13')]===_0xc5e6('0x12');var _0x2ff74a=_0x3aef03['count'];var _0x4c5a59=_0x1fa057?0x0:_0x315d97['offset'];var _0x1c8f3c=_0x1fa057?_0x3aef03[_0xc5e6('0x14')]:_0x315d97[_0xc5e6('0x15')]+_0x315d97[_0xc5e6('0x13')];var _0x39d600;if(_0x1c8f3c>=_0x2ff74a){_0x1c8f3c=_0x2ff74a;_0x39d600=0xc8;}else{_0x39d600=0xce;}_0x411669[_0xc5e6('0xf')](_0x39d600);return _0x411669[_0xc5e6('0x16')](_0xc5e6('0x17'),_0x4c5a59+'-'+_0x1c8f3c+'/'+_0x2ff74a)[_0xc5e6('0x11')](_0x3aef03);}return null;};}function saveUpdates(_0x59327a){return function(_0x1a72e4){if(_0x1a72e4){return _0x1a72e4[_0xc5e6('0x18')](_0x59327a)['then'](function(_0x30a58e){return _0x30a58e;});}return null;};}function removeEntity(_0x58c0ab){return function(_0x5cb227){if(_0x5cb227){return _0x5cb227['destroy']()[_0xc5e6('0x19')](function(){_0x58c0ab[_0xc5e6('0xf')](0xcc)[_0xc5e6('0x10')]();});}};}function handleEntityNotFound(_0x1a92de){return function(_0x563c3b){if(!_0x563c3b){_0x1a92de[_0xc5e6('0xe')](0x194);}return _0x563c3b;};}function handleError(_0x1824b6,_0x5885da){_0x5885da=_0x5885da||0x1f4;return function(_0x1e4b56){logger[_0xc5e6('0x1a')](_0x1e4b56[_0xc5e6('0x1b')]);if(_0x1e4b56[_0xc5e6('0x1c')]){delete _0x1e4b56[_0xc5e6('0x1c')];}_0x1824b6[_0xc5e6('0xf')](_0x5885da)[_0xc5e6('0x1d')](_0x1e4b56);};}exports[_0xc5e6('0x1e')]=function(_0x41b451,_0x5ecb0c){var _0x522fda={};var _0x5ec880=_[_0xc5e6('0x1f')](db[_0xc5e6('0x20')]['rawAttributes'],function(_0x2e71e6){return{'name':_0x2e71e6['fieldName'],'type':_0x2e71e6[_0xc5e6('0x21')][_0xc5e6('0x22')]};});_0x522fda=qs[_0xc5e6('0x23')](_0x5ec880,_0x41b451);return interaction['findAll'](_0xc5e6('0x24'),_0x41b451[_0xc5e6('0x25')],_0x41b451[_0xc5e6('0x26')],_0x522fda,_0x5ec880)['then'](respondWithFilteredResult(_0x5ecb0c,_0x522fda))[_0xc5e6('0x27')](handleError(_0x5ecb0c,null));};exports[_0xc5e6('0x28')]=function(_0x2fbe88,_0x401f44){var _0x18acfb={};if(_0x2fbe88[_0xc5e6('0x25')][_0xc5e6('0x21')]&&_0x2fbe88[_0xc5e6('0x25')][_0xc5e6('0x21')]==='from'){_0x18acfb[_0xc5e6('0x29')]=_0x2fbe88[_0xc5e6('0x2a')]['id'];}else{_0x18acfb['id']=_0x2fbe88[_0xc5e6('0x2a')]['id'];}var _0x3c6d07={'raw':![],'where':_0x18acfb},_0x23fc36={};_0x23fc36[_0xc5e6('0x2b')]=_['keys'](db[_0xc5e6('0x20')][_0xc5e6('0x2c')]);_0x23fc36[_0xc5e6('0x25')]=_[_0xc5e6('0x2d')](_0x2fbe88['query']);_0x23fc36['filters']=_[_0xc5e6('0x2e')](_0x23fc36[_0xc5e6('0x2b')],_0x23fc36[_0xc5e6('0x25')]);_0x3c6d07[_0xc5e6('0x2f')]=_['intersection'](_0x23fc36[_0xc5e6('0x2b')],qs[_0xc5e6('0x30')](_0x2fbe88[_0xc5e6('0x25')]['fields']));_0x3c6d07[_0xc5e6('0x2f')]=_0x3c6d07['attributes'][_0xc5e6('0x31')]?_0x3c6d07[_0xc5e6('0x2f')]:_0x23fc36['model'];if(_0x2fbe88[_0xc5e6('0x25')]['includeAll']){_0x3c6d07[_0xc5e6('0x32')]=[{'all':!![]}];}_0x3c6d07=_[_0xc5e6('0x33')]({},_0x3c6d07,_0x2fbe88[_0xc5e6('0x34')]);return db['OpenchannelInteraction'][_0xc5e6('0x35')](_0x3c6d07)[_0xc5e6('0x19')](handleEntityNotFound(_0x401f44,null))['then'](respondWithResult(_0x401f44,null))[_0xc5e6('0x27')](handleError(_0x401f44,null));};exports['create']=function(_0x48750d,_0x2a6d53){return db[_0xc5e6('0x20')][_0xc5e6('0x36')](_0x48750d[_0xc5e6('0x37')],{})['then'](respondWithResult(_0x2a6d53,0xc9))[_0xc5e6('0x27')](handleError(_0x2a6d53,null));};exports[_0xc5e6('0x18')]=function(_0x561af2,_0x336100){if(_0x561af2['body']['id']){delete _0x561af2[_0xc5e6('0x37')]['id'];}return db[_0xc5e6('0x20')][_0xc5e6('0x35')]({'where':{'id':_0x561af2['params']['id']}})['then'](handleEntityNotFound(_0x336100,null))['then'](saveUpdates(_0x561af2['body'],null))['then'](respondWithResult(_0x336100,null))[_0xc5e6('0x27')](handleError(_0x336100,null));};exports[_0xc5e6('0x38')]=function(_0x228f47,_0x1b417c){return db[_0xc5e6('0x20')]['find']({'where':{'id':_0x228f47['params']['id']}})[_0xc5e6('0x19')](handleEntityNotFound(_0x1b417c,null))[_0xc5e6('0x19')](removeEntity(_0x1b417c,null))[_0xc5e6('0x27')](handleError(_0x1b417c,null));};exports['describe']=function(_0x572cbc,_0x22236b){return db[_0xc5e6('0x20')]['describe']()[_0xc5e6('0x19')](respondWithResult(_0x22236b,null))[_0xc5e6('0x27')](handleError(_0x22236b,null));};exports[_0xc5e6('0x39')]=function(_0x4df199,_0x255b46){return db['OpenchannelMessage'][_0xc5e6('0x35')]({'where':{'id':_0x4df199[_0xc5e6('0x2a')]['id']}})[_0xc5e6('0x19')](handleEntityNotFound(_0x255b46,null))[_0xc5e6('0x19')](function(_0x1fd459){if(_0x1fd459){return _0x1fd459[_0xc5e6('0x39')](_0x4df199[_0xc5e6('0x37')]['ids'],_[_0xc5e6('0x3a')](_0x4df199[_0xc5e6('0x37')],[_0xc5e6('0x3b'),'id'])||{});}})[_0xc5e6('0x19')](respondWithResult(_0x255b46,null))['catch'](handleError(_0x255b46,null));};exports[_0xc5e6('0x3c')]=function(_0x592e1d,_0x41d3a7){var _0x2e5867={'raw':![],'where':{}};var _0x4c466b={};var _0x21ead6={'count':0x0,'rows':[]};return db[_0xc5e6('0x20')][_0xc5e6('0x3d')]({'where':{'id':_0x592e1d['params']['id']}})['then'](handleEntityNotFound(_0x41d3a7,null))[_0xc5e6('0x19')](function(_0x1d7ba5){if(_0x1d7ba5){_0x4c466b['model']=_[_0xc5e6('0x2d')](db[_0xc5e6('0x3e')][_0xc5e6('0x2c')]);_0x4c466b['query']=_['keys'](_0x592e1d[_0xc5e6('0x25')]);_0x4c466b[_0xc5e6('0x3f')]=_[_0xc5e6('0x2e')](_0x4c466b[_0xc5e6('0x2b')],_0x4c466b[_0xc5e6('0x25')]);_0x2e5867[_0xc5e6('0x2f')]=_[_0xc5e6('0x2e')](_0x4c466b[_0xc5e6('0x2b')],qs[_0xc5e6('0x30')](_0x592e1d[_0xc5e6('0x25')]['fields']));_0x2e5867[_0xc5e6('0x2f')]=_0x2e5867[_0xc5e6('0x2f')][_0xc5e6('0x31')]?_0x2e5867[_0xc5e6('0x2f')]:_0x4c466b[_0xc5e6('0x2b')];if(!_0x592e1d[_0xc5e6('0x25')]['hasOwnProperty']('nolimit')){_0x2e5867[_0xc5e6('0x13')]=qs[_0xc5e6('0x13')](_0x592e1d['query']['limit']);_0x2e5867[_0xc5e6('0x15')]=qs['offset'](_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x15')]);}_0x2e5867[_0xc5e6('0x40')]=qs[_0xc5e6('0x41')](_0x592e1d[_0xc5e6('0x25')]['sort']);_0x2e5867[_0xc5e6('0x42')]=qs[_0xc5e6('0x3f')](_[_0xc5e6('0x43')](_0x592e1d[_0xc5e6('0x25')],_0x4c466b[_0xc5e6('0x3f')]));_0x2e5867[_0xc5e6('0x42')][_0xc5e6('0x44')]=_0x1d7ba5['id'];if(_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x45')]){_0x2e5867['where']=_[_0xc5e6('0x33')](_0x2e5867[_0xc5e6('0x42')],{'$or':_['map'](_0x2e5867[_0xc5e6('0x2f')],function(_0xcfc18f){var _0x5917fd={};_0x5917fd[_0xcfc18f]={'$like':'%'+_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x45')]+'%'};return _0x5917fd;})});}if(_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x46')]){var _0x1a4eec=_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x46')][_0xc5e6('0x47')](',');var _0x3b5f89={};_0x3b5f89[_0x1a4eec[0x0]]={'$gte':moment(_0x1a4eec[0x1])[_0xc5e6('0x48')](_0xc5e6('0x49'))};_0x2e5867[_0xc5e6('0x42')]=_['merge'](_0x2e5867[_0xc5e6('0x42')],_0x3b5f89);}_0x2e5867=_[_0xc5e6('0x33')]({},_0x2e5867,_0x592e1d[_0xc5e6('0x34')]);return db['OpenchannelMessage'][_0xc5e6('0x14')]({'where':_0x2e5867[_0xc5e6('0x42')]})[_0xc5e6('0x19')](function(_0x32cdd0){_0x21ead6['count']=_0x32cdd0;if(_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x4a')]){_0x2e5867[_0xc5e6('0x32')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc5e6('0x4b')](_0x2e5867);})[_0xc5e6('0x19')](function(_0x58340c){_0x21ead6[_0xc5e6('0x4c')]=_0x58340c;return _0x21ead6;});}})[_0xc5e6('0x19')](respondWithFilteredResult(_0x41d3a7,_0x2e5867))[_0xc5e6('0x27')](handleError(_0x41d3a7,null));};exports['addTags']=function(_0x4cb326,_0x40cf07){return db[_0xc5e6('0x20')][_0xc5e6('0x35')]({'where':{'id':_0x4cb326[_0xc5e6('0x2a')]['id']}})[_0xc5e6('0x19')](handleEntityNotFound(_0x40cf07,null))[_0xc5e6('0x19')](function(_0x54d1cf){if(_0x54d1cf){return _0x54d1cf[_0xc5e6('0x4d')](_0x4cb326[_0xc5e6('0x37')][_0xc5e6('0x3b')],_['omit'](_0x4cb326[_0xc5e6('0x37')],[_0xc5e6('0x3b'),'id'])||{})[_0xc5e6('0x4e')](function(){return db[_0xc5e6('0x4f')]['findAll']({'attributes':['id',_0xc5e6('0x1c'),_0xc5e6('0x50')],'where':{'id':_0x4cb326['body']['ids']}});})[_0xc5e6('0x19')](function(_0x1ce17b){socket[_0xc5e6('0x51')](_0xc5e6('0x52'),{'id':Number(_0x4cb326[_0xc5e6('0x2a')]['id']),'tags':_0x1ce17b||[]});return{'id':Number(_0x4cb326[_0xc5e6('0x2a')]['id']),'tags':_0x1ce17b||[]};});}})[_0xc5e6('0x19')](respondWithResult(_0x40cf07,null))[_0xc5e6('0x27')](handleError(_0x40cf07,null));};exports[_0xc5e6('0x53')]=function(_0x145720,_0xb9e32b){return db[_0xc5e6('0x20')][_0xc5e6('0x35')]({'where':{'id':_0x145720['params']['id']}})[_0xc5e6('0x19')](handleEntityNotFound(_0xb9e32b,null))[_0xc5e6('0x19')](function(_0x26ec37){if(_0x26ec37){return _0x26ec37[_0xc5e6('0x53')](_0x145720[_0xc5e6('0x25')][_0xc5e6('0x3b')]);}})['then'](respondWithStatusCode(_0xb9e32b,null))[_0xc5e6('0x27')](handleError(_0xb9e32b,null));};exports[_0xc5e6('0x54')]=function(_0x2b6c38,_0x2ede5f){var _0x52665b=moment()[_0xc5e6('0x55')]()['toString']();var _0x2d0a62=path['join'](config[_0xc5e6('0x56')],'server',_0xc5e6('0x57'),'tmp');var _0x1c1ba6=path['join'](config[_0xc5e6('0x56')],_0xc5e6('0x58'),_0xc5e6('0x57'),'attachments');var _0x43290b=path['join'](_0x2d0a62,_0x52665b);var _0x4d2a2e=util[_0xc5e6('0x48')]('transcript-%d-%s.zip',_0x2b6c38[_0xc5e6('0x2a')]['id'],_0x52665b);var _0x43aeb9=path[_0xc5e6('0x59')](_0x2d0a62,_0x4d2a2e);var _0x23df23=[];_0x23df23['push']({'model':db[_0xc5e6('0x5a')],'as':'User','attributes':['id',_0xc5e6('0x5b')],'raw':!![]});_0x23df23['push']({'model':db[_0xc5e6('0x5c')],'as':'Contact','attributes':['id',_0xc5e6('0x5d'),_0xc5e6('0x5e')],'raw':!![]});if(_0x2b6c38[_0xc5e6('0x25')]['attachments']){_0x23df23['push']({'model':db[_0xc5e6('0x5f')],'as':'Attachment','raw':!![]});}var _0x8dd8e1=[{'model':db[_0xc5e6('0x3e')],'as':_0xc5e6('0x60'),'attributes':['id',_0xc5e6('0x37'),_0xc5e6('0x61'),'direction',_0xc5e6('0x62'),_0xc5e6('0x63')],'include':_0x23df23}];_0x8dd8e1[_0xc5e6('0x64')]({'model':db['OpenchannelAccount'],'as':_0xc5e6('0x65'),'attributes':['id',_0xc5e6('0x1c')]});_0x8dd8e1[_0xc5e6('0x64')]({'model':db['User'],'as':'Owner','attributes':['id',_0xc5e6('0x5b')]});return db[_0xc5e6('0x20')][_0xc5e6('0x35')]({'where':{'id':_0x2b6c38[_0xc5e6('0x2a')]['id']},'include':_0x8dd8e1})[_0xc5e6('0x19')](handleEntityNotFound(_0x2ede5f,null))['then'](function(_0x15813f){if(_0x15813f){var _0x213422=_0x15813f['get']({'plain':!![]});fs[_0xc5e6('0x66')](_0x43290b);var _0x5d1915={'channel':_0xc5e6('0x67'),'account':_0x213422[_0xc5e6('0x65')]['name'],'agent':_0x213422['Owner']?_0x213422[_0xc5e6('0x68')][_0xc5e6('0x5b')]:_0xc5e6('0x69'),'createdAt':moment(_0x213422[_0xc5e6('0x61')])[_0xc5e6('0x48')](_0xc5e6('0x49'))[_0xc5e6('0x6a')](),'closedAt':_0x213422[_0xc5e6('0x6b')]?moment(_0x213422[_0xc5e6('0x6c')])['format'](_0xc5e6('0x49'))[_0xc5e6('0x6a')]():'','disposition':_0x213422['disposition'],'visibility':_0x213422[_0xc5e6('0x6d')]?'Public':_0xc5e6('0x6e'),'messages':_(_0x213422['Messages'])['filter']({'secret':![]})[_0xc5e6('0x1f')](function(_0x13a579){if(_0x13a579[_0xc5e6('0x5f')]){var _0x27de98=path[_0xc5e6('0x59')](_0x1c1ba6,_0x13a579[_0xc5e6('0x5f')]['basename']);if(fs['existsSync'](_0x27de98)){fs[_0xc5e6('0x6f')](_0x27de98)[_0xc5e6('0x70')](fs[_0xc5e6('0x71')](path[_0xc5e6('0x59')](_0x43290b,_0x13a579[_0xc5e6('0x5f')][_0xc5e6('0x72')])));}}return{'date':moment(_0x13a579[_0xc5e6('0x61')])[_0xc5e6('0x48')](_0xc5e6('0x49'))[_0xc5e6('0x6a')](),'sender':_0x13a579['direction']===_0xc5e6('0x73')?_0x13a579[_0xc5e6('0x5a')]?_0x13a579[_0xc5e6('0x5a')][_0xc5e6('0x5b')]:_0xc5e6('0x74'):_0x13a579[_0xc5e6('0x75')][_0xc5e6('0x5d')]+(_0x13a579[_0xc5e6('0x75')][_0xc5e6('0x5e')]?'\x20'+_0x13a579['Contact'][_0xc5e6('0x5e')]:''),'body':_0x13a579[_0xc5e6('0x5f')]?_0x13a579[_0xc5e6('0x5f')][_0xc5e6('0x72')]:_0x13a579[_0xc5e6('0x37')],'direction':_0x13a579[_0xc5e6('0x76')]===_0xc5e6('0x73')?'A':'C','secret':_0x13a579[_0xc5e6('0x62')],'read':_0x13a579[_0xc5e6('0x63')],'attachment':_0x13a579[_0xc5e6('0x5f')]};})[_0xc5e6('0x77')]()};return ejs[_0xc5e6('0x78')](path['join'](config[_0xc5e6('0x56')],_0xc5e6('0x58'),_0xc5e6('0x79'),_0xc5e6('0x7a')),{'interaction':_0x5d1915})[_0xc5e6('0x19')](function(_0x1458d3){var _0x4c322d=path[_0xc5e6('0x59')](_0x43290b,_0xc5e6('0x7b')+_0x213422['id']+'-'+_0x52665b+_0xc5e6('0x7c'));var _0x162bd2={'path':_0x4c322d,'channel':_0xc5e6('0x67'),'interactionId':_0x213422['id']};return pdf['createPdfFromHTML'](_0x1458d3,_0x162bd2);})['then'](function(){return new Promise(function(_0x2488f3,_0x46c8e9){zipdir(_0x43290b,{'saveTo':_0x43aeb9},function(_0x1df71a,_0x20cd1d){if(_0x1df71a)return _0x46c8e9(_0x1df71a);return _0x2488f3(_0x20cd1d);});})[_0xc5e6('0x19')](function(){return new Promise(function(_0x1ac7d8,_0x371e0d){rimraf(_0x43290b,function(_0x399bde){if(_0x399bde)_0x371e0d(_0x399bde);return _0x1ac7d8();});});})[_0xc5e6('0x19')](function(){return _0x2ede5f['download'](_0x43aeb9,_0x4d2a2e,function(_0x2ee4fb){if(_0x2ee4fb){logger[_0xc5e6('0x1a')](_0xc5e6('0x7d'),_0x2ee4fb);}else{fs['unlinkSync'](_0x43aeb9);}});});});}else{return _0x2ede5f[_0xc5e6('0xe')](0xc8);}})['catch'](handleError(_0x2ede5f,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c988aa6..7eb397a 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 _0x2e4f=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x36811e,_0xf01330){var _0x48bafb=function(_0x3f569c){while(--_0x3f569c){_0x36811e['push'](_0x36811e['shift']());}};_0x48bafb(++_0xf01330);}(_0x2e4f,0x18d));var _0xf2e4=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0x2e4f[_0x42c118];return _0x112ebd;};'use strict';var EventEmitter=require(_0xf2e4('0x0'));var OpenchannelInteraction=require(_0xf2e4('0x1'))['db'][_0xf2e4('0x2')];var OpenchannelMessage=require(_0xf2e4('0x1'))['db'][_0xf2e4('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf2e4('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5eb634){return function(_0x1141e1,_0x15f033,_0x13c15e){_0x1141e1[_0xf2e4('0x5')]({'attributes':['id'],'raw':!![]})[_0xf2e4('0x6')](function(_0x412b68){_0x1141e1[_0xf2e4('0x7')](_0xf2e4('0x8'),_0x412b68[_0xf2e4('0x9')](function(_0x32c905){return{'id':_0x32c905['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x1141e1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf2e4('0x6')](function(_0x198fb8){_0x1141e1[_0xf2e4('0x7')](_0xf2e4('0xa'),_0x198fb8[_0xf2e4('0xb')]);OpenchannelInteractionEvents[_0xf2e4('0xc')](_0x5eb634+':'+_0x1141e1['id'],_0x1141e1);OpenchannelInteractionEvents[_0xf2e4('0xc')](_0x5eb634,_0x1141e1);_0x13c15e(null);})[_0xf2e4('0xd')](_0x13c15e(null));};}for(var e in events){if(events[_0xf2e4('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xf2e4('0xf')](e,emitEvent(event));}}module[_0xf2e4('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4174=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll'];(function(_0x4d88e9,_0x37bd4a){var _0x5299a6=function(_0x274ee5){while(--_0x274ee5){_0x4d88e9['push'](_0x4d88e9['shift']());}};_0x5299a6(++_0x37bd4a);}(_0x4174,0x124));var _0x4417=function(_0x30a28b,_0x4dc624){_0x30a28b=_0x30a28b-0x0;var _0x3786fd=_0x4174[_0x30a28b];return _0x3786fd;};'use strict';var EventEmitter=require(_0x4417('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x4417('0x1')];var OpenchannelMessage=require(_0x4417('0x2'))['db'][_0x4417('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4417('0x4')](0x0);var events={'afterCreate':_0x4417('0x5'),'afterUpdate':_0x4417('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4ee719){return function(_0x29f397,_0x34150c,_0x5d09b9){_0x29f397[_0x4417('0x7')]({'attributes':['id'],'raw':!![]})[_0x4417('0x8')](function(_0x3885c0){_0x29f397[_0x4417('0x9')](_0x4417('0xa'),_0x3885c0['map'](function(_0x30ce82){return{'id':_0x30ce82['id']};}));return OpenchannelMessage[_0x4417('0xb')]({'where':{'OpenchannelInteractionId':_0x29f397['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4417('0x8')](function(_0xd95ee0){_0x29f397['setDataValue'](_0x4417('0xc'),_0xd95ee0[_0x4417('0xd')]);OpenchannelInteractionEvents['emit'](_0x4ee719+':'+_0x29f397['id'],_0x29f397);OpenchannelInteractionEvents[_0x4417('0xe')](_0x4ee719,_0x29f397);_0x5d09b9(null);})[_0x4417('0xf')](_0x5d09b9(null));};}for(var e in events){if(events[_0x4417('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x4417('0x11')](e,emitEvent(event));}}module[_0x4417('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 c2224a2..88b7b15 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 _0x816f=['utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','request-promise','path','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4'];(function(_0x350228,_0x54a3e6){var _0x53cbdc=function(_0xb0a0cd){while(--_0xb0a0cd){_0x350228['push'](_0x350228['shift']());}};_0x53cbdc(++_0x54a3e6);}(_0x816f,0x1af));var _0xf816=function(_0x2076f3,_0x15c894){_0x2076f3=_0x2076f3-0x0;var _0x49cb48=_0x816f[_0x2076f3];return _0x49cb48;};'use strict';var _=require('lodash');var util=require(_0xf816('0x0'));var logger=require(_0xf816('0x1'))(_0xf816('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf816('0x3'));var fs=require('fs');var path=require(_0xf816('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf816('0x5'));module[_0xf816('0x6')]=function(_0x668143,_0x1a07b1){return _0x668143[_0xf816('0x7')](_0xf816('0x8'),attributes,{'tableName':_0xf816('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf816('0xa'),'collate':_0xf816('0xb'),'hooks':{'beforeUpdate':function(_0xf718a6,_0x54059a,_0x3bf32e){if(_0xf718a6[_0xf816('0xc')](_0xf816('0xd'))){_0xf718a6[_0xf816('0xe')]=moment()[_0xf816('0xf')](_0xf816('0x10'));}_0x3bf32e(null,_0xf718a6);}}});}; \ No newline at end of file +var _0x0b56=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','path'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0x0b56,0x1bb));var _0x60b5=function(_0x3f242b,_0x3c6ebc){_0x3f242b=_0x3f242b-0x0;var _0x2aa496=_0x0b56[_0x3f242b];return _0x2aa496;};'use strict';var _=require(_0x60b5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x60b5('0x1'));var moment=require(_0x60b5('0x2'));var BPromise=require(_0x60b5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60b5('0x4'));var rimraf=require(_0x60b5('0x5'));var config=require(_0x60b5('0x6'));var attributes=require(_0x60b5('0x7'));module[_0x60b5('0x8')]=function(_0x56fbc0,_0x38b38d){return _0x56fbc0[_0x60b5('0x9')](_0x60b5('0xa'),attributes,{'tableName':_0x60b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x60b5('0xc'),'hooks':{'beforeUpdate':function(_0x30f339,_0x2a0c0c,_0x12bbb4){if(_0x30f339[_0x60b5('0xd')]('closed')){_0x30f339[_0x60b5('0xe')]=moment()['format'](_0x60b5('0xf'));}_0x12bbb4(null,_0x30f339);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 871403c..2358155 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 _0x543f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelInteraction','update','body','options','attributes','limit','UpdateOpenchannelInteraction','find','ids','AddTags','lodash'];(function(_0x3e55ff,_0x579048){var _0x30ca1a=function(_0xa2642c){while(--_0xa2642c){_0x3e55ff['push'](_0x3e55ff['shift']());}};_0x30ca1a(++_0x579048);}(_0x543f,0xf5));var _0xf543=function(_0x17a584,_0x327252){_0x17a584=_0x17a584-0x0;var _0x42a0c1=_0x543f[_0x17a584];return _0x42a0c1;};'use strict';var _=require(_0xf543('0x0'));var util=require('util');var moment=require(_0xf543('0x1'));var BPromise=require(_0xf543('0x2'));var rs=require(_0xf543('0x3'));var fs=require('fs');var Redis=require(_0xf543('0x4'));var db=require(_0xf543('0x5'))['db'];var utils=require(_0xf543('0x6'));var logger=require(_0xf543('0x7'))(_0xf543('0x8'));var config=require(_0xf543('0x9'));var jayson=require(_0xf543('0xa'));var client=jayson[_0xf543('0xb')][_0xf543('0xc')]({'port':0x232a});config[_0xf543('0xd')]=_[_0xf543('0xe')](config[_0xf543('0xd')],{'host':_0xf543('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf543('0x10'))[_0xf543('0x11')](socket);function respondWithRpcPromise(_0x46b135,_0x20530f,_0x321ed6){return new BPromise(function(_0xd844b2,_0x4e1585){return client[_0xf543('0x12')](_0x46b135,_0x321ed6)[_0xf543('0x13')](function(_0x120a8c){logger[_0xf543('0x14')](_0xf543('0x15'),_0x20530f,_0xf543('0x16'));logger[_0xf543('0x17')](_0xf543('0x18'),_0x20530f,'request\x20sent',JSON[_0xf543('0x19')](_0x120a8c));if(_0x120a8c[_0xf543('0x1a')]){if(_0x120a8c['error'][_0xf543('0x1b')]===0x1f4){logger[_0xf543('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x20530f,_0x120a8c[_0xf543('0x1a')][_0xf543('0x1c')]);return _0x4e1585(_0x120a8c[_0xf543('0x1a')][_0xf543('0x1c')]);}logger[_0xf543('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x20530f,_0x120a8c['error'][_0xf543('0x1c')]);return _0xd844b2(_0x120a8c[_0xf543('0x1a')][_0xf543('0x1c')]);}else{logger['info'](_0xf543('0x15'),_0x20530f,'request\x20sent');_0xd844b2(_0x120a8c[_0xf543('0x1d')][_0xf543('0x1c')]);}})[_0xf543('0x1e')](function(_0x50e072){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x20530f,_0x50e072);_0x4e1585(_0x50e072);});});}exports['UpdateOpenchannelInteraction']=function(_0x24c5b8){var _0x2bbccb=this;return new Promise(function(_0x5e77b8,_0x570f4e){return db[_0xf543('0x1f')][_0xf543('0x20')](_0x24c5b8[_0xf543('0x21')],{'raw':_0x24c5b8['options']?_0x24c5b8[_0xf543('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24c5b8[_0xf543('0x22')]?_0x24c5b8[_0xf543('0x22')]['where']||null:null,'attributes':_0x24c5b8[_0xf543('0x22')]?_0x24c5b8[_0xf543('0x22')][_0xf543('0x23')]||null:null,'limit':_0x24c5b8[_0xf543('0x22')]?_0x24c5b8[_0xf543('0x22')][_0xf543('0x24')]||null:null})[_0xf543('0x13')](function(_0x441d2b){logger[_0xf543('0x14')](_0xf543('0x25'),_0x24c5b8);logger[_0xf543('0x17')](_0xf543('0x25'),_0x24c5b8,JSON['stringify'](_0x441d2b));_0x5e77b8(_0x441d2b);})[_0xf543('0x1e')](function(_0x5c99e2){logger[_0xf543('0x1a')](_0xf543('0x25'),_0x5c99e2['message'],_0x24c5b8);_0x570f4e(_0x2bbccb[_0xf543('0x1a')](0x1f4,_0x5c99e2[_0xf543('0x1c')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1080e0){return new Promise(function(_0x167ded,_0x5846c6){return db[_0xf543('0x1f')][_0xf543('0x26')]({'where':_0x1080e0[_0xf543('0x22')]?_0x1080e0[_0xf543('0x22')]['where']||null:null})[_0xf543('0x13')](function(_0x5cafd0){if(_0x5cafd0){return _0x5cafd0['addTags'](_0x1080e0[_0xf543('0x21')][_0xf543('0x27')],_['omit'](_0x1080e0['body'],[_0xf543('0x27'),'id'])||{});}})['spread'](function(_0x404171){logger['info'](_0xf543('0x28'),_0x1080e0);logger['debug'](_0xf543('0x28'),_0x1080e0,JSON[_0xf543('0x19')](_0x404171));_0x167ded(_0x404171);})['catch'](function(_0x1caa7c){logger[_0xf543('0x1a')](_0xf543('0x28'),_0x1caa7c[_0xf543('0x1c')],_0x1080e0);_0x5846c6(_this['error'](0x1f4,_0x1caa7c[_0xf543('0x1c')]));});});}; \ No newline at end of file +var _0x0a4c=['OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','where','AddTagsToOpenchannelInteraction','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x0a4c,0x83));var _0xc0a4=function(_0xb0337,_0x3f942f){_0xb0337=_0xb0337-0x0;var _0x444c68=_0x0a4c[_0xb0337];return _0x444c68;};'use strict';var _=require(_0xc0a4('0x0'));var util=require(_0xc0a4('0x1'));var moment=require(_0xc0a4('0x2'));var BPromise=require(_0xc0a4('0x3'));var rs=require(_0xc0a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0a4('0x5'))['db'];var utils=require(_0xc0a4('0x6'));var logger=require(_0xc0a4('0x7'))('rpc');var config=require(_0xc0a4('0x8'));var jayson=require(_0xc0a4('0x9'));var client=jayson[_0xc0a4('0xa')]['http']({'port':0x232a});config['redis']=_[_0xc0a4('0xb')](config[_0xc0a4('0xc')],{'host':_0xc0a4('0xd'),'port':0x18eb});var socket=require(_0xc0a4('0xe'))(new Redis(config[_0xc0a4('0xc')]));require(_0xc0a4('0xf'))['register'](socket);function respondWithRpcPromise(_0x22b734,_0x537f33,_0x2d5bfb){return new BPromise(function(_0x55f516,_0x1f640d){return client[_0xc0a4('0x10')](_0x22b734,_0x2d5bfb)[_0xc0a4('0x11')](function(_0x443be4){logger[_0xc0a4('0x12')](_0xc0a4('0x13'),_0x537f33,'request\x20sent');logger[_0xc0a4('0x14')](_0xc0a4('0x15'),_0x537f33,_0xc0a4('0x16'),JSON[_0xc0a4('0x17')](_0x443be4));if(_0x443be4[_0xc0a4('0x18')]){if(_0x443be4['error']['code']===0x1f4){logger['error'](_0xc0a4('0x13'),_0x537f33,_0x443be4[_0xc0a4('0x18')][_0xc0a4('0x19')]);return _0x1f640d(_0x443be4[_0xc0a4('0x18')][_0xc0a4('0x19')]);}logger[_0xc0a4('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x537f33,_0x443be4[_0xc0a4('0x18')][_0xc0a4('0x19')]);return _0x55f516(_0x443be4['error'][_0xc0a4('0x19')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x537f33,_0xc0a4('0x16'));_0x55f516(_0x443be4[_0xc0a4('0x1a')][_0xc0a4('0x19')]);}})[_0xc0a4('0x1b')](function(_0x4cb9f1){logger[_0xc0a4('0x18')](_0xc0a4('0x13'),_0x537f33,_0x4cb9f1);_0x1f640d(_0x4cb9f1);});});}exports[_0xc0a4('0x1c')]=function(_0x3b65ad){var _0x1e33ab=this;return new Promise(function(_0x2b45de,_0x299fe9){return db[_0xc0a4('0x1d')]['update'](_0x3b65ad[_0xc0a4('0x1e')],{'raw':_0x3b65ad[_0xc0a4('0x1f')]?_0x3b65ad['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b65ad[_0xc0a4('0x1f')]?_0x3b65ad[_0xc0a4('0x1f')][_0xc0a4('0x20')]||null:null,'attributes':_0x3b65ad[_0xc0a4('0x1f')]?_0x3b65ad['options']['attributes']||null:null,'limit':_0x3b65ad[_0xc0a4('0x1f')]?_0x3b65ad[_0xc0a4('0x1f')]['limit']||null:null})[_0xc0a4('0x11')](function(_0x5bfe27){logger['info'](_0xc0a4('0x1c'),_0x3b65ad);logger[_0xc0a4('0x14')]('UpdateOpenchannelInteraction',_0x3b65ad,JSON[_0xc0a4('0x17')](_0x5bfe27));_0x2b45de(_0x5bfe27);})[_0xc0a4('0x1b')](function(_0x465e13){logger[_0xc0a4('0x18')](_0xc0a4('0x1c'),_0x465e13[_0xc0a4('0x19')],_0x3b65ad);_0x299fe9(_0x1e33ab[_0xc0a4('0x18')](0x1f4,_0x465e13[_0xc0a4('0x19')]));});});};exports[_0xc0a4('0x21')]=function(_0x5d7c3d){return new Promise(function(_0x5b4686,_0x1591f5){return db['OpenchannelInteraction']['find']({'where':_0x5d7c3d[_0xc0a4('0x1f')]?_0x5d7c3d[_0xc0a4('0x1f')][_0xc0a4('0x20')]||null:null})[_0xc0a4('0x11')](function(_0x2ab39b){if(_0x2ab39b){return _0x2ab39b[_0xc0a4('0x22')](_0x5d7c3d[_0xc0a4('0x1e')][_0xc0a4('0x23')],_[_0xc0a4('0x24')](_0x5d7c3d[_0xc0a4('0x1e')],[_0xc0a4('0x23'),'id'])||{});}})['spread'](function(_0x4a932f){logger[_0xc0a4('0x12')](_0xc0a4('0x25'),_0x5d7c3d);logger[_0xc0a4('0x14')](_0xc0a4('0x25'),_0x5d7c3d,JSON['stringify'](_0x4a932f));_0x5b4686(_0x4a932f);})[_0xc0a4('0x1b')](function(_0x376170){logger['error'](_0xc0a4('0x25'),_0x376170['message'],_0x5d7c3d);_0x1591f5(_this[_0xc0a4('0x18')](0x1f4,_0x376170[_0xc0a4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 53c0252..15a18eb 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 _0x937e=['removeListener','register','openchannelInteraction:','save','remove','update','emit'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x937e,0x192));var _0xe937=function(_0x3169b1,_0x4a7151){_0x3169b1=_0x3169b1-0x0;var _0x10f66e=_0x937e[_0x3169b1];return _0x10f66e;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xe937('0x0'),_0xe937('0x1'),_0xe937('0x2')];function createListener(_0x3ef94c,_0x458a42){return function(_0x5b415d){_0x458a42[_0xe937('0x3')](_0x3ef94c,_0x5b415d);};}function removeListener(_0x372c6c,_0x456958){return function(){OpenchannelInteractionEvents[_0xe937('0x4')](_0x372c6c,_0x456958);};}exports[_0xe937('0x5')]=function(_0x375c86){for(var _0x2aebcf=0x0,_0x167618=events['length'];_0x2aebcf<_0x167618;_0x2aebcf++){var _0x3a455d=events[_0x2aebcf];var _0x17953e=createListener(_0xe937('0x6')+_0x3a455d,_0x375c86);OpenchannelInteractionEvents['on'](_0x3a455d,_0x17953e);}}; \ No newline at end of file +var _0xb95a=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','update'];(function(_0x455b06,_0x341c4a){var _0x5e916d=function(_0xbb3a84){while(--_0xbb3a84){_0x455b06['push'](_0x455b06['shift']());}};_0x5e916d(++_0x341c4a);}(_0xb95a,0xad));var _0xab95=function(_0x9e6209,_0x2f4a4a){_0x9e6209=_0x9e6209-0x0;var _0x3ae92e=_0xb95a[_0x9e6209];return _0x3ae92e;};'use strict';var OpenchannelInteractionEvents=require(_0xab95('0x0'));var events=[_0xab95('0x1'),'remove',_0xab95('0x2')];function createListener(_0x3a4ba2,_0x3fd204){return function(_0x47d19a){_0x3fd204[_0xab95('0x3')](_0x3a4ba2,_0x47d19a);};}function removeListener(_0x4b5ff0,_0x47cec9){return function(){OpenchannelInteractionEvents[_0xab95('0x4')](_0x4b5ff0,_0x47cec9);};}exports[_0xab95('0x5')]=function(_0x4b60c4){for(var _0xe2ca4c=0x0,_0x168379=events[_0xab95('0x6')];_0xe2ca4c<_0x168379;_0xe2ca4c++){var _0x3230df=events[_0xe2ca4c];var _0x3753d1=createListener(_0xab95('0x7')+_0x3230df,_0x4b60c4);OpenchannelInteractionEvents['on'](_0x3230df,_0x3753d1);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index cee07e8..4e78d20 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x42a98c,_0x31b5c5){var _0x342bd3=function(_0x4f258d){while(--_0x4f258d){_0x42a98c['push'](_0x42a98c['shift']());}};_0x342bd3(++_0x31b5c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x55e4a9,_0xdb06c2){var _0x59f50e=function(_0x131de7){while(--_0x131de7){_0x55e4a9['push'](_0x55e4a9['shift']());}};_0x59f50e(++_0xdb06c2);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 1cb5093..41f1b48 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 _0xd7a0=['out','DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xd7a0,0x163));var _0x0d7a=function(_0x370fd2,_0x413f1d){_0x370fd2=_0x370fd2-0x0;var _0x2acc0d=_0xd7a0[_0x370fd2];return _0x2acc0d;};'use strict';var Sequelize=require(_0x0d7a('0x0'));module[_0x0d7a('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0d7a('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x0d7a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0d7a('0x4')]('in',_0x0d7a('0x5')),'defaultValue':_0x0d7a('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0d7a('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0d7a('0x7')]}}; \ No newline at end of file +var _0x6cb4=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x81f000,_0x15df85){var _0x337aa2=function(_0x37f6a4){while(--_0x37f6a4){_0x81f000['push'](_0x81f000['shift']());}};_0x337aa2(++_0x15df85);}(_0x6cb4,0xff));var _0x46cb=function(_0x2ca85e,_0x3018e3){_0x2ca85e=_0x2ca85e-0x0;var _0x1cb796=_0x6cb4[_0x2ca85e];return _0x1cb796;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'body':{'type':Sequelize[_0x46cb('0x2')](_0x46cb('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x46cb('0x5')]('in',_0x46cb('0x6')),'defaultValue':_0x46cb('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x46cb('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 39887bb..38e01e6 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 _0xf980=['fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','describe','accept','openchannel','read','format','UserId','user','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','OpenchannelInteractionId','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','info','request\x20sent','debug','stringify','error','message','OpenchannelMessage,\x20%s,\x20%s','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','sendStatus','name','index','map','OpenchannelMessage','rawAttributes'];(function(_0x162607,_0xa3e1a8){var _0x2f2d29=function(_0x11c8f5){while(--_0x11c8f5){_0x162607['push'](_0x162607['shift']());}};_0x2f2d29(++_0xa3e1a8);}(_0xf980,0xc3));var _0x0f98=function(_0x84ce4d,_0x24c6d7){_0x84ce4d=_0x84ce4d-0x0;var _0x327d33=_0xf980[_0x84ce4d];return _0x327d33;};'use strict';var emlformat=require(_0x0f98('0x0'));var rimraf=require(_0x0f98('0x1'));var zipdir=require(_0x0f98('0x2'));var jsonpatch=require(_0x0f98('0x3'));var rp=require(_0x0f98('0x4'));var moment=require('moment');var BPromise=require(_0x0f98('0x5'));var Mustache=require('mustache');var util=require(_0x0f98('0x6'));var path=require(_0x0f98('0x7'));var sox=require(_0x0f98('0x8'));var csv=require(_0x0f98('0x9'));var ejs=require(_0x0f98('0xa'));var fs=require('fs');var fs_extra=require(_0x0f98('0xb'));var _=require(_0x0f98('0xc'));var squel=require('squel');var crypto=require(_0x0f98('0xd'));var jsforce=require(_0x0f98('0xe'));var deskjs=require(_0x0f98('0xf'));var toCsv=require(_0x0f98('0x9'));var querystring=require(_0x0f98('0x10'));var Papa=require(_0x0f98('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0f98('0x12'));var as=require(_0x0f98('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f98('0x14'))(_0x0f98('0x15'));var utils=require(_0x0f98('0x16'));var config=require(_0x0f98('0x17'));var licenseUtil=require(_0x0f98('0x18'));var db=require(_0x0f98('0x19'))['db'];config[_0x0f98('0x1a')]=_['defaults'](config[_0x0f98('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0f98('0x1b'))(new Redis(config[_0x0f98('0x1a')]));require(_0x0f98('0x1c'))[_0x0f98('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0f98('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x0f98('0x1e')][_0x0f98('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1848cd,_0xacd969,_0x5221de,_0x1012c6){return new BPromise(function(_0x1b6103,_0x3b6d05){var _0x6b4e24=_0x1012c6||client;return _0x6b4e24[_0x0f98('0x20')](_0x1848cd,_0x5221de)[_0x0f98('0x21')](function(_0x2b497a){logger[_0x0f98('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0xacd969,_0x0f98('0x23'));logger[_0x0f98('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xacd969,_0x0f98('0x23'),JSON[_0x0f98('0x25')](_0x2b497a));if(_0x2b497a[_0x0f98('0x26')]){if(_0x2b497a[_0x0f98('0x26')]['code']===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xacd969,_0x2b497a[_0x0f98('0x26')][_0x0f98('0x27')]);return _0x3b6d05(_0x2b497a['error']['message']);}logger[_0x0f98('0x26')](_0x0f98('0x28'),_0xacd969,_0x2b497a[_0x0f98('0x26')]['message']);return _0x1b6103(_0x2b497a[_0x0f98('0x26')][_0x0f98('0x27')]);}else{logger[_0x0f98('0x22')](_0x0f98('0x28'),_0xacd969,'request\x20sent');_0x1b6103(_0x2b497a['result']['message']);}})[_0x0f98('0x29')](function(_0x478940){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xacd969,_0x478940);_0x3b6d05(_0x478940);});});}function respondWithStatusCode(_0x27eb86,_0x4c3056){_0x4c3056=_0x4c3056||0xcc;return function(_0x3a6ddf){if(_0x3a6ddf){return _0x27eb86['sendStatus'](_0x4c3056);}return _0x27eb86[_0x0f98('0x2a')](_0x4c3056)[_0x0f98('0x2b')]();};}function respondWithResult(_0x367390,_0x1f828d){_0x1f828d=_0x1f828d||0xc8;return function(_0x1f47d5){if(_0x1f47d5){return _0x367390['status'](_0x1f828d)[_0x0f98('0x2c')](_0x1f47d5);}};}function respondWithFilteredResult(_0x365f1b,_0x2163b4){return function(_0x21819e){if(_0x21819e){var _0x5e6230=typeof _0x2163b4[_0x0f98('0x2d')]===_0x0f98('0x2e')&&typeof _0x2163b4[_0x0f98('0x2f')]===_0x0f98('0x2e');var _0x2f23dc=_0x21819e[_0x0f98('0x30')];var _0x27c567=_0x5e6230?0x0:_0x2163b4[_0x0f98('0x2d')];var _0x2059a9=_0x5e6230?_0x21819e[_0x0f98('0x30')]:_0x2163b4[_0x0f98('0x2d')]+_0x2163b4['limit'];var _0x2cc891;if(_0x2059a9>=_0x2f23dc){_0x2059a9=_0x2f23dc;_0x2cc891=0xc8;}else{_0x2cc891=0xce;}_0x365f1b[_0x0f98('0x2a')](_0x2cc891);return _0x365f1b[_0x0f98('0x31')]('Content-Range',_0x27c567+'-'+_0x2059a9+'/'+_0x2f23dc)[_0x0f98('0x2c')](_0x21819e);}return null;};}function patchUpdates(_0x2da517){return function(_0x504383){try{jsonpatch[_0x0f98('0x32')](_0x504383,_0x2da517,!![]);}catch(_0x3673cc){return BPromise[_0x0f98('0x33')](_0x3673cc);}return _0x504383[_0x0f98('0x34')]();};}function saveUpdates(_0x5dab0a,_0x29aea3){return function(_0xc4c4b1){if(_0xc4c4b1){return _0xc4c4b1[_0x0f98('0x35')](_0x5dab0a)['then'](function(_0x1ca51a){return _0x1ca51a;});}return null;};}function removeEntity(_0x56f3d8,_0x2da4f8){return function(_0x38fd3b){if(_0x38fd3b){return _0x38fd3b[_0x0f98('0x36')]()[_0x0f98('0x21')](function(){_0x56f3d8[_0x0f98('0x2a')](0xcc)[_0x0f98('0x2b')]();});}};}function handleEntityNotFound(_0x322146,_0x2ee568){return function(_0x2efbbe){if(!_0x2efbbe){_0x322146[_0x0f98('0x37')](0x194);}return _0x2efbbe;};}function handleError(_0x357d2c,_0x45faf8){_0x45faf8=_0x45faf8||0x1f4;return function(_0x3495c0){logger[_0x0f98('0x26')](_0x3495c0['stack']);if(_0x3495c0[_0x0f98('0x38')]){delete _0x3495c0[_0x0f98('0x38')];}_0x357d2c[_0x0f98('0x2a')](_0x45faf8)['send'](_0x3495c0);};}exports[_0x0f98('0x39')]=function(_0x27217c,_0x4aff1a){var _0x49156e={},_0x2036cd={},_0x445a48={'count':0x0,'rows':[]};var _0x31e271=_[_0x0f98('0x3a')](db[_0x0f98('0x3b')][_0x0f98('0x3c')],function(_0x5d74a8){return{'name':_0x5d74a8[_0x0f98('0x3d')],'type':_0x5d74a8['type'][_0x0f98('0x3e')]};});_0x2036cd[_0x0f98('0x3f')]=_[_0x0f98('0x3a')](_0x31e271,_0x0f98('0x38'));_0x2036cd[_0x0f98('0x40')]=_[_0x0f98('0x41')](_0x27217c[_0x0f98('0x40')]);_0x2036cd['filters']=_[_0x0f98('0x42')](_0x2036cd[_0x0f98('0x3f')],_0x2036cd[_0x0f98('0x40')]);_0x49156e['attributes']=_[_0x0f98('0x42')](_0x2036cd[_0x0f98('0x3f')],qs[_0x0f98('0x43')](_0x27217c[_0x0f98('0x40')][_0x0f98('0x43')]));_0x49156e[_0x0f98('0x44')]=_0x49156e[_0x0f98('0x44')][_0x0f98('0x45')]?_0x49156e['attributes']:_0x2036cd[_0x0f98('0x3f')];if(!_0x27217c[_0x0f98('0x40')][_0x0f98('0x46')](_0x0f98('0x47'))){_0x49156e[_0x0f98('0x2f')]=qs[_0x0f98('0x2f')](_0x27217c['query'][_0x0f98('0x2f')]);_0x49156e['offset']=qs['offset'](_0x27217c['query'][_0x0f98('0x2d')]);}_0x49156e[_0x0f98('0x48')]=qs[_0x0f98('0x49')](_0x27217c[_0x0f98('0x40')][_0x0f98('0x49')]);_0x49156e[_0x0f98('0x4a')]=qs[_0x0f98('0x4b')](_[_0x0f98('0x4c')](_0x27217c[_0x0f98('0x40')],_0x2036cd['filters']),_0x31e271);if(_0x27217c[_0x0f98('0x40')][_0x0f98('0x4d')]){_0x49156e[_0x0f98('0x4a')]=_[_0x0f98('0x4e')](_0x49156e[_0x0f98('0x4a')],{'$or':_['map'](_0x31e271,function(_0x533951){if(_0x533951[_0x0f98('0x4f')]!==_0x0f98('0x50')){var _0x4607df={};_0x4607df[_0x533951[_0x0f98('0x38')]]={'$like':'%'+_0x27217c['query'][_0x0f98('0x4d')]+'%'};return _0x4607df;}})});}_0x49156e=_[_0x0f98('0x4e')]({},_0x49156e,_0x27217c[_0x0f98('0x51')]);var _0x5000e3={'where':_0x49156e[_0x0f98('0x4a')]};return db[_0x0f98('0x3b')]['count'](_0x5000e3)[_0x0f98('0x21')](function(_0x335566){_0x445a48[_0x0f98('0x30')]=_0x335566;if(_0x27217c[_0x0f98('0x40')][_0x0f98('0x52')]){_0x49156e[_0x0f98('0x53')]=[{'all':!![]}];}return db[_0x0f98('0x3b')]['findAll'](_0x49156e);})[_0x0f98('0x21')](function(_0x122737){_0x445a48[_0x0f98('0x54')]=_0x122737;return _0x445a48;})['then'](respondWithFilteredResult(_0x4aff1a,_0x49156e))['catch'](handleError(_0x4aff1a,null));};exports[_0x0f98('0x55')]=function(_0x5e9223,_0xf846f4){var _0x2db7a6={'raw':!![],'where':{'id':_0x5e9223[_0x0f98('0x56')]['id']}},_0x40b34c={};_0x40b34c[_0x0f98('0x3f')]=_[_0x0f98('0x41')](db[_0x0f98('0x3b')][_0x0f98('0x3c')]);_0x40b34c[_0x0f98('0x40')]=_[_0x0f98('0x41')](_0x5e9223[_0x0f98('0x40')]);_0x40b34c[_0x0f98('0x4b')]=_[_0x0f98('0x42')](_0x40b34c['model'],_0x40b34c['query']);_0x2db7a6[_0x0f98('0x44')]=_['intersection'](_0x40b34c[_0x0f98('0x3f')],qs[_0x0f98('0x43')](_0x5e9223[_0x0f98('0x40')]['fields']));_0x2db7a6[_0x0f98('0x44')]=_0x2db7a6['attributes'][_0x0f98('0x45')]?_0x2db7a6['attributes']:_0x40b34c[_0x0f98('0x3f')];if(_0x5e9223[_0x0f98('0x40')][_0x0f98('0x52')]){_0x2db7a6['include']=[{'all':!![]}];}_0x2db7a6=_[_0x0f98('0x4e')]({},_0x2db7a6,_0x5e9223[_0x0f98('0x51')]);return db[_0x0f98('0x3b')][_0x0f98('0x57')](_0x2db7a6)[_0x0f98('0x21')](handleEntityNotFound(_0xf846f4,null))[_0x0f98('0x21')](respondWithResult(_0xf846f4,null))[_0x0f98('0x29')](handleError(_0xf846f4,null));};exports['create']=function(_0x5ecfaa,_0x3c8bfe){return db[_0x0f98('0x3b')][_0x0f98('0x58')](_0x5ecfaa[_0x0f98('0x59')],{})[_0x0f98('0x21')](respondWithResult(_0x3c8bfe,0xc9))[_0x0f98('0x29')](handleError(_0x3c8bfe,null));};exports[_0x0f98('0x35')]=function(_0x12a2ac,_0x52366c){if(_0x12a2ac[_0x0f98('0x59')]['id']){delete _0x12a2ac[_0x0f98('0x59')]['id'];}return db['OpenchannelMessage'][_0x0f98('0x57')]({'where':{'id':_0x12a2ac['params']['id']}})[_0x0f98('0x21')](handleEntityNotFound(_0x52366c,null))['then'](saveUpdates(_0x12a2ac[_0x0f98('0x59')],null))[_0x0f98('0x21')](respondWithResult(_0x52366c,null))[_0x0f98('0x29')](handleError(_0x52366c,null));};exports[_0x0f98('0x36')]=function(_0x82dfc,_0x47c55c){return db[_0x0f98('0x3b')][_0x0f98('0x57')]({'where':{'id':_0x82dfc[_0x0f98('0x56')]['id']}})[_0x0f98('0x21')](handleEntityNotFound(_0x47c55c,null))[_0x0f98('0x21')](removeEntity(_0x47c55c,null))[_0x0f98('0x29')](handleError(_0x47c55c,null));};exports[_0x0f98('0x5a')]=function(_0x54e0d9,_0xb5d435){return db[_0x0f98('0x3b')][_0x0f98('0x5a')]()[_0x0f98('0x21')](respondWithResult(_0xb5d435,null))[_0x0f98('0x29')](handleError(_0xb5d435,null));};var interaction_log=require(_0x0f98('0x14'))('openchannel-interactions');exports[_0x0f98('0x5b')]=function(_0x44fb9e,_0x3cf547,_0x3b420d){var _0x5774f0={'agent':{},'channel':_0x0f98('0x5c')};if(_0x44fb9e[_0x0f98('0x59')]['id']){delete _0x44fb9e[_0x0f98('0x59')]['id'];}_0x44fb9e['body'][_0x0f98('0x5d')]=!![];_0x44fb9e['body']['readAt']=moment()[_0x0f98('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x44fb9e[_0x0f98('0x59')][_0x0f98('0x5f')]=_0x44fb9e[_0x0f98('0x59')][_0x0f98('0x5f')]||_0x44fb9e[_0x0f98('0x60')]['id'];_0x5774f0['agent']['id']=_0x44fb9e[_0x0f98('0x59')]['UserId'];return db[_0x0f98('0x3b')][_0x0f98('0x57')]({'where':{'id':_0x44fb9e['params']['id'],'UserId':null}})[_0x0f98('0x21')](handleEntityNotFound(_0x3cf547,null))[_0x0f98('0x21')](saveUpdates(_0x44fb9e[_0x0f98('0x59')],null))[_0x0f98('0x21')](function(_0x5a0c83){if(_0x5a0c83){_0x5774f0[_0x0f98('0x27')]=_0x5a0c83[_0x0f98('0x61')]({'plain':!![]});return db[_0x0f98('0x62')]['find']({'where':{'id':_0x5a0c83['OpenchannelInteractionId']}});}return null;})[_0x0f98('0x21')](handleEntityNotFound(_0x3cf547,null))['then'](function(_0xc5a780){if(_0xc5a780){return _0xc5a780['update']({'UserId':_0x44fb9e['body'][_0x0f98('0x5f')],'read1stAt':_[_0x0f98('0x63')](_0xc5a780[_0x0f98('0x64')])?moment()['format'](_0x0f98('0x65')):undefined});}return null;})[_0x0f98('0x21')](function(_0x4e22a7){if(_0x4e22a7){_0x5774f0[_0x0f98('0x66')]=_0x4e22a7['get']({'plain':!![]});interaction_log[_0x0f98('0x22')](_0x0f98('0x67'),_0x44fb9e[_0x0f98('0x60')]['id'],_0x44fb9e[_0x0f98('0x60')]['name'],_0x44fb9e[_0x0f98('0x60')][_0x0f98('0x68')],_0x5774f0[_0x0f98('0x66')]['id'],_0x44fb9e['body']?JSON[_0x0f98('0x25')](_0x44fb9e['body']):_0x0f98('0x69'));return respondWithRpcPromise('AcceptMessage',_0x0f98('0x6a'),_0x5774f0);}return null;})[_0x0f98('0x21')](function(_0x16a23f){var _0x59679c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x16a23f[_0x0f98('0x27')][_0x0f98('0x6b')];return db[_0x0f98('0x6c')]['query'](_0x59679c,{'type':db[_0x0f98('0x6d')]['QueryTypes'][_0x0f98('0x6e')],'raw':!![]})[_0x0f98('0x21')](function(_0x5e2ded){return _0x5e2ded;});})[_0x0f98('0x21')](function(_0x2407b8){if(_0x2407b8){_0x5774f0[_0x0f98('0x27')][_0x0f98('0x6f')]=_0x2407b8[0x0];if(!_0x44fb9e[_0x0f98('0x59')][_0x0f98('0x5f')])return;return db[_0x0f98('0x70')]['find']({'where':{'id':_0x44fb9e[_0x0f98('0x59')][_0x0f98('0x5f')],'role':_0x0f98('0x71')},'attributes':['id','name',_0x0f98('0x72'),_0x0f98('0x73'),_0x0f98('0x74')],'raw':!![]});}return null;})[_0x0f98('0x21')](function(_0x4bc034){if(!_0x4bc034)return null;_0x5774f0['message'][_0x0f98('0x71')]=_0x4bc034;return _0x5774f0;})['then'](function(_0x1ff3d6){if(_0x1ff3d6){if(_0x44fb9e[_0x0f98('0x59')][_0x0f98('0x75')]){_0x5774f0[_0x0f98('0x27')][_0x0f98('0x76')]=util[_0x0f98('0x5e')](_0x0f98('0x77'),_0x44fb9e['user'][_0x0f98('0x38')]);_0x5774f0[_0x0f98('0x27')]['channel']=_0x5774f0[_0x0f98('0x78')];_0x5774f0[_0x0f98('0x27')][_0x0f98('0x79')]=_0x5774f0['channel'];_0x5774f0[_0x0f98('0x27')]['event']=_0x0f98('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5774f0[_0x0f98('0x27')]},client9002)['then'](function(){return _0x5774f0;});}return _0x5774f0;}return null;})['then'](respondWithResult(_0x3cf547,null))['catch'](handleError(_0x3cf547,null));};var interaction_log=require(_0x0f98('0x14'))('openchannel-interactions');exports[_0x0f98('0x33')]=function(_0x21a5b9,_0x457170,_0x5e3eb6){var _0x45b405={'agent':{},'channel':_0x0f98('0x5c')};if(_0x21a5b9[_0x0f98('0x59')]['id']){delete _0x21a5b9[_0x0f98('0x59')]['id'];}_0x21a5b9['body']['UserId']=_0x21a5b9[_0x0f98('0x59')][_0x0f98('0x5f')]||_0x21a5b9[_0x0f98('0x60')]['id'];_0x45b405[_0x0f98('0x71')]['id']=_0x21a5b9['body'][_0x0f98('0x5f')];return db[_0x0f98('0x3b')]['find']({'where':{'id':_0x21a5b9[_0x0f98('0x56')]['id'],'UserId':null}})[_0x0f98('0x21')](handleEntityNotFound(_0x457170,null))[_0x0f98('0x21')](function(_0x84ade2){if(_0x84ade2){_0x45b405[_0x0f98('0x27')]=_0x84ade2[_0x0f98('0x61')]({'plain':!![]});return db[_0x0f98('0x62')]['find']({'where':{'id':_0x84ade2[_0x0f98('0x7a')]}});}return null;})[_0x0f98('0x21')](handleEntityNotFound(_0x457170,null))[_0x0f98('0x21')](function(_0x46fcc9){if(_0x46fcc9){_0x45b405[_0x0f98('0x66')]=_0x46fcc9['get']({'plain':!![]});interaction_log[_0x0f98('0x22')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x21a5b9[_0x0f98('0x60')]['id'],_0x21a5b9[_0x0f98('0x60')]['name'],_0x21a5b9[_0x0f98('0x60')][_0x0f98('0x68')],_0x45b405[_0x0f98('0x66')]['id'],_0x21a5b9[_0x0f98('0x59')]?JSON[_0x0f98('0x25')](_0x21a5b9['body']):_0x0f98('0x69'));return respondWithRpcPromise('RejectMessage',_0x0f98('0x7b'),_0x45b405);}return null;})[_0x0f98('0x21')](function(_0x1f4800){var _0x43fd2a=_0x0f98('0x7c')+_0x1f4800['message'][_0x0f98('0x6b')];return db[_0x0f98('0x6c')][_0x0f98('0x40')](_0x43fd2a,{'type':db[_0x0f98('0x6d')][_0x0f98('0x7d')]['SELECT'],'raw':!![]})[_0x0f98('0x21')](function(_0xf843e4){return _0xf843e4;});})[_0x0f98('0x21')](function(_0x4d219f){if(_0x4d219f){_0x45b405[_0x0f98('0x27')][_0x0f98('0x6f')]=_0x4d219f[0x0];if(!_0x21a5b9['body'][_0x0f98('0x5f')])return;return db['User'][_0x0f98('0x57')]({'where':{'id':_0x21a5b9[_0x0f98('0x59')]['UserId'],'role':_0x0f98('0x71')},'attributes':['id',_0x0f98('0x38'),'fullname',_0x0f98('0x73'),_0x0f98('0x74')],'raw':!![]});}return null;})[_0x0f98('0x21')](function(_0x534a99){if(!_0x534a99)return null;_0x45b405[_0x0f98('0x27')][_0x0f98('0x71')]=_0x534a99;return _0x45b405;})[_0x0f98('0x21')](function(_0x53e261){if(_0x53e261){_0x53e261['message'][_0x0f98('0x76')]=util['format'](_0x0f98('0x77'),_0x21a5b9[_0x0f98('0x60')][_0x0f98('0x38')]);_0x53e261[_0x0f98('0x27')][_0x0f98('0x78')]=_0x45b405['channel'];_0x53e261[_0x0f98('0x27')][_0x0f98('0x79')]=_0x45b405[_0x0f98('0x78')];_0x53e261['message'][_0x0f98('0x7e')]=_0x0f98('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':_0x0f98('0x7f'),'message':_0x53e261[_0x0f98('0x27')]},client9002);return _0x45b405;}return null;})[_0x0f98('0x21')](respondWithResult(_0x457170,null))[_0x0f98('0x29')](handleError(_0x457170,null));}; \ No newline at end of file +var _0x2378=['jayson/promise','client','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','OpenchannelMessage','findAll','rows','params','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','OpenchannelInteractionId','RejectMessage','rejectMessage','ContactId','SIP/%s','event','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x54dcad,_0x554f46){var _0x537c56=function(_0x48ff85){while(--_0x48ff85){_0x54dcad['push'](_0x54dcad['shift']());}};_0x537c56(++_0x554f46);}(_0x2378,0x64));var _0x8237=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x2378[_0x264b9b];return _0x4c7a0e;};'use strict';var emlformat=require(_0x8237('0x0'));var rimraf=require(_0x8237('0x1'));var zipdir=require(_0x8237('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8237('0x3'));var moment=require(_0x8237('0x4'));var BPromise=require(_0x8237('0x5'));var Mustache=require(_0x8237('0x6'));var util=require(_0x8237('0x7'));var path=require(_0x8237('0x8'));var sox=require(_0x8237('0x9'));var csv=require(_0x8237('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8237('0xb'));var squel=require(_0x8237('0xc'));var crypto=require(_0x8237('0xd'));var jsforce=require(_0x8237('0xe'));var deskjs=require(_0x8237('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8237('0x10'));var Papa=require(_0x8237('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8237('0x12'));var as=require(_0x8237('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8237('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8237('0x15'));var db=require(_0x8237('0x16'))['db'];config[_0x8237('0x17')]=_[_0x8237('0x18')](config[_0x8237('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x8237('0x19'))(new Redis(config[_0x8237('0x17')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x8237('0x1a'));var client=jayson[_0x8237('0x1b')][_0x8237('0x1c')]({'port':0x232c});var client9002=jayson[_0x8237('0x1b')][_0x8237('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xb5b9fd,_0x387d62,_0x25cbcb,_0xf35eea){return new BPromise(function(_0x4f1b8c,_0x62a753){var _0xd68afe=_0xf35eea||client;return _0xd68afe['request'](_0xb5b9fd,_0x25cbcb)[_0x8237('0x1d')](function(_0x292534){logger['info'](_0x8237('0x1e'),_0x387d62,_0x8237('0x1f'));logger[_0x8237('0x20')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x387d62,'request\x20sent',JSON['stringify'](_0x292534));if(_0x292534[_0x8237('0x21')]){if(_0x292534[_0x8237('0x21')][_0x8237('0x22')]===0x1f4){logger[_0x8237('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x387d62,_0x292534[_0x8237('0x21')][_0x8237('0x23')]);return _0x62a753(_0x292534[_0x8237('0x21')][_0x8237('0x23')]);}logger[_0x8237('0x21')](_0x8237('0x1e'),_0x387d62,_0x292534[_0x8237('0x21')][_0x8237('0x23')]);return _0x4f1b8c(_0x292534[_0x8237('0x21')][_0x8237('0x23')]);}else{logger[_0x8237('0x24')](_0x8237('0x1e'),_0x387d62,_0x8237('0x1f'));_0x4f1b8c(_0x292534['result'][_0x8237('0x23')]);}})[_0x8237('0x25')](function(_0x5a3f25){logger[_0x8237('0x21')](_0x8237('0x1e'),_0x387d62,_0x5a3f25);_0x62a753(_0x5a3f25);});});}function respondWithStatusCode(_0x138d18,_0x23a065){_0x23a065=_0x23a065||0xcc;return function(_0x5ebb56){if(_0x5ebb56){return _0x138d18[_0x8237('0x26')](_0x23a065);}return _0x138d18[_0x8237('0x27')](_0x23a065)[_0x8237('0x28')]();};}function respondWithResult(_0x46a349,_0x1c85cc){_0x1c85cc=_0x1c85cc||0xc8;return function(_0x30a522){if(_0x30a522){return _0x46a349[_0x8237('0x27')](_0x1c85cc)[_0x8237('0x29')](_0x30a522);}};}function respondWithFilteredResult(_0x3a061b,_0x264b9b){return function(_0x422153){if(_0x422153){var _0xd31884=typeof _0x264b9b[_0x8237('0x2a')]===_0x8237('0x2b')&&typeof _0x264b9b['limit']===_0x8237('0x2b');var _0x566c83=_0x422153[_0x8237('0x2c')];var _0x290e9c=_0xd31884?0x0:_0x264b9b[_0x8237('0x2a')];var _0x47ae77=_0xd31884?_0x422153[_0x8237('0x2c')]:_0x264b9b['offset']+_0x264b9b[_0x8237('0x2d')];var _0x97be51;if(_0x47ae77>=_0x566c83){_0x47ae77=_0x566c83;_0x97be51=0xc8;}else{_0x97be51=0xce;}_0x3a061b['status'](_0x97be51);return _0x3a061b[_0x8237('0x2e')](_0x8237('0x2f'),_0x290e9c+'-'+_0x47ae77+'/'+_0x566c83)[_0x8237('0x29')](_0x422153);}return null;};}function patchUpdates(_0x3ccb23){return function(_0x48f52d){try{jsonpatch[_0x8237('0x30')](_0x48f52d,_0x3ccb23,!![]);}catch(_0x4a6038){return BPromise[_0x8237('0x31')](_0x4a6038);}return _0x48f52d[_0x8237('0x32')]();};}function saveUpdates(_0x459916,_0x8922e7){return function(_0x2d8b4f){if(_0x2d8b4f){return _0x2d8b4f[_0x8237('0x33')](_0x459916)[_0x8237('0x1d')](function(_0x4d1e76){return _0x4d1e76;});}return null;};}function removeEntity(_0x526c95,_0x4ca65b){return function(_0x53403e){if(_0x53403e){return _0x53403e[_0x8237('0x34')]()[_0x8237('0x1d')](function(){_0x526c95[_0x8237('0x27')](0xcc)[_0x8237('0x28')]();});}};}function handleEntityNotFound(_0x2f4f78,_0x599125){return function(_0x1f2c5f){if(!_0x1f2c5f){_0x2f4f78['sendStatus'](0x194);}return _0x1f2c5f;};}function handleError(_0x5461b7,_0x50bc72){_0x50bc72=_0x50bc72||0x1f4;return function(_0x27d934){logger['error'](_0x27d934[_0x8237('0x35')]);if(_0x27d934[_0x8237('0x36')]){delete _0x27d934[_0x8237('0x36')];}_0x5461b7[_0x8237('0x27')](_0x50bc72)[_0x8237('0x37')](_0x27d934);};}exports[_0x8237('0x38')]=function(_0x271faf,_0x4557aa){var _0x36fc9b={},_0xbeae4c={},_0x2a9100={'count':0x0,'rows':[]};var _0x2bda6c=_[_0x8237('0x39')](db['OpenchannelMessage'][_0x8237('0x3a')],function(_0x29b4f3){return{'name':_0x29b4f3[_0x8237('0x3b')],'type':_0x29b4f3[_0x8237('0x3c')]['key']};});_0xbeae4c[_0x8237('0x3d')]=_[_0x8237('0x39')](_0x2bda6c,_0x8237('0x36'));_0xbeae4c[_0x8237('0x3e')]=_[_0x8237('0x3f')](_0x271faf[_0x8237('0x3e')]);_0xbeae4c[_0x8237('0x40')]=_[_0x8237('0x41')](_0xbeae4c['model'],_0xbeae4c['query']);_0x36fc9b[_0x8237('0x42')]=_['intersection'](_0xbeae4c[_0x8237('0x3d')],qs['fields'](_0x271faf[_0x8237('0x3e')][_0x8237('0x43')]));_0x36fc9b[_0x8237('0x42')]=_0x36fc9b[_0x8237('0x42')][_0x8237('0x44')]?_0x36fc9b[_0x8237('0x42')]:_0xbeae4c['model'];if(!_0x271faf['query'][_0x8237('0x45')]('nolimit')){_0x36fc9b[_0x8237('0x2d')]=qs['limit'](_0x271faf[_0x8237('0x3e')]['limit']);_0x36fc9b[_0x8237('0x2a')]=qs[_0x8237('0x2a')](_0x271faf[_0x8237('0x3e')][_0x8237('0x2a')]);}_0x36fc9b[_0x8237('0x46')]=qs['sort'](_0x271faf[_0x8237('0x3e')][_0x8237('0x47')]);_0x36fc9b[_0x8237('0x48')]=qs[_0x8237('0x40')](_['pick'](_0x271faf[_0x8237('0x3e')],_0xbeae4c['filters']),_0x2bda6c);if(_0x271faf['query'][_0x8237('0x49')]){_0x36fc9b[_0x8237('0x48')]=_[_0x8237('0x4a')](_0x36fc9b[_0x8237('0x48')],{'$or':_['map'](_0x2bda6c,function(_0x209a3d){if(_0x209a3d[_0x8237('0x3c')]!=='VIRTUAL'){var _0x5c3cd6={};_0x5c3cd6[_0x209a3d['name']]={'$like':'%'+_0x271faf['query'][_0x8237('0x49')]+'%'};return _0x5c3cd6;}})});}_0x36fc9b=_[_0x8237('0x4a')]({},_0x36fc9b,_0x271faf['options']);var _0xec264f={'where':_0x36fc9b[_0x8237('0x48')]};return db['OpenchannelMessage'][_0x8237('0x2c')](_0xec264f)[_0x8237('0x1d')](function(_0x5dd406){_0x2a9100[_0x8237('0x2c')]=_0x5dd406;if(_0x271faf[_0x8237('0x3e')][_0x8237('0x4b')]){_0x36fc9b[_0x8237('0x4c')]=[{'all':!![]}];}return db[_0x8237('0x4d')][_0x8237('0x4e')](_0x36fc9b);})[_0x8237('0x1d')](function(_0x5d95c9){_0x2a9100[_0x8237('0x4f')]=_0x5d95c9;return _0x2a9100;})[_0x8237('0x1d')](respondWithFilteredResult(_0x4557aa,_0x36fc9b))[_0x8237('0x25')](handleError(_0x4557aa,null));};exports['show']=function(_0x3a678a,_0x38b8b2){var _0x5e46e5={'raw':!![],'where':{'id':_0x3a678a[_0x8237('0x50')]['id']}},_0xd08f3d={};_0xd08f3d[_0x8237('0x3d')]=_[_0x8237('0x3f')](db[_0x8237('0x4d')][_0x8237('0x3a')]);_0xd08f3d[_0x8237('0x3e')]=_[_0x8237('0x3f')](_0x3a678a['query']);_0xd08f3d[_0x8237('0x40')]=_[_0x8237('0x41')](_0xd08f3d[_0x8237('0x3d')],_0xd08f3d[_0x8237('0x3e')]);_0x5e46e5[_0x8237('0x42')]=_[_0x8237('0x41')](_0xd08f3d[_0x8237('0x3d')],qs[_0x8237('0x43')](_0x3a678a[_0x8237('0x3e')][_0x8237('0x43')]));_0x5e46e5[_0x8237('0x42')]=_0x5e46e5['attributes'][_0x8237('0x44')]?_0x5e46e5['attributes']:_0xd08f3d['model'];if(_0x3a678a[_0x8237('0x3e')][_0x8237('0x4b')]){_0x5e46e5[_0x8237('0x4c')]=[{'all':!![]}];}_0x5e46e5=_[_0x8237('0x4a')]({},_0x5e46e5,_0x3a678a[_0x8237('0x51')]);return db['OpenchannelMessage'][_0x8237('0x52')](_0x5e46e5)[_0x8237('0x1d')](handleEntityNotFound(_0x38b8b2,null))[_0x8237('0x1d')](respondWithResult(_0x38b8b2,null))['catch'](handleError(_0x38b8b2,null));};exports[_0x8237('0x53')]=function(_0x332779,_0x398e06){return db[_0x8237('0x4d')]['create'](_0x332779[_0x8237('0x54')],{})[_0x8237('0x1d')](respondWithResult(_0x398e06,0xc9))[_0x8237('0x25')](handleError(_0x398e06,null));};exports[_0x8237('0x33')]=function(_0x309593,_0x4c2888){if(_0x309593['body']['id']){delete _0x309593['body']['id'];}return db[_0x8237('0x4d')][_0x8237('0x52')]({'where':{'id':_0x309593[_0x8237('0x50')]['id']}})[_0x8237('0x1d')](handleEntityNotFound(_0x4c2888,null))['then'](saveUpdates(_0x309593[_0x8237('0x54')],null))['then'](respondWithResult(_0x4c2888,null))[_0x8237('0x25')](handleError(_0x4c2888,null));};exports[_0x8237('0x34')]=function(_0x40035d,_0x1d256c){return db['OpenchannelMessage']['find']({'where':{'id':_0x40035d[_0x8237('0x50')]['id']}})['then'](handleEntityNotFound(_0x1d256c,null))[_0x8237('0x1d')](removeEntity(_0x1d256c,null))[_0x8237('0x25')](handleError(_0x1d256c,null));};exports[_0x8237('0x55')]=function(_0x17ab41,_0xa6d894){return db[_0x8237('0x4d')][_0x8237('0x55')]()[_0x8237('0x1d')](respondWithResult(_0xa6d894,null))['catch'](handleError(_0xa6d894,null));};var interaction_log=require('../../config/logger')(_0x8237('0x56'));exports[_0x8237('0x57')]=function(_0x4dc5ec,_0x30bdcc,_0x1c739d){var _0x43d077={'agent':{},'channel':_0x8237('0x58')};if(_0x4dc5ec[_0x8237('0x54')]['id']){delete _0x4dc5ec[_0x8237('0x54')]['id'];}_0x4dc5ec[_0x8237('0x54')][_0x8237('0x59')]=!![];_0x4dc5ec[_0x8237('0x54')]['readAt']=moment()[_0x8237('0x5a')](_0x8237('0x5b'));_0x4dc5ec[_0x8237('0x54')][_0x8237('0x5c')]=_0x4dc5ec[_0x8237('0x54')][_0x8237('0x5c')]||_0x4dc5ec['user']['id'];_0x43d077[_0x8237('0x5d')]['id']=_0x4dc5ec[_0x8237('0x54')]['UserId'];return db[_0x8237('0x4d')][_0x8237('0x52')]({'where':{'id':_0x4dc5ec[_0x8237('0x50')]['id'],'UserId':null}})[_0x8237('0x1d')](handleEntityNotFound(_0x30bdcc,null))[_0x8237('0x1d')](saveUpdates(_0x4dc5ec[_0x8237('0x54')],null))[_0x8237('0x1d')](function(_0x12fdb1){if(_0x12fdb1){_0x43d077['message']=_0x12fdb1[_0x8237('0x5e')]({'plain':!![]});return db[_0x8237('0x5f')][_0x8237('0x52')]({'where':{'id':_0x12fdb1['OpenchannelInteractionId']}});}return null;})[_0x8237('0x1d')](handleEntityNotFound(_0x30bdcc,null))[_0x8237('0x1d')](function(_0x28dc5f){if(_0x28dc5f){return _0x28dc5f[_0x8237('0x33')]({'UserId':_0x4dc5ec[_0x8237('0x54')]['UserId'],'read1stAt':_[_0x8237('0x60')](_0x28dc5f['read1stAt'])?moment()[_0x8237('0x5a')](_0x8237('0x5b')):undefined});}return null;})[_0x8237('0x1d')](function(_0x4a85f0){if(_0x4a85f0){_0x43d077[_0x8237('0x61')]=_0x4a85f0['get']({'plain':!![]});interaction_log[_0x8237('0x24')](_0x8237('0x62'),_0x4dc5ec['user']['id'],_0x4dc5ec['user'][_0x8237('0x36')],_0x4dc5ec[_0x8237('0x63')][_0x8237('0x64')],_0x43d077[_0x8237('0x61')]['id'],_0x4dc5ec[_0x8237('0x54')]?JSON[_0x8237('0x65')](_0x4dc5ec[_0x8237('0x54')]):_0x8237('0x66'));return respondWithRpcPromise(_0x8237('0x67'),_0x8237('0x68'),_0x43d077);}return null;})[_0x8237('0x1d')](function(_0x2dae5b){var _0x2b9b3b=_0x8237('0x69')+_0x2dae5b['message']['ContactId'];return db[_0x8237('0x6a')][_0x8237('0x3e')](_0x2b9b3b,{'type':db[_0x8237('0x6b')][_0x8237('0x6c')][_0x8237('0x6d')],'raw':!![]})[_0x8237('0x1d')](function(_0x329955){return _0x329955;});})[_0x8237('0x1d')](function(_0x9c3893){if(_0x9c3893){_0x43d077[_0x8237('0x23')]['contact']=_0x9c3893[0x0];if(!_0x4dc5ec['body'][_0x8237('0x5c')])return;return db[_0x8237('0x6e')][_0x8237('0x52')]({'where':{'id':_0x4dc5ec[_0x8237('0x54')][_0x8237('0x5c')],'role':_0x8237('0x5d')},'attributes':['id',_0x8237('0x36'),_0x8237('0x6f'),_0x8237('0x70'),_0x8237('0x71')],'raw':!![]});}return null;})[_0x8237('0x1d')](function(_0x2a16f3){if(!_0x2a16f3)return null;_0x43d077[_0x8237('0x23')]['agent']=_0x2a16f3;return _0x43d077;})[_0x8237('0x1d')](function(_0x5d5f57){if(_0x5d5f57){if(_0x4dc5ec['body'][_0x8237('0x72')]){_0x43d077[_0x8237('0x23')][_0x8237('0x73')]=util[_0x8237('0x5a')]('SIP/%s',_0x4dc5ec[_0x8237('0x63')][_0x8237('0x36')]);_0x43d077[_0x8237('0x23')][_0x8237('0x74')]=_0x43d077['channel'];_0x43d077[_0x8237('0x23')][_0x8237('0x75')]=_0x43d077[_0x8237('0x74')];_0x43d077[_0x8237('0x23')]['event']=_0x8237('0x57');return respondWithRpcPromise(_0x8237('0x76'),_0x8237('0x76'),{'event':_0x8237('0x77'),'message':_0x43d077[_0x8237('0x23')]},client9002)[_0x8237('0x1d')](function(){return _0x43d077;});}return _0x43d077;}return null;})[_0x8237('0x1d')](respondWithResult(_0x30bdcc,null))[_0x8237('0x25')](handleError(_0x30bdcc,null));};var interaction_log=require(_0x8237('0x14'))(_0x8237('0x56'));exports['reject']=function(_0x4fea2b,_0x1fbbf2,_0x11f782){var _0x22619b={'agent':{},'channel':_0x8237('0x58')};if(_0x4fea2b['body']['id']){delete _0x4fea2b[_0x8237('0x54')]['id'];}_0x4fea2b['body'][_0x8237('0x5c')]=_0x4fea2b[_0x8237('0x54')][_0x8237('0x5c')]||_0x4fea2b['user']['id'];_0x22619b[_0x8237('0x5d')]['id']=_0x4fea2b[_0x8237('0x54')][_0x8237('0x5c')];return db[_0x8237('0x4d')][_0x8237('0x52')]({'where':{'id':_0x4fea2b[_0x8237('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1fbbf2,null))['then'](function(_0x10e1a5){if(_0x10e1a5){_0x22619b[_0x8237('0x23')]=_0x10e1a5[_0x8237('0x5e')]({'plain':!![]});return db[_0x8237('0x5f')][_0x8237('0x52')]({'where':{'id':_0x10e1a5[_0x8237('0x78')]}});}return null;})[_0x8237('0x1d')](handleEntityNotFound(_0x1fbbf2,null))[_0x8237('0x1d')](function(_0x26834d){if(_0x26834d){_0x22619b[_0x8237('0x61')]=_0x26834d[_0x8237('0x5e')]({'plain':!![]});interaction_log[_0x8237('0x24')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4fea2b[_0x8237('0x63')]['id'],_0x4fea2b[_0x8237('0x63')]['name'],_0x4fea2b[_0x8237('0x63')][_0x8237('0x64')],_0x22619b['interaction']['id'],_0x4fea2b['body']?JSON['stringify'](_0x4fea2b[_0x8237('0x54')]):_0x8237('0x66'));return respondWithRpcPromise(_0x8237('0x79'),_0x8237('0x7a'),_0x22619b);}return null;})[_0x8237('0x1d')](function(_0x370635){var _0x125427=_0x8237('0x69')+_0x370635[_0x8237('0x23')][_0x8237('0x7b')];return db['sequelize'][_0x8237('0x3e')](_0x125427,{'type':db[_0x8237('0x6b')][_0x8237('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x1ad43d){return _0x1ad43d;});})['then'](function(_0x4615fa){if(_0x4615fa){_0x22619b[_0x8237('0x23')]['contact']=_0x4615fa[0x0];if(!_0x4fea2b[_0x8237('0x54')][_0x8237('0x5c')])return;return db[_0x8237('0x6e')][_0x8237('0x52')]({'where':{'id':_0x4fea2b[_0x8237('0x54')][_0x8237('0x5c')],'role':_0x8237('0x5d')},'attributes':['id','name',_0x8237('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0x8237('0x1d')](function(_0x1656bd){if(!_0x1656bd)return null;_0x22619b[_0x8237('0x23')][_0x8237('0x5d')]=_0x1656bd;return _0x22619b;})[_0x8237('0x1d')](function(_0x117a63){if(_0x117a63){_0x117a63['message'][_0x8237('0x73')]=util[_0x8237('0x5a')](_0x8237('0x7c'),_0x4fea2b[_0x8237('0x63')][_0x8237('0x36')]);_0x117a63[_0x8237('0x23')][_0x8237('0x74')]=_0x22619b[_0x8237('0x74')];_0x117a63[_0x8237('0x23')][_0x8237('0x75')]=_0x22619b[_0x8237('0x74')];_0x117a63[_0x8237('0x23')][_0x8237('0x7d')]='reject';respondWithRpcPromise(_0x8237('0x76'),_0x8237('0x76'),{'event':'rejectmessage','message':_0x117a63[_0x8237('0x23')]},client9002);return _0x22619b;}return null;})[_0x8237('0x1d')](respondWithResult(_0x1fbbf2,null))[_0x8237('0x25')](handleError(_0x1fbbf2,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 45d6deb..6198aa8 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 _0xb6a5=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x1e56f1,_0x209ef3){var _0x449a78=function(_0x4f606a){while(--_0x4f606a){_0x1e56f1['push'](_0x1e56f1['shift']());}};_0x449a78(++_0x209ef3);}(_0xb6a5,0xce));var _0x5b6a=function(_0x17ce0e,_0x773586){_0x17ce0e=_0x17ce0e-0x0;var _0x12e994=_0xb6a5[_0x17ce0e];return _0x12e994;};'use strict';var EventEmitter=require(_0x5b6a('0x0'));var OpenchannelMessage=require(_0x5b6a('0x1'))['db'][_0x5b6a('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5b6a('0x3')](0x0);var events={'afterCreate':_0x5b6a('0x4'),'afterUpdate':'update','afterDestroy':_0x5b6a('0x5')};function emitEvent(_0x4ef3c4){return function(_0x128764,_0x46f687,_0x5cd072){OpenchannelMessageEvents[_0x5b6a('0x6')](_0x4ef3c4+':'+_0x128764['id'],_0x128764);OpenchannelMessageEvents['emit'](_0x4ef3c4,_0x128764);_0x5cd072(null);};}for(var e in events){if(events[_0x5b6a('0x7')](e)){var event=events[e];OpenchannelMessage[_0x5b6a('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x7344=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4c5f20,_0x3cce59){var _0x8e3e56=function(_0x43babf){while(--_0x43babf){_0x4c5f20['push'](_0x4c5f20['shift']());}};_0x8e3e56(++_0x3cce59);}(_0x7344,0x1df));var _0x4734=function(_0x141890,_0x4eeb62){_0x141890=_0x141890-0x0;var _0x5ab4c9=_0x7344[_0x141890];return _0x5ab4c9;};'use strict';var EventEmitter=require(_0x4734('0x0'));var OpenchannelMessage=require(_0x4734('0x1'))['db'][_0x4734('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x4734('0x3')](0x0);var events={'afterCreate':_0x4734('0x4'),'afterUpdate':_0x4734('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1de9ed){return function(_0x4364e5,_0x4c4488,_0x2fa02b){OpenchannelMessageEvents[_0x4734('0x6')](_0x1de9ed+':'+_0x4364e5['id'],_0x4364e5);OpenchannelMessageEvents[_0x4734('0x6')](_0x1de9ed,_0x4364e5);_0x2fa02b(null);};}for(var e in events){if(events[_0x4734('0x7')](e)){var event=events[e];OpenchannelMessage[_0x4734('0x8')](e,emitEvent(event));}}module[_0x4734('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index f0f1a36..f924cd3 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 _0x3c4f=['format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','POST','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','finally','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate'];(function(_0x5e6cea,_0x24b02a){var _0x55a315=function(_0x395b80){while(--_0x395b80){_0x5e6cea['push'](_0x5e6cea['shift']());}};_0x55a315(++_0x24b02a);}(_0x3c4f,0xab));var _0xf3c4=function(_0x196d4d,_0x5e3c10){_0x196d4d=_0x196d4d-0x0;var _0x131e2f=_0x3c4f[_0x196d4d];return _0x131e2f;};'use strict';var _=require(_0xf3c4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf3c4('0x1'));var BPromise=require(_0xf3c4('0x2'));var rp=require(_0xf3c4('0x3'));var fs=require('fs');var path=require(_0xf3c4('0x4'));var rimraf=require(_0xf3c4('0x5'));var config=require(_0xf3c4('0x6'));var attributes=require(_0xf3c4('0x7'));module['exports']=function(_0x2fdc8a,_0x23d192){return _0x2fdc8a['define'](_0xf3c4('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xf3c4('0x9'),'fields':[_0xf3c4('0xa')],'type':_0xf3c4('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16f13b,_0x596be0,_0x3099e3){var _0x43a3d2=_0x2fdc8a[_0xf3c4('0xc')];var _0x43b504=_0x16f13b['get']({'plain':!![]});if(_0x43b504[_0xf3c4('0xd')][_0xf3c4('0xe')]()==='in'||_0x43b504['direction']['toLowerCase']()===_0xf3c4('0xf')&&!_0x43b504[_0xf3c4('0x10')]&&!_[_0xf3c4('0x11')](_0x43b504[_0xf3c4('0x12')])){_0x43a3d2[_0xf3c4('0x13')][_0xf3c4('0x14')]({'where':{'id':_0x43b504[_0xf3c4('0x15')]}})['then'](function(_0x398bca){if(_0x398bca){_0x398bca[_0xf3c4('0x16')]({'lastMsgAt':_0x43b504[_0xf3c4('0x17')],'lastMsgDirection':_0x43b504[_0xf3c4('0xd')][_0xf3c4('0xe')]()});}})['catch'](function(_0x588a7b){console[_0xf3c4('0x18')](_0x588a7b);});}if(_0x43b504[_0xf3c4('0xd')]===_0xf3c4('0xf')&&!_0x43b504[_0xf3c4('0x10')]){var _0x423263;_0x43a3d2[_0xf3c4('0x19')][_0xf3c4('0x1a')]()[_0xf3c4('0x1b')](function(_0x14ae23){return _0x43a3d2[_0xf3c4('0x1c')][_0xf3c4('0x1d')]({'where':{'id':_0x43b504[_0xf3c4('0x1e')]},'include':[{'model':_0x43a3d2[_0xf3c4('0x13')],'as':_0xf3c4('0x1f'),'where':{'id':_0x43b504['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x43a3d2[_0xf3c4('0x19')],'as':_0xf3c4('0x20'),'attributes':_[_0xf3c4('0x21')](_0x14ae23)}]}]});})['then'](function(_0x46c59f){_0x423263=_0x46c59f['get']({'plain':!![]});if(_0x423263&&_0x423263[_0xf3c4('0x22')]){logger['info'](_0xf3c4('0x23'),_0xf3c4('0x24'),util[_0xf3c4('0x25')](_0xf3c4('0x26'),_0x43b504['id'],_0x423263[_0xf3c4('0x22')]));if(_0x423263['Interactions']&&_0x423263[_0xf3c4('0x1f')][_0xf3c4('0x27')]){_0x43b504[_0xf3c4('0x28')]=_[_0xf3c4('0x29')](_0x423263[_0xf3c4('0x1f')][0x0],_0xf3c4('0x20'));_0x43b504['Contact']=_0x423263[_0xf3c4('0x1f')][0x0][_0xf3c4('0x20')];}var _0x596be0={'method':'POST','uri':encodeURI(_0x423263[_0xf3c4('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x596be0[_0xf3c4('0x2a')]){case _0xf3c4('0x2b'):_0x596be0['qs']=_0x43b504;break;case _0xf3c4('0x2c'):_0x596be0[_0xf3c4('0xa')]=_0x43b504;break;}return rp(_0x596be0)[_0xf3c4('0x1b')](function(_0x1bf3a7){logger[_0xf3c4('0x2d')](_0xf3c4('0x23'),'afterCreate',util[_0xf3c4('0x25')](_0xf3c4('0x2e'),_0x43b504['id'],_0x423263[_0xf3c4('0x22')]));if(_0x1bf3a7[_0xf3c4('0xa')][_0xf3c4('0x2f')]&&_0x1bf3a7[_0xf3c4('0xa')]['threadId']!=_0x43b504[_0xf3c4('0x28')][_0xf3c4('0x2f')]){return _0x43a3d2[_0xf3c4('0x13')][_0xf3c4('0x16')]({'threadId':_0x1bf3a7[_0xf3c4('0xa')]['threadId']},{'where':{'id':_0x43b504[_0xf3c4('0x28')]['id']}});}else{return;}})[_0xf3c4('0x1b')](function(){return _0x16f13b[_0xf3c4('0x16')]({'read':!![]});})[_0xf3c4('0x30')](function(_0x5b4df0){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xf3c4('0x31')](_0x5b4df0,{'showHidden':![],'depth':null}));_0x3099e3();});}else{_0x3099e3();}})[_0xf3c4('0x32')](function(){_0x3099e3();});}else{_0x3099e3();}}},'charset':'utf8mb4','collate':_0xf3c4('0x33')});}; \ No newline at end of file +var _0xc74e=['fti_openchannel_messages','body','FULLTEXT','get','direction','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','toLowerCase','catch','error','out','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages'];(function(_0x40741b,_0x380f1a){var _0x30e499=function(_0x1c8dbc){while(--_0x1c8dbc){_0x40741b['push'](_0x40741b['shift']());}};_0x30e499(++_0x380f1a);}(_0xc74e,0x90));var _0xec74=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc74e[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xec74('0x0'));var logger=require(_0xec74('0x1'))(_0xec74('0x2'));var moment=require(_0xec74('0x3'));var BPromise=require(_0xec74('0x4'));var rp=require(_0xec74('0x5'));var fs=require('fs');var path=require(_0xec74('0x6'));var rimraf=require('rimraf');var config=require(_0xec74('0x7'));var attributes=require(_0xec74('0x8'));module[_0xec74('0x9')]=function(_0x7767d4,_0x1b076d){return _0x7767d4[_0xec74('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xec74('0xb'),'paranoid':![],'indexes':[{'name':_0xec74('0xc'),'fields':[_0xec74('0xd')],'type':_0xec74('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b2477,_0x2cef8c,_0x59df3a){var _0x264ddd=_0x7767d4['models'];var _0x124a31=_0x3b2477[_0xec74('0xf')]({'plain':!![]});if(_0x124a31[_0xec74('0x10')]['toLowerCase']()==='in'||_0x124a31[_0xec74('0x10')]['toLowerCase']()==='out'&&!_0x124a31['secret']&&!_[_0xec74('0x11')](_0x124a31[_0xec74('0x12')])){_0x264ddd[_0xec74('0x13')]['findOne']({'where':{'id':_0x124a31[_0xec74('0x14')]}})[_0xec74('0x15')](function(_0x107b4a){if(_0x107b4a){_0x107b4a[_0xec74('0x16')]({'lastMsgAt':_0x124a31[_0xec74('0x17')],'lastMsgDirection':_0x124a31[_0xec74('0x10')][_0xec74('0x18')]()});}})[_0xec74('0x19')](function(_0x3157ee){console[_0xec74('0x1a')](_0x3157ee);});}if(_0x124a31[_0xec74('0x10')]===_0xec74('0x1b')&&!_0x124a31['secret']){var _0xcaa8fc;_0x264ddd[_0xec74('0x1c')][_0xec74('0x1d')]()[_0xec74('0x15')](function(_0x42eccd){return _0x264ddd[_0xec74('0x1e')][_0xec74('0x1f')]({'where':{'id':_0x124a31[_0xec74('0x20')]},'include':[{'model':_0x264ddd[_0xec74('0x13')],'as':_0xec74('0x21'),'where':{'id':_0x124a31[_0xec74('0x14')]},'limit':0x1,'include':[{'model':_0x264ddd[_0xec74('0x1c')],'as':_0xec74('0x22'),'attributes':_[_0xec74('0x23')](_0x42eccd)}]}]});})[_0xec74('0x15')](function(_0xa009b4){_0xcaa8fc=_0xa009b4[_0xec74('0xf')]({'plain':!![]});if(_0xcaa8fc&&_0xcaa8fc[_0xec74('0x24')]){logger[_0xec74('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0xec74('0x26'),util[_0xec74('0x27')](_0xec74('0x28'),_0x124a31['id'],_0xcaa8fc[_0xec74('0x24')]));if(_0xcaa8fc[_0xec74('0x21')]&&_0xcaa8fc[_0xec74('0x21')][_0xec74('0x29')]){_0x124a31['Interaction']=_[_0xec74('0x2a')](_0xcaa8fc[_0xec74('0x21')][0x0],'Contact');_0x124a31[_0xec74('0x22')]=_0xcaa8fc[_0xec74('0x21')][0x0][_0xec74('0x22')];}var _0x2cef8c={'method':_0xec74('0x2b'),'uri':encodeURI(_0xcaa8fc[_0xec74('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2cef8c[_0xec74('0x2c')]){case'GET':_0x2cef8c['qs']=_0x124a31;break;case _0xec74('0x2b'):_0x2cef8c[_0xec74('0xd')]=_0x124a31;break;}return rp(_0x2cef8c)['then'](function(_0x48e42a){logger[_0xec74('0x25')](_0xec74('0x2d'),_0xec74('0x26'),util[_0xec74('0x27')](_0xec74('0x2e'),_0x124a31['id'],_0xcaa8fc['replyUri']));if(_0x48e42a[_0xec74('0xd')][_0xec74('0x2f')]&&_0x48e42a[_0xec74('0xd')][_0xec74('0x2f')]!=_0x124a31[_0xec74('0x30')][_0xec74('0x2f')]){return _0x264ddd[_0xec74('0x13')]['update']({'threadId':_0x48e42a[_0xec74('0xd')]['threadId']},{'where':{'id':_0x124a31['Interaction']['id']}});}else{return;}})[_0xec74('0x15')](function(){return _0x3b2477[_0xec74('0x16')]({'read':!![]});})[_0xec74('0x19')](function(_0x522b78){logger['error'](_0xec74('0x2d'),_0xec74('0x26'),util[_0xec74('0x31')](_0x522b78,{'showHidden':![],'depth':null}));_0x59df3a();});}else{_0x59df3a();}})[_0xec74('0x32')](function(){_0x59df3a();});}else{_0x59df3a();}}},'charset':_0xec74('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 012b57d..d19e3b4 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14e13a,_0x2a7452){var _0x9b3c3=function(_0x5f4e1b){while(--_0x5f4e1b){_0x14e13a['push'](_0x14e13a['shift']());}};_0x9b3c3(++_0x2a7452);}(_0x5f2f,0x73));var _0xf5f2=function(_0x50bd74,_0x47e8fa){_0x50bd74=_0x50bd74-0x0;var _0x509e03=_0x5f2f[_0x50bd74];return _0x509e03;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _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(_0x40f4c2,_0x52face){var _0x2f55aa=function(_0x407c95){while(--_0x407c95){_0x40f4c2['push'](_0x40f4c2['shift']());}};_0x2f55aa(++_0x52face);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index d8fbd2c..2542a0b 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 _0x720e=['update','emit','register','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x39872e,_0xf01729){var _0x70015d=function(_0x519236){while(--_0x519236){_0x39872e['push'](_0x39872e['shift']());}};_0x70015d(++_0xf01729);}(_0x720e,0x18c));var _0xe720=function(_0x534617,_0x41a7ba){_0x534617=_0x534617-0x0;var _0x516e6a=_0x720e[_0x534617];return _0x516e6a;};'use strict';var OpenchannelMessageEvents=require(_0xe720('0x0'));var events=[_0xe720('0x1'),_0xe720('0x2'),_0xe720('0x3')];function createListener(_0x3eb9e2,_0xa4176f){return function(_0x43a79f){_0xa4176f[_0xe720('0x4')](_0x3eb9e2,_0x43a79f);};}function removeListener(_0x260d77,_0xdc3d13){return function(){OpenchannelMessageEvents['removeListener'](_0x260d77,_0xdc3d13);};}exports[_0xe720('0x5')]=function(_0x16c77e){for(var _0x4eb47c=0x0,_0x1d5963=events['length'];_0x4eb47c<_0x1d5963;_0x4eb47c++){var _0x11aac7=events[_0x4eb47c];var _0x2e1664=createListener(_0xe720('0x6')+_0x11aac7,_0x16c77e);OpenchannelMessageEvents['on'](_0x11aac7,_0x2e1664);}}; \ No newline at end of file +var _0xce2a=['openchannelMessage:','save','remove','update','emit','register','length'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xce2a,0xd3));var _0xace2=function(_0x49eff5,_0x16a431){_0x49eff5=_0x49eff5-0x0;var _0x3617d1=_0xce2a[_0x49eff5];return _0x3617d1;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xace2('0x0'),_0xace2('0x1'),_0xace2('0x2')];function createListener(_0x5753ff,_0x2435ad){return function(_0x88316){_0x2435ad[_0xace2('0x3')](_0x5753ff,_0x88316);};}function removeListener(_0x5eb117,_0x362167){return function(){OpenchannelMessageEvents['removeListener'](_0x5eb117,_0x362167);};}exports[_0xace2('0x4')]=function(_0x25fdde){for(var _0x5b68c3=0x0,_0x5295a0=events[_0xace2('0x5')];_0x5b68c3<_0x5295a0;_0x5b68c3++){var _0x1e6111=events[_0x5b68c3];var _0x3f6540=createListener(_0xace2('0x6')+_0x1e6111,_0x25fdde);OpenchannelMessageEvents['on'](_0x1e6111,_0x3f6540);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 7beb9fe..f1ad1c2 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 _0xa6b8=['./openchannelQueue.controller','index','get','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xab407,_0x159b65){var _0x5c6288=function(_0x36cb3d){while(--_0x36cb3d){_0xab407['push'](_0xab407['shift']());}};_0x5c6288(++_0x159b65);}(_0xa6b8,0x147));var _0x8a6b=function(_0x2db896,_0x579f33){_0x2db896=_0x2db896-0x0;var _0x4be17=_0xa6b8[_0x2db896];return _0x4be17;};'use strict';var multer=require(_0x8a6b('0x0'));var util=require(_0x8a6b('0x1'));var path=require(_0x8a6b('0x2'));var timeout=require(_0x8a6b('0x3'));var express=require(_0x8a6b('0x4'));var router=express['Router']();var fs_extra=require(_0x8a6b('0x5'));var auth=require(_0x8a6b('0x6'));var interaction=require(_0x8a6b('0x7'));var config=require(_0x8a6b('0x8'));var controller=require(_0x8a6b('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8a6b('0xa')]);router[_0x8a6b('0xb')]('/describe',auth[_0x8a6b('0xc')](),controller['describe']);router['get']('/:id',auth[_0x8a6b('0xc')](),controller[_0x8a6b('0xd')]);router[_0x8a6b('0xb')](_0x8a6b('0xe'),auth['isAuthenticated'](),controller[_0x8a6b('0xf')]);router['get'](_0x8a6b('0x10'),auth['isAuthenticated'](),controller[_0x8a6b('0x11')]);router[_0x8a6b('0xb')](_0x8a6b('0x12'),auth[_0x8a6b('0xc')](),controller['getAgents']);router[_0x8a6b('0x13')]('/',auth[_0x8a6b('0xc')](),controller['create']);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x8a6b('0x14')]);router[_0x8a6b('0x13')](_0x8a6b('0x12'),auth['isAuthenticated'](),controller[_0x8a6b('0x15')]);router['put'](_0x8a6b('0x16'),auth[_0x8a6b('0xc')](),controller['update']);router[_0x8a6b('0x17')]('/:id',auth[_0x8a6b('0xc')](),controller[_0x8a6b('0x18')]);router[_0x8a6b('0x17')](_0x8a6b('0x10'),auth[_0x8a6b('0xc')](),controller[_0x8a6b('0x19')]);router['delete'](_0x8a6b('0x12'),auth['isAuthenticated'](),controller[_0x8a6b('0x1a')]);module[_0x8a6b('0x1b')]=router; \ No newline at end of file +var _0x4c4d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents','put','/:id','update','delete','destroy','removeAgents','exports'];(function(_0xd9f981,_0x299d14){var _0xfbd729=function(_0x48d77b){while(--_0x48d77b){_0xd9f981['push'](_0xd9f981['shift']());}};_0xfbd729(++_0x299d14);}(_0x4c4d,0x195));var _0xd4c4=function(_0x3af6ed,_0x2f7f88){_0x3af6ed=_0x3af6ed-0x0;var _0x25b391=_0x4c4d[_0x3af6ed];return _0x25b391;};'use strict';var multer=require(_0xd4c4('0x0'));var util=require(_0xd4c4('0x1'));var path=require(_0xd4c4('0x2'));var timeout=require(_0xd4c4('0x3'));var express=require(_0xd4c4('0x4'));var router=express[_0xd4c4('0x5')]();var fs_extra=require(_0xd4c4('0x6'));var auth=require(_0xd4c4('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd4c4('0x8'));router[_0xd4c4('0x9')]('/',auth[_0xd4c4('0xa')](),controller[_0xd4c4('0xb')]);router[_0xd4c4('0x9')]('/describe',auth[_0xd4c4('0xa')](),controller[_0xd4c4('0xc')]);router[_0xd4c4('0x9')]('/:id',auth[_0xd4c4('0xa')](),controller['show']);router[_0xd4c4('0x9')](_0xd4c4('0xd'),auth[_0xd4c4('0xa')](),controller[_0xd4c4('0xe')]);router[_0xd4c4('0x9')](_0xd4c4('0xf'),auth[_0xd4c4('0xa')](),controller[_0xd4c4('0x10')]);router[_0xd4c4('0x9')](_0xd4c4('0x11'),auth[_0xd4c4('0xa')](),controller['getAgents']);router[_0xd4c4('0x12')]('/',auth[_0xd4c4('0xa')](),controller['create']);router[_0xd4c4('0x12')](_0xd4c4('0xf'),auth[_0xd4c4('0xa')](),controller['addTeams']);router['post'](_0xd4c4('0x11'),auth['isAuthenticated'](),controller[_0xd4c4('0x13')]);router[_0xd4c4('0x14')](_0xd4c4('0x15'),auth[_0xd4c4('0xa')](),controller[_0xd4c4('0x16')]);router[_0xd4c4('0x17')]('/:id',auth[_0xd4c4('0xa')](),controller[_0xd4c4('0x18')]);router['delete'](_0xd4c4('0xf'),auth[_0xd4c4('0xa')](),controller['removeTeams']);router[_0xd4c4('0x17')](_0xd4c4('0x11'),auth['isAuthenticated'](),controller[_0xd4c4('0x19')]);module[_0xd4c4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 613f089..92c9642 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 _0xd52a=['INTEGER','ENUM','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x337800,_0x1e986e){var _0x2caa1d=function(_0x4fee6f){while(--_0x4fee6f){_0x337800['push'](_0x337800['shift']());}};_0x2caa1d(++_0x1e986e);}(_0xd52a,0x19c));var _0xad52=function(_0x4bc8ca,_0x80aab1){_0x4bc8ca=_0x4bc8ca-0x0;var _0x374c76=_0xd52a[_0x4bc8ca];return _0x374c76;};'use strict';var Sequelize=require(_0xad52('0x0'));module[_0xad52('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xad52('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xad52('0x3')]},'timeout':{'type':Sequelize[_0xad52('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xad52('0x5')]('rrmemory',_0xad52('0x6'),_0xad52('0x7'))}}; \ No newline at end of file +var _0x18eb=['beepall','sequelize','exports','STRING','ENUM','rrmemory'];(function(_0x418782,_0x755d5c){var _0x444610=function(_0x35ad31){while(--_0x35ad31){_0x418782['push'](_0x418782['shift']());}};_0x444610(++_0x755d5c);}(_0x18eb,0x1a5));var _0xb18e=function(_0x46bcec,_0x5bc91e){_0x46bcec=_0x46bcec-0x0;var _0xa23497=_0x18eb[_0x46bcec];return _0xa23497;};'use strict';var Sequelize=require(_0xb18e('0x0'));module[_0xb18e('0x1')]={'name':{'type':Sequelize[_0xb18e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb18e('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb18e('0x3')](_0xb18e('0x4'),_0xb18e('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4dbc6d7..9e3b198 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 _0xa847=['addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','getOptions','where','include','query','findAll','rows','catch','show','keys','intersection','model','attributes','fields','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','filters','length'];(function(_0x12dfeb,_0x3fe94f){var _0x3f2fb8=function(_0x2770e5){while(--_0x2770e5){_0x12dfeb['push'](_0x12dfeb['shift']());}};_0x3f2fb8(++_0x3fe94f);}(_0xa847,0x123));var _0x7a84=function(_0x3449b0,_0x5477f2){_0x3449b0=_0x3449b0-0x0;var _0x15b0a9=_0xa847[_0x3449b0];return _0x15b0a9;};'use strict';var BPromise=require(_0x7a84('0x0'));var util=require(_0x7a84('0x1'));var _=require(_0x7a84('0x2'));var squel=require('squel');var Redis=require(_0x7a84('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x7a84('0x4'))(_0x7a84('0x5'));var config=require(_0x7a84('0x6'));var db=require(_0x7a84('0x7'))['db'];config[_0x7a84('0x8')]=_[_0x7a84('0x9')](config[_0x7a84('0x8')],{'host':_0x7a84('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7a84('0xb'))[_0x7a84('0xc')](socket);function respondWithStatusCode(_0xa9465f,_0x6f3084){_0x6f3084=_0x6f3084||0xcc;return function(_0x196d1e){if(_0x196d1e){return _0xa9465f[_0x7a84('0xd')](_0x6f3084);}return _0xa9465f[_0x7a84('0xe')](_0x6f3084)[_0x7a84('0xf')]();};}function respondWithResult(_0x5c8b3c,_0x3c8076){_0x3c8076=_0x3c8076||0xc8;return function(_0x1e5268){if(_0x1e5268){return _0x5c8b3c[_0x7a84('0xe')](_0x3c8076)[_0x7a84('0x10')](_0x1e5268);}};}function respondWithFilteredResult(_0x4a9da2,_0x5144f2){return function(_0x18910d){if(_0x18910d){var _0xdd81d9=typeof _0x5144f2['offset']===_0x7a84('0x11')&&typeof _0x5144f2['limit']==='undefined';var _0x208b45=_0x18910d[_0x7a84('0x12')];var _0xeb89bb=_0xdd81d9?0x0:_0x5144f2['offset'];var _0x54234f=_0xdd81d9?_0x18910d[_0x7a84('0x12')]:_0x5144f2[_0x7a84('0x13')]+_0x5144f2[_0x7a84('0x14')];var _0x4fadce;if(_0x54234f>=_0x208b45){_0x54234f=_0x208b45;_0x4fadce=0xc8;}else{_0x4fadce=0xce;}_0x4a9da2['status'](_0x4fadce);return _0x4a9da2['set'](_0x7a84('0x15'),_0xeb89bb+'-'+_0x54234f+'/'+_0x208b45)[_0x7a84('0x10')](_0x18910d);}return null;};}function saveUpdates(_0xe7a1dd){return function(_0x297f69){if(_0x297f69){return _0x297f69[_0x7a84('0x16')](_0xe7a1dd)['then'](function(_0x351cbe){return _0x351cbe;});}return null;};}function removeEntity(_0x2ebc49){return function(_0x380552){if(_0x380552){return _0x380552[_0x7a84('0x17')]()[_0x7a84('0x18')](function(){var _0x2ec1ec=_0x380552[_0x7a84('0x19')]({'plain':!![]});var _0x198bb0=_0x7a84('0x1a');return db[_0x7a84('0x1b')][_0x7a84('0x17')]({'where':{'type':_0x198bb0,'resourceId':_0x2ec1ec['id']}})[_0x7a84('0x18')](function(){return _0x380552;});})[_0x7a84('0x18')](function(){_0x2ebc49[_0x7a84('0xe')](0xcc)[_0x7a84('0xf')]();});}};}function handleEntityNotFound(_0x2b0180){return function(_0x17f94c){if(!_0x17f94c){_0x2b0180['sendStatus'](0x194);}return _0x17f94c;};}function handleError(_0x364580,_0x1718b8){_0x1718b8=_0x1718b8||0x1f4;return function(_0x381376){logger[_0x7a84('0x1c')](_0x381376[_0x7a84('0x1d')]);if(_0x381376[_0x7a84('0x1e')]){delete _0x381376['name'];}_0x364580[_0x7a84('0xe')](_0x1718b8)[_0x7a84('0x1f')](_0x381376);};}exports['index']=function(_0x1249dc,_0x2a9964){var _0x554794={};var _0x4d12c3={'count':0x0,'rows':[]};var _0x58f432=_[_0x7a84('0x20')](db[_0x7a84('0x21')][_0x7a84('0x22')],function(_0x14b277){return{'name':_0x14b277[_0x7a84('0x23')],'type':_0x14b277['type']['key']};});_0x554794=qs[_0x7a84('0x24')](_0x58f432,_0x1249dc);var _0x2c4465={'where':_0x554794[_0x7a84('0x25')]};return db['OpenchannelQueue'][_0x7a84('0x12')](_0x2c4465)[_0x7a84('0x18')](function(_0x253ad0){_0x4d12c3['count']=_0x253ad0;_0x554794[_0x7a84('0x26')]=qs[_0x7a84('0x26')](_0x1249dc[_0x7a84('0x27')]);return db[_0x7a84('0x21')][_0x7a84('0x28')](_0x554794);})[_0x7a84('0x18')](function(_0xd2842a){_0x4d12c3[_0x7a84('0x29')]=_0xd2842a;return _0x4d12c3;})[_0x7a84('0x18')](respondWithFilteredResult(_0x2a9964,_0x554794))[_0x7a84('0x2a')](handleError(_0x2a9964,null));};exports[_0x7a84('0x2b')]=function(_0x5014ee,_0x494da8){var _0x3bda61={'raw':!![],'where':{'id':_0x5014ee['params']['id']}},_0x5b80cf={};_0x5b80cf['model']=_[_0x7a84('0x2c')](db['OpenchannelQueue']['rawAttributes']);_0x5b80cf[_0x7a84('0x27')]=_[_0x7a84('0x2c')](_0x5014ee['query']);_0x5b80cf['filters']=_[_0x7a84('0x2d')](_0x5b80cf[_0x7a84('0x2e')],_0x5b80cf[_0x7a84('0x27')]);_0x3bda61[_0x7a84('0x2f')]=_[_0x7a84('0x2d')](_0x5b80cf[_0x7a84('0x2e')],qs['fields'](_0x5014ee[_0x7a84('0x27')][_0x7a84('0x30')]));_0x3bda61[_0x7a84('0x2f')]=_0x3bda61[_0x7a84('0x2f')]['length']?_0x3bda61[_0x7a84('0x2f')]:_0x5b80cf[_0x7a84('0x2e')];if(_0x5014ee[_0x7a84('0x27')][_0x7a84('0x31')]){_0x3bda61[_0x7a84('0x26')]=[{'all':!![]}];}_0x3bda61=_[_0x7a84('0x32')]({},_0x3bda61,_0x5014ee[_0x7a84('0x33')]);return db['OpenchannelQueue'][_0x7a84('0x34')](_0x3bda61)[_0x7a84('0x18')](handleEntityNotFound(_0x494da8,null))['then'](respondWithResult(_0x494da8,null))['catch'](handleError(_0x494da8,null));};exports[_0x7a84('0x35')]=function(_0x5c668c,_0x171856){return db[_0x7a84('0x21')][_0x7a84('0x35')](_0x5c668c[_0x7a84('0x36')],{})[_0x7a84('0x18')](function(_0x33a8d5){var _0x36ddef=_0x5c668c[_0x7a84('0x37')][_0x7a84('0x19')]({'plain':!![]});if(!_0x36ddef)throw new Error(_0x7a84('0x38'));if(_0x36ddef[_0x7a84('0x39')]==='user'){var _0xdf0f12=_0x33a8d5[_0x7a84('0x19')]({'plain':!![]});var _0x5c21f4='OpenchannelQueues';return db[_0x7a84('0x3a')]['find']({'where':{'name':_0x5c21f4,'userProfileId':_0x36ddef[_0x7a84('0x3b')]},'raw':!![]})['then'](function(_0x6bfbf8){if(_0x6bfbf8&&_0x6bfbf8[_0x7a84('0x3c')]===0x0){return db[_0x7a84('0x1b')][_0x7a84('0x35')]({'name':_0xdf0f12[_0x7a84('0x1e')],'resourceId':_0xdf0f12['id'],'type':_0x6bfbf8[_0x7a84('0x1e')],'sectionId':_0x6bfbf8['id']},{})['then'](function(){return _0x33a8d5;});}else{return _0x33a8d5;}})[_0x7a84('0x2a')](function(_0x350c60){logger[_0x7a84('0x1c')](_0x7a84('0x3d'),_0x350c60);throw _0x350c60;});}return _0x33a8d5;})[_0x7a84('0x18')](respondWithResult(_0x171856,0xc9))[_0x7a84('0x2a')](handleError(_0x171856,null));};exports[_0x7a84('0x16')]=function(_0x1c683a,_0x1b8846){if(_0x1c683a[_0x7a84('0x36')]['id']){delete _0x1c683a[_0x7a84('0x36')]['id'];}return db[_0x7a84('0x21')]['find']({'where':{'id':_0x1c683a[_0x7a84('0x3e')]['id']}})[_0x7a84('0x18')](handleEntityNotFound(_0x1b8846,null))[_0x7a84('0x18')](saveUpdates(_0x1c683a['body'],null))[_0x7a84('0x18')](respondWithResult(_0x1b8846,null))['catch'](handleError(_0x1b8846,null));};exports[_0x7a84('0x17')]=function(_0x3d0bf4,_0x3ea6ae){return db[_0x7a84('0x21')]['find']({'where':{'id':_0x3d0bf4[_0x7a84('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3ea6ae,null))[_0x7a84('0x18')](removeEntity(_0x3ea6ae,null))['catch'](handleError(_0x3ea6ae,null));};exports[_0x7a84('0x3f')]=function(_0x26a6e8,_0x358360){return db[_0x7a84('0x21')][_0x7a84('0x3f')]()[_0x7a84('0x18')](respondWithResult(_0x358360,null))['catch'](handleError(_0x358360,null));};exports[_0x7a84('0x40')]=function(_0x2ce5c3,_0x2e0f37){var _0x536287={'raw':!![],'where':{}},_0x2d62c1={},_0x114ab5;return db[_0x7a84('0x21')][_0x7a84('0x41')]({'where':{'id':_0x2ce5c3[_0x7a84('0x3e')]['id']}})[_0x7a84('0x18')](handleEntityNotFound(_0x2e0f37,null))[_0x7a84('0x18')](function(_0x370b40){if(_0x370b40){_0x114ab5=_0x370b40['get']({'plain':!![]});_0x2d62c1[_0x7a84('0x2e')]=_[_0x7a84('0x2c')](db[_0x7a84('0x42')]['rawAttributes']);_0x2d62c1[_0x7a84('0x27')]=_[_0x7a84('0x2c')](_0x2ce5c3[_0x7a84('0x27')]);_0x2d62c1['filters']=_[_0x7a84('0x2d')](_0x2d62c1['model'],_0x2d62c1['query']);_0x536287[_0x7a84('0x2f')]=_[_0x7a84('0x2d')](_0x2d62c1['model'],qs[_0x7a84('0x30')](_0x2ce5c3[_0x7a84('0x27')]['fields']));_0x536287['attributes']=_0x536287[_0x7a84('0x2f')]['length']?_0x536287[_0x7a84('0x2f')]:_0x2d62c1[_0x7a84('0x2e')];if(!_0x2ce5c3['query'][_0x7a84('0x43')](_0x7a84('0x44'))){_0x536287[_0x7a84('0x14')]=qs[_0x7a84('0x14')](_0x2ce5c3[_0x7a84('0x27')]['limit']);_0x536287[_0x7a84('0x13')]=qs[_0x7a84('0x13')](_0x2ce5c3[_0x7a84('0x27')][_0x7a84('0x13')]);}_0x536287[_0x7a84('0x45')]=qs[_0x7a84('0x46')](_0x2ce5c3['query'][_0x7a84('0x46')]);_0x536287['where']=qs['filters'](_[_0x7a84('0x47')](_0x2ce5c3['query'],_0x2d62c1['filters']));_0x536287[_0x7a84('0x25')][_0x7a84('0x48')]=_0x370b40['id'];if(_0x2ce5c3[_0x7a84('0x27')][_0x7a84('0x49')]){_0x536287['where']=_[_0x7a84('0x32')](_0x536287['where'],{'$or':_[_0x7a84('0x20')](_0x536287[_0x7a84('0x2f')],function(_0x166c95){var _0x1d2dcd={};_0x1d2dcd[_0x166c95]={'$like':'%'+_0x2ce5c3[_0x7a84('0x27')][_0x7a84('0x49')]+'%'};return _0x1d2dcd;})});}_0x536287=_[_0x7a84('0x32')]({},_0x536287,_0x2ce5c3[_0x7a84('0x33')]);return db[_0x7a84('0x42')][_0x7a84('0x28')](_0x536287);}})[_0x7a84('0x18')](function(_0x106a29){if(_0x106a29){return db[_0x7a84('0x4a')][_0x7a84('0x4b')]({'where':{'id':_[_0x7a84('0x20')](_0x106a29,_0x7a84('0x4c')),'role':_0x7a84('0x4d')},'attributes':['id','name','openchannelPause',_0x7a84('0x4e'),_0x7a84('0x4f')]});}})[_0x7a84('0x18')](function(_0x1f6722){if(_0x1f6722){return{'count':_0x1f6722[_0x7a84('0x12')],'rows':_[_0x7a84('0x20')](_0x1f6722[_0x7a84('0x29')],function(_0x2dc189){return{'membername':_0x2dc189[_0x7a84('0x1e')],'UserId':_0x2dc189['id'],'queue_name':_0x114ab5[_0x7a84('0x1e')],'OpenchannelQueueId':_0x114ab5['id'],'interface':util[_0x7a84('0x50')](_0x7a84('0x51'),_0x7a84('0x52'),_0x2dc189[_0x7a84('0x1e')]),'penalty':0x0,'paused':_0x2dc189['openchannelPause'],'createdAt':_0x2dc189['createdAt'],'updatedAt':_0x2dc189[_0x7a84('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7a84('0x18')](respondWithFilteredResult(_0x2e0f37,_0x536287))[_0x7a84('0x2a')](handleError(_0x2e0f37,null));};exports[_0x7a84('0x53')]=function(_0x1bf1dd,_0x4609c1){var _0x798b91={};var _0x1a870c={};var _0x48d7c9;var _0x3160a7;return db['OpenchannelQueue'][_0x7a84('0x41')]({'where':{'id':_0x1bf1dd[_0x7a84('0x3e')]['id']}})[_0x7a84('0x18')](handleEntityNotFound(_0x4609c1,null))[_0x7a84('0x18')](function(_0x3e2213){if(_0x3e2213){_0x48d7c9=_0x3e2213;_0x1a870c[_0x7a84('0x2e')]=_['keys'](db[_0x7a84('0x54')][_0x7a84('0x22')]);_0x1a870c[_0x7a84('0x27')]=_[_0x7a84('0x2c')](_0x1bf1dd[_0x7a84('0x27')]);_0x1a870c[_0x7a84('0x55')]=_['intersection'](_0x1a870c[_0x7a84('0x2e')],_0x1a870c[_0x7a84('0x27')]);_0x798b91[_0x7a84('0x2f')]=_[_0x7a84('0x2d')](_0x1a870c['model'],qs[_0x7a84('0x30')](_0x1bf1dd[_0x7a84('0x27')][_0x7a84('0x30')]));_0x798b91[_0x7a84('0x2f')]=_0x798b91[_0x7a84('0x2f')][_0x7a84('0x56')]?_0x798b91[_0x7a84('0x2f')]:_0x1a870c[_0x7a84('0x2e')];_0x798b91[_0x7a84('0x45')]=qs[_0x7a84('0x46')](_0x1bf1dd[_0x7a84('0x27')][_0x7a84('0x46')]);_0x798b91[_0x7a84('0x25')]=qs[_0x7a84('0x55')](_['pick'](_0x1bf1dd[_0x7a84('0x27')],_0x1a870c[_0x7a84('0x55')]));if(_0x1bf1dd[_0x7a84('0x27')][_0x7a84('0x49')]){_0x798b91[_0x7a84('0x25')]=_[_0x7a84('0x32')](_0x798b91[_0x7a84('0x25')],{'$or':_[_0x7a84('0x20')](_0x798b91[_0x7a84('0x2f')],function(_0x5b9463){var _0x51a7ca={};_0x51a7ca[_0x5b9463]={'$like':'%'+_0x1bf1dd[_0x7a84('0x27')]['filter']+'%'};return _0x51a7ca;})});}_0x798b91=_[_0x7a84('0x32')]({},_0x798b91,_0x1bf1dd[_0x7a84('0x33')]);return _0x48d7c9[_0x7a84('0x53')](_0x798b91);}})[_0x7a84('0x18')](function(_0x5bca07){if(_0x5bca07){_0x3160a7=_0x5bca07['length'];if(!_0x1bf1dd[_0x7a84('0x27')][_0x7a84('0x43')](_0x7a84('0x44'))){_0x798b91[_0x7a84('0x14')]=qs[_0x7a84('0x14')](_0x1bf1dd[_0x7a84('0x27')][_0x7a84('0x14')]);_0x798b91[_0x7a84('0x13')]=qs[_0x7a84('0x13')](_0x1bf1dd['query'][_0x7a84('0x13')]);}return _0x48d7c9[_0x7a84('0x53')](_0x798b91);}})['then'](function(_0x245cde){if(_0x245cde){return _0x245cde?{'count':_0x3160a7,'rows':_0x245cde}:null;}})['then'](respondWithResult(_0x4609c1,null))[_0x7a84('0x2a')](handleError(_0x4609c1,null));};exports[_0x7a84('0x57')]=function(_0x33b256,_0x1376d9){var _0x5a8604=_0x33b256[_0x7a84('0x36')][_0x7a84('0x58')];return db[_0x7a84('0x54')][_0x7a84('0x28')]({'where':{'id':_0x5a8604},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7a84('0x59'),'attributes':['id','name',_0x7a84('0x5a'),_0x7a84('0x5b'),_0x7a84('0x5c')],'raw':!![]}]})[_0x7a84('0x18')](function(_0x9f98d8){if(_0x9f98d8){var _0x108a5c=_[_0x7a84('0x5d')](_0x9f98d8,function(_0x268800){var _0xc87f50=_0x268800[_0x7a84('0x19')]({'plain':!![]});return _0xc87f50[_0x7a84('0x59')];});return db[_0x7a84('0x21')][_0x7a84('0x34')]({'where':{'id':_0x33b256['params']['id']}})[_0x7a84('0x18')](function(_0x3e3e8b){return db['sequelize'][_0x7a84('0x5e')](function(_0x4505fb){return _0x3e3e8b['addTeams'](_0x5a8604,{'transaction':_0x4505fb})[_0x7a84('0x18')](function(){return BPromise[_0x7a84('0x5f')](_0x108a5c,function(_0x287bb1){return db['UserOpenchannelQueue'][_0x7a84('0x60')]({'where':{'UserId':_0x287bb1['id'],'OpenchannelQueueId':_0x33b256[_0x7a84('0x3e')]['id']},'transaction':_0x4505fb});});})[_0x7a84('0x18')](function(){_0x108a5c[_0x7a84('0x61')](function(_0x5af931){socket[_0x7a84('0x62')](_0x7a84('0x63'),{'UserId':_0x5af931['id'],'OpenchannelQueueId':_0x3e3e8b['id']});});});});});}})['then'](respondWithStatusCode(_0x1376d9,null))[_0x7a84('0x2a')](handleError(_0x1376d9,null));};exports[_0x7a84('0x64')]=function(_0x355547,_0x135500){return db[_0x7a84('0x54')][_0x7a84('0x28')]({'where':{'id':_0x355547[_0x7a84('0x27')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7a84('0x18')](handleEntityNotFound(_0x135500,null))['then'](function(_0x21205e){var _0x45a2fa=_[_0x7a84('0x20')](_0x21205e,'id');var _0x40c89a=[];var _0x106900=[];var _0x2f6bf9=squel['select']();_0x2f6bf9['field'](_0x7a84('0x65'))[_0x7a84('0x66')](_0x7a84('0x67'),'tq')[_0x7a84('0x68')](_0x7a84('0x69'),'ut',_0x7a84('0x6a'))[_0x7a84('0x25')]('OpenchannelQueueId\x20=\x20?',_0x355547[_0x7a84('0x3e')]['id']);for(var _0x1dfb58=0x0;_0x1dfb58<_0x21205e[_0x7a84('0x56')];_0x1dfb58+=0x1){let _0x2ace3e=_0x21205e[_0x1dfb58];for(var _0xa517b5=0x0;_0xa517b5<_0x2ace3e['Agents']['length'];_0xa517b5+=0x1){let _0xc41f64=_0x2ace3e[_0x7a84('0x59')][_0xa517b5];var _0x140c0f=_0x2f6bf9[_0x7a84('0x6b')]();_0x140c0f[_0x7a84('0x25')](_0x7a84('0x6c'),_0xc41f64['id']);_0x106900[_0x7a84('0x6d')](db[_0x7a84('0x6e')][_0x7a84('0x27')](_0x140c0f['toString'](),{'type':db[_0x7a84('0x6e')][_0x7a84('0x6f')][_0x7a84('0x70')]})[_0x7a84('0x18')](function(_0x3c9324){if(_0x3c9324[_0x7a84('0x56')]===0x1){return _0xc41f64['id'];}else{var _0x178f8b=_[_0x7a84('0x71')](_[_0x7a84('0x20')](_0x3c9324,_0x7a84('0x72')),function(_0x2077d4){return _[_0x7a84('0x73')](_0x45a2fa,_0x2077d4);});if(_0x178f8b){return _0xc41f64['id'];}}}));}}return BPromise[_0x7a84('0x74')](_0x106900)[_0x7a84('0x18')](function(_0x1a4c8f){_0x40c89a=_(_0x40c89a)[_0x7a84('0x75')](_0x1a4c8f)[_0x7a84('0x76')]()[_0x7a84('0x77')]();return db[_0x7a84('0x21')][_0x7a84('0x34')]({'where':{'id':_0x355547[_0x7a84('0x3e')]['id']}})[_0x7a84('0x18')](function(_0x66548f){return db[_0x7a84('0x6e')][_0x7a84('0x5e')](function(_0x29bfab){return _0x66548f[_0x7a84('0x64')](_0x355547[_0x7a84('0x27')]['ids'],{'transaction':_0x29bfab})['then'](function(){if(!_[_0x7a84('0x78')](_0x40c89a)){return _0x66548f[_0x7a84('0x79')](_0x40c89a,{'transaction':_0x29bfab});}})['then'](function(){_0x40c89a[_0x7a84('0x61')](function(_0x3d23e5){socket[_0x7a84('0x62')](_0x7a84('0x7a'),{'UserId':_0x3d23e5,'OpenchannelQueueId':_0x66548f['id']});});});});});});})[_0x7a84('0x18')](respondWithStatusCode(_0x135500,null))[_0x7a84('0x2a')](handleError(_0x135500,null));};exports[_0x7a84('0x7b')]=function(_0x1a3c41,_0x466f5a){return db['OpenchannelQueue'][_0x7a84('0x34')]({'where':{'id':_0x1a3c41['params']['id']}})[_0x7a84('0x18')](handleEntityNotFound(_0x466f5a,null))['then'](function(_0x9ab318){if(_0x9ab318){return _0x9ab318['addAgents'](_0x1a3c41[_0x7a84('0x36')][_0x7a84('0x58')],_['omit'](_0x1a3c41[_0x7a84('0x36')],[_0x7a84('0x58'),'id'])||{})['spread'](function(_0x3f6392){for(var _0x28e8ae=0x0;_0x28e8ae<_0x1a3c41['body'][_0x7a84('0x58')][_0x7a84('0x56')];_0x28e8ae+=0x1){socket[_0x7a84('0x62')](_0x7a84('0x63'),{'UserId':Number(_0x1a3c41[_0x7a84('0x36')][_0x7a84('0x58')][_0x28e8ae]),'OpenchannelQueueId':Number(_0x1a3c41[_0x7a84('0x3e')]['id'])});}return _0x3f6392;});}})[_0x7a84('0x18')](respondWithResult(_0x466f5a,null))[_0x7a84('0x2a')](handleError(_0x466f5a,null));};exports['removeAgents']=function(_0x101823,_0x3b4375){return db[_0x7a84('0x21')][_0x7a84('0x34')]({'where':{'id':_0x101823['params']['id']}})[_0x7a84('0x18')](handleEntityNotFound(_0x3b4375,null))[_0x7a84('0x18')](function(_0x3707e2){if(_0x3707e2){return _0x3707e2[_0x7a84('0x79')](_0x101823[_0x7a84('0x27')][_0x7a84('0x58')])[_0x7a84('0x18')](function(){if(_[_0x7a84('0x7c')](_0x101823[_0x7a84('0x27')]['ids'])){for(var _0x1d99f5=0x0;_0x1d99f5<_0x101823['query'][_0x7a84('0x58')][_0x7a84('0x56')];_0x1d99f5+=0x1){socket[_0x7a84('0x62')](_0x7a84('0x7a'),{'UserId':Number(_0x101823[_0x7a84('0x27')][_0x7a84('0x58')][_0x1d99f5]),'OpenchannelQueueId':Number(_0x101823[_0x7a84('0x3e')]['id'])});}}else{socket[_0x7a84('0x62')](_0x7a84('0x7a'),{'UserId':Number(_0x101823[_0x7a84('0x27')][_0x7a84('0x58')]),'OpenchannelQueueId':Number(_0x101823[_0x7a84('0x3e')]['id'])});}});}})[_0x7a84('0x18')](respondWithStatusCode(_0x3b4375,null))[_0x7a84('0x2a')](handleError(_0x3b4375,null));};exports[_0x7a84('0x7d')]=function(_0x12cf81,_0x589a7c){var _0x4d98d0={};var _0x4ed65e={};var _0x3c12ca;var _0x3ab56d;return db[_0x7a84('0x21')][_0x7a84('0x41')]({'where':{'id':_0x12cf81[_0x7a84('0x3e')]['id']}})['then'](handleEntityNotFound(_0x589a7c,null))['then'](function(_0xeef8a0){if(_0xeef8a0){_0x3c12ca=_0xeef8a0;_0x4ed65e[_0x7a84('0x2e')]=_[_0x7a84('0x2c')](db[_0x7a84('0x4a')][_0x7a84('0x22')]);_0x4ed65e[_0x7a84('0x27')]=_[_0x7a84('0x2c')](_0x12cf81['query']);_0x4ed65e[_0x7a84('0x55')]=_[_0x7a84('0x2d')](_0x4ed65e[_0x7a84('0x2e')],_0x4ed65e['query']);_0x4d98d0[_0x7a84('0x2f')]=_[_0x7a84('0x2d')](_0x4ed65e['model'],qs[_0x7a84('0x30')](_0x12cf81['query']['fields']));_0x4d98d0['attributes']=_0x4d98d0[_0x7a84('0x2f')]['length']?_0x4d98d0['attributes']:_0x4ed65e['model'];_0x4d98d0[_0x7a84('0x45')]=qs[_0x7a84('0x46')](_0x12cf81[_0x7a84('0x27')][_0x7a84('0x46')]);_0x4d98d0[_0x7a84('0x25')]=qs[_0x7a84('0x55')](_[_0x7a84('0x47')](_0x12cf81['query'],_0x4ed65e[_0x7a84('0x55')]));if(_0x12cf81[_0x7a84('0x27')][_0x7a84('0x49')]){_0x4d98d0[_0x7a84('0x25')]=_['merge'](_0x4d98d0[_0x7a84('0x25')],{'$or':_[_0x7a84('0x20')](_0x4d98d0['attributes'],function(_0x311eba){var _0x18613e={};_0x18613e[_0x311eba]={'$like':'%'+_0x12cf81['query'][_0x7a84('0x49')]+'%'};return _0x18613e;})});}_0x4d98d0=_[_0x7a84('0x32')]({},_0x4d98d0,_0x12cf81[_0x7a84('0x33')]);return _0x3c12ca[_0x7a84('0x7d')](_0x4d98d0);}})[_0x7a84('0x18')](function(_0x5440b6){if(_0x5440b6){_0x3ab56d=_0x5440b6[_0x7a84('0x56')];if(!_0x12cf81[_0x7a84('0x27')][_0x7a84('0x43')]('nolimit')){_0x4d98d0[_0x7a84('0x14')]=qs['limit'](_0x12cf81[_0x7a84('0x27')][_0x7a84('0x14')]);_0x4d98d0['offset']=qs['offset'](_0x12cf81[_0x7a84('0x27')][_0x7a84('0x13')]);}return _0x3c12ca['getAgents'](_0x4d98d0);}})[_0x7a84('0x18')](function(_0x3cec0a){if(_0x3cec0a){return _0x3cec0a?{'count':_0x3ab56d,'rows':_0x3cec0a}:null;}})[_0x7a84('0x18')](respondWithResult(_0x589a7c,null))[_0x7a84('0x2a')](handleError(_0x589a7c,null));}; \ No newline at end of file +var _0x2baa=['userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','removeAgents','isArray','getAgents','bluebird','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','get','OpenchannelQueues','UserProfileResource','then','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','type','getOptions','include','query','rows','catch','params','keys','filters','intersection','model','attributes','fields','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','findOne','UserOpenchannelQueue','length','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelQueueId','filter','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','%s/%s','getTeams','Team','ids','findAll','Agents','voicePause','interface','flatMap','transaction','addTeams','findOrCreate','forEach','emit','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0x2baa,0x1df));var _0xa2ba=function(_0x392ea9,_0xfe8969){_0x392ea9=_0x392ea9-0x0;var _0x389de4=_0x2baa[_0x392ea9];return _0x389de4;};'use strict';var BPromise=require(_0xa2ba('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xa2ba('0x1'));var Redis=require('ioredis');var qs=require(_0xa2ba('0x2'));var logger=require(_0xa2ba('0x3'))(_0xa2ba('0x4'));var config=require('../../config/environment');var db=require(_0xa2ba('0x5'))['db'];config['redis']=_[_0xa2ba('0x6')](config['redis'],{'host':_0xa2ba('0x7'),'port':0x18eb});var socket=require(_0xa2ba('0x8'))(new Redis(config[_0xa2ba('0x9')]));require(_0xa2ba('0xa'))['register'](socket);function respondWithStatusCode(_0x4449d8,_0x5c23f0){_0x5c23f0=_0x5c23f0||0xcc;return function(_0x277ca7){if(_0x277ca7){return _0x4449d8[_0xa2ba('0xb')](_0x5c23f0);}return _0x4449d8[_0xa2ba('0xc')](_0x5c23f0)[_0xa2ba('0xd')]();};}function respondWithResult(_0x32774d,_0x4fe142){_0x4fe142=_0x4fe142||0xc8;return function(_0xfa87fb){if(_0xfa87fb){return _0x32774d['status'](_0x4fe142)[_0xa2ba('0xe')](_0xfa87fb);}};}function respondWithFilteredResult(_0x12be2b,_0x1903c2){return function(_0x3ee91e){if(_0x3ee91e){var _0x422e11=typeof _0x1903c2[_0xa2ba('0xf')]===_0xa2ba('0x10')&&typeof _0x1903c2[_0xa2ba('0x11')]===_0xa2ba('0x10');var _0x1eabac=_0x3ee91e['count'];var _0x3a7e4b=_0x422e11?0x0:_0x1903c2['offset'];var _0x193d58=_0x422e11?_0x3ee91e[_0xa2ba('0x12')]:_0x1903c2[_0xa2ba('0xf')]+_0x1903c2[_0xa2ba('0x11')];var _0x24b098;if(_0x193d58>=_0x1eabac){_0x193d58=_0x1eabac;_0x24b098=0xc8;}else{_0x24b098=0xce;}_0x12be2b[_0xa2ba('0xc')](_0x24b098);return _0x12be2b['set'](_0xa2ba('0x13'),_0x3a7e4b+'-'+_0x193d58+'/'+_0x1eabac)['json'](_0x3ee91e);}return null;};}function saveUpdates(_0x39b1ed){return function(_0x1fc786){if(_0x1fc786){return _0x1fc786['update'](_0x39b1ed)['then'](function(_0x4f468a){return _0x4f468a;});}return null;};}function removeEntity(_0x36edc1){return function(_0x323264){if(_0x323264){return _0x323264[_0xa2ba('0x14')]()['then'](function(){var _0x75f8ab=_0x323264[_0xa2ba('0x15')]({'plain':!![]});var _0x1c9a03=_0xa2ba('0x16');return db[_0xa2ba('0x17')][_0xa2ba('0x14')]({'where':{'type':_0x1c9a03,'resourceId':_0x75f8ab['id']}})[_0xa2ba('0x18')](function(){return _0x323264;});})['then'](function(){_0x36edc1[_0xa2ba('0xc')](0xcc)[_0xa2ba('0xd')]();});}};}function handleEntityNotFound(_0x5479c8){return function(_0x3a2109){if(!_0x3a2109){_0x5479c8[_0xa2ba('0xb')](0x194);}return _0x3a2109;};}function handleError(_0x4566bb,_0x256f07){_0x256f07=_0x256f07||0x1f4;return function(_0x137496){logger[_0xa2ba('0x19')](_0x137496[_0xa2ba('0x1a')]);if(_0x137496[_0xa2ba('0x1b')]){delete _0x137496[_0xa2ba('0x1b')];}_0x4566bb[_0xa2ba('0xc')](_0x256f07)[_0xa2ba('0x1c')](_0x137496);};}exports[_0xa2ba('0x1d')]=function(_0x2ee91c,_0x2b1964){var _0xecf10a={};var _0x23c87c={'count':0x0,'rows':[]};var _0x5f1f0b=_[_0xa2ba('0x1e')](db[_0xa2ba('0x1f')][_0xa2ba('0x20')],function(_0x106f31){return{'name':_0x106f31['fieldName'],'type':_0x106f31[_0xa2ba('0x21')]['key']};});_0xecf10a=qs[_0xa2ba('0x22')](_0x5f1f0b,_0x2ee91c);var _0x48dccd={'where':_0xecf10a['where']};return db[_0xa2ba('0x1f')][_0xa2ba('0x12')](_0x48dccd)['then'](function(_0x461b0b){_0x23c87c[_0xa2ba('0x12')]=_0x461b0b;_0xecf10a[_0xa2ba('0x23')]=qs[_0xa2ba('0x23')](_0x2ee91c[_0xa2ba('0x24')]);return db['OpenchannelQueue']['findAll'](_0xecf10a);})['then'](function(_0x5bfb4d){_0x23c87c[_0xa2ba('0x25')]=_0x5bfb4d;return _0x23c87c;})['then'](respondWithFilteredResult(_0x2b1964,_0xecf10a))[_0xa2ba('0x26')](handleError(_0x2b1964,null));};exports['show']=function(_0x1c0e1e,_0x334ca8){var _0x3e09b7={'raw':!![],'where':{'id':_0x1c0e1e[_0xa2ba('0x27')]['id']}},_0x66cbce={};_0x66cbce['model']=_[_0xa2ba('0x28')](db[_0xa2ba('0x1f')]['rawAttributes']);_0x66cbce['query']=_[_0xa2ba('0x28')](_0x1c0e1e[_0xa2ba('0x24')]);_0x66cbce[_0xa2ba('0x29')]=_[_0xa2ba('0x2a')](_0x66cbce[_0xa2ba('0x2b')],_0x66cbce['query']);_0x3e09b7[_0xa2ba('0x2c')]=_['intersection'](_0x66cbce[_0xa2ba('0x2b')],qs[_0xa2ba('0x2d')](_0x1c0e1e[_0xa2ba('0x24')][_0xa2ba('0x2d')]));_0x3e09b7['attributes']=_0x3e09b7['attributes']['length']?_0x3e09b7[_0xa2ba('0x2c')]:_0x66cbce[_0xa2ba('0x2b')];if(_0x1c0e1e[_0xa2ba('0x24')][_0xa2ba('0x2e')]){_0x3e09b7[_0xa2ba('0x23')]=[{'all':!![]}];}_0x3e09b7=_[_0xa2ba('0x2f')]({},_0x3e09b7,_0x1c0e1e[_0xa2ba('0x30')]);return db[_0xa2ba('0x1f')][_0xa2ba('0x31')](_0x3e09b7)[_0xa2ba('0x18')](handleEntityNotFound(_0x334ca8,null))[_0xa2ba('0x18')](respondWithResult(_0x334ca8,null))[_0xa2ba('0x26')](handleError(_0x334ca8,null));};exports[_0xa2ba('0x32')]=function(_0x17181c,_0x4fcdd9){return db[_0xa2ba('0x1f')][_0xa2ba('0x32')](_0x17181c['body'],{})[_0xa2ba('0x18')](function(_0x5477a8){var _0x147af0=_0x17181c['user'][_0xa2ba('0x15')]({'plain':!![]});if(!_0x147af0)throw new Error(_0xa2ba('0x33'));if(_0x147af0[_0xa2ba('0x34')]===_0xa2ba('0x35')){var _0x8a13e3=_0x5477a8[_0xa2ba('0x15')]({'plain':!![]});var _0x3aa5e4='OpenchannelQueues';return db[_0xa2ba('0x36')]['find']({'where':{'name':_0x3aa5e4,'userProfileId':_0x147af0['userProfileId']},'raw':!![]})[_0xa2ba('0x18')](function(_0x595732){if(_0x595732&&_0x595732[_0xa2ba('0x37')]===0x0){return db['UserProfileResource'][_0xa2ba('0x32')]({'name':_0x8a13e3[_0xa2ba('0x1b')],'resourceId':_0x8a13e3['id'],'type':_0x595732[_0xa2ba('0x1b')],'sectionId':_0x595732['id']},{})['then'](function(){return _0x5477a8;});}else{return _0x5477a8;}})[_0xa2ba('0x26')](function(_0x343023){logger[_0xa2ba('0x19')](_0xa2ba('0x38'),_0x343023);throw _0x343023;});}return _0x5477a8;})['then'](respondWithResult(_0x4fcdd9,0xc9))[_0xa2ba('0x26')](handleError(_0x4fcdd9,null));};exports[_0xa2ba('0x39')]=function(_0x1b8a33,_0x1670a9){if(_0x1b8a33[_0xa2ba('0x3a')]['id']){delete _0x1b8a33[_0xa2ba('0x3a')]['id'];}return db[_0xa2ba('0x1f')][_0xa2ba('0x31')]({'where':{'id':_0x1b8a33[_0xa2ba('0x27')]['id']}})[_0xa2ba('0x18')](handleEntityNotFound(_0x1670a9,null))[_0xa2ba('0x18')](saveUpdates(_0x1b8a33['body'],null))['then'](respondWithResult(_0x1670a9,null))[_0xa2ba('0x26')](handleError(_0x1670a9,null));};exports[_0xa2ba('0x14')]=function(_0x599c49,_0x50bc08){return db['OpenchannelQueue'][_0xa2ba('0x31')]({'where':{'id':_0x599c49['params']['id']}})[_0xa2ba('0x18')](handleEntityNotFound(_0x50bc08,null))['then'](removeEntity(_0x50bc08,null))[_0xa2ba('0x26')](handleError(_0x50bc08,null));};exports[_0xa2ba('0x3b')]=function(_0x369784,_0x113af2){return db[_0xa2ba('0x1f')][_0xa2ba('0x3b')]()[_0xa2ba('0x18')](respondWithResult(_0x113af2,null))[_0xa2ba('0x26')](handleError(_0x113af2,null));};exports['getMembers']=function(_0x2a4311,_0x459a9e){var _0x3c7e48={'raw':!![],'where':{}},_0x3fcdeb={},_0x6bb03b;return db[_0xa2ba('0x1f')][_0xa2ba('0x3c')]({'where':{'id':_0x2a4311['params']['id']}})[_0xa2ba('0x18')](handleEntityNotFound(_0x459a9e,null))['then'](function(_0x1ca881){if(_0x1ca881){_0x6bb03b=_0x1ca881['get']({'plain':!![]});_0x3fcdeb[_0xa2ba('0x2b')]=_['keys'](db[_0xa2ba('0x3d')][_0xa2ba('0x20')]);_0x3fcdeb['query']=_[_0xa2ba('0x28')](_0x2a4311[_0xa2ba('0x24')]);_0x3fcdeb[_0xa2ba('0x29')]=_[_0xa2ba('0x2a')](_0x3fcdeb[_0xa2ba('0x2b')],_0x3fcdeb[_0xa2ba('0x24')]);_0x3c7e48['attributes']=_[_0xa2ba('0x2a')](_0x3fcdeb[_0xa2ba('0x2b')],qs[_0xa2ba('0x2d')](_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x2d')]));_0x3c7e48[_0xa2ba('0x2c')]=_0x3c7e48['attributes'][_0xa2ba('0x3e')]?_0x3c7e48[_0xa2ba('0x2c')]:_0x3fcdeb['model'];if(!_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x3f')](_0xa2ba('0x40'))){_0x3c7e48[_0xa2ba('0x11')]=qs[_0xa2ba('0x11')](_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x11')]);_0x3c7e48[_0xa2ba('0xf')]=qs['offset'](_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0xf')]);}_0x3c7e48[_0xa2ba('0x41')]=qs[_0xa2ba('0x42')](_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x42')]);_0x3c7e48[_0xa2ba('0x43')]=qs[_0xa2ba('0x29')](_[_0xa2ba('0x44')](_0x2a4311[_0xa2ba('0x24')],_0x3fcdeb[_0xa2ba('0x29')]));_0x3c7e48[_0xa2ba('0x43')][_0xa2ba('0x45')]=_0x1ca881['id'];if(_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x46')]){_0x3c7e48['where']=_[_0xa2ba('0x2f')](_0x3c7e48[_0xa2ba('0x43')],{'$or':_[_0xa2ba('0x1e')](_0x3c7e48[_0xa2ba('0x2c')],function(_0x24d424){var _0x245d1e={};_0x245d1e[_0x24d424]={'$like':'%'+_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x46')]+'%'};return _0x245d1e;})});}_0x3c7e48=_[_0xa2ba('0x2f')]({},_0x3c7e48,_0x2a4311[_0xa2ba('0x30')]);return db[_0xa2ba('0x3d')]['findAll'](_0x3c7e48);}})['then'](function(_0x45a4fd){if(_0x45a4fd){return db[_0xa2ba('0x47')][_0xa2ba('0x48')]({'where':{'id':_[_0xa2ba('0x1e')](_0x45a4fd,'UserId'),'role':_0xa2ba('0x49')},'attributes':['id','name',_0xa2ba('0x4a'),_0xa2ba('0x4b'),_0xa2ba('0x4c')]});}})[_0xa2ba('0x18')](function(_0x2f1949){if(_0x2f1949){return{'count':_0x2f1949[_0xa2ba('0x12')],'rows':_[_0xa2ba('0x1e')](_0x2f1949['rows'],function(_0x4aef2d){return{'membername':_0x4aef2d['name'],'UserId':_0x4aef2d['id'],'queue_name':_0x6bb03b['name'],'OpenchannelQueueId':_0x6bb03b['id'],'interface':util['format'](_0xa2ba('0x4d'),'SIP',_0x4aef2d[_0xa2ba('0x1b')]),'penalty':0x0,'paused':_0x4aef2d[_0xa2ba('0x4a')],'createdAt':_0x4aef2d[_0xa2ba('0x4c')],'updatedAt':_0x4aef2d[_0xa2ba('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa2ba('0x18')](respondWithFilteredResult(_0x459a9e,_0x3c7e48))[_0xa2ba('0x26')](handleError(_0x459a9e,null));};exports[_0xa2ba('0x4e')]=function(_0x5b0ff5,_0x21e8c7){var _0x283abc={};var _0x550fbb={};var _0x25a53a;var _0xae30ef;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5b0ff5[_0xa2ba('0x27')]['id']}})[_0xa2ba('0x18')](handleEntityNotFound(_0x21e8c7,null))[_0xa2ba('0x18')](function(_0xb886d6){if(_0xb886d6){_0x25a53a=_0xb886d6;_0x550fbb[_0xa2ba('0x2b')]=_[_0xa2ba('0x28')](db[_0xa2ba('0x4f')][_0xa2ba('0x20')]);_0x550fbb[_0xa2ba('0x24')]=_['keys'](_0x5b0ff5[_0xa2ba('0x24')]);_0x550fbb['filters']=_['intersection'](_0x550fbb['model'],_0x550fbb[_0xa2ba('0x24')]);_0x283abc[_0xa2ba('0x2c')]=_[_0xa2ba('0x2a')](_0x550fbb[_0xa2ba('0x2b')],qs[_0xa2ba('0x2d')](_0x5b0ff5['query'][_0xa2ba('0x2d')]));_0x283abc[_0xa2ba('0x2c')]=_0x283abc['attributes']['length']?_0x283abc['attributes']:_0x550fbb[_0xa2ba('0x2b')];_0x283abc[_0xa2ba('0x41')]=qs[_0xa2ba('0x42')](_0x5b0ff5[_0xa2ba('0x24')][_0xa2ba('0x42')]);_0x283abc[_0xa2ba('0x43')]=qs[_0xa2ba('0x29')](_[_0xa2ba('0x44')](_0x5b0ff5['query'],_0x550fbb[_0xa2ba('0x29')]));if(_0x5b0ff5['query'][_0xa2ba('0x46')]){_0x283abc[_0xa2ba('0x43')]=_['merge'](_0x283abc[_0xa2ba('0x43')],{'$or':_[_0xa2ba('0x1e')](_0x283abc[_0xa2ba('0x2c')],function(_0x58ccdd){var _0x465533={};_0x465533[_0x58ccdd]={'$like':'%'+_0x5b0ff5['query'][_0xa2ba('0x46')]+'%'};return _0x465533;})});}_0x283abc=_[_0xa2ba('0x2f')]({},_0x283abc,_0x5b0ff5[_0xa2ba('0x30')]);return _0x25a53a[_0xa2ba('0x4e')](_0x283abc);}})[_0xa2ba('0x18')](function(_0x24e8a5){if(_0x24e8a5){_0xae30ef=_0x24e8a5[_0xa2ba('0x3e')];if(!_0x5b0ff5[_0xa2ba('0x24')][_0xa2ba('0x3f')](_0xa2ba('0x40'))){_0x283abc[_0xa2ba('0x11')]=qs[_0xa2ba('0x11')](_0x5b0ff5['query'][_0xa2ba('0x11')]);_0x283abc[_0xa2ba('0xf')]=qs[_0xa2ba('0xf')](_0x5b0ff5[_0xa2ba('0x24')][_0xa2ba('0xf')]);}return _0x25a53a['getTeams'](_0x283abc);}})[_0xa2ba('0x18')](function(_0x27b0e9){if(_0x27b0e9){return _0x27b0e9?{'count':_0xae30ef,'rows':_0x27b0e9}:null;}})[_0xa2ba('0x18')](respondWithResult(_0x21e8c7,null))[_0xa2ba('0x26')](handleError(_0x21e8c7,null));};exports['addTeams']=function(_0x217c14,_0x30247f){var _0x1cf10f=_0x217c14[_0xa2ba('0x3a')][_0xa2ba('0x50')];return db[_0xa2ba('0x4f')][_0xa2ba('0x51')]({'where':{'id':_0x1cf10f},'attributes':['id'],'include':[{'model':db[_0xa2ba('0x47')],'as':_0xa2ba('0x52'),'attributes':['id',_0xa2ba('0x1b'),'online',_0xa2ba('0x53'),_0xa2ba('0x54')],'raw':!![]}]})[_0xa2ba('0x18')](function(_0x6a752){if(_0x6a752){var _0x3949c9=_[_0xa2ba('0x55')](_0x6a752,function(_0x28eafa){var _0x59317f=_0x28eafa[_0xa2ba('0x15')]({'plain':!![]});return _0x59317f[_0xa2ba('0x52')];});return db[_0xa2ba('0x1f')][_0xa2ba('0x31')]({'where':{'id':_0x217c14[_0xa2ba('0x27')]['id']}})['then'](function(_0x4ee093){return db['sequelize'][_0xa2ba('0x56')](function(_0xacc4c){return _0x4ee093[_0xa2ba('0x57')](_0x1cf10f,{'transaction':_0xacc4c})['then'](function(){return BPromise['each'](_0x3949c9,function(_0x59c82d){return db[_0xa2ba('0x3d')][_0xa2ba('0x58')]({'where':{'UserId':_0x59c82d['id'],'OpenchannelQueueId':_0x217c14[_0xa2ba('0x27')]['id']},'transaction':_0xacc4c});});})[_0xa2ba('0x18')](function(){_0x3949c9[_0xa2ba('0x59')](function(_0x490627){socket[_0xa2ba('0x5a')]('userOpenchannelQueue:save',{'UserId':_0x490627['id'],'OpenchannelQueueId':_0x4ee093['id']});});});});});}})['then'](respondWithStatusCode(_0x30247f,null))[_0xa2ba('0x26')](handleError(_0x30247f,null));};exports['removeTeams']=function(_0x4a9cb9,_0x3ab3d3){return db['Team'][_0xa2ba('0x51')]({'where':{'id':_0x4a9cb9[_0xa2ba('0x24')][_0xa2ba('0x50')]},'attributes':['id'],'include':[{'model':db[_0xa2ba('0x47')],'as':_0xa2ba('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3ab3d3,null))['then'](function(_0x264363){var _0x5e9135=_[_0xa2ba('0x1e')](_0x264363,'id');var _0x426c52=[];var _0x146a48=[];var _0x2ea015=squel['select']();_0x2ea015[_0xa2ba('0x5b')](_0xa2ba('0x5c'))[_0xa2ba('0x5d')](_0xa2ba('0x5e'),'tq')[_0xa2ba('0x5f')](_0xa2ba('0x60'),'ut',_0xa2ba('0x61'))[_0xa2ba('0x43')](_0xa2ba('0x62'),_0x4a9cb9[_0xa2ba('0x27')]['id']);for(var _0x466a52=0x0;_0x466a52<_0x264363[_0xa2ba('0x3e')];_0x466a52+=0x1){let _0x2d72a5=_0x264363[_0x466a52];for(var _0x36481a=0x0;_0x36481a<_0x2d72a5[_0xa2ba('0x52')][_0xa2ba('0x3e')];_0x36481a+=0x1){let _0x28cdcd=_0x2d72a5[_0xa2ba('0x52')][_0x36481a];var _0x4d010b=_0x2ea015['clone']();_0x4d010b[_0xa2ba('0x43')]('ut.UserId\x20=\x20?',_0x28cdcd['id']);_0x146a48[_0xa2ba('0x63')](db['sequelize'][_0xa2ba('0x24')](_0x4d010b['toString'](),{'type':db[_0xa2ba('0x64')][_0xa2ba('0x65')][_0xa2ba('0x66')]})[_0xa2ba('0x18')](function(_0x462def){if(_0x462def[_0xa2ba('0x3e')]===0x1){return _0x28cdcd['id'];}else{var _0x2a945d=_[_0xa2ba('0x67')](_[_0xa2ba('0x1e')](_0x462def,_0xa2ba('0x68')),function(_0x439a4f){return _[_0xa2ba('0x69')](_0x5e9135,_0x439a4f);});if(_0x2a945d){return _0x28cdcd['id'];}}}));}}return BPromise['all'](_0x146a48)[_0xa2ba('0x18')](function(_0x2edbac){_0x426c52=_(_0x426c52)[_0xa2ba('0x6a')](_0x2edbac)[_0xa2ba('0x6b')]()[_0xa2ba('0x6c')]();return db['OpenchannelQueue'][_0xa2ba('0x31')]({'where':{'id':_0x4a9cb9[_0xa2ba('0x27')]['id']}})['then'](function(_0x5b507e){return db[_0xa2ba('0x64')][_0xa2ba('0x56')](function(_0x280589){return _0x5b507e[_0xa2ba('0x6d')](_0x4a9cb9[_0xa2ba('0x24')][_0xa2ba('0x50')],{'transaction':_0x280589})[_0xa2ba('0x18')](function(){if(!_[_0xa2ba('0x6e')](_0x426c52)){return _0x5b507e['removeAgents'](_0x426c52,{'transaction':_0x280589});}})['then'](function(){_0x426c52[_0xa2ba('0x59')](function(_0x46f61b){socket['emit'](_0xa2ba('0x6f'),{'UserId':_0x46f61b,'OpenchannelQueueId':_0x5b507e['id']});});});});});});})['then'](respondWithStatusCode(_0x3ab3d3,null))[_0xa2ba('0x26')](handleError(_0x3ab3d3,null));};exports[_0xa2ba('0x70')]=function(_0x5a8795,_0x1df31c){return db[_0xa2ba('0x1f')]['find']({'where':{'id':_0x5a8795[_0xa2ba('0x27')]['id']}})[_0xa2ba('0x18')](handleEntityNotFound(_0x1df31c,null))[_0xa2ba('0x18')](function(_0x57cb05){if(_0x57cb05){return _0x57cb05[_0xa2ba('0x70')](_0x5a8795[_0xa2ba('0x3a')][_0xa2ba('0x50')],_['omit'](_0x5a8795['body'],['ids','id'])||{})[_0xa2ba('0x71')](function(_0x5b2e77){for(var _0x3392d7=0x0;_0x3392d7<_0x5a8795['body'][_0xa2ba('0x50')][_0xa2ba('0x3e')];_0x3392d7+=0x1){socket[_0xa2ba('0x5a')](_0xa2ba('0x72'),{'UserId':Number(_0x5a8795[_0xa2ba('0x3a')][_0xa2ba('0x50')][_0x3392d7]),'OpenchannelQueueId':Number(_0x5a8795[_0xa2ba('0x27')]['id'])});}return _0x5b2e77;});}})['then'](respondWithResult(_0x1df31c,null))['catch'](handleError(_0x1df31c,null));};exports['removeAgents']=function(_0x1cdc0b,_0x158773){return db[_0xa2ba('0x1f')][_0xa2ba('0x31')]({'where':{'id':_0x1cdc0b[_0xa2ba('0x27')]['id']}})['then'](handleEntityNotFound(_0x158773,null))[_0xa2ba('0x18')](function(_0x23893a){if(_0x23893a){return _0x23893a[_0xa2ba('0x73')](_0x1cdc0b[_0xa2ba('0x24')]['ids'])[_0xa2ba('0x18')](function(){if(_[_0xa2ba('0x74')](_0x1cdc0b[_0xa2ba('0x24')][_0xa2ba('0x50')])){for(var _0x3e69bf=0x0;_0x3e69bf<_0x1cdc0b[_0xa2ba('0x24')][_0xa2ba('0x50')][_0xa2ba('0x3e')];_0x3e69bf+=0x1){socket[_0xa2ba('0x5a')](_0xa2ba('0x6f'),{'UserId':Number(_0x1cdc0b[_0xa2ba('0x24')][_0xa2ba('0x50')][_0x3e69bf]),'OpenchannelQueueId':Number(_0x1cdc0b[_0xa2ba('0x27')]['id'])});}}else{socket['emit'](_0xa2ba('0x6f'),{'UserId':Number(_0x1cdc0b[_0xa2ba('0x24')]['ids']),'OpenchannelQueueId':Number(_0x1cdc0b[_0xa2ba('0x27')]['id'])});}});}})[_0xa2ba('0x18')](respondWithStatusCode(_0x158773,null))[_0xa2ba('0x26')](handleError(_0x158773,null));};exports[_0xa2ba('0x75')]=function(_0x1caabc,_0x185f82){var _0x7ce59={};var _0x322556={};var _0x360b74;var _0x436424;return db[_0xa2ba('0x1f')][_0xa2ba('0x3c')]({'where':{'id':_0x1caabc[_0xa2ba('0x27')]['id']}})['then'](handleEntityNotFound(_0x185f82,null))[_0xa2ba('0x18')](function(_0x446f49){if(_0x446f49){_0x360b74=_0x446f49;_0x322556[_0xa2ba('0x2b')]=_['keys'](db[_0xa2ba('0x47')][_0xa2ba('0x20')]);_0x322556[_0xa2ba('0x24')]=_[_0xa2ba('0x28')](_0x1caabc[_0xa2ba('0x24')]);_0x322556[_0xa2ba('0x29')]=_[_0xa2ba('0x2a')](_0x322556[_0xa2ba('0x2b')],_0x322556[_0xa2ba('0x24')]);_0x7ce59[_0xa2ba('0x2c')]=_[_0xa2ba('0x2a')](_0x322556['model'],qs[_0xa2ba('0x2d')](_0x1caabc[_0xa2ba('0x24')][_0xa2ba('0x2d')]));_0x7ce59[_0xa2ba('0x2c')]=_0x7ce59[_0xa2ba('0x2c')]['length']?_0x7ce59['attributes']:_0x322556['model'];_0x7ce59[_0xa2ba('0x41')]=qs[_0xa2ba('0x42')](_0x1caabc['query'][_0xa2ba('0x42')]);_0x7ce59[_0xa2ba('0x43')]=qs[_0xa2ba('0x29')](_[_0xa2ba('0x44')](_0x1caabc['query'],_0x322556[_0xa2ba('0x29')]));if(_0x1caabc[_0xa2ba('0x24')][_0xa2ba('0x46')]){_0x7ce59[_0xa2ba('0x43')]=_[_0xa2ba('0x2f')](_0x7ce59[_0xa2ba('0x43')],{'$or':_[_0xa2ba('0x1e')](_0x7ce59[_0xa2ba('0x2c')],function(_0xefd8f3){var _0x3ad193={};_0x3ad193[_0xefd8f3]={'$like':'%'+_0x1caabc['query'][_0xa2ba('0x46')]+'%'};return _0x3ad193;})});}_0x7ce59=_[_0xa2ba('0x2f')]({},_0x7ce59,_0x1caabc[_0xa2ba('0x30')]);return _0x360b74[_0xa2ba('0x75')](_0x7ce59);}})['then'](function(_0x3d04c7){if(_0x3d04c7){_0x436424=_0x3d04c7[_0xa2ba('0x3e')];if(!_0x1caabc[_0xa2ba('0x24')][_0xa2ba('0x3f')](_0xa2ba('0x40'))){_0x7ce59[_0xa2ba('0x11')]=qs[_0xa2ba('0x11')](_0x1caabc[_0xa2ba('0x24')]['limit']);_0x7ce59['offset']=qs[_0xa2ba('0xf')](_0x1caabc['query'][_0xa2ba('0xf')]);}return _0x360b74[_0xa2ba('0x75')](_0x7ce59);}})['then'](function(_0x358d7e){if(_0x358d7e){return _0x358d7e?{'count':_0x436424,'rows':_0x358d7e}:null;}})[_0xa2ba('0x18')](respondWithResult(_0x185f82,null))[_0xa2ba('0x26')](handleError(_0x185f82,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 0796488..bcc074f 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 _0x9e48=['save','update','remove','emit','hasOwnProperty','hook','setMaxListeners'];(function(_0x2e1678,_0x5449a6){var _0x204874=function(_0x5917a3){while(--_0x5917a3){_0x2e1678['push'](_0x2e1678['shift']());}};_0x204874(++_0x5449a6);}(_0x9e48,0x179));var _0x89e4=function(_0x5e9ae0,_0x16b4bb){_0x5e9ae0=_0x5e9ae0-0x0;var _0x204d50=_0x9e48[_0x5e9ae0];return _0x204d50;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x89e4('0x0')](0x0);var events={'afterCreate':_0x89e4('0x1'),'afterUpdate':_0x89e4('0x2'),'afterDestroy':_0x89e4('0x3')};function emitEvent(_0xf897ce){return function(_0x564c3f,_0x1a3f45,_0xe644){OpenchannelQueueEvents['emit'](_0xf897ce+':'+_0x564c3f['id'],_0x564c3f);OpenchannelQueueEvents[_0x89e4('0x4')](_0xf897ce,_0x564c3f);_0xe644(null);};}for(var e in events){if(events[_0x89e4('0x5')](e)){var event=events[e];OpenchannelQueue[_0x89e4('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x33aa=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x267d29,_0x27f1fe){var _0x4cd7c9=function(_0x4526d4){while(--_0x4526d4){_0x267d29['push'](_0x267d29['shift']());}};_0x4cd7c9(++_0x27f1fe);}(_0x33aa,0x18d));var _0xa33a=function(_0x2c6fa1,_0x288773){_0x2c6fa1=_0x2c6fa1-0x0;var _0x3a0f72=_0x33aa[_0x2c6fa1];return _0x3a0f72;};'use strict';var EventEmitter=require(_0xa33a('0x0'));var OpenchannelQueue=require(_0xa33a('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa33a('0x2')](0x0);var events={'afterCreate':_0xa33a('0x3'),'afterUpdate':_0xa33a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c2e08){return function(_0x3f94c2,_0x9162d9,_0x442cfd){OpenchannelQueueEvents[_0xa33a('0x5')](_0x2c2e08+':'+_0x3f94c2['id'],_0x3f94c2);OpenchannelQueueEvents[_0xa33a('0x5')](_0x2c2e08,_0x3f94c2);_0x442cfd(null);};}for(var e in events){if(events[_0xa33a('0x6')](e)){var event=events[e];OpenchannelQueue[_0xa33a('0x7')](e,emitEvent(event));}}module[_0xa33a('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 1318ad5..056651c 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 _0xd7c6=['../../config/logger','api','moment','bluebird','path','rimraf','define','openchannel_queues','util'];(function(_0x469cb7,_0x59abad){var _0x5cf520=function(_0x1c82d7){while(--_0x1c82d7){_0x469cb7['push'](_0x469cb7['shift']());}};_0x5cf520(++_0x59abad);}(_0xd7c6,0x11f));var _0x6d7c=function(_0x4c9e80,_0x123e17){_0x4c9e80=_0x4c9e80-0x0;var _0x1512c8=_0xd7c6[_0x4c9e80];return _0x1512c8;};'use strict';var _=require('lodash');var util=require(_0x6d7c('0x0'));var logger=require(_0x6d7c('0x1'))(_0x6d7c('0x2'));var moment=require(_0x6d7c('0x3'));var BPromise=require(_0x6d7c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d7c('0x5'));var rimraf=require(_0x6d7c('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x14d051,_0x41b5e8){return _0x14d051[_0x6d7c('0x7')]('OpenchannelQueue',attributes,{'tableName':_0x6d7c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41c9=['rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','../../config/logger','moment','request-promise','path'];(function(_0x4783a4,_0x5850ad){var _0x48be62=function(_0x369583){while(--_0x369583){_0x4783a4['push'](_0x4783a4['shift']());}};_0x48be62(++_0x5850ad);}(_0x41c9,0xc2));var _0x941c=function(_0x156699,_0x2d2351){_0x156699=_0x156699-0x0;var _0x50d475=_0x41c9[_0x156699];return _0x50d475;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x941c('0x0'))('api');var moment=require(_0x941c('0x1'));var BPromise=require('bluebird');var rp=require(_0x941c('0x2'));var fs=require('fs');var path=require(_0x941c('0x3'));var rimraf=require(_0x941c('0x4'));var config=require(_0x941c('0x5'));var attributes=require(_0x941c('0x6'));module[_0x941c('0x7')]=function(_0x2bb6ac,_0x557d6f){return _0x2bb6ac[_0x941c('0x8')](_0x941c('0x9'),attributes,{'tableName':_0x941c('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 788c1b7..21f02f6 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 _0x9e43=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetOpenchannelQueue','findAll','options','raw','attributes','limit','map','include','model','ShowOpenchannelQueue','OpenchannelQueue','where','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3147ea,_0x474e48){var _0x4e712a=function(_0x22f629){while(--_0x22f629){_0x3147ea['push'](_0x3147ea['shift']());}};_0x4e712a(++_0x474e48);}(_0x9e43,0x1e5));var _0x39e4=function(_0x10d6f2,_0x18ae62){_0x10d6f2=_0x10d6f2-0x0;var _0x59e5c7=_0x9e43[_0x10d6f2];return _0x59e5c7;};'use strict';var _=require(_0x39e4('0x0'));var util=require(_0x39e4('0x1'));var moment=require(_0x39e4('0x2'));var BPromise=require(_0x39e4('0x3'));var rs=require(_0x39e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39e4('0x5'))['db'];var utils=require(_0x39e4('0x6'));var logger=require('../../config/logger')(_0x39e4('0x7'));var config=require(_0x39e4('0x8'));var jayson=require(_0x39e4('0x9'));var client=jayson[_0x39e4('0xa')][_0x39e4('0xb')]({'port':0x232a});config[_0x39e4('0xc')]=_['defaults'](config[_0x39e4('0xc')],{'host':_0x39e4('0xd'),'port':0x18eb});var socket=require(_0x39e4('0xe'))(new Redis(config['redis']));require(_0x39e4('0xf'))[_0x39e4('0x10')](socket);function respondWithRpcPromise(_0x31843a,_0x455a43,_0x37579b){return new BPromise(function(_0x57c9d5,_0x1fc742){return client[_0x39e4('0x11')](_0x31843a,_0x37579b)[_0x39e4('0x12')](function(_0xe48c78){logger[_0x39e4('0x13')](_0x39e4('0x14'),_0x455a43,'request\x20sent');logger[_0x39e4('0x15')](_0x39e4('0x16'),_0x455a43,_0x39e4('0x17'),JSON[_0x39e4('0x18')](_0xe48c78));if(_0xe48c78[_0x39e4('0x19')]){if(_0xe48c78[_0x39e4('0x19')]['code']===0x1f4){logger[_0x39e4('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x455a43,_0xe48c78['error']['message']);return _0x1fc742(_0xe48c78[_0x39e4('0x19')]['message']);}logger[_0x39e4('0x19')](_0x39e4('0x14'),_0x455a43,_0xe48c78[_0x39e4('0x19')][_0x39e4('0x1a')]);return _0x57c9d5(_0xe48c78[_0x39e4('0x19')][_0x39e4('0x1a')]);}else{logger['info'](_0x39e4('0x14'),_0x455a43,_0x39e4('0x17'));_0x57c9d5(_0xe48c78[_0x39e4('0x1b')][_0x39e4('0x1a')]);}})['catch'](function(_0x3b717c){logger[_0x39e4('0x19')](_0x39e4('0x14'),_0x455a43,_0x3b717c);_0x1fc742(_0x3b717c);});});}exports[_0x39e4('0x1c')]=function(_0x53980f){var _0x5de964=this;return new Promise(function(_0x3a4b39,_0x2f0d08){return db['OpenchannelQueue'][_0x39e4('0x1d')]({'raw':_0x53980f['options']?_0x53980f[_0x39e4('0x1e')][_0x39e4('0x1f')]===undefined?!![]:![]:!![],'where':_0x53980f[_0x39e4('0x1e')]?_0x53980f[_0x39e4('0x1e')]['where']||null:null,'attributes':_0x53980f['options']?_0x53980f[_0x39e4('0x1e')][_0x39e4('0x20')]||null:null,'limit':_0x53980f[_0x39e4('0x1e')]?_0x53980f[_0x39e4('0x1e')][_0x39e4('0x21')]||null:null,'include':_0x53980f[_0x39e4('0x1e')]?_0x53980f[_0x39e4('0x1e')]['include']?_[_0x39e4('0x22')](_0x53980f[_0x39e4('0x1e')][_0x39e4('0x23')],function(_0x4d00d5){return{'model':db[_0x4d00d5[_0x39e4('0x24')]],'as':_0x4d00d5['as'],'attributes':_0x4d00d5[_0x39e4('0x20')],'include':_0x4d00d5[_0x39e4('0x23')]?_[_0x39e4('0x22')](_0x4d00d5['include'],function(_0x35ff03){return{'model':db[_0x35ff03[_0x39e4('0x24')]],'as':_0x35ff03['as'],'attributes':_0x35ff03[_0x39e4('0x20')],'include':_0x35ff03[_0x39e4('0x23')]?_[_0x39e4('0x22')](_0x35ff03[_0x39e4('0x23')],function(_0x3e103d){return{'model':db[_0x3e103d['model']],'as':_0x3e103d['as'],'attributes':_0x3e103d[_0x39e4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x39e4('0x12')](function(_0x3a9b76){logger[_0x39e4('0x13')](_0x39e4('0x1c'),_0x53980f);logger['debug'](_0x39e4('0x1c'),_0x53980f,JSON['stringify'](_0x3a9b76));_0x3a4b39(_0x3a9b76);})['catch'](function(_0x5d9e27){logger[_0x39e4('0x19')](_0x39e4('0x1c'),_0x5d9e27[_0x39e4('0x1a')],_0x53980f);_0x2f0d08(_0x5de964['error'](0x1f4,_0x5d9e27[_0x39e4('0x1a')]));});});};exports[_0x39e4('0x25')]=function(_0x2dd90a){var _0x358e53=this;return new Promise(function(_0x238d7a,_0xf17765){return db[_0x39e4('0x26')]['find']({'raw':_0x2dd90a[_0x39e4('0x1e')]?_0x2dd90a[_0x39e4('0x1e')][_0x39e4('0x1f')]===undefined?!![]:![]:!![],'where':_0x2dd90a[_0x39e4('0x1e')]?_0x2dd90a['options'][_0x39e4('0x27')]||null:null,'attributes':_0x2dd90a[_0x39e4('0x1e')]?_0x2dd90a[_0x39e4('0x1e')][_0x39e4('0x20')]||null:null,'include':_0x2dd90a[_0x39e4('0x1e')]?_0x2dd90a[_0x39e4('0x1e')][_0x39e4('0x23')]?_[_0x39e4('0x22')](_0x2dd90a[_0x39e4('0x1e')][_0x39e4('0x23')],function(_0x36f451){return{'model':db[_0x36f451['model']],'as':_0x36f451['as'],'attributes':_0x36f451['attributes'],'include':_0x36f451[_0x39e4('0x23')]?_[_0x39e4('0x22')](_0x36f451['include'],function(_0x19bc7d){return{'model':db[_0x19bc7d[_0x39e4('0x24')]],'as':_0x19bc7d['as'],'attributes':_0x19bc7d[_0x39e4('0x20')],'include':_0x19bc7d[_0x39e4('0x23')]?_[_0x39e4('0x22')](_0x19bc7d[_0x39e4('0x23')],function(_0x41b2a1){return{'model':db[_0x41b2a1['model']],'as':_0x41b2a1['as'],'attributes':_0x41b2a1[_0x39e4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x39e4('0x12')](function(_0x1be43b){logger['info'](_0x39e4('0x25'),_0x2dd90a);logger['debug'](_0x39e4('0x25'),_0x2dd90a,JSON[_0x39e4('0x18')](_0x1be43b));_0x238d7a(_0x1be43b);})[_0x39e4('0x28')](function(_0x525cc6){logger[_0x39e4('0x19')](_0x39e4('0x25'),_0x525cc6[_0x39e4('0x1a')],_0x2dd90a);_0xf17765(_0x358e53['error'](0x1f4,_0x525cc6[_0x39e4('0x1a')]));});});}; \ No newline at end of file +var _0x9c45=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','findAll','options','where','limit','include','map','attributes','model','stringify','find','raw','ShowOpenchannelQueue','util','ioredis'];(function(_0x2d94f6,_0x12b913){var _0x4c0f45=function(_0x4cc7ea){while(--_0x4cc7ea){_0x2d94f6['push'](_0x2d94f6['shift']());}};_0x4c0f45(++_0x12b913);}(_0x9c45,0x101));var _0x59c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c45[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x59c4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59c4('0x1'));var db=require(_0x59c4('0x2'))['db'];var utils=require(_0x59c4('0x3'));var logger=require(_0x59c4('0x4'))(_0x59c4('0x5'));var config=require(_0x59c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x59c4('0x7')][_0x59c4('0x8')]({'port':0x232a});config[_0x59c4('0x9')]=_[_0x59c4('0xa')](config[_0x59c4('0x9')],{'host':_0x59c4('0xb'),'port':0x18eb});var socket=require(_0x59c4('0xc'))(new Redis(config[_0x59c4('0x9')]));require('./openchannelQueue.socket')[_0x59c4('0xd')](socket);function respondWithRpcPromise(_0x19114b,_0x905af2,_0x581b45){return new BPromise(function(_0x508392,_0x4b341d){return client['request'](_0x19114b,_0x581b45)[_0x59c4('0xe')](function(_0x35f571){logger[_0x59c4('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x905af2,_0x59c4('0x10'));logger[_0x59c4('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x905af2,'request\x20sent',JSON['stringify'](_0x35f571));if(_0x35f571[_0x59c4('0x12')]){if(_0x35f571[_0x59c4('0x12')][_0x59c4('0x13')]===0x1f4){logger[_0x59c4('0x12')](_0x59c4('0x14'),_0x905af2,_0x35f571[_0x59c4('0x12')][_0x59c4('0x15')]);return _0x4b341d(_0x35f571[_0x59c4('0x12')][_0x59c4('0x15')]);}logger[_0x59c4('0x12')](_0x59c4('0x14'),_0x905af2,_0x35f571['error']['message']);return _0x508392(_0x35f571['error'][_0x59c4('0x15')]);}else{logger[_0x59c4('0xf')](_0x59c4('0x14'),_0x905af2,_0x59c4('0x10'));_0x508392(_0x35f571[_0x59c4('0x16')]['message']);}})[_0x59c4('0x17')](function(_0x57dbad){logger[_0x59c4('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x905af2,_0x57dbad);_0x4b341d(_0x57dbad);});});}exports[_0x59c4('0x18')]=function(_0x5b1d94){var _0x2b1159=this;return new Promise(function(_0x232472,_0x12e159){return db['OpenchannelQueue'][_0x59c4('0x19')]({'raw':_0x5b1d94[_0x59c4('0x1a')]?_0x5b1d94[_0x59c4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5b1d94[_0x59c4('0x1a')]?_0x5b1d94['options'][_0x59c4('0x1b')]||null:null,'attributes':_0x5b1d94['options']?_0x5b1d94[_0x59c4('0x1a')]['attributes']||null:null,'limit':_0x5b1d94[_0x59c4('0x1a')]?_0x5b1d94[_0x59c4('0x1a')][_0x59c4('0x1c')]||null:null,'include':_0x5b1d94['options']?_0x5b1d94[_0x59c4('0x1a')][_0x59c4('0x1d')]?_[_0x59c4('0x1e')](_0x5b1d94[_0x59c4('0x1a')]['include'],function(_0x5e2611){return{'model':db[_0x5e2611['model']],'as':_0x5e2611['as'],'attributes':_0x5e2611[_0x59c4('0x1f')],'include':_0x5e2611[_0x59c4('0x1d')]?_['map'](_0x5e2611[_0x59c4('0x1d')],function(_0x1a1def){return{'model':db[_0x1a1def[_0x59c4('0x20')]],'as':_0x1a1def['as'],'attributes':_0x1a1def[_0x59c4('0x1f')],'include':_0x1a1def[_0x59c4('0x1d')]?_['map'](_0x1a1def[_0x59c4('0x1d')],function(_0x5a8c5a){return{'model':db[_0x5a8c5a[_0x59c4('0x20')]],'as':_0x5a8c5a['as'],'attributes':_0x5a8c5a[_0x59c4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x59c4('0xe')](function(_0x35a269){logger[_0x59c4('0xf')](_0x59c4('0x18'),_0x5b1d94);logger[_0x59c4('0x11')]('GetOpenchannelQueue',_0x5b1d94,JSON[_0x59c4('0x21')](_0x35a269));_0x232472(_0x35a269);})[_0x59c4('0x17')](function(_0x158515){logger[_0x59c4('0x12')](_0x59c4('0x18'),_0x158515[_0x59c4('0x15')],_0x5b1d94);_0x12e159(_0x2b1159[_0x59c4('0x12')](0x1f4,_0x158515[_0x59c4('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x4630bc){var _0x402950=this;return new Promise(function(_0x267bc9,_0x508535){return db['OpenchannelQueue'][_0x59c4('0x22')]({'raw':_0x4630bc['options']?_0x4630bc[_0x59c4('0x1a')][_0x59c4('0x23')]===undefined?!![]:![]:!![],'where':_0x4630bc[_0x59c4('0x1a')]?_0x4630bc[_0x59c4('0x1a')][_0x59c4('0x1b')]||null:null,'attributes':_0x4630bc[_0x59c4('0x1a')]?_0x4630bc[_0x59c4('0x1a')][_0x59c4('0x1f')]||null:null,'include':_0x4630bc[_0x59c4('0x1a')]?_0x4630bc[_0x59c4('0x1a')][_0x59c4('0x1d')]?_[_0x59c4('0x1e')](_0x4630bc['options'][_0x59c4('0x1d')],function(_0x192141){return{'model':db[_0x192141['model']],'as':_0x192141['as'],'attributes':_0x192141[_0x59c4('0x1f')],'include':_0x192141[_0x59c4('0x1d')]?_[_0x59c4('0x1e')](_0x192141['include'],function(_0x113e83){return{'model':db[_0x113e83['model']],'as':_0x113e83['as'],'attributes':_0x113e83[_0x59c4('0x1f')],'include':_0x113e83[_0x59c4('0x1d')]?_[_0x59c4('0x1e')](_0x113e83[_0x59c4('0x1d')],function(_0x5f52fe){return{'model':db[_0x5f52fe['model']],'as':_0x5f52fe['as'],'attributes':_0x5f52fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x59c4('0xe')](function(_0xeaa69e){logger['info'](_0x59c4('0x24'),_0x4630bc);logger[_0x59c4('0x11')]('ShowOpenchannelQueue',_0x4630bc,JSON[_0x59c4('0x21')](_0xeaa69e));_0x267bc9(_0xeaa69e);})[_0x59c4('0x17')](function(_0xa03c13){logger[_0x59c4('0x12')](_0x59c4('0x24'),_0xa03c13[_0x59c4('0x15')],_0x4630bc);_0x508535(_0x402950['error'](0x1f4,_0xa03c13[_0x59c4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 2e9163f..6edfc3f 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 _0x0738=['./openchannelQueue.events','remove','emit','removeListener','length','openchannelQueue:'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x0738,0x192));var _0x8073=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x0738[_0x411017];return _0x2adeea;};'use strict';var OpenchannelQueueEvents=require(_0x8073('0x0'));var events=['save',_0x8073('0x1'),'update'];function createListener(_0x5f458c,_0x11e92d){return function(_0x51833d){_0x11e92d[_0x8073('0x2')](_0x5f458c,_0x51833d);};}function removeListener(_0x51f9ab,_0x4cee04){return function(){OpenchannelQueueEvents[_0x8073('0x3')](_0x51f9ab,_0x4cee04);};}exports['register']=function(_0x17e671){for(var _0x127464=0x0,_0x46564a=events[_0x8073('0x4')];_0x127464<_0x46564a;_0x127464++){var _0x2146be=events[_0x127464];var _0x2c7abf=createListener(_0x8073('0x5')+_0x2146be,_0x17e671);OpenchannelQueueEvents['on'](_0x2146be,_0x2c7abf);}}; \ No newline at end of file +var _0x9ab1=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9ab1,0x16b));var _0x19ab=function(_0x26c51c,_0x3d0b32){_0x26c51c=_0x26c51c-0x0;var _0x4285d3=_0x9ab1[_0x26c51c];return _0x4285d3;};'use strict';var OpenchannelQueueEvents=require(_0x19ab('0x0'));var events=[_0x19ab('0x1'),_0x19ab('0x2'),_0x19ab('0x3')];function createListener(_0x4e1e13,_0x5ad849){return function(_0x36169d){_0x5ad849[_0x19ab('0x4')](_0x4e1e13,_0x36169d);};}function removeListener(_0x4b6c8e,_0x1dce64){return function(){OpenchannelQueueEvents['removeListener'](_0x4b6c8e,_0x1dce64);};}exports[_0x19ab('0x5')]=function(_0x2608f3){for(var _0x297c10=0x0,_0x1e43da=events[_0x19ab('0x6')];_0x297c10<_0x1e43da;_0x297c10++){var _0x4d29be=events[_0x297c10];var _0x36ef19=createListener(_0x19ab('0x7')+_0x4d29be,_0x2608f3);OpenchannelQueueEvents['on'](_0x4d29be,_0x36ef19);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 94cff58..eab71ad 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 _0xe8b5=['get','/describe','describe','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller'];(function(_0x276221,_0x378da4){var _0x4fa716=function(_0x4dd561){while(--_0x4dd561){_0x276221['push'](_0x276221['shift']());}};_0x4fa716(++_0x378da4);}(_0xe8b5,0x198));var _0x5e8b=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0xe8b5[_0x503cd5];return _0x1fdf1e;};'use strict';var multer=require(_0x5e8b('0x0'));var util=require(_0x5e8b('0x1'));var path=require(_0x5e8b('0x2'));var timeout=require('connect-timeout');var express=require(_0x5e8b('0x3'));var router=express[_0x5e8b('0x4')]();var fs_extra=require(_0x5e8b('0x5'));var auth=require(_0x5e8b('0x6'));var interaction=require(_0x5e8b('0x7'));var config=require(_0x5e8b('0x8'));var controller=require(_0x5e8b('0x9'));router[_0x5e8b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5e8b('0xa')](_0x5e8b('0xb'),auth['isAuthenticated'](),controller[_0x5e8b('0xc')]);router[_0x5e8b('0xa')]('/:id',auth[_0x5e8b('0xd')](),controller[_0x5e8b('0xe')]);router[_0x5e8b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5e8b('0x10')](_0x5e8b('0x11'),auth[_0x5e8b('0xd')](),controller[_0x5e8b('0x12')]);router[_0x5e8b('0x13')](_0x5e8b('0x11'),auth[_0x5e8b('0xd')](),controller[_0x5e8b('0x14')]);module[_0x5e8b('0x15')]=router; \ No newline at end of file +var _0x5623=['isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','index','get','/describe'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5623,0x181));var _0x3562=function(_0x5b0d70,_0x3d5e33){_0x5b0d70=_0x5b0d70-0x0;var _0x5b3eb9=_0x5623[_0x5b0d70];return _0x5b3eb9;};'use strict';var multer=require(_0x3562('0x0'));var util=require('util');var path=require(_0x3562('0x1'));var timeout=require(_0x3562('0x2'));var express=require(_0x3562('0x3'));var router=express[_0x3562('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3562('0x5'));var interaction=require(_0x3562('0x6'));var config=require('../../config/environment');var controller=require(_0x3562('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3562('0x8')]);router[_0x3562('0x9')](_0x3562('0xa'),auth[_0x3562('0xb')](),controller[_0x3562('0xc')]);router['get'](_0x3562('0xd'),auth[_0x3562('0xb')](),controller[_0x3562('0xe')]);router[_0x3562('0xf')]('/',auth[_0x3562('0xb')](),controller[_0x3562('0x10')]);router[_0x3562('0x11')](_0x3562('0xd'),auth[_0x3562('0xb')](),controller[_0x3562('0x12')]);router[_0x3562('0x13')](_0x3562('0xd'),auth['isAuthenticated'](),controller[_0x3562('0x14')]);module[_0x3562('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ec04c87..a90c3bc 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 _0xc6b1=['DATE','moment','exports','STRING'];(function(_0x5a666e,_0x34008a){var _0x25aab6=function(_0x4ca179){while(--_0x4ca179){_0x5a666e['push'](_0x5a666e['shift']());}};_0x25aab6(++_0x34008a);}(_0xc6b1,0x1a5));var _0x1c6b=function(_0x270a05,_0x2ee3a5){_0x270a05=_0x270a05-0x0;var _0x494a55=_0xc6b1[_0x270a05];return _0x494a55;};'use strict';var moment=require(_0x1c6b('0x0'));var Sequelize=require('sequelize');module[_0x1c6b('0x1')]={'uniqueid':{'type':Sequelize[_0x1c6b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1c6b('0x2')]},'joinAt':{'type':Sequelize[_0x1c6b('0x3')]},'leaveAt':{'type':Sequelize[_0x1c6b('0x3')]},'acceptAt':{'type':Sequelize[_0x1c6b('0x3')]},'exitAt':{'type':Sequelize[_0x1c6b('0x3')]},'reason':{'type':Sequelize[_0x1c6b('0x2')]}}; \ No newline at end of file +var _0x9b78=['STRING','DATE','moment','sequelize','exports'];(function(_0x5b5684,_0x525ccb){var _0x1bf041=function(_0x2df3e4){while(--_0x2df3e4){_0x5b5684['push'](_0x5b5684['shift']());}};_0x1bf041(++_0x525ccb);}(_0x9b78,0x66));var _0x89b7=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0x9b78[_0x56756b];return _0xa3002;};'use strict';var moment=require(_0x89b7('0x0'));var Sequelize=require(_0x89b7('0x1'));module[_0x89b7('0x2')]={'uniqueid':{'type':Sequelize[_0x89b7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x89b7('0x3')]},'joinAt':{'type':Sequelize[_0x89b7('0x4')]},'leaveAt':{'type':Sequelize[_0x89b7('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x89b7('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 7297056..8a36f88 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 _0x875a=['name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','OpenchannelQueueReport','rows','catch','show','rawAttributes','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0xd06c50,_0xebced3){var _0x4f5db2=function(_0x30d406){while(--_0x30d406){_0xd06c50['push'](_0xd06c50['shift']());}};_0x4f5db2(++_0xebced3);}(_0x875a,0xbe));var _0xa875=function(_0x531e86,_0x5d7305){_0x531e86=_0x531e86-0x0;var _0x5a640a=_0x875a[_0x531e86];return _0x5a640a;};'use strict';var emlformat=require(_0xa875('0x0'));var rimraf=require(_0xa875('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa875('0x2'));var rp=require(_0xa875('0x3'));var moment=require(_0xa875('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa875('0x5'));var util=require(_0xa875('0x6'));var path=require(_0xa875('0x7'));var sox=require(_0xa875('0x8'));var csv=require(_0xa875('0x9'));var ejs=require(_0xa875('0xa'));var fs=require('fs');var fs_extra=require(_0xa875('0xb'));var _=require(_0xa875('0xc'));var squel=require(_0xa875('0xd'));var crypto=require(_0xa875('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa875('0xf'));var toCsv=require(_0xa875('0x9'));var querystring=require(_0xa875('0x10'));var Papa=require(_0xa875('0x11'));var Redis=require(_0xa875('0x12'));var authService=require(_0xa875('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa875('0x14'));var hardwareService=require(_0xa875('0x15'));var logger=require(_0xa875('0x16'))(_0xa875('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa875('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x220e54,_0x31a4ed){_0x31a4ed=_0x31a4ed||0xcc;return function(_0x51149f){if(_0x51149f){return _0x220e54[_0xa875('0x19')](_0x31a4ed);}return _0x220e54[_0xa875('0x1a')](_0x31a4ed)[_0xa875('0x1b')]();};}function respondWithResult(_0xd5d5f3,_0x190584){_0x190584=_0x190584||0xc8;return function(_0x36b258){if(_0x36b258){return _0xd5d5f3[_0xa875('0x1a')](_0x190584)[_0xa875('0x1c')](_0x36b258);}};}function respondWithFilteredResult(_0x1e0047,_0x448993){return function(_0x49e131){if(_0x49e131){var _0x274fcb=typeof _0x448993[_0xa875('0x1d')]===_0xa875('0x1e')&&typeof _0x448993[_0xa875('0x1f')]==='undefined';var _0x203bdf=_0x49e131['count'];var _0x292e85=_0x274fcb?0x0:_0x448993[_0xa875('0x1d')];var _0x34d389=_0x274fcb?_0x49e131[_0xa875('0x20')]:_0x448993['offset']+_0x448993[_0xa875('0x1f')];var _0x2e7ab2;if(_0x34d389>=_0x203bdf){_0x34d389=_0x203bdf;_0x2e7ab2=0xc8;}else{_0x2e7ab2=0xce;}_0x1e0047[_0xa875('0x1a')](_0x2e7ab2);return _0x1e0047['set'](_0xa875('0x21'),_0x292e85+'-'+_0x34d389+'/'+_0x203bdf)['json'](_0x49e131);}return null;};}function patchUpdates(_0x3ff8d5){return function(_0x46349a){try{jsonpatch[_0xa875('0x22')](_0x46349a,_0x3ff8d5,!![]);}catch(_0x4802c9){return BPromise[_0xa875('0x23')](_0x4802c9);}return _0x46349a[_0xa875('0x24')]();};}function saveUpdates(_0xef14e8,_0x40b1bb){return function(_0x2424b1){if(_0x2424b1){return _0x2424b1[_0xa875('0x25')](_0xef14e8)[_0xa875('0x26')](function(_0x212f38){return _0x212f38;});}return null;};}function removeEntity(_0x35d835,_0x5b9e95){return function(_0x1c0dc0){if(_0x1c0dc0){return _0x1c0dc0[_0xa875('0x27')]()[_0xa875('0x26')](function(){_0x35d835['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51309f,_0x1c2029){return function(_0x5ce929){if(!_0x5ce929){_0x51309f[_0xa875('0x19')](0x194);}return _0x5ce929;};}function handleError(_0x50ded6,_0x21c450){_0x21c450=_0x21c450||0x1f4;return function(_0x4ab841){logger[_0xa875('0x28')](_0x4ab841['stack']);if(_0x4ab841[_0xa875('0x29')]){delete _0x4ab841[_0xa875('0x29')];}_0x50ded6[_0xa875('0x1a')](_0x21c450)[_0xa875('0x2a')](_0x4ab841);};}exports[_0xa875('0x2b')]=function(_0x4b981f,_0x279df5){var _0x1276d5={},_0x35bdd0={},_0x32ea2a={'count':0x0,'rows':[]};var _0x312853=_['map'](db['OpenchannelQueueReport']['rawAttributes'],function(_0x3581b7){return{'name':_0x3581b7[_0xa875('0x2c')],'type':_0x3581b7[_0xa875('0x2d')][_0xa875('0x2e')]};});_0x35bdd0[_0xa875('0x2f')]=_[_0xa875('0x30')](_0x312853,_0xa875('0x29'));_0x35bdd0[_0xa875('0x31')]=_[_0xa875('0x32')](_0x4b981f[_0xa875('0x31')]);_0x35bdd0[_0xa875('0x33')]=_[_0xa875('0x34')](_0x35bdd0[_0xa875('0x2f')],_0x35bdd0[_0xa875('0x31')]);_0x1276d5[_0xa875('0x35')]=_[_0xa875('0x34')](_0x35bdd0[_0xa875('0x2f')],qs[_0xa875('0x36')](_0x4b981f[_0xa875('0x31')][_0xa875('0x36')]));_0x1276d5[_0xa875('0x35')]=_0x1276d5[_0xa875('0x35')][_0xa875('0x37')]?_0x1276d5[_0xa875('0x35')]:_0x35bdd0[_0xa875('0x2f')];if(!_0x4b981f['query'][_0xa875('0x38')](_0xa875('0x39'))){_0x1276d5[_0xa875('0x1f')]=qs[_0xa875('0x1f')](_0x4b981f[_0xa875('0x31')][_0xa875('0x1f')]);_0x1276d5[_0xa875('0x1d')]=qs[_0xa875('0x1d')](_0x4b981f['query']['offset']);}_0x1276d5[_0xa875('0x3a')]=qs[_0xa875('0x3b')](_0x4b981f[_0xa875('0x31')][_0xa875('0x3b')]);_0x1276d5['where']=qs[_0xa875('0x33')](_[_0xa875('0x3c')](_0x4b981f[_0xa875('0x31')],_0x35bdd0[_0xa875('0x33')]),_0x312853);if(_0x4b981f['query'][_0xa875('0x3d')]){_0x1276d5[_0xa875('0x3e')]=_[_0xa875('0x3f')](_0x1276d5[_0xa875('0x3e')],{'$or':_[_0xa875('0x30')](_0x312853,function(_0x32b91e){if(_0x32b91e[_0xa875('0x2d')]!==_0xa875('0x40')){var _0x44908c={};_0x44908c[_0x32b91e['name']]={'$like':'%'+_0x4b981f['query'][_0xa875('0x3d')]+'%'};return _0x44908c;}})});}_0x1276d5=_['merge']({},_0x1276d5,_0x4b981f[_0xa875('0x41')]);var _0x877e79={'where':_0x1276d5[_0xa875('0x3e')]};return db['OpenchannelQueueReport']['count'](_0x877e79)[_0xa875('0x26')](function(_0x243feb){_0x32ea2a[_0xa875('0x20')]=_0x243feb;if(_0x4b981f[_0xa875('0x31')][_0xa875('0x42')]){_0x1276d5['include']=[{'all':!![]}];}return db[_0xa875('0x43')]['findAll'](_0x1276d5);})[_0xa875('0x26')](function(_0x456cd4){_0x32ea2a[_0xa875('0x44')]=_0x456cd4;return _0x32ea2a;})['then'](respondWithFilteredResult(_0x279df5,_0x1276d5))[_0xa875('0x45')](handleError(_0x279df5,null));};exports[_0xa875('0x46')]=function(_0x376cbc,_0xa95e6f){var _0x7c244={'raw':!![],'where':{'id':_0x376cbc['params']['id']}},_0x31434d={};_0x31434d[_0xa875('0x2f')]=_[_0xa875('0x32')](db[_0xa875('0x43')][_0xa875('0x47')]);_0x31434d['query']=_[_0xa875('0x32')](_0x376cbc[_0xa875('0x31')]);_0x31434d[_0xa875('0x33')]=_[_0xa875('0x34')](_0x31434d[_0xa875('0x2f')],_0x31434d['query']);_0x7c244[_0xa875('0x35')]=_[_0xa875('0x34')](_0x31434d[_0xa875('0x2f')],qs[_0xa875('0x36')](_0x376cbc[_0xa875('0x31')][_0xa875('0x36')]));_0x7c244[_0xa875('0x35')]=_0x7c244[_0xa875('0x35')][_0xa875('0x37')]?_0x7c244[_0xa875('0x35')]:_0x31434d[_0xa875('0x2f')];if(_0x376cbc['query'][_0xa875('0x42')]){_0x7c244['include']=[{'all':!![]}];}_0x7c244=_['merge']({},_0x7c244,_0x376cbc['options']);return db[_0xa875('0x43')]['find'](_0x7c244)['then'](handleEntityNotFound(_0xa95e6f,null))['then'](respondWithResult(_0xa95e6f,null))[_0xa875('0x45')](handleError(_0xa95e6f,null));};exports['create']=function(_0x18b637,_0x408fea){return db[_0xa875('0x43')][_0xa875('0x48')](_0x18b637['body'],{})[_0xa875('0x26')](respondWithResult(_0x408fea,0xc9))[_0xa875('0x45')](handleError(_0x408fea,null));};exports['update']=function(_0x3f7e37,_0x4da9b3){if(_0x3f7e37[_0xa875('0x49')]['id']){delete _0x3f7e37[_0xa875('0x49')]['id'];}return db[_0xa875('0x43')][_0xa875('0x4a')]({'where':{'id':_0x3f7e37[_0xa875('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4da9b3,null))['then'](saveUpdates(_0x3f7e37['body'],null))[_0xa875('0x26')](respondWithResult(_0x4da9b3,null))[_0xa875('0x45')](handleError(_0x4da9b3,null));};exports[_0xa875('0x27')]=function(_0x394fe5,_0x48f27d){return db[_0xa875('0x43')][_0xa875('0x4a')]({'where':{'id':_0x394fe5['params']['id']}})[_0xa875('0x26')](handleEntityNotFound(_0x48f27d,null))[_0xa875('0x26')](removeEntity(_0x48f27d,null))[_0xa875('0x45')](handleError(_0x48f27d,null));};exports['describe']=function(_0x2dc05b,_0x5292b2){return db[_0xa875('0x43')][_0xa875('0x4c')]()[_0xa875('0x26')](respondWithResult(_0x5292b2,null))['catch'](handleError(_0x5292b2,null));}; \ No newline at end of file +var _0x1e47=['path','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','apply','reject','save','then','end','error','name','index','map','OpenchannelQueueReport','fieldName','type','model','query','keys','attributes','intersection','length','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','fields','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3d8631,_0x1a3b1b){var _0x5d8885=function(_0x374491){while(--_0x374491){_0x3d8631['push'](_0x3d8631['shift']());}};_0x5d8885(++_0x1a3b1b);}(_0x1e47,0xca));var _0x71e4=function(_0x592ed4,_0x5b002c){_0x592ed4=_0x592ed4-0x0;var _0x1c66fb=_0x1e47[_0x592ed4];return _0x1c66fb;};'use strict';var emlformat=require(_0x71e4('0x0'));var rimraf=require(_0x71e4('0x1'));var zipdir=require(_0x71e4('0x2'));var jsonpatch=require(_0x71e4('0x3'));var rp=require(_0x71e4('0x4'));var moment=require(_0x71e4('0x5'));var BPromise=require(_0x71e4('0x6'));var Mustache=require(_0x71e4('0x7'));var util=require('util');var path=require(_0x71e4('0x8'));var sox=require(_0x71e4('0x9'));var csv=require(_0x71e4('0xa'));var ejs=require(_0x71e4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71e4('0xc'));var squel=require(_0x71e4('0xd'));var crypto=require('crypto');var jsforce=require(_0x71e4('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71e4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x71e4('0x10'));var as=require(_0x71e4('0x11'));var hardwareService=require(_0x71e4('0x12'));var logger=require('../../config/logger')(_0x71e4('0x13'));var utils=require(_0x71e4('0x14'));var config=require(_0x71e4('0x15'));var licenseUtil=require(_0x71e4('0x16'));var db=require(_0x71e4('0x17'))['db'];function respondWithStatusCode(_0x3ae270,_0x2ef353){_0x2ef353=_0x2ef353||0xcc;return function(_0x5ba20e){if(_0x5ba20e){return _0x3ae270[_0x71e4('0x18')](_0x2ef353);}return _0x3ae270['status'](_0x2ef353)['end']();};}function respondWithResult(_0xc728bd,_0x322fc1){_0x322fc1=_0x322fc1||0xc8;return function(_0x310202){if(_0x310202){return _0xc728bd[_0x71e4('0x19')](_0x322fc1)['json'](_0x310202);}};}function respondWithFilteredResult(_0x2e9887,_0x53dbe2){return function(_0x415d66){if(_0x415d66){var _0x2de698=typeof _0x53dbe2[_0x71e4('0x1a')]==='undefined'&&typeof _0x53dbe2[_0x71e4('0x1b')]==='undefined';var _0x2e7832=_0x415d66[_0x71e4('0x1c')];var _0x55eee7=_0x2de698?0x0:_0x53dbe2[_0x71e4('0x1a')];var _0x4fe234=_0x2de698?_0x415d66['count']:_0x53dbe2['offset']+_0x53dbe2[_0x71e4('0x1b')];var _0x2b3884;if(_0x4fe234>=_0x2e7832){_0x4fe234=_0x2e7832;_0x2b3884=0xc8;}else{_0x2b3884=0xce;}_0x2e9887['status'](_0x2b3884);return _0x2e9887[_0x71e4('0x1d')](_0x71e4('0x1e'),_0x55eee7+'-'+_0x4fe234+'/'+_0x2e7832)['json'](_0x415d66);}return null;};}function patchUpdates(_0x4beed0){return function(_0x46b8c3){try{jsonpatch[_0x71e4('0x1f')](_0x46b8c3,_0x4beed0,!![]);}catch(_0x32bc10){return BPromise[_0x71e4('0x20')](_0x32bc10);}return _0x46b8c3[_0x71e4('0x21')]();};}function saveUpdates(_0x529514,_0x1f2ba3){return function(_0x38a86b){if(_0x38a86b){return _0x38a86b['update'](_0x529514)[_0x71e4('0x22')](function(_0x192cb4){return _0x192cb4;});}return null;};}function removeEntity(_0x2f7c42,_0x158748){return function(_0xac4aa8){if(_0xac4aa8){return _0xac4aa8['destroy']()[_0x71e4('0x22')](function(){_0x2f7c42[_0x71e4('0x19')](0xcc)[_0x71e4('0x23')]();});}};}function handleEntityNotFound(_0x48c435,_0x57c991){return function(_0x52de7f){if(!_0x52de7f){_0x48c435['sendStatus'](0x194);}return _0x52de7f;};}function handleError(_0xa3833f,_0xa5e733){_0xa5e733=_0xa5e733||0x1f4;return function(_0x474b45){logger[_0x71e4('0x24')](_0x474b45['stack']);if(_0x474b45[_0x71e4('0x25')]){delete _0x474b45[_0x71e4('0x25')];}_0xa3833f[_0x71e4('0x19')](_0xa5e733)['send'](_0x474b45);};}exports[_0x71e4('0x26')]=function(_0x27bb1e,_0x7150d9){var _0x39f7ce={},_0x37f507={},_0x1ee5e7={'count':0x0,'rows':[]};var _0xfbca3b=_[_0x71e4('0x27')](db[_0x71e4('0x28')]['rawAttributes'],function(_0x1d26a1){return{'name':_0x1d26a1[_0x71e4('0x29')],'type':_0x1d26a1[_0x71e4('0x2a')]['key']};});_0x37f507[_0x71e4('0x2b')]=_['map'](_0xfbca3b,_0x71e4('0x25'));_0x37f507[_0x71e4('0x2c')]=_[_0x71e4('0x2d')](_0x27bb1e['query']);_0x37f507['filters']=_['intersection'](_0x37f507[_0x71e4('0x2b')],_0x37f507['query']);_0x39f7ce[_0x71e4('0x2e')]=_[_0x71e4('0x2f')](_0x37f507['model'],qs['fields'](_0x27bb1e[_0x71e4('0x2c')]['fields']));_0x39f7ce[_0x71e4('0x2e')]=_0x39f7ce['attributes'][_0x71e4('0x30')]?_0x39f7ce[_0x71e4('0x2e')]:_0x37f507[_0x71e4('0x2b')];if(!_0x27bb1e['query']['hasOwnProperty']('nolimit')){_0x39f7ce['limit']=qs[_0x71e4('0x1b')](_0x27bb1e['query'][_0x71e4('0x1b')]);_0x39f7ce[_0x71e4('0x1a')]=qs[_0x71e4('0x1a')](_0x27bb1e[_0x71e4('0x2c')][_0x71e4('0x1a')]);}_0x39f7ce['order']=qs[_0x71e4('0x31')](_0x27bb1e[_0x71e4('0x2c')][_0x71e4('0x31')]);_0x39f7ce['where']=qs[_0x71e4('0x32')](_[_0x71e4('0x33')](_0x27bb1e['query'],_0x37f507['filters']),_0xfbca3b);if(_0x27bb1e[_0x71e4('0x2c')][_0x71e4('0x34')]){_0x39f7ce[_0x71e4('0x35')]=_[_0x71e4('0x36')](_0x39f7ce[_0x71e4('0x35')],{'$or':_[_0x71e4('0x27')](_0xfbca3b,function(_0x1a25e5){if(_0x1a25e5[_0x71e4('0x2a')]!==_0x71e4('0x37')){var _0x27551f={};_0x27551f[_0x1a25e5['name']]={'$like':'%'+_0x27bb1e[_0x71e4('0x2c')][_0x71e4('0x34')]+'%'};return _0x27551f;}})});}_0x39f7ce=_[_0x71e4('0x36')]({},_0x39f7ce,_0x27bb1e[_0x71e4('0x38')]);var _0x1ed2f0={'where':_0x39f7ce[_0x71e4('0x35')]};return db[_0x71e4('0x28')]['count'](_0x1ed2f0)[_0x71e4('0x22')](function(_0x1b7eb0){_0x1ee5e7['count']=_0x1b7eb0;if(_0x27bb1e[_0x71e4('0x2c')][_0x71e4('0x39')]){_0x39f7ce[_0x71e4('0x3a')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x71e4('0x3b')](_0x39f7ce);})[_0x71e4('0x22')](function(_0x4175a5){_0x1ee5e7['rows']=_0x4175a5;return _0x1ee5e7;})[_0x71e4('0x22')](respondWithFilteredResult(_0x7150d9,_0x39f7ce))[_0x71e4('0x3c')](handleError(_0x7150d9,null));};exports[_0x71e4('0x3d')]=function(_0x23f744,_0x25e48a){var _0xa6f3da={'raw':!![],'where':{'id':_0x23f744['params']['id']}},_0x268fb0={};_0x268fb0['model']=_[_0x71e4('0x2d')](db[_0x71e4('0x28')][_0x71e4('0x3e')]);_0x268fb0['query']=_[_0x71e4('0x2d')](_0x23f744[_0x71e4('0x2c')]);_0x268fb0[_0x71e4('0x32')]=_[_0x71e4('0x2f')](_0x268fb0[_0x71e4('0x2b')],_0x268fb0['query']);_0xa6f3da[_0x71e4('0x2e')]=_[_0x71e4('0x2f')](_0x268fb0[_0x71e4('0x2b')],qs[_0x71e4('0x3f')](_0x23f744[_0x71e4('0x2c')][_0x71e4('0x3f')]));_0xa6f3da['attributes']=_0xa6f3da[_0x71e4('0x2e')][_0x71e4('0x30')]?_0xa6f3da[_0x71e4('0x2e')]:_0x268fb0[_0x71e4('0x2b')];if(_0x23f744[_0x71e4('0x2c')][_0x71e4('0x39')]){_0xa6f3da[_0x71e4('0x3a')]=[{'all':!![]}];}_0xa6f3da=_[_0x71e4('0x36')]({},_0xa6f3da,_0x23f744[_0x71e4('0x38')]);return db[_0x71e4('0x28')][_0x71e4('0x40')](_0xa6f3da)[_0x71e4('0x22')](handleEntityNotFound(_0x25e48a,null))[_0x71e4('0x22')](respondWithResult(_0x25e48a,null))[_0x71e4('0x3c')](handleError(_0x25e48a,null));};exports[_0x71e4('0x41')]=function(_0x1ac2df,_0x5a6250){return db[_0x71e4('0x28')][_0x71e4('0x41')](_0x1ac2df['body'],{})[_0x71e4('0x22')](respondWithResult(_0x5a6250,0xc9))[_0x71e4('0x3c')](handleError(_0x5a6250,null));};exports['update']=function(_0x232df2,_0x38ece7){if(_0x232df2['body']['id']){delete _0x232df2[_0x71e4('0x42')]['id'];}return db[_0x71e4('0x28')][_0x71e4('0x40')]({'where':{'id':_0x232df2[_0x71e4('0x43')]['id']}})['then'](handleEntityNotFound(_0x38ece7,null))[_0x71e4('0x22')](saveUpdates(_0x232df2[_0x71e4('0x42')],null))[_0x71e4('0x22')](respondWithResult(_0x38ece7,null))[_0x71e4('0x3c')](handleError(_0x38ece7,null));};exports[_0x71e4('0x44')]=function(_0x1f33e8,_0x1b6e8a){return db[_0x71e4('0x28')][_0x71e4('0x40')]({'where':{'id':_0x1f33e8['params']['id']}})[_0x71e4('0x22')](handleEntityNotFound(_0x1b6e8a,null))['then'](removeEntity(_0x1b6e8a,null))[_0x71e4('0x3c')](handleError(_0x1b6e8a,null));};exports['describe']=function(_0x1fe39e,_0x4e765b){return db[_0x71e4('0x28')][_0x71e4('0x45')]()[_0x71e4('0x22')](respondWithResult(_0x4e765b,null))[_0x71e4('0x3c')](handleError(_0x4e765b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ed13a3c..afec3c2 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x3e577e,_0x194ae3){var _0x22d047=function(_0x236271){while(--_0x236271){_0x3e577e['push'](_0x3e577e['shift']());}};_0x22d047(++_0x194ae3);}(_0x1261,0x144));var _0x1126=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0x1261[_0x44c974];return _0x5214c6;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x581319,_0x50fb69){var _0x3f3b9b=function(_0x23c9ed){while(--_0x23c9ed){_0x581319['push'](_0x581319['shift']());}};_0x3f3b9b(++_0x50fb69);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index f955568..c978813 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 _0x3495=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','where'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0x3495,0x1de));var _0x5349=function(_0x1c8f7e,_0x3cb83a){_0x1c8f7e=_0x1c8f7e-0x0;var _0x5a9683=_0x3495[_0x1c8f7e];return _0x5a9683;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var moment=require(_0x5349('0x2'));var BPromise=require(_0x5349('0x3'));var rs=require(_0x5349('0x4'));var fs=require('fs');var Redis=require(_0x5349('0x5'));var db=require(_0x5349('0x6'))['db'];var utils=require(_0x5349('0x7'));var logger=require(_0x5349('0x8'))('rpc');var config=require(_0x5349('0x9'));var jayson=require(_0x5349('0xa'));var client=jayson['client'][_0x5349('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x538385,_0x6fb5dc,_0x529323){return new BPromise(function(_0x393873,_0x583cee){return client[_0x5349('0xc')](_0x538385,_0x529323)[_0x5349('0xd')](function(_0x22a3d3){logger[_0x5349('0xe')](_0x5349('0xf'),_0x6fb5dc,_0x5349('0x10'));logger[_0x5349('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x6fb5dc,_0x5349('0x10'),JSON['stringify'](_0x22a3d3));if(_0x22a3d3[_0x5349('0x12')]){if(_0x22a3d3[_0x5349('0x12')][_0x5349('0x13')]===0x1f4){logger[_0x5349('0x12')](_0x5349('0xf'),_0x6fb5dc,_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);return _0x583cee(_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);}logger[_0x5349('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x6fb5dc,_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);return _0x393873(_0x22a3d3['error'][_0x5349('0x14')]);}else{logger[_0x5349('0xe')](_0x5349('0xf'),_0x6fb5dc,'request\x20sent');_0x393873(_0x22a3d3['result']['message']);}})[_0x5349('0x15')](function(_0x5c873d){logger[_0x5349('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x6fb5dc,_0x5c873d);_0x583cee(_0x5c873d);});});}exports[_0x5349('0x16')]=function(_0x2c1f1){var _0x1f5747=this;return new Promise(function(_0x132639,_0x4e128c){return db[_0x5349('0x17')][_0x5349('0x18')](_0x2c1f1[_0x5349('0x19')],{'raw':_0x2c1f1[_0x5349('0x1a')]?_0x2c1f1['options'][_0x5349('0x1b')]===undefined?!![]:![]:!![]})[_0x5349('0xd')](function(_0x4f2cb6){logger['info']('CreateOpenchannelQueueReport',_0x2c1f1);logger[_0x5349('0x11')]('CreateOpenchannelQueueReport',_0x2c1f1,JSON[_0x5349('0x1c')](_0x4f2cb6));_0x132639(_0x4f2cb6);})[_0x5349('0x15')](function(_0x164978){logger[_0x5349('0x12')](_0x5349('0x16'),_0x164978[_0x5349('0x14')],_0x2c1f1);_0x4e128c(_0x1f5747[_0x5349('0x12')](0x1f4,_0x164978[_0x5349('0x14')]));});});};exports[_0x5349('0x1d')]=function(_0x34353f){var _0x1a84ce=this;return new Promise(function(_0x52520,_0x57af6c){return db[_0x5349('0x17')][_0x5349('0x1e')](_0x34353f[_0x5349('0x19')],{'raw':_0x34353f['options']?_0x34353f[_0x5349('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34353f[_0x5349('0x1a')]?_0x34353f[_0x5349('0x1a')][_0x5349('0x1f')]||null:null,'attributes':_0x34353f['options']?_0x34353f[_0x5349('0x1a')][_0x5349('0x20')]||null:null,'limit':_0x34353f[_0x5349('0x1a')]?_0x34353f[_0x5349('0x1a')][_0x5349('0x21')]||null:null})[_0x5349('0xd')](function(_0x3b6faa){logger[_0x5349('0xe')](_0x5349('0x1d'),_0x34353f);logger['debug'](_0x5349('0x1d'),_0x34353f,JSON[_0x5349('0x1c')](_0x3b6faa));_0x52520(_0x3b6faa);})['catch'](function(_0x3cad49){logger['error'](_0x5349('0x1d'),_0x3cad49[_0x5349('0x14')],_0x34353f);_0x57af6c(_0x1a84ce[_0x5349('0x12')](0x1f4,_0x3cad49[_0x5349('0x14')]));});});}; \ No newline at end of file +var _0x160f=['stringify','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','where','attributes','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3857c4,_0x131210){var _0x4c9878=function(_0x134da3){while(--_0x134da3){_0x3857c4['push'](_0x3857c4['shift']());}};_0x4c9878(++_0x131210);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')](_0x4b8185[_0xf160('0x19')],{'raw':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x40ccf0){logger[_0xf160('0xd')](_0xf160('0x16'),_0x4b8185);logger['debug'](_0xf160('0x16'),_0x4b8185,JSON[_0xf160('0x11')](_0x40ccf0));_0x1cf6ba(_0x40ccf0);})[_0xf160('0x15')](function(_0x36d0cb){logger[_0xf160('0x12')](_0xf160('0x16'),_0x36d0cb[_0xf160('0x14')],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0x36d0cb[_0xf160('0x14')]));});});};exports[_0xf160('0x1c')]=function(_0x305f6a){var _0x49bb5c=this;return new Promise(function(_0x578f7d,_0x42458c){return db[_0xf160('0x17')]['update'](_0x305f6a['body'],{'raw':_0x305f6a[_0xf160('0x1a')]?_0x305f6a[_0xf160('0x1a')][_0xf160('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x305f6a['options']?_0x305f6a[_0xf160('0x1a')][_0xf160('0x1d')]||null:null,'attributes':_0x305f6a[_0xf160('0x1a')]?_0x305f6a[_0xf160('0x1a')][_0xf160('0x1e')]||null:null,'limit':_0x305f6a[_0xf160('0x1a')]?_0x305f6a['options']['limit']||null:null})['then'](function(_0x26e7b9){logger[_0xf160('0xd')](_0xf160('0x1c'),_0x305f6a);logger[_0xf160('0x1f')](_0xf160('0x1c'),_0x305f6a,JSON['stringify'](_0x26e7b9));_0x578f7d(_0x26e7b9);})['catch'](function(_0x329d6b){logger['error']('UpdateOpenchannelQueueReport',_0x329d6b[_0xf160('0x14')],_0x305f6a);_0x42458c(_0x49bb5c[_0xf160('0x12')](0x1f4,_0x329d6b['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 955f892..f4b13f0 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 _0x3f1c=['fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','exports','path','connect-timeout','express','Router'];(function(_0x4887a8,_0x52be03){var _0x2cbb48=function(_0x59427e){while(--_0x59427e){_0x4887a8['push'](_0x4887a8['shift']());}};_0x2cbb48(++_0x52be03);}(_0x3f1c,0x152));var _0xc3f1=function(_0x48533a,_0xba12a5){_0x48533a=_0x48533a-0x0;var _0x2ea9e7=_0x3f1c[_0x48533a];return _0x2ea9e7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3f1('0x0'));var timeout=require(_0xc3f1('0x1'));var express=require(_0xc3f1('0x2'));var router=express[_0xc3f1('0x3')]();var fs_extra=require(_0xc3f1('0x4'));var auth=require(_0xc3f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc3f1('0x6'));var controller=require(_0xc3f1('0x7'));router[_0xc3f1('0x8')]('/',auth[_0xc3f1('0x9')](),controller['index']);router[_0xc3f1('0x8')](_0xc3f1('0xa'),auth['isAuthenticated'](),controller[_0xc3f1('0xb')]);router[_0xc3f1('0x8')](_0xc3f1('0xc'),auth[_0xc3f1('0x9')](),controller[_0xc3f1('0xd')]);router[_0xc3f1('0xe')]('/',auth[_0xc3f1('0x9')](),controller['create']);router[_0xc3f1('0xf')](_0xc3f1('0xc'),auth[_0xc3f1('0x9')](),controller[_0xc3f1('0x10')]);router['delete'](_0xc3f1('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xc3f1('0x11')]=router; \ No newline at end of file +var _0x1999=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4e8384,_0x5865c4){var _0x4deaa4=function(_0x242ee8){while(--_0x242ee8){_0x4e8384['push'](_0x4e8384['shift']());}};_0x4deaa4(++_0x5865c4);}(_0x1999,0x1bf));var _0x9199=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1999[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require(_0x9199('0x0'));var path=require(_0x9199('0x1'));var timeout=require(_0x9199('0x2'));var express=require(_0x9199('0x3'));var router=express['Router']();var fs_extra=require(_0x9199('0x4'));var auth=require(_0x9199('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9199('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0x9199('0x7')]('/',auth[_0x9199('0x8')](),controller['index']);router['get'](_0x9199('0x9'),auth[_0x9199('0x8')](),controller['describe']);router[_0x9199('0x7')](_0x9199('0xa'),auth['isAuthenticated'](),controller[_0x9199('0xb')]);router[_0x9199('0xc')]('/',auth[_0x9199('0x8')](),controller['create']);router[_0x9199('0xd')](_0x9199('0xa'),auth['isAuthenticated'](),controller[_0x9199('0xe')]);router[_0x9199('0xf')](_0x9199('0xa'),auth['isAuthenticated'](),controller[_0x9199('0x10')]);module[_0x9199('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index ff9ff4b..e377cef 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(_0xfcb518,_0x3b77ba){var _0x47e13a=function(_0x36d28c){while(--_0x36d28c){_0xfcb518['push'](_0xfcb518['shift']());}};_0x47e13a(++_0x3b77ba);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xf3cd[_0x55e08b];return _0xd1a7ff;};'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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x45c107,_0x5c04b4){var _0x1f3bf3=function(_0x247a6b){while(--_0x247a6b){_0x45c107['push'](_0x45c107['shift']());}};_0x1f3bf3(++_0x5c04b4);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x4b84[_0x3635ce];return _0x97ecd0;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 2d26533..0949f7e 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 _0xa13e=['undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','then','includeAll','include','findAll','rows','catch','show','params','length','merge','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0xa13e,0xc7));var _0xea13=function(_0x44f518,_0x8cf9cd){_0x44f518=_0x44f518-0x0;var _0x35f2a2=_0xa13e[_0x44f518];return _0x35f2a2;};'use strict';var emlformat=require(_0xea13('0x0'));var rimraf=require(_0xea13('0x1'));var zipdir=require(_0xea13('0x2'));var jsonpatch=require(_0xea13('0x3'));var rp=require('request-promise');var moment=require(_0xea13('0x4'));var BPromise=require(_0xea13('0x5'));var Mustache=require(_0xea13('0x6'));var util=require(_0xea13('0x7'));var path=require('path');var sox=require(_0xea13('0x8'));var csv=require('to-csv');var ejs=require(_0xea13('0x9'));var fs=require('fs');var fs_extra=require(_0xea13('0xa'));var _=require(_0xea13('0xb'));var squel=require(_0xea13('0xc'));var crypto=require(_0xea13('0xd'));var jsforce=require(_0xea13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xea13('0xf'));var querystring=require('querystring');var Papa=require(_0xea13('0x10'));var Redis=require(_0xea13('0x11'));var authService=require(_0xea13('0x12'));var qs=require(_0xea13('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xea13('0x14'));var utils=require(_0xea13('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xea13('0x16'))['db'];function respondWithStatusCode(_0x1aea71,_0x1ea6c7){_0x1ea6c7=_0x1ea6c7||0xcc;return function(_0x3bfd48){if(_0x3bfd48){return _0x1aea71[_0xea13('0x17')](_0x1ea6c7);}return _0x1aea71['status'](_0x1ea6c7)[_0xea13('0x18')]();};}function respondWithResult(_0x5b55d3,_0x37ebe0){_0x37ebe0=_0x37ebe0||0xc8;return function(_0x13582b){if(_0x13582b){return _0x5b55d3[_0xea13('0x19')](_0x37ebe0)[_0xea13('0x1a')](_0x13582b);}};}function respondWithFilteredResult(_0x38aef6,_0x1c494a){return function(_0x10ba1e){if(_0x10ba1e){var _0x1dfb41=typeof _0x1c494a[_0xea13('0x1b')]==='undefined'&&typeof _0x1c494a[_0xea13('0x1c')]===_0xea13('0x1d');var _0x5e8d3b=_0x10ba1e[_0xea13('0x1e')];var _0x3b93a3=_0x1dfb41?0x0:_0x1c494a[_0xea13('0x1b')];var _0x16a974=_0x1dfb41?_0x10ba1e[_0xea13('0x1e')]:_0x1c494a[_0xea13('0x1b')]+_0x1c494a[_0xea13('0x1c')];var _0x1f88a2;if(_0x16a974>=_0x5e8d3b){_0x16a974=_0x5e8d3b;_0x1f88a2=0xc8;}else{_0x1f88a2=0xce;}_0x38aef6[_0xea13('0x19')](_0x1f88a2);return _0x38aef6[_0xea13('0x1f')](_0xea13('0x20'),_0x3b93a3+'-'+_0x16a974+'/'+_0x5e8d3b)[_0xea13('0x1a')](_0x10ba1e);}return null;};}function patchUpdates(_0x24d97c){return function(_0x348dc1){try{jsonpatch[_0xea13('0x21')](_0x348dc1,_0x24d97c,!![]);}catch(_0x502878){return BPromise[_0xea13('0x22')](_0x502878);}return _0x348dc1[_0xea13('0x23')]();};}function saveUpdates(_0x46cfa6,_0x509bf8){return function(_0x227775){if(_0x227775){return _0x227775[_0xea13('0x24')](_0x46cfa6)['then'](function(_0xe241f6){return _0xe241f6;});}return null;};}function removeEntity(_0x2461a4,_0x5932a0){return function(_0x41a443){if(_0x41a443){return _0x41a443[_0xea13('0x25')]()['then'](function(){_0x2461a4[_0xea13('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15c84a,_0x37afbd){return function(_0x3d8fe7){if(!_0x3d8fe7){_0x15c84a[_0xea13('0x17')](0x194);}return _0x3d8fe7;};}function handleError(_0x256362,_0x2bff8f){_0x2bff8f=_0x2bff8f||0x1f4;return function(_0x5b95ac){logger[_0xea13('0x26')](_0x5b95ac[_0xea13('0x27')]);if(_0x5b95ac[_0xea13('0x28')]){delete _0x5b95ac[_0xea13('0x28')];}_0x256362[_0xea13('0x19')](_0x2bff8f)[_0xea13('0x29')](_0x5b95ac);};}exports[_0xea13('0x2a')]=function(_0xd6c9f4,_0x3636bd){var _0x58dbd0={},_0x526ca0={},_0xad5071={'count':0x0,'rows':[]};var _0x321ca2=_[_0xea13('0x2b')](db[_0xea13('0x2c')][_0xea13('0x2d')],function(_0x578bde){return{'name':_0x578bde[_0xea13('0x2e')],'type':_0x578bde[_0xea13('0x2f')][_0xea13('0x30')]};});_0x526ca0['model']=_[_0xea13('0x2b')](_0x321ca2,_0xea13('0x28'));_0x526ca0[_0xea13('0x31')]=_[_0xea13('0x32')](_0xd6c9f4[_0xea13('0x31')]);_0x526ca0['filters']=_['intersection'](_0x526ca0['model'],_0x526ca0[_0xea13('0x31')]);_0x58dbd0[_0xea13('0x33')]=_[_0xea13('0x34')](_0x526ca0[_0xea13('0x35')],qs[_0xea13('0x36')](_0xd6c9f4[_0xea13('0x31')][_0xea13('0x36')]));_0x58dbd0[_0xea13('0x33')]=_0x58dbd0[_0xea13('0x33')]['length']?_0x58dbd0[_0xea13('0x33')]:_0x526ca0[_0xea13('0x35')];if(!_0xd6c9f4['query'][_0xea13('0x37')](_0xea13('0x38'))){_0x58dbd0[_0xea13('0x1c')]=qs['limit'](_0xd6c9f4[_0xea13('0x31')][_0xea13('0x1c')]);_0x58dbd0[_0xea13('0x1b')]=qs[_0xea13('0x1b')](_0xd6c9f4[_0xea13('0x31')][_0xea13('0x1b')]);}_0x58dbd0['order']=qs[_0xea13('0x39')](_0xd6c9f4[_0xea13('0x31')][_0xea13('0x39')]);_0x58dbd0[_0xea13('0x3a')]=qs['filters'](_[_0xea13('0x3b')](_0xd6c9f4[_0xea13('0x31')],_0x526ca0['filters']),_0x321ca2);if(_0xd6c9f4[_0xea13('0x31')][_0xea13('0x3c')]){_0x58dbd0[_0xea13('0x3a')]=_['merge'](_0x58dbd0[_0xea13('0x3a')],{'$or':_['map'](_0x321ca2,function(_0x2fd353){if(_0x2fd353[_0xea13('0x2f')]!=='VIRTUAL'){var _0x20808f={};_0x20808f[_0x2fd353['name']]={'$like':'%'+_0xd6c9f4[_0xea13('0x31')][_0xea13('0x3c')]+'%'};return _0x20808f;}})});}_0x58dbd0=_['merge']({},_0x58dbd0,_0xd6c9f4['options']);var _0x5bae76={'where':_0x58dbd0[_0xea13('0x3a')]};return db[_0xea13('0x2c')][_0xea13('0x1e')](_0x5bae76)[_0xea13('0x3d')](function(_0x52a605){_0xad5071['count']=_0x52a605;if(_0xd6c9f4[_0xea13('0x31')][_0xea13('0x3e')]){_0x58dbd0[_0xea13('0x3f')]=[{'all':!![]}];}return db[_0xea13('0x2c')][_0xea13('0x40')](_0x58dbd0);})[_0xea13('0x3d')](function(_0x1ed957){_0xad5071[_0xea13('0x41')]=_0x1ed957;return _0xad5071;})[_0xea13('0x3d')](respondWithFilteredResult(_0x3636bd,_0x58dbd0))[_0xea13('0x42')](handleError(_0x3636bd,null));};exports[_0xea13('0x43')]=function(_0x32258d,_0x39bd1d){var _0x1341cb={'raw':!![],'where':{'id':_0x32258d[_0xea13('0x44')]['id']}},_0x3ca256={};_0x3ca256[_0xea13('0x35')]=_['keys'](db[_0xea13('0x2c')][_0xea13('0x2d')]);_0x3ca256['query']=_[_0xea13('0x32')](_0x32258d[_0xea13('0x31')]);_0x3ca256['filters']=_[_0xea13('0x34')](_0x3ca256[_0xea13('0x35')],_0x3ca256['query']);_0x1341cb[_0xea13('0x33')]=_['intersection'](_0x3ca256[_0xea13('0x35')],qs[_0xea13('0x36')](_0x32258d['query'][_0xea13('0x36')]));_0x1341cb[_0xea13('0x33')]=_0x1341cb[_0xea13('0x33')][_0xea13('0x45')]?_0x1341cb['attributes']:_0x3ca256[_0xea13('0x35')];if(_0x32258d[_0xea13('0x31')][_0xea13('0x3e')]){_0x1341cb[_0xea13('0x3f')]=[{'all':!![]}];}_0x1341cb=_[_0xea13('0x46')]({},_0x1341cb,_0x32258d[_0xea13('0x47')]);return db[_0xea13('0x2c')]['find'](_0x1341cb)['then'](handleEntityNotFound(_0x39bd1d,null))['then'](respondWithResult(_0x39bd1d,null))[_0xea13('0x42')](handleError(_0x39bd1d,null));};exports[_0xea13('0x48')]=function(_0x4fe2c0,_0x323bdd){return db[_0xea13('0x2c')][_0xea13('0x48')](_0x4fe2c0['body'],{})[_0xea13('0x3d')](respondWithResult(_0x323bdd,0xc9))['catch'](handleError(_0x323bdd,null));};exports[_0xea13('0x24')]=function(_0x67766d,_0x25383e){if(_0x67766d[_0xea13('0x49')]['id']){delete _0x67766d[_0xea13('0x49')]['id'];}return db[_0xea13('0x2c')][_0xea13('0x4a')]({'where':{'id':_0x67766d[_0xea13('0x44')]['id']}})['then'](handleEntityNotFound(_0x25383e,null))[_0xea13('0x3d')](saveUpdates(_0x67766d[_0xea13('0x49')],null))[_0xea13('0x3d')](respondWithResult(_0x25383e,null))[_0xea13('0x42')](handleError(_0x25383e,null));};exports['destroy']=function(_0x484448,_0x15fcfc){return db[_0xea13('0x2c')][_0xea13('0x4a')]({'where':{'id':_0x484448[_0xea13('0x44')]['id']}})[_0xea13('0x3d')](handleEntityNotFound(_0x15fcfc,null))[_0xea13('0x3d')](removeEntity(_0x15fcfc,null))[_0xea13('0x42')](handleError(_0x15fcfc,null));};exports[_0xea13('0x4b')]=function(_0x470bc2,_0x307d44){return db[_0xea13('0x2c')][_0xea13('0x4b')]()[_0xea13('0x3d')](respondWithResult(_0x307d44,null))[_0xea13('0x42')](handleError(_0x307d44,null));}; \ No newline at end of file +var _0xf5d2=['json','reject','save','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','set','Content-Range'];(function(_0x3f9f17,_0x547eb3){var _0x1f1c46=function(_0x2843ea){while(--_0x2843ea){_0x3f9f17['push'](_0x3f9f17['shift']());}};_0x1f1c46(++_0x547eb3);}(_0xf5d2,0x77));var _0x2f5d=function(_0x5962eb,_0x27a854){_0x5962eb=_0x5962eb-0x0;var _0x42700b=_0xf5d2[_0x5962eb];return _0x42700b;};'use strict';var emlformat=require(_0x2f5d('0x0'));var rimraf=require(_0x2f5d('0x1'));var zipdir=require(_0x2f5d('0x2'));var jsonpatch=require(_0x2f5d('0x3'));var rp=require('request-promise');var moment=require(_0x2f5d('0x4'));var BPromise=require(_0x2f5d('0x5'));var Mustache=require(_0x2f5d('0x6'));var util=require('util');var path=require(_0x2f5d('0x7'));var sox=require('sox');var csv=require(_0x2f5d('0x8'));var ejs=require(_0x2f5d('0x9'));var fs=require('fs');var fs_extra=require(_0x2f5d('0xa'));var _=require('lodash');var squel=require(_0x2f5d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2f5d('0xc'));var toCsv=require(_0x2f5d('0x8'));var querystring=require('querystring');var Papa=require(_0x2f5d('0xd'));var Redis=require(_0x2f5d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2f5d('0xf'));var as=require(_0x2f5d('0x10'));var hardwareService=require(_0x2f5d('0x11'));var logger=require('../../config/logger')(_0x2f5d('0x12'));var utils=require(_0x2f5d('0x13'));var config=require(_0x2f5d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f5d('0x15'))['db'];function respondWithStatusCode(_0x40e7e0,_0x5c8211){_0x5c8211=_0x5c8211||0xcc;return function(_0x140d62){if(_0x140d62){return _0x40e7e0[_0x2f5d('0x16')](_0x5c8211);}return _0x40e7e0[_0x2f5d('0x17')](_0x5c8211)[_0x2f5d('0x18')]();};}function respondWithResult(_0x581a94,_0x3a23d5){_0x3a23d5=_0x3a23d5||0xc8;return function(_0x3c1c7c){if(_0x3c1c7c){return _0x581a94['status'](_0x3a23d5)['json'](_0x3c1c7c);}};}function respondWithFilteredResult(_0x25354f,_0x2a2fca){return function(_0x2ef3e0){if(_0x2ef3e0){var _0x219f50=typeof _0x2a2fca[_0x2f5d('0x19')]===_0x2f5d('0x1a')&&typeof _0x2a2fca['limit']===_0x2f5d('0x1a');var _0x5b7931=_0x2ef3e0['count'];var _0x1400ff=_0x219f50?0x0:_0x2a2fca[_0x2f5d('0x19')];var _0x29b822=_0x219f50?_0x2ef3e0['count']:_0x2a2fca['offset']+_0x2a2fca['limit'];var _0x2c6f8d;if(_0x29b822>=_0x5b7931){_0x29b822=_0x5b7931;_0x2c6f8d=0xc8;}else{_0x2c6f8d=0xce;}_0x25354f[_0x2f5d('0x17')](_0x2c6f8d);return _0x25354f[_0x2f5d('0x1b')](_0x2f5d('0x1c'),_0x1400ff+'-'+_0x29b822+'/'+_0x5b7931)[_0x2f5d('0x1d')](_0x2ef3e0);}return null;};}function patchUpdates(_0x267e43){return function(_0xa3d049){try{jsonpatch['apply'](_0xa3d049,_0x267e43,!![]);}catch(_0x2d2dd8){return BPromise[_0x2f5d('0x1e')](_0x2d2dd8);}return _0xa3d049[_0x2f5d('0x1f')]();};}function saveUpdates(_0x2ac4cd,_0x2d011a){return function(_0x356bde){if(_0x356bde){return _0x356bde['update'](_0x2ac4cd)[_0x2f5d('0x20')](function(_0x250a61){return _0x250a61;});}return null;};}function removeEntity(_0x357c8e,_0xe427b6){return function(_0xa2aebc){if(_0xa2aebc){return _0xa2aebc[_0x2f5d('0x21')]()[_0x2f5d('0x20')](function(){_0x357c8e[_0x2f5d('0x17')](0xcc)[_0x2f5d('0x18')]();});}};}function handleEntityNotFound(_0x4d4e91,_0xbf6cb2){return function(_0x19a42a){if(!_0x19a42a){_0x4d4e91[_0x2f5d('0x16')](0x194);}return _0x19a42a;};}function handleError(_0x1f833c,_0x3dbdfa){_0x3dbdfa=_0x3dbdfa||0x1f4;return function(_0x4eda7a){logger['error'](_0x4eda7a[_0x2f5d('0x22')]);if(_0x4eda7a[_0x2f5d('0x23')]){delete _0x4eda7a['name'];}_0x1f833c[_0x2f5d('0x17')](_0x3dbdfa)[_0x2f5d('0x24')](_0x4eda7a);};}exports[_0x2f5d('0x25')]=function(_0x566c24,_0xd11c77){var _0x472805={},_0x1e2538={},_0x5e3a81={'count':0x0,'rows':[]};var _0x5ed5c3=_[_0x2f5d('0x26')](db[_0x2f5d('0x27')][_0x2f5d('0x28')],function(_0x301758){return{'name':_0x301758['fieldName'],'type':_0x301758['type'][_0x2f5d('0x29')]};});_0x1e2538[_0x2f5d('0x2a')]=_[_0x2f5d('0x26')](_0x5ed5c3,_0x2f5d('0x23'));_0x1e2538['query']=_[_0x2f5d('0x2b')](_0x566c24['query']);_0x1e2538[_0x2f5d('0x2c')]=_[_0x2f5d('0x2d')](_0x1e2538[_0x2f5d('0x2a')],_0x1e2538[_0x2f5d('0x2e')]);_0x472805[_0x2f5d('0x2f')]=_['intersection'](_0x1e2538[_0x2f5d('0x2a')],qs[_0x2f5d('0x30')](_0x566c24['query'][_0x2f5d('0x30')]));_0x472805['attributes']=_0x472805[_0x2f5d('0x2f')][_0x2f5d('0x31')]?_0x472805[_0x2f5d('0x2f')]:_0x1e2538[_0x2f5d('0x2a')];if(!_0x566c24[_0x2f5d('0x2e')][_0x2f5d('0x32')](_0x2f5d('0x33'))){_0x472805['limit']=qs['limit'](_0x566c24[_0x2f5d('0x2e')][_0x2f5d('0x34')]);_0x472805[_0x2f5d('0x19')]=qs[_0x2f5d('0x19')](_0x566c24['query'][_0x2f5d('0x19')]);}_0x472805[_0x2f5d('0x35')]=qs[_0x2f5d('0x36')](_0x566c24[_0x2f5d('0x2e')][_0x2f5d('0x36')]);_0x472805[_0x2f5d('0x37')]=qs[_0x2f5d('0x2c')](_[_0x2f5d('0x38')](_0x566c24['query'],_0x1e2538[_0x2f5d('0x2c')]),_0x5ed5c3);if(_0x566c24['query'][_0x2f5d('0x39')]){_0x472805[_0x2f5d('0x37')]=_[_0x2f5d('0x3a')](_0x472805[_0x2f5d('0x37')],{'$or':_[_0x2f5d('0x26')](_0x5ed5c3,function(_0x293442){if(_0x293442[_0x2f5d('0x3b')]!==_0x2f5d('0x3c')){var _0x2de25e={};_0x2de25e[_0x293442[_0x2f5d('0x23')]]={'$like':'%'+_0x566c24[_0x2f5d('0x2e')][_0x2f5d('0x39')]+'%'};return _0x2de25e;}})});}_0x472805=_[_0x2f5d('0x3a')]({},_0x472805,_0x566c24[_0x2f5d('0x3d')]);var _0xd345b0={'where':_0x472805['where']};return db['OpenchannelTransferReport'][_0x2f5d('0x3e')](_0xd345b0)[_0x2f5d('0x20')](function(_0x3d99a9){_0x5e3a81['count']=_0x3d99a9;if(_0x566c24[_0x2f5d('0x2e')][_0x2f5d('0x3f')]){_0x472805[_0x2f5d('0x40')]=[{'all':!![]}];}return db[_0x2f5d('0x27')][_0x2f5d('0x41')](_0x472805);})['then'](function(_0x3e9b95){_0x5e3a81[_0x2f5d('0x42')]=_0x3e9b95;return _0x5e3a81;})[_0x2f5d('0x20')](respondWithFilteredResult(_0xd11c77,_0x472805))['catch'](handleError(_0xd11c77,null));};exports['show']=function(_0x2edbe2,_0x4eb5d8){var _0x428657={'raw':!![],'where':{'id':_0x2edbe2['params']['id']}},_0x3630e3={};_0x3630e3[_0x2f5d('0x2a')]=_[_0x2f5d('0x2b')](db['OpenchannelTransferReport'][_0x2f5d('0x28')]);_0x3630e3[_0x2f5d('0x2e')]=_[_0x2f5d('0x2b')](_0x2edbe2[_0x2f5d('0x2e')]);_0x3630e3[_0x2f5d('0x2c')]=_[_0x2f5d('0x2d')](_0x3630e3['model'],_0x3630e3[_0x2f5d('0x2e')]);_0x428657['attributes']=_['intersection'](_0x3630e3[_0x2f5d('0x2a')],qs['fields'](_0x2edbe2[_0x2f5d('0x2e')][_0x2f5d('0x30')]));_0x428657[_0x2f5d('0x2f')]=_0x428657['attributes'][_0x2f5d('0x31')]?_0x428657['attributes']:_0x3630e3[_0x2f5d('0x2a')];if(_0x2edbe2[_0x2f5d('0x2e')]['includeAll']){_0x428657['include']=[{'all':!![]}];}_0x428657=_[_0x2f5d('0x3a')]({},_0x428657,_0x2edbe2[_0x2f5d('0x3d')]);return db[_0x2f5d('0x27')]['find'](_0x428657)[_0x2f5d('0x20')](handleEntityNotFound(_0x4eb5d8,null))[_0x2f5d('0x20')](respondWithResult(_0x4eb5d8,null))[_0x2f5d('0x43')](handleError(_0x4eb5d8,null));};exports['create']=function(_0x428c27,_0x7c0d2b){return db[_0x2f5d('0x27')][_0x2f5d('0x44')](_0x428c27[_0x2f5d('0x45')],{})[_0x2f5d('0x20')](respondWithResult(_0x7c0d2b,0xc9))[_0x2f5d('0x43')](handleError(_0x7c0d2b,null));};exports[_0x2f5d('0x46')]=function(_0x57ef9b,_0x32e607){if(_0x57ef9b[_0x2f5d('0x45')]['id']){delete _0x57ef9b[_0x2f5d('0x45')]['id'];}return db['OpenchannelTransferReport'][_0x2f5d('0x47')]({'where':{'id':_0x57ef9b[_0x2f5d('0x48')]['id']}})[_0x2f5d('0x20')](handleEntityNotFound(_0x32e607,null))[_0x2f5d('0x20')](saveUpdates(_0x57ef9b[_0x2f5d('0x45')],null))[_0x2f5d('0x20')](respondWithResult(_0x32e607,null))[_0x2f5d('0x43')](handleError(_0x32e607,null));};exports['destroy']=function(_0x4f701f,_0xa71328){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x4f701f[_0x2f5d('0x48')]['id']}})[_0x2f5d('0x20')](handleEntityNotFound(_0xa71328,null))[_0x2f5d('0x20')](removeEntity(_0xa71328,null))[_0x2f5d('0x43')](handleError(_0xa71328,null));};exports['describe']=function(_0x19c1fc,_0x3840f6){return db[_0x2f5d('0x27')][_0x2f5d('0x49')]()['then'](respondWithResult(_0x3840f6,null))[_0x2f5d('0x43')](handleError(_0x3840f6,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 6b581a6..c94a467 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 _0xf0bd=['path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','util','api','request-promise'];(function(_0x11b9ce,_0x4e1436){var _0x4e2e64=function(_0x1ad8c0){while(--_0x1ad8c0){_0x11b9ce['push'](_0x11b9ce['shift']());}};_0x4e2e64(++_0x4e1436);}(_0xf0bd,0x147));var _0xdf0b=function(_0x6795e8,_0x321be3){_0x6795e8=_0x6795e8-0x0;var _0x1ff04e=_0xf0bd[_0x6795e8];return _0x1ff04e;};'use strict';var _=require('lodash');var util=require(_0xdf0b('0x0'));var logger=require('../../config/logger')(_0xdf0b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdf0b('0x2'));var fs=require('fs');var path=require(_0xdf0b('0x3'));var rimraf=require(_0xdf0b('0x4'));var config=require('../../config/environment');var attributes=require(_0xdf0b('0x5'));module[_0xdf0b('0x6')]=function(_0x52374b,_0x519941){return _0x52374b[_0xdf0b('0x7')](_0xdf0b('0x8'),attributes,{'tableName':_0xdf0b('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd089=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0xd089,0x107));var _0x9d08=function(_0x37b197,_0xe1a0e5){_0x37b197=_0x37b197-0x0;var _0x3f9108=_0xd089[_0x37b197];return _0x3f9108;};'use strict';var _=require('lodash');var util=require(_0x9d08('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9d08('0x1'));var BPromise=require(_0x9d08('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d08('0x3'));var rimraf=require(_0x9d08('0x4'));var config=require(_0x9d08('0x5'));var attributes=require('./openchannelTransferReport.attributes');module[_0x9d08('0x6')]=function(_0x48cdb9,_0x2c0591){return _0x48cdb9['define'](_0x9d08('0x7'),attributes,{'tableName':_0x9d08('0x8'),'paranoid':![],'indexes':[{'name':_0x9d08('0x9'),'fields':[_0x9d08('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 46b0a47..7d6c982 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3bd2fc,_0x1c93db){var _0x48372f=function(_0x5c4e8e){while(--_0x5c4e8e){_0x3bd2fc['push'](_0x3bd2fc['shift']());}};_0x48372f(++_0x1c93db);}(_0x81bd,0x7c));var _0xd81b=function(_0x31f5b0,_0x3ceb60){_0x31f5b0=_0x31f5b0-0x0;var _0x25dfd3=_0x81bd[_0x31f5b0];return _0x25dfd3;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file +var _0xa1f6=['client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','jayson/promise'];(function(_0x32bfd6,_0x5b289d){var _0x17cb8b=function(_0x4d9d35){while(--_0x4d9d35){_0x32bfd6['push'](_0x32bfd6['shift']());}};_0x17cb8b(++_0x5b289d);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0xa1f6[_0x541a67];return _0x45da2a;};'use strict';var _=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var moment=require(_0x6a1f('0x2'));var BPromise=require(_0x6a1f('0x3'));var rs=require(_0x6a1f('0x4'));var fs=require('fs');var Redis=require(_0x6a1f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6a1f('0x6'));var client=jayson[_0x6a1f('0x7')][_0x6a1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a772b,_0x328033,_0x3ecd63){return new BPromise(function(_0x36c00b,_0x56bf63){return client[_0x6a1f('0x9')](_0x3a772b,_0x3ecd63)[_0x6a1f('0xa')](function(_0x2300b1){logger[_0x6a1f('0xb')](_0x6a1f('0xc'),_0x328033,'request\x20sent');logger[_0x6a1f('0xd')](_0x6a1f('0xe'),_0x328033,_0x6a1f('0xf'),JSON[_0x6a1f('0x10')](_0x2300b1));if(_0x2300b1['error']){if(_0x2300b1[_0x6a1f('0x11')]['code']===0x1f4){logger[_0x6a1f('0x11')](_0x6a1f('0xc'),_0x328033,_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);return _0x56bf63(_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);}logger[_0x6a1f('0x11')](_0x6a1f('0xc'),_0x328033,_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);return _0x36c00b(_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);}else{logger[_0x6a1f('0xb')](_0x6a1f('0xc'),_0x328033,_0x6a1f('0xf'));_0x36c00b(_0x2300b1[_0x6a1f('0x13')][_0x6a1f('0x12')]);}})[_0x6a1f('0x14')](function(_0x2c44a0){logger['error'](_0x6a1f('0xc'),_0x328033,_0x2c44a0);_0x56bf63(_0x2c44a0);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 99de519..1166073 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 _0x1629=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x1629,0x1ac));var _0x9162=function(_0x186052,_0x272d2b){_0x186052=_0x186052-0x0;var _0x5a45d9=_0x1629[_0x186052];return _0x5a45d9;};'use strict';var multer=require(_0x9162('0x0'));var util=require(_0x9162('0x1'));var path=require(_0x9162('0x2'));var timeout=require(_0x9162('0x3'));var express=require(_0x9162('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9162('0x5'));var interaction=require(_0x9162('0x6'));var config=require(_0x9162('0x7'));var controller=require(_0x9162('0x8'));router['get']('/',auth[_0x9162('0x9')](),controller[_0x9162('0xa')]);router['get'](_0x9162('0xb'),auth[_0x9162('0x9')](),controller[_0x9162('0xc')]);router[_0x9162('0xd')]('/',auth[_0x9162('0x9')](),controller[_0x9162('0xe')]);router[_0x9162('0xf')](_0x9162('0xb'),auth[_0x9162('0x9')](),controller[_0x9162('0x10')]);router['delete'](_0x9162('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x9162('0x11')]=router; \ No newline at end of file +var _0x9162=['post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x9162,0x14a));var _0x2916=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x9162[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x2916('0x0'));var util=require(_0x2916('0x1'));var path=require(_0x2916('0x2'));var timeout=require('connect-timeout');var express=require(_0x2916('0x3'));var router=express[_0x2916('0x4')]();var fs_extra=require(_0x2916('0x5'));var auth=require(_0x2916('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2916('0x7'));var controller=require('./pause.controller');router[_0x2916('0x8')]('/',auth[_0x2916('0x9')](),controller[_0x2916('0xa')]);router['get'](_0x2916('0xb'),auth[_0x2916('0x9')](),controller['show']);router[_0x2916('0xc')]('/',auth[_0x2916('0x9')](),controller['create']);router[_0x2916('0xd')](_0x2916('0xb'),auth[_0x2916('0x9')](),controller[_0x2916('0xe')]);router[_0x2916('0xf')]('/:id',auth[_0x2916('0x9')](),controller[_0x2916('0x10')]);module[_0x2916('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 3c59570..5a90b61 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 _0x4c75=['STRING','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4c75,0x1ab));var _0x54c7=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x4c75[_0x20b29c];return _0x20d81b;};'use strict';var Sequelize=require(_0x54c7('0x0'));module[_0x54c7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x54c7('0x2')]}}; \ No newline at end of file +var _0x647f=['name','STRING'];(function(_0x4f72b1,_0x248817){var _0x41e5e5=function(_0x25a042){while(--_0x25a042){_0x4f72b1['push'](_0x4f72b1['shift']());}};_0x41e5e5(++_0x248817);}(_0x647f,0x75));var _0xf647=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x647f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf647('0x0')],'unique':_0xf647('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xf647('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 6cd3227..f1ccd71 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 _0x4327=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','Pauses','error','name','send','map','Pause','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis'];(function(_0x163d42,_0x3cabea){var _0x59186c=function(_0x139ab9){while(--_0x139ab9){_0x163d42['push'](_0x163d42['shift']());}};_0x59186c(++_0x3cabea);}(_0x4327,0xeb));var _0x7432=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0x4327[_0x417baa];return _0x42724f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7432('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7432('0x1'));var rp=require(_0x7432('0x2'));var moment=require('moment');var BPromise=require(_0x7432('0x3'));var Mustache=require(_0x7432('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7432('0x5'));var csv=require(_0x7432('0x6'));var ejs=require(_0x7432('0x7'));var fs=require('fs');var fs_extra=require(_0x7432('0x8'));var _=require(_0x7432('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7432('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7432('0xb'));var Papa=require(_0x7432('0xc'));var Redis=require(_0x7432('0xd'));var authService=require(_0x7432('0xe'));var qs=require(_0x7432('0xf'));var as=require(_0x7432('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7432('0x11'))(_0x7432('0x12'));var utils=require(_0x7432('0x13'));var config=require(_0x7432('0x14'));var licenseUtil=require(_0x7432('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2711a4,_0xea8030){_0xea8030=_0xea8030||0xcc;return function(_0x2a4cd3){if(_0x2a4cd3){return _0x2711a4[_0x7432('0x16')](_0xea8030);}return _0x2711a4[_0x7432('0x17')](_0xea8030)[_0x7432('0x18')]();};}function respondWithResult(_0x41de12,_0x162f80){_0x162f80=_0x162f80||0xc8;return function(_0x275e26){if(_0x275e26){return _0x41de12[_0x7432('0x17')](_0x162f80)[_0x7432('0x19')](_0x275e26);}};}function respondWithFilteredResult(_0x266730,_0xb72889){return function(_0x2e9568){if(_0x2e9568){var _0x6e011f=typeof _0xb72889['offset']===_0x7432('0x1a')&&typeof _0xb72889[_0x7432('0x1b')]==='undefined';var _0x566f25=_0x2e9568[_0x7432('0x1c')];var _0x4b8f03=_0x6e011f?0x0:_0xb72889['offset'];var _0x3c28a6=_0x6e011f?_0x2e9568[_0x7432('0x1c')]:_0xb72889[_0x7432('0x1d')]+_0xb72889[_0x7432('0x1b')];var _0x261e80;if(_0x3c28a6>=_0x566f25){_0x3c28a6=_0x566f25;_0x261e80=0xc8;}else{_0x261e80=0xce;}_0x266730[_0x7432('0x17')](_0x261e80);return _0x266730[_0x7432('0x1e')](_0x7432('0x1f'),_0x4b8f03+'-'+_0x3c28a6+'/'+_0x566f25)['json'](_0x2e9568);}return null;};}function patchUpdates(_0x22b8b4){return function(_0x56dafd){try{jsonpatch[_0x7432('0x20')](_0x56dafd,_0x22b8b4,!![]);}catch(_0x565120){return BPromise[_0x7432('0x21')](_0x565120);}return _0x56dafd[_0x7432('0x22')]();};}function saveUpdates(_0x127052,_0x222e67){return function(_0x2ea794){if(_0x2ea794){return _0x2ea794['update'](_0x127052)['then'](function(_0x16ed09){return _0x16ed09;});}return null;};}function removeEntity(_0x33d15a,_0xa73be9){return function(_0x49bd55){if(_0x49bd55){return _0x49bd55[_0x7432('0x23')]()[_0x7432('0x24')](function(){var _0x3585e5=_0x49bd55[_0x7432('0x25')]({'plain':!![]});var _0x3ed582=_0x7432('0x26');return db['UserProfileResource'][_0x7432('0x23')]({'where':{'type':_0x3ed582,'resourceId':_0x3585e5['id']}})[_0x7432('0x24')](function(){return _0x49bd55;});})['then'](function(){_0x33d15a[_0x7432('0x17')](0xcc)[_0x7432('0x18')]();});}};}function handleEntityNotFound(_0x10a222,_0x6dc0d8){return function(_0x1fdbda){if(!_0x1fdbda){_0x10a222[_0x7432('0x16')](0x194);}return _0x1fdbda;};}function handleError(_0x5ac979,_0x17b82b){_0x17b82b=_0x17b82b||0x1f4;return function(_0x497ab9){logger[_0x7432('0x27')](_0x497ab9['stack']);if(_0x497ab9['name']){delete _0x497ab9[_0x7432('0x28')];}_0x5ac979[_0x7432('0x17')](_0x17b82b)[_0x7432('0x29')](_0x497ab9);};}exports['index']=function(_0x5b96b9,_0x28465a){var _0x1aa435={},_0x500100={},_0x492905={'count':0x0,'rows':[]};var _0x198333=_[_0x7432('0x2a')](db[_0x7432('0x2b')]['rawAttributes'],function(_0x401242){return{'name':_0x401242[_0x7432('0x2c')],'type':_0x401242['type'][_0x7432('0x2d')]};});_0x500100[_0x7432('0x2e')]=_[_0x7432('0x2a')](_0x198333,_0x7432('0x28'));_0x500100['query']=_[_0x7432('0x2f')](_0x5b96b9[_0x7432('0x30')]);_0x500100[_0x7432('0x31')]=_[_0x7432('0x32')](_0x500100[_0x7432('0x2e')],_0x500100['query']);_0x1aa435[_0x7432('0x33')]=_[_0x7432('0x32')](_0x500100[_0x7432('0x2e')],qs['fields'](_0x5b96b9[_0x7432('0x30')]['fields']));_0x1aa435[_0x7432('0x33')]=_0x1aa435['attributes'][_0x7432('0x34')]?_0x1aa435[_0x7432('0x33')]:_0x500100[_0x7432('0x2e')];if(!_0x5b96b9[_0x7432('0x30')][_0x7432('0x35')](_0x7432('0x36'))){_0x1aa435[_0x7432('0x1b')]=qs['limit'](_0x5b96b9[_0x7432('0x30')][_0x7432('0x1b')]);_0x1aa435[_0x7432('0x1d')]=qs['offset'](_0x5b96b9[_0x7432('0x30')][_0x7432('0x1d')]);}_0x1aa435[_0x7432('0x37')]=qs[_0x7432('0x38')](_0x5b96b9['query']['sort']);_0x1aa435['where']=qs[_0x7432('0x31')](_[_0x7432('0x39')](_0x5b96b9['query'],_0x500100['filters']),_0x198333);if(_0x5b96b9['query'][_0x7432('0x3a')]){_0x1aa435[_0x7432('0x3b')]=_['merge'](_0x1aa435['where'],{'$or':_[_0x7432('0x2a')](_0x198333,function(_0xfe1c6e){if(_0xfe1c6e[_0x7432('0x3c')]!==_0x7432('0x3d')){var _0x139683={};_0x139683[_0xfe1c6e[_0x7432('0x28')]]={'$like':'%'+_0x5b96b9[_0x7432('0x30')][_0x7432('0x3a')]+'%'};return _0x139683;}})});}_0x1aa435=_[_0x7432('0x3e')]({},_0x1aa435,_0x5b96b9[_0x7432('0x3f')]);var _0x4318d3={'where':_0x1aa435[_0x7432('0x3b')]};return db['Pause']['count'](_0x4318d3)['then'](function(_0x1ed560){_0x492905[_0x7432('0x1c')]=_0x1ed560;if(_0x5b96b9[_0x7432('0x30')][_0x7432('0x40')]){_0x1aa435[_0x7432('0x41')]=[{'all':!![]}];}return db['Pause'][_0x7432('0x42')](_0x1aa435);})[_0x7432('0x24')](function(_0x4963e7){_0x492905[_0x7432('0x43')]=_0x4963e7;return _0x492905;})['then'](respondWithFilteredResult(_0x28465a,_0x1aa435))[_0x7432('0x44')](handleError(_0x28465a,null));};exports[_0x7432('0x45')]=function(_0x3331a6,_0x2dd4c1){var _0x5cb259={'raw':!![],'where':{'id':_0x3331a6[_0x7432('0x46')]['id']}},_0x5dad00={};_0x5dad00[_0x7432('0x2e')]=_[_0x7432('0x2f')](db[_0x7432('0x2b')][_0x7432('0x47')]);_0x5dad00[_0x7432('0x30')]=_[_0x7432('0x2f')](_0x3331a6[_0x7432('0x30')]);_0x5dad00['filters']=_[_0x7432('0x32')](_0x5dad00[_0x7432('0x2e')],_0x5dad00[_0x7432('0x30')]);_0x5cb259[_0x7432('0x33')]=_[_0x7432('0x32')](_0x5dad00['model'],qs[_0x7432('0x48')](_0x3331a6[_0x7432('0x30')]['fields']));_0x5cb259['attributes']=_0x5cb259[_0x7432('0x33')][_0x7432('0x34')]?_0x5cb259[_0x7432('0x33')]:_0x5dad00[_0x7432('0x2e')];if(_0x3331a6[_0x7432('0x30')][_0x7432('0x40')]){_0x5cb259[_0x7432('0x41')]=[{'all':!![]}];}_0x5cb259=_[_0x7432('0x3e')]({},_0x5cb259,_0x3331a6[_0x7432('0x3f')]);return db[_0x7432('0x2b')][_0x7432('0x49')](_0x5cb259)[_0x7432('0x24')](handleEntityNotFound(_0x2dd4c1,null))['then'](respondWithResult(_0x2dd4c1,null))[_0x7432('0x44')](handleError(_0x2dd4c1,null));};exports['create']=function(_0x4cb6fb,_0x241282){return db[_0x7432('0x2b')][_0x7432('0x4a')](_0x4cb6fb[_0x7432('0x4b')],{})[_0x7432('0x24')](function(_0x1a46a7){var _0x55ec67=_0x4cb6fb[_0x7432('0x4c')][_0x7432('0x25')]({'plain':!![]});if(!_0x55ec67)throw new Error(_0x7432('0x4d'));if(_0x55ec67[_0x7432('0x4e')]==='user'){var _0x501eb2=_0x1a46a7[_0x7432('0x25')]({'plain':!![]});var _0x4cd6d3=_0x7432('0x26');return db['UserProfileSection'][_0x7432('0x49')]({'where':{'name':_0x4cd6d3,'userProfileId':_0x55ec67[_0x7432('0x4f')]},'raw':!![]})['then'](function(_0x4469c1){if(_0x4469c1&&_0x4469c1['autoAssociation']===0x0){return db[_0x7432('0x50')][_0x7432('0x4a')]({'name':_0x501eb2[_0x7432('0x28')],'resourceId':_0x501eb2['id'],'type':_0x4469c1['name'],'sectionId':_0x4469c1['id']},{})[_0x7432('0x24')](function(){return _0x1a46a7;});}else{return _0x1a46a7;}})[_0x7432('0x44')](function(_0x141e00){logger['error'](_0x7432('0x51'),_0x141e00);throw _0x141e00;});}return _0x1a46a7;})[_0x7432('0x24')](respondWithResult(_0x241282,0xc9))[_0x7432('0x44')](handleError(_0x241282,null));};exports[_0x7432('0x52')]=function(_0x36a462,_0x2d6319){if(_0x36a462[_0x7432('0x4b')]['id']){delete _0x36a462['body']['id'];}return db[_0x7432('0x2b')]['find']({'where':{'id':_0x36a462[_0x7432('0x46')]['id']}})[_0x7432('0x24')](handleEntityNotFound(_0x2d6319,null))[_0x7432('0x24')](saveUpdates(_0x36a462[_0x7432('0x4b')],null))[_0x7432('0x24')](respondWithResult(_0x2d6319,null))[_0x7432('0x44')](handleError(_0x2d6319,null));};exports[_0x7432('0x23')]=function(_0x57ad2f,_0xbfcd60){return db['Pause'][_0x7432('0x49')]({'where':{'id':_0x57ad2f[_0x7432('0x46')]['id']}})[_0x7432('0x24')](handleEntityNotFound(_0xbfcd60,null))[_0x7432('0x24')](removeEntity(_0xbfcd60,null))[_0x7432('0x44')](handleError(_0xbfcd60,null));}; \ No newline at end of file +var _0xed98=['params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','Pauses','end','error','stack','name','index','Pause','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4938ae,_0xa6036a){var _0xc070e8=function(_0x1fe630){while(--_0x1fe630){_0x4938ae['push'](_0x4938ae['shift']());}};_0xc070e8(++_0xa6036a);}(_0xed98,0xfd));var _0x8ed9=function(_0x4978dd,_0x12923b){_0x4978dd=_0x4978dd-0x0;var _0x1e9e7c=_0xed98[_0x4978dd];return _0x1e9e7c;};'use strict';var emlformat=require(_0x8ed9('0x0'));var rimraf=require(_0x8ed9('0x1'));var zipdir=require(_0x8ed9('0x2'));var jsonpatch=require(_0x8ed9('0x3'));var rp=require(_0x8ed9('0x4'));var moment=require(_0x8ed9('0x5'));var BPromise=require(_0x8ed9('0x6'));var Mustache=require(_0x8ed9('0x7'));var util=require('util');var path=require(_0x8ed9('0x8'));var sox=require(_0x8ed9('0x9'));var csv=require('to-csv');var ejs=require(_0x8ed9('0xa'));var fs=require('fs');var fs_extra=require(_0x8ed9('0xb'));var _=require(_0x8ed9('0xc'));var squel=require(_0x8ed9('0xd'));var crypto=require(_0x8ed9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8ed9('0xf'));var querystring=require(_0x8ed9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8ed9('0x11'));var qs=require(_0x8ed9('0x12'));var as=require(_0x8ed9('0x13'));var hardwareService=require(_0x8ed9('0x14'));var logger=require(_0x8ed9('0x15'))(_0x8ed9('0x16'));var utils=require(_0x8ed9('0x17'));var config=require(_0x8ed9('0x18'));var licenseUtil=require(_0x8ed9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x521798,_0x14d36e){_0x14d36e=_0x14d36e||0xcc;return function(_0x10e532){if(_0x10e532){return _0x521798[_0x8ed9('0x1a')](_0x14d36e);}return _0x521798[_0x8ed9('0x1b')](_0x14d36e)['end']();};}function respondWithResult(_0x19c892,_0x47504c){_0x47504c=_0x47504c||0xc8;return function(_0x4de14c){if(_0x4de14c){return _0x19c892[_0x8ed9('0x1b')](_0x47504c)[_0x8ed9('0x1c')](_0x4de14c);}};}function respondWithFilteredResult(_0x1a28b7,_0x30da85){return function(_0x4b181e){if(_0x4b181e){var _0x335bc5=typeof _0x30da85['offset']==='undefined'&&typeof _0x30da85['limit']==='undefined';var _0x407ed3=_0x4b181e[_0x8ed9('0x1d')];var _0x137a36=_0x335bc5?0x0:_0x30da85[_0x8ed9('0x1e')];var _0x2b3f32=_0x335bc5?_0x4b181e['count']:_0x30da85[_0x8ed9('0x1e')]+_0x30da85[_0x8ed9('0x1f')];var _0x3c9c12;if(_0x2b3f32>=_0x407ed3){_0x2b3f32=_0x407ed3;_0x3c9c12=0xc8;}else{_0x3c9c12=0xce;}_0x1a28b7[_0x8ed9('0x1b')](_0x3c9c12);return _0x1a28b7['set']('Content-Range',_0x137a36+'-'+_0x2b3f32+'/'+_0x407ed3)[_0x8ed9('0x1c')](_0x4b181e);}return null;};}function patchUpdates(_0x2ad782){return function(_0x37590e){try{jsonpatch[_0x8ed9('0x20')](_0x37590e,_0x2ad782,!![]);}catch(_0x15c669){return BPromise['reject'](_0x15c669);}return _0x37590e[_0x8ed9('0x21')]();};}function saveUpdates(_0x470c7d,_0x47df46){return function(_0x19349b){if(_0x19349b){return _0x19349b[_0x8ed9('0x22')](_0x470c7d)[_0x8ed9('0x23')](function(_0x3b33fe){return _0x3b33fe;});}return null;};}function removeEntity(_0x58f468,_0x26b3b3){return function(_0x1c20d4){if(_0x1c20d4){return _0x1c20d4[_0x8ed9('0x24')]()[_0x8ed9('0x23')](function(){var _0x46e610=_0x1c20d4['get']({'plain':!![]});var _0x50b474=_0x8ed9('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x50b474,'resourceId':_0x46e610['id']}})[_0x8ed9('0x23')](function(){return _0x1c20d4;});})['then'](function(){_0x58f468[_0x8ed9('0x1b')](0xcc)[_0x8ed9('0x26')]();});}};}function handleEntityNotFound(_0x2be3e1,_0x48606d){return function(_0x9962da){if(!_0x9962da){_0x2be3e1[_0x8ed9('0x1a')](0x194);}return _0x9962da;};}function handleError(_0x23827e,_0x553841){_0x553841=_0x553841||0x1f4;return function(_0x569640){logger[_0x8ed9('0x27')](_0x569640[_0x8ed9('0x28')]);if(_0x569640[_0x8ed9('0x29')]){delete _0x569640['name'];}_0x23827e['status'](_0x553841)['send'](_0x569640);};}exports[_0x8ed9('0x2a')]=function(_0x3188f5,_0xd02391){var _0x4b964b={},_0x1c6500={},_0x208b58={'count':0x0,'rows':[]};var _0x2d3f87=_['map'](db[_0x8ed9('0x2b')][_0x8ed9('0x2c')],function(_0x5a30df){return{'name':_0x5a30df[_0x8ed9('0x2d')],'type':_0x5a30df['type'][_0x8ed9('0x2e')]};});_0x1c6500[_0x8ed9('0x2f')]=_[_0x8ed9('0x30')](_0x2d3f87,_0x8ed9('0x29'));_0x1c6500['query']=_[_0x8ed9('0x31')](_0x3188f5[_0x8ed9('0x32')]);_0x1c6500[_0x8ed9('0x33')]=_['intersection'](_0x1c6500[_0x8ed9('0x2f')],_0x1c6500['query']);_0x4b964b['attributes']=_[_0x8ed9('0x34')](_0x1c6500[_0x8ed9('0x2f')],qs[_0x8ed9('0x35')](_0x3188f5['query']['fields']));_0x4b964b['attributes']=_0x4b964b[_0x8ed9('0x36')][_0x8ed9('0x37')]?_0x4b964b[_0x8ed9('0x36')]:_0x1c6500[_0x8ed9('0x2f')];if(!_0x3188f5[_0x8ed9('0x32')][_0x8ed9('0x38')]('nolimit')){_0x4b964b[_0x8ed9('0x1f')]=qs['limit'](_0x3188f5[_0x8ed9('0x32')][_0x8ed9('0x1f')]);_0x4b964b[_0x8ed9('0x1e')]=qs[_0x8ed9('0x1e')](_0x3188f5['query'][_0x8ed9('0x1e')]);}_0x4b964b[_0x8ed9('0x39')]=qs[_0x8ed9('0x3a')](_0x3188f5[_0x8ed9('0x32')]['sort']);_0x4b964b['where']=qs[_0x8ed9('0x33')](_[_0x8ed9('0x3b')](_0x3188f5[_0x8ed9('0x32')],_0x1c6500[_0x8ed9('0x33')]),_0x2d3f87);if(_0x3188f5[_0x8ed9('0x32')][_0x8ed9('0x3c')]){_0x4b964b[_0x8ed9('0x3d')]=_[_0x8ed9('0x3e')](_0x4b964b['where'],{'$or':_[_0x8ed9('0x30')](_0x2d3f87,function(_0x1707c3){if(_0x1707c3[_0x8ed9('0x3f')]!==_0x8ed9('0x40')){var _0xc13d8f={};_0xc13d8f[_0x1707c3['name']]={'$like':'%'+_0x3188f5['query'][_0x8ed9('0x3c')]+'%'};return _0xc13d8f;}})});}_0x4b964b=_[_0x8ed9('0x3e')]({},_0x4b964b,_0x3188f5[_0x8ed9('0x41')]);var _0x35cda8={'where':_0x4b964b[_0x8ed9('0x3d')]};return db[_0x8ed9('0x2b')]['count'](_0x35cda8)[_0x8ed9('0x23')](function(_0x635c39){_0x208b58['count']=_0x635c39;if(_0x3188f5[_0x8ed9('0x32')][_0x8ed9('0x42')]){_0x4b964b[_0x8ed9('0x43')]=[{'all':!![]}];}return db[_0x8ed9('0x2b')][_0x8ed9('0x44')](_0x4b964b);})[_0x8ed9('0x23')](function(_0x25a02e){_0x208b58['rows']=_0x25a02e;return _0x208b58;})[_0x8ed9('0x23')](respondWithFilteredResult(_0xd02391,_0x4b964b))['catch'](handleError(_0xd02391,null));};exports[_0x8ed9('0x45')]=function(_0x22c4ba,_0x226bca){var _0x2de5ee={'raw':!![],'where':{'id':_0x22c4ba['params']['id']}},_0x3a4eed={};_0x3a4eed[_0x8ed9('0x2f')]=_[_0x8ed9('0x31')](db[_0x8ed9('0x2b')][_0x8ed9('0x2c')]);_0x3a4eed['query']=_[_0x8ed9('0x31')](_0x22c4ba['query']);_0x3a4eed['filters']=_[_0x8ed9('0x34')](_0x3a4eed[_0x8ed9('0x2f')],_0x3a4eed[_0x8ed9('0x32')]);_0x2de5ee[_0x8ed9('0x36')]=_['intersection'](_0x3a4eed[_0x8ed9('0x2f')],qs['fields'](_0x22c4ba['query'][_0x8ed9('0x35')]));_0x2de5ee['attributes']=_0x2de5ee[_0x8ed9('0x36')][_0x8ed9('0x37')]?_0x2de5ee[_0x8ed9('0x36')]:_0x3a4eed[_0x8ed9('0x2f')];if(_0x22c4ba['query'][_0x8ed9('0x42')]){_0x2de5ee[_0x8ed9('0x43')]=[{'all':!![]}];}_0x2de5ee=_[_0x8ed9('0x3e')]({},_0x2de5ee,_0x22c4ba[_0x8ed9('0x41')]);return db[_0x8ed9('0x2b')][_0x8ed9('0x46')](_0x2de5ee)[_0x8ed9('0x23')](handleEntityNotFound(_0x226bca,null))['then'](respondWithResult(_0x226bca,null))['catch'](handleError(_0x226bca,null));};exports[_0x8ed9('0x47')]=function(_0xed2b5c,_0x371656){return db[_0x8ed9('0x2b')][_0x8ed9('0x47')](_0xed2b5c[_0x8ed9('0x48')],{})[_0x8ed9('0x23')](function(_0x182fdd){var _0x4c401e=_0xed2b5c[_0x8ed9('0x49')][_0x8ed9('0x4a')]({'plain':!![]});if(!_0x4c401e)throw new Error(_0x8ed9('0x4b'));if(_0x4c401e[_0x8ed9('0x4c')]===_0x8ed9('0x49')){var _0x4ffad3=_0x182fdd[_0x8ed9('0x4a')]({'plain':!![]});var _0x43c9d8=_0x8ed9('0x25');return db[_0x8ed9('0x4d')][_0x8ed9('0x46')]({'where':{'name':_0x43c9d8,'userProfileId':_0x4c401e[_0x8ed9('0x4e')]},'raw':!![]})['then'](function(_0x108c46){if(_0x108c46&&_0x108c46[_0x8ed9('0x4f')]===0x0){return db[_0x8ed9('0x50')][_0x8ed9('0x47')]({'name':_0x4ffad3[_0x8ed9('0x29')],'resourceId':_0x4ffad3['id'],'type':_0x108c46[_0x8ed9('0x29')],'sectionId':_0x108c46['id']},{})[_0x8ed9('0x23')](function(){return _0x182fdd;});}else{return _0x182fdd;}})[_0x8ed9('0x51')](function(_0x300b2a){logger['error'](_0x8ed9('0x52'),_0x300b2a);throw _0x300b2a;});}return _0x182fdd;})[_0x8ed9('0x23')](respondWithResult(_0x371656,0xc9))['catch'](handleError(_0x371656,null));};exports[_0x8ed9('0x22')]=function(_0x527e13,_0x13e6a0){if(_0x527e13[_0x8ed9('0x48')]['id']){delete _0x527e13[_0x8ed9('0x48')]['id'];}return db[_0x8ed9('0x2b')][_0x8ed9('0x46')]({'where':{'id':_0x527e13[_0x8ed9('0x53')]['id']}})[_0x8ed9('0x23')](handleEntityNotFound(_0x13e6a0,null))[_0x8ed9('0x23')](saveUpdates(_0x527e13[_0x8ed9('0x48')],null))[_0x8ed9('0x23')](respondWithResult(_0x13e6a0,null))[_0x8ed9('0x51')](handleError(_0x13e6a0,null));};exports['destroy']=function(_0x463f86,_0x124fb9){return db['Pause'][_0x8ed9('0x46')]({'where':{'id':_0x463f86[_0x8ed9('0x53')]['id']}})['then'](handleEntityNotFound(_0x124fb9,null))['then'](removeEntity(_0x124fb9,null))[_0x8ed9('0x51')](handleError(_0x124fb9,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 738b756..3b272e7 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x8ef6,0xf2));var _0x68ef=function(_0x40fd75,_0xbdabe8){_0x40fd75=_0x40fd75-0x0;var _0xbcb3c=_0x8ef6[_0x40fd75];return _0xbcb3c;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 7375791..fd2ff0a 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(_0x4e3caf,_0x189859){var _0x28c9b9=function(_0x2eae90){while(--_0x2eae90){_0x4e3caf['push'](_0x4e3caf['shift']());}};_0x28c9b9(++_0x189859);}(_0x7a54,0x106));var _0x47a5=function(_0x4ffcc6,_0x5a407a){_0x4ffcc6=_0x4ffcc6-0x0;var _0x168664=_0x7a54[_0x4ffcc6];return _0x168664;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x54d726,_0x4b21ca){var _0x2e6619=function(_0x32e27a){while(--_0x32e27a){_0x54d726['push'](_0x54d726['shift']());}};_0x2e6619(++_0x4b21ca);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c6310,_0x13601d){_0x3c6310=_0x3c6310-0x0;var _0x320122=_0xb10b[_0x3c6310];return _0x320122;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 3efe0c7..1284562 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 _0x5636=['fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','extname','now','post','single','file','delete','exports','multer','util','Router'];(function(_0x42c3fa,_0x5b704c){var _0x29f89b=function(_0x12f7a7){while(--_0x12f7a7){_0x42c3fa['push'](_0x42c3fa['shift']());}};_0x29f89b(++_0x5b704c);}(_0x5636,0x102));var _0x6563=function(_0x5042c1,_0x8f6210){_0x5042c1=_0x5042c1-0x0;var _0x3a2c6c=_0x5636[_0x5042c1];return _0x3a2c6c;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),controller[_0x6563('0xb')]);router[_0x6563('0x7')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router[_0x6563('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x6563('0xe')]);var upload=multer({'storage':multer[_0x6563('0xf')]({'destination':function(_0x490a56,_0x506ee9,_0x5da960){_0x5da960(null,path[_0x6563('0x10')](config[_0x6563('0x11')],_0x6563('0x12')));},'filename':function(_0x12429c,_0x33816e,_0x2ed676){_0x33816e[_0x6563('0x13')]=_0x33816e[_0x6563('0x13')][_0x6563('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2ed676(null,util['format'](_0x6563('0x15'),path['basename'](_0x33816e[_0x6563('0x13')],path[_0x6563('0x16')](_0x33816e[_0x6563('0x13')])),Date[_0x6563('0x17')](),path['extname'](_0x33816e[_0x6563('0x13')])));}})});router[_0x6563('0x18')]('/',upload[_0x6563('0x19')](_0x6563('0x1a')),controller['upload']);router[_0x6563('0x18')]('/webhook',controller['webhookPost']);router['put'](_0x6563('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6563('0x1b')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0x1b')]);module[_0x6563('0x1c')]=router; \ No newline at end of file +var _0x2123=['join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','update','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','isAuthenticated','show','/:id/download','diskStorage'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2123,0x190));var _0x3212=function(_0x1fc7f5,_0x545b65){_0x1fc7f5=_0x1fc7f5-0x0;var _0x5ad8a9=_0x2123[_0x1fc7f5];return _0x5ad8a9;};'use strict';var multer=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var timeout=require(_0x3212('0x3'));var express=require(_0x3212('0x4'));var router=express[_0x3212('0x5')]();var fs_extra=require(_0x3212('0x6'));var auth=require(_0x3212('0x7'));var interaction=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var controller=require(_0x3212('0xa'));router[_0x3212('0xb')]('/',auth['isAuthenticated'](),controller[_0x3212('0xc')]);router[_0x3212('0xb')](_0x3212('0xd'),controller['webhookGet']);router[_0x3212('0xb')]('/:id',auth[_0x3212('0xe')](),controller[_0x3212('0xf')]);router[_0x3212('0xb')](_0x3212('0x10'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x3212('0x11')]({'destination':function(_0xf166c2,_0x1a3b2f,_0x23f7e3){_0x23f7e3(null,path[_0x3212('0x12')](config[_0x3212('0x13')],_0x3212('0x14')));},'filename':function(_0x359cef,_0x26c1c8,_0x2d5fce){_0x26c1c8[_0x3212('0x15')]=_0x26c1c8[_0x3212('0x15')][_0x3212('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d5fce(null,util[_0x3212('0x17')](_0x3212('0x18'),path[_0x3212('0x19')](_0x26c1c8[_0x3212('0x15')],path[_0x3212('0x1a')](_0x26c1c8[_0x3212('0x15')])),Date[_0x3212('0x1b')](),path[_0x3212('0x1a')](_0x26c1c8[_0x3212('0x15')])));}})});router['post']('/',upload[_0x3212('0x1c')](_0x3212('0x1d')),controller[_0x3212('0x1e')]);router[_0x3212('0x1f')](_0x3212('0xd'),controller[_0x3212('0x20')]);router[_0x3212('0x21')]('/:id',auth['isAuthenticated'](),controller[_0x3212('0x22')]);router['delete'](_0x3212('0x23'),auth[_0x3212('0xe')](),controller[_0x3212('0x24')]);module[_0x3212('0x25')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d9305c0..a7d468d 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 _0x5ae9=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5ae9,0x161));var _0x95ae=function(_0x42f247,_0x5bbeca){_0x42f247=_0x42f247-0x0;var _0x411317=_0x5ae9[_0x42f247];return _0x411317;};'use strict';var Sequelize=require(_0x95ae('0x0'));module[_0x95ae('0x1')]={'name':{'type':Sequelize[_0x95ae('0x2')]},'type':{'type':Sequelize[_0x95ae('0x3')](_0x95ae('0x4'),_0x95ae('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x95ae('0x6')]},'path':{'type':Sequelize[_0x95ae('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x95ae('0x7')},'sidebar':{'type':Sequelize[_0x95ae('0x3')](_0x95ae('0x8'),_0x95ae('0x9'),_0x95ae('0xa'),_0x95ae('0xb')),'defaultValue':_0x95ae('0xa'),'comment':_0x95ae('0xc')},'icon':{'type':Sequelize[_0x95ae('0x2')]},'adminUrl':{'type':Sequelize[_0x95ae('0x2')]},'agentUrl':{'type':Sequelize[_0x95ae('0x2')]},'scriptName':{'type':Sequelize[_0x95ae('0x2')]},'scriptPath':{'type':Sequelize[_0x95ae('0x2')]}}; \ No newline at end of file +var _0x6aa4=['STRING','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6aa4,0x8e));var _0x46aa=function(_0x3746ed,_0x584fd7){_0x3746ed=_0x3746ed-0x0;var _0x2eddbd=_0x6aa4[_0x3746ed];return _0x2eddbd;};'use strict';var Sequelize=require(_0x46aa('0x0'));module[_0x46aa('0x1')]={'name':{'type':Sequelize[_0x46aa('0x2')]},'type':{'type':Sequelize['ENUM'](_0x46aa('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x46aa('0x4')]},'path':{'type':Sequelize[_0x46aa('0x2')],'comment':_0x46aa('0x5')},'active':{'type':Sequelize[_0x46aa('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x46aa('0x7')](_0x46aa('0x8'),_0x46aa('0x9'),'always','never'),'defaultValue':_0x46aa('0xa'),'comment':_0x46aa('0xb')},'icon':{'type':Sequelize[_0x46aa('0x2')]},'adminUrl':{'type':Sequelize[_0x46aa('0x2')]},'agentUrl':{'type':Sequelize[_0x46aa('0x2')]},'scriptName':{'type':Sequelize[_0x46aa('0x2')]},'scriptPath':{'type':Sequelize[_0x46aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 1c9d6cc..a275da7 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 _0x8906=['rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','length','options','find','download','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','error','Error','Sequelize','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','catch','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./plugin.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','update','then','Plugins','UserProfileResource','destroy','end','stack','name','send','Plugin'];(function(_0x3ea81f,_0x2194ea){var _0x20655b=function(_0x19d5f2){while(--_0x19d5f2){_0x3ea81f['push'](_0x3ea81f['shift']());}};_0x20655b(++_0x2194ea);}(_0x8906,0x124));var _0x6890=function(_0x1f7e68,_0x52f1d5){_0x1f7e68=_0x1f7e68-0x0;var _0xef3bc=_0x8906[_0x1f7e68];return _0xef3bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6890('0x0'));var zipdir=require(_0x6890('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6890('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6890('0x3'));var util=require('util');var path=require(_0x6890('0x4'));var sox=require(_0x6890('0x5'));var csv=require(_0x6890('0x6'));var ejs=require(_0x6890('0x7'));var fs=require('fs');var fs_extra=require(_0x6890('0x8'));var _=require(_0x6890('0x9'));var squel=require(_0x6890('0xa'));var crypto=require(_0x6890('0xb'));var jsforce=require(_0x6890('0xc'));var deskjs=require(_0x6890('0xd'));var toCsv=require(_0x6890('0x6'));var querystring=require(_0x6890('0xe'));var Papa=require('papaparse');var extract=require(_0x6890('0xf'));var rimraf=require(_0x6890('0x0'));var archiver=require('archiver');var Redis=require(_0x6890('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6890('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6890('0x12'));var logger=require('../../config/logger')(_0x6890('0x13'));var utils=require(_0x6890('0x14'));var config=require(_0x6890('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6890('0x16'))['db'];config[_0x6890('0x17')]=_[_0x6890('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6890('0x17')]));require(_0x6890('0x19'))[_0x6890('0x1a')](socket);function respondWithStatusCode(_0x3ea012,_0x35d9c3){_0x35d9c3=_0x35d9c3||0xcc;return function(_0x4727c0){if(_0x4727c0){return _0x3ea012[_0x6890('0x1b')](_0x35d9c3);}return _0x3ea012[_0x6890('0x1c')](_0x35d9c3)['end']();};}function respondWithResult(_0x1dc575,_0xf6550a){_0xf6550a=_0xf6550a||0xc8;return function(_0x147262){if(_0x147262){return _0x1dc575[_0x6890('0x1c')](_0xf6550a)[_0x6890('0x1d')](_0x147262);}};}function respondWithFilteredResult(_0x337897,_0x2e8fe2){return function(_0xc66714){if(_0xc66714){var _0x2ee9ea=typeof _0x2e8fe2[_0x6890('0x1e')]===_0x6890('0x1f')&&typeof _0x2e8fe2['limit']===_0x6890('0x1f');var _0x23c46a=_0xc66714[_0x6890('0x20')];var _0x5900e1=_0x2ee9ea?0x0:_0x2e8fe2[_0x6890('0x1e')];var _0x47e710=_0x2ee9ea?_0xc66714[_0x6890('0x20')]:_0x2e8fe2[_0x6890('0x1e')]+_0x2e8fe2['limit'];var _0x511839;if(_0x47e710>=_0x23c46a){_0x47e710=_0x23c46a;_0x511839=0xc8;}else{_0x511839=0xce;}_0x337897[_0x6890('0x1c')](_0x511839);return _0x337897[_0x6890('0x21')](_0x6890('0x22'),_0x5900e1+'-'+_0x47e710+'/'+_0x23c46a)[_0x6890('0x1d')](_0xc66714);}return null;};}function patchUpdates(_0x544ec7){return function(_0x48d65f){try{jsonpatch['apply'](_0x48d65f,_0x544ec7,!![]);}catch(_0x680445){return BPromise[_0x6890('0x23')](_0x680445);}return _0x48d65f['save']();};}function saveUpdates(_0x1617e9,_0x4849a7){return function(_0x21acd0){if(_0x21acd0){return _0x21acd0[_0x6890('0x24')](_0x1617e9)[_0x6890('0x25')](function(_0x5495b4){return _0x5495b4;});}return null;};}function removeEntity(_0xb9f01d,_0x26ab74){return function(_0x59d07a){if(_0x59d07a){return _0x59d07a['destroy']()['then'](function(){var _0x14d63d=_0x59d07a['get']({'plain':!![]});var _0x453f5c=_0x6890('0x26');return db[_0x6890('0x27')][_0x6890('0x28')]({'where':{'type':_0x453f5c,'resourceId':_0x14d63d['id']}})['then'](function(){return _0x59d07a;});})['then'](function(){_0xb9f01d[_0x6890('0x1c')](0xcc)[_0x6890('0x29')]();});}};}function handleEntityNotFound(_0x5c9017,_0x400f42){return function(_0x3c7865){if(!_0x3c7865){_0x5c9017[_0x6890('0x1b')](0x194);}return _0x3c7865;};}function handleError(_0x5b90d9,_0x56b82e){_0x56b82e=_0x56b82e||0x1f4;return function(_0x5eae3f){logger['error'](_0x5eae3f[_0x6890('0x2a')]);if(_0x5eae3f[_0x6890('0x2b')]){delete _0x5eae3f[_0x6890('0x2b')];}_0x5b90d9['status'](_0x56b82e)[_0x6890('0x2c')](_0x5eae3f);};}exports['index']=function(_0x3c82ee,_0x4d0404){var _0x16ef6a={},_0x3c5a03={},_0x4c03ab={'count':0x0,'rows':[]};var _0x3d3f54=_['map'](db[_0x6890('0x2d')][_0x6890('0x2e')],function(_0x250111){return{'name':_0x250111[_0x6890('0x2f')],'type':_0x250111[_0x6890('0x30')][_0x6890('0x31')]};});_0x3c5a03['model']=_[_0x6890('0x32')](_0x3d3f54,'name');_0x3c5a03[_0x6890('0x33')]=_[_0x6890('0x34')](_0x3c82ee[_0x6890('0x33')]);_0x3c5a03[_0x6890('0x35')]=_[_0x6890('0x36')](_0x3c5a03[_0x6890('0x37')],_0x3c5a03[_0x6890('0x33')]);_0x16ef6a[_0x6890('0x38')]=_[_0x6890('0x36')](_0x3c5a03[_0x6890('0x37')],qs[_0x6890('0x39')](_0x3c82ee[_0x6890('0x33')][_0x6890('0x39')]));_0x16ef6a['attributes']=_0x16ef6a[_0x6890('0x38')]['length']?_0x16ef6a[_0x6890('0x38')]:_0x3c5a03[_0x6890('0x37')];if(!_0x3c82ee[_0x6890('0x33')][_0x6890('0x3a')](_0x6890('0x3b'))){_0x16ef6a[_0x6890('0x3c')]=qs[_0x6890('0x3c')](_0x3c82ee[_0x6890('0x33')]['limit']);_0x16ef6a['offset']=qs[_0x6890('0x1e')](_0x3c82ee[_0x6890('0x33')]['offset']);}_0x16ef6a[_0x6890('0x3d')]=qs['sort'](_0x3c82ee[_0x6890('0x33')]['sort']);_0x16ef6a[_0x6890('0x3e')]=qs[_0x6890('0x35')](_[_0x6890('0x3f')](_0x3c82ee[_0x6890('0x33')],_0x3c5a03[_0x6890('0x35')]),_0x3d3f54);if(_0x3c82ee[_0x6890('0x33')][_0x6890('0x40')]){_0x16ef6a['where']=_[_0x6890('0x41')](_0x16ef6a[_0x6890('0x3e')],{'$or':_[_0x6890('0x32')](_0x3d3f54,function(_0x16c8fb){if(_0x16c8fb[_0x6890('0x30')]!=='VIRTUAL'){var _0x1e2800={};_0x1e2800[_0x16c8fb[_0x6890('0x2b')]]={'$like':'%'+_0x3c82ee['query'][_0x6890('0x40')]+'%'};return _0x1e2800;}})});}_0x16ef6a=_[_0x6890('0x41')]({},_0x16ef6a,_0x3c82ee['options']);var _0x972eba={'where':_0x16ef6a[_0x6890('0x3e')]};return db[_0x6890('0x2d')][_0x6890('0x20')](_0x972eba)[_0x6890('0x25')](function(_0x14cc20){_0x4c03ab['count']=_0x14cc20;if(_0x3c82ee[_0x6890('0x33')][_0x6890('0x42')]){_0x16ef6a[_0x6890('0x43')]=[{'all':!![]}];}return db['Plugin'][_0x6890('0x44')](_0x16ef6a);})[_0x6890('0x25')](function(_0x2ae06e){_0x4c03ab[_0x6890('0x45')]=_0x2ae06e;return _0x4c03ab;})['then'](respondWithFilteredResult(_0x4d0404,_0x16ef6a))['catch'](handleError(_0x4d0404,null));};exports[_0x6890('0x46')]=function(_0x58db34,_0x3115a6){var _0x4e9d78={'raw':!![],'where':{'id':_0x58db34[_0x6890('0x47')]['id']}},_0x215702={};_0x215702[_0x6890('0x37')]=_['keys'](db[_0x6890('0x2d')][_0x6890('0x2e')]);_0x215702[_0x6890('0x33')]=_[_0x6890('0x34')](_0x58db34[_0x6890('0x33')]);_0x215702[_0x6890('0x35')]=_['intersection'](_0x215702[_0x6890('0x37')],_0x215702[_0x6890('0x33')]);_0x4e9d78[_0x6890('0x38')]=_[_0x6890('0x36')](_0x215702[_0x6890('0x37')],qs[_0x6890('0x39')](_0x58db34['query'][_0x6890('0x39')]));_0x4e9d78[_0x6890('0x38')]=_0x4e9d78[_0x6890('0x38')][_0x6890('0x48')]?_0x4e9d78[_0x6890('0x38')]:_0x215702['model'];if(_0x58db34[_0x6890('0x33')]['includeAll']){_0x4e9d78[_0x6890('0x43')]=[{'all':!![]}];}_0x4e9d78=_[_0x6890('0x41')]({},_0x4e9d78,_0x58db34[_0x6890('0x49')]);return db[_0x6890('0x2d')][_0x6890('0x4a')](_0x4e9d78)['then'](handleEntityNotFound(_0x3115a6,null))[_0x6890('0x25')](respondWithResult(_0x3115a6,null))['catch'](handleError(_0x3115a6,null));};exports[_0x6890('0x4b')]=function(_0x26f493,_0x2f8fef,_0x4c968a){return db[_0x6890('0x2d')][_0x6890('0x4a')]({'where':{'id':_0x26f493[_0x6890('0x47')]['id']},'attributes':[_0x6890('0x2b'),_0x6890('0x4')],'raw':!![]})[_0x6890('0x25')](handleEntityNotFound(_0x2f8fef,null))[_0x6890('0x25')](function(_0x1bd0e8){if(_0x1bd0e8){var _0x129847=path[_0x6890('0x4c')](config[_0x6890('0x4d')],_0x6890('0x4e'),util[_0x6890('0x4f')](_0x6890('0x50'),path[_0x6890('0x51')](_0x1bd0e8[_0x6890('0x4')])));var _0x52cba8=fs['createWriteStream'](_0x129847);var _0x12f56a=archiver(_0x6890('0x52'),{'zlib':{'level':0x9}});_0x12f56a['on'](_0x6890('0x53'),function(_0x252539){if(_0x252539[_0x6890('0x54')]===_0x6890('0x55')){logger[_0x6890('0x56')](_0x252539);}else{throw new db['Sequelize'][(_0x6890('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x12f56a['on']('error',function(_0x5ede34){throw new db[(_0x6890('0x58'))][(_0x6890('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x12f56a[_0x6890('0x59')](_0x52cba8);_0x12f56a[_0x6890('0x5a')](_0x6890('0x5b'),{'cwd':path['join'](config[_0x6890('0x4d')],_0x6890('0x4e'),path[_0x6890('0x5c')](_0x1bd0e8['path'])),'ignore':[path[_0x6890('0x4c')](path[_0x6890('0x51')](_0x1bd0e8[_0x6890('0x4')]),_0x6890('0x5d')),path[_0x6890('0x4c')](path[_0x6890('0x51')](_0x1bd0e8[_0x6890('0x4')]),_0x6890('0x5e'))],'nodir':!![]})[_0x6890('0x5f')]();_0x52cba8['on'](_0x6890('0x60'),function(){if(!fs['existsSync'](_0x129847)){throw new db[(_0x6890('0x58'))][(_0x6890('0x57'))](_0x6890('0x61'));}return _0x2f8fef['download'](_0x129847,util[_0x6890('0x4f')](_0x6890('0x50'),path[_0x6890('0x51')](_0x1bd0e8[_0x6890('0x4')])),function(_0x222a1b){if(_0x222a1b){throw new db[(_0x6890('0x58'))][(_0x6890('0x57'))](_0x6890('0x62'));}fs['unlinkSync'](_0x129847);logger[_0x6890('0x63')]('Download\x20completed');logger[_0x6890('0x63')](_0x6890('0x64'));});});}return null;})[_0x6890('0x65')](handleError(_0x2f8fef,null));};exports[_0x6890('0x66')]=function(_0x3b90a8,_0x109224,_0x485c0f){var _0x17e0e2=path[_0x6890('0x51')](_0x3b90a8[_0x6890('0x67')][_0x6890('0x68')],path[_0x6890('0x69')](_0x3b90a8['file'][_0x6890('0x68')]));var _0x32af2f=path[_0x6890('0x4c')](config[_0x6890('0x4d')],_0x6890('0x4e'),_0x3b90a8['file'][_0x6890('0x68')]);var _0x240934=path[_0x6890('0x4c')](config[_0x6890('0x4d')],_0x6890('0x4e'),_0x17e0e2);logger['info'](_0x6890('0x6a'),_0x32af2f);logger[_0x6890('0x63')](_0x6890('0x6b'),_0x240934);try{fs[_0x6890('0x6c')](_0x32af2f,parseInt('0777',0x8));extract(_0x32af2f,{'dir':_0x240934},function(_0x18382b){if(_0x18382b){logger[_0x6890('0x56')](_0x18382b);handleError(_0x18382b,!![]);};var _0x429bb6=fs['readdirSync'](_0x240934);if(_0x429bb6[_0x6890('0x48')]>0x1){removeReferences(_0x32af2f,_0x240934);logger[_0x6890('0x56')](_0x6890('0x6d'));return _0x485c0f(new Error(_0x6890('0x6d')));}var _0x55a8fd=fs[_0x6890('0x6e')](path[_0x6890('0x4c')](_0x240934,_0x429bb6[0x0]));if(_0x55a8fd[_0x6890('0x6f')]()){removeReferences(_0x32af2f,_0x240934);logger[_0x6890('0x56')]('Invalid\x20plugin\x20structure');return _0x485c0f(new Error(_0x6890('0x6d')));}if(_0x55a8fd[_0x6890('0x70')]()){var _0x5cd91a=fs[_0x6890('0x71')](path['join'](_0x240934,_0x429bb6[0x0]));if(_0x5cd91a[_0x6890('0x48')]===0x0){removeReferences(_0x32af2f,_0x240934);logger[_0x6890('0x56')](_0x6890('0x6d'));return _0x485c0f(new Error(_0x6890('0x6d')));}var _0x1d5450=_0x5cd91a[_0x6890('0x72')](function(_0x4316af){return _0x4316af==='manifest.json';});if(!_0x1d5450){return _0x485c0f(new Error(_0x6890('0x73')));}var _0x4cdd9f=fs[_0x6890('0x74')](path[_0x6890('0x4c')](_0x240934,_0x429bb6[0x0],_0x6890('0x75')));var _0x102044=JSON['parse'](_0x4cdd9f);if(_0x6890('0x1f')==typeof _0x102044[_0x6890('0x2b')]){return _0x485c0f(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x6890('0x1f')==typeof _0x102044[_0x6890('0x30')]){return _0x485c0f(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x6890('0x1f')==typeof _0x102044['version']){return _0x485c0f(new Error(_0x6890('0x76')));}if(_0x6890('0x1f')==typeof _0x102044[_0x6890('0x77')]){return _0x485c0f(new Error(_0x6890('0x78')));}if(_0x102044['type']===_0x6890('0x79')){if(_0x6890('0x1f')==typeof _0x102044[_0x6890('0x77')][_0x6890('0x7a')]){return _0x485c0f(new Error(_0x6890('0x7b')));}if(_0x6890('0x1f')==typeof _0x102044[_0x6890('0x77')][_0x6890('0x7a')][_0x6890('0x7c')]&&'undefined'==typeof _0x102044['parameters']['views'][_0x6890('0x7d')]){return _0x485c0f(new Error(_0x6890('0x7e')));}}else if(_0x102044[_0x6890('0x30')]===_0x6890('0x7f')){if(_0x6890('0x1f')==typeof _0x102044[_0x6890('0x77')][_0x6890('0x80')]){return _0x485c0f(new Error(_0x6890('0x81')));}if('undefined'==typeof _0x102044['parameters'][_0x6890('0x82')]){return _0x485c0f(new Error(_0x6890('0x83')));}}else{return _0x485c0f(new Error(_0x6890('0x84')));}var _0x157b02=_0x102044[_0x6890('0x2b')];var _0x1eeb51=_0x102044['description'];var _0x3293ba=_0x102044[_0x6890('0x30')];var _0x4d5c6a=_0x102044[_0x6890('0x85')]?_0x102044[_0x6890('0x85')]:_0x6890('0x86');var _0x398740=_0x102044[_0x6890('0x87')]?_0x102044[_0x6890('0x87')]:_0x6890('0x88');var _0xfca94a='';var _0x3b0efa='';var _0x51312c='';var _0x810c71='';var _0x49233d=_0x102044[_0x6890('0x89')];if(_0x3293ba==='html'){if(_0x6890('0x1f')!=typeof _0x102044[_0x6890('0x77')][_0x6890('0x7a')]['admin']){var _0x1868d4=_0x102044[_0x6890('0x77')][_0x6890('0x7a')][_0x6890('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x6890('0x8a')](_0x1868d4)){_0xfca94a=path[_0x6890('0x4c')](_0x6890('0x8b'),_0x17e0e2,_0x429bb6[0x0],_0x1868d4);}else{_0xfca94a=_0x1868d4;}}else{logger[_0x6890('0x63')](_0x6890('0x8c'));}if(_0x6890('0x1f')!=typeof _0x102044[_0x6890('0x77')][_0x6890('0x7a')][_0x6890('0x7d')]){var _0x4a47f1=_0x102044[_0x6890('0x77')][_0x6890('0x7a')][_0x6890('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x6890('0x8a')](_0x4a47f1)){_0x3b0efa=path[_0x6890('0x4c')](_0x6890('0x8b'),_0x17e0e2,_0x429bb6[0x0],_0x4a47f1);}else{_0x3b0efa=_0x4a47f1;}}else{logger[_0x6890('0x63')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x3293ba===_0x6890('0x7f')){_0x51312c=_0x102044[_0x6890('0x77')][_0x6890('0x80')];_0x810c71=_0x102044[_0x6890('0x77')][_0x6890('0x82')];if('undefined'!=typeof _0x102044[_0x6890('0x77')][_0x6890('0x7a')]){if('undefined'!=typeof _0x102044[_0x6890('0x77')][_0x6890('0x7a')][_0x6890('0x7c')]){var _0x1868d4=_0x102044[_0x6890('0x77')][_0x6890('0x7a')][_0x6890('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x6890('0x8a')](_0x1868d4)){_0xfca94a=path['join'](_0x6890('0x8b'),_0x17e0e2,_0x429bb6[0x0],_0x1868d4);}else{_0xfca94a=_0x1868d4;}}if('undefined'!=typeof _0x102044['parameters'][_0x6890('0x7a')]['agent']){var _0x4a47f1=_0x102044['parameters'][_0x6890('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x6890('0x8a')](_0x4a47f1)){_0x3b0efa=path['join'](_0x6890('0x8b'),_0x17e0e2,_0x429bb6[0x0],_0x4a47f1);}else{_0x3b0efa=_0x4a47f1;}}}}var _0x4104e2={'name':_0x157b02,'description':_0x1eeb51,'path':path[_0x6890('0x4c')](_0x17e0e2,_0x429bb6[0x0]),'type':_0x3293ba,'sidebar':_0x4d5c6a,'icon':_0x398740,'adminUrl':_0xfca94a,'agentUrl':_0x3b0efa,'scriptName':_0x51312c,'scriptPath':_0x810c71,'version':_0x49233d};removeReferences(_0x32af2f,null);return db[_0x6890('0x2d')][_0x6890('0x8d')](_0x4104e2)[_0x6890('0x25')](function(_0x5e7b6f){var _0x3d3cc6={'role':_0x3b90a8[_0x6890('0x8e')]['role'],'userProfileId':_0x3b90a8[_0x6890('0x8e')][_0x6890('0x8f')]};if(!_0x3d3cc6)throw new Error(_0x6890('0x90'));if(_0x3d3cc6[_0x6890('0x91')]===_0x6890('0x92')){var _0x3722d8=_0x5e7b6f[_0x6890('0x93')]({'plain':!![]});return db['UserProfileSection'][_0x6890('0x4a')]({'where':{'name':_0x6890('0x26'),'userProfileId':_0x3d3cc6['userProfileId']},'raw':!![]})['then'](function(_0x54822c){if(_0x54822c&&_0x54822c['autoAssociation']===0x0){return db[_0x6890('0x27')][_0x6890('0x8d')]({'name':_0x3722d8[_0x6890('0x2b')],'resourceId':_0x3722d8['id'],'type':_0x54822c['name'],'sectionId':_0x54822c['id']},{})[_0x6890('0x25')](function(){return _0x5e7b6f;});}else{return _0x5e7b6f;}})[_0x6890('0x65')](function(_0x5ab604){logger[_0x6890('0x56')](_0x6890('0x94'),_0x5ab604);throw _0x5ab604;});}return _0x5e7b6f;})[_0x6890('0x25')](respondWithResult(_0x109224,null))['catch'](handleError(_0x109224,null));}});}catch(_0x4650a1){_0x109224[_0x6890('0x1c')](0x1f4)[_0x6890('0x2c')](_0x4650a1);}};function removeReferences(_0x48ef32,_0x56b966){try{if(_0x48ef32){fs[_0x6890('0x95')](_0x48ef32);logger[_0x6890('0x63')](_0x6890('0x96'));}if(_0x56b966){rimraf(_0x56b966,function(){});logger[_0x6890('0x63')](_0x6890('0x97'));}}catch(_0x200e57){logger[_0x6890('0x56')](_0x200e57);}}exports[_0x6890('0x24')]=function(_0x2ae6e1,_0x1e1411,_0x662540){return db[_0x6890('0x2d')][_0x6890('0x4a')]({'where':{'id':_0x2ae6e1[_0x6890('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e1411,null))['then'](saveUpdates(_0x2ae6e1[_0x6890('0x8e')],null))['then'](respondWithResult(_0x1e1411,null))[_0x6890('0x65')](handleError(_0x1e1411,null));};exports[_0x6890('0x98')]=function(_0x35ae0e,_0x5148a8,_0x4a4578){return db[_0x6890('0x2d')][_0x6890('0x4a')]({'where':{'id':_0x35ae0e[_0x6890('0x47')]['id']}})[_0x6890('0x25')](function(_0xd98bf4){if(_0xd98bf4){return _0xd98bf4[_0x6890('0x28')]();}})['then'](function(_0x28b7b8){rimraf(path[_0x6890('0x4c')](config[_0x6890('0x4d')],_0x6890('0x4e'),path[_0x6890('0x5c')](_0x28b7b8[_0x6890('0x4')])),function(){});return _0x28b7b8;})[_0x6890('0x25')](handleEntityNotFound(_0x5148a8,null))[_0x6890('0x25')](respondWithStatusCode(_0x5148a8,null))[_0x6890('0x65')](handleError(_0x5148a8,null));};exports[_0x6890('0x99')]=function(_0x1187c0,_0x31b516,_0x29051b){return BPromise[_0x6890('0x9a')]()[_0x6890('0x25')](function(){if(!_0x1187c0[_0x6890('0x33')][_0x6890('0x4')]){throw new Error(_0x6890('0x9b'));}if(!_0x1187c0[_0x6890('0x33')][_0x6890('0x9c')]){throw new Error(_0x6890('0x9d'));}var _0xcb8e64=_0x1187c0[_0x6890('0x33')][_0x6890('0x9e')]?_0x1187c0[_0x6890('0x33')][_0x6890('0x9e')]+':'+_0x1187c0[_0x6890('0x33')][_0x6890('0x9c')]:_0x6890('0x9f')+_0x1187c0[_0x6890('0x33')][_0x6890('0x9c')];var _0x4b1efd=_0x1187c0['query'][_0x6890('0x1d')]?_0x1187c0['query']['json']:!![];var _0x5bd40c=_0x1187c0[_0x6890('0x33')][_0x6890('0xa0')]?_0x1187c0['query'][_0x6890('0xa0')]:null;var _0x16401f={'method':_0x1187c0[_0x6890('0xa1')],'uri':util[_0x6890('0x4f')]('%s%s',_0xcb8e64,_0x1187c0['query']['path']),'json':_0x4b1efd,'resolveWithFullResponse':!![],'encoding':_0x5bd40c,'qs':_0x1187c0[_0x6890('0x33')]};if(_0x1187c0['headers']){_0x16401f[_0x6890('0xa2')]=_0x1187c0['headers'];if(_0x16401f['headers'][_0x6890('0xa3')]){delete _0x16401f[_0x6890('0xa2')][_0x6890('0xa3')];}}if(_0x16401f[_0x6890('0xa2')][_0x6890('0xa4')]){delete _0x16401f[_0x6890('0xa2')]['content-type'];}return rp(_0x16401f);})[_0x6890('0x25')](function(_0x35c4f5){if(_0x35c4f5){_0x31b516[_0x6890('0x21')](_0x35c4f5[_0x6890('0xa2')]);logger[_0x6890('0x63')](_0x35c4f5[_0x6890('0x8e')]);if(_[_0x6890('0xa5')](_0x1187c0[_0x6890('0x33')][_0x6890('0x4')],_0x6890('0x4b'))&&_0x35c4f5[_0x6890('0xa6')]==0x1f4){return _0x31b516[_0x6890('0x1b')](_0x35c4f5[_0x6890('0xa6')]);}else{return _0x31b516[_0x6890('0x1c')](_0x35c4f5[_0x6890('0xa6')])['send'](_0x35c4f5['body']);}}else{return _0x31b516['sendStatus'](0xc8);}})[_0x6890('0x65')](handleError(_0x31b516,null));};exports[_0x6890('0xa7')]=function(_0x10c369,_0x254065,_0x1202a1){return BPromise[_0x6890('0x9a')]()['then'](function(){if(!_0x10c369['query'][_0x6890('0x4')]){throw new Error(_0x6890('0x9b'));}if(!_0x10c369[_0x6890('0x33')][_0x6890('0x9c')]){throw new Error(_0x6890('0x9d'));}var _0x589d33=_0x10c369[_0x6890('0x33')][_0x6890('0x9e')]?_0x10c369[_0x6890('0x33')]['hostname']+':'+_0x10c369[_0x6890('0x33')][_0x6890('0x9c')]:_0x6890('0x9f')+_0x10c369[_0x6890('0x33')][_0x6890('0x9c')];var _0x26e53a=_0x10c369[_0x6890('0x33')]['json']?_0x10c369[_0x6890('0x33')][_0x6890('0x1d')]:!![];var _0x31d441=_0x10c369['query']['encoding']?_0x10c369[_0x6890('0x33')][_0x6890('0xa0')]:null;var _0x15092f={'method':_0x10c369['method'],'uri':util[_0x6890('0x4f')](_0x6890('0xa8'),_0x589d33,_0x10c369[_0x6890('0x33')][_0x6890('0x4')]),'json':_0x26e53a,'resolveWithFullResponse':!![],'encoding':_0x31d441,'body':_0x10c369[_0x6890('0x8e')]};if(_0x10c369[_0x6890('0xa2')]){_0x15092f[_0x6890('0xa2')]=_0x10c369['headers'];if(_0x15092f[_0x6890('0xa2')][_0x6890('0xa3')]){delete _0x15092f[_0x6890('0xa2')][_0x6890('0xa3')];}}if(_0x15092f[_0x6890('0xa2')][_0x6890('0xa4')]){delete _0x15092f['headers']['content-type'];}return rp(_0x15092f);})['then'](function(_0x14d932){if(_0x14d932){_0x254065[_0x6890('0x21')](_0x14d932['headers']);logger[_0x6890('0x63')](_0x14d932[_0x6890('0x8e')]);return _0x254065[_0x6890('0x1c')](_0x14d932['statusCode'])[_0x6890('0x2c')](_0x14d932[_0x6890('0x8e')]);}else{return _0x254065[_0x6890('0x1b')](0xc8);}})[_0x6890('0x65')](handleError(_0x254065,null));}; \ No newline at end of file +var _0x934c=['lstatSync','isDirectory','readdirSync','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','dirname','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','resolve','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','extract-zip','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./plugin.socket','register','status','json','limit','undefined','offset','count','set','Content-Range','save','then','get','sendStatus','error','stack','name','send','index','Plugin','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','fields','find','download','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','file','extname','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure'];(function(_0x214bd7,_0x9d5a1a){var _0x1f3be5=function(_0xf53540){while(--_0xf53540){_0x214bd7['push'](_0x214bd7['shift']());}};_0x1f3be5(++_0x9d5a1a);}(_0x934c,0xd3));var _0xc934=function(_0x385b4e,_0x206ce9){_0x385b4e=_0x385b4e-0x0;var _0x593af1=_0x934c[_0x385b4e];return _0x593af1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc934('0x0'));var zipdir=require(_0xc934('0x1'));var jsonpatch=require(_0xc934('0x2'));var rp=require('request-promise');var moment=require(_0xc934('0x3'));var BPromise=require(_0xc934('0x4'));var Mustache=require(_0xc934('0x5'));var util=require('util');var path=require(_0xc934('0x6'));var sox=require(_0xc934('0x7'));var csv=require(_0xc934('0x8'));var ejs=require(_0xc934('0x9'));var fs=require('fs');var fs_extra=require(_0xc934('0xa'));var _=require(_0xc934('0xb'));var squel=require('squel');var crypto=require(_0xc934('0xc'));var jsforce=require(_0xc934('0xd'));var deskjs=require(_0xc934('0xe'));var toCsv=require(_0xc934('0x8'));var querystring=require('querystring');var Papa=require(_0xc934('0xf'));var extract=require(_0xc934('0x10'));var rimraf=require(_0xc934('0x0'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xc934('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc934('0x12'));var hardwareService=require(_0xc934('0x13'));var logger=require(_0xc934('0x14'))('api');var utils=require(_0xc934('0x15'));var config=require(_0xc934('0x16'));var licenseUtil=require(_0xc934('0x17'));var db=require(_0xc934('0x18'))['db'];config['redis']=_[_0xc934('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc934('0x1a'))(new Redis(config[_0xc934('0x1b')]));require(_0xc934('0x1c'))[_0xc934('0x1d')](socket);function respondWithStatusCode(_0x241d66,_0x4aadec){_0x4aadec=_0x4aadec||0xcc;return function(_0xab32ce){if(_0xab32ce){return _0x241d66['sendStatus'](_0x4aadec);}return _0x241d66[_0xc934('0x1e')](_0x4aadec)['end']();};}function respondWithResult(_0x4549a3,_0x3194e6){_0x3194e6=_0x3194e6||0xc8;return function(_0x184123){if(_0x184123){return _0x4549a3[_0xc934('0x1e')](_0x3194e6)[_0xc934('0x1f')](_0x184123);}};}function respondWithFilteredResult(_0x3cfaf2,_0x3a3ce8){return function(_0xbe012a){if(_0xbe012a){var _0x3c6442=typeof _0x3a3ce8['offset']==='undefined'&&typeof _0x3a3ce8[_0xc934('0x20')]===_0xc934('0x21');var _0x4c5f35=_0xbe012a['count'];var _0x18d4a9=_0x3c6442?0x0:_0x3a3ce8[_0xc934('0x22')];var _0x206790=_0x3c6442?_0xbe012a[_0xc934('0x23')]:_0x3a3ce8[_0xc934('0x22')]+_0x3a3ce8[_0xc934('0x20')];var _0x434226;if(_0x206790>=_0x4c5f35){_0x206790=_0x4c5f35;_0x434226=0xc8;}else{_0x434226=0xce;}_0x3cfaf2[_0xc934('0x1e')](_0x434226);return _0x3cfaf2[_0xc934('0x24')](_0xc934('0x25'),_0x18d4a9+'-'+_0x206790+'/'+_0x4c5f35)['json'](_0xbe012a);}return null;};}function patchUpdates(_0x34dd90){return function(_0x4d210b){try{jsonpatch['apply'](_0x4d210b,_0x34dd90,!![]);}catch(_0x7ce53f){return BPromise['reject'](_0x7ce53f);}return _0x4d210b[_0xc934('0x26')]();};}function saveUpdates(_0x77b675,_0x11f081){return function(_0x92904a){if(_0x92904a){return _0x92904a['update'](_0x77b675)[_0xc934('0x27')](function(_0x53a72c){return _0x53a72c;});}return null;};}function removeEntity(_0x35fffe,_0x2525cf){return function(_0x51858f){if(_0x51858f){return _0x51858f['destroy']()[_0xc934('0x27')](function(){var _0x553025=_0x51858f[_0xc934('0x28')]({'plain':!![]});var _0x3fb339='Plugins';return db['UserProfileResource']['destroy']({'where':{'type':_0x3fb339,'resourceId':_0x553025['id']}})[_0xc934('0x27')](function(){return _0x51858f;});})[_0xc934('0x27')](function(){_0x35fffe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a8d51,_0x553de8){return function(_0x5057cd){if(!_0x5057cd){_0x5a8d51[_0xc934('0x29')](0x194);}return _0x5057cd;};}function handleError(_0x341692,_0x443947){_0x443947=_0x443947||0x1f4;return function(_0x578a03){logger[_0xc934('0x2a')](_0x578a03[_0xc934('0x2b')]);if(_0x578a03['name']){delete _0x578a03[_0xc934('0x2c')];}_0x341692['status'](_0x443947)[_0xc934('0x2d')](_0x578a03);};}exports[_0xc934('0x2e')]=function(_0x3876ff,_0x51a41f){var _0x12ad58={},_0x3fbe1b={},_0x264970={'count':0x0,'rows':[]};var _0x2a05a5=_['map'](db[_0xc934('0x2f')][_0xc934('0x30')],function(_0x5d7669){return{'name':_0x5d7669[_0xc934('0x31')],'type':_0x5d7669[_0xc934('0x32')][_0xc934('0x33')]};});_0x3fbe1b[_0xc934('0x34')]=_[_0xc934('0x35')](_0x2a05a5,_0xc934('0x2c'));_0x3fbe1b[_0xc934('0x36')]=_[_0xc934('0x37')](_0x3876ff[_0xc934('0x36')]);_0x3fbe1b[_0xc934('0x38')]=_[_0xc934('0x39')](_0x3fbe1b[_0xc934('0x34')],_0x3fbe1b[_0xc934('0x36')]);_0x12ad58[_0xc934('0x3a')]=_['intersection'](_0x3fbe1b[_0xc934('0x34')],qs['fields'](_0x3876ff[_0xc934('0x36')]['fields']));_0x12ad58[_0xc934('0x3a')]=_0x12ad58['attributes'][_0xc934('0x3b')]?_0x12ad58[_0xc934('0x3a')]:_0x3fbe1b[_0xc934('0x34')];if(!_0x3876ff[_0xc934('0x36')]['hasOwnProperty'](_0xc934('0x3c'))){_0x12ad58['limit']=qs[_0xc934('0x20')](_0x3876ff['query'][_0xc934('0x20')]);_0x12ad58[_0xc934('0x22')]=qs[_0xc934('0x22')](_0x3876ff[_0xc934('0x36')][_0xc934('0x22')]);}_0x12ad58['order']=qs[_0xc934('0x3d')](_0x3876ff[_0xc934('0x36')][_0xc934('0x3d')]);_0x12ad58[_0xc934('0x3e')]=qs[_0xc934('0x38')](_[_0xc934('0x3f')](_0x3876ff['query'],_0x3fbe1b[_0xc934('0x38')]),_0x2a05a5);if(_0x3876ff['query'][_0xc934('0x40')]){_0x12ad58[_0xc934('0x3e')]=_[_0xc934('0x41')](_0x12ad58[_0xc934('0x3e')],{'$or':_['map'](_0x2a05a5,function(_0x5c07c5){if(_0x5c07c5['type']!==_0xc934('0x42')){var _0x26727e={};_0x26727e[_0x5c07c5['name']]={'$like':'%'+_0x3876ff['query'][_0xc934('0x40')]+'%'};return _0x26727e;}})});}_0x12ad58=_['merge']({},_0x12ad58,_0x3876ff[_0xc934('0x43')]);var _0x241d1c={'where':_0x12ad58[_0xc934('0x3e')]};return db['Plugin'][_0xc934('0x23')](_0x241d1c)['then'](function(_0x133589){_0x264970[_0xc934('0x23')]=_0x133589;if(_0x3876ff[_0xc934('0x36')][_0xc934('0x44')]){_0x12ad58[_0xc934('0x45')]=[{'all':!![]}];}return db[_0xc934('0x2f')][_0xc934('0x46')](_0x12ad58);})[_0xc934('0x27')](function(_0x30e383){_0x264970[_0xc934('0x47')]=_0x30e383;return _0x264970;})[_0xc934('0x27')](respondWithFilteredResult(_0x51a41f,_0x12ad58))[_0xc934('0x48')](handleError(_0x51a41f,null));};exports['show']=function(_0x2bf832,_0x2c89ff){var _0x30491a={'raw':!![],'where':{'id':_0x2bf832['params']['id']}},_0x2634f8={};_0x2634f8['model']=_['keys'](db[_0xc934('0x2f')]['rawAttributes']);_0x2634f8[_0xc934('0x36')]=_[_0xc934('0x37')](_0x2bf832[_0xc934('0x36')]);_0x2634f8[_0xc934('0x38')]=_['intersection'](_0x2634f8[_0xc934('0x34')],_0x2634f8[_0xc934('0x36')]);_0x30491a[_0xc934('0x3a')]=_[_0xc934('0x39')](_0x2634f8[_0xc934('0x34')],qs[_0xc934('0x49')](_0x2bf832[_0xc934('0x36')][_0xc934('0x49')]));_0x30491a[_0xc934('0x3a')]=_0x30491a['attributes'][_0xc934('0x3b')]?_0x30491a[_0xc934('0x3a')]:_0x2634f8['model'];if(_0x2bf832[_0xc934('0x36')][_0xc934('0x44')]){_0x30491a['include']=[{'all':!![]}];}_0x30491a=_[_0xc934('0x41')]({},_0x30491a,_0x2bf832[_0xc934('0x43')]);return db['Plugin'][_0xc934('0x4a')](_0x30491a)['then'](handleEntityNotFound(_0x2c89ff,null))[_0xc934('0x27')](respondWithResult(_0x2c89ff,null))[_0xc934('0x48')](handleError(_0x2c89ff,null));};exports[_0xc934('0x4b')]=function(_0x3fcc1f,_0x5397c8,_0x4ad659){return db[_0xc934('0x2f')]['find']({'where':{'id':_0x3fcc1f[_0xc934('0x4c')]['id']},'attributes':[_0xc934('0x2c'),_0xc934('0x6')],'raw':!![]})[_0xc934('0x27')](handleEntityNotFound(_0x5397c8,null))[_0xc934('0x27')](function(_0xd31cae){if(_0xd31cae){var _0x17e324=path[_0xc934('0x4d')](config[_0xc934('0x4e')],_0xc934('0x4f'),util[_0xc934('0x50')](_0xc934('0x51'),path[_0xc934('0x52')](_0xd31cae['path'])));var _0x56b115=fs[_0xc934('0x53')](_0x17e324);var _0x180c81=archiver('zip',{'zlib':{'level':0x9}});_0x180c81['on']('warning',function(_0x358752){if(_0x358752[_0xc934('0x54')]===_0xc934('0x55')){logger[_0xc934('0x2a')](_0x358752);}else{throw new db[(_0xc934('0x56'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x180c81['on'](_0xc934('0x2a'),function(_0x438dc8){throw new db[(_0xc934('0x56'))][(_0xc934('0x57'))](_0xc934('0x58'));});_0x180c81[_0xc934('0x59')](_0x56b115);_0x180c81['glob'](_0xc934('0x5a'),{'cwd':path[_0xc934('0x4d')](config[_0xc934('0x4e')],_0xc934('0x4f'),path['dirname'](_0xd31cae[_0xc934('0x6')])),'ignore':[path['join'](path[_0xc934('0x52')](_0xd31cae[_0xc934('0x6')]),'node_modules/**/*'),path[_0xc934('0x4d')](path['basename'](_0xd31cae['path']),_0xc934('0x5b'))],'nodir':!![]})[_0xc934('0x5c')]();_0x56b115['on'](_0xc934('0x5d'),function(){if(!fs[_0xc934('0x5e')](_0x17e324)){throw new db[(_0xc934('0x56'))][(_0xc934('0x57'))]('Plugin\x20not\x20found');}return _0x5397c8[_0xc934('0x4b')](_0x17e324,util['format']('%s.zip',path[_0xc934('0x52')](_0xd31cae[_0xc934('0x6')])),function(_0x5b023f){if(_0x5b023f){throw new db[(_0xc934('0x56'))][(_0xc934('0x57'))](_0xc934('0x5f'));}fs[_0xc934('0x60')](_0x17e324);logger[_0xc934('0x61')](_0xc934('0x62'));logger[_0xc934('0x61')]('Temporary\x20file\x20removed');});});}return null;})[_0xc934('0x48')](handleError(_0x5397c8,null));};exports['upload']=function(_0x4f62fd,_0x2f774e,_0x61c282){var _0x3fd31e=path[_0xc934('0x52')](_0x4f62fd[_0xc934('0x63')]['filename'],path[_0xc934('0x64')](_0x4f62fd['file'][_0xc934('0x65')]));var _0x1b4547=path[_0xc934('0x4d')](config[_0xc934('0x4e')],'server/files/plugins',_0x4f62fd[_0xc934('0x63')][_0xc934('0x65')]);var _0x465bf9=path['join'](config['root'],_0xc934('0x4f'),_0x3fd31e);logger[_0xc934('0x61')]('Plugin\x20upload\x20filepath:\x20%s',_0x1b4547);logger['info'](_0xc934('0x66'),_0x465bf9);try{fs[_0xc934('0x67')](_0x1b4547,parseInt('0777',0x8));extract(_0x1b4547,{'dir':_0x465bf9},function(_0x1a2f6c){if(_0x1a2f6c){logger[_0xc934('0x2a')](_0x1a2f6c);handleError(_0x1a2f6c,!![]);};var _0x558b4f=fs['readdirSync'](_0x465bf9);if(_0x558b4f[_0xc934('0x3b')]>0x1){removeReferences(_0x1b4547,_0x465bf9);logger[_0xc934('0x2a')]('Invalid\x20plugin\x20structure');return _0x61c282(new Error(_0xc934('0x68')));}var _0x14a222=fs[_0xc934('0x69')](path[_0xc934('0x4d')](_0x465bf9,_0x558b4f[0x0]));if(_0x14a222['isFile']()){removeReferences(_0x1b4547,_0x465bf9);logger[_0xc934('0x2a')](_0xc934('0x68'));return _0x61c282(new Error('Invalid\x20plugin\x20structure'));}if(_0x14a222[_0xc934('0x6a')]()){var _0x2b72ab=fs[_0xc934('0x6b')](path['join'](_0x465bf9,_0x558b4f[0x0]));if(_0x2b72ab[_0xc934('0x3b')]===0x0){removeReferences(_0x1b4547,_0x465bf9);logger[_0xc934('0x2a')]('Invalid\x20plugin\x20structure');return _0x61c282(new Error('Invalid\x20plugin\x20structure'));}var _0x2fe2f2=_0x2b72ab['some'](function(_0x4c6b4a){return _0x4c6b4a==='manifest.json';});if(!_0x2fe2f2){return _0x61c282(new Error(_0xc934('0x6c')));}var _0xe03750=fs[_0xc934('0x6d')](path[_0xc934('0x4d')](_0x465bf9,_0x558b4f[0x0],_0xc934('0x6e')));var _0x318981=JSON['parse'](_0xe03750);if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x2c')]){return _0x61c282(new Error(_0xc934('0x6f')));}if('undefined'==typeof _0x318981[_0xc934('0x32')]){return _0x61c282(new Error(_0xc934('0x70')));}if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x71')]){return _0x61c282(new Error(_0xc934('0x72')));}if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x73')]){return _0x61c282(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x318981['type']===_0xc934('0x74')){if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')]){return _0x61c282(new Error(_0xc934('0x76')));}if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')][_0xc934('0x77')]&&'undefined'==typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')]['agent']){return _0x61c282(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x318981[_0xc934('0x32')]===_0xc934('0x78')){if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x73')][_0xc934('0x79')]){return _0x61c282(new Error(_0xc934('0x7a')));}if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x73')][_0xc934('0x7b')]){return _0x61c282(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x61c282(new Error(_0xc934('0x7c')));}var _0x153b57=_0x318981['name'];var _0x10e5ad=_0x318981['description'];var _0x4fa1d5=_0x318981[_0xc934('0x32')];var _0x4f140d=_0x318981[_0xc934('0x7d')]?_0x318981[_0xc934('0x7d')]:_0xc934('0x7e');var _0x3806f2=_0x318981['icon']?_0x318981['icon']:_0xc934('0x7f');var _0x18277e='';var _0x52a7ac='';var _0x365041='';var _0x14b707='';var _0xf135c5=_0x318981['version'];if(_0x4fa1d5===_0xc934('0x74')){if(_0xc934('0x21')!=typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')][_0xc934('0x77')]){var _0x4649dc=_0x318981[_0xc934('0x73')][_0xc934('0x75')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4649dc)){_0x18277e=path[_0xc934('0x4d')](_0xc934('0x80'),_0x3fd31e,_0x558b4f[0x0],_0x4649dc);}else{_0x18277e=_0x4649dc;}}else{logger[_0xc934('0x61')](_0xc934('0x81'));}if(_0xc934('0x21')!=typeof _0x318981['parameters']['views'][_0xc934('0x82')]){var _0x181661=_0x318981[_0xc934('0x73')][_0xc934('0x75')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x181661)){_0x52a7ac=path[_0xc934('0x4d')](_0xc934('0x80'),_0x3fd31e,_0x558b4f[0x0],_0x181661);}else{_0x52a7ac=_0x181661;}}else{logger[_0xc934('0x61')](_0xc934('0x83'));}}else if(_0x4fa1d5===_0xc934('0x78')){_0x365041=_0x318981[_0xc934('0x73')][_0xc934('0x79')];_0x14b707=_0x318981['parameters']['scriptPath'];if(_0xc934('0x21')!=typeof _0x318981['parameters'][_0xc934('0x75')]){if(_0xc934('0x21')!=typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')][_0xc934('0x77')]){var _0x4649dc=_0x318981[_0xc934('0x73')][_0xc934('0x75')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4649dc)){_0x18277e=path[_0xc934('0x4d')]('plugins',_0x3fd31e,_0x558b4f[0x0],_0x4649dc);}else{_0x18277e=_0x4649dc;}}if('undefined'!=typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')][_0xc934('0x82')]){var _0x181661=_0x318981['parameters'][_0xc934('0x75')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x181661)){_0x52a7ac=path[_0xc934('0x4d')]('plugins',_0x3fd31e,_0x558b4f[0x0],_0x181661);}else{_0x52a7ac=_0x181661;}}}}var _0x31357f={'name':_0x153b57,'description':_0x10e5ad,'path':path[_0xc934('0x4d')](_0x3fd31e,_0x558b4f[0x0]),'type':_0x4fa1d5,'sidebar':_0x4f140d,'icon':_0x3806f2,'adminUrl':_0x18277e,'agentUrl':_0x52a7ac,'scriptName':_0x365041,'scriptPath':_0x14b707,'version':_0xf135c5};removeReferences(_0x1b4547,null);return db[_0xc934('0x2f')]['create'](_0x31357f)[_0xc934('0x27')](function(_0x20fd70){var _0x56f926={'role':_0x4f62fd[_0xc934('0x84')][_0xc934('0x85')],'userProfileId':_0x4f62fd['body']['userProfileId']};if(!_0x56f926)throw new Error(_0xc934('0x86'));if(_0x56f926[_0xc934('0x85')]===_0xc934('0x87')){var _0x496774=_0x20fd70['get']({'plain':!![]});return db['UserProfileSection'][_0xc934('0x4a')]({'where':{'name':_0xc934('0x88'),'userProfileId':_0x56f926['userProfileId']},'raw':!![]})[_0xc934('0x27')](function(_0x59f7f3){if(_0x59f7f3&&_0x59f7f3['autoAssociation']===0x0){return db[_0xc934('0x89')]['create']({'name':_0x496774[_0xc934('0x2c')],'resourceId':_0x496774['id'],'type':_0x59f7f3['name'],'sectionId':_0x59f7f3['id']},{})[_0xc934('0x27')](function(){return _0x20fd70;});}else{return _0x20fd70;}})[_0xc934('0x48')](function(_0x4e595c){logger[_0xc934('0x2a')](_0xc934('0x8a'),_0x4e595c);throw _0x4e595c;});}return _0x20fd70;})[_0xc934('0x27')](respondWithResult(_0x2f774e,null))[_0xc934('0x48')](handleError(_0x2f774e,null));}});}catch(_0x184043){_0x2f774e['status'](0x1f4)[_0xc934('0x2d')](_0x184043);}};function removeReferences(_0x40345a,_0xb33187){try{if(_0x40345a){fs[_0xc934('0x60')](_0x40345a);logger[_0xc934('0x61')](_0xc934('0x8b'));}if(_0xb33187){rimraf(_0xb33187,function(){});logger['info'](_0xc934('0x8c'));}}catch(_0x444596){logger[_0xc934('0x2a')](_0x444596);}}exports[_0xc934('0x8d')]=function(_0x242914,_0x361cfb,_0x3ea320){return db[_0xc934('0x2f')]['find']({'where':{'id':_0x242914[_0xc934('0x4c')]['id']}})['then'](handleEntityNotFound(_0x361cfb,null))[_0xc934('0x27')](saveUpdates(_0x242914[_0xc934('0x84')],null))['then'](respondWithResult(_0x361cfb,null))['catch'](handleError(_0x361cfb,null));};exports[_0xc934('0x8e')]=function(_0x356922,_0x340254,_0xceac4){return db[_0xc934('0x2f')][_0xc934('0x4a')]({'where':{'id':_0x356922['params']['id']}})[_0xc934('0x27')](function(_0x4159d1){if(_0x4159d1){return _0x4159d1['destroy']();}})[_0xc934('0x27')](function(_0x4fae62){rimraf(path[_0xc934('0x4d')](config[_0xc934('0x4e')],_0xc934('0x4f'),path[_0xc934('0x8f')](_0x4fae62[_0xc934('0x6')])),function(){});return _0x4fae62;})[_0xc934('0x27')](handleEntityNotFound(_0x340254,null))[_0xc934('0x27')](respondWithStatusCode(_0x340254,null))[_0xc934('0x48')](handleError(_0x340254,null));};exports['webhookGet']=function(_0x55acff,_0x1b0337,_0x8f40e9){return BPromise['resolve']()[_0xc934('0x27')](function(){if(!_0x55acff[_0xc934('0x36')][_0xc934('0x6')]){throw new Error(_0xc934('0x90'));}if(!_0x55acff[_0xc934('0x36')][_0xc934('0x91')]){throw new Error(_0xc934('0x92'));}var _0x4fd2e1=_0x55acff[_0xc934('0x36')][_0xc934('0x93')]?_0x55acff[_0xc934('0x36')]['hostname']+':'+_0x55acff[_0xc934('0x36')][_0xc934('0x91')]:_0xc934('0x94')+_0x55acff[_0xc934('0x36')][_0xc934('0x91')];var _0x5ef64d=_0x55acff[_0xc934('0x36')][_0xc934('0x1f')]?_0x55acff[_0xc934('0x36')][_0xc934('0x1f')]:!![];var _0x379205=_0x55acff[_0xc934('0x36')][_0xc934('0x95')]?_0x55acff[_0xc934('0x36')][_0xc934('0x95')]:null;var _0x3c3bfc={'method':_0x55acff[_0xc934('0x96')],'uri':util[_0xc934('0x50')](_0xc934('0x97'),_0x4fd2e1,_0x55acff['query'][_0xc934('0x6')]),'json':_0x5ef64d,'resolveWithFullResponse':!![],'encoding':_0x379205,'qs':_0x55acff['query']};if(_0x55acff[_0xc934('0x98')]){_0x3c3bfc[_0xc934('0x98')]=_0x55acff[_0xc934('0x98')];if(_0x3c3bfc[_0xc934('0x98')][_0xc934('0x99')]){delete _0x3c3bfc[_0xc934('0x98')][_0xc934('0x99')];}}if(_0x3c3bfc[_0xc934('0x98')][_0xc934('0x9a')]){delete _0x3c3bfc['headers'][_0xc934('0x9a')];}return rp(_0x3c3bfc);})[_0xc934('0x27')](function(_0x54d9bd){if(_0x54d9bd){_0x1b0337['set'](_0x54d9bd[_0xc934('0x98')]);logger[_0xc934('0x61')](_0x54d9bd[_0xc934('0x84')]);if(_[_0xc934('0x9b')](_0x55acff[_0xc934('0x36')][_0xc934('0x6')],_0xc934('0x4b'))&&_0x54d9bd[_0xc934('0x9c')]==0x1f4){return _0x1b0337[_0xc934('0x29')](_0x54d9bd[_0xc934('0x9c')]);}else{return _0x1b0337['status'](_0x54d9bd[_0xc934('0x9c')])[_0xc934('0x2d')](_0x54d9bd[_0xc934('0x84')]);}}else{return _0x1b0337[_0xc934('0x29')](0xc8);}})[_0xc934('0x48')](handleError(_0x1b0337,null));};exports['webhookPost']=function(_0x18471e,_0x29be35,_0x3aa57b){return BPromise[_0xc934('0x9d')]()['then'](function(){if(!_0x18471e['query']['path']){throw new Error(_0xc934('0x90'));}if(!_0x18471e[_0xc934('0x36')][_0xc934('0x91')]){throw new Error(_0xc934('0x92'));}var _0x18ef46=_0x18471e[_0xc934('0x36')]['hostname']?_0x18471e[_0xc934('0x36')][_0xc934('0x93')]+':'+_0x18471e['query'][_0xc934('0x91')]:'http://localhost:'+_0x18471e[_0xc934('0x36')][_0xc934('0x91')];var _0x351682=_0x18471e[_0xc934('0x36')]['json']?_0x18471e[_0xc934('0x36')][_0xc934('0x1f')]:!![];var _0x26c565=_0x18471e['query'][_0xc934('0x95')]?_0x18471e[_0xc934('0x36')][_0xc934('0x95')]:null;var _0xffa283={'method':_0x18471e['method'],'uri':util[_0xc934('0x50')](_0xc934('0x97'),_0x18ef46,_0x18471e[_0xc934('0x36')][_0xc934('0x6')]),'json':_0x351682,'resolveWithFullResponse':!![],'encoding':_0x26c565,'body':_0x18471e[_0xc934('0x84')]};if(_0x18471e[_0xc934('0x98')]){_0xffa283[_0xc934('0x98')]=_0x18471e['headers'];if(_0xffa283[_0xc934('0x98')]['content-length']){delete _0xffa283[_0xc934('0x98')][_0xc934('0x99')];}}if(_0xffa283['headers']['content-type']){delete _0xffa283[_0xc934('0x98')]['content-type'];}return rp(_0xffa283);})[_0xc934('0x27')](function(_0x202088){if(_0x202088){_0x29be35[_0xc934('0x24')](_0x202088[_0xc934('0x98')]);logger['info'](_0x202088[_0xc934('0x84')]);return _0x29be35[_0xc934('0x1e')](_0x202088[_0xc934('0x9c')])['send'](_0x202088[_0xc934('0x84')]);}else{return _0x29be35[_0xc934('0x29')](0xc8);}})['catch'](handleError(_0x29be35,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 27bcced..1967d1b 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 _0x16a6=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x7d4dc8,_0x14d70e){var _0x20b216=function(_0x3575b0){while(--_0x3575b0){_0x7d4dc8['push'](_0x7d4dc8['shift']());}};_0x20b216(++_0x14d70e);}(_0x16a6,0x15c));var _0x616a=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x16a6[_0x486f4a];return _0x135d99;};'use strict';var EventEmitter=require(_0x616a('0x0'));var Plugin=require(_0x616a('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x616a('0x2')](0x0);var events={'afterCreate':_0x616a('0x3'),'afterUpdate':_0x616a('0x4'),'afterDestroy':_0x616a('0x5')};function emitEvent(_0x43e20b){return function(_0x13cbc6,_0x59fc7e,_0x41fbfa){PluginEvents[_0x616a('0x6')](_0x43e20b+':'+_0x13cbc6['id'],_0x13cbc6);PluginEvents['emit'](_0x43e20b,_0x13cbc6);_0x41fbfa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x616a('0x7')](e,emitEvent(event));}}module[_0x616a('0x8')]=PluginEvents; \ No newline at end of file +var _0x9bb8=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x86d32e,_0x3a0bf1){var _0x50a35e=function(_0x414a12){while(--_0x414a12){_0x86d32e['push'](_0x86d32e['shift']());}};_0x50a35e(++_0x3a0bf1);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x89bb('0x0'));var Plugin=require(_0x89bb('0x1'))['db'][_0x89bb('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x89bb('0x3')](0x0);var events={'afterCreate':_0x89bb('0x4'),'afterUpdate':_0x89bb('0x5'),'afterDestroy':_0x89bb('0x6')};function emitEvent(_0x1af2d3){return function(_0xaa37b7,_0x26ecc2,_0x436902){PluginEvents[_0x89bb('0x7')](_0x1af2d3+':'+_0xaa37b7['id'],_0xaa37b7);PluginEvents['emit'](_0x1af2d3,_0xaa37b7);_0x436902(null);};}for(var e in events){if(events[_0x89bb('0x8')](e)){var event=events[e];Plugin[_0x89bb('0x9')](e,emitEvent(event));}}module[_0x89bb('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index c2fb019..72b9c1b 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 _0xb71d=['../../config/environment','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x638ef9,_0x2860ff){var _0x372e23=function(_0x24a5be){while(--_0x24a5be){_0x638ef9['push'](_0x638ef9['shift']());}};_0x372e23(++_0x2860ff);}(_0xb71d,0xc0));var _0xdb71=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb71d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdb71('0x0'));var util=require(_0xdb71('0x1'));var logger=require(_0xdb71('0x2'))(_0xdb71('0x3'));var moment=require(_0xdb71('0x4'));var BPromise=require(_0xdb71('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb71('0x6'));var rimraf=require(_0xdb71('0x7'));var config=require(_0xdb71('0x8'));var attributes=require('./plugin.attributes');module['exports']=function(_0x3bd587,_0x4dff0d){return _0x3bd587[_0xdb71('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b19=['api','moment','request-promise','path','rimraf','./plugin.attributes','exports','define','plugins','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b19,0x195));var _0x94b1=function(_0x447305,_0x59ae0b){_0x447305=_0x447305-0x0;var _0x198b2b=_0x4b19[_0x447305];return _0x198b2b;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b1('0x4'));var fs=require('fs');var path=require(_0x94b1('0x5'));var rimraf=require(_0x94b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b1('0x7'));module[_0x94b1('0x8')]=function(_0x52d6c1,_0x24df76){return _0x52d6c1[_0x94b1('0x9')]('Plugin',attributes,{'tableName':_0x94b1('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 2bf727e..67a1e00 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 _0xc9ed=['error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x36bdd6,_0x4f38e1){var _0x3d4772=function(_0x4ff1e8){while(--_0x4ff1e8){_0x36bdd6['push'](_0x36bdd6['shift']());}};_0x3d4772(++_0x4f38e1);}(_0xc9ed,0x12b));var _0xdc9e=function(_0x25acfe,_0x3797bc){_0x25acfe=_0x25acfe-0x0;var _0x547928=_0xc9ed[_0x25acfe];return _0x547928;};'use strict';var _=require(_0xdc9e('0x0'));var util=require(_0xdc9e('0x1'));var moment=require(_0xdc9e('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc9e('0x3'));var fs=require('fs');var Redis=require(_0xdc9e('0x4'));var db=require(_0xdc9e('0x5'))['db'];var utils=require(_0xdc9e('0x6'));var logger=require(_0xdc9e('0x7'))(_0xdc9e('0x8'));var config=require(_0xdc9e('0x9'));var jayson=require(_0xdc9e('0xa'));var client=jayson['client'][_0xdc9e('0xb')]({'port':0x232a});config[_0xdc9e('0xc')]=_[_0xdc9e('0xd')](config[_0xdc9e('0xc')],{'host':_0xdc9e('0xe'),'port':0x18eb});var socket=require(_0xdc9e('0xf'))(new Redis(config[_0xdc9e('0xc')]));require(_0xdc9e('0x10'))[_0xdc9e('0x11')](socket);function respondWithRpcPromise(_0x430c42,_0x55b09c,_0x162c94){return new BPromise(function(_0x5a0242,_0x23db3c){return client[_0xdc9e('0x12')](_0x430c42,_0x162c94)['then'](function(_0x41cca7){logger[_0xdc9e('0x13')](_0xdc9e('0x14'),_0x55b09c,_0xdc9e('0x15'));logger[_0xdc9e('0x16')](_0xdc9e('0x17'),_0x55b09c,_0xdc9e('0x15'),JSON[_0xdc9e('0x18')](_0x41cca7));if(_0x41cca7[_0xdc9e('0x19')]){if(_0x41cca7['error'][_0xdc9e('0x1a')]===0x1f4){logger['error'](_0xdc9e('0x14'),_0x55b09c,_0x41cca7[_0xdc9e('0x19')]['message']);return _0x23db3c(_0x41cca7[_0xdc9e('0x19')][_0xdc9e('0x1b')]);}logger['error'](_0xdc9e('0x14'),_0x55b09c,_0x41cca7[_0xdc9e('0x19')][_0xdc9e('0x1b')]);return _0x5a0242(_0x41cca7[_0xdc9e('0x19')][_0xdc9e('0x1b')]);}else{logger[_0xdc9e('0x13')](_0xdc9e('0x14'),_0x55b09c,_0xdc9e('0x15'));_0x5a0242(_0x41cca7[_0xdc9e('0x1c')][_0xdc9e('0x1b')]);}})[_0xdc9e('0x1d')](function(_0x379762){logger[_0xdc9e('0x19')]('Plugin,\x20%s,\x20%s',_0x55b09c,_0x379762);_0x23db3c(_0x379762);});});}exports[_0xdc9e('0x1e')]=function(_0x59eeec){var _0x447560=this;return new Promise(function(_0xba1a51,_0x3f8c12){return db[_0xdc9e('0x1f')][_0xdc9e('0x20')](_0x59eeec[_0xdc9e('0x21')],{'raw':_0x59eeec[_0xdc9e('0x22')]?_0x59eeec[_0xdc9e('0x22')][_0xdc9e('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0xb64e0d){logger['info'](_0xdc9e('0x1e'),_0x59eeec);logger[_0xdc9e('0x16')](_0xdc9e('0x1e'),_0x59eeec,JSON['stringify'](_0xb64e0d));_0xba1a51(_0xb64e0d);})[_0xdc9e('0x1d')](function(_0x6c2216){logger[_0xdc9e('0x19')](_0xdc9e('0x1e'),_0x6c2216['message'],_0x59eeec);_0x3f8c12(_0x447560[_0xdc9e('0x19')](0x1f4,_0x6c2216[_0xdc9e('0x1b')]));});});}; \ No newline at end of file +var _0x1b5b=['http','redis','defaults','localhost','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','Plugin','create','options','raw','catch','CreatePlugin','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x1b5b,0x74));var _0xb1b5=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x1b5b[_0x3e0763];return _0x351ca2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb1b5('0x0'));var rs=require(_0xb1b5('0x1'));var fs=require('fs');var Redis=require(_0xb1b5('0x2'));var db=require(_0xb1b5('0x3'))['db'];var utils=require(_0xb1b5('0x4'));var logger=require(_0xb1b5('0x5'))(_0xb1b5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb1b5('0x7')][_0xb1b5('0x8')]({'port':0x232a});config[_0xb1b5('0x9')]=_[_0xb1b5('0xa')](config[_0xb1b5('0x9')],{'host':_0xb1b5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb1b5('0xc'))[_0xb1b5('0xd')](socket);function respondWithRpcPromise(_0x153a36,_0x5c7ef0,_0x3f56fb){return new BPromise(function(_0x2f5288,_0x1d21c1){return client[_0xb1b5('0xe')](_0x153a36,_0x3f56fb)[_0xb1b5('0xf')](function(_0x15e6b9){logger[_0xb1b5('0x10')](_0xb1b5('0x11'),_0x5c7ef0,'request\x20sent');logger[_0xb1b5('0x12')](_0xb1b5('0x13'),_0x5c7ef0,_0xb1b5('0x14'),JSON['stringify'](_0x15e6b9));if(_0x15e6b9[_0xb1b5('0x15')]){if(_0x15e6b9['error'][_0xb1b5('0x16')]===0x1f4){logger[_0xb1b5('0x15')](_0xb1b5('0x11'),_0x5c7ef0,_0x15e6b9[_0xb1b5('0x15')][_0xb1b5('0x17')]);return _0x1d21c1(_0x15e6b9[_0xb1b5('0x15')]['message']);}logger['error'](_0xb1b5('0x11'),_0x5c7ef0,_0x15e6b9[_0xb1b5('0x15')][_0xb1b5('0x17')]);return _0x2f5288(_0x15e6b9['error'][_0xb1b5('0x17')]);}else{logger[_0xb1b5('0x10')]('Plugin,\x20%s,\x20%s',_0x5c7ef0,_0xb1b5('0x14'));_0x2f5288(_0x15e6b9[_0xb1b5('0x18')][_0xb1b5('0x17')]);}})['catch'](function(_0x225ad5){logger[_0xb1b5('0x15')](_0xb1b5('0x11'),_0x5c7ef0,_0x225ad5);_0x1d21c1(_0x225ad5);});});}exports['CreatePlugin']=function(_0x288c55){var _0x38c382=this;return new Promise(function(_0x2637a0,_0x35c2cc){return db[_0xb1b5('0x19')][_0xb1b5('0x1a')](_0x288c55['body'],{'raw':_0x288c55['options']?_0x288c55[_0xb1b5('0x1b')][_0xb1b5('0x1c')]===undefined?!![]:![]:!![]})[_0xb1b5('0xf')](function(_0x35a796){logger[_0xb1b5('0x10')]('CreatePlugin',_0x288c55);logger[_0xb1b5('0x12')]('CreatePlugin',_0x288c55,JSON['stringify'](_0x35a796));_0x2637a0(_0x35a796);})[_0xb1b5('0x1d')](function(_0x42d3e4){logger[_0xb1b5('0x15')](_0xb1b5('0x1e'),_0x42d3e4[_0xb1b5('0x17')],_0x288c55);_0x35c2cc(_0x38c382[_0xb1b5('0x15')](0x1f4,_0x42d3e4[_0xb1b5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 8fab392..fd57215 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 _0x68bd=['update','emit','register','length','plugin:','save'];(function(_0x3837e1,_0x3fe5b2){var _0x3f3341=function(_0xc2951e){while(--_0xc2951e){_0x3837e1['push'](_0x3837e1['shift']());}};_0x3f3341(++_0x3fe5b2);}(_0x68bd,0xd7));var _0xd68b=function(_0x5bcdd7,_0x5e481c){_0x5bcdd7=_0x5bcdd7-0x0;var _0x36192b=_0x68bd[_0x5bcdd7];return _0x36192b;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xd68b('0x0'),'remove',_0xd68b('0x1')];function createListener(_0x5b49b3,_0x54886b){return function(_0x4585e9){_0x54886b[_0xd68b('0x2')](_0x5b49b3,_0x4585e9);};}function removeListener(_0x4180df,_0x136fba){return function(){PluginEvents['removeListener'](_0x4180df,_0x136fba);};}exports[_0xd68b('0x3')]=function(_0x3839fd){for(var _0x546612=0x0,_0x1a620f=events[_0xd68b('0x4')];_0x546612<_0x1a620f;_0x546612++){var _0x814fb4=events[_0x546612];var _0x429a23=createListener(_0xd68b('0x5')+_0x814fb4,_0x3839fd);PluginEvents['on'](_0x814fb4,_0x429a23);}}; \ No newline at end of file +var _0xc204=['length','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x2d7f8c,_0x2a1c7f){var _0x294d42=function(_0x1f4cd0){while(--_0x1f4cd0){_0x2d7f8c['push'](_0x2d7f8c['shift']());}};_0x294d42(++_0x2a1c7f);}(_0xc204,0x8d));var _0x4c20=function(_0x5baf5e,_0x131b8c){_0x5baf5e=_0x5baf5e-0x0;var _0x3650ed=_0xc204[_0x5baf5e];return _0x3650ed;};'use strict';var PluginEvents=require(_0x4c20('0x0'));var events=[_0x4c20('0x1'),_0x4c20('0x2'),_0x4c20('0x3')];function createListener(_0xcf875a,_0x5ca139){return function(_0xd81a49){_0x5ca139[_0x4c20('0x4')](_0xcf875a,_0xd81a49);};}function removeListener(_0x141d90,_0x3165db){return function(){PluginEvents[_0x4c20('0x5')](_0x141d90,_0x3165db);};}exports['register']=function(_0x36c555){for(var _0x11ee37=0x0,_0x1188bd=events[_0x4c20('0x6')];_0x11ee37<_0x1188bd;_0x11ee37++){var _0x54fa74=events[_0x11ee37];var _0x17ea3e=createListener('plugin:'+_0x54fa74,_0x36c555);PluginEvents['on'](_0x54fa74,_0x17ea3e);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 243c90c..e508bd3 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(_0x253f7f,_0x47d4f4){var _0x84ee28=function(_0x3fefe1){while(--_0x3fefe1){_0x253f7f['push'](_0x253f7f['shift']());}};_0x84ee28(++_0x47d4f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x415493,_0x487a92){var _0x5624be=function(_0x7884ea){while(--_0x7884ea){_0x415493['push'](_0x415493['shift']());}};_0x5624be(++_0x487a92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 766470f..4ac3ab2 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 _0xe205=['cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','json','error','name','status','send','npm\x20install','info','index','list','reject','express','length','then','catch','show','describe','params','body','script'];(function(_0x28cd15,_0x247b07){var _0x4ee543=function(_0x28bfaa){while(--_0x28bfaa){_0x28cd15['push'](_0x28cd15['shift']());}};_0x4ee543(++_0x247b07);}(_0xe205,0xa7));var _0x5e20=function(_0x573262,_0x4e0f57){_0x573262=_0x573262-0x0;var _0x159178=_0xe205[_0x573262];return _0x159178;};'use strict';var _=require(_0x5e20('0x0'));var pm2=require(_0x5e20('0x1'));var logger=require(_0x5e20('0x2'))(_0x5e20('0x3'));var path=require(_0x5e20('0x4'));var exec=require(_0x5e20('0x5'))[_0x5e20('0x6')];var BPromise=require(_0x5e20('0x7'));function handleEntityNotFound(_0x37c5e9,_0x4ac934){return function(_0x1a6198){if(!_0x1a6198){_0x37c5e9[_0x5e20('0x8')](0x194);;}return _0x1a6198;};}function respondWithResult(_0x44dbb3,_0x3c4203){_0x3c4203=_0x3c4203||0xc8;return function(_0x5eca5c){if(_0x5eca5c){return _0x44dbb3['status'](_0x3c4203)[_0x5e20('0x9')](_0x5eca5c);}return null;};}function handleError(_0x4c9332,_0x533e18){_0x533e18=_0x533e18||0x1f4;return function(_0x30b757){logger[_0x5e20('0xa')](_0x30b757['stack']);if(_0x30b757[_0x5e20('0xb')]){delete _0x30b757[_0x5e20('0xb')];}_0x4c9332[_0x5e20('0xc')](_0x533e18)[_0x5e20('0xd')](_0x30b757);};}function execChildProcess(){return new BPromise(function(_0x5cb51d,_0x349613){exec(_0x5e20('0xe'),function(_0x270689,_0x27f1f9,_0x165824){logger[_0x5e20('0xf')](_0x27f1f9);logger['info'](_0x165824);if(_0x270689){logger[_0x5e20('0xa')](_0x270689);return _0x349613(_0x270689);}return _0x5cb51d(_0x27f1f9);});});}exports[_0x5e20('0x10')]=function(_0x22540d,_0x5868c0){return pm2[_0x5e20('0x11')]()['then'](function(_0x1f47f3){if(_0x1f47f3){var _0x5ba833=_[_0x5e20('0x12')](_0x1f47f3,function(_0x330cdf){return _0x330cdf[_0x5e20('0xb')]===_0x5e20('0x13')||_0x330cdf[_0x5e20('0xb')]==='motion2';});return{'rows':_0x5ba833,'count':_0x5ba833[_0x5e20('0x14')]};}return null;})[_0x5e20('0x15')](respondWithResult(_0x5868c0,null))[_0x5e20('0x16')](handleError(_0x5868c0,null));};exports[_0x5e20('0x17')]=function(_0x2f194b,_0x3b353f){return pm2[_0x5e20('0x18')](_0x2f194b[_0x5e20('0x19')]['id'])['then'](respondWithResult(_0x3b353f,null))[_0x5e20('0x15')](handleEntityNotFound(_0x3b353f,null))[_0x5e20('0x16')](handleError(_0x3b353f,null));};exports['create']=function(_0x295eb3,_0x1b1457){if(_0x295eb3[_0x5e20('0x1a')][_0x5e20('0xb')]&&_0x295eb3['body'][_0x5e20('0x1b')]){var _0x50f222=path['join'](__dirname,'../../files/plugins',_0x295eb3['body'][_0x5e20('0x1b')]);var _0x5cca90=process[_0x5e20('0x1c')]();process[_0x5e20('0x1d')](path[_0x5e20('0x1e')](_0x50f222));return execChildProcess()[_0x5e20('0x15')](function(_0x3ef7fa){process[_0x5e20('0x1d')](_0x5cca90);return pm2['start']({'name':_0x295eb3[_0x5e20('0x1a')]['name'],'script':_0x50f222});})['then'](function(_0x33993a){pm2[_0x5e20('0x1f')]();return _0x33993a[0x0];})[_0x5e20('0x15')](respondWithResult(_0x1b1457,0xc9))[_0x5e20('0x16')](handleError(_0x1b1457,null));}else{return _0x1b1457[_0x5e20('0xc')](0x1f4)[_0x5e20('0xd')]({'message':_0x5e20('0x20')});}};exports['update']=function(_0x3bf4f4,_0x420f63){if(_0x3bf4f4[_0x5e20('0x1a')]['id']){delete _0x3bf4f4[_0x5e20('0x1a')]['id'];}var _0x4c799d={'online':_0x5e20('0x21'),'stopped':_0x5e20('0x22')};if(_0x4c799d[_0x5e20('0x23')](_0x3bf4f4[_0x5e20('0x1a')][_0x5e20('0xc')])){return pm2[_0x4c799d[_0x3bf4f4[_0x5e20('0x1a')]['status']]](_0x3bf4f4[_0x5e20('0x19')]['id'])[_0x5e20('0x15')](respondWithResult(_0x420f63,0xc8))['catch'](handleError(_0x420f63,null));}else{return _0x420f63[_0x5e20('0xc')](0x1f4)[_0x5e20('0xd')]({'message':_0x5e20('0x24')});}};exports[_0x5e20('0x25')]=function(_0x1548c8,_0x395a27){if(_0x1548c8['body']['id']){delete _0x1548c8[_0x5e20('0x1a')]['id'];}if(_0x1548c8[_0x5e20('0x19')]['id']){return pm2[_0x5e20('0x26')](_0x1548c8[_0x5e20('0x19')]['id'])[_0x5e20('0x15')](function(_0x1ac162){pm2[_0x5e20('0x1f')]();return _0x1ac162[0x0];})[_0x5e20('0x15')](respondWithResult(_0x395a27,null))[_0x5e20('0x16')](handleError(_0x395a27,null));}else{return _0x395a27[_0x5e20('0xc')](0x1f4)[_0x5e20('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x1339=['body','params','delete','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','then','reject','motion2','catch','show','describe','create','../../files/plugins','cwd','chdir','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x96ad7d,_0x1017ba){var _0x32d63a=function(_0xb47ad9){while(--_0xb47ad9){_0x96ad7d['push'](_0x96ad7d['shift']());}};_0x32d63a(++_0x1017ba);}(_0x1339,0x1ed));var _0x9133=function(_0x2f8c7e,_0x1e75da){_0x2f8c7e=_0x2f8c7e-0x0;var _0x3ce584=_0x1339[_0x2f8c7e];return _0x3ce584;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var path=require(_0x9133('0x2'));var exec=require(_0x9133('0x3'))[_0x9133('0x4')];var BPromise=require(_0x9133('0x5'));function handleEntityNotFound(_0x176e80,_0x110c51){return function(_0x558345){if(!_0x558345){_0x176e80[_0x9133('0x6')](0x194);;}return _0x558345;};}function respondWithResult(_0x855473,_0x379915){_0x379915=_0x379915||0xc8;return function(_0x539af6){if(_0x539af6){return _0x855473[_0x9133('0x7')](_0x379915)[_0x9133('0x8')](_0x539af6);}return null;};}function handleError(_0x3059c4,_0x431a55){_0x431a55=_0x431a55||0x1f4;return function(_0x261698){logger[_0x9133('0x9')](_0x261698[_0x9133('0xa')]);if(_0x261698[_0x9133('0xb')]){delete _0x261698[_0x9133('0xb')];}_0x3059c4[_0x9133('0x7')](_0x431a55)['send'](_0x261698);};}function execChildProcess(){return new BPromise(function(_0x3f9650,_0x3533fa){exec(_0x9133('0xc'),function(_0x452481,_0x3b8f89,_0x244ced){logger['info'](_0x3b8f89);logger[_0x9133('0xd')](_0x244ced);if(_0x452481){logger[_0x9133('0x9')](_0x452481);return _0x3533fa(_0x452481);}return _0x3f9650(_0x3b8f89);});});}exports['index']=function(_0x5283a3,_0x10475c){return pm2['list']()[_0x9133('0xe')](function(_0x439e1a){if(_0x439e1a){var _0x17dfd1=_[_0x9133('0xf')](_0x439e1a,function(_0x31847a){return _0x31847a[_0x9133('0xb')]==='express'||_0x31847a[_0x9133('0xb')]===_0x9133('0x10');});return{'rows':_0x17dfd1,'count':_0x17dfd1['length']};}return null;})[_0x9133('0xe')](respondWithResult(_0x10475c,null))[_0x9133('0x11')](handleError(_0x10475c,null));};exports[_0x9133('0x12')]=function(_0x427663,_0x4a2c4f){return pm2[_0x9133('0x13')](_0x427663['params']['id'])[_0x9133('0xe')](respondWithResult(_0x4a2c4f,null))['then'](handleEntityNotFound(_0x4a2c4f,null))[_0x9133('0x11')](handleError(_0x4a2c4f,null));};exports[_0x9133('0x14')]=function(_0x5e8620,_0x38dd60){if(_0x5e8620['body'][_0x9133('0xb')]&&_0x5e8620['body']['script']){var _0x2f7354=path['join'](__dirname,_0x9133('0x15'),_0x5e8620['body']['script']);var _0x4c846e=process[_0x9133('0x16')]();process[_0x9133('0x17')](path['dirname'](_0x2f7354));return execChildProcess()[_0x9133('0xe')](function(_0x3f5d0e){process[_0x9133('0x17')](_0x4c846e);return pm2[_0x9133('0x18')]({'name':_0x5e8620['body'][_0x9133('0xb')],'script':_0x2f7354});})['then'](function(_0x187e32){pm2[_0x9133('0x19')]();return _0x187e32[0x0];})[_0x9133('0xe')](respondWithResult(_0x38dd60,0xc9))[_0x9133('0x11')](handleError(_0x38dd60,null));}else{return _0x38dd60[_0x9133('0x7')](0x1f4)[_0x9133('0x1a')]({'message':_0x9133('0x1b')});}};exports[_0x9133('0x1c')]=function(_0x1b6b3e,_0x46050b){if(_0x1b6b3e['body']['id']){delete _0x1b6b3e['body']['id'];}var _0x477bf1={'online':_0x9133('0x1d'),'stopped':_0x9133('0x1e')};if(_0x477bf1[_0x9133('0x1f')](_0x1b6b3e['body']['status'])){return pm2[_0x477bf1[_0x1b6b3e[_0x9133('0x20')][_0x9133('0x7')]]](_0x1b6b3e[_0x9133('0x21')]['id'])[_0x9133('0xe')](respondWithResult(_0x46050b,0xc8))[_0x9133('0x11')](handleError(_0x46050b,null));}else{return _0x46050b[_0x9133('0x7')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x1ad222,_0x4a4a8e){if(_0x1ad222[_0x9133('0x20')]['id']){delete _0x1ad222[_0x9133('0x20')]['id'];}if(_0x1ad222['params']['id']){return pm2[_0x9133('0x22')](_0x1ad222['params']['id'])[_0x9133('0xe')](function(_0x26ca56){pm2[_0x9133('0x19')]();return _0x26ca56[0x0];})['then'](respondWithResult(_0x4a4a8e,null))[_0x9133('0x11')](handleError(_0x4a4a8e,null));}else{return _0x4a4a8e[_0x9133('0x7')](0x1f4)[_0x9133('0x1a')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 4ec8afd..8b036dc 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 _0xec26=['get','/agents','isAuthenticated','getAgents','/queues','getQueues','Router','../../components/auth/service','./realtime.controller'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xec26,0x15c));var _0x6ec2=function(_0x3f39a6,_0xc32e86){_0x3f39a6=_0x3f39a6-0x0;var _0x31c3bd=_0xec26[_0x3f39a6];return _0x31c3bd;};'use strict';var express=require('express');var router=express[_0x6ec2('0x0')]();var auth=require(_0x6ec2('0x1'));var controller=require(_0x6ec2('0x2'));router[_0x6ec2('0x3')](_0x6ec2('0x4'),auth[_0x6ec2('0x5')](),controller[_0x6ec2('0x6')]);router['get'](_0x6ec2('0x7'),auth[_0x6ec2('0x5')](),controller[_0x6ec2('0x8')]);module['exports']=router; \ No newline at end of file +var _0x1681=['../../components/auth/service','./realtime.controller','get','/agents','/queues','exports','Router'];(function(_0x1726a4,_0x3c0da5){var _0x116ce4=function(_0x5d71a1){while(--_0x5d71a1){_0x1726a4['push'](_0x1726a4['shift']());}};_0x116ce4(++_0x3c0da5);}(_0x1681,0xdf));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x1168('0x0')]();var auth=require(_0x1168('0x1'));var controller=require(_0x1168('0x2'));router[_0x1168('0x3')](_0x1168('0x4'),auth['isAuthenticated'](),controller['getAgents']);router[_0x1168('0x3')](_0x1168('0x5'),auth['isAuthenticated'](),controller['getQueues']);module[_0x1168('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index e0bd4a9..37fc328 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 _0x9d75=['../../components/parsers/qs','../../mysqldb','../../errors/api','APIBadRequestError','handleError','limit','offset','count','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','*pause','resolve','then','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','length','User','rawAttributes','fieldName','role','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','user','userProfileId','Agents','online','extraQueryConditions','omit','getResources','findAndCountAll','map','getAgentStatus','pause','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','getQueues','format','startCase','key','name','type','outbound','dialActive','dialMethod','Queues','filter','assign','UserProfile','catch','lodash','util','../../components/realtime/agents'];(function(_0x20ea89,_0x1bfce6){var _0x1f06a8=function(_0xc541ce){while(--_0xc541ce){_0x20ea89['push'](_0x20ea89['shift']());}};_0x1f06a8(++_0x1bfce6);}(_0x9d75,0xf9));var _0x59d7=function(_0x1579ed,_0x541862){_0x1579ed=_0x1579ed-0x0;var _0x166279=_0x9d75[_0x1579ed];return _0x166279;};'use strict';var _=require(_0x59d7('0x0'));var util=require(_0x59d7('0x1'));var rta=require(_0x59d7('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0x59d7('0x3'));var utils=require('../../config/utils');var db=require(_0x59d7('0x4'))['db'];var APIBadRequestError=require(_0x59d7('0x5'))[_0x59d7('0x6')];var APIHandleError=require(_0x59d7('0x5'))[_0x59d7('0x7')];function respondWithFilteredResult(_0x1d065c,_0x4b3841){return function(_0x2bb9d9){if(_0x2bb9d9){var _0x3f5d15=typeof _0x4b3841['offset']==='undefined'&&typeof _0x4b3841[_0x59d7('0x8')]==='undefined';var _0x54601c=_0x2bb9d9['count'];var _0x455d62=_0x3f5d15?0x0:_0x4b3841[_0x59d7('0x9')];var _0x72f4b4=_0x3f5d15?_0x2bb9d9[_0x59d7('0xa')]:_0x4b3841[_0x59d7('0x9')]+_0x4b3841['limit'];var _0x3399aa;if(_0x72f4b4>=_0x54601c){_0x72f4b4=_0x54601c;_0x3399aa=0xc8;}else{_0x3399aa=0xce;}_0x1d065c['status'](_0x3399aa);return _0x1d065c['set'](_0x59d7('0xb'),_0x455d62+'-'+_0x72f4b4+'/'+_0x54601c)[_0x59d7('0xc')](_0x2bb9d9);}return null;};}exports[_0x59d7('0xd')]=function(_0x2eb5a7,_0x5f0ed7){var _0x5c1985={'count':0x0,'rows':[]};var _0xe682b0={};var _0x28159d;var _0x5074ec=utils[_0x59d7('0xe')]();var _0x5e6a99;var _0x3c082d;var _0x43e2f3=_0x2eb5a7[_0x59d7('0xf')]['globalQueueFilter'];var _0x16d246=_0x2eb5a7[_0x59d7('0xf')][_0x59d7('0x10')];var _0x37c124=_0x2eb5a7[_0x59d7('0xf')][_0x59d7('0x11')];var _0x28a244=_0x16d246==='pause'||_0x16d246===_0x59d7('0x12')?!![]:![];var _0x357d98=[];var _0x3d9d9a;var _0x4bc45d;Promise[_0x59d7('0x13')]()[_0x59d7('0x14')](function(){if(_0x2eb5a7[_0x59d7('0xf')][_0x59d7('0x15')]){if(!utils[_0x59d7('0x16')](_0x2eb5a7[_0x59d7('0xf')][_0x59d7('0x15')])){throw new APIBadRequestError(util['format'](_0x59d7('0x17'),_0x2eb5a7[_0x59d7('0xf')][_0x59d7('0x15')]));}_0x28159d=_0x2eb5a7['query'][_0x59d7('0x15')][_0x59d7('0x18')]();}if(!_0x2eb5a7[_0x59d7('0xf')][_0x59d7('0x19')]||!_0x2eb5a7[_0x59d7('0xf')]['sort'][_0x59d7('0x1a')](_0x59d7('0x1b'))){_0x2eb5a7[_0x59d7('0xf')]['sort']=rta[_0x59d7('0x1c')](_0x2eb5a7[_0x59d7('0xf')]['sort']);return;}var _0x3bb681=rta[_0x59d7('0x1d')](_0x2eb5a7['query']['sort']);_0x2eb5a7[_0x59d7('0xf')]['sort']=_0x3bb681[_0x59d7('0x1e')][_0x59d7('0x1f')](',');_0x3d9d9a=_0x3bb681[_0x59d7('0x20')];})[_0x59d7('0x14')](function(){if(!_0x43e2f3){return[];}return rta[_0x59d7('0x21')](_0x43e2f3,_0x28159d);})[_0x59d7('0x14')](function(_0x9a189a){_0x357d98=_0x9a189a;return rta[_0x59d7('0x22')]();})['then'](function(_0x352184){_0x3c082d=_0x352184[_0x59d7('0x23')];if((!_0x16d246||_0x28a244)&&!_0x3d9d9a){return _0x357d98;}if(_0x3d9d9a&&!_0x16d246){return rta[_0x59d7('0x24')](_0x3c082d,_0x357d98,_0x3d9d9a);}else{return rta['getAgentIdsByStatus'](_0x3c082d,_0x357d98,_0x16d246);}})['then'](function(_0x490fb2){_0x357d98=_0x490fb2;var _0x3b8080=![];if(_0x357d98[_0x59d7('0x25')]===0x0){if(_0x43e2f3||_0x16d246){_0x3b8080=!![];}if(_0x28a244){_0x3b8080=![];}}if(_0x3b8080){return _0x5c1985;}var _0x3f5b1=_['map'](db[_0x59d7('0x26')][_0x59d7('0x27')],function(_0x20b54a){return{'name':_0x20b54a[_0x59d7('0x28')],'type':_0x20b54a['type']['key']};});_0x2eb5a7[_0x59d7('0xf')][_0x59d7('0x29')]=_0x59d7('0x2a');_0xe682b0=qs[_0x59d7('0x2b')](_0x3f5b1,_0x2eb5a7);_0xe682b0[_0x59d7('0x2c')]=!![];var _0x2d6ee0=[];if(_0x357d98[_0x59d7('0x25')]>0x0){_0x2d6ee0[_0x59d7('0x2d')]({'id':{'$in':_0x357d98}});if(_0x3d9d9a&&!_0x16d246){_0x4bc45d=[db[_0x59d7('0x2e')][_0x59d7('0x2f')](_0x59d7('0x30')+_0x357d98+')')];_0xe682b0['order']=_0x4bc45d;}}if(_0x28a244){_0x5074ec[_0x59d7('0x31')](function(_0x3dedb3){var _0x26a3ec=!![];if(_0x16d246===_0x59d7('0x12')&&_0x28159d!==_0x3dedb3){_0x26a3ec=![];}_0x2d6ee0['push']({[_0x3dedb3+_0x59d7('0x32')]:_0x26a3ec});});if(_0x37c124){_0x2d6ee0[_0x59d7('0x2d')]({'pauseType':_0x37c124});}}else if(_0x16d246){_0x5074ec[_0x59d7('0x31')](function(_0x40b622){_0x2d6ee0[_0x59d7('0x2d')]({[_0x40b622+_0x59d7('0x32')]:![]});});}_0xe682b0[_0x59d7('0x33')]=_['merge'](_0xe682b0['where'],{'$and':_0x2d6ee0});if(_0x2eb5a7[_0x59d7('0x34')]['role']===_0x59d7('0x34')){var _0x4205ba={'params':{'id':_0x2eb5a7[_0x59d7('0x34')][_0x59d7('0x35')]},'query':{'section':_0x59d7('0x36'),'role':'agent','raw':!![],'ids':_0x357d98,'customSorting':_0x4bc45d}};if(_0x2eb5a7[_0x59d7('0xf')][_0x59d7('0x37')]){_0x4205ba[_0x59d7('0xf')][_0x59d7('0x37')]=!![];}if(_0x28a244){_0x4205ba['query'][_0x59d7('0x38')]=_0x2d6ee0;}_0x4205ba[_0x59d7('0xf')]=Object['assign'](_0x4205ba['query'],_[_0x59d7('0x39')](_0x2eb5a7[_0x59d7('0xf')],'id'));return db['UserProfile'][_0x59d7('0x3a')](_0x4205ba);}return db[_0x59d7('0x26')][_0x59d7('0x3b')](_0xe682b0);})[_0x59d7('0x14')](function(_0x1d5cec){_0x5c1985[_0x59d7('0xa')]=_0x1d5cec[_0x59d7('0xa')];_0x5e6a99=_0x1d5cec[_0x59d7('0x23')];return _0x5e6a99[_0x59d7('0x3c')](function(_0x3c7f9d){var _0x4ad962=_['find'](_0x3c082d,['id',_0x3c7f9d['id']]);if(_0x4ad962){var _0xb54737=rta['filterAgentAttributes'](_0x4ad962);_['merge'](_0x3c7f9d,_0xb54737);}_0x3c7f9d[_0x59d7('0x1b')]=rta[_0x59d7('0x3d')](_0x3c7f9d);if(_0x3c7f9d[_0x59d7('0x1b')]['includes'](_0x59d7('0x3e'))){_0x5074ec['forEach'](function(_0xd0e90b){if(_0x3c7f9d[_0xd0e90b+'Pause']){if(_0xd0e90b===_0x59d7('0x3f')){if(_0x3c7f9d[_0x59d7('0x40')]!==_0x59d7('0x41')){_0x3c7f9d[_0x59d7('0x40')]=_0x59d7('0x3e');}}else{_0x3c7f9d[_0xd0e90b+_0x59d7('0x42')]='pause';}}});}return _0x3c7f9d;});})['then'](function(_0x23c962){if(!_0x3d9d9a||_0x4bc45d){return _0x23c962;}return rta[_0x59d7('0x43')](_0x23c962,_0x3d9d9a);})['then'](function(_0x4706fa){var _0x4d8273=rta[_0x59d7('0x44')]();_0x5c1985[_0x59d7('0x23')]=_0x4706fa['map'](function(_0x152464){return _[_0x59d7('0x45')](_0x152464,_0x4d8273);});return _0x5c1985;})[_0x59d7('0x14')](respondWithFilteredResult(_0x5f0ed7,_0xe682b0))['catch'](APIHandleError(_0x5f0ed7));};exports[_0x59d7('0x46')]=function(_0x25eed2,_0x5cdeff){var _0x29f9e1={'count':0x0,'rows':[]};var _0x29e9af={};var _0x256b82;var _0x5e68e6;var _0x1cb70a;Promise['resolve']()[_0x59d7('0x14')](function(){if(_0x25eed2[_0x59d7('0xf')]['channel']){if(!utils[_0x59d7('0x16')](_0x25eed2[_0x59d7('0xf')]['channel'])){throw new APIBadRequestError(util[_0x59d7('0x47')](_0x59d7('0x17'),_0x25eed2[_0x59d7('0xf')][_0x59d7('0x15')]));}_0x256b82=_0x25eed2['query']['channel'][_0x59d7('0x18')]();}var _0x568efc=_[_0x59d7('0x48')](_0x256b82)+'Queue';var _0x1bfb36=_[_0x59d7('0x3c')](db[_0x568efc][_0x59d7('0x27')],function(_0x17328b){return{'name':_0x17328b[_0x59d7('0x28')],'type':_0x17328b['type'][_0x59d7('0x49')]};});if(!_0x25eed2['query']['fields']){var _0x2351b4=['id',_0x59d7('0x4a')];if(_0x256b82===_0x59d7('0x3f')){_0x2351b4[_0x59d7('0x2d')](_0x59d7('0x4b'));if(_0x25eed2[_0x59d7('0xf')][_0x59d7('0x4b')]===_0x59d7('0x4c')){_0x2351b4[_0x59d7('0x2d')]([_0x59d7('0x4d'),_0x59d7('0x4e')]);}}_0x25eed2[_0x59d7('0xf')]['fields']=_0x2351b4[_0x59d7('0x1f')](',');}_0x29e9af=qs[_0x59d7('0x2b')](_0x1bfb36,_0x25eed2);if(_0x25eed2['user'][_0x59d7('0x29')]==='user'){var _0x4edbc1={'params':{'id':_0x25eed2[_0x59d7('0x34')]['userProfileId']},'query':{'section':_0x256b82==='voice'&&_0x25eed2[_0x59d7('0xf')][_0x59d7('0x4b')]===_0x59d7('0x4c')?'QueueCampaigns':_[_0x59d7('0x48')](_0x256b82)+_0x59d7('0x4f'),'type':_0x25eed2['query']['type'],'nolimit':!![],'sort':_0x59d7('0x4a'),'filter':_0x25eed2[_0x59d7('0xf')][_0x59d7('0x50')]}};_0x4edbc1['query']=Object[_0x59d7('0x51')](_0x4edbc1[_0x59d7('0xf')],_0x25eed2[_0x59d7('0xf')]);delete _0x4edbc1[_0x59d7('0xf')]['id'];return db[_0x59d7('0x52')][_0x59d7('0x3a')](_0x4edbc1);}return db[_0x568efc][_0x59d7('0x3b')](_0x29e9af);})['then'](function(_0x1b0941){_0x29f9e1[_0x59d7('0xa')]=_0x1b0941[_0x59d7('0xa')];_0x5e68e6=_0x1b0941['rows'];return rtq['getRealtimeQueues'](_0x25eed2,_0x256b82);})['then'](function(_0x1e5761){_0x1cb70a=_0x1e5761[_0x59d7('0x23')];return rtq['initializeQueues'](_0x5e68e6,_0x1cb70a,_0x256b82,_0x25eed2[_0x59d7('0xf')][_0x59d7('0x4b')]);})[_0x59d7('0x14')](function(_0x273ff9){_0x29f9e1[_0x59d7('0x23')]=_0x273ff9;return _0x29f9e1;})['then'](respondWithFilteredResult(_0x5cdeff,_0x29e9af))[_0x59d7('0x53')](APIHandleError(_0x5cdeff));}; \ No newline at end of file +var _0x8478=['set','Content-Range','json','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','length','push','literal','FIELD(id,','Pause','forEach','user','userProfileId','Agents','online','extraQueryConditions','omit','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','merge','voiceStatus','talking','Status','getRealtimeAgentsQueryFields','getQueues','Queue','fields','outbound','dialMethod','voice','Queues','name','assign','catch','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x8478,0x197));var _0x8847=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8478[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x8847('0x0'));var util=require(_0x8847('0x1'));var rta=require(_0x8847('0x2'));var rtq=require(_0x8847('0x3'));var qs=require(_0x8847('0x4'));var utils=require(_0x8847('0x5'));var db=require(_0x8847('0x6'))['db'];var APIBadRequestError=require(_0x8847('0x7'))[_0x8847('0x8')];var APIHandleError=require(_0x8847('0x7'))['handleError'];function respondWithFilteredResult(_0x26b6b6,_0x3022b9){return function(_0x3c0db2){if(_0x3c0db2){var _0xe7e4aa=typeof _0x3022b9[_0x8847('0x9')]===_0x8847('0xa')&&typeof _0x3022b9[_0x8847('0xb')]===_0x8847('0xa');var _0x5978ec=_0x3c0db2[_0x8847('0xc')];var _0x44acab=_0xe7e4aa?0x0:_0x3022b9['offset'];var _0x590b85=_0xe7e4aa?_0x3c0db2[_0x8847('0xc')]:_0x3022b9[_0x8847('0x9')]+_0x3022b9[_0x8847('0xb')];var _0x2368ea;if(_0x590b85>=_0x5978ec){_0x590b85=_0x5978ec;_0x2368ea=0xc8;}else{_0x2368ea=0xce;}_0x26b6b6['status'](_0x2368ea);return _0x26b6b6[_0x8847('0xd')](_0x8847('0xe'),_0x44acab+'-'+_0x590b85+'/'+_0x5978ec)[_0x8847('0xf')](_0x3c0db2);}return null;};}exports[_0x8847('0x10')]=function(_0x54fa74,_0x232617){var _0x3d5c49={'count':0x0,'rows':[]};var _0x41356d={};var _0x8bd5d8;var _0xb8f419=utils[_0x8847('0x11')]();var _0x3406d0;var _0x20c763;var _0x4ad202=_0x54fa74['query'][_0x8847('0x12')];var _0x40b16e=_0x54fa74[_0x8847('0x13')][_0x8847('0x14')];var _0x597c44=_0x54fa74[_0x8847('0x13')][_0x8847('0x15')];var _0x51c5ca=_0x40b16e===_0x8847('0x16')||_0x40b16e===_0x8847('0x17')?!![]:![];var _0x6e8f6d=[];var _0x41d073;var _0x16e3e7;Promise[_0x8847('0x18')]()[_0x8847('0x19')](function(){if(_0x54fa74[_0x8847('0x13')][_0x8847('0x1a')]){if(!utils[_0x8847('0x1b')](_0x54fa74[_0x8847('0x13')]['channel'])){throw new APIBadRequestError(util[_0x8847('0x1c')](_0x8847('0x1d'),_0x54fa74[_0x8847('0x13')][_0x8847('0x1a')]));}_0x8bd5d8=_0x54fa74[_0x8847('0x13')][_0x8847('0x1a')][_0x8847('0x1e')]();}if(!_0x54fa74[_0x8847('0x13')][_0x8847('0x1f')]||!_0x54fa74[_0x8847('0x13')][_0x8847('0x1f')][_0x8847('0x20')](_0x8847('0x21'))){_0x54fa74[_0x8847('0x13')][_0x8847('0x1f')]=rta[_0x8847('0x22')](_0x54fa74['query'][_0x8847('0x1f')]);return;}var _0x44caa0=rta[_0x8847('0x23')](_0x54fa74[_0x8847('0x13')]['sort']);_0x54fa74[_0x8847('0x13')]['sort']=_0x44caa0['fields'][_0x8847('0x24')](',');_0x41d073=_0x44caa0[_0x8847('0x25')];})[_0x8847('0x19')](function(){if(!_0x4ad202){return[];}return rta[_0x8847('0x26')](_0x4ad202,_0x8bd5d8);})[_0x8847('0x19')](function(_0x9151e9){_0x6e8f6d=_0x9151e9;return rta[_0x8847('0x27')]();})[_0x8847('0x19')](function(_0x520e70){_0x20c763=_0x520e70[_0x8847('0x28')];if((!_0x40b16e||_0x51c5ca)&&!_0x41d073){return _0x6e8f6d;}if(_0x41d073&&!_0x40b16e){return rta['getSortedAgentsIdsByStatus'](_0x20c763,_0x6e8f6d,_0x41d073);}else{return rta[_0x8847('0x29')](_0x20c763,_0x6e8f6d,_0x40b16e);}})[_0x8847('0x19')](function(_0xfd7d4c){_0x6e8f6d=_0xfd7d4c;var _0x343cfc=![];if(_0x6e8f6d['length']===0x0){if(_0x4ad202||_0x40b16e){_0x343cfc=!![];}if(_0x51c5ca){_0x343cfc=![];}}if(_0x343cfc){return _0x3d5c49;}var _0x382333=_[_0x8847('0x2a')](db[_0x8847('0x2b')][_0x8847('0x2c')],function(_0x21bc10){return{'name':_0x21bc10[_0x8847('0x2d')],'type':_0x21bc10[_0x8847('0x2e')][_0x8847('0x2f')]};});_0x54fa74[_0x8847('0x13')][_0x8847('0x30')]=_0x8847('0x31');_0x41356d=qs[_0x8847('0x32')](_0x382333,_0x54fa74);_0x41356d[_0x8847('0x33')]=!![];var _0x1eed84=[];if(_0x6e8f6d[_0x8847('0x34')]>0x0){_0x1eed84[_0x8847('0x35')]({'id':{'$in':_0x6e8f6d}});if(_0x41d073&&!_0x40b16e){_0x16e3e7=[db['sequelize'][_0x8847('0x36')](_0x8847('0x37')+_0x6e8f6d+')')];_0x41356d[_0x8847('0x25')]=_0x16e3e7;}}if(_0x51c5ca){_0xb8f419['forEach'](function(_0x1a9764){var _0x28a618=!![];if(_0x40b16e==='*pause'&&_0x8bd5d8!==_0x1a9764){_0x28a618=![];}_0x1eed84[_0x8847('0x35')]({[_0x1a9764+_0x8847('0x38')]:_0x28a618});});if(_0x597c44){_0x1eed84[_0x8847('0x35')]({'pauseType':_0x597c44});}}else if(_0x40b16e){_0xb8f419[_0x8847('0x39')](function(_0x4f336e){_0x1eed84[_0x8847('0x35')]({[_0x4f336e+_0x8847('0x38')]:![]});});}_0x41356d['where']=_['merge'](_0x41356d['where'],{'$and':_0x1eed84});if(_0x54fa74['user'][_0x8847('0x30')]===_0x8847('0x3a')){var _0x4a4316={'params':{'id':_0x54fa74[_0x8847('0x3a')][_0x8847('0x3b')]},'query':{'section':_0x8847('0x3c'),'role':_0x8847('0x31'),'raw':!![],'ids':_0x6e8f6d,'customSorting':_0x16e3e7}};if(_0x54fa74['query']['online']){_0x4a4316[_0x8847('0x13')][_0x8847('0x3d')]=!![];}if(_0x51c5ca){_0x4a4316[_0x8847('0x13')][_0x8847('0x3e')]=_0x1eed84;}_0x4a4316[_0x8847('0x13')]=Object['assign'](_0x4a4316['query'],_[_0x8847('0x3f')](_0x54fa74['query'],'id'));return db[_0x8847('0x40')][_0x8847('0x41')](_0x4a4316);}return db[_0x8847('0x2b')][_0x8847('0x42')](_0x41356d);})[_0x8847('0x19')](function(_0x13f0ea){_0x3d5c49['count']=_0x13f0ea[_0x8847('0xc')];_0x3406d0=_0x13f0ea[_0x8847('0x28')];return _0x3406d0[_0x8847('0x2a')](function(_0x20fa1b){var _0x28ed43=_[_0x8847('0x43')](_0x20c763,['id',_0x20fa1b['id']]);if(_0x28ed43){var _0x58fd2c=rta[_0x8847('0x44')](_0x28ed43);_[_0x8847('0x45')](_0x20fa1b,_0x58fd2c);}_0x20fa1b[_0x8847('0x21')]=rta['getAgentStatus'](_0x20fa1b);if(_0x20fa1b['globalStatus'][_0x8847('0x20')](_0x8847('0x16'))){_0xb8f419['forEach'](function(_0x3279f7){if(_0x20fa1b[_0x3279f7+_0x8847('0x38')]){if(_0x3279f7==='voice'){if(_0x20fa1b[_0x8847('0x46')]!==_0x8847('0x47')){_0x20fa1b[_0x8847('0x46')]=_0x8847('0x16');}}else{_0x20fa1b[_0x3279f7+_0x8847('0x48')]=_0x8847('0x16');}}});}return _0x20fa1b;});})['then'](function(_0x2f66b7){if(!_0x41d073||_0x16e3e7){return _0x2f66b7;}return rta['sortAgentsByStatus'](_0x2f66b7,_0x41d073);})[_0x8847('0x19')](function(_0x1bc310){var _0x49add1=rta[_0x8847('0x49')]();_0x3d5c49[_0x8847('0x28')]=_0x1bc310[_0x8847('0x2a')](function(_0x111b4b){return _['pick'](_0x111b4b,_0x49add1);});return _0x3d5c49;})[_0x8847('0x19')](respondWithFilteredResult(_0x232617,_0x41356d))['catch'](APIHandleError(_0x232617));};exports[_0x8847('0x4a')]=function(_0x234d6b,_0x160ed2){var _0x2c1019={'count':0x0,'rows':[]};var _0x21c216={};var _0x217b87;var _0x74d806;var _0x4549a4;Promise[_0x8847('0x18')]()['then'](function(){if(_0x234d6b[_0x8847('0x13')][_0x8847('0x1a')]){if(!utils['isValidChannel'](_0x234d6b[_0x8847('0x13')]['channel'])){throw new APIBadRequestError(util['format'](_0x8847('0x1d'),_0x234d6b[_0x8847('0x13')][_0x8847('0x1a')]));}_0x217b87=_0x234d6b['query'][_0x8847('0x1a')][_0x8847('0x1e')]();}var _0x1d8c72=_['startCase'](_0x217b87)+_0x8847('0x4b');var _0x4c9f74=_[_0x8847('0x2a')](db[_0x1d8c72][_0x8847('0x2c')],function(_0x2159ba){return{'name':_0x2159ba[_0x8847('0x2d')],'type':_0x2159ba[_0x8847('0x2e')]['key']};});if(!_0x234d6b['query'][_0x8847('0x4c')]){var _0x305e8b=['id','name'];if(_0x217b87==='voice'){_0x305e8b[_0x8847('0x35')](_0x8847('0x2e'));if(_0x234d6b[_0x8847('0x13')][_0x8847('0x2e')]===_0x8847('0x4d')){_0x305e8b[_0x8847('0x35')](['dialActive',_0x8847('0x4e')]);}}_0x234d6b[_0x8847('0x13')]['fields']=_0x305e8b[_0x8847('0x24')](',');}_0x21c216=qs['getOptions'](_0x4c9f74,_0x234d6b);if(_0x234d6b[_0x8847('0x3a')][_0x8847('0x30')]===_0x8847('0x3a')){var _0x26d67a={'params':{'id':_0x234d6b['user']['userProfileId']},'query':{'section':_0x217b87===_0x8847('0x4f')&&_0x234d6b[_0x8847('0x13')][_0x8847('0x2e')]===_0x8847('0x4d')?'QueueCampaigns':_['startCase'](_0x217b87)+_0x8847('0x50'),'type':_0x234d6b[_0x8847('0x13')]['type'],'nolimit':!![],'sort':_0x8847('0x51'),'filter':_0x234d6b[_0x8847('0x13')]['filter']}};_0x26d67a[_0x8847('0x13')]=Object[_0x8847('0x52')](_0x26d67a[_0x8847('0x13')],_0x234d6b['query']);delete _0x26d67a[_0x8847('0x13')]['id'];return db[_0x8847('0x40')][_0x8847('0x41')](_0x26d67a);}return db[_0x1d8c72][_0x8847('0x42')](_0x21c216);})['then'](function(_0x455762){_0x2c1019[_0x8847('0xc')]=_0x455762[_0x8847('0xc')];_0x74d806=_0x455762['rows'];return rtq['getRealtimeQueues'](_0x234d6b,_0x217b87);})[_0x8847('0x19')](function(_0x41dbaf){_0x4549a4=_0x41dbaf[_0x8847('0x28')];return rtq['initializeQueues'](_0x74d806,_0x4549a4,_0x217b87,_0x234d6b['query'][_0x8847('0x2e')]);})[_0x8847('0x19')](function(_0x68c4c9){_0x2c1019['rows']=_0x68c4c9;return _0x2c1019;})[_0x8847('0x19')](respondWithFilteredResult(_0x160ed2,_0x21c216))[_0x8847('0x53')](APIHandleError(_0x160ed2));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 319d348..9908bdb 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(_0x7aee79,_0x124af2){var _0xcbf9d1=function(_0x3f9f5f){while(--_0x3f9f5f){_0x7aee79['push'](_0x7aee79['shift']());}};_0xcbf9d1(++_0x124af2);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4de767,_0x1e4e15){var _0x561d85=function(_0x7902ec){while(--_0x7902ec){_0x4de767['push'](_0x4de767['shift']());}};_0x561d85(++_0x1e4e15);}(_0x70e0,0x17b));var _0x070e=function(_0x8e28c6,_0x4f0896){_0x8e28c6=_0x8e28c6-0x0;var _0xc3955e=_0x70e0[_0x8e28c6];return _0xc3955e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c81dd32..c16f4ee 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 _0xb1aa=['sequelize','exports','STRING','DATE','INTEGER'];(function(_0x4d855d,_0x4e198c){var _0x3c2e07=function(_0x3a4f3e){while(--_0x3a4f3e){_0x4d855d['push'](_0x4d855d['shift']());}};_0x3c2e07(++_0x4e198c);}(_0xb1aa,0x159));var _0xab1a=function(_0x513d85,_0x4c11ee){_0x513d85=_0x513d85-0x0;var _0x908d16=_0xb1aa[_0x513d85];return _0x908d16;};'use strict';var Sequelize=require(_0xab1a('0x0'));module[_0xab1a('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xab1a('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xab1a('0x2')]},'starttime':{'type':Sequelize[_0xab1a('0x3')]},'responsetime':{'type':Sequelize[_0xab1a('0x3')]},'ringtime':{'type':Sequelize[_0xab1a('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xab1a('0x2')]},'campaigntype':{'type':Sequelize[_0xab1a('0x2')]},'membername':{'type':Sequelize[_0xab1a('0x2')]}}; \ No newline at end of file +var _0xafdd=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0xafdd,0x19a));var _0xdafd=function(_0x54efa9,_0x1d3773){_0x54efa9=_0x54efa9-0x0;var _0x4289e4=_0xafdd[_0x54efa9];return _0x4289e4;};'use strict';var Sequelize=require(_0xdafd('0x0'));module[_0xdafd('0x1')]={'state':{'type':Sequelize[_0xdafd('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xdafd('0x3')]},'scheduledat':{'type':Sequelize[_0xdafd('0x4')]},'uniqueid':{'type':Sequelize[_0xdafd('0x3')]},'starttime':{'type':Sequelize[_0xdafd('0x4')]},'responsetime':{'type':Sequelize[_0xdafd('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xdafd('0x3')]},'campaigntype':{'type':Sequelize[_0xdafd('0x3')]},'membername':{'type':Sequelize[_0xdafd('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 6ab7d7c..297b812 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 _0x1600=['api','moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x19e57f,_0x4ae750){var _0x469556=function(_0xf6968b){while(--_0xf6968b){_0x19e57f['push'](_0x19e57f['shift']());}};_0x469556(++_0x4ae750);}(_0x1600,0x7b));var _0x0160=function(_0x3f91c5,_0x2967ca){_0x3f91c5=_0x3f91c5-0x0;var _0x351685=_0x1600[_0x3f91c5];return _0x351685;};'use strict';var _=require(_0x0160('0x0'));var util=require(_0x0160('0x1'));var logger=require(_0x0160('0x2'))(_0x0160('0x3'));var moment=require(_0x0160('0x4'));var BPromise=require(_0x0160('0x5'));var rp=require(_0x0160('0x6'));var fs=require('fs');var path=require(_0x0160('0x7'));var rimraf=require(_0x0160('0x8'));var config=require('../../config/environment');var attributes=require(_0x0160('0x9'));module[_0x0160('0xa')]=function(_0xefa155,_0x506b46){return _0xefa155[_0x0160('0xb')](_0x0160('0xc'),attributes,{'tableName':_0x0160('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e3b=['lodash','util','../../config/logger','moment','request-promise','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0x6e3b,0x108));var _0xb6e3=function(_0x5cbcee,_0x94c367){_0x5cbcee=_0x5cbcee-0x0;var _0x51a39a=_0x6e3b[_0x5cbcee];return _0x51a39a;};'use strict';var _=require(_0xb6e3('0x0'));var util=require(_0xb6e3('0x1'));var logger=require(_0xb6e3('0x2'))('api');var moment=require(_0xb6e3('0x3'));var BPromise=require('bluebird');var rp=require(_0xb6e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb6e3('0x5'));var attributes=require(_0xb6e3('0x6'));module['exports']=function(_0x2cc859,_0x1e0e7a){return _0x2cc859['define'](_0xb6e3('0x7'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 35c314f..690d66d 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 _0x6752=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','catch','ReportAgentPreview','body','options','raw','then','CreateReportAgentPreview','stringify'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6752,0x96));var _0x2675=function(_0xc4c878,_0x52a8e4){_0xc4c878=_0xc4c878-0x0;var _0x121b22=_0x6752[_0xc4c878];return _0x121b22;};'use strict';var _=require(_0x2675('0x0'));var util=require(_0x2675('0x1'));var moment=require(_0x2675('0x2'));var BPromise=require(_0x2675('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2675('0x4'));var db=require(_0x2675('0x5'))['db'];var utils=require(_0x2675('0x6'));var logger=require(_0x2675('0x7'))(_0x2675('0x8'));var config=require(_0x2675('0x9'));var jayson=require(_0x2675('0xa'));var client=jayson[_0x2675('0xb')][_0x2675('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x518e17,_0x316a58,_0x65ae43){return new BPromise(function(_0x604c8a,_0x11acbf){return client[_0x2675('0xd')](_0x518e17,_0x65ae43)['then'](function(_0x5d12c6){logger[_0x2675('0xe')](_0x2675('0xf'),_0x316a58,_0x2675('0x10'));logger[_0x2675('0x11')](_0x2675('0x12'),_0x316a58,_0x2675('0x10'),JSON['stringify'](_0x5d12c6));if(_0x5d12c6[_0x2675('0x13')]){if(_0x5d12c6[_0x2675('0x13')][_0x2675('0x14')]===0x1f4){logger[_0x2675('0x13')](_0x2675('0xf'),_0x316a58,_0x5d12c6[_0x2675('0x13')][_0x2675('0x15')]);return _0x11acbf(_0x5d12c6[_0x2675('0x13')][_0x2675('0x15')]);}logger['error'](_0x2675('0xf'),_0x316a58,_0x5d12c6[_0x2675('0x13')]['message']);return _0x604c8a(_0x5d12c6[_0x2675('0x13')]['message']);}else{logger[_0x2675('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x316a58,_0x2675('0x10'));_0x604c8a(_0x5d12c6['result'][_0x2675('0x15')]);}})[_0x2675('0x16')](function(_0x402faf){logger[_0x2675('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x316a58,_0x402faf);_0x11acbf(_0x402faf);});});}exports['CreateReportAgentPreview']=function(_0x10f2a9){var _0x5a86e0=this;return new Promise(function(_0x288445,_0x45c54d){return db[_0x2675('0x17')]['create'](_0x10f2a9[_0x2675('0x18')],{'raw':_0x10f2a9[_0x2675('0x19')]?_0x10f2a9[_0x2675('0x19')][_0x2675('0x1a')]===undefined?!![]:![]:!![]})[_0x2675('0x1b')](function(_0x16e35c){logger[_0x2675('0xe')](_0x2675('0x1c'),_0x10f2a9);logger[_0x2675('0x11')](_0x2675('0x1c'),_0x10f2a9,JSON[_0x2675('0x1d')](_0x16e35c));_0x288445(_0x16e35c);})[_0x2675('0x16')](function(_0x1888c1){logger['error'](_0x2675('0x1c'),_0x1888c1['message'],_0x10f2a9);_0x45c54d(_0x5a86e0[_0x2675('0x13')](0x1f4,_0x1888c1[_0x2675('0x15')]));});});}; \ No newline at end of file +var _0xbdcd=['error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xcc44c6,_0x4471c2){var _0x26c192=function(_0x25e00d){while(--_0x25e00d){_0xcc44c6['push'](_0xcc44c6['shift']());}};_0x26c192(++_0x4471c2);}(_0xbdcd,0xfe));var _0xdbdc=function(_0x337651,_0x2af690){_0x337651=_0x337651-0x0;var _0x20893c=_0xbdcd[_0x337651];return _0x20893c;};'use strict';var _=require(_0xdbdc('0x0'));var util=require(_0xdbdc('0x1'));var moment=require(_0xdbdc('0x2'));var BPromise=require(_0xdbdc('0x3'));var rs=require(_0xdbdc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdbdc('0x5'));var config=require(_0xdbdc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdbdc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x253ebe,_0x20b24c,_0x588f88){return new BPromise(function(_0x55f7af,_0xd42874){return client[_0xdbdc('0x8')](_0x253ebe,_0x588f88)[_0xdbdc('0x9')](function(_0x25eca3){logger[_0xdbdc('0xa')](_0xdbdc('0xb'),_0x20b24c,_0xdbdc('0xc'));logger[_0xdbdc('0xd')](_0xdbdc('0xe'),_0x20b24c,_0xdbdc('0xc'),JSON[_0xdbdc('0xf')](_0x25eca3));if(_0x25eca3[_0xdbdc('0x10')]){if(_0x25eca3[_0xdbdc('0x10')][_0xdbdc('0x11')]===0x1f4){logger[_0xdbdc('0x10')](_0xdbdc('0xb'),_0x20b24c,_0x25eca3[_0xdbdc('0x10')][_0xdbdc('0x12')]);return _0xd42874(_0x25eca3[_0xdbdc('0x10')][_0xdbdc('0x12')]);}logger[_0xdbdc('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x20b24c,_0x25eca3[_0xdbdc('0x10')][_0xdbdc('0x12')]);return _0x55f7af(_0x25eca3[_0xdbdc('0x10')][_0xdbdc('0x12')]);}else{logger[_0xdbdc('0xa')](_0xdbdc('0xb'),_0x20b24c,_0xdbdc('0xc'));_0x55f7af(_0x25eca3[_0xdbdc('0x13')]['message']);}})[_0xdbdc('0x14')](function(_0x38b3be){logger[_0xdbdc('0x10')](_0xdbdc('0xb'),_0x20b24c,_0x38b3be);_0xd42874(_0x38b3be);});});}exports[_0xdbdc('0x15')]=function(_0x37f86a){var _0x185275=this;return new Promise(function(_0x4a8be9,_0x2302d2){return db[_0xdbdc('0x16')][_0xdbdc('0x17')](_0x37f86a[_0xdbdc('0x18')],{'raw':_0x37f86a['options']?_0x37f86a[_0xdbdc('0x19')][_0xdbdc('0x1a')]===undefined?!![]:![]:!![]})[_0xdbdc('0x9')](function(_0x58a91e){logger['info'](_0xdbdc('0x15'),_0x37f86a);logger[_0xdbdc('0xd')](_0xdbdc('0x15'),_0x37f86a,JSON[_0xdbdc('0xf')](_0x58a91e));_0x4a8be9(_0x58a91e);})[_0xdbdc('0x14')](function(_0x270802){logger[_0xdbdc('0x10')]('CreateReportAgentPreview',_0x270802['message'],_0x37f86a);_0x2302d2(_0x185275['error'](0x1f4,_0x270802[_0xdbdc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 998e3ec..57bb77e 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 _0x7643=['mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','campaigns','/fax/accounts','faxAccounts'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7643,0x6b));var _0x3764=function(_0xbba421,_0x81d172){_0xbba421=_0xbba421-0x0;var _0x420880=_0x7643[_0xbba421];return _0x420880;};'use strict';var multer=require(_0x3764('0x0'));var util=require(_0x3764('0x1'));var path=require('path');var express=require(_0x3764('0x2'));var router=express[_0x3764('0x3')]();var auth=require(_0x3764('0x4'));var controller=require(_0x3764('0x5'));router[_0x3764('0x6')](_0x3764('0x7'),auth[_0x3764('0x8')](),controller[_0x3764('0x9')]);router[_0x3764('0x6')](_0x3764('0xa'),auth[_0x3764('0x8')](),controller[_0x3764('0xb')]);router[_0x3764('0x6')](_0x3764('0xc'),auth[_0x3764('0x8')](),controller[_0x3764('0xd')]);router[_0x3764('0x6')](_0x3764('0xe'),auth[_0x3764('0x8')](),controller['voiceQueues']);router[_0x3764('0x6')](_0x3764('0xf'),auth[_0x3764('0x8')](),controller[_0x3764('0x10')]);router[_0x3764('0x6')]('/mail/queues',auth[_0x3764('0x8')](),controller[_0x3764('0x11')]);router['get'](_0x3764('0x12'),auth[_0x3764('0x8')](),controller[_0x3764('0x13')]);router[_0x3764('0x6')](_0x3764('0x14'),auth[_0x3764('0x8')](),controller[_0x3764('0x15')]);router['get'](_0x3764('0x16'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x3764('0x6')](_0x3764('0x17'),auth[_0x3764('0x8')](),controller[_0x3764('0x18')]);router[_0x3764('0x6')](_0x3764('0x19'),auth[_0x3764('0x8')](),controller[_0x3764('0x1a')]);router['get']('/voice/queues/preview/:id',auth[_0x3764('0x8')](),controller[_0x3764('0x1b')]);router['get'](_0x3764('0x1c'),auth[_0x3764('0x8')](),controller[_0x3764('0x1d')]);router[_0x3764('0x6')](_0x3764('0x1e'),auth[_0x3764('0x8')](),controller['voiceQueuesChannel']);router[_0x3764('0x6')](_0x3764('0x1f'),auth['isAuthenticated'](),controller[_0x3764('0x20')]);router[_0x3764('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x3764('0x21')]);router[_0x3764('0x6')](_0x3764('0x22'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x3764('0x23')](_0x3764('0x22'),auth[_0x3764('0x8')](),controller[_0x3764('0x24')]);router[_0x3764('0x6')](_0x3764('0x25'),auth[_0x3764('0x8')](),controller['outbound']);router[_0x3764('0x6')](_0x3764('0x26'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0x3764('0x6')](_0x3764('0x27'),auth[_0x3764('0x8')](),controller[_0x3764('0x28')]);router[_0x3764('0x23')](_0x3764('0x29'),auth[_0x3764('0x8')](),controller[_0x3764('0x2a')]);router[_0x3764('0x6')](_0x3764('0x2b'),auth[_0x3764('0x8')](),controller[_0x3764('0x2c')]);router[_0x3764('0x6')]('/trunks',auth[_0x3764('0x8')](),controller[_0x3764('0x2d')]);router[_0x3764('0x6')]('/campaigns',auth[_0x3764('0x8')](),controller[_0x3764('0x2e')]);router[_0x3764('0x6')](_0x3764('0x2f'),auth[_0x3764('0x8')](),controller[_0x3764('0x30')]);router[_0x3764('0x6')]('/chat/queues/waitinginteractions',auth[_0x3764('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x3764('0x6')]('/mail/queues/waitinginteractions',auth[_0x3764('0x8')](),controller[_0x3764('0x31')]);router[_0x3764('0x6')](_0x3764('0x32'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x3764('0x33'),auth['isAuthenticated'](),controller[_0x3764('0x34')]);router[_0x3764('0x6')]('/sms/queues/waitinginteractions',auth[_0x3764('0x8')](),controller[_0x3764('0x35')]);router[_0x3764('0x6')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3764('0x36')]);router[_0x3764('0x6')](_0x3764('0x37'),auth['isAuthenticated'](),controller[_0x3764('0x38')]);router['post']('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x3764('0x39')](_0x3764('0x3a')));router['get'](_0x3764('0x3b'),auth[_0x3764('0x8')](),controller[_0x3764('0x3c')]);router[_0x3764('0x3d')](_0x3764('0x3e'),auth[_0x3764('0x8')](),controller[_0x3764('0x39')]('chat'));router[_0x3764('0x6')](_0x3764('0x3f'),auth['isAuthenticated'](),controller[_0x3764('0x40')]);router[_0x3764('0x3d')](_0x3764('0x41'),auth[_0x3764('0x8')](),controller[_0x3764('0x39')]('fax'));router['get'](_0x3764('0x42'),auth['isAuthenticated'](),controller[_0x3764('0x43')]);router['post'](_0x3764('0x44'),auth[_0x3764('0x8')](),controller[_0x3764('0x39')](_0x3764('0x45')));router[_0x3764('0x6')](_0x3764('0x46'),auth[_0x3764('0x8')](),controller['showOpenchannelQueues']);router[_0x3764('0x3d')](_0x3764('0x47'),auth[_0x3764('0x8')](),controller[_0x3764('0x39')](_0x3764('0x48')));router[_0x3764('0x3d')]('/whatsapp/queues/:id/notify',auth[_0x3764('0x8')](),controller[_0x3764('0x39')]('whatsapp'));router[_0x3764('0x6')](_0x3764('0x49'),auth[_0x3764('0x8')](),controller['showSmsQueues']);router[_0x3764('0x6')](_0x3764('0x4a'),auth[_0x3764('0x8')](),controller[_0x3764('0x4b')]);router['post'](_0x3764('0x4c'),auth[_0x3764('0x8')](),controller[_0x3764('0x4d')]);module['exports']=router; \ No newline at end of file +var _0xceab=['mailQueues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','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','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues'];(function(_0x5e158b,_0x1811d5){var _0x2e0db5=function(_0x381185){while(--_0x381185){_0x5e158b['push'](_0x5e158b['shift']());}};_0x2e0db5(++_0x1811d5);}(_0xceab,0x93));var _0xbcea=function(_0x309ca2,_0x49e93c){_0x309ca2=_0x309ca2-0x0;var _0x12ad59=_0xceab[_0x309ca2];return _0x12ad59;};'use strict';var multer=require(_0xbcea('0x0'));var util=require(_0xbcea('0x1'));var path=require(_0xbcea('0x2'));var express=require(_0xbcea('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xbcea('0x4'));router[_0xbcea('0x5')](_0xbcea('0x6'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x8')]);router[_0xbcea('0x5')](_0xbcea('0x9'),auth[_0xbcea('0x7')](),controller['voiceChannelMixMonitor']);router[_0xbcea('0x5')](_0xbcea('0xa'),auth[_0xbcea('0x7')](),controller[_0xbcea('0xb')]);router['get'](_0xbcea('0xc'),auth[_0xbcea('0x7')](),controller[_0xbcea('0xd')]);router[_0xbcea('0x5')](_0xbcea('0xe'),auth[_0xbcea('0x7')](),controller[_0xbcea('0xf')]);router[_0xbcea('0x5')](_0xbcea('0x10'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x11')]);router['get'](_0xbcea('0x12'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x13')]);router[_0xbcea('0x5')]('/openchannel/queues',auth[_0xbcea('0x7')](),controller[_0xbcea('0x14')]);router[_0xbcea('0x5')]('/sms/queues',auth[_0xbcea('0x7')](),controller[_0xbcea('0x15')]);router['get'](_0xbcea('0x16'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x17')]);router['get']('/fax/queues',auth[_0xbcea('0x7')](),controller[_0xbcea('0x18')]);router[_0xbcea('0x5')](_0xbcea('0x19'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x1a')]);router[_0xbcea('0x5')](_0xbcea('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0xbcea('0x5')](_0xbcea('0x1c'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xbcea('0x5')](_0xbcea('0x1d'),auth['isAuthenticated'](),controller[_0xbcea('0x1e')]);router['get'](_0xbcea('0x1f'),auth[_0xbcea('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0xbcea('0x5')](_0xbcea('0x20'),auth['isAuthenticated'](),controller[_0xbcea('0x21')]);router[_0xbcea('0x22')]('/voice/queues/:id',auth[_0xbcea('0x7')](),controller[_0xbcea('0x23')]);router[_0xbcea('0x5')]('/outbound',auth[_0xbcea('0x7')](),controller[_0xbcea('0x24')]);router[_0xbcea('0x5')]('/outbound/channels',auth[_0xbcea('0x7')](),controller[_0xbcea('0x25')]);router[_0xbcea('0x5')](_0xbcea('0x26'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x27')]);router[_0xbcea('0x22')](_0xbcea('0x28'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x29')]);router[_0xbcea('0x5')](_0xbcea('0x2a'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x2b')]);router[_0xbcea('0x5')](_0xbcea('0x2c'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x2d')]);router['get'](_0xbcea('0x2e'),auth['isAuthenticated'](),controller['campaigns']);router[_0xbcea('0x5')]('/fax/accounts',auth[_0xbcea('0x7')](),controller[_0xbcea('0x2f')]);router[_0xbcea('0x5')](_0xbcea('0x30'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x31')]);router[_0xbcea('0x5')](_0xbcea('0x32'),auth[_0xbcea('0x7')](),controller['mailQueuesWaitingInteractions']);router['get'](_0xbcea('0x33'),auth[_0xbcea('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0xbcea('0x5')]('/openchannel/queues/:id/waitinginteractions',auth[_0xbcea('0x7')](),controller[_0xbcea('0x34')]);router[_0xbcea('0x5')](_0xbcea('0x35'),auth['isAuthenticated'](),controller[_0xbcea('0x36')]);router['get'](_0xbcea('0x37'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x38')]);router['get'](_0xbcea('0x39'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x3a')]);router['post'](_0xbcea('0x3b'),auth[_0xbcea('0x7')](),controller['queueNotify'](_0xbcea('0x3c')));router['get'](_0xbcea('0x3d'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x3e')]);router[_0xbcea('0x3f')](_0xbcea('0x40'),auth['isAuthenticated'](),controller[_0xbcea('0x41')](_0xbcea('0x42')));router['get'](_0xbcea('0x43'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x44')]);router[_0xbcea('0x3f')](_0xbcea('0x45'),auth[_0xbcea('0x7')](),controller['queueNotify'](_0xbcea('0x46')));router[_0xbcea('0x5')]('/fax/queues/:id',auth[_0xbcea('0x7')](),controller['showFaxQueues']);router['post'](_0xbcea('0x47'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x41')](_0xbcea('0x48')));router[_0xbcea('0x5')]('/openchannel/queues/:id',auth[_0xbcea('0x7')](),controller[_0xbcea('0x49')]);router[_0xbcea('0x3f')](_0xbcea('0x4a'),auth['isAuthenticated'](),controller[_0xbcea('0x41')](_0xbcea('0x4b')));router[_0xbcea('0x3f')](_0xbcea('0x4c'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x41')]('whatsapp'));router['get']('/sms/queues/:id',auth['isAuthenticated'](),controller[_0xbcea('0x4d')]);router[_0xbcea('0x5')]('/whatsapp/queues/:id',auth[_0xbcea('0x7')](),controller[_0xbcea('0x4e')]);router[_0xbcea('0x3f')](_0xbcea('0x4f'),auth['isAuthenticated'](),controller[_0xbcea('0x50')]);module[_0xbcea('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index ea537f8..e5b247e 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 _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x79c0de,_0x4cd77d){var _0x3d3f03=function(_0x325bba){while(--_0x325bba){_0x79c0de['push'](_0x79c0de['shift']());}};_0x3d3f03(++_0x4cd77d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c2dca28..0aa44e5 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 _0x2369=['get','show','/:id/run','run','post','create','put','/:id','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x359f9b,_0x2843fb){var _0x4c2ba7=function(_0x269c49){while(--_0x269c49){_0x359f9b['push'](_0x359f9b['shift']());}};_0x4c2ba7(++_0x2843fb);}(_0x2369,0x1d3));var _0x9236=function(_0x11219a,_0x517322){_0x11219a=_0x11219a-0x0;var _0x36afbc=_0x2369[_0x11219a];return _0x36afbc;};'use strict';var multer=require(_0x9236('0x0'));var util=require('util');var path=require(_0x9236('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9236('0x2')]();var fs_extra=require(_0x9236('0x3'));var auth=require(_0x9236('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9236('0x5'));var controller=require('./schedule.controller');router['get']('/',auth[_0x9236('0x6')](),controller[_0x9236('0x7')]);router[_0x9236('0x8')]('/:id',auth[_0x9236('0x6')](),controller[_0x9236('0x9')]);router[_0x9236('0x8')](_0x9236('0xa'),auth['isAuthenticated'](),controller[_0x9236('0xb')]);router[_0x9236('0xc')]('/',auth[_0x9236('0x6')](),controller[_0x9236('0xd')]);router[_0x9236('0xe')](_0x9236('0xf'),auth[_0x9236('0x6')](),controller['update']);router[_0x9236('0x10')](_0x9236('0xf'),auth[_0x9236('0x6')](),controller[_0x9236('0x11')]);module[_0x9236('0x12')]=router; \ No newline at end of file +var _0xfb63=['./schedule.controller','isAuthenticated','index','show','get','/:id/run','run','create','update','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x2b9370,_0x4d10e9){var _0x540472=function(_0x422e8f){while(--_0x422e8f){_0x2b9370['push'](_0x2b9370['shift']());}};_0x540472(++_0x4d10e9);}(_0xfb63,0x14f));var _0x3fb6=function(_0x511cc6,_0x115846){_0x511cc6=_0x511cc6-0x0;var _0x48f888=_0xfb63[_0x511cc6];return _0x48f888;};'use strict';var multer=require(_0x3fb6('0x0'));var util=require(_0x3fb6('0x1'));var path=require('path');var timeout=require(_0x3fb6('0x2'));var express=require(_0x3fb6('0x3'));var router=express[_0x3fb6('0x4')]();var fs_extra=require(_0x3fb6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3fb6('0x6'));var controller=require(_0x3fb6('0x7'));router['get']('/',auth[_0x3fb6('0x8')](),controller[_0x3fb6('0x9')]);router['get']('/:id',auth[_0x3fb6('0x8')](),controller[_0x3fb6('0xa')]);router[_0x3fb6('0xb')](_0x3fb6('0xc'),auth[_0x3fb6('0x8')](),controller[_0x3fb6('0xd')]);router['post']('/',auth[_0x3fb6('0x8')](),controller[_0x3fb6('0xe')]);router['put']('/:id',auth[_0x3fb6('0x8')](),controller[_0x3fb6('0xf')]);router['delete'](_0x3fb6('0x10'),auth[_0x3fb6('0x8')](),controller['destroy']);module[_0x3fb6('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a0c05eb..26d9fa5 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 _0xf798=['hours','minutes','csv','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','ENUM','years','months','days'];(function(_0x1ec8f9,_0x22f5e7){var _0x17cd3d=function(_0x156ad2){while(--_0x156ad2){_0x1ec8f9['push'](_0x1ec8f9['shift']());}};_0x17cd3d(++_0x22f5e7);}(_0xf798,0x18d));var _0x8f79=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf798[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x8f79('0x0'));module[_0x8f79('0x1')]={'name':{'type':Sequelize[_0x8f79('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8f79('0x2')]},'active':{'type':Sequelize[_0x8f79('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8f79('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x8f79('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8f79('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8f79('0x5')](_0x8f79('0x6'),'quarters',_0x8f79('0x7'),'weeks',_0x8f79('0x8'),_0x8f79('0x9'),_0x8f79('0xa')),'allowNull':![],'defaultValue':_0x8f79('0x8')},'output':{'type':Sequelize[_0x8f79('0x5')](_0x8f79('0xb'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x8f79('0x5')]('custom',_0x8f79('0xc')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x8f79('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x8f79('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x8f79('0xd')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x878a=['quarters','months','days','hours','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x2122be,_0x290730){var _0x441bf6=function(_0x56d6f8){while(--_0x56d6f8){_0x2122be['push'](_0x2122be['shift']());}};_0x441bf6(++_0x290730);}(_0x878a,0x1de));var _0xa878=function(_0x2fd169,_0x29b5f0){_0x2fd169=_0x2fd169-0x0;var _0x390237=_0x878a[_0x2fd169];return _0x390237;};'use strict';var Sequelize=require(_0xa878('0x0'));module[_0xa878('0x1')]={'name':{'type':Sequelize[_0xa878('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa878('0x2')]},'active':{'type':Sequelize[_0xa878('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa878('0x2')],'allowNull':![],'defaultValue':_0xa878('0x4')},'startAt':{'type':Sequelize[_0xa878('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xa878('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa878('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa878('0x7')]('years',_0xa878('0x8'),_0xa878('0x9'),'weeks',_0xa878('0xa'),_0xa878('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xa878('0xa')},'output':{'type':Sequelize['ENUM'](_0xa878('0xc'),_0xa878('0xd'),_0xa878('0xe')),'allowNull':![],'defaultValue':_0xa878('0xc')},'type':{'type':Sequelize[_0xa878('0x7')](_0xa878('0xf'),_0xa878('0x10')),'allowNull':![],'defaultValue':_0xa878('0xf')},'sendMail':{'type':Sequelize[_0xa878('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xa878('0x2')]},'cc':{'type':Sequelize[_0xa878('0x11')]},'bcc':{'type':Sequelize[_0xa878('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f425f25..036cd3c 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 _0x8e8e=['Scheduler','UserProfileResource','error','name','index','map','Schedule','rawAttributes','type','key','model','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','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','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x51b744,_0x156d96){var _0xd25a58=function(_0x9cd8c2){while(--_0x9cd8c2){_0x51b744['push'](_0x51b744['shift']());}};_0xd25a58(++_0x156d96);}(_0x8e8e,0x89));var _0xe8e8=function(_0x14d303,_0x14dd8c){_0x14d303=_0x14d303-0x0;var _0x14ff60=_0x8e8e[_0x14d303];return _0x14ff60;};'use strict';var emlformat=require(_0xe8e8('0x0'));var rimraf=require(_0xe8e8('0x1'));var zipdir=require(_0xe8e8('0x2'));var jsonpatch=require(_0xe8e8('0x3'));var rp=require(_0xe8e8('0x4'));var moment=require(_0xe8e8('0x5'));var BPromise=require(_0xe8e8('0x6'));var Mustache=require(_0xe8e8('0x7'));var util=require(_0xe8e8('0x8'));var path=require(_0xe8e8('0x9'));var sox=require(_0xe8e8('0xa'));var csv=require(_0xe8e8('0xb'));var ejs=require(_0xe8e8('0xc'));var fs=require('fs');var fs_extra=require(_0xe8e8('0xd'));var _=require(_0xe8e8('0xe'));var squel=require(_0xe8e8('0xf'));var crypto=require('crypto');var jsforce=require(_0xe8e8('0x10'));var deskjs=require(_0xe8e8('0x11'));var toCsv=require(_0xe8e8('0xb'));var querystring=require(_0xe8e8('0x12'));var Papa=require(_0xe8e8('0x13'));var Redis=require(_0xe8e8('0x14'));var authService=require(_0xe8e8('0x15'));var qs=require(_0xe8e8('0x16'));var as=require(_0xe8e8('0x17'));var hardwareService=require(_0xe8e8('0x18'));var logger=require(_0xe8e8('0x19'))(_0xe8e8('0x1a'));var utils=require(_0xe8e8('0x1b'));var config=require(_0xe8e8('0x1c'));var licenseUtil=require(_0xe8e8('0x1d'));var db=require(_0xe8e8('0x1e'))['db'];function respondWithStatusCode(_0x32a7b3,_0x3fe608){_0x3fe608=_0x3fe608||0xcc;return function(_0x40752c){if(_0x40752c){return _0x32a7b3[_0xe8e8('0x1f')](_0x3fe608);}return _0x32a7b3['status'](_0x3fe608)['end']();};}function respondWithResult(_0x59fd84,_0x656610){_0x656610=_0x656610||0xc8;return function(_0x4f6ab0){if(_0x4f6ab0){return _0x59fd84[_0xe8e8('0x20')](_0x656610)[_0xe8e8('0x21')](_0x4f6ab0);}};}function respondWithFilteredResult(_0x59d103,_0x1f7812){return function(_0xe449e9){if(_0xe449e9){var _0x43e36d=typeof _0x1f7812[_0xe8e8('0x22')]===_0xe8e8('0x23')&&typeof _0x1f7812['limit']===_0xe8e8('0x23');var _0x590969=_0xe449e9['count'];var _0x2a817a=_0x43e36d?0x0:_0x1f7812[_0xe8e8('0x22')];var _0x4c3519=_0x43e36d?_0xe449e9[_0xe8e8('0x24')]:_0x1f7812[_0xe8e8('0x22')]+_0x1f7812[_0xe8e8('0x25')];var _0x3666b7;if(_0x4c3519>=_0x590969){_0x4c3519=_0x590969;_0x3666b7=0xc8;}else{_0x3666b7=0xce;}_0x59d103[_0xe8e8('0x20')](_0x3666b7);return _0x59d103[_0xe8e8('0x26')](_0xe8e8('0x27'),_0x2a817a+'-'+_0x4c3519+'/'+_0x590969)['json'](_0xe449e9);}return null;};}function patchUpdates(_0x36233a){return function(_0x29996b){try{jsonpatch[_0xe8e8('0x28')](_0x29996b,_0x36233a,!![]);}catch(_0xeced4d){return BPromise[_0xe8e8('0x29')](_0xeced4d);}return _0x29996b[_0xe8e8('0x2a')]();};}function saveUpdates(_0x2d2eb5,_0x50fc1d){return function(_0xde9e6f){if(_0xde9e6f){return _0xde9e6f[_0xe8e8('0x2b')](_0x2d2eb5)[_0xe8e8('0x2c')](function(_0x312571){return _0x312571;});}return null;};}function removeEntity(_0xd663f0,_0x35e9c6){return function(_0x876138){if(_0x876138){return _0x876138[_0xe8e8('0x2d')]()[_0xe8e8('0x2c')](function(){var _0x3aa43c=_0x876138[_0xe8e8('0x2e')]({'plain':!![]});var _0x27d983=_0xe8e8('0x2f');return db[_0xe8e8('0x30')][_0xe8e8('0x2d')]({'where':{'type':_0x27d983,'resourceId':_0x3aa43c['id']}})['then'](function(){return _0x876138;});})[_0xe8e8('0x2c')](function(){_0xd663f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x208fcb,_0x46ab1c){return function(_0x1bed0f){if(!_0x1bed0f){_0x208fcb[_0xe8e8('0x1f')](0x194);}return _0x1bed0f;};}function handleError(_0x5db593,_0xf19f34){_0xf19f34=_0xf19f34||0x1f4;return function(_0x49213f){logger[_0xe8e8('0x31')](_0x49213f['stack']);if(_0x49213f[_0xe8e8('0x32')]){delete _0x49213f[_0xe8e8('0x32')];}_0x5db593[_0xe8e8('0x20')](_0xf19f34)['send'](_0x49213f);};}exports[_0xe8e8('0x33')]=function(_0x58a62d,_0x45d6c6){var _0x389179={},_0x285981={},_0x23e565={'count':0x0,'rows':[]};var _0x36065a=_[_0xe8e8('0x34')](db[_0xe8e8('0x35')][_0xe8e8('0x36')],function(_0x49e7b1){return{'name':_0x49e7b1['fieldName'],'type':_0x49e7b1[_0xe8e8('0x37')][_0xe8e8('0x38')]};});_0x285981[_0xe8e8('0x39')]=_[_0xe8e8('0x34')](_0x36065a,'name');_0x285981['query']=_['keys'](_0x58a62d['query']);_0x285981['filters']=_[_0xe8e8('0x3a')](_0x285981[_0xe8e8('0x39')],_0x285981[_0xe8e8('0x3b')]);_0x389179[_0xe8e8('0x3c')]=_[_0xe8e8('0x3a')](_0x285981['model'],qs[_0xe8e8('0x3d')](_0x58a62d[_0xe8e8('0x3b')][_0xe8e8('0x3d')]));_0x389179[_0xe8e8('0x3c')]=_0x389179[_0xe8e8('0x3c')]['length']?_0x389179['attributes']:_0x285981['model'];if(!_0x58a62d['query'][_0xe8e8('0x3e')](_0xe8e8('0x3f'))){_0x389179['limit']=qs[_0xe8e8('0x25')](_0x58a62d[_0xe8e8('0x3b')][_0xe8e8('0x25')]);_0x389179[_0xe8e8('0x22')]=qs[_0xe8e8('0x22')](_0x58a62d[_0xe8e8('0x3b')][_0xe8e8('0x22')]);}_0x389179[_0xe8e8('0x40')]=qs[_0xe8e8('0x41')](_0x58a62d[_0xe8e8('0x3b')][_0xe8e8('0x41')]);_0x389179[_0xe8e8('0x42')]=qs['filters'](_[_0xe8e8('0x43')](_0x58a62d[_0xe8e8('0x3b')],_0x285981[_0xe8e8('0x44')]),_0x36065a);if(_0x58a62d[_0xe8e8('0x3b')][_0xe8e8('0x45')]){_0x389179['where']=_[_0xe8e8('0x46')](_0x389179[_0xe8e8('0x42')],{'$or':_[_0xe8e8('0x34')](_0x36065a,function(_0x5b025a){if(_0x5b025a[_0xe8e8('0x37')]!==_0xe8e8('0x47')){var _0xcef3b0={};_0xcef3b0[_0x5b025a[_0xe8e8('0x32')]]={'$like':'%'+_0x58a62d[_0xe8e8('0x3b')][_0xe8e8('0x45')]+'%'};return _0xcef3b0;}})});}_0x389179=_[_0xe8e8('0x46')]({},_0x389179,_0x58a62d[_0xe8e8('0x48')]);var _0x37c21d={'where':_0x389179['where']};return db['Schedule']['count'](_0x37c21d)['then'](function(_0x2b884d){_0x23e565[_0xe8e8('0x24')]=_0x2b884d;if(_0x58a62d['query']['includeAll']){_0x389179[_0xe8e8('0x49')]=[{'all':!![]}];}return db[_0xe8e8('0x35')][_0xe8e8('0x4a')](_0x389179);})['then'](function(_0x20d391){_0x23e565[_0xe8e8('0x4b')]=_0x20d391;return _0x23e565;})[_0xe8e8('0x2c')](respondWithFilteredResult(_0x45d6c6,_0x389179))[_0xe8e8('0x4c')](handleError(_0x45d6c6,null));};exports['show']=function(_0x4447a0,_0x47ab0e){var _0x2c1611={'raw':![],'where':{'id':_0x4447a0[_0xe8e8('0x4d')]['id']}},_0x4d5e25={};_0x4d5e25[_0xe8e8('0x39')]=_[_0xe8e8('0x4e')](db[_0xe8e8('0x35')][_0xe8e8('0x36')]);_0x4d5e25[_0xe8e8('0x3b')]=_[_0xe8e8('0x4e')](_0x4447a0['query']);_0x4d5e25[_0xe8e8('0x44')]=_['intersection'](_0x4d5e25[_0xe8e8('0x39')],_0x4d5e25[_0xe8e8('0x3b')]);_0x2c1611['attributes']=_[_0xe8e8('0x3a')](_0x4d5e25[_0xe8e8('0x39')],qs[_0xe8e8('0x3d')](_0x4447a0[_0xe8e8('0x3b')][_0xe8e8('0x3d')]));_0x2c1611[_0xe8e8('0x3c')]=_0x2c1611[_0xe8e8('0x3c')]['length']?_0x2c1611[_0xe8e8('0x3c')]:_0x4d5e25[_0xe8e8('0x39')];if(_0x4447a0[_0xe8e8('0x3b')][_0xe8e8('0x4f')]){_0x2c1611[_0xe8e8('0x49')]=[{'all':!![]}];}_0x2c1611=_[_0xe8e8('0x46')]({},_0x2c1611,_0x4447a0[_0xe8e8('0x48')]);return db[_0xe8e8('0x35')][_0xe8e8('0x50')](_0x2c1611)['then'](handleEntityNotFound(_0x47ab0e,null))[_0xe8e8('0x2c')](respondWithResult(_0x47ab0e,null))[_0xe8e8('0x4c')](handleError(_0x47ab0e,null));};exports[_0xe8e8('0x51')]=function(_0xf4b5f2,_0xabda83){return db['Schedule'][_0xe8e8('0x51')](_0xf4b5f2['body'],{})[_0xe8e8('0x2c')](function(_0x27e140){var _0x5e4890=_0xf4b5f2[_0xe8e8('0x52')][_0xe8e8('0x2e')]({'plain':!![]});if(!_0x5e4890)throw new Error(_0xe8e8('0x53'));if(_0x5e4890[_0xe8e8('0x54')]===_0xe8e8('0x52')){var _0x2c2fd6=_0x27e140[_0xe8e8('0x2e')]({'plain':!![]});var _0xca345f=_0xe8e8('0x2f');return db[_0xe8e8('0x55')][_0xe8e8('0x50')]({'where':{'name':_0xca345f,'userProfileId':_0x5e4890[_0xe8e8('0x56')]},'raw':!![]})[_0xe8e8('0x2c')](function(_0xd02819){if(_0xd02819&&_0xd02819[_0xe8e8('0x57')]===0x0){return db[_0xe8e8('0x30')][_0xe8e8('0x51')]({'name':_0x2c2fd6[_0xe8e8('0x32')],'resourceId':_0x2c2fd6['id'],'type':_0xd02819['name'],'sectionId':_0xd02819['id']},{})[_0xe8e8('0x2c')](function(){return _0x27e140;});}else{return _0x27e140;}})['catch'](function(_0x3a14b9){logger['error'](_0xe8e8('0x58'),_0x3a14b9);throw _0x3a14b9;});}return _0x27e140;})[_0xe8e8('0x2c')](respondWithResult(_0xabda83,0xc9))[_0xe8e8('0x4c')](handleError(_0xabda83,null));};exports[_0xe8e8('0x2b')]=function(_0x2c50b4,_0x1cb76e){if(_0x2c50b4[_0xe8e8('0x59')]['id']){delete _0x2c50b4['body']['id'];}return db[_0xe8e8('0x35')][_0xe8e8('0x50')]({'where':{'id':_0x2c50b4[_0xe8e8('0x4d')]['id']}})[_0xe8e8('0x2c')](handleEntityNotFound(_0x1cb76e,null))[_0xe8e8('0x2c')](saveUpdates(_0x2c50b4[_0xe8e8('0x59')],null))[_0xe8e8('0x2c')](respondWithResult(_0x1cb76e,null))[_0xe8e8('0x4c')](handleError(_0x1cb76e,null));};exports['destroy']=function(_0x2da16c,_0x84de5){return db['Schedule'][_0xe8e8('0x50')]({'where':{'id':_0x2da16c[_0xe8e8('0x4d')]['id']}})[_0xe8e8('0x2c')](handleEntityNotFound(_0x84de5,null))['then'](removeEntity(_0x84de5,null))['catch'](handleError(_0x84de5,null));};exports[_0xe8e8('0x5a')]=function(_0x5bd684,_0x56c118,_0x96a6bf){var _0x273732=require(_0xe8e8('0x5b'));return db[_0xe8e8('0x35')]['find']({'where':{'id':_0x5bd684[_0xe8e8('0x4d')]['id']},'raw':!![]})[_0xe8e8('0x2c')](handleEntityNotFound(_0x56c118,null))[_0xe8e8('0x2c')](function(){_0x273732[_0xe8e8('0x5a')](_0x5bd684[_0xe8e8('0x4d')]['id']);})[_0xe8e8('0x2c')](respondWithStatusCode(_0x56c118,null))[_0xe8e8('0x4c')](handleError(_0x56c118,null));}; \ No newline at end of file +var _0x5c5a=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','destroy','get','stack','name','send','map','Schedule','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c5a,0x99));var _0xa5c5=function(_0x19dded,_0x19945f){_0x19dded=_0x19dded-0x0;var _0x406d58=_0x5c5a[_0x19dded];return _0x406d58;};'use strict';var emlformat=require(_0xa5c5('0x0'));var rimraf=require(_0xa5c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa5c5('0x2'));var rp=require(_0xa5c5('0x3'));var moment=require(_0xa5c5('0x4'));var BPromise=require(_0xa5c5('0x5'));var Mustache=require(_0xa5c5('0x6'));var util=require(_0xa5c5('0x7'));var path=require(_0xa5c5('0x8'));var sox=require('sox');var csv=require(_0xa5c5('0x9'));var ejs=require(_0xa5c5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5c5('0xb'));var squel=require(_0xa5c5('0xc'));var crypto=require(_0xa5c5('0xd'));var jsforce=require(_0xa5c5('0xe'));var deskjs=require(_0xa5c5('0xf'));var toCsv=require(_0xa5c5('0x9'));var querystring=require(_0xa5c5('0x10'));var Papa=require(_0xa5c5('0x11'));var Redis=require(_0xa5c5('0x12'));var authService=require(_0xa5c5('0x13'));var qs=require(_0xa5c5('0x14'));var as=require(_0xa5c5('0x15'));var hardwareService=require(_0xa5c5('0x16'));var logger=require(_0xa5c5('0x17'))(_0xa5c5('0x18'));var utils=require(_0xa5c5('0x19'));var config=require(_0xa5c5('0x1a'));var licenseUtil=require(_0xa5c5('0x1b'));var db=require(_0xa5c5('0x1c'))['db'];function respondWithStatusCode(_0x31899c,_0x5b87a9){_0x5b87a9=_0x5b87a9||0xcc;return function(_0x1d4937){if(_0x1d4937){return _0x31899c[_0xa5c5('0x1d')](_0x5b87a9);}return _0x31899c[_0xa5c5('0x1e')](_0x5b87a9)[_0xa5c5('0x1f')]();};}function respondWithResult(_0x28f08f,_0xcfd90c){_0xcfd90c=_0xcfd90c||0xc8;return function(_0x426557){if(_0x426557){return _0x28f08f[_0xa5c5('0x1e')](_0xcfd90c)[_0xa5c5('0x20')](_0x426557);}};}function respondWithFilteredResult(_0x505794,_0x3e7bf5){return function(_0x43800a){if(_0x43800a){var _0x2addaa=typeof _0x3e7bf5['offset']===_0xa5c5('0x21')&&typeof _0x3e7bf5[_0xa5c5('0x22')]===_0xa5c5('0x21');var _0x3803ec=_0x43800a['count'];var _0x4a822c=_0x2addaa?0x0:_0x3e7bf5[_0xa5c5('0x23')];var _0x144eee=_0x2addaa?_0x43800a[_0xa5c5('0x24')]:_0x3e7bf5['offset']+_0x3e7bf5[_0xa5c5('0x22')];var _0x2516dc;if(_0x144eee>=_0x3803ec){_0x144eee=_0x3803ec;_0x2516dc=0xc8;}else{_0x2516dc=0xce;}_0x505794[_0xa5c5('0x1e')](_0x2516dc);return _0x505794[_0xa5c5('0x25')](_0xa5c5('0x26'),_0x4a822c+'-'+_0x144eee+'/'+_0x3803ec)['json'](_0x43800a);}return null;};}function patchUpdates(_0x3decac){return function(_0x3497ae){try{jsonpatch['apply'](_0x3497ae,_0x3decac,!![]);}catch(_0x2af2f8){return BPromise[_0xa5c5('0x27')](_0x2af2f8);}return _0x3497ae[_0xa5c5('0x28')]();};}function saveUpdates(_0x20971a,_0x4e8613){return function(_0x31512b){if(_0x31512b){return _0x31512b['update'](_0x20971a)[_0xa5c5('0x29')](function(_0x594474){return _0x594474;});}return null;};}function removeEntity(_0x4dea7d,_0x44763a){return function(_0x10207b){if(_0x10207b){return _0x10207b[_0xa5c5('0x2a')]()['then'](function(){var _0xfd3339=_0x10207b[_0xa5c5('0x2b')]({'plain':!![]});var _0x4cd2f3='Scheduler';return db['UserProfileResource'][_0xa5c5('0x2a')]({'where':{'type':_0x4cd2f3,'resourceId':_0xfd3339['id']}})[_0xa5c5('0x29')](function(){return _0x10207b;});})['then'](function(){_0x4dea7d[_0xa5c5('0x1e')](0xcc)[_0xa5c5('0x1f')]();});}};}function handleEntityNotFound(_0x592fac,_0x442075){return function(_0x887955){if(!_0x887955){_0x592fac[_0xa5c5('0x1d')](0x194);}return _0x887955;};}function handleError(_0x5191de,_0x27ffd6){_0x27ffd6=_0x27ffd6||0x1f4;return function(_0x3fd248){logger['error'](_0x3fd248[_0xa5c5('0x2c')]);if(_0x3fd248[_0xa5c5('0x2d')]){delete _0x3fd248['name'];}_0x5191de[_0xa5c5('0x1e')](_0x27ffd6)[_0xa5c5('0x2e')](_0x3fd248);};}exports['index']=function(_0x28cd2b,_0x19c0b9){var _0x15308d={},_0x1abc03={},_0x564985={'count':0x0,'rows':[]};var _0x2cd015=_[_0xa5c5('0x2f')](db[_0xa5c5('0x30')]['rawAttributes'],function(_0x18875d){return{'name':_0x18875d['fieldName'],'type':_0x18875d[_0xa5c5('0x31')][_0xa5c5('0x32')]};});_0x1abc03[_0xa5c5('0x33')]=_[_0xa5c5('0x2f')](_0x2cd015,_0xa5c5('0x2d'));_0x1abc03[_0xa5c5('0x34')]=_[_0xa5c5('0x35')](_0x28cd2b[_0xa5c5('0x34')]);_0x1abc03[_0xa5c5('0x36')]=_['intersection'](_0x1abc03[_0xa5c5('0x33')],_0x1abc03['query']);_0x15308d[_0xa5c5('0x37')]=_[_0xa5c5('0x38')](_0x1abc03['model'],qs[_0xa5c5('0x39')](_0x28cd2b[_0xa5c5('0x34')]['fields']));_0x15308d[_0xa5c5('0x37')]=_0x15308d[_0xa5c5('0x37')][_0xa5c5('0x3a')]?_0x15308d[_0xa5c5('0x37')]:_0x1abc03[_0xa5c5('0x33')];if(!_0x28cd2b['query']['hasOwnProperty'](_0xa5c5('0x3b'))){_0x15308d['limit']=qs[_0xa5c5('0x22')](_0x28cd2b[_0xa5c5('0x34')][_0xa5c5('0x22')]);_0x15308d[_0xa5c5('0x23')]=qs['offset'](_0x28cd2b[_0xa5c5('0x34')]['offset']);}_0x15308d[_0xa5c5('0x3c')]=qs[_0xa5c5('0x3d')](_0x28cd2b[_0xa5c5('0x34')][_0xa5c5('0x3d')]);_0x15308d[_0xa5c5('0x3e')]=qs[_0xa5c5('0x36')](_[_0xa5c5('0x3f')](_0x28cd2b['query'],_0x1abc03[_0xa5c5('0x36')]),_0x2cd015);if(_0x28cd2b[_0xa5c5('0x34')][_0xa5c5('0x40')]){_0x15308d['where']=_[_0xa5c5('0x41')](_0x15308d['where'],{'$or':_['map'](_0x2cd015,function(_0x4da9f2){if(_0x4da9f2['type']!==_0xa5c5('0x42')){var _0x4d0c28={};_0x4d0c28[_0x4da9f2[_0xa5c5('0x2d')]]={'$like':'%'+_0x28cd2b[_0xa5c5('0x34')][_0xa5c5('0x40')]+'%'};return _0x4d0c28;}})});}_0x15308d=_[_0xa5c5('0x41')]({},_0x15308d,_0x28cd2b[_0xa5c5('0x43')]);var _0x11c052={'where':_0x15308d['where']};return db['Schedule'][_0xa5c5('0x24')](_0x11c052)[_0xa5c5('0x29')](function(_0x299b04){_0x564985['count']=_0x299b04;if(_0x28cd2b[_0xa5c5('0x34')]['includeAll']){_0x15308d[_0xa5c5('0x44')]=[{'all':!![]}];}return db[_0xa5c5('0x30')][_0xa5c5('0x45')](_0x15308d);})[_0xa5c5('0x29')](function(_0x1f0e5c){_0x564985[_0xa5c5('0x46')]=_0x1f0e5c;return _0x564985;})[_0xa5c5('0x29')](respondWithFilteredResult(_0x19c0b9,_0x15308d))[_0xa5c5('0x47')](handleError(_0x19c0b9,null));};exports['show']=function(_0x5948ce,_0x404426){var _0x364963={'raw':![],'where':{'id':_0x5948ce[_0xa5c5('0x48')]['id']}},_0x284c2c={};_0x284c2c['model']=_[_0xa5c5('0x35')](db[_0xa5c5('0x30')][_0xa5c5('0x49')]);_0x284c2c[_0xa5c5('0x34')]=_['keys'](_0x5948ce[_0xa5c5('0x34')]);_0x284c2c[_0xa5c5('0x36')]=_[_0xa5c5('0x38')](_0x284c2c['model'],_0x284c2c['query']);_0x364963['attributes']=_[_0xa5c5('0x38')](_0x284c2c['model'],qs[_0xa5c5('0x39')](_0x5948ce['query'][_0xa5c5('0x39')]));_0x364963['attributes']=_0x364963[_0xa5c5('0x37')][_0xa5c5('0x3a')]?_0x364963[_0xa5c5('0x37')]:_0x284c2c[_0xa5c5('0x33')];if(_0x5948ce[_0xa5c5('0x34')][_0xa5c5('0x4a')]){_0x364963['include']=[{'all':!![]}];}_0x364963=_[_0xa5c5('0x41')]({},_0x364963,_0x5948ce[_0xa5c5('0x43')]);return db[_0xa5c5('0x30')][_0xa5c5('0x4b')](_0x364963)['then'](handleEntityNotFound(_0x404426,null))[_0xa5c5('0x29')](respondWithResult(_0x404426,null))[_0xa5c5('0x47')](handleError(_0x404426,null));};exports[_0xa5c5('0x4c')]=function(_0x543506,_0x5727c4){return db[_0xa5c5('0x30')][_0xa5c5('0x4c')](_0x543506[_0xa5c5('0x4d')],{})['then'](function(_0x20f76a){var _0x289575=_0x543506[_0xa5c5('0x4e')][_0xa5c5('0x2b')]({'plain':!![]});if(!_0x289575)throw new Error(_0xa5c5('0x4f'));if(_0x289575[_0xa5c5('0x50')]===_0xa5c5('0x4e')){var _0x44e8ac=_0x20f76a[_0xa5c5('0x2b')]({'plain':!![]});var _0xf6f9dd='Scheduler';return db[_0xa5c5('0x51')][_0xa5c5('0x4b')]({'where':{'name':_0xf6f9dd,'userProfileId':_0x289575[_0xa5c5('0x52')]},'raw':!![]})['then'](function(_0x3faad5){if(_0x3faad5&&_0x3faad5[_0xa5c5('0x53')]===0x0){return db[_0xa5c5('0x54')][_0xa5c5('0x4c')]({'name':_0x44e8ac[_0xa5c5('0x2d')],'resourceId':_0x44e8ac['id'],'type':_0x3faad5[_0xa5c5('0x2d')],'sectionId':_0x3faad5['id']},{})[_0xa5c5('0x29')](function(){return _0x20f76a;});}else{return _0x20f76a;}})['catch'](function(_0x34246a){logger[_0xa5c5('0x55')](_0xa5c5('0x56'),_0x34246a);throw _0x34246a;});}return _0x20f76a;})[_0xa5c5('0x29')](respondWithResult(_0x5727c4,0xc9))['catch'](handleError(_0x5727c4,null));};exports[_0xa5c5('0x57')]=function(_0x4f07c0,_0x3d5711){if(_0x4f07c0['body']['id']){delete _0x4f07c0[_0xa5c5('0x4d')]['id'];}return db[_0xa5c5('0x30')][_0xa5c5('0x4b')]({'where':{'id':_0x4f07c0[_0xa5c5('0x48')]['id']}})[_0xa5c5('0x29')](handleEntityNotFound(_0x3d5711,null))[_0xa5c5('0x29')](saveUpdates(_0x4f07c0[_0xa5c5('0x4d')],null))['then'](respondWithResult(_0x3d5711,null))['catch'](handleError(_0x3d5711,null));};exports[_0xa5c5('0x2a')]=function(_0x10f4c5,_0x29cb9){return db['Schedule']['find']({'where':{'id':_0x10f4c5[_0xa5c5('0x48')]['id']}})[_0xa5c5('0x29')](handleEntityNotFound(_0x29cb9,null))[_0xa5c5('0x29')](removeEntity(_0x29cb9,null))['catch'](handleError(_0x29cb9,null));};exports[_0xa5c5('0x58')]=function(_0x216bfc,_0xd71269,_0x3ef350){var _0x5dc506=require(_0xa5c5('0x59'));return db[_0xa5c5('0x30')][_0xa5c5('0x4b')]({'where':{'id':_0x216bfc[_0xa5c5('0x48')]['id']},'raw':!![]})[_0xa5c5('0x29')](handleEntityNotFound(_0xd71269,null))[_0xa5c5('0x29')](function(){_0x5dc506[_0xa5c5('0x58')](_0x216bfc[_0xa5c5('0x48')]['id']);})[_0xa5c5('0x29')](respondWithStatusCode(_0xd71269,null))['catch'](handleError(_0xd71269,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ef38378..8898239 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 _0xe3ac=['../../config/environment','./schedule.attributes','tools_schedules','lodash','util','api','request-promise'];(function(_0x217f25,_0x494aa0){var _0x73d265=function(_0x343ba2){while(--_0x343ba2){_0x217f25['push'](_0x217f25['shift']());}};_0x73d265(++_0x494aa0);}(_0xe3ac,0xf1));var _0xce3a=function(_0x241348,_0x53586b){_0x241348=_0x241348-0x0;var _0x399fc5=_0xe3ac[_0x241348];return _0x399fc5;};'use strict';var _=require(_0xce3a('0x0'));var util=require(_0xce3a('0x1'));var logger=require('../../config/logger')(_0xce3a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xce3a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xce3a('0x4'));var attributes=require(_0xce3a('0x5'));module['exports']=function(_0xdd5337,_0xe34e49){return _0xdd5337['define']('Schedule',attributes,{'tableName':_0xce3a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73a4=['../../config/environment','exports','define','Schedule','tools_schedules','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x245c1c,_0x203ee6){var _0x4092f7=function(_0x26511d){while(--_0x26511d){_0x245c1c['push'](_0x245c1c['shift']());}};_0x4092f7(++_0x203ee6);}(_0x73a4,0x139));var _0x473a=function(_0x223a7d,_0x280d77){_0x223a7d=_0x223a7d-0x0;var _0x40787e=_0x73a4[_0x223a7d];return _0x40787e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x473a('0x0'))(_0x473a('0x1'));var moment=require(_0x473a('0x2'));var BPromise=require(_0x473a('0x3'));var rp=require(_0x473a('0x4'));var fs=require('fs');var path=require(_0x473a('0x5'));var rimraf=require('rimraf');var config=require(_0x473a('0x6'));var attributes=require('./schedule.attributes');module[_0x473a('0x7')]=function(_0x3a8327,_0x15b526){return _0x3a8327[_0x473a('0x8')](_0x473a('0x9'),attributes,{'tableName':_0x473a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index ac81824..1c47fa8 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 _0x7682=['Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','then','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7682,0x196));var _0x2768=function(_0x526d4e,_0x52f714){_0x526d4e=_0x526d4e-0x0;var _0x266790=_0x7682[_0x526d4e];return _0x266790;};'use strict';var _=require(_0x2768('0x0'));var util=require(_0x2768('0x1'));var moment=require(_0x2768('0x2'));var BPromise=require(_0x2768('0x3'));var rs=require(_0x2768('0x4'));var fs=require('fs');var Redis=require(_0x2768('0x5'));var db=require(_0x2768('0x6'))['db'];var utils=require(_0x2768('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2768('0x8'));var jayson=require(_0x2768('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d17a9,_0x3e9616,_0x307585){return new BPromise(function(_0x2fd73d,_0x3cb4bd){return client['request'](_0x2d17a9,_0x307585)[_0x2768('0xa')](function(_0x3e0bb4){logger[_0x2768('0xb')](_0x2768('0xc'),_0x3e9616,_0x2768('0xd'));logger['debug'](_0x2768('0xe'),_0x3e9616,_0x2768('0xd'),JSON['stringify'](_0x3e0bb4));if(_0x3e0bb4['error']){if(_0x3e0bb4[_0x2768('0xf')][_0x2768('0x10')]===0x1f4){logger[_0x2768('0xf')](_0x2768('0xc'),_0x3e9616,_0x3e0bb4[_0x2768('0xf')]['message']);return _0x3cb4bd(_0x3e0bb4[_0x2768('0xf')][_0x2768('0x11')]);}logger[_0x2768('0xf')](_0x2768('0xc'),_0x3e9616,_0x3e0bb4[_0x2768('0xf')][_0x2768('0x11')]);return _0x2fd73d(_0x3e0bb4['error']['message']);}else{logger[_0x2768('0xb')](_0x2768('0xc'),_0x3e9616,_0x2768('0xd'));_0x2fd73d(_0x3e0bb4[_0x2768('0x12')][_0x2768('0x11')]);}})[_0x2768('0x13')](function(_0x10987c){logger[_0x2768('0xf')](_0x2768('0xc'),_0x3e9616,_0x10987c);_0x3cb4bd(_0x10987c);});});} \ No newline at end of file +var _0x00f6=['Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x31b39a,_0xcc93f9){var _0x4a3935=function(_0x4e9dfc){while(--_0x4e9dfc){_0x31b39a['push'](_0x31b39a['shift']());}};_0x4a3935(++_0xcc93f9);}(_0x00f6,0x1b4));var _0x600f=function(_0xb2a425,_0x213fc3){_0xb2a425=_0xb2a425-0x0;var _0x33858d=_0x00f6[_0xb2a425];return _0x33858d;};'use strict';var _=require(_0x600f('0x0'));var util=require(_0x600f('0x1'));var moment=require(_0x600f('0x2'));var BPromise=require(_0x600f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x600f('0x4'));var db=require(_0x600f('0x5'))['db'];var utils=require(_0x600f('0x6'));var logger=require('../../config/logger')(_0x600f('0x7'));var config=require(_0x600f('0x8'));var jayson=require(_0x600f('0x9'));var client=jayson[_0x600f('0xa')][_0x600f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3266dd,_0x398958,_0x5e980e){return new BPromise(function(_0x1542c5,_0x246132){return client[_0x600f('0xc')](_0x3266dd,_0x5e980e)['then'](function(_0x33168a){logger[_0x600f('0xd')]('Schedule,\x20%s,\x20%s',_0x398958,'request\x20sent');logger[_0x600f('0xe')](_0x600f('0xf'),_0x398958,_0x600f('0x10'),JSON[_0x600f('0x11')](_0x33168a));if(_0x33168a[_0x600f('0x12')]){if(_0x33168a[_0x600f('0x12')][_0x600f('0x13')]===0x1f4){logger[_0x600f('0x12')](_0x600f('0x14'),_0x398958,_0x33168a[_0x600f('0x12')][_0x600f('0x15')]);return _0x246132(_0x33168a['error']['message']);}logger[_0x600f('0x12')](_0x600f('0x14'),_0x398958,_0x33168a[_0x600f('0x12')]['message']);return _0x1542c5(_0x33168a[_0x600f('0x12')][_0x600f('0x15')]);}else{logger[_0x600f('0xd')](_0x600f('0x14'),_0x398958,_0x600f('0x10'));_0x1542c5(_0x33168a[_0x600f('0x16')]['message']);}})[_0x600f('0x17')](function(_0x4eaa4c){logger[_0x600f('0x12')](_0x600f('0x14'),_0x398958,_0x4eaa4c);_0x246132(_0x4eaa4c);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index da274f3..5c55f3c 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 _0x2f90=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports'];(function(_0x3c29f3,_0x252e43){var _0x57128f=function(_0x3c9785){while(--_0x3c9785){_0x3c29f3['push'](_0x3c29f3['shift']());}};_0x57128f(++_0x252e43);}(_0x2f90,0x168));var _0x02f9=function(_0xee4774,_0x414de1){_0xee4774=_0xee4774-0x0;var _0x54829a=_0x2f90[_0xee4774];return _0x54829a;};'use strict';var multer=require('multer');var util=require(_0x02f9('0x0'));var path=require('path');var timeout=require(_0x02f9('0x1'));var express=require(_0x02f9('0x2'));var router=express[_0x02f9('0x3')]();var fs_extra=require(_0x02f9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x02f9('0x5'));var config=require(_0x02f9('0x6'));var controller=require(_0x02f9('0x7'));router[_0x02f9('0x8')]('/',auth[_0x02f9('0x9')](),controller[_0x02f9('0xa')]);router['get'](_0x02f9('0xb'),auth[_0x02f9('0x9')](),controller[_0x02f9('0xc')]);router['get'](_0x02f9('0xd'),auth[_0x02f9('0x9')](),controller[_0x02f9('0xe')]);router[_0x02f9('0x8')](_0x02f9('0xf'),auth[_0x02f9('0x9')](),controller[_0x02f9('0x10')]);router[_0x02f9('0x11')]('/',auth[_0x02f9('0x9')](),controller[_0x02f9('0x12')]);router[_0x02f9('0x13')](_0x02f9('0xd'),auth[_0x02f9('0x9')](),controller[_0x02f9('0x14')]);router[_0x02f9('0x15')]('/:id',auth[_0x02f9('0x9')](),controller[_0x02f9('0x16')]);module[_0x02f9('0x17')]=router; \ No newline at end of file +var _0xfd87=['/:id/download','download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x537563,_0x1eab9e){var _0x3d3f2=function(_0x3fdb0a){while(--_0x3fdb0a){_0x537563['push'](_0x537563['shift']());}};_0x3d3f2(++_0x1eab9e);}(_0xfd87,0xd8));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var path=require(_0x7fd8('0x2'));var timeout=require(_0x7fd8('0x3'));var express=require(_0x7fd8('0x4'));var router=express[_0x7fd8('0x5')]();var fs_extra=require(_0x7fd8('0x6'));var auth=require(_0x7fd8('0x7'));var interaction=require(_0x7fd8('0x8'));var config=require(_0x7fd8('0x9'));var controller=require(_0x7fd8('0xa'));router[_0x7fd8('0xb')]('/',auth[_0x7fd8('0xc')](),controller[_0x7fd8('0xd')]);router[_0x7fd8('0xb')](_0x7fd8('0xe'),auth['isAuthenticated'](),controller[_0x7fd8('0xf')]);router['get'](_0x7fd8('0x10'),auth[_0x7fd8('0xc')](),controller[_0x7fd8('0x11')]);router[_0x7fd8('0xb')](_0x7fd8('0x12'),auth[_0x7fd8('0xc')](),controller[_0x7fd8('0x13')]);router[_0x7fd8('0x14')]('/',auth[_0x7fd8('0xc')](),controller[_0x7fd8('0x15')]);router[_0x7fd8('0x16')](_0x7fd8('0x10'),auth[_0x7fd8('0xc')](),controller[_0x7fd8('0x17')]);router[_0x7fd8('0x18')](_0x7fd8('0x10'),auth[_0x7fd8('0xc')](),controller[_0x7fd8('0x19')]);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 50d2b1c..226662b 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 _0xbe9d=['extname','STRING','replace','INTEGER','startedAt','subtract','setDataValue','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','format','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value'];(function(_0xd8adce,_0x3c283e){var _0x4b2489=function(_0x51ef21){while(--_0x51ef21){_0xd8adce['push'](_0xd8adce['shift']());}};_0x4b2489(++_0x3c283e);}(_0xbe9d,0x99));var _0xdbe9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbe9d[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xdbe9('0x0'));var moment=require(_0xdbe9('0x1'));var path=require(_0xdbe9('0x2'));var config=require(_0xdbe9('0x3'));module[_0xdbe9('0x4')]={'format':{'type':Sequelize[_0xdbe9('0x5')],'get':function(){return this[_0xdbe9('0x6')](_0xdbe9('0x7'))?path[_0xdbe9('0x8')](this[_0xdbe9('0x6')](_0xdbe9('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xdbe9('0x9')]},'channel':{'type':Sequelize[_0xdbe9('0x9')]},'value':{'type':Sequelize['STRING'],'set':function(_0x56e9be){var _0x3d5165=_0x56e9be[_0xdbe9('0xa')](/\\/g,'/');this['setDataValue'](_0xdbe9('0x7'),_0x3d5165);}},'rating':{'type':Sequelize[_0xdbe9('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdbe9('0xb')],'set':function(_0x56470c){this['setDataValue'](_0xdbe9('0xc'),moment()[_0xdbe9('0xd')](_0x56470c,'ms'));this[_0xdbe9('0xe')](_0xdbe9('0xf'),moment());this['setDataValue'](_0xdbe9('0x10'),_0x56470c);}},'startedAt':{'type':Sequelize[_0xdbe9('0x11')],'get':function(){return moment(this[_0xdbe9('0x6')](_0xdbe9('0xc')))['format'](_0xdbe9('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0xdbe9('0x11')],'get':function(){return moment(this[_0xdbe9('0x6')](_0xdbe9('0xf')))['format'](_0xdbe9('0x12'))[_0xdbe9('0x13')]();}},'createdAt':{'type':Sequelize[_0xdbe9('0x11')],'get':function(){return moment(this['getDataValue'](_0xdbe9('0x14')))['format'](_0xdbe9('0x12'))[_0xdbe9('0x13')]();}},'updatedAt':{'type':Sequelize[_0xdbe9('0x11')],'get':function(){return moment(this['getDataValue'](_0xdbe9('0x15')))[_0xdbe9('0x16')](_0xdbe9('0x12'))['toString']();}}}; \ No newline at end of file +var _0x7cdc=['createdAt','moment','path','exports','VIRTUAL','getDataValue','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format'];(function(_0x20c28b,_0x5a393d){var _0x457bc5=function(_0x8058ee){while(--_0x8058ee){_0x20c28b['push'](_0x20c28b['shift']());}};_0x457bc5(++_0x5a393d);}(_0x7cdc,0x190));var _0xc7cd=function(_0x4a169f,_0x19c8ae){_0x4a169f=_0x4a169f-0x0;var _0x28e342=_0x7cdc[_0x4a169f];return _0x28e342;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc7cd('0x0'));var path=require(_0xc7cd('0x1'));var config=require('../../config/environment');module[_0xc7cd('0x2')]={'format':{'type':Sequelize[_0xc7cd('0x3')],'get':function(){return this[_0xc7cd('0x4')]('value')?path[_0xc7cd('0x5')](this[_0xc7cd('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xc7cd('0x6')]},'channel':{'type':Sequelize[_0xc7cd('0x6')]},'value':{'type':Sequelize[_0xc7cd('0x6')],'set':function(_0x2c168c){var _0x13ffeb=_0x2c168c[_0xc7cd('0x7')](/\\/g,'/');this[_0xc7cd('0x8')]('value',_0x13ffeb);}},'rating':{'type':Sequelize[_0xc7cd('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x36d8b9){this[_0xc7cd('0x8')](_0xc7cd('0xa'),moment()[_0xc7cd('0xb')](_0x36d8b9,'ms'));this['setDataValue'](_0xc7cd('0xc'),moment());this[_0xc7cd('0x8')](_0xc7cd('0xd'),_0x36d8b9);}},'startedAt':{'type':Sequelize[_0xc7cd('0xe')],'get':function(){return moment(this['getDataValue'](_0xc7cd('0xa')))['format'](_0xc7cd('0xf'))[_0xc7cd('0x10')]();}},'closedAt':{'type':Sequelize[_0xc7cd('0xe')],'get':function(){return moment(this[_0xc7cd('0x4')]('closedAt'))[_0xc7cd('0x11')](_0xc7cd('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0xc7cd('0xe')],'get':function(){return moment(this['getDataValue'](_0xc7cd('0x12')))['format'](_0xc7cd('0xf'))[_0xc7cd('0x10')]();}},'updatedAt':{'type':Sequelize[_0xc7cd('0xe')],'get':function(){return moment(this[_0xc7cd('0x4')]('updatedAt'))[_0xc7cd('0x11')](_0xc7cd('0xf'))[_0xc7cd('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e610826..f8d6d9a 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 _0xb4c7=['rawAttributes','fieldName','type','format','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','params','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','ValidationError','download','filename','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording'];(function(_0x2dc96f,_0x459058){var _0xd012da=function(_0x38d032){while(--_0x38d032){_0x2dc96f['push'](_0x2dc96f['shift']());}};_0xd012da(++_0x459058);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x42c6fd,_0x352ebf){_0x42c6fd=_0x42c6fd-0x0;var _0x2d84b8=_0xb4c7[_0x42c6fd];return _0x2d84b8;};'use strict';var emlformat=require(_0x7b4c('0x0'));var rimraf=require(_0x7b4c('0x1'));var zipdir=require(_0x7b4c('0x2'));var jsonpatch=require(_0x7b4c('0x3'));var rp=require(_0x7b4c('0x4'));var moment=require('moment');var BPromise=require(_0x7b4c('0x5'));var Mustache=require(_0x7b4c('0x6'));var util=require(_0x7b4c('0x7'));var path=require(_0x7b4c('0x8'));var sox=require(_0x7b4c('0x9'));var csv=require('to-csv');var ejs=require(_0x7b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b4c('0xb'));var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xf'));var querystring=require(_0x7b4c('0x10'));var Papa=require(_0x7b4c('0x11'));var Redis=require(_0x7b4c('0x12'));var authService=require(_0x7b4c('0x13'));var qs=require(_0x7b4c('0x14'));var as=require(_0x7b4c('0x15'));var hardwareService=require(_0x7b4c('0x16'));var logger=require(_0x7b4c('0x17'))(_0x7b4c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x19'));var db=require(_0x7b4c('0x1a'))['db'];function respondWithStatusCode(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xcc;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0x1b')](_0x1722ad);}return _0x38656b[_0x7b4c('0x1c')](_0x1722ad)[_0x7b4c('0x1d')]();};}function respondWithResult(_0x25b90b,_0x387488){_0x387488=_0x387488||0xc8;return function(_0x593a19){if(_0x593a19){return _0x25b90b[_0x7b4c('0x1c')](_0x387488)[_0x7b4c('0x1e')](_0x593a19);}};}function respondWithFilteredResult(_0xdc71cd,_0x2a0e2f){return function(_0xa0a812){if(_0xa0a812){var _0x2471b3=typeof _0x2a0e2f[_0x7b4c('0x1f')]===_0x7b4c('0x20')&&typeof _0x2a0e2f['limit']===_0x7b4c('0x20');var _0xe71d88=_0xa0a812[_0x7b4c('0x21')];var _0x36c02a=_0x2471b3?0x0:_0x2a0e2f['offset'];var _0x3ce10c=_0x2471b3?_0xa0a812[_0x7b4c('0x21')]:_0x2a0e2f[_0x7b4c('0x1f')]+_0x2a0e2f[_0x7b4c('0x22')];var _0x2d4c72;if(_0x3ce10c>=_0xe71d88){_0x3ce10c=_0xe71d88;_0x2d4c72=0xc8;}else{_0x2d4c72=0xce;}_0xdc71cd[_0x7b4c('0x1c')](_0x2d4c72);return _0xdc71cd[_0x7b4c('0x23')](_0x7b4c('0x24'),_0x36c02a+'-'+_0x3ce10c+'/'+_0xe71d88)[_0x7b4c('0x1e')](_0xa0a812);}return null;};}function patchUpdates(_0x55e3df){return function(_0x1f06ec){try{jsonpatch[_0x7b4c('0x25')](_0x1f06ec,_0x55e3df,!![]);}catch(_0x11996d){return BPromise[_0x7b4c('0x26')](_0x11996d);}return _0x1f06ec[_0x7b4c('0x27')]();};}function saveUpdates(_0x168ac9,_0x176704){return function(_0x3d4826){if(_0x3d4826){return _0x3d4826[_0x7b4c('0x28')](_0x168ac9)[_0x7b4c('0x29')](function(_0x5eec1e){return _0x5eec1e;});}return null;};}function removeEntity(_0x45438c,_0x4350c9){return function(_0x276271){if(_0x276271){return _0x276271[_0x7b4c('0x2a')]()[_0x7b4c('0x29')](function(){_0x45438c[_0x7b4c('0x1c')](0xcc)[_0x7b4c('0x1d')]();});}};}function handleEntityNotFound(_0x459eb4,_0x1f311e){return function(_0x1a69db){if(!_0x1a69db){_0x459eb4[_0x7b4c('0x1b')](0x194);}return _0x1a69db;};}function handleError(_0x257da2,_0x316e5f){_0x316e5f=_0x316e5f||0x1f4;return function(_0x501f75){logger[_0x7b4c('0x2b')](_0x501f75[_0x7b4c('0x2c')]);if(_0x501f75[_0x7b4c('0x2d')]){delete _0x501f75[_0x7b4c('0x2d')];}_0x257da2[_0x7b4c('0x1c')](_0x316e5f)[_0x7b4c('0x2e')](_0x501f75);};}exports[_0x7b4c('0x2f')]=function(_0x2552f9,_0x3e4a46){var _0x9a799b={},_0x3585cd={},_0x130ace={'count':0x0,'rows':[]};var _0x3544bc=_[_0x7b4c('0x30')](db[_0x7b4c('0x31')][_0x7b4c('0x32')],function(_0x1d0724){return{'name':_0x1d0724[_0x7b4c('0x33')],'type':_0x1d0724[_0x7b4c('0x34')]['key']};});_0x3585cd['model']=_['differenceBy'](_[_0x7b4c('0x30')](_0x3544bc,_0x7b4c('0x2d')),[_0x7b4c('0x35')]);_0x3585cd[_0x7b4c('0x36')]=_['keys'](_0x2552f9[_0x7b4c('0x36')]);_0x3585cd[_0x7b4c('0x37')]=_['intersection'](_0x3585cd[_0x7b4c('0x38')],_0x3585cd['query']);_0x9a799b[_0x7b4c('0x39')]=_[_0x7b4c('0x3a')](_0x3585cd[_0x7b4c('0x38')],qs['fields'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x9a799b['attributes']=_0x9a799b[_0x7b4c('0x39')][_0x7b4c('0x3c')]?_0x9a799b[_0x7b4c('0x39')]:_0x3585cd[_0x7b4c('0x38')];if(!_0x2552f9['query']['hasOwnProperty'](_0x7b4c('0x3d'))){_0x9a799b[_0x7b4c('0x22')]=qs['limit'](_0x2552f9[_0x7b4c('0x36')]['limit']);_0x9a799b['offset']=qs[_0x7b4c('0x1f')](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x1f')]);}_0x9a799b[_0x7b4c('0x3e')]=qs['sort'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3f')]);_0x9a799b[_0x7b4c('0x40')]=qs[_0x7b4c('0x37')](_[_0x7b4c('0x41')](_0x2552f9[_0x7b4c('0x36')],_0x3585cd[_0x7b4c('0x37')]),_0x3544bc);if(_0x2552f9['query']['filter']){_0x9a799b[_0x7b4c('0x40')]=_[_0x7b4c('0x42')](_0x9a799b[_0x7b4c('0x40')],{'$or':_[_0x7b4c('0x30')](_0x3544bc,function(_0xb8486d){if(_0xb8486d['type']!==_0x7b4c('0x43')){var _0x902367={};_0x902367[_0xb8486d[_0x7b4c('0x2d')]]={'$like':'%'+_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x44')]+'%'};return _0x902367;}})});}_0x9a799b=_[_0x7b4c('0x42')]({},_0x9a799b,_0x2552f9[_0x7b4c('0x45')]);var _0x1080fc={'where':_0x9a799b[_0x7b4c('0x40')]};return db['ScreenRecording'][_0x7b4c('0x21')](_0x1080fc)['then'](function(_0x2a3a74){_0x130ace['count']=_0x2a3a74;if(_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x9a799b['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x7b4c('0x47')](_0x9a799b);})[_0x7b4c('0x29')](function(_0x1def44){_0x130ace[_0x7b4c('0x48')]=_0x1def44;return _0x130ace;})['then'](respondWithFilteredResult(_0x3e4a46,_0x9a799b))[_0x7b4c('0x49')](handleError(_0x3e4a46,null));};exports[_0x7b4c('0x4a')]=function(_0x100774,_0x5d4ed8){var _0x45ad59={'raw':![],'where':{'id':_0x100774['params']['id']}},_0x4b4757={};_0x4b4757[_0x7b4c('0x38')]=_['keys'](db[_0x7b4c('0x31')][_0x7b4c('0x32')]);_0x4b4757[_0x7b4c('0x36')]=_[_0x7b4c('0x4b')](_0x100774[_0x7b4c('0x36')]);_0x4b4757[_0x7b4c('0x37')]=_[_0x7b4c('0x3a')](_0x4b4757[_0x7b4c('0x38')],_0x4b4757[_0x7b4c('0x36')]);_0x45ad59['attributes']=_[_0x7b4c('0x3a')](_0x4b4757['model'],qs['fields'](_0x100774[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x45ad59['attributes']=_0x45ad59['attributes'][_0x7b4c('0x3c')]?_0x45ad59[_0x7b4c('0x39')]:_0x4b4757[_0x7b4c('0x38')];if(_0x100774[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x45ad59[_0x7b4c('0x4c')]=[{'all':!![]}];}_0x45ad59=_[_0x7b4c('0x42')]({},_0x45ad59,_0x100774[_0x7b4c('0x45')]);return db['ScreenRecording'][_0x7b4c('0x4d')](_0x45ad59)[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4ed8,null))[_0x7b4c('0x29')](respondWithResult(_0x5d4ed8,null))[_0x7b4c('0x49')](handleError(_0x5d4ed8,null));};exports[_0x7b4c('0x4e')]=function(_0x379f15,_0x11a6f9){return db[_0x7b4c('0x31')][_0x7b4c('0x4e')](_0x379f15['body'],{})['then'](respondWithResult(_0x11a6f9,0xc9))[_0x7b4c('0x49')](handleError(_0x11a6f9,null));};exports[_0x7b4c('0x28')]=function(_0x97eadf,_0x5d4192){if(_0x97eadf[_0x7b4c('0x4f')]['id']){delete _0x97eadf[_0x7b4c('0x4f')]['id'];}delete _0x97eadf['body'][_0x7b4c('0x50')];delete _0x97eadf['body'][_0x7b4c('0x51')];delete _0x97eadf['body'][_0x7b4c('0x52')];delete _0x97eadf['body'][_0x7b4c('0x53')];return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x97eadf['params']['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4192,null))[_0x7b4c('0x29')](saveUpdates(_0x97eadf[_0x7b4c('0x4f')],null))['then'](respondWithResult(_0x5d4192,null))['catch'](handleError(_0x5d4192,null));};exports[_0x7b4c('0x54')]=function(_0x1c118a,_0x4cbf1b){return db['ScreenRecording'][_0x7b4c('0x54')]()[_0x7b4c('0x29')](respondWithResult(_0x4cbf1b,null))[_0x7b4c('0x49')](handleError(_0x4cbf1b,null));};exports['download']=function(_0x1d017d,_0x2f009a,_0x4aaf57){var _0x484e80=require(_0x7b4c('0x55'));var _0x4d8491=![];var _0x59db20={};if(_0x1d017d[_0x7b4c('0x36')]['type']&&_0x1d017d['query'][_0x7b4c('0x34')]===_0x7b4c('0x56')){_0x59db20[_0x7b4c('0x56')]=_0x1d017d[_0x7b4c('0x57')]['id'];}else{_0x59db20['id']=_0x1d017d['params']['id'];}return db['ScreenRecording'][_0x7b4c('0x4d')]({'where':_0x59db20,'attributes':['id',_0x7b4c('0x53')],'raw':!![]})[_0x7b4c('0x29')](handleEntityNotFound(_0x2f009a,null))['then'](function(_0x255262){if(_0x255262){var _0x3d81fb=path[_0x7b4c('0x58')](config['root'],_0x7b4c('0x59'),_0x255262[_0x7b4c('0x53')]);var _0x529803=util[_0x7b4c('0x35')](_0x7b4c('0x5a'),_0x3d81fb);if(fs[_0x7b4c('0x5b')](_0x529803)){_0x4d8491=!![];return _0x484e80[_0x7b4c('0x5c')](_0x529803,_0x3d81fb,config[_0x7b4c('0x5d')][_0x7b4c('0x5e')])[_0x7b4c('0x29')](function(){return _0x255262;});}return _0x255262;}})['then'](function(_0x4443d0){if(_0x4443d0){var _0x2dc79a=path['join'](config[_0x7b4c('0x5f')],_0x7b4c('0x59'),_0x4443d0[_0x7b4c('0x53')]);if(!fs[_0x7b4c('0x5b')](_0x2dc79a)){throw new db['Sequelize'][(_0x7b4c('0x60'))]('ScreenRecording\x20not\x20found');}if(_0x4443d0['filename']){return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,_0x4443d0[_0x7b4c('0x62')]+path[_0x7b4c('0x63')](_0x2dc79a),function(){if(_0x4d8491){fs[_0x7b4c('0x64')](_0x2dc79a);}});}else{return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,function(_0x5b24f6){if(_0x4d8491){fs['unlink'](_0x2dc79a);}});}}})[_0x7b4c('0x49')](function(_0x3c84af){if(_0x3c84af[_0x7b4c('0x65')]==='ScreenRecording\x20not\x20found'){_0x2f009a[_0x7b4c('0x1c')](0x194)[_0x7b4c('0x2e')](_0x7b4c('0x66'));}else{return handleError(_0x2f009a,null);}});};exports['destroy']=function(_0x222b47,_0x3b2144){return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x222b47[_0x7b4c('0x57')]['id']}})[_0x7b4c('0x29')](function(_0x4ac03e){if(_[_0x7b4c('0x67')](_0x4ac03e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4ac03e;})[_0x7b4c('0x29')](function(_0x11ae6e){var _0x3a3713=path['join'](config['root'],_0x7b4c('0x59'),_0x11ae6e[_0x7b4c('0x53')]);logger[_0x7b4c('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x3a3713);if(!_[_0x7b4c('0x67')](_0x11ae6e['value'])&&fs[_0x7b4c('0x5b')](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}_0x3a3713=_0x3a3713+'.cypher';if(!_[_0x7b4c('0x67')](_0x11ae6e[_0x7b4c('0x53')])&&fs['existsSync'](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}return _0x11ae6e;})[_0x7b4c('0x29')](function(_0x2befd7){if(!_0x2befd7)throw new InternalError();return _0x2befd7[_0x7b4c('0x2a')]();})[_0x7b4c('0x29')](function(){_0x3b2144['status'](0xcc)[_0x7b4c('0x1d')]();})[_0x7b4c('0x49')](handleError(_0x3b2144,null));}; \ No newline at end of file +var _0x008c=['papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','sendStatus','send','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','name','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x008c,0x188));var _0xc008=function(_0x553c78,_0x4656c2){_0x553c78=_0x553c78-0x0;var _0x2f68c5=_0x008c[_0x553c78];return _0x2f68c5;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_[_0xc008('0x2b')](_0x2a7d4f,_0xc008('0x2c')),[_0xc008('0x2d')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x25eae4[_0xc008('0x2e')]);_0x32390d[_0xc008('0x30')]=_[_0xc008('0x31')](_0x32390d[_0xc008('0x29')],_0x32390d['query']);_0x24c14c[_0xc008('0x32')]=_[_0xc008('0x31')](_0x32390d['model'],qs[_0xc008('0x33')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x33')]));_0x24c14c[_0xc008('0x32')]=_0x24c14c[_0xc008('0x32')][_0xc008('0x34')]?_0x24c14c[_0xc008('0x32')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2e')]['hasOwnProperty'](_0xc008('0x35'))){_0x24c14c[_0xc008('0x1d')]=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4['query'][_0xc008('0x1b')]);}_0x24c14c[_0xc008('0x36')]=qs['sort'](_0x25eae4[_0xc008('0x2e')][_0xc008('0x37')]);_0x24c14c['where']=qs[_0xc008('0x30')](_[_0xc008('0x38')](_0x25eae4[_0xc008('0x2e')],_0x32390d['filters']),_0x2a7d4f);if(_0x25eae4['query']['filter']){_0x24c14c[_0xc008('0x39')]=_['merge'](_0x24c14c[_0xc008('0x39')],{'$or':_[_0xc008('0x2b')](_0x2a7d4f,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x3a')]!==_0xc008('0x3b')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x2c')]]={'$like':'%'+_0x25eae4[_0xc008('0x2e')][_0xc008('0x3c')]+'%'};return _0xa381d1;}})});}_0x24c14c=_[_0xc008('0x3d')]({},_0x24c14c,_0x25eae4[_0xc008('0x3e')]);var _0xdfca2e={'where':_0x24c14c[_0xc008('0x39')]};return db[_0xc008('0x26')]['count'](_0xdfca2e)[_0xc008('0x21')](function(_0x23c4db){_0x209591[_0xc008('0x1e')]=_0x23c4db;if(_0x25eae4[_0xc008('0x2e')]['includeAll']){_0x24c14c[_0xc008('0x3f')]=[{'all':!![]}];}return db[_0xc008('0x26')][_0xc008('0x40')](_0x24c14c);})[_0xc008('0x21')](function(_0x2d142d){_0x209591['rows']=_0x2d142d;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))[_0xc008('0x41')](handleError(_0x529961,null));};exports[_0xc008('0x42')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':![],'where':{'id':_0x3e9a99[_0xc008('0x43')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x29')]=_[_0xc008('0x2f')](db['ScreenRecording'][_0xc008('0x27')]);_0xf4cc4b[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x30')]=_['intersection'](_0xf4cc4b[_0xc008('0x29')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x32')]=_[_0xc008('0x31')](_0xf4cc4b['model'],qs[_0xc008('0x33')](_0x3e9a99[_0xc008('0x2e')][_0xc008('0x33')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x32')][_0xc008('0x34')]?_0x4f93a4[_0xc008('0x32')]:_0xf4cc4b[_0xc008('0x29')];if(_0x3e9a99[_0xc008('0x2e')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x26')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x21')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x21')](respondWithResult(_0x7279e8,null))[_0xc008('0x41')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['ScreenRecording']['create'](_0x2cf641['body'],{})[_0xc008('0x21')](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x41')](handleError(_0x33be4f,null));};exports[_0xc008('0x20')]=function(_0x511383,_0x28bc33){if(_0x511383[_0xc008('0x47')]['id']){delete _0x511383[_0xc008('0x47')]['id'];}delete _0x511383[_0xc008('0x47')][_0xc008('0x48')];delete _0x511383[_0xc008('0x47')][_0xc008('0x49')];delete _0x511383[_0xc008('0x47')][_0xc008('0x4a')];delete _0x511383[_0xc008('0x47')]['value'];return db['ScreenRecording'][_0xc008('0x45')]({'where':{'id':_0x511383['params']['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x28bc33,null))[_0xc008('0x21')](saveUpdates(_0x511383[_0xc008('0x47')],null))['then'](respondWithResult(_0x28bc33,null))[_0xc008('0x41')](handleError(_0x28bc33,null));};exports[_0xc008('0x4b')]=function(_0xee64,_0x8b9775){return db[_0xc008('0x26')]['describe']()[_0xc008('0x21')](respondWithResult(_0x8b9775,null))[_0xc008('0x41')](handleError(_0x8b9775,null));};exports['download']=function(_0x24f775,_0xfd6d1d,_0x5b5fbf){var _0x51d3dc=require(_0xc008('0x4c'));var _0xd47b74=![];var _0x20947b={};if(_0x24f775[_0xc008('0x2e')][_0xc008('0x3a')]&&_0x24f775['query']['type']===_0xc008('0x4d')){_0x20947b['uniqueid']=_0x24f775[_0xc008('0x43')]['id'];}else{_0x20947b['id']=_0x24f775[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x45')]({'where':_0x20947b,'attributes':['id',_0xc008('0x4e')],'raw':!![]})[_0xc008('0x21')](handleEntityNotFound(_0xfd6d1d,null))['then'](function(_0x2ea742){if(_0x2ea742){var _0xbd7422=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x2ea742['value']);var _0x41fae3=util['format']('%s.cypher',_0xbd7422);if(fs['existsSync'](_0x41fae3)){_0xd47b74=!![];return _0x51d3dc[_0xc008('0x52')](_0x41fae3,_0xbd7422,config[_0xc008('0x53')][_0xc008('0x54')])['then'](function(){return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x21')](function(_0x2d8361){if(_0x2d8361){var _0x3dda82=path['join'](config[_0xc008('0x50')],_0xc008('0x51'),_0x2d8361[_0xc008('0x4e')]);if(!fs[_0xc008('0x55')](_0x3dda82)){throw new db['Sequelize'][(_0xc008('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x2d8361[_0xc008('0x57')]){return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,_0x2d8361[_0xc008('0x57')]+path[_0xc008('0x59')](_0x3dda82),function(){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}else{return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,function(_0x4818c7){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}}})['catch'](function(_0x5bf4a9){if(_0x5bf4a9[_0xc008('0x5b')]===_0xc008('0x5c')){_0xfd6d1d['status'](0x194)[_0xc008('0x24')](_0xc008('0x5d'));}else{return handleError(_0xfd6d1d,null);}});};exports[_0xc008('0x22')]=function(_0x4517c0,_0x21ee6d){return db[_0xc008('0x26')][_0xc008('0x45')]({'where':{'id':_0x4517c0['params']['id']}})[_0xc008('0x21')](function(_0x462e1e){if(_[_0xc008('0x5e')](_0x462e1e)){throw new ReferenceError(_0xc008('0x5f'));}return _0x462e1e;})[_0xc008('0x21')](function(_0x167425){var _0x249898=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x167425[_0xc008('0x4e')]);logger[_0xc008('0x60')](_0xc008('0x61'),_0x249898);if(!_[_0xc008('0x5e')](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc008('0x63')](_0x249898);}_0x249898=_0x249898+_0xc008('0x64');if(!_['isNil'](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+_0xc008('0x65'));fs[_0xc008('0x63')](_0x249898);}return _0x167425;})[_0xc008('0x21')](function(_0x238852){if(!_0x238852)throw new InternalError();return _0x238852[_0xc008('0x22')]();})[_0xc008('0x21')](function(){_0x21ee6d[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();})['catch'](handleError(_0x21ee6d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d36fdf6..38fd092 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 _0xafe8=['interactionid','util','../../config/logger','bluebird','request-promise','../../config/environment','./screenRecording.attributes','exports','screen_recordings'];(function(_0x5cbaf8,_0x1d6747){var _0x38a0f2=function(_0x53ce2f){while(--_0x53ce2f){_0x5cbaf8['push'](_0x5cbaf8['shift']());}};_0x38a0f2(++_0x1d6747);}(_0xafe8,0x1e7));var _0x8afe=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0xafe8[_0x53c4f8];return _0x416458;};'use strict';var _=require('lodash');var util=require(_0x8afe('0x0'));var logger=require(_0x8afe('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8afe('0x2'));var rp=require(_0x8afe('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8afe('0x4'));var attributes=require(_0x8afe('0x5'));module[_0x8afe('0x6')]=function(_0x58a9c9,_0x102e9c){return _0x58a9c9['define']('ScreenRecording',attributes,{'tableName':_0x8afe('0x7'),'paranoid':![],'indexes':[{'name':_0x8afe('0x8'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8cde=['path','rimraf','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird'];(function(_0x85d478,_0x333b11){var _0x4d5a85=function(_0x324277){while(--_0x324277){_0x85d478['push'](_0x85d478['shift']());}};_0x4d5a85(++_0x333b11);}(_0x8cde,0x1f3));var _0xe8cd=function(_0x2dd22e,_0xec41fe){_0x2dd22e=_0x2dd22e-0x0;var _0x257b01=_0x8cde[_0x2dd22e];return _0x257b01;};'use strict';var _=require(_0xe8cd('0x0'));var util=require(_0xe8cd('0x1'));var logger=require('../../config/logger')(_0xe8cd('0x2'));var moment=require(_0xe8cd('0x3'));var BPromise=require(_0xe8cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8cd('0x5'));var rimraf=require(_0xe8cd('0x6'));var config=require(_0xe8cd('0x7'));var attributes=require(_0xe8cd('0x8'));module['exports']=function(_0x23330b,_0x39ec21){return _0x23330b['define'](_0xe8cd('0x9'),attributes,{'tableName':_0xe8cd('0xa'),'paranoid':![],'indexes':[{'name':_0xe8cd('0xb'),'fields':[_0xe8cd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 44ff63e..f8e3cfd 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 _0xa37b=['then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x5e5291,_0xfb146b){var _0x253373=function(_0x163500){while(--_0x163500){_0x5e5291['push'](_0x5e5291['shift']());}};_0x253373(++_0xfb146b);}(_0xa37b,0xba));var _0xba37=function(_0x1d1e2e,_0x560855){_0x1d1e2e=_0x1d1e2e-0x0;var _0x22c325=_0xa37b[_0x1d1e2e];return _0x22c325;};'use strict';var _=require('lodash');var util=require(_0xba37('0x0'));var moment=require(_0xba37('0x1'));var BPromise=require(_0xba37('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba37('0x3'));var db=require(_0xba37('0x4'))['db'];var utils=require(_0xba37('0x5'));var logger=require(_0xba37('0x6'))('rpc');var config=require(_0xba37('0x7'));var jayson=require(_0xba37('0x8'));var client=jayson[_0xba37('0x9')][_0xba37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cb0b0,_0x59a5e5,_0x26978e){return new BPromise(function(_0x5b9ada,_0x333247){return client[_0xba37('0xb')](_0x2cb0b0,_0x26978e)[_0xba37('0xc')](function(_0x592143){logger[_0xba37('0xd')](_0xba37('0xe'),_0x59a5e5,_0xba37('0xf'));logger[_0xba37('0x10')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x59a5e5,'request\x20sent',JSON[_0xba37('0x11')](_0x592143));if(_0x592143[_0xba37('0x12')]){if(_0x592143[_0xba37('0x12')][_0xba37('0x13')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x59a5e5,_0x592143[_0xba37('0x12')][_0xba37('0x14')]);return _0x333247(_0x592143[_0xba37('0x12')][_0xba37('0x14')]);}logger[_0xba37('0x12')](_0xba37('0xe'),_0x59a5e5,_0x592143['error'][_0xba37('0x14')]);return _0x5b9ada(_0x592143[_0xba37('0x12')][_0xba37('0x14')]);}else{logger[_0xba37('0xd')](_0xba37('0xe'),_0x59a5e5,_0xba37('0xf'));_0x5b9ada(_0x592143[_0xba37('0x15')][_0xba37('0x14')]);}})['catch'](function(_0xc14a4c){logger['error'](_0xba37('0xe'),_0x59a5e5,_0xc14a4c);_0x333247(_0xc14a4c);});});} \ No newline at end of file +var _0x4dbe=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','debug','error','code','ScreenRecording,\x20%s,\x20%s','message','info','request\x20sent','catch','lodash','moment','bluebird','randomstring'];(function(_0x48b222,_0x356d90){var _0x3606d1=function(_0xda823e){while(--_0xda823e){_0x48b222['push'](_0x48b222['shift']());}};_0x3606d1(++_0x356d90);}(_0x4dbe,0xb0));var _0xe4db=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4dbe[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xe4db('0x0'));var util=require('util');var moment=require(_0xe4db('0x1'));var BPromise=require(_0xe4db('0x2'));var rs=require(_0xe4db('0x3'));var fs=require('fs');var Redis=require(_0xe4db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4db('0x5'));var logger=require(_0xe4db('0x6'))(_0xe4db('0x7'));var config=require(_0xe4db('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe4db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x278424,_0x1ff200,_0x7fa79){return new BPromise(function(_0x133e7b,_0x2e9e6a){return client[_0xe4db('0xa')](_0x278424,_0x7fa79)[_0xe4db('0xb')](function(_0x4ec80c){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x1ff200,'request\x20sent');logger[_0xe4db('0xc')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1ff200,'request\x20sent',JSON['stringify'](_0x4ec80c));if(_0x4ec80c[_0xe4db('0xd')]){if(_0x4ec80c[_0xe4db('0xd')][_0xe4db('0xe')]===0x1f4){logger['error'](_0xe4db('0xf'),_0x1ff200,_0x4ec80c[_0xe4db('0xd')][_0xe4db('0x10')]);return _0x2e9e6a(_0x4ec80c['error'][_0xe4db('0x10')]);}logger['error'](_0xe4db('0xf'),_0x1ff200,_0x4ec80c['error'][_0xe4db('0x10')]);return _0x133e7b(_0x4ec80c[_0xe4db('0xd')][_0xe4db('0x10')]);}else{logger[_0xe4db('0x11')](_0xe4db('0xf'),_0x1ff200,_0xe4db('0x12'));_0x133e7b(_0x4ec80c['result']['message']);}})[_0xe4db('0x13')](function(_0x56fedb){logger[_0xe4db('0xd')](_0xe4db('0xf'),_0x1ff200,_0x56fedb);_0x2e9e6a(_0x56fedb);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 8779bb1..f89629a 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 _0x9316=['/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','post','single','file','addLogo','logologin','extname','originalname','preferred','favicon','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin'];(function(_0x1725d2,_0x3dc70d){var _0x2221ab=function(_0x36b7f3){while(--_0x36b7f3){_0x1725d2['push'](_0x1725d2['shift']());}};_0x2221ab(++_0x3dc70d);}(_0x9316,0x6e));var _0x6931=function(_0x3c3cca,_0x22a98d){_0x3c3cca=_0x3c3cca-0x0;var _0x529e0c=_0x9316[_0x3c3cca];return _0x529e0c;};'use strict';var multer=require(_0x6931('0x0'));var util=require(_0x6931('0x1'));var path=require(_0x6931('0x2'));var timeout=require(_0x6931('0x3'));var express=require('express');var router=express[_0x6931('0x4')]();var fs_extra=require(_0x6931('0x5'));var auth=require(_0x6931('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6931('0x7'));router['get']('/',auth[_0x6931('0x8')](),controller[_0x6931('0x9')]);router[_0x6931('0xa')](_0x6931('0xb'),controller[_0x6931('0xc')]);router[_0x6931('0xa')](_0x6931('0xd'),controller[_0x6931('0xe')]);router[_0x6931('0xa')](_0x6931('0xf'),controller[_0x6931('0x10')]);router[_0x6931('0xa')](_0x6931('0x11'),controller[_0x6931('0x12')]);router['get'](_0x6931('0x13'),controller[_0x6931('0x14')]);router['get'](_0x6931('0x15'),controller[_0x6931('0x16')]);router[_0x6931('0xa')](_0x6931('0x17'),controller[_0x6931('0x18')]);var upload=multer({'storage':multer[_0x6931('0x19')]({'destination':function(_0x349fbb,_0x50b903,_0x5cf113){_0x5cf113(null,path[_0x6931('0x1a')](config[_0x6931('0x1b')],_0x6931('0x1c')));},'filename':function(_0x5e2cbc,_0x4ecf07,_0x568dc3){_0x568dc3(null,util[_0x6931('0x1d')](_0x6931('0x1e'),'logo',path['extname'](_0x4ecf07['originalname'])));}})});router[_0x6931('0x1f')](_0x6931('0xf'),upload[_0x6931('0x20')](_0x6931('0x21')),controller[_0x6931('0x22')]);var upload=multer({'storage':multer[_0x6931('0x19')]({'destination':function(_0x3d3a22,_0x451200,_0x5f07dd){_0x5f07dd(null,path['join'](config['root'],_0x6931('0x1c')));},'filename':function(_0x4c6bf4,_0x1aa3c9,_0x965dc4){_0x965dc4(null,util[_0x6931('0x1d')](_0x6931('0x1e'),_0x6931('0x23'),path[_0x6931('0x24')](_0x1aa3c9[_0x6931('0x25')])));}})});router[_0x6931('0x1f')](_0x6931('0x11'),upload[_0x6931('0x20')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x8f5938,_0x228752,_0x30279a){_0x30279a(null,path[_0x6931('0x1a')](config['root'],_0x6931('0x1c')));},'filename':function(_0x48dcdb,_0x3b82d8,_0x3591ed){_0x3591ed(null,util[_0x6931('0x1d')](_0x6931('0x1e'),_0x6931('0x26'),path[_0x6931('0x24')](_0x3b82d8[_0x6931('0x25')])));}})});router['post'](_0x6931('0x15'),upload[_0x6931('0x20')]('file'),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3e9e3d,_0x585f67,_0xc8f8fe){_0xc8f8fe(null,path[_0x6931('0x1a')](config['root'],_0x6931('0x1c')));},'filename':function(_0x21294e,_0xb6acd9,_0x2d7876){_0x2d7876(null,util['format'](_0x6931('0x1e'),_0x6931('0x27'),path[_0x6931('0x24')](_0xb6acd9[_0x6931('0x25')])));}})});router['post'](_0x6931('0x17'),upload[_0x6931('0x20')](_0x6931('0x21')),controller['addFavicon']);router[_0x6931('0x28')]('/:id',auth[_0x6931('0x8')](),controller[_0x6931('0x29')]);module[_0x6931('0x2a')]=router; \ No newline at end of file +var _0x5fc4=['/now','/:id','show','/:id/logo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','server/files/images/logos/','format','%s%s','extname','originalname','post','single','diskStorage','root','logologin','file','addLogoLogin','addPreferred','favicon','addFavicon','update','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x18effb,_0x4d86bf){var _0x20da6d=function(_0x42ba7c){while(--_0x42ba7c){_0x18effb['push'](_0x18effb['shift']());}};_0x20da6d(++_0x4d86bf);}(_0x5fc4,0x8b));var _0x45fc=function(_0x64679c,_0xb68c0a){_0x64679c=_0x64679c-0x0;var _0x4b306a=_0x5fc4[_0x64679c];return _0x4b306a;};'use strict';var multer=require(_0x45fc('0x0'));var util=require(_0x45fc('0x1'));var path=require(_0x45fc('0x2'));var timeout=require('connect-timeout');var express=require(_0x45fc('0x3'));var router=express['Router']();var fs_extra=require(_0x45fc('0x4'));var auth=require(_0x45fc('0x5'));var interaction=require(_0x45fc('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x45fc('0x7')]('/',auth['isAuthenticated'](),controller[_0x45fc('0x8')]);router[_0x45fc('0x7')](_0x45fc('0x9'),controller['getDate']);router[_0x45fc('0x7')](_0x45fc('0xa'),controller[_0x45fc('0xb')]);router[_0x45fc('0x7')](_0x45fc('0xc'),controller['getLogo']);router['get'](_0x45fc('0xd'),controller['getLogoLogin']);router['get'](_0x45fc('0xe'),controller[_0x45fc('0xf')]);router['get'](_0x45fc('0x10'),controller[_0x45fc('0x11')]);router[_0x45fc('0x7')](_0x45fc('0x12'),controller[_0x45fc('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5630a6,_0x578bac,_0x5295e5){_0x5295e5(null,path[_0x45fc('0x14')](config['root'],_0x45fc('0x15')));},'filename':function(_0x4f367f,_0x1d5b51,_0x16299d){_0x16299d(null,util[_0x45fc('0x16')](_0x45fc('0x17'),'logo',path[_0x45fc('0x18')](_0x1d5b51[_0x45fc('0x19')])));}})});router[_0x45fc('0x1a')](_0x45fc('0xc'),upload[_0x45fc('0x1b')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x45fc('0x1c')]({'destination':function(_0x4e8cdf,_0x2569e1,_0xcd9587){_0xcd9587(null,path['join'](config[_0x45fc('0x1d')],_0x45fc('0x15')));},'filename':function(_0x5272ad,_0x4e3ec2,_0x47f14e){_0x47f14e(null,util[_0x45fc('0x16')]('%s%s',_0x45fc('0x1e'),path[_0x45fc('0x18')](_0x4e3ec2[_0x45fc('0x19')])));}})});router['post'](_0x45fc('0xd'),upload[_0x45fc('0x1b')](_0x45fc('0x1f')),controller[_0x45fc('0x20')]);var upload=multer({'storage':multer[_0x45fc('0x1c')]({'destination':function(_0x1e8e31,_0x43a856,_0x1e65c6){_0x1e65c6(null,path[_0x45fc('0x14')](config['root'],_0x45fc('0x15')));},'filename':function(_0x1726e7,_0x39210c,_0x3a533e){_0x3a533e(null,util['format'](_0x45fc('0x17'),'preferred',path['extname'](_0x39210c[_0x45fc('0x19')])));}})});router[_0x45fc('0x1a')]('/:id/preferred',upload[_0x45fc('0x1b')](_0x45fc('0x1f')),controller[_0x45fc('0x21')]);var upload=multer({'storage':multer[_0x45fc('0x1c')]({'destination':function(_0x2da2c8,_0x4719b8,_0x531ff3){_0x531ff3(null,path[_0x45fc('0x14')](config['root'],_0x45fc('0x15')));},'filename':function(_0x2c6c12,_0x292101,_0x97171){_0x97171(null,util[_0x45fc('0x16')](_0x45fc('0x17'),_0x45fc('0x22'),path[_0x45fc('0x18')](_0x292101[_0x45fc('0x19')])));}})});router[_0x45fc('0x1a')](_0x45fc('0x12'),upload[_0x45fc('0x1b')](_0x45fc('0x1f')),controller[_0x45fc('0x23')]);router['put'](_0x45fc('0xa'),auth['isAuthenticated'](),controller[_0x45fc('0x24')]);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 8b7d9cc..91f8f9e 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 _0xb20a=['sequelize','exports','min_internal','INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x5e7366,_0x2c2ad7){var _0x183874=function(_0x3ab971){while(--_0x3ab971){_0x5e7366['push'](_0x5e7366['shift']());}};_0x183874(++_0x2c2ad7);}(_0xb20a,0xe7));var _0xab20=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xb20a[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0xab20('0x0'));module[_0xab20('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xab20('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xab20('0x3')](0xb),'unique':_0xab20('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xab20('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xab20('0x5')},'logo':{'type':Sequelize[_0xab20('0x6')]},'defaultLogo':{'type':Sequelize[_0xab20('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xab20('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0xab20('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xab20('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xab20('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xab20('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xab20('0x6')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xab20('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xab20('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xab20('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xab20('0x6')],'defaultValue':_0xab20('0x8')},'enableEmailPreview':{'type':Sequelize[_0xab20('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xab20('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xab20('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xab20('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xab20('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xab20('0x9')},'chatTimeout':{'type':Sequelize[_0xab20('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xab20('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xab20('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xab20('0x6')]},'allowedLoginAttempts':{'type':Sequelize[_0xab20('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xab20('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xab20('0x6')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xab20('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xab20('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xab20('0x3')]},'transcribeRegion':{'type':Sequelize[_0xab20('0x6')]},'sentiment':{'type':Sequelize[_0xab20('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xab20('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xab20('0x3')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xab20('0x6')]},'bucket':{'type':Sequelize[_0xab20('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0xab20('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xab20('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xab20('0x3')](0x2)[_0xab20('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xab20('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xab20('0x3')](0x2)[_0xab20('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xab20('0x3')](0x2)[_0xab20('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xab20('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xab20('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xab20('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xab20('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xab20('0x3')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xab20('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xab20('0x3')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xab20('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x059b=['UNSIGNED','exports','INTEGER','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x059b,0x1c8));var _0xb059=function(_0x20d141,_0x59837b){_0x20d141=_0x20d141-0x0;var _0x621c89=_0x059b[_0x20d141];return _0x621c89;};'use strict';var Sequelize=require('sequelize');module[_0xb059('0x0')]={'min_internal':{'type':Sequelize[_0xb059('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb059('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xb059('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xb059('0x2')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xb059('0x2')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xb059('0x2')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xb059('0x2')]},'turnpassword':{'type':Sequelize[_0xb059('0x2')]},'pageTitle':{'type':Sequelize[_0xb059('0x2')]},'defaultPageTitle':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb059('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xb059('0x4')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xb059('0x2')],'defaultValue':_0xb059('0x5')},'chatTimeout':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb059('0x2')]},'defaultPreferred':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xb059('0x2')]},'defaultFavicon':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xb059('0x1')]},'transcribeRegion':{'type':Sequelize[_0xb059('0x2')]},'sentiment':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xb059('0x2')]},'language':{'type':Sequelize[_0xb059('0x2')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xb059('0x1')](0x2)[_0xb059('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xb059('0x1')](0x2)[_0xb059('0x6')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xb059('0x6')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6ae2483..854c8e2 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 _0x6068=['where','filters','filter','merge','VIRTUAL','includeAll','rows','show','params','include','options','find','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','root','join','default','upperFirst','custom','toLower','default_logo.svg','\x20not\x20found','download','getLogoLogin','existsSync','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','Sequelize','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','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','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort'];(function(_0x4810f7,_0x8d1c8a){var _0x31f387=function(_0x52606d){while(--_0x52606d){_0x4810f7['push'](_0x4810f7['shift']());}};_0x31f387(++_0x8d1c8a);}(_0x6068,0x134));var _0x8606=function(_0x33a195,_0x2c3684){_0x33a195=_0x33a195-0x0;var _0x211296=_0x6068[_0x33a195];return _0x211296;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8606('0x0'));var zipdir=require(_0x8606('0x1'));var jsonpatch=require(_0x8606('0x2'));var rp=require(_0x8606('0x3'));var moment=require(_0x8606('0x4'));var BPromise=require(_0x8606('0x5'));var Mustache=require(_0x8606('0x6'));var util=require(_0x8606('0x7'));var path=require(_0x8606('0x8'));var sox=require('sox');var csv=require(_0x8606('0x9'));var ejs=require(_0x8606('0xa'));var fs=require('fs');var fs_extra=require(_0x8606('0xb'));var _=require(_0x8606('0xc'));var squel=require(_0x8606('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8606('0xe'));var toCsv=require(_0x8606('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8606('0xf'));var authService=require(_0x8606('0x10'));var qs=require(_0x8606('0x11'));var as=require(_0x8606('0x12'));var hardwareService=require(_0x8606('0x13'));var logger=require(_0x8606('0x14'))(_0x8606('0x15'));var utils=require(_0x8606('0x16'));var config=require(_0x8606('0x17'));var licenseUtil=require(_0x8606('0x18'));var db=require(_0x8606('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8606('0x1a')][_0x8606('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x69495d,_0xc4575,_0x54b7b2,_0x31f806){return new BPromise(function(_0x2aec74,_0x4a88f2){var _0x236d3a=_0x31f806||client;return _0x236d3a[_0x8606('0x1c')](_0x69495d,_0x54b7b2)[_0x8606('0x1d')](function(_0x37be86){logger[_0x8606('0x1e')](_0x8606('0x1f'),_0xc4575,_0x8606('0x20'));logger[_0x8606('0x21')](_0x8606('0x22'),_0xc4575,_0x8606('0x20'),JSON['stringify'](_0x37be86));if(_0x37be86[_0x8606('0x23')]){if(_0x37be86[_0x8606('0x23')][_0x8606('0x24')]===0x1f4){logger['error'](_0x8606('0x1f'),_0xc4575,_0x37be86[_0x8606('0x23')][_0x8606('0x25')]);return _0x4a88f2(_0x37be86[_0x8606('0x23')]['message']);}logger['error'](_0x8606('0x1f'),_0xc4575,_0x37be86['error'][_0x8606('0x25')]);return _0x2aec74(_0x37be86['error'][_0x8606('0x25')]);}else{logger['info'](_0x8606('0x1f'),_0xc4575,_0x8606('0x20'));_0x2aec74(_0x37be86[_0x8606('0x26')][_0x8606('0x25')]);}})[_0x8606('0x27')](function(_0xd7efb0){logger['error'](_0x8606('0x1f'),_0xc4575,_0xd7efb0);_0x4a88f2(_0xd7efb0);});});}function respondWithStatusCode(_0x521026,_0x2e5b66){_0x2e5b66=_0x2e5b66||0xcc;return function(_0x36e9a0){if(_0x36e9a0){return _0x521026[_0x8606('0x28')](_0x2e5b66);}return _0x521026['status'](_0x2e5b66)[_0x8606('0x29')]();};}function respondWithResult(_0x30c653,_0x564431){_0x564431=_0x564431||0xc8;return function(_0x7fa27f){if(_0x7fa27f){return _0x30c653[_0x8606('0x2a')](_0x564431)[_0x8606('0x2b')](_0x7fa27f);}};}function respondWithFilteredResult(_0x5f2dfa,_0xb2791f){return function(_0x4c586c){if(_0x4c586c){var _0xca4bbb=typeof _0xb2791f['offset']==='undefined'&&typeof _0xb2791f[_0x8606('0x2c')]==='undefined';var _0x3e9362=_0x4c586c['count'];var _0x15f4b1=_0xca4bbb?0x0:_0xb2791f['offset'];var _0x2e8af1=_0xca4bbb?_0x4c586c[_0x8606('0x2d')]:_0xb2791f[_0x8606('0x2e')]+_0xb2791f[_0x8606('0x2c')];var _0x13d020;if(_0x2e8af1>=_0x3e9362){_0x2e8af1=_0x3e9362;_0x13d020=0xc8;}else{_0x13d020=0xce;}_0x5f2dfa['status'](_0x13d020);return _0x5f2dfa[_0x8606('0x2f')](_0x8606('0x30'),_0x15f4b1+'-'+_0x2e8af1+'/'+_0x3e9362)[_0x8606('0x2b')](_0x4c586c);}return null;};}function patchUpdates(_0x4c3842){return function(_0xd85249){try{jsonpatch[_0x8606('0x31')](_0xd85249,_0x4c3842,!![]);}catch(_0x45cafd){return BPromise[_0x8606('0x32')](_0x45cafd);}return _0xd85249[_0x8606('0x33')]();};}function saveUpdates(_0x5c9845,_0x189cb5){return function(_0x557531){if(_0x557531){return _0x557531[_0x8606('0x34')](_0x5c9845)[_0x8606('0x1d')](function(_0x266b6d){return _0x266b6d;});}return null;};}function removeEntity(_0x11ff70,_0x23a222){return function(_0x1a8f1c){if(_0x1a8f1c){return _0x1a8f1c[_0x8606('0x35')]()[_0x8606('0x1d')](function(){_0x11ff70[_0x8606('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50dde8,_0x511ddb){return function(_0x22072b){if(!_0x22072b){_0x50dde8['sendStatus'](0x194);}return _0x22072b;};}function handleError(_0x4e57b1,_0x2ad796){_0x2ad796=_0x2ad796||0x1f4;return function(_0x13a30b){logger[_0x8606('0x23')](_0x13a30b[_0x8606('0x36')]);if(_0x13a30b[_0x8606('0x37')]){delete _0x13a30b[_0x8606('0x37')];}_0x4e57b1[_0x8606('0x2a')](_0x2ad796)['send'](_0x13a30b);};}exports[_0x8606('0x38')]=function(_0x44a16e,_0x972c84){var _0x123b5c={},_0xf42ef3={},_0x48e3bb={'count':0x0,'rows':[]};var _0x113075=_[_0x8606('0x39')](db[_0x8606('0x3a')][_0x8606('0x3b')],function(_0x12f117){return{'name':_0x12f117[_0x8606('0x3c')],'type':_0x12f117[_0x8606('0x3d')][_0x8606('0x3e')]};});_0xf42ef3['model']=_[_0x8606('0x39')](_0x113075,_0x8606('0x37'));_0xf42ef3[_0x8606('0x3f')]=_[_0x8606('0x40')](_0x44a16e[_0x8606('0x3f')]);_0xf42ef3['filters']=_[_0x8606('0x41')](_0xf42ef3[_0x8606('0x42')],_0xf42ef3[_0x8606('0x3f')]);_0x123b5c[_0x8606('0x43')]=_[_0x8606('0x41')](_0xf42ef3[_0x8606('0x42')],qs['fields'](_0x44a16e[_0x8606('0x3f')][_0x8606('0x44')]));_0x123b5c[_0x8606('0x43')]=_0x123b5c['attributes'][_0x8606('0x45')]?_0x123b5c[_0x8606('0x43')]:_0xf42ef3[_0x8606('0x42')];if(!_0x44a16e[_0x8606('0x3f')]['hasOwnProperty'](_0x8606('0x46'))){_0x123b5c[_0x8606('0x2c')]=qs[_0x8606('0x2c')](_0x44a16e[_0x8606('0x3f')][_0x8606('0x2c')]);_0x123b5c[_0x8606('0x2e')]=qs[_0x8606('0x2e')](_0x44a16e[_0x8606('0x3f')][_0x8606('0x2e')]);}_0x123b5c[_0x8606('0x47')]=qs['sort'](_0x44a16e['query'][_0x8606('0x48')]);_0x123b5c[_0x8606('0x49')]=qs[_0x8606('0x4a')](_['pick'](_0x44a16e['query'],_0xf42ef3[_0x8606('0x4a')]),_0x113075);if(_0x44a16e['query'][_0x8606('0x4b')]){_0x123b5c[_0x8606('0x49')]=_[_0x8606('0x4c')](_0x123b5c[_0x8606('0x49')],{'$or':_[_0x8606('0x39')](_0x113075,function(_0x16d3c6){if(_0x16d3c6[_0x8606('0x3d')]!==_0x8606('0x4d')){var _0x8f90b7={};_0x8f90b7[_0x16d3c6[_0x8606('0x37')]]={'$like':'%'+_0x44a16e[_0x8606('0x3f')][_0x8606('0x4b')]+'%'};return _0x8f90b7;}})});}_0x123b5c=_[_0x8606('0x4c')]({},_0x123b5c,_0x44a16e['options']);var _0x3bd8a8={'where':_0x123b5c[_0x8606('0x49')]};return db[_0x8606('0x3a')][_0x8606('0x2d')](_0x3bd8a8)[_0x8606('0x1d')](function(_0x33f35e){_0x48e3bb[_0x8606('0x2d')]=_0x33f35e;if(_0x44a16e[_0x8606('0x3f')][_0x8606('0x4e')]){_0x123b5c['include']=[{'all':!![]}];}return db[_0x8606('0x3a')]['findAll'](_0x123b5c);})[_0x8606('0x1d')](function(_0x2621dc){_0x48e3bb[_0x8606('0x4f')]=_0x2621dc;return _0x48e3bb;})[_0x8606('0x1d')](respondWithFilteredResult(_0x972c84,_0x123b5c))['catch'](handleError(_0x972c84,null));};exports[_0x8606('0x50')]=function(_0xd73310,_0x59580c){var _0x25155b={'raw':![],'where':{'id':_0xd73310[_0x8606('0x51')]['id']}},_0x4db0a9={};_0x4db0a9[_0x8606('0x42')]=_['keys'](db[_0x8606('0x3a')][_0x8606('0x3b')]);_0x4db0a9[_0x8606('0x3f')]=_['keys'](_0xd73310[_0x8606('0x3f')]);_0x4db0a9[_0x8606('0x4a')]=_[_0x8606('0x41')](_0x4db0a9[_0x8606('0x42')],_0x4db0a9['query']);_0x25155b['attributes']=_[_0x8606('0x41')](_0x4db0a9[_0x8606('0x42')],qs[_0x8606('0x44')](_0xd73310[_0x8606('0x3f')][_0x8606('0x44')]));_0x25155b[_0x8606('0x43')]=_0x25155b[_0x8606('0x43')]['length']?_0x25155b[_0x8606('0x43')]:_0x4db0a9[_0x8606('0x42')];if(_0xd73310['query'][_0x8606('0x4e')]){_0x25155b[_0x8606('0x52')]=[{'all':!![]}];}_0x25155b=_[_0x8606('0x4c')]({},_0x25155b,_0xd73310[_0x8606('0x53')]);return db['Setting'][_0x8606('0x54')](_0x25155b)[_0x8606('0x1d')](handleEntityNotFound(_0x59580c,null))[_0x8606('0x1d')](respondWithResult(_0x59580c,null))[_0x8606('0x27')](handleError(_0x59580c,null));};exports[_0x8606('0x34')]=function(_0x22e45b,_0x469f0d){if(_0x22e45b[_0x8606('0x55')]['id']){delete _0x22e45b[_0x8606('0x55')]['id'];}return db['Setting'][_0x8606('0x54')]({'where':{'id':_0x22e45b[_0x8606('0x51')]['id']}})[_0x8606('0x1d')](handleEntityNotFound(_0x469f0d,null))[_0x8606('0x1d')](saveUpdates(_0x22e45b[_0x8606('0x55')],null))['then'](respondWithResult(_0x469f0d,null))['catch'](handleError(_0x469f0d,null));};exports[_0x8606('0x56')]=function(_0x259838,_0x523eff,_0x4ae8b8){if(_0x259838[_0x8606('0x57')]&&_0x259838[_0x8606('0x57')][_0x8606('0x58')]){_0x259838[_0x8606('0x55')]['logo']=_0x259838[_0x8606('0x57')][_0x8606('0x58')];}return db['Setting'][_0x8606('0x54')]({'where':{'id':_0x259838[_0x8606('0x51')]['id']}})[_0x8606('0x1d')](handleEntityNotFound(_0x523eff,null))[_0x8606('0x1d')](saveUpdates(_0x259838['body'],null))[_0x8606('0x1d')](respondWithResult(_0x523eff,null))[_0x8606('0x27')](handleError(_0x523eff,null));};exports[_0x8606('0x59')]=function(_0x426e18,_0x5f24ef,_0x4fa2c0){if(_0x426e18[_0x8606('0x57')]&&_0x426e18['file'][_0x8606('0x58')]){_0x426e18[_0x8606('0x55')][_0x8606('0x5a')]=_0x426e18[_0x8606('0x57')][_0x8606('0x58')];}return db[_0x8606('0x3a')][_0x8606('0x54')]({'where':{'id':_0x426e18[_0x8606('0x51')]['id']}})[_0x8606('0x1d')](handleEntityNotFound(_0x5f24ef,null))['then'](saveUpdates(_0x426e18[_0x8606('0x55')],null))[_0x8606('0x1d')](respondWithResult(_0x5f24ef,null))[_0x8606('0x27')](handleError(_0x5f24ef,null));};var utilLicense=require(_0x8606('0x18'));exports[_0x8606('0x5b')]=function(_0xb7c32f,_0x134f81,_0x2cf1f1){var _0x10f45a=_0x8606('0x5c');var _0x27e2bd={'custom':![]};return utilLicense[_0x8606('0x5d')]()['then'](function(_0x553f92){if(_0x553f92){_0x27e2bd=_0x553f92;}return db[_0x8606('0x3a')]['find']({'where':{'id':_0xb7c32f['params']['id']},'attributes':[_0x8606('0x5e'),_0x8606('0x5a'),_0x8606('0x5f'),_0x8606('0x60'),_0x8606('0x61'),_0x8606('0x62'),_0x8606('0x63'),_0x8606('0x64')],'raw':!![]});})[_0x8606('0x1d')](handleEntityNotFound(_0x134f81,null))[_0x8606('0x1d')](function(_0x2270db){if(_0x2270db){var _0x1b9726=_0x2270db[_0x8606('0x5e')]&&fs['existsSync'](path['join'](config[_0x8606('0x65')],_0x10f45a,_['toLower'](_0x2270db['logo'])))?path[_0x8606('0x66')](config[_0x8606('0x65')],_0x10f45a,_['toLower'](_0x2270db[_0x8606('0x5e')])):path[_0x8606('0x66')](config['root'],_0x10f45a,_['toLower']('default_logo.svg'));var _0x14e718=_0x8606('0x67')+_[_0x8606('0x68')](_0x8606('0x5e'));if(_0x2270db[_0x14e718]||!_0x27e2bd[_0x8606('0x69')]){_0x1b9726=path[_0x8606('0x66')](config[_0x8606('0x65')],_0x10f45a,_[_0x8606('0x6a')](_0x8606('0x6b')));}if(!fs['existsSync'](_0x1b9726)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x8606('0x5e'))+_0x8606('0x6c'));}return _0x134f81[_0x8606('0x6d')](_0x1b9726);}})[_0x8606('0x27')](handleError(_0x134f81,null));};var utilLicense=require('../../config/license/util');exports[_0x8606('0x6e')]=function(_0x50e5d1,_0xda19eb,_0x364394){var _0x28c994=_0x8606('0x5c');var _0x4ae847={'custom':![]};return utilLicense[_0x8606('0x5d')]()[_0x8606('0x1d')](function(_0x4c87d3){if(_0x4c87d3){_0x4ae847=_0x4c87d3;}return db['Setting'][_0x8606('0x54')]({'where':{'id':_0x50e5d1[_0x8606('0x51')]['id']},'attributes':[_0x8606('0x5e'),_0x8606('0x5a'),_0x8606('0x5f'),_0x8606('0x60'),_0x8606('0x61'),_0x8606('0x62'),_0x8606('0x63'),_0x8606('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0xda19eb,null))['then'](function(_0xe4df0c){if(_0xe4df0c){var _0x164e3d=_0xe4df0c[_0x8606('0x5a')]&&fs[_0x8606('0x6f')](path[_0x8606('0x66')](config['root'],_0x28c994,_[_0x8606('0x6a')](_0xe4df0c[_0x8606('0x5a')])))?path[_0x8606('0x66')](config['root'],_0x28c994,_[_0x8606('0x6a')](_0xe4df0c[_0x8606('0x5a')])):path['join'](config[_0x8606('0x65')],_0x28c994,_[_0x8606('0x6a')]('default_loginLogo.svg'));var _0x574743=_0x8606('0x67')+_[_0x8606('0x68')](_0x8606('0x5a'));if(_0xe4df0c[_0x574743]||!_0x4ae847[_0x8606('0x69')]){_0x164e3d=path[_0x8606('0x66')](config['root'],_0x28c994,_['toLower'](_0x8606('0x70')));}if(!fs[_0x8606('0x6f')](_0x164e3d)){throw new db['Sequelize'][(_0x8606('0x71'))](_['upperFirst'](_0x8606('0x5a'))+_0x8606('0x6c'));}return _0xda19eb['download'](_0x164e3d);}})[_0x8606('0x27')](handleError(_0xda19eb,null));};exports[_0x8606('0x72')]=function(_0x59042f,_0x4bf448){return db['Setting'][_0x8606('0x54')]({'where':{'id':_0x59042f[_0x8606('0x51')]['id']},'attributes':[_0x8606('0x73')]})['then'](respondWithResult(_0x4bf448,null))[_0x8606('0x27')](handleError(_0x4bf448,null));};exports[_0x8606('0x74')]=function(_0x4fb6ee,_0x1a38ad,_0x16606a){if(_0x4fb6ee[_0x8606('0x57')]&&_0x4fb6ee['file'][_0x8606('0x58')]){_0x4fb6ee[_0x8606('0x55')][_0x8606('0x5f')]=_0x4fb6ee['file'][_0x8606('0x58')];}return db['Setting'][_0x8606('0x54')]({'where':{'id':_0x4fb6ee[_0x8606('0x51')]['id']}})[_0x8606('0x1d')](handleEntityNotFound(_0x1a38ad,null))[_0x8606('0x1d')](saveUpdates(_0x4fb6ee['body'],null))[_0x8606('0x1d')](respondWithResult(_0x1a38ad,null))['catch'](handleError(_0x1a38ad,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x49bb26,_0x24f06f,_0x1194a5){var _0x48bb21=_0x8606('0x5c');var _0x45704a={'custom':![]};return utilLicense['getLicense']()[_0x8606('0x1d')](function(_0x434eb9){if(_0x434eb9){_0x45704a=_0x434eb9;}return db[_0x8606('0x3a')]['find']({'where':{'id':_0x49bb26[_0x8606('0x51')]['id']},'attributes':[_0x8606('0x5e'),'loginLogo',_0x8606('0x5f'),'favicon',_0x8606('0x61'),_0x8606('0x62'),'defaultPreferred',_0x8606('0x64')],'raw':!![]});})[_0x8606('0x1d')](handleEntityNotFound(_0x24f06f,null))[_0x8606('0x1d')](function(_0x1f0430){if(_0x1f0430){var _0x9bf4e3=_0x1f0430[_0x8606('0x5f')]&&fs[_0x8606('0x6f')](path[_0x8606('0x66')](config[_0x8606('0x65')],_0x48bb21,_[_0x8606('0x6a')](_0x1f0430[_0x8606('0x5f')])))?path[_0x8606('0x66')](config[_0x8606('0x65')],_0x48bb21,_[_0x8606('0x6a')](_0x1f0430[_0x8606('0x5f')])):path[_0x8606('0x66')](config['root'],_0x48bb21,_[_0x8606('0x6a')](_0x8606('0x75')));var _0x1722f8=_0x8606('0x67')+_['upperFirst'](_0x8606('0x5f'));if(_0x1f0430[_0x1722f8]||!_0x45704a[_0x8606('0x69')]||!_0x45704a[_0x8606('0x5f')]){_0x9bf4e3=path[_0x8606('0x66')](config[_0x8606('0x65')],_0x48bb21,_[_0x8606('0x6a')](_0x8606('0x75')));}if(!fs['existsSync'](_0x9bf4e3)){throw new db['Sequelize']['ValidationError'](_[_0x8606('0x68')](_0x8606('0x5f'))+_0x8606('0x6c'));}return _0x24f06f[_0x8606('0x6d')](_0x9bf4e3);}})[_0x8606('0x27')](handleError(_0x24f06f,null));};exports[_0x8606('0x76')]=function(_0xf177f,_0x3113ee,_0x26b596){if(_0xf177f[_0x8606('0x57')]&&_0xf177f[_0x8606('0x57')][_0x8606('0x58')]){_0xf177f[_0x8606('0x55')][_0x8606('0x60')]=_0xf177f[_0x8606('0x57')][_0x8606('0x58')];}return db[_0x8606('0x3a')][_0x8606('0x54')]({'where':{'id':_0xf177f[_0x8606('0x51')]['id']}})[_0x8606('0x1d')](handleEntityNotFound(_0x3113ee,null))[_0x8606('0x1d')](saveUpdates(_0xf177f[_0x8606('0x55')],null))[_0x8606('0x1d')](respondWithResult(_0x3113ee,null))[_0x8606('0x27')](handleError(_0x3113ee,null));};var utilLicense=require(_0x8606('0x18'));exports[_0x8606('0x77')]=function(_0x36f090,_0x1de7d8,_0x23247c){var _0x29f324=_0x8606('0x5c');var _0x3220e8={'custom':![]};return utilLicense[_0x8606('0x5d')]()['then'](function(_0x33621d){if(_0x33621d){_0x3220e8=_0x33621d;}return db[_0x8606('0x3a')][_0x8606('0x54')]({'where':{'id':_0x36f090[_0x8606('0x51')]['id']},'attributes':[_0x8606('0x5e'),'loginLogo',_0x8606('0x5f'),_0x8606('0x60'),_0x8606('0x61'),_0x8606('0x62'),'defaultPreferred',_0x8606('0x64')],'raw':!![]});})[_0x8606('0x1d')](handleEntityNotFound(_0x1de7d8,null))[_0x8606('0x1d')](function(_0x17397b){if(_0x17397b){var _0x284f8d=_0x17397b['favicon']&&fs[_0x8606('0x6f')](path['join'](config[_0x8606('0x65')],_0x29f324,_['toLower'](_0x17397b[_0x8606('0x60')])))?path[_0x8606('0x66')](config[_0x8606('0x65')],_0x29f324,_[_0x8606('0x6a')](_0x17397b[_0x8606('0x60')])):path[_0x8606('0x66')](config[_0x8606('0x65')],_0x29f324,_['toLower'](_0x8606('0x78')));var _0x17214e=_0x8606('0x67')+_[_0x8606('0x68')](_0x8606('0x60'));if(_0x17397b[_0x17214e]||!_0x3220e8['custom']){_0x284f8d=path[_0x8606('0x66')](config[_0x8606('0x65')],_0x29f324,_['toLower'](_0x8606('0x78')));}if(!fs['existsSync'](_0x284f8d)){throw new db[(_0x8606('0x79'))][(_0x8606('0x71'))](_[_0x8606('0x68')]('favicon')+_0x8606('0x6c'));}return _0x1de7d8[_0x8606('0x6d')](_0x284f8d);}})[_0x8606('0x27')](handleError(_0x1de7d8,null));};exports[_0x8606('0x7a')]=function(_0x509a03,_0x283ec9){var _0x17088b={'offset':moment()[_0x8606('0x7b')]()};_0x17088b[_0x8606('0x7c')]=moment()[_0x8606('0x7b')](_0x17088b['offset'])['format'](_0x8606('0x7d'));return _0x283ec9['status'](0xc8)[_0x8606('0x7e')](_0x17088b);}; \ No newline at end of file +var _0x98fc=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','destroy','name','send','index','map','Setting','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','fields','body','find','addLogo','file','logo','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','custom','existsSync','upperFirst','download','getLogoLogin','favicon','default_loginLogo.svg','Sequelize','ValidationError','\x20not\x20found','gdpr','addPreferred','preferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0x136bce,_0x18216b){var _0xe0a011=function(_0x5cf72f){while(--_0x5cf72f){_0x136bce['push'](_0x136bce['shift']());}};_0xe0a011(++_0x18216b);}(_0x98fc,0x156));var _0xc98f=function(_0x492e32,_0x2e0a93){_0x492e32=_0x492e32-0x0;var _0x4a335e=_0x98fc[_0x492e32];return _0x4a335e;};'use strict';var emlformat=require(_0xc98f('0x0'));var rimraf=require(_0xc98f('0x1'));var zipdir=require(_0xc98f('0x2'));var jsonpatch=require(_0xc98f('0x3'));var rp=require(_0xc98f('0x4'));var moment=require('moment');var BPromise=require(_0xc98f('0x5'));var Mustache=require('mustache');var util=require(_0xc98f('0x6'));var path=require('path');var sox=require(_0xc98f('0x7'));var csv=require(_0xc98f('0x8'));var ejs=require(_0xc98f('0x9'));var fs=require('fs');var fs_extra=require(_0xc98f('0xa'));var _=require(_0xc98f('0xb'));var squel=require(_0xc98f('0xc'));var crypto=require(_0xc98f('0xd'));var jsforce=require(_0xc98f('0xe'));var deskjs=require(_0xc98f('0xf'));var toCsv=require(_0xc98f('0x8'));var querystring=require('querystring');var Papa=require(_0xc98f('0x10'));var Redis=require('ioredis');var authService=require(_0xc98f('0x11'));var qs=require(_0xc98f('0x12'));var as=require(_0xc98f('0x13'));var hardwareService=require(_0xc98f('0x14'));var logger=require(_0xc98f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc98f('0x16'));var licenseUtil=require(_0xc98f('0x17'));var db=require(_0xc98f('0x18'))['db'];var jayson=require(_0xc98f('0x19'));var client=jayson[_0xc98f('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f2734,_0x2ec996,_0x5b64c2,_0x3c0b29){return new BPromise(function(_0x131932,_0x1ff20a){var _0xca4553=_0x3c0b29||client;return _0xca4553[_0xc98f('0x1b')](_0x1f2734,_0x5b64c2)[_0xc98f('0x1c')](function(_0x4f4e28){logger[_0xc98f('0x1d')](_0xc98f('0x1e'),_0x2ec996,'request\x20sent');logger[_0xc98f('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x2ec996,_0xc98f('0x20'),JSON[_0xc98f('0x21')](_0x4f4e28));if(_0x4f4e28['error']){if(_0x4f4e28[_0xc98f('0x22')][_0xc98f('0x23')]===0x1f4){logger[_0xc98f('0x22')]('Setting,\x20%s,\x20%s',_0x2ec996,_0x4f4e28['error'][_0xc98f('0x24')]);return _0x1ff20a(_0x4f4e28[_0xc98f('0x22')][_0xc98f('0x24')]);}logger[_0xc98f('0x22')](_0xc98f('0x1e'),_0x2ec996,_0x4f4e28[_0xc98f('0x22')]['message']);return _0x131932(_0x4f4e28[_0xc98f('0x22')][_0xc98f('0x24')]);}else{logger['info'](_0xc98f('0x1e'),_0x2ec996,_0xc98f('0x20'));_0x131932(_0x4f4e28[_0xc98f('0x25')][_0xc98f('0x24')]);}})[_0xc98f('0x26')](function(_0x4f8014){logger[_0xc98f('0x22')](_0xc98f('0x1e'),_0x2ec996,_0x4f8014);_0x1ff20a(_0x4f8014);});});}function respondWithStatusCode(_0x2f78fe,_0x433576){_0x433576=_0x433576||0xcc;return function(_0x21d514){if(_0x21d514){return _0x2f78fe[_0xc98f('0x27')](_0x433576);}return _0x2f78fe[_0xc98f('0x28')](_0x433576)[_0xc98f('0x29')]();};}function respondWithResult(_0x21d124,_0x13c9c9){_0x13c9c9=_0x13c9c9||0xc8;return function(_0xe18d29){if(_0xe18d29){return _0x21d124['status'](_0x13c9c9)[_0xc98f('0x2a')](_0xe18d29);}};}function respondWithFilteredResult(_0x2cf0ec,_0x151c56){return function(_0x13f9e0){if(_0x13f9e0){var _0x3a8150=typeof _0x151c56[_0xc98f('0x2b')]===_0xc98f('0x2c')&&typeof _0x151c56[_0xc98f('0x2d')]==='undefined';var _0x3179c2=_0x13f9e0[_0xc98f('0x2e')];var _0x2ffd33=_0x3a8150?0x0:_0x151c56['offset'];var _0x1b8659=_0x3a8150?_0x13f9e0[_0xc98f('0x2e')]:_0x151c56[_0xc98f('0x2b')]+_0x151c56[_0xc98f('0x2d')];var _0x598b7c;if(_0x1b8659>=_0x3179c2){_0x1b8659=_0x3179c2;_0x598b7c=0xc8;}else{_0x598b7c=0xce;}_0x2cf0ec[_0xc98f('0x28')](_0x598b7c);return _0x2cf0ec['set'](_0xc98f('0x2f'),_0x2ffd33+'-'+_0x1b8659+'/'+_0x3179c2)[_0xc98f('0x2a')](_0x13f9e0);}return null;};}function patchUpdates(_0x4958f3){return function(_0x1de1e5){try{jsonpatch['apply'](_0x1de1e5,_0x4958f3,!![]);}catch(_0x3fc501){return BPromise[_0xc98f('0x30')](_0x3fc501);}return _0x1de1e5['save']();};}function saveUpdates(_0x358e3d,_0x11275e){return function(_0x50cc33){if(_0x50cc33){return _0x50cc33['update'](_0x358e3d)[_0xc98f('0x1c')](function(_0x53532c){return _0x53532c;});}return null;};}function removeEntity(_0x482acc,_0x35375c){return function(_0x1613c0){if(_0x1613c0){return _0x1613c0[_0xc98f('0x31')]()['then'](function(){_0x482acc[_0xc98f('0x28')](0xcc)[_0xc98f('0x29')]();});}};}function handleEntityNotFound(_0xfa8482,_0x22ce33){return function(_0xff354b){if(!_0xff354b){_0xfa8482[_0xc98f('0x27')](0x194);}return _0xff354b;};}function handleError(_0x17ae0f,_0x5c09f){_0x5c09f=_0x5c09f||0x1f4;return function(_0x5af938){logger['error'](_0x5af938['stack']);if(_0x5af938[_0xc98f('0x32')]){delete _0x5af938['name'];}_0x17ae0f['status'](_0x5c09f)[_0xc98f('0x33')](_0x5af938);};}exports[_0xc98f('0x34')]=function(_0x2fe253,_0x3a4634){var _0x28ed7c={},_0x5d9a85={},_0x4e0a16={'count':0x0,'rows':[]};var _0x506384=_[_0xc98f('0x35')](db[_0xc98f('0x36')]['rawAttributes'],function(_0x4b6de1){return{'name':_0x4b6de1['fieldName'],'type':_0x4b6de1[_0xc98f('0x37')][_0xc98f('0x38')]};});_0x5d9a85[_0xc98f('0x39')]=_[_0xc98f('0x35')](_0x506384,_0xc98f('0x32'));_0x5d9a85[_0xc98f('0x3a')]=_[_0xc98f('0x3b')](_0x2fe253[_0xc98f('0x3a')]);_0x5d9a85['filters']=_[_0xc98f('0x3c')](_0x5d9a85[_0xc98f('0x39')],_0x5d9a85['query']);_0x28ed7c['attributes']=_[_0xc98f('0x3c')](_0x5d9a85['model'],qs['fields'](_0x2fe253['query']['fields']));_0x28ed7c[_0xc98f('0x3d')]=_0x28ed7c[_0xc98f('0x3d')][_0xc98f('0x3e')]?_0x28ed7c[_0xc98f('0x3d')]:_0x5d9a85[_0xc98f('0x39')];if(!_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x3f')]('nolimit')){_0x28ed7c['limit']=qs[_0xc98f('0x2d')](_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x2d')]);_0x28ed7c[_0xc98f('0x2b')]=qs['offset'](_0x2fe253['query'][_0xc98f('0x2b')]);}_0x28ed7c[_0xc98f('0x40')]=qs[_0xc98f('0x41')](_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x41')]);_0x28ed7c[_0xc98f('0x42')]=qs[_0xc98f('0x43')](_[_0xc98f('0x44')](_0x2fe253[_0xc98f('0x3a')],_0x5d9a85[_0xc98f('0x43')]),_0x506384);if(_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x45')]){_0x28ed7c[_0xc98f('0x42')]=_[_0xc98f('0x46')](_0x28ed7c[_0xc98f('0x42')],{'$or':_[_0xc98f('0x35')](_0x506384,function(_0x17698f){if(_0x17698f['type']!==_0xc98f('0x47')){var _0x3bd720={};_0x3bd720[_0x17698f[_0xc98f('0x32')]]={'$like':'%'+_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x45')]+'%'};return _0x3bd720;}})});}_0x28ed7c=_[_0xc98f('0x46')]({},_0x28ed7c,_0x2fe253[_0xc98f('0x48')]);var _0x38c2eb={'where':_0x28ed7c['where']};return db[_0xc98f('0x36')][_0xc98f('0x2e')](_0x38c2eb)['then'](function(_0x4962e2){_0x4e0a16[_0xc98f('0x2e')]=_0x4962e2;if(_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x49')]){_0x28ed7c[_0xc98f('0x4a')]=[{'all':!![]}];}return db[_0xc98f('0x36')]['findAll'](_0x28ed7c);})['then'](function(_0x31f450){_0x4e0a16[_0xc98f('0x4b')]=_0x31f450;return _0x4e0a16;})[_0xc98f('0x1c')](respondWithFilteredResult(_0x3a4634,_0x28ed7c))[_0xc98f('0x26')](handleError(_0x3a4634,null));};exports['show']=function(_0x27eaa8,_0x12c187){var _0x224091={'raw':![],'where':{'id':_0x27eaa8[_0xc98f('0x4c')]['id']}},_0x47541e={};_0x47541e[_0xc98f('0x39')]=_[_0xc98f('0x3b')](db[_0xc98f('0x36')][_0xc98f('0x4d')]);_0x47541e['query']=_['keys'](_0x27eaa8[_0xc98f('0x3a')]);_0x47541e[_0xc98f('0x43')]=_[_0xc98f('0x3c')](_0x47541e['model'],_0x47541e[_0xc98f('0x3a')]);_0x224091[_0xc98f('0x3d')]=_[_0xc98f('0x3c')](_0x47541e['model'],qs[_0xc98f('0x4e')](_0x27eaa8[_0xc98f('0x3a')]['fields']));_0x224091[_0xc98f('0x3d')]=_0x224091[_0xc98f('0x3d')]['length']?_0x224091[_0xc98f('0x3d')]:_0x47541e['model'];if(_0x27eaa8[_0xc98f('0x3a')][_0xc98f('0x49')]){_0x224091[_0xc98f('0x4a')]=[{'all':!![]}];}_0x224091=_[_0xc98f('0x46')]({},_0x224091,_0x27eaa8[_0xc98f('0x48')]);return db['Setting']['find'](_0x224091)[_0xc98f('0x1c')](handleEntityNotFound(_0x12c187,null))['then'](respondWithResult(_0x12c187,null))[_0xc98f('0x26')](handleError(_0x12c187,null));};exports['update']=function(_0x4a34ad,_0x2d3bcc){if(_0x4a34ad[_0xc98f('0x4f')]['id']){delete _0x4a34ad[_0xc98f('0x4f')]['id'];}return db['Setting'][_0xc98f('0x50')]({'where':{'id':_0x4a34ad[_0xc98f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2d3bcc,null))[_0xc98f('0x1c')](saveUpdates(_0x4a34ad[_0xc98f('0x4f')],null))[_0xc98f('0x1c')](respondWithResult(_0x2d3bcc,null))['catch'](handleError(_0x2d3bcc,null));};exports[_0xc98f('0x51')]=function(_0x402ccb,_0x49eea9,_0x1277ca){if(_0x402ccb[_0xc98f('0x52')]&&_0x402ccb[_0xc98f('0x52')]['filename']){_0x402ccb[_0xc98f('0x4f')][_0xc98f('0x53')]=_0x402ccb['file'][_0xc98f('0x54')];}return db[_0xc98f('0x36')]['find']({'where':{'id':_0x402ccb['params']['id']}})[_0xc98f('0x1c')](handleEntityNotFound(_0x49eea9,null))[_0xc98f('0x1c')](saveUpdates(_0x402ccb[_0xc98f('0x4f')],null))['then'](respondWithResult(_0x49eea9,null))[_0xc98f('0x26')](handleError(_0x49eea9,null));};exports[_0xc98f('0x55')]=function(_0x38a78d,_0x271af0,_0x7a7172){if(_0x38a78d[_0xc98f('0x52')]&&_0x38a78d[_0xc98f('0x52')][_0xc98f('0x54')]){_0x38a78d[_0xc98f('0x4f')]['loginLogo']=_0x38a78d[_0xc98f('0x52')][_0xc98f('0x54')];}return db['Setting'][_0xc98f('0x50')]({'where':{'id':_0x38a78d[_0xc98f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x271af0,null))[_0xc98f('0x1c')](saveUpdates(_0x38a78d[_0xc98f('0x4f')],null))[_0xc98f('0x1c')](respondWithResult(_0x271af0,null))['catch'](handleError(_0x271af0,null));};var utilLicense=require('../../config/license/util');exports[_0xc98f('0x56')]=function(_0x58f7b0,_0x452180,_0x300f80){var _0x4672c2=_0xc98f('0x57');var _0x200546={'custom':![]};return utilLicense[_0xc98f('0x58')]()[_0xc98f('0x1c')](function(_0x441e51){if(_0x441e51){_0x200546=_0x441e51;}return db['Setting'][_0xc98f('0x50')]({'where':{'id':_0x58f7b0['params']['id']},'attributes':[_0xc98f('0x53'),_0xc98f('0x59'),'preferred','favicon',_0xc98f('0x5a'),_0xc98f('0x5b'),_0xc98f('0x5c'),_0xc98f('0x5d')],'raw':!![]});})[_0xc98f('0x1c')](handleEntityNotFound(_0x452180,null))['then'](function(_0x8aca4){if(_0x8aca4){var _0x45f4a8=_0x8aca4[_0xc98f('0x53')]&&fs['existsSync'](path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x4672c2,_[_0xc98f('0x60')](_0x8aca4[_0xc98f('0x53')])))?path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x4672c2,_['toLower'](_0x8aca4[_0xc98f('0x53')])):path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x4672c2,_['toLower'](_0xc98f('0x61')));var _0x190341=_0xc98f('0x62')+_['upperFirst'](_0xc98f('0x53'));if(_0x8aca4[_0x190341]||!_0x200546[_0xc98f('0x63')]){_0x45f4a8=path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x4672c2,_[_0xc98f('0x60')]('default_logo.svg'));}if(!fs[_0xc98f('0x64')](_0x45f4a8)){throw new db['Sequelize']['ValidationError'](_[_0xc98f('0x65')](_0xc98f('0x53'))+'\x20not\x20found');}return _0x452180[_0xc98f('0x66')](_0x45f4a8);}})[_0xc98f('0x26')](handleError(_0x452180,null));};var utilLicense=require(_0xc98f('0x17'));exports[_0xc98f('0x67')]=function(_0x1292a4,_0x592411,_0x621f8f){var _0x3bcac7=_0xc98f('0x57');var _0x487c9b={'custom':![]};return utilLicense[_0xc98f('0x58')]()[_0xc98f('0x1c')](function(_0xb556c){if(_0xb556c){_0x487c9b=_0xb556c;}return db[_0xc98f('0x36')][_0xc98f('0x50')]({'where':{'id':_0x1292a4[_0xc98f('0x4c')]['id']},'attributes':['logo',_0xc98f('0x59'),'preferred',_0xc98f('0x68'),_0xc98f('0x5a'),'defaultLoginLogo',_0xc98f('0x5c'),_0xc98f('0x5d')],'raw':!![]});})[_0xc98f('0x1c')](handleEntityNotFound(_0x592411,null))[_0xc98f('0x1c')](function(_0x2c1536){if(_0x2c1536){var _0x1a09b8=_0x2c1536[_0xc98f('0x59')]&&fs[_0xc98f('0x64')](path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x3bcac7,_[_0xc98f('0x60')](_0x2c1536[_0xc98f('0x59')])))?path[_0xc98f('0x5e')](config['root'],_0x3bcac7,_[_0xc98f('0x60')](_0x2c1536[_0xc98f('0x59')])):path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x3bcac7,_[_0xc98f('0x60')](_0xc98f('0x69')));var _0x501a39='default'+_[_0xc98f('0x65')](_0xc98f('0x59'));if(_0x2c1536[_0x501a39]||!_0x487c9b[_0xc98f('0x63')]){_0x1a09b8=path[_0xc98f('0x5e')](config['root'],_0x3bcac7,_[_0xc98f('0x60')](_0xc98f('0x69')));}if(!fs[_0xc98f('0x64')](_0x1a09b8)){throw new db[(_0xc98f('0x6a'))][(_0xc98f('0x6b'))](_[_0xc98f('0x65')](_0xc98f('0x59'))+_0xc98f('0x6c'));}return _0x592411[_0xc98f('0x66')](_0x1a09b8);}})[_0xc98f('0x26')](handleError(_0x592411,null));};exports[_0xc98f('0x6d')]=function(_0x5c093b,_0x487058){return db[_0xc98f('0x36')][_0xc98f('0x50')]({'where':{'id':_0x5c093b['params']['id']},'attributes':['securePassword']})[_0xc98f('0x1c')](respondWithResult(_0x487058,null))[_0xc98f('0x26')](handleError(_0x487058,null));};exports[_0xc98f('0x6e')]=function(_0x55ab47,_0xf34c14,_0x3ccb0a){if(_0x55ab47[_0xc98f('0x52')]&&_0x55ab47[_0xc98f('0x52')]['filename']){_0x55ab47[_0xc98f('0x4f')][_0xc98f('0x6f')]=_0x55ab47['file'][_0xc98f('0x54')];}return db[_0xc98f('0x36')]['find']({'where':{'id':_0x55ab47[_0xc98f('0x4c')]['id']}})[_0xc98f('0x1c')](handleEntityNotFound(_0xf34c14,null))[_0xc98f('0x1c')](saveUpdates(_0x55ab47['body'],null))[_0xc98f('0x1c')](respondWithResult(_0xf34c14,null))[_0xc98f('0x26')](handleError(_0xf34c14,null));};var utilLicense=require(_0xc98f('0x17'));exports[_0xc98f('0x70')]=function(_0x41bf7c,_0x30bd43,_0x3a1c99){var _0x32e480=_0xc98f('0x57');var _0xb43a79={'custom':![]};return utilLicense['getLicense']()[_0xc98f('0x1c')](function(_0x476d1d){if(_0x476d1d){_0xb43a79=_0x476d1d;}return db[_0xc98f('0x36')][_0xc98f('0x50')]({'where':{'id':_0x41bf7c[_0xc98f('0x4c')]['id']},'attributes':[_0xc98f('0x53'),'loginLogo',_0xc98f('0x6f'),_0xc98f('0x68'),_0xc98f('0x5a'),'defaultLoginLogo','defaultPreferred',_0xc98f('0x5d')],'raw':!![]});})[_0xc98f('0x1c')](handleEntityNotFound(_0x30bd43,null))[_0xc98f('0x1c')](function(_0x11599a){if(_0x11599a){var _0x6ac0fb=_0x11599a[_0xc98f('0x6f')]&&fs[_0xc98f('0x64')](path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x32e480,_[_0xc98f('0x60')](_0x11599a[_0xc98f('0x6f')])))?path['join'](config[_0xc98f('0x5f')],_0x32e480,_[_0xc98f('0x60')](_0x11599a[_0xc98f('0x6f')])):path['join'](config[_0xc98f('0x5f')],_0x32e480,_[_0xc98f('0x60')]('default_preferred.png'));var _0xf5d515='default'+_[_0xc98f('0x65')](_0xc98f('0x6f'));if(_0x11599a[_0xf5d515]||!_0xb43a79[_0xc98f('0x63')]||!_0xb43a79['preferred']){_0x6ac0fb=path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x32e480,_[_0xc98f('0x60')](_0xc98f('0x71')));}if(!fs[_0xc98f('0x64')](_0x6ac0fb)){throw new db[(_0xc98f('0x6a'))][(_0xc98f('0x6b'))](_[_0xc98f('0x65')](_0xc98f('0x6f'))+_0xc98f('0x6c'));}return _0x30bd43[_0xc98f('0x66')](_0x6ac0fb);}})[_0xc98f('0x26')](handleError(_0x30bd43,null));};exports['addFavicon']=function(_0x4b3687,_0x2b78e8,_0x1432d3){if(_0x4b3687['file']&&_0x4b3687[_0xc98f('0x52')][_0xc98f('0x54')]){_0x4b3687[_0xc98f('0x4f')]['favicon']=_0x4b3687['file'][_0xc98f('0x54')];}return db['Setting'][_0xc98f('0x50')]({'where':{'id':_0x4b3687['params']['id']}})[_0xc98f('0x1c')](handleEntityNotFound(_0x2b78e8,null))[_0xc98f('0x1c')](saveUpdates(_0x4b3687[_0xc98f('0x4f')],null))[_0xc98f('0x1c')](respondWithResult(_0x2b78e8,null))[_0xc98f('0x26')](handleError(_0x2b78e8,null));};var utilLicense=require('../../config/license/util');exports[_0xc98f('0x72')]=function(_0x489041,_0x113d7e,_0x39245c){var _0x304e9d=_0xc98f('0x57');var _0x5db438={'custom':![]};return utilLicense['getLicense']()[_0xc98f('0x1c')](function(_0x4fdcd2){if(_0x4fdcd2){_0x5db438=_0x4fdcd2;}return db[_0xc98f('0x36')][_0xc98f('0x50')]({'where':{'id':_0x489041[_0xc98f('0x4c')]['id']},'attributes':['logo',_0xc98f('0x59'),_0xc98f('0x6f'),'favicon',_0xc98f('0x5a'),'defaultLoginLogo',_0xc98f('0x5c'),_0xc98f('0x5d')],'raw':!![]});})[_0xc98f('0x1c')](handleEntityNotFound(_0x113d7e,null))['then'](function(_0x1bc997){if(_0x1bc997){var _0x4e8953=_0x1bc997[_0xc98f('0x68')]&&fs[_0xc98f('0x64')](path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x304e9d,_[_0xc98f('0x60')](_0x1bc997[_0xc98f('0x68')])))?path[_0xc98f('0x5e')](config['root'],_0x304e9d,_['toLower'](_0x1bc997[_0xc98f('0x68')])):path['join'](config['root'],_0x304e9d,_[_0xc98f('0x60')](_0xc98f('0x73')));var _0x54a3a3='default'+_[_0xc98f('0x65')]('favicon');if(_0x1bc997[_0x54a3a3]||!_0x5db438[_0xc98f('0x63')]){_0x4e8953=path['join'](config['root'],_0x304e9d,_['toLower']('default_favicon.ico'));}if(!fs[_0xc98f('0x64')](_0x4e8953)){throw new db[(_0xc98f('0x6a'))][(_0xc98f('0x6b'))](_[_0xc98f('0x65')](_0xc98f('0x68'))+_0xc98f('0x6c'));}return _0x113d7e['download'](_0x4e8953);}})['catch'](handleError(_0x113d7e,null));};exports[_0xc98f('0x74')]=function(_0x3a0f20,_0x426a58){var _0x1a975b={'offset':moment()[_0xc98f('0x75')]()};_0x1a975b[_0xc98f('0x76')]=moment()[_0xc98f('0x75')](_0x1a975b[_0xc98f('0x2b')])['format'](_0xc98f('0x77'));return _0x426a58[_0xc98f('0x28')](0xc8)['send'](_0x1a975b);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 649e60f..6947865 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(_0x35a33b,_0x2d5950){var _0x38888c=function(_0x334e60){while(--_0x334e60){_0x35a33b['push'](_0x35a33b['shift']());}};_0x38888c(++_0x2d5950);}(_0x34e8,0x12c));var _0x834e=function(_0x234aa8,_0x1d167e){_0x234aa8=_0x234aa8-0x0;var _0x36cae1=_0x34e8[_0x234aa8];return _0x36cae1;};'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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x30c226,_0xa58794){var _0x45de18=function(_0x2d8f76){while(--_0x2d8f76){_0x30c226['push'](_0x30c226['shift']());}};_0x45de18(++_0xa58794);}(_0xedd9,0xfc));var _0x9edd=function(_0x1d24ad,_0x57b05d){_0x1d24ad=_0x1d24ad-0x0;var _0xea3065=_0xedd9[_0x1d24ad];return _0xea3065;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index a0aae8c..1d902ac 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 _0xe1fb=['then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','map','include','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x216d80,_0x38cd26){var _0x20a066=function(_0x2e321c){while(--_0x2e321c){_0x216d80['push'](_0x216d80['shift']());}};_0x20a066(++_0x38cd26);}(_0xe1fb,0x78));var _0xbe1f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe1fb[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xbe1f('0x0'));var moment=require(_0xbe1f('0x1'));var BPromise=require(_0xbe1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe1f('0x3'));var db=require(_0xbe1f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe1f('0x5'))(_0xbe1f('0x6'));var config=require(_0xbe1f('0x7'));var jayson=require(_0xbe1f('0x8'));var client=jayson[_0xbe1f('0x9')][_0xbe1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x340e1d,_0xa93522,_0x3c169b){return new BPromise(function(_0x3e44e0,_0x3611d5){return client[_0xbe1f('0xb')](_0x340e1d,_0x3c169b)[_0xbe1f('0xc')](function(_0x54cd23){logger['info'](_0xbe1f('0xd'),_0xa93522,_0xbe1f('0xe'));logger[_0xbe1f('0xf')](_0xbe1f('0x10'),_0xa93522,'request\x20sent',JSON[_0xbe1f('0x11')](_0x54cd23));if(_0x54cd23[_0xbe1f('0x12')]){if(_0x54cd23[_0xbe1f('0x12')]['code']===0x1f4){logger[_0xbe1f('0x12')](_0xbe1f('0xd'),_0xa93522,_0x54cd23['error']['message']);return _0x3611d5(_0x54cd23[_0xbe1f('0x12')]['message']);}logger[_0xbe1f('0x12')]('Setting,\x20%s,\x20%s',_0xa93522,_0x54cd23[_0xbe1f('0x12')]['message']);return _0x3e44e0(_0x54cd23[_0xbe1f('0x12')][_0xbe1f('0x13')]);}else{logger[_0xbe1f('0x14')](_0xbe1f('0xd'),_0xa93522,_0xbe1f('0xe'));_0x3e44e0(_0x54cd23[_0xbe1f('0x15')][_0xbe1f('0x13')]);}})[_0xbe1f('0x16')](function(_0x4fe3ac){logger[_0xbe1f('0x12')](_0xbe1f('0xd'),_0xa93522,_0x4fe3ac);_0x3611d5(_0x4fe3ac);});});}exports[_0xbe1f('0x17')]=function(_0x35d01a){var _0x1df50f=this;return new Promise(function(_0x3d51d1,_0x4d36dc){return db[_0xbe1f('0x18')][_0xbe1f('0x19')]({'raw':_0x35d01a[_0xbe1f('0x1a')]?_0x35d01a[_0xbe1f('0x1a')][_0xbe1f('0x1b')]===undefined?!![]:![]:!![],'where':_0x35d01a[_0xbe1f('0x1a')]?_0x35d01a[_0xbe1f('0x1a')][_0xbe1f('0x1c')]||null:null,'attributes':_0x35d01a[_0xbe1f('0x1a')]?_0x35d01a[_0xbe1f('0x1a')][_0xbe1f('0x1d')]||null:null,'include':_0x35d01a[_0xbe1f('0x1a')]?_0x35d01a[_0xbe1f('0x1a')]['include']?_[_0xbe1f('0x1e')](_0x35d01a[_0xbe1f('0x1a')][_0xbe1f('0x1f')],function(_0x4a7bc2){return{'model':db[_0x4a7bc2[_0xbe1f('0x20')]],'as':_0x4a7bc2['as'],'attributes':_0x4a7bc2[_0xbe1f('0x1d')],'include':_0x4a7bc2[_0xbe1f('0x1f')]?_['map'](_0x4a7bc2[_0xbe1f('0x1f')],function(_0x127735){return{'model':db[_0x127735[_0xbe1f('0x20')]],'as':_0x127735['as'],'attributes':_0x127735['attributes'],'include':_0x127735[_0xbe1f('0x1f')]?_['map'](_0x127735['include'],function(_0x20210f){return{'model':db[_0x20210f[_0xbe1f('0x20')]],'as':_0x20210f['as'],'attributes':_0x20210f[_0xbe1f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d03d9){logger['info']('ShowSetting',_0x35d01a);logger[_0xbe1f('0xf')]('ShowSetting',_0x35d01a,JSON['stringify'](_0x5d03d9));_0x3d51d1(_0x5d03d9);})[_0xbe1f('0x16')](function(_0x502dca){logger[_0xbe1f('0x12')]('ShowSetting',_0x502dca['message'],_0x35d01a);_0x4d36dc(_0x1df50f[_0xbe1f('0x12')](0x1f4,_0x502dca[_0xbe1f('0x13')]));});});}; \ No newline at end of file +var _0x21f3=['http','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','code','error','message','result','Setting','find','options','raw','where','attributes','include','model','map','ShowSetting','debug','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x310ca4,_0x195e91){var _0x303c6f=function(_0x53dbf2){while(--_0x53dbf2){_0x310ca4['push'](_0x310ca4['shift']());}};_0x303c6f(++_0x195e91);}(_0x21f3,0x16a));var _0x321f=function(_0x1568a9,_0x52760c){_0x1568a9=_0x1568a9-0x0;var _0x4a120e=_0x21f3[_0x1568a9];return _0x4a120e;};'use strict';var _=require(_0x321f('0x0'));var util=require(_0x321f('0x1'));var moment=require(_0x321f('0x2'));var BPromise=require('bluebird');var rs=require(_0x321f('0x3'));var fs=require('fs');var Redis=require(_0x321f('0x4'));var db=require(_0x321f('0x5'))['db'];var utils=require(_0x321f('0x6'));var logger=require(_0x321f('0x7'))(_0x321f('0x8'));var config=require(_0x321f('0x9'));var jayson=require(_0x321f('0xa'));var client=jayson[_0x321f('0xb')][_0x321f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7ee3cd,_0x3e8da6,_0x6ca187){return new BPromise(function(_0x39efbd,_0x35e0ce){return client['request'](_0x7ee3cd,_0x6ca187)['then'](function(_0x173eb7){logger[_0x321f('0xd')](_0x321f('0xe'),_0x3e8da6,_0x321f('0xf'));logger['debug'](_0x321f('0x10'),_0x3e8da6,_0x321f('0xf'),JSON['stringify'](_0x173eb7));if(_0x173eb7['error']){if(_0x173eb7['error'][_0x321f('0x11')]===0x1f4){logger[_0x321f('0x12')](_0x321f('0xe'),_0x3e8da6,_0x173eb7[_0x321f('0x12')]['message']);return _0x35e0ce(_0x173eb7[_0x321f('0x12')][_0x321f('0x13')]);}logger['error']('Setting,\x20%s,\x20%s',_0x3e8da6,_0x173eb7['error'][_0x321f('0x13')]);return _0x39efbd(_0x173eb7[_0x321f('0x12')][_0x321f('0x13')]);}else{logger[_0x321f('0xd')](_0x321f('0xe'),_0x3e8da6,_0x321f('0xf'));_0x39efbd(_0x173eb7[_0x321f('0x14')][_0x321f('0x13')]);}})['catch'](function(_0x7bdc94){logger[_0x321f('0x12')](_0x321f('0xe'),_0x3e8da6,_0x7bdc94);_0x35e0ce(_0x7bdc94);});});}exports['ShowSetting']=function(_0x5b6d60){var _0x34d0c3=this;return new Promise(function(_0x47295f,_0x186a6a){return db[_0x321f('0x15')][_0x321f('0x16')]({'raw':_0x5b6d60[_0x321f('0x17')]?_0x5b6d60['options'][_0x321f('0x18')]===undefined?!![]:![]:!![],'where':_0x5b6d60['options']?_0x5b6d60[_0x321f('0x17')][_0x321f('0x19')]||null:null,'attributes':_0x5b6d60['options']?_0x5b6d60[_0x321f('0x17')][_0x321f('0x1a')]||null:null,'include':_0x5b6d60['options']?_0x5b6d60[_0x321f('0x17')][_0x321f('0x1b')]?_['map'](_0x5b6d60[_0x321f('0x17')][_0x321f('0x1b')],function(_0x3c53b2){return{'model':db[_0x3c53b2[_0x321f('0x1c')]],'as':_0x3c53b2['as'],'attributes':_0x3c53b2[_0x321f('0x1a')],'include':_0x3c53b2[_0x321f('0x1b')]?_[_0x321f('0x1d')](_0x3c53b2[_0x321f('0x1b')],function(_0x53f413){return{'model':db[_0x53f413[_0x321f('0x1c')]],'as':_0x53f413['as'],'attributes':_0x53f413[_0x321f('0x1a')],'include':_0x53f413[_0x321f('0x1b')]?_[_0x321f('0x1d')](_0x53f413[_0x321f('0x1b')],function(_0xe7aaa2){return{'model':db[_0xe7aaa2['model']],'as':_0xe7aaa2['as'],'attributes':_0xe7aaa2[_0x321f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe48880){logger['info'](_0x321f('0x1e'),_0x5b6d60);logger[_0x321f('0x1f')](_0x321f('0x1e'),_0x5b6d60,JSON[_0x321f('0x20')](_0xe48880));_0x47295f(_0xe48880);})[_0x321f('0x21')](function(_0x2170e0){logger[_0x321f('0x12')]('ShowSetting',_0x2170e0[_0x321f('0x13')],_0x5b6d60);_0x186a6a(_0x34d0c3[_0x321f('0x12')](0x1f4,_0x2170e0[_0x321f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index fb25861..8e76404 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x5db37b,_0x5ad772){var _0x98dcf5=function(_0xbaf702){while(--_0xbaf702){_0x5db37b['push'](_0x5db37b['shift']());}};_0x98dcf5(++_0x5ad772);}(_0x7a54,0x106));var _0x47a5=function(_0x4f1e22,_0x4619bb){_0x4f1e22=_0x4f1e22-0x0;var _0x48b5a9=_0x7a54[_0x4f1e22];return _0x48b5a9;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x191f56,_0x5678e0){var _0x49010c=function(_0x17ed88){while(--_0x17ed88){_0x191f56['push'](_0x191f56['shift']());}};_0x49010c(++_0x5678e0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index c5ea5c3..ef68719 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 _0xb87c=['STRING','name','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xb87c,0x8d));var _0xcb87=function(_0x4a1aa1,_0x23b2ea){_0x4a1aa1=_0x4a1aa1-0x0;var _0x1ada1d=_0xb87c[_0x4a1aa1];return _0x1ada1d;};'use strict';var Sequelize=require(_0xcb87('0x0'));var rs=require(_0xcb87('0x1'));module[_0xcb87('0x2')]={'name':{'type':Sequelize[_0xcb87('0x3')],'unique':_0xcb87('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xcb87('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xcb87('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xcb87('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xcb87('0x3')]},'type':{'type':Sequelize[_0xcb87('0x5')](_0xcb87('0x6'),_0xcb87('0x7'),_0xcb87('0x8'),_0xcb87('0x9'),_0xcb87('0xa'),_0xcb87('0xb'),_0xcb87('0xc'),_0xcb87('0xd'),_0xcb87('0xe'),'intelepeer')},'accountSid':{'type':Sequelize[_0xcb87('0x3')]},'authId':{'type':Sequelize[_0xcb87('0x3')]},'authToken':{'type':Sequelize[_0xcb87('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xcb87('0x3')]},'apiKey':{'type':Sequelize[_0xcb87('0x3')]},'applicationId':{'type':Sequelize[_0xcb87('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xcb87('0x3')]},'deliveryReport':{'type':Sequelize[_0xcb87('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xcb87('0x3')]},'notificationTemplate':{'type':Sequelize[_0xcb87('0x10')],'defaultValue':function(){return _0xcb87('0x11');}},'notificationSound':{'type':Sequelize[_0xcb87('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcb87('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcb87('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcb87('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xcb87('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcb87('0x12')],'comment':_0xcb87('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xcb87('0xf')],'defaultValue':![],'comment':_0xcb87('0x14'),'set':function(_0x3159a5){if(!_0x3159a5)this[_0xcb87('0x15')](_0xcb87('0x16'),null);this[_0xcb87('0x15')](_0xcb87('0x17'),_0x3159a5);}}}; \ No newline at end of file +var _0x88c8=['randomstring','exports','STRING','name','twilio','skebby','connectel','clicksend','clickatell','bandwidth','ENUM','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x49f750,_0x3e8052){var _0x5d0fea=function(_0xd7a2ee){while(--_0xd7a2ee){_0x49f750['push'](_0x49f750['shift']());}};_0x5d0fea(++_0x3e8052);}(_0x88c8,0xee));var _0x888c=function(_0x16261b,_0x87ab5){_0x16261b=_0x16261b-0x0;var _0x1a6706=_0x88c8[_0x16261b];return _0x1a6706;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x888c('0x0'));module[_0x888c('0x1')]={'name':{'type':Sequelize[_0x888c('0x2')],'unique':_0x888c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x888c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x888c('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x888c('0x2')]},'type':{'type':Sequelize['ENUM'](_0x888c('0x4'),_0x888c('0x5'),_0x888c('0x6'),_0x888c('0x7'),'plivo',_0x888c('0x8'),_0x888c('0x9'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x888c('0x2')]},'authId':{'type':Sequelize[_0x888c('0x2')]},'authToken':{'type':Sequelize[_0x888c('0x2')]},'smsMethod':{'type':Sequelize[_0x888c('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0x888c('0x2')]},'password':{'type':Sequelize[_0x888c('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x888c('0x2')]},'accountId':{'type':Sequelize[_0x888c('0x2')]},'senderString':{'type':Sequelize[_0x888c('0x2')]},'deliveryReport':{'type':Sequelize[_0x888c('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x888c('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x888c('0xc');}},'notificationSound':{'type':Sequelize[_0x888c('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x888c('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x888c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x888c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x888c('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x888c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x888c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x888c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x888c('0xd')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x888c('0xb')],'defaultValue':![],'comment':_0x888c('0xe'),'set':function(_0x37b150){if(!_0x37b150)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x888c('0xf')](_0x888c('0x10'),_0x37b150);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index d8edd15..c67866e 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 _0x8bbb=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','order','sort','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','Body','messageId','sender','text','message_id','MessageUUID','infobip','results','csc','fromNumber','replyMessageId','bandwidth','intelepeer','ValidationError','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','DESC','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','Start','startRouting','receiveMessage','info','entity\x20found','Content-Type','text/xml','send','\x0a','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','json','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','rows','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','clickatell','redif','skebby','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','type','model','map'];(function(_0x4b6b2a,_0x5d0713){var _0x33264d=function(_0x2bdf25){while(--_0x2bdf25){_0x4b6b2a['push'](_0x4b6b2a['shift']());}};_0x33264d(++_0x5d0713);}(_0x8bbb,0x180));var _0xb8bb=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0x8bbb[_0x28669c];return _0x4a3af6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb8bb('0x0'));var zipdir=require(_0xb8bb('0x1'));var jsonpatch=require(_0xb8bb('0x2'));var rp=require('request-promise');var moment=require(_0xb8bb('0x3'));var BPromise=require(_0xb8bb('0x4'));var Mustache=require(_0xb8bb('0x5'));var util=require('util');var path=require(_0xb8bb('0x6'));var sox=require('sox');var csv=require(_0xb8bb('0x7'));var ejs=require(_0xb8bb('0x8'));var fs=require('fs');var fs_extra=require(_0xb8bb('0x9'));var _=require(_0xb8bb('0xa'));var squel=require(_0xb8bb('0xb'));var crypto=require(_0xb8bb('0xc'));var jsforce=require(_0xb8bb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb8bb('0x7'));var querystring=require(_0xb8bb('0xe'));var Papa=require(_0xb8bb('0xf'));var Redis=require(_0xb8bb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb8bb('0x11'));var as=require(_0xb8bb('0x12'));var hardwareService=require(_0xb8bb('0x13'));var logger=require(_0xb8bb('0x14'))('api');var utils=require(_0xb8bb('0x15'));var config=require(_0xb8bb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb8bb('0x17'))['db'];config['redis']=_[_0xb8bb('0x18')](config[_0xb8bb('0x19')],{'host':_0xb8bb('0x1a'),'port':0x18eb});var socket=require(_0xb8bb('0x1b'))(new Redis(config['redis']));require(_0xb8bb('0x1c'))['register'](socket);var jayson=require(_0xb8bb('0x1d'));var client=jayson[_0xb8bb('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4c9f2e,_0x44a132,_0xe9a9,_0x5ebaf5){return new BPromise(function(_0x2fd1b4,_0x59f5b4){var _0x27320a=_0x5ebaf5||client;return _0x27320a['request'](_0x4c9f2e,_0xe9a9)[_0xb8bb('0x1f')](function(_0x976736){logger['info']('SmsAccount,\x20%s,\x20%s',_0x44a132,_0xb8bb('0x20'));logger[_0xb8bb('0x21')](_0xb8bb('0x22'),_0x44a132,_0xb8bb('0x20'),JSON[_0xb8bb('0x23')](_0x976736));if(_0x976736[_0xb8bb('0x24')]){if(_0x976736[_0xb8bb('0x24')][_0xb8bb('0x25')]===0x1f4){logger[_0xb8bb('0x24')](_0xb8bb('0x26'),_0x44a132,_0x976736[_0xb8bb('0x24')][_0xb8bb('0x27')]);return _0x59f5b4(_0x976736[_0xb8bb('0x24')][_0xb8bb('0x27')]);}logger[_0xb8bb('0x24')](_0xb8bb('0x26'),_0x44a132,_0x976736['error']['message']);return _0x2fd1b4(_0x976736[_0xb8bb('0x24')][_0xb8bb('0x27')]);}else{logger['info'](_0xb8bb('0x26'),_0x44a132,_0xb8bb('0x20'));_0x2fd1b4(_0x976736['result'][_0xb8bb('0x27')]);}})['catch'](function(_0x4794d2){logger[_0xb8bb('0x24')]('SmsAccount,\x20%s,\x20%s',_0x44a132,_0x4794d2);_0x59f5b4(_0x4794d2);});});}function respondWithStatusCode(_0x35bc2c,_0x3ffa24){_0x3ffa24=_0x3ffa24||0xcc;return function(_0x13e812){if(_0x13e812){return _0x35bc2c[_0xb8bb('0x28')](_0x3ffa24);}return _0x35bc2c[_0xb8bb('0x29')](_0x3ffa24)[_0xb8bb('0x2a')]();};}function respondWithResult(_0x34f2d8,_0x507864){_0x507864=_0x507864||0xc8;return function(_0x398b0f){if(_0x398b0f){return _0x34f2d8['status'](_0x507864)['json'](_0x398b0f);}};}function respondWithFilteredResult(_0x1c2407,_0xb8a44d){return function(_0x3e3202){if(_0x3e3202){var _0x503767=typeof _0xb8a44d[_0xb8bb('0x2b')]==='undefined'&&typeof _0xb8a44d['limit']===_0xb8bb('0x2c');var _0x499be2=_0x3e3202[_0xb8bb('0x2d')];var _0x2de526=_0x503767?0x0:_0xb8a44d[_0xb8bb('0x2b')];var _0x20b6aa=_0x503767?_0x3e3202[_0xb8bb('0x2d')]:_0xb8a44d[_0xb8bb('0x2b')]+_0xb8a44d[_0xb8bb('0x2e')];var _0x2d231a;if(_0x20b6aa>=_0x499be2){_0x20b6aa=_0x499be2;_0x2d231a=0xc8;}else{_0x2d231a=0xce;}_0x1c2407[_0xb8bb('0x29')](_0x2d231a);return _0x1c2407[_0xb8bb('0x2f')]('Content-Range',_0x2de526+'-'+_0x20b6aa+'/'+_0x499be2)['json'](_0x3e3202);}return null;};}function patchUpdates(_0x4dca36){return function(_0x4207bc){try{jsonpatch[_0xb8bb('0x30')](_0x4207bc,_0x4dca36,!![]);}catch(_0x2464d0){return BPromise[_0xb8bb('0x31')](_0x2464d0);}return _0x4207bc[_0xb8bb('0x32')]();};}function saveUpdates(_0x2e17b7,_0x3fcf00){return function(_0x5c50e8){if(_0x5c50e8){return _0x5c50e8[_0xb8bb('0x33')](_0x2e17b7)[_0xb8bb('0x1f')](function(_0x4cbb2d){return _0x4cbb2d;});}return null;};}function removeEntity(_0x3584f8,_0x2f62ae){return function(_0x2fcf49){if(_0x2fcf49){return _0x2fcf49[_0xb8bb('0x34')]()[_0xb8bb('0x1f')](function(){var _0x1ee38f=_0x2fcf49[_0xb8bb('0x35')]({'plain':!![]});var _0x17fa65=_0xb8bb('0x36');return db[_0xb8bb('0x37')][_0xb8bb('0x34')]({'where':{'type':_0x17fa65,'resourceId':_0x1ee38f['id']}})['then'](function(){return _0x2fcf49;});})[_0xb8bb('0x1f')](function(){_0x3584f8[_0xb8bb('0x29')](0xcc)[_0xb8bb('0x2a')]();});}};}function handleEntityNotFound(_0x257a2a,_0x596052){return function(_0x2f12b2){if(!_0x2f12b2){_0x257a2a[_0xb8bb('0x28')](0x194);}return _0x2f12b2;};}function handleError(_0x551583,_0x274e41){_0x274e41=_0x274e41||0x1f4;return function(_0x5ea0e2){logger[_0xb8bb('0x24')](_0x5ea0e2[_0xb8bb('0x38')]);if(_0x5ea0e2[_0xb8bb('0x39')]){delete _0x5ea0e2[_0xb8bb('0x39')];}_0x551583[_0xb8bb('0x29')](_0x274e41)['send'](_0x5ea0e2);};}exports[_0xb8bb('0x3a')]=function(_0xb9c716,_0x35a1fe){var _0xe2f6fe={'include':[{'model':db[_0xb8bb('0x3b')],'as':_0xb8bb('0x3c')}]},_0x218c7f={},_0x447e78={'count':0x0,'rows':[]};var _0x7d9c08=_['map'](db[_0xb8bb('0x3d')][_0xb8bb('0x3e')],function(_0x1bdef2){return{'name':_0x1bdef2['fieldName'],'type':_0x1bdef2[_0xb8bb('0x3f')]['key']};});_0x218c7f[_0xb8bb('0x40')]=_[_0xb8bb('0x41')](_0x7d9c08,_0xb8bb('0x39'));_0x218c7f['query']=_[_0xb8bb('0x42')](_0xb9c716[_0xb8bb('0x43')]);_0x218c7f[_0xb8bb('0x44')]=_[_0xb8bb('0x45')](_0x218c7f['model'],_0x218c7f[_0xb8bb('0x43')]);_0xe2f6fe[_0xb8bb('0x46')]=_[_0xb8bb('0x45')](_0x218c7f['model'],qs[_0xb8bb('0x47')](_0xb9c716['query'][_0xb8bb('0x47')]));_0xe2f6fe[_0xb8bb('0x46')]=_0xe2f6fe[_0xb8bb('0x46')][_0xb8bb('0x48')]?_0xe2f6fe[_0xb8bb('0x46')]:_0x218c7f[_0xb8bb('0x40')];if(!_0xb9c716[_0xb8bb('0x43')][_0xb8bb('0x49')]('nolimit')){_0xe2f6fe[_0xb8bb('0x2e')]=qs['limit'](_0xb9c716[_0xb8bb('0x43')][_0xb8bb('0x2e')]);_0xe2f6fe[_0xb8bb('0x2b')]=qs[_0xb8bb('0x2b')](_0xb9c716['query'][_0xb8bb('0x2b')]);}_0xe2f6fe['order']=qs['sort'](_0xb9c716[_0xb8bb('0x43')]['sort']);_0xe2f6fe[_0xb8bb('0x4a')]=qs[_0xb8bb('0x44')](_[_0xb8bb('0x4b')](_0xb9c716['query'],_0x218c7f[_0xb8bb('0x44')]),_0x7d9c08);if(_0xb9c716[_0xb8bb('0x43')][_0xb8bb('0x4c')]){_0xe2f6fe[_0xb8bb('0x4a')]=_[_0xb8bb('0x4d')](_0xe2f6fe['where'],{'$or':_[_0xb8bb('0x41')](_0x7d9c08,function(_0x5390b7){if(_0x5390b7[_0xb8bb('0x3f')]!=='VIRTUAL'){var _0x4f1f63={};_0x4f1f63[_0x5390b7[_0xb8bb('0x39')]]={'$like':'%'+_0xb9c716[_0xb8bb('0x43')]['filter']+'%'};return _0x4f1f63;}})});}_0xe2f6fe=_['merge']({},_0xe2f6fe,_0xb9c716[_0xb8bb('0x4e')]);var _0x936d17={'where':_0xe2f6fe[_0xb8bb('0x4a')]};return db['SmsAccount'][_0xb8bb('0x2d')](_0x936d17)[_0xb8bb('0x1f')](function(_0x34c4b8){_0x447e78[_0xb8bb('0x2d')]=_0x34c4b8;if(_0xb9c716[_0xb8bb('0x43')][_0xb8bb('0x4f')]){_0xe2f6fe[_0xb8bb('0x50')]=[{'all':!![]}];}return db[_0xb8bb('0x3d')][_0xb8bb('0x51')](_0xe2f6fe);})[_0xb8bb('0x1f')](function(_0x2a63c0){_0x447e78['rows']=_0x2a63c0;return _0x447e78;})[_0xb8bb('0x1f')](respondWithFilteredResult(_0x35a1fe,_0xe2f6fe))[_0xb8bb('0x52')](handleError(_0x35a1fe,null));};exports[_0xb8bb('0x53')]=function(_0x1e20d3,_0x443443){var _0xd8fee={'raw':![],'where':{'id':_0x1e20d3[_0xb8bb('0x54')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4f613d={};_0x4f613d['model']=_[_0xb8bb('0x42')](db[_0xb8bb('0x3d')][_0xb8bb('0x3e')]);_0x4f613d[_0xb8bb('0x43')]=_[_0xb8bb('0x42')](_0x1e20d3['query']);_0x4f613d[_0xb8bb('0x44')]=_[_0xb8bb('0x45')](_0x4f613d['model'],_0x4f613d[_0xb8bb('0x43')]);_0xd8fee['attributes']=_[_0xb8bb('0x45')](_0x4f613d[_0xb8bb('0x40')],qs[_0xb8bb('0x47')](_0x1e20d3[_0xb8bb('0x43')][_0xb8bb('0x47')]));_0xd8fee[_0xb8bb('0x46')]=_0xd8fee[_0xb8bb('0x46')][_0xb8bb('0x48')]?_0xd8fee[_0xb8bb('0x46')]:_0x4f613d['model'];if(_0x1e20d3[_0xb8bb('0x43')][_0xb8bb('0x4f')]){_0xd8fee[_0xb8bb('0x50')]=[{'all':!![]}];}_0xd8fee=_[_0xb8bb('0x4d')]({},_0xd8fee,_0x1e20d3[_0xb8bb('0x4e')]);return db[_0xb8bb('0x3d')][_0xb8bb('0x55')](_0xd8fee)['then'](handleEntityNotFound(_0x443443,null))[_0xb8bb('0x1f')](respondWithResult(_0x443443,null))[_0xb8bb('0x52')](handleError(_0x443443,null));};exports[_0xb8bb('0x56')]=function(_0x3e59d9,_0x166c9e){return db['SmsAccount'][_0xb8bb('0x56')](_0x3e59d9[_0xb8bb('0x57')],{})[_0xb8bb('0x1f')](function(_0x35841e){var _0x351924=_0x3e59d9[_0xb8bb('0x58')][_0xb8bb('0x35')]({'plain':!![]});if(!_0x351924)throw new Error(_0xb8bb('0x59'));if(_0x351924['role']===_0xb8bb('0x58')){var _0x5e11d6=_0x35841e[_0xb8bb('0x35')]({'plain':!![]});var _0x1597b6='SmsAccounts';return db['UserProfileSection'][_0xb8bb('0x55')]({'where':{'name':_0x1597b6,'userProfileId':_0x351924[_0xb8bb('0x5a')]},'raw':!![]})[_0xb8bb('0x1f')](function(_0x3f5513){if(_0x3f5513&&_0x3f5513[_0xb8bb('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e11d6[_0xb8bb('0x39')],'resourceId':_0x5e11d6['id'],'type':_0x3f5513['name'],'sectionId':_0x3f5513['id']},{})[_0xb8bb('0x1f')](function(){return _0x35841e;});}else{return _0x35841e;}})[_0xb8bb('0x52')](function(_0x11a5fc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11a5fc);throw _0x11a5fc;});}return _0x35841e;})[_0xb8bb('0x1f')](respondWithResult(_0x166c9e,0xc9))[_0xb8bb('0x52')](handleError(_0x166c9e,null));};exports[_0xb8bb('0x33')]=function(_0x1d54e8,_0x726ef){if(_0x1d54e8[_0xb8bb('0x57')]['id']){delete _0x1d54e8[_0xb8bb('0x57')]['id'];}return db[_0xb8bb('0x3d')][_0xb8bb('0x55')]({'where':{'id':_0x1d54e8[_0xb8bb('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0xb8bb('0x3c')}]})[_0xb8bb('0x1f')](handleEntityNotFound(_0x726ef,null))[_0xb8bb('0x1f')](saveUpdates(_0x1d54e8[_0xb8bb('0x57')],null))['then'](respondWithResult(_0x726ef,null))[_0xb8bb('0x52')](handleError(_0x726ef,null));};exports[_0xb8bb('0x34')]=function(_0x5bc66b,_0x890ab5){return db[_0xb8bb('0x3d')][_0xb8bb('0x55')]({'where':{'id':_0x5bc66b[_0xb8bb('0x54')]['id']}})['then'](handleEntityNotFound(_0x890ab5,null))[_0xb8bb('0x1f')](removeEntity(_0x890ab5,null))['catch'](handleError(_0x890ab5,null));};exports[_0xb8bb('0x5c')]=function(_0x335909,_0x5c9c0c){return db[_0xb8bb('0x3d')][_0xb8bb('0x5c')]()[_0xb8bb('0x1f')](respondWithResult(_0x5c9c0c,null))[_0xb8bb('0x52')](handleError(_0x5c9c0c,null));};exports[_0xb8bb('0x5d')]=function(_0x23ce2a,_0x338ab5,_0x19df41){if(_0x23ce2a[_0xb8bb('0x57')]['id']){delete _0x23ce2a[_0xb8bb('0x57')]['id'];}return db[_0xb8bb('0x3d')][_0xb8bb('0x55')]({'where':{'id':_0x23ce2a[_0xb8bb('0x54')]['id']}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x338ab5,null))[_0xb8bb('0x1f')](function(_0x4d74a5){if(_0x4d74a5){_0x23ce2a[_0xb8bb('0x57')][_0xb8bb('0x5e')]=_0x4d74a5['id'];return db[_0xb8bb('0x5f')][_0xb8bb('0x56')](_0x23ce2a['body']);}})[_0xb8bb('0x1f')](respondWithResult(_0x338ab5,null))['catch'](handleError(_0x338ab5,null));};exports[_0xb8bb('0x60')]=function(_0x2384b9,_0x201e7f,_0x17d182){var _0x1be5e3={'raw':![],'where':{}};var _0x21e619={};var _0x3ce685={'count':0x0,'rows':[]};return db['SmsAccount'][_0xb8bb('0x61')]({'where':{'id':_0x2384b9[_0xb8bb('0x54')]['id']}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x201e7f,null))[_0xb8bb('0x1f')](function(_0x1a79fd){if(_0x1a79fd){_0x21e619[_0xb8bb('0x40')]=_['keys'](db[_0xb8bb('0x5f')]['rawAttributes']);_0x21e619['query']=_['keys'](_0x2384b9[_0xb8bb('0x43')]);_0x21e619[_0xb8bb('0x44')]=_[_0xb8bb('0x45')](_0x21e619['model'],_0x21e619[_0xb8bb('0x43')]);_0x1be5e3[_0xb8bb('0x46')]=_[_0xb8bb('0x45')](_0x21e619[_0xb8bb('0x40')],qs[_0xb8bb('0x47')](_0x2384b9[_0xb8bb('0x43')][_0xb8bb('0x47')]));_0x1be5e3[_0xb8bb('0x46')]=_0x1be5e3[_0xb8bb('0x46')]['length']?_0x1be5e3[_0xb8bb('0x46')]:_0x21e619[_0xb8bb('0x40')];if(!_0x2384b9[_0xb8bb('0x43')][_0xb8bb('0x49')](_0xb8bb('0x62'))){_0x1be5e3[_0xb8bb('0x2e')]=qs[_0xb8bb('0x2e')](_0x2384b9['query'][_0xb8bb('0x2e')]);_0x1be5e3['offset']=qs['offset'](_0x2384b9[_0xb8bb('0x43')][_0xb8bb('0x2b')]);}_0x1be5e3[_0xb8bb('0x63')]=qs[_0xb8bb('0x64')](_0x2384b9[_0xb8bb('0x43')][_0xb8bb('0x64')]);_0x1be5e3[_0xb8bb('0x4a')]=qs[_0xb8bb('0x44')](_[_0xb8bb('0x4b')](_0x2384b9[_0xb8bb('0x43')],_0x21e619[_0xb8bb('0x44')]));_0x1be5e3[_0xb8bb('0x4a')][_0xb8bb('0x5e')]=_0x1a79fd['id'];if(_0x2384b9['query']['filter']){_0x1be5e3[_0xb8bb('0x4a')]=_[_0xb8bb('0x4d')](_0x1be5e3['where'],{'$or':_[_0xb8bb('0x41')](_0x1be5e3['attributes'],function(_0x45c237){var _0x14a2cd={};_0x14a2cd[_0x45c237]={'$like':'%'+_0x2384b9['query'][_0xb8bb('0x4c')]+'%'};return _0x14a2cd;})});}_0x1be5e3=_[_0xb8bb('0x4d')]({},_0x1be5e3,_0x2384b9[_0xb8bb('0x4e')]);return db['Disposition'][_0xb8bb('0x2d')]({'where':_0x1be5e3['where']})['then'](function(_0xa89466){_0x3ce685[_0xb8bb('0x2d')]=_0xa89466;if(_0x2384b9['query'][_0xb8bb('0x4f')]){_0x1be5e3[_0xb8bb('0x50')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1be5e3);})['then'](function(_0x1b44a2){_0x3ce685['rows']=_0x1b44a2;return _0x3ce685;});}})[_0xb8bb('0x1f')](respondWithFilteredResult(_0x201e7f,_0x1be5e3))[_0xb8bb('0x52')](handleError(_0x201e7f,null));};exports[_0xb8bb('0x65')]=function(_0x357866,_0x470875,_0x5ed09d){return db['SmsAccount'][_0xb8bb('0x55')]({'where':{'id':_0x357866[_0xb8bb('0x54')]['id']}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x470875,null))[_0xb8bb('0x1f')](function(_0x3b0399){if(_0x3b0399){return _0x3b0399[_0xb8bb('0x65')](_0x357866[_0xb8bb('0x43')][_0xb8bb('0x66')]);}})[_0xb8bb('0x1f')](respondWithStatusCode(_0x470875,null))[_0xb8bb('0x52')](handleError(_0x470875,null));};exports[_0xb8bb('0x67')]=function(_0x39deff,_0x4859df,_0x42580d){if(_0x39deff[_0xb8bb('0x57')]['id']){delete _0x39deff[_0xb8bb('0x57')]['id'];}return db[_0xb8bb('0x3d')][_0xb8bb('0x55')]({'where':{'id':_0x39deff[_0xb8bb('0x54')]['id']}})['then'](handleEntityNotFound(_0x4859df,null))[_0xb8bb('0x1f')](function(_0x495a6a){if(_0x495a6a){_0x39deff[_0xb8bb('0x57')]['SmsAccountId']=_0x495a6a['id'];return db['CannedAnswer']['create'](_0x39deff['body']);}})[_0xb8bb('0x1f')](respondWithResult(_0x4859df,null))[_0xb8bb('0x52')](handleError(_0x4859df,null));};exports[_0xb8bb('0x68')]=function(_0x29f729,_0x2a967d,_0x5ed2f8){var _0x17c5cd={'raw':![],'where':{}};var _0x253432={};var _0x5ed909={'count':0x0,'rows':[]};return db[_0xb8bb('0x3d')][_0xb8bb('0x61')]({'where':{'id':_0x29f729[_0xb8bb('0x54')]['id']}})['then'](handleEntityNotFound(_0x2a967d,null))[_0xb8bb('0x1f')](function(_0x7357df){if(_0x7357df){_0x253432[_0xb8bb('0x40')]=_[_0xb8bb('0x42')](db[_0xb8bb('0x69')][_0xb8bb('0x3e')]);_0x253432[_0xb8bb('0x43')]=_[_0xb8bb('0x42')](_0x29f729['query']);_0x253432['filters']=_[_0xb8bb('0x45')](_0x253432[_0xb8bb('0x40')],_0x253432[_0xb8bb('0x43')]);_0x17c5cd['attributes']=_[_0xb8bb('0x45')](_0x253432[_0xb8bb('0x40')],qs[_0xb8bb('0x47')](_0x29f729[_0xb8bb('0x43')][_0xb8bb('0x47')]));_0x17c5cd['attributes']=_0x17c5cd['attributes'][_0xb8bb('0x48')]?_0x17c5cd[_0xb8bb('0x46')]:_0x253432[_0xb8bb('0x40')];if(!_0x29f729[_0xb8bb('0x43')]['hasOwnProperty']('nolimit')){_0x17c5cd[_0xb8bb('0x2e')]=qs['limit'](_0x29f729[_0xb8bb('0x43')][_0xb8bb('0x2e')]);_0x17c5cd[_0xb8bb('0x2b')]=qs[_0xb8bb('0x2b')](_0x29f729[_0xb8bb('0x43')][_0xb8bb('0x2b')]);}_0x17c5cd[_0xb8bb('0x63')]=qs['sort'](_0x29f729[_0xb8bb('0x43')][_0xb8bb('0x64')]);_0x17c5cd[_0xb8bb('0x4a')]=qs[_0xb8bb('0x44')](_[_0xb8bb('0x4b')](_0x29f729[_0xb8bb('0x43')],_0x253432[_0xb8bb('0x44')]));_0x17c5cd[_0xb8bb('0x4a')][_0xb8bb('0x5e')]=_0x7357df['id'];if(_0x29f729['query']['filter']){_0x17c5cd['where']=_['merge'](_0x17c5cd[_0xb8bb('0x4a')],{'$or':_[_0xb8bb('0x41')](_0x17c5cd[_0xb8bb('0x46')],function(_0x4f8c41){var _0xed0d4d={};_0xed0d4d[_0x4f8c41]={'$like':'%'+_0x29f729[_0xb8bb('0x43')]['filter']+'%'};return _0xed0d4d;})});}_0x17c5cd=_[_0xb8bb('0x4d')]({},_0x17c5cd,_0x29f729[_0xb8bb('0x4e')]);return db['CannedAnswer'][_0xb8bb('0x2d')]({'where':_0x17c5cd[_0xb8bb('0x4a')]})[_0xb8bb('0x1f')](function(_0x59774e){_0x5ed909[_0xb8bb('0x2d')]=_0x59774e;if(_0x29f729[_0xb8bb('0x43')][_0xb8bb('0x4f')]){_0x17c5cd[_0xb8bb('0x50')]=[{'all':!![]}];}return db[_0xb8bb('0x69')][_0xb8bb('0x51')](_0x17c5cd);})[_0xb8bb('0x1f')](function(_0x234357){_0x5ed909['rows']=_0x234357;return _0x5ed909;});}})[_0xb8bb('0x1f')](respondWithFilteredResult(_0x2a967d,_0x17c5cd))[_0xb8bb('0x52')](handleError(_0x2a967d,null));};exports[_0xb8bb('0x6a')]=function(_0x574f26,_0x14c703,_0x168d3a){return db[_0xb8bb('0x3d')][_0xb8bb('0x55')]({'where':{'id':_0x574f26['params']['id']}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x14c703,null))['then'](function(_0x3f289b){if(_0x3f289b){return _0x3f289b[_0xb8bb('0x6a')](_0x574f26[_0xb8bb('0x43')][_0xb8bb('0x66')]);}})[_0xb8bb('0x1f')](respondWithStatusCode(_0x14c703,null))[_0xb8bb('0x52')](handleError(_0x14c703,null));};exports[_0xb8bb('0x6b')]=function(_0x29f3ba,_0x4f0085,_0x53f008){var _0x242080={'channel':_0xb8bb('0x6c')};var _0x163046=[];var _0x5b4b47=[];var _0x2827a0={};return db[_0xb8bb('0x3d')][_0xb8bb('0x55')]({'where':{'id':_0x29f3ba['params']['id']},'include':[{'model':db[_0xb8bb('0x6d')],'as':'Applications'}]})[_0xb8bb('0x1f')](handleEntityNotFound(_0x4f0085,null))[_0xb8bb('0x1f')](function(_0x2c38e3){_0x242080[_0xb8bb('0x6e')]=_0x2c38e3;_0x242080[_0xb8bb('0x6f')]=_[_0xb8bb('0x70')](_0x2c38e3[_0xb8bb('0x71')],[_0xb8bb('0x72')],['asc']);if(_0x242080[_0xb8bb('0x6e')]['Applications']){delete _0x242080[_0xb8bb('0x6e')]['Applications'];}return db[_0xb8bb('0x73')]['describe']();})['then'](function(_0x1a443e){if(!_0x1a443e){throw new db[(_0xb8bb('0x74'))]['ValidationError'](_0xb8bb('0x75'));}_0x163046=_[_0xb8bb('0x76')](_['keys'](_0x1a443e),[_0xb8bb('0x77'),'updatedAt']);_0x5b4b47=_[_0xb8bb('0x76')](_[_0xb8bb('0x42')](_0x1a443e),[_0xb8bb('0x77'),_0xb8bb('0x78'),_0xb8bb('0x79'),_0xb8bb('0x7a')]);_0x242080[_0xb8bb('0x57')]={'mapKey':'mobile'};if(_0x242080['account']['type']){switch(_0x242080[_0xb8bb('0x6e')][_0xb8bb('0x3f')]){case _0xb8bb('0x7b'):_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7c')]=_0x29f3ba[_0xb8bb('0x57')][_0xb8bb('0x7d')];_0x242080['body']['body']=_0x29f3ba['body'][_0xb8bb('0x7e')];_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7f')]=_0x29f3ba[_0xb8bb('0x57')]['MessageSid'];break;case'skebby':_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7c')]='+'+_0x29f3ba['body'][_0xb8bb('0x80')];_0x242080['body'][_0xb8bb('0x57')]=_0x29f3ba[_0xb8bb('0x57')][_0xb8bb('0x81')];break;case'connectel':_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7c')]=_0x29f3ba[_0xb8bb('0x57')][_0xb8bb('0x7c')];_0x242080[_0xb8bb('0x57')][_0xb8bb('0x57')]=_0x29f3ba['body'][_0xb8bb('0x27')];break;case'clicksend':_0x242080[_0xb8bb('0x57')]['from']=_0x29f3ba[_0xb8bb('0x57')]['from'];_0x242080[_0xb8bb('0x57')][_0xb8bb('0x57')]=_0x29f3ba[_0xb8bb('0x57')][_0xb8bb('0x57')];_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7f')]=_0x29f3ba['body'][_0xb8bb('0x82')];break;case'plivo':_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7c')]=_0x29f3ba[_0xb8bb('0x57')]['From'];_0x242080[_0xb8bb('0x57')][_0xb8bb('0x57')]=_0x29f3ba['body']['Text'];_0x242080['body']['messageId']=_0x29f3ba[_0xb8bb('0x57')][_0xb8bb('0x83')];break;case _0xb8bb('0x84'):_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7c')]='+'+_0x29f3ba['body']['results'][0x0][_0xb8bb('0x7c')];_0x242080[_0xb8bb('0x57')][_0xb8bb('0x57')]=_0x29f3ba[_0xb8bb('0x57')][_0xb8bb('0x85')][0x0][_0xb8bb('0x81')];_0x242080['body'][_0xb8bb('0x7f')]=_0x29f3ba[_0xb8bb('0x57')][_0xb8bb('0x85')][0x0]['messageId'];break;case _0xb8bb('0x86'):_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7c')]=_0x29f3ba[_0xb8bb('0x57')]['originatingAddress'];_0x242080[_0xb8bb('0x57')]['body']=_0x29f3ba[_0xb8bb('0x57')]['segmentedMessage'][_0xb8bb('0x27')];break;case'clickatell':_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7c')]=_0x29f3ba[_0xb8bb('0x57')][_0xb8bb('0x87')];_0x242080['body'][_0xb8bb('0x57')]=_0x29f3ba[_0xb8bb('0x57')][_0xb8bb('0x81')];_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7f')]=_0x29f3ba[_0xb8bb('0x57')][_0xb8bb('0x88')];break;case _0xb8bb('0x89'):_0x242080['body'][_0xb8bb('0x7f')]=_0x29f3ba['body'][0x0][_0xb8bb('0x27')]['id'];_0x242080[_0xb8bb('0x57')]['from']=_0x29f3ba[_0xb8bb('0x57')][0x0][_0xb8bb('0x27')][_0xb8bb('0x7c')];_0x242080['body']['body']=_0x29f3ba[_0xb8bb('0x57')][0x0][_0xb8bb('0x27')][_0xb8bb('0x81')];break;case _0xb8bb('0x8a'):_0x242080[_0xb8bb('0x57')]['from']=_0x29f3ba['body']['from'];_0x242080[_0xb8bb('0x57')][_0xb8bb('0x57')]=_0x29f3ba['body'][_0xb8bb('0x27')];_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7f')]=_0x29f3ba['body']['refid'];break;}}if(_0x242080[_0xb8bb('0x57')]['id']){delete _0x242080[_0xb8bb('0x57')]['id'];}if(_['isNil'](_0x242080[_0xb8bb('0x57')]['from'])){throw new db[(_0xb8bb('0x74'))][(_0xb8bb('0x8b'))](_0xb8bb('0x8c'));}if(_['isNil'](_0x242080[_0xb8bb('0x57')][_0xb8bb('0x57')])||_0x242080[_0xb8bb('0x57')][_0xb8bb('0x57')]===''){throw new db[(_0xb8bb('0x74'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb8bb('0x8d')](_0x242080[_0xb8bb('0x57')]['mapKey'])){throw new db[(_0xb8bb('0x74'))][(_0xb8bb('0x8b'))](_0xb8bb('0x8e')+_0x5b4b47);}if(!_[_0xb8bb('0x8f')](_0x5b4b47,_0x242080[_0xb8bb('0x57')][_0xb8bb('0x90')])){throw new db[(_0xb8bb('0x74'))][(_0xb8bb('0x8b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b4b47);}_0x2827a0[_0x242080[_0xb8bb('0x57')][_0xb8bb('0x90')]]=_0x242080[_0xb8bb('0x57')]['from'];return db[_0xb8bb('0x91')]['find']({'where':{'id':_0x242080['account'][_0xb8bb('0x7a')]},'include':[{'model':db[_0xb8bb('0x73')],'as':_0xb8bb('0x92'),'where':_0x2827a0,'limit':0x1,'order':[['updatedAt',_0xb8bb('0x93')]]}]});})[_0xb8bb('0x1f')](handleEntityNotFound(_0x4f0085,null))[_0xb8bb('0x1f')](function(_0x3d0c0d){if(_0x3d0c0d){_0x242080['list']=_['omit'](_0x3d0c0d,[_0xb8bb('0x92')]);if(_0x3d0c0d[_0xb8bb('0x92')][_0xb8bb('0x48')]){return _0x3d0c0d[_0xb8bb('0x92')][0x0];}var _0x4fa70b=_[_0xb8bb('0x18')](_0x242080[_0xb8bb('0x57')],{'firstName':_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7c')],'ListId':_0x3d0c0d['id']});_0x4fa70b[_0x242080[_0xb8bb('0x57')][_0xb8bb('0x90')]]=_0x242080['body'][_0xb8bb('0x7c')];return db[_0xb8bb('0x73')][_0xb8bb('0x56')](_0x4fa70b,{'fields':_0x163046,'raw':!![]});}})['then'](handleEntityNotFound(_0x4f0085,null))[_0xb8bb('0x1f')](function(_0x3554ca){if(_0x3554ca){_0x242080[_0xb8bb('0x94')]=_0x3554ca;var _0x5d5833={'ContactId':_0x3554ca['id'],'phone':_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7c')],'SmsAccountId':_0x29f3ba['params']['id']};var _0x4726bb={'ContactId':_0x3554ca['id'],'SmsAccountId':_0x29f3ba[_0xb8bb('0x54')]['id'],'closed':![]};return db[_0xb8bb('0x95')]['find']({'where':_0x4726bb})[_0xb8bb('0x1f')](function(_0x1c4f1b){if(_0x1c4f1b){return[_0x1c4f1b,![]];}return db[_0xb8bb('0x95')][_0xb8bb('0x56')](_0x5d5833)[_0xb8bb('0x1f')](function(_0x57e59b){return[_0x57e59b,!![]];});});}})[_0xb8bb('0x96')](function(_0x3fbce7,_0x23b129){_0x242080['interaction']=_0x3fbce7['get']({'plain':!![]});_0x242080[_0xb8bb('0x97')]['created']=![];if(_0x23b129){if(_0x242080[_0xb8bb('0x6e')][_0xb8bb('0x98')]){_0x242080[_0xb8bb('0x6f')][_0xb8bb('0x99')]({'id':0x0,'priority':_0x242080['applications']['length']+0x1,'app':_0xb8bb('0x9a'),'appdata':_0xb8bb('0x9b'),'interval':_0xb8bb('0x9c')});}_0x242080[_0xb8bb('0x97')][_0xb8bb('0x9d')]=!![];}return db[_0xb8bb('0x9e')][_0xb8bb('0x56')]({'phone':_0x242080['body'][_0xb8bb('0x7c')],'messageId':_0x242080[_0xb8bb('0x57')][_0xb8bb('0x7f')],'body':_0x242080[_0xb8bb('0x57')]['body'],'SmsAccountId':_0x29f3ba[_0xb8bb('0x54')]['id'],'SmsInteractionId':_0x3fbce7['id'],'direction':'in','ContactId':_0x3fbce7[_0xb8bb('0x9f')],'AttachmentId':_0x242080[_0xb8bb('0x57')][_0xb8bb('0xa0')]});})['then'](function(_0x541d25){_0x242080[_0xb8bb('0x27')]=_0x541d25;if(!_0x242080['interaction'][_0xb8bb('0xa1')])return;return db[_0xb8bb('0xa2')][_0xb8bb('0x55')]({'attributes':['id','name'],'where':{'id':_0x242080['interaction'][_0xb8bb('0xa1')]}});})[_0xb8bb('0x1f')](function(_0x271b3f){if(_0x271b3f){_0x242080[_0xb8bb('0x6f')][_0xb8bb('0xa3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x271b3f[_0xb8bb('0x39')]+','+(_0x242080[_0xb8bb('0x6e')][_0xb8bb('0xa4')]||0xa),'interval':'*,*,*,*'});}if(!_0x242080[_0xb8bb('0x97')][_0xb8bb('0xa5')])return;return db['SmsQueue'][_0xb8bb('0x55')]({'attributes':['id',_0xb8bb('0x39')],'where':{'id':_0x242080[_0xb8bb('0x97')][_0xb8bb('0xa5')]}});})[_0xb8bb('0x1f')](function(_0x1f552d){if(_0x1f552d){_0x242080[_0xb8bb('0x6f')][_0xb8bb('0xa3')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1f552d[_0xb8bb('0x39')]+','+(_0x242080[_0xb8bb('0x6e')]['waitForTheAssignedQueue']||0x12c),'interval':_0xb8bb('0x9c')});}return respondWithRpcPromise(_0xb8bb('0xa6'),_0xb8bb('0xa7'),_0x242080);})['then'](function(_0x2e52e6){if(_0x2e52e6){var _0x1c98d7=0xc8;var _0x4526a8=_0xb8bb('0xa8');logger[_0xb8bb('0xa9')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4526a8,_0x1c98d7,_0xb8bb('0xaa'));logger[_0xb8bb('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4526a8,_0x1c98d7,_0xb8bb('0xaa'),JSON[_0xb8bb('0x23')](_0x2e52e6));if(_0x242080[_0xb8bb('0x6e')][_0xb8bb('0x3f')]===_0xb8bb('0x7b')){return _0x4f0085[_0xb8bb('0x29')](_0x1c98d7)[_0xb8bb('0x2f')](_0xb8bb('0xab'),_0xb8bb('0xac'))[_0xb8bb('0xad')](_0xb8bb('0xae'));}else{return _0x4f0085[_0xb8bb('0x29')](_0x1c98d7)['json'](_0x2e52e6);}}})[_0xb8bb('0x52')](handleError(_0x4f0085,null));};exports[_0xb8bb('0xaf')]=function(_0x9a64d1,_0x8620ac){var _0x2b7084=_0x9a64d1[_0xb8bb('0x54')]['id'];var _0x3adf82=_0x9a64d1[_0xb8bb('0x57')];var _0x57c0e9=0xc8;var _0x56cc1c=null;return db['sequelize'][_0xb8bb('0xb0')]({'isolationLevel':db['sequelize'][_0xb8bb('0xb1')][_0xb8bb('0xb2')][_0xb8bb('0xb3')]},function(_0x29f276){return db[_0xb8bb('0x3d')][_0xb8bb('0x61')]({'where':{'id':_0x2b7084},'transaction':_0x29f276})[_0xb8bb('0x1f')](function(_0xbb4c36){if(_0xbb4c36){return db[_0xb8bb('0x6d')][_0xb8bb('0x34')]({'where':{'SmsAccountId':_0x2b7084},'transaction':_0x29f276})[_0xb8bb('0x1f')](function(){var _0x54615c=_[_0xb8bb('0x41')](_0x3adf82,function(_0x440dcd){_0x440dcd['SmsAccountId']=_0x2b7084;return _0x440dcd;});return db[_0xb8bb('0x6d')][_0xb8bb('0xb4')](_0x54615c,{'transaction':_0x29f276});});}else{_0x57c0e9=0x194;_0x56cc1c=[];}});})[_0xb8bb('0x1f')](function(){if(_0x57c0e9!==0x194){return db[_0xb8bb('0x6d')][_0xb8bb('0xb5')]({'where':{'SmsAccountId':_0x2b7084},'order':'priority'})['then'](function(_0x52cb3e){_0x56cc1c=_0x52cb3e;});}})[_0xb8bb('0x52')](function(_0x3713e0){_0x57c0e9=0x1f4;logger['error'](_0x3713e0[_0xb8bb('0x38')]);if(_0x3713e0[_0xb8bb('0x39')]){delete _0x3713e0[_0xb8bb('0x39')];}_0x56cc1c=_0x3713e0;})[_0xb8bb('0xb6')](function(){if(_0x56cc1c===null){_0x8620ac[_0xb8bb('0x28')](_0x57c0e9);}else{if(_0x57c0e9===0x1f4){_0x8620ac['status'](_0x57c0e9)[_0xb8bb('0xad')](_0x56cc1c);}else{_0x8620ac[_0xb8bb('0x29')](_0x57c0e9)[_0xb8bb('0xb7')](_0x56cc1c);}}});};exports[_0xb8bb('0xb8')]=function(_0x22610c,_0x1ef14b,_0x476eea){var _0x850c7a={};var _0x51f2f0={};var _0x41d9d1;var _0x82ea62;return db[_0xb8bb('0x3d')][_0xb8bb('0x61')]({'where':{'id':_0x22610c[_0xb8bb('0x54')]['id']}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x1ef14b,null))[_0xb8bb('0x1f')](function(_0x1f1fd8){if(_0x1f1fd8){_0x41d9d1=_0x1f1fd8;_0x51f2f0['model']=_[_0xb8bb('0x42')](db['SmsApplication'][_0xb8bb('0x3e')]);_0x51f2f0[_0xb8bb('0x43')]=_['keys'](_0x22610c['query']);_0x51f2f0[_0xb8bb('0x44')]=_[_0xb8bb('0x45')](_0x51f2f0[_0xb8bb('0x40')],_0x51f2f0[_0xb8bb('0x43')]);_0x850c7a[_0xb8bb('0x46')]=_['intersection'](_0x51f2f0[_0xb8bb('0x40')],qs[_0xb8bb('0x47')](_0x22610c[_0xb8bb('0x43')]['fields']));_0x850c7a['attributes']=_0x850c7a['attributes']['length']?_0x850c7a[_0xb8bb('0x46')]:_0x51f2f0[_0xb8bb('0x40')];_0x850c7a[_0xb8bb('0x63')]=qs[_0xb8bb('0x64')](_0x22610c[_0xb8bb('0x43')][_0xb8bb('0x64')]);_0x850c7a[_0xb8bb('0x4a')]=qs[_0xb8bb('0x44')](_[_0xb8bb('0x4b')](_0x22610c[_0xb8bb('0x43')],_0x51f2f0['filters']));if(_0x22610c[_0xb8bb('0x43')][_0xb8bb('0x4c')]){_0x850c7a[_0xb8bb('0x4a')]=_[_0xb8bb('0x4d')](_0x850c7a[_0xb8bb('0x4a')],{'$or':_['map'](_0x850c7a[_0xb8bb('0x46')],function(_0x4a3d01){var _0x30e8b5={};_0x30e8b5[_0x4a3d01]={'$like':'%'+_0x22610c['query'][_0xb8bb('0x4c')]+'%'};return _0x30e8b5;})});}_0x850c7a=_[_0xb8bb('0x4d')]({},_0x850c7a,_0x22610c[_0xb8bb('0x4e')]);return _0x41d9d1[_0xb8bb('0xb8')](_0x850c7a);}})[_0xb8bb('0x1f')](function(_0x5ab2f1){if(_0x5ab2f1){_0x82ea62=_0x5ab2f1[_0xb8bb('0x48')];if(!_0x22610c[_0xb8bb('0x43')]['hasOwnProperty'](_0xb8bb('0x62'))){_0x850c7a[_0xb8bb('0x2e')]=qs['limit'](_0x22610c[_0xb8bb('0x43')][_0xb8bb('0x2e')]);_0x850c7a[_0xb8bb('0x2b')]=qs['offset'](_0x22610c[_0xb8bb('0x43')][_0xb8bb('0x2b')]);}return _0x41d9d1[_0xb8bb('0xb8')](_0x850c7a);}})[_0xb8bb('0x1f')](function(_0x2c4e87){if(_0x2c4e87){return _0x2c4e87?{'count':_0x82ea62,'rows':_0x2c4e87}:null;}})[_0xb8bb('0x1f')](respondWithResult(_0x1ef14b,null))[_0xb8bb('0x52')](handleError(_0x1ef14b,null));};exports[_0xb8bb('0xb9')]=function(_0x1d0015,_0x15c8c2,_0x5d0fe7){var _0x122990={'raw':![],'where':{}};var _0x25897a={};var _0xafa84={'count':0x0,'rows':[]};return db[_0xb8bb('0x3d')][_0xb8bb('0x61')]({'where':{'id':_0x1d0015[_0xb8bb('0x54')]['id']}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x15c8c2,null))['then'](function(_0x16d739){if(_0x16d739){_0x25897a[_0xb8bb('0x40')]=_[_0xb8bb('0x42')](db['SmsInteraction']['rawAttributes']);_0x25897a[_0xb8bb('0x43')]=_[_0xb8bb('0x42')](_0x1d0015[_0xb8bb('0x43')]);_0x25897a[_0xb8bb('0x44')]=_[_0xb8bb('0x45')](_0x25897a[_0xb8bb('0x40')],_0x25897a[_0xb8bb('0x43')]);_0x122990[_0xb8bb('0x46')]=_[_0xb8bb('0x45')](_0x25897a['model'],qs[_0xb8bb('0x47')](_0x1d0015['query'][_0xb8bb('0x47')]));_0x122990['attributes']=_0x122990[_0xb8bb('0x46')][_0xb8bb('0x48')]?_0x122990[_0xb8bb('0x46')]:_0x25897a[_0xb8bb('0x40')];if(!_0x1d0015['query'][_0xb8bb('0x49')]('nolimit')){_0x122990[_0xb8bb('0x2e')]=qs[_0xb8bb('0x2e')](_0x1d0015[_0xb8bb('0x43')][_0xb8bb('0x2e')]);_0x122990[_0xb8bb('0x2b')]=qs[_0xb8bb('0x2b')](_0x1d0015['query'][_0xb8bb('0x2b')]);}_0x122990['order']=qs[_0xb8bb('0x64')](_0x1d0015['query'][_0xb8bb('0x64')]);_0x122990[_0xb8bb('0x4a')]=qs[_0xb8bb('0x44')](_[_0xb8bb('0x4b')](_0x1d0015[_0xb8bb('0x43')],_0x25897a[_0xb8bb('0x44')]));_0x122990[_0xb8bb('0x4a')][_0xb8bb('0x5e')]=_0x16d739['id'];if(_0x1d0015[_0xb8bb('0x43')][_0xb8bb('0x4c')]){_0x122990[_0xb8bb('0x4a')]=_[_0xb8bb('0x4d')](_0x122990[_0xb8bb('0x4a')],{'$or':_[_0xb8bb('0x41')](_0x122990['attributes'],function(_0x54af63){var _0x5b2064={};_0x5b2064[_0x54af63]={'$like':'%'+_0x1d0015['query'][_0xb8bb('0x4c')]+'%'};return _0x5b2064;})});}_0x122990=_[_0xb8bb('0x4d')]({},_0x122990,_0x1d0015['options']);return db[_0xb8bb('0x95')]['count']({'where':_0x122990[_0xb8bb('0x4a')]})[_0xb8bb('0x1f')](function(_0x21f867){_0xafa84[_0xb8bb('0x2d')]=_0x21f867;if(_0x1d0015[_0xb8bb('0x43')]['includeAll']){_0x122990['include']=[{'model':db[_0xb8bb('0x73')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xb8bb('0xba'),'attributes':[_0xb8bb('0x39'),_0xb8bb('0xbb'),_0xb8bb('0xbc')],'required':![]},{'model':db[_0xb8bb('0xbd')],'as':_0xb8bb('0xbe'),'attributes':['id',_0xb8bb('0x39'),_0xb8bb('0xbf')],'where':_0x1d0015[_0xb8bb('0x43')][_0xb8bb('0xc0')]?{'id':_0x1d0015[_0xb8bb('0x43')][_0xb8bb('0xc0')]}:undefined,'required':_0x1d0015[_0xb8bb('0x43')]['tag']?!![]:![]}];}return db[_0xb8bb('0x95')][_0xb8bb('0x51')](_0x122990);})[_0xb8bb('0x1f')](function(_0x3f82d3){_0xafa84[_0xb8bb('0xc1')]=_0x3f82d3;return _0xafa84;});}})[_0xb8bb('0x1f')](respondWithFilteredResult(_0x15c8c2,_0x122990))[_0xb8bb('0x52')](handleError(_0x15c8c2,null));};exports[_0xb8bb('0xad')]=function(_0x53d72f,_0xc8b1b5,_0x462965){var _0x639813,_0x5a7170,_0x2dfafb;if(_['isNil'](_0x53d72f[_0xb8bb('0x57')][_0xb8bb('0x57')])||_0x53d72f[_0xb8bb('0x57')][_0xb8bb('0x57')]===''){throw new db[(_0xb8bb('0x74'))][(_0xb8bb('0x8b'))](_0xb8bb('0xc2'));}if(_[_0xb8bb('0x8d')](_0x53d72f[_0xb8bb('0x57')]['to'])){throw new db[(_0xb8bb('0x74'))][(_0xb8bb('0x8b'))](_0xb8bb('0xc3'));}_0x639813=_0x53d72f[_0xb8bb('0x57')]['to'];return db[_0xb8bb('0x3d')][_0xb8bb('0x55')]({'where':{'id':_0x53d72f[_0xb8bb('0x54')]['id']},'include':[{'model':db[_0xb8bb('0x91')],'as':_0xb8bb('0xc4'),'include':[{'model':db[_0xb8bb('0x73')],'as':_0xb8bb('0x92'),'where':{'mobile':_0x639813},'limit':0x1,'order':[[_0xb8bb('0x78'),_0xb8bb('0x93')]]}]}]})[_0xb8bb('0x1f')](handleEntityNotFound(_0xc8b1b5,null))[_0xb8bb('0x1f')](function(_0x40873d){if(_0x40873d&&_0x40873d[_0xb8bb('0xc4')]){_0x5a7170=_0x40873d['get']({'plain':!![]});if(_0x5a7170[_0xb8bb('0xc4')]&&_0x5a7170['List'][_0xb8bb('0x92')]['length']){return _0x5a7170[_0xb8bb('0xc4')][_0xb8bb('0x92')][0x0];}return db[_0xb8bb('0x73')]['create'](_['defaults'](_0x53d72f[_0xb8bb('0x57')],{'firstName':_0x639813,'mobile':_0x639813,'phone':_0x639813,'ListId':_0x5a7170['ListId']}));}})[_0xb8bb('0x1f')](handleEntityNotFound(_0xc8b1b5,null))['then'](function(_0x4fa3d0){if(_0x4fa3d0){_0x2dfafb=_0x4fa3d0;return db[_0xb8bb('0x95')][_0xb8bb('0x55')]({'where':{'ContactId':_0x2dfafb['id'],'closed':![],'SmsAccountId':_0x5a7170['id']}})[_0xb8bb('0x1f')](function(_0x12ab3c){if(_0x12ab3c){return[_0x12ab3c,![]];}return db[_0xb8bb('0x95')]['create']({'UserId':_0x53d72f[_0xb8bb('0x58')]['id'],'ContactId':_0x2dfafb['id'],'SmsAccountId':_0x5a7170['id'],'phone':_0x639813,'firstMsgDirection':'out','Messages':[_[_0xb8bb('0x4d')](_0x53d72f['body'],{'read':![],'body':_0x53d72f[_0xb8bb('0x57')][_0xb8bb('0x57')],'phone':_0x639813,'SmsAccountId':_0x5a7170['id'],'UserId':_0x53d72f[_0xb8bb('0x58')]['id'],'ContactId':_0x2dfafb['id']})]},{'include':[{'model':db[_0xb8bb('0x9e')],'as':'Messages'}]})[_0xb8bb('0x1f')](function(_0x76bf2c){return[_0x76bf2c,!![]];});});}})['spread'](function(_0xe49a60,_0x5cb1f0){if(_0x5cb1f0){return _0xe49a60;}return db[_0xb8bb('0x9e')][_0xb8bb('0x56')](_[_0xb8bb('0x4d')](_0x53d72f[_0xb8bb('0x57')],{'read':![],'body':_0x53d72f[_0xb8bb('0x57')][_0xb8bb('0x57')],'phone':_0x639813,'SmsAccountId':_0x5a7170['id'],'SmsInteractionId':_0xe49a60['id'],'UserId':_0x53d72f['user']['id'],'ContactId':_0x2dfafb['id']}))[_0xb8bb('0x1f')](function(_0x4b7bec){_0xe49a60['dataValues'][_0xb8bb('0xc5')]=[];_0xe49a60[_0xb8bb('0xc6')][_0xb8bb('0xc5')][_0xb8bb('0x99')](_0x4b7bec[_0xb8bb('0xc6')]);return _0xe49a60;});})[_0xb8bb('0x1f')](respondWithResult(_0xc8b1b5,null))[_0xb8bb('0x52')](handleError(_0xc8b1b5,null));};exports[_0xb8bb('0x29')]=function(_0x41f01b,_0x2aa2e9,_0x246370){if(_0x41f01b[_0xb8bb('0x57')]['id']){delete _0x41f01b[_0xb8bb('0x57')]['id'];}var _0x56d0db,_0x50cdf9,_0x4aec04;return db['SmsAccount'][_0xb8bb('0x55')]({'where':{'id':_0x41f01b[_0xb8bb('0x54')]['id']}})['then'](handleEntityNotFound(_0x2aa2e9,null))[_0xb8bb('0x1f')](function(_0x32acb7){if(_0x32acb7){_0x4aec04=_0x32acb7;logger[_0xb8bb('0x21')](_0xb8bb('0x22'),_0xb8bb('0x29'),_0xb8bb('0xc7'),_0x32acb7['type'],util['inspect'](_0x41f01b['body'],{'showHidden':![],'depth':null}));switch(_0x32acb7[_0xb8bb('0x3f')]){case'skebby':if(_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0xc8')]&&_0x41f01b['body'][_0xb8bb('0x29')]){_0x50cdf9=_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0x29')];return db[_0xb8bb('0x9e')][_0xb8bb('0x55')]({'where':{'messageId':_0x41f01b['body'][_0xb8bb('0xc8')]}});}break;case _0xb8bb('0xc9'):if(_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0xca')]&&_0x41f01b[_0xb8bb('0x57')]['statusInt']){_0x50cdf9=_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0xcb')];return db['SmsMessage'][_0xb8bb('0x55')]({'where':{'messageId':_0x41f01b['body'][_0xb8bb('0xca')]}});}break;case _0xb8bb('0xcc'):if(_0x41f01b['body'][_0xb8bb('0x82')]&&_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0xcd')]){_0x50cdf9=_0x41f01b[_0xb8bb('0x57')]['status_code'];return db[_0xb8bb('0x9e')][_0xb8bb('0x55')]({'where':{'messageId':_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0x82')]}});}break;case _0xb8bb('0x84'):var _0x152c68=_0x41f01b['body'][_0xb8bb('0x85')][0x0];if(_0x152c68[_0xb8bb('0x7f')]&&_0x152c68[_0xb8bb('0x29')][_0xb8bb('0xce')]===_0xb8bb('0xcf')){_0x50cdf9=_0x152c68[_0xb8bb('0x29')][_0xb8bb('0xce')];return db[_0xb8bb('0x9e')][_0xb8bb('0x55')]({'where':{'messageId':_0x152c68[_0xb8bb('0x7f')]}});}break;case _0xb8bb('0xd0'):if(_0x41f01b['body'][_0xb8bb('0x7f')]&&_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0x29')]){_0x50cdf9=_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0x29')];return db['SmsMessage'][_0xb8bb('0x55')]({'where':{'messageId':_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0x7f')]}});}break;case _0xb8bb('0x89'):if(_0x41f01b[_0xb8bb('0x57')][0x0][_0xb8bb('0x27')]['id']){_0x50cdf9=_0x41f01b['body'][0x0]['type'];return db['SmsMessage']['find']({'where':{'messageId':_0x41f01b[_0xb8bb('0x57')][0x0][_0xb8bb('0x27')]['id']}});}break;case _0xb8bb('0x8a'):if(_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0xd1')]&&_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0x29')]){_0x50cdf9=_0x41f01b[_0xb8bb('0x57')]['status'];return db[_0xb8bb('0x9e')][_0xb8bb('0x55')]({'where':{'messageId':_0x41f01b[_0xb8bb('0x57')][_0xb8bb('0xd1')]}});}break;}}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x2aa2e9,null))['then'](function(_0x150502){if(_0x150502){_0x56d0db=_0x150502;switch(_0x4aec04[_0xb8bb('0x3f')]){case _0xb8bb('0xd2'):if(_0x50cdf9===_0xb8bb('0xcf')){return _0x56d0db[_0xb8bb('0x33')]({'read':!![]});}else{logger['error'](_0xb8bb('0x22'),_0xb8bb('0x29'),_0xb8bb('0xd2'),util[_0xb8bb('0xd3')](_0x41f01b['body'],{'showHidden':![],'depth':null}));}break;case _0xb8bb('0xc9'):if(_0x50cdf9==='1'){return _0x56d0db['update']({'read':!![]});}else{logger[_0xb8bb('0x24')](_0xb8bb('0x22'),_0xb8bb('0x29'),'skebby',util[_0xb8bb('0xd3')](_0x41f01b[_0xb8bb('0x57')],{'showHidden':![],'depth':null}));}break;case _0xb8bb('0xcc'):if(!_0x41f01b['body'][_0xb8bb('0xd4')]&&_0x50cdf9>=0xc8&&_0x50cdf9<=0xce){return _0x56d0db[_0xb8bb('0x33')]({'read':!![]});}else{logger[_0xb8bb('0x24')](_0xb8bb('0x22'),_0xb8bb('0x29'),_0xb8bb('0xcc'),util[_0xb8bb('0xd3')](_0x41f01b[_0xb8bb('0x57')],{'showHidden':![],'depth':null}));}break;case _0xb8bb('0x84'):var _0xff1aca=_0x41f01b[_0xb8bb('0x57')]['results'][0x0];if(_0xff1aca[_0xb8bb('0x29')][_0xb8bb('0xce')]==='DELIVERED'){return _0x56d0db[_0xb8bb('0x33')]({'read':!![]});}else{logger[_0xb8bb('0x24')](_0xb8bb('0x22'),'status',_0xb8bb('0x84'),util[_0xb8bb('0xd3')](_0x41f01b[_0xb8bb('0x57')],{'showHidden':![],'depth':null}));}break;case _0xb8bb('0xd0'):if(_0x50cdf9==_0xb8bb('0xd5')||_0x50cdf9==_0xb8bb('0xd6')){return _0x56d0db[_0xb8bb('0x33')]({'read':!![]});}else{logger[_0xb8bb('0x24')](_0xb8bb('0x22'),_0xb8bb('0x29'),_0xb8bb('0xd0'),util['inspect'](_0x41f01b[_0xb8bb('0x57')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x50cdf9=='message-delivered'){return _0x56d0db['update']({'read':!![]});}else{logger[_0xb8bb('0x24')](_0xb8bb('0x22'),'status',_0xb8bb('0x89'),util[_0xb8bb('0xd3')](_0x41f01b[_0xb8bb('0x57')],{'showHidden':![],'depth':null}));}break;case _0xb8bb('0x8a'):if(_0x50cdf9===_0xb8bb('0xd7')||_0x50cdf9===_0xb8bb('0xd8')){return _0x56d0db[_0xb8bb('0x33')]({'read':!![]});}else{logger[_0xb8bb('0x24')](_0xb8bb('0x22'),_0xb8bb('0x29'),_0xb8bb('0x8a'),util['inspect'](_0x41f01b[_0xb8bb('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x56d0db;}})['then'](respondWithResult(_0x2aa2e9,null))['catch'](handleError(_0x2aa2e9,null));};exports[_0xb8bb('0xd9')]=function(_0x1a1d3e,_0x3c9214,_0x496f7f){var _0x2a7d35,_0x23729b,_0x1b3669;return db[_0xb8bb('0x3d')]['find']({'where':{'id':_0x1a1d3e[_0xb8bb('0x54')]['id']}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x3c9214,null))['then'](function(_0x55f745){if(_0x55f745){_0x1b3669=_0x55f745;logger[_0xb8bb('0x21')](_0xb8bb('0x22'),'status',_0xb8bb('0xc7'),_0x55f745[_0xb8bb('0x3f')],util[_0xb8bb('0xd3')](_0x1a1d3e[_0xb8bb('0x43')],{'showHidden':![],'depth':null}));switch(_0x55f745[_0xb8bb('0x3f')]){case _0xb8bb('0x86'):if(_0x1a1d3e[_0xb8bb('0x43')]['message-id']&&_0x1a1d3e[_0xb8bb('0x43')][_0xb8bb('0xda')]){_0x23729b=_0x1a1d3e['query'][_0xb8bb('0xda')];return db[_0xb8bb('0x9e')][_0xb8bb('0x55')]({'where':{'messageId':_0x1a1d3e['query']['message-id']}});}break;}}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x3c9214,null))[_0xb8bb('0x1f')](function(_0x3162e0){if(_0x3162e0){_0x2a7d35=_0x3162e0;switch(_0x1b3669[_0xb8bb('0x3f')]){case'csc':if(_0x23729b==='2'||_0x23729b==='6'){return _0x2a7d35[_0xb8bb('0x33')]({'read':!![]});}else{logger['error'](_0xb8bb('0x22'),'status','csc',util[_0xb8bb('0xd3')](_0x1a1d3e[_0xb8bb('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x2a7d35;}})[_0xb8bb('0x1f')](respondWithResult(_0x3c9214,null))[_0xb8bb('0x52')](handleError(_0x3c9214,null));};exports[_0xb8bb('0xdb')]=function(_0x5ef8ae,_0x442314,_0x3329bb){return db['SmsAccount'][_0xb8bb('0x55')]({'where':{'id':_0x5ef8ae['params']['id']}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x442314,null))[_0xb8bb('0x1f')](function(_0x1bdffe){if(_0x1bdffe){return _0x1bdffe[_0xb8bb('0xdb')](_0x5ef8ae[_0xb8bb('0x57')][_0xb8bb('0x66')],_['omit'](_0x5ef8ae[_0xb8bb('0x57')],[_0xb8bb('0x66'),'id'])||{})[_0xb8bb('0x96')](function(_0x424ee5){for(var _0x2354b7=0x0;_0x2354b7<_0x5ef8ae['body'][_0xb8bb('0x66')][_0xb8bb('0x48')];_0x2354b7+=0x1){socket[_0xb8bb('0xdc')]('userSmsAccount:save',{'UserId':Number(_0x5ef8ae['body'][_0xb8bb('0x66')][_0x2354b7]),'SmsAccountId':Number(_0x5ef8ae[_0xb8bb('0x54')]['id'])});}return _0x424ee5;});}})['then'](respondWithResult(_0x442314,null))[_0xb8bb('0x52')](handleError(_0x442314,null));};exports[_0xb8bb('0xdd')]=function(_0x29e027,_0x3abbaa,_0x38ee2c){return db[_0xb8bb('0x3d')][_0xb8bb('0x55')]({'where':{'id':_0x29e027[_0xb8bb('0x54')]['id']}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x3abbaa,null))[_0xb8bb('0x1f')](function(_0x2d0e91){if(_0x2d0e91){return _0x2d0e91[_0xb8bb('0xdd')](_0x29e027[_0xb8bb('0x43')][_0xb8bb('0x66')])[_0xb8bb('0x1f')](function(){if(_[_0xb8bb('0xde')](_0x29e027[_0xb8bb('0x43')][_0xb8bb('0x66')])){for(var _0x1b5f3a=0x0;_0x1b5f3a<_0x29e027[_0xb8bb('0x43')][_0xb8bb('0x66')][_0xb8bb('0x48')];_0x1b5f3a+=0x1){socket[_0xb8bb('0xdc')](_0xb8bb('0xdf'),{'UserId':Number(_0x29e027['query']['ids'][_0x1b5f3a]),'SmsAccountId':Number(_0x29e027['params']['id'])});}}else{socket[_0xb8bb('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x29e027[_0xb8bb('0x43')]['ids']),'SmsAccountId':Number(_0x29e027[_0xb8bb('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x3abbaa,null))[_0xb8bb('0x52')](handleError(_0x3abbaa,null));};exports[_0xb8bb('0xe0')]=function(_0x5bce5f,_0x47b508,_0x5c858a){var _0x4c3ad9={};var _0x12bdb8={};var _0x146fe4;var _0x307d1d;return db[_0xb8bb('0x3d')][_0xb8bb('0x61')]({'where':{'id':_0x5bce5f[_0xb8bb('0x54')]['id']}})[_0xb8bb('0x1f')](handleEntityNotFound(_0x47b508,null))[_0xb8bb('0x1f')](function(_0x507e6a){if(_0x507e6a){_0x146fe4=_0x507e6a;_0x12bdb8[_0xb8bb('0x40')]=_[_0xb8bb('0x42')](db[_0xb8bb('0xa2')][_0xb8bb('0x3e')]);_0x12bdb8[_0xb8bb('0x43')]=_[_0xb8bb('0x42')](_0x5bce5f[_0xb8bb('0x43')]);_0x12bdb8['filters']=_['intersection'](_0x12bdb8[_0xb8bb('0x40')],_0x12bdb8[_0xb8bb('0x43')]);_0x4c3ad9[_0xb8bb('0x46')]=_[_0xb8bb('0x45')](_0x12bdb8[_0xb8bb('0x40')],qs['fields'](_0x5bce5f[_0xb8bb('0x43')][_0xb8bb('0x47')]));_0x4c3ad9[_0xb8bb('0x46')]=_0x4c3ad9[_0xb8bb('0x46')][_0xb8bb('0x48')]?_0x4c3ad9[_0xb8bb('0x46')]:_0x12bdb8[_0xb8bb('0x40')];_0x4c3ad9['order']=qs['sort'](_0x5bce5f[_0xb8bb('0x43')][_0xb8bb('0x64')]);_0x4c3ad9[_0xb8bb('0x4a')]=qs['filters'](_[_0xb8bb('0x4b')](_0x5bce5f[_0xb8bb('0x43')],_0x12bdb8['filters']));if(_0x5bce5f[_0xb8bb('0x43')][_0xb8bb('0x4c')]){_0x4c3ad9[_0xb8bb('0x4a')]=_[_0xb8bb('0x4d')](_0x4c3ad9[_0xb8bb('0x4a')],{'$or':_[_0xb8bb('0x41')](_0x4c3ad9[_0xb8bb('0x46')],function(_0x3dbc6c){var _0x385752={};_0x385752[_0x3dbc6c]={'$like':'%'+_0x5bce5f[_0xb8bb('0x43')][_0xb8bb('0x4c')]+'%'};return _0x385752;})});}_0x4c3ad9=_[_0xb8bb('0x4d')]({},_0x4c3ad9,_0x5bce5f[_0xb8bb('0x4e')]);return _0x146fe4[_0xb8bb('0xe0')](_0x4c3ad9);}})[_0xb8bb('0x1f')](function(_0x15cda8){if(_0x15cda8){_0x307d1d=_0x15cda8[_0xb8bb('0x48')];if(!_0x5bce5f[_0xb8bb('0x43')][_0xb8bb('0x49')](_0xb8bb('0x62'))){_0x4c3ad9[_0xb8bb('0x2e')]=qs[_0xb8bb('0x2e')](_0x5bce5f[_0xb8bb('0x43')][_0xb8bb('0x2e')]);_0x4c3ad9[_0xb8bb('0x2b')]=qs['offset'](_0x5bce5f[_0xb8bb('0x43')]['offset']);}return _0x146fe4[_0xb8bb('0xe0')](_0x4c3ad9);}})[_0xb8bb('0x1f')](function(_0x45da8f){if(_0x45da8f){return _0x45da8f?{'count':_0x307d1d,'rows':_0x45da8f}:null;}})[_0xb8bb('0x1f')](respondWithResult(_0x47b508,null))[_0xb8bb('0x52')](handleError(_0x47b508,null));}; \ No newline at end of file +var _0xf494=['hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','findAll','rows','show','Pause','include','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addDisposition','getDispositions','findOne','SmsAccountId','Disposition','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','account','applications','Applications','priority','asc','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','plivo','From','infobip','results','segmentedMessage','clickatell','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','emit','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','http','info','SmsAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','SmsAccounts','destroy','sendStatus','stack','name','send','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','model','query','keys','intersection','fields','attributes','length'];(function(_0x3e6045,_0x48bbeb){var _0x161d0f=function(_0x48ed3d){while(--_0x48ed3d){_0x3e6045['push'](_0x3e6045['shift']());}};_0x161d0f(++_0x48bbeb);}(_0xf494,0x9d));var _0x4f49=function(_0x3a8d86,_0xbc8e50){_0x3a8d86=_0x3a8d86-0x0;var _0x576f5=_0xf494[_0x3a8d86];return _0x576f5;};'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(_0x4f49('0xe'));var crypto=require('crypto');var jsforce=require(_0x4f49('0xf'));var deskjs=require(_0x4f49('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4f49('0x11'));var Papa=require(_0x4f49('0x12'));var Redis=require('ioredis');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'))(_0x4f49('0x17'));var utils=require(_0x4f49('0x18'));var config=require(_0x4f49('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x1a'))['db'];config[_0x4f49('0x1b')]=_[_0x4f49('0x1c')](config[_0x4f49('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f49('0x1d'))(new Redis(config[_0x4f49('0x1b')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x4f49('0x1e'));var client=jayson['client'][_0x4f49('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x86b58,_0x1ad560,_0xca5c2,_0x4e6c04){return new BPromise(function(_0x1defd4,_0x133349){var _0x11eadd=_0x4e6c04||client;return _0x11eadd['request'](_0x86b58,_0xca5c2)['then'](function(_0x4e8b8b){logger[_0x4f49('0x20')](_0x4f49('0x21'),_0x1ad560,'request\x20sent');logger[_0x4f49('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1ad560,'request\x20sent',JSON[_0x4f49('0x23')](_0x4e8b8b));if(_0x4e8b8b[_0x4f49('0x24')]){if(_0x4e8b8b['error'][_0x4f49('0x25')]===0x1f4){logger[_0x4f49('0x24')](_0x4f49('0x21'),_0x1ad560,_0x4e8b8b[_0x4f49('0x24')][_0x4f49('0x26')]);return _0x133349(_0x4e8b8b[_0x4f49('0x24')][_0x4f49('0x26')]);}logger[_0x4f49('0x24')](_0x4f49('0x21'),_0x1ad560,_0x4e8b8b[_0x4f49('0x24')][_0x4f49('0x26')]);return _0x1defd4(_0x4e8b8b[_0x4f49('0x24')][_0x4f49('0x26')]);}else{logger[_0x4f49('0x20')](_0x4f49('0x21'),_0x1ad560,'request\x20sent');_0x1defd4(_0x4e8b8b[_0x4f49('0x27')][_0x4f49('0x26')]);}})[_0x4f49('0x28')](function(_0x15b7cb){logger['error'](_0x4f49('0x21'),_0x1ad560,_0x15b7cb);_0x133349(_0x15b7cb);});});}function respondWithStatusCode(_0x4cfa5e,_0xd1cd2f){_0xd1cd2f=_0xd1cd2f||0xcc;return function(_0x5b961a){if(_0x5b961a){return _0x4cfa5e['sendStatus'](_0xd1cd2f);}return _0x4cfa5e[_0x4f49('0x29')](_0xd1cd2f)[_0x4f49('0x2a')]();};}function respondWithResult(_0x2c0ab8,_0x52765a){_0x52765a=_0x52765a||0xc8;return function(_0x19829d){if(_0x19829d){return _0x2c0ab8[_0x4f49('0x29')](_0x52765a)[_0x4f49('0x2b')](_0x19829d);}};}function respondWithFilteredResult(_0x17b98f,_0x5ed5b7){return function(_0x36959a){if(_0x36959a){var _0x1e2802=typeof _0x5ed5b7[_0x4f49('0x2c')]==='undefined'&&typeof _0x5ed5b7[_0x4f49('0x2d')]===_0x4f49('0x2e');var _0x32763c=_0x36959a[_0x4f49('0x2f')];var _0x44af6c=_0x1e2802?0x0:_0x5ed5b7[_0x4f49('0x2c')];var _0x5b8c97=_0x1e2802?_0x36959a[_0x4f49('0x2f')]:_0x5ed5b7[_0x4f49('0x2c')]+_0x5ed5b7[_0x4f49('0x2d')];var _0x41e213;if(_0x5b8c97>=_0x32763c){_0x5b8c97=_0x32763c;_0x41e213=0xc8;}else{_0x41e213=0xce;}_0x17b98f[_0x4f49('0x29')](_0x41e213);return _0x17b98f[_0x4f49('0x30')](_0x4f49('0x31'),_0x44af6c+'-'+_0x5b8c97+'/'+_0x32763c)[_0x4f49('0x2b')](_0x36959a);}return null;};}function patchUpdates(_0x25db05){return function(_0x15780a){try{jsonpatch[_0x4f49('0x32')](_0x15780a,_0x25db05,!![]);}catch(_0x1e8667){return BPromise[_0x4f49('0x33')](_0x1e8667);}return _0x15780a[_0x4f49('0x34')]();};}function saveUpdates(_0x4ac813,_0x40d287){return function(_0x8d79da){if(_0x8d79da){return _0x8d79da['update'](_0x4ac813)[_0x4f49('0x35')](function(_0x1ddb40){return _0x1ddb40;});}return null;};}function removeEntity(_0x18dfda,_0x2a2e3a){return function(_0x5c1030){if(_0x5c1030){return _0x5c1030['destroy']()[_0x4f49('0x35')](function(){var _0xb3dec6=_0x5c1030['get']({'plain':!![]});var _0x2efd59=_0x4f49('0x36');return db['UserProfileResource'][_0x4f49('0x37')]({'where':{'type':_0x2efd59,'resourceId':_0xb3dec6['id']}})[_0x4f49('0x35')](function(){return _0x5c1030;});})[_0x4f49('0x35')](function(){_0x18dfda[_0x4f49('0x29')](0xcc)[_0x4f49('0x2a')]();});}};}function handleEntityNotFound(_0x47e52d,_0x16fdb0){return function(_0x3eebe3){if(!_0x3eebe3){_0x47e52d[_0x4f49('0x38')](0x194);}return _0x3eebe3;};}function handleError(_0x3fd704,_0x46310d){_0x46310d=_0x46310d||0x1f4;return function(_0x5c0fe8){logger[_0x4f49('0x24')](_0x5c0fe8[_0x4f49('0x39')]);if(_0x5c0fe8['name']){delete _0x5c0fe8[_0x4f49('0x3a')];}_0x3fd704['status'](_0x46310d)[_0x4f49('0x3b')](_0x5c0fe8);};}exports['index']=function(_0x360c5b,_0x22e62c){var _0x3e2742={'include':[{'model':db['Pause'],'as':_0x4f49('0x3c')}]},_0x5512dd={},_0x5bede5={'count':0x0,'rows':[]};var _0x380878=_[_0x4f49('0x3d')](db[_0x4f49('0x3e')][_0x4f49('0x3f')],function(_0x37de8e){return{'name':_0x37de8e['fieldName'],'type':_0x37de8e[_0x4f49('0x40')]['key']};});_0x5512dd[_0x4f49('0x41')]=_[_0x4f49('0x3d')](_0x380878,_0x4f49('0x3a'));_0x5512dd[_0x4f49('0x42')]=_[_0x4f49('0x43')](_0x360c5b[_0x4f49('0x42')]);_0x5512dd['filters']=_[_0x4f49('0x44')](_0x5512dd[_0x4f49('0x41')],_0x5512dd[_0x4f49('0x42')]);_0x3e2742['attributes']=_[_0x4f49('0x44')](_0x5512dd[_0x4f49('0x41')],qs[_0x4f49('0x45')](_0x360c5b[_0x4f49('0x42')][_0x4f49('0x45')]));_0x3e2742[_0x4f49('0x46')]=_0x3e2742[_0x4f49('0x46')][_0x4f49('0x47')]?_0x3e2742[_0x4f49('0x46')]:_0x5512dd[_0x4f49('0x41')];if(!_0x360c5b[_0x4f49('0x42')][_0x4f49('0x48')](_0x4f49('0x49'))){_0x3e2742[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x360c5b[_0x4f49('0x42')][_0x4f49('0x2d')]);_0x3e2742['offset']=qs[_0x4f49('0x2c')](_0x360c5b[_0x4f49('0x42')][_0x4f49('0x2c')]);}_0x3e2742[_0x4f49('0x4a')]=qs['sort'](_0x360c5b[_0x4f49('0x42')][_0x4f49('0x4b')]);_0x3e2742[_0x4f49('0x4c')]=qs[_0x4f49('0x4d')](_[_0x4f49('0x4e')](_0x360c5b[_0x4f49('0x42')],_0x5512dd['filters']),_0x380878);if(_0x360c5b[_0x4f49('0x42')]['filter']){_0x3e2742[_0x4f49('0x4c')]=_['merge'](_0x3e2742['where'],{'$or':_[_0x4f49('0x3d')](_0x380878,function(_0x507472){if(_0x507472['type']!==_0x4f49('0x4f')){var _0x389516={};_0x389516[_0x507472[_0x4f49('0x3a')]]={'$like':'%'+_0x360c5b[_0x4f49('0x42')][_0x4f49('0x50')]+'%'};return _0x389516;}})});}_0x3e2742=_['merge']({},_0x3e2742,_0x360c5b[_0x4f49('0x51')]);var _0x345eb8={'where':_0x3e2742[_0x4f49('0x4c')]};return db['SmsAccount']['count'](_0x345eb8)[_0x4f49('0x35')](function(_0xb05c5c){_0x5bede5[_0x4f49('0x2f')]=_0xb05c5c;if(_0x360c5b[_0x4f49('0x42')][_0x4f49('0x52')]){_0x3e2742['include']=[{'all':!![]}];}return db[_0x4f49('0x3e')][_0x4f49('0x53')](_0x3e2742);})[_0x4f49('0x35')](function(_0x6238a0){_0x5bede5[_0x4f49('0x54')]=_0x6238a0;return _0x5bede5;})[_0x4f49('0x35')](respondWithFilteredResult(_0x22e62c,_0x3e2742))[_0x4f49('0x28')](handleError(_0x22e62c,null));};exports[_0x4f49('0x55')]=function(_0x1759e9,_0x5c0477){var _0x2799e1={'raw':![],'where':{'id':_0x1759e9['params']['id']},'include':[{'model':db[_0x4f49('0x56')],'as':'mandatoryDispositionPause'}]},_0x561596={};_0x561596[_0x4f49('0x41')]=_[_0x4f49('0x43')](db[_0x4f49('0x3e')][_0x4f49('0x3f')]);_0x561596[_0x4f49('0x42')]=_[_0x4f49('0x43')](_0x1759e9[_0x4f49('0x42')]);_0x561596[_0x4f49('0x4d')]=_['intersection'](_0x561596[_0x4f49('0x41')],_0x561596[_0x4f49('0x42')]);_0x2799e1[_0x4f49('0x46')]=_[_0x4f49('0x44')](_0x561596[_0x4f49('0x41')],qs['fields'](_0x1759e9[_0x4f49('0x42')][_0x4f49('0x45')]));_0x2799e1[_0x4f49('0x46')]=_0x2799e1[_0x4f49('0x46')][_0x4f49('0x47')]?_0x2799e1[_0x4f49('0x46')]:_0x561596[_0x4f49('0x41')];if(_0x1759e9[_0x4f49('0x42')][_0x4f49('0x52')]){_0x2799e1[_0x4f49('0x57')]=[{'all':!![]}];}_0x2799e1=_[_0x4f49('0x58')]({},_0x2799e1,_0x1759e9['options']);return db[_0x4f49('0x3e')][_0x4f49('0x59')](_0x2799e1)['then'](handleEntityNotFound(_0x5c0477,null))[_0x4f49('0x35')](respondWithResult(_0x5c0477,null))[_0x4f49('0x28')](handleError(_0x5c0477,null));};exports[_0x4f49('0x5a')]=function(_0x2d7e70,_0x1ff61a){return db[_0x4f49('0x3e')][_0x4f49('0x5a')](_0x2d7e70[_0x4f49('0x5b')],{})[_0x4f49('0x35')](function(_0x5301ab){var _0x3746e8=_0x2d7e70[_0x4f49('0x5c')][_0x4f49('0x5d')]({'plain':!![]});if(!_0x3746e8)throw new Error(_0x4f49('0x5e'));if(_0x3746e8['role']===_0x4f49('0x5c')){var _0x5f0724=_0x5301ab[_0x4f49('0x5d')]({'plain':!![]});var _0x639bcb=_0x4f49('0x36');return db['UserProfileSection'][_0x4f49('0x59')]({'where':{'name':_0x639bcb,'userProfileId':_0x3746e8[_0x4f49('0x5f')]},'raw':!![]})['then'](function(_0x53bbfa){if(_0x53bbfa&&_0x53bbfa[_0x4f49('0x60')]===0x0){return db[_0x4f49('0x61')][_0x4f49('0x5a')]({'name':_0x5f0724[_0x4f49('0x3a')],'resourceId':_0x5f0724['id'],'type':_0x53bbfa['name'],'sectionId':_0x53bbfa['id']},{})[_0x4f49('0x35')](function(){return _0x5301ab;});}else{return _0x5301ab;}})[_0x4f49('0x28')](function(_0x1bd37f){logger['error'](_0x4f49('0x62'),_0x1bd37f);throw _0x1bd37f;});}return _0x5301ab;})[_0x4f49('0x35')](respondWithResult(_0x1ff61a,0xc9))[_0x4f49('0x28')](handleError(_0x1ff61a,null));};exports[_0x4f49('0x63')]=function(_0x46c7ec,_0x425b09){if(_0x46c7ec[_0x4f49('0x5b')]['id']){delete _0x46c7ec[_0x4f49('0x5b')]['id'];}return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x46c7ec[_0x4f49('0x64')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x4f49('0x35')](handleEntityNotFound(_0x425b09,null))[_0x4f49('0x35')](saveUpdates(_0x46c7ec[_0x4f49('0x5b')],null))[_0x4f49('0x35')](respondWithResult(_0x425b09,null))[_0x4f49('0x28')](handleError(_0x425b09,null));};exports['destroy']=function(_0x8d497,_0x1815fe){return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x8d497[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x1815fe,null))['then'](removeEntity(_0x1815fe,null))[_0x4f49('0x28')](handleError(_0x1815fe,null));};exports['describe']=function(_0x2577e5,_0x559380){return db[_0x4f49('0x3e')]['describe']()[_0x4f49('0x35')](respondWithResult(_0x559380,null))['catch'](handleError(_0x559380,null));};exports[_0x4f49('0x65')]=function(_0x2a9f9a,_0x224f6c,_0x30d16d){if(_0x2a9f9a[_0x4f49('0x5b')]['id']){delete _0x2a9f9a[_0x4f49('0x5b')]['id'];}return db[_0x4f49('0x3e')]['find']({'where':{'id':_0x2a9f9a['params']['id']}})['then'](handleEntityNotFound(_0x224f6c,null))[_0x4f49('0x35')](function(_0x997ab6){if(_0x997ab6){_0x2a9f9a[_0x4f49('0x5b')]['SmsAccountId']=_0x997ab6['id'];return db['Disposition'][_0x4f49('0x5a')](_0x2a9f9a[_0x4f49('0x5b')]);}})[_0x4f49('0x35')](respondWithResult(_0x224f6c,null))[_0x4f49('0x28')](handleError(_0x224f6c,null));};exports[_0x4f49('0x66')]=function(_0x143b7e,_0x3992f7,_0x425216){var _0x4286cd={'raw':![],'where':{}};var _0x2e636a={};var _0xa3b76={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4f49('0x67')]({'where':{'id':_0x143b7e['params']['id']}})['then'](handleEntityNotFound(_0x3992f7,null))[_0x4f49('0x35')](function(_0x5f143e){if(_0x5f143e){_0x2e636a[_0x4f49('0x41')]=_[_0x4f49('0x43')](db['Disposition'][_0x4f49('0x3f')]);_0x2e636a[_0x4f49('0x42')]=_['keys'](_0x143b7e['query']);_0x2e636a['filters']=_[_0x4f49('0x44')](_0x2e636a[_0x4f49('0x41')],_0x2e636a[_0x4f49('0x42')]);_0x4286cd[_0x4f49('0x46')]=_[_0x4f49('0x44')](_0x2e636a[_0x4f49('0x41')],qs[_0x4f49('0x45')](_0x143b7e['query'][_0x4f49('0x45')]));_0x4286cd['attributes']=_0x4286cd['attributes'][_0x4f49('0x47')]?_0x4286cd['attributes']:_0x2e636a['model'];if(!_0x143b7e[_0x4f49('0x42')]['hasOwnProperty']('nolimit')){_0x4286cd[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x143b7e['query'][_0x4f49('0x2d')]);_0x4286cd[_0x4f49('0x2c')]=qs[_0x4f49('0x2c')](_0x143b7e['query']['offset']);}_0x4286cd[_0x4f49('0x4a')]=qs['sort'](_0x143b7e[_0x4f49('0x42')]['sort']);_0x4286cd[_0x4f49('0x4c')]=qs[_0x4f49('0x4d')](_[_0x4f49('0x4e')](_0x143b7e['query'],_0x2e636a[_0x4f49('0x4d')]));_0x4286cd[_0x4f49('0x4c')][_0x4f49('0x68')]=_0x5f143e['id'];if(_0x143b7e[_0x4f49('0x42')][_0x4f49('0x50')]){_0x4286cd['where']=_['merge'](_0x4286cd[_0x4f49('0x4c')],{'$or':_[_0x4f49('0x3d')](_0x4286cd[_0x4f49('0x46')],function(_0x275e36){var _0x3143b0={};_0x3143b0[_0x275e36]={'$like':'%'+_0x143b7e['query'][_0x4f49('0x50')]+'%'};return _0x3143b0;})});}_0x4286cd=_[_0x4f49('0x58')]({},_0x4286cd,_0x143b7e[_0x4f49('0x51')]);return db['Disposition'][_0x4f49('0x2f')]({'where':_0x4286cd[_0x4f49('0x4c')]})[_0x4f49('0x35')](function(_0x13ccc5){_0xa3b76[_0x4f49('0x2f')]=_0x13ccc5;if(_0x143b7e[_0x4f49('0x42')][_0x4f49('0x52')]){_0x4286cd[_0x4f49('0x57')]=[{'all':!![]}];}return db[_0x4f49('0x69')]['findAll'](_0x4286cd);})[_0x4f49('0x35')](function(_0x41c612){_0xa3b76[_0x4f49('0x54')]=_0x41c612;return _0xa3b76;});}})[_0x4f49('0x35')](respondWithFilteredResult(_0x3992f7,_0x4286cd))[_0x4f49('0x28')](handleError(_0x3992f7,null));};exports['removeDispositions']=function(_0x5794a4,_0x114ac8,_0x25b73d){return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x5794a4[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x114ac8,null))[_0x4f49('0x35')](function(_0x3f8e29){if(_0x3f8e29){return _0x3f8e29['removeDispositions'](_0x5794a4['query'][_0x4f49('0x6a')]);}})['then'](respondWithStatusCode(_0x114ac8,null))[_0x4f49('0x28')](handleError(_0x114ac8,null));};exports[_0x4f49('0x6b')]=function(_0x127f08,_0x556268,_0x44b3ea){if(_0x127f08[_0x4f49('0x5b')]['id']){delete _0x127f08[_0x4f49('0x5b')]['id'];}return db['SmsAccount'][_0x4f49('0x59')]({'where':{'id':_0x127f08[_0x4f49('0x64')]['id']}})['then'](handleEntityNotFound(_0x556268,null))[_0x4f49('0x35')](function(_0x8c9f12){if(_0x8c9f12){_0x127f08[_0x4f49('0x5b')][_0x4f49('0x68')]=_0x8c9f12['id'];return db[_0x4f49('0x6c')][_0x4f49('0x5a')](_0x127f08['body']);}})[_0x4f49('0x35')](respondWithResult(_0x556268,null))[_0x4f49('0x28')](handleError(_0x556268,null));};exports[_0x4f49('0x6d')]=function(_0x1998eb,_0x375f15,_0x80e547){var _0x1cd2eb={'raw':![],'where':{}};var _0x3fb371={};var _0x454127={'count':0x0,'rows':[]};return db[_0x4f49('0x3e')][_0x4f49('0x67')]({'where':{'id':_0x1998eb[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x375f15,null))[_0x4f49('0x35')](function(_0x3397d2){if(_0x3397d2){_0x3fb371[_0x4f49('0x41')]=_[_0x4f49('0x43')](db['CannedAnswer']['rawAttributes']);_0x3fb371['query']=_[_0x4f49('0x43')](_0x1998eb[_0x4f49('0x42')]);_0x3fb371['filters']=_['intersection'](_0x3fb371[_0x4f49('0x41')],_0x3fb371[_0x4f49('0x42')]);_0x1cd2eb[_0x4f49('0x46')]=_['intersection'](_0x3fb371['model'],qs[_0x4f49('0x45')](_0x1998eb['query'][_0x4f49('0x45')]));_0x1cd2eb[_0x4f49('0x46')]=_0x1cd2eb[_0x4f49('0x46')][_0x4f49('0x47')]?_0x1cd2eb['attributes']:_0x3fb371['model'];if(!_0x1998eb[_0x4f49('0x42')]['hasOwnProperty'](_0x4f49('0x49'))){_0x1cd2eb[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x1998eb['query'][_0x4f49('0x2d')]);_0x1cd2eb[_0x4f49('0x2c')]=qs['offset'](_0x1998eb[_0x4f49('0x42')][_0x4f49('0x2c')]);}_0x1cd2eb[_0x4f49('0x4a')]=qs['sort'](_0x1998eb['query'][_0x4f49('0x4b')]);_0x1cd2eb['where']=qs[_0x4f49('0x4d')](_[_0x4f49('0x4e')](_0x1998eb[_0x4f49('0x42')],_0x3fb371[_0x4f49('0x4d')]));_0x1cd2eb[_0x4f49('0x4c')]['SmsAccountId']=_0x3397d2['id'];if(_0x1998eb[_0x4f49('0x42')][_0x4f49('0x50')]){_0x1cd2eb['where']=_['merge'](_0x1cd2eb[_0x4f49('0x4c')],{'$or':_['map'](_0x1cd2eb[_0x4f49('0x46')],function(_0x46632f){var _0x24dac4={};_0x24dac4[_0x46632f]={'$like':'%'+_0x1998eb['query'][_0x4f49('0x50')]+'%'};return _0x24dac4;})});}_0x1cd2eb=_[_0x4f49('0x58')]({},_0x1cd2eb,_0x1998eb[_0x4f49('0x51')]);return db[_0x4f49('0x6c')]['count']({'where':_0x1cd2eb['where']})['then'](function(_0x1bb11b){_0x454127['count']=_0x1bb11b;if(_0x1998eb[_0x4f49('0x42')]['includeAll']){_0x1cd2eb[_0x4f49('0x57')]=[{'all':!![]}];}return db[_0x4f49('0x6c')]['findAll'](_0x1cd2eb);})[_0x4f49('0x35')](function(_0x1ddc70){_0x454127['rows']=_0x1ddc70;return _0x454127;});}})[_0x4f49('0x35')](respondWithFilteredResult(_0x375f15,_0x1cd2eb))[_0x4f49('0x28')](handleError(_0x375f15,null));};exports[_0x4f49('0x6e')]=function(_0x4b0c8d,_0x10ec2b,_0x2820ca){return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x4b0c8d[_0x4f49('0x64')]['id']}})['then'](handleEntityNotFound(_0x10ec2b,null))[_0x4f49('0x35')](function(_0x7e5733){if(_0x7e5733){return _0x7e5733[_0x4f49('0x6e')](_0x4b0c8d[_0x4f49('0x42')][_0x4f49('0x6a')]);}})[_0x4f49('0x35')](respondWithStatusCode(_0x10ec2b,null))[_0x4f49('0x28')](handleError(_0x10ec2b,null));};exports[_0x4f49('0x6f')]=function(_0x38f392,_0x377959,_0x5969a2){var _0x3abcfb={'channel':_0x4f49('0x70')};var _0x19d565=[];var _0xeb6774=[];var _0xc06aea={};return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x38f392[_0x4f49('0x64')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0x4f49('0x35')](handleEntityNotFound(_0x377959,null))[_0x4f49('0x35')](function(_0x3de170){_0x3abcfb[_0x4f49('0x71')]=_0x3de170;_0x3abcfb[_0x4f49('0x72')]=_['orderBy'](_0x3de170[_0x4f49('0x73')],[_0x4f49('0x74')],[_0x4f49('0x75')]);if(_0x3abcfb['account']['Applications']){delete _0x3abcfb[_0x4f49('0x71')][_0x4f49('0x73')];}return db[_0x4f49('0x76')][_0x4f49('0x77')]();})[_0x4f49('0x35')](function(_0x34d22e){if(!_0x34d22e){throw new db[(_0x4f49('0x78'))][(_0x4f49('0x79'))](_0x4f49('0x7a'));}_0x19d565=_[_0x4f49('0x7b')](_[_0x4f49('0x43')](_0x34d22e),[_0x4f49('0x7c'),_0x4f49('0x7d')]);_0xeb6774=_[_0x4f49('0x7b')](_[_0x4f49('0x43')](_0x34d22e),['createdAt','updatedAt','CompanyId','ListId']);_0x3abcfb[_0x4f49('0x5b')]={'mapKey':_0x4f49('0x7e')};if(_0x3abcfb[_0x4f49('0x71')][_0x4f49('0x40')]){switch(_0x3abcfb['account']['type']){case _0x4f49('0x7f'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')]['From'];_0x3abcfb['body']['body']=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x81')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x82')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x83')];break;case _0x4f49('0x84'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]='+'+_0x38f392[_0x4f49('0x5b')][_0x4f49('0x85')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x86')];break;case _0x4f49('0x87'):_0x3abcfb['body'][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x80')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')]['message'];break;case _0x4f49('0x88'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x80')];_0x3abcfb['body']['body']=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x5b')];_0x3abcfb['body']['messageId']=_0x38f392[_0x4f49('0x5b')]['message_id'];break;case _0x4f49('0x89'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x8a')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')]['Text'];_0x3abcfb[_0x4f49('0x5b')]['messageId']=_0x38f392[_0x4f49('0x5b')]['MessageUUID'];break;case _0x4f49('0x8b'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]='+'+_0x38f392[_0x4f49('0x5b')][_0x4f49('0x8c')][0x0][_0x4f49('0x80')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x8c')][0x0]['text'];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x82')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x8c')][0x0][_0x4f49('0x82')];break;case'csc':_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392['body']['originatingAddress'];_0x3abcfb['body'][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x8d')][_0x4f49('0x26')];break;case _0x4f49('0x8e'):_0x3abcfb['body'][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')]['fromNumber'];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x86')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x82')]=_0x38f392[_0x4f49('0x5b')]['replyMessageId'];break;case _0x4f49('0x8f'):_0x3abcfb['body'][_0x4f49('0x82')]=_0x38f392[_0x4f49('0x5b')][0x0][_0x4f49('0x26')]['id'];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')][0x0][_0x4f49('0x26')][_0x4f49('0x80')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')][0x0][_0x4f49('0x26')][_0x4f49('0x86')];break;case _0x4f49('0x90'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x80')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')]['message'];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x82')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x91')];break;}}if(_0x3abcfb['body']['id']){delete _0x3abcfb[_0x4f49('0x5b')]['id'];}if(_['isNil'](_0x3abcfb[_0x4f49('0x5b')]['from'])){throw new db[(_0x4f49('0x78'))]['ValidationError'](_0x4f49('0x92'));}if(_[_0x4f49('0x93')](_0x3abcfb[_0x4f49('0x5b')]['body'])||_0x3abcfb[_0x4f49('0x5b')]['body']===''){throw new db[(_0x4f49('0x78'))]['ValidationError'](_0x4f49('0x94'));}if(_[_0x4f49('0x93')](_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x95')])){throw new db[(_0x4f49('0x78'))][(_0x4f49('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xeb6774);}if(!_[_0x4f49('0x96')](_0xeb6774,_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x95')])){throw new db[(_0x4f49('0x78'))][(_0x4f49('0x79'))](_0x4f49('0x97')+_0xeb6774);}_0xc06aea[_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x95')]]=_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')];return db[_0x4f49('0x98')]['find']({'where':{'id':_0x3abcfb[_0x4f49('0x71')][_0x4f49('0x99')]},'include':[{'model':db['CmContact'],'as':_0x4f49('0x9a'),'where':_0xc06aea,'limit':0x1,'order':[[_0x4f49('0x7d'),_0x4f49('0x9b')]]}]});})['then'](handleEntityNotFound(_0x377959,null))['then'](function(_0x513b13){if(_0x513b13){_0x3abcfb['list']=_[_0x4f49('0x9c')](_0x513b13,[_0x4f49('0x9a')]);if(_0x513b13[_0x4f49('0x9a')][_0x4f49('0x47')]){return _0x513b13[_0x4f49('0x9a')][0x0];}var _0xd78e9f=_[_0x4f49('0x1c')](_0x3abcfb[_0x4f49('0x5b')],{'firstName':_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')],'ListId':_0x513b13['id']});_0xd78e9f[_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x95')]]=_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')];return db[_0x4f49('0x76')]['create'](_0xd78e9f,{'fields':_0x19d565,'raw':!![]});}})[_0x4f49('0x35')](handleEntityNotFound(_0x377959,null))[_0x4f49('0x35')](function(_0x1d062b){if(_0x1d062b){_0x3abcfb[_0x4f49('0x9d')]=_0x1d062b;var _0x222b82={'ContactId':_0x1d062b['id'],'phone':_0x3abcfb[_0x4f49('0x5b')]['from'],'SmsAccountId':_0x38f392[_0x4f49('0x64')]['id']};var _0x3b84f9={'ContactId':_0x1d062b['id'],'SmsAccountId':_0x38f392[_0x4f49('0x64')]['id'],'closed':![]};return db[_0x4f49('0x9e')]['find']({'where':_0x3b84f9})[_0x4f49('0x35')](function(_0xcbe3c7){if(_0xcbe3c7){return[_0xcbe3c7,![]];}return db[_0x4f49('0x9e')][_0x4f49('0x5a')](_0x222b82)[_0x4f49('0x35')](function(_0x425efa){return[_0x425efa,!![]];});});}})[_0x4f49('0x9f')](function(_0x880068,_0x4ac6da){_0x3abcfb[_0x4f49('0xa0')]=_0x880068['get']({'plain':!![]});_0x3abcfb['interaction'][_0x4f49('0xa1')]=![];if(_0x4ac6da){if(_0x3abcfb[_0x4f49('0x71')][_0x4f49('0xa2')]){_0x3abcfb['applications'][_0x4f49('0xa3')]({'id':0x0,'priority':_0x3abcfb['applications'][_0x4f49('0x47')]+0x1,'app':_0x4f49('0xa4'),'appdata':_0x4f49('0xa5'),'interval':'*,*,*,*'});}_0x3abcfb['interaction'][_0x4f49('0xa1')]=!![];}return db[_0x4f49('0xa6')][_0x4f49('0x5a')]({'phone':_0x3abcfb['body'][_0x4f49('0x80')],'messageId':_0x3abcfb[_0x4f49('0x5b')]['messageId'],'body':_0x3abcfb['body'][_0x4f49('0x5b')],'SmsAccountId':_0x38f392[_0x4f49('0x64')]['id'],'SmsInteractionId':_0x880068['id'],'direction':'in','ContactId':_0x880068[_0x4f49('0xa7')],'AttachmentId':_0x3abcfb['body']['AttachmentId']});})[_0x4f49('0x35')](function(_0x40e5ae){_0x3abcfb[_0x4f49('0x26')]=_0x40e5ae;if(!_0x3abcfb[_0x4f49('0xa0')][_0x4f49('0xa8')])return;return db[_0x4f49('0xa9')][_0x4f49('0x59')]({'attributes':['id',_0x4f49('0x3a')],'where':{'id':_0x3abcfb[_0x4f49('0xa0')][_0x4f49('0xa8')]}});})[_0x4f49('0x35')](function(_0x40ec12){if(_0x40ec12){_0x3abcfb['applications'][_0x4f49('0xaa')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x40ec12[_0x4f49('0x3a')]+','+(_0x3abcfb[_0x4f49('0x71')][_0x4f49('0xab')]||0xa),'interval':_0x4f49('0xac')});}if(!_0x3abcfb[_0x4f49('0xa0')][_0x4f49('0xad')])return;return db[_0x4f49('0xae')][_0x4f49('0x59')]({'attributes':['id',_0x4f49('0x3a')],'where':{'id':_0x3abcfb[_0x4f49('0xa0')]['queueId']}});})[_0x4f49('0x35')](function(_0x290adc){if(_0x290adc){_0x3abcfb[_0x4f49('0x72')][_0x4f49('0xaa')]({'id':0x0,'priority':0x1,'app':_0x4f49('0xaf'),'appdata':_0x290adc[_0x4f49('0x3a')]+','+(_0x3abcfb['account'][_0x4f49('0xb0')]||0x12c),'interval':_0x4f49('0xac')});}return respondWithRpcPromise(_0x4f49('0xb1'),_0x4f49('0xb2'),_0x3abcfb);})[_0x4f49('0x35')](function(_0x347d69){if(_0x347d69){var _0x3c3c24=0xc8;var _0x4f8603=_0x4f49('0xb3');logger[_0x4f49('0x20')](_0x4f49('0xb4'),_0x4f8603,_0x3c3c24,'entity\x20found');logger[_0x4f49('0x22')](_0x4f49('0xb5'),_0x4f8603,_0x3c3c24,'entity\x20found',JSON['stringify'](_0x347d69));if(_0x3abcfb[_0x4f49('0x71')][_0x4f49('0x40')]===_0x4f49('0x7f')){return _0x377959[_0x4f49('0x29')](_0x3c3c24)[_0x4f49('0x30')](_0x4f49('0xb6'),_0x4f49('0xb7'))[_0x4f49('0x3b')](_0x4f49('0xb8'));}else{return _0x377959[_0x4f49('0x29')](_0x3c3c24)[_0x4f49('0x2b')](_0x347d69);}}})['catch'](handleError(_0x377959,null));};exports[_0x4f49('0xb9')]=function(_0x475f0e,_0x15f926){var _0x308108=_0x475f0e[_0x4f49('0x64')]['id'];var _0x43afc3=_0x475f0e[_0x4f49('0x5b')];var _0x25e3d5=0xc8;var _0x297d48=null;return db[_0x4f49('0xba')]['transaction']({'isolationLevel':db[_0x4f49('0xba')]['Transaction'][_0x4f49('0xbb')][_0x4f49('0xbc')]},function(_0x800d2e){return db[_0x4f49('0x3e')][_0x4f49('0x67')]({'where':{'id':_0x308108},'transaction':_0x800d2e})['then'](function(_0x100fde){if(_0x100fde){return db[_0x4f49('0xbd')][_0x4f49('0x37')]({'where':{'SmsAccountId':_0x308108},'transaction':_0x800d2e})[_0x4f49('0x35')](function(){var _0x566dd1=_[_0x4f49('0x3d')](_0x43afc3,function(_0x2240fc){_0x2240fc[_0x4f49('0x68')]=_0x308108;return _0x2240fc;});return db[_0x4f49('0xbd')][_0x4f49('0xbe')](_0x566dd1,{'transaction':_0x800d2e});});}else{_0x25e3d5=0x194;_0x297d48=[];}});})[_0x4f49('0x35')](function(){if(_0x25e3d5!==0x194){return db['SmsApplication'][_0x4f49('0xbf')]({'where':{'SmsAccountId':_0x308108},'order':_0x4f49('0x74')})[_0x4f49('0x35')](function(_0x4d39bc){_0x297d48=_0x4d39bc;});}})[_0x4f49('0x28')](function(_0x1dee3e){_0x25e3d5=0x1f4;logger[_0x4f49('0x24')](_0x1dee3e[_0x4f49('0x39')]);if(_0x1dee3e['name']){delete _0x1dee3e[_0x4f49('0x3a')];}_0x297d48=_0x1dee3e;})[_0x4f49('0xc0')](function(){if(_0x297d48===null){_0x15f926[_0x4f49('0x38')](_0x25e3d5);}else{if(_0x25e3d5===0x1f4){_0x15f926[_0x4f49('0x29')](_0x25e3d5)['send'](_0x297d48);}else{_0x15f926[_0x4f49('0x29')](_0x25e3d5)[_0x4f49('0x2b')](_0x297d48);}}});};exports[_0x4f49('0xc1')]=function(_0x17f9d6,_0x198d6c,_0x5a4986){var _0x4fc3c0={};var _0x4f0b72={};var _0x424f43;var _0x110a09;return db[_0x4f49('0x3e')][_0x4f49('0x67')]({'where':{'id':_0x17f9d6[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x198d6c,null))['then'](function(_0x16c14a){if(_0x16c14a){_0x424f43=_0x16c14a;_0x4f0b72['model']=_[_0x4f49('0x43')](db[_0x4f49('0xbd')][_0x4f49('0x3f')]);_0x4f0b72[_0x4f49('0x42')]=_[_0x4f49('0x43')](_0x17f9d6[_0x4f49('0x42')]);_0x4f0b72['filters']=_[_0x4f49('0x44')](_0x4f0b72[_0x4f49('0x41')],_0x4f0b72[_0x4f49('0x42')]);_0x4fc3c0[_0x4f49('0x46')]=_['intersection'](_0x4f0b72['model'],qs[_0x4f49('0x45')](_0x17f9d6[_0x4f49('0x42')][_0x4f49('0x45')]));_0x4fc3c0[_0x4f49('0x46')]=_0x4fc3c0[_0x4f49('0x46')][_0x4f49('0x47')]?_0x4fc3c0[_0x4f49('0x46')]:_0x4f0b72[_0x4f49('0x41')];_0x4fc3c0[_0x4f49('0x4a')]=qs[_0x4f49('0x4b')](_0x17f9d6[_0x4f49('0x42')][_0x4f49('0x4b')]);_0x4fc3c0[_0x4f49('0x4c')]=qs[_0x4f49('0x4d')](_[_0x4f49('0x4e')](_0x17f9d6[_0x4f49('0x42')],_0x4f0b72[_0x4f49('0x4d')]));if(_0x17f9d6[_0x4f49('0x42')][_0x4f49('0x50')]){_0x4fc3c0[_0x4f49('0x4c')]=_['merge'](_0x4fc3c0['where'],{'$or':_['map'](_0x4fc3c0[_0x4f49('0x46')],function(_0x5091fb){var _0x12545d={};_0x12545d[_0x5091fb]={'$like':'%'+_0x17f9d6[_0x4f49('0x42')]['filter']+'%'};return _0x12545d;})});}_0x4fc3c0=_[_0x4f49('0x58')]({},_0x4fc3c0,_0x17f9d6[_0x4f49('0x51')]);return _0x424f43[_0x4f49('0xc1')](_0x4fc3c0);}})[_0x4f49('0x35')](function(_0x4203cb){if(_0x4203cb){_0x110a09=_0x4203cb[_0x4f49('0x47')];if(!_0x17f9d6[_0x4f49('0x42')][_0x4f49('0x48')](_0x4f49('0x49'))){_0x4fc3c0[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x17f9d6[_0x4f49('0x42')]['limit']);_0x4fc3c0[_0x4f49('0x2c')]=qs[_0x4f49('0x2c')](_0x17f9d6['query'][_0x4f49('0x2c')]);}return _0x424f43[_0x4f49('0xc1')](_0x4fc3c0);}})[_0x4f49('0x35')](function(_0xf24c76){if(_0xf24c76){return _0xf24c76?{'count':_0x110a09,'rows':_0xf24c76}:null;}})[_0x4f49('0x35')](respondWithResult(_0x198d6c,null))[_0x4f49('0x28')](handleError(_0x198d6c,null));};exports[_0x4f49('0xc2')]=function(_0x284d51,_0x289a70,_0x9395dd){var _0x57730a={'raw':![],'where':{}};var _0x274b8b={};var _0x4cac08={'count':0x0,'rows':[]};return db[_0x4f49('0x3e')][_0x4f49('0x67')]({'where':{'id':_0x284d51[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x289a70,null))[_0x4f49('0x35')](function(_0x589e2a){if(_0x589e2a){_0x274b8b['model']=_[_0x4f49('0x43')](db[_0x4f49('0x9e')][_0x4f49('0x3f')]);_0x274b8b[_0x4f49('0x42')]=_[_0x4f49('0x43')](_0x284d51['query']);_0x274b8b[_0x4f49('0x4d')]=_[_0x4f49('0x44')](_0x274b8b[_0x4f49('0x41')],_0x274b8b['query']);_0x57730a[_0x4f49('0x46')]=_['intersection'](_0x274b8b[_0x4f49('0x41')],qs[_0x4f49('0x45')](_0x284d51[_0x4f49('0x42')]['fields']));_0x57730a[_0x4f49('0x46')]=_0x57730a[_0x4f49('0x46')][_0x4f49('0x47')]?_0x57730a[_0x4f49('0x46')]:_0x274b8b['model'];if(!_0x284d51[_0x4f49('0x42')][_0x4f49('0x48')](_0x4f49('0x49'))){_0x57730a[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x284d51['query'][_0x4f49('0x2d')]);_0x57730a[_0x4f49('0x2c')]=qs['offset'](_0x284d51['query'][_0x4f49('0x2c')]);}_0x57730a['order']=qs[_0x4f49('0x4b')](_0x284d51[_0x4f49('0x42')]['sort']);_0x57730a[_0x4f49('0x4c')]=qs['filters'](_[_0x4f49('0x4e')](_0x284d51['query'],_0x274b8b['filters']));_0x57730a[_0x4f49('0x4c')]['SmsAccountId']=_0x589e2a['id'];if(_0x284d51['query'][_0x4f49('0x50')]){_0x57730a['where']=_[_0x4f49('0x58')](_0x57730a['where'],{'$or':_[_0x4f49('0x3d')](_0x57730a[_0x4f49('0x46')],function(_0x1e4ff2){var _0xd7efa9={};_0xd7efa9[_0x1e4ff2]={'$like':'%'+_0x284d51[_0x4f49('0x42')][_0x4f49('0x50')]+'%'};return _0xd7efa9;})});}_0x57730a=_['merge']({},_0x57730a,_0x284d51['options']);return db[_0x4f49('0x9e')][_0x4f49('0x2f')]({'where':_0x57730a['where']})[_0x4f49('0x35')](function(_0x3a32eb){_0x4cac08[_0x4f49('0x2f')]=_0x3a32eb;if(_0x284d51['query'][_0x4f49('0x52')]){_0x57730a[_0x4f49('0x57')]=[{'model':db[_0x4f49('0x76')],'as':_0x4f49('0xc3'),'required':![]},{'model':db[_0x4f49('0xa9')],'as':_0x4f49('0xc4'),'attributes':[_0x4f49('0x3a'),'fullname',_0x4f49('0xc5')],'required':![]},{'model':db[_0x4f49('0xc6')],'as':_0x4f49('0xc7'),'attributes':['id','name',_0x4f49('0xc8')],'where':_0x284d51[_0x4f49('0x42')][_0x4f49('0xc9')]?{'id':_0x284d51[_0x4f49('0x42')][_0x4f49('0xc9')]}:undefined,'required':_0x284d51[_0x4f49('0x42')]['tag']?!![]:![]}];}return db[_0x4f49('0x9e')]['findAll'](_0x57730a);})[_0x4f49('0x35')](function(_0x2cd588){_0x4cac08[_0x4f49('0x54')]=_0x2cd588;return _0x4cac08;});}})[_0x4f49('0x35')](respondWithFilteredResult(_0x289a70,_0x57730a))[_0x4f49('0x28')](handleError(_0x289a70,null));};exports['send']=function(_0x3da596,_0x11ec64,_0x29a749){var _0x352571,_0x1a3857,_0xe9186f;if(_[_0x4f49('0x93')](_0x3da596[_0x4f49('0x5b')][_0x4f49('0x5b')])||_0x3da596[_0x4f49('0x5b')][_0x4f49('0x5b')]===''){throw new db[(_0x4f49('0x78'))][(_0x4f49('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4f49('0x93')](_0x3da596['body']['to'])){throw new db[(_0x4f49('0x78'))][(_0x4f49('0x79'))](_0x4f49('0xca'));}_0x352571=_0x3da596[_0x4f49('0x5b')]['to'];return db['SmsAccount'][_0x4f49('0x59')]({'where':{'id':_0x3da596[_0x4f49('0x64')]['id']},'include':[{'model':db['CmList'],'as':_0x4f49('0xcb'),'include':[{'model':db[_0x4f49('0x76')],'as':'Contacts','where':{'mobile':_0x352571},'limit':0x1,'order':[[_0x4f49('0x7d'),_0x4f49('0x9b')]]}]}]})[_0x4f49('0x35')](handleEntityNotFound(_0x11ec64,null))[_0x4f49('0x35')](function(_0x3a732e){if(_0x3a732e&&_0x3a732e['List']){_0x1a3857=_0x3a732e[_0x4f49('0x5d')]({'plain':!![]});if(_0x1a3857[_0x4f49('0xcb')]&&_0x1a3857[_0x4f49('0xcb')][_0x4f49('0x9a')][_0x4f49('0x47')]){return _0x1a3857['List'][_0x4f49('0x9a')][0x0];}return db[_0x4f49('0x76')][_0x4f49('0x5a')](_['defaults'](_0x3da596['body'],{'firstName':_0x352571,'mobile':_0x352571,'phone':_0x352571,'ListId':_0x1a3857[_0x4f49('0x99')]}));}})['then'](handleEntityNotFound(_0x11ec64,null))[_0x4f49('0x35')](function(_0x4850d9){if(_0x4850d9){_0xe9186f=_0x4850d9;return db['SmsInteraction']['find']({'where':{'ContactId':_0xe9186f['id'],'closed':![],'SmsAccountId':_0x1a3857['id']}})[_0x4f49('0x35')](function(_0x116565){if(_0x116565){return[_0x116565,![]];}return db['SmsInteraction']['create']({'UserId':_0x3da596[_0x4f49('0x5c')]['id'],'ContactId':_0xe9186f['id'],'SmsAccountId':_0x1a3857['id'],'phone':_0x352571,'firstMsgDirection':'out','Messages':[_[_0x4f49('0x58')](_0x3da596[_0x4f49('0x5b')],{'read':![],'body':_0x3da596[_0x4f49('0x5b')][_0x4f49('0x5b')],'phone':_0x352571,'SmsAccountId':_0x1a3857['id'],'UserId':_0x3da596['user']['id'],'ContactId':_0xe9186f['id']})]},{'include':[{'model':db[_0x4f49('0xa6')],'as':_0x4f49('0xcc')}]})[_0x4f49('0x35')](function(_0x2c0f06){return[_0x2c0f06,!![]];});});}})[_0x4f49('0x9f')](function(_0x4ac28d,_0x29f477){if(_0x29f477){return _0x4ac28d;}return db[_0x4f49('0xa6')][_0x4f49('0x5a')](_[_0x4f49('0x58')](_0x3da596[_0x4f49('0x5b')],{'read':![],'body':_0x3da596[_0x4f49('0x5b')][_0x4f49('0x5b')],'phone':_0x352571,'SmsAccountId':_0x1a3857['id'],'SmsInteractionId':_0x4ac28d['id'],'UserId':_0x3da596['user']['id'],'ContactId':_0xe9186f['id']}))[_0x4f49('0x35')](function(_0x244ea7){_0x4ac28d['dataValues'][_0x4f49('0xcc')]=[];_0x4ac28d[_0x4f49('0xcd')][_0x4f49('0xcc')][_0x4f49('0xa3')](_0x244ea7[_0x4f49('0xcd')]);return _0x4ac28d;});})[_0x4f49('0x35')](respondWithResult(_0x11ec64,null))[_0x4f49('0x28')](handleError(_0x11ec64,null));};exports[_0x4f49('0x29')]=function(_0xcf35e3,_0x4c0ff9,_0x3a1d5f){if(_0xcf35e3['body']['id']){delete _0xcf35e3[_0x4f49('0x5b')]['id'];}var _0x2a218f,_0x34b261,_0x276624;return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0xcf35e3[_0x4f49('0x64')]['id']}})['then'](handleEntityNotFound(_0x4c0ff9,null))[_0x4f49('0x35')](function(_0x576acf){if(_0x576acf){_0x276624=_0x576acf;logger[_0x4f49('0x22')](_0x4f49('0xb4'),_0x4f49('0x29'),'received\x20delivery\x20report\x20from',_0x576acf['type'],util['inspect'](_0xcf35e3[_0x4f49('0x5b')],{'showHidden':![],'depth':null}));switch(_0x576acf['type']){case _0x4f49('0x84'):if(_0xcf35e3['body'][_0x4f49('0xce')]&&_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0x29')]){_0x34b261=_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0x29')];return db[_0x4f49('0xa6')][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xce')]}});}break;case _0x4f49('0x87'):if(_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xcf')]&&_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xd0')]){_0x34b261=_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xd0')];return db['SmsMessage'][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xcf')]}});}break;case'clicksend':if(_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xd1')]&&_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xd2')]){_0x34b261=_0xcf35e3['body'][_0x4f49('0xd2')];return db['SmsMessage'][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')]['message_id']}});}break;case _0x4f49('0x8b'):var _0x2a524d=_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0x8c')][0x0];if(_0x2a524d[_0x4f49('0x82')]&&_0x2a524d['status'][_0x4f49('0xd3')]===_0x4f49('0xd4')){_0x34b261=_0x2a524d[_0x4f49('0x29')]['groupName'];return db[_0x4f49('0xa6')][_0x4f49('0x59')]({'where':{'messageId':_0x2a524d[_0x4f49('0x82')]}});}break;case _0x4f49('0x8e'):if(_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0x82')]&&_0xcf35e3['body'][_0x4f49('0x29')]){_0x34b261=_0xcf35e3[_0x4f49('0x5b')]['status'];return db[_0x4f49('0xa6')][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')]['messageId']}});}break;case _0x4f49('0x8f'):if(_0xcf35e3[_0x4f49('0x5b')][0x0][_0x4f49('0x26')]['id']){_0x34b261=_0xcf35e3[_0x4f49('0x5b')][0x0][_0x4f49('0x40')];return db[_0x4f49('0xa6')][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')][0x0]['message']['id']}});}break;case _0x4f49('0x90'):if(_0xcf35e3['body'][_0x4f49('0xd5')]&&_0xcf35e3['body'][_0x4f49('0x29')]){_0x34b261=_0xcf35e3[_0x4f49('0x5b')]['status'];return db['SmsMessage'][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x4c0ff9,null))[_0x4f49('0x35')](function(_0x3af41d){if(_0x3af41d){_0x2a218f=_0x3af41d;switch(_0x276624['type']){case _0x4f49('0x84'):if(_0x34b261===_0x4f49('0xd4')){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger['error'](_0x4f49('0xb4'),_0x4f49('0x29'),_0x4f49('0x84'),util[_0x4f49('0xd6')](_0xcf35e3['body'],{'showHidden':![],'depth':null}));}break;case _0x4f49('0x87'):if(_0x34b261==='1'){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger[_0x4f49('0x24')](_0x4f49('0xb4'),'status',_0x4f49('0x84'),util[_0x4f49('0xd6')](_0xcf35e3[_0x4f49('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4f49('0x88'):if(!_0xcf35e3['body']['error_code']&&_0x34b261>=0xc8&&_0x34b261<=0xce){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger[_0x4f49('0x24')](_0x4f49('0xb4'),_0x4f49('0x29'),_0x4f49('0x88'),util[_0x4f49('0xd6')](_0xcf35e3[_0x4f49('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x55c002=_0xcf35e3['body'][_0x4f49('0x8c')][0x0];if(_0x55c002['status']['groupName']===_0x4f49('0xd4')){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger[_0x4f49('0x24')](_0x4f49('0xb4'),'status',_0x4f49('0x8b'),util['inspect'](_0xcf35e3['body'],{'showHidden':![],'depth':null}));}break;case _0x4f49('0x8e'):if(_0x34b261==_0x4f49('0xd7')||_0x34b261==_0x4f49('0xd8')){return _0x2a218f['update']({'read':!![]});}else{logger[_0x4f49('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4f49('0x29'),_0x4f49('0x8e'),util['inspect'](_0xcf35e3[_0x4f49('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4f49('0x8f'):if(_0x34b261==_0x4f49('0xd9')){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger[_0x4f49('0x24')](_0x4f49('0xb4'),_0x4f49('0x29'),_0x4f49('0x8f'),util[_0x4f49('0xd6')](_0xcf35e3[_0x4f49('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4f49('0x90'):if(_0x34b261===_0x4f49('0xda')||_0x34b261==='ACCEPTD'){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger['error'](_0x4f49('0xb4'),_0x4f49('0x29'),_0x4f49('0x90'),util[_0x4f49('0xd6')](_0xcf35e3['body'],{'showHidden':![],'depth':null}));}break;}return _0x2a218f;}})[_0x4f49('0x35')](respondWithResult(_0x4c0ff9,null))[_0x4f49('0x28')](handleError(_0x4c0ff9,null));};exports[_0x4f49('0xdb')]=function(_0x595524,_0x551ba8,_0x4d15be){var _0x4851ec,_0x22c16a,_0x432378;return db['SmsAccount'][_0x4f49('0x59')]({'where':{'id':_0x595524[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x551ba8,null))[_0x4f49('0x35')](function(_0x580764){if(_0x580764){_0x432378=_0x580764;logger[_0x4f49('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4f49('0xdc'),_0x580764[_0x4f49('0x40')],util[_0x4f49('0xd6')](_0x595524[_0x4f49('0x42')],{'showHidden':![],'depth':null}));switch(_0x580764[_0x4f49('0x40')]){case _0x4f49('0xdd'):if(_0x595524[_0x4f49('0x42')][_0x4f49('0xde')]&&_0x595524[_0x4f49('0x42')][_0x4f49('0xdf')]){_0x22c16a=_0x595524['query']['state'];return db[_0x4f49('0xa6')]['find']({'where':{'messageId':_0x595524[_0x4f49('0x42')][_0x4f49('0xde')]}});}break;}}})[_0x4f49('0x35')](handleEntityNotFound(_0x551ba8,null))[_0x4f49('0x35')](function(_0x4c590f){if(_0x4c590f){_0x4851ec=_0x4c590f;switch(_0x432378['type']){case'csc':if(_0x22c16a==='2'||_0x22c16a==='6'){return _0x4851ec[_0x4f49('0x63')]({'read':!![]});}else{logger[_0x4f49('0x24')](_0x4f49('0xb4'),_0x4f49('0x29'),'csc',util[_0x4f49('0xd6')](_0x595524[_0x4f49('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x4851ec;}})['then'](respondWithResult(_0x551ba8,null))[_0x4f49('0x28')](handleError(_0x551ba8,null));};exports[_0x4f49('0xe0')]=function(_0x155211,_0x4c9d01,_0x432349){return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x155211[_0x4f49('0x64')]['id']}})['then'](handleEntityNotFound(_0x4c9d01,null))[_0x4f49('0x35')](function(_0x2390db){if(_0x2390db){return _0x2390db[_0x4f49('0xe0')](_0x155211[_0x4f49('0x5b')]['ids'],_['omit'](_0x155211['body'],[_0x4f49('0x6a'),'id'])||{})[_0x4f49('0x9f')](function(_0x4cf0b8){for(var _0xa21e81=0x0;_0xa21e81<_0x155211[_0x4f49('0x5b')][_0x4f49('0x6a')][_0x4f49('0x47')];_0xa21e81+=0x1){socket['emit'](_0x4f49('0xe1'),{'UserId':Number(_0x155211[_0x4f49('0x5b')]['ids'][_0xa21e81]),'SmsAccountId':Number(_0x155211['params']['id'])});}return _0x4cf0b8;});}})[_0x4f49('0x35')](respondWithResult(_0x4c9d01,null))[_0x4f49('0x28')](handleError(_0x4c9d01,null));};exports[_0x4f49('0xe2')]=function(_0x573f32,_0x182108,_0x366523){return db['SmsAccount']['find']({'where':{'id':_0x573f32[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x182108,null))[_0x4f49('0x35')](function(_0x2b4b39){if(_0x2b4b39){return _0x2b4b39[_0x4f49('0xe2')](_0x573f32[_0x4f49('0x42')][_0x4f49('0x6a')])['then'](function(){if(_['isArray'](_0x573f32[_0x4f49('0x42')][_0x4f49('0x6a')])){for(var _0xa6b4c0=0x0;_0xa6b4c0<_0x573f32[_0x4f49('0x42')][_0x4f49('0x6a')][_0x4f49('0x47')];_0xa6b4c0+=0x1){socket[_0x4f49('0xe3')]('userSmsAccount:remove',{'UserId':Number(_0x573f32['query'][_0x4f49('0x6a')][_0xa6b4c0]),'SmsAccountId':Number(_0x573f32[_0x4f49('0x64')]['id'])});}}else{socket[_0x4f49('0xe3')]('userSmsAccount:remove',{'UserId':Number(_0x573f32[_0x4f49('0x42')][_0x4f49('0x6a')]),'SmsAccountId':Number(_0x573f32[_0x4f49('0x64')]['id'])});}});}})[_0x4f49('0x35')](respondWithStatusCode(_0x182108,null))[_0x4f49('0x28')](handleError(_0x182108,null));};exports[_0x4f49('0xe4')]=function(_0x463cf7,_0x3f3304,_0x54f609){var _0x47f3c6={};var _0xae49c2={};var _0x3ea9ba;var _0xa14468;return db['SmsAccount']['findOne']({'where':{'id':_0x463cf7['params']['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x3f3304,null))[_0x4f49('0x35')](function(_0x6a48cb){if(_0x6a48cb){_0x3ea9ba=_0x6a48cb;_0xae49c2['model']=_[_0x4f49('0x43')](db['User'][_0x4f49('0x3f')]);_0xae49c2[_0x4f49('0x42')]=_[_0x4f49('0x43')](_0x463cf7['query']);_0xae49c2[_0x4f49('0x4d')]=_[_0x4f49('0x44')](_0xae49c2[_0x4f49('0x41')],_0xae49c2[_0x4f49('0x42')]);_0x47f3c6[_0x4f49('0x46')]=_['intersection'](_0xae49c2[_0x4f49('0x41')],qs[_0x4f49('0x45')](_0x463cf7[_0x4f49('0x42')][_0x4f49('0x45')]));_0x47f3c6[_0x4f49('0x46')]=_0x47f3c6[_0x4f49('0x46')][_0x4f49('0x47')]?_0x47f3c6['attributes']:_0xae49c2[_0x4f49('0x41')];_0x47f3c6[_0x4f49('0x4a')]=qs[_0x4f49('0x4b')](_0x463cf7[_0x4f49('0x42')][_0x4f49('0x4b')]);_0x47f3c6[_0x4f49('0x4c')]=qs[_0x4f49('0x4d')](_['pick'](_0x463cf7[_0x4f49('0x42')],_0xae49c2[_0x4f49('0x4d')]));if(_0x463cf7[_0x4f49('0x42')]['filter']){_0x47f3c6['where']=_[_0x4f49('0x58')](_0x47f3c6[_0x4f49('0x4c')],{'$or':_[_0x4f49('0x3d')](_0x47f3c6['attributes'],function(_0x296aee){var _0x4f5543={};_0x4f5543[_0x296aee]={'$like':'%'+_0x463cf7[_0x4f49('0x42')][_0x4f49('0x50')]+'%'};return _0x4f5543;})});}_0x47f3c6=_[_0x4f49('0x58')]({},_0x47f3c6,_0x463cf7[_0x4f49('0x51')]);return _0x3ea9ba[_0x4f49('0xe4')](_0x47f3c6);}})[_0x4f49('0x35')](function(_0x1be056){if(_0x1be056){_0xa14468=_0x1be056[_0x4f49('0x47')];if(!_0x463cf7[_0x4f49('0x42')][_0x4f49('0x48')](_0x4f49('0x49'))){_0x47f3c6[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x463cf7[_0x4f49('0x42')][_0x4f49('0x2d')]);_0x47f3c6[_0x4f49('0x2c')]=qs[_0x4f49('0x2c')](_0x463cf7[_0x4f49('0x42')][_0x4f49('0x2c')]);}return _0x3ea9ba[_0x4f49('0xe4')](_0x47f3c6);}})['then'](function(_0x1c1c08){if(_0x1c1c08){return _0x1c1c08?{'count':_0xa14468,'rows':_0x1c1c08}:null;}})['then'](respondWithResult(_0x3f3304,null))[_0x4f49('0x28')](handleError(_0x3f3304,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 631bec7..cddb576 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 _0x6995=['../../mysqldb','SmsAccount','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x55e48d,_0x24dd15){var _0x166daa=function(_0x32359a){while(--_0x32359a){_0x55e48d['push'](_0x55e48d['shift']());}};_0x166daa(++_0x24dd15);}(_0x6995,0xc5));var _0x5699=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6995[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x5699('0x0'));var SmsAccount=require(_0x5699('0x1'))['db'][_0x5699('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5699('0x3'),'afterUpdate':_0x5699('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3442c5){return function(_0x1d514f,_0x203227,_0x123f92){SmsAccountEvents[_0x5699('0x5')](_0x3442c5+':'+_0x1d514f['id'],_0x1d514f);SmsAccountEvents[_0x5699('0x5')](_0x3442c5,_0x1d514f);_0x123f92(null);};}for(var e in events){if(events[_0x5699('0x6')](e)){var event=events[e];SmsAccount[_0x5699('0x7')](e,emitEvent(event));}}module[_0x5699('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x7843=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','hook','exports','events'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0x7843,0xe0));var _0x3784=function(_0x31a7ac,_0xe27f3b){_0x31a7ac=_0x31a7ac-0x0;var _0x32014a=_0x7843[_0x31a7ac];return _0x32014a;};'use strict';var EventEmitter=require(_0x3784('0x0'));var SmsAccount=require(_0x3784('0x1'))['db'][_0x3784('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3784('0x3')](0x0);var events={'afterCreate':_0x3784('0x4'),'afterUpdate':_0x3784('0x5'),'afterDestroy':_0x3784('0x6')};function emitEvent(_0x4fe6b7){return function(_0x986458,_0x375c53,_0x4cc6e0){SmsAccountEvents['emit'](_0x4fe6b7+':'+_0x986458['id'],_0x986458);SmsAccountEvents['emit'](_0x4fe6b7,_0x986458);_0x4cc6e0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x3784('0x7')](e,emitEvent(event));}}module[_0x3784('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 5696cf8..e015888 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 _0xe532=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4e9935,_0x55214b){var _0x53d374=function(_0x14757e){while(--_0x14757e){_0x4e9935['push'](_0x4e9935['shift']());}};_0x53d374(++_0x55214b);}(_0xe532,0x1ce));var _0x2e53=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0xe532[_0x548627];return _0x844a84;};'use strict';var _=require(_0x2e53('0x0'));var util=require(_0x2e53('0x1'));var logger=require(_0x2e53('0x2'))(_0x2e53('0x3'));var moment=require(_0x2e53('0x4'));var BPromise=require(_0x2e53('0x5'));var rp=require(_0x2e53('0x6'));var fs=require('fs');var path=require(_0x2e53('0x7'));var rimraf=require(_0x2e53('0x8'));var config=require(_0x2e53('0x9'));var attributes=require(_0x2e53('0xa'));module[_0x2e53('0xb')]=function(_0x1a2d1,_0x57dcb3){return _0x1a2d1[_0x2e53('0xc')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cd8=['request-promise','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','api','moment'];(function(_0x51a5c3,_0x424d62){var _0x5f43b8=function(_0x4ecaad){while(--_0x4ecaad){_0x51a5c3['push'](_0x51a5c3['shift']());}};_0x5f43b8(++_0x424d62);}(_0x0cd8,0x1f4));var _0x80cd=function(_0x1392a7,_0xac8ca0){_0x1392a7=_0x1392a7-0x0;var _0x9d762d=_0x0cd8[_0x1392a7];return _0x9d762d;};'use strict';var _=require(_0x80cd('0x0'));var util=require(_0x80cd('0x1'));var logger=require('../../config/logger')(_0x80cd('0x2'));var moment=require(_0x80cd('0x3'));var BPromise=require('bluebird');var rp=require(_0x80cd('0x4'));var fs=require('fs');var path=require(_0x80cd('0x5'));var rimraf=require(_0x80cd('0x6'));var config=require('../../config/environment');var attributes=require(_0x80cd('0x7'));module[_0x80cd('0x8')]=function(_0x3bbc14,_0x4b7a3a){return _0x3bbc14[_0x80cd('0x9')](_0x80cd('0xa'),attributes,{'tableName':_0x80cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 6b69180..e67d96c 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 _0x8db2=['model','attributes','debug','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','ShowSmsAccount','find','options','raw','where','include','map'];(function(_0x3e6324,_0x31a551){var _0x2603f1=function(_0x1ec74c){while(--_0x1ec74c){_0x3e6324['push'](_0x3e6324['shift']());}};_0x2603f1(++_0x31a551);}(_0x8db2,0x13d));var _0x28db=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x8db2[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x28db('0x0'));var util=require(_0x28db('0x1'));var moment=require('moment');var BPromise=require(_0x28db('0x2'));var rs=require(_0x28db('0x3'));var fs=require('fs');var Redis=require(_0x28db('0x4'));var db=require(_0x28db('0x5'))['db'];var utils=require(_0x28db('0x6'));var logger=require(_0x28db('0x7'))(_0x28db('0x8'));var config=require(_0x28db('0x9'));var jayson=require(_0x28db('0xa'));var client=jayson[_0x28db('0xb')][_0x28db('0xc')]({'port':0x232a});config[_0x28db('0xd')]=_[_0x28db('0xe')](config[_0x28db('0xd')],{'host':_0x28db('0xf'),'port':0x18eb});var socket=require(_0x28db('0x10'))(new Redis(config[_0x28db('0xd')]));require(_0x28db('0x11'))[_0x28db('0x12')](socket);function respondWithRpcPromise(_0x38839,_0x4c11e1,_0x2ed279){return new BPromise(function(_0x5eeb2c,_0x517107){return client[_0x28db('0x13')](_0x38839,_0x2ed279)[_0x28db('0x14')](function(_0x14f42d){logger[_0x28db('0x15')](_0x28db('0x16'),_0x4c11e1,'request\x20sent');logger['debug'](_0x28db('0x17'),_0x4c11e1,_0x28db('0x18'),JSON['stringify'](_0x14f42d));if(_0x14f42d['error']){if(_0x14f42d['error']['code']===0x1f4){logger[_0x28db('0x19')]('SmsAccount,\x20%s,\x20%s',_0x4c11e1,_0x14f42d[_0x28db('0x19')][_0x28db('0x1a')]);return _0x517107(_0x14f42d[_0x28db('0x19')][_0x28db('0x1a')]);}logger['error'](_0x28db('0x16'),_0x4c11e1,_0x14f42d[_0x28db('0x19')][_0x28db('0x1a')]);return _0x5eeb2c(_0x14f42d[_0x28db('0x19')]['message']);}else{logger[_0x28db('0x15')](_0x28db('0x16'),_0x4c11e1,'request\x20sent');_0x5eeb2c(_0x14f42d['result'][_0x28db('0x1a')]);}})['catch'](function(_0x1ad4ee){logger[_0x28db('0x19')](_0x28db('0x16'),_0x4c11e1,_0x1ad4ee);_0x517107(_0x1ad4ee);});});}exports[_0x28db('0x1b')]=function(_0xcc5c19){var _0x1483fe=this;return new Promise(function(_0x55569d,_0x294b74){return db['SmsAccount'][_0x28db('0x1c')]({'raw':_0xcc5c19[_0x28db('0x1d')]?_0xcc5c19[_0x28db('0x1d')][_0x28db('0x1e')]===undefined?!![]:![]:!![],'where':_0xcc5c19['options']?_0xcc5c19[_0x28db('0x1d')][_0x28db('0x1f')]||null:null,'attributes':_0xcc5c19[_0x28db('0x1d')]?_0xcc5c19[_0x28db('0x1d')]['attributes']||null:null,'include':_0xcc5c19['options']?_0xcc5c19[_0x28db('0x1d')][_0x28db('0x20')]?_[_0x28db('0x21')](_0xcc5c19[_0x28db('0x1d')][_0x28db('0x20')],function(_0x28cbe8){return{'model':db[_0x28cbe8[_0x28db('0x22')]],'as':_0x28cbe8['as'],'attributes':_0x28cbe8[_0x28db('0x23')],'include':_0x28cbe8[_0x28db('0x20')]?_[_0x28db('0x21')](_0x28cbe8['include'],function(_0x16ddb3){return{'model':db[_0x16ddb3[_0x28db('0x22')]],'as':_0x16ddb3['as'],'attributes':_0x16ddb3[_0x28db('0x23')],'include':_0x16ddb3[_0x28db('0x20')]?_[_0x28db('0x21')](_0x16ddb3[_0x28db('0x20')],function(_0x2fb18f){return{'model':db[_0x2fb18f['model']],'as':_0x2fb18f['as'],'attributes':_0x2fb18f[_0x28db('0x23')]};}):[]};}):[]};}):[]:[]})[_0x28db('0x14')](function(_0x3b32e0){logger['info'](_0x28db('0x1b'),_0xcc5c19);logger[_0x28db('0x24')]('ShowSmsAccount',_0xcc5c19,JSON[_0x28db('0x25')](_0x3b32e0));_0x55569d(_0x3b32e0);})[_0x28db('0x26')](function(_0x467c2a){logger['error'](_0x28db('0x1b'),_0x467c2a[_0x28db('0x1a')],_0xcc5c19);_0x294b74(_0x1483fe['error'](0x1f4,_0x467c2a[_0x28db('0x1a')]));});});}; \ No newline at end of file +var _0xba89=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','socket.io-emitter','./smsAccount.socket','register','then','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1f7b96,_0x3b68c3){var _0x6363e7=function(_0x209835){while(--_0x209835){_0x1f7b96['push'](_0x1f7b96['shift']());}};_0x6363e7(++_0x3b68c3);}(_0xba89,0x7c));var _0x9ba8=function(_0x3f6ed8,_0x1ac76b){_0x3f6ed8=_0x3f6ed8-0x0;var _0x5b6a94=_0xba89[_0x3f6ed8];return _0x5b6a94;};'use strict';var _=require(_0x9ba8('0x0'));var util=require(_0x9ba8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ba8('0x2'));var db=require(_0x9ba8('0x3'))['db'];var utils=require(_0x9ba8('0x4'));var logger=require(_0x9ba8('0x5'))(_0x9ba8('0x6'));var config=require('../../config/environment');var jayson=require(_0x9ba8('0x7'));var client=jayson[_0x9ba8('0x8')]['http']({'port':0x232a});config['redis']=_[_0x9ba8('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9ba8('0xa'))(new Redis(config['redis']));require(_0x9ba8('0xb'))[_0x9ba8('0xc')](socket);function respondWithRpcPromise(_0x5077c9,_0x162eb2,_0x3f4b47){return new BPromise(function(_0x68afa5,_0x13b4a5){return client['request'](_0x5077c9,_0x3f4b47)[_0x9ba8('0xd')](function(_0x1652a1){logger['info'](_0x9ba8('0xe'),_0x162eb2,_0x9ba8('0xf'));logger['debug'](_0x9ba8('0x10'),_0x162eb2,_0x9ba8('0xf'),JSON[_0x9ba8('0x11')](_0x1652a1));if(_0x1652a1[_0x9ba8('0x12')]){if(_0x1652a1['error'][_0x9ba8('0x13')]===0x1f4){logger[_0x9ba8('0x12')]('SmsAccount,\x20%s,\x20%s',_0x162eb2,_0x1652a1[_0x9ba8('0x12')][_0x9ba8('0x14')]);return _0x13b4a5(_0x1652a1['error'][_0x9ba8('0x14')]);}logger['error'](_0x9ba8('0xe'),_0x162eb2,_0x1652a1[_0x9ba8('0x12')]['message']);return _0x68afa5(_0x1652a1['error'][_0x9ba8('0x14')]);}else{logger[_0x9ba8('0x15')](_0x9ba8('0xe'),_0x162eb2,_0x9ba8('0xf'));_0x68afa5(_0x1652a1[_0x9ba8('0x16')][_0x9ba8('0x14')]);}})[_0x9ba8('0x17')](function(_0x393ce8){logger[_0x9ba8('0x12')](_0x9ba8('0xe'),_0x162eb2,_0x393ce8);_0x13b4a5(_0x393ce8);});});}exports[_0x9ba8('0x18')]=function(_0x18d63f){var _0x29b4e3=this;return new Promise(function(_0x270376,_0x5d2201){return db[_0x9ba8('0x19')][_0x9ba8('0x1a')]({'raw':_0x18d63f['options']?_0x18d63f[_0x9ba8('0x1b')][_0x9ba8('0x1c')]===undefined?!![]:![]:!![],'where':_0x18d63f[_0x9ba8('0x1b')]?_0x18d63f[_0x9ba8('0x1b')][_0x9ba8('0x1d')]||null:null,'attributes':_0x18d63f[_0x9ba8('0x1b')]?_0x18d63f[_0x9ba8('0x1b')][_0x9ba8('0x1e')]||null:null,'include':_0x18d63f[_0x9ba8('0x1b')]?_0x18d63f[_0x9ba8('0x1b')][_0x9ba8('0x1f')]?_[_0x9ba8('0x20')](_0x18d63f[_0x9ba8('0x1b')][_0x9ba8('0x1f')],function(_0x5ad07a){return{'model':db[_0x5ad07a[_0x9ba8('0x21')]],'as':_0x5ad07a['as'],'attributes':_0x5ad07a[_0x9ba8('0x1e')],'include':_0x5ad07a[_0x9ba8('0x1f')]?_[_0x9ba8('0x20')](_0x5ad07a[_0x9ba8('0x1f')],function(_0x144e9e){return{'model':db[_0x144e9e[_0x9ba8('0x21')]],'as':_0x144e9e['as'],'attributes':_0x144e9e[_0x9ba8('0x1e')],'include':_0x144e9e[_0x9ba8('0x1f')]?_[_0x9ba8('0x20')](_0x144e9e[_0x9ba8('0x1f')],function(_0x3bbfcd){return{'model':db[_0x3bbfcd[_0x9ba8('0x21')]],'as':_0x3bbfcd['as'],'attributes':_0x3bbfcd[_0x9ba8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9ba8('0xd')](function(_0x509d36){logger[_0x9ba8('0x15')]('ShowSmsAccount',_0x18d63f);logger[_0x9ba8('0x22')](_0x9ba8('0x18'),_0x18d63f,JSON[_0x9ba8('0x11')](_0x509d36));_0x270376(_0x509d36);})[_0x9ba8('0x17')](function(_0x32d6b3){logger[_0x9ba8('0x12')](_0x9ba8('0x18'),_0x32d6b3[_0x9ba8('0x14')],_0x18d63f);_0x5d2201(_0x29b4e3[_0x9ba8('0x12')](0x1f4,_0x32d6b3[_0x9ba8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 09d5591..b6c0b3e 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 e07ca01..5343e30 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x23a216,_0x58097f){var _0x4d0c86=function(_0x5bcd43){while(--_0x5bcd43){_0x23a216['push'](_0x23a216['shift']());}};_0x4d0c86(++_0x58097f);}(_0x3e74,0x175));var _0x43e7=function(_0x4ab407,_0x5eb24b){_0x4ab407=_0x4ab407-0x0;var _0x353683=_0x3e74[_0x4ab407];return _0x353683;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x16bfae,_0x36ed25){var _0x3870f5=function(_0x5ae24a){while(--_0x5ae24a){_0x16bfae['push'](_0x16bfae['shift']());}};_0x3870f5(++_0x36ed25);}(_0x34e8,0x12c));var _0x834e=function(_0x317d63,_0x2a36bd){_0x317d63=_0x317d63-0x0;var _0x43b1ef=_0x34e8[_0x317d63];return _0x43b1ef;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index baa1aec..a857a47 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 _0xbae0=['exports','INTEGER','STRING','TEXT','sequelize'];(function(_0x49f4ee,_0x2d4f3c){var _0x5f5dff=function(_0x47c547){while(--_0x47c547){_0x49f4ee['push'](_0x49f4ee['shift']());}};_0x5f5dff(++_0x2d4f3c);}(_0xbae0,0x77));var _0x0bae=function(_0x1caf3f,_0x1b4800){_0x1caf3f=_0x1caf3f-0x0;var _0x1905f0=_0xbae0[_0x1caf3f];return _0x1905f0;};'use strict';var Sequelize=require(_0x0bae('0x0'));module[_0x0bae('0x1')]={'priority':{'type':Sequelize[_0x0bae('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0bae('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0bae('0x4')]()},'description':{'type':Sequelize[_0x0bae('0x3')]},'interval':{'type':Sequelize[_0x0bae('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x78d8=['noop','STRING','exports'];(function(_0x3d4603,_0x3c7f76){var _0x24561f=function(_0x23e4a7){while(--_0x23e4a7){_0x3d4603['push'](_0x3d4603['shift']());}};_0x24561f(++_0x3c7f76);}(_0x78d8,0xad));var _0x878d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x78d8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x878d('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x878d('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x878d('0x2')]},'interval':{'type':Sequelize[_0x878d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index ebc3e15..0cecb3d 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 _0x9562=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','keys','length','find','catch','create','body','params','eml-format','rimraf','request-promise','moment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9562,0x92));var _0x2956=function(_0x2e6f04,_0x138e02){_0x2e6f04=_0x2e6f04-0x0;var _0x31e495=_0x9562[_0x2e6f04];return _0x31e495;};'use strict';var emlformat=require(_0x2956('0x0'));var rimraf=require(_0x2956('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2956('0x2'));var moment=require(_0x2956('0x3'));var BPromise=require(_0x2956('0x4'));var Mustache=require(_0x2956('0x5'));var util=require(_0x2956('0x6'));var path=require('path');var sox=require(_0x2956('0x7'));var csv=require(_0x2956('0x8'));var ejs=require(_0x2956('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2956('0xa'));var squel=require(_0x2956('0xb'));var crypto=require(_0x2956('0xc'));var jsforce=require(_0x2956('0xd'));var deskjs=require(_0x2956('0xe'));var toCsv=require(_0x2956('0x8'));var querystring=require(_0x2956('0xf'));var Papa=require(_0x2956('0x10'));var Redis=require('ioredis');var authService=require(_0x2956('0x11'));var qs=require(_0x2956('0x12'));var as=require(_0x2956('0x13'));var hardwareService=require(_0x2956('0x14'));var logger=require(_0x2956('0x15'))(_0x2956('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2956('0x17'));var db=require(_0x2956('0x18'))['db'];function respondWithStatusCode(_0x2f7e8b,_0x253a66){_0x253a66=_0x253a66||0xcc;return function(_0x174fcd){if(_0x174fcd){return _0x2f7e8b['sendStatus'](_0x253a66);}return _0x2f7e8b['status'](_0x253a66)[_0x2956('0x19')]();};}function respondWithResult(_0x4d84fe,_0x90320e){_0x90320e=_0x90320e||0xc8;return function(_0x55c8a0){if(_0x55c8a0){return _0x4d84fe[_0x2956('0x1a')](_0x90320e)['json'](_0x55c8a0);}};}function respondWithFilteredResult(_0x33686e,_0x2f97b4){return function(_0x314ab7){if(_0x314ab7){var _0x2d0a99=typeof _0x2f97b4[_0x2956('0x1b')]==='undefined'&&typeof _0x2f97b4['limit']===_0x2956('0x1c');var _0x5f4ce5=_0x314ab7[_0x2956('0x1d')];var _0x1fe7f0=_0x2d0a99?0x0:_0x2f97b4[_0x2956('0x1b')];var _0x59fdc8=_0x2d0a99?_0x314ab7[_0x2956('0x1d')]:_0x2f97b4[_0x2956('0x1b')]+_0x2f97b4[_0x2956('0x1e')];var _0x49731a;if(_0x59fdc8>=_0x5f4ce5){_0x59fdc8=_0x5f4ce5;_0x49731a=0xc8;}else{_0x49731a=0xce;}_0x33686e[_0x2956('0x1a')](_0x49731a);return _0x33686e['set'](_0x2956('0x1f'),_0x1fe7f0+'-'+_0x59fdc8+'/'+_0x5f4ce5)[_0x2956('0x20')](_0x314ab7);}return null;};}function patchUpdates(_0x29e1b4){return function(_0x32050d){try{jsonpatch[_0x2956('0x21')](_0x32050d,_0x29e1b4,!![]);}catch(_0x3dd54f){return BPromise[_0x2956('0x22')](_0x3dd54f);}return _0x32050d[_0x2956('0x23')]();};}function saveUpdates(_0x2ae0d8,_0x2b54dc){return function(_0x2a7dcc){if(_0x2a7dcc){return _0x2a7dcc[_0x2956('0x24')](_0x2ae0d8)[_0x2956('0x25')](function(_0x35a756){return _0x35a756;});}return null;};}function removeEntity(_0x45b1df,_0x3dcaee){return function(_0x238963){if(_0x238963){return _0x238963[_0x2956('0x26')]()[_0x2956('0x25')](function(){_0x45b1df[_0x2956('0x1a')](0xcc)[_0x2956('0x19')]();});}};}function handleEntityNotFound(_0x77e4a1,_0x24a61b){return function(_0x2acb0d){if(!_0x2acb0d){_0x77e4a1['sendStatus'](0x194);}return _0x2acb0d;};}function handleError(_0xd2fb81,_0x399cb4){_0x399cb4=_0x399cb4||0x1f4;return function(_0x207ba7){logger[_0x2956('0x27')](_0x207ba7[_0x2956('0x28')]);if(_0x207ba7[_0x2956('0x29')]){delete _0x207ba7[_0x2956('0x29')];}_0xd2fb81[_0x2956('0x1a')](_0x399cb4)[_0x2956('0x2a')](_0x207ba7);};}exports[_0x2956('0x2b')]=function(_0x1002d3,_0x198412){var _0x47363c={},_0x1220ca={},_0x442ca4={'count':0x0,'rows':[]};var _0x58a990=_[_0x2956('0x2c')](db[_0x2956('0x2d')][_0x2956('0x2e')],function(_0x4fe664){return{'name':_0x4fe664[_0x2956('0x2f')],'type':_0x4fe664[_0x2956('0x30')][_0x2956('0x31')]};});_0x1220ca[_0x2956('0x32')]=_[_0x2956('0x2c')](_0x58a990,_0x2956('0x29'));_0x1220ca['query']=_['keys'](_0x1002d3['query']);_0x1220ca[_0x2956('0x33')]=_[_0x2956('0x34')](_0x1220ca[_0x2956('0x32')],_0x1220ca['query']);_0x47363c[_0x2956('0x35')]=_[_0x2956('0x34')](_0x1220ca[_0x2956('0x32')],qs[_0x2956('0x36')](_0x1002d3[_0x2956('0x37')][_0x2956('0x36')]));_0x47363c[_0x2956('0x35')]=_0x47363c['attributes']['length']?_0x47363c[_0x2956('0x35')]:_0x1220ca[_0x2956('0x32')];if(!_0x1002d3[_0x2956('0x37')][_0x2956('0x38')](_0x2956('0x39'))){_0x47363c[_0x2956('0x1e')]=qs['limit'](_0x1002d3[_0x2956('0x37')]['limit']);_0x47363c['offset']=qs[_0x2956('0x1b')](_0x1002d3[_0x2956('0x37')][_0x2956('0x1b')]);}_0x47363c['order']=qs['sort'](_0x1002d3[_0x2956('0x37')]['sort']);_0x47363c[_0x2956('0x3a')]=qs[_0x2956('0x33')](_[_0x2956('0x3b')](_0x1002d3['query'],_0x1220ca[_0x2956('0x33')]),_0x58a990);if(_0x1002d3[_0x2956('0x37')][_0x2956('0x3c')]){_0x47363c[_0x2956('0x3a')]=_[_0x2956('0x3d')](_0x47363c[_0x2956('0x3a')],{'$or':_[_0x2956('0x2c')](_0x58a990,function(_0x31d332){if(_0x31d332[_0x2956('0x30')]!==_0x2956('0x3e')){var _0x4dee99={};_0x4dee99[_0x31d332[_0x2956('0x29')]]={'$like':'%'+_0x1002d3[_0x2956('0x37')][_0x2956('0x3c')]+'%'};return _0x4dee99;}})});}_0x47363c=_['merge']({},_0x47363c,_0x1002d3[_0x2956('0x3f')]);var _0x44bc46={'where':_0x47363c[_0x2956('0x3a')]};return db[_0x2956('0x2d')]['count'](_0x44bc46)[_0x2956('0x25')](function(_0x4e9dff){_0x442ca4['count']=_0x4e9dff;if(_0x1002d3[_0x2956('0x37')][_0x2956('0x40')]){_0x47363c[_0x2956('0x41')]=[{'all':!![]}];}return db[_0x2956('0x2d')][_0x2956('0x42')](_0x47363c);})['then'](function(_0x1c97f5){_0x442ca4['rows']=_0x1c97f5;return _0x442ca4;})[_0x2956('0x25')](respondWithFilteredResult(_0x198412,_0x47363c))['catch'](handleError(_0x198412,null));};exports[_0x2956('0x43')]=function(_0x1fa525,_0x206f45){var _0x3076d5={'raw':!![],'where':{'id':_0x1fa525['params']['id']}},_0x3bbba4={};_0x3bbba4[_0x2956('0x32')]=_[_0x2956('0x44')](db['SmsApplication'][_0x2956('0x2e')]);_0x3bbba4['query']=_[_0x2956('0x44')](_0x1fa525[_0x2956('0x37')]);_0x3bbba4[_0x2956('0x33')]=_[_0x2956('0x34')](_0x3bbba4[_0x2956('0x32')],_0x3bbba4[_0x2956('0x37')]);_0x3076d5['attributes']=_['intersection'](_0x3bbba4['model'],qs['fields'](_0x1fa525[_0x2956('0x37')][_0x2956('0x36')]));_0x3076d5[_0x2956('0x35')]=_0x3076d5['attributes'][_0x2956('0x45')]?_0x3076d5[_0x2956('0x35')]:_0x3bbba4[_0x2956('0x32')];if(_0x1fa525['query'][_0x2956('0x40')]){_0x3076d5[_0x2956('0x41')]=[{'all':!![]}];}_0x3076d5=_[_0x2956('0x3d')]({},_0x3076d5,_0x1fa525[_0x2956('0x3f')]);return db[_0x2956('0x2d')][_0x2956('0x46')](_0x3076d5)[_0x2956('0x25')](handleEntityNotFound(_0x206f45,null))[_0x2956('0x25')](respondWithResult(_0x206f45,null))[_0x2956('0x47')](handleError(_0x206f45,null));};exports['create']=function(_0x2f688f,_0x131995){return db['SmsApplication'][_0x2956('0x48')](_0x2f688f[_0x2956('0x49')],{})['then'](respondWithResult(_0x131995,0xc9))[_0x2956('0x47')](handleError(_0x131995,null));};exports[_0x2956('0x24')]=function(_0x49b172,_0x23e38a){if(_0x49b172[_0x2956('0x49')]['id']){delete _0x49b172['body']['id'];}return db[_0x2956('0x2d')][_0x2956('0x46')]({'where':{'id':_0x49b172[_0x2956('0x4a')]['id']}})['then'](handleEntityNotFound(_0x23e38a,null))[_0x2956('0x25')](saveUpdates(_0x49b172[_0x2956('0x49')],null))[_0x2956('0x25')](respondWithResult(_0x23e38a,null))[_0x2956('0x47')](handleError(_0x23e38a,null));};exports[_0x2956('0x26')]=function(_0x197488,_0x24acf4){return db['SmsApplication'][_0x2956('0x46')]({'where':{'id':_0x197488[_0x2956('0x4a')]['id']}})[_0x2956('0x25')](handleEntityNotFound(_0x24acf4,null))[_0x2956('0x25')](removeEntity(_0x24acf4,null))[_0x2956('0x47')](handleError(_0x24acf4,null));}; \ No newline at end of file +var _0xfadc=['zip-dir','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','then','destroy','sendStatus','error','stack','name','send','index','SmsApplication','rawAttributes','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf'];(function(_0xc96b0d,_0x37cfa3){var _0xe97c39=function(_0xbfbc4){while(--_0xbfbc4){_0xc96b0d['push'](_0xc96b0d['shift']());}};_0xe97c39(++_0x37cfa3);}(_0xfadc,0xd6));var _0xcfad=function(_0x12938c,_0xedc99c){_0x12938c=_0x12938c-0x0;var _0x4d1254=_0xfadc[_0x12938c];return _0x4d1254;};'use strict';var emlformat=require(_0xcfad('0x0'));var rimraf=require(_0xcfad('0x1'));var zipdir=require(_0xcfad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcfad('0x3'));var BPromise=require(_0xcfad('0x4'));var Mustache=require(_0xcfad('0x5'));var util=require(_0xcfad('0x6'));var path=require(_0xcfad('0x7'));var sox=require('sox');var csv=require(_0xcfad('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcfad('0x9'));var squel=require(_0xcfad('0xa'));var crypto=require('crypto');var jsforce=require(_0xcfad('0xb'));var deskjs=require(_0xcfad('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcfad('0xd'));var Papa=require(_0xcfad('0xe'));var Redis=require(_0xcfad('0xf'));var authService=require(_0xcfad('0x10'));var qs=require(_0xcfad('0x11'));var as=require(_0xcfad('0x12'));var hardwareService=require(_0xcfad('0x13'));var logger=require('../../config/logger')(_0xcfad('0x14'));var utils=require('../../config/utils');var config=require(_0xcfad('0x15'));var licenseUtil=require(_0xcfad('0x16'));var db=require(_0xcfad('0x17'))['db'];function respondWithStatusCode(_0x2297ad,_0x3923d6){_0x3923d6=_0x3923d6||0xcc;return function(_0x1e5275){if(_0x1e5275){return _0x2297ad['sendStatus'](_0x3923d6);}return _0x2297ad[_0xcfad('0x18')](_0x3923d6)[_0xcfad('0x19')]();};}function respondWithResult(_0x10a9fe,_0x3ab4e4){_0x3ab4e4=_0x3ab4e4||0xc8;return function(_0x5c3459){if(_0x5c3459){return _0x10a9fe[_0xcfad('0x18')](_0x3ab4e4)[_0xcfad('0x1a')](_0x5c3459);}};}function respondWithFilteredResult(_0x129e9e,_0x16be39){return function(_0x1deb22){if(_0x1deb22){var _0x261742=typeof _0x16be39[_0xcfad('0x1b')]==='undefined'&&typeof _0x16be39['limit']===_0xcfad('0x1c');var _0xb4d1d6=_0x1deb22[_0xcfad('0x1d')];var _0x4a72fb=_0x261742?0x0:_0x16be39['offset'];var _0x46bb2a=_0x261742?_0x1deb22['count']:_0x16be39[_0xcfad('0x1b')]+_0x16be39[_0xcfad('0x1e')];var _0x3b02bb;if(_0x46bb2a>=_0xb4d1d6){_0x46bb2a=_0xb4d1d6;_0x3b02bb=0xc8;}else{_0x3b02bb=0xce;}_0x129e9e[_0xcfad('0x18')](_0x3b02bb);return _0x129e9e[_0xcfad('0x1f')]('Content-Range',_0x4a72fb+'-'+_0x46bb2a+'/'+_0xb4d1d6)[_0xcfad('0x1a')](_0x1deb22);}return null;};}function patchUpdates(_0x4de792){return function(_0x7cd95e){try{jsonpatch['apply'](_0x7cd95e,_0x4de792,!![]);}catch(_0xc7f8d8){return BPromise['reject'](_0xc7f8d8);}return _0x7cd95e['save']();};}function saveUpdates(_0x2e2669,_0x435dd2){return function(_0x1d5618){if(_0x1d5618){return _0x1d5618['update'](_0x2e2669)[_0xcfad('0x20')](function(_0x3cdf2b){return _0x3cdf2b;});}return null;};}function removeEntity(_0x242c5a,_0x419fef){return function(_0x231fbc){if(_0x231fbc){return _0x231fbc[_0xcfad('0x21')]()[_0xcfad('0x20')](function(){_0x242c5a[_0xcfad('0x18')](0xcc)[_0xcfad('0x19')]();});}};}function handleEntityNotFound(_0x2e6a4e,_0x511e83){return function(_0x2ed0cf){if(!_0x2ed0cf){_0x2e6a4e[_0xcfad('0x22')](0x194);}return _0x2ed0cf;};}function handleError(_0x5a432a,_0x5d9b09){_0x5d9b09=_0x5d9b09||0x1f4;return function(_0x56133b){logger[_0xcfad('0x23')](_0x56133b[_0xcfad('0x24')]);if(_0x56133b[_0xcfad('0x25')]){delete _0x56133b[_0xcfad('0x25')];}_0x5a432a[_0xcfad('0x18')](_0x5d9b09)[_0xcfad('0x26')](_0x56133b);};}exports[_0xcfad('0x27')]=function(_0x2d6fe1,_0x5a2316){var _0x2ae3ab={},_0x26896f={},_0x197f62={'count':0x0,'rows':[]};var _0x29a330=_['map'](db[_0xcfad('0x28')][_0xcfad('0x29')],function(_0x33ad76){return{'name':_0x33ad76['fieldName'],'type':_0x33ad76[_0xcfad('0x2a')]['key']};});_0x26896f['model']=_[_0xcfad('0x2b')](_0x29a330,_0xcfad('0x25'));_0x26896f['query']=_[_0xcfad('0x2c')](_0x2d6fe1[_0xcfad('0x2d')]);_0x26896f[_0xcfad('0x2e')]=_[_0xcfad('0x2f')](_0x26896f[_0xcfad('0x30')],_0x26896f[_0xcfad('0x2d')]);_0x2ae3ab[_0xcfad('0x31')]=_[_0xcfad('0x2f')](_0x26896f[_0xcfad('0x30')],qs[_0xcfad('0x32')](_0x2d6fe1['query']['fields']));_0x2ae3ab[_0xcfad('0x31')]=_0x2ae3ab[_0xcfad('0x31')][_0xcfad('0x33')]?_0x2ae3ab[_0xcfad('0x31')]:_0x26896f['model'];if(!_0x2d6fe1['query'][_0xcfad('0x34')](_0xcfad('0x35'))){_0x2ae3ab[_0xcfad('0x1e')]=qs[_0xcfad('0x1e')](_0x2d6fe1[_0xcfad('0x2d')][_0xcfad('0x1e')]);_0x2ae3ab['offset']=qs[_0xcfad('0x1b')](_0x2d6fe1[_0xcfad('0x2d')][_0xcfad('0x1b')]);}_0x2ae3ab[_0xcfad('0x36')]=qs['sort'](_0x2d6fe1[_0xcfad('0x2d')][_0xcfad('0x37')]);_0x2ae3ab[_0xcfad('0x38')]=qs['filters'](_[_0xcfad('0x39')](_0x2d6fe1['query'],_0x26896f[_0xcfad('0x2e')]),_0x29a330);if(_0x2d6fe1['query'][_0xcfad('0x3a')]){_0x2ae3ab[_0xcfad('0x38')]=_[_0xcfad('0x3b')](_0x2ae3ab['where'],{'$or':_[_0xcfad('0x2b')](_0x29a330,function(_0x533a4b){if(_0x533a4b[_0xcfad('0x2a')]!==_0xcfad('0x3c')){var _0x48e5af={};_0x48e5af[_0x533a4b['name']]={'$like':'%'+_0x2d6fe1[_0xcfad('0x2d')]['filter']+'%'};return _0x48e5af;}})});}_0x2ae3ab=_[_0xcfad('0x3b')]({},_0x2ae3ab,_0x2d6fe1['options']);var _0x1158c6={'where':_0x2ae3ab[_0xcfad('0x38')]};return db['SmsApplication'][_0xcfad('0x1d')](_0x1158c6)[_0xcfad('0x20')](function(_0x5a15a2){_0x197f62[_0xcfad('0x1d')]=_0x5a15a2;if(_0x2d6fe1[_0xcfad('0x2d')][_0xcfad('0x3d')]){_0x2ae3ab[_0xcfad('0x3e')]=[{'all':!![]}];}return db[_0xcfad('0x28')][_0xcfad('0x3f')](_0x2ae3ab);})[_0xcfad('0x20')](function(_0x90de9d){_0x197f62[_0xcfad('0x40')]=_0x90de9d;return _0x197f62;})[_0xcfad('0x20')](respondWithFilteredResult(_0x5a2316,_0x2ae3ab))[_0xcfad('0x41')](handleError(_0x5a2316,null));};exports[_0xcfad('0x42')]=function(_0x22d73a,_0x31d1c){var _0x27ceae={'raw':!![],'where':{'id':_0x22d73a[_0xcfad('0x43')]['id']}},_0x57e87c={};_0x57e87c['model']=_[_0xcfad('0x2c')](db[_0xcfad('0x28')][_0xcfad('0x29')]);_0x57e87c[_0xcfad('0x2d')]=_[_0xcfad('0x2c')](_0x22d73a[_0xcfad('0x2d')]);_0x57e87c[_0xcfad('0x2e')]=_[_0xcfad('0x2f')](_0x57e87c[_0xcfad('0x30')],_0x57e87c[_0xcfad('0x2d')]);_0x27ceae[_0xcfad('0x31')]=_[_0xcfad('0x2f')](_0x57e87c[_0xcfad('0x30')],qs['fields'](_0x22d73a[_0xcfad('0x2d')][_0xcfad('0x32')]));_0x27ceae['attributes']=_0x27ceae[_0xcfad('0x31')][_0xcfad('0x33')]?_0x27ceae['attributes']:_0x57e87c[_0xcfad('0x30')];if(_0x22d73a[_0xcfad('0x2d')][_0xcfad('0x3d')]){_0x27ceae['include']=[{'all':!![]}];}_0x27ceae=_['merge']({},_0x27ceae,_0x22d73a[_0xcfad('0x44')]);return db[_0xcfad('0x28')][_0xcfad('0x45')](_0x27ceae)['then'](handleEntityNotFound(_0x31d1c,null))[_0xcfad('0x20')](respondWithResult(_0x31d1c,null))[_0xcfad('0x41')](handleError(_0x31d1c,null));};exports[_0xcfad('0x46')]=function(_0x2aab82,_0x5d4a69){return db[_0xcfad('0x28')][_0xcfad('0x46')](_0x2aab82[_0xcfad('0x47')],{})[_0xcfad('0x20')](respondWithResult(_0x5d4a69,0xc9))[_0xcfad('0x41')](handleError(_0x5d4a69,null));};exports['update']=function(_0x3275cd,_0x9504e1){if(_0x3275cd[_0xcfad('0x47')]['id']){delete _0x3275cd[_0xcfad('0x47')]['id'];}return db['SmsApplication'][_0xcfad('0x45')]({'where':{'id':_0x3275cd[_0xcfad('0x43')]['id']}})['then'](handleEntityNotFound(_0x9504e1,null))['then'](saveUpdates(_0x3275cd[_0xcfad('0x47')],null))[_0xcfad('0x20')](respondWithResult(_0x9504e1,null))[_0xcfad('0x41')](handleError(_0x9504e1,null));};exports[_0xcfad('0x21')]=function(_0xab5466,_0x586433){return db[_0xcfad('0x28')][_0xcfad('0x45')]({'where':{'id':_0xab5466[_0xcfad('0x43')]['id']}})['then'](handleEntityNotFound(_0x586433,null))[_0xcfad('0x20')](removeEntity(_0x586433,null))[_0xcfad('0x41')](handleError(_0x586433,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ef90a48..f9a3fd4 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 _0x9e3e=['./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfe3349,_0x5b6ec0){var _0x4471af=function(_0x21b88a){while(--_0x21b88a){_0xfe3349['push'](_0xfe3349['shift']());}};_0x4471af(++_0x5b6ec0);}(_0x9e3e,0x1c6));var _0xe9e3=function(_0x5670cb,_0xe6e20d){_0x5670cb=_0x5670cb-0x0;var _0x11dc29=_0x9e3e[_0x5670cb];return _0x11dc29;};'use strict';var _=require('lodash');var util=require(_0xe9e3('0x0'));var logger=require('../../config/logger')(_0xe9e3('0x1'));var moment=require(_0xe9e3('0x2'));var BPromise=require(_0xe9e3('0x3'));var rp=require(_0xe9e3('0x4'));var fs=require('fs');var path=require(_0xe9e3('0x5'));var rimraf=require(_0xe9e3('0x6'));var config=require(_0xe9e3('0x7'));var attributes=require(_0xe9e3('0x8'));module['exports']=function(_0x1d2ede,_0x3b01d7){return _0x1d2ede[_0xe9e3('0x9')](_0xe9e3('0xa'),attributes,{'tableName':_0xe9e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe9e3('0xc'),'collate':_0xe9e3('0xd')});}; \ No newline at end of file +var _0x8bc2=['moment','bluebird','request-promise','path','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x1d0e07,_0x1f484c){var _0x3514bd=function(_0x5b9bd0){while(--_0x5b9bd0){_0x1d0e07['push'](_0x1d0e07['shift']());}};_0x3514bd(++_0x1f484c);}(_0x8bc2,0x7a));var _0x28bc=function(_0x32bac4,_0x1c2a1a){_0x32bac4=_0x32bac4-0x0;var _0x3de461=_0x8bc2[_0x32bac4];return _0x3de461;};'use strict';var _=require(_0x28bc('0x0'));var util=require(_0x28bc('0x1'));var logger=require(_0x28bc('0x2'))(_0x28bc('0x3'));var moment=require(_0x28bc('0x4'));var BPromise=require(_0x28bc('0x5'));var rp=require(_0x28bc('0x6'));var fs=require('fs');var path=require(_0x28bc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x28bc('0x8'));module[_0x28bc('0x9')]=function(_0xe216b7,_0x3bbcf1){return _0xe216b7[_0x28bc('0xa')](_0x28bc('0xb'),attributes,{'tableName':_0x28bc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x28bc('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 6ae2417..ad63cfd 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 _0x04fa=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','request\x20sent'];(function(_0x3c9f4c,_0x1d474e){var _0x1c9d07=function(_0x540e98){while(--_0x540e98){_0x3c9f4c['push'](_0x3c9f4c['shift']());}};_0x1c9d07(++_0x1d474e);}(_0x04fa,0x119));var _0xa04f=function(_0x3295d9,_0x276fed){_0x3295d9=_0x3295d9-0x0;var _0x4eecdd=_0x04fa[_0x3295d9];return _0x4eecdd;};'use strict';var _=require('lodash');var util=require(_0xa04f('0x0'));var moment=require(_0xa04f('0x1'));var BPromise=require(_0xa04f('0x2'));var rs=require(_0xa04f('0x3'));var fs=require('fs');var Redis=require(_0xa04f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa04f('0x5'));var logger=require('../../config/logger')(_0xa04f('0x6'));var config=require(_0xa04f('0x7'));var jayson=require(_0xa04f('0x8'));var client=jayson['client'][_0xa04f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c521c,_0x315771,_0x56f898){return new BPromise(function(_0x303e54,_0x4a2e03){return client['request'](_0x2c521c,_0x56f898)['then'](function(_0x5ea498){logger[_0xa04f('0xa')]('SmsApplication,\x20%s,\x20%s',_0x315771,'request\x20sent');logger[_0xa04f('0xb')](_0xa04f('0xc'),_0x315771,'request\x20sent',JSON[_0xa04f('0xd')](_0x5ea498));if(_0x5ea498['error']){if(_0x5ea498[_0xa04f('0xe')][_0xa04f('0xf')]===0x1f4){logger['error'](_0xa04f('0x10'),_0x315771,_0x5ea498[_0xa04f('0xe')]['message']);return _0x4a2e03(_0x5ea498['error']['message']);}logger[_0xa04f('0xe')](_0xa04f('0x10'),_0x315771,_0x5ea498[_0xa04f('0xe')][_0xa04f('0x11')]);return _0x303e54(_0x5ea498[_0xa04f('0xe')][_0xa04f('0x11')]);}else{logger['info'](_0xa04f('0x10'),_0x315771,_0xa04f('0x12'));_0x303e54(_0x5ea498['result'][_0xa04f('0x11')]);}})[_0xa04f('0x13')](function(_0x505abc){logger[_0xa04f('0xe')]('SmsApplication,\x20%s,\x20%s',_0x315771,_0x505abc);_0x4a2e03(_0x505abc);});});} \ No newline at end of file +var _0x5713=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','SmsApplication,\x20%s,\x20%s','message','result','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x9abce3,_0x462518){var _0x15c3a8=function(_0x4ed5d1){while(--_0x4ed5d1){_0x9abce3['push'](_0x9abce3['shift']());}};_0x15c3a8(++_0x462518);}(_0x5713,0x1c7));var _0x3571=function(_0x493cd8,_0x2ce060){_0x493cd8=_0x493cd8-0x0;var _0xef3a37=_0x5713[_0x493cd8];return _0xef3a37;};'use strict';var _=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var moment=require('moment');var BPromise=require(_0x3571('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3571('0x3'));var db=require(_0x3571('0x4'))['db'];var utils=require(_0x3571('0x5'));var logger=require(_0x3571('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3571('0x7'));var client=jayson[_0x3571('0x8')][_0x3571('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x432a48,_0x3a6f29,_0x1f8f0f){return new BPromise(function(_0x48b06d,_0x358ba1){return client[_0x3571('0xa')](_0x432a48,_0x1f8f0f)[_0x3571('0xb')](function(_0x288fc8){logger[_0x3571('0xc')]('SmsApplication,\x20%s,\x20%s',_0x3a6f29,'request\x20sent');logger[_0x3571('0xd')](_0x3571('0xe'),_0x3a6f29,_0x3571('0xf'),JSON['stringify'](_0x288fc8));if(_0x288fc8['error']){if(_0x288fc8['error']['code']===0x1f4){logger[_0x3571('0x10')](_0x3571('0x11'),_0x3a6f29,_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);return _0x358ba1(_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);}logger[_0x3571('0x10')](_0x3571('0x11'),_0x3a6f29,_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);return _0x48b06d(_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);}else{logger[_0x3571('0xc')](_0x3571('0x11'),_0x3a6f29,_0x3571('0xf'));_0x48b06d(_0x288fc8[_0x3571('0x13')]['message']);}})['catch'](function(_0x48c77e){logger[_0x3571('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3a6f29,_0x48c77e);_0x358ba1(_0x48c77e);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 9fc5ded..93e28a2 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 _0x4483=['isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4483,0x1a3));var _0x3448=function(_0x13eed7,_0x163bba){_0x13eed7=_0x13eed7-0x0;var _0x4efed9=_0x4483[_0x13eed7];return _0x4efed9;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3448('0x13')](_0x3448('0xf'),auth['isAuthenticated'](),controller[_0x3448('0x14')]);router[_0x3448('0x13')](_0x3448('0x15'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),'smsinteraction:addtags'),controller[_0x3448('0x18')]);router[_0x3448('0x19')](_0x3448('0x1a'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),_0x3448('0x1b')),controller[_0x3448('0x1c')]);router[_0x3448('0x1d')](_0x3448('0x1a'),auth[_0x3448('0xa')](),interaction[_0x3448('0x16')]('sms',_0x3448('0x1e')),controller['destroy']);router['delete']('/:id/tags',auth[_0x3448('0xa')](),controller[_0x3448('0x1f')]);module[_0x3448('0x20')]=router; \ No newline at end of file +var _0x757a=['smsinteraction:update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x757a,0xde));var _0xa757=function(_0x18177d,_0x181fb2){_0x18177d=_0x18177d-0x0;var _0x2d37fb=_0x757a[_0x18177d];return _0x2d37fb;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa757('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x12')),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x15')),controller['update']);router[_0xa757('0x16')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction['tracked']('sms',_0xa757('0x17')),controller[_0xa757('0x18')]);router[_0xa757('0x16')](_0xa757('0x19'),auth[_0xa757('0x9')](),controller[_0xa757('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 4eff882..b57dcf5 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 _0x06ef=['out','exports','STRING','ENUM'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x06ef,0x185));var _0xf06e=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0x06ef[_0x124298];return _0x35ac24;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xf06e('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf06e('0x1')]},'note':{'type':Sequelize[_0xf06e('0x1')]},'phone':{'type':Sequelize[_0xf06e('0x1')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf06e('0x2')]('in',_0xf06e('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4808=['sequelize','moment','exports','DATE','STRING','ENUM','out','INTEGER'];(function(_0x53bf1d,_0xe9dfe5){var _0xd69967=function(_0x336ca9){while(--_0x336ca9){_0x53bf1d['push'](_0x53bf1d['shift']());}};_0xd69967(++_0xe9dfe5);}(_0x4808,0x160));var _0x8480=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x4808[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0x8480('0x0'));var moment=require(_0x8480('0x1'));module[_0x8480('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8480('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8480('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8480('0x4')]},'note':{'type':Sequelize[_0x8480('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8480('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8480('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8480('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8480('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8480('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index fb78e84..e48bdf9 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 _0xa363=['createdAt','direction','read','Account','Owner','mkdirSync','Sms','N.A.','closed','closedAt','disposition','map','out','secret','value','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','update','then','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','user','catch','show','model','keys','filters','intersection','query','attributes','fields','includeAll','merge','options','create','body','find','params','destroy','describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa363,0x10e));var _0x3a36=function(_0x3ca800,_0x352855){_0x3ca800=_0x3ca800-0x0;var _0x2f4eca=_0xa363[_0x3ca800];return _0x2f4eca;};'use strict';var rimraf=require(_0x3a36('0x0'));var zipdir=require(_0x3a36('0x1'));var moment=require(_0x3a36('0x2'));var BPromise=require(_0x3a36('0x3'));var util=require(_0x3a36('0x4'));var path=require(_0x3a36('0x5'));var ejs=require(_0x3a36('0x6'));var fs=require('fs');var _=require(_0x3a36('0x7'));var Redis=require(_0x3a36('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x3a36('0x9'));var pdf=require(_0x3a36('0xa'));var logger=require(_0x3a36('0xb'))(_0x3a36('0xc'));var config=require(_0x3a36('0xd'));var db=require(_0x3a36('0xe'))['db'];config['redis']=_[_0x3a36('0xf')](config[_0x3a36('0x10')],{'host':_0x3a36('0x11'),'port':0x18eb});var socket=require(_0x3a36('0x12'))(new Redis(config[_0x3a36('0x10')]));require(_0x3a36('0x13'))[_0x3a36('0x14')](socket);function respondWithStatusCode(_0x39ac26,_0xe5ae07){_0xe5ae07=_0xe5ae07||0xcc;return function(_0x3304d3){if(_0x3304d3){return _0x39ac26[_0x3a36('0x15')](_0xe5ae07);}return _0x39ac26['status'](_0xe5ae07)[_0x3a36('0x16')]();};}function respondWithResult(_0x4ad833,_0xc275ee){_0xc275ee=_0xc275ee||0xc8;return function(_0x653c09){if(_0x653c09){return _0x4ad833[_0x3a36('0x17')](_0xc275ee)['json'](_0x653c09);}};}function respondWithFilteredResult(_0x568159,_0x5de758){return function(_0x4d09a9){if(_0x4d09a9){var _0x34235e=typeof _0x5de758[_0x3a36('0x18')]===_0x3a36('0x19')&&typeof _0x5de758[_0x3a36('0x1a')]===_0x3a36('0x19');var _0x362777=_0x4d09a9[_0x3a36('0x1b')];var _0x2ad798=_0x34235e?0x0:_0x5de758['offset'];var _0x1efb51=_0x34235e?_0x4d09a9[_0x3a36('0x1b')]:_0x5de758[_0x3a36('0x18')]+_0x5de758[_0x3a36('0x1a')];var _0x37d8e5;if(_0x1efb51>=_0x362777){_0x1efb51=_0x362777;_0x37d8e5=0xc8;}else{_0x37d8e5=0xce;}_0x568159[_0x3a36('0x17')](_0x37d8e5);return _0x568159[_0x3a36('0x1c')]('Content-Range',_0x2ad798+'-'+_0x1efb51+'/'+_0x362777)['json'](_0x4d09a9);}return null;};}function saveUpdates(_0x3618cb){return function(_0xb77f24){if(_0xb77f24){return _0xb77f24[_0x3a36('0x1d')](_0x3618cb)[_0x3a36('0x1e')](function(_0x2032e7){return _0x2032e7;});}return null;};}function removeEntity(_0x53f7e1){return function(_0x5384eb){if(_0x5384eb){return _0x5384eb['destroy']()[_0x3a36('0x1e')](function(){_0x53f7e1['status'](0xcc)[_0x3a36('0x16')]();});}};}function handleEntityNotFound(_0x11eee3){return function(_0x40137a){if(!_0x40137a){_0x11eee3[_0x3a36('0x15')](0x194);}return _0x40137a;};}function handleError(_0x47e89e,_0x4b6d82){_0x4b6d82=_0x4b6d82||0x1f4;return function(_0x24c046){logger['error'](_0x24c046[_0x3a36('0x1f')]);if(_0x24c046[_0x3a36('0x20')]){delete _0x24c046[_0x3a36('0x20')];}_0x47e89e[_0x3a36('0x17')](_0x4b6d82)[_0x3a36('0x21')](_0x24c046);};}exports[_0x3a36('0x22')]=function(_0x90d89e,_0x4d607b){var _0x4a9a96={};var _0x3a4717=_['map'](db[_0x3a36('0x23')][_0x3a36('0x24')],function(_0x2314f6){return{'name':_0x2314f6[_0x3a36('0x25')],'type':_0x2314f6[_0x3a36('0x26')][_0x3a36('0x27')]};});_0x4a9a96=qs[_0x3a36('0x28')](_0x3a4717,_0x90d89e);return interaction[_0x3a36('0x29')](_0x3a36('0x2a'),_0x90d89e['query'],_0x90d89e[_0x3a36('0x2b')],_0x4a9a96,_0x3a4717)['then'](respondWithFilteredResult(_0x4d607b,_0x4a9a96))[_0x3a36('0x2c')](handleError(_0x4d607b,null));};exports[_0x3a36('0x2d')]=function(_0x36ca05,_0x4ba6ca){var _0x12f0a0={'raw':![],'where':{'id':_0x36ca05['params']['id']}},_0x2cb774={};_0x2cb774[_0x3a36('0x2e')]=_[_0x3a36('0x2f')](db[_0x3a36('0x23')][_0x3a36('0x24')]);_0x2cb774['query']=_[_0x3a36('0x2f')](_0x36ca05['query']);_0x2cb774[_0x3a36('0x30')]=_[_0x3a36('0x31')](_0x2cb774[_0x3a36('0x2e')],_0x2cb774[_0x3a36('0x32')]);_0x12f0a0[_0x3a36('0x33')]=_[_0x3a36('0x31')](_0x2cb774[_0x3a36('0x2e')],qs['fields'](_0x36ca05[_0x3a36('0x32')][_0x3a36('0x34')]));_0x12f0a0[_0x3a36('0x33')]=_0x12f0a0['attributes']['length']?_0x12f0a0[_0x3a36('0x33')]:_0x2cb774[_0x3a36('0x2e')];if(_0x36ca05[_0x3a36('0x32')][_0x3a36('0x35')]){_0x12f0a0['include']=[{'all':!![]}];}_0x12f0a0=_[_0x3a36('0x36')]({},_0x12f0a0,_0x36ca05[_0x3a36('0x37')]);return db['SmsInteraction']['find'](_0x12f0a0)[_0x3a36('0x1e')](handleEntityNotFound(_0x4ba6ca,null))[_0x3a36('0x1e')](respondWithResult(_0x4ba6ca,null))[_0x3a36('0x2c')](handleError(_0x4ba6ca,null));};exports[_0x3a36('0x38')]=function(_0x1432c8,_0x41d03c){return db[_0x3a36('0x23')][_0x3a36('0x38')](_0x1432c8[_0x3a36('0x39')],{})[_0x3a36('0x1e')](respondWithResult(_0x41d03c,0xc9))[_0x3a36('0x2c')](handleError(_0x41d03c,null));};exports[_0x3a36('0x1d')]=function(_0x26eb83,_0x4de5e4){if(_0x26eb83[_0x3a36('0x39')]['id']){delete _0x26eb83[_0x3a36('0x39')]['id'];}return db[_0x3a36('0x23')][_0x3a36('0x3a')]({'where':{'id':_0x26eb83[_0x3a36('0x3b')]['id']}})[_0x3a36('0x1e')](handleEntityNotFound(_0x4de5e4,null))['then'](saveUpdates(_0x26eb83[_0x3a36('0x39')],null))[_0x3a36('0x1e')](respondWithResult(_0x4de5e4,null))[_0x3a36('0x2c')](handleError(_0x4de5e4,null));};exports[_0x3a36('0x3c')]=function(_0x58590a,_0x3f9d63){return db[_0x3a36('0x23')]['find']({'where':{'id':_0x58590a['params']['id']}})[_0x3a36('0x1e')](handleEntityNotFound(_0x3f9d63,null))[_0x3a36('0x1e')](removeEntity(_0x3f9d63,null))['catch'](handleError(_0x3f9d63,null));};exports[_0x3a36('0x3d')]=function(_0x234deb,_0x507c5f){return db[_0x3a36('0x23')][_0x3a36('0x3d')]()['then'](respondWithResult(_0x507c5f,null))[_0x3a36('0x2c')](handleError(_0x507c5f,null));};exports[_0x3a36('0x3e')]=function(_0x4ae043,_0x791872){return db[_0x3a36('0x3f')][_0x3a36('0x3a')]({'where':{'id':_0x4ae043[_0x3a36('0x3b')]['id']}})['then'](handleEntityNotFound(_0x791872,null))[_0x3a36('0x1e')](function(_0x21e369){if(_0x21e369){return _0x21e369[_0x3a36('0x3e')](_0x4ae043[_0x3a36('0x39')][_0x3a36('0x40')],_[_0x3a36('0x41')](_0x4ae043[_0x3a36('0x39')],['ids','id'])||{});}})[_0x3a36('0x1e')](respondWithResult(_0x791872,null))[_0x3a36('0x2c')](handleError(_0x791872,null));};exports['getMessages']=function(_0x5ecef2,_0x4848d8){var _0x2944e2={'raw':![],'where':{}};var _0x5a655f={};var _0x3ba9e5={'count':0x0,'rows':[]};return db[_0x3a36('0x23')][_0x3a36('0x42')]({'where':{'id':_0x5ecef2['params']['id']}})[_0x3a36('0x1e')](handleEntityNotFound(_0x4848d8,null))[_0x3a36('0x1e')](function(_0x533034){if(_0x533034){_0x5a655f['model']=_['keys'](db[_0x3a36('0x3f')][_0x3a36('0x24')]);_0x5a655f['query']=_['keys'](_0x5ecef2[_0x3a36('0x32')]);_0x5a655f[_0x3a36('0x30')]=_['intersection'](_0x5a655f[_0x3a36('0x2e')],_0x5a655f[_0x3a36('0x32')]);_0x2944e2[_0x3a36('0x33')]=_[_0x3a36('0x31')](_0x5a655f[_0x3a36('0x2e')],qs[_0x3a36('0x34')](_0x5ecef2[_0x3a36('0x32')][_0x3a36('0x34')]));_0x2944e2[_0x3a36('0x33')]=_0x2944e2[_0x3a36('0x33')]['length']?_0x2944e2[_0x3a36('0x33')]:_0x5a655f['model'];if(!_0x5ecef2[_0x3a36('0x32')][_0x3a36('0x43')](_0x3a36('0x44'))){_0x2944e2['limit']=qs[_0x3a36('0x1a')](_0x5ecef2[_0x3a36('0x32')]['limit']);_0x2944e2[_0x3a36('0x18')]=qs[_0x3a36('0x18')](_0x5ecef2['query']['offset']);}_0x2944e2[_0x3a36('0x45')]=qs[_0x3a36('0x46')](_0x5ecef2[_0x3a36('0x32')]['sort']);_0x2944e2[_0x3a36('0x47')]=qs[_0x3a36('0x30')](_[_0x3a36('0x48')](_0x5ecef2[_0x3a36('0x32')],_0x5a655f[_0x3a36('0x30')]));_0x2944e2[_0x3a36('0x47')][_0x3a36('0x49')]=_0x533034['id'];if(_0x5ecef2['query'][_0x3a36('0x4a')]){_0x2944e2[_0x3a36('0x47')]=_[_0x3a36('0x36')](_0x2944e2[_0x3a36('0x47')],{'$or':_['map'](_0x2944e2[_0x3a36('0x33')],function(_0x3500d9){var _0x2e7641={};_0x2e7641[_0x3500d9]={'$like':'%'+_0x5ecef2[_0x3a36('0x32')][_0x3a36('0x4a')]+'%'};return _0x2e7641;})});}if(_0x5ecef2[_0x3a36('0x32')][_0x3a36('0x4b')]){var _0x3e29d0=_0x5ecef2[_0x3a36('0x32')][_0x3a36('0x4b')][_0x3a36('0x4c')](',');var _0xe0113={};_0xe0113[_0x3e29d0[0x0]]={'$gte':moment(_0x3e29d0[0x1])[_0x3a36('0x4d')](_0x3a36('0x4e'))};_0x2944e2[_0x3a36('0x47')]=_[_0x3a36('0x36')](_0x2944e2[_0x3a36('0x47')],_0xe0113);}_0x2944e2=_[_0x3a36('0x36')]({},_0x2944e2,_0x5ecef2['options']);return db[_0x3a36('0x3f')][_0x3a36('0x1b')]({'where':_0x2944e2[_0x3a36('0x47')]})['then'](function(_0x532579){_0x3ba9e5[_0x3a36('0x1b')]=_0x532579;if(_0x5ecef2[_0x3a36('0x32')][_0x3a36('0x35')]){_0x2944e2['include']=[{'all':!![]}];}return db['SmsMessage'][_0x3a36('0x29')](_0x2944e2);})[_0x3a36('0x1e')](function(_0x58f3a8){_0x3ba9e5[_0x3a36('0x4f')]=_0x58f3a8;return _0x3ba9e5;});}})[_0x3a36('0x1e')](respondWithFilteredResult(_0x4848d8,_0x2944e2))[_0x3a36('0x2c')](handleError(_0x4848d8,null));};exports['addTags']=function(_0x4b5b9b,_0xaa18d2){return db[_0x3a36('0x23')][_0x3a36('0x3a')]({'where':{'id':_0x4b5b9b[_0x3a36('0x3b')]['id']}})[_0x3a36('0x1e')](handleEntityNotFound(_0xaa18d2,null))[_0x3a36('0x1e')](function(_0x28febc){if(_0x28febc){return _0x28febc[_0x3a36('0x50')](_0x4b5b9b['body'][_0x3a36('0x40')],_[_0x3a36('0x41')](_0x4b5b9b[_0x3a36('0x39')],['ids','id'])||{})[_0x3a36('0x51')](function(){return db[_0x3a36('0x52')][_0x3a36('0x29')]({'attributes':['id',_0x3a36('0x20'),'color'],'where':{'id':_0x4b5b9b['body'][_0x3a36('0x40')]}});})['then'](function(_0x1ac801){socket[_0x3a36('0x53')](_0x3a36('0x54'),{'id':Number(_0x4b5b9b[_0x3a36('0x3b')]['id']),'tags':_0x1ac801||[]});return{'id':Number(_0x4b5b9b[_0x3a36('0x3b')]['id']),'tags':_0x1ac801||[]};});}})[_0x3a36('0x1e')](respondWithResult(_0xaa18d2,null))[_0x3a36('0x2c')](handleError(_0xaa18d2,null));};exports[_0x3a36('0x55')]=function(_0x3e48ad,_0x36b84f){return db[_0x3a36('0x23')][_0x3a36('0x3a')]({'where':{'id':_0x3e48ad[_0x3a36('0x3b')]['id']}})[_0x3a36('0x1e')](handleEntityNotFound(_0x36b84f,null))['then'](function(_0x1ecf65){if(_0x1ecf65){return _0x1ecf65['removeTags'](_0x3e48ad['query'][_0x3a36('0x40')]);}})[_0x3a36('0x1e')](respondWithStatusCode(_0x36b84f,null))['catch'](handleError(_0x36b84f,null));};exports[_0x3a36('0x56')]=function(_0x4150dc,_0x2ad8d6){var _0x29716d=moment()['unix']()[_0x3a36('0x57')]();var _0x31962a=path[_0x3a36('0x58')](config[_0x3a36('0x59')],_0x3a36('0x5a'),_0x3a36('0x5b'),_0x3a36('0x5c'));var _0x247665=path['join'](_0x31962a,_0x29716d);var _0x3911f0=util[_0x3a36('0x4d')](_0x3a36('0x5d'),_0x4150dc[_0x3a36('0x3b')]['id'],_0x29716d);var _0x2babfb=path[_0x3a36('0x58')](_0x31962a,_0x3911f0);var _0x56ce6c=[];_0x56ce6c[_0x3a36('0x5e')]({'model':db[_0x3a36('0x5f')],'as':_0x3a36('0x5f'),'attributes':['id',_0x3a36('0x60')],'raw':!![]});_0x56ce6c[_0x3a36('0x5e')]({'model':db[_0x3a36('0x61')],'as':_0x3a36('0x62'),'attributes':['id',_0x3a36('0x63'),_0x3a36('0x64')],'raw':!![]});var _0x465595=[{'model':db[_0x3a36('0x3f')],'as':_0x3a36('0x65'),'attributes':['id',_0x3a36('0x39'),_0x3a36('0x66'),_0x3a36('0x67'),'secret',_0x3a36('0x68')],'include':_0x56ce6c}];_0x465595['push']({'model':db['SmsAccount'],'as':_0x3a36('0x69'),'attributes':['id','name']});_0x465595[_0x3a36('0x5e')]({'model':db[_0x3a36('0x5f')],'as':_0x3a36('0x6a'),'attributes':['id',_0x3a36('0x60')]});return db[_0x3a36('0x23')][_0x3a36('0x3a')]({'where':{'id':_0x4150dc[_0x3a36('0x3b')]['id']},'include':_0x465595})['then'](handleEntityNotFound(_0x2ad8d6,null))['then'](function(_0x9193f8){if(_0x9193f8){var _0x3a00af=_0x9193f8['get']({'plain':!![]});fs[_0x3a36('0x6b')](_0x247665);var _0x364fbc={'channel':_0x3a36('0x6c'),'account':_0x3a00af[_0x3a36('0x69')][_0x3a36('0x20')],'agent':_0x3a00af[_0x3a36('0x6a')]?_0x3a00af[_0x3a36('0x6a')][_0x3a36('0x60')]:_0x3a36('0x6d'),'createdAt':moment(_0x3a00af['createdAt'])[_0x3a36('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3a36('0x57')](),'closedAt':_0x3a00af[_0x3a36('0x6e')]?moment(_0x3a00af[_0x3a36('0x6f')])['format'](_0x3a36('0x4e'))[_0x3a36('0x57')]():'','disposition':_0x3a00af[_0x3a36('0x70')],'messages':_(_0x3a00af[_0x3a36('0x65')])[_0x3a36('0x4a')]({'secret':![]})[_0x3a36('0x71')](function(_0xba8c03){return{'date':moment(_0xba8c03['createdAt'])[_0x3a36('0x4d')](_0x3a36('0x4e'))[_0x3a36('0x57')](),'sender':_0xba8c03[_0x3a36('0x67')]===_0x3a36('0x72')?_0xba8c03[_0x3a36('0x5f')]?_0xba8c03[_0x3a36('0x5f')][_0x3a36('0x60')]:'System':_0xba8c03[_0x3a36('0x62')][_0x3a36('0x63')]+(_0xba8c03[_0x3a36('0x62')][_0x3a36('0x64')]?'\x20'+_0xba8c03[_0x3a36('0x62')][_0x3a36('0x64')]:''),'body':_0xba8c03[_0x3a36('0x39')],'direction':_0xba8c03[_0x3a36('0x67')]==='out'?'A':'C','secret':_0xba8c03[_0x3a36('0x73')],'read':_0xba8c03[_0x3a36('0x68')]};})[_0x3a36('0x74')]()};return ejs['renderFile'](path['join'](config[_0x3a36('0x59')],_0x3a36('0x5a'),_0x3a36('0x75'),_0x3a36('0x76')),{'interaction':_0x364fbc})[_0x3a36('0x1e')](function(_0x4e2b22){var _0x3d247e=path['join'](_0x247665,_0x3a36('0x77')+_0x3a00af['id']+'-'+_0x29716d+_0x3a36('0x78'));var _0x5a51ea={'path':_0x3d247e,'channel':_0x3a36('0x6c'),'interactionId':_0x3a00af['id']};return pdf['createPdfFromHTML'](_0x4e2b22,_0x5a51ea);})[_0x3a36('0x1e')](function(){return new BPromise(function(_0x3b3ad2,_0xe08cd1){zipdir(_0x247665,{'saveTo':_0x2babfb},function(_0x44d0f8,_0x1c0a10){if(_0x44d0f8)return _0xe08cd1(_0x44d0f8);return _0x3b3ad2(_0x1c0a10);});})['then'](function(){return new BPromise(function(_0x355494,_0x16907c){rimraf(_0x247665,function(_0x5a86ca){if(_0x5a86ca)_0x16907c(_0x5a86ca);return _0x355494();});});})['then'](function(){return _0x2ad8d6[_0x3a36('0x56')](_0x2babfb,_0x3911f0,function(_0x194738){if(_0x194738){console[_0x3a36('0x79')](_0x3a36('0x7a'),_0x194738);}else{fs[_0x3a36('0x7b')](_0x2babfb);}});});});}else{return _0x2ad8d6[_0x3a36('0x15')](0xc8);}})[_0x3a36('0x2c')](handleError(_0x2ad8d6,null));}; \ No newline at end of file +var _0x718e=['read','SmsAccount','Account','get','Sms','Owner','N.A.','format','closed','disposition','out','System','value','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','lodash','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./smsInteraction.socket','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','end','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','findAll','sms','query','user','catch','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','transcript-%d-%s.zip','join','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x718e,0x1eb));var _0xe718=function(_0x56f3d4,_0xfc65dd){_0x56f3d4=_0x56f3d4-0x0;var _0x2c7ef0=_0x718e[_0x56f3d4];return _0x2c7ef0;};'use strict';var rimraf=require(_0xe718('0x0'));var zipdir=require(_0xe718('0x1'));var moment=require(_0xe718('0x2'));var BPromise=require(_0xe718('0x3'));var util=require(_0xe718('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe718('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xe718('0x6'));var logger=require(_0xe718('0x7'))('api');var config=require(_0xe718('0x8'));var db=require(_0xe718('0x9'))['db'];config['redis']=_[_0xe718('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe718('0xb'))(new Redis(config['redis']));require(_0xe718('0xc'))['register'](socket);function respondWithStatusCode(_0x444ec8,_0x27e045){_0x27e045=_0x27e045||0xcc;return function(_0x403070){if(_0x403070){return _0x444ec8['sendStatus'](_0x27e045);}return _0x444ec8['status'](_0x27e045)['end']();};}function respondWithResult(_0x1ee88d,_0x1f4b0d){_0x1f4b0d=_0x1f4b0d||0xc8;return function(_0x523e7f){if(_0x523e7f){return _0x1ee88d[_0xe718('0xd')](_0x1f4b0d)[_0xe718('0xe')](_0x523e7f);}};}function respondWithFilteredResult(_0x250f4b,_0x2c05f8){return function(_0x1c0a51){if(_0x1c0a51){var _0x2199c9=typeof _0x2c05f8[_0xe718('0xf')]==='undefined'&&typeof _0x2c05f8[_0xe718('0x10')]===_0xe718('0x11');var _0x39c173=_0x1c0a51[_0xe718('0x12')];var _0x23a32c=_0x2199c9?0x0:_0x2c05f8[_0xe718('0xf')];var _0x968c83=_0x2199c9?_0x1c0a51[_0xe718('0x12')]:_0x2c05f8[_0xe718('0xf')]+_0x2c05f8[_0xe718('0x10')];var _0x52c07b;if(_0x968c83>=_0x39c173){_0x968c83=_0x39c173;_0x52c07b=0xc8;}else{_0x52c07b=0xce;}_0x250f4b['status'](_0x52c07b);return _0x250f4b[_0xe718('0x13')](_0xe718('0x14'),_0x23a32c+'-'+_0x968c83+'/'+_0x39c173)[_0xe718('0xe')](_0x1c0a51);}return null;};}function saveUpdates(_0x1dd3e7){return function(_0x29ccc1){if(_0x29ccc1){return _0x29ccc1[_0xe718('0x15')](_0x1dd3e7)['then'](function(_0x324aa5){return _0x324aa5;});}return null;};}function removeEntity(_0x4d4b85){return function(_0x4ad937){if(_0x4ad937){return _0x4ad937[_0xe718('0x16')]()[_0xe718('0x17')](function(){_0x4d4b85[_0xe718('0xd')](0xcc)[_0xe718('0x18')]();});}};}function handleEntityNotFound(_0x4b593e){return function(_0x57c0f0){if(!_0x57c0f0){_0x4b593e['sendStatus'](0x194);}return _0x57c0f0;};}function handleError(_0xe83ea5,_0x2c108b){_0x2c108b=_0x2c108b||0x1f4;return function(_0x3e78f6){logger[_0xe718('0x19')](_0x3e78f6[_0xe718('0x1a')]);if(_0x3e78f6[_0xe718('0x1b')]){delete _0x3e78f6[_0xe718('0x1b')];}_0xe83ea5['status'](_0x2c108b)[_0xe718('0x1c')](_0x3e78f6);};}exports[_0xe718('0x1d')]=function(_0x49f421,_0x4ea06d){var _0x12de17={};var _0x2e7ca6=_[_0xe718('0x1e')](db[_0xe718('0x1f')][_0xe718('0x20')],function(_0x5ace4f){return{'name':_0x5ace4f[_0xe718('0x21')],'type':_0x5ace4f[_0xe718('0x22')]['key']};});_0x12de17=qs['getOptions'](_0x2e7ca6,_0x49f421);return interaction[_0xe718('0x23')](_0xe718('0x24'),_0x49f421[_0xe718('0x25')],_0x49f421[_0xe718('0x26')],_0x12de17,_0x2e7ca6)[_0xe718('0x17')](respondWithFilteredResult(_0x4ea06d,_0x12de17))[_0xe718('0x27')](handleError(_0x4ea06d,null));};exports['show']=function(_0x5c6d42,_0xa56023){var _0x4713bc={'raw':![],'where':{'id':_0x5c6d42[_0xe718('0x28')]['id']}},_0x2e4fc9={};_0x2e4fc9[_0xe718('0x29')]=_[_0xe718('0x2a')](db['SmsInteraction']['rawAttributes']);_0x2e4fc9[_0xe718('0x25')]=_['keys'](_0x5c6d42[_0xe718('0x25')]);_0x2e4fc9[_0xe718('0x2b')]=_[_0xe718('0x2c')](_0x2e4fc9['model'],_0x2e4fc9[_0xe718('0x25')]);_0x4713bc[_0xe718('0x2d')]=_[_0xe718('0x2c')](_0x2e4fc9[_0xe718('0x29')],qs['fields'](_0x5c6d42[_0xe718('0x25')][_0xe718('0x2e')]));_0x4713bc['attributes']=_0x4713bc['attributes']['length']?_0x4713bc['attributes']:_0x2e4fc9[_0xe718('0x29')];if(_0x5c6d42['query'][_0xe718('0x2f')]){_0x4713bc[_0xe718('0x30')]=[{'all':!![]}];}_0x4713bc=_[_0xe718('0x31')]({},_0x4713bc,_0x5c6d42[_0xe718('0x32')]);return db[_0xe718('0x1f')][_0xe718('0x33')](_0x4713bc)[_0xe718('0x17')](handleEntityNotFound(_0xa56023,null))[_0xe718('0x17')](respondWithResult(_0xa56023,null))[_0xe718('0x27')](handleError(_0xa56023,null));};exports[_0xe718('0x34')]=function(_0x3b3c9e,_0x3191d0){return db[_0xe718('0x1f')][_0xe718('0x34')](_0x3b3c9e['body'],{})['then'](respondWithResult(_0x3191d0,0xc9))[_0xe718('0x27')](handleError(_0x3191d0,null));};exports[_0xe718('0x15')]=function(_0x40207f,_0x6329af){if(_0x40207f[_0xe718('0x35')]['id']){delete _0x40207f[_0xe718('0x35')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x40207f[_0xe718('0x28')]['id']}})[_0xe718('0x17')](handleEntityNotFound(_0x6329af,null))[_0xe718('0x17')](saveUpdates(_0x40207f[_0xe718('0x35')],null))[_0xe718('0x17')](respondWithResult(_0x6329af,null))[_0xe718('0x27')](handleError(_0x6329af,null));};exports[_0xe718('0x16')]=function(_0x1ea855,_0x3a179b){return db[_0xe718('0x1f')][_0xe718('0x33')]({'where':{'id':_0x1ea855[_0xe718('0x28')]['id']}})[_0xe718('0x17')](handleEntityNotFound(_0x3a179b,null))['then'](removeEntity(_0x3a179b,null))[_0xe718('0x27')](handleError(_0x3a179b,null));};exports[_0xe718('0x36')]=function(_0x135df4,_0x58c359){return db[_0xe718('0x1f')]['describe']()[_0xe718('0x17')](respondWithResult(_0x58c359,null))[_0xe718('0x27')](handleError(_0x58c359,null));};exports[_0xe718('0x37')]=function(_0x1d6bf9,_0x47ebf0){return db[_0xe718('0x38')][_0xe718('0x33')]({'where':{'id':_0x1d6bf9['params']['id']}})['then'](handleEntityNotFound(_0x47ebf0,null))[_0xe718('0x17')](function(_0x2edd21){if(_0x2edd21){return _0x2edd21[_0xe718('0x37')](_0x1d6bf9[_0xe718('0x35')][_0xe718('0x39')],_[_0xe718('0x3a')](_0x1d6bf9[_0xe718('0x35')],[_0xe718('0x39'),'id'])||{});}})[_0xe718('0x17')](respondWithResult(_0x47ebf0,null))[_0xe718('0x27')](handleError(_0x47ebf0,null));};exports[_0xe718('0x3b')]=function(_0x403672,_0x120b19){var _0x1ff00d={'raw':![],'where':{}};var _0x40b731={};var _0x57ed2c={'count':0x0,'rows':[]};return db[_0xe718('0x1f')][_0xe718('0x3c')]({'where':{'id':_0x403672['params']['id']}})[_0xe718('0x17')](handleEntityNotFound(_0x120b19,null))[_0xe718('0x17')](function(_0x40cb09){if(_0x40cb09){_0x40b731[_0xe718('0x29')]=_[_0xe718('0x2a')](db['SmsMessage'][_0xe718('0x20')]);_0x40b731[_0xe718('0x25')]=_[_0xe718('0x2a')](_0x403672[_0xe718('0x25')]);_0x40b731[_0xe718('0x2b')]=_['intersection'](_0x40b731[_0xe718('0x29')],_0x40b731['query']);_0x1ff00d[_0xe718('0x2d')]=_[_0xe718('0x2c')](_0x40b731[_0xe718('0x29')],qs[_0xe718('0x2e')](_0x403672[_0xe718('0x25')][_0xe718('0x2e')]));_0x1ff00d[_0xe718('0x2d')]=_0x1ff00d['attributes']['length']?_0x1ff00d[_0xe718('0x2d')]:_0x40b731[_0xe718('0x29')];if(!_0x403672['query']['hasOwnProperty'](_0xe718('0x3d'))){_0x1ff00d[_0xe718('0x10')]=qs[_0xe718('0x10')](_0x403672['query'][_0xe718('0x10')]);_0x1ff00d[_0xe718('0xf')]=qs[_0xe718('0xf')](_0x403672[_0xe718('0x25')][_0xe718('0xf')]);}_0x1ff00d[_0xe718('0x3e')]=qs[_0xe718('0x3f')](_0x403672[_0xe718('0x25')][_0xe718('0x3f')]);_0x1ff00d[_0xe718('0x40')]=qs[_0xe718('0x2b')](_[_0xe718('0x41')](_0x403672[_0xe718('0x25')],_0x40b731[_0xe718('0x2b')]));_0x1ff00d[_0xe718('0x40')][_0xe718('0x42')]=_0x40cb09['id'];if(_0x403672[_0xe718('0x25')][_0xe718('0x43')]){_0x1ff00d[_0xe718('0x40')]=_[_0xe718('0x31')](_0x1ff00d['where'],{'$or':_[_0xe718('0x1e')](_0x1ff00d[_0xe718('0x2d')],function(_0x3e3ab5){var _0x129ae0={};_0x129ae0[_0x3e3ab5]={'$like':'%'+_0x403672['query'][_0xe718('0x43')]+'%'};return _0x129ae0;})});}if(_0x403672[_0xe718('0x25')][_0xe718('0x44')]){var _0x4338d8=_0x403672[_0xe718('0x25')][_0xe718('0x44')][_0xe718('0x45')](',');var _0x32fb0e={};_0x32fb0e[_0x4338d8[0x0]]={'$gte':moment(_0x4338d8[0x1])['format'](_0xe718('0x46'))};_0x1ff00d[_0xe718('0x40')]=_[_0xe718('0x31')](_0x1ff00d[_0xe718('0x40')],_0x32fb0e);}_0x1ff00d=_[_0xe718('0x31')]({},_0x1ff00d,_0x403672['options']);return db[_0xe718('0x38')][_0xe718('0x12')]({'where':_0x1ff00d[_0xe718('0x40')]})[_0xe718('0x17')](function(_0x210aa4){_0x57ed2c['count']=_0x210aa4;if(_0x403672[_0xe718('0x25')][_0xe718('0x2f')]){_0x1ff00d['include']=[{'all':!![]}];}return db[_0xe718('0x38')][_0xe718('0x23')](_0x1ff00d);})[_0xe718('0x17')](function(_0x3d4d7e){_0x57ed2c[_0xe718('0x47')]=_0x3d4d7e;return _0x57ed2c;});}})[_0xe718('0x17')](respondWithFilteredResult(_0x120b19,_0x1ff00d))[_0xe718('0x27')](handleError(_0x120b19,null));};exports[_0xe718('0x48')]=function(_0x1e89fa,_0x2b56d1){return db['SmsInteraction'][_0xe718('0x33')]({'where':{'id':_0x1e89fa[_0xe718('0x28')]['id']}})[_0xe718('0x17')](handleEntityNotFound(_0x2b56d1,null))['then'](function(_0x8b1f77){if(_0x8b1f77){return _0x8b1f77[_0xe718('0x49')](_0x1e89fa[_0xe718('0x35')][_0xe718('0x39')],_[_0xe718('0x3a')](_0x1e89fa[_0xe718('0x35')],['ids','id'])||{})['spread'](function(){return db[_0xe718('0x4a')]['findAll']({'attributes':['id',_0xe718('0x1b'),_0xe718('0x4b')],'where':{'id':_0x1e89fa[_0xe718('0x35')][_0xe718('0x39')]}});})['then'](function(_0x19d6a6){socket[_0xe718('0x4c')](_0xe718('0x4d'),{'id':Number(_0x1e89fa['params']['id']),'tags':_0x19d6a6||[]});return{'id':Number(_0x1e89fa[_0xe718('0x28')]['id']),'tags':_0x19d6a6||[]};});}})['then'](respondWithResult(_0x2b56d1,null))['catch'](handleError(_0x2b56d1,null));};exports[_0xe718('0x4e')]=function(_0x956ef5,_0x5bfad7){return db['SmsInteraction'][_0xe718('0x33')]({'where':{'id':_0x956ef5[_0xe718('0x28')]['id']}})[_0xe718('0x17')](handleEntityNotFound(_0x5bfad7,null))[_0xe718('0x17')](function(_0x704db5){if(_0x704db5){return _0x704db5[_0xe718('0x4e')](_0x956ef5[_0xe718('0x25')][_0xe718('0x39')]);}})[_0xe718('0x17')](respondWithStatusCode(_0x5bfad7,null))[_0xe718('0x27')](handleError(_0x5bfad7,null));};exports[_0xe718('0x4f')]=function(_0x106ade,_0x1c56e8){var _0x496310=moment()[_0xe718('0x50')]()[_0xe718('0x51')]();var _0x34bb2c=path['join'](config[_0xe718('0x52')],_0xe718('0x53'),_0xe718('0x54'),_0xe718('0x55'));var _0x103d95=path['join'](_0x34bb2c,_0x496310);var _0xf3ad9f=util['format'](_0xe718('0x56'),_0x106ade[_0xe718('0x28')]['id'],_0x496310);var _0x457890=path[_0xe718('0x57')](_0x34bb2c,_0xf3ad9f);var _0x49c9e9=[];_0x49c9e9[_0xe718('0x58')]({'model':db[_0xe718('0x59')],'as':_0xe718('0x59'),'attributes':['id',_0xe718('0x5a')],'raw':!![]});_0x49c9e9[_0xe718('0x58')]({'model':db[_0xe718('0x5b')],'as':_0xe718('0x5c'),'attributes':['id',_0xe718('0x5d'),_0xe718('0x5e')],'raw':!![]});var _0x4d0894=[{'model':db[_0xe718('0x38')],'as':_0xe718('0x5f'),'attributes':['id','body',_0xe718('0x60'),_0xe718('0x61'),_0xe718('0x62'),_0xe718('0x63')],'include':_0x49c9e9}];_0x4d0894[_0xe718('0x58')]({'model':db[_0xe718('0x64')],'as':_0xe718('0x65'),'attributes':['id',_0xe718('0x1b')]});_0x4d0894['push']({'model':db[_0xe718('0x59')],'as':'Owner','attributes':['id',_0xe718('0x5a')]});return db[_0xe718('0x1f')][_0xe718('0x33')]({'where':{'id':_0x106ade['params']['id']},'include':_0x4d0894})[_0xe718('0x17')](handleEntityNotFound(_0x1c56e8,null))[_0xe718('0x17')](function(_0x421571){if(_0x421571){var _0x38582d=_0x421571[_0xe718('0x66')]({'plain':!![]});fs['mkdirSync'](_0x103d95);var _0x5dbd0a={'channel':_0xe718('0x67'),'account':_0x38582d[_0xe718('0x65')][_0xe718('0x1b')],'agent':_0x38582d[_0xe718('0x68')]?_0x38582d[_0xe718('0x68')][_0xe718('0x5a')]:_0xe718('0x69'),'createdAt':moment(_0x38582d[_0xe718('0x60')])[_0xe718('0x6a')](_0xe718('0x46'))[_0xe718('0x51')](),'closedAt':_0x38582d[_0xe718('0x6b')]?moment(_0x38582d['closedAt'])[_0xe718('0x6a')](_0xe718('0x46'))[_0xe718('0x51')]():'','disposition':_0x38582d[_0xe718('0x6c')],'messages':_(_0x38582d[_0xe718('0x5f')])[_0xe718('0x43')]({'secret':![]})[_0xe718('0x1e')](function(_0x5384ce){return{'date':moment(_0x5384ce['createdAt'])[_0xe718('0x6a')](_0xe718('0x46'))[_0xe718('0x51')](),'sender':_0x5384ce[_0xe718('0x61')]===_0xe718('0x6d')?_0x5384ce[_0xe718('0x59')]?_0x5384ce[_0xe718('0x59')][_0xe718('0x5a')]:_0xe718('0x6e'):_0x5384ce['Contact']['firstName']+(_0x5384ce[_0xe718('0x5c')][_0xe718('0x5e')]?'\x20'+_0x5384ce[_0xe718('0x5c')][_0xe718('0x5e')]:''),'body':_0x5384ce[_0xe718('0x35')],'direction':_0x5384ce[_0xe718('0x61')]===_0xe718('0x6d')?'A':'C','secret':_0x5384ce[_0xe718('0x62')],'read':_0x5384ce[_0xe718('0x63')]};})[_0xe718('0x6f')]()};return ejs['renderFile'](path[_0xe718('0x57')](config[_0xe718('0x52')],_0xe718('0x53'),_0xe718('0x70'),_0xe718('0x71')),{'interaction':_0x5dbd0a})[_0xe718('0x17')](function(_0x2a2629){var _0x4d5dfa=path[_0xe718('0x57')](_0x103d95,'transcript-'+_0x38582d['id']+'-'+_0x496310+_0xe718('0x72'));var _0x1f8e08={'path':_0x4d5dfa,'channel':'Sms','interactionId':_0x38582d['id']};return pdf[_0xe718('0x73')](_0x2a2629,_0x1f8e08);})[_0xe718('0x17')](function(){return new BPromise(function(_0x46412d,_0x2e78eb){zipdir(_0x103d95,{'saveTo':_0x457890},function(_0x344836,_0x2b9d3d){if(_0x344836)return _0x2e78eb(_0x344836);return _0x46412d(_0x2b9d3d);});})[_0xe718('0x17')](function(){return new BPromise(function(_0x582d64,_0xddf87e){rimraf(_0x103d95,function(_0x281feb){if(_0x281feb)_0xddf87e(_0x281feb);return _0x582d64();});});})[_0xe718('0x17')](function(){return _0x1c56e8[_0xe718('0x4f')](_0x457890,_0xf3ad9f,function(_0x3b6794){if(_0x3b6794){console['log']('err',_0x3b6794);}else{fs[_0xe718('0x74')](_0x457890);}});});});}else{return _0x1c56e8[_0xe718('0x75')](0xc8);}})[_0xe718('0x27')](handleError(_0x1c56e8,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c985abf..3d9076f 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 _0x2032=['Users','map','unreadMessages','length','emit','hasOwnProperty','exports','../../mysqldb','SmsInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x2032,0xd9));var _0x2203=function(_0x3a199f,_0x234522){_0x3a199f=_0x3a199f-0x0;var _0x2fbbc3=_0x2032[_0x3a199f];return _0x2fbbc3;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var SmsMessage=require(_0x2203('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2203('0x2')](0x0);var events={'afterCreate':_0x2203('0x3'),'afterUpdate':'update','afterDestroy':_0x2203('0x4')};function emitEvent(_0x880dcd){return function(_0x44ccfd,_0x201796,_0x3f7ba1){_0x44ccfd[_0x2203('0x5')]({'attributes':['id'],'raw':!![]})[_0x2203('0x6')](function(_0x2676aa){_0x44ccfd[_0x2203('0x7')](_0x2203('0x8'),_0x2676aa[_0x2203('0x9')](function(_0x5ecf9e){return{'id':_0x5ecf9e['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x44ccfd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2203('0x6')](function(_0x549908){_0x44ccfd[_0x2203('0x7')](_0x2203('0xa'),_0x549908[_0x2203('0xb')]);SmsInteractionEvents['emit'](_0x880dcd+':'+_0x44ccfd['id'],_0x44ccfd);SmsInteractionEvents[_0x2203('0xc')](_0x880dcd,_0x44ccfd);_0x3f7ba1(null);})['catch'](_0x3f7ba1(null));};}for(var e in events){if(events[_0x2203('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x2203('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0xefda=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0x57a943,_0x33f711){var _0x512917=function(_0x57b1e1){while(--_0x57b1e1){_0x57a943['push'](_0x57a943['shift']());}};_0x512917(++_0x33f711);}(_0xefda,0x96));var _0xaefd=function(_0x1e8e7f,_0x10d55a){_0x1e8e7f=_0x1e8e7f-0x0;var _0x563328=_0xefda[_0x1e8e7f];return _0x563328;};'use strict';var EventEmitter=require(_0xaefd('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require(_0xaefd('0x1'))['db'][_0xaefd('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaefd('0x3'),'afterUpdate':_0xaefd('0x4'),'afterDestroy':_0xaefd('0x5')};function emitEvent(_0x22df24){return function(_0x1ef6b4,_0x3288f9,_0x497258){_0x1ef6b4[_0xaefd('0x6')]({'attributes':['id'],'raw':!![]})[_0xaefd('0x7')](function(_0x24d10c){_0x1ef6b4[_0xaefd('0x8')]('Users',_0x24d10c[_0xaefd('0x9')](function(_0xbb04fb){return{'id':_0xbb04fb['id']};}));return SmsMessage[_0xaefd('0xa')]({'where':{'SmsInteractionId':_0x1ef6b4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x48a255){_0x1ef6b4['setDataValue'](_0xaefd('0xb'),_0x48a255[_0xaefd('0xc')]);SmsInteractionEvents[_0xaefd('0xd')](_0x22df24+':'+_0x1ef6b4['id'],_0x1ef6b4);SmsInteractionEvents[_0xaefd('0xd')](_0x22df24,_0x1ef6b4);_0x497258(null);})[_0xaefd('0xe')](_0x497258(null));};}for(var e in events){if(events[_0xaefd('0xf')](e)){var event=events[e];SmsInteraction[_0xaefd('0x10')](e,emitEvent(event));}}module[_0xaefd('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 7bd3489..3317968 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 _0xabf4=['./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabf4,0x6e));var _0x4abf=function(_0x5ef9fc,_0x481b7f){_0x5ef9fc=_0x5ef9fc-0x0;var _0x27f8fb=_0xabf4[_0x5ef9fc];return _0x27f8fb;};'use strict';var _=require(_0x4abf('0x0'));var util=require('util');var logger=require(_0x4abf('0x1'))(_0x4abf('0x2'));var moment=require(_0x4abf('0x3'));var BPromise=require(_0x4abf('0x4'));var rp=require(_0x4abf('0x5'));var fs=require('fs');var path=require(_0x4abf('0x6'));var rimraf=require(_0x4abf('0x7'));var config=require(_0x4abf('0x8'));var attributes=require(_0x4abf('0x9'));module['exports']=function(_0x221dbb,_0x4dc22e){return _0x221dbb[_0x4abf('0xa')](_0x4abf('0xb'),attributes,{'tableName':_0x4abf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x447219,_0x5ef2ab,_0x480c4e){if(_0x447219[_0x4abf('0xd')](_0x4abf('0xe'))){_0x447219[_0x4abf('0xf')]=moment()[_0x4abf('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x480c4e(null,_0x447219);}}});}; \ No newline at end of file +var _0x58da=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt'];(function(_0x2ffda4,_0x3bef65){var _0x53d46e=function(_0x1bea82){while(--_0x1bea82){_0x2ffda4['push'](_0x2ffda4['shift']());}};_0x53d46e(++_0x3bef65);}(_0x58da,0x132));var _0xa58d=function(_0xc2d26f,_0x180ccf){_0xc2d26f=_0xc2d26f-0x0;var _0x50e707=_0x58da[_0xc2d26f];return _0x50e707;};'use strict';var _=require(_0xa58d('0x0'));var util=require(_0xa58d('0x1'));var logger=require(_0xa58d('0x2'))(_0xa58d('0x3'));var moment=require(_0xa58d('0x4'));var BPromise=require(_0xa58d('0x5'));var rp=require(_0xa58d('0x6'));var fs=require('fs');var path=require(_0xa58d('0x7'));var rimraf=require(_0xa58d('0x8'));var config=require('../../config/environment');var attributes=require(_0xa58d('0x9'));module[_0xa58d('0xa')]=function(_0x9430ff,_0x4df545){return _0x9430ff[_0xa58d('0xb')](_0xa58d('0xc'),attributes,{'tableName':_0xa58d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x235e7d,_0x409462,_0x553400){if(_0x235e7d[_0xa58d('0xe')](_0xa58d('0xf'))){_0x235e7d[_0xa58d('0x10')]=moment()[_0xa58d('0x11')](_0xa58d('0x12'));}_0x553400(null,_0x235e7d);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 18eec22..5483768 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 _0xfec6=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','AddTagsToSmsInteraction','find','where','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring'];(function(_0x440cc9,_0x5a3417){var _0x20690f=function(_0x1bf882){while(--_0x1bf882){_0x440cc9['push'](_0x440cc9['shift']());}};_0x20690f(++_0x5a3417);}(_0xfec6,0x182));var _0x6fec=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xfec6[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x6fec('0x0'));var util=require(_0x6fec('0x1'));var moment=require('moment');var BPromise=require(_0x6fec('0x2'));var rs=require(_0x6fec('0x3'));var fs=require('fs');var Redis=require(_0x6fec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fec('0x5'));var logger=require(_0x6fec('0x6'))('rpc');var config=require(_0x6fec('0x7'));var jayson=require(_0x6fec('0x8'));var client=jayson['client'][_0x6fec('0x9')]({'port':0x232a});config['redis']=_[_0x6fec('0xa')](config[_0x6fec('0xb')],{'host':_0x6fec('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6fec('0xd'))[_0x6fec('0xe')](socket);function respondWithRpcPromise(_0x3b8eca,_0x211b6e,_0x3e964f){return new BPromise(function(_0x3cef3a,_0x1a8296){return client[_0x6fec('0xf')](_0x3b8eca,_0x3e964f)[_0x6fec('0x10')](function(_0x20557e){logger[_0x6fec('0x11')](_0x6fec('0x12'),_0x211b6e,'request\x20sent');logger[_0x6fec('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x211b6e,'request\x20sent',JSON[_0x6fec('0x14')](_0x20557e));if(_0x20557e[_0x6fec('0x15')]){if(_0x20557e[_0x6fec('0x15')][_0x6fec('0x16')]===0x1f4){logger[_0x6fec('0x15')](_0x6fec('0x12'),_0x211b6e,_0x20557e[_0x6fec('0x15')][_0x6fec('0x17')]);return _0x1a8296(_0x20557e['error'][_0x6fec('0x17')]);}logger[_0x6fec('0x15')](_0x6fec('0x12'),_0x211b6e,_0x20557e[_0x6fec('0x15')][_0x6fec('0x17')]);return _0x3cef3a(_0x20557e[_0x6fec('0x15')]['message']);}else{logger[_0x6fec('0x11')](_0x6fec('0x12'),_0x211b6e,'request\x20sent');_0x3cef3a(_0x20557e['result'][_0x6fec('0x17')]);}})[_0x6fec('0x18')](function(_0x4e63ab){logger[_0x6fec('0x15')](_0x6fec('0x12'),_0x211b6e,_0x4e63ab);_0x1a8296(_0x4e63ab);});});}exports[_0x6fec('0x19')]=function(_0x97a782){var _0x51d68c=this;return new Promise(function(_0x2b7217,_0x32ad21){return db[_0x6fec('0x1a')][_0x6fec('0x1b')](_0x97a782[_0x6fec('0x1c')],{'raw':_0x97a782[_0x6fec('0x1d')]?_0x97a782[_0x6fec('0x1d')][_0x6fec('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x97a782[_0x6fec('0x1d')]?_0x97a782[_0x6fec('0x1d')]['where']||null:null,'attributes':_0x97a782[_0x6fec('0x1d')]?_0x97a782[_0x6fec('0x1d')][_0x6fec('0x1f')]||null:null,'limit':_0x97a782[_0x6fec('0x1d')]?_0x97a782[_0x6fec('0x1d')]['limit']||null:null})['then'](function(_0x4137f6){logger[_0x6fec('0x11')](_0x6fec('0x19'),_0x97a782);logger[_0x6fec('0x13')](_0x6fec('0x19'),_0x97a782,JSON[_0x6fec('0x14')](_0x4137f6));_0x2b7217(_0x4137f6);})[_0x6fec('0x18')](function(_0x1c2839){logger['error'](_0x6fec('0x19'),_0x1c2839[_0x6fec('0x17')],_0x97a782);_0x32ad21(_0x51d68c[_0x6fec('0x15')](0x1f4,_0x1c2839[_0x6fec('0x17')]));});});};exports[_0x6fec('0x20')]=function(_0x2dcd26){return new Promise(function(_0x148b13,_0x25f15b){return db[_0x6fec('0x1a')][_0x6fec('0x21')]({'where':_0x2dcd26[_0x6fec('0x1d')]?_0x2dcd26[_0x6fec('0x1d')][_0x6fec('0x22')]||null:null})[_0x6fec('0x10')](function(_0x1567db){if(_0x1567db){return _0x1567db['addTags'](_0x2dcd26[_0x6fec('0x1c')][_0x6fec('0x23')],_[_0x6fec('0x24')](_0x2dcd26[_0x6fec('0x1c')],[_0x6fec('0x23'),'id'])||{});}})[_0x6fec('0x25')](function(_0x39649e){logger[_0x6fec('0x11')]('AddTags',_0x2dcd26);logger[_0x6fec('0x13')]('AddTags',_0x2dcd26,JSON[_0x6fec('0x14')](_0x39649e));_0x148b13(_0x39649e);})[_0x6fec('0x18')](function(_0x17cd33){logger[_0x6fec('0x15')](_0x6fec('0x26'),_0x17cd33[_0x6fec('0x17')],_0x2dcd26);_0x25f15b(_this[_0x6fec('0x15')](0x1f4,_0x17cd33[_0x6fec('0x17')]));});});}; \ No newline at end of file +var _0x9686=['defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','addTags','ids','AddTags','lodash','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0x9686,0x69));var _0x6968=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9686[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6968('0x0'));var util=require('util');var moment=require(_0x6968('0x1'));var BPromise=require(_0x6968('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6968('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6968('0x4'))('rpc');var config=require(_0x6968('0x5'));var jayson=require(_0x6968('0x6'));var client=jayson[_0x6968('0x7')][_0x6968('0x8')]({'port':0x232a});config['redis']=_[_0x6968('0x9')](config[_0x6968('0xa')],{'host':_0x6968('0xb'),'port':0x18eb});var socket=require(_0x6968('0xc'))(new Redis(config[_0x6968('0xa')]));require(_0x6968('0xd'))[_0x6968('0xe')](socket);function respondWithRpcPromise(_0x110e32,_0x1d4a69,_0x4e9e1d){return new BPromise(function(_0x3ad4c4,_0x26d99f){return client[_0x6968('0xf')](_0x110e32,_0x4e9e1d)['then'](function(_0x3f07b7){logger['info'](_0x6968('0x10'),_0x1d4a69,_0x6968('0x11'));logger[_0x6968('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x1d4a69,_0x6968('0x11'),JSON[_0x6968('0x13')](_0x3f07b7));if(_0x3f07b7[_0x6968('0x14')]){if(_0x3f07b7[_0x6968('0x14')]['code']===0x1f4){logger[_0x6968('0x14')](_0x6968('0x10'),_0x1d4a69,_0x3f07b7['error'][_0x6968('0x15')]);return _0x26d99f(_0x3f07b7[_0x6968('0x14')][_0x6968('0x15')]);}logger['error'](_0x6968('0x10'),_0x1d4a69,_0x3f07b7[_0x6968('0x14')][_0x6968('0x15')]);return _0x3ad4c4(_0x3f07b7[_0x6968('0x14')][_0x6968('0x15')]);}else{logger[_0x6968('0x16')](_0x6968('0x10'),_0x1d4a69,'request\x20sent');_0x3ad4c4(_0x3f07b7['result']['message']);}})[_0x6968('0x17')](function(_0x3a5efb){logger['error'](_0x6968('0x10'),_0x1d4a69,_0x3a5efb);_0x26d99f(_0x3a5efb);});});}exports['UpdateSmsInteraction']=function(_0x331a45){var _0x102844=this;return new Promise(function(_0x67183c,_0x287891){return db[_0x6968('0x18')][_0x6968('0x19')](_0x331a45[_0x6968('0x1a')],{'raw':_0x331a45['options']?_0x331a45[_0x6968('0x1b')][_0x6968('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x331a45[_0x6968('0x1b')]?_0x331a45[_0x6968('0x1b')][_0x6968('0x1d')]||null:null,'attributes':_0x331a45[_0x6968('0x1b')]?_0x331a45[_0x6968('0x1b')][_0x6968('0x1e')]||null:null,'limit':_0x331a45[_0x6968('0x1b')]?_0x331a45[_0x6968('0x1b')][_0x6968('0x1f')]||null:null})[_0x6968('0x20')](function(_0xc643be){logger['info'](_0x6968('0x21'),_0x331a45);logger['debug'](_0x6968('0x21'),_0x331a45,JSON[_0x6968('0x13')](_0xc643be));_0x67183c(_0xc643be);})['catch'](function(_0x1b1e31){logger['error']('UpdateSmsInteraction',_0x1b1e31[_0x6968('0x15')],_0x331a45);_0x287891(_0x102844[_0x6968('0x14')](0x1f4,_0x1b1e31[_0x6968('0x15')]));});});};exports[_0x6968('0x22')]=function(_0x2a8045){return new Promise(function(_0xf83c51,_0x111b50){return db['SmsInteraction']['find']({'where':_0x2a8045[_0x6968('0x1b')]?_0x2a8045['options']['where']||null:null})['then'](function(_0x22c02c){if(_0x22c02c){return _0x22c02c[_0x6968('0x23')](_0x2a8045[_0x6968('0x1a')]['ids'],_['omit'](_0x2a8045['body'],[_0x6968('0x24'),'id'])||{});}})['spread'](function(_0x4bacd0){logger[_0x6968('0x16')]('AddTags',_0x2a8045);logger[_0x6968('0x12')]('AddTags',_0x2a8045,JSON[_0x6968('0x13')](_0x4bacd0));_0xf83c51(_0x4bacd0);})[_0x6968('0x17')](function(_0x669c1b){logger[_0x6968('0x14')](_0x6968('0x25'),_0x669c1b[_0x6968('0x15')],_0x2a8045);_0x111b50(_this[_0x6968('0x14')](0x1f4,_0x669c1b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5f7a34d..941cdc0 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 _0xe344=['smsInteraction:','./smsInteraction.events','save','remove','emit','removeListener','register','length'];(function(_0x3eef96,_0x18c7a9){var _0x4693a8=function(_0x2cf359){while(--_0x2cf359){_0x3eef96['push'](_0x3eef96['shift']());}};_0x4693a8(++_0x18c7a9);}(_0xe344,0x189));var _0x4e34=function(_0x42e1cb,_0x336a39){_0x42e1cb=_0x42e1cb-0x0;var _0x4d155a=_0xe344[_0x42e1cb];return _0x4d155a;};'use strict';var SmsInteractionEvents=require(_0x4e34('0x0'));var events=[_0x4e34('0x1'),_0x4e34('0x2'),'update'];function createListener(_0x1c7f33,_0x1ad95c){return function(_0x237da8){_0x1ad95c[_0x4e34('0x3')](_0x1c7f33,_0x237da8);};}function removeListener(_0x727eb9,_0x269ab9){return function(){SmsInteractionEvents[_0x4e34('0x4')](_0x727eb9,_0x269ab9);};}exports[_0x4e34('0x5')]=function(_0xa606a8){for(var _0x419ba4=0x0,_0x29bda4=events[_0x4e34('0x6')];_0x419ba4<_0x29bda4;_0x419ba4++){var _0x55a76c=events[_0x419ba4];var _0x551a0d=createListener(_0x4e34('0x7')+_0x55a76c,_0xa606a8);SmsInteractionEvents['on'](_0x55a76c,_0x551a0d);}}; \ No newline at end of file +var _0x6fa0=['smsInteraction:','./smsInteraction.events','update','emit','register','length'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x6fa0,0xf1));var _0x06fa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6fa0[_0x122ef9];return _0x42fba0;};'use strict';var SmsInteractionEvents=require(_0x06fa('0x0'));var events=['save','remove',_0x06fa('0x1')];function createListener(_0x28c98d,_0x27a49d){return function(_0x3498d4){_0x27a49d[_0x06fa('0x2')](_0x28c98d,_0x3498d4);};}function removeListener(_0x51dbff,_0x70ada7){return function(){SmsInteractionEvents['removeListener'](_0x51dbff,_0x70ada7);};}exports[_0x06fa('0x3')]=function(_0x59a7a0){for(var _0x3db2ca=0x0,_0x141b5b=events[_0x06fa('0x4')];_0x3db2ca<_0x141b5b;_0x3db2ca++){var _0x15ca2b=events[_0x3db2ca];var _0x448356=createListener(_0x06fa('0x5')+_0x15ca2b,_0x59a7a0);SmsInteractionEvents['on'](_0x15ca2b,_0x448356);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 1b13784..69645da 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 _0xb31b=['accept','/:id/reject','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','index','isAuthenticated','describe','/:id','show','post','tracked','sms','smsmessage:create','create','put','update','/:id/accept'];(function(_0x2610e1,_0x5a86f1){var _0xef812e=function(_0x6bd568){while(--_0x6bd568){_0x2610e1['push'](_0x2610e1['shift']());}};_0xef812e(++_0x5a86f1);}(_0xb31b,0x9f));var _0xbb31=function(_0x4284bf,_0x1812da){_0x4284bf=_0x4284bf-0x0;var _0x56c154=_0xb31b[_0x4284bf];return _0x56c154;};'use strict';var multer=require(_0xbb31('0x0'));var util=require(_0xbb31('0x1'));var path=require(_0xbb31('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb31('0x3'));var router=express[_0xbb31('0x4')]();var fs_extra=require(_0xbb31('0x5'));var auth=require(_0xbb31('0x6'));var interaction=require(_0xbb31('0x7'));var config=require('../../config/environment');var controller=require(_0xbb31('0x8'));router[_0xbb31('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb31('0xa')]);router['get']('/describe',auth[_0xbb31('0xb')](),controller[_0xbb31('0xc')]);router[_0xbb31('0x9')](_0xbb31('0xd'),auth[_0xbb31('0xb')](),controller[_0xbb31('0xe')]);router[_0xbb31('0xf')]('/',auth[_0xbb31('0xb')](),interaction[_0xbb31('0x10')](_0xbb31('0x11'),_0xbb31('0x12')),controller[_0xbb31('0x13')]);router[_0xbb31('0xf')]('/:id/status',controller['status']);router[_0xbb31('0x14')](_0xbb31('0xd'),auth[_0xbb31('0xb')](),controller[_0xbb31('0x15')]);router['put'](_0xbb31('0x16'),auth[_0xbb31('0xb')](),controller[_0xbb31('0x17')]);router[_0xbb31('0x14')](_0xbb31('0x18'),auth[_0xbb31('0xb')](),controller['reject']);router[_0xbb31('0x19')]('/:id',auth[_0xbb31('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x52fe=['/:id','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x1fbf82,_0x5a47f3){var _0x2374a5=function(_0x2131cb){while(--_0x2131cb){_0x1fbf82['push'](_0x1fbf82['shift']());}};_0x2374a5(++_0x5a47f3);}(_0x52fe,0xc5));var _0xe52f=function(_0x5ab3e6,_0x40a4e2){_0x5ab3e6=_0x5ab3e6-0x0;var _0x4c2e8a=_0x52fe[_0x5ab3e6];return _0x4c2e8a;};'use strict';var multer=require(_0xe52f('0x0'));var util=require(_0xe52f('0x1'));var path=require(_0xe52f('0x2'));var timeout=require(_0xe52f('0x3'));var express=require(_0xe52f('0x4'));var router=express[_0xe52f('0x5')]();var fs_extra=require(_0xe52f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe52f('0x7'));var config=require('../../config/environment');var controller=require(_0xe52f('0x8'));router[_0xe52f('0x9')]('/',auth[_0xe52f('0xa')](),controller[_0xe52f('0xb')]);router[_0xe52f('0x9')](_0xe52f('0xc'),auth[_0xe52f('0xa')](),controller['describe']);router[_0xe52f('0x9')](_0xe52f('0xd'),auth[_0xe52f('0xa')](),controller[_0xe52f('0xe')]);router[_0xe52f('0xf')]('/',auth[_0xe52f('0xa')](),interaction[_0xe52f('0x10')](_0xe52f('0x11'),_0xe52f('0x12')),controller['create']);router[_0xe52f('0xf')](_0xe52f('0x13'),controller[_0xe52f('0x14')]);router[_0xe52f('0x15')](_0xe52f('0xd'),auth[_0xe52f('0xa')](),controller[_0xe52f('0x16')]);router['put'](_0xe52f('0x17'),auth[_0xe52f('0xa')](),controller[_0xe52f('0x18')]);router[_0xe52f('0x15')](_0xe52f('0x19'),auth['isAuthenticated'](),controller[_0xe52f('0x1a')]);router[_0xe52f('0x1b')](_0xe52f('0xd'),auth[_0xe52f('0xa')](),controller[_0xe52f('0x1c')]);module[_0xe52f('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index ee490ff..3206479 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 _0x75a2=['exports','TEXT','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75a2,0x187));var _0x275a=function(_0x3e7585,_0xedbf2d){_0x3e7585=_0x3e7585-0x0;var _0xd793ea=_0x75a2[_0x3e7585];return _0xd793ea;};'use strict';var Sequelize=require(_0x275a('0x0'));module[_0x275a('0x1')]={'body':{'type':Sequelize[_0x275a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x275a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x275a('0x4')]('in',_0x275a('0x5')),'defaultValue':_0x275a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x275a('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3a5e=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x572149,_0x1e8aab){var _0x256761=function(_0x4dff2d){while(--_0x4dff2d){_0x572149['push'](_0x572149['shift']());}};_0x256761(++_0x1e8aab);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x11bdf4,_0x36efdc){_0x11bdf4=_0x11bdf4-0x0;var _0x20b5fe=_0x3a5e[_0x11bdf4];return _0x20b5fe;};'use strict';var Sequelize=require(_0xe3a5('0x0'));module[_0xe3a5('0x1')]={'body':{'type':Sequelize[_0xe3a5('0x2')](_0xe3a5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe3a5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe3a5('0x5')]('in','out'),'defaultValue':_0xe3a5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe3a5('0x7')](0xbe)},'phone':{'type':Sequelize[_0xe3a5('0x7')]},'readAt':{'type':Sequelize[_0xe3a5('0x8')]},'secret':{'type':Sequelize[_0xe3a5('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'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 1b626b4..3d1c112 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 _0x01d3=['twilio','plivo','MessageUUID','sent','delivered','Status','plivio','infobip','results','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','client','http','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','request\x20sent','catch','status','end','json','undefined','count','offset','limit','set','save','update','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','SmsMessage','includeAll','include','rows','show','params','keys','intersection','length','find','create','body','destroy','describe','sms-interactions','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','EventManager','acceptmessage','../../config/logger','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','contact','motionChannel','event','reject','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x250071,_0x301941){var _0x34e574=function(_0x567186){while(--_0x567186){_0x250071['push'](_0x250071['shift']());}};_0x34e574(++_0x301941);}(_0x01d3,0xa2));var _0x301d=function(_0x58cb91,_0x5269bb){_0x58cb91=_0x58cb91-0x0;var _0x41c2ae=_0x01d3[_0x58cb91];return _0x41c2ae;};'use strict';var emlformat=require(_0x301d('0x0'));var rimraf=require(_0x301d('0x1'));var zipdir=require(_0x301d('0x2'));var jsonpatch=require(_0x301d('0x3'));var rp=require('request-promise');var moment=require(_0x301d('0x4'));var BPromise=require(_0x301d('0x5'));var Mustache=require('mustache');var util=require(_0x301d('0x6'));var path=require(_0x301d('0x7'));var sox=require(_0x301d('0x8'));var csv=require(_0x301d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x301d('0xa'));var _=require(_0x301d('0xb'));var squel=require(_0x301d('0xc'));var crypto=require(_0x301d('0xd'));var jsforce=require(_0x301d('0xe'));var deskjs=require(_0x301d('0xf'));var toCsv=require(_0x301d('0x9'));var querystring=require(_0x301d('0x10'));var Papa=require(_0x301d('0x11'));var Redis=require(_0x301d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x301d('0x13'));var as=require(_0x301d('0x14'));var hardwareService=require(_0x301d('0x15'));var logger=require('../../config/logger')(_0x301d('0x16'));var utils=require(_0x301d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x301d('0x18')]=_[_0x301d('0x19')](config[_0x301d('0x18')],{'host':_0x301d('0x1a'),'port':0x18eb});var socket=require(_0x301d('0x1b'))(new Redis(config[_0x301d('0x18')]));require(_0x301d('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x301d('0x1d')][_0x301d('0x1e')]({'port':0x232c});var client9002=jayson[_0x301d('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d89a0,_0x4f0f10,_0x5a1583,_0x36f7d5){return new BPromise(function(_0x3deffb,_0x395ff3){var _0xc31e6d=_0x36f7d5||client;return _0xc31e6d[_0x301d('0x1f')](_0x4d89a0,_0x5a1583)[_0x301d('0x20')](function(_0x4c36a6){logger[_0x301d('0x21')]('SmsMessage,\x20%s,\x20%s',_0x4f0f10,'request\x20sent');logger[_0x301d('0x22')](_0x301d('0x23'),_0x4f0f10,'request\x20sent',JSON[_0x301d('0x24')](_0x4c36a6));if(_0x4c36a6['error']){if(_0x4c36a6[_0x301d('0x25')][_0x301d('0x26')]===0x1f4){logger[_0x301d('0x25')]('SmsMessage,\x20%s,\x20%s',_0x4f0f10,_0x4c36a6[_0x301d('0x25')]['message']);return _0x395ff3(_0x4c36a6[_0x301d('0x25')][_0x301d('0x27')]);}logger[_0x301d('0x25')]('SmsMessage,\x20%s,\x20%s',_0x4f0f10,_0x4c36a6[_0x301d('0x25')][_0x301d('0x27')]);return _0x3deffb(_0x4c36a6[_0x301d('0x25')][_0x301d('0x27')]);}else{logger[_0x301d('0x21')](_0x301d('0x28'),_0x4f0f10,_0x301d('0x29'));_0x3deffb(_0x4c36a6['result'][_0x301d('0x27')]);}})[_0x301d('0x2a')](function(_0x45e7e3){logger['error'](_0x301d('0x28'),_0x4f0f10,_0x45e7e3);_0x395ff3(_0x45e7e3);});});}function respondWithStatusCode(_0x3d9dc6,_0x4fe881){_0x4fe881=_0x4fe881||0xcc;return function(_0x44aa87){if(_0x44aa87){return _0x3d9dc6['sendStatus'](_0x4fe881);}return _0x3d9dc6[_0x301d('0x2b')](_0x4fe881)[_0x301d('0x2c')]();};}function respondWithResult(_0x49f1ac,_0x332175){_0x332175=_0x332175||0xc8;return function(_0x5580fe){if(_0x5580fe){return _0x49f1ac['status'](_0x332175)[_0x301d('0x2d')](_0x5580fe);}};}function respondWithFilteredResult(_0x67c4de,_0x2a6652){return function(_0x54423d){if(_0x54423d){var _0x361940=typeof _0x2a6652['offset']==='undefined'&&typeof _0x2a6652['limit']===_0x301d('0x2e');var _0x54e9a1=_0x54423d[_0x301d('0x2f')];var _0xa06831=_0x361940?0x0:_0x2a6652[_0x301d('0x30')];var _0x130d36=_0x361940?_0x54423d[_0x301d('0x2f')]:_0x2a6652[_0x301d('0x30')]+_0x2a6652[_0x301d('0x31')];var _0x1b1d83;if(_0x130d36>=_0x54e9a1){_0x130d36=_0x54e9a1;_0x1b1d83=0xc8;}else{_0x1b1d83=0xce;}_0x67c4de['status'](_0x1b1d83);return _0x67c4de[_0x301d('0x32')]('Content-Range',_0xa06831+'-'+_0x130d36+'/'+_0x54e9a1)[_0x301d('0x2d')](_0x54423d);}return null;};}function patchUpdates(_0xfc69f4){return function(_0x586f7d){try{jsonpatch['apply'](_0x586f7d,_0xfc69f4,!![]);}catch(_0x1e7c8f){return BPromise['reject'](_0x1e7c8f);}return _0x586f7d[_0x301d('0x33')]();};}function saveUpdates(_0x257c6f,_0x2d4c9f){return function(_0x245710){if(_0x245710){return _0x245710[_0x301d('0x34')](_0x257c6f)[_0x301d('0x20')](function(_0x2c74b5){return _0x2c74b5;});}return null;};}function removeEntity(_0x40d5af,_0x6d751){return function(_0xfee86d){if(_0xfee86d){return _0xfee86d['destroy']()['then'](function(){_0x40d5af['status'](0xcc)[_0x301d('0x2c')]();});}};}function handleEntityNotFound(_0x475209,_0x4501c9){return function(_0x54152d){if(!_0x54152d){_0x475209[_0x301d('0x35')](0x194);}return _0x54152d;};}function handleError(_0xb6bee3,_0x143f3e){_0x143f3e=_0x143f3e||0x1f4;return function(_0x4ca338){logger[_0x301d('0x25')](_0x4ca338[_0x301d('0x36')]);if(_0x4ca338[_0x301d('0x37')]){delete _0x4ca338['name'];}_0xb6bee3[_0x301d('0x2b')](_0x143f3e)[_0x301d('0x38')](_0x4ca338);};}exports[_0x301d('0x39')]=function(_0x1658ec,_0x7160b2){var _0x16b5dc={},_0x29f226={},_0x1ee8df={'count':0x0,'rows':[]};var _0x2e4f6a=_['map'](db['SmsMessage'][_0x301d('0x3a')],function(_0x3cff49){return{'name':_0x3cff49[_0x301d('0x3b')],'type':_0x3cff49[_0x301d('0x3c')][_0x301d('0x3d')]};});_0x29f226[_0x301d('0x3e')]=_[_0x301d('0x3f')](_0x2e4f6a,'name');_0x29f226[_0x301d('0x40')]=_['keys'](_0x1658ec['query']);_0x29f226[_0x301d('0x41')]=_['intersection'](_0x29f226[_0x301d('0x3e')],_0x29f226[_0x301d('0x40')]);_0x16b5dc[_0x301d('0x42')]=_['intersection'](_0x29f226['model'],qs[_0x301d('0x43')](_0x1658ec[_0x301d('0x40')]['fields']));_0x16b5dc['attributes']=_0x16b5dc[_0x301d('0x42')]['length']?_0x16b5dc['attributes']:_0x29f226[_0x301d('0x3e')];if(!_0x1658ec[_0x301d('0x40')][_0x301d('0x44')](_0x301d('0x45'))){_0x16b5dc[_0x301d('0x31')]=qs[_0x301d('0x31')](_0x1658ec['query']['limit']);_0x16b5dc['offset']=qs['offset'](_0x1658ec[_0x301d('0x40')][_0x301d('0x30')]);}_0x16b5dc[_0x301d('0x46')]=qs[_0x301d('0x47')](_0x1658ec[_0x301d('0x40')][_0x301d('0x47')]);_0x16b5dc['where']=qs[_0x301d('0x41')](_[_0x301d('0x48')](_0x1658ec[_0x301d('0x40')],_0x29f226[_0x301d('0x41')]),_0x2e4f6a);if(_0x1658ec[_0x301d('0x40')][_0x301d('0x49')]){_0x16b5dc[_0x301d('0x4a')]=_['merge'](_0x16b5dc[_0x301d('0x4a')],{'$or':_[_0x301d('0x3f')](_0x2e4f6a,function(_0x354fd9){if(_0x354fd9['type']!==_0x301d('0x4b')){var _0x12d390={};_0x12d390[_0x354fd9[_0x301d('0x37')]]={'$like':'%'+_0x1658ec[_0x301d('0x40')][_0x301d('0x49')]+'%'};return _0x12d390;}})});}_0x16b5dc=_[_0x301d('0x4c')]({},_0x16b5dc,_0x1658ec[_0x301d('0x4d')]);var _0x415d54={'where':_0x16b5dc['where']};return db[_0x301d('0x4e')][_0x301d('0x2f')](_0x415d54)[_0x301d('0x20')](function(_0x56e8a2){_0x1ee8df[_0x301d('0x2f')]=_0x56e8a2;if(_0x1658ec['query'][_0x301d('0x4f')]){_0x16b5dc[_0x301d('0x50')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x16b5dc);})[_0x301d('0x20')](function(_0x4d61e2){_0x1ee8df[_0x301d('0x51')]=_0x4d61e2;return _0x1ee8df;})[_0x301d('0x20')](respondWithFilteredResult(_0x7160b2,_0x16b5dc))['catch'](handleError(_0x7160b2,null));};exports[_0x301d('0x52')]=function(_0x362623,_0x193894){var _0x174853={'raw':!![],'where':{'id':_0x362623[_0x301d('0x53')]['id']}},_0x2bfe3e={};_0x2bfe3e[_0x301d('0x3e')]=_[_0x301d('0x54')](db[_0x301d('0x4e')][_0x301d('0x3a')]);_0x2bfe3e[_0x301d('0x40')]=_[_0x301d('0x54')](_0x362623['query']);_0x2bfe3e[_0x301d('0x41')]=_[_0x301d('0x55')](_0x2bfe3e[_0x301d('0x3e')],_0x2bfe3e['query']);_0x174853['attributes']=_[_0x301d('0x55')](_0x2bfe3e[_0x301d('0x3e')],qs[_0x301d('0x43')](_0x362623[_0x301d('0x40')][_0x301d('0x43')]));_0x174853['attributes']=_0x174853[_0x301d('0x42')][_0x301d('0x56')]?_0x174853[_0x301d('0x42')]:_0x2bfe3e[_0x301d('0x3e')];if(_0x362623['query'][_0x301d('0x4f')]){_0x174853[_0x301d('0x50')]=[{'all':!![]}];}_0x174853=_['merge']({},_0x174853,_0x362623[_0x301d('0x4d')]);return db[_0x301d('0x4e')][_0x301d('0x57')](_0x174853)[_0x301d('0x20')](handleEntityNotFound(_0x193894,null))[_0x301d('0x20')](respondWithResult(_0x193894,null))[_0x301d('0x2a')](handleError(_0x193894,null));};exports[_0x301d('0x58')]=function(_0x58d7b0,_0x1ec744){return db[_0x301d('0x4e')][_0x301d('0x58')](_0x58d7b0[_0x301d('0x59')],{})['then'](respondWithResult(_0x1ec744,0xc9))[_0x301d('0x2a')](handleError(_0x1ec744,null));};exports['update']=function(_0x52baaa,_0x39de68){if(_0x52baaa['body']['id']){delete _0x52baaa[_0x301d('0x59')]['id'];}return db['SmsMessage'][_0x301d('0x57')]({'where':{'id':_0x52baaa[_0x301d('0x53')]['id']}})[_0x301d('0x20')](handleEntityNotFound(_0x39de68,null))[_0x301d('0x20')](saveUpdates(_0x52baaa[_0x301d('0x59')],null))[_0x301d('0x20')](respondWithResult(_0x39de68,null))[_0x301d('0x2a')](handleError(_0x39de68,null));};exports[_0x301d('0x5a')]=function(_0x51c347,_0x35a012){return db[_0x301d('0x4e')]['find']({'where':{'id':_0x51c347[_0x301d('0x53')]['id']}})['then'](handleEntityNotFound(_0x35a012,null))[_0x301d('0x20')](removeEntity(_0x35a012,null))[_0x301d('0x2a')](handleError(_0x35a012,null));};exports['describe']=function(_0x41e798,_0x2015ca){return db[_0x301d('0x4e')][_0x301d('0x5b')]()['then'](respondWithResult(_0x2015ca,null))['catch'](handleError(_0x2015ca,null));};var interaction_log=require('../../config/logger')(_0x301d('0x5c'));exports[_0x301d('0x5d')]=function(_0x262ea,_0x26e0c2,_0x1015cd){var _0x221aa7={'agent':{},'channel':_0x301d('0x5e')};if(_0x262ea[_0x301d('0x59')]['id']){delete _0x262ea[_0x301d('0x59')]['id'];}_0x262ea[_0x301d('0x59')][_0x301d('0x5f')]=!![];_0x262ea['body'][_0x301d('0x60')]=moment()[_0x301d('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x262ea[_0x301d('0x59')][_0x301d('0x62')]=_0x262ea[_0x301d('0x59')]['UserId']||_0x262ea[_0x301d('0x63')]['id'];_0x221aa7[_0x301d('0x64')]['id']=_0x262ea[_0x301d('0x59')][_0x301d('0x62')];return db['SmsMessage'][_0x301d('0x57')]({'where':{'id':_0x262ea[_0x301d('0x53')]['id'],'UserId':null}})[_0x301d('0x20')](handleEntityNotFound(_0x26e0c2,null))[_0x301d('0x20')](saveUpdates(_0x262ea[_0x301d('0x59')],null))[_0x301d('0x20')](function(_0x495cd6){if(_0x495cd6){_0x221aa7[_0x301d('0x27')]=_0x495cd6[_0x301d('0x65')]({'plain':!![]});return db[_0x301d('0x66')]['find']({'where':{'id':_0x495cd6[_0x301d('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x26e0c2,null))['then'](function(_0x72ee88){if(_0x72ee88){return _0x72ee88[_0x301d('0x34')]({'UserId':_0x262ea[_0x301d('0x59')]['UserId'],'read1stAt':_[_0x301d('0x68')](_0x72ee88[_0x301d('0x69')])?moment()[_0x301d('0x61')](_0x301d('0x6a')):undefined});}return null;})[_0x301d('0x20')](function(_0x10683c){if(_0x10683c){_0x221aa7[_0x301d('0x6b')]=_0x10683c[_0x301d('0x65')]({'plain':!![]});interaction_log['info'](_0x301d('0x6c'),_0x262ea['user']['id'],_0x262ea[_0x301d('0x63')][_0x301d('0x37')],_0x262ea['user'][_0x301d('0x6d')],_0x221aa7[_0x301d('0x6b')]['id'],_0x262ea[_0x301d('0x59')]?JSON[_0x301d('0x24')](_0x262ea['body']):'null');return respondWithRpcPromise(_0x301d('0x6e'),_0x301d('0x6f'),_0x221aa7);}return null;})[_0x301d('0x20')](function(_0x569a72){var _0x2e050f=_0x301d('0x70')+_0x569a72[_0x301d('0x27')]['ContactId'];return db[_0x301d('0x71')][_0x301d('0x40')](_0x2e050f,{'type':db[_0x301d('0x72')]['QueryTypes'][_0x301d('0x73')],'raw':!![]})['then'](function(_0x50feca){return _0x50feca;});})['then'](function(_0x1fac45){if(_0x1fac45){_0x221aa7['message']['contact']=_0x1fac45[0x0];if(!_0x262ea[_0x301d('0x59')][_0x301d('0x62')])return;return db[_0x301d('0x74')][_0x301d('0x57')]({'where':{'id':_0x262ea[_0x301d('0x59')][_0x301d('0x62')],'role':_0x301d('0x64')},'attributes':['id',_0x301d('0x37'),_0x301d('0x75'),_0x301d('0x76'),_0x301d('0x77')],'raw':!![]});}return null;})['then'](function(_0x935f98){if(!_0x935f98)return null;_0x221aa7[_0x301d('0x27')][_0x301d('0x64')]=_0x935f98;return _0x221aa7;})[_0x301d('0x20')](function(_0x283705){if(_0x283705){if(_0x262ea['body']['manual']){_0x221aa7[_0x301d('0x27')][_0x301d('0x78')]=util[_0x301d('0x61')](_0x301d('0x79'),_0x262ea[_0x301d('0x63')][_0x301d('0x37')]);_0x221aa7[_0x301d('0x27')][_0x301d('0x7a')]=_0x221aa7[_0x301d('0x7a')];_0x221aa7[_0x301d('0x27')]['motionChannel']=_0x221aa7[_0x301d('0x7a')];_0x221aa7[_0x301d('0x27')]['event']=_0x301d('0x5d');return respondWithRpcPromise(_0x301d('0x7b'),_0x301d('0x7b'),{'event':_0x301d('0x7c'),'message':_0x221aa7[_0x301d('0x27')]},client9002)[_0x301d('0x20')](function(){return _0x221aa7;});}return _0x221aa7;}return null;})[_0x301d('0x20')](respondWithResult(_0x26e0c2,null))[_0x301d('0x2a')](handleError(_0x26e0c2,null));};var interaction_log=require(_0x301d('0x7d'))(_0x301d('0x5c'));exports['reject']=function(_0x38e3d7,_0xe9f979,_0x241b0a){var _0x14bf2d={'agent':{},'channel':_0x301d('0x5e')};if(_0x38e3d7['body']['id']){delete _0x38e3d7[_0x301d('0x59')]['id'];}_0x38e3d7[_0x301d('0x59')]['UserId']=_0x38e3d7['body'][_0x301d('0x62')]||_0x38e3d7[_0x301d('0x63')]['id'];_0x14bf2d[_0x301d('0x64')]['id']=_0x38e3d7[_0x301d('0x59')]['UserId'];return db[_0x301d('0x4e')]['find']({'where':{'id':_0x38e3d7['params']['id'],'UserId':null}})[_0x301d('0x20')](handleEntityNotFound(_0xe9f979,null))[_0x301d('0x20')](function(_0xe4da6b){if(_0xe4da6b){_0x14bf2d[_0x301d('0x27')]=_0xe4da6b[_0x301d('0x65')]({'plain':!![]});return db[_0x301d('0x66')][_0x301d('0x57')]({'where':{'id':_0xe4da6b[_0x301d('0x67')]}});}return null;})['then'](handleEntityNotFound(_0xe9f979,null))[_0x301d('0x20')](function(_0x43cc07){if(_0x43cc07){_0x14bf2d[_0x301d('0x6b')]=_0x43cc07[_0x301d('0x65')]({'plain':!![]});interaction_log['info'](_0x301d('0x7e'),_0x38e3d7['user']['id'],_0x38e3d7[_0x301d('0x63')][_0x301d('0x37')],_0x38e3d7['user']['role'],_0x14bf2d[_0x301d('0x6b')]['id'],_0x38e3d7['body']?JSON[_0x301d('0x24')](_0x38e3d7[_0x301d('0x59')]):_0x301d('0x7f'));return respondWithRpcPromise(_0x301d('0x80'),_0x301d('0x81'),_0x14bf2d);}return null;})[_0x301d('0x20')](function(_0x40f366){var _0x2e2580='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x40f366[_0x301d('0x27')]['ContactId'];return db[_0x301d('0x71')]['query'](_0x2e2580,{'type':db[_0x301d('0x72')]['QueryTypes'][_0x301d('0x73')],'raw':!![]})['then'](function(_0x18941d){return _0x18941d;});})[_0x301d('0x20')](function(_0x597c17){if(_0x597c17){_0x14bf2d[_0x301d('0x27')][_0x301d('0x82')]=_0x597c17[0x0];if(!_0x38e3d7[_0x301d('0x59')][_0x301d('0x62')])return;return db['User'][_0x301d('0x57')]({'where':{'id':_0x38e3d7[_0x301d('0x59')][_0x301d('0x62')],'role':_0x301d('0x64')},'attributes':['id',_0x301d('0x37'),_0x301d('0x75'),_0x301d('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x27d887){if(!_0x27d887)return null;_0x14bf2d[_0x301d('0x27')][_0x301d('0x64')]=_0x27d887;return _0x14bf2d;})['then'](function(_0x24b51c){if(_0x24b51c){_0x24b51c[_0x301d('0x27')][_0x301d('0x78')]=util[_0x301d('0x61')]('SIP/%s',_0x38e3d7['user']['name']);_0x24b51c[_0x301d('0x27')][_0x301d('0x7a')]=_0x14bf2d[_0x301d('0x7a')];_0x24b51c[_0x301d('0x27')][_0x301d('0x83')]=_0x14bf2d[_0x301d('0x7a')];_0x24b51c[_0x301d('0x27')][_0x301d('0x84')]=_0x301d('0x85');respondWithRpcPromise('EventManager',_0x301d('0x7b'),{'event':_0x301d('0x86'),'message':_0x24b51c[_0x301d('0x27')]},client9002);return _0x14bf2d;}return null;})[_0x301d('0x20')](respondWithResult(_0xe9f979,null))[_0x301d('0x2a')](handleError(_0xe9f979,null));};exports[_0x301d('0x2b')]=function(_0x31211c,_0x223229,_0x98c3bc){if(_0x31211c[_0x301d('0x59')]['id']){delete _0x31211c[_0x301d('0x59')]['id'];}var _0x32c2dd;return db['SmsMessage'][_0x301d('0x57')]({'where':{'id':_0x31211c[_0x301d('0x53')]['id']}})[_0x301d('0x20')](handleEntityNotFound(_0x223229,null))[_0x301d('0x20')](function(_0x293d85){if(_0x293d85){_0x32c2dd=_0x293d85;return db[_0x301d('0x87')][_0x301d('0x57')]({'where':{'id':_0x293d85[_0x301d('0x88')]}});}})[_0x301d('0x20')](handleEntityNotFound(_0x223229,null))[_0x301d('0x20')](function(_0x36f046){if(_0x36f046){logger[_0x301d('0x22')](_0x301d('0x23'),_0x301d('0x2b'),_0x301d('0x89'),_0x36f046[_0x301d('0x3c')],util[_0x301d('0x8a')](_0x31211c[_0x301d('0x59')],{'showHidden':![],'depth':null}));switch(_0x36f046['type']){case'twilio':if(_0x31211c[_0x301d('0x59')][_0x301d('0x8b')]&&_0x31211c[_0x301d('0x59')][_0x301d('0x8b')]===_0x32c2dd[_0x301d('0x8c')]){return _0x32c2dd[_0x301d('0x34')]({'read':!![]});}else{logger[_0x301d('0x25')](_0x301d('0x8d'),_0x301d('0x2b'),_0x301d('0x8e'),util[_0x301d('0x8a')](_0x31211c[_0x301d('0x59')],{'showHidden':![],'depth':null}));}break;case _0x301d('0x8f'):if(_0x31211c['body'][_0x301d('0x90')]&&_0x31211c[_0x301d('0x59')][_0x301d('0x90')]===_0x32c2dd[_0x301d('0x8c')]&&_['indexOf']([_0x301d('0x91'),_0x301d('0x92')],_0x31211c[_0x301d('0x59')][_0x301d('0x93')])>=0x0){return _0x32c2dd[_0x301d('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x301d('0x2b'),_0x301d('0x94'),util['inspect'](_0x31211c[_0x301d('0x59')],{'showHidden':![],'depth':null}));}break;case _0x301d('0x95'):var _0x65e5c4=_0x31211c['body'][_0x301d('0x96')][0x0];if(_0x65e5c4['status']['groupName']===_0x301d('0x97')){return _0x32c2dd[_0x301d('0x34')]({'read':!![]});}else{logger[_0x301d('0x25')](_0x301d('0x8d'),'status',_0x301d('0x95'),util['inspect'](_0x31211c[_0x301d('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x32c2dd;}})[_0x301d('0x20')](respondWithResult(_0x223229,null))['catch'](handleError(_0x223229,null));}; \ No newline at end of file +var _0x8861=['debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','stack','name','send','index','map','SmsMessage','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','includeAll','include','catch','show','params','keys','find','body','describe','accept','read','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','RejectMessage','rejectMessage','QueryTypes','contact','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','delivered','Status','plivio','infobip','results','groupName','DELIVERED','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','http','client','info','SmsMessage,\x20%s,\x20%s','request\x20sent'];(function(_0xc97dd1,_0x5eb65d){var _0x345adf=function(_0x13347c){while(--_0x13347c){_0xc97dd1['push'](_0xc97dd1['shift']());}};_0x345adf(++_0x5eb65d);}(_0x8861,0x6d));var _0x1886=function(_0x49873b,_0x26c041){_0x49873b=_0x49873b-0x0;var _0x4df91d=_0x8861[_0x49873b];return _0x4df91d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1886('0x0'));var jsonpatch=require(_0x1886('0x1'));var rp=require(_0x1886('0x2'));var moment=require(_0x1886('0x3'));var BPromise=require(_0x1886('0x4'));var Mustache=require(_0x1886('0x5'));var util=require(_0x1886('0x6'));var path=require(_0x1886('0x7'));var sox=require(_0x1886('0x8'));var csv=require(_0x1886('0x9'));var ejs=require(_0x1886('0xa'));var fs=require('fs');var fs_extra=require(_0x1886('0xb'));var _=require(_0x1886('0xc'));var squel=require(_0x1886('0xd'));var crypto=require(_0x1886('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1886('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1886('0x10'));var Papa=require('papaparse');var Redis=require(_0x1886('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1886('0x12'));var as=require(_0x1886('0x13'));var hardwareService=require(_0x1886('0x14'));var logger=require(_0x1886('0x15'))(_0x1886('0x16'));var utils=require(_0x1886('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1886('0x18'));var db=require(_0x1886('0x19'))['db'];config[_0x1886('0x1a')]=_[_0x1886('0x1b')](config[_0x1886('0x1a')],{'host':_0x1886('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1886('0x1d'))[_0x1886('0x1e')](socket);var jayson=require(_0x1886('0x1f'));var client=jayson['client'][_0x1886('0x20')]({'port':0x232c});var client9002=jayson[_0x1886('0x21')][_0x1886('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4993fe,_0x54d2ee,_0x4083d5,_0x5afc6b){return new BPromise(function(_0x18f7a6,_0x49a12c){var _0xe3ba5e=_0x5afc6b||client;return _0xe3ba5e['request'](_0x4993fe,_0x4083d5)['then'](function(_0x2faf4e){logger[_0x1886('0x22')](_0x1886('0x23'),_0x54d2ee,_0x1886('0x24'));logger[_0x1886('0x25')](_0x1886('0x26'),_0x54d2ee,_0x1886('0x24'),JSON['stringify'](_0x2faf4e));if(_0x2faf4e[_0x1886('0x27')]){if(_0x2faf4e[_0x1886('0x27')]['code']===0x1f4){logger[_0x1886('0x27')](_0x1886('0x23'),_0x54d2ee,_0x2faf4e[_0x1886('0x27')]['message']);return _0x49a12c(_0x2faf4e[_0x1886('0x27')][_0x1886('0x28')]);}logger[_0x1886('0x27')](_0x1886('0x23'),_0x54d2ee,_0x2faf4e[_0x1886('0x27')]['message']);return _0x18f7a6(_0x2faf4e['error'][_0x1886('0x28')]);}else{logger[_0x1886('0x22')](_0x1886('0x23'),_0x54d2ee,_0x1886('0x24'));_0x18f7a6(_0x2faf4e[_0x1886('0x29')]['message']);}})['catch'](function(_0x1c8841){logger[_0x1886('0x27')](_0x1886('0x23'),_0x54d2ee,_0x1c8841);_0x49a12c(_0x1c8841);});});}function respondWithStatusCode(_0x4b7265,_0x2d2dff){_0x2d2dff=_0x2d2dff||0xcc;return function(_0x188ab5){if(_0x188ab5){return _0x4b7265[_0x1886('0x2a')](_0x2d2dff);}return _0x4b7265[_0x1886('0x2b')](_0x2d2dff)[_0x1886('0x2c')]();};}function respondWithResult(_0x1a9ce3,_0xcd0ac5){_0xcd0ac5=_0xcd0ac5||0xc8;return function(_0x148cf5){if(_0x148cf5){return _0x1a9ce3[_0x1886('0x2b')](_0xcd0ac5)[_0x1886('0x2d')](_0x148cf5);}};}function respondWithFilteredResult(_0x13fe64,_0x177307){return function(_0x4edca2){if(_0x4edca2){var _0x2e7a79=typeof _0x177307[_0x1886('0x2e')]===_0x1886('0x2f')&&typeof _0x177307['limit']===_0x1886('0x2f');var _0x2539c6=_0x4edca2[_0x1886('0x30')];var _0x4b9985=_0x2e7a79?0x0:_0x177307['offset'];var _0x48127e=_0x2e7a79?_0x4edca2[_0x1886('0x30')]:_0x177307[_0x1886('0x2e')]+_0x177307[_0x1886('0x31')];var _0x33db06;if(_0x48127e>=_0x2539c6){_0x48127e=_0x2539c6;_0x33db06=0xc8;}else{_0x33db06=0xce;}_0x13fe64[_0x1886('0x2b')](_0x33db06);return _0x13fe64[_0x1886('0x32')]('Content-Range',_0x4b9985+'-'+_0x48127e+'/'+_0x2539c6)[_0x1886('0x2d')](_0x4edca2);}return null;};}function patchUpdates(_0x2729d0){return function(_0x4b0589){try{jsonpatch[_0x1886('0x33')](_0x4b0589,_0x2729d0,!![]);}catch(_0x4e73ba){return BPromise['reject'](_0x4e73ba);}return _0x4b0589[_0x1886('0x34')]();};}function saveUpdates(_0xa653f5,_0x3e07ca){return function(_0x465299){if(_0x465299){return _0x465299[_0x1886('0x35')](_0xa653f5)[_0x1886('0x36')](function(_0x326bab){return _0x326bab;});}return null;};}function removeEntity(_0x242e88,_0x17d3b9){return function(_0x279e85){if(_0x279e85){return _0x279e85['destroy']()['then'](function(){_0x242e88[_0x1886('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35f682,_0x117505){return function(_0x442789){if(!_0x442789){_0x35f682[_0x1886('0x2a')](0x194);}return _0x442789;};}function handleError(_0x55637d,_0x8d84cc){_0x8d84cc=_0x8d84cc||0x1f4;return function(_0x1e754d){logger['error'](_0x1e754d[_0x1886('0x37')]);if(_0x1e754d[_0x1886('0x38')]){delete _0x1e754d[_0x1886('0x38')];}_0x55637d[_0x1886('0x2b')](_0x8d84cc)[_0x1886('0x39')](_0x1e754d);};}exports[_0x1886('0x3a')]=function(_0x1e8d6a,_0x40f98d){var _0x592bc9={},_0x3a8bf0={},_0x1983fa={'count':0x0,'rows':[]};var _0x20c3ca=_[_0x1886('0x3b')](db[_0x1886('0x3c')]['rawAttributes'],function(_0x39694d){return{'name':_0x39694d['fieldName'],'type':_0x39694d['type']['key']};});_0x3a8bf0[_0x1886('0x3d')]=_[_0x1886('0x3b')](_0x20c3ca,'name');_0x3a8bf0[_0x1886('0x3e')]=_['keys'](_0x1e8d6a['query']);_0x3a8bf0[_0x1886('0x3f')]=_[_0x1886('0x40')](_0x3a8bf0[_0x1886('0x3d')],_0x3a8bf0[_0x1886('0x3e')]);_0x592bc9[_0x1886('0x41')]=_[_0x1886('0x40')](_0x3a8bf0[_0x1886('0x3d')],qs[_0x1886('0x42')](_0x1e8d6a[_0x1886('0x3e')][_0x1886('0x42')]));_0x592bc9[_0x1886('0x41')]=_0x592bc9[_0x1886('0x41')][_0x1886('0x43')]?_0x592bc9[_0x1886('0x41')]:_0x3a8bf0[_0x1886('0x3d')];if(!_0x1e8d6a[_0x1886('0x3e')][_0x1886('0x44')](_0x1886('0x45'))){_0x592bc9[_0x1886('0x31')]=qs[_0x1886('0x31')](_0x1e8d6a[_0x1886('0x3e')][_0x1886('0x31')]);_0x592bc9[_0x1886('0x2e')]=qs[_0x1886('0x2e')](_0x1e8d6a[_0x1886('0x3e')]['offset']);}_0x592bc9[_0x1886('0x46')]=qs['sort'](_0x1e8d6a[_0x1886('0x3e')]['sort']);_0x592bc9[_0x1886('0x47')]=qs['filters'](_[_0x1886('0x48')](_0x1e8d6a['query'],_0x3a8bf0[_0x1886('0x3f')]),_0x20c3ca);if(_0x1e8d6a['query'][_0x1886('0x49')]){_0x592bc9['where']=_[_0x1886('0x4a')](_0x592bc9['where'],{'$or':_[_0x1886('0x3b')](_0x20c3ca,function(_0x5d83e7){if(_0x5d83e7[_0x1886('0x4b')]!=='VIRTUAL'){var _0x3766bb={};_0x3766bb[_0x5d83e7[_0x1886('0x38')]]={'$like':'%'+_0x1e8d6a['query'][_0x1886('0x49')]+'%'};return _0x3766bb;}})});}_0x592bc9=_[_0x1886('0x4a')]({},_0x592bc9,_0x1e8d6a[_0x1886('0x4c')]);var _0x561afa={'where':_0x592bc9[_0x1886('0x47')]};return db[_0x1886('0x3c')]['count'](_0x561afa)[_0x1886('0x36')](function(_0xbd4ca0){_0x1983fa[_0x1886('0x30')]=_0xbd4ca0;if(_0x1e8d6a[_0x1886('0x3e')][_0x1886('0x4d')]){_0x592bc9[_0x1886('0x4e')]=[{'all':!![]}];}return db[_0x1886('0x3c')]['findAll'](_0x592bc9);})[_0x1886('0x36')](function(_0x5a13c7){_0x1983fa['rows']=_0x5a13c7;return _0x1983fa;})['then'](respondWithFilteredResult(_0x40f98d,_0x592bc9))[_0x1886('0x4f')](handleError(_0x40f98d,null));};exports[_0x1886('0x50')]=function(_0x50431f,_0x222531){var _0x3355ac={'raw':!![],'where':{'id':_0x50431f[_0x1886('0x51')]['id']}},_0x36234c={};_0x36234c[_0x1886('0x3d')]=_['keys'](db[_0x1886('0x3c')]['rawAttributes']);_0x36234c[_0x1886('0x3e')]=_[_0x1886('0x52')](_0x50431f[_0x1886('0x3e')]);_0x36234c[_0x1886('0x3f')]=_['intersection'](_0x36234c[_0x1886('0x3d')],_0x36234c[_0x1886('0x3e')]);_0x3355ac['attributes']=_['intersection'](_0x36234c['model'],qs['fields'](_0x50431f['query'][_0x1886('0x42')]));_0x3355ac['attributes']=_0x3355ac[_0x1886('0x41')]['length']?_0x3355ac['attributes']:_0x36234c[_0x1886('0x3d')];if(_0x50431f[_0x1886('0x3e')]['includeAll']){_0x3355ac[_0x1886('0x4e')]=[{'all':!![]}];}_0x3355ac=_[_0x1886('0x4a')]({},_0x3355ac,_0x50431f[_0x1886('0x4c')]);return db[_0x1886('0x3c')][_0x1886('0x53')](_0x3355ac)[_0x1886('0x36')](handleEntityNotFound(_0x222531,null))[_0x1886('0x36')](respondWithResult(_0x222531,null))[_0x1886('0x4f')](handleError(_0x222531,null));};exports['create']=function(_0x1a7e93,_0x577421){return db['SmsMessage']['create'](_0x1a7e93[_0x1886('0x54')],{})['then'](respondWithResult(_0x577421,0xc9))[_0x1886('0x4f')](handleError(_0x577421,null));};exports['update']=function(_0x4c0575,_0x3755af){if(_0x4c0575['body']['id']){delete _0x4c0575[_0x1886('0x54')]['id'];}return db['SmsMessage'][_0x1886('0x53')]({'where':{'id':_0x4c0575['params']['id']}})[_0x1886('0x36')](handleEntityNotFound(_0x3755af,null))[_0x1886('0x36')](saveUpdates(_0x4c0575[_0x1886('0x54')],null))[_0x1886('0x36')](respondWithResult(_0x3755af,null))[_0x1886('0x4f')](handleError(_0x3755af,null));};exports['destroy']=function(_0x322271,_0x5928fd){return db[_0x1886('0x3c')]['find']({'where':{'id':_0x322271['params']['id']}})['then'](handleEntityNotFound(_0x5928fd,null))['then'](removeEntity(_0x5928fd,null))[_0x1886('0x4f')](handleError(_0x5928fd,null));};exports[_0x1886('0x55')]=function(_0x5e2dde,_0x1b063e){return db['SmsMessage']['describe']()[_0x1886('0x36')](respondWithResult(_0x1b063e,null))[_0x1886('0x4f')](handleError(_0x1b063e,null));};var interaction_log=require(_0x1886('0x15'))('sms-interactions');exports[_0x1886('0x56')]=function(_0x3cb097,_0x52e351,_0x59325b){var _0x2c758e={'agent':{},'channel':'sms'};if(_0x3cb097[_0x1886('0x54')]['id']){delete _0x3cb097[_0x1886('0x54')]['id'];}_0x3cb097[_0x1886('0x54')][_0x1886('0x57')]=!![];_0x3cb097[_0x1886('0x54')]['readAt']=moment()[_0x1886('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x3cb097[_0x1886('0x54')][_0x1886('0x59')]=_0x3cb097[_0x1886('0x54')]['UserId']||_0x3cb097[_0x1886('0x5a')]['id'];_0x2c758e[_0x1886('0x5b')]['id']=_0x3cb097[_0x1886('0x54')][_0x1886('0x59')];return db['SmsMessage'][_0x1886('0x53')]({'where':{'id':_0x3cb097['params']['id'],'UserId':null}})[_0x1886('0x36')](handleEntityNotFound(_0x52e351,null))[_0x1886('0x36')](saveUpdates(_0x3cb097['body'],null))['then'](function(_0x3a9844){if(_0x3a9844){_0x2c758e[_0x1886('0x28')]=_0x3a9844[_0x1886('0x5c')]({'plain':!![]});return db[_0x1886('0x5d')][_0x1886('0x53')]({'where':{'id':_0x3a9844[_0x1886('0x5e')]}});}return null;})[_0x1886('0x36')](handleEntityNotFound(_0x52e351,null))['then'](function(_0x47e5c9){if(_0x47e5c9){return _0x47e5c9[_0x1886('0x35')]({'UserId':_0x3cb097[_0x1886('0x54')][_0x1886('0x59')],'read1stAt':_[_0x1886('0x5f')](_0x47e5c9['read1stAt'])?moment()[_0x1886('0x58')](_0x1886('0x60')):undefined});}return null;})['then'](function(_0x57fd4e){if(_0x57fd4e){_0x2c758e[_0x1886('0x61')]=_0x57fd4e[_0x1886('0x5c')]({'plain':!![]});interaction_log[_0x1886('0x22')](_0x1886('0x62'),_0x3cb097[_0x1886('0x5a')]['id'],_0x3cb097[_0x1886('0x5a')]['name'],_0x3cb097[_0x1886('0x5a')]['role'],_0x2c758e[_0x1886('0x61')]['id'],_0x3cb097[_0x1886('0x54')]?JSON['stringify'](_0x3cb097[_0x1886('0x54')]):'null');return respondWithRpcPromise(_0x1886('0x63'),_0x1886('0x64'),_0x2c758e);}return null;})[_0x1886('0x36')](function(_0x354212){var _0x28998e=_0x1886('0x65')+_0x354212['message'][_0x1886('0x66')];return db[_0x1886('0x67')][_0x1886('0x3e')](_0x28998e,{'type':db[_0x1886('0x68')]['QueryTypes'][_0x1886('0x69')],'raw':!![]})['then'](function(_0x4f0190){return _0x4f0190;});})['then'](function(_0x46a886){if(_0x46a886){_0x2c758e['message']['contact']=_0x46a886[0x0];if(!_0x3cb097[_0x1886('0x54')][_0x1886('0x59')])return;return db[_0x1886('0x6a')][_0x1886('0x53')]({'where':{'id':_0x3cb097['body'][_0x1886('0x59')],'role':_0x1886('0x5b')},'attributes':['id','name',_0x1886('0x6b'),_0x1886('0x6c'),_0x1886('0x6d')],'raw':!![]});}return null;})['then'](function(_0x26b090){if(!_0x26b090)return null;_0x2c758e[_0x1886('0x28')]['agent']=_0x26b090;return _0x2c758e;})[_0x1886('0x36')](function(_0x1b9f74){if(_0x1b9f74){if(_0x3cb097[_0x1886('0x54')][_0x1886('0x6e')]){_0x2c758e[_0x1886('0x28')][_0x1886('0x6f')]=util[_0x1886('0x58')](_0x1886('0x70'),_0x3cb097[_0x1886('0x5a')][_0x1886('0x38')]);_0x2c758e[_0x1886('0x28')][_0x1886('0x71')]=_0x2c758e['channel'];_0x2c758e[_0x1886('0x28')][_0x1886('0x72')]=_0x2c758e[_0x1886('0x71')];_0x2c758e[_0x1886('0x28')]['event']='accept';return respondWithRpcPromise(_0x1886('0x73'),'EventManager',{'event':_0x1886('0x74'),'message':_0x2c758e[_0x1886('0x28')]},client9002)['then'](function(){return _0x2c758e;});}return _0x2c758e;}return null;})['then'](respondWithResult(_0x52e351,null))['catch'](handleError(_0x52e351,null));};var interaction_log=require(_0x1886('0x15'))('sms-interactions');exports[_0x1886('0x75')]=function(_0x493b1e,_0xbf96f6,_0x2f1e31){var _0x58c6e9={'agent':{},'channel':_0x1886('0x76')};if(_0x493b1e[_0x1886('0x54')]['id']){delete _0x493b1e[_0x1886('0x54')]['id'];}_0x493b1e[_0x1886('0x54')][_0x1886('0x59')]=_0x493b1e[_0x1886('0x54')]['UserId']||_0x493b1e[_0x1886('0x5a')]['id'];_0x58c6e9['agent']['id']=_0x493b1e[_0x1886('0x54')]['UserId'];return db['SmsMessage'][_0x1886('0x53')]({'where':{'id':_0x493b1e[_0x1886('0x51')]['id'],'UserId':null}})[_0x1886('0x36')](handleEntityNotFound(_0xbf96f6,null))[_0x1886('0x36')](function(_0x473059){if(_0x473059){_0x58c6e9[_0x1886('0x28')]=_0x473059[_0x1886('0x5c')]({'plain':!![]});return db[_0x1886('0x5d')]['find']({'where':{'id':_0x473059[_0x1886('0x5e')]}});}return null;})[_0x1886('0x36')](handleEntityNotFound(_0xbf96f6,null))[_0x1886('0x36')](function(_0x46ddcc){if(_0x46ddcc){_0x58c6e9[_0x1886('0x61')]=_0x46ddcc[_0x1886('0x5c')]({'plain':!![]});interaction_log['info'](_0x1886('0x77'),_0x493b1e['user']['id'],_0x493b1e[_0x1886('0x5a')][_0x1886('0x38')],_0x493b1e['user'][_0x1886('0x78')],_0x58c6e9[_0x1886('0x61')]['id'],_0x493b1e[_0x1886('0x54')]?JSON[_0x1886('0x79')](_0x493b1e[_0x1886('0x54')]):_0x1886('0x7a'));return respondWithRpcPromise(_0x1886('0x7b'),_0x1886('0x7c'),_0x58c6e9);}return null;})[_0x1886('0x36')](function(_0x4926e5){var _0x491c7b=_0x1886('0x65')+_0x4926e5[_0x1886('0x28')][_0x1886('0x66')];return db[_0x1886('0x67')][_0x1886('0x3e')](_0x491c7b,{'type':db[_0x1886('0x68')][_0x1886('0x7d')][_0x1886('0x69')],'raw':!![]})['then'](function(_0x37e86b){return _0x37e86b;});})['then'](function(_0x768881){if(_0x768881){_0x58c6e9[_0x1886('0x28')][_0x1886('0x7e')]=_0x768881[0x0];if(!_0x493b1e['body'][_0x1886('0x59')])return;return db[_0x1886('0x6a')]['find']({'where':{'id':_0x493b1e[_0x1886('0x54')][_0x1886('0x59')],'role':_0x1886('0x5b')},'attributes':['id','name',_0x1886('0x6b'),_0x1886('0x6c'),_0x1886('0x6d')],'raw':!![]});}return null;})[_0x1886('0x36')](function(_0x56a01c){if(!_0x56a01c)return null;_0x58c6e9[_0x1886('0x28')][_0x1886('0x5b')]=_0x56a01c;return _0x58c6e9;})[_0x1886('0x36')](function(_0x3c4e7d){if(_0x3c4e7d){_0x3c4e7d['message'][_0x1886('0x6f')]=util[_0x1886('0x58')]('SIP/%s',_0x493b1e[_0x1886('0x5a')][_0x1886('0x38')]);_0x3c4e7d[_0x1886('0x28')][_0x1886('0x71')]=_0x58c6e9[_0x1886('0x71')];_0x3c4e7d[_0x1886('0x28')][_0x1886('0x72')]=_0x58c6e9[_0x1886('0x71')];_0x3c4e7d[_0x1886('0x28')][_0x1886('0x7f')]=_0x1886('0x75');respondWithRpcPromise(_0x1886('0x73'),_0x1886('0x73'),{'event':_0x1886('0x80'),'message':_0x3c4e7d[_0x1886('0x28')]},client9002);return _0x58c6e9;}return null;})['then'](respondWithResult(_0xbf96f6,null))[_0x1886('0x4f')](handleError(_0xbf96f6,null));};exports[_0x1886('0x2b')]=function(_0x192e35,_0x487a77,_0x23d75c){if(_0x192e35[_0x1886('0x54')]['id']){delete _0x192e35['body']['id'];}var _0x2686c4;return db[_0x1886('0x3c')][_0x1886('0x53')]({'where':{'id':_0x192e35[_0x1886('0x51')]['id']}})['then'](handleEntityNotFound(_0x487a77,null))[_0x1886('0x36')](function(_0x865550){if(_0x865550){_0x2686c4=_0x865550;return db[_0x1886('0x81')][_0x1886('0x53')]({'where':{'id':_0x865550[_0x1886('0x82')]}});}})['then'](handleEntityNotFound(_0x487a77,null))[_0x1886('0x36')](function(_0x1a0290){if(_0x1a0290){logger[_0x1886('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x1886('0x83'),_0x1a0290[_0x1886('0x4b')],util[_0x1886('0x84')](_0x192e35[_0x1886('0x54')],{'showHidden':![],'depth':null}));switch(_0x1a0290[_0x1886('0x4b')]){case _0x1886('0x85'):if(_0x192e35[_0x1886('0x54')][_0x1886('0x86')]&&_0x192e35['body'][_0x1886('0x86')]===_0x2686c4[_0x1886('0x87')]){return _0x2686c4[_0x1886('0x35')]({'read':!![]});}else{logger[_0x1886('0x27')](_0x1886('0x88'),'status','twilio',util[_0x1886('0x84')](_0x192e35[_0x1886('0x54')],{'showHidden':![],'depth':null}));}break;case _0x1886('0x89'):if(_0x192e35[_0x1886('0x54')][_0x1886('0x8a')]&&_0x192e35[_0x1886('0x54')][_0x1886('0x8a')]===_0x2686c4[_0x1886('0x87')]&&_['indexOf'](['sent',_0x1886('0x8b')],_0x192e35[_0x1886('0x54')][_0x1886('0x8c')])>=0x0){return _0x2686c4[_0x1886('0x35')]({'read':!![]});}else{logger[_0x1886('0x27')](_0x1886('0x88'),_0x1886('0x2b'),_0x1886('0x8d'),util[_0x1886('0x84')](_0x192e35[_0x1886('0x54')],{'showHidden':![],'depth':null}));}break;case _0x1886('0x8e'):var _0xb9dc02=_0x192e35[_0x1886('0x54')][_0x1886('0x8f')][0x0];if(_0xb9dc02[_0x1886('0x2b')][_0x1886('0x90')]===_0x1886('0x91')){return _0x2686c4[_0x1886('0x35')]({'read':!![]});}else{logger['error'](_0x1886('0x88'),_0x1886('0x2b'),_0x1886('0x8e'),util['inspect'](_0x192e35[_0x1886('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x2686c4;}})[_0x1886('0x36')](respondWithResult(_0x487a77,null))[_0x1886('0x4f')](handleError(_0x487a77,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a0ecb3f..ad4838e 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 _0x064a=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3d4057,_0x23ac6d){var _0x25668c=function(_0x5ef9d9){while(--_0x5ef9d9){_0x3d4057['push'](_0x3d4057['shift']());}};_0x25668c(++_0x23ac6d);}(_0x064a,0x16a));var _0xa064=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x064a[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xa064('0x0'));var SmsMessage=require(_0xa064('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa064('0x2'),'afterDestroy':_0xa064('0x3')};function emitEvent(_0x22f5cc){return function(_0x5f0512,_0x3de158,_0x172f2f){SmsMessageEvents[_0xa064('0x4')](_0x22f5cc+':'+_0x5f0512['id'],_0x5f0512);SmsMessageEvents[_0xa064('0x4')](_0x22f5cc,_0x5f0512);_0x172f2f(null);};}for(var e in events){if(events[_0xa064('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xa064('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0x006f=['SmsMessage','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xe8712b,_0x42aa8c){var _0xf5bcdc=function(_0x1f45fe){while(--_0x1f45fe){_0xe8712b['push'](_0xe8712b['shift']());}};_0xf5bcdc(++_0x42aa8c);}(_0x006f,0x75));var _0xf006=function(_0x44dc6f,_0x1f128b){_0x44dc6f=_0x44dc6f-0x0;var _0x5c8d69=_0x006f[_0x44dc6f];return _0x5c8d69;};'use strict';var EventEmitter=require(_0xf006('0x0'));var SmsMessage=require(_0xf006('0x1'))['db'][_0xf006('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf006('0x3')};function emitEvent(_0x2ac2d2){return function(_0x1928d6,_0x113e32,_0x2bb237){SmsMessageEvents['emit'](_0x2ac2d2+':'+_0x1928d6['id'],_0x1928d6);SmsMessageEvents[_0xf006('0x4')](_0x2ac2d2,_0x1928d6);_0x2bb237(null);};}for(var e in events){if(events[_0xf006('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xf006('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 464c99f..91d0bf2 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 _0xbbbe=['format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','uuid','UTF-8','apiMessageId','clickatell','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','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','error','find','type','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','sms','user_key','total_sent','internal_order_id','deliveryReport','read','update','connectel','senderString','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion'];(function(_0x262882,_0x2e45e8){var _0x498a6e=function(_0x4ef052){while(--_0x4ef052){_0x262882['push'](_0x262882['shift']());}};_0x498a6e(++_0x2e45e8);}(_0xbbbe,0x1c4));var _0xebbb=function(_0x593f7a,_0x4ed903){_0x593f7a=_0x593f7a-0x0;var _0xd816be=_0xbbbe[_0x593f7a];return _0xd816be;};'use strict';var _=require(_0xebbb('0x0'));var util=require(_0xebbb('0x1'));var logger=require('../../config/logger')(_0xebbb('0x2'));var moment=require(_0xebbb('0x3'));var BPromise=require('bluebird');var rp=require(_0xebbb('0x4'));var fs=require('fs');var path=require(_0xebbb('0x5'));var rimraf=require(_0xebbb('0x6'));var config=require(_0xebbb('0x7'));var attributes=require(_0xebbb('0x8'));module[_0xebbb('0x9')]=function(_0x37ceaf,_0xcb62dc){return _0x37ceaf['define'](_0xebbb('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xebbb('0xb'),'fields':[_0xebbb('0xb')]},{'name':_0xebbb('0xc'),'fields':[_0xebbb('0xd')],'type':_0xebbb('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41e7a1,_0x453fbc,_0x549e1d){var _0x119706=_0x37ceaf[_0xebbb('0xf')];var _0xfd7fee=_0x41e7a1[_0xebbb('0x10')]({'plain':!![]});if(_0xfd7fee[_0xebbb('0x11')][_0xebbb('0x12')]()==='in'||_0xfd7fee[_0xebbb('0x11')][_0xebbb('0x12')]()===_0xebbb('0x13')&&!_0xfd7fee[_0xebbb('0x14')]&&!_[_0xebbb('0x15')](_0xfd7fee[_0xebbb('0x16')])&&!_[_0xebbb('0x15')](_0xfd7fee[_0xebbb('0x17')])){_0x119706[_0xebbb('0x18')][_0xebbb('0x19')]({'where':{'id':_0xfd7fee[_0xebbb('0x17')]}})[_0xebbb('0x1a')](function(_0x435702){if(_0x435702){_0x435702['update']({'lastMsgAt':_0xfd7fee[_0xebbb('0x1b')],'lastMsgDirection':_0xfd7fee[_0xebbb('0x11')][_0xebbb('0x12')]()});}})[_0xebbb('0x1c')](function(_0x3e0062){console[_0xebbb('0x1d')](_0x3e0062);});}if(_0xfd7fee[_0xebbb('0x11')]===_0xebbb('0x13')&&!_0xfd7fee['secret']){var _0x549cb0;_0x119706['SmsAccount'][_0xebbb('0x1e')]({'where':{'id':_0xfd7fee['SmsAccountId']},'raw':!![]})[_0xebbb('0x1a')](function(_0x244ffb){_0x549cb0=_0x244ffb;if(_0x549cb0&&_0x549cb0[_0xebbb('0x1f')]){switch(_0x549cb0[_0xebbb('0x1f')]){case'twilio':var _0x3aec72=require('twilio');if(_0x549cb0[_0xebbb('0x20')]&&_0x549cb0[_0xebbb('0x21')]&&_0x549cb0[_0xebbb('0x22')]){var _0x1e57f8=new _0x3aec72(_0x549cb0[_0xebbb('0x20')],_0x549cb0[_0xebbb('0x21')]);_0x1e57f8['messages'][_0xebbb('0x23')]({'body':_0xfd7fee[_0xebbb('0xd')],'to':_0xfd7fee[_0xebbb('0x22')],'from':_0x549cb0['phone'],'statusCallback':_0x549cb0[_0xebbb('0x24')]+_0xebbb('0x25')+_0xfd7fee['id']+_0xebbb('0x26')+_0x549cb0['token']})[_0xebbb('0x1a')](function(_0x229884){if(_0x229884[_0xebbb('0x27')]){return _0x41e7a1['update']({'messageId':_0x229884[_0xebbb('0x27')]});}})[_0xebbb('0x1c')](function(_0x5d8711){logger['error'](_0xebbb('0x28'),_0xebbb('0x29'),'twilio',util[_0xebbb('0x2a')](_0x5d8711,{'showHidden':![],'depth':null}));});}else{logger[_0xebbb('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xebbb('0x29'),_0xebbb('0x2b'),_0xebbb('0x2c'));}break;case _0xebbb('0x2d'):var _0x55d282=_0xebbb('0x2e');if(_0x549cb0[_0xebbb('0x2f')]&&_0x549cb0[_0xebbb('0x30')]){var _0x442785={'recipient':[_0xfd7fee[_0xebbb('0x22')]],'message':_0xfd7fee[_0xebbb('0xd')],'message_type':_0x549cb0['smsMethod']};if(_0x549cb0['smsMethod']&&_0x549cb0[_0xebbb('0x31')]!=='SI'){_0x442785[_0xebbb('0x32')]=_0x549cb0[_0xebbb('0x22')];}var _0x1a96a3={'url':_0x55d282+_0xebbb('0x33')+_0x549cb0[_0xebbb('0x2f')]+_0xebbb('0x34')+_0x549cb0['password'],'method':_0xebbb('0x35')};rp(_0x1a96a3)[_0xebbb('0x1a')](function(_0x5b8777){var _0x1a2b7d=_0x5b8777['split'](';');var _0x365c3a={'user_key':_0x1a2b7d[0x0],'session_key':_0x1a2b7d[0x1]};_0x1a96a3={'url':_0x55d282+_0xebbb('0x36'),'method':'POST','headers':{'user_key':_0x365c3a[_0xebbb('0x37')],'Session_key':_0x365c3a['session_key']},'json':!![],'body':_0x442785};return rp(_0x1a96a3);})[_0xebbb('0x1a')](function(_0x433d5b){if(_0x433d5b[_0xebbb('0x38')]>=0x1){var _0x4aa0f6={'messageId':_0x433d5b[_0xebbb('0x39')]};if(_0x549cb0['smsMethod']!=='GP'||!_0x549cb0[_0xebbb('0x3a')]){_0x4aa0f6[_0xebbb('0x3b')]=!![];}return _0x41e7a1[_0xebbb('0x3c')](_0x4aa0f6);}else{return logger[_0xebbb('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xebbb('0x29'),_0xebbb('0x2d'),util['inspect'](_0x433d5b,{'showHidden':![],'depth':null}));}})[_0xebbb('0x1c')](function(_0x6bea78){return logger['error'](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x2d'),util[_0xebbb('0x2a')](_0x6bea78,{'showHidden':![],'depth':null}));});}else{logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xebbb('0x3d'):if(_0x549cb0[_0xebbb('0x21')]){var _0x5cddb9={'recipient':_0xfd7fee[_0xebbb('0x22')],'message':_0xfd7fee[_0xebbb('0xd')],'sender':_0x549cb0[_0xebbb('0x3e')]||_0x549cb0[_0xebbb('0x22')],'authorization':_0x549cb0[_0xebbb('0x21')]};var _0x453fbc={'method':_0xebbb('0x3f'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x5cddb9,'json':!![]};rp(_0x453fbc)[_0xebbb('0x1a')](function(_0x54f37d){var _0x11d9e6={'messageId':_0x54f37d[_0xebbb('0x40')]};if(!_0x549cb0[_0xebbb('0x3a')]){_0x11d9e6['read']=!![];}return _0x41e7a1[_0xebbb('0x3c')](_0x11d9e6);})[_0xebbb('0x1c')](function(_0x57dea6){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xebbb('0x29'),_0xebbb('0x3d'),util[_0xebbb('0x2a')](_0x57dea6,{'showHidden':![],'depth':null}));});}else{logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x3d'),_0xebbb('0x41'));}break;case _0xebbb('0x42'):if(_0x549cb0['username']&&_0x549cb0[_0xebbb('0x30')]){var _0x5cddb9={'messages':[{'source':_0xebbb('0x43'),'to':_0xfd7fee[_0xebbb('0x22')],'body':_0xfd7fee['body'],'from':_0x549cb0[_0xebbb('0x3e')]||_0x549cb0[_0xebbb('0x22')]}]};var _0x2d82f5=util[_0xebbb('0x44')](_0xebbb('0x45'),_0x549cb0[_0xebbb('0x2f')],_0x549cb0[_0xebbb('0x30')]);var _0x453fbc={'method':_0xebbb('0x3f'),'uri':_0xebbb('0x46'),'body':_0x5cddb9,'headers':{'Authorization':util[_0xebbb('0x44')](_0xebbb('0x47'),new Buffer(_0x2d82f5)[_0xebbb('0x48')](_0xebbb('0x49')))},'json':!![]};rp(_0x453fbc)['then'](function(_0x1febd8){if(_0x1febd8[_0xebbb('0x4a')]>=0xc8&&_0x1febd8[_0xebbb('0x4a')]<=0xce){if(_0x1febd8[_0xebbb('0x4b')]&&_0x1febd8[_0xebbb('0x4b')][_0xebbb('0x4c')]>0x0){var _0x3878ab=_[_0xebbb('0x4d')](_0x1febd8[_0xebbb('0x4b')][_0xebbb('0x4e')]);var _0x527e57={'messageId':_0x3878ab[_0xebbb('0x4f')]};if(!_0x549cb0[_0xebbb('0x3a')]){_0x527e57[_0xebbb('0x3b')]=!![];}return _0x41e7a1[_0xebbb('0x3c')](_0x527e57);}else{logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x50'),util[_0xebbb('0x2a')](_0x1febd8,{'showHidden':![],'depth':null}));}}else{logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x50'),util['inspect'](_0x1febd8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3ad7e8){logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x50'),util[_0xebbb('0x2a')](_0x3ad7e8,{'showHidden':![],'depth':null}));});}else{logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x50'),_0xebbb('0x51'));}break;case _0xebbb('0x52'):if(_0x549cb0[_0xebbb('0x53')]&&_0x549cb0[_0xebbb('0x21')]){var _0x5cddb9={'dst':_0xfd7fee['phone'],'text':_0xfd7fee[_0xebbb('0xd')],'src':_0x549cb0[_0xebbb('0x3e')]||_0x549cb0[_0xebbb('0x22')],'url':_0x549cb0[_0xebbb('0x24')]+_0xebbb('0x25')+_0xfd7fee['id']+_0xebbb('0x26')+_0x549cb0['token']};var _0x2d82f5=util[_0xebbb('0x44')](_0xebbb('0x45'),_0x549cb0[_0xebbb('0x53')],_0x549cb0[_0xebbb('0x21')]);var _0x453fbc={'method':_0xebbb('0x3f'),'uri':util[_0xebbb('0x44')](_0xebbb('0x54'),_0x549cb0[_0xebbb('0x53')]),'body':_0x5cddb9,'headers':{'Authorization':util[_0xebbb('0x44')]('Basic\x20%s',new Buffer(_0x2d82f5)['toString'](_0xebbb('0x49')))},'json':!![]};rp(_0x453fbc)[_0xebbb('0x1a')](function(_0x3519f7){var _0x2e0830={'messageId':_0x3519f7[_0xebbb('0x55')][0x0]};return _0x41e7a1[_0xebbb('0x3c')](_0x2e0830);})[_0xebbb('0x1c')](function(_0x404657){logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x52'),util[_0xebbb('0x2a')](_0x404657,{'showHidden':![],'depth':null}));});}else{logger[_0xebbb('0x1d')](_0xebbb('0x28'),'afterCreate','plivo',_0xebbb('0x56'));}break;case'infobip':if(_0x549cb0['username']&&_0x549cb0[_0xebbb('0x30')]){if(_0x549cb0[_0xebbb('0x57')]){var _0x5a4903={'method':'POST','uri':_0x549cb0[_0xebbb('0x57')]+_0xebbb('0x58'),'body':{'username':_0x549cb0[_0xebbb('0x2f')],'password':_0x549cb0['password']},'json':!![]};return rp(_0x5a4903)[_0xebbb('0x1a')](function(_0x444138){var _0x10a61f={'method':_0xebbb('0x3f'),'uri':_0x549cb0[_0xebbb('0x57')]+_0xebbb('0x59'),'body':{'messages':[{'from':_0x549cb0['phone'],'destinations':[{'to':_0xfd7fee[_0xebbb('0x22')]}],'text':_0xfd7fee[_0xebbb('0xd')],'notifyUrl':_0x549cb0[_0xebbb('0x24')]+_0xebbb('0x25')+_0xfd7fee['id']+'/status?token='+_0x549cb0[_0xebbb('0x5a')],'notifyContentType':_0xebbb('0x5b'),'callbackData':_0x549cb0['phone']+';'+_0xfd7fee[_0xebbb('0xd')]}]},'headers':{'Authorization':_0xebbb('0x5c')+_0x444138['token']},'json':!![]};return rp(_0x10a61f)[_0xebbb('0x1a')](function(_0x2df8c8){if(_0x2df8c8['messages']){var _0x22c0df={'messageId':_0x2df8c8['messages'][0x0]['messageId']};if(!_0x549cb0[_0xebbb('0x3a')]){_0x22c0df[_0xebbb('0x3b')]=!![];}return _0x41e7a1['update'](_0x22c0df);}else{return logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x5d'),util[_0xebbb('0x2a')](_0x2df8c8,{'showHidden':![],'depth':null}));}});})[_0xebbb('0x1c')](function(_0x4dbf1e){return logger[_0xebbb('0x1d')](_0xebbb('0x28'),'afterCreate',_0xebbb('0x5d'),util[_0xebbb('0x2a')](_0x4dbf1e,{'showHidden':![],'depth':null}));});}else{logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x5d'),_0xebbb('0x5e'));}}else{logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),'infobip',_0xebbb('0x51'));}break;case _0xebbb('0x5f'):var _0x4bb7df=require(_0xebbb('0x60'));if(_0x549cb0[_0xebbb('0x61')]){var _0x4b9552={};_0x4b9552[_0xebbb('0x62')]=_0x549cb0[_0xebbb('0x2f')];_0x4b9552[_0xebbb('0x22')]=_0xfd7fee[_0xebbb('0x22')];_0x4b9552[_0xebbb('0x32')]=_0x549cb0[_0xebbb('0x22')];_0x4b9552[_0xebbb('0x63')]=_0xfd7fee[_0xebbb('0xd')];_0x4b9552[_0xebbb('0x64')]=+new Date();var _0x402912='';var _0x5f5bcf='';var _0x7bf226=Object[_0xebbb('0x65')](_0x4b9552);_0x7bf226[_0xebbb('0x66')]();for(var _0x5a9ef4=0x0;_0x5a9ef4<_0x7bf226[_0xebbb('0x67')];_0x5a9ef4++){if(_0x402912!=''){_0x402912+='&';}_0x402912+=_0x7bf226[_0x5a9ef4]+'='+encodeURIComponent(_0x4b9552[_0x7bf226[_0x5a9ef4]]);_0x5f5bcf+=_0x4b9552[_0x7bf226[_0x5a9ef4]];}_0x5f5bcf+=_0x549cb0[_0xebbb('0x61')];_0x5f5bcf=_0x4bb7df[_0xebbb('0x68')](_0xebbb('0x69'))[_0xebbb('0x3c')](_0x5f5bcf)[_0xebbb('0x6a')](_0xebbb('0x6b'));if(_0x402912!==''){_0x402912+='&';}_0x402912+=_0xebbb('0x6c')+_0x5f5bcf;var _0x1a96a3={'method':'GET','uri':_0x549cb0[_0xebbb('0x57')]+_0xebbb('0x6d')+_0x402912,'json':!![]};return rp(_0x1a96a3)[_0xebbb('0x1a')](function(_0x2e19c){var _0x2b8725=Object[_0xebbb('0x65')](_0x2e19c);if(_0x2e19c[_0x2b8725[0x0]][_0xebbb('0x1d')]&&parseInt(_0x2e19c[_0x2b8725[0x0]][_0xebbb('0x1d')])===0x0){var _0x1b52d3={'messageId':_0x2e19c[_0x2b8725[0x0]][_0xebbb('0x6e')]};if(!_0x549cb0[_0xebbb('0x3a')]){_0x1b52d3[_0xebbb('0x3b')]=!![];}return _0x41e7a1['update'](_0x1b52d3);}else{return logger[_0xebbb('0x1d')](_0xebbb('0x28'),'afterCreate','csc',util[_0xebbb('0x2a')](_0x2e19c[_0xebbb('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x43906b){return logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x5f'),util[_0xebbb('0x2a')](_0x43906b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x5f'),_0xebbb('0x6f'));}break;case'clickatell':if(_0x549cb0['apiKey']){var _0x261662={'method':_0xebbb('0x3f'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x549cb0[_0xebbb('0x61')]},'body':{'content':_0xfd7fee[_0xebbb('0xd')],'to':[_0xfd7fee[_0xebbb('0x22')]],'from':_0x549cb0[_0xebbb('0x22')],'binary':![],'clientMessageId':_0xebbb('0x70'),'charset':_0xebbb('0x71')},'json':!![]};rp(_0x261662)['then'](function(_0x2fcd81){if(!_0x2fcd81['error']){var _0x49ef7c={'messageId':_0x2fcd81['messages'][0x0][_0xebbb('0x72')]};if(!_0x549cb0['deliveryReport']){_0x49ef7c[_0xebbb('0x3b')]=!![];}return _0x41e7a1[_0xebbb('0x3c')](_0x49ef7c);}else{return logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),'clickatell',util[_0xebbb('0x2a')](_0x2fcd81['error'],{'showHidden':![],'depth':null}));}})[_0xebbb('0x1c')](function(_0x21db6e){return logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x73'),util[_0xebbb('0x2a')](_0x21db6e,{'showHidden':![],'depth':null}));});}else{logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x73'),_0xebbb('0x6f'));}break;case'bandwidth':if(_0x549cb0[_0xebbb('0x2f')]&&_0x549cb0[_0xebbb('0x30')]){var _0x2d82f5=util[_0xebbb('0x44')](_0xebbb('0x45'),_0x549cb0[_0xebbb('0x2f')],_0x549cb0[_0xebbb('0x30')]);var _0x453fbc={'method':_0xebbb('0x3f'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x549cb0[_0xebbb('0x74')]+_0xebbb('0x75'),'body':{'to':[_0xfd7fee['phone']],'text':_0xfd7fee[_0xebbb('0xd')],'from':_0x549cb0['phone'],'applicationId':_0x549cb0[_0xebbb('0x76')]},'headers':{'Authorization':util[_0xebbb('0x44')](_0xebbb('0x47'),new Buffer(_0x2d82f5)[_0xebbb('0x48')](_0xebbb('0x49')))},'json':!![]};rp(_0x453fbc)[_0xebbb('0x1a')](function(_0x2f8f22){if(_0x2f8f22['id']){var _0x2d5074={'messageId':_0x2f8f22['id']};return _0x41e7a1['update'](_0x2d5074);}else{logger[_0xebbb('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xebbb('0x29'),_0xebbb('0x77'),util['inspect'](_0x2f8f22,{'showHidden':![],'depth':null}));}})[_0xebbb('0x1c')](function(_0x4ddce4){logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x77'),util[_0xebbb('0x2a')](_0x4ddce4,{'showHidden':![],'depth':null}));});}else{logger[_0xebbb('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xebbb('0x29'),_0xebbb('0x77'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xebbb('0x78'):if(_0x549cb0['apiKey']){var _0x5d2c2a={};var _0x1a96a3={'method':'POST','uri':_0xebbb('0x79'),'headers':{'Authorization':_0xebbb('0x7a')+_0x549cb0[_0xebbb('0x61')],'Content-Type':'application/json'},'body':{'from':_0x549cb0[_0xebbb('0x22')],'to':_0xfd7fee[_0xebbb('0x22')],'text':_0xfd7fee[_0xebbb('0xd')]},'json':!![]};return rp(_0x1a96a3)[_0xebbb('0x1a')](function(_0x5b3661){if(_0x5b3661[_0xebbb('0x7b')]==0xca){_0x5d2c2a[_0xebbb('0x7c')]=_0x5b3661;var _0xad037c={'method':'POST','uri':_0xebbb('0x7d'),'headers':{'Authorization':'Bearer\x20'+_0x549cb0['apiKey'],'Content-Type':_0xebbb('0x5b')},'body':{'refid':_0x5d2c2a[_0xebbb('0x7c')][_0xebbb('0x7e')]},'json':!![]};return rp(_0xad037c)[_0xebbb('0x1a')](function(_0x49f080){_0x5d2c2a['status']=_0x49f080;var _0xb811={'messageId':_0x5d2c2a[_0xebbb('0x7c')][_0xebbb('0x7e')],'read':!![]};return _0x41e7a1[_0xebbb('0x3c')](_0xb811);});}else{return logger['error'](_0xebbb('0x28'),'afterCreate',_0xebbb('0x78'),util[_0xebbb('0x2a')](_0x5b3661,{'showHidden':![],'depth':null}));}})[_0xebbb('0x1c')](function(_0xd63453){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xebbb('0x29'),'intelepeer',util['inspect'](_0xd63453,{'showHidden':![],'depth':null}));});}else{return logger[_0xebbb('0x1d')](_0xebbb('0x28'),_0xebbb('0x29'),_0xebbb('0x78'),'Token\x20not\x20received');}break;}}})[_0xebbb('0x7f')](function(){_0x549e1d();});}else{_0x549e1d();}}},'charset':_0xebbb('0x80'),'collate':_0xebbb('0x81')});}; \ No newline at end of file +var _0xcc37=['token','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','md5','digest','hex','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','findOne','then','catch','error','secret','find','SmsAccountId','type','twilio','phone','accountSid','messages','create','remote','sid','update','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','POST','user_key','total_sent','internal_order_id','read','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel','authToken','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','senderString','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xcc37,0xa7));var _0x7cc3=function(_0x372e0c,_0x31b172){_0x372e0c=_0x372e0c-0x0;var _0x3ad8ed=_0xcc37[_0x372e0c];return _0x3ad8ed;};'use strict';var _=require('lodash');var util=require(_0x7cc3('0x0'));var logger=require(_0x7cc3('0x1'))('api');var moment=require(_0x7cc3('0x2'));var BPromise=require(_0x7cc3('0x3'));var rp=require(_0x7cc3('0x4'));var fs=require('fs');var path=require(_0x7cc3('0x5'));var rimraf=require(_0x7cc3('0x6'));var config=require(_0x7cc3('0x7'));var attributes=require('./smsMessage.attributes');module[_0x7cc3('0x8')]=function(_0xecfb40,_0x56d567){return _0xecfb40[_0x7cc3('0x9')](_0x7cc3('0xa'),attributes,{'tableName':_0x7cc3('0xb'),'paranoid':![],'indexes':[{'name':_0x7cc3('0xc'),'fields':[_0x7cc3('0xc')]},{'name':_0x7cc3('0xd'),'fields':[_0x7cc3('0xe')],'type':_0x7cc3('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf2ab9,_0x631d0,_0x52537f){var _0x517ed8=_0xecfb40[_0x7cc3('0x10')];var _0x438b59=_0xf2ab9[_0x7cc3('0x11')]({'plain':!![]});if(_0x438b59['direction']['toLowerCase']()==='in'||_0x438b59[_0x7cc3('0x12')][_0x7cc3('0x13')]()===_0x7cc3('0x14')&&!_0x438b59['secret']&&!_[_0x7cc3('0x15')](_0x438b59[_0x7cc3('0x16')])&&!_[_0x7cc3('0x15')](_0x438b59[_0x7cc3('0x17')])){_0x517ed8['SmsInteraction'][_0x7cc3('0x18')]({'where':{'id':_0x438b59[_0x7cc3('0x17')]}})[_0x7cc3('0x19')](function(_0x3e4aa1){if(_0x3e4aa1){_0x3e4aa1['update']({'lastMsgAt':_0x438b59['createdAt'],'lastMsgDirection':_0x438b59[_0x7cc3('0x12')][_0x7cc3('0x13')]()});}})[_0x7cc3('0x1a')](function(_0x3b046e){console[_0x7cc3('0x1b')](_0x3b046e);});}if(_0x438b59[_0x7cc3('0x12')]==='out'&&!_0x438b59[_0x7cc3('0x1c')]){var _0xf0bc1f;_0x517ed8['SmsAccount'][_0x7cc3('0x1d')]({'where':{'id':_0x438b59[_0x7cc3('0x1e')]},'raw':!![]})[_0x7cc3('0x19')](function(_0x513826){_0xf0bc1f=_0x513826;if(_0xf0bc1f&&_0xf0bc1f[_0x7cc3('0x1f')]){switch(_0xf0bc1f[_0x7cc3('0x1f')]){case _0x7cc3('0x20'):var _0x3e341b=require(_0x7cc3('0x20'));if(_0xf0bc1f['accountSid']&&_0xf0bc1f['authToken']&&_0xf0bc1f[_0x7cc3('0x21')]){var _0x30869e=new _0x3e341b(_0xf0bc1f[_0x7cc3('0x22')],_0xf0bc1f['authToken']);_0x30869e[_0x7cc3('0x23')][_0x7cc3('0x24')]({'body':_0x438b59[_0x7cc3('0xe')],'to':_0x438b59[_0x7cc3('0x21')],'from':_0xf0bc1f[_0x7cc3('0x21')],'statusCallback':_0xf0bc1f[_0x7cc3('0x25')]+'/api/sms/messages/'+_0x438b59['id']+'/status?token='+_0xf0bc1f['token']})[_0x7cc3('0x19')](function(_0x35edb3){if(_0x35edb3[_0x7cc3('0x26')]){return _0xf2ab9[_0x7cc3('0x27')]({'messageId':_0x35edb3[_0x7cc3('0x26')]});}})[_0x7cc3('0x1a')](function(_0x2da7f4){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7cc3('0x20'),util[_0x7cc3('0x28')](_0x2da7f4,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x7cc3('0x29'));}break;case _0x7cc3('0x2a'):var _0x5193e2=_0x7cc3('0x2b');if(_0xf0bc1f[_0x7cc3('0x2c')]&&_0xf0bc1f[_0x7cc3('0x2d')]){var _0x58e3e6={'recipient':[_0x438b59[_0x7cc3('0x21')]],'message':_0x438b59[_0x7cc3('0xe')],'message_type':_0xf0bc1f['smsMethod']};if(_0xf0bc1f[_0x7cc3('0x2e')]&&_0xf0bc1f[_0x7cc3('0x2e')]!=='SI'){_0x58e3e6['sender']=_0xf0bc1f[_0x7cc3('0x21')];}var _0x318e28={'url':_0x5193e2+_0x7cc3('0x2f')+_0xf0bc1f[_0x7cc3('0x2c')]+_0x7cc3('0x30')+_0xf0bc1f[_0x7cc3('0x2d')],'method':_0x7cc3('0x31')};rp(_0x318e28)[_0x7cc3('0x19')](function(_0x15caad){var _0x54c5ee=_0x15caad[_0x7cc3('0x32')](';');var _0x1511dc={'user_key':_0x54c5ee[0x0],'session_key':_0x54c5ee[0x1]};_0x318e28={'url':_0x5193e2+'sms','method':_0x7cc3('0x33'),'headers':{'user_key':_0x1511dc[_0x7cc3('0x34')],'Session_key':_0x1511dc['session_key']},'json':!![],'body':_0x58e3e6};return rp(_0x318e28);})['then'](function(_0x31023e){if(_0x31023e[_0x7cc3('0x35')]>=0x1){var _0x16c22b={'messageId':_0x31023e[_0x7cc3('0x36')]};if(_0xf0bc1f[_0x7cc3('0x2e')]!=='GP'||!_0xf0bc1f['deliveryReport']){_0x16c22b[_0x7cc3('0x37')]=!![];}return _0xf2ab9[_0x7cc3('0x27')](_0x16c22b);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7cc3('0x2a'),util[_0x7cc3('0x28')](_0x31023e,{'showHidden':![],'depth':null}));}})[_0x7cc3('0x1a')](function(_0xd7627d){return logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x2a'),util['inspect'](_0xd7627d,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),'afterCreate',_0x7cc3('0x2a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x7cc3('0x3a'):if(_0xf0bc1f[_0x7cc3('0x3b')]){var _0x1d4328={'recipient':_0x438b59[_0x7cc3('0x21')],'message':_0x438b59[_0x7cc3('0xe')],'sender':_0xf0bc1f['senderString']||_0xf0bc1f[_0x7cc3('0x21')],'authorization':_0xf0bc1f['authToken']};var _0x631d0={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x3c'),'body':_0x1d4328,'json':!![]};rp(_0x631d0)['then'](function(_0x36c0d2){var _0x47b44d={'messageId':_0x36c0d2[_0x7cc3('0x3d')]};if(!_0xf0bc1f[_0x7cc3('0x3e')]){_0x47b44d[_0x7cc3('0x37')]=!![];}return _0xf2ab9['update'](_0x47b44d);})['catch'](function(_0x139d69){logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),'connectel',util[_0x7cc3('0x28')](_0x139d69,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),'afterCreate',_0x7cc3('0x3a'),_0x7cc3('0x3f'));}break;case _0x7cc3('0x40'):if(_0xf0bc1f[_0x7cc3('0x2c')]&&_0xf0bc1f['password']){var _0x1d4328={'messages':[{'source':'xCALLY\x20Motion','to':_0x438b59[_0x7cc3('0x21')],'body':_0x438b59[_0x7cc3('0xe')],'from':_0xf0bc1f[_0x7cc3('0x41')]||_0xf0bc1f[_0x7cc3('0x21')]}]};var _0x16751d=util[_0x7cc3('0x42')]('%s:%s',_0xf0bc1f[_0x7cc3('0x2c')],_0xf0bc1f[_0x7cc3('0x2d')]);var _0x631d0={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x43'),'body':_0x1d4328,'headers':{'Authorization':util[_0x7cc3('0x42')](_0x7cc3('0x44'),new Buffer(_0x16751d)[_0x7cc3('0x45')](_0x7cc3('0x46')))},'json':!![]};rp(_0x631d0)[_0x7cc3('0x19')](function(_0x152198){if(_0x152198['http_code']>=0xc8&&_0x152198[_0x7cc3('0x47')]<=0xce){if(_0x152198[_0x7cc3('0x48')]&&_0x152198[_0x7cc3('0x48')][_0x7cc3('0x49')]>0x0){var _0x19ed1c=_[_0x7cc3('0x4a')](_0x152198[_0x7cc3('0x48')][_0x7cc3('0x23')]);var _0x659bff={'messageId':_0x19ed1c[_0x7cc3('0x4b')]};if(!_0xf0bc1f[_0x7cc3('0x3e')]){_0x659bff[_0x7cc3('0x37')]=!![];}return _0xf2ab9[_0x7cc3('0x27')](_0x659bff);}else{logger['error'](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x4c'),util[_0x7cc3('0x28')](_0x152198,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x7cc3('0x38'),'afterCreate','clickSend',util[_0x7cc3('0x28')](_0x152198,{'showHidden':![],'depth':null}));}})[_0x7cc3('0x1a')](function(_0x142c84){logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x4c'),util[_0x7cc3('0x28')](_0x142c84,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x4c'),_0x7cc3('0x4d'));}break;case _0x7cc3('0x4e'):if(_0xf0bc1f[_0x7cc3('0x4f')]&&_0xf0bc1f[_0x7cc3('0x3b')]){var _0x1d4328={'dst':_0x438b59[_0x7cc3('0x21')],'text':_0x438b59[_0x7cc3('0xe')],'src':_0xf0bc1f[_0x7cc3('0x41')]||_0xf0bc1f[_0x7cc3('0x21')],'url':_0xf0bc1f[_0x7cc3('0x25')]+_0x7cc3('0x50')+_0x438b59['id']+'/status?token='+_0xf0bc1f[_0x7cc3('0x51')]};var _0x16751d=util['format'](_0x7cc3('0x52'),_0xf0bc1f[_0x7cc3('0x4f')],_0xf0bc1f[_0x7cc3('0x3b')]);var _0x631d0={'method':'POST','uri':util[_0x7cc3('0x42')](_0x7cc3('0x53'),_0xf0bc1f[_0x7cc3('0x4f')]),'body':_0x1d4328,'headers':{'Authorization':util[_0x7cc3('0x42')]('Basic\x20%s',new Buffer(_0x16751d)['toString'](_0x7cc3('0x46')))},'json':!![]};rp(_0x631d0)[_0x7cc3('0x19')](function(_0xa7c1a3){var _0x5f7d2c={'messageId':_0xa7c1a3['message_uuid'][0x0]};return _0xf2ab9['update'](_0x5f7d2c);})[_0x7cc3('0x1a')](function(_0x5a72f1){logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),'afterCreate','plivo',util['inspect'](_0x5a72f1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x4e'),_0x7cc3('0x54'));}break;case _0x7cc3('0x55'):if(_0xf0bc1f[_0x7cc3('0x2c')]&&_0xf0bc1f[_0x7cc3('0x2d')]){if(_0xf0bc1f[_0x7cc3('0x56')]){var _0x16d4c4={'method':_0x7cc3('0x33'),'uri':_0xf0bc1f[_0x7cc3('0x56')]+_0x7cc3('0x57'),'body':{'username':_0xf0bc1f[_0x7cc3('0x2c')],'password':_0xf0bc1f['password']},'json':!![]};return rp(_0x16d4c4)[_0x7cc3('0x19')](function(_0xdc6afa){var _0x433c40={'method':'POST','uri':_0xf0bc1f['baseUrl']+_0x7cc3('0x58'),'body':{'messages':[{'from':_0xf0bc1f[_0x7cc3('0x21')],'destinations':[{'to':_0x438b59[_0x7cc3('0x21')]}],'text':_0x438b59[_0x7cc3('0xe')],'notifyUrl':_0xf0bc1f[_0x7cc3('0x25')]+_0x7cc3('0x50')+_0x438b59['id']+_0x7cc3('0x59')+_0xf0bc1f[_0x7cc3('0x51')],'notifyContentType':_0x7cc3('0x5a'),'callbackData':_0xf0bc1f['phone']+';'+_0x438b59['body']}]},'headers':{'Authorization':_0x7cc3('0x5b')+_0xdc6afa['token']},'json':!![]};return rp(_0x433c40)[_0x7cc3('0x19')](function(_0x4541b6){if(_0x4541b6['messages']){var _0x4dfadf={'messageId':_0x4541b6[_0x7cc3('0x23')][0x0][_0x7cc3('0xc')]};if(!_0xf0bc1f[_0x7cc3('0x3e')]){_0x4dfadf[_0x7cc3('0x37')]=!![];}return _0xf2ab9['update'](_0x4dfadf);}else{return logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),_0x7cc3('0x55'),util[_0x7cc3('0x28')](_0x4541b6,{'showHidden':![],'depth':null}));}});})[_0x7cc3('0x1a')](function(_0x36ba35){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),_0x7cc3('0x55'),util[_0x7cc3('0x28')](_0x36ba35,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),'infobip',_0x7cc3('0x5c'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),_0x7cc3('0x55'),_0x7cc3('0x4d'));}break;case _0x7cc3('0x5d'):var _0x26d9d8=require(_0x7cc3('0x5e'));if(_0xf0bc1f[_0x7cc3('0x5f')]){var _0x544a08={};_0x544a08[_0x7cc3('0x60')]=_0xf0bc1f[_0x7cc3('0x2c')];_0x544a08[_0x7cc3('0x21')]=_0x438b59[_0x7cc3('0x21')];_0x544a08['sender']=_0xf0bc1f['phone'];_0x544a08[_0x7cc3('0x61')]=_0x438b59[_0x7cc3('0xe')];_0x544a08[_0x7cc3('0x62')]=+new Date();var _0x5dedbd='';var _0x4f08af='';var _0x69ed06=Object['keys'](_0x544a08);_0x69ed06[_0x7cc3('0x63')]();for(var _0x83b07a=0x0;_0x83b07a<_0x69ed06['length'];_0x83b07a++){if(_0x5dedbd!=''){_0x5dedbd+='&';}_0x5dedbd+=_0x69ed06[_0x83b07a]+'='+encodeURIComponent(_0x544a08[_0x69ed06[_0x83b07a]]);_0x4f08af+=_0x544a08[_0x69ed06[_0x83b07a]];}_0x4f08af+=_0xf0bc1f['apiKey'];_0x4f08af=_0x26d9d8['createHash'](_0x7cc3('0x64'))[_0x7cc3('0x27')](_0x4f08af)[_0x7cc3('0x65')](_0x7cc3('0x66'));if(_0x5dedbd!==''){_0x5dedbd+='&';}_0x5dedbd+='signature='+_0x4f08af;var _0x318e28={'method':'GET','uri':_0xf0bc1f[_0x7cc3('0x56')]+_0x7cc3('0x67')+_0x5dedbd,'json':!![]};return rp(_0x318e28)[_0x7cc3('0x19')](function(_0x3cbf02){var _0x136251=Object['keys'](_0x3cbf02);if(_0x3cbf02[_0x136251[0x0]][_0x7cc3('0x1b')]&&parseInt(_0x3cbf02[_0x136251[0x0]]['error'])===0x0){var _0x4b1bdd={'messageId':_0x3cbf02[_0x136251[0x0]]['id_sms']};if(!_0xf0bc1f[_0x7cc3('0x3e')]){_0x4b1bdd[_0x7cc3('0x37')]=!![];}return _0xf2ab9[_0x7cc3('0x27')](_0x4b1bdd);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7cc3('0x5d'),util[_0x7cc3('0x28')](_0x3cbf02[_0x7cc3('0x1b')],{'showHidden':![],'depth':null}));}})[_0x7cc3('0x1a')](function(_0x8e5ebc){return logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),'afterCreate','csc',util[_0x7cc3('0x28')](_0x8e5ebc,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),_0x7cc3('0x5d'),_0x7cc3('0x68'));}break;case _0x7cc3('0x69'):if(_0xf0bc1f['apiKey']){var _0x49f797={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x6a'),'headers':{'Authorization':_0xf0bc1f[_0x7cc3('0x5f')]},'body':{'content':_0x438b59[_0x7cc3('0xe')],'to':[_0x438b59[_0x7cc3('0x21')]],'from':_0xf0bc1f[_0x7cc3('0x21')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x49f797)[_0x7cc3('0x19')](function(_0x2890a7){if(!_0x2890a7[_0x7cc3('0x1b')]){var _0x2971c7={'messageId':_0x2890a7['messages'][0x0][_0x7cc3('0x6b')]};if(!_0xf0bc1f['deliveryReport']){_0x2971c7[_0x7cc3('0x37')]=!![];}return _0xf2ab9['update'](_0x2971c7);}else{return logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),'clickatell',util[_0x7cc3('0x28')](_0x2890a7[_0x7cc3('0x1b')],{'showHidden':![],'depth':null}));}})[_0x7cc3('0x1a')](function(_0xe1c82){return logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x69'),util[_0x7cc3('0x28')](_0xe1c82,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7cc3('0x69'),_0x7cc3('0x68'));}break;case _0x7cc3('0x6c'):if(_0xf0bc1f['username']&&_0xf0bc1f[_0x7cc3('0x2d')]){var _0x16751d=util[_0x7cc3('0x42')](_0x7cc3('0x52'),_0xf0bc1f[_0x7cc3('0x2c')],_0xf0bc1f['password']);var _0x631d0={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x6d')+_0xf0bc1f[_0x7cc3('0x6e')]+_0x7cc3('0x6f'),'body':{'to':[_0x438b59[_0x7cc3('0x21')]],'text':_0x438b59[_0x7cc3('0xe')],'from':_0xf0bc1f[_0x7cc3('0x21')],'applicationId':_0xf0bc1f[_0x7cc3('0x70')]},'headers':{'Authorization':util[_0x7cc3('0x42')](_0x7cc3('0x44'),new Buffer(_0x16751d)[_0x7cc3('0x45')](_0x7cc3('0x46')))},'json':!![]};rp(_0x631d0)[_0x7cc3('0x19')](function(_0x17c40d){if(_0x17c40d['id']){var _0x237708={'messageId':_0x17c40d['id']};return _0xf2ab9[_0x7cc3('0x27')](_0x237708);}else{logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x6c'),util['inspect'](_0x17c40d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x16a435){logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7cc3('0x6c'),util[_0x7cc3('0x28')](_0x16a435,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7cc3('0x38'),_0x7cc3('0x39'),'bandwidth',_0x7cc3('0x4d'));}break;case _0x7cc3('0x71'):if(_0xf0bc1f[_0x7cc3('0x5f')]){var _0xabe4ac={};var _0x318e28={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x72'),'headers':{'Authorization':_0x7cc3('0x73')+_0xf0bc1f[_0x7cc3('0x5f')],'Content-Type':_0x7cc3('0x5a')},'body':{'from':_0xf0bc1f[_0x7cc3('0x21')],'to':_0x438b59['phone'],'text':_0x438b59[_0x7cc3('0xe')]},'json':!![]};return rp(_0x318e28)[_0x7cc3('0x19')](function(_0xe64331){if(_0xe64331[_0x7cc3('0x74')]==0xca){_0xabe4ac['message']=_0xe64331;var _0x5687e1={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x75'),'headers':{'Authorization':_0x7cc3('0x73')+_0xf0bc1f[_0x7cc3('0x5f')],'Content-Type':_0x7cc3('0x5a')},'body':{'refid':_0xabe4ac[_0x7cc3('0x76')]['refid']},'json':!![]};return rp(_0x5687e1)[_0x7cc3('0x19')](function(_0x3b7edc){_0xabe4ac['status']=_0x3b7edc;var _0x4e1c0c={'messageId':_0xabe4ac[_0x7cc3('0x76')][_0x7cc3('0x77')],'read':!![]};return _0xf2ab9[_0x7cc3('0x27')](_0x4e1c0c);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),'intelepeer',util[_0x7cc3('0x28')](_0xe64331,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5270ed){return logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),_0x7cc3('0x71'),util[_0x7cc3('0x28')](_0x5270ed,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x7cc3('0x38'),_0x7cc3('0x39'),'intelepeer',_0x7cc3('0x78'));}break;}}})[_0x7cc3('0x79')](function(){_0x52537f();});}else{_0x52537f();}}},'charset':_0x7cc3('0x7a'),'collate':_0x7cc3('0x7b')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 46baf76..4dac286 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 _0x7d9e=['./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','stringify','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0xcd5bb3,_0x41afe0){var _0xfacb9c=function(_0x40cae9){while(--_0x40cae9){_0xcd5bb3['push'](_0xcd5bb3['shift']());}};_0xfacb9c(++_0x41afe0);}(_0x7d9e,0x10b));var _0xe7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe7d9('0x0'));var util=require(_0xe7d9('0x1'));var moment=require(_0xe7d9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7d9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7d9('0x4'));var logger=require('../../config/logger')(_0xe7d9('0x5'));var config=require(_0xe7d9('0x6'));var jayson=require(_0xe7d9('0x7'));var client=jayson[_0xe7d9('0x8')][_0xe7d9('0x9')]({'port':0x232a});config[_0xe7d9('0xa')]=_['defaults'](config['redis'],{'host':_0xe7d9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe7d9('0xa')]));require(_0xe7d9('0xc'))[_0xe7d9('0xd')](socket);function respondWithRpcPromise(_0x2841f4,_0x5df099,_0x403683){return new BPromise(function(_0x424ff3,_0x4442d4){return client[_0xe7d9('0xe')](_0x2841f4,_0x403683)[_0xe7d9('0xf')](function(_0x4a4210){logger[_0xe7d9('0x10')](_0xe7d9('0x11'),_0x5df099,_0xe7d9('0x12'));logger[_0xe7d9('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5df099,_0xe7d9('0x12'),JSON['stringify'](_0x4a4210));if(_0x4a4210[_0xe7d9('0x14')]){if(_0x4a4210[_0xe7d9('0x14')][_0xe7d9('0x15')]===0x1f4){logger['error'](_0xe7d9('0x11'),_0x5df099,_0x4a4210['error'][_0xe7d9('0x16')]);return _0x4442d4(_0x4a4210[_0xe7d9('0x14')][_0xe7d9('0x16')]);}logger[_0xe7d9('0x14')](_0xe7d9('0x11'),_0x5df099,_0x4a4210[_0xe7d9('0x14')][_0xe7d9('0x16')]);return _0x424ff3(_0x4a4210['error'][_0xe7d9('0x16')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x5df099,_0xe7d9('0x12'));_0x424ff3(_0x4a4210[_0xe7d9('0x17')][_0xe7d9('0x16')]);}})[_0xe7d9('0x18')](function(_0x4ee261){logger['error']('SmsMessage,\x20%s,\x20%s',_0x5df099,_0x4ee261);_0x4442d4(_0x4ee261);});});}exports[_0xe7d9('0x19')]=function(_0x389db4){var _0x2d3608=this;return new Promise(function(_0x2758c1,_0x2863f4){return db[_0xe7d9('0x1a')][_0xe7d9('0x1b')](_0x389db4[_0xe7d9('0x1c')],{'raw':_0x389db4[_0xe7d9('0x1d')]?_0x389db4[_0xe7d9('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xe7d9('0xf')](function(_0x14661e){logger[_0xe7d9('0x10')](_0xe7d9('0x19'),_0x389db4);logger[_0xe7d9('0x13')](_0xe7d9('0x19'),_0x389db4,JSON[_0xe7d9('0x1e')](_0x14661e));_0x2758c1(_0x14661e);})[_0xe7d9('0x18')](function(_0x2bedd6){logger[_0xe7d9('0x14')](_0xe7d9('0x19'),_0x2bedd6[_0xe7d9('0x16')],_0x389db4);_0x2863f4(_0x2d3608[_0xe7d9('0x14')](0x1f4,_0x2bedd6[_0xe7d9('0x16')]));});});}; \ No newline at end of file +var _0x6023=['request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','create','options','raw','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsMessage.socket','register','then','info'];(function(_0x293a6b,_0x1c3110){var _0x4b3d19=function(_0x3b823a){while(--_0x3b823a){_0x293a6b['push'](_0x293a6b['shift']());}};_0x4b3d19(++_0x1c3110);}(_0x6023,0x71));var _0x3602=function(_0x313882,_0xcec514){_0x313882=_0x313882-0x0;var _0x21fb4f=_0x6023[_0x313882];return _0x21fb4f;};'use strict';var _=require(_0x3602('0x0'));var util=require('util');var moment=require(_0x3602('0x1'));var BPromise=require('bluebird');var rs=require(_0x3602('0x2'));var fs=require('fs');var Redis=require(_0x3602('0x3'));var db=require(_0x3602('0x4'))['db'];var utils=require(_0x3602('0x5'));var logger=require(_0x3602('0x6'))(_0x3602('0x7'));var config=require(_0x3602('0x8'));var jayson=require(_0x3602('0x9'));var client=jayson[_0x3602('0xa')][_0x3602('0xb')]({'port':0x232a});config[_0x3602('0xc')]=_[_0x3602('0xd')](config[_0x3602('0xc')],{'host':_0x3602('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3602('0xc')]));require(_0x3602('0xf'))[_0x3602('0x10')](socket);function respondWithRpcPromise(_0x56c7e2,_0x329b5e,_0x3f041a){return new BPromise(function(_0x186edd,_0xdbdb18){return client['request'](_0x56c7e2,_0x3f041a)[_0x3602('0x11')](function(_0x26c347){logger[_0x3602('0x12')]('SmsMessage,\x20%s,\x20%s',_0x329b5e,_0x3602('0x13'));logger[_0x3602('0x14')](_0x3602('0x15'),_0x329b5e,_0x3602('0x13'),JSON['stringify'](_0x26c347));if(_0x26c347[_0x3602('0x16')]){if(_0x26c347[_0x3602('0x16')][_0x3602('0x17')]===0x1f4){logger[_0x3602('0x16')](_0x3602('0x18'),_0x329b5e,_0x26c347[_0x3602('0x16')][_0x3602('0x19')]);return _0xdbdb18(_0x26c347['error'][_0x3602('0x19')]);}logger[_0x3602('0x16')](_0x3602('0x18'),_0x329b5e,_0x26c347['error']['message']);return _0x186edd(_0x26c347[_0x3602('0x16')]['message']);}else{logger['info'](_0x3602('0x18'),_0x329b5e,_0x3602('0x13'));_0x186edd(_0x26c347[_0x3602('0x1a')]['message']);}})[_0x3602('0x1b')](function(_0x9ebea7){logger[_0x3602('0x16')](_0x3602('0x18'),_0x329b5e,_0x9ebea7);_0xdbdb18(_0x9ebea7);});});}exports[_0x3602('0x1c')]=function(_0x5aded4){var _0x36c866=this;return new Promise(function(_0x4a9f81,_0x294758){return db['SmsMessage'][_0x3602('0x1d')](_0x5aded4['body'],{'raw':_0x5aded4[_0x3602('0x1e')]?_0x5aded4[_0x3602('0x1e')][_0x3602('0x1f')]===undefined?!![]:![]:!![]})[_0x3602('0x11')](function(_0x1307ab){logger[_0x3602('0x12')](_0x3602('0x1c'),_0x5aded4);logger['debug'](_0x3602('0x1c'),_0x5aded4,JSON[_0x3602('0x20')](_0x1307ab));_0x4a9f81(_0x1307ab);})[_0x3602('0x1b')](function(_0x54e452){logger[_0x3602('0x16')](_0x3602('0x1c'),_0x54e452['message'],_0x5aded4);_0x294758(_0x36c866['error'](0x1f4,_0x54e452['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index faeaffe..04df102 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 _0x4c32=['removeListener','register','length','smsMessage:','./smsMessage.events','save','update','emit'];(function(_0x4a2282,_0x172116){var _0x483df0=function(_0x2ca56a){while(--_0x2ca56a){_0x4a2282['push'](_0x4a2282['shift']());}};_0x483df0(++_0x172116);}(_0x4c32,0x1bc));var _0x24c3=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x4c32[_0x5f3f88];return _0xd08119;};'use strict';var SmsMessageEvents=require(_0x24c3('0x0'));var events=[_0x24c3('0x1'),'remove',_0x24c3('0x2')];function createListener(_0x52fdd0,_0x8fa7a1){return function(_0x33a093){_0x8fa7a1[_0x24c3('0x3')](_0x52fdd0,_0x33a093);};}function removeListener(_0x4eb33d,_0x1ebebf){return function(){SmsMessageEvents[_0x24c3('0x4')](_0x4eb33d,_0x1ebebf);};}exports[_0x24c3('0x5')]=function(_0x73d43e){for(var _0x5c7769=0x0,_0x35fe74=events[_0x24c3('0x6')];_0x5c7769<_0x35fe74;_0x5c7769++){var _0x50f699=events[_0x5c7769];var _0x576d59=createListener(_0x24c3('0x7')+_0x50f699,_0x73d43e);SmsMessageEvents['on'](_0x50f699,_0x576d59);}}; \ No newline at end of file +var _0xd934=['register','length','smsMessage:','./smsMessage.events','save','remove','update','emit'];(function(_0x185133,_0x29a472){var _0x862f7f=function(_0x25ea87){while(--_0x25ea87){_0x185133['push'](_0x185133['shift']());}};_0x862f7f(++_0x29a472);}(_0xd934,0xb3));var _0x4d93=function(_0x369085,_0x2b07b4){_0x369085=_0x369085-0x0;var _0x20ccc9=_0xd934[_0x369085];return _0x20ccc9;};'use strict';var SmsMessageEvents=require(_0x4d93('0x0'));var events=[_0x4d93('0x1'),_0x4d93('0x2'),_0x4d93('0x3')];function createListener(_0x15e9cc,_0x50128b){return function(_0xd534ed){_0x50128b[_0x4d93('0x4')](_0x15e9cc,_0xd534ed);};}function removeListener(_0x3b48fb,_0x56814a){return function(){SmsMessageEvents['removeListener'](_0x3b48fb,_0x56814a);};}exports[_0x4d93('0x5')]=function(_0x2b5c6b){for(var _0x1c4036=0x0,_0x15519b=events[_0x4d93('0x6')];_0x1c4036<_0x15519b;_0x1c4036++){var _0x8e1e38=events[_0x1c4036];var _0x301969=createListener(_0x4d93('0x7')+_0x8e1e38,_0x2b5c6b);SmsMessageEvents['on'](_0x8e1e38,_0x301969);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 01399d3..f127a8f 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 _0xff0e=['/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','create','/:id/teams','addTeams','post','addAgents','put','delete','destroy','removeAgents','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x27736d,_0x19cb1b){var _0xa32ede=function(_0x1dcf3a){while(--_0x1dcf3a){_0x27736d['push'](_0x27736d['shift']());}};_0xa32ede(++_0x19cb1b);}(_0xff0e,0xb4));var _0xeff0=function(_0x4c7721,_0x296c38){_0x4c7721=_0x4c7721-0x0;var _0x5ae43e=_0xff0e[_0x4c7721];return _0x5ae43e;};'use strict';var multer=require('multer');var util=require(_0xeff0('0x0'));var path=require('path');var timeout=require(_0xeff0('0x1'));var express=require(_0xeff0('0x2'));var router=express['Router']();var fs_extra=require(_0xeff0('0x3'));var auth=require(_0xeff0('0x4'));var interaction=require(_0xeff0('0x5'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router['get']('/',auth[_0xeff0('0x6')](),controller[_0xeff0('0x7')]);router[_0xeff0('0x8')](_0xeff0('0x9'),auth[_0xeff0('0x6')](),controller[_0xeff0('0xa')]);router[_0xeff0('0x8')](_0xeff0('0xb'),auth[_0xeff0('0x6')](),controller[_0xeff0('0xc')]);router[_0xeff0('0x8')](_0xeff0('0xd'),auth[_0xeff0('0x6')](),controller[_0xeff0('0xe')]);router[_0xeff0('0x8')]('/:id/teams',auth[_0xeff0('0x6')](),controller[_0xeff0('0xf')]);router['get'](_0xeff0('0x10'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xeff0('0x6')](),controller[_0xeff0('0x11')]);router['post'](_0xeff0('0x12'),auth[_0xeff0('0x6')](),controller[_0xeff0('0x13')]);router[_0xeff0('0x14')]('/:id/users',auth[_0xeff0('0x6')](),controller[_0xeff0('0x15')]);router[_0xeff0('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xeff0('0x17')](_0xeff0('0xb'),auth[_0xeff0('0x6')](),controller[_0xeff0('0x18')]);router[_0xeff0('0x17')](_0xeff0('0x12'),auth[_0xeff0('0x6')](),controller['removeTeams']);router[_0xeff0('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xeff0('0x19')]);module[_0xeff0('0x1a')]=router; \ No newline at end of file +var _0x2b26=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','connect-timeout'];(function(_0x440fd0,_0x252743){var _0x15ab79=function(_0x32f2d3){while(--_0x32f2d3){_0x440fd0['push'](_0x440fd0['shift']());}};_0x15ab79(++_0x252743);}(_0x2b26,0xbc));var _0x62b2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2b26[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x62b2('0x0'));var express=require('express');var router=express[_0x62b2('0x1')]();var fs_extra=require(_0x62b2('0x2'));var auth=require(_0x62b2('0x3'));var interaction=require(_0x62b2('0x4'));var config=require(_0x62b2('0x5'));var controller=require(_0x62b2('0x6'));router[_0x62b2('0x7')]('/',auth[_0x62b2('0x8')](),controller['index']);router[_0x62b2('0x7')](_0x62b2('0x9'),auth[_0x62b2('0x8')](),controller['describe']);router[_0x62b2('0x7')](_0x62b2('0xa'),auth['isAuthenticated'](),controller[_0x62b2('0xb')]);router[_0x62b2('0x7')](_0x62b2('0xc'),auth[_0x62b2('0x8')](),controller[_0x62b2('0xd')]);router['get'](_0x62b2('0xe'),auth['isAuthenticated'](),controller[_0x62b2('0xf')]);router['get'](_0x62b2('0x10'),auth['isAuthenticated'](),controller[_0x62b2('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x62b2('0x12')]);router[_0x62b2('0x13')]('/:id/teams',auth[_0x62b2('0x8')](),controller[_0x62b2('0x14')]);router[_0x62b2('0x13')]('/:id/users',auth[_0x62b2('0x8')](),controller['addAgents']);router[_0x62b2('0x15')](_0x62b2('0xa'),auth[_0x62b2('0x8')](),controller['update']);router[_0x62b2('0x16')](_0x62b2('0xa'),auth[_0x62b2('0x8')](),controller[_0x62b2('0x17')]);router[_0x62b2('0x16')](_0x62b2('0xe'),auth[_0x62b2('0x8')](),controller[_0x62b2('0x18')]);router['delete'](_0x62b2('0x10'),auth[_0x62b2('0x8')](),controller[_0x62b2('0x19')]);module[_0x62b2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 9b19190..ca2448f 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 _0xeb0e=['roundrobin','sequelize','name','STRING','INTEGER','rrmemory','beepall'];(function(_0x22e13e,_0x69cc26){var _0x3c9279=function(_0x9a8d67){while(--_0x9a8d67){_0x22e13e['push'](_0x22e13e['shift']());}};_0x3c9279(++_0x69cc26);}(_0xeb0e,0x71));var _0xeeb0=function(_0x1959cf,_0x1202eb){_0x1959cf=_0x1959cf-0x0;var _0x2fd4e6=_0xeb0e[_0x1959cf];return _0x2fd4e6;};'use strict';var Sequelize=require(_0xeeb0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xeeb0('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeeb0('0x2')]},'timeout':{'type':Sequelize[_0xeeb0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xeeb0('0x4'),_0xeeb0('0x5'),_0xeeb0('0x6'))}}; \ No newline at end of file +var _0x138e=['exports','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x2e65ee,_0x29dad9){var _0x4c712a=function(_0xca593f){while(--_0xca593f){_0x2e65ee['push'](_0x2e65ee['shift']());}};_0x4c712a(++_0x29dad9);}(_0x138e,0x11e));var _0xe138=function(_0x54c731,_0x153595){_0x54c731=_0x54c731-0x0;var _0x285dfb=_0x138e[_0x54c731];return _0x285dfb;};'use strict';var Sequelize=require(_0xe138('0x0'));module[_0xe138('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe138('0x2')]},'timeout':{'type':Sequelize[_0xe138('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe138('0x4')]('rrmemory',_0xe138('0x5'),_0xe138('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ba7745c..ad28911 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2c602e,_0x1d26f5){_0x2c602e=_0x2c602e-0x0;var _0x1a2650=_0x0b0e[_0x2c602e];return _0x1a2650;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x18ceaa,_0x22735e){var _0x3960e0=function(_0x58f05e){while(--_0x58f05e){_0x18ceaa['push'](_0x18ceaa['shift']());}};_0x3960e0(++_0x22735e);}(_0x2ef3,0xba));var _0x32ef=function(_0x9a1172,_0x589a75){_0x9a1172=_0x9a1172-0x0;var _0x13cad1=_0x2ef3[_0x9a1172];return _0x13cad1;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 195b229..10851ab 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 _0x5939=['../../mysqldb','SmsQueue','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x50fa63,_0x269a73){var _0x3f3b1c=function(_0x33a6a6){while(--_0x33a6a6){_0x50fa63['push'](_0x50fa63['shift']());}};_0x3f3b1c(++_0x269a73);}(_0x5939,0x7d));var _0x9593=function(_0x2c7f6c,_0x55c42a){_0x2c7f6c=_0x2c7f6c-0x0;var _0x95dec7=_0x5939[_0x2c7f6c];return _0x95dec7;};'use strict';var EventEmitter=require(_0x9593('0x0'));var SmsQueue=require(_0x9593('0x1'))['db'][_0x9593('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9593('0x3'),'afterUpdate':_0x9593('0x4'),'afterDestroy':_0x9593('0x5')};function emitEvent(_0x21e2de){return function(_0x5d7b1f,_0x2ba7a7,_0x3ff813){SmsQueueEvents[_0x9593('0x6')](_0x21e2de+':'+_0x5d7b1f['id'],_0x5d7b1f);SmsQueueEvents[_0x9593('0x6')](_0x21e2de,_0x5d7b1f);_0x3ff813(null);};}for(var e in events){if(events[_0x9593('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x9593('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xcf91=['../../mysqldb','SmsQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x482734,_0x418162){var _0x36651d=function(_0x91cb4f){while(--_0x91cb4f){_0x482734['push'](_0x482734['shift']());}};_0x36651d(++_0x418162);}(_0xcf91,0x1d5));var _0x1cf9=function(_0x2b9b50,_0x520124){_0x2b9b50=_0x2b9b50-0x0;var _0x733b91=_0xcf91[_0x2b9b50];return _0x733b91;};'use strict';var EventEmitter=require(_0x1cf9('0x0'));var SmsQueue=require(_0x1cf9('0x1'))['db'][_0x1cf9('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cf9('0x3'),'afterUpdate':_0x1cf9('0x4'),'afterDestroy':_0x1cf9('0x5')};function emitEvent(_0x56b263){return function(_0xbf0a04,_0x54cdb5,_0x3333f){SmsQueueEvents[_0x1cf9('0x6')](_0x56b263+':'+_0xbf0a04['id'],_0xbf0a04);SmsQueueEvents[_0x1cf9('0x6')](_0x56b263,_0xbf0a04);_0x3333f(null);};}for(var e in events){if(events[_0x1cf9('0x7')](e)){var event=events[e];SmsQueue[_0x1cf9('0x8')](e,emitEvent(event));}}module[_0x1cf9('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 06d2a4d..6732eee 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 _0x75d6=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x75d6,0x137));var _0x675d=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0x75d6[_0x55daf2];return _0x1c8500;};'use strict';var _=require(_0x675d('0x0'));var util=require(_0x675d('0x1'));var logger=require(_0x675d('0x2'))(_0x675d('0x3'));var moment=require(_0x675d('0x4'));var BPromise=require(_0x675d('0x5'));var rp=require(_0x675d('0x6'));var fs=require('fs');var path=require(_0x675d('0x7'));var rimraf=require(_0x675d('0x8'));var config=require('../../config/environment');var attributes=require(_0x675d('0x9'));module['exports']=function(_0x7bb6a0,_0x446c50){return _0x7bb6a0[_0x675d('0xa')](_0x675d('0xb'),attributes,{'tableName':_0x675d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77c9=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','api'];(function(_0x450a68,_0x41444d){var _0x4f4b1a=function(_0xd7cb05){while(--_0xd7cb05){_0x450a68['push'](_0x450a68['shift']());}};_0x4f4b1a(++_0x41444d);}(_0x77c9,0x10e));var _0x977c=function(_0x4e6243,_0x37ec06){_0x4e6243=_0x4e6243-0x0;var _0x211fbc=_0x77c9[_0x4e6243];return _0x211fbc;};'use strict';var _=require(_0x977c('0x0'));var util=require('util');var logger=require(_0x977c('0x1'))(_0x977c('0x2'));var moment=require('moment');var BPromise=require(_0x977c('0x3'));var rp=require(_0x977c('0x4'));var fs=require('fs');var path=require(_0x977c('0x5'));var rimraf=require(_0x977c('0x6'));var config=require(_0x977c('0x7'));var attributes=require(_0x977c('0x8'));module[_0x977c('0x9')]=function(_0xa40c10,_0x4c191d){return _0xa40c10[_0x977c('0xa')](_0x977c('0xb'),attributes,{'tableName':_0x977c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index f7ef8f2..a39dd4c 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 _0x590d=['result','catch','SmsQueue','findAll','options','raw','where','limit','include','model','map','attributes','GetSmsQueue','find','ShowSmsQueue','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0x590d,0x14f));var _0xd590=function(_0x117713,_0x1b3f0c){_0x117713=_0x117713-0x0;var _0x310d68=_0x590d[_0x117713];return _0x310d68;};'use strict';var _=require(_0xd590('0x0'));var util=require('util');var moment=require(_0xd590('0x1'));var BPromise=require(_0xd590('0x2'));var rs=require(_0xd590('0x3'));var fs=require('fs');var Redis=require(_0xd590('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd590('0x5'));var logger=require(_0xd590('0x6'))(_0xd590('0x7'));var config=require(_0xd590('0x8'));var jayson=require(_0xd590('0x9'));var client=jayson[_0xd590('0xa')]['http']({'port':0x232a});config[_0xd590('0xb')]=_[_0xd590('0xc')](config[_0xd590('0xb')],{'host':_0xd590('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd590('0xb')]));require(_0xd590('0xe'))[_0xd590('0xf')](socket);function respondWithRpcPromise(_0x4f3b86,_0x53f470,_0x1d37b7){return new BPromise(function(_0xdd7f9e,_0x4c1bd3){return client[_0xd590('0x10')](_0x4f3b86,_0x1d37b7)[_0xd590('0x11')](function(_0x54d01c){logger[_0xd590('0x12')](_0xd590('0x13'),_0x53f470,'request\x20sent');logger[_0xd590('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x53f470,_0xd590('0x15'),JSON[_0xd590('0x16')](_0x54d01c));if(_0x54d01c[_0xd590('0x17')]){if(_0x54d01c[_0xd590('0x17')]['code']===0x1f4){logger[_0xd590('0x17')]('SmsQueue,\x20%s,\x20%s',_0x53f470,_0x54d01c[_0xd590('0x17')]['message']);return _0x4c1bd3(_0x54d01c[_0xd590('0x17')][_0xd590('0x18')]);}logger[_0xd590('0x17')]('SmsQueue,\x20%s,\x20%s',_0x53f470,_0x54d01c[_0xd590('0x17')][_0xd590('0x18')]);return _0xdd7f9e(_0x54d01c['error'][_0xd590('0x18')]);}else{logger[_0xd590('0x12')]('SmsQueue,\x20%s,\x20%s',_0x53f470,_0xd590('0x15'));_0xdd7f9e(_0x54d01c[_0xd590('0x19')]['message']);}})[_0xd590('0x1a')](function(_0x49f671){logger[_0xd590('0x17')](_0xd590('0x13'),_0x53f470,_0x49f671);_0x4c1bd3(_0x49f671);});});}exports['GetSmsQueue']=function(_0x5308bd){var _0x245914=this;return new Promise(function(_0x5e1315,_0x142089){return db[_0xd590('0x1b')][_0xd590('0x1c')]({'raw':_0x5308bd[_0xd590('0x1d')]?_0x5308bd[_0xd590('0x1d')][_0xd590('0x1e')]===undefined?!![]:![]:!![],'where':_0x5308bd['options']?_0x5308bd[_0xd590('0x1d')][_0xd590('0x1f')]||null:null,'attributes':_0x5308bd[_0xd590('0x1d')]?_0x5308bd[_0xd590('0x1d')]['attributes']||null:null,'limit':_0x5308bd[_0xd590('0x1d')]?_0x5308bd[_0xd590('0x1d')][_0xd590('0x20')]||null:null,'include':_0x5308bd[_0xd590('0x1d')]?_0x5308bd['options'][_0xd590('0x21')]?_['map'](_0x5308bd[_0xd590('0x1d')]['include'],function(_0x4723ce){return{'model':db[_0x4723ce[_0xd590('0x22')]],'as':_0x4723ce['as'],'attributes':_0x4723ce['attributes'],'include':_0x4723ce[_0xd590('0x21')]?_[_0xd590('0x23')](_0x4723ce[_0xd590('0x21')],function(_0x573d26){return{'model':db[_0x573d26[_0xd590('0x22')]],'as':_0x573d26['as'],'attributes':_0x573d26[_0xd590('0x24')],'include':_0x573d26['include']?_['map'](_0x573d26[_0xd590('0x21')],function(_0x51f43d){return{'model':db[_0x51f43d[_0xd590('0x22')]],'as':_0x51f43d['as'],'attributes':_0x51f43d[_0xd590('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1db563){logger['info'](_0xd590('0x25'),_0x5308bd);logger[_0xd590('0x14')]('GetSmsQueue',_0x5308bd,JSON[_0xd590('0x16')](_0x1db563));_0x5e1315(_0x1db563);})[_0xd590('0x1a')](function(_0x205bb2){logger[_0xd590('0x17')](_0xd590('0x25'),_0x205bb2[_0xd590('0x18')],_0x5308bd);_0x142089(_0x245914[_0xd590('0x17')](0x1f4,_0x205bb2[_0xd590('0x18')]));});});};exports['ShowSmsQueue']=function(_0x233777){var _0x4a1c7a=this;return new Promise(function(_0x3dcbed,_0x1a559a){return db['SmsQueue'][_0xd590('0x26')]({'raw':_0x233777[_0xd590('0x1d')]?_0x233777[_0xd590('0x1d')][_0xd590('0x1e')]===undefined?!![]:![]:!![],'where':_0x233777['options']?_0x233777[_0xd590('0x1d')][_0xd590('0x1f')]||null:null,'attributes':_0x233777[_0xd590('0x1d')]?_0x233777[_0xd590('0x1d')]['attributes']||null:null,'include':_0x233777[_0xd590('0x1d')]?_0x233777['options'][_0xd590('0x21')]?_[_0xd590('0x23')](_0x233777[_0xd590('0x1d')]['include'],function(_0x7eaeef){return{'model':db[_0x7eaeef['model']],'as':_0x7eaeef['as'],'attributes':_0x7eaeef['attributes'],'include':_0x7eaeef[_0xd590('0x21')]?_[_0xd590('0x23')](_0x7eaeef[_0xd590('0x21')],function(_0x334bc0){return{'model':db[_0x334bc0[_0xd590('0x22')]],'as':_0x334bc0['as'],'attributes':_0x334bc0[_0xd590('0x24')],'include':_0x334bc0[_0xd590('0x21')]?_[_0xd590('0x23')](_0x334bc0['include'],function(_0x31d923){return{'model':db[_0x31d923['model']],'as':_0x31d923['as'],'attributes':_0x31d923[_0xd590('0x24')]};}):[]};}):[]};}):[]:[]})[_0xd590('0x11')](function(_0xd69fe5){logger[_0xd590('0x12')](_0xd590('0x27'),_0x233777);logger[_0xd590('0x14')]('ShowSmsQueue',_0x233777,JSON['stringify'](_0xd69fe5));_0x3dcbed(_0xd69fe5);})[_0xd590('0x1a')](function(_0x1dcf63){logger[_0xd590('0x17')](_0xd590('0x27'),_0x1dcf63[_0xd590('0x18')],_0x233777);_0x1a559a(_0x4a1c7a['error'](0x1f4,_0x1dcf63[_0xd590('0x18')]));});});}; \ No newline at end of file +var _0xdd62=['rpc','jayson/promise','redis','defaults','socket.io-emitter','./smsQueue.socket','register','then','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','findAll','options','raw','attributes','limit','include','map','model','info','ShowSmsQueue','SmsQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdd62,0x1e7));var _0x2dd6=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xdd62[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x2dd6('0x0'));var util=require('util');var moment=require(_0x2dd6('0x1'));var BPromise=require(_0x2dd6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2dd6('0x3'));var db=require(_0x2dd6('0x4'))['db'];var utils=require(_0x2dd6('0x5'));var logger=require(_0x2dd6('0x6'))(_0x2dd6('0x7'));var config=require('../../config/environment');var jayson=require(_0x2dd6('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x2dd6('0x9')]=_[_0x2dd6('0xa')](config[_0x2dd6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2dd6('0xb'))(new Redis(config[_0x2dd6('0x9')]));require(_0x2dd6('0xc'))[_0x2dd6('0xd')](socket);function respondWithRpcPromise(_0x2ea2cb,_0x165d2c,_0x16cb0e){return new BPromise(function(_0x4ff47c,_0x4531cc){return client['request'](_0x2ea2cb,_0x16cb0e)[_0x2dd6('0xe')](function(_0x20cda7){logger['info']('SmsQueue,\x20%s,\x20%s',_0x165d2c,_0x2dd6('0xf'));logger[_0x2dd6('0x10')](_0x2dd6('0x11'),_0x165d2c,'request\x20sent',JSON[_0x2dd6('0x12')](_0x20cda7));if(_0x20cda7[_0x2dd6('0x13')]){if(_0x20cda7[_0x2dd6('0x13')][_0x2dd6('0x14')]===0x1f4){logger[_0x2dd6('0x13')](_0x2dd6('0x15'),_0x165d2c,_0x20cda7[_0x2dd6('0x13')]['message']);return _0x4531cc(_0x20cda7[_0x2dd6('0x13')][_0x2dd6('0x16')]);}logger[_0x2dd6('0x13')]('SmsQueue,\x20%s,\x20%s',_0x165d2c,_0x20cda7[_0x2dd6('0x13')][_0x2dd6('0x16')]);return _0x4ff47c(_0x20cda7[_0x2dd6('0x13')][_0x2dd6('0x16')]);}else{logger['info'](_0x2dd6('0x15'),_0x165d2c,_0x2dd6('0xf'));_0x4ff47c(_0x20cda7[_0x2dd6('0x17')][_0x2dd6('0x16')]);}})[_0x2dd6('0x18')](function(_0x2ca3c9){logger[_0x2dd6('0x13')](_0x2dd6('0x15'),_0x165d2c,_0x2ca3c9);_0x4531cc(_0x2ca3c9);});});}exports[_0x2dd6('0x19')]=function(_0x5a8d04){var _0x471d59=this;return new Promise(function(_0x12a643,_0x4fce2){return db['SmsQueue'][_0x2dd6('0x1a')]({'raw':_0x5a8d04['options']?_0x5a8d04[_0x2dd6('0x1b')][_0x2dd6('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a8d04['options']?_0x5a8d04[_0x2dd6('0x1b')]['where']||null:null,'attributes':_0x5a8d04['options']?_0x5a8d04['options'][_0x2dd6('0x1d')]||null:null,'limit':_0x5a8d04[_0x2dd6('0x1b')]?_0x5a8d04['options'][_0x2dd6('0x1e')]||null:null,'include':_0x5a8d04[_0x2dd6('0x1b')]?_0x5a8d04[_0x2dd6('0x1b')][_0x2dd6('0x1f')]?_[_0x2dd6('0x20')](_0x5a8d04[_0x2dd6('0x1b')]['include'],function(_0x355ba1){return{'model':db[_0x355ba1['model']],'as':_0x355ba1['as'],'attributes':_0x355ba1[_0x2dd6('0x1d')],'include':_0x355ba1[_0x2dd6('0x1f')]?_[_0x2dd6('0x20')](_0x355ba1[_0x2dd6('0x1f')],function(_0x302b18){return{'model':db[_0x302b18[_0x2dd6('0x21')]],'as':_0x302b18['as'],'attributes':_0x302b18[_0x2dd6('0x1d')],'include':_0x302b18[_0x2dd6('0x1f')]?_['map'](_0x302b18[_0x2dd6('0x1f')],function(_0x138a6b){return{'model':db[_0x138a6b[_0x2dd6('0x21')]],'as':_0x138a6b['as'],'attributes':_0x138a6b[_0x2dd6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2dd6('0xe')](function(_0x45f0a4){logger[_0x2dd6('0x22')](_0x2dd6('0x19'),_0x5a8d04);logger['debug'](_0x2dd6('0x19'),_0x5a8d04,JSON[_0x2dd6('0x12')](_0x45f0a4));_0x12a643(_0x45f0a4);})[_0x2dd6('0x18')](function(_0x5b4331){logger[_0x2dd6('0x13')]('GetSmsQueue',_0x5b4331[_0x2dd6('0x16')],_0x5a8d04);_0x4fce2(_0x471d59[_0x2dd6('0x13')](0x1f4,_0x5b4331[_0x2dd6('0x16')]));});});};exports[_0x2dd6('0x23')]=function(_0x303181){var _0x4c5433=this;return new Promise(function(_0x298dab,_0x1f1267){return db[_0x2dd6('0x24')][_0x2dd6('0x25')]({'raw':_0x303181[_0x2dd6('0x1b')]?_0x303181['options'][_0x2dd6('0x1c')]===undefined?!![]:![]:!![],'where':_0x303181[_0x2dd6('0x1b')]?_0x303181[_0x2dd6('0x1b')]['where']||null:null,'attributes':_0x303181[_0x2dd6('0x1b')]?_0x303181[_0x2dd6('0x1b')]['attributes']||null:null,'include':_0x303181[_0x2dd6('0x1b')]?_0x303181[_0x2dd6('0x1b')]['include']?_[_0x2dd6('0x20')](_0x303181['options']['include'],function(_0x39761f){return{'model':db[_0x39761f[_0x2dd6('0x21')]],'as':_0x39761f['as'],'attributes':_0x39761f[_0x2dd6('0x1d')],'include':_0x39761f[_0x2dd6('0x1f')]?_[_0x2dd6('0x20')](_0x39761f[_0x2dd6('0x1f')],function(_0x3a0a60){return{'model':db[_0x3a0a60['model']],'as':_0x3a0a60['as'],'attributes':_0x3a0a60[_0x2dd6('0x1d')],'include':_0x3a0a60[_0x2dd6('0x1f')]?_[_0x2dd6('0x20')](_0x3a0a60['include'],function(_0xaed528){return{'model':db[_0xaed528[_0x2dd6('0x21')]],'as':_0xaed528['as'],'attributes':_0xaed528[_0x2dd6('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55c53e){logger['info']('ShowSmsQueue',_0x303181);logger[_0x2dd6('0x10')](_0x2dd6('0x23'),_0x303181,JSON[_0x2dd6('0x12')](_0x55c53e));_0x298dab(_0x55c53e);})[_0x2dd6('0x18')](function(_0x402413){logger[_0x2dd6('0x13')]('ShowSmsQueue',_0x402413[_0x2dd6('0x16')],_0x303181);_0x1f1267(_0x4c5433[_0x2dd6('0x13')](0x1f4,_0x402413['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index b87da86..3fc39c4 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 _0xe2df=['smsQueue:','./smsQueue.events','save','remove','register','length'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xe2df,0x109));var _0xfe2d=function(_0x17004f,_0xecafb6){_0x17004f=_0x17004f-0x0;var _0x46742d=_0xe2df[_0x17004f];return _0x46742d;};'use strict';var SmsQueueEvents=require(_0xfe2d('0x0'));var events=[_0xfe2d('0x1'),_0xfe2d('0x2'),'update'];function createListener(_0x21aff6,_0x15ea3d){return function(_0x20d060){_0x15ea3d['emit'](_0x21aff6,_0x20d060);};}function removeListener(_0x3e9d66,_0x48c96c){return function(){SmsQueueEvents['removeListener'](_0x3e9d66,_0x48c96c);};}exports[_0xfe2d('0x3')]=function(_0x215896){for(var _0x5b5e95=0x0,_0xecd8e5=events[_0xfe2d('0x4')];_0x5b5e95<_0xecd8e5;_0x5b5e95++){var _0x34002e=events[_0x5b5e95];var _0x5c0d90=createListener(_0xfe2d('0x5')+_0x34002e,_0x215896);SmsQueueEvents['on'](_0x34002e,_0x5c0d90);}}; \ No newline at end of file +var _0x976b=['register','length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x976b,0x1ce));var _0xb976=function(_0x554eff,_0x515dd9){_0x554eff=_0x554eff-0x0;var _0x416215=_0x976b[_0x554eff];return _0x416215;};'use strict';var SmsQueueEvents=require(_0xb976('0x0'));var events=[_0xb976('0x1'),_0xb976('0x2'),_0xb976('0x3')];function createListener(_0x3f9a8d,_0x8fc92b){return function(_0x4d0b88){_0x8fc92b[_0xb976('0x4')](_0x3f9a8d,_0x4d0b88);};}function removeListener(_0xa89185,_0x539ca4){return function(){SmsQueueEvents[_0xb976('0x5')](_0xa89185,_0x539ca4);};}exports[_0xb976('0x6')]=function(_0x3dc484){for(var _0x3b8e33=0x0,_0x4f72b7=events[_0xb976('0x7')];_0x3b8e33<_0x4f72b7;_0x3b8e33++){var _0x42e3cb=events[_0x3b8e33];var _0x27505e=createListener(_0xb976('0x8')+_0x42e3cb,_0x3dc484);SmsQueueEvents['on'](_0x42e3cb,_0x27505e);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f40af21..6d140f8 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 _0x42f0=['describe','show','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x508c82,_0x4a5715){var _0x4acbe3=function(_0x15de32){while(--_0x15de32){_0x508c82['push'](_0x508c82['shift']());}};_0x4acbe3(++_0x4a5715);}(_0x42f0,0x1b4));var _0x042f=function(_0x2e9b9c,_0x438d76){_0x2e9b9c=_0x2e9b9c-0x0;var _0x17fb46=_0x42f0[_0x2e9b9c];return _0x17fb46;};'use strict';var multer=require(_0x042f('0x0'));var util=require(_0x042f('0x1'));var path=require(_0x042f('0x2'));var timeout=require(_0x042f('0x3'));var express=require(_0x042f('0x4'));var router=express[_0x042f('0x5')]();var fs_extra=require(_0x042f('0x6'));var auth=require(_0x042f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x042f('0x8'));var controller=require(_0x042f('0x9'));router[_0x042f('0xa')]('/',auth[_0x042f('0xb')](),controller[_0x042f('0xc')]);router[_0x042f('0xa')](_0x042f('0xd'),auth['isAuthenticated'](),controller[_0x042f('0xe')]);router[_0x042f('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x042f('0xf')]);router['post']('/',auth[_0x042f('0xb')](),controller['create']);router['put'](_0x042f('0x10'),auth[_0x042f('0xb')](),controller[_0x042f('0x11')]);router['delete']('/:id',auth[_0x042f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4020=['./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4020,0x1f0));var _0x0402=function(_0x1b9d1d,_0x159136){_0x1b9d1d=_0x1b9d1d-0x0;var _0x3d8740=_0x4020[_0x1b9d1d];return _0x3d8740;};'use strict';var multer=require('multer');var util=require(_0x0402('0x0'));var path=require(_0x0402('0x1'));var timeout=require(_0x0402('0x2'));var express=require(_0x0402('0x3'));var router=express[_0x0402('0x4')]();var fs_extra=require(_0x0402('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0402('0x6'));var config=require(_0x0402('0x7'));var controller=require(_0x0402('0x8'));router[_0x0402('0x9')]('/',auth['isAuthenticated'](),controller[_0x0402('0xa')]);router['get'](_0x0402('0xb'),auth[_0x0402('0xc')](),controller[_0x0402('0xd')]);router[_0x0402('0x9')](_0x0402('0xe'),auth[_0x0402('0xc')](),controller[_0x0402('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0402('0xe'),auth[_0x0402('0xc')](),controller[_0x0402('0x10')]);router['delete'](_0x0402('0xe'),auth[_0x0402('0xc')](),controller['destroy']);module[_0x0402('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 82a82ae..3f3c7d5 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 _0x5f01=['sequelize','exports','STRING','DATE'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x5f01,0xcc));var _0x15f0=function(_0x7cd84c,_0xa9797a){_0x7cd84c=_0x7cd84c-0x0;var _0x45e62e=_0x5f01[_0x7cd84c];return _0x45e62e;};'use strict';var moment=require('moment');var Sequelize=require(_0x15f0('0x0'));module[_0x15f0('0x1')]={'uniqueid':{'type':Sequelize[_0x15f0('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x15f0('0x3')]},'leaveAt':{'type':Sequelize[_0x15f0('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x15f0('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0940=['moment','exports','STRING','DATE'];(function(_0x1ecc80,_0x2d845d){var _0x4d33f6=function(_0x5e0b0b){while(--_0x5e0b0b){_0x1ecc80['push'](_0x1ecc80['shift']());}};_0x4d33f6(++_0x2d845d);}(_0x0940,0x84));var _0x0094=function(_0x2cee01,_0x3c3642){_0x2cee01=_0x2cee01-0x0;var _0x467c0d=_0x0940[_0x2cee01];return _0x467c0d;};'use strict';var moment=require(_0x0094('0x0'));var Sequelize=require('sequelize');module[_0x0094('0x1')]={'uniqueid':{'type':Sequelize[_0x0094('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0094('0x2')]},'joinAt':{'type':Sequelize[_0x0094('0x3')]},'leaveAt':{'type':Sequelize[_0x0094('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0094('0x3')]},'reason':{'type':Sequelize[_0x0094('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 5224d3b..ae2276a 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 _0xb503=['destroy','end','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsQueueReport','include','catch','params','length','includeAll','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','save','update','then'];(function(_0x133b2b,_0x44a644){var _0x3bc4dc=function(_0x1491f7){while(--_0x1491f7){_0x133b2b['push'](_0x133b2b['shift']());}};_0x3bc4dc(++_0x44a644);}(_0xb503,0x184));var _0x3b50=function(_0x19b1ca,_0x3bd11f){_0x19b1ca=_0x19b1ca-0x0;var _0x5549f4=_0xb503[_0x19b1ca];return _0x5549f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b50('0x0'));var zipdir=require(_0x3b50('0x1'));var jsonpatch=require(_0x3b50('0x2'));var rp=require(_0x3b50('0x3'));var moment=require(_0x3b50('0x4'));var BPromise=require(_0x3b50('0x5'));var Mustache=require(_0x3b50('0x6'));var util=require(_0x3b50('0x7'));var path=require(_0x3b50('0x8'));var sox=require(_0x3b50('0x9'));var csv=require(_0x3b50('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b50('0xb'));var squel=require(_0x3b50('0xc'));var crypto=require(_0x3b50('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3b50('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b50('0xf'));var Redis=require(_0x3b50('0x10'));var authService=require(_0x3b50('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3b50('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3b50('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3b50('0x14'))['db'];function respondWithStatusCode(_0x40ef9b,_0x2e530a){_0x2e530a=_0x2e530a||0xcc;return function(_0xede138){if(_0xede138){return _0x40ef9b[_0x3b50('0x15')](_0x2e530a);}return _0x40ef9b[_0x3b50('0x16')](_0x2e530a)['end']();};}function respondWithResult(_0x1ccecf,_0x39601b){_0x39601b=_0x39601b||0xc8;return function(_0x39b328){if(_0x39b328){return _0x1ccecf['status'](_0x39601b)['json'](_0x39b328);}};}function respondWithFilteredResult(_0x471c1d,_0x120137){return function(_0x2628ee){if(_0x2628ee){var _0x3e5017=typeof _0x120137[_0x3b50('0x17')]===_0x3b50('0x18')&&typeof _0x120137[_0x3b50('0x19')]===_0x3b50('0x18');var _0x113c91=_0x2628ee[_0x3b50('0x1a')];var _0x3b0779=_0x3e5017?0x0:_0x120137['offset'];var _0x51c3c6=_0x3e5017?_0x2628ee[_0x3b50('0x1a')]:_0x120137['offset']+_0x120137[_0x3b50('0x19')];var _0x257087;if(_0x51c3c6>=_0x113c91){_0x51c3c6=_0x113c91;_0x257087=0xc8;}else{_0x257087=0xce;}_0x471c1d['status'](_0x257087);return _0x471c1d[_0x3b50('0x1b')]('Content-Range',_0x3b0779+'-'+_0x51c3c6+'/'+_0x113c91)['json'](_0x2628ee);}return null;};}function patchUpdates(_0x2daf0a){return function(_0x2322c7){try{jsonpatch[_0x3b50('0x1c')](_0x2322c7,_0x2daf0a,!![]);}catch(_0x3a6f93){return BPromise['reject'](_0x3a6f93);}return _0x2322c7[_0x3b50('0x1d')]();};}function saveUpdates(_0x45af4c,_0x4be126){return function(_0x11e148){if(_0x11e148){return _0x11e148[_0x3b50('0x1e')](_0x45af4c)[_0x3b50('0x1f')](function(_0x1e30f1){return _0x1e30f1;});}return null;};}function removeEntity(_0x49e3d2,_0x262cd0){return function(_0x50e473){if(_0x50e473){return _0x50e473[_0x3b50('0x20')]()[_0x3b50('0x1f')](function(){_0x49e3d2[_0x3b50('0x16')](0xcc)[_0x3b50('0x21')]();});}};}function handleEntityNotFound(_0x3dac38,_0x2af102){return function(_0x29d6ac){if(!_0x29d6ac){_0x3dac38[_0x3b50('0x15')](0x194);}return _0x29d6ac;};}function handleError(_0x57ab71,_0x2ef63a){_0x2ef63a=_0x2ef63a||0x1f4;return function(_0x1a4d82){logger[_0x3b50('0x22')](_0x1a4d82['stack']);if(_0x1a4d82[_0x3b50('0x23')]){delete _0x1a4d82['name'];}_0x57ab71[_0x3b50('0x16')](_0x2ef63a)[_0x3b50('0x24')](_0x1a4d82);};}exports[_0x3b50('0x25')]=function(_0x3bf06c,_0x58e615){var _0x45ed5a={},_0xa7253d={},_0x4fa1c1={'count':0x0,'rows':[]};var _0x5ad5cb=_[_0x3b50('0x26')](db['SmsQueueReport'][_0x3b50('0x27')],function(_0x37adec){return{'name':_0x37adec[_0x3b50('0x28')],'type':_0x37adec['type'][_0x3b50('0x29')]};});_0xa7253d['model']=_[_0x3b50('0x26')](_0x5ad5cb,_0x3b50('0x23'));_0xa7253d[_0x3b50('0x2a')]=_[_0x3b50('0x2b')](_0x3bf06c[_0x3b50('0x2a')]);_0xa7253d[_0x3b50('0x2c')]=_[_0x3b50('0x2d')](_0xa7253d[_0x3b50('0x2e')],_0xa7253d[_0x3b50('0x2a')]);_0x45ed5a[_0x3b50('0x2f')]=_[_0x3b50('0x2d')](_0xa7253d['model'],qs[_0x3b50('0x30')](_0x3bf06c[_0x3b50('0x2a')][_0x3b50('0x30')]));_0x45ed5a[_0x3b50('0x2f')]=_0x45ed5a[_0x3b50('0x2f')]['length']?_0x45ed5a[_0x3b50('0x2f')]:_0xa7253d[_0x3b50('0x2e')];if(!_0x3bf06c['query'][_0x3b50('0x31')](_0x3b50('0x32'))){_0x45ed5a['limit']=qs[_0x3b50('0x19')](_0x3bf06c[_0x3b50('0x2a')]['limit']);_0x45ed5a['offset']=qs['offset'](_0x3bf06c['query']['offset']);}_0x45ed5a[_0x3b50('0x33')]=qs[_0x3b50('0x34')](_0x3bf06c[_0x3b50('0x2a')]['sort']);_0x45ed5a[_0x3b50('0x35')]=qs[_0x3b50('0x2c')](_[_0x3b50('0x36')](_0x3bf06c[_0x3b50('0x2a')],_0xa7253d[_0x3b50('0x2c')]),_0x5ad5cb);if(_0x3bf06c['query'][_0x3b50('0x37')]){_0x45ed5a[_0x3b50('0x35')]=_[_0x3b50('0x38')](_0x45ed5a[_0x3b50('0x35')],{'$or':_[_0x3b50('0x26')](_0x5ad5cb,function(_0x16bfd2){if(_0x16bfd2[_0x3b50('0x39')]!==_0x3b50('0x3a')){var _0x3385c4={};_0x3385c4[_0x16bfd2[_0x3b50('0x23')]]={'$like':'%'+_0x3bf06c[_0x3b50('0x2a')]['filter']+'%'};return _0x3385c4;}})});}_0x45ed5a=_[_0x3b50('0x38')]({},_0x45ed5a,_0x3bf06c[_0x3b50('0x3b')]);var _0x35c0ab={'where':_0x45ed5a[_0x3b50('0x35')]};return db[_0x3b50('0x3c')][_0x3b50('0x1a')](_0x35c0ab)[_0x3b50('0x1f')](function(_0x69e855){_0x4fa1c1['count']=_0x69e855;if(_0x3bf06c[_0x3b50('0x2a')]['includeAll']){_0x45ed5a[_0x3b50('0x3d')]=[{'all':!![]}];}return db[_0x3b50('0x3c')]['findAll'](_0x45ed5a);})['then'](function(_0x1c584a){_0x4fa1c1['rows']=_0x1c584a;return _0x4fa1c1;})[_0x3b50('0x1f')](respondWithFilteredResult(_0x58e615,_0x45ed5a))[_0x3b50('0x3e')](handleError(_0x58e615,null));};exports['show']=function(_0x53fdd9,_0x5f4445){var _0x57dfea={'raw':!![],'where':{'id':_0x53fdd9[_0x3b50('0x3f')]['id']}},_0x2dcc4c={};_0x2dcc4c[_0x3b50('0x2e')]=_[_0x3b50('0x2b')](db['SmsQueueReport'][_0x3b50('0x27')]);_0x2dcc4c[_0x3b50('0x2a')]=_[_0x3b50('0x2b')](_0x53fdd9['query']);_0x2dcc4c[_0x3b50('0x2c')]=_[_0x3b50('0x2d')](_0x2dcc4c['model'],_0x2dcc4c['query']);_0x57dfea[_0x3b50('0x2f')]=_[_0x3b50('0x2d')](_0x2dcc4c['model'],qs[_0x3b50('0x30')](_0x53fdd9[_0x3b50('0x2a')][_0x3b50('0x30')]));_0x57dfea[_0x3b50('0x2f')]=_0x57dfea[_0x3b50('0x2f')][_0x3b50('0x40')]?_0x57dfea[_0x3b50('0x2f')]:_0x2dcc4c[_0x3b50('0x2e')];if(_0x53fdd9['query'][_0x3b50('0x41')]){_0x57dfea['include']=[{'all':!![]}];}_0x57dfea=_[_0x3b50('0x38')]({},_0x57dfea,_0x53fdd9[_0x3b50('0x3b')]);return db[_0x3b50('0x3c')]['find'](_0x57dfea)[_0x3b50('0x1f')](handleEntityNotFound(_0x5f4445,null))['then'](respondWithResult(_0x5f4445,null))[_0x3b50('0x3e')](handleError(_0x5f4445,null));};exports['create']=function(_0x15db19,_0x2052b3){return db[_0x3b50('0x3c')][_0x3b50('0x42')](_0x15db19[_0x3b50('0x43')],{})[_0x3b50('0x1f')](respondWithResult(_0x2052b3,0xc9))[_0x3b50('0x3e')](handleError(_0x2052b3,null));};exports[_0x3b50('0x1e')]=function(_0x386bcd,_0x2d8d20){if(_0x386bcd[_0x3b50('0x43')]['id']){delete _0x386bcd['body']['id'];}return db[_0x3b50('0x3c')][_0x3b50('0x44')]({'where':{'id':_0x386bcd[_0x3b50('0x3f')]['id']}})[_0x3b50('0x1f')](handleEntityNotFound(_0x2d8d20,null))[_0x3b50('0x1f')](saveUpdates(_0x386bcd[_0x3b50('0x43')],null))[_0x3b50('0x1f')](respondWithResult(_0x2d8d20,null))[_0x3b50('0x3e')](handleError(_0x2d8d20,null));};exports[_0x3b50('0x20')]=function(_0x3866bc,_0x2281d2){return db[_0x3b50('0x3c')][_0x3b50('0x44')]({'where':{'id':_0x3866bc[_0x3b50('0x3f')]['id']}})[_0x3b50('0x1f')](handleEntityNotFound(_0x2281d2,null))['then'](removeEntity(_0x2281d2,null))[_0x3b50('0x3e')](handleError(_0x2281d2,null));};exports[_0x3b50('0x45')]=function(_0xec0f59,_0x25a511){return db[_0x3b50('0x3c')][_0x3b50('0x45')]()[_0x3b50('0x1f')](respondWithResult(_0x25a511,null))[_0x3b50('0x3e')](handleError(_0x25a511,null));}; \ No newline at end of file +var _0xbcaa=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcaa,0xbf));var _0xabca=function(_0x26dd21,_0x155b92){_0x26dd21=_0x26dd21-0x0;var _0x467436=_0xbcaa[_0x26dd21];return _0x467436;};'use strict';var emlformat=require(_0xabca('0x0'));var rimraf=require(_0xabca('0x1'));var zipdir=require(_0xabca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xabca('0x4'));var util=require(_0xabca('0x5'));var path=require(_0xabca('0x6'));var sox=require('sox');var csv=require(_0xabca('0x7'));var ejs=require(_0xabca('0x8'));var fs=require('fs');var fs_extra=require(_0xabca('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xabca('0xa'));var deskjs=require(_0xabca('0xb'));var toCsv=require(_0xabca('0x7'));var querystring=require(_0xabca('0xc'));var Papa=require(_0xabca('0xd'));var Redis=require(_0xabca('0xe'));var authService=require(_0xabca('0xf'));var qs=require(_0xabca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabca('0x11'));var logger=require(_0xabca('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xabca('0x13'));var licenseUtil=require(_0xabca('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f7202,_0x4b3d69){_0x4b3d69=_0x4b3d69||0xcc;return function(_0x44a03f){if(_0x44a03f){return _0x4f7202[_0xabca('0x15')](_0x4b3d69);}return _0x4f7202[_0xabca('0x16')](_0x4b3d69)[_0xabca('0x17')]();};}function respondWithResult(_0x2d1e2b,_0xc3e7d3){_0xc3e7d3=_0xc3e7d3||0xc8;return function(_0x48bc58){if(_0x48bc58){return _0x2d1e2b[_0xabca('0x16')](_0xc3e7d3)[_0xabca('0x18')](_0x48bc58);}};}function respondWithFilteredResult(_0x552d71,_0x18b5f8){return function(_0x3deeee){if(_0x3deeee){var _0x2ba07b=typeof _0x18b5f8[_0xabca('0x19')]===_0xabca('0x1a')&&typeof _0x18b5f8[_0xabca('0x1b')]===_0xabca('0x1a');var _0x9d7181=_0x3deeee[_0xabca('0x1c')];var _0x1b657c=_0x2ba07b?0x0:_0x18b5f8[_0xabca('0x19')];var _0x275c45=_0x2ba07b?_0x3deeee['count']:_0x18b5f8['offset']+_0x18b5f8[_0xabca('0x1b')];var _0x5b81e1;if(_0x275c45>=_0x9d7181){_0x275c45=_0x9d7181;_0x5b81e1=0xc8;}else{_0x5b81e1=0xce;}_0x552d71[_0xabca('0x16')](_0x5b81e1);return _0x552d71[_0xabca('0x1d')](_0xabca('0x1e'),_0x1b657c+'-'+_0x275c45+'/'+_0x9d7181)[_0xabca('0x18')](_0x3deeee);}return null;};}function patchUpdates(_0x1634e5){return function(_0x2fc546){try{jsonpatch['apply'](_0x2fc546,_0x1634e5,!![]);}catch(_0x21644f){return BPromise[_0xabca('0x1f')](_0x21644f);}return _0x2fc546['save']();};}function saveUpdates(_0xd78d41,_0xa7da90){return function(_0x56dd18){if(_0x56dd18){return _0x56dd18[_0xabca('0x20')](_0xd78d41)[_0xabca('0x21')](function(_0x54ff70){return _0x54ff70;});}return null;};}function removeEntity(_0x10fe4f,_0x4caedb){return function(_0x3f2c81){if(_0x3f2c81){return _0x3f2c81[_0xabca('0x22')]()[_0xabca('0x21')](function(){_0x10fe4f[_0xabca('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fe44,_0x13d252){return function(_0xbeae18){if(!_0xbeae18){_0x39fe44[_0xabca('0x15')](0x194);}return _0xbeae18;};}function handleError(_0x39d084,_0x2ee876){_0x2ee876=_0x2ee876||0x1f4;return function(_0x36c8ba){logger[_0xabca('0x23')](_0x36c8ba[_0xabca('0x24')]);if(_0x36c8ba[_0xabca('0x25')]){delete _0x36c8ba[_0xabca('0x25')];}_0x39d084[_0xabca('0x16')](_0x2ee876)[_0xabca('0x26')](_0x36c8ba);};}exports[_0xabca('0x27')]=function(_0x4719cb,_0x458b53){var _0x242d9a={},_0x1f1cf6={},_0x20a1fc={'count':0x0,'rows':[]};var _0x113bea=_['map'](db[_0xabca('0x28')][_0xabca('0x29')],function(_0x44b985){return{'name':_0x44b985[_0xabca('0x2a')],'type':_0x44b985[_0xabca('0x2b')][_0xabca('0x2c')]};});_0x1f1cf6[_0xabca('0x2d')]=_[_0xabca('0x2e')](_0x113bea,_0xabca('0x25'));_0x1f1cf6[_0xabca('0x2f')]=_[_0xabca('0x30')](_0x4719cb[_0xabca('0x2f')]);_0x1f1cf6[_0xabca('0x31')]=_[_0xabca('0x32')](_0x1f1cf6[_0xabca('0x2d')],_0x1f1cf6[_0xabca('0x2f')]);_0x242d9a['attributes']=_[_0xabca('0x32')](_0x1f1cf6['model'],qs[_0xabca('0x33')](_0x4719cb[_0xabca('0x2f')][_0xabca('0x33')]));_0x242d9a[_0xabca('0x34')]=_0x242d9a[_0xabca('0x34')][_0xabca('0x35')]?_0x242d9a[_0xabca('0x34')]:_0x1f1cf6['model'];if(!_0x4719cb[_0xabca('0x2f')]['hasOwnProperty'](_0xabca('0x36'))){_0x242d9a[_0xabca('0x1b')]=qs[_0xabca('0x1b')](_0x4719cb['query']['limit']);_0x242d9a[_0xabca('0x19')]=qs['offset'](_0x4719cb[_0xabca('0x2f')][_0xabca('0x19')]);}_0x242d9a[_0xabca('0x37')]=qs[_0xabca('0x38')](_0x4719cb['query'][_0xabca('0x38')]);_0x242d9a[_0xabca('0x39')]=qs[_0xabca('0x31')](_['pick'](_0x4719cb['query'],_0x1f1cf6['filters']),_0x113bea);if(_0x4719cb['query'][_0xabca('0x3a')]){_0x242d9a[_0xabca('0x39')]=_['merge'](_0x242d9a['where'],{'$or':_[_0xabca('0x2e')](_0x113bea,function(_0x49808f){if(_0x49808f[_0xabca('0x2b')]!==_0xabca('0x3b')){var _0x4371da={};_0x4371da[_0x49808f['name']]={'$like':'%'+_0x4719cb[_0xabca('0x2f')][_0xabca('0x3a')]+'%'};return _0x4371da;}})});}_0x242d9a=_[_0xabca('0x3c')]({},_0x242d9a,_0x4719cb[_0xabca('0x3d')]);var _0x5517ed={'where':_0x242d9a[_0xabca('0x39')]};return db[_0xabca('0x28')][_0xabca('0x1c')](_0x5517ed)[_0xabca('0x21')](function(_0x2d7579){_0x20a1fc[_0xabca('0x1c')]=_0x2d7579;if(_0x4719cb[_0xabca('0x2f')][_0xabca('0x3e')]){_0x242d9a[_0xabca('0x3f')]=[{'all':!![]}];}return db[_0xabca('0x28')]['findAll'](_0x242d9a);})[_0xabca('0x21')](function(_0x1f55e2){_0x20a1fc['rows']=_0x1f55e2;return _0x20a1fc;})[_0xabca('0x21')](respondWithFilteredResult(_0x458b53,_0x242d9a))[_0xabca('0x40')](handleError(_0x458b53,null));};exports[_0xabca('0x41')]=function(_0x43a8b3,_0x2c1785){var _0xe9aa10={'raw':!![],'where':{'id':_0x43a8b3[_0xabca('0x42')]['id']}},_0x214b71={};_0x214b71['model']=_['keys'](db[_0xabca('0x28')][_0xabca('0x29')]);_0x214b71[_0xabca('0x2f')]=_[_0xabca('0x30')](_0x43a8b3['query']);_0x214b71[_0xabca('0x31')]=_['intersection'](_0x214b71[_0xabca('0x2d')],_0x214b71[_0xabca('0x2f')]);_0xe9aa10[_0xabca('0x34')]=_[_0xabca('0x32')](_0x214b71[_0xabca('0x2d')],qs[_0xabca('0x33')](_0x43a8b3[_0xabca('0x2f')][_0xabca('0x33')]));_0xe9aa10[_0xabca('0x34')]=_0xe9aa10[_0xabca('0x34')][_0xabca('0x35')]?_0xe9aa10[_0xabca('0x34')]:_0x214b71['model'];if(_0x43a8b3[_0xabca('0x2f')][_0xabca('0x3e')]){_0xe9aa10[_0xabca('0x3f')]=[{'all':!![]}];}_0xe9aa10=_[_0xabca('0x3c')]({},_0xe9aa10,_0x43a8b3[_0xabca('0x3d')]);return db[_0xabca('0x28')][_0xabca('0x43')](_0xe9aa10)[_0xabca('0x21')](handleEntityNotFound(_0x2c1785,null))[_0xabca('0x21')](respondWithResult(_0x2c1785,null))['catch'](handleError(_0x2c1785,null));};exports[_0xabca('0x44')]=function(_0x41c60e,_0x3cc68b){return db[_0xabca('0x28')]['create'](_0x41c60e['body'],{})[_0xabca('0x21')](respondWithResult(_0x3cc68b,0xc9))[_0xabca('0x40')](handleError(_0x3cc68b,null));};exports[_0xabca('0x20')]=function(_0x3d92f5,_0x4e5350){if(_0x3d92f5['body']['id']){delete _0x3d92f5['body']['id'];}return db[_0xabca('0x28')][_0xabca('0x43')]({'where':{'id':_0x3d92f5['params']['id']}})['then'](handleEntityNotFound(_0x4e5350,null))[_0xabca('0x21')](saveUpdates(_0x3d92f5[_0xabca('0x45')],null))[_0xabca('0x21')](respondWithResult(_0x4e5350,null))[_0xabca('0x40')](handleError(_0x4e5350,null));};exports[_0xabca('0x22')]=function(_0x24f935,_0xb39ffd){return db[_0xabca('0x28')][_0xabca('0x43')]({'where':{'id':_0x24f935[_0xabca('0x42')]['id']}})[_0xabca('0x21')](handleEntityNotFound(_0xb39ffd,null))[_0xabca('0x21')](removeEntity(_0xb39ffd,null))[_0xabca('0x40')](handleError(_0xb39ffd,null));};exports['describe']=function(_0x2982fd,_0x4eae8f){return db['SmsQueueReport']['describe']()[_0xabca('0x21')](respondWithResult(_0x4eae8f,null))[_0xabca('0x40')](handleError(_0x4eae8f,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 3b3d09d..5ac617e 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x3ab928,_0x2b990b){var _0xf47692=function(_0x311b8e){while(--_0x311b8e){_0x3ab928['push'](_0x3ab928['shift']());}};_0xf47692(++_0x2b990b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x23b3ac,_0x3963ce){var _0xdcebe2=function(_0x364672){while(--_0x364672){_0x23b3ac['push'](_0x23b3ac['shift']());}};_0xdcebe2(++_0x3963ce);}(_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 16f7437..fae1be1 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 _0x2b2f=['SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','info','debug','UpdateSmsQueueReport','where','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x161c31,_0x2e3feb){var _0x5e7223=function(_0x2994f2){while(--_0x2994f2){_0x161c31['push'](_0x161c31['shift']());}};_0x5e7223(++_0x2e3feb);}(_0x2b2f,0xea));var _0xf2b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2b2f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf2b2('0x0'));var util=require(_0xf2b2('0x1'));var moment=require(_0xf2b2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2b2('0x3'));var db=require(_0xf2b2('0x4'))['db'];var utils=require(_0xf2b2('0x5'));var logger=require(_0xf2b2('0x6'))(_0xf2b2('0x7'));var config=require(_0xf2b2('0x8'));var jayson=require(_0xf2b2('0x9'));var client=jayson['client'][_0xf2b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x396a50,_0x1be206,_0x1a09b5){return new BPromise(function(_0x3bf7ee,_0x1475da){return client[_0xf2b2('0xb')](_0x396a50,_0x1a09b5)['then'](function(_0xb382b2){logger['info'](_0xf2b2('0xc'),_0x1be206,_0xf2b2('0xd'));logger['debug'](_0xf2b2('0xe'),_0x1be206,_0xf2b2('0xd'),JSON[_0xf2b2('0xf')](_0xb382b2));if(_0xb382b2[_0xf2b2('0x10')]){if(_0xb382b2[_0xf2b2('0x10')]['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x1be206,_0xb382b2[_0xf2b2('0x10')][_0xf2b2('0x11')]);return _0x1475da(_0xb382b2[_0xf2b2('0x10')][_0xf2b2('0x11')]);}logger[_0xf2b2('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x1be206,_0xb382b2[_0xf2b2('0x10')]['message']);return _0x3bf7ee(_0xb382b2[_0xf2b2('0x10')][_0xf2b2('0x11')]);}else{logger['info'](_0xf2b2('0xc'),_0x1be206,_0xf2b2('0xd'));_0x3bf7ee(_0xb382b2[_0xf2b2('0x12')][_0xf2b2('0x11')]);}})[_0xf2b2('0x13')](function(_0x3d46aa){logger[_0xf2b2('0x10')](_0xf2b2('0xc'),_0x1be206,_0x3d46aa);_0x1475da(_0x3d46aa);});});}exports[_0xf2b2('0x14')]=function(_0x41a621){var _0x192b58=this;return new Promise(function(_0x4a8b7c,_0x149832){return db[_0xf2b2('0x15')]['create'](_0x41a621[_0xf2b2('0x16')],{'raw':_0x41a621[_0xf2b2('0x17')]?_0x41a621[_0xf2b2('0x17')][_0xf2b2('0x18')]===undefined?!![]:![]:!![]})[_0xf2b2('0x19')](function(_0x43e0de){logger[_0xf2b2('0x1a')](_0xf2b2('0x14'),_0x41a621);logger[_0xf2b2('0x1b')](_0xf2b2('0x14'),_0x41a621,JSON['stringify'](_0x43e0de));_0x4a8b7c(_0x43e0de);})[_0xf2b2('0x13')](function(_0xc50e26){logger[_0xf2b2('0x10')](_0xf2b2('0x14'),_0xc50e26[_0xf2b2('0x11')],_0x41a621);_0x149832(_0x192b58['error'](0x1f4,_0xc50e26[_0xf2b2('0x11')]));});});};exports[_0xf2b2('0x1c')]=function(_0x2f5268){var _0x2d4de1=this;return new Promise(function(_0x4cd8b1,_0xeecdc8){return db[_0xf2b2('0x15')]['update'](_0x2f5268[_0xf2b2('0x16')],{'raw':_0x2f5268[_0xf2b2('0x17')]?_0x2f5268['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f5268[_0xf2b2('0x17')]?_0x2f5268[_0xf2b2('0x17')][_0xf2b2('0x1d')]||null:null,'attributes':_0x2f5268[_0xf2b2('0x17')]?_0x2f5268[_0xf2b2('0x17')]['attributes']||null:null,'limit':_0x2f5268[_0xf2b2('0x17')]?_0x2f5268[_0xf2b2('0x17')][_0xf2b2('0x1e')]||null:null})[_0xf2b2('0x19')](function(_0x13044e){logger['info'](_0xf2b2('0x1c'),_0x2f5268);logger['debug']('UpdateSmsQueueReport',_0x2f5268,JSON[_0xf2b2('0xf')](_0x13044e));_0x4cd8b1(_0x13044e);})['catch'](function(_0x50f655){logger['error'](_0xf2b2('0x1c'),_0x50f655[_0xf2b2('0x11')],_0x2f5268);_0xeecdc8(_0x2d4de1[_0xf2b2('0x10')](0x1f4,_0x50f655['message']));});});}; \ No newline at end of file +var _0xd42c=['jayson/promise','client','http','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','body','options','raw','info','UpdateSmsQueueReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x4e1584,_0x3e0d82){var _0x1f4d68=function(_0x58f59b){while(--_0x58f59b){_0x4e1584['push'](_0x4e1584['shift']());}};_0x1f4d68(++_0x3e0d82);}(_0xd42c,0x16c));var _0xcd42=function(_0x30868,_0x39793f){_0x30868=_0x30868-0x0;var _0x3ee1d4=_0xd42c[_0x30868];return _0x3ee1d4;};'use strict';var _=require('lodash');var util=require(_0xcd42('0x0'));var moment=require(_0xcd42('0x1'));var BPromise=require(_0xcd42('0x2'));var rs=require(_0xcd42('0x3'));var fs=require('fs');var Redis=require(_0xcd42('0x4'));var db=require(_0xcd42('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcd42('0x6'));var config=require(_0xcd42('0x7'));var jayson=require(_0xcd42('0x8'));var client=jayson[_0xcd42('0x9')][_0xcd42('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fe739,_0xb7d38e,_0x1cc5ef){return new BPromise(function(_0x444988,_0x36fdb0){return client['request'](_0x4fe739,_0x1cc5ef)[_0xcd42('0xb')](function(_0xe78fc7){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0xb7d38e,_0xcd42('0xc'));logger[_0xcd42('0xd')](_0xcd42('0xe'),_0xb7d38e,_0xcd42('0xc'),JSON[_0xcd42('0xf')](_0xe78fc7));if(_0xe78fc7['error']){if(_0xe78fc7['error'][_0xcd42('0x10')]===0x1f4){logger[_0xcd42('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0xb7d38e,_0xe78fc7[_0xcd42('0x11')]['message']);return _0x36fdb0(_0xe78fc7[_0xcd42('0x11')]['message']);}logger[_0xcd42('0x11')](_0xcd42('0x12'),_0xb7d38e,_0xe78fc7[_0xcd42('0x11')]['message']);return _0x444988(_0xe78fc7['error'][_0xcd42('0x13')]);}else{logger['info'](_0xcd42('0x12'),_0xb7d38e,_0xcd42('0xc'));_0x444988(_0xe78fc7[_0xcd42('0x14')][_0xcd42('0x13')]);}})[_0xcd42('0x15')](function(_0x1c8e91){logger[_0xcd42('0x11')](_0xcd42('0x12'),_0xb7d38e,_0x1c8e91);_0x36fdb0(_0x1c8e91);});});}exports[_0xcd42('0x16')]=function(_0x590817){var _0xbd50f3=this;return new Promise(function(_0x423be1,_0x2055a8){return db['SmsQueueReport']['create'](_0x590817[_0xcd42('0x17')],{'raw':_0x590817[_0xcd42('0x18')]?_0x590817['options'][_0xcd42('0x19')]===undefined?!![]:![]:!![]})[_0xcd42('0xb')](function(_0x3f7fc4){logger[_0xcd42('0x1a')](_0xcd42('0x16'),_0x590817);logger[_0xcd42('0xd')](_0xcd42('0x16'),_0x590817,JSON[_0xcd42('0xf')](_0x3f7fc4));_0x423be1(_0x3f7fc4);})[_0xcd42('0x15')](function(_0x27a750){logger[_0xcd42('0x11')](_0xcd42('0x16'),_0x27a750[_0xcd42('0x13')],_0x590817);_0x2055a8(_0xbd50f3[_0xcd42('0x11')](0x1f4,_0x27a750[_0xcd42('0x13')]));});});};exports[_0xcd42('0x1b')]=function(_0xbc1a28){var _0x1667ef=this;return new Promise(function(_0x5ca3d4,_0x46ac36){return db['SmsQueueReport']['update'](_0xbc1a28[_0xcd42('0x17')],{'raw':_0xbc1a28[_0xcd42('0x18')]?_0xbc1a28[_0xcd42('0x18')][_0xcd42('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbc1a28['options']?_0xbc1a28[_0xcd42('0x18')][_0xcd42('0x1c')]||null:null,'attributes':_0xbc1a28['options']?_0xbc1a28['options'][_0xcd42('0x1d')]||null:null,'limit':_0xbc1a28['options']?_0xbc1a28[_0xcd42('0x18')][_0xcd42('0x1e')]||null:null})['then'](function(_0x456885){logger[_0xcd42('0x1a')](_0xcd42('0x1b'),_0xbc1a28);logger[_0xcd42('0xd')]('UpdateSmsQueueReport',_0xbc1a28,JSON[_0xcd42('0xf')](_0x456885));_0x5ca3d4(_0x456885);})[_0xcd42('0x15')](function(_0x135bf7){logger[_0xcd42('0x11')](_0xcd42('0x1b'),_0x135bf7['message'],_0xbc1a28);_0x46ac36(_0x1667ef[_0xcd42('0x11')](0x1f4,_0x135bf7[_0xcd42('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 5b30c00..7879628 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 _0xf69d=['./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xf69d,0xd3));var _0xdf69=function(_0x34692e,_0x175b66){_0x34692e=_0x34692e-0x0;var _0x419da0=_0xf69d[_0x34692e];return _0x419da0;};'use strict';var multer=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var path=require(_0xdf69('0x2'));var timeout=require(_0xdf69('0x3'));var express=require(_0xdf69('0x4'));var router=express['Router']();var fs_extra=require(_0xdf69('0x5'));var auth=require(_0xdf69('0x6'));var interaction=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var controller=require(_0xdf69('0x9'));router[_0xdf69('0xa')]('/',auth[_0xdf69('0xb')](),controller[_0xdf69('0xc')]);router[_0xdf69('0xa')](_0xdf69('0xd'),auth[_0xdf69('0xb')](),controller[_0xdf69('0xe')]);router[_0xdf69('0xa')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x10')]);router[_0xdf69('0x11')]('/',auth['isAuthenticated'](),controller[_0xdf69('0x12')]);router[_0xdf69('0x13')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x14')]);router[_0xdf69('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5292=['../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','/describe','/:id','show','post','isAuthenticated','create','put','update','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x5c1924,_0x30eadf){var _0x53f845=function(_0x1be275){while(--_0x1be275){_0x5c1924['push'](_0x5c1924['shift']());}};_0x53f845(++_0x30eadf);}(_0x5292,0xf7));var _0x2529=function(_0x1d6dea,_0x1f8978){_0x1d6dea=_0x1d6dea-0x0;var _0x1b5967=_0x5292[_0x1d6dea];return _0x1b5967;};'use strict';var multer=require(_0x2529('0x0'));var util=require(_0x2529('0x1'));var path=require('path');var timeout=require(_0x2529('0x2'));var express=require('express');var router=express[_0x2529('0x3')]();var fs_extra=require(_0x2529('0x4'));var auth=require(_0x2529('0x5'));var interaction=require(_0x2529('0x6'));var config=require('../../config/environment');var controller=require(_0x2529('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2529('0x8')](_0x2529('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x2529('0x8')](_0x2529('0xa'),auth['isAuthenticated'](),controller[_0x2529('0xb')]);router[_0x2529('0xc')]('/',auth[_0x2529('0xd')](),controller[_0x2529('0xe')]);router[_0x2529('0xf')](_0x2529('0xa'),auth[_0x2529('0xd')](),controller[_0x2529('0x10')]);router['delete'](_0x2529('0xa'),auth[_0x2529('0xd')](),controller['destroy']);module[_0x2529('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 578e24c..bb813e9 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x33f1ec,_0x3116be){var _0x14e046=function(_0x4fd3cc){while(--_0x4fd3cc){_0x33f1ec['push'](_0x33f1ec['shift']());}};_0x14e046(++_0x3116be);}(_0xf4eb,0xec));var _0xbf4e=function(_0x53e66b,_0x269cb7){_0x53e66b=_0x53e66b-0x0;var _0x27347f=_0xf4eb[_0x53e66b];return _0x27347f;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xe1d065,_0x39ab64){var _0x481700=function(_0x34947a){while(--_0x34947a){_0xe1d065['push'](_0xe1d065['shift']());}};_0x481700(++_0x39ab64);}(_0x34e8,0x12c));var _0x834e=function(_0x55e728,_0x2ec3bb){_0x55e728=_0x55e728-0x0;var _0x41c95f=_0x34e8[_0x55e728];return _0x41c95f;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 8188977..3ed3567 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 _0x2d5d=['includeAll','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','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/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys'];(function(_0x596f51,_0x300f6d){var _0x325124=function(_0x264957){while(--_0x264957){_0x596f51['push'](_0x596f51['shift']());}};_0x325124(++_0x300f6d);}(_0x2d5d,0x1da));var _0xd2d5=function(_0x49f89a,_0x13a407){_0x49f89a=_0x49f89a-0x0;var _0x2d1b6d=_0x2d5d[_0x49f89a];return _0x2d1b6d;};'use strict';var emlformat=require(_0xd2d5('0x0'));var rimraf=require(_0xd2d5('0x1'));var zipdir=require(_0xd2d5('0x2'));var jsonpatch=require(_0xd2d5('0x3'));var rp=require('request-promise');var moment=require(_0xd2d5('0x4'));var BPromise=require(_0xd2d5('0x5'));var Mustache=require('mustache');var util=require(_0xd2d5('0x6'));var path=require(_0xd2d5('0x7'));var sox=require('sox');var csv=require(_0xd2d5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd2d5('0x9'));var _=require(_0xd2d5('0xa'));var squel=require(_0xd2d5('0xb'));var crypto=require(_0xd2d5('0xc'));var jsforce=require(_0xd2d5('0xd'));var deskjs=require(_0xd2d5('0xe'));var toCsv=require(_0xd2d5('0x8'));var querystring=require(_0xd2d5('0xf'));var Papa=require(_0xd2d5('0x10'));var Redis=require(_0xd2d5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd2d5('0x12'));var as=require(_0xd2d5('0x13'));var hardwareService=require(_0xd2d5('0x14'));var logger=require(_0xd2d5('0x15'))(_0xd2d5('0x16'));var utils=require(_0xd2d5('0x17'));var config=require(_0xd2d5('0x18'));var licenseUtil=require(_0xd2d5('0x19'));var db=require(_0xd2d5('0x1a'))['db'];function respondWithStatusCode(_0x7f1d5,_0x2889e8){_0x2889e8=_0x2889e8||0xcc;return function(_0x441de0){if(_0x441de0){return _0x7f1d5['sendStatus'](_0x2889e8);}return _0x7f1d5[_0xd2d5('0x1b')](_0x2889e8)['end']();};}function respondWithResult(_0x47cac5,_0x280ac7){_0x280ac7=_0x280ac7||0xc8;return function(_0x555d05){if(_0x555d05){return _0x47cac5['status'](_0x280ac7)[_0xd2d5('0x1c')](_0x555d05);}};}function respondWithFilteredResult(_0x48a5cf,_0x4d2f85){return function(_0x44c506){if(_0x44c506){var _0x2d0c4c=typeof _0x4d2f85[_0xd2d5('0x1d')]===_0xd2d5('0x1e')&&typeof _0x4d2f85[_0xd2d5('0x1f')]===_0xd2d5('0x1e');var _0x34a494=_0x44c506[_0xd2d5('0x20')];var _0xb80712=_0x2d0c4c?0x0:_0x4d2f85[_0xd2d5('0x1d')];var _0x5585fd=_0x2d0c4c?_0x44c506[_0xd2d5('0x20')]:_0x4d2f85[_0xd2d5('0x1d')]+_0x4d2f85[_0xd2d5('0x1f')];var _0x34b4ce;if(_0x5585fd>=_0x34a494){_0x5585fd=_0x34a494;_0x34b4ce=0xc8;}else{_0x34b4ce=0xce;}_0x48a5cf[_0xd2d5('0x1b')](_0x34b4ce);return _0x48a5cf[_0xd2d5('0x21')](_0xd2d5('0x22'),_0xb80712+'-'+_0x5585fd+'/'+_0x34a494)['json'](_0x44c506);}return null;};}function patchUpdates(_0xd1c201){return function(_0x3056bc){try{jsonpatch[_0xd2d5('0x23')](_0x3056bc,_0xd1c201,!![]);}catch(_0x136080){return BPromise['reject'](_0x136080);}return _0x3056bc[_0xd2d5('0x24')]();};}function saveUpdates(_0x223d32,_0x11b98b){return function(_0x3f59e6){if(_0x3f59e6){return _0x3f59e6[_0xd2d5('0x25')](_0x223d32)[_0xd2d5('0x26')](function(_0x3bb7b6){return _0x3bb7b6;});}return null;};}function removeEntity(_0x5bdbb5,_0x3cd2b7){return function(_0x474d86){if(_0x474d86){return _0x474d86['destroy']()[_0xd2d5('0x26')](function(){_0x5bdbb5[_0xd2d5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27c058,_0x6e399c){return function(_0x4835ed){if(!_0x4835ed){_0x27c058[_0xd2d5('0x27')](0x194);}return _0x4835ed;};}function handleError(_0x34347c,_0x29686e){_0x29686e=_0x29686e||0x1f4;return function(_0x26852d){logger['error'](_0x26852d[_0xd2d5('0x28')]);if(_0x26852d[_0xd2d5('0x29')]){delete _0x26852d[_0xd2d5('0x29')];}_0x34347c[_0xd2d5('0x1b')](_0x29686e)[_0xd2d5('0x2a')](_0x26852d);};}exports[_0xd2d5('0x2b')]=function(_0x522f1f,_0x347540){var _0x1de1a8={},_0x2fa148={},_0x232d84={'count':0x0,'rows':[]};var _0x5cdb58=_[_0xd2d5('0x2c')](db[_0xd2d5('0x2d')][_0xd2d5('0x2e')],function(_0x1fd1c0){return{'name':_0x1fd1c0['fieldName'],'type':_0x1fd1c0[_0xd2d5('0x2f')][_0xd2d5('0x30')]};});_0x2fa148[_0xd2d5('0x31')]=_[_0xd2d5('0x2c')](_0x5cdb58,_0xd2d5('0x29'));_0x2fa148[_0xd2d5('0x32')]=_['keys'](_0x522f1f[_0xd2d5('0x32')]);_0x2fa148[_0xd2d5('0x33')]=_[_0xd2d5('0x34')](_0x2fa148[_0xd2d5('0x31')],_0x2fa148['query']);_0x1de1a8[_0xd2d5('0x35')]=_['intersection'](_0x2fa148[_0xd2d5('0x31')],qs[_0xd2d5('0x36')](_0x522f1f[_0xd2d5('0x32')][_0xd2d5('0x36')]));_0x1de1a8[_0xd2d5('0x35')]=_0x1de1a8[_0xd2d5('0x35')][_0xd2d5('0x37')]?_0x1de1a8[_0xd2d5('0x35')]:_0x2fa148[_0xd2d5('0x31')];if(!_0x522f1f[_0xd2d5('0x32')][_0xd2d5('0x38')](_0xd2d5('0x39'))){_0x1de1a8[_0xd2d5('0x1f')]=qs[_0xd2d5('0x1f')](_0x522f1f['query'][_0xd2d5('0x1f')]);_0x1de1a8['offset']=qs[_0xd2d5('0x1d')](_0x522f1f[_0xd2d5('0x32')]['offset']);}_0x1de1a8[_0xd2d5('0x3a')]=qs[_0xd2d5('0x3b')](_0x522f1f[_0xd2d5('0x32')][_0xd2d5('0x3b')]);_0x1de1a8[_0xd2d5('0x3c')]=qs[_0xd2d5('0x33')](_[_0xd2d5('0x3d')](_0x522f1f[_0xd2d5('0x32')],_0x2fa148[_0xd2d5('0x33')]),_0x5cdb58);if(_0x522f1f[_0xd2d5('0x32')][_0xd2d5('0x3e')]){_0x1de1a8['where']=_[_0xd2d5('0x3f')](_0x1de1a8[_0xd2d5('0x3c')],{'$or':_[_0xd2d5('0x2c')](_0x5cdb58,function(_0x5216ec){if(_0x5216ec['type']!==_0xd2d5('0x40')){var _0x2b99c7={};_0x2b99c7[_0x5216ec['name']]={'$like':'%'+_0x522f1f[_0xd2d5('0x32')][_0xd2d5('0x3e')]+'%'};return _0x2b99c7;}})});}_0x1de1a8=_[_0xd2d5('0x3f')]({},_0x1de1a8,_0x522f1f[_0xd2d5('0x41')]);var _0xa41aee={'where':_0x1de1a8[_0xd2d5('0x3c')]};return db[_0xd2d5('0x2d')][_0xd2d5('0x20')](_0xa41aee)['then'](function(_0x396478){_0x232d84['count']=_0x396478;if(_0x522f1f[_0xd2d5('0x32')]['includeAll']){_0x1de1a8['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0xd2d5('0x42')](_0x1de1a8);})[_0xd2d5('0x26')](function(_0x2bc05a){_0x232d84[_0xd2d5('0x43')]=_0x2bc05a;return _0x232d84;})['then'](respondWithFilteredResult(_0x347540,_0x1de1a8))[_0xd2d5('0x44')](handleError(_0x347540,null));};exports[_0xd2d5('0x45')]=function(_0x443c3f,_0x1bcbdc){var _0xbec0b5={'raw':!![],'where':{'id':_0x443c3f[_0xd2d5('0x46')]['id']}},_0x40448c={};_0x40448c['model']=_[_0xd2d5('0x47')](db[_0xd2d5('0x2d')][_0xd2d5('0x2e')]);_0x40448c['query']=_['keys'](_0x443c3f[_0xd2d5('0x32')]);_0x40448c[_0xd2d5('0x33')]=_[_0xd2d5('0x34')](_0x40448c[_0xd2d5('0x31')],_0x40448c[_0xd2d5('0x32')]);_0xbec0b5[_0xd2d5('0x35')]=_[_0xd2d5('0x34')](_0x40448c[_0xd2d5('0x31')],qs[_0xd2d5('0x36')](_0x443c3f[_0xd2d5('0x32')][_0xd2d5('0x36')]));_0xbec0b5[_0xd2d5('0x35')]=_0xbec0b5[_0xd2d5('0x35')][_0xd2d5('0x37')]?_0xbec0b5['attributes']:_0x40448c[_0xd2d5('0x31')];if(_0x443c3f[_0xd2d5('0x32')][_0xd2d5('0x48')]){_0xbec0b5[_0xd2d5('0x49')]=[{'all':!![]}];}_0xbec0b5=_['merge']({},_0xbec0b5,_0x443c3f[_0xd2d5('0x41')]);return db['SmsTransferReport']['find'](_0xbec0b5)[_0xd2d5('0x26')](handleEntityNotFound(_0x1bcbdc,null))[_0xd2d5('0x26')](respondWithResult(_0x1bcbdc,null))[_0xd2d5('0x44')](handleError(_0x1bcbdc,null));};exports[_0xd2d5('0x4a')]=function(_0x3830e3,_0xcbdd80){return db[_0xd2d5('0x2d')][_0xd2d5('0x4a')](_0x3830e3[_0xd2d5('0x4b')],{})['then'](respondWithResult(_0xcbdd80,0xc9))[_0xd2d5('0x44')](handleError(_0xcbdd80,null));};exports['update']=function(_0x519137,_0x312533){if(_0x519137[_0xd2d5('0x4b')]['id']){delete _0x519137[_0xd2d5('0x4b')]['id'];}return db[_0xd2d5('0x2d')][_0xd2d5('0x4c')]({'where':{'id':_0x519137[_0xd2d5('0x46')]['id']}})['then'](handleEntityNotFound(_0x312533,null))['then'](saveUpdates(_0x519137[_0xd2d5('0x4b')],null))[_0xd2d5('0x26')](respondWithResult(_0x312533,null))['catch'](handleError(_0x312533,null));};exports['destroy']=function(_0x830304,_0x1a6815){return db[_0xd2d5('0x2d')][_0xd2d5('0x4c')]({'where':{'id':_0x830304[_0xd2d5('0x46')]['id']}})[_0xd2d5('0x26')](handleEntityNotFound(_0x1a6815,null))[_0xd2d5('0x26')](removeEntity(_0x1a6815,null))[_0xd2d5('0x44')](handleError(_0x1a6815,null));};exports[_0xd2d5('0x4d')]=function(_0x273958,_0x473720){return db[_0xd2d5('0x2d')]['describe']()[_0xd2d5('0x26')](respondWithResult(_0x473720,null))[_0xd2d5('0x44')](handleError(_0x473720,null));}; \ No newline at end of file +var _0x6f00=['undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','where','type','filter','merge','options','SmsTransferReport','includeAll','include','rows','show','find','create','catch','update','params','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x46d52f,_0x5a4398){var _0x1e96c0=function(_0x3fb443){while(--_0x3fb443){_0x46d52f['push'](_0x46d52f['shift']());}};_0x1e96c0(++_0x5a4398);}(_0x6f00,0x1b6));var _0x06f0=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x6f00[_0x54d4fe];return _0x1ab5bb;};'use strict';var emlformat=require(_0x06f0('0x0'));var rimraf=require(_0x06f0('0x1'));var zipdir=require(_0x06f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06f0('0x3'));var moment=require(_0x06f0('0x4'));var BPromise=require(_0x06f0('0x5'));var Mustache=require(_0x06f0('0x6'));var util=require(_0x06f0('0x7'));var path=require('path');var sox=require(_0x06f0('0x8'));var csv=require(_0x06f0('0x9'));var ejs=require(_0x06f0('0xa'));var fs=require('fs');var fs_extra=require(_0x06f0('0xb'));var _=require(_0x06f0('0xc'));var squel=require(_0x06f0('0xd'));var crypto=require('crypto');var jsforce=require(_0x06f0('0xe'));var deskjs=require(_0x06f0('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x06f0('0x10'));var Redis=require('ioredis');var authService=require(_0x06f0('0x11'));var qs=require(_0x06f0('0x12'));var as=require(_0x06f0('0x13'));var hardwareService=require(_0x06f0('0x14'));var logger=require('../../config/logger')(_0x06f0('0x15'));var utils=require(_0x06f0('0x16'));var config=require(_0x06f0('0x17'));var licenseUtil=require(_0x06f0('0x18'));var db=require(_0x06f0('0x19'))['db'];function respondWithStatusCode(_0x1a2fa1,_0x44fc17){_0x44fc17=_0x44fc17||0xcc;return function(_0xd408c8){if(_0xd408c8){return _0x1a2fa1[_0x06f0('0x1a')](_0x44fc17);}return _0x1a2fa1[_0x06f0('0x1b')](_0x44fc17)[_0x06f0('0x1c')]();};}function respondWithResult(_0x538503,_0x2c13e5){_0x2c13e5=_0x2c13e5||0xc8;return function(_0x39fe04){if(_0x39fe04){return _0x538503[_0x06f0('0x1b')](_0x2c13e5)[_0x06f0('0x1d')](_0x39fe04);}};}function respondWithFilteredResult(_0x39342e,_0x3c127b){return function(_0x46186f){if(_0x46186f){var _0x159a7b=typeof _0x3c127b['offset']===_0x06f0('0x1e')&&typeof _0x3c127b[_0x06f0('0x1f')]===_0x06f0('0x1e');var _0x1f98f8=_0x46186f['count'];var _0xaab89c=_0x159a7b?0x0:_0x3c127b[_0x06f0('0x20')];var _0x2c79af=_0x159a7b?_0x46186f[_0x06f0('0x21')]:_0x3c127b[_0x06f0('0x20')]+_0x3c127b[_0x06f0('0x1f')];var _0x122a0f;if(_0x2c79af>=_0x1f98f8){_0x2c79af=_0x1f98f8;_0x122a0f=0xc8;}else{_0x122a0f=0xce;}_0x39342e[_0x06f0('0x1b')](_0x122a0f);return _0x39342e[_0x06f0('0x22')](_0x06f0('0x23'),_0xaab89c+'-'+_0x2c79af+'/'+_0x1f98f8)[_0x06f0('0x1d')](_0x46186f);}return null;};}function patchUpdates(_0x16caa4){return function(_0x51844b){try{jsonpatch[_0x06f0('0x24')](_0x51844b,_0x16caa4,!![]);}catch(_0x1c01d8){return BPromise[_0x06f0('0x25')](_0x1c01d8);}return _0x51844b[_0x06f0('0x26')]();};}function saveUpdates(_0x549f8e,_0x557ae0){return function(_0x20c718){if(_0x20c718){return _0x20c718['update'](_0x549f8e)[_0x06f0('0x27')](function(_0x5e7bc7){return _0x5e7bc7;});}return null;};}function removeEntity(_0x2e7b23,_0x70f318){return function(_0x162157){if(_0x162157){return _0x162157[_0x06f0('0x28')]()[_0x06f0('0x27')](function(){_0x2e7b23[_0x06f0('0x1b')](0xcc)[_0x06f0('0x1c')]();});}};}function handleEntityNotFound(_0x123aa2,_0x4b751f){return function(_0x205cab){if(!_0x205cab){_0x123aa2[_0x06f0('0x1a')](0x194);}return _0x205cab;};}function handleError(_0x157ac5,_0x97c325){_0x97c325=_0x97c325||0x1f4;return function(_0x42b172){logger[_0x06f0('0x29')](_0x42b172[_0x06f0('0x2a')]);if(_0x42b172[_0x06f0('0x2b')]){delete _0x42b172[_0x06f0('0x2b')];}_0x157ac5[_0x06f0('0x1b')](_0x97c325)[_0x06f0('0x2c')](_0x42b172);};}exports[_0x06f0('0x2d')]=function(_0x138da4,_0x53ae2f){var _0x4619e9={},_0x18f3a2={},_0x6a5466={'count':0x0,'rows':[]};var _0x422185=_[_0x06f0('0x2e')](db['SmsTransferReport'][_0x06f0('0x2f')],function(_0x14d8a6){return{'name':_0x14d8a6['fieldName'],'type':_0x14d8a6['type'][_0x06f0('0x30')]};});_0x18f3a2['model']=_[_0x06f0('0x2e')](_0x422185,_0x06f0('0x2b'));_0x18f3a2[_0x06f0('0x31')]=_[_0x06f0('0x32')](_0x138da4[_0x06f0('0x31')]);_0x18f3a2[_0x06f0('0x33')]=_[_0x06f0('0x34')](_0x18f3a2['model'],_0x18f3a2[_0x06f0('0x31')]);_0x4619e9[_0x06f0('0x35')]=_[_0x06f0('0x34')](_0x18f3a2[_0x06f0('0x36')],qs['fields'](_0x138da4[_0x06f0('0x31')][_0x06f0('0x37')]));_0x4619e9[_0x06f0('0x35')]=_0x4619e9['attributes'][_0x06f0('0x38')]?_0x4619e9[_0x06f0('0x35')]:_0x18f3a2[_0x06f0('0x36')];if(!_0x138da4[_0x06f0('0x31')][_0x06f0('0x39')]('nolimit')){_0x4619e9[_0x06f0('0x1f')]=qs[_0x06f0('0x1f')](_0x138da4['query']['limit']);_0x4619e9[_0x06f0('0x20')]=qs[_0x06f0('0x20')](_0x138da4['query']['offset']);}_0x4619e9[_0x06f0('0x3a')]=qs[_0x06f0('0x3b')](_0x138da4['query'][_0x06f0('0x3b')]);_0x4619e9['where']=qs['filters'](_[_0x06f0('0x3c')](_0x138da4[_0x06f0('0x31')],_0x18f3a2[_0x06f0('0x33')]),_0x422185);if(_0x138da4[_0x06f0('0x31')]['filter']){_0x4619e9[_0x06f0('0x3d')]=_['merge'](_0x4619e9[_0x06f0('0x3d')],{'$or':_['map'](_0x422185,function(_0x3a2fbc){if(_0x3a2fbc[_0x06f0('0x3e')]!=='VIRTUAL'){var _0x4e7a05={};_0x4e7a05[_0x3a2fbc[_0x06f0('0x2b')]]={'$like':'%'+_0x138da4[_0x06f0('0x31')][_0x06f0('0x3f')]+'%'};return _0x4e7a05;}})});}_0x4619e9=_[_0x06f0('0x40')]({},_0x4619e9,_0x138da4[_0x06f0('0x41')]);var _0x18fd8d={'where':_0x4619e9[_0x06f0('0x3d')]};return db[_0x06f0('0x42')]['count'](_0x18fd8d)[_0x06f0('0x27')](function(_0x1c7236){_0x6a5466[_0x06f0('0x21')]=_0x1c7236;if(_0x138da4['query'][_0x06f0('0x43')]){_0x4619e9[_0x06f0('0x44')]=[{'all':!![]}];}return db[_0x06f0('0x42')]['findAll'](_0x4619e9);})[_0x06f0('0x27')](function(_0x36ebcd){_0x6a5466[_0x06f0('0x45')]=_0x36ebcd;return _0x6a5466;})[_0x06f0('0x27')](respondWithFilteredResult(_0x53ae2f,_0x4619e9))['catch'](handleError(_0x53ae2f,null));};exports[_0x06f0('0x46')]=function(_0x4157c4,_0x3efb8f){var _0x139067={'raw':!![],'where':{'id':_0x4157c4['params']['id']}},_0x4ff20b={};_0x4ff20b['model']=_['keys'](db[_0x06f0('0x42')][_0x06f0('0x2f')]);_0x4ff20b[_0x06f0('0x31')]=_[_0x06f0('0x32')](_0x4157c4['query']);_0x4ff20b['filters']=_[_0x06f0('0x34')](_0x4ff20b['model'],_0x4ff20b['query']);_0x139067[_0x06f0('0x35')]=_[_0x06f0('0x34')](_0x4ff20b['model'],qs[_0x06f0('0x37')](_0x4157c4[_0x06f0('0x31')][_0x06f0('0x37')]));_0x139067[_0x06f0('0x35')]=_0x139067[_0x06f0('0x35')][_0x06f0('0x38')]?_0x139067[_0x06f0('0x35')]:_0x4ff20b[_0x06f0('0x36')];if(_0x4157c4[_0x06f0('0x31')][_0x06f0('0x43')]){_0x139067[_0x06f0('0x44')]=[{'all':!![]}];}_0x139067=_[_0x06f0('0x40')]({},_0x139067,_0x4157c4['options']);return db[_0x06f0('0x42')][_0x06f0('0x47')](_0x139067)[_0x06f0('0x27')](handleEntityNotFound(_0x3efb8f,null))[_0x06f0('0x27')](respondWithResult(_0x3efb8f,null))['catch'](handleError(_0x3efb8f,null));};exports['create']=function(_0x205cea,_0x4e8d2e){return db[_0x06f0('0x42')][_0x06f0('0x48')](_0x205cea['body'],{})[_0x06f0('0x27')](respondWithResult(_0x4e8d2e,0xc9))[_0x06f0('0x49')](handleError(_0x4e8d2e,null));};exports[_0x06f0('0x4a')]=function(_0x5b639b,_0x9ad8da){if(_0x5b639b['body']['id']){delete _0x5b639b['body']['id'];}return db[_0x06f0('0x42')][_0x06f0('0x47')]({'where':{'id':_0x5b639b[_0x06f0('0x4b')]['id']}})[_0x06f0('0x27')](handleEntityNotFound(_0x9ad8da,null))['then'](saveUpdates(_0x5b639b[_0x06f0('0x4c')],null))[_0x06f0('0x27')](respondWithResult(_0x9ad8da,null))['catch'](handleError(_0x9ad8da,null));};exports[_0x06f0('0x28')]=function(_0x196f1e,_0x58cbd5){return db['SmsTransferReport']['find']({'where':{'id':_0x196f1e[_0x06f0('0x4b')]['id']}})[_0x06f0('0x27')](handleEntityNotFound(_0x58cbd5,null))[_0x06f0('0x27')](removeEntity(_0x58cbd5,null))[_0x06f0('0x49')](handleError(_0x58cbd5,null));};exports['describe']=function(_0x186864,_0x5dc518){return db[_0x06f0('0x42')][_0x06f0('0x4d')]()['then'](respondWithResult(_0x5dc518,null))[_0x06f0('0x49')](handleError(_0x5dc518,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d5706b0..1a87292 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 _0xaeaf=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x3203c3,_0xad2917){var _0x4646ac=function(_0x512a82){while(--_0x512a82){_0x3203c3['push'](_0x3203c3['shift']());}};_0x4646ac(++_0xad2917);}(_0xaeaf,0x14e));var _0xfaea=function(_0x3df822,_0x299495){_0x3df822=_0x3df822-0x0;var _0x4e457d=_0xaeaf[_0x3df822];return _0x4e457d;};'use strict';var _=require(_0xfaea('0x0'));var util=require(_0xfaea('0x1'));var logger=require(_0xfaea('0x2'))(_0xfaea('0x3'));var moment=require(_0xfaea('0x4'));var BPromise=require(_0xfaea('0x5'));var rp=require(_0xfaea('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfaea('0x7'));var config=require(_0xfaea('0x8'));var attributes=require(_0xfaea('0x9'));module[_0xfaea('0xa')]=function(_0x4b2303,_0x30cfb6){return _0x4b2303[_0xfaea('0xb')](_0xfaea('0xc'),attributes,{'tableName':_0xfaea('0xd'),'paranoid':![],'indexes':[{'name':_0xfaea('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4b8=['./smsTransferReport.attributes','exports','SmsTransferReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x367589,_0x2ab170){var _0x539c06=function(_0x49149f){while(--_0x49149f){_0x367589['push'](_0x367589['shift']());}};_0x539c06(++_0x2ab170);}(_0xe4b8,0x179));var _0x8e4b=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xe4b8[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x8e4b('0x0'));var util=require(_0x8e4b('0x1'));var logger=require(_0x8e4b('0x2'))(_0x8e4b('0x3'));var moment=require(_0x8e4b('0x4'));var BPromise=require(_0x8e4b('0x5'));var rp=require(_0x8e4b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8e4b('0x7'));var attributes=require(_0x8e4b('0x8'));module[_0x8e4b('0x9')]=function(_0x47e630,_0x2796f8){return _0x47e630['define'](_0x8e4b('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 7391857..50a52a8 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 _0x1670=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x1670,0x9a));var _0x0167=function(_0x4c1711,_0x2f49ce){_0x4c1711=_0x4c1711-0x0;var _0x3de6eb=_0x1670[_0x4c1711];return _0x3de6eb;};'use strict';var _=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var moment=require('moment');var BPromise=require(_0x0167('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0167('0x3'));var db=require(_0x0167('0x4'))['db'];var utils=require(_0x0167('0x5'));var logger=require(_0x0167('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0167('0x7'));var client=jayson[_0x0167('0x8')][_0x0167('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e1507,_0x2120f2,_0x149956){return new BPromise(function(_0xcdfc5,_0x416079){return client['request'](_0x3e1507,_0x149956)['then'](function(_0x146dad){logger[_0x0167('0xa')](_0x0167('0xb'),_0x2120f2,_0x0167('0xc'));logger[_0x0167('0xd')](_0x0167('0xe'),_0x2120f2,_0x0167('0xc'),JSON[_0x0167('0xf')](_0x146dad));if(_0x146dad[_0x0167('0x10')]){if(_0x146dad[_0x0167('0x10')][_0x0167('0x11')]===0x1f4){logger[_0x0167('0x10')](_0x0167('0xb'),_0x2120f2,_0x146dad[_0x0167('0x10')]['message']);return _0x416079(_0x146dad[_0x0167('0x10')]['message']);}logger[_0x0167('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x2120f2,_0x146dad[_0x0167('0x10')][_0x0167('0x12')]);return _0xcdfc5(_0x146dad[_0x0167('0x10')]['message']);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x2120f2,_0x0167('0xc'));_0xcdfc5(_0x146dad[_0x0167('0x13')]['message']);}})[_0x0167('0x14')](function(_0x498cd2){logger['error'](_0x0167('0xb'),_0x2120f2,_0x498cd2);_0x416079(_0x498cd2);});});} \ No newline at end of file +var _0x33c5=['then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x33c5,0xe6));var _0x533c=function(_0x45adb4,_0x2abb06){_0x45adb4=_0x45adb4-0x0;var _0x137296=_0x33c5[_0x45adb4];return _0x137296;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){return client[_0x533c('0xb')](_0x34ca89,_0x3a009b)[_0x533c('0xc')](function(_0x46536d){logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));logger[_0x533c('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1699d5,_0x533c('0xf'),JSON[_0x533c('0x11')](_0x46536d));if(_0x46536d[_0x533c('0x12')]){if(_0x46536d[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x2c297c(_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x36d74e(_0x46536d['error'][_0x533c('0x14')]);}else{logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));_0x36d74e(_0x46536d['result'][_0x533c('0x14')]);}})[_0x533c('0x15')](function(_0x41e22c){logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x41e22c);_0x2c297c(_0x41e22c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index bc1b7f5..1f56e6a 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 _0xc107=['basename','extname','now','post','single','update','delete','multer','path','connect-timeout','express','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xc107,0x159));var _0x7c10=function(_0x48e8ad,_0x55b864){_0x48e8ad=_0x48e8ad-0x0;var _0x21bbde=_0xc107[_0x48e8ad];return _0x21bbde;};'use strict';var multer=require(_0x7c10('0x0'));var util=require('util');var path=require(_0x7c10('0x1'));var timeout=require(_0x7c10('0x2'));var express=require(_0x7c10('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7c10('0x4'));var config=require('../../config/environment');var controller=require(_0x7c10('0x5'));router[_0x7c10('0x6')]('/',auth[_0x7c10('0x7')](),controller[_0x7c10('0x8')]);router[_0x7c10('0x6')](_0x7c10('0x9'),auth[_0x7c10('0x7')](),controller[_0x7c10('0xa')]);router['get'](_0x7c10('0xb'),auth['isAuthenticated'](),controller[_0x7c10('0xc')]);var upload=multer({'storage':multer[_0x7c10('0xd')]({'destination':function(_0x301855,_0x15ca84,_0x1a85e2){_0x1a85e2(null,path[_0x7c10('0xe')](config[_0x7c10('0xf')],_0x7c10('0x10')));},'filename':function(_0x1b90cf,_0x27f10c,_0x5307ae){_0x27f10c[_0x7c10('0x11')]=_0x27f10c[_0x7c10('0x11')][_0x7c10('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5307ae(null,util['format']('%s-%s%s',path[_0x7c10('0x13')](_0x27f10c[_0x7c10('0x11')],path[_0x7c10('0x14')](_0x27f10c['originalname'])),Date[_0x7c10('0x15')](),path[_0x7c10('0x14')](_0x27f10c[_0x7c10('0x11')])));}})});router[_0x7c10('0x16')]('/',upload[_0x7c10('0x17')]('file'),controller['create']);router['put']('/:id',auth[_0x7c10('0x7')](),controller[_0x7c10('0x18')]);router[_0x7c10('0x19')]('/:id',auth[_0x7c10('0x7')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xdc2c=['post','single','file','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','basename','extname','now'];(function(_0x2f7f74,_0x622553){var _0x38cf34=function(_0x53361f){while(--_0x53361f){_0x2f7f74['push'](_0x2f7f74['shift']());}};_0x38cf34(++_0x622553);}(_0xdc2c,0x11d));var _0xcdc2=function(_0x4b5a95,_0x10eb5e){_0x4b5a95=_0x4b5a95-0x0;var _0x9540dc=_0xdc2c[_0x4b5a95];return _0x9540dc;};'use strict';var multer=require(_0xcdc2('0x0'));var util=require(_0xcdc2('0x1'));var path=require(_0xcdc2('0x2'));var timeout=require(_0xcdc2('0x3'));var express=require(_0xcdc2('0x4'));var router=express[_0xcdc2('0x5')]();var fs_extra=require(_0xcdc2('0x6'));var auth=require(_0xcdc2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcdc2('0x8'));var controller=require(_0xcdc2('0x9'));router[_0xcdc2('0xa')]('/',auth[_0xcdc2('0xb')](),controller[_0xcdc2('0xc')]);router[_0xcdc2('0xa')](_0xcdc2('0xd'),auth['isAuthenticated'](),controller[_0xcdc2('0xe')]);router[_0xcdc2('0xa')](_0xcdc2('0xf'),auth[_0xcdc2('0xb')](),controller[_0xcdc2('0x10')]);var upload=multer({'storage':multer[_0xcdc2('0x11')]({'destination':function(_0x37f951,_0xd405b6,_0x331428){_0x331428(null,path[_0xcdc2('0x12')](config[_0xcdc2('0x13')],'server/files/sounds/original/'));},'filename':function(_0x265661,_0x10eb77,_0x66fda9){_0x10eb77[_0xcdc2('0x14')]=_0x10eb77[_0xcdc2('0x14')][_0xcdc2('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x66fda9(null,util['format']('%s-%s%s',path[_0xcdc2('0x16')](_0x10eb77[_0xcdc2('0x14')],path[_0xcdc2('0x17')](_0x10eb77['originalname'])),Date[_0xcdc2('0x18')](),path[_0xcdc2('0x17')](_0x10eb77[_0xcdc2('0x14')])));}})});router[_0xcdc2('0x19')]('/',upload[_0xcdc2('0x1a')](_0xcdc2('0x1b')),controller[_0xcdc2('0x1c')]);router[_0xcdc2('0x1d')](_0xcdc2('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xcdc2('0xd'),auth[_0xcdc2('0xb')](),controller['delete']);module[_0xcdc2('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 3667f61..03ddddf 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 _0x3d5e=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0xba0a2b,_0x313c9c){var _0x26af05=function(_0x12b348){while(--_0x12b348){_0xba0a2b['push'](_0xba0a2b['shift']());}};_0x26af05(++_0x313c9c);}(_0x3d5e,0x7c));var _0xe3d5=function(_0x48666f,_0x25348a){_0x48666f=_0x48666f-0x0;var _0xcfad48=_0x3d5e[_0x48666f];return _0xcfad48;};'use strict';var Sequelize=require(_0xe3d5('0x0'));module[_0xe3d5('0x1')]={'name':{'type':Sequelize[_0xe3d5('0x2')],'unique':_0xe3d5('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe3d5('0x2')]},'display_name':{'type':Sequelize[_0xe3d5('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xe3d5('0x2')]},'original_duration':{'type':Sequelize[_0xe3d5('0x4')]},'original_sampleCount':{'type':Sequelize[_0xe3d5('0x5')]},'original_channelCount':{'type':Sequelize[_0xe3d5('0x6')]},'original_bitRate':{'type':Sequelize[_0xe3d5('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xe3d5('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xe3d5('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xe3d5('0x6')]}}; \ No newline at end of file +var _0xda63=['exports','STRING','name','INTEGER','BIGINT','FLOAT','sequelize'];(function(_0x28f228,_0x4d3853){var _0x3af165=function(_0x4b8dee){while(--_0x4b8dee){_0x28f228['push'](_0x28f228['shift']());}};_0x3af165(++_0x4d3853);}(_0xda63,0x92));var _0x3da6=function(_0x7902d0,_0x378152){_0x7902d0=_0x7902d0-0x0;var _0x2ab4ac=_0xda63[_0x7902d0];return _0x2ab4ac;};'use strict';var Sequelize=require(_0x3da6('0x0'));module[_0x3da6('0x1')]={'name':{'type':Sequelize[_0x3da6('0x2')],'unique':_0x3da6('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x3da6('0x2')]},'original_format':{'type':Sequelize[_0x3da6('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x3da6('0x4')]},'original_bitRate':{'type':Sequelize[_0x3da6('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x3da6('0x2')]},'converted_duration':{'type':Sequelize[_0x3da6('0x6')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x3da6('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x3da6('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1c3367f..0957d47 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 _0x8470=['include','rows','catch','show','params','rawAttributes','find','download','save_name','converted_format','existsSync','join','Sound\x20not\x20found','root','server/files/sounds/converted','format','%s.%s','create','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','sampleRate','dest','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','body','role','userProfileId','user','UserProfileSection','start','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','stack','name','send','index','map','Sound','fieldName','type','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','options','includeAll'];(function(_0x5573d9,_0x4a97f7){var _0x502a3b=function(_0x3e324c){while(--_0x3e324c){_0x5573d9['push'](_0x5573d9['shift']());}};_0x502a3b(++_0x4a97f7);}(_0x8470,0x1a8));var _0x0847=function(_0x223be0,_0x186742){_0x223be0=_0x223be0-0x0;var _0x2431da=_0x8470[_0x223be0];return _0x2431da;};'use strict';var emlformat=require(_0x0847('0x0'));var rimraf=require(_0x0847('0x1'));var zipdir=require(_0x0847('0x2'));var jsonpatch=require(_0x0847('0x3'));var rp=require(_0x0847('0x4'));var moment=require('moment');var BPromise=require(_0x0847('0x5'));var Mustache=require(_0x0847('0x6'));var util=require(_0x0847('0x7'));var path=require(_0x0847('0x8'));var sox=require('sox');var csv=require(_0x0847('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0847('0xa'));var _=require('lodash');var squel=require(_0x0847('0xb'));var crypto=require(_0x0847('0xc'));var jsforce=require(_0x0847('0xd'));var deskjs=require(_0x0847('0xe'));var toCsv=require(_0x0847('0x9'));var querystring=require(_0x0847('0xf'));var Papa=require(_0x0847('0x10'));var Redis=require(_0x0847('0x11'));var authService=require(_0x0847('0x12'));var qs=require(_0x0847('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0847('0x14'))(_0x0847('0x15'));var utils=require(_0x0847('0x16'));var config=require(_0x0847('0x17'));var licenseUtil=require(_0x0847('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x521b48,_0x4622cb){_0x4622cb=_0x4622cb||0xcc;return function(_0x49ddac){if(_0x49ddac){return _0x521b48[_0x0847('0x19')](_0x4622cb);}return _0x521b48[_0x0847('0x1a')](_0x4622cb)[_0x0847('0x1b')]();};}function respondWithResult(_0x1788c3,_0x130d71){_0x130d71=_0x130d71||0xc8;return function(_0xb74418){if(_0xb74418){return _0x1788c3[_0x0847('0x1a')](_0x130d71)['json'](_0xb74418);}};}function respondWithFilteredResult(_0x26d448,_0x22416b){return function(_0x4a230e){if(_0x4a230e){var _0xd80486=typeof _0x22416b[_0x0847('0x1c')]===_0x0847('0x1d')&&typeof _0x22416b['limit']===_0x0847('0x1d');var _0x3c4dba=_0x4a230e['count'];var _0x3ed268=_0xd80486?0x0:_0x22416b[_0x0847('0x1c')];var _0x30e603=_0xd80486?_0x4a230e[_0x0847('0x1e')]:_0x22416b[_0x0847('0x1c')]+_0x22416b['limit'];var _0x216147;if(_0x30e603>=_0x3c4dba){_0x30e603=_0x3c4dba;_0x216147=0xc8;}else{_0x216147=0xce;}_0x26d448['status'](_0x216147);return _0x26d448[_0x0847('0x1f')](_0x0847('0x20'),_0x3ed268+'-'+_0x30e603+'/'+_0x3c4dba)[_0x0847('0x21')](_0x4a230e);}return null;};}function patchUpdates(_0xb0e590){return function(_0x1ad832){try{jsonpatch[_0x0847('0x22')](_0x1ad832,_0xb0e590,!![]);}catch(_0x29caf2){return BPromise[_0x0847('0x23')](_0x29caf2);}return _0x1ad832[_0x0847('0x24')]();};}function saveUpdates(_0x46b3f4,_0xf42332){return function(_0x138546){if(_0x138546){return _0x138546[_0x0847('0x25')](_0x46b3f4)[_0x0847('0x26')](function(_0x18d437){return _0x18d437;});}return null;};}function removeEntity(_0x50f128,_0x4435fa){return function(_0x2dab84){if(_0x2dab84){return _0x2dab84[_0x0847('0x27')]()['then'](function(){var _0x56d7f3=_0x2dab84[_0x0847('0x28')]({'plain':!![]});var _0x420338=_0x0847('0x29');return db[_0x0847('0x2a')][_0x0847('0x27')]({'where':{'type':_0x420338,'resourceId':_0x56d7f3['id']}})[_0x0847('0x26')](function(){return _0x2dab84;});})[_0x0847('0x26')](function(){_0x50f128[_0x0847('0x1a')](0xcc)[_0x0847('0x1b')]();});}};}function handleEntityNotFound(_0x10d61a,_0x3a1c5c){return function(_0x147845){if(!_0x147845){_0x10d61a[_0x0847('0x19')](0x194);}return _0x147845;};}function handleError(_0x51a458,_0x360be3){_0x360be3=_0x360be3||0x1f4;return function(_0x22fb48){logger['error'](_0x22fb48[_0x0847('0x2b')]);if(_0x22fb48['name']){delete _0x22fb48[_0x0847('0x2c')];}_0x51a458[_0x0847('0x1a')](_0x360be3)[_0x0847('0x2d')](_0x22fb48);};}exports[_0x0847('0x2e')]=function(_0x44097c,_0x26254b){var _0x552b73={},_0x4854b5={},_0x232469={'count':0x0,'rows':[]};var _0x5c94ec=_[_0x0847('0x2f')](db[_0x0847('0x30')]['rawAttributes'],function(_0x180b12){return{'name':_0x180b12[_0x0847('0x31')],'type':_0x180b12[_0x0847('0x32')]['key']};});_0x4854b5['model']=_[_0x0847('0x2f')](_0x5c94ec,_0x0847('0x2c'));_0x4854b5['query']=_[_0x0847('0x33')](_0x44097c[_0x0847('0x34')]);_0x4854b5[_0x0847('0x35')]=_['intersection'](_0x4854b5['model'],_0x4854b5[_0x0847('0x34')]);_0x552b73[_0x0847('0x36')]=_[_0x0847('0x37')](_0x4854b5[_0x0847('0x38')],qs[_0x0847('0x39')](_0x44097c[_0x0847('0x34')][_0x0847('0x39')]));_0x552b73[_0x0847('0x36')]=_0x552b73[_0x0847('0x36')][_0x0847('0x3a')]?_0x552b73[_0x0847('0x36')]:_0x4854b5[_0x0847('0x38')];if(!_0x44097c[_0x0847('0x34')][_0x0847('0x3b')]('nolimit')){_0x552b73['limit']=qs[_0x0847('0x3c')](_0x44097c['query'][_0x0847('0x3c')]);_0x552b73[_0x0847('0x1c')]=qs[_0x0847('0x1c')](_0x44097c[_0x0847('0x34')][_0x0847('0x1c')]);}_0x552b73[_0x0847('0x3d')]=qs[_0x0847('0x3e')](_0x44097c['query']['sort']);_0x552b73[_0x0847('0x3f')]=qs[_0x0847('0x35')](_['pick'](_0x44097c[_0x0847('0x34')],_0x4854b5['filters']),_0x5c94ec);if(_0x44097c[_0x0847('0x34')][_0x0847('0x40')]){_0x552b73['where']=_[_0x0847('0x41')](_0x552b73[_0x0847('0x3f')],{'$or':_['map'](_0x5c94ec,function(_0x39a5a0){if(_0x39a5a0[_0x0847('0x32')]!=='VIRTUAL'){var _0x3d38be={};_0x3d38be[_0x39a5a0[_0x0847('0x2c')]]={'$like':'%'+_0x44097c['query']['filter']+'%'};return _0x3d38be;}})});}_0x552b73=_[_0x0847('0x41')]({},_0x552b73,_0x44097c[_0x0847('0x42')]);var _0x365e3f={'where':_0x552b73[_0x0847('0x3f')]};return db[_0x0847('0x30')][_0x0847('0x1e')](_0x365e3f)[_0x0847('0x26')](function(_0x21276c){_0x232469['count']=_0x21276c;if(_0x44097c[_0x0847('0x34')][_0x0847('0x43')]){_0x552b73[_0x0847('0x44')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x552b73);})[_0x0847('0x26')](function(_0x19c7ed){_0x232469[_0x0847('0x45')]=_0x19c7ed;return _0x232469;})[_0x0847('0x26')](respondWithFilteredResult(_0x26254b,_0x552b73))[_0x0847('0x46')](handleError(_0x26254b,null));};exports[_0x0847('0x47')]=function(_0x7c1688,_0x20ffef){var _0x1cde5a={'raw':!![],'where':{'id':_0x7c1688[_0x0847('0x48')]['id']}},_0x5a30cb={};_0x5a30cb[_0x0847('0x38')]=_[_0x0847('0x33')](db[_0x0847('0x30')][_0x0847('0x49')]);_0x5a30cb[_0x0847('0x34')]=_[_0x0847('0x33')](_0x7c1688[_0x0847('0x34')]);_0x5a30cb['filters']=_[_0x0847('0x37')](_0x5a30cb['model'],_0x5a30cb[_0x0847('0x34')]);_0x1cde5a[_0x0847('0x36')]=_[_0x0847('0x37')](_0x5a30cb['model'],qs[_0x0847('0x39')](_0x7c1688['query']['fields']));_0x1cde5a['attributes']=_0x1cde5a[_0x0847('0x36')][_0x0847('0x3a')]?_0x1cde5a[_0x0847('0x36')]:_0x5a30cb['model'];if(_0x7c1688[_0x0847('0x34')]['includeAll']){_0x1cde5a['include']=[{'all':!![]}];}_0x1cde5a=_['merge']({},_0x1cde5a,_0x7c1688[_0x0847('0x42')]);return db[_0x0847('0x30')][_0x0847('0x4a')](_0x1cde5a)[_0x0847('0x26')](handleEntityNotFound(_0x20ffef,null))[_0x0847('0x26')](respondWithResult(_0x20ffef,null))[_0x0847('0x46')](handleError(_0x20ffef,null));};exports[_0x0847('0x4b')]=function(_0x84921,_0x67847f,_0x9739b1){return db['Sound'][_0x0847('0x4a')]({'where':{'id':_0x84921[_0x0847('0x48')]['id']},'attributes':[_0x0847('0x2c'),_0x0847('0x4c'),_0x0847('0x4d')],'raw':!![]})[_0x0847('0x26')](handleEntityNotFound(_0x67847f,null))[_0x0847('0x26')](function(_0x2e8cb2){if(_0x2e8cb2){if(!fs[_0x0847('0x4e')](path[_0x0847('0x4f')](config['root'],'server/files/sounds/converted',_0x2e8cb2[_0x0847('0x4c')]+'.'+_0x2e8cb2[_0x0847('0x4d')]))){throw new db['Sequelize']['ValidationError'](_0x0847('0x50'));}return _0x67847f['download'](path[_0x0847('0x4f')](config[_0x0847('0x51')],_0x0847('0x52'),util[_0x0847('0x53')](_0x0847('0x54'),_0x2e8cb2[_0x0847('0x4c')],_0x2e8cb2[_0x0847('0x4d')])),util[_0x0847('0x53')](_0x0847('0x54'),_0x2e8cb2[_0x0847('0x2c')],_0x2e8cb2[_0x0847('0x4d')]));}return null;})['catch'](handleError(_0x67847f,null));};exports[_0x0847('0x55')]=function(_0x2d8b4f,_0x226d17,_0x3f6be8){var _0x343f74={'name':path[_0x0847('0x56')](_0x2d8b4f[_0x0847('0x57')]['originalname'],path[_0x0847('0x58')](_0x2d8b4f[_0x0847('0x57')][_0x0847('0x59')])),'save_name':path[_0x0847('0x56')](_0x2d8b4f[_0x0847('0x57')]['filename'],path['extname'](_0x2d8b4f['file'][_0x0847('0x5a')])),'original_format':path[_0x0847('0x58')](_0x2d8b4f['file'][_0x0847('0x59')])[_0x0847('0x5b')](0x1),'converted_format':_0x0847('0x5c')};var _0xcea72=path['join'](config[_0x0847('0x51')],_0x0847('0x5d'),_0x2d8b4f[_0x0847('0x57')][_0x0847('0x5a')]);var _0xc6a102=path[_0x0847('0x4f')](config[_0x0847('0x51')],'server/files/sounds/converted',util[_0x0847('0x53')]('%s.%s',path[_0x0847('0x56')](_0x2d8b4f[_0x0847('0x57')][_0x0847('0x5a')],path[_0x0847('0x58')](_0x2d8b4f[_0x0847('0x57')]['filename'])),_0x343f74[_0x0847('0x4d')]));logger[_0x0847('0x5e')](_0x0847('0x5f'),_0xcea72);logger[_0x0847('0x5e')](_0x0847('0x60'),_0xc6a102);try{fs[_0x0847('0x61')](_0xcea72,parseInt(_0x0847('0x62'),0x8));var _0x394f07=sox[_0x0847('0x63')](_0xcea72,_0xc6a102,{'sampleRate':0x1f40,'format':_0x0847('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x394f07['on'](_0x0847('0x64'),function(_0x29a0e7){fs[_0x0847('0x65')](_0xcea72);_0x226d17['status'](0x1f4)[_0x0847('0x2d')](_0x29a0e7);});_0x394f07['on'](_0x0847('0x66'),function(_0x4af77d){_0x343f74[_0x0847('0x67')]=isNaN(_0x4af77d[_0x0847('0x68')])?null:_0x4af77d[_0x0847('0x68')]*0x3e8;_0x343f74[_0x0847('0x69')]=isNaN(_0x4af77d['sampleCount'])?null:_0x4af77d[_0x0847('0x6a')];_0x343f74[_0x0847('0x6b')]=isNaN(_0x4af77d[_0x0847('0x6c')])?null:_0x4af77d[_0x0847('0x6c')];_0x343f74['original_bitRate']=isNaN(_0x4af77d['bitRate'])?null:_0x4af77d['bitRate'];_0x343f74['original_sampleRate']=isNaN(_0x4af77d['sampleRate'])?null:_0x4af77d[_0x0847('0x6d')];});_0x394f07['on'](_0x0847('0x6e'),function(_0xed7176){_0x343f74['converted_duration']=isNaN(_0xed7176[_0x0847('0x68')])?null:_0xed7176['duration']*0x3e8;_0x343f74['converted_sampleCount']=isNaN(_0xed7176[_0x0847('0x6a')])?null:_0xed7176[_0x0847('0x6a')];_0x343f74[_0x0847('0x6f')]=isNaN(_0xed7176[_0x0847('0x6c')])?null:_0xed7176['channelCount'];_0x343f74[_0x0847('0x70')]=isNaN(_0xed7176['bitRate'])?null:_0xed7176[_0x0847('0x71')];_0x343f74[_0x0847('0x72')]=isNaN(_0xed7176[_0x0847('0x6d')])?null:_0xed7176[_0x0847('0x6d')];});_0x394f07['on'](_0x0847('0x1b'),function(){fs[_0x0847('0x61')](_0xc6a102,parseInt('0777',0x8));return db[_0x0847('0x30')]['create'](_0x343f74)[_0x0847('0x26')](function(_0x590677){var _0x453bff={'role':_0x2d8b4f[_0x0847('0x73')][_0x0847('0x74')],'userProfileId':_0x2d8b4f[_0x0847('0x73')][_0x0847('0x75')]};if(!_0x453bff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x453bff[_0x0847('0x74')]===_0x0847('0x76')){var _0x435afd=_0x590677[_0x0847('0x28')]({'plain':!![]});return db[_0x0847('0x77')]['find']({'where':{'name':'Sounds','userProfileId':_0x453bff[_0x0847('0x75')]},'raw':!![]})[_0x0847('0x26')](function(_0xb205a4){if(_0xb205a4&&_0xb205a4['autoAssociation']===0x0){return db[_0x0847('0x2a')][_0x0847('0x55')]({'name':_0x435afd[_0x0847('0x2c')],'resourceId':_0x435afd['id'],'type':_0xb205a4[_0x0847('0x2c')],'sectionId':_0xb205a4['id']},{})[_0x0847('0x26')](function(){return _0x590677;});}else{return _0x590677;}})['catch'](function(_0x16cc3f){logger[_0x0847('0x64')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16cc3f);throw _0x16cc3f;});}return _0x590677;})['then'](respondWithResult(_0x226d17,null))[_0x0847('0x46')](handleError(_0x226d17,null));});_0x394f07[_0x0847('0x78')]();}catch(_0x3e3088){_0x226d17[_0x0847('0x1a')](0x1f4)['send'](_0x3e3088);}};exports[_0x0847('0x25')]=function(_0x150254,_0x6bf7b,_0x13c471){return db[_0x0847('0x30')][_0x0847('0x4a')]({'where':{'id':_0x150254[_0x0847('0x48')]['id']}})['then'](handleEntityNotFound(_0x6bf7b,null))['then'](saveUpdates(_['pick'](_0x150254[_0x0847('0x73')],['name',_0x0847('0x79')]),null))[_0x0847('0x26')](respondWithResult(_0x6bf7b,null))[_0x0847('0x46')](handleError(_0x6bf7b,null));};exports[_0x0847('0x7a')]=function(_0x323d3c,_0x2e97bd,_0x241566){return db[_0x0847('0x30')][_0x0847('0x4a')]({'where':{'id':_0x323d3c[_0x0847('0x48')]['id']}})[_0x0847('0x26')](function(_0x38f8d1){if(_0x38f8d1){return _0x38f8d1[_0x0847('0x27')]();}})['then'](function(_0x480c33){var _0x1dfd27=path[_0x0847('0x4f')](config[_0x0847('0x51')],_0x0847('0x5d'),util[_0x0847('0x53')](_0x0847('0x54'),_0x480c33[_0x0847('0x4c')],_0x480c33['original_format']));var _0x4a8b9c=path[_0x0847('0x4f')](config[_0x0847('0x51')],_0x0847('0x52'),util[_0x0847('0x53')](_0x0847('0x54'),_0x480c33[_0x0847('0x4c')],_0x480c33['converted_format']));fs[_0x0847('0x65')](_0x1dfd27);fs[_0x0847('0x65')](_0x4a8b9c);return _0x480c33;})[_0x0847('0x26')](function(_0x1c469e){if(_0x1c469e){return _0x2e97bd[_0x0847('0x1a')](0xcc)[_0x0847('0x1b')]();}})[_0x0847('0x26')](handleEntityNotFound(_0x2e97bd,null))[_0x0847('0x46')](handleError(_0x2e97bd,null));}; \ No newline at end of file +var _0xab97=['server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','extname','originalname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Sounds','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Sound','includeAll','include','findAll','rows','catch','params','find','download','save_name','existsSync','join','root'];(function(_0x2abeee,_0x1d7879){var _0x17929b=function(_0x3e54c9){while(--_0x3e54c9){_0x2abeee['push'](_0x2abeee['shift']());}};_0x17929b(++_0x1d7879);}(_0xab97,0xaf));var _0x7ab9=function(_0x1c645b,_0x254cd7){_0x1c645b=_0x1c645b-0x0;var _0x14a19c=_0xab97[_0x1c645b];return _0x14a19c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ab9('0x0'));var zipdir=require(_0x7ab9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ab9('0x2'));var BPromise=require(_0x7ab9('0x3'));var Mustache=require(_0x7ab9('0x4'));var util=require(_0x7ab9('0x5'));var path=require(_0x7ab9('0x6'));var sox=require(_0x7ab9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ab9('0x8'));var _=require(_0x7ab9('0x9'));var squel=require(_0x7ab9('0xa'));var crypto=require(_0x7ab9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7ab9('0xc'));var toCsv=require(_0x7ab9('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7ab9('0xe'));var qs=require(_0x7ab9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ab9('0x10'));var logger=require(_0x7ab9('0x11'))('api');var utils=require(_0x7ab9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7ab9('0x13'));var db=require(_0x7ab9('0x14'))['db'];function respondWithStatusCode(_0x896d85,_0x166655){_0x166655=_0x166655||0xcc;return function(_0x3a79de){if(_0x3a79de){return _0x896d85[_0x7ab9('0x15')](_0x166655);}return _0x896d85[_0x7ab9('0x16')](_0x166655)[_0x7ab9('0x17')]();};}function respondWithResult(_0x496c68,_0x41a0a1){_0x41a0a1=_0x41a0a1||0xc8;return function(_0x290f96){if(_0x290f96){return _0x496c68[_0x7ab9('0x16')](_0x41a0a1)[_0x7ab9('0x18')](_0x290f96);}};}function respondWithFilteredResult(_0x27d348,_0x415e1b){return function(_0x137f1f){if(_0x137f1f){var _0x5fe0d9=typeof _0x415e1b[_0x7ab9('0x19')]===_0x7ab9('0x1a')&&typeof _0x415e1b[_0x7ab9('0x1b')]==='undefined';var _0x247304=_0x137f1f[_0x7ab9('0x1c')];var _0x269068=_0x5fe0d9?0x0:_0x415e1b['offset'];var _0x2137a3=_0x5fe0d9?_0x137f1f[_0x7ab9('0x1c')]:_0x415e1b[_0x7ab9('0x19')]+_0x415e1b[_0x7ab9('0x1b')];var _0xd63980;if(_0x2137a3>=_0x247304){_0x2137a3=_0x247304;_0xd63980=0xc8;}else{_0xd63980=0xce;}_0x27d348[_0x7ab9('0x16')](_0xd63980);return _0x27d348[_0x7ab9('0x1d')](_0x7ab9('0x1e'),_0x269068+'-'+_0x2137a3+'/'+_0x247304)[_0x7ab9('0x18')](_0x137f1f);}return null;};}function patchUpdates(_0x4ed85e){return function(_0x2a3cd8){try{jsonpatch[_0x7ab9('0x1f')](_0x2a3cd8,_0x4ed85e,!![]);}catch(_0x462e86){return BPromise[_0x7ab9('0x20')](_0x462e86);}return _0x2a3cd8[_0x7ab9('0x21')]();};}function saveUpdates(_0x1c6dda,_0x558c87){return function(_0x2e028c){if(_0x2e028c){return _0x2e028c[_0x7ab9('0x22')](_0x1c6dda)['then'](function(_0x23b3d1){return _0x23b3d1;});}return null;};}function removeEntity(_0x2cc78d,_0x5b1569){return function(_0x4c9a0e){if(_0x4c9a0e){return _0x4c9a0e['destroy']()[_0x7ab9('0x23')](function(){var _0x3929af=_0x4c9a0e[_0x7ab9('0x24')]({'plain':!![]});var _0xbff1ef=_0x7ab9('0x25');return db[_0x7ab9('0x26')][_0x7ab9('0x27')]({'where':{'type':_0xbff1ef,'resourceId':_0x3929af['id']}})[_0x7ab9('0x23')](function(){return _0x4c9a0e;});})[_0x7ab9('0x23')](function(){_0x2cc78d[_0x7ab9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5955,_0x2c3f28){return function(_0x295a8b){if(!_0x295a8b){_0x3f5955['sendStatus'](0x194);}return _0x295a8b;};}function handleError(_0x21a251,_0x4b942f){_0x4b942f=_0x4b942f||0x1f4;return function(_0x56ee8c){logger['error'](_0x56ee8c[_0x7ab9('0x28')]);if(_0x56ee8c[_0x7ab9('0x29')]){delete _0x56ee8c[_0x7ab9('0x29')];}_0x21a251[_0x7ab9('0x16')](_0x4b942f)[_0x7ab9('0x2a')](_0x56ee8c);};}exports[_0x7ab9('0x2b')]=function(_0x1fcb26,_0x361b0c){var _0x1c15cf={},_0x44b764={},_0x2dc263={'count':0x0,'rows':[]};var _0x5f1f27=_['map'](db['Sound'][_0x7ab9('0x2c')],function(_0x14736e){return{'name':_0x14736e[_0x7ab9('0x2d')],'type':_0x14736e[_0x7ab9('0x2e')][_0x7ab9('0x2f')]};});_0x44b764[_0x7ab9('0x30')]=_[_0x7ab9('0x31')](_0x5f1f27,'name');_0x44b764[_0x7ab9('0x32')]=_[_0x7ab9('0x33')](_0x1fcb26[_0x7ab9('0x32')]);_0x44b764[_0x7ab9('0x34')]=_[_0x7ab9('0x35')](_0x44b764[_0x7ab9('0x30')],_0x44b764[_0x7ab9('0x32')]);_0x1c15cf[_0x7ab9('0x36')]=_[_0x7ab9('0x35')](_0x44b764['model'],qs[_0x7ab9('0x37')](_0x1fcb26[_0x7ab9('0x32')]['fields']));_0x1c15cf[_0x7ab9('0x36')]=_0x1c15cf[_0x7ab9('0x36')][_0x7ab9('0x38')]?_0x1c15cf['attributes']:_0x44b764[_0x7ab9('0x30')];if(!_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x39')]('nolimit')){_0x1c15cf['limit']=qs[_0x7ab9('0x1b')](_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x1b')]);_0x1c15cf[_0x7ab9('0x19')]=qs[_0x7ab9('0x19')](_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x19')]);}_0x1c15cf[_0x7ab9('0x3a')]=qs['sort'](_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x3b')]);_0x1c15cf[_0x7ab9('0x3c')]=qs[_0x7ab9('0x34')](_[_0x7ab9('0x3d')](_0x1fcb26[_0x7ab9('0x32')],_0x44b764[_0x7ab9('0x34')]),_0x5f1f27);if(_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x3e')]){_0x1c15cf[_0x7ab9('0x3c')]=_[_0x7ab9('0x3f')](_0x1c15cf[_0x7ab9('0x3c')],{'$or':_[_0x7ab9('0x31')](_0x5f1f27,function(_0x4fc00a){if(_0x4fc00a[_0x7ab9('0x2e')]!==_0x7ab9('0x40')){var _0x5297f8={};_0x5297f8[_0x4fc00a[_0x7ab9('0x29')]]={'$like':'%'+_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x3e')]+'%'};return _0x5297f8;}})});}_0x1c15cf=_['merge']({},_0x1c15cf,_0x1fcb26[_0x7ab9('0x41')]);var _0x24b0ec={'where':_0x1c15cf[_0x7ab9('0x3c')]};return db[_0x7ab9('0x42')][_0x7ab9('0x1c')](_0x24b0ec)[_0x7ab9('0x23')](function(_0xffe6c3){_0x2dc263['count']=_0xffe6c3;if(_0x1fcb26['query'][_0x7ab9('0x43')]){_0x1c15cf[_0x7ab9('0x44')]=[{'all':!![]}];}return db[_0x7ab9('0x42')][_0x7ab9('0x45')](_0x1c15cf);})['then'](function(_0x2ed2fe){_0x2dc263[_0x7ab9('0x46')]=_0x2ed2fe;return _0x2dc263;})[_0x7ab9('0x23')](respondWithFilteredResult(_0x361b0c,_0x1c15cf))[_0x7ab9('0x47')](handleError(_0x361b0c,null));};exports['show']=function(_0x2b9119,_0xcfbba6){var _0x145ce9={'raw':!![],'where':{'id':_0x2b9119[_0x7ab9('0x48')]['id']}},_0x16cb61={};_0x16cb61['model']=_[_0x7ab9('0x33')](db['Sound'][_0x7ab9('0x2c')]);_0x16cb61[_0x7ab9('0x32')]=_[_0x7ab9('0x33')](_0x2b9119[_0x7ab9('0x32')]);_0x16cb61[_0x7ab9('0x34')]=_['intersection'](_0x16cb61['model'],_0x16cb61[_0x7ab9('0x32')]);_0x145ce9[_0x7ab9('0x36')]=_['intersection'](_0x16cb61['model'],qs[_0x7ab9('0x37')](_0x2b9119[_0x7ab9('0x32')]['fields']));_0x145ce9['attributes']=_0x145ce9['attributes'][_0x7ab9('0x38')]?_0x145ce9['attributes']:_0x16cb61['model'];if(_0x2b9119['query'][_0x7ab9('0x43')]){_0x145ce9['include']=[{'all':!![]}];}_0x145ce9=_['merge']({},_0x145ce9,_0x2b9119[_0x7ab9('0x41')]);return db[_0x7ab9('0x42')][_0x7ab9('0x49')](_0x145ce9)[_0x7ab9('0x23')](handleEntityNotFound(_0xcfbba6,null))[_0x7ab9('0x23')](respondWithResult(_0xcfbba6,null))[_0x7ab9('0x47')](handleError(_0xcfbba6,null));};exports[_0x7ab9('0x4a')]=function(_0x324dd2,_0x54cce0,_0x180d80){return db[_0x7ab9('0x42')][_0x7ab9('0x49')]({'where':{'id':_0x324dd2['params']['id']},'attributes':['name',_0x7ab9('0x4b'),'converted_format'],'raw':!![]})[_0x7ab9('0x23')](handleEntityNotFound(_0x54cce0,null))['then'](function(_0x2ba3a4){if(_0x2ba3a4){if(!fs[_0x7ab9('0x4c')](path[_0x7ab9('0x4d')](config[_0x7ab9('0x4e')],_0x7ab9('0x4f'),_0x2ba3a4['save_name']+'.'+_0x2ba3a4[_0x7ab9('0x50')]))){throw new db[(_0x7ab9('0x51'))][(_0x7ab9('0x52'))](_0x7ab9('0x53'));}return _0x54cce0[_0x7ab9('0x4a')](path[_0x7ab9('0x4d')](config[_0x7ab9('0x4e')],_0x7ab9('0x4f'),util[_0x7ab9('0x54')](_0x7ab9('0x55'),_0x2ba3a4[_0x7ab9('0x4b')],_0x2ba3a4[_0x7ab9('0x50')])),util['format']('%s.%s',_0x2ba3a4[_0x7ab9('0x29')],_0x2ba3a4['converted_format']));}return null;})['catch'](handleError(_0x54cce0,null));};exports[_0x7ab9('0x56')]=function(_0x170154,_0x598487,_0x293197){var _0x5ac31c={'name':path[_0x7ab9('0x57')](_0x170154[_0x7ab9('0x58')]['originalname'],path[_0x7ab9('0x59')](_0x170154[_0x7ab9('0x58')][_0x7ab9('0x5a')])),'save_name':path['basename'](_0x170154['file'][_0x7ab9('0x5b')],path['extname'](_0x170154['file'][_0x7ab9('0x5b')])),'original_format':path[_0x7ab9('0x59')](_0x170154[_0x7ab9('0x58')]['originalname'])[_0x7ab9('0x5c')](0x1),'converted_format':'wav'};var _0x4b5f92=path['join'](config[_0x7ab9('0x4e')],_0x7ab9('0x5d'),_0x170154['file']['filename']);var _0x2d91c4=path['join'](config['root'],_0x7ab9('0x4f'),util['format']('%s.%s',path['basename'](_0x170154[_0x7ab9('0x58')][_0x7ab9('0x5b')],path[_0x7ab9('0x59')](_0x170154[_0x7ab9('0x58')]['filename'])),_0x5ac31c[_0x7ab9('0x50')]));logger[_0x7ab9('0x5e')]('Sound\x20upload\x20filepath:\x20%s',_0x4b5f92);logger[_0x7ab9('0x5e')](_0x7ab9('0x5f'),_0x2d91c4);try{fs[_0x7ab9('0x60')](_0x4b5f92,parseInt('0777',0x8));var _0x2a7a31=sox[_0x7ab9('0x61')](_0x4b5f92,_0x2d91c4,{'sampleRate':0x1f40,'format':_0x7ab9('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2a7a31['on']('error',function(_0x24ba74){fs[_0x7ab9('0x63')](_0x4b5f92);_0x598487[_0x7ab9('0x16')](0x1f4)[_0x7ab9('0x2a')](_0x24ba74);});_0x2a7a31['on'](_0x7ab9('0x64'),function(_0x5a6b83){_0x5ac31c[_0x7ab9('0x65')]=isNaN(_0x5a6b83['duration'])?null:_0x5a6b83[_0x7ab9('0x66')]*0x3e8;_0x5ac31c[_0x7ab9('0x67')]=isNaN(_0x5a6b83[_0x7ab9('0x68')])?null:_0x5a6b83[_0x7ab9('0x68')];_0x5ac31c['original_channelCount']=isNaN(_0x5a6b83['channelCount'])?null:_0x5a6b83[_0x7ab9('0x69')];_0x5ac31c[_0x7ab9('0x6a')]=isNaN(_0x5a6b83['bitRate'])?null:_0x5a6b83[_0x7ab9('0x6b')];_0x5ac31c[_0x7ab9('0x6c')]=isNaN(_0x5a6b83[_0x7ab9('0x6d')])?null:_0x5a6b83['sampleRate'];});_0x2a7a31['on'](_0x7ab9('0x6e'),function(_0x5697ea){_0x5ac31c[_0x7ab9('0x6f')]=isNaN(_0x5697ea[_0x7ab9('0x66')])?null:_0x5697ea['duration']*0x3e8;_0x5ac31c[_0x7ab9('0x70')]=isNaN(_0x5697ea[_0x7ab9('0x68')])?null:_0x5697ea[_0x7ab9('0x68')];_0x5ac31c[_0x7ab9('0x71')]=isNaN(_0x5697ea['channelCount'])?null:_0x5697ea['channelCount'];_0x5ac31c[_0x7ab9('0x72')]=isNaN(_0x5697ea[_0x7ab9('0x6b')])?null:_0x5697ea[_0x7ab9('0x6b')];_0x5ac31c[_0x7ab9('0x73')]=isNaN(_0x5697ea[_0x7ab9('0x6d')])?null:_0x5697ea[_0x7ab9('0x6d')];});_0x2a7a31['on'](_0x7ab9('0x17'),function(){fs['chmodSync'](_0x2d91c4,parseInt('0777',0x8));return db[_0x7ab9('0x42')][_0x7ab9('0x56')](_0x5ac31c)[_0x7ab9('0x23')](function(_0x106e6d){var _0x431b1a={'role':_0x170154[_0x7ab9('0x74')][_0x7ab9('0x75')],'userProfileId':_0x170154[_0x7ab9('0x74')][_0x7ab9('0x76')]};if(!_0x431b1a)throw new Error(_0x7ab9('0x77'));if(_0x431b1a[_0x7ab9('0x75')]===_0x7ab9('0x78')){var _0x2deead=_0x106e6d[_0x7ab9('0x24')]({'plain':!![]});return db[_0x7ab9('0x79')]['find']({'where':{'name':'Sounds','userProfileId':_0x431b1a['userProfileId']},'raw':!![]})['then'](function(_0x101229){if(_0x101229&&_0x101229['autoAssociation']===0x0){return db[_0x7ab9('0x26')]['create']({'name':_0x2deead[_0x7ab9('0x29')],'resourceId':_0x2deead['id'],'type':_0x101229[_0x7ab9('0x29')],'sectionId':_0x101229['id']},{})['then'](function(){return _0x106e6d;});}else{return _0x106e6d;}})[_0x7ab9('0x47')](function(_0x1c5e82){logger[_0x7ab9('0x7a')](_0x7ab9('0x7b'),_0x1c5e82);throw _0x1c5e82;});}return _0x106e6d;})[_0x7ab9('0x23')](respondWithResult(_0x598487,null))[_0x7ab9('0x47')](handleError(_0x598487,null));});_0x2a7a31[_0x7ab9('0x7c')]();}catch(_0x13c52b){_0x598487[_0x7ab9('0x16')](0x1f4)['send'](_0x13c52b);}};exports['update']=function(_0x4bee46,_0x3c41b8,_0x1c85fb){return db[_0x7ab9('0x42')][_0x7ab9('0x49')]({'where':{'id':_0x4bee46[_0x7ab9('0x48')]['id']}})[_0x7ab9('0x23')](handleEntityNotFound(_0x3c41b8,null))[_0x7ab9('0x23')](saveUpdates(_[_0x7ab9('0x3d')](_0x4bee46[_0x7ab9('0x74')],[_0x7ab9('0x29'),'description']),null))[_0x7ab9('0x23')](respondWithResult(_0x3c41b8,null))[_0x7ab9('0x47')](handleError(_0x3c41b8,null));};exports[_0x7ab9('0x7d')]=function(_0xb47afc,_0x4e35d6,_0x51b9e3){return db[_0x7ab9('0x42')][_0x7ab9('0x49')]({'where':{'id':_0xb47afc[_0x7ab9('0x48')]['id']}})[_0x7ab9('0x23')](function(_0x6b885e){if(_0x6b885e){return _0x6b885e[_0x7ab9('0x27')]();}})[_0x7ab9('0x23')](function(_0x38608f){var _0x523a1d=path[_0x7ab9('0x4d')](config['root'],'server/files/sounds/original',util['format']('%s.%s',_0x38608f[_0x7ab9('0x4b')],_0x38608f[_0x7ab9('0x7e')]));var _0x417215=path[_0x7ab9('0x4d')](config[_0x7ab9('0x4e')],'server/files/sounds/converted',util[_0x7ab9('0x54')]('%s.%s',_0x38608f['save_name'],_0x38608f[_0x7ab9('0x50')]));fs[_0x7ab9('0x63')](_0x523a1d);fs[_0x7ab9('0x63')](_0x417215);return _0x38608f;})[_0x7ab9('0x23')](function(_0x3069cc){if(_0x3069cc){return _0x4e35d6[_0x7ab9('0x16')](0xcc)[_0x7ab9('0x17')]();}})[_0x7ab9('0x23')](handleEntityNotFound(_0x4e35d6,null))[_0x7ab9('0x47')](handleError(_0x4e35d6,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index b521b26..e986393 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 _0x1650=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds','lodash','../../config/logger'];(function(_0x4552a7,_0x27eba3){var _0x3db806=function(_0x5b6ff0){while(--_0x5b6ff0){_0x4552a7['push'](_0x4552a7['shift']());}};_0x3db806(++_0x27eba3);}(_0x1650,0xe2));var _0x0165=function(_0x3e25bc,_0x1b01f3){_0x3e25bc=_0x3e25bc-0x0;var _0x345958=_0x1650[_0x3e25bc];return _0x345958;};'use strict';var _=require(_0x0165('0x0'));var util=require('util');var logger=require(_0x0165('0x1'))('api');var moment=require(_0x0165('0x2'));var BPromise=require(_0x0165('0x3'));var rp=require(_0x0165('0x4'));var fs=require('fs');var path=require(_0x0165('0x5'));var rimraf=require(_0x0165('0x6'));var config=require(_0x0165('0x7'));var attributes=require(_0x0165('0x8'));module[_0x0165('0x9')]=function(_0x409e47,_0x11c3cd){return _0x409e47[_0x0165('0xa')]('Sound',attributes,{'tableName':_0x0165('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7b2=['tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./sound.attributes','exports','Sound'];(function(_0x4264ee,_0x520320){var _0x46d043=function(_0x4636e8){while(--_0x4636e8){_0x4264ee['push'](_0x4264ee['shift']());}};_0x46d043(++_0x520320);}(_0xc7b2,0x79));var _0x2c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2c7b('0x0'));var logger=require(_0x2c7b('0x1'))(_0x2c7b('0x2'));var moment=require(_0x2c7b('0x3'));var BPromise=require(_0x2c7b('0x4'));var rp=require(_0x2c7b('0x5'));var fs=require('fs');var path=require(_0x2c7b('0x6'));var rimraf=require(_0x2c7b('0x7'));var config=require('../../config/environment');var attributes=require(_0x2c7b('0x8'));module[_0x2c7b('0x9')]=function(_0x9a855c,_0x4e690b){return _0x9a855c['define'](_0x2c7b('0xa'),attributes,{'tableName':_0x2c7b('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 c8be396..d4a9b7a 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 _0x759b=['result','catch','ShowSound','find','options','raw','where','include','map','model','attributes','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4fcba4,_0x40eafc){var _0xd74f98=function(_0x1c927e){while(--_0x1c927e){_0x4fcba4['push'](_0x4fcba4['shift']());}};_0xd74f98(++_0x40eafc);}(_0x759b,0x90));var _0xb759=function(_0x1c4b8d,_0x146a41){_0x1c4b8d=_0x1c4b8d-0x0;var _0x203346=_0x759b[_0x1c4b8d];return _0x203346;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb759('0x0'));var BPromise=require(_0xb759('0x1'));var rs=require(_0xb759('0x2'));var fs=require('fs');var Redis=require(_0xb759('0x3'));var db=require(_0xb759('0x4'))['db'];var utils=require(_0xb759('0x5'));var logger=require('../../config/logger')(_0xb759('0x6'));var config=require(_0xb759('0x7'));var jayson=require(_0xb759('0x8'));var client=jayson[_0xb759('0x9')][_0xb759('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x766163,_0x44739d,_0x4e7ec7){return new BPromise(function(_0x245426,_0x2c5345){return client[_0xb759('0xb')](_0x766163,_0x4e7ec7)[_0xb759('0xc')](function(_0x218f92){logger[_0xb759('0xd')](_0xb759('0xe'),_0x44739d,_0xb759('0xf'));logger[_0xb759('0x10')](_0xb759('0x11'),_0x44739d,'request\x20sent',JSON['stringify'](_0x218f92));if(_0x218f92[_0xb759('0x12')]){if(_0x218f92[_0xb759('0x12')][_0xb759('0x13')]===0x1f4){logger[_0xb759('0x12')]('Sound,\x20%s,\x20%s',_0x44739d,_0x218f92[_0xb759('0x12')][_0xb759('0x14')]);return _0x2c5345(_0x218f92[_0xb759('0x12')][_0xb759('0x14')]);}logger[_0xb759('0x12')](_0xb759('0xe'),_0x44739d,_0x218f92[_0xb759('0x12')][_0xb759('0x14')]);return _0x245426(_0x218f92[_0xb759('0x12')][_0xb759('0x14')]);}else{logger[_0xb759('0xd')](_0xb759('0xe'),_0x44739d,_0xb759('0xf'));_0x245426(_0x218f92[_0xb759('0x15')][_0xb759('0x14')]);}})[_0xb759('0x16')](function(_0x458ed3){logger[_0xb759('0x12')]('Sound,\x20%s,\x20%s',_0x44739d,_0x458ed3);_0x2c5345(_0x458ed3);});});}exports[_0xb759('0x17')]=function(_0x242ad2){var _0x757c60=this;return new Promise(function(_0x3542da,_0x148ebf){return db['Sound'][_0xb759('0x18')]({'raw':_0x242ad2['options']?_0x242ad2[_0xb759('0x19')][_0xb759('0x1a')]===undefined?!![]:![]:!![],'where':_0x242ad2[_0xb759('0x19')]?_0x242ad2['options'][_0xb759('0x1b')]||null:null,'attributes':_0x242ad2[_0xb759('0x19')]?_0x242ad2['options']['attributes']||null:null,'include':_0x242ad2[_0xb759('0x19')]?_0x242ad2[_0xb759('0x19')][_0xb759('0x1c')]?_[_0xb759('0x1d')](_0x242ad2[_0xb759('0x19')][_0xb759('0x1c')],function(_0xab7ed6){return{'model':db[_0xab7ed6[_0xb759('0x1e')]],'as':_0xab7ed6['as'],'attributes':_0xab7ed6[_0xb759('0x1f')],'include':_0xab7ed6[_0xb759('0x1c')]?_[_0xb759('0x1d')](_0xab7ed6[_0xb759('0x1c')],function(_0x4ccd8d){return{'model':db[_0x4ccd8d[_0xb759('0x1e')]],'as':_0x4ccd8d['as'],'attributes':_0x4ccd8d[_0xb759('0x1f')],'include':_0x4ccd8d['include']?_['map'](_0x4ccd8d[_0xb759('0x1c')],function(_0x5341cf){return{'model':db[_0x5341cf['model']],'as':_0x5341cf['as'],'attributes':_0x5341cf['attributes']};}):[]};}):[]};}):[]:[]})[_0xb759('0xc')](function(_0x58c26a){logger['info'](_0xb759('0x17'),_0x242ad2);logger['debug'](_0xb759('0x17'),_0x242ad2,JSON[_0xb759('0x20')](_0x58c26a));_0x3542da(_0x58c26a);})['catch'](function(_0x1336d9){logger[_0xb759('0x12')](_0xb759('0x17'),_0x1336d9[_0xb759('0x14')],_0x242ad2);_0x148ebf(_0x757c60[_0xb759('0x12')](0x1f4,_0x1336d9[_0xb759('0x14')]));});});}; \ No newline at end of file +var _0xfb49=['attributes','include','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSound','Sound','options','where','map'];(function(_0x1e3a11,_0x56e4f2){var _0x4b72f2=function(_0x2c0590){while(--_0x2c0590){_0x1e3a11['push'](_0x1e3a11['shift']());}};_0x4b72f2(++_0x56e4f2);}(_0xfb49,0x11a));var _0x9fb4=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0xfb49[_0x57ee1d];return _0x12a933;};'use strict';var _=require(_0x9fb4('0x0'));var util=require(_0x9fb4('0x1'));var moment=require(_0x9fb4('0x2'));var BPromise=require(_0x9fb4('0x3'));var rs=require(_0x9fb4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fb4('0x5'))['db'];var utils=require(_0x9fb4('0x6'));var logger=require(_0x9fb4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9fb4('0x8'));var client=jayson[_0x9fb4('0x9')][_0x9fb4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bfdc4,_0x40def2,_0x160eb0){return new BPromise(function(_0x230111,_0x4e5de4){return client[_0x9fb4('0xb')](_0x2bfdc4,_0x160eb0)[_0x9fb4('0xc')](function(_0x4fa454){logger[_0x9fb4('0xd')](_0x9fb4('0xe'),_0x40def2,_0x9fb4('0xf'));logger[_0x9fb4('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x40def2,_0x9fb4('0xf'),JSON[_0x9fb4('0x11')](_0x4fa454));if(_0x4fa454[_0x9fb4('0x12')]){if(_0x4fa454[_0x9fb4('0x12')][_0x9fb4('0x13')]===0x1f4){logger[_0x9fb4('0x12')](_0x9fb4('0xe'),_0x40def2,_0x4fa454[_0x9fb4('0x12')][_0x9fb4('0x14')]);return _0x4e5de4(_0x4fa454[_0x9fb4('0x12')][_0x9fb4('0x14')]);}logger[_0x9fb4('0x12')](_0x9fb4('0xe'),_0x40def2,_0x4fa454[_0x9fb4('0x12')][_0x9fb4('0x14')]);return _0x230111(_0x4fa454[_0x9fb4('0x12')][_0x9fb4('0x14')]);}else{logger['info'](_0x9fb4('0xe'),_0x40def2,'request\x20sent');_0x230111(_0x4fa454[_0x9fb4('0x15')]['message']);}})[_0x9fb4('0x16')](function(_0x1f7680){logger[_0x9fb4('0x12')](_0x9fb4('0xe'),_0x40def2,_0x1f7680);_0x4e5de4(_0x1f7680);});});}exports[_0x9fb4('0x17')]=function(_0x33279f){var _0x1fba8e=this;return new Promise(function(_0x2c5637,_0x12851f){return db[_0x9fb4('0x18')]['find']({'raw':_0x33279f[_0x9fb4('0x19')]?_0x33279f[_0x9fb4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x33279f[_0x9fb4('0x19')]?_0x33279f[_0x9fb4('0x19')][_0x9fb4('0x1a')]||null:null,'attributes':_0x33279f[_0x9fb4('0x19')]?_0x33279f[_0x9fb4('0x19')]['attributes']||null:null,'include':_0x33279f['options']?_0x33279f[_0x9fb4('0x19')]['include']?_[_0x9fb4('0x1b')](_0x33279f[_0x9fb4('0x19')]['include'],function(_0xbc36a4){return{'model':db[_0xbc36a4['model']],'as':_0xbc36a4['as'],'attributes':_0xbc36a4[_0x9fb4('0x1c')],'include':_0xbc36a4[_0x9fb4('0x1d')]?_[_0x9fb4('0x1b')](_0xbc36a4['include'],function(_0x25d6a2){return{'model':db[_0x25d6a2[_0x9fb4('0x1e')]],'as':_0x25d6a2['as'],'attributes':_0x25d6a2[_0x9fb4('0x1c')],'include':_0x25d6a2[_0x9fb4('0x1d')]?_[_0x9fb4('0x1b')](_0x25d6a2[_0x9fb4('0x1d')],function(_0x2a6367){return{'model':db[_0x2a6367['model']],'as':_0x2a6367['as'],'attributes':_0x2a6367[_0x9fb4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9fb4('0xc')](function(_0x145786){logger[_0x9fb4('0xd')](_0x9fb4('0x17'),_0x33279f);logger[_0x9fb4('0x10')](_0x9fb4('0x17'),_0x33279f,JSON['stringify'](_0x145786));_0x2c5637(_0x145786);})[_0x9fb4('0x16')](function(_0x2f10ad){logger[_0x9fb4('0x12')]('ShowSound',_0x2f10ad[_0x9fb4('0x14')],_0x33279f);_0x12851f(_0x1fba8e['error'](0x1f4,_0x2f10ad['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ed8b542..c1d0a8b 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 _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x7ed9e9,_0x35fb5d){var _0x383437=function(_0x496ea0){while(--_0x496ea0){_0x7ed9e9['push'](_0x7ed9e9['shift']());}};_0x383437(++_0x35fb5d);}(_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('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x272a88,_0x57e586){var _0x5c71c4=function(_0x8151b3){while(--_0x8151b3){_0x272a88['push'](_0x272a88['shift']());}};_0x5c71c4(++_0x57e586);}(_0x2032,0xd9));var _0x2203=function(_0x386e74,_0x1b2005){_0x386e74=_0x386e74-0x0;var _0x73350=_0x2032[_0x386e74];return _0x73350;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0ca2029..0543f02 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 _0xc380=['TEXT','ENUM','out','sequelize','exports','STRING'];(function(_0x113bb4,_0x1bcdf6){var _0x24c79b=function(_0x5129b5){while(--_0x5129b5){_0x113bb4['push'](_0x113bb4['shift']());}};_0x24c79b(++_0x1bcdf6);}(_0xc380,0x14d));var _0x0c38=function(_0x438cce,_0x1596c3){_0x438cce=_0x438cce-0x0;var _0x5c4550=_0xc380[_0x438cce];return _0x5c4550;};'use strict';var Sequelize=require(_0x0c38('0x0'));module[_0x0c38('0x1')]={'uniqueid':{'type':Sequelize[_0x0c38('0x2')]},'body':{'type':Sequelize[_0x0c38('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x0c38('0x4')]('in',_0x0c38('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0c38('0x3')]}}; \ No newline at end of file +var _0x456f=['TEXT','ENUM','out','STRING','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x456f,0x112));var _0xf456=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x456f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf456('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xf456('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xf456('0x2')]('in',_0xf456('0x3')),'defaultValue':_0xf456('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xf456('0x4')]},'providerResponse':{'type':Sequelize[_0xf456('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 0d6ab33..6a008a9 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 _0x160f=['../../components/auth/service','../../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','then','destroy','error','stack','name','rawAttributes','type','key','map','intersection','model','query','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SquareMessage','include','findAll','rows','show','params','keys','fields','includeAll','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','querystring','papaparse','ioredis'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf160('0x0'));var rimraf=require(_0xf160('0x1'));var zipdir=require(_0xf160('0x2'));var jsonpatch=require(_0xf160('0x3'));var rp=require('request-promise');var moment=require(_0xf160('0x4'));var BPromise=require(_0xf160('0x5'));var Mustache=require(_0xf160('0x6'));var util=require(_0xf160('0x7'));var path=require(_0xf160('0x8'));var sox=require(_0xf160('0x9'));var csv=require('to-csv');var ejs=require(_0xf160('0xa'));var fs=require('fs');var fs_extra=require(_0xf160('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var licenseUtil=require(_0xf160('0x15'));var db=require(_0xf160('0x16'))['db'];function respondWithStatusCode(_0x3b09ea,_0x2d8854){_0x2d8854=_0x2d8854||0xcc;return function(_0x523af5){if(_0x523af5){return _0x3b09ea[_0xf160('0x17')](_0x2d8854);}return _0x3b09ea['status'](_0x2d8854)[_0xf160('0x18')]();};}function respondWithResult(_0x26951a,_0x12549a){_0x12549a=_0x12549a||0xc8;return function(_0x2bb6c7){if(_0x2bb6c7){return _0x26951a[_0xf160('0x19')](_0x12549a)[_0xf160('0x1a')](_0x2bb6c7);}};}function respondWithFilteredResult(_0x2643ba,_0x172337){return function(_0x1396ba){if(_0x1396ba){var _0x59ac02=typeof _0x172337[_0xf160('0x1b')]===_0xf160('0x1c')&&typeof _0x172337[_0xf160('0x1d')]===_0xf160('0x1c');var _0x51824b=_0x1396ba[_0xf160('0x1e')];var _0x4b8185=_0x59ac02?0x0:_0x172337[_0xf160('0x1b')];var _0x1cf6ba=_0x59ac02?_0x1396ba[_0xf160('0x1e')]:_0x172337[_0xf160('0x1b')]+_0x172337[_0xf160('0x1d')];var _0x205afa;if(_0x1cf6ba>=_0x51824b){_0x1cf6ba=_0x51824b;_0x205afa=0xc8;}else{_0x205afa=0xce;}_0x2643ba[_0xf160('0x19')](_0x205afa);return _0x2643ba[_0xf160('0x1f')](_0xf160('0x20'),_0x4b8185+'-'+_0x1cf6ba+'/'+_0x51824b)['json'](_0x1396ba);}return null;};}function patchUpdates(_0x40ccf0){return function(_0xa20d5a){try{jsonpatch[_0xf160('0x21')](_0xa20d5a,_0x40ccf0,!![]);}catch(_0x5ad173){return BPromise[_0xf160('0x22')](_0x5ad173);}return _0xa20d5a[_0xf160('0x23')]();};}function saveUpdates(_0x454e63,_0x36d0cb){return function(_0x2e03c8){if(_0x2e03c8){return _0x2e03c8[_0xf160('0x24')](_0x454e63)[_0xf160('0x25')](function(_0x5a72d1){return _0x5a72d1;});}return null;};}function removeEntity(_0x3d1f6c,_0x28bf27){return function(_0x305f6a){if(_0x305f6a){return _0x305f6a[_0xf160('0x26')]()['then'](function(){_0x3d1f6c[_0xf160('0x19')](0xcc)[_0xf160('0x18')]();});}};}function handleEntityNotFound(_0x4a8003,_0x487c0c){return function(_0x168a09){if(!_0x168a09){_0x4a8003[_0xf160('0x17')](0x194);}return _0x168a09;};}function handleError(_0x39c0e3,_0x4c0c51){_0x4c0c51=_0x4c0c51||0x1f4;return function(_0xcfa9bd){logger[_0xf160('0x27')](_0xcfa9bd[_0xf160('0x28')]);if(_0xcfa9bd[_0xf160('0x29')]){delete _0xcfa9bd[_0xf160('0x29')];}_0x39c0e3[_0xf160('0x19')](_0x4c0c51)['send'](_0xcfa9bd);};}exports['index']=function(_0x48145e,_0x26e7b9){var _0x16a5fa={},_0xcaab39={},_0x26e06b={'count':0x0,'rows':[]};var _0x399cce=_['map'](db['SquareMessage'][_0xf160('0x2a')],function(_0x558596){return{'name':_0x558596['fieldName'],'type':_0x558596[_0xf160('0x2b')][_0xf160('0x2c')]};});_0xcaab39['model']=_[_0xf160('0x2d')](_0x399cce,_0xf160('0x29'));_0xcaab39['query']=_['keys'](_0x48145e['query']);_0xcaab39['filters']=_[_0xf160('0x2e')](_0xcaab39[_0xf160('0x2f')],_0xcaab39[_0xf160('0x30')]);_0x16a5fa[_0xf160('0x31')]=_[_0xf160('0x2e')](_0xcaab39[_0xf160('0x2f')],qs['fields'](_0x48145e['query']['fields']));_0x16a5fa[_0xf160('0x31')]=_0x16a5fa['attributes']['length']?_0x16a5fa[_0xf160('0x31')]:_0xcaab39[_0xf160('0x2f')];if(!_0x48145e['query'][_0xf160('0x32')](_0xf160('0x33'))){_0x16a5fa[_0xf160('0x1d')]=qs[_0xf160('0x1d')](_0x48145e[_0xf160('0x30')]['limit']);_0x16a5fa[_0xf160('0x1b')]=qs[_0xf160('0x1b')](_0x48145e[_0xf160('0x30')]['offset']);}_0x16a5fa[_0xf160('0x34')]=qs[_0xf160('0x35')](_0x48145e[_0xf160('0x30')][_0xf160('0x35')]);_0x16a5fa[_0xf160('0x36')]=qs[_0xf160('0x37')](_['pick'](_0x48145e['query'],_0xcaab39[_0xf160('0x37')]),_0x399cce);if(_0x48145e[_0xf160('0x30')][_0xf160('0x38')]){_0x16a5fa[_0xf160('0x36')]=_[_0xf160('0x39')](_0x16a5fa[_0xf160('0x36')],{'$or':_[_0xf160('0x2d')](_0x399cce,function(_0x38a33e){if(_0x38a33e[_0xf160('0x2b')]!==_0xf160('0x3a')){var _0x1e65d4={};_0x1e65d4[_0x38a33e[_0xf160('0x29')]]={'$like':'%'+_0x48145e[_0xf160('0x30')][_0xf160('0x38')]+'%'};return _0x1e65d4;}})});}_0x16a5fa=_[_0xf160('0x39')]({},_0x16a5fa,_0x48145e[_0xf160('0x3b')]);var _0x161f06={'where':_0x16a5fa[_0xf160('0x36')]};return db[_0xf160('0x3c')][_0xf160('0x1e')](_0x161f06)[_0xf160('0x25')](function(_0x8fe1de){_0x26e06b[_0xf160('0x1e')]=_0x8fe1de;if(_0x48145e[_0xf160('0x30')]['includeAll']){_0x16a5fa[_0xf160('0x3d')]=[{'all':!![]}];}return db[_0xf160('0x3c')][_0xf160('0x3e')](_0x16a5fa);})[_0xf160('0x25')](function(_0x3d273d){_0x26e06b[_0xf160('0x3f')]=_0x3d273d;return _0x26e06b;})[_0xf160('0x25')](respondWithFilteredResult(_0x26e7b9,_0x16a5fa))['catch'](handleError(_0x26e7b9,null));};exports[_0xf160('0x40')]=function(_0x5be7ce,_0xa80a5f){var _0x477ded={'raw':!![],'where':{'id':_0x5be7ce[_0xf160('0x41')]['id']}},_0x530fc5={};_0x530fc5[_0xf160('0x2f')]=_[_0xf160('0x42')](db[_0xf160('0x3c')][_0xf160('0x2a')]);_0x530fc5[_0xf160('0x30')]=_[_0xf160('0x42')](_0x5be7ce['query']);_0x530fc5[_0xf160('0x37')]=_[_0xf160('0x2e')](_0x530fc5[_0xf160('0x2f')],_0x530fc5[_0xf160('0x30')]);_0x477ded[_0xf160('0x31')]=_[_0xf160('0x2e')](_0x530fc5[_0xf160('0x2f')],qs[_0xf160('0x43')](_0x5be7ce[_0xf160('0x30')][_0xf160('0x43')]));_0x477ded[_0xf160('0x31')]=_0x477ded['attributes']['length']?_0x477ded[_0xf160('0x31')]:_0x530fc5[_0xf160('0x2f')];if(_0x5be7ce[_0xf160('0x30')][_0xf160('0x44')]){_0x477ded[_0xf160('0x3d')]=[{'all':!![]}];}_0x477ded=_[_0xf160('0x39')]({},_0x477ded,_0x5be7ce['options']);return db[_0xf160('0x3c')]['find'](_0x477ded)['then'](handleEntityNotFound(_0xa80a5f,null))[_0xf160('0x25')](respondWithResult(_0xa80a5f,null))[_0xf160('0x45')](handleError(_0xa80a5f,null));};exports['create']=function(_0x5ea49d,_0x2f1648){return db[_0xf160('0x3c')][_0xf160('0x46')](_0x5ea49d[_0xf160('0x47')],{})['then'](respondWithResult(_0x2f1648,0xc9))['catch'](handleError(_0x2f1648,null));};exports['update']=function(_0x50a97d,_0x406494){if(_0x50a97d['body']['id']){delete _0x50a97d[_0xf160('0x47')]['id'];}return db[_0xf160('0x3c')][_0xf160('0x48')]({'where':{'id':_0x50a97d[_0xf160('0x41')]['id']}})['then'](handleEntityNotFound(_0x406494,null))[_0xf160('0x25')](saveUpdates(_0x50a97d[_0xf160('0x47')],null))[_0xf160('0x25')](respondWithResult(_0x406494,null))['catch'](handleError(_0x406494,null));};exports[_0xf160('0x26')]=function(_0x40f855,_0x87ad7e){return db['SquareMessage'][_0xf160('0x48')]({'where':{'id':_0x40f855[_0xf160('0x41')]['id']}})[_0xf160('0x25')](handleEntityNotFound(_0x87ad7e,null))[_0xf160('0x25')](removeEntity(_0x87ad7e,null))[_0xf160('0x45')](handleError(_0x87ad7e,null));}; \ No newline at end of file +var _0x0733=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','error','stack','name','send','index','SquareMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','rows','catch','include','find','create','body','params','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv'];(function(_0x28b4e8,_0x4dc742){var _0x420a1d=function(_0x23ecf9){while(--_0x23ecf9){_0x28b4e8['push'](_0x28b4e8['shift']());}};_0x420a1d(++_0x4dc742);}(_0x0733,0xc4));var _0x3073=function(_0x4408e,_0x3b98f9){_0x4408e=_0x4408e-0x0;var _0x3802b7=_0x0733[_0x4408e];return _0x3802b7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3073('0x0'));var jsonpatch=require(_0x3073('0x1'));var rp=require(_0x3073('0x2'));var moment=require('moment');var BPromise=require(_0x3073('0x3'));var Mustache=require(_0x3073('0x4'));var util=require('util');var path=require(_0x3073('0x5'));var sox=require(_0x3073('0x6'));var csv=require(_0x3073('0x7'));var ejs=require(_0x3073('0x8'));var fs=require('fs');var fs_extra=require(_0x3073('0x9'));var _=require(_0x3073('0xa'));var squel=require(_0x3073('0xb'));var crypto=require(_0x3073('0xc'));var jsforce=require(_0x3073('0xd'));var deskjs=require(_0x3073('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3073('0xf'));var Redis=require(_0x3073('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3073('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3073('0x12'))(_0x3073('0x13'));var utils=require(_0x3073('0x14'));var config=require(_0x3073('0x15'));var licenseUtil=require(_0x3073('0x16'));var db=require(_0x3073('0x17'))['db'];function respondWithStatusCode(_0x494252,_0x11e780){_0x11e780=_0x11e780||0xcc;return function(_0x473d73){if(_0x473d73){return _0x494252[_0x3073('0x18')](_0x11e780);}return _0x494252[_0x3073('0x19')](_0x11e780)[_0x3073('0x1a')]();};}function respondWithResult(_0x1ef805,_0x5025ee){_0x5025ee=_0x5025ee||0xc8;return function(_0x2828cf){if(_0x2828cf){return _0x1ef805[_0x3073('0x19')](_0x5025ee)['json'](_0x2828cf);}};}function respondWithFilteredResult(_0x415571,_0x2b8c8b){return function(_0x5efc8d){if(_0x5efc8d){var _0x169772=typeof _0x2b8c8b[_0x3073('0x1b')]===_0x3073('0x1c')&&typeof _0x2b8c8b['limit']===_0x3073('0x1c');var _0x3b2714=_0x5efc8d[_0x3073('0x1d')];var _0x33cf39=_0x169772?0x0:_0x2b8c8b['offset'];var _0xaa8b3c=_0x169772?_0x5efc8d[_0x3073('0x1d')]:_0x2b8c8b['offset']+_0x2b8c8b[_0x3073('0x1e')];var _0x39978a;if(_0xaa8b3c>=_0x3b2714){_0xaa8b3c=_0x3b2714;_0x39978a=0xc8;}else{_0x39978a=0xce;}_0x415571[_0x3073('0x19')](_0x39978a);return _0x415571['set'](_0x3073('0x1f'),_0x33cf39+'-'+_0xaa8b3c+'/'+_0x3b2714)['json'](_0x5efc8d);}return null;};}function patchUpdates(_0x5749de){return function(_0x4c3934){try{jsonpatch['apply'](_0x4c3934,_0x5749de,!![]);}catch(_0x3c3712){return BPromise[_0x3073('0x20')](_0x3c3712);}return _0x4c3934['save']();};}function saveUpdates(_0x154028,_0x352b0d){return function(_0x1b3afd){if(_0x1b3afd){return _0x1b3afd[_0x3073('0x21')](_0x154028)[_0x3073('0x22')](function(_0x455736){return _0x455736;});}return null;};}function removeEntity(_0x2091b2,_0x3812ba){return function(_0x19a98f){if(_0x19a98f){return _0x19a98f[_0x3073('0x23')]()['then'](function(){_0x2091b2[_0x3073('0x19')](0xcc)[_0x3073('0x1a')]();});}};}function handleEntityNotFound(_0x5cb529,_0x45edcd){return function(_0x1b3aef){if(!_0x1b3aef){_0x5cb529[_0x3073('0x18')](0x194);}return _0x1b3aef;};}function handleError(_0x1e3b1d,_0x2cebe3){_0x2cebe3=_0x2cebe3||0x1f4;return function(_0xd9c41b){logger[_0x3073('0x24')](_0xd9c41b[_0x3073('0x25')]);if(_0xd9c41b['name']){delete _0xd9c41b[_0x3073('0x26')];}_0x1e3b1d[_0x3073('0x19')](_0x2cebe3)[_0x3073('0x27')](_0xd9c41b);};}exports[_0x3073('0x28')]=function(_0x1fdbcd,_0x484c47){var _0x22cc0f={},_0x1bc498={},_0x5d5dd8={'count':0x0,'rows':[]};var _0x3f9d64=_['map'](db[_0x3073('0x29')][_0x3073('0x2a')],function(_0x384941){return{'name':_0x384941['fieldName'],'type':_0x384941[_0x3073('0x2b')][_0x3073('0x2c')]};});_0x1bc498[_0x3073('0x2d')]=_[_0x3073('0x2e')](_0x3f9d64,_0x3073('0x26'));_0x1bc498[_0x3073('0x2f')]=_[_0x3073('0x30')](_0x1fdbcd['query']);_0x1bc498[_0x3073('0x31')]=_[_0x3073('0x32')](_0x1bc498[_0x3073('0x2d')],_0x1bc498[_0x3073('0x2f')]);_0x22cc0f['attributes']=_[_0x3073('0x32')](_0x1bc498['model'],qs['fields'](_0x1fdbcd[_0x3073('0x2f')]['fields']));_0x22cc0f[_0x3073('0x33')]=_0x22cc0f[_0x3073('0x33')][_0x3073('0x34')]?_0x22cc0f[_0x3073('0x33')]:_0x1bc498['model'];if(!_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x35')]('nolimit')){_0x22cc0f['limit']=qs[_0x3073('0x1e')](_0x1fdbcd['query'][_0x3073('0x1e')]);_0x22cc0f[_0x3073('0x1b')]=qs[_0x3073('0x1b')](_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x1b')]);}_0x22cc0f['order']=qs[_0x3073('0x36')](_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x36')]);_0x22cc0f[_0x3073('0x37')]=qs[_0x3073('0x31')](_[_0x3073('0x38')](_0x1fdbcd[_0x3073('0x2f')],_0x1bc498['filters']),_0x3f9d64);if(_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x39')]){_0x22cc0f[_0x3073('0x37')]=_[_0x3073('0x3a')](_0x22cc0f['where'],{'$or':_['map'](_0x3f9d64,function(_0x53df25){if(_0x53df25[_0x3073('0x2b')]!=='VIRTUAL'){var _0x569153={};_0x569153[_0x53df25[_0x3073('0x26')]]={'$like':'%'+_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x39')]+'%'};return _0x569153;}})});}_0x22cc0f=_['merge']({},_0x22cc0f,_0x1fdbcd[_0x3073('0x3b')]);var _0x4635d8={'where':_0x22cc0f[_0x3073('0x37')]};return db[_0x3073('0x29')]['count'](_0x4635d8)['then'](function(_0x45e63f){_0x5d5dd8[_0x3073('0x1d')]=_0x45e63f;if(_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x3c')]){_0x22cc0f['include']=[{'all':!![]}];}return db[_0x3073('0x29')]['findAll'](_0x22cc0f);})[_0x3073('0x22')](function(_0xa69318){_0x5d5dd8[_0x3073('0x3d')]=_0xa69318;return _0x5d5dd8;})[_0x3073('0x22')](respondWithFilteredResult(_0x484c47,_0x22cc0f))[_0x3073('0x3e')](handleError(_0x484c47,null));};exports['show']=function(_0x5295b4,_0x151f86){var _0x5f2e57={'raw':!![],'where':{'id':_0x5295b4['params']['id']}},_0x54bc1f={};_0x54bc1f[_0x3073('0x2d')]=_[_0x3073('0x30')](db['SquareMessage'][_0x3073('0x2a')]);_0x54bc1f[_0x3073('0x2f')]=_[_0x3073('0x30')](_0x5295b4[_0x3073('0x2f')]);_0x54bc1f[_0x3073('0x31')]=_['intersection'](_0x54bc1f[_0x3073('0x2d')],_0x54bc1f['query']);_0x5f2e57['attributes']=_[_0x3073('0x32')](_0x54bc1f['model'],qs['fields'](_0x5295b4[_0x3073('0x2f')]['fields']));_0x5f2e57[_0x3073('0x33')]=_0x5f2e57['attributes'][_0x3073('0x34')]?_0x5f2e57[_0x3073('0x33')]:_0x54bc1f[_0x3073('0x2d')];if(_0x5295b4[_0x3073('0x2f')][_0x3073('0x3c')]){_0x5f2e57[_0x3073('0x3f')]=[{'all':!![]}];}_0x5f2e57=_[_0x3073('0x3a')]({},_0x5f2e57,_0x5295b4[_0x3073('0x3b')]);return db[_0x3073('0x29')][_0x3073('0x40')](_0x5f2e57)[_0x3073('0x22')](handleEntityNotFound(_0x151f86,null))[_0x3073('0x22')](respondWithResult(_0x151f86,null))[_0x3073('0x3e')](handleError(_0x151f86,null));};exports[_0x3073('0x41')]=function(_0x1885ee,_0x756ff6){return db[_0x3073('0x29')][_0x3073('0x41')](_0x1885ee[_0x3073('0x42')],{})[_0x3073('0x22')](respondWithResult(_0x756ff6,0xc9))['catch'](handleError(_0x756ff6,null));};exports[_0x3073('0x21')]=function(_0xcdd434,_0x329e4a){if(_0xcdd434[_0x3073('0x42')]['id']){delete _0xcdd434[_0x3073('0x42')]['id'];}return db[_0x3073('0x29')]['find']({'where':{'id':_0xcdd434['params']['id']}})['then'](handleEntityNotFound(_0x329e4a,null))['then'](saveUpdates(_0xcdd434['body'],null))['then'](respondWithResult(_0x329e4a,null))[_0x3073('0x3e')](handleError(_0x329e4a,null));};exports[_0x3073('0x23')]=function(_0x4f60a4,_0x2f2830){return db[_0x3073('0x29')][_0x3073('0x40')]({'where':{'id':_0x4f60a4[_0x3073('0x43')]['id']}})[_0x3073('0x22')](handleEntityNotFound(_0x2f2830,null))[_0x3073('0x22')](removeEntity(_0x2f2830,null))[_0x3073('0x3e')](handleError(_0x2f2830,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d2fbf41..6ae4f45 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 _0xbdc8=['SquareMessage','square_messages','util','../../config/logger','api','bluebird','path','../../config/environment','./squareMessage.attributes','define'];(function(_0x3477aa,_0xb32e81){var _0x1210f1=function(_0x1357e1){while(--_0x1357e1){_0x3477aa['push'](_0x3477aa['shift']());}};_0x1210f1(++_0xb32e81);}(_0xbdc8,0xb6));var _0x8bdc=function(_0x3d4740,_0x3c78e0){_0x3d4740=_0x3d4740-0x0;var _0x3b13b5=_0xbdc8[_0x3d4740];return _0x3b13b5;};'use strict';var _=require('lodash');var util=require(_0x8bdc('0x0'));var logger=require(_0x8bdc('0x1'))(_0x8bdc('0x2'));var moment=require('moment');var BPromise=require(_0x8bdc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bdc('0x4'));var rimraf=require('rimraf');var config=require(_0x8bdc('0x5'));var attributes=require(_0x8bdc('0x6'));module['exports']=function(_0x51a463,_0x37fb39){return _0x51a463[_0x8bdc('0x7')](_0x8bdc('0x8'),attributes,{'tableName':_0x8bdc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0120=['rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0x0120,0x172));var _0x0012=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x0120[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x0012('0x0'));var util=require('util');var logger=require(_0x0012('0x1'))(_0x0012('0x2'));var moment=require(_0x0012('0x3'));var BPromise=require(_0x0012('0x4'));var rp=require(_0x0012('0x5'));var fs=require('fs');var path=require(_0x0012('0x6'));var rimraf=require(_0x0012('0x7'));var config=require(_0x0012('0x8'));var attributes=require(_0x0012('0x9'));module[_0x0012('0xa')]=function(_0x29448b,_0x1ccb25){return _0x29448b['define'](_0x0012('0xb'),attributes,{'tableName':_0x0012('0xc'),'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 3344061..be34c52 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 _0x9e0d=['message','catch','CreateSquareMessage','SquareMessage','body','options','then','info','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3fcdf5,_0x503ca0){var _0x2d0786=function(_0x1ee5e2){while(--_0x1ee5e2){_0x3fcdf5['push'](_0x3fcdf5['shift']());}};_0x2d0786(++_0x503ca0);}(_0x9e0d,0x1c2));var _0xd9e0=function(_0x23f02d,_0x147d7c){_0x23f02d=_0x23f02d-0x0;var _0x18b071=_0x9e0d[_0x23f02d];return _0x18b071;};'use strict';var _=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var moment=require(_0xd9e0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9e0('0x3'));var db=require(_0xd9e0('0x4'))['db'];var utils=require(_0xd9e0('0x5'));var logger=require(_0xd9e0('0x6'))(_0xd9e0('0x7'));var config=require(_0xd9e0('0x8'));var jayson=require(_0xd9e0('0x9'));var client=jayson['client'][_0xd9e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x462cd2,_0x537538,_0x485d96){return new BPromise(function(_0x5c108c,_0x251215){return client['request'](_0x462cd2,_0x485d96)['then'](function(_0x4ed90e){logger['info'](_0xd9e0('0xb'),_0x537538,_0xd9e0('0xc'));logger[_0xd9e0('0xd')](_0xd9e0('0xe'),_0x537538,_0xd9e0('0xc'),JSON[_0xd9e0('0xf')](_0x4ed90e));if(_0x4ed90e[_0xd9e0('0x10')]){if(_0x4ed90e[_0xd9e0('0x10')][_0xd9e0('0x11')]===0x1f4){logger[_0xd9e0('0x10')]('SquareMessage,\x20%s,\x20%s',_0x537538,_0x4ed90e[_0xd9e0('0x10')][_0xd9e0('0x12')]);return _0x251215(_0x4ed90e[_0xd9e0('0x10')][_0xd9e0('0x12')]);}logger[_0xd9e0('0x10')](_0xd9e0('0xb'),_0x537538,_0x4ed90e[_0xd9e0('0x10')][_0xd9e0('0x12')]);return _0x5c108c(_0x4ed90e['error']['message']);}else{logger['info'](_0xd9e0('0xb'),_0x537538,'request\x20sent');_0x5c108c(_0x4ed90e['result'][_0xd9e0('0x12')]);}})[_0xd9e0('0x13')](function(_0x1256c2){logger[_0xd9e0('0x10')]('SquareMessage,\x20%s,\x20%s',_0x537538,_0x1256c2);_0x251215(_0x1256c2);});});}exports[_0xd9e0('0x14')]=function(_0x34205c){var _0x549788=this;return new Promise(function(_0x2bc569,_0x3d54e9){return db[_0xd9e0('0x15')]['create'](_0x34205c[_0xd9e0('0x16')],{'raw':_0x34205c[_0xd9e0('0x17')]?_0x34205c['options']['raw']===undefined?!![]:![]:!![]})[_0xd9e0('0x18')](function(_0x145be6){logger[_0xd9e0('0x19')](_0xd9e0('0x14'),_0x34205c);logger[_0xd9e0('0xd')](_0xd9e0('0x14'),_0x34205c,JSON[_0xd9e0('0xf')](_0x145be6));_0x2bc569(_0x145be6);})[_0xd9e0('0x13')](function(_0x587a13){logger[_0xd9e0('0x10')](_0xd9e0('0x14'),_0x587a13[_0xd9e0('0x12')],_0x34205c);_0x3d54e9(_0x549788[_0xd9e0('0x10')](0x1f4,_0x587a13[_0xd9e0('0x12')]));});});}; \ No newline at end of file +var _0x2d16=['body','options','raw','then','debug','stringify','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','error','SquareMessage,\x20%s,\x20%s','message','info','CreateSquareMessage','SquareMessage','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d16,0x166));var _0x62d1=function(_0x244a43,_0x4f7222){_0x244a43=_0x244a43-0x0;var _0x4d1769=_0x2d16[_0x244a43];return _0x4d1769;};'use strict';var _=require('lodash');var util=require(_0x62d1('0x0'));var moment=require(_0x62d1('0x1'));var BPromise=require('bluebird');var rs=require(_0x62d1('0x2'));var fs=require('fs');var Redis=require(_0x62d1('0x3'));var db=require(_0x62d1('0x4'))['db'];var utils=require(_0x62d1('0x5'));var logger=require('../../config/logger')(_0x62d1('0x6'));var config=require(_0x62d1('0x7'));var jayson=require(_0x62d1('0x8'));var client=jayson[_0x62d1('0x9')][_0x62d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4979f9,_0x14ec1d,_0x220905){return new BPromise(function(_0x5c897c,_0x44f152){return client[_0x62d1('0xb')](_0x4979f9,_0x220905)['then'](function(_0x4aaeea){logger['info']('SquareMessage,\x20%s,\x20%s',_0x14ec1d,_0x62d1('0xc'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x14ec1d,_0x62d1('0xc'),JSON['stringify'](_0x4aaeea));if(_0x4aaeea[_0x62d1('0xd')]){if(_0x4aaeea['error']['code']===0x1f4){logger[_0x62d1('0xd')]('SquareMessage,\x20%s,\x20%s',_0x14ec1d,_0x4aaeea[_0x62d1('0xd')]['message']);return _0x44f152(_0x4aaeea['error']['message']);}logger[_0x62d1('0xd')](_0x62d1('0xe'),_0x14ec1d,_0x4aaeea['error'][_0x62d1('0xf')]);return _0x5c897c(_0x4aaeea['error'][_0x62d1('0xf')]);}else{logger[_0x62d1('0x10')](_0x62d1('0xe'),_0x14ec1d,_0x62d1('0xc'));_0x5c897c(_0x4aaeea['result'][_0x62d1('0xf')]);}})['catch'](function(_0x12b0ee){logger[_0x62d1('0xd')](_0x62d1('0xe'),_0x14ec1d,_0x12b0ee);_0x44f152(_0x12b0ee);});});}exports[_0x62d1('0x11')]=function(_0x186451){var _0x2d88fa=this;return new Promise(function(_0x1a3c9a,_0x3bcf56){return db[_0x62d1('0x12')][_0x62d1('0x13')](_0x186451[_0x62d1('0x14')],{'raw':_0x186451[_0x62d1('0x15')]?_0x186451[_0x62d1('0x15')][_0x62d1('0x16')]===undefined?!![]:![]:!![]})[_0x62d1('0x17')](function(_0x5a8490){logger[_0x62d1('0x10')](_0x62d1('0x11'),_0x186451);logger[_0x62d1('0x18')]('CreateSquareMessage',_0x186451,JSON[_0x62d1('0x19')](_0x5a8490));_0x1a3c9a(_0x5a8490);})[_0x62d1('0x1a')](function(_0x314d74){logger[_0x62d1('0xd')](_0x62d1('0x11'),_0x314d74[_0x62d1('0xf')],_0x186451);_0x3bcf56(_0x2d88fa[_0x62d1('0xd')](0x1f4,_0x314d74[_0x62d1('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 56fa172..bbb3601 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 _0x39f7=['../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','test','put','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x39f7,0xf5));var _0x739f=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0x39f7[_0x4e170e];return _0x338291;};'use strict';var multer=require(_0x739f('0x0'));var util=require(_0x739f('0x1'));var path=require(_0x739f('0x2'));var timeout=require(_0x739f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x739f('0x4'));var auth=require(_0x739f('0x5'));var interaction=require(_0x739f('0x6'));var config=require(_0x739f('0x7'));var controller=require(_0x739f('0x8'));router['get']('/',auth[_0x739f('0x9')](),controller[_0x739f('0xa')]);router[_0x739f('0xb')](_0x739f('0xc'),auth[_0x739f('0x9')](),controller[_0x739f('0xd')]);router[_0x739f('0xb')]('/:id/test',auth[_0x739f('0x9')](),timeout('15s'),controller[_0x739f('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x739f('0xf')]('/:id',auth[_0x739f('0x9')](),controller['update']);router[_0x739f('0x10')](_0x739f('0xc'),auth['isAuthenticated'](),controller[_0x739f('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcd3c=['put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','create'];(function(_0xb3bbc8,_0x2a3635){var _0x3254b7=function(_0x823e23){while(--_0x823e23){_0xb3bbc8['push'](_0xb3bbc8['shift']());}};_0x3254b7(++_0x2a3635);}(_0xcd3c,0x12b));var _0xccd3=function(_0x7e6d18,_0x18ef42){_0x7e6d18=_0x7e6d18-0x0;var _0xe547e7=_0xcd3c[_0x7e6d18];return _0xe547e7;};'use strict';var multer=require('multer');var util=require(_0xccd3('0x0'));var path=require(_0xccd3('0x1'));var timeout=require(_0xccd3('0x2'));var express=require('express');var router=express[_0xccd3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xccd3('0x4'));var interaction=require(_0xccd3('0x5'));var config=require(_0xccd3('0x6'));var controller=require(_0xccd3('0x7'));router[_0xccd3('0x8')]('/',auth[_0xccd3('0x9')](),controller[_0xccd3('0xa')]);router[_0xccd3('0x8')](_0xccd3('0xb'),auth[_0xccd3('0x9')](),controller[_0xccd3('0xc')]);router['get'](_0xccd3('0xd'),auth[_0xccd3('0x9')](),timeout(_0xccd3('0xe')),controller['test']);router['post']('/',auth['isAuthenticated'](),controller[_0xccd3('0xf')]);router[_0xccd3('0x10')](_0xccd3('0xb'),auth[_0xccd3('0x9')](),controller[_0xccd3('0x11')]);router[_0xccd3('0x12')](_0xccd3('0xb'),auth['isAuthenticated'](),controller[_0xccd3('0x13')]);module[_0xccd3('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 0247490..81ef50e 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 _0xa194=['sequelize','STRING'];(function(_0x43fb13,_0x30eb18){var _0x1728de=function(_0x4bbf4f){while(--_0x4bbf4f){_0x43fb13['push'](_0x43fb13['shift']());}};_0x1728de(++_0x30eb18);}(_0xa194,0x134));var _0x4a19=function(_0x147f5c,_0x1e5deb){_0x147f5c=_0x147f5c-0x0;var _0x545070=_0xa194[_0x147f5c];return _0x545070;};'use strict';var Sequelize=require(_0x4a19('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a19('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x4a19('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6216=['sequelize','exports','STRING','name'];(function(_0x2e34b1,_0x5dba45){var _0x17ef03=function(_0x234a4d){while(--_0x234a4d){_0x2e34b1['push'](_0x2e34b1['shift']());}};_0x17ef03(++_0x5dba45);}(_0x6216,0x124));var _0x6621=function(_0x4bf70d,_0x1cc11c){_0x4bf70d=_0x4bf70d-0x0;var _0x2c2ecf=_0x6216[_0x4bf70d];return _0x2c2ecf;};'use strict';var Sequelize=require(_0x6621('0x0'));module[_0x6621('0x1')]={'name':{'type':Sequelize[_0x6621('0x2')],'unique':_0x6621('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x6621('0x2')]},'description':{'type':Sequelize[_0x6621('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 661188b..5c019e1 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 _0x7d71=['params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','dsn','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','update','then','destroy','get','ODBC','UserProfileResource','end','error','stack','name','map','SquareOdbc','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show'];(function(_0x2f7fe0,_0x43ed9c){var _0x44e944=function(_0x669714){while(--_0x669714){_0x2f7fe0['push'](_0x2f7fe0['shift']());}};_0x44e944(++_0x43ed9c);}(_0x7d71,0x6a));var _0x17d7=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x7d71[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0x17d7('0x0'));var rimraf=require(_0x17d7('0x1'));var zipdir=require(_0x17d7('0x2'));var jsonpatch=require(_0x17d7('0x3'));var rp=require(_0x17d7('0x4'));var moment=require(_0x17d7('0x5'));var BPromise=require(_0x17d7('0x6'));var Mustache=require(_0x17d7('0x7'));var util=require(_0x17d7('0x8'));var path=require(_0x17d7('0x9'));var sox=require(_0x17d7('0xa'));var csv=require(_0x17d7('0xb'));var ejs=require(_0x17d7('0xc'));var fs=require('fs');var fs_extra=require(_0x17d7('0xd'));var _=require('lodash');var squel=require(_0x17d7('0xe'));var crypto=require(_0x17d7('0xf'));var jsforce=require(_0x17d7('0x10'));var deskjs=require(_0x17d7('0x11'));var toCsv=require('to-csv');var querystring=require(_0x17d7('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x17d7('0x13'));var qs=require(_0x17d7('0x14'));var as=require(_0x17d7('0x15'));var hardwareService=require(_0x17d7('0x16'));var logger=require(_0x17d7('0x17'))(_0x17d7('0x18'));var utils=require(_0x17d7('0x19'));var config=require(_0x17d7('0x1a'));var licenseUtil=require(_0x17d7('0x1b'));var db=require(_0x17d7('0x1c'))['db'];function respondWithStatusCode(_0x32d93f,_0x148bff){_0x148bff=_0x148bff||0xcc;return function(_0x1e52e9){if(_0x1e52e9){return _0x32d93f[_0x17d7('0x1d')](_0x148bff);}return _0x32d93f[_0x17d7('0x1e')](_0x148bff)['end']();};}function respondWithResult(_0x4bb2d4,_0x2427b0){_0x2427b0=_0x2427b0||0xc8;return function(_0x53a3ec){if(_0x53a3ec){return _0x4bb2d4[_0x17d7('0x1e')](_0x2427b0)[_0x17d7('0x1f')](_0x53a3ec);}};}function respondWithFilteredResult(_0x530a99,_0x318d35){return function(_0x1bf324){if(_0x1bf324){var _0x2b11ba=typeof _0x318d35['offset']===_0x17d7('0x20')&&typeof _0x318d35[_0x17d7('0x21')]==='undefined';var _0x13e47e=_0x1bf324['count'];var _0x18310d=_0x2b11ba?0x0:_0x318d35[_0x17d7('0x22')];var _0x568e64=_0x2b11ba?_0x1bf324['count']:_0x318d35[_0x17d7('0x22')]+_0x318d35[_0x17d7('0x21')];var _0x34d911;if(_0x568e64>=_0x13e47e){_0x568e64=_0x13e47e;_0x34d911=0xc8;}else{_0x34d911=0xce;}_0x530a99[_0x17d7('0x1e')](_0x34d911);return _0x530a99[_0x17d7('0x23')](_0x17d7('0x24'),_0x18310d+'-'+_0x568e64+'/'+_0x13e47e)[_0x17d7('0x1f')](_0x1bf324);}return null;};}function patchUpdates(_0x522ccf){return function(_0x96e643){try{jsonpatch[_0x17d7('0x25')](_0x96e643,_0x522ccf,!![]);}catch(_0x3534d7){return BPromise['reject'](_0x3534d7);}return _0x96e643['save']();};}function saveUpdates(_0xf30d96,_0x11c8c5){return function(_0x14c444){if(_0x14c444){return _0x14c444[_0x17d7('0x26')](_0xf30d96)[_0x17d7('0x27')](function(_0x4a4600){return _0x4a4600;});}return null;};}function removeEntity(_0x3c0aca,_0x44ce8c){return function(_0x34de25){if(_0x34de25){return _0x34de25[_0x17d7('0x28')]()['then'](function(){var _0x5eb407=_0x34de25[_0x17d7('0x29')]({'plain':!![]});var _0x513673=_0x17d7('0x2a');return db[_0x17d7('0x2b')][_0x17d7('0x28')]({'where':{'type':_0x513673,'resourceId':_0x5eb407['id']}})['then'](function(){return _0x34de25;});})[_0x17d7('0x27')](function(){_0x3c0aca[_0x17d7('0x1e')](0xcc)[_0x17d7('0x2c')]();});}};}function handleEntityNotFound(_0x35499e,_0x34a46a){return function(_0x48f18d){if(!_0x48f18d){_0x35499e[_0x17d7('0x1d')](0x194);}return _0x48f18d;};}function handleError(_0x452399,_0x405360){_0x405360=_0x405360||0x1f4;return function(_0x3638d3){logger[_0x17d7('0x2d')](_0x3638d3[_0x17d7('0x2e')]);if(_0x3638d3[_0x17d7('0x2f')]){delete _0x3638d3[_0x17d7('0x2f')];}_0x452399[_0x17d7('0x1e')](_0x405360)['send'](_0x3638d3);};}exports['index']=function(_0x1d4443,_0x3163bb){var _0xc599d0={},_0x438bfd={},_0x2837d3={'count':0x0,'rows':[]};var _0x313372=_[_0x17d7('0x30')](db[_0x17d7('0x31')][_0x17d7('0x32')],function(_0x55f866){return{'name':_0x55f866[_0x17d7('0x33')],'type':_0x55f866['type'][_0x17d7('0x34')]};});_0x438bfd[_0x17d7('0x35')]=_['map'](_0x313372,_0x17d7('0x2f'));_0x438bfd['query']=_[_0x17d7('0x36')](_0x1d4443[_0x17d7('0x37')]);_0x438bfd[_0x17d7('0x38')]=_[_0x17d7('0x39')](_0x438bfd[_0x17d7('0x35')],_0x438bfd[_0x17d7('0x37')]);_0xc599d0['attributes']=_['intersection'](_0x438bfd[_0x17d7('0x35')],qs[_0x17d7('0x3a')](_0x1d4443[_0x17d7('0x37')]['fields']));_0xc599d0[_0x17d7('0x3b')]=_0xc599d0[_0x17d7('0x3b')]['length']?_0xc599d0['attributes']:_0x438bfd['model'];if(!_0x1d4443[_0x17d7('0x37')]['hasOwnProperty']('nolimit')){_0xc599d0['limit']=qs[_0x17d7('0x21')](_0x1d4443[_0x17d7('0x37')][_0x17d7('0x21')]);_0xc599d0[_0x17d7('0x22')]=qs[_0x17d7('0x22')](_0x1d4443[_0x17d7('0x37')][_0x17d7('0x22')]);}_0xc599d0[_0x17d7('0x3c')]=qs[_0x17d7('0x3d')](_0x1d4443[_0x17d7('0x37')][_0x17d7('0x3d')]);_0xc599d0[_0x17d7('0x3e')]=qs[_0x17d7('0x38')](_[_0x17d7('0x3f')](_0x1d4443[_0x17d7('0x37')],_0x438bfd[_0x17d7('0x38')]),_0x313372);if(_0x1d4443[_0x17d7('0x37')][_0x17d7('0x40')]){_0xc599d0['where']=_[_0x17d7('0x41')](_0xc599d0[_0x17d7('0x3e')],{'$or':_[_0x17d7('0x30')](_0x313372,function(_0x4e67ce){if(_0x4e67ce[_0x17d7('0x42')]!==_0x17d7('0x43')){var _0x422d87={};_0x422d87[_0x4e67ce['name']]={'$like':'%'+_0x1d4443['query']['filter']+'%'};return _0x422d87;}})});}_0xc599d0=_[_0x17d7('0x41')]({},_0xc599d0,_0x1d4443[_0x17d7('0x44')]);var _0x4adcb3={'where':_0xc599d0['where']};return db[_0x17d7('0x31')][_0x17d7('0x45')](_0x4adcb3)[_0x17d7('0x27')](function(_0x5924b4){_0x2837d3[_0x17d7('0x45')]=_0x5924b4;if(_0x1d4443[_0x17d7('0x37')][_0x17d7('0x46')]){_0xc599d0[_0x17d7('0x47')]=[{'all':!![]}];}return db['SquareOdbc'][_0x17d7('0x48')](_0xc599d0);})[_0x17d7('0x27')](function(_0x5a860a){_0x2837d3[_0x17d7('0x49')]=_0x5a860a;return _0x2837d3;})[_0x17d7('0x27')](respondWithFilteredResult(_0x3163bb,_0xc599d0))[_0x17d7('0x4a')](handleError(_0x3163bb,null));};exports[_0x17d7('0x4b')]=function(_0x55bc6d,_0x59f392){var _0x5e0398={'raw':!![],'where':{'id':_0x55bc6d[_0x17d7('0x4c')]['id']}},_0x3eea1d={};_0x3eea1d[_0x17d7('0x35')]=_[_0x17d7('0x36')](db[_0x17d7('0x31')][_0x17d7('0x32')]);_0x3eea1d[_0x17d7('0x37')]=_[_0x17d7('0x36')](_0x55bc6d['query']);_0x3eea1d[_0x17d7('0x38')]=_['intersection'](_0x3eea1d[_0x17d7('0x35')],_0x3eea1d[_0x17d7('0x37')]);_0x5e0398[_0x17d7('0x3b')]=_[_0x17d7('0x39')](_0x3eea1d[_0x17d7('0x35')],qs[_0x17d7('0x3a')](_0x55bc6d['query'][_0x17d7('0x3a')]));_0x5e0398['attributes']=_0x5e0398['attributes'][_0x17d7('0x4d')]?_0x5e0398[_0x17d7('0x3b')]:_0x3eea1d['model'];if(_0x55bc6d[_0x17d7('0x37')][_0x17d7('0x46')]){_0x5e0398[_0x17d7('0x47')]=[{'all':!![]}];}_0x5e0398=_[_0x17d7('0x41')]({},_0x5e0398,_0x55bc6d[_0x17d7('0x44')]);return db['SquareOdbc'][_0x17d7('0x4e')](_0x5e0398)[_0x17d7('0x27')](handleEntityNotFound(_0x59f392,null))['then'](respondWithResult(_0x59f392,null))[_0x17d7('0x4a')](handleError(_0x59f392,null));};exports[_0x17d7('0x4f')]=function(_0x55492b,_0x2f3768){return db[_0x17d7('0x31')][_0x17d7('0x4f')](_0x55492b[_0x17d7('0x50')],{})[_0x17d7('0x27')](function(_0x3fe286){var _0x335f8c=_0x55492b[_0x17d7('0x51')][_0x17d7('0x29')]({'plain':!![]});if(!_0x335f8c)throw new Error(_0x17d7('0x52'));if(_0x335f8c['role']===_0x17d7('0x51')){var _0x47441c=_0x3fe286[_0x17d7('0x29')]({'plain':!![]});var _0xd61cef=_0x17d7('0x2a');return db[_0x17d7('0x53')][_0x17d7('0x4e')]({'where':{'name':_0xd61cef,'userProfileId':_0x335f8c[_0x17d7('0x54')]},'raw':!![]})[_0x17d7('0x27')](function(_0x4b2146){if(_0x4b2146&&_0x4b2146[_0x17d7('0x55')]===0x0){return db[_0x17d7('0x2b')][_0x17d7('0x4f')]({'name':_0x47441c[_0x17d7('0x2f')],'resourceId':_0x47441c['id'],'type':_0x4b2146[_0x17d7('0x2f')],'sectionId':_0x4b2146['id']},{})[_0x17d7('0x27')](function(){return _0x3fe286;});}else{return _0x3fe286;}})['catch'](function(_0x167b0e){logger['error'](_0x17d7('0x56'),_0x167b0e);throw _0x167b0e;});}return _0x3fe286;})[_0x17d7('0x27')](respondWithResult(_0x2f3768,0xc9))[_0x17d7('0x4a')](handleError(_0x2f3768,null));};exports['update']=function(_0x2608d5,_0x2b2078){if(_0x2608d5[_0x17d7('0x50')]['id']){delete _0x2608d5[_0x17d7('0x50')]['id'];}return db[_0x17d7('0x31')][_0x17d7('0x4e')]({'where':{'id':_0x2608d5[_0x17d7('0x4c')]['id']}})[_0x17d7('0x27')](handleEntityNotFound(_0x2b2078,null))[_0x17d7('0x27')](saveUpdates(_0x2608d5[_0x17d7('0x50')],null))[_0x17d7('0x27')](respondWithResult(_0x2b2078,null))[_0x17d7('0x4a')](handleError(_0x2b2078,null));};exports['destroy']=function(_0x27aeb1,_0x298697){return db[_0x17d7('0x31')]['find']({'where':{'id':_0x27aeb1['params']['id']}})[_0x17d7('0x27')](handleEntityNotFound(_0x298697,null))[_0x17d7('0x27')](removeEntity(_0x298697,null))[_0x17d7('0x4a')](handleError(_0x298697,null));};exports[_0x17d7('0x57')]=function(_0x175f1c,_0x119f3e,_0x5033cf){var _0xca1ae3;return db['SquareOdbc'][_0x17d7('0x4e')]({'where':{'id':_0x175f1c[_0x17d7('0x4c')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x119f3e,null))[_0x17d7('0x27')](function(_0x4c9136){if(_0x4c9136){var _0x497f8c=require(_0x17d7('0x58'))();_0x497f8c[_0x17d7('0x59')](_0x4c9136[_0x17d7('0x5a')]);_0x497f8c['closeSync']();return _0x4c9136;}})[_0x17d7('0x27')](respondWithResult(_0x119f3e,null))[_0x17d7('0x4a')](handleError(_0x119f3e,null));}; \ No newline at end of file +var _0x1e31=['moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','get','ODBC','end','stack','index','map','SquareOdbc','rawAttributes','fieldName','name','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','show','params','includeAll','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','update','find','test','dsn','odbc','openSync','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x39f438,_0x8d21a0){var _0x5eec5a=function(_0x183734){while(--_0x183734){_0x39f438['push'](_0x39f438['shift']());}};_0x5eec5a(++_0x8d21a0);}(_0x1e31,0xf8));var _0x11e3=function(_0xd6d705,_0x28b624){_0xd6d705=_0xd6d705-0x0;var _0x4481bd=_0x1e31[_0xd6d705];return _0x4481bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x11e3('0x0'));var zipdir=require(_0x11e3('0x1'));var jsonpatch=require(_0x11e3('0x2'));var rp=require(_0x11e3('0x3'));var moment=require(_0x11e3('0x4'));var BPromise=require(_0x11e3('0x5'));var Mustache=require(_0x11e3('0x6'));var util=require(_0x11e3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x11e3('0x8'));var ejs=require(_0x11e3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11e3('0xa'));var squel=require(_0x11e3('0xb'));var crypto=require(_0x11e3('0xc'));var jsforce=require(_0x11e3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x11e3('0xe'));var Papa=require(_0x11e3('0xf'));var Redis=require('ioredis');var authService=require(_0x11e3('0x10'));var qs=require(_0x11e3('0x11'));var as=require(_0x11e3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x11e3('0x13'))('api');var utils=require(_0x11e3('0x14'));var config=require(_0x11e3('0x15'));var licenseUtil=require(_0x11e3('0x16'));var db=require(_0x11e3('0x17'))['db'];function respondWithStatusCode(_0x4bbaa1,_0x54db8f){_0x54db8f=_0x54db8f||0xcc;return function(_0x37f30f){if(_0x37f30f){return _0x4bbaa1[_0x11e3('0x18')](_0x54db8f);}return _0x4bbaa1[_0x11e3('0x19')](_0x54db8f)['end']();};}function respondWithResult(_0x5752f2,_0x423e68){_0x423e68=_0x423e68||0xc8;return function(_0x127ae0){if(_0x127ae0){return _0x5752f2['status'](_0x423e68)[_0x11e3('0x1a')](_0x127ae0);}};}function respondWithFilteredResult(_0x327c43,_0x3c9b28){return function(_0x3b42dc){if(_0x3b42dc){var _0x581442=typeof _0x3c9b28[_0x11e3('0x1b')]===_0x11e3('0x1c')&&typeof _0x3c9b28[_0x11e3('0x1d')]==='undefined';var _0xf7f553=_0x3b42dc[_0x11e3('0x1e')];var _0x5dc48f=_0x581442?0x0:_0x3c9b28[_0x11e3('0x1b')];var _0x1d293e=_0x581442?_0x3b42dc[_0x11e3('0x1e')]:_0x3c9b28['offset']+_0x3c9b28[_0x11e3('0x1d')];var _0x3a5f62;if(_0x1d293e>=_0xf7f553){_0x1d293e=_0xf7f553;_0x3a5f62=0xc8;}else{_0x3a5f62=0xce;}_0x327c43[_0x11e3('0x19')](_0x3a5f62);return _0x327c43[_0x11e3('0x1f')](_0x11e3('0x20'),_0x5dc48f+'-'+_0x1d293e+'/'+_0xf7f553)[_0x11e3('0x1a')](_0x3b42dc);}return null;};}function patchUpdates(_0x3dced1){return function(_0x274ad0){try{jsonpatch['apply'](_0x274ad0,_0x3dced1,!![]);}catch(_0x4b119b){return BPromise[_0x11e3('0x21')](_0x4b119b);}return _0x274ad0['save']();};}function saveUpdates(_0x92a4e3,_0x44a34f){return function(_0x334741){if(_0x334741){return _0x334741['update'](_0x92a4e3)['then'](function(_0x42d8e5){return _0x42d8e5;});}return null;};}function removeEntity(_0x1f89f8,_0x3253d6){return function(_0x3a8fc0){if(_0x3a8fc0){return _0x3a8fc0[_0x11e3('0x22')]()[_0x11e3('0x23')](function(){var _0x41164b=_0x3a8fc0[_0x11e3('0x24')]({'plain':!![]});var _0x3a48f2=_0x11e3('0x25');return db['UserProfileResource'][_0x11e3('0x22')]({'where':{'type':_0x3a48f2,'resourceId':_0x41164b['id']}})['then'](function(){return _0x3a8fc0;});})[_0x11e3('0x23')](function(){_0x1f89f8[_0x11e3('0x19')](0xcc)[_0x11e3('0x26')]();});}};}function handleEntityNotFound(_0x5957e9,_0x3c84eb){return function(_0x5945e5){if(!_0x5945e5){_0x5957e9[_0x11e3('0x18')](0x194);}return _0x5945e5;};}function handleError(_0x5ecf71,_0x1ce19f){_0x1ce19f=_0x1ce19f||0x1f4;return function(_0x89e7bb){logger['error'](_0x89e7bb[_0x11e3('0x27')]);if(_0x89e7bb['name']){delete _0x89e7bb['name'];}_0x5ecf71['status'](_0x1ce19f)['send'](_0x89e7bb);};}exports[_0x11e3('0x28')]=function(_0x5686f6,_0x48781d){var _0x571b30={},_0x85d0a3={},_0x765cc={'count':0x0,'rows':[]};var _0x14ffa8=_[_0x11e3('0x29')](db[_0x11e3('0x2a')][_0x11e3('0x2b')],function(_0x26f212){return{'name':_0x26f212[_0x11e3('0x2c')],'type':_0x26f212['type']['key']};});_0x85d0a3['model']=_['map'](_0x14ffa8,_0x11e3('0x2d'));_0x85d0a3[_0x11e3('0x2e')]=_[_0x11e3('0x2f')](_0x5686f6[_0x11e3('0x2e')]);_0x85d0a3['filters']=_[_0x11e3('0x30')](_0x85d0a3['model'],_0x85d0a3[_0x11e3('0x2e')]);_0x571b30[_0x11e3('0x31')]=_['intersection'](_0x85d0a3[_0x11e3('0x32')],qs[_0x11e3('0x33')](_0x5686f6[_0x11e3('0x2e')][_0x11e3('0x33')]));_0x571b30[_0x11e3('0x31')]=_0x571b30[_0x11e3('0x31')][_0x11e3('0x34')]?_0x571b30['attributes']:_0x85d0a3[_0x11e3('0x32')];if(!_0x5686f6[_0x11e3('0x2e')][_0x11e3('0x35')](_0x11e3('0x36'))){_0x571b30[_0x11e3('0x1d')]=qs['limit'](_0x5686f6[_0x11e3('0x2e')][_0x11e3('0x1d')]);_0x571b30['offset']=qs['offset'](_0x5686f6[_0x11e3('0x2e')][_0x11e3('0x1b')]);}_0x571b30[_0x11e3('0x37')]=qs[_0x11e3('0x38')](_0x5686f6[_0x11e3('0x2e')][_0x11e3('0x38')]);_0x571b30[_0x11e3('0x39')]=qs[_0x11e3('0x3a')](_['pick'](_0x5686f6['query'],_0x85d0a3['filters']),_0x14ffa8);if(_0x5686f6['query'][_0x11e3('0x3b')]){_0x571b30[_0x11e3('0x39')]=_[_0x11e3('0x3c')](_0x571b30[_0x11e3('0x39')],{'$or':_['map'](_0x14ffa8,function(_0x51d481){if(_0x51d481[_0x11e3('0x3d')]!==_0x11e3('0x3e')){var _0x1add9e={};_0x1add9e[_0x51d481[_0x11e3('0x2d')]]={'$like':'%'+_0x5686f6['query'][_0x11e3('0x3b')]+'%'};return _0x1add9e;}})});}_0x571b30=_[_0x11e3('0x3c')]({},_0x571b30,_0x5686f6[_0x11e3('0x3f')]);var _0x129692={'where':_0x571b30['where']};return db[_0x11e3('0x2a')][_0x11e3('0x1e')](_0x129692)['then'](function(_0x3c1f8){_0x765cc[_0x11e3('0x1e')]=_0x3c1f8;if(_0x5686f6[_0x11e3('0x2e')]['includeAll']){_0x571b30[_0x11e3('0x40')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x571b30);})[_0x11e3('0x23')](function(_0xe9944a){_0x765cc['rows']=_0xe9944a;return _0x765cc;})[_0x11e3('0x23')](respondWithFilteredResult(_0x48781d,_0x571b30))['catch'](handleError(_0x48781d,null));};exports[_0x11e3('0x41')]=function(_0x7ad6c1,_0x4f674f){var _0x5339d7={'raw':!![],'where':{'id':_0x7ad6c1[_0x11e3('0x42')]['id']}},_0x372ff4={};_0x372ff4[_0x11e3('0x32')]=_[_0x11e3('0x2f')](db[_0x11e3('0x2a')][_0x11e3('0x2b')]);_0x372ff4[_0x11e3('0x2e')]=_[_0x11e3('0x2f')](_0x7ad6c1[_0x11e3('0x2e')]);_0x372ff4[_0x11e3('0x3a')]=_[_0x11e3('0x30')](_0x372ff4[_0x11e3('0x32')],_0x372ff4[_0x11e3('0x2e')]);_0x5339d7[_0x11e3('0x31')]=_['intersection'](_0x372ff4[_0x11e3('0x32')],qs[_0x11e3('0x33')](_0x7ad6c1[_0x11e3('0x2e')]['fields']));_0x5339d7[_0x11e3('0x31')]=_0x5339d7[_0x11e3('0x31')][_0x11e3('0x34')]?_0x5339d7[_0x11e3('0x31')]:_0x372ff4[_0x11e3('0x32')];if(_0x7ad6c1['query'][_0x11e3('0x43')]){_0x5339d7[_0x11e3('0x40')]=[{'all':!![]}];}_0x5339d7=_[_0x11e3('0x3c')]({},_0x5339d7,_0x7ad6c1['options']);return db['SquareOdbc']['find'](_0x5339d7)[_0x11e3('0x23')](handleEntityNotFound(_0x4f674f,null))[_0x11e3('0x23')](respondWithResult(_0x4f674f,null))[_0x11e3('0x44')](handleError(_0x4f674f,null));};exports[_0x11e3('0x45')]=function(_0x33910e,_0x54a261){return db[_0x11e3('0x2a')][_0x11e3('0x45')](_0x33910e[_0x11e3('0x46')],{})[_0x11e3('0x23')](function(_0x4c41d1){var _0x153695=_0x33910e[_0x11e3('0x47')][_0x11e3('0x24')]({'plain':!![]});if(!_0x153695)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x153695[_0x11e3('0x48')]===_0x11e3('0x47')){var _0x4ca23b=_0x4c41d1[_0x11e3('0x24')]({'plain':!![]});var _0x574fe7=_0x11e3('0x25');return db[_0x11e3('0x49')]['find']({'where':{'name':_0x574fe7,'userProfileId':_0x153695[_0x11e3('0x4a')]},'raw':!![]})[_0x11e3('0x23')](function(_0x38c3ac){if(_0x38c3ac&&_0x38c3ac[_0x11e3('0x4b')]===0x0){return db[_0x11e3('0x4c')][_0x11e3('0x45')]({'name':_0x4ca23b[_0x11e3('0x2d')],'resourceId':_0x4ca23b['id'],'type':_0x38c3ac[_0x11e3('0x2d')],'sectionId':_0x38c3ac['id']},{})[_0x11e3('0x23')](function(){return _0x4c41d1;});}else{return _0x4c41d1;}})[_0x11e3('0x44')](function(_0xcf201a){logger[_0x11e3('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcf201a);throw _0xcf201a;});}return _0x4c41d1;})['then'](respondWithResult(_0x54a261,0xc9))[_0x11e3('0x44')](handleError(_0x54a261,null));};exports[_0x11e3('0x4e')]=function(_0x2900df,_0x44352f){if(_0x2900df[_0x11e3('0x46')]['id']){delete _0x2900df[_0x11e3('0x46')]['id'];}return db[_0x11e3('0x2a')][_0x11e3('0x4f')]({'where':{'id':_0x2900df[_0x11e3('0x42')]['id']}})[_0x11e3('0x23')](handleEntityNotFound(_0x44352f,null))[_0x11e3('0x23')](saveUpdates(_0x2900df[_0x11e3('0x46')],null))['then'](respondWithResult(_0x44352f,null))[_0x11e3('0x44')](handleError(_0x44352f,null));};exports['destroy']=function(_0x33f402,_0x4e1bd8){return db[_0x11e3('0x2a')][_0x11e3('0x4f')]({'where':{'id':_0x33f402['params']['id']}})[_0x11e3('0x23')](handleEntityNotFound(_0x4e1bd8,null))['then'](removeEntity(_0x4e1bd8,null))[_0x11e3('0x44')](handleError(_0x4e1bd8,null));};exports[_0x11e3('0x50')]=function(_0x1cc243,_0x80a46d,_0x1d9dd7){var _0x4dbf96;return db['SquareOdbc'][_0x11e3('0x4f')]({'where':{'id':_0x1cc243[_0x11e3('0x42')]['id']},'attributes':['id',_0x11e3('0x51')]})['then'](handleEntityNotFound(_0x80a46d,null))[_0x11e3('0x23')](function(_0x394d53){if(_0x394d53){var _0x5a173c=require(_0x11e3('0x52'))();_0x5a173c[_0x11e3('0x53')](_0x394d53[_0x11e3('0x51')]);_0x5a173c['closeSync']();return _0x394d53;}})['then'](respondWithResult(_0x80a46d,null))[_0x11e3('0x44')](handleError(_0x80a46d,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e67e0ee..478d5da 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 _0x2754=['request-promise','path','rimraf','exports','square_odbc','lodash','../../config/logger','moment','bluebird'];(function(_0x5d839c,_0x58bd08){var _0x50ae12=function(_0x1bd6d2){while(--_0x1bd6d2){_0x5d839c['push'](_0x5d839c['shift']());}};_0x50ae12(++_0x58bd08);}(_0x2754,0x95));var _0x4275=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0x2754[_0x1e5068];return _0x2230b6;};'use strict';var _=require(_0x4275('0x0'));var util=require('util');var logger=require(_0x4275('0x1'))('api');var moment=require(_0x4275('0x2'));var BPromise=require(_0x4275('0x3'));var rp=require(_0x4275('0x4'));var fs=require('fs');var path=require(_0x4275('0x5'));var rimraf=require(_0x4275('0x6'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x4275('0x7')]=function(_0x34ba58,_0x30e373){return _0x34ba58['define']('SquareOdbc',attributes,{'tableName':_0x4275('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8e4=['SquareOdbc','square_odbc','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb8e4,0x1e2));var _0x4b8e=function(_0x214a83,_0x198004){_0x214a83=_0x214a83-0x0;var _0x549ab1=_0xb8e4[_0x214a83];return _0x549ab1;};'use strict';var _=require('lodash');var util=require(_0x4b8e('0x0'));var logger=require(_0x4b8e('0x1'))(_0x4b8e('0x2'));var moment=require(_0x4b8e('0x3'));var BPromise=require(_0x4b8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4b8e('0x5'));var config=require(_0x4b8e('0x6'));var attributes=require(_0x4b8e('0x7'));module[_0x4b8e('0x8')]=function(_0x24c0be,_0x2e228e){return _0x24c0be[_0x4b8e('0x9')](_0x4b8e('0xa'),attributes,{'tableName':_0x4b8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 029ba2f..3bfadb2 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 _0x88d4=['util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','find','options','raw','where','include','model','attributes','map','lodash'];(function(_0x4f96e0,_0x44cc8b){var _0x2b1744=function(_0x1b0918){while(--_0x1b0918){_0x4f96e0['push'](_0x4f96e0['shift']());}};_0x2b1744(++_0x44cc8b);}(_0x88d4,0x192));var _0x488d=function(_0x5e367b,_0x5ed549){_0x5e367b=_0x5e367b-0x0;var _0x34cb72=_0x88d4[_0x5e367b];return _0x34cb72;};'use strict';var _=require(_0x488d('0x0'));var util=require(_0x488d('0x1'));var moment=require(_0x488d('0x2'));var BPromise=require('bluebird');var rs=require(_0x488d('0x3'));var fs=require('fs');var Redis=require(_0x488d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x488d('0x5'));var logger=require('../../config/logger')(_0x488d('0x6'));var config=require(_0x488d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x488d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x370f95,_0x353d0f,_0x2ac528){return new BPromise(function(_0x1ac4a0,_0x139c6f){return client[_0x488d('0x9')](_0x370f95,_0x2ac528)[_0x488d('0xa')](function(_0x5ca0d1){logger[_0x488d('0xb')](_0x488d('0xc'),_0x353d0f,_0x488d('0xd'));logger[_0x488d('0xe')](_0x488d('0xf'),_0x353d0f,_0x488d('0xd'),JSON[_0x488d('0x10')](_0x5ca0d1));if(_0x5ca0d1[_0x488d('0x11')]){if(_0x5ca0d1[_0x488d('0x11')][_0x488d('0x12')]===0x1f4){logger[_0x488d('0x11')](_0x488d('0xc'),_0x353d0f,_0x5ca0d1[_0x488d('0x11')][_0x488d('0x13')]);return _0x139c6f(_0x5ca0d1[_0x488d('0x11')][_0x488d('0x13')]);}logger[_0x488d('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x353d0f,_0x5ca0d1[_0x488d('0x11')][_0x488d('0x13')]);return _0x1ac4a0(_0x5ca0d1[_0x488d('0x11')][_0x488d('0x13')]);}else{logger['info'](_0x488d('0xc'),_0x353d0f,_0x488d('0xd'));_0x1ac4a0(_0x5ca0d1[_0x488d('0x14')][_0x488d('0x13')]);}})[_0x488d('0x15')](function(_0xf8301b){logger[_0x488d('0x11')](_0x488d('0xc'),_0x353d0f,_0xf8301b);_0x139c6f(_0xf8301b);});});}exports[_0x488d('0x16')]=function(_0x13d3b2){var _0x1a0093=this;return new Promise(function(_0x30971f,_0x3a6b85){return db['SquareOdbc'][_0x488d('0x17')]({'raw':_0x13d3b2[_0x488d('0x18')]?_0x13d3b2[_0x488d('0x18')][_0x488d('0x19')]===undefined?!![]:![]:!![],'where':_0x13d3b2[_0x488d('0x18')]?_0x13d3b2['options'][_0x488d('0x1a')]||null:null,'attributes':_0x13d3b2['options']?_0x13d3b2[_0x488d('0x18')]['attributes']||null:null,'include':_0x13d3b2[_0x488d('0x18')]?_0x13d3b2['options'][_0x488d('0x1b')]?_['map'](_0x13d3b2[_0x488d('0x18')][_0x488d('0x1b')],function(_0x4c88e3){return{'model':db[_0x4c88e3[_0x488d('0x1c')]],'as':_0x4c88e3['as'],'attributes':_0x4c88e3[_0x488d('0x1d')],'include':_0x4c88e3[_0x488d('0x1b')]?_[_0x488d('0x1e')](_0x4c88e3[_0x488d('0x1b')],function(_0x14b443){return{'model':db[_0x14b443[_0x488d('0x1c')]],'as':_0x14b443['as'],'attributes':_0x14b443[_0x488d('0x1d')],'include':_0x14b443[_0x488d('0x1b')]?_[_0x488d('0x1e')](_0x14b443[_0x488d('0x1b')],function(_0x2e05e9){return{'model':db[_0x2e05e9['model']],'as':_0x2e05e9['as'],'attributes':_0x2e05e9['attributes']};}):[]};}):[]};}):[]:[]})[_0x488d('0xa')](function(_0x4ebdef){logger['info'](_0x488d('0x16'),_0x13d3b2);logger[_0x488d('0xe')](_0x488d('0x16'),_0x13d3b2,JSON['stringify'](_0x4ebdef));_0x30971f(_0x4ebdef);})[_0x488d('0x15')](function(_0x232d8e){logger['error'](_0x488d('0x16'),_0x232d8e['message'],_0x13d3b2);_0x3a6b85(_0x1a0093[_0x488d('0x11')](0x1f4,_0x232d8e[_0x488d('0x13')]));});});}; \ No newline at end of file +var _0x8565=['client','http','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise'];(function(_0x2b2094,_0x59e69d){var _0x3d56ff=function(_0x138bdf){while(--_0x138bdf){_0x2b2094['push'](_0x2b2094['shift']());}};_0x3d56ff(++_0x59e69d);}(_0x8565,0xc5));var _0x5856=function(_0x34259d,_0x31f72b){_0x34259d=_0x34259d-0x0;var _0x48a15c=_0x8565[_0x34259d];return _0x48a15c;};'use strict';var _=require(_0x5856('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5856('0x1'));var rs=require(_0x5856('0x2'));var fs=require('fs');var Redis=require(_0x5856('0x3'));var db=require(_0x5856('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5856('0x5'));var client=jayson[_0x5856('0x6')][_0x5856('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x47c114,_0x37410d,_0x401abd){return new BPromise(function(_0x2318f3,_0x2f5e4a){return client['request'](_0x47c114,_0x401abd)['then'](function(_0x5bf948){logger[_0x5856('0x8')](_0x5856('0x9'),_0x37410d,_0x5856('0xa'));logger[_0x5856('0xb')](_0x5856('0xc'),_0x37410d,_0x5856('0xa'),JSON[_0x5856('0xd')](_0x5bf948));if(_0x5bf948['error']){if(_0x5bf948['error'][_0x5856('0xe')]===0x1f4){logger[_0x5856('0xf')](_0x5856('0x9'),_0x37410d,_0x5bf948['error']['message']);return _0x2f5e4a(_0x5bf948['error']['message']);}logger[_0x5856('0xf')](_0x5856('0x9'),_0x37410d,_0x5bf948[_0x5856('0xf')][_0x5856('0x10')]);return _0x2318f3(_0x5bf948[_0x5856('0xf')][_0x5856('0x10')]);}else{logger['info'](_0x5856('0x9'),_0x37410d,_0x5856('0xa'));_0x2318f3(_0x5bf948[_0x5856('0x11')][_0x5856('0x10')]);}})[_0x5856('0x12')](function(_0x52825c){logger[_0x5856('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x37410d,_0x52825c);_0x2f5e4a(_0x52825c);});});}exports[_0x5856('0x13')]=function(_0x4c1029){var _0x886f78=this;return new Promise(function(_0x3b4065,_0x4afccd){return db[_0x5856('0x14')][_0x5856('0x15')]({'raw':_0x4c1029[_0x5856('0x16')]?_0x4c1029[_0x5856('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4c1029[_0x5856('0x16')]?_0x4c1029[_0x5856('0x16')][_0x5856('0x17')]||null:null,'attributes':_0x4c1029[_0x5856('0x16')]?_0x4c1029[_0x5856('0x16')][_0x5856('0x18')]||null:null,'include':_0x4c1029[_0x5856('0x16')]?_0x4c1029['options'][_0x5856('0x19')]?_[_0x5856('0x1a')](_0x4c1029['options']['include'],function(_0x26f082){return{'model':db[_0x26f082['model']],'as':_0x26f082['as'],'attributes':_0x26f082[_0x5856('0x18')],'include':_0x26f082[_0x5856('0x19')]?_['map'](_0x26f082[_0x5856('0x19')],function(_0x1163c4){return{'model':db[_0x1163c4[_0x5856('0x1b')]],'as':_0x1163c4['as'],'attributes':_0x1163c4[_0x5856('0x18')],'include':_0x1163c4[_0x5856('0x19')]?_[_0x5856('0x1a')](_0x1163c4['include'],function(_0x428562){return{'model':db[_0x428562[_0x5856('0x1b')]],'as':_0x428562['as'],'attributes':_0x428562[_0x5856('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5856('0x1c')](function(_0x24d2fd){logger[_0x5856('0x8')](_0x5856('0x13'),_0x4c1029);logger[_0x5856('0xb')]('ShowSquareOdbc',_0x4c1029,JSON['stringify'](_0x24d2fd));_0x3b4065(_0x24d2fd);})[_0x5856('0x12')](function(_0xa5a0c8){logger[_0x5856('0xf')](_0x5856('0x13'),_0xa5a0c8[_0x5856('0x10')],_0x4c1029);_0x4afccd(_0x886f78[_0x5856('0xf')](0x1f4,_0xa5a0c8['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a0ef9f7..957a29c 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 _0x9589=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./squareProject.controller','isAuthenticated','index','get','/:id','post','create','put'];(function(_0x49cecf,_0x4270f){var _0x155c49=function(_0x546d4c){while(--_0x546d4c){_0x49cecf['push'](_0x49cecf['shift']());}};_0x155c49(++_0x4270f);}(_0x9589,0x10e));var _0x9958=function(_0x564ec1,_0x2a0f57){_0x564ec1=_0x564ec1-0x0;var _0x323392=_0x9589[_0x564ec1];return _0x323392;};'use strict';var multer=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var path=require(_0x9958('0x2'));var timeout=require(_0x9958('0x3'));var express=require(_0x9958('0x4'));var router=express['Router']();var fs_extra=require(_0x9958('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9958('0x6'));var config=require('../../config/environment');var controller=require(_0x9958('0x7'));router['get']('/',auth[_0x9958('0x8')](),controller[_0x9958('0x9')]);router[_0x9958('0xa')](_0x9958('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9958('0xc')]('/',auth[_0x9958('0x8')](),controller[_0x9958('0xd')]);router[_0x9958('0xe')](_0x9958('0xb'),auth[_0x9958('0x8')](),controller[_0x9958('0xf')]);router[_0x9958('0x10')](_0x9958('0xb'),auth[_0x9958('0x8')](),controller[_0x9958('0x11')]);module[_0x9958('0x12')]=router; \ No newline at end of file +var _0x085c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x21090b,_0x39dd3b){var _0x3c68d7=function(_0x28ecd4){while(--_0x28ecd4){_0x21090b['push'](_0x21090b['shift']());}};_0x3c68d7(++_0x39dd3b);}(_0x085c,0x9d));var _0xc085=function(_0x1142da,_0x4ee9cb){_0x1142da=_0x1142da-0x0;var _0x234ff9=_0x085c[_0x1142da];return _0x234ff9;};'use strict';var multer=require(_0xc085('0x0'));var util=require(_0xc085('0x1'));var path=require(_0xc085('0x2'));var timeout=require(_0xc085('0x3'));var express=require(_0xc085('0x4'));var router=express[_0xc085('0x5')]();var fs_extra=require(_0xc085('0x6'));var auth=require(_0xc085('0x7'));var interaction=require(_0xc085('0x8'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0xc085('0x9')]('/',auth['isAuthenticated'](),controller[_0xc085('0xa')]);router[_0xc085('0x9')](_0xc085('0xb'),auth[_0xc085('0xc')](),controller[_0xc085('0xd')]);router[_0xc085('0xe')]('/',auth['isAuthenticated'](),controller[_0xc085('0xf')]);router[_0xc085('0x10')](_0xc085('0xb'),auth[_0xc085('0xc')](),controller[_0xc085('0x11')]);router['delete']('/:id',auth[_0xc085('0xc')](),controller[_0xc085('0x12')]);module[_0xc085('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 79f2ea8..3030fd6 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 _0x6a45=['production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8'];(function(_0x130516,_0x5e43d4){var _0x2b4880=function(_0x4c8868){while(--_0x4c8868){_0x130516['push'](_0x130516['shift']());}};_0x2b4880(++_0x5e43d4);}(_0x6a45,0x147));var _0x56a4=function(_0x6d5f29,_0x57d533){_0x6d5f29=_0x6d5f29-0x0;var _0x1b4e4d=_0x6a45[_0x6d5f29];return _0x1b4e4d;};'use strict';var Sequelize=require(_0x56a4('0x0'));module[_0x56a4('0x1')]={'name':{'type':Sequelize[_0x56a4('0x2')],'unique':_0x56a4('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x56a4('0x4')]},'preproduction':{'type':Sequelize[_0x56a4('0x5')](_0x56a4('0x6')),'get':function(){if(this[_0x56a4('0x7')](_0x56a4('0x8'))){return this[_0x56a4('0x7')]('preproduction')[_0x56a4('0x9')](_0x56a4('0xa'));}}},'production':{'type':Sequelize[_0x56a4('0x5')](_0x56a4('0x6')),'get':function(){if(this[_0x56a4('0x7')]('production')){return this[_0x56a4('0x7')](_0x56a4('0xb'))[_0x56a4('0x9')](_0x56a4('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x56a4('0xc')]}}; \ No newline at end of file +var _0xa4a9=['DATE','exports','STRING','name','BLOB','getDataValue','preproduction','utf8','long','production','toString'];(function(_0x49e006,_0x4b8386){var _0x7980c1=function(_0x22d9a5){while(--_0x22d9a5){_0x49e006['push'](_0x49e006['shift']());}};_0x7980c1(++_0x4b8386);}(_0xa4a9,0x7a));var _0x9a4a=function(_0x1af482,_0x1af5b7){_0x1af482=_0x1af482-0x0;var _0x7e7580=_0xa4a9[_0x1af482];return _0x7e7580;};'use strict';var Sequelize=require('sequelize');module[_0x9a4a('0x0')]={'name':{'type':Sequelize[_0x9a4a('0x1')],'unique':_0x9a4a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9a4a('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x9a4a('0x3')]('long'),'get':function(){if(this[_0x9a4a('0x4')](_0x9a4a('0x5'))){return this[_0x9a4a('0x4')](_0x9a4a('0x5'))['toString'](_0x9a4a('0x6'));}}},'production':{'type':Sequelize['BLOB'](_0x9a4a('0x7')),'get':function(){if(this[_0x9a4a('0x4')](_0x9a4a('0x8'))){return this[_0x9a4a('0x4')](_0x9a4a('0x8'))[_0x9a4a('0x9')](_0x9a4a('0x6'));}}},'savedAt':{'type':Sequelize[_0x9a4a('0xa')]},'publishedAt':{'type':Sequelize[_0x9a4a('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2f0ebb1..d6549de 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 _0x5822=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','publish','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','limit','count','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','agi','stringify','sendStatus','name','send','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','pick','filter','merge','where','options','include','findAll','rows','catch','show','params','SquareProject','rawAttributes','includeAll','find'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x5822,0x1d0));var _0x2582=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x5822[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0x2582('0x0'));var Redis=require(_0x2582('0x1'));var qs=require(_0x2582('0x2'));var logger=require(_0x2582('0x3'))(_0x2582('0x4'));var config=require(_0x2582('0x5'));var db=require('../../mysqldb')['db'];config[_0x2582('0x6')]=_[_0x2582('0x7')](config[_0x2582('0x6')],{'host':_0x2582('0x8'),'port':0x18eb});var socket=require(_0x2582('0x9'))(new Redis(config[_0x2582('0x6')]));require('./squareProject.socket')[_0x2582('0xa')](socket);function respondWithResult(_0x57fa48,_0x18aaa0){_0x18aaa0=_0x18aaa0||0xc8;return function(_0x5c876a){if(_0x5c876a){return _0x57fa48[_0x2582('0xb')](_0x18aaa0)[_0x2582('0xc')](_0x5c876a);}};}function respondWithFilteredResult(_0x47d716,_0x380abb){return function(_0x3ba3d3){if(_0x3ba3d3){var _0x1ad745=typeof _0x380abb[_0x2582('0xd')]==='undefined'&&typeof _0x380abb[_0x2582('0xe')]==='undefined';var _0xf581b5=_0x3ba3d3[_0x2582('0xf')];var _0x1299ce=_0x1ad745?0x0:_0x380abb['offset'];var _0x1a0e02=_0x1ad745?_0x3ba3d3[_0x2582('0xf')]:_0x380abb[_0x2582('0xd')]+_0x380abb[_0x2582('0xe')];var _0x286e09;if(_0x1a0e02>=_0xf581b5){_0x1a0e02=_0xf581b5;_0x286e09=0xc8;}else{_0x286e09=0xce;}_0x47d716['status'](_0x286e09);return _0x47d716['set'](_0x2582('0x10'),_0x1299ce+'-'+_0x1a0e02+'/'+_0xf581b5)[_0x2582('0xc')](_0x3ba3d3);}return null;};}function saveUpdates(_0x161aac){return function(_0xb38cbe){if(_0xb38cbe){return _0xb38cbe[_0x2582('0x11')](_0x161aac)[_0x2582('0x12')](function(_0x2522e4){return _0x2522e4;});}return null;};}function removeEntity(_0x54ecc7){return function(_0x5d84d9){if(_0x5d84d9){return _0x5d84d9[_0x2582('0x13')]()['then'](function(){var _0x4e3ca5=_0x5d84d9[_0x2582('0x14')]({'plain':!![]});var _0x4b441c=_0x2582('0x15');return db[_0x2582('0x16')][_0x2582('0x13')]({'where':{'type':_0x4b441c,'resourceId':_0x4e3ca5['id']}})['then'](function(){return _0x5d84d9;});})[_0x2582('0x12')](function(){var _0x3bc1c2=new Redis(config[_0x2582('0x6')]);_0x3bc1c2['publish'](_0x2582('0x17'),JSON[_0x2582('0x18')]({'id':_0x5d84d9['id'],'deleted':!![]}));})[_0x2582('0x12')](function(){_0x54ecc7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38eb33){return function(_0x4514b2){if(!_0x4514b2){_0x38eb33[_0x2582('0x19')](0x194);}return _0x4514b2;};}function handleError(_0x1eac50,_0x4dc6f9){_0x4dc6f9=_0x4dc6f9||0x1f4;return function(_0x2095f2){logger['error'](_0x2095f2['stack']);if(_0x2095f2[_0x2582('0x1a')]){delete _0x2095f2[_0x2582('0x1a')];}_0x1eac50[_0x2582('0xb')](_0x4dc6f9)[_0x2582('0x1b')](_0x2095f2);};}exports[_0x2582('0x1c')]=function(_0x4be127,_0x2f3c30){var _0x4c089b={},_0x5e6901={},_0x2d07ce={'count':0x0,'rows':[]};var _0x1960d=_[_0x2582('0x1d')](db['SquareProject']['rawAttributes'],function(_0x24a7a6){return{'name':_0x24a7a6['fieldName'],'type':_0x24a7a6[_0x2582('0x1e')][_0x2582('0x1f')]};});_0x5e6901[_0x2582('0x20')]=_['map'](_0x1960d,_0x2582('0x1a'));_0x5e6901[_0x2582('0x21')]=_[_0x2582('0x22')](_0x4be127['query']);_0x5e6901[_0x2582('0x23')]=_['intersection'](_0x5e6901['model'],_0x5e6901[_0x2582('0x21')]);_0x4c089b[_0x2582('0x24')]=_[_0x2582('0x25')](_0x5e6901['model'],qs[_0x2582('0x26')](_0x4be127[_0x2582('0x21')][_0x2582('0x26')]));_0x4c089b[_0x2582('0x24')]=_0x4c089b['attributes']['length']?_0x4c089b[_0x2582('0x24')]:_0x5e6901[_0x2582('0x20')];if(!_0x4be127[_0x2582('0x21')][_0x2582('0x27')]('nolimit')){_0x4c089b[_0x2582('0xe')]=qs[_0x2582('0xe')](_0x4be127[_0x2582('0x21')][_0x2582('0xe')]);_0x4c089b[_0x2582('0xd')]=qs[_0x2582('0xd')](_0x4be127['query'][_0x2582('0xd')]);}_0x4c089b[_0x2582('0x28')]=qs['sort'](_0x4be127[_0x2582('0x21')]['sort']);_0x4c089b['where']=qs[_0x2582('0x23')](_[_0x2582('0x29')](_0x4be127[_0x2582('0x21')],_0x5e6901['filters']),_0x1960d);if(_0x4be127[_0x2582('0x21')][_0x2582('0x2a')]){_0x4c089b['where']=_[_0x2582('0x2b')](_0x4c089b[_0x2582('0x2c')],{'$or':_[_0x2582('0x1d')](_0x1960d,function(_0x2c6adf){if(_0x2c6adf['type']!=='VIRTUAL'){var _0x1832b6={};_0x1832b6[_0x2c6adf[_0x2582('0x1a')]]={'$like':'%'+_0x4be127[_0x2582('0x21')][_0x2582('0x2a')]+'%'};return _0x1832b6;}})});}_0x4c089b=_[_0x2582('0x2b')]({},_0x4c089b,_0x4be127[_0x2582('0x2d')]);var _0x360163={'where':_0x4c089b[_0x2582('0x2c')]};return db['SquareProject'][_0x2582('0xf')](_0x360163)[_0x2582('0x12')](function(_0x4c90e2){_0x2d07ce[_0x2582('0xf')]=_0x4c90e2;if(_0x4be127[_0x2582('0x21')]['includeAll']){_0x4c089b[_0x2582('0x2e')]=[{'all':!![]}];}return db['SquareProject'][_0x2582('0x2f')](_0x4c089b);})['then'](function(_0x2d6309){_0x2d07ce[_0x2582('0x30')]=_0x2d6309;return _0x2d07ce;})[_0x2582('0x12')](respondWithFilteredResult(_0x2f3c30,_0x4c089b))[_0x2582('0x31')](handleError(_0x2f3c30,null));};exports[_0x2582('0x32')]=function(_0x311536,_0x11d2df){var _0x435ad9={'raw':![],'where':{'id':_0x311536[_0x2582('0x33')]['id']}},_0x2ec63e={};_0x2ec63e[_0x2582('0x20')]=_['keys'](db[_0x2582('0x34')][_0x2582('0x35')]);_0x2ec63e[_0x2582('0x21')]=_[_0x2582('0x22')](_0x311536[_0x2582('0x21')]);_0x2ec63e[_0x2582('0x23')]=_[_0x2582('0x25')](_0x2ec63e[_0x2582('0x20')],_0x2ec63e['query']);_0x435ad9['attributes']=_[_0x2582('0x25')](_0x2ec63e[_0x2582('0x20')],qs[_0x2582('0x26')](_0x311536[_0x2582('0x21')][_0x2582('0x26')]));_0x435ad9[_0x2582('0x24')]=_0x435ad9[_0x2582('0x24')]['length']?_0x435ad9['attributes']:_0x2ec63e['model'];if(_0x311536['query'][_0x2582('0x36')]){_0x435ad9[_0x2582('0x2e')]=[{'all':!![]}];}_0x435ad9=_[_0x2582('0x2b')]({},_0x435ad9,_0x311536[_0x2582('0x2d')]);return db[_0x2582('0x34')][_0x2582('0x37')](_0x435ad9)[_0x2582('0x12')](handleEntityNotFound(_0x11d2df,null))[_0x2582('0x12')](respondWithResult(_0x11d2df,null))[_0x2582('0x31')](handleError(_0x11d2df,null));};exports[_0x2582('0x38')]=function(_0x4ac586,_0x3231b8){return db['SquareProject'][_0x2582('0x38')](_0x4ac586[_0x2582('0x39')],{})[_0x2582('0x12')](function(_0x2e947f){var _0xd7f4ac=_0x4ac586['user'][_0x2582('0x14')]({'plain':!![]});if(!_0xd7f4ac)throw new Error(_0x2582('0x3a'));if(_0xd7f4ac[_0x2582('0x3b')]==='user'){var _0x379ee7=_0x2e947f['get']({'plain':!![]});var _0x2edb73=_0x2582('0x15');return db[_0x2582('0x3c')]['find']({'where':{'name':_0x2edb73,'userProfileId':_0xd7f4ac[_0x2582('0x3d')]},'raw':!![]})['then'](function(_0x411bd3){if(_0x411bd3&&_0x411bd3['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x379ee7['name'],'resourceId':_0x379ee7['id'],'type':_0x411bd3[_0x2582('0x1a')],'sectionId':_0x411bd3['id']},{})[_0x2582('0x12')](function(){return _0x2e947f;});}else{return _0x2e947f;}})[_0x2582('0x31')](function(_0xcb7859){logger[_0x2582('0x3e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcb7859);throw _0xcb7859;});}return _0x2e947f;})[_0x2582('0x12')](respondWithResult(_0x3231b8,0xc9))[_0x2582('0x31')](handleError(_0x3231b8,null));};exports[_0x2582('0x11')]=function(_0x903b9a,_0x5215c4){if(_0x903b9a['body']['id']){delete _0x903b9a[_0x2582('0x39')]['id'];}return db[_0x2582('0x34')][_0x2582('0x37')]({'where':{'id':_0x903b9a[_0x2582('0x33')]['id']}})[_0x2582('0x12')](handleEntityNotFound(_0x5215c4,null))[_0x2582('0x12')](saveUpdates(_0x903b9a[_0x2582('0x39')],null))['then'](function(_0x4429a4){if(!_0x4429a4)return;var _0x678748=_0x4429a4[_0x2582('0x14')]({'plain':!![]});return _0x678748;})[_0x2582('0x12')](function(_0x3e607e){var _0x531fa2=new Redis(config['redis']);_0x531fa2[_0x2582('0x3f')]('agi',JSON[_0x2582('0x18')](_[_0x2582('0x29')](_0x3e607e,['id',_0x2582('0x1a'),_0x2582('0x40')])));return _0x3e607e;})['then'](respondWithResult(_0x5215c4,null))[_0x2582('0x31')](handleError(_0x5215c4,null));};exports[_0x2582('0x13')]=function(_0x2c99da,_0x20899a){return db[_0x2582('0x34')][_0x2582('0x37')]({'where':{'id':_0x2c99da['params']['id']}})['then'](handleEntityNotFound(_0x20899a,null))['then'](removeEntity(_0x20899a,null))['catch'](handleError(_0x20899a,null));}; \ No newline at end of file +var _0x312c=['length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','options','SquareProject','includeAll','include','findAll','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','production','lodash','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','get','UserProfileResource','publish','agi','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','intersection','query','attributes','fields'];(function(_0xd377bb,_0x1a5855){var _0x46dfcc=function(_0x2bac33){while(--_0x2bac33){_0xd377bb['push'](_0xd377bb['shift']());}};_0x46dfcc(++_0x1a5855);}(_0x312c,0x1cb));var _0xc312=function(_0x46f96c,_0x52c349){_0x46f96c=_0x46f96c-0x0;var _0x40e5c3=_0x312c[_0x46f96c];return _0x40e5c3;};'use strict';var _=require(_0xc312('0x0'));var Redis=require('ioredis');var qs=require(_0xc312('0x1'));var logger=require('../../config/logger')(_0xc312('0x2'));var config=require(_0xc312('0x3'));var db=require('../../mysqldb')['db'];config[_0xc312('0x4')]=_[_0xc312('0x5')](config[_0xc312('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xc312('0x6'))(new Redis(config[_0xc312('0x4')]));require(_0xc312('0x7'))['register'](socket);function respondWithResult(_0x169418,_0x483f8d){_0x483f8d=_0x483f8d||0xc8;return function(_0xca95a8){if(_0xca95a8){return _0x169418[_0xc312('0x8')](_0x483f8d)[_0xc312('0x9')](_0xca95a8);}};}function respondWithFilteredResult(_0x20493f,_0x551c53){return function(_0x47b93f){if(_0x47b93f){var _0x1177e1=typeof _0x551c53[_0xc312('0xa')]===_0xc312('0xb')&&typeof _0x551c53['limit']===_0xc312('0xb');var _0x47be31=_0x47b93f['count'];var _0x1f0e20=_0x1177e1?0x0:_0x551c53[_0xc312('0xa')];var _0x487811=_0x1177e1?_0x47b93f[_0xc312('0xc')]:_0x551c53[_0xc312('0xa')]+_0x551c53['limit'];var _0x1c5d31;if(_0x487811>=_0x47be31){_0x487811=_0x47be31;_0x1c5d31=0xc8;}else{_0x1c5d31=0xce;}_0x20493f[_0xc312('0x8')](_0x1c5d31);return _0x20493f[_0xc312('0xd')](_0xc312('0xe'),_0x1f0e20+'-'+_0x487811+'/'+_0x47be31)[_0xc312('0x9')](_0x47b93f);}return null;};}function saveUpdates(_0x7d9686){return function(_0x246356){if(_0x246356){return _0x246356[_0xc312('0xf')](_0x7d9686)[_0xc312('0x10')](function(_0x4e5c77){return _0x4e5c77;});}return null;};}function removeEntity(_0x5c2d47){return function(_0x14ce34){if(_0x14ce34){return _0x14ce34[_0xc312('0x11')]()[_0xc312('0x10')](function(){var _0x1f5445=_0x14ce34[_0xc312('0x12')]({'plain':!![]});var _0xcfea22='SquareProjects';return db[_0xc312('0x13')][_0xc312('0x11')]({'where':{'type':_0xcfea22,'resourceId':_0x1f5445['id']}})[_0xc312('0x10')](function(){return _0x14ce34;});})[_0xc312('0x10')](function(){var _0x34b12c=new Redis(config[_0xc312('0x4')]);_0x34b12c[_0xc312('0x14')](_0xc312('0x15'),JSON['stringify']({'id':_0x14ce34['id'],'deleted':!![]}));})[_0xc312('0x10')](function(){_0x5c2d47[_0xc312('0x8')](0xcc)[_0xc312('0x16')]();});}};}function handleEntityNotFound(_0x22855c){return function(_0x15192a){if(!_0x15192a){_0x22855c['sendStatus'](0x194);}return _0x15192a;};}function handleError(_0x41fa18,_0x3d565b){_0x3d565b=_0x3d565b||0x1f4;return function(_0x329189){logger[_0xc312('0x17')](_0x329189[_0xc312('0x18')]);if(_0x329189[_0xc312('0x19')]){delete _0x329189[_0xc312('0x19')];}_0x41fa18[_0xc312('0x8')](_0x3d565b)[_0xc312('0x1a')](_0x329189);};}exports[_0xc312('0x1b')]=function(_0x3e8225,_0x55e9bb){var _0x3324a8={},_0x7f6dd={},_0x3cbbc0={'count':0x0,'rows':[]};var _0x11a06b=_['map'](db['SquareProject'][_0xc312('0x1c')],function(_0x54e6af){return{'name':_0x54e6af[_0xc312('0x1d')],'type':_0x54e6af['type'][_0xc312('0x1e')]};});_0x7f6dd[_0xc312('0x1f')]=_[_0xc312('0x20')](_0x11a06b,_0xc312('0x19'));_0x7f6dd['query']=_[_0xc312('0x21')](_0x3e8225['query']);_0x7f6dd['filters']=_[_0xc312('0x22')](_0x7f6dd['model'],_0x7f6dd[_0xc312('0x23')]);_0x3324a8[_0xc312('0x24')]=_[_0xc312('0x22')](_0x7f6dd[_0xc312('0x1f')],qs[_0xc312('0x25')](_0x3e8225[_0xc312('0x23')][_0xc312('0x25')]));_0x3324a8['attributes']=_0x3324a8[_0xc312('0x24')][_0xc312('0x26')]?_0x3324a8[_0xc312('0x24')]:_0x7f6dd[_0xc312('0x1f')];if(!_0x3e8225['query'][_0xc312('0x27')](_0xc312('0x28'))){_0x3324a8[_0xc312('0x29')]=qs[_0xc312('0x29')](_0x3e8225[_0xc312('0x23')][_0xc312('0x29')]);_0x3324a8['offset']=qs[_0xc312('0xa')](_0x3e8225[_0xc312('0x23')][_0xc312('0xa')]);}_0x3324a8[_0xc312('0x2a')]=qs[_0xc312('0x2b')](_0x3e8225['query'][_0xc312('0x2b')]);_0x3324a8[_0xc312('0x2c')]=qs[_0xc312('0x2d')](_[_0xc312('0x2e')](_0x3e8225[_0xc312('0x23')],_0x7f6dd[_0xc312('0x2d')]),_0x11a06b);if(_0x3e8225[_0xc312('0x23')][_0xc312('0x2f')]){_0x3324a8[_0xc312('0x2c')]=_[_0xc312('0x30')](_0x3324a8[_0xc312('0x2c')],{'$or':_['map'](_0x11a06b,function(_0x305476){if(_0x305476[_0xc312('0x31')]!=='VIRTUAL'){var _0x56034c={};_0x56034c[_0x305476[_0xc312('0x19')]]={'$like':'%'+_0x3e8225[_0xc312('0x23')][_0xc312('0x2f')]+'%'};return _0x56034c;}})});}_0x3324a8=_[_0xc312('0x30')]({},_0x3324a8,_0x3e8225[_0xc312('0x32')]);var _0x373c8b={'where':_0x3324a8[_0xc312('0x2c')]};return db[_0xc312('0x33')][_0xc312('0xc')](_0x373c8b)[_0xc312('0x10')](function(_0x33bfb1){_0x3cbbc0[_0xc312('0xc')]=_0x33bfb1;if(_0x3e8225[_0xc312('0x23')][_0xc312('0x34')]){_0x3324a8[_0xc312('0x35')]=[{'all':!![]}];}return db[_0xc312('0x33')][_0xc312('0x36')](_0x3324a8);})['then'](function(_0x4fde25){_0x3cbbc0[_0xc312('0x37')]=_0x4fde25;return _0x3cbbc0;})[_0xc312('0x10')](respondWithFilteredResult(_0x55e9bb,_0x3324a8))['catch'](handleError(_0x55e9bb,null));};exports[_0xc312('0x38')]=function(_0x40bde4,_0x526b9e){var _0x28746e={'raw':![],'where':{'id':_0x40bde4[_0xc312('0x39')]['id']}},_0xd2e016={};_0xd2e016[_0xc312('0x1f')]=_['keys'](db[_0xc312('0x33')][_0xc312('0x1c')]);_0xd2e016[_0xc312('0x23')]=_[_0xc312('0x21')](_0x40bde4['query']);_0xd2e016[_0xc312('0x2d')]=_[_0xc312('0x22')](_0xd2e016['model'],_0xd2e016['query']);_0x28746e[_0xc312('0x24')]=_['intersection'](_0xd2e016['model'],qs[_0xc312('0x25')](_0x40bde4[_0xc312('0x23')][_0xc312('0x25')]));_0x28746e[_0xc312('0x24')]=_0x28746e['attributes'][_0xc312('0x26')]?_0x28746e[_0xc312('0x24')]:_0xd2e016[_0xc312('0x1f')];if(_0x40bde4[_0xc312('0x23')]['includeAll']){_0x28746e[_0xc312('0x35')]=[{'all':!![]}];}_0x28746e=_['merge']({},_0x28746e,_0x40bde4['options']);return db['SquareProject'][_0xc312('0x3a')](_0x28746e)[_0xc312('0x10')](handleEntityNotFound(_0x526b9e,null))[_0xc312('0x10')](respondWithResult(_0x526b9e,null))[_0xc312('0x3b')](handleError(_0x526b9e,null));};exports[_0xc312('0x3c')]=function(_0x511b46,_0x38037d){return db[_0xc312('0x33')]['create'](_0x511b46[_0xc312('0x3d')],{})['then'](function(_0x1d9ae7){var _0x583d0c=_0x511b46['user'][_0xc312('0x12')]({'plain':!![]});if(!_0x583d0c)throw new Error(_0xc312('0x3e'));if(_0x583d0c[_0xc312('0x3f')]==='user'){var _0x2648ec=_0x1d9ae7[_0xc312('0x12')]({'plain':!![]});var _0x192dd7=_0xc312('0x40');return db[_0xc312('0x41')][_0xc312('0x3a')]({'where':{'name':_0x192dd7,'userProfileId':_0x583d0c[_0xc312('0x42')]},'raw':!![]})['then'](function(_0x3db388){if(_0x3db388&&_0x3db388[_0xc312('0x43')]===0x0){return db['UserProfileResource'][_0xc312('0x3c')]({'name':_0x2648ec[_0xc312('0x19')],'resourceId':_0x2648ec['id'],'type':_0x3db388[_0xc312('0x19')],'sectionId':_0x3db388['id']},{})['then'](function(){return _0x1d9ae7;});}else{return _0x1d9ae7;}})[_0xc312('0x3b')](function(_0x439f65){logger[_0xc312('0x17')](_0xc312('0x44'),_0x439f65);throw _0x439f65;});}return _0x1d9ae7;})[_0xc312('0x10')](respondWithResult(_0x38037d,0xc9))[_0xc312('0x3b')](handleError(_0x38037d,null));};exports[_0xc312('0xf')]=function(_0x3368ca,_0x47cc98){if(_0x3368ca[_0xc312('0x3d')]['id']){delete _0x3368ca['body']['id'];}return db[_0xc312('0x33')]['find']({'where':{'id':_0x3368ca['params']['id']}})[_0xc312('0x10')](handleEntityNotFound(_0x47cc98,null))['then'](saveUpdates(_0x3368ca['body'],null))['then'](function(_0x573e53){if(!_0x573e53)return;var _0x43baea=_0x573e53[_0xc312('0x12')]({'plain':!![]});return _0x43baea;})[_0xc312('0x10')](function(_0x38f794){var _0x1322a0=new Redis(config['redis']);_0x1322a0[_0xc312('0x14')](_0xc312('0x15'),JSON[_0xc312('0x45')](_[_0xc312('0x2e')](_0x38f794,['id',_0xc312('0x19'),_0xc312('0x46')])));return _0x38f794;})[_0xc312('0x10')](respondWithResult(_0x47cc98,null))[_0xc312('0x3b')](handleError(_0x47cc98,null));};exports[_0xc312('0x11')]=function(_0x5c6b90,_0x2e59ea){return db['SquareProject'][_0xc312('0x3a')]({'where':{'id':_0x5c6b90['params']['id']}})[_0xc312('0x10')](handleEntityNotFound(_0x2e59ea,null))[_0xc312('0x10')](removeEntity(_0x2e59ea,null))[_0xc312('0x3b')](handleError(_0x2e59ea,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 7f8c81f..ac42cf0 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 _0x5034=['SquareProject','setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x40692d,_0x57f514){var _0x450bea=function(_0x5c9127){while(--_0x5c9127){_0x40692d['push'](_0x40692d['shift']());}};_0x450bea(++_0x57f514);}(_0x5034,0xbe));var _0x4503=function(_0x40e091,_0x465bd9){_0x40e091=_0x40e091-0x0;var _0x88e14a=_0x5034[_0x40e091];return _0x88e14a;};'use strict';var EventEmitter=require(_0x4503('0x0'));var SquareProject=require(_0x4503('0x1'))['db'][_0x4503('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4503('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4503('0x4'),'afterDestroy':'remove'};function emitEvent(_0x18e1f2){return function(_0x253dc7,_0x1dbde8,_0x4c9db4){SquareProjectEvents[_0x4503('0x5')](_0x18e1f2+':'+_0x253dc7['id'],_0x253dc7);SquareProjectEvents[_0x4503('0x5')](_0x18e1f2,_0x253dc7);_0x4c9db4(null);};}for(var e in events){if(events[_0x4503('0x6')](e)){var event=events[e];SquareProject[_0x4503('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x0979=['update','remove','emit','hasOwnProperty','events','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x21404a,_0x4fffed){var _0x13ac55=function(_0x1448a5){while(--_0x1448a5){_0x21404a['push'](_0x21404a['shift']());}};_0x13ac55(++_0x4fffed);}(_0x0979,0x11b));var _0x9097=function(_0x77d286,_0x1ddc6d){_0x77d286=_0x77d286-0x0;var _0x5446a5=_0x0979[_0x77d286];return _0x5446a5;};'use strict';var EventEmitter=require(_0x9097('0x0'));var SquareProject=require(_0x9097('0x1'))['db'][_0x9097('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9097('0x3')](0x0);var events={'afterCreate':_0x9097('0x4'),'afterUpdate':_0x9097('0x5'),'afterDestroy':_0x9097('0x6')};function emitEvent(_0x3fb850){return function(_0x634674,_0x23fe0f,_0x360128){SquareProjectEvents[_0x9097('0x7')](_0x3fb850+':'+_0x634674['id'],_0x634674);SquareProjectEvents[_0x9097('0x7')](_0x3fb850,_0x634674);_0x360128(null);};}for(var e in events){if(events[_0x9097('0x8')](e)){var event=events[e];SquareProject['hook'](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 8e93fe2..84f4397 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 _0xc791=['bluebird','rimraf','../../config/environment','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x41a70a,_0x4d49bd){var _0x14f609=function(_0x58325d){while(--_0x58325d){_0x41a70a['push'](_0x41a70a['shift']());}};_0x14f609(++_0x4d49bd);}(_0xc791,0x1b5));var _0x1c79=function(_0xbe5e95,_0x499866){_0xbe5e95=_0xbe5e95-0x0;var _0x1fe535=_0xc791[_0xbe5e95];return _0x1fe535;};'use strict';var _=require(_0x1c79('0x0'));var util=require(_0x1c79('0x1'));var logger=require(_0x1c79('0x2'))(_0x1c79('0x3'));var moment=require(_0x1c79('0x4'));var BPromise=require(_0x1c79('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1c79('0x6'));var config=require(_0x1c79('0x7'));var attributes=require('./squareProject.attributes');module[_0x1c79('0x8')]=function(_0x1910a7,_0x321c39){return _0x1910a7[_0x1c79('0x9')](_0x1c79('0xa'),attributes,{'tableName':_0x1c79('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46acac,_0x3f6dbd,_0x4755c1){if(_0x46acac[_0x1c79('0xc')](_0x1c79('0xd'))){_0x46acac[_0x1c79('0xe')]=moment()[_0x1c79('0xf')](_0x1c79('0x10'));}if(_0x46acac[_0x1c79('0xc')]('production')){_0x46acac['publishedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4755c1(null,_0x46acac);}}});}; \ No newline at end of file +var _0x4d2a=['format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','square_projects','changed','preproduction','savedAt'];(function(_0x5248eb,_0x53288a){var _0x326a3a=function(_0x54b6f3){while(--_0x54b6f3){_0x5248eb['push'](_0x5248eb['shift']());}};_0x326a3a(++_0x53288a);}(_0x4d2a,0x17e));var _0xa4d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d2a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa4d2('0x0'));var util=require(_0xa4d2('0x1'));var logger=require(_0xa4d2('0x2'))(_0xa4d2('0x3'));var moment=require(_0xa4d2('0x4'));var BPromise=require('bluebird');var rp=require(_0xa4d2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4d2('0x6'));var config=require(_0xa4d2('0x7'));var attributes=require(_0xa4d2('0x8'));module[_0xa4d2('0x9')]=function(_0x189b37,_0x1d72dd){return _0x189b37['define']('SquareProject',attributes,{'tableName':_0xa4d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e66a8,_0xc0a521,_0x3535fd){if(_0x4e66a8[_0xa4d2('0xb')](_0xa4d2('0xc'))){_0x4e66a8[_0xa4d2('0xd')]=moment()[_0xa4d2('0xe')](_0xa4d2('0xf'));}if(_0x4e66a8[_0xa4d2('0xb')](_0xa4d2('0x10'))){_0x4e66a8[_0xa4d2('0x11')]=moment()[_0xa4d2('0xe')](_0xa4d2('0xf'));}_0x3535fd(null,_0x4e66a8);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 9711e2d..1803107 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 _0x10f3=['where','attributes','limit','include','map','model','info','debug','stringify','catch','error','message','ShowSquareProject','find','then','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetSquareProjects','SquareProject','options','raw'];(function(_0x281194,_0x33caae){var _0x4975e3=function(_0x31360a){while(--_0x31360a){_0x281194['push'](_0x281194['shift']());}};_0x4975e3(++_0x33caae);}(_0x10f3,0x1c2));var _0x310f=function(_0x2e6f64,_0x28cdad){_0x2e6f64=_0x2e6f64-0x0;var _0x151045=_0x10f3[_0x2e6f64];return _0x151045;};'use strict';var _=require('lodash');var Redis=require(_0x310f('0x0'));var db=require(_0x310f('0x1'))['db'];var logger=require(_0x310f('0x2'))(_0x310f('0x3'));var config=require(_0x310f('0x4'));config[_0x310f('0x5')]=_[_0x310f('0x6')](config[_0x310f('0x5')],{'host':_0x310f('0x7'),'port':0x18eb});var socket=require(_0x310f('0x8'))(new Redis(config[_0x310f('0x5')]));require('./squareProject.socket')[_0x310f('0x9')](socket);exports[_0x310f('0xa')]=function(_0x5b9ee1){var _0x369f67=this;return new Promise(function(_0xe74903,_0x18799a){return db[_0x310f('0xb')]['findAll']({'raw':_0x5b9ee1[_0x310f('0xc')]?_0x5b9ee1[_0x310f('0xc')][_0x310f('0xd')]===undefined?!![]:![]:!![],'where':_0x5b9ee1[_0x310f('0xc')]?_0x5b9ee1['options'][_0x310f('0xe')]||null:null,'attributes':_0x5b9ee1['options']?_0x5b9ee1[_0x310f('0xc')][_0x310f('0xf')]||null:null,'limit':_0x5b9ee1['options']?_0x5b9ee1[_0x310f('0xc')][_0x310f('0x10')]||null:null,'include':_0x5b9ee1[_0x310f('0xc')]?_0x5b9ee1['options'][_0x310f('0x11')]?_[_0x310f('0x12')](_0x5b9ee1[_0x310f('0xc')][_0x310f('0x11')],function(_0x13dd61){return{'model':db[_0x13dd61['model']],'as':_0x13dd61['as'],'attributes':_0x13dd61[_0x310f('0xf')],'include':_0x13dd61['include']?_[_0x310f('0x12')](_0x13dd61[_0x310f('0x11')],function(_0x4df5c2){return{'model':db[_0x4df5c2['model']],'as':_0x4df5c2['as'],'attributes':_0x4df5c2[_0x310f('0xf')],'include':_0x4df5c2[_0x310f('0x11')]?_['map'](_0x4df5c2[_0x310f('0x11')],function(_0x4deae0){return{'model':db[_0x4deae0[_0x310f('0x13')]],'as':_0x4deae0['as'],'attributes':_0x4deae0[_0x310f('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x566865){logger[_0x310f('0x14')](_0x310f('0xa'),_0x5b9ee1);logger[_0x310f('0x15')]('GetSquareProjects',_0x5b9ee1,JSON[_0x310f('0x16')](_0x566865));_0xe74903(_0x566865);})[_0x310f('0x17')](function(_0x53cd42){logger[_0x310f('0x18')]('GetSquareProjects',_0x53cd42[_0x310f('0x19')],_0x5b9ee1);_0x18799a(_0x369f67[_0x310f('0x18')](0x1f4,_0x53cd42[_0x310f('0x19')]));});});};exports[_0x310f('0x1a')]=function(_0x105d99){var _0x5e877b=this;return new Promise(function(_0x458898,_0x12155f){return db[_0x310f('0xb')][_0x310f('0x1b')]({'raw':_0x105d99['options']?_0x105d99[_0x310f('0xc')][_0x310f('0xd')]===undefined?!![]:![]:!![],'where':_0x105d99[_0x310f('0xc')]?_0x105d99[_0x310f('0xc')][_0x310f('0xe')]||null:null,'attributes':_0x105d99['options']?_0x105d99[_0x310f('0xc')][_0x310f('0xf')]||null:null,'include':_0x105d99[_0x310f('0xc')]?_0x105d99['options']['include']?_[_0x310f('0x12')](_0x105d99[_0x310f('0xc')]['include'],function(_0x185608){return{'model':db[_0x185608['model']],'as':_0x185608['as'],'attributes':_0x185608[_0x310f('0xf')],'include':_0x185608[_0x310f('0x11')]?_[_0x310f('0x12')](_0x185608[_0x310f('0x11')],function(_0x18ac2a){return{'model':db[_0x18ac2a[_0x310f('0x13')]],'as':_0x18ac2a['as'],'attributes':_0x18ac2a['attributes'],'include':_0x18ac2a[_0x310f('0x11')]?_[_0x310f('0x12')](_0x18ac2a[_0x310f('0x11')],function(_0x2274c9){return{'model':db[_0x2274c9['model']],'as':_0x2274c9['as'],'attributes':_0x2274c9[_0x310f('0xf')]};}):[]};}):[]};}):[]:[]})[_0x310f('0x1c')](function(_0x5c4abf){logger['info']('ShowSquareProject',_0x105d99);logger[_0x310f('0x15')]('ShowSquareProject',_0x105d99,JSON[_0x310f('0x16')](_0x5c4abf));_0x458898(_0x5c4abf);})[_0x310f('0x17')](function(_0xfb6144){logger[_0x310f('0x18')](_0x310f('0x1a'),_0xfb6144[_0x310f('0x19')],_0x105d99);_0x12155f(_0x5e877b[_0x310f('0x18')](0x1f4,_0xfb6144[_0x310f('0x19')]));});});}; \ No newline at end of file +var _0xfbda=['attributes','then','info','debug','stringify','error','find','ShowSquareProject','message','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','limit','include','map','model'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xfbda,0xdb));var _0xafbd=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xfbda[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0xafbd('0x0'));var Redis=require(_0xafbd('0x1'));var db=require(_0xafbd('0x2'))['db'];var logger=require(_0xafbd('0x3'))(_0xafbd('0x4'));var config=require(_0xafbd('0x5'));config[_0xafbd('0x6')]=_[_0xafbd('0x7')](config[_0xafbd('0x6')],{'host':_0xafbd('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xafbd('0x6')]));require(_0xafbd('0x9'))[_0xafbd('0xa')](socket);exports[_0xafbd('0xb')]=function(_0x295bae){var _0x409a0c=this;return new Promise(function(_0x1e169c,_0x1798e1){return db[_0xafbd('0xc')][_0xafbd('0xd')]({'raw':_0x295bae['options']?_0x295bae[_0xafbd('0xe')][_0xafbd('0xf')]===undefined?!![]:![]:!![],'where':_0x295bae['options']?_0x295bae[_0xafbd('0xe')][_0xafbd('0x10')]||null:null,'attributes':_0x295bae[_0xafbd('0xe')]?_0x295bae[_0xafbd('0xe')]['attributes']||null:null,'limit':_0x295bae[_0xafbd('0xe')]?_0x295bae[_0xafbd('0xe')][_0xafbd('0x11')]||null:null,'include':_0x295bae[_0xafbd('0xe')]?_0x295bae['options'][_0xafbd('0x12')]?_[_0xafbd('0x13')](_0x295bae[_0xafbd('0xe')][_0xafbd('0x12')],function(_0x35c0bf){return{'model':db[_0x35c0bf[_0xafbd('0x14')]],'as':_0x35c0bf['as'],'attributes':_0x35c0bf[_0xafbd('0x15')],'include':_0x35c0bf[_0xafbd('0x12')]?_['map'](_0x35c0bf['include'],function(_0x141ff7){return{'model':db[_0x141ff7[_0xafbd('0x14')]],'as':_0x141ff7['as'],'attributes':_0x141ff7[_0xafbd('0x15')],'include':_0x141ff7['include']?_[_0xafbd('0x13')](_0x141ff7['include'],function(_0x3a1903){return{'model':db[_0x3a1903['model']],'as':_0x3a1903['as'],'attributes':_0x3a1903['attributes']};}):[]};}):[]};}):[]:[]})[_0xafbd('0x16')](function(_0x1eaab4){logger[_0xafbd('0x17')]('GetSquareProjects',_0x295bae);logger[_0xafbd('0x18')](_0xafbd('0xb'),_0x295bae,JSON[_0xafbd('0x19')](_0x1eaab4));_0x1e169c(_0x1eaab4);})['catch'](function(_0x179265){logger[_0xafbd('0x1a')](_0xafbd('0xb'),_0x179265['message'],_0x295bae);_0x1798e1(_0x409a0c['error'](0x1f4,_0x179265['message']));});});};exports['ShowSquareProject']=function(_0x35c2e5){var _0x1eeb35=this;return new Promise(function(_0x1ac78f,_0x2bee5d){return db[_0xafbd('0xc')][_0xafbd('0x1b')]({'raw':_0x35c2e5['options']?_0x35c2e5[_0xafbd('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x35c2e5[_0xafbd('0xe')]?_0x35c2e5[_0xafbd('0xe')][_0xafbd('0x10')]||null:null,'attributes':_0x35c2e5[_0xafbd('0xe')]?_0x35c2e5['options']['attributes']||null:null,'include':_0x35c2e5[_0xafbd('0xe')]?_0x35c2e5['options'][_0xafbd('0x12')]?_[_0xafbd('0x13')](_0x35c2e5[_0xafbd('0xe')][_0xafbd('0x12')],function(_0x138aff){return{'model':db[_0x138aff[_0xafbd('0x14')]],'as':_0x138aff['as'],'attributes':_0x138aff['attributes'],'include':_0x138aff[_0xafbd('0x12')]?_['map'](_0x138aff[_0xafbd('0x12')],function(_0x5034a5){return{'model':db[_0x5034a5[_0xafbd('0x14')]],'as':_0x5034a5['as'],'attributes':_0x5034a5[_0xafbd('0x15')],'include':_0x5034a5[_0xafbd('0x12')]?_['map'](_0x5034a5[_0xafbd('0x12')],function(_0x560d8f){return{'model':db[_0x560d8f['model']],'as':_0x560d8f['as'],'attributes':_0x560d8f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xa010ff){logger[_0xafbd('0x17')]('ShowSquareProject',_0x35c2e5);logger[_0xafbd('0x18')](_0xafbd('0x1c'),_0x35c2e5,JSON['stringify'](_0xa010ff));_0x1ac78f(_0xa010ff);})['catch'](function(_0x4cb64e){logger[_0xafbd('0x1a')]('ShowSquareProject',_0x4cb64e[_0xafbd('0x1d')],_0x35c2e5);_0x2bee5d(_0x1eeb35[_0xafbd('0x1a')](0x1f4,_0x4cb64e[_0xafbd('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 42c5cdb..98d1514 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 _0x63a2=['length','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x63a2,0x1de));var _0x263a=function(_0x56b0d6,_0x42763a){_0x56b0d6=_0x56b0d6-0x0;var _0x2db4a8=_0x63a2[_0x56b0d6];return _0x2db4a8;};'use strict';var SquareProjectEvents=require(_0x263a('0x0'));var events=[_0x263a('0x1'),_0x263a('0x2'),_0x263a('0x3')];function createListener(_0x4cfb67,_0x4caa0f){return function(_0x557e7e){_0x4caa0f[_0x263a('0x4')](_0x4cfb67,_0x557e7e);};}function removeListener(_0x3bee66,_0x22f134){return function(){SquareProjectEvents['removeListener'](_0x3bee66,_0x22f134);};}exports['register']=function(_0x116cca){for(var _0x329988=0x0,_0x291524=events[_0x263a('0x5')];_0x329988<_0x291524;_0x329988++){var _0xe0c612=events[_0x329988];var _0x146272=createListener(_0x263a('0x6')+_0xe0c612,_0x116cca);SquareProjectEvents['on'](_0xe0c612,_0x146272);}}; \ No newline at end of file +var _0xc135=['removeListener','length','squareProject:','save','remove','emit'];(function(_0x20bd7b,_0x29a620){var _0x55a0eb=function(_0x5d948){while(--_0x5d948){_0x20bd7b['push'](_0x20bd7b['shift']());}};_0x55a0eb(++_0x29a620);}(_0xc135,0x189));var _0x5c13=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc135[_0x14add3];return _0x4a174f;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x5c13('0x0'),_0x5c13('0x1'),'update'];function createListener(_0x28268a,_0x16cb34){return function(_0x22ed72){_0x16cb34[_0x5c13('0x2')](_0x28268a,_0x22ed72);};}function removeListener(_0x2e4402,_0x4395d0){return function(){SquareProjectEvents[_0x5c13('0x3')](_0x2e4402,_0x4395d0);};}exports['register']=function(_0x19ec5a){for(var _0x1cf640=0x0,_0x4be116=events[_0x5c13('0x4')];_0x1cf640<_0x4be116;_0x1cf640++){var _0x26bf8d=events[_0x1cf640];var _0x286d09=createListener(_0x5c13('0x5')+_0x26bf8d,_0x19ec5a);SquareProjectEvents['on'](_0x26bf8d,_0x286d09);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index c32020d..fb5e145 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1e4ae5,_0x16a3e1){var _0x5833e0=function(_0x1f8846){while(--_0x1f8846){_0x1e4ae5['push'](_0x1e4ae5['shift']());}};_0x5833e0(++_0x16a3e1);}(_0x4975,0x86));var _0x5497=function(_0x4e4901,_0x25d270){_0x4e4901=_0x4e4901-0x0;var _0x35f20b=_0x4975[_0x4e4901];return _0x35f20b;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x1f0977,_0x2d9db6){var _0x3fcee6=function(_0x1bb9cd){while(--_0x1bb9cd){_0x1f0977['push'](_0x1f0977['shift']());}};_0x3fcee6(++_0x2d9db6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0x5fc3[_0x5f1617];return _0x3af5da;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 357ba2b..0ed1678 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 _0x8958=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x8958,0x93));var _0x8895=function(_0x35a8bc,_0x1933af){_0x35a8bc=_0x35a8bc-0x0;var _0x9a52f2=_0x8958[_0x35a8bc];return _0x9a52f2;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8895('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8895('0x1')]},'dnid':{'type':Sequelize[_0x8895('0x1')]},'projectName':{'type':Sequelize[_0x8895('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8895('0x1')]},'savePath':{'type':Sequelize[_0x8895('0x1')]},'format':{'type':Sequelize[_0x8895('0x2')],'get':function(){var _0x40cec6='';var _0x33013a=this['getDataValue'](_0x8895('0x3'));if(_0x33013a){_0x40cec6=_0x33013a[_0x8895('0x4')](_0x33013a[_0x8895('0x5')]('.'));}return _0x40cec6;}}}; \ No newline at end of file +var _0xed1f=['lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','substring'];(function(_0x4c6cf0,_0x826f70){var _0x108145=function(_0x299f69){while(--_0x299f69){_0x4c6cf0['push'](_0x4c6cf0['shift']());}};_0x108145(++_0x826f70);}(_0xed1f,0x6a));var _0xfed1=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xed1f[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'callerid':{'type':Sequelize[_0xfed1('0x2')]},'calleridname':{'type':Sequelize[_0xfed1('0x2')]},'context':{'type':Sequelize[_0xfed1('0x2')]},'extension':{'type':Sequelize[_0xfed1('0x2')]},'priority':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize[_0xfed1('0x2')]},'dnid':{'type':Sequelize[_0xfed1('0x2')]},'projectName':{'type':Sequelize[_0xfed1('0x2')]},'saveName':{'type':Sequelize[_0xfed1('0x2')]},'filename':{'type':Sequelize[_0xfed1('0x2')]},'savePath':{'type':Sequelize[_0xfed1('0x2')]},'format':{'type':Sequelize[_0xfed1('0x3')],'get':function(){var _0x612b38='';var _0x2a6082=this[_0xfed1('0x4')]('savePath');if(_0x2a6082){_0x612b38=_0x2a6082[_0xfed1('0x5')](_0x2a6082[_0xfed1('0x6')]('.'));}return _0x612b38;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b81258c..9db48b7 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 _0xe4e8=['VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','create','body','find','download','../../components/encryptor','uniqueid','filename','savePath','format','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','sort','pick','filter','where','merge'];(function(_0x5f3ae3,_0x2b383d){var _0x4d454e=function(_0x27f57d){while(--_0x27f57d){_0x5f3ae3['push'](_0x5f3ae3['shift']());}};_0x4d454e(++_0x2b383d);}(_0xe4e8,0xf2));var _0x8e4e=function(_0x20bfea,_0x3ecd0f){_0x20bfea=_0x20bfea-0x0;var _0x332a90=_0xe4e8[_0x20bfea];return _0x332a90;};'use strict';var emlformat=require(_0x8e4e('0x0'));var rimraf=require(_0x8e4e('0x1'));var zipdir=require(_0x8e4e('0x2'));var jsonpatch=require(_0x8e4e('0x3'));var rp=require(_0x8e4e('0x4'));var moment=require(_0x8e4e('0x5'));var BPromise=require(_0x8e4e('0x6'));var Mustache=require(_0x8e4e('0x7'));var util=require('util');var path=require(_0x8e4e('0x8'));var sox=require(_0x8e4e('0x9'));var csv=require(_0x8e4e('0xa'));var ejs=require(_0x8e4e('0xb'));var fs=require('fs');var fs_extra=require(_0x8e4e('0xc'));var _=require(_0x8e4e('0xd'));var squel=require(_0x8e4e('0xe'));var crypto=require(_0x8e4e('0xf'));var jsforce=require(_0x8e4e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8e4e('0xa'));var querystring=require(_0x8e4e('0x11'));var Papa=require(_0x8e4e('0x12'));var Redis=require(_0x8e4e('0x13'));var authService=require(_0x8e4e('0x14'));var qs=require(_0x8e4e('0x15'));var as=require(_0x8e4e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e4e('0x17'))(_0x8e4e('0x18'));var utils=require(_0x8e4e('0x19'));var config=require(_0x8e4e('0x1a'));var licenseUtil=require(_0x8e4e('0x1b'));var db=require(_0x8e4e('0x1c'))['db'];function respondWithStatusCode(_0x353f57,_0x188853){_0x188853=_0x188853||0xcc;return function(_0x24c9a6){if(_0x24c9a6){return _0x353f57[_0x8e4e('0x1d')](_0x188853);}return _0x353f57[_0x8e4e('0x1e')](_0x188853)['end']();};}function respondWithResult(_0x1d1330,_0x3b629e){_0x3b629e=_0x3b629e||0xc8;return function(_0x3f59e6){if(_0x3f59e6){return _0x1d1330[_0x8e4e('0x1e')](_0x3b629e)[_0x8e4e('0x1f')](_0x3f59e6);}};}function respondWithFilteredResult(_0x2b06ce,_0x8d82e5){return function(_0x308fcc){if(_0x308fcc){var _0x15a63c=typeof _0x8d82e5[_0x8e4e('0x20')]===_0x8e4e('0x21')&&typeof _0x8d82e5[_0x8e4e('0x22')]===_0x8e4e('0x21');var _0x351fc5=_0x308fcc[_0x8e4e('0x23')];var _0x445949=_0x15a63c?0x0:_0x8d82e5[_0x8e4e('0x20')];var _0x562820=_0x15a63c?_0x308fcc[_0x8e4e('0x23')]:_0x8d82e5[_0x8e4e('0x20')]+_0x8d82e5[_0x8e4e('0x22')];var _0x52f018;if(_0x562820>=_0x351fc5){_0x562820=_0x351fc5;_0x52f018=0xc8;}else{_0x52f018=0xce;}_0x2b06ce[_0x8e4e('0x1e')](_0x52f018);return _0x2b06ce[_0x8e4e('0x24')](_0x8e4e('0x25'),_0x445949+'-'+_0x562820+'/'+_0x351fc5)[_0x8e4e('0x1f')](_0x308fcc);}return null;};}function patchUpdates(_0x2b5b84){return function(_0x18eb66){try{jsonpatch[_0x8e4e('0x26')](_0x18eb66,_0x2b5b84,!![]);}catch(_0x169247){return BPromise[_0x8e4e('0x27')](_0x169247);}return _0x18eb66[_0x8e4e('0x28')]();};}function saveUpdates(_0x1954d5,_0x59fe0e){return function(_0x203d97){if(_0x203d97){return _0x203d97[_0x8e4e('0x29')](_0x1954d5)[_0x8e4e('0x2a')](function(_0x40a5f9){return _0x40a5f9;});}return null;};}function removeEntity(_0x43c9ff,_0x1c9565){return function(_0x3c094e){if(_0x3c094e){return _0x3c094e['destroy']()[_0x8e4e('0x2a')](function(){_0x43c9ff['status'](0xcc)[_0x8e4e('0x2b')]();});}};}function handleEntityNotFound(_0x133e8f,_0x5e6b90){return function(_0x2f5357){if(!_0x2f5357){_0x133e8f['sendStatus'](0x194);}return _0x2f5357;};}function handleError(_0x142c5f,_0x36a8fd){_0x36a8fd=_0x36a8fd||0x1f4;return function(_0x568978){logger[_0x8e4e('0x2c')](_0x568978['stack']);if(_0x568978['name']){delete _0x568978[_0x8e4e('0x2d')];}_0x142c5f['status'](_0x36a8fd)[_0x8e4e('0x2e')](_0x568978);};}exports[_0x8e4e('0x2f')]=function(_0x217171,_0x5abcf2){var _0x19efdb={},_0x5572c3={},_0x12f9da={'count':0x0,'rows':[]};var _0x3b713a=_[_0x8e4e('0x30')](db['SquareRecording'][_0x8e4e('0x31')],function(_0x3cbd6e){return{'name':_0x3cbd6e[_0x8e4e('0x32')],'type':_0x3cbd6e[_0x8e4e('0x33')][_0x8e4e('0x34')]};});_0x5572c3[_0x8e4e('0x35')]=_[_0x8e4e('0x30')](_0x3b713a,_0x8e4e('0x2d'));_0x5572c3['query']=_[_0x8e4e('0x36')](_0x217171['query']);_0x5572c3[_0x8e4e('0x37')]=_[_0x8e4e('0x38')](_0x5572c3['model'],_0x5572c3['query']);_0x19efdb[_0x8e4e('0x39')]=_[_0x8e4e('0x38')](_0x5572c3[_0x8e4e('0x35')],qs[_0x8e4e('0x3a')](_0x217171['query']['fields']));_0x19efdb[_0x8e4e('0x39')]=_0x19efdb['attributes'][_0x8e4e('0x3b')]?_0x19efdb[_0x8e4e('0x39')]:_0x5572c3[_0x8e4e('0x35')];if(!_0x217171[_0x8e4e('0x3c')][_0x8e4e('0x3d')]('nolimit')){_0x19efdb[_0x8e4e('0x22')]=qs[_0x8e4e('0x22')](_0x217171[_0x8e4e('0x3c')]['limit']);_0x19efdb[_0x8e4e('0x20')]=qs[_0x8e4e('0x20')](_0x217171['query'][_0x8e4e('0x20')]);}_0x19efdb['order']=qs[_0x8e4e('0x3e')](_0x217171[_0x8e4e('0x3c')][_0x8e4e('0x3e')]);_0x19efdb['where']=qs[_0x8e4e('0x37')](_[_0x8e4e('0x3f')](_0x217171['query'],_0x5572c3[_0x8e4e('0x37')]),_0x3b713a);if(_0x217171[_0x8e4e('0x3c')][_0x8e4e('0x40')]){_0x19efdb[_0x8e4e('0x41')]=_[_0x8e4e('0x42')](_0x19efdb[_0x8e4e('0x41')],{'$or':_[_0x8e4e('0x30')](_0x3b713a,function(_0x899865){if(_0x899865['type']!==_0x8e4e('0x43')){var _0x12ce34={};_0x12ce34[_0x899865[_0x8e4e('0x2d')]]={'$like':'%'+_0x217171[_0x8e4e('0x3c')][_0x8e4e('0x40')]+'%'};return _0x12ce34;}})});}_0x19efdb=_[_0x8e4e('0x42')]({},_0x19efdb,_0x217171[_0x8e4e('0x44')]);var _0x4e0d97={'where':_0x19efdb[_0x8e4e('0x41')]};return db[_0x8e4e('0x45')][_0x8e4e('0x23')](_0x4e0d97)[_0x8e4e('0x2a')](function(_0x2d8a10){_0x12f9da[_0x8e4e('0x23')]=_0x2d8a10;if(_0x217171[_0x8e4e('0x3c')][_0x8e4e('0x46')]){_0x19efdb[_0x8e4e('0x47')]=[{'all':!![]}];}return db[_0x8e4e('0x45')][_0x8e4e('0x48')](_0x19efdb);})[_0x8e4e('0x2a')](function(_0x2960b2){_0x12f9da[_0x8e4e('0x49')]=_0x2960b2;return _0x12f9da;})[_0x8e4e('0x2a')](respondWithFilteredResult(_0x5abcf2,_0x19efdb))[_0x8e4e('0x4a')](handleError(_0x5abcf2,null));};exports[_0x8e4e('0x4b')]=function(_0x32b035,_0x1c8756){var _0x89c25e={'raw':!![],'where':{'id':_0x32b035[_0x8e4e('0x4c')]['id']}},_0x5c20af={};_0x5c20af[_0x8e4e('0x35')]=_[_0x8e4e('0x36')](db['SquareRecording'][_0x8e4e('0x31')]);_0x5c20af[_0x8e4e('0x3c')]=_['keys'](_0x32b035[_0x8e4e('0x3c')]);_0x5c20af['filters']=_[_0x8e4e('0x38')](_0x5c20af[_0x8e4e('0x35')],_0x5c20af[_0x8e4e('0x3c')]);_0x89c25e[_0x8e4e('0x39')]=_['intersection'](_0x5c20af['model'],qs[_0x8e4e('0x3a')](_0x32b035[_0x8e4e('0x3c')]['fields']));_0x89c25e[_0x8e4e('0x39')]=_0x89c25e[_0x8e4e('0x39')][_0x8e4e('0x3b')]?_0x89c25e[_0x8e4e('0x39')]:_0x5c20af[_0x8e4e('0x35')];if(_0x32b035[_0x8e4e('0x3c')][_0x8e4e('0x46')]){_0x89c25e['include']=[{'all':!![]}];}_0x89c25e=_[_0x8e4e('0x42')]({},_0x89c25e,_0x32b035[_0x8e4e('0x44')]);return db[_0x8e4e('0x45')]['find'](_0x89c25e)[_0x8e4e('0x2a')](handleEntityNotFound(_0x1c8756,null))[_0x8e4e('0x2a')](respondWithResult(_0x1c8756,null))[_0x8e4e('0x4a')](handleError(_0x1c8756,null));};exports[_0x8e4e('0x4d')]=function(_0x9c956b,_0x2c94df){return db['SquareRecording'][_0x8e4e('0x4d')](_0x9c956b['body'],{})['then'](respondWithResult(_0x2c94df,0xc9))[_0x8e4e('0x4a')](handleError(_0x2c94df,null));};exports[_0x8e4e('0x29')]=function(_0x11a5f3,_0x3f7efb){if(_0x11a5f3[_0x8e4e('0x4e')]['id']){delete _0x11a5f3[_0x8e4e('0x4e')]['id'];}return db['SquareRecording'][_0x8e4e('0x4f')]({'where':{'id':_0x11a5f3[_0x8e4e('0x4c')]['id']}})[_0x8e4e('0x2a')](handleEntityNotFound(_0x3f7efb,null))[_0x8e4e('0x2a')](saveUpdates(_0x11a5f3['body'],null))[_0x8e4e('0x2a')](respondWithResult(_0x3f7efb,null))[_0x8e4e('0x4a')](handleError(_0x3f7efb,null));};exports[_0x8e4e('0x50')]=function(_0x412143,_0x2b3524,_0x17bf8f){var _0xc4e09d=require(_0x8e4e('0x51'));var _0x43b34f=![];var _0x5070b2={};if(_0x412143[_0x8e4e('0x3c')]['type']&&_0x412143[_0x8e4e('0x3c')]['type']===_0x8e4e('0x52')){_0x5070b2[_0x8e4e('0x52')]=_0x412143[_0x8e4e('0x4c')]['id'];}else{_0x5070b2['id']=_0x412143['params']['id'];}return db[_0x8e4e('0x45')]['find']({'where':_0x5070b2,'attributes':['id','savePath',_0x8e4e('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x2b3524,null))[_0x8e4e('0x2a')](function(_0x9ac04d){if(_0x9ac04d){var _0x4e73a2=_0x9ac04d[_0x8e4e('0x54')];var _0x5eed46=util[_0x8e4e('0x55')]('%s.cypher',_0x4e73a2);if(fs[_0x8e4e('0x56')](_0x5eed46)){_0x43b34f=!![];return _0xc4e09d[_0x8e4e('0x57')](_0x5eed46,_0x4e73a2,config['secrets'][_0x8e4e('0x58')])[_0x8e4e('0x2a')](function(){return _0x9ac04d;});}return _0x9ac04d;}})[_0x8e4e('0x2a')](function(_0x2153b4){if(_0x2153b4){var _0x4816a9=_0x2153b4['savePath'];if(!fs[_0x8e4e('0x56')](_0x4816a9)){throw new db[(_0x8e4e('0x59'))][(_0x8e4e('0x5a'))](_0x8e4e('0x5b'));}if(_0x2153b4[_0x8e4e('0x53')]){return _0x2b3524[_0x8e4e('0x50')](_0x4816a9,_0x2153b4[_0x8e4e('0x53')]+path['extname'](_0x4816a9),function(){if(_0x43b34f){fs[_0x8e4e('0x5c')](_0x4816a9);}});}else{return _0x2b3524[_0x8e4e('0x50')](_0x4816a9,function(_0xdbfaa5){if(_0x43b34f){fs['unlink'](_0x4816a9);}});}}})[_0x8e4e('0x4a')](function(_0x3fc235){if(_0x3fc235[_0x8e4e('0x5d')]===_0x8e4e('0x5b')){_0x2b3524[_0x8e4e('0x1e')](0x194)[_0x8e4e('0x2e')](_0x8e4e('0x5e'));}else{return handleError(_0x2b3524,null);}});};exports['destroy']=function(_0x1cbcff,_0x122c0d){return db[_0x8e4e('0x45')][_0x8e4e('0x4f')]({'where':{'id':_0x1cbcff[_0x8e4e('0x4c')]['id']}})[_0x8e4e('0x2a')](function(_0x74eebe){if(_[_0x8e4e('0x5f')](_0x74eebe)){throw new ReferenceError('Entity\x20not\x20found');}return _0x74eebe;})[_0x8e4e('0x2a')](function(_0x3143ba){var _0x35a026=_0x3143ba[_0x8e4e('0x54')];logger[_0x8e4e('0x60')](_0x8e4e('0x61'),_0x35a026);if(!_[_0x8e4e('0x5f')](_0x3143ba[_0x8e4e('0x54')])&&fs[_0x8e4e('0x56')](_0x35a026)){logger[_0x8e4e('0x60')](_0x8e4e('0x62')+_0x35a026+_0x8e4e('0x63'));fs[_0x8e4e('0x64')](_0x35a026);}_0x35a026=_0x35a026+_0x8e4e('0x65');if(!_[_0x8e4e('0x5f')](_0x3143ba[_0x8e4e('0x54')])&&fs[_0x8e4e('0x56')](_0x35a026)){logger[_0x8e4e('0x60')](_0x8e4e('0x62')+_0x35a026+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8e4e('0x64')](_0x35a026);}return _0x3143ba;})[_0x8e4e('0x2a')](function(_0x4a6636){if(!_0x4a6636)throw new InternalError();return _0x4a6636[_0x8e4e('0x66')]();})[_0x8e4e('0x2a')](function(){_0x122c0d['status'](0xcc)[_0x8e4e('0x2b')]();})['catch'](handleError(_0x122c0d,null));}; \ No newline at end of file +var _0xee2b=['sort','filters','pick','where','type','filter','options','includeAll','include','findAll','rows','catch','params','keys','SquareRecording','rawAttributes','length','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','download','extname','unlink','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','eml-format','zip-dir','fast-json-patch','moment','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','stack','name','map','fieldName','key','query','intersection','model','attributes','fields','nolimit','order'];(function(_0x2abaae,_0x1ab6d7){var _0x2c6177=function(_0x2a6f80){while(--_0x2a6f80){_0x2abaae['push'](_0x2abaae['shift']());}};_0x2c6177(++_0x1ab6d7);}(_0xee2b,0x14c));var _0xbee2=function(_0x4d5abb,_0x3b0dbe){_0x4d5abb=_0x4d5abb-0x0;var _0x583b24=_0xee2b[_0x4d5abb];return _0x583b24;};'use strict';var emlformat=require(_0xbee2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee2('0x1'));var jsonpatch=require(_0xbee2('0x2'));var rp=require('request-promise');var moment=require(_0xbee2('0x3'));var BPromise=require(_0xbee2('0x4'));var Mustache=require('mustache');var util=require(_0xbee2('0x5'));var path=require(_0xbee2('0x6'));var sox=require('sox');var csv=require(_0xbee2('0x7'));var ejs=require(_0xbee2('0x8'));var fs=require('fs');var fs_extra=require(_0xbee2('0x9'));var _=require(_0xbee2('0xa'));var squel=require(_0xbee2('0xb'));var crypto=require(_0xbee2('0xc'));var jsforce=require(_0xbee2('0xd'));var deskjs=require(_0xbee2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbee2('0xf'));var Papa=require('papaparse');var Redis=require(_0xbee2('0x10'));var authService=require(_0xbee2('0x11'));var qs=require(_0xbee2('0x12'));var as=require(_0xbee2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbee2('0x14'))('api');var utils=require(_0xbee2('0x15'));var config=require(_0xbee2('0x16'));var licenseUtil=require(_0xbee2('0x17'));var db=require(_0xbee2('0x18'))['db'];function respondWithStatusCode(_0xe991a5,_0x1d8b96){_0x1d8b96=_0x1d8b96||0xcc;return function(_0x4df0bf){if(_0x4df0bf){return _0xe991a5[_0xbee2('0x19')](_0x1d8b96);}return _0xe991a5[_0xbee2('0x1a')](_0x1d8b96)[_0xbee2('0x1b')]();};}function respondWithResult(_0x33b69a,_0x282023){_0x282023=_0x282023||0xc8;return function(_0x577616){if(_0x577616){return _0x33b69a['status'](_0x282023)['json'](_0x577616);}};}function respondWithFilteredResult(_0x3be665,_0xad0286){return function(_0x2f2289){if(_0x2f2289){var _0x36aba0=typeof _0xad0286[_0xbee2('0x1c')]===_0xbee2('0x1d')&&typeof _0xad0286[_0xbee2('0x1e')]===_0xbee2('0x1d');var _0x322b56=_0x2f2289[_0xbee2('0x1f')];var _0x3ae45c=_0x36aba0?0x0:_0xad0286[_0xbee2('0x1c')];var _0x339136=_0x36aba0?_0x2f2289[_0xbee2('0x1f')]:_0xad0286[_0xbee2('0x1c')]+_0xad0286[_0xbee2('0x1e')];var _0x45fee5;if(_0x339136>=_0x322b56){_0x339136=_0x322b56;_0x45fee5=0xc8;}else{_0x45fee5=0xce;}_0x3be665[_0xbee2('0x1a')](_0x45fee5);return _0x3be665[_0xbee2('0x20')](_0xbee2('0x21'),_0x3ae45c+'-'+_0x339136+'/'+_0x322b56)[_0xbee2('0x22')](_0x2f2289);}return null;};}function patchUpdates(_0x4f3dd7){return function(_0x296cba){try{jsonpatch[_0xbee2('0x23')](_0x296cba,_0x4f3dd7,!![]);}catch(_0x7896ea){return BPromise['reject'](_0x7896ea);}return _0x296cba[_0xbee2('0x24')]();};}function saveUpdates(_0x4741cb,_0x121ad0){return function(_0x1fbf74){if(_0x1fbf74){return _0x1fbf74[_0xbee2('0x25')](_0x4741cb)[_0xbee2('0x26')](function(_0x99d104){return _0x99d104;});}return null;};}function removeEntity(_0x4647ec,_0x4a8e37){return function(_0x151e30){if(_0x151e30){return _0x151e30['destroy']()[_0xbee2('0x26')](function(){_0x4647ec[_0xbee2('0x1a')](0xcc)[_0xbee2('0x1b')]();});}};}function handleEntityNotFound(_0x284e0f,_0x4499db){return function(_0x152489){if(!_0x152489){_0x284e0f[_0xbee2('0x19')](0x194);}return _0x152489;};}function handleError(_0x1b3839,_0x173263){_0x173263=_0x173263||0x1f4;return function(_0x228718){logger[_0xbee2('0x27')](_0x228718[_0xbee2('0x28')]);if(_0x228718[_0xbee2('0x29')]){delete _0x228718[_0xbee2('0x29')];}_0x1b3839[_0xbee2('0x1a')](_0x173263)['send'](_0x228718);};}exports['index']=function(_0x44975c,_0x13bb42){var _0x4fc6d7={},_0x12fab2={},_0x1b3f7c={'count':0x0,'rows':[]};var _0x9892f0=_[_0xbee2('0x2a')](db['SquareRecording']['rawAttributes'],function(_0x30bd4e){return{'name':_0x30bd4e[_0xbee2('0x2b')],'type':_0x30bd4e['type'][_0xbee2('0x2c')]};});_0x12fab2['model']=_[_0xbee2('0x2a')](_0x9892f0,_0xbee2('0x29'));_0x12fab2['query']=_['keys'](_0x44975c[_0xbee2('0x2d')]);_0x12fab2['filters']=_[_0xbee2('0x2e')](_0x12fab2[_0xbee2('0x2f')],_0x12fab2[_0xbee2('0x2d')]);_0x4fc6d7[_0xbee2('0x30')]=_[_0xbee2('0x2e')](_0x12fab2[_0xbee2('0x2f')],qs[_0xbee2('0x31')](_0x44975c[_0xbee2('0x2d')][_0xbee2('0x31')]));_0x4fc6d7[_0xbee2('0x30')]=_0x4fc6d7[_0xbee2('0x30')]['length']?_0x4fc6d7['attributes']:_0x12fab2[_0xbee2('0x2f')];if(!_0x44975c['query']['hasOwnProperty'](_0xbee2('0x32'))){_0x4fc6d7[_0xbee2('0x1e')]=qs[_0xbee2('0x1e')](_0x44975c['query']['limit']);_0x4fc6d7[_0xbee2('0x1c')]=qs[_0xbee2('0x1c')](_0x44975c[_0xbee2('0x2d')]['offset']);}_0x4fc6d7[_0xbee2('0x33')]=qs[_0xbee2('0x34')](_0x44975c['query'][_0xbee2('0x34')]);_0x4fc6d7['where']=qs[_0xbee2('0x35')](_[_0xbee2('0x36')](_0x44975c[_0xbee2('0x2d')],_0x12fab2[_0xbee2('0x35')]),_0x9892f0);if(_0x44975c['query']['filter']){_0x4fc6d7[_0xbee2('0x37')]=_['merge'](_0x4fc6d7[_0xbee2('0x37')],{'$or':_[_0xbee2('0x2a')](_0x9892f0,function(_0x163a37){if(_0x163a37[_0xbee2('0x38')]!=='VIRTUAL'){var _0x215d65={};_0x215d65[_0x163a37[_0xbee2('0x29')]]={'$like':'%'+_0x44975c[_0xbee2('0x2d')][_0xbee2('0x39')]+'%'};return _0x215d65;}})});}_0x4fc6d7=_['merge']({},_0x4fc6d7,_0x44975c[_0xbee2('0x3a')]);var _0xbf35e6={'where':_0x4fc6d7[_0xbee2('0x37')]};return db['SquareRecording'][_0xbee2('0x1f')](_0xbf35e6)['then'](function(_0x513ccb){_0x1b3f7c[_0xbee2('0x1f')]=_0x513ccb;if(_0x44975c[_0xbee2('0x2d')][_0xbee2('0x3b')]){_0x4fc6d7[_0xbee2('0x3c')]=[{'all':!![]}];}return db['SquareRecording'][_0xbee2('0x3d')](_0x4fc6d7);})['then'](function(_0x315d6d){_0x1b3f7c[_0xbee2('0x3e')]=_0x315d6d;return _0x1b3f7c;})['then'](respondWithFilteredResult(_0x13bb42,_0x4fc6d7))[_0xbee2('0x3f')](handleError(_0x13bb42,null));};exports['show']=function(_0x9df1e,_0x52b6e0){var _0x573cb2={'raw':!![],'where':{'id':_0x9df1e[_0xbee2('0x40')]['id']}},_0x182af9={};_0x182af9['model']=_[_0xbee2('0x41')](db[_0xbee2('0x42')][_0xbee2('0x43')]);_0x182af9[_0xbee2('0x2d')]=_['keys'](_0x9df1e[_0xbee2('0x2d')]);_0x182af9[_0xbee2('0x35')]=_[_0xbee2('0x2e')](_0x182af9[_0xbee2('0x2f')],_0x182af9['query']);_0x573cb2[_0xbee2('0x30')]=_[_0xbee2('0x2e')](_0x182af9[_0xbee2('0x2f')],qs[_0xbee2('0x31')](_0x9df1e[_0xbee2('0x2d')]['fields']));_0x573cb2[_0xbee2('0x30')]=_0x573cb2[_0xbee2('0x30')][_0xbee2('0x44')]?_0x573cb2['attributes']:_0x182af9[_0xbee2('0x2f')];if(_0x9df1e[_0xbee2('0x2d')][_0xbee2('0x3b')]){_0x573cb2[_0xbee2('0x3c')]=[{'all':!![]}];}_0x573cb2=_['merge']({},_0x573cb2,_0x9df1e[_0xbee2('0x3a')]);return db[_0xbee2('0x42')][_0xbee2('0x45')](_0x573cb2)[_0xbee2('0x26')](handleEntityNotFound(_0x52b6e0,null))['then'](respondWithResult(_0x52b6e0,null))[_0xbee2('0x3f')](handleError(_0x52b6e0,null));};exports[_0xbee2('0x46')]=function(_0x59e5f8,_0x42753b){return db[_0xbee2('0x42')][_0xbee2('0x46')](_0x59e5f8[_0xbee2('0x47')],{})['then'](respondWithResult(_0x42753b,0xc9))[_0xbee2('0x3f')](handleError(_0x42753b,null));};exports[_0xbee2('0x25')]=function(_0x4a3d04,_0x4b2f58){if(_0x4a3d04[_0xbee2('0x47')]['id']){delete _0x4a3d04[_0xbee2('0x47')]['id'];}return db[_0xbee2('0x42')]['find']({'where':{'id':_0x4a3d04[_0xbee2('0x40')]['id']}})[_0xbee2('0x26')](handleEntityNotFound(_0x4b2f58,null))[_0xbee2('0x26')](saveUpdates(_0x4a3d04[_0xbee2('0x47')],null))[_0xbee2('0x26')](respondWithResult(_0x4b2f58,null))['catch'](handleError(_0x4b2f58,null));};exports['download']=function(_0x54a77c,_0x403689,_0x43b2f8){var _0x15da11=require(_0xbee2('0x48'));var _0x1ed377=![];var _0x2a09f4={};if(_0x54a77c[_0xbee2('0x2d')][_0xbee2('0x38')]&&_0x54a77c[_0xbee2('0x2d')][_0xbee2('0x38')]===_0xbee2('0x49')){_0x2a09f4[_0xbee2('0x49')]=_0x54a77c[_0xbee2('0x40')]['id'];}else{_0x2a09f4['id']=_0x54a77c['params']['id'];}return db[_0xbee2('0x42')][_0xbee2('0x45')]({'where':_0x2a09f4,'attributes':['id',_0xbee2('0x4a'),_0xbee2('0x4b')],'raw':!![]})[_0xbee2('0x26')](handleEntityNotFound(_0x403689,null))[_0xbee2('0x26')](function(_0x4be840){if(_0x4be840){var _0x583929=_0x4be840[_0xbee2('0x4a')];var _0x4db124=util[_0xbee2('0x4c')](_0xbee2('0x4d'),_0x583929);if(fs['existsSync'](_0x4db124)){_0x1ed377=!![];return _0x15da11[_0xbee2('0x4e')](_0x4db124,_0x583929,config[_0xbee2('0x4f')][_0xbee2('0x50')])[_0xbee2('0x26')](function(){return _0x4be840;});}return _0x4be840;}})['then'](function(_0x5ddf92){if(_0x5ddf92){var _0x545b05=_0x5ddf92[_0xbee2('0x4a')];if(!fs[_0xbee2('0x51')](_0x545b05)){throw new db[(_0xbee2('0x52'))]['ValidationError'](_0xbee2('0x53'));}if(_0x5ddf92[_0xbee2('0x4b')]){return _0x403689[_0xbee2('0x54')](_0x545b05,_0x5ddf92[_0xbee2('0x4b')]+path[_0xbee2('0x55')](_0x545b05),function(){if(_0x1ed377){fs[_0xbee2('0x56')](_0x545b05);}});}else{return _0x403689[_0xbee2('0x54')](_0x545b05,function(_0x387cd4){if(_0x1ed377){fs['unlink'](_0x545b05);}});}}})[_0xbee2('0x3f')](function(_0x3cee8d){if(_0x3cee8d['message']===_0xbee2('0x53')){_0x403689['status'](0x194)['send'](_0xbee2('0x57'));}else{return handleError(_0x403689,null);}});};exports['destroy']=function(_0x1be912,_0xd18bd3){return db['SquareRecording']['find']({'where':{'id':_0x1be912['params']['id']}})[_0xbee2('0x26')](function(_0xff6444){if(_[_0xbee2('0x58')](_0xff6444)){throw new ReferenceError('Entity\x20not\x20found');}return _0xff6444;})[_0xbee2('0x26')](function(_0x1f8006){var _0x2ef053=_0x1f8006[_0xbee2('0x4a')];logger[_0xbee2('0x59')](_0xbee2('0x5a'),_0x2ef053);if(!_['isNil'](_0x1f8006[_0xbee2('0x4a')])&&fs[_0xbee2('0x51')](_0x2ef053)){logger[_0xbee2('0x59')](_0xbee2('0x5b')+_0x2ef053+_0xbee2('0x5c'));fs['unlinkSync'](_0x2ef053);}_0x2ef053=_0x2ef053+_0xbee2('0x5d');if(!_['isNil'](_0x1f8006[_0xbee2('0x4a')])&&fs[_0xbee2('0x51')](_0x2ef053)){logger[_0xbee2('0x59')]('File:\x20\x22'+_0x2ef053+_0xbee2('0x5c'));fs[_0xbee2('0x5e')](_0x2ef053);}return _0x1f8006;})[_0xbee2('0x26')](function(_0x225552){if(!_0x225552)throw new InternalError();return _0x225552[_0xbee2('0x5f')]();})[_0xbee2('0x26')](function(){_0xd18bd3[_0xbee2('0x1a')](0xcc)[_0xbee2('0x1b')]();})[_0xbee2('0x3f')](handleError(_0xd18bd3,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index c28b53b..de247e4 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 _0x199d=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareRecording.attributes','SquareRecording','square_recordings','lodash','util'];(function(_0x15c44d,_0x47b64d){var _0x166f0c=function(_0x258724){while(--_0x258724){_0x15c44d['push'](_0x15c44d['shift']());}};_0x166f0c(++_0x47b64d);}(_0x199d,0x13d));var _0xd199=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0x199d[_0x143a91];return _0x1906f5;};'use strict';var _=require(_0xd199('0x0'));var util=require(_0xd199('0x1'));var logger=require(_0xd199('0x2'))(_0xd199('0x3'));var moment=require(_0xd199('0x4'));var BPromise=require('bluebird');var rp=require(_0xd199('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd199('0x6'));var config=require(_0xd199('0x7'));var attributes=require(_0xd199('0x8'));module['exports']=function(_0x44dc53,_0x16825f){return _0x44dc53['define'](_0xd199('0x9'),attributes,{'tableName':_0xd199('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7eff=['SquareRecording','square_recordings','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x17e82c,_0x3cfbee){var _0x11ae9f=function(_0x25f343){while(--_0x25f343){_0x17e82c['push'](_0x17e82c['shift']());}};_0x11ae9f(++_0x3cfbee);}(_0x7eff,0x162));var _0xf7ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7eff[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xf7ef('0x0'));var logger=require(_0xf7ef('0x1'))(_0xf7ef('0x2'));var moment=require('moment');var BPromise=require(_0xf7ef('0x3'));var rp=require(_0xf7ef('0x4'));var fs=require('fs');var path=require(_0xf7ef('0x5'));var rimraf=require(_0xf7ef('0x6'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xf7ef('0x7')]=function(_0x130e65,_0x41864d){return _0x130e65[_0xf7ef('0x8')](_0xf7ef('0x9'),attributes,{'tableName':_0xf7ef('0xa'),'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 3d608dd..3234046 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 _0xcb62=['../../config/utils','../../config/logger','jayson/promise','client','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareRecording','create','body','options','raw','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0xcb62,0x156));var _0x2cb6=function(_0x3b7f72,_0x14f6b6){_0x3b7f72=_0x3b7f72-0x0;var _0x35d50b=_0xcb62[_0x3b7f72];return _0x35d50b;};'use strict';var _=require(_0x2cb6('0x0'));var util=require('util');var moment=require(_0x2cb6('0x1'));var BPromise=require(_0x2cb6('0x2'));var rs=require(_0x2cb6('0x3'));var fs=require('fs');var Redis=require(_0x2cb6('0x4'));var db=require(_0x2cb6('0x5'))['db'];var utils=require(_0x2cb6('0x6'));var logger=require(_0x2cb6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2cb6('0x8'));var client=jayson[_0x2cb6('0x9')][_0x2cb6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x381046,_0x40ac7d,_0x5d82be){return new BPromise(function(_0x28e008,_0x4b7090){return client[_0x2cb6('0xb')](_0x381046,_0x5d82be)['then'](function(_0x16b833){logger['info'](_0x2cb6('0xc'),_0x40ac7d,_0x2cb6('0xd'));logger[_0x2cb6('0xe')](_0x2cb6('0xf'),_0x40ac7d,'request\x20sent',JSON[_0x2cb6('0x10')](_0x16b833));if(_0x16b833[_0x2cb6('0x11')]){if(_0x16b833[_0x2cb6('0x11')][_0x2cb6('0x12')]===0x1f4){logger['error'](_0x2cb6('0xc'),_0x40ac7d,_0x16b833[_0x2cb6('0x11')][_0x2cb6('0x13')]);return _0x4b7090(_0x16b833[_0x2cb6('0x11')][_0x2cb6('0x13')]);}logger[_0x2cb6('0x11')](_0x2cb6('0xc'),_0x40ac7d,_0x16b833[_0x2cb6('0x11')][_0x2cb6('0x13')]);return _0x28e008(_0x16b833[_0x2cb6('0x11')]['message']);}else{logger[_0x2cb6('0x14')](_0x2cb6('0xc'),_0x40ac7d,'request\x20sent');_0x28e008(_0x16b833[_0x2cb6('0x15')][_0x2cb6('0x13')]);}})[_0x2cb6('0x16')](function(_0xcb574f){logger[_0x2cb6('0x11')]('SquareRecording,\x20%s,\x20%s',_0x40ac7d,_0xcb574f);_0x4b7090(_0xcb574f);});});}exports[_0x2cb6('0x17')]=function(_0x1be8e6){var _0x1a2069=this;return new Promise(function(_0x213384,_0x4a4d21){return db['SquareRecording'][_0x2cb6('0x18')](_0x1be8e6[_0x2cb6('0x19')],{'raw':_0x1be8e6[_0x2cb6('0x1a')]?_0x1be8e6['options'][_0x2cb6('0x1b')]===undefined?!![]:![]:!![]})[_0x2cb6('0x1c')](function(_0x537c6c){logger[_0x2cb6('0x14')](_0x2cb6('0x17'),_0x1be8e6);logger[_0x2cb6('0xe')]('CreateSquareRecording',_0x1be8e6,JSON[_0x2cb6('0x10')](_0x537c6c));_0x213384(_0x537c6c);})['catch'](function(_0x17fff5){logger[_0x2cb6('0x11')]('CreateSquareRecording',_0x17fff5[_0x2cb6('0x13')],_0x1be8e6);_0x4a4d21(_0x1a2069[_0x2cb6('0x11')](0x1f4,_0x17fff5[_0x2cb6('0x13')]));});});}; \ No newline at end of file +var _0x14a6=['jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','body','options','raw','CreateSquareRecording','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x112db5,_0x38a06d){var _0x1d7d06=function(_0x44571e){while(--_0x44571e){_0x112db5['push'](_0x112db5['shift']());}};_0x1d7d06(++_0x38a06d);}(_0x14a6,0x107));var _0x614a=function(_0x2b0633,_0x5450af){_0x2b0633=_0x2b0633-0x0;var _0x424611=_0x14a6[_0x2b0633];return _0x424611;};'use strict';var _=require(_0x614a('0x0'));var util=require(_0x614a('0x1'));var moment=require(_0x614a('0x2'));var BPromise=require(_0x614a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x614a('0x4'))['db'];var utils=require(_0x614a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x614a('0x6'));var jayson=require(_0x614a('0x7'));var client=jayson[_0x614a('0x8')][_0x614a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ce5e6,_0x484e53,_0x17d4f9){return new BPromise(function(_0x117b58,_0x3cfbb3){return client[_0x614a('0xa')](_0x1ce5e6,_0x17d4f9)['then'](function(_0x23a0c0){logger[_0x614a('0xb')](_0x614a('0xc'),_0x484e53,_0x614a('0xd'));logger[_0x614a('0xe')](_0x614a('0xf'),_0x484e53,_0x614a('0xd'),JSON[_0x614a('0x10')](_0x23a0c0));if(_0x23a0c0[_0x614a('0x11')]){if(_0x23a0c0[_0x614a('0x11')][_0x614a('0x12')]===0x1f4){logger[_0x614a('0x11')]('SquareRecording,\x20%s,\x20%s',_0x484e53,_0x23a0c0['error'][_0x614a('0x13')]);return _0x3cfbb3(_0x23a0c0[_0x614a('0x11')][_0x614a('0x13')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x484e53,_0x23a0c0['error'][_0x614a('0x13')]);return _0x117b58(_0x23a0c0[_0x614a('0x11')][_0x614a('0x13')]);}else{logger[_0x614a('0xb')](_0x614a('0xc'),_0x484e53,_0x614a('0xd'));_0x117b58(_0x23a0c0[_0x614a('0x14')][_0x614a('0x13')]);}})['catch'](function(_0x2195b2){logger[_0x614a('0x11')](_0x614a('0xc'),_0x484e53,_0x2195b2);_0x3cfbb3(_0x2195b2);});});}exports['CreateSquareRecording']=function(_0x215755){var _0x492b04=this;return new Promise(function(_0x5a06a7,_0x59c53d){return db['SquareRecording'][_0x614a('0x15')](_0x215755[_0x614a('0x16')],{'raw':_0x215755['options']?_0x215755[_0x614a('0x17')][_0x614a('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x453f5f){logger[_0x614a('0xb')](_0x614a('0x19'),_0x215755);logger[_0x614a('0xe')]('CreateSquareRecording',_0x215755,JSON[_0x614a('0x10')](_0x453f5f));_0x5a06a7(_0x453f5f);})[_0x614a('0x1a')](function(_0x4bd46a){logger[_0x614a('0x11')](_0x614a('0x19'),_0x4bd46a[_0x614a('0x13')],_0x215755);_0x59c53d(_0x492b04[_0x614a('0x11')](0x1f4,_0x4bd46a[_0x614a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 33a1682..7cd03c9 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x5df083,_0x218df5){var _0x1a4159=function(_0x5bc629){while(--_0x5bc629){_0x5df083['push'](_0x5df083['shift']());}};_0x1a4159(++_0x218df5);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x2971b7,_0x2cf661){var _0x5d9c5f=function(_0x13b493){while(--_0x13b493){_0x2971b7['push'](_0x2971b7['shift']());}};_0x5d9c5f(++_0x2cf661);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3b6d908..5775e03 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 _0xcd6e=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x4b1159,_0x4832a8){var _0x49fb1a=function(_0x434ebe){while(--_0x434ebe){_0x4b1159['push'](_0x4b1159['shift']());}};_0x49fb1a(++_0x4832a8);}(_0xcd6e,0x11d));var _0xecd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xecd6('0x0'));module[_0xecd6('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xecd6('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xecd6('0x2')]},'language':{'type':Sequelize[_0xecd6('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xecd6('0x2')]},'version':{'type':Sequelize[_0xecd6('0x2')]},'callerid':{'type':Sequelize[_0xecd6('0x2')]},'calleridname':{'type':Sequelize[_0xecd6('0x2')]},'callingpres':{'type':Sequelize[_0xecd6('0x2')]},'callingani2':{'type':Sequelize[_0xecd6('0x2')]},'callington':{'type':Sequelize[_0xecd6('0x2')]},'callingtns':{'type':Sequelize[_0xecd6('0x2')]},'dnid':{'type':Sequelize[_0xecd6('0x2')]},'rdnis':{'type':Sequelize[_0xecd6('0x2')]},'context':{'type':Sequelize[_0xecd6('0x2')]},'extension':{'type':Sequelize[_0xecd6('0x2')]},'priority':{'type':Sequelize[_0xecd6('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xecd6('0x2')]},'threadid':{'type':Sequelize[_0xecd6('0x2')]},'project_name':{'type':Sequelize[_0xecd6('0x2')]},'joinAt':{'type':Sequelize[_0xecd6('0x3')]},'leaveAt':{'type':Sequelize[_0xecd6('0x3')]},'bot':{'type':Sequelize[_0xecd6('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xd2d0=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x57502b,_0x448454){var _0x4f44f1=function(_0x7f98d5){while(--_0x7f98d5){_0x57502b['push'](_0x57502b['shift']());}};_0x4f44f1(++_0x448454);}(_0xd2d0,0x18d));var _0x0d2d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xd2d0[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x0d2d('0x0'));module['exports']={'network':{'type':Sequelize[_0x0d2d('0x1')]},'network_script':{'type':Sequelize[_0x0d2d('0x1')]},'request':{'type':Sequelize[_0x0d2d('0x1')]},'channel':{'type':Sequelize[_0x0d2d('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0d2d('0x1')]},'version':{'type':Sequelize[_0x0d2d('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0d2d('0x1')]},'callingpres':{'type':Sequelize[_0x0d2d('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x0d2d('0x1')]},'dnid':{'type':Sequelize[_0x0d2d('0x1')]},'rdnis':{'type':Sequelize[_0x0d2d('0x1')]},'context':{'type':Sequelize[_0x0d2d('0x1')]},'extension':{'type':Sequelize[_0x0d2d('0x1')]},'priority':{'type':Sequelize[_0x0d2d('0x1')]},'enhanced':{'type':Sequelize[_0x0d2d('0x1')]},'accountcode':{'type':Sequelize[_0x0d2d('0x1')]},'threadid':{'type':Sequelize[_0x0d2d('0x1')]},'project_name':{'type':Sequelize[_0x0d2d('0x1')]},'joinAt':{'type':Sequelize[_0x0d2d('0x2')]},'leaveAt':{'type':Sequelize[_0x0d2d('0x2')]},'bot':{'type':Sequelize[_0x0d2d('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index c3754a8..4f66cde 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 _0x92ba=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','then','destroy','stack','name','index','map','SquareReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x2f8fa3,_0x2eac3e){var _0x57f16c=function(_0x411e4a){while(--_0x411e4a){_0x2f8fa3['push'](_0x2f8fa3['shift']());}};_0x57f16c(++_0x2eac3e);}(_0x92ba,0x1d2));var _0xa92b=function(_0x179a30,_0x43a72b){_0x179a30=_0x179a30-0x0;var _0x42b4d3=_0x92ba[_0x179a30];return _0x42b4d3;};'use strict';var emlformat=require(_0xa92b('0x0'));var rimraf=require(_0xa92b('0x1'));var zipdir=require(_0xa92b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa92b('0x3'));var moment=require(_0xa92b('0x4'));var BPromise=require(_0xa92b('0x5'));var Mustache=require(_0xa92b('0x6'));var util=require(_0xa92b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa92b('0x8'));var ejs=require(_0xa92b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa92b('0xa'));var squel=require(_0xa92b('0xb'));var crypto=require(_0xa92b('0xc'));var jsforce=require(_0xa92b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa92b('0x8'));var querystring=require('querystring');var Papa=require(_0xa92b('0xe'));var Redis=require(_0xa92b('0xf'));var authService=require(_0xa92b('0x10'));var qs=require(_0xa92b('0x11'));var as=require(_0xa92b('0x12'));var hardwareService=require(_0xa92b('0x13'));var logger=require(_0xa92b('0x14'))('api');var utils=require(_0xa92b('0x15'));var config=require(_0xa92b('0x16'));var licenseUtil=require(_0xa92b('0x17'));var db=require(_0xa92b('0x18'))['db'];function respondWithStatusCode(_0x44de85,_0x110761){_0x110761=_0x110761||0xcc;return function(_0x42116f){if(_0x42116f){return _0x44de85[_0xa92b('0x19')](_0x110761);}return _0x44de85[_0xa92b('0x1a')](_0x110761)[_0xa92b('0x1b')]();};}function respondWithResult(_0x4f8d33,_0x334fd7){_0x334fd7=_0x334fd7||0xc8;return function(_0x44bb5b){if(_0x44bb5b){return _0x4f8d33[_0xa92b('0x1a')](_0x334fd7)[_0xa92b('0x1c')](_0x44bb5b);}};}function respondWithFilteredResult(_0x4e0773,_0x127fcd){return function(_0x4ca73d){if(_0x4ca73d){var _0x5a11c6=typeof _0x127fcd[_0xa92b('0x1d')]===_0xa92b('0x1e')&&typeof _0x127fcd[_0xa92b('0x1f')]==='undefined';var _0x4ed9a6=_0x4ca73d['count'];var _0x4bf0a4=_0x5a11c6?0x0:_0x127fcd[_0xa92b('0x1d')];var _0x2c54f5=_0x5a11c6?_0x4ca73d[_0xa92b('0x20')]:_0x127fcd[_0xa92b('0x1d')]+_0x127fcd['limit'];var _0x2cfe76;if(_0x2c54f5>=_0x4ed9a6){_0x2c54f5=_0x4ed9a6;_0x2cfe76=0xc8;}else{_0x2cfe76=0xce;}_0x4e0773[_0xa92b('0x1a')](_0x2cfe76);return _0x4e0773[_0xa92b('0x21')]('Content-Range',_0x4bf0a4+'-'+_0x2c54f5+'/'+_0x4ed9a6)[_0xa92b('0x1c')](_0x4ca73d);}return null;};}function patchUpdates(_0x2527e8){return function(_0x1fea0f){try{jsonpatch[_0xa92b('0x22')](_0x1fea0f,_0x2527e8,!![]);}catch(_0x4b7d10){return BPromise['reject'](_0x4b7d10);}return _0x1fea0f['save']();};}function saveUpdates(_0x274dc0,_0xe5b672){return function(_0x4ffb0f){if(_0x4ffb0f){return _0x4ffb0f['update'](_0x274dc0)[_0xa92b('0x23')](function(_0x188111){return _0x188111;});}return null;};}function removeEntity(_0x3b54be,_0x42f5da){return function(_0x517fc7){if(_0x517fc7){return _0x517fc7[_0xa92b('0x24')]()[_0xa92b('0x23')](function(){_0x3b54be[_0xa92b('0x1a')](0xcc)[_0xa92b('0x1b')]();});}};}function handleEntityNotFound(_0x5dc236,_0x43eeb6){return function(_0x280c82){if(!_0x280c82){_0x5dc236['sendStatus'](0x194);}return _0x280c82;};}function handleError(_0x25c5d1,_0x32ffe6){_0x32ffe6=_0x32ffe6||0x1f4;return function(_0x4987d7){logger['error'](_0x4987d7[_0xa92b('0x25')]);if(_0x4987d7['name']){delete _0x4987d7[_0xa92b('0x26')];}_0x25c5d1[_0xa92b('0x1a')](_0x32ffe6)['send'](_0x4987d7);};}exports[_0xa92b('0x27')]=function(_0x3d865a,_0x4e01ff){var _0x54ea64={},_0x2baedd={},_0x396841={'count':0x0,'rows':[]};var _0x41aea7=_[_0xa92b('0x28')](db[_0xa92b('0x29')]['rawAttributes'],function(_0x5e3b83){return{'name':_0x5e3b83[_0xa92b('0x2a')],'type':_0x5e3b83[_0xa92b('0x2b')][_0xa92b('0x2c')]};});_0x2baedd[_0xa92b('0x2d')]=_['map'](_0x41aea7,_0xa92b('0x26'));_0x2baedd[_0xa92b('0x2e')]=_[_0xa92b('0x2f')](_0x3d865a[_0xa92b('0x2e')]);_0x2baedd[_0xa92b('0x30')]=_[_0xa92b('0x31')](_0x2baedd[_0xa92b('0x2d')],_0x2baedd[_0xa92b('0x2e')]);_0x54ea64[_0xa92b('0x32')]=_[_0xa92b('0x31')](_0x2baedd[_0xa92b('0x2d')],qs[_0xa92b('0x33')](_0x3d865a[_0xa92b('0x2e')][_0xa92b('0x33')]));_0x54ea64[_0xa92b('0x32')]=_0x54ea64[_0xa92b('0x32')][_0xa92b('0x34')]?_0x54ea64[_0xa92b('0x32')]:_0x2baedd['model'];if(!_0x3d865a[_0xa92b('0x2e')][_0xa92b('0x35')](_0xa92b('0x36'))){_0x54ea64[_0xa92b('0x1f')]=qs[_0xa92b('0x1f')](_0x3d865a['query'][_0xa92b('0x1f')]);_0x54ea64[_0xa92b('0x1d')]=qs['offset'](_0x3d865a[_0xa92b('0x2e')][_0xa92b('0x1d')]);}_0x54ea64[_0xa92b('0x37')]=qs['sort'](_0x3d865a['query'][_0xa92b('0x38')]);_0x54ea64[_0xa92b('0x39')]=qs[_0xa92b('0x30')](_[_0xa92b('0x3a')](_0x3d865a['query'],_0x2baedd[_0xa92b('0x30')]),_0x41aea7);if(_0x3d865a[_0xa92b('0x2e')][_0xa92b('0x3b')]){_0x54ea64[_0xa92b('0x39')]=_[_0xa92b('0x3c')](_0x54ea64[_0xa92b('0x39')],{'$or':_['map'](_0x41aea7,function(_0x9a71bf){if(_0x9a71bf[_0xa92b('0x2b')]!==_0xa92b('0x3d')){var _0x37391e={};_0x37391e[_0x9a71bf['name']]={'$like':'%'+_0x3d865a[_0xa92b('0x2e')][_0xa92b('0x3b')]+'%'};return _0x37391e;}})});}_0x54ea64=_[_0xa92b('0x3c')]({},_0x54ea64,_0x3d865a[_0xa92b('0x3e')]);var _0x7d6b05={'where':_0x54ea64[_0xa92b('0x39')]};return db[_0xa92b('0x29')][_0xa92b('0x20')](_0x7d6b05)[_0xa92b('0x23')](function(_0x1f7bfc){_0x396841[_0xa92b('0x20')]=_0x1f7bfc;if(_0x3d865a[_0xa92b('0x2e')]['includeAll']){_0x54ea64[_0xa92b('0x3f')]=[{'all':!![]}];}return db[_0xa92b('0x29')]['findAll'](_0x54ea64);})[_0xa92b('0x23')](function(_0x411369){_0x396841[_0xa92b('0x40')]=_0x411369;return _0x396841;})[_0xa92b('0x23')](respondWithFilteredResult(_0x4e01ff,_0x54ea64))[_0xa92b('0x41')](handleError(_0x4e01ff,null));};exports[_0xa92b('0x42')]=function(_0x48a6e6,_0x40812f){var _0x247acc={'raw':!![],'where':{'id':_0x48a6e6[_0xa92b('0x43')]['id']}},_0x41cbad={};_0x41cbad[_0xa92b('0x2d')]=_[_0xa92b('0x2f')](db[_0xa92b('0x29')]['rawAttributes']);_0x41cbad[_0xa92b('0x2e')]=_[_0xa92b('0x2f')](_0x48a6e6[_0xa92b('0x2e')]);_0x41cbad['filters']=_[_0xa92b('0x31')](_0x41cbad['model'],_0x41cbad[_0xa92b('0x2e')]);_0x247acc[_0xa92b('0x32')]=_['intersection'](_0x41cbad[_0xa92b('0x2d')],qs[_0xa92b('0x33')](_0x48a6e6[_0xa92b('0x2e')]['fields']));_0x247acc[_0xa92b('0x32')]=_0x247acc['attributes'][_0xa92b('0x34')]?_0x247acc[_0xa92b('0x32')]:_0x41cbad[_0xa92b('0x2d')];if(_0x48a6e6[_0xa92b('0x2e')][_0xa92b('0x44')]){_0x247acc['include']=[{'all':!![]}];}_0x247acc=_[_0xa92b('0x3c')]({},_0x247acc,_0x48a6e6[_0xa92b('0x3e')]);return db['SquareReport'][_0xa92b('0x45')](_0x247acc)['then'](handleEntityNotFound(_0x40812f,null))['then'](respondWithResult(_0x40812f,null))[_0xa92b('0x41')](handleError(_0x40812f,null));};exports[_0xa92b('0x46')]=function(_0x152bb4,_0xfdc3d7){return db[_0xa92b('0x29')][_0xa92b('0x46')](_0x152bb4[_0xa92b('0x47')],{})[_0xa92b('0x23')](respondWithResult(_0xfdc3d7,0xc9))[_0xa92b('0x41')](handleError(_0xfdc3d7,null));};exports[_0xa92b('0x48')]=function(_0x548340,_0x2b6eab){if(_0x548340['body']['id']){delete _0x548340['body']['id'];}return db[_0xa92b('0x29')]['find']({'where':{'id':_0x548340['params']['id']}})[_0xa92b('0x23')](handleEntityNotFound(_0x2b6eab,null))['then'](saveUpdates(_0x548340[_0xa92b('0x47')],null))[_0xa92b('0x23')](respondWithResult(_0x2b6eab,null))[_0xa92b('0x41')](handleError(_0x2b6eab,null));};exports['destroy']=function(_0x59f1ec,_0x3e8005){return db[_0xa92b('0x29')][_0xa92b('0x45')]({'where':{'id':_0x59f1ec['params']['id']}})[_0xa92b('0x23')](handleEntityNotFound(_0x3e8005,null))[_0xa92b('0x23')](removeEntity(_0x3e8005,null))[_0xa92b('0x41')](handleError(_0x3e8005,null));};exports[_0xa92b('0x49')]=function(_0x140b39,_0x543246){return db[_0xa92b('0x29')][_0xa92b('0x49')]()[_0xa92b('0x23')](respondWithResult(_0x543246,null))['catch'](handleError(_0x543246,null));}; \ No newline at end of file +var _0x8934=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','end','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x4b49cc,_0x24c7f5){var _0x3e60aa=function(_0x7c2fd8){while(--_0x7c2fd8){_0x4b49cc['push'](_0x4b49cc['shift']());}};_0x3e60aa(++_0x24c7f5);}(_0x8934,0x1db));var _0x4893=function(_0x52c8d8,_0x36a1f4){_0x52c8d8=_0x52c8d8-0x0;var _0x55a958=_0x8934[_0x52c8d8];return _0x55a958;};'use strict';var emlformat=require(_0x4893('0x0'));var rimraf=require(_0x4893('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4893('0x2'));var moment=require('moment');var BPromise=require(_0x4893('0x3'));var Mustache=require(_0x4893('0x4'));var util=require(_0x4893('0x5'));var path=require('path');var sox=require(_0x4893('0x6'));var csv=require(_0x4893('0x7'));var ejs=require(_0x4893('0x8'));var fs=require('fs');var fs_extra=require(_0x4893('0x9'));var _=require('lodash');var squel=require(_0x4893('0xa'));var crypto=require('crypto');var jsforce=require(_0x4893('0xb'));var deskjs=require(_0x4893('0xc'));var toCsv=require(_0x4893('0x7'));var querystring=require(_0x4893('0xd'));var Papa=require(_0x4893('0xe'));var Redis=require(_0x4893('0xf'));var authService=require(_0x4893('0x10'));var qs=require(_0x4893('0x11'));var as=require(_0x4893('0x12'));var hardwareService=require(_0x4893('0x13'));var logger=require(_0x4893('0x14'))(_0x4893('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4893('0x16'));var db=require(_0x4893('0x17'))['db'];function respondWithStatusCode(_0x3b36b8,_0x1e82b8){_0x1e82b8=_0x1e82b8||0xcc;return function(_0x3184dd){if(_0x3184dd){return _0x3b36b8[_0x4893('0x18')](_0x1e82b8);}return _0x3b36b8['status'](_0x1e82b8)['end']();};}function respondWithResult(_0x4f338e,_0x5ee7ba){_0x5ee7ba=_0x5ee7ba||0xc8;return function(_0x41e9d1){if(_0x41e9d1){return _0x4f338e[_0x4893('0x19')](_0x5ee7ba)[_0x4893('0x1a')](_0x41e9d1);}};}function respondWithFilteredResult(_0x4af71c,_0x5e4b9f){return function(_0x2c3151){if(_0x2c3151){var _0x388d95=typeof _0x5e4b9f['offset']===_0x4893('0x1b')&&typeof _0x5e4b9f[_0x4893('0x1c')]==='undefined';var _0x509f05=_0x2c3151['count'];var _0x13ea56=_0x388d95?0x0:_0x5e4b9f['offset'];var _0x3358f3=_0x388d95?_0x2c3151[_0x4893('0x1d')]:_0x5e4b9f[_0x4893('0x1e')]+_0x5e4b9f[_0x4893('0x1c')];var _0x375886;if(_0x3358f3>=_0x509f05){_0x3358f3=_0x509f05;_0x375886=0xc8;}else{_0x375886=0xce;}_0x4af71c[_0x4893('0x19')](_0x375886);return _0x4af71c['set'](_0x4893('0x1f'),_0x13ea56+'-'+_0x3358f3+'/'+_0x509f05)[_0x4893('0x1a')](_0x2c3151);}return null;};}function patchUpdates(_0x52d779){return function(_0x13a2ac){try{jsonpatch[_0x4893('0x20')](_0x13a2ac,_0x52d779,!![]);}catch(_0x22eb38){return BPromise['reject'](_0x22eb38);}return _0x13a2ac[_0x4893('0x21')]();};}function saveUpdates(_0x442ea6,_0x58fde3){return function(_0x5f5d47){if(_0x5f5d47){return _0x5f5d47['update'](_0x442ea6)[_0x4893('0x22')](function(_0xa54b0e){return _0xa54b0e;});}return null;};}function removeEntity(_0x2f4d36,_0x38cfd5){return function(_0x273b3b){if(_0x273b3b){return _0x273b3b['destroy']()[_0x4893('0x22')](function(){_0x2f4d36['status'](0xcc)[_0x4893('0x23')]();});}};}function handleEntityNotFound(_0x464b43,_0x4a8aed){return function(_0x4ab8d8){if(!_0x4ab8d8){_0x464b43['sendStatus'](0x194);}return _0x4ab8d8;};}function handleError(_0x3c0ce1,_0x1a0bfe){_0x1a0bfe=_0x1a0bfe||0x1f4;return function(_0x297e1a){logger[_0x4893('0x24')](_0x297e1a[_0x4893('0x25')]);if(_0x297e1a[_0x4893('0x26')]){delete _0x297e1a[_0x4893('0x26')];}_0x3c0ce1[_0x4893('0x19')](_0x1a0bfe)['send'](_0x297e1a);};}exports[_0x4893('0x27')]=function(_0x293032,_0xb0e31d){var _0x5e7178={},_0x1b9d51={},_0x34bf09={'count':0x0,'rows':[]};var _0x4ab367=_[_0x4893('0x28')](db[_0x4893('0x29')][_0x4893('0x2a')],function(_0x56f547){return{'name':_0x56f547[_0x4893('0x2b')],'type':_0x56f547[_0x4893('0x2c')][_0x4893('0x2d')]};});_0x1b9d51[_0x4893('0x2e')]=_[_0x4893('0x28')](_0x4ab367,'name');_0x1b9d51[_0x4893('0x2f')]=_[_0x4893('0x30')](_0x293032[_0x4893('0x2f')]);_0x1b9d51[_0x4893('0x31')]=_[_0x4893('0x32')](_0x1b9d51[_0x4893('0x2e')],_0x1b9d51[_0x4893('0x2f')]);_0x5e7178[_0x4893('0x33')]=_[_0x4893('0x32')](_0x1b9d51[_0x4893('0x2e')],qs['fields'](_0x293032[_0x4893('0x2f')][_0x4893('0x34')]));_0x5e7178[_0x4893('0x33')]=_0x5e7178[_0x4893('0x33')][_0x4893('0x35')]?_0x5e7178[_0x4893('0x33')]:_0x1b9d51[_0x4893('0x2e')];if(!_0x293032['query'][_0x4893('0x36')](_0x4893('0x37'))){_0x5e7178['limit']=qs[_0x4893('0x1c')](_0x293032[_0x4893('0x2f')][_0x4893('0x1c')]);_0x5e7178[_0x4893('0x1e')]=qs[_0x4893('0x1e')](_0x293032[_0x4893('0x2f')]['offset']);}_0x5e7178[_0x4893('0x38')]=qs[_0x4893('0x39')](_0x293032[_0x4893('0x2f')][_0x4893('0x39')]);_0x5e7178[_0x4893('0x3a')]=qs[_0x4893('0x31')](_[_0x4893('0x3b')](_0x293032['query'],_0x1b9d51['filters']),_0x4ab367);if(_0x293032['query'][_0x4893('0x3c')]){_0x5e7178['where']=_[_0x4893('0x3d')](_0x5e7178[_0x4893('0x3a')],{'$or':_['map'](_0x4ab367,function(_0x3b36fa){if(_0x3b36fa[_0x4893('0x2c')]!==_0x4893('0x3e')){var _0x961819={};_0x961819[_0x3b36fa[_0x4893('0x26')]]={'$like':'%'+_0x293032['query'][_0x4893('0x3c')]+'%'};return _0x961819;}})});}_0x5e7178=_[_0x4893('0x3d')]({},_0x5e7178,_0x293032['options']);var _0x4b8f85={'where':_0x5e7178[_0x4893('0x3a')]};return db[_0x4893('0x29')][_0x4893('0x1d')](_0x4b8f85)[_0x4893('0x22')](function(_0x3e2ed1){_0x34bf09['count']=_0x3e2ed1;if(_0x293032[_0x4893('0x2f')][_0x4893('0x3f')]){_0x5e7178[_0x4893('0x40')]=[{'all':!![]}];}return db[_0x4893('0x29')]['findAll'](_0x5e7178);})[_0x4893('0x22')](function(_0x1aaa55){_0x34bf09[_0x4893('0x41')]=_0x1aaa55;return _0x34bf09;})[_0x4893('0x22')](respondWithFilteredResult(_0xb0e31d,_0x5e7178))[_0x4893('0x42')](handleError(_0xb0e31d,null));};exports[_0x4893('0x43')]=function(_0xa2ad65,_0x48dc09){var _0x304c87={'raw':!![],'where':{'id':_0xa2ad65[_0x4893('0x44')]['id']}},_0x4982c8={};_0x4982c8[_0x4893('0x2e')]=_[_0x4893('0x30')](db[_0x4893('0x29')]['rawAttributes']);_0x4982c8[_0x4893('0x2f')]=_[_0x4893('0x30')](_0xa2ad65[_0x4893('0x2f')]);_0x4982c8[_0x4893('0x31')]=_['intersection'](_0x4982c8[_0x4893('0x2e')],_0x4982c8[_0x4893('0x2f')]);_0x304c87[_0x4893('0x33')]=_[_0x4893('0x32')](_0x4982c8['model'],qs[_0x4893('0x34')](_0xa2ad65[_0x4893('0x2f')][_0x4893('0x34')]));_0x304c87[_0x4893('0x33')]=_0x304c87['attributes'][_0x4893('0x35')]?_0x304c87[_0x4893('0x33')]:_0x4982c8['model'];if(_0xa2ad65['query'][_0x4893('0x3f')]){_0x304c87[_0x4893('0x40')]=[{'all':!![]}];}_0x304c87=_['merge']({},_0x304c87,_0xa2ad65[_0x4893('0x45')]);return db[_0x4893('0x29')][_0x4893('0x46')](_0x304c87)[_0x4893('0x22')](handleEntityNotFound(_0x48dc09,null))[_0x4893('0x22')](respondWithResult(_0x48dc09,null))[_0x4893('0x42')](handleError(_0x48dc09,null));};exports[_0x4893('0x47')]=function(_0x316cd5,_0x427977){return db[_0x4893('0x29')]['create'](_0x316cd5[_0x4893('0x48')],{})[_0x4893('0x22')](respondWithResult(_0x427977,0xc9))[_0x4893('0x42')](handleError(_0x427977,null));};exports['update']=function(_0x2879be,_0x59ae39){if(_0x2879be['body']['id']){delete _0x2879be['body']['id'];}return db[_0x4893('0x29')]['find']({'where':{'id':_0x2879be[_0x4893('0x44')]['id']}})[_0x4893('0x22')](handleEntityNotFound(_0x59ae39,null))['then'](saveUpdates(_0x2879be[_0x4893('0x48')],null))[_0x4893('0x22')](respondWithResult(_0x59ae39,null))[_0x4893('0x42')](handleError(_0x59ae39,null));};exports[_0x4893('0x49')]=function(_0x430dc7,_0x3edb27){return db[_0x4893('0x29')]['find']({'where':{'id':_0x430dc7[_0x4893('0x44')]['id']}})[_0x4893('0x22')](handleEntityNotFound(_0x3edb27,null))[_0x4893('0x22')](removeEntity(_0x3edb27,null))[_0x4893('0x42')](handleError(_0x3edb27,null));};exports[_0x4893('0x4a')]=function(_0x203cb1,_0xc7d2ec){return db[_0x4893('0x29')]['describe']()['then'](respondWithResult(_0xc7d2ec,null))[_0x4893('0x42')](handleError(_0xc7d2ec,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1f34189..e66199f 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 _0x2760=['../../config/environment','exports','define','SquareReport','uid_pname','uniqueid','leaveAt','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x206a02,_0xf4fb2d){var _0x5c9a96=function(_0x496791){while(--_0x496791){_0x206a02['push'](_0x206a02['shift']());}};_0x5c9a96(++_0xf4fb2d);}(_0x2760,0xaf));var _0x0276=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0x2760[_0x4ec13d];return _0x3c3fa7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0276('0x0'))(_0x0276('0x1'));var moment=require(_0x0276('0x2'));var BPromise=require(_0x0276('0x3'));var rp=require(_0x0276('0x4'));var fs=require('fs');var path=require(_0x0276('0x5'));var rimraf=require(_0x0276('0x6'));var config=require(_0x0276('0x7'));var attributes=require('./squareReport.attributes');module[_0x0276('0x8')]=function(_0x2880ea,_0x160e19){return _0x2880ea[_0x0276('0x9')](_0x0276('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x0276('0xb'),'fields':[_0x0276('0xc'),'project_name']},{'name':_0x0276('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ef6=['report_square','uid_pname','project_name','leaveAt','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3ef6,0x1cb));var _0x63ef=function(_0x362e6d,_0x4d40b0){_0x362e6d=_0x362e6d-0x0;var _0x416d99=_0x3ef6[_0x362e6d];return _0x416d99;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x63ef('0x0'))('api');var moment=require(_0x63ef('0x1'));var BPromise=require(_0x63ef('0x2'));var rp=require(_0x63ef('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63ef('0x4'));var config=require(_0x63ef('0x5'));var attributes=require(_0x63ef('0x6'));module['exports']=function(_0x438b5a,_0x26b46e){return _0x438b5a[_0x63ef('0x7')](_0x63ef('0x8'),attributes,{'tableName':_0x63ef('0x9'),'paranoid':![],'indexes':[{'name':_0x63ef('0xa'),'fields':['uniqueid',_0x63ef('0xb')]},{'name':_0x63ef('0xc'),'fields':[_0x63ef('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 514d065..5c10568 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 _0x3633=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','then','stringify','update','where','attributes','limit','UpdateSquareReport','util','moment','bluebird','ioredis'];(function(_0x263dc6,_0x133a6b){var _0x4357e6=function(_0x173a95){while(--_0x173a95){_0x263dc6['push'](_0x263dc6['shift']());}};_0x4357e6(++_0x133a6b);}(_0x3633,0x1be));var _0x3363=function(_0x12b676,_0x43ce6e){_0x12b676=_0x12b676-0x0;var _0xa69b34=_0x3633[_0x12b676];return _0xa69b34;};'use strict';var _=require('lodash');var util=require(_0x3363('0x0'));var moment=require(_0x3363('0x1'));var BPromise=require(_0x3363('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3363('0x3'));var db=require(_0x3363('0x4'))['db'];var utils=require(_0x3363('0x5'));var logger=require(_0x3363('0x6'))('rpc');var config=require(_0x3363('0x7'));var jayson=require(_0x3363('0x8'));var client=jayson['client'][_0x3363('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe37570,_0x40a7c3,_0x297db9){return new BPromise(function(_0x54de0a,_0x4e0910){return client['request'](_0xe37570,_0x297db9)['then'](function(_0x2c4708){logger[_0x3363('0xa')](_0x3363('0xb'),_0x40a7c3,'request\x20sent');logger[_0x3363('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x40a7c3,_0x3363('0xd'),JSON['stringify'](_0x2c4708));if(_0x2c4708[_0x3363('0xe')]){if(_0x2c4708[_0x3363('0xe')]['code']===0x1f4){logger[_0x3363('0xe')](_0x3363('0xb'),_0x40a7c3,_0x2c4708[_0x3363('0xe')]['message']);return _0x4e0910(_0x2c4708['error']['message']);}logger[_0x3363('0xe')](_0x3363('0xb'),_0x40a7c3,_0x2c4708['error'][_0x3363('0xf')]);return _0x54de0a(_0x2c4708[_0x3363('0xe')][_0x3363('0xf')]);}else{logger[_0x3363('0xa')](_0x3363('0xb'),_0x40a7c3,'request\x20sent');_0x54de0a(_0x2c4708[_0x3363('0x10')][_0x3363('0xf')]);}})[_0x3363('0x11')](function(_0x2f5c56){logger[_0x3363('0xe')](_0x3363('0xb'),_0x40a7c3,_0x2f5c56);_0x4e0910(_0x2f5c56);});});}exports[_0x3363('0x12')]=function(_0x24d786){var _0x428f4c=this;return new Promise(function(_0x430e77,_0x3c4e9b){return db[_0x3363('0x13')][_0x3363('0x14')](_0x24d786['body'],{'raw':_0x24d786[_0x3363('0x15')]?_0x24d786[_0x3363('0x15')][_0x3363('0x16')]===undefined?!![]:![]:!![]})[_0x3363('0x17')](function(_0x1ed8c1){logger[_0x3363('0xa')](_0x3363('0x12'),_0x24d786);logger[_0x3363('0xc')](_0x3363('0x12'),_0x24d786,JSON[_0x3363('0x18')](_0x1ed8c1));_0x430e77(_0x1ed8c1);})[_0x3363('0x11')](function(_0x2fa504){logger['error'](_0x3363('0x12'),_0x2fa504['message'],_0x24d786);_0x3c4e9b(_0x428f4c[_0x3363('0xe')](0x1f4,_0x2fa504[_0x3363('0xf')]));});});};exports['UpdateSquareReport']=function(_0x536e12){var _0x29c824=this;return new Promise(function(_0x814e4a,_0x4abc4b){return db[_0x3363('0x13')][_0x3363('0x19')](_0x536e12['body'],{'raw':_0x536e12['options']?_0x536e12['options'][_0x3363('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x536e12[_0x3363('0x15')]?_0x536e12['options'][_0x3363('0x1a')]||null:null,'attributes':_0x536e12[_0x3363('0x15')]?_0x536e12[_0x3363('0x15')][_0x3363('0x1b')]||null:null,'limit':_0x536e12[_0x3363('0x15')]?_0x536e12[_0x3363('0x15')][_0x3363('0x1c')]||null:null})[_0x3363('0x17')](function(_0xdfa096){logger[_0x3363('0xa')](_0x3363('0x1d'),_0x536e12);logger[_0x3363('0xc')](_0x3363('0x1d'),_0x536e12,JSON[_0x3363('0x18')](_0xdfa096));_0x814e4a(_0xdfa096);})['catch'](function(_0x549b7e){logger[_0x3363('0xe')](_0x3363('0x1d'),_0x549b7e[_0x3363('0xf')],_0x536e12);_0x4abc4b(_0x29c824[_0x3363('0xe')](0x1f4,_0x549b7e[_0x3363('0xf')]));});});}; \ No newline at end of file +var _0xd0d3=['code','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','SquareReport','body','options','raw','then','UpdateSquareReport','update','attributes','limit','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0xd0d3,0x16a));var _0x3d0d=function(_0x56621e,_0x355ad1){_0x56621e=_0x56621e-0x0;var _0x81f5ce=_0xd0d3[_0x56621e];return _0x81f5ce;};'use strict';var _=require('lodash');var util=require(_0x3d0d('0x0'));var moment=require(_0x3d0d('0x1'));var BPromise=require(_0x3d0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d0d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d0d('0x4'))(_0x3d0d('0x5'));var config=require(_0x3d0d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3d0d('0x7')][_0x3d0d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46597e,_0x179afe,_0x545e2a){return new BPromise(function(_0x5751b3,_0x2f9a3e){return client['request'](_0x46597e,_0x545e2a)['then'](function(_0x29fe0b){logger[_0x3d0d('0x9')]('SquareReport,\x20%s,\x20%s',_0x179afe,_0x3d0d('0xa'));logger[_0x3d0d('0xb')](_0x3d0d('0xc'),_0x179afe,'request\x20sent',JSON[_0x3d0d('0xd')](_0x29fe0b));if(_0x29fe0b[_0x3d0d('0xe')]){if(_0x29fe0b[_0x3d0d('0xe')][_0x3d0d('0xf')]===0x1f4){logger[_0x3d0d('0xe')](_0x3d0d('0x10'),_0x179afe,_0x29fe0b[_0x3d0d('0xe')][_0x3d0d('0x11')]);return _0x2f9a3e(_0x29fe0b['error'][_0x3d0d('0x11')]);}logger[_0x3d0d('0xe')](_0x3d0d('0x10'),_0x179afe,_0x29fe0b[_0x3d0d('0xe')][_0x3d0d('0x11')]);return _0x5751b3(_0x29fe0b[_0x3d0d('0xe')][_0x3d0d('0x11')]);}else{logger['info'](_0x3d0d('0x10'),_0x179afe,_0x3d0d('0xa'));_0x5751b3(_0x29fe0b['result'][_0x3d0d('0x11')]);}})[_0x3d0d('0x12')](function(_0xd16936){logger[_0x3d0d('0xe')](_0x3d0d('0x10'),_0x179afe,_0xd16936);_0x2f9a3e(_0xd16936);});});}exports[_0x3d0d('0x13')]=function(_0x38117a){var _0x2a2584=this;return new Promise(function(_0x17c612,_0x3ee267){return db[_0x3d0d('0x14')]['create'](_0x38117a[_0x3d0d('0x15')],{'raw':_0x38117a[_0x3d0d('0x16')]?_0x38117a[_0x3d0d('0x16')][_0x3d0d('0x17')]===undefined?!![]:![]:!![]})[_0x3d0d('0x18')](function(_0x217d12){logger[_0x3d0d('0x9')](_0x3d0d('0x13'),_0x38117a);logger[_0x3d0d('0xb')](_0x3d0d('0x13'),_0x38117a,JSON['stringify'](_0x217d12));_0x17c612(_0x217d12);})[_0x3d0d('0x12')](function(_0x485f9e){logger['error'](_0x3d0d('0x13'),_0x485f9e['message'],_0x38117a);_0x3ee267(_0x2a2584['error'](0x1f4,_0x485f9e[_0x3d0d('0x11')]));});});};exports[_0x3d0d('0x19')]=function(_0x90d40f){var _0x36c4df=this;return new Promise(function(_0xbb80b9,_0x297fa2){return db[_0x3d0d('0x14')][_0x3d0d('0x1a')](_0x90d40f['body'],{'raw':_0x90d40f[_0x3d0d('0x16')]?_0x90d40f[_0x3d0d('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x90d40f[_0x3d0d('0x16')]?_0x90d40f[_0x3d0d('0x16')]['where']||null:null,'attributes':_0x90d40f[_0x3d0d('0x16')]?_0x90d40f['options'][_0x3d0d('0x1b')]||null:null,'limit':_0x90d40f['options']?_0x90d40f['options'][_0x3d0d('0x1c')]||null:null})[_0x3d0d('0x18')](function(_0x5de7af){logger[_0x3d0d('0x9')](_0x3d0d('0x19'),_0x90d40f);logger['debug'](_0x3d0d('0x19'),_0x90d40f,JSON[_0x3d0d('0xd')](_0x5de7af));_0xbb80b9(_0x5de7af);})['catch'](function(_0x304d4c){logger[_0x3d0d('0xe')](_0x3d0d('0x19'),_0x304d4c[_0x3d0d('0x11')],_0x90d40f);_0x297fa2(_0x36c4df[_0x3d0d('0xe')](0x1f4,_0x304d4c[_0x3d0d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 54e9a61..dbe9294 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 _0x311c=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','index','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer'];(function(_0x565faf,_0x5f3718){var _0x42292f=function(_0x514b49){while(--_0x514b49){_0x565faf['push'](_0x565faf['shift']());}};_0x42292f(++_0x5f3718);}(_0x311c,0xaf));var _0xc311=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0x311c[_0x4a209a];return _0x4b3c20;};'use strict';var multer=require(_0xc311('0x0'));var util=require(_0xc311('0x1'));var path=require(_0xc311('0x2'));var timeout=require(_0xc311('0x3'));var express=require(_0xc311('0x4'));var router=express[_0xc311('0x5')]();var fs_extra=require(_0xc311('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc311('0x7'));var config=require(_0xc311('0x8'));var controller=require(_0xc311('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc311('0xa')]);router[_0xc311('0xb')](_0xc311('0xc'),auth[_0xc311('0xd')](),controller[_0xc311('0xe')]);router[_0xc311('0xb')](_0xc311('0xf'),auth[_0xc311('0xd')](),controller[_0xc311('0x10')]);router['post']('/',auth[_0xc311('0xd')](),controller['create']);router[_0xc311('0x11')](_0xc311('0xf'),auth[_0xc311('0xd')](),controller[_0xc311('0x12')]);router[_0xc311('0x13')](_0xc311('0xf'),auth[_0xc311('0xd')](),controller[_0xc311('0x14')]);module[_0xc311('0x15')]=router; \ No newline at end of file +var _0x2464=['create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x2464,0xb5));var _0x4246=function(_0x356478,_0x590be1){_0x356478=_0x356478-0x0;var _0x17bd00=_0x2464[_0x356478];return _0x17bd00;};'use strict';var multer=require(_0x4246('0x0'));var util=require(_0x4246('0x1'));var path=require('path');var timeout=require(_0x4246('0x2'));var express=require(_0x4246('0x3'));var router=express[_0x4246('0x4')]();var fs_extra=require(_0x4246('0x5'));var auth=require(_0x4246('0x6'));var interaction=require(_0x4246('0x7'));var config=require('../../config/environment');var controller=require(_0x4246('0x8'));router[_0x4246('0x9')]('/',auth[_0x4246('0xa')](),controller[_0x4246('0xb')]);router[_0x4246('0x9')](_0x4246('0xc'),auth[_0x4246('0xa')](),controller[_0x4246('0xd')]);router[_0x4246('0x9')](_0x4246('0xe'),auth['isAuthenticated'](),controller[_0x4246('0xf')]);router[_0x4246('0x10')]('/',auth[_0x4246('0xa')](),controller[_0x4246('0x11')]);router[_0x4246('0x12')](_0x4246('0xe'),auth['isAuthenticated'](),controller[_0x4246('0x13')]);router[_0x4246('0x14')](_0x4246('0xe'),auth[_0x4246('0xa')](),controller[_0x4246('0x15')]);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 a2c28e6..5e933be 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 _0x88d2=['exports','TEXT','STRING'];(function(_0x269c65,_0x5dccc1){var _0x31ce14=function(_0x1a64bc){while(--_0x1a64bc){_0x269c65['push'](_0x269c65['shift']());}};_0x31ce14(++_0x5dccc1);}(_0x88d2,0x6f));var _0x288d=function(_0x52bfd9,_0x2183fe){_0x52bfd9=_0x52bfd9-0x0;var _0x463be5=_0x88d2[_0x52bfd9];return _0x463be5;};'use strict';var Sequelize=require('sequelize');module[_0x288d('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x288d('0x1')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x288d('0x2')]}}; \ No newline at end of file +var _0x4283=['STRING','TEXT','sequelize','exports'];(function(_0x5aa023,_0x1cf1d2){var _0x31ceb5=function(_0x40f643){while(--_0x40f643){_0x5aa023['push'](_0x5aa023['shift']());}};_0x31ceb5(++_0x1cf1d2);}(_0x4283,0x1c6));var _0x3428=function(_0xb25e3,_0x34dbad){_0xb25e3=_0xb25e3-0x0;var _0x3236fe=_0x4283[_0xb25e3];return _0x3236fe;};'use strict';var Sequelize=require(_0x3428('0x0'));module[_0x3428('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x3428('0x2')]},'application':{'type':Sequelize[_0x3428('0x2')]},'data':{'type':Sequelize[_0x3428('0x3')]},'project_name':{'type':Sequelize[_0x3428('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 24e1daf..f670de9 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 _0x2a2b=['params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','util','sox','to-csv','lodash','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','type','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','VIRTUAL','options','where','SquareDetailsReport','include','findAll','rows','catch','show'];(function(_0x20b204,_0x1434f2){var _0x166dc0=function(_0x270011){while(--_0x270011){_0x20b204['push'](_0x20b204['shift']());}};_0x166dc0(++_0x1434f2);}(_0x2a2b,0x1d5));var _0xb2a2=function(_0xddd0ea,_0x2685bd){_0xddd0ea=_0xddd0ea-0x0;var _0x1bc329=_0x2a2b[_0xddd0ea];return _0x1bc329;};'use strict';var emlformat=require(_0xb2a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2a2('0x1'));var jsonpatch=require(_0xb2a2('0x2'));var rp=require('request-promise');var moment=require(_0xb2a2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb2a2('0x4'));var path=require('path');var sox=require(_0xb2a2('0x5'));var csv=require(_0xb2a2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2a2('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb2a2('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb2a2('0x9'));var qs=require(_0xb2a2('0xa'));var as=require(_0xb2a2('0xb'));var hardwareService=require(_0xb2a2('0xc'));var logger=require(_0xb2a2('0xd'))(_0xb2a2('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb2a2('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x168101,_0x1cca7c){_0x1cca7c=_0x1cca7c||0xcc;return function(_0x4a80fe){if(_0x4a80fe){return _0x168101[_0xb2a2('0x10')](_0x1cca7c);}return _0x168101[_0xb2a2('0x11')](_0x1cca7c)[_0xb2a2('0x12')]();};}function respondWithResult(_0x190638,_0x3346c4){_0x3346c4=_0x3346c4||0xc8;return function(_0x5a6bab){if(_0x5a6bab){return _0x190638[_0xb2a2('0x11')](_0x3346c4)[_0xb2a2('0x13')](_0x5a6bab);}};}function respondWithFilteredResult(_0x3c0afe,_0x1d5ec8){return function(_0x2aec2f){if(_0x2aec2f){var _0x574a21=typeof _0x1d5ec8[_0xb2a2('0x14')]==='undefined'&&typeof _0x1d5ec8[_0xb2a2('0x15')]===_0xb2a2('0x16');var _0x2c8ea9=_0x2aec2f[_0xb2a2('0x17')];var _0x4dddfc=_0x574a21?0x0:_0x1d5ec8['offset'];var _0x2d41d9=_0x574a21?_0x2aec2f[_0xb2a2('0x17')]:_0x1d5ec8[_0xb2a2('0x14')]+_0x1d5ec8['limit'];var _0x22d157;if(_0x2d41d9>=_0x2c8ea9){_0x2d41d9=_0x2c8ea9;_0x22d157=0xc8;}else{_0x22d157=0xce;}_0x3c0afe[_0xb2a2('0x11')](_0x22d157);return _0x3c0afe['set'](_0xb2a2('0x18'),_0x4dddfc+'-'+_0x2d41d9+'/'+_0x2c8ea9)[_0xb2a2('0x13')](_0x2aec2f);}return null;};}function patchUpdates(_0x2e6e70){return function(_0x101643){try{jsonpatch[_0xb2a2('0x19')](_0x101643,_0x2e6e70,!![]);}catch(_0x47cf42){return BPromise[_0xb2a2('0x1a')](_0x47cf42);}return _0x101643['save']();};}function saveUpdates(_0xff0d62,_0x52792d){return function(_0x5411c6){if(_0x5411c6){return _0x5411c6[_0xb2a2('0x1b')](_0xff0d62)['then'](function(_0x5c04a1){return _0x5c04a1;});}return null;};}function removeEntity(_0xffc2d1,_0x3a32c8){return function(_0x503a41){if(_0x503a41){return _0x503a41[_0xb2a2('0x1c')]()[_0xb2a2('0x1d')](function(){_0xffc2d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52a2e4,_0x22dbbb){return function(_0x498ba1){if(!_0x498ba1){_0x52a2e4[_0xb2a2('0x10')](0x194);}return _0x498ba1;};}function handleError(_0x189461,_0x1de2d8){_0x1de2d8=_0x1de2d8||0x1f4;return function(_0x3b8f50){logger[_0xb2a2('0x1e')](_0x3b8f50[_0xb2a2('0x1f')]);if(_0x3b8f50[_0xb2a2('0x20')]){delete _0x3b8f50[_0xb2a2('0x20')];}_0x189461[_0xb2a2('0x11')](_0x1de2d8)['send'](_0x3b8f50);};}exports[_0xb2a2('0x21')]=function(_0x4da44a,_0x50b489){var _0x63d9bc={},_0x9614bf={},_0x3b138a={'count':0x0,'rows':[]};var _0x55abda=_[_0xb2a2('0x22')](db['SquareDetailsReport']['rawAttributes'],function(_0x44491e){return{'name':_0x44491e['fieldName'],'type':_0x44491e[_0xb2a2('0x23')]['key']};});_0x9614bf['model']=_[_0xb2a2('0x22')](_0x55abda,_0xb2a2('0x20'));_0x9614bf['query']=_[_0xb2a2('0x24')](_0x4da44a[_0xb2a2('0x25')]);_0x9614bf['filters']=_['intersection'](_0x9614bf[_0xb2a2('0x26')],_0x9614bf[_0xb2a2('0x25')]);_0x63d9bc['attributes']=_[_0xb2a2('0x27')](_0x9614bf[_0xb2a2('0x26')],qs[_0xb2a2('0x28')](_0x4da44a[_0xb2a2('0x25')][_0xb2a2('0x28')]));_0x63d9bc[_0xb2a2('0x29')]=_0x63d9bc[_0xb2a2('0x29')][_0xb2a2('0x2a')]?_0x63d9bc['attributes']:_0x9614bf[_0xb2a2('0x26')];if(!_0x4da44a[_0xb2a2('0x25')][_0xb2a2('0x2b')](_0xb2a2('0x2c'))){_0x63d9bc['limit']=qs[_0xb2a2('0x15')](_0x4da44a[_0xb2a2('0x25')][_0xb2a2('0x15')]);_0x63d9bc[_0xb2a2('0x14')]=qs[_0xb2a2('0x14')](_0x4da44a[_0xb2a2('0x25')][_0xb2a2('0x14')]);}_0x63d9bc['order']=qs['sort'](_0x4da44a[_0xb2a2('0x25')][_0xb2a2('0x2d')]);_0x63d9bc['where']=qs[_0xb2a2('0x2e')](_[_0xb2a2('0x2f')](_0x4da44a[_0xb2a2('0x25')],_0x9614bf[_0xb2a2('0x2e')]),_0x55abda);if(_0x4da44a[_0xb2a2('0x25')][_0xb2a2('0x30')]){_0x63d9bc['where']=_[_0xb2a2('0x31')](_0x63d9bc['where'],{'$or':_[_0xb2a2('0x22')](_0x55abda,function(_0x5c0db1){if(_0x5c0db1[_0xb2a2('0x23')]!==_0xb2a2('0x32')){var _0x4e904f={};_0x4e904f[_0x5c0db1['name']]={'$like':'%'+_0x4da44a[_0xb2a2('0x25')]['filter']+'%'};return _0x4e904f;}})});}_0x63d9bc=_[_0xb2a2('0x31')]({},_0x63d9bc,_0x4da44a[_0xb2a2('0x33')]);var _0xecbfda={'where':_0x63d9bc[_0xb2a2('0x34')]};return db[_0xb2a2('0x35')][_0xb2a2('0x17')](_0xecbfda)[_0xb2a2('0x1d')](function(_0x7e61a1){_0x3b138a[_0xb2a2('0x17')]=_0x7e61a1;if(_0x4da44a[_0xb2a2('0x25')]['includeAll']){_0x63d9bc[_0xb2a2('0x36')]=[{'all':!![]}];}return db[_0xb2a2('0x35')][_0xb2a2('0x37')](_0x63d9bc);})[_0xb2a2('0x1d')](function(_0x3c1534){_0x3b138a[_0xb2a2('0x38')]=_0x3c1534;return _0x3b138a;})[_0xb2a2('0x1d')](respondWithFilteredResult(_0x50b489,_0x63d9bc))[_0xb2a2('0x39')](handleError(_0x50b489,null));};exports[_0xb2a2('0x3a')]=function(_0x830426,_0x3c53ee){var _0xe9faac={'raw':!![],'where':{'id':_0x830426[_0xb2a2('0x3b')]['id']}},_0x418ab2={};_0x418ab2[_0xb2a2('0x26')]=_[_0xb2a2('0x24')](db[_0xb2a2('0x35')][_0xb2a2('0x3c')]);_0x418ab2[_0xb2a2('0x25')]=_[_0xb2a2('0x24')](_0x830426[_0xb2a2('0x25')]);_0x418ab2[_0xb2a2('0x2e')]=_[_0xb2a2('0x27')](_0x418ab2[_0xb2a2('0x26')],_0x418ab2[_0xb2a2('0x25')]);_0xe9faac['attributes']=_[_0xb2a2('0x27')](_0x418ab2[_0xb2a2('0x26')],qs[_0xb2a2('0x28')](_0x830426['query']['fields']));_0xe9faac[_0xb2a2('0x29')]=_0xe9faac[_0xb2a2('0x29')][_0xb2a2('0x2a')]?_0xe9faac[_0xb2a2('0x29')]:_0x418ab2['model'];if(_0x830426[_0xb2a2('0x25')][_0xb2a2('0x3d')]){_0xe9faac['include']=[{'all':!![]}];}_0xe9faac=_['merge']({},_0xe9faac,_0x830426[_0xb2a2('0x33')]);return db[_0xb2a2('0x35')][_0xb2a2('0x3e')](_0xe9faac)[_0xb2a2('0x1d')](handleEntityNotFound(_0x3c53ee,null))[_0xb2a2('0x1d')](respondWithResult(_0x3c53ee,null))[_0xb2a2('0x39')](handleError(_0x3c53ee,null));};exports[_0xb2a2('0x3f')]=function(_0x34d3de,_0x98b887){return db[_0xb2a2('0x35')][_0xb2a2('0x3f')](_0x34d3de[_0xb2a2('0x40')],{})[_0xb2a2('0x1d')](respondWithResult(_0x98b887,0xc9))[_0xb2a2('0x39')](handleError(_0x98b887,null));};exports['update']=function(_0x412d35,_0x19cc46){if(_0x412d35[_0xb2a2('0x40')]['id']){delete _0x412d35['body']['id'];}return db[_0xb2a2('0x35')][_0xb2a2('0x3e')]({'where':{'id':_0x412d35[_0xb2a2('0x3b')]['id']}})[_0xb2a2('0x1d')](handleEntityNotFound(_0x19cc46,null))[_0xb2a2('0x1d')](saveUpdates(_0x412d35[_0xb2a2('0x40')],null))[_0xb2a2('0x1d')](respondWithResult(_0x19cc46,null))[_0xb2a2('0x39')](handleError(_0x19cc46,null));};exports[_0xb2a2('0x1c')]=function(_0x1faf28,_0x3e4e67){return db['SquareDetailsReport'][_0xb2a2('0x3e')]({'where':{'id':_0x1faf28[_0xb2a2('0x3b')]['id']}})[_0xb2a2('0x1d')](handleEntityNotFound(_0x3e4e67,null))[_0xb2a2('0x1d')](removeEntity(_0x3e4e67,null))['catch'](handleError(_0x3e4e67,null));};exports[_0xb2a2('0x41')]=function(_0x558536,_0x243987){return db[_0xb2a2('0x35')]['describe']()[_0xb2a2('0x1d')](respondWithResult(_0x243987,null))[_0xb2a2('0x39')](handleError(_0x243987,null));}; \ No newline at end of file +var _0xd2ff=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','SquareDetailsReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x2a534f,_0x23705b){var _0x23d365=function(_0x2f5849){while(--_0x2f5849){_0x2a534f['push'](_0x2a534f['shift']());}};_0x23d365(++_0x23705b);}(_0xd2ff,0x1e2));var _0xfd2f=function(_0x4d8dc9,_0x544834){_0x4d8dc9=_0x4d8dc9-0x0;var _0x349d02=_0xd2ff[_0x4d8dc9];return _0x349d02;};'use strict';var emlformat=require(_0xfd2f('0x0'));var rimraf=require(_0xfd2f('0x1'));var zipdir=require(_0xfd2f('0x2'));var jsonpatch=require(_0xfd2f('0x3'));var rp=require('request-promise');var moment=require(_0xfd2f('0x4'));var BPromise=require(_0xfd2f('0x5'));var Mustache=require(_0xfd2f('0x6'));var util=require(_0xfd2f('0x7'));var path=require(_0xfd2f('0x8'));var sox=require(_0xfd2f('0x9'));var csv=require(_0xfd2f('0xa'));var ejs=require(_0xfd2f('0xb'));var fs=require('fs');var fs_extra=require(_0xfd2f('0xc'));var _=require(_0xfd2f('0xd'));var squel=require('squel');var crypto=require(_0xfd2f('0xe'));var jsforce=require(_0xfd2f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfd2f('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfd2f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfd2f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfd2f('0x12'));var config=require(_0xfd2f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd2f('0x14'))['db'];function respondWithStatusCode(_0x152687,_0x4c7aa1){_0x4c7aa1=_0x4c7aa1||0xcc;return function(_0x45dfd7){if(_0x45dfd7){return _0x152687[_0xfd2f('0x15')](_0x4c7aa1);}return _0x152687[_0xfd2f('0x16')](_0x4c7aa1)[_0xfd2f('0x17')]();};}function respondWithResult(_0x3ad5cc,_0x2552ca){_0x2552ca=_0x2552ca||0xc8;return function(_0x5c269b){if(_0x5c269b){return _0x3ad5cc[_0xfd2f('0x16')](_0x2552ca)['json'](_0x5c269b);}};}function respondWithFilteredResult(_0x1435f3,_0x564377){return function(_0x7d038a){if(_0x7d038a){var _0x521690=typeof _0x564377[_0xfd2f('0x18')]===_0xfd2f('0x19')&&typeof _0x564377[_0xfd2f('0x1a')]===_0xfd2f('0x19');var _0x2193a5=_0x7d038a[_0xfd2f('0x1b')];var _0x111dfa=_0x521690?0x0:_0x564377[_0xfd2f('0x18')];var _0x12992a=_0x521690?_0x7d038a[_0xfd2f('0x1b')]:_0x564377['offset']+_0x564377[_0xfd2f('0x1a')];var _0x2c38a3;if(_0x12992a>=_0x2193a5){_0x12992a=_0x2193a5;_0x2c38a3=0xc8;}else{_0x2c38a3=0xce;}_0x1435f3[_0xfd2f('0x16')](_0x2c38a3);return _0x1435f3[_0xfd2f('0x1c')](_0xfd2f('0x1d'),_0x111dfa+'-'+_0x12992a+'/'+_0x2193a5)[_0xfd2f('0x1e')](_0x7d038a);}return null;};}function patchUpdates(_0x252fa4){return function(_0x4d5ec1){try{jsonpatch[_0xfd2f('0x1f')](_0x4d5ec1,_0x252fa4,!![]);}catch(_0x246848){return BPromise[_0xfd2f('0x20')](_0x246848);}return _0x4d5ec1[_0xfd2f('0x21')]();};}function saveUpdates(_0x25ad8c,_0x30a5ce){return function(_0x3a58bd){if(_0x3a58bd){return _0x3a58bd['update'](_0x25ad8c)[_0xfd2f('0x22')](function(_0x47ba69){return _0x47ba69;});}return null;};}function removeEntity(_0xd9380e,_0x159008){return function(_0x3facfd){if(_0x3facfd){return _0x3facfd[_0xfd2f('0x23')]()[_0xfd2f('0x22')](function(){_0xd9380e['status'](0xcc)[_0xfd2f('0x17')]();});}};}function handleEntityNotFound(_0x13f492,_0x3b611d){return function(_0x3df5cb){if(!_0x3df5cb){_0x13f492[_0xfd2f('0x15')](0x194);}return _0x3df5cb;};}function handleError(_0x340cd9,_0x577ac6){_0x577ac6=_0x577ac6||0x1f4;return function(_0x4b0a90){logger[_0xfd2f('0x24')](_0x4b0a90[_0xfd2f('0x25')]);if(_0x4b0a90[_0xfd2f('0x26')]){delete _0x4b0a90[_0xfd2f('0x26')];}_0x340cd9[_0xfd2f('0x16')](_0x577ac6)['send'](_0x4b0a90);};}exports['index']=function(_0x35b378,_0x25c43e){var _0x12004b={},_0x4d1346={},_0x2ae2f1={'count':0x0,'rows':[]};var _0x5e6f41=_['map'](db[_0xfd2f('0x27')][_0xfd2f('0x28')],function(_0x2f1fce){return{'name':_0x2f1fce[_0xfd2f('0x29')],'type':_0x2f1fce[_0xfd2f('0x2a')]['key']};});_0x4d1346['model']=_[_0xfd2f('0x2b')](_0x5e6f41,_0xfd2f('0x26'));_0x4d1346[_0xfd2f('0x2c')]=_['keys'](_0x35b378[_0xfd2f('0x2c')]);_0x4d1346[_0xfd2f('0x2d')]=_[_0xfd2f('0x2e')](_0x4d1346[_0xfd2f('0x2f')],_0x4d1346[_0xfd2f('0x2c')]);_0x12004b[_0xfd2f('0x30')]=_['intersection'](_0x4d1346[_0xfd2f('0x2f')],qs[_0xfd2f('0x31')](_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x31')]));_0x12004b[_0xfd2f('0x30')]=_0x12004b[_0xfd2f('0x30')][_0xfd2f('0x32')]?_0x12004b[_0xfd2f('0x30')]:_0x4d1346[_0xfd2f('0x2f')];if(!_0x35b378[_0xfd2f('0x2c')]['hasOwnProperty']('nolimit')){_0x12004b['limit']=qs[_0xfd2f('0x1a')](_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x1a')]);_0x12004b[_0xfd2f('0x18')]=qs['offset'](_0x35b378['query'][_0xfd2f('0x18')]);}_0x12004b[_0xfd2f('0x33')]=qs[_0xfd2f('0x34')](_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x34')]);_0x12004b[_0xfd2f('0x35')]=qs[_0xfd2f('0x2d')](_[_0xfd2f('0x36')](_0x35b378[_0xfd2f('0x2c')],_0x4d1346[_0xfd2f('0x2d')]),_0x5e6f41);if(_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x37')]){_0x12004b[_0xfd2f('0x35')]=_[_0xfd2f('0x38')](_0x12004b[_0xfd2f('0x35')],{'$or':_[_0xfd2f('0x2b')](_0x5e6f41,function(_0x2c3fc1){if(_0x2c3fc1[_0xfd2f('0x2a')]!==_0xfd2f('0x39')){var _0x511c5d={};_0x511c5d[_0x2c3fc1[_0xfd2f('0x26')]]={'$like':'%'+_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x37')]+'%'};return _0x511c5d;}})});}_0x12004b=_[_0xfd2f('0x38')]({},_0x12004b,_0x35b378[_0xfd2f('0x3a')]);var _0x235cbe={'where':_0x12004b[_0xfd2f('0x35')]};return db[_0xfd2f('0x27')][_0xfd2f('0x1b')](_0x235cbe)['then'](function(_0x724bb7){_0x2ae2f1[_0xfd2f('0x1b')]=_0x724bb7;if(_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x3b')]){_0x12004b[_0xfd2f('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xfd2f('0x3d')](_0x12004b);})[_0xfd2f('0x22')](function(_0x172593){_0x2ae2f1['rows']=_0x172593;return _0x2ae2f1;})[_0xfd2f('0x22')](respondWithFilteredResult(_0x25c43e,_0x12004b))['catch'](handleError(_0x25c43e,null));};exports[_0xfd2f('0x3e')]=function(_0xd94de0,_0x309dd7){var _0x55054b={'raw':!![],'where':{'id':_0xd94de0[_0xfd2f('0x3f')]['id']}},_0x134c0b={};_0x134c0b['model']=_[_0xfd2f('0x40')](db[_0xfd2f('0x27')]['rawAttributes']);_0x134c0b['query']=_['keys'](_0xd94de0[_0xfd2f('0x2c')]);_0x134c0b[_0xfd2f('0x2d')]=_[_0xfd2f('0x2e')](_0x134c0b[_0xfd2f('0x2f')],_0x134c0b[_0xfd2f('0x2c')]);_0x55054b[_0xfd2f('0x30')]=_[_0xfd2f('0x2e')](_0x134c0b[_0xfd2f('0x2f')],qs['fields'](_0xd94de0[_0xfd2f('0x2c')][_0xfd2f('0x31')]));_0x55054b[_0xfd2f('0x30')]=_0x55054b[_0xfd2f('0x30')][_0xfd2f('0x32')]?_0x55054b[_0xfd2f('0x30')]:_0x134c0b[_0xfd2f('0x2f')];if(_0xd94de0[_0xfd2f('0x2c')][_0xfd2f('0x3b')]){_0x55054b[_0xfd2f('0x3c')]=[{'all':!![]}];}_0x55054b=_[_0xfd2f('0x38')]({},_0x55054b,_0xd94de0['options']);return db['SquareDetailsReport'][_0xfd2f('0x41')](_0x55054b)[_0xfd2f('0x22')](handleEntityNotFound(_0x309dd7,null))[_0xfd2f('0x22')](respondWithResult(_0x309dd7,null))['catch'](handleError(_0x309dd7,null));};exports[_0xfd2f('0x42')]=function(_0x5357d3,_0x3e6477){return db[_0xfd2f('0x27')][_0xfd2f('0x42')](_0x5357d3[_0xfd2f('0x43')],{})[_0xfd2f('0x22')](respondWithResult(_0x3e6477,0xc9))['catch'](handleError(_0x3e6477,null));};exports['update']=function(_0x4e656f,_0x1a82a3){if(_0x4e656f[_0xfd2f('0x43')]['id']){delete _0x4e656f[_0xfd2f('0x43')]['id'];}return db[_0xfd2f('0x27')][_0xfd2f('0x41')]({'where':{'id':_0x4e656f['params']['id']}})['then'](handleEntityNotFound(_0x1a82a3,null))[_0xfd2f('0x22')](saveUpdates(_0x4e656f[_0xfd2f('0x43')],null))[_0xfd2f('0x22')](respondWithResult(_0x1a82a3,null))[_0xfd2f('0x44')](handleError(_0x1a82a3,null));};exports[_0xfd2f('0x23')]=function(_0x272c29,_0x10d211){return db[_0xfd2f('0x27')][_0xfd2f('0x41')]({'where':{'id':_0x272c29[_0xfd2f('0x3f')]['id']}})[_0xfd2f('0x22')](handleEntityNotFound(_0x10d211,null))[_0xfd2f('0x22')](removeEntity(_0x10d211,null))[_0xfd2f('0x44')](handleError(_0x10d211,null));};exports[_0xfd2f('0x45')]=function(_0x26345c,_0x16afe1){return db[_0xfd2f('0x27')][_0xfd2f('0x45')]()[_0xfd2f('0x22')](respondWithResult(_0x16afe1,null))[_0xfd2f('0x44')](handleError(_0x16afe1,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 33a151a..82db079 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 _0xd1ab=['rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details','util','../../config/logger','api','path'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0xd1ab,0x132));var _0xbd1a=function(_0x13b906,_0x4b3ae0){_0x13b906=_0x13b906-0x0;var _0x296f94=_0xd1ab[_0x13b906];return _0x296f94;};'use strict';var _=require('lodash');var util=require(_0xbd1a('0x0'));var logger=require(_0xbd1a('0x1'))(_0xbd1a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd1a('0x3'));var rimraf=require(_0xbd1a('0x4'));var config=require(_0xbd1a('0x5'));var attributes=require('./squareReportDetail.attributes');module[_0xbd1a('0x6')]=function(_0x24916d,_0xb36d86){return _0x24916d[_0xbd1a('0x7')](_0xbd1a('0x8'),attributes,{'tableName':_0xbd1a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b7e=['rimraf','../../config/environment','exports','SquareDetailsReport','report_square_details','lodash','util','api','bluebird'];(function(_0x4ebdba,_0x54cf50){var _0x1d8bb6=function(_0x1afc7c){while(--_0x1afc7c){_0x4ebdba['push'](_0x4ebdba['shift']());}};_0x1d8bb6(++_0x54cf50);}(_0x6b7e,0xd4));var _0xe6b7=function(_0x17e8e5,_0x1a6720){_0x17e8e5=_0x17e8e5-0x0;var _0x44de95=_0x6b7e[_0x17e8e5];return _0x44de95;};'use strict';var _=require(_0xe6b7('0x0'));var util=require(_0xe6b7('0x1'));var logger=require('../../config/logger')(_0xe6b7('0x2'));var moment=require('moment');var BPromise=require(_0xe6b7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe6b7('0x4'));var config=require(_0xe6b7('0x5'));var attributes=require('./squareReportDetail.attributes');module[_0xe6b7('0x6')]=function(_0x1600b3,_0xfcea8b){return _0x1600b3['define'](_0xe6b7('0x7'),attributes,{'tableName':_0xe6b7('0x8'),'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 bb4e10e..f09e846 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 _0x373d=['result','catch','body','options','raw','then','CreateSquareDetailsReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x373d,0x1e2));var _0xd373=function(_0xccd9b7,_0x2ea6bd){_0xccd9b7=_0xccd9b7-0x0;var _0x26301d=_0x373d[_0xccd9b7];return _0x26301d;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var moment=require(_0xd373('0x1'));var BPromise=require(_0xd373('0x2'));var rs=require(_0xd373('0x3'));var fs=require('fs');var Redis=require(_0xd373('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd373('0x5'));var logger=require(_0xd373('0x6'))(_0xd373('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd373('0x8')][_0xd373('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446be6,_0x4008c5,_0x48d977){return new BPromise(function(_0xe79819,_0x51c074){return client['request'](_0x446be6,_0x48d977)['then'](function(_0x14472a){logger[_0xd373('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x4008c5,_0xd373('0xb'));logger[_0xd373('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x4008c5,'request\x20sent',JSON[_0xd373('0xd')](_0x14472a));if(_0x14472a[_0xd373('0xe')]){if(_0x14472a[_0xd373('0xe')][_0xd373('0xf')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4008c5,_0x14472a['error'][_0xd373('0x10')]);return _0x51c074(_0x14472a[_0xd373('0xe')]['message']);}logger[_0xd373('0xe')](_0xd373('0x11'),_0x4008c5,_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);return _0xe79819(_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);}else{logger[_0xd373('0xa')](_0xd373('0x11'),_0x4008c5,_0xd373('0xb'));_0xe79819(_0x14472a[_0xd373('0x12')][_0xd373('0x10')]);}})[_0xd373('0x13')](function(_0x1921dd){logger['error'](_0xd373('0x11'),_0x4008c5,_0x1921dd);_0x51c074(_0x1921dd);});});}exports['CreateSquareDetailsReport']=function(_0x460259){var _0x36d47a=this;return new Promise(function(_0x55c5c7,_0x1bbdbd){return db['SquareDetailsReport']['create'](_0x460259[_0xd373('0x14')],{'raw':_0x460259[_0xd373('0x15')]?_0x460259[_0xd373('0x15')][_0xd373('0x16')]===undefined?!![]:![]:!![]})[_0xd373('0x17')](function(_0x181eb2){logger['info'](_0xd373('0x18'),_0x460259);logger[_0xd373('0xc')](_0xd373('0x18'),_0x460259,JSON[_0xd373('0xd')](_0x181eb2));_0x55c5c7(_0x181eb2);})[_0xd373('0x13')](function(_0x3aa1c5){logger['error'](_0xd373('0x18'),_0x3aa1c5[_0xd373('0x10')],_0x460259);_0x1bbdbd(_0x36d47a[_0xd373('0xe')](0x1f4,_0x3aa1c5[_0xd373('0x10')]));});});}; \ No newline at end of file +var _0x160f=['../../config/environment','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1897e0,_0x5eb979){var _0x112e74=function(_0x31d030){while(--_0x31d030){_0x1897e0['push'](_0x1897e0['shift']());}};_0x112e74(++_0x5eb979);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')](_0x4b8185[_0xf160('0x19')],{'raw':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x40ccf0){logger[_0xf160('0xd')](_0xf160('0x16'),_0x4b8185);logger['debug'](_0xf160('0x16'),_0x4b8185,JSON[_0xf160('0x11')](_0x40ccf0));_0x1cf6ba(_0x40ccf0);})[_0xf160('0x15')](function(_0x36d0cb){logger[_0xf160('0x12')](_0xf160('0x16'),_0x36d0cb[_0xf160('0x14')],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0x36d0cb[_0xf160('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 904b108..e3b9901 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 _0x80dc=['killProcess','exports','express','Router','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x5090ed,_0x5132a6){var _0x3cadba=function(_0x25045e){while(--_0x25045e){_0x5090ed['push'](_0x5090ed['shift']());}};_0x3cadba(++_0x5132a6);}(_0x80dc,0xda));var _0xc80d=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x80dc[_0x9df060];return _0x338dfe;};'use strict';var express=require(_0xc80d('0x0'));var router=express[_0xc80d('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0xc80d('0x2')]('/',auth[_0xc80d('0x3')](),controller[_0xc80d('0x4')]);router[_0xc80d('0x2')](_0xc80d('0x5'),auth[_0xc80d('0x3')](),controller[_0xc80d('0x6')]);module[_0xc80d('0x7')]=router; \ No newline at end of file +var _0xa447=['../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x421aab,_0x95057e){var _0x40447b=function(_0xcf4573){while(--_0xcf4573){_0x421aab['push'](_0x421aab['shift']());}};_0x40447b(++_0x95057e);}(_0xa447,0x11e));var _0x7a44=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xa447[_0x87b0ff];return _0x3bc0b2;};'use strict';var express=require(_0x7a44('0x0'));var router=express[_0x7a44('0x1')]();var auth=require(_0x7a44('0x2'));var controller=require(_0x7a44('0x3'));router[_0x7a44('0x4')]('/',auth[_0x7a44('0x5')](),controller['index']);router['get'](_0x7a44('0x6'),auth[_0x7a44('0x5')](),controller[_0x7a44('0x7')]);module[_0x7a44('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index ed8f53c..0c62629 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 _0xda5a=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','SIGINT','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','getAllData','then','catch','json','killProcess','components/import/cm','format'];(function(_0x3d1bf0,_0x201488){var _0xc1ec1f=function(_0x15251e){while(--_0x15251e){_0x3d1bf0['push'](_0x3d1bf0['shift']());}};_0xc1ec1f(++_0x201488);}(_0xda5a,0x66));var _0xada5=function(_0x27c0f8,_0xd1bd2f){_0x27c0f8=_0x27c0f8-0x0;var _0x426b4e=_0xda5a[_0x27c0f8];return _0x426b4e;};'use strict';var info=require(_0xada5('0x0'));var exec=require(_0xada5('0x1'))[_0xada5('0x2')];var logger=require(_0xada5('0x3'))(_0xada5('0x4'));var util=require(_0xada5('0x5'));var BPromise=require(_0xada5('0x6'));var _=require('lodash');function handleError(_0x3a8aaf,_0x5f2e53,_0x1f6478){_0x5f2e53=_0x5f2e53||0x1f4;return function(_0x9ba1e1){logger[_0xada5('0x7')](_0xada5('0x8'),_0x1f6478,_0x5f2e53,util['inspect'](_0x9ba1e1,{'showHidden':![],'depth':null}));delete _0x9ba1e1[_0xada5('0x9')];_0x3a8aaf[_0xada5('0xa')](_0x5f2e53)['send'](_0x9ba1e1);};}exports['index']=function(_0x54df46,_0x2b85d8){return info[_0xada5('0xb')]()[_0xada5('0xc')](function(_0x39cfdd){return _0x2b85d8[_0xada5('0xa')](0xc8)['json'](_0x39cfdd);})[_0xada5('0xd')](function(_0x68abf6){return _0x2b85d8[_0xada5('0xa')](0x1f4)[_0xada5('0xe')](_0x68abf6);});};exports[_0xada5('0xf')]=function(_0xd70737,_0xab8fb5){var _0x2c18d9=[_0xada5('0x10')];return new BPromise(function(_0x5b4a14,_0x257053){return exec(util[_0xada5('0x11')](_0xada5('0x12'),_0xd70737[_0xada5('0x13')][_0xada5('0x14')]),function(_0x50f22e,_0x1a7d06,_0x45f545){if(_0x50f22e){return _0x257053(_0x50f22e);}return _0x5b4a14(_0x1a7d06);});})[_0xada5('0xc')](function(_0x396cef){var _0x4fc245=![];var _0x2e31fe=_0x396cef[_0xada5('0x15')](/\n/);for(var _0x46f6e7=0x0,_0x302c86=_0x2c18d9[_0xada5('0x16')];_0x46f6e7<_0x302c86,_0x4fc245===![];_0x46f6e7+=0x1){if(_0x396cef['indexOf'](_0x2c18d9[_0x46f6e7])>=0x0){_0x4fc245=!![];}}if(!_0x4fc245){throw new Error(util[_0xada5('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0xd70737['params']['pid']));}process['kill'](_0xd70737['params'][_0xada5('0x14')],_0xada5('0x17'));return _0xab8fb5[_0xada5('0xa')](0xc8)[_0xada5('0xe')]({'message':util[_0xada5('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0xd70737[_0xada5('0x13')]['pid'])});})[_0xada5('0xd')](handleError(_0xab8fb5,null,'killProcess'));}; \ No newline at end of file +var _0x3489=['then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','child_process','../../config/logger','api','util','bluebird','lodash','error','inspect','name','status','index','getAllData','json','killProcess','components/import/cm','format','params','pid'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3489,0x1ef));var _0x9348=function(_0x4f2877,_0x99138b){_0x4f2877=_0x4f2877-0x0;var _0x124c9c=_0x3489[_0x4f2877];return _0x124c9c;};'use strict';var info=require('systeminformation');var exec=require(_0x9348('0x0'))['exec'];var logger=require(_0x9348('0x1'))(_0x9348('0x2'));var util=require(_0x9348('0x3'));var BPromise=require(_0x9348('0x4'));var _=require(_0x9348('0x5'));function handleError(_0x110d86,_0x55fe5e,_0x133c97){_0x55fe5e=_0x55fe5e||0x1f4;return function(_0x12d694){logger[_0x9348('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x133c97,_0x55fe5e,util[_0x9348('0x7')](_0x12d694,{'showHidden':![],'depth':null}));delete _0x12d694[_0x9348('0x8')];_0x110d86[_0x9348('0x9')](_0x55fe5e)['send'](_0x12d694);};}exports[_0x9348('0xa')]=function(_0xe51dda,_0x1105e4){return info[_0x9348('0xb')]()['then'](function(_0x1a8a1d){return _0x1105e4['status'](0xc8)[_0x9348('0xc')](_0x1a8a1d);})['catch'](function(_0x1667d8){return _0x1105e4['status'](0x1f4)[_0x9348('0xc')](_0x1667d8);});};exports[_0x9348('0xd')]=function(_0x3b244c,_0x29648f){var _0x4d1e62=[_0x9348('0xe')];return new BPromise(function(_0x5054d9,_0x2c2a4c){return exec(util[_0x9348('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x3b244c[_0x9348('0x10')][_0x9348('0x11')]),function(_0x2ab184,_0x2a0956,_0x203b70){if(_0x2ab184){return _0x2c2a4c(_0x2ab184);}return _0x5054d9(_0x2a0956);});})[_0x9348('0x12')](function(_0x5e684c){var _0x49e70d=![];var _0x4c5b7d=_0x5e684c[_0x9348('0x13')](/\n/);for(var _0x5d4c73=0x0,_0x2cbcea=_0x4d1e62[_0x9348('0x14')];_0x5d4c73<_0x2cbcea,_0x49e70d===![];_0x5d4c73+=0x1){if(_0x5e684c[_0x9348('0x15')](_0x4d1e62[_0x5d4c73])>=0x0){_0x49e70d=!![];}}if(!_0x49e70d){throw new Error(util[_0x9348('0xf')](_0x9348('0x16'),_0x3b244c[_0x9348('0x10')][_0x9348('0x11')]));}process[_0x9348('0x17')](_0x3b244c['params'][_0x9348('0x11')],_0x9348('0x18'));return _0x29648f[_0x9348('0x9')](0xc8)[_0x9348('0xc')]({'message':util['format'](_0x9348('0x19'),_0x3b244c[_0x9348('0x10')]['pid'])});})[_0x9348('0x1a')](handleError(_0x29648f,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 0e8ccc2..ceb0048 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 _0x5636=['isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get'];(function(_0x1b357c,_0x23f7ee){var _0x4fecc6=function(_0x491414){while(--_0x491414){_0x1b357c['push'](_0x1b357c['shift']());}};_0x4fecc6(++_0x23f7ee);}(_0x5636,0x102));var _0x6563=function(_0x21bfb2,_0x62b713){_0x21bfb2=_0x21bfb2-0x0;var _0x4d1f9e=_0x5636[_0x21bfb2];return _0x4d1f9e;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),auth[_0x6563('0x8')](),controller[_0x6563('0xb')]);router[_0x6563('0x7')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6563('0xe')]);router[_0x6563('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6563('0x10')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0x11')]);module[_0x6563('0x12')]=router; \ No newline at end of file +var _0xac31=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','post','create','put','/:id'];(function(_0x15e32a,_0xd81ea6){var _0x2dd714=function(_0x109b00){while(--_0x109b00){_0x15e32a['push'](_0x15e32a['shift']());}};_0x2dd714(++_0xd81ea6);}(_0xac31,0xca));var _0x1ac3=function(_0x103255,_0x2bdf3b){_0x103255=_0x103255-0x0;var _0x481939=_0xac31[_0x103255];return _0x481939;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var fs_extra=require(_0x1ac3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var controller=require('./tag.controller');router['get']('/',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xa')]);router[_0x1ac3('0xb')](_0x1ac3('0xc'),auth[_0x1ac3('0x9')](),controller['describe']);router[_0x1ac3('0xb')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xd')]);router[_0x1ac3('0xe')]('/',auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0x10')](_0x1ac3('0x11'),auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x12')]);router[_0x1ac3('0x13')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x14')]);module[_0x1ac3('0x15')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 306d9de..b0f4a3d 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 _0x4065=['STRING','name','#0091EA'];(function(_0xeffc93,_0x3a3e5d){var _0x57ca3e=function(_0xa77da1){while(--_0xa77da1){_0xeffc93['push'](_0xeffc93['shift']());}};_0x57ca3e(++_0x3a3e5d);}(_0x4065,0xdc));var _0x5406=function(_0xba95ba,_0x598bfb){_0xba95ba=_0xba95ba-0x0;var _0x3325bd=_0x4065[_0xba95ba];return _0x3325bd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5406('0x0'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x5406('0x1')},'description':{'type':Sequelize[_0x5406('0x2')]}}; \ No newline at end of file +var _0x56c8=['STRING','name','#0091EA','sequelize','exports'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x56c8,0x12f));var _0x856c=function(_0x18dfb9,_0x7a007e){_0x18dfb9=_0x18dfb9-0x0;var _0xe64d4f=_0x56c8[_0x18dfb9];return _0xe64d4f;};'use strict';var Sequelize=require(_0x856c('0x0'));module[_0x856c('0x1')]={'name':{'type':Sequelize[_0x856c('0x2')],'unique':_0x856c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x856c('0x4')},'description':{'type':Sequelize[_0x856c('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ae8e5c6..053e5ce 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 _0xd8a7=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Tags','error','stack','name','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','params','Tag','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','eml-format','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5a306b,_0x5cad65){var _0x354ee4=function(_0x4de09f){while(--_0x4de09f){_0x5a306b['push'](_0x5a306b['shift']());}};_0x354ee4(++_0x5cad65);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x4c6e5b,_0x57dd31){_0x4c6e5b=_0x4c6e5b-0x0;var _0x4cae64=_0xd8a7[_0x4c6e5b];return _0x4cae64;};'use strict';var emlformat=require(_0x7d8a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7d8a('0x1'));var moment=require(_0x7d8a('0x2'));var BPromise=require(_0x7d8a('0x3'));var Mustache=require('mustache');var util=require(_0x7d8a('0x4'));var path=require('path');var sox=require(_0x7d8a('0x5'));var csv=require('to-csv');var ejs=require(_0x7d8a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d8a('0x7'));var squel=require(_0x7d8a('0x8'));var crypto=require(_0x7d8a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7d8a('0xa'));var toCsv=require(_0x7d8a('0xb'));var querystring=require(_0x7d8a('0xc'));var Papa=require(_0x7d8a('0xd'));var Redis=require(_0x7d8a('0xe'));var authService=require(_0x7d8a('0xf'));var qs=require(_0x7d8a('0x10'));var as=require(_0x7d8a('0x11'));var hardwareService=require(_0x7d8a('0x12'));var logger=require(_0x7d8a('0x13'))(_0x7d8a('0x14'));var utils=require(_0x7d8a('0x15'));var config=require(_0x7d8a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d8a('0x17'))['db'];function respondWithStatusCode(_0xd57f7d,_0x400bd6){_0x400bd6=_0x400bd6||0xcc;return function(_0x1ca39e){if(_0x1ca39e){return _0xd57f7d[_0x7d8a('0x18')](_0x400bd6);}return _0xd57f7d['status'](_0x400bd6)[_0x7d8a('0x19')]();};}function respondWithResult(_0x5a9b2c,_0x14caed){_0x14caed=_0x14caed||0xc8;return function(_0x506c6c){if(_0x506c6c){return _0x5a9b2c[_0x7d8a('0x1a')](_0x14caed)['json'](_0x506c6c);}};}function respondWithFilteredResult(_0x290d0a,_0x164c6c){return function(_0x52ec93){if(_0x52ec93){var _0x12516d=typeof _0x164c6c[_0x7d8a('0x1b')]===_0x7d8a('0x1c')&&typeof _0x164c6c[_0x7d8a('0x1d')]==='undefined';var _0x39fec5=_0x52ec93[_0x7d8a('0x1e')];var _0x5916ed=_0x12516d?0x0:_0x164c6c[_0x7d8a('0x1b')];var _0xcc3354=_0x12516d?_0x52ec93['count']:_0x164c6c[_0x7d8a('0x1b')]+_0x164c6c[_0x7d8a('0x1d')];var _0x4202e1;if(_0xcc3354>=_0x39fec5){_0xcc3354=_0x39fec5;_0x4202e1=0xc8;}else{_0x4202e1=0xce;}_0x290d0a[_0x7d8a('0x1a')](_0x4202e1);return _0x290d0a[_0x7d8a('0x1f')](_0x7d8a('0x20'),_0x5916ed+'-'+_0xcc3354+'/'+_0x39fec5)[_0x7d8a('0x21')](_0x52ec93);}return null;};}function patchUpdates(_0x18c8d1){return function(_0x428aa8){try{jsonpatch[_0x7d8a('0x22')](_0x428aa8,_0x18c8d1,!![]);}catch(_0x33c69f){return BPromise[_0x7d8a('0x23')](_0x33c69f);}return _0x428aa8[_0x7d8a('0x24')]();};}function saveUpdates(_0x4cc9ec,_0x478375){return function(_0x4acdfc){if(_0x4acdfc){return _0x4acdfc['update'](_0x4cc9ec)[_0x7d8a('0x25')](function(_0x1481b2){return _0x1481b2;});}return null;};}function removeEntity(_0xfaf23f,_0x9b324d){return function(_0x51c12d){if(_0x51c12d){return _0x51c12d[_0x7d8a('0x26')]()['then'](function(){var _0x190663=_0x51c12d[_0x7d8a('0x27')]({'plain':!![]});var _0x5b57a1=_0x7d8a('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x5b57a1,'resourceId':_0x190663['id']}})[_0x7d8a('0x25')](function(){return _0x51c12d;});})['then'](function(){_0xfaf23f[_0x7d8a('0x1a')](0xcc)[_0x7d8a('0x19')]();});}};}function handleEntityNotFound(_0x417311,_0x3ded5e){return function(_0x4dd6c2){if(!_0x4dd6c2){_0x417311[_0x7d8a('0x18')](0x194);}return _0x4dd6c2;};}function handleError(_0x358494,_0x3af432){_0x3af432=_0x3af432||0x1f4;return function(_0x124fab){logger[_0x7d8a('0x29')](_0x124fab[_0x7d8a('0x2a')]);if(_0x124fab[_0x7d8a('0x2b')]){delete _0x124fab['name'];}_0x358494[_0x7d8a('0x1a')](_0x3af432)['send'](_0x124fab);};}exports[_0x7d8a('0x2c')]=function(_0x1d05cb,_0x174ec8){var _0x2e2312={},_0x52afa5={},_0x405573={'count':0x0,'rows':[]};var _0x363e4a=_['map'](db['Tag'][_0x7d8a('0x2d')],function(_0x11339b){return{'name':_0x11339b[_0x7d8a('0x2e')],'type':_0x11339b[_0x7d8a('0x2f')]['key']};});_0x52afa5[_0x7d8a('0x30')]=_[_0x7d8a('0x31')](_0x363e4a,_0x7d8a('0x2b'));_0x52afa5['query']=_[_0x7d8a('0x32')](_0x1d05cb[_0x7d8a('0x33')]);_0x52afa5[_0x7d8a('0x34')]=_[_0x7d8a('0x35')](_0x52afa5[_0x7d8a('0x30')],_0x52afa5['query']);_0x2e2312[_0x7d8a('0x36')]=_[_0x7d8a('0x35')](_0x52afa5[_0x7d8a('0x30')],qs[_0x7d8a('0x37')](_0x1d05cb[_0x7d8a('0x33')][_0x7d8a('0x37')]));_0x2e2312[_0x7d8a('0x36')]=_0x2e2312[_0x7d8a('0x36')][_0x7d8a('0x38')]?_0x2e2312[_0x7d8a('0x36')]:_0x52afa5[_0x7d8a('0x30')];if(!_0x1d05cb[_0x7d8a('0x33')][_0x7d8a('0x39')](_0x7d8a('0x3a'))){_0x2e2312[_0x7d8a('0x1d')]=qs[_0x7d8a('0x1d')](_0x1d05cb[_0x7d8a('0x33')][_0x7d8a('0x1d')]);_0x2e2312[_0x7d8a('0x1b')]=qs[_0x7d8a('0x1b')](_0x1d05cb[_0x7d8a('0x33')][_0x7d8a('0x1b')]);}_0x2e2312[_0x7d8a('0x3b')]=qs['sort'](_0x1d05cb['query'][_0x7d8a('0x3c')]);_0x2e2312[_0x7d8a('0x3d')]=qs[_0x7d8a('0x34')](_['pick'](_0x1d05cb[_0x7d8a('0x33')],_0x52afa5['filters']),_0x363e4a);if(_0x1d05cb['query']['filter']){_0x2e2312[_0x7d8a('0x3d')]=_[_0x7d8a('0x3e')](_0x2e2312[_0x7d8a('0x3d')],{'$or':_[_0x7d8a('0x31')](_0x363e4a,function(_0x1c1236){if(_0x1c1236[_0x7d8a('0x2f')]!=='VIRTUAL'){var _0x51a35d={};_0x51a35d[_0x1c1236['name']]={'$like':'%'+_0x1d05cb[_0x7d8a('0x33')][_0x7d8a('0x3f')]+'%'};return _0x51a35d;}})});}_0x2e2312=_[_0x7d8a('0x3e')]({},_0x2e2312,_0x1d05cb[_0x7d8a('0x40')]);var _0x1e7ef6={'where':_0x2e2312['where']};return db['Tag'][_0x7d8a('0x1e')](_0x1e7ef6)[_0x7d8a('0x25')](function(_0x2f62db){_0x405573[_0x7d8a('0x1e')]=_0x2f62db;if(_0x1d05cb[_0x7d8a('0x33')][_0x7d8a('0x41')]){_0x2e2312[_0x7d8a('0x42')]=[{'all':!![]}];}return db['Tag'][_0x7d8a('0x43')](_0x2e2312);})[_0x7d8a('0x25')](function(_0x1f872f){_0x405573[_0x7d8a('0x44')]=_0x1f872f;return _0x405573;})[_0x7d8a('0x25')](respondWithFilteredResult(_0x174ec8,_0x2e2312))[_0x7d8a('0x45')](handleError(_0x174ec8,null));};exports['show']=function(_0x5140db,_0xc07701){var _0x38fbd7={'raw':!![],'where':{'id':_0x5140db[_0x7d8a('0x46')]['id']}},_0x430fdb={};_0x430fdb[_0x7d8a('0x30')]=_[_0x7d8a('0x32')](db[_0x7d8a('0x47')][_0x7d8a('0x2d')]);_0x430fdb[_0x7d8a('0x33')]=_[_0x7d8a('0x32')](_0x5140db[_0x7d8a('0x33')]);_0x430fdb[_0x7d8a('0x34')]=_['intersection'](_0x430fdb[_0x7d8a('0x30')],_0x430fdb[_0x7d8a('0x33')]);_0x38fbd7[_0x7d8a('0x36')]=_[_0x7d8a('0x35')](_0x430fdb[_0x7d8a('0x30')],qs[_0x7d8a('0x37')](_0x5140db['query'][_0x7d8a('0x37')]));_0x38fbd7[_0x7d8a('0x36')]=_0x38fbd7['attributes']['length']?_0x38fbd7['attributes']:_0x430fdb[_0x7d8a('0x30')];if(_0x5140db[_0x7d8a('0x33')]['includeAll']){_0x38fbd7[_0x7d8a('0x42')]=[{'all':!![]}];}_0x38fbd7=_['merge']({},_0x38fbd7,_0x5140db[_0x7d8a('0x40')]);return db[_0x7d8a('0x47')][_0x7d8a('0x48')](_0x38fbd7)[_0x7d8a('0x25')](handleEntityNotFound(_0xc07701,null))['then'](respondWithResult(_0xc07701,null))[_0x7d8a('0x45')](handleError(_0xc07701,null));};exports[_0x7d8a('0x49')]=function(_0x54374b,_0x5615cb){return db[_0x7d8a('0x47')][_0x7d8a('0x49')](_0x54374b[_0x7d8a('0x4a')],{})[_0x7d8a('0x25')](function(_0xb53db0){var _0xbf65a=_0x54374b['user'][_0x7d8a('0x27')]({'plain':!![]});if(!_0xbf65a)throw new Error(_0x7d8a('0x4b'));if(_0xbf65a['role']===_0x7d8a('0x4c')){var _0xe18e3f=_0xb53db0[_0x7d8a('0x27')]({'plain':!![]});var _0x3d6457=_0x7d8a('0x28');return db['UserProfileSection'][_0x7d8a('0x48')]({'where':{'name':_0x3d6457,'userProfileId':_0xbf65a['userProfileId']},'raw':!![]})['then'](function(_0x234fc5){if(_0x234fc5&&_0x234fc5['autoAssociation']===0x0){return db['UserProfileResource'][_0x7d8a('0x49')]({'name':_0xe18e3f[_0x7d8a('0x2b')],'resourceId':_0xe18e3f['id'],'type':_0x234fc5[_0x7d8a('0x2b')],'sectionId':_0x234fc5['id']},{})[_0x7d8a('0x25')](function(){return _0xb53db0;});}else{return _0xb53db0;}})[_0x7d8a('0x45')](function(_0x2c6d8b){logger[_0x7d8a('0x29')](_0x7d8a('0x4d'),_0x2c6d8b);throw _0x2c6d8b;});}return _0xb53db0;})[_0x7d8a('0x25')](respondWithResult(_0x5615cb,0xc9))[_0x7d8a('0x45')](handleError(_0x5615cb,null));};exports[_0x7d8a('0x4e')]=function(_0xf4a718,_0x247d96){if(_0xf4a718[_0x7d8a('0x4a')]['id']){delete _0xf4a718[_0x7d8a('0x4a')]['id'];}return db['Tag'][_0x7d8a('0x48')]({'where':{'id':_0xf4a718[_0x7d8a('0x46')]['id']}})[_0x7d8a('0x25')](handleEntityNotFound(_0x247d96,null))[_0x7d8a('0x25')](saveUpdates(_0xf4a718[_0x7d8a('0x4a')],null))['then'](respondWithResult(_0x247d96,null))[_0x7d8a('0x45')](handleError(_0x247d96,null));};exports[_0x7d8a('0x26')]=function(_0x43c6af,_0x4ff521){return db[_0x7d8a('0x47')][_0x7d8a('0x48')]({'where':{'id':_0x43c6af[_0x7d8a('0x46')]['id']}})[_0x7d8a('0x25')](handleEntityNotFound(_0x4ff521,null))[_0x7d8a('0x25')](removeEntity(_0x4ff521,null))[_0x7d8a('0x45')](handleError(_0x4ff521,null));};exports[_0x7d8a('0x4f')]=function(_0x1b032d,_0x5570a7){return db[_0x7d8a('0x47')][_0x7d8a('0x4f')]()[_0x7d8a('0x25')](respondWithResult(_0x5570a7,null))[_0x7d8a('0x45')](handleError(_0x5570a7,null));}; \ No newline at end of file +var _0x389b=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','role','userProfileId','autoAssociation','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x124248,_0x38ae53){var _0x2d8217=function(_0x31aa9d){while(--_0x31aa9d){_0x124248['push'](_0x124248['shift']());}};_0x2d8217(++_0x38ae53);}(_0x389b,0xa3));var _0xb389=function(_0x70d3b5,_0x4bbd30){_0x70d3b5=_0x70d3b5-0x0;var _0x4f96d6=_0x389b[_0x70d3b5];return _0x4f96d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb389('0x0'));var jsonpatch=require(_0xb389('0x1'));var rp=require(_0xb389('0x2'));var moment=require(_0xb389('0x3'));var BPromise=require(_0xb389('0x4'));var Mustache=require(_0xb389('0x5'));var util=require(_0xb389('0x6'));var path=require(_0xb389('0x7'));var sox=require(_0xb389('0x8'));var csv=require(_0xb389('0x9'));var ejs=require(_0xb389('0xa'));var fs=require('fs');var fs_extra=require(_0xb389('0xb'));var _=require(_0xb389('0xc'));var squel=require(_0xb389('0xd'));var crypto=require(_0xb389('0xe'));var jsforce=require(_0xb389('0xf'));var deskjs=require(_0xb389('0x10'));var toCsv=require(_0xb389('0x9'));var querystring=require(_0xb389('0x11'));var Papa=require(_0xb389('0x12'));var Redis=require(_0xb389('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb389('0x14'));var as=require(_0xb389('0x15'));var hardwareService=require(_0xb389('0x16'));var logger=require(_0xb389('0x17'))(_0xb389('0x18'));var utils=require(_0xb389('0x19'));var config=require(_0xb389('0x1a'));var licenseUtil=require(_0xb389('0x1b'));var db=require(_0xb389('0x1c'))['db'];function respondWithStatusCode(_0x493085,_0x3f648f){_0x3f648f=_0x3f648f||0xcc;return function(_0x2f8a5f){if(_0x2f8a5f){return _0x493085[_0xb389('0x1d')](_0x3f648f);}return _0x493085[_0xb389('0x1e')](_0x3f648f)[_0xb389('0x1f')]();};}function respondWithResult(_0x7781cf,_0x5da347){_0x5da347=_0x5da347||0xc8;return function(_0x2d4c1e){if(_0x2d4c1e){return _0x7781cf[_0xb389('0x1e')](_0x5da347)[_0xb389('0x20')](_0x2d4c1e);}};}function respondWithFilteredResult(_0x52e486,_0x29a5c6){return function(_0x1443a2){if(_0x1443a2){var _0x4699c4=typeof _0x29a5c6[_0xb389('0x21')]===_0xb389('0x22')&&typeof _0x29a5c6[_0xb389('0x23')]===_0xb389('0x22');var _0x865881=_0x1443a2[_0xb389('0x24')];var _0x1e8f0c=_0x4699c4?0x0:_0x29a5c6[_0xb389('0x21')];var _0x2ae5dc=_0x4699c4?_0x1443a2['count']:_0x29a5c6[_0xb389('0x21')]+_0x29a5c6[_0xb389('0x23')];var _0x4d14e3;if(_0x2ae5dc>=_0x865881){_0x2ae5dc=_0x865881;_0x4d14e3=0xc8;}else{_0x4d14e3=0xce;}_0x52e486[_0xb389('0x1e')](_0x4d14e3);return _0x52e486[_0xb389('0x25')](_0xb389('0x26'),_0x1e8f0c+'-'+_0x2ae5dc+'/'+_0x865881)[_0xb389('0x20')](_0x1443a2);}return null;};}function patchUpdates(_0xb290a0){return function(_0x6aa289){try{jsonpatch[_0xb389('0x27')](_0x6aa289,_0xb290a0,!![]);}catch(_0xc3bc1e){return BPromise[_0xb389('0x28')](_0xc3bc1e);}return _0x6aa289['save']();};}function saveUpdates(_0x176a86,_0x22f3cf){return function(_0x1ebd72){if(_0x1ebd72){return _0x1ebd72[_0xb389('0x29')](_0x176a86)['then'](function(_0x14db0b){return _0x14db0b;});}return null;};}function removeEntity(_0x37c1ed,_0x598bb1){return function(_0x9f26df){if(_0x9f26df){return _0x9f26df[_0xb389('0x2a')]()[_0xb389('0x2b')](function(){var _0x2b7d9d=_0x9f26df[_0xb389('0x2c')]({'plain':!![]});var _0x3eaabc=_0xb389('0x2d');return db[_0xb389('0x2e')][_0xb389('0x2a')]({'where':{'type':_0x3eaabc,'resourceId':_0x2b7d9d['id']}})[_0xb389('0x2b')](function(){return _0x9f26df;});})[_0xb389('0x2b')](function(){_0x37c1ed[_0xb389('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f6c6a,_0x4b58a5){return function(_0x30c57e){if(!_0x30c57e){_0x1f6c6a['sendStatus'](0x194);}return _0x30c57e;};}function handleError(_0x3da63d,_0x3490ff){_0x3490ff=_0x3490ff||0x1f4;return function(_0x30c53d){logger[_0xb389('0x2f')](_0x30c53d['stack']);if(_0x30c53d[_0xb389('0x30')]){delete _0x30c53d[_0xb389('0x30')];}_0x3da63d[_0xb389('0x1e')](_0x3490ff)[_0xb389('0x31')](_0x30c53d);};}exports[_0xb389('0x32')]=function(_0x24c7c0,_0x22e19f){var _0x19bbab={},_0x48c0c6={},_0x7248cd={'count':0x0,'rows':[]};var _0x1e1b17=_[_0xb389('0x33')](db[_0xb389('0x34')][_0xb389('0x35')],function(_0x410138){return{'name':_0x410138['fieldName'],'type':_0x410138[_0xb389('0x36')][_0xb389('0x37')]};});_0x48c0c6[_0xb389('0x38')]=_['map'](_0x1e1b17,'name');_0x48c0c6['query']=_[_0xb389('0x39')](_0x24c7c0[_0xb389('0x3a')]);_0x48c0c6[_0xb389('0x3b')]=_[_0xb389('0x3c')](_0x48c0c6[_0xb389('0x38')],_0x48c0c6[_0xb389('0x3a')]);_0x19bbab[_0xb389('0x3d')]=_[_0xb389('0x3c')](_0x48c0c6[_0xb389('0x38')],qs[_0xb389('0x3e')](_0x24c7c0[_0xb389('0x3a')][_0xb389('0x3e')]));_0x19bbab[_0xb389('0x3d')]=_0x19bbab[_0xb389('0x3d')][_0xb389('0x3f')]?_0x19bbab[_0xb389('0x3d')]:_0x48c0c6[_0xb389('0x38')];if(!_0x24c7c0[_0xb389('0x3a')]['hasOwnProperty'](_0xb389('0x40'))){_0x19bbab[_0xb389('0x23')]=qs['limit'](_0x24c7c0[_0xb389('0x3a')][_0xb389('0x23')]);_0x19bbab[_0xb389('0x21')]=qs['offset'](_0x24c7c0[_0xb389('0x3a')][_0xb389('0x21')]);}_0x19bbab[_0xb389('0x41')]=qs[_0xb389('0x42')](_0x24c7c0[_0xb389('0x3a')]['sort']);_0x19bbab[_0xb389('0x43')]=qs[_0xb389('0x3b')](_[_0xb389('0x44')](_0x24c7c0[_0xb389('0x3a')],_0x48c0c6['filters']),_0x1e1b17);if(_0x24c7c0['query']['filter']){_0x19bbab['where']=_[_0xb389('0x45')](_0x19bbab[_0xb389('0x43')],{'$or':_['map'](_0x1e1b17,function(_0x2c4207){if(_0x2c4207[_0xb389('0x36')]!=='VIRTUAL'){var _0x4104ed={};_0x4104ed[_0x2c4207[_0xb389('0x30')]]={'$like':'%'+_0x24c7c0[_0xb389('0x3a')][_0xb389('0x46')]+'%'};return _0x4104ed;}})});}_0x19bbab=_['merge']({},_0x19bbab,_0x24c7c0[_0xb389('0x47')]);var _0x1df970={'where':_0x19bbab['where']};return db[_0xb389('0x34')][_0xb389('0x24')](_0x1df970)[_0xb389('0x2b')](function(_0x206bd1){_0x7248cd[_0xb389('0x24')]=_0x206bd1;if(_0x24c7c0[_0xb389('0x3a')]['includeAll']){_0x19bbab['include']=[{'all':!![]}];}return db[_0xb389('0x34')][_0xb389('0x48')](_0x19bbab);})[_0xb389('0x2b')](function(_0x28d2e9){_0x7248cd[_0xb389('0x49')]=_0x28d2e9;return _0x7248cd;})['then'](respondWithFilteredResult(_0x22e19f,_0x19bbab))[_0xb389('0x4a')](handleError(_0x22e19f,null));};exports[_0xb389('0x4b')]=function(_0x16d0ff,_0x247165){var _0x3cf5e5={'raw':!![],'where':{'id':_0x16d0ff[_0xb389('0x4c')]['id']}},_0xd29cb6={};_0xd29cb6['model']=_['keys'](db[_0xb389('0x34')][_0xb389('0x35')]);_0xd29cb6[_0xb389('0x3a')]=_['keys'](_0x16d0ff[_0xb389('0x3a')]);_0xd29cb6[_0xb389('0x3b')]=_['intersection'](_0xd29cb6['model'],_0xd29cb6[_0xb389('0x3a')]);_0x3cf5e5[_0xb389('0x3d')]=_[_0xb389('0x3c')](_0xd29cb6['model'],qs['fields'](_0x16d0ff[_0xb389('0x3a')]['fields']));_0x3cf5e5[_0xb389('0x3d')]=_0x3cf5e5[_0xb389('0x3d')][_0xb389('0x3f')]?_0x3cf5e5[_0xb389('0x3d')]:_0xd29cb6[_0xb389('0x38')];if(_0x16d0ff[_0xb389('0x3a')][_0xb389('0x4d')]){_0x3cf5e5[_0xb389('0x4e')]=[{'all':!![]}];}_0x3cf5e5=_[_0xb389('0x45')]({},_0x3cf5e5,_0x16d0ff[_0xb389('0x47')]);return db[_0xb389('0x34')][_0xb389('0x4f')](_0x3cf5e5)['then'](handleEntityNotFound(_0x247165,null))['then'](respondWithResult(_0x247165,null))[_0xb389('0x4a')](handleError(_0x247165,null));};exports[_0xb389('0x50')]=function(_0xae71d4,_0x39d875){return db[_0xb389('0x34')][_0xb389('0x50')](_0xae71d4[_0xb389('0x51')],{})[_0xb389('0x2b')](function(_0xf30b10){var _0x1cf275=_0xae71d4[_0xb389('0x52')][_0xb389('0x2c')]({'plain':!![]});if(!_0x1cf275)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cf275[_0xb389('0x53')]===_0xb389('0x52')){var _0x4df31e=_0xf30b10[_0xb389('0x2c')]({'plain':!![]});var _0x7d0cec=_0xb389('0x2d');return db['UserProfileSection'][_0xb389('0x4f')]({'where':{'name':_0x7d0cec,'userProfileId':_0x1cf275[_0xb389('0x54')]},'raw':!![]})[_0xb389('0x2b')](function(_0x12fbdb){if(_0x12fbdb&&_0x12fbdb[_0xb389('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x4df31e[_0xb389('0x30')],'resourceId':_0x4df31e['id'],'type':_0x12fbdb[_0xb389('0x30')],'sectionId':_0x12fbdb['id']},{})[_0xb389('0x2b')](function(){return _0xf30b10;});}else{return _0xf30b10;}})[_0xb389('0x4a')](function(_0x19a59a){logger[_0xb389('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19a59a);throw _0x19a59a;});}return _0xf30b10;})[_0xb389('0x2b')](respondWithResult(_0x39d875,0xc9))[_0xb389('0x4a')](handleError(_0x39d875,null));};exports[_0xb389('0x29')]=function(_0x215176,_0x48ec97){if(_0x215176[_0xb389('0x51')]['id']){delete _0x215176[_0xb389('0x51')]['id'];}return db[_0xb389('0x34')][_0xb389('0x4f')]({'where':{'id':_0x215176[_0xb389('0x4c')]['id']}})[_0xb389('0x2b')](handleEntityNotFound(_0x48ec97,null))[_0xb389('0x2b')](saveUpdates(_0x215176[_0xb389('0x51')],null))[_0xb389('0x2b')](respondWithResult(_0x48ec97,null))[_0xb389('0x4a')](handleError(_0x48ec97,null));};exports[_0xb389('0x2a')]=function(_0x4d8984,_0x3f64e9){return db[_0xb389('0x34')]['find']({'where':{'id':_0x4d8984[_0xb389('0x4c')]['id']}})[_0xb389('0x2b')](handleEntityNotFound(_0x3f64e9,null))[_0xb389('0x2b')](removeEntity(_0x3f64e9,null))[_0xb389('0x4a')](handleError(_0x3f64e9,null));};exports[_0xb389('0x56')]=function(_0x1cf11a,_0xd1373a){return db[_0xb389('0x34')][_0xb389('0x56')]()[_0xb389('0x2b')](respondWithResult(_0xd1373a,null))[_0xb389('0x4a')](handleError(_0xd1373a,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b358a0a..c3d54ef 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 _0x8e94=['lodash','util','api','bluebird','path','exports','define','tools_tags'];(function(_0x1fbb30,_0x2286a2){var _0x5369a7=function(_0x2e1d08){while(--_0x2e1d08){_0x1fbb30['push'](_0x1fbb30['shift']());}};_0x5369a7(++_0x2286a2);}(_0x8e94,0xf8));var _0x48e9=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0x8e94[_0x163742];return _0x1152ac;};'use strict';var _=require(_0x48e9('0x0'));var util=require(_0x48e9('0x1'));var logger=require('../../config/logger')(_0x48e9('0x2'));var moment=require('moment');var BPromise=require(_0x48e9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x48e9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x48e9('0x5')]=function(_0x20d724,_0x5d6996){return _0x20d724[_0x48e9('0x6')]('Tag',attributes,{'tableName':_0x48e9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7baf=['Tag','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./tag.attributes','exports','define'];(function(_0x34331b,_0x22a64c){var _0x1f97c8=function(_0x488b07){while(--_0x488b07){_0x34331b['push'](_0x34331b['shift']());}};_0x1f97c8(++_0x22a64c);}(_0x7baf,0x1cf));var _0xf7ba=function(_0x2cb70a,_0x4fffab){_0x2cb70a=_0x2cb70a-0x0;var _0x1c90e0=_0x7baf[_0x2cb70a];return _0x1c90e0;};'use strict';var _=require(_0xf7ba('0x0'));var util=require('util');var logger=require(_0xf7ba('0x1'))(_0xf7ba('0x2'));var moment=require('moment');var BPromise=require(_0xf7ba('0x3'));var rp=require(_0xf7ba('0x4'));var fs=require('fs');var path=require(_0xf7ba('0x5'));var rimraf=require('rimraf');var config=require(_0xf7ba('0x6'));var attributes=require(_0xf7ba('0x7'));module[_0xf7ba('0x8')]=function(_0x2d52f5,_0x2b5f73){return _0x2d52f5[_0xf7ba('0x9')](_0xf7ba('0xa'),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 7dc4178..d1f0554 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 _0xfd0f=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Tag,\x20%s,\x20%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfd0f,0x1b8));var _0xffd0=function(_0xbfff0b,_0x24e61f){_0xbfff0b=_0xbfff0b-0x0;var _0x4b8f10=_0xfd0f[_0xbfff0b];return _0x4b8f10;};'use strict';var _=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var moment=require('moment');var BPromise=require(_0xffd0('0x2'));var rs=require(_0xffd0('0x3'));var fs=require('fs');var Redis=require(_0xffd0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xffd0('0x5'));var logger=require('../../config/logger')(_0xffd0('0x6'));var config=require(_0xffd0('0x7'));var jayson=require(_0xffd0('0x8'));var client=jayson[_0xffd0('0x9')][_0xffd0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b64a5,_0x2aaee6,_0x3fcf31){return new BPromise(function(_0x55488d,_0x4e2d54){return client[_0xffd0('0xb')](_0x1b64a5,_0x3fcf31)[_0xffd0('0xc')](function(_0x1b3842){logger[_0xffd0('0xd')]('Tag,\x20%s,\x20%s',_0x2aaee6,'request\x20sent');logger[_0xffd0('0xe')](_0xffd0('0xf'),_0x2aaee6,_0xffd0('0x10'),JSON['stringify'](_0x1b3842));if(_0x1b3842['error']){if(_0x1b3842[_0xffd0('0x11')][_0xffd0('0x12')]===0x1f4){logger['error'](_0xffd0('0x13'),_0x2aaee6,_0x1b3842[_0xffd0('0x11')][_0xffd0('0x14')]);return _0x4e2d54(_0x1b3842['error'][_0xffd0('0x14')]);}logger[_0xffd0('0x11')]('Tag,\x20%s,\x20%s',_0x2aaee6,_0x1b3842[_0xffd0('0x11')]['message']);return _0x55488d(_0x1b3842['error'][_0xffd0('0x14')]);}else{logger['info'](_0xffd0('0x13'),_0x2aaee6,_0xffd0('0x10'));_0x55488d(_0x1b3842[_0xffd0('0x15')][_0xffd0('0x14')]);}})[_0xffd0('0x16')](function(_0x5582df){logger['error'](_0xffd0('0x13'),_0x2aaee6,_0x5582df);_0x4e2d54(_0x5582df);});});} \ No newline at end of file +var _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x552782,_0x398216){var _0x11b034=function(_0x4d7407){while(--_0x4d7407){_0x552782['push'](_0x552782['shift']());}};_0x11b034(++_0x398216);}(_0x9f62,0x154));var _0x29f6=function(_0x24ba13,_0x4cc6a5){_0x24ba13=_0x24ba13-0x0;var _0x3281f2=_0x9f62[_0x24ba13];return _0x3281f2;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('Tag,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 5c12c46..f5f5cb2 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 8a0a2e8..db0a40a 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 _0xb10b=['name','sequelize','STRING'];(function(_0x44e1be,_0x2ea032){var _0x4ba2bc=function(_0x1bb50f){while(--_0x1bb50f){_0x44e1be['push'](_0x44e1be['shift']());}};_0x4ba2bc(++_0x2ea032);}(_0xb10b,0x12a));var _0xbb10=function(_0x569c95,_0x54f839){_0x569c95=_0x569c95-0x0;var _0x2749b5=_0xb10b[_0x569c95];return _0x2749b5;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x5c42bd,_0x32f124){var _0x523af3=function(_0x14ca85){while(--_0x14ca85){_0x5c42bd['push'](_0x5c42bd['shift']());}};_0x523af3(++_0x32f124);}(_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 1fc9869..50eb8c9 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 _0xe8d4=['all','removeAgents','Chat','Mail','Whatsapp','Queue:remove','getAgents','nolimit','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./team.socket','register','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','save','update','then','sendStatus','error','stack','send','Team','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','map','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','addQueues','Unknown\x20channel','add','ids','remove','Queues','addAgents','isArray','Voice','Fax','Openchannel','through','penalty','QueueId','User','Queue','findOrCreate','emit','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','TeamVoiceQueue'];(function(_0x3af392,_0xe5e91f){var _0x33be9f=function(_0x3e3a59){while(--_0x3e3a59){_0x3af392['push'](_0x3af392['shift']());}};_0x33be9f(++_0xe5e91f);}(_0xe8d4,0x13e));var _0x4e8d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe8d4[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x4e8d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e8d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e8d('0x2'));var moment=require(_0x4e8d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4e8d('0x4'));var path=require(_0x4e8d('0x5'));var sox=require(_0x4e8d('0x6'));var csv=require(_0x4e8d('0x7'));var ejs=require(_0x4e8d('0x8'));var fs=require('fs');var fs_extra=require(_0x4e8d('0x9'));var _=require(_0x4e8d('0xa'));var squel=require('squel');var crypto=require(_0x4e8d('0xb'));var jsforce=require(_0x4e8d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4e8d('0x7'));var querystring=require(_0x4e8d('0xd'));var Papa=require(_0x4e8d('0xe'));var Redis=require(_0x4e8d('0xf'));var authService=require(_0x4e8d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4e8d('0x11'));var hardwareService=require(_0x4e8d('0x12'));var logger=require(_0x4e8d('0x13'))(_0x4e8d('0x14'));var utils=require(_0x4e8d('0x15'));var config=require(_0x4e8d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e8d('0x17'))['db'];config['redis']=_[_0x4e8d('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4e8d('0x19'))(new Redis(config[_0x4e8d('0x1a')]));require(_0x4e8d('0x1b'))[_0x4e8d('0x1c')](socket);function respondWithStatusCode(_0x55d597,_0x591160){_0x591160=_0x591160||0xcc;return function(_0x49d26e){if(_0x49d26e){return _0x55d597['sendStatus'](_0x591160);}return _0x55d597['status'](_0x591160)[_0x4e8d('0x1d')]();};}function respondWithResult(_0x2b95e9,_0x1cec76){_0x1cec76=_0x1cec76||0xc8;return function(_0x52ec00){if(_0x52ec00){return _0x2b95e9['status'](_0x1cec76)[_0x4e8d('0x1e')](_0x52ec00);}};}function respondWithFilteredResult(_0x29de56,_0x18c05){return function(_0x191677){if(_0x191677){var _0x5f1383=typeof _0x18c05['offset']===_0x4e8d('0x1f')&&typeof _0x18c05[_0x4e8d('0x20')]===_0x4e8d('0x1f');var _0x29979a=_0x191677[_0x4e8d('0x21')];var _0x4f69fb=_0x5f1383?0x0:_0x18c05['offset'];var _0x45590b=_0x5f1383?_0x191677['count']:_0x18c05[_0x4e8d('0x22')]+_0x18c05[_0x4e8d('0x20')];var _0x39c349;if(_0x45590b>=_0x29979a){_0x45590b=_0x29979a;_0x39c349=0xc8;}else{_0x39c349=0xce;}_0x29de56[_0x4e8d('0x23')](_0x39c349);return _0x29de56[_0x4e8d('0x24')](_0x4e8d('0x25'),_0x4f69fb+'-'+_0x45590b+'/'+_0x29979a)[_0x4e8d('0x1e')](_0x191677);}return null;};}function patchUpdates(_0x204408){return function(_0x47c42d){try{jsonpatch[_0x4e8d('0x26')](_0x47c42d,_0x204408,!![]);}catch(_0x200ff8){return BPromise['reject'](_0x200ff8);}return _0x47c42d[_0x4e8d('0x27')]();};}function saveUpdates(_0x1c3675,_0x431ce7){return function(_0x3a9c0e){if(_0x3a9c0e){return _0x3a9c0e[_0x4e8d('0x28')](_0x1c3675)[_0x4e8d('0x29')](function(_0x366456){return _0x366456;});}return null;};}function handleEntityNotFound(_0x3e0631,_0x2a0fca){return function(_0x17a43){if(!_0x17a43){_0x3e0631[_0x4e8d('0x2a')](0x194);}return _0x17a43;};}function handleError(_0x13b577,_0x5732ec){_0x5732ec=_0x5732ec||0x1f4;return function(_0x5c42a3){logger[_0x4e8d('0x2b')](_0x5c42a3[_0x4e8d('0x2c')]);if(_0x5c42a3['name']){delete _0x5c42a3['name'];}_0x13b577['status'](_0x5732ec)[_0x4e8d('0x2d')](_0x5c42a3);};}exports['index']=function(_0x1080f8,_0xdbb236){var _0x2a2e3a={},_0xae825e={},_0x4f7cd2={'count':0x0,'rows':[]};var _0x1d1ffe=_['map'](db[_0x4e8d('0x2e')][_0x4e8d('0x2f')],function(_0xbfc3cd){return{'name':_0xbfc3cd['fieldName'],'type':_0xbfc3cd['type'][_0x4e8d('0x30')]};});_0xae825e[_0x4e8d('0x31')]=_['map'](_0x1d1ffe,_0x4e8d('0x32'));_0xae825e[_0x4e8d('0x33')]=_[_0x4e8d('0x34')](_0x1080f8[_0x4e8d('0x33')]);_0xae825e[_0x4e8d('0x35')]=_[_0x4e8d('0x36')](_0xae825e[_0x4e8d('0x31')],_0xae825e[_0x4e8d('0x33')]);_0x2a2e3a[_0x4e8d('0x37')]=_[_0x4e8d('0x36')](_0xae825e[_0x4e8d('0x31')],qs[_0x4e8d('0x38')](_0x1080f8['query'][_0x4e8d('0x38')]));_0x2a2e3a[_0x4e8d('0x37')]=_0x2a2e3a[_0x4e8d('0x37')][_0x4e8d('0x39')]?_0x2a2e3a[_0x4e8d('0x37')]:_0xae825e[_0x4e8d('0x31')];if(!_0x1080f8['query'][_0x4e8d('0x3a')]('nolimit')){_0x2a2e3a['limit']=qs[_0x4e8d('0x20')](_0x1080f8['query'][_0x4e8d('0x20')]);_0x2a2e3a[_0x4e8d('0x22')]=qs[_0x4e8d('0x22')](_0x1080f8[_0x4e8d('0x33')][_0x4e8d('0x22')]);}_0x2a2e3a[_0x4e8d('0x3b')]=qs['sort'](_0x1080f8[_0x4e8d('0x33')][_0x4e8d('0x3c')]);_0x2a2e3a[_0x4e8d('0x3d')]=qs['filters'](_[_0x4e8d('0x3e')](_0x1080f8[_0x4e8d('0x33')],_0xae825e[_0x4e8d('0x35')]),_0x1d1ffe);if(_0x1080f8['query'][_0x4e8d('0x3f')]){_0x2a2e3a['where']=_[_0x4e8d('0x40')](_0x2a2e3a[_0x4e8d('0x3d')],{'$or':_['map'](_0x1d1ffe,function(_0x1e8fee){if(_0x1e8fee['type']!==_0x4e8d('0x41')){var _0x331338={};_0x331338[_0x1e8fee[_0x4e8d('0x32')]]={'$like':'%'+_0x1080f8[_0x4e8d('0x33')][_0x4e8d('0x3f')]+'%'};return _0x331338;}})});}_0x2a2e3a=_['merge']({},_0x2a2e3a,_0x1080f8[_0x4e8d('0x42')]);var _0x867b0d={'where':_0x2a2e3a[_0x4e8d('0x3d')]};return db[_0x4e8d('0x2e')][_0x4e8d('0x21')](_0x867b0d)[_0x4e8d('0x29')](function(_0x10cf57){_0x4f7cd2['count']=_0x10cf57;if(_0x1080f8['query'][_0x4e8d('0x43')]){_0x2a2e3a[_0x4e8d('0x44')]=[{'all':!![]}];}return db[_0x4e8d('0x2e')][_0x4e8d('0x45')](_0x2a2e3a);})[_0x4e8d('0x29')](function(_0x108428){_0x4f7cd2[_0x4e8d('0x46')]=_0x108428;return _0x4f7cd2;})[_0x4e8d('0x29')](respondWithFilteredResult(_0xdbb236,_0x2a2e3a))[_0x4e8d('0x47')](handleError(_0xdbb236,null));};exports[_0x4e8d('0x48')]=function(_0x7fff05,_0x250ba8){var _0x3d9236={'raw':![],'where':{'id':_0x7fff05[_0x4e8d('0x49')]['id']}},_0xf02ca7={};_0xf02ca7[_0x4e8d('0x31')]=_[_0x4e8d('0x34')](db[_0x4e8d('0x2e')][_0x4e8d('0x2f')]);_0xf02ca7[_0x4e8d('0x33')]=_[_0x4e8d('0x34')](_0x7fff05[_0x4e8d('0x33')]);_0xf02ca7[_0x4e8d('0x35')]=_[_0x4e8d('0x36')](_0xf02ca7[_0x4e8d('0x31')],_0xf02ca7[_0x4e8d('0x33')]);_0x3d9236['attributes']=_[_0x4e8d('0x36')](_0xf02ca7[_0x4e8d('0x31')],qs[_0x4e8d('0x38')](_0x7fff05[_0x4e8d('0x33')][_0x4e8d('0x38')]));_0x3d9236[_0x4e8d('0x37')]=_0x3d9236[_0x4e8d('0x37')][_0x4e8d('0x39')]?_0x3d9236['attributes']:_0xf02ca7[_0x4e8d('0x31')];if(_0x7fff05['query'][_0x4e8d('0x43')]){_0x3d9236[_0x4e8d('0x44')]=[{'all':!![]}];}_0x3d9236=_[_0x4e8d('0x40')]({},_0x3d9236,_0x7fff05[_0x4e8d('0x42')]);return db[_0x4e8d('0x2e')][_0x4e8d('0x4a')](_0x3d9236)[_0x4e8d('0x29')](handleEntityNotFound(_0x250ba8,null))[_0x4e8d('0x29')](respondWithResult(_0x250ba8,null))[_0x4e8d('0x47')](handleError(_0x250ba8,null));};exports['create']=function(_0x55ce40,_0x15e08a){return db[_0x4e8d('0x2e')][_0x4e8d('0x4b')](_0x55ce40[_0x4e8d('0x4c')],{})[_0x4e8d('0x29')](function(_0x484a39){var _0x2be05f=_0x55ce40['user'][_0x4e8d('0x4d')]({'plain':!![]});if(!_0x2be05f)throw new Error(_0x4e8d('0x4e'));if(_0x2be05f[_0x4e8d('0x4f')]===_0x4e8d('0x50')){var _0x46c76b=_0x484a39[_0x4e8d('0x4d')]({'plain':!![]});var _0x34c96d=_0x4e8d('0x51');return db[_0x4e8d('0x52')][_0x4e8d('0x4a')]({'where':{'name':_0x34c96d,'userProfileId':_0x2be05f[_0x4e8d('0x53')]},'raw':!![]})[_0x4e8d('0x29')](function(_0x189eb7){if(_0x189eb7&&_0x189eb7[_0x4e8d('0x54')]===0x0){return db[_0x4e8d('0x55')][_0x4e8d('0x4b')]({'name':_0x46c76b['name'],'resourceId':_0x46c76b['id'],'type':_0x189eb7[_0x4e8d('0x32')],'sectionId':_0x189eb7['id']},{})[_0x4e8d('0x29')](function(){return _0x484a39;});}else{return _0x484a39;}})[_0x4e8d('0x47')](function(_0x1d0d97){logger[_0x4e8d('0x2b')](_0x4e8d('0x56'),_0x1d0d97);throw _0x1d0d97;});}return _0x484a39;})['then'](respondWithResult(_0x15e08a,0xc9))[_0x4e8d('0x47')](handleError(_0x15e08a,null));};exports[_0x4e8d('0x28')]=function(_0x1e32bd,_0x4fe202){if(_0x1e32bd[_0x4e8d('0x4c')]['id']){delete _0x1e32bd[_0x4e8d('0x4c')]['id'];}return db[_0x4e8d('0x2e')]['find']({'where':{'id':_0x1e32bd[_0x4e8d('0x49')]['id']}})[_0x4e8d('0x29')](handleEntityNotFound(_0x4fe202,null))['then'](saveUpdates(_0x1e32bd['body'],null))[_0x4e8d('0x29')](respondWithResult(_0x4fe202,null))[_0x4e8d('0x47')](handleError(_0x4fe202,null));};exports[_0x4e8d('0x57')]=function(_0x557c1a,_0x389334){var _0x469a62=_0x557c1a[_0x4e8d('0x49')]['id'];var _0x1543f4=[];return db[_0x4e8d('0x58')][_0x4e8d('0x59')](function(_0x37438c){var _0x4b6924='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x469a62;return db[_0x4e8d('0x58')][_0x4e8d('0x33')](_0x4b6924,{'type':db[_0x4e8d('0x5a')][_0x4e8d('0x5b')][_0x4e8d('0x5c')],'raw':!![],'transaction':_0x37438c})[_0x4e8d('0x29')](function(_0x4b153d){_0x1543f4=_['map'](_0x4b153d,function(_0x50d308){return Number(_0x50d308[_0x4e8d('0x5d')]);});})['then'](function(){var _0x520876=_0x4e8d('0x5e')+_0x469a62;return db[_0x4e8d('0x58')]['query'](_0x520876,{'type':db[_0x4e8d('0x5a')]['QueryTypes'][_0x4e8d('0x5c')],'raw':!![],'transaction':_0x37438c});})['then'](function(_0x8f2945){var _0x5dea80=_[_0x4e8d('0x5f')](_0x8f2945,function(_0x3a2703){return Number(_0x3a2703[_0x4e8d('0x60')]);});return db[_0x4e8d('0x61')]['destroy']({'where':{'UserId':{'$in':_0x1543f4},'VoiceQueueId':{'$in':_0x5dea80}},'transaction':_0x37438c});})[_0x4e8d('0x29')](function(){var _0x203050='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x469a62;return db[_0x4e8d('0x58')][_0x4e8d('0x33')](_0x203050,{'type':db[_0x4e8d('0x5a')]['QueryTypes'][_0x4e8d('0x5c')],'raw':!![],'transaction':_0x37438c});})[_0x4e8d('0x29')](function(_0x11dbdc){var _0x42f4cb=_[_0x4e8d('0x5f')](_0x11dbdc,function(_0x42e30c){return Number(_0x42e30c[_0x4e8d('0x62')]);});return db[_0x4e8d('0x63')][_0x4e8d('0x57')]({'where':{'UserId':{'$in':_0x1543f4},'MailQueueId':{'$in':_0x42f4cb}},'transaction':_0x37438c});})['then'](function(){var _0x151c0a=_0x4e8d('0x64')+_0x469a62;return db['sequelize']['query'](_0x151c0a,{'type':db[_0x4e8d('0x5a')][_0x4e8d('0x5b')][_0x4e8d('0x5c')],'raw':!![],'transaction':_0x37438c});})['then'](function(_0x3d5319){var _0x45b03e=_[_0x4e8d('0x5f')](_0x3d5319,function(_0x5c1c21){return Number(_0x5c1c21['SmsQueueId']);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x1543f4},'SmsQueueId':{'$in':_0x45b03e}},'transaction':_0x37438c});})[_0x4e8d('0x29')](function(){var _0x7a87ff=_0x4e8d('0x65')+_0x469a62;return db['sequelize'][_0x4e8d('0x33')](_0x7a87ff,{'type':db[_0x4e8d('0x5a')][_0x4e8d('0x5b')][_0x4e8d('0x5c')],'raw':!![],'transaction':_0x37438c});})[_0x4e8d('0x29')](function(_0x4e67bf){var _0x51f1ef=_[_0x4e8d('0x5f')](_0x4e67bf,function(_0x21cf92){return Number(_0x21cf92[_0x4e8d('0x66')]);});return db[_0x4e8d('0x67')][_0x4e8d('0x57')]({'where':{'UserId':{'$in':_0x1543f4},'ChatQueueId':{'$in':_0x51f1ef}},'transaction':_0x37438c});})[_0x4e8d('0x29')](function(){var _0x13db9b=_0x4e8d('0x68')+_0x469a62;return db[_0x4e8d('0x58')][_0x4e8d('0x33')](_0x13db9b,{'type':db['Sequelize'][_0x4e8d('0x5b')]['SELECT'],'raw':!![],'transaction':_0x37438c});})[_0x4e8d('0x29')](function(_0x4a10fd){var _0x4c1cd9=_[_0x4e8d('0x5f')](_0x4a10fd,function(_0x20442a){return Number(_0x20442a[_0x4e8d('0x69')]);});return db[_0x4e8d('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x1543f4},'FaxQueueId':{'$in':_0x4c1cd9}},'transaction':_0x37438c});})[_0x4e8d('0x29')](function(){var _0x14b21f=_0x4e8d('0x6b')+_0x469a62;return db[_0x4e8d('0x58')][_0x4e8d('0x33')](_0x14b21f,{'type':db[_0x4e8d('0x5a')]['QueryTypes'][_0x4e8d('0x5c')],'raw':!![],'transaction':_0x37438c});})['then'](function(_0x27a1b6){var _0x272565=_['map'](_0x27a1b6,function(_0x1204d4){return Number(_0x1204d4[_0x4e8d('0x6c')]);});return db[_0x4e8d('0x6d')][_0x4e8d('0x57')]({'where':{'UserId':{'$in':_0x1543f4},'OpenchannelQueueId':{'$in':_0x272565}},'transaction':_0x37438c});})[_0x4e8d('0x29')](function(){var _0x3a08bd=_0x4e8d('0x6e')+_0x469a62;return db[_0x4e8d('0x58')][_0x4e8d('0x33')](_0x3a08bd,{'type':db[_0x4e8d('0x5a')][_0x4e8d('0x5b')][_0x4e8d('0x5c')],'raw':!![],'transaction':_0x37438c});})[_0x4e8d('0x29')](function(_0x2ccf43){var _0x33bfa3=_[_0x4e8d('0x5f')](_0x2ccf43,function(_0x89843a){return Number(_0x89843a[_0x4e8d('0x6f')]);});return db[_0x4e8d('0x70')][_0x4e8d('0x57')]({'where':{'UserId':{'$in':_0x1543f4},'WhatsappQueueId':{'$in':_0x33bfa3}},'transaction':_0x37438c});})[_0x4e8d('0x29')](function(){return db[_0x4e8d('0x71')][_0x4e8d('0x4a')]({'where':{'TeamId':_0x469a62}});})[_0x4e8d('0x29')](function(_0x5ac165){if(_0x5ac165===null){return;}return db[_0x4e8d('0x72')]['destroy']({'where':{'UserId':{'$in':_0x1543f4},'VoicePrefixId':_0x5ac165[_0x4e8d('0x73')]},'transaction':_0x37438c});})[_0x4e8d('0x29')](function(){return db[_0x4e8d('0x2e')]['destroy']({'where':{'id':_0x469a62},'cascade':!![],'transaction':_0x37438c});})[_0x4e8d('0x29')](function(_0x342d0f){if(_0x342d0f===0x0){_0x389334[_0x4e8d('0x2a')](0x194);}else{return db[_0x4e8d('0x55')][_0x4e8d('0x57')]({'where':{'type':'Teams','resourceId':_0x469a62},'cascade':!![],'transaction':_0x37438c})[_0x4e8d('0x29')](function(){_0x389334[_0x4e8d('0x23')](0xcc)[_0x4e8d('0x1d')]();});}})[_0x4e8d('0x47')](function(_0x1cb00c){_0x389334[_0x4e8d('0x23')](0x1f4)[_0x4e8d('0x2d')](_0x1cb00c);});});};exports['getQueues']=function(_0x2d8720,_0x4a7de0,_0x55c620){return db['Team'][_0x4e8d('0x74')]({'where':{'id':_0x2d8720['params']['id']}})['then'](handleEntityNotFound(_0x4a7de0,null))[_0x4e8d('0x29')](function(_0x1980da){if(!_0x2d8720[_0x4e8d('0x33')][_0x4e8d('0x75')]||!utils[_0x4e8d('0x76')](_0x2d8720['query'][_0x4e8d('0x75')])){throw new db[(_0x4e8d('0x5a'))][(_0x4e8d('0x77'))]('Unknown\x20channel');}var _0x178730={};var _0x35f39e={};_0x35f39e[_0x4e8d('0x31')]=_[_0x4e8d('0x34')](db[_[_0x4e8d('0x78')](_0x2d8720['query'][_0x4e8d('0x75')][_0x4e8d('0x79')]())+'Queue'][_0x4e8d('0x2f')]);_0x35f39e[_0x4e8d('0x33')]=_[_0x4e8d('0x34')](_0x2d8720[_0x4e8d('0x33')]);_0x35f39e['filters']=_['intersection'](_0x35f39e[_0x4e8d('0x31')],_0x35f39e[_0x4e8d('0x33')]);_0x178730['attributes']=_['intersection'](_0x35f39e[_0x4e8d('0x31')],qs[_0x4e8d('0x38')](_0x2d8720['query'][_0x4e8d('0x38')]));_0x178730[_0x4e8d('0x37')]=_0x178730['attributes'][_0x4e8d('0x39')]?_0x178730[_0x4e8d('0x37')]:_0x35f39e[_0x4e8d('0x31')];_0x178730['limit']=qs[_0x4e8d('0x20')](_0x2d8720[_0x4e8d('0x33')]['limit']);_0x178730[_0x4e8d('0x22')]=qs['offset'](_0x2d8720['query'][_0x4e8d('0x22')]);_0x178730[_0x4e8d('0x3b')]=qs[_0x4e8d('0x3c')](_0x2d8720['query'][_0x4e8d('0x3c')]);_0x178730[_0x4e8d('0x3d')]=qs[_0x4e8d('0x35')](_[_0x4e8d('0x3e')](_0x2d8720['query'],_0x35f39e[_0x4e8d('0x35')]));_0x178730=_[_0x4e8d('0x40')]({},_0x178730,_0x2d8720[_0x4e8d('0x42')]);return _0x1980da['get'+_['capitalize'](_0x2d8720[_0x4e8d('0x33')][_0x4e8d('0x75')][_0x4e8d('0x79')]())+'Queues'](_0x178730);})['then'](respondWithResult(_0x4a7de0,null))[_0x4e8d('0x47')](handleError(_0x4a7de0,null));};exports[_0x4e8d('0x7a')]=function(_0x57c3df,_0x2e7d6f,_0x5c99db){return db[_0x4e8d('0x2e')][_0x4e8d('0x74')]({'where':{'id':_0x57c3df[_0x4e8d('0x49')]['id']}})[_0x4e8d('0x29')](function(_0x5a7247){if(_0x5a7247){if(!_0x57c3df[_0x4e8d('0x4c')][_0x4e8d('0x75')]||!utils[_0x4e8d('0x76')](_0x57c3df[_0x4e8d('0x4c')]['channel'])){throw new db[(_0x4e8d('0x5a'))][(_0x4e8d('0x77'))](_0x4e8d('0x7b'));}return _0x5a7247[_0x4e8d('0x7c')+_[_0x4e8d('0x78')](_0x57c3df[_0x4e8d('0x4c')]['channel'][_0x4e8d('0x79')]())+'Queues'](_0x57c3df['body'][_0x4e8d('0x7d')]);}return null;})[_0x4e8d('0x29')](handleEntityNotFound(_0x2e7d6f,null))[_0x4e8d('0x29')](respondWithStatusCode(_0x2e7d6f,null))['catch'](handleError(_0x2e7d6f,null));};exports['removeQueues']=function(_0x3d91ab,_0x4dcc8b,_0x132658){return db[_0x4e8d('0x2e')][_0x4e8d('0x74')]({'where':{'id':_0x3d91ab[_0x4e8d('0x49')]['id']}})[_0x4e8d('0x29')](function(_0x4c42d6){if(_0x4c42d6){if(!_0x3d91ab['query'][_0x4e8d('0x75')]||!utils[_0x4e8d('0x76')](_0x3d91ab['query'][_0x4e8d('0x75')])){throw new db[(_0x4e8d('0x5a'))][(_0x4e8d('0x77'))](_0x4e8d('0x7b'));}return _0x4c42d6[_0x4e8d('0x7e')+_['capitalize'](_0x3d91ab['query'][_0x4e8d('0x75')]['toLowerCase']())+_0x4e8d('0x7f')](_0x3d91ab[_0x4e8d('0x33')][_0x4e8d('0x7d')]);}return null;})[_0x4e8d('0x29')](handleEntityNotFound(_0x4dcc8b,null))[_0x4e8d('0x29')](respondWithStatusCode(_0x4dcc8b,null))[_0x4e8d('0x47')](handleError(_0x4dcc8b,null));};exports[_0x4e8d('0x80')]=function(_0xc5e26c,_0x1e79ba){var _0x3b8131=_[_0x4e8d('0x81')](_0xc5e26c['body'][_0x4e8d('0x7d')])?_0xc5e26c[_0x4e8d('0x4c')]['ids']:[_0xc5e26c[_0x4e8d('0x4c')][_0x4e8d('0x7d')]];var _0x20d3ba=_0xc5e26c[_0x4e8d('0x49')]['id'];return db[_0x4e8d('0x2e')][_0x4e8d('0x4a')]({'where':{'id':_0x20d3ba}})[_0x4e8d('0x29')](handleEntityNotFound(_0x1e79ba,null))[_0x4e8d('0x29')](function(_0x45a6e7){if(_0x45a6e7){var _0x24e734=[_0x4e8d('0x82'),'Chat','Mail','Sms',_0x4e8d('0x83'),_0x4e8d('0x84'),'Whatsapp'];return db[_0x4e8d('0x58')]['transaction'](function(_0x575d01){var _0x497df4=_['map'](_0x24e734,function(_0x553f6d){var _0x46c981={'attributes':['id',_0x4e8d('0x32')]};if(_0x553f6d===_0x4e8d('0x82')){_0x46c981[_0x4e8d('0x85')]={'attributes':[_0x4e8d('0x86')]};}return _0x45a6e7[_0x4e8d('0x4d')+_0x553f6d+'Queues'](_0x46c981)[_0x4e8d('0x29')](function(_0x11abf4){var _0x4047c4=_['map'](_0x11abf4,function(_0x237d42){var _0x5c805f=_[_0x4e8d('0x5f')](_0x3b8131,function(_0x1b1c52){var _0x2b86a0={'where':{'UserId':_0x1b1c52,[_0x553f6d+_0x4e8d('0x87')]:_0x237d42['id']},'transaction':_0x575d01};if(_0x553f6d===_0x4e8d('0x82')){_0x2b86a0['defaults']={'penalty':_0x237d42['TeamVoiceQueue'][_0x4e8d('0x86')]};}return db[_0x4e8d('0x88')+_0x553f6d+_0x4e8d('0x89')][_0x4e8d('0x8a')](_0x2b86a0)[_0x4e8d('0x29')](function(){socket[_0x4e8d('0x8b')]('user'+_0x553f6d+'Queue:save',{'UserId':_0x1b1c52,[_0x553f6d+'QueueId']:_0x237d42['id']});if(_0x553f6d!==_0x4e8d('0x82')){return;}return db[_0x4e8d('0x88')][_0x4e8d('0x45')]({'where':{'id':_0x3b8131,'online':0x1},'attributes':['id',_0x4e8d('0x32'),_0x4e8d('0x8c'),_0x4e8d('0x8d'),_0x4e8d('0x8e')],'raw':!![]})[_0x4e8d('0x29')](function(_0x2c19b7){var _0x4b2a5c=_['map'](_0x2c19b7,function(_0x1f6e5f){return db[_0x4e8d('0x8f')][_0x4e8d('0x90')]({'membername':_0x1f6e5f[_0x4e8d('0x32')],'UserId':_0x1f6e5f['id'],'queue_name':_0x237d42[_0x4e8d('0x32')],'VoiceQueueId':_0x237d42['id'],'interface':_[_0x4e8d('0x91')](_0x1f6e5f[_0x4e8d('0x8e')])?util['format']('SIP/%s',_0x1f6e5f[_0x4e8d('0x32')]):_0x1f6e5f['interface'],'paused':_0x1f6e5f[_0x4e8d('0x8d')]||![],'penalty':_0x237d42[_0x4e8d('0x92')]['penalty']},{'transaction':_0x575d01});});return Promise[_0x4e8d('0x93')](_0x4b2a5c);});});});return Promise[_0x4e8d('0x93')](_0x5c805f);});return Promise['all'](_0x4047c4);})['then'](function(){return db[_0x4e8d('0x71')][_0x4e8d('0x74')]({'where':{'teamId':_0x20d3ba}})[_0x4e8d('0x29')](function(_0x261561){if(_0x261561){var _0x3361d4=_[_0x4e8d('0x5f')](_0x3b8131,function(_0xc0f305){db[_0x4e8d('0x72')][_0x4e8d('0x90')]({'UserId':_0xc0f305,'VoicePrefixId':_0x261561[_0x4e8d('0x73')]});});return Promise[_0x4e8d('0x93')](_0x3361d4);}});});});return Promise['all'](_0x497df4)[_0x4e8d('0x29')](function(){return _0x45a6e7['addAgents'](_0x3b8131,{'transaction':_0x575d01})['spread'](function(_0xc1b682){return _0xc1b682;});});});}})['then'](respondWithResult(_0x1e79ba,null))[_0x4e8d('0x47')](handleError(_0x1e79ba,null));};exports[_0x4e8d('0x94')]=function(_0x186ac5,_0x2adf1a){var _0x37c763=_[_0x4e8d('0x81')](_0x186ac5[_0x4e8d('0x33')][_0x4e8d('0x7d')])?_0x186ac5['query'][_0x4e8d('0x7d')]:[_0x186ac5[_0x4e8d('0x33')][_0x4e8d('0x7d')]];var _0xf6c24f=_0x186ac5[_0x4e8d('0x49')]['id'];return db[_0x4e8d('0x2e')]['find']({'where':{'id':_0xf6c24f}})[_0x4e8d('0x29')](handleEntityNotFound(_0x2adf1a,null))['then'](function(_0x1f9e6b){if(_0x1f9e6b){var _0x24c4be=[_0x4e8d('0x82'),_0x4e8d('0x95'),_0x4e8d('0x96'),'Sms',_0x4e8d('0x83'),_0x4e8d('0x84'),_0x4e8d('0x97')];return db[_0x4e8d('0x58')]['transaction'](function(_0x568414){var _0x40d533=_[_0x4e8d('0x5f')](_0x24c4be,function(_0x988e95){var _0x1e7115={'attributes':['id','name']};return _0x1f9e6b[_0x4e8d('0x4d')+_0x988e95+_0x4e8d('0x7f')](_0x1e7115)[_0x4e8d('0x29')](function(_0x23ae6f){var _0x13d709=_[_0x4e8d('0x5f')](_0x23ae6f,function(_0x1801c9){return _0x1801c9[_0x4e8d('0x94')](_0x37c763,{'transaction':_0x568414})['then'](function(){var _0x2677e6=_[_0x4e8d('0x5f')](_0x37c763,function(_0x545a44){socket['emit'](_0x4e8d('0x50')+_0x988e95+_0x4e8d('0x98'),{'UserId':Number(_0x545a44),[_0x988e95+'QueueId']:_0x1801c9['id']});if(_0x988e95!==_0x4e8d('0x82')){return;}return db['UserVoiceQueueRt'][_0x4e8d('0x57')]({'where':{'VoiceQueueId':_0x1801c9['id'],'UserId':_0x545a44},'transaction':_0x568414});});return Promise['all'](_0x2677e6);});});return Promise[_0x4e8d('0x93')](_0x13d709);});});return Promise[_0x4e8d('0x93')](_0x40d533)[_0x4e8d('0x29')](function(){return _0x1f9e6b['removeAgents'](_0x37c763,{'transaction':_0x568414});})[_0x4e8d('0x29')](function(){return db[_0x4e8d('0x71')][_0x4e8d('0x74')]({'where':{'teamId':_0xf6c24f}})['then'](function(_0x415a17){if(_0x415a17){var _0x3dbe83=_[_0x4e8d('0x5f')](_0x37c763,function(_0x15e472){db[_0x4e8d('0x72')][_0x4e8d('0x57')]({'where':{'UserId':_0x15e472,'VoicePrefixId':_0x415a17[_0x4e8d('0x73')]}});});return Promise[_0x4e8d('0x93')](_0x3dbe83);}});});});}})[_0x4e8d('0x29')](respondWithStatusCode(_0x2adf1a,null))['catch'](handleError(_0x2adf1a,null));};exports['getAgents']=function(_0x2da0ae,_0x213ae6,_0x34fa11){var _0x195c05={};var _0x103759={};var _0x66f166;var _0x1bbe32;return db[_0x4e8d('0x2e')]['findOne']({'where':{'id':_0x2da0ae['params']['id']}})[_0x4e8d('0x29')](handleEntityNotFound(_0x213ae6,null))['then'](function(_0x114075){if(_0x114075){_0x66f166=_0x114075;_0x103759[_0x4e8d('0x31')]=_['keys'](db[_0x4e8d('0x88')][_0x4e8d('0x2f')]);_0x103759['query']=_[_0x4e8d('0x34')](_0x2da0ae['query']);_0x103759[_0x4e8d('0x35')]=_[_0x4e8d('0x36')](_0x103759[_0x4e8d('0x31')],_0x103759[_0x4e8d('0x33')]);_0x195c05[_0x4e8d('0x37')]=_[_0x4e8d('0x36')](_0x103759[_0x4e8d('0x31')],qs['fields'](_0x2da0ae[_0x4e8d('0x33')]['fields']));_0x195c05['attributes']=_0x195c05['attributes']['length']?_0x195c05[_0x4e8d('0x37')]:_0x103759[_0x4e8d('0x31')];_0x195c05[_0x4e8d('0x3b')]=qs['sort'](_0x2da0ae[_0x4e8d('0x33')][_0x4e8d('0x3c')]);_0x195c05[_0x4e8d('0x3d')]=qs[_0x4e8d('0x35')](_[_0x4e8d('0x3e')](_0x2da0ae[_0x4e8d('0x33')],_0x103759[_0x4e8d('0x35')]));if(_0x2da0ae[_0x4e8d('0x33')]['filter']){_0x195c05[_0x4e8d('0x3d')]=_[_0x4e8d('0x40')](_0x195c05[_0x4e8d('0x3d')],{'$or':_['map'](_0x195c05[_0x4e8d('0x37')],function(_0x45b8c1){var _0x4dfd5f={};_0x4dfd5f[_0x45b8c1]={'$like':'%'+_0x2da0ae[_0x4e8d('0x33')][_0x4e8d('0x3f')]+'%'};return _0x4dfd5f;})});}_0x195c05=_[_0x4e8d('0x40')]({},_0x195c05,_0x2da0ae[_0x4e8d('0x42')]);return _0x66f166[_0x4e8d('0x99')](_0x195c05);}})[_0x4e8d('0x29')](function(_0x2e0ef8){if(_0x2e0ef8){_0x1bbe32=_0x2e0ef8[_0x4e8d('0x39')];if(!_0x2da0ae['query'][_0x4e8d('0x3a')](_0x4e8d('0x9a'))){_0x195c05[_0x4e8d('0x20')]=qs[_0x4e8d('0x20')](_0x2da0ae[_0x4e8d('0x33')]['limit']);_0x195c05[_0x4e8d('0x22')]=qs[_0x4e8d('0x22')](_0x2da0ae['query']['offset']);}return _0x66f166[_0x4e8d('0x99')](_0x195c05);}})[_0x4e8d('0x29')](function(_0x4bc0e0){if(_0x4bc0e0){return _0x4bc0e0?{'count':_0x1bbe32,'rows':_0x4bc0e0}:null;}})[_0x4e8d('0x29')](respondWithResult(_0x213ae6,null))['catch'](handleError(_0x213ae6,null));}; \ No newline at end of file +var _0x0a7b=['interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','UserVoicePrefix','addAgents','spread','removeAgents','emit','Queue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','options','Queues','add','ids','remove','isArray','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','Voice','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause'];(function(_0x2c2954,_0x3cadf4){var _0x1e834e=function(_0x9f157e){while(--_0x9f157e){_0x2c2954['push'](_0x2c2954['shift']());}};_0x1e834e(++_0x3cadf4);}(_0x0a7b,0x1e4));var _0xb0a7=function(_0x59eab2,_0x23d4f5){_0x59eab2=_0x59eab2-0x0;var _0x599a59=_0x0a7b[_0x59eab2];return _0x599a59;};'use strict';var emlformat=require(_0xb0a7('0x0'));var rimraf=require(_0xb0a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb0a7('0x2'));var rp=require('request-promise');var moment=require(_0xb0a7('0x3'));var BPromise=require(_0xb0a7('0x4'));var Mustache=require(_0xb0a7('0x5'));var util=require(_0xb0a7('0x6'));var path=require(_0xb0a7('0x7'));var sox=require(_0xb0a7('0x8'));var csv=require('to-csv');var ejs=require(_0xb0a7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb0a7('0xa'));var squel=require(_0xb0a7('0xb'));var crypto=require(_0xb0a7('0xc'));var jsforce=require(_0xb0a7('0xd'));var deskjs=require(_0xb0a7('0xe'));var toCsv=require(_0xb0a7('0xf'));var querystring=require(_0xb0a7('0x10'));var Papa=require(_0xb0a7('0x11'));var Redis=require('ioredis');var authService=require(_0xb0a7('0x12'));var qs=require(_0xb0a7('0x13'));var as=require(_0xb0a7('0x14'));var hardwareService=require(_0xb0a7('0x15'));var logger=require(_0xb0a7('0x16'))(_0xb0a7('0x17'));var utils=require(_0xb0a7('0x18'));var config=require(_0xb0a7('0x19'));var licenseUtil=require(_0xb0a7('0x1a'));var db=require(_0xb0a7('0x1b'))['db'];config[_0xb0a7('0x1c')]=_[_0xb0a7('0x1d')](config[_0xb0a7('0x1c')],{'host':_0xb0a7('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb0a7('0x1f'))[_0xb0a7('0x20')](socket);function respondWithStatusCode(_0x4bc104,_0x17360c){_0x17360c=_0x17360c||0xcc;return function(_0x2fa05b){if(_0x2fa05b){return _0x4bc104[_0xb0a7('0x21')](_0x17360c);}return _0x4bc104['status'](_0x17360c)[_0xb0a7('0x22')]();};}function respondWithResult(_0x39d01e,_0x235e81){_0x235e81=_0x235e81||0xc8;return function(_0x1fcd91){if(_0x1fcd91){return _0x39d01e['status'](_0x235e81)[_0xb0a7('0x23')](_0x1fcd91);}};}function respondWithFilteredResult(_0x1b8cb3,_0x42d9b4){return function(_0xc919c7){if(_0xc919c7){var _0x46ee12=typeof _0x42d9b4[_0xb0a7('0x24')]===_0xb0a7('0x25')&&typeof _0x42d9b4[_0xb0a7('0x26')]===_0xb0a7('0x25');var _0x165c84=_0xc919c7[_0xb0a7('0x27')];var _0x1eb933=_0x46ee12?0x0:_0x42d9b4[_0xb0a7('0x24')];var _0x173fbe=_0x46ee12?_0xc919c7[_0xb0a7('0x27')]:_0x42d9b4[_0xb0a7('0x24')]+_0x42d9b4[_0xb0a7('0x26')];var _0x170081;if(_0x173fbe>=_0x165c84){_0x173fbe=_0x165c84;_0x170081=0xc8;}else{_0x170081=0xce;}_0x1b8cb3[_0xb0a7('0x28')](_0x170081);return _0x1b8cb3[_0xb0a7('0x29')](_0xb0a7('0x2a'),_0x1eb933+'-'+_0x173fbe+'/'+_0x165c84)['json'](_0xc919c7);}return null;};}function patchUpdates(_0x620a26){return function(_0x5e01a6){try{jsonpatch[_0xb0a7('0x2b')](_0x5e01a6,_0x620a26,!![]);}catch(_0x3db358){return BPromise[_0xb0a7('0x2c')](_0x3db358);}return _0x5e01a6['save']();};}function saveUpdates(_0x1bc198,_0x2e1650){return function(_0x13fa4a){if(_0x13fa4a){return _0x13fa4a[_0xb0a7('0x2d')](_0x1bc198)[_0xb0a7('0x2e')](function(_0x471099){return _0x471099;});}return null;};}function handleEntityNotFound(_0x497ce0,_0x3f1f20){return function(_0x58e40c){if(!_0x58e40c){_0x497ce0[_0xb0a7('0x21')](0x194);}return _0x58e40c;};}function handleError(_0x56862e,_0x4a97e6){_0x4a97e6=_0x4a97e6||0x1f4;return function(_0x174a77){logger[_0xb0a7('0x2f')](_0x174a77[_0xb0a7('0x30')]);if(_0x174a77[_0xb0a7('0x31')]){delete _0x174a77[_0xb0a7('0x31')];}_0x56862e[_0xb0a7('0x28')](_0x4a97e6)[_0xb0a7('0x32')](_0x174a77);};}exports[_0xb0a7('0x33')]=function(_0x236a8f,_0x12b94a){var _0x4c318b={},_0x1b3e0a={},_0x5f0a6a={'count':0x0,'rows':[]};var _0x1750c5=_[_0xb0a7('0x34')](db[_0xb0a7('0x35')][_0xb0a7('0x36')],function(_0x431ade){return{'name':_0x431ade[_0xb0a7('0x37')],'type':_0x431ade[_0xb0a7('0x38')][_0xb0a7('0x39')]};});_0x1b3e0a['model']=_[_0xb0a7('0x34')](_0x1750c5,'name');_0x1b3e0a[_0xb0a7('0x3a')]=_[_0xb0a7('0x3b')](_0x236a8f[_0xb0a7('0x3a')]);_0x1b3e0a[_0xb0a7('0x3c')]=_[_0xb0a7('0x3d')](_0x1b3e0a[_0xb0a7('0x3e')],_0x1b3e0a['query']);_0x4c318b[_0xb0a7('0x3f')]=_[_0xb0a7('0x3d')](_0x1b3e0a[_0xb0a7('0x3e')],qs['fields'](_0x236a8f['query'][_0xb0a7('0x40')]));_0x4c318b[_0xb0a7('0x3f')]=_0x4c318b[_0xb0a7('0x3f')][_0xb0a7('0x41')]?_0x4c318b[_0xb0a7('0x3f')]:_0x1b3e0a[_0xb0a7('0x3e')];if(!_0x236a8f[_0xb0a7('0x3a')][_0xb0a7('0x42')]('nolimit')){_0x4c318b[_0xb0a7('0x26')]=qs[_0xb0a7('0x26')](_0x236a8f[_0xb0a7('0x3a')]['limit']);_0x4c318b[_0xb0a7('0x24')]=qs[_0xb0a7('0x24')](_0x236a8f['query'][_0xb0a7('0x24')]);}_0x4c318b[_0xb0a7('0x43')]=qs[_0xb0a7('0x44')](_0x236a8f['query']['sort']);_0x4c318b[_0xb0a7('0x45')]=qs[_0xb0a7('0x3c')](_[_0xb0a7('0x46')](_0x236a8f[_0xb0a7('0x3a')],_0x1b3e0a[_0xb0a7('0x3c')]),_0x1750c5);if(_0x236a8f[_0xb0a7('0x3a')][_0xb0a7('0x47')]){_0x4c318b['where']=_['merge'](_0x4c318b[_0xb0a7('0x45')],{'$or':_['map'](_0x1750c5,function(_0x52d46e){if(_0x52d46e[_0xb0a7('0x38')]!==_0xb0a7('0x48')){var _0x40ef0f={};_0x40ef0f[_0x52d46e['name']]={'$like':'%'+_0x236a8f['query'][_0xb0a7('0x47')]+'%'};return _0x40ef0f;}})});}_0x4c318b=_[_0xb0a7('0x49')]({},_0x4c318b,_0x236a8f['options']);var _0x35afa7={'where':_0x4c318b[_0xb0a7('0x45')]};return db[_0xb0a7('0x35')][_0xb0a7('0x27')](_0x35afa7)[_0xb0a7('0x2e')](function(_0x2b3543){_0x5f0a6a['count']=_0x2b3543;if(_0x236a8f[_0xb0a7('0x3a')][_0xb0a7('0x4a')]){_0x4c318b[_0xb0a7('0x4b')]=[{'all':!![]}];}return db['Team'][_0xb0a7('0x4c')](_0x4c318b);})[_0xb0a7('0x2e')](function(_0x398105){_0x5f0a6a[_0xb0a7('0x4d')]=_0x398105;return _0x5f0a6a;})[_0xb0a7('0x2e')](respondWithFilteredResult(_0x12b94a,_0x4c318b))['catch'](handleError(_0x12b94a,null));};exports[_0xb0a7('0x4e')]=function(_0x122551,_0x29b8a0){var _0x2da5d5={'raw':![],'where':{'id':_0x122551[_0xb0a7('0x4f')]['id']}},_0x4eb2c2={};_0x4eb2c2['model']=_[_0xb0a7('0x3b')](db[_0xb0a7('0x35')][_0xb0a7('0x36')]);_0x4eb2c2[_0xb0a7('0x3a')]=_[_0xb0a7('0x3b')](_0x122551[_0xb0a7('0x3a')]);_0x4eb2c2['filters']=_[_0xb0a7('0x3d')](_0x4eb2c2[_0xb0a7('0x3e')],_0x4eb2c2['query']);_0x2da5d5[_0xb0a7('0x3f')]=_[_0xb0a7('0x3d')](_0x4eb2c2[_0xb0a7('0x3e')],qs[_0xb0a7('0x40')](_0x122551['query'][_0xb0a7('0x40')]));_0x2da5d5['attributes']=_0x2da5d5[_0xb0a7('0x3f')][_0xb0a7('0x41')]?_0x2da5d5[_0xb0a7('0x3f')]:_0x4eb2c2[_0xb0a7('0x3e')];if(_0x122551[_0xb0a7('0x3a')][_0xb0a7('0x4a')]){_0x2da5d5[_0xb0a7('0x4b')]=[{'all':!![]}];}_0x2da5d5=_[_0xb0a7('0x49')]({},_0x2da5d5,_0x122551['options']);return db['Team'][_0xb0a7('0x50')](_0x2da5d5)['then'](handleEntityNotFound(_0x29b8a0,null))['then'](respondWithResult(_0x29b8a0,null))[_0xb0a7('0x51')](handleError(_0x29b8a0,null));};exports[_0xb0a7('0x52')]=function(_0x28f17e,_0x4ea6ed){return db[_0xb0a7('0x35')]['create'](_0x28f17e[_0xb0a7('0x53')],{})[_0xb0a7('0x2e')](function(_0x1e6afd){var _0x1042e0=_0x28f17e[_0xb0a7('0x54')][_0xb0a7('0x55')]({'plain':!![]});if(!_0x1042e0)throw new Error(_0xb0a7('0x56'));if(_0x1042e0[_0xb0a7('0x57')]==='user'){var _0x7c81de=_0x1e6afd[_0xb0a7('0x55')]({'plain':!![]});var _0x4f4723=_0xb0a7('0x58');return db[_0xb0a7('0x59')][_0xb0a7('0x50')]({'where':{'name':_0x4f4723,'userProfileId':_0x1042e0[_0xb0a7('0x5a')]},'raw':!![]})['then'](function(_0x366173){if(_0x366173&&_0x366173[_0xb0a7('0x5b')]===0x0){return db['UserProfileResource'][_0xb0a7('0x52')]({'name':_0x7c81de[_0xb0a7('0x31')],'resourceId':_0x7c81de['id'],'type':_0x366173[_0xb0a7('0x31')],'sectionId':_0x366173['id']},{})[_0xb0a7('0x2e')](function(){return _0x1e6afd;});}else{return _0x1e6afd;}})[_0xb0a7('0x51')](function(_0xa307a4){logger[_0xb0a7('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa307a4);throw _0xa307a4;});}return _0x1e6afd;})[_0xb0a7('0x2e')](respondWithResult(_0x4ea6ed,0xc9))['catch'](handleError(_0x4ea6ed,null));};exports[_0xb0a7('0x2d')]=function(_0x5ae963,_0x3733af){if(_0x5ae963['body']['id']){delete _0x5ae963[_0xb0a7('0x53')]['id'];}return db[_0xb0a7('0x35')]['find']({'where':{'id':_0x5ae963['params']['id']}})[_0xb0a7('0x2e')](handleEntityNotFound(_0x3733af,null))[_0xb0a7('0x2e')](saveUpdates(_0x5ae963[_0xb0a7('0x53')],null))[_0xb0a7('0x2e')](respondWithResult(_0x3733af,null))['catch'](handleError(_0x3733af,null));};exports[_0xb0a7('0x5c')]=function(_0x964650,_0x5ce591){var _0xd81336=_0x964650['params']['id'];var _0x183455=[];return db[_0xb0a7('0x5d')][_0xb0a7('0x5e')](function(_0x1d2ef4){var _0x1f39c2=_0xb0a7('0x5f')+_0xd81336;return db[_0xb0a7('0x5d')][_0xb0a7('0x3a')](_0x1f39c2,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')]['SELECT'],'raw':!![],'transaction':_0x1d2ef4})[_0xb0a7('0x2e')](function(_0x32c7d0){_0x183455=_['map'](_0x32c7d0,function(_0x4e4200){return Number(_0x4e4200['UserId']);});})[_0xb0a7('0x2e')](function(){var _0x7d9751='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd81336;return db[_0xb0a7('0x5d')][_0xb0a7('0x3a')](_0x7d9751,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0xff8694){var _0x3da64f=_[_0xb0a7('0x34')](_0xff8694,function(_0x161e0c){return Number(_0x161e0c['VoiceQueueId']);});return db[_0xb0a7('0x63')]['destroy']({'where':{'UserId':{'$in':_0x183455},'VoiceQueueId':{'$in':_0x3da64f}},'transaction':_0x1d2ef4});})['then'](function(){var _0x239907='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd81336;return db[_0xb0a7('0x5d')]['query'](_0x239907,{'type':db[_0xb0a7('0x60')]['QueryTypes'][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x26f4ac){var _0x5a8976=_[_0xb0a7('0x34')](_0x26f4ac,function(_0x1b07d8){return Number(_0x1b07d8[_0xb0a7('0x64')]);});return db[_0xb0a7('0x65')][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'MailQueueId':{'$in':_0x5a8976}},'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(){var _0x5b410d=_0xb0a7('0x66')+_0xd81336;return db[_0xb0a7('0x5d')][_0xb0a7('0x3a')](_0x5b410d,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x204d9a){var _0x50a341=_[_0xb0a7('0x34')](_0x204d9a,function(_0x526a24){return Number(_0x526a24['SmsQueueId']);});return db['UserSmsQueue'][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'SmsQueueId':{'$in':_0x50a341}},'transaction':_0x1d2ef4});})['then'](function(){var _0x56edc6=_0xb0a7('0x67')+_0xd81336;return db['sequelize']['query'](_0x56edc6,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x2f2faa){var _0x5e60c7=_[_0xb0a7('0x34')](_0x2f2faa,function(_0x1a2750){return Number(_0x1a2750[_0xb0a7('0x68')]);});return db[_0xb0a7('0x69')][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'ChatQueueId':{'$in':_0x5e60c7}},'transaction':_0x1d2ef4});})['then'](function(){var _0x26d745='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd81336;return db[_0xb0a7('0x5d')]['query'](_0x26d745,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})['then'](function(_0x8c0a0b){var _0x5cf6a2=_[_0xb0a7('0x34')](_0x8c0a0b,function(_0x11db56){return Number(_0x11db56[_0xb0a7('0x6a')]);});return db[_0xb0a7('0x6b')][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'FaxQueueId':{'$in':_0x5cf6a2}},'transaction':_0x1d2ef4});})['then'](function(){var _0x45f6f0='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd81336;return db[_0xb0a7('0x5d')][_0xb0a7('0x3a')](_0x45f6f0,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x2c7a2e){var _0x1ad856=_[_0xb0a7('0x34')](_0x2c7a2e,function(_0x2f8dd2){return Number(_0x2f8dd2['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'OpenchannelQueueId':{'$in':_0x1ad856}},'transaction':_0x1d2ef4});})['then'](function(){var _0xa049df='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd81336;return db[_0xb0a7('0x5d')][_0xb0a7('0x3a')](_0xa049df,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x5041f5){var _0x24d6a2=_[_0xb0a7('0x34')](_0x5041f5,function(_0x52c83d){return Number(_0x52c83d[_0xb0a7('0x6c')]);});return db[_0xb0a7('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x183455},'WhatsappQueueId':{'$in':_0x24d6a2}},'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(){return db[_0xb0a7('0x6e')][_0xb0a7('0x50')]({'where':{'TeamId':_0xd81336}});})[_0xb0a7('0x2e')](function(_0xb60037){if(_0xb60037===null){return;}return db['UserVoicePrefix'][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'VoicePrefixId':_0xb60037[_0xb0a7('0x6f')]},'transaction':_0x1d2ef4});})['then'](function(){return db[_0xb0a7('0x35')]['destroy']({'where':{'id':_0xd81336},'cascade':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x3766dc){if(_0x3766dc===0x0){_0x5ce591[_0xb0a7('0x21')](0x194);}else{return db[_0xb0a7('0x70')]['destroy']({'where':{'type':_0xb0a7('0x58'),'resourceId':_0xd81336},'cascade':!![],'transaction':_0x1d2ef4})[_0xb0a7('0x2e')](function(){_0x5ce591[_0xb0a7('0x28')](0xcc)[_0xb0a7('0x22')]();});}})[_0xb0a7('0x51')](function(_0x17072a){_0x5ce591[_0xb0a7('0x28')](0x1f4)[_0xb0a7('0x32')](_0x17072a);});});};exports[_0xb0a7('0x71')]=function(_0x5eed8f,_0x5aeb52,_0x1a547d){return db[_0xb0a7('0x35')][_0xb0a7('0x72')]({'where':{'id':_0x5eed8f['params']['id']}})[_0xb0a7('0x2e')](handleEntityNotFound(_0x5aeb52,null))[_0xb0a7('0x2e')](function(_0x59c467){if(!_0x5eed8f[_0xb0a7('0x3a')]['channel']||!utils[_0xb0a7('0x73')](_0x5eed8f[_0xb0a7('0x3a')][_0xb0a7('0x74')])){throw new db[(_0xb0a7('0x60'))][(_0xb0a7('0x75'))](_0xb0a7('0x76'));}var _0x1d1393={};var _0x19db63={};_0x19db63[_0xb0a7('0x3e')]=_[_0xb0a7('0x3b')](db[_[_0xb0a7('0x77')](_0x5eed8f[_0xb0a7('0x3a')]['channel'][_0xb0a7('0x78')]())+_0xb0a7('0x79')][_0xb0a7('0x36')]);_0x19db63[_0xb0a7('0x3a')]=_['keys'](_0x5eed8f[_0xb0a7('0x3a')]);_0x19db63[_0xb0a7('0x3c')]=_['intersection'](_0x19db63[_0xb0a7('0x3e')],_0x19db63['query']);_0x1d1393[_0xb0a7('0x3f')]=_[_0xb0a7('0x3d')](_0x19db63[_0xb0a7('0x3e')],qs[_0xb0a7('0x40')](_0x5eed8f[_0xb0a7('0x3a')][_0xb0a7('0x40')]));_0x1d1393[_0xb0a7('0x3f')]=_0x1d1393['attributes'][_0xb0a7('0x41')]?_0x1d1393[_0xb0a7('0x3f')]:_0x19db63[_0xb0a7('0x3e')];_0x1d1393['limit']=qs[_0xb0a7('0x26')](_0x5eed8f[_0xb0a7('0x3a')]['limit']);_0x1d1393[_0xb0a7('0x24')]=qs['offset'](_0x5eed8f[_0xb0a7('0x3a')][_0xb0a7('0x24')]);_0x1d1393[_0xb0a7('0x43')]=qs[_0xb0a7('0x44')](_0x5eed8f[_0xb0a7('0x3a')][_0xb0a7('0x44')]);_0x1d1393[_0xb0a7('0x45')]=qs[_0xb0a7('0x3c')](_['pick'](_0x5eed8f['query'],_0x19db63[_0xb0a7('0x3c')]));_0x1d1393=_[_0xb0a7('0x49')]({},_0x1d1393,_0x5eed8f[_0xb0a7('0x7a')]);return _0x59c467[_0xb0a7('0x55')+_['capitalize'](_0x5eed8f[_0xb0a7('0x3a')][_0xb0a7('0x74')][_0xb0a7('0x78')]())+_0xb0a7('0x7b')](_0x1d1393);})['then'](respondWithResult(_0x5aeb52,null))['catch'](handleError(_0x5aeb52,null));};exports['addQueues']=function(_0x99ab8f,_0x550781,_0x360b13){return db[_0xb0a7('0x35')][_0xb0a7('0x72')]({'where':{'id':_0x99ab8f[_0xb0a7('0x4f')]['id']}})['then'](function(_0x392c0d){if(_0x392c0d){if(!_0x99ab8f[_0xb0a7('0x53')][_0xb0a7('0x74')]||!utils['isValidChannel'](_0x99ab8f[_0xb0a7('0x53')][_0xb0a7('0x74')])){throw new db[(_0xb0a7('0x60'))][(_0xb0a7('0x75'))](_0xb0a7('0x76'));}return _0x392c0d[_0xb0a7('0x7c')+_[_0xb0a7('0x77')](_0x99ab8f[_0xb0a7('0x53')][_0xb0a7('0x74')][_0xb0a7('0x78')]())+_0xb0a7('0x7b')](_0x99ab8f[_0xb0a7('0x53')][_0xb0a7('0x7d')]);}return null;})[_0xb0a7('0x2e')](handleEntityNotFound(_0x550781,null))[_0xb0a7('0x2e')](respondWithStatusCode(_0x550781,null))[_0xb0a7('0x51')](handleError(_0x550781,null));};exports['removeQueues']=function(_0x4adc01,_0x1132af,_0x3c1d30){return db[_0xb0a7('0x35')][_0xb0a7('0x72')]({'where':{'id':_0x4adc01['params']['id']}})[_0xb0a7('0x2e')](function(_0x69b1b2){if(_0x69b1b2){if(!_0x4adc01[_0xb0a7('0x3a')][_0xb0a7('0x74')]||!utils[_0xb0a7('0x73')](_0x4adc01[_0xb0a7('0x3a')]['channel'])){throw new db[(_0xb0a7('0x60'))][(_0xb0a7('0x75'))](_0xb0a7('0x76'));}return _0x69b1b2[_0xb0a7('0x7e')+_[_0xb0a7('0x77')](_0x4adc01['query'][_0xb0a7('0x74')]['toLowerCase']())+_0xb0a7('0x7b')](_0x4adc01['query'][_0xb0a7('0x7d')]);}return null;})[_0xb0a7('0x2e')](handleEntityNotFound(_0x1132af,null))[_0xb0a7('0x2e')](respondWithStatusCode(_0x1132af,null))['catch'](handleError(_0x1132af,null));};exports['addAgents']=function(_0x168c86,_0x34d401){var _0x3e909f=_[_0xb0a7('0x7f')](_0x168c86[_0xb0a7('0x53')][_0xb0a7('0x7d')])?_0x168c86[_0xb0a7('0x53')]['ids']:[_0x168c86['body'][_0xb0a7('0x7d')]];var _0x31f68a=_0x168c86[_0xb0a7('0x4f')]['id'];return db[_0xb0a7('0x35')][_0xb0a7('0x50')]({'where':{'id':_0x31f68a}})['then'](handleEntityNotFound(_0x34d401,null))[_0xb0a7('0x2e')](function(_0x13a537){if(_0x13a537){var _0x257b27=['Voice',_0xb0a7('0x80'),_0xb0a7('0x81'),_0xb0a7('0x82'),_0xb0a7('0x83'),_0xb0a7('0x84'),_0xb0a7('0x85')];return db[_0xb0a7('0x5d')][_0xb0a7('0x5e')](function(_0x1e6d64){var _0x45c855=_['map'](_0x257b27,function(_0x27fcf8){var _0x363789={'attributes':['id',_0xb0a7('0x31')]};if(_0x27fcf8===_0xb0a7('0x86')){_0x363789[_0xb0a7('0x87')]={'attributes':[_0xb0a7('0x88')]};}return _0x13a537[_0xb0a7('0x55')+_0x27fcf8+_0xb0a7('0x7b')](_0x363789)['then'](function(_0x3b2f86){var _0x3cbcc8=_[_0xb0a7('0x34')](_0x3b2f86,function(_0x16329d){var _0x571f19=_[_0xb0a7('0x34')](_0x3e909f,function(_0x1ba197){var _0x14ff66={'where':{'UserId':_0x1ba197,[_0x27fcf8+_0xb0a7('0x89')]:_0x16329d['id']},'transaction':_0x1e6d64};if(_0x27fcf8===_0xb0a7('0x86')){_0x14ff66[_0xb0a7('0x1d')]={'penalty':_0x16329d[_0xb0a7('0x8a')][_0xb0a7('0x88')]};}return db[_0xb0a7('0x8b')+_0x27fcf8+_0xb0a7('0x79')][_0xb0a7('0x8c')](_0x14ff66)[_0xb0a7('0x2e')](function(){socket['emit'](_0xb0a7('0x54')+_0x27fcf8+_0xb0a7('0x8d'),{'UserId':_0x1ba197,[_0x27fcf8+'QueueId']:_0x16329d['id']});if(_0x27fcf8!=='Voice'){return;}return db[_0xb0a7('0x8b')][_0xb0a7('0x4c')]({'where':{'id':_0x3e909f,'online':0x1},'attributes':['id',_0xb0a7('0x31'),_0xb0a7('0x8e'),_0xb0a7('0x8f'),_0xb0a7('0x90')],'raw':!![]})[_0xb0a7('0x2e')](function(_0x2fe09f){var _0x1149da=_[_0xb0a7('0x34')](_0x2fe09f,function(_0x57c87f){return db[_0xb0a7('0x91')][_0xb0a7('0x92')]({'membername':_0x57c87f['name'],'UserId':_0x57c87f['id'],'queue_name':_0x16329d['name'],'VoiceQueueId':_0x16329d['id'],'interface':_['isNil'](_0x57c87f[_0xb0a7('0x90')])?util[_0xb0a7('0x93')](_0xb0a7('0x94'),_0x57c87f[_0xb0a7('0x31')]):_0x57c87f[_0xb0a7('0x90')],'paused':_0x57c87f[_0xb0a7('0x8f')]||![],'penalty':_0x16329d[_0xb0a7('0x8a')][_0xb0a7('0x88')]},{'transaction':_0x1e6d64});});return Promise[_0xb0a7('0x95')](_0x1149da);});});});return Promise[_0xb0a7('0x95')](_0x571f19);});return Promise[_0xb0a7('0x95')](_0x3cbcc8);})['then'](function(){return db[_0xb0a7('0x6e')][_0xb0a7('0x72')]({'where':{'teamId':_0x31f68a}})['then'](function(_0x2f780e){if(_0x2f780e){var _0x1c4603=_['map'](_0x3e909f,function(_0x231054){db[_0xb0a7('0x96')]['upsert']({'UserId':_0x231054,'VoicePrefixId':_0x2f780e[_0xb0a7('0x6f')]});});return Promise[_0xb0a7('0x95')](_0x1c4603);}});});});return Promise[_0xb0a7('0x95')](_0x45c855)['then'](function(){return _0x13a537[_0xb0a7('0x97')](_0x3e909f,{'transaction':_0x1e6d64})[_0xb0a7('0x98')](function(_0x16d7fb){return _0x16d7fb;});});});}})[_0xb0a7('0x2e')](respondWithResult(_0x34d401,null))[_0xb0a7('0x51')](handleError(_0x34d401,null));};exports[_0xb0a7('0x99')]=function(_0x54b99e,_0x2fdbfc){var _0x1564fc=_[_0xb0a7('0x7f')](_0x54b99e[_0xb0a7('0x3a')][_0xb0a7('0x7d')])?_0x54b99e[_0xb0a7('0x3a')][_0xb0a7('0x7d')]:[_0x54b99e[_0xb0a7('0x3a')][_0xb0a7('0x7d')]];var _0x551f97=_0x54b99e[_0xb0a7('0x4f')]['id'];return db[_0xb0a7('0x35')][_0xb0a7('0x50')]({'where':{'id':_0x551f97}})[_0xb0a7('0x2e')](handleEntityNotFound(_0x2fdbfc,null))[_0xb0a7('0x2e')](function(_0x1ee60b){if(_0x1ee60b){var _0x262226=['Voice',_0xb0a7('0x80'),_0xb0a7('0x81'),_0xb0a7('0x82'),_0xb0a7('0x83'),_0xb0a7('0x84'),'Whatsapp'];return db['sequelize'][_0xb0a7('0x5e')](function(_0x31bfc3){var _0x3bae43=_[_0xb0a7('0x34')](_0x262226,function(_0x48654b){var _0x5d9f18={'attributes':['id','name']};return _0x1ee60b[_0xb0a7('0x55')+_0x48654b+_0xb0a7('0x7b')](_0x5d9f18)[_0xb0a7('0x2e')](function(_0x3b9896){var _0x14b68c=_[_0xb0a7('0x34')](_0x3b9896,function(_0x5ff154){return _0x5ff154[_0xb0a7('0x99')](_0x1564fc,{'transaction':_0x31bfc3})[_0xb0a7('0x2e')](function(){var _0x22b43f=_[_0xb0a7('0x34')](_0x1564fc,function(_0x3313d8){socket[_0xb0a7('0x9a')]('user'+_0x48654b+_0xb0a7('0x9b'),{'UserId':Number(_0x3313d8),[_0x48654b+_0xb0a7('0x89')]:_0x5ff154['id']});if(_0x48654b!==_0xb0a7('0x86')){return;}return db['UserVoiceQueueRt'][_0xb0a7('0x5c')]({'where':{'VoiceQueueId':_0x5ff154['id'],'UserId':_0x3313d8},'transaction':_0x31bfc3});});return Promise[_0xb0a7('0x95')](_0x22b43f);});});return Promise[_0xb0a7('0x95')](_0x14b68c);});});return Promise['all'](_0x3bae43)[_0xb0a7('0x2e')](function(){return _0x1ee60b[_0xb0a7('0x99')](_0x1564fc,{'transaction':_0x31bfc3});})[_0xb0a7('0x2e')](function(){return db['TeamVoicePrefix'][_0xb0a7('0x72')]({'where':{'teamId':_0x551f97}})['then'](function(_0x270c67){if(_0x270c67){var _0x46a665=_[_0xb0a7('0x34')](_0x1564fc,function(_0x2b3521){db[_0xb0a7('0x96')][_0xb0a7('0x5c')]({'where':{'UserId':_0x2b3521,'VoicePrefixId':_0x270c67[_0xb0a7('0x6f')]}});});return Promise[_0xb0a7('0x95')](_0x46a665);}});});});}})[_0xb0a7('0x2e')](respondWithStatusCode(_0x2fdbfc,null))[_0xb0a7('0x51')](handleError(_0x2fdbfc,null));};exports[_0xb0a7('0x9c')]=function(_0x111395,_0x16ac68,_0x4004ff){var _0xdc86ed={};var _0x3aa88d={};var _0x12f401;var _0x2646fe;return db[_0xb0a7('0x35')][_0xb0a7('0x72')]({'where':{'id':_0x111395[_0xb0a7('0x4f')]['id']}})[_0xb0a7('0x2e')](handleEntityNotFound(_0x16ac68,null))['then'](function(_0x46b19c){if(_0x46b19c){_0x12f401=_0x46b19c;_0x3aa88d[_0xb0a7('0x3e')]=_[_0xb0a7('0x3b')](db[_0xb0a7('0x8b')][_0xb0a7('0x36')]);_0x3aa88d[_0xb0a7('0x3a')]=_[_0xb0a7('0x3b')](_0x111395['query']);_0x3aa88d[_0xb0a7('0x3c')]=_[_0xb0a7('0x3d')](_0x3aa88d[_0xb0a7('0x3e')],_0x3aa88d[_0xb0a7('0x3a')]);_0xdc86ed[_0xb0a7('0x3f')]=_['intersection'](_0x3aa88d['model'],qs[_0xb0a7('0x40')](_0x111395[_0xb0a7('0x3a')][_0xb0a7('0x40')]));_0xdc86ed[_0xb0a7('0x3f')]=_0xdc86ed[_0xb0a7('0x3f')][_0xb0a7('0x41')]?_0xdc86ed[_0xb0a7('0x3f')]:_0x3aa88d[_0xb0a7('0x3e')];_0xdc86ed['order']=qs[_0xb0a7('0x44')](_0x111395[_0xb0a7('0x3a')]['sort']);_0xdc86ed['where']=qs[_0xb0a7('0x3c')](_[_0xb0a7('0x46')](_0x111395[_0xb0a7('0x3a')],_0x3aa88d['filters']));if(_0x111395[_0xb0a7('0x3a')][_0xb0a7('0x47')]){_0xdc86ed[_0xb0a7('0x45')]=_[_0xb0a7('0x49')](_0xdc86ed[_0xb0a7('0x45')],{'$or':_[_0xb0a7('0x34')](_0xdc86ed[_0xb0a7('0x3f')],function(_0x182157){var _0x504f6c={};_0x504f6c[_0x182157]={'$like':'%'+_0x111395[_0xb0a7('0x3a')]['filter']+'%'};return _0x504f6c;})});}_0xdc86ed=_[_0xb0a7('0x49')]({},_0xdc86ed,_0x111395['options']);return _0x12f401[_0xb0a7('0x9c')](_0xdc86ed);}})['then'](function(_0x26a6c4){if(_0x26a6c4){_0x2646fe=_0x26a6c4[_0xb0a7('0x41')];if(!_0x111395['query'][_0xb0a7('0x42')]('nolimit')){_0xdc86ed[_0xb0a7('0x26')]=qs[_0xb0a7('0x26')](_0x111395['query'][_0xb0a7('0x26')]);_0xdc86ed[_0xb0a7('0x24')]=qs['offset'](_0x111395['query'][_0xb0a7('0x24')]);}return _0x12f401['getAgents'](_0xdc86ed);}})[_0xb0a7('0x2e')](function(_0x3b941b){if(_0x3b941b){return _0x3b941b?{'count':_0x2646fe,'rows':_0x3b941b}:null;}})[_0xb0a7('0x2e')](respondWithResult(_0x16ac68,null))[_0xb0a7('0x51')](handleError(_0x16ac68,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f1f0d5c..f8bf706 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 _0x0a1f=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x0a1f,0x17a));var _0xf0a1=function(_0x62661c,_0x117404){_0x62661c=_0x62661c-0x0;var _0x133b23=_0x0a1f[_0x62661c];return _0x133b23;};'use strict';var EventEmitter=require(_0xf0a1('0x0'));var Team=require(_0xf0a1('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xf0a1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf0a1('0x3'),'afterDestroy':_0xf0a1('0x4')};function emitEvent(_0x1b57df){return function(_0x4ce803,_0x36923b,_0x5b1584){TeamEvents['emit'](_0x1b57df+':'+_0x4ce803['id'],_0x4ce803);TeamEvents[_0xf0a1('0x5')](_0x1b57df,_0x4ce803);_0x5b1584(null);};}for(var e in events){if(events[_0xf0a1('0x6')](e)){var event=events[e];Team[_0xf0a1('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x13ac=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4f1c05,_0x4cdf88){var _0x530236=function(_0x358e60){while(--_0x358e60){_0x4f1c05['push'](_0x4f1c05['shift']());}};_0x530236(++_0x4cdf88);}(_0x13ac,0x1b7));var _0xc13a=function(_0x297bc0,_0x434196){_0x297bc0=_0x297bc0-0x0;var _0x3f8df9=_0x13ac[_0x297bc0];return _0x3f8df9;};'use strict';var EventEmitter=require(_0xc13a('0x0'));var Team=require(_0xc13a('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xc13a('0x2')](0x0);var events={'afterCreate':_0xc13a('0x3'),'afterUpdate':_0xc13a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x599735){return function(_0x5b4cf8,_0x4949d9,_0x58a49d){TeamEvents['emit'](_0x599735+':'+_0x5b4cf8['id'],_0x5b4cf8);TeamEvents[_0xc13a('0x5')](_0x599735,_0x5b4cf8);_0x58a49d(null);};}for(var e in events){if(events[_0xc13a('0x6')](e)){var event=events[e];Team[_0xc13a('0x7')](e,emitEvent(event));}}module[_0xc13a('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 03666b0..89e1163 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 _0x592c=['then','map','setDataValue','catch','exports','define','Team','Chat','Openchannel','Sms','Voice','Whatsapp','all','lodash','./team.attributes','get','Queues'];(function(_0x2c904b,_0x6a3fe8){var _0x53df34=function(_0x51e100){while(--_0x51e100){_0x2c904b['push'](_0x2c904b['shift']());}};_0x53df34(++_0x6a3fe8);}(_0x592c,0xc8));var _0xc592=function(_0x14328f,_0x396cf7){_0x14328f=_0x14328f-0x0;var _0x53aaab=_0x592c[_0x14328f];return _0x53aaab;};'use strict';var _=require(_0xc592('0x0'));var attributes=require(_0xc592('0x1'));function getQueuesByChannel(_0x5aeb15,_0x415d58){var _0x3c1111=_0xc592('0x2')+_0x415d58+_0xc592('0x3');return _0x5aeb15[_0x3c1111]()[_0xc592('0x4')](function(_0x308c95){return _[_0xc592('0x5')](_0x308c95,function(_0x2690df){_0x2690df[_0xc592('0x6')]('channel',_0x415d58);return _0x2690df;});})[_0xc592('0x7')](function(_0xffd9fa){throw _0xffd9fa;});}module[_0xc592('0x8')]=function(_0x58be38){return _0x58be38[_0xc592('0x9')](_0xc592('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3c1f58=this;var _0x13202f=[_0xc592('0xb'),'Fax','Mail',_0xc592('0xc'),_0xc592('0xd'),_0xc592('0xe'),_0xc592('0xf')];return Promise['resolve']()['then'](function(){var _0x14f6c6=_[_0xc592('0x5')](_0x13202f,function(_0x26baeb){return getQueuesByChannel(_0x3c1f58,_0x26baeb);});return Promise[_0xc592('0x10')](_0x14f6c6);})[_0xc592('0x7')](function(_0x24f67d){throw _0x24f67d;});}}});}; \ No newline at end of file +var _0xc685=['get','Queues','then','map','setDataValue','channel','define','Team','Chat','Mail','Openchannel','Sms','Voice','Whatsapp','all','./team.attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc685,0x11f));var _0x5c68=function(_0x5261da,_0xb5fe00){_0x5261da=_0x5261da-0x0;var _0x4392fc=_0xc685[_0x5261da];return _0x4392fc;};'use strict';var _=require('lodash');var attributes=require(_0x5c68('0x0'));function getQueuesByChannel(_0x587446,_0x552861){var _0x562701=_0x5c68('0x1')+_0x552861+_0x5c68('0x2');return _0x587446[_0x562701]()[_0x5c68('0x3')](function(_0x478efd){return _[_0x5c68('0x4')](_0x478efd,function(_0x2ee2dd){_0x2ee2dd[_0x5c68('0x5')](_0x5c68('0x6'),_0x552861);return _0x2ee2dd;});})['catch'](function(_0x3371f6){throw _0x3371f6;});}module['exports']=function(_0x2df52f){return _0x2df52f[_0x5c68('0x7')](_0x5c68('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x20924a=this;var _0x35bcfe=[_0x5c68('0x9'),'Fax',_0x5c68('0xa'),_0x5c68('0xb'),_0x5c68('0xc'),_0x5c68('0xd'),_0x5c68('0xe')];return Promise['resolve']()[_0x5c68('0x3')](function(){var _0x1607bd=_['map'](_0x35bcfe,function(_0x5a04f8){return getQueuesByChannel(_0x20924a,_0x5a04f8);});return Promise[_0x5c68('0xf')](_0x1607bd);})['catch'](function(_0x4df5b1){throw _0x4df5b1;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 38ba741..728ee70 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 _0x0a7e=['../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x13faf4,_0x596f03){var _0x583098=function(_0x41878d){while(--_0x41878d){_0x13faf4['push'](_0x13faf4['shift']());}};_0x583098(++_0x596f03);}(_0x0a7e,0x13e));var _0xe0a7=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0a7e[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xe0a7('0x0'));var util=require(_0xe0a7('0x1'));var moment=require(_0xe0a7('0x2'));var BPromise=require('bluebird');var rs=require(_0xe0a7('0x3'));var fs=require('fs');var Redis=require(_0xe0a7('0x4'));var db=require(_0xe0a7('0x5'))['db'];var utils=require(_0xe0a7('0x6'));var logger=require(_0xe0a7('0x7'))('rpc');var config=require(_0xe0a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe0a7('0x9')][_0xe0a7('0xa')]({'port':0x232a});config[_0xe0a7('0xb')]=_['defaults'](config['redis'],{'host':_0xe0a7('0xc'),'port':0x18eb});var socket=require(_0xe0a7('0xd'))(new Redis(config['redis']));require('./team.socket')[_0xe0a7('0xe')](socket);function respondWithRpcPromise(_0x4587bc,_0xd244d7,_0x4a7bc5){return new BPromise(function(_0x4b5ddf,_0x5c58a6){return client[_0xe0a7('0xf')](_0x4587bc,_0x4a7bc5)[_0xe0a7('0x10')](function(_0x391d14){logger[_0xe0a7('0x11')](_0xe0a7('0x12'),_0xd244d7,_0xe0a7('0x13'));logger[_0xe0a7('0x14')](_0xe0a7('0x15'),_0xd244d7,'request\x20sent',JSON[_0xe0a7('0x16')](_0x391d14));if(_0x391d14[_0xe0a7('0x17')]){if(_0x391d14[_0xe0a7('0x17')][_0xe0a7('0x18')]===0x1f4){logger[_0xe0a7('0x17')](_0xe0a7('0x12'),_0xd244d7,_0x391d14['error'][_0xe0a7('0x19')]);return _0x5c58a6(_0x391d14[_0xe0a7('0x17')][_0xe0a7('0x19')]);}logger[_0xe0a7('0x17')](_0xe0a7('0x12'),_0xd244d7,_0x391d14['error'][_0xe0a7('0x19')]);return _0x4b5ddf(_0x391d14['error'][_0xe0a7('0x19')]);}else{logger[_0xe0a7('0x11')](_0xe0a7('0x12'),_0xd244d7,'request\x20sent');_0x4b5ddf(_0x391d14[_0xe0a7('0x1a')][_0xe0a7('0x19')]);}})['catch'](function(_0x33023c){logger[_0xe0a7('0x17')](_0xe0a7('0x12'),_0xd244d7,_0x33023c);_0x5c58a6(_0x33023c);});});} \ No newline at end of file +var _0x99f8=['../../config/environment','jayson/promise','client','http','redis','defaults','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5e12e7,_0x58bf03){var _0x27c046=function(_0x579501){while(--_0x579501){_0x5e12e7['push'](_0x5e12e7['shift']());}};_0x27c046(++_0x58bf03);}(_0x99f8,0x146));var _0x899f=function(_0x5a57bf,_0x39f906){_0x5a57bf=_0x5a57bf-0x0;var _0x6a6949=_0x99f8[_0x5a57bf];return _0x6a6949;};'use strict';var _=require(_0x899f('0x0'));var util=require(_0x899f('0x1'));var moment=require(_0x899f('0x2'));var BPromise=require(_0x899f('0x3'));var rs=require(_0x899f('0x4'));var fs=require('fs');var Redis=require(_0x899f('0x5'));var db=require(_0x899f('0x6'))['db'];var utils=require(_0x899f('0x7'));var logger=require(_0x899f('0x8'))(_0x899f('0x9'));var config=require(_0x899f('0xa'));var jayson=require(_0x899f('0xb'));var client=jayson[_0x899f('0xc')][_0x899f('0xd')]({'port':0x232a});config[_0x899f('0xe')]=_[_0x899f('0xf')](config[_0x899f('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x899f('0xe')]));require(_0x899f('0x10'))[_0x899f('0x11')](socket);function respondWithRpcPromise(_0x56f5ca,_0x46eb75,_0x1474de){return new BPromise(function(_0x253870,_0x589746){return client['request'](_0x56f5ca,_0x1474de)[_0x899f('0x12')](function(_0x5259d6){logger[_0x899f('0x13')](_0x899f('0x14'),_0x46eb75,_0x899f('0x15'));logger['debug'](_0x899f('0x16'),_0x46eb75,_0x899f('0x15'),JSON['stringify'](_0x5259d6));if(_0x5259d6[_0x899f('0x17')]){if(_0x5259d6['error'][_0x899f('0x18')]===0x1f4){logger[_0x899f('0x17')](_0x899f('0x14'),_0x46eb75,_0x5259d6[_0x899f('0x17')]['message']);return _0x589746(_0x5259d6['error']['message']);}logger['error'](_0x899f('0x14'),_0x46eb75,_0x5259d6[_0x899f('0x17')][_0x899f('0x19')]);return _0x253870(_0x5259d6[_0x899f('0x17')][_0x899f('0x19')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x46eb75,'request\x20sent');_0x253870(_0x5259d6[_0x899f('0x1a')][_0x899f('0x19')]);}})[_0x899f('0x1b')](function(_0x51936c){logger['error'](_0x899f('0x14'),_0x46eb75,_0x51936c);_0x589746(_0x51936c);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e9a0f0c..92aa4b8 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 _0x7428=['./team.events','save','update','emit','removeListener','register','length'];(function(_0x5281c1,_0x28715a){var _0x5c89b7=function(_0x23cfd7){while(--_0x23cfd7){_0x5281c1['push'](_0x5281c1['shift']());}};_0x5c89b7(++_0x28715a);}(_0x7428,0xfc));var _0x8742=function(_0x51aa9d,_0x397b32){_0x51aa9d=_0x51aa9d-0x0;var _0x20b163=_0x7428[_0x51aa9d];return _0x20b163;};'use strict';var TeamEvents=require(_0x8742('0x0'));var events=[_0x8742('0x1'),'remove',_0x8742('0x2')];function createListener(_0x474c46,_0x13de9f){return function(_0x27a773){_0x13de9f[_0x8742('0x3')](_0x474c46,_0x27a773);};}function removeListener(_0x2a032e,_0x1fb1d9){return function(){TeamEvents[_0x8742('0x4')](_0x2a032e,_0x1fb1d9);};}exports[_0x8742('0x5')]=function(_0x4a9ae7){for(var _0x509621=0x0,_0x6c1768=events[_0x8742('0x6')];_0x509621<_0x6c1768;_0x509621++){var _0x5a6d7e=events[_0x509621];var _0x4a58d2=createListener('team:'+_0x5a6d7e,_0x4a9ae7);TeamEvents['on'](_0x5a6d7e,_0x4a58d2);}}; \ No newline at end of file +var _0x205d=['remove','emit','removeListener','register','length','team:','./team.events','save'];(function(_0x6da4ee,_0x5c7e81){var _0x1974ad=function(_0xc37e66){while(--_0xc37e66){_0x6da4ee['push'](_0x6da4ee['shift']());}};_0x1974ad(++_0x5c7e81);}(_0x205d,0xf6));var _0xd205=function(_0x5e7e1a,_0x38a7c6){_0x5e7e1a=_0x5e7e1a-0x0;var _0x46b94f=_0x205d[_0x5e7e1a];return _0x46b94f;};'use strict';var TeamEvents=require(_0xd205('0x0'));var events=[_0xd205('0x1'),_0xd205('0x2'),'update'];function createListener(_0x4a640b,_0x1eaf09){return function(_0xbd11c7){_0x1eaf09[_0xd205('0x3')](_0x4a640b,_0xbd11c7);};}function removeListener(_0x4bc52b,_0xd8bd69){return function(){TeamEvents[_0xd205('0x4')](_0x4bc52b,_0xd8bd69);};}exports[_0xd205('0x5')]=function(_0x45a533){for(var _0x4c078b=0x0,_0x2614e7=events[_0xd205('0x6')];_0x4c078b<_0x2614e7;_0x4c078b++){var _0xdb99a8=events[_0x4c078b];var _0x372211=createListener(_0xd205('0x7')+_0xdb99a8,_0x45a533);TeamEvents['on'](_0xdb99a8,_0x372211);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6a4c434..65c9d7b 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 _0x6c76=['INTEGER','sequelize','exports'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x6c76,0x184));var _0x66c7=function(_0x1c5d18,_0x1803ef){_0x1c5d18=_0x1c5d18-0x0;var _0x4583d6=_0x6c76[_0x1c5d18];return _0x4583d6;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'TeamId':{'type':Sequelize[_0x66c7('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3e0f=['sequelize','exports','INTEGER'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0x3e0f,0xfc));var _0xf3e0=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x3e0f[_0x3718b7];return _0xf8c91e;};'use strict';var Sequelize=require(_0xf3e0('0x0'));module[_0xf3e0('0x1')]={'TeamId':{'type':Sequelize[_0xf3e0('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xf3e0('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 95d4450..2da1681 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 _0x39d0=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x2bd940,_0x156ac8){var _0x5d3c44=function(_0x2d85e6){while(--_0x2d85e6){_0x2bd940['push'](_0x2bd940['shift']());}};_0x5d3c44(++_0x156ac8);}(_0x39d0,0x144));var _0x039d=function(_0x1e8c13,_0x416301){_0x1e8c13=_0x1e8c13-0x0;var _0x41ec7f=_0x39d0[_0x1e8c13];return _0x41ec7f;};'use strict';var _=require(_0x039d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x039d('0x1'));var moment=require(_0x039d('0x2'));var BPromise=require(_0x039d('0x3'));var rp=require(_0x039d('0x4'));var fs=require('fs');var path=require(_0x039d('0x5'));var rimraf=require('rimraf');var config=require(_0x039d('0x6'));var attributes=require(_0x039d('0x7'));module[_0x039d('0x8')]=function(_0x1e5075,_0x1ab56f){return _0x1e5075[_0x039d('0x9')](_0x039d('0xa'),attributes,{'tableName':_0x039d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','team_has_voice_prefixes','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x338bd0,_0x434a83){var _0x1d1bed=function(_0x549732){while(--_0x549732){_0x338bd0['push'](_0x338bd0['shift']());}};_0x1d1bed(++_0x434a83);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('TeamVoicePrefix',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 23d75be..efcf761 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4a3b28,_0x41fc7c){var _0x394c74=function(_0x3a30e5){while(--_0x3a30e5){_0x4a3b28['push'](_0x4a3b28['shift']());}};_0x394c74(++_0x41fc7c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4afc2c,_0x336a88){var _0x164084=function(_0x14b783){while(--_0x14b783){_0x4afc2c['push'](_0x4afc2c['shift']());}};_0x164084(++_0x336a88);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9a12bc6..3790697 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 _0x24d3=['exports','INTEGER','sequelize'];(function(_0x2fd780,_0xb4d6be){var _0x511452=function(_0x3596f8){while(--_0x3596f8){_0x2fd780['push'](_0x2fd780['shift']());}};_0x511452(++_0xb4d6be);}(_0x24d3,0x1b5));var _0x324d=function(_0x441f32,_0x455368){_0x441f32=_0x441f32-0x0;var _0x3150e8=_0x24d3[_0x441f32];return _0x3150e8;};'use strict';var Sequelize=require(_0x324d('0x0'));module[_0x324d('0x1')]={'penalty':{'type':Sequelize[_0x324d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa027=['INTEGER','sequelize'];(function(_0x61d9b7,_0x5a56ac){var _0x291d82=function(_0x51305b){while(--_0x51305b){_0x61d9b7['push'](_0x61d9b7['shift']());}};_0x291d82(++_0x5a56ac);}(_0xa027,0x1dd));var _0x7a02=function(_0x695ef3,_0x1f2e21){_0x695ef3=_0x695ef3-0x0;var _0x1ee15f=_0xa027[_0x695ef3];return _0x1ee15f;};'use strict';var Sequelize=require(_0x7a02('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7a02('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 101cea1..6619bc0 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 _0xdd0c=['bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xdd0c,0x165));var _0xcdd0=function(_0x5607ba,_0xd31351){_0x5607ba=_0x5607ba-0x0;var _0x3d783f=_0xdd0c[_0x5607ba];return _0x3d783f;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var logger=require(_0xcdd0('0x1'))(_0xcdd0('0x2'));var moment=require('moment');var BPromise=require(_0xcdd0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdd0('0x4'));var rimraf=require(_0xcdd0('0x5'));var config=require(_0xcdd0('0x6'));var attributes=require(_0xcdd0('0x7'));module[_0xcdd0('0x8')]=function(_0x5ae472,_0x2b33fc){return _0x5ae472[_0xcdd0('0x9')](_0xcdd0('0xa'),attributes,{'tableName':_0xcdd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf452=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x46559b,_0x26b3d1){var _0x4974c0=function(_0x908696){while(--_0x908696){_0x46559b['push'](_0x46559b['shift']());}};_0x4974c0(++_0x26b3d1);}(_0xf452,0x13b));var _0x2f45=function(_0x48cdba,_0x12d3a3){_0x48cdba=_0x48cdba-0x0;var _0x4ec5d6=_0xf452[_0x48cdba];return _0x4ec5d6;};'use strict';var _=require(_0x2f45('0x0'));var util=require(_0x2f45('0x1'));var logger=require('../../config/logger')(_0x2f45('0x2'));var moment=require(_0x2f45('0x3'));var BPromise=require(_0x2f45('0x4'));var rp=require(_0x2f45('0x5'));var fs=require('fs');var path=require(_0x2f45('0x6'));var rimraf=require(_0x2f45('0x7'));var config=require(_0x2f45('0x8'));var attributes=require(_0x2f45('0x9'));module[_0x2f45('0xa')]=function(_0x416e83,_0x1a53cf){return _0x416e83[_0x2f45('0xb')](_0x2f45('0xc'),attributes,{'tableName':_0x2f45('0xd'),'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 413e343..06e033b 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 _0xbff9=['request','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x17fd5e,_0x4fe691){var _0x5145e8=function(_0x55eba4){while(--_0x55eba4){_0x17fd5e['push'](_0x17fd5e['shift']());}};_0x5145e8(++_0x4fe691);}(_0xbff9,0x197));var _0x9bff=function(_0x43638b,_0x559bf6){_0x43638b=_0x43638b-0x0;var _0x14f38d=_0xbff9[_0x43638b];return _0x14f38d;};'use strict';var _=require(_0x9bff('0x0'));var util=require(_0x9bff('0x1'));var moment=require(_0x9bff('0x2'));var BPromise=require(_0x9bff('0x3'));var rs=require(_0x9bff('0x4'));var fs=require('fs');var Redis=require(_0x9bff('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9bff('0x6'));var logger=require('../../config/logger')(_0x9bff('0x7'));var config=require(_0x9bff('0x8'));var jayson=require(_0x9bff('0x9'));var client=jayson[_0x9bff('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ec07a,_0xc75a4d,_0x23ae80){return new BPromise(function(_0x1b893d,_0x140876){return client[_0x9bff('0xb')](_0x3ec07a,_0x23ae80)['then'](function(_0x48484e){logger[_0x9bff('0xc')](_0x9bff('0xd'),_0xc75a4d,'request\x20sent');logger[_0x9bff('0xe')](_0x9bff('0xf'),_0xc75a4d,_0x9bff('0x10'),JSON[_0x9bff('0x11')](_0x48484e));if(_0x48484e[_0x9bff('0x12')]){if(_0x48484e['error']['code']===0x1f4){logger[_0x9bff('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0xc75a4d,_0x48484e[_0x9bff('0x12')][_0x9bff('0x13')]);return _0x140876(_0x48484e[_0x9bff('0x12')][_0x9bff('0x13')]);}logger[_0x9bff('0x12')](_0x9bff('0xd'),_0xc75a4d,_0x48484e[_0x9bff('0x12')][_0x9bff('0x13')]);return _0x1b893d(_0x48484e[_0x9bff('0x12')][_0x9bff('0x13')]);}else{logger['info'](_0x9bff('0xd'),_0xc75a4d,_0x9bff('0x10'));_0x1b893d(_0x48484e[_0x9bff('0x14')][_0x9bff('0x13')]);}})[_0x9bff('0x15')](function(_0x2b9849){logger['error'](_0x9bff('0xd'),_0xc75a4d,_0x2b9849);_0x140876(_0x2b9849);});});} \ No newline at end of file +var _0xa8ca=['stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0xf8628a,_0x5afb04){var _0x48b217=function(_0xe23b66){while(--_0xe23b66){_0xf8628a['push'](_0xf8628a['shift']());}};_0x48b217(++_0x5afb04);}(_0xa8ca,0x12b));var _0xaa8c=function(_0x2f7cd8,_0x4ea902){_0x2f7cd8=_0x2f7cd8-0x0;var _0x13d0c2=_0xa8ca[_0x2f7cd8];return _0x13d0c2;};'use strict';var _=require(_0xaa8c('0x0'));var util=require('util');var moment=require(_0xaa8c('0x1'));var BPromise=require('bluebird');var rs=require(_0xaa8c('0x2'));var fs=require('fs');var Redis=require(_0xaa8c('0x3'));var db=require(_0xaa8c('0x4'))['db'];var utils=require(_0xaa8c('0x5'));var logger=require(_0xaa8c('0x6'))(_0xaa8c('0x7'));var config=require('../../config/environment');var jayson=require(_0xaa8c('0x8'));var client=jayson[_0xaa8c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47a6e4,_0x620f3a,_0x736ba3){return new BPromise(function(_0x5e8f2d,_0x4ae00d){return client['request'](_0x47a6e4,_0x736ba3)[_0xaa8c('0xa')](function(_0x2321b1){logger[_0xaa8c('0xb')](_0xaa8c('0xc'),_0x620f3a,_0xaa8c('0xd'));logger[_0xaa8c('0xe')](_0xaa8c('0xf'),_0x620f3a,_0xaa8c('0xd'),JSON[_0xaa8c('0x10')](_0x2321b1));if(_0x2321b1[_0xaa8c('0x11')]){if(_0x2321b1[_0xaa8c('0x11')][_0xaa8c('0x12')]===0x1f4){logger[_0xaa8c('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x620f3a,_0x2321b1[_0xaa8c('0x11')]['message']);return _0x4ae00d(_0x2321b1[_0xaa8c('0x11')][_0xaa8c('0x13')]);}logger[_0xaa8c('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x620f3a,_0x2321b1[_0xaa8c('0x11')][_0xaa8c('0x13')]);return _0x5e8f2d(_0x2321b1['error']['message']);}else{logger[_0xaa8c('0xb')](_0xaa8c('0xc'),_0x620f3a,_0xaa8c('0xd'));_0x5e8f2d(_0x2321b1[_0xaa8c('0x14')][_0xaa8c('0x13')]);}})['catch'](function(_0x3ba363){logger[_0xaa8c('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x620f3a,_0x3ba363);_0x4ae00d(_0x3ba363);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index da3f27a..de1b1a9 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 _0x2ebd=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','index','get','/:id','isAuthenticated','show','create','update','delete','destroy','exports'];(function(_0x27bcf5,_0x236765){var _0x4ce4cf=function(_0x4864ea){while(--_0x4864ea){_0x27bcf5['push'](_0x27bcf5['shift']());}};_0x4ce4cf(++_0x236765);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x1c99f7,_0x14134f){_0x1c99f7=_0x1c99f7-0x0;var _0x443613=_0x2ebd[_0x1c99f7];return _0x443613;};'use strict';var multer=require(_0xd2eb('0x0'));var util=require(_0xd2eb('0x1'));var path=require(_0xd2eb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd2eb('0x3')]();var fs_extra=require(_0xd2eb('0x4'));var auth=require(_0xd2eb('0x5'));var interaction=require(_0xd2eb('0x6'));var config=require(_0xd2eb('0x7'));var controller=require(_0xd2eb('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd2eb('0x9')]);router[_0xd2eb('0xa')](_0xd2eb('0xb'),auth[_0xd2eb('0xc')](),controller[_0xd2eb('0xd')]);router['post']('/',auth[_0xd2eb('0xc')](),controller[_0xd2eb('0xe')]);router['put']('/:id',auth[_0xd2eb('0xc')](),controller[_0xd2eb('0xf')]);router[_0xd2eb('0x10')](_0xd2eb('0xb'),auth[_0xd2eb('0xc')](),controller[_0xd2eb('0x11')]);module[_0xd2eb('0x12')]=router; \ No newline at end of file +var _0x2cc4=['isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','./template.controller','get'];(function(_0x427147,_0x3ff69e){var _0xf4aadb=function(_0x7e1ef3){while(--_0x7e1ef3){_0x427147['push'](_0x427147['shift']());}};_0xf4aadb(++_0x3ff69e);}(_0x2cc4,0x1f0));var _0x42cc=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0x2cc4[_0x585ee5];return _0x470808;};'use strict';var multer=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var path=require(_0x42cc('0x2'));var timeout=require(_0x42cc('0x3'));var express=require('express');var router=express[_0x42cc('0x4')]();var fs_extra=require(_0x42cc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x42cc('0x6'));router[_0x42cc('0x7')]('/',auth[_0x42cc('0x8')](),controller[_0x42cc('0x9')]);router[_0x42cc('0x7')]('/:id',auth[_0x42cc('0x8')](),controller[_0x42cc('0xa')]);router[_0x42cc('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x42cc('0xc')](_0x42cc('0xd'),auth[_0x42cc('0x8')](),controller[_0x42cc('0xe')]);router[_0x42cc('0xf')](_0x42cc('0xd'),auth[_0x42cc('0x8')](),controller[_0x42cc('0x10')]);module[_0x42cc('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 444afa5..716fb74 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 _0x4cf9=['STRING','TEXT','sequelize','exports'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0x4cf9,0xd2));var _0x94cf=function(_0x7a3903,_0x12734e){_0x7a3903=_0x7a3903-0x0;var _0x1d9dcb=_0x4cf9[_0x7a3903];return _0x1d9dcb;};'use strict';var Sequelize=require(_0x94cf('0x0'));module[_0x94cf('0x1')]={'name':{'type':Sequelize[_0x94cf('0x2')]},'description':{'type':Sequelize[_0x94cf('0x2')]},'html':{'type':Sequelize[_0x94cf('0x3')]}}; \ No newline at end of file +var _0xc41e=['TEXT','exports','STRING'];(function(_0xa4cf04,_0x409cd6){var _0x546ae0=function(_0x496665){while(--_0x496665){_0xa4cf04['push'](_0xa4cf04['shift']());}};_0x546ae0(++_0x409cd6);}(_0xc41e,0x172));var _0xec41=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc41e[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0xec41('0x0')]={'name':{'type':Sequelize[_0xec41('0x1')]},'description':{'type':Sequelize[_0xec41('0x1')]},'html':{'type':Sequelize[_0xec41('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index dd2b73f..0b1baa8 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 _0x361c=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','options','find','catch','create','user','role','Templates','UserProfileSection','autoAssociation','UserProfileResource','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','error','stack','name','send','index','Template','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x215a31,_0x1925fb){var _0x11c72a=function(_0x4115e3){while(--_0x4115e3){_0x215a31['push'](_0x215a31['shift']());}};_0x11c72a(++_0x1925fb);}(_0x361c,0xb8));var _0xc361=function(_0x2678cf,_0xcb2c29){_0x2678cf=_0x2678cf-0x0;var _0x4788e8=_0x361c[_0x2678cf];return _0x4788e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc361('0x0'));var zipdir=require(_0xc361('0x1'));var jsonpatch=require(_0xc361('0x2'));var rp=require(_0xc361('0x3'));var moment=require(_0xc361('0x4'));var BPromise=require(_0xc361('0x5'));var Mustache=require(_0xc361('0x6'));var util=require(_0xc361('0x7'));var path=require(_0xc361('0x8'));var sox=require(_0xc361('0x9'));var csv=require(_0xc361('0xa'));var ejs=require(_0xc361('0xb'));var fs=require('fs');var fs_extra=require(_0xc361('0xc'));var _=require('lodash');var squel=require(_0xc361('0xd'));var crypto=require(_0xc361('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc361('0xf'));var Papa=require(_0xc361('0x10'));var Redis=require('ioredis');var authService=require(_0xc361('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc361('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc361('0x13'))('api');var utils=require(_0xc361('0x14'));var config=require(_0xc361('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc361('0x16'))['db'];function respondWithStatusCode(_0x2f6f78,_0x4d395e){_0x4d395e=_0x4d395e||0xcc;return function(_0xaa3a04){if(_0xaa3a04){return _0x2f6f78[_0xc361('0x17')](_0x4d395e);}return _0x2f6f78[_0xc361('0x18')](_0x4d395e)[_0xc361('0x19')]();};}function respondWithResult(_0x4027cc,_0x2c3afe){_0x2c3afe=_0x2c3afe||0xc8;return function(_0x64338){if(_0x64338){return _0x4027cc[_0xc361('0x18')](_0x2c3afe)[_0xc361('0x1a')](_0x64338);}};}function respondWithFilteredResult(_0x54848e,_0x5b7c53){return function(_0x232a3e){if(_0x232a3e){var _0x1c3663=typeof _0x5b7c53[_0xc361('0x1b')]===_0xc361('0x1c')&&typeof _0x5b7c53[_0xc361('0x1d')]===_0xc361('0x1c');var _0x39197a=_0x232a3e[_0xc361('0x1e')];var _0x3cc730=_0x1c3663?0x0:_0x5b7c53[_0xc361('0x1b')];var _0x4370a2=_0x1c3663?_0x232a3e[_0xc361('0x1e')]:_0x5b7c53[_0xc361('0x1b')]+_0x5b7c53[_0xc361('0x1d')];var _0x4ec31c;if(_0x4370a2>=_0x39197a){_0x4370a2=_0x39197a;_0x4ec31c=0xc8;}else{_0x4ec31c=0xce;}_0x54848e[_0xc361('0x18')](_0x4ec31c);return _0x54848e[_0xc361('0x1f')]('Content-Range',_0x3cc730+'-'+_0x4370a2+'/'+_0x39197a)[_0xc361('0x1a')](_0x232a3e);}return null;};}function patchUpdates(_0x457b1c){return function(_0x38a241){try{jsonpatch['apply'](_0x38a241,_0x457b1c,!![]);}catch(_0x43a2a1){return BPromise[_0xc361('0x20')](_0x43a2a1);}return _0x38a241[_0xc361('0x21')]();};}function saveUpdates(_0x1b713c,_0x1f1781){return function(_0x5f1d3d){if(_0x5f1d3d){return _0x5f1d3d[_0xc361('0x22')](_0x1b713c)[_0xc361('0x23')](function(_0x53dfd5){return _0x53dfd5;});}return null;};}function removeEntity(_0x7eec77,_0x1995a6){return function(_0x3a6f8e){if(_0x3a6f8e){return _0x3a6f8e[_0xc361('0x24')]()[_0xc361('0x23')](function(){var _0x2fd7e8=_0x3a6f8e[_0xc361('0x25')]({'plain':!![]});var _0x55b1a3='Templates';return db['UserProfileResource'][_0xc361('0x24')]({'where':{'type':_0x55b1a3,'resourceId':_0x2fd7e8['id']}})[_0xc361('0x23')](function(){return _0x3a6f8e;});})[_0xc361('0x23')](function(){_0x7eec77[_0xc361('0x18')](0xcc)[_0xc361('0x19')]();});}};}function handleEntityNotFound(_0xb50941,_0x3cfd4a){return function(_0xd296b){if(!_0xd296b){_0xb50941['sendStatus'](0x194);}return _0xd296b;};}function handleError(_0x4c78a6,_0x47f175){_0x47f175=_0x47f175||0x1f4;return function(_0x1e6025){logger[_0xc361('0x26')](_0x1e6025[_0xc361('0x27')]);if(_0x1e6025[_0xc361('0x28')]){delete _0x1e6025['name'];}_0x4c78a6['status'](_0x47f175)[_0xc361('0x29')](_0x1e6025);};}exports[_0xc361('0x2a')]=function(_0x5a186b,_0xa6da08){var _0x58962f={},_0x5867f4={},_0x289c54={'count':0x0,'rows':[]};var _0x55632e=_['map'](db[_0xc361('0x2b')][_0xc361('0x2c')],function(_0x4354dd){return{'name':_0x4354dd['fieldName'],'type':_0x4354dd[_0xc361('0x2d')]['key']};});_0x5867f4[_0xc361('0x2e')]=_[_0xc361('0x2f')](_0x55632e,_0xc361('0x28'));_0x5867f4['query']=_[_0xc361('0x30')](_0x5a186b[_0xc361('0x31')]);_0x5867f4[_0xc361('0x32')]=_['intersection'](_0x5867f4[_0xc361('0x2e')],_0x5867f4[_0xc361('0x31')]);_0x58962f[_0xc361('0x33')]=_[_0xc361('0x34')](_0x5867f4[_0xc361('0x2e')],qs[_0xc361('0x35')](_0x5a186b[_0xc361('0x31')][_0xc361('0x35')]));_0x58962f[_0xc361('0x33')]=_0x58962f[_0xc361('0x33')][_0xc361('0x36')]?_0x58962f['attributes']:_0x5867f4[_0xc361('0x2e')];if(!_0x5a186b['query'][_0xc361('0x37')](_0xc361('0x38'))){_0x58962f['limit']=qs[_0xc361('0x1d')](_0x5a186b[_0xc361('0x31')]['limit']);_0x58962f[_0xc361('0x1b')]=qs[_0xc361('0x1b')](_0x5a186b[_0xc361('0x31')]['offset']);}_0x58962f[_0xc361('0x39')]=qs['sort'](_0x5a186b[_0xc361('0x31')][_0xc361('0x3a')]);_0x58962f[_0xc361('0x3b')]=qs[_0xc361('0x32')](_[_0xc361('0x3c')](_0x5a186b['query'],_0x5867f4[_0xc361('0x32')]),_0x55632e);if(_0x5a186b['query'][_0xc361('0x3d')]){_0x58962f[_0xc361('0x3b')]=_[_0xc361('0x3e')](_0x58962f[_0xc361('0x3b')],{'$or':_['map'](_0x55632e,function(_0x3be2ff){if(_0x3be2ff[_0xc361('0x2d')]!==_0xc361('0x3f')){var _0x47f5ff={};_0x47f5ff[_0x3be2ff['name']]={'$like':'%'+_0x5a186b[_0xc361('0x31')][_0xc361('0x3d')]+'%'};return _0x47f5ff;}})});}_0x58962f=_[_0xc361('0x3e')]({},_0x58962f,_0x5a186b['options']);var _0x27aa4b={'where':_0x58962f[_0xc361('0x3b')]};return db[_0xc361('0x2b')][_0xc361('0x1e')](_0x27aa4b)['then'](function(_0x1d54a2){_0x289c54['count']=_0x1d54a2;if(_0x5a186b[_0xc361('0x31')][_0xc361('0x40')]){_0x58962f[_0xc361('0x41')]=[{'all':!![]}];}return db[_0xc361('0x2b')]['findAll'](_0x58962f);})[_0xc361('0x23')](function(_0x41962f){_0x289c54[_0xc361('0x42')]=_0x41962f;return _0x289c54;})[_0xc361('0x23')](respondWithFilteredResult(_0xa6da08,_0x58962f))['catch'](handleError(_0xa6da08,null));};exports[_0xc361('0x43')]=function(_0x1e7f9a,_0x3db122){var _0x5c14f8={'raw':!![],'where':{'id':_0x1e7f9a[_0xc361('0x44')]['id']}},_0xc1ed91={};_0xc1ed91[_0xc361('0x2e')]=_[_0xc361('0x30')](db[_0xc361('0x2b')]['rawAttributes']);_0xc1ed91['query']=_['keys'](_0x1e7f9a['query']);_0xc1ed91['filters']=_[_0xc361('0x34')](_0xc1ed91[_0xc361('0x2e')],_0xc1ed91['query']);_0x5c14f8[_0xc361('0x33')]=_[_0xc361('0x34')](_0xc1ed91[_0xc361('0x2e')],qs[_0xc361('0x35')](_0x1e7f9a[_0xc361('0x31')][_0xc361('0x35')]));_0x5c14f8[_0xc361('0x33')]=_0x5c14f8['attributes'][_0xc361('0x36')]?_0x5c14f8[_0xc361('0x33')]:_0xc1ed91[_0xc361('0x2e')];if(_0x1e7f9a[_0xc361('0x31')][_0xc361('0x40')]){_0x5c14f8['include']=[{'all':!![]}];}_0x5c14f8=_[_0xc361('0x3e')]({},_0x5c14f8,_0x1e7f9a[_0xc361('0x45')]);return db[_0xc361('0x2b')][_0xc361('0x46')](_0x5c14f8)['then'](handleEntityNotFound(_0x3db122,null))[_0xc361('0x23')](respondWithResult(_0x3db122,null))[_0xc361('0x47')](handleError(_0x3db122,null));};exports[_0xc361('0x48')]=function(_0x95bb44,_0x18a480){return db[_0xc361('0x2b')][_0xc361('0x48')](_0x95bb44['body'],{})[_0xc361('0x23')](function(_0x3cf797){var _0x50a847=_0x95bb44[_0xc361('0x49')][_0xc361('0x25')]({'plain':!![]});if(!_0x50a847)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50a847[_0xc361('0x4a')]===_0xc361('0x49')){var _0xb38dde=_0x3cf797['get']({'plain':!![]});var _0x555de8=_0xc361('0x4b');return db[_0xc361('0x4c')][_0xc361('0x46')]({'where':{'name':_0x555de8,'userProfileId':_0x50a847['userProfileId']},'raw':!![]})[_0xc361('0x23')](function(_0x38eff5){if(_0x38eff5&&_0x38eff5[_0xc361('0x4d')]===0x0){return db[_0xc361('0x4e')][_0xc361('0x48')]({'name':_0xb38dde['name'],'resourceId':_0xb38dde['id'],'type':_0x38eff5[_0xc361('0x28')],'sectionId':_0x38eff5['id']},{})['then'](function(){return _0x3cf797;});}else{return _0x3cf797;}})[_0xc361('0x47')](function(_0x4ea3d1){logger[_0xc361('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ea3d1);throw _0x4ea3d1;});}return _0x3cf797;})['then'](respondWithResult(_0x18a480,0xc9))['catch'](handleError(_0x18a480,null));};exports[_0xc361('0x22')]=function(_0x3f16cc,_0x4c8367){if(_0x3f16cc[_0xc361('0x4f')]['id']){delete _0x3f16cc[_0xc361('0x4f')]['id'];}return db[_0xc361('0x2b')][_0xc361('0x46')]({'where':{'id':_0x3f16cc['params']['id']}})['then'](handleEntityNotFound(_0x4c8367,null))[_0xc361('0x23')](saveUpdates(_0x3f16cc[_0xc361('0x4f')],null))[_0xc361('0x23')](respondWithResult(_0x4c8367,null))['catch'](handleError(_0x4c8367,null));};exports[_0xc361('0x24')]=function(_0x31fc39,_0x8b5943){return db[_0xc361('0x2b')][_0xc361('0x46')]({'where':{'id':_0x31fc39[_0xc361('0x44')]['id']}})['then'](handleEntityNotFound(_0x8b5943,null))['then'](removeEntity(_0x8b5943,null))[_0xc361('0x47')](handleError(_0x8b5943,null));}; \ No newline at end of file +var _0x66e6=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','reject','then','destroy','error','name','send','index','Template','fieldName','type','key','map','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Templates','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0xdf284e,_0x29c97b){var _0x8f1315=function(_0x3a0fbb){while(--_0x3a0fbb){_0xdf284e['push'](_0xdf284e['shift']());}};_0x8f1315(++_0x29c97b);}(_0x66e6,0x189));var _0x666e=function(_0x146a0c,_0x101149){_0x146a0c=_0x146a0c-0x0;var _0x2a0bd5=_0x66e6[_0x146a0c];return _0x2a0bd5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x666e('0x0'));var zipdir=require(_0x666e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x666e('0x2'));var moment=require(_0x666e('0x3'));var BPromise=require(_0x666e('0x4'));var Mustache=require(_0x666e('0x5'));var util=require(_0x666e('0x6'));var path=require(_0x666e('0x7'));var sox=require(_0x666e('0x8'));var csv=require(_0x666e('0x9'));var ejs=require(_0x666e('0xa'));var fs=require('fs');var fs_extra=require(_0x666e('0xb'));var _=require(_0x666e('0xc'));var squel=require(_0x666e('0xd'));var crypto=require('crypto');var jsforce=require(_0x666e('0xe'));var deskjs=require(_0x666e('0xf'));var toCsv=require(_0x666e('0x9'));var querystring=require(_0x666e('0x10'));var Papa=require(_0x666e('0x11'));var Redis=require('ioredis');var authService=require(_0x666e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x666e('0x13'));var hardwareService=require(_0x666e('0x14'));var logger=require(_0x666e('0x15'))(_0x666e('0x16'));var utils=require(_0x666e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x666e('0x18'));var db=require(_0x666e('0x19'))['db'];function respondWithStatusCode(_0x18db7b,_0x512fe5){_0x512fe5=_0x512fe5||0xcc;return function(_0x5a1171){if(_0x5a1171){return _0x18db7b[_0x666e('0x1a')](_0x512fe5);}return _0x18db7b['status'](_0x512fe5)[_0x666e('0x1b')]();};}function respondWithResult(_0x5b46f0,_0x1bb619){_0x1bb619=_0x1bb619||0xc8;return function(_0xc8d3ff){if(_0xc8d3ff){return _0x5b46f0['status'](_0x1bb619)[_0x666e('0x1c')](_0xc8d3ff);}};}function respondWithFilteredResult(_0x24987e,_0x47b5d9){return function(_0x223831){if(_0x223831){var _0x2dec65=typeof _0x47b5d9['offset']===_0x666e('0x1d')&&typeof _0x47b5d9[_0x666e('0x1e')]==='undefined';var _0x376b11=_0x223831[_0x666e('0x1f')];var _0x686042=_0x2dec65?0x0:_0x47b5d9[_0x666e('0x20')];var _0x5ce33f=_0x2dec65?_0x223831[_0x666e('0x1f')]:_0x47b5d9[_0x666e('0x20')]+_0x47b5d9['limit'];var _0x157c8f;if(_0x5ce33f>=_0x376b11){_0x5ce33f=_0x376b11;_0x157c8f=0xc8;}else{_0x157c8f=0xce;}_0x24987e[_0x666e('0x21')](_0x157c8f);return _0x24987e['set'](_0x666e('0x22'),_0x686042+'-'+_0x5ce33f+'/'+_0x376b11)[_0x666e('0x1c')](_0x223831);}return null;};}function patchUpdates(_0x1db864){return function(_0x3488cb){try{jsonpatch['apply'](_0x3488cb,_0x1db864,!![]);}catch(_0x12ab23){return BPromise[_0x666e('0x23')](_0x12ab23);}return _0x3488cb['save']();};}function saveUpdates(_0x26bfa2,_0x464182){return function(_0x3f641c){if(_0x3f641c){return _0x3f641c['update'](_0x26bfa2)['then'](function(_0x2a950e){return _0x2a950e;});}return null;};}function removeEntity(_0x5c572c,_0x59c873){return function(_0x56b1f8){if(_0x56b1f8){return _0x56b1f8['destroy']()[_0x666e('0x24')](function(){var _0x22c59a=_0x56b1f8['get']({'plain':!![]});var _0x514112='Templates';return db['UserProfileResource'][_0x666e('0x25')]({'where':{'type':_0x514112,'resourceId':_0x22c59a['id']}})[_0x666e('0x24')](function(){return _0x56b1f8;});})[_0x666e('0x24')](function(){_0x5c572c['status'](0xcc)[_0x666e('0x1b')]();});}};}function handleEntityNotFound(_0x55a58a,_0x3c1550){return function(_0x39dba0){if(!_0x39dba0){_0x55a58a[_0x666e('0x1a')](0x194);}return _0x39dba0;};}function handleError(_0x1c915c,_0x589057){_0x589057=_0x589057||0x1f4;return function(_0x101c6b){logger[_0x666e('0x26')](_0x101c6b['stack']);if(_0x101c6b[_0x666e('0x27')]){delete _0x101c6b[_0x666e('0x27')];}_0x1c915c[_0x666e('0x21')](_0x589057)[_0x666e('0x28')](_0x101c6b);};}exports[_0x666e('0x29')]=function(_0x5ce948,_0xa1f4df){var _0x4237ea={},_0x2c8532={},_0x307138={'count':0x0,'rows':[]};var _0x2c980d=_['map'](db[_0x666e('0x2a')]['rawAttributes'],function(_0x49197e){return{'name':_0x49197e[_0x666e('0x2b')],'type':_0x49197e[_0x666e('0x2c')][_0x666e('0x2d')]};});_0x2c8532['model']=_[_0x666e('0x2e')](_0x2c980d,_0x666e('0x27'));_0x2c8532[_0x666e('0x2f')]=_[_0x666e('0x30')](_0x5ce948[_0x666e('0x2f')]);_0x2c8532['filters']=_['intersection'](_0x2c8532['model'],_0x2c8532[_0x666e('0x2f')]);_0x4237ea[_0x666e('0x31')]=_[_0x666e('0x32')](_0x2c8532[_0x666e('0x33')],qs[_0x666e('0x34')](_0x5ce948[_0x666e('0x2f')][_0x666e('0x34')]));_0x4237ea[_0x666e('0x31')]=_0x4237ea[_0x666e('0x31')][_0x666e('0x35')]?_0x4237ea[_0x666e('0x31')]:_0x2c8532[_0x666e('0x33')];if(!_0x5ce948[_0x666e('0x2f')][_0x666e('0x36')]('nolimit')){_0x4237ea['limit']=qs[_0x666e('0x1e')](_0x5ce948[_0x666e('0x2f')]['limit']);_0x4237ea['offset']=qs[_0x666e('0x20')](_0x5ce948[_0x666e('0x2f')][_0x666e('0x20')]);}_0x4237ea[_0x666e('0x37')]=qs[_0x666e('0x38')](_0x5ce948[_0x666e('0x2f')][_0x666e('0x38')]);_0x4237ea['where']=qs['filters'](_[_0x666e('0x39')](_0x5ce948['query'],_0x2c8532[_0x666e('0x3a')]),_0x2c980d);if(_0x5ce948['query'][_0x666e('0x3b')]){_0x4237ea[_0x666e('0x3c')]=_[_0x666e('0x3d')](_0x4237ea[_0x666e('0x3c')],{'$or':_['map'](_0x2c980d,function(_0x21d272){if(_0x21d272[_0x666e('0x2c')]!==_0x666e('0x3e')){var _0xff246f={};_0xff246f[_0x21d272[_0x666e('0x27')]]={'$like':'%'+_0x5ce948[_0x666e('0x2f')][_0x666e('0x3b')]+'%'};return _0xff246f;}})});}_0x4237ea=_[_0x666e('0x3d')]({},_0x4237ea,_0x5ce948[_0x666e('0x3f')]);var _0x183d1a={'where':_0x4237ea[_0x666e('0x3c')]};return db[_0x666e('0x2a')][_0x666e('0x1f')](_0x183d1a)['then'](function(_0x1ea741){_0x307138['count']=_0x1ea741;if(_0x5ce948[_0x666e('0x2f')][_0x666e('0x40')]){_0x4237ea[_0x666e('0x41')]=[{'all':!![]}];}return db[_0x666e('0x2a')]['findAll'](_0x4237ea);})[_0x666e('0x24')](function(_0x60e838){_0x307138['rows']=_0x60e838;return _0x307138;})['then'](respondWithFilteredResult(_0xa1f4df,_0x4237ea))[_0x666e('0x42')](handleError(_0xa1f4df,null));};exports[_0x666e('0x43')]=function(_0x21b063,_0xa9e68){var _0x4d00c9={'raw':!![],'where':{'id':_0x21b063[_0x666e('0x44')]['id']}},_0x3df3b2={};_0x3df3b2[_0x666e('0x33')]=_[_0x666e('0x30')](db[_0x666e('0x2a')]['rawAttributes']);_0x3df3b2['query']=_[_0x666e('0x30')](_0x21b063['query']);_0x3df3b2[_0x666e('0x3a')]=_[_0x666e('0x32')](_0x3df3b2[_0x666e('0x33')],_0x3df3b2[_0x666e('0x2f')]);_0x4d00c9[_0x666e('0x31')]=_[_0x666e('0x32')](_0x3df3b2['model'],qs[_0x666e('0x34')](_0x21b063[_0x666e('0x2f')][_0x666e('0x34')]));_0x4d00c9[_0x666e('0x31')]=_0x4d00c9[_0x666e('0x31')]['length']?_0x4d00c9[_0x666e('0x31')]:_0x3df3b2['model'];if(_0x21b063['query'][_0x666e('0x40')]){_0x4d00c9['include']=[{'all':!![]}];}_0x4d00c9=_[_0x666e('0x3d')]({},_0x4d00c9,_0x21b063[_0x666e('0x3f')]);return db[_0x666e('0x2a')][_0x666e('0x45')](_0x4d00c9)['then'](handleEntityNotFound(_0xa9e68,null))[_0x666e('0x24')](respondWithResult(_0xa9e68,null))[_0x666e('0x42')](handleError(_0xa9e68,null));};exports[_0x666e('0x46')]=function(_0xb90054,_0xed2ed1){return db[_0x666e('0x2a')][_0x666e('0x46')](_0xb90054[_0x666e('0x47')],{})[_0x666e('0x24')](function(_0x199370){var _0x5a4c6a=_0xb90054[_0x666e('0x48')][_0x666e('0x49')]({'plain':!![]});if(!_0x5a4c6a)throw new Error(_0x666e('0x4a'));if(_0x5a4c6a['role']===_0x666e('0x48')){var _0x1817f9=_0x199370['get']({'plain':!![]});var _0x7eac60=_0x666e('0x4b');return db[_0x666e('0x4c')][_0x666e('0x45')]({'where':{'name':_0x7eac60,'userProfileId':_0x5a4c6a[_0x666e('0x4d')]},'raw':!![]})['then'](function(_0x19aeef){if(_0x19aeef&&_0x19aeef[_0x666e('0x4e')]===0x0){return db[_0x666e('0x4f')][_0x666e('0x46')]({'name':_0x1817f9['name'],'resourceId':_0x1817f9['id'],'type':_0x19aeef[_0x666e('0x27')],'sectionId':_0x19aeef['id']},{})[_0x666e('0x24')](function(){return _0x199370;});}else{return _0x199370;}})['catch'](function(_0x364383){logger[_0x666e('0x26')](_0x666e('0x50'),_0x364383);throw _0x364383;});}return _0x199370;})[_0x666e('0x24')](respondWithResult(_0xed2ed1,0xc9))[_0x666e('0x42')](handleError(_0xed2ed1,null));};exports[_0x666e('0x51')]=function(_0x5281d7,_0x2185b0){if(_0x5281d7['body']['id']){delete _0x5281d7[_0x666e('0x47')]['id'];}return db['Template'][_0x666e('0x45')]({'where':{'id':_0x5281d7[_0x666e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2185b0,null))[_0x666e('0x24')](saveUpdates(_0x5281d7[_0x666e('0x47')],null))[_0x666e('0x24')](respondWithResult(_0x2185b0,null))[_0x666e('0x42')](handleError(_0x2185b0,null));};exports[_0x666e('0x25')]=function(_0x3a18ef,_0x51bf4c){return db['Template'][_0x666e('0x45')]({'where':{'id':_0x3a18ef['params']['id']}})[_0x666e('0x24')](handleEntityNotFound(_0x51bf4c,null))[_0x666e('0x24')](removeEntity(_0x51bf4c,null))[_0x666e('0x42')](handleError(_0x51bf4c,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 663eb7d..b4dad0c 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 _0xf298=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf298,0x94));var _0x8f29=function(_0x208158,_0x21c120){_0x208158=_0x208158-0x0;var _0x27b273=_0xf298[_0x208158];return _0x27b273;};'use strict';var _=require(_0x8f29('0x0'));var util=require(_0x8f29('0x1'));var logger=require(_0x8f29('0x2'))(_0x8f29('0x3'));var moment=require(_0x8f29('0x4'));var BPromise=require(_0x8f29('0x5'));var rp=require(_0x8f29('0x6'));var fs=require('fs');var path=require(_0x8f29('0x7'));var rimraf=require(_0x8f29('0x8'));var config=require(_0x8f29('0x9'));var attributes=require(_0x8f29('0xa'));module[_0x8f29('0xb')]=function(_0x435309,_0x59d58f){return _0x435309[_0x8f29('0xc')](_0x8f29('0xd'),attributes,{'tableName':_0x8f29('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3956=['./template.attributes','exports','define','tools_templates','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x7e1eb6,_0x3fecd3){var _0x34c586=function(_0x146ce0){while(--_0x146ce0){_0x7e1eb6['push'](_0x7e1eb6['shift']());}};_0x34c586(++_0x3fecd3);}(_0x3956,0x1e8));var _0x6395=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0x3956[_0x3e6b2f];return _0x323215;};'use strict';var _=require(_0x6395('0x0'));var util=require(_0x6395('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6395('0x2'));var BPromise=require(_0x6395('0x3'));var rp=require(_0x6395('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6395('0x5'));var config=require(_0x6395('0x6'));var attributes=require(_0x6395('0x7'));module[_0x6395('0x8')]=function(_0x6d2b28,_0x2fd693){return _0x6d2b28[_0x6395('0x9')]('Template',attributes,{'tableName':_0x6395('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 fb5d60a..799efc2 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 _0x0f9d=['debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','map','model','include'];(function(_0x44cb53,_0x5c347c){var _0x539f2a=function(_0x1200e5){while(--_0x1200e5){_0x44cb53['push'](_0x44cb53['shift']());}};_0x539f2a(++_0x5c347c);}(_0x0f9d,0x81));var _0xd0f9=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x0f9d[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require(_0xd0f9('0x0'));var util=require('util');var moment=require(_0xd0f9('0x1'));var BPromise=require('bluebird');var rs=require(_0xd0f9('0x2'));var fs=require('fs');var Redis=require(_0xd0f9('0x3'));var db=require(_0xd0f9('0x4'))['db'];var utils=require(_0xd0f9('0x5'));var logger=require(_0xd0f9('0x6'))(_0xd0f9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0f9('0x8')][_0xd0f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eaf4b,_0x32308e,_0x20d86d){return new BPromise(function(_0x536a71,_0x220cab){return client[_0xd0f9('0xa')](_0x2eaf4b,_0x20d86d)['then'](function(_0x242d0d){logger[_0xd0f9('0xb')]('Template,\x20%s,\x20%s',_0x32308e,'request\x20sent');logger['debug'](_0xd0f9('0xc'),_0x32308e,_0xd0f9('0xd'),JSON[_0xd0f9('0xe')](_0x242d0d));if(_0x242d0d['error']){if(_0x242d0d['error'][_0xd0f9('0xf')]===0x1f4){logger[_0xd0f9('0x10')](_0xd0f9('0x11'),_0x32308e,_0x242d0d[_0xd0f9('0x10')][_0xd0f9('0x12')]);return _0x220cab(_0x242d0d[_0xd0f9('0x10')][_0xd0f9('0x12')]);}logger['error']('Template,\x20%s,\x20%s',_0x32308e,_0x242d0d[_0xd0f9('0x10')][_0xd0f9('0x12')]);return _0x536a71(_0x242d0d[_0xd0f9('0x10')][_0xd0f9('0x12')]);}else{logger[_0xd0f9('0xb')](_0xd0f9('0x11'),_0x32308e,'request\x20sent');_0x536a71(_0x242d0d[_0xd0f9('0x13')][_0xd0f9('0x12')]);}})[_0xd0f9('0x14')](function(_0x56ae14){logger[_0xd0f9('0x10')]('Template,\x20%s,\x20%s',_0x32308e,_0x56ae14);_0x220cab(_0x56ae14);});});}exports[_0xd0f9('0x15')]=function(_0x4ce885){var _0x26cb40=this;return new Promise(function(_0x3263e2,_0x3647b1){return db[_0xd0f9('0x16')][_0xd0f9('0x17')]({'raw':_0x4ce885[_0xd0f9('0x18')]?_0x4ce885[_0xd0f9('0x18')][_0xd0f9('0x19')]===undefined?!![]:![]:!![],'where':_0x4ce885[_0xd0f9('0x18')]?_0x4ce885[_0xd0f9('0x18')][_0xd0f9('0x1a')]||null:null,'attributes':_0x4ce885[_0xd0f9('0x18')]?_0x4ce885['options'][_0xd0f9('0x1b')]||null:null,'limit':_0x4ce885[_0xd0f9('0x18')]?_0x4ce885[_0xd0f9('0x18')]['limit']||null:null,'include':_0x4ce885['options']?_0x4ce885[_0xd0f9('0x18')]['include']?_[_0xd0f9('0x1c')](_0x4ce885[_0xd0f9('0x18')]['include'],function(_0xeb76a){return{'model':db[_0xeb76a[_0xd0f9('0x1d')]],'as':_0xeb76a['as'],'attributes':_0xeb76a[_0xd0f9('0x1b')],'include':_0xeb76a[_0xd0f9('0x1e')]?_[_0xd0f9('0x1c')](_0xeb76a[_0xd0f9('0x1e')],function(_0x2be0a5){return{'model':db[_0x2be0a5['model']],'as':_0x2be0a5['as'],'attributes':_0x2be0a5[_0xd0f9('0x1b')],'include':_0x2be0a5[_0xd0f9('0x1e')]?_[_0xd0f9('0x1c')](_0x2be0a5[_0xd0f9('0x1e')],function(_0x4413df){return{'model':db[_0x4413df['model']],'as':_0x4413df['as'],'attributes':_0x4413df[_0xd0f9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31156e){logger['info'](_0xd0f9('0x15'),_0x4ce885);logger[_0xd0f9('0x1f')](_0xd0f9('0x15'),_0x4ce885,JSON[_0xd0f9('0xe')](_0x31156e));_0x3263e2(_0x31156e);})[_0xd0f9('0x14')](function(_0x35ee7d){logger['error'](_0xd0f9('0x15'),_0x35ee7d[_0xd0f9('0x12')],_0x4ce885);_0x3647b1(_0x26cb40['error'](0x1f4,_0x35ee7d[_0xd0f9('0x12')]));});});}; \ No newline at end of file +var _0xd92b=['include','model','attributes','then','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTemplate','options','raw','where','limit','map'];(function(_0x2b8d16,_0x17c7ef){var _0x5478e9=function(_0x14be03){while(--_0x14be03){_0x2b8d16['push'](_0x2b8d16['shift']());}};_0x5478e9(++_0x17c7ef);}(_0xd92b,0x1f4));var _0xbd92=function(_0x31cfb8,_0x48a724){_0x31cfb8=_0x31cfb8-0x0;var _0x7a14be=_0xd92b[_0x31cfb8];return _0x7a14be;};'use strict';var _=require(_0xbd92('0x0'));var util=require('util');var moment=require(_0xbd92('0x1'));var BPromise=require(_0xbd92('0x2'));var rs=require(_0xbd92('0x3'));var fs=require('fs');var Redis=require(_0xbd92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd92('0x5'));var logger=require(_0xbd92('0x6'))(_0xbd92('0x7'));var config=require(_0xbd92('0x8'));var jayson=require(_0xbd92('0x9'));var client=jayson[_0xbd92('0xa')][_0xbd92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52eb5d,_0x29d72d,_0x4d4f71){return new BPromise(function(_0x43bccc,_0x445a48){return client[_0xbd92('0xc')](_0x52eb5d,_0x4d4f71)['then'](function(_0x3dfc8a){logger[_0xbd92('0xd')](_0xbd92('0xe'),_0x29d72d,_0xbd92('0xf'));logger[_0xbd92('0x10')](_0xbd92('0x11'),_0x29d72d,'request\x20sent',JSON['stringify'](_0x3dfc8a));if(_0x3dfc8a['error']){if(_0x3dfc8a[_0xbd92('0x12')][_0xbd92('0x13')]===0x1f4){logger[_0xbd92('0x12')](_0xbd92('0xe'),_0x29d72d,_0x3dfc8a[_0xbd92('0x12')][_0xbd92('0x14')]);return _0x445a48(_0x3dfc8a[_0xbd92('0x12')]['message']);}logger['error'](_0xbd92('0xe'),_0x29d72d,_0x3dfc8a[_0xbd92('0x12')]['message']);return _0x43bccc(_0x3dfc8a['error'][_0xbd92('0x14')]);}else{logger[_0xbd92('0xd')](_0xbd92('0xe'),_0x29d72d,_0xbd92('0xf'));_0x43bccc(_0x3dfc8a['result'][_0xbd92('0x14')]);}})[_0xbd92('0x15')](function(_0x3303df){logger[_0xbd92('0x12')](_0xbd92('0xe'),_0x29d72d,_0x3303df);_0x445a48(_0x3303df);});});}exports[_0xbd92('0x16')]=function(_0x1a5e75){var _0x142d1e=this;return new Promise(function(_0x5a330e,_0x312782){return db['Template']['findAll']({'raw':_0x1a5e75[_0xbd92('0x17')]?_0x1a5e75[_0xbd92('0x17')][_0xbd92('0x18')]===undefined?!![]:![]:!![],'where':_0x1a5e75['options']?_0x1a5e75['options'][_0xbd92('0x19')]||null:null,'attributes':_0x1a5e75[_0xbd92('0x17')]?_0x1a5e75[_0xbd92('0x17')]['attributes']||null:null,'limit':_0x1a5e75[_0xbd92('0x17')]?_0x1a5e75[_0xbd92('0x17')][_0xbd92('0x1a')]||null:null,'include':_0x1a5e75['options']?_0x1a5e75[_0xbd92('0x17')]['include']?_[_0xbd92('0x1b')](_0x1a5e75['options'][_0xbd92('0x1c')],function(_0xc8568){return{'model':db[_0xc8568[_0xbd92('0x1d')]],'as':_0xc8568['as'],'attributes':_0xc8568[_0xbd92('0x1e')],'include':_0xc8568[_0xbd92('0x1c')]?_[_0xbd92('0x1b')](_0xc8568['include'],function(_0x598927){return{'model':db[_0x598927[_0xbd92('0x1d')]],'as':_0x598927['as'],'attributes':_0x598927[_0xbd92('0x1e')],'include':_0x598927['include']?_['map'](_0x598927[_0xbd92('0x1c')],function(_0x1df061){return{'model':db[_0x1df061[_0xbd92('0x1d')]],'as':_0x1df061['as'],'attributes':_0x1df061[_0xbd92('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbd92('0x1f')](function(_0x191369){logger[_0xbd92('0xd')](_0xbd92('0x16'),_0x1a5e75);logger[_0xbd92('0x10')]('GetTemplate',_0x1a5e75,JSON[_0xbd92('0x20')](_0x191369));_0x5a330e(_0x191369);})[_0xbd92('0x15')](function(_0x4d602d){logger[_0xbd92('0x12')](_0xbd92('0x16'),_0x4d602d[_0xbd92('0x14')],_0x1a5e75);_0x312782(_0x142d1e['error'](0x1f4,_0x4d602d[_0xbd92('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 0e6625f..527052a 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 _0xe181=['isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','create','post','addAllCondition','/:id/actions','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get'];(function(_0x3134dd,_0x52a8e8){var _0x1d5733=function(_0xb682ac){while(--_0xb682ac){_0x3134dd['push'](_0x3134dd['shift']());}};_0x1d5733(++_0x52a8e8);}(_0xe181,0x17a));var _0x1e18=function(_0x1fcde8,_0x44c01d){_0x1fcde8=_0x1fcde8-0x0;var _0x5b3541=_0xe181[_0x1fcde8];return _0x5b3541;};'use strict';var multer=require(_0x1e18('0x0'));var util=require(_0x1e18('0x1'));var path=require(_0x1e18('0x2'));var timeout=require(_0x1e18('0x3'));var express=require(_0x1e18('0x4'));var router=express[_0x1e18('0x5')]();var fs_extra=require(_0x1e18('0x6'));var auth=require(_0x1e18('0x7'));var interaction=require(_0x1e18('0x8'));var config=require(_0x1e18('0x9'));var controller=require(_0x1e18('0xa'));router[_0x1e18('0xb')]('/',auth[_0x1e18('0xc')](),controller[_0x1e18('0xd')]);router['get'](_0x1e18('0xe'),auth[_0x1e18('0xc')](),controller['show']);router[_0x1e18('0xb')](_0x1e18('0xf'),auth[_0x1e18('0xc')](),controller[_0x1e18('0x10')]);router[_0x1e18('0xb')](_0x1e18('0x11'),auth[_0x1e18('0xc')](),controller[_0x1e18('0x12')]);router['get']('/:id/actions',auth[_0x1e18('0xc')](),controller[_0x1e18('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1e18('0x14')]);router[_0x1e18('0x15')](_0x1e18('0xf'),auth['isAuthenticated'](),controller[_0x1e18('0x16')]);router[_0x1e18('0x15')](_0x1e18('0x11'),auth[_0x1e18('0xc')](),controller['addAnyCondition']);router['post'](_0x1e18('0x17'),auth[_0x1e18('0xc')](),controller[_0x1e18('0x18')]);router[_0x1e18('0x19')](_0x1e18('0xe'),auth['isAuthenticated'](),controller[_0x1e18('0x1a')]);router[_0x1e18('0x1b')](_0x1e18('0xe'),auth[_0x1e18('0xc')](),controller[_0x1e18('0x1c')]);module[_0x1e18('0x1d')]=router; \ No newline at end of file +var _0x2186=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAnyCondition','addAction','update','delete','destroy','exports','util','path'];(function(_0x4060ef,_0x469edf){var _0x553c6b=function(_0x54ee2){while(--_0x54ee2){_0x4060ef['push'](_0x4060ef['shift']());}};_0x553c6b(++_0x469edf);}(_0x2186,0x18e));var _0x6218=function(_0x445ab8,_0x1ed00e){_0x445ab8=_0x445ab8-0x0;var _0x3d3082=_0x2186[_0x445ab8];return _0x3d3082;};'use strict';var multer=require('multer');var util=require(_0x6218('0x0'));var path=require(_0x6218('0x1'));var timeout=require(_0x6218('0x2'));var express=require('express');var router=express[_0x6218('0x3')]();var fs_extra=require(_0x6218('0x4'));var auth=require(_0x6218('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6218('0x6'));var controller=require('./trigger.controller');router['get']('/',auth[_0x6218('0x7')](),controller[_0x6218('0x8')]);router[_0x6218('0x9')](_0x6218('0xa'),auth[_0x6218('0x7')](),controller[_0x6218('0xb')]);router[_0x6218('0x9')](_0x6218('0xc'),auth[_0x6218('0x7')](),controller[_0x6218('0xd')]);router[_0x6218('0x9')](_0x6218('0xe'),auth[_0x6218('0x7')](),controller[_0x6218('0xf')]);router['get'](_0x6218('0x10'),auth['isAuthenticated'](),controller['getActions']);router[_0x6218('0x11')]('/',auth[_0x6218('0x7')](),controller['create']);router[_0x6218('0x11')](_0x6218('0xc'),auth[_0x6218('0x7')](),controller[_0x6218('0x12')]);router['post'](_0x6218('0xe'),auth[_0x6218('0x7')](),controller[_0x6218('0x13')]);router['post'](_0x6218('0x10'),auth['isAuthenticated'](),controller[_0x6218('0x14')]);router['put']('/:id',auth[_0x6218('0x7')](),controller[_0x6218('0x15')]);router[_0x6218('0x16')]('/:id',auth[_0x6218('0x7')](),controller[_0x6218('0x17')]);module[_0x6218('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 2bf0888..8d641f6 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 _0x6b55=['exports','STRING','BOOLEAN','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6b55,0xeb));var _0x56b5=function(_0x113e43,_0x5308c0){_0x113e43=_0x113e43-0x0;var _0x230f8a=_0x6b55[_0x113e43];return _0x230f8a;};'use strict';var Sequelize=require(_0x56b5('0x0'));module[_0x56b5('0x1')]={'name':{'type':Sequelize[_0x56b5('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x56b5('0x2')]},'status':{'type':Sequelize[_0x56b5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7f46=['STRING','BOOLEAN'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x7f46,0x12a));var _0x67f4=function(_0x104427,_0x48fe5c){_0x104427=_0x104427-0x0;var _0x22f6e5=_0x7f46[_0x104427];return _0x22f6e5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x67f4('0x0')]},'channel':{'type':Sequelize[_0x67f4('0x0')]},'description':{'type':Sequelize[_0x67f4('0x0')]},'status':{'type':Sequelize[_0x67f4('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 21fd0c2..d77f7d9 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 _0xd632=['Trigger','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','sort','pick','hasOwnProperty','getAnyConditions','addAction','TriggerId','getActions','Action','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','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','limit','undefined','count','set','Content-Range','apply','save','then','destroy','get','Triggers','error','stack','name','send','index','map'];(function(_0x1c12bd,_0x348360){var _0x1de620=function(_0x2ab4d5){while(--_0x2ab4d5){_0x1c12bd['push'](_0x1c12bd['shift']());}};_0x1de620(++_0x348360);}(_0xd632,0x1c1));var _0x2d63=function(_0xb49cb8,_0x39474b){_0xb49cb8=_0xb49cb8-0x0;var _0x879ead=_0xd632[_0xb49cb8];return _0x879ead;};'use strict';var emlformat=require(_0x2d63('0x0'));var rimraf=require(_0x2d63('0x1'));var zipdir=require(_0x2d63('0x2'));var jsonpatch=require(_0x2d63('0x3'));var rp=require(_0x2d63('0x4'));var moment=require('moment');var BPromise=require(_0x2d63('0x5'));var Mustache=require(_0x2d63('0x6'));var util=require(_0x2d63('0x7'));var path=require(_0x2d63('0x8'));var sox=require(_0x2d63('0x9'));var csv=require(_0x2d63('0xa'));var ejs=require(_0x2d63('0xb'));var fs=require('fs');var fs_extra=require(_0x2d63('0xc'));var _=require(_0x2d63('0xd'));var squel=require(_0x2d63('0xe'));var crypto=require(_0x2d63('0xf'));var jsforce=require(_0x2d63('0x10'));var deskjs=require(_0x2d63('0x11'));var toCsv=require(_0x2d63('0xa'));var querystring=require(_0x2d63('0x12'));var Papa=require(_0x2d63('0x13'));var Redis=require(_0x2d63('0x14'));var authService=require(_0x2d63('0x15'));var qs=require(_0x2d63('0x16'));var as=require(_0x2d63('0x17'));var hardwareService=require(_0x2d63('0x18'));var logger=require(_0x2d63('0x19'))(_0x2d63('0x1a'));var utils=require(_0x2d63('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x2d63('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46a91d,_0x99b8da){_0x99b8da=_0x99b8da||0xcc;return function(_0x5f3f24){if(_0x5f3f24){return _0x46a91d[_0x2d63('0x1d')](_0x99b8da);}return _0x46a91d[_0x2d63('0x1e')](_0x99b8da)[_0x2d63('0x1f')]();};}function respondWithResult(_0x2b2833,_0x4fabff){_0x4fabff=_0x4fabff||0xc8;return function(_0x1baea8){if(_0x1baea8){return _0x2b2833[_0x2d63('0x1e')](_0x4fabff)[_0x2d63('0x20')](_0x1baea8);}};}function respondWithFilteredResult(_0xf756e9,_0x374276){return function(_0x452563){if(_0x452563){var _0x5df21a=typeof _0x374276[_0x2d63('0x21')]==='undefined'&&typeof _0x374276[_0x2d63('0x22')]===_0x2d63('0x23');var _0x56ca98=_0x452563[_0x2d63('0x24')];var _0x1f1909=_0x5df21a?0x0:_0x374276['offset'];var _0x163f5b=_0x5df21a?_0x452563['count']:_0x374276[_0x2d63('0x21')]+_0x374276[_0x2d63('0x22')];var _0x252a7f;if(_0x163f5b>=_0x56ca98){_0x163f5b=_0x56ca98;_0x252a7f=0xc8;}else{_0x252a7f=0xce;}_0xf756e9[_0x2d63('0x1e')](_0x252a7f);return _0xf756e9[_0x2d63('0x25')](_0x2d63('0x26'),_0x1f1909+'-'+_0x163f5b+'/'+_0x56ca98)['json'](_0x452563);}return null;};}function patchUpdates(_0x553787){return function(_0x59e37d){try{jsonpatch[_0x2d63('0x27')](_0x59e37d,_0x553787,!![]);}catch(_0x4414fd){return BPromise['reject'](_0x4414fd);}return _0x59e37d[_0x2d63('0x28')]();};}function saveUpdates(_0x561fc2,_0x2160e0){return function(_0x19a4f6){if(_0x19a4f6){return _0x19a4f6['update'](_0x561fc2)[_0x2d63('0x29')](function(_0x58ced8){return _0x58ced8;});}return null;};}function removeEntity(_0x4c1e19,_0x22666e){return function(_0x590771){if(_0x590771){return _0x590771[_0x2d63('0x2a')]()['then'](function(){var _0x1ebf05=_0x590771[_0x2d63('0x2b')]({'plain':!![]});var _0x25a8fd=_0x2d63('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x25a8fd,'resourceId':_0x1ebf05['id']}})[_0x2d63('0x29')](function(){return _0x590771;});})[_0x2d63('0x29')](function(){_0x4c1e19[_0x2d63('0x1e')](0xcc)[_0x2d63('0x1f')]();});}};}function handleEntityNotFound(_0x5ebc88,_0x4eb61d){return function(_0x65f594){if(!_0x65f594){_0x5ebc88[_0x2d63('0x1d')](0x194);}return _0x65f594;};}function handleError(_0x279bc8,_0x94c90b){_0x94c90b=_0x94c90b||0x1f4;return function(_0x1bb0a3){logger[_0x2d63('0x2d')](_0x1bb0a3[_0x2d63('0x2e')]);if(_0x1bb0a3[_0x2d63('0x2f')]){delete _0x1bb0a3[_0x2d63('0x2f')];}_0x279bc8[_0x2d63('0x1e')](_0x94c90b)[_0x2d63('0x30')](_0x1bb0a3);};}exports[_0x2d63('0x31')]=function(_0x2c70eb,_0x25ce0a){var _0x393c36={},_0x4ee1fe={},_0x3b4f57={'count':0x0,'rows':[]};var _0xcf21d=_[_0x2d63('0x32')](db[_0x2d63('0x33')][_0x2d63('0x34')],function(_0x4e4e8c){return{'name':_0x4e4e8c[_0x2d63('0x35')],'type':_0x4e4e8c[_0x2d63('0x36')][_0x2d63('0x37')]};});_0x4ee1fe[_0x2d63('0x38')]=_[_0x2d63('0x32')](_0xcf21d,_0x2d63('0x2f'));_0x4ee1fe['query']=_[_0x2d63('0x39')](_0x2c70eb[_0x2d63('0x3a')]);_0x4ee1fe[_0x2d63('0x3b')]=_[_0x2d63('0x3c')](_0x4ee1fe['model'],_0x4ee1fe['query']);_0x393c36[_0x2d63('0x3d')]=_[_0x2d63('0x3c')](_0x4ee1fe[_0x2d63('0x38')],qs[_0x2d63('0x3e')](_0x2c70eb[_0x2d63('0x3a')][_0x2d63('0x3e')]));_0x393c36[_0x2d63('0x3d')]=_0x393c36[_0x2d63('0x3d')][_0x2d63('0x3f')]?_0x393c36[_0x2d63('0x3d')]:_0x4ee1fe['model'];if(!_0x2c70eb[_0x2d63('0x3a')]['hasOwnProperty'](_0x2d63('0x40'))){_0x393c36['limit']=qs[_0x2d63('0x22')](_0x2c70eb['query'][_0x2d63('0x22')]);_0x393c36[_0x2d63('0x21')]=qs[_0x2d63('0x21')](_0x2c70eb[_0x2d63('0x3a')][_0x2d63('0x21')]);}_0x393c36[_0x2d63('0x41')]=qs['sort'](_0x2c70eb[_0x2d63('0x3a')]['sort']);_0x393c36[_0x2d63('0x42')]=qs[_0x2d63('0x3b')](_['pick'](_0x2c70eb[_0x2d63('0x3a')],_0x4ee1fe[_0x2d63('0x3b')]),_0xcf21d);if(_0x2c70eb[_0x2d63('0x3a')][_0x2d63('0x43')]){_0x393c36[_0x2d63('0x42')]=_[_0x2d63('0x44')](_0x393c36[_0x2d63('0x42')],{'$or':_[_0x2d63('0x32')](_0xcf21d,function(_0x5c4af9){if(_0x5c4af9['type']!=='VIRTUAL'){var _0x3f585d={};_0x3f585d[_0x5c4af9[_0x2d63('0x2f')]]={'$like':'%'+_0x2c70eb[_0x2d63('0x3a')]['filter']+'%'};return _0x3f585d;}})});}_0x393c36=_[_0x2d63('0x44')]({},_0x393c36,_0x2c70eb[_0x2d63('0x45')]);var _0x4864c1={'where':_0x393c36[_0x2d63('0x42')]};return db[_0x2d63('0x33')][_0x2d63('0x24')](_0x4864c1)[_0x2d63('0x29')](function(_0x1e4347){_0x3b4f57['count']=_0x1e4347;if(_0x2c70eb['query'][_0x2d63('0x46')]){_0x393c36[_0x2d63('0x47')]=[{'all':!![]}];}return db[_0x2d63('0x33')][_0x2d63('0x48')](_0x393c36);})['then'](function(_0xfe37c7){_0x3b4f57[_0x2d63('0x49')]=_0xfe37c7;return _0x3b4f57;})[_0x2d63('0x29')](respondWithFilteredResult(_0x25ce0a,_0x393c36))['catch'](handleError(_0x25ce0a,null));};exports['show']=function(_0x10f8d3,_0x5a5c5b){var _0x43118d={'raw':![],'where':{'id':_0x10f8d3[_0x2d63('0x4a')]['id']}},_0x306eed={};_0x306eed[_0x2d63('0x38')]=_['keys'](db[_0x2d63('0x33')][_0x2d63('0x34')]);_0x306eed[_0x2d63('0x3a')]=_[_0x2d63('0x39')](_0x10f8d3[_0x2d63('0x3a')]);_0x306eed['filters']=_[_0x2d63('0x3c')](_0x306eed[_0x2d63('0x38')],_0x306eed[_0x2d63('0x3a')]);_0x43118d[_0x2d63('0x3d')]=_[_0x2d63('0x3c')](_0x306eed[_0x2d63('0x38')],qs['fields'](_0x10f8d3[_0x2d63('0x3a')][_0x2d63('0x3e')]));_0x43118d[_0x2d63('0x3d')]=_0x43118d['attributes'][_0x2d63('0x3f')]?_0x43118d[_0x2d63('0x3d')]:_0x306eed['model'];if(_0x10f8d3[_0x2d63('0x3a')][_0x2d63('0x46')]){_0x43118d[_0x2d63('0x47')]=[{'all':!![]}];}_0x43118d=_[_0x2d63('0x44')]({},_0x43118d,_0x10f8d3[_0x2d63('0x45')]);return db[_0x2d63('0x33')][_0x2d63('0x4b')](_0x43118d)[_0x2d63('0x29')](handleEntityNotFound(_0x5a5c5b,null))[_0x2d63('0x29')](respondWithResult(_0x5a5c5b,null))[_0x2d63('0x4c')](handleError(_0x5a5c5b,null));};exports[_0x2d63('0x4d')]=function(_0x4cfc1a,_0x1d08d8){return db[_0x2d63('0x33')][_0x2d63('0x4d')](_0x4cfc1a[_0x2d63('0x4e')],{})[_0x2d63('0x29')](function(_0x576a51){var _0x5a5f22=_0x4cfc1a['user'][_0x2d63('0x2b')]({'plain':!![]});if(!_0x5a5f22)throw new Error(_0x2d63('0x4f'));if(_0x5a5f22[_0x2d63('0x50')]===_0x2d63('0x51')){var _0x4cee7d=_0x576a51[_0x2d63('0x2b')]({'plain':!![]});var _0x16e3c7=_0x2d63('0x2c');return db['UserProfileSection'][_0x2d63('0x4b')]({'where':{'name':_0x16e3c7,'userProfileId':_0x5a5f22[_0x2d63('0x52')]},'raw':!![]})[_0x2d63('0x29')](function(_0x2d926a){if(_0x2d926a&&_0x2d926a['autoAssociation']===0x0){return db[_0x2d63('0x53')][_0x2d63('0x4d')]({'name':_0x4cee7d[_0x2d63('0x2f')],'resourceId':_0x4cee7d['id'],'type':_0x2d926a[_0x2d63('0x2f')],'sectionId':_0x2d926a['id']},{})[_0x2d63('0x29')](function(){return _0x576a51;});}else{return _0x576a51;}})[_0x2d63('0x4c')](function(_0x5baa7a){logger[_0x2d63('0x2d')](_0x2d63('0x54'),_0x5baa7a);throw _0x5baa7a;});}return _0x576a51;})['then'](respondWithResult(_0x1d08d8,0xc9))['catch'](handleError(_0x1d08d8,null));};exports[_0x2d63('0x55')]=function(_0x89f507,_0x3b0497){if(_0x89f507[_0x2d63('0x4e')]['id']){delete _0x89f507[_0x2d63('0x4e')]['id'];}return db['Trigger'][_0x2d63('0x4b')]({'where':{'id':_0x89f507[_0x2d63('0x4a')]['id']}})[_0x2d63('0x29')](handleEntityNotFound(_0x3b0497,null))[_0x2d63('0x29')](saveUpdates(_0x89f507[_0x2d63('0x4e')],null))[_0x2d63('0x29')](respondWithResult(_0x3b0497,null))[_0x2d63('0x4c')](handleError(_0x3b0497,null));};exports[_0x2d63('0x2a')]=function(_0x357d4a,_0x3a69df){return db['Trigger'][_0x2d63('0x4b')]({'where':{'id':_0x357d4a['params']['id']}})[_0x2d63('0x29')](handleEntityNotFound(_0x3a69df,null))['then'](removeEntity(_0x3a69df,null))['catch'](handleError(_0x3a69df,null));};exports['addAllCondition']=function(_0x5e9ceb,_0x364415,_0x3dbd77){if(_0x5e9ceb[_0x2d63('0x4e')]['id']){delete _0x5e9ceb['body']['id'];}return db[_0x2d63('0x33')]['find']({'where':{'id':_0x5e9ceb[_0x2d63('0x4a')]['id']}})[_0x2d63('0x29')](handleEntityNotFound(_0x364415,null))[_0x2d63('0x29')](function(_0xf4356d){if(_0xf4356d){_0x5e9ceb[_0x2d63('0x4e')][_0x2d63('0x56')]=_0xf4356d['id'];return db['Condition'][_0x2d63('0x4d')](_0x5e9ceb[_0x2d63('0x4e')]);}})['then'](respondWithResult(_0x364415,null))[_0x2d63('0x4c')](handleError(_0x364415,null));};exports[_0x2d63('0x57')]=function(_0xa47ee9,_0x50344a,_0x6b22a8){if(_0xa47ee9['body']['id']){delete _0xa47ee9[_0x2d63('0x4e')]['id'];}return db[_0x2d63('0x33')][_0x2d63('0x4b')]({'where':{'id':_0xa47ee9['params']['id']}})[_0x2d63('0x29')](handleEntityNotFound(_0x50344a,null))['then'](function(_0x34f385){if(_0x34f385){_0xa47ee9[_0x2d63('0x4e')][_0x2d63('0x58')]=_0x34f385['id'];return db[_0x2d63('0x59')]['create'](_0xa47ee9[_0x2d63('0x4e')]);}})['then'](respondWithResult(_0x50344a,null))[_0x2d63('0x4c')](handleError(_0x50344a,null));};exports[_0x2d63('0x5a')]=function(_0x28383b,_0x457450,_0x338ecb){var _0x4bf464={};var _0x1e2a4e={};var _0x396aa0;var _0x5f10cd;return db[_0x2d63('0x33')][_0x2d63('0x5b')]({'where':{'id':_0x28383b[_0x2d63('0x4a')]['id']}})[_0x2d63('0x29')](handleEntityNotFound(_0x457450,null))[_0x2d63('0x29')](function(_0x4ebba6){if(_0x4ebba6){_0x396aa0=_0x4ebba6;_0x1e2a4e['model']=_[_0x2d63('0x39')](db[_0x2d63('0x59')]['rawAttributes']);_0x1e2a4e['query']=_[_0x2d63('0x39')](_0x28383b['query']);_0x1e2a4e['filters']=_['intersection'](_0x1e2a4e[_0x2d63('0x38')],_0x1e2a4e['query']);_0x4bf464[_0x2d63('0x3d')]=_[_0x2d63('0x3c')](_0x1e2a4e[_0x2d63('0x38')],qs[_0x2d63('0x3e')](_0x28383b[_0x2d63('0x3a')][_0x2d63('0x3e')]));_0x4bf464['attributes']=_0x4bf464[_0x2d63('0x3d')]['length']?_0x4bf464[_0x2d63('0x3d')]:_0x1e2a4e[_0x2d63('0x38')];_0x4bf464[_0x2d63('0x41')]=qs['sort'](_0x28383b[_0x2d63('0x3a')][_0x2d63('0x5c')]);_0x4bf464[_0x2d63('0x42')]=qs[_0x2d63('0x3b')](_[_0x2d63('0x5d')](_0x28383b['query'],_0x1e2a4e['filters']));if(_0x28383b['query'][_0x2d63('0x43')]){_0x4bf464[_0x2d63('0x42')]=_[_0x2d63('0x44')](_0x4bf464[_0x2d63('0x42')],{'$or':_[_0x2d63('0x32')](_0x4bf464[_0x2d63('0x3d')],function(_0x4997b6){var _0x1682e5={};_0x1682e5[_0x4997b6]={'$like':'%'+_0x28383b[_0x2d63('0x3a')][_0x2d63('0x43')]+'%'};return _0x1682e5;})});}_0x4bf464=_[_0x2d63('0x44')]({},_0x4bf464,_0x28383b[_0x2d63('0x45')]);return _0x396aa0['getAllConditions'](_0x4bf464);}})['then'](function(_0x2c598f){if(_0x2c598f){_0x5f10cd=_0x2c598f['length'];if(!_0x28383b[_0x2d63('0x3a')][_0x2d63('0x5e')](_0x2d63('0x40'))){_0x4bf464[_0x2d63('0x22')]=qs[_0x2d63('0x22')](_0x28383b['query'][_0x2d63('0x22')]);_0x4bf464[_0x2d63('0x21')]=qs[_0x2d63('0x21')](_0x28383b[_0x2d63('0x3a')]['offset']);}return _0x396aa0[_0x2d63('0x5a')](_0x4bf464);}})['then'](function(_0x849d32){if(_0x849d32){return _0x849d32?{'count':_0x5f10cd,'rows':_0x849d32}:null;}})[_0x2d63('0x29')](respondWithResult(_0x457450,null))[_0x2d63('0x4c')](handleError(_0x457450,null));};exports[_0x2d63('0x5f')]=function(_0x5b3b58,_0x115241,_0x8f660f){var _0x1f22e0={};var _0x1cf14c={};var _0x155993;var _0x15b31a;return db[_0x2d63('0x33')]['findOne']({'where':{'id':_0x5b3b58['params']['id']}})[_0x2d63('0x29')](handleEntityNotFound(_0x115241,null))[_0x2d63('0x29')](function(_0x1cfd83){if(_0x1cfd83){_0x155993=_0x1cfd83;_0x1cf14c[_0x2d63('0x38')]=_[_0x2d63('0x39')](db[_0x2d63('0x59')][_0x2d63('0x34')]);_0x1cf14c[_0x2d63('0x3a')]=_['keys'](_0x5b3b58['query']);_0x1cf14c[_0x2d63('0x3b')]=_[_0x2d63('0x3c')](_0x1cf14c[_0x2d63('0x38')],_0x1cf14c[_0x2d63('0x3a')]);_0x1f22e0[_0x2d63('0x3d')]=_[_0x2d63('0x3c')](_0x1cf14c[_0x2d63('0x38')],qs['fields'](_0x5b3b58[_0x2d63('0x3a')][_0x2d63('0x3e')]));_0x1f22e0[_0x2d63('0x3d')]=_0x1f22e0[_0x2d63('0x3d')][_0x2d63('0x3f')]?_0x1f22e0[_0x2d63('0x3d')]:_0x1cf14c[_0x2d63('0x38')];_0x1f22e0[_0x2d63('0x41')]=qs[_0x2d63('0x5c')](_0x5b3b58[_0x2d63('0x3a')]['sort']);_0x1f22e0[_0x2d63('0x42')]=qs['filters'](_['pick'](_0x5b3b58['query'],_0x1cf14c[_0x2d63('0x3b')]));if(_0x5b3b58[_0x2d63('0x3a')][_0x2d63('0x43')]){_0x1f22e0[_0x2d63('0x42')]=_['merge'](_0x1f22e0['where'],{'$or':_[_0x2d63('0x32')](_0x1f22e0[_0x2d63('0x3d')],function(_0x545096){var _0x59f92b={};_0x59f92b[_0x545096]={'$like':'%'+_0x5b3b58[_0x2d63('0x3a')][_0x2d63('0x43')]+'%'};return _0x59f92b;})});}_0x1f22e0=_['merge']({},_0x1f22e0,_0x5b3b58[_0x2d63('0x45')]);return _0x155993[_0x2d63('0x5f')](_0x1f22e0);}})['then'](function(_0x2c4c5c){if(_0x2c4c5c){_0x15b31a=_0x2c4c5c[_0x2d63('0x3f')];if(!_0x5b3b58[_0x2d63('0x3a')][_0x2d63('0x5e')](_0x2d63('0x40'))){_0x1f22e0[_0x2d63('0x22')]=qs['limit'](_0x5b3b58[_0x2d63('0x3a')]['limit']);_0x1f22e0['offset']=qs[_0x2d63('0x21')](_0x5b3b58[_0x2d63('0x3a')]['offset']);}return _0x155993[_0x2d63('0x5f')](_0x1f22e0);}})[_0x2d63('0x29')](function(_0x56505b){if(_0x56505b){return _0x56505b?{'count':_0x15b31a,'rows':_0x56505b}:null;}})[_0x2d63('0x29')](respondWithResult(_0x115241,null))['catch'](handleError(_0x115241,null));};exports[_0x2d63('0x60')]=function(_0xff329a,_0x524397,_0x5058b1){if(_0xff329a[_0x2d63('0x4e')]['id']){delete _0xff329a[_0x2d63('0x4e')]['id'];}return db[_0x2d63('0x33')]['find']({'where':{'id':_0xff329a[_0x2d63('0x4a')]['id']}})[_0x2d63('0x29')](handleEntityNotFound(_0x524397,null))[_0x2d63('0x29')](function(_0x515677){if(_0x515677){_0xff329a['body'][_0x2d63('0x61')]=_0x515677['id'];return db['Action'][_0x2d63('0x4d')](_0xff329a[_0x2d63('0x4e')]);}})[_0x2d63('0x29')](respondWithResult(_0x524397,null))[_0x2d63('0x4c')](handleError(_0x524397,null));};exports[_0x2d63('0x62')]=function(_0x5892bc,_0x5bdf36,_0x2aa92a){var _0x69d241={};var _0x5e06fc={};var _0x23bbb2;var _0x4c4c11;return db['Trigger'][_0x2d63('0x5b')]({'where':{'id':_0x5892bc[_0x2d63('0x4a')]['id']}})[_0x2d63('0x29')](handleEntityNotFound(_0x5bdf36,null))[_0x2d63('0x29')](function(_0x5b8453){if(_0x5b8453){_0x23bbb2=_0x5b8453;_0x5e06fc[_0x2d63('0x38')]=_[_0x2d63('0x39')](db[_0x2d63('0x63')][_0x2d63('0x34')]);_0x5e06fc['query']=_[_0x2d63('0x39')](_0x5892bc[_0x2d63('0x3a')]);_0x5e06fc[_0x2d63('0x3b')]=_[_0x2d63('0x3c')](_0x5e06fc[_0x2d63('0x38')],_0x5e06fc[_0x2d63('0x3a')]);_0x69d241[_0x2d63('0x3d')]=_[_0x2d63('0x3c')](_0x5e06fc[_0x2d63('0x38')],qs['fields'](_0x5892bc[_0x2d63('0x3a')][_0x2d63('0x3e')]));_0x69d241[_0x2d63('0x3d')]=_0x69d241['attributes'][_0x2d63('0x3f')]?_0x69d241['attributes']:_0x5e06fc[_0x2d63('0x38')];_0x69d241['order']=qs[_0x2d63('0x5c')](_0x5892bc[_0x2d63('0x3a')][_0x2d63('0x5c')]);_0x69d241[_0x2d63('0x42')]=qs['filters'](_[_0x2d63('0x5d')](_0x5892bc['query'],_0x5e06fc['filters']));if(_0x5892bc['query']['filter']){_0x69d241['where']=_[_0x2d63('0x44')](_0x69d241[_0x2d63('0x42')],{'$or':_[_0x2d63('0x32')](_0x69d241['attributes'],function(_0x37b796){var _0xbe5794={};_0xbe5794[_0x37b796]={'$like':'%'+_0x5892bc[_0x2d63('0x3a')][_0x2d63('0x43')]+'%'};return _0xbe5794;})});}_0x69d241=_[_0x2d63('0x44')]({},_0x69d241,_0x5892bc[_0x2d63('0x45')]);return _0x23bbb2[_0x2d63('0x62')](_0x69d241);}})['then'](function(_0x4d00be){if(_0x4d00be){_0x4c4c11=_0x4d00be[_0x2d63('0x3f')];if(!_0x5892bc[_0x2d63('0x3a')][_0x2d63('0x5e')](_0x2d63('0x40'))){_0x69d241['limit']=qs['limit'](_0x5892bc['query'][_0x2d63('0x22')]);_0x69d241[_0x2d63('0x21')]=qs[_0x2d63('0x21')](_0x5892bc[_0x2d63('0x3a')][_0x2d63('0x21')]);}return _0x23bbb2[_0x2d63('0x62')](_0x69d241);}})[_0x2d63('0x29')](function(_0xbe833){if(_0xbe833){return _0xbe833?{'count':_0x4c4c11,'rows':_0xbe833}:null;}})['then'](respondWithResult(_0x5bdf36,null))[_0x2d63('0x4c')](handleError(_0x5bdf36,null));}; \ No newline at end of file +var _0x2837=['params','include','options','catch','create','user','role','userProfileId','autoAssociation','update','body','find','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','findOne','Condition','getAllConditions','getAnyConditions','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','error','stack','name','index','map','Trigger','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','findAll','rows','show'];(function(_0x8554cf,_0x2b5759){var _0x1b3cca=function(_0x425fab){while(--_0x425fab){_0x8554cf['push'](_0x8554cf['shift']());}};_0x1b3cca(++_0x2b5759);}(_0x2837,0x17d));var _0x7283=function(_0x3c1050,_0x39965a){_0x3c1050=_0x3c1050-0x0;var _0x38e10e=_0x2837[_0x3c1050];return _0x38e10e;};'use strict';var emlformat=require(_0x7283('0x0'));var rimraf=require(_0x7283('0x1'));var zipdir=require(_0x7283('0x2'));var jsonpatch=require(_0x7283('0x3'));var rp=require(_0x7283('0x4'));var moment=require(_0x7283('0x5'));var BPromise=require(_0x7283('0x6'));var Mustache=require(_0x7283('0x7'));var util=require(_0x7283('0x8'));var path=require(_0x7283('0x9'));var sox=require(_0x7283('0xa'));var csv=require(_0x7283('0xb'));var ejs=require(_0x7283('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7283('0xd'));var deskjs=require(_0x7283('0xe'));var toCsv=require(_0x7283('0xb'));var querystring=require(_0x7283('0xf'));var Papa=require(_0x7283('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7283('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7283('0x12'))(_0x7283('0x13'));var utils=require('../../config/utils');var config=require(_0x7283('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7283('0x15'))['db'];function respondWithStatusCode(_0x312c7b,_0x49ad3c){_0x49ad3c=_0x49ad3c||0xcc;return function(_0x9cf58e){if(_0x9cf58e){return _0x312c7b[_0x7283('0x16')](_0x49ad3c);}return _0x312c7b[_0x7283('0x17')](_0x49ad3c)[_0x7283('0x18')]();};}function respondWithResult(_0x4a8b46,_0x20ee46){_0x20ee46=_0x20ee46||0xc8;return function(_0x1dc405){if(_0x1dc405){return _0x4a8b46[_0x7283('0x17')](_0x20ee46)[_0x7283('0x19')](_0x1dc405);}};}function respondWithFilteredResult(_0x5a95a3,_0x5d07c2){return function(_0x25c566){if(_0x25c566){var _0x5b795d=typeof _0x5d07c2[_0x7283('0x1a')]==='undefined'&&typeof _0x5d07c2[_0x7283('0x1b')]===_0x7283('0x1c');var _0x3896e3=_0x25c566['count'];var _0x39d598=_0x5b795d?0x0:_0x5d07c2[_0x7283('0x1a')];var _0x2a5fca=_0x5b795d?_0x25c566['count']:_0x5d07c2[_0x7283('0x1a')]+_0x5d07c2[_0x7283('0x1b')];var _0x39427a;if(_0x2a5fca>=_0x3896e3){_0x2a5fca=_0x3896e3;_0x39427a=0xc8;}else{_0x39427a=0xce;}_0x5a95a3[_0x7283('0x17')](_0x39427a);return _0x5a95a3[_0x7283('0x1d')](_0x7283('0x1e'),_0x39d598+'-'+_0x2a5fca+'/'+_0x3896e3)[_0x7283('0x19')](_0x25c566);}return null;};}function patchUpdates(_0x33424d){return function(_0x22ea14){try{jsonpatch[_0x7283('0x1f')](_0x22ea14,_0x33424d,!![]);}catch(_0x2907f7){return BPromise[_0x7283('0x20')](_0x2907f7);}return _0x22ea14[_0x7283('0x21')]();};}function saveUpdates(_0x3baed4,_0x1a0af5){return function(_0x2270a7){if(_0x2270a7){return _0x2270a7['update'](_0x3baed4)[_0x7283('0x22')](function(_0x46642e){return _0x46642e;});}return null;};}function removeEntity(_0xbce056,_0x11af6c){return function(_0x3d0667){if(_0x3d0667){return _0x3d0667[_0x7283('0x23')]()['then'](function(){var _0xfebdd1=_0x3d0667[_0x7283('0x24')]({'plain':!![]});var _0x338ced=_0x7283('0x25');return db[_0x7283('0x26')]['destroy']({'where':{'type':_0x338ced,'resourceId':_0xfebdd1['id']}})[_0x7283('0x22')](function(){return _0x3d0667;});})[_0x7283('0x22')](function(){_0xbce056[_0x7283('0x17')](0xcc)[_0x7283('0x18')]();});}};}function handleEntityNotFound(_0x3dfe01,_0x3f4b62){return function(_0x501f4c){if(!_0x501f4c){_0x3dfe01[_0x7283('0x16')](0x194);}return _0x501f4c;};}function handleError(_0x23dafe,_0x41bd16){_0x41bd16=_0x41bd16||0x1f4;return function(_0x2d94bd){logger[_0x7283('0x27')](_0x2d94bd[_0x7283('0x28')]);if(_0x2d94bd[_0x7283('0x29')]){delete _0x2d94bd[_0x7283('0x29')];}_0x23dafe[_0x7283('0x17')](_0x41bd16)['send'](_0x2d94bd);};}exports[_0x7283('0x2a')]=function(_0x1eaf60,_0x1a59f4){var _0x3fa15c={},_0x3d14d4={},_0x293fdc={'count':0x0,'rows':[]};var _0x4825d8=_[_0x7283('0x2b')](db[_0x7283('0x2c')][_0x7283('0x2d')],function(_0x5d2be4){return{'name':_0x5d2be4['fieldName'],'type':_0x5d2be4[_0x7283('0x2e')]['key']};});_0x3d14d4[_0x7283('0x2f')]=_[_0x7283('0x2b')](_0x4825d8,_0x7283('0x29'));_0x3d14d4[_0x7283('0x30')]=_[_0x7283('0x31')](_0x1eaf60['query']);_0x3d14d4[_0x7283('0x32')]=_[_0x7283('0x33')](_0x3d14d4['model'],_0x3d14d4[_0x7283('0x30')]);_0x3fa15c[_0x7283('0x34')]=_['intersection'](_0x3d14d4['model'],qs['fields'](_0x1eaf60['query'][_0x7283('0x35')]));_0x3fa15c[_0x7283('0x34')]=_0x3fa15c['attributes'][_0x7283('0x36')]?_0x3fa15c['attributes']:_0x3d14d4['model'];if(!_0x1eaf60[_0x7283('0x30')][_0x7283('0x37')](_0x7283('0x38'))){_0x3fa15c[_0x7283('0x1b')]=qs[_0x7283('0x1b')](_0x1eaf60[_0x7283('0x30')][_0x7283('0x1b')]);_0x3fa15c['offset']=qs['offset'](_0x1eaf60[_0x7283('0x30')][_0x7283('0x1a')]);}_0x3fa15c[_0x7283('0x39')]=qs[_0x7283('0x3a')](_0x1eaf60[_0x7283('0x30')][_0x7283('0x3a')]);_0x3fa15c[_0x7283('0x3b')]=qs[_0x7283('0x32')](_[_0x7283('0x3c')](_0x1eaf60[_0x7283('0x30')],_0x3d14d4[_0x7283('0x32')]),_0x4825d8);if(_0x1eaf60['query'][_0x7283('0x3d')]){_0x3fa15c[_0x7283('0x3b')]=_['merge'](_0x3fa15c['where'],{'$or':_[_0x7283('0x2b')](_0x4825d8,function(_0x56ff49){if(_0x56ff49[_0x7283('0x2e')]!==_0x7283('0x3e')){var _0x252df7={};_0x252df7[_0x56ff49[_0x7283('0x29')]]={'$like':'%'+_0x1eaf60[_0x7283('0x30')][_0x7283('0x3d')]+'%'};return _0x252df7;}})});}_0x3fa15c=_[_0x7283('0x3f')]({},_0x3fa15c,_0x1eaf60['options']);var _0x54179f={'where':_0x3fa15c['where']};return db[_0x7283('0x2c')][_0x7283('0x40')](_0x54179f)[_0x7283('0x22')](function(_0xd4004c){_0x293fdc[_0x7283('0x40')]=_0xd4004c;if(_0x1eaf60['query'][_0x7283('0x41')]){_0x3fa15c['include']=[{'all':!![]}];}return db['Trigger'][_0x7283('0x42')](_0x3fa15c);})[_0x7283('0x22')](function(_0x26aec9){_0x293fdc[_0x7283('0x43')]=_0x26aec9;return _0x293fdc;})[_0x7283('0x22')](respondWithFilteredResult(_0x1a59f4,_0x3fa15c))['catch'](handleError(_0x1a59f4,null));};exports[_0x7283('0x44')]=function(_0x2507e0,_0x59fcde){var _0x534b89={'raw':![],'where':{'id':_0x2507e0[_0x7283('0x45')]['id']}},_0x1f3c66={};_0x1f3c66['model']=_[_0x7283('0x31')](db['Trigger']['rawAttributes']);_0x1f3c66[_0x7283('0x30')]=_[_0x7283('0x31')](_0x2507e0[_0x7283('0x30')]);_0x1f3c66[_0x7283('0x32')]=_[_0x7283('0x33')](_0x1f3c66[_0x7283('0x2f')],_0x1f3c66['query']);_0x534b89['attributes']=_[_0x7283('0x33')](_0x1f3c66['model'],qs[_0x7283('0x35')](_0x2507e0[_0x7283('0x30')][_0x7283('0x35')]));_0x534b89['attributes']=_0x534b89['attributes'][_0x7283('0x36')]?_0x534b89[_0x7283('0x34')]:_0x1f3c66[_0x7283('0x2f')];if(_0x2507e0['query'][_0x7283('0x41')]){_0x534b89[_0x7283('0x46')]=[{'all':!![]}];}_0x534b89=_[_0x7283('0x3f')]({},_0x534b89,_0x2507e0[_0x7283('0x47')]);return db[_0x7283('0x2c')]['find'](_0x534b89)['then'](handleEntityNotFound(_0x59fcde,null))['then'](respondWithResult(_0x59fcde,null))[_0x7283('0x48')](handleError(_0x59fcde,null));};exports[_0x7283('0x49')]=function(_0x25cf2c,_0x963641){return db[_0x7283('0x2c')][_0x7283('0x49')](_0x25cf2c['body'],{})['then'](function(_0x4c7c2e){var _0x415bb0=_0x25cf2c[_0x7283('0x4a')][_0x7283('0x24')]({'plain':!![]});if(!_0x415bb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x415bb0[_0x7283('0x4b')]===_0x7283('0x4a')){var _0x3cec6b=_0x4c7c2e[_0x7283('0x24')]({'plain':!![]});var _0x4b9f3f=_0x7283('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x4b9f3f,'userProfileId':_0x415bb0[_0x7283('0x4c')]},'raw':!![]})[_0x7283('0x22')](function(_0x3f2077){if(_0x3f2077&&_0x3f2077[_0x7283('0x4d')]===0x0){return db[_0x7283('0x26')][_0x7283('0x49')]({'name':_0x3cec6b[_0x7283('0x29')],'resourceId':_0x3cec6b['id'],'type':_0x3f2077[_0x7283('0x29')],'sectionId':_0x3f2077['id']},{})[_0x7283('0x22')](function(){return _0x4c7c2e;});}else{return _0x4c7c2e;}})[_0x7283('0x48')](function(_0xc879a6){logger[_0x7283('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc879a6);throw _0xc879a6;});}return _0x4c7c2e;})[_0x7283('0x22')](respondWithResult(_0x963641,0xc9))[_0x7283('0x48')](handleError(_0x963641,null));};exports[_0x7283('0x4e')]=function(_0x37dcb7,_0x3d72af){if(_0x37dcb7[_0x7283('0x4f')]['id']){delete _0x37dcb7[_0x7283('0x4f')]['id'];}return db[_0x7283('0x2c')][_0x7283('0x50')]({'where':{'id':_0x37dcb7[_0x7283('0x45')]['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x3d72af,null))[_0x7283('0x22')](saveUpdates(_0x37dcb7[_0x7283('0x4f')],null))[_0x7283('0x22')](respondWithResult(_0x3d72af,null))[_0x7283('0x48')](handleError(_0x3d72af,null));};exports[_0x7283('0x23')]=function(_0x392e75,_0x2d1e73){return db[_0x7283('0x2c')]['find']({'where':{'id':_0x392e75['params']['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x2d1e73,null))['then'](removeEntity(_0x2d1e73,null))[_0x7283('0x48')](handleError(_0x2d1e73,null));};exports[_0x7283('0x51')]=function(_0x59a60e,_0x53447c,_0x55fa6f){if(_0x59a60e[_0x7283('0x4f')]['id']){delete _0x59a60e[_0x7283('0x4f')]['id'];}return db[_0x7283('0x2c')][_0x7283('0x50')]({'where':{'id':_0x59a60e['params']['id']}})['then'](handleEntityNotFound(_0x53447c,null))[_0x7283('0x22')](function(_0x5c2444){if(_0x5c2444){_0x59a60e[_0x7283('0x4f')][_0x7283('0x52')]=_0x5c2444['id'];return db['Condition'][_0x7283('0x49')](_0x59a60e[_0x7283('0x4f')]);}})[_0x7283('0x22')](respondWithResult(_0x53447c,null))[_0x7283('0x48')](handleError(_0x53447c,null));};exports[_0x7283('0x53')]=function(_0x496318,_0x2c7bca,_0x253159){if(_0x496318['body']['id']){delete _0x496318['body']['id'];}return db[_0x7283('0x2c')][_0x7283('0x50')]({'where':{'id':_0x496318[_0x7283('0x45')]['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x2c7bca,null))[_0x7283('0x22')](function(_0x4bc692){if(_0x4bc692){_0x496318[_0x7283('0x4f')][_0x7283('0x54')]=_0x4bc692['id'];return db['Condition'][_0x7283('0x49')](_0x496318['body']);}})[_0x7283('0x22')](respondWithResult(_0x2c7bca,null))[_0x7283('0x48')](handleError(_0x2c7bca,null));};exports['getAllConditions']=function(_0x190faf,_0x2a3cba,_0x4f2a1c){var _0x1cf099={};var _0x432c2f={};var _0x3e7d91;var _0x4ec5b6;return db['Trigger'][_0x7283('0x55')]({'where':{'id':_0x190faf[_0x7283('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a3cba,null))[_0x7283('0x22')](function(_0x2b2bfd){if(_0x2b2bfd){_0x3e7d91=_0x2b2bfd;_0x432c2f[_0x7283('0x2f')]=_[_0x7283('0x31')](db[_0x7283('0x56')][_0x7283('0x2d')]);_0x432c2f[_0x7283('0x30')]=_[_0x7283('0x31')](_0x190faf[_0x7283('0x30')]);_0x432c2f[_0x7283('0x32')]=_[_0x7283('0x33')](_0x432c2f[_0x7283('0x2f')],_0x432c2f['query']);_0x1cf099['attributes']=_['intersection'](_0x432c2f[_0x7283('0x2f')],qs[_0x7283('0x35')](_0x190faf[_0x7283('0x30')][_0x7283('0x35')]));_0x1cf099[_0x7283('0x34')]=_0x1cf099[_0x7283('0x34')][_0x7283('0x36')]?_0x1cf099['attributes']:_0x432c2f[_0x7283('0x2f')];_0x1cf099[_0x7283('0x39')]=qs['sort'](_0x190faf[_0x7283('0x30')]['sort']);_0x1cf099[_0x7283('0x3b')]=qs[_0x7283('0x32')](_[_0x7283('0x3c')](_0x190faf[_0x7283('0x30')],_0x432c2f[_0x7283('0x32')]));if(_0x190faf[_0x7283('0x30')]['filter']){_0x1cf099[_0x7283('0x3b')]=_[_0x7283('0x3f')](_0x1cf099['where'],{'$or':_[_0x7283('0x2b')](_0x1cf099['attributes'],function(_0x159cab){var _0x86b555={};_0x86b555[_0x159cab]={'$like':'%'+_0x190faf[_0x7283('0x30')][_0x7283('0x3d')]+'%'};return _0x86b555;})});}_0x1cf099=_['merge']({},_0x1cf099,_0x190faf[_0x7283('0x47')]);return _0x3e7d91[_0x7283('0x57')](_0x1cf099);}})['then'](function(_0x3f2520){if(_0x3f2520){_0x4ec5b6=_0x3f2520[_0x7283('0x36')];if(!_0x190faf[_0x7283('0x30')][_0x7283('0x37')](_0x7283('0x38'))){_0x1cf099['limit']=qs[_0x7283('0x1b')](_0x190faf['query'][_0x7283('0x1b')]);_0x1cf099[_0x7283('0x1a')]=qs[_0x7283('0x1a')](_0x190faf[_0x7283('0x30')]['offset']);}return _0x3e7d91[_0x7283('0x57')](_0x1cf099);}})[_0x7283('0x22')](function(_0x53d656){if(_0x53d656){return _0x53d656?{'count':_0x4ec5b6,'rows':_0x53d656}:null;}})[_0x7283('0x22')](respondWithResult(_0x2a3cba,null))['catch'](handleError(_0x2a3cba,null));};exports[_0x7283('0x58')]=function(_0x1fb056,_0x327c7f,_0x1ff404){var _0x306d8b={};var _0x4f78f5={};var _0x4c8eaf;var _0x2b114d;return db[_0x7283('0x2c')]['findOne']({'where':{'id':_0x1fb056[_0x7283('0x45')]['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x327c7f,null))[_0x7283('0x22')](function(_0x3642eb){if(_0x3642eb){_0x4c8eaf=_0x3642eb;_0x4f78f5[_0x7283('0x2f')]=_[_0x7283('0x31')](db[_0x7283('0x56')][_0x7283('0x2d')]);_0x4f78f5[_0x7283('0x30')]=_[_0x7283('0x31')](_0x1fb056[_0x7283('0x30')]);_0x4f78f5[_0x7283('0x32')]=_['intersection'](_0x4f78f5[_0x7283('0x2f')],_0x4f78f5[_0x7283('0x30')]);_0x306d8b[_0x7283('0x34')]=_['intersection'](_0x4f78f5['model'],qs['fields'](_0x1fb056[_0x7283('0x30')]['fields']));_0x306d8b[_0x7283('0x34')]=_0x306d8b['attributes'][_0x7283('0x36')]?_0x306d8b[_0x7283('0x34')]:_0x4f78f5['model'];_0x306d8b['order']=qs[_0x7283('0x3a')](_0x1fb056['query']['sort']);_0x306d8b[_0x7283('0x3b')]=qs[_0x7283('0x32')](_[_0x7283('0x3c')](_0x1fb056['query'],_0x4f78f5[_0x7283('0x32')]));if(_0x1fb056[_0x7283('0x30')]['filter']){_0x306d8b[_0x7283('0x3b')]=_[_0x7283('0x3f')](_0x306d8b[_0x7283('0x3b')],{'$or':_[_0x7283('0x2b')](_0x306d8b[_0x7283('0x34')],function(_0x5b7406){var _0x5d6eaf={};_0x5d6eaf[_0x5b7406]={'$like':'%'+_0x1fb056[_0x7283('0x30')]['filter']+'%'};return _0x5d6eaf;})});}_0x306d8b=_['merge']({},_0x306d8b,_0x1fb056[_0x7283('0x47')]);return _0x4c8eaf['getAnyConditions'](_0x306d8b);}})[_0x7283('0x22')](function(_0x492d0e){if(_0x492d0e){_0x2b114d=_0x492d0e[_0x7283('0x36')];if(!_0x1fb056['query']['hasOwnProperty']('nolimit')){_0x306d8b['limit']=qs['limit'](_0x1fb056['query'][_0x7283('0x1b')]);_0x306d8b[_0x7283('0x1a')]=qs[_0x7283('0x1a')](_0x1fb056[_0x7283('0x30')][_0x7283('0x1a')]);}return _0x4c8eaf[_0x7283('0x58')](_0x306d8b);}})[_0x7283('0x22')](function(_0x24b507){if(_0x24b507){return _0x24b507?{'count':_0x2b114d,'rows':_0x24b507}:null;}})[_0x7283('0x22')](respondWithResult(_0x327c7f,null))[_0x7283('0x48')](handleError(_0x327c7f,null));};exports['addAction']=function(_0x440aaa,_0x232543,_0x36bfac){if(_0x440aaa[_0x7283('0x4f')]['id']){delete _0x440aaa['body']['id'];}return db[_0x7283('0x2c')]['find']({'where':{'id':_0x440aaa[_0x7283('0x45')]['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x232543,null))['then'](function(_0xad61e5){if(_0xad61e5){_0x440aaa[_0x7283('0x4f')]['TriggerId']=_0xad61e5['id'];return db['Action'][_0x7283('0x49')](_0x440aaa[_0x7283('0x4f')]);}})['then'](respondWithResult(_0x232543,null))[_0x7283('0x48')](handleError(_0x232543,null));};exports[_0x7283('0x59')]=function(_0x488bca,_0x268fac,_0x31de1f){var _0x4ec274={};var _0x392bf1={};var _0x5d73bc;var _0x2eb170;return db[_0x7283('0x2c')][_0x7283('0x55')]({'where':{'id':_0x488bca[_0x7283('0x45')]['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x268fac,null))[_0x7283('0x22')](function(_0x5a7c20){if(_0x5a7c20){_0x5d73bc=_0x5a7c20;_0x392bf1[_0x7283('0x2f')]=_[_0x7283('0x31')](db['Action'][_0x7283('0x2d')]);_0x392bf1[_0x7283('0x30')]=_['keys'](_0x488bca[_0x7283('0x30')]);_0x392bf1['filters']=_[_0x7283('0x33')](_0x392bf1[_0x7283('0x2f')],_0x392bf1[_0x7283('0x30')]);_0x4ec274['attributes']=_[_0x7283('0x33')](_0x392bf1['model'],qs[_0x7283('0x35')](_0x488bca['query'][_0x7283('0x35')]));_0x4ec274[_0x7283('0x34')]=_0x4ec274[_0x7283('0x34')][_0x7283('0x36')]?_0x4ec274[_0x7283('0x34')]:_0x392bf1['model'];_0x4ec274[_0x7283('0x39')]=qs[_0x7283('0x3a')](_0x488bca[_0x7283('0x30')][_0x7283('0x3a')]);_0x4ec274[_0x7283('0x3b')]=qs['filters'](_[_0x7283('0x3c')](_0x488bca[_0x7283('0x30')],_0x392bf1[_0x7283('0x32')]));if(_0x488bca[_0x7283('0x30')][_0x7283('0x3d')]){_0x4ec274[_0x7283('0x3b')]=_[_0x7283('0x3f')](_0x4ec274[_0x7283('0x3b')],{'$or':_[_0x7283('0x2b')](_0x4ec274['attributes'],function(_0x1466f6){var _0x438c35={};_0x438c35[_0x1466f6]={'$like':'%'+_0x488bca[_0x7283('0x30')][_0x7283('0x3d')]+'%'};return _0x438c35;})});}_0x4ec274=_[_0x7283('0x3f')]({},_0x4ec274,_0x488bca[_0x7283('0x47')]);return _0x5d73bc['getActions'](_0x4ec274);}})['then'](function(_0x2cc9e4){if(_0x2cc9e4){_0x2eb170=_0x2cc9e4[_0x7283('0x36')];if(!_0x488bca[_0x7283('0x30')][_0x7283('0x37')](_0x7283('0x38'))){_0x4ec274[_0x7283('0x1b')]=qs[_0x7283('0x1b')](_0x488bca[_0x7283('0x30')][_0x7283('0x1b')]);_0x4ec274[_0x7283('0x1a')]=qs[_0x7283('0x1a')](_0x488bca[_0x7283('0x30')][_0x7283('0x1a')]);}return _0x5d73bc[_0x7283('0x59')](_0x4ec274);}})['then'](function(_0x19f7b6){if(_0x19f7b6){return _0x19f7b6?{'count':_0x2eb170,'rows':_0x19f7b6}:null;}})[_0x7283('0x22')](respondWithResult(_0x268fac,null))[_0x7283('0x48')](handleError(_0x268fac,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d800711..ade82a4 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 _0x3379=['exports','Trigger','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./trigger.attributes'];(function(_0x323dcc,_0x188149){var _0x48b0e2=function(_0x576ea3){while(--_0x576ea3){_0x323dcc['push'](_0x323dcc['shift']());}};_0x48b0e2(++_0x188149);}(_0x3379,0x115));var _0x9337=function(_0x579fe1,_0x25a28e){_0x579fe1=_0x579fe1-0x0;var _0x1e56b1=_0x3379[_0x579fe1];return _0x1e56b1;};'use strict';var _=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var logger=require(_0x9337('0x2'))(_0x9337('0x3'));var moment=require('moment');var BPromise=require(_0x9337('0x4'));var rp=require(_0x9337('0x5'));var fs=require('fs');var path=require(_0x9337('0x6'));var rimraf=require(_0x9337('0x7'));var config=require('../../config/environment');var attributes=require(_0x9337('0x8'));module[_0x9337('0x9')]=function(_0x390772,_0x677c38){return _0x390772['define'](_0x9337('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6658=['../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x417baa,_0x3923d0){var _0x42724f=function(_0x276146){while(--_0x276146){_0x417baa['push'](_0x417baa['shift']());}};_0x42724f(++_0x3923d0);}(_0x6658,0x198));var _0x8665=function(_0x5cf2ab,_0x4fcdcc){_0x5cf2ab=_0x5cf2ab-0x0;var _0x2270dc=_0x6658[_0x5cf2ab];return _0x2270dc;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var logger=require(_0x8665('0x2'))(_0x8665('0x3'));var moment=require(_0x8665('0x4'));var BPromise=require(_0x8665('0x5'));var rp=require(_0x8665('0x6'));var fs=require('fs');var path=require(_0x8665('0x7'));var rimraf=require('rimraf');var config=require(_0x8665('0x8'));var attributes=require(_0x8665('0x9'));module['exports']=function(_0x562829,_0x203780){return _0x562829[_0x8665('0xa')](_0x8665('0xb'),attributes,{'tableName':_0x8665('0xc'),'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 67886da..11dc300 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 _0xe6dd=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3cc60c,_0x33f0d2){var _0x52c2b4=function(_0x4ec915){while(--_0x4ec915){_0x3cc60c['push'](_0x3cc60c['shift']());}};_0x52c2b4(++_0x33f0d2);}(_0xe6dd,0x8c));var _0xde6d=function(_0x4bd08c,_0x1e40e0){_0x4bd08c=_0x4bd08c-0x0;var _0x1018b8=_0xe6dd[_0x4bd08c];return _0x1018b8;};'use strict';var _=require(_0xde6d('0x0'));var util=require(_0xde6d('0x1'));var moment=require(_0xde6d('0x2'));var BPromise=require(_0xde6d('0x3'));var rs=require(_0xde6d('0x4'));var fs=require('fs');var Redis=require(_0xde6d('0x5'));var db=require(_0xde6d('0x6'))['db'];var utils=require(_0xde6d('0x7'));var logger=require(_0xde6d('0x8'))(_0xde6d('0x9'));var config=require('../../config/environment');var jayson=require(_0xde6d('0xa'));var client=jayson[_0xde6d('0xb')][_0xde6d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c1b07,_0xfbbb2c,_0x2d8c5b){return new BPromise(function(_0x270ee6,_0x3485ba){return client[_0xde6d('0xd')](_0x4c1b07,_0x2d8c5b)[_0xde6d('0xe')](function(_0x25aa41){logger[_0xde6d('0xf')](_0xde6d('0x10'),_0xfbbb2c,'request\x20sent');logger[_0xde6d('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0xfbbb2c,_0xde6d('0x12'),JSON[_0xde6d('0x13')](_0x25aa41));if(_0x25aa41[_0xde6d('0x14')]){if(_0x25aa41[_0xde6d('0x14')]['code']===0x1f4){logger[_0xde6d('0x14')](_0xde6d('0x10'),_0xfbbb2c,_0x25aa41[_0xde6d('0x14')][_0xde6d('0x15')]);return _0x3485ba(_0x25aa41['error'][_0xde6d('0x15')]);}logger[_0xde6d('0x14')](_0xde6d('0x10'),_0xfbbb2c,_0x25aa41['error']['message']);return _0x270ee6(_0x25aa41['error'][_0xde6d('0x15')]);}else{logger[_0xde6d('0xf')]('Trigger,\x20%s,\x20%s',_0xfbbb2c,_0xde6d('0x12'));_0x270ee6(_0x25aa41[_0xde6d('0x16')][_0xde6d('0x15')]);}})[_0xde6d('0x17')](function(_0x4b90d8){logger[_0xde6d('0x14')]('Trigger,\x20%s,\x20%s',_0xfbbb2c,_0x4b90d8);_0x3485ba(_0x4b90d8);});});}exports[_0xde6d('0x18')]=function(_0x376dfa){var _0x39a63e=this;return new Promise(function(_0x558493,_0x394d47){return db[_0xde6d('0x19')][_0xde6d('0x1a')]({'raw':_0x376dfa[_0xde6d('0x1b')]?_0x376dfa['options'][_0xde6d('0x1c')]===undefined?!![]:![]:!![],'where':_0x376dfa['options']?_0x376dfa['options'][_0xde6d('0x1d')]||null:null,'attributes':_0x376dfa[_0xde6d('0x1b')]?_0x376dfa['options'][_0xde6d('0x1e')]||null:null,'limit':_0x376dfa[_0xde6d('0x1b')]?_0x376dfa['options'][_0xde6d('0x1f')]||null:null,'include':_0x376dfa['options']?_0x376dfa[_0xde6d('0x1b')][_0xde6d('0x20')]?_['map'](_0x376dfa[_0xde6d('0x1b')]['include'],function(_0x532241){return{'model':db[_0x532241[_0xde6d('0x21')]],'as':_0x532241['as'],'attributes':_0x532241[_0xde6d('0x1e')],'include':_0x532241[_0xde6d('0x20')]?_[_0xde6d('0x22')](_0x532241[_0xde6d('0x20')],function(_0x46aeab){return{'model':db[_0x46aeab[_0xde6d('0x21')]],'as':_0x46aeab['as'],'attributes':_0x46aeab[_0xde6d('0x1e')],'include':_0x46aeab[_0xde6d('0x20')]?_[_0xde6d('0x22')](_0x46aeab[_0xde6d('0x20')],function(_0x51236c){return{'model':db[_0x51236c[_0xde6d('0x21')]],'as':_0x51236c['as'],'attributes':_0x51236c[_0xde6d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde6d('0xe')](function(_0x58f80c){logger[_0xde6d('0xf')](_0xde6d('0x18'),_0x376dfa);logger[_0xde6d('0x11')](_0xde6d('0x18'),_0x376dfa,JSON[_0xde6d('0x13')](_0x58f80c));_0x558493(_0x58f80c);})[_0xde6d('0x17')](function(_0x22e17d){logger[_0xde6d('0x14')](_0xde6d('0x18'),_0x22e17d[_0xde6d('0x15')],_0x376dfa);_0x394d47(_0x39a63e[_0xde6d('0x14')](0x1f4,_0x22e17d[_0xde6d('0x15')]));});});};exports[_0xde6d('0x23')]=function(_0x4d23e4){var _0x334e02=this;return new Promise(function(_0x44757a,_0xb835f6){return db[_0xde6d('0x19')][_0xde6d('0x24')]({'raw':_0x4d23e4[_0xde6d('0x1b')]?_0x4d23e4[_0xde6d('0x1b')][_0xde6d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d23e4['options']?_0x4d23e4[_0xde6d('0x1b')][_0xde6d('0x1d')]||null:null,'attributes':_0x4d23e4[_0xde6d('0x1b')]?_0x4d23e4[_0xde6d('0x1b')][_0xde6d('0x1e')]||null:null,'include':_0x4d23e4[_0xde6d('0x1b')]?_0x4d23e4[_0xde6d('0x1b')][_0xde6d('0x20')]?_[_0xde6d('0x22')](_0x4d23e4['options'][_0xde6d('0x20')],function(_0x195f72){return{'model':db[_0x195f72[_0xde6d('0x21')]],'as':_0x195f72['as'],'attributes':_0x195f72[_0xde6d('0x1e')],'include':_0x195f72['include']?_[_0xde6d('0x22')](_0x195f72[_0xde6d('0x20')],function(_0x4f3621){return{'model':db[_0x4f3621[_0xde6d('0x21')]],'as':_0x4f3621['as'],'attributes':_0x4f3621['attributes'],'include':_0x4f3621[_0xde6d('0x20')]?_[_0xde6d('0x22')](_0x4f3621[_0xde6d('0x20')],function(_0x1be628){return{'model':db[_0x1be628['model']],'as':_0x1be628['as'],'attributes':_0x1be628[_0xde6d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31139e){logger[_0xde6d('0xf')](_0xde6d('0x23'),_0x4d23e4);logger['debug']('ShowTrigger',_0x4d23e4,JSON['stringify'](_0x31139e));_0x44757a(_0x31139e);})[_0xde6d('0x17')](function(_0xfa0ffc){logger[_0xde6d('0x14')](_0xde6d('0x23'),_0xfa0ffc[_0xde6d('0x15')],_0x4d23e4);_0xb835f6(_0x334e02['error'](0x1f4,_0xfa0ffc[_0xde6d('0x15')]));});});}; \ No newline at end of file +var _0x9571=['Trigger','options','raw','where','attributes','limit','map','include','model','ShowTrigger','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','catch','GetTrigger'];(function(_0x3eb2bb,_0x84b81d){var _0x4e38d6=function(_0x7a21b1){while(--_0x7a21b1){_0x3eb2bb['push'](_0x3eb2bb['shift']());}};_0x4e38d6(++_0x84b81d);}(_0x9571,0x11b));var _0x1957=function(_0x34a6e9,_0x25cabe){_0x34a6e9=_0x34a6e9-0x0;var _0x11015c=_0x9571[_0x34a6e9];return _0x11015c;};'use strict';var _=require('lodash');var util=require(_0x1957('0x0'));var moment=require(_0x1957('0x1'));var BPromise=require(_0x1957('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1957('0x3'));var db=require(_0x1957('0x4'))['db'];var utils=require(_0x1957('0x5'));var logger=require(_0x1957('0x6'))(_0x1957('0x7'));var config=require(_0x1957('0x8'));var jayson=require(_0x1957('0x9'));var client=jayson['client'][_0x1957('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b7f83,_0x38ae1d,_0x53305b){return new BPromise(function(_0x1e9b78,_0x5c5297){return client['request'](_0x1b7f83,_0x53305b)[_0x1957('0xb')](function(_0x245a65){logger[_0x1957('0xc')]('Trigger,\x20%s,\x20%s',_0x38ae1d,'request\x20sent');logger[_0x1957('0xd')](_0x1957('0xe'),_0x38ae1d,_0x1957('0xf'),JSON[_0x1957('0x10')](_0x245a65));if(_0x245a65[_0x1957('0x11')]){if(_0x245a65[_0x1957('0x11')][_0x1957('0x12')]===0x1f4){logger['error'](_0x1957('0x13'),_0x38ae1d,_0x245a65[_0x1957('0x11')]['message']);return _0x5c5297(_0x245a65[_0x1957('0x11')][_0x1957('0x14')]);}logger[_0x1957('0x11')](_0x1957('0x13'),_0x38ae1d,_0x245a65[_0x1957('0x11')][_0x1957('0x14')]);return _0x1e9b78(_0x245a65[_0x1957('0x11')]['message']);}else{logger[_0x1957('0xc')]('Trigger,\x20%s,\x20%s',_0x38ae1d,_0x1957('0xf'));_0x1e9b78(_0x245a65['result'][_0x1957('0x14')]);}})[_0x1957('0x15')](function(_0x1d04fa){logger['error'](_0x1957('0x13'),_0x38ae1d,_0x1d04fa);_0x5c5297(_0x1d04fa);});});}exports[_0x1957('0x16')]=function(_0x2929ba){var _0x242474=this;return new Promise(function(_0xcfb9cc,_0x22cf26){return db[_0x1957('0x17')]['findAll']({'raw':_0x2929ba[_0x1957('0x18')]?_0x2929ba['options'][_0x1957('0x19')]===undefined?!![]:![]:!![],'where':_0x2929ba[_0x1957('0x18')]?_0x2929ba[_0x1957('0x18')][_0x1957('0x1a')]||null:null,'attributes':_0x2929ba[_0x1957('0x18')]?_0x2929ba[_0x1957('0x18')][_0x1957('0x1b')]||null:null,'limit':_0x2929ba[_0x1957('0x18')]?_0x2929ba['options'][_0x1957('0x1c')]||null:null,'include':_0x2929ba[_0x1957('0x18')]?_0x2929ba[_0x1957('0x18')]['include']?_[_0x1957('0x1d')](_0x2929ba[_0x1957('0x18')][_0x1957('0x1e')],function(_0x102887){return{'model':db[_0x102887[_0x1957('0x1f')]],'as':_0x102887['as'],'attributes':_0x102887[_0x1957('0x1b')],'include':_0x102887[_0x1957('0x1e')]?_[_0x1957('0x1d')](_0x102887[_0x1957('0x1e')],function(_0x1a1c13){return{'model':db[_0x1a1c13[_0x1957('0x1f')]],'as':_0x1a1c13['as'],'attributes':_0x1a1c13['attributes'],'include':_0x1a1c13[_0x1957('0x1e')]?_[_0x1957('0x1d')](_0x1a1c13[_0x1957('0x1e')],function(_0x26f67b){return{'model':db[_0x26f67b['model']],'as':_0x26f67b['as'],'attributes':_0x26f67b[_0x1957('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb93eba){logger[_0x1957('0xc')](_0x1957('0x16'),_0x2929ba);logger[_0x1957('0xd')](_0x1957('0x16'),_0x2929ba,JSON['stringify'](_0xb93eba));_0xcfb9cc(_0xb93eba);})['catch'](function(_0x3e0d97){logger[_0x1957('0x11')]('GetTrigger',_0x3e0d97[_0x1957('0x14')],_0x2929ba);_0x22cf26(_0x242474[_0x1957('0x11')](0x1f4,_0x3e0d97[_0x1957('0x14')]));});});};exports[_0x1957('0x20')]=function(_0xdd5325){var _0x3ea679=this;return new Promise(function(_0x54ef64,_0x1bade5){return db['Trigger'][_0x1957('0x21')]({'raw':_0xdd5325[_0x1957('0x18')]?_0xdd5325[_0x1957('0x18')][_0x1957('0x19')]===undefined?!![]:![]:!![],'where':_0xdd5325[_0x1957('0x18')]?_0xdd5325[_0x1957('0x18')][_0x1957('0x1a')]||null:null,'attributes':_0xdd5325[_0x1957('0x18')]?_0xdd5325[_0x1957('0x18')][_0x1957('0x1b')]||null:null,'include':_0xdd5325[_0x1957('0x18')]?_0xdd5325[_0x1957('0x18')][_0x1957('0x1e')]?_[_0x1957('0x1d')](_0xdd5325[_0x1957('0x18')]['include'],function(_0x85e7dd){return{'model':db[_0x85e7dd[_0x1957('0x1f')]],'as':_0x85e7dd['as'],'attributes':_0x85e7dd['attributes'],'include':_0x85e7dd['include']?_[_0x1957('0x1d')](_0x85e7dd[_0x1957('0x1e')],function(_0x35d4ad){return{'model':db[_0x35d4ad[_0x1957('0x1f')]],'as':_0x35d4ad['as'],'attributes':_0x35d4ad[_0x1957('0x1b')],'include':_0x35d4ad[_0x1957('0x1e')]?_['map'](_0x35d4ad['include'],function(_0x44c23b){return{'model':db[_0x44c23b[_0x1957('0x1f')]],'as':_0x44c23b['as'],'attributes':_0x44c23b[_0x1957('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1957('0xb')](function(_0x3e690c){logger['info'](_0x1957('0x20'),_0xdd5325);logger[_0x1957('0xd')]('ShowTrigger',_0xdd5325,JSON['stringify'](_0x3e690c));_0x54ef64(_0x3e690c);})[_0x1957('0x15')](function(_0x595933){logger[_0x1957('0x11')](_0x1957('0x20'),_0x595933[_0x1957('0x14')],_0xdd5325);_0x1bade5(_0x3ea679[_0x1957('0x11')](0x1f4,_0x595933[_0x1957('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 7d6adae..22b0c7a 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 _0xb062=['./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x242e23,_0x3b8846){var _0x224039=function(_0x2106e3){while(--_0x2106e3){_0x242e23['push'](_0x242e23['shift']());}};_0x224039(++_0x3b8846);}(_0xb062,0x158));var _0x2b06=function(_0x10469c,_0x2e23da){_0x10469c=_0x10469c-0x0;var _0x5ee819=_0xb062[_0x10469c];return _0x5ee819;};'use strict';var multer=require(_0x2b06('0x0'));var util=require(_0x2b06('0x1'));var path=require(_0x2b06('0x2'));var timeout=require(_0x2b06('0x3'));var express=require(_0x2b06('0x4'));var router=express[_0x2b06('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2b06('0x6'));var interaction=require(_0x2b06('0x7'));var config=require('../../config/environment');var controller=require(_0x2b06('0x8'));router[_0x2b06('0x9')]('/',auth[_0x2b06('0xa')](),controller['index']);router[_0x2b06('0x9')](_0x2b06('0xb'),auth[_0x2b06('0xa')](),controller[_0x2b06('0xc')]);router[_0x2b06('0xd')](_0x2b06('0xe'),auth[_0x2b06('0xa')](),controller[_0x2b06('0xf')]);router[_0x2b06('0xd')]('/',auth[_0x2b06('0xa')](),controller[_0x2b06('0x10')]);router[_0x2b06('0x11')](_0x2b06('0xb'),auth[_0x2b06('0xa')](),controller[_0x2b06('0x12')]);router[_0x2b06('0x13')](_0x2b06('0xb'),auth[_0x2b06('0xa')](),controller[_0x2b06('0x14')]);module[_0x2b06('0x15')]=router; \ No newline at end of file +var _0x586c=['fs-extra','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x8fca8e,_0x3bb629){var _0xab1e60=function(_0x27d939){while(--_0x27d939){_0x8fca8e['push'](_0x8fca8e['shift']());}};_0xab1e60(++_0x3bb629);}(_0x586c,0x125));var _0xc586=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0x586c[_0x2e6c19];return _0x52885d;};'use strict';var multer=require(_0xc586('0x0'));var util=require(_0xc586('0x1'));var path=require(_0xc586('0x2'));var timeout=require(_0xc586('0x3'));var express=require(_0xc586('0x4'));var router=express[_0xc586('0x5')]();var fs_extra=require(_0xc586('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc586('0x7'));var config=require('../../config/environment');var controller=require(_0xc586('0x8'));router[_0xc586('0x9')]('/',auth[_0xc586('0xa')](),controller[_0xc586('0xb')]);router[_0xc586('0x9')](_0xc586('0xc'),auth[_0xc586('0xa')](),controller[_0xc586('0xd')]);router[_0xc586('0xe')](_0xc586('0xf'),auth['isAuthenticated'](),controller[_0xc586('0x10')]);router['post']('/',auth[_0xc586('0xa')](),controller[_0xc586('0x11')]);router[_0xc586('0x12')]('/:id',auth[_0xc586('0xa')](),controller[_0xc586('0x13')]);router[_0xc586('0x14')](_0xc586('0xc'),auth[_0xc586('0xa')](),controller[_0xc586('0x15')]);module[_0xc586('0x16')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 5acd72c..da22369 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 _0x0885=['getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','nonat','update,nonat','sequelize','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue'];(function(_0x146c73,_0x4a894c){var _0x3bc4ba=function(_0x2b16c3){while(--_0x2b16c3){_0x146c73['push'](_0x146c73['shift']());}};_0x3bc4ba(++_0x4a894c);}(_0x0885,0xe9));var _0x5088=function(_0x4adbbf,_0xd3383b){_0x4adbbf=_0x4adbbf-0x0;var _0x530f27=_0x0885[_0x4adbbf];return _0x530f27;};'use strict';var Sequelize=require(_0x5088('0x0'));module[_0x5088('0x1')]={'name':{'type':Sequelize[_0x5088('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x4'),_0x5088('0x5'),_0x5088('0x6')),'allowNull':![],'defaultValue':_0x5088('0x4')},'context':{'type':Sequelize[_0x5088('0x2')],'allowNull':![],'defaultValue':_0x5088('0x7')},'callingpres':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x8'),_0x5088('0x9'),'ALLOWED_FAILED_SCREEN',_0x5088('0xa'),_0x5088('0xb'),_0x5088('0xc'),_0x5088('0xd'),_0x5088('0xe'))},'deny':{'type':Sequelize[_0x5088('0x2')]},'permit':{'type':Sequelize[_0x5088('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x5088('0x2')]},'remotesecret':{'type':Sequelize[_0x5088('0x2')]},'transport':{'type':Sequelize[_0x5088('0x2')],'defaultValue':_0x5088('0xf'),'set':function(_0x2c17a6){this[_0x5088('0x10')]('transport',_0x2c17a6?_0x2c17a6['join'](','):null);},'get':function(){return this[_0x5088('0x11')](_0x5088('0x12'))?this[_0x5088('0x11')](_0x5088('0x12'))[_0x5088('0x13')](','):null;},'comment':_0x5088('0x14')},'dtmfmode':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x15'),'info',_0x5088('0x16'),'inband',_0x5088('0x17')),'defaultValue':_0x5088('0x15')},'directmedia':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x18'),'no','nonat',_0x5088('0x19'),_0x5088('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5088('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x5088('0x1b'),'set':function(_0x246181){this[_0x5088('0x10')](_0x5088('0x1c'),_0x246181?_0x246181[_0x5088('0x1d')](','):null);},'get':function(){return this['getDataValue'](_0x5088('0x1c'))?this[_0x5088('0x11')](_0x5088('0x1c'))[_0x5088('0x13')](','):null;},'comment':_0x5088('0x1e')},'callgroup':{'type':Sequelize[_0x5088('0x2')]},'namedcallgroup':{'type':Sequelize[_0x5088('0x2')]},'pickupgroup':{'type':Sequelize[_0x5088('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x5088('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x5088('0x1f')},'allow':{'type':Sequelize[_0x5088('0x2')],'allowNull':![],'defaultValue':_0x5088('0x20'),'set':function(_0xdb365f){this['setDataValue']('allow',_0xdb365f?_0xdb365f[_0x5088('0x1d')](';'):_0x5088('0x20'));},'get':function(){return this[_0x5088('0x11')](_0x5088('0x21'))?this['getDataValue'](_0x5088('0x21'))[_0x5088('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x5088('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x5088('0x2')],'defaultValue':_0x5088('0x22'),'set':function(_0x4831a8){this['setDataValue']('insecure',_0x4831a8?_0x4831a8[_0x5088('0x1d')](','):null);},'get':function(){return this[_0x5088('0x11')](_0x5088('0x23'))?this[_0x5088('0x11')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x5088('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x18'),'no',_0x5088('0x24'))},'promiscredir':{'type':Sequelize[_0x5088('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x5088('0x25')},'amaflags':{'type':Sequelize[_0x5088('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x5088('0x18'),'no'),'defaultValue':_0x5088('0x18')},'busylevel':{'type':Sequelize[_0x5088('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x5088('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x5088('0x2')]},'template':{'type':Sequelize[_0x5088('0x2')]},'videosupport':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x18'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5088('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x5088('0x18'),'no')},'mailbox':{'type':Sequelize[_0x5088('0x2')]},'session_timers':{'type':Sequelize[_0x5088('0x3')]('accept',_0x5088('0x27'),_0x5088('0x28'))},'session_expires':{'type':Sequelize[_0x5088('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x5088('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x29'),_0x5088('0x2a')),'defaultValue':_0x5088('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x5088('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x5088('0x2')]},'fromuser':{'type':Sequelize[_0x5088('0x2')]},'port':{'type':Sequelize[_0x5088('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x5088('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x5088('0x2')]},'defaultuser':{'type':Sequelize[_0x5088('0x2')]},'rtptimeout':{'type':Sequelize[_0x5088('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5088('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5088('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x18'),'no',_0x5088('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5088('0x2')]},'callbackextension':{'type':Sequelize[_0x5088('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x5088('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x5088('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x5088('0x2')]},'contactdeny':{'type':Sequelize[_0x5088('0x2')]},'contactacl':{'type':Sequelize[_0x5088('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x5088('0x2')]},'use_q850_reason':{'type':Sequelize[_0x5088('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x5088('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x18'),'no')},'force_avp':{'type':Sequelize[_0x5088('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x5088('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x5088('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x5088('0x18'),'no',_0x5088('0x2c'),_0x5088('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x5088('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x5088('0x2')]},'dtlscipher':{'type':Sequelize[_0x5088('0x2')]},'dtlscafile':{'type':Sequelize[_0x5088('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x5088('0x3')]('active',_0x5088('0x2e'),_0x5088('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x5088('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x5088('0x2')]},'call_limit':{'type':Sequelize[_0x5088('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5088('0x3')](_0x5088('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x5088('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x5088('0x2')]},'mohinterpret':{'type':Sequelize[_0x5088('0x2')]},'mohsuggest':{'type':Sequelize[_0x5088('0x2')]},'parkinglot':{'type':Sequelize[_0x5088('0x2')]},'description':{'type':Sequelize[_0x5088('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x5088('0x18'),'no',_0x5088('0x30'),_0x5088('0x19'),_0x5088('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5088('0x2')]},'otherFields':{'type':Sequelize[_0x5088('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5088('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xcb97=['BOOLEAN','sequelize','exports','name','ENUM','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','pai','certificate','active','passive','actpass','dynamic','nonat'];(function(_0x87a800,_0x4027a8){var _0x275e7e=function(_0x19ff6e){while(--_0x19ff6e){_0x87a800['push'](_0x87a800['shift']());}};_0x275e7e(++_0x4027a8);}(_0xcb97,0x100));var _0x7cb9=function(_0x5c4f18,_0x3f8b0e){_0x5c4f18=_0x5c4f18-0x0;var _0x2e4032=_0xcb97[_0x5c4f18];return _0x2e4032;};'use strict';var Sequelize=require(_0x7cb9('0x0'));module[_0x7cb9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7cb9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7cb9('0x3')]('friend',_0x7cb9('0x4'),_0x7cb9('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7cb9('0x6')],'allowNull':![],'defaultValue':_0x7cb9('0x7')},'callingpres':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x8'),_0x7cb9('0x9'),_0x7cb9('0xa'),_0x7cb9('0xb'),'PROHIB_NOT_SCREENED',_0x7cb9('0xc'),'PROHIB_FAILED_SCREEN',_0x7cb9('0xd'))},'deny':{'type':Sequelize[_0x7cb9('0x6')]},'permit':{'type':Sequelize[_0x7cb9('0x6')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x7cb9('0x6')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x7cb9('0x6')],'defaultValue':_0x7cb9('0xe'),'set':function(_0x51e7e0){this[_0x7cb9('0xf')](_0x7cb9('0x10'),_0x51e7e0?_0x51e7e0[_0x7cb9('0x11')](','):null);},'get':function(){return this[_0x7cb9('0x12')](_0x7cb9('0x10'))?this[_0x7cb9('0x12')](_0x7cb9('0x10'))[_0x7cb9('0x13')](','):null;},'comment':_0x7cb9('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0x7cb9('0x15'),_0x7cb9('0x16'),_0x7cb9('0x17'),'inband',_0x7cb9('0x18')),'defaultValue':_0x7cb9('0x15')},'directmedia':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no','nonat',_0x7cb9('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7cb9('0x6')]},'directmediadeny':{'type':Sequelize[_0x7cb9('0x6')]},'nat':{'type':Sequelize[_0x7cb9('0x6')],'defaultValue':_0x7cb9('0x1b'),'set':function(_0x4bf24e){this[_0x7cb9('0xf')](_0x7cb9('0x1c'),_0x4bf24e?_0x4bf24e[_0x7cb9('0x11')](','):null);},'get':function(){return this[_0x7cb9('0x12')]('nat')?this[_0x7cb9('0x12')](_0x7cb9('0x1c'))[_0x7cb9('0x13')](','):null;},'comment':_0x7cb9('0x1d')},'callgroup':{'type':Sequelize[_0x7cb9('0x6')]},'namedcallgroup':{'type':Sequelize[_0x7cb9('0x6')]},'pickupgroup':{'type':Sequelize[_0x7cb9('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x7cb9('0x6')]},'language':{'type':Sequelize[_0x7cb9('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7cb9('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7cb9('0x6')],'defaultValue':_0x7cb9('0x1e')},'allow':{'type':Sequelize[_0x7cb9('0x6')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5253e1){this[_0x7cb9('0xf')]('allow',_0x5253e1?_0x5253e1[_0x7cb9('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x7cb9('0x12')](_0x7cb9('0x1f'))?this[_0x7cb9('0x12')]('allow')[_0x7cb9('0x13')](';'):null;},'comment':_0x7cb9('0x20')},'autoframing':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x7cb9('0x21'),'set':function(_0x359db5){this['setDataValue'](_0x7cb9('0x22'),_0x359db5?_0x359db5[_0x7cb9('0x11')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue'](_0x7cb9('0x22'))[_0x7cb9('0x13')](','):null;},'comment':_0x7cb9('0x23')},'trustrpid':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no',_0x7cb9('0x24'))},'promiscredir':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x7cb9('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7cb9('0x6')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x7cb9('0x6')]},'callcounter':{'type':Sequelize[_0x7cb9('0x3')]('yes','no'),'defaultValue':_0x7cb9('0x19')},'busylevel':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x7cb9('0x6')]},'template':{'type':Sequelize[_0x7cb9('0x6')]},'videosupport':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no',_0x7cb9('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no')},'mailbox':{'type':Sequelize[_0x7cb9('0x6')]},'session_timers':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x27'),_0x7cb9('0x28'),_0x7cb9('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x2a'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x7cb9('0x6')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x7cb9('0x6')]},'fromuser':{'type':Sequelize[_0x7cb9('0x6')]},'port':{'type':Sequelize[_0x7cb9('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x7cb9('0x6')]},'defaultuser':{'type':Sequelize[_0x7cb9('0x6')]},'rtptimeout':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no',_0x7cb9('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x7cb9('0x6')]},'timert1':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x7cb9('0x6')]},'contactdeny':{'type':Sequelize[_0x7cb9('0x6')]},'contactacl':{'type':Sequelize[_0x7cb9('0x6')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'encryption':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'force_avp':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x7cb9('0x3')]('yes','no','fingerprint',_0x7cb9('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x7cb9('0x6')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x7cb9('0x6')]},'dtlscapath':{'type':Sequelize[_0x7cb9('0x6')]},'dtlssetup':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x2d'),_0x7cb9('0x2e'),_0x7cb9('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7cb9('0x6')]},'usereqphone':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7cb9('0x6')]},'recordofffeature':{'type':Sequelize[_0x7cb9('0x6')]},'call_limit':{'type':Sequelize[_0x7cb9('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'vmexten':{'type':Sequelize[_0x7cb9('0x6')]},'mohinterpret':{'type':Sequelize[_0x7cb9('0x6')]},'mohsuggest':{'type':Sequelize[_0x7cb9('0x6')]},'parkinglot':{'type':Sequelize[_0x7cb9('0x6')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x7cb9('0x30')},'canreinvite':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no',_0x7cb9('0x31'),_0x7cb9('0x1a'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7cb9('0x6')]},'otherFields':{'type':Sequelize[_0x7cb9('0x6')]},'active':{'type':Sequelize[_0x7cb9('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7cb9('0x6')],'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 9b4a5a5..d5c1216 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 _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x502276,_0x47320d){var _0x1a8495=function(_0x22a260){while(--_0x22a260){_0x502276['push'](_0x502276['shift']());}};_0x1a8495(++_0x47320d);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x34d0de,_0x4bc113){_0x34d0de=_0x34d0de-0x0;var _0x545caf=_0xd6d6[_0x34d0de];return _0x545caf;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file +var _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x40646e,_0x2b7664){var _0x5911a0=function(_0xea0d93){while(--_0xea0d93){_0x40646e['push'](_0x40646e['shift']());}};_0x5911a0(++_0x2b7664);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x24ca[_0x3ce2c4];return _0x4047c1;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 867c52d..da93dea 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 _0xf733=['exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','request-promise','path','./trunk.attributes'];(function(_0x28b77a,_0x2581bd){var _0x2a60a2=function(_0x319557){while(--_0x319557){_0x28b77a['push'](_0x28b77a['shift']());}};_0x2a60a2(++_0x2581bd);}(_0xf733,0x13c));var _0x3f73=function(_0x3c0cd6,_0x5ba428){_0x3c0cd6=_0x3c0cd6-0x0;var _0x4381ec=_0xf733[_0x3c0cd6];return _0x4381ec;};'use strict';var _=require(_0x3f73('0x0'));var util=require(_0x3f73('0x1'));var logger=require(_0x3f73('0x2'))(_0x3f73('0x3'));var moment=require(_0x3f73('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f73('0x5'));var fs=require('fs');var path=require(_0x3f73('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3f73('0x7'));module[_0x3f73('0x8')]=function(_0x172cb6,_0x4a8730){return _0x172cb6[_0x3f73('0x9')](_0x3f73('0xa'),attributes,{'tableName':_0x3f73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0f9=['path','rimraf','../../config/environment','./trunk.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe0f9,0x8a));var _0x9e0f=function(_0x38dac5,_0x4f7e50){_0x38dac5=_0x38dac5-0x0;var _0xbdbf59=_0xe0f9[_0x38dac5];return _0xbdbf59;};'use strict';var _=require('lodash');var util=require(_0x9e0f('0x0'));var logger=require(_0x9e0f('0x1'))(_0x9e0f('0x2'));var moment=require(_0x9e0f('0x3'));var BPromise=require(_0x9e0f('0x4'));var rp=require(_0x9e0f('0x5'));var fs=require('fs');var path=require(_0x9e0f('0x6'));var rimraf=require(_0x9e0f('0x7'));var config=require(_0x9e0f('0x8'));var attributes=require(_0x9e0f('0x9'));module[_0x9e0f('0xa')]=function(_0x4d324a,_0x10ed29){return _0x4d324a[_0x9e0f('0xb')]('Trunk',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 5df814a..31c5e72 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 _0x34e8=['attributes','model','ShowTrunk','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','limit','include','map'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0x34e8,0x12c));var _0x834e=function(_0x3d4e37,_0x34f5ab){_0x3d4e37=_0x3d4e37-0x0;var _0x5e38f7=_0x34e8[_0x3d4e37];return _0x5e38f7;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('Trunk,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('Trunk,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});}exports[_0x834e('0x19')]=function(_0x211e9a){var _0x34e41a=this;return new Promise(function(_0xb993a1,_0x237947){return db[_0x834e('0x1a')][_0x834e('0x1b')]({'raw':_0x211e9a['options']?_0x211e9a[_0x834e('0x1c')][_0x834e('0x1d')]===undefined?!![]:![]:!![],'where':_0x211e9a[_0x834e('0x1c')]?_0x211e9a[_0x834e('0x1c')]['where']||null:null,'attributes':_0x211e9a[_0x834e('0x1c')]?_0x211e9a[_0x834e('0x1c')]['attributes']||null:null,'limit':_0x211e9a[_0x834e('0x1c')]?_0x211e9a[_0x834e('0x1c')][_0x834e('0x1e')]||null:null,'include':_0x211e9a['options']?_0x211e9a['options'][_0x834e('0x1f')]?_[_0x834e('0x20')](_0x211e9a['options'][_0x834e('0x1f')],function(_0x1dc1e0){return{'model':db[_0x1dc1e0['model']],'as':_0x1dc1e0['as'],'attributes':_0x1dc1e0[_0x834e('0x21')],'include':_0x1dc1e0[_0x834e('0x1f')]?_[_0x834e('0x20')](_0x1dc1e0['include'],function(_0x24fcf7){return{'model':db[_0x24fcf7[_0x834e('0x22')]],'as':_0x24fcf7['as'],'attributes':_0x24fcf7['attributes'],'include':_0x24fcf7['include']?_[_0x834e('0x20')](_0x24fcf7['include'],function(_0x2826ec){return{'model':db[_0x2826ec[_0x834e('0x22')]],'as':_0x2826ec['as'],'attributes':_0x2826ec[_0x834e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x834e('0xd')](function(_0x3cd928){logger[_0x834e('0xe')]('GetTrunk',_0x211e9a);logger['debug']('GetTrunk',_0x211e9a,JSON['stringify'](_0x3cd928));_0xb993a1(_0x3cd928);})[_0x834e('0x18')](function(_0x567cea){logger[_0x834e('0x14')]('GetTrunk',_0x567cea[_0x834e('0x16')],_0x211e9a);_0x237947(_0x34e41a[_0x834e('0x14')](0x1f4,_0x567cea[_0x834e('0x16')]));});});};exports[_0x834e('0x23')]=function(_0x4551f5){var _0x390119=this;return new Promise(function(_0x3d149d,_0xfaf716){return db[_0x834e('0x1a')]['find']({'raw':_0x4551f5[_0x834e('0x1c')]?_0x4551f5['options'][_0x834e('0x1d')]===undefined?!![]:![]:!![],'where':_0x4551f5[_0x834e('0x1c')]?_0x4551f5[_0x834e('0x1c')][_0x834e('0x24')]||null:null,'attributes':_0x4551f5[_0x834e('0x1c')]?_0x4551f5[_0x834e('0x1c')][_0x834e('0x21')]||null:null,'include':_0x4551f5[_0x834e('0x1c')]?_0x4551f5[_0x834e('0x1c')][_0x834e('0x1f')]?_['map'](_0x4551f5[_0x834e('0x1c')][_0x834e('0x1f')],function(_0x24a9df){return{'model':db[_0x24a9df[_0x834e('0x22')]],'as':_0x24a9df['as'],'attributes':_0x24a9df['attributes'],'include':_0x24a9df[_0x834e('0x1f')]?_[_0x834e('0x20')](_0x24a9df['include'],function(_0x496533){return{'model':db[_0x496533['model']],'as':_0x496533['as'],'attributes':_0x496533[_0x834e('0x21')],'include':_0x496533[_0x834e('0x1f')]?_[_0x834e('0x20')](_0x496533[_0x834e('0x1f')],function(_0x339e28){return{'model':db[_0x339e28[_0x834e('0x22')]],'as':_0x339e28['as'],'attributes':_0x339e28['attributes']};}):[]};}):[]};}):[]:[]})[_0x834e('0xd')](function(_0x513f36){logger[_0x834e('0xe')](_0x834e('0x23'),_0x4551f5);logger['debug'](_0x834e('0x23'),_0x4551f5,JSON[_0x834e('0x13')](_0x513f36));_0x3d149d(_0x513f36);})['catch'](function(_0x481f70){logger[_0x834e('0x14')](_0x834e('0x23'),_0x481f70[_0x834e('0x16')],_0x4551f5);_0xfaf716(_0x390119[_0x834e('0x14')](0x1f4,_0x481f70[_0x834e('0x16')]));});});}; \ No newline at end of file +var _0x544a=['../../config/environment','jayson/promise','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Trunk,\x20%s,\x20%s','request\x20sent','catch','GetTrunk','Trunk','findAll','options','raw','where','limit','include','model','attributes','map','then','find','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x39c9bc,_0x398f06){var _0x5c94a0=function(_0x57060a){while(--_0x57060a){_0x39c9bc['push'](_0x39c9bc['shift']());}};_0x5c94a0(++_0x398f06);}(_0x544a,0x184));var _0xa544=function(_0x1b2264,_0x39d6bd){_0x1b2264=_0x1b2264-0x0;var _0x4b3c14=_0x544a[_0x1b2264];return _0x4b3c14;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require(_0xa544('0x2'));var BPromise=require(_0xa544('0x3'));var rs=require(_0xa544('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa544('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa544('0x6'))(_0xa544('0x7'));var config=require(_0xa544('0x8'));var jayson=require(_0xa544('0x9'));var client=jayson['client'][_0xa544('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x171bbd,_0xf73042,_0x5bb8bd){return new BPromise(function(_0xa8b571,_0x1dd888){return client[_0xa544('0xb')](_0x171bbd,_0x5bb8bd)['then'](function(_0x26970d){logger[_0xa544('0xc')]('Trunk,\x20%s,\x20%s',_0xf73042,'request\x20sent');logger[_0xa544('0xd')](_0xa544('0xe'),_0xf73042,'request\x20sent',JSON[_0xa544('0xf')](_0x26970d));if(_0x26970d['error']){if(_0x26970d['error'][_0xa544('0x10')]===0x1f4){logger[_0xa544('0x11')]('Trunk,\x20%s,\x20%s',_0xf73042,_0x26970d['error'][_0xa544('0x12')]);return _0x1dd888(_0x26970d[_0xa544('0x11')][_0xa544('0x12')]);}logger[_0xa544('0x11')]('Trunk,\x20%s,\x20%s',_0xf73042,_0x26970d[_0xa544('0x11')]['message']);return _0xa8b571(_0x26970d[_0xa544('0x11')][_0xa544('0x12')]);}else{logger[_0xa544('0xc')](_0xa544('0x13'),_0xf73042,_0xa544('0x14'));_0xa8b571(_0x26970d['result'][_0xa544('0x12')]);}})[_0xa544('0x15')](function(_0x3c7e8f){logger[_0xa544('0x11')](_0xa544('0x13'),_0xf73042,_0x3c7e8f);_0x1dd888(_0x3c7e8f);});});}exports[_0xa544('0x16')]=function(_0x32b6bc){var _0x1a4281=this;return new Promise(function(_0x131ae4,_0x4abcf4){return db[_0xa544('0x17')][_0xa544('0x18')]({'raw':_0x32b6bc[_0xa544('0x19')]?_0x32b6bc[_0xa544('0x19')][_0xa544('0x1a')]===undefined?!![]:![]:!![],'where':_0x32b6bc[_0xa544('0x19')]?_0x32b6bc['options'][_0xa544('0x1b')]||null:null,'attributes':_0x32b6bc[_0xa544('0x19')]?_0x32b6bc[_0xa544('0x19')]['attributes']||null:null,'limit':_0x32b6bc[_0xa544('0x19')]?_0x32b6bc[_0xa544('0x19')][_0xa544('0x1c')]||null:null,'include':_0x32b6bc[_0xa544('0x19')]?_0x32b6bc['options'][_0xa544('0x1d')]?_['map'](_0x32b6bc['options'][_0xa544('0x1d')],function(_0x3a2b0b){return{'model':db[_0x3a2b0b[_0xa544('0x1e')]],'as':_0x3a2b0b['as'],'attributes':_0x3a2b0b[_0xa544('0x1f')],'include':_0x3a2b0b[_0xa544('0x1d')]?_[_0xa544('0x20')](_0x3a2b0b['include'],function(_0x448c24){return{'model':db[_0x448c24[_0xa544('0x1e')]],'as':_0x448c24['as'],'attributes':_0x448c24[_0xa544('0x1f')],'include':_0x448c24['include']?_[_0xa544('0x20')](_0x448c24[_0xa544('0x1d')],function(_0x593f18){return{'model':db[_0x593f18[_0xa544('0x1e')]],'as':_0x593f18['as'],'attributes':_0x593f18[_0xa544('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa544('0x21')](function(_0x3e56d0){logger[_0xa544('0xc')]('GetTrunk',_0x32b6bc);logger[_0xa544('0xd')]('GetTrunk',_0x32b6bc,JSON['stringify'](_0x3e56d0));_0x131ae4(_0x3e56d0);})[_0xa544('0x15')](function(_0x36879f){logger[_0xa544('0x11')](_0xa544('0x16'),_0x36879f['message'],_0x32b6bc);_0x4abcf4(_0x1a4281['error'](0x1f4,_0x36879f[_0xa544('0x12')]));});});};exports['ShowTrunk']=function(_0x2d5982){var _0x6361de=this;return new Promise(function(_0x1a710b,_0x4dfacb){return db[_0xa544('0x17')][_0xa544('0x22')]({'raw':_0x2d5982[_0xa544('0x19')]?_0x2d5982[_0xa544('0x19')][_0xa544('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d5982[_0xa544('0x19')]?_0x2d5982[_0xa544('0x19')][_0xa544('0x1b')]||null:null,'attributes':_0x2d5982[_0xa544('0x19')]?_0x2d5982[_0xa544('0x19')]['attributes']||null:null,'include':_0x2d5982[_0xa544('0x19')]?_0x2d5982[_0xa544('0x19')]['include']?_[_0xa544('0x20')](_0x2d5982[_0xa544('0x19')]['include'],function(_0x146bff){return{'model':db[_0x146bff[_0xa544('0x1e')]],'as':_0x146bff['as'],'attributes':_0x146bff[_0xa544('0x1f')],'include':_0x146bff[_0xa544('0x1d')]?_[_0xa544('0x20')](_0x146bff[_0xa544('0x1d')],function(_0x25c327){return{'model':db[_0x25c327['model']],'as':_0x25c327['as'],'attributes':_0x25c327[_0xa544('0x1f')],'include':_0x25c327[_0xa544('0x1d')]?_[_0xa544('0x20')](_0x25c327[_0xa544('0x1d')],function(_0x312e4e){return{'model':db[_0x312e4e[_0xa544('0x1e')]],'as':_0x312e4e['as'],'attributes':_0x312e4e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c4694){logger[_0xa544('0xc')]('ShowTrunk',_0x2d5982);logger[_0xa544('0xd')](_0xa544('0x23'),_0x2d5982,JSON['stringify'](_0x1c4694));_0x1a710b(_0x1c4694);})['catch'](function(_0x5a5b30){logger[_0xa544('0x11')]('ShowTrunk',_0x5a5b30[_0xa544('0x12')],_0x2d5982);_0x4dfacb(_0x6361de[_0xa544('0x11')](0x1f4,_0x5a5b30[_0xa544('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index eaa562f..e2d7233 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 _0xd3e9=['update','exports','express','Router','../../components/auth/service','/:id'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xd3e9,0xb6));var _0x9d3e=function(_0x167223,_0x106b82){_0x167223=_0x167223-0x0;var _0x4a1639=_0xd3e9[_0x167223];return _0x4a1639;};'use strict';var express=require(_0x9d3e('0x0'));var router=express[_0x9d3e('0x1')]();var auth=require(_0x9d3e('0x2'));var controller=require('./user-setting.controller');router['put'](_0x9d3e('0x3'),auth['isAuthenticated'](),controller[_0x9d3e('0x4')]);module[_0x9d3e('0x5')]=router; \ No newline at end of file +var _0xb8c2=['put','/:id','isAuthenticated','update','exports','express','Router'];(function(_0x3fa577,_0x5033e9){var _0x395529=function(_0x3ab670){while(--_0x3ab670){_0x3fa577['push'](_0x3fa577['shift']());}};_0x395529(++_0x5033e9);}(_0xb8c2,0xd7));var _0x2b8c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb8c2[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0x2b8c('0x0'));var router=express[_0x2b8c('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router[_0x2b8c('0x2')](_0x2b8c('0x3'),auth[_0x2b8c('0x4')](),controller[_0x2b8c('0x5')]);module[_0x2b8c('0x6')]=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 fbbf757..f94c5fc 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 _0x29f6=['debug','exports','ENUM','DATE','INTEGER','sequelize','error','warning','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29f6,0x152));var _0x629f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x629f('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x629f('0x1'),_0x629f('0x2'),_0x629f('0x3'),_0x629f('0x4')];module[_0x629f('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x629f('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x629f('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x629f('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x629f('0x8')],'unique':'UserId'}}; \ No newline at end of file +var _0x5eab=['error','BOOLEAN','TEXT','UserId','sequelize','warning','debug','ENUM'];(function(_0x14aacd,_0x5d57a3){var _0x47b98f=function(_0x3123df){while(--_0x3123df){_0x14aacd['push'](_0x14aacd['shift']());}};_0x47b98f(++_0x5d57a3);}(_0x5eab,0x1c4));var _0xb5ea=function(_0x5e05fd,_0x498153){_0x5e05fd=_0x5e05fd-0x0;var _0x24a1bc=_0x5eab[_0x5e05fd];return _0x24a1bc;};'use strict';var Sequelize=require(_0xb5ea('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xb5ea('0x1'),'info',_0xb5ea('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xb5ea('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb5ea('0x4'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb5ea('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb5ea('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xb5ea('0x7')}}; \ 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 9333865..cfad052 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 _0xc5c7=['stack','name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','then','body','catch','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','status','sendStatus','error'];(function(_0x387589,_0x575422){var _0x568031=function(_0x1280b3){while(--_0x1280b3){_0x387589['push'](_0x387589['shift']());}};_0x568031(++_0x575422);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x160c4b,_0x1e48f7){_0x160c4b=_0x160c4b-0x0;var _0xd203d3=_0xc5c7[_0x160c4b];return _0xd203d3;};'use strict';var _=require('lodash');var Redis=require(_0x7c5c('0x0'));var logger=require(_0x7c5c('0x1'))(_0x7c5c('0x2'));var config=require(_0x7c5c('0x3'));var db=require(_0x7c5c('0x4'))['db'];var socket=require(_0x7c5c('0x5'))(new Redis(config['redis']));require(_0x7c5c('0x6'))[_0x7c5c('0x7')](socket);config[_0x7c5c('0x8')]=_[_0x7c5c('0x9')](config[_0x7c5c('0x8')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x5ec99e,_0xdbfbeb){_0xdbfbeb=_0xdbfbeb||0xc8;return function(_0x5895b5){if(_0x5895b5){return _0x5ec99e[_0x7c5c('0xa')](_0xdbfbeb)['json'](_0x5895b5);}};}function saveUpdates(_0x2b27d0){return function(_0x15f4c1){if(_0x15f4c1){return _0x15f4c1['update'](_0x2b27d0)['then'](function(_0x17597c){return _0x17597c;});}return null;};}function handleEntityNotFound(_0x1cd540){return function(_0x5c7073){if(!_0x5c7073){_0x1cd540[_0x7c5c('0xb')](0x194);}return _0x5c7073;};}function handleError(_0x58ef28,_0x1f5e0b){_0x1f5e0b=_0x1f5e0b||0x1f4;return function(_0x5bb950){logger[_0x7c5c('0xc')](_0x5bb950[_0x7c5c('0xd')]);if(_0x5bb950['name']){delete _0x5bb950[_0x7c5c('0xe')];}_0x58ef28[_0x7c5c('0xa')](_0x1f5e0b)[_0x7c5c('0xf')](_0x5bb950);};}exports[_0x7c5c('0x10')]=function(_0x3d5a9d,_0x113c0b){if(_0x3d5a9d[_0x7c5c('0x11')][_0x7c5c('0x12')]!==_0x7c5c('0x13'))throw new Error(_0x7c5c('0x14'));if(isNaN(Number(_0x3d5a9d[_0x7c5c('0x15')]['id'])))throw new Error(_0x7c5c('0x16'));return db[_0x7c5c('0x17')][_0x7c5c('0x18')]({'where':{'id':_0x3d5a9d['params']['id']}})['then'](handleEntityNotFound(_0x113c0b,null))[_0x7c5c('0x19')](saveUpdates(_0x3d5a9d[_0x7c5c('0x1a')],null))[_0x7c5c('0x19')](respondWithResult(_0x113c0b,null))[_0x7c5c('0x1b')](handleError(_0x113c0b,null));}; \ No newline at end of file +var _0xf0cc=['redis','defaults','update','sendStatus','stack','name','status','send','user','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','then','catch','lodash','api','socket.io-emitter'];(function(_0x357b6e,_0x541b0f){var _0x205aac=function(_0x329ace){while(--_0x329ace){_0x357b6e['push'](_0x357b6e['shift']());}};_0x205aac(++_0x541b0f);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x34c2bb,_0x31d716){_0x34c2bb=_0x34c2bb-0x0;var _0x1aa494=_0xf0cc[_0x34c2bb];return _0x1aa494;};'use strict';var _=require(_0xcf0c('0x0'));var Redis=require('ioredis');var logger=require('../../config/logger')(_0xcf0c('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xcf0c('0x2'))(new Redis(config[_0xcf0c('0x3')]));require('./user-setting.socket')['register'](socket);config[_0xcf0c('0x3')]=_[_0xcf0c('0x4')](config[_0xcf0c('0x3')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x346cb0,_0x1503f6){_0x1503f6=_0x1503f6||0xc8;return function(_0x2cb15a){if(_0x2cb15a){return _0x346cb0['status'](_0x1503f6)['json'](_0x2cb15a);}};}function saveUpdates(_0x3cf3cb){return function(_0x53a853){if(_0x53a853){return _0x53a853[_0xcf0c('0x5')](_0x3cf3cb)['then'](function(_0x291141){return _0x291141;});}return null;};}function handleEntityNotFound(_0x1a8e08){return function(_0x16190b){if(!_0x16190b){_0x1a8e08[_0xcf0c('0x6')](0x194);}return _0x16190b;};}function handleError(_0x3ba6ab,_0x817634){_0x817634=_0x817634||0x1f4;return function(_0x39375d){logger['error'](_0x39375d[_0xcf0c('0x7')]);if(_0x39375d[_0xcf0c('0x8')]){delete _0x39375d[_0xcf0c('0x8')];}_0x3ba6ab[_0xcf0c('0x9')](_0x817634)[_0xcf0c('0xa')](_0x39375d);};}exports['update']=function(_0x540eae,_0x395d90){if(_0x540eae[_0xcf0c('0xb')]['role']!=='admin')throw new Error(_0xcf0c('0xc'));if(isNaN(Number(_0x540eae['params']['id'])))throw new Error(_0xcf0c('0xd'));return db[_0xcf0c('0xe')]['find']({'where':{'id':_0x540eae['params']['id']}})['then'](handleEntityNotFound(_0x395d90,null))[_0xcf0c('0xf')](saveUpdates(_0x540eae['body'],null))[_0xcf0c('0xf')](respondWithResult(_0x395d90,null))[_0xcf0c('0x10')](handleError(_0x395d90,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 4223cd1..2950220 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 _0xab8a=['hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2a2ea9,_0x4b426c){var _0x25e496=function(_0x25ab2b){while(--_0x25ab2b){_0x2a2ea9['push'](_0x2a2ea9['shift']());}};_0x25e496(++_0x4b426c);}(_0xab8a,0xde));var _0xaab8=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xab8a[_0x599f41];return _0x2e4d58;};'use strict';var EventEmitter=require(_0xaab8('0x0'));var UserSetting=require(_0xaab8('0x1'))['db'][_0xaab8('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xaab8('0x3')](0x0);var events={'afterCreate':_0xaab8('0x4'),'afterUpdate':_0xaab8('0x5'),'afterDestroy':_0xaab8('0x6')};function emitEvent(_0x9d94fb){return function(_0x158ae3,_0x4a8ea1,_0x23a48e){UserSettingEvents[_0xaab8('0x7')](_0x9d94fb+':'+_0x158ae3['id'],_0x158ae3);UserSettingEvents[_0xaab8('0x7')](_0x9d94fb,_0x158ae3);_0x23a48e(null);};}for(var e in events){if(events[_0xaab8('0x8')](e)){var event=events[e];UserSetting[_0xaab8('0x9')](e,emitEvent(event));}}module[_0xaab8('0xa')]=UserSettingEvents; \ No newline at end of file +var _0x5dab=['setMaxListeners','save','update','remove','emit','../../mysqldb'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x5dab,0xad));var _0xb5da=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x5dab[_0x40ac5e];return _0x2839d6;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xb5da('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xb5da('0x1')](0x0);var events={'afterCreate':_0xb5da('0x2'),'afterUpdate':_0xb5da('0x3'),'afterDestroy':_0xb5da('0x4')};function emitEvent(_0xcb185f){return function(_0x388f01,_0x780a45,_0x181312){UserSettingEvents[_0xb5da('0x5')](_0xcb185f+':'+_0x388f01['id'],_0x388f01);UserSettingEvents[_0xb5da('0x5')](_0xcb185f,_0x388f01);_0x181312(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 diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index e301c81..2a0f934 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 _0x073e=['./user-setting.attributes','exports','define','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x55afd9,_0xb6ca13){var _0x49b640=function(_0x23df46){while(--_0x23df46){_0x55afd9['push'](_0x55afd9['shift']());}};_0x49b640(++_0xb6ca13);}(_0x073e,0x181));var _0xe073=function(_0x4b69c3,_0x265e74){_0x4b69c3=_0x4b69c3-0x0;var _0x5f23b4=_0x073e[_0x4b69c3];return _0x5f23b4;};'use strict';var attributes=require(_0xe073('0x0'));module[_0xe073('0x1')]=function(_0x876bb9){return _0x876bb9[_0xe073('0x2')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e8df8){if(!_0x4e8df8[_0xe073('0x3')])_0x4e8df8[_0xe073('0x4')]=null;else if(_0x4e8df8[_0xe073('0x4')]===null)_0x4e8df8['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x9147=['define','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9147,0x7b));var _0x7914=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x9147[_0x2a6809];return _0x11c371;};'use strict';var attributes=require(_0x7914('0x0'));module[_0x7914('0x1')]=function(_0x4c49ca){return _0x4c49ca[_0x7914('0x2')]('UserSetting',attributes,{'tableName':_0x7914('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b3ab2){if(!_0x2b3ab2['clientSideLoggingEnabled'])_0x2b3ab2[_0x7914('0x4')]=null;else if(_0x2b3ab2[_0x7914('0x4')]===null)_0x2b3ab2[_0x7914('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index c7e9e68..d459cdb 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 _0x5c7b=['save','remove','update','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events'];(function(_0xb6b285,_0x596e01){var _0x11393c=function(_0x506469){while(--_0x506469){_0xb6b285['push'](_0xb6b285['shift']());}};_0x11393c(++_0x596e01);}(_0x5c7b,0x171));var _0xb5c7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5c7b[_0xa464c9];return _0x3d73c4;};'use strict';var UserSettingEvents=require(_0xb5c7('0x0'));var events=[_0xb5c7('0x1'),_0xb5c7('0x2'),_0xb5c7('0x3')];function createListener(_0x55b72f,_0x2e5325){return function(_0x49f6ef){_0x2e5325['emit'](_0x55b72f,_0x49f6ef);if(_0x55b72f===_0xb5c7('0x4')){_0x2e5325['emit'](_0xb5c7('0x5')+_0x49f6ef[_0xb5c7('0x6')],_0x49f6ef);}};}exports[_0xb5c7('0x7')]=function(_0x30d0e2){for(var _0x582f89=0x0,_0x3d4aab=events[_0xb5c7('0x8')];_0x582f89<_0x3d4aab;_0x582f89++){var _0x4caacd=events[_0x582f89];var _0x413414=createListener(_0xb5c7('0x9')+_0x4caacd,_0x30d0e2);UserSettingEvents['on'](_0x4caacd,_0x413414);}}; \ No newline at end of file +var _0x65d9=['save','emit','user-setting:update','user-setting:update:user-','register','length','user-setting:','./user-setting.events'];(function(_0x3f71e6,_0x156722){var _0x50409b=function(_0x8144ae){while(--_0x8144ae){_0x3f71e6['push'](_0x3f71e6['shift']());}};_0x50409b(++_0x156722);}(_0x65d9,0xaf));var _0x965d=function(_0x2b8ff9,_0x25cdbf){_0x2b8ff9=_0x2b8ff9-0x0;var _0x1692a5=_0x65d9[_0x2b8ff9];return _0x1692a5;};'use strict';var UserSettingEvents=require(_0x965d('0x0'));var events=[_0x965d('0x1'),'remove','update'];function createListener(_0x2d2ebe,_0x256421){return function(_0x5ebf14){_0x256421[_0x965d('0x2')](_0x2d2ebe,_0x5ebf14);if(_0x2d2ebe===_0x965d('0x3')){_0x256421['emit'](_0x965d('0x4')+_0x5ebf14['UserId'],_0x5ebf14);}};}exports[_0x965d('0x5')]=function(_0x3967b8){for(var _0x126a28=0x0,_0x35e101=events[_0x965d('0x6')];_0x126a28<_0x35e101;_0x126a28++){var _0x361fb7=events[_0x126a28];var _0x160edf=createListener(_0x965d('0x7')+_0x361fb7,_0x3967b8);UserSettingEvents['on'](_0x361fb7,_0x160edf);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 2fc99ee..880ec08 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 _0x038f=['/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','delete','/:id/queues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','path','express','Router','fs-extra','../../components/auth/service','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getVoiceQueuesRt','/:id/groups','/:id/recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','diskStorage','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','logout'];(function(_0x4bbc02,_0x3559b6){var _0x5e67c4=function(_0x2e16c6){while(--_0x2e16c6){_0x4bbc02['push'](_0x4bbc02['shift']());}};_0x5e67c4(++_0x3559b6);}(_0x038f,0x106));var _0xf038=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0x038f[_0x14363e];return _0x17c56d;};'use strict';var multer=require(_0xf038('0x0'));var util=require(_0xf038('0x1'));var path=require(_0xf038('0x2'));var timeout=require('connect-timeout');var express=require(_0xf038('0x3'));var router=express[_0xf038('0x4')]();var fs_extra=require(_0xf038('0x5'));var auth=require(_0xf038('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf038('0x7'));router[_0xf038('0x8')]('/',auth[_0xf038('0x9')](),controller[_0xf038('0xa')]);router[_0xf038('0x8')]('/describe',auth[_0xf038('0x9')](),controller[_0xf038('0xb')]);router['get'](_0xf038('0xc'),auth[_0xf038('0x9')](),controller[_0xf038('0xd')]);router['get']('/presence',auth[_0xf038('0x9')](),controller[_0xf038('0xe')]);router[_0xf038('0x8')](_0xf038('0xf'),auth[_0xf038('0x9')](),controller[_0xf038('0x10')]);router[_0xf038('0x8')](_0xf038('0x11'),controller['getAvatar']);router[_0xf038('0x8')](_0xf038('0x12'),auth[_0xf038('0x9')](),controller[_0xf038('0x13')]);router[_0xf038('0x8')](_0xf038('0x14'),auth[_0xf038('0x9')](),controller[_0xf038('0x15')]);router['get']('/:id/queues',auth[_0xf038('0x9')](),controller['getQueues']);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0xf038('0x16')]);router['get'](_0xf038('0x17'),auth[_0xf038('0x9')](),controller['getGroups']);router[_0xf038('0x8')](_0xf038('0x18'),auth[_0xf038('0x9')](),controller['getRecordings']);router[_0xf038('0x8')]('/:id/screen_recordings',auth[_0xf038('0x9')](),controller['getScreenRecordings']);router[_0xf038('0x8')](_0xf038('0x19'),auth['isAuthenticated'](),controller[_0xf038('0x1a')]);router[_0xf038('0x8')](_0xf038('0x1b'),auth[_0xf038('0x9')](),controller[_0xf038('0x1c')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xf038('0x1d')]);router['get'](_0xf038('0x1e'),auth[_0xf038('0x9')](),controller[_0xf038('0x1f')]);router[_0xf038('0x8')](_0xf038('0x20'),auth['isAuthenticated'](),controller[_0xf038('0x21')]);router[_0xf038('0x8')](_0xf038('0x22'),auth[_0xf038('0x9')](),controller['getWhatsappInteractions']);router[_0xf038('0x8')](_0xf038('0x23'),auth['isAuthenticated'](),controller[_0xf038('0x24')]);router['get'](_0xf038('0x25'),auth[_0xf038('0x9')](),controller[_0xf038('0x26')]);router[_0xf038('0x8')](_0xf038('0x27'),auth['isAuthenticated'](),controller['getAgents']);router[_0xf038('0x8')](_0xf038('0x28'),auth[_0xf038('0x9')](),controller[_0xf038('0x29')]);router[_0xf038('0x8')](_0xf038('0x2a'),auth['isAuthenticated'](),controller[_0xf038('0x2b')]);router['get']('/:id/mail_accounts',auth[_0xf038('0x9')](),controller[_0xf038('0x2c')]);router[_0xf038('0x8')](_0xf038('0x2d'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0xf038('0x2e'),auth[_0xf038('0x9')](),controller[_0xf038('0x2f')]);router[_0xf038('0x8')](_0xf038('0x30'),auth[_0xf038('0x9')](),controller[_0xf038('0x31')]);router[_0xf038('0x8')](_0xf038('0x32'),auth[_0xf038('0x9')](),controller[_0xf038('0x33')]);router[_0xf038('0x8')](_0xf038('0x34'),auth[_0xf038('0x9')](),controller[_0xf038('0x35')]);router[_0xf038('0x8')](_0xf038('0x36'),auth['isAuthenticated'](),controller[_0xf038('0x37')]);router[_0xf038('0x38')]('/:id/contacts',auth[_0xf038('0x9')](),controller['addContacts']);router[_0xf038('0x38')]('/',auth[_0xf038('0x9')](),controller[_0xf038('0x39')]);router[_0xf038('0x38')](_0xf038('0x3a'),auth['isAuthenticated'](),controller['bulkCreate']);router['post']('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0xf038('0x3b')]({'destination':function(_0x39e377,_0x337f9f,_0x500c01){_0x500c01(null,path['join'](config['root'],_0xf038('0x3c')));},'filename':function(_0x4d89a1,_0x338f4c,_0x133e6e){_0x133e6e(null,util[_0xf038('0x3d')](_0xf038('0x3e'),Date[_0xf038('0x3f')](),_0x338f4c[_0xf038('0x40')]));}})});router[_0xf038('0x38')](_0xf038('0x11'),upload[_0xf038('0x41')](_0xf038('0x42')),controller[_0xf038('0x43')]);router['post'](_0xf038('0x44'),auth['isAuthenticated'](),controller[_0xf038('0x45')]);router['post']('/:id/logout',auth[_0xf038('0x9')](),controller[_0xf038('0x46')]);router[_0xf038('0x38')](_0xf038('0x47'),auth[_0xf038('0x9')](),controller[_0xf038('0x48')]);router[_0xf038('0x38')](_0xf038('0x49'),auth[_0xf038('0x9')](),controller[_0xf038('0x4a')]);router[_0xf038('0x38')](_0xf038('0x23'),auth[_0xf038('0x9')](),controller['addTeams']);router[_0xf038('0x38')](_0xf038('0x4b'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0xf038('0x38')](_0xf038('0x4c'),auth[_0xf038('0x9')](),controller['addMailInteractions']);router[_0xf038('0x38')](_0xf038('0x4d'),auth[_0xf038('0x9')](),controller[_0xf038('0x4e')]);router[_0xf038('0x38')](_0xf038('0x4f'),auth[_0xf038('0x9')](),controller['addSmsInteractions']);router[_0xf038('0x38')](_0xf038('0x50'),auth[_0xf038('0x9')](),controller[_0xf038('0x51')]);router[_0xf038('0x38')](_0xf038('0x52'),auth[_0xf038('0x9')](),controller[_0xf038('0x53')]);router[_0xf038('0x38')](_0xf038('0x2a'),auth['isAuthenticated'](),controller[_0xf038('0x54')]);router[_0xf038('0x38')](_0xf038('0x55'),auth[_0xf038('0x9')](),controller[_0xf038('0x56')]);router['post'](_0xf038('0x2d'),auth[_0xf038('0x9')](),controller[_0xf038('0x57')]);router[_0xf038('0x38')](_0xf038('0x2e'),auth[_0xf038('0x9')](),controller[_0xf038('0x58')]);router[_0xf038('0x38')]('/:id/chat_websites',auth[_0xf038('0x9')](),controller[_0xf038('0x59')]);router['post']('/:id/whatsapp_accounts',auth[_0xf038('0x9')](),controller[_0xf038('0x5a')]);router[_0xf038('0x38')](_0xf038('0x36'),auth[_0xf038('0x9')](),controller[_0xf038('0x5b')]);router[_0xf038('0x5c')](_0xf038('0xf'),auth[_0xf038('0x9')](),controller[_0xf038('0x5d')]);router[_0xf038('0x5c')]('/:id/password',auth[_0xf038('0x9')](),controller['changePassword']);router[_0xf038('0x5e')](_0xf038('0x5f'),auth[_0xf038('0x9')](),controller['removeQueues']);router[_0xf038('0x5e')](_0xf038('0x23'),auth[_0xf038('0x9')](),controller[_0xf038('0x60')]);router[_0xf038('0x5e')]('/:id',auth['isAuthenticated'](),controller[_0xf038('0x61')]);router[_0xf038('0x5e')](_0xf038('0x4b'),auth[_0xf038('0x9')](),controller[_0xf038('0x62')]);router['delete'](_0xf038('0x4c'),auth[_0xf038('0x9')](),controller[_0xf038('0x63')]);router['delete']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xf038('0x64')]);router[_0xf038('0x5e')](_0xf038('0x4f'),auth[_0xf038('0x9')](),controller[_0xf038('0x65')]);router[_0xf038('0x5e')]('/:id/openchannel_interactions',auth[_0xf038('0x9')](),controller['removeOpenchannelInteractions']);router[_0xf038('0x5e')](_0xf038('0x52'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xf038('0x5e')](_0xf038('0x2a'),auth[_0xf038('0x9')](),controller[_0xf038('0x66')]);router[_0xf038('0x5e')](_0xf038('0x55'),auth['isAuthenticated'](),controller[_0xf038('0x67')]);router[_0xf038('0x5e')](_0xf038('0x2d'),auth[_0xf038('0x9')](),controller[_0xf038('0x68')]);router[_0xf038('0x5e')]('/:id/sms_accounts',auth[_0xf038('0x9')](),controller[_0xf038('0x69')]);router[_0xf038('0x5e')](_0xf038('0x30'),auth[_0xf038('0x9')](),controller[_0xf038('0x6a')]);router[_0xf038('0x5e')](_0xf038('0x32'),auth[_0xf038('0x9')](),controller[_0xf038('0x6b')]);router[_0xf038('0x5e')]('/:id/api_key',auth[_0xf038('0x9')](),controller[_0xf038('0x6c')]);router[_0xf038('0x38')](_0xf038('0x6d'),auth[_0xf038('0x9')](),controller[_0xf038('0x6e')]);module['exports']=router; \ No newline at end of file +var _0x9330=['/describe','isAuthenticated','describe','get','/whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','post','/:id/contacts','addContacts','create','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','now','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','createApiKey','put','/:id/password','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/api_key','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller'];(function(_0x369637,_0x3e6096){var _0x133c0f=function(_0x152014){while(--_0x152014){_0x369637['push'](_0x369637['shift']());}};_0x133c0f(++_0x3e6096);}(_0x9330,0xd3));var _0x0933=function(_0x35352d,_0x4dd1a5){_0x35352d=_0x35352d-0x0;var _0x20dae=_0x9330[_0x35352d];return _0x20dae;};'use strict';var multer=require(_0x0933('0x0'));var util=require(_0x0933('0x1'));var path=require('path');var timeout=require(_0x0933('0x2'));var express=require('express');var router=express[_0x0933('0x3')]();var fs_extra=require(_0x0933('0x4'));var auth=require(_0x0933('0x5'));var interaction=require(_0x0933('0x6'));var config=require(_0x0933('0x7'));var controller=require(_0x0933('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0933('0x9'),auth[_0x0933('0xa')](),controller[_0x0933('0xb')]);router[_0x0933('0xc')](_0x0933('0xd'),auth[_0x0933('0xa')](),controller['whoami']);router['get']('/presence',auth[_0x0933('0xa')](),controller[_0x0933('0xe')]);router[_0x0933('0xc')](_0x0933('0xf'),auth['isAuthenticated'](),controller[_0x0933('0x10')]);router['get'](_0x0933('0x11'),controller[_0x0933('0x12')]);router[_0x0933('0xc')](_0x0933('0x13'),auth[_0x0933('0xa')](),controller[_0x0933('0x14')]);router[_0x0933('0xc')]('/:id/contacts',auth[_0x0933('0xa')](),controller[_0x0933('0x15')]);router[_0x0933('0xc')](_0x0933('0x16'),auth[_0x0933('0xa')](),controller[_0x0933('0x17')]);router['get']('/:id/queues_rt',auth[_0x0933('0xa')](),controller[_0x0933('0x18')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router['get'](_0x0933('0x19'),auth[_0x0933('0xa')](),controller[_0x0933('0x1a')]);router[_0x0933('0xc')]('/:id/screen_recordings',auth[_0x0933('0xa')](),controller[_0x0933('0x1b')]);router[_0x0933('0xc')](_0x0933('0x1c'),auth[_0x0933('0xa')](),controller['getChatInteractions']);router[_0x0933('0xc')](_0x0933('0x1d'),auth[_0x0933('0xa')](),controller['getOpenchannelInteractions']);router[_0x0933('0xc')](_0x0933('0x1e'),auth[_0x0933('0xa')](),controller[_0x0933('0x1f')]);router['get'](_0x0933('0x20'),auth[_0x0933('0xa')](),controller[_0x0933('0x21')]);router[_0x0933('0xc')]('/:id/fax/interactions',auth[_0x0933('0xa')](),controller['getFaxInteractions']);router[_0x0933('0xc')](_0x0933('0x22'),auth[_0x0933('0xa')](),controller[_0x0933('0x23')]);router[_0x0933('0xc')](_0x0933('0x24'),auth[_0x0933('0xa')](),controller[_0x0933('0x25')]);router[_0x0933('0xc')](_0x0933('0x26'),auth['isAuthenticated'](),controller[_0x0933('0x27')]);router[_0x0933('0xc')](_0x0933('0x28'),auth['isAuthenticated'](),controller[_0x0933('0x29')]);router[_0x0933('0xc')](_0x0933('0x2a'),auth[_0x0933('0xa')](),controller[_0x0933('0x2b')]);router['get']('/:id/fax_accounts',auth[_0x0933('0xa')](),controller[_0x0933('0x2c')]);router[_0x0933('0xc')](_0x0933('0x2d'),auth[_0x0933('0xa')](),controller['getMailAccounts']);router[_0x0933('0xc')](_0x0933('0x2e'),auth[_0x0933('0xa')](),controller['getOpenchannelAccounts']);router[_0x0933('0xc')](_0x0933('0x2f'),auth[_0x0933('0xa')](),controller[_0x0933('0x30')]);router[_0x0933('0xc')]('/:id/chat_websites',auth[_0x0933('0xa')](),controller[_0x0933('0x31')]);router['get']('/:id/whatsapp_accounts',auth[_0x0933('0xa')](),controller[_0x0933('0x32')]);router[_0x0933('0xc')](_0x0933('0x33'),auth['isAuthenticated'](),controller[_0x0933('0x34')]);router['get']('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router[_0x0933('0x35')](_0x0933('0x36'),auth[_0x0933('0xa')](),controller[_0x0933('0x37')]);router[_0x0933('0x35')]('/',auth['isAuthenticated'](),controller[_0x0933('0x38')]);router[_0x0933('0x35')]('/create_many',auth['isAuthenticated'](),controller[_0x0933('0x39')]);router[_0x0933('0x35')](_0x0933('0x16'),auth[_0x0933('0xa')](),controller[_0x0933('0x3a')]);var upload=multer({'storage':multer[_0x0933('0x3b')]({'destination':function(_0x2c0fb8,_0x5f5b9b,_0x124980){_0x124980(null,path['join'](config[_0x0933('0x3c')],_0x0933('0x3d')));},'filename':function(_0x2e9752,_0x375e3c,_0x367d1d){_0x367d1d(null,util[_0x0933('0x3e')]('%s-%s',Date[_0x0933('0x3f')](),_0x375e3c['originalname']));}})});router[_0x0933('0x35')](_0x0933('0x11'),upload['single'](_0x0933('0x40')),controller[_0x0933('0x41')]);router['post'](_0x0933('0x42'),auth['isAuthenticated'](),controller[_0x0933('0x43')]);router[_0x0933('0x35')](_0x0933('0x44'),auth[_0x0933('0xa')](),controller[_0x0933('0x45')]);router[_0x0933('0x35')](_0x0933('0x46'),auth['isAuthenticated'](),controller[_0x0933('0x47')]);router[_0x0933('0x35')](_0x0933('0x48'),auth[_0x0933('0xa')](),controller['unpause']);router[_0x0933('0x35')](_0x0933('0x24'),auth['isAuthenticated'](),controller[_0x0933('0x49')]);router[_0x0933('0x35')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x0933('0x4a')]);router[_0x0933('0x35')](_0x0933('0x4b'),auth['isAuthenticated'](),controller['addMailInteractions']);router['post'](_0x0933('0x4c'),auth[_0x0933('0xa')](),controller['addFaxInteractions']);router[_0x0933('0x35')]('/:id/sms_interactions',auth[_0x0933('0xa')](),controller[_0x0933('0x4d')]);router[_0x0933('0x35')](_0x0933('0x4e'),auth['isAuthenticated'](),controller[_0x0933('0x4f')]);router[_0x0933('0x35')](_0x0933('0x50'),auth[_0x0933('0xa')](),controller[_0x0933('0x51')]);router['post']('/:id/fax_accounts',auth[_0x0933('0xa')](),controller['addFaxAccounts']);router['post'](_0x0933('0x2d'),auth['isAuthenticated'](),controller[_0x0933('0x52')]);router[_0x0933('0x35')](_0x0933('0x2e'),auth['isAuthenticated'](),controller[_0x0933('0x53')]);router[_0x0933('0x35')]('/:id/sms_accounts',auth[_0x0933('0xa')](),controller['addSmsAccounts']);router[_0x0933('0x35')](_0x0933('0x54'),auth[_0x0933('0xa')](),controller[_0x0933('0x55')]);router[_0x0933('0x35')](_0x0933('0x56'),auth[_0x0933('0xa')](),controller['addWhatsappAccounts']);router[_0x0933('0x35')]('/:id/api_key',auth[_0x0933('0xa')](),controller[_0x0933('0x57')]);router[_0x0933('0x58')]('/:id',auth[_0x0933('0xa')](),controller['update']);router[_0x0933('0x58')](_0x0933('0x59'),auth[_0x0933('0xa')](),controller['changePassword']);router['delete'](_0x0933('0x16'),auth['isAuthenticated'](),controller[_0x0933('0x5a')]);router[_0x0933('0x5b')](_0x0933('0x24'),auth['isAuthenticated'](),controller[_0x0933('0x5c')]);router[_0x0933('0x5b')](_0x0933('0xf'),auth[_0x0933('0xa')](),controller[_0x0933('0x5d')]);router['delete']('/:id/chat_interactions',auth[_0x0933('0xa')](),controller[_0x0933('0x5e')]);router[_0x0933('0x5b')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x0933('0x5f')]);router[_0x0933('0x5b')]('/:id/fax_interactions',auth[_0x0933('0xa')](),controller['removeFaxInteractions']);router['delete'](_0x0933('0x60'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x0933('0x5b')](_0x0933('0x4e'),auth['isAuthenticated'](),controller[_0x0933('0x61')]);router[_0x0933('0x5b')](_0x0933('0x50'),auth[_0x0933('0xa')](),controller[_0x0933('0x62')]);router[_0x0933('0x5b')](_0x0933('0x63'),auth[_0x0933('0xa')](),controller[_0x0933('0x64')]);router[_0x0933('0x5b')](_0x0933('0x2d'),auth['isAuthenticated'](),controller[_0x0933('0x65')]);router[_0x0933('0x5b')](_0x0933('0x2e'),auth[_0x0933('0xa')](),controller[_0x0933('0x66')]);router[_0x0933('0x5b')](_0x0933('0x2f'),auth['isAuthenticated'](),controller[_0x0933('0x67')]);router['delete'](_0x0933('0x54'),auth[_0x0933('0xa')](),controller[_0x0933('0x68')]);router['delete']('/:id/whatsapp_accounts',auth[_0x0933('0xa')](),controller[_0x0933('0x69')]);router[_0x0933('0x5b')](_0x0933('0x6a'),auth[_0x0933('0xa')](),controller[_0x0933('0x6b')]);router[_0x0933('0x35')](_0x0933('0x6c'),auth[_0x0933('0xa')](),controller[_0x0933('0x6d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 1065e1e..24cc2f1 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 _0x641c=['callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','local','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','passive','update,nonat','TEXT','showWebBar','get','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','actpass','dtlscertfile','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','util','name','setDataValue','STRING','fullname'];(function(_0x41f0c4,_0x34c5f0){var _0x517d7b=function(_0x12668e){while(--_0x12668e){_0x41f0c4['push'](_0x41f0c4['shift']());}};_0x517d7b(++_0x34c5f0);}(_0x641c,0x102));var _0xc641=function(_0x44d707,_0x3a6867){_0x44d707=_0x44d707-0x0;var _0x41fde1=_0x641c[_0x44d707];return _0x41fde1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc641('0x0'));var util=require(_0xc641('0x1'));var _=require('lodash');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc641('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5f0389){this[_0xc641('0x3')](_0xc641('0x2'),_0x5f0389);this[_0xc641('0x3')]('defaultuser',_0x5f0389);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xc641('0x4')],'allowNull':![],'set':function(_0x50c7d6){this['setDataValue'](_0xc641('0x5'),_0x50c7d6);this['setDataValue'](_0xc641('0x6'),util[_0xc641('0x7')](_0xc641('0x8'),_0x50c7d6,this[_0xc641('0x9')](_0xc641('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc641('0x4')],'allowNull':![],'unique':_0xc641('0xb'),'validate':{'isEmail':!![]},'set':function(_0x162f19){if(_0x162f19){this[_0xc641('0x3')](_0xc641('0xb'),_0x162f19[_0xc641('0xc')]());}}},'role':{'type':Sequelize[_0xc641('0xd')](_0xc641('0xe'),_0xc641('0xf'),_0xc641('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xc641('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xc641('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0xe9fd27){this[_0xc641('0x3')](_0xc641('0xa'),_0xe9fd27);this[_0xc641('0x3')]('accountcode',_0xe9fd27);this[_0xc641('0x3')](_0xc641('0x6'),util[_0xc641('0x7')](_0xc641('0x8'),this[_0xc641('0x9')](_0xc641('0x5')),_0xe9fd27));}},'salt':{'type':Sequelize[_0xc641('0x4')]},'phone':{'type':Sequelize[_0xc641('0x4')]},'mobile':{'type':Sequelize[_0xc641('0x4')]},'address':{'type':Sequelize[_0xc641('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc641('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xc641('0x12')]},'voicePause':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc641('0x4')],'defaultValue':_0xc641('0x14')},'lastPauseAt':{'type':Sequelize[_0xc641('0x12')]},'chatCapacity':{'type':Sequelize[_0xc641('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc641('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc641('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc641('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc641('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc641('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc641('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc641('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![],'defaultValue':_0xc641('0x16')},'ipaddr':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xc641('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x17'),_0xc641('0xf'),_0xc641('0x18')),'allowNull':!![],'defaultValue':_0xc641('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc641('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0xc641('0x1a'),_0xc641('0x1b'),_0xc641('0x1c'),'ALLOWED',_0xc641('0x1d'),'PROHIB_PASSED_SCREEN',_0xc641('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![],'defaultValue':_0xc641('0x1f'),'set':function(_0x320c9d){this[_0xc641('0x3')]('transport',_0x320c9d?_0x320c9d[_0xc641('0x20')](','):null);},'get':function(){return this[_0xc641('0x9')](_0xc641('0x21'))?this[_0xc641('0x9')](_0xc641('0x21'))['split'](','):null;},'comment':_0xc641('0x22')},'dtmfmode':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x23'),_0xc641('0x24'),_0xc641('0x25'),_0xc641('0x26'),_0xc641('0x27')),'allowNull':!![],'defaultValue':_0xc641('0x23')},'directmedia':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no',_0xc641('0x29'),_0xc641('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc641('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x12241b){this[_0xc641('0x3')](_0xc641('0x2b'),_0x12241b?_0x12241b[_0xc641('0x20')](','):null);},'get':function(){return this[_0xc641('0x9')](_0xc641('0x2b'))?this[_0xc641('0x9')]('nat')['split'](','):null;},'comment':_0xc641('0x2c')},'callgroup':{'type':Sequelize[_0xc641('0x4')]},'namedcallgroup':{'type':Sequelize[_0xc641('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc641('0x4')]},'language':{'type':Sequelize[_0xc641('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc641('0x2d')},'allow':{'type':Sequelize[_0xc641('0x4')],'allowNull':![],'defaultValue':_0xc641('0x2e'),'set':function(_0x2ec27c){this['setDataValue'](_0xc641('0x2f'),_0x2ec27c?_0x2ec27c[_0xc641('0x20')](';'):_0xc641('0x2e'));},'get':function(){return this[_0xc641('0x9')]('allow')?this[_0xc641('0x9')](_0xc641('0x2f'))[_0xc641('0x30')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![],'set':function(_0x18050e){this['setDataValue']('insecure',_0x18050e?_0x18050e['join'](','):null);},'get':function(){return this[_0xc641('0x9')](_0xc641('0x31'))?this['getDataValue'](_0xc641('0x31'))[_0xc641('0x30')](','):null;},'comment':_0xc641('0x32')},'trustrpid':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xc641('0x28'),'no',_0xc641('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![],'defaultValue':_0xc641('0x34')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc641('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xc641('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xc641('0x28'),'no',_0xc641('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc641('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc641('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x36'),_0xc641('0x37'),_0xc641('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc641('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xc641('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc641('0xd')]('uac','uas'),'allowNull':!![],'defaultValue':_0xc641('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xc641('0x28'),'no'),'allowNull':!![],'defaultValue':_0xc641('0x28')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc641('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc641('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc641('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc641('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xc641('0x28'),'no',_0xc641('0x3a'),_0xc641('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc641('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc641('0xd')]('active',_0xc641('0x3c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc641('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xc641('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xc641('0x29'),_0xc641('0x2a'),_0xc641('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc641('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xc641('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc641('0x3e')]},'showWebBar':{'type':Sequelize[_0xc641('0x15')],'defaultValue':0x0,'set':function(_0x12e839){this[_0xc641('0x3')](_0xc641('0x3f'),_0x12e839);var _0x476a25=this[_0xc641('0x40')]({'plain':!![]});switch(_0x12e839){case 0x0:case 0x1:var _0x54293d=_0x476a25[_0xc641('0x21')]?_['isArray'](_0x476a25[_0xc641('0x21')])?_0x476a25[_0xc641('0x21')][_0xc641('0x20')]():_0x476a25[_0xc641('0x21')]:_0xc641('0x1f');if(_0x54293d==='wss'){_0x54293d=_0xc641('0x1f');}this[_0xc641('0x3')](_0xc641('0x21'),_0x54293d);this[_0xc641('0x3')](_0xc641('0x41'),'no');this[_0xc641('0x3')](_0xc641('0x42'),null);this[_0xc641('0x3')](_0xc641('0x43'),null);this[_0xc641('0x3')](_0xc641('0x44'),null);this[_0xc641('0x3')](_0xc641('0x45'),null);this[_0xc641('0x3')](_0xc641('0x46'),null);this[_0xc641('0x3')](_0xc641('0x47'),null);this['setDataValue']('dtlscertfile',null);this[_0xc641('0x3')](_0xc641('0x48'),null);this[_0xc641('0x3')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0xc641('0x21'),'wss');this[_0xc641('0x3')](_0xc641('0x41'),'yes');this[_0xc641('0x3')](_0xc641('0x42'),_0xc641('0x28'));this[_0xc641('0x3')]('force_avp',_0xc641('0x28'));this[_0xc641('0x3')](_0xc641('0x44'),_0xc641('0x28'));this[_0xc641('0x3')](_0xc641('0x45'),'yes');this[_0xc641('0x3')](_0xc641('0x46'),'no');this[_0xc641('0x3')]('dtlssetup',_0xc641('0x49'));this['setDataValue'](_0xc641('0x4a'),_0x476a25['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0xc641('0x3')]('dtlsprivatekey',_0x476a25[_0xc641('0x48')]||_0xc641('0x4b'));this['setDataValue'](_0xc641('0x4c'),_0xc641('0x28'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1e9615){this[_0xc641('0x3')](_0xc641('0x4d'),_0x1e9615?_0x1e9615['join'](','):[]);},'get':function(){return this[_0xc641('0x9')](_0xc641('0x4d'))?_[_0xc641('0x4e')](this[_0xc641('0x9')]('permissions')[_0xc641('0x30')](','),function(_0x5258b0){return parseInt(_0x5258b0,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc641('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc641('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xc641('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc641('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc641('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xc641('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc641('0xd')](_0xc641('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc641('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xc641('0x4f'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xc641('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc641('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![],'set':function(_0x3f7014){if(typeof _0x3f7014===_0xc641('0x50')){var _0xd98ff9=_0x3f7014==='1'?!![]:_0x3f7014==='0'?![]:_0x3f7014===_0xc641('0x51')?!![]:_0x3f7014===_0xc641('0x52')?![]:![];this['setDataValue'](_0xc641('0x53'),_0xd98ff9);}else{this[_0xc641('0x3')](_0xc641('0x53'),_0x3f7014);}}},'blocked':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![],'set':function(_0x3bc00d){this[_0xc641('0x3')](_0xc641('0x54'),_0x3bc00d);if(_0x3bc00d===!![]){this['setDataValue'](_0xc641('0x55'),moment());this['setDataValue'](_0xc641('0x56'),0x0);}else{this[_0xc641('0x3')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xc641('0x12')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc641('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc641('0x15')](0x5)[_0xc641('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc641('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc641('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xc641('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xc641('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xc641('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xc641('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xc641('0x13')],'defaultValue':![]}}; \ No newline at end of file +var _0x3f9c=['allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','update,nonat','DATE','TEXT','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','dtlssetup','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','util','lodash','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','admin','agent','telephone','local','INTEGER','internal','accountcode','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','user','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','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'];(function(_0x4b27c6,_0x5bf653){var _0x54ae89=function(_0x5cd51f){while(--_0x5cd51f){_0x4b27c6['push'](_0x4b27c6['shift']());}};_0x54ae89(++_0x5bf653);}(_0x3f9c,0xea));var _0xc3f9=function(_0x4601c3,_0x5e6210){_0x4601c3=_0x4601c3-0x0;var _0xe1d1e2=_0x3f9c[_0x4601c3];return _0xe1d1e2;};'use strict';var Sequelize=require(_0xc3f9('0x0'));var moment=require(_0xc3f9('0x1'));var util=require(_0xc3f9('0x2'));var _=require(_0xc3f9('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc3f9('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x46d5f3){this[_0xc3f9('0x5')](_0xc3f9('0x4'),_0x46d5f3);this[_0xc3f9('0x5')](_0xc3f9('0x6'),_0x46d5f3);},'comment':_0xc3f9('0x7')},'fullname':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':![],'set':function(_0x430cd9){this['setDataValue'](_0xc3f9('0x9'),_0x430cd9);this[_0xc3f9('0x5')](_0xc3f9('0xa'),util[_0xc3f9('0xb')](_0xc3f9('0xc'),_0x430cd9,this[_0xc3f9('0xd')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0xd6892a){if(_0xd6892a){this['setDataValue'](_0xc3f9('0xe'),_0xd6892a[_0xc3f9('0xf')]());}}},'role':{'type':Sequelize['ENUM'](_0xc3f9('0x10'),'user',_0xc3f9('0x11'),_0xc3f9('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc3f9('0x8')],'defaultValue':_0xc3f9('0x13')},'internal':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':![],'unique':_0xc3f9('0x15'),'set':function(_0x428f2d){this[_0xc3f9('0x5')](_0xc3f9('0x15'),_0x428f2d);this['setDataValue'](_0xc3f9('0x16'),_0x428f2d);this['setDataValue']('callerid',util[_0xc3f9('0xb')](_0xc3f9('0xc'),this['getDataValue'](_0xc3f9('0x9')),_0x428f2d));}},'salt':{'type':Sequelize[_0xc3f9('0x8')]},'phone':{'type':Sequelize[_0xc3f9('0x8')]},'mobile':{'type':Sequelize[_0xc3f9('0x8')]},'address':{'type':Sequelize[_0xc3f9('0x8')]},'zipcode':{'type':Sequelize[_0xc3f9('0x8')]},'userpic':{'type':Sequelize[_0xc3f9('0x8')]},'city':{'type':Sequelize[_0xc3f9('0x8')]},'country':{'type':Sequelize[_0xc3f9('0x8')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc3f9('0x8')],'defaultValue':_0xc3f9('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc3f9('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc3f9('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'host':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![],'defaultValue':_0xc3f9('0x19')},'ipaddr':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'port':{'type':Sequelize[_0xc3f9('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x1b'),_0xc3f9('0x1c'),_0xc3f9('0x1d')),'allowNull':!![],'defaultValue':_0xc3f9('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc3f9('0x1e')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xc3f9('0x1f'),_0xc3f9('0x20'),_0xc3f9('0x21'),_0xc3f9('0x22'),'PROHIB_PASSED_SCREEN',_0xc3f9('0x23'),_0xc3f9('0x24')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![],'defaultValue':_0xc3f9('0x25'),'set':function(_0x134a2d){this[_0xc3f9('0x5')](_0xc3f9('0x26'),_0x134a2d?_0x134a2d[_0xc3f9('0x27')](','):null);},'get':function(){return this['getDataValue'](_0xc3f9('0x26'))?this[_0xc3f9('0xd')]('transport')[_0xc3f9('0x28')](','):null;},'comment':_0xc3f9('0x29')},'dtmfmode':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2a'),_0xc3f9('0x2b'),'shortinfo','inband',_0xc3f9('0x2c')),'allowNull':!![],'defaultValue':_0xc3f9('0x2a')},'directmedia':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no',_0xc3f9('0x2e'),_0xc3f9('0x2f'),_0xc3f9('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![],'defaultValue':_0xc3f9('0x31'),'set':function(_0x448ed9){this['setDataValue']('nat',_0x448ed9?_0x448ed9['join'](','):null);},'get':function(){return this[_0xc3f9('0xd')]('nat')?this[_0xc3f9('0xd')](_0xc3f9('0x32'))['split'](','):null;},'comment':_0xc3f9('0x33')},'callgroup':{'type':Sequelize[_0xc3f9('0x8')]},'namedcallgroup':{'type':Sequelize[_0xc3f9('0x8')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc3f9('0x8')]},'language':{'type':Sequelize[_0xc3f9('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc3f9('0x8')]},'disallow':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':![],'defaultValue':_0xc3f9('0x34')},'allow':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':![],'defaultValue':_0xc3f9('0x35'),'set':function(_0xdfb1dd){this[_0xc3f9('0x5')]('allow',_0xdfb1dd?_0xdfb1dd[_0xc3f9('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xc3f9('0xd')](_0xc3f9('0x36'))?this[_0xc3f9('0xd')](_0xc3f9('0x36'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x5d3654){this[_0xc3f9('0x5')]('insecure',_0x5d3654?_0x5d3654[_0xc3f9('0x27')](','):null);},'get':function(){return this[_0xc3f9('0xd')](_0xc3f9('0x37'))?this[_0xc3f9('0xd')](_0xc3f9('0x37'))[_0xc3f9('0x28')](','):null;},'comment':_0xc3f9('0x38')},'trustrpid':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no',_0xc3f9('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![],'defaultValue':_0xc3f9('0x3a')},'amaflags':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc3f9('0x1a')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no',_0xc3f9('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc3f9('0x1a')]('accept',_0xc3f9('0x3c'),_0xc3f9('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x3e'),'uas'),'allowNull':!![],'defaultValue':_0xc3f9('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no',_0xc3f9('0x40'),_0xc3f9('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x42'),_0xc3f9('0x43'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc3f9('0x1a')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no','nonat','update',_0xc3f9('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc3f9('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0xc3f9('0x45')]},'passwordResetAt':{'type':Sequelize[_0xc3f9('0x45')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc3f9('0x46')]},'showWebBar':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0,'set':function(_0x349302){this[_0xc3f9('0x5')](_0xc3f9('0x47'),_0x349302);var _0x5db8e5=this[_0xc3f9('0x48')]({'plain':!![]});switch(_0x349302){case 0x0:case 0x1:var _0x82acbe=_0x5db8e5[_0xc3f9('0x26')]?_[_0xc3f9('0x49')](_0x5db8e5[_0xc3f9('0x26')])?_0x5db8e5['transport'][_0xc3f9('0x27')]():_0x5db8e5[_0xc3f9('0x26')]:'udp';if(_0x82acbe===_0xc3f9('0x4a')){_0x82acbe='udp';}this[_0xc3f9('0x5')](_0xc3f9('0x26'),_0x82acbe);this[_0xc3f9('0x5')](_0xc3f9('0x4b'),'no');this['setDataValue']('avpf',null);this[_0xc3f9('0x5')](_0xc3f9('0x4c'),null);this[_0xc3f9('0x5')](_0xc3f9('0x4d'),null);this[_0xc3f9('0x5')]('dtlsenable',null);this[_0xc3f9('0x5')](_0xc3f9('0x4e'),null);this[_0xc3f9('0x5')]('dtlssetup',null);this[_0xc3f9('0x5')](_0xc3f9('0x4f'),null);this[_0xc3f9('0x5')](_0xc3f9('0x50'),null);this[_0xc3f9('0x5')](_0xc3f9('0x51'),'no');break;case 0x2:this['setDataValue'](_0xc3f9('0x26'),_0xc3f9('0x4a'));this['setDataValue'](_0xc3f9('0x4b'),'yes');this[_0xc3f9('0x5')](_0xc3f9('0x52'),'yes');this[_0xc3f9('0x5')]('force_avp',_0xc3f9('0x2d'));this[_0xc3f9('0x5')](_0xc3f9('0x4d'),'yes');this['setDataValue']('dtlsenable',_0xc3f9('0x2d'));this[_0xc3f9('0x5')](_0xc3f9('0x4e'),'no');this[_0xc3f9('0x5')](_0xc3f9('0x53'),'actpass');this[_0xc3f9('0x5')](_0xc3f9('0x4f'),_0x5db8e5[_0xc3f9('0x4f')]||_0xc3f9('0x54'));this[_0xc3f9('0x5')](_0xc3f9('0x50'),_0x5db8e5[_0xc3f9('0x50')]||'/etc/pki/tls/private/motion.key');this[_0xc3f9('0x5')](_0xc3f9('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xc3f9('0x46')],'set':function(_0x17bffc){this[_0xc3f9('0x5')](_0xc3f9('0x55'),_0x17bffc?_0x17bffc[_0xc3f9('0x27')](','):[]);},'get':function(){return this[_0xc3f9('0xd')](_0xc3f9('0x55'))?_[_0xc3f9('0x56')](this['getDataValue'](_0xc3f9('0x55'))[_0xc3f9('0x28')](','),function(_0x46093f){return parseInt(_0x46093f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc3f9('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc3f9('0x8')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc3f9('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc3f9('0x8')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc3f9('0x57')],'get':function(){return this[_0xc3f9('0xd')]('phoneBarEnableScreenRecordingByAgent')?this[_0xc3f9('0xd')](_0xc3f9('0x58')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xc3f9('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![],'set':function(_0x1a600f){if(typeof _0x1a600f===_0xc3f9('0x59')){var _0x56010e=_0x1a600f==='1'?!![]:_0x1a600f==='0'?![]:_0x1a600f===_0xc3f9('0x5a')?!![]:_0x1a600f==='false'?![]:![];this[_0xc3f9('0x5')](_0xc3f9('0x5b'),_0x56010e);}else{this[_0xc3f9('0x5')](_0xc3f9('0x5b'),_0x1a600f);}}},'blocked':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![],'set':function(_0x26017d){this['setDataValue'](_0xc3f9('0x5c'),_0x26017d);if(_0x26017d===!![]){this[_0xc3f9('0x5')]('blockedAt',moment());this['setDataValue'](_0xc3f9('0x5d'),0x0);}else{this[_0xc3f9('0x5')](_0xc3f9('0x5e'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc3f9('0x14')](0x5)[_0xc3f9('0x5f')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 9a144e6..c94e059 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 _0x4a78=['toUpperCase','select','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','moment','util','lodash','squel','ioredis','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','../../config/utils','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','request\x20sent','stringify','error','code','User,\x20%s,\x20%s','message','info','result','catch','update','then','agent','role','admin','user','Agents','Telephones','telephone','filter','ignore','map','includes','find','value','name','UserProfileResource','destroy','stack','key','salt','previousPasswords','resetPasswordToken','md5secret','where','User','query','includeAll','userSetting','true','include','UserSetting','attributes','push','rows','chat','sms','dataValues','fax','mail','openchannel','whatsapp','all','show','getOptions','merge','options','openTabs','body','params','describe','addContacts','ids','omit','internal','findById','password','max','isNil','min_internal','sequelize','QueryTypes','SELECT','length','from','mailbox','VoiceMail','fullname','email','permissions','101','102','103','110','105','106','107','108','109','100','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','autoAssociation','compact','changePassword','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','Sequelize','ValidationError','Wrong\x20credentials','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','enforcePasswordHistory','securePassword','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','emit','Queue:save','voice','VoiceQueue','findAll','get','interface','format','SIP/%s','upsert','channel','isArray','QueueId','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','getAvatar','server/files/images/logos/default_profile.png','download','existsSync','join','root','server/files/images/','getOpenTabs','CHAT','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','Tag','tag','getQueues','findOne','isValidChannel','model','keys','Queue','rawAttributes','intersection','fields','sort','filters','pick','Unknown\x20role','nolimit','getVoiceQueuesRt','order','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','MemberReport','forEach','LOGIN','device','LOGININPAUSE','bulkCreate','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','pause','QueuePause','PAUSE','getChannels','type','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeTeams','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','concat','$and','$or','$gt','$lt','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','firstName','lastName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','send','resolve','getUserSetting','getPresence','idle','unknown','queues','inbound','flatten','toString','lower','col','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x4a78,0x19a));var _0x84a7=function(_0x535144,_0x8b5ce5){_0x535144=_0x535144-0x0;var _0x3941f6=_0x4a78[_0x535144];return _0x3941f6;};'use strict';var moment=require(_0x84a7('0x0'));var util=require(_0x84a7('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x84a7('0x2'));var squel=require(_0x84a7('0x3'));var Redis=require(_0x84a7('0x4'));var jayson=require(_0x84a7('0x5'));var authService=require(_0x84a7('0x6'));var contacts=require(_0x84a7('0x7'));var qs=require(_0x84a7('0x8'));var rta=require(_0x84a7('0x9'));var logger=require(_0x84a7('0xa'))('api');var utils=require(_0x84a7('0xb'));var config=require(_0x84a7('0xc'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x84a7('0xd'))[_0x84a7('0xe')];var APINotFoundError=require(_0x84a7('0xd'))[_0x84a7('0xf')];var APIForbiddenError=require(_0x84a7('0xd'))['APIForbiddenrror'];var APIHandleError=require(_0x84a7('0xd'))[_0x84a7('0x10')];var db=require(_0x84a7('0x11'))['db'];var socket=require(_0x84a7('0x12'))(new Redis(config[_0x84a7('0x13')]));require(_0x84a7('0x14'))[_0x84a7('0x15')](socket);config[_0x84a7('0x13')]=_[_0x84a7('0x16')](config['redis'],{'host':_0x84a7('0x17'),'port':0x18eb});var amiClient=jayson['client']['http']({'port':0x232a});var values;function respondWithStatusCode(_0x22e6ad,_0xb54534){_0xb54534=_0xb54534||0xcc;return function(_0x5929ab){if(_0x5929ab){return _0x22e6ad[_0x84a7('0x18')](_0xb54534);}return _0x22e6ad[_0x84a7('0x19')](_0xb54534)[_0x84a7('0x1a')]();};}function respondWithResult(_0x362e4f,_0x1f5ea3){_0x1f5ea3=_0x1f5ea3||0xc8;return function(_0x5c6b2b){if(_0x5c6b2b){return _0x362e4f[_0x84a7('0x19')](_0x1f5ea3)['json'](_0x5c6b2b);}};}function respondWithFilteredResult(_0x34bc92,_0x4fbf6a){return function(_0x50b5c5){if(_0x50b5c5){var _0x5644af=typeof _0x4fbf6a[_0x84a7('0x1b')]==='undefined'&&typeof _0x4fbf6a[_0x84a7('0x1c')]===_0x84a7('0x1d');var _0x4c5705=_0x50b5c5[_0x84a7('0x1e')];var _0x210cb5=_0x5644af?0x0:_0x4fbf6a[_0x84a7('0x1b')];var _0x20eb75=_0x5644af?_0x50b5c5[_0x84a7('0x1e')]:_0x4fbf6a[_0x84a7('0x1b')]+_0x4fbf6a[_0x84a7('0x1c')];var _0x10d9cf;if(_0x20eb75>=_0x4c5705){_0x20eb75=_0x4c5705;_0x10d9cf=0xc8;}else{_0x10d9cf=0xce;}_0x34bc92[_0x84a7('0x19')](_0x10d9cf);return _0x34bc92[_0x84a7('0x1f')](_0x84a7('0x20'),_0x210cb5+'-'+_0x20eb75+'/'+_0x4c5705)[_0x84a7('0x21')](_0x50b5c5);}return null;};}function respondWithRpcPromise(_0x43423c,_0x555750,_0x59921c,_0x342133){return new Promise(function(_0xdaf556,_0x124115){var _0x2bc805=_0x342133||amiClient;return _0x2bc805['request'](_0x43423c,_0x59921c)['then'](function(_0x4de4d0){logger['info']('User,\x20%s,\x20%s',_0x555750,_0x84a7('0x22'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x555750,_0x84a7('0x22'),JSON[_0x84a7('0x23')](_0x4de4d0));if(_0x4de4d0[_0x84a7('0x24')]){if(_0x4de4d0[_0x84a7('0x24')][_0x84a7('0x25')]===0x1f4){logger['error'](_0x84a7('0x26'),_0x555750,_0x4de4d0[_0x84a7('0x24')][_0x84a7('0x27')]);return _0x124115(_0x4de4d0[_0x84a7('0x24')][_0x84a7('0x27')]);}logger['error']('User,\x20%s,\x20%s',_0x555750,_0x4de4d0['error'][_0x84a7('0x27')]);return _0xdaf556(_0x4de4d0['error'][_0x84a7('0x27')]);}else{logger[_0x84a7('0x28')](_0x84a7('0x26'),_0x555750,_0x84a7('0x22'));_0xdaf556(_0x4de4d0[_0x84a7('0x29')][_0x84a7('0x27')]);}})[_0x84a7('0x2a')](function(_0x4b6242){logger[_0x84a7('0x24')](_0x84a7('0x26'),_0x555750,_0x4b6242);_0x124115(_0x4b6242);});});}function saveUpdates(_0x13b200){return function(_0x596d45){if(_0x596d45){return _0x596d45[_0x84a7('0x2b')](_0x13b200)[_0x84a7('0x2c')](function(_0x8e5b60){if(_0x8e5b60['role']===_0x84a7('0x2d')){socket['emit']('userNotification:recalc:'+_0x8e5b60['id'],_0x8e5b60);}return _0x8e5b60;});}return null;};}function removeEntity(_0x2517a4,_0x1ecb82){return function(_0x17224a){if(_0x17224a){return _0x17224a['destroy']({'transaction':_0x1ecb82})['then'](function(){var _0x3ce73c=_0x17224a['get']({'plain':!![]});if(_0x3ce73c[_0x84a7('0x2e')]===_0x84a7('0x2f'))return;var _0x119a72=[{'name':'Users','value':_0x84a7('0x30'),'ignore':!![]},{'name':_0x84a7('0x31'),'value':_0x84a7('0x2d'),'ignore':![]},{'name':_0x84a7('0x32'),'value':_0x84a7('0x33'),'ignore':![]}];var _0x41e421=_(_0x119a72)[_0x84a7('0x34')](_0x84a7('0x35'))[_0x84a7('0x36')]('value')['value']();if(_[_0x84a7('0x37')](_0x41e421,_0x3ce73c[_0x84a7('0x2e')])){return;}var _0x4704b6=_[_0x84a7('0x38')](_0x119a72,[_0x84a7('0x39'),_0x3ce73c[_0x84a7('0x2e')]])[_0x84a7('0x3a')];return db[_0x84a7('0x3b')][_0x84a7('0x3c')]({'where':{'type':_0x4704b6,'resourceId':_0x3ce73c['id']},'transaction':_0x1ecb82})['then'](function(){return _0x17224a;});})['then'](function(){_0x2517a4[_0x84a7('0x19')](0xcc)[_0x84a7('0x1a')]();});}};}function handleEntityNotFound(_0x4c922d){return function(_0xf609e){if(!_0xf609e){_0x4c922d[_0x84a7('0x18')](0x194);}return _0xf609e;};}function handleError(_0x2dccce,_0x39e9fc){_0x39e9fc=_0x39e9fc||0x1f4;return function(_0x4717a6){logger['error'](_0x4717a6[_0x84a7('0x3d')]);if(_0x4717a6[_0x84a7('0x3a')]){delete _0x4717a6[_0x84a7('0x3a')];}_0x2dccce[_0x84a7('0x19')](_0x39e9fc)['send'](_0x4717a6);};}function getUserAttributes(){return _(db['User']['rawAttributes'])[_0x84a7('0x36')](function(_0x39b527){return{'name':_0x39b527['fieldName'],'type':_0x39b527['type'][_0x84a7('0x3e')]};})[_0x84a7('0x34')](function(_0x104224){return!['password',_0x84a7('0x3f'),_0x84a7('0x40'),_0x84a7('0x41'),'resetPasswordExpires',_0x84a7('0x42')][_0x84a7('0x37')](_0x104224[_0x84a7('0x3a')]);})[_0x84a7('0x39')]();}exports['index']=function(_0x10a492,_0x53cf8c){var _0x1e8409={},_0x4f60b6={'count':0x0,'rows':[]};var _0x5bc700=getUserAttributes();_0x1e8409=qs['getOptions'](_0x5bc700,_0x10a492);var _0x3c2c84={'where':_0x1e8409[_0x84a7('0x43')]};return db[_0x84a7('0x44')][_0x84a7('0x1e')](_0x3c2c84)[_0x84a7('0x2c')](function(_0x535578){_0x4f60b6[_0x84a7('0x1e')]=_0x535578;if(_0x10a492[_0x84a7('0x45')][_0x84a7('0x46')]){_0x1e8409['include']=[{'all':!![]}];}if(_0x10a492[_0x84a7('0x45')][_0x84a7('0x47')]===_0x84a7('0x48')){_0x1e8409[_0x84a7('0x49')]=[{'model':db[_0x84a7('0x4a')],'as':_0x84a7('0x47')}];}if(!_[_0x84a7('0x37')](_0x1e8409[_0x84a7('0x4b')],'id')){_0x1e8409[_0x84a7('0x4b')][_0x84a7('0x4c')]('id');}return db[_0x84a7('0x44')]['findAll'](_0x1e8409);})[_0x84a7('0x2c')](function(_0x1a4148){_0x4f60b6[_0x84a7('0x4d')]=_0x1a4148;if(_0x10a492[_0x84a7('0x45')]['openTabs']===_0x84a7('0x48')){var _0x42effc=[];for(var _0x4401c8=0x0;_0x4401c8<_0x4f60b6[_0x84a7('0x4d')]['length'];_0x4401c8++){_0x42effc[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x4e'),_0x4f60b6[_0x84a7('0x4d')][_0x4401c8]['dataValues']));_0x42effc[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x4f'),_0x4f60b6['rows'][_0x4401c8][_0x84a7('0x50')]));_0x42effc[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x51'),_0x4f60b6[_0x84a7('0x4d')][_0x4401c8][_0x84a7('0x50')]));_0x42effc[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x52'),_0x4f60b6[_0x84a7('0x4d')][_0x4401c8][_0x84a7('0x50')]));_0x42effc['push'](get_open_tabs(_0x84a7('0x53'),_0x4f60b6[_0x84a7('0x4d')][_0x4401c8][_0x84a7('0x50')]));_0x42effc[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x54'),_0x4f60b6['rows'][_0x4401c8][_0x84a7('0x50')]));}return Promise[_0x84a7('0x55')](_0x42effc)[_0x84a7('0x2c')](function(){return _0x4f60b6;});}else{return _0x4f60b6;}})[_0x84a7('0x2c')](respondWithFilteredResult(_0x53cf8c,_0x1e8409))['catch'](handleError(_0x53cf8c,null));};exports[_0x84a7('0x56')]=function(_0x2c2daa,_0x2531b2){var _0x48f30a=getUserAttributes();_0x2c2daa[_0x84a7('0x45')]['id']=_0x2c2daa['params']['id'];var _0x102754=qs[_0x84a7('0x57')](_0x48f30a,_0x2c2daa);if(_0x2c2daa[_0x84a7('0x45')][_0x84a7('0x46')]){_0x102754[_0x84a7('0x49')]=[{'all':!![]}];}if(_0x2c2daa[_0x84a7('0x45')][_0x84a7('0x47')]===_0x84a7('0x48')){_0x102754[_0x84a7('0x49')]=[{'model':db[_0x84a7('0x4a')],'as':_0x84a7('0x47')}];}_0x102754=_[_0x84a7('0x58')]({},_0x102754,_0x2c2daa[_0x84a7('0x59')]);if(!_['includes'](_0x102754['attributes'],'id')){_0x102754[_0x84a7('0x4b')]['push']('id');}return db[_0x84a7('0x44')][_0x84a7('0x38')](_0x102754)[_0x84a7('0x2c')](handleEntityNotFound(_0x2531b2,null))['then'](function(_0x1434e4){var _0x52cfcb=[];values=_0x1434e4;if(_0x2c2daa['query'][_0x84a7('0x5a')]===_0x84a7('0x48')){_0x52cfcb[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x4e'),_0x1434e4[_0x84a7('0x50')]));_0x52cfcb[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x4f'),_0x1434e4[_0x84a7('0x50')]));_0x52cfcb['push'](get_open_tabs(_0x84a7('0x53'),_0x1434e4[_0x84a7('0x50')]));_0x52cfcb[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x54'),_0x1434e4[_0x84a7('0x50')]));_0x52cfcb[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x51'),_0x1434e4[_0x84a7('0x50')]));_0x52cfcb[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x52'),_0x1434e4['dataValues']));return Promise[_0x84a7('0x55')](_0x52cfcb);}else{return values;}})[_0x84a7('0x2c')](function(){return values;})['then'](respondWithResult(_0x2531b2,null))[_0x84a7('0x2a')](handleError(_0x2531b2,null));};exports['update']=function(_0x3c1d93,_0x23ce6b){if(_0x3c1d93[_0x84a7('0x5b')]['id']){delete _0x3c1d93[_0x84a7('0x5b')]['id'];}delete _0x3c1d93['body'][_0x84a7('0x2e')];return db[_0x84a7('0x44')]['find']({'where':{'id':_0x3c1d93[_0x84a7('0x5c')]['id']}})[_0x84a7('0x2c')](handleEntityNotFound(_0x23ce6b,null))[_0x84a7('0x2c')](saveUpdates(_0x3c1d93[_0x84a7('0x5b')],null))[_0x84a7('0x2c')](respondWithResult(_0x23ce6b,null))['catch'](handleError(_0x23ce6b,null));};exports[_0x84a7('0x5d')]=function(_0xd33313,_0xa73040){return db['User']['describe']()[_0x84a7('0x2c')](respondWithResult(_0xa73040,null))['catch'](handleError(_0xa73040,null));};exports[_0x84a7('0x5e')]=function(_0x4c68f7,_0xf96961){return db[_0x84a7('0x44')][_0x84a7('0x38')]({'where':{'id':_0x4c68f7[_0x84a7('0x5c')]['id']}})[_0x84a7('0x2c')](handleEntityNotFound(_0xf96961,null))[_0x84a7('0x2c')](function(_0x47eda8){if(_0x47eda8){return _0x47eda8[_0x84a7('0x5e')](_0x4c68f7[_0x84a7('0x5b')][_0x84a7('0x5f')],_[_0x84a7('0x60')](_0x4c68f7['body'],['ids','id'])||{});}})[_0x84a7('0x2c')](respondWithResult(_0xf96961,null))['catch'](handleError(_0xf96961,null));};function validateUser(_0x33bcfa){return new Promise(function(_0x55f667,_0x2f466c){if(_0x33bcfa[_0x84a7('0x61')])return _0x55f667(_0x33bcfa);return db['Setting'][_0x84a7('0x62')](0x1)['then'](function(_0x2880dd){if(_0x2880dd['securePassword'])authService['validatePasswordPattern'](_0x33bcfa[_0x84a7('0x63')]);db[_0x84a7('0x44')][_0x84a7('0x64')](_0x84a7('0x61'))[_0x84a7('0x2c')](function(_0x18171d){if(_['isNil'](_0x18171d)){_0x33bcfa[_0x84a7('0x61')]=_0x2880dd['min_internal']||0x1;return;}if(_[_0x84a7('0x65')](_0x2880dd['min_internal'])||_0x2880dd[_0x84a7('0x66')]===_0x18171d){_0x33bcfa[_0x84a7('0x61')]=_0x18171d+0x1;return;}if(_0x2880dd[_0x84a7('0x66')]>_0x18171d){_0x33bcfa['internal']=_0x2880dd[_0x84a7('0x66')];return;}return db['sequelize'][_0x84a7('0x45')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x84a7('0x67')][_0x84a7('0x68')][_0x84a7('0x69')]})['then'](function(_0x239085){if(_0x239085&&_0x239085['length']){for(var _0x592460=0x0,_0x40dd1f=_0x239085[_0x84a7('0x6a')];_0x592460<_0x40dd1f&&_[_0x84a7('0x65')](_0x33bcfa[_0x84a7('0x61')]);_0x592460++){if(_0x2880dd[_0x84a7('0x66')]<=_0x239085[_0x592460]['from']){_0x33bcfa[_0x84a7('0x61')]=_0x239085[_0x592460][_0x84a7('0x6b')];}else if(_0x2880dd[_0x84a7('0x66')]>_0x239085[_0x592460][_0x84a7('0x6b')]&&_0x2880dd[_0x84a7('0x66')]<=_0x239085[_0x592460]['to']){_0x33bcfa['internal']=_0x2880dd[_0x84a7('0x66')];}}}if(_[_0x84a7('0x65')](_0x33bcfa['internal'])){_0x33bcfa[_0x84a7('0x61')]=_0x18171d+0x1;}return _0x55f667(_0x33bcfa);});});})[_0x84a7('0x2a')](function(_0x3a2630){_0x2f466c(_0x3a2630);});});}function updateUser(_0x4775b2){return new Promise(function(_0x2c1369,_0x4598bd){try{if(_0x4775b2['voicemail']){_0x4775b2[_0x84a7('0x6c')]=_0x4775b2[_0x84a7('0x61')];_0x4775b2[_0x84a7('0x6d')]={'mailbox':_0x4775b2[_0x84a7('0x61')],'password':_0x4775b2['password'],'fullname':_0x4775b2[_0x84a7('0x6e')],'email':_0x4775b2[_0x84a7('0x6f')]};}if(_0x4775b2[_0x84a7('0x2e')]===_0x84a7('0x2d')){if(!_0x4775b2[_0x84a7('0x70')])_0x4775b2[_0x84a7('0x70')]=[_0x84a7('0x71'),_0x84a7('0x72'),_0x84a7('0x73'),'113',_0x84a7('0x74'),'104',_0x84a7('0x75'),_0x84a7('0x76'),_0x84a7('0x77'),_0x84a7('0x78'),_0x84a7('0x79'),_0x84a7('0x7a'),_0x84a7('0x7b'),_0x84a7('0x7c'),_0x84a7('0x7d')];}_0x2c1369(_0x4775b2);}catch(_0x37f139){_0x4598bd(_0x37f139);}});}exports[_0x84a7('0x7e')]=function(_0x3ed4bd,_0x47384d){if(_0x3ed4bd[_0x84a7('0x30')][_0x84a7('0x2e')]===_0x84a7('0x2d'))throw new Error('Unauthorized');if(_0x3ed4bd[_0x84a7('0x5b')][_0x84a7('0x2e')]===_0x84a7('0x30')&&_0x3ed4bd['user'][_0x84a7('0x2e')]!==_0x84a7('0x2f')){throw new Error(_0x84a7('0x7f'));}if(_0x3ed4bd['body'][_0x84a7('0x2e')]===_0x84a7('0x2f')&&_0x3ed4bd['user'][_0x84a7('0x2e')]!==_0x84a7('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x84a7('0x80')]([_0x3ed4bd[_0x84a7('0x5b')]])[_0x84a7('0x2c')](function(){return validateUser(_0x3ed4bd[_0x84a7('0x5b')]);})[_0x84a7('0x2c')](function(_0x5876b4){return updateUser(_0x5876b4)['then'](function(_0x1d1bea){if(_0x1d1bea['role']===_0x84a7('0x2f')){_0x1d1bea[_0x84a7('0x81')]=_0x3ed4bd[_0x84a7('0x30')][_0x84a7('0x81')];delete _0x1d1bea[_0x84a7('0x82')];}return _0x1d1bea;});})['then'](function(_0x3c7558){return db[_0x84a7('0x44')]['create'](_0x3c7558,{'include':[{'model':db[_0x84a7('0x6d')],'as':_0x84a7('0x6d')}]});})['then'](function(_0x4e560a){if(_0x3ed4bd[_0x84a7('0x5b')][_0x84a7('0x2e')]===_0x84a7('0x30'))return _0x4e560a;if(_0x3ed4bd[_0x84a7('0x30')]['role']!==_0x84a7('0x30'))return _0x4e560a;return db['UserProfileSection'][_0x84a7('0x38')]({'where':{'name':_0x4e560a[_0x84a7('0x2e')]==='agent'?_0x84a7('0x31'):_0x84a7('0x32'),'userProfileId':_0x3ed4bd[_0x84a7('0x30')][_0x84a7('0x82')]},'raw':!![]})[_0x84a7('0x2c')](function(_0x302459){if(!_0x302459||_0x302459['autoAssociation']!=0x0)return _0x4e560a;return db['UserProfileResource'][_0x84a7('0x7e')]({'name':_0x4e560a[_0x84a7('0x3a')],'resourceId':_0x4e560a['id'],'type':_0x302459[_0x84a7('0x3a')],'sectionId':_0x302459['id']},{})[_0x84a7('0x2c')](function(){return _0x4e560a;});})[_0x84a7('0x2a')](function(_0x3882f5){logger[_0x84a7('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3882f5);throw _0x3882f5;});})[_0x84a7('0x2c')](respondWithResult(_0x47384d,0xc9))[_0x84a7('0x2a')](handleError(_0x47384d,null));};exports['bulkCreate']=function(_0x534904,_0x5c79e5){var _0x3ec807=_0x534904['body'];var _0x5e6258=[];if(_0x534904[_0x84a7('0x30')]['role']===_0x84a7('0x2d'))throw new Error(_0x84a7('0x83'));if(_[_0x84a7('0x84')](_0x3ec807,[_0x84a7('0x2e'),_0x84a7('0x30')])&&_0x534904['user']['role']!=='admin'){throw new Error(_0x84a7('0x7f'));}if(_[_0x84a7('0x84')](_0x3ec807,[_0x84a7('0x2e'),_0x84a7('0x2f')])&&_0x534904['user']['role']!==_0x84a7('0x2f')){throw new Error(_0x84a7('0x85'));}return licenseUtil['checkUserLimits'](_0x3ec807)[_0x84a7('0x2c')](function(){return validateUser(_0x3ec807[0x0]);})[_0x84a7('0x2c')](function(){for(var _0x5dc758=0x1;_0x5dc758<_0x3ec807['length'];_0x5dc758++){var _0x1f7ede=_0x3ec807[_0x5dc758-0x1][_0x84a7('0x61')];if(!_0x3ec807[_0x5dc758]['internal'])_0x3ec807[_0x5dc758][_0x84a7('0x61')]=_0x1f7ede+0x1;_0x5e6258[_0x84a7('0x4c')](validateUser(_0x3ec807[_0x5dc758]));}return Promise[_0x84a7('0x55')](_0x5e6258);})[_0x84a7('0x2c')](function(){_0x5e6258=[];for(var _0x23b1a9=0x0;_0x23b1a9<_0x3ec807[_0x84a7('0x6a')];_0x23b1a9++){_0x5e6258[_0x84a7('0x4c')](updateUser(_0x3ec807[_0x23b1a9]));}return Promise[_0x84a7('0x55')](_0x5e6258);})['then'](function(){_0x5e6258=_0x3ec807[_0x84a7('0x36')](function(_0x30d11a){return db['User'][_0x84a7('0x7e')](_0x30d11a,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x84a7('0x2c')](function(_0x34494d){_0x30d11a['id']=_0x34494d['id'];return _0x30d11a;});});return Promise[_0x84a7('0x55')](_0x5e6258);})[_0x84a7('0x2c')](function(_0x27ae58){if(_0x534904[_0x84a7('0x5b')][_0x84a7('0x2e')]==='user')return _0x27ae58;if(_0x534904['user'][_0x84a7('0x2e')]!==_0x84a7('0x30'))return _0x27ae58;var _0x445258=_[_0x84a7('0x84')](_0x27ae58,function(_0x5951a7){return _0x5951a7[_0x84a7('0x2e')]===_0x84a7('0x2d')||_0x5951a7[_0x84a7('0x2e')]==='telephone';});if(!_0x445258)return _0x27ae58;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x84a7('0x31'),_0x84a7('0x32')]},'userProfileId':_0x534904[_0x84a7('0x30')][_0x84a7('0x82')]},'raw':!![]})[_0x84a7('0x2c')](function(_0x530ab6){if(_[_0x84a7('0x86')](_0x530ab6)||!_['some'](_0x530ab6,['autoAssociation',0x0]))return _0x27ae58;_0x5e6258=[];var _0x47d086=_(_0x530ab6)['map'](function(_0x2e0116){if(_0x2e0116[_0x84a7('0x87')]===0x1)return;return _0x2e0116[_0x84a7('0x3a')]===_0x84a7('0x31')?'agent':_0x84a7('0x33');})[_0x84a7('0x88')]()[_0x84a7('0x39')]();for(var _0xa538ab=0x0;_0xa538ab<_0x27ae58[_0x84a7('0x6a')];_0xa538ab++){if(!_[_0x84a7('0x37')](_0x47d086,_0x27ae58[_0xa538ab]['role']))return;var _0x58fe84=_0x27ae58[_0xa538ab][_0x84a7('0x2e')]===_0x84a7('0x2d')?_0x84a7('0x31'):'Telephones';_0x5e6258[_0x84a7('0x4c')](db['UserProfileResource'][_0x84a7('0x7e')]({'name':_0x27ae58[_0xa538ab][_0x84a7('0x3a')],'resourceId':_0x27ae58[_0xa538ab]['id'],'type':_0x58fe84,'sectionId':_[_0x84a7('0x38')](_0x530ab6,['name',_0x58fe84])['id']},{}));}return Promise[_0x84a7('0x55')](_0x5e6258);});})[_0x84a7('0x2c')](respondWithResult(_0x5c79e5,0xc9))[_0x84a7('0x2a')](handleError(_0x5c79e5,null));};exports[_0x84a7('0x89')]=function(_0x577f55,_0x1bb2ea){if(_0x577f55['body']['id']){delete _0x577f55[_0x84a7('0x5b')]['id'];}return db['User'][_0x84a7('0x38')]({'where':{'id':_0x577f55[_0x84a7('0x5c')]['id']}})['then'](function(_0x20132c){if(!_0x20132c)return null;if(_0x20132c['id']===_0x577f55[_0x84a7('0x30')]['id']){if(!_0x577f55['body']['oldPassword']||!_0x577f55[_0x84a7('0x5b')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x84a7('0x8a'));}if(!_0x20132c['authenticate'](_0x577f55['body'][_0x84a7('0x8b')])){throw new db[(_0x84a7('0x8c'))][(_0x84a7('0x8d'))](_0x84a7('0x8e'));}if(_0x577f55[_0x84a7('0x5b')][_0x84a7('0x8b')]===_0x577f55[_0x84a7('0x5b')]['newPassword']){throw new db[(_0x84a7('0x8c'))][(_0x84a7('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x577f55[_0x84a7('0x30')][_0x84a7('0x2e')]===_0x84a7('0x2f')){if(!_0x577f55[_0x84a7('0x5b')][_0x84a7('0x8f')]){throw new db[(_0x84a7('0x8c'))][(_0x84a7('0x8d'))](_0x84a7('0x90'));}}else if(_0x577f55[_0x84a7('0x30')][_0x84a7('0x2e')]===_0x84a7('0x30')){if(!_0x577f55[_0x84a7('0x5b')]['newPassword']){throw new db[(_0x84a7('0x8c'))][(_0x84a7('0x8d'))](_0x84a7('0x90'));}if(_0x20132c[_0x84a7('0x2e')]!==_0x84a7('0x2d')){throw new db[(_0x84a7('0x8c'))]['ValidationError'](_0x84a7('0x83'));}}else{throw new db['Sequelize'][(_0x84a7('0x8d'))]('Unauthorized');}return _0x20132c;})[_0x84a7('0x2c')](handleEntityNotFound(_0x1bb2ea,null))[_0x84a7('0x2c')](function(_0x162421){return db[_0x84a7('0x91')]['findOne']({'attributes':['id','securePassword',_0x84a7('0x92'),'passwordHistoryLimit']})[_0x84a7('0x2c')](function(_0x5d9de6){if(_0x5d9de6[_0x84a7('0x93')])authService['validatePasswordPattern'](_0x577f55[_0x84a7('0x5b')]['newPassword']);if(!_0x5d9de6[_0x84a7('0x92')]||!_0x162421[_0x84a7('0x40')])return _0x162421;authService[_0x84a7('0x94')](_0x577f55[_0x84a7('0x5b')][_0x84a7('0x8f')],_0x162421[_0x84a7('0x40')],_0x5d9de6[_0x84a7('0x95')]);return _0x162421;})[_0x84a7('0x2c')](saveUpdates({'password':_0x577f55[_0x84a7('0x5b')][_0x84a7('0x8f')],'passwordResetAt':_0x577f55[_0x84a7('0x30')]['id']==_0x577f55[_0x84a7('0x5c')]['id']?moment():null,'previousPasswords':authService[_0x84a7('0x96')](_0x577f55[_0x84a7('0x5b')][_0x84a7('0x8f')],_0x162421['previousPasswords'])},null));})['then'](respondWithResult(_0x1bb2ea,null))[_0x84a7('0x2a')](handleError(_0x1bb2ea,null));};exports[_0x84a7('0x97')]=function(_0x308133,_0x237f61){var _0x54b377=_0x308133[_0x84a7('0x5b')]['channel'];return db[_0x84a7('0x44')][_0x84a7('0x38')]({'where':{'id':_0x308133[_0x84a7('0x5c')]['id']},'attributes':['id','name',_0x84a7('0x2e'),_0x84a7('0x98'),_0x84a7('0x99'),_0x84a7('0x9a'),'interface']})[_0x84a7('0x2c')](handleEntityNotFound(_0x237f61,null))['then'](function(_0x2dcc92){if(_0x2dcc92){if(!utils['isValidChannel'](_0x54b377)){throw new db[(_0x84a7('0x8c'))][(_0x84a7('0x8d'))](_0x84a7('0x9b'));}return _0x2dcc92[_0x84a7('0x9c')+_[_0x84a7('0x9d')](_0x54b377[_0x84a7('0x9e')]())+_0x84a7('0x9f')](_0x308133[_0x84a7('0x5b')]['ids'],{'penalty':_0x308133[_0x84a7('0x5b')][_0x84a7('0xa0')]||0x0})[_0x84a7('0xa1')](function(_0x2cb4cb){for(var _0x3ce2b5=0x0;_0x3ce2b5<_0x308133[_0x84a7('0x5b')][_0x84a7('0x5f')][_0x84a7('0x6a')];_0x3ce2b5+=0x1){var _0xafa9dc={'UserId':Number(_0x308133[_0x84a7('0x5c')]['id'])};_0xafa9dc[_[_0x84a7('0x9d')](_0x54b377[_0x84a7('0x9e')]())+'QueueId']=Number(_0x308133['body'][_0x84a7('0x5f')][_0x3ce2b5]);socket[_0x84a7('0xa2')](_0x84a7('0x30')+_['capitalize'](_0x54b377['toLowerCase']())+_0x84a7('0xa3'),_0xafa9dc);}return _0x2cb4cb;})[_0x84a7('0x2c')](function(){if(_0x54b377===_0x84a7('0xa4')){return db[_0x84a7('0xa5')][_0x84a7('0xa6')]({'where':{'id':_0x308133[_0x84a7('0x5b')][_0x84a7('0x5f')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x2613d0){var _0x465aec=_0x2dcc92[_0x84a7('0xa7')]({'plain':!![]});var _0x4ae6e4=[];if(_0x54b377==='voice'&&_0x465aec[_0x84a7('0x2e')]===_0x84a7('0x2d')&&_0x465aec[_0x84a7('0x98')]){for(let _0x6891b9=0x0;_0x6891b9<_0x2613d0[_0x84a7('0x6a')];_0x6891b9+=0x1){_0x4ae6e4[_0x84a7('0x4c')]({'membername':_0x465aec[_0x84a7('0x3a')],'UserId':_0x465aec['id'],'queue_name':_0x2613d0[_0x6891b9][_0x84a7('0x3a')],'VoiceQueueId':_0x2613d0[_0x6891b9]['id'],'interface':_[_0x84a7('0x65')](_0x465aec[_0x84a7('0xa8')])?util[_0x84a7('0xa9')](_0x84a7('0xaa'),_0x465aec['name']):_0x465aec[_0x84a7('0xa8')],'paused':_0x465aec['voicePause']||![],'penalty':_0x308133[_0x84a7('0x5b')][_0x84a7('0xa0')]||0x0});}return Promise['all'](_0x4ae6e4['map'](function(_0x5174ce){return db['UserVoiceQueueRt'][_0x84a7('0xab')](_0x5174ce);}));}return _0x2dcc92;});}})[_0x84a7('0x2c')](respondWithStatusCode(_0x237f61,null))[_0x84a7('0x2a')](handleError(_0x237f61,null));};exports['removeQueues']=function(_0x1f5c36,_0x34eac3){var _0x3df7e7,_0x355e84;return db['User'][_0x84a7('0x38')]({'where':{'id':_0x1f5c36['params']['id']},'attributes':['id',_0x84a7('0x3a'),_0x84a7('0x2e')]})[_0x84a7('0x2c')](handleEntityNotFound(_0x34eac3,null))[_0x84a7('0x2c')](function(_0x342e7e){if(_0x342e7e){_0x3df7e7=_0x342e7e;if(!_0x1f5c36[_0x84a7('0x45')][_0x84a7('0xac')]||!utils['isValidChannel'](_0x1f5c36['query'][_0x84a7('0xac')])){throw new db[(_0x84a7('0x8c'))][(_0x84a7('0x8d'))](_0x84a7('0x9b'));}return _0x342e7e['remove'+_[_0x84a7('0x9d')](_0x1f5c36[_0x84a7('0x45')][_0x84a7('0xac')][_0x84a7('0x9e')]())+_0x84a7('0x9f')](_0x1f5c36[_0x84a7('0x45')]['ids']);}})['then'](function(_0x142e03){if(_[_0x84a7('0xad')](_0x1f5c36['query']['ids'])){for(var _0x2099cb=0x0;_0x2099cb<_0x1f5c36[_0x84a7('0x45')][_0x84a7('0x5f')][_0x84a7('0x6a')];_0x2099cb+=0x1){_0x355e84={'UserId':Number(_0x1f5c36[_0x84a7('0x5c')]['id'])};_0x355e84[_[_0x84a7('0x9d')](_0x1f5c36['query']['channel'][_0x84a7('0x9e')]())+_0x84a7('0xae')]=Number(_0x1f5c36[_0x84a7('0x45')][_0x84a7('0x5f')][_0x2099cb]);socket[_0x84a7('0xa2')](_0x84a7('0x30')+_[_0x84a7('0x9d')](_0x1f5c36[_0x84a7('0x45')][_0x84a7('0xac')][_0x84a7('0x9e')]())+'Queue:remove',_0x355e84);}}else{_0x355e84={'UserId':Number(_0x1f5c36[_0x84a7('0x5c')]['id'])};_0x355e84[_[_0x84a7('0x9d')](_0x1f5c36['query']['channel']['toLowerCase']())+'QueueId']=Number(_0x1f5c36['query'][_0x84a7('0x5f')]);socket[_0x84a7('0xa2')](_0x84a7('0x30')+_[_0x84a7('0x9d')](_0x1f5c36['query'][_0x84a7('0xac')][_0x84a7('0x9e')]())+_0x84a7('0xaf'),_0x355e84);}return _0x142e03;})[_0x84a7('0x2c')](function(){if(_0x1f5c36[_0x84a7('0x45')][_0x84a7('0xac')]===_0x84a7('0xa4')){return db[_0x84a7('0xb0')]['destroy']({'where':{'UserId':_0x1f5c36[_0x84a7('0x5c')]['id'],'VoiceQueueId':_0x1f5c36['query']['ids']},'individualHooks':!![]})['then'](function(){return _0x3df7e7;});}return _0x3df7e7;})[_0x84a7('0x2c')](respondWithStatusCode(_0x34eac3,null))['catch'](handleError(_0x34eac3,null));};exports[_0x84a7('0xb1')]=function(_0xb1a1a7,_0x1a7243){_0xb1a1a7[_0x84a7('0x5b')][_0x84a7('0xb2')]=_0xb1a1a7[_0x84a7('0xb3')]['filename'];return db['User'][_0x84a7('0x38')]({'where':{'id':_0xb1a1a7[_0x84a7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1a7243,null))[_0x84a7('0x2c')](saveUpdates(_0xb1a1a7['body'],null))['then'](respondWithResult(_0x1a7243,null))[_0x84a7('0x2a')](handleError(_0x1a7243,null));};exports[_0x84a7('0xb4')]=function(_0x401ea0,_0x5d0a93){var _0x42e600=path['join'](config['root'],_0x84a7('0xb5'));return db[_0x84a7('0x44')][_0x84a7('0x38')]({'where':{'id':_0x401ea0[_0x84a7('0x5c')]['id']},'attributes':['id',_0x84a7('0xb2')],'raw':!![]})[_0x84a7('0x2c')](handleEntityNotFound(_0x5d0a93,null))[_0x84a7('0x2c')](function(_0x304f9f){if(_0x304f9f){if(_[_0x84a7('0x65')](_0x304f9f['userpic'])){return _0x5d0a93[_0x84a7('0xb6')](_0x42e600);}else{if(!fs[_0x84a7('0xb7')](path[_0x84a7('0xb8')](config[_0x84a7('0xb9')],'server/files/images/',_0x304f9f['userpic']))){return _0x5d0a93[_0x84a7('0xb6')](_0x42e600);}return _0x5d0a93['download'](path[_0x84a7('0xb8')](config[_0x84a7('0xb9')],_0x84a7('0xba'),_0x304f9f['userpic']));}}})[_0x84a7('0x2a')](handleError(_0x5d0a93,null));};exports[_0x84a7('0xbb')]=function(_0x44d4f2,_0x235216){return db[_0x84a7('0x44')][_0x84a7('0x38')]({'where':{'id':_0x44d4f2[_0x84a7('0x5c')]['id']},'attributes':['id']})[_0x84a7('0x2c')](handleEntityNotFound(_0x235216,null))[_0x84a7('0x2c')](function(_0x478c2b){var _0x209c87=[];values=_0x478c2b[_0x84a7('0x50')];_0x209c87['push'](get_open_tabs(_0x84a7('0x4e'),_0x478c2b[_0x84a7('0x50')]));_0x209c87['push'](get_open_tabs(_0x84a7('0x4f'),_0x478c2b['dataValues']));_0x209c87[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x53'),_0x478c2b[_0x84a7('0x50')]));_0x209c87[_0x84a7('0x4c')](get_open_tabs(_0x84a7('0x54'),_0x478c2b['dataValues']));_0x209c87[_0x84a7('0x4c')](get_open_tabs('fax',_0x478c2b[_0x84a7('0x50')]));_0x209c87[_0x84a7('0x4c')](get_open_tabs('mail',_0x478c2b[_0x84a7('0x50')]));return Promise['all'](_0x209c87);})[_0x84a7('0x2c')](function(_0x502084){if(_0x502084){var _0x2de6c0=_[_0x84a7('0x36')](values['ChatOpenTabs'],function(_0x597542){return{'channel':_0x84a7('0xbc'),'id':_0x597542['id'],'createdAt':_0x597542['createdAt']};});var _0xedd3cb=_[_0x84a7('0x36')](values['FaxOpenTabs'],function(_0x30e0cc){return{'channel':'FAX','id':_0x30e0cc['id'],'createdAt':_0x30e0cc[_0x84a7('0xbd')]};});var _0x50f1f6=_['map'](values[_0x84a7('0xbe')],function(_0x14dec5){return{'channel':_0x84a7('0xbf'),'id':_0x14dec5['id'],'createdAt':_0x14dec5[_0x84a7('0xbd')]};});var _0x35aa87=_['map'](values[_0x84a7('0xc0')],function(_0x286bca){return{'channel':_0x84a7('0xc1'),'id':_0x286bca['id'],'createdAt':_0x286bca['createdAt']};});var _0x4d7c14=_[_0x84a7('0x36')](values[_0x84a7('0xc2')],function(_0x578cda){return{'channel':_0x84a7('0xc3'),'id':_0x578cda['id'],'createdAt':_0x578cda['createdAt']};});var _0xf49a88=_[_0x84a7('0x36')](values[_0x84a7('0xc4')],function(_0x28ef37){return{'channel':_0x84a7('0xc5'),'id':_0x28ef37['id'],'createdAt':_0x28ef37[_0x84a7('0xbd')]};});var _0x3fa437=_['concat'](_0x2de6c0,_0xedd3cb,_0x50f1f6,_0x35aa87,_0x4d7c14,_0xf49a88);var _0x1cfbdd={'count':_0x3fa437['length'],'rows':_0x3fa437};return _0x1cfbdd;}else return null;})[_0x84a7('0x2c')](respondWithResult(_0x235216,null))[_0x84a7('0x2a')](handleError(_0x235216,null));};exports['getContacts']=function(_0x1b3e15,_0x41c7e4){var _0x514c4a={};return db[_0x84a7('0x44')]['findOne']({'where':{'id':_0x1b3e15[_0x84a7('0x5c')]['id']}})[_0x84a7('0x2c')](function(_0x3a0762){if(!_0x3a0762){throw new APINotFoundError(util['format'](_0x84a7('0xc6'),_0x1b3e15[_0x84a7('0x5c')]['id']));}return contacts[_0x84a7('0x5d')]();})[_0x84a7('0x2c')](function(_0x53f5fb){_0x1b3e15[_0x84a7('0x45')][_0x84a7('0x44')]=_0x1b3e15[_0x84a7('0x5c')]['id'];_0x514c4a=qs[_0x84a7('0x57')](_0x53f5fb,_0x1b3e15);if(_0x1b3e15[_0x84a7('0x45')][_0x84a7('0xc7')](_0x84a7('0x46'))){_0x514c4a[_0x84a7('0x49')]=[{'model':db[_0x84a7('0xc8')],'as':'List','required':![]},{'model':db[_0x84a7('0xc9')],'as':'Tags','attributes':['id',_0x84a7('0x3a'),'color'],'where':_0x1b3e15[_0x84a7('0x45')][_0x84a7('0xca')]?{'id':_0x1b3e15[_0x84a7('0x45')]['tag']}:undefined,'required':_0x1b3e15[_0x84a7('0x45')]['tag']?!![]:![]}];}return contacts[_0x84a7('0xa6')](_0x1b3e15['query'],_0x1b3e15[_0x84a7('0x30')],_0x514c4a,_0x53f5fb);})[_0x84a7('0x2c')](respondWithFilteredResult(_0x41c7e4,_0x514c4a))[_0x84a7('0x2a')](APIHandleError(_0x41c7e4));};exports[_0x84a7('0xcb')]=function(_0x4050fc,_0x27bc18){var _0x5947dc;var _0x53d53e={};var _0x4265ea;return db['User'][_0x84a7('0xcc')]({'where':{'id':_0x4050fc['params']['id']},'attributes':['id','name','role']})[_0x84a7('0x2c')](handleEntityNotFound(_0x27bc18,null))[_0x84a7('0x2c')](function(_0x73e13a){if(!utils[_0x84a7('0xcd')](_0x4050fc['query']['channel'])){throw new db[(_0x84a7('0x8c'))]['ValidationError'](_0x84a7('0x9b'));}_0x5947dc=_0x73e13a;var _0x39d219={};_0x39d219[_0x84a7('0xce')]=_[_0x84a7('0xcf')](db[_['capitalize'](_0x4050fc[_0x84a7('0x45')][_0x84a7('0xac')])+_0x84a7('0xd0')][_0x84a7('0xd1')]);_0x39d219[_0x84a7('0x45')]=_[_0x84a7('0xcf')](_0x4050fc[_0x84a7('0x45')]);_0x39d219['filters']=_['intersection'](_0x39d219[_0x84a7('0xce')],_0x39d219[_0x84a7('0x45')]);_0x53d53e[_0x84a7('0x4b')]=_[_0x84a7('0xd2')](_0x39d219[_0x84a7('0xce')],qs[_0x84a7('0xd3')](_0x4050fc[_0x84a7('0x45')][_0x84a7('0xd3')]));_0x53d53e[_0x84a7('0x4b')]=_0x53d53e['attributes']['length']?_0x53d53e[_0x84a7('0x4b')]:_0x39d219[_0x84a7('0xce')];_0x53d53e['order']=qs[_0x84a7('0xd4')](_0x4050fc[_0x84a7('0x45')][_0x84a7('0xd4')]);_0x53d53e[_0x84a7('0x43')]=qs[_0x84a7('0xd5')](_[_0x84a7('0xd6')](_0x4050fc[_0x84a7('0x45')],_0x39d219['filters']));if(_0x4050fc['query']['filter']){_0x53d53e[_0x84a7('0x43')]=_[_0x84a7('0x58')](_0x53d53e[_0x84a7('0x43')],{'$or':_[_0x84a7('0x36')](_0x53d53e[_0x84a7('0x4b')],function(_0x4355c0){var _0x16fae9={};_0x16fae9[_0x4355c0]={'$like':'%'+_0x4050fc[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0x16fae9;})});}_0x53d53e=_[_0x84a7('0x58')]({},_0x53d53e,_0x4050fc['options']);switch(_0x5947dc['role']){case'admin':return db[_[_0x84a7('0x9d')](_0x4050fc[_0x84a7('0x45')][_0x84a7('0xac')])+'Queue'][_0x84a7('0xa6')](_0x53d53e);case _0x84a7('0x30'):case'agent':return _0x5947dc[_0x84a7('0xa7')+_[_0x84a7('0x9d')](_0x4050fc[_0x84a7('0x45')][_0x84a7('0xac')])+_0x84a7('0x9f')](_0x53d53e);default:throw new db[(_0x84a7('0x8c'))][(_0x84a7('0x8d'))](_0x84a7('0xd7'));}})[_0x84a7('0x2c')](function(_0x8127ac){_0x4265ea=_0x8127ac['length'];if(!_0x4050fc['query']['hasOwnProperty'](_0x84a7('0xd8'))){_0x53d53e[_0x84a7('0x1c')]=qs[_0x84a7('0x1c')](_0x4050fc['query'][_0x84a7('0x1c')]);_0x53d53e[_0x84a7('0x1b')]=qs[_0x84a7('0x1b')](_0x4050fc['query'][_0x84a7('0x1b')]);}switch(_0x5947dc[_0x84a7('0x2e')]){case _0x84a7('0x2f'):return db[_[_0x84a7('0x9d')](_0x4050fc['query']['channel'])+_0x84a7('0xd0')][_0x84a7('0xa6')](_0x53d53e);case'user':case _0x84a7('0x2d'):return _0x5947dc[_0x84a7('0xa7')+_[_0x84a7('0x9d')](_0x4050fc['query']['channel'])+_0x84a7('0x9f')](_0x53d53e);}})[_0x84a7('0x2c')](function(_0x560dac){return{'count':_0x4265ea,'rows':_0x560dac};})['then'](respondWithResult(_0x27bc18,null))['catch'](handleError(_0x27bc18,null));};exports[_0x84a7('0xd9')]=function(_0x34e64f,_0x3d8699){var _0x3a9799={};var _0x58af1b={};var _0x534b5d;var _0x499c0e;return db['User'][_0x84a7('0xcc')]({'where':{'id':_0x34e64f[_0x84a7('0x5c')]['id']}})[_0x84a7('0x2c')](handleEntityNotFound(_0x3d8699,null))[_0x84a7('0x2c')](function(_0x1a0cf1){if(_0x1a0cf1){_0x534b5d=_0x1a0cf1;_0x58af1b[_0x84a7('0xce')]=_[_0x84a7('0xcf')](db[_0x84a7('0xb0')][_0x84a7('0xd1')]);_0x58af1b[_0x84a7('0x45')]=_[_0x84a7('0xcf')](_0x34e64f[_0x84a7('0x45')]);_0x58af1b[_0x84a7('0xd5')]=_[_0x84a7('0xd2')](_0x58af1b[_0x84a7('0xce')],_0x58af1b[_0x84a7('0x45')]);_0x3a9799['attributes']=_[_0x84a7('0xd2')](_0x58af1b[_0x84a7('0xce')],qs['fields'](_0x34e64f['query'][_0x84a7('0xd3')]));_0x3a9799[_0x84a7('0x4b')]=_0x3a9799[_0x84a7('0x4b')][_0x84a7('0x6a')]?_0x3a9799[_0x84a7('0x4b')]:_0x58af1b[_0x84a7('0xce')];_0x3a9799[_0x84a7('0xda')]=qs['sort'](_0x34e64f['query'][_0x84a7('0xd4')]);_0x3a9799[_0x84a7('0x43')]=qs[_0x84a7('0xd5')](_[_0x84a7('0xd6')](_0x34e64f['query'],_0x58af1b[_0x84a7('0xd5')]));if(_0x34e64f['query']['filter']){_0x3a9799[_0x84a7('0x43')]=_[_0x84a7('0x58')](_0x3a9799[_0x84a7('0x43')],{'$or':_[_0x84a7('0x36')](_0x3a9799['attributes'],function(_0x5ee47b){var _0x35187a={};_0x35187a[_0x5ee47b]={'$like':'%'+_0x34e64f[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0x35187a;})});}_0x3a9799=_[_0x84a7('0x58')]({},_0x3a9799,_0x34e64f[_0x84a7('0x59')]);return _0x534b5d['getVoiceQueuesRt'](_0x3a9799);}})[_0x84a7('0x2c')](function(_0x1554e7){if(_0x1554e7){_0x499c0e=_0x1554e7[_0x84a7('0x6a')];if(!_0x34e64f['query'][_0x84a7('0xc7')]('nolimit')){_0x3a9799[_0x84a7('0x1c')]=qs['limit'](_0x34e64f[_0x84a7('0x45')][_0x84a7('0x1c')]);_0x3a9799[_0x84a7('0x1b')]=qs[_0x84a7('0x1b')](_0x34e64f[_0x84a7('0x45')][_0x84a7('0x1b')]);}return _0x534b5d[_0x84a7('0xd9')](_0x3a9799);}})[_0x84a7('0x2c')](function(_0x16f9d6){if(_0x16f9d6){return _0x16f9d6?{'count':_0x499c0e,'rows':_0x16f9d6}:null;}})[_0x84a7('0x2c')](respondWithResult(_0x3d8699,null))[_0x84a7('0x2a')](handleError(_0x3d8699,null));};exports['getGroups']=function(_0x3bd1a4,_0x2b36cf){var _0x115765={};var _0x1fde64={};var _0x2cf437;var _0x49e058;return db['User'][_0x84a7('0xcc')]({'where':{'id':_0x3bd1a4[_0x84a7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2b36cf,null))[_0x84a7('0x2c')](function(_0x40ae98){if(_0x40ae98){_0x2cf437=_0x40ae98;_0x1fde64[_0x84a7('0xce')]=_[_0x84a7('0xcf')](db[_0x84a7('0xdb')][_0x84a7('0xd1')]);_0x1fde64[_0x84a7('0x45')]=_[_0x84a7('0xcf')](_0x3bd1a4['query']);_0x1fde64['filters']=_[_0x84a7('0xd2')](_0x1fde64[_0x84a7('0xce')],_0x1fde64[_0x84a7('0x45')]);_0x115765[_0x84a7('0x4b')]=_[_0x84a7('0xd2')](_0x1fde64[_0x84a7('0xce')],qs[_0x84a7('0xd3')](_0x3bd1a4[_0x84a7('0x45')][_0x84a7('0xd3')]));_0x115765[_0x84a7('0x4b')]=_0x115765[_0x84a7('0x4b')][_0x84a7('0x6a')]?_0x115765[_0x84a7('0x4b')]:_0x1fde64['model'];_0x115765[_0x84a7('0xda')]=qs[_0x84a7('0xd4')](_0x3bd1a4[_0x84a7('0x45')]['sort']);_0x115765[_0x84a7('0x43')]=qs['filters'](_['pick'](_0x3bd1a4[_0x84a7('0x45')],_0x1fde64['filters']));if(_0x3bd1a4[_0x84a7('0x45')]['filter']){_0x115765[_0x84a7('0x43')]=_[_0x84a7('0x58')](_0x115765[_0x84a7('0x43')],{'$or':_[_0x84a7('0x36')](_0x115765['attributes'],function(_0x39f388){var _0x3b62c8={};_0x3b62c8[_0x39f388]={'$like':'%'+_0x3bd1a4[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0x3b62c8;})});}_0x115765=_[_0x84a7('0x58')]({},_0x115765,_0x3bd1a4[_0x84a7('0x59')]);return _0x2cf437['getGroups'](_0x115765);}})[_0x84a7('0x2c')](function(_0x3b089d){if(_0x3b089d){_0x49e058=_0x3b089d[_0x84a7('0x6a')];if(!_0x3bd1a4[_0x84a7('0x45')][_0x84a7('0xc7')](_0x84a7('0xd8'))){_0x115765[_0x84a7('0x1c')]=qs[_0x84a7('0x1c')](_0x3bd1a4[_0x84a7('0x45')][_0x84a7('0x1c')]);_0x115765['offset']=qs['offset'](_0x3bd1a4[_0x84a7('0x45')][_0x84a7('0x1b')]);}return _0x2cf437['getGroups'](_0x115765);}})[_0x84a7('0x2c')](function(_0x3c4182){if(_0x3c4182){return _0x3c4182?{'count':_0x49e058,'rows':_0x3c4182}:null;}})[_0x84a7('0x2c')](respondWithResult(_0x2b36cf,null))['catch'](handleError(_0x2b36cf,null));};exports[_0x84a7('0xdc')]=function(_0x33ef18,_0x389c3f){var _0x32c7ca={'raw':!![],'where':{}};var _0x346880={};var _0x3a5f6c={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x33ef18[_0x84a7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x389c3f,null))['then'](function(_0x52293a){if(_0x52293a){_0x346880[_0x84a7('0xce')]=_[_0x84a7('0xcf')](db[_0x84a7('0xdd')][_0x84a7('0xd1')]);_0x346880[_0x84a7('0x45')]=_[_0x84a7('0xcf')](_0x33ef18[_0x84a7('0x45')]);_0x346880['filters']=_[_0x84a7('0xd2')](_0x346880[_0x84a7('0xce')],_0x346880[_0x84a7('0x45')]);_0x32c7ca['attributes']=_[_0x84a7('0xd2')](_0x346880['model'],qs[_0x84a7('0xd3')](_0x33ef18[_0x84a7('0x45')]['fields']));_0x32c7ca['attributes']=_0x32c7ca['attributes'][_0x84a7('0x6a')]?_0x32c7ca['attributes']:_0x346880[_0x84a7('0xce')];if(!_0x33ef18['query'][_0x84a7('0xc7')](_0x84a7('0xd8'))){_0x32c7ca[_0x84a7('0x1c')]=qs[_0x84a7('0x1c')](_0x33ef18['query'][_0x84a7('0x1c')]);_0x32c7ca['offset']=qs[_0x84a7('0x1b')](_0x33ef18[_0x84a7('0x45')][_0x84a7('0x1b')]);}_0x32c7ca[_0x84a7('0xda')]=qs['sort'](_0x33ef18[_0x84a7('0x45')][_0x84a7('0xd4')]);_0x32c7ca['where']=qs[_0x84a7('0xd5')](_[_0x84a7('0xd6')](_0x33ef18[_0x84a7('0x45')],_0x346880['filters']));_0x32c7ca[_0x84a7('0x43')][_0x84a7('0xde')]=_0x52293a['id'];if(_0x33ef18[_0x84a7('0x45')]['filter']){_0x32c7ca[_0x84a7('0x43')]=_['merge'](_0x32c7ca[_0x84a7('0x43')],{'$or':_['map'](_0x32c7ca[_0x84a7('0x4b')],function(_0x514eaf){var _0x250084={};_0x250084[_0x514eaf]={'$like':'%'+_0x33ef18['query']['filter']+'%'};return _0x250084;})});}_0x32c7ca=_[_0x84a7('0x58')]({},_0x32c7ca,_0x33ef18['options']);return db[_0x84a7('0xdd')][_0x84a7('0x1e')]({'where':_0x32c7ca[_0x84a7('0x43')]})['then'](function(_0x118556){_0x3a5f6c[_0x84a7('0x1e')]=_0x118556;if(_0x33ef18[_0x84a7('0x45')][_0x84a7('0x46')]){_0x32c7ca[_0x84a7('0x49')]=[{'all':!![]}];}return db['VoiceRecording'][_0x84a7('0xa6')](_0x32c7ca);})[_0x84a7('0x2c')](function(_0x2a63fb){_0x3a5f6c[_0x84a7('0x4d')]=_0x2a63fb;return _0x3a5f6c;});}})[_0x84a7('0x2c')](respondWithFilteredResult(_0x389c3f,_0x32c7ca))[_0x84a7('0x2a')](handleError(_0x389c3f,null));};exports[_0x84a7('0xdf')]=function(_0x5bdda3,_0x3b3506){var _0x21c8f1={'raw':!![],'where':{}};var _0x11aa8e={};var _0x507302={'count':0x0,'rows':[]};return db[_0x84a7('0x44')]['findOne']({'where':{'id':_0x5bdda3[_0x84a7('0x5c')]['id']}})[_0x84a7('0x2c')](handleEntityNotFound(_0x3b3506,null))[_0x84a7('0x2c')](function(_0x2d5844){if(_0x2d5844){_0x11aa8e['model']=_['keys'](db['ScreenRecording'][_0x84a7('0xd1')]);_0x11aa8e[_0x84a7('0x45')]=_['keys'](_0x5bdda3[_0x84a7('0x45')]);_0x11aa8e[_0x84a7('0xd5')]=_[_0x84a7('0xd2')](_0x11aa8e['model'],_0x11aa8e[_0x84a7('0x45')]);_0x21c8f1[_0x84a7('0x4b')]=_[_0x84a7('0xd2')](_0x11aa8e[_0x84a7('0xce')],qs[_0x84a7('0xd3')](_0x5bdda3[_0x84a7('0x45')][_0x84a7('0xd3')]));_0x21c8f1['attributes']=_0x21c8f1[_0x84a7('0x4b')][_0x84a7('0x6a')]?_0x21c8f1[_0x84a7('0x4b')]:_0x11aa8e['model'];if(!_0x5bdda3[_0x84a7('0x45')]['hasOwnProperty']('nolimit')){_0x21c8f1['limit']=qs[_0x84a7('0x1c')](_0x5bdda3['query'][_0x84a7('0x1c')]);_0x21c8f1['offset']=qs[_0x84a7('0x1b')](_0x5bdda3[_0x84a7('0x45')][_0x84a7('0x1b')]);}_0x21c8f1['order']=qs[_0x84a7('0xd4')](_0x5bdda3[_0x84a7('0x45')][_0x84a7('0xd4')]);_0x21c8f1[_0x84a7('0x43')]=qs[_0x84a7('0xd5')](_[_0x84a7('0xd6')](_0x5bdda3['query'],_0x11aa8e[_0x84a7('0xd5')]));_0x21c8f1[_0x84a7('0x43')][_0x84a7('0xde')]=_0x2d5844['id'];if(_0x5bdda3['query']['filter']){_0x21c8f1[_0x84a7('0x43')]=_[_0x84a7('0x58')](_0x21c8f1[_0x84a7('0x43')],{'$or':_[_0x84a7('0x36')](_0x21c8f1[_0x84a7('0x4b')],function(_0xa4cc29){var _0x30c4ac={};_0x30c4ac[_0xa4cc29]={'$like':'%'+_0x5bdda3[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0x30c4ac;})});}_0x21c8f1=_[_0x84a7('0x58')]({},_0x21c8f1,_0x5bdda3[_0x84a7('0x59')]);return db[_0x84a7('0xe0')][_0x84a7('0x1e')]({'where':_0x21c8f1['where']})['then'](function(_0xcf4d04){_0x507302[_0x84a7('0x1e')]=_0xcf4d04;if(_0x5bdda3[_0x84a7('0x45')][_0x84a7('0x46')]){_0x21c8f1['include']=[{'all':!![]}];}return db[_0x84a7('0xe0')]['findAll'](_0x21c8f1);})[_0x84a7('0x2c')](function(_0x2402fa){_0x507302[_0x84a7('0x4d')]=_0x2402fa;return _0x507302;});}})[_0x84a7('0x2c')](respondWithFilteredResult(_0x3b3506,_0x21c8f1))[_0x84a7('0x2a')](handleError(_0x3b3506,null));};exports[_0x84a7('0xe1')]=function(_0x3ccd03,_0x16e3d6){var _0x3d70d4={};var _0x4879f5={};var _0x5d9f00;var _0x1f9365;return db[_0x84a7('0x44')]['findOne']({'where':{'id':_0x3ccd03[_0x84a7('0x5c')]['id']}})[_0x84a7('0x2c')](handleEntityNotFound(_0x16e3d6,null))[_0x84a7('0x2c')](function(_0x2d2d86){if(_0x2d2d86){_0x5d9f00=_0x2d2d86;_0x4879f5[_0x84a7('0xce')]=_['keys'](db[_0x84a7('0xe2')]['rawAttributes']);_0x4879f5[_0x84a7('0x45')]=_['keys'](_0x3ccd03[_0x84a7('0x45')]);_0x4879f5[_0x84a7('0xd5')]=_['intersection'](_0x4879f5[_0x84a7('0xce')],_0x4879f5[_0x84a7('0x45')]);_0x3d70d4[_0x84a7('0x4b')]=_['intersection'](_0x4879f5[_0x84a7('0xce')],qs[_0x84a7('0xd3')](_0x3ccd03['query'][_0x84a7('0xd3')]));_0x3d70d4[_0x84a7('0x4b')]=_0x3d70d4['attributes'][_0x84a7('0x6a')]?_0x3d70d4['attributes']:_0x4879f5['model'];_0x3d70d4[_0x84a7('0xda')]=qs['sort'](_0x3ccd03[_0x84a7('0x45')][_0x84a7('0xd4')]);_0x3d70d4[_0x84a7('0x43')]=qs[_0x84a7('0xd5')](_[_0x84a7('0xd6')](_0x3ccd03['query'],_0x4879f5[_0x84a7('0xd5')]));if(_0x3ccd03[_0x84a7('0x45')][_0x84a7('0x34')]){_0x3d70d4[_0x84a7('0x43')]=_[_0x84a7('0x58')](_0x3d70d4['where'],{'$or':_[_0x84a7('0x36')](_0x3d70d4[_0x84a7('0x4b')],function(_0x1f85ae){var _0x2c6c18={};_0x2c6c18[_0x1f85ae]={'$like':'%'+_0x3ccd03[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0x2c6c18;})});}_0x3d70d4=_[_0x84a7('0x58')]({},_0x3d70d4,_0x3ccd03[_0x84a7('0x59')]);return _0x5d9f00[_0x84a7('0xe1')](_0x3d70d4);}})['then'](function(_0x5ae543){if(_0x5ae543){_0x1f9365=_0x5ae543[_0x84a7('0x6a')];if(!_0x3ccd03[_0x84a7('0x45')][_0x84a7('0xc7')]('nolimit')){_0x3d70d4[_0x84a7('0x1c')]=qs[_0x84a7('0x1c')](_0x3ccd03[_0x84a7('0x45')][_0x84a7('0x1c')]);_0x3d70d4['offset']=qs[_0x84a7('0x1b')](_0x3ccd03['query'][_0x84a7('0x1b')]);}return _0x5d9f00[_0x84a7('0xe1')](_0x3d70d4);}})['then'](function(_0x2d5671){if(_0x2d5671){return _0x2d5671?{'count':_0x1f9365,'rows':_0x2d5671}:null;}})[_0x84a7('0x2c')](respondWithResult(_0x16e3d6,null))[_0x84a7('0x2a')](handleError(_0x16e3d6,null));};exports['getOpenchannelInteractions']=function(_0x473409,_0x4541c7){var _0x109469={};var _0x4f7fa3={};var _0x10d02b;var _0x13a99c;return db['User']['findOne']({'where':{'id':_0x473409[_0x84a7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4541c7,null))['then'](function(_0x1aa06a){if(_0x1aa06a){_0x10d02b=_0x1aa06a;_0x4f7fa3[_0x84a7('0xce')]=_[_0x84a7('0xcf')](db['OpenchannelInteraction']['rawAttributes']);_0x4f7fa3['query']=_[_0x84a7('0xcf')](_0x473409['query']);_0x4f7fa3[_0x84a7('0xd5')]=_[_0x84a7('0xd2')](_0x4f7fa3[_0x84a7('0xce')],_0x4f7fa3[_0x84a7('0x45')]);_0x109469[_0x84a7('0x4b')]=_[_0x84a7('0xd2')](_0x4f7fa3[_0x84a7('0xce')],qs[_0x84a7('0xd3')](_0x473409[_0x84a7('0x45')][_0x84a7('0xd3')]));_0x109469['attributes']=_0x109469[_0x84a7('0x4b')][_0x84a7('0x6a')]?_0x109469[_0x84a7('0x4b')]:_0x4f7fa3['model'];_0x109469[_0x84a7('0xda')]=qs[_0x84a7('0xd4')](_0x473409[_0x84a7('0x45')][_0x84a7('0xd4')]);_0x109469[_0x84a7('0x43')]=qs[_0x84a7('0xd5')](_[_0x84a7('0xd6')](_0x473409[_0x84a7('0x45')],_0x4f7fa3[_0x84a7('0xd5')]));if(_0x473409['query'][_0x84a7('0x34')]){_0x109469['where']=_[_0x84a7('0x58')](_0x109469[_0x84a7('0x43')],{'$or':_[_0x84a7('0x36')](_0x109469[_0x84a7('0x4b')],function(_0x5c80c5){var _0x1adbc1={};_0x1adbc1[_0x5c80c5]={'$like':'%'+_0x473409[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0x1adbc1;})});}_0x109469=_[_0x84a7('0x58')]({},_0x109469,_0x473409[_0x84a7('0x59')]);return _0x10d02b[_0x84a7('0xe3')](_0x109469);}})[_0x84a7('0x2c')](function(_0x402a94){if(_0x402a94){_0x13a99c=_0x402a94[_0x84a7('0x6a')];if(!_0x473409[_0x84a7('0x45')][_0x84a7('0xc7')](_0x84a7('0xd8'))){_0x109469[_0x84a7('0x1c')]=qs[_0x84a7('0x1c')](_0x473409['query'][_0x84a7('0x1c')]);_0x109469[_0x84a7('0x1b')]=qs[_0x84a7('0x1b')](_0x473409[_0x84a7('0x45')][_0x84a7('0x1b')]);}return _0x10d02b['getOpenchannelInteractions'](_0x109469);}})[_0x84a7('0x2c')](function(_0x5bea04){if(_0x5bea04){return _0x5bea04?{'count':_0x13a99c,'rows':_0x5bea04}:null;}})['then'](respondWithResult(_0x4541c7,null))[_0x84a7('0x2a')](handleError(_0x4541c7,null));};exports[_0x84a7('0xe4')]=function(_0x19f5af,_0x3da400){var _0x239a73={'raw':!![],'where':{}};var _0x142905={};var _0x35997e={'count':0x0,'rows':[]};return db[_0x84a7('0x44')][_0x84a7('0xcc')]({'where':{'id':_0x19f5af[_0x84a7('0x5c')]['id']}})[_0x84a7('0x2c')](handleEntityNotFound(_0x3da400,null))[_0x84a7('0x2c')](function(_0x39f733){if(_0x39f733){_0x142905[_0x84a7('0xce')]=_['keys'](db[_0x84a7('0xe5')][_0x84a7('0xd1')]);_0x142905[_0x84a7('0x45')]=_[_0x84a7('0xcf')](_0x19f5af[_0x84a7('0x45')]);_0x142905[_0x84a7('0xd5')]=_[_0x84a7('0xd2')](_0x142905['model'],_0x142905[_0x84a7('0x45')]);_0x239a73[_0x84a7('0x4b')]=_[_0x84a7('0xd2')](_0x142905[_0x84a7('0xce')],qs[_0x84a7('0xd3')](_0x19f5af[_0x84a7('0x45')]['fields']));_0x239a73[_0x84a7('0x4b')]=_0x239a73['attributes'][_0x84a7('0x6a')]?_0x239a73['attributes']:_0x142905[_0x84a7('0xce')];if(!_0x19f5af[_0x84a7('0x45')][_0x84a7('0xc7')]('nolimit')){_0x239a73[_0x84a7('0x1c')]=qs['limit'](_0x19f5af[_0x84a7('0x45')][_0x84a7('0x1c')]);_0x239a73[_0x84a7('0x1b')]=qs[_0x84a7('0x1b')](_0x19f5af[_0x84a7('0x45')][_0x84a7('0x1b')]);}_0x239a73[_0x84a7('0xda')]=qs[_0x84a7('0xd4')](_0x19f5af[_0x84a7('0x45')][_0x84a7('0xd4')]);_0x239a73[_0x84a7('0x43')]=qs[_0x84a7('0xd5')](_['pick'](_0x19f5af[_0x84a7('0x45')],_0x142905['filters']));_0x239a73[_0x84a7('0x43')][_0x84a7('0xde')]=_0x39f733['id'];if(_0x19f5af['query'][_0x84a7('0x34')]){_0x239a73[_0x84a7('0x43')]=_['merge'](_0x239a73[_0x84a7('0x43')],{'$or':_[_0x84a7('0x36')](_0x239a73[_0x84a7('0x4b')],function(_0x1e1b92){var _0x2008e9={};_0x2008e9[_0x1e1b92]={'$like':'%'+_0x19f5af[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0x2008e9;})});}_0x239a73=_[_0x84a7('0x58')]({},_0x239a73,_0x19f5af[_0x84a7('0x59')]);return db['MailInteraction']['count']({'where':_0x239a73[_0x84a7('0x43')]})[_0x84a7('0x2c')](function(_0x40c9c6){_0x35997e['count']=_0x40c9c6;if(_0x19f5af[_0x84a7('0x45')][_0x84a7('0x46')]){_0x239a73[_0x84a7('0x49')]=[{'all':!![]}];}return db[_0x84a7('0xe5')]['findAll'](_0x239a73);})[_0x84a7('0x2c')](function(_0x131757){_0x35997e['rows']=_0x131757;return _0x35997e;});}})[_0x84a7('0x2c')](respondWithFilteredResult(_0x3da400,_0x239a73))[_0x84a7('0x2a')](handleError(_0x3da400,null));};exports['getSmsInteractions']=function(_0x4eeecb,_0x51efe5){var _0x552be3={};var _0x14fe47={};var _0x430721;var _0x5ccd7b;return db[_0x84a7('0x44')][_0x84a7('0xcc')]({'where':{'id':_0x4eeecb[_0x84a7('0x5c')]['id']}})[_0x84a7('0x2c')](handleEntityNotFound(_0x51efe5,null))[_0x84a7('0x2c')](function(_0xb406e0){if(_0xb406e0){_0x430721=_0xb406e0;_0x14fe47['model']=_[_0x84a7('0xcf')](db[_0x84a7('0xe6')][_0x84a7('0xd1')]);_0x14fe47[_0x84a7('0x45')]=_[_0x84a7('0xcf')](_0x4eeecb['query']);_0x14fe47[_0x84a7('0xd5')]=_[_0x84a7('0xd2')](_0x14fe47[_0x84a7('0xce')],_0x14fe47['query']);_0x552be3[_0x84a7('0x4b')]=_['intersection'](_0x14fe47[_0x84a7('0xce')],qs[_0x84a7('0xd3')](_0x4eeecb[_0x84a7('0x45')][_0x84a7('0xd3')]));_0x552be3[_0x84a7('0x4b')]=_0x552be3['attributes']['length']?_0x552be3[_0x84a7('0x4b')]:_0x14fe47[_0x84a7('0xce')];_0x552be3[_0x84a7('0xda')]=qs['sort'](_0x4eeecb[_0x84a7('0x45')][_0x84a7('0xd4')]);_0x552be3[_0x84a7('0x43')]=qs[_0x84a7('0xd5')](_['pick'](_0x4eeecb[_0x84a7('0x45')],_0x14fe47['filters']));if(_0x4eeecb[_0x84a7('0x45')][_0x84a7('0x34')]){_0x552be3[_0x84a7('0x43')]=_[_0x84a7('0x58')](_0x552be3[_0x84a7('0x43')],{'$or':_[_0x84a7('0x36')](_0x552be3[_0x84a7('0x4b')],function(_0x571e8e){var _0xeddb07={};_0xeddb07[_0x571e8e]={'$like':'%'+_0x4eeecb[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0xeddb07;})});}_0x552be3=_[_0x84a7('0x58')]({},_0x552be3,_0x4eeecb[_0x84a7('0x59')]);return _0x430721[_0x84a7('0xe7')](_0x552be3);}})[_0x84a7('0x2c')](function(_0x22bcb8){if(_0x22bcb8){_0x5ccd7b=_0x22bcb8[_0x84a7('0x6a')];if(!_0x4eeecb['query']['hasOwnProperty'](_0x84a7('0xd8'))){_0x552be3[_0x84a7('0x1c')]=qs[_0x84a7('0x1c')](_0x4eeecb['query']['limit']);_0x552be3['offset']=qs[_0x84a7('0x1b')](_0x4eeecb[_0x84a7('0x45')][_0x84a7('0x1b')]);}return _0x430721[_0x84a7('0xe7')](_0x552be3);}})[_0x84a7('0x2c')](function(_0x1f5a25){if(_0x1f5a25){return _0x1f5a25?{'count':_0x5ccd7b,'rows':_0x1f5a25}:null;}})[_0x84a7('0x2c')](respondWithResult(_0x51efe5,null))[_0x84a7('0x2a')](handleError(_0x51efe5,null));};exports['getFaxInteractions']=function(_0x39307e,_0x2fee9b){var _0x1967bc={};var _0x447ac3={};var _0x4a7fe6;var _0x3e9e3e;return db[_0x84a7('0x44')][_0x84a7('0xcc')]({'where':{'id':_0x39307e[_0x84a7('0x5c')]['id']}})[_0x84a7('0x2c')](handleEntityNotFound(_0x2fee9b,null))[_0x84a7('0x2c')](function(_0x4b455f){if(_0x4b455f){_0x4a7fe6=_0x4b455f;_0x447ac3[_0x84a7('0xce')]=_[_0x84a7('0xcf')](db[_0x84a7('0xe8')][_0x84a7('0xd1')]);_0x447ac3['query']=_[_0x84a7('0xcf')](_0x39307e[_0x84a7('0x45')]);_0x447ac3[_0x84a7('0xd5')]=_[_0x84a7('0xd2')](_0x447ac3[_0x84a7('0xce')],_0x447ac3[_0x84a7('0x45')]);_0x1967bc[_0x84a7('0x4b')]=_[_0x84a7('0xd2')](_0x447ac3[_0x84a7('0xce')],qs[_0x84a7('0xd3')](_0x39307e[_0x84a7('0x45')][_0x84a7('0xd3')]));_0x1967bc[_0x84a7('0x4b')]=_0x1967bc[_0x84a7('0x4b')][_0x84a7('0x6a')]?_0x1967bc[_0x84a7('0x4b')]:_0x447ac3['model'];_0x1967bc[_0x84a7('0xda')]=qs[_0x84a7('0xd4')](_0x39307e['query'][_0x84a7('0xd4')]);_0x1967bc['where']=qs[_0x84a7('0xd5')](_['pick'](_0x39307e['query'],_0x447ac3['filters']));if(_0x39307e['query']['filter']){_0x1967bc[_0x84a7('0x43')]=_[_0x84a7('0x58')](_0x1967bc[_0x84a7('0x43')],{'$or':_['map'](_0x1967bc[_0x84a7('0x4b')],function(_0x1ea58b){var _0xb8011a={};_0xb8011a[_0x1ea58b]={'$like':'%'+_0x39307e[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0xb8011a;})});}_0x1967bc=_[_0x84a7('0x58')]({},_0x1967bc,_0x39307e[_0x84a7('0x59')]);return _0x4a7fe6[_0x84a7('0xe9')](_0x1967bc);}})['then'](function(_0x4bed74){if(_0x4bed74){_0x3e9e3e=_0x4bed74['length'];if(!_0x39307e[_0x84a7('0x45')]['hasOwnProperty']('nolimit')){_0x1967bc[_0x84a7('0x1c')]=qs[_0x84a7('0x1c')](_0x39307e[_0x84a7('0x45')][_0x84a7('0x1c')]);_0x1967bc[_0x84a7('0x1b')]=qs[_0x84a7('0x1b')](_0x39307e[_0x84a7('0x45')][_0x84a7('0x1b')]);}return _0x4a7fe6[_0x84a7('0xe9')](_0x1967bc);}})[_0x84a7('0x2c')](function(_0x394af6){if(_0x394af6){return _0x394af6?{'count':_0x3e9e3e,'rows':_0x394af6}:null;}})[_0x84a7('0x2c')](respondWithResult(_0x2fee9b,null))[_0x84a7('0x2a')](handleError(_0x2fee9b,null));};exports[_0x84a7('0xea')]=function(_0x510379,_0x30ce42){var _0x17e74e={};var _0x18be51={};var _0x27f3b4;var _0x1ac565;return db[_0x84a7('0x44')][_0x84a7('0xcc')]({'where':{'id':_0x510379['params']['id']}})['then'](handleEntityNotFound(_0x30ce42,null))['then'](function(_0x2918ef){if(_0x2918ef){_0x27f3b4=_0x2918ef;_0x18be51[_0x84a7('0xce')]=_[_0x84a7('0xcf')](db[_0x84a7('0xeb')][_0x84a7('0xd1')]);_0x18be51[_0x84a7('0x45')]=_[_0x84a7('0xcf')](_0x510379[_0x84a7('0x45')]);_0x18be51[_0x84a7('0xd5')]=_[_0x84a7('0xd2')](_0x18be51[_0x84a7('0xce')],_0x18be51['query']);_0x17e74e[_0x84a7('0x4b')]=_[_0x84a7('0xd2')](_0x18be51[_0x84a7('0xce')],qs[_0x84a7('0xd3')](_0x510379[_0x84a7('0x45')][_0x84a7('0xd3')]));_0x17e74e[_0x84a7('0x4b')]=_0x17e74e[_0x84a7('0x4b')][_0x84a7('0x6a')]?_0x17e74e[_0x84a7('0x4b')]:_0x18be51['model'];_0x17e74e['order']=qs[_0x84a7('0xd4')](_0x510379['query'][_0x84a7('0xd4')]);_0x17e74e[_0x84a7('0x43')]=qs[_0x84a7('0xd5')](_[_0x84a7('0xd6')](_0x510379[_0x84a7('0x45')],_0x18be51['filters']));if(_0x510379[_0x84a7('0x45')][_0x84a7('0x34')]){_0x17e74e[_0x84a7('0x43')]=_[_0x84a7('0x58')](_0x17e74e[_0x84a7('0x43')],{'$or':_['map'](_0x17e74e[_0x84a7('0x4b')],function(_0x2506a4){var _0x13cd81={};_0x13cd81[_0x2506a4]={'$like':'%'+_0x510379[_0x84a7('0x45')]['filter']+'%'};return _0x13cd81;})});}_0x17e74e=_[_0x84a7('0x58')]({},_0x17e74e,_0x510379['options']);return _0x27f3b4[_0x84a7('0xea')](_0x17e74e);}})[_0x84a7('0x2c')](function(_0x5cf15b){if(_0x5cf15b){_0x1ac565=_0x5cf15b[_0x84a7('0x6a')];if(!_0x510379['query'][_0x84a7('0xc7')](_0x84a7('0xd8'))){_0x17e74e['limit']=qs[_0x84a7('0x1c')](_0x510379[_0x84a7('0x45')][_0x84a7('0x1c')]);_0x17e74e[_0x84a7('0x1b')]=qs[_0x84a7('0x1b')](_0x510379[_0x84a7('0x45')][_0x84a7('0x1b')]);}return _0x27f3b4[_0x84a7('0xea')](_0x17e74e);}})['then'](function(_0x34f85d){if(_0x34f85d){return _0x34f85d?{'count':_0x1ac565,'rows':_0x34f85d}:null;}})[_0x84a7('0x2c')](respondWithResult(_0x30ce42,null))[_0x84a7('0x2a')](handleError(_0x30ce42,null));};exports[_0x84a7('0xec')]=function(_0x224b65,_0x36a01f,_0x1d08c0){var _0x347b16;var _0x4d4283;var _0x562d6e;var _0x3ff1d5=!_[_0x84a7('0x65')](_0x224b65[_0x84a7('0x5c')]['id'])?_0x224b65[_0x84a7('0x5c')]['id']:!_[_0x84a7('0x65')](_0x224b65[_0x84a7('0x30')]['id'])?_0x224b65[_0x84a7('0x30')]['id']:null;return db[_0x84a7('0x44')][_0x84a7('0x38')]({'where':{'id':_0x3ff1d5,'role':{'$or':[_0x84a7('0x2f'),_0x84a7('0x30'),_0x84a7('0x2d')]}},'attributes':['id','name',_0x84a7('0xed'),_0x84a7('0xee'),'role','internal',_0x84a7('0x99')]})[_0x84a7('0x2c')](function(_0x2a40b3){if(_0x2a40b3){if(_0x2a40b3['role']==='agent'){_0x347b16=_0x2a40b3;if(_0x224b65[_0x84a7('0x5b')][_0x84a7('0xa8')]){_0x562d6e=util[_0x84a7('0xa9')](_0x84a7('0xef'),_0x347b16[_0x224b65[_0x84a7('0x5b')]['interface']]);}else if(_0x224b65[_0x84a7('0x5b')]['intrf']){_0x562d6e=util[_0x84a7('0xa9')](_0x84a7('0xaa'),_0x224b65['body'][_0x84a7('0xf0')]);}else{_0x562d6e=util[_0x84a7('0xa9')](_0x84a7('0xaa'),_0x347b16[_0x84a7('0x3a')]);}socket['to'](util[_0x84a7('0xa9')]('user:%s',_0x347b16[_0x84a7('0x3a')]))[_0x84a7('0xa2')](_0x84a7('0xf1'),{'user':{'id':_0x347b16['id'],'name':_0x347b16[_0x84a7('0x3a')]},'ip':_0x224b65[_0x84a7('0xf2')][_0x84a7('0xf3')]||_0x224b65[_0x84a7('0xf4')][_0x84a7('0xf5')]||_0x224b65[_0x84a7('0xf6')][_0x84a7('0xf5')]||_0x224b65[_0x84a7('0xf4')][_0x84a7('0xf6')]['remoteAddress']});return db[_0x84a7('0xb0')][_0x84a7('0x3c')]({'where':{'membername':_0x347b16[_0x84a7('0x3a')]},'individualHooks':!![]});}}else{throw new db[(_0x84a7('0x8c'))][(_0x84a7('0x8d'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x84a7('0x2c')](function(){if(_0x347b16){return _0x347b16[_0x84a7('0xf7')]({'raw':!![]});}})['then'](function(_0x250401){if(_0x347b16){if(_0x250401){_0x4d4283=_0x250401;if(_0x4d4283[_0x84a7('0x6a')]){var _0x595345=_0x4d4283[_0x84a7('0x36')](function(_0x1a6b2b){var _0x41d009={'membername':_0x347b16[_0x84a7('0x3a')],'UserId':_0x347b16['id'],'queue_name':_0x1a6b2b[_0x84a7('0x3a')],'VoiceQueueId':_0x1a6b2b['id'],'interface':_0x562d6e,'paused':_0x347b16[_0x84a7('0x99')]||![],'penalty':_0x1a6b2b['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt'][_0x84a7('0xab')](_0x41d009);});return Promise[_0x84a7('0x55')](_0x595345);}}}})['then'](function(){if(_0x347b16){return db[_0x84a7('0xf8')]['findAll']({'where':{'membername':_0x347b16[_0x84a7('0x3a')],'exitAt':null}});}})[_0x84a7('0x2c')](function(_0x591ae2){if(_0x347b16){var _0x485d7c=[];_0x591ae2[_0x84a7('0xf9')](function(_0x4e5e72){_0x485d7c['push'](_0x4e5e72[_0x84a7('0x2b')]({'exitAt':moment()[_0x84a7('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x485d7c);}})[_0x84a7('0x2c')](function(){if(_0x347b16){var _0xc43e83=[];var _0x12217c=[];var _0x44e916=utils['getChannels']();var _0x4977ff={'membername':_0x347b16[_0x84a7('0x3a')],'interface':_0x562d6e,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x347b16[_0x84a7('0x2e')],'internal':_0x347b16[_0x84a7('0x61')]};_0x44e916[_0x84a7('0xf9')](function(_0x3672a8){_0xc43e83[_0x84a7('0x4c')](_[_0x84a7('0x58')]({'channel':_0x3672a8,'type':_0x84a7('0xfa'),'data1':_0x224b65[_0x84a7('0x5b')][_0x84a7('0xfb')],'data2':_0x562d6e},_0x4977ff));if(_0x347b16['loginInPause']){_0x12217c['push'](_[_0x84a7('0x58')]({'channel':_0x3672a8,'type':'PAUSE','data1':_0x84a7('0xfc')},_0x4977ff));}});return db[_0x84a7('0xf8')][_0x84a7('0xfd')](_0xc43e83['concat'](_0x12217c),{'individualHooks':!![]});}})['then'](function(){if(_0x347b16){return _0x347b16['update']({'online':!![],'lastLoginAt':moment()[_0x84a7('0xa9')](_0x84a7('0xfe')),'voicePause':_0x347b16[_0x84a7('0x99')]||![],'mailPause':_0x347b16['loginInPause']||![],'chatPause':_0x347b16[_0x84a7('0x99')]||![],'faxPause':_0x347b16[_0x84a7('0x99')]||![],'smsPause':_0x347b16[_0x84a7('0x99')]||![],'openchannelPause':_0x347b16[_0x84a7('0x99')]||![],'whatsappPause':_0x347b16[_0x84a7('0x99')]||![],'pauseType':_0x347b16[_0x84a7('0x99')]?'LOGININPAUSE':null,'interface':_0x562d6e,'lastPauseAt':moment()[_0x84a7('0xa9')](_0x84a7('0xfe'))});}})[_0x84a7('0x2c')](function(_0x347c77){if(_0x224b65[_0x84a7('0xff')]){return _0x1d08c0();}else{return Promise['resolve'](_0x347c77)[_0x84a7('0x2c')](respondWithResult(_0x36a01f,null));}})[_0x84a7('0x2a')](handleError(_0x36a01f,null));};exports['logout']=function(_0x45e0a7,_0x21817f){var _0x43b9e2;return db[_0x84a7('0x44')][_0x84a7('0x38')]({'where':{'id':_0x45e0a7['params']['id'],'role':_0x84a7('0x2d')},'attributes':['id',_0x84a7('0x3a'),_0x84a7('0x2e')]})[_0x84a7('0x2c')](handleEntityNotFound(_0x21817f,null))['then'](function(_0x278eca){if(_0x278eca){_0x43b9e2=_0x278eca;return db[_0x84a7('0xb0')][_0x84a7('0x3c')]({'where':{'membername':_0x43b9e2[_0x84a7('0x3a')]},'individualHooks':!![]});}})[_0x84a7('0x2c')](function(){return db['MemberReport'][_0x84a7('0xa6')]({'where':{'membername':_0x43b9e2[_0x84a7('0x3a')],'exitAt':null}});})[_0x84a7('0x2c')](function(_0x349470){var _0x7d58d9=[];_0x349470[_0x84a7('0xf9')](function(_0x368180){_0x7d58d9[_0x84a7('0x4c')](_0x368180[_0x84a7('0x2b')]({'exitAt':moment()['format'](_0x84a7('0xfe'))}));});return Promise[_0x84a7('0x55')](_0x7d58d9);})['then'](function(){return _0x43b9e2[_0x84a7('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x84a7('0x2c')](respondWithResult(_0x21817f,null))[_0x84a7('0x2a')](handleError(_0x21817f,null));};exports[_0x84a7('0x100')]=function(_0x38e29f,_0x55a860){var _0x24973f;return db[_0x84a7('0xb0')][_0x84a7('0x2b')]({'paused':0x1},{'where':{'UserId':_0x38e29f[_0x84a7('0x5c')]['id']},'individualHooks':!![]})[_0x84a7('0x2c')](function(){return db[_0x84a7('0x44')][_0x84a7('0x38')]({'where':{'id':_0x38e29f[_0x84a7('0x5c')]['id'],'role':_0x84a7('0x2d')},'attributes':['id','name',_0x84a7('0x2e'),_0x84a7('0x61'),_0x84a7('0xa8'),_0x84a7('0x98')]});})['then'](handleEntityNotFound(_0x55a860,null))['then'](function(_0x1a2cbd){if(_0x1a2cbd){_0x24973f=_0x1a2cbd;return respondWithRpcPromise(_0x84a7('0x101'),_0x84a7('0x100'),{'id':_0x24973f['id'],'name':_0x24973f[_0x84a7('0x3a')],'pause':!![]});}})[_0x84a7('0x2c')](function(){if(_0x24973f){return db[_0x84a7('0xf8')]['findAll']({'where':{'membername':_0x24973f[_0x84a7('0x3a')],'type':_0x84a7('0x102'),'exitAt':null}});}})[_0x84a7('0x2c')](function(_0x3b57a2){if(_0x3b57a2['length']){var _0xdb69b=moment()[_0x84a7('0xa9')](_0x84a7('0xfe'));for(var _0x2c3b57=0x0,_0x5044e2=_0x3b57a2[_0x84a7('0x6a')];_0x2c3b57<_0x5044e2;_0x2c3b57++){_0x3b57a2[_0x2c3b57]['updateAttributes']({'exitAt':_0xdb69b});}}})[_0x84a7('0x2c')](function(){var _0x1b8169=[];var _0x1c4fbb=utils[_0x84a7('0x103')]();_0x1c4fbb[_0x84a7('0xf9')](function(_0x34ffe9){_0x1b8169[_0x84a7('0x4c')]({'channel':_0x34ffe9,'membername':_0x24973f['name'],'interface':_['isNil'](_0x24973f[_0x84a7('0xa8')])?util['format'](_0x84a7('0xaa'),_0x24973f[_0x84a7('0x3a')]):_0x24973f['interface'],'type':_0x84a7('0x102'),'enterAt':moment()[_0x84a7('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x38e29f[_0x84a7('0x5b')][_0x84a7('0x104')]||_0x84a7('0x105'),'role':_0x24973f[_0x84a7('0x2e')],'internal':_0x24973f[_0x84a7('0x61')]});});return db['MemberReport'][_0x84a7('0xfd')](_0x1b8169,{'individualHooks':!![]});})[_0x84a7('0x2c')](function(){return _0x24973f['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x38e29f[_0x84a7('0x5b')]['type']||_0x84a7('0x105'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x84a7('0x2c')](respondWithResult(_0x55a860,null))[_0x84a7('0x2a')](handleError(_0x55a860,null));};exports['unpause']=function(_0x3c5096,_0x4f40d1){if(_0x3c5096[_0x84a7('0x5b')][_0x84a7('0xac')]&&!utils['isValidChannel'](_0x3c5096[_0x84a7('0x5b')][_0x84a7('0xac')])){throw new APIBadRequestError(util[_0x84a7('0xa9')](_0x84a7('0x106'),_0x3c5096['body'][_0x84a7('0xac')]));}return db['User'][_0x84a7('0x38')]({'where':{'id':_0x3c5096['params']['id']},'attributes':['id',_0x84a7('0x3a'),_0x84a7('0x2e'),'internal',_0x84a7('0xa8'),'online','voicePause',_0x84a7('0x107'),_0x84a7('0x108'),_0x84a7('0x109'),_0x84a7('0x10a'),_0x84a7('0x10b'),_0x84a7('0x10c'),_0x84a7('0x10d'),_0x84a7('0x10e')]})[_0x84a7('0x2c')](function(_0x33fb81){if(!_0x33fb81){throw new APINotFoundError(util['format'](_0x84a7('0xc6'),_0x3c5096[_0x84a7('0x5c')]['id']));}return _0x33fb81['unpause'](_0x3c5096[_0x84a7('0x5b')][_0x84a7('0xac')]);})[_0x84a7('0x2c')](respondWithResult(_0x4f40d1,null))[_0x84a7('0x2a')](APIHandleError(_0x4f40d1));};exports[_0x84a7('0x10f')]=function(_0x2cce3d,_0x122435){var _0x1c5fc7={};var _0x456755={};var _0x14f978;var _0x270356;return db['User'][_0x84a7('0xcc')]({'where':{'id':_0x2cce3d['params']['id']}})[_0x84a7('0x2c')](handleEntityNotFound(_0x122435,null))[_0x84a7('0x2c')](function(_0x2e2f96){if(_0x2e2f96){_0x14f978=_0x2e2f96;_0x456755[_0x84a7('0xce')]=_[_0x84a7('0xcf')](db[_0x84a7('0x110')][_0x84a7('0xd1')]);_0x456755[_0x84a7('0x45')]=_[_0x84a7('0xcf')](_0x2cce3d[_0x84a7('0x45')]);_0x456755[_0x84a7('0xd5')]=_['intersection'](_0x456755[_0x84a7('0xce')],_0x456755[_0x84a7('0x45')]);_0x1c5fc7[_0x84a7('0x4b')]=_[_0x84a7('0xd2')](_0x456755[_0x84a7('0xce')],qs[_0x84a7('0xd3')](_0x2cce3d['query']['fields']));_0x1c5fc7[_0x84a7('0x4b')]=_0x1c5fc7[_0x84a7('0x4b')][_0x84a7('0x6a')]?_0x1c5fc7[_0x84a7('0x4b')]:_0x456755['model'];_0x1c5fc7[_0x84a7('0xda')]=qs[_0x84a7('0xd4')](_0x2cce3d['query']['sort']);_0x1c5fc7[_0x84a7('0x43')]=qs['filters'](_[_0x84a7('0xd6')](_0x2cce3d[_0x84a7('0x45')],_0x456755[_0x84a7('0xd5')]));if(_0x2cce3d[_0x84a7('0x45')]['filter']){_0x1c5fc7[_0x84a7('0x43')]=_[_0x84a7('0x58')](_0x1c5fc7[_0x84a7('0x43')],{'$or':_[_0x84a7('0x36')](_0x1c5fc7[_0x84a7('0x4b')],function(_0x16e17b){var _0x4d0449={};_0x4d0449[_0x16e17b]={'$like':'%'+_0x2cce3d[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0x4d0449;})});}_0x1c5fc7=_[_0x84a7('0x58')]({},_0x1c5fc7,_0x2cce3d[_0x84a7('0x59')]);return _0x14f978[_0x84a7('0x10f')](_0x1c5fc7);}})[_0x84a7('0x2c')](function(_0x3add8f){if(_0x3add8f){_0x270356=_0x3add8f[_0x84a7('0x6a')];if(!_0x2cce3d['query']['hasOwnProperty'](_0x84a7('0xd8'))){_0x1c5fc7[_0x84a7('0x1c')]=qs[_0x84a7('0x1c')](_0x2cce3d[_0x84a7('0x45')]['limit']);_0x1c5fc7['offset']=qs[_0x84a7('0x1b')](_0x2cce3d[_0x84a7('0x45')]['offset']);}return _0x14f978[_0x84a7('0x10f')](_0x1c5fc7);}})[_0x84a7('0x2c')](function(_0x3b5e54){if(_0x3b5e54){return _0x3b5e54?{'count':_0x270356,'rows':_0x3b5e54}:null;}})[_0x84a7('0x2c')](respondWithResult(_0x122435,null))[_0x84a7('0x2a')](handleError(_0x122435,null));};exports[_0x84a7('0x111')]=function(_0x132f6e,_0x2b1445){var _0x5e3dfa=_0x132f6e['params']['id'];var _0x335ece=_0x132f6e['body']?_0x132f6e[_0x84a7('0x5b')][_0x84a7('0x5f')]:null;var _0x18bf5e=[];return Promise['resolve']()[_0x84a7('0x2c')](function(){if(!_0x335ece)throw new APIBadRequestError(_0x84a7('0x112'));})[_0x84a7('0x2c')](function(){return db[_0x84a7('0x44')][_0x84a7('0xcc')]({'where':{'id':_0x5e3dfa}});})['then'](function(_0x46d941){if(!_0x46d941)throw new APINotFoundError(util[_0x84a7('0xa9')](_0x84a7('0xc6'),_0x132f6e['params']['id']));return db['sequelize'][_0x84a7('0x113')](function(_0x59e808){return _0x46d941[_0x84a7('0x111')](_0x335ece,{'transaction':_0x59e808})[_0x84a7('0x2c')](function(){return db['Team'][_0x84a7('0xa6')]({'where':{'id':{'$in':_0x335ece}}});})['then'](function(_0x101c60){var _0x491a1e=_[_0x84a7('0x36')](_0x101c60,function(_0x1c9956){return _0x1c9956[_0x84a7('0x114')]();});return Promise[_0x84a7('0x55')](_0x491a1e);})[_0x84a7('0x2c')](function(_0x506c36){_0x18bf5e=_[_0x84a7('0x115')](_0x506c36);var _0x143b91=_['map'](_0x18bf5e,function(_0x146eed){return _0x146eed['addAgent'](_0x46d941['id'],{'transaction':_0x59e808});});return Promise[_0x84a7('0x55')](_0x143b91);})[_0x84a7('0x2c')](function(){if(!_0x46d941[_0x84a7('0x98')])return;var _0x4ae06b=_[_0x84a7('0x34')](_0x18bf5e,function(_0x2516ba){return _0x2516ba[_0x84a7('0x116')]('channel')===_0x84a7('0x117');});var _0x36239f=_[_0x84a7('0x36')](_0x4ae06b,function(_0xc6d1d1){return db[_0x84a7('0xb0')][_0x84a7('0xab')]({'membername':_0x46d941[_0x84a7('0x3a')],'UserId':_0x46d941['id'],'queue_name':_0xc6d1d1[_0x84a7('0x3a')],'VoiceQueueId':_0xc6d1d1['id'],'interface':_[_0x84a7('0x65')](_0x46d941[_0x84a7('0xa8')])?util[_0x84a7('0xa9')](_0x84a7('0xaa'),_0x46d941[_0x84a7('0x3a')]):_0x46d941[_0x84a7('0xa8')],'paused':_0x46d941[_0x84a7('0x9a')]||![],'penalty':_0x46d941[_0x84a7('0xa0')]},{'transaction':_0x59e808});});return Promise[_0x84a7('0x55')](_0x36239f);})[_0x84a7('0x2c')](function(){return db[_0x84a7('0x118')][_0x84a7('0xa6')]({'where':{'teamId':{'$in':_0x335ece}}});})[_0x84a7('0x2c')](function(_0x1071a6){var _0x3c7bf1=_['map'](_0x1071a6,function(_0x2dd4ed){return db[_0x84a7('0x119')]['create']({'UserId':_0x46d941['id'],'VoicePrefixId':_0x2dd4ed[_0x84a7('0x11a')]},{'transaction':_0x59e808});});return Promise[_0x84a7('0x55')](_0x3c7bf1);});});})[_0x84a7('0x2c')](function(){for(var _0x1bfb6a=0x0;_0x1bfb6a<_0x18bf5e[_0x84a7('0x6a')];_0x1bfb6a++){var _0x45baad=_0x18bf5e[_0x1bfb6a][_0x84a7('0x116')]('channel');var _0x3644f0=_0x45baad+_0x84a7('0xae');socket[_0x84a7('0xa2')]('user'+_0x45baad+_0x84a7('0xa3'),{'UserId':_0x5e3dfa,['queueField']:_0x18bf5e[_0x1bfb6a]['id']});}})['then'](respondWithStatusCode(_0x2b1445,null))[_0x84a7('0x2a')](APIHandleError(_0x2b1445));};exports['removeTeams']=function(_0x4f112f,_0x24898a){var _0x113cac=_0x4f112f[_0x84a7('0x5c')]['id'];var _0x3ce1da=null;if(_0x4f112f[_0x84a7('0x45')][_0x84a7('0x5f')]){_0x3ce1da=_[_0x84a7('0xad')](_0x4f112f[_0x84a7('0x45')][_0x84a7('0x5f')])?_0x4f112f[_0x84a7('0x45')][_0x84a7('0x5f')]:[_0x4f112f[_0x84a7('0x45')][_0x84a7('0x5f')]];}var _0x23a6fd=[];return Promise['resolve']()[_0x84a7('0x2c')](function(){if(!_0x3ce1da)throw new APIBadRequestError(_0x84a7('0x11b'));})[_0x84a7('0x2c')](function(){return db[_0x84a7('0x44')]['findOne']({'where':{'id':_0x113cac}});})[_0x84a7('0x2c')](function(_0x12a792){if(!_0x12a792)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x4f112f['params']['id']));return db[_0x84a7('0x67')][_0x84a7('0x113')](function(_0x581897){return _0x12a792[_0x84a7('0x11c')](_0x3ce1da,{'transaction':_0x581897})[_0x84a7('0x2c')](function(){return db['Team'][_0x84a7('0xa6')]({'where':{'id':{'$in':_0x3ce1da}}});})[_0x84a7('0x2c')](function(_0x420fdb){var _0x529446=_[_0x84a7('0x36')](_0x420fdb,function(_0x10889e){return _0x10889e['getAssociatedQueues']();});return Promise['all'](_0x529446);})[_0x84a7('0x2c')](function(_0x3afd4f){_0x23a6fd=_[_0x84a7('0x115')](_0x3afd4f);var _0x42c848=_[_0x84a7('0x36')](_0x23a6fd,function(_0x375f5a){return _0x375f5a[_0x84a7('0x11d')](_0x12a792['id'],{'transaction':_0x581897});});return Promise[_0x84a7('0x55')](_0x42c848);})['then'](function(){if(!_0x12a792[_0x84a7('0x98')])return;var _0x1d7f52=_[_0x84a7('0x34')](_0x23a6fd,function(_0x545385){return _0x545385[_0x84a7('0x116')](_0x84a7('0xac'))===_0x84a7('0x117');});var _0x487dae=_[_0x84a7('0x36')](_0x1d7f52,function(_0x36517d){return db[_0x84a7('0xb0')][_0x84a7('0x3c')]({'where':{'VoiceQueueId':_0x36517d['id'],'UserId':_0x12a792['id']},'transaction':_0x581897});});return Promise['all'](_0x487dae);})[_0x84a7('0x2c')](function(){return db['TeamVoicePrefix'][_0x84a7('0xa6')]({'where':{'teamId':{'$in':_0x3ce1da}}});})[_0x84a7('0x2c')](function(_0x4d1cef){var _0x2d45e5=_[_0x84a7('0x36')](_0x4d1cef,function(_0x97762){return db[_0x84a7('0x119')][_0x84a7('0x3c')]({'where':{'UserId':_0x12a792['id'],'VoicePrefixId':_0x97762['VoicePrefixId']}},{'transaction':_0x581897});});return Promise[_0x84a7('0x55')](_0x2d45e5);});});})[_0x84a7('0x2c')](function(){for(var _0x509eb3=0x0;_0x509eb3<_0x23a6fd[_0x84a7('0x6a')];_0x509eb3++){var _0x16e948=_0x23a6fd[_0x509eb3]['getDataValue'](_0x84a7('0xac'));var _0x44ed36=_0x16e948+_0x84a7('0xae');socket[_0x84a7('0xa2')](_0x84a7('0x30')+_0x16e948+_0x84a7('0xaf'),{'UserId':_0x113cac,['queueField']:_0x23a6fd[_0x509eb3]['id']});}})[_0x84a7('0x2c')](respondWithStatusCode(_0x24898a,null))[_0x84a7('0x2a')](APIHandleError(_0x24898a));};exports[_0x84a7('0x11e')]=function(_0x535eb6,_0x130194){var _0x4a6def={};var _0x5c14a6={};var _0x2de5c;var _0x8fa989;return db[_0x84a7('0x44')][_0x84a7('0xcc')]({'where':{'id':_0x535eb6[_0x84a7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x130194,null))['then'](function(_0x3b22ae){if(_0x3b22ae){_0x2de5c=_0x3b22ae;_0x5c14a6[_0x84a7('0xce')]=_[_0x84a7('0xcf')](db[_0x84a7('0xc8')][_0x84a7('0xd1')]);_0x5c14a6[_0x84a7('0x45')]=_[_0x84a7('0xcf')](_0x535eb6[_0x84a7('0x45')]);_0x5c14a6['filters']=_['intersection'](_0x5c14a6[_0x84a7('0xce')],_0x5c14a6[_0x84a7('0x45')]);_0x4a6def[_0x84a7('0x4b')]=_[_0x84a7('0xd2')](_0x5c14a6[_0x84a7('0xce')],qs[_0x84a7('0xd3')](_0x535eb6[_0x84a7('0x45')]['fields']));_0x4a6def[_0x84a7('0x4b')]=_0x4a6def[_0x84a7('0x4b')]['length']?_0x4a6def[_0x84a7('0x4b')]:_0x5c14a6[_0x84a7('0xce')];_0x4a6def[_0x84a7('0xda')]=qs[_0x84a7('0xd4')](_0x535eb6[_0x84a7('0x45')][_0x84a7('0xd4')]);_0x4a6def[_0x84a7('0x43')]=qs[_0x84a7('0xd5')](_[_0x84a7('0xd6')](_0x535eb6[_0x84a7('0x45')],_0x5c14a6[_0x84a7('0xd5')]));if(_0x535eb6['query'][_0x84a7('0x34')]){_0x4a6def['where']=_['merge'](_0x4a6def['where'],{'$or':_['map'](_0x4a6def['attributes'],function(_0x2da50a){var _0x1b8ca4={};_0x1b8ca4[_0x2da50a]={'$like':'%'+_0x535eb6[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0x1b8ca4;})});}_0x4a6def=_[_0x84a7('0x58')]({},_0x4a6def,_0x535eb6[_0x84a7('0x59')]);return _0x2de5c[_0x84a7('0x11e')](_0x4a6def);}})[_0x84a7('0x2c')](function(_0x5ce7d1){if(_0x5ce7d1){_0x8fa989=_0x5ce7d1[_0x84a7('0x6a')];if(!_0x535eb6[_0x84a7('0x45')][_0x84a7('0xc7')](_0x84a7('0xd8'))){_0x4a6def['limit']=qs[_0x84a7('0x1c')](_0x535eb6['query'][_0x84a7('0x1c')]);_0x4a6def[_0x84a7('0x1b')]=qs[_0x84a7('0x1b')](_0x535eb6[_0x84a7('0x45')][_0x84a7('0x1b')]);}return _0x2de5c[_0x84a7('0x11e')](_0x4a6def);}})[_0x84a7('0x2c')](function(_0x399152){if(_0x399152){return _0x399152?{'count':_0x8fa989,'rows':_0x399152}:null;}})['then'](respondWithResult(_0x130194,null))[_0x84a7('0x2a')](handleError(_0x130194,null));};exports[_0x84a7('0x11f')]=function(_0x40e088,_0xc5b753){var _0x59d806={};var _0x1cb58b={};var _0x4e8837;return db[_0x84a7('0x44')][_0x84a7('0xcc')]({'where':{'id':_0x40e088[_0x84a7('0x5c')]['id']}})['then'](handleEntityNotFound(_0xc5b753,null))[_0x84a7('0x2c')](function(_0x126b20){if(_0x126b20){_0x4e8837=_0x126b20;_0x1cb58b[_0x84a7('0xce')]=_[_0x84a7('0xcf')](db[_0x84a7('0x44')]['rawAttributes']);_0x1cb58b['query']=_[_0x84a7('0xcf')](_0x40e088['query']);_0x1cb58b[_0x84a7('0xd5')]=_[_0x84a7('0xd2')](_0x1cb58b[_0x84a7('0xce')],_0x1cb58b['query']);_0x59d806[_0x84a7('0x4b')]=_['intersection'](_0x1cb58b[_0x84a7('0xce')],qs['fields'](_0x40e088[_0x84a7('0x45')][_0x84a7('0xd3')]));_0x59d806[_0x84a7('0x4b')]=_0x59d806[_0x84a7('0x4b')][_0x84a7('0x6a')]?_0x59d806[_0x84a7('0x4b')]:_0x1cb58b[_0x84a7('0xce')];_0x59d806['order']=qs['sort'](_0x40e088[_0x84a7('0x45')][_0x84a7('0xd4')]);_0x59d806[_0x84a7('0x43')]=qs[_0x84a7('0xd5')](_[_0x84a7('0xd6')](_0x40e088['query'],_0x1cb58b[_0x84a7('0xd5')]));if(_0x40e088['query']['filter']){_0x59d806[_0x84a7('0x43')]=_[_0x84a7('0x58')](_0x59d806[_0x84a7('0x43')],{'$or':_['map'](_0x59d806[_0x84a7('0x4b')],function(_0x1bc7ba){var _0x2dc5d9={};_0x2dc5d9[_0x1bc7ba]={'$like':'%'+_0x40e088[_0x84a7('0x45')][_0x84a7('0x34')]+'%'};return _0x2dc5d9;})});}_0x59d806[_0x84a7('0xce')]=db[_0x84a7('0x44')];_0x59d806['as']=_0x84a7('0x31');_0x59d806=_[_0x84a7('0x58')]({},_0x59d806,_0x40e088[_0x84a7('0x59')]);return _0x4e8837[_0x84a7('0xf7')]({'include':[_0x59d806]});}})['then'](function(_0xeb2a77){if(_0xeb2a77){var _0x421350={},_0x1e8525=[];for(var _0x1b6b38=0x0;_0x1b6b38<_0xeb2a77[_0x84a7('0x6a')];_0x1b6b38+=0x1){for(var _0x5157c2=0x0,_0x254a95;_0x5157c2<_0xeb2a77[_0x1b6b38][_0x84a7('0x31')][_0x84a7('0x6a')];_0x5157c2+=0x1){_0x254a95=_0xeb2a77[_0x1b6b38][_0x84a7('0x31')][_0x5157c2][_0x84a7('0xa7')]({'plain':!![]});_0x421350[_0x254a95['id']]=_0x254a95;}}_0x421350=_[_0x84a7('0x120')](_0x421350);for(var _0x59020e=qs['offset'](_0x40e088[_0x84a7('0x45')][_0x84a7('0x1b')]);_0x59020e<_0x421350[_0x84a7('0x6a')]&&_0x1e8525[_0x84a7('0x6a')]=_0x2e6a70){_0x4c9318=_0x2e6a70;_0x48d3de=0xc8;}else{_0x48d3de=0xce;}_0x27571d['status'](_0x48d3de);return _0x27571d[_0x2a32('0x21')]('Content-Range',_0x1c852f+'-'+_0x4c9318+'/'+_0x2e6a70)[_0x2a32('0x22')](_0x2368c3);}return null;};}function respondWithRpcPromise(_0x2d3623,_0x4fe765,_0x460f67,_0x4602dd){return new Promise(function(_0x427961,_0x597d58){var _0x1b10cf=_0x4602dd||amiClient;return _0x1b10cf['request'](_0x2d3623,_0x460f67)[_0x2a32('0x23')](function(_0x555592){logger[_0x2a32('0x24')](_0x2a32('0x25'),_0x4fe765,_0x2a32('0x26'));logger['debug'](_0x2a32('0x27'),_0x4fe765,'request\x20sent',JSON[_0x2a32('0x28')](_0x555592));if(_0x555592[_0x2a32('0x29')]){if(_0x555592[_0x2a32('0x29')][_0x2a32('0x2a')]===0x1f4){logger['error'](_0x2a32('0x25'),_0x4fe765,_0x555592[_0x2a32('0x29')][_0x2a32('0x2b')]);return _0x597d58(_0x555592[_0x2a32('0x29')][_0x2a32('0x2b')]);}logger[_0x2a32('0x29')](_0x2a32('0x25'),_0x4fe765,_0x555592[_0x2a32('0x29')][_0x2a32('0x2b')]);return _0x427961(_0x555592[_0x2a32('0x29')]['message']);}else{logger['info'](_0x2a32('0x25'),_0x4fe765,_0x2a32('0x26'));_0x427961(_0x555592[_0x2a32('0x2c')][_0x2a32('0x2b')]);}})[_0x2a32('0x2d')](function(_0x53e72e){logger[_0x2a32('0x29')](_0x2a32('0x25'),_0x4fe765,_0x53e72e);_0x597d58(_0x53e72e);});});}function saveUpdates(_0x2bba6e){return function(_0x20edb4){if(_0x20edb4){return _0x20edb4[_0x2a32('0x2e')](_0x2bba6e)[_0x2a32('0x23')](function(_0x1e6847){if(_0x1e6847['role']===_0x2a32('0x2f')){socket[_0x2a32('0x30')](_0x2a32('0x31')+_0x1e6847['id'],_0x1e6847);}return _0x1e6847;});}return null;};}function removeEntity(_0x21eb79,_0x14d3b0){return function(_0x12db4d){if(_0x12db4d){return _0x12db4d['destroy']({'transaction':_0x14d3b0})[_0x2a32('0x23')](function(){var _0x1a2f5c=_0x12db4d[_0x2a32('0x32')]({'plain':!![]});if(_0x1a2f5c['role']===_0x2a32('0x33'))return;var _0x58f6a6=[{'name':_0x2a32('0x34'),'value':_0x2a32('0x35'),'ignore':!![]},{'name':_0x2a32('0x36'),'value':_0x2a32('0x2f'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x544633=_(_0x58f6a6)[_0x2a32('0x37')](_0x2a32('0x38'))[_0x2a32('0x39')]('value')[_0x2a32('0x3a')]();if(_[_0x2a32('0x3b')](_0x544633,_0x1a2f5c['role'])){return;}var _0x4eeb31=_[_0x2a32('0x3c')](_0x58f6a6,[_0x2a32('0x3a'),_0x1a2f5c[_0x2a32('0x3d')]])[_0x2a32('0x3e')];return db[_0x2a32('0x3f')]['destroy']({'where':{'type':_0x4eeb31,'resourceId':_0x1a2f5c['id']},'transaction':_0x14d3b0})[_0x2a32('0x23')](function(){return _0x12db4d;});})[_0x2a32('0x23')](function(){_0x21eb79[_0x2a32('0x1b')](0xcc)[_0x2a32('0x1c')]();});}};}function handleEntityNotFound(_0x4d3be2){return function(_0x1a7296){if(!_0x1a7296){_0x4d3be2[_0x2a32('0x1a')](0x194);}return _0x1a7296;};}function handleError(_0x1cf2cf,_0x158526){_0x158526=_0x158526||0x1f4;return function(_0xfc560f){logger[_0x2a32('0x29')](_0xfc560f[_0x2a32('0x40')]);if(_0xfc560f['name']){delete _0xfc560f['name'];}_0x1cf2cf[_0x2a32('0x1b')](_0x158526)[_0x2a32('0x41')](_0xfc560f);};}function getUserAttributes(){return _(db[_0x2a32('0x42')][_0x2a32('0x43')])['map'](function(_0x537d05){return{'name':_0x537d05[_0x2a32('0x44')],'type':_0x537d05[_0x2a32('0x45')]['key']};})[_0x2a32('0x37')](function(_0x57c15e){return![_0x2a32('0x46'),_0x2a32('0x47'),'previousPasswords',_0x2a32('0x48'),_0x2a32('0x49'),_0x2a32('0x4a')]['includes'](_0x57c15e[_0x2a32('0x3e')]);})[_0x2a32('0x3a')]();}exports[_0x2a32('0x4b')]=function(_0x2786e7,_0xc85cfc){var _0x1ce113={},_0x2bed71={'count':0x0,'rows':[]};var _0x160fdb=getUserAttributes();_0x1ce113=qs[_0x2a32('0x4c')](_0x160fdb,_0x2786e7);var _0x510de5={'where':_0x1ce113[_0x2a32('0x4d')]};return db[_0x2a32('0x42')]['count'](_0x510de5)[_0x2a32('0x23')](function(_0x2892e6){_0x2bed71['count']=_0x2892e6;if(_0x2786e7[_0x2a32('0x4e')][_0x2a32('0x4f')]){_0x1ce113['include']=[{'all':!![]}];}if(_0x2786e7['query'][_0x2a32('0x50')]===_0x2a32('0x51')){_0x1ce113[_0x2a32('0x52')]=[{'model':db[_0x2a32('0x53')],'as':'userSetting'}];}if(!_[_0x2a32('0x3b')](_0x1ce113[_0x2a32('0x54')],'id')){_0x1ce113[_0x2a32('0x54')][_0x2a32('0x55')]('id');}return db[_0x2a32('0x42')][_0x2a32('0x56')](_0x1ce113);})[_0x2a32('0x23')](function(_0x595a24){_0x2bed71[_0x2a32('0x57')]=_0x595a24;if(_0x2786e7[_0x2a32('0x4e')][_0x2a32('0x58')]===_0x2a32('0x51')){var _0x1a0296=[];for(var _0x1c6c60=0x0;_0x1c6c60<_0x2bed71[_0x2a32('0x57')][_0x2a32('0x59')];_0x1c6c60++){_0x1a0296[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5a'),_0x2bed71[_0x2a32('0x57')][_0x1c6c60]['dataValues']));_0x1a0296[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5b'),_0x2bed71[_0x2a32('0x57')][_0x1c6c60][_0x2a32('0x5c')]));_0x1a0296[_0x2a32('0x55')](get_open_tabs('fax',_0x2bed71['rows'][_0x1c6c60][_0x2a32('0x5c')]));_0x1a0296['push'](get_open_tabs(_0x2a32('0x5d'),_0x2bed71[_0x2a32('0x57')][_0x1c6c60][_0x2a32('0x5c')]));_0x1a0296[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5e'),_0x2bed71[_0x2a32('0x57')][_0x1c6c60]['dataValues']));_0x1a0296[_0x2a32('0x55')](get_open_tabs('whatsapp',_0x2bed71['rows'][_0x1c6c60][_0x2a32('0x5c')]));}return Promise[_0x2a32('0x5f')](_0x1a0296)['then'](function(){return _0x2bed71;});}else{return _0x2bed71;}})['then'](respondWithFilteredResult(_0xc85cfc,_0x1ce113))[_0x2a32('0x2d')](handleError(_0xc85cfc,null));};exports[_0x2a32('0x60')]=function(_0x3bd5fa,_0x5dd6bb){var _0x10c4e8=getUserAttributes();_0x3bd5fa['query']['id']=_0x3bd5fa[_0x2a32('0x61')]['id'];var _0x5b4e81=qs[_0x2a32('0x4c')](_0x10c4e8,_0x3bd5fa);if(_0x3bd5fa[_0x2a32('0x4e')][_0x2a32('0x4f')]){_0x5b4e81[_0x2a32('0x52')]=[{'all':!![]}];}if(_0x3bd5fa[_0x2a32('0x4e')]['userSetting']==='true'){_0x5b4e81[_0x2a32('0x52')]=[{'model':db[_0x2a32('0x53')],'as':'userSetting'}];}_0x5b4e81=_[_0x2a32('0x62')]({},_0x5b4e81,_0x3bd5fa[_0x2a32('0x63')]);if(!_[_0x2a32('0x3b')](_0x5b4e81[_0x2a32('0x54')],'id')){_0x5b4e81['attributes']['push']('id');}return db[_0x2a32('0x42')]['find'](_0x5b4e81)[_0x2a32('0x23')](handleEntityNotFound(_0x5dd6bb,null))[_0x2a32('0x23')](function(_0x88363e){var _0x4c4bcc=[];values=_0x88363e;if(_0x3bd5fa[_0x2a32('0x4e')][_0x2a32('0x58')]===_0x2a32('0x51')){_0x4c4bcc[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5a'),_0x88363e[_0x2a32('0x5c')]));_0x4c4bcc[_0x2a32('0x55')](get_open_tabs('sms',_0x88363e[_0x2a32('0x5c')]));_0x4c4bcc['push'](get_open_tabs(_0x2a32('0x5e'),_0x88363e[_0x2a32('0x5c')]));_0x4c4bcc['push'](get_open_tabs(_0x2a32('0x64'),_0x88363e[_0x2a32('0x5c')]));_0x4c4bcc[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x65'),_0x88363e[_0x2a32('0x5c')]));_0x4c4bcc[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5d'),_0x88363e[_0x2a32('0x5c')]));return Promise['all'](_0x4c4bcc);}else{return values;}})[_0x2a32('0x23')](function(){return values;})['then'](respondWithResult(_0x5dd6bb,null))['catch'](handleError(_0x5dd6bb,null));};exports[_0x2a32('0x2e')]=function(_0x1fa4e6,_0x3e13c8){if(_0x1fa4e6[_0x2a32('0x66')]['id']){delete _0x1fa4e6[_0x2a32('0x66')]['id'];}delete _0x1fa4e6['body'][_0x2a32('0x3d')];return db['User'][_0x2a32('0x3c')]({'where':{'id':_0x1fa4e6[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x3e13c8,null))[_0x2a32('0x23')](saveUpdates(_0x1fa4e6[_0x2a32('0x66')],null))[_0x2a32('0x23')](respondWithResult(_0x3e13c8,null))[_0x2a32('0x2d')](handleError(_0x3e13c8,null));};exports['describe']=function(_0x2a044f,_0x1606b9){return db[_0x2a32('0x42')][_0x2a32('0x67')]()[_0x2a32('0x23')](respondWithResult(_0x1606b9,null))[_0x2a32('0x2d')](handleError(_0x1606b9,null));};exports[_0x2a32('0x68')]=function(_0x313b8a,_0x4b45cb){return db['User'][_0x2a32('0x3c')]({'where':{'id':_0x313b8a[_0x2a32('0x61')]['id']}})['then'](handleEntityNotFound(_0x4b45cb,null))[_0x2a32('0x23')](function(_0x441810){if(_0x441810){return _0x441810[_0x2a32('0x68')](_0x313b8a[_0x2a32('0x66')][_0x2a32('0x69')],_[_0x2a32('0x6a')](_0x313b8a[_0x2a32('0x66')],[_0x2a32('0x69'),'id'])||{});}})[_0x2a32('0x23')](respondWithResult(_0x4b45cb,null))[_0x2a32('0x2d')](handleError(_0x4b45cb,null));};function validateUser(_0x481725){return new Promise(function(_0x234751,_0x1d39b9){if(_0x481725[_0x2a32('0x6b')])return _0x234751(_0x481725);return db['Setting'][_0x2a32('0x6c')](0x1)[_0x2a32('0x23')](function(_0x65f8a3){if(_0x65f8a3[_0x2a32('0x6d')])authService[_0x2a32('0x6e')](_0x481725[_0x2a32('0x46')]);db[_0x2a32('0x42')][_0x2a32('0x6f')](_0x2a32('0x6b'))[_0x2a32('0x23')](function(_0x33d5f2){if(_['isNil'](_0x33d5f2)){_0x481725[_0x2a32('0x6b')]=_0x65f8a3[_0x2a32('0x70')]||0x1;return;}if(_['isNil'](_0x65f8a3[_0x2a32('0x70')])||_0x65f8a3['min_internal']===_0x33d5f2){_0x481725['internal']=_0x33d5f2+0x1;return;}if(_0x65f8a3['min_internal']>_0x33d5f2){_0x481725['internal']=_0x65f8a3[_0x2a32('0x70')];return;}return db['sequelize'][_0x2a32('0x4e')](_0x2a32('0x71'),{'type':db[_0x2a32('0x72')][_0x2a32('0x73')]['SELECT']})[_0x2a32('0x23')](function(_0x398613){if(_0x398613&&_0x398613[_0x2a32('0x59')]){for(var _0x548bde=0x0,_0x4a68c9=_0x398613[_0x2a32('0x59')];_0x548bde<_0x4a68c9&&_['isNil'](_0x481725[_0x2a32('0x6b')]);_0x548bde++){if(_0x65f8a3[_0x2a32('0x70')]<=_0x398613[_0x548bde]['from']){_0x481725[_0x2a32('0x6b')]=_0x398613[_0x548bde]['from'];}else if(_0x65f8a3[_0x2a32('0x70')]>_0x398613[_0x548bde][_0x2a32('0x74')]&&_0x65f8a3['min_internal']<=_0x398613[_0x548bde]['to']){_0x481725[_0x2a32('0x6b')]=_0x65f8a3['min_internal'];}}}if(_[_0x2a32('0x75')](_0x481725['internal'])){_0x481725[_0x2a32('0x6b')]=_0x33d5f2+0x1;}return _0x234751(_0x481725);});});})[_0x2a32('0x2d')](function(_0x48bf03){_0x1d39b9(_0x48bf03);});});}function updateUser(_0x2887a4){return new Promise(function(_0xc9fe9c,_0x102755){try{if(_0x2887a4[_0x2a32('0x76')]){_0x2887a4[_0x2a32('0x77')]=_0x2887a4['internal'];_0x2887a4[_0x2a32('0x78')]={'mailbox':_0x2887a4[_0x2a32('0x6b')],'password':_0x2887a4['password'],'fullname':_0x2887a4['fullname'],'email':_0x2887a4['email']};}if(_0x2887a4[_0x2a32('0x3d')]===_0x2a32('0x2f')){if(!_0x2887a4[_0x2a32('0x79')])_0x2887a4[_0x2a32('0x79')]=[_0x2a32('0x7a'),_0x2a32('0x7b'),'103',_0x2a32('0x7c'),_0x2a32('0x7d'),'104',_0x2a32('0x7e'),_0x2a32('0x7f'),_0x2a32('0x80'),'108',_0x2a32('0x81'),_0x2a32('0x82'),'111',_0x2a32('0x83'),_0x2a32('0x84')];}_0xc9fe9c(_0x2887a4);}catch(_0x194150){_0x102755(_0x194150);}});}exports[_0x2a32('0x85')]=function(_0x2686c2,_0x36fe54){if(_0x2686c2[_0x2a32('0x35')][_0x2a32('0x3d')]===_0x2a32('0x2f'))throw new Error('Unauthorized');if(_0x2686c2[_0x2a32('0x66')][_0x2a32('0x3d')]===_0x2a32('0x35')&&_0x2686c2[_0x2a32('0x35')][_0x2a32('0x3d')]!==_0x2a32('0x33')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x2686c2[_0x2a32('0x66')][_0x2a32('0x3d')]===_0x2a32('0x33')&&_0x2686c2[_0x2a32('0x35')][_0x2a32('0x3d')]!==_0x2a32('0x33')){throw new Error(_0x2a32('0x86'));}return licenseUtil[_0x2a32('0x87')]([_0x2686c2[_0x2a32('0x66')]])['then'](function(){return validateUser(_0x2686c2['body']);})[_0x2a32('0x23')](function(_0x4da0b0){return updateUser(_0x4da0b0)[_0x2a32('0x23')](function(_0x3d5db9){if(_0x3d5db9[_0x2a32('0x3d')]==='admin'){_0x3d5db9['settingsEnabled']=_0x2686c2[_0x2a32('0x35')][_0x2a32('0x88')];delete _0x3d5db9[_0x2a32('0x89')];}return _0x3d5db9;});})['then'](function(_0x5623c0){return db[_0x2a32('0x42')]['create'](_0x5623c0,{'include':[{'model':db[_0x2a32('0x78')],'as':_0x2a32('0x78')}]});})[_0x2a32('0x23')](function(_0x545c50){if(_0x2686c2[_0x2a32('0x66')][_0x2a32('0x3d')]===_0x2a32('0x35'))return _0x545c50;if(_0x2686c2['user'][_0x2a32('0x3d')]!==_0x2a32('0x35'))return _0x545c50;return db['UserProfileSection'][_0x2a32('0x3c')]({'where':{'name':_0x545c50[_0x2a32('0x3d')]===_0x2a32('0x2f')?'Agents':_0x2a32('0x8a'),'userProfileId':_0x2686c2[_0x2a32('0x35')][_0x2a32('0x89')]},'raw':!![]})[_0x2a32('0x23')](function(_0x397d7f){if(!_0x397d7f||_0x397d7f[_0x2a32('0x8b')]!=0x0)return _0x545c50;return db['UserProfileResource'][_0x2a32('0x85')]({'name':_0x545c50[_0x2a32('0x3e')],'resourceId':_0x545c50['id'],'type':_0x397d7f[_0x2a32('0x3e')],'sectionId':_0x397d7f['id']},{})[_0x2a32('0x23')](function(){return _0x545c50;});})[_0x2a32('0x2d')](function(_0x25b246){logger[_0x2a32('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25b246);throw _0x25b246;});})[_0x2a32('0x23')](respondWithResult(_0x36fe54,0xc9))[_0x2a32('0x2d')](handleError(_0x36fe54,null));};exports[_0x2a32('0x8c')]=function(_0x482f2d,_0x4e0eb7){var _0x4e46bf=_0x482f2d[_0x2a32('0x66')];var _0xbe4421=[];if(_0x482f2d[_0x2a32('0x35')]['role']===_0x2a32('0x2f'))throw new Error(_0x2a32('0x8d'));if(_[_0x2a32('0x8e')](_0x4e46bf,['role',_0x2a32('0x35')])&&_0x482f2d[_0x2a32('0x35')][_0x2a32('0x3d')]!==_0x2a32('0x33')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x2a32('0x8e')](_0x4e46bf,[_0x2a32('0x3d'),_0x2a32('0x33')])&&_0x482f2d[_0x2a32('0x35')][_0x2a32('0x3d')]!==_0x2a32('0x33')){throw new Error(_0x2a32('0x8f'));}return licenseUtil['checkUserLimits'](_0x4e46bf)[_0x2a32('0x23')](function(){return validateUser(_0x4e46bf[0x0]);})['then'](function(){for(var _0x54802c=0x1;_0x54802c<_0x4e46bf[_0x2a32('0x59')];_0x54802c++){var _0x3ba732=_0x4e46bf[_0x54802c-0x1][_0x2a32('0x6b')];if(!_0x4e46bf[_0x54802c][_0x2a32('0x6b')])_0x4e46bf[_0x54802c][_0x2a32('0x6b')]=_0x3ba732+0x1;_0xbe4421[_0x2a32('0x55')](validateUser(_0x4e46bf[_0x54802c]));}return Promise[_0x2a32('0x5f')](_0xbe4421);})['then'](function(){_0xbe4421=[];for(var _0x5259e9=0x0;_0x5259e9<_0x4e46bf[_0x2a32('0x59')];_0x5259e9++){_0xbe4421[_0x2a32('0x55')](updateUser(_0x4e46bf[_0x5259e9]));}return Promise['all'](_0xbe4421);})[_0x2a32('0x23')](function(){_0xbe4421=_0x4e46bf[_0x2a32('0x39')](function(_0x163475){return db[_0x2a32('0x42')][_0x2a32('0x85')](_0x163475,{'include':[{'model':db[_0x2a32('0x78')],'as':_0x2a32('0x78')}]})[_0x2a32('0x23')](function(_0x175d1c){_0x163475['id']=_0x175d1c['id'];return _0x163475;});});return Promise[_0x2a32('0x5f')](_0xbe4421);})[_0x2a32('0x23')](function(_0x2b349d){if(_0x482f2d[_0x2a32('0x66')]['role']===_0x2a32('0x35'))return _0x2b349d;if(_0x482f2d[_0x2a32('0x35')][_0x2a32('0x3d')]!==_0x2a32('0x35'))return _0x2b349d;var _0x216af2=_[_0x2a32('0x8e')](_0x2b349d,function(_0x1254f8){return _0x1254f8[_0x2a32('0x3d')]===_0x2a32('0x2f')||_0x1254f8[_0x2a32('0x3d')]===_0x2a32('0x90');});if(!_0x216af2)return _0x2b349d;return db[_0x2a32('0x91')][_0x2a32('0x56')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x482f2d[_0x2a32('0x35')][_0x2a32('0x89')]},'raw':!![]})[_0x2a32('0x23')](function(_0x2e96bd){if(_[_0x2a32('0x92')](_0x2e96bd)||!_[_0x2a32('0x8e')](_0x2e96bd,[_0x2a32('0x8b'),0x0]))return _0x2b349d;_0xbe4421=[];var _0x26b82b=_(_0x2e96bd)['map'](function(_0x405813){if(_0x405813['autoAssociation']===0x1)return;return _0x405813[_0x2a32('0x3e')]===_0x2a32('0x36')?'agent':'telephone';})[_0x2a32('0x93')]()[_0x2a32('0x3a')]();for(var _0x46d921=0x0;_0x46d921<_0x2b349d[_0x2a32('0x59')];_0x46d921++){if(!_[_0x2a32('0x3b')](_0x26b82b,_0x2b349d[_0x46d921][_0x2a32('0x3d')]))return;var _0x59cef5=_0x2b349d[_0x46d921][_0x2a32('0x3d')]==='agent'?_0x2a32('0x36'):_0x2a32('0x8a');_0xbe4421[_0x2a32('0x55')](db[_0x2a32('0x3f')][_0x2a32('0x85')]({'name':_0x2b349d[_0x46d921][_0x2a32('0x3e')],'resourceId':_0x2b349d[_0x46d921]['id'],'type':_0x59cef5,'sectionId':_['find'](_0x2e96bd,[_0x2a32('0x3e'),_0x59cef5])['id']},{}));}return Promise[_0x2a32('0x5f')](_0xbe4421);});})[_0x2a32('0x23')](respondWithResult(_0x4e0eb7,0xc9))['catch'](handleError(_0x4e0eb7,null));};exports[_0x2a32('0x94')]=function(_0x21ea72,_0xaaafc2){if(_0x21ea72['body']['id']){delete _0x21ea72[_0x2a32('0x66')]['id'];}return db['User'][_0x2a32('0x3c')]({'where':{'id':_0x21ea72[_0x2a32('0x61')]['id']}})['then'](function(_0x4ad7e3){if(!_0x4ad7e3)return null;if(_0x4ad7e3['id']===_0x21ea72[_0x2a32('0x35')]['id']){if(!_0x21ea72[_0x2a32('0x66')][_0x2a32('0x95')]||!_0x21ea72[_0x2a32('0x66')][_0x2a32('0x96')]){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0x99'));}if(!_0x4ad7e3['authenticate'](_0x21ea72[_0x2a32('0x66')][_0x2a32('0x95')])){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0x9a'));}if(_0x21ea72['body'][_0x2a32('0x95')]===_0x21ea72[_0x2a32('0x66')][_0x2a32('0x96')]){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0x9b'));}}else if(_0x21ea72[_0x2a32('0x35')][_0x2a32('0x3d')]===_0x2a32('0x33')){if(!_0x21ea72[_0x2a32('0x66')][_0x2a32('0x96')]){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x21ea72[_0x2a32('0x35')][_0x2a32('0x3d')]===_0x2a32('0x35')){if(!_0x21ea72[_0x2a32('0x66')][_0x2a32('0x96')]){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0x9c'));}if(_0x4ad7e3[_0x2a32('0x3d')]!=='agent'){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))]('Unauthorized');}}else{throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0x8d'));}return _0x4ad7e3;})[_0x2a32('0x23')](handleEntityNotFound(_0xaaafc2,null))[_0x2a32('0x23')](function(_0x44d439){return db[_0x2a32('0x9d')][_0x2a32('0x9e')]({'attributes':['id',_0x2a32('0x6d'),_0x2a32('0x9f'),_0x2a32('0xa0')]})[_0x2a32('0x23')](function(_0x1157cd){if(_0x1157cd[_0x2a32('0x6d')])authService[_0x2a32('0x6e')](_0x21ea72[_0x2a32('0x66')][_0x2a32('0x96')]);if(!_0x1157cd[_0x2a32('0x9f')]||!_0x44d439[_0x2a32('0xa1')])return _0x44d439;authService['validatePasswordHistory'](_0x21ea72[_0x2a32('0x66')]['newPassword'],_0x44d439['previousPasswords'],_0x1157cd[_0x2a32('0xa0')]);return _0x44d439;})['then'](saveUpdates({'password':_0x21ea72['body'][_0x2a32('0x96')],'passwordResetAt':_0x21ea72[_0x2a32('0x35')]['id']==_0x21ea72['params']['id']?moment():null,'previousPasswords':authService[_0x2a32('0xa2')](_0x21ea72['body']['newPassword'],_0x44d439[_0x2a32('0xa1')])},null));})[_0x2a32('0x23')](respondWithResult(_0xaaafc2,null))[_0x2a32('0x2d')](handleError(_0xaaafc2,null));};exports[_0x2a32('0xa3')]=function(_0x44bb48,_0x4f40b6){var _0x4c1b79=_0x44bb48[_0x2a32('0x66')]['channel'];return db['User']['find']({'where':{'id':_0x44bb48[_0x2a32('0x61')]['id']},'attributes':['id',_0x2a32('0x3e'),_0x2a32('0x3d'),'online',_0x2a32('0xa4'),'voicePause',_0x2a32('0xa5')]})[_0x2a32('0x23')](handleEntityNotFound(_0x4f40b6,null))['then'](function(_0x1f1a09){if(_0x1f1a09){if(!utils[_0x2a32('0xa6')](_0x4c1b79)){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0xa7'));}return _0x1f1a09[_0x2a32('0xa8')+_[_0x2a32('0xa9')](_0x4c1b79[_0x2a32('0xaa')]())+_0x2a32('0xab')](_0x44bb48['body'][_0x2a32('0x69')],{'penalty':_0x44bb48[_0x2a32('0x66')][_0x2a32('0xac')]||0x0})['spread'](function(_0x5e9c0f){for(var _0x34b7eb=0x0;_0x34b7eb<_0x44bb48[_0x2a32('0x66')][_0x2a32('0x69')][_0x2a32('0x59')];_0x34b7eb+=0x1){var _0x3e8fc9={'UserId':Number(_0x44bb48[_0x2a32('0x61')]['id'])};_0x3e8fc9[_[_0x2a32('0xa9')](_0x4c1b79[_0x2a32('0xaa')]())+_0x2a32('0xad')]=Number(_0x44bb48['body']['ids'][_0x34b7eb]);socket[_0x2a32('0x30')](_0x2a32('0x35')+_[_0x2a32('0xa9')](_0x4c1b79[_0x2a32('0xaa')]())+_0x2a32('0xae'),_0x3e8fc9);}return _0x5e9c0f;})[_0x2a32('0x23')](function(){if(_0x4c1b79==='voice'){return db[_0x2a32('0xaf')][_0x2a32('0x56')]({'where':{'id':_0x44bb48[_0x2a32('0x66')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x2a32('0x23')](function(_0x19756b){var _0x1737b6=_0x1f1a09['get']({'plain':!![]});var _0x239b03=[];if(_0x4c1b79===_0x2a32('0xb0')&&_0x1737b6[_0x2a32('0x3d')]===_0x2a32('0x2f')&&_0x1737b6[_0x2a32('0xb1')]){for(let _0x2adfed=0x0;_0x2adfed<_0x19756b['length'];_0x2adfed+=0x1){_0x239b03[_0x2a32('0x55')]({'membername':_0x1737b6[_0x2a32('0x3e')],'UserId':_0x1737b6['id'],'queue_name':_0x19756b[_0x2adfed][_0x2a32('0x3e')],'VoiceQueueId':_0x19756b[_0x2adfed]['id'],'interface':_[_0x2a32('0x75')](_0x1737b6['interface'])?util['format'](_0x2a32('0xb2'),_0x1737b6[_0x2a32('0x3e')]):_0x1737b6[_0x2a32('0xa5')],'paused':_0x1737b6[_0x2a32('0xb3')]||![],'penalty':_0x44bb48[_0x2a32('0x66')][_0x2a32('0xac')]||0x0});}return Promise[_0x2a32('0x5f')](_0x239b03[_0x2a32('0x39')](function(_0x4d7988){return db['UserVoiceQueueRt'][_0x2a32('0xb4')](_0x4d7988);}));}return _0x1f1a09;});}})['then'](respondWithStatusCode(_0x4f40b6,null))[_0x2a32('0x2d')](handleError(_0x4f40b6,null));};exports[_0x2a32('0xb5')]=function(_0x1ae789,_0x5785cd){var _0x367a84,_0x56ee84;return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0x1ae789[_0x2a32('0x61')]['id']},'attributes':['id',_0x2a32('0x3e'),_0x2a32('0x3d')]})[_0x2a32('0x23')](handleEntityNotFound(_0x5785cd,null))[_0x2a32('0x23')](function(_0xe0b61d){if(_0xe0b61d){_0x367a84=_0xe0b61d;if(!_0x1ae789[_0x2a32('0x4e')][_0x2a32('0xb6')]||!utils['isValidChannel'](_0x1ae789[_0x2a32('0x4e')][_0x2a32('0xb6')])){throw new db['Sequelize'][(_0x2a32('0x98'))](_0x2a32('0xa7'));}return _0xe0b61d['remove'+_['capitalize'](_0x1ae789[_0x2a32('0x4e')][_0x2a32('0xb6')][_0x2a32('0xaa')]())+_0x2a32('0xab')](_0x1ae789[_0x2a32('0x4e')]['ids']);}})['then'](function(_0x5aa916){if(_['isArray'](_0x1ae789[_0x2a32('0x4e')][_0x2a32('0x69')])){for(var _0x246eda=0x0;_0x246eda<_0x1ae789[_0x2a32('0x4e')][_0x2a32('0x69')]['length'];_0x246eda+=0x1){_0x56ee84={'UserId':Number(_0x1ae789[_0x2a32('0x61')]['id'])};_0x56ee84[_['capitalize'](_0x1ae789[_0x2a32('0x4e')]['channel']['toLowerCase']())+_0x2a32('0xad')]=Number(_0x1ae789[_0x2a32('0x4e')]['ids'][_0x246eda]);socket[_0x2a32('0x30')](_0x2a32('0x35')+_[_0x2a32('0xa9')](_0x1ae789[_0x2a32('0x4e')][_0x2a32('0xb6')]['toLowerCase']())+'Queue:remove',_0x56ee84);}}else{_0x56ee84={'UserId':Number(_0x1ae789[_0x2a32('0x61')]['id'])};_0x56ee84[_[_0x2a32('0xa9')](_0x1ae789[_0x2a32('0x4e')][_0x2a32('0xb6')][_0x2a32('0xaa')]())+_0x2a32('0xad')]=Number(_0x1ae789[_0x2a32('0x4e')]['ids']);socket[_0x2a32('0x30')](_0x2a32('0x35')+_[_0x2a32('0xa9')](_0x1ae789['query'][_0x2a32('0xb6')][_0x2a32('0xaa')]())+_0x2a32('0xb7'),_0x56ee84);}return _0x5aa916;})[_0x2a32('0x23')](function(){if(_0x1ae789['query'][_0x2a32('0xb6')]===_0x2a32('0xb0')){return db['UserVoiceQueueRt'][_0x2a32('0xb8')]({'where':{'UserId':_0x1ae789[_0x2a32('0x61')]['id'],'VoiceQueueId':_0x1ae789[_0x2a32('0x4e')][_0x2a32('0x69')]},'individualHooks':!![]})['then'](function(){return _0x367a84;});}return _0x367a84;})['then'](respondWithStatusCode(_0x5785cd,null))[_0x2a32('0x2d')](handleError(_0x5785cd,null));};exports[_0x2a32('0xb9')]=function(_0xced8c2,_0x4bc3ef){_0xced8c2['body'][_0x2a32('0xba')]=_0xced8c2[_0x2a32('0xbb')][_0x2a32('0xbc')];return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0xced8c2[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x4bc3ef,null))[_0x2a32('0x23')](saveUpdates(_0xced8c2[_0x2a32('0x66')],null))['then'](respondWithResult(_0x4bc3ef,null))[_0x2a32('0x2d')](handleError(_0x4bc3ef,null));};exports[_0x2a32('0xbd')]=function(_0x219790,_0x23341c){var _0x2b698f=path[_0x2a32('0xbe')](config['root'],_0x2a32('0xbf'));return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0x219790['params']['id']},'attributes':['id',_0x2a32('0xba')],'raw':!![]})[_0x2a32('0x23')](handleEntityNotFound(_0x23341c,null))[_0x2a32('0x23')](function(_0x34b778){if(_0x34b778){if(_[_0x2a32('0x75')](_0x34b778[_0x2a32('0xba')])){return _0x23341c['download'](_0x2b698f);}else{if(!fs[_0x2a32('0xc0')](path[_0x2a32('0xbe')](config[_0x2a32('0xc1')],_0x2a32('0xc2'),_0x34b778['userpic']))){return _0x23341c['download'](_0x2b698f);}return _0x23341c[_0x2a32('0xc3')](path[_0x2a32('0xbe')](config['root'],_0x2a32('0xc2'),_0x34b778['userpic']));}}})[_0x2a32('0x2d')](handleError(_0x23341c,null));};exports[_0x2a32('0xc4')]=function(_0xbf882f,_0x1e7650){return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0xbf882f['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1e7650,null))[_0x2a32('0x23')](function(_0x3c6251){var _0x41c555=[];values=_0x3c6251[_0x2a32('0x5c')];_0x41c555[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5a'),_0x3c6251[_0x2a32('0x5c')]));_0x41c555['push'](get_open_tabs('sms',_0x3c6251[_0x2a32('0x5c')]));_0x41c555[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5e'),_0x3c6251[_0x2a32('0x5c')]));_0x41c555['push'](get_open_tabs(_0x2a32('0x64'),_0x3c6251['dataValues']));_0x41c555[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x65'),_0x3c6251[_0x2a32('0x5c')]));_0x41c555['push'](get_open_tabs(_0x2a32('0x5d'),_0x3c6251['dataValues']));return Promise['all'](_0x41c555);})['then'](function(_0x1f24c0){if(_0x1f24c0){var _0xeb2928=_[_0x2a32('0x39')](values[_0x2a32('0xc5')],function(_0x4b0f6e){return{'channel':_0x2a32('0xc6'),'id':_0x4b0f6e['id'],'createdAt':_0x4b0f6e[_0x2a32('0xc7')]};});var _0x5b026c=_[_0x2a32('0x39')](values[_0x2a32('0xc8')],function(_0x289420){return{'channel':_0x2a32('0xc9'),'id':_0x289420['id'],'createdAt':_0x289420['createdAt']};});var _0x318c24=_['map'](values[_0x2a32('0xca')],function(_0x39f32b){return{'channel':_0x2a32('0xcb'),'id':_0x39f32b['id'],'createdAt':_0x39f32b[_0x2a32('0xc7')]};});var _0x34c014=_[_0x2a32('0x39')](values['MailOpenTabs'],function(_0x32db43){return{'channel':_0x2a32('0xcc'),'id':_0x32db43['id'],'createdAt':_0x32db43[_0x2a32('0xc7')]};});var _0x1da0ec=_[_0x2a32('0x39')](values[_0x2a32('0xcd')],function(_0x1e8816){return{'channel':_0x2a32('0xce'),'id':_0x1e8816['id'],'createdAt':_0x1e8816['createdAt']};});var _0x52a3b3=_[_0x2a32('0x39')](values[_0x2a32('0xcf')],function(_0x573b65){return{'channel':'WHATSAPP','id':_0x573b65['id'],'createdAt':_0x573b65[_0x2a32('0xc7')]};});var _0x4fef2f=_[_0x2a32('0xd0')](_0xeb2928,_0x5b026c,_0x318c24,_0x34c014,_0x1da0ec,_0x52a3b3);var _0x1caadd={'count':_0x4fef2f[_0x2a32('0x59')],'rows':_0x4fef2f};return _0x1caadd;}else return null;})['then'](respondWithResult(_0x1e7650,null))[_0x2a32('0x2d')](handleError(_0x1e7650,null));};exports[_0x2a32('0xd1')]=function(_0x12b309,_0x3ba39d){var _0xcc6be5={};return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x12b309[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](function(_0x31e9ec){if(!_0x31e9ec){throw new APINotFoundError(util['format'](_0x2a32('0xd2'),_0x12b309[_0x2a32('0x61')]['id']));}return contacts['describe']();})[_0x2a32('0x23')](function(_0x2ec78f){_0x12b309[_0x2a32('0x4e')][_0x2a32('0x42')]=_0x12b309[_0x2a32('0x61')]['id'];_0xcc6be5=qs[_0x2a32('0x4c')](_0x2ec78f,_0x12b309);if(_0x12b309[_0x2a32('0x4e')][_0x2a32('0xd3')]('includeAll')){_0xcc6be5['include']=[{'model':db[_0x2a32('0xd4')],'as':'List','required':![]},{'model':db[_0x2a32('0xd5')],'as':_0x2a32('0xd6'),'attributes':['id','name',_0x2a32('0xd7')],'where':_0x12b309[_0x2a32('0x4e')][_0x2a32('0xd8')]?{'id':_0x12b309[_0x2a32('0x4e')][_0x2a32('0xd8')]}:undefined,'required':_0x12b309[_0x2a32('0x4e')][_0x2a32('0xd8')]?!![]:![]}];}return contacts[_0x2a32('0x56')](_0x12b309['query'],_0x12b309[_0x2a32('0x35')],_0xcc6be5,_0x2ec78f);})['then'](respondWithFilteredResult(_0x3ba39d,_0xcc6be5))[_0x2a32('0x2d')](APIHandleError(_0x3ba39d));};exports['getQueues']=function(_0x1d5359,_0x562d2b){var _0x3c917a;var _0x3ed01e={};var _0x550a29;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x1d5359['params']['id']},'attributes':['id',_0x2a32('0x3e'),_0x2a32('0x3d')]})['then'](handleEntityNotFound(_0x562d2b,null))[_0x2a32('0x23')](function(_0x23b3a5){if(!utils[_0x2a32('0xa6')](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xb6')])){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))]('Unknown\x20channel');}_0x3c917a=_0x23b3a5;var _0x35b8b5={};_0x35b8b5[_0x2a32('0xd9')]=_['keys'](db[_[_0x2a32('0xa9')](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xb6')])+_0x2a32('0xda')][_0x2a32('0x43')]);_0x35b8b5[_0x2a32('0x4e')]=_['keys'](_0x1d5359[_0x2a32('0x4e')]);_0x35b8b5[_0x2a32('0xdb')]=_['intersection'](_0x35b8b5[_0x2a32('0xd9')],_0x35b8b5[_0x2a32('0x4e')]);_0x3ed01e[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x35b8b5[_0x2a32('0xd9')],qs['fields'](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x3ed01e[_0x2a32('0x54')]=_0x3ed01e[_0x2a32('0x54')][_0x2a32('0x59')]?_0x3ed01e[_0x2a32('0x54')]:_0x35b8b5[_0x2a32('0xd9')];_0x3ed01e[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x3ed01e['where']=qs['filters'](_[_0x2a32('0xe0')](_0x1d5359[_0x2a32('0x4e')],_0x35b8b5[_0x2a32('0xdb')]));if(_0x1d5359[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x3ed01e[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x3ed01e[_0x2a32('0x4d')],{'$or':_['map'](_0x3ed01e['attributes'],function(_0x1e2e58){var _0x59cda0={};_0x59cda0[_0x1e2e58]={'$like':'%'+_0x1d5359[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x59cda0;})});}_0x3ed01e=_[_0x2a32('0x62')]({},_0x3ed01e,_0x1d5359[_0x2a32('0x63')]);switch(_0x3c917a[_0x2a32('0x3d')]){case _0x2a32('0x33'):return db[_[_0x2a32('0xa9')](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xb6')])+_0x2a32('0xda')][_0x2a32('0x56')](_0x3ed01e);case'user':case _0x2a32('0x2f'):return _0x3c917a[_0x2a32('0x32')+_[_0x2a32('0xa9')](_0x1d5359[_0x2a32('0x4e')]['channel'])+_0x2a32('0xab')](_0x3ed01e);default:throw new db['Sequelize'][(_0x2a32('0x98'))](_0x2a32('0xe1'));}})[_0x2a32('0x23')](function(_0x15115c){_0x550a29=_0x15115c[_0x2a32('0x59')];if(!_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x3ed01e[_0x2a32('0x1e')]=qs['limit'](_0x1d5359[_0x2a32('0x4e')]['limit']);_0x3ed01e[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0x20')]);}switch(_0x3c917a[_0x2a32('0x3d')]){case _0x2a32('0x33'):return db[_['capitalize'](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xb6')])+_0x2a32('0xda')][_0x2a32('0x56')](_0x3ed01e);case _0x2a32('0x35'):case _0x2a32('0x2f'):return _0x3c917a['get'+_[_0x2a32('0xa9')](_0x1d5359[_0x2a32('0x4e')]['channel'])+_0x2a32('0xab')](_0x3ed01e);}})['then'](function(_0x45c206){return{'count':_0x550a29,'rows':_0x45c206};})[_0x2a32('0x23')](respondWithResult(_0x562d2b,null))[_0x2a32('0x2d')](handleError(_0x562d2b,null));};exports['getVoiceQueuesRt']=function(_0x5515af,_0xb3007f){var _0x1640c0={};var _0x17dc71={};var _0x4fd0d6;var _0x1a62d8;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x5515af[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0xb3007f,null))[_0x2a32('0x23')](function(_0xf6702){if(_0xf6702){_0x4fd0d6=_0xf6702;_0x17dc71[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xe4')][_0x2a32('0x43')]);_0x17dc71['query']=_['keys'](_0x5515af['query']);_0x17dc71[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x17dc71[_0x2a32('0xd9')],_0x17dc71[_0x2a32('0x4e')]);_0x1640c0[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x17dc71[_0x2a32('0xd9')],qs['fields'](_0x5515af[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x1640c0[_0x2a32('0x54')]=_0x1640c0[_0x2a32('0x54')]['length']?_0x1640c0[_0x2a32('0x54')]:_0x17dc71[_0x2a32('0xd9')];_0x1640c0[_0x2a32('0xde')]=qs['sort'](_0x5515af['query'][_0x2a32('0xdf')]);_0x1640c0[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x5515af[_0x2a32('0x4e')],_0x17dc71[_0x2a32('0xdb')]));if(_0x5515af[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x1640c0[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x1640c0['where'],{'$or':_[_0x2a32('0x39')](_0x1640c0[_0x2a32('0x54')],function(_0x3aa7ce){var _0x2139bb={};_0x2139bb[_0x3aa7ce]={'$like':'%'+_0x5515af[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x2139bb;})});}_0x1640c0=_['merge']({},_0x1640c0,_0x5515af[_0x2a32('0x63')]);return _0x4fd0d6['getVoiceQueuesRt'](_0x1640c0);}})[_0x2a32('0x23')](function(_0x38608){if(_0x38608){_0x1a62d8=_0x38608[_0x2a32('0x59')];if(!_0x5515af['query'][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x1640c0[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x5515af[_0x2a32('0x4e')]['limit']);_0x1640c0[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x5515af['query']['offset']);}return _0x4fd0d6[_0x2a32('0xe5')](_0x1640c0);}})[_0x2a32('0x23')](function(_0x4bf8b0){if(_0x4bf8b0){return _0x4bf8b0?{'count':_0x1a62d8,'rows':_0x4bf8b0}:null;}})[_0x2a32('0x23')](respondWithResult(_0xb3007f,null))[_0x2a32('0x2d')](handleError(_0xb3007f,null));};exports[_0x2a32('0xe6')]=function(_0x280b24,_0x1689d7){var _0x23a17c={};var _0x1d6562={};var _0x2147a2;var _0x58f1b0;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x280b24['params']['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x1689d7,null))['then'](function(_0x48ab91){if(_0x48ab91){_0x2147a2=_0x48ab91;_0x1d6562[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db['ChatGroup']['rawAttributes']);_0x1d6562[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0x280b24['query']);_0x1d6562[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x1d6562[_0x2a32('0xd9')],_0x1d6562['query']);_0x23a17c[_0x2a32('0x54')]=_['intersection'](_0x1d6562[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x280b24['query'][_0x2a32('0xdd')]));_0x23a17c[_0x2a32('0x54')]=_0x23a17c['attributes']['length']?_0x23a17c[_0x2a32('0x54')]:_0x1d6562['model'];_0x23a17c['order']=qs[_0x2a32('0xdf')](_0x280b24[_0x2a32('0x4e')]['sort']);_0x23a17c[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_['pick'](_0x280b24[_0x2a32('0x4e')],_0x1d6562[_0x2a32('0xdb')]));if(_0x280b24[_0x2a32('0x4e')]['filter']){_0x23a17c['where']=_[_0x2a32('0x62')](_0x23a17c[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x23a17c[_0x2a32('0x54')],function(_0x188c44){var _0x253577={};_0x253577[_0x188c44]={'$like':'%'+_0x280b24[_0x2a32('0x4e')]['filter']+'%'};return _0x253577;})});}_0x23a17c=_[_0x2a32('0x62')]({},_0x23a17c,_0x280b24[_0x2a32('0x63')]);return _0x2147a2['getGroups'](_0x23a17c);}})[_0x2a32('0x23')](function(_0x3495ca){if(_0x3495ca){_0x58f1b0=_0x3495ca[_0x2a32('0x59')];if(!_0x280b24[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x23a17c[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x280b24[_0x2a32('0x4e')][_0x2a32('0x1e')]);_0x23a17c[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x280b24[_0x2a32('0x4e')]['offset']);}return _0x2147a2[_0x2a32('0xe6')](_0x23a17c);}})[_0x2a32('0x23')](function(_0x1a1cd3){if(_0x1a1cd3){return _0x1a1cd3?{'count':_0x58f1b0,'rows':_0x1a1cd3}:null;}})[_0x2a32('0x23')](respondWithResult(_0x1689d7,null))[_0x2a32('0x2d')](handleError(_0x1689d7,null));};exports['getRecordings']=function(_0xe45bde,_0x15279e){var _0x10e9da={'raw':!![],'where':{}};var _0x50fa85={};var _0x3280ea={'count':0x0,'rows':[]};return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0xe45bde[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x15279e,null))[_0x2a32('0x23')](function(_0x1bb5d0){if(_0x1bb5d0){_0x50fa85['model']=_[_0x2a32('0xe3')](db['VoiceRecording'][_0x2a32('0x43')]);_0x50fa85[_0x2a32('0x4e')]=_['keys'](_0xe45bde[_0x2a32('0x4e')]);_0x50fa85['filters']=_[_0x2a32('0xdc')](_0x50fa85['model'],_0x50fa85[_0x2a32('0x4e')]);_0x10e9da[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x50fa85[_0x2a32('0xd9')],qs['fields'](_0xe45bde['query'][_0x2a32('0xdd')]));_0x10e9da['attributes']=_0x10e9da[_0x2a32('0x54')][_0x2a32('0x59')]?_0x10e9da['attributes']:_0x50fa85[_0x2a32('0xd9')];if(!_0xe45bde[_0x2a32('0x4e')][_0x2a32('0xd3')]('nolimit')){_0x10e9da[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0xe45bde[_0x2a32('0x4e')]['limit']);_0x10e9da[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0xe45bde[_0x2a32('0x4e')][_0x2a32('0x20')]);}_0x10e9da[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0xe45bde[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x10e9da[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0xe45bde[_0x2a32('0x4e')],_0x50fa85[_0x2a32('0xdb')]));_0x10e9da['where'][_0x2a32('0xe7')]=_0x1bb5d0['id'];if(_0xe45bde[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x10e9da[_0x2a32('0x4d')]=_['merge'](_0x10e9da[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x10e9da[_0x2a32('0x54')],function(_0x2573b1){var _0x2add8c={};_0x2add8c[_0x2573b1]={'$like':'%'+_0xe45bde['query'][_0x2a32('0x37')]+'%'};return _0x2add8c;})});}_0x10e9da=_[_0x2a32('0x62')]({},_0x10e9da,_0xe45bde[_0x2a32('0x63')]);return db['VoiceRecording']['count']({'where':_0x10e9da[_0x2a32('0x4d')]})[_0x2a32('0x23')](function(_0x18f741){_0x3280ea['count']=_0x18f741;if(_0xe45bde[_0x2a32('0x4e')]['includeAll']){_0x10e9da[_0x2a32('0x52')]=[{'all':!![]}];}return db[_0x2a32('0xe8')][_0x2a32('0x56')](_0x10e9da);})[_0x2a32('0x23')](function(_0x2e779c){_0x3280ea['rows']=_0x2e779c;return _0x3280ea;});}})[_0x2a32('0x23')](respondWithFilteredResult(_0x15279e,_0x10e9da))[_0x2a32('0x2d')](handleError(_0x15279e,null));};exports[_0x2a32('0xe9')]=function(_0x1e3c85,_0x239bcd){var _0x500303={'raw':!![],'where':{}};var _0x306a1b={};var _0x1cfed4={'count':0x0,'rows':[]};return db[_0x2a32('0x42')]['findOne']({'where':{'id':_0x1e3c85[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x239bcd,null))[_0x2a32('0x23')](function(_0x350cc2){if(_0x350cc2){_0x306a1b[_0x2a32('0xd9')]=_['keys'](db[_0x2a32('0xea')][_0x2a32('0x43')]);_0x306a1b[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0x1e3c85[_0x2a32('0x4e')]);_0x306a1b['filters']=_[_0x2a32('0xdc')](_0x306a1b[_0x2a32('0xd9')],_0x306a1b['query']);_0x500303[_0x2a32('0x54')]=_['intersection'](_0x306a1b['model'],qs[_0x2a32('0xdd')](_0x1e3c85[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x500303[_0x2a32('0x54')]=_0x500303[_0x2a32('0x54')]['length']?_0x500303['attributes']:_0x306a1b['model'];if(!_0x1e3c85[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x500303['limit']=qs[_0x2a32('0x1e')](_0x1e3c85['query'][_0x2a32('0x1e')]);_0x500303[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x1e3c85[_0x2a32('0x4e')][_0x2a32('0x20')]);}_0x500303[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x1e3c85[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x500303[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x1e3c85['query'],_0x306a1b['filters']));_0x500303[_0x2a32('0x4d')][_0x2a32('0xe7')]=_0x350cc2['id'];if(_0x1e3c85['query'][_0x2a32('0x37')]){_0x500303['where']=_[_0x2a32('0x62')](_0x500303[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x500303['attributes'],function(_0x3c31f0){var _0x46724e={};_0x46724e[_0x3c31f0]={'$like':'%'+_0x1e3c85[_0x2a32('0x4e')]['filter']+'%'};return _0x46724e;})});}_0x500303=_['merge']({},_0x500303,_0x1e3c85[_0x2a32('0x63')]);return db[_0x2a32('0xea')][_0x2a32('0x1f')]({'where':_0x500303[_0x2a32('0x4d')]})[_0x2a32('0x23')](function(_0x1e4dcb){_0x1cfed4[_0x2a32('0x1f')]=_0x1e4dcb;if(_0x1e3c85['query']['includeAll']){_0x500303['include']=[{'all':!![]}];}return db[_0x2a32('0xea')]['findAll'](_0x500303);})[_0x2a32('0x23')](function(_0x3d1d99){_0x1cfed4['rows']=_0x3d1d99;return _0x1cfed4;});}})['then'](respondWithFilteredResult(_0x239bcd,_0x500303))[_0x2a32('0x2d')](handleError(_0x239bcd,null));};exports[_0x2a32('0xeb')]=function(_0x2bfe1e,_0x1cdca9){var _0x2fa187={};var _0x40d0b4={};var _0x224750;var _0x1ec611;return db['User']['findOne']({'where':{'id':_0x2bfe1e[_0x2a32('0x61')]['id']}})['then'](handleEntityNotFound(_0x1cdca9,null))[_0x2a32('0x23')](function(_0x5c8d8c){if(_0x5c8d8c){_0x224750=_0x5c8d8c;_0x40d0b4[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db['ChatInteraction'][_0x2a32('0x43')]);_0x40d0b4[_0x2a32('0x4e')]=_['keys'](_0x2bfe1e[_0x2a32('0x4e')]);_0x40d0b4[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x40d0b4['model'],_0x40d0b4[_0x2a32('0x4e')]);_0x2fa187[_0x2a32('0x54')]=_['intersection'](_0x40d0b4[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x2bfe1e['query']['fields']));_0x2fa187['attributes']=_0x2fa187['attributes'][_0x2a32('0x59')]?_0x2fa187['attributes']:_0x40d0b4[_0x2a32('0xd9')];_0x2fa187['order']=qs[_0x2a32('0xdf')](_0x2bfe1e['query'][_0x2a32('0xdf')]);_0x2fa187['where']=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x2bfe1e[_0x2a32('0x4e')],_0x40d0b4[_0x2a32('0xdb')]));if(_0x2bfe1e[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x2fa187[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x2fa187['where'],{'$or':_[_0x2a32('0x39')](_0x2fa187['attributes'],function(_0x598811){var _0x1b1fe9={};_0x1b1fe9[_0x598811]={'$like':'%'+_0x2bfe1e[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x1b1fe9;})});}_0x2fa187=_[_0x2a32('0x62')]({},_0x2fa187,_0x2bfe1e[_0x2a32('0x63')]);return _0x224750['getChatInteractions'](_0x2fa187);}})[_0x2a32('0x23')](function(_0x184dc8){if(_0x184dc8){_0x1ec611=_0x184dc8[_0x2a32('0x59')];if(!_0x2bfe1e[_0x2a32('0x4e')]['hasOwnProperty'](_0x2a32('0xe2'))){_0x2fa187[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x2bfe1e[_0x2a32('0x4e')][_0x2a32('0x1e')]);_0x2fa187['offset']=qs[_0x2a32('0x20')](_0x2bfe1e[_0x2a32('0x4e')]['offset']);}return _0x224750[_0x2a32('0xeb')](_0x2fa187);}})[_0x2a32('0x23')](function(_0x4d2511){if(_0x4d2511){return _0x4d2511?{'count':_0x1ec611,'rows':_0x4d2511}:null;}})[_0x2a32('0x23')](respondWithResult(_0x1cdca9,null))[_0x2a32('0x2d')](handleError(_0x1cdca9,null));};exports[_0x2a32('0xec')]=function(_0x2102b3,_0x29d5c0){var _0x288213={};var _0x24eb89={};var _0x4fc7a8;var _0x83f07b;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x2102b3['params']['id']}})['then'](handleEntityNotFound(_0x29d5c0,null))[_0x2a32('0x23')](function(_0xd9da80){if(_0xd9da80){_0x4fc7a8=_0xd9da80;_0x24eb89[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xed')]['rawAttributes']);_0x24eb89['query']=_['keys'](_0x2102b3[_0x2a32('0x4e')]);_0x24eb89[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x24eb89['model'],_0x24eb89[_0x2a32('0x4e')]);_0x288213[_0x2a32('0x54')]=_['intersection'](_0x24eb89[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x2102b3[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x288213[_0x2a32('0x54')]=_0x288213[_0x2a32('0x54')][_0x2a32('0x59')]?_0x288213['attributes']:_0x24eb89[_0x2a32('0xd9')];_0x288213[_0x2a32('0xde')]=qs['sort'](_0x2102b3['query'][_0x2a32('0xdf')]);_0x288213['where']=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x2102b3[_0x2a32('0x4e')],_0x24eb89[_0x2a32('0xdb')]));if(_0x2102b3[_0x2a32('0x4e')]['filter']){_0x288213[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x288213[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x288213[_0x2a32('0x54')],function(_0xce69b2){var _0x28921b={};_0x28921b[_0xce69b2]={'$like':'%'+_0x2102b3[_0x2a32('0x4e')]['filter']+'%'};return _0x28921b;})});}_0x288213=_['merge']({},_0x288213,_0x2102b3[_0x2a32('0x63')]);return _0x4fc7a8['getOpenchannelInteractions'](_0x288213);}})['then'](function(_0x5c6e66){if(_0x5c6e66){_0x83f07b=_0x5c6e66[_0x2a32('0x59')];if(!_0x2102b3['query']['hasOwnProperty'](_0x2a32('0xe2'))){_0x288213['limit']=qs[_0x2a32('0x1e')](_0x2102b3[_0x2a32('0x4e')]['limit']);_0x288213[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x2102b3[_0x2a32('0x4e')][_0x2a32('0x20')]);}return _0x4fc7a8[_0x2a32('0xec')](_0x288213);}})[_0x2a32('0x23')](function(_0x1695c0){if(_0x1695c0){return _0x1695c0?{'count':_0x83f07b,'rows':_0x1695c0}:null;}})[_0x2a32('0x23')](respondWithResult(_0x29d5c0,null))[_0x2a32('0x2d')](handleError(_0x29d5c0,null));};exports[_0x2a32('0xee')]=function(_0x3d626e,_0x34ce32){var _0x9df5a9={'raw':!![],'where':{}};var _0x396647={};var _0x53f8a6={'count':0x0,'rows':[]};return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x3d626e[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x34ce32,null))[_0x2a32('0x23')](function(_0x5d9323){if(_0x5d9323){_0x396647[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xef')][_0x2a32('0x43')]);_0x396647[_0x2a32('0x4e')]=_['keys'](_0x3d626e[_0x2a32('0x4e')]);_0x396647[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x396647[_0x2a32('0xd9')],_0x396647[_0x2a32('0x4e')]);_0x9df5a9[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x396647[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x3d626e[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x9df5a9[_0x2a32('0x54')]=_0x9df5a9['attributes'][_0x2a32('0x59')]?_0x9df5a9['attributes']:_0x396647[_0x2a32('0xd9')];if(!_0x3d626e[_0x2a32('0x4e')]['hasOwnProperty'](_0x2a32('0xe2'))){_0x9df5a9[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x3d626e[_0x2a32('0x4e')][_0x2a32('0x1e')]);_0x9df5a9[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x3d626e[_0x2a32('0x4e')][_0x2a32('0x20')]);}_0x9df5a9[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x3d626e[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x9df5a9[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x3d626e[_0x2a32('0x4e')],_0x396647[_0x2a32('0xdb')]));_0x9df5a9[_0x2a32('0x4d')][_0x2a32('0xe7')]=_0x5d9323['id'];if(_0x3d626e[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x9df5a9['where']=_['merge'](_0x9df5a9[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x9df5a9[_0x2a32('0x54')],function(_0x522bf1){var _0x2bec62={};_0x2bec62[_0x522bf1]={'$like':'%'+_0x3d626e[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x2bec62;})});}_0x9df5a9=_[_0x2a32('0x62')]({},_0x9df5a9,_0x3d626e[_0x2a32('0x63')]);return db['MailInteraction'][_0x2a32('0x1f')]({'where':_0x9df5a9[_0x2a32('0x4d')]})[_0x2a32('0x23')](function(_0x5484ca){_0x53f8a6[_0x2a32('0x1f')]=_0x5484ca;if(_0x3d626e['query'][_0x2a32('0x4f')]){_0x9df5a9['include']=[{'all':!![]}];}return db['MailInteraction'][_0x2a32('0x56')](_0x9df5a9);})[_0x2a32('0x23')](function(_0x2637fe){_0x53f8a6[_0x2a32('0x57')]=_0x2637fe;return _0x53f8a6;});}})[_0x2a32('0x23')](respondWithFilteredResult(_0x34ce32,_0x9df5a9))[_0x2a32('0x2d')](handleError(_0x34ce32,null));};exports[_0x2a32('0xf0')]=function(_0xe1c265,_0x27962a){var _0x5a0f6b={};var _0x2a72a1={};var _0x3cfbcf;var _0x2f24be;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0xe1c265[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x27962a,null))[_0x2a32('0x23')](function(_0x47d501){if(_0x47d501){_0x3cfbcf=_0x47d501;_0x2a72a1[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xf1')]['rawAttributes']);_0x2a72a1[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0xe1c265[_0x2a32('0x4e')]);_0x2a72a1[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x2a72a1['model'],_0x2a72a1[_0x2a32('0x4e')]);_0x5a0f6b[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x2a72a1[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0xe1c265[_0x2a32('0x4e')]['fields']));_0x5a0f6b[_0x2a32('0x54')]=_0x5a0f6b[_0x2a32('0x54')][_0x2a32('0x59')]?_0x5a0f6b['attributes']:_0x2a72a1[_0x2a32('0xd9')];_0x5a0f6b[_0x2a32('0xde')]=qs['sort'](_0xe1c265[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x5a0f6b[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0xe1c265[_0x2a32('0x4e')],_0x2a72a1[_0x2a32('0xdb')]));if(_0xe1c265[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x5a0f6b[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x5a0f6b[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x5a0f6b['attributes'],function(_0x2dacdf){var _0x7add81={};_0x7add81[_0x2dacdf]={'$like':'%'+_0xe1c265[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x7add81;})});}_0x5a0f6b=_[_0x2a32('0x62')]({},_0x5a0f6b,_0xe1c265[_0x2a32('0x63')]);return _0x3cfbcf[_0x2a32('0xf0')](_0x5a0f6b);}})[_0x2a32('0x23')](function(_0x28f0a8){if(_0x28f0a8){_0x2f24be=_0x28f0a8['length'];if(!_0xe1c265['query']['hasOwnProperty'](_0x2a32('0xe2'))){_0x5a0f6b[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0xe1c265['query'][_0x2a32('0x1e')]);_0x5a0f6b[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0xe1c265['query'][_0x2a32('0x20')]);}return _0x3cfbcf[_0x2a32('0xf0')](_0x5a0f6b);}})[_0x2a32('0x23')](function(_0x5d892f){if(_0x5d892f){return _0x5d892f?{'count':_0x2f24be,'rows':_0x5d892f}:null;}})[_0x2a32('0x23')](respondWithResult(_0x27962a,null))[_0x2a32('0x2d')](handleError(_0x27962a,null));};exports[_0x2a32('0xf2')]=function(_0x3d7791,_0x121f91){var _0x13c810={};var _0x496db0={};var _0x46eafe;var _0x5a0ea5;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x3d7791[_0x2a32('0x61')]['id']}})['then'](handleEntityNotFound(_0x121f91,null))[_0x2a32('0x23')](function(_0x1621e3){if(_0x1621e3){_0x46eafe=_0x1621e3;_0x496db0[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xf3')][_0x2a32('0x43')]);_0x496db0[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0x3d7791['query']);_0x496db0[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x496db0[_0x2a32('0xd9')],_0x496db0['query']);_0x13c810[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x496db0[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x3d7791['query'][_0x2a32('0xdd')]));_0x13c810[_0x2a32('0x54')]=_0x13c810['attributes'][_0x2a32('0x59')]?_0x13c810[_0x2a32('0x54')]:_0x496db0[_0x2a32('0xd9')];_0x13c810[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x3d7791[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x13c810[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x3d7791[_0x2a32('0x4e')],_0x496db0['filters']));if(_0x3d7791[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x13c810[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x13c810[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x13c810[_0x2a32('0x54')],function(_0x340d3b){var _0x255cc4={};_0x255cc4[_0x340d3b]={'$like':'%'+_0x3d7791['query']['filter']+'%'};return _0x255cc4;})});}_0x13c810=_[_0x2a32('0x62')]({},_0x13c810,_0x3d7791[_0x2a32('0x63')]);return _0x46eafe[_0x2a32('0xf2')](_0x13c810);}})[_0x2a32('0x23')](function(_0x387bcc){if(_0x387bcc){_0x5a0ea5=_0x387bcc[_0x2a32('0x59')];if(!_0x3d7791[_0x2a32('0x4e')][_0x2a32('0xd3')]('nolimit')){_0x13c810[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x3d7791[_0x2a32('0x4e')][_0x2a32('0x1e')]);_0x13c810[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x3d7791[_0x2a32('0x4e')][_0x2a32('0x20')]);}return _0x46eafe[_0x2a32('0xf2')](_0x13c810);}})[_0x2a32('0x23')](function(_0x3f9a9e){if(_0x3f9a9e){return _0x3f9a9e?{'count':_0x5a0ea5,'rows':_0x3f9a9e}:null;}})[_0x2a32('0x23')](respondWithResult(_0x121f91,null))[_0x2a32('0x2d')](handleError(_0x121f91,null));};exports[_0x2a32('0xf4')]=function(_0x123e9c,_0x19846b){var _0x4a79cf={};var _0x28ae84={};var _0x5b7757;var _0x47df2c;return db['User']['findOne']({'where':{'id':_0x123e9c[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x19846b,null))[_0x2a32('0x23')](function(_0x4b4a1c){if(_0x4b4a1c){_0x5b7757=_0x4b4a1c;_0x28ae84[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xf5')][_0x2a32('0x43')]);_0x28ae84[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0x123e9c[_0x2a32('0x4e')]);_0x28ae84[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x28ae84[_0x2a32('0xd9')],_0x28ae84[_0x2a32('0x4e')]);_0x4a79cf[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x28ae84[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x123e9c[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x4a79cf['attributes']=_0x4a79cf[_0x2a32('0x54')][_0x2a32('0x59')]?_0x4a79cf[_0x2a32('0x54')]:_0x28ae84[_0x2a32('0xd9')];_0x4a79cf[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x123e9c[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x4a79cf[_0x2a32('0x4d')]=qs['filters'](_[_0x2a32('0xe0')](_0x123e9c[_0x2a32('0x4e')],_0x28ae84[_0x2a32('0xdb')]));if(_0x123e9c[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x4a79cf[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x4a79cf['where'],{'$or':_[_0x2a32('0x39')](_0x4a79cf[_0x2a32('0x54')],function(_0x2c2285){var _0x527a9e={};_0x527a9e[_0x2c2285]={'$like':'%'+_0x123e9c[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x527a9e;})});}_0x4a79cf=_[_0x2a32('0x62')]({},_0x4a79cf,_0x123e9c['options']);return _0x5b7757[_0x2a32('0xf4')](_0x4a79cf);}})[_0x2a32('0x23')](function(_0x4dc868){if(_0x4dc868){_0x47df2c=_0x4dc868['length'];if(!_0x123e9c[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x4a79cf[_0x2a32('0x1e')]=qs['limit'](_0x123e9c['query'][_0x2a32('0x1e')]);_0x4a79cf['offset']=qs['offset'](_0x123e9c[_0x2a32('0x4e')][_0x2a32('0x20')]);}return _0x5b7757[_0x2a32('0xf4')](_0x4a79cf);}})['then'](function(_0x41093c){if(_0x41093c){return _0x41093c?{'count':_0x47df2c,'rows':_0x41093c}:null;}})[_0x2a32('0x23')](respondWithResult(_0x19846b,null))[_0x2a32('0x2d')](handleError(_0x19846b,null));};exports['login']=function(_0x51eeb4,_0xef940,_0x2ef8ef){var _0x5979a5;var _0x5abc19;var _0x3d1ed1;var _0x10d528=!_[_0x2a32('0x75')](_0x51eeb4[_0x2a32('0x61')]['id'])?_0x51eeb4[_0x2a32('0x61')]['id']:!_['isNil'](_0x51eeb4[_0x2a32('0x35')]['id'])?_0x51eeb4[_0x2a32('0x35')]['id']:null;return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0x10d528,'role':{'$or':[_0x2a32('0x33'),_0x2a32('0x35'),_0x2a32('0x2f')]}},'attributes':['id','name',_0x2a32('0xf6'),'mobile',_0x2a32('0x3d'),_0x2a32('0x6b'),_0x2a32('0xa4')]})['then'](function(_0xaf3fbd){if(_0xaf3fbd){if(_0xaf3fbd[_0x2a32('0x3d')]===_0x2a32('0x2f')){_0x5979a5=_0xaf3fbd;if(_0x51eeb4[_0x2a32('0x66')]['interface']){_0x3d1ed1=util[_0x2a32('0xf7')](_0x2a32('0xf8'),_0x5979a5[_0x51eeb4[_0x2a32('0x66')][_0x2a32('0xa5')]]);}else if(_0x51eeb4['body'][_0x2a32('0xf9')]){_0x3d1ed1=util['format'](_0x2a32('0xb2'),_0x51eeb4[_0x2a32('0x66')][_0x2a32('0xf9')]);}else{_0x3d1ed1=util[_0x2a32('0xf7')]('SIP/%s',_0x5979a5['name']);}socket['to'](util[_0x2a32('0xf7')](_0x2a32('0xfa'),_0x5979a5[_0x2a32('0x3e')]))['emit'](_0x2a32('0xfb'),{'user':{'id':_0x5979a5['id'],'name':_0x5979a5[_0x2a32('0x3e')]},'ip':_0x51eeb4[_0x2a32('0xfc')]['x-forwarded-for']||_0x51eeb4[_0x2a32('0xfd')][_0x2a32('0xfe')]||_0x51eeb4['socket']['remoteAddress']||_0x51eeb4[_0x2a32('0xfd')][_0x2a32('0xff')][_0x2a32('0xfe')]});return db['UserVoiceQueueRt'][_0x2a32('0xb8')]({'where':{'membername':_0x5979a5[_0x2a32('0x3e')]},'individualHooks':!![]});}}else{throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x2a32('0x23')](function(){if(_0x5979a5){return _0x5979a5[_0x2a32('0x100')]({'raw':!![]});}})[_0x2a32('0x23')](function(_0x766ce){if(_0x5979a5){if(_0x766ce){_0x5abc19=_0x766ce;if(_0x5abc19[_0x2a32('0x59')]){var _0x4359eb=_0x5abc19['map'](function(_0x5740f8){var _0x1a9743={'membername':_0x5979a5[_0x2a32('0x3e')],'UserId':_0x5979a5['id'],'queue_name':_0x5740f8['name'],'VoiceQueueId':_0x5740f8['id'],'interface':_0x3d1ed1,'paused':_0x5979a5[_0x2a32('0xa4')]||![],'penalty':_0x5740f8[_0x2a32('0x101')]||0x0};return db[_0x2a32('0xe4')][_0x2a32('0xb4')](_0x1a9743);});return Promise[_0x2a32('0x5f')](_0x4359eb);}}}})[_0x2a32('0x23')](function(){if(_0x5979a5){return db['MemberReport'][_0x2a32('0x56')]({'where':{'membername':_0x5979a5[_0x2a32('0x3e')],'exitAt':null}});}})[_0x2a32('0x23')](function(_0x2d07c7){if(_0x5979a5){var _0x1d4927=[];_0x2d07c7[_0x2a32('0x102')](function(_0x5bd98e){_0x1d4927[_0x2a32('0x55')](_0x5bd98e[_0x2a32('0x2e')]({'exitAt':moment()[_0x2a32('0xf7')](_0x2a32('0x103'))}));});return Promise['all'](_0x1d4927);}})[_0x2a32('0x23')](function(){if(_0x5979a5){var _0x1c5476=[];var _0x730b43=[];var _0xc0d5a2=utils[_0x2a32('0x104')]();var _0x58a6ce={'membername':_0x5979a5[_0x2a32('0x3e')],'interface':_0x3d1ed1,'enterAt':moment()[_0x2a32('0xf7')](_0x2a32('0x103')),'role':_0x5979a5[_0x2a32('0x3d')],'internal':_0x5979a5[_0x2a32('0x6b')]};_0xc0d5a2['forEach'](function(_0x331f57){_0x1c5476['push'](_[_0x2a32('0x62')]({'channel':_0x331f57,'type':_0x2a32('0x105'),'data1':_0x51eeb4[_0x2a32('0x66')][_0x2a32('0x106')],'data2':_0x3d1ed1},_0x58a6ce));if(_0x5979a5['loginInPause']){_0x730b43[_0x2a32('0x55')](_[_0x2a32('0x62')]({'channel':_0x331f57,'type':_0x2a32('0x107'),'data1':_0x2a32('0x108')},_0x58a6ce));}});return db[_0x2a32('0x109')][_0x2a32('0x8c')](_0x1c5476['concat'](_0x730b43),{'individualHooks':!![]});}})[_0x2a32('0x23')](function(){if(_0x5979a5){return _0x5979a5[_0x2a32('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x2a32('0xf7')](_0x2a32('0x103')),'voicePause':_0x5979a5['loginInPause']||![],'mailPause':_0x5979a5[_0x2a32('0xa4')]||![],'chatPause':_0x5979a5[_0x2a32('0xa4')]||![],'faxPause':_0x5979a5[_0x2a32('0xa4')]||![],'smsPause':_0x5979a5[_0x2a32('0xa4')]||![],'openchannelPause':_0x5979a5['loginInPause']||![],'whatsappPause':_0x5979a5[_0x2a32('0xa4')]||![],'pauseType':_0x5979a5[_0x2a32('0xa4')]?_0x2a32('0x108'):null,'interface':_0x3d1ed1,'lastPauseAt':moment()['format'](_0x2a32('0x103'))});}})[_0x2a32('0x23')](function(_0x55fde8){if(_0x51eeb4[_0x2a32('0x10a')]){return _0x2ef8ef();}else{return Promise[_0x2a32('0x10b')](_0x55fde8)[_0x2a32('0x23')](respondWithResult(_0xef940,null));}})[_0x2a32('0x2d')](handleError(_0xef940,null));};exports[_0x2a32('0x10c')]=function(_0x311ecd,_0x27c3a0){var _0x43b86b;return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0x311ecd[_0x2a32('0x61')]['id'],'role':_0x2a32('0x2f')},'attributes':['id',_0x2a32('0x3e'),_0x2a32('0x3d')]})['then'](handleEntityNotFound(_0x27c3a0,null))[_0x2a32('0x23')](function(_0xb8325a){if(_0xb8325a){_0x43b86b=_0xb8325a;return db[_0x2a32('0xe4')][_0x2a32('0xb8')]({'where':{'membername':_0x43b86b['name']},'individualHooks':!![]});}})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x43b86b[_0x2a32('0x3e')],'exitAt':null}});})[_0x2a32('0x23')](function(_0x543f41){var _0x32a5f6=[];_0x543f41['forEach'](function(_0x295ce8){_0x32a5f6['push'](_0x295ce8['update']({'exitAt':moment()[_0x2a32('0xf7')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x2a32('0x5f')](_0x32a5f6);})[_0x2a32('0x23')](function(){return _0x43b86b[_0x2a32('0x2e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x27c3a0,null))[_0x2a32('0x2d')](handleError(_0x27c3a0,null));};exports['pause']=function(_0x39b360,_0x915035){var _0x3e3db8;return db[_0x2a32('0xe4')][_0x2a32('0x2e')]({'paused':0x1},{'where':{'UserId':_0x39b360[_0x2a32('0x61')]['id']},'individualHooks':!![]})[_0x2a32('0x23')](function(){return db['User'][_0x2a32('0x3c')]({'where':{'id':_0x39b360[_0x2a32('0x61')]['id'],'role':'agent'},'attributes':['id','name',_0x2a32('0x3d'),_0x2a32('0x6b'),_0x2a32('0xa5'),_0x2a32('0xb1')]});})[_0x2a32('0x23')](handleEntityNotFound(_0x915035,null))[_0x2a32('0x23')](function(_0x35e5ec){if(_0x35e5ec){_0x3e3db8=_0x35e5ec;return respondWithRpcPromise(_0x2a32('0x10d'),'pause',{'id':_0x3e3db8['id'],'name':_0x3e3db8[_0x2a32('0x3e')],'pause':!![]});}})['then'](function(){if(_0x3e3db8){return db[_0x2a32('0x109')][_0x2a32('0x56')]({'where':{'membername':_0x3e3db8['name'],'type':_0x2a32('0x107'),'exitAt':null}});}})['then'](function(_0x1d7b10){if(_0x1d7b10[_0x2a32('0x59')]){var _0x142595=moment()['format'](_0x2a32('0x103'));for(var _0x19af68=0x0,_0x37447f=_0x1d7b10[_0x2a32('0x59')];_0x19af68<_0x37447f;_0x19af68++){_0x1d7b10[_0x19af68][_0x2a32('0x10e')]({'exitAt':_0x142595});}}})['then'](function(){var _0x1a4f13=[];var _0x53fc77=utils[_0x2a32('0x104')]();_0x53fc77['forEach'](function(_0x4f1cc9){_0x1a4f13[_0x2a32('0x55')]({'channel':_0x4f1cc9,'membername':_0x3e3db8[_0x2a32('0x3e')],'interface':_['isNil'](_0x3e3db8[_0x2a32('0xa5')])?util[_0x2a32('0xf7')](_0x2a32('0xb2'),_0x3e3db8[_0x2a32('0x3e')]):_0x3e3db8[_0x2a32('0xa5')],'type':_0x2a32('0x107'),'enterAt':moment()[_0x2a32('0xf7')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x39b360['body'][_0x2a32('0x45')]||_0x2a32('0x10f'),'role':_0x3e3db8[_0x2a32('0x3d')],'internal':_0x3e3db8['internal']});});return db['MemberReport'][_0x2a32('0x8c')](_0x1a4f13,{'individualHooks':!![]});})[_0x2a32('0x23')](function(){return _0x3e3db8[_0x2a32('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x39b360[_0x2a32('0x66')][_0x2a32('0x45')]||_0x2a32('0x10f'),'lastPauseAt':moment()[_0x2a32('0xf7')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2a32('0x23')](respondWithResult(_0x915035,null))[_0x2a32('0x2d')](handleError(_0x915035,null));};exports[_0x2a32('0x110')]=function(_0x2a9c9f,_0x461a62){if(_0x2a9c9f[_0x2a32('0x66')][_0x2a32('0xb6')]&&!utils[_0x2a32('0xa6')](_0x2a9c9f[_0x2a32('0x66')][_0x2a32('0xb6')])){throw new APIBadRequestError(util[_0x2a32('0xf7')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2a9c9f[_0x2a32('0x66')][_0x2a32('0xb6')]));}return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0x2a9c9f[_0x2a32('0x61')]['id']},'attributes':['id',_0x2a32('0x3e'),_0x2a32('0x3d'),_0x2a32('0x6b'),_0x2a32('0xa5'),'online',_0x2a32('0xb3'),'mailPause','chatPause',_0x2a32('0x111'),'openchannelPause',_0x2a32('0x112'),'whatsappPause',_0x2a32('0x113'),_0x2a32('0x114')]})['then'](function(_0x9c59e7){if(!_0x9c59e7){throw new APINotFoundError(util[_0x2a32('0xf7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2a9c9f['params']['id']));}return _0x9c59e7[_0x2a32('0x110')](_0x2a9c9f[_0x2a32('0x66')][_0x2a32('0xb6')]);})[_0x2a32('0x23')](respondWithResult(_0x461a62,null))[_0x2a32('0x2d')](APIHandleError(_0x461a62));};exports[_0x2a32('0x115')]=function(_0x144f81,_0x3678c5){var _0x1dea02={};var _0x2c85cc={};var _0x2425d2;var _0x50e2fa;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x144f81[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x3678c5,null))['then'](function(_0x2ae83d){if(_0x2ae83d){_0x2425d2=_0x2ae83d;_0x2c85cc[_0x2a32('0xd9')]=_['keys'](db['Team']['rawAttributes']);_0x2c85cc['query']=_[_0x2a32('0xe3')](_0x144f81[_0x2a32('0x4e')]);_0x2c85cc[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x2c85cc[_0x2a32('0xd9')],_0x2c85cc[_0x2a32('0x4e')]);_0x1dea02[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x2c85cc[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x144f81[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x1dea02[_0x2a32('0x54')]=_0x1dea02[_0x2a32('0x54')][_0x2a32('0x59')]?_0x1dea02[_0x2a32('0x54')]:_0x2c85cc[_0x2a32('0xd9')];_0x1dea02[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x144f81['query'][_0x2a32('0xdf')]);_0x1dea02[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x144f81[_0x2a32('0x4e')],_0x2c85cc[_0x2a32('0xdb')]));if(_0x144f81['query'][_0x2a32('0x37')]){_0x1dea02[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x1dea02[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x1dea02[_0x2a32('0x54')],function(_0x2707fb){var _0x1abcf3={};_0x1abcf3[_0x2707fb]={'$like':'%'+_0x144f81['query'][_0x2a32('0x37')]+'%'};return _0x1abcf3;})});}_0x1dea02=_[_0x2a32('0x62')]({},_0x1dea02,_0x144f81['options']);return _0x2425d2['getTeams'](_0x1dea02);}})[_0x2a32('0x23')](function(_0x1f94d5){if(_0x1f94d5){_0x50e2fa=_0x1f94d5[_0x2a32('0x59')];if(!_0x144f81[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x1dea02[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x144f81['query'][_0x2a32('0x1e')]);_0x1dea02[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x144f81[_0x2a32('0x4e')]['offset']);}return _0x2425d2[_0x2a32('0x115')](_0x1dea02);}})[_0x2a32('0x23')](function(_0x23f5af){if(_0x23f5af){return _0x23f5af?{'count':_0x50e2fa,'rows':_0x23f5af}:null;}})[_0x2a32('0x23')](respondWithResult(_0x3678c5,null))[_0x2a32('0x2d')](handleError(_0x3678c5,null));};exports[_0x2a32('0x116')]=function(_0x45724c,_0x2861cc){var _0xf7204d=_0x45724c[_0x2a32('0x61')]['id'];var _0x15252f=_0x45724c[_0x2a32('0x66')]?_0x45724c[_0x2a32('0x66')]['ids']:null;var _0xca2f48=[];return Promise[_0x2a32('0x10b')]()['then'](function(){if(!_0x15252f)throw new APIBadRequestError(_0x2a32('0x117'));})['then'](function(){return db['User'][_0x2a32('0x9e')]({'where':{'id':_0xf7204d}});})[_0x2a32('0x23')](function(_0x3f380d){if(!_0x3f380d)throw new APINotFoundError(util[_0x2a32('0xf7')](_0x2a32('0xd2'),_0x45724c[_0x2a32('0x61')]['id']));return db['sequelize'][_0x2a32('0x118')](function(_0x3df841){return _0x3f380d[_0x2a32('0x116')](_0x15252f,{'transaction':_0x3df841})['then'](function(){return db[_0x2a32('0x119')][_0x2a32('0x56')]({'where':{'id':{'$in':_0x15252f}}});})[_0x2a32('0x23')](function(_0x44b40e){var _0x57e21f=_[_0x2a32('0x39')](_0x44b40e,function(_0x587f62){return _0x587f62[_0x2a32('0x11a')]();});return Promise[_0x2a32('0x5f')](_0x57e21f);})[_0x2a32('0x23')](function(_0x57f303){_0xca2f48=_[_0x2a32('0x11b')](_0x57f303);var _0x14977d=_[_0x2a32('0x39')](_0xca2f48,function(_0x472abe){return _0x472abe[_0x2a32('0x11c')](_0x3f380d['id'],{'transaction':_0x3df841});});return Promise[_0x2a32('0x5f')](_0x14977d);})['then'](function(){if(!_0x3f380d[_0x2a32('0xb1')])return;var _0x4d87b6=_[_0x2a32('0x37')](_0xca2f48,function(_0x5d0f1e){return _0x5d0f1e[_0x2a32('0x11d')](_0x2a32('0xb6'))===_0x2a32('0x11e');});var _0x54d583=_['map'](_0x4d87b6,function(_0x4f9baf){return db[_0x2a32('0xe4')][_0x2a32('0xb4')]({'membername':_0x3f380d[_0x2a32('0x3e')],'UserId':_0x3f380d['id'],'queue_name':_0x4f9baf[_0x2a32('0x3e')],'VoiceQueueId':_0x4f9baf['id'],'interface':_[_0x2a32('0x75')](_0x3f380d[_0x2a32('0xa5')])?util[_0x2a32('0xf7')](_0x2a32('0xb2'),_0x3f380d[_0x2a32('0x3e')]):_0x3f380d[_0x2a32('0xa5')],'paused':_0x3f380d[_0x2a32('0xb3')]||![],'penalty':_0x3f380d[_0x2a32('0xac')]},{'transaction':_0x3df841});});return Promise[_0x2a32('0x5f')](_0x54d583);})['then'](function(){return db[_0x2a32('0x11f')][_0x2a32('0x56')]({'where':{'teamId':{'$in':_0x15252f}}});})[_0x2a32('0x23')](function(_0x2957f9){var _0x518e3b=_[_0x2a32('0x39')](_0x2957f9,function(_0x393f38){return db['UserVoicePrefix'][_0x2a32('0x85')]({'UserId':_0x3f380d['id'],'VoicePrefixId':_0x393f38[_0x2a32('0x120')]},{'transaction':_0x3df841});});return Promise[_0x2a32('0x5f')](_0x518e3b);});});})[_0x2a32('0x23')](function(){for(var _0x7afd96=0x0;_0x7afd96<_0xca2f48[_0x2a32('0x59')];_0x7afd96++){var _0x92b9ad=_0xca2f48[_0x7afd96][_0x2a32('0x11d')]('channel');var _0x233275=_0x92b9ad+_0x2a32('0xad');socket[_0x2a32('0x30')](_0x2a32('0x35')+_0x92b9ad+_0x2a32('0xae'),{'UserId':_0xf7204d,['queueField']:_0xca2f48[_0x7afd96]['id']});}})[_0x2a32('0x23')](respondWithStatusCode(_0x2861cc,null))[_0x2a32('0x2d')](APIHandleError(_0x2861cc));};exports[_0x2a32('0x121')]=function(_0x49b4d9,_0x3a62be){var _0x33af4f=_0x49b4d9[_0x2a32('0x61')]['id'];var _0x51edb9=null;if(_0x49b4d9[_0x2a32('0x4e')][_0x2a32('0x69')]){_0x51edb9=_[_0x2a32('0x122')](_0x49b4d9[_0x2a32('0x4e')][_0x2a32('0x69')])?_0x49b4d9[_0x2a32('0x4e')][_0x2a32('0x69')]:[_0x49b4d9[_0x2a32('0x4e')][_0x2a32('0x69')]];}var _0x23e574=[];return Promise[_0x2a32('0x10b')]()[_0x2a32('0x23')](function(){if(!_0x51edb9)throw new APIBadRequestError(_0x2a32('0x123'));})[_0x2a32('0x23')](function(){return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x33af4f}});})['then'](function(_0x3c9218){if(!_0x3c9218)throw new APINotFoundError(util['format'](_0x2a32('0xd2'),_0x49b4d9[_0x2a32('0x61')]['id']));return db['sequelize'][_0x2a32('0x118')](function(_0x29d6fe){return _0x3c9218[_0x2a32('0x121')](_0x51edb9,{'transaction':_0x29d6fe})[_0x2a32('0x23')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x51edb9}}});})[_0x2a32('0x23')](function(_0x42137f){var _0x3eac16=_[_0x2a32('0x39')](_0x42137f,function(_0x5bba36){return _0x5bba36[_0x2a32('0x11a')]();});return Promise['all'](_0x3eac16);})[_0x2a32('0x23')](function(_0x33403e){_0x23e574=_[_0x2a32('0x11b')](_0x33403e);var _0x15d5c7=_['map'](_0x23e574,function(_0x120c6c){return _0x120c6c[_0x2a32('0x124')](_0x3c9218['id'],{'transaction':_0x29d6fe});});return Promise[_0x2a32('0x5f')](_0x15d5c7);})[_0x2a32('0x23')](function(){if(!_0x3c9218[_0x2a32('0xb1')])return;var _0x25d03b=_[_0x2a32('0x37')](_0x23e574,function(_0x64acd0){return _0x64acd0[_0x2a32('0x11d')](_0x2a32('0xb6'))===_0x2a32('0x11e');});var _0x29c7ce=_['map'](_0x25d03b,function(_0x1561dc){return db['UserVoiceQueueRt'][_0x2a32('0xb8')]({'where':{'VoiceQueueId':_0x1561dc['id'],'UserId':_0x3c9218['id']},'transaction':_0x29d6fe});});return Promise[_0x2a32('0x5f')](_0x29c7ce);})[_0x2a32('0x23')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x51edb9}}});})[_0x2a32('0x23')](function(_0x33667c){var _0x54009b=_['map'](_0x33667c,function(_0x3f844d){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x3c9218['id'],'VoicePrefixId':_0x3f844d[_0x2a32('0x120')]}},{'transaction':_0x29d6fe});});return Promise[_0x2a32('0x5f')](_0x54009b);});});})[_0x2a32('0x23')](function(){for(var _0x1105fd=0x0;_0x1105fd<_0x23e574[_0x2a32('0x59')];_0x1105fd++){var _0x112ac7=_0x23e574[_0x1105fd][_0x2a32('0x11d')](_0x2a32('0xb6'));var _0x35a645=_0x112ac7+_0x2a32('0xad');socket[_0x2a32('0x30')](_0x2a32('0x35')+_0x112ac7+_0x2a32('0xb7'),{'UserId':_0x33af4f,['queueField']:_0x23e574[_0x1105fd]['id']});}})[_0x2a32('0x23')](respondWithStatusCode(_0x3a62be,null))[_0x2a32('0x2d')](APIHandleError(_0x3a62be));};exports['getLists']=function(_0x3eb5e,_0x10e4b6){var _0x4f2acf={};var _0x206609={};var _0x290d08;var _0x1ae04a;return db['User'][_0x2a32('0x9e')]({'where':{'id':_0x3eb5e['params']['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x10e4b6,null))[_0x2a32('0x23')](function(_0x2fc7de){if(_0x2fc7de){_0x290d08=_0x2fc7de;_0x206609[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xd4')][_0x2a32('0x43')]);_0x206609[_0x2a32('0x4e')]=_['keys'](_0x3eb5e['query']);_0x206609['filters']=_[_0x2a32('0xdc')](_0x206609[_0x2a32('0xd9')],_0x206609['query']);_0x4f2acf[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x206609[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x4f2acf[_0x2a32('0x54')]=_0x4f2acf[_0x2a32('0x54')][_0x2a32('0x59')]?_0x4f2acf[_0x2a32('0x54')]:_0x206609['model'];_0x4f2acf[_0x2a32('0xde')]=qs['sort'](_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x4f2acf[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x3eb5e[_0x2a32('0x4e')],_0x206609[_0x2a32('0xdb')]));if(_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x4f2acf[_0x2a32('0x4d')]=_['merge'](_0x4f2acf[_0x2a32('0x4d')],{'$or':_['map'](_0x4f2acf[_0x2a32('0x54')],function(_0x5dd68c){var _0x11277b={};_0x11277b[_0x5dd68c]={'$like':'%'+_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x11277b;})});}_0x4f2acf=_[_0x2a32('0x62')]({},_0x4f2acf,_0x3eb5e[_0x2a32('0x63')]);return _0x290d08[_0x2a32('0x125')](_0x4f2acf);}})[_0x2a32('0x23')](function(_0x150035){if(_0x150035){_0x1ae04a=_0x150035[_0x2a32('0x59')];if(!_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x4f2acf[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x3eb5e[_0x2a32('0x4e')]['limit']);_0x4f2acf[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0x20')]);}return _0x290d08[_0x2a32('0x125')](_0x4f2acf);}})[_0x2a32('0x23')](function(_0x5ce1e2){if(_0x5ce1e2){return _0x5ce1e2?{'count':_0x1ae04a,'rows':_0x5ce1e2}:null;}})[_0x2a32('0x23')](respondWithResult(_0x10e4b6,null))['catch'](handleError(_0x10e4b6,null));};exports[_0x2a32('0x126')]=function(_0x152801,_0x1872b9){var _0x20af6d={};var _0x16590e={};var _0xe2fd1;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x152801['params']['id']}})['then'](handleEntityNotFound(_0x1872b9,null))['then'](function(_0x24f0ce){if(_0x24f0ce){_0xe2fd1=_0x24f0ce;_0x16590e[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0x42')]['rawAttributes']);_0x16590e[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0x152801[_0x2a32('0x4e')]);_0x16590e[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x16590e[_0x2a32('0xd9')],_0x16590e['query']);_0x20af6d[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x16590e[_0x2a32('0xd9')],qs['fields'](_0x152801['query'][_0x2a32('0xdd')]));_0x20af6d[_0x2a32('0x54')]=_0x20af6d[_0x2a32('0x54')][_0x2a32('0x59')]?_0x20af6d[_0x2a32('0x54')]:_0x16590e['model'];_0x20af6d['order']=qs[_0x2a32('0xdf')](_0x152801[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x20af6d[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_['pick'](_0x152801[_0x2a32('0x4e')],_0x16590e[_0x2a32('0xdb')]));if(_0x152801[_0x2a32('0x4e')]['filter']){_0x20af6d[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x20af6d[_0x2a32('0x4d')],{'$or':_['map'](_0x20af6d[_0x2a32('0x54')],function(_0x51bfaa){var _0x5d17e4={};_0x5d17e4[_0x51bfaa]={'$like':'%'+_0x152801['query'][_0x2a32('0x37')]+'%'};return _0x5d17e4;})});}_0x20af6d[_0x2a32('0xd9')]=db[_0x2a32('0x42')];_0x20af6d['as']=_0x2a32('0x36');_0x20af6d=_['merge']({},_0x20af6d,_0x152801['options']);return _0xe2fd1[_0x2a32('0x100')]({'include':[_0x20af6d]});}})[_0x2a32('0x23')](function(_0x175e16){if(_0x175e16){var _0x2a637c={},_0x24c2d5=[];for(var _0x72ac38=0x0;_0x72ac38<_0x175e16[_0x2a32('0x59')];_0x72ac38+=0x1){for(var _0x21b1b2=0x0,_0xf88b46;_0x21b1b2<_0x175e16[_0x72ac38][_0x2a32('0x36')][_0x2a32('0x59')];_0x21b1b2+=0x1){_0xf88b46=_0x175e16[_0x72ac38][_0x2a32('0x36')][_0x21b1b2][_0x2a32('0x32')]({'plain':!![]});_0x2a637c[_0xf88b46['id']]=_0xf88b46;}}_0x2a637c=_['values'](_0x2a637c);for(var _0x3e0449=qs[_0x2a32('0x20')](_0x152801[_0x2a32('0x4e')]['offset']);_0x3e0449<_0x2a637c[_0x2a32('0x59')]&&_0x24c2d5[_0x2a32('0x59')]=_0x36c08a[_0xd533('0x4b')]){throw new Error(_0xd533('0x4c'));}})[_0xd533('0x17')](function(){if(_0xc7ad9a){return db[_0xd533('0x25')][_0xd533('0x41')]({'where':{'membername':_0xc7ad9a[_0xd533('0x21')]},'individualHooks':!![]});}})[_0xd533('0x17')](function(){if(_0xc7ad9a){return _0xc7ad9a[_0xd533('0x4d')]({'raw':!![]});}})[_0xd533('0x17')](function(_0x17809d){if(_0xc7ad9a){if(_0x17809d){var _0x4b1beb=[];_0x410970=_0x17809d;if(_0x410970[_0xd533('0x27')]){for(var _0x46b7de=0x0;_0x46b7de<_0x410970[_0xd533('0x27')];_0x46b7de++){_0x4b1beb[_0xd533('0x43')](db[_0xd533('0x25')]['upsert']({'membername':_0xc7ad9a['name'],'UserId':_0xc7ad9a['id'],'queue_name':_0x410970[_0x46b7de][_0xd533('0x21')],'VoiceQueueId':_0x410970[_0x46b7de]['id'],'interface':_0x43589e,'paused':_0xc7ad9a['loginInPause']||![],'penalty':_0x410970[_0x46b7de]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xd533('0x44')](_0x4b1beb);}}}})[_0xd533('0x17')](function(){if(_0xc7ad9a){return db['MemberReport'][_0xd533('0xf')]({'where':{'membername':_0xc7ad9a[_0xd533('0x21')],'exitAt':null}});}})[_0xd533('0x17')](function(_0x142968){if(_0xc7ad9a){if(_0x142968&&_0x142968[_0xd533('0x27')]){var _0x5a8cc5=[];_0x142968[_0xd533('0x29')](function(_0x273fe1){_0x5a8cc5[_0xd533('0x43')](_0x273fe1[_0xd533('0x31')]({'exitAt':moment()[_0xd533('0x28')](_0xd533('0x2b'))}));});return BPromise['all'](_0x5a8cc5);}}})[_0xd533('0x17')](function(){if(_0xc7ad9a){var _0x3e6da9=[];var _0xe9f25d=[];var _0x1ab98c=utils[_0xd533('0x4e')]();var _0x1ec2fc={'membername':_0xc7ad9a[_0xd533('0x21')],'interface':_0x43589e,'enterAt':moment()[_0xd533('0x28')](_0xd533('0x2b')),'role':_0xc7ad9a[_0xd533('0x22')],'internal':_0xc7ad9a[_0xd533('0x23')]};_0x1ab98c['forEach'](function(_0x5cfdb2){_0x3e6da9['push'](_[_0xd533('0x4f')]({'channel':_0x5cfdb2,'type':_0xd533('0x50'),'data1':_0xd533('0x51'),'data2':_0x43589e},_0x1ec2fc));if(_0xc7ad9a['loginInPause']){_0xe9f25d[_0xd533('0x43')](_['merge']({'channel':_0x5cfdb2,'type':_0xd533('0x26'),'data1':_0xd533('0x52')},_0x1ec2fc));}});return db[_0xd533('0x42')][_0xd533('0x30')](_0x3e6da9[_0xd533('0x53')](_0xe9f25d),{'individualHooks':!![]});}})[_0xd533('0x17')](function(){if(_0xc7ad9a){return _0xc7ad9a[_0xd533('0x31')]({'online':!![],'lastLoginAt':moment()[_0xd533('0x28')](_0xd533('0x2b')),'voicePause':_0xc7ad9a[_0xd533('0x47')]||![],'mailPause':_0xc7ad9a[_0xd533('0x47')]||![],'chatPause':_0xc7ad9a[_0xd533('0x47')]||![],'faxPause':_0xc7ad9a[_0xd533('0x47')]||![],'smsPause':_0xc7ad9a[_0xd533('0x47')]||![],'openchannelPause':_0xc7ad9a[_0xd533('0x47')]||![],'pauseType':_0xc7ad9a[_0xd533('0x47')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xd533('0x28')](_0xd533('0x2b')),'interface':_0x43589e});}})[_0xd533('0x17')](function(_0x39921d){_0x29e503(_0x39921d);})['catch'](function(_0x508c8f){_0x5e6372(_0x42b2e6['error'](0x1f4,_0x508c8f[_0xd533('0x1c')]));});});}; \ No newline at end of file +var _0xb59b=['bluebird','../../mysqldb','rpc','redis','defaults','socket.io-emitter','register','GetUser','User','options','raw','where','attributes','include','map','model','then','info','debug','stringify','catch','message','ShowUser','find','error','PauseUser','name','role','internal','interface','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','findAll','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','body','type','DEFAULT\x20PAUSE','update','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','LogoutUser','destroy','MemberReport','all','LoginUser','mobile','phone','SIP/%s','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','getChannels','merge','LOGIN','LOGININPAUSE','bulkCreate','concat','lodash','util'];(function(_0x4d90b2,_0x297374){var _0x45f3f0=function(_0x3f06d5){while(--_0x3f06d5){_0x4d90b2['push'](_0x4d90b2['shift']());}};_0x45f3f0(++_0x297374);}(_0xb59b,0x1a7));var _0xbb59=function(_0x57b263,_0x117304){_0x57b263=_0x57b263-0x0;var _0x57c3d3=_0xb59b[_0x57b263];return _0x57c3d3;};'use strict';var _=require(_0xbb59('0x0'));var util=require(_0xbb59('0x1'));var moment=require('moment');var BPromise=require(_0xbb59('0x2'));var Redis=require('ioredis');var db=require(_0xbb59('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbb59('0x4'));var config=require('../../config/environment');config[_0xbb59('0x5')]=_[_0xbb59('0x6')](config[_0xbb59('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb59('0x7'))(new Redis(config[_0xbb59('0x5')]));require('./user.socket')[_0xbb59('0x8')](socket);exports[_0xbb59('0x9')]=function(_0x4ad4ba){var _0x4c4e22=this;return new Promise(function(_0x193207,_0x5ad040){return db[_0xbb59('0xa')]['findAll']({'raw':_0x4ad4ba[_0xbb59('0xb')]?_0x4ad4ba[_0xbb59('0xb')][_0xbb59('0xc')]===undefined?!![]:![]:!![],'where':_0x4ad4ba['options']?_0x4ad4ba[_0xbb59('0xb')][_0xbb59('0xd')]||null:null,'attributes':_0x4ad4ba[_0xbb59('0xb')]?_0x4ad4ba['options'][_0xbb59('0xe')]||null:null,'limit':_0x4ad4ba[_0xbb59('0xb')]?_0x4ad4ba[_0xbb59('0xb')]['limit']||null:null,'include':_0x4ad4ba[_0xbb59('0xb')]?_0x4ad4ba[_0xbb59('0xb')][_0xbb59('0xf')]?_[_0xbb59('0x10')](_0x4ad4ba['options']['include'],function(_0xc9f96e){return{'model':db[_0xc9f96e[_0xbb59('0x11')]],'as':_0xc9f96e['as'],'attributes':_0xc9f96e[_0xbb59('0xe')],'include':_0xc9f96e[_0xbb59('0xf')]?_['map'](_0xc9f96e[_0xbb59('0xf')],function(_0x458252){return{'model':db[_0x458252[_0xbb59('0x11')]],'as':_0x458252['as'],'attributes':_0x458252[_0xbb59('0xe')],'include':_0x458252[_0xbb59('0xf')]?_[_0xbb59('0x10')](_0x458252[_0xbb59('0xf')],function(_0x55e3b7){return{'model':db[_0x55e3b7[_0xbb59('0x11')]],'as':_0x55e3b7['as'],'attributes':_0x55e3b7[_0xbb59('0xe')]};}):[]};}):[]};}):[]:[]})[_0xbb59('0x12')](function(_0x284b4a){logger[_0xbb59('0x13')](_0xbb59('0x9'),_0x4ad4ba);logger[_0xbb59('0x14')](_0xbb59('0x9'),_0x4ad4ba,JSON[_0xbb59('0x15')](_0x284b4a));_0x193207(_0x284b4a);})[_0xbb59('0x16')](function(_0x1eed39){logger['error']('GetUser',_0x1eed39[_0xbb59('0x17')],_0x4ad4ba);_0x5ad040(_0x4c4e22['error'](0x1f4,_0x1eed39['message']));});});};exports[_0xbb59('0x18')]=function(_0x3694ae){var _0x2384a0=this;return new Promise(function(_0x207497,_0x38fb76){return db[_0xbb59('0xa')][_0xbb59('0x19')]({'raw':_0x3694ae[_0xbb59('0xb')]?_0x3694ae[_0xbb59('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x3694ae['options']?_0x3694ae['options'][_0xbb59('0xd')]||null:null,'attributes':_0x3694ae[_0xbb59('0xb')]?_0x3694ae[_0xbb59('0xb')]['attributes']||null:null,'include':_0x3694ae[_0xbb59('0xb')]?_0x3694ae[_0xbb59('0xb')][_0xbb59('0xf')]?_[_0xbb59('0x10')](_0x3694ae[_0xbb59('0xb')][_0xbb59('0xf')],function(_0x442d85){return{'model':db[_0x442d85['model']],'as':_0x442d85['as'],'attributes':_0x442d85[_0xbb59('0xe')],'include':_0x442d85['include']?_[_0xbb59('0x10')](_0x442d85['include'],function(_0x53581c){return{'model':db[_0x53581c[_0xbb59('0x11')]],'as':_0x53581c['as'],'attributes':_0x53581c[_0xbb59('0xe')],'include':_0x53581c[_0xbb59('0xf')]?_[_0xbb59('0x10')](_0x53581c[_0xbb59('0xf')],function(_0x523d6e){return{'model':db[_0x523d6e['model']],'as':_0x523d6e['as'],'attributes':_0x523d6e[_0xbb59('0xe')]};}):[]};}):[]};}):[]:[]})[_0xbb59('0x12')](function(_0x1ec6f2){logger[_0xbb59('0x13')](_0xbb59('0x18'),_0x3694ae);logger[_0xbb59('0x14')]('ShowUser',_0x3694ae,JSON[_0xbb59('0x15')](_0x1ec6f2));_0x207497(_0x1ec6f2);})[_0xbb59('0x16')](function(_0x4ebf44){logger[_0xbb59('0x1a')](_0xbb59('0x18'),_0x4ebf44[_0xbb59('0x17')],_0x3694ae);_0x38fb76(_0x2384a0[_0xbb59('0x1a')](0x1f4,_0x4ebf44['message']));});});};exports[_0xbb59('0x1b')]=function(_0x26e317){var _0x4b0cea;return db[_0xbb59('0xa')][_0xbb59('0x19')]({'where':_0x26e317[_0xbb59('0xb')]['where']||{},'attributes':['id',_0xbb59('0x1c'),_0xbb59('0x1d'),_0xbb59('0x1e'),_0xbb59('0x1f')]})[_0xbb59('0x12')](function(_0x2a238a){if(!_0x2a238a){throw new Error(util['format'](_0xbb59('0x20'),_0x26e317['params']['id']));}_0x4b0cea=_0x2a238a;return db[_0xbb59('0x21')]['update']({'paused':0x1},{'where':{'UserId':_0x4b0cea['id']},'individualHooks':!![]});})[_0xbb59('0x12')](function(){return db['MemberReport'][_0xbb59('0x22')]({'where':{'membername':_0x4b0cea['name'],'type':_0xbb59('0x23'),'exitAt':null}});})[_0xbb59('0x12')](function(_0x59dbcc){if(_0x59dbcc&&_0x59dbcc[_0xbb59('0x24')]){var _0x20d10a=moment()[_0xbb59('0x25')](_0xbb59('0x26'));for(var _0x512852=0x0,_0xb0b46c=_0x59dbcc[_0xbb59('0x24')];_0x512852<_0xb0b46c;_0x512852++){_0x59dbcc[_0x512852][_0xbb59('0x27')]({'exitAt':_0x20d10a});}}})['then'](function(){var _0x47db9d=[];var _0x472aa2=utils['getChannels']();_0x472aa2[_0xbb59('0x28')](function(_0x282017){_0x47db9d[_0xbb59('0x29')]({'channel':_0x282017,'membername':_0x4b0cea['name'],'interface':_['isNil'](_0x4b0cea['interface'])?util[_0xbb59('0x25')]('SIP/%s',_0x4b0cea[_0xbb59('0x1c')]):_0x4b0cea['interface'],'type':_0xbb59('0x23'),'enterAt':moment()[_0xbb59('0x25')](_0xbb59('0x26')),'data1':_0x26e317[_0xbb59('0x2a')][_0xbb59('0x2b')]||_0xbb59('0x2c'),'role':_0x4b0cea['role'],'internal':_0x4b0cea[_0xbb59('0x1e')],'uniqueid':_0x26e317[_0xbb59('0x2a')]['uniqueid']||null});});return db['MemberReport']['bulkCreate'](_0x47db9d,{'individualHooks':!![]});})[_0xbb59('0x12')](function(){return _0x4b0cea[_0xbb59('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x26e317[_0xbb59('0x2a')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xbb59('0x25')](_0xbb59('0x26'))});})['catch'](function(_0x1bcf41){throw _0x1bcf41;});};exports['UnpauseUser']=function(_0x398778){return Promise[_0xbb59('0x2e')]()['then'](function(){if(_0x398778[_0xbb59('0x2a')][_0xbb59('0x2f')]&&!utils[_0xbb59('0x30')](_0x398778[_0xbb59('0x2a')][_0xbb59('0x2f')])){throw new Error(util[_0xbb59('0x25')](_0xbb59('0x31'),_0x398778['body']['channel']));}return db[_0xbb59('0xa')][_0xbb59('0x32')]({'where':_0x398778[_0xbb59('0xb')]['where']||{},'attributes':['id',_0xbb59('0x1c'),_0xbb59('0x1d'),_0xbb59('0x1e'),'interface',_0xbb59('0x33'),_0xbb59('0x34'),_0xbb59('0x35'),_0xbb59('0x36'),_0xbb59('0x37'),_0xbb59('0x38'),_0xbb59('0x39'),_0xbb59('0x3a'),_0xbb59('0x3b'),_0xbb59('0x3c')]});})[_0xbb59('0x12')](function(_0xddef02){if(!_0xddef02){throw new Error(util[_0xbb59('0x25')]('User\x20with\x20id\x20%s\x20not\x20found',_0x398778['params']['id']));}return _0xddef02[_0xbb59('0x3d')](_0x398778['body'][_0xbb59('0x2f')],'system');})['catch'](function(_0x4ecd47){throw _0x4ecd47;});};exports[_0xbb59('0x3e')]=function(_0x2fe36c){var _0x56bff4=this;return new Promise(function(_0xc51c5e,_0x56b7fd){var _0x505a11;return db[_0xbb59('0xa')]['findOne']({'where':_0x2fe36c[_0xbb59('0xb')][_0xbb59('0xd')]||{},'attributes':['id',_0xbb59('0x1c')]})['then'](function(_0x18b41c){if(_0x18b41c){_0x505a11=_0x18b41c;return db[_0xbb59('0x21')][_0xbb59('0x3f')]({'where':{'membername':_0x505a11[_0xbb59('0x1c')]},'individualHooks':!![]});}})['then'](function(){if(_0x505a11){return db[_0xbb59('0x40')][_0xbb59('0x22')]({'where':{'membername':_0x505a11['name'],'exitAt':null}});}})[_0xbb59('0x12')](function(_0x195537){if(_0x505a11){if(_0x195537&&_0x195537[_0xbb59('0x24')]){var _0x22bdc5=[];_0x195537['forEach'](function(_0x319f93){_0x22bdc5['push'](_0x319f93['update']({'exitAt':moment()[_0xbb59('0x25')](_0xbb59('0x26'))}));});return BPromise[_0xbb59('0x41')](_0x22bdc5);}}})[_0xbb59('0x12')](function(){if(_0x505a11){return _0x505a11[_0xbb59('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xbb59('0x12')](function(_0x2f57ed){_0xc51c5e(_0x2f57ed);})['catch'](function(_0x541b34){_0x56b7fd(_0x56bff4[_0xbb59('0x1a')](0x1f4,_0x541b34[_0xbb59('0x17')]));});});};exports[_0xbb59('0x42')]=function(_0x356939){var _0x2805b9=this;return new Promise(function(_0x2001f2,_0x193a7e){var _0xdabcf2;var _0x58ed16;var _0xd45db9;var _0x3cc8de;return db[_0xbb59('0xa')][_0xbb59('0x32')]({'where':_0x356939['options']['where']||{},'attributes':['id',_0xbb59('0x1c'),'role',_0xbb59('0x43'),_0xbb59('0x44'),'internal','loginInPause','interface']})[_0xbb59('0x12')](function(_0x506bf3){if(_0x506bf3){_0xdabcf2=_0x506bf3;_0x3cc8de=_0x356939['body'][_0xbb59('0x1f')]?_0x356939[_0xbb59('0x2a')][_0xbb59('0x1f')]:util[_0xbb59('0x25')](_0xbb59('0x45'),_0xdabcf2[_0xbb59('0x1c')]);return db['User']['count']({'where':{'role':_0xbb59('0x46'),'online':!![],'id':{'$ne':_0xdabcf2['id']}}});}})['then'](function(_0x1bb351){if(_0x1bb351){_0xd45db9=_0x1bb351;return require(_0xbb59('0x47'))[_0xbb59('0x48')]();}})[_0xbb59('0x12')](function(_0x2b09ae){if(_0x2b09ae&&_0x2b09ae[_0xbb59('0x49')]&&_0xd45db9>=_0x2b09ae[_0xbb59('0x49')]){throw new Error(_0xbb59('0x4a'));}})['then'](function(){if(_0xdabcf2){return db[_0xbb59('0x21')]['destroy']({'where':{'membername':_0xdabcf2[_0xbb59('0x1c')]},'individualHooks':!![]});}})[_0xbb59('0x12')](function(){if(_0xdabcf2){return _0xdabcf2[_0xbb59('0x4b')]({'raw':!![]});}})[_0xbb59('0x12')](function(_0x4a5624){if(_0xdabcf2){if(_0x4a5624){var _0x428cc7=[];_0x58ed16=_0x4a5624;if(_0x58ed16['length']){for(var _0x482ea0=0x0;_0x482ea0<_0x58ed16['length'];_0x482ea0++){_0x428cc7['push'](db[_0xbb59('0x21')][_0xbb59('0x4c')]({'membername':_0xdabcf2['name'],'UserId':_0xdabcf2['id'],'queue_name':_0x58ed16[_0x482ea0][_0xbb59('0x1c')],'VoiceQueueId':_0x58ed16[_0x482ea0]['id'],'interface':_0x3cc8de,'paused':_0xdabcf2[_0xbb59('0x4d')]||![],'penalty':_0x58ed16[_0x482ea0][_0xbb59('0x4e')]||0x0}));}return BPromise[_0xbb59('0x41')](_0x428cc7);}}}})[_0xbb59('0x12')](function(){if(_0xdabcf2){return db[_0xbb59('0x40')][_0xbb59('0x22')]({'where':{'membername':_0xdabcf2[_0xbb59('0x1c')],'exitAt':null}});}})[_0xbb59('0x12')](function(_0xedbe83){if(_0xdabcf2){if(_0xedbe83&&_0xedbe83[_0xbb59('0x24')]){var _0x3dbdb5=[];_0xedbe83[_0xbb59('0x28')](function(_0x5522dd){_0x3dbdb5[_0xbb59('0x29')](_0x5522dd[_0xbb59('0x2d')]({'exitAt':moment()[_0xbb59('0x25')](_0xbb59('0x26'))}));});return BPromise[_0xbb59('0x41')](_0x3dbdb5);}}})[_0xbb59('0x12')](function(){if(_0xdabcf2){var _0x193f23=[];var _0x9d48bc=[];var _0x276e3e=utils[_0xbb59('0x4f')]();var _0x4852ce={'membername':_0xdabcf2[_0xbb59('0x1c')],'interface':_0x3cc8de,'enterAt':moment()['format'](_0xbb59('0x26')),'role':_0xdabcf2[_0xbb59('0x1d')],'internal':_0xdabcf2[_0xbb59('0x1e')]};_0x276e3e[_0xbb59('0x28')](function(_0x2f67af){_0x193f23[_0xbb59('0x29')](_[_0xbb59('0x50')]({'channel':_0x2f67af,'type':_0xbb59('0x51'),'data1':'callysquare','data2':_0x3cc8de},_0x4852ce));if(_0xdabcf2['loginInPause']){_0x9d48bc[_0xbb59('0x29')](_['merge']({'channel':_0x2f67af,'type':'PAUSE','data1':_0xbb59('0x52')},_0x4852ce));}});return db[_0xbb59('0x40')][_0xbb59('0x53')](_0x193f23[_0xbb59('0x54')](_0x9d48bc),{'individualHooks':!![]});}})[_0xbb59('0x12')](function(){if(_0xdabcf2){return _0xdabcf2[_0xbb59('0x2d')]({'online':!![],'lastLoginAt':moment()[_0xbb59('0x25')](_0xbb59('0x26')),'voicePause':_0xdabcf2[_0xbb59('0x4d')]||![],'mailPause':_0xdabcf2['loginInPause']||![],'chatPause':_0xdabcf2['loginInPause']||![],'faxPause':_0xdabcf2[_0xbb59('0x4d')]||![],'smsPause':_0xdabcf2[_0xbb59('0x4d')]||![],'openchannelPause':_0xdabcf2[_0xbb59('0x4d')]||![],'pauseType':_0xdabcf2[_0xbb59('0x4d')]?_0xbb59('0x52'):null,'lastPauseAt':moment()[_0xbb59('0x25')](_0xbb59('0x26')),'interface':_0x3cc8de});}})[_0xbb59('0x12')](function(_0x4b4dd1){_0x2001f2(_0x4b4dd1);})[_0xbb59('0x16')](function(_0x1764eb){_0x193a7e(_0x2805b9[_0xbb59('0x1a')](0x1f4,_0x1764eb[_0xbb59('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 863edc5..fa8d9ed 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 _0xe0ae=['emit','removeListener','register','user:','./user.events','save','remove','update'];(function(_0x38c590,_0xd935b8){var _0x48300b=function(_0x2c8255){while(--_0x2c8255){_0x38c590['push'](_0x38c590['shift']());}};_0x48300b(++_0xd935b8);}(_0xe0ae,0x154));var _0xee0a=function(_0x5c619e,_0x1bccdf){_0x5c619e=_0x5c619e-0x0;var _0x445cf8=_0xe0ae[_0x5c619e];return _0x445cf8;};'use strict';var UserEvents=require(_0xee0a('0x0'));var events=[_0xee0a('0x1'),_0xee0a('0x2'),_0xee0a('0x3')];function createListener(_0x1bc6fd,_0xa2bdba){return function(_0x67ef49){_0xa2bdba[_0xee0a('0x4')](_0x1bc6fd,_0x67ef49);};}function removeListener(_0x5402e0,_0x2c5dc6){return function(){UserEvents[_0xee0a('0x5')](_0x5402e0,_0x2c5dc6);};}exports[_0xee0a('0x6')]=function(_0xd374bd){for(var _0x2d7b0b=0x0,_0x876297=events['length'];_0x2d7b0b<_0x876297;_0x2d7b0b++){var _0x56f5cf=events[_0x2d7b0b];var _0x201cc2=createListener(_0xee0a('0x7')+_0x56f5cf,_0xd374bd);UserEvents['on'](_0x56f5cf,_0x201cc2);}}; \ No newline at end of file +var _0xd2f4=['emit','removeListener','register','user:','./user.events','save','remove','update'];(function(_0x44dd97,_0x5c129f){var _0x49c6bd=function(_0xea590f){while(--_0xea590f){_0x44dd97['push'](_0x44dd97['shift']());}};_0x49c6bd(++_0x5c129f);}(_0xd2f4,0xb4));var _0x4d2f=function(_0x1a0091,_0x584590){_0x1a0091=_0x1a0091-0x0;var _0x119710=_0xd2f4[_0x1a0091];return _0x119710;};'use strict';var UserEvents=require(_0x4d2f('0x0'));var events=[_0x4d2f('0x1'),_0x4d2f('0x2'),_0x4d2f('0x3')];function createListener(_0x9c286a,_0x371339){return function(_0x3845b0){_0x371339[_0x4d2f('0x4')](_0x9c286a,_0x3845b0);};}function removeListener(_0x166744,_0x23f485){return function(){UserEvents[_0x4d2f('0x5')](_0x166744,_0x23f485);};}exports[_0x4d2f('0x6')]=function(_0x5e9684){for(var _0x3ffce8=0x0,_0x2e56fe=events['length'];_0x3ffce8<_0x2e56fe;_0x3ffce8++){var _0x5ab2f2=events[_0x3ffce8];var _0x1691b6=createListener(_0x4d2f('0x7')+_0x5ab2f2,_0x5e9684);UserEvents['on'](_0x5ab2f2,_0x1691b6);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f015084..dd0caa4 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x18b3d5,_0x2927a2){var _0x5602d6=function(_0x1cfe91){while(--_0x1cfe91){_0x18b3d5['push'](_0x18b3d5['shift']());}};_0x5602d6(++_0x2927a2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1e3dfe,_0x199c5d){var _0x914065=function(_0x39efc6){while(--_0x39efc6){_0x1e3dfe['push'](_0x1e3dfe['shift']());}};_0x914065(++_0x199c5d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index f7ef602..ec422bd 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 _0xa60a=['exports','sequelize'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0xa60a,0x13b));var _0xaa60=function(_0x3cab88,_0x3a9f47){_0x3cab88=_0x3cab88-0x0;var _0x58e15d=_0xa60a[_0x3cab88];return _0x58e15d;};'use strict';var Sequelize=require(_0xaa60('0x0'));module[_0xaa60('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0b09=['sequelize','exports'];(function(_0xddd806,_0x574abf){var _0x522acf=function(_0x1b2372){while(--_0x1b2372){_0xddd806['push'](_0xddd806['shift']());}};_0x522acf(++_0x574abf);}(_0x0b09,0x13c));var _0x90b0=function(_0x1da1b1,_0xebd18){_0x1da1b1=_0x1da1b1-0x0;var _0x2ffdeb=_0x0b09[_0x1da1b1];return _0x2ffdeb;};'use strict';var Sequelize=require(_0x90b0('0x0'));module[_0x90b0('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 79f2e4c..1c58c57 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 _0x5cf7=['rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','moment','bluebird','request-promise'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5cf7,0x145));var _0x75cf=function(_0x3158ec,_0xb45f74){_0x3158ec=_0x3158ec-0x0;var _0xdd0bf6=_0x5cf7[_0x3158ec];return _0xdd0bf6;};'use strict';var _=require(_0x75cf('0x0'));var util=require(_0x75cf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75cf('0x2'));var BPromise=require(_0x75cf('0x3'));var rp=require(_0x75cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75cf('0x5'));var config=require(_0x75cf('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x75cf('0x7')]=function(_0x5ba7fe,_0x25e78d){return _0x5ba7fe[_0x75cf('0x8')](_0x75cf('0x9'),attributes,{'tableName':_0x75cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc739=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','rimraf','../../config/environment','exports','define'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xc739,0x160));var _0x9c73=function(_0x436fa8,_0x1d9926){_0x436fa8=_0x436fa8-0x0;var _0x2b640e=_0xc739[_0x436fa8];return _0x2b640e;};'use strict';var _=require(_0x9c73('0x0'));var util=require(_0x9c73('0x1'));var logger=require(_0x9c73('0x2'))('api');var moment=require(_0x9c73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c73('0x4'));var config=require(_0x9c73('0x5'));var attributes=require('./userChatQueue.attributes');module[_0x9c73('0x6')]=function(_0x51b03b,_0x16478b){return _0x51b03b[_0x9c73('0x7')](_0x9c73('0x8'),attributes,{'tableName':_0x9c73('0x9'),'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 ba55937..46b1695 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 _0x330f=['request\x20sent','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0x330f,0x13e));var _0xf330=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x330f[_0x56740a];return _0x257144;};'use strict';var _=require('lodash');var util=require(_0xf330('0x0'));var moment=require('moment');var BPromise=require(_0xf330('0x1'));var rs=require(_0xf330('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf330('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf330('0x4'))(_0xf330('0x5'));var config=require('../../config/environment');var jayson=require(_0xf330('0x6'));var client=jayson[_0xf330('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd2eccb,_0x1eb42d,_0x1a30cd){return new BPromise(function(_0x5dd97d,_0x5e2814){return client[_0xf330('0x8')](_0xd2eccb,_0x1a30cd)[_0xf330('0x9')](function(_0x4b6f73){logger[_0xf330('0xa')](_0xf330('0xb'),_0x1eb42d,'request\x20sent');logger[_0xf330('0xc')](_0xf330('0xd'),_0x1eb42d,'request\x20sent',JSON[_0xf330('0xe')](_0x4b6f73));if(_0x4b6f73[_0xf330('0xf')]){if(_0x4b6f73[_0xf330('0xf')][_0xf330('0x10')]===0x1f4){logger[_0xf330('0xf')](_0xf330('0xb'),_0x1eb42d,_0x4b6f73[_0xf330('0xf')][_0xf330('0x11')]);return _0x5e2814(_0x4b6f73[_0xf330('0xf')][_0xf330('0x11')]);}logger[_0xf330('0xf')](_0xf330('0xb'),_0x1eb42d,_0x4b6f73[_0xf330('0xf')]['message']);return _0x5dd97d(_0x4b6f73[_0xf330('0xf')][_0xf330('0x11')]);}else{logger[_0xf330('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x1eb42d,_0xf330('0x12'));_0x5dd97d(_0x4b6f73[_0xf330('0x13')][_0xf330('0x11')]);}})[_0xf330('0x14')](function(_0x53348b){logger[_0xf330('0xf')](_0xf330('0xb'),_0x1eb42d,_0x53348b);_0x5e2814(_0x53348b);});});} \ No newline at end of file +var _0x9c95=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x111717,_0x156957){var _0x212339=function(_0x223b27){while(--_0x223b27){_0x111717['push'](_0x111717['shift']());}};_0x212339(++_0x156957);}(_0x9c95,0x1b0));var _0x59c9=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x9c95[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x59c9('0x0'));var util=require(_0x59c9('0x1'));var moment=require(_0x59c9('0x2'));var BPromise=require(_0x59c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x59c9('0x5'))(_0x59c9('0x6'));var config=require(_0x59c9('0x7'));var jayson=require(_0x59c9('0x8'));var client=jayson[_0x59c9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cb2d3,_0x2e834f,_0xd911f3){return new BPromise(function(_0x18d404,_0x262111){return client[_0x59c9('0xa')](_0x2cb2d3,_0xd911f3)[_0x59c9('0xb')](function(_0xd99bb5){logger['info'](_0x59c9('0xc'),_0x2e834f,_0x59c9('0xd'));logger[_0x59c9('0xe')](_0x59c9('0xf'),_0x2e834f,'request\x20sent',JSON[_0x59c9('0x10')](_0xd99bb5));if(_0xd99bb5[_0x59c9('0x11')]){if(_0xd99bb5['error'][_0x59c9('0x12')]===0x1f4){logger[_0x59c9('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x2e834f,_0xd99bb5[_0x59c9('0x11')][_0x59c9('0x13')]);return _0x262111(_0xd99bb5[_0x59c9('0x11')][_0x59c9('0x13')]);}logger['error'](_0x59c9('0xc'),_0x2e834f,_0xd99bb5['error'][_0x59c9('0x13')]);return _0x18d404(_0xd99bb5[_0x59c9('0x11')]['message']);}else{logger[_0x59c9('0x14')](_0x59c9('0xc'),_0x2e834f,_0x59c9('0xd'));_0x18d404(_0xd99bb5[_0x59c9('0x15')][_0x59c9('0x13')]);}})[_0x59c9('0x16')](function(_0x212cf3){logger[_0x59c9('0x11')](_0x59c9('0xc'),_0x2e834f,_0x212cf3);_0x262111(_0x212cf3);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2c8f4e8..7ac7407 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x161ac3,_0x142e49){var _0x3bb837=function(_0x269c7c){while(--_0x269c7c){_0x161ac3['push'](_0x161ac3['shift']());}};_0x3bb837(++_0x142e49);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2e30f9,_0x1274b0){var _0x53bf16=function(_0x19a921){while(--_0x19a921){_0x2e30f9['push'](_0x2e30f9['shift']());}};_0x53bf16(++_0x1274b0);}(_0xe706,0xa3));var _0x6e70=function(_0x5f20f0,_0x4cfb6d){_0x5f20f0=_0x5f20f0-0x0;var _0x16b5a2=_0xe706[_0x5f20f0];return _0x16b5a2;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 02f6f3e..a00015b 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 _0xa0bd=['INTEGER','STRING','sequelize','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa0bd,0x16a));var _0xda0b=function(_0x5a20a3,_0x1cf677){_0x5a20a3=_0x5a20a3-0x0;var _0x1b9dfe=_0xa0bd[_0x5a20a3];return _0x1b9dfe;};'use strict';var Sequelize=require(_0xda0b('0x0'));module[_0xda0b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xda0b('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xda0b('0x3')]}}; \ No newline at end of file +var _0x2a34=['exports','INTEGER','STRING','sequelize'];(function(_0x541f55,_0x34c13f){var _0x415874=function(_0x10c9e9){while(--_0x10c9e9){_0x541f55['push'](_0x541f55['shift']());}};_0x415874(++_0x34c13f);}(_0x2a34,0x19b));var _0x42a3=function(_0x3e12ca,_0x5247b6){_0x3e12ca=_0x3e12ca-0x0;var _0x42a242=_0x2a34[_0x3e12ca];return _0x42a242;};'use strict';var Sequelize=require(_0x42a3('0x0'));module[_0x42a3('0x1')]={'penalty':{'type':Sequelize[_0x42a3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x42a3('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x42a3('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a354595..1b90e29 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 _0xe59d=['./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1866ea,_0x547489){var _0x34f90a=function(_0x2b9a5c){while(--_0x2b9a5c){_0x1866ea['push'](_0x1866ea['shift']());}};_0x34f90a(++_0x547489);}(_0xe59d,0x1d8));var _0xde59=function(_0x422890,_0x434494){_0x422890=_0x422890-0x0;var _0x202cf0=_0xe59d[_0x422890];return _0x202cf0;};'use strict';var _=require(_0xde59('0x0'));var util=require(_0xde59('0x1'));var logger=require(_0xde59('0x2'))(_0xde59('0x3'));var moment=require(_0xde59('0x4'));var BPromise=require(_0xde59('0x5'));var rp=require(_0xde59('0x6'));var fs=require('fs');var path=require(_0xde59('0x7'));var rimraf=require('rimraf');var config=require(_0xde59('0x8'));var attributes=require(_0xde59('0x9'));module[_0xde59('0xa')]=function(_0x9ddbaa,_0x1cdae8){return _0x9ddbaa[_0xde59('0xb')](_0xde59('0xc'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5276=['../../config/logger','api','bluebird','request-promise','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util'];(function(_0x333243,_0x2c4c13){var _0x4ecf85=function(_0x22aa50){while(--_0x22aa50){_0x333243['push'](_0x333243['shift']());}};_0x4ecf85(++_0x2c4c13);}(_0x5276,0x16a));var _0x6527=function(_0x233fc5,_0x37596a){_0x233fc5=_0x233fc5-0x0;var _0x59bacb=_0x5276[_0x233fc5];return _0x59bacb;};'use strict';var _=require('lodash');var util=require(_0x6527('0x0'));var logger=require(_0x6527('0x1'))(_0x6527('0x2'));var moment=require('moment');var BPromise=require(_0x6527('0x3'));var rp=require(_0x6527('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6527('0x5'));var config=require('../../config/environment');var attributes=require(_0x6527('0x6'));module[_0x6527('0x7')]=function(_0x4a1ae5,_0xc3e97d){return _0x4a1ae5[_0x6527('0x8')](_0x6527('0x9'),attributes,{'tableName':_0x6527('0xa'),'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 8b2218a..dfdf482 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 _0x9207=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','request\x20sent','result','lodash','moment'];(function(_0x395866,_0x21119c){var _0xeedfea=function(_0x28507d){while(--_0x28507d){_0x395866['push'](_0x395866['shift']());}};_0xeedfea(++_0x21119c);}(_0x9207,0x140));var _0x7920=function(_0x57f4de,_0x57c7ae){_0x57f4de=_0x57f4de-0x0;var _0x1edd7b=_0x9207[_0x57f4de];return _0x1edd7b;};'use strict';var _=require(_0x7920('0x0'));var util=require('util');var moment=require(_0x7920('0x1'));var BPromise=require(_0x7920('0x2'));var rs=require(_0x7920('0x3'));var fs=require('fs');var Redis=require(_0x7920('0x4'));var db=require(_0x7920('0x5'))['db'];var utils=require(_0x7920('0x6'));var logger=require(_0x7920('0x7'))(_0x7920('0x8'));var config=require(_0x7920('0x9'));var jayson=require(_0x7920('0xa'));var client=jayson['client'][_0x7920('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x500202,_0x203b65,_0x137ac7){return new BPromise(function(_0x2c46aa,_0x51f7d0){return client['request'](_0x500202,_0x137ac7)[_0x7920('0xc')](function(_0x4282eb){logger[_0x7920('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x203b65,'request\x20sent');logger[_0x7920('0xe')](_0x7920('0xf'),_0x203b65,'request\x20sent',JSON[_0x7920('0x10')](_0x4282eb));if(_0x4282eb[_0x7920('0x11')]){if(_0x4282eb[_0x7920('0x11')][_0x7920('0x12')]===0x1f4){logger[_0x7920('0x11')](_0x7920('0x13'),_0x203b65,_0x4282eb[_0x7920('0x11')]['message']);return _0x51f7d0(_0x4282eb[_0x7920('0x11')]['message']);}logger[_0x7920('0x11')](_0x7920('0x13'),_0x203b65,_0x4282eb['error']['message']);return _0x2c46aa(_0x4282eb['error'][_0x7920('0x14')]);}else{logger[_0x7920('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x203b65,_0x7920('0x15'));_0x2c46aa(_0x4282eb[_0x7920('0x16')][_0x7920('0x14')]);}})['catch'](function(_0x2ade3a){logger[_0x7920('0x11')](_0x7920('0x13'),_0x203b65,_0x2ade3a);_0x51f7d0(_0x2ade3a);});});} \ No newline at end of file +var _0x909d=['client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x909d,0x1f1));var _0xd909=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x909d[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0xd909('0x0'));var util=require(_0xd909('0x1'));var moment=require(_0xd909('0x2'));var BPromise=require(_0xd909('0x3'));var rs=require(_0xd909('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd909('0x5'));var logger=require('../../config/logger')(_0xd909('0x6'));var config=require(_0xd909('0x7'));var jayson=require(_0xd909('0x8'));var client=jayson[_0xd909('0x9')][_0xd909('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3850e5,_0x1097b1,_0x2c1394){return new BPromise(function(_0x39fe53,_0x1b15e1){return client[_0xd909('0xb')](_0x3850e5,_0x2c1394)[_0xd909('0xc')](function(_0x12a9b9){logger[_0xd909('0xd')](_0xd909('0xe'),_0x1097b1,'request\x20sent');logger[_0xd909('0xf')](_0xd909('0x10'),_0x1097b1,_0xd909('0x11'),JSON[_0xd909('0x12')](_0x12a9b9));if(_0x12a9b9[_0xd909('0x13')]){if(_0x12a9b9[_0xd909('0x13')]['code']===0x1f4){logger[_0xd909('0x13')](_0xd909('0xe'),_0x1097b1,_0x12a9b9['error']['message']);return _0x1b15e1(_0x12a9b9['error'][_0xd909('0x14')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x1097b1,_0x12a9b9['error'][_0xd909('0x14')]);return _0x39fe53(_0x12a9b9['error'][_0xd909('0x14')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x1097b1,'request\x20sent');_0x39fe53(_0x12a9b9[_0xd909('0x15')]['message']);}})[_0xd909('0x16')](function(_0xd267ea){logger[_0xd909('0x13')](_0xd909('0xe'),_0x1097b1,_0xd267ea);_0x1b15e1(_0xd267ea);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 5a3662c..ec18e86 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5e5cb0,_0x5a4772){var _0x362a0f=function(_0x33e487){while(--_0x33e487){_0x5e5cb0['push'](_0x5e5cb0['shift']());}};_0x362a0f(++_0x5a4772);}(_0x70e0,0x17b));var _0x070e=function(_0x1d66b1,_0x37d738){_0x1d66b1=_0x1d66b1-0x0;var _0x5c0480=_0x70e0[_0x1d66b1];return _0x5c0480;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x370dca,_0x5aaf09){var _0x471b05=function(_0x36494e){while(--_0x36494e){_0x370dca['push'](_0x370dca['shift']());}};_0x471b05(++_0x5aaf09);}(_0x70e0,0x17b));var _0x070e=function(_0x5dba6e,_0x59f1bd){_0x5dba6e=_0x5dba6e-0x0;var _0x151b80=_0x70e0[_0x5dba6e];return _0x151b80;};'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 598d0ad..1ac2cc8 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 _0x683c=['INTEGER'];(function(_0x5dcca6,_0x1672e8){var _0x178cae=function(_0x3f2ef0){while(--_0x3f2ef0){_0x5dcca6['push'](_0x5dcca6['shift']());}};_0x178cae(++_0x1672e8);}(_0x683c,0xac));var _0xc683=function(_0x5cd81c,_0x58a809){_0x5cd81c=_0x5cd81c-0x0;var _0x23576a=_0x683c[_0x5cd81c];return _0x23576a;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xc683('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbf7=['sequelize','exports','INTEGER'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x30720e,_0x55753f){_0x30720e=_0x30720e-0x0;var _0x5674ac=_0xdbf7[_0x30720e];return _0x5674ac;};'use strict';var Sequelize=require(_0x7dbf('0x0'));module[_0x7dbf('0x1')]={'penalty':{'type':Sequelize[_0x7dbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 1b8ee15..6edefe4 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 _0x8fba=['./userMailQueue.attributes','exports','UserMailQueue','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x8fba,0x1e7));var _0xa8fb=function(_0xda2472,_0x52bbff){_0xda2472=_0xda2472-0x0;var _0x4b633d=_0x8fba[_0xda2472];return _0x4b633d;};'use strict';var _=require('lodash');var util=require(_0xa8fb('0x0'));var logger=require('../../config/logger')(_0xa8fb('0x1'));var moment=require(_0xa8fb('0x2'));var BPromise=require(_0xa8fb('0x3'));var rp=require(_0xa8fb('0x4'));var fs=require('fs');var path=require(_0xa8fb('0x5'));var rimraf=require(_0xa8fb('0x6'));var config=require(_0xa8fb('0x7'));var attributes=require(_0xa8fb('0x8'));module[_0xa8fb('0x9')]=function(_0x290809,_0x12622c){return _0x290809['define'](_0xa8fb('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec3a=['./userMailQueue.attributes','user_has_mail_queues','lodash','util','api','moment','request-promise','path'];(function(_0x2f1a76,_0x3b3469){var _0x3c46a9=function(_0x2336e6){while(--_0x2336e6){_0x2f1a76['push'](_0x2f1a76['shift']());}};_0x3c46a9(++_0x3b3469);}(_0xec3a,0x82));var _0xaec3=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xec3a[_0x455c6c];return _0x488242;};'use strict';var _=require(_0xaec3('0x0'));var util=require(_0xaec3('0x1'));var logger=require('../../config/logger')(_0xaec3('0x2'));var moment=require(_0xaec3('0x3'));var BPromise=require('bluebird');var rp=require(_0xaec3('0x4'));var fs=require('fs');var path=require(_0xaec3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaec3('0x6'));module['exports']=function(_0x169638,_0x501b93){return _0x169638['define']('UserMailQueue',attributes,{'tableName':_0xaec3('0x7'),'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 7bed3a9..9228d68 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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x008c,0x188));var _0xc008=function(_0x3c0a36,_0x8e2f2b){_0x3c0a36=_0x3c0a36-0x0;var _0x5ac4cb=_0x008c[_0x3c0a36];return _0x5ac4cb;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x121fb6,_0x352cb5){var _0x5de21b=function(_0x380164){while(--_0x380164){_0x121fb6['push'](_0x121fb6['shift']());}};_0x5de21b(++_0x352cb5);}(_0x6aa7,0x178));var _0x76aa=function(_0x10ffa3,_0x536569){_0x10ffa3=_0x10ffa3-0x0;var _0x309948=_0x6aa7[_0x10ffa3];return _0x309948;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index d35a8ce..5146bc0 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 _0x61bf=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','exports','util','path'];(function(_0x2b626a,_0x5e9d1c){var _0x19f1eb=function(_0x537720){while(--_0x537720){_0x2b626a['push'](_0x2b626a['shift']());}};_0x19f1eb(++_0x5e9d1c);}(_0x61bf,0x1f2));var _0xf61b=function(_0x5f07b9,_0x52f06d){_0x5f07b9=_0x5f07b9-0x0;var _0x24fb1e=_0x61bf[_0x5f07b9];return _0x24fb1e;};'use strict';var multer=require('multer');var util=require(_0xf61b('0x0'));var path=require(_0xf61b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf61b('0x2')]();var fs_extra=require(_0xf61b('0x3'));var auth=require(_0xf61b('0x4'));var interaction=require(_0xf61b('0x5'));var config=require(_0xf61b('0x6'));var controller=require(_0xf61b('0x7'));router['post']('/',auth[_0xf61b('0x8')](),controller['sendUserNotification']);module[_0xf61b('0x9')]=router; \ No newline at end of file +var _0x76cb=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated'];(function(_0x4fe5a7,_0x147749){var _0x4800ef=function(_0x97c8e8){while(--_0x97c8e8){_0x4fe5a7['push'](_0x4fe5a7['shift']());}};_0x4800ef(++_0x147749);}(_0x76cb,0x9a));var _0xb76c=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x76cb[_0x1304c6];return _0x2e6654;};'use strict';var multer=require(_0xb76c('0x0'));var util=require('util');var path=require(_0xb76c('0x1'));var timeout=require(_0xb76c('0x2'));var express=require(_0xb76c('0x3'));var router=express[_0xb76c('0x4')]();var fs_extra=require(_0xb76c('0x5'));var auth=require(_0xb76c('0x6'));var interaction=require(_0xb76c('0x7'));var config=require('../../config/environment');var controller=require(_0xb76c('0x8'));router[_0xb76c('0x9')]('/',auth[_0xb76c('0xa')](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 2d93cd1..e8a07f3 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 _0x8737=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x8737,0x7a));var _0x7873=function(_0x357f22,_0x238e08){_0x357f22=_0x357f22-0x0;var _0x34dd5c=_0x8737[_0x357f22];return _0x34dd5c;};'use strict';var Sequelize=require(_0x7873('0x0'));module['exports']={'body':{'type':Sequelize[_0x7873('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x7873('0x1')]},'recipientsDescription':{'type':Sequelize[_0x7873('0x2')]},'beep':{'type':Sequelize[_0x7873('0x3')]}}; \ No newline at end of file +var _0x562b=['TEXT','STRING','exports'];(function(_0x3e7817,_0x287be1){var _0x14e9f2=function(_0x388d51){while(--_0x388d51){_0x3e7817['push'](_0x3e7817['shift']());}};_0x14e9f2(++_0x287be1);}(_0x562b,0x19d));var _0xb562=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x562b[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require('sequelize');module[_0xb562('0x0')]={'body':{'type':Sequelize[_0xb562('0x1')]},'senderName':{'type':Sequelize[_0xb562('0x2')]},'recipientsId':{'type':Sequelize[_0xb562('0x1')]},'recipientsDescription':{'type':Sequelize[_0xb562('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index ab0fc6a..9d1e447 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 _0xdea7=['userNotification:send','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','forEach','startCase','toLowerCase','User','ids','queue','replace','all','union','getAgents','map','zip-dir','fast-json-patch','util','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','senderName','user','fullname','recipientsDescription','isEmpty','beep','recipientsId','join','sequelize','UserNotification','recipient','emit'];(function(_0x2b2ba7,_0x578e13){var _0x127046=function(_0x30deb6){while(--_0x30deb6){_0x2b2ba7['push'](_0x2b2ba7['shift']());}};_0x127046(++_0x578e13);}(_0xdea7,0x1ec));var _0x7dea=function(_0x5bf655,_0x3c737e){_0x5bf655=_0x5bf655-0x0;var _0x592c7a=_0xdea7[_0x5bf655];return _0x592c7a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7dea('0x0'));var jsonpatch=require(_0x7dea('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7dea('0x2'));var path=require('path');var sox=require(_0x7dea('0x3'));var csv=require('to-csv');var ejs=require(_0x7dea('0x4'));var fs=require('fs');var fs_extra=require(_0x7dea('0x5'));var _=require(_0x7dea('0x6'));var squel=require('squel');var crypto=require(_0x7dea('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x7dea('0x8'));var toCsv=require('to-csv');var querystring=require(_0x7dea('0x9'));var Papa=require('papaparse');var Redis=require(_0x7dea('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x7dea('0xb'));var as=require(_0x7dea('0xc'));var hardwareService=require(_0x7dea('0xd'));var logger=require(_0x7dea('0xe'))(_0x7dea('0xf'));var utils=require(_0x7dea('0x10'));var config=require(_0x7dea('0x11'));var licenseUtil=require(_0x7dea('0x12'));var db=require(_0x7dea('0x13'))['db'];config[_0x7dea('0x14')]=_[_0x7dea('0x15')](config['redis'],{'host':_0x7dea('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7dea('0x17'))[_0x7dea('0x18')](socket);function respondWithStatusCode(_0x582eb1,_0x3f556b){_0x3f556b=_0x3f556b||0xcc;return function(_0x235506){if(_0x235506){return _0x582eb1['sendStatus'](_0x3f556b);}return _0x582eb1[_0x7dea('0x19')](_0x3f556b)[_0x7dea('0x1a')]();};}function respondWithResult(_0x3ec9d8,_0x14d66e){_0x14d66e=_0x14d66e||0xc8;return function(_0x3e5acd){if(_0x3e5acd){return _0x3ec9d8[_0x7dea('0x19')](_0x14d66e)[_0x7dea('0x1b')](_0x3e5acd);}};}function respondWithFilteredResult(_0xf1d14e,_0xf83555){return function(_0xd096d6){if(_0xd096d6){var _0x43a111=typeof _0xf83555[_0x7dea('0x1c')]===_0x7dea('0x1d')&&typeof _0xf83555['limit']==='undefined';var _0x3435c5=_0xd096d6[_0x7dea('0x1e')];var _0x57d1b8=_0x43a111?0x0:_0xf83555['offset'];var _0x56c091=_0x43a111?_0xd096d6[_0x7dea('0x1e')]:_0xf83555['offset']+_0xf83555[_0x7dea('0x1f')];var _0x4e9544;if(_0x56c091>=_0x3435c5){_0x56c091=_0x3435c5;_0x4e9544=0xc8;}else{_0x4e9544=0xce;}_0xf1d14e[_0x7dea('0x19')](_0x4e9544);return _0xf1d14e['set'](_0x7dea('0x20'),_0x57d1b8+'-'+_0x56c091+'/'+_0x3435c5)[_0x7dea('0x1b')](_0xd096d6);}return null;};}function patchUpdates(_0x46ffcf){return function(_0x1824a1){try{jsonpatch[_0x7dea('0x21')](_0x1824a1,_0x46ffcf,!![]);}catch(_0xd15ce2){return BPromise['reject'](_0xd15ce2);}return _0x1824a1[_0x7dea('0x22')]();};}function saveUpdates(_0x110c7e,_0x3f20bd){return function(_0xb2f8a8){if(_0xb2f8a8){return _0xb2f8a8[_0x7dea('0x23')](_0x110c7e)[_0x7dea('0x24')](function(_0x26897d){return _0x26897d;});}return null;};}function removeEntity(_0xba82c0,_0x3c8d88){return function(_0x398ed3){if(_0x398ed3){return _0x398ed3['destroy']()[_0x7dea('0x24')](function(){_0xba82c0[_0x7dea('0x19')](0xcc)[_0x7dea('0x1a')]();});}};}function handleEntityNotFound(_0x3ef495,_0x522d6a){return function(_0x13cac7){if(!_0x13cac7){_0x3ef495[_0x7dea('0x25')](0x194);}return _0x13cac7;};}function handleError(_0x377f89,_0x3bcdd6){_0x3bcdd6=_0x3bcdd6||0x1f4;return function(_0x2eaec8){logger[_0x7dea('0x26')](_0x2eaec8[_0x7dea('0x27')]);if(_0x2eaec8[_0x7dea('0x28')]){delete _0x2eaec8[_0x7dea('0x28')];}_0x377f89[_0x7dea('0x19')](_0x3bcdd6)[_0x7dea('0x29')](_0x2eaec8);};}exports[_0x7dea('0x2a')]=function(_0x106da5,_0xdd503a,_0x5bb63b){if(!_0x106da5[_0x7dea('0x2b')][_0x7dea('0x2c')](_0x7dea('0x2d'))&&!_0x106da5['body'][_0x7dea('0x2c')](_0x7dea('0x2e'))){throw new db[(_0x7dea('0x2f'))][(_0x7dea('0x30'))](_0x7dea('0x31'));}else{if(_0x106da5['body'][_0x7dea('0x2c')](_0x7dea('0x2e'))&&!_0x106da5[_0x7dea('0x2b')]['hasOwnProperty'](_0x7dea('0x32'))){throw new db[(_0x7dea('0x2f'))][(_0x7dea('0x30'))](_0x7dea('0x33'));}if(!_0x106da5[_0x7dea('0x2b')]['hasOwnProperty'](_0x7dea('0x34'))){throw new db['Sequelize'][(_0x7dea('0x30'))](_0x7dea('0x35'));}else{try{var _0x327867=JSON[_0x7dea('0x36')](_0x106da5[_0x7dea('0x2b')][_0x7dea('0x34')]);}catch(_0x4ca809){logger['error'](_0x4ca809);throw new db[(_0x7dea('0x2f'))][(_0x7dea('0x30'))](_0x7dea('0x37'));}var _0x478c13=[_0x7dea('0x38'),_0x7dea('0x39'),_0x7dea('0x3a'),'openchannelqueue',_0x7dea('0x3b'),_0x7dea('0x3c'),_0x7dea('0x3d'),_0x7dea('0x3e'),'user'];if(_[_0x7dea('0x3f')](_0x327867,function(_0x47337d){return!_[_0x7dea('0x40')](_0x478c13,_0x47337d[_0x7dea('0x41')]['toLowerCase']());})){throw new db[(_0x7dea('0x2f'))][(_0x7dea('0x30'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x17d051={};_0x17d051[_0x7dea('0x42')]=_0x106da5[_0x7dea('0x2b')][_0x7dea('0x2c')](_0x7dea('0x42'))?_0x106da5[_0x7dea('0x2b')][_0x7dea('0x42')]:_0x106da5[_0x7dea('0x43')][_0x7dea('0x44')];_0x17d051[_0x7dea('0x45')]=_[_0x7dea('0x46')](_0x106da5[_0x7dea('0x2b')]['recipientsDescription'])?null:_0x106da5[_0x7dea('0x2b')][_0x7dea('0x45')];_0x17d051[_0x7dea('0x47')]=_0x106da5[_0x7dea('0x2b')]['beep']||![];_0x17d051['SenderId']=_0x106da5[_0x7dea('0x43')]['id'];return getContent(_0x106da5['body'])[_0x7dea('0x24')](function(_0x22950a){_0x17d051['body']=_0x22950a;return getRecipients(_0x327867);})[_0x7dea('0x24')](function(_0x4d1e01){_0x17d051[_0x7dea('0x48')]=_['sortBy'](_0x4d1e01)[_0x7dea('0x49')](',');return db[_0x7dea('0x4a')]['transaction'](function(_0x4fcb8c){return db[_0x7dea('0x4b')]['create'](_0x17d051,{'raw':!![],'transaction':_0x4fcb8c})[_0x7dea('0x24')](function(_0x3c105e){var _0xace64d={'sender':_0x17d051[_0x7dea('0x42')],'description':_0x17d051[_0x7dea('0x45')],'content':_0x17d051[_0x7dea('0x2b')],'beep':_0x17d051[_0x7dea('0x47')]};_0x4d1e01['forEach'](function(_0x171243){_0xace64d[_0x7dea('0x4c')]=_0x171243;socket[_0x7dea('0x4d')](_0x7dea('0x4e'),_0xace64d);});return _0x3c105e;});});})[_0x7dea('0x24')](respondWithResult(_0xdd503a,0xc9))[_0x7dea('0x4f')](handleError(_0xdd503a,null));};function getContent(_0x587761){return new BPromise(function(_0x54547a,_0x31cfdb){if(_0x587761[_0x7dea('0x2d')]){_0x54547a(_0x587761[_0x7dea('0x2d')]);return;}return db['Template'][_0x7dea('0x50')]({'attributes':['html'],'where':{'id':_0x587761['TemplateId']},'raw':!![]})['then'](function(_0x144128){if(!_0x144128)throw new db[(_0x7dea('0x2f'))][(_0x7dea('0x30'))](_0x7dea('0x51'));var _0xdf7e50=Mustache[_0x7dea('0x52')](_0x144128[_0x7dea('0x53')],_0x587761[_0x7dea('0x32')]);_0x54547a(_0xdf7e50);})[_0x7dea('0x4f')](function(_0x2baf32){_0x31cfdb(_0x2baf32);});});}function getRecipients(_0x5617f8){return new BPromise(function(_0x1da355,_0x17755b){var _0x156e2d=[];var _0x112b46=[];_0x5617f8[_0x7dea('0x54')](function(_0xca47cf){var _0x2e0c10=_[_0x7dea('0x55')](_0xca47cf[_0x7dea('0x41')][_0x7dea('0x56')]());if(_0x2e0c10===_0x7dea('0x57')){_0x156e2d=_['union'](_0x156e2d,_0xca47cf[_0x7dea('0x58')]);}else{if(_[_0x7dea('0x40')](_0x2e0c10,_0x7dea('0x59')))_0x2e0c10=_0x2e0c10[_0x7dea('0x5a')](_0x7dea('0x59'),'Queue');_0xca47cf[_0x7dea('0x58')][_0x7dea('0x54')](function(_0x393907){_0x112b46['push'](getAgents(_0x2e0c10,_0x393907));});}});return BPromise[_0x7dea('0x5b')](_0x112b46)[_0x7dea('0x24')](function(_0x42b104){_0x156e2d=_[_0x7dea('0x5c')](_0x156e2d,_['flatten'](_0x42b104));_0x1da355(_0x156e2d);})[_0x7dea('0x4f')](function(_0xe1e35d){_0x17755b(_0xe1e35d);});});}function getAgents(_0x1b0200,_0x1c92ec){return new BPromise(function(_0x4c2e0c,_0x112c0){return db[_0x1b0200]['findOne']({'where':{'id':_0x1c92ec}})[_0x7dea('0x24')](function(_0x3f6959){return _0x3f6959[_0x7dea('0x5d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x43e92c){var _0x2a4684=_[_0x7dea('0x5e')](_0x43e92c,'id');_0x4c2e0c(_0x2a4684);});})[_0x7dea('0x4f')](function(_0x254c8d){_0x112c0(_0x254c8d);});});} \ No newline at end of file +var _0x303c=['rimraf','zip-dir','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','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','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','apply','reject','update','then','destroy','error','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','recipientsId','join','sequelize','transaction','create','forEach','recipient','userNotification:send','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','union','ids','queue','replace','Queue','all','map','eml-format'];(function(_0xae35cc,_0x36272a){var _0x4244c5=function(_0x8e8344){while(--_0x8e8344){_0xae35cc['push'](_0xae35cc['shift']());}};_0x4244c5(++_0x36272a);}(_0x303c,0x1e4));var _0xc303=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0x303c[_0x3b16e1];return _0x311d1b;};'use strict';var emlformat=require(_0xc303('0x0'));var rimraf=require(_0xc303('0x1'));var zipdir=require(_0xc303('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc303('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc303('0x4'));var util=require('util');var path=require(_0xc303('0x5'));var sox=require(_0xc303('0x6'));var csv=require('to-csv');var ejs=require(_0xc303('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc303('0x8'));var squel=require(_0xc303('0x9'));var crypto=require(_0xc303('0xa'));var jsforce=require(_0xc303('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc303('0xc'));var querystring=require(_0xc303('0xd'));var Papa=require(_0xc303('0xe'));var Redis=require(_0xc303('0xf'));var authService=require(_0xc303('0x10'));var qs=require(_0xc303('0x11'));var as=require(_0xc303('0x12'));var hardwareService=require(_0xc303('0x13'));var logger=require('../../config/logger')(_0xc303('0x14'));var utils=require(_0xc303('0x15'));var config=require(_0xc303('0x16'));var licenseUtil=require(_0xc303('0x17'));var db=require(_0xc303('0x18'))['db'];config[_0xc303('0x19')]=_['defaults'](config['redis'],{'host':_0xc303('0x1a'),'port':0x18eb});var socket=require(_0xc303('0x1b'))(new Redis(config[_0xc303('0x19')]));require(_0xc303('0x1c'))[_0xc303('0x1d')](socket);function respondWithStatusCode(_0x152ca9,_0x57ebfa){_0x57ebfa=_0x57ebfa||0xcc;return function(_0x43d2f9){if(_0x43d2f9){return _0x152ca9[_0xc303('0x1e')](_0x57ebfa);}return _0x152ca9[_0xc303('0x1f')](_0x57ebfa)[_0xc303('0x20')]();};}function respondWithResult(_0x141001,_0x56e62f){_0x56e62f=_0x56e62f||0xc8;return function(_0xab1105){if(_0xab1105){return _0x141001['status'](_0x56e62f)[_0xc303('0x21')](_0xab1105);}};}function respondWithFilteredResult(_0x5e9249,_0x5024b9){return function(_0x4fa116){if(_0x4fa116){var _0x454a7d=typeof _0x5024b9['offset']==='undefined'&&typeof _0x5024b9[_0xc303('0x22')]===_0xc303('0x23');var _0x1eb5c6=_0x4fa116['count'];var _0x4a1500=_0x454a7d?0x0:_0x5024b9['offset'];var _0x342b99=_0x454a7d?_0x4fa116[_0xc303('0x24')]:_0x5024b9[_0xc303('0x25')]+_0x5024b9[_0xc303('0x22')];var _0x5ba14b;if(_0x342b99>=_0x1eb5c6){_0x342b99=_0x1eb5c6;_0x5ba14b=0xc8;}else{_0x5ba14b=0xce;}_0x5e9249[_0xc303('0x1f')](_0x5ba14b);return _0x5e9249['set']('Content-Range',_0x4a1500+'-'+_0x342b99+'/'+_0x1eb5c6)[_0xc303('0x21')](_0x4fa116);}return null;};}function patchUpdates(_0x2215eb){return function(_0x4d9bde){try{jsonpatch[_0xc303('0x26')](_0x4d9bde,_0x2215eb,!![]);}catch(_0x4a75ab){return BPromise[_0xc303('0x27')](_0x4a75ab);}return _0x4d9bde['save']();};}function saveUpdates(_0x586703,_0x52e4a5){return function(_0x6b48e3){if(_0x6b48e3){return _0x6b48e3[_0xc303('0x28')](_0x586703)[_0xc303('0x29')](function(_0x23bc61){return _0x23bc61;});}return null;};}function removeEntity(_0x2b4b13,_0x259f53){return function(_0x4db4ad){if(_0x4db4ad){return _0x4db4ad[_0xc303('0x2a')]()[_0xc303('0x29')](function(){_0x2b4b13[_0xc303('0x1f')](0xcc)[_0xc303('0x20')]();});}};}function handleEntityNotFound(_0x3fe24c,_0x11a059){return function(_0x53125a){if(!_0x53125a){_0x3fe24c[_0xc303('0x1e')](0x194);}return _0x53125a;};}function handleError(_0x394c1f,_0x5aaef7){_0x5aaef7=_0x5aaef7||0x1f4;return function(_0x3047b2){logger[_0xc303('0x2b')](_0x3047b2['stack']);if(_0x3047b2[_0xc303('0x2c')]){delete _0x3047b2[_0xc303('0x2c')];}_0x394c1f[_0xc303('0x1f')](_0x5aaef7)[_0xc303('0x2d')](_0x3047b2);};}exports['sendUserNotification']=function(_0x23f40e,_0x1807e0,_0x3d72f3){if(!_0x23f40e[_0xc303('0x2e')][_0xc303('0x2f')](_0xc303('0x30'))&&!_0x23f40e[_0xc303('0x2e')][_0xc303('0x2f')](_0xc303('0x31'))){throw new db[(_0xc303('0x32'))][(_0xc303('0x33'))](_0xc303('0x34'));}else{if(_0x23f40e['body'][_0xc303('0x2f')]('TemplateId')&&!_0x23f40e[_0xc303('0x2e')][_0xc303('0x2f')](_0xc303('0x35'))){throw new db[(_0xc303('0x32'))][(_0xc303('0x33'))](_0xc303('0x36'));}if(!_0x23f40e[_0xc303('0x2e')][_0xc303('0x2f')](_0xc303('0x37'))){throw new db[(_0xc303('0x32'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5c80b2=JSON[_0xc303('0x38')](_0x23f40e['body'][_0xc303('0x37')]);}catch(_0x59c5a9){logger['error'](_0x59c5a9);throw new db[(_0xc303('0x32'))]['ValidationError'](_0xc303('0x39'));}var _0x18e4e1=[_0xc303('0x3a'),_0xc303('0x3b'),_0xc303('0x3c'),_0xc303('0x3d'),_0xc303('0x3e'),_0xc303('0x3f'),_0xc303('0x40'),_0xc303('0x41'),_0xc303('0x42')];if(_[_0xc303('0x43')](_0x5c80b2,function(_0x15a9c8){return!_['includes'](_0x18e4e1,_0x15a9c8[_0xc303('0x44')][_0xc303('0x45')]());})){throw new db[(_0xc303('0x32'))][(_0xc303('0x33'))](_0xc303('0x46'));}}}var _0x40ff5c={};_0x40ff5c[_0xc303('0x47')]=_0x23f40e[_0xc303('0x2e')][_0xc303('0x2f')](_0xc303('0x47'))?_0x23f40e['body'][_0xc303('0x47')]:_0x23f40e[_0xc303('0x42')]['fullname'];_0x40ff5c['recipientsDescription']=_[_0xc303('0x48')](_0x23f40e[_0xc303('0x2e')]['recipientsDescription'])?null:_0x23f40e[_0xc303('0x2e')][_0xc303('0x49')];_0x40ff5c[_0xc303('0x4a')]=_0x23f40e['body'][_0xc303('0x4a')]||![];_0x40ff5c['SenderId']=_0x23f40e[_0xc303('0x42')]['id'];return getContent(_0x23f40e['body'])[_0xc303('0x29')](function(_0x28b4a4){_0x40ff5c[_0xc303('0x2e')]=_0x28b4a4;return getRecipients(_0x5c80b2);})[_0xc303('0x29')](function(_0x101630){_0x40ff5c[_0xc303('0x4b')]=_['sortBy'](_0x101630)[_0xc303('0x4c')](',');return db[_0xc303('0x4d')][_0xc303('0x4e')](function(_0x4a080e){return db['UserNotification'][_0xc303('0x4f')](_0x40ff5c,{'raw':!![],'transaction':_0x4a080e})[_0xc303('0x29')](function(_0x566bac){var _0xd46146={'sender':_0x40ff5c[_0xc303('0x47')],'description':_0x40ff5c['recipientsDescription'],'content':_0x40ff5c['body'],'beep':_0x40ff5c[_0xc303('0x4a')]};_0x101630[_0xc303('0x50')](function(_0x484cb5){_0xd46146[_0xc303('0x51')]=_0x484cb5;socket['emit'](_0xc303('0x52'),_0xd46146);});return _0x566bac;});});})[_0xc303('0x29')](respondWithResult(_0x1807e0,0xc9))['catch'](handleError(_0x1807e0,null));};function getContent(_0x1b2fb4){return new BPromise(function(_0x117f71,_0x372f8b){if(_0x1b2fb4[_0xc303('0x30')]){_0x117f71(_0x1b2fb4[_0xc303('0x30')]);return;}return db['Template'][_0xc303('0x53')]({'attributes':[_0xc303('0x54')],'where':{'id':_0x1b2fb4[_0xc303('0x31')]},'raw':!![]})['then'](function(_0x1d58e4){if(!_0x1d58e4)throw new db['Sequelize'][(_0xc303('0x33'))](_0xc303('0x55'));var _0x2f6421=Mustache[_0xc303('0x56')](_0x1d58e4['html'],_0x1b2fb4[_0xc303('0x35')]);_0x117f71(_0x2f6421);})[_0xc303('0x57')](function(_0x40c037){_0x372f8b(_0x40c037);});});}function getRecipients(_0x129b48){return new BPromise(function(_0x3e3d1c,_0x39268d){var _0x2fac34=[];var _0x1ddc97=[];_0x129b48[_0xc303('0x50')](function(_0x33e3d6){var _0x512f0d=_[_0xc303('0x58')](_0x33e3d6['model']['toLowerCase']());if(_0x512f0d===_0xc303('0x59')){_0x2fac34=_[_0xc303('0x5a')](_0x2fac34,_0x33e3d6[_0xc303('0x5b')]);}else{if(_['includes'](_0x512f0d,_0xc303('0x5c')))_0x512f0d=_0x512f0d[_0xc303('0x5d')](_0xc303('0x5c'),_0xc303('0x5e'));_0x33e3d6[_0xc303('0x5b')][_0xc303('0x50')](function(_0x549d2b){_0x1ddc97['push'](getAgents(_0x512f0d,_0x549d2b));});}});return BPromise[_0xc303('0x5f')](_0x1ddc97)[_0xc303('0x29')](function(_0x1b67dc){_0x2fac34=_['union'](_0x2fac34,_['flatten'](_0x1b67dc));_0x3e3d1c(_0x2fac34);})[_0xc303('0x57')](function(_0x34582c){_0x39268d(_0x34582c);});});}function getAgents(_0x36b004,_0x4fd236){return new BPromise(function(_0x493ea9,_0x382938){return db[_0x36b004][_0xc303('0x53')]({'where':{'id':_0x4fd236}})['then'](function(_0x1c5098){return _0x1c5098['getAgents']({'attributes':['id'],'raw':!![]})[_0xc303('0x29')](function(_0x455d4d){var _0x2f7990=_[_0xc303('0x60')](_0x455d4d,'id');_0x493ea9(_0x2f7990);});})[_0xc303('0x57')](function(_0x5d5c8c){_0x382938(_0x5d5c8c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 7f0e0bc..2e5e72a 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 _0x2311=['UserNotification','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x15cc17,_0x5a498d){var _0x9607cc=function(_0x2c84fb){while(--_0x2c84fb){_0x15cc17['push'](_0x15cc17['shift']());}};_0x9607cc(++_0x5a498d);}(_0x2311,0x166));var _0x1231=function(_0x2cc1b9,_0x4bf2ba){_0x2cc1b9=_0x2cc1b9-0x0;var _0x38af54=_0x2311[_0x2cc1b9];return _0x38af54;};'use strict';var EventEmitter=require(_0x1231('0x0'));var UserNotification=require(_0x1231('0x1'))['db'][_0x1231('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1231('0x3'),'afterUpdate':_0x1231('0x4'),'afterDestroy':_0x1231('0x5')};function emitEvent(_0x1744ed){return function(_0x1aa660,_0x4a46dd,_0x35e7e2){UserNotificationEvents[_0x1231('0x6')](_0x1744ed+':'+_0x1aa660['id'],_0x1aa660);UserNotificationEvents[_0x1231('0x6')](_0x1744ed,_0x1aa660);_0x35e7e2(null);};}for(var e in events){if(events[_0x1231('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x1231('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xcf23=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification'];(function(_0x2483e2,_0x348234){var _0x40d853=function(_0x541597){while(--_0x541597){_0x2483e2['push'](_0x2483e2['shift']());}};_0x40d853(++_0x348234);}(_0xcf23,0xf9));var _0x3cf2=function(_0x4e2e7a,_0x4631a2){_0x4e2e7a=_0x4e2e7a-0x0;var _0x289ba9=_0xcf23[_0x4e2e7a];return _0x289ba9;};'use strict';var EventEmitter=require(_0x3cf2('0x0'));var UserNotification=require(_0x3cf2('0x1'))['db'][_0x3cf2('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3cf2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3cf2('0x4'),'afterDestroy':_0x3cf2('0x5')};function emitEvent(_0x5eec70){return function(_0x1bc186,_0x4f7255,_0x25cee1){UserNotificationEvents['emit'](_0x5eec70+':'+_0x1bc186['id'],_0x1bc186);UserNotificationEvents[_0x3cf2('0x6')](_0x5eec70,_0x1bc186);_0x25cee1(null);};}for(var e in events){if(events[_0x3cf2('0x7')](e)){var event=events[e];UserNotification[_0x3cf2('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 3838890..e350cb8 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 _0x9cc1=['exports','define','UserNotification','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x20e7ca,_0x41a3d0){var _0x1f6e25=function(_0x3eef2c){while(--_0x3eef2c){_0x20e7ca['push'](_0x20e7ca['shift']());}};_0x1f6e25(++_0x41a3d0);}(_0x9cc1,0x18c));var _0x19cc=function(_0x35bd6c,_0x585087){_0x35bd6c=_0x35bd6c-0x0;var _0x2f421d=_0x9cc1[_0x35bd6c];return _0x2f421d;};'use strict';var _=require(_0x19cc('0x0'));var util=require(_0x19cc('0x1'));var logger=require(_0x19cc('0x2'))(_0x19cc('0x3'));var moment=require(_0x19cc('0x4'));var BPromise=require(_0x19cc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19cc('0x6'));var rimraf=require(_0x19cc('0x7'));var config=require(_0x19cc('0x8'));var attributes=require(_0x19cc('0x9'));module[_0x19cc('0xa')]=function(_0x3fe962,_0x2c82d9){return _0x3fe962[_0x19cc('0xb')](_0x19cc('0xc'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x19cc('0xd')});}; \ No newline at end of file +var _0xbb6a=['utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications'];(function(_0x4a1c3d,_0xa4655c){var _0x1a403c=function(_0xc74904){while(--_0xc74904){_0x4a1c3d['push'](_0x4a1c3d['shift']());}};_0x1a403c(++_0xa4655c);}(_0xbb6a,0x76));var _0xabb6=function(_0x24e8db,_0x89fc47){_0x24e8db=_0x24e8db-0x0;var _0x576cc1=_0xbb6a[_0x24e8db];return _0x576cc1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xabb6('0x0'))(_0xabb6('0x1'));var moment=require(_0xabb6('0x2'));var BPromise=require(_0xabb6('0x3'));var rp=require(_0xabb6('0x4'));var fs=require('fs');var path=require(_0xabb6('0x5'));var rimraf=require(_0xabb6('0x6'));var config=require(_0xabb6('0x7'));var attributes=require(_0xabb6('0x8'));module[_0xabb6('0x9')]=function(_0x193ff5,_0x6f129d){return _0x193ff5[_0xabb6('0xa')]('UserNotification',attributes,{'tableName':_0xabb6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xabb6('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 583763b..2132631 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 _0xc301=['client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x557cc6,_0x48aff3){var _0x1d9df3=function(_0x2be6a1){while(--_0x2be6a1){_0x557cc6['push'](_0x557cc6['shift']());}};_0x1d9df3(++_0x48aff3);}(_0xc301,0x1b1));var _0x1c30=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xc301[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1c30('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c30('0x1'))['db'];var utils=require(_0x1c30('0x2'));var logger=require(_0x1c30('0x3'))(_0x1c30('0x4'));var config=require(_0x1c30('0x5'));var jayson=require(_0x1c30('0x6'));var client=jayson[_0x1c30('0x7')]['http']({'port':0x232a});config[_0x1c30('0x8')]=_[_0x1c30('0x9')](config[_0x1c30('0x8')],{'host':_0x1c30('0xa'),'port':0x18eb});var socket=require(_0x1c30('0xb'))(new Redis(config[_0x1c30('0x8')]));require(_0x1c30('0xc'))['register'](socket);function respondWithRpcPromise(_0x58ff4f,_0x2dc702,_0x5a2efb){return new BPromise(function(_0x56f5d6,_0x32e2f7){return client['request'](_0x58ff4f,_0x5a2efb)[_0x1c30('0xd')](function(_0x52caf5){logger[_0x1c30('0xe')](_0x1c30('0xf'),_0x2dc702,'request\x20sent');logger[_0x1c30('0x10')](_0x1c30('0x11'),_0x2dc702,_0x1c30('0x12'),JSON['stringify'](_0x52caf5));if(_0x52caf5[_0x1c30('0x13')]){if(_0x52caf5[_0x1c30('0x13')][_0x1c30('0x14')]===0x1f4){logger[_0x1c30('0x13')]('UserNotification,\x20%s,\x20%s',_0x2dc702,_0x52caf5[_0x1c30('0x13')][_0x1c30('0x15')]);return _0x32e2f7(_0x52caf5['error'][_0x1c30('0x15')]);}logger[_0x1c30('0x13')]('UserNotification,\x20%s,\x20%s',_0x2dc702,_0x52caf5[_0x1c30('0x13')][_0x1c30('0x15')]);return _0x56f5d6(_0x52caf5['error'][_0x1c30('0x15')]);}else{logger[_0x1c30('0xe')]('UserNotification,\x20%s,\x20%s',_0x2dc702,'request\x20sent');_0x56f5d6(_0x52caf5['result'][_0x1c30('0x15')]);}})['catch'](function(_0x3f8f2d){logger[_0x1c30('0x13')](_0x1c30('0xf'),_0x2dc702,_0x3f8f2d);_0x32e2f7(_0x3f8f2d);});});} \ No newline at end of file +var _0x3473=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x3fbfe4,_0x249f5a){var _0xb79447=function(_0x4ce489){while(--_0x4ce489){_0x3fbfe4['push'](_0x3fbfe4['shift']());}};_0xb79447(++_0x249f5a);}(_0x3473,0x9f));var _0x3347=function(_0x17788a,_0x150887){_0x17788a=_0x17788a-0x0;var _0x33f47c=_0x3473[_0x17788a];return _0x33f47c;};'use strict';var _=require(_0x3347('0x0'));var util=require(_0x3347('0x1'));var moment=require(_0x3347('0x2'));var BPromise=require(_0x3347('0x3'));var rs=require(_0x3347('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3347('0x5'))['db'];var utils=require(_0x3347('0x6'));var logger=require(_0x3347('0x7'))(_0x3347('0x8'));var config=require('../../config/environment');var jayson=require(_0x3347('0x9'));var client=jayson[_0x3347('0xa')][_0x3347('0xb')]({'port':0x232a});config['redis']=_[_0x3347('0xc')](config[_0x3347('0xd')],{'host':_0x3347('0xe'),'port':0x18eb});var socket=require(_0x3347('0xf'))(new Redis(config['redis']));require(_0x3347('0x10'))['register'](socket);function respondWithRpcPromise(_0x29ef71,_0x572958,_0x57073c){return new BPromise(function(_0x56a02a,_0x51d630){return client[_0x3347('0x11')](_0x29ef71,_0x57073c)[_0x3347('0x12')](function(_0x554f3f){logger[_0x3347('0x13')]('UserNotification,\x20%s,\x20%s',_0x572958,'request\x20sent');logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x572958,_0x3347('0x14'),JSON[_0x3347('0x15')](_0x554f3f));if(_0x554f3f[_0x3347('0x16')]){if(_0x554f3f[_0x3347('0x16')][_0x3347('0x17')]===0x1f4){logger[_0x3347('0x16')](_0x3347('0x18'),_0x572958,_0x554f3f['error'][_0x3347('0x19')]);return _0x51d630(_0x554f3f[_0x3347('0x16')][_0x3347('0x19')]);}logger[_0x3347('0x16')](_0x3347('0x18'),_0x572958,_0x554f3f['error'][_0x3347('0x19')]);return _0x56a02a(_0x554f3f[_0x3347('0x16')][_0x3347('0x19')]);}else{logger[_0x3347('0x13')](_0x3347('0x18'),_0x572958,'request\x20sent');_0x56a02a(_0x554f3f['result'][_0x3347('0x19')]);}})[_0x3347('0x1a')](function(_0x3bf705){logger['error']('UserNotification,\x20%s,\x20%s',_0x572958,_0x3bf705);_0x51d630(_0x3bf705);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index eb5bba9..d516139 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 _0xec0c=['register','userNotification:','update','emit'];(function(_0x3bc3b4,_0x5acff4){var _0x4c546b=function(_0x158717){while(--_0x158717){_0x3bc3b4['push'](_0x3bc3b4['shift']());}};_0x4c546b(++_0x5acff4);}(_0xec0c,0x11a));var _0xcec0=function(_0x3193af,_0x5390e0){_0x3193af=_0x3193af-0x0;var _0x319955=_0xec0c[_0x3193af];return _0x319955;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save','remove',_0xcec0('0x0')];function createListener(_0x34f8b5,_0x5a4c15){return function(_0x10caed){_0x5a4c15[_0xcec0('0x1')](_0x34f8b5,_0x10caed);};}function removeListener(_0x36819e,_0x1c535a){return function(){UserNotificationEvents['removeListener'](_0x36819e,_0x1c535a);};}exports[_0xcec0('0x2')]=function(_0x287b12){for(var _0x6081b7=0x0,_0x188036=events['length'];_0x6081b7<_0x188036;_0x6081b7++){var _0x1d37bb=events[_0x6081b7];var _0x581e19=createListener(_0xcec0('0x3')+_0x1d37bb,_0x287b12);UserNotificationEvents['on'](_0x1d37bb,_0x581e19);}}; \ No newline at end of file +var _0xcd09=['length','userNotification:','./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xcd09,0xa4));var _0x9cd0=function(_0xdb810a,_0x3007f8){_0xdb810a=_0xdb810a-0x0;var _0x3954ba=_0xcd09[_0xdb810a];return _0x3954ba;};'use strict';var UserNotificationEvents=require(_0x9cd0('0x0'));var events=[_0x9cd0('0x1'),_0x9cd0('0x2'),_0x9cd0('0x3')];function createListener(_0xeb350a,_0x4608b7){return function(_0x1137f3){_0x4608b7[_0x9cd0('0x4')](_0xeb350a,_0x1137f3);};}function removeListener(_0x201b7d,_0x218e32){return function(){UserNotificationEvents[_0x9cd0('0x5')](_0x201b7d,_0x218e32);};}exports[_0x9cd0('0x6')]=function(_0x243715){for(var _0x3f97fb=0x0,_0x139eae=events[_0x9cd0('0x7')];_0x3f97fb<_0x139eae;_0x3f97fb++){var _0x41203e=events[_0x3f97fb];var _0x2a01ac=createListener(_0x9cd0('0x8')+_0x41203e,_0x243715);UserNotificationEvents['on'](_0x41203e,_0x2a01ac);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index cba8c2c..2e280f2 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x786070,_0x3d7129){var _0x3766a5=function(_0x2c99c5){while(--_0x2c99c5){_0x786070['push'](_0x786070['shift']());}};_0x3766a5(++_0x3d7129);}(_0xe706,0xa3));var _0x6e70=function(_0x1a7a1b,_0x518846){_0x1a7a1b=_0x1a7a1b-0x0;var _0x350750=_0xe706[_0x1a7a1b];return _0x350750;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5c50de,_0x248df5){var _0x39861f=function(_0x3dcc0b){while(--_0x3dcc0b){_0x5c50de['push'](_0x5c50de['shift']());}};_0x39861f(++_0x248df5);}(_0x70e0,0x17b));var _0x070e=function(_0x354c3c,_0x21a05f){_0x354c3c=_0x354c3c-0x0;var _0x4070ed=_0x70e0[_0x354c3c];return _0x4070ed;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index b79754b..fba1479 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 _0xd98b=['INTEGER','sequelize'];(function(_0x4b296c,_0x2ab86e){var _0x4967d8=function(_0x527bbe){while(--_0x527bbe){_0x4b296c['push'](_0x4b296c['shift']());}};_0x4967d8(++_0x2ab86e);}(_0xd98b,0x1d1));var _0xbd98=function(_0x55de81,_0x1ebe60){_0x55de81=_0x55de81-0x0;var _0x21d6e6=_0xd98b[_0x55de81];return _0x21d6e6;};'use strict';var Sequelize=require(_0xbd98('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbd98('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa88d=['INTEGER','sequelize'];(function(_0x1c2478,_0x466bf3){var _0x36c4af=function(_0x3b3541){while(--_0x3b3541){_0x1c2478['push'](_0x1c2478['shift']());}};_0x36c4af(++_0x466bf3);}(_0xa88d,0x179));var _0xda88=function(_0x1b173a,_0x34265f){_0x1b173a=_0x1b173a-0x0;var _0x42346f=_0xa88d[_0x1b173a];return _0x42346f;};'use strict';var Sequelize=require(_0xda88('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xda88('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 0bf833f..8004f4e 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 _0x8776=['lodash','moment','request-promise','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x2bcddb,_0x3eaf37){var _0x12a9e8=function(_0xeeb678){while(--_0xeeb678){_0x2bcddb['push'](_0x2bcddb['shift']());}};_0x12a9e8(++_0x3eaf37);}(_0x8776,0x168));var _0x6877=function(_0x4eab33,_0x27fff4){_0x4eab33=_0x4eab33-0x0;var _0x750fa=_0x8776[_0x4eab33];return _0x750fa;};'use strict';var _=require(_0x6877('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6877('0x1'));var BPromise=require('bluebird');var rp=require(_0x6877('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6877('0x3'));var config=require(_0x6877('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x6877('0x5')]=function(_0x57a06c,_0x235a65){return _0x57a06c[_0x6877('0x6')](_0x6877('0x7'),attributes,{'tableName':_0x6877('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x957f=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x56a161,_0x29b2ab){var _0x93fe3a=function(_0x4b97c5){while(--_0x4b97c5){_0x56a161['push'](_0x56a161['shift']());}};_0x93fe3a(++_0x29b2ab);}(_0x957f,0x159));var _0xf957=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x957f[_0x33a694];return _0x41ff01;};'use strict';var _=require(_0xf957('0x0'));var util=require(_0xf957('0x1'));var logger=require(_0xf957('0x2'))(_0xf957('0x3'));var moment=require(_0xf957('0x4'));var BPromise=require(_0xf957('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf957('0x6'));var rimraf=require(_0xf957('0x7'));var config=require(_0xf957('0x8'));var attributes=require(_0xf957('0x9'));module[_0xf957('0xa')]=function(_0x809515,_0x465c17){return _0x809515[_0xf957('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0xf957('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index e7fa9a8..6bf6e42 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 _0x87dc=['result','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x254849,_0x321ff6){var _0x4f73d1=function(_0x489d88){while(--_0x489d88){_0x254849['push'](_0x254849['shift']());}};_0x4f73d1(++_0x321ff6);}(_0x87dc,0x12d));var _0xc87d=function(_0x11f2c6,_0x202ab6){_0x11f2c6=_0x11f2c6-0x0;var _0x3879bd=_0x87dc[_0x11f2c6];return _0x3879bd;};'use strict';var _=require(_0xc87d('0x0'));var util=require('util');var moment=require(_0xc87d('0x1'));var BPromise=require(_0xc87d('0x2'));var rs=require(_0xc87d('0x3'));var fs=require('fs');var Redis=require(_0xc87d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc87d('0x5'));var config=require(_0xc87d('0x6'));var jayson=require(_0xc87d('0x7'));var client=jayson[_0xc87d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x911a53,_0x2f2d59,_0x14e5ce){return new BPromise(function(_0x41b44e,_0x5a010e){return client[_0xc87d('0x9')](_0x911a53,_0x14e5ce)[_0xc87d('0xa')](function(_0x56853b){logger['info'](_0xc87d('0xb'),_0x2f2d59,_0xc87d('0xc'));logger[_0xc87d('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2f2d59,_0xc87d('0xc'),JSON[_0xc87d('0xe')](_0x56853b));if(_0x56853b[_0xc87d('0xf')]){if(_0x56853b['error'][_0xc87d('0x10')]===0x1f4){logger[_0xc87d('0xf')](_0xc87d('0xb'),_0x2f2d59,_0x56853b[_0xc87d('0xf')][_0xc87d('0x11')]);return _0x5a010e(_0x56853b[_0xc87d('0xf')][_0xc87d('0x11')]);}logger[_0xc87d('0xf')](_0xc87d('0xb'),_0x2f2d59,_0x56853b[_0xc87d('0xf')][_0xc87d('0x11')]);return _0x41b44e(_0x56853b[_0xc87d('0xf')]['message']);}else{logger[_0xc87d('0x12')](_0xc87d('0xb'),_0x2f2d59,_0xc87d('0xc'));_0x41b44e(_0x56853b[_0xc87d('0x13')][_0xc87d('0x11')]);}})['catch'](function(_0x1c5692){logger['error'](_0xc87d('0xb'),_0x2f2d59,_0x1c5692);_0x5a010e(_0x1c5692);});});} \ No newline at end of file +var _0x746d=['stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x244ee3,_0x31ba8b){var _0x52ba39=function(_0x24450d){while(--_0x24450d){_0x244ee3['push'](_0x244ee3['shift']());}};_0x52ba39(++_0x31ba8b);}(_0x746d,0xd7));var _0xd746=function(_0x42df3f,_0x4fdea7){_0x42df3f=_0x42df3f-0x0;var _0x334f56=_0x746d[_0x42df3f];return _0x334f56;};'use strict';var _=require(_0xd746('0x0'));var util=require(_0xd746('0x1'));var moment=require('moment');var BPromise=require(_0xd746('0x2'));var rs=require(_0xd746('0x3'));var fs=require('fs');var Redis=require(_0xd746('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd746('0x5'));var config=require(_0xd746('0x6'));var jayson=require(_0xd746('0x7'));var client=jayson[_0xd746('0x8')][_0xd746('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x90d616,_0x4af5a6,_0xda4776){return new BPromise(function(_0x343494,_0x40713c){return client[_0xd746('0xa')](_0x90d616,_0xda4776)[_0xd746('0xb')](function(_0x1f6c7a){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4af5a6,_0xd746('0xc'));logger[_0xd746('0xd')](_0xd746('0xe'),_0x4af5a6,_0xd746('0xc'),JSON[_0xd746('0xf')](_0x1f6c7a));if(_0x1f6c7a['error']){if(_0x1f6c7a[_0xd746('0x10')][_0xd746('0x11')]===0x1f4){logger[_0xd746('0x10')](_0xd746('0x12'),_0x4af5a6,_0x1f6c7a[_0xd746('0x10')][_0xd746('0x13')]);return _0x40713c(_0x1f6c7a[_0xd746('0x10')]['message']);}logger[_0xd746('0x10')](_0xd746('0x12'),_0x4af5a6,_0x1f6c7a[_0xd746('0x10')][_0xd746('0x13')]);return _0x343494(_0x1f6c7a[_0xd746('0x10')]['message']);}else{logger[_0xd746('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4af5a6,_0xd746('0xc'));_0x343494(_0x1f6c7a[_0xd746('0x15')][_0xd746('0x13')]);}})[_0xd746('0x16')](function(_0x40f5d7){logger[_0xd746('0x10')](_0xd746('0x12'),_0x4af5a6,_0x40f5d7);_0x40713c(_0x40f5d7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index aabeb92..90115a7 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 _0x113c=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','/:id','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path'];(function(_0x2cd36d,_0x5e2ba7){var _0x284284=function(_0x4fb16f){while(--_0x4fb16f){_0x2cd36d['push'](_0x2cd36d['shift']());}};_0x284284(++_0x5e2ba7);}(_0x113c,0x1ed));var _0xc113=function(_0x249dfe,_0x21f85c){_0x249dfe=_0x249dfe-0x0;var _0xc7c7be=_0x113c[_0x249dfe];return _0xc7c7be;};'use strict';var multer=require(_0xc113('0x0'));var util=require(_0xc113('0x1'));var path=require(_0xc113('0x2'));var timeout=require(_0xc113('0x3'));var express=require(_0xc113('0x4'));var router=express['Router']();var fs_extra=require(_0xc113('0x5'));var auth=require(_0xc113('0x6'));var interaction=require(_0xc113('0x7'));var config=require(_0xc113('0x8'));var controller=require('./userProfile.controller');router['get']('/',auth[_0xc113('0x9')](),controller[_0xc113('0xa')]);router['get'](_0xc113('0xb'),auth[_0xc113('0x9')](),controller['describe']);router[_0xc113('0xc')](_0xc113('0xd'),auth[_0xc113('0x9')](),controller[_0xc113('0xe')]);router[_0xc113('0xc')](_0xc113('0xf'),auth[_0xc113('0x9')](),controller[_0xc113('0x10')]);router['get']('/:id/resources',auth[_0xc113('0x9')](),controller[_0xc113('0x11')]);router[_0xc113('0x12')]('/',auth[_0xc113('0x9')](),controller[_0xc113('0x13')]);router['post'](_0xc113('0x14'),auth[_0xc113('0x9')](),controller[_0xc113('0x15')]);router[_0xc113('0x12')]('/:id/sections',auth[_0xc113('0x9')](),controller[_0xc113('0x16')]);router[_0xc113('0x12')]('/:id/resources',auth['isAuthenticated'](),controller[_0xc113('0x17')]);router[_0xc113('0x18')](_0xc113('0xd'),auth[_0xc113('0x9')](),controller[_0xc113('0x19')]);router[_0xc113('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xc113('0x1b')]);router[_0xc113('0x1a')](_0xc113('0xf'),auth['isAuthenticated'](),controller[_0xc113('0x1c')]);router[_0xc113('0x1a')]('/:id/resources',auth[_0xc113('0x9')](),controller[_0xc113('0x1d')]);module[_0xc113('0x1e')]=router; \ No newline at end of file +var _0xc818=['index','get','/describe','isAuthenticated','show','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','clone','addResources','put','update','/:id','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller'];(function(_0x4195eb,_0x516050){var _0x3ec2c5=function(_0x2b2c47){while(--_0x2b2c47){_0x4195eb['push'](_0x4195eb['shift']());}};_0x3ec2c5(++_0x516050);}(_0xc818,0xe6));var _0x8c81=function(_0xd9b991,_0x2f990f){_0xd9b991=_0xd9b991-0x0;var _0x313cfa=_0xc818[_0xd9b991];return _0x313cfa;};'use strict';var multer=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var path=require(_0x8c81('0x2'));var timeout=require(_0x8c81('0x3'));var express=require(_0x8c81('0x4'));var router=express['Router']();var fs_extra=require(_0x8c81('0x5'));var auth=require(_0x8c81('0x6'));var interaction=require(_0x8c81('0x7'));var config=require(_0x8c81('0x8'));var controller=require(_0x8c81('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8c81('0xa')]);router[_0x8c81('0xb')](_0x8c81('0xc'),auth[_0x8c81('0xd')](),controller['describe']);router[_0x8c81('0xb')]('/:id',auth[_0x8c81('0xd')](),controller[_0x8c81('0xe')]);router[_0x8c81('0xb')](_0x8c81('0xf'),auth[_0x8c81('0xd')](),controller['getSections']);router[_0x8c81('0xb')](_0x8c81('0x10'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x11')]);router[_0x8c81('0x12')]('/',auth[_0x8c81('0xd')](),controller[_0x8c81('0x13')]);router['post'](_0x8c81('0x14'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x15')]);router[_0x8c81('0x12')](_0x8c81('0xf'),auth[_0x8c81('0xd')](),controller['addSections']);router[_0x8c81('0x12')](_0x8c81('0x10'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x16')]);router[_0x8c81('0x17')]('/:id',auth[_0x8c81('0xd')](),controller[_0x8c81('0x18')]);router['delete'](_0x8c81('0x19'),auth[_0x8c81('0xd')](),controller['destroy']);router[_0x8c81('0x1a')](_0x8c81('0xf'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x1b')]);router[_0x8c81('0x1a')](_0x8c81('0x10'),auth['isAuthenticated'](),controller[_0x8c81('0x1c')]);module[_0x8c81('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index d3e3b67..c8c0beb 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 _0xdc0a=['STRING','setDataValue','crudPermissions','getDataValue','split','BOOLEAN','sequelize','exports','name'];(function(_0x118706,_0x303f5a){var _0x2487f7=function(_0x48395b){while(--_0x48395b){_0x118706['push'](_0x118706['shift']());}};_0x2487f7(++_0x303f5a);}(_0xdc0a,0x84));var _0xadc0=function(_0x29547f,_0x7d94ea){_0x29547f=_0x29547f-0x0;var _0x17abfb=_0xdc0a[_0x29547f];return _0x17abfb;};'use strict';var Sequelize=require(_0xadc0('0x0'));module[_0xadc0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xadc0('0x2')},'crudPermissions':{'type':Sequelize[_0xadc0('0x3')],'set':function(_0x22fe9f){this[_0xadc0('0x4')](_0xadc0('0x5'),_0x22fe9f?_0x22fe9f['join'](''):[]);},'get':function(){return this[_0xadc0('0x6')]('crudPermissions')?this['getDataValue'](_0xadc0('0x5'))[_0xadc0('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xadc0('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xadc0('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xadc0('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xadc0('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xadc0('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xadc0('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8525=['exports','STRING','join','crudPermissions','getDataValue','split','BOOLEAN'];(function(_0x417b4b,_0x3ba2d7){var _0x1e1f6d=function(_0x35931b){while(--_0x35931b){_0x417b4b['push'](_0x417b4b['shift']());}};_0x1e1f6d(++_0x3ba2d7);}(_0x8525,0x18f));var _0x5852=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8525[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x5852('0x0')]={'name':{'type':Sequelize[_0x5852('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4b09cc){this['setDataValue']('crudPermissions',_0x4b09cc?_0x4b09cc[_0x5852('0x2')](''):[]);},'get':function(){return this['getDataValue'](_0x5852('0x3'))?this[_0x5852('0x4')](_0x5852('0x3'))[_0x5852('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5852('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5852('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5852('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5852('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5852('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5852('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d028407..6536258 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 _0xc40c=['UserProfileSection','describe','addSections','push','removeSections','ids','enabled','includes','sectionId','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','UserProfile','rawAttributes','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','type','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','find','catch','create','merge','get','omit','createdAt','crudPermissions','body','sequelize','transaction','autoAssociation','UserProfileResource','updatedAt','userProfileId','Resources'];(function(_0x42881b,_0x48bcb4){var _0x1a5f86=function(_0x2e26c8){while(--_0x2e26c8){_0x42881b['push'](_0x42881b['shift']());}};_0x1a5f86(++_0x48bcb4);}(_0xc40c,0x158));var _0xcc40=function(_0x35bf64,_0x625fb6){_0x35bf64=_0x35bf64-0x0;var _0x2c1406=_0xc40c[_0x35bf64];return _0x2c1406;};'use strict';var emlformat=require(_0xcc40('0x0'));var rimraf=require(_0xcc40('0x1'));var zipdir=require(_0xcc40('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcc40('0x3'));var BPromise=require(_0xcc40('0x4'));var Mustache=require(_0xcc40('0x5'));var util=require(_0xcc40('0x6'));var path=require('path');var sox=require(_0xcc40('0x7'));var csv=require('to-csv');var ejs=require(_0xcc40('0x8'));var fs=require('fs');var fs_extra=require(_0xcc40('0x9'));var _=require(_0xcc40('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcc40('0xb'));var querystring=require(_0xcc40('0xc'));var Papa=require('papaparse');var Redis=require(_0xcc40('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xcc40('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc40('0xf'));var logger=require(_0xcc40('0x10'))(_0xcc40('0x11'));var utils=require(_0xcc40('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xcc40('0x13'));var db=require('../../mysqldb')['db'];config[_0xcc40('0x14')]=_['defaults'](config[_0xcc40('0x14')],{'host':_0xcc40('0x15'),'port':0x18eb});var socket=require(_0xcc40('0x16'))(new Redis(config[_0xcc40('0x14')]));require(_0xcc40('0x17'))[_0xcc40('0x18')](socket);function respondWithStatusCode(_0x21f2e7,_0x1e544f){_0x1e544f=_0x1e544f||0xcc;return function(_0x160b81){if(_0x160b81){return _0x21f2e7[_0xcc40('0x19')](_0x1e544f);}return _0x21f2e7[_0xcc40('0x1a')](_0x1e544f)[_0xcc40('0x1b')]();};}function respondWithResult(_0x158b4f,_0x4cbc7a){_0x4cbc7a=_0x4cbc7a||0xc8;return function(_0x4b68d0){if(_0x4b68d0){return _0x158b4f['status'](_0x4cbc7a)[_0xcc40('0x1c')](_0x4b68d0);}};}function respondWithFilteredResult(_0xd15d8c,_0x95cc7){return function(_0x561f39){if(_0x561f39){var _0x5a8483=typeof _0x95cc7[_0xcc40('0x1d')]===_0xcc40('0x1e')&&typeof _0x95cc7[_0xcc40('0x1f')]===_0xcc40('0x1e');var _0xc7cc16=_0x561f39['count'];var _0x3bf6b3=_0x5a8483?0x0:_0x95cc7['offset'];var _0x4e22e0=_0x5a8483?_0x561f39[_0xcc40('0x20')]:_0x95cc7[_0xcc40('0x1d')]+_0x95cc7[_0xcc40('0x1f')];var _0x37d6a4;if(_0x4e22e0>=_0xc7cc16){_0x4e22e0=_0xc7cc16;_0x37d6a4=0xc8;}else{_0x37d6a4=0xce;}_0xd15d8c[_0xcc40('0x1a')](_0x37d6a4);return _0xd15d8c['set'](_0xcc40('0x21'),_0x3bf6b3+'-'+_0x4e22e0+'/'+_0xc7cc16)[_0xcc40('0x1c')](_0x561f39);}return null;};}function patchUpdates(_0x302656){return function(_0x5c0620){try{jsonpatch[_0xcc40('0x22')](_0x5c0620,_0x302656,!![]);}catch(_0x4df752){return BPromise[_0xcc40('0x23')](_0x4df752);}return _0x5c0620[_0xcc40('0x24')]();};}function saveUpdates(_0x297b0c,_0x7c178f){return function(_0x5506ac){if(_0x5506ac){return _0x5506ac[_0xcc40('0x25')](_0x297b0c)[_0xcc40('0x26')](function(_0x590954){return _0x590954;});}return null;};}function removeEntity(_0x43fa4d,_0x21d124){return function(_0x4ace02){if(_0x4ace02){return _0x4ace02[_0xcc40('0x27')]()[_0xcc40('0x26')](function(){_0x43fa4d[_0xcc40('0x1a')](0xcc)[_0xcc40('0x1b')]();});}};}function handleEntityNotFound(_0x3ced83,_0xb875a4){return function(_0x12ff1a){if(!_0x12ff1a){_0x3ced83[_0xcc40('0x19')](0x194);}return _0x12ff1a;};}function handleError(_0xc1c38d,_0x53212e){_0x53212e=_0x53212e||0x1f4;return function(_0x206e42){logger[_0xcc40('0x28')](_0x206e42['stack']);if(_0x206e42[_0xcc40('0x29')]){delete _0x206e42[_0xcc40('0x29')];}_0xc1c38d[_0xcc40('0x1a')](_0x53212e)[_0xcc40('0x2a')](_0x206e42);};}exports[_0xcc40('0x2b')]=function(_0x9ddc90,_0x47b703){var _0xf59b12={},_0x173595={},_0x2cb9f3={'count':0x0,'rows':[]};var _0x27f361=_[_0xcc40('0x2c')](db[_0xcc40('0x2d')][_0xcc40('0x2e')],function(_0x5caebd){return{'name':_0x5caebd['fieldName'],'type':_0x5caebd['type']['key']};});_0x173595['model']=_['map'](_0x27f361,_0xcc40('0x29'));_0x173595[_0xcc40('0x2f')]=_['keys'](_0x9ddc90['query']);_0x173595['filters']=_[_0xcc40('0x30')](_0x173595[_0xcc40('0x31')],_0x173595[_0xcc40('0x2f')]);_0xf59b12[_0xcc40('0x32')]=_[_0xcc40('0x30')](_0x173595[_0xcc40('0x31')],qs['fields'](_0x9ddc90['query'][_0xcc40('0x33')]));_0xf59b12[_0xcc40('0x32')]=_0xf59b12[_0xcc40('0x32')][_0xcc40('0x34')]?_0xf59b12[_0xcc40('0x32')]:_0x173595[_0xcc40('0x31')];if(!_0x9ddc90[_0xcc40('0x2f')]['hasOwnProperty'](_0xcc40('0x35'))){_0xf59b12[_0xcc40('0x1f')]=qs[_0xcc40('0x1f')](_0x9ddc90[_0xcc40('0x2f')][_0xcc40('0x1f')]);_0xf59b12[_0xcc40('0x1d')]=qs[_0xcc40('0x1d')](_0x9ddc90[_0xcc40('0x2f')]['offset']);}_0xf59b12[_0xcc40('0x36')]=qs[_0xcc40('0x37')](_0x9ddc90[_0xcc40('0x2f')][_0xcc40('0x37')]);_0xf59b12[_0xcc40('0x38')]=qs[_0xcc40('0x39')](_['pick'](_0x9ddc90['query'],_0x173595['filters']),_0x27f361);if(_0x9ddc90[_0xcc40('0x2f')][_0xcc40('0x3a')]){_0xf59b12[_0xcc40('0x38')]=_['merge'](_0xf59b12['where'],{'$or':_[_0xcc40('0x2c')](_0x27f361,function(_0xcfc099){if(_0xcfc099[_0xcc40('0x3b')]!==_0xcc40('0x3c')){var _0x208273={};_0x208273[_0xcfc099[_0xcc40('0x29')]]={'$like':'%'+_0x9ddc90['query'][_0xcc40('0x3a')]+'%'};return _0x208273;}})});}_0xf59b12=_['merge']({},_0xf59b12,_0x9ddc90[_0xcc40('0x3d')]);var _0x4499da={'where':_0xf59b12[_0xcc40('0x38')]};return db['UserProfile'][_0xcc40('0x20')](_0x4499da)[_0xcc40('0x26')](function(_0x5a147c){_0x2cb9f3[_0xcc40('0x20')]=_0x5a147c;if(_0x9ddc90[_0xcc40('0x2f')][_0xcc40('0x3e')]){_0xf59b12['include']=[{'all':!![]}];}return db[_0xcc40('0x2d')][_0xcc40('0x3f')](_0xf59b12);})[_0xcc40('0x26')](function(_0xd19c2d){_0x2cb9f3[_0xcc40('0x40')]=_0xd19c2d;return _0x2cb9f3;})[_0xcc40('0x26')](respondWithFilteredResult(_0x47b703,_0xf59b12))['catch'](handleError(_0x47b703,null));};exports['show']=function(_0x4dc733,_0x2aea3e){var _0x16adb5={'raw':![],'where':{'id':_0x4dc733[_0xcc40('0x41')]['id']}},_0x53d465={};_0x53d465[_0xcc40('0x31')]=_[_0xcc40('0x42')](db[_0xcc40('0x2d')][_0xcc40('0x2e')]);_0x53d465[_0xcc40('0x2f')]=_[_0xcc40('0x42')](_0x4dc733[_0xcc40('0x2f')]);_0x53d465[_0xcc40('0x39')]=_[_0xcc40('0x30')](_0x53d465[_0xcc40('0x31')],_0x53d465[_0xcc40('0x2f')]);_0x16adb5['attributes']=_[_0xcc40('0x30')](_0x53d465[_0xcc40('0x31')],qs[_0xcc40('0x33')](_0x4dc733[_0xcc40('0x2f')][_0xcc40('0x33')]));_0x16adb5['attributes']=_0x16adb5['attributes'][_0xcc40('0x34')]?_0x16adb5[_0xcc40('0x32')]:_0x53d465[_0xcc40('0x31')];if(_0x4dc733[_0xcc40('0x2f')][_0xcc40('0x3e')]){_0x16adb5[_0xcc40('0x43')]=[{'all':!![]}];}_0x16adb5=_['merge']({},_0x16adb5,_0x4dc733[_0xcc40('0x3d')]);return db[_0xcc40('0x2d')][_0xcc40('0x44')](_0x16adb5)[_0xcc40('0x26')](handleEntityNotFound(_0x2aea3e,null))['then'](respondWithResult(_0x2aea3e,null))[_0xcc40('0x45')](handleError(_0x2aea3e,null));};exports[_0xcc40('0x46')]=function(_0x89b37d,_0x3b74c7){return db['UserProfile'][_0xcc40('0x46')](_0x89b37d['body'],{})[_0xcc40('0x26')](respondWithResult(_0x3b74c7,0xc9))[_0xcc40('0x45')](handleError(_0x3b74c7,null));};exports['clone']=function(_0x5245ed,_0x1dc7c0){var _0x3bae35={'where':{'id':_0x5245ed[_0xcc40('0x41')]['id']}},_0x53414c={};_0x53414c['model']=_['keys'](db[_0xcc40('0x2d')][_0xcc40('0x2e')]);_0x3bae35['attributes']=_[_0xcc40('0x30')](_0x53414c[_0xcc40('0x31')],qs['fields'](_0x5245ed[_0xcc40('0x2f')][_0xcc40('0x33')]));_0x3bae35[_0xcc40('0x32')]=_0x3bae35[_0xcc40('0x32')][_0xcc40('0x34')]?_0x3bae35['attributes']:_0x53414c[_0xcc40('0x31')];if(_0x5245ed[_0xcc40('0x2f')]['includeAll']){_0x3bae35[_0xcc40('0x43')]=[{'all':!![]}];}_0x3bae35=_[_0xcc40('0x47')]({},_0x3bae35,_0x5245ed[_0xcc40('0x3d')]);return db['UserProfile'][_0xcc40('0x44')](_0x3bae35)[_0xcc40('0x26')](handleEntityNotFound(_0x1dc7c0,null))[_0xcc40('0x26')](function(_0x16d958){if(_0x16d958){var _0x5bc69d=_0x16d958[_0xcc40('0x48')]({'plain':!![]});_0x5bc69d=qs[_0xcc40('0x49')](_0x5bc69d,['id',_0xcc40('0x4a'),'updatedAt',_0xcc40('0x4b')]);_0x5245ed[_0xcc40('0x4c')]=_[_0xcc40('0x49')](_0x5245ed['body'],['id',_0xcc40('0x4a'),'updatedAt']);return db[_0xcc40('0x4d')][_0xcc40('0x4e')](function(_0x461b70){return db['UserProfile'][_0xcc40('0x46')](_[_0xcc40('0x47')](_0x5bc69d,_0x5245ed[_0xcc40('0x4c')]),{'include':_0x5245ed[_0xcc40('0x2f')][_0xcc40('0x3e')]?[{'all':!![]}]:undefined,'transaction':_0x461b70})[_0xcc40('0x26')](function(_0x524f79){var _0x3b1867=_0x524f79[_0xcc40('0x48')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x5245ed[_0xcc40('0x41')]['id']},'raw':!![]})[_0xcc40('0x26')](function(_0x4004dd){if(_0x4004dd){return BPromise['each'](_0x4004dd,function(_0x5c5bb2){return new BPromise(function(_0x1fd3fe,_0x330f33){if(_0x5c5bb2['autoAssociation']===null||_0x5c5bb2[_0xcc40('0x4f')]===0x1)_0x1fd3fe(null);return db[_0xcc40('0x50')][_0xcc40('0x3f')]({'where':{'sectionId':_0x5c5bb2['id']},'raw':!![]})[_0xcc40('0x26')](function(_0x555f95){var _0x52221b=_['map'](_0x555f95,function(_0x50ec16){return qs[_0xcc40('0x49')](_0x50ec16,['id',_0xcc40('0x4a'),_0xcc40('0x51'),'sectionId']);});_0x1fd3fe(_0x52221b);})[_0xcc40('0x45')](function(_0x2f9218){_0x330f33(_0x2f9218);});})[_0xcc40('0x26')](function(_0x4964ec){var _0x2fa73f=qs[_0xcc40('0x49')](_0x5c5bb2,['id','createdAt',_0xcc40('0x51')]);_0x2fa73f[_0xcc40('0x52')]=_0x3b1867['id'];if(_0x4964ec)_0x2fa73f[_0xcc40('0x53')]=_0x4964ec;return _0x2fa73f;})[_0xcc40('0x26')](function(_0x48a82e){return db[_0xcc40('0x54')][_0xcc40('0x46')](_0x48a82e,{'include':[{'model':db['UserProfileResource'],'as':_0xcc40('0x53')}],'raw':!![],'transaction':_0x461b70});});})[_0xcc40('0x26')](function(){return _0x3b1867;});}});});});}})[_0xcc40('0x26')](respondWithResult(_0x1dc7c0,0xc9))[_0xcc40('0x45')](handleError(_0x1dc7c0,null));};exports[_0xcc40('0x25')]=function(_0x9c4f88,_0xe158c1){if(_0x9c4f88[_0xcc40('0x4c')]['id']){delete _0x9c4f88['body']['id'];}return db['UserProfile'][_0xcc40('0x44')]({'where':{'id':_0x9c4f88['params']['id']}})[_0xcc40('0x26')](handleEntityNotFound(_0xe158c1,null))[_0xcc40('0x26')](saveUpdates(_0x9c4f88[_0xcc40('0x4c')],null))[_0xcc40('0x26')](respondWithResult(_0xe158c1,null))[_0xcc40('0x45')](handleError(_0xe158c1,null));};exports['destroy']=function(_0x383dea,_0x23ec30){return db[_0xcc40('0x2d')][_0xcc40('0x44')]({'where':{'id':_0x383dea['params']['id']}})[_0xcc40('0x26')](handleEntityNotFound(_0x23ec30,null))[_0xcc40('0x26')](removeEntity(_0x23ec30,null))[_0xcc40('0x45')](handleError(_0x23ec30,null));};exports['describe']=function(_0x2634bb,_0x31cb68){return db[_0xcc40('0x2d')][_0xcc40('0x55')]()['then'](respondWithResult(_0x31cb68,null))[_0xcc40('0x45')](handleError(_0x31cb68,null));};exports[_0xcc40('0x56')]=function(_0x5f1537,_0x4cc314){var _0x18b54b=_0x5f1537[_0xcc40('0x4c')];return db['UserProfile'][_0xcc40('0x44')]({'where':{'id':_0x5f1537[_0xcc40('0x41')]['id']}})[_0xcc40('0x26')](handleEntityNotFound(_0x4cc314,null))[_0xcc40('0x26')](function(_0x3f81a5){if(_0x3f81a5){return db['sequelize']['transaction'](function(_0x3d115f){return db['UserProfileSection'][_0xcc40('0x27')]({'where':{'userProfileId':_0x5f1537[_0xcc40('0x41')]['id'],'sectionId':_[_0xcc40('0x2c')](_0x18b54b,function(_0x2769a9){return _0x2769a9['sectionId'];})},'transaction':_0x3d115f})[_0xcc40('0x26')](function(){var _0x47806=_[_0xcc40('0x2c')](_0x18b54b,function(_0xb5c06f){_0xb5c06f[_0xcc40('0x52')]=_0x5f1537['params']['id'];return _0xb5c06f;});var _0x175cd7=[];return BPromise['each'](_0x47806,function(_0x467473){return db[_0xcc40('0x54')]['create'](_0x467473,{'include':[{'model':db[_0xcc40('0x50')],'as':_0xcc40('0x53')}],'raw':!![],'transaction':_0x3d115f})[_0xcc40('0x26')](function(_0x12a609){_0x175cd7[_0xcc40('0x57')](_0x12a609[_0xcc40('0x48')]({'plain':!![]}));});})[_0xcc40('0x26')](function(){return _0x175cd7;});});});}})[_0xcc40('0x26')](function(_0x17c90c){return _0x17c90c;})['then'](respondWithResult(_0x4cc314,null))[_0xcc40('0x45')](handleError(_0x4cc314,null));};exports[_0xcc40('0x58')]=function(_0x1ad535,_0x5b07d4){var _0x2f2058;return db[_0xcc40('0x2d')][_0xcc40('0x44')]({'where':{'id':_0x1ad535[_0xcc40('0x41')]['id']},'attributes':['id',_0xcc40('0x29')]})[_0xcc40('0x26')](handleEntityNotFound(_0x5b07d4,null))[_0xcc40('0x26')](function(_0x12e55d){if(_0x12e55d){_0x2f2058=_0x12e55d;return db[_0xcc40('0x54')][_0xcc40('0x27')]({'where':{'userProfileId':_0x1ad535[_0xcc40('0x41')]['id'],'sectionId':_0x1ad535[_0xcc40('0x2f')][_0xcc40('0x59')]}});}})[_0xcc40('0x26')](function(){return _0x2f2058;})[_0xcc40('0x26')](respondWithStatusCode(_0x5b07d4,null))[_0xcc40('0x45')](handleError(_0x5b07d4,null));};exports['getSections']=function(_0x26a3a5,_0x8e703){var _0x15b38e=[];var _0x140e13=[];return db[_0xcc40('0x54')][_0xcc40('0x3f')]({'where':{'userProfileId':_0x26a3a5[_0xcc40('0x41')]['id']},'raw':!![]})['then'](function(_0xdfff72){_0x15b38e=_['filter'](_0xdfff72,function(_0x5b126e){return _0x5b126e[_0xcc40('0x5a')]===0x1||_[_0xcc40('0x5b')]([0x3eb,0x709],_0x5b126e[_0xcc40('0x5c')]);});if(!_[_0xcc40('0x5d')](_0x15b38e)){return _[_0xcc40('0x2c')](_0x15b38e,function(_0x1b86ac){return _0x1b86ac['sectionId'];});}else{return;}})[_0xcc40('0x26')](function(_0x34f9df){if(_0x34f9df)_0x140e13=_0x34f9df;if(_['includes'](_0x140e13,0x64)){var _0x4f534e=_['find'](_0x15b38e,{'sectionId':0x64});return hasDefaultDashboard(_0x4f534e)[_0xcc40('0x26')](function(_0x3b8cd6){return _['map'](_0x15b38e,function(_0x47b830){if(_0x47b830['sectionId']===0x64){_0x47b830[_0xcc40('0x5e')]=_0x3b8cd6;}return _0x47b830;});});}else{return;}})[_0xcc40('0x26')](function(_0xf4daf1){if(_0xf4daf1)_0x15b38e=_0xf4daf1;if(_['includes'](_0x140e13,0x3eb)){var _0x2f5fba=_[_0xcc40('0x44')](_0x15b38e,{'sectionId':0x3eb});return getCustomDashboards(_0x2f5fba)[_0xcc40('0x26')](function(_0x8b4ca5){return _[_0xcc40('0x2c')](_0x15b38e,function(_0x44f567){if(_0x2f5fba[_0xcc40('0x5a')]){if(_0x44f567['sectionId']===0x3eb){_0x44f567[_0xcc40('0x5e')]=_0x8b4ca5;}}else{if(_0x44f567[_0xcc40('0x5c')]===0x64){if(!_0x44f567[_0xcc40('0x5e')]){_0x44f567['subsections']=[];}_0x44f567[_0xcc40('0x5e')]=_0x44f567[_0xcc40('0x5e')][_0xcc40('0x5f')](_0x8b4ca5);}}return _0x44f567;});});}else{return;}})[_0xcc40('0x26')](function(_0x50527c){if(_0x50527c)_0x15b38e=_0x50527c;if(_['includes'](_0x140e13,0x709)){var _0x52a6d2=_[_0xcc40('0x44')](_0x15b38e,{'sectionId':0x709});return getPlugins(_0x52a6d2)[_0xcc40('0x26')](function(_0x3dd11f){if(_0x52a6d2[_0xcc40('0x5a')]){return _[_0xcc40('0x2c')](_0x15b38e,function(_0x226180){if(_0x226180['sectionId']===0x709){_0x226180[_0xcc40('0x5e')]=_0x3dd11f;}return _0x226180;});}else{var _0x53ae33={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3dd11f};var _0x263b8d=_[_0xcc40('0x2c')](_0x15b38e);_0x263b8d[_0xcc40('0x57')](_0x53ae33);return _0x263b8d;}});}else{return;}})[_0xcc40('0x26')](function(_0x4e473e){if(_0x4e473e)_0x15b38e=_0x4e473e;return _[_0xcc40('0x3a')](_0x15b38e,[_0xcc40('0x5a'),0x1]);})[_0xcc40('0x26')](respondWithResult(_0x8e703,null))[_0xcc40('0x45')](handleError(_0x8e703,null));};function hasDefaultDashboard(_0x556965){var _0x1cb156=[0x65];return new BPromise(function(_0x545a90,_0x56bd89){try{if(_0x556965[_0xcc40('0x4f')]){_0x545a90(_0x1cb156);}else{return db[_0xcc40('0x50')][_0xcc40('0x60')]({'where':{'sectionId':_0x556965['id']},'raw':!![]})[_0xcc40('0x26')](function(_0x35ff2d){_0x35ff2d?_0x545a90(_0x1cb156):_0x545a90();});}}catch(_0x2da608){_0x56bd89(_0x2da608);}});}function getCustomDashboards(_0x151feb){var _0x11e552=[];return new BPromise(function(_0x52e959,_0x26a857){try{if(_0x151feb[_0xcc40('0x4f')]){return db[_0xcc40('0x61')]['findAll']({'raw':!![]})[_0xcc40('0x26')](function(_0x501430){_0x501430['forEach'](function(_0x1c7585){_0x11e552['push'](_0x1c7585['id']+0x1869f);});_0x52e959(_0x11e552);});}else{return db['UserProfileResource'][_0xcc40('0x3f')]({'where':{'sectionId':_0x151feb['id']},'raw':!![]})['then'](function(_0x45f1c8){_0x45f1c8[_0xcc40('0x62')](function(_0x9f328e){_0x11e552[_0xcc40('0x57')](_0x9f328e[_0xcc40('0x63')]+0x1869f);});_0x52e959(_0x11e552);});}}catch(_0x3b39aa){_0x26a857(_0x3b39aa);}});}function getPlugins(_0x51b023){var _0x3c3c9f=[];return new BPromise(function(_0x14eedc,_0x35b30c){try{if(_0x51b023['autoAssociation']){return db[_0xcc40('0x64')]['findAll']({'raw':!![]})[_0xcc40('0x26')](function(_0xfe8ab5){_0xfe8ab5[_0xcc40('0x62')](function(_0x5b5aed){_0x3c3c9f[_0xcc40('0x57')](_0x5b5aed['id']+0x15b38);});_0x14eedc(_0x3c3c9f);});}else{return db['UserProfileResource'][_0xcc40('0x3f')]({'where':{'sectionId':_0x51b023['id']},'raw':!![]})[_0xcc40('0x26')](function(_0xc411e4){_0xc411e4[_0xcc40('0x62')](function(_0x28b361){_0x3c3c9f['push'](_0x28b361[_0xcc40('0x63')]+0x15b38);});_0x14eedc(_0x3c3c9f);});}}catch(_0x5f0b8a){_0x35b30c(_0x5f0b8a);}});}exports[_0xcc40('0x65')]=function(_0x17f498,_0x42398d){return db[_0xcc40('0x2d')][_0xcc40('0x44')]({'where':{'id':_0x17f498[_0xcc40('0x41')]['id']}})[_0xcc40('0x26')](handleEntityNotFound(_0x42398d,null))[_0xcc40('0x26')](function(_0xe00af5){if(_0xe00af5){return db[_0xcc40('0x4d')][_0xcc40('0x4e')](function(_0x4228f4){return db[_0xcc40('0x54')][_0xcc40('0x3f')]({'where':{'userProfileId':_0x17f498[_0xcc40('0x41')]['id']},'attributes':['id'],'raw':!![]})[_0xcc40('0x26')](function(_0x5e1288){if(_0x5e1288){return db[_0xcc40('0x54')][_0xcc40('0x27')]({'where':{'userProfileId':_0x17f498[_0xcc40('0x41')]['id'],'id':_[_0xcc40('0x2c')](_0x5e1288,function(_0x4f51d9){return _0x4f51d9['id'];})},'transaction':_0x4228f4});}})[_0xcc40('0x26')](function(_0x128e03){var _0x6e1a20=_[_0xcc40('0x2c')](_0x17f498[_0xcc40('0x4c')],function(_0x3e2874){_0x3e2874[_0xcc40('0x52')]=_0x17f498[_0xcc40('0x41')]['id'];return _0x3e2874;});return db[_0xcc40('0x54')][_0xcc40('0x66')](_0x6e1a20,{'raw':!![],'transaction':_0x4228f4});})[_0xcc40('0x26')](function(_0x3d6db9){var _0x53bd92=_[_0xcc40('0x3a')](_[_0xcc40('0x2c')](_0x3d6db9,function(_0x4264d4){return _0x4264d4['get']({'plain':!![]});}),{'includeAll':![]});if(_0x53bd92){return db[_0xcc40('0x54')][_0xcc40('0x3f')]({'where':{'userProfileId':_0x17f498['params']['id'],'sectionId':_['map'](_0x53bd92,function(_0x27d63a){return _0x27d63a[_0xcc40('0x5c')];})},'attributes':['id',_0xcc40('0x5c')],'raw':!![]})[_0xcc40('0x26')](function(_0x1ed38f){var _0x41f542=_[_0xcc40('0x2c')](_0x17f498['body'],function(_0x3b0002){_0x3b0002['userProfileId']=_0x17f498[_0xcc40('0x41')]['id'];return _0x3b0002;});return db['UserProfileResource'][_0xcc40('0x66')](_0x41f542,{'raw':!![],'transaction':_0x4228f4});});}})[_0xcc40('0x45')](handleError(_0x42398d,null));});}})[_0xcc40('0x26')](function(_0x2e4202){var _0x41057f=_[_0xcc40('0x2c')](_0x2e4202,function(_0x29c9c6){return _0x29c9c6[_0xcc40('0x48')]({'plain':!![]});});})[_0xcc40('0x26')](respondWithResult(_0x42398d,null))[_0xcc40('0x45')](handleError(_0x42398d,null));};exports[_0xcc40('0x67')]=function(_0x175df1,_0x50c5d7,_0xb2fbe5){return db[_0xcc40('0x2d')][_0xcc40('0x44')]({'where':{'id':_0x175df1['params']['id']}})['then'](handleEntityNotFound(_0x50c5d7,null))[_0xcc40('0x26')](function(_0x3193b8){if(_0x3193b8){return _0x3193b8['removeResources'](_0x175df1[_0xcc40('0x2f')]['ids']);}})['then'](respondWithStatusCode(_0x50c5d7,null))[_0xcc40('0x45')](handleError(_0x50c5d7,null));};exports[_0xcc40('0x68')]=function(_0x41bebf,_0x58ebae){var _0x276373={};if(!_0x41bebf['query'][_0xcc40('0x69')])throw new Error(_0xcc40('0x6a'));if(!_0x41bebf[_0xcc40('0x2f')]['hasOwnProperty'](_0xcc40('0x35'))){_0x276373['limit']=qs[_0xcc40('0x1f')](_0x41bebf[_0xcc40('0x2f')][_0xcc40('0x1f')]);_0x276373[_0xcc40('0x1d')]=qs[_0xcc40('0x1d')](_0x41bebf[_0xcc40('0x2f')]['offset']);}return db[_0xcc40('0x2d')][_0xcc40('0x44')]({'where':{'id':_0x41bebf[_0xcc40('0x41')]['id']}})[_0xcc40('0x26')](function(_0x54615a){if(!_0x54615a)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x41bebf[_0xcc40('0x41')]['id']);return db[_0xcc40('0x2d')][_0xcc40('0x68')](_0x41bebf);})['then'](respondWithFilteredResult(_0x58ebae,_0x276373))[_0xcc40('0x45')](handleError(_0x58ebae,null));}; \ No newline at end of file +var _0x8da8=['api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','catch','params','length','body','clone','options','find','get','createdAt','crudPermissions','updatedAt','each','autoAssociation','UserProfileResource','sectionId','omit','userProfileId','UserProfileSection','create','Resources','update','describe','addSections','transaction','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','getResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x14e9fc,_0x396121){var _0x1c3893=function(_0x3bbe89){while(--_0x3bbe89){_0x14e9fc['push'](_0x14e9fc['shift']());}};_0x1c3893(++_0x396121);}(_0x8da8,0x149));var _0x88da=function(_0x3ef5d1,_0x5e7c02){_0x3ef5d1=_0x3ef5d1-0x0;var _0x4fdeef=_0x8da8[_0x3ef5d1];return _0x4fdeef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88da('0x0'));var zipdir=require(_0x88da('0x1'));var jsonpatch=require(_0x88da('0x2'));var rp=require(_0x88da('0x3'));var moment=require('moment');var BPromise=require(_0x88da('0x4'));var Mustache=require(_0x88da('0x5'));var util=require(_0x88da('0x6'));var path=require('path');var sox=require(_0x88da('0x7'));var csv=require('to-csv');var ejs=require(_0x88da('0x8'));var fs=require('fs');var fs_extra=require(_0x88da('0x9'));var _=require(_0x88da('0xa'));var squel=require(_0x88da('0xb'));var crypto=require('crypto');var jsforce=require(_0x88da('0xc'));var deskjs=require(_0x88da('0xd'));var toCsv=require(_0x88da('0xe'));var querystring=require('querystring');var Papa=require(_0x88da('0xf'));var Redis=require(_0x88da('0x10'));var authService=require(_0x88da('0x11'));var qs=require(_0x88da('0x12'));var as=require(_0x88da('0x13'));var hardwareService=require(_0x88da('0x14'));var logger=require(_0x88da('0x15'))(_0x88da('0x16'));var utils=require(_0x88da('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x88da('0x18'));var db=require(_0x88da('0x19'))['db'];config[_0x88da('0x1a')]=_[_0x88da('0x1b')](config[_0x88da('0x1a')],{'host':_0x88da('0x1c'),'port':0x18eb});var socket=require(_0x88da('0x1d'))(new Redis(config['redis']));require(_0x88da('0x1e'))[_0x88da('0x1f')](socket);function respondWithStatusCode(_0x50a41a,_0x4fc08a){_0x4fc08a=_0x4fc08a||0xcc;return function(_0x332702){if(_0x332702){return _0x50a41a['sendStatus'](_0x4fc08a);}return _0x50a41a[_0x88da('0x20')](_0x4fc08a)[_0x88da('0x21')]();};}function respondWithResult(_0x50f012,_0x4b374f){_0x4b374f=_0x4b374f||0xc8;return function(_0x4fb25b){if(_0x4fb25b){return _0x50f012[_0x88da('0x20')](_0x4b374f)[_0x88da('0x22')](_0x4fb25b);}};}function respondWithFilteredResult(_0x59767a,_0x91eb26){return function(_0x55e4d3){if(_0x55e4d3){var _0x3da18e=typeof _0x91eb26[_0x88da('0x23')]===_0x88da('0x24')&&typeof _0x91eb26['limit']==='undefined';var _0x34a6d6=_0x55e4d3['count'];var _0x5b1b0c=_0x3da18e?0x0:_0x91eb26[_0x88da('0x23')];var _0x5b330e=_0x3da18e?_0x55e4d3[_0x88da('0x25')]:_0x91eb26['offset']+_0x91eb26[_0x88da('0x26')];var _0x241c0a;if(_0x5b330e>=_0x34a6d6){_0x5b330e=_0x34a6d6;_0x241c0a=0xc8;}else{_0x241c0a=0xce;}_0x59767a['status'](_0x241c0a);return _0x59767a[_0x88da('0x27')](_0x88da('0x28'),_0x5b1b0c+'-'+_0x5b330e+'/'+_0x34a6d6)[_0x88da('0x22')](_0x55e4d3);}return null;};}function patchUpdates(_0x357b88){return function(_0x14efb4){try{jsonpatch[_0x88da('0x29')](_0x14efb4,_0x357b88,!![]);}catch(_0x260e7d){return BPromise[_0x88da('0x2a')](_0x260e7d);}return _0x14efb4[_0x88da('0x2b')]();};}function saveUpdates(_0x466455,_0x137306){return function(_0x4e6b82){if(_0x4e6b82){return _0x4e6b82['update'](_0x466455)['then'](function(_0x3e05ff){return _0x3e05ff;});}return null;};}function removeEntity(_0x2a1cc7,_0x5ad1cf){return function(_0xeb50d8){if(_0xeb50d8){return _0xeb50d8[_0x88da('0x2c')]()['then'](function(){_0x2a1cc7[_0x88da('0x20')](0xcc)[_0x88da('0x21')]();});}};}function handleEntityNotFound(_0x5d9457,_0x5af072){return function(_0x2941f8){if(!_0x2941f8){_0x5d9457[_0x88da('0x2d')](0x194);}return _0x2941f8;};}function handleError(_0x5ba9fa,_0x1a7e4b){_0x1a7e4b=_0x1a7e4b||0x1f4;return function(_0x2cba4d){logger['error'](_0x2cba4d['stack']);if(_0x2cba4d[_0x88da('0x2e')]){delete _0x2cba4d[_0x88da('0x2e')];}_0x5ba9fa[_0x88da('0x20')](_0x1a7e4b)[_0x88da('0x2f')](_0x2cba4d);};}exports[_0x88da('0x30')]=function(_0x5aa955,_0x3dd7b3){var _0x33c5af={},_0xf28a0={},_0x16086d={'count':0x0,'rows':[]};var _0x3cfecc=_[_0x88da('0x31')](db[_0x88da('0x32')][_0x88da('0x33')],function(_0x232b13){return{'name':_0x232b13[_0x88da('0x34')],'type':_0x232b13[_0x88da('0x35')][_0x88da('0x36')]};});_0xf28a0['model']=_[_0x88da('0x31')](_0x3cfecc,'name');_0xf28a0['query']=_[_0x88da('0x37')](_0x5aa955[_0x88da('0x38')]);_0xf28a0[_0x88da('0x39')]=_[_0x88da('0x3a')](_0xf28a0[_0x88da('0x3b')],_0xf28a0['query']);_0x33c5af[_0x88da('0x3c')]=_[_0x88da('0x3a')](_0xf28a0['model'],qs[_0x88da('0x3d')](_0x5aa955['query'][_0x88da('0x3d')]));_0x33c5af[_0x88da('0x3c')]=_0x33c5af[_0x88da('0x3c')]['length']?_0x33c5af[_0x88da('0x3c')]:_0xf28a0[_0x88da('0x3b')];if(!_0x5aa955[_0x88da('0x38')][_0x88da('0x3e')](_0x88da('0x3f'))){_0x33c5af['limit']=qs[_0x88da('0x26')](_0x5aa955[_0x88da('0x38')]['limit']);_0x33c5af[_0x88da('0x23')]=qs[_0x88da('0x23')](_0x5aa955['query'][_0x88da('0x23')]);}_0x33c5af[_0x88da('0x40')]=qs[_0x88da('0x41')](_0x5aa955['query'][_0x88da('0x41')]);_0x33c5af[_0x88da('0x42')]=qs[_0x88da('0x39')](_['pick'](_0x5aa955[_0x88da('0x38')],_0xf28a0[_0x88da('0x39')]),_0x3cfecc);if(_0x5aa955['query']['filter']){_0x33c5af[_0x88da('0x42')]=_[_0x88da('0x43')](_0x33c5af[_0x88da('0x42')],{'$or':_['map'](_0x3cfecc,function(_0x5629b9){if(_0x5629b9[_0x88da('0x35')]!==_0x88da('0x44')){var _0x488753={};_0x488753[_0x5629b9['name']]={'$like':'%'+_0x5aa955[_0x88da('0x38')][_0x88da('0x45')]+'%'};return _0x488753;}})});}_0x33c5af=_[_0x88da('0x43')]({},_0x33c5af,_0x5aa955['options']);var _0x389cc0={'where':_0x33c5af[_0x88da('0x42')]};return db[_0x88da('0x32')][_0x88da('0x25')](_0x389cc0)[_0x88da('0x46')](function(_0x41fb53){_0x16086d[_0x88da('0x25')]=_0x41fb53;if(_0x5aa955['query'][_0x88da('0x47')]){_0x33c5af[_0x88da('0x48')]=[{'all':!![]}];}return db[_0x88da('0x32')][_0x88da('0x49')](_0x33c5af);})[_0x88da('0x46')](function(_0x38a9d2){_0x16086d[_0x88da('0x4a')]=_0x38a9d2;return _0x16086d;})[_0x88da('0x46')](respondWithFilteredResult(_0x3dd7b3,_0x33c5af))[_0x88da('0x4b')](handleError(_0x3dd7b3,null));};exports['show']=function(_0x1121be,_0x5bc884){var _0x3ddd5e={'raw':![],'where':{'id':_0x1121be[_0x88da('0x4c')]['id']}},_0x2e42bf={};_0x2e42bf[_0x88da('0x3b')]=_['keys'](db[_0x88da('0x32')][_0x88da('0x33')]);_0x2e42bf[_0x88da('0x38')]=_[_0x88da('0x37')](_0x1121be[_0x88da('0x38')]);_0x2e42bf['filters']=_[_0x88da('0x3a')](_0x2e42bf['model'],_0x2e42bf['query']);_0x3ddd5e[_0x88da('0x3c')]=_[_0x88da('0x3a')](_0x2e42bf['model'],qs[_0x88da('0x3d')](_0x1121be[_0x88da('0x38')]['fields']));_0x3ddd5e[_0x88da('0x3c')]=_0x3ddd5e[_0x88da('0x3c')][_0x88da('0x4d')]?_0x3ddd5e[_0x88da('0x3c')]:_0x2e42bf['model'];if(_0x1121be[_0x88da('0x38')][_0x88da('0x47')]){_0x3ddd5e[_0x88da('0x48')]=[{'all':!![]}];}_0x3ddd5e=_[_0x88da('0x43')]({},_0x3ddd5e,_0x1121be['options']);return db['UserProfile']['find'](_0x3ddd5e)[_0x88da('0x46')](handleEntityNotFound(_0x5bc884,null))[_0x88da('0x46')](respondWithResult(_0x5bc884,null))[_0x88da('0x4b')](handleError(_0x5bc884,null));};exports['create']=function(_0x545d18,_0x2dfed3){return db['UserProfile']['create'](_0x545d18[_0x88da('0x4e')],{})[_0x88da('0x46')](respondWithResult(_0x2dfed3,0xc9))[_0x88da('0x4b')](handleError(_0x2dfed3,null));};exports[_0x88da('0x4f')]=function(_0x444de4,_0x428c04){var _0x4e9c17={'where':{'id':_0x444de4[_0x88da('0x4c')]['id']}},_0x1bc76b={};_0x1bc76b[_0x88da('0x3b')]=_[_0x88da('0x37')](db[_0x88da('0x32')][_0x88da('0x33')]);_0x4e9c17[_0x88da('0x3c')]=_[_0x88da('0x3a')](_0x1bc76b['model'],qs[_0x88da('0x3d')](_0x444de4[_0x88da('0x38')]['fields']));_0x4e9c17[_0x88da('0x3c')]=_0x4e9c17['attributes'][_0x88da('0x4d')]?_0x4e9c17['attributes']:_0x1bc76b[_0x88da('0x3b')];if(_0x444de4[_0x88da('0x38')][_0x88da('0x47')]){_0x4e9c17['include']=[{'all':!![]}];}_0x4e9c17=_[_0x88da('0x43')]({},_0x4e9c17,_0x444de4[_0x88da('0x50')]);return db[_0x88da('0x32')][_0x88da('0x51')](_0x4e9c17)[_0x88da('0x46')](handleEntityNotFound(_0x428c04,null))[_0x88da('0x46')](function(_0x266fe6){if(_0x266fe6){var _0x235aca=_0x266fe6[_0x88da('0x52')]({'plain':!![]});_0x235aca=qs['omit'](_0x235aca,['id',_0x88da('0x53'),'updatedAt',_0x88da('0x54')]);_0x444de4[_0x88da('0x4e')]=_['omit'](_0x444de4[_0x88da('0x4e')],['id','createdAt',_0x88da('0x55')]);return db['sequelize']['transaction'](function(_0x51b9cb){return db[_0x88da('0x32')]['create'](_['merge'](_0x235aca,_0x444de4[_0x88da('0x4e')]),{'include':_0x444de4[_0x88da('0x38')][_0x88da('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x51b9cb})['then'](function(_0x1bfd78){var _0xf221d2=_0x1bfd78['get']({'plain':!![]});return db['UserProfileSection'][_0x88da('0x49')]({'where':{'userProfileId':_0x444de4[_0x88da('0x4c')]['id']},'raw':!![]})[_0x88da('0x46')](function(_0x6938ab){if(_0x6938ab){return BPromise[_0x88da('0x56')](_0x6938ab,function(_0x72dbec){return new BPromise(function(_0x58cb5c,_0x20244e){if(_0x72dbec['autoAssociation']===null||_0x72dbec[_0x88da('0x57')]===0x1)_0x58cb5c(null);return db[_0x88da('0x58')][_0x88da('0x49')]({'where':{'sectionId':_0x72dbec['id']},'raw':!![]})[_0x88da('0x46')](function(_0x376f0e){var _0x2b2aaa=_[_0x88da('0x31')](_0x376f0e,function(_0x4d2256){return qs['omit'](_0x4d2256,['id',_0x88da('0x53'),'updatedAt',_0x88da('0x59')]);});_0x58cb5c(_0x2b2aaa);})['catch'](function(_0x32966f){_0x20244e(_0x32966f);});})[_0x88da('0x46')](function(_0x1c4061){var _0x1da480=qs[_0x88da('0x5a')](_0x72dbec,['id',_0x88da('0x53'),_0x88da('0x55')]);_0x1da480[_0x88da('0x5b')]=_0xf221d2['id'];if(_0x1c4061)_0x1da480['Resources']=_0x1c4061;return _0x1da480;})[_0x88da('0x46')](function(_0x2d84f5){return db[_0x88da('0x5c')][_0x88da('0x5d')](_0x2d84f5,{'include':[{'model':db['UserProfileResource'],'as':_0x88da('0x5e')}],'raw':!![],'transaction':_0x51b9cb});});})[_0x88da('0x46')](function(){return _0xf221d2;});}});});});}})[_0x88da('0x46')](respondWithResult(_0x428c04,0xc9))[_0x88da('0x4b')](handleError(_0x428c04,null));};exports[_0x88da('0x5f')]=function(_0x342087,_0x3132b8){if(_0x342087[_0x88da('0x4e')]['id']){delete _0x342087[_0x88da('0x4e')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x342087[_0x88da('0x4c')]['id']}})[_0x88da('0x46')](handleEntityNotFound(_0x3132b8,null))[_0x88da('0x46')](saveUpdates(_0x342087[_0x88da('0x4e')],null))['then'](respondWithResult(_0x3132b8,null))[_0x88da('0x4b')](handleError(_0x3132b8,null));};exports[_0x88da('0x2c')]=function(_0x20a006,_0x57e15a){return db['UserProfile']['find']({'where':{'id':_0x20a006['params']['id']}})[_0x88da('0x46')](handleEntityNotFound(_0x57e15a,null))[_0x88da('0x46')](removeEntity(_0x57e15a,null))[_0x88da('0x4b')](handleError(_0x57e15a,null));};exports['describe']=function(_0x468d5b,_0x57e6e6){return db[_0x88da('0x32')][_0x88da('0x60')]()[_0x88da('0x46')](respondWithResult(_0x57e6e6,null))[_0x88da('0x4b')](handleError(_0x57e6e6,null));};exports[_0x88da('0x61')]=function(_0x1d887f,_0x53fa19){var _0x596b8c=_0x1d887f[_0x88da('0x4e')];return db[_0x88da('0x32')][_0x88da('0x51')]({'where':{'id':_0x1d887f[_0x88da('0x4c')]['id']}})[_0x88da('0x46')](handleEntityNotFound(_0x53fa19,null))['then'](function(_0x42eaee){if(_0x42eaee){return db['sequelize'][_0x88da('0x62')](function(_0xd06ddf){return db[_0x88da('0x5c')][_0x88da('0x2c')]({'where':{'userProfileId':_0x1d887f[_0x88da('0x4c')]['id'],'sectionId':_['map'](_0x596b8c,function(_0x3bc029){return _0x3bc029[_0x88da('0x59')];})},'transaction':_0xd06ddf})['then'](function(){var _0x740f36=_[_0x88da('0x31')](_0x596b8c,function(_0x4ea445){_0x4ea445['userProfileId']=_0x1d887f[_0x88da('0x4c')]['id'];return _0x4ea445;});var _0x1e8f6c=[];return BPromise[_0x88da('0x56')](_0x740f36,function(_0x1d7575){return db[_0x88da('0x5c')][_0x88da('0x5d')](_0x1d7575,{'include':[{'model':db[_0x88da('0x58')],'as':_0x88da('0x5e')}],'raw':!![],'transaction':_0xd06ddf})[_0x88da('0x46')](function(_0x49e9ee){_0x1e8f6c[_0x88da('0x63')](_0x49e9ee[_0x88da('0x52')]({'plain':!![]}));});})[_0x88da('0x46')](function(){return _0x1e8f6c;});});});}})['then'](function(_0x39729c){return _0x39729c;})[_0x88da('0x46')](respondWithResult(_0x53fa19,null))[_0x88da('0x4b')](handleError(_0x53fa19,null));};exports[_0x88da('0x64')]=function(_0x4599dc,_0xcce555){var _0x28a0db;return db[_0x88da('0x32')][_0x88da('0x51')]({'where':{'id':_0x4599dc[_0x88da('0x4c')]['id']},'attributes':['id',_0x88da('0x2e')]})[_0x88da('0x46')](handleEntityNotFound(_0xcce555,null))[_0x88da('0x46')](function(_0x93f1af){if(_0x93f1af){_0x28a0db=_0x93f1af;return db[_0x88da('0x5c')][_0x88da('0x2c')]({'where':{'userProfileId':_0x4599dc[_0x88da('0x4c')]['id'],'sectionId':_0x4599dc['query'][_0x88da('0x65')]}});}})[_0x88da('0x46')](function(){return _0x28a0db;})[_0x88da('0x46')](respondWithStatusCode(_0xcce555,null))['catch'](handleError(_0xcce555,null));};exports[_0x88da('0x66')]=function(_0x21afa7,_0x23dcfd){var _0xaef774=[];var _0x49ef20=[];return db[_0x88da('0x5c')][_0x88da('0x49')]({'where':{'userProfileId':_0x21afa7[_0x88da('0x4c')]['id']},'raw':!![]})['then'](function(_0x3c1c0a){_0xaef774=_[_0x88da('0x45')](_0x3c1c0a,function(_0x4a66a2){return _0x4a66a2['enabled']===0x1||_[_0x88da('0x67')]([0x3eb,0x709],_0x4a66a2['sectionId']);});if(!_[_0x88da('0x68')](_0xaef774)){return _[_0x88da('0x31')](_0xaef774,function(_0x5d064f){return _0x5d064f[_0x88da('0x59')];});}else{return;}})[_0x88da('0x46')](function(_0x1e021b){if(_0x1e021b)_0x49ef20=_0x1e021b;if(_['includes'](_0x49ef20,0x64)){var _0x537ccd=_[_0x88da('0x51')](_0xaef774,{'sectionId':0x64});return hasDefaultDashboard(_0x537ccd)[_0x88da('0x46')](function(_0xac069a){return _['map'](_0xaef774,function(_0x4ee519){if(_0x4ee519[_0x88da('0x59')]===0x64){_0x4ee519[_0x88da('0x69')]=_0xac069a;}return _0x4ee519;});});}else{return;}})[_0x88da('0x46')](function(_0x5543b5){if(_0x5543b5)_0xaef774=_0x5543b5;if(_['includes'](_0x49ef20,0x3eb)){var _0x3f8e3f=_['find'](_0xaef774,{'sectionId':0x3eb});return getCustomDashboards(_0x3f8e3f)[_0x88da('0x46')](function(_0x86769c){return _[_0x88da('0x31')](_0xaef774,function(_0x2aa376){if(_0x3f8e3f[_0x88da('0x6a')]){if(_0x2aa376[_0x88da('0x59')]===0x3eb){_0x2aa376[_0x88da('0x69')]=_0x86769c;}}else{if(_0x2aa376[_0x88da('0x59')]===0x64){if(!_0x2aa376[_0x88da('0x69')]){_0x2aa376[_0x88da('0x69')]=[];}_0x2aa376[_0x88da('0x69')]=_0x2aa376[_0x88da('0x69')][_0x88da('0x6b')](_0x86769c);}}return _0x2aa376;});});}else{return;}})[_0x88da('0x46')](function(_0x3abbad){if(_0x3abbad)_0xaef774=_0x3abbad;if(_[_0x88da('0x67')](_0x49ef20,0x709)){var _0x45f962=_['find'](_0xaef774,{'sectionId':0x709});return getPlugins(_0x45f962)[_0x88da('0x46')](function(_0x1df041){if(_0x45f962['enabled']){return _[_0x88da('0x31')](_0xaef774,function(_0x542d0b){if(_0x542d0b[_0x88da('0x59')]===0x709){_0x542d0b['subsections']=_0x1df041;}return _0x542d0b;});}else{var _0xf2de38={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1df041};var _0x25feef=_[_0x88da('0x31')](_0xaef774);_0x25feef[_0x88da('0x63')](_0xf2de38);return _0x25feef;}});}else{return;}})[_0x88da('0x46')](function(_0x458a5e){if(_0x458a5e)_0xaef774=_0x458a5e;return _[_0x88da('0x45')](_0xaef774,[_0x88da('0x6a'),0x1]);})['then'](respondWithResult(_0x23dcfd,null))[_0x88da('0x4b')](handleError(_0x23dcfd,null));};function hasDefaultDashboard(_0x30ba10){var _0x281af5=[0x65];return new BPromise(function(_0x36fe2e,_0xf6291a){try{if(_0x30ba10['autoAssociation']){_0x36fe2e(_0x281af5);}else{return db['UserProfileResource'][_0x88da('0x6c')]({'where':{'sectionId':_0x30ba10['id']},'raw':!![]})[_0x88da('0x46')](function(_0x1ffa4b){_0x1ffa4b?_0x36fe2e(_0x281af5):_0x36fe2e();});}}catch(_0x359170){_0xf6291a(_0x359170);}});}function getCustomDashboards(_0x266c9c){var _0x3c5fc0=[];return new BPromise(function(_0x5373e6,_0x32dafc){try{if(_0x266c9c['autoAssociation']){return db[_0x88da('0x6d')][_0x88da('0x49')]({'raw':!![]})[_0x88da('0x46')](function(_0x4eb431){_0x4eb431[_0x88da('0x6e')](function(_0x41b439){_0x3c5fc0[_0x88da('0x63')](_0x41b439['id']+0x1869f);});_0x5373e6(_0x3c5fc0);});}else{return db[_0x88da('0x58')][_0x88da('0x49')]({'where':{'sectionId':_0x266c9c['id']},'raw':!![]})[_0x88da('0x46')](function(_0x4242a4){_0x4242a4[_0x88da('0x6e')](function(_0x51b077){_0x3c5fc0[_0x88da('0x63')](_0x51b077[_0x88da('0x6f')]+0x1869f);});_0x5373e6(_0x3c5fc0);});}}catch(_0x1d026a){_0x32dafc(_0x1d026a);}});}function getPlugins(_0xbf0731){var _0x3a1df8=[];return new BPromise(function(_0xa9bdcd,_0x2241f8){try{if(_0xbf0731[_0x88da('0x57')]){return db[_0x88da('0x70')]['findAll']({'raw':!![]})['then'](function(_0xed5dac){_0xed5dac[_0x88da('0x6e')](function(_0x4254a1){_0x3a1df8['push'](_0x4254a1['id']+0x15b38);});_0xa9bdcd(_0x3a1df8);});}else{return db['UserProfileResource'][_0x88da('0x49')]({'where':{'sectionId':_0xbf0731['id']},'raw':!![]})[_0x88da('0x46')](function(_0xb17d01){_0xb17d01[_0x88da('0x6e')](function(_0x307fd0){_0x3a1df8['push'](_0x307fd0[_0x88da('0x6f')]+0x15b38);});_0xa9bdcd(_0x3a1df8);});}}catch(_0x2cba53){_0x2241f8(_0x2cba53);}});}exports[_0x88da('0x71')]=function(_0x266b96,_0x3d1bcc){return db[_0x88da('0x32')][_0x88da('0x51')]({'where':{'id':_0x266b96['params']['id']}})[_0x88da('0x46')](handleEntityNotFound(_0x3d1bcc,null))[_0x88da('0x46')](function(_0x57737c){if(_0x57737c){return db['sequelize'][_0x88da('0x62')](function(_0xa99b58){return db['UserProfileSection'][_0x88da('0x49')]({'where':{'userProfileId':_0x266b96[_0x88da('0x4c')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xf63584){if(_0xf63584){return db[_0x88da('0x5c')][_0x88da('0x2c')]({'where':{'userProfileId':_0x266b96['params']['id'],'id':_['map'](_0xf63584,function(_0x2092c8){return _0x2092c8['id'];})},'transaction':_0xa99b58});}})['then'](function(_0x2d241c){var _0x3a8707=_[_0x88da('0x31')](_0x266b96[_0x88da('0x4e')],function(_0x1111d2){_0x1111d2[_0x88da('0x5b')]=_0x266b96['params']['id'];return _0x1111d2;});return db[_0x88da('0x5c')][_0x88da('0x72')](_0x3a8707,{'raw':!![],'transaction':_0xa99b58});})[_0x88da('0x46')](function(_0x310cdc){var _0x2e6d46=_[_0x88da('0x45')](_[_0x88da('0x31')](_0x310cdc,function(_0x53ec47){return _0x53ec47['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2e6d46){return db[_0x88da('0x5c')][_0x88da('0x49')]({'where':{'userProfileId':_0x266b96[_0x88da('0x4c')]['id'],'sectionId':_[_0x88da('0x31')](_0x2e6d46,function(_0x1b4be6){return _0x1b4be6[_0x88da('0x59')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x88da('0x46')](function(_0x2b9546){var _0x32a539=_[_0x88da('0x31')](_0x266b96[_0x88da('0x4e')],function(_0x5675a9){_0x5675a9[_0x88da('0x5b')]=_0x266b96[_0x88da('0x4c')]['id'];return _0x5675a9;});return db['UserProfileResource']['bulkCreate'](_0x32a539,{'raw':!![],'transaction':_0xa99b58});});}})['catch'](handleError(_0x3d1bcc,null));});}})[_0x88da('0x46')](function(_0x543752){var _0x49fbf9=_[_0x88da('0x31')](_0x543752,function(_0xa55bb3){return _0xa55bb3[_0x88da('0x52')]({'plain':!![]});});})['then'](respondWithResult(_0x3d1bcc,null))[_0x88da('0x4b')](handleError(_0x3d1bcc,null));};exports['removeResources']=function(_0x264cdd,_0x4ceaec,_0x4fda8a){return db[_0x88da('0x32')][_0x88da('0x51')]({'where':{'id':_0x264cdd[_0x88da('0x4c')]['id']}})[_0x88da('0x46')](handleEntityNotFound(_0x4ceaec,null))[_0x88da('0x46')](function(_0x1b9237){if(_0x1b9237){return _0x1b9237['removeResources'](_0x264cdd[_0x88da('0x38')][_0x88da('0x65')]);}})[_0x88da('0x46')](respondWithStatusCode(_0x4ceaec,null))[_0x88da('0x4b')](handleError(_0x4ceaec,null));};exports[_0x88da('0x73')]=function(_0x1463c8,_0x4c0c69){var _0x347261={};if(!_0x1463c8['query']['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x1463c8[_0x88da('0x38')][_0x88da('0x3e')](_0x88da('0x3f'))){_0x347261[_0x88da('0x26')]=qs[_0x88da('0x26')](_0x1463c8['query'][_0x88da('0x26')]);_0x347261['offset']=qs['offset'](_0x1463c8[_0x88da('0x38')]['offset']);}return db['UserProfile'][_0x88da('0x51')]({'where':{'id':_0x1463c8['params']['id']}})[_0x88da('0x46')](function(_0x31320a){if(!_0x31320a)throw new Error(_0x88da('0x74')+_0x1463c8[_0x88da('0x4c')]['id']);return db['UserProfile']['getResources'](_0x1463c8);})[_0x88da('0x46')](respondWithFilteredResult(_0x4c0c69,_0x347261))[_0x88da('0x4b')](handleError(_0x4c0c69,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index c35e760..bcb649a 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 _0xee87=['UserProfile','setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0xd1c196,_0xa3d4f6){var _0x38fb6d=function(_0x1aa321){while(--_0x1aa321){_0xd1c196['push'](_0xd1c196['shift']());}};_0x38fb6d(++_0xa3d4f6);}(_0xee87,0x10d));var _0x7ee8=function(_0x10605f,_0x173e0c){_0x10605f=_0x10605f-0x0;var _0x8d27ea=_0xee87[_0x10605f];return _0x8d27ea;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x7ee8('0x0'))['db'][_0x7ee8('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7ee8('0x2')](0x0);var events={'afterCreate':_0x7ee8('0x3'),'afterUpdate':_0x7ee8('0x4'),'afterDestroy':_0x7ee8('0x5')};function emitEvent(_0x41c2cc){return function(_0x2f1867,_0x32466c,_0x23a89c){UserProfileEvents['emit'](_0x41c2cc+':'+_0x2f1867['id'],_0x2f1867);UserProfileEvents[_0x7ee8('0x6')](_0x41c2cc,_0x2f1867);_0x23a89c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x7ee8('0x7')](e,emitEvent(event));}}module[_0x7ee8('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x81c6=['exports','../../mysqldb','update','remove','emit','hook'];(function(_0x27d023,_0x1592ac){var _0x15350b=function(_0x27edee){while(--_0x27edee){_0x27d023['push'](_0x27d023['shift']());}};_0x15350b(++_0x1592ac);}(_0x81c6,0x1d5));var _0x681c=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x81c6[_0x355ce8];return _0x1db8b8;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x681c('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x681c('0x1'),'afterDestroy':_0x681c('0x2')};function emitEvent(_0x7a556b){return function(_0x5566e5,_0x44c18e,_0x2aff9d){UserProfileEvents[_0x681c('0x3')](_0x7a556b+':'+_0x5566e5['id'],_0x5566e5);UserProfileEvents[_0x681c('0x3')](_0x7a556b,_0x5566e5);_0x2aff9d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x681c('0x4')](e,emitEvent(event));}}module[_0x681c('0x5')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 25646ac..8f357bb 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 _0xa1d0=['CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','Agents','membername','Telephones','telephone','queue','VoiceQueue','inbound','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','VoiceQueues','QueueCampaigns','users','agents','User','Users','role','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','customdashboards','intervals','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','from','user_has_','where','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','ignore','union','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','ThroughTags','color','tag','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','findAll','field','value','model','then','associatedResources','map','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xa1d0,0x9e));var _0x0a1d=function(_0x47ce31,_0x1e7997){_0x47ce31=_0x47ce31-0x0;var _0x3958b0=_0xa1d0[_0x47ce31];return _0x3958b0;};'use strict';var _=require(_0x0a1d('0x0'));var attributes=require(_0x0a1d('0x1'));var squel=require(_0x0a1d('0x2'));module[_0x0a1d('0x3')]=function(_0x5bb6a7){var _0x5c5d4e=_0x5bb6a7[_0x0a1d('0x4')];function _0x134285(_0x2bfe07,_0x33fe27){return new Promise(function(_0x4bf041,_0x27dbed){if(!_0x33fe27)return _0x4bf041(null);var _0x1bd1b9=_0x33fe27[_0x0a1d('0x5')]?{[_0x33fe27['filter']['field']]:_0x33fe27[_0x0a1d('0x5')]['value']}:undefined;return _0x5c5d4e[_0x2bfe07][_0x0a1d('0x6')]({'where':_0x1bd1b9,'raw':!![]})['then'](function(_0x3f63e4){_0x33fe27['associatedResources']=_['map'](_0x3f63e4,'id');_0x4bf041(_0x33fe27);})['catch'](function(_0x2172ae){_0x27dbed(_0x2172ae);});});}function _0xc780d6(_0x481a0d,_0x1cd836){return new Promise(function(_0x44dc0e,_0x4788f6){var _0x2290d1=_0x481a0d['filter']?{[_0x481a0d[_0x0a1d('0x5')][_0x0a1d('0x7')]]:_0x481a0d[_0x0a1d('0x5')][_0x0a1d('0x8')]}:undefined;return _0x5c5d4e[_0x481a0d[_0x0a1d('0x9')]][_0x0a1d('0x6')]({'where':_0x2290d1,'raw':!![]})[_0x0a1d('0xa')](function(_0x2b1a5f){_0x1cd836[_0x0a1d('0xb')]=_[_0x0a1d('0xc')](_0x2b1a5f,function(_0x52a765){return _0x52a765[_0x0a1d('0xd')];});_0x44dc0e(_0x1cd836);})[_0x0a1d('0xe')](function(_0x196c26){_0x4788f6(_0x196c26);});});}function _0x4473d1(_0x295cae,_0x18d508,_0x95828d){if(!_0x18d508)return Promise[_0x0a1d('0xf')](null);return new Promise(function(_0x1faac3,_0x389f8f){return _0x5c5d4e[_0x0a1d('0x10')][_0x0a1d('0x6')]({'where':{'sectionId':_0x18d508['id']},'raw':!![]})[_0x0a1d('0xa')](function(_0xfbeb6e){if(_0x295cae[_0x0a1d('0x7')]&&_0x295cae['field']!=='id'){_0x18d508['associatedResources']=_[_0x0a1d('0xc')](_0xfbeb6e,function(_0x590c48){return _0x590c48[_0x295cae[_0x0a1d('0x7')]];});}else{if(_0x95828d===_0x0a1d('0x11')){_0x18d508[_0x0a1d('0xb')]=_[_0x0a1d('0xc')](_0xfbeb6e,function(_0x330a89){return{'id':_0x330a89[_0x0a1d('0x12')],'type':_0x330a89[_0x0a1d('0x13')]};});}else{_0x18d508['associatedResources']=_[_0x0a1d('0xc')](_0xfbeb6e,function(_0x42dcf2){return _0x42dcf2['resourceId'];});}}_0x1faac3(_0x18d508);})['catch'](function(_0x436826){_0x389f8f(_0x436826);});});}function _0x4c3157(_0x5a95d1,_0x42ca2e){var _0x51f71d={'parentSections':[]};switch(_0x5a95d1[_0x0a1d('0x14')]()){case _0x0a1d('0x15'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x17');break;case _0x0a1d('0x18'):_0x51f71d['childModel']='SquareOdbc';break;case'squarerecordings':_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x19');_0x51f71d[_0x0a1d('0x1a')]=[{'name':_0x0a1d('0x1b'),'field':'name','foreignKey':_0x0a1d('0x1c')}];break;case _0x0a1d('0x1d'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x1e');break;case _0x0a1d('0x1f'):_0x51f71d[_0x0a1d('0x16')]='CmContact';_0x51f71d[_0x0a1d('0x1a')]=[{'name':_0x0a1d('0x20'),'field':'id','foreignKey':_0x0a1d('0x21')}];break;case _0x0a1d('0x22'):_0x51f71d['childModel']=_0x0a1d('0x23');break;case _0x0a1d('0x24'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x25');break;case _0x0a1d('0x26'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x27');break;case'chatqueues':_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x28');break;case _0x0a1d('0x29'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x2a');break;case _0x0a1d('0x2b'):_0x51f71d['childModel']=_0x0a1d('0x2c');break;case _0x0a1d('0x2d'):_0x51f71d[_0x0a1d('0x16')]='FaxAccount';break;case _0x0a1d('0x2e'):case'internalroutes':case _0x0a1d('0x2f'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x30');break;case _0x0a1d('0x31'):_0x51f71d[_0x0a1d('0x16')]='VoiceContext';break;case'voicemails':_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x32');break;case _0x0a1d('0x33'):_0x51f71d[_0x0a1d('0x16')]='VoiceRecording';_0x51f71d[_0x0a1d('0x1a')]=[{'name':_0x0a1d('0x34'),'field':'name','foreignKey':_0x0a1d('0x35'),'model':'User','filter':{'field':'role','value':['agent']}},{'name':_0x0a1d('0x36'),'field':'name','foreignKey':_0x0a1d('0x35'),'model':'User','filter':{'field':'role','value':[_0x0a1d('0x37')]}},{'name':'VoiceQueues','field':_0x0a1d('0xd'),'foreignKey':_0x0a1d('0x38'),'model':_0x0a1d('0x39'),'filter':{'field':'type','value':[_0x0a1d('0x3a')]}},{'name':'QueueCampaigns','field':_0x0a1d('0xd'),'foreignKey':_0x0a1d('0x38'),'model':_0x0a1d('0x39'),'filter':{'field':_0x0a1d('0x13'),'value':[_0x0a1d('0x3b')]}}];break;case _0x0a1d('0x3c'):_0x51f71d[_0x0a1d('0x16')]='VoiceMusicOnHold';break;case _0x0a1d('0x3d'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x3e');break;case _0x0a1d('0x3f'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x40');break;case _0x0a1d('0x41'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x42');break;case _0x0a1d('0x43'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x44');break;case _0x0a1d('0x45'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x46');break;case'mailsubstatuses':_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x47');break;case _0x0a1d('0x48'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x49');break;case _0x0a1d('0x4a'):_0x51f71d['childModel']='OpenchannelAccount';break;case'smsqueues':_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x4b');break;case'smsaccounts':_0x51f71d[_0x0a1d('0x16')]='SmsAccount';break;case _0x0a1d('0x4c'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x4d');break;case _0x0a1d('0x4e'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x4f');break;case'teams':_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x50');break;case _0x0a1d('0x51'):case _0x0a1d('0x52'):_0x51f71d[_0x0a1d('0x16')]='VoiceQueue';if(_0x42ca2e){_0x51f71d['parentSections']=[{'name':_0x0a1d('0x53')},{'name':_0x0a1d('0x54')}];}break;case _0x0a1d('0x55'):case _0x0a1d('0x56'):case'telephones':_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x57');if(_0x42ca2e){_0x51f71d[_0x0a1d('0x1a')]=[{'name':_0x0a1d('0x58'),'filter':{'field':_0x0a1d('0x59'),'value':[_0x0a1d('0x5a'),_0x0a1d('0x5b')]},'ignore':!![]},{'name':'Agents'},{'name':_0x0a1d('0x36')}];}break;case _0x0a1d('0x5c'):_0x51f71d['childModel']=_0x0a1d('0x5d');break;case _0x0a1d('0x5e'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x5f');break;case'freshdeskaccounts':_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x60');break;case'sugarcrmaccounts':_0x51f71d[_0x0a1d('0x16')]='SugarcrmAccount';break;case _0x0a1d('0x61'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x62');break;case _0x0a1d('0x63'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x64');break;case _0x0a1d('0x65'):_0x51f71d[_0x0a1d('0x16')]='User';break;case _0x0a1d('0x66'):_0x51f71d['childModel']=_0x0a1d('0x67');break;case'dispositions':_0x51f71d[_0x0a1d('0x16')]='Disposition';break;case _0x0a1d('0x68'):_0x51f71d['childModel']='Dashboard';break;case _0x0a1d('0x69'):_0x51f71d[_0x0a1d('0x16')]='Interval';break;case'pauses':_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x6a');break;case _0x0a1d('0x6b'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x6c');break;case _0x0a1d('0x6d'):_0x51f71d['childModel']=_0x0a1d('0x6e');break;case _0x0a1d('0x6f'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x70');break;case _0x0a1d('0x71'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x72');break;case _0x0a1d('0x73'):_0x51f71d['childModel']=_0x0a1d('0x74');break;case _0x0a1d('0x75'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x76');break;case _0x0a1d('0x77'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x78');break;case _0x0a1d('0x79'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x7a');break;case _0x0a1d('0x7b'):_0x51f71d[_0x0a1d('0x16')]=_0x0a1d('0x11');_0x51f71d[_0x0a1d('0x1a')]=[{'name':_0x0a1d('0x7c'),'field':'id','foreignKey':_0x0a1d('0x7d')}];break;case'metrics':_0x51f71d[_0x0a1d('0x16')]='AnalyticMetric';break;}return _0x51f71d;}function _0x49c225(_0x5b7d26,_0x4c0831){var _0x4f75d0=_0x5b7d26[_0x0a1d('0x7e')](0x0)[_0x0a1d('0x7f')]()+_0x5b7d26[_0x0a1d('0x80')](0x1);var _0x2a93cf={'type':_0x5c5d4e[_0x0a1d('0x81')]['QueryTypes'][_0x0a1d('0x82')],'raw':!![]};return new Promise(function(_0x1fd7e8,_0x5a7d5d){var _0x39424e=squel[_0x0a1d('0x83')]()[_0x0a1d('0x7')](_0x0a1d('0x84')+_0x4f75d0+_0x0a1d('0x85'),'id')[_0x0a1d('0x7')]('ui.createdAt')[_0x0a1d('0x86')](_0x0a1d('0x87')+_0x5b7d26+'_interactions','ui')[_0x0a1d('0x88')]('ui.UserId\x20=\x20?',_0x4c0831['id']);return _0x5c5d4e[_0x0a1d('0x89')][_0x0a1d('0x8a')](_0x39424e[_0x0a1d('0x8b')](),_0x2a93cf)[_0x0a1d('0xa')](function(_0x3b21a1){_0x4c0831[_0x4f75d0+_0x0a1d('0x8c')]=_0x3b21a1;_0x1fd7e8(_0x3b21a1);})[_0x0a1d('0xe')](function(_0x582721){_0x5a7d5d(_0x582721);});});}return _0x5bb6a7[_0x0a1d('0x8d')](_0x0a1d('0x8e'),attributes,{'tableName':_0x0a1d('0x8f'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x521655){var _0x13af7c=require(_0x0a1d('0x90'));var _0xaf68d6={'raw':_0x521655[_0x0a1d('0x8a')]['raw'],'where':{}};var _0x38bb64={};var _0x499389={'count':0x0,'rows':[]};var _0x4ec74e=_0x521655[_0x0a1d('0x8a')][_0x0a1d('0x91')];var _0x58174f=_0x521655['query'][_0x0a1d('0x92')]||![];var _0xa3e654=_0x4c3157(_0x4ec74e,_0x58174f);if(!_0xa3e654['childModel'])throw new Error(_0x0a1d('0x93')+_0x4ec74e+'\x27');var _0x224461=[{'name':_0x4ec74e}];if(!_[_0x0a1d('0x94')](_0xa3e654[_0x0a1d('0x1a')]))_0x224461=_0xa3e654[_0x0a1d('0x1a')];var _0x11ba0=[];for(var _0x11bd7c=0x0;_0x11bd7c<_0x224461[_0x0a1d('0x95')];_0x11bd7c++){_0x11ba0[_0x0a1d('0x96')](_0x5c5d4e[_0x0a1d('0x97')][_0x0a1d('0x98')]({'where':{'userProfileId':_0x521655['params']['id'],'name':_0x224461[_0x11bd7c][_0x0a1d('0xd')]},'raw':!![]}));}return Promise[_0x0a1d('0x99')](_0x11ba0)[_0x0a1d('0xa')](function(_0x165b0a){var _0x1d375e=_[_0x0a1d('0x5')](_0x165b0a,function(_0x43efe2){return _0x43efe2?_0x43efe2:undefined;});var _0x80dc6d=_[_0x0a1d('0x5')](_0x224461,[_0x0a1d('0x9a'),!![]]);var _0xc5b7fb=_[_0x0a1d('0x94')](_0x1d375e)&&_[_0x0a1d('0x94')](_0x80dc6d)?null:_[_0x0a1d('0x9b')](_0x80dc6d,_0x1d375e);if(!_0xc5b7fb)return null;var _0x14d3d9=[];for(var _0xefb33f=0x0;_0xefb33f<_0xc5b7fb['length'];_0xefb33f++){var _0x6115f2=_[_0x0a1d('0x98')](_0x224461,function(_0x22268b){return _0xc5b7fb[_0xefb33f]?_0x22268b['name']===_0xc5b7fb[_0xefb33f]['name']:null;});if(_0x6115f2){if(_0xc5b7fb[_0xefb33f][_0x0a1d('0x9a')]){_0x14d3d9['push'](_0x134285(_0xa3e654[_0x0a1d('0x16')],_0xc5b7fb[_0xefb33f]));}else{if(!_0xc5b7fb[_0xefb33f]['autoAssociation']){_0x14d3d9['push'](_0x4473d1(_0x6115f2,_0xc5b7fb[_0xefb33f],_0xa3e654['childModel']));}else{if(_0x6115f2[_0x0a1d('0x9')]){_0x14d3d9[_0x0a1d('0x96')](_0xc780d6(_0x6115f2,_0xc5b7fb[_0xefb33f]));}}}}}return Promise[_0x0a1d('0x99')](_0x14d3d9);})[_0x0a1d('0xa')](function(_0x51bb03){var _0x20b405=_0x51bb03;var _0x9febf9=null;if(_0x20b405){_0x9febf9=_0x20b405[_0x0a1d('0x95')]===0x1?_0x20b405[0x0]:null;}if(!_0x9febf9&&!_0x20b405)return _0x499389;var _0x33df13=_0x5c5d4e[_0xa3e654[_0x0a1d('0x16')]]['rawAttributes'];_0x38bb64[_0x0a1d('0x9')]=_[_0x0a1d('0x9c')](_0x33df13);_0x38bb64['query']=_[_0x0a1d('0x9c')](_0x521655[_0x0a1d('0x8a')]);_0x38bb64[_0x0a1d('0x9d')]=_[_0x0a1d('0x9e')](_0x38bb64['model'],_0x38bb64[_0x0a1d('0x8a')]);_0xaf68d6[_0x0a1d('0x9f')]=_[_0x0a1d('0x9e')](_0x38bb64[_0x0a1d('0x9')],_0x13af7c['fields'](_0x521655[_0x0a1d('0x8a')]['fields']));_0xaf68d6[_0x0a1d('0x9f')]=_0xaf68d6[_0x0a1d('0x9f')][_0x0a1d('0x95')]?_0xaf68d6[_0x0a1d('0x9f')]:_0x38bb64[_0x0a1d('0x9')];if(!_0x521655[_0x0a1d('0x8a')][_0x0a1d('0xa0')](_0x0a1d('0xa1'))){_0xaf68d6[_0x0a1d('0xa2')]=_0x13af7c[_0x0a1d('0xa2')](_0x521655['query']['limit']);_0xaf68d6[_0x0a1d('0xa3')]=_0x13af7c[_0x0a1d('0xa3')](_0x521655[_0x0a1d('0x8a')][_0x0a1d('0xa3')]);}_0xaf68d6[_0x0a1d('0xa4')]=_0x13af7c[_0x0a1d('0xa5')](_0x521655['query'][_0x0a1d('0xa5')]);_0xaf68d6[_0x0a1d('0x88')]=_0x13af7c[_0x0a1d('0x9d')](_[_0x0a1d('0xa6')](_0x521655['query'],_0x38bb64[_0x0a1d('0x9d')]));if(_0x521655[_0x0a1d('0x8a')][_0x0a1d('0x5')]){_0xaf68d6[_0x0a1d('0x88')]=_['merge'](_0xaf68d6['where'],{'$or':_['map'](_0x33df13,function(_0x28f1ce){if(_0x28f1ce[_0x0a1d('0x13')][_0x0a1d('0xa7')]!==_0x0a1d('0xa8')){var _0x593212={};_0x593212[_0x28f1ce[_0x0a1d('0x7')]]={'$like':'%'+_0x521655[_0x0a1d('0x8a')]['filter']+'%'};return _0x593212;}})});}var _0x3bed2b=[];var _0x52fa05=null;var _0x865be4={};if(_0x9febf9){_0x52fa05=_['find'](_0x224461,[_0x0a1d('0xd'),_0x9febf9[_0x0a1d('0xd')]]);if(_0x52fa05[_0x0a1d('0x7')]){_0x865be4={};if(_0xa3e654[_0x0a1d('0x16')]===_0x0a1d('0x11')){_0x865be4[_0x52fa05[_0x0a1d('0xa9')]]=_[_0x0a1d('0xc')](_0x9febf9['associatedResources'],'id');}else{_0x865be4[_0x52fa05[_0x0a1d('0xa9')]]=_0x9febf9['associatedResources'];}_0x3bed2b[_0x0a1d('0x96')](_0x865be4);}else{_0xaf68d6[_0x0a1d('0x88')]['id']=_0x9febf9[_0x0a1d('0xb')];}}else{for(var _0x1c2281=0x0;_0x1c2281<_0x20b405['length'];_0x1c2281++){_0x52fa05=_['find'](_0x224461,[_0x0a1d('0xd'),_0x20b405[_0x1c2281][_0x0a1d('0xd')]]);if(_0x52fa05[_0x0a1d('0x7')]){_0x865be4={};_0x865be4[_0x52fa05[_0x0a1d('0xa9')]]=_0x20b405[_0x1c2281][_0x0a1d('0xb')];_0x3bed2b[_0x0a1d('0x96')](_0x865be4);}else{if(!_0xaf68d6[_0x0a1d('0x88')]['id'])_0xaf68d6[_0x0a1d('0x88')]['id']=[];_0x20b405[_0x1c2281][_0x0a1d('0xb')][_0x0a1d('0xaa')](function(_0x3c875d){_0xaf68d6[_0x0a1d('0x88')]['id'][_0x0a1d('0x96')](_0x3c875d);});}}}if(!_['isEmpty'](_0x3bed2b)){_0xaf68d6[_0x0a1d('0x88')]=_['merge'](_0xaf68d6[_0x0a1d('0x88')],{'$and':{'$or':_0x3bed2b}});}_0xaf68d6=_[_0x0a1d('0xab')]({},_0xaf68d6,_0x521655[_0x0a1d('0xac')]);if(_0x9febf9&&!_0x9febf9['autoAssociation']&&_0xa3e654['childModel']===_0x0a1d('0x11')){if(_0x521655['query'][_0x0a1d('0xad')]){_0xaf68d6[_0x0a1d('0xae')]=[{'all':!![]}];}return _0x5c5d4e[_0xa3e654[_0x0a1d('0x16')]][_0x0a1d('0x6')](_0xaf68d6)['then'](function(_0x24d9b4){var _0x5cd8a6=[];_0x24d9b4[_0x0a1d('0xaa')](function(_0xad97){var _0x367092;switch(_0xad97['reportType']){case _0x0a1d('0xaf'):_0x367092=_['find'](_0x9febf9[_0x0a1d('0xb')],function(_0x12b39b){return _0x12b39b['id']===_0xad97[_0x0a1d('0x7d')]&&_0x12b39b[_0x0a1d('0x13')]===_0x0a1d('0xb0');});break;case _0x0a1d('0xb1'):_0x367092=_[_0x0a1d('0x98')](_0x9febf9[_0x0a1d('0xb')],function(_0x58974a){return _0x58974a['id']===_0xad97[_0x0a1d('0x7d')]&&_0x58974a[_0x0a1d('0x13')]===_0x0a1d('0xb2');});break;}if(_0x367092)_0x5cd8a6[_0x0a1d('0x96')](_0xad97);});_0x499389[_0x0a1d('0xb3')]=_0x5cd8a6[_0x0a1d('0x95')];_0x499389[_0x0a1d('0xb4')]=_0x5cd8a6;return _0x499389;});}else{if(!_[_0x0a1d('0x94')](_0x521655[_0x0a1d('0x8a')]['ids'])){_0xaf68d6['where']['id']=_0xaf68d6[_0x0a1d('0x88')]['id']?_[_0x0a1d('0x9e')](_0xaf68d6['where']['id'],_0x521655[_0x0a1d('0x8a')][_0x0a1d('0xb5')]):_0x521655[_0x0a1d('0x8a')][_0x0a1d('0xb5')];if(_0x521655['query'][_0x0a1d('0xb6')]){_0xaf68d6[_0x0a1d('0xa4')]=_0x521655[_0x0a1d('0x8a')][_0x0a1d('0xb6')];}}if(_0x521655[_0x0a1d('0x8a')]['extraQueryConditions']){_0xaf68d6[_0x0a1d('0x88')]=_[_0x0a1d('0xab')](_0xaf68d6[_0x0a1d('0x88')],{'$and':_0x521655[_0x0a1d('0x8a')][_0x0a1d('0xb7')]});}return _0x5c5d4e[_0xa3e654['childModel']][_0x0a1d('0xb3')]({'where':_0xaf68d6[_0x0a1d('0x88')]})['then'](function(_0x10cb51){_0x499389[_0x0a1d('0xb3')]=_0x10cb51;if(_0x521655['query']['includeAll']){if(_0xa3e654[_0x0a1d('0x16')]===_0x0a1d('0xb8')){_0xaf68d6['include']=[{'model':_0x5c5d4e['Tag'],'as':_0x0a1d('0xb9'),'attributes':['id','name','color'],'required':_0x521655['query']['tag']?!![]:![]},{'model':_0x5c5d4e[_0x0a1d('0x70')],'as':_0x0a1d('0xba'),'attributes':['id',_0x0a1d('0xd'),_0x0a1d('0xbb')],'through':_0x521655[_0x0a1d('0x8a')][_0x0a1d('0xbc')]?{'attributes':[],'where':{'TagId':_0x521655[_0x0a1d('0x8a')]['tag']||undefined}}:{},'required':_0x521655['query']['tag']?!![]:![]}];}else{_0xaf68d6[_0x0a1d('0xae')]=[{'all':!![]}];}}return _0x5c5d4e[_0xa3e654[_0x0a1d('0x16')]][_0x0a1d('0x6')](_0xaf68d6);})[_0x0a1d('0xa')](function(_0x405add){_0x499389[_0x0a1d('0xb4')]=_0x405add;if(_0x4ec74e===_0x0a1d('0x34')&&_0x521655[_0x0a1d('0x8a')][_0x0a1d('0xbd')]===_0x0a1d('0xbe')){var _0x1748ba=[];for(var _0x503ebf=0x0;_0x503ebf<_0x499389['rows'][_0x0a1d('0x95')];_0x503ebf++){_0x1748ba[_0x0a1d('0x96')](_0x49c225('chat',_0x499389[_0x0a1d('0xb4')][_0x503ebf][_0x0a1d('0xbf')]));_0x1748ba[_0x0a1d('0x96')](_0x49c225(_0x0a1d('0xc0'),_0x499389[_0x0a1d('0xb4')][_0x503ebf][_0x0a1d('0xbf')]));_0x1748ba[_0x0a1d('0x96')](_0x49c225(_0x0a1d('0xc1'),_0x499389[_0x0a1d('0xb4')][_0x503ebf]['dataValues']));_0x1748ba[_0x0a1d('0x96')](_0x49c225(_0x0a1d('0xc2'),_0x499389[_0x0a1d('0xb4')][_0x503ebf][_0x0a1d('0xbf')]));_0x1748ba[_0x0a1d('0x96')](_0x49c225(_0x0a1d('0xc3'),_0x499389[_0x0a1d('0xb4')][_0x503ebf]['dataValues']));_0x1748ba[_0x0a1d('0x96')](_0x49c225(_0x0a1d('0xc4'),_0x499389[_0x0a1d('0xb4')][_0x503ebf][_0x0a1d('0xbf')]));}return Promise[_0x0a1d('0x99')](_0x1748ba)[_0x0a1d('0xa')](function(){return _0x499389;});}return _0x499389;});}});}}});}; \ No newline at end of file +var _0xe7ee=['Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','triggers','Trigger','trunks','Trunk','Variable','plugins','Reports','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','from','user_has_','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','find','params','all','ignore','union','length','push','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','nolimit','limit','offset','sort','where','merge','key','VIRTUAL','foreignKey','options','include','forEach','default','reportId','DefaultReports','custom','CustomReports','rows','ids','customSorting','order','extraQueryConditions','count','includeAll','Tags','color','ThroughTags','tag','openTabs','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','models','filter','field','findAll','associatedResources','map','value','model','then','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','ListId','CmList','companies','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappAccount','teams','voicequeues','users','agents','telephones'];(function(_0x4fcfbe,_0x107dc6){var _0x50b203=function(_0x3a9083){while(--_0x3a9083){_0x4fcfbe['push'](_0x4fcfbe['shift']());}};_0x50b203(++_0x107dc6);}(_0xe7ee,0x12b));var _0xee7e=function(_0x3ae835,_0x3c9b77){_0x3ae835=_0x3ae835-0x0;var _0x256850=_0xe7ee[_0x3ae835];return _0x256850;};'use strict';var _=require(_0xee7e('0x0'));var attributes=require(_0xee7e('0x1'));var squel=require('squel');module['exports']=function(_0x178a0f){var _0x155219=_0x178a0f[_0xee7e('0x2')];function _0x2c2622(_0xcf532b,_0x1d111e){return new Promise(function(_0x44ce4b,_0xdd1554){if(!_0x1d111e)return _0x44ce4b(null);var _0x544afc=_0x1d111e[_0xee7e('0x3')]?{[_0x1d111e[_0xee7e('0x3')][_0xee7e('0x4')]]:_0x1d111e[_0xee7e('0x3')]['value']}:undefined;return _0x155219[_0xcf532b][_0xee7e('0x5')]({'where':_0x544afc,'raw':!![]})['then'](function(_0x582ee7){_0x1d111e[_0xee7e('0x6')]=_[_0xee7e('0x7')](_0x582ee7,'id');_0x44ce4b(_0x1d111e);})['catch'](function(_0x2608c4){_0xdd1554(_0x2608c4);});});}function _0x243b57(_0x169987,_0x51c0db){return new Promise(function(_0x337d69,_0x896bf6){var _0x3afeaa=_0x169987[_0xee7e('0x3')]?{[_0x169987[_0xee7e('0x3')]['field']]:_0x169987[_0xee7e('0x3')][_0xee7e('0x8')]}:undefined;return _0x155219[_0x169987[_0xee7e('0x9')]][_0xee7e('0x5')]({'where':_0x3afeaa,'raw':!![]})[_0xee7e('0xa')](function(_0x24a8f4){_0x51c0db[_0xee7e('0x6')]=_[_0xee7e('0x7')](_0x24a8f4,function(_0x39823c){return _0x39823c[_0xee7e('0xb')];});_0x337d69(_0x51c0db);})[_0xee7e('0xc')](function(_0x191511){_0x896bf6(_0x191511);});});}function _0x23928(_0x406192,_0x49eacb,_0x468142){if(!_0x49eacb)return Promise[_0xee7e('0xd')](null);return new Promise(function(_0xa11e12,_0x384db1){return _0x155219[_0xee7e('0xe')]['findAll']({'where':{'sectionId':_0x49eacb['id']},'raw':!![]})[_0xee7e('0xa')](function(_0x109fa5){if(_0x406192[_0xee7e('0x4')]&&_0x406192[_0xee7e('0x4')]!=='id'){_0x49eacb[_0xee7e('0x6')]=_[_0xee7e('0x7')](_0x109fa5,function(_0x106fcf){return _0x106fcf[_0x406192[_0xee7e('0x4')]];});}else{if(_0x468142===_0xee7e('0xf')){_0x49eacb[_0xee7e('0x6')]=_[_0xee7e('0x7')](_0x109fa5,function(_0x1d1ce3){return{'id':_0x1d1ce3['resourceId'],'type':_0x1d1ce3[_0xee7e('0x10')]};});}else{_0x49eacb['associatedResources']=_['map'](_0x109fa5,function(_0x237d9a){return _0x237d9a[_0xee7e('0x11')];});}}_0xa11e12(_0x49eacb);})[_0xee7e('0xc')](function(_0x13eb33){_0x384db1(_0x13eb33);});});}function _0xb522c7(_0x429010,_0x53b263){var _0xac5776={'parentSections':[]};switch(_0x429010['toLowerCase']()){case _0xee7e('0x12'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x14');break;case _0xee7e('0x15'):_0xac5776[_0xee7e('0x13')]='SquareOdbc';break;case _0xee7e('0x16'):_0xac5776['childModel']=_0xee7e('0x17');_0xac5776[_0xee7e('0x18')]=[{'name':_0xee7e('0x19'),'field':_0xee7e('0xb'),'foreignKey':_0xee7e('0x1a')}];break;case'projects':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x1b');break;case _0xee7e('0x1c'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x1d');_0xac5776[_0xee7e('0x18')]=[{'name':'Lists','field':'id','foreignKey':_0xee7e('0x1e')}];break;case'lists':_0xac5776['childModel']=_0xee7e('0x1f');break;case _0xee7e('0x20'):_0xac5776[_0xee7e('0x13')]='CmCompany';break;case'globalcustomfields':_0xac5776['childModel']='CmCustomField';break;case _0xee7e('0x21'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x22');break;case'chatwebsites':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x23');break;case'faxqueues':_0xac5776['childModel']=_0xee7e('0x24');break;case _0xee7e('0x25'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x26');break;case'inboundroutes':case'internalroutes':case _0xee7e('0x27'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x28');break;case _0xee7e('0x29'):_0xac5776['childModel']=_0xee7e('0x2a');break;case _0xee7e('0x2b'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x2c');break;case _0xee7e('0x2d'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x2e');_0xac5776['parentSections']=[{'name':_0xee7e('0x2f'),'field':_0xee7e('0xb'),'foreignKey':'membername','model':_0xee7e('0x30'),'filter':{'field':_0xee7e('0x31'),'value':[_0xee7e('0x32')]}},{'name':_0xee7e('0x33'),'field':'name','foreignKey':'membername','model':_0xee7e('0x30'),'filter':{'field':_0xee7e('0x31'),'value':[_0xee7e('0x34')]}},{'name':_0xee7e('0x35'),'field':_0xee7e('0xb'),'foreignKey':'queue','model':_0xee7e('0x36'),'filter':{'field':_0xee7e('0x10'),'value':[_0xee7e('0x37')]}},{'name':_0xee7e('0x38'),'field':_0xee7e('0xb'),'foreignKey':_0xee7e('0x39'),'model':_0xee7e('0x36'),'filter':{'field':'type','value':[_0xee7e('0x3a')]}}];break;case'musiconholds':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x3b');break;case _0xee7e('0x3c'):_0xac5776['childModel']=_0xee7e('0x3d');break;case _0xee7e('0x3e'):_0xac5776['childModel']=_0xee7e('0x3f');break;case'ivrcampaigns':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x40');break;case _0xee7e('0x41'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x42');break;case _0xee7e('0x43'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x44');break;case'mailsubstatuses':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x45');break;case _0xee7e('0x46'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x47');break;case _0xee7e('0x48'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x49');break;case _0xee7e('0x4a'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x4b');break;case _0xee7e('0x4c'):_0xac5776['childModel']=_0xee7e('0x4d');break;case _0xee7e('0x4e'):_0xac5776[_0xee7e('0x13')]='WhatsappQueue';break;case'whatsappaccounts':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x4f');break;case _0xee7e('0x50'):_0xac5776['childModel']='Team';break;case _0xee7e('0x51'):case'queuecampaigns':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x36');if(_0x53b263){_0xac5776['parentSections']=[{'name':_0xee7e('0x35')},{'name':_0xee7e('0x38')}];}break;case _0xee7e('0x52'):case _0xee7e('0x53'):case _0xee7e('0x54'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x30');if(_0x53b263){_0xac5776['parentSections']=[{'name':_0xee7e('0x55'),'filter':{'field':_0xee7e('0x31'),'value':[_0xee7e('0x56'),_0xee7e('0x57')]},'ignore':!![]},{'name':_0xee7e('0x2f')},{'name':_0xee7e('0x33')}];}break;case _0xee7e('0x58'):_0xac5776['childModel']=_0xee7e('0x59');break;case _0xee7e('0x5a'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x5b');break;case _0xee7e('0x5c'):_0xac5776['childModel']=_0xee7e('0x5d');break;case _0xee7e('0x5e'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x5f');break;case'deskaccounts':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x60');break;case _0xee7e('0x61'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x62');break;case _0xee7e('0x63'):_0xac5776['childModel']=_0xee7e('0x30');break;case _0xee7e('0x64'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x65');break;case _0xee7e('0x66'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x67');break;case _0xee7e('0x68'):_0xac5776[_0xee7e('0x13')]='Dashboard';break;case _0xee7e('0x69'):_0xac5776['childModel']=_0xee7e('0x6a');break;case _0xee7e('0x6b'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x6c');break;case _0xee7e('0x6d'):_0xac5776['childModel']=_0xee7e('0x6e');break;case'sounds':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x6f');break;case _0xee7e('0x70'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x71');break;case'templates':_0xac5776[_0xee7e('0x13')]='Template';break;case _0xee7e('0x72'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x73');break;case _0xee7e('0x74'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x75');break;case'variables':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x76');break;case _0xee7e('0x77'):_0xac5776['childModel']='Plugin';break;case'extractedreports':_0xac5776['childModel']=_0xee7e('0xf');_0xac5776['parentSections']=[{'name':_0xee7e('0x78'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x79');break;}return _0xac5776;}function _0x23a83f(_0x2e67c5,_0x42c045){var _0x4fd259=_0x2e67c5[_0xee7e('0x7a')](0x0)[_0xee7e('0x7b')]()+_0x2e67c5[_0xee7e('0x7c')](0x1);var _0x288ab2={'type':_0x155219[_0xee7e('0x7d')]['QueryTypes'][_0xee7e('0x7e')],'raw':!![]};return new Promise(function(_0x16e9ea,_0x5e023d){var _0x59a1b8=squel[_0xee7e('0x7f')]()[_0xee7e('0x4')](_0xee7e('0x80')+_0x4fd259+'InteractionId','id')[_0xee7e('0x4')]('ui.createdAt')[_0xee7e('0x81')](_0xee7e('0x82')+_0x2e67c5+'_interactions','ui')['where']('ui.UserId\x20=\x20?',_0x42c045['id']);return _0x155219[_0xee7e('0x83')]['query'](_0x59a1b8[_0xee7e('0x84')](),_0x288ab2)[_0xee7e('0xa')](function(_0x39e032){_0x42c045[_0x4fd259+_0xee7e('0x85')]=_0x39e032;_0x16e9ea(_0x39e032);})[_0xee7e('0xc')](function(_0x11fed9){_0x5e023d(_0x11fed9);});});}return _0x178a0f[_0xee7e('0x86')](_0xee7e('0x87'),attributes,{'tableName':_0xee7e('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1c3e01){var _0x592910=require(_0xee7e('0x89'));var _0x5dba06={'raw':_0x1c3e01['query']['raw'],'where':{}};var _0x1e6b98={};var _0x39b59f={'count':0x0,'rows':[]};var _0x5f3edf=_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0x8b')];var _0x2dc719=_0x1c3e01['query'][_0xee7e('0x8c')]||![];var _0x3470f4=_0xb522c7(_0x5f3edf,_0x2dc719);if(!_0x3470f4['childModel'])throw new Error(_0xee7e('0x8d')+_0x5f3edf+'\x27');var _0x4bc8e1=[{'name':_0x5f3edf}];if(!_[_0xee7e('0x8e')](_0x3470f4[_0xee7e('0x18')]))_0x4bc8e1=_0x3470f4['parentSections'];var _0x2998b4=[];for(var _0x3ee20b=0x0;_0x3ee20b<_0x4bc8e1['length'];_0x3ee20b++){_0x2998b4['push'](_0x155219['UserProfileSection'][_0xee7e('0x8f')]({'where':{'userProfileId':_0x1c3e01[_0xee7e('0x90')]['id'],'name':_0x4bc8e1[_0x3ee20b][_0xee7e('0xb')]},'raw':!![]}));}return Promise[_0xee7e('0x91')](_0x2998b4)[_0xee7e('0xa')](function(_0x10205e){var _0x88788e=_[_0xee7e('0x3')](_0x10205e,function(_0x475adb){return _0x475adb?_0x475adb:undefined;});var _0x53d62d=_[_0xee7e('0x3')](_0x4bc8e1,[_0xee7e('0x92'),!![]]);var _0x353bec=_[_0xee7e('0x8e')](_0x88788e)&&_['isEmpty'](_0x53d62d)?null:_[_0xee7e('0x93')](_0x53d62d,_0x88788e);if(!_0x353bec)return null;var _0x34d33a=[];for(var _0x5a1881=0x0;_0x5a1881<_0x353bec[_0xee7e('0x94')];_0x5a1881++){var _0x1e4cfc=_['find'](_0x4bc8e1,function(_0x4bc0cd){return _0x353bec[_0x5a1881]?_0x4bc0cd[_0xee7e('0xb')]===_0x353bec[_0x5a1881]['name']:null;});if(_0x1e4cfc){if(_0x353bec[_0x5a1881]['ignore']){_0x34d33a[_0xee7e('0x95')](_0x2c2622(_0x3470f4['childModel'],_0x353bec[_0x5a1881]));}else{if(!_0x353bec[_0x5a1881][_0xee7e('0x96')]){_0x34d33a[_0xee7e('0x95')](_0x23928(_0x1e4cfc,_0x353bec[_0x5a1881],_0x3470f4['childModel']));}else{if(_0x1e4cfc['model']){_0x34d33a[_0xee7e('0x95')](_0x243b57(_0x1e4cfc,_0x353bec[_0x5a1881]));}}}}}return Promise[_0xee7e('0x91')](_0x34d33a);})[_0xee7e('0xa')](function(_0x4cd64b){var _0x24f592=_0x4cd64b;var _0x31207e=null;if(_0x24f592){_0x31207e=_0x24f592[_0xee7e('0x94')]===0x1?_0x24f592[0x0]:null;}if(!_0x31207e&&!_0x24f592)return _0x39b59f;var _0x550306=_0x155219[_0x3470f4[_0xee7e('0x13')]][_0xee7e('0x97')];_0x1e6b98[_0xee7e('0x9')]=_[_0xee7e('0x98')](_0x550306);_0x1e6b98[_0xee7e('0x8a')]=_['keys'](_0x1c3e01['query']);_0x1e6b98[_0xee7e('0x99')]=_['intersection'](_0x1e6b98['model'],_0x1e6b98[_0xee7e('0x8a')]);_0x5dba06['attributes']=_[_0xee7e('0x9a')](_0x1e6b98[_0xee7e('0x9')],_0x592910[_0xee7e('0x9b')](_0x1c3e01[_0xee7e('0x8a')]['fields']));_0x5dba06['attributes']=_0x5dba06[_0xee7e('0x9c')]['length']?_0x5dba06[_0xee7e('0x9c')]:_0x1e6b98['model'];if(!_0x1c3e01[_0xee7e('0x8a')]['hasOwnProperty'](_0xee7e('0x9d'))){_0x5dba06[_0xee7e('0x9e')]=_0x592910[_0xee7e('0x9e')](_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0x9e')]);_0x5dba06[_0xee7e('0x9f')]=_0x592910[_0xee7e('0x9f')](_0x1c3e01['query'][_0xee7e('0x9f')]);}_0x5dba06['order']=_0x592910[_0xee7e('0xa0')](_0x1c3e01['query']['sort']);_0x5dba06[_0xee7e('0xa1')]=_0x592910[_0xee7e('0x99')](_['pick'](_0x1c3e01[_0xee7e('0x8a')],_0x1e6b98[_0xee7e('0x99')]));if(_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0x3')]){_0x5dba06[_0xee7e('0xa1')]=_[_0xee7e('0xa2')](_0x5dba06[_0xee7e('0xa1')],{'$or':_[_0xee7e('0x7')](_0x550306,function(_0x469507){if(_0x469507[_0xee7e('0x10')][_0xee7e('0xa3')]!==_0xee7e('0xa4')){var _0xbc89c7={};_0xbc89c7[_0x469507[_0xee7e('0x4')]]={'$like':'%'+_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0x3')]+'%'};return _0xbc89c7;}})});}var _0x28e221=[];var _0x42d4d5=null;var _0x212f45={};if(_0x31207e){_0x42d4d5=_['find'](_0x4bc8e1,['name',_0x31207e[_0xee7e('0xb')]]);if(_0x42d4d5[_0xee7e('0x4')]){_0x212f45={};if(_0x3470f4[_0xee7e('0x13')]==='AnalyticExtractedReport'){_0x212f45[_0x42d4d5[_0xee7e('0xa5')]]=_[_0xee7e('0x7')](_0x31207e[_0xee7e('0x6')],'id');}else{_0x212f45[_0x42d4d5['foreignKey']]=_0x31207e[_0xee7e('0x6')];}_0x28e221[_0xee7e('0x95')](_0x212f45);}else{_0x5dba06[_0xee7e('0xa1')]['id']=_0x31207e[_0xee7e('0x6')];}}else{for(var _0x134e74=0x0;_0x134e74<_0x24f592[_0xee7e('0x94')];_0x134e74++){_0x42d4d5=_[_0xee7e('0x8f')](_0x4bc8e1,[_0xee7e('0xb'),_0x24f592[_0x134e74]['name']]);if(_0x42d4d5[_0xee7e('0x4')]){_0x212f45={};_0x212f45[_0x42d4d5[_0xee7e('0xa5')]]=_0x24f592[_0x134e74][_0xee7e('0x6')];_0x28e221[_0xee7e('0x95')](_0x212f45);}else{if(!_0x5dba06[_0xee7e('0xa1')]['id'])_0x5dba06[_0xee7e('0xa1')]['id']=[];_0x24f592[_0x134e74][_0xee7e('0x6')]['forEach'](function(_0x41ed2f){_0x5dba06[_0xee7e('0xa1')]['id'][_0xee7e('0x95')](_0x41ed2f);});}}}if(!_['isEmpty'](_0x28e221)){_0x5dba06[_0xee7e('0xa1')]=_[_0xee7e('0xa2')](_0x5dba06[_0xee7e('0xa1')],{'$and':{'$or':_0x28e221}});}_0x5dba06=_[_0xee7e('0xa2')]({},_0x5dba06,_0x1c3e01[_0xee7e('0xa6')]);if(_0x31207e&&!_0x31207e[_0xee7e('0x96')]&&_0x3470f4[_0xee7e('0x13')]===_0xee7e('0xf')){if(_0x1c3e01[_0xee7e('0x8a')]['includeAll']){_0x5dba06[_0xee7e('0xa7')]=[{'all':!![]}];}return _0x155219[_0x3470f4[_0xee7e('0x13')]]['findAll'](_0x5dba06)[_0xee7e('0xa')](function(_0x2b46f1){var _0x477753=[];_0x2b46f1[_0xee7e('0xa8')](function(_0x24a85f){var _0x41ce76;switch(_0x24a85f['reportType']){case _0xee7e('0xa9'):_0x41ce76=_['find'](_0x31207e['associatedResources'],function(_0x47db62){return _0x47db62['id']===_0x24a85f[_0xee7e('0xaa')]&&_0x47db62[_0xee7e('0x10')]===_0xee7e('0xab');});break;case _0xee7e('0xac'):_0x41ce76=_[_0xee7e('0x8f')](_0x31207e[_0xee7e('0x6')],function(_0x3c1b24){return _0x3c1b24['id']===_0x24a85f[_0xee7e('0xaa')]&&_0x3c1b24[_0xee7e('0x10')]===_0xee7e('0xad');});break;}if(_0x41ce76)_0x477753['push'](_0x24a85f);});_0x39b59f['count']=_0x477753['length'];_0x39b59f[_0xee7e('0xae')]=_0x477753;return _0x39b59f;});}else{if(!_[_0xee7e('0x8e')](_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xaf')])){_0x5dba06[_0xee7e('0xa1')]['id']=_0x5dba06[_0xee7e('0xa1')]['id']?_['intersection'](_0x5dba06[_0xee7e('0xa1')]['id'],_0x1c3e01['query'][_0xee7e('0xaf')]):_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xaf')];if(_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb0')]){_0x5dba06[_0xee7e('0xb1')]=_0x1c3e01['query']['customSorting'];}}if(_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb2')]){_0x5dba06['where']=_[_0xee7e('0xa2')](_0x5dba06[_0xee7e('0xa1')],{'$and':_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb2')]});}return _0x155219[_0x3470f4[_0xee7e('0x13')]][_0xee7e('0xb3')]({'where':_0x5dba06[_0xee7e('0xa1')]})[_0xee7e('0xa')](function(_0x3f4b38){_0x39b59f['count']=_0x3f4b38;if(_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb4')]){if(_0x3470f4[_0xee7e('0x13')]===_0xee7e('0x1d')){_0x5dba06[_0xee7e('0xa7')]=[{'model':_0x155219[_0xee7e('0x71')],'as':_0xee7e('0xb5'),'attributes':['id',_0xee7e('0xb'),_0xee7e('0xb6')],'required':_0x1c3e01['query']['tag']?!![]:![]},{'model':_0x155219[_0xee7e('0x71')],'as':_0xee7e('0xb7'),'attributes':['id',_0xee7e('0xb'),'color'],'through':_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb8')]?{'attributes':[],'where':{'TagId':_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb8')]||undefined}}:{},'required':_0x1c3e01[_0xee7e('0x8a')]['tag']?!![]:![]}];}else{_0x5dba06[_0xee7e('0xa7')]=[{'all':!![]}];}}return _0x155219[_0x3470f4[_0xee7e('0x13')]]['findAll'](_0x5dba06);})['then'](function(_0x22d349){_0x39b59f['rows']=_0x22d349;if(_0x5f3edf===_0xee7e('0x2f')&&_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb9')]==='true'){var _0x3e58bd=[];for(var _0x1bda08=0x0;_0x1bda08<_0x39b59f[_0xee7e('0xae')][_0xee7e('0x94')];_0x1bda08++){_0x3e58bd[_0xee7e('0x95')](_0x23a83f(_0xee7e('0xba'),_0x39b59f[_0xee7e('0xae')][_0x1bda08][_0xee7e('0xbb')]));_0x3e58bd[_0xee7e('0x95')](_0x23a83f(_0xee7e('0xbc'),_0x39b59f[_0xee7e('0xae')][_0x1bda08]['dataValues']));_0x3e58bd[_0xee7e('0x95')](_0x23a83f(_0xee7e('0xbd'),_0x39b59f['rows'][_0x1bda08][_0xee7e('0xbb')]));_0x3e58bd[_0xee7e('0x95')](_0x23a83f(_0xee7e('0xbe'),_0x39b59f[_0xee7e('0xae')][_0x1bda08][_0xee7e('0xbb')]));_0x3e58bd[_0xee7e('0x95')](_0x23a83f('openchannel',_0x39b59f[_0xee7e('0xae')][_0x1bda08][_0xee7e('0xbb')]));_0x3e58bd['push'](_0x23a83f(_0xee7e('0xbf'),_0x39b59f[_0xee7e('0xae')][_0x1bda08][_0xee7e('0xbb')]));}return Promise[_0xee7e('0x91')](_0x3e58bd)[_0xee7e('0xa')](function(){return _0x39b59f;});}return _0x39b59f;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 8f8e9c5..d5823c8 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 _0xe1d7=['client','http','defaults','redis','socket.io-emitter','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x513a86,_0x1e385e){var _0x3e39f2=function(_0x18b0ab){while(--_0x18b0ab){_0x513a86['push'](_0x513a86['shift']());}};_0x3e39f2(++_0x1e385e);}(_0xe1d7,0x1a9));var _0x7e1d=function(_0x280a2e,_0x244c6f){_0x280a2e=_0x280a2e-0x0;var _0x286f67=_0xe1d7[_0x280a2e];return _0x286f67;};'use strict';var _=require('lodash');var util=require(_0x7e1d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e1d('0x1'));var db=require(_0x7e1d('0x2'))['db'];var utils=require(_0x7e1d('0x3'));var logger=require('../../config/logger')(_0x7e1d('0x4'));var config=require(_0x7e1d('0x5'));var jayson=require(_0x7e1d('0x6'));var client=jayson[_0x7e1d('0x7')][_0x7e1d('0x8')]({'port':0x232a});config['redis']=_[_0x7e1d('0x9')](config[_0x7e1d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e1d('0xb'))(new Redis(config[_0x7e1d('0xa')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x39b933,_0x1e78ac,_0x15a029){return new BPromise(function(_0x36cf4d,_0x1e771a){return client[_0x7e1d('0xc')](_0x39b933,_0x15a029)[_0x7e1d('0xd')](function(_0x539502){logger[_0x7e1d('0xe')](_0x7e1d('0xf'),_0x1e78ac,_0x7e1d('0x10'));logger[_0x7e1d('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x1e78ac,_0x7e1d('0x10'),JSON[_0x7e1d('0x12')](_0x539502));if(_0x539502[_0x7e1d('0x13')]){if(_0x539502['error'][_0x7e1d('0x14')]===0x1f4){logger[_0x7e1d('0x13')]('UserProfile,\x20%s,\x20%s',_0x1e78ac,_0x539502['error'][_0x7e1d('0x15')]);return _0x1e771a(_0x539502[_0x7e1d('0x13')][_0x7e1d('0x15')]);}logger['error'](_0x7e1d('0xf'),_0x1e78ac,_0x539502[_0x7e1d('0x13')]['message']);return _0x36cf4d(_0x539502[_0x7e1d('0x13')][_0x7e1d('0x15')]);}else{logger[_0x7e1d('0xe')](_0x7e1d('0xf'),_0x1e78ac,'request\x20sent');_0x36cf4d(_0x539502[_0x7e1d('0x16')][_0x7e1d('0x15')]);}})[_0x7e1d('0x17')](function(_0x368320){logger[_0x7e1d('0x13')](_0x7e1d('0xf'),_0x1e78ac,_0x368320);_0x1e771a(_0x368320);});});} \ No newline at end of file +var _0xf0f4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../config/utils'];(function(_0x46cc04,_0x5a6bef){var _0x400c05=function(_0x885527){while(--_0x885527){_0x46cc04['push'](_0x46cc04['shift']());}};_0x400c05(++_0x5a6bef);}(_0xf0f4,0x182));var _0x4f0f=function(_0x197ddb,_0x5e757d){_0x197ddb=_0x197ddb-0x0;var _0x1c3171=_0xf0f4[_0x197ddb];return _0x1c3171;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f0f('0x1'));var fs=require('fs');var Redis=require(_0x4f0f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f0f('0x3'));var logger=require(_0x4f0f('0x4'))(_0x4f0f('0x5'));var config=require(_0x4f0f('0x6'));var jayson=require(_0x4f0f('0x7'));var client=jayson[_0x4f0f('0x8')][_0x4f0f('0x9')]({'port':0x232a});config['redis']=_[_0x4f0f('0xa')](config[_0x4f0f('0xb')],{'host':_0x4f0f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f0f('0xb')]));require(_0x4f0f('0xd'))[_0x4f0f('0xe')](socket);function respondWithRpcPromise(_0x3754fc,_0x343c30,_0xb41508){return new BPromise(function(_0x9533a3,_0x2b2e49){return client['request'](_0x3754fc,_0xb41508)[_0x4f0f('0xf')](function(_0x315d01){logger[_0x4f0f('0x10')](_0x4f0f('0x11'),_0x343c30,_0x4f0f('0x12'));logger[_0x4f0f('0x13')](_0x4f0f('0x14'),_0x343c30,_0x4f0f('0x12'),JSON[_0x4f0f('0x15')](_0x315d01));if(_0x315d01[_0x4f0f('0x16')]){if(_0x315d01[_0x4f0f('0x16')]['code']===0x1f4){logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x315d01[_0x4f0f('0x16')][_0x4f0f('0x17')]);return _0x2b2e49(_0x315d01['error'][_0x4f0f('0x17')]);}logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x315d01[_0x4f0f('0x16')][_0x4f0f('0x17')]);return _0x9533a3(_0x315d01['error'][_0x4f0f('0x17')]);}else{logger[_0x4f0f('0x10')](_0x4f0f('0x11'),_0x343c30,'request\x20sent');_0x9533a3(_0x315d01[_0x4f0f('0x18')][_0x4f0f('0x17')]);}})[_0x4f0f('0x19')](function(_0x5f5363){logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x5f5363);_0x2b2e49(_0x5f5363);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index cac540b..b936ef8 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 _0x263f=['./userProfile.events','save','remove','update','emit','removeListener','register','length','userProfile:'];(function(_0x9dbfd4,_0xfe06b5){var _0x234639=function(_0x19b58a){while(--_0x19b58a){_0x9dbfd4['push'](_0x9dbfd4['shift']());}};_0x234639(++_0xfe06b5);}(_0x263f,0x1e6));var _0xf263=function(_0x46f587,_0x34fdcb){_0x46f587=_0x46f587-0x0;var _0x9a818f=_0x263f[_0x46f587];return _0x9a818f;};'use strict';var UserProfileEvents=require(_0xf263('0x0'));var events=[_0xf263('0x1'),_0xf263('0x2'),_0xf263('0x3')];function createListener(_0x1e128d,_0x509678){return function(_0x433dc4){_0x509678[_0xf263('0x4')](_0x1e128d,_0x433dc4);};}function removeListener(_0xfeb91f,_0x4fe83a){return function(){UserProfileEvents[_0xf263('0x5')](_0xfeb91f,_0x4fe83a);};}exports[_0xf263('0x6')]=function(_0x176958){for(var _0x4dcfc2=0x0,_0xec6ce=events[_0xf263('0x7')];_0x4dcfc2<_0xec6ce;_0x4dcfc2++){var _0x1344ff=events[_0x4dcfc2];var _0xb2968f=createListener(_0xf263('0x8')+_0x1344ff,_0x176958);UserProfileEvents['on'](_0x1344ff,_0xb2968f);}}; \ No newline at end of file +var _0x747e=['save','remove','emit','removeListener','length','./userProfile.events'];(function(_0x3fc51b,_0x5b2bbf){var _0x3a5937=function(_0x4fbc7c){while(--_0x4fbc7c){_0x3fc51b['push'](_0x3fc51b['shift']());}};_0x3a5937(++_0x5b2bbf);}(_0x747e,0x1a3));var _0xe747=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x747e[_0x2112d4];return _0x434972;};'use strict';var UserProfileEvents=require(_0xe747('0x0'));var events=[_0xe747('0x1'),_0xe747('0x2'),'update'];function createListener(_0x4df7ee,_0x25e02c){return function(_0x39308f){_0x25e02c[_0xe747('0x3')](_0x4df7ee,_0x39308f);};}function removeListener(_0x28052d,_0x5aec72){return function(){UserProfileEvents[_0xe747('0x4')](_0x28052d,_0x5aec72);};}exports['register']=function(_0x5f4f4f){for(var _0x381e8d=0x0,_0x3a2be9=events[_0xe747('0x5')];_0x381e8d<_0x3a2be9;_0x381e8d++){var _0xc7267f=events[_0x381e8d];var _0xa07809=createListener('userProfile:'+_0xc7267f,_0x5f4f4f);UserProfileEvents['on'](_0xc7267f,_0xa07809);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 0812c8a..1967aa8 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 _0xcdac=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x1a3e23,_0xce45e){var _0x5ee0d8=function(_0x4b932f){while(--_0x4b932f){_0x1a3e23['push'](_0x1a3e23['shift']());}};_0x5ee0d8(++_0xce45e);}(_0xcdac,0x9d));var _0xccda=function(_0x16c2c2,_0x1b79e4){_0x16c2c2=_0x16c2c2-0x0;var _0x2cf35b=_0xcdac[_0x16c2c2];return _0x2cf35b;};'use strict';var multer=require(_0xccda('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xccda('0x1'));var express=require(_0xccda('0x2'));var router=express['Router']();var fs_extra=require(_0xccda('0x3'));var auth=require(_0xccda('0x4'));var interaction=require(_0xccda('0x5'));var config=require(_0xccda('0x6'));var controller=require(_0xccda('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xccda('0x8')]);router['get']('/describe',auth[_0xccda('0x9')](),controller[_0xccda('0xa')]);router['get']('/:id',auth[_0xccda('0x9')](),controller[_0xccda('0xb')]);router[_0xccda('0xc')]('/',auth[_0xccda('0x9')](),controller[_0xccda('0xd')]);router[_0xccda('0xe')](_0xccda('0xf'),auth[_0xccda('0x9')](),controller[_0xccda('0x10')]);router[_0xccda('0x11')](_0xccda('0xf'),auth[_0xccda('0x9')](),controller[_0xccda('0x12')]);module[_0xccda('0x13')]=router; \ No newline at end of file +var _0x791a=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','multer','util','connect-timeout'];(function(_0x355f95,_0x369c0b){var _0x5e5db5=function(_0x59ef48){while(--_0x59ef48){_0x355f95['push'](_0x355f95['shift']());}};_0x5e5db5(++_0x369c0b);}(_0x791a,0x75));var _0xa791=function(_0x28486d,_0x191eb1){_0x28486d=_0x28486d-0x0;var _0x4a0a94=_0x791a[_0x28486d];return _0x4a0a94;};'use strict';var multer=require(_0xa791('0x0'));var util=require(_0xa791('0x1'));var path=require('path');var timeout=require(_0xa791('0x2'));var express=require('express');var router=express[_0xa791('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa791('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa791('0x5'));var controller=require('./userProfileResource.controller');router[_0xa791('0x6')]('/',auth[_0xa791('0x7')](),controller[_0xa791('0x8')]);router[_0xa791('0x6')](_0xa791('0x9'),auth[_0xa791('0x7')](),controller['describe']);router[_0xa791('0x6')](_0xa791('0xa'),auth[_0xa791('0x7')](),controller[_0xa791('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa791('0xc')]);router[_0xa791('0xd')](_0xa791('0xa'),auth[_0xa791('0x7')](),controller['update']);router[_0xa791('0xe')]('/:id',auth[_0xa791('0x7')](),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 a99c77b..0e9aeb9 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 _0x5615=['INTEGER','sequelize','exports','STRING'];(function(_0x3df4fe,_0x1d9181){var _0x44be4a=function(_0xc80ae2){while(--_0xc80ae2){_0x3df4fe['push'](_0x3df4fe['shift']());}};_0x44be4a(++_0x1d9181);}(_0x5615,0x6d));var _0x5561=function(_0x2b7be6,_0xdcc6ac){_0x2b7be6=_0x2b7be6-0x0;var _0x1dd717=_0x5615[_0x2b7be6];return _0x1dd717;};'use strict';var Sequelize=require(_0x5561('0x0'));module[_0x5561('0x1')]={'name':{'type':Sequelize[_0x5561('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5561('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4cfb=['STRING','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cfb,0x68));var _0xb4cf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4cfb[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xb4cf('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4cf('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb4cf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb4cf('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 4471710..c6dd1f3 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 _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfileResource','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x3fc041,_0xc0732c){var _0x1f6edb=function(_0x5f4006){while(--_0x5f4006){_0x3fc041['push'](_0x3fc041['shift']());}};_0x1f6edb(++_0xc0732c);}(_0xef0f,0x168));var _0xfef0=function(_0x33a7ea,_0x55f431){_0x33a7ea=_0x33a7ea-0x0;var _0x707e26=_0xef0f[_0x33a7ea];return _0x707e26;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['UserProfileResource']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file +var _0x57ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','UserProfileResource','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x5d9c31,_0x46a08d){var _0x579098=function(_0x5811a3){while(--_0x5811a3){_0x5d9c31['push'](_0x5d9c31['shift']());}};_0x579098(++_0x46a08d);}(_0x57ca,0x108));var _0xa57c=function(_0x12fe1c,_0x270bbf){_0x12fe1c=_0x12fe1c-0x0;var _0x42b22a=_0x57ca[_0x12fe1c];return _0x42b22a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['UserProfileResource'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['UserProfileResource'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 9ea0ddd..7f592b1 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 _0xacf3=['define','UserProfileResource','compositeIndex','resourceId','sectionId','../../config/logger','api','moment','bluebird','rimraf','./userProfileResource.attributes','exports'];(function(_0x1193f9,_0x367502){var _0x3d4ca9=function(_0xa06232){while(--_0xa06232){_0x1193f9['push'](_0x1193f9['shift']());}};_0x3d4ca9(++_0x367502);}(_0xacf3,0x125));var _0x3acf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xacf3[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3acf('0x0'))(_0x3acf('0x1'));var moment=require(_0x3acf('0x2'));var BPromise=require(_0x3acf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3acf('0x4'));var config=require('../../config/environment');var attributes=require(_0x3acf('0x5'));module[_0x3acf('0x6')]=function(_0x5ef7df,_0x502e01){return _0x5ef7df[_0x3acf('0x7')](_0x3acf('0x8'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x3acf('0x9'),'fields':[_0x3acf('0xa'),_0x3acf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x640b=['./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','../../config/environment'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0x640b,0x1ce));var _0xb640=function(_0x268202,_0x4ff2ff){_0x268202=_0x268202-0x0;var _0x1847aa=_0x640b[_0x268202];return _0x1847aa;};'use strict';var _=require(_0xb640('0x0'));var util=require(_0xb640('0x1'));var logger=require(_0xb640('0x2'))(_0xb640('0x3'));var moment=require(_0xb640('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(_0xb640('0x5'));var attributes=require(_0xb640('0x6'));module[_0xb640('0x7')]=function(_0x6c1e83,_0x2f2969){return _0x6c1e83[_0xb640('0x8')](_0xb640('0x9'),attributes,{'tableName':_0xb640('0xa'),'paranoid':![],'indexes':[{'name':_0xb640('0xb'),'fields':[_0xb640('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 5c94398..3d7e4ea 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 _0xeb00=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment'];(function(_0x33e3fc,_0x122874){var _0x16a772=function(_0x13306a){while(--_0x13306a){_0x33e3fc['push'](_0x33e3fc['shift']());}};_0x16a772(++_0x122874);}(_0xeb00,0xc3));var _0x0eb0=function(_0x4633ad,_0x19f95a){_0x4633ad=_0x4633ad-0x0;var _0x298264=_0xeb00[_0x4633ad];return _0x298264;};'use strict';var _=require(_0x0eb0('0x0'));var util=require(_0x0eb0('0x1'));var moment=require(_0x0eb0('0x2'));var BPromise=require(_0x0eb0('0x3'));var rs=require(_0x0eb0('0x4'));var fs=require('fs');var Redis=require(_0x0eb0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0eb0('0x6'));var logger=require(_0x0eb0('0x7'))(_0x0eb0('0x8'));var config=require(_0x0eb0('0x9'));var jayson=require(_0x0eb0('0xa'));var client=jayson['client'][_0x0eb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x554d9b,_0x54ecb9,_0x2ce909){return new BPromise(function(_0x4e3dea,_0x4a4e25){return client[_0x0eb0('0xc')](_0x554d9b,_0x2ce909)[_0x0eb0('0xd')](function(_0x57ba9f){logger[_0x0eb0('0xe')](_0x0eb0('0xf'),_0x54ecb9,_0x0eb0('0x10'));logger[_0x0eb0('0x11')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x54ecb9,'request\x20sent',JSON['stringify'](_0x57ba9f));if(_0x57ba9f[_0x0eb0('0x12')]){if(_0x57ba9f['error']['code']===0x1f4){logger[_0x0eb0('0x12')](_0x0eb0('0xf'),_0x54ecb9,_0x57ba9f[_0x0eb0('0x12')][_0x0eb0('0x13')]);return _0x4a4e25(_0x57ba9f[_0x0eb0('0x12')]['message']);}logger[_0x0eb0('0x12')](_0x0eb0('0xf'),_0x54ecb9,_0x57ba9f[_0x0eb0('0x12')]['message']);return _0x4e3dea(_0x57ba9f[_0x0eb0('0x12')][_0x0eb0('0x13')]);}else{logger[_0x0eb0('0xe')](_0x0eb0('0xf'),_0x54ecb9,_0x0eb0('0x10'));_0x4e3dea(_0x57ba9f[_0x0eb0('0x14')][_0x0eb0('0x13')]);}})[_0x0eb0('0x15')](function(_0x1f7bff){logger[_0x0eb0('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x54ecb9,_0x1f7bff);_0x4a4e25(_0x1f7bff);});});} \ No newline at end of file +var _0xa646=['jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','bluebird','randomstring','ioredis','../../config/environment'];(function(_0x46b1bd,_0x1940d9){var _0x1b2f0e=function(_0x2b242d){while(--_0x2b242d){_0x46b1bd['push'](_0x46b1bd['shift']());}};_0x1b2f0e(++_0x1940d9);}(_0xa646,0xaf));var _0x6a64=function(_0x18770c,_0xdf9da8){_0x18770c=_0x18770c-0x0;var _0x37c722=_0xa646[_0x18770c];return _0x37c722;};'use strict';var _=require('lodash');var util=require(_0x6a64('0x0'));var moment=require('moment');var BPromise=require(_0x6a64('0x1'));var rs=require(_0x6a64('0x2'));var fs=require('fs');var Redis=require(_0x6a64('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6a64('0x4'));var jayson=require(_0x6a64('0x5'));var client=jayson[_0x6a64('0x6')][_0x6a64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e944a,_0x215d29,_0x43191e){return new BPromise(function(_0x2d883f,_0x18c586){return client[_0x6a64('0x8')](_0x4e944a,_0x43191e)[_0x6a64('0x9')](function(_0x44784e){logger[_0x6a64('0xa')](_0x6a64('0xb'),_0x215d29,_0x6a64('0xc'));logger['debug'](_0x6a64('0xd'),_0x215d29,_0x6a64('0xc'),JSON[_0x6a64('0xe')](_0x44784e));if(_0x44784e[_0x6a64('0xf')]){if(_0x44784e[_0x6a64('0xf')][_0x6a64('0x10')]===0x1f4){logger['error'](_0x6a64('0xb'),_0x215d29,_0x44784e[_0x6a64('0xf')][_0x6a64('0x11')]);return _0x18c586(_0x44784e[_0x6a64('0xf')][_0x6a64('0x11')]);}logger[_0x6a64('0xf')](_0x6a64('0xb'),_0x215d29,_0x44784e['error']['message']);return _0x2d883f(_0x44784e[_0x6a64('0xf')][_0x6a64('0x11')]);}else{logger[_0x6a64('0xa')](_0x6a64('0xb'),_0x215d29,_0x6a64('0xc'));_0x2d883f(_0x44784e['result'][_0x6a64('0x11')]);}})['catch'](function(_0x5de8f7){logger[_0x6a64('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x215d29,_0x5de8f7);_0x18c586(_0x5de8f7);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 32ae3d3..c02e63e 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 _0x5ad3=['put','/:id','update','delete','destroy','exports','express','../../components/auth/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','describe','get','post'];(function(_0x557bf5,_0x4b4e64){var _0x5152a9=function(_0x125b39){while(--_0x125b39){_0x557bf5['push'](_0x557bf5['shift']());}};_0x5152a9(++_0x4b4e64);}(_0x5ad3,0x1e6));var _0x35ad=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x5ad3[_0x6dd5c];return _0x5a87fa;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x35ad('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x35ad('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x35ad('0x2'));var controller=require(_0x35ad('0x3'));router['get']('/',auth[_0x35ad('0x4')](),controller[_0x35ad('0x5')]);router['get']('/describe',auth[_0x35ad('0x4')](),controller[_0x35ad('0x6')]);router[_0x35ad('0x7')]('/:id',auth[_0x35ad('0x4')](),controller['show']);router[_0x35ad('0x8')]('/',auth[_0x35ad('0x4')](),controller['create']);router[_0x35ad('0x9')](_0x35ad('0xa'),auth[_0x35ad('0x4')](),controller[_0x35ad('0xb')]);router[_0x35ad('0xc')](_0x35ad('0xa'),auth[_0x35ad('0x4')](),controller[_0x35ad('0xd')]);module[_0x35ad('0xe')]=router; \ No newline at end of file +var _0x94ea=['delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','post','update'];(function(_0x2031aa,_0x2e4f04){var _0xd5db15=function(_0x21fd75){while(--_0x21fd75){_0x2031aa['push'](_0x2031aa['shift']());}};_0xd5db15(++_0x2e4f04);}(_0x94ea,0xce));var _0xa94e=function(_0x335f5c,_0xce622c){_0x335f5c=_0x335f5c-0x0;var _0x27458c=_0x94ea[_0x335f5c];return _0x27458c;};'use strict';var multer=require('multer');var util=require(_0xa94e('0x0'));var path=require(_0xa94e('0x1'));var timeout=require(_0xa94e('0x2'));var express=require('express');var router=express[_0xa94e('0x3')]();var fs_extra=require(_0xa94e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa94e('0x5'));var config=require(_0xa94e('0x6'));var controller=require(_0xa94e('0x7'));router[_0xa94e('0x8')]('/',auth[_0xa94e('0x9')](),controller[_0xa94e('0xa')]);router['get'](_0xa94e('0xb'),auth[_0xa94e('0x9')](),controller['describe']);router['get'](_0xa94e('0xc'),auth[_0xa94e('0x9')](),controller['show']);router[_0xa94e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa94e('0xc'),auth['isAuthenticated'](),controller[_0xa94e('0xe')]);router[_0xa94e('0xf')]('/:id',auth[_0xa94e('0x9')](),controller['destroy']);module[_0xa94e('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index c6498f4..a6f8237 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 _0xe1e3=['getDataValue','split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x16bd21,_0x3410da){var _0x3224c0=function(_0x460adc){while(--_0x460adc){_0x16bd21['push'](_0x16bd21['shift']());}};_0x3224c0(++_0x3410da);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x35e1bf,_0x4f853f){_0x35e1bf=_0x35e1bf-0x0;var _0x5369ea=_0xe1e3[_0x35e1bf];return _0x5369ea;};'use strict';var Sequelize=require(_0x3e1e('0x0'));module[_0x3e1e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x3e1e('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3e1e('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3bacc){this[_0x3e1e('0x4')](_0x3e1e('0x5'),_0x3bacc?_0x3bacc[_0x3e1e('0x6')](''):[]);},'get':function(){return this[_0x3e1e('0x7')](_0x3e1e('0x5'))?this['getDataValue'](_0x3e1e('0x5'))[_0x3e1e('0x8')](''):[];}}}; \ No newline at end of file +var _0x63a5=['STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions','sequelize','exports'];(function(_0x30f68d,_0x12cb44){var _0x4ac6bf=function(_0x15da9c){while(--_0x15da9c){_0x30f68d['push'](_0x30f68d['shift']());}};_0x4ac6bf(++_0x12cb44);}(_0x63a5,0x18e));var _0x563a=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x63a5[_0x4b73a2];return _0x383c66;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'name':{'type':Sequelize[_0x563a('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x563a('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x563a('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x563a('0x2')],'set':function(_0x386400){this[_0x563a('0x5')]('crudPermissions',_0x386400?_0x386400['join'](''):[]);},'get':function(){return this[_0x563a('0x6')]('crudPermissions')?this[_0x563a('0x6')](_0x563a('0x7'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b360649..cb0fd36 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 _0xd2a5=['nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd2a5,0xa9));var _0x5d2a=function(_0x1e3c2a,_0x33acf3){_0x1e3c2a=_0x1e3c2a-0x0;var _0x10fa0c=_0xd2a5[_0x1e3c2a];return _0x10fa0c;};'use strict';var emlformat=require(_0x5d2a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5d2a('0x1'));var rp=require(_0x5d2a('0x2'));var moment=require(_0x5d2a('0x3'));var BPromise=require(_0x5d2a('0x4'));var Mustache=require('mustache');var util=require(_0x5d2a('0x5'));var path=require(_0x5d2a('0x6'));var sox=require(_0x5d2a('0x7'));var csv=require(_0x5d2a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d2a('0x9'));var squel=require(_0x5d2a('0xa'));var crypto=require(_0x5d2a('0xb'));var jsforce=require(_0x5d2a('0xc'));var deskjs=require(_0x5d2a('0xd'));var toCsv=require(_0x5d2a('0x8'));var querystring=require('querystring');var Papa=require(_0x5d2a('0xe'));var Redis=require(_0x5d2a('0xf'));var authService=require(_0x5d2a('0x10'));var qs=require(_0x5d2a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d2a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5d2a('0x13'));var config=require(_0x5d2a('0x14'));var licenseUtil=require(_0x5d2a('0x15'));var db=require(_0x5d2a('0x16'))['db'];function respondWithStatusCode(_0x2f8303,_0x54ad95){_0x54ad95=_0x54ad95||0xcc;return function(_0x41fb1a){if(_0x41fb1a){return _0x2f8303[_0x5d2a('0x17')](_0x54ad95);}return _0x2f8303[_0x5d2a('0x18')](_0x54ad95)[_0x5d2a('0x19')]();};}function respondWithResult(_0x24f81d,_0x20645f){_0x20645f=_0x20645f||0xc8;return function(_0x9e4afe){if(_0x9e4afe){return _0x24f81d[_0x5d2a('0x18')](_0x20645f)[_0x5d2a('0x1a')](_0x9e4afe);}};}function respondWithFilteredResult(_0x230f75,_0x59515c){return function(_0x133713){if(_0x133713){var _0x4e5ef7=typeof _0x59515c[_0x5d2a('0x1b')]==='undefined'&&typeof _0x59515c[_0x5d2a('0x1c')]==='undefined';var _0x13e064=_0x133713['count'];var _0x1b6491=_0x4e5ef7?0x0:_0x59515c[_0x5d2a('0x1b')];var _0x22b770=_0x4e5ef7?_0x133713[_0x5d2a('0x1d')]:_0x59515c['offset']+_0x59515c[_0x5d2a('0x1c')];var _0x4fb673;if(_0x22b770>=_0x13e064){_0x22b770=_0x13e064;_0x4fb673=0xc8;}else{_0x4fb673=0xce;}_0x230f75['status'](_0x4fb673);return _0x230f75[_0x5d2a('0x1e')](_0x5d2a('0x1f'),_0x1b6491+'-'+_0x22b770+'/'+_0x13e064)['json'](_0x133713);}return null;};}function patchUpdates(_0x7a9fd4){return function(_0x56548c){try{jsonpatch[_0x5d2a('0x20')](_0x56548c,_0x7a9fd4,!![]);}catch(_0x2a3f8f){return BPromise[_0x5d2a('0x21')](_0x2a3f8f);}return _0x56548c[_0x5d2a('0x22')]();};}function saveUpdates(_0x244434,_0x19ee1c){return function(_0x65adf6){if(_0x65adf6){return _0x65adf6[_0x5d2a('0x23')](_0x244434)['then'](function(_0x1846cd){return _0x1846cd;});}return null;};}function removeEntity(_0x3a82fc,_0x1d3a20){return function(_0x4442b4){if(_0x4442b4){return _0x4442b4['destroy']()[_0x5d2a('0x24')](function(){_0x3a82fc[_0x5d2a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25bd95,_0x31492e){return function(_0x373d0f){if(!_0x373d0f){_0x25bd95[_0x5d2a('0x17')](0x194);}return _0x373d0f;};}function handleError(_0xfcd543,_0x462f15){_0x462f15=_0x462f15||0x1f4;return function(_0x1dff1b){logger[_0x5d2a('0x25')](_0x1dff1b[_0x5d2a('0x26')]);if(_0x1dff1b[_0x5d2a('0x27')]){delete _0x1dff1b[_0x5d2a('0x27')];}_0xfcd543[_0x5d2a('0x18')](_0x462f15)[_0x5d2a('0x28')](_0x1dff1b);};}exports[_0x5d2a('0x29')]=function(_0x19c497,_0x343d08){var _0xc57229={},_0x340f7b={},_0xf696a9={'count':0x0,'rows':[]};var _0x4409c6=_[_0x5d2a('0x2a')](db[_0x5d2a('0x2b')][_0x5d2a('0x2c')],function(_0x6a8c47){return{'name':_0x6a8c47[_0x5d2a('0x2d')],'type':_0x6a8c47[_0x5d2a('0x2e')]['key']};});_0x340f7b[_0x5d2a('0x2f')]=_[_0x5d2a('0x2a')](_0x4409c6,_0x5d2a('0x27'));_0x340f7b['query']=_[_0x5d2a('0x30')](_0x19c497[_0x5d2a('0x31')]);_0x340f7b[_0x5d2a('0x32')]=_[_0x5d2a('0x33')](_0x340f7b[_0x5d2a('0x2f')],_0x340f7b['query']);_0xc57229['attributes']=_[_0x5d2a('0x33')](_0x340f7b[_0x5d2a('0x2f')],qs[_0x5d2a('0x34')](_0x19c497[_0x5d2a('0x31')]['fields']));_0xc57229[_0x5d2a('0x35')]=_0xc57229[_0x5d2a('0x35')][_0x5d2a('0x36')]?_0xc57229[_0x5d2a('0x35')]:_0x340f7b['model'];if(!_0x19c497[_0x5d2a('0x31')][_0x5d2a('0x37')](_0x5d2a('0x38'))){_0xc57229[_0x5d2a('0x1c')]=qs[_0x5d2a('0x1c')](_0x19c497[_0x5d2a('0x31')][_0x5d2a('0x1c')]);_0xc57229['offset']=qs[_0x5d2a('0x1b')](_0x19c497[_0x5d2a('0x31')][_0x5d2a('0x1b')]);}_0xc57229[_0x5d2a('0x39')]=qs['sort'](_0x19c497['query'][_0x5d2a('0x3a')]);_0xc57229[_0x5d2a('0x3b')]=qs['filters'](_[_0x5d2a('0x3c')](_0x19c497['query'],_0x340f7b['filters']),_0x4409c6);if(_0x19c497['query']['filter']){_0xc57229['where']=_['merge'](_0xc57229[_0x5d2a('0x3b')],{'$or':_[_0x5d2a('0x2a')](_0x4409c6,function(_0x1e74ba){if(_0x1e74ba[_0x5d2a('0x2e')]!==_0x5d2a('0x3d')){var _0x3a7e7f={};_0x3a7e7f[_0x1e74ba['name']]={'$like':'%'+_0x19c497[_0x5d2a('0x31')][_0x5d2a('0x3e')]+'%'};return _0x3a7e7f;}})});}_0xc57229=_[_0x5d2a('0x3f')]({},_0xc57229,_0x19c497[_0x5d2a('0x40')]);var _0x793b01={'where':_0xc57229[_0x5d2a('0x3b')]};return db[_0x5d2a('0x2b')][_0x5d2a('0x1d')](_0x793b01)[_0x5d2a('0x24')](function(_0x25902c){_0xf696a9[_0x5d2a('0x1d')]=_0x25902c;if(_0x19c497['query'][_0x5d2a('0x41')]){_0xc57229[_0x5d2a('0x42')]=[{'all':!![]}];}return db[_0x5d2a('0x2b')]['findAll'](_0xc57229);})[_0x5d2a('0x24')](function(_0x2f3c1e){_0xf696a9[_0x5d2a('0x43')]=_0x2f3c1e;return _0xf696a9;})[_0x5d2a('0x24')](respondWithFilteredResult(_0x343d08,_0xc57229))[_0x5d2a('0x44')](handleError(_0x343d08,null));};exports[_0x5d2a('0x45')]=function(_0x449546,_0x22fe19){var _0x14b8b2={'raw':![],'where':{'id':_0x449546[_0x5d2a('0x46')]['id']}},_0x11ef31={};_0x11ef31[_0x5d2a('0x2f')]=_[_0x5d2a('0x30')](db[_0x5d2a('0x2b')]['rawAttributes']);_0x11ef31['query']=_[_0x5d2a('0x30')](_0x449546[_0x5d2a('0x31')]);_0x11ef31['filters']=_['intersection'](_0x11ef31['model'],_0x11ef31[_0x5d2a('0x31')]);_0x14b8b2[_0x5d2a('0x35')]=_['intersection'](_0x11ef31[_0x5d2a('0x2f')],qs['fields'](_0x449546['query'][_0x5d2a('0x34')]));_0x14b8b2[_0x5d2a('0x35')]=_0x14b8b2['attributes'][_0x5d2a('0x36')]?_0x14b8b2[_0x5d2a('0x35')]:_0x11ef31[_0x5d2a('0x2f')];if(_0x449546['query'][_0x5d2a('0x41')]){_0x14b8b2[_0x5d2a('0x42')]=[{'all':!![]}];}_0x14b8b2=_[_0x5d2a('0x3f')]({},_0x14b8b2,_0x449546['options']);return db[_0x5d2a('0x2b')][_0x5d2a('0x47')](_0x14b8b2)[_0x5d2a('0x24')](handleEntityNotFound(_0x22fe19,null))[_0x5d2a('0x24')](respondWithResult(_0x22fe19,null))[_0x5d2a('0x44')](handleError(_0x22fe19,null));};exports['create']=function(_0x3350db,_0x218dca){return db['UserProfileSection'][_0x5d2a('0x48')](_0x3350db[_0x5d2a('0x49')],{})[_0x5d2a('0x24')](respondWithResult(_0x218dca,0xc9))[_0x5d2a('0x44')](handleError(_0x218dca,null));};exports[_0x5d2a('0x23')]=function(_0x24dea9,_0x28506e){if(_0x24dea9[_0x5d2a('0x49')]['id']){delete _0x24dea9[_0x5d2a('0x49')]['id'];}return db[_0x5d2a('0x2b')]['find']({'where':{'id':_0x24dea9[_0x5d2a('0x46')]['id']}})[_0x5d2a('0x24')](handleEntityNotFound(_0x28506e,null))[_0x5d2a('0x24')](saveUpdates(_0x24dea9[_0x5d2a('0x49')],null))['then'](respondWithResult(_0x28506e,null))[_0x5d2a('0x44')](handleError(_0x28506e,null));};exports['destroy']=function(_0x77403f,_0x14a14c){return db['UserProfileSection'][_0x5d2a('0x47')]({'where':{'id':_0x77403f['params']['id']}})['then'](handleEntityNotFound(_0x14a14c,null))['then'](removeEntity(_0x14a14c,null))[_0x5d2a('0x44')](handleError(_0x14a14c,null));};exports[_0x5d2a('0x4a')]=function(_0x2f8fec,_0x57837b){return db['UserProfileSection'][_0x5d2a('0x4a')]()[_0x5d2a('0x24')](respondWithResult(_0x57837b,null))['catch'](handleError(_0x57837b,null));}; \ No newline at end of file +var _0x673d=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','error','name','send','index','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileSection','then','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x284d99,_0x44ecfe){var _0x224cd5=function(_0x64a594){while(--_0x64a594){_0x284d99['push'](_0x284d99['shift']());}};_0x224cd5(++_0x44ecfe);}(_0x673d,0x1c3));var _0xd673=function(_0x41ef02,_0x101e1a){_0x41ef02=_0x41ef02-0x0;var _0x5e6995=_0x673d[_0x41ef02];return _0x5e6995;};'use strict';var emlformat=require(_0xd673('0x0'));var rimraf=require(_0xd673('0x1'));var zipdir=require(_0xd673('0x2'));var jsonpatch=require(_0xd673('0x3'));var rp=require(_0xd673('0x4'));var moment=require(_0xd673('0x5'));var BPromise=require(_0xd673('0x6'));var Mustache=require(_0xd673('0x7'));var util=require(_0xd673('0x8'));var path=require(_0xd673('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd673('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd673('0xb'));var squel=require(_0xd673('0xc'));var crypto=require('crypto');var jsforce=require(_0xd673('0xd'));var deskjs=require(_0xd673('0xe'));var toCsv=require(_0xd673('0xf'));var querystring=require(_0xd673('0x10'));var Papa=require('papaparse');var Redis=require(_0xd673('0x11'));var authService=require(_0xd673('0x12'));var qs=require(_0xd673('0x13'));var as=require(_0xd673('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd673('0x15'))('api');var utils=require(_0xd673('0x16'));var config=require(_0xd673('0x17'));var licenseUtil=require(_0xd673('0x18'));var db=require(_0xd673('0x19'))['db'];function respondWithStatusCode(_0x44a7bf,_0xe8e83){_0xe8e83=_0xe8e83||0xcc;return function(_0x385c4){if(_0x385c4){return _0x44a7bf[_0xd673('0x1a')](_0xe8e83);}return _0x44a7bf[_0xd673('0x1b')](_0xe8e83)[_0xd673('0x1c')]();};}function respondWithResult(_0x413458,_0x3ad67c){_0x3ad67c=_0x3ad67c||0xc8;return function(_0x3d1374){if(_0x3d1374){return _0x413458['status'](_0x3ad67c)[_0xd673('0x1d')](_0x3d1374);}};}function respondWithFilteredResult(_0x3d937e,_0x443fb7){return function(_0x13fd88){if(_0x13fd88){var _0x44359a=typeof _0x443fb7[_0xd673('0x1e')]===_0xd673('0x1f')&&typeof _0x443fb7[_0xd673('0x20')]===_0xd673('0x1f');var _0x323d77=_0x13fd88[_0xd673('0x21')];var _0x557175=_0x44359a?0x0:_0x443fb7['offset'];var _0x403a9f=_0x44359a?_0x13fd88[_0xd673('0x21')]:_0x443fb7[_0xd673('0x1e')]+_0x443fb7[_0xd673('0x20')];var _0x175d06;if(_0x403a9f>=_0x323d77){_0x403a9f=_0x323d77;_0x175d06=0xc8;}else{_0x175d06=0xce;}_0x3d937e[_0xd673('0x1b')](_0x175d06);return _0x3d937e[_0xd673('0x22')](_0xd673('0x23'),_0x557175+'-'+_0x403a9f+'/'+_0x323d77)[_0xd673('0x1d')](_0x13fd88);}return null;};}function patchUpdates(_0x1431ed){return function(_0x47d00e){try{jsonpatch[_0xd673('0x24')](_0x47d00e,_0x1431ed,!![]);}catch(_0x2b0399){return BPromise['reject'](_0x2b0399);}return _0x47d00e['save']();};}function saveUpdates(_0x210d44,_0xb9f699){return function(_0x4507d4){if(_0x4507d4){return _0x4507d4['update'](_0x210d44)['then'](function(_0x152aad){return _0x152aad;});}return null;};}function removeEntity(_0x21742b,_0x3cbe9c){return function(_0x21747b){if(_0x21747b){return _0x21747b[_0xd673('0x25')]()['then'](function(){_0x21742b[_0xd673('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x495028,_0x4101c6){return function(_0x3218ef){if(!_0x3218ef){_0x495028[_0xd673('0x1a')](0x194);}return _0x3218ef;};}function handleError(_0x3b0861,_0x1db6f1){_0x1db6f1=_0x1db6f1||0x1f4;return function(_0x9f408e){logger[_0xd673('0x26')](_0x9f408e['stack']);if(_0x9f408e[_0xd673('0x27')]){delete _0x9f408e[_0xd673('0x27')];}_0x3b0861[_0xd673('0x1b')](_0x1db6f1)[_0xd673('0x28')](_0x9f408e);};}exports[_0xd673('0x29')]=function(_0x55d273,_0x56fc08){var _0x1b862b={},_0x3c7a96={},_0x2a0b2e={'count':0x0,'rows':[]};var _0x1ae486=_[_0xd673('0x2a')](db['UserProfileSection']['rawAttributes'],function(_0x1463d5){return{'name':_0x1463d5[_0xd673('0x2b')],'type':_0x1463d5[_0xd673('0x2c')][_0xd673('0x2d')]};});_0x3c7a96[_0xd673('0x2e')]=_[_0xd673('0x2a')](_0x1ae486,'name');_0x3c7a96[_0xd673('0x2f')]=_['keys'](_0x55d273[_0xd673('0x2f')]);_0x3c7a96[_0xd673('0x30')]=_['intersection'](_0x3c7a96[_0xd673('0x2e')],_0x3c7a96[_0xd673('0x2f')]);_0x1b862b[_0xd673('0x31')]=_[_0xd673('0x32')](_0x3c7a96['model'],qs[_0xd673('0x33')](_0x55d273[_0xd673('0x2f')][_0xd673('0x33')]));_0x1b862b[_0xd673('0x31')]=_0x1b862b[_0xd673('0x31')][_0xd673('0x34')]?_0x1b862b[_0xd673('0x31')]:_0x3c7a96[_0xd673('0x2e')];if(!_0x55d273[_0xd673('0x2f')][_0xd673('0x35')](_0xd673('0x36'))){_0x1b862b['limit']=qs[_0xd673('0x20')](_0x55d273['query']['limit']);_0x1b862b[_0xd673('0x1e')]=qs[_0xd673('0x1e')](_0x55d273[_0xd673('0x2f')][_0xd673('0x1e')]);}_0x1b862b[_0xd673('0x37')]=qs[_0xd673('0x38')](_0x55d273[_0xd673('0x2f')][_0xd673('0x38')]);_0x1b862b[_0xd673('0x39')]=qs[_0xd673('0x30')](_[_0xd673('0x3a')](_0x55d273['query'],_0x3c7a96[_0xd673('0x30')]),_0x1ae486);if(_0x55d273[_0xd673('0x2f')][_0xd673('0x3b')]){_0x1b862b[_0xd673('0x39')]=_[_0xd673('0x3c')](_0x1b862b['where'],{'$or':_['map'](_0x1ae486,function(_0x1eff3d){if(_0x1eff3d[_0xd673('0x2c')]!==_0xd673('0x3d')){var _0xe100d3={};_0xe100d3[_0x1eff3d[_0xd673('0x27')]]={'$like':'%'+_0x55d273[_0xd673('0x2f')][_0xd673('0x3b')]+'%'};return _0xe100d3;}})});}_0x1b862b=_[_0xd673('0x3c')]({},_0x1b862b,_0x55d273[_0xd673('0x3e')]);var _0x37e413={'where':_0x1b862b[_0xd673('0x39')]};return db[_0xd673('0x3f')]['count'](_0x37e413)[_0xd673('0x40')](function(_0x40d5f6){_0x2a0b2e['count']=_0x40d5f6;if(_0x55d273[_0xd673('0x2f')]['includeAll']){_0x1b862b[_0xd673('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0xd673('0x42')](_0x1b862b);})[_0xd673('0x40')](function(_0x1ce674){_0x2a0b2e[_0xd673('0x43')]=_0x1ce674;return _0x2a0b2e;})['then'](respondWithFilteredResult(_0x56fc08,_0x1b862b))[_0xd673('0x44')](handleError(_0x56fc08,null));};exports[_0xd673('0x45')]=function(_0x37699f,_0x5d81a0){var _0x1c7230={'raw':![],'where':{'id':_0x37699f[_0xd673('0x46')]['id']}},_0x29decf={};_0x29decf[_0xd673('0x2e')]=_[_0xd673('0x47')](db['UserProfileSection'][_0xd673('0x48')]);_0x29decf['query']=_[_0xd673('0x47')](_0x37699f[_0xd673('0x2f')]);_0x29decf[_0xd673('0x30')]=_['intersection'](_0x29decf[_0xd673('0x2e')],_0x29decf[_0xd673('0x2f')]);_0x1c7230[_0xd673('0x31')]=_[_0xd673('0x32')](_0x29decf[_0xd673('0x2e')],qs[_0xd673('0x33')](_0x37699f[_0xd673('0x2f')][_0xd673('0x33')]));_0x1c7230[_0xd673('0x31')]=_0x1c7230['attributes'][_0xd673('0x34')]?_0x1c7230[_0xd673('0x31')]:_0x29decf['model'];if(_0x37699f[_0xd673('0x2f')][_0xd673('0x49')]){_0x1c7230['include']=[{'all':!![]}];}_0x1c7230=_[_0xd673('0x3c')]({},_0x1c7230,_0x37699f[_0xd673('0x3e')]);return db[_0xd673('0x3f')][_0xd673('0x4a')](_0x1c7230)[_0xd673('0x40')](handleEntityNotFound(_0x5d81a0,null))['then'](respondWithResult(_0x5d81a0,null))['catch'](handleError(_0x5d81a0,null));};exports['create']=function(_0x1fcad0,_0x5cb17c){return db[_0xd673('0x3f')][_0xd673('0x4b')](_0x1fcad0[_0xd673('0x4c')],{})['then'](respondWithResult(_0x5cb17c,0xc9))[_0xd673('0x44')](handleError(_0x5cb17c,null));};exports[_0xd673('0x4d')]=function(_0x5c1c0e,_0x28bb9e){if(_0x5c1c0e[_0xd673('0x4c')]['id']){delete _0x5c1c0e['body']['id'];}return db[_0xd673('0x3f')][_0xd673('0x4a')]({'where':{'id':_0x5c1c0e['params']['id']}})[_0xd673('0x40')](handleEntityNotFound(_0x28bb9e,null))[_0xd673('0x40')](saveUpdates(_0x5c1c0e[_0xd673('0x4c')],null))[_0xd673('0x40')](respondWithResult(_0x28bb9e,null))['catch'](handleError(_0x28bb9e,null));};exports[_0xd673('0x25')]=function(_0x4d3936,_0x344909){return db['UserProfileSection'][_0xd673('0x4a')]({'where':{'id':_0x4d3936[_0xd673('0x46')]['id']}})[_0xd673('0x40')](handleEntityNotFound(_0x344909,null))[_0xd673('0x40')](removeEntity(_0x344909,null))[_0xd673('0x44')](handleError(_0x344909,null));};exports[_0xd673('0x4e')]=function(_0x142197,_0x17b745){return db[_0xd673('0x3f')][_0xd673('0x4e')]()['then'](respondWithResult(_0x17b745,null))[_0xd673('0x44')](handleError(_0x17b745,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 54bb4cf..d0c2a55 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 _0xf3ce=['rimraf','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x31ee08,_0x270029){var _0x48d939=function(_0x15f8f5){while(--_0x15f8f5){_0x31ee08['push'](_0x31ee08['shift']());}};_0x48d939(++_0x270029);}(_0xf3ce,0x165));var _0xef3c=function(_0x367e3b,_0x5d92ad){_0x367e3b=_0x367e3b-0x0;var _0x35568d=_0xf3ce[_0x367e3b];return _0x35568d;};'use strict';var _=require(_0xef3c('0x0'));var util=require(_0xef3c('0x1'));var logger=require(_0xef3c('0x2'))(_0xef3c('0x3'));var moment=require(_0xef3c('0x4'));var BPromise=require(_0xef3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef3c('0x6'));var rimraf=require(_0xef3c('0x7'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x34f0b6,_0x4e006b){return _0x34f0b6[_0xef3c('0x8')]('UserProfileSection',attributes,{'tableName':_0xef3c('0x9'),'paranoid':![],'indexes':[{'name':_0xef3c('0xa'),'fields':[_0xef3c('0xb'),_0xef3c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x34a4=['moment','bluebird','path','rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','../../config/logger','api'];(function(_0x3837b4,_0x1ad8a2){var _0x4069c0=function(_0x20ea4f){while(--_0x20ea4f){_0x3837b4['push'](_0x3837b4['shift']());}};_0x4069c0(++_0x1ad8a2);}(_0x34a4,0x1ba));var _0x434a=function(_0x2d93d4,_0x149172){_0x2d93d4=_0x2d93d4-0x0;var _0x44df30=_0x34a4[_0x2d93d4];return _0x44df30;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x434a('0x0'))(_0x434a('0x1'));var moment=require(_0x434a('0x2'));var BPromise=require(_0x434a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x434a('0x4'));var rimraf=require(_0x434a('0x5'));var config=require('../../config/environment');var attributes=require(_0x434a('0x6'));module[_0x434a('0x7')]=function(_0x3086c8,_0x4534e){return _0x3086c8[_0x434a('0x8')]('UserProfileSection',attributes,{'tableName':_0x434a('0x9'),'paranoid':![],'indexes':[{'name':_0x434a('0xa'),'fields':[_0x434a('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 0a5b379..8f68caf 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 _0x01e7=['request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01e7,0x125));var _0x701e=function(_0x42012a,_0xdfd9da){_0x42012a=_0x42012a-0x0;var _0x474b1f=_0x01e7[_0x42012a];return _0x474b1f;};'use strict';var _=require(_0x701e('0x0'));var util=require(_0x701e('0x1'));var moment=require(_0x701e('0x2'));var BPromise=require(_0x701e('0x3'));var rs=require(_0x701e('0x4'));var fs=require('fs');var Redis=require(_0x701e('0x5'));var db=require(_0x701e('0x6'))['db'];var utils=require(_0x701e('0x7'));var logger=require(_0x701e('0x8'))(_0x701e('0x9'));var config=require(_0x701e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x701e('0xb')][_0x701e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9ab603,_0x4cf450,_0x5984de){return new BPromise(function(_0x3dc407,_0xe9b695){return client[_0x701e('0xd')](_0x9ab603,_0x5984de)[_0x701e('0xe')](function(_0x3aea34){logger[_0x701e('0xf')](_0x701e('0x10'),_0x4cf450,'request\x20sent');logger[_0x701e('0x11')](_0x701e('0x12'),_0x4cf450,_0x701e('0x13'),JSON['stringify'](_0x3aea34));if(_0x3aea34['error']){if(_0x3aea34[_0x701e('0x14')][_0x701e('0x15')]===0x1f4){logger[_0x701e('0x14')](_0x701e('0x10'),_0x4cf450,_0x3aea34[_0x701e('0x14')]['message']);return _0xe9b695(_0x3aea34[_0x701e('0x14')][_0x701e('0x16')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x4cf450,_0x3aea34['error'][_0x701e('0x16')]);return _0x3dc407(_0x3aea34[_0x701e('0x14')][_0x701e('0x16')]);}else{logger['info'](_0x701e('0x10'),_0x4cf450,'request\x20sent');_0x3dc407(_0x3aea34[_0x701e('0x17')][_0x701e('0x16')]);}})['catch'](function(_0x40b85b){logger['error'](_0x701e('0x10'),_0x4cf450,_0x40b85b);_0xe9b695(_0x40b85b);});});} \ No newline at end of file +var _0xef39=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3b3922,_0x4c6b03){var _0x3ecbc9=function(_0xc321f7){while(--_0xc321f7){_0x3b3922['push'](_0x3b3922['shift']());}};_0x3ecbc9(++_0x4c6b03);}(_0xef39,0x92));var _0x9ef3=function(_0x3b006c,_0x8317f2){_0x3b006c=_0x3b006c-0x0;var _0x39fc23=_0xef39[_0x3b006c];return _0x39fc23;};'use strict';var _=require('lodash');var util=require(_0x9ef3('0x0'));var moment=require(_0x9ef3('0x1'));var BPromise=require(_0x9ef3('0x2'));var rs=require(_0x9ef3('0x3'));var fs=require('fs');var Redis=require(_0x9ef3('0x4'));var db=require(_0x9ef3('0x5'))['db'];var utils=require(_0x9ef3('0x6'));var logger=require(_0x9ef3('0x7'))(_0x9ef3('0x8'));var config=require(_0x9ef3('0x9'));var jayson=require(_0x9ef3('0xa'));var client=jayson[_0x9ef3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b8488,_0x1f7ab7,_0x290ffd){return new BPromise(function(_0x27cfaa,_0x370330){return client[_0x9ef3('0xc')](_0x1b8488,_0x290ffd)[_0x9ef3('0xd')](function(_0x15ae4c){logger[_0x9ef3('0xe')](_0x9ef3('0xf'),_0x1f7ab7,_0x9ef3('0x10'));logger[_0x9ef3('0x11')](_0x9ef3('0x12'),_0x1f7ab7,'request\x20sent',JSON[_0x9ef3('0x13')](_0x15ae4c));if(_0x15ae4c[_0x9ef3('0x14')]){if(_0x15ae4c[_0x9ef3('0x14')][_0x9ef3('0x15')]===0x1f4){logger[_0x9ef3('0x14')](_0x9ef3('0xf'),_0x1f7ab7,_0x15ae4c['error'][_0x9ef3('0x16')]);return _0x370330(_0x15ae4c[_0x9ef3('0x14')][_0x9ef3('0x16')]);}logger['error'](_0x9ef3('0xf'),_0x1f7ab7,_0x15ae4c[_0x9ef3('0x14')]['message']);return _0x27cfaa(_0x15ae4c[_0x9ef3('0x14')][_0x9ef3('0x16')]);}else{logger[_0x9ef3('0xe')](_0x9ef3('0xf'),_0x1f7ab7,_0x9ef3('0x10'));_0x27cfaa(_0x15ae4c[_0x9ef3('0x17')]['message']);}})[_0x9ef3('0x18')](function(_0x355dbb){logger[_0x9ef3('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x1f7ab7,_0x355dbb);_0x370330(_0x355dbb);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 6bd0991..ba797ae 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x28abdc,_0x106adc){var _0x3939a8=function(_0x5b1050){while(--_0x5b1050){_0x28abdc['push'](_0x28abdc['shift']());}};_0x3939a8(++_0x106adc);}(_0xe706,0xa3));var _0x6e70=function(_0xeb7786,_0x53a053){_0xeb7786=_0xeb7786-0x0;var _0x120bbc=_0xe706[_0xeb7786];return _0x120bbc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1d9993,_0x4b7875){var _0x44148a=function(_0x26e020){while(--_0x26e020){_0x1d9993['push'](_0x1d9993['shift']());}};_0x44148a(++_0x4b7875);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 3697e64..b08e760 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 _0xfd85=['sequelize','exports'];(function(_0x5d8735,_0x48c781){var _0x447ca7=function(_0x2c6fd1){while(--_0x2c6fd1){_0x5d8735['push'](_0x5d8735['shift']());}};_0x447ca7(++_0x48c781);}(_0xfd85,0x1d2));var _0x5fd8=function(_0x652b90,_0x52865b){_0x652b90=_0x652b90-0x0;var _0x523368=_0xfd85[_0x652b90];return _0x523368;};'use strict';var Sequelize=require(_0x5fd8('0x0'));module[_0x5fd8('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x19ff=['exports','INTEGER','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x19ff,0xbc));var _0xf19f=function(_0x45a21c,_0x4bcd4d){_0x45a21c=_0x45a21c-0x0;var _0x2bdbf0=_0x19ff[_0x45a21c];return _0x2bdbf0;};'use strict';var Sequelize=require(_0xf19f('0x0'));module[_0xf19f('0x1')]={'penalty':{'type':Sequelize[_0xf19f('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 46e83f4..9c5d489 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 _0xdf55=['util','api','moment','request-promise','path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xdf55,0x83));var _0x5df5=function(_0x46066f,_0x23105c){_0x46066f=_0x46066f-0x0;var _0x411977=_0xdf55[_0x46066f];return _0x411977;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var logger=require('../../config/logger')(_0x5df5('0x2'));var moment=require(_0x5df5('0x3'));var BPromise=require('bluebird');var rp=require(_0x5df5('0x4'));var fs=require('fs');var path=require(_0x5df5('0x5'));var rimraf=require(_0x5df5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5df5('0x7'));module[_0x5df5('0x8')]=function(_0x27ec86,_0x476e21){return _0x27ec86[_0x5df5('0x9')](_0x5df5('0xa'),attributes,{'tableName':_0x5df5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f6f=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./userSmsQueue.attributes','exports','user_has_sms_queues'];(function(_0x43f5d1,_0x2455c5){var _0x4e744b=function(_0x1ea06e){while(--_0x1ea06e){_0x43f5d1['push'](_0x43f5d1['shift']());}};_0x4e744b(++_0x2455c5);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x1f4fe3,_0x5b660b){_0x1f4fe3=_0x1f4fe3-0x0;var _0xe8dd52=_0x5f6f[_0x1f4fe3];return _0xe8dd52;};'use strict';var _=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var logger=require(_0xf5f6('0x2'))(_0xf5f6('0x3'));var moment=require(_0xf5f6('0x4'));var BPromise=require('bluebird');var rp=require(_0xf5f6('0x5'));var fs=require('fs');var path=require(_0xf5f6('0x6'));var rimraf=require(_0xf5f6('0x7'));var config=require('../../config/environment');var attributes=require(_0xf5f6('0x8'));module[_0xf5f6('0x9')]=function(_0x390b1a,_0xfda1c7){return _0x390b1a['define']('UserSmsQueue',attributes,{'tableName':_0xf5f6('0xa'),'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 5adf5e7..b322993 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 _0xf7c5=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xf7c5,0xa0));var _0x5f7c=function(_0x10548e,_0x80eaff){_0x10548e=_0x10548e-0x0;var _0x540aa4=_0xf7c5[_0x10548e];return _0x540aa4;};'use strict';var _=require(_0x5f7c('0x0'));var util=require(_0x5f7c('0x1'));var moment=require(_0x5f7c('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f7c('0x3'));var fs=require('fs');var Redis=require(_0x5f7c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f7c('0x5'));var logger=require(_0x5f7c('0x6'))(_0x5f7c('0x7'));var config=require(_0x5f7c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f7c('0x9')][_0x5f7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3900ea,_0x5fc47,_0x47509a){return new BPromise(function(_0x3f6951,_0x1285c2){return client[_0x5f7c('0xb')](_0x3900ea,_0x47509a)[_0x5f7c('0xc')](function(_0x4255b2){logger[_0x5f7c('0xd')](_0x5f7c('0xe'),_0x5fc47,_0x5f7c('0xf'));logger[_0x5f7c('0x10')](_0x5f7c('0x11'),_0x5fc47,'request\x20sent',JSON['stringify'](_0x4255b2));if(_0x4255b2[_0x5f7c('0x12')]){if(_0x4255b2[_0x5f7c('0x12')][_0x5f7c('0x13')]===0x1f4){logger['error'](_0x5f7c('0xe'),_0x5fc47,_0x4255b2[_0x5f7c('0x12')][_0x5f7c('0x14')]);return _0x1285c2(_0x4255b2[_0x5f7c('0x12')][_0x5f7c('0x14')]);}logger[_0x5f7c('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x5fc47,_0x4255b2['error'][_0x5f7c('0x14')]);return _0x3f6951(_0x4255b2['error'][_0x5f7c('0x14')]);}else{logger[_0x5f7c('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x5fc47,_0x5f7c('0xf'));_0x3f6951(_0x4255b2[_0x5f7c('0x15')][_0x5f7c('0x14')]);}})[_0x5f7c('0x16')](function(_0x41ea83){logger[_0x5f7c('0x12')](_0x5f7c('0xe'),_0x5fc47,_0x41ea83);_0x1285c2(_0x41ea83);});});} \ No newline at end of file +var _0x07fa=['bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x18af5,_0x1820ce){var _0xd307bb=function(_0x372566){while(--_0x372566){_0x18af5['push'](_0x18af5['shift']());}};_0xd307bb(++_0x1820ce);}(_0x07fa,0x97));var _0xa07f=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x07fa[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0xa07f('0x0'));var util=require(_0xa07f('0x1'));var moment=require(_0xa07f('0x2'));var BPromise=require(_0xa07f('0x3'));var rs=require(_0xa07f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa07f('0x5'));var logger=require(_0xa07f('0x6'))('rpc');var config=require(_0xa07f('0x7'));var jayson=require(_0xa07f('0x8'));var client=jayson[_0xa07f('0x9')][_0xa07f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1467b3,_0x36d68e,_0x104cbf){return new BPromise(function(_0x8d3dfc,_0x530c1c){return client[_0xa07f('0xb')](_0x1467b3,_0x104cbf)[_0xa07f('0xc')](function(_0x40a9d0){logger['info'](_0xa07f('0xd'),_0x36d68e,'request\x20sent');logger[_0xa07f('0xe')](_0xa07f('0xf'),_0x36d68e,_0xa07f('0x10'),JSON['stringify'](_0x40a9d0));if(_0x40a9d0['error']){if(_0x40a9d0[_0xa07f('0x11')][_0xa07f('0x12')]===0x1f4){logger[_0xa07f('0x11')](_0xa07f('0xd'),_0x36d68e,_0x40a9d0[_0xa07f('0x11')][_0xa07f('0x13')]);return _0x530c1c(_0x40a9d0[_0xa07f('0x11')]['message']);}logger[_0xa07f('0x11')](_0xa07f('0xd'),_0x36d68e,_0x40a9d0[_0xa07f('0x11')][_0xa07f('0x13')]);return _0x8d3dfc(_0x40a9d0[_0xa07f('0x11')][_0xa07f('0x13')]);}else{logger['info'](_0xa07f('0xd'),_0x36d68e,_0xa07f('0x10'));_0x8d3dfc(_0x40a9d0[_0xa07f('0x14')][_0xa07f('0x13')]);}})[_0xa07f('0x15')](function(_0xa32465){logger['error'](_0xa07f('0xd'),_0x36d68e,_0xa32465);_0x530c1c(_0xa32465);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 1d17ac9..301e519 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 _0xa02c=['exports','INTEGER'];(function(_0x2ecaa0,_0x1f676e){var _0x5c2b9b=function(_0x5debe7){while(--_0x5debe7){_0x2ecaa0['push'](_0x2ecaa0['shift']());}};_0x5c2b9b(++_0x1f676e);}(_0xa02c,0x176));var _0xca02=function(_0x1b5baa,_0x10e05b){_0x1b5baa=_0x1b5baa-0x0;var _0x3508f6=_0xa02c[_0x1b5baa];return _0x3508f6;};'use strict';var Sequelize=require('sequelize');module[_0xca02('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xca02('0x1')]}}; \ No newline at end of file +var _0x0d28=['INTEGER','sequelize'];(function(_0x275a90,_0xa0f3cc){var _0x17b092=function(_0x45ec5a){while(--_0x45ec5a){_0x275a90['push'](_0x275a90['shift']());}};_0x17b092(++_0xa0f3cc);}(_0x0d28,0x1a5));var _0x80d2=function(_0x2b8810,_0x55efdb){_0x2b8810=_0x2b8810-0x0;var _0x4c0f41=_0x0d28[_0x2b8810];return _0x4c0f41;};'use strict';var Sequelize=require(_0x80d2('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x80d2('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 2048db3..029c5f8 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(_0x522f54,_0x4a5c05){var _0x237ee3=function(_0x50ecc2){while(--_0x50ecc2){_0x522f54['push'](_0x522f54['shift']());}};_0x237ee3(++_0x4a5c05);}(_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':'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(_0x4bed57,_0x4e551b){var _0x6cb955=function(_0x4c7f97){while(--_0x4c7f97){_0x4bed57['push'](_0x4bed57['shift']());}};_0x6cb955(++_0x4e551b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 ed32d81..f9d1553 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2fe7b0,_0x39c02b){var _0x456c3d=function(_0x44041e){while(--_0x44041e){_0x2fe7b0['push'](_0x2fe7b0['shift']());}};_0x456c3d(++_0x39c02b);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'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(_0x1aae6a,_0x56bb19){var _0x297a71=function(_0x471e80){while(--_0x471e80){_0x1aae6a['push'](_0x1aae6a['shift']());}};_0x297a71(++_0x56bb19);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index edb9fc6..559399c 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 _0x8bcc=['exports','INTEGER','sequelize'];(function(_0x3c04f4,_0x5826be){var _0x3e8a91=function(_0x489db3){while(--_0x489db3){_0x3c04f4['push'](_0x3c04f4['shift']());}};_0x3e8a91(++_0x5826be);}(_0x8bcc,0xaa));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc8bc('0x0'));module[_0xc8bc('0x1')]={'penalty':{'type':Sequelize[_0xc8bc('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x47f4=['exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x47f4,0x17f));var _0x447f=function(_0x481113,_0x5b008f){_0x481113=_0x481113-0x0;var _0x4910f2=_0x47f4[_0x481113];return _0x4910f2;};'use strict';var Sequelize=require('sequelize');module[_0x447f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 6536599..e33cc08 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 _0x52e9=['api','path','rimraf','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger'];(function(_0x59d65b,_0x454cb4){var _0x5f1471=function(_0x333662){while(--_0x333662){_0x59d65b['push'](_0x59d65b['shift']());}};_0x5f1471(++_0x454cb4);}(_0x52e9,0x10e));var _0x952e=function(_0x1229ac,_0x24520e){_0x1229ac=_0x1229ac-0x0;var _0x491d8b=_0x52e9[_0x1229ac];return _0x491d8b;};'use strict';var _=require('lodash');var util=require(_0x952e('0x0'));var logger=require(_0x952e('0x1'))(_0x952e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x952e('0x3'));var rimraf=require(_0x952e('0x4'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x777bca,_0x52070f){return _0x777bca[_0x952e('0x5')](_0x952e('0x6'),attributes,{'tableName':_0x952e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb91d=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger'];(function(_0x40951a,_0x2cbe60){var _0xdb2028=function(_0x134fa6){while(--_0x134fa6){_0x40951a['push'](_0x40951a['shift']());}};_0xdb2028(++_0x2cbe60);}(_0xb91d,0x129));var _0xdb91=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb91d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdb91('0x0'));var util=require('util');var logger=require(_0xdb91('0x1'))(_0xdb91('0x2'));var moment=require(_0xdb91('0x3'));var BPromise=require(_0xdb91('0x4'));var rp=require(_0xdb91('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb91('0x6'));var config=require(_0xdb91('0x7'));var attributes=require(_0xdb91('0x8'));module[_0xdb91('0x9')]=function(_0x35605d,_0x5c890d){return _0x35605d[_0xdb91('0xa')](_0xdb91('0xb'),attributes,{'tableName':_0xdb91('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index a2a641f..4a3a293 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 _0xf0c6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xf0c6,0x172));var _0x6f0c=function(_0x48baf2,_0x4f3031){_0x48baf2=_0x48baf2-0x0;var _0x2dd170=_0xf0c6[_0x48baf2];return _0x2dd170;};'use strict';var _=require(_0x6f0c('0x0'));var util=require(_0x6f0c('0x1'));var moment=require(_0x6f0c('0x2'));var BPromise=require(_0x6f0c('0x3'));var rs=require(_0x6f0c('0x4'));var fs=require('fs');var Redis=require(_0x6f0c('0x5'));var db=require(_0x6f0c('0x6'))['db'];var utils=require(_0x6f0c('0x7'));var logger=require(_0x6f0c('0x8'))('rpc');var config=require(_0x6f0c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6f0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35cf46,_0x166881,_0xf92c8c){return new BPromise(function(_0x24a14d,_0x367c79){return client[_0x6f0c('0xb')](_0x35cf46,_0xf92c8c)[_0x6f0c('0xc')](function(_0x1bc986){logger['info'](_0x6f0c('0xd'),_0x166881,_0x6f0c('0xe'));logger['debug'](_0x6f0c('0xf'),_0x166881,_0x6f0c('0xe'),JSON[_0x6f0c('0x10')](_0x1bc986));if(_0x1bc986[_0x6f0c('0x11')]){if(_0x1bc986['error'][_0x6f0c('0x12')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x166881,_0x1bc986[_0x6f0c('0x11')][_0x6f0c('0x13')]);return _0x367c79(_0x1bc986[_0x6f0c('0x11')][_0x6f0c('0x13')]);}logger[_0x6f0c('0x11')](_0x6f0c('0xd'),_0x166881,_0x1bc986[_0x6f0c('0x11')][_0x6f0c('0x13')]);return _0x24a14d(_0x1bc986['error'][_0x6f0c('0x13')]);}else{logger[_0x6f0c('0x14')](_0x6f0c('0xd'),_0x166881,_0x6f0c('0xe'));_0x24a14d(_0x1bc986['result']['message']);}})[_0x6f0c('0x15')](function(_0x5c0124){logger[_0x6f0c('0x11')](_0x6f0c('0xd'),_0x166881,_0x5c0124);_0x367c79(_0x5c0124);});});} \ No newline at end of file +var _0x4ff4=['error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57caf0,_0x1fe145){var _0x65d871=function(_0x56a92){while(--_0x56a92){_0x57caf0['push'](_0x57caf0['shift']());}};_0x65d871(++_0x1fe145);}(_0x4ff4,0x15b));var _0x44ff=function(_0x402731,_0x43c115){_0x402731=_0x402731-0x0;var _0x111736=_0x4ff4[_0x402731];return _0x111736;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x44ff('0x0'));var rs=require(_0x44ff('0x1'));var fs=require('fs');var Redis=require(_0x44ff('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x44ff('0x3'));var logger=require(_0x44ff('0x4'))(_0x44ff('0x5'));var config=require(_0x44ff('0x6'));var jayson=require(_0x44ff('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56a94e,_0x51050f,_0x2c6392){return new BPromise(function(_0x1fb239,_0x2ef574){return client[_0x44ff('0x8')](_0x56a94e,_0x2c6392)[_0x44ff('0x9')](function(_0x38e9fc){logger[_0x44ff('0xa')](_0x44ff('0xb'),_0x51050f,_0x44ff('0xc'));logger[_0x44ff('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x51050f,'request\x20sent',JSON['stringify'](_0x38e9fc));if(_0x38e9fc[_0x44ff('0xe')]){if(_0x38e9fc['error'][_0x44ff('0xf')]===0x1f4){logger['error'](_0x44ff('0xb'),_0x51050f,_0x38e9fc['error']['message']);return _0x2ef574(_0x38e9fc[_0x44ff('0xe')][_0x44ff('0x10')]);}logger[_0x44ff('0xe')](_0x44ff('0xb'),_0x51050f,_0x38e9fc[_0x44ff('0xe')]['message']);return _0x1fb239(_0x38e9fc['error']['message']);}else{logger['info'](_0x44ff('0xb'),_0x51050f,_0x44ff('0xc'));_0x1fb239(_0x38e9fc[_0x44ff('0x11')][_0x44ff('0x10')]);}})[_0x44ff('0x12')](function(_0x38ab38){logger[_0x44ff('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x51050f,_0x38ab38);_0x2ef574(_0x38ab38);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a6c6066..deb1fbf 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x300fc2,_0x340499){var _0x42057d=function(_0x2b1a90){while(--_0x2b1a90){_0x300fc2['push'](_0x300fc2['shift']());}};_0x42057d(++_0x340499);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3d8041,_0x2381d3){var _0x263c24=function(_0x2fa0ea){while(--_0x2fa0ea){_0x3d8041['push'](_0x3d8041['shift']());}};_0x263c24(++_0x2381d3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index fdc9773..2777aae 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 _0x1487=['queue_interface','STRING','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0x1487,0xf2));var _0x7148=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x1487[_0x5b64a1];return _0x4b6f55;};'use strict';var Sequelize=require('sequelize');module[_0x7148('0x0')]={'uniqueid':{'type':Sequelize[_0x7148('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7148('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x7148('0x2')},'UserId':{'type':Sequelize[_0x7148('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7148('0x3'),'comment':_0x7148('0x2')},'VoiceQueueId':{'type':Sequelize[_0x7148('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x7148('0x4')],'allowNull':![],'unique':_0x7148('0x3'),'comment':_0x7148('0x2')},'penalty':{'type':Sequelize[_0x7148('0x1')](0xb),'defaultValue':0x0,'comment':_0x7148('0x2')},'paused':{'type':Sequelize[_0x7148('0x1')](0xb),'defaultValue':0x0,'comment':_0x7148('0x2')}}; \ No newline at end of file +var _0x14d9=['Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','exports'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x14d9,0x1a3));var _0x914d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x914d('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x914d('0x1')},'membername':{'type':Sequelize[_0x914d('0x2')],'allowNull':![],'comment':_0x914d('0x1')},'UserId':{'type':Sequelize[_0x914d('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x914d('0x2')],'allowNull':![],'unique':_0x914d('0x4'),'comment':_0x914d('0x1')},'VoiceQueueId':{'type':Sequelize[_0x914d('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x914d('0x2')],'allowNull':![],'unique':_0x914d('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x914d('0x3')](0xb),'defaultValue':0x0,'comment':_0x914d('0x1')},'paused':{'type':Sequelize[_0x914d('0x3')](0xb),'defaultValue':0x0,'comment':_0x914d('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index fc2f82b..f09f003 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 _0xb66e=['hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb66e,0xb7));var _0xeb66=function(_0x4c74f4,_0x2f93c4){_0x4c74f4=_0x4c74f4-0x0;var _0x5aaee1=_0xb66e[_0x4c74f4];return _0x5aaee1;};'use strict';var EventEmitter=require(_0xeb66('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xeb66('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xeb66('0x2')](0x0);var events={'afterCreate':_0xeb66('0x3'),'afterUpdate':_0xeb66('0x4'),'afterDestroy':_0xeb66('0x5')};function emitEvent(_0x277e15){return function(_0x29aeb0,_0x210f5d,_0x1a5c7e){UserVoiceQueueRtEvents[_0xeb66('0x6')](_0x277e15+':'+_0x29aeb0['id'],_0x29aeb0);UserVoiceQueueRtEvents[_0xeb66('0x6')](_0x277e15,_0x29aeb0);_0x1a5c7e(null);};}for(var e in events){if(events[_0xeb66('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xeb66('0x8')](e,emitEvent(event));}}module[_0xeb66('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd996=['UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xd996,0x6c));var _0x6d99=function(_0x1213eb,_0x254d44){_0x1213eb=_0x1213eb-0x0;var _0x1cb4bb=_0xd996[_0x1213eb];return _0x1cb4bb;};'use strict';var EventEmitter=require(_0x6d99('0x0'));var UserVoiceQueueRt=require(_0x6d99('0x1'))['db'][_0x6d99('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6d99('0x3')](0x0);var events={'afterCreate':_0x6d99('0x4'),'afterUpdate':_0x6d99('0x5'),'afterDestroy':_0x6d99('0x6')};function emitEvent(_0x9c1781){return function(_0x48f175,_0x476f72,_0x5e6459){UserVoiceQueueRtEvents['emit'](_0x9c1781+':'+_0x48f175['id'],_0x48f175);UserVoiceQueueRtEvents[_0x6d99('0x7')](_0x9c1781,_0x48f175);_0x5e6459(null);};}for(var e in events){if(events[_0x6d99('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x6d99('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ed8a9ec..4b94339 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 _0x118b=['user_has_voice_queues_rt','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserVoiceQueueRt'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x118b,0x160));var _0xb118=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0x118b[_0x1aed80];return _0x43961e;};'use strict';var _=require(_0xb118('0x0'));var util=require(_0xb118('0x1'));var logger=require('../../config/logger')(_0xb118('0x2'));var moment=require(_0xb118('0x3'));var BPromise=require(_0xb118('0x4'));var rp=require(_0xb118('0x5'));var fs=require('fs');var path=require(_0xb118('0x6'));var rimraf=require(_0xb118('0x7'));var config=require(_0xb118('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xb118('0x9')]=function(_0x55ded1,_0x18c267){return _0x55ded1[_0xb118('0xa')](_0xb118('0xb'),attributes,{'tableName':_0xb118('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0548=['api','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','user_has_voice_queues_rt','lodash','../../config/logger'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x0548,0x166));var _0x8054=function(_0x44507f,_0x586a37){_0x44507f=_0x44507f-0x0;var _0x363232=_0x0548[_0x44507f];return _0x363232;};'use strict';var _=require(_0x8054('0x0'));var util=require('util');var logger=require(_0x8054('0x1'))(_0x8054('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8054('0x3'));var fs=require('fs');var path=require(_0x8054('0x4'));var rimraf=require(_0x8054('0x5'));var config=require(_0x8054('0x6'));var attributes=require(_0x8054('0x7'));module[_0x8054('0x8')]=function(_0x237daf,_0x4fab96){return _0x237daf['define']('UserVoiceQueueRt',attributes,{'tableName':_0x8054('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index dd08a1e..fc3fd31 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 _0xdced=['http','redis','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueRtPauses','findAll','options','raw','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4f9c8f,_0x3377ff){var _0x2ae065=function(_0x2953a5){while(--_0x2953a5){_0x4f9c8f['push'](_0x4f9c8f['shift']());}};_0x2ae065(++_0x3377ff);}(_0xdced,0xc2));var _0xddce=function(_0x5dd691,_0x18d0e8){_0x5dd691=_0x5dd691-0x0;var _0x47c1f5=_0xdced[_0x5dd691];return _0x47c1f5;};'use strict';var _=require('lodash');var util=require(_0xddce('0x0'));var moment=require(_0xddce('0x1'));var BPromise=require(_0xddce('0x2'));var rs=require(_0xddce('0x3'));var fs=require('fs');var Redis=require(_0xddce('0x4'));var db=require(_0xddce('0x5'))['db'];var utils=require(_0xddce('0x6'));var logger=require('../../config/logger')(_0xddce('0x7'));var config=require(_0xddce('0x8'));var jayson=require(_0xddce('0x9'));var client=jayson['client'][_0xddce('0xa')]({'port':0x232a});config[_0xddce('0xb')]=_['defaults'](config[_0xddce('0xb')],{'host':_0xddce('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xddce('0xd'))[_0xddce('0xe')](socket);function respondWithRpcPromise(_0x49fd8d,_0x6e74bd,_0x55abcd){return new BPromise(function(_0x1f5ed6,_0x3c4583){return client[_0xddce('0xf')](_0x49fd8d,_0x55abcd)[_0xddce('0x10')](function(_0x572a99){logger[_0xddce('0x11')](_0xddce('0x12'),_0x6e74bd,_0xddce('0x13'));logger[_0xddce('0x14')](_0xddce('0x15'),_0x6e74bd,_0xddce('0x13'),JSON[_0xddce('0x16')](_0x572a99));if(_0x572a99[_0xddce('0x17')]){if(_0x572a99[_0xddce('0x17')][_0xddce('0x18')]===0x1f4){logger[_0xddce('0x17')](_0xddce('0x12'),_0x6e74bd,_0x572a99[_0xddce('0x17')][_0xddce('0x19')]);return _0x3c4583(_0x572a99[_0xddce('0x17')][_0xddce('0x19')]);}logger[_0xddce('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x6e74bd,_0x572a99[_0xddce('0x17')][_0xddce('0x19')]);return _0x1f5ed6(_0x572a99[_0xddce('0x17')][_0xddce('0x19')]);}else{logger[_0xddce('0x11')](_0xddce('0x12'),_0x6e74bd,_0xddce('0x13'));_0x1f5ed6(_0x572a99['result'][_0xddce('0x19')]);}})[_0xddce('0x1a')](function(_0x1d966c){logger[_0xddce('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x6e74bd,_0x1d966c);_0x3c4583(_0x1d966c);});});}exports[_0xddce('0x1b')]=function(_0x5cbee4){var _0x4e79ab=this;return new Promise(function(_0x364603,_0x2f570c){return db['UserVoiceQueueRt'][_0xddce('0x1c')]({'raw':_0x5cbee4[_0xddce('0x1d')]?_0x5cbee4[_0xddce('0x1d')][_0xddce('0x1e')]===undefined?!![]:![]:!![],'where':_0x5cbee4[_0xddce('0x1d')]?_0x5cbee4[_0xddce('0x1d')]['where']||null:null,'attributes':[[db[_0xddce('0x1f')]['fn'](_0xddce('0x20'),db[_0xddce('0x1f')]['fn']('IF',db[_0xddce('0x1f')]['literal'](_0xddce('0x21')))),'outboundQueuePauses']]})[_0xddce('0x10')](function(_0x14c4b7){logger['info'](_0xddce('0x1b'),_0x5cbee4);logger[_0xddce('0x14')](_0xddce('0x1b'),_0x5cbee4,JSON[_0xddce('0x16')](_0x14c4b7));_0x364603(_0x14c4b7);})['catch'](function(_0x6c9eec){logger[_0xddce('0x17')]('GetVoiceQueueRtPauses',_0x6c9eec[_0xddce('0x19')],_0x5cbee4);_0x2f570c(_0x4e79ab[_0xddce('0x17')](0x1f4,_0x6c9eec[_0xddce('0x19')]));});});}; \ No newline at end of file +var _0xedeb=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize'];(function(_0x5afca6,_0x290b8e){var _0x454589=function(_0x503f78){while(--_0x503f78){_0x5afca6['push'](_0x5afca6['shift']());}};_0x454589(++_0x290b8e);}(_0xedeb,0x77));var _0xbede=function(_0x217cfd,_0x1e3094){_0x217cfd=_0x217cfd-0x0;var _0x1e887f=_0xedeb[_0x217cfd];return _0x1e887f;};'use strict';var _=require('lodash');var util=require(_0xbede('0x0'));var moment=require(_0xbede('0x1'));var BPromise=require(_0xbede('0x2'));var rs=require(_0xbede('0x3'));var fs=require('fs');var Redis=require(_0xbede('0x4'));var db=require(_0xbede('0x5'))['db'];var utils=require(_0xbede('0x6'));var logger=require(_0xbede('0x7'))(_0xbede('0x8'));var config=require(_0xbede('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbede('0xa')][_0xbede('0xb')]({'port':0x232a});config['redis']=_[_0xbede('0xc')](config[_0xbede('0xd')],{'host':_0xbede('0xe'),'port':0x18eb});var socket=require(_0xbede('0xf'))(new Redis(config[_0xbede('0xd')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x4d3e97,_0x351cce,_0x1ef844){return new BPromise(function(_0x44162a,_0x4aa6bc){return client['request'](_0x4d3e97,_0x1ef844)['then'](function(_0x251534){logger[_0xbede('0x10')](_0xbede('0x11'),_0x351cce,_0xbede('0x12'));logger[_0xbede('0x13')](_0xbede('0x14'),_0x351cce,'request\x20sent',JSON[_0xbede('0x15')](_0x251534));if(_0x251534[_0xbede('0x16')]){if(_0x251534[_0xbede('0x16')][_0xbede('0x17')]===0x1f4){logger['error'](_0xbede('0x11'),_0x351cce,_0x251534['error']['message']);return _0x4aa6bc(_0x251534[_0xbede('0x16')][_0xbede('0x18')]);}logger[_0xbede('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x351cce,_0x251534['error'][_0xbede('0x18')]);return _0x44162a(_0x251534[_0xbede('0x16')][_0xbede('0x18')]);}else{logger[_0xbede('0x10')](_0xbede('0x11'),_0x351cce,_0xbede('0x12'));_0x44162a(_0x251534[_0xbede('0x19')][_0xbede('0x18')]);}})[_0xbede('0x1a')](function(_0x500629){logger['error'](_0xbede('0x11'),_0x351cce,_0x500629);_0x4aa6bc(_0x500629);});});}exports['GetVoiceQueueRtPauses']=function(_0x214f8d){var _0x1d6d5d=this;return new Promise(function(_0x6ea8b4,_0x1971f6){return db[_0xbede('0x1b')][_0xbede('0x1c')]({'raw':_0x214f8d['options']?_0x214f8d[_0xbede('0x1d')][_0xbede('0x1e')]===undefined?!![]:![]:!![],'where':_0x214f8d[_0xbede('0x1d')]?_0x214f8d[_0xbede('0x1d')][_0xbede('0x1f')]||null:null,'attributes':[[db[_0xbede('0x20')]['fn'](_0xbede('0x21'),db[_0xbede('0x20')]['fn']('IF',db[_0xbede('0x20')][_0xbede('0x22')](_0xbede('0x23')))),_0xbede('0x24')]]})['then'](function(_0x1e8904){logger[_0xbede('0x10')]('GetVoiceQueueRtPauses',_0x214f8d);logger[_0xbede('0x13')](_0xbede('0x25'),_0x214f8d,JSON[_0xbede('0x15')](_0x1e8904));_0x6ea8b4(_0x1e8904);})[_0xbede('0x1a')](function(_0x5e3c05){logger[_0xbede('0x16')](_0xbede('0x25'),_0x5e3c05[_0xbede('0x18')],_0x214f8d);_0x1971f6(_0x1d6d5d[_0xbede('0x16')](0x1f4,_0x5e3c05[_0xbede('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index f700efe..1ce7320 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 _0x6f44=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','emit','removeListener','register'];(function(_0x493503,_0x5a542d){var _0x41b08c=function(_0x2d8a8e){while(--_0x2d8a8e){_0x493503['push'](_0x493503['shift']());}};_0x41b08c(++_0x5a542d);}(_0x6f44,0x1ea));var _0x46f4=function(_0x5d33f2,_0x223a37){_0x5d33f2=_0x5d33f2-0x0;var _0x130408=_0x6f44[_0x5d33f2];return _0x130408;};'use strict';var UserVoiceQueueRtEvents=require(_0x46f4('0x0'));var events=[_0x46f4('0x1'),'remove',_0x46f4('0x2')];function createListener(_0x4640f1,_0x24421f){return function(_0x46388d){_0x24421f[_0x46f4('0x3')](_0x4640f1,_0x46388d);};}function removeListener(_0x1e2554,_0x26f749){return function(){UserVoiceQueueRtEvents[_0x46f4('0x4')](_0x1e2554,_0x26f749);};}exports[_0x46f4('0x5')]=function(_0x57f1a9){for(var _0x169a5a=0x0,_0x2a50b1=events[_0x46f4('0x6')];_0x169a5a<_0x2a50b1;_0x169a5a++){var _0x4b791c=events[_0x169a5a];var _0x5ce344=createListener(_0x46f4('0x7')+_0x4b791c,_0x57f1a9);UserVoiceQueueRtEvents['on'](_0x4b791c,_0x5ce344);}}; \ No newline at end of file +var _0xd7ce=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7ce,0x16b));var _0xed7c=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xd7ce[_0x374ada];return _0x449ed8;};'use strict';var UserVoiceQueueRtEvents=require(_0xed7c('0x0'));var events=[_0xed7c('0x1'),_0xed7c('0x2'),_0xed7c('0x3')];function createListener(_0x4ce2a9,_0x4fe5c1){return function(_0x1230ec){_0x4fe5c1['emit'](_0x4ce2a9,_0x1230ec);};}function removeListener(_0x4a6138,_0x587c5a){return function(){UserVoiceQueueRtEvents[_0xed7c('0x4')](_0x4a6138,_0x587c5a);};}exports[_0xed7c('0x5')]=function(_0x194d4b){for(var _0x1aa7a0=0x0,_0x34bbd7=events[_0xed7c('0x6')];_0x1aa7a0<_0x34bbd7;_0x1aa7a0++){var _0x41afb9=events[_0x1aa7a0];var _0x270db6=createListener(_0xed7c('0x7')+_0x41afb9,_0x194d4b);UserVoiceQueueRtEvents['on'](_0x41afb9,_0x270db6);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 80608b7..d953397 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x46ed01,_0x5af9e6){var _0x809d68=function(_0x43c8b8){while(--_0x43c8b8){_0x46ed01['push'](_0x46ed01['shift']());}};_0x809d68(++_0x5af9e6);}(_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(_0x5346fe,_0x2f9e23){var _0x3018b3=function(_0xcfdc2){while(--_0xcfdc2){_0x5346fe['push'](_0x5346fe['shift']());}};_0x3018b3(++_0x2f9e23);}(_0x70e0,0x17b));var _0x070e=function(_0x466668,_0x2bfde1){_0x466668=_0x466668-0x0;var _0x34a44c=_0x70e0[_0x466668];return _0x34a44c;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a93461a..9c4386d 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 _0xfa11=['sequelize','exports','INTEGER'];(function(_0x3124e9,_0x5d8557){var _0x2b7378=function(_0x3db618){while(--_0x3db618){_0x3124e9['push'](_0x3124e9['shift']());}};_0x2b7378(++_0x5d8557);}(_0xfa11,0xba));var _0x1fa1=function(_0x48e95a,_0x2f121a){_0x48e95a=_0x48e95a-0x0;var _0x13e73f=_0xfa11[_0x48e95a];return _0x13e73f;};'use strict';var Sequelize=require(_0x1fa1('0x0'));module[_0x1fa1('0x1')]={'penalty':{'type':Sequelize[_0x1fa1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc8e8=['exports','INTEGER','sequelize'];(function(_0x4ed4f3,_0x160bf5){var _0x1af90d=function(_0x3e0c57){while(--_0x3e0c57){_0x4ed4f3['push'](_0x4ed4f3['shift']());}};_0x1af90d(++_0x160bf5);}(_0xc8e8,0x173));var _0x8c8e=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0xc8e8[_0x15876a];return _0xbd900f;};'use strict';var Sequelize=require(_0x8c8e('0x0'));module[_0x8c8e('0x1')]={'penalty':{'type':Sequelize[_0x8c8e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 25ce4a8..ac37695 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 _0x640c=['request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','util','../../config/logger','moment'];(function(_0x290241,_0xa01360){var _0x533015=function(_0x548f65){while(--_0x548f65){_0x290241['push'](_0x290241['shift']());}};_0x533015(++_0xa01360);}(_0x640c,0x6b));var _0xc640=function(_0x1abb11,_0xd68915){_0x1abb11=_0x1abb11-0x0;var _0x149a9f=_0x640c[_0x1abb11];return _0x149a9f;};'use strict';var _=require('lodash');var util=require(_0xc640('0x0'));var logger=require(_0xc640('0x1'))('api');var moment=require(_0xc640('0x2'));var BPromise=require('bluebird');var rp=require(_0xc640('0x3'));var fs=require('fs');var path=require(_0xc640('0x4'));var rimraf=require(_0xc640('0x5'));var config=require(_0xc640('0x6'));var attributes=require(_0xc640('0x7'));module[_0xc640('0x8')]=function(_0x13ddf5,_0x38d0ac){return _0x13ddf5[_0xc640('0x9')]('UserWhatsappQueue',attributes,{'tableName':_0xc640('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3ab=['request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','api','bluebird'];(function(_0x267f04,_0x18005d){var _0x324621=function(_0x3ef6a9){while(--_0x3ef6a9){_0x267f04['push'](_0x267f04['shift']());}};_0x324621(++_0x18005d);}(_0xa3ab,0xb0));var _0xba3a=function(_0x26c122,_0x407ce7){_0x26c122=_0x26c122-0x0;var _0xd52043=_0xa3ab[_0x26c122];return _0xd52043;};'use strict';var _=require(_0xba3a('0x0'));var util=require(_0xba3a('0x1'));var logger=require('../../config/logger')(_0xba3a('0x2'));var moment=require('moment');var BPromise=require(_0xba3a('0x3'));var rp=require(_0xba3a('0x4'));var fs=require('fs');var path=require(_0xba3a('0x5'));var rimraf=require(_0xba3a('0x6'));var config=require(_0xba3a('0x7'));var attributes=require(_0xba3a('0x8'));module[_0xba3a('0x9')]=function(_0x418ed9,_0x270a72){return _0x418ed9[_0xba3a('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0xba3a('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 77d61f0..34d5a34 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 _0xd221=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4bd90d,_0x32001b){var _0x3948ed=function(_0x32eaf9){while(--_0x32eaf9){_0x4bd90d['push'](_0x4bd90d['shift']());}};_0x3948ed(++_0x32001b);}(_0xd221,0x17a));var _0x1d22=function(_0x3400d0,_0x15e219){_0x3400d0=_0x3400d0-0x0;var _0x89d4a9=_0xd221[_0x3400d0];return _0x89d4a9;};'use strict';var _=require(_0x1d22('0x0'));var util=require(_0x1d22('0x1'));var moment=require(_0x1d22('0x2'));var BPromise=require(_0x1d22('0x3'));var rs=require(_0x1d22('0x4'));var fs=require('fs');var Redis=require(_0x1d22('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d22('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1d22('0x7'));var jayson=require(_0x1d22('0x8'));var client=jayson[_0x1d22('0x9')][_0x1d22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a7cfd,_0x17a77d,_0x48a368){return new BPromise(function(_0x1d410d,_0x111b8d){return client[_0x1d22('0xb')](_0x1a7cfd,_0x48a368)['then'](function(_0x437d78){logger['info'](_0x1d22('0xc'),_0x17a77d,_0x1d22('0xd'));logger[_0x1d22('0xe')](_0x1d22('0xf'),_0x17a77d,'request\x20sent',JSON[_0x1d22('0x10')](_0x437d78));if(_0x437d78[_0x1d22('0x11')]){if(_0x437d78[_0x1d22('0x11')][_0x1d22('0x12')]===0x1f4){logger[_0x1d22('0x11')](_0x1d22('0xc'),_0x17a77d,_0x437d78[_0x1d22('0x11')]['message']);return _0x111b8d(_0x437d78[_0x1d22('0x11')][_0x1d22('0x13')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x17a77d,_0x437d78['error'][_0x1d22('0x13')]);return _0x1d410d(_0x437d78[_0x1d22('0x11')][_0x1d22('0x13')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x17a77d,'request\x20sent');_0x1d410d(_0x437d78[_0x1d22('0x14')][_0x1d22('0x13')]);}})['catch'](function(_0x221f71){logger[_0x1d22('0x11')](_0x1d22('0xc'),_0x17a77d,_0x221f71);_0x111b8d(_0x221f71);});});} \ No newline at end of file +var _0x5018=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment'];(function(_0x2f0a29,_0x4ab128){var _0x41fce4=function(_0x3386bf){while(--_0x3386bf){_0x2f0a29['push'](_0x2f0a29['shift']());}};_0x41fce4(++_0x4ab128);}(_0x5018,0xb2));var _0x8501=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x5018[_0x158da6];return _0x429c30;};'use strict';var _=require(_0x8501('0x0'));var util=require('util');var moment=require(_0x8501('0x1'));var BPromise=require(_0x8501('0x2'));var rs=require(_0x8501('0x3'));var fs=require('fs');var Redis=require(_0x8501('0x4'));var db=require(_0x8501('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8501('0x6'));var config=require(_0x8501('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8501('0x8')][_0x8501('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3063aa,_0x4f3cac,_0x3c916d){return new BPromise(function(_0x46ba20,_0x55d300){return client[_0x8501('0xa')](_0x3063aa,_0x3c916d)[_0x8501('0xb')](function(_0x1698f2){logger[_0x8501('0xc')](_0x8501('0xd'),_0x4f3cac,_0x8501('0xe'));logger['debug'](_0x8501('0xf'),_0x4f3cac,'request\x20sent',JSON[_0x8501('0x10')](_0x1698f2));if(_0x1698f2[_0x8501('0x11')]){if(_0x1698f2[_0x8501('0x11')]['code']===0x1f4){logger[_0x8501('0x11')](_0x8501('0xd'),_0x4f3cac,_0x1698f2[_0x8501('0x11')][_0x8501('0x12')]);return _0x55d300(_0x1698f2['error'][_0x8501('0x12')]);}logger[_0x8501('0x11')](_0x8501('0xd'),_0x4f3cac,_0x1698f2[_0x8501('0x11')][_0x8501('0x12')]);return _0x46ba20(_0x1698f2[_0x8501('0x11')][_0x8501('0x12')]);}else{logger['info'](_0x8501('0xd'),_0x4f3cac,_0x8501('0xe'));_0x46ba20(_0x1698f2[_0x8501('0x13')][_0x8501('0x12')]);}})['catch'](function(_0x417369){logger[_0x8501('0x11')](_0x8501('0xd'),_0x4f3cac,_0x417369);_0x55d300(_0x417369);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 30c64aa..19023a8 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 _0xd737=['express','Router','fs-extra','../../config/environment','isAuthenticated','index','get','/:id','show','post','delete','destroy','exports','multer','path'];(function(_0x56afa1,_0x4dafab){var _0x27a206=function(_0xcda7c6){while(--_0xcda7c6){_0x56afa1['push'](_0x56afa1['shift']());}};_0x27a206(++_0x4dafab);}(_0xd737,0x85));var _0x7d73=function(_0x2e5a8c,_0x35f4bf){_0x2e5a8c=_0x2e5a8c-0x0;var _0x5816ec=_0xd737[_0x2e5a8c];return _0x5816ec;};'use strict';var multer=require(_0x7d73('0x0'));var util=require('util');var path=require(_0x7d73('0x1'));var timeout=require('connect-timeout');var express=require(_0x7d73('0x2'));var router=express[_0x7d73('0x3')]();var fs_extra=require(_0x7d73('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7d73('0x5'));var controller=require('./variable.controller');router['get']('/',auth[_0x7d73('0x6')](),controller[_0x7d73('0x7')]);router[_0x7d73('0x8')](_0x7d73('0x9'),auth[_0x7d73('0x6')](),controller[_0x7d73('0xa')]);router[_0x7d73('0xb')]('/',auth[_0x7d73('0x6')](),controller['create']);router['put'](_0x7d73('0x9'),auth[_0x7d73('0x6')](),controller['update']);router[_0x7d73('0xc')]('/:id',auth[_0x7d73('0x6')](),controller[_0x7d73('0xd')]);module[_0x7d73('0xe')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x2378bc,_0x122c03){var _0x1980ef=function(_0x5c83cb){while(--_0x5c83cb){_0x2378bc['push'](_0x2378bc['shift']());}};_0x1980ef(++_0x122c03);}(_0x008c,0x188));var _0xc008=function(_0x1d7973,_0x357676){_0x1d7973=_0x1d7973-0x0;var _0x43190c=_0x008c[_0x1d7973];return _0x43190c;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index b564752..da66b8e 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 _0x47cf=['STRING','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x47cf,0x189));var _0xf47c=function(_0x1ae470,_0x3811b5){_0x1ae470=_0x1ae470-0x0;var _0x1207e9=_0x47cf[_0x1ae470];return _0x1207e9;};'use strict';var Sequelize=require('sequelize');module[_0xf47c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf47c('0x1')]}}; \ No newline at end of file +var _0x3d11=['name','sequelize','exports','STRING'];(function(_0x5bcd3d,_0x2fb1c5){var _0x439f54=function(_0x3451bd){while(--_0x3451bd){_0x5bcd3d['push'](_0x5bcd3d['shift']());}};_0x439f54(++_0x2fb1c5);}(_0x3d11,0x105));var _0x13d1=function(_0x51e943,_0x16e9c4){_0x51e943=_0x51e943-0x0;var _0x3fa027=_0x3d11[_0x51e943];return _0x3fa027;};'use strict';var Sequelize=require(_0x13d1('0x0'));module[_0x13d1('0x1')]={'name':{'type':Sequelize[_0x13d1('0x2')],'unique':_0x13d1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x13d1('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index cb90333..d614e8f 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 _0xd812=['options','Variable','includeAll','include','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','Variables','error','stack','name','index','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','map','VIRTUAL','merge'];(function(_0x229069,_0x5b101a){var _0x5bfbed=function(_0xe1eef8){while(--_0xe1eef8){_0x229069['push'](_0x229069['shift']());}};_0x5bfbed(++_0x5b101a);}(_0xd812,0x1b9));var _0x2d81=function(_0x23a079,_0xb8c9aa){_0x23a079=_0x23a079-0x0;var _0x53f2a5=_0xd812[_0x23a079];return _0x53f2a5;};'use strict';var emlformat=require(_0x2d81('0x0'));var rimraf=require(_0x2d81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d81('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2d81('0x3'));var Mustache=require(_0x2d81('0x4'));var util=require(_0x2d81('0x5'));var path=require('path');var sox=require(_0x2d81('0x6'));var csv=require(_0x2d81('0x7'));var ejs=require(_0x2d81('0x8'));var fs=require('fs');var fs_extra=require(_0x2d81('0x9'));var _=require('lodash');var squel=require(_0x2d81('0xa'));var crypto=require(_0x2d81('0xb'));var jsforce=require(_0x2d81('0xc'));var deskjs=require(_0x2d81('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2d81('0xe'));var Redis=require('ioredis');var authService=require(_0x2d81('0xf'));var qs=require(_0x2d81('0x10'));var as=require(_0x2d81('0x11'));var hardwareService=require(_0x2d81('0x12'));var logger=require(_0x2d81('0x13'))(_0x2d81('0x14'));var utils=require(_0x2d81('0x15'));var config=require(_0x2d81('0x16'));var licenseUtil=require(_0x2d81('0x17'));var db=require(_0x2d81('0x18'))['db'];function respondWithStatusCode(_0x41d965,_0x1b610f){_0x1b610f=_0x1b610f||0xcc;return function(_0x237493){if(_0x237493){return _0x41d965[_0x2d81('0x19')](_0x1b610f);}return _0x41d965[_0x2d81('0x1a')](_0x1b610f)[_0x2d81('0x1b')]();};}function respondWithResult(_0x2c3f78,_0x18a42a){_0x18a42a=_0x18a42a||0xc8;return function(_0xa9d93d){if(_0xa9d93d){return _0x2c3f78['status'](_0x18a42a)[_0x2d81('0x1c')](_0xa9d93d);}};}function respondWithFilteredResult(_0x3902df,_0x50acb1){return function(_0x49f2bd){if(_0x49f2bd){var _0x5b75e2=typeof _0x50acb1[_0x2d81('0x1d')]==='undefined'&&typeof _0x50acb1[_0x2d81('0x1e')]===_0x2d81('0x1f');var _0x3fa8c6=_0x49f2bd['count'];var _0x58643f=_0x5b75e2?0x0:_0x50acb1[_0x2d81('0x1d')];var _0x2c9996=_0x5b75e2?_0x49f2bd[_0x2d81('0x20')]:_0x50acb1[_0x2d81('0x1d')]+_0x50acb1[_0x2d81('0x1e')];var _0x3dd218;if(_0x2c9996>=_0x3fa8c6){_0x2c9996=_0x3fa8c6;_0x3dd218=0xc8;}else{_0x3dd218=0xce;}_0x3902df[_0x2d81('0x1a')](_0x3dd218);return _0x3902df['set'](_0x2d81('0x21'),_0x58643f+'-'+_0x2c9996+'/'+_0x3fa8c6)[_0x2d81('0x1c')](_0x49f2bd);}return null;};}function patchUpdates(_0x16c4cd){return function(_0x4eaf0b){try{jsonpatch[_0x2d81('0x22')](_0x4eaf0b,_0x16c4cd,!![]);}catch(_0x1d13e6){return BPromise[_0x2d81('0x23')](_0x1d13e6);}return _0x4eaf0b[_0x2d81('0x24')]();};}function saveUpdates(_0x2900c9,_0x3dad87){return function(_0x38e64a){if(_0x38e64a){return _0x38e64a[_0x2d81('0x25')](_0x2900c9)['then'](function(_0x410dfa){return _0x410dfa;});}return null;};}function removeEntity(_0x20398b,_0x254624){return function(_0x2bb450){if(_0x2bb450){return _0x2bb450['destroy']()[_0x2d81('0x26')](function(){var _0x4f49fd=_0x2bb450['get']({'plain':!![]});var _0x48d1a2=_0x2d81('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x48d1a2,'resourceId':_0x4f49fd['id']}})[_0x2d81('0x26')](function(){return _0x2bb450;});})['then'](function(){_0x20398b[_0x2d81('0x1a')](0xcc)[_0x2d81('0x1b')]();});}};}function handleEntityNotFound(_0x41e266,_0x5a2ef2){return function(_0x4080b5){if(!_0x4080b5){_0x41e266[_0x2d81('0x19')](0x194);}return _0x4080b5;};}function handleError(_0x53bdc5,_0x3cab25){_0x3cab25=_0x3cab25||0x1f4;return function(_0x4b31a1){logger[_0x2d81('0x28')](_0x4b31a1[_0x2d81('0x29')]);if(_0x4b31a1[_0x2d81('0x2a')]){delete _0x4b31a1['name'];}_0x53bdc5['status'](_0x3cab25)['send'](_0x4b31a1);};}exports[_0x2d81('0x2b')]=function(_0x4073ee,_0x572f45){var _0x67cfd3={},_0x308b6a={},_0x49f88f={'count':0x0,'rows':[]};var _0x4c057b=_['map'](db['Variable'][_0x2d81('0x2c')],function(_0x114605){return{'name':_0x114605['fieldName'],'type':_0x114605[_0x2d81('0x2d')][_0x2d81('0x2e')]};});_0x308b6a[_0x2d81('0x2f')]=_['map'](_0x4c057b,_0x2d81('0x2a'));_0x308b6a[_0x2d81('0x30')]=_[_0x2d81('0x31')](_0x4073ee['query']);_0x308b6a[_0x2d81('0x32')]=_['intersection'](_0x308b6a['model'],_0x308b6a[_0x2d81('0x30')]);_0x67cfd3[_0x2d81('0x33')]=_[_0x2d81('0x34')](_0x308b6a[_0x2d81('0x2f')],qs[_0x2d81('0x35')](_0x4073ee[_0x2d81('0x30')][_0x2d81('0x35')]));_0x67cfd3['attributes']=_0x67cfd3[_0x2d81('0x33')]['length']?_0x67cfd3[_0x2d81('0x33')]:_0x308b6a[_0x2d81('0x2f')];if(!_0x4073ee[_0x2d81('0x30')][_0x2d81('0x36')](_0x2d81('0x37'))){_0x67cfd3[_0x2d81('0x1e')]=qs[_0x2d81('0x1e')](_0x4073ee[_0x2d81('0x30')][_0x2d81('0x1e')]);_0x67cfd3['offset']=qs[_0x2d81('0x1d')](_0x4073ee[_0x2d81('0x30')][_0x2d81('0x1d')]);}_0x67cfd3[_0x2d81('0x38')]=qs[_0x2d81('0x39')](_0x4073ee['query'][_0x2d81('0x39')]);_0x67cfd3['where']=qs[_0x2d81('0x32')](_['pick'](_0x4073ee[_0x2d81('0x30')],_0x308b6a[_0x2d81('0x32')]),_0x4c057b);if(_0x4073ee['query'][_0x2d81('0x3a')]){_0x67cfd3[_0x2d81('0x3b')]=_['merge'](_0x67cfd3[_0x2d81('0x3b')],{'$or':_[_0x2d81('0x3c')](_0x4c057b,function(_0x42966d){if(_0x42966d[_0x2d81('0x2d')]!==_0x2d81('0x3d')){var _0x52e5ef={};_0x52e5ef[_0x42966d[_0x2d81('0x2a')]]={'$like':'%'+_0x4073ee[_0x2d81('0x30')][_0x2d81('0x3a')]+'%'};return _0x52e5ef;}})});}_0x67cfd3=_[_0x2d81('0x3e')]({},_0x67cfd3,_0x4073ee[_0x2d81('0x3f')]);var _0x51a319={'where':_0x67cfd3['where']};return db[_0x2d81('0x40')][_0x2d81('0x20')](_0x51a319)['then'](function(_0x275a1d){_0x49f88f[_0x2d81('0x20')]=_0x275a1d;if(_0x4073ee[_0x2d81('0x30')][_0x2d81('0x41')]){_0x67cfd3[_0x2d81('0x42')]=[{'all':!![]}];}return db[_0x2d81('0x40')]['findAll'](_0x67cfd3);})[_0x2d81('0x26')](function(_0x4e728a){_0x49f88f[_0x2d81('0x43')]=_0x4e728a;return _0x49f88f;})['then'](respondWithFilteredResult(_0x572f45,_0x67cfd3))[_0x2d81('0x44')](handleError(_0x572f45,null));};exports[_0x2d81('0x45')]=function(_0x163643,_0x431393){var _0x4a6f68={'raw':!![],'where':{'id':_0x163643[_0x2d81('0x46')]['id']}},_0x38e9aa={};_0x38e9aa['model']=_[_0x2d81('0x31')](db[_0x2d81('0x40')][_0x2d81('0x2c')]);_0x38e9aa[_0x2d81('0x30')]=_['keys'](_0x163643[_0x2d81('0x30')]);_0x38e9aa[_0x2d81('0x32')]=_[_0x2d81('0x34')](_0x38e9aa['model'],_0x38e9aa[_0x2d81('0x30')]);_0x4a6f68[_0x2d81('0x33')]=_[_0x2d81('0x34')](_0x38e9aa[_0x2d81('0x2f')],qs[_0x2d81('0x35')](_0x163643[_0x2d81('0x30')]['fields']));_0x4a6f68['attributes']=_0x4a6f68[_0x2d81('0x33')][_0x2d81('0x47')]?_0x4a6f68['attributes']:_0x38e9aa[_0x2d81('0x2f')];if(_0x163643['query'][_0x2d81('0x41')]){_0x4a6f68['include']=[{'all':!![]}];}_0x4a6f68=_[_0x2d81('0x3e')]({},_0x4a6f68,_0x163643[_0x2d81('0x3f')]);return db['Variable'][_0x2d81('0x48')](_0x4a6f68)['then'](handleEntityNotFound(_0x431393,null))[_0x2d81('0x26')](respondWithResult(_0x431393,null))['catch'](handleError(_0x431393,null));};exports['create']=function(_0x3cd92d,_0x272af6){return db[_0x2d81('0x40')][_0x2d81('0x49')](_0x3cd92d['body'],{})[_0x2d81('0x26')](function(_0x21ad7a){var _0x26fbba=_0x3cd92d[_0x2d81('0x4a')]['get']({'plain':!![]});if(!_0x26fbba)throw new Error(_0x2d81('0x4b'));if(_0x26fbba[_0x2d81('0x4c')]===_0x2d81('0x4a')){var _0x329a52=_0x21ad7a[_0x2d81('0x4d')]({'plain':!![]});var _0x5f3d17=_0x2d81('0x27');return db[_0x2d81('0x4e')][_0x2d81('0x48')]({'where':{'name':_0x5f3d17,'userProfileId':_0x26fbba[_0x2d81('0x4f')]},'raw':!![]})['then'](function(_0x74cba3){if(_0x74cba3&&_0x74cba3[_0x2d81('0x50')]===0x0){return db[_0x2d81('0x51')][_0x2d81('0x49')]({'name':_0x329a52[_0x2d81('0x2a')],'resourceId':_0x329a52['id'],'type':_0x74cba3[_0x2d81('0x2a')],'sectionId':_0x74cba3['id']},{})[_0x2d81('0x26')](function(){return _0x21ad7a;});}else{return _0x21ad7a;}})[_0x2d81('0x44')](function(_0x4e986b){logger[_0x2d81('0x28')](_0x2d81('0x52'),_0x4e986b);throw _0x4e986b;});}return _0x21ad7a;})[_0x2d81('0x26')](respondWithResult(_0x272af6,0xc9))[_0x2d81('0x44')](handleError(_0x272af6,null));};exports[_0x2d81('0x25')]=function(_0x1b5849,_0x422c40){if(_0x1b5849['body']['id']){delete _0x1b5849[_0x2d81('0x53')]['id'];}return db[_0x2d81('0x40')]['find']({'where':{'id':_0x1b5849[_0x2d81('0x46')]['id']}})[_0x2d81('0x26')](handleEntityNotFound(_0x422c40,null))[_0x2d81('0x26')](saveUpdates(_0x1b5849[_0x2d81('0x53')],null))[_0x2d81('0x26')](respondWithResult(_0x422c40,null))['catch'](handleError(_0x422c40,null));};exports['destroy']=function(_0xa66747,_0x5ee1e9){return db[_0x2d81('0x40')][_0x2d81('0x48')]({'where':{'id':_0xa66747['params']['id']}})[_0x2d81('0x26')](handleEntityNotFound(_0x5ee1e9,null))[_0x2d81('0x26')](removeEntity(_0x5ee1e9,null))[_0x2d81('0x44')](handleError(_0x5ee1e9,null));}; \ No newline at end of file +var _0x0a83=['send','index','map','Variable','rawAttributes','fieldName','type','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','save','update','destroy','then','get','Variables','UserProfileResource','end','stack','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a83,0x177));var _0x30a8=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0x0a83[_0x44216d];return _0xeca523;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30a8('0x0'));var zipdir=require(_0x30a8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30a8('0x2'));var moment=require(_0x30a8('0x3'));var BPromise=require(_0x30a8('0x4'));var Mustache=require(_0x30a8('0x5'));var util=require(_0x30a8('0x6'));var path=require(_0x30a8('0x7'));var sox=require(_0x30a8('0x8'));var csv=require(_0x30a8('0x9'));var ejs=require(_0x30a8('0xa'));var fs=require('fs');var fs_extra=require(_0x30a8('0xb'));var _=require(_0x30a8('0xc'));var squel=require(_0x30a8('0xd'));var crypto=require('crypto');var jsforce=require(_0x30a8('0xe'));var deskjs=require(_0x30a8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x30a8('0x10'));var Papa=require(_0x30a8('0x11'));var Redis=require(_0x30a8('0x12'));var authService=require(_0x30a8('0x13'));var qs=require(_0x30a8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30a8('0x15'));var logger=require('../../config/logger')(_0x30a8('0x16'));var utils=require(_0x30a8('0x17'));var config=require(_0x30a8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x30a8('0x19'))['db'];function respondWithStatusCode(_0x59a86b,_0x39b4b9){_0x39b4b9=_0x39b4b9||0xcc;return function(_0x15f25d){if(_0x15f25d){return _0x59a86b[_0x30a8('0x1a')](_0x39b4b9);}return _0x59a86b[_0x30a8('0x1b')](_0x39b4b9)['end']();};}function respondWithResult(_0x704cb9,_0x3e0d12){_0x3e0d12=_0x3e0d12||0xc8;return function(_0x2e5fdb){if(_0x2e5fdb){return _0x704cb9[_0x30a8('0x1b')](_0x3e0d12)['json'](_0x2e5fdb);}};}function respondWithFilteredResult(_0x1c60a3,_0x148f27){return function(_0xecad20){if(_0xecad20){var _0x2250dd=typeof _0x148f27[_0x30a8('0x1c')]===_0x30a8('0x1d')&&typeof _0x148f27[_0x30a8('0x1e')]===_0x30a8('0x1d');var _0x366080=_0xecad20[_0x30a8('0x1f')];var _0x1c98d0=_0x2250dd?0x0:_0x148f27[_0x30a8('0x1c')];var _0x261316=_0x2250dd?_0xecad20[_0x30a8('0x1f')]:_0x148f27[_0x30a8('0x1c')]+_0x148f27[_0x30a8('0x1e')];var _0xea25ed;if(_0x261316>=_0x366080){_0x261316=_0x366080;_0xea25ed=0xc8;}else{_0xea25ed=0xce;}_0x1c60a3[_0x30a8('0x1b')](_0xea25ed);return _0x1c60a3[_0x30a8('0x20')]('Content-Range',_0x1c98d0+'-'+_0x261316+'/'+_0x366080)[_0x30a8('0x21')](_0xecad20);}return null;};}function patchUpdates(_0x369063){return function(_0xa3bcad){try{jsonpatch[_0x30a8('0x22')](_0xa3bcad,_0x369063,!![]);}catch(_0x3a0824){return BPromise['reject'](_0x3a0824);}return _0xa3bcad[_0x30a8('0x23')]();};}function saveUpdates(_0x4ba30e,_0x543da1){return function(_0xf99cb4){if(_0xf99cb4){return _0xf99cb4[_0x30a8('0x24')](_0x4ba30e)['then'](function(_0x2a2301){return _0x2a2301;});}return null;};}function removeEntity(_0x5c0eed,_0x5a1421){return function(_0x5eb652){if(_0x5eb652){return _0x5eb652[_0x30a8('0x25')]()[_0x30a8('0x26')](function(){var _0x1f67f1=_0x5eb652[_0x30a8('0x27')]({'plain':!![]});var _0x37ebb5=_0x30a8('0x28');return db[_0x30a8('0x29')][_0x30a8('0x25')]({'where':{'type':_0x37ebb5,'resourceId':_0x1f67f1['id']}})[_0x30a8('0x26')](function(){return _0x5eb652;});})[_0x30a8('0x26')](function(){_0x5c0eed[_0x30a8('0x1b')](0xcc)[_0x30a8('0x2a')]();});}};}function handleEntityNotFound(_0x4365a7,_0x32ff42){return function(_0xf4c95f){if(!_0xf4c95f){_0x4365a7['sendStatus'](0x194);}return _0xf4c95f;};}function handleError(_0x1b7c00,_0x446830){_0x446830=_0x446830||0x1f4;return function(_0x16dffb){logger['error'](_0x16dffb[_0x30a8('0x2b')]);if(_0x16dffb[_0x30a8('0x2c')]){delete _0x16dffb['name'];}_0x1b7c00[_0x30a8('0x1b')](_0x446830)[_0x30a8('0x2d')](_0x16dffb);};}exports[_0x30a8('0x2e')]=function(_0x24f7a1,_0x48da2a){var _0x41024c={},_0x1e5fe6={},_0x5b10d7={'count':0x0,'rows':[]};var _0x43e254=_[_0x30a8('0x2f')](db[_0x30a8('0x30')][_0x30a8('0x31')],function(_0xae0d04){return{'name':_0xae0d04[_0x30a8('0x32')],'type':_0xae0d04[_0x30a8('0x33')]['key']};});_0x1e5fe6[_0x30a8('0x34')]=_[_0x30a8('0x2f')](_0x43e254,'name');_0x1e5fe6['query']=_[_0x30a8('0x35')](_0x24f7a1['query']);_0x1e5fe6['filters']=_[_0x30a8('0x36')](_0x1e5fe6[_0x30a8('0x34')],_0x1e5fe6['query']);_0x41024c[_0x30a8('0x37')]=_[_0x30a8('0x36')](_0x1e5fe6['model'],qs[_0x30a8('0x38')](_0x24f7a1[_0x30a8('0x39')][_0x30a8('0x38')]));_0x41024c[_0x30a8('0x37')]=_0x41024c['attributes'][_0x30a8('0x3a')]?_0x41024c[_0x30a8('0x37')]:_0x1e5fe6[_0x30a8('0x34')];if(!_0x24f7a1[_0x30a8('0x39')][_0x30a8('0x3b')](_0x30a8('0x3c'))){_0x41024c[_0x30a8('0x1e')]=qs[_0x30a8('0x1e')](_0x24f7a1['query']['limit']);_0x41024c[_0x30a8('0x1c')]=qs[_0x30a8('0x1c')](_0x24f7a1[_0x30a8('0x39')][_0x30a8('0x1c')]);}_0x41024c[_0x30a8('0x3d')]=qs[_0x30a8('0x3e')](_0x24f7a1[_0x30a8('0x39')]['sort']);_0x41024c['where']=qs[_0x30a8('0x3f')](_['pick'](_0x24f7a1[_0x30a8('0x39')],_0x1e5fe6[_0x30a8('0x3f')]),_0x43e254);if(_0x24f7a1[_0x30a8('0x39')]['filter']){_0x41024c[_0x30a8('0x40')]=_['merge'](_0x41024c[_0x30a8('0x40')],{'$or':_[_0x30a8('0x2f')](_0x43e254,function(_0x2ee079){if(_0x2ee079[_0x30a8('0x33')]!==_0x30a8('0x41')){var _0x12baa9={};_0x12baa9[_0x2ee079[_0x30a8('0x2c')]]={'$like':'%'+_0x24f7a1[_0x30a8('0x39')]['filter']+'%'};return _0x12baa9;}})});}_0x41024c=_[_0x30a8('0x42')]({},_0x41024c,_0x24f7a1[_0x30a8('0x43')]);var _0x2fe09c={'where':_0x41024c[_0x30a8('0x40')]};return db[_0x30a8('0x30')][_0x30a8('0x1f')](_0x2fe09c)['then'](function(_0x36da18){_0x5b10d7[_0x30a8('0x1f')]=_0x36da18;if(_0x24f7a1[_0x30a8('0x39')]['includeAll']){_0x41024c[_0x30a8('0x44')]=[{'all':!![]}];}return db[_0x30a8('0x30')][_0x30a8('0x45')](_0x41024c);})[_0x30a8('0x26')](function(_0x346550){_0x5b10d7[_0x30a8('0x46')]=_0x346550;return _0x5b10d7;})[_0x30a8('0x26')](respondWithFilteredResult(_0x48da2a,_0x41024c))[_0x30a8('0x47')](handleError(_0x48da2a,null));};exports['show']=function(_0xa748b4,_0x437930){var _0x210137={'raw':!![],'where':{'id':_0xa748b4[_0x30a8('0x48')]['id']}},_0x5c068={};_0x5c068[_0x30a8('0x34')]=_[_0x30a8('0x35')](db[_0x30a8('0x30')]['rawAttributes']);_0x5c068[_0x30a8('0x39')]=_[_0x30a8('0x35')](_0xa748b4[_0x30a8('0x39')]);_0x5c068[_0x30a8('0x3f')]=_[_0x30a8('0x36')](_0x5c068[_0x30a8('0x34')],_0x5c068[_0x30a8('0x39')]);_0x210137[_0x30a8('0x37')]=_['intersection'](_0x5c068[_0x30a8('0x34')],qs['fields'](_0xa748b4[_0x30a8('0x39')][_0x30a8('0x38')]));_0x210137[_0x30a8('0x37')]=_0x210137[_0x30a8('0x37')][_0x30a8('0x3a')]?_0x210137['attributes']:_0x5c068[_0x30a8('0x34')];if(_0xa748b4['query'][_0x30a8('0x49')]){_0x210137[_0x30a8('0x44')]=[{'all':!![]}];}_0x210137=_[_0x30a8('0x42')]({},_0x210137,_0xa748b4['options']);return db[_0x30a8('0x30')]['find'](_0x210137)[_0x30a8('0x26')](handleEntityNotFound(_0x437930,null))['then'](respondWithResult(_0x437930,null))[_0x30a8('0x47')](handleError(_0x437930,null));};exports[_0x30a8('0x4a')]=function(_0x1ca959,_0x511e66){return db[_0x30a8('0x30')][_0x30a8('0x4a')](_0x1ca959[_0x30a8('0x4b')],{})[_0x30a8('0x26')](function(_0x883455){var _0x251d1a=_0x1ca959[_0x30a8('0x4c')][_0x30a8('0x27')]({'plain':!![]});if(!_0x251d1a)throw new Error(_0x30a8('0x4d'));if(_0x251d1a[_0x30a8('0x4e')]==='user'){var _0x446dae=_0x883455[_0x30a8('0x27')]({'plain':!![]});var _0x20aefb=_0x30a8('0x28');return db['UserProfileSection'][_0x30a8('0x4f')]({'where':{'name':_0x20aefb,'userProfileId':_0x251d1a[_0x30a8('0x50')]},'raw':!![]})[_0x30a8('0x26')](function(_0x3e40ce){if(_0x3e40ce&&_0x3e40ce[_0x30a8('0x51')]===0x0){return db[_0x30a8('0x29')][_0x30a8('0x4a')]({'name':_0x446dae[_0x30a8('0x2c')],'resourceId':_0x446dae['id'],'type':_0x3e40ce['name'],'sectionId':_0x3e40ce['id']},{})[_0x30a8('0x26')](function(){return _0x883455;});}else{return _0x883455;}})[_0x30a8('0x47')](function(_0x55389b){logger[_0x30a8('0x52')](_0x30a8('0x53'),_0x55389b);throw _0x55389b;});}return _0x883455;})[_0x30a8('0x26')](respondWithResult(_0x511e66,0xc9))[_0x30a8('0x47')](handleError(_0x511e66,null));};exports[_0x30a8('0x24')]=function(_0x4aabdf,_0x578b30){if(_0x4aabdf[_0x30a8('0x4b')]['id']){delete _0x4aabdf[_0x30a8('0x4b')]['id'];}return db[_0x30a8('0x30')][_0x30a8('0x4f')]({'where':{'id':_0x4aabdf[_0x30a8('0x48')]['id']}})[_0x30a8('0x26')](handleEntityNotFound(_0x578b30,null))[_0x30a8('0x26')](saveUpdates(_0x4aabdf[_0x30a8('0x4b')],null))[_0x30a8('0x26')](respondWithResult(_0x578b30,null))['catch'](handleError(_0x578b30,null));};exports[_0x30a8('0x25')]=function(_0x27af4f,_0x5cd46c){return db['Variable'][_0x30a8('0x4f')]({'where':{'id':_0x27af4f[_0x30a8('0x48')]['id']}})[_0x30a8('0x26')](handleEntityNotFound(_0x5cd46c,null))['then'](removeEntity(_0x5cd46c,null))[_0x30a8('0x47')](handleError(_0x5cd46c,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 5674f1c..a0c6e60 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 _0x2e3f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','../../config/logger'];(function(_0x5e4ffa,_0x56154d){var _0x43a656=function(_0x507ed4){while(--_0x507ed4){_0x5e4ffa['push'](_0x5e4ffa['shift']());}};_0x43a656(++_0x56154d);}(_0x2e3f,0x129));var _0xf2e3=function(_0x28f0a8,_0x2cfd26){_0x28f0a8=_0x28f0a8-0x0;var _0x33db97=_0x2e3f[_0x28f0a8];return _0x33db97;};'use strict';var _=require(_0xf2e3('0x0'));var util=require('util');var logger=require(_0xf2e3('0x1'))('api');var moment=require(_0xf2e3('0x2'));var BPromise=require(_0xf2e3('0x3'));var rp=require(_0xf2e3('0x4'));var fs=require('fs');var path=require(_0xf2e3('0x5'));var rimraf=require(_0xf2e3('0x6'));var config=require(_0xf2e3('0x7'));var attributes=require(_0xf2e3('0x8'));module[_0xf2e3('0x9')]=function(_0x38835e,_0x4d30ee){return _0x38835e[_0xf2e3('0xa')](_0xf2e3('0xb'),attributes,{'tableName':_0xf2e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1de5=['request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','Variable','tools_variables','util','../../config/logger','api','moment'];(function(_0x45b0f4,_0x2a6f2e){var _0x4e88bd=function(_0x5d9fcf){while(--_0x5d9fcf){_0x45b0f4['push'](_0x45b0f4['shift']());}};_0x4e88bd(++_0x2a6f2e);}(_0x1de5,0x1a0));var _0x51de=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x1de5[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require(_0x51de('0x0'));var logger=require(_0x51de('0x1'))(_0x51de('0x2'));var moment=require(_0x51de('0x3'));var BPromise=require('bluebird');var rp=require(_0x51de('0x4'));var fs=require('fs');var path=require(_0x51de('0x5'));var rimraf=require(_0x51de('0x6'));var config=require(_0x51de('0x7'));var attributes=require(_0x51de('0x8'));module[_0x51de('0x9')]=function(_0x1964e1,_0x403d65){return _0x1964e1['define'](_0x51de('0xa'),attributes,{'tableName':_0x51de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index f7fb132..a4f584d 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x1c17e3,_0x5995b9){var _0x54a18b=function(_0x201d78){while(--_0x201d78){_0x1c17e3['push'](_0x1c17e3['shift']());}};_0x54a18b(++_0x5995b9);}(_0xe14b,0x93));var _0xbe14=function(_0x1362fb,_0x457d2a){_0x1362fb=_0x1362fb-0x0;var _0x410675=_0xe14b[_0x1362fb];return _0x410675;};'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);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x1d0f7b,_0x4f4f60){var _0xf48406=function(_0x24ab16){while(--_0x24ab16){_0x1d0f7b['push'](_0x1d0f7b['shift']());}};_0xf48406(++_0x4f4f60);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4879f7,_0x33749d){_0x4879f7=_0x4879f7-0x0;var _0x41771a=_0x7fbe[_0x4879f7];return _0x41771a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index d3337f7..9a88e19 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 _0x0a25=['/reset','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations','./version.controller','get','/fetch','isAuthenticated','fetch'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x0a25,0x105));var _0x50a2=function(_0x3ae0f0,_0x3335cf){_0x3ae0f0=_0x3ae0f0-0x0;var _0x45449a=_0x0a25[_0x3ae0f0];return _0x45449a;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x50a2('0x0'));router[_0x50a2('0x1')]('/',controller['index']);router['get'](_0x50a2('0x2'),auth[_0x50a2('0x3')](),auth['canUpdate'](),controller[_0x50a2('0x4')]);router[_0x50a2('0x1')](_0x50a2('0x5'),auth[_0x50a2('0x3')](),auth[_0x50a2('0x6')](),controller[_0x50a2('0x7')]);router[_0x50a2('0x1')](_0x50a2('0x8'),auth[_0x50a2('0x3')](),auth[_0x50a2('0x6')](),controller[_0x50a2('0x9')]);router['get'](_0x50a2('0xa'),auth[_0x50a2('0x3')](),controller[_0x50a2('0xb')]);router[_0x50a2('0x1')](_0x50a2('0xc'),controller[_0x50a2('0xd')]);module['exports']=router; \ No newline at end of file +var _0xf83a=['Router','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','/restart','restart','/migrations','exports'];(function(_0x4c8155,_0x23b067){var _0x4230d9=function(_0x31cad7){while(--_0x31cad7){_0x4c8155['push'](_0x4c8155['shift']());}};_0x4230d9(++_0x23b067);}(_0xf83a,0x1e0));var _0xaf83=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xf83a[_0x1e172a];return _0x96338b;};'use strict';var express=require('express');var router=express[_0xaf83('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xaf83('0x1'));router[_0xaf83('0x2')]('/',controller['index']);router[_0xaf83('0x2')](_0xaf83('0x3'),auth[_0xaf83('0x4')](),auth[_0xaf83('0x5')](),controller[_0xaf83('0x6')]);router[_0xaf83('0x2')](_0xaf83('0x7'),auth['isAuthenticated'](),auth[_0xaf83('0x5')](),controller['reset']);router[_0xaf83('0x2')]('/pull',auth['isAuthenticated'](),auth[_0xaf83('0x5')](),controller['pull']);router[_0xaf83('0x2')](_0xaf83('0x8'),auth[_0xaf83('0x4')](),controller[_0xaf83('0x9')]);router[_0xaf83('0x2')](_0xaf83('0xa'),controller['migrations']);module[_0xaf83('0xb')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index c335603..52ffd1c 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 _0xc6f7=['Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','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','push','sort','sequelize','Migration','getQueryInterface'];(function(_0x4e5ea1,_0x397282){var _0x59cd85=function(_0x267bf0){while(--_0x267bf0){_0x4e5ea1['push'](_0x4e5ea1['shift']());}};_0x59cd85(++_0x397282);}(_0xc6f7,0xeb));var _0x7c6f=function(_0x4ed245,_0x52dd9f){_0x4ed245=_0x4ed245-0x0;var _0x1d7e24=_0xc6f7[_0x4ed245];return _0x1d7e24;};'use strict';var Umzug=require(_0x7c6f('0x0'));var path=require(_0x7c6f('0x1'));var fs=require('fs');var _=require(_0x7c6f('0x2'));var pkginfo=require(_0x7c6f('0x3'))(module,_0x7c6f('0x4'));var compareVersions=require(_0x7c6f('0x5'));var exec=require(_0x7c6f('0x6'))[_0x7c6f('0x7')];var db=require('../../mysqldb')['db'];var config=require(_0x7c6f('0x8'));var pm2=require(_0x7c6f('0x9'));var logger=require(_0x7c6f('0xa'))(_0x7c6f('0xb'));var git=require(_0x7c6f('0xc'))(config['root']);exports[_0x7c6f('0xd')]=function(_0x7138e9,_0x5125e8){var _0x36d2ef={'current':module[_0x7c6f('0xe')][_0x7c6f('0x4')],'phonebar':0x2};if(_0x7138e9[_0x7c6f('0xf')]&&_0x7138e9[_0x7c6f('0xf')][_0x7c6f('0x10')]){return git['fetch']()['tags'](function(_0x3b8aae,_0x46b56d){_0x36d2ef['latest']=(_0x3b8aae?module[_0x7c6f('0xe')]['version']:_0x46b56d[_0x7c6f('0x10')])||'2.0.0';return _0x5125e8[_0x7c6f('0x11')](0xc8)[_0x7c6f('0x12')](_0x36d2ef);});}else{return _0x5125e8['status'](0xc8)[_0x7c6f('0x12')](_0x36d2ef);}};exports[_0x7c6f('0x13')]=function(_0x5706c2,_0x1a14c6){return git[_0x7c6f('0x13')]([_0x7c6f('0x14'),_0x7c6f('0x15')],function(_0x26b8b1){if(_0x26b8b1){logger[_0x7c6f('0x16')](_0x26b8b1);return _0x1a14c6[_0x7c6f('0x11')](0x1f4)['json'](_0x26b8b1);}logger[_0x7c6f('0x17')](_0x7c6f('0x18'));return _0x1a14c6[_0x7c6f('0x11')](0xc8)[_0x7c6f('0x12')]({'output':_0x7c6f('0x19')});});};exports[_0x7c6f('0x1a')]=function(_0x3d900d,_0x1e5a01){return git[_0x7c6f('0x1a')]([_0x7c6f('0x1b'),'FETCH_HEAD'],function(_0x38c44a){if(_0x38c44a){logger[_0x7c6f('0x16')](_0x38c44a);return _0x1e5a01[_0x7c6f('0x11')](0x1f4)[_0x7c6f('0x12')](_0x38c44a);}logger['info'](_0x7c6f('0x1c'));return _0x1e5a01[_0x7c6f('0x11')](0xc8)[_0x7c6f('0x12')]({'output':_0x7c6f('0x1d')});});};exports[_0x7c6f('0x1e')]=function(_0x4b5743,_0x580ed8){exec(_0x7c6f('0x1f'),function(_0x24407c,_0x54f865,_0x59ac0a){logger['info'](_0x54f865);logger[_0x7c6f('0x17')](_0x59ac0a);if(_0x24407c){logger['error'](_0x24407c);return _0x580ed8[_0x7c6f('0x11')](0x1f4)['json'](_0x24407c);}return _0x580ed8[_0x7c6f('0x11')](0xc8)[_0x7c6f('0x12')]({'output':_0x54f865});});};exports[_0x7c6f('0x20')]=function(_0xa59819,_0x947e6a){return pm2[_0x7c6f('0x20')](_0x7c6f('0x21'))[_0x7c6f('0x22')](function(_0x55cee4){logger[_0x7c6f('0x17')](_0x7c6f('0x23'),_0x55cee4);return _0x947e6a[_0x7c6f('0x11')](0xc8)[_0x7c6f('0x12')]({'output':_0x7c6f('0x24')});})[_0x7c6f('0x25')](function(_0x35b2b5){logger[_0x7c6f('0x16')](_0x35b2b5);return _0x947e6a['status'](0x1f4)[_0x7c6f('0x12')](_0x35b2b5);});};exports[_0x7c6f('0x26')]=function(_0x262957,_0x10c3ac){var _0x34558b=fs[_0x7c6f('0x27')](path[_0x7c6f('0x28')](config['root'],_0x7c6f('0x29'),'migrations'));var _0x1b899c=[];for(var _0x4116c0=0x0;_0x4116c0<_0x34558b[_0x7c6f('0x2a')];_0x4116c0++){var _0x27b2fd=_0x34558b[_0x4116c0][_0x7c6f('0x2b')](_0x7c6f('0x2c'),'');if(compareVersions(module[_0x7c6f('0xe')][_0x7c6f('0x4')],_0x27b2fd)===-0x1){_0x1b899c[_0x7c6f('0x2d')](_0x27b2fd);}}if(_0x1b899c[_0x7c6f('0x2a')]){var _0x4314de=_0x1b899c[_0x7c6f('0x2e')](compareVersions);var _0x3d37d1=new Umzug({'storage':_0x7c6f('0x2f'),'storageOptions':{'model':db[_0x7c6f('0x30')],'modelName':_0x7c6f('0x30'),'columnName':'version'},'migrations':{'params':[db[_0x7c6f('0x2f')][_0x7c6f('0x31')](),db[_0x7c6f('0x2f')]['constructor'],function(){throw new Error(_0x7c6f('0x32'));}],'path':path['join'](config[_0x7c6f('0x33')],_0x7c6f('0x29'),_0x7c6f('0x26')),'pattern':/\.js$/}});_0x3d37d1['up']({'migrations':_[_0x7c6f('0x34')](_0x4314de,function(_0x6f4e50){return _0x6f4e50+_0x7c6f('0x2c');})})[_0x7c6f('0x22')](function(){return _0x10c3ac['status'](0xc8)[_0x7c6f('0x12')]({'output':_0x7c6f('0x35')+module[_0x7c6f('0xe')]['version']+'\x20to\x20'+_[_0x7c6f('0x36')](_0x4314de),'migrations':_[_0x7c6f('0x28')](_0x4314de)});})[_0x7c6f('0x25')](function(_0x1502fa){if(_0x1502fa instanceof db['sequelize'][_0x7c6f('0x37')]){return _0x10c3ac[_0x7c6f('0x11')](0xc8)[_0x7c6f('0x12')]({'output':_0x7c6f('0x38')});}else{return _0x10c3ac[_0x7c6f('0x11')](0x1f4)[_0x7c6f('0x12')](_0x1502fa);}});}else{return _0x10c3ac['status'](0xc8)[_0x7c6f('0x12')]({'output':_0x7c6f('0x38')});}}; \ No newline at end of file +var _0x7368=['origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','replace','.js','push','length','sort','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','update','simple-git','root','index','exports','version','query','latest','fetch','2.0.0','json','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7368,0x89));var _0x8736=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7368[_0x4b369d];return _0x571a98;};'use strict';var Umzug=require(_0x8736('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x8736('0x1'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x8736('0x2'));var exec=require(_0x8736('0x3'))[_0x8736('0x4')];var db=require(_0x8736('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x8736('0x6'));var logger=require('../../config/logger')(_0x8736('0x7'));var git=require(_0x8736('0x8'))(config[_0x8736('0x9')]);exports[_0x8736('0xa')]=function(_0x89c55d,_0x3ad536){var _0x4c35ca={'current':module[_0x8736('0xb')][_0x8736('0xc')],'phonebar':0x2};if(_0x89c55d[_0x8736('0xd')]&&_0x89c55d[_0x8736('0xd')][_0x8736('0xe')]){return git[_0x8736('0xf')]()['tags'](function(_0x48a23a,_0x1ad001){_0x4c35ca[_0x8736('0xe')]=(_0x48a23a?module[_0x8736('0xb')][_0x8736('0xc')]:_0x1ad001[_0x8736('0xe')])||_0x8736('0x10');return _0x3ad536['status'](0xc8)[_0x8736('0x11')](_0x4c35ca);});}else{return _0x3ad536[_0x8736('0x12')](0xc8)[_0x8736('0x11')](_0x4c35ca);}};exports[_0x8736('0xf')]=function(_0x1ef509,_0x3ea4e7){return git[_0x8736('0xf')]([_0x8736('0x13'),_0x8736('0x14')],function(_0x3804ab){if(_0x3804ab){logger[_0x8736('0x15')](_0x3804ab);return _0x3ea4e7['status'](0x1f4)[_0x8736('0x11')](_0x3804ab);}logger[_0x8736('0x16')](_0x8736('0x17'));return _0x3ea4e7[_0x8736('0x12')](0xc8)[_0x8736('0x11')]({'output':_0x8736('0x18')});});};exports[_0x8736('0x19')]=function(_0x18739a,_0x5bf4eb){return git[_0x8736('0x19')]([_0x8736('0x1a'),'FETCH_HEAD'],function(_0x42db2f){if(_0x42db2f){logger['error'](_0x42db2f);return _0x5bf4eb[_0x8736('0x12')](0x1f4)[_0x8736('0x11')](_0x42db2f);}logger[_0x8736('0x16')](_0x8736('0x1b'));return _0x5bf4eb['status'](0xc8)[_0x8736('0x11')]({'output':_0x8736('0x1c')});});};exports['pull']=function(_0x410372,_0x4937d1){exec(_0x8736('0x1d'),function(_0x4a7e98,_0x335642,_0x4ead1c){logger[_0x8736('0x16')](_0x335642);logger[_0x8736('0x16')](_0x4ead1c);if(_0x4a7e98){logger[_0x8736('0x15')](_0x4a7e98);return _0x4937d1[_0x8736('0x12')](0x1f4)[_0x8736('0x11')](_0x4a7e98);}return _0x4937d1[_0x8736('0x12')](0xc8)['json']({'output':_0x335642});});};exports[_0x8736('0x1e')]=function(_0x53d7bb,_0x500500){return pm2['restart'](_0x8736('0x1f'))[_0x8736('0x20')](function(_0x4484ca){logger[_0x8736('0x16')](_0x8736('0x21'),_0x4484ca);return _0x500500[_0x8736('0x12')](0xc8)[_0x8736('0x11')]({'output':_0x8736('0x22')});})[_0x8736('0x23')](function(_0x497f59){logger['error'](_0x497f59);return _0x500500[_0x8736('0x12')](0x1f4)['json'](_0x497f59);});};exports[_0x8736('0x24')]=function(_0x2da100,_0x3e94c0){var _0x1d5989=fs['readdirSync'](path['join'](config[_0x8736('0x9')],_0x8736('0x25'),_0x8736('0x24')));var _0x5ea402=[];for(var _0x221ce8=0x0;_0x221ce8<_0x1d5989['length'];_0x221ce8++){var _0x358832=_0x1d5989[_0x221ce8][_0x8736('0x26')](_0x8736('0x27'),'');if(compareVersions(module[_0x8736('0xb')][_0x8736('0xc')],_0x358832)===-0x1){_0x5ea402[_0x8736('0x28')](_0x358832);}}if(_0x5ea402[_0x8736('0x29')]){var _0x48ff50=_0x5ea402[_0x8736('0x2a')](compareVersions);var _0x8b5fac=new Umzug({'storage':_0x8736('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x8736('0xc')},'migrations':{'params':[db[_0x8736('0x2b')][_0x8736('0x2c')](),db['sequelize']['constructor'],function(){throw new Error(_0x8736('0x2d'));}],'path':path[_0x8736('0x2e')](config[_0x8736('0x9')],'server',_0x8736('0x24')),'pattern':/\.js$/}});_0x8b5fac['up']({'migrations':_['map'](_0x48ff50,function(_0x3fa249){return _0x3fa249+'.js';})})[_0x8736('0x20')](function(){return _0x3e94c0['status'](0xc8)[_0x8736('0x11')]({'output':_0x8736('0x2f')+module[_0x8736('0xb')][_0x8736('0xc')]+_0x8736('0x30')+_[_0x8736('0x31')](_0x48ff50),'migrations':_['join'](_0x48ff50)});})[_0x8736('0x23')](function(_0x3b96f0){if(_0x3b96f0 instanceof db['sequelize'][_0x8736('0x32')]){return _0x3e94c0[_0x8736('0x12')](0xc8)['json']({'output':_0x8736('0x33')});}else{return _0x3e94c0[_0x8736('0x12')](0x1f4)['json'](_0x3b96f0);}});}else{return _0x3e94c0[_0x8736('0x12')](0xc8)[_0x8736('0x11')]({'output':_0x8736('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a6ced00..2f63504 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 _0x7ed3=['update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','/:id','show','create','put'];(function(_0x143c2c,_0x5ac42e){var _0x1ff4c1=function(_0x2b53be){while(--_0x2b53be){_0x143c2c['push'](_0x143c2c['shift']());}};_0x1ff4c1(++_0x5ac42e);}(_0x7ed3,0x129));var _0x37ed=function(_0x2d94d5,_0x5c2b38){_0x2d94d5=_0x2d94d5-0x0;var _0x121642=_0x7ed3[_0x2d94d5];return _0x121642;};'use strict';var multer=require('multer');var util=require(_0x37ed('0x0'));var path=require(_0x37ed('0x1'));var timeout=require(_0x37ed('0x2'));var express=require(_0x37ed('0x3'));var router=express[_0x37ed('0x4')]();var fs_extra=require(_0x37ed('0x5'));var auth=require(_0x37ed('0x6'));var interaction=require(_0x37ed('0x7'));var config=require(_0x37ed('0x8'));var controller=require(_0x37ed('0x9'));router[_0x37ed('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x37ed('0xa')](_0x37ed('0xb'),auth[_0x37ed('0xc')](),controller[_0x37ed('0xd')]);router['get'](_0x37ed('0xe'),auth[_0x37ed('0xc')](),controller[_0x37ed('0xf')]);router['post']('/',auth[_0x37ed('0xc')](),controller[_0x37ed('0x10')]);router[_0x37ed('0x11')](_0x37ed('0xe'),auth[_0x37ed('0xc')](),controller[_0x37ed('0x12')]);router[_0x37ed('0x13')]('/:id',auth[_0x37ed('0xc')](),controller[_0x37ed('0x14')]);module['exports']=router; \ No newline at end of file +var _0xff21=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0xf58a6f,_0x291585){var _0x23f99d=function(_0x54b6d4){while(--_0x54b6d4){_0xf58a6f['push'](_0xf58a6f['shift']());}};_0x23f99d(++_0x291585);}(_0xff21,0x1a1));var _0x1ff2=function(_0xb65ffb,_0x2cc0af){_0xb65ffb=_0xb65ffb-0x0;var _0x58f55c=_0xff21[_0xb65ffb];return _0x58f55c;};'use strict';var multer=require(_0x1ff2('0x0'));var util=require('util');var path=require(_0x1ff2('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ff2('0x2'));var router=express[_0x1ff2('0x3')]();var fs_extra=require(_0x1ff2('0x4'));var auth=require(_0x1ff2('0x5'));var interaction=require(_0x1ff2('0x6'));var config=require(_0x1ff2('0x7'));var controller=require(_0x1ff2('0x8'));router[_0x1ff2('0x9')]('/',auth[_0x1ff2('0xa')](),controller[_0x1ff2('0xb')]);router[_0x1ff2('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1ff2('0xc')]);router['get'](_0x1ff2('0xd'),auth[_0x1ff2('0xa')](),controller[_0x1ff2('0xe')]);router[_0x1ff2('0xf')]('/',auth[_0x1ff2('0xa')](),controller[_0x1ff2('0x10')]);router[_0x1ff2('0x11')](_0x1ff2('0xd'),auth[_0x1ff2('0xa')](),controller[_0x1ff2('0x12')]);router[_0x1ff2('0x13')](_0x1ff2('0xd'),auth[_0x1ff2('0xa')](),controller[_0x1ff2('0x14')]);module[_0x1ff2('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 9b1e054..dd72175 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 _0xea28=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x4218e3,_0x5650d5){var _0x5bfc97=function(_0xc67dfa){while(--_0xc67dfa){_0x4218e3['push'](_0x4218e3['shift']());}};_0x5bfc97(++_0x5650d5);}(_0xea28,0x13a));var _0x8ea2=function(_0x55dfa5,_0x4358cd){_0x55dfa5=_0x55dfa5-0x0;var _0x46a1a9=_0xea28[_0x55dfa5];return _0x46a1a9;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'type':{'type':Sequelize[_0x8ea2('0x2')]},'uniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'calleridnum':{'type':Sequelize[_0x8ea2('0x2')]},'calleridname':{'type':Sequelize[_0x8ea2('0x2')]},'queue':{'type':Sequelize[_0x8ea2('0x2')]},'interface':{'type':Sequelize[_0x8ea2('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x8ea2('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8ea2('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x8ea2('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x8ea2('0x3')]},'holdtime':{'type':Sequelize[_0x8ea2('0x4')]},'agentcomplete':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8ea2('0x4')]},'agentacw':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8ea2('0x4')]},'reason':{'type':Sequelize[_0x8ea2('0x2')]},'lastevent':{'type':Sequelize[_0x8ea2('0x2')]},'channel':{'type':Sequelize[_0x8ea2('0x2')]},'channelstate':{'type':Sequelize[_0x8ea2('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8ea2('0x2')]},'language':{'type':Sequelize[_0x8ea2('0x2')]},'accountcode':{'type':Sequelize[_0x8ea2('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x8ea2('0x2')]},'priority':{'type':Sequelize[_0x8ea2('0x2')]},'destchannel':{'type':Sequelize[_0x8ea2('0x2')]},'destchannelstate':{'type':Sequelize[_0x8ea2('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8ea2('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x8ea2('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8ea2('0x2')]},'destaccountcode':{'type':Sequelize[_0x8ea2('0x2')]},'destcontext':{'type':Sequelize[_0x8ea2('0x2')]},'destexten':{'type':Sequelize[_0x8ea2('0x2')]},'destpriority':{'type':Sequelize[_0x8ea2('0x2')]},'destuniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x8ea2('0x2')]},'transfer':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8ea2('0x2')],'comment':_0x8ea2('0x6')},'transferexten':{'type':Sequelize[_0x8ea2('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'agententerreason':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x373d=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','INTEGER'];(function(_0x59a3cc,_0x1797c8){var _0x26a295=function(_0x279141){while(--_0x279141){_0x59a3cc['push'](_0x59a3cc['shift']());}};_0x26a295(++_0x1797c8);}(_0x373d,0x1e2));var _0xd373=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x373d[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require(_0xd373('0x0'));module['exports']={'type':{'type':Sequelize[_0xd373('0x1')]},'uniqueid':{'type':Sequelize[_0xd373('0x1')]},'calleridnum':{'type':Sequelize[_0xd373('0x1')]},'calleridname':{'type':Sequelize[_0xd373('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd373('0x1')]},'membername':{'type':Sequelize[_0xd373('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd373('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xd373('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd373('0x2')]},'holdtime':{'type':Sequelize[_0xd373('0x3')]},'agentcomplete':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd373('0x1')]},'lastevent':{'type':Sequelize[_0xd373('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd373('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd373('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd373('0x1')]},'accountcode':{'type':Sequelize[_0xd373('0x1')]},'context':{'type':Sequelize[_0xd373('0x1')]},'exten':{'type':Sequelize[_0xd373('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd373('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd373('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xd373('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd373('0x1')]},'destlanguage':{'type':Sequelize[_0xd373('0x1')]},'destaccountcode':{'type':Sequelize[_0xd373('0x1')]},'destcontext':{'type':Sequelize[_0xd373('0x1')]},'destexten':{'type':Sequelize[_0xd373('0x1')]},'destpriority':{'type':Sequelize[_0xd373('0x1')]},'destuniqueid':{'type':Sequelize[_0xd373('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd373('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd373('0x1')]},'transfer':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd373('0x1')],'comment':_0xd373('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xd373('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index c96b01d..e0353b8 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(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 41b8176..7d4f218 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 _0x6c32=['destuniqueid','lodash','../../config/logger','moment','request-promise','path','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6c32,0xb5));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var util=require('util');var logger=require(_0x26c3('0x1'))('api');var moment=require(_0x26c3('0x2'));var BPromise=require('bluebird');var rp=require(_0x26c3('0x3'));var fs=require('fs');var path=require(_0x26c3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x26c3('0x5'));module[_0x26c3('0x6')]=function(_0x421941,_0x402393){return _0x421941[_0x26c3('0x7')](_0x26c3('0x8'),attributes,{'tableName':_0x26c3('0x9'),'paranoid':![],'indexes':[{'fields':[_0x26c3('0xa'),_0x26c3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f74=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0x2f74,0x7b));var _0x42f7=function(_0x3a2797,_0x1f905c){_0x3a2797=_0x3a2797-0x0;var _0x5c2d96=_0x2f74[_0x3a2797];return _0x5c2d96;};'use strict';var _=require(_0x42f7('0x0'));var util=require('util');var logger=require(_0x42f7('0x1'))(_0x42f7('0x2'));var moment=require(_0x42f7('0x3'));var BPromise=require(_0x42f7('0x4'));var rp=require(_0x42f7('0x5'));var fs=require('fs');var path=require(_0x42f7('0x6'));var rimraf=require(_0x42f7('0x7'));var config=require(_0x42f7('0x8'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x540e53,_0x250aa9){return _0x540e53[_0x42f7('0x9')](_0x42f7('0xa'),attributes,{'tableName':_0x42f7('0xb'),'paranoid':![],'indexes':[{'fields':[_0x42f7('0xc'),_0x42f7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index df2f1ff..45f8a19 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 _0x18e1=['error','message','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','debug','catch','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c1eec,_0x515aa1){var _0x5d8475=function(_0xd50a8e){while(--_0xd50a8e){_0x4c1eec['push'](_0x4c1eec['shift']());}};_0x5d8475(++_0x515aa1);}(_0x18e1,0x145));var _0x118e=function(_0x4edb29,_0xcb1dc6){_0x4edb29=_0x4edb29-0x0;var _0x49a814=_0x18e1[_0x4edb29];return _0x49a814;};'use strict';var _=require(_0x118e('0x0'));var util=require('util');var moment=require(_0x118e('0x1'));var BPromise=require(_0x118e('0x2'));var rs=require(_0x118e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x118e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x118e('0x5'))('rpc');var config=require(_0x118e('0x6'));var jayson=require(_0x118e('0x7'));var client=jayson[_0x118e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c8ef3,_0xa6e70c,_0x5501ca){return new BPromise(function(_0x5e7fce,_0x5d01f5){return client[_0x118e('0x9')](_0x3c8ef3,_0x5501ca)[_0x118e('0xa')](function(_0x25c926){logger[_0x118e('0xb')](_0x118e('0xc'),_0xa6e70c,_0x118e('0xd'));logger['debug'](_0x118e('0xe'),_0xa6e70c,_0x118e('0xd'),JSON[_0x118e('0xf')](_0x25c926));if(_0x25c926[_0x118e('0x10')]){if(_0x25c926['error']['code']===0x1f4){logger[_0x118e('0x10')](_0x118e('0xc'),_0xa6e70c,_0x25c926[_0x118e('0x10')]['message']);return _0x5d01f5(_0x25c926['error'][_0x118e('0x11')]);}logger[_0x118e('0x10')](_0x118e('0xc'),_0xa6e70c,_0x25c926[_0x118e('0x10')][_0x118e('0x11')]);return _0x5e7fce(_0x25c926[_0x118e('0x10')][_0x118e('0x11')]);}else{logger['info'](_0x118e('0xc'),_0xa6e70c,_0x118e('0xd'));_0x5e7fce(_0x25c926['result'][_0x118e('0x11')]);}})['catch'](function(_0x21a235){logger[_0x118e('0x10')](_0x118e('0xc'),_0xa6e70c,_0x21a235);_0x5d01f5(_0x21a235);});});}exports[_0x118e('0x12')]=function(_0xa563b5){var _0x1a6979=this;return new Promise(function(_0x247449,_0x46398d){return db[_0x118e('0x13')][_0x118e('0x14')](_0xa563b5[_0x118e('0x15')],{'raw':_0xa563b5['options']?_0xa563b5[_0x118e('0x16')][_0x118e('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5ed7e2){logger[_0x118e('0xb')](_0x118e('0x12'),_0xa563b5);logger[_0x118e('0x18')](_0x118e('0x12'),_0xa563b5,JSON[_0x118e('0xf')](_0x5ed7e2));_0x247449(_0x5ed7e2);})[_0x118e('0x19')](function(_0x1b99fa){logger[_0x118e('0x10')](_0x118e('0x12'),_0x1b99fa[_0x118e('0x11')],_0xa563b5);_0x46398d(_0x1a6979['error'](0x1f4,_0x1b99fa[_0x118e('0x11')]));});});};exports[_0x118e('0x1a')]=function(_0x3acbf5){var _0x3799f2=this;return new Promise(function(_0xa2ada0,_0x4154d5){return db[_0x118e('0x13')][_0x118e('0x1b')](_0x3acbf5['body'],{'raw':_0x3acbf5[_0x118e('0x16')]?_0x3acbf5[_0x118e('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3acbf5[_0x118e('0x16')]?_0x3acbf5['options'][_0x118e('0x1c')]||null:null,'attributes':_0x3acbf5['options']?_0x3acbf5[_0x118e('0x16')][_0x118e('0x1d')]||null:null,'limit':_0x3acbf5[_0x118e('0x16')]?_0x3acbf5[_0x118e('0x16')][_0x118e('0x1e')]||null:null})[_0x118e('0xa')](function(_0x203e54){logger['info'](_0x118e('0x1a'),_0x3acbf5);logger[_0x118e('0x18')]('UpdateVoiceAgentReport',_0x3acbf5,JSON[_0x118e('0xf')](_0x203e54));_0xa2ada0(_0x203e54);})['catch'](function(_0x58535d){logger[_0x118e('0x10')](_0x118e('0x1a'),_0x58535d[_0x118e('0x11')],_0x3acbf5);_0x4154d5(_0x3799f2[_0x118e('0x10')](0x1f4,_0x58535d['message']));});});}; \ No newline at end of file +var _0x25cf=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','then','catch','UpdateVoiceAgentReport','update','where','attributes'];(function(_0x2c3458,_0x1f7efd){var _0x3f7e02=function(_0x261040){while(--_0x261040){_0x2c3458['push'](_0x2c3458['shift']());}};_0x3f7e02(++_0x1f7efd);}(_0x25cf,0x140));var _0xf25c=function(_0x196ce1,_0x46e836){_0x196ce1=_0x196ce1-0x0;var _0x360a64=_0x25cf[_0x196ce1];return _0x360a64;};'use strict';var _=require(_0xf25c('0x0'));var util=require(_0xf25c('0x1'));var moment=require(_0xf25c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf25c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf25c('0x4'));var logger=require(_0xf25c('0x5'))(_0xf25c('0x6'));var config=require('../../config/environment');var jayson=require(_0xf25c('0x7'));var client=jayson[_0xf25c('0x8')][_0xf25c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f300,_0x509d34,_0x42065a){return new BPromise(function(_0x159056,_0x4ad392){return client[_0xf25c('0xa')](_0x45f300,_0x42065a)['then'](function(_0x5e7ba2){logger[_0xf25c('0xb')](_0xf25c('0xc'),_0x509d34,_0xf25c('0xd'));logger[_0xf25c('0xe')](_0xf25c('0xf'),_0x509d34,_0xf25c('0xd'),JSON[_0xf25c('0x10')](_0x5e7ba2));if(_0x5e7ba2[_0xf25c('0x11')]){if(_0x5e7ba2['error'][_0xf25c('0x12')]===0x1f4){logger[_0xf25c('0x11')](_0xf25c('0xc'),_0x509d34,_0x5e7ba2['error'][_0xf25c('0x13')]);return _0x4ad392(_0x5e7ba2[_0xf25c('0x11')]['message']);}logger[_0xf25c('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x509d34,_0x5e7ba2[_0xf25c('0x11')][_0xf25c('0x13')]);return _0x159056(_0x5e7ba2[_0xf25c('0x11')][_0xf25c('0x13')]);}else{logger[_0xf25c('0xb')](_0xf25c('0xc'),_0x509d34,_0xf25c('0xd'));_0x159056(_0x5e7ba2[_0xf25c('0x14')][_0xf25c('0x13')]);}})['catch'](function(_0x537af0){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x509d34,_0x537af0);_0x4ad392(_0x537af0);});});}exports[_0xf25c('0x15')]=function(_0x57040a){var _0x4e1a98=this;return new Promise(function(_0x17bf19,_0x1d0804){return db[_0xf25c('0x16')][_0xf25c('0x17')](_0x57040a['body'],{'raw':_0x57040a[_0xf25c('0x18')]?_0x57040a[_0xf25c('0x18')][_0xf25c('0x19')]===undefined?!![]:![]:!![]})[_0xf25c('0x1a')](function(_0x5a396f){logger[_0xf25c('0xb')](_0xf25c('0x15'),_0x57040a);logger[_0xf25c('0xe')](_0xf25c('0x15'),_0x57040a,JSON[_0xf25c('0x10')](_0x5a396f));_0x17bf19(_0x5a396f);})[_0xf25c('0x1b')](function(_0x1f8f82){logger[_0xf25c('0x11')](_0xf25c('0x15'),_0x1f8f82[_0xf25c('0x13')],_0x57040a);_0x1d0804(_0x4e1a98[_0xf25c('0x11')](0x1f4,_0x1f8f82[_0xf25c('0x13')]));});});};exports[_0xf25c('0x1c')]=function(_0x427b76){var _0x57ac28=this;return new Promise(function(_0xd09dda,_0x34cd74){return db['VoiceAgentReport'][_0xf25c('0x1d')](_0x427b76['body'],{'raw':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')][_0xf25c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')][_0xf25c('0x1e')]||null:null,'attributes':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')][_0xf25c('0x1f')]||null:null,'limit':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')]['limit']||null:null})[_0xf25c('0x1a')](function(_0x3c22a0){logger['info']('UpdateVoiceAgentReport',_0x427b76);logger['debug'](_0xf25c('0x1c'),_0x427b76,JSON['stringify'](_0x3c22a0));_0xd09dda(_0x3c22a0);})[_0xf25c('0x1b')](function(_0x241e9c){logger[_0xf25c('0x11')](_0xf25c('0x1c'),_0x241e9c[_0xf25c('0x13')],_0x427b76);_0x34cd74(_0x57ac28['error'](0x1f4,_0x241e9c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 439ad26..afe099d 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 _0x0c1a=['isAuthenticated','index','/describe','describe','get','/:id','show','create','put','/with-retry/:id','updateWithRetry','delete','destroy','exports','Router','../../components/auth/service','./voiceCallReport.controller'];(function(_0x54447d,_0x22b5de){var _0x2b65a0=function(_0x37dc38){while(--_0x37dc38){_0x54447d['push'](_0x54447d['shift']());}};_0x2b65a0(++_0x22b5de);}(_0x0c1a,0x74));var _0xa0c1=function(_0x4b276c,_0x55d49c){_0x4b276c=_0x4b276c-0x0;var _0x591632=_0x0c1a[_0x4b276c];return _0x591632;};'use strict';var express=require('express');var router=express[_0xa0c1('0x0')]();var auth=require(_0xa0c1('0x1'));var controller=require(_0xa0c1('0x2'));router['get']('/',auth[_0xa0c1('0x3')](),controller[_0xa0c1('0x4')]);router['get'](_0xa0c1('0x5'),auth[_0xa0c1('0x3')](),controller[_0xa0c1('0x6')]);router[_0xa0c1('0x7')](_0xa0c1('0x8'),auth[_0xa0c1('0x3')](),controller[_0xa0c1('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa0c1('0xa')]);router[_0xa0c1('0xb')](_0xa0c1('0x8'),auth[_0xa0c1('0x3')](),controller['update']);router['put'](_0xa0c1('0xc'),auth[_0xa0c1('0x3')](),controller[_0xa0c1('0xd')]);router[_0xa0c1('0xe')](_0xa0c1('0x8'),auth['isAuthenticated'](),controller[_0xa0c1('0xf')]);module[_0xa0c1('0x10')]=router; \ No newline at end of file +var _0x0d6b=['../../components/auth/service','isAuthenticated','index','get','/describe','/:id','post','create','put','updateWithRetry','delete','destroy','exports','express','Router'];(function(_0x151911,_0x4de5d6){var _0x18e43d=function(_0x5f4afa){while(--_0x5f4afa){_0x151911['push'](_0x151911['shift']());}};_0x18e43d(++_0x4de5d6);}(_0x0d6b,0xd0));var _0xb0d6=function(_0x5bccb9,_0x1eb18f){_0x5bccb9=_0x5bccb9-0x0;var _0x531ac6=_0x0d6b[_0x5bccb9];return _0x531ac6;};'use strict';var express=require(_0xb0d6('0x0'));var router=express[_0xb0d6('0x1')]();var auth=require(_0xb0d6('0x2'));var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0xb0d6('0x3')](),controller[_0xb0d6('0x4')]);router[_0xb0d6('0x5')](_0xb0d6('0x6'),auth[_0xb0d6('0x3')](),controller['describe']);router[_0xb0d6('0x5')](_0xb0d6('0x7'),auth[_0xb0d6('0x3')](),controller['show']);router[_0xb0d6('0x8')]('/',auth['isAuthenticated'](),controller[_0xb0d6('0x9')]);router['put'](_0xb0d6('0x7'),auth[_0xb0d6('0x3')](),controller['update']);router[_0xb0d6('0xa')]('/with-retry/:id',auth[_0xb0d6('0x3')](),controller[_0xb0d6('0xb')]);router[_0xb0d6('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb0d6('0xd')]);module[_0xb0d6('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0fbc1ab..f89d88d 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 _0x2854=['outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','inbound','internal','outbound','inbound-fax'];(function(_0x223b8a,_0x3e07f1){var _0x1cd19e=function(_0x3ec3f3){while(--_0x3ec3f3){_0x223b8a['push'](_0x223b8a['shift']());}};_0x1cd19e(++_0x3e07f1);}(_0x2854,0xaa));var _0x4285=function(_0x2b9b09,_0x409311){_0x2b9b09=_0x2b9b09-0x0;var _0x3a82cd=_0x2854[_0x2b9b09];return _0x3a82cd;};'use strict';var Sequelize=require(_0x4285('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4285('0x1')]},'type':{'type':Sequelize['ENUM'](_0x4285('0x2'),_0x4285('0x3'),_0x4285('0x4'),_0x4285('0x5'),_0x4285('0x6'),_0x4285('0x7'))},'tag':{'type':Sequelize[_0x4285('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x4285('0x1')]},'callerid':{'type':Sequelize[_0x4285('0x1')]},'channel':{'type':Sequelize[_0x4285('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x4285('0x1')]},'lastdata':{'type':Sequelize[_0x4285('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x4285('0x9')]},'answertime':{'type':Sequelize[_0x4285('0x9')]},'endtime':{'type':Sequelize[_0x4285('0x9')]},'duration':{'type':Sequelize[_0x4285('0xa')]},'billableseconds':{'type':Sequelize[_0x4285('0xa')]},'mohtime':{'type':Sequelize[_0x4285('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4285('0x1')]},'amaflags':{'type':Sequelize[_0x4285('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x4285('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x4285('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x4285('0x1')]},'note':{'type':Sequelize[_0x4285('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x4285('0xa')]},'sipcallid':{'type':Sequelize[_0x4285('0x1')]}}; \ No newline at end of file +var _0x6215=['INTEGER','sequelize','exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE'];(function(_0xdcda3,_0x4252fb){var _0x2bec82=function(_0x589fe2){while(--_0x589fe2){_0xdcda3['push'](_0xdcda3['shift']());}};_0x2bec82(++_0x4252fb);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5621('0x0'));module[_0x5621('0x1')]={'uniqueid':{'type':Sequelize[_0x5621('0x2')]},'type':{'type':Sequelize['ENUM'](_0x5621('0x3'),_0x5621('0x4'),_0x5621('0x5'),_0x5621('0x6'),_0x5621('0x7'),_0x5621('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x5621('0x2')]},'callerid':{'type':Sequelize[_0x5621('0x2')]},'channel':{'type':Sequelize[_0x5621('0x2')]},'destinationchannel':{'type':Sequelize[_0x5621('0x2')]},'lastapplication':{'type':Sequelize[_0x5621('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x5621('0x9')]},'systemanswertime':{'type':Sequelize[_0x5621('0x9')]},'answertime':{'type':Sequelize[_0x5621('0x9')]},'endtime':{'type':Sequelize[_0x5621('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x5621('0xa')]},'mohtime':{'type':Sequelize[_0x5621('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5621('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x5621('0x2')]},'userDisposition':{'type':Sequelize[_0x5621('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x5621('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x5621('0x2')]},'note':{'type':Sequelize[_0x5621('0x2')]},'prefix':{'type':Sequelize[_0x5621('0x2')]},'routeid':{'type':Sequelize[_0x5621('0xa')]},'sipcallid':{'type':Sequelize[_0x5621('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e249167..4dddc30 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 _0x3e74=['json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','type','key','query','keys','filters','model','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','fields','include','find','create','body','describe','user','uniqueid','lodash','../../config/logger','api','../../mysqldb','status'];(function(_0x2db19d,_0x231893){var _0x1030a8=function(_0x10f0e4){while(--_0x10f0e4){_0x2db19d['push'](_0x2db19d['shift']());}};_0x1030a8(++_0x231893);}(_0x3e74,0x175));var _0x43e7=function(_0x391d89,_0x23d1b9){_0x391d89=_0x391d89-0x0;var _0xa390b6=_0x3e74[_0x391d89];return _0xa390b6;};'use strict';var _=require(_0x43e7('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var db=require(_0x43e7('0x3'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x490ced,_0xc58479){_0xc58479=_0xc58479||0xc8;return function(_0x4f9bbe){if(_0x4f9bbe){return _0x490ced[_0x43e7('0x4')](_0xc58479)[_0x43e7('0x5')](_0x4f9bbe);}};}function respondWithFilteredResult(_0xe78cb7,_0x1c503b){return function(_0xc98b9c){if(_0xc98b9c){var _0x503698=typeof _0x1c503b[_0x43e7('0x6')]===_0x43e7('0x7')&&typeof _0x1c503b[_0x43e7('0x8')]===_0x43e7('0x7');var _0x21f491=_0xc98b9c['count'];var _0x212c6c=_0x503698?0x0:_0x1c503b['offset'];var _0x54948c=_0x503698?_0xc98b9c[_0x43e7('0x9')]:_0x1c503b[_0x43e7('0x6')]+_0x1c503b['limit'];var _0x2803d9;if(_0x54948c>=_0x21f491){_0x54948c=_0x21f491;_0x2803d9=0xc8;}else{_0x2803d9=0xce;}_0xe78cb7['status'](_0x2803d9);return _0xe78cb7[_0x43e7('0xa')](_0x43e7('0xb'),_0x212c6c+'-'+_0x54948c+'/'+_0x21f491)['json'](_0xc98b9c);}return null;};}function saveUpdates(_0x3eb206){return function(_0xc960ea){if(_0xc960ea){return _0xc960ea[_0x43e7('0xc')](_0x3eb206)[_0x43e7('0xd')](function(_0x4e008c){return _0x4e008c;});}return null;};}function removeEntity(_0x583d85){return function(_0x2fcb36){if(_0x2fcb36){return _0x2fcb36[_0x43e7('0xe')]()[_0x43e7('0xd')](function(){_0x583d85['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16849c){return function(_0x14c146){if(!_0x14c146){_0x16849c[_0x43e7('0xf')](0x194);}return _0x14c146;};}function handleError(_0x328445,_0x4de324){_0x4de324=_0x4de324||0x1f4;return function(_0x5c4eaa){logger[_0x43e7('0x10')](_0x5c4eaa[_0x43e7('0x11')]);if(_0x5c4eaa[_0x43e7('0x12')]){delete _0x5c4eaa['name'];}_0x328445['status'](_0x4de324)[_0x43e7('0x13')](_0x5c4eaa);};}exports[_0x43e7('0x14')]=function(_0x9037d3,_0x140657){var _0x3776f5={},_0x1f24fb={},_0x619236={'count':0x0,'rows':[]};var _0x1441ef=_[_0x43e7('0x15')](db[_0x43e7('0x16')][_0x43e7('0x17')],function(_0x177ee1){return{'name':_0x177ee1['fieldName'],'type':_0x177ee1[_0x43e7('0x18')][_0x43e7('0x19')]};});_0x1f24fb['model']=_[_0x43e7('0x15')](_0x1441ef,_0x43e7('0x12'));_0x1f24fb[_0x43e7('0x1a')]=_[_0x43e7('0x1b')](_0x9037d3[_0x43e7('0x1a')]);_0x1f24fb[_0x43e7('0x1c')]=_['intersection'](_0x1f24fb[_0x43e7('0x1d')],_0x1f24fb['query']);_0x3776f5['attributes']=_[_0x43e7('0x1e')](_0x1f24fb[_0x43e7('0x1d')],qs['fields'](_0x9037d3[_0x43e7('0x1a')]['fields']));_0x3776f5[_0x43e7('0x1f')]=_0x3776f5['attributes'][_0x43e7('0x20')]?_0x3776f5[_0x43e7('0x1f')]:_0x1f24fb[_0x43e7('0x1d')];if(!_0x9037d3[_0x43e7('0x1a')]['hasOwnProperty']('nolimit')){_0x3776f5[_0x43e7('0x8')]=qs['limit'](_0x9037d3[_0x43e7('0x1a')][_0x43e7('0x8')]);_0x3776f5[_0x43e7('0x6')]=qs[_0x43e7('0x6')](_0x9037d3['query'][_0x43e7('0x6')]);}_0x3776f5[_0x43e7('0x21')]=qs[_0x43e7('0x22')](_0x9037d3[_0x43e7('0x1a')][_0x43e7('0x22')]);_0x3776f5[_0x43e7('0x23')]=qs[_0x43e7('0x1c')](_[_0x43e7('0x24')](_0x9037d3[_0x43e7('0x1a')],_0x1f24fb[_0x43e7('0x1c')]),_0x1441ef);if(_0x9037d3[_0x43e7('0x1a')][_0x43e7('0x25')]){_0x3776f5[_0x43e7('0x23')]=_[_0x43e7('0x26')](_0x3776f5['where'],{'$or':_[_0x43e7('0x15')](_0x1441ef,function(_0x44f6b0){if(_0x44f6b0[_0x43e7('0x18')]!==_0x43e7('0x27')){var _0x4251c8={};_0x4251c8[_0x44f6b0['name']]={'$like':'%'+_0x9037d3[_0x43e7('0x1a')][_0x43e7('0x25')]+'%'};return _0x4251c8;}})});}_0x3776f5=_[_0x43e7('0x26')]({},_0x3776f5,_0x9037d3[_0x43e7('0x28')]);var _0x4c61b9={'where':_0x3776f5['where']};return db['VoiceCallReport'][_0x43e7('0x9')](_0x4c61b9)[_0x43e7('0xd')](function(_0x117c07){_0x619236[_0x43e7('0x9')]=_0x117c07;if(_0x9037d3[_0x43e7('0x1a')][_0x43e7('0x29')]){_0x3776f5['include']=[{'attributes':['id','name','fullname','alias'],'model':db['User'],'as':'User'}];}return db['VoiceCallReport'][_0x43e7('0x2a')](_0x3776f5);})['then'](function(_0x2b4bfd){_0x619236[_0x43e7('0x2b')]=_0x2b4bfd;return _0x619236;})[_0x43e7('0xd')](respondWithFilteredResult(_0x140657,_0x3776f5))[_0x43e7('0x2c')](handleError(_0x140657,null));};exports[_0x43e7('0x2d')]=function(_0x449803,_0x101d45){var _0x4f1a5f={'raw':!![],'where':{'id':_0x449803['params']['id']}},_0x5332d9={};_0x5332d9[_0x43e7('0x1d')]=_[_0x43e7('0x1b')](db[_0x43e7('0x16')][_0x43e7('0x17')]);_0x5332d9[_0x43e7('0x1a')]=_[_0x43e7('0x1b')](_0x449803[_0x43e7('0x1a')]);_0x5332d9[_0x43e7('0x1c')]=_['intersection'](_0x5332d9[_0x43e7('0x1d')],_0x5332d9[_0x43e7('0x1a')]);_0x4f1a5f['attributes']=_[_0x43e7('0x1e')](_0x5332d9['model'],qs[_0x43e7('0x2e')](_0x449803[_0x43e7('0x1a')][_0x43e7('0x2e')]));_0x4f1a5f[_0x43e7('0x1f')]=_0x4f1a5f[_0x43e7('0x1f')][_0x43e7('0x20')]?_0x4f1a5f['attributes']:_0x5332d9['model'];if(_0x449803[_0x43e7('0x1a')][_0x43e7('0x29')]){_0x4f1a5f[_0x43e7('0x2f')]=[{'all':!![]}];}_0x4f1a5f=_[_0x43e7('0x26')]({},_0x4f1a5f,_0x449803[_0x43e7('0x28')]);return db['VoiceCallReport'][_0x43e7('0x30')](_0x4f1a5f)[_0x43e7('0xd')](handleEntityNotFound(_0x101d45,null))['then'](respondWithResult(_0x101d45,null))[_0x43e7('0x2c')](handleError(_0x101d45,null));};exports['create']=function(_0x2ad8ef,_0x504101){return db[_0x43e7('0x16')][_0x43e7('0x31')](_0x2ad8ef[_0x43e7('0x32')],{})[_0x43e7('0xd')](respondWithResult(_0x504101,0xc9))['catch'](handleError(_0x504101,null));};exports['destroy']=function(_0x103393,_0x40c509){return db[_0x43e7('0x16')][_0x43e7('0x30')]({'where':{'id':_0x103393['params']['id']}})['then'](handleEntityNotFound(_0x40c509,null))['then'](removeEntity(_0x40c509,null))[_0x43e7('0x2c')](handleError(_0x40c509,null));};exports['describe']=function(_0x2ab022,_0x4b3a59){return db['VoiceCallReport'][_0x43e7('0x33')]()['then'](respondWithResult(_0x4b3a59,null))[_0x43e7('0x2c')](handleError(_0x4b3a59,null));};function findForUpdate(_0x39db7f){return db[_0x43e7('0x16')][_0x43e7('0x30')]({'where':{'uniqueid':_0x39db7f['params']['id'],'UserId':{'$or':[null,_0x39db7f[_0x43e7('0x34')]['id']]}}});}exports[_0x43e7('0xc')]=function(_0x23a611,_0x1fd277){if(_0x23a611[_0x43e7('0x32')][_0x43e7('0x35')]){delete _0x23a611['body']['uniqueid'];}return findForUpdate(_0x23a611)[_0x43e7('0xd')](handleEntityNotFound(_0x1fd277,null))[_0x43e7('0xd')](saveUpdates(_0x23a611[_0x43e7('0x32')],null))['then'](respondWithResult(_0x1fd277,null))['catch'](handleError(_0x1fd277,null));};exports['updateWithRetry']=function(_0x292ded,_0x42ed10,_0x52b098){if(_0x292ded[_0x43e7('0x32')][_0x43e7('0x35')]){delete _0x292ded[_0x43e7('0x32')]['uniqueid'];}promiseRetry(function(){return findForUpdate(_0x292ded);},{'retries':0x6,'minTimeout':0xfa})['then'](function(_0x4ec263){if(!_0x4ec263){return new Promise(function(_0x4de644){_0x4de644(handleEntityNotFound(_0x42ed10)());});}else{return _0x4ec263[_0x43e7('0xc')](_0x292ded[_0x43e7('0x32')])['then'](function(_0x23e7cb){return respondWithResult(_0x42ed10)(_0x23e7cb);});}},function(){handleEntityNotFound(_0x42ed10)();});}; \ No newline at end of file +var _0x7217=['find','create','describe','params','user','body','uniqueid','updateWithRetry','lodash','../../config/logger','api','../../mysqldb','promise-retry','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','map','VoiceCallReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','keys','options'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0x7217,0x19e));var _0x7721=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7217[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x7721('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var db=require(_0x7721('0x3'))['db'];const promiseRetry=require(_0x7721('0x4'));function respondWithResult(_0x115ab3,_0x4d6446){_0x4d6446=_0x4d6446||0xc8;return function(_0x5bf160){if(_0x5bf160){return _0x115ab3[_0x7721('0x5')](_0x4d6446)[_0x7721('0x6')](_0x5bf160);}};}function respondWithFilteredResult(_0x46415c,_0x3fe47c){return function(_0xb239e0){if(_0xb239e0){var _0xf7ff37=typeof _0x3fe47c[_0x7721('0x7')]===_0x7721('0x8')&&typeof _0x3fe47c[_0x7721('0x9')]===_0x7721('0x8');var _0x3e6368=_0xb239e0[_0x7721('0xa')];var _0xfa8835=_0xf7ff37?0x0:_0x3fe47c[_0x7721('0x7')];var _0x2c3986=_0xf7ff37?_0xb239e0['count']:_0x3fe47c[_0x7721('0x7')]+_0x3fe47c[_0x7721('0x9')];var _0x8729a6;if(_0x2c3986>=_0x3e6368){_0x2c3986=_0x3e6368;_0x8729a6=0xc8;}else{_0x8729a6=0xce;}_0x46415c[_0x7721('0x5')](_0x8729a6);return _0x46415c[_0x7721('0xb')](_0x7721('0xc'),_0xfa8835+'-'+_0x2c3986+'/'+_0x3e6368)[_0x7721('0x6')](_0xb239e0);}return null;};}function saveUpdates(_0x27b36b){return function(_0x55b4ca){if(_0x55b4ca){return _0x55b4ca[_0x7721('0xd')](_0x27b36b)[_0x7721('0xe')](function(_0x57ff6d){return _0x57ff6d;});}return null;};}function removeEntity(_0x109900){return function(_0x30da54){if(_0x30da54){return _0x30da54[_0x7721('0xf')]()[_0x7721('0xe')](function(){_0x109900['status'](0xcc)[_0x7721('0x10')]();});}};}function handleEntityNotFound(_0x25b1c0){return function(_0x534f1b){if(!_0x534f1b){_0x25b1c0['sendStatus'](0x194);}return _0x534f1b;};}function handleError(_0x4b183e,_0x5ed54){_0x5ed54=_0x5ed54||0x1f4;return function(_0x25a628){logger[_0x7721('0x11')](_0x25a628[_0x7721('0x12')]);if(_0x25a628['name']){delete _0x25a628[_0x7721('0x13')];}_0x4b183e['status'](_0x5ed54)[_0x7721('0x14')](_0x25a628);};}exports['index']=function(_0xfec626,_0x4e96fb){var _0x3ab5a5={},_0x3e140d={},_0x2286e5={'count':0x0,'rows':[]};var _0x40af90=_[_0x7721('0x15')](db[_0x7721('0x16')][_0x7721('0x17')],function(_0xaeccc4){return{'name':_0xaeccc4['fieldName'],'type':_0xaeccc4[_0x7721('0x18')][_0x7721('0x19')]};});_0x3e140d[_0x7721('0x1a')]=_[_0x7721('0x15')](_0x40af90,'name');_0x3e140d[_0x7721('0x1b')]=_['keys'](_0xfec626[_0x7721('0x1b')]);_0x3e140d[_0x7721('0x1c')]=_[_0x7721('0x1d')](_0x3e140d[_0x7721('0x1a')],_0x3e140d[_0x7721('0x1b')]);_0x3ab5a5[_0x7721('0x1e')]=_[_0x7721('0x1d')](_0x3e140d['model'],qs[_0x7721('0x1f')](_0xfec626[_0x7721('0x1b')][_0x7721('0x1f')]));_0x3ab5a5[_0x7721('0x1e')]=_0x3ab5a5[_0x7721('0x1e')][_0x7721('0x20')]?_0x3ab5a5[_0x7721('0x1e')]:_0x3e140d[_0x7721('0x1a')];if(!_0xfec626[_0x7721('0x1b')]['hasOwnProperty'](_0x7721('0x21'))){_0x3ab5a5['limit']=qs['limit'](_0xfec626[_0x7721('0x1b')][_0x7721('0x9')]);_0x3ab5a5[_0x7721('0x7')]=qs[_0x7721('0x7')](_0xfec626[_0x7721('0x1b')][_0x7721('0x7')]);}_0x3ab5a5[_0x7721('0x22')]=qs[_0x7721('0x23')](_0xfec626['query'][_0x7721('0x23')]);_0x3ab5a5[_0x7721('0x24')]=qs['filters'](_['pick'](_0xfec626[_0x7721('0x1b')],_0x3e140d[_0x7721('0x1c')]),_0x40af90);if(_0xfec626['query'][_0x7721('0x25')]){_0x3ab5a5[_0x7721('0x24')]=_[_0x7721('0x26')](_0x3ab5a5['where'],{'$or':_[_0x7721('0x15')](_0x40af90,function(_0x1ff31b){if(_0x1ff31b[_0x7721('0x18')]!==_0x7721('0x27')){var _0xc0f3c4={};_0xc0f3c4[_0x1ff31b['name']]={'$like':'%'+_0xfec626[_0x7721('0x1b')][_0x7721('0x25')]+'%'};return _0xc0f3c4;}})});}_0x3ab5a5=_[_0x7721('0x26')]({},_0x3ab5a5,_0xfec626['options']);var _0x35de7a={'where':_0x3ab5a5[_0x7721('0x24')]};return db['VoiceCallReport'][_0x7721('0xa')](_0x35de7a)['then'](function(_0x2d6ba0){_0x2286e5[_0x7721('0xa')]=_0x2d6ba0;if(_0xfec626[_0x7721('0x1b')][_0x7721('0x28')]){_0x3ab5a5[_0x7721('0x29')]=[{'attributes':['id',_0x7721('0x13'),_0x7721('0x2a'),_0x7721('0x2b')],'model':db[_0x7721('0x2c')],'as':_0x7721('0x2c')}];}return db[_0x7721('0x16')]['findAll'](_0x3ab5a5);})[_0x7721('0xe')](function(_0x5e6663){_0x2286e5[_0x7721('0x2d')]=_0x5e6663;return _0x2286e5;})[_0x7721('0xe')](respondWithFilteredResult(_0x4e96fb,_0x3ab5a5))[_0x7721('0x2e')](handleError(_0x4e96fb,null));};exports[_0x7721('0x2f')]=function(_0x3968f3,_0x378ba5){var _0x482b70={'raw':!![],'where':{'id':_0x3968f3['params']['id']}},_0x557c34={};_0x557c34['model']=_[_0x7721('0x30')](db[_0x7721('0x16')][_0x7721('0x17')]);_0x557c34[_0x7721('0x1b')]=_['keys'](_0x3968f3[_0x7721('0x1b')]);_0x557c34['filters']=_[_0x7721('0x1d')](_0x557c34[_0x7721('0x1a')],_0x557c34['query']);_0x482b70[_0x7721('0x1e')]=_[_0x7721('0x1d')](_0x557c34['model'],qs['fields'](_0x3968f3[_0x7721('0x1b')][_0x7721('0x1f')]));_0x482b70[_0x7721('0x1e')]=_0x482b70[_0x7721('0x1e')]['length']?_0x482b70[_0x7721('0x1e')]:_0x557c34[_0x7721('0x1a')];if(_0x3968f3[_0x7721('0x1b')][_0x7721('0x28')]){_0x482b70[_0x7721('0x29')]=[{'all':!![]}];}_0x482b70=_['merge']({},_0x482b70,_0x3968f3[_0x7721('0x31')]);return db['VoiceCallReport'][_0x7721('0x32')](_0x482b70)['then'](handleEntityNotFound(_0x378ba5,null))[_0x7721('0xe')](respondWithResult(_0x378ba5,null))[_0x7721('0x2e')](handleError(_0x378ba5,null));};exports[_0x7721('0x33')]=function(_0x49e0c5,_0x1453d4){return db[_0x7721('0x16')][_0x7721('0x33')](_0x49e0c5['body'],{})[_0x7721('0xe')](respondWithResult(_0x1453d4,0xc9))[_0x7721('0x2e')](handleError(_0x1453d4,null));};exports[_0x7721('0xf')]=function(_0x2d5f35,_0x135dbc){return db[_0x7721('0x16')][_0x7721('0x32')]({'where':{'id':_0x2d5f35['params']['id']}})['then'](handleEntityNotFound(_0x135dbc,null))[_0x7721('0xe')](removeEntity(_0x135dbc,null))[_0x7721('0x2e')](handleError(_0x135dbc,null));};exports[_0x7721('0x34')]=function(_0x39a3ad,_0x335145){return db[_0x7721('0x16')][_0x7721('0x34')]()[_0x7721('0xe')](respondWithResult(_0x335145,null))[_0x7721('0x2e')](handleError(_0x335145,null));};function findForUpdate(_0x3af123){return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x3af123[_0x7721('0x35')]['id'],'UserId':{'$or':[null,_0x3af123[_0x7721('0x36')]['id']]}}});}exports[_0x7721('0xd')]=function(_0x219c9f,_0x589e95){if(_0x219c9f[_0x7721('0x37')][_0x7721('0x38')]){delete _0x219c9f['body'][_0x7721('0x38')];}return findForUpdate(_0x219c9f)['then'](handleEntityNotFound(_0x589e95,null))[_0x7721('0xe')](saveUpdates(_0x219c9f['body'],null))[_0x7721('0xe')](respondWithResult(_0x589e95,null))[_0x7721('0x2e')](handleError(_0x589e95,null));};exports[_0x7721('0x39')]=function(_0x4eda58,_0x2d18dd,_0x20fbbb){if(_0x4eda58['body'][_0x7721('0x38')]){delete _0x4eda58[_0x7721('0x37')][_0x7721('0x38')];}promiseRetry(function(){return findForUpdate(_0x4eda58);},{'retries':0x6,'minTimeout':0xfa})['then'](function(_0x20ba21){if(!_0x20ba21){return new Promise(function(_0x5a32b6){_0x5a32b6(handleEntityNotFound(_0x2d18dd)());});}else{return _0x20ba21[_0x7721('0xd')](_0x4eda58[_0x7721('0x37')])[_0x7721('0xe')](function(_0x443503){return respondWithResult(_0x2d18dd)(_0x443503);});}},function(){handleEntityNotFound(_0x2d18dd)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 051516e..5ce3cb3 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 _0x9993=['request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x9993,0xfa));var _0x3999=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x9993[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x3999('0x0'));var util=require(_0x3999('0x1'));var logger=require(_0x3999('0x2'))('api');var moment=require(_0x3999('0x3'));var BPromise=require(_0x3999('0x4'));var rp=require(_0x3999('0x5'));var fs=require('fs');var path=require(_0x3999('0x6'));var rimraf=require(_0x3999('0x7'));var config=require(_0x3999('0x8'));var attributes=require(_0x3999('0x9'));module[_0x3999('0xa')]=function(_0x370e75,_0x20ace2){return _0x370e75[_0x3999('0xb')](_0x3999('0xc'),attributes,{'tableName':_0x3999('0xd'),'paranoid':![],'indexes':[{'fields':[_0x3999('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f0a=['report_call','uniqueid','../../config/logger','rimraf','../../config/environment','exports','define','VoiceCallReport'];(function(_0x3fd49b,_0x22657c){var _0x463bc6=function(_0x3d1882){while(--_0x3d1882){_0x3fd49b['push'](_0x3fd49b['shift']());}};_0x463bc6(++_0x22657c);}(_0x3f0a,0x19a));var _0xa3f0=function(_0xf70b7a,_0x273b99){_0xf70b7a=_0xf70b7a-0x0;var _0x71f26b=_0x3f0a[_0xf70b7a];return _0x71f26b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3f0('0x0'))('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(_0xa3f0('0x1'));var config=require(_0xa3f0('0x2'));var attributes=require('./voiceCallReport.attributes');module[_0xa3f0('0x3')]=function(_0x517775,_0x417bda){return _0x517775[_0xa3f0('0x4')](_0xa3f0('0x5'),attributes,{'tableName':_0xa3f0('0x6'),'paranoid':![],'indexes':[{'fields':[_0xa3f0('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 934bb3a..bd4f956 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 _0xf6a8=['raw','where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','VoiceCallReport','options'];(function(_0x1bb6ce,_0x52d276){var _0x29ba72=function(_0x3ae2ec){while(--_0x3ae2ec){_0x1bb6ce['push'](_0x1bb6ce['shift']());}};_0x29ba72(++_0x52d276);}(_0xf6a8,0x1ed));var _0x8f6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6a8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8f6a('0x0'));var util=require(_0x8f6a('0x1'));var moment=require(_0x8f6a('0x2'));var BPromise=require(_0x8f6a('0x3'));var rs=require(_0x8f6a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8f6a('0x5'));var logger=require(_0x8f6a('0x6'))(_0x8f6a('0x7'));var config=require(_0x8f6a('0x8'));var jayson=require(_0x8f6a('0x9'));var client=jayson[_0x8f6a('0xa')][_0x8f6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x283417,_0x1dcbfe,_0x49c942){return new BPromise(function(_0x106774,_0x22c2a0){return client[_0x8f6a('0xc')](_0x283417,_0x49c942)[_0x8f6a('0xd')](function(_0x3422fc){logger[_0x8f6a('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x1dcbfe,'request\x20sent');logger[_0x8f6a('0xf')](_0x8f6a('0x10'),_0x1dcbfe,_0x8f6a('0x11'),JSON[_0x8f6a('0x12')](_0x3422fc));if(_0x3422fc[_0x8f6a('0x13')]){if(_0x3422fc[_0x8f6a('0x13')][_0x8f6a('0x14')]===0x1f4){logger[_0x8f6a('0x13')](_0x8f6a('0x15'),_0x1dcbfe,_0x3422fc[_0x8f6a('0x13')]['message']);return _0x22c2a0(_0x3422fc[_0x8f6a('0x13')][_0x8f6a('0x16')]);}logger[_0x8f6a('0x13')](_0x8f6a('0x15'),_0x1dcbfe,_0x3422fc[_0x8f6a('0x13')][_0x8f6a('0x16')]);return _0x106774(_0x3422fc[_0x8f6a('0x13')][_0x8f6a('0x16')]);}else{logger[_0x8f6a('0xe')](_0x8f6a('0x15'),_0x1dcbfe,_0x8f6a('0x11'));_0x106774(_0x3422fc[_0x8f6a('0x17')][_0x8f6a('0x16')]);}})[_0x8f6a('0x18')](function(_0x2d2890){logger[_0x8f6a('0x13')](_0x8f6a('0x15'),_0x1dcbfe,_0x2d2890);_0x22c2a0(_0x2d2890);});});}exports['GetVoiceCallReport']=function(_0x1cdabb){var _0x2fd945=this;return new Promise(function(_0x27003c,_0x12c49){return db[_0x8f6a('0x19')]['findAll']({'raw':_0x1cdabb[_0x8f6a('0x1a')]?_0x1cdabb[_0x8f6a('0x1a')][_0x8f6a('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cdabb[_0x8f6a('0x1a')]?_0x1cdabb['options'][_0x8f6a('0x1c')]||null:null,'attributes':_0x1cdabb[_0x8f6a('0x1a')]?_0x1cdabb[_0x8f6a('0x1a')][_0x8f6a('0x1d')]||null:null,'limit':_0x1cdabb[_0x8f6a('0x1a')]?_0x1cdabb[_0x8f6a('0x1a')][_0x8f6a('0x1e')]||null:null,'include':_0x1cdabb[_0x8f6a('0x1a')]?_0x1cdabb['options'][_0x8f6a('0x1f')]?_['map'](_0x1cdabb[_0x8f6a('0x1a')]['include'],function(_0x1654ff){return{'model':db[_0x1654ff['model']],'as':_0x1654ff['as'],'attributes':_0x1654ff['attributes'],'include':_0x1654ff[_0x8f6a('0x1f')]?_[_0x8f6a('0x20')](_0x1654ff['include'],function(_0x392b89){return{'model':db[_0x392b89['model']],'as':_0x392b89['as'],'attributes':_0x392b89[_0x8f6a('0x1d')],'include':_0x392b89['include']?_[_0x8f6a('0x20')](_0x392b89[_0x8f6a('0x1f')],function(_0x400eae){return{'model':db[_0x400eae[_0x8f6a('0x21')]],'as':_0x400eae['as'],'attributes':_0x400eae[_0x8f6a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8f6a('0xd')](function(_0x35d3b5){logger['info']('GetVoiceCallReport',_0x1cdabb);logger['debug'](_0x8f6a('0x22'),_0x1cdabb,JSON[_0x8f6a('0x12')](_0x35d3b5));_0x27003c(_0x35d3b5);})[_0x8f6a('0x18')](function(_0x22afb3){logger['error'](_0x8f6a('0x22'),_0x22afb3['message'],_0x1cdabb);_0x12c49(_0x2fd945[_0x8f6a('0x13')](0x1f4,_0x22afb3[_0x8f6a('0x16')]));});});};exports[_0x8f6a('0x23')]=function(_0x3c2cd9){var _0x313348=this;return new Promise(function(_0x23eeed,_0x522952){return db[_0x8f6a('0x19')][_0x8f6a('0x24')](_0x3c2cd9[_0x8f6a('0x25')],{'raw':_0x3c2cd9[_0x8f6a('0x1a')]?_0x3c2cd9[_0x8f6a('0x1a')][_0x8f6a('0x1b')]===undefined?!![]:![]:!![]})[_0x8f6a('0xd')](function(_0x24974e){logger['info'](_0x8f6a('0x23'),_0x3c2cd9);logger[_0x8f6a('0xf')](_0x8f6a('0x23'),_0x3c2cd9,JSON[_0x8f6a('0x12')](_0x24974e));_0x23eeed(_0x24974e);})['catch'](function(_0x303972){logger['error'](_0x8f6a('0x23'),_0x303972[_0x8f6a('0x16')],_0x3c2cd9);_0x522952(_0x313348['error'](0x1f4,_0x303972[_0x8f6a('0x16')]));});});};exports[_0x8f6a('0x26')]=function(_0x42c8d3){var _0x5bf3dd=this;return new Promise(function(_0x4bcef4,_0x43b749){return db[_0x8f6a('0x19')][_0x8f6a('0x27')](_0x42c8d3[_0x8f6a('0x25')],{'raw':_0x42c8d3[_0x8f6a('0x1a')]?_0x42c8d3[_0x8f6a('0x1a')][_0x8f6a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42c8d3[_0x8f6a('0x1a')]?_0x42c8d3[_0x8f6a('0x1a')][_0x8f6a('0x1c')]||null:null,'attributes':_0x42c8d3[_0x8f6a('0x1a')]?_0x42c8d3[_0x8f6a('0x1a')][_0x8f6a('0x1d')]||null:null,'limit':_0x42c8d3[_0x8f6a('0x1a')]?_0x42c8d3['options'][_0x8f6a('0x1e')]||null:null})['then'](function(_0x51fc6f){logger[_0x8f6a('0xe')](_0x8f6a('0x26'),_0x42c8d3);logger[_0x8f6a('0xf')](_0x8f6a('0x26'),_0x42c8d3,JSON[_0x8f6a('0x12')](_0x51fc6f));_0x4bcef4(_0x51fc6f);})[_0x8f6a('0x18')](function(_0x9ac7ca){logger[_0x8f6a('0x13')]('UpdateVoiceCallReport',_0x9ac7ca['message'],_0x42c8d3);_0x43b749(_0x5bf3dd[_0x8f6a('0x13')](0x1f4,_0x9ac7ca[_0x8f6a('0x16')]));});});}; \ No newline at end of file +var _0x9125=['result','findAll','options','raw','where','attributes','limit','include','map','model','catch','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s'];(function(_0x13c1f6,_0x47fbd2){var _0x5800b5=function(_0x19e602){while(--_0x19e602){_0x13c1f6['push'](_0x13c1f6['shift']());}};_0x5800b5(++_0x47fbd2);}(_0x9125,0x152));var _0x5912=function(_0x500a1f,_0x14745f){_0x500a1f=_0x500a1f-0x0;var _0x2f5bd7=_0x9125[_0x500a1f];return _0x2f5bd7;};'use strict';var _=require(_0x5912('0x0'));var util=require(_0x5912('0x1'));var moment=require(_0x5912('0x2'));var BPromise=require(_0x5912('0x3'));var rs=require(_0x5912('0x4'));var fs=require('fs');var Redis=require(_0x5912('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5912('0x6'));var logger=require(_0x5912('0x7'))(_0x5912('0x8'));var config=require('../../config/environment');var jayson=require(_0x5912('0x9'));var client=jayson[_0x5912('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x180be6,_0x1d2ffd,_0x49a572){return new BPromise(function(_0x1556b0,_0x382346){return client[_0x5912('0xb')](_0x180be6,_0x49a572)[_0x5912('0xc')](function(_0x292b06){logger[_0x5912('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x1d2ffd,_0x5912('0xe'));logger[_0x5912('0xf')](_0x5912('0x10'),_0x1d2ffd,_0x5912('0xe'),JSON[_0x5912('0x11')](_0x292b06));if(_0x292b06['error']){if(_0x292b06[_0x5912('0x12')][_0x5912('0x13')]===0x1f4){logger[_0x5912('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x1d2ffd,_0x292b06[_0x5912('0x12')][_0x5912('0x14')]);return _0x382346(_0x292b06[_0x5912('0x12')]['message']);}logger['error'](_0x5912('0x15'),_0x1d2ffd,_0x292b06['error'][_0x5912('0x14')]);return _0x1556b0(_0x292b06['error'][_0x5912('0x14')]);}else{logger[_0x5912('0xd')](_0x5912('0x15'),_0x1d2ffd,'request\x20sent');_0x1556b0(_0x292b06[_0x5912('0x16')][_0x5912('0x14')]);}})['catch'](function(_0x13924c){logger[_0x5912('0x12')](_0x5912('0x15'),_0x1d2ffd,_0x13924c);_0x382346(_0x13924c);});});}exports['GetVoiceCallReport']=function(_0x46c4a3){var _0x26c492=this;return new Promise(function(_0x2162a4,_0x21b1f2){return db['VoiceCallReport'][_0x5912('0x17')]({'raw':_0x46c4a3[_0x5912('0x18')]?_0x46c4a3[_0x5912('0x18')][_0x5912('0x19')]===undefined?!![]:![]:!![],'where':_0x46c4a3[_0x5912('0x18')]?_0x46c4a3[_0x5912('0x18')][_0x5912('0x1a')]||null:null,'attributes':_0x46c4a3[_0x5912('0x18')]?_0x46c4a3['options'][_0x5912('0x1b')]||null:null,'limit':_0x46c4a3['options']?_0x46c4a3[_0x5912('0x18')][_0x5912('0x1c')]||null:null,'include':_0x46c4a3[_0x5912('0x18')]?_0x46c4a3[_0x5912('0x18')][_0x5912('0x1d')]?_[_0x5912('0x1e')](_0x46c4a3[_0x5912('0x18')][_0x5912('0x1d')],function(_0xa0c6cf){return{'model':db[_0xa0c6cf[_0x5912('0x1f')]],'as':_0xa0c6cf['as'],'attributes':_0xa0c6cf['attributes'],'include':_0xa0c6cf['include']?_[_0x5912('0x1e')](_0xa0c6cf['include'],function(_0xc44034){return{'model':db[_0xc44034[_0x5912('0x1f')]],'as':_0xc44034['as'],'attributes':_0xc44034[_0x5912('0x1b')],'include':_0xc44034['include']?_[_0x5912('0x1e')](_0xc44034['include'],function(_0x399711){return{'model':db[_0x399711[_0x5912('0x1f')]],'as':_0x399711['as'],'attributes':_0x399711[_0x5912('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cde61){logger[_0x5912('0xd')]('GetVoiceCallReport',_0x46c4a3);logger[_0x5912('0xf')]('GetVoiceCallReport',_0x46c4a3,JSON[_0x5912('0x11')](_0x2cde61));_0x2162a4(_0x2cde61);})[_0x5912('0x20')](function(_0xee074c){logger['error'](_0x5912('0x21'),_0xee074c[_0x5912('0x14')],_0x46c4a3);_0x21b1f2(_0x26c492['error'](0x1f4,_0xee074c['message']));});});};exports[_0x5912('0x22')]=function(_0x4c3d9d){var _0x511e1b=this;return new Promise(function(_0x272a12,_0x28dc28){return db[_0x5912('0x23')][_0x5912('0x24')](_0x4c3d9d[_0x5912('0x25')],{'raw':_0x4c3d9d[_0x5912('0x18')]?_0x4c3d9d[_0x5912('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x5912('0xc')](function(_0x487ca7){logger[_0x5912('0xd')](_0x5912('0x22'),_0x4c3d9d);logger['debug'](_0x5912('0x22'),_0x4c3d9d,JSON[_0x5912('0x11')](_0x487ca7));_0x272a12(_0x487ca7);})[_0x5912('0x20')](function(_0xd0908){logger['error'](_0x5912('0x22'),_0xd0908['message'],_0x4c3d9d);_0x28dc28(_0x511e1b[_0x5912('0x12')](0x1f4,_0xd0908[_0x5912('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x165dc4){var _0xfab05e=this;return new Promise(function(_0xcd63f1,_0x54b81d){return db['VoiceCallReport'][_0x5912('0x26')](_0x165dc4['body'],{'raw':_0x165dc4[_0x5912('0x18')]?_0x165dc4[_0x5912('0x18')][_0x5912('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x165dc4['options']?_0x165dc4[_0x5912('0x18')][_0x5912('0x1a')]||null:null,'attributes':_0x165dc4[_0x5912('0x18')]?_0x165dc4[_0x5912('0x18')][_0x5912('0x1b')]||null:null,'limit':_0x165dc4[_0x5912('0x18')]?_0x165dc4['options'][_0x5912('0x1c')]||null:null})[_0x5912('0xc')](function(_0x1ffb6c){logger[_0x5912('0xd')](_0x5912('0x27'),_0x165dc4);logger[_0x5912('0xf')](_0x5912('0x27'),_0x165dc4,JSON['stringify'](_0x1ffb6c));_0xcd63f1(_0x1ffb6c);})[_0x5912('0x20')](function(_0x39bf43){logger[_0x5912('0x12')](_0x5912('0x27'),_0x39bf43['message'],_0x165dc4);_0x54b81d(_0xfab05e[_0x5912('0x12')](0x1f4,_0x39bf43[_0x5912('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 0264bbb..5799456 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 _0x4915=['put','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x56dea3,_0x8a4762){var _0x789256=function(_0x2a78b8){while(--_0x2a78b8){_0x56dea3['push'](_0x56dea3['shift']());}};_0x789256(++_0x8a4762);}(_0x4915,0x179));var _0x5491=function(_0xaad974,_0x396049){_0xaad974=_0xaad974-0x0;var _0x3801e9=_0x4915[_0xaad974];return _0x3801e9;};'use strict';var multer=require('multer');var util=require(_0x5491('0x0'));var path=require('path');var timeout=require(_0x5491('0x1'));var express=require('express');var router=express[_0x5491('0x2')]();var fs_extra=require(_0x5491('0x3'));var auth=require(_0x5491('0x4'));var interaction=require(_0x5491('0x5'));var config=require(_0x5491('0x6'));var controller=require(_0x5491('0x7'));router[_0x5491('0x8')]('/',auth[_0x5491('0x9')](),controller[_0x5491('0xa')]);router[_0x5491('0x8')](_0x5491('0xb'),auth[_0x5491('0x9')](),controller[_0x5491('0xc')]);router['post']('/',auth[_0x5491('0x9')](),controller[_0x5491('0xd')]);router[_0x5491('0xe')](_0x5491('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5491('0xf')](_0x5491('0xb'),auth['isAuthenticated'](),controller[_0x5491('0x10')]);module['exports']=router; \ No newline at end of file +var _0x73ba=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','connect-timeout'];(function(_0x54c102,_0x5e6888){var _0x54ce79=function(_0x2cf32b){while(--_0x2cf32b){_0x54c102['push'](_0x54c102['shift']());}};_0x54ce79(++_0x5e6888);}(_0x73ba,0x12e));var _0xa73b=function(_0x93c984,_0x4e579c){_0x93c984=_0x93c984-0x0;var _0x47af51=_0x73ba[_0x93c984];return _0x47af51;};'use strict';var multer=require('multer');var util=require(_0xa73b('0x0'));var path=require('path');var timeout=require(_0xa73b('0x1'));var express=require('express');var router=express[_0xa73b('0x2')]();var fs_extra=require(_0xa73b('0x3'));var auth=require(_0xa73b('0x4'));var interaction=require(_0xa73b('0x5'));var config=require(_0xa73b('0x6'));var controller=require(_0xa73b('0x7'));router[_0xa73b('0x8')]('/',auth['isAuthenticated'](),controller[_0xa73b('0x9')]);router[_0xa73b('0x8')](_0xa73b('0xa'),auth[_0xa73b('0xb')](),controller[_0xa73b('0xc')]);router[_0xa73b('0xd')]('/',auth[_0xa73b('0xb')](),controller[_0xa73b('0xe')]);router[_0xa73b('0xf')](_0xa73b('0xa'),auth[_0xa73b('0xb')](),controller[_0xa73b('0x10')]);router['delete']('/:id',auth[_0xa73b('0xb')](),controller[_0xa73b('0x11')]);module[_0xa73b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index bd6a63f..e339ea9 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 _0xf281=['join','getDataValue','split','BOOLEAN','exports','STRING','setDataValue','options'];(function(_0x5532e1,_0x388cd1){var _0x276bb5=function(_0xa6bded){while(--_0xa6bded){_0x5532e1['push'](_0x5532e1['shift']());}};_0x276bb5(++_0x388cd1);}(_0xf281,0x194));var _0x1f28=function(_0x17f191,_0x353d5a){_0x17f191=_0x17f191-0x0;var _0x2494f7=_0xf281[_0x17f191];return _0x2494f7;};'use strict';var Sequelize=require('sequelize');module[_0x1f28('0x0')]={'name':{'type':Sequelize[_0x1f28('0x1')]},'prefix':{'type':Sequelize[_0x1f28('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0xa5220d){this[_0x1f28('0x2')](_0x1f28('0x3'),_0xa5220d?_0xa5220d[_0x1f28('0x4')](''):[]);},'get':function(){return this[_0x1f28('0x5')]('options')?this[_0x1f28('0x5')](_0x1f28('0x3'))[_0x1f28('0x6')](''):[];}},'auth':{'type':Sequelize[_0x1f28('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x1f28('0x1')]},'record':{'type':Sequelize[_0x1f28('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1f28('0x1')]}}; \ No newline at end of file +var _0x3811=['setDataValue','options','join','getDataValue','split','STRING','name'];(function(_0x5269ed,_0xeeca79){var _0x522fe7=function(_0x205d9f){while(--_0x205d9f){_0x5269ed['push'](_0x5269ed['shift']());}};_0x522fe7(++_0xeeca79);}(_0x3811,0x1d3));var _0x1381=function(_0x42a82c,_0x324e6a){_0x42a82c=_0x42a82c-0x0;var _0x154ef5=_0x3811[_0x42a82c];return _0x154ef5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1381('0x0')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x1381('0x1'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x36d8dc){this[_0x1381('0x2')](_0x1381('0x3'),_0x36d8dc?_0x36d8dc[_0x1381('0x4')](''):[]);},'get':function(){return this[_0x1381('0x5')](_0x1381('0x3'))?this['getDataValue'](_0x1381('0x3'))[_0x1381('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x1381('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1381('0x0')]},'description':{'type':Sequelize[_0x1381('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 3d9496d..42b5759 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 _0x8b29=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','limit','undefined','count','offset','status','set','json','reject','then','ChanSpies','UserProfileResource','sendStatus','error','stack','name','index','map','VoiceChanSpy','rawAttributes','type','key','model','query','filters','intersection','attributes'];(function(_0x1839ee,_0x2472b8){var _0x54bbfa=function(_0x874bbd){while(--_0x874bbd){_0x1839ee['push'](_0x1839ee['shift']());}};_0x54bbfa(++_0x2472b8);}(_0x8b29,0xbe));var _0x98b2=function(_0x192042,_0x40c1ad){_0x192042=_0x192042-0x0;var _0x5c424a=_0x8b29[_0x192042];return _0x5c424a;};'use strict';var emlformat=require(_0x98b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98b2('0x1'));var jsonpatch=require(_0x98b2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x98b2('0x3'));var Mustache=require(_0x98b2('0x4'));var util=require('util');var path=require(_0x98b2('0x5'));var sox=require('sox');var csv=require(_0x98b2('0x6'));var ejs=require(_0x98b2('0x7'));var fs=require('fs');var fs_extra=require(_0x98b2('0x8'));var _=require(_0x98b2('0x9'));var squel=require(_0x98b2('0xa'));var crypto=require(_0x98b2('0xb'));var jsforce=require(_0x98b2('0xc'));var deskjs=require(_0x98b2('0xd'));var toCsv=require(_0x98b2('0x6'));var querystring=require(_0x98b2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x98b2('0xf'));var qs=require(_0x98b2('0x10'));var as=require(_0x98b2('0x11'));var hardwareService=require(_0x98b2('0x12'));var logger=require(_0x98b2('0x13'))(_0x98b2('0x14'));var utils=require('../../config/utils');var config=require(_0x98b2('0x15'));var licenseUtil=require(_0x98b2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27865e,_0x1180fe){_0x1180fe=_0x1180fe||0xcc;return function(_0x2a6337){if(_0x2a6337){return _0x27865e['sendStatus'](_0x1180fe);}return _0x27865e['status'](_0x1180fe)[_0x98b2('0x17')]();};}function respondWithResult(_0x56bcbd,_0x2966e2){_0x2966e2=_0x2966e2||0xc8;return function(_0x49b151){if(_0x49b151){return _0x56bcbd['status'](_0x2966e2)['json'](_0x49b151);}};}function respondWithFilteredResult(_0x831ee8,_0x413464){return function(_0xe49e9a){if(_0xe49e9a){var _0x5ecea1=typeof _0x413464['offset']==='undefined'&&typeof _0x413464[_0x98b2('0x18')]===_0x98b2('0x19');var _0x145d65=_0xe49e9a[_0x98b2('0x1a')];var _0x4b9f2c=_0x5ecea1?0x0:_0x413464[_0x98b2('0x1b')];var _0x588837=_0x5ecea1?_0xe49e9a[_0x98b2('0x1a')]:_0x413464['offset']+_0x413464[_0x98b2('0x18')];var _0x1dfc04;if(_0x588837>=_0x145d65){_0x588837=_0x145d65;_0x1dfc04=0xc8;}else{_0x1dfc04=0xce;}_0x831ee8[_0x98b2('0x1c')](_0x1dfc04);return _0x831ee8[_0x98b2('0x1d')]('Content-Range',_0x4b9f2c+'-'+_0x588837+'/'+_0x145d65)[_0x98b2('0x1e')](_0xe49e9a);}return null;};}function patchUpdates(_0x242cbd){return function(_0x5dfdf7){try{jsonpatch['apply'](_0x5dfdf7,_0x242cbd,!![]);}catch(_0x5d6b38){return BPromise[_0x98b2('0x1f')](_0x5d6b38);}return _0x5dfdf7['save']();};}function saveUpdates(_0x4ddded,_0x3796c0){return function(_0x37fc18){if(_0x37fc18){return _0x37fc18['update'](_0x4ddded)[_0x98b2('0x20')](function(_0x13d149){return _0x13d149;});}return null;};}function removeEntity(_0xfae112,_0x4f33d8){return function(_0x2a5587){if(_0x2a5587){return _0x2a5587['destroy']()[_0x98b2('0x20')](function(){var _0x4c34f1=_0x2a5587['get']({'plain':!![]});var _0x7b6ebc=_0x98b2('0x21');return db[_0x98b2('0x22')]['destroy']({'where':{'type':_0x7b6ebc,'resourceId':_0x4c34f1['id']}})['then'](function(){return _0x2a5587;});})['then'](function(){_0xfae112[_0x98b2('0x1c')](0xcc)[_0x98b2('0x17')]();});}};}function handleEntityNotFound(_0x50aafb,_0xecb32b){return function(_0x28db65){if(!_0x28db65){_0x50aafb[_0x98b2('0x23')](0x194);}return _0x28db65;};}function handleError(_0x56efb6,_0x2e1ea4){_0x2e1ea4=_0x2e1ea4||0x1f4;return function(_0x1dee11){logger[_0x98b2('0x24')](_0x1dee11[_0x98b2('0x25')]);if(_0x1dee11[_0x98b2('0x26')]){delete _0x1dee11['name'];}_0x56efb6[_0x98b2('0x1c')](_0x2e1ea4)['send'](_0x1dee11);};}exports[_0x98b2('0x27')]=function(_0x1aa42a,_0x4d197c){var _0x2f5156={},_0x363174={},_0x526637={'count':0x0,'rows':[]};var _0x1a676e=_[_0x98b2('0x28')](db[_0x98b2('0x29')][_0x98b2('0x2a')],function(_0x4aee2a){return{'name':_0x4aee2a['fieldName'],'type':_0x4aee2a[_0x98b2('0x2b')][_0x98b2('0x2c')]};});_0x363174[_0x98b2('0x2d')]=_[_0x98b2('0x28')](_0x1a676e,_0x98b2('0x26'));_0x363174[_0x98b2('0x2e')]=_['keys'](_0x1aa42a[_0x98b2('0x2e')]);_0x363174[_0x98b2('0x2f')]=_[_0x98b2('0x30')](_0x363174[_0x98b2('0x2d')],_0x363174[_0x98b2('0x2e')]);_0x2f5156[_0x98b2('0x31')]=_[_0x98b2('0x30')](_0x363174[_0x98b2('0x2d')],qs[_0x98b2('0x32')](_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x32')]));_0x2f5156[_0x98b2('0x31')]=_0x2f5156[_0x98b2('0x31')]['length']?_0x2f5156['attributes']:_0x363174[_0x98b2('0x2d')];if(!_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x33')](_0x98b2('0x34'))){_0x2f5156[_0x98b2('0x18')]=qs[_0x98b2('0x18')](_0x1aa42a['query'][_0x98b2('0x18')]);_0x2f5156[_0x98b2('0x1b')]=qs[_0x98b2('0x1b')](_0x1aa42a[_0x98b2('0x2e')]['offset']);}_0x2f5156[_0x98b2('0x35')]=qs[_0x98b2('0x36')](_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x36')]);_0x2f5156[_0x98b2('0x37')]=qs[_0x98b2('0x2f')](_[_0x98b2('0x38')](_0x1aa42a['query'],_0x363174[_0x98b2('0x2f')]),_0x1a676e);if(_0x1aa42a['query'][_0x98b2('0x39')]){_0x2f5156[_0x98b2('0x37')]=_[_0x98b2('0x3a')](_0x2f5156[_0x98b2('0x37')],{'$or':_['map'](_0x1a676e,function(_0x5aa34b){if(_0x5aa34b[_0x98b2('0x2b')]!==_0x98b2('0x3b')){var _0x42c69c={};_0x42c69c[_0x5aa34b['name']]={'$like':'%'+_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x39')]+'%'};return _0x42c69c;}})});}_0x2f5156=_[_0x98b2('0x3a')]({},_0x2f5156,_0x1aa42a[_0x98b2('0x3c')]);var _0x311fa7={'where':_0x2f5156[_0x98b2('0x37')]};return db['VoiceChanSpy'][_0x98b2('0x1a')](_0x311fa7)[_0x98b2('0x20')](function(_0x197749){_0x526637['count']=_0x197749;if(_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x3d')]){_0x2f5156[_0x98b2('0x3e')]=[{'all':!![]}];}return db[_0x98b2('0x29')][_0x98b2('0x3f')](_0x2f5156);})[_0x98b2('0x20')](function(_0x4a6c03){_0x526637[_0x98b2('0x40')]=_0x4a6c03;return _0x526637;})['then'](respondWithFilteredResult(_0x4d197c,_0x2f5156))[_0x98b2('0x41')](handleError(_0x4d197c,null));};exports[_0x98b2('0x42')]=function(_0x410094,_0x1d262d){var _0x44d858={'raw':![],'where':{'id':_0x410094[_0x98b2('0x43')]['id']}},_0x32e14b={};_0x32e14b[_0x98b2('0x2d')]=_[_0x98b2('0x44')](db['VoiceChanSpy'][_0x98b2('0x2a')]);_0x32e14b['query']=_[_0x98b2('0x44')](_0x410094[_0x98b2('0x2e')]);_0x32e14b[_0x98b2('0x2f')]=_[_0x98b2('0x30')](_0x32e14b[_0x98b2('0x2d')],_0x32e14b[_0x98b2('0x2e')]);_0x44d858['attributes']=_[_0x98b2('0x30')](_0x32e14b[_0x98b2('0x2d')],qs[_0x98b2('0x32')](_0x410094[_0x98b2('0x2e')][_0x98b2('0x32')]));_0x44d858['attributes']=_0x44d858['attributes'][_0x98b2('0x45')]?_0x44d858[_0x98b2('0x31')]:_0x32e14b[_0x98b2('0x2d')];if(_0x410094[_0x98b2('0x2e')]['includeAll']){_0x44d858['include']=[{'all':!![]}];}_0x44d858=_['merge']({},_0x44d858,_0x410094[_0x98b2('0x3c')]);return db[_0x98b2('0x29')][_0x98b2('0x46')](_0x44d858)[_0x98b2('0x20')](handleEntityNotFound(_0x1d262d,null))[_0x98b2('0x20')](respondWithResult(_0x1d262d,null))[_0x98b2('0x41')](handleError(_0x1d262d,null));};exports[_0x98b2('0x47')]=function(_0x2b08ed,_0x3c2477){return db['VoiceChanSpy'][_0x98b2('0x47')](_0x2b08ed['body'],{})[_0x98b2('0x20')](function(_0x6369ca){var _0x3c3c64=_0x2b08ed[_0x98b2('0x48')]['get']({'plain':!![]});if(!_0x3c3c64)throw new Error(_0x98b2('0x49'));if(_0x3c3c64[_0x98b2('0x4a')]===_0x98b2('0x48')){var _0x1e13b8=_0x6369ca[_0x98b2('0x4b')]({'plain':!![]});var _0x54f7ba=_0x98b2('0x21');return db[_0x98b2('0x4c')][_0x98b2('0x46')]({'where':{'name':_0x54f7ba,'userProfileId':_0x3c3c64[_0x98b2('0x4d')]},'raw':!![]})[_0x98b2('0x20')](function(_0x3d6a4e){if(_0x3d6a4e&&_0x3d6a4e[_0x98b2('0x4e')]===0x0){return db[_0x98b2('0x22')][_0x98b2('0x47')]({'name':_0x1e13b8[_0x98b2('0x26')],'resourceId':_0x1e13b8['id'],'type':_0x3d6a4e[_0x98b2('0x26')],'sectionId':_0x3d6a4e['id']},{})[_0x98b2('0x20')](function(){return _0x6369ca;});}else{return _0x6369ca;}})['catch'](function(_0x3b083a){logger[_0x98b2('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b083a);throw _0x3b083a;});}return _0x6369ca;})['then'](respondWithResult(_0x3c2477,0xc9))[_0x98b2('0x41')](handleError(_0x3c2477,null));};exports['update']=function(_0x20ddfd,_0x1cad33){if(_0x20ddfd[_0x98b2('0x4f')]['id']){delete _0x20ddfd[_0x98b2('0x4f')]['id'];}return db[_0x98b2('0x29')][_0x98b2('0x46')]({'where':{'id':_0x20ddfd['params']['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x1cad33,null))['then'](saveUpdates(_0x20ddfd['body'],null))[_0x98b2('0x20')](respondWithResult(_0x1cad33,null))[_0x98b2('0x41')](handleError(_0x1cad33,null));};exports['destroy']=function(_0x12a72e,_0x1253e2){return db['VoiceChanSpy'][_0x98b2('0x46')]({'where':{'id':_0x12a72e[_0x98b2('0x43')]['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x1253e2,null))[_0x98b2('0x20')](removeEntity(_0x1253e2,null))['catch'](handleError(_0x1253e2,null));}; \ No newline at end of file +var _0x7070=['mustache','util','path','to-csv','ejs','squel','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','status','end','offset','limit','undefined','set','json','save','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','include','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7070,0x1d7));var _0x0707=function(_0x293da0,_0x206a0a){_0x293da0=_0x293da0-0x0;var _0x4d57d0=_0x7070[_0x293da0];return _0x4d57d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0707('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0707('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0707('0x2'));var Mustache=require(_0x0707('0x3'));var util=require(_0x0707('0x4'));var path=require(_0x0707('0x5'));var sox=require('sox');var csv=require(_0x0707('0x6'));var ejs=require(_0x0707('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0707('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0707('0x9'));var toCsv=require(_0x0707('0x6'));var querystring=require(_0x0707('0xa'));var Papa=require(_0x0707('0xb'));var Redis=require(_0x0707('0xc'));var authService=require(_0x0707('0xd'));var qs=require(_0x0707('0xe'));var as=require(_0x0707('0xf'));var hardwareService=require(_0x0707('0x10'));var logger=require(_0x0707('0x11'))('api');var utils=require(_0x0707('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0707('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b55c6,_0x2bd4d8){_0x2bd4d8=_0x2bd4d8||0xcc;return function(_0x3eeea8){if(_0x3eeea8){return _0x3b55c6[_0x0707('0x14')](_0x2bd4d8);}return _0x3b55c6[_0x0707('0x15')](_0x2bd4d8)[_0x0707('0x16')]();};}function respondWithResult(_0x3b0f64,_0x111fd7){_0x111fd7=_0x111fd7||0xc8;return function(_0x380abc){if(_0x380abc){return _0x3b0f64[_0x0707('0x15')](_0x111fd7)['json'](_0x380abc);}};}function respondWithFilteredResult(_0x5bae3d,_0x3fce78){return function(_0x429da2){if(_0x429da2){var _0x1370b3=typeof _0x3fce78[_0x0707('0x17')]==='undefined'&&typeof _0x3fce78[_0x0707('0x18')]===_0x0707('0x19');var _0xe1cf0e=_0x429da2['count'];var _0x13d5de=_0x1370b3?0x0:_0x3fce78['offset'];var _0x471431=_0x1370b3?_0x429da2['count']:_0x3fce78[_0x0707('0x17')]+_0x3fce78[_0x0707('0x18')];var _0x1debb9;if(_0x471431>=_0xe1cf0e){_0x471431=_0xe1cf0e;_0x1debb9=0xc8;}else{_0x1debb9=0xce;}_0x5bae3d[_0x0707('0x15')](_0x1debb9);return _0x5bae3d[_0x0707('0x1a')]('Content-Range',_0x13d5de+'-'+_0x471431+'/'+_0xe1cf0e)[_0x0707('0x1b')](_0x429da2);}return null;};}function patchUpdates(_0x360caf){return function(_0x37d1fd){try{jsonpatch['apply'](_0x37d1fd,_0x360caf,!![]);}catch(_0x5c8731){return BPromise['reject'](_0x5c8731);}return _0x37d1fd[_0x0707('0x1c')]();};}function saveUpdates(_0x3f31e1,_0x1d133c){return function(_0x51dec4){if(_0x51dec4){return _0x51dec4['update'](_0x3f31e1)[_0x0707('0x1d')](function(_0x225a58){return _0x225a58;});}return null;};}function removeEntity(_0x370554,_0x3e9c41){return function(_0x3ba507){if(_0x3ba507){return _0x3ba507[_0x0707('0x1e')]()[_0x0707('0x1d')](function(){var _0x57c868=_0x3ba507[_0x0707('0x1f')]({'plain':!![]});var _0x3dc5fb=_0x0707('0x20');return db[_0x0707('0x21')]['destroy']({'where':{'type':_0x3dc5fb,'resourceId':_0x57c868['id']}})[_0x0707('0x1d')](function(){return _0x3ba507;});})[_0x0707('0x1d')](function(){_0x370554[_0x0707('0x15')](0xcc)[_0x0707('0x16')]();});}};}function handleEntityNotFound(_0x4d4666,_0x4008b9){return function(_0xb5bb75){if(!_0xb5bb75){_0x4d4666[_0x0707('0x14')](0x194);}return _0xb5bb75;};}function handleError(_0x470381,_0x428bd5){_0x428bd5=_0x428bd5||0x1f4;return function(_0x599090){logger[_0x0707('0x22')](_0x599090[_0x0707('0x23')]);if(_0x599090[_0x0707('0x24')]){delete _0x599090[_0x0707('0x24')];}_0x470381['status'](_0x428bd5)[_0x0707('0x25')](_0x599090);};}exports[_0x0707('0x26')]=function(_0x160485,_0x451c3f){var _0x230dca={},_0x2eeddb={},_0x1ec95d={'count':0x0,'rows':[]};var _0x4e4b3f=_['map'](db[_0x0707('0x27')][_0x0707('0x28')],function(_0x24fda7){return{'name':_0x24fda7[_0x0707('0x29')],'type':_0x24fda7['type'][_0x0707('0x2a')]};});_0x2eeddb[_0x0707('0x2b')]=_['map'](_0x4e4b3f,_0x0707('0x24'));_0x2eeddb[_0x0707('0x2c')]=_['keys'](_0x160485[_0x0707('0x2c')]);_0x2eeddb[_0x0707('0x2d')]=_['intersection'](_0x2eeddb[_0x0707('0x2b')],_0x2eeddb[_0x0707('0x2c')]);_0x230dca['attributes']=_[_0x0707('0x2e')](_0x2eeddb[_0x0707('0x2b')],qs[_0x0707('0x2f')](_0x160485[_0x0707('0x2c')][_0x0707('0x2f')]));_0x230dca[_0x0707('0x30')]=_0x230dca[_0x0707('0x30')]['length']?_0x230dca[_0x0707('0x30')]:_0x2eeddb[_0x0707('0x2b')];if(!_0x160485[_0x0707('0x2c')]['hasOwnProperty'](_0x0707('0x31'))){_0x230dca[_0x0707('0x18')]=qs['limit'](_0x160485[_0x0707('0x2c')][_0x0707('0x18')]);_0x230dca[_0x0707('0x17')]=qs['offset'](_0x160485[_0x0707('0x2c')]['offset']);}_0x230dca[_0x0707('0x32')]=qs[_0x0707('0x33')](_0x160485[_0x0707('0x2c')][_0x0707('0x33')]);_0x230dca[_0x0707('0x34')]=qs[_0x0707('0x2d')](_[_0x0707('0x35')](_0x160485[_0x0707('0x2c')],_0x2eeddb[_0x0707('0x2d')]),_0x4e4b3f);if(_0x160485[_0x0707('0x2c')][_0x0707('0x36')]){_0x230dca[_0x0707('0x34')]=_[_0x0707('0x37')](_0x230dca[_0x0707('0x34')],{'$or':_[_0x0707('0x38')](_0x4e4b3f,function(_0x30765c){if(_0x30765c[_0x0707('0x39')]!==_0x0707('0x3a')){var _0x1e3d16={};_0x1e3d16[_0x30765c['name']]={'$like':'%'+_0x160485[_0x0707('0x2c')][_0x0707('0x36')]+'%'};return _0x1e3d16;}})});}_0x230dca=_[_0x0707('0x37')]({},_0x230dca,_0x160485['options']);var _0x51b0bf={'where':_0x230dca[_0x0707('0x34')]};return db[_0x0707('0x27')]['count'](_0x51b0bf)[_0x0707('0x1d')](function(_0x2d9c47){_0x1ec95d[_0x0707('0x3b')]=_0x2d9c47;if(_0x160485[_0x0707('0x2c')][_0x0707('0x3c')]){_0x230dca['include']=[{'all':!![]}];}return db[_0x0707('0x27')][_0x0707('0x3d')](_0x230dca);})[_0x0707('0x1d')](function(_0x508cc2){_0x1ec95d[_0x0707('0x3e')]=_0x508cc2;return _0x1ec95d;})[_0x0707('0x1d')](respondWithFilteredResult(_0x451c3f,_0x230dca))[_0x0707('0x3f')](handleError(_0x451c3f,null));};exports[_0x0707('0x40')]=function(_0x11eac5,_0x290277){var _0x4e45c6={'raw':![],'where':{'id':_0x11eac5[_0x0707('0x41')]['id']}},_0x2727e2={};_0x2727e2[_0x0707('0x2b')]=_[_0x0707('0x42')](db['VoiceChanSpy']['rawAttributes']);_0x2727e2[_0x0707('0x2c')]=_[_0x0707('0x42')](_0x11eac5[_0x0707('0x2c')]);_0x2727e2[_0x0707('0x2d')]=_[_0x0707('0x2e')](_0x2727e2[_0x0707('0x2b')],_0x2727e2[_0x0707('0x2c')]);_0x4e45c6[_0x0707('0x30')]=_[_0x0707('0x2e')](_0x2727e2[_0x0707('0x2b')],qs[_0x0707('0x2f')](_0x11eac5['query'][_0x0707('0x2f')]));_0x4e45c6[_0x0707('0x30')]=_0x4e45c6[_0x0707('0x30')]['length']?_0x4e45c6[_0x0707('0x30')]:_0x2727e2[_0x0707('0x2b')];if(_0x11eac5[_0x0707('0x2c')][_0x0707('0x3c')]){_0x4e45c6[_0x0707('0x43')]=[{'all':!![]}];}_0x4e45c6=_[_0x0707('0x37')]({},_0x4e45c6,_0x11eac5[_0x0707('0x44')]);return db[_0x0707('0x27')]['find'](_0x4e45c6)[_0x0707('0x1d')](handleEntityNotFound(_0x290277,null))[_0x0707('0x1d')](respondWithResult(_0x290277,null))[_0x0707('0x3f')](handleError(_0x290277,null));};exports[_0x0707('0x45')]=function(_0x19a4df,_0x5e5d53){return db[_0x0707('0x27')][_0x0707('0x45')](_0x19a4df[_0x0707('0x46')],{})[_0x0707('0x1d')](function(_0x4a1ae7){var _0x3afe58=_0x19a4df['user'][_0x0707('0x1f')]({'plain':!![]});if(!_0x3afe58)throw new Error(_0x0707('0x47'));if(_0x3afe58[_0x0707('0x48')]===_0x0707('0x49')){var _0x504255=_0x4a1ae7[_0x0707('0x1f')]({'plain':!![]});var _0x9445e0=_0x0707('0x20');return db[_0x0707('0x4a')][_0x0707('0x4b')]({'where':{'name':_0x9445e0,'userProfileId':_0x3afe58[_0x0707('0x4c')]},'raw':!![]})['then'](function(_0x27c306){if(_0x27c306&&_0x27c306[_0x0707('0x4d')]===0x0){return db[_0x0707('0x21')][_0x0707('0x45')]({'name':_0x504255[_0x0707('0x24')],'resourceId':_0x504255['id'],'type':_0x27c306[_0x0707('0x24')],'sectionId':_0x27c306['id']},{})['then'](function(){return _0x4a1ae7;});}else{return _0x4a1ae7;}})[_0x0707('0x3f')](function(_0x271964){logger[_0x0707('0x22')](_0x0707('0x4e'),_0x271964);throw _0x271964;});}return _0x4a1ae7;})[_0x0707('0x1d')](respondWithResult(_0x5e5d53,0xc9))[_0x0707('0x3f')](handleError(_0x5e5d53,null));};exports['update']=function(_0x439309,_0x768e45){if(_0x439309[_0x0707('0x46')]['id']){delete _0x439309['body']['id'];}return db[_0x0707('0x27')][_0x0707('0x4b')]({'where':{'id':_0x439309['params']['id']}})['then'](handleEntityNotFound(_0x768e45,null))[_0x0707('0x1d')](saveUpdates(_0x439309[_0x0707('0x46')],null))['then'](respondWithResult(_0x768e45,null))[_0x0707('0x3f')](handleError(_0x768e45,null));};exports[_0x0707('0x1e')]=function(_0x389903,_0x1d5edc){return db[_0x0707('0x27')][_0x0707('0x4b')]({'where':{'id':_0x389903['params']['id']}})[_0x0707('0x1d')](handleEntityNotFound(_0x1d5edc,null))[_0x0707('0x1d')](removeEntity(_0x1d5edc,null))[_0x0707('0x3f')](handleError(_0x1d5edc,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 24f1568..a58ee01 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 _0xb6cb=['User','findAll','agent','then','catch','models','VoiceChanSpy','bulkCreate','VoiceExtension','destroy','length','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','internal','concat'];(function(_0x507056,_0xe16b72){var _0x4eaecc=function(_0x440b91){while(--_0x440b91){_0x507056['push'](_0x507056['shift']());}};_0x4eaecc(++_0xe16b72);}(_0xb6cb,0xce));var _0xbb6c=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xb6cb[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0xbb6c('0x0'));var util=require(_0xbb6c('0x1'));var BPromise=require(_0xbb6c('0x2'));var attributes=require(_0xbb6c('0x3'));var getUserApplications=function(_0x308180,_0x1e705b,_0x3f0510){var _0x212f76=0x1;var _0x3de0c1=[];var _0x1cdbef={'context':_0x1e705b[_0xbb6c('0x4')]||_0xbb6c('0x5'),'exten':util[_0xbb6c('0x6')](_0xbb6c('0x7'),_0x308180[_0xbb6c('0x8')],_0x3f0510),'type':_0xbb6c('0x9'),'isApp':![],'ChanSpyId':_0x308180['id'],'UserId':_0x1e705b['id']};_0x3de0c1[_0xbb6c('0xa')](_[_0xbb6c('0xb')]({'app':_0xbb6c('0xc'),'appdata':util[_0xbb6c('0x6')]('CDR(type)=%s',_0xbb6c('0xd')),'priority':_0x212f76++},_0x1cdbef));if(_0x308180['record']){_0x3de0c1[_0xbb6c('0xa')](_[_0xbb6c('0xb')]({'app':_0xbb6c('0xe'),'appdata':util[_0xbb6c('0x6')](_0xbb6c('0xf'),_0x308180[_0xbb6c('0x10')]),'priority':_0x212f76++},_0x1cdbef));}if(_0x308180[_0xbb6c('0x11')]){_0x3de0c1[_0xbb6c('0xa')](_[_0xbb6c('0xb')]({'app':_0xbb6c('0x12'),'appdata':_0x308180['password'],'priority':_0x212f76++},_0x1cdbef));}_0x3de0c1[_0xbb6c('0xa')](_['merge']({'app':_0xbb6c('0x13'),'appdata':util[_0xbb6c('0x6')](_0xbb6c('0x14'),_0x1e705b[_0xbb6c('0x15')],_0x308180[_0xbb6c('0x16')]?_0x308180['options'][_0xbb6c('0x17')](''):''),'priority':_0x212f76++},_0x1cdbef));if(_0x308180[_0xbb6c('0x18')]){_0x3de0c1[_0xbb6c('0xa')](_['merge']({'app':_0xbb6c('0x19'),'priority':_0x212f76++},_0x1cdbef));}return _0x3de0c1;};var getChanSpyApplications=function(_0x4a6bc0,_0xc4d186){var _0x55b754=[];for(var _0x3782bf=0x0,_0x12fba6=0x1;_0x3782bf<_0xc4d186['length'];_0x3782bf++,_0x12fba6=0x1){_0x55b754=_0x55b754['concat'](getUserApplications(_0x4a6bc0,_0xc4d186[_0x3782bf],_0xc4d186[_0x3782bf][_0xbb6c('0x1a')]));if(_0xc4d186[_0x3782bf][_0xbb6c('0x1a')]!=_0xc4d186[_0x3782bf][_0xbb6c('0x15')]){_0x55b754=_0x55b754[_0xbb6c('0x1b')](getUserApplications(_0x4a6bc0,_0xc4d186[_0x3782bf],_0xc4d186[_0x3782bf][_0xbb6c('0x15')]));}}return _0x55b754;};var getChanSpyPromise=function(_0x341ce6,_0x3c44de){return new BPromise(function(_0x57c0a4,_0xc82832){return _0x341ce6[_0xbb6c('0x1c')][_0xbb6c('0x1d')]({'attributes':['id',_0xbb6c('0x15'),_0xbb6c('0x1a')],'where':{'role':_0xbb6c('0x1e'),'chanspy':!![]},'raw':!![]})[_0xbb6c('0x1f')](function(_0x331c91){if(_0x331c91){return _0x57c0a4(getChanSpyApplications(_0x3c44de,_0x331c91));}return _0x57c0a4([]);})[_0xbb6c('0x20')](function(_0xd01766){_0xc82832(_0xd01766);});});};module['exports']=function(_0x1ef513,_0x30c552){var _0x11a59c=_0x1ef513[_0xbb6c('0x21')];return _0x1ef513['define'](_0xbb6c('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe72b66,_0x4e4906,_0x572115){return getChanSpyPromise(_0x11a59c,_0xe72b66)['then'](function(_0x14effc){if(_0x14effc&&_0x14effc['length']){return _0x11a59c['VoiceExtension'][_0xbb6c('0x23')](_0x14effc);}})[_0xbb6c('0x1f')](function(){_0x572115();})[_0xbb6c('0x20')](function(_0x57aa9a){_0x572115(_0x57aa9a);});},'afterUpdate':function(_0x19e5a5,_0x2e7897,_0x4e366f){return _0x11a59c[_0xbb6c('0x24')][_0xbb6c('0x25')]({'where':{'ChanSpyId':_0x19e5a5['id']}})['then'](function(){return getChanSpyPromise(_0x11a59c,_0x19e5a5);})[_0xbb6c('0x1f')](function(_0x37db71){if(_0x37db71&&_0x37db71[_0xbb6c('0x26')]){return _0x11a59c[_0xbb6c('0x24')][_0xbb6c('0x23')](_0x37db71);}})[_0xbb6c('0x1f')](function(){_0x4e366f();})[_0xbb6c('0x20')](function(_0x1387a0){_0x4e366f(_0x1387a0);});},'afterDestroy':function(_0x3a454f,_0x3a91da,_0x2dfb14){return _0x11a59c['VoiceExtension'][_0xbb6c('0x25')]({'where':{'ChanSpyId':_0x3a454f['id']}})[_0xbb6c('0x1f')](function(){_0x2dfb14();})['catch'](function(_0x1b7953){_0x2dfb14(_0x1b7953);});}}});}; \ No newline at end of file +var _0x0fc7=['system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','recordingFormat','auth','Authenticate','password','name','join','StopMixMonitor','length','concat','User','internal','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','destroy','lodash','util','context','from-sip','format','%s%s','prefix'];(function(_0x30a5cf,_0x4e90b2){var _0x5a7245=function(_0x3605b0){while(--_0x3605b0){_0x30a5cf['push'](_0x30a5cf['shift']());}};_0x5a7245(++_0x4e90b2);}(_0x0fc7,0x12b));var _0x70fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0fc7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x70fc('0x0'));var util=require(_0x70fc('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xae5939,_0x57aea9,_0x65f20e){var _0x55432c=0x1;var _0x311fc3=[];var _0x5a8e96={'context':_0x57aea9[_0x70fc('0x2')]||_0x70fc('0x3'),'exten':util[_0x70fc('0x4')](_0x70fc('0x5'),_0xae5939[_0x70fc('0x6')],_0x65f20e),'type':_0x70fc('0x7'),'isApp':![],'ChanSpyId':_0xae5939['id'],'UserId':_0x57aea9['id']};_0x311fc3[_0x70fc('0x8')](_['merge']({'app':_0x70fc('0x9'),'appdata':util[_0x70fc('0x4')](_0x70fc('0xa'),_0x70fc('0xb')),'priority':_0x55432c++},_0x5a8e96));if(_0xae5939[_0x70fc('0xc')]){_0x311fc3[_0x70fc('0x8')](_[_0x70fc('0xd')]({'app':_0x70fc('0xe'),'appdata':util[_0x70fc('0x4')]('${UNIQUEID}.%s,a',_0xae5939[_0x70fc('0xf')]),'priority':_0x55432c++},_0x5a8e96));}if(_0xae5939[_0x70fc('0x10')]){_0x311fc3['push'](_[_0x70fc('0xd')]({'app':_0x70fc('0x11'),'appdata':_0xae5939[_0x70fc('0x12')],'priority':_0x55432c++},_0x5a8e96));}_0x311fc3[_0x70fc('0x8')](_['merge']({'app':'ChanSpy','appdata':util[_0x70fc('0x4')]('SIP/%s,%s',_0x57aea9[_0x70fc('0x13')],_0xae5939['options']?_0xae5939['options'][_0x70fc('0x14')](''):''),'priority':_0x55432c++},_0x5a8e96));if(_0xae5939[_0x70fc('0xc')]){_0x311fc3[_0x70fc('0x8')](_[_0x70fc('0xd')]({'app':_0x70fc('0x15'),'priority':_0x55432c++},_0x5a8e96));}return _0x311fc3;};var getChanSpyApplications=function(_0x416544,_0x19eef8){var _0x3e62a5=[];for(var _0x20b999=0x0,_0xf3f9d1=0x1;_0x20b999<_0x19eef8[_0x70fc('0x16')];_0x20b999++,_0xf3f9d1=0x1){_0x3e62a5=_0x3e62a5[_0x70fc('0x17')](getUserApplications(_0x416544,_0x19eef8[_0x20b999],_0x19eef8[_0x20b999]['internal']));if(_0x19eef8[_0x20b999]['internal']!=_0x19eef8[_0x20b999]['name']){_0x3e62a5=_0x3e62a5[_0x70fc('0x17')](getUserApplications(_0x416544,_0x19eef8[_0x20b999],_0x19eef8[_0x20b999][_0x70fc('0x13')]));}}return _0x3e62a5;};var getChanSpyPromise=function(_0x30fd3c,_0x2a8256){return new BPromise(function(_0x5b38a4,_0x19675b){return _0x30fd3c[_0x70fc('0x18')]['findAll']({'attributes':['id',_0x70fc('0x13'),_0x70fc('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x70fc('0x1a')](function(_0x2e71ca){if(_0x2e71ca){return _0x5b38a4(getChanSpyApplications(_0x2a8256,_0x2e71ca));}return _0x5b38a4([]);})[_0x70fc('0x1b')](function(_0x30ee52){_0x19675b(_0x30ee52);});});};module[_0x70fc('0x1c')]=function(_0x2c06a4,_0x5a186e){var _0x43e26f=_0x2c06a4[_0x70fc('0x1d')];return _0x2c06a4[_0x70fc('0x1e')](_0x70fc('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xdcc414,_0x460743,_0x4361e6){return getChanSpyPromise(_0x43e26f,_0xdcc414)[_0x70fc('0x1a')](function(_0x4a660e){if(_0x4a660e&&_0x4a660e[_0x70fc('0x16')]){return _0x43e26f[_0x70fc('0x20')]['bulkCreate'](_0x4a660e);}})[_0x70fc('0x1a')](function(){_0x4361e6();})[_0x70fc('0x1b')](function(_0x3420d1){_0x4361e6(_0x3420d1);});},'afterUpdate':function(_0x18c94c,_0xf3904a,_0x362b4a){return _0x43e26f['VoiceExtension'][_0x70fc('0x21')]({'where':{'ChanSpyId':_0x18c94c['id']}})[_0x70fc('0x1a')](function(){return getChanSpyPromise(_0x43e26f,_0x18c94c);})[_0x70fc('0x1a')](function(_0x43616f){if(_0x43616f&&_0x43616f[_0x70fc('0x16')]){return _0x43e26f[_0x70fc('0x20')]['bulkCreate'](_0x43616f);}})[_0x70fc('0x1a')](function(){_0x362b4a();})[_0x70fc('0x1b')](function(_0x10881e){_0x362b4a(_0x10881e);});},'afterDestroy':function(_0x4ae848,_0x5df30d,_0x47bb31){return _0x43e26f[_0x70fc('0x20')][_0x70fc('0x21')]({'where':{'ChanSpyId':_0x4ae848['id']}})[_0x70fc('0x1a')](function(){_0x47bb31();})[_0x70fc('0x1b')](function(_0x310886){_0x47bb31(_0x310886);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 55fe003..d85211b 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 _0x9567=['info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x3e618a,_0x135251){var _0x1f3d61=function(_0x12131b){while(--_0x12131b){_0x3e618a['push'](_0x3e618a['shift']());}};_0x1f3d61(++_0x135251);}(_0x9567,0xdc));var _0x7956=function(_0x4203f6,_0x192f62){_0x4203f6=_0x4203f6-0x0;var _0xd3c09c=_0x9567[_0x4203f6];return _0xd3c09c;};'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')]('VoiceChanSpy,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});} \ No newline at end of file +var _0x235a=['http','then','VoiceChanSpy,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a2197,_0x256dbd){var _0x35c1c0=function(_0x545ba1){while(--_0x545ba1){_0x1a2197['push'](_0x1a2197['shift']());}};_0x35c1c0(++_0x256dbd);}(_0x235a,0x1ef));var _0xa235=function(_0x2edb6a,_0x2902c7){_0x2edb6a=_0x2edb6a-0x0;var _0x10c417=_0x235a[_0x2edb6a];return _0x10c417;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));var BPromise=require('bluebird');var rs=require(_0xa235('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa235('0x4'))['db'];var utils=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));var config=require(_0xa235('0x8'));var jayson=require(_0xa235('0x9'));var client=jayson[_0xa235('0xa')][_0xa235('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b849b,_0x2e535e,_0x2dc1ba){return new BPromise(function(_0x450e27,_0x2f3403){return client['request'](_0x4b849b,_0x2dc1ba)[_0xa235('0xc')](function(_0x561602){logger['info'](_0xa235('0xd'),_0x2e535e,'request\x20sent');logger[_0xa235('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2e535e,'request\x20sent',JSON['stringify'](_0x561602));if(_0x561602[_0xa235('0xf')]){if(_0x561602[_0xa235('0xf')][_0xa235('0x10')]===0x1f4){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x561602['error']['message']);return _0x2f3403(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}logger[_0xa235('0xf')](_0xa235('0xd'),_0x2e535e,_0x561602[_0xa235('0xf')][_0xa235('0x11')]);return _0x450e27(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}else{logger[_0xa235('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0xa235('0x13'));_0x450e27(_0x561602[_0xa235('0x14')][_0xa235('0x11')]);}})[_0xa235('0x15')](function(_0x16dbe9){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x16dbe9);_0x2f3403(_0x16dbe9);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f8064aa..60d7945 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 _0xf1b3=['fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','/:id','show','create','put','delete','destroy','util','path','connect-timeout','express'];(function(_0x235150,_0x1e4776){var _0x142090=function(_0x1bbbc9){while(--_0x1bbbc9){_0x235150['push'](_0x235150['shift']());}};_0x142090(++_0x1e4776);}(_0xf1b3,0x19c));var _0x3f1b=function(_0x184d74,_0x413d03){_0x184d74=_0x184d74-0x0;var _0x4bdea1=_0xf1b3[_0x184d74];return _0x4bdea1;};'use strict';var multer=require('multer');var util=require(_0x3f1b('0x0'));var path=require(_0x3f1b('0x1'));var timeout=require(_0x3f1b('0x2'));var express=require(_0x3f1b('0x3'));var router=express['Router']();var fs_extra=require(_0x3f1b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3f1b('0x5'));var config=require(_0x3f1b('0x6'));var controller=require(_0x3f1b('0x7'));router['get']('/',auth[_0x3f1b('0x8')](),controller[_0x3f1b('0x9')]);router['get'](_0x3f1b('0xa'),auth[_0x3f1b('0x8')](),controller[_0x3f1b('0xb')]);router['post']('/',auth[_0x3f1b('0x8')](),controller[_0x3f1b('0xc')]);router[_0x3f1b('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3f1b('0xe')](_0x3f1b('0xa'),auth[_0x3f1b('0x8')](),controller[_0x3f1b('0xf')]);module['exports']=router; \ No newline at end of file +var _0xa1c8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','path'];(function(_0xf5cf8b,_0x4698bd){var _0x38216e=function(_0x52b583){while(--_0x52b583){_0xf5cf8b['push'](_0xf5cf8b['shift']());}};_0x38216e(++_0x4698bd);}(_0xa1c8,0xb1));var _0x8a1c=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xa1c8[_0x3070dc];return _0x431489;};'use strict';var multer=require(_0x8a1c('0x0'));var util=require(_0x8a1c('0x1'));var path=require(_0x8a1c('0x2'));var timeout=require(_0x8a1c('0x3'));var express=require(_0x8a1c('0x4'));var router=express[_0x8a1c('0x5')]();var fs_extra=require(_0x8a1c('0x6'));var auth=require(_0x8a1c('0x7'));var interaction=require(_0x8a1c('0x8'));var config=require(_0x8a1c('0x9'));var controller=require('./voiceContext.controller');router[_0x8a1c('0xa')]('/',auth[_0x8a1c('0xb')](),controller[_0x8a1c('0xc')]);router[_0x8a1c('0xa')](_0x8a1c('0xd'),auth[_0x8a1c('0xb')](),controller[_0x8a1c('0xe')]);router['post']('/',auth[_0x8a1c('0xb')](),controller[_0x8a1c('0xf')]);router['put'](_0x8a1c('0xd'),auth[_0x8a1c('0xb')](),controller[_0x8a1c('0x10')]);router[_0x8a1c('0x11')](_0x8a1c('0xd'),auth[_0x8a1c('0xb')](),controller[_0x8a1c('0x12')]);module[_0x8a1c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index fabdad2..c09d44d 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 _0x1e3e=['sequelize','STRING','name'];(function(_0x46dac9,_0x2439b3){var _0x10507d=function(_0x441156){while(--_0x441156){_0x46dac9['push'](_0x46dac9['shift']());}};_0x10507d(++_0x2439b3);}(_0x1e3e,0x87));var _0xe1e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1e3e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe1e3('0x0'));module['exports']={'name':{'type':Sequelize[_0xe1e3('0x1')],'unique':_0xe1e3('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3a42=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0xdb5271,_0x20fbb7){var _0x38bb9f=function(_0x538617){while(--_0x538617){_0xdb5271['push'](_0xdb5271['shift']());}};_0x38bb9f(++_0x20fbb7);}(_0x3a42,0x19c));var _0x23a4=function(_0x5a9a65,_0x48363a){_0x5a9a65=_0x5a9a65-0x0;var _0x467823=_0x3a42[_0x5a9a65];return _0x467823;};'use strict';var Sequelize=require(_0x23a4('0x0'));module[_0x23a4('0x1')]={'name':{'type':Sequelize[_0x23a4('0x2')],'unique':_0x23a4('0x3')},'description':{'type':Sequelize[_0x23a4('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x23a4('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 8d4b85f..5d04167 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 _0xef97=['stack','name','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','merge','options','VoiceContext','includeAll','include','findAll','show','params','keys','find','create','body','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','end'];(function(_0x5d0ac9,_0x11c334){var _0x26c603=function(_0xf82883){while(--_0xf82883){_0x5d0ac9['push'](_0x5d0ac9['shift']());}};_0x26c603(++_0x11c334);}(_0xef97,0x95));var _0x7ef9=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xef97[_0x2bf141];return _0x48277b;};'use strict';var emlformat=require(_0x7ef9('0x0'));var rimraf=require(_0x7ef9('0x1'));var zipdir=require(_0x7ef9('0x2'));var jsonpatch=require(_0x7ef9('0x3'));var rp=require('request-promise');var moment=require(_0x7ef9('0x4'));var BPromise=require(_0x7ef9('0x5'));var Mustache=require(_0x7ef9('0x6'));var util=require(_0x7ef9('0x7'));var path=require(_0x7ef9('0x8'));var sox=require(_0x7ef9('0x9'));var csv=require(_0x7ef9('0xa'));var ejs=require(_0x7ef9('0xb'));var fs=require('fs');var fs_extra=require(_0x7ef9('0xc'));var _=require(_0x7ef9('0xd'));var squel=require('squel');var crypto=require(_0x7ef9('0xe'));var jsforce=require(_0x7ef9('0xf'));var deskjs=require(_0x7ef9('0x10'));var toCsv=require(_0x7ef9('0xa'));var querystring=require(_0x7ef9('0x11'));var Papa=require(_0x7ef9('0x12'));var Redis=require(_0x7ef9('0x13'));var authService=require(_0x7ef9('0x14'));var qs=require(_0x7ef9('0x15'));var as=require(_0x7ef9('0x16'));var hardwareService=require(_0x7ef9('0x17'));var logger=require(_0x7ef9('0x18'))('api');var utils=require(_0x7ef9('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7ef9('0x1a'))['db'];var jayson=require(_0x7ef9('0x1b'));var client=jayson[_0x7ef9('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e1116,_0x5baeae,_0x19d554,_0x521101){return new BPromise(function(_0x4f7406,_0x57206d){var _0x8188ee=_0x521101||client;return _0x8188ee[_0x7ef9('0x1d')](_0x4e1116,_0x19d554)[_0x7ef9('0x1e')](function(_0x439a26){logger[_0x7ef9('0x1f')](_0x7ef9('0x20'),_0x5baeae,_0x7ef9('0x21'));logger[_0x7ef9('0x22')](_0x7ef9('0x23'),_0x5baeae,_0x7ef9('0x21'),JSON[_0x7ef9('0x24')](_0x439a26));if(_0x439a26[_0x7ef9('0x25')]){if(_0x439a26[_0x7ef9('0x25')]['code']===0x1f4){logger['error'](_0x7ef9('0x20'),_0x5baeae,_0x439a26[_0x7ef9('0x25')]['message']);return _0x57206d(_0x439a26[_0x7ef9('0x25')][_0x7ef9('0x26')]);}logger[_0x7ef9('0x25')](_0x7ef9('0x20'),_0x5baeae,_0x439a26['error'][_0x7ef9('0x26')]);return _0x4f7406(_0x439a26['error'][_0x7ef9('0x26')]);}else{logger['info'](_0x7ef9('0x20'),_0x5baeae,_0x7ef9('0x21'));_0x4f7406(_0x439a26[_0x7ef9('0x27')][_0x7ef9('0x26')]);}})[_0x7ef9('0x28')](function(_0x986fc7){logger[_0x7ef9('0x25')](_0x7ef9('0x20'),_0x5baeae,_0x986fc7);_0x57206d(_0x986fc7);});});}function respondWithStatusCode(_0x1a17d1,_0x4621ed){_0x4621ed=_0x4621ed||0xcc;return function(_0x6fdf80){if(_0x6fdf80){return _0x1a17d1[_0x7ef9('0x29')](_0x4621ed);}return _0x1a17d1['status'](_0x4621ed)['end']();};}function respondWithResult(_0x146772,_0x494a72){_0x494a72=_0x494a72||0xc8;return function(_0x4f4370){if(_0x4f4370){return _0x146772[_0x7ef9('0x2a')](_0x494a72)[_0x7ef9('0x2b')](_0x4f4370);}};}function respondWithFilteredResult(_0x5479ba,_0x56b072){return function(_0x1c5ff2){if(_0x1c5ff2){var _0x3353a5=typeof _0x56b072[_0x7ef9('0x2c')]===_0x7ef9('0x2d')&&typeof _0x56b072[_0x7ef9('0x2e')]===_0x7ef9('0x2d');var _0x238e1f=_0x1c5ff2[_0x7ef9('0x2f')];var _0x208c88=_0x3353a5?0x0:_0x56b072['offset'];var _0x211b67=_0x3353a5?_0x1c5ff2['count']:_0x56b072[_0x7ef9('0x2c')]+_0x56b072[_0x7ef9('0x2e')];var _0x3acac8;if(_0x211b67>=_0x238e1f){_0x211b67=_0x238e1f;_0x3acac8=0xc8;}else{_0x3acac8=0xce;}_0x5479ba['status'](_0x3acac8);return _0x5479ba['set'](_0x7ef9('0x30'),_0x208c88+'-'+_0x211b67+'/'+_0x238e1f)[_0x7ef9('0x2b')](_0x1c5ff2);}return null;};}function patchUpdates(_0x1e6caf){return function(_0x465ad7){try{jsonpatch[_0x7ef9('0x31')](_0x465ad7,_0x1e6caf,!![]);}catch(_0x558e9e){return BPromise[_0x7ef9('0x32')](_0x558e9e);}return _0x465ad7[_0x7ef9('0x33')]();};}function saveUpdates(_0x2658f0,_0xc6d2ce){return function(_0x162062){if(_0x162062){return _0x162062[_0x7ef9('0x34')](_0x2658f0)[_0x7ef9('0x1e')](function(_0x3dba72){return _0x3dba72;});}return null;};}function removeEntity(_0x354fbf,_0x64a737){return function(_0x2c5cdc){if(_0x2c5cdc){return _0x2c5cdc[_0x7ef9('0x35')]()['then'](function(){var _0x499b82=_0x2c5cdc[_0x7ef9('0x36')]({'plain':!![]});var _0x176708='Contexts';return db[_0x7ef9('0x37')][_0x7ef9('0x35')]({'where':{'type':_0x176708,'resourceId':_0x499b82['id']}})['then'](function(){return _0x2c5cdc;});})[_0x7ef9('0x1e')](function(){_0x354fbf[_0x7ef9('0x2a')](0xcc)[_0x7ef9('0x38')]();});}};}function handleEntityNotFound(_0x432d2a,_0x9d716){return function(_0x10cc43){if(!_0x10cc43){_0x432d2a['sendStatus'](0x194);}return _0x10cc43;};}function handleError(_0x511c2f,_0x17b12b){_0x17b12b=_0x17b12b||0x1f4;return function(_0x469c20){logger[_0x7ef9('0x25')](_0x469c20[_0x7ef9('0x39')]);if(_0x469c20[_0x7ef9('0x3a')]){delete _0x469c20[_0x7ef9('0x3a')];}_0x511c2f['status'](_0x17b12b)['send'](_0x469c20);};}exports[_0x7ef9('0x3b')]=function(_0x2dc254,_0x3521a7){var _0x39af24={},_0x339ad2={},_0x6345ff={'count':0x0,'rows':[]};var _0x546e2c=_[_0x7ef9('0x3c')](db['VoiceContext']['rawAttributes'],function(_0x5d51da){return{'name':_0x5d51da[_0x7ef9('0x3d')],'type':_0x5d51da['type'][_0x7ef9('0x3e')]};});_0x339ad2[_0x7ef9('0x3f')]=_[_0x7ef9('0x3c')](_0x546e2c,_0x7ef9('0x3a'));_0x339ad2[_0x7ef9('0x40')]=_['keys'](_0x2dc254[_0x7ef9('0x40')]);_0x339ad2[_0x7ef9('0x41')]=_[_0x7ef9('0x42')](_0x339ad2['model'],_0x339ad2[_0x7ef9('0x40')]);_0x39af24[_0x7ef9('0x43')]=_['intersection'](_0x339ad2['model'],qs[_0x7ef9('0x44')](_0x2dc254[_0x7ef9('0x40')][_0x7ef9('0x44')]));_0x39af24[_0x7ef9('0x43')]=_0x39af24['attributes'][_0x7ef9('0x45')]?_0x39af24[_0x7ef9('0x43')]:_0x339ad2[_0x7ef9('0x3f')];if(!_0x2dc254[_0x7ef9('0x40')][_0x7ef9('0x46')](_0x7ef9('0x47'))){_0x39af24[_0x7ef9('0x2e')]=qs[_0x7ef9('0x2e')](_0x2dc254[_0x7ef9('0x40')]['limit']);_0x39af24['offset']=qs[_0x7ef9('0x2c')](_0x2dc254[_0x7ef9('0x40')][_0x7ef9('0x2c')]);}_0x39af24['order']=qs[_0x7ef9('0x48')](_0x2dc254[_0x7ef9('0x40')][_0x7ef9('0x48')]);_0x39af24['where']=qs[_0x7ef9('0x41')](_['pick'](_0x2dc254[_0x7ef9('0x40')],_0x339ad2[_0x7ef9('0x41')]),_0x546e2c);if(_0x2dc254[_0x7ef9('0x40')]['filter']){_0x39af24[_0x7ef9('0x49')]=_['merge'](_0x39af24['where'],{'$or':_[_0x7ef9('0x3c')](_0x546e2c,function(_0x21687b){if(_0x21687b[_0x7ef9('0x4a')]!==_0x7ef9('0x4b')){var _0x1bd21c={};_0x1bd21c[_0x21687b[_0x7ef9('0x3a')]]={'$like':'%'+_0x2dc254[_0x7ef9('0x40')]['filter']+'%'};return _0x1bd21c;}})});}_0x39af24=_[_0x7ef9('0x4c')]({},_0x39af24,_0x2dc254[_0x7ef9('0x4d')]);var _0x5d260c={'where':_0x39af24[_0x7ef9('0x49')]};return db[_0x7ef9('0x4e')][_0x7ef9('0x2f')](_0x5d260c)[_0x7ef9('0x1e')](function(_0x17ec48){_0x6345ff[_0x7ef9('0x2f')]=_0x17ec48;if(_0x2dc254[_0x7ef9('0x40')][_0x7ef9('0x4f')]){_0x39af24[_0x7ef9('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0x7ef9('0x51')](_0x39af24);})[_0x7ef9('0x1e')](function(_0x1d4523){_0x6345ff['rows']=_0x1d4523;return _0x6345ff;})[_0x7ef9('0x1e')](respondWithFilteredResult(_0x3521a7,_0x39af24))[_0x7ef9('0x28')](handleError(_0x3521a7,null));};exports[_0x7ef9('0x52')]=function(_0xfb3b76,_0x2b6b99){var _0x4771ca={'raw':![],'where':{'id':_0xfb3b76[_0x7ef9('0x53')]['id']}},_0x2957a6={};_0x2957a6[_0x7ef9('0x3f')]=_[_0x7ef9('0x54')](db['VoiceContext']['rawAttributes']);_0x2957a6[_0x7ef9('0x40')]=_[_0x7ef9('0x54')](_0xfb3b76['query']);_0x2957a6[_0x7ef9('0x41')]=_[_0x7ef9('0x42')](_0x2957a6[_0x7ef9('0x3f')],_0x2957a6[_0x7ef9('0x40')]);_0x4771ca[_0x7ef9('0x43')]=_['intersection'](_0x2957a6[_0x7ef9('0x3f')],qs[_0x7ef9('0x44')](_0xfb3b76[_0x7ef9('0x40')][_0x7ef9('0x44')]));_0x4771ca[_0x7ef9('0x43')]=_0x4771ca[_0x7ef9('0x43')][_0x7ef9('0x45')]?_0x4771ca[_0x7ef9('0x43')]:_0x2957a6[_0x7ef9('0x3f')];if(_0xfb3b76[_0x7ef9('0x40')][_0x7ef9('0x4f')]){_0x4771ca[_0x7ef9('0x50')]=[{'all':!![]}];}_0x4771ca=_[_0x7ef9('0x4c')]({},_0x4771ca,_0xfb3b76[_0x7ef9('0x4d')]);return db['VoiceContext'][_0x7ef9('0x55')](_0x4771ca)[_0x7ef9('0x1e')](handleEntityNotFound(_0x2b6b99,null))['then'](respondWithResult(_0x2b6b99,null))[_0x7ef9('0x28')](handleError(_0x2b6b99,null));};exports[_0x7ef9('0x56')]=function(_0x567a1c,_0x25c85e,_0x4108a6){var _0x164742;return db[_0x7ef9('0x4e')]['create'](_0x567a1c[_0x7ef9('0x57')],{'raw':!![]})[_0x7ef9('0x1e')](function(_0x314866){_0x164742=_0x314866;return db[_0x7ef9('0x4e')][_0x7ef9('0x51')]({'raw':!![]});})[_0x7ef9('0x1e')](function(_0x9fd758){var _0xe4de98=fs['readFileSync'](path[_0x7ef9('0x58')](config[_0x7ef9('0x59')],_0x7ef9('0x5a')),_0x7ef9('0x5b'));var _0xa4fca9=ejs[_0x7ef9('0x5c')](_0xe4de98,{'contexts':_0x9fd758||[]});fs['writeFileSync'](_0x7ef9('0x5d'),_0xa4fca9);})['then'](function(){return respondWithRpcPromise(_0x7ef9('0x5e'),_0x7ef9('0x56'),{'module':'chan_sip.so'});})['then'](function(){var _0x5bc8e8=_0x567a1c[_0x7ef9('0x5f')]['get']({'plain':!![]});if(!_0x5bc8e8)throw new Error(_0x7ef9('0x60'));if(_0x5bc8e8[_0x7ef9('0x61')]===_0x7ef9('0x5f')){var _0x573f66=_0x164742[_0x7ef9('0x36')]({'plain':!![]});return db[_0x7ef9('0x62')][_0x7ef9('0x55')]({'where':{'name':_0x7ef9('0x63'),'userProfileId':_0x5bc8e8['userProfileId']},'raw':!![]})[_0x7ef9('0x1e')](function(_0x56e19f){if(_0x56e19f&&_0x56e19f['autoAssociation']===0x0){return db[_0x7ef9('0x37')]['create']({'name':_0x573f66[_0x7ef9('0x3a')],'resourceId':_0x573f66['id'],'type':_0x56e19f[_0x7ef9('0x3a')],'sectionId':_0x56e19f['id']},{})[_0x7ef9('0x1e')](function(){return _0x164742;});}else{return _0x164742;}})[_0x7ef9('0x28')](function(_0x46a7c0){logger[_0x7ef9('0x25')](_0x7ef9('0x64'),_0x46a7c0);throw _0x46a7c0;});}return _0x164742;})[_0x7ef9('0x1e')](respondWithResult(_0x25c85e,0xc9))[_0x7ef9('0x28')](handleError(_0x25c85e,null));};exports['update']=function(_0x272fdd,_0x53964d,_0x38e31b){var _0xdebba3;return db['VoiceContext'][_0x7ef9('0x55')]({'where':{'id':_0x272fdd[_0x7ef9('0x53')]['id']}})[_0x7ef9('0x1e')](handleEntityNotFound(_0x53964d,null))[_0x7ef9('0x1e')](saveUpdates(_0x272fdd[_0x7ef9('0x57')],null))['then'](function(_0x530050){if(_0x530050){_0xdebba3=_0x530050;return db[_0x7ef9('0x4e')][_0x7ef9('0x51')]({'raw':!![]});}})[_0x7ef9('0x1e')](function(_0x563fb7){var _0x52e264=fs[_0x7ef9('0x65')](path[_0x7ef9('0x58')](config[_0x7ef9('0x59')],_0x7ef9('0x5a')),_0x7ef9('0x5b'));var _0x2b5a6e=ejs[_0x7ef9('0x5c')](_0x52e264,{'contexts':_0x563fb7||[]});fs['writeFileSync'](_0x7ef9('0x5d'),_0x2b5a6e);})['then'](function(){return respondWithRpcPromise(_0x7ef9('0x5e'),_0x7ef9('0x34'),{'module':'chan_sip.so'});})[_0x7ef9('0x1e')](function(){return _0xdebba3;})[_0x7ef9('0x1e')](respondWithResult(_0x53964d,null))[_0x7ef9('0x28')](handleError(_0x53964d,null));};exports['destroy']=function(_0x5ea7b8,_0x4a09b2,_0x499451){var _0x39d293;return db[_0x7ef9('0x4e')][_0x7ef9('0x55')]({'where':{'id':_0x5ea7b8['params']['id']}})[_0x7ef9('0x1e')](handleEntityNotFound(_0x4a09b2,null))[_0x7ef9('0x1e')](removeEntity(_0x4a09b2,null))[_0x7ef9('0x1e')](function(){return db[_0x7ef9('0x4e')]['findAll']({'raw':!![]});})[_0x7ef9('0x1e')](function(_0x31c2b6){var _0x4e0f12=fs[_0x7ef9('0x65')](path[_0x7ef9('0x58')](config[_0x7ef9('0x59')],_0x7ef9('0x5a')),_0x7ef9('0x5b'));var _0xea6b5f=ejs[_0x7ef9('0x5c')](_0x4e0f12,{'contexts':_0x31c2b6});fs[_0x7ef9('0x66')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xea6b5f);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});})['catch'](handleError(_0x4a09b2,null));}; \ No newline at end of file +var _0x0d3a=['key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','destroy','get','Contexts','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','fieldName','type'];(function(_0x1c987e,_0x596ef1){var _0x3620a1=function(_0x454157){while(--_0x454157){_0x1c987e['push'](_0x1c987e['shift']());}};_0x3620a1(++_0x596ef1);}(_0x0d3a,0x163));var _0xa0d3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0d3a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xa0d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0d3('0x1'));var jsonpatch=require(_0xa0d3('0x2'));var rp=require(_0xa0d3('0x3'));var moment=require(_0xa0d3('0x4'));var BPromise=require(_0xa0d3('0x5'));var Mustache=require(_0xa0d3('0x6'));var util=require(_0xa0d3('0x7'));var path=require(_0xa0d3('0x8'));var sox=require(_0xa0d3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0d3('0xa'));var _=require(_0xa0d3('0xb'));var squel=require(_0xa0d3('0xc'));var crypto=require(_0xa0d3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa0d3('0xe'));var toCsv=require(_0xa0d3('0xf'));var querystring=require('querystring');var Papa=require(_0xa0d3('0x10'));var Redis=require(_0xa0d3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa0d3('0x12'));var hardwareService=require(_0xa0d3('0x13'));var logger=require(_0xa0d3('0x14'))(_0xa0d3('0x15'));var utils=require('../../config/utils');var config=require(_0xa0d3('0x16'));var licenseUtil=require(_0xa0d3('0x17'));var db=require(_0xa0d3('0x18'))['db'];var jayson=require(_0xa0d3('0x19'));var client=jayson[_0xa0d3('0x1a')][_0xa0d3('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x59552b,_0x3043cc,_0x42f1fe,_0x418bd3){return new BPromise(function(_0xadbed5,_0xfdbc77){var _0x30e778=_0x418bd3||client;return _0x30e778['request'](_0x59552b,_0x42f1fe)[_0xa0d3('0x1c')](function(_0x5ecfd7){logger[_0xa0d3('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x3043cc,_0xa0d3('0x1e'));logger[_0xa0d3('0x1f')](_0xa0d3('0x20'),_0x3043cc,_0xa0d3('0x1e'),JSON[_0xa0d3('0x21')](_0x5ecfd7));if(_0x5ecfd7[_0xa0d3('0x22')]){if(_0x5ecfd7['error']['code']===0x1f4){logger[_0xa0d3('0x22')](_0xa0d3('0x23'),_0x3043cc,_0x5ecfd7[_0xa0d3('0x22')][_0xa0d3('0x24')]);return _0xfdbc77(_0x5ecfd7[_0xa0d3('0x22')][_0xa0d3('0x24')]);}logger[_0xa0d3('0x22')](_0xa0d3('0x23'),_0x3043cc,_0x5ecfd7[_0xa0d3('0x22')][_0xa0d3('0x24')]);return _0xadbed5(_0x5ecfd7[_0xa0d3('0x22')][_0xa0d3('0x24')]);}else{logger[_0xa0d3('0x1d')](_0xa0d3('0x23'),_0x3043cc,_0xa0d3('0x1e'));_0xadbed5(_0x5ecfd7[_0xa0d3('0x25')][_0xa0d3('0x24')]);}})['catch'](function(_0x360fce){logger[_0xa0d3('0x22')](_0xa0d3('0x23'),_0x3043cc,_0x360fce);_0xfdbc77(_0x360fce);});});}function respondWithStatusCode(_0x260d80,_0x25c885){_0x25c885=_0x25c885||0xcc;return function(_0x3a2ee6){if(_0x3a2ee6){return _0x260d80[_0xa0d3('0x26')](_0x25c885);}return _0x260d80[_0xa0d3('0x27')](_0x25c885)[_0xa0d3('0x28')]();};}function respondWithResult(_0x99be14,_0x5ee4cf){_0x5ee4cf=_0x5ee4cf||0xc8;return function(_0x54cd98){if(_0x54cd98){return _0x99be14[_0xa0d3('0x27')](_0x5ee4cf)[_0xa0d3('0x29')](_0x54cd98);}};}function respondWithFilteredResult(_0x522846,_0x4a2346){return function(_0xce932e){if(_0xce932e){var _0x3f9025=typeof _0x4a2346['offset']===_0xa0d3('0x2a')&&typeof _0x4a2346[_0xa0d3('0x2b')]===_0xa0d3('0x2a');var _0x489d9b=_0xce932e[_0xa0d3('0x2c')];var _0x2e6570=_0x3f9025?0x0:_0x4a2346[_0xa0d3('0x2d')];var _0x279e49=_0x3f9025?_0xce932e['count']:_0x4a2346['offset']+_0x4a2346[_0xa0d3('0x2b')];var _0x2fb0fa;if(_0x279e49>=_0x489d9b){_0x279e49=_0x489d9b;_0x2fb0fa=0xc8;}else{_0x2fb0fa=0xce;}_0x522846[_0xa0d3('0x27')](_0x2fb0fa);return _0x522846['set'](_0xa0d3('0x2e'),_0x2e6570+'-'+_0x279e49+'/'+_0x489d9b)[_0xa0d3('0x29')](_0xce932e);}return null;};}function patchUpdates(_0x15ca96){return function(_0x55c132){try{jsonpatch['apply'](_0x55c132,_0x15ca96,!![]);}catch(_0x567264){return BPromise[_0xa0d3('0x2f')](_0x567264);}return _0x55c132['save']();};}function saveUpdates(_0x3f450d,_0x46addb){return function(_0x313003){if(_0x313003){return _0x313003[_0xa0d3('0x30')](_0x3f450d)[_0xa0d3('0x1c')](function(_0x540aa9){return _0x540aa9;});}return null;};}function removeEntity(_0x36020e,_0x163bab){return function(_0x48f4fc){if(_0x48f4fc){return _0x48f4fc[_0xa0d3('0x31')]()[_0xa0d3('0x1c')](function(){var _0x2ec735=_0x48f4fc[_0xa0d3('0x32')]({'plain':!![]});var _0x4bdf0a=_0xa0d3('0x33');return db[_0xa0d3('0x34')]['destroy']({'where':{'type':_0x4bdf0a,'resourceId':_0x2ec735['id']}})[_0xa0d3('0x1c')](function(){return _0x48f4fc;});})[_0xa0d3('0x1c')](function(){_0x36020e[_0xa0d3('0x27')](0xcc)[_0xa0d3('0x28')]();});}};}function handleEntityNotFound(_0x463603,_0x51bd36){return function(_0x53e0d4){if(!_0x53e0d4){_0x463603[_0xa0d3('0x26')](0x194);}return _0x53e0d4;};}function handleError(_0x34c519,_0x2a7e00){_0x2a7e00=_0x2a7e00||0x1f4;return function(_0x4e98d0){logger[_0xa0d3('0x22')](_0x4e98d0['stack']);if(_0x4e98d0['name']){delete _0x4e98d0[_0xa0d3('0x35')];}_0x34c519['status'](_0x2a7e00)[_0xa0d3('0x36')](_0x4e98d0);};}exports[_0xa0d3('0x37')]=function(_0x46a5f5,_0x4ce97f){var _0x7444e5={},_0x3b8c59={},_0x526b7c={'count':0x0,'rows':[]};var _0x52a6d7=_[_0xa0d3('0x38')](db[_0xa0d3('0x39')][_0xa0d3('0x3a')],function(_0x10f8e2){return{'name':_0x10f8e2[_0xa0d3('0x3b')],'type':_0x10f8e2[_0xa0d3('0x3c')][_0xa0d3('0x3d')]};});_0x3b8c59['model']=_[_0xa0d3('0x38')](_0x52a6d7,'name');_0x3b8c59[_0xa0d3('0x3e')]=_['keys'](_0x46a5f5[_0xa0d3('0x3e')]);_0x3b8c59['filters']=_[_0xa0d3('0x3f')](_0x3b8c59[_0xa0d3('0x40')],_0x3b8c59[_0xa0d3('0x3e')]);_0x7444e5[_0xa0d3('0x41')]=_[_0xa0d3('0x3f')](_0x3b8c59[_0xa0d3('0x40')],qs[_0xa0d3('0x42')](_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x42')]));_0x7444e5[_0xa0d3('0x41')]=_0x7444e5[_0xa0d3('0x41')][_0xa0d3('0x43')]?_0x7444e5[_0xa0d3('0x41')]:_0x3b8c59['model'];if(!_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x44')](_0xa0d3('0x45'))){_0x7444e5[_0xa0d3('0x2b')]=qs[_0xa0d3('0x2b')](_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x2b')]);_0x7444e5[_0xa0d3('0x2d')]=qs['offset'](_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x2d')]);}_0x7444e5[_0xa0d3('0x46')]=qs[_0xa0d3('0x47')](_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x47')]);_0x7444e5[_0xa0d3('0x48')]=qs[_0xa0d3('0x49')](_[_0xa0d3('0x4a')](_0x46a5f5['query'],_0x3b8c59['filters']),_0x52a6d7);if(_0x46a5f5['query'][_0xa0d3('0x4b')]){_0x7444e5[_0xa0d3('0x48')]=_['merge'](_0x7444e5[_0xa0d3('0x48')],{'$or':_[_0xa0d3('0x38')](_0x52a6d7,function(_0x57eabf){if(_0x57eabf[_0xa0d3('0x3c')]!=='VIRTUAL'){var _0x3c3129={};_0x3c3129[_0x57eabf[_0xa0d3('0x35')]]={'$like':'%'+_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x4b')]+'%'};return _0x3c3129;}})});}_0x7444e5=_[_0xa0d3('0x4c')]({},_0x7444e5,_0x46a5f5[_0xa0d3('0x4d')]);var _0x2841a7={'where':_0x7444e5[_0xa0d3('0x48')]};return db['VoiceContext']['count'](_0x2841a7)[_0xa0d3('0x1c')](function(_0x32464f){_0x526b7c['count']=_0x32464f;if(_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x4e')]){_0x7444e5[_0xa0d3('0x4f')]=[{'all':!![]}];}return db[_0xa0d3('0x39')][_0xa0d3('0x50')](_0x7444e5);})['then'](function(_0x3a487c){_0x526b7c[_0xa0d3('0x51')]=_0x3a487c;return _0x526b7c;})[_0xa0d3('0x1c')](respondWithFilteredResult(_0x4ce97f,_0x7444e5))[_0xa0d3('0x52')](handleError(_0x4ce97f,null));};exports['show']=function(_0xf2068,_0x56af57){var _0x4416ce={'raw':![],'where':{'id':_0xf2068[_0xa0d3('0x53')]['id']}},_0x116cfc={};_0x116cfc[_0xa0d3('0x40')]=_[_0xa0d3('0x54')](db[_0xa0d3('0x39')]['rawAttributes']);_0x116cfc['query']=_['keys'](_0xf2068[_0xa0d3('0x3e')]);_0x116cfc[_0xa0d3('0x49')]=_[_0xa0d3('0x3f')](_0x116cfc[_0xa0d3('0x40')],_0x116cfc[_0xa0d3('0x3e')]);_0x4416ce[_0xa0d3('0x41')]=_['intersection'](_0x116cfc['model'],qs[_0xa0d3('0x42')](_0xf2068['query'][_0xa0d3('0x42')]));_0x4416ce['attributes']=_0x4416ce[_0xa0d3('0x41')]['length']?_0x4416ce[_0xa0d3('0x41')]:_0x116cfc['model'];if(_0xf2068[_0xa0d3('0x3e')][_0xa0d3('0x4e')]){_0x4416ce[_0xa0d3('0x4f')]=[{'all':!![]}];}_0x4416ce=_[_0xa0d3('0x4c')]({},_0x4416ce,_0xf2068[_0xa0d3('0x4d')]);return db['VoiceContext'][_0xa0d3('0x55')](_0x4416ce)[_0xa0d3('0x1c')](handleEntityNotFound(_0x56af57,null))['then'](respondWithResult(_0x56af57,null))['catch'](handleError(_0x56af57,null));};exports['create']=function(_0x46a8b7,_0x4a8087,_0x70e6d6){var _0x1fbdbc;return db[_0xa0d3('0x39')][_0xa0d3('0x56')](_0x46a8b7[_0xa0d3('0x57')],{'raw':!![]})['then'](function(_0x2210e1){_0x1fbdbc=_0x2210e1;return db[_0xa0d3('0x39')][_0xa0d3('0x50')]({'raw':!![]});})['then'](function(_0x3eefde){var _0x154a23=fs[_0xa0d3('0x58')](path[_0xa0d3('0x59')](config[_0xa0d3('0x5a')],_0xa0d3('0x5b')),_0xa0d3('0x5c'));var _0x258e03=ejs['render'](_0x154a23,{'contexts':_0x3eefde||[]});fs[_0xa0d3('0x5d')](_0xa0d3('0x5e'),_0x258e03);})['then'](function(){return respondWithRpcPromise(_0xa0d3('0x5f'),'create',{'module':_0xa0d3('0x60')});})[_0xa0d3('0x1c')](function(){var _0x19b6df=_0x46a8b7[_0xa0d3('0x61')][_0xa0d3('0x32')]({'plain':!![]});if(!_0x19b6df)throw new Error(_0xa0d3('0x62'));if(_0x19b6df[_0xa0d3('0x63')]===_0xa0d3('0x61')){var _0x5f416e=_0x1fbdbc[_0xa0d3('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xa0d3('0x55')]({'where':{'name':_0xa0d3('0x33'),'userProfileId':_0x19b6df[_0xa0d3('0x64')]},'raw':!![]})[_0xa0d3('0x1c')](function(_0x24d3ec){if(_0x24d3ec&&_0x24d3ec[_0xa0d3('0x65')]===0x0){return db[_0xa0d3('0x34')][_0xa0d3('0x56')]({'name':_0x5f416e[_0xa0d3('0x35')],'resourceId':_0x5f416e['id'],'type':_0x24d3ec[_0xa0d3('0x35')],'sectionId':_0x24d3ec['id']},{})[_0xa0d3('0x1c')](function(){return _0x1fbdbc;});}else{return _0x1fbdbc;}})[_0xa0d3('0x52')](function(_0x278617){logger[_0xa0d3('0x22')](_0xa0d3('0x66'),_0x278617);throw _0x278617;});}return _0x1fbdbc;})[_0xa0d3('0x1c')](respondWithResult(_0x4a8087,0xc9))[_0xa0d3('0x52')](handleError(_0x4a8087,null));};exports[_0xa0d3('0x30')]=function(_0x1e7f3e,_0x5dd3a3,_0x38c640){var _0x1df2f0;return db[_0xa0d3('0x39')][_0xa0d3('0x55')]({'where':{'id':_0x1e7f3e['params']['id']}})[_0xa0d3('0x1c')](handleEntityNotFound(_0x5dd3a3,null))[_0xa0d3('0x1c')](saveUpdates(_0x1e7f3e['body'],null))[_0xa0d3('0x1c')](function(_0x378b28){if(_0x378b28){_0x1df2f0=_0x378b28;return db[_0xa0d3('0x39')][_0xa0d3('0x50')]({'raw':!![]});}})[_0xa0d3('0x1c')](function(_0x50250b){var _0x47393b=fs['readFileSync'](path[_0xa0d3('0x59')](config[_0xa0d3('0x5a')],_0xa0d3('0x5b')),_0xa0d3('0x5c'));var _0x35b5b8=ejs[_0xa0d3('0x67')](_0x47393b,{'contexts':_0x50250b||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x35b5b8);})[_0xa0d3('0x1c')](function(){return respondWithRpcPromise(_0xa0d3('0x5f'),_0xa0d3('0x30'),{'module':_0xa0d3('0x60')});})[_0xa0d3('0x1c')](function(){return _0x1df2f0;})['then'](respondWithResult(_0x5dd3a3,null))[_0xa0d3('0x52')](handleError(_0x5dd3a3,null));};exports[_0xa0d3('0x31')]=function(_0x44abfa,_0x1a1a2c,_0x41f0dc){var _0x1d94db;return db['VoiceContext']['find']({'where':{'id':_0x44abfa[_0xa0d3('0x53')]['id']}})[_0xa0d3('0x1c')](handleEntityNotFound(_0x1a1a2c,null))[_0xa0d3('0x1c')](removeEntity(_0x1a1a2c,null))[_0xa0d3('0x1c')](function(){return db[_0xa0d3('0x39')]['findAll']({'raw':!![]});})[_0xa0d3('0x1c')](function(_0x97329a){var _0x1d0a94=fs[_0xa0d3('0x58')](path[_0xa0d3('0x59')](config['root'],_0xa0d3('0x5b')),_0xa0d3('0x5c'));var _0x4414fd=ejs[_0xa0d3('0x67')](_0x1d0a94,{'contexts':_0x97329a});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x4414fd);return respondWithRpcPromise(_0xa0d3('0x5f'),_0xa0d3('0x31'),{'module':_0xa0d3('0x60')});})[_0xa0d3('0x52')](handleError(_0x1a1a2c,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 02450d3..d734352 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 _0xa409=['../../config/environment','exports','define','VoiceContext','lodash','util','../../config/logger','api','rimraf'];(function(_0x23e7d0,_0x513d8c){var _0x3fc0f0=function(_0x1ff09b){while(--_0x1ff09b){_0x23e7d0['push'](_0x23e7d0['shift']());}};_0x3fc0f0(++_0x513d8c);}(_0xa409,0x15a));var _0x9a40=function(_0xc472fc,_0x5e7309){_0xc472fc=_0xc472fc-0x0;var _0x5932e8=_0xa409[_0xc472fc];return _0x5932e8;};'use strict';var _=require(_0x9a40('0x0'));var util=require(_0x9a40('0x1'));var logger=require(_0x9a40('0x2'))(_0x9a40('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9a40('0x4'));var config=require(_0x9a40('0x5'));var attributes=require('./voiceContext.attributes');module[_0x9a40('0x6')]=function(_0x362545,_0xfd117c){return _0x362545[_0x9a40('0x7')](_0x9a40('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f21=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8f21,0x1ee));var _0x18f2=function(_0x1bc1dc,_0x5b6b90){_0x1bc1dc=_0x1bc1dc-0x0;var _0x6c89c8=_0x8f21[_0x1bc1dc];return _0x6c89c8;};'use strict';var _=require('lodash');var util=require(_0x18f2('0x0'));var logger=require(_0x18f2('0x1'))(_0x18f2('0x2'));var moment=require(_0x18f2('0x3'));var BPromise=require(_0x18f2('0x4'));var rp=require(_0x18f2('0x5'));var fs=require('fs');var path=require(_0x18f2('0x6'));var rimraf=require('rimraf');var config=require(_0x18f2('0x7'));var attributes=require(_0x18f2('0x8'));module[_0x18f2('0x9')]=function(_0x29c286,_0x282a0a){return _0x29c286[_0x18f2('0xa')](_0x18f2('0xb'),attributes,{'tableName':_0x18f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 0e1eb17..c77f703 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 _0x2f8b=['request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x5a7755,_0x28bfc4){var _0x5604f5=function(_0x1a4903){while(--_0x1a4903){_0x5a7755['push'](_0x5a7755['shift']());}};_0x5604f5(++_0x28bfc4);}(_0x2f8b,0x96));var _0xb2f8=function(_0xb42aee,_0x4b8bc9){_0xb42aee=_0xb42aee-0x0;var _0x434a79=_0x2f8b[_0xb42aee];return _0x434a79;};'use strict';var _=require(_0xb2f8('0x0'));var util=require(_0xb2f8('0x1'));var moment=require('moment');var BPromise=require(_0xb2f8('0x2'));var rs=require(_0xb2f8('0x3'));var fs=require('fs');var Redis=require(_0xb2f8('0x4'));var db=require(_0xb2f8('0x5'))['db'];var utils=require(_0xb2f8('0x6'));var logger=require(_0xb2f8('0x7'))(_0xb2f8('0x8'));var config=require('../../config/environment');var jayson=require(_0xb2f8('0x9'));var client=jayson[_0xb2f8('0xa')][_0xb2f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b9235,_0x5a3755,_0x582b60){return new BPromise(function(_0x23dba6,_0x273476){return client[_0xb2f8('0xc')](_0x5b9235,_0x582b60)[_0xb2f8('0xd')](function(_0x1c053b){logger[_0xb2f8('0xe')](_0xb2f8('0xf'),_0x5a3755,'request\x20sent');logger[_0xb2f8('0x10')](_0xb2f8('0x11'),_0x5a3755,_0xb2f8('0x12'),JSON[_0xb2f8('0x13')](_0x1c053b));if(_0x1c053b[_0xb2f8('0x14')]){if(_0x1c053b[_0xb2f8('0x14')][_0xb2f8('0x15')]===0x1f4){logger[_0xb2f8('0x14')](_0xb2f8('0xf'),_0x5a3755,_0x1c053b[_0xb2f8('0x14')][_0xb2f8('0x16')]);return _0x273476(_0x1c053b[_0xb2f8('0x14')][_0xb2f8('0x16')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x5a3755,_0x1c053b[_0xb2f8('0x14')][_0xb2f8('0x16')]);return _0x23dba6(_0x1c053b['error'][_0xb2f8('0x16')]);}else{logger[_0xb2f8('0xe')](_0xb2f8('0xf'),_0x5a3755,_0xb2f8('0x12'));_0x23dba6(_0x1c053b['result']['message']);}})[_0xb2f8('0x17')](function(_0x20ebf9){logger['error'](_0xb2f8('0xf'),_0x5a3755,_0x20ebf9);_0x273476(_0x20ebf9);});});} \ No newline at end of file +var _0xde1e=['client','request','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x21e4bb,_0x10691d){var _0x2a7639=function(_0x2820de){while(--_0x2820de){_0x21e4bb['push'](_0x21e4bb['shift']());}};_0x2a7639(++_0x10691d);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xede1('0x0'));var util=require(_0xede1('0x1'));var moment=require(_0xede1('0x2'));var BPromise=require(_0xede1('0x3'));var rs=require(_0xede1('0x4'));var fs=require('fs');var Redis=require(_0xede1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xede1('0x6'));var logger=require(_0xede1('0x7'))(_0xede1('0x8'));var config=require(_0xede1('0x9'));var jayson=require(_0xede1('0xa'));var client=jayson[_0xede1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a4671,_0xeeec58,_0x1722c9){return new BPromise(function(_0x452e74,_0x29fe67){return client[_0xede1('0xc')](_0x3a4671,_0x1722c9)['then'](function(_0xa1641){logger['info']('VoiceContext,\x20%s,\x20%s',_0xeeec58,_0xede1('0xd'));logger[_0xede1('0xe')](_0xede1('0xf'),_0xeeec58,_0xede1('0xd'),JSON[_0xede1('0x10')](_0xa1641));if(_0xa1641[_0xede1('0x11')]){if(_0xa1641['error'][_0xede1('0x12')]===0x1f4){logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0xa1641['error']['message']);return _0x29fe67(_0xa1641[_0xede1('0x11')][_0xede1('0x14')]);}logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0xa1641[_0xede1('0x11')]['message']);return _0x452e74(_0xa1641[_0xede1('0x11')][_0xede1('0x14')]);}else{logger[_0xede1('0x15')](_0xede1('0x13'),_0xeeec58,_0xede1('0xd'));_0x452e74(_0xa1641[_0xede1('0x16')][_0xede1('0x14')]);}})[_0xede1('0x17')](function(_0x5648fb){logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0x5648fb);_0x29fe67(_0x5648fb);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 73f9400..87ce23c 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 _0xeb34=['/:id','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x2077b4,_0x320858){var _0x3e57d2=function(_0x48ebf8){while(--_0x48ebf8){_0x2077b4['push'](_0x2077b4['shift']());}};_0x3e57d2(++_0x320858);}(_0xeb34,0xc9));var _0x4eb3=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0xeb34[_0x5c846d];return _0xd064e4;};'use strict';var multer=require(_0x4eb3('0x0'));var util=require(_0x4eb3('0x1'));var path=require('path');var timeout=require(_0x4eb3('0x2'));var express=require(_0x4eb3('0x3'));var router=express['Router']();var fs_extra=require(_0x4eb3('0x4'));var auth=require(_0x4eb3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4eb3('0x6'));var controller=require(_0x4eb3('0x7'));router[_0x4eb3('0x8')]('/',auth[_0x4eb3('0x9')](),controller[_0x4eb3('0xa')]);router[_0x4eb3('0x8')](_0x4eb3('0xb'),auth[_0x4eb3('0x9')](),controller[_0x4eb3('0xc')]);router[_0x4eb3('0x8')]('/:id',auth[_0x4eb3('0x9')](),controller[_0x4eb3('0xd')]);router[_0x4eb3('0xe')]('/',auth[_0x4eb3('0x9')](),controller['create']);router['put'](_0x4eb3('0xf'),auth['isAuthenticated'](),controller[_0x4eb3('0x10')]);router['delete'](_0x4eb3('0xf'),auth[_0x4eb3('0x9')](),controller['destroy']);module[_0x4eb3('0x11')]=router; \ No newline at end of file +var _0x20ce=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4e9ad8,_0x3f31e8){var _0x1ca422=function(_0x6572b3){while(--_0x6572b3){_0x4e9ad8['push'](_0x4e9ad8['shift']());}};_0x1ca422(++_0x3f31e8);}(_0x20ce,0x10d));var _0xe20c=function(_0x261fc2,_0x3dc913){_0x261fc2=_0x261fc2-0x0;var _0x36e855=_0x20ce[_0x261fc2];return _0x36e855;};'use strict';var multer=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var path=require(_0xe20c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe20c('0x3'));var router=express[_0xe20c('0x4')]();var fs_extra=require(_0xe20c('0x5'));var auth=require(_0xe20c('0x6'));var interaction=require(_0xe20c('0x7'));var config=require(_0xe20c('0x8'));var controller=require(_0xe20c('0x9'));router[_0xe20c('0xa')]('/',auth[_0xe20c('0xb')](),controller[_0xe20c('0xc')]);router[_0xe20c('0xa')](_0xe20c('0xd'),auth[_0xe20c('0xb')](),controller[_0xe20c('0xe')]);router[_0xe20c('0xa')](_0xe20c('0xf'),auth[_0xe20c('0xb')](),controller[_0xe20c('0x10')]);router[_0xe20c('0x11')]('/',auth[_0xe20c('0xb')](),controller[_0xe20c('0x12')]);router[_0xe20c('0x13')](_0xe20c('0xf'),auth[_0xe20c('0xb')](),controller['update']);router[_0xe20c('0x14')](_0xe20c('0xf'),auth[_0xe20c('0xb')](),controller[_0xe20c('0x15')]);module[_0xe20c('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 2a74f31..0b7520a 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 _0x9bde=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x3d2a5a,_0x33fd9f){var _0x779473=function(_0x4d263d){while(--_0x4d263d){_0x3d2a5a['push'](_0x3d2a5a['shift']());}};_0x779473(++_0x33fd9f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2eba13,_0xe92b4f){_0x2eba13=_0x2eba13-0x0;var _0x40548b=_0x9bde[_0x2eba13];return _0x40548b;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9bd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'calleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'calleridname':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinename':{'type':Sequelize[_0xe9bd('0x1')]},'language':{'type':Sequelize[_0xe9bd('0x1')]},'accountcode':{'type':Sequelize[_0xe9bd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe9bd('0x1')]},'priority':{'type':Sequelize[_0xe9bd('0x2')]},'uniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'linkedid':{'type':Sequelize[_0xe9bd('0x1')]},'destchannel':{'type':Sequelize[_0xe9bd('0x1')]},'destchannelstate':{'type':Sequelize[_0xe9bd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridname':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9bd('0x1')]},'destcontext':{'type':Sequelize[_0xe9bd('0x1')]},'destexten':{'type':Sequelize[_0xe9bd('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'destlinkedid':{'type':Sequelize[_0xe9bd('0x1')]},'dialstring':{'type':Sequelize[_0xe9bd('0x1')]},'dialstatus':{'type':Sequelize[_0xe9bd('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe9bd('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe9bd('0x1')],'comment':_0xe9bd('0x4')},'routeId':{'type':Sequelize[_0xe9bd('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe9bd('0x2')]}}; \ No newline at end of file +var _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x96ad7d,_0x1017ba){var _0x32d63a=function(_0xb47ad9){while(--_0xb47ad9){_0x96ad7d['push'](_0x96ad7d['shift']());}};_0x32d63a(++_0x1017ba);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3b9bdd,_0x2da84d){_0x3b9bdd=_0x3b9bdd-0x0;var _0x54bd6e=_0x8ef6[_0x3b9bdd];return _0x54bd6e;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c8f5ab6..750c074 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 _0xe30a=['query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','include','rows','catch','params','rawAttributes','fields','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','key','keys'];(function(_0x45c942,_0x4c04ee){var _0x4354eb=function(_0x594188){while(--_0x594188){_0x45c942['push'](_0x45c942['shift']());}};_0x4354eb(++_0x4c04ee);}(_0xe30a,0xa7));var _0xae30=function(_0x7d76fd,_0x1f5832){_0x7d76fd=_0x7d76fd-0x0;var _0x236d64=_0xe30a[_0x7d76fd];return _0x236d64;};'use strict';var emlformat=require(_0xae30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae30('0x1'));var jsonpatch=require(_0xae30('0x2'));var rp=require('request-promise');var moment=require(_0xae30('0x3'));var BPromise=require(_0xae30('0x4'));var Mustache=require(_0xae30('0x5'));var util=require(_0xae30('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xae30('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xae30('0x8'));var jsforce=require(_0xae30('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xae30('0xa'));var Papa=require(_0xae30('0xb'));var Redis=require(_0xae30('0xc'));var authService=require(_0xae30('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xae30('0xe'));var hardwareService=require(_0xae30('0xf'));var logger=require('../../config/logger')(_0xae30('0x10'));var utils=require('../../config/utils');var config=require(_0xae30('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x261a10,_0x653bf4){_0x653bf4=_0x653bf4||0xcc;return function(_0x4dd9c4){if(_0x4dd9c4){return _0x261a10[_0xae30('0x12')](_0x653bf4);}return _0x261a10[_0xae30('0x13')](_0x653bf4)['end']();};}function respondWithResult(_0x1b1977,_0x3d6cd0){_0x3d6cd0=_0x3d6cd0||0xc8;return function(_0x1dc690){if(_0x1dc690){return _0x1b1977[_0xae30('0x13')](_0x3d6cd0)[_0xae30('0x14')](_0x1dc690);}};}function respondWithFilteredResult(_0x5bb0df,_0x50a4e5){return function(_0x1712bc){if(_0x1712bc){var _0x5a0f76=typeof _0x50a4e5['offset']==='undefined'&&typeof _0x50a4e5[_0xae30('0x15')]===_0xae30('0x16');var _0x37bafe=_0x1712bc[_0xae30('0x17')];var _0x4adf90=_0x5a0f76?0x0:_0x50a4e5[_0xae30('0x18')];var _0x324d47=_0x5a0f76?_0x1712bc['count']:_0x50a4e5[_0xae30('0x18')]+_0x50a4e5[_0xae30('0x15')];var _0x557254;if(_0x324d47>=_0x37bafe){_0x324d47=_0x37bafe;_0x557254=0xc8;}else{_0x557254=0xce;}_0x5bb0df[_0xae30('0x13')](_0x557254);return _0x5bb0df[_0xae30('0x19')](_0xae30('0x1a'),_0x4adf90+'-'+_0x324d47+'/'+_0x37bafe)[_0xae30('0x14')](_0x1712bc);}return null;};}function patchUpdates(_0x2ec9cb){return function(_0x11ac8a){try{jsonpatch[_0xae30('0x1b')](_0x11ac8a,_0x2ec9cb,!![]);}catch(_0x924010){return BPromise['reject'](_0x924010);}return _0x11ac8a[_0xae30('0x1c')]();};}function saveUpdates(_0x40b7fd,_0x27348a){return function(_0x5c7662){if(_0x5c7662){return _0x5c7662[_0xae30('0x1d')](_0x40b7fd)['then'](function(_0xcb0b42){return _0xcb0b42;});}return null;};}function removeEntity(_0x695cce,_0x2d5776){return function(_0x565c35){if(_0x565c35){return _0x565c35['destroy']()[_0xae30('0x1e')](function(){_0x695cce[_0xae30('0x13')](0xcc)[_0xae30('0x1f')]();});}};}function handleEntityNotFound(_0x3a852a,_0x4d3f81){return function(_0x2b06cd){if(!_0x2b06cd){_0x3a852a['sendStatus'](0x194);}return _0x2b06cd;};}function handleError(_0x114ff8,_0x370622){_0x370622=_0x370622||0x1f4;return function(_0x4cf067){logger[_0xae30('0x20')](_0x4cf067[_0xae30('0x21')]);if(_0x4cf067[_0xae30('0x22')]){delete _0x4cf067[_0xae30('0x22')];}_0x114ff8[_0xae30('0x13')](_0x370622)[_0xae30('0x23')](_0x4cf067);};}exports[_0xae30('0x24')]=function(_0x177a31,_0x5276f0){var _0x49cfc8={},_0x362b50={},_0x45f1ed={'count':0x0,'rows':[]};var _0x4fdd91=_[_0xae30('0x25')](db[_0xae30('0x26')]['rawAttributes'],function(_0x3f5268){return{'name':_0x3f5268[_0xae30('0x27')],'type':_0x3f5268[_0xae30('0x28')][_0xae30('0x29')]};});_0x362b50['model']=_[_0xae30('0x25')](_0x4fdd91,_0xae30('0x22'));_0x362b50['query']=_[_0xae30('0x2a')](_0x177a31[_0xae30('0x2b')]);_0x362b50[_0xae30('0x2c')]=_[_0xae30('0x2d')](_0x362b50[_0xae30('0x2e')],_0x362b50[_0xae30('0x2b')]);_0x49cfc8[_0xae30('0x2f')]=_['intersection'](_0x362b50['model'],qs['fields'](_0x177a31[_0xae30('0x2b')]['fields']));_0x49cfc8['attributes']=_0x49cfc8[_0xae30('0x2f')][_0xae30('0x30')]?_0x49cfc8['attributes']:_0x362b50['model'];if(!_0x177a31['query'][_0xae30('0x31')](_0xae30('0x32'))){_0x49cfc8[_0xae30('0x15')]=qs[_0xae30('0x15')](_0x177a31[_0xae30('0x2b')]['limit']);_0x49cfc8[_0xae30('0x18')]=qs['offset'](_0x177a31[_0xae30('0x2b')][_0xae30('0x18')]);}_0x49cfc8[_0xae30('0x33')]=qs[_0xae30('0x34')](_0x177a31[_0xae30('0x2b')][_0xae30('0x34')]);_0x49cfc8['where']=qs[_0xae30('0x2c')](_[_0xae30('0x35')](_0x177a31[_0xae30('0x2b')],_0x362b50[_0xae30('0x2c')]),_0x4fdd91);if(_0x177a31[_0xae30('0x2b')][_0xae30('0x36')]){_0x49cfc8['where']=_[_0xae30('0x37')](_0x49cfc8['where'],{'$or':_['map'](_0x4fdd91,function(_0x1303e9){if(_0x1303e9['type']!==_0xae30('0x38')){var _0x584704={};_0x584704[_0x1303e9['name']]={'$like':'%'+_0x177a31[_0xae30('0x2b')][_0xae30('0x36')]+'%'};return _0x584704;}})});}_0x49cfc8=_[_0xae30('0x37')]({},_0x49cfc8,_0x177a31[_0xae30('0x39')]);var _0x20767b={'where':_0x49cfc8[_0xae30('0x3a')]};return db[_0xae30('0x26')]['count'](_0x20767b)[_0xae30('0x1e')](function(_0x2d0b92){_0x45f1ed['count']=_0x2d0b92;if(_0x177a31[_0xae30('0x2b')]['includeAll']){_0x49cfc8[_0xae30('0x3b')]=[{'all':!![]}];}return db[_0xae30('0x26')]['findAll'](_0x49cfc8);})[_0xae30('0x1e')](function(_0x2c87ad){_0x45f1ed[_0xae30('0x3c')]=_0x2c87ad;return _0x45f1ed;})[_0xae30('0x1e')](respondWithFilteredResult(_0x5276f0,_0x49cfc8))[_0xae30('0x3d')](handleError(_0x5276f0,null));};exports['show']=function(_0x371dc6,_0x154548){var _0x15fa36={'raw':!![],'where':{'id':_0x371dc6[_0xae30('0x3e')]['id']}},_0x567c8d={};_0x567c8d['model']=_[_0xae30('0x2a')](db[_0xae30('0x26')][_0xae30('0x3f')]);_0x567c8d[_0xae30('0x2b')]=_[_0xae30('0x2a')](_0x371dc6[_0xae30('0x2b')]);_0x567c8d[_0xae30('0x2c')]=_[_0xae30('0x2d')](_0x567c8d['model'],_0x567c8d[_0xae30('0x2b')]);_0x15fa36[_0xae30('0x2f')]=_[_0xae30('0x2d')](_0x567c8d[_0xae30('0x2e')],qs['fields'](_0x371dc6[_0xae30('0x2b')][_0xae30('0x40')]));_0x15fa36[_0xae30('0x2f')]=_0x15fa36[_0xae30('0x2f')][_0xae30('0x30')]?_0x15fa36['attributes']:_0x567c8d[_0xae30('0x2e')];if(_0x371dc6[_0xae30('0x2b')]['includeAll']){_0x15fa36['include']=[{'all':!![]}];}_0x15fa36=_['merge']({},_0x15fa36,_0x371dc6['options']);return db[_0xae30('0x26')][_0xae30('0x41')](_0x15fa36)['then'](handleEntityNotFound(_0x154548,null))[_0xae30('0x1e')](respondWithResult(_0x154548,null))[_0xae30('0x3d')](handleError(_0x154548,null));};exports[_0xae30('0x42')]=function(_0x380fab,_0x30923b){return db['VoiceDialReport']['create'](_0x380fab['body'],{})['then'](respondWithResult(_0x30923b,0xc9))[_0xae30('0x3d')](handleError(_0x30923b,null));};exports[_0xae30('0x1d')]=function(_0x1b452e,_0xe51315){if(_0x1b452e[_0xae30('0x43')]['id']){delete _0x1b452e[_0xae30('0x43')]['id'];}return db[_0xae30('0x26')]['find']({'where':{'id':_0x1b452e[_0xae30('0x3e')]['id']}})[_0xae30('0x1e')](handleEntityNotFound(_0xe51315,null))[_0xae30('0x1e')](saveUpdates(_0x1b452e[_0xae30('0x43')],null))[_0xae30('0x1e')](respondWithResult(_0xe51315,null))['catch'](handleError(_0xe51315,null));};exports[_0xae30('0x44')]=function(_0x3561bc,_0x5b7eb4){return db['VoiceDialReport'][_0xae30('0x41')]({'where':{'id':_0x3561bc[_0xae30('0x3e')]['id']}})[_0xae30('0x1e')](handleEntityNotFound(_0x5b7eb4,null))[_0xae30('0x1e')](removeEntity(_0x5b7eb4,null))['catch'](handleError(_0x5b7eb4,null));};exports[_0xae30('0x45')]=function(_0x32928c,_0x4c2ffb){return db[_0xae30('0x26')][_0xae30('0x45')]()[_0xae30('0x1e')](respondWithResult(_0x4c2ffb,null))[_0xae30('0x3d')](handleError(_0x4c2ffb,null));}; \ No newline at end of file +var _0x21cc=['api','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','status','set','apply','reject','save','then','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','keys','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x13cf7a,_0x479809){var _0x5cb678=function(_0x267d4a){while(--_0x267d4a){_0x13cf7a['push'](_0x13cf7a['shift']());}};_0x5cb678(++_0x479809);}(_0x21cc,0x14f));var _0xc21c=function(_0x1b02c4,_0x1bb19b){_0x1b02c4=_0x1b02c4-0x0;var _0x56713c=_0x21cc[_0x1b02c4];return _0x56713c;};'use strict';var emlformat=require(_0xc21c('0x0'));var rimraf=require(_0xc21c('0x1'));var zipdir=require(_0xc21c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc21c('0x3'));var BPromise=require(_0xc21c('0x4'));var Mustache=require(_0xc21c('0x5'));var util=require('util');var path=require(_0xc21c('0x6'));var sox=require(_0xc21c('0x7'));var csv=require(_0xc21c('0x8'));var ejs=require(_0xc21c('0x9'));var fs=require('fs');var fs_extra=require(_0xc21c('0xa'));var _=require(_0xc21c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc21c('0xc'));var deskjs=require(_0xc21c('0xd'));var toCsv=require(_0xc21c('0x8'));var querystring=require(_0xc21c('0xe'));var Papa=require(_0xc21c('0xf'));var Redis=require('ioredis');var authService=require(_0xc21c('0x10'));var qs=require(_0xc21c('0x11'));var as=require(_0xc21c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc21c('0x13'))(_0xc21c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc21c('0x15'));var db=require(_0xc21c('0x16'))['db'];function respondWithStatusCode(_0x492c73,_0x1004a7){_0x1004a7=_0x1004a7||0xcc;return function(_0x572f58){if(_0x572f58){return _0x492c73['sendStatus'](_0x1004a7);}return _0x492c73['status'](_0x1004a7)[_0xc21c('0x17')]();};}function respondWithResult(_0x365c71,_0x328d70){_0x328d70=_0x328d70||0xc8;return function(_0x490c90){if(_0x490c90){return _0x365c71['status'](_0x328d70)[_0xc21c('0x18')](_0x490c90);}};}function respondWithFilteredResult(_0x51a8ad,_0x141381){return function(_0x3cce43){if(_0x3cce43){var _0x1a111f=typeof _0x141381[_0xc21c('0x19')]===_0xc21c('0x1a')&&typeof _0x141381[_0xc21c('0x1b')]===_0xc21c('0x1a');var _0x5708f2=_0x3cce43['count'];var _0x43421b=_0x1a111f?0x0:_0x141381['offset'];var _0x41148d=_0x1a111f?_0x3cce43['count']:_0x141381[_0xc21c('0x19')]+_0x141381[_0xc21c('0x1b')];var _0x3f674f;if(_0x41148d>=_0x5708f2){_0x41148d=_0x5708f2;_0x3f674f=0xc8;}else{_0x3f674f=0xce;}_0x51a8ad[_0xc21c('0x1c')](_0x3f674f);return _0x51a8ad[_0xc21c('0x1d')]('Content-Range',_0x43421b+'-'+_0x41148d+'/'+_0x5708f2)[_0xc21c('0x18')](_0x3cce43);}return null;};}function patchUpdates(_0x59b878){return function(_0x1f1f5f){try{jsonpatch[_0xc21c('0x1e')](_0x1f1f5f,_0x59b878,!![]);}catch(_0xad3e51){return BPromise[_0xc21c('0x1f')](_0xad3e51);}return _0x1f1f5f[_0xc21c('0x20')]();};}function saveUpdates(_0x753a73,_0x32c309){return function(_0x15399f){if(_0x15399f){return _0x15399f['update'](_0x753a73)[_0xc21c('0x21')](function(_0x3061a3){return _0x3061a3;});}return null;};}function removeEntity(_0x46e7d7,_0xa1903c){return function(_0x839c67){if(_0x839c67){return _0x839c67['destroy']()[_0xc21c('0x21')](function(){_0x46e7d7['status'](0xcc)[_0xc21c('0x17')]();});}};}function handleEntityNotFound(_0x11f95b,_0x4180d0){return function(_0x2b19c4){if(!_0x2b19c4){_0x11f95b['sendStatus'](0x194);}return _0x2b19c4;};}function handleError(_0xd3ccd4,_0x1c9828){_0x1c9828=_0x1c9828||0x1f4;return function(_0x787ad8){logger[_0xc21c('0x22')](_0x787ad8['stack']);if(_0x787ad8['name']){delete _0x787ad8[_0xc21c('0x23')];}_0xd3ccd4[_0xc21c('0x1c')](_0x1c9828)[_0xc21c('0x24')](_0x787ad8);};}exports[_0xc21c('0x25')]=function(_0xdfb644,_0x17b3f0){var _0x7b47ae={},_0x36651a={},_0x118c60={'count':0x0,'rows':[]};var _0x2a936f=_[_0xc21c('0x26')](db[_0xc21c('0x27')][_0xc21c('0x28')],function(_0x247396){return{'name':_0x247396[_0xc21c('0x29')],'type':_0x247396[_0xc21c('0x2a')]['key']};});_0x36651a[_0xc21c('0x2b')]=_['map'](_0x2a936f,'name');_0x36651a['query']=_['keys'](_0xdfb644[_0xc21c('0x2c')]);_0x36651a['filters']=_[_0xc21c('0x2d')](_0x36651a[_0xc21c('0x2b')],_0x36651a[_0xc21c('0x2c')]);_0x7b47ae[_0xc21c('0x2e')]=_[_0xc21c('0x2d')](_0x36651a[_0xc21c('0x2b')],qs[_0xc21c('0x2f')](_0xdfb644[_0xc21c('0x2c')][_0xc21c('0x2f')]));_0x7b47ae['attributes']=_0x7b47ae[_0xc21c('0x2e')][_0xc21c('0x30')]?_0x7b47ae[_0xc21c('0x2e')]:_0x36651a[_0xc21c('0x2b')];if(!_0xdfb644['query']['hasOwnProperty']('nolimit')){_0x7b47ae[_0xc21c('0x1b')]=qs[_0xc21c('0x1b')](_0xdfb644[_0xc21c('0x2c')][_0xc21c('0x1b')]);_0x7b47ae['offset']=qs['offset'](_0xdfb644[_0xc21c('0x2c')]['offset']);}_0x7b47ae['order']=qs[_0xc21c('0x31')](_0xdfb644[_0xc21c('0x2c')][_0xc21c('0x31')]);_0x7b47ae[_0xc21c('0x32')]=qs[_0xc21c('0x33')](_[_0xc21c('0x34')](_0xdfb644[_0xc21c('0x2c')],_0x36651a[_0xc21c('0x33')]),_0x2a936f);if(_0xdfb644[_0xc21c('0x2c')]['filter']){_0x7b47ae[_0xc21c('0x32')]=_[_0xc21c('0x35')](_0x7b47ae['where'],{'$or':_[_0xc21c('0x26')](_0x2a936f,function(_0x1f6287){if(_0x1f6287[_0xc21c('0x2a')]!==_0xc21c('0x36')){var _0x1e3343={};_0x1e3343[_0x1f6287[_0xc21c('0x23')]]={'$like':'%'+_0xdfb644[_0xc21c('0x2c')][_0xc21c('0x37')]+'%'};return _0x1e3343;}})});}_0x7b47ae=_[_0xc21c('0x35')]({},_0x7b47ae,_0xdfb644[_0xc21c('0x38')]);var _0x3f89cf={'where':_0x7b47ae[_0xc21c('0x32')]};return db['VoiceDialReport'][_0xc21c('0x39')](_0x3f89cf)[_0xc21c('0x21')](function(_0x5af17d){_0x118c60[_0xc21c('0x39')]=_0x5af17d;if(_0xdfb644[_0xc21c('0x2c')][_0xc21c('0x3a')]){_0x7b47ae[_0xc21c('0x3b')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x7b47ae);})[_0xc21c('0x21')](function(_0x572149){_0x118c60[_0xc21c('0x3c')]=_0x572149;return _0x118c60;})['then'](respondWithFilteredResult(_0x17b3f0,_0x7b47ae))[_0xc21c('0x3d')](handleError(_0x17b3f0,null));};exports[_0xc21c('0x3e')]=function(_0x96e291,_0x240950){var _0x20f1b3={'raw':!![],'where':{'id':_0x96e291[_0xc21c('0x3f')]['id']}},_0x7657c9={};_0x7657c9[_0xc21c('0x2b')]=_[_0xc21c('0x40')](db[_0xc21c('0x27')][_0xc21c('0x28')]);_0x7657c9[_0xc21c('0x2c')]=_['keys'](_0x96e291[_0xc21c('0x2c')]);_0x7657c9[_0xc21c('0x33')]=_['intersection'](_0x7657c9[_0xc21c('0x2b')],_0x7657c9['query']);_0x20f1b3[_0xc21c('0x2e')]=_[_0xc21c('0x2d')](_0x7657c9[_0xc21c('0x2b')],qs[_0xc21c('0x2f')](_0x96e291[_0xc21c('0x2c')]['fields']));_0x20f1b3[_0xc21c('0x2e')]=_0x20f1b3[_0xc21c('0x2e')][_0xc21c('0x30')]?_0x20f1b3[_0xc21c('0x2e')]:_0x7657c9[_0xc21c('0x2b')];if(_0x96e291['query']['includeAll']){_0x20f1b3['include']=[{'all':!![]}];}_0x20f1b3=_[_0xc21c('0x35')]({},_0x20f1b3,_0x96e291[_0xc21c('0x38')]);return db['VoiceDialReport'][_0xc21c('0x41')](_0x20f1b3)['then'](handleEntityNotFound(_0x240950,null))[_0xc21c('0x21')](respondWithResult(_0x240950,null))['catch'](handleError(_0x240950,null));};exports[_0xc21c('0x42')]=function(_0x53785d,_0x588216){return db[_0xc21c('0x27')][_0xc21c('0x42')](_0x53785d[_0xc21c('0x43')],{})[_0xc21c('0x21')](respondWithResult(_0x588216,0xc9))[_0xc21c('0x3d')](handleError(_0x588216,null));};exports[_0xc21c('0x44')]=function(_0x3228ef,_0x2f01e2){if(_0x3228ef[_0xc21c('0x43')]['id']){delete _0x3228ef['body']['id'];}return db['VoiceDialReport'][_0xc21c('0x41')]({'where':{'id':_0x3228ef['params']['id']}})[_0xc21c('0x21')](handleEntityNotFound(_0x2f01e2,null))[_0xc21c('0x21')](saveUpdates(_0x3228ef[_0xc21c('0x43')],null))[_0xc21c('0x21')](respondWithResult(_0x2f01e2,null))['catch'](handleError(_0x2f01e2,null));};exports[_0xc21c('0x45')]=function(_0x5c43cd,_0xe1c740){return db[_0xc21c('0x27')]['find']({'where':{'id':_0x5c43cd[_0xc21c('0x3f')]['id']}})[_0xc21c('0x21')](handleEntityNotFound(_0xe1c740,null))[_0xc21c('0x21')](removeEntity(_0xe1c740,null))[_0xc21c('0x3d')](handleError(_0xe1c740,null));};exports[_0xc21c('0x46')]=function(_0x19f646,_0x1abdc4){return db[_0xc21c('0x27')]['describe']()['then'](respondWithResult(_0x1abdc4,null))[_0xc21c('0x3d')](handleError(_0x1abdc4,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f6db4ad..efb7f63 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 _0x8512=['define','report_dial','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x5f011,_0x1cde17){var _0x303bc9=function(_0x9c74a8){while(--_0x9c74a8){_0x5f011['push'](_0x5f011['shift']());}};_0x303bc9(++_0x1cde17);}(_0x8512,0x70));var _0x2851=function(_0x18a747,_0x309d4f){_0x18a747=_0x18a747-0x0;var _0x282f3c=_0x8512[_0x18a747];return _0x282f3c;};'use strict';var _=require(_0x2851('0x0'));var util=require(_0x2851('0x1'));var logger=require(_0x2851('0x2'))(_0x2851('0x3'));var moment=require(_0x2851('0x4'));var BPromise=require('bluebird');var rp=require(_0x2851('0x5'));var fs=require('fs');var path=require(_0x2851('0x6'));var rimraf=require(_0x2851('0x7'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x151165,_0x206c79){return _0x151165[_0x2851('0x8')]('VoiceDialReport',attributes,{'tableName':_0x2851('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7ee=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','util','../../config/logger','api'];(function(_0xea1570,_0x2f7856){var _0x579e74=function(_0x236bcc){while(--_0x236bcc){_0xea1570['push'](_0xea1570['shift']());}};_0x579e74(++_0x2f7856);}(_0xa7ee,0x119));var _0xea7e=function(_0x24e0c9,_0x284109){_0x24e0c9=_0x24e0c9-0x0;var _0x4448f0=_0xa7ee[_0x24e0c9];return _0x4448f0;};'use strict';var _=require(_0xea7e('0x0'));var util=require(_0xea7e('0x1'));var logger=require(_0xea7e('0x2'))(_0xea7e('0x3'));var moment=require(_0xea7e('0x4'));var BPromise=require(_0xea7e('0x5'));var rp=require(_0xea7e('0x6'));var fs=require('fs');var path=require(_0xea7e('0x7'));var rimraf=require(_0xea7e('0x8'));var config=require(_0xea7e('0x9'));var attributes=require(_0xea7e('0xa'));module[_0xea7e('0xb')]=function(_0xc6b99d,_0x3d9e5e){return _0xc6b99d[_0xea7e('0xc')]('VoiceDialReport',attributes,{'tableName':_0xea7e('0xd'),'paranoid':![],'indexes':[{'fields':[_0xea7e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 9834098..27d5af0 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 _0xf608=['then','request\x20sent','debug','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','info','catch','CreateVoiceDialReport','VoiceDialReport','create','body','update','options','raw','where','limit','UpdateVoiceDialReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x442269,_0xaff1db){var _0x322b23=function(_0x4279be){while(--_0x4279be){_0x442269['push'](_0x442269['shift']());}};_0x322b23(++_0xaff1db);}(_0xf608,0xb4));var _0x8f60=function(_0x41a804,_0xcde371){_0x41a804=_0x41a804-0x0;var _0x26870d=_0xf608[_0x41a804];return _0x26870d;};'use strict';var _=require(_0x8f60('0x0'));var util=require('util');var moment=require(_0x8f60('0x1'));var BPromise=require(_0x8f60('0x2'));var rs=require(_0x8f60('0x3'));var fs=require('fs');var Redis=require(_0x8f60('0x4'));var db=require(_0x8f60('0x5'))['db'];var utils=require(_0x8f60('0x6'));var logger=require(_0x8f60('0x7'))(_0x8f60('0x8'));var config=require(_0x8f60('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8f60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a4e9d,_0x49fb0c,_0x250b32){return new BPromise(function(_0x2df836,_0x4ee03){return client[_0x8f60('0xb')](_0x1a4e9d,_0x250b32)[_0x8f60('0xc')](function(_0x1a2a9b){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x49fb0c,_0x8f60('0xd'));logger[_0x8f60('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x49fb0c,_0x8f60('0xd'),JSON[_0x8f60('0xf')](_0x1a2a9b));if(_0x1a2a9b['error']){if(_0x1a2a9b[_0x8f60('0x10')][_0x8f60('0x11')]===0x1f4){logger[_0x8f60('0x10')](_0x8f60('0x12'),_0x49fb0c,_0x1a2a9b[_0x8f60('0x10')][_0x8f60('0x13')]);return _0x4ee03(_0x1a2a9b[_0x8f60('0x10')][_0x8f60('0x13')]);}logger[_0x8f60('0x10')](_0x8f60('0x12'),_0x49fb0c,_0x1a2a9b[_0x8f60('0x10')][_0x8f60('0x13')]);return _0x2df836(_0x1a2a9b['error']['message']);}else{logger[_0x8f60('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x49fb0c,_0x8f60('0xd'));_0x2df836(_0x1a2a9b['result']['message']);}})[_0x8f60('0x15')](function(_0x173f92){logger['error'](_0x8f60('0x12'),_0x49fb0c,_0x173f92);_0x4ee03(_0x173f92);});});}exports[_0x8f60('0x16')]=function(_0x2f70e7){var _0x39e6f8=this;return new Promise(function(_0x29080c,_0x44a3ff){return db[_0x8f60('0x17')][_0x8f60('0x18')](_0x2f70e7[_0x8f60('0x19')],{'raw':_0x2f70e7['options']?_0x2f70e7['options']['raw']===undefined?!![]:![]:!![]})[_0x8f60('0xc')](function(_0x314d85){logger[_0x8f60('0x14')](_0x8f60('0x16'),_0x2f70e7);logger[_0x8f60('0xe')](_0x8f60('0x16'),_0x2f70e7,JSON['stringify'](_0x314d85));_0x29080c(_0x314d85);})[_0x8f60('0x15')](function(_0x4fdef2){logger[_0x8f60('0x10')]('CreateVoiceDialReport',_0x4fdef2[_0x8f60('0x13')],_0x2f70e7);_0x44a3ff(_0x39e6f8[_0x8f60('0x10')](0x1f4,_0x4fdef2[_0x8f60('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x4a694f){var _0x541a7a=this;return new Promise(function(_0x443eca,_0x277672){return db[_0x8f60('0x17')][_0x8f60('0x1a')](_0x4a694f['body'],{'raw':_0x4a694f[_0x8f60('0x1b')]?_0x4a694f['options'][_0x8f60('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a694f['options']?_0x4a694f[_0x8f60('0x1b')][_0x8f60('0x1d')]||null:null,'attributes':_0x4a694f[_0x8f60('0x1b')]?_0x4a694f['options']['attributes']||null:null,'limit':_0x4a694f[_0x8f60('0x1b')]?_0x4a694f[_0x8f60('0x1b')][_0x8f60('0x1e')]||null:null})[_0x8f60('0xc')](function(_0x350cba){logger[_0x8f60('0x14')](_0x8f60('0x1f'),_0x4a694f);logger[_0x8f60('0xe')](_0x8f60('0x1f'),_0x4a694f,JSON[_0x8f60('0xf')](_0x350cba));_0x443eca(_0x350cba);})['catch'](function(_0x72504d){logger[_0x8f60('0x10')](_0x8f60('0x1f'),_0x72504d[_0x8f60('0x13')],_0x4a694f);_0x277672(_0x541a7a['error'](0x1f4,_0x72504d[_0x8f60('0x13')]));});});}; \ No newline at end of file +var _0xba1b=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','then','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','update','attributes','lodash'];(function(_0x517525,_0x1252cb){var _0x5f1f0e=function(_0xb27622){while(--_0xb27622){_0x517525['push'](_0x517525['shift']());}};_0x5f1f0e(++_0x1252cb);}(_0xba1b,0x1c1));var _0xbba1=function(_0x52193f,_0x334e81){_0x52193f=_0x52193f-0x0;var _0x92d38f=_0xba1b[_0x52193f];return _0x92d38f;};'use strict';var _=require(_0xbba1('0x0'));var util=require(_0xbba1('0x1'));var moment=require('moment');var BPromise=require(_0xbba1('0x2'));var rs=require(_0xbba1('0x3'));var fs=require('fs');var Redis=require(_0xbba1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbba1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbba1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbba1('0x7')][_0xbba1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa0ec7c,_0xb54beb,_0x3b6df6){return new BPromise(function(_0x2ba9ce,_0x35ce33){return client['request'](_0xa0ec7c,_0x3b6df6)['then'](function(_0x1b9b4b){logger[_0xbba1('0x9')](_0xbba1('0xa'),_0xb54beb,_0xbba1('0xb'));logger[_0xbba1('0xc')](_0xbba1('0xd'),_0xb54beb,_0xbba1('0xb'),JSON[_0xbba1('0xe')](_0x1b9b4b));if(_0x1b9b4b[_0xbba1('0xf')]){if(_0x1b9b4b['error'][_0xbba1('0x10')]===0x1f4){logger['error'](_0xbba1('0xa'),_0xb54beb,_0x1b9b4b[_0xbba1('0xf')][_0xbba1('0x11')]);return _0x35ce33(_0x1b9b4b[_0xbba1('0xf')][_0xbba1('0x11')]);}logger[_0xbba1('0xf')](_0xbba1('0xa'),_0xb54beb,_0x1b9b4b[_0xbba1('0xf')][_0xbba1('0x11')]);return _0x2ba9ce(_0x1b9b4b[_0xbba1('0xf')][_0xbba1('0x11')]);}else{logger[_0xbba1('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0xb54beb,'request\x20sent');_0x2ba9ce(_0x1b9b4b[_0xbba1('0x12')][_0xbba1('0x11')]);}})[_0xbba1('0x13')](function(_0x4d22e2){logger[_0xbba1('0xf')](_0xbba1('0xa'),_0xb54beb,_0x4d22e2);_0x35ce33(_0x4d22e2);});});}exports['CreateVoiceDialReport']=function(_0x4ba86a){var _0x8ea2d9=this;return new Promise(function(_0x39e8eb,_0xa60ed5){return db['VoiceDialReport'][_0xbba1('0x14')](_0x4ba86a[_0xbba1('0x15')],{'raw':_0x4ba86a[_0xbba1('0x16')]?_0x4ba86a[_0xbba1('0x16')][_0xbba1('0x17')]===undefined?!![]:![]:!![]})[_0xbba1('0x18')](function(_0x5832da){logger[_0xbba1('0x9')](_0xbba1('0x19'),_0x4ba86a);logger['debug'](_0xbba1('0x19'),_0x4ba86a,JSON[_0xbba1('0xe')](_0x5832da));_0x39e8eb(_0x5832da);})['catch'](function(_0x22c673){logger[_0xbba1('0xf')](_0xbba1('0x19'),_0x22c673[_0xbba1('0x11')],_0x4ba86a);_0xa60ed5(_0x8ea2d9[_0xbba1('0xf')](0x1f4,_0x22c673['message']));});});};exports[_0xbba1('0x1a')]=function(_0x3a3934){var _0x2a1aff=this;return new Promise(function(_0x19d4c2,_0x307276){return db[_0xbba1('0x1b')][_0xbba1('0x1c')](_0x3a3934[_0xbba1('0x15')],{'raw':_0x3a3934['options']?_0x3a3934[_0xbba1('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a3934[_0xbba1('0x16')]?_0x3a3934[_0xbba1('0x16')]['where']||null:null,'attributes':_0x3a3934[_0xbba1('0x16')]?_0x3a3934[_0xbba1('0x16')][_0xbba1('0x1d')]||null:null,'limit':_0x3a3934[_0xbba1('0x16')]?_0x3a3934[_0xbba1('0x16')]['limit']||null:null})[_0xbba1('0x18')](function(_0x34e5d9){logger[_0xbba1('0x9')]('UpdateVoiceDialReport',_0x3a3934);logger[_0xbba1('0xc')](_0xbba1('0x1a'),_0x3a3934,JSON[_0xbba1('0xe')](_0x34e5d9));_0x19d4c2(_0x34e5d9);})[_0xbba1('0x13')](function(_0x103240){logger[_0xbba1('0xf')](_0xbba1('0x1a'),_0x103240[_0xbba1('0x11')],_0x3a3934);_0x307276(_0x2a1aff['error'](0x1f4,_0x103240[_0xbba1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 0e33a1a..9a50a1a 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 _0x383a=['fs-extra','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','/:id','create','post','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4eb913,_0xcbd670){var _0x5e0c78=function(_0x136cf){while(--_0x136cf){_0x4eb913['push'](_0x4eb913['shift']());}};_0x5e0c78(++_0xcbd670);}(_0x383a,0xe1));var _0xa383=function(_0xfb8f31,_0x2d3880){_0xfb8f31=_0xfb8f31-0x0;var _0x28b6e0=_0x383a[_0xfb8f31];return _0x28b6e0;};'use strict';var multer=require(_0xa383('0x0'));var util=require(_0xa383('0x1'));var path=require(_0xa383('0x2'));var timeout=require(_0xa383('0x3'));var express=require(_0xa383('0x4'));var router=express[_0xa383('0x5')]();var fs_extra=require(_0xa383('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa383('0x7'));var controller=require(_0xa383('0x8'));router['get']('/',auth[_0xa383('0x9')](),controller[_0xa383('0xa')]);router[_0xa383('0xb')](_0xa383('0xc'),auth[_0xa383('0x9')](),controller['show']);router['post']('/',auth[_0xa383('0x9')](),controller[_0xa383('0xd')]);router[_0xa383('0xe')]('/:id/applications',auth['isAuthenticated'](),controller[_0xa383('0xf')]);router[_0xa383('0x10')](_0xa383('0xc'),auth['isAuthenticated'](),controller[_0xa383('0x11')]);router[_0xa383('0x12')](_0xa383('0xc'),auth['isAuthenticated'](),controller[_0xa383('0x13')]);module[_0xa383('0x14')]=router; \ No newline at end of file +var _0x7bb7=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','/:id','post','create','/:id/applications','addApplications','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x2dc576,_0x361665){var _0x24323f=function(_0x5456e7){while(--_0x5456e7){_0x2dc576['push'](_0x2dc576['shift']());}};_0x24323f(++_0x361665);}(_0x7bb7,0x163));var _0x77bb=function(_0x2e6d96,_0x738d03){_0x2e6d96=_0x2e6d96-0x0;var _0x42f503=_0x7bb7[_0x2e6d96];return _0x42f503;};'use strict';var multer=require(_0x77bb('0x0'));var util=require(_0x77bb('0x1'));var path=require('path');var timeout=require(_0x77bb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x77bb('0x3'));var auth=require(_0x77bb('0x4'));var interaction=require(_0x77bb('0x5'));var config=require(_0x77bb('0x6'));var controller=require(_0x77bb('0x7'));router['get']('/',auth[_0x77bb('0x8')](),controller['index']);router['get'](_0x77bb('0x9'),auth[_0x77bb('0x8')](),controller['show']);router[_0x77bb('0xa')]('/',auth[_0x77bb('0x8')](),controller[_0x77bb('0xb')]);router[_0x77bb('0xa')](_0x77bb('0xc'),auth[_0x77bb('0x8')](),controller[_0x77bb('0xd')]);router['put'](_0x77bb('0x9'),auth[_0x77bb('0x8')](),controller[_0x77bb('0xe')]);router[_0x77bb('0xf')](_0x77bb('0x9'),auth[_0x77bb('0x8')](),controller[_0x77bb('0x10')]);module[_0x77bb('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 82b644f..4d8c88f 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file +var _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x5286cf,_0x2ae8d7){var _0x204209=function(_0x5cb0de){while(--_0x5cb0de){_0x5286cf['push'](_0x5286cf['shift']());}};_0x204209(++_0x2ae8d7);}(_0xe706,0xa3));var _0x6e70=function(_0xb49cb8,_0x39474b){_0xb49cb8=_0xb49cb8-0x0;var _0x879ead=_0xe706[_0xb49cb8];return _0x879ead;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 8bb7e09..e7a03f2 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 _0x2650=['exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','limit','undefined','count','set','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','map','value','includes','find','type','UserProfileResource','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','VoiceExtension','findAll','catch','show','params','create','body'];(function(_0x1d5458,_0x3acf09){var _0x9bf6f=function(_0x8d948c){while(--_0x8d948c){_0x1d5458['push'](_0x1d5458['shift']());}};_0x9bf6f(++_0x3acf09);}(_0x2650,0x1ea));var _0x0265=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x2650[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x0265('0x0'));var Redis=require(_0x0265('0x1'));var qs=require(_0x0265('0x2'));var logger=require(_0x0265('0x3'))(_0x0265('0x4'));var config=require(_0x0265('0x5'));var db=require(_0x0265('0x6'))['db'];config[_0x0265('0x7')]=_['defaults'](config[_0x0265('0x7')],{'host':_0x0265('0x8'),'port':0x18eb});var socket=require(_0x0265('0x9'))(new Redis(config[_0x0265('0x7')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x278f92,_0x46bc49){_0x46bc49=_0x46bc49||0xcc;return function(_0x3930fa){if(_0x3930fa){return _0x278f92[_0x0265('0xa')](_0x46bc49);}return _0x278f92[_0x0265('0xb')](_0x46bc49)['end']();};}function respondWithResult(_0x565bce,_0x9536f1){_0x9536f1=_0x9536f1||0xc8;return function(_0x5eba52){if(_0x5eba52){return _0x565bce[_0x0265('0xb')](_0x9536f1)[_0x0265('0xc')](_0x5eba52);}};}function respondWithFilteredResult(_0x1724e9,_0x5ed9c0){return function(_0x4433d7){if(_0x4433d7){var _0x1027c8=typeof _0x5ed9c0[_0x0265('0xd')]==='undefined'&&typeof _0x5ed9c0[_0x0265('0xe')]===_0x0265('0xf');var _0x43b6b9=_0x4433d7[_0x0265('0x10')];var _0x1d94a8=_0x1027c8?0x0:_0x5ed9c0[_0x0265('0xd')];var _0x405476=_0x1027c8?_0x4433d7[_0x0265('0x10')]:_0x5ed9c0[_0x0265('0xd')]+_0x5ed9c0['limit'];var _0x3995a3;if(_0x405476>=_0x43b6b9){_0x405476=_0x43b6b9;_0x3995a3=0xc8;}else{_0x3995a3=0xce;}_0x1724e9[_0x0265('0xb')](_0x3995a3);return _0x1724e9[_0x0265('0x11')]('Content-Range',_0x1d94a8+'-'+_0x405476+'/'+_0x43b6b9)[_0x0265('0xc')](_0x4433d7);}return null;};}function removeEntity(_0x19ce5d){return function(_0x1a5fa5){if(_0x1a5fa5){return _0x1a5fa5['destroy']()[_0x0265('0x12')](function(){var _0x419991=_0x1a5fa5[_0x0265('0x13')]({'plain':!![]});var _0x1ee6fd=[{'name':_0x0265('0x14'),'value':_0x0265('0x15'),'ignore':![]},{'name':_0x0265('0x16'),'value':_0x0265('0x17'),'ignore':![]},{'name':_0x0265('0x18'),'value':_0x0265('0x19'),'ignore':![]}];var _0x3ee11f=_(_0x1ee6fd)['filter']('ignore')[_0x0265('0x1a')](_0x0265('0x1b'))[_0x0265('0x1b')]();if(_[_0x0265('0x1c')](_0x3ee11f,_0x419991['type'])){return;}var _0x447298=_[_0x0265('0x1d')](_0x1ee6fd,[_0x0265('0x1b'),_0x419991[_0x0265('0x1e')]])['name'];return db[_0x0265('0x1f')][_0x0265('0x20')]({'where':{'type':_0x447298,'resourceId':_0x419991['id']}})['then'](function(){return _0x1a5fa5;});})['then'](function(){_0x19ce5d[_0x0265('0xb')](0xcc)[_0x0265('0x21')]();});}};}function handleEntityNotFound(_0x40618e){return function(_0x4644ca){if(!_0x4644ca){_0x40618e[_0x0265('0xa')](0x194);}return _0x4644ca;};}function handleError(_0x3d0d9a,_0xcf677){_0xcf677=_0xcf677||0x1f4;return function(_0x4deb76){logger[_0x0265('0x22')](_0x4deb76[_0x0265('0x23')]);if(_0x4deb76[_0x0265('0x24')]){delete _0x4deb76[_0x0265('0x24')];}_0x3d0d9a['status'](_0xcf677)[_0x0265('0x25')](_0x4deb76);};}exports[_0x0265('0x26')]=function(_0x2d5665,_0x5b2b9c){var _0x4d9059={},_0x3a297e={},_0x147aa9={'count':0x0,'rows':[]};var _0x40dd18=_['map'](db['VoiceExtension'][_0x0265('0x27')],function(_0x4e7428){return{'name':_0x4e7428[_0x0265('0x28')],'type':_0x4e7428[_0x0265('0x1e')]['key']};});_0x3a297e[_0x0265('0x29')]=_[_0x0265('0x1a')](_0x40dd18,_0x0265('0x24'));_0x3a297e[_0x0265('0x2a')]=_[_0x0265('0x2b')](_0x2d5665[_0x0265('0x2a')]);_0x3a297e['filters']=_[_0x0265('0x2c')](_0x3a297e[_0x0265('0x29')],_0x3a297e[_0x0265('0x2a')]);_0x4d9059[_0x0265('0x2d')]=_[_0x0265('0x2c')](_0x3a297e[_0x0265('0x29')],qs['fields'](_0x2d5665[_0x0265('0x2a')][_0x0265('0x2e')]));_0x4d9059[_0x0265('0x2d')]=_0x4d9059[_0x0265('0x2d')][_0x0265('0x2f')]?_0x4d9059['attributes']:_0x3a297e[_0x0265('0x29')];if(!_0x2d5665[_0x0265('0x2a')][_0x0265('0x30')](_0x0265('0x31'))){_0x4d9059['limit']=qs['limit'](_0x2d5665[_0x0265('0x2a')][_0x0265('0xe')]);_0x4d9059[_0x0265('0xd')]=qs[_0x0265('0xd')](_0x2d5665[_0x0265('0x2a')][_0x0265('0xd')]);}_0x4d9059[_0x0265('0x32')]=qs[_0x0265('0x33')](_0x2d5665[_0x0265('0x2a')][_0x0265('0x33')]);_0x4d9059[_0x0265('0x34')]=qs[_0x0265('0x35')](_[_0x0265('0x36')](_0x2d5665['query'],_0x3a297e[_0x0265('0x35')]),_0x40dd18);if(_0x2d5665[_0x0265('0x2a')]['filter']){_0x4d9059[_0x0265('0x34')]=_[_0x0265('0x37')](_0x4d9059[_0x0265('0x34')],{'$or':_[_0x0265('0x1a')](_0x40dd18,function(_0x2467bf){if(_0x2467bf[_0x0265('0x1e')]!==_0x0265('0x38')){var _0x4b0490={};_0x4b0490[_0x2467bf[_0x0265('0x24')]]={'$like':'%'+_0x2d5665[_0x0265('0x2a')][_0x0265('0x39')]+'%'};return _0x4b0490;}})});}_0x4d9059=_[_0x0265('0x37')]({},_0x4d9059,_0x2d5665[_0x0265('0x3a')]);var _0x519248={'where':_0x4d9059[_0x0265('0x34')]};return db['VoiceExtension']['count'](_0x519248)[_0x0265('0x12')](function(_0x21cdc7){_0x147aa9[_0x0265('0x10')]=_0x21cdc7;if(_0x2d5665[_0x0265('0x2a')][_0x0265('0x3b')]){_0x4d9059[_0x0265('0x3c')]=[{'all':!![]}];}return db[_0x0265('0x3d')][_0x0265('0x3e')](_0x4d9059);})[_0x0265('0x12')](function(_0x5602c2){_0x147aa9['rows']=_0x5602c2;return _0x147aa9;})[_0x0265('0x12')](respondWithFilteredResult(_0x5b2b9c,_0x4d9059))[_0x0265('0x3f')](handleError(_0x5b2b9c,null));};exports[_0x0265('0x40')]=function(_0x34d77e,_0x5104f1){var _0x547bd1={'raw':![],'where':{'id':_0x34d77e[_0x0265('0x41')]['id']}},_0x4c20ad={};_0x4c20ad['model']=_[_0x0265('0x2b')](db['VoiceExtension']['rawAttributes']);_0x4c20ad['query']=_[_0x0265('0x2b')](_0x34d77e[_0x0265('0x2a')]);_0x4c20ad[_0x0265('0x35')]=_['intersection'](_0x4c20ad[_0x0265('0x29')],_0x4c20ad[_0x0265('0x2a')]);_0x547bd1['attributes']=_[_0x0265('0x2c')](_0x4c20ad['model'],qs[_0x0265('0x2e')](_0x34d77e[_0x0265('0x2a')]['fields']));_0x547bd1['attributes']=_0x547bd1['attributes']['length']?_0x547bd1[_0x0265('0x2d')]:_0x4c20ad[_0x0265('0x29')];if(_0x34d77e[_0x0265('0x2a')][_0x0265('0x3b')]){_0x547bd1[_0x0265('0x3c')]=[{'all':!![]}];}_0x547bd1=_[_0x0265('0x37')]({},_0x547bd1,_0x34d77e['options']);return db['VoiceExtension'][_0x0265('0x1d')](_0x547bd1)[_0x0265('0x12')](handleEntityNotFound(_0x5104f1,null))[_0x0265('0x12')](respondWithResult(_0x5104f1,null))[_0x0265('0x3f')](handleError(_0x5104f1,null));};exports[_0x0265('0x20')]=function(_0x1e02cc,_0x5b91d3){return db['VoiceExtension'][_0x0265('0x1d')]({'where':{'id':_0x1e02cc[_0x0265('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b91d3,null))[_0x0265('0x12')](removeEntity(_0x5b91d3,null))[_0x0265('0x3f')](handleError(_0x5b91d3,null));};exports[_0x0265('0x42')]=function(_0x4d04e7,_0x1f31d0){if(_0x4d04e7[_0x0265('0x43')][_0x0265('0x1e')]===_0x0265('0x17')&&!_['startsWith'](_0x4d04e7[_0x0265('0x43')]['exten'],'_')){_0x4d04e7[_0x0265('0x43')][_0x0265('0x44')]='_'[_0x0265('0x45')](_0x4d04e7['body'][_0x0265('0x44')]);}return db['VoiceExtension'][_0x0265('0x42')](_0x4d04e7['body'],{'raw':![]})[_0x0265('0x12')](function(_0x2eef57){var _0x394324=_0x4d04e7[_0x0265('0x46')]['get']({'plain':!![]});if(!_0x394324)throw new Error(_0x0265('0x47'));if(_0x394324[_0x0265('0x48')]===_0x0265('0x46')){var _0x411775=_0x2eef57['get']({'plain':!![]});var _0x30d579=[{'name':'InboundRoutes','value':_0x0265('0x15')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x0265('0x19')}];var _0xb2016b=_['find'](_0x30d579,[_0x0265('0x1b'),_0x411775['type']])[_0x0265('0x24')];return db[_0x0265('0x49')][_0x0265('0x1d')]({'where':{'name':_0xb2016b,'userProfileId':_0x394324[_0x0265('0x4a')]},'raw':!![]})[_0x0265('0x12')](function(_0x2ab64a){if(_0x2ab64a&&_0x2ab64a['autoAssociation']===0x0){return db[_0x0265('0x1f')][_0x0265('0x42')]({'name':_0x411775[_0x0265('0x24')],'resourceId':_0x411775['id'],'type':_0x2ab64a[_0x0265('0x24')],'sectionId':_0x2ab64a['id']},{})[_0x0265('0x12')](function(){return _0x2eef57;});}else{return _0x2eef57;}})[_0x0265('0x3f')](function(_0x4448ef){logger['error'](_0x0265('0x4b'),_0x4448ef);throw _0x4448ef;});}return _0x2eef57;})['then'](respondWithResult(_0x1f31d0,0xc9))[_0x0265('0x3f')](handleError(_0x1f31d0,null));};exports[_0x0265('0x4c')]=function(_0x1a36ac,_0x32035d){if(_0x1a36ac[_0x0265('0x43')]['id']){delete _0x1a36ac['body']['id'];}return db[_0x0265('0x3d')]['find']({'where':{'id':_0x1a36ac[_0x0265('0x41')]['id']}})[_0x0265('0x12')](handleEntityNotFound(_0x32035d,null))[_0x0265('0x12')](function(_0x17292c){if(_0x17292c){return db[_0x0265('0x3d')][_0x0265('0x4c')](_['pick'](_0x1a36ac['body'],['exten',_0x0265('0x4d'),'description',_0x0265('0x4e'),'cutdigits',_0x0265('0x4f'),_0x0265('0x50')]),{'where':{'context':_0x17292c[_0x0265('0x4d')],'exten':_0x17292c[_0x0265('0x44')]},'individualHooks':!![]})[_0x0265('0x12')](function(_0x49a9a5){return _0x49a9a5;});}return null;})[_0x0265('0x12')](respondWithStatusCode(_0x32035d,null))['catch'](handleError(_0x32035d,null));};exports[_0x0265('0x51')]=function(_0x32f35f,_0x1ee1a3){var _0x2e7c76=_0x32f35f[_0x0265('0x41')]['id'];var _0x46e04a=_0x32f35f[_0x0265('0x43')];var _0x459c2=0xc8;var _0x35cdb8=null;return db[_0x0265('0x52')][_0x0265('0x53')]({'isolationLevel':db['sequelize'][_0x0265('0x54')][_0x0265('0x55')][_0x0265('0x56')]},function(_0x197efb){return db[_0x0265('0x3d')][_0x0265('0x57')]({'where':{'id':_0x2e7c76},'transaction':_0x197efb})[_0x0265('0x12')](function(_0x31388d){if(_0x31388d){return db[_0x0265('0x3d')]['destroy']({'where':{'VoiceExtensionId':_0x2e7c76},'transaction':_0x197efb})[_0x0265('0x12')](function(){var _0x202ddc=_[_0x0265('0x1a')](_0x46e04a,function(_0x37570b){_0x37570b['VoiceExtensionId']=_0x2e7c76;_0x37570b['isApp']=!![];return _0x37570b;});return _0x31388d[_0x0265('0x58')](_0x202ddc);})[_0x0265('0x12')](function(_0x50b3ac){return db[_0x0265('0x3d')][_0x0265('0x59')](_0x50b3ac,{'transaction':_0x197efb});});}else{_0x459c2=0x194;_0x35cdb8=[];}});})[_0x0265('0x12')](function(){if(_0x459c2!==0x194){return db[_0x0265('0x3d')][_0x0265('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2e7c76},'order':_0x0265('0x5b')})[_0x0265('0x12')](function(_0xc62a3){_0x35cdb8=_0xc62a3;});}})[_0x0265('0x3f')](function(_0x143af5){_0x459c2=0x1f4;logger[_0x0265('0x22')](_0x143af5[_0x0265('0x23')]);if(_0x143af5[_0x0265('0x24')]){delete _0x143af5['name'];}_0x35cdb8=_0x143af5;})[_0x0265('0x5c')](function(){if(_0x35cdb8===null){_0x1ee1a3[_0x0265('0xa')](_0x459c2);}else{if(_0x459c2===0x1f4){_0x1ee1a3[_0x0265('0xb')](_0x459c2)[_0x0265('0x25')](_0x35cdb8);}else{_0x1ee1a3['status'](_0x459c2)['json'](_0x35cdb8);}}});}; \ No newline at end of file +var _0x5a9c=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','options','includeAll','include','findAll','rows','show','params','VoiceExtension','catch','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','outbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','cast(priority\x20as\x20unsigned)','finally','send','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','destroy','then','get','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','stack','index','rawAttributes','key','model','query','keys'];(function(_0x1329e2,_0x281ee7){var _0x4b6904=function(_0x4ea8cb){while(--_0x4ea8cb){_0x1329e2['push'](_0x1329e2['shift']());}};_0x4b6904(++_0x281ee7);}(_0x5a9c,0x8e));var _0xc5a9=function(_0x481a5e,_0x5c9fe4){_0x481a5e=_0x481a5e-0x0;var _0x43de8f=_0x5a9c[_0x481a5e];return _0x43de8f;};'use strict';var _=require('lodash');var Redis=require(_0xc5a9('0x0'));var qs=require(_0xc5a9('0x1'));var logger=require(_0xc5a9('0x2'))('api');var config=require(_0xc5a9('0x3'));var db=require(_0xc5a9('0x4'))['db'];config[_0xc5a9('0x5')]=_[_0xc5a9('0x6')](config[_0xc5a9('0x5')],{'host':_0xc5a9('0x7'),'port':0x18eb});var socket=require(_0xc5a9('0x8'))(new Redis(config[_0xc5a9('0x5')]));require('./voiceExtension.socket')[_0xc5a9('0x9')](socket);function respondWithStatusCode(_0x347d1e,_0x1556bd){_0x1556bd=_0x1556bd||0xcc;return function(_0x21fad6){if(_0x21fad6){return _0x347d1e[_0xc5a9('0xa')](_0x1556bd);}return _0x347d1e[_0xc5a9('0xb')](_0x1556bd)[_0xc5a9('0xc')]();};}function respondWithResult(_0x215abd,_0x41d74b){_0x41d74b=_0x41d74b||0xc8;return function(_0x493bba){if(_0x493bba){return _0x215abd[_0xc5a9('0xb')](_0x41d74b)['json'](_0x493bba);}};}function respondWithFilteredResult(_0x15ad09,_0x56fcb3){return function(_0x767a32){if(_0x767a32){var _0x4932fb=typeof _0x56fcb3[_0xc5a9('0xd')]===_0xc5a9('0xe')&&typeof _0x56fcb3['limit']===_0xc5a9('0xe');var _0x5a1693=_0x767a32['count'];var _0x493975=_0x4932fb?0x0:_0x56fcb3[_0xc5a9('0xd')];var _0x574b05=_0x4932fb?_0x767a32[_0xc5a9('0xf')]:_0x56fcb3[_0xc5a9('0xd')]+_0x56fcb3[_0xc5a9('0x10')];var _0x5d9cf3;if(_0x574b05>=_0x5a1693){_0x574b05=_0x5a1693;_0x5d9cf3=0xc8;}else{_0x5d9cf3=0xce;}_0x15ad09[_0xc5a9('0xb')](_0x5d9cf3);return _0x15ad09['set']('Content-Range',_0x493975+'-'+_0x574b05+'/'+_0x5a1693)['json'](_0x767a32);}return null;};}function removeEntity(_0x49cafa){return function(_0x4efa7a){if(_0x4efa7a){return _0x4efa7a[_0xc5a9('0x11')]()[_0xc5a9('0x12')](function(){var _0x37f160=_0x4efa7a[_0xc5a9('0x13')]({'plain':!![]});var _0x4381ff=[{'name':'InboundRoutes','value':_0xc5a9('0x14'),'ignore':![]},{'name':_0xc5a9('0x15'),'value':'outbound','ignore':![]},{'name':_0xc5a9('0x16'),'value':_0xc5a9('0x17'),'ignore':![]}];var _0x267765=_(_0x4381ff)[_0xc5a9('0x18')](_0xc5a9('0x19'))[_0xc5a9('0x1a')](_0xc5a9('0x1b'))[_0xc5a9('0x1b')]();if(_[_0xc5a9('0x1c')](_0x267765,_0x37f160[_0xc5a9('0x1d')])){return;}var _0x1581cc=_[_0xc5a9('0x1e')](_0x4381ff,['value',_0x37f160[_0xc5a9('0x1d')]])[_0xc5a9('0x1f')];return db[_0xc5a9('0x20')][_0xc5a9('0x11')]({'where':{'type':_0x1581cc,'resourceId':_0x37f160['id']}})['then'](function(){return _0x4efa7a;});})[_0xc5a9('0x12')](function(){_0x49cafa[_0xc5a9('0xb')](0xcc)[_0xc5a9('0xc')]();});}};}function handleEntityNotFound(_0x500b56){return function(_0x460c2f){if(!_0x460c2f){_0x500b56[_0xc5a9('0xa')](0x194);}return _0x460c2f;};}function handleError(_0x39eaf3,_0x5e135c){_0x5e135c=_0x5e135c||0x1f4;return function(_0x52e606){logger['error'](_0x52e606[_0xc5a9('0x21')]);if(_0x52e606[_0xc5a9('0x1f')]){delete _0x52e606[_0xc5a9('0x1f')];}_0x39eaf3[_0xc5a9('0xb')](_0x5e135c)['send'](_0x52e606);};}exports[_0xc5a9('0x22')]=function(_0x1b7686,_0x480d57){var _0x2eb9ab={},_0x39d51b={},_0x3c92b5={'count':0x0,'rows':[]};var _0x3c442b=_[_0xc5a9('0x1a')](db['VoiceExtension'][_0xc5a9('0x23')],function(_0x44da4d){return{'name':_0x44da4d['fieldName'],'type':_0x44da4d[_0xc5a9('0x1d')][_0xc5a9('0x24')]};});_0x39d51b[_0xc5a9('0x25')]=_[_0xc5a9('0x1a')](_0x3c442b,_0xc5a9('0x1f'));_0x39d51b[_0xc5a9('0x26')]=_[_0xc5a9('0x27')](_0x1b7686[_0xc5a9('0x26')]);_0x39d51b[_0xc5a9('0x28')]=_['intersection'](_0x39d51b[_0xc5a9('0x25')],_0x39d51b['query']);_0x2eb9ab['attributes']=_[_0xc5a9('0x29')](_0x39d51b['model'],qs['fields'](_0x1b7686[_0xc5a9('0x26')][_0xc5a9('0x2a')]));_0x2eb9ab[_0xc5a9('0x2b')]=_0x2eb9ab[_0xc5a9('0x2b')][_0xc5a9('0x2c')]?_0x2eb9ab[_0xc5a9('0x2b')]:_0x39d51b[_0xc5a9('0x25')];if(!_0x1b7686[_0xc5a9('0x26')][_0xc5a9('0x2d')](_0xc5a9('0x2e'))){_0x2eb9ab[_0xc5a9('0x10')]=qs[_0xc5a9('0x10')](_0x1b7686[_0xc5a9('0x26')][_0xc5a9('0x10')]);_0x2eb9ab[_0xc5a9('0xd')]=qs['offset'](_0x1b7686['query'][_0xc5a9('0xd')]);}_0x2eb9ab[_0xc5a9('0x2f')]=qs[_0xc5a9('0x30')](_0x1b7686[_0xc5a9('0x26')][_0xc5a9('0x30')]);_0x2eb9ab['where']=qs[_0xc5a9('0x28')](_[_0xc5a9('0x31')](_0x1b7686[_0xc5a9('0x26')],_0x39d51b[_0xc5a9('0x28')]),_0x3c442b);if(_0x1b7686['query'][_0xc5a9('0x18')]){_0x2eb9ab['where']=_[_0xc5a9('0x32')](_0x2eb9ab[_0xc5a9('0x33')],{'$or':_[_0xc5a9('0x1a')](_0x3c442b,function(_0x83992a){if(_0x83992a[_0xc5a9('0x1d')]!=='VIRTUAL'){var _0x2717e4={};_0x2717e4[_0x83992a[_0xc5a9('0x1f')]]={'$like':'%'+_0x1b7686['query'][_0xc5a9('0x18')]+'%'};return _0x2717e4;}})});}_0x2eb9ab=_[_0xc5a9('0x32')]({},_0x2eb9ab,_0x1b7686[_0xc5a9('0x34')]);var _0x4ff3e1={'where':_0x2eb9ab[_0xc5a9('0x33')]};return db['VoiceExtension'][_0xc5a9('0xf')](_0x4ff3e1)[_0xc5a9('0x12')](function(_0x57d5b3){_0x3c92b5[_0xc5a9('0xf')]=_0x57d5b3;if(_0x1b7686[_0xc5a9('0x26')][_0xc5a9('0x35')]){_0x2eb9ab[_0xc5a9('0x36')]=[{'all':!![]}];}return db['VoiceExtension'][_0xc5a9('0x37')](_0x2eb9ab);})[_0xc5a9('0x12')](function(_0x3c30b9){_0x3c92b5[_0xc5a9('0x38')]=_0x3c30b9;return _0x3c92b5;})[_0xc5a9('0x12')](respondWithFilteredResult(_0x480d57,_0x2eb9ab))['catch'](handleError(_0x480d57,null));};exports[_0xc5a9('0x39')]=function(_0x4260ce,_0x5e3771){var _0x38d7a2={'raw':![],'where':{'id':_0x4260ce[_0xc5a9('0x3a')]['id']}},_0x19448c={};_0x19448c[_0xc5a9('0x25')]=_['keys'](db[_0xc5a9('0x3b')][_0xc5a9('0x23')]);_0x19448c['query']=_[_0xc5a9('0x27')](_0x4260ce[_0xc5a9('0x26')]);_0x19448c[_0xc5a9('0x28')]=_[_0xc5a9('0x29')](_0x19448c['model'],_0x19448c[_0xc5a9('0x26')]);_0x38d7a2['attributes']=_[_0xc5a9('0x29')](_0x19448c[_0xc5a9('0x25')],qs['fields'](_0x4260ce['query'][_0xc5a9('0x2a')]));_0x38d7a2[_0xc5a9('0x2b')]=_0x38d7a2['attributes'][_0xc5a9('0x2c')]?_0x38d7a2[_0xc5a9('0x2b')]:_0x19448c[_0xc5a9('0x25')];if(_0x4260ce[_0xc5a9('0x26')]['includeAll']){_0x38d7a2[_0xc5a9('0x36')]=[{'all':!![]}];}_0x38d7a2=_['merge']({},_0x38d7a2,_0x4260ce[_0xc5a9('0x34')]);return db[_0xc5a9('0x3b')][_0xc5a9('0x1e')](_0x38d7a2)[_0xc5a9('0x12')](handleEntityNotFound(_0x5e3771,null))[_0xc5a9('0x12')](respondWithResult(_0x5e3771,null))['catch'](handleError(_0x5e3771,null));};exports[_0xc5a9('0x11')]=function(_0xe4c43,_0x3a1795){return db[_0xc5a9('0x3b')][_0xc5a9('0x1e')]({'where':{'id':_0xe4c43['params']['id']}})[_0xc5a9('0x12')](handleEntityNotFound(_0x3a1795,null))['then'](removeEntity(_0x3a1795,null))[_0xc5a9('0x3c')](handleError(_0x3a1795,null));};exports[_0xc5a9('0x3d')]=function(_0x22113a,_0x5f1289){if(_0x22113a['body'][_0xc5a9('0x1d')]==='outbound'&&!_[_0xc5a9('0x3e')](_0x22113a[_0xc5a9('0x3f')][_0xc5a9('0x40')],'_')){_0x22113a['body'][_0xc5a9('0x40')]='_'[_0xc5a9('0x41')](_0x22113a[_0xc5a9('0x3f')][_0xc5a9('0x40')]);}return db['VoiceExtension'][_0xc5a9('0x3d')](_0x22113a['body'],{'raw':![]})[_0xc5a9('0x12')](function(_0x3a0fd3){var _0x5d8af7=_0x22113a[_0xc5a9('0x42')]['get']({'plain':!![]});if(!_0x5d8af7)throw new Error(_0xc5a9('0x43'));if(_0x5d8af7[_0xc5a9('0x44')]===_0xc5a9('0x42')){var _0x10aff0=_0x3a0fd3[_0xc5a9('0x13')]({'plain':!![]});var _0x17b034=[{'name':_0xc5a9('0x45'),'value':_0xc5a9('0x14')},{'name':'OutboundRoutes','value':_0xc5a9('0x46')},{'name':_0xc5a9('0x16'),'value':'internal'}];var _0x40b2d8=_['find'](_0x17b034,[_0xc5a9('0x1b'),_0x10aff0[_0xc5a9('0x1d')]])[_0xc5a9('0x1f')];return db[_0xc5a9('0x47')][_0xc5a9('0x1e')]({'where':{'name':_0x40b2d8,'userProfileId':_0x5d8af7['userProfileId']},'raw':!![]})[_0xc5a9('0x12')](function(_0x23f2fd){if(_0x23f2fd&&_0x23f2fd[_0xc5a9('0x48')]===0x0){return db['UserProfileResource'][_0xc5a9('0x3d')]({'name':_0x10aff0[_0xc5a9('0x1f')],'resourceId':_0x10aff0['id'],'type':_0x23f2fd[_0xc5a9('0x1f')],'sectionId':_0x23f2fd['id']},{})['then'](function(){return _0x3a0fd3;});}else{return _0x3a0fd3;}})[_0xc5a9('0x3c')](function(_0x525619){logger[_0xc5a9('0x49')](_0xc5a9('0x4a'),_0x525619);throw _0x525619;});}return _0x3a0fd3;})[_0xc5a9('0x12')](respondWithResult(_0x5f1289,0xc9))[_0xc5a9('0x3c')](handleError(_0x5f1289,null));};exports[_0xc5a9('0x4b')]=function(_0x400c95,_0x5775be){if(_0x400c95[_0xc5a9('0x3f')]['id']){delete _0x400c95[_0xc5a9('0x3f')]['id'];}return db['VoiceExtension'][_0xc5a9('0x1e')]({'where':{'id':_0x400c95['params']['id']}})[_0xc5a9('0x12')](handleEntityNotFound(_0x5775be,null))['then'](function(_0x3b888a){if(_0x3b888a){return db[_0xc5a9('0x3b')]['update'](_['pick'](_0x400c95['body'],[_0xc5a9('0x40'),_0xc5a9('0x4c'),'description','recordingFormat',_0xc5a9('0x4d'),_0xc5a9('0x4e'),'alias']),{'where':{'context':_0x3b888a[_0xc5a9('0x4c')],'exten':_0x3b888a[_0xc5a9('0x40')]},'individualHooks':!![]})[_0xc5a9('0x12')](function(_0x5e9da0){return _0x5e9da0;});}return null;})[_0xc5a9('0x12')](respondWithStatusCode(_0x5775be,null))['catch'](handleError(_0x5775be,null));};exports[_0xc5a9('0x4f')]=function(_0x37e2d3,_0x1c066c){var _0xdd474d=_0x37e2d3[_0xc5a9('0x3a')]['id'];var _0x5dab8a=_0x37e2d3[_0xc5a9('0x3f')];var _0x11931a=0xc8;var _0x28daa2=null;return db[_0xc5a9('0x50')][_0xc5a9('0x51')]({'isolationLevel':db['sequelize'][_0xc5a9('0x52')][_0xc5a9('0x53')][_0xc5a9('0x54')]},function(_0x1c210d){return db[_0xc5a9('0x3b')]['findOne']({'where':{'id':_0xdd474d},'transaction':_0x1c210d})[_0xc5a9('0x12')](function(_0x27c30e){if(_0x27c30e){return db['VoiceExtension'][_0xc5a9('0x11')]({'where':{'VoiceExtensionId':_0xdd474d},'transaction':_0x1c210d})[_0xc5a9('0x12')](function(){var _0x97d9bd=_[_0xc5a9('0x1a')](_0x5dab8a,function(_0x5064e0){_0x5064e0[_0xc5a9('0x55')]=_0xdd474d;_0x5064e0[_0xc5a9('0x56')]=!![];return _0x5064e0;});return _0x27c30e[_0xc5a9('0x57')](_0x97d9bd);})[_0xc5a9('0x12')](function(_0x2717c9){return db['VoiceExtension']['bulkCreate'](_0x2717c9,{'transaction':_0x1c210d});});}else{_0x11931a=0x194;_0x28daa2=[];}});})[_0xc5a9('0x12')](function(){if(_0x11931a!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0xdd474d},'order':_0xc5a9('0x58')})['then'](function(_0x14f53a){_0x28daa2=_0x14f53a;});}})[_0xc5a9('0x3c')](function(_0x216c90){_0x11931a=0x1f4;logger['error'](_0x216c90[_0xc5a9('0x21')]);if(_0x216c90['name']){delete _0x216c90['name'];}_0x28daa2=_0x216c90;})[_0xc5a9('0x59')](function(){if(_0x28daa2===null){_0x1c066c[_0xc5a9('0xa')](_0x11931a);}else{if(_0x11931a===0x1f4){_0x1c066c['status'](_0x11931a)[_0xc5a9('0x5a')](_0x28daa2);}else{_0x1c066c[_0xc5a9('0xb')](_0x11931a)['json'](_0x28daa2);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4904935..cce1faf 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 _0xddd1=['VoiceExtension','setMaxListeners','save','update','remove','emit','events','../../mysqldb'];(function(_0xc69f39,_0x2ce0cf){var _0x93be41=function(_0xd66056){while(--_0xd66056){_0xc69f39['push'](_0xc69f39['shift']());}};_0x93be41(++_0x2ce0cf);}(_0xddd1,0x6e));var _0x1ddd=function(_0x3a189c,_0x3db017){_0x3a189c=_0x3a189c-0x0;var _0x320277=_0xddd1[_0x3a189c];return _0x320277;};'use strict';var EventEmitter=require(_0x1ddd('0x0'));var VoiceExtension=require(_0x1ddd('0x1'))['db'][_0x1ddd('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1ddd('0x3')](0x0);var events={'afterCreate':_0x1ddd('0x4'),'afterUpdate':_0x1ddd('0x5'),'afterDestroy':_0x1ddd('0x6')};function emitEvent(_0xd958dd){return function(_0x365e03,_0x328d32,_0x50bfa9){VoiceExtensionEvents['emit'](_0xd958dd+':'+_0x365e03['id'],_0x365e03);VoiceExtensionEvents[_0x1ddd('0x7')](_0xd958dd,_0x365e03);_0x50bfa9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x6f33=['update','remove','emit','exports','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6f33,0x84));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x36f3('0x0'));var VoiceExtension=require(_0x36f3('0x1'))['db'][_0x36f3('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x36f3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x36f3('0x4'),'afterDestroy':_0x36f3('0x5')};function emitEvent(_0x2a1a1c){return function(_0x448a1a,_0x4a143f,_0x566374){VoiceExtensionEvents[_0x36f3('0x6')](_0x2a1a1c+':'+_0x448a1a['id'],_0x448a1a);VoiceExtensionEvents[_0x36f3('0x6')](_0x2a1a1c,_0x448a1a);_0x566374(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x36f3('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index e8acf28..d80fd32 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 _0x7eaa=['XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','catch','define','VoiceExtension','voice_extensions','get','then','concat','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','exten','type','inbound','CDR(routeid)=','push','context','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','*,*,*,*','intervals','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi'];(function(_0x23fdae,_0x201cee){var _0x19d10b=function(_0x11e967){while(--_0x11e967){_0x23fdae['push'](_0x23fdae['shift']());}};_0x19d10b(++_0x201cee);}(_0x7eaa,0x103));var _0xa7ea=function(_0x50cce3,_0x58f261){_0x50cce3=_0x50cce3-0x0;var _0x1c2082=_0x7eaa[_0x50cce3];return _0x1c2082;};'use strict';var _=require(_0xa7ea('0x0'));var attributes=require(_0xa7ea('0x1'));module[_0xa7ea('0x2')]=function(_0x4cff31){var _0x24bfb0=_0x4cff31[_0xa7ea('0x3')];function _0x25a9fd(_0x1d903b){var _0x372296=0x2;var _0x1cae92=[{'type':_0x1d903b['type'],'app':_0xa7ea('0x4'),'appdata':_0xa7ea('0x5')+_0x1d903b['type'],'context':_0x1d903b['context'],'exten':_0x1d903b[_0xa7ea('0x6')],'priority':_0x372296++,'VoiceExtensionId':_0x1d903b['id']}];if(_0x1d903b[_0xa7ea('0x7')]===_0xa7ea('0x8')){_0x1cae92['push']({'type':_0xa7ea('0x8'),'app':'Set','appdata':_0xa7ea('0x9')+_0x1d903b['id'],'context':_0x1d903b['context'],'exten':_0x1d903b[_0xa7ea('0x6')],'priority':_0x372296++,'VoiceExtensionId':_0x1d903b['id']});}_0x1cae92[_0xa7ea('0xa')]({'type':_0x1d903b[_0xa7ea('0x7')],'app':_0xa7ea('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1d903b[_0xa7ea('0xb')],'exten':_0x1d903b[_0xa7ea('0x6')],'priority':_0x372296++,'VoiceExtensionId':_0x1d903b['id']},{'type':_0x1d903b[_0xa7ea('0x7')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1d903b[_0xa7ea('0xb')],'exten':_0x1d903b['exten'],'priority':_0x372296++,'VoiceExtensionId':_0x1d903b['id']},{'type':_0x1d903b[_0xa7ea('0x7')],'app':_0xa7ea('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1d903b[_0xa7ea('0xb')],'exten':_0x1d903b['exten'],'priority':_0x372296++,'VoiceExtensionId':_0x1d903b['id']});return _0x1cae92;}function _0x52cb1d(_0x4b3d6c){var _0x59726c=0x2;var _0x2b36bd=[{'type':_0xa7ea('0xc'),'app':_0xa7ea('0x4'),'appdata':_0xa7ea('0xd'),'context':_0x4b3d6c[_0xa7ea('0xb')],'exten':_0x4b3d6c['exten'],'priority':_0x59726c++,'VoiceExtensionId':_0x4b3d6c['id']},{'type':'outbound','app':_0xa7ea('0x4'),'appdata':'CDR(destination)='+(_0x4b3d6c[_0xa7ea('0xe')]?_0xa7ea('0xf')+_0x4b3d6c['cutdigits']+'}':_0xa7ea('0x10')),'context':_0x4b3d6c['context'],'exten':_0x4b3d6c[_0xa7ea('0x6')],'priority':_0x59726c++,'VoiceExtensionId':_0x4b3d6c['id']},{'type':'outbound','app':_0xa7ea('0x4'),'appdata':_0xa7ea('0x9')+_0x4b3d6c['id'],'context':_0x4b3d6c[_0xa7ea('0xb')],'exten':_0x4b3d6c[_0xa7ea('0x6')],'priority':_0x59726c++,'VoiceExtensionId':_0x4b3d6c['id']},{'type':_0xa7ea('0xc'),'app':_0xa7ea('0x11'),'appdata':_0xa7ea('0x12')+(_0x59726c+0x2)+_0xa7ea('0x13')+(_0x59726c+0x1)+')','context':_0x4b3d6c[_0xa7ea('0xb')],'exten':_0x4b3d6c[_0xa7ea('0x6')],'priority':_0x59726c++,'VoiceExtensionId':_0x4b3d6c['id']},{'type':_0xa7ea('0xc'),'app':_0xa7ea('0x4'),'appdata':_0x4b3d6c[_0xa7ea('0xe')]?_0xa7ea('0x14')+_0x4b3d6c[_0xa7ea('0xe')]+'}':_0xa7ea('0x15'),'context':_0x4b3d6c['context'],'exten':_0x4b3d6c[_0xa7ea('0x6')],'priority':_0x59726c++,'VoiceExtensionId':_0x4b3d6c['id']},{'type':_0xa7ea('0xc'),'app':_0xa7ea('0x4'),'appdata':_0xa7ea('0x16'),'context':_0x4b3d6c[_0xa7ea('0xb')],'exten':_0x4b3d6c[_0xa7ea('0x6')],'priority':_0x59726c++,'VoiceExtensionId':_0x4b3d6c['id']},{'type':_0xa7ea('0xc'),'app':_0xa7ea('0x4'),'appdata':_0xa7ea('0x17'),'context':_0x4b3d6c[_0xa7ea('0xb')],'exten':_0x4b3d6c['exten'],'priority':_0x59726c++,'VoiceExtensionId':_0x4b3d6c['id']},{'type':_0xa7ea('0xc'),'app':_0xa7ea('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4b3d6c[_0xa7ea('0xb')],'exten':_0x4b3d6c[_0xa7ea('0x6')],'priority':_0x59726c++,'VoiceExtensionId':_0x4b3d6c['id']},{'type':'outbound','app':_0xa7ea('0x4'),'appdata':'outboundrouteid='+_0x4b3d6c['id'],'context':_0x4b3d6c['context'],'exten':_0x4b3d6c['exten'],'priority':_0x59726c++,'VoiceExtensionId':_0x4b3d6c['id']}];if(_0x4b3d6c[_0xa7ea('0x18')](_0xa7ea('0x19'))&&_0x4b3d6c[_0xa7ea('0x19')]!=='none'){_0x2b36bd[_0xa7ea('0xa')]({'type':_0xa7ea('0xc'),'app':'Set','appdata':_0xa7ea('0x1a'),'context':_0x4b3d6c[_0xa7ea('0xb')],'exten':_0x4b3d6c['exten'],'priority':_0x59726c++,'VoiceExtensionId':_0x4b3d6c['id']},{'type':_0xa7ea('0xc'),'app':_0xa7ea('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4b3d6c[_0xa7ea('0x19')]||_0xa7ea('0x1b'),'context':_0x4b3d6c[_0xa7ea('0xb')],'exten':_0x4b3d6c[_0xa7ea('0x6')],'priority':_0x59726c++,'VoiceExtensionId':_0x4b3d6c['id']});}return _0x2b36bd;}function _0x44c359(_0x40fa0f,_0xba41f4){var _0x231c5c=[{'name':_0xa7ea('0x1c'),'param':0x0},{'name':_0xa7ea('0x1d'),'param':0x1},{'name':_0xa7ea('0x1e'),'param':0x2},{'name':_0xa7ea('0x1f'),'param':0x3}];var _0x3787b3={};var _0x5e8452=_0xba41f4[_0xa7ea('0x20')](',');var _0x3ffcad=[];for(var _0x3bb790=0x0;_0x3bb790<_0x231c5c[_0xa7ea('0x21')];_0x3bb790++){switch(_0x231c5c[_0x3bb790][_0xa7ea('0x22')]){case _0xa7ea('0x1c'):_0x3787b3[_0xa7ea('0x1c')]=_0x5e8452[_0x231c5c[_0x3bb790][_0xa7ea('0x23')]]['split']('/')[0x1];_0x3787b3[_0xa7ea('0x24')]=_0x5e8452[_0x231c5c[_0x3bb790][_0xa7ea('0x23')]][_0xa7ea('0x20')]('/')[0x2];_0x3787b3['prefix']=_0x3787b3[_0xa7ea('0x24')]?_0x3787b3[_0xa7ea('0x24')][_0xa7ea('0x20')]('$')[0x0]:undefined;_0x3787b3[_0xa7ea('0x24')]=_0x40fa0f[_0xa7ea('0xe')]?(_0x3787b3[_0xa7ea('0x25')]||'')+_0xa7ea('0xf')+_0x40fa0f[_0xa7ea('0xe')]+'}':(_0x3787b3[_0xa7ea('0x25')]||'')+_0xa7ea('0x10');_0x3ffcad[_0x231c5c[_0x3bb790][_0xa7ea('0x23')]]=[_0xa7ea('0x26'),_0x3787b3[_0xa7ea('0x1c')],_0x3787b3[_0xa7ea('0x24')]][_0xa7ea('0x27')]('/');break;case _0xa7ea('0x1e'):_0x3787b3['options']=_0x5e8452[_0x231c5c[_0x3bb790]['param']];if(_0x40fa0f[_0xa7ea('0x19')]!==_0xa7ea('0x28')){if(_0x3787b3[_0xa7ea('0x1e')][_0xa7ea('0x29')](_0xa7ea('0x2a'))<0x0){_0x3787b3[_0xa7ea('0x1e')]+=_0xa7ea('0x2a');}}else{_0x3787b3[_0xa7ea('0x1e')]=_0x3787b3[_0xa7ea('0x1e')][_0xa7ea('0x2b')](_0xa7ea('0x2a'),'');}_0x3ffcad[_0x231c5c[_0x3bb790][_0xa7ea('0x23')]]=_0x3787b3['options'];break;default:_0x3ffcad[_0x231c5c[_0x3bb790]['param']]=_0x5e8452[_0x231c5c[_0x3bb790][_0xa7ea('0x23')]];}}return _0x3ffcad['join'](',');}function _0x3f9880(_0x1b5263,_0x83171f,_0x221154){return new Promise(function(_0x55da07,_0x4f6b99){var _0x44f899=[];if(_[_0xa7ea('0x2c')](_0x83171f))return _0x55da07(_0x44f899);_0x24bfb0['Interval'][_0xa7ea('0x2d')]({'attributes':['id',_0xa7ea('0x2e'),_0xa7ea('0x2f')],'raw':!![]})['then'](function(_0x243597){for(var _0xa33c02=0x0,_0x2f26d9=0x0;_0xa33c02<_0x83171f['length'];_0xa33c02++,_0x2f26d9=0x0){var _0x4a69a7=_0x83171f[_0xa33c02];var _0x2fec8b=[];var _0x3bbfc0=[];delete _0x4a69a7['id'];if(_0x4a69a7[_0xa7ea('0x2e')]!==_0xa7ea('0x30')){_0x4a69a7[_0xa7ea('0x31')]=[_0x4a69a7[_0xa7ea('0x2e')]];}else{_0x4a69a7[_0xa7ea('0x31')]=_0x4a69a7[_0xa7ea('0x2f')]?_['map'](_[_0xa7ea('0x32')](_0x243597,{'IntervalId':_0x4a69a7[_0xa7ea('0x2f')]}),_0xa7ea('0x2e')):[];}_0x4a69a7[_0xa7ea('0xb')]=_0x1b5263[_0xa7ea('0xb')];_0x4a69a7['exten']=_0x1b5263[_0xa7ea('0x6')];if(_0x4a69a7[_0xa7ea('0x7')])_0x4a69a7['type']=_0x4a69a7[_0xa7ea('0x7')]['toLowerCase']();if(_0x1b5263[_0xa7ea('0x7')]==='outbound'){if(_0x4a69a7[_0xa7ea('0x18')]('tag')&&_0x4a69a7[_0xa7ea('0x33')]&&_0x4a69a7[_0xa7ea('0x33')]!=='--'){_0x2fec8b['push']({'type':_0x4a69a7[_0xa7ea('0x7')][_0xa7ea('0x34')](),'app':_0xa7ea('0x4'),'appdata':_0xa7ea('0x35')+_0x4a69a7[_0xa7ea('0x33')],'context':_0x1b5263[_0xa7ea('0xb')],'exten':_0x1b5263['exten'],'priority':_0x4a69a7['intervals']['length']+_0x221154+_0x2f26d9++,'VoiceExtensionId':_0x1b5263['id']});}_0x2fec8b[_0xa7ea('0xa')]({'type':_0x4a69a7['type'][_0xa7ea('0x34')](),'app':_0xa7ea('0x11'),'appdata':_0xa7ea('0x36')+(_0x4a69a7['callerID']?_0xa7ea('0x37')+_0x4a69a7[_0xa7ea('0x38')]+')':_0xa7ea('0x39')),'context':_0x1b5263[_0xa7ea('0xb')],'exten':_0x1b5263[_0xa7ea('0x6')],'priority':_0x4a69a7[_0xa7ea('0x31')][_0xa7ea('0x21')]+_0x221154+_0x2f26d9++,'VoiceExtensionId':_0x1b5263['id']});}else{if(_0x4a69a7[_0xa7ea('0x18')](_0xa7ea('0x3a'))){if([_0xa7ea('0x3b'),_0xa7ea('0x3c')][_0xa7ea('0x3d')](_0x4a69a7[_0xa7ea('0x3e')][_0xa7ea('0x34')]())&&_0x4a69a7[_0xa7ea('0x3f')]!==_0xa7ea('0x40')){if(_0x4a69a7['answer']){_0x2fec8b[_0xa7ea('0xa')]({'type':_0x4a69a7[_0xa7ea('0x7')][_0xa7ea('0x34')](),'app':_0xa7ea('0x11'),'appdata':_0xa7ea('0x41'),'context':_0x1b5263[_0xa7ea('0xb')],'exten':_0x1b5263[_0xa7ea('0x6')],'priority':_0x4a69a7[_0xa7ea('0x31')][_0xa7ea('0x21')]+_0x221154+_0x2f26d9++,'VoiceExtensionId':_0x1b5263['id']});_0x2fec8b[_0xa7ea('0xa')]({'type':_0x4a69a7['type']['toLowerCase'](),'app':_0xa7ea('0x4'),'appdata':_0xa7ea('0x42'),'context':_0x1b5263[_0xa7ea('0xb')],'exten':_0x1b5263[_0xa7ea('0x6')],'priority':_0x4a69a7[_0xa7ea('0x31')][_0xa7ea('0x21')]+_0x221154+_0x2f26d9++,'VoiceExtensionId':_0x1b5263['id']});}else{_0x2fec8b[_0xa7ea('0xa')]({'type':_0x4a69a7['type'][_0xa7ea('0x34')](),'app':_0xa7ea('0x11'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1b5263['context'],'exten':_0x1b5263[_0xa7ea('0x6')],'priority':_0x4a69a7[_0xa7ea('0x31')][_0xa7ea('0x21')]+_0x221154+_0x2f26d9++,'VoiceExtensionId':_0x1b5263['id']});_0x2fec8b[_0xa7ea('0xa')]({'type':_0x4a69a7[_0xa7ea('0x7')][_0xa7ea('0x34')](),'app':_0xa7ea('0x4'),'appdata':_0xa7ea('0x43'),'context':_0x1b5263[_0xa7ea('0xb')],'exten':_0x1b5263[_0xa7ea('0x6')],'priority':_0x4a69a7['intervals']['length']+_0x221154+_0x2f26d9++,'VoiceExtensionId':_0x1b5263['id']});}}}}for(var _0x757ddc=0x0;_0x757ddc<_0x4a69a7['intervals'][_0xa7ea('0x21')];_0x757ddc++){var _0x15555d=_0x221154+_0x4a69a7[_0xa7ea('0x31')][_0xa7ea('0x21')];var _0x503e17=_0x757ddc===_0x4a69a7[_0xa7ea('0x31')]['length']-0x1?_0x221154+_0x2fec8b[_0xa7ea('0x21')]+_0x3bbfc0[_0xa7ea('0x21')]+0x2:_0x221154+_0x757ddc+0x1;_0x2fec8b['splice'](_0x757ddc,0x0,{'type':_0x1b5263[_0xa7ea('0x7')],'app':_0xa7ea('0x44'),'appdata':_0x4a69a7['intervals'][_0x757ddc]+'?'+_0x1b5263[_0xa7ea('0xb')]+_0xa7ea('0x45')+_0x15555d+':'+_0x1b5263[_0xa7ea('0xb')]+_0xa7ea('0x45')+_0x503e17,'exten':_0x1b5263[_0xa7ea('0x6')],'context':_0x1b5263['context'],'priority':_0x221154+_0x757ddc,'VoiceExtensionId':_0x1b5263['id']});}if(_0x4a69a7[_0xa7ea('0x3f')]===_0xa7ea('0x46')){_0x4a69a7[_0xa7ea('0x47')]=_0x44c359(_0x1b5263,_0x4a69a7[_0xa7ea('0x47')]);}if(_0x4a69a7[_0xa7ea('0x3f')]===_0xa7ea('0x48')){_0x2fec8b['push']({'type':_0x4a69a7[_0xa7ea('0x7')][_0xa7ea('0x34')](),'app':'Set','appdata':_0xa7ea('0x49'),'context':_0x1b5263[_0xa7ea('0xb')],'exten':_0x1b5263['exten'],'priority':_0x4a69a7[_0xa7ea('0x31')]['length']+_0x221154+_0x2f26d9++,'VoiceExtensionId':_0x1b5263['id']});}_0x4a69a7['priority']=_0x2fec8b[_0xa7ea('0x21')]?_[_0xa7ea('0x4a')](_0x2fec8b)[_0xa7ea('0x4b')]+0x1:_0x221154;_0x44f899=_['concat'](_0x44f899,_0x2fec8b,[_0x4a69a7],_0x3bbfc0);_0x221154=_[_0xa7ea('0x4a')](_0x44f899)['priority']+0x1;}return _0x55da07(_0x44f899);})[_0xa7ea('0x4c')](function(_0x3e9da5){_0x4f6b99(_0x3e9da5);});});}return _0x4cff31[_0xa7ea('0x4d')](_0xa7ea('0x4e'),attributes,{'tableName':_0xa7ea('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4a5056){var _0x3c7c9a=this[_0xa7ea('0x50')]({'plain':!![]});var _0x5dcbb3=_0x3c7c9a['type']===_0xa7ea('0xc')?_0x52cb1d(_0x3c7c9a):_0x25a9fd(_0x3c7c9a);return _0x3f9880(_0x3c7c9a,_0x4a5056,_[_0xa7ea('0x4a')](_0x5dcbb3)[_0xa7ea('0x4b')]+0x1)[_0xa7ea('0x51')](function(_0x1d9c08){var _0x2eb9a9=_[_0xa7ea('0x52')](_0x5dcbb3,_0x1d9c08);_0x2eb9a9[_0xa7ea('0xa')]({'type':_0x3c7c9a['type'],'app':'Hangup','exten':_0x3c7c9a['exten'],'context':_0x3c7c9a[_0xa7ea('0xb')],'priority':_[_0xa7ea('0x4a')](_0x2eb9a9)[_0xa7ea('0x4b')]+0x1,'VoiceExtensionId':_0x3c7c9a['id']});return _0x2eb9a9;});}}});}; \ No newline at end of file +var _0xa849=['prefix','${EXTEN:','SIP','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','findAll','interval','IntervalId','then','intervals','map','filter','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appType','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','./voiceExtension.attributes','models','type','CDR(type)=','context','exten','inbound','CDR(routeid)=','push','Set','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','options','split','length','name','param','phone'];(function(_0x5e2350,_0x1077cb){var _0x1b88a9=function(_0x1fe510){while(--_0x1fe510){_0x5e2350['push'](_0x5e2350['shift']());}};_0x1b88a9(++_0x1077cb);}(_0xa849,0x73));var _0x9a84=function(_0x21b675,_0x12c1c0){_0x21b675=_0x21b675-0x0;var _0x1c4103=_0xa849[_0x21b675];return _0x1c4103;};'use strict';var _=require('lodash');var attributes=require(_0x9a84('0x0'));module['exports']=function(_0x25fd20){var _0x4097f4=_0x25fd20[_0x9a84('0x1')];function _0x96b0(_0x15e199){var _0x445c09=0x2;var _0x3e1428=[{'type':_0x15e199[_0x9a84('0x2')],'app':'Set','appdata':_0x9a84('0x3')+_0x15e199['type'],'context':_0x15e199[_0x9a84('0x4')],'exten':_0x15e199[_0x9a84('0x5')],'priority':_0x445c09++,'VoiceExtensionId':_0x15e199['id']}];if(_0x15e199[_0x9a84('0x2')]==='inbound'){_0x3e1428['push']({'type':_0x9a84('0x6'),'app':'Set','appdata':_0x9a84('0x7')+_0x15e199['id'],'context':_0x15e199[_0x9a84('0x4')],'exten':_0x15e199[_0x9a84('0x5')],'priority':_0x445c09++,'VoiceExtensionId':_0x15e199['id']});}_0x3e1428[_0x9a84('0x8')]({'type':_0x15e199[_0x9a84('0x2')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x15e199[_0x9a84('0x4')],'exten':_0x15e199[_0x9a84('0x5')],'priority':_0x445c09++,'VoiceExtensionId':_0x15e199['id']},{'type':_0x15e199[_0x9a84('0x2')],'app':_0x9a84('0x9'),'appdata':_0x9a84('0xa'),'context':_0x15e199[_0x9a84('0x4')],'exten':_0x15e199['exten'],'priority':_0x445c09++,'VoiceExtensionId':_0x15e199['id']},{'type':_0x15e199['type'],'app':_0x9a84('0x9'),'appdata':_0x9a84('0xb'),'context':_0x15e199[_0x9a84('0x4')],'exten':_0x15e199[_0x9a84('0x5')],'priority':_0x445c09++,'VoiceExtensionId':_0x15e199['id']});return _0x3e1428;}function _0x53476d(_0xaffd85){var _0x1c4ffd=0x2;var _0x4f5c46=[{'type':_0x9a84('0xc'),'app':_0x9a84('0x9'),'appdata':_0x9a84('0xd'),'context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':_0x9a84('0xc'),'app':'Set','appdata':_0x9a84('0xe')+(_0xaffd85[_0x9a84('0xf')]?'${EXTEN:'+_0xaffd85[_0x9a84('0xf')]+'}':_0x9a84('0x10')),'context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':'outbound','app':_0x9a84('0x9'),'appdata':_0x9a84('0x7')+_0xaffd85['id'],'context':_0xaffd85['context'],'exten':_0xaffd85['exten'],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':'outbound','app':_0x9a84('0x11'),'appdata':_0x9a84('0x12')+(_0x1c4ffd+0x2)+'):Goto('+(_0x1c4ffd+0x1)+')','context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':_0x9a84('0xc'),'app':_0x9a84('0x9'),'appdata':_0xaffd85[_0x9a84('0xf')]?'CDR(prefix)=${EXTEN:0:'+_0xaffd85['cutdigits']+'}':_0x9a84('0x13'),'context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85['exten'],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':'outbound','app':_0x9a84('0x9'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85['exten'],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':_0x9a84('0xc'),'app':'Set','appdata':_0x9a84('0xa'),'context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85['exten'],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':_0x9a84('0xc'),'app':_0x9a84('0x9'),'appdata':'MONITOR_OPTIONS=ab','context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':_0x9a84('0xc'),'app':_0x9a84('0x9'),'appdata':_0x9a84('0x14')+_0xaffd85['id'],'context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']}];if(_0xaffd85[_0x9a84('0x15')]('recordingFormat')&&_0xaffd85[_0x9a84('0x16')]!==_0x9a84('0x17')){_0x4f5c46['push']({'type':_0x9a84('0xc'),'app':_0x9a84('0x9'),'appdata':_0x9a84('0x18'),'context':_0xaffd85['context'],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':'outbound','app':_0x9a84('0x9'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xaffd85['recordingFormat']||'wav','context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85['exten'],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']});}return _0x4f5c46;}function _0x40b33c(_0x568221,_0x2860d1){var _0x3ba164=[{'name':_0x9a84('0x19'),'param':0x0},{'name':_0x9a84('0x1a'),'param':0x1},{'name':_0x9a84('0x1b'),'param':0x2},{'name':'url','param':0x3}];var _0x217c01={};var _0x25b008=_0x2860d1[_0x9a84('0x1c')](',');var _0x49d35f=[];for(var _0x59f383=0x0;_0x59f383<_0x3ba164[_0x9a84('0x1d')];_0x59f383++){switch(_0x3ba164[_0x59f383][_0x9a84('0x1e')]){case _0x9a84('0x19'):_0x217c01['trunk']=_0x25b008[_0x3ba164[_0x59f383][_0x9a84('0x1f')]][_0x9a84('0x1c')]('/')[0x1];_0x217c01[_0x9a84('0x20')]=_0x25b008[_0x3ba164[_0x59f383][_0x9a84('0x1f')]][_0x9a84('0x1c')]('/')[0x2];_0x217c01[_0x9a84('0x21')]=_0x217c01[_0x9a84('0x20')]?_0x217c01[_0x9a84('0x20')][_0x9a84('0x1c')]('$')[0x0]:undefined;_0x217c01[_0x9a84('0x20')]=_0x568221[_0x9a84('0xf')]?(_0x217c01['prefix']||'')+_0x9a84('0x22')+_0x568221[_0x9a84('0xf')]+'}':(_0x217c01[_0x9a84('0x21')]||'')+_0x9a84('0x10');_0x49d35f[_0x3ba164[_0x59f383][_0x9a84('0x1f')]]=[_0x9a84('0x23'),_0x217c01[_0x9a84('0x19')],_0x217c01[_0x9a84('0x20')]]['join']('/');break;case'options':_0x217c01['options']=_0x25b008[_0x3ba164[_0x59f383][_0x9a84('0x1f')]];if(_0x568221[_0x9a84('0x16')]!=='none'){if(_0x217c01[_0x9a84('0x1b')][_0x9a84('0x24')](_0x9a84('0x25'))<0x0){_0x217c01[_0x9a84('0x1b')]+=_0x9a84('0x25');}}else{_0x217c01[_0x9a84('0x1b')]=_0x217c01['options']['replace'](_0x9a84('0x25'),'');}_0x49d35f[_0x3ba164[_0x59f383][_0x9a84('0x1f')]]=_0x217c01[_0x9a84('0x1b')];break;default:_0x49d35f[_0x3ba164[_0x59f383][_0x9a84('0x1f')]]=_0x25b008[_0x3ba164[_0x59f383][_0x9a84('0x1f')]];}}return _0x49d35f[_0x9a84('0x26')](',');}function _0x15b722(_0x2c5c16,_0x33919d,_0x4491dd){return new Promise(function(_0x1315d2,_0x4f581a){var _0x4e6ebb=[];if(_[_0x9a84('0x27')](_0x33919d))return _0x1315d2(_0x4e6ebb);_0x4097f4['Interval'][_0x9a84('0x28')]({'attributes':['id',_0x9a84('0x29'),_0x9a84('0x2a')],'raw':!![]})[_0x9a84('0x2b')](function(_0x5db733){for(var _0x1b8eb1=0x0,_0x2039d=0x0;_0x1b8eb1<_0x33919d['length'];_0x1b8eb1++,_0x2039d=0x0){var _0x12aad0=_0x33919d[_0x1b8eb1];var _0x19fcb5=[];var _0x48116e=[];delete _0x12aad0['id'];if(_0x12aad0[_0x9a84('0x29')]!=='*,*,*,*'){_0x12aad0[_0x9a84('0x2c')]=[_0x12aad0[_0x9a84('0x29')]];}else{_0x12aad0[_0x9a84('0x2c')]=_0x12aad0[_0x9a84('0x2a')]?_[_0x9a84('0x2d')](_[_0x9a84('0x2e')](_0x5db733,{'IntervalId':_0x12aad0['IntervalId']}),'interval'):[];}_0x12aad0[_0x9a84('0x4')]=_0x2c5c16[_0x9a84('0x4')];_0x12aad0[_0x9a84('0x5')]=_0x2c5c16[_0x9a84('0x5')];if(_0x12aad0['type'])_0x12aad0[_0x9a84('0x2')]=_0x12aad0[_0x9a84('0x2')]['toLowerCase']();if(_0x2c5c16[_0x9a84('0x2')]===_0x9a84('0xc')){if(_0x12aad0[_0x9a84('0x15')](_0x9a84('0x2f'))&&_0x12aad0[_0x9a84('0x2f')]&&_0x12aad0[_0x9a84('0x2f')]!=='--'){_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0[_0x9a84('0x2')]['toLowerCase'](),'app':_0x9a84('0x9'),'appdata':_0x9a84('0x30')+_0x12aad0[_0x9a84('0x2f')],'context':_0x2c5c16[_0x9a84('0x4')],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0['intervals'][_0x9a84('0x1d')]+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});}_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0[_0x9a84('0x2')][_0x9a84('0x31')](),'app':_0x9a84('0x11'),'appdata':_0x9a84('0x32')+(_0x12aad0[_0x9a84('0x33')]?_0x9a84('0x34')+_0x12aad0[_0x9a84('0x33')]+')':_0x9a84('0x35')),'context':_0x2c5c16[_0x9a84('0x4')],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0[_0x9a84('0x2c')][_0x9a84('0x1d')]+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});}else{if(_0x12aad0[_0x9a84('0x15')](_0x9a84('0x36'))){if([_0x9a84('0x37'),'playback']['includes'](_0x12aad0['app']['toLowerCase']())&&_0x12aad0['appType']!==_0x9a84('0x38')){if(_0x12aad0['answer']){_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0[_0x9a84('0x2')][_0x9a84('0x31')](),'app':'ExecIf','appdata':_0x9a84('0x39'),'context':_0x2c5c16['context'],'exten':_0x2c5c16['exten'],'priority':_0x12aad0['intervals'][_0x9a84('0x1d')]+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0[_0x9a84('0x2')]['toLowerCase'](),'app':_0x9a84('0x9'),'appdata':_0x9a84('0x3a'),'context':_0x2c5c16['context'],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0['intervals']['length']+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});}else{_0x19fcb5['push']({'type':_0x12aad0['type'][_0x9a84('0x31')](),'app':_0x9a84('0x11'),'appdata':_0x9a84('0x3b'),'context':_0x2c5c16[_0x9a84('0x4')],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0[_0x9a84('0x2c')][_0x9a84('0x1d')]+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0['type'][_0x9a84('0x31')](),'app':_0x9a84('0x9'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2c5c16['context'],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0['intervals']['length']+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});}}}}for(var _0x10ebbe=0x0;_0x10ebbe<_0x12aad0[_0x9a84('0x2c')][_0x9a84('0x1d')];_0x10ebbe++){var _0xc98789=_0x4491dd+_0x12aad0['intervals']['length'];var _0x41c01c=_0x10ebbe===_0x12aad0['intervals'][_0x9a84('0x1d')]-0x1?_0x4491dd+_0x19fcb5[_0x9a84('0x1d')]+_0x48116e[_0x9a84('0x1d')]+0x2:_0x4491dd+_0x10ebbe+0x1;_0x19fcb5[_0x9a84('0x3c')](_0x10ebbe,0x0,{'type':_0x2c5c16[_0x9a84('0x2')],'app':_0x9a84('0x3d'),'appdata':_0x12aad0[_0x9a84('0x2c')][_0x10ebbe]+'?'+_0x2c5c16['context']+_0x9a84('0x3e')+_0xc98789+':'+_0x2c5c16[_0x9a84('0x4')]+',${EXTEN},'+_0x41c01c,'exten':_0x2c5c16[_0x9a84('0x5')],'context':_0x2c5c16[_0x9a84('0x4')],'priority':_0x4491dd+_0x10ebbe,'VoiceExtensionId':_0x2c5c16['id']});}if(_0x12aad0[_0x9a84('0x3f')]==='outboundDial'){_0x12aad0[_0x9a84('0x40')]=_0x40b33c(_0x2c5c16,_0x12aad0['appdata']);}if(_0x12aad0[_0x9a84('0x3f')]==='agi'){_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0[_0x9a84('0x2')][_0x9a84('0x31')](),'app':'Set','appdata':_0x9a84('0x41'),'context':_0x2c5c16['context'],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0[_0x9a84('0x2c')][_0x9a84('0x1d')]+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});}_0x12aad0[_0x9a84('0x42')]=_0x19fcb5[_0x9a84('0x1d')]?_[_0x9a84('0x43')](_0x19fcb5)[_0x9a84('0x42')]+0x1:_0x4491dd;_0x4e6ebb=_[_0x9a84('0x44')](_0x4e6ebb,_0x19fcb5,[_0x12aad0],_0x48116e);_0x4491dd=_['last'](_0x4e6ebb)[_0x9a84('0x42')]+0x1;}return _0x1315d2(_0x4e6ebb);})[_0x9a84('0x45')](function(_0x3d5f1b){_0x4f581a(_0x3d5f1b);});});}return _0x25fd20[_0x9a84('0x46')](_0x9a84('0x47'),attributes,{'tableName':_0x9a84('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4d85bc){var _0x2eaa62=this[_0x9a84('0x49')]({'plain':!![]});var _0x1fad79=_0x2eaa62['type']===_0x9a84('0xc')?_0x53476d(_0x2eaa62):_0x96b0(_0x2eaa62);return _0x15b722(_0x2eaa62,_0x4d85bc,_[_0x9a84('0x43')](_0x1fad79)['priority']+0x1)[_0x9a84('0x2b')](function(_0x5dae23){var _0x123b53=_['concat'](_0x1fad79,_0x5dae23);_0x123b53[_0x9a84('0x8')]({'type':_0x2eaa62[_0x9a84('0x2')],'app':'Hangup','exten':_0x2eaa62[_0x9a84('0x5')],'context':_0x2eaa62[_0x9a84('0x4')],'priority':_[_0x9a84('0x43')](_0x123b53)[_0x9a84('0x42')]+0x1,'VoiceExtensionId':_0x2eaa62['id']});return _0x123b53;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 175a560..7abced9 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 _0xa1aa=['request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceExtension','findAll','options','where','attributes','limit','map','include','model','GetVoiceExtension','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s'];(function(_0x5e6f02,_0x19927e){var _0x4efbfc=function(_0x372929){while(--_0x372929){_0x5e6f02['push'](_0x5e6f02['shift']());}};_0x4efbfc(++_0x19927e);}(_0xa1aa,0x88));var _0xaa1a=function(_0x536784,_0x495afb){_0x536784=_0x536784-0x0;var _0x1dd19b=_0xa1aa[_0x536784];return _0x1dd19b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa1a('0x0'));var BPromise=require(_0xaa1a('0x1'));var rs=require(_0xaa1a('0x2'));var fs=require('fs');var Redis=require(_0xaa1a('0x3'));var db=require(_0xaa1a('0x4'))['db'];var utils=require(_0xaa1a('0x5'));var logger=require(_0xaa1a('0x6'))('rpc');var config=require(_0xaa1a('0x7'));var jayson=require(_0xaa1a('0x8'));var client=jayson['client'][_0xaa1a('0x9')]({'port':0x232a});config[_0xaa1a('0xa')]=_[_0xaa1a('0xb')](config[_0xaa1a('0xa')],{'host':_0xaa1a('0xc'),'port':0x18eb});var socket=require(_0xaa1a('0xd'))(new Redis(config[_0xaa1a('0xa')]));require(_0xaa1a('0xe'))[_0xaa1a('0xf')](socket);function respondWithRpcPromise(_0x4cd755,_0x1a276c,_0x5663fd){return new BPromise(function(_0x7c44f4,_0x2b58b2){return client[_0xaa1a('0x10')](_0x4cd755,_0x5663fd)[_0xaa1a('0x11')](function(_0x432916){logger[_0xaa1a('0x12')](_0xaa1a('0x13'),_0x1a276c,_0xaa1a('0x14'));logger[_0xaa1a('0x15')](_0xaa1a('0x16'),_0x1a276c,_0xaa1a('0x14'),JSON['stringify'](_0x432916));if(_0x432916['error']){if(_0x432916[_0xaa1a('0x17')][_0xaa1a('0x18')]===0x1f4){logger[_0xaa1a('0x17')](_0xaa1a('0x13'),_0x1a276c,_0x432916[_0xaa1a('0x17')][_0xaa1a('0x19')]);return _0x2b58b2(_0x432916['error'][_0xaa1a('0x19')]);}logger[_0xaa1a('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x1a276c,_0x432916[_0xaa1a('0x17')]['message']);return _0x7c44f4(_0x432916['error'][_0xaa1a('0x19')]);}else{logger[_0xaa1a('0x12')](_0xaa1a('0x13'),_0x1a276c,_0xaa1a('0x14'));_0x7c44f4(_0x432916[_0xaa1a('0x1a')][_0xaa1a('0x19')]);}})[_0xaa1a('0x1b')](function(_0x18bb19){logger[_0xaa1a('0x17')](_0xaa1a('0x13'),_0x1a276c,_0x18bb19);_0x2b58b2(_0x18bb19);});});}exports['GetVoiceExtension']=function(_0x328a07){var _0x156ce9=this;return new Promise(function(_0x281e8f,_0x2558a8){return db[_0xaa1a('0x1c')][_0xaa1a('0x1d')]({'raw':_0x328a07[_0xaa1a('0x1e')]?_0x328a07[_0xaa1a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x328a07[_0xaa1a('0x1e')]?_0x328a07[_0xaa1a('0x1e')][_0xaa1a('0x1f')]||null:null,'attributes':_0x328a07[_0xaa1a('0x1e')]?_0x328a07[_0xaa1a('0x1e')][_0xaa1a('0x20')]||null:null,'limit':_0x328a07[_0xaa1a('0x1e')]?_0x328a07[_0xaa1a('0x1e')][_0xaa1a('0x21')]||null:null,'include':_0x328a07['options']?_0x328a07[_0xaa1a('0x1e')]['include']?_[_0xaa1a('0x22')](_0x328a07[_0xaa1a('0x1e')][_0xaa1a('0x23')],function(_0x15fb61){return{'model':db[_0x15fb61[_0xaa1a('0x24')]],'as':_0x15fb61['as'],'attributes':_0x15fb61[_0xaa1a('0x20')],'include':_0x15fb61[_0xaa1a('0x23')]?_['map'](_0x15fb61[_0xaa1a('0x23')],function(_0x164b7f){return{'model':db[_0x164b7f['model']],'as':_0x164b7f['as'],'attributes':_0x164b7f[_0xaa1a('0x20')],'include':_0x164b7f['include']?_[_0xaa1a('0x22')](_0x164b7f[_0xaa1a('0x23')],function(_0xd2360d){return{'model':db[_0xd2360d['model']],'as':_0xd2360d['as'],'attributes':_0xd2360d[_0xaa1a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaa1a('0x11')](function(_0x43d0b1){logger[_0xaa1a('0x12')]('GetVoiceExtension',_0x328a07);logger['debug'](_0xaa1a('0x25'),_0x328a07,JSON[_0xaa1a('0x26')](_0x43d0b1));_0x281e8f(_0x43d0b1);})[_0xaa1a('0x1b')](function(_0x3d10c7){logger[_0xaa1a('0x17')](_0xaa1a('0x25'),_0x3d10c7['message'],_0x328a07);_0x2558a8(_0x156ce9['error'](0x1f4,_0x3d10c7[_0xaa1a('0x19')]));});});}; \ No newline at end of file +var _0x01db=['bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','lodash'];(function(_0x28557d,_0x572726){var _0xe70a73=function(_0x17f657){while(--_0x17f657){_0x28557d['push'](_0x28557d['shift']());}};_0xe70a73(++_0x572726);}(_0x01db,0x171));var _0xb01d=function(_0x3624b3,_0x19fb6a){_0x3624b3=_0x3624b3-0x0;var _0xd3a448=_0x01db[_0x3624b3];return _0xd3a448;};'use strict';var _=require(_0xb01d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb01d('0x1'));var rs=require(_0xb01d('0x2'));var fs=require('fs');var Redis=require(_0xb01d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb01d('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb01d('0x5'));var jayson=require(_0xb01d('0x6'));var client=jayson[_0xb01d('0x7')][_0xb01d('0x8')]({'port':0x232a});config[_0xb01d('0x9')]=_[_0xb01d('0xa')](config[_0xb01d('0x9')],{'host':_0xb01d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb01d('0xc'))[_0xb01d('0xd')](socket);function respondWithRpcPromise(_0x28e0fc,_0x3b2de4,_0x147b7b){return new BPromise(function(_0x9112c1,_0x4eb866){return client['request'](_0x28e0fc,_0x147b7b)[_0xb01d('0xe')](function(_0x1b59b9){logger[_0xb01d('0xf')](_0xb01d('0x10'),_0x3b2de4,_0xb01d('0x11'));logger[_0xb01d('0x12')](_0xb01d('0x13'),_0x3b2de4,'request\x20sent',JSON['stringify'](_0x1b59b9));if(_0x1b59b9[_0xb01d('0x14')]){if(_0x1b59b9['error'][_0xb01d('0x15')]===0x1f4){logger[_0xb01d('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x3b2de4,_0x1b59b9[_0xb01d('0x14')][_0xb01d('0x16')]);return _0x4eb866(_0x1b59b9[_0xb01d('0x14')][_0xb01d('0x16')]);}logger['error'](_0xb01d('0x10'),_0x3b2de4,_0x1b59b9['error'][_0xb01d('0x16')]);return _0x9112c1(_0x1b59b9[_0xb01d('0x14')][_0xb01d('0x16')]);}else{logger[_0xb01d('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x3b2de4,_0xb01d('0x11'));_0x9112c1(_0x1b59b9[_0xb01d('0x17')][_0xb01d('0x16')]);}})['catch'](function(_0x210023){logger['error'](_0xb01d('0x10'),_0x3b2de4,_0x210023);_0x4eb866(_0x210023);});});}exports[_0xb01d('0x18')]=function(_0x3e96ef){var _0x28a6a7=this;return new Promise(function(_0x3d5c9d,_0x4d517e){return db[_0xb01d('0x19')][_0xb01d('0x1a')]({'raw':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x1d')]||null:null,'attributes':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x1e')]||null:null,'limit':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef['options'][_0xb01d('0x1f')]||null:null,'include':_0x3e96ef['options']?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x20')]?_[_0xb01d('0x21')](_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x20')],function(_0x1d8f04){return{'model':db[_0x1d8f04[_0xb01d('0x22')]],'as':_0x1d8f04['as'],'attributes':_0x1d8f04[_0xb01d('0x1e')],'include':_0x1d8f04[_0xb01d('0x20')]?_[_0xb01d('0x21')](_0x1d8f04[_0xb01d('0x20')],function(_0x531d37){return{'model':db[_0x531d37[_0xb01d('0x22')]],'as':_0x531d37['as'],'attributes':_0x531d37[_0xb01d('0x1e')],'include':_0x531d37[_0xb01d('0x20')]?_['map'](_0x531d37[_0xb01d('0x20')],function(_0x1bd8d2){return{'model':db[_0x1bd8d2[_0xb01d('0x22')]],'as':_0x1bd8d2['as'],'attributes':_0x1bd8d2['attributes']};}):[]};}):[]};}):[]:[]})[_0xb01d('0xe')](function(_0x5007d1){logger[_0xb01d('0xf')](_0xb01d('0x18'),_0x3e96ef);logger[_0xb01d('0x12')]('GetVoiceExtension',_0x3e96ef,JSON[_0xb01d('0x23')](_0x5007d1));_0x3d5c9d(_0x5007d1);})[_0xb01d('0x24')](function(_0x1666a1){logger[_0xb01d('0x14')](_0xb01d('0x18'),_0x1666a1[_0xb01d('0x16')],_0x3e96ef);_0x4d517e(_0x28a6a7['error'](0x1f4,_0x1666a1[_0xb01d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 1ef3cc4..ae3d8cb 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 _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x484bb1,_0x538d95){var _0x22bc47=function(_0x4e57c5){while(--_0x4e57c5){_0x484bb1['push'](_0x484bb1['shift']());}};_0x22bc47(++_0x538d95);}(_0xf494,0x1c6));var _0x4f49=function(_0x2cd313,_0x34a888){_0x2cd313=_0x2cd313-0x0;var _0x546297=_0xf494[_0x2cd313];return _0x546297;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x38dcd6,_0x4e10b8){var _0x108b96=function(_0x3499b5){while(--_0x3499b5){_0x38dcd6['push'](_0x38dcd6['shift']());}};_0x108b96(++_0x4e10b8);}(_0x1261,0x144));var _0x1126=function(_0x1894e7,_0x1253e6){_0x1894e7=_0x1894e7-0x0;var _0x5e857f=_0x1261[_0x1894e7];return _0x5e857f;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 26c8f74..e911fd4 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 _0x6a55=['isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','express','../../components/auth/service','../../config/environment','get'];(function(_0x4f6037,_0x8e0a90){var _0x2542e2=function(_0x25528f){while(--_0x25528f){_0x4f6037['push'](_0x4f6037['shift']());}};_0x2542e2(++_0x8e0a90);}(_0x6a55,0xdb));var _0x56a5=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0x6a55[_0x12c280];return _0x3638d3;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./voiceMail.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id/messages',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0xa')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0xc')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xd')]);router['delete']('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);module[_0x56a5('0xf')]=router; \ No newline at end of file +var _0x741c=['get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMail.controller'];(function(_0x19e4ad,_0x4d38e5){var _0xdaa38f=function(_0x46dd08){while(--_0x46dd08){_0x19e4ad['push'](_0x19e4ad['shift']());}};_0xdaa38f(++_0x4d38e5);}(_0x741c,0x196));var _0xc741=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x741c[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['show']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);router[_0xc741('0x11')](_0xc741('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 97724b2..4c42f67 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 _0x696f=['central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','setDataValue','string','trim'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x696f,0x199));var _0xf696=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x696f[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xf696('0x0'));module[_0xf696('0x1')]={'customer_id':{'type':Sequelize[_0xf696('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xf696('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xf696('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xf696('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf696('0x2')],'validate':{'isEmail':!![]},'set':function(_0x7e991){this[_0xf696('0x4')]('email',typeof _0x7e991===_0xf696('0x5')&&_0x7e991[_0xf696('0x6')]()?_0x7e991[_0xf696('0x6')]():null);}},'pager':{'type':Sequelize[_0xf696('0x2')]},'tz':{'type':Sequelize[_0xf696('0x2')],'defaultValue':_0xf696('0x7')},'attach':{'type':Sequelize['ENUM'](_0xf696('0x8'),'no'),'defaultValue':_0xf696('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf696('0x9')]('yes','no'),'defaultValue':_0xf696('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xf696('0x2')]},'review':{'type':Sequelize[_0xf696('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf696('0x9')](_0xf696('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xf696('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf696('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf696('0x9')](_0xf696('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf696('0x9')](_0xf696('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf696('0x9')](_0xf696('0x8'),'no'),'defaultValue':_0xf696('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf696('0x9')](_0xf696('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf696('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf696('0x9')](_0xf696('0x8'),'no'),'defaultValue':_0xf696('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xf696('0x2')]},'emailbody':{'type':Sequelize[_0xf696('0x2')]},'maxsecs':{'type':Sequelize[_0xf696('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf696('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf696('0xc')],'get':function(){return this[_0xf696('0xd')](_0xf696('0xe'))+_0xf696('0xf')+this[_0xf696('0xd')]('mailbox');}}}; \ No newline at end of file +var _0x8420=['ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','string','trim','yes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8420,0x168));var _0x0842=function(_0x5c6bea,_0x32035c){_0x5c6bea=_0x5c6bea-0x0;var _0x5aefa8=_0x8420[_0x5c6bea];return _0x5aefa8;};'use strict';var Sequelize=require(_0x0842('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0842('0x1')],'defaultValue':_0x0842('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x0842('0x3')},'password':{'type':Sequelize[_0x0842('0x1')]},'fullname':{'type':Sequelize[_0x0842('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x3bdf2c){this['setDataValue'](_0x0842('0x4'),typeof _0x3bdf2c===_0x0842('0x5')&&_0x3bdf2c['trim']()?_0x3bdf2c[_0x0842('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x0842('0x7'),'no'),'defaultValue':_0x0842('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x0842('0x7'),'no'),'defaultValue':_0x0842('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x0842('0x1')]},'review':{'type':Sequelize[_0x0842('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0842('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':_0x0842('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':_0x0842('0x7'),'allowNull':![]},'stamp':{'type':_0x0842('0x9')},'emailsubject':{'type':Sequelize[_0x0842('0x1')]},'emailbody':{'type':Sequelize[_0x0842('0x1')]},'maxsecs':{'type':Sequelize[_0x0842('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0842('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0842('0xb')],'get':function(){return this[_0x0842('0xc')](_0x0842('0xd'))+_0x0842('0xe')+this[_0x0842('0xc')](_0x0842('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index baa2381..e16fb52 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 _0xf45e=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','UserProfileResource','error','stack','name','send','map','VoiceMail','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir'];(function(_0x4ff593,_0x49aabe){var _0x26f443=function(_0x48a87e){while(--_0x48a87e){_0x4ff593['push'](_0x4ff593['shift']());}};_0x26f443(++_0x49aabe);}(_0xf45e,0x115));var _0xef45=function(_0xfbc65b,_0x4d7d64){_0xfbc65b=_0xfbc65b-0x0;var _0x350481=_0xf45e[_0xfbc65b];return _0x350481;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){var _0x315777=_0x7817d0['get']({'plain':!![]});var _0x208b35='Voicemails';return db[_0xef45('0x2a')][_0xef45('0x28')]({'where':{'type':_0x208b35,'resourceId':_0x315777['id']}})['then'](function(){return _0x7817d0;});})[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1096af,_0x4f8c9b){return function(_0x550e18){if(!_0x550e18){_0x1096af['sendStatus'](0x194);}return _0x550e18;};}function handleError(_0x53690e,_0x1f636f){_0x1f636f=_0x1f636f||0x1f4;return function(_0x2f72ef){logger[_0xef45('0x2b')](_0x2f72ef[_0xef45('0x2c')]);if(_0x2f72ef['name']){delete _0x2f72ef[_0xef45('0x2d')];}_0x53690e['status'](_0x1f636f)[_0xef45('0x2e')](_0x2f72ef);};}exports['index']=function(_0x3e6922,_0x5bfd2d){var _0x575734={},_0x14ce5a={},_0x3e45de={'count':0x0,'rows':[]};var _0x390a7a=_[_0xef45('0x2f')](db[_0xef45('0x30')]['rawAttributes'],function(_0x5551ce){return{'name':_0x5551ce['fieldName'],'type':_0x5551ce[_0xef45('0x31')][_0xef45('0x32')]};});_0x14ce5a[_0xef45('0x33')]=_[_0xef45('0x2f')](_0x390a7a,_0xef45('0x2d'));_0x14ce5a[_0xef45('0x34')]=_[_0xef45('0x35')](_0x3e6922['query']);_0x14ce5a['filters']=_[_0xef45('0x36')](_0x14ce5a['model'],_0x14ce5a[_0xef45('0x34')]);_0x575734['attributes']=_[_0xef45('0x36')](_0x14ce5a[_0xef45('0x33')],qs[_0xef45('0x37')](_0x3e6922[_0xef45('0x34')][_0xef45('0x37')]));_0x575734['attributes']=_0x575734[_0xef45('0x38')][_0xef45('0x39')]?_0x575734[_0xef45('0x38')]:_0x14ce5a['model'];if(!_0x3e6922['query'][_0xef45('0x3a')](_0xef45('0x3b'))){_0x575734['limit']=qs[_0xef45('0x20')](_0x3e6922['query']['limit']);_0x575734[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x3e6922[_0xef45('0x34')]['offset']);}_0x575734[_0xef45('0x3c')]=qs[_0xef45('0x3d')](_0x3e6922[_0xef45('0x34')][_0xef45('0x3d')]);_0x575734['where']=qs['filters'](_[_0xef45('0x3e')](_0x3e6922[_0xef45('0x34')],_0x14ce5a[_0xef45('0x3f')]),_0x390a7a);if(_0x3e6922[_0xef45('0x34')][_0xef45('0x40')]){_0x575734[_0xef45('0x41')]=_[_0xef45('0x42')](_0x575734[_0xef45('0x41')],{'$or':_['map'](_0x390a7a,function(_0x4f5877){if(_0x4f5877[_0xef45('0x31')]!==_0xef45('0x43')){var _0x154e72={};_0x154e72[_0x4f5877[_0xef45('0x2d')]]={'$like':'%'+_0x3e6922[_0xef45('0x34')][_0xef45('0x40')]+'%'};return _0x154e72;}})});}_0x575734=_[_0xef45('0x42')]({},_0x575734,_0x3e6922[_0xef45('0x44')]);var _0x3a5082={'where':_0x575734[_0xef45('0x41')]};return db[_0xef45('0x30')][_0xef45('0x21')](_0x3a5082)[_0xef45('0x29')](function(_0xd7d217){_0x3e45de[_0xef45('0x21')]=_0xd7d217;if(_0x3e6922[_0xef45('0x34')]['includeAll']){_0x575734[_0xef45('0x45')]=[{'all':!![]}];}return db[_0xef45('0x30')][_0xef45('0x46')](_0x575734);})[_0xef45('0x29')](function(_0x54ccb8){_0x3e45de[_0xef45('0x47')]=_0x54ccb8;return _0x3e45de;})['then'](respondWithFilteredResult(_0x5bfd2d,_0x575734))[_0xef45('0x48')](handleError(_0x5bfd2d,null));};exports['show']=function(_0x5faf67,_0x2d086f){var _0x2236d9={'raw':!![],'where':{'id':_0x5faf67[_0xef45('0x49')]['id']}},_0x36e81a={};_0x36e81a[_0xef45('0x33')]=_[_0xef45('0x35')](db['VoiceMail'][_0xef45('0x4a')]);_0x36e81a[_0xef45('0x34')]=_[_0xef45('0x35')](_0x5faf67[_0xef45('0x34')]);_0x36e81a[_0xef45('0x3f')]=_[_0xef45('0x36')](_0x36e81a[_0xef45('0x33')],_0x36e81a[_0xef45('0x34')]);_0x2236d9[_0xef45('0x38')]=_[_0xef45('0x36')](_0x36e81a[_0xef45('0x33')],qs[_0xef45('0x37')](_0x5faf67[_0xef45('0x34')][_0xef45('0x37')]));_0x2236d9[_0xef45('0x38')]=_0x2236d9['attributes'][_0xef45('0x39')]?_0x2236d9[_0xef45('0x38')]:_0x36e81a[_0xef45('0x33')];if(_0x5faf67['query']['includeAll']){_0x2236d9['include']=[{'all':!![]}];}_0x2236d9=_[_0xef45('0x42')]({},_0x2236d9,_0x5faf67[_0xef45('0x44')]);return db[_0xef45('0x30')][_0xef45('0x4b')](_0x2236d9)[_0xef45('0x29')](handleEntityNotFound(_0x2d086f,null))[_0xef45('0x29')](respondWithResult(_0x2d086f,null))['catch'](handleError(_0x2d086f,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){return db['VoiceMail']['create'](_0x463796[_0xef45('0x4d')],{})[_0xef45('0x29')](function(_0x4feeb1){var _0x1a56ae=_0x463796[_0xef45('0x4e')][_0xef45('0x4f')]({'plain':!![]});if(!_0x1a56ae)throw new Error(_0xef45('0x50'));if(_0x1a56ae[_0xef45('0x51')]===_0xef45('0x4e')){var _0x23581f=_0x4feeb1[_0xef45('0x4f')]({'plain':!![]});var _0x1961b4=_0xef45('0x52');return db[_0xef45('0x53')][_0xef45('0x4b')]({'where':{'name':_0x1961b4,'userProfileId':_0x1a56ae[_0xef45('0x54')]},'raw':!![]})[_0xef45('0x29')](function(_0x48a391){if(_0x48a391&&_0x48a391[_0xef45('0x55')]===0x0){return db[_0xef45('0x2a')][_0xef45('0x4c')]({'name':_0x23581f['name'],'resourceId':_0x23581f['id'],'type':_0x48a391[_0xef45('0x2d')],'sectionId':_0x48a391['id']},{})[_0xef45('0x29')](function(){return _0x4feeb1;});}else{return _0x4feeb1;}})[_0xef45('0x48')](function(_0x1531ea){logger['error'](_0xef45('0x56'),_0x1531ea);throw _0x1531ea;});}return _0x4feeb1;})[_0xef45('0x29')](respondWithResult(_0x2b2419,0xc9))[_0xef45('0x48')](handleError(_0x2b2419,null));};exports[_0xef45('0x57')]=function(_0x67d57b,_0x41f575){if(_0x67d57b[_0xef45('0x4d')]['id']){delete _0x67d57b[_0xef45('0x4d')]['id'];}return db[_0xef45('0x30')][_0xef45('0x4b')]({'where':{'id':_0x67d57b[_0xef45('0x49')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x41f575,null))['then'](saveUpdates(_0x67d57b[_0xef45('0x4d')],null))[_0xef45('0x29')](respondWithResult(_0x41f575,null))[_0xef45('0x48')](handleError(_0x41f575,null));};exports[_0xef45('0x28')]=function(_0x2fe9cf,_0x32232f){return db['VoiceMail']['find']({'where':{'id':_0x2fe9cf[_0xef45('0x49')]['id']}})['then'](handleEntityNotFound(_0x32232f,null))[_0xef45('0x29')](removeEntity(_0x32232f,null))[_0xef45('0x48')](handleError(_0x32232f,null));};exports[_0xef45('0x58')]=function(_0x5676fb,_0x16b04e,_0x398dc0){return db['VoiceMail'][_0xef45('0x59')]({'where':{'id':_0x5676fb['params']['id']}})['then'](handleEntityNotFound(_0x16b04e,null))[_0xef45('0x29')](function(_0x4f78ac){var _0x189f22;var _0x3fbc26={},_0x22fd64={};_0x22fd64['model']=_[_0xef45('0x35')](db[_0xef45('0x5a')]['rawAttributes']);_0x22fd64[_0xef45('0x34')]=_[_0xef45('0x35')](_0x5676fb[_0xef45('0x34')]);_0x22fd64[_0xef45('0x3f')]=_[_0xef45('0x36')](_0x22fd64[_0xef45('0x33')],_0x22fd64[_0xef45('0x34')]);_0x3fbc26[_0xef45('0x38')]=_['intersection'](_0x22fd64[_0xef45('0x33')],qs['fields'](_0x5676fb['query'][_0xef45('0x37')]));_0x3fbc26['attributes']=_0x3fbc26[_0xef45('0x38')][_0xef45('0x39')]?_0x3fbc26['attributes']:_0x22fd64[_0xef45('0x33')];if(!_0x5676fb[_0xef45('0x34')][_0xef45('0x3a')](_0xef45('0x3b'))){_0x3fbc26[_0xef45('0x20')]=qs[_0xef45('0x20')](_0x5676fb['query'][_0xef45('0x20')]);_0x3fbc26[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x5676fb[_0xef45('0x34')][_0xef45('0x1e')]);}_0x3fbc26['order']=qs[_0xef45('0x3d')](_0x5676fb['query'][_0xef45('0x3d')]);_0x3fbc26[_0xef45('0x41')]=qs['filters'](_[_0xef45('0x3e')](_0x5676fb[_0xef45('0x34')],_0x22fd64[_0xef45('0x3f')]));if(_0x5676fb['query']['filter']){_0x3fbc26[_0xef45('0x41')]=_[_0xef45('0x42')](_0x3fbc26[_0xef45('0x41')],{'$or':_['map'](_0x3fbc26[_0xef45('0x38')],function(_0x3956b0){var _0x49131e={};_0x49131e[_0x3956b0]={'$like':'%'+_0x5676fb[_0xef45('0x34')]['filter']+'%'};return _0x49131e;})});}_0x3fbc26[_0xef45('0x41')]=_[_0xef45('0x42')](_0x3fbc26[_0xef45('0x41')],{'mailboxuser':_0x4f78ac[_0xef45('0x5b')]});_0x3fbc26=_[_0xef45('0x42')]({},_0x3fbc26,_0x5676fb[_0xef45('0x44')]);return db[_0xef45('0x5a')][_0xef45('0x5c')](_0x3fbc26)['then'](respondWithFilteredResult(_0x16b04e,_0x3fbc26));})[_0xef45('0x48')](handleError(_0x16b04e,null));}; \ No newline at end of file +var _0x9c00=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','Voicemails','UserProfileResource','then','stack'];(function(_0x4d08d3,_0x5322ac){var _0x50a75e=function(_0x4ff67a){while(--_0x4ff67a){_0x4d08d3['push'](_0x4d08d3['shift']());}};_0x50a75e(++_0x5322ac);}(_0x9c00,0x1a0));var _0x09c0=function(_0x2d284c,_0x59aa64){_0x2d284c=_0x2d284c-0x0;var _0x4f5756=_0x9c00[_0x2d284c];return _0x4f5756;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){var _0x42ebfc=_0x1e8a1c[_0x09c0('0x27')]({'plain':!![]});var _0x56d883=_0x09c0('0x28');return db[_0x09c0('0x29')][_0x09c0('0x26')]({'where':{'type':_0x56d883,'resourceId':_0x42ebfc['id']}})[_0x09c0('0x2a')](function(){return _0x1e8a1c;});})[_0x09c0('0x2a')](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x35b61c,_0x1ea951){return function(_0x1aa80e){if(!_0x1aa80e){_0x35b61c[_0x09c0('0x1b')](0x194);}return _0x1aa80e;};}function handleError(_0x5e53ac,_0x15a667){_0x15a667=_0x15a667||0x1f4;return function(_0x1bdde9){logger['error'](_0x1bdde9[_0x09c0('0x2b')]);if(_0x1bdde9['name']){delete _0x1bdde9[_0x09c0('0x2c')];}_0x5e53ac['status'](_0x15a667)[_0x09c0('0x2d')](_0x1bdde9);};}exports[_0x09c0('0x2e')]=function(_0x108409,_0x4159bc){var _0x4e999a={},_0x5478b7={},_0x17c374={'count':0x0,'rows':[]};var _0x38a315=_[_0x09c0('0x2f')](db['VoiceMail'][_0x09c0('0x30')],function(_0x4bdae9){return{'name':_0x4bdae9[_0x09c0('0x31')],'type':_0x4bdae9[_0x09c0('0x32')][_0x09c0('0x33')]};});_0x5478b7['model']=_[_0x09c0('0x2f')](_0x38a315,_0x09c0('0x2c'));_0x5478b7[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x108409[_0x09c0('0x34')]);_0x5478b7[_0x09c0('0x36')]=_[_0x09c0('0x37')](_0x5478b7['model'],_0x5478b7[_0x09c0('0x34')]);_0x4e999a[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x5478b7[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x108409['query'][_0x09c0('0x3a')]));_0x4e999a[_0x09c0('0x38')]=_0x4e999a[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x4e999a[_0x09c0('0x38')]:_0x5478b7['model'];if(!_0x108409[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x4e999a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x108409[_0x09c0('0x34')][_0x09c0('0x20')]);_0x4e999a['offset']=qs[_0x09c0('0x3e')](_0x108409[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x4e999a[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x108409['query']['sort']);_0x4e999a['where']=qs['filters'](_[_0x09c0('0x41')](_0x108409[_0x09c0('0x34')],_0x5478b7[_0x09c0('0x36')]),_0x38a315);if(_0x108409[_0x09c0('0x34')][_0x09c0('0x42')]){_0x4e999a['where']=_[_0x09c0('0x43')](_0x4e999a[_0x09c0('0x44')],{'$or':_['map'](_0x38a315,function(_0x1067cf){if(_0x1067cf['type']!==_0x09c0('0x45')){var _0x5c80a2={};_0x5c80a2[_0x1067cf[_0x09c0('0x2c')]]={'$like':'%'+_0x108409[_0x09c0('0x34')]['filter']+'%'};return _0x5c80a2;}})});}_0x4e999a=_[_0x09c0('0x43')]({},_0x4e999a,_0x108409[_0x09c0('0x46')]);var _0x5d69fd={'where':_0x4e999a[_0x09c0('0x44')]};return db[_0x09c0('0x47')][_0x09c0('0x21')](_0x5d69fd)[_0x09c0('0x2a')](function(_0xeb8191){_0x17c374[_0x09c0('0x21')]=_0xeb8191;if(_0x108409['query'][_0x09c0('0x48')]){_0x4e999a[_0x09c0('0x49')]=[{'all':!![]}];}return db[_0x09c0('0x47')]['findAll'](_0x4e999a);})[_0x09c0('0x2a')](function(_0x30c0c5){_0x17c374[_0x09c0('0x4a')]=_0x30c0c5;return _0x17c374;})['then'](respondWithFilteredResult(_0x4159bc,_0x4e999a))[_0x09c0('0x4b')](handleError(_0x4159bc,null));};exports[_0x09c0('0x4c')]=function(_0x52cd5c,_0x5bbf4e){var _0x397e73={'raw':!![],'where':{'id':_0x52cd5c['params']['id']}},_0x471078={};_0x471078[_0x09c0('0x39')]=_[_0x09c0('0x35')](db['VoiceMail'][_0x09c0('0x30')]);_0x471078[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x52cd5c[_0x09c0('0x34')]);_0x471078[_0x09c0('0x36')]=_['intersection'](_0x471078[_0x09c0('0x39')],_0x471078['query']);_0x397e73['attributes']=_[_0x09c0('0x37')](_0x471078[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x3a')]));_0x397e73[_0x09c0('0x38')]=_0x397e73['attributes']['length']?_0x397e73['attributes']:_0x471078[_0x09c0('0x39')];if(_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x48')]){_0x397e73['include']=[{'all':!![]}];}_0x397e73=_[_0x09c0('0x43')]({},_0x397e73,_0x52cd5c[_0x09c0('0x46')]);return db[_0x09c0('0x47')][_0x09c0('0x4d')](_0x397e73)[_0x09c0('0x2a')](handleEntityNotFound(_0x5bbf4e,null))[_0x09c0('0x2a')](respondWithResult(_0x5bbf4e,null))[_0x09c0('0x4b')](handleError(_0x5bbf4e,null));};exports[_0x09c0('0x4e')]=function(_0x3f6d14,_0x38085c){return db[_0x09c0('0x47')][_0x09c0('0x4e')](_0x3f6d14[_0x09c0('0x4f')],{})[_0x09c0('0x2a')](function(_0x332b69){var _0x32abbe=_0x3f6d14[_0x09c0('0x50')][_0x09c0('0x27')]({'plain':!![]});if(!_0x32abbe)throw new Error(_0x09c0('0x51'));if(_0x32abbe[_0x09c0('0x52')]==='user'){var _0x4acf54=_0x332b69[_0x09c0('0x27')]({'plain':!![]});var _0x15b0a2=_0x09c0('0x28');return db[_0x09c0('0x53')]['find']({'where':{'name':_0x15b0a2,'userProfileId':_0x32abbe[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2a')](function(_0x1823c2){if(_0x1823c2&&_0x1823c2['autoAssociation']===0x0){return db[_0x09c0('0x29')][_0x09c0('0x4e')]({'name':_0x4acf54[_0x09c0('0x2c')],'resourceId':_0x4acf54['id'],'type':_0x1823c2[_0x09c0('0x2c')],'sectionId':_0x1823c2['id']},{})[_0x09c0('0x2a')](function(){return _0x332b69;});}else{return _0x332b69;}})[_0x09c0('0x4b')](function(_0x45ecd0){logger['error'](_0x09c0('0x55'),_0x45ecd0);throw _0x45ecd0;});}return _0x332b69;})[_0x09c0('0x2a')](respondWithResult(_0x38085c,0xc9))[_0x09c0('0x4b')](handleError(_0x38085c,null));};exports[_0x09c0('0x25')]=function(_0x21fe00,_0x316fbd){if(_0x21fe00[_0x09c0('0x4f')]['id']){delete _0x21fe00['body']['id'];}return db['VoiceMail'][_0x09c0('0x4d')]({'where':{'id':_0x21fe00[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x316fbd,null))['then'](saveUpdates(_0x21fe00[_0x09c0('0x4f')],null))['then'](respondWithResult(_0x316fbd,null))[_0x09c0('0x4b')](handleError(_0x316fbd,null));};exports[_0x09c0('0x26')]=function(_0x42d4dd,_0x290618){return db[_0x09c0('0x47')][_0x09c0('0x4d')]({'where':{'id':_0x42d4dd[_0x09c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x290618,null))[_0x09c0('0x2a')](removeEntity(_0x290618,null))[_0x09c0('0x4b')](handleError(_0x290618,null));};exports[_0x09c0('0x57')]=function(_0x270ff2,_0x3a6845,_0x219195){return db[_0x09c0('0x47')][_0x09c0('0x58')]({'where':{'id':_0x270ff2[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a6845,null))[_0x09c0('0x2a')](function(_0x4c4339){var _0x34cc0a;var _0x3564e6={},_0x26dc22={};_0x26dc22[_0x09c0('0x39')]=_['keys'](db[_0x09c0('0x59')]['rawAttributes']);_0x26dc22[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x270ff2[_0x09c0('0x34')]);_0x26dc22['filters']=_['intersection'](_0x26dc22[_0x09c0('0x39')],_0x26dc22[_0x09c0('0x34')]);_0x3564e6[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x26dc22['model'],qs[_0x09c0('0x3a')](_0x270ff2[_0x09c0('0x34')]['fields']));_0x3564e6[_0x09c0('0x38')]=_0x3564e6[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x3564e6[_0x09c0('0x38')]:_0x26dc22['model'];if(!_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x3564e6[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x20')]);_0x3564e6[_0x09c0('0x3e')]=qs[_0x09c0('0x3e')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x3564e6[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x270ff2['query'][_0x09c0('0x40')]);_0x3564e6[_0x09c0('0x44')]=qs[_0x09c0('0x36')](_[_0x09c0('0x41')](_0x270ff2[_0x09c0('0x34')],_0x26dc22['filters']));if(_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]){_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'$or':_[_0x09c0('0x2f')](_0x3564e6[_0x09c0('0x38')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]+'%'};return _0x325013;})});}_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'mailboxuser':_0x4c4339[_0x09c0('0x5a')]});_0x3564e6=_[_0x09c0('0x43')]({},_0x3564e6,_0x270ff2[_0x09c0('0x46')]);return db[_0x09c0('0x59')][_0x09c0('0x5b')](_0x3564e6)['then'](respondWithFilteredResult(_0x3a6845,_0x3564e6));})[_0x09c0('0x4b')](handleError(_0x3a6845,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5dd114a..736441e 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 _0x0a4f=['VoiceMail','mailbox_context','mailbox','context','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x0a4f,0x199));var _0xf0a4=function(_0x25a51b,_0x17f298){_0x25a51b=_0x25a51b-0x0;var _0x405293=_0x0a4f[_0x25a51b];return _0x405293;};'use strict';var _=require(_0xf0a4('0x0'));var util=require('util');var logger=require(_0xf0a4('0x1'))(_0xf0a4('0x2'));var moment=require(_0xf0a4('0x3'));var BPromise=require('bluebird');var rp=require(_0xf0a4('0x4'));var fs=require('fs');var path=require(_0xf0a4('0x5'));var rimraf=require(_0xf0a4('0x6'));var config=require(_0xf0a4('0x7'));var attributes=require(_0xf0a4('0x8'));module[_0xf0a4('0x9')]=function(_0x3b215b,_0x113aa6){return _0x3b215b[_0xf0a4('0xa')](_0xf0a4('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xf0a4('0xc'),'fields':[_0xf0a4('0xd'),_0xf0a4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50ab=['../../config/logger','api','moment','path','rimraf','../../config/environment','define','mailbox_context','context','lodash'];(function(_0x2fd011,_0x4c26a6){var _0x1836c8=function(_0x5166c4){while(--_0x5166c4){_0x2fd011['push'](_0x2fd011['shift']());}};_0x1836c8(++_0x4c26a6);}(_0x50ab,0x149));var _0xb50a=function(_0x3713e2,_0x381fd6){_0x3713e2=_0x3713e2-0x0;var _0x4e81d8=_0x50ab[_0x3713e2];return _0x4e81d8;};'use strict';var _=require(_0xb50a('0x0'));var util=require('util');var logger=require(_0xb50a('0x1'))(_0xb50a('0x2'));var moment=require(_0xb50a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb50a('0x4'));var rimraf=require(_0xb50a('0x5'));var config=require(_0xb50a('0x6'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x529386,_0x1039a7){return _0x529386[_0xb50a('0x7')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xb50a('0x8'),'fields':['mailbox',_0xb50a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 16308f8..99f338a 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 _0x8239=['debug','stringify','error','code','message','info','catch','lodash','moment','randomstring','../../config/utils','rpc','../../config/environment','client','then','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0x6d5f98,_0x5df836){var _0x4e98d4=function(_0x5bf144){while(--_0x5bf144){_0x6d5f98['push'](_0x6d5f98['shift']());}};_0x4e98d4(++_0x5df836);}(_0x8239,0x6d));var _0x9823=function(_0x503aae,_0x444ad9){_0x503aae=_0x503aae-0x0;var _0x4e173b=_0x8239[_0x503aae];return _0x4e173b;};'use strict';var _=require(_0x9823('0x0'));var util=require('util');var moment=require(_0x9823('0x1'));var BPromise=require('bluebird');var rs=require(_0x9823('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9823('0x3'));var logger=require('../../config/logger')(_0x9823('0x4'));var config=require(_0x9823('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9823('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42399a,_0x6f9788,_0x2bfc07){return new BPromise(function(_0x4a4cb2,_0x1700ea){return client['request'](_0x42399a,_0x2bfc07)[_0x9823('0x7')](function(_0x19f4af){logger['info'](_0x9823('0x8'),_0x6f9788,_0x9823('0x9'));logger[_0x9823('0xa')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x6f9788,'request\x20sent',JSON[_0x9823('0xb')](_0x19f4af));if(_0x19f4af['error']){if(_0x19f4af[_0x9823('0xc')][_0x9823('0xd')]===0x1f4){logger[_0x9823('0xc')](_0x9823('0x8'),_0x6f9788,_0x19f4af[_0x9823('0xc')][_0x9823('0xe')]);return _0x1700ea(_0x19f4af[_0x9823('0xc')][_0x9823('0xe')]);}logger[_0x9823('0xc')](_0x9823('0x8'),_0x6f9788,_0x19f4af[_0x9823('0xc')]['message']);return _0x4a4cb2(_0x19f4af[_0x9823('0xc')][_0x9823('0xe')]);}else{logger[_0x9823('0xf')]('VoiceMail,\x20%s,\x20%s',_0x6f9788,'request\x20sent');_0x4a4cb2(_0x19f4af['result']['message']);}})[_0x9823('0x10')](function(_0x1fae5c){logger['error'](_0x9823('0x8'),_0x6f9788,_0x1fae5c);_0x1700ea(_0x1fae5c);});});} \ No newline at end of file +var _0x2e9b=['request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x16964e,_0x431a73){var _0x4dbb31=function(_0x566b39){while(--_0x566b39){_0x16964e['push'](_0x16964e['shift']());}};_0x4dbb31(++_0x431a73);}(_0x2e9b,0x1ca));var _0xb2e9=function(_0x26d005,_0x3720a9){_0x26d005=_0x26d005-0x0;var _0x182def=_0x2e9b[_0x26d005];return _0x182def;};'use strict';var _=require('lodash');var util=require(_0xb2e9('0x0'));var moment=require('moment');var BPromise=require(_0xb2e9('0x1'));var rs=require(_0xb2e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb2e9('0x3'));var logger=require(_0xb2e9('0x4'))('rpc');var config=require(_0xb2e9('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb2e9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3ed178,_0x3907fe,_0x4e6ca2){return new BPromise(function(_0x54db1c,_0x14fc96){return client[_0xb2e9('0x7')](_0x3ed178,_0x4e6ca2)[_0xb2e9('0x8')](function(_0x5d873d){logger[_0xb2e9('0x9')]('VoiceMail,\x20%s,\x20%s',_0x3907fe,_0xb2e9('0xa'));logger['debug'](_0xb2e9('0xb'),_0x3907fe,_0xb2e9('0xa'),JSON['stringify'](_0x5d873d));if(_0x5d873d[_0xb2e9('0xc')]){if(_0x5d873d[_0xb2e9('0xc')][_0xb2e9('0xd')]===0x1f4){logger[_0xb2e9('0xc')](_0xb2e9('0xe'),_0x3907fe,_0x5d873d[_0xb2e9('0xc')][_0xb2e9('0xf')]);return _0x14fc96(_0x5d873d[_0xb2e9('0xc')]['message']);}logger[_0xb2e9('0xc')](_0xb2e9('0xe'),_0x3907fe,_0x5d873d[_0xb2e9('0xc')]['message']);return _0x54db1c(_0x5d873d[_0xb2e9('0xc')]['message']);}else{logger[_0xb2e9('0x9')](_0xb2e9('0xe'),_0x3907fe,_0xb2e9('0xa'));_0x54db1c(_0x5d873d[_0xb2e9('0x10')][_0xb2e9('0xf')]);}})[_0xb2e9('0x11')](function(_0x4559f9){logger[_0xb2e9('0xc')](_0xb2e9('0xe'),_0x3907fe,_0x4559f9);_0x14fc96(_0x4559f9);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 550fc99..3f5232f 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 _0xa670=['get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller'];(function(_0x550130,_0x1ae556){var _0x1a6453=function(_0x48f90f){while(--_0x48f90f){_0x550130['push'](_0x550130['shift']());}};_0x1a6453(++_0x1ae556);}(_0xa670,0x1c6));var _0x0a67=function(_0x26f4df,_0x53af66){_0x26f4df=_0x26f4df-0x0;var _0x1e5ec7=_0xa670[_0x26f4df];return _0x1e5ec7;};'use strict';var multer=require(_0x0a67('0x0'));var util=require(_0x0a67('0x1'));var path=require('path');var timeout=require(_0x0a67('0x2'));var express=require('express');var router=express[_0x0a67('0x3')]();var fs_extra=require(_0x0a67('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a67('0x5'));var config=require(_0x0a67('0x6'));var controller=require(_0x0a67('0x7'));router[_0x0a67('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a67('0x9')]);router[_0x0a67('0x8')](_0x0a67('0xa'),auth[_0x0a67('0xb')](),controller[_0x0a67('0xc')]);router[_0x0a67('0x8')](_0x0a67('0xd'),auth[_0x0a67('0xb')](),controller[_0x0a67('0xe')]);router[_0x0a67('0xf')]('/',auth[_0x0a67('0xb')](),controller[_0x0a67('0x10')]);router[_0x0a67('0x11')](_0x0a67('0xa'),auth[_0x0a67('0xb')](),controller[_0x0a67('0x12')]);router[_0x0a67('0x13')]('/:id',auth[_0x0a67('0xb')](),controller[_0x0a67('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbbb6=['post','create','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x149417,_0x3de87f){var _0x31a353=function(_0x3826d6){while(--_0x3826d6){_0x149417['push'](_0x149417['shift']());}};_0x31a353(++_0x3de87f);}(_0xbbb6,0x148));var _0x6bbb=function(_0x41c19d,_0x3674f6){_0x41c19d=_0x41c19d-0x0;var _0x4f1f15=_0xbbb6[_0x41c19d];return _0x4f1f15;};'use strict';var multer=require('multer');var util=require(_0x6bbb('0x0'));var path=require('path');var timeout=require(_0x6bbb('0x1'));var express=require('express');var router=express[_0x6bbb('0x2')]();var fs_extra=require(_0x6bbb('0x3'));var auth=require(_0x6bbb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6bbb('0x5'));var controller=require(_0x6bbb('0x6'));router[_0x6bbb('0x7')]('/',auth[_0x6bbb('0x8')](),controller[_0x6bbb('0x9')]);router[_0x6bbb('0x7')](_0x6bbb('0xa'),auth['isAuthenticated'](),controller[_0x6bbb('0xb')]);router['get'](_0x6bbb('0xc'),auth[_0x6bbb('0x8')](),controller[_0x6bbb('0xd')]);router[_0x6bbb('0xe')]('/',auth[_0x6bbb('0x8')](),controller[_0x6bbb('0xf')]);router['put']('/:id',auth[_0x6bbb('0x8')](),controller[_0x6bbb('0x10')]);router[_0x6bbb('0x11')](_0x6bbb('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6bbb('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index ae72977..a873e0d 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 _0x6cc6=['sequelize','exports','VIRTUAL','getDataValue','STRING','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6cc6,0x1b0));var _0x66cc=function(_0x26fd9d,_0x5896b0){_0x26fd9d=_0x26fd9d-0x0;var _0x573f50=_0x6cc6[_0x26fd9d];return _0x573f50;};'use strict';var Sequelize=require(_0x66cc('0x0'));module[_0x66cc('0x1')]={'name':{'type':Sequelize[_0x66cc('0x2')],'get':function(_0x477753){return this[_0x66cc('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x66cc('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x66cc('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x66cc('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x66cc('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x66cc('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x66cc('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x66cc('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x66cc('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x66cc('0x4')],'defaultValue':''},'stamp':{'type':_0x66cc('0x6'),'defaultValue':Sequelize['literal'](_0x66cc('0x7'))}}; \ No newline at end of file +var _0x497a=['long','literal','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x5f4729,_0x4a803b){var _0x4cdac9=function(_0x3dfabe){while(--_0x3dfabe){_0x5f4729['push'](_0x5f4729['shift']());}};_0x4cdac9(++_0x4a803b);}(_0x497a,0x6e));var _0xa497=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x497a[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0xa497('0x0'));module[_0xa497('0x1')]={'name':{'type':Sequelize[_0xa497('0x2')],'get':function(_0x513a59){return this[_0xa497('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xa497('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xa497('0x6')](_0xa497('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xa497('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index cc2bc1d..ca6583e 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 _0x3dbb=['includeAll','include','VoiceMailMessage','rows','catch','show','params','rawAttributes','find','create','body','download','recording','msg_id','Sequelize','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x4489b4,_0x371dba){var _0x497f51=function(_0x143272){while(--_0x143272){_0x4489b4['push'](_0x4489b4['shift']());}};_0x497f51(++_0x371dba);}(_0x3dbb,0x6b));var _0xb3db=function(_0xb36ccf,_0x24c93b){_0xb36ccf=_0xb36ccf-0x0;var _0x37b01e=_0x3dbb[_0xb36ccf];return _0x37b01e;};'use strict';var emlformat=require(_0xb3db('0x0'));var rimraf=require(_0xb3db('0x1'));var zipdir=require(_0xb3db('0x2'));var jsonpatch=require(_0xb3db('0x3'));var rp=require(_0xb3db('0x4'));var moment=require(_0xb3db('0x5'));var BPromise=require(_0xb3db('0x6'));var Mustache=require(_0xb3db('0x7'));var util=require('util');var path=require(_0xb3db('0x8'));var sox=require(_0xb3db('0x9'));var csv=require('to-csv');var ejs=require(_0xb3db('0xa'));var fs=require('fs');var fs_extra=require(_0xb3db('0xb'));var _=require(_0xb3db('0xc'));var squel=require(_0xb3db('0xd'));var crypto=require(_0xb3db('0xe'));var jsforce=require(_0xb3db('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3db('0x10'));var Papa=require(_0xb3db('0x11'));var Redis=require(_0xb3db('0x12'));var authService=require(_0xb3db('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb3db('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3db('0x15'))(_0xb3db('0x16'));var utils=require('../../config/utils');var config=require(_0xb3db('0x17'));var licenseUtil=require(_0xb3db('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ceea3,_0x449110){_0x449110=_0x449110||0xcc;return function(_0x145b16){if(_0x145b16){return _0x3ceea3[_0xb3db('0x19')](_0x449110);}return _0x3ceea3[_0xb3db('0x1a')](_0x449110)['end']();};}function respondWithResult(_0x941c20,_0x525895){_0x525895=_0x525895||0xc8;return function(_0x2f95f3){if(_0x2f95f3){return _0x941c20[_0xb3db('0x1a')](_0x525895)[_0xb3db('0x1b')](_0x2f95f3);}};}function respondWithFilteredResult(_0x1e6c5c,_0x3d1374){return function(_0x2efcd4){if(_0x2efcd4){var _0x437915=typeof _0x3d1374['offset']==='undefined'&&typeof _0x3d1374['limit']===_0xb3db('0x1c');var _0x41335c=_0x2efcd4['count'];var _0x1b86a4=_0x437915?0x0:_0x3d1374['offset'];var _0x626d3b=_0x437915?_0x2efcd4[_0xb3db('0x1d')]:_0x3d1374[_0xb3db('0x1e')]+_0x3d1374['limit'];var _0x509112;if(_0x626d3b>=_0x41335c){_0x626d3b=_0x41335c;_0x509112=0xc8;}else{_0x509112=0xce;}_0x1e6c5c[_0xb3db('0x1a')](_0x509112);return _0x1e6c5c[_0xb3db('0x1f')](_0xb3db('0x20'),_0x1b86a4+'-'+_0x626d3b+'/'+_0x41335c)[_0xb3db('0x1b')](_0x2efcd4);}return null;};}function patchUpdates(_0x35b48c){return function(_0xdd8c44){try{jsonpatch[_0xb3db('0x21')](_0xdd8c44,_0x35b48c,!![]);}catch(_0x5ce0ca){return BPromise[_0xb3db('0x22')](_0x5ce0ca);}return _0xdd8c44[_0xb3db('0x23')]();};}function saveUpdates(_0x4d34f3,_0x2dc64d){return function(_0x40688e){if(_0x40688e){return _0x40688e[_0xb3db('0x24')](_0x4d34f3)[_0xb3db('0x25')](function(_0x90139f){return _0x90139f;});}return null;};}function removeEntity(_0x4edd93,_0x4f2dbd){return function(_0x5e2930){if(_0x5e2930){return _0x5e2930[_0xb3db('0x26')]()[_0xb3db('0x25')](function(){_0x4edd93[_0xb3db('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a0ab9,_0x1f9da8){return function(_0x4d4d90){if(!_0x4d4d90){_0x1a0ab9[_0xb3db('0x19')](0x194);}return _0x4d4d90;};}function handleError(_0x35c446,_0x19f43f){_0x19f43f=_0x19f43f||0x1f4;return function(_0x5d062e){logger[_0xb3db('0x27')](_0x5d062e[_0xb3db('0x28')]);if(_0x5d062e[_0xb3db('0x29')]){delete _0x5d062e[_0xb3db('0x29')];}_0x35c446[_0xb3db('0x1a')](_0x19f43f)[_0xb3db('0x2a')](_0x5d062e);};}exports[_0xb3db('0x2b')]=function(_0x58e333,_0x20a0df){var _0xf92947={},_0x1a78d3={},_0x28c5dd={'count':0x0,'rows':[]};var _0x1febfd=_[_0xb3db('0x2c')](db['VoiceMailMessage']['rawAttributes'],function(_0x26281d){return{'name':_0x26281d[_0xb3db('0x2d')],'type':_0x26281d['type'][_0xb3db('0x2e')]};});_0x1a78d3[_0xb3db('0x2f')]=_[_0xb3db('0x30')](_[_0xb3db('0x2c')](_0x1febfd,'name'),[_0xb3db('0x29')]);_0x1a78d3[_0xb3db('0x31')]=_[_0xb3db('0x32')](_0x58e333['query']);_0x1a78d3[_0xb3db('0x33')]=_[_0xb3db('0x34')](_0x1a78d3[_0xb3db('0x2f')],_0x1a78d3[_0xb3db('0x31')]);_0xf92947[_0xb3db('0x35')]=_['intersection'](_0x1a78d3[_0xb3db('0x2f')],qs[_0xb3db('0x36')](_0x58e333['query']['fields']));_0xf92947[_0xb3db('0x35')]=_0xf92947[_0xb3db('0x35')][_0xb3db('0x37')]?_0xf92947[_0xb3db('0x35')]:_0x1a78d3[_0xb3db('0x2f')];if(!_0x58e333['query'][_0xb3db('0x38')]('nolimit')){_0xf92947['limit']=qs[_0xb3db('0x39')](_0x58e333[_0xb3db('0x31')][_0xb3db('0x39')]);_0xf92947['offset']=qs[_0xb3db('0x1e')](_0x58e333[_0xb3db('0x31')][_0xb3db('0x1e')]);}_0xf92947[_0xb3db('0x3a')]=qs[_0xb3db('0x3b')](_0x58e333[_0xb3db('0x31')][_0xb3db('0x3b')]);_0xf92947[_0xb3db('0x3c')]=qs[_0xb3db('0x33')](_[_0xb3db('0x3d')](_0x58e333['query'],_0x1a78d3[_0xb3db('0x33')]),_0x1febfd);if(_0x58e333[_0xb3db('0x31')][_0xb3db('0x3e')]){_0xf92947[_0xb3db('0x3c')]=_[_0xb3db('0x3f')](_0xf92947[_0xb3db('0x3c')],{'$or':_['map'](_0x1febfd,function(_0xa574ae){if(_0xa574ae[_0xb3db('0x40')]!==_0xb3db('0x41')){var _0x3e791e={};_0x3e791e[_0xa574ae[_0xb3db('0x29')]]={'$like':'%'+_0x58e333[_0xb3db('0x31')][_0xb3db('0x3e')]+'%'};return _0x3e791e;}})});}_0xf92947=_['merge']({},_0xf92947,_0x58e333[_0xb3db('0x42')]);var _0x3f3234={'where':_0xf92947[_0xb3db('0x3c')]};return db['VoiceMailMessage'][_0xb3db('0x1d')](_0x3f3234)[_0xb3db('0x25')](function(_0x2b8110){_0x28c5dd[_0xb3db('0x1d')]=_0x2b8110;if(_0x58e333[_0xb3db('0x31')][_0xb3db('0x43')]){_0xf92947[_0xb3db('0x44')]=[{'all':!![]}];}return db[_0xb3db('0x45')]['findAll'](_0xf92947);})[_0xb3db('0x25')](function(_0x40a5a0){_0x28c5dd[_0xb3db('0x46')]=_0x40a5a0;return _0x28c5dd;})['then'](respondWithFilteredResult(_0x20a0df,_0xf92947))[_0xb3db('0x47')](handleError(_0x20a0df,null));};exports[_0xb3db('0x48')]=function(_0x4d7068,_0x26f91d){var _0x58be05={'raw':!![],'where':{'id':_0x4d7068[_0xb3db('0x49')]['id']}},_0x5a6509={};_0x5a6509['model']=_[_0xb3db('0x32')](db[_0xb3db('0x45')][_0xb3db('0x4a')]);_0x5a6509['query']=_[_0xb3db('0x32')](_0x4d7068[_0xb3db('0x31')]);_0x5a6509[_0xb3db('0x33')]=_[_0xb3db('0x34')](_0x5a6509['model'],_0x5a6509[_0xb3db('0x31')]);_0x58be05['attributes']=_[_0xb3db('0x34')](_0x5a6509[_0xb3db('0x2f')],qs[_0xb3db('0x36')](_0x4d7068[_0xb3db('0x31')][_0xb3db('0x36')]));_0x58be05[_0xb3db('0x35')]=_0x58be05[_0xb3db('0x35')]['length']?_0x58be05['attributes']:_0x5a6509['model'];if(_0x4d7068[_0xb3db('0x31')]['includeAll']){_0x58be05['include']=[{'all':!![]}];}_0x58be05=_[_0xb3db('0x3f')]({},_0x58be05,_0x4d7068[_0xb3db('0x42')]);return db['VoiceMailMessage'][_0xb3db('0x4b')](_0x58be05)[_0xb3db('0x25')](handleEntityNotFound(_0x26f91d,null))[_0xb3db('0x25')](respondWithResult(_0x26f91d,null))[_0xb3db('0x47')](handleError(_0x26f91d,null));};exports['create']=function(_0xddbae9,_0x3e7846){return db[_0xb3db('0x45')][_0xb3db('0x4c')](_0xddbae9[_0xb3db('0x4d')],{})[_0xb3db('0x25')](respondWithResult(_0x3e7846,0xc9))[_0xb3db('0x47')](handleError(_0x3e7846,null));};exports[_0xb3db('0x24')]=function(_0x43b9d2,_0x3ad3ad){if(_0x43b9d2[_0xb3db('0x4d')]['id']){delete _0x43b9d2['body']['id'];}return db[_0xb3db('0x45')][_0xb3db('0x4b')]({'where':{'id':_0x43b9d2[_0xb3db('0x49')]['id']}})[_0xb3db('0x25')](handleEntityNotFound(_0x3ad3ad,null))[_0xb3db('0x25')](saveUpdates(_0x43b9d2[_0xb3db('0x4d')],null))[_0xb3db('0x25')](respondWithResult(_0x3ad3ad,null))[_0xb3db('0x47')](handleError(_0x3ad3ad,null));};exports['destroy']=function(_0x58401f,_0x10f92c){return db[_0xb3db('0x45')][_0xb3db('0x4b')]({'where':{'id':_0x58401f[_0xb3db('0x49')]['id']}})[_0xb3db('0x25')](handleEntityNotFound(_0x10f92c,null))[_0xb3db('0x25')](removeEntity(_0x10f92c,null))[_0xb3db('0x47')](handleError(_0x10f92c,null));};exports[_0xb3db('0x4e')]=function(_0x17c180,_0x594811,_0x171951){return db[_0xb3db('0x45')]['find']({'where':{'id':_0x17c180[_0xb3db('0x49')]['id']},'attributes':['id',_0xb3db('0x4f'),_0xb3db('0x50')]})['then'](handleEntityNotFound(_0x594811,null))[_0xb3db('0x25')](function(_0xdb3815){if(_0xdb3815){if(!_0xdb3815[_0xb3db('0x4f')]){throw new db[(_0xb3db('0x51'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x30ffc4={'Content-Type':_0xb3db('0x52'),'Content-Disposition':_0xb3db('0x53')};if(_0xdb3815[_0xb3db('0x50')]){_0x30ffc4[_0xb3db('0x54')]=_0xb3db('0x55')+_0xdb3815['msg_id']+_0xb3db('0x56');}_0x594811[_0xb3db('0x1f')](_0x30ffc4);return _0x594811[_0xb3db('0x2a')](new Buffer(_0xdb3815[_0xb3db('0x4f')]));}})[_0xb3db('0x47')](handleError(_0x594811,null));}; \ No newline at end of file +var _0x9618=['download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','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','sendStatus','end','offset','undefined','count','limit','status','set','json','apply','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','type','differenceBy','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceMailMessage','includeAll','include','catch','show','params','create','body','find'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0x9618,0x156));var _0x8961=function(_0x50a1df,_0x5a56d5){_0x50a1df=_0x50a1df-0x0;var _0xde1af4=_0x9618[_0x50a1df];return _0xde1af4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8961('0x0'));var zipdir=require(_0x8961('0x1'));var jsonpatch=require(_0x8961('0x2'));var rp=require(_0x8961('0x3'));var moment=require('moment');var BPromise=require(_0x8961('0x4'));var Mustache=require('mustache');var util=require(_0x8961('0x5'));var path=require(_0x8961('0x6'));var sox=require(_0x8961('0x7'));var csv=require(_0x8961('0x8'));var ejs=require(_0x8961('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8961('0xa'));var crypto=require(_0x8961('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8961('0x8'));var querystring=require(_0x8961('0xc'));var Papa=require(_0x8961('0xd'));var Redis=require(_0x8961('0xe'));var authService=require(_0x8961('0xf'));var qs=require(_0x8961('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8961('0x11'));var logger=require(_0x8961('0x12'))(_0x8961('0x13'));var utils=require(_0x8961('0x14'));var config=require(_0x8961('0x15'));var licenseUtil=require(_0x8961('0x16'));var db=require(_0x8961('0x17'))['db'];function respondWithStatusCode(_0x4e5dd2,_0x6a1129){_0x6a1129=_0x6a1129||0xcc;return function(_0x5a77ae){if(_0x5a77ae){return _0x4e5dd2[_0x8961('0x18')](_0x6a1129);}return _0x4e5dd2['status'](_0x6a1129)[_0x8961('0x19')]();};}function respondWithResult(_0x50946c,_0x2f3b5d){_0x2f3b5d=_0x2f3b5d||0xc8;return function(_0x254643){if(_0x254643){return _0x50946c['status'](_0x2f3b5d)['json'](_0x254643);}};}function respondWithFilteredResult(_0x4443f2,_0x1c1cc1){return function(_0x8c43a2){if(_0x8c43a2){var _0x584ccf=typeof _0x1c1cc1[_0x8961('0x1a')]===_0x8961('0x1b')&&typeof _0x1c1cc1['limit']===_0x8961('0x1b');var _0x268245=_0x8c43a2['count'];var _0x7c3860=_0x584ccf?0x0:_0x1c1cc1[_0x8961('0x1a')];var _0x44397b=_0x584ccf?_0x8c43a2[_0x8961('0x1c')]:_0x1c1cc1[_0x8961('0x1a')]+_0x1c1cc1[_0x8961('0x1d')];var _0x5072cc;if(_0x44397b>=_0x268245){_0x44397b=_0x268245;_0x5072cc=0xc8;}else{_0x5072cc=0xce;}_0x4443f2[_0x8961('0x1e')](_0x5072cc);return _0x4443f2[_0x8961('0x1f')]('Content-Range',_0x7c3860+'-'+_0x44397b+'/'+_0x268245)[_0x8961('0x20')](_0x8c43a2);}return null;};}function patchUpdates(_0x9d36de){return function(_0x17c0b3){try{jsonpatch[_0x8961('0x21')](_0x17c0b3,_0x9d36de,!![]);}catch(_0x4daa2f){return BPromise[_0x8961('0x22')](_0x4daa2f);}return _0x17c0b3['save']();};}function saveUpdates(_0x568685,_0x479471){return function(_0xef76ff){if(_0xef76ff){return _0xef76ff[_0x8961('0x23')](_0x568685)[_0x8961('0x24')](function(_0x559387){return _0x559387;});}return null;};}function removeEntity(_0x3db1d2,_0x2304eb){return function(_0x556642){if(_0x556642){return _0x556642[_0x8961('0x25')]()[_0x8961('0x24')](function(){_0x3db1d2[_0x8961('0x1e')](0xcc)[_0x8961('0x19')]();});}};}function handleEntityNotFound(_0x547107,_0x1de3a1){return function(_0x40059d){if(!_0x40059d){_0x547107['sendStatus'](0x194);}return _0x40059d;};}function handleError(_0x2878f3,_0x5978b2){_0x5978b2=_0x5978b2||0x1f4;return function(_0x2e5a4e){logger[_0x8961('0x26')](_0x2e5a4e[_0x8961('0x27')]);if(_0x2e5a4e[_0x8961('0x28')]){delete _0x2e5a4e[_0x8961('0x28')];}_0x2878f3[_0x8961('0x1e')](_0x5978b2)[_0x8961('0x29')](_0x2e5a4e);};}exports['index']=function(_0x4dc0a1,_0x1b0f5e){var _0x362b65={},_0x4d4df5={},_0x3d0992={'count':0x0,'rows':[]};var _0x117e9c=_[_0x8961('0x2a')](db['VoiceMailMessage'][_0x8961('0x2b')],function(_0x59004e){return{'name':_0x59004e['fieldName'],'type':_0x59004e[_0x8961('0x2c')]['key']};});_0x4d4df5['model']=_[_0x8961('0x2d')](_[_0x8961('0x2a')](_0x117e9c,_0x8961('0x28')),[_0x8961('0x28')]);_0x4d4df5['query']=_[_0x8961('0x2e')](_0x4dc0a1[_0x8961('0x2f')]);_0x4d4df5[_0x8961('0x30')]=_[_0x8961('0x31')](_0x4d4df5[_0x8961('0x32')],_0x4d4df5[_0x8961('0x2f')]);_0x362b65[_0x8961('0x33')]=_[_0x8961('0x31')](_0x4d4df5[_0x8961('0x32')],qs['fields'](_0x4dc0a1['query'][_0x8961('0x34')]));_0x362b65[_0x8961('0x33')]=_0x362b65[_0x8961('0x33')][_0x8961('0x35')]?_0x362b65['attributes']:_0x4d4df5['model'];if(!_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x36')](_0x8961('0x37'))){_0x362b65[_0x8961('0x1d')]=qs[_0x8961('0x1d')](_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x1d')]);_0x362b65[_0x8961('0x1a')]=qs[_0x8961('0x1a')](_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x1a')]);}_0x362b65[_0x8961('0x38')]=qs[_0x8961('0x39')](_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x39')]);_0x362b65[_0x8961('0x3a')]=qs[_0x8961('0x30')](_[_0x8961('0x3b')](_0x4dc0a1[_0x8961('0x2f')],_0x4d4df5[_0x8961('0x30')]),_0x117e9c);if(_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x3c')]){_0x362b65[_0x8961('0x3a')]=_['merge'](_0x362b65[_0x8961('0x3a')],{'$or':_['map'](_0x117e9c,function(_0x4e3d91){if(_0x4e3d91[_0x8961('0x2c')]!==_0x8961('0x3d')){var _0x23e373={};_0x23e373[_0x4e3d91[_0x8961('0x28')]]={'$like':'%'+_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x3c')]+'%'};return _0x23e373;}})});}_0x362b65=_[_0x8961('0x3e')]({},_0x362b65,_0x4dc0a1[_0x8961('0x3f')]);var _0x5dcffd={'where':_0x362b65[_0x8961('0x3a')]};return db[_0x8961('0x40')][_0x8961('0x1c')](_0x5dcffd)[_0x8961('0x24')](function(_0x42ee26){_0x3d0992[_0x8961('0x1c')]=_0x42ee26;if(_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x41')]){_0x362b65[_0x8961('0x42')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x362b65);})[_0x8961('0x24')](function(_0x48991f){_0x3d0992['rows']=_0x48991f;return _0x3d0992;})[_0x8961('0x24')](respondWithFilteredResult(_0x1b0f5e,_0x362b65))[_0x8961('0x43')](handleError(_0x1b0f5e,null));};exports[_0x8961('0x44')]=function(_0x279c2c,_0x2e3269){var _0x5ea6c7={'raw':!![],'where':{'id':_0x279c2c[_0x8961('0x45')]['id']}},_0x5cff84={};_0x5cff84[_0x8961('0x32')]=_[_0x8961('0x2e')](db[_0x8961('0x40')][_0x8961('0x2b')]);_0x5cff84[_0x8961('0x2f')]=_[_0x8961('0x2e')](_0x279c2c['query']);_0x5cff84[_0x8961('0x30')]=_['intersection'](_0x5cff84['model'],_0x5cff84['query']);_0x5ea6c7[_0x8961('0x33')]=_[_0x8961('0x31')](_0x5cff84[_0x8961('0x32')],qs[_0x8961('0x34')](_0x279c2c[_0x8961('0x2f')][_0x8961('0x34')]));_0x5ea6c7[_0x8961('0x33')]=_0x5ea6c7['attributes'][_0x8961('0x35')]?_0x5ea6c7[_0x8961('0x33')]:_0x5cff84[_0x8961('0x32')];if(_0x279c2c[_0x8961('0x2f')][_0x8961('0x41')]){_0x5ea6c7[_0x8961('0x42')]=[{'all':!![]}];}_0x5ea6c7=_[_0x8961('0x3e')]({},_0x5ea6c7,_0x279c2c[_0x8961('0x3f')]);return db['VoiceMailMessage']['find'](_0x5ea6c7)['then'](handleEntityNotFound(_0x2e3269,null))['then'](respondWithResult(_0x2e3269,null))[_0x8961('0x43')](handleError(_0x2e3269,null));};exports[_0x8961('0x46')]=function(_0x1d7ce5,_0xc9b97b){return db['VoiceMailMessage']['create'](_0x1d7ce5[_0x8961('0x47')],{})[_0x8961('0x24')](respondWithResult(_0xc9b97b,0xc9))[_0x8961('0x43')](handleError(_0xc9b97b,null));};exports[_0x8961('0x23')]=function(_0x1f5a29,_0x1ccc79){if(_0x1f5a29['body']['id']){delete _0x1f5a29[_0x8961('0x47')]['id'];}return db[_0x8961('0x40')][_0x8961('0x48')]({'where':{'id':_0x1f5a29[_0x8961('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ccc79,null))[_0x8961('0x24')](saveUpdates(_0x1f5a29[_0x8961('0x47')],null))[_0x8961('0x24')](respondWithResult(_0x1ccc79,null))[_0x8961('0x43')](handleError(_0x1ccc79,null));};exports[_0x8961('0x25')]=function(_0x51b52d,_0x46557d){return db['VoiceMailMessage'][_0x8961('0x48')]({'where':{'id':_0x51b52d[_0x8961('0x45')]['id']}})[_0x8961('0x24')](handleEntityNotFound(_0x46557d,null))[_0x8961('0x24')](removeEntity(_0x46557d,null))[_0x8961('0x43')](handleError(_0x46557d,null));};exports[_0x8961('0x49')]=function(_0x123f90,_0x47f4d6,_0x498a66){return db['VoiceMailMessage'][_0x8961('0x48')]({'where':{'id':_0x123f90[_0x8961('0x45')]['id']},'attributes':['id',_0x8961('0x4a'),_0x8961('0x4b')]})[_0x8961('0x24')](handleEntityNotFound(_0x47f4d6,null))[_0x8961('0x24')](function(_0x16ee60){if(_0x16ee60){if(!_0x16ee60[_0x8961('0x4a')]){throw new db[(_0x8961('0x4c'))][(_0x8961('0x4d'))](_0x8961('0x4e'));}var _0x203ceb={'Content-Type':_0x8961('0x4f'),'Content-Disposition':'attachment'};if(_0x16ee60[_0x8961('0x4b')]){_0x203ceb[_0x8961('0x50')]=_0x8961('0x51')+_0x16ee60[_0x8961('0x4b')]+_0x8961('0x52');}_0x47f4d6[_0x8961('0x1f')](_0x203ceb);return _0x47f4d6['send'](new Buffer(_0x16ee60[_0x8961('0x4a')]));}})[_0x8961('0x43')](handleError(_0x47f4d6,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e38e1e1..1242d3d 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 _0x56c2=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','../../config/logger','api'];(function(_0x8e0dd1,_0x2e2cc7){var _0x3d4ef0=function(_0x1a6db4){while(--_0x1a6db4){_0x8e0dd1['push'](_0x8e0dd1['shift']());}};_0x3d4ef0(++_0x2e2cc7);}(_0x56c2,0x1b6));var _0x256c=function(_0x506df8,_0x3498da){_0x506df8=_0x506df8-0x0;var _0x54aa08=_0x56c2[_0x506df8];return _0x54aa08;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x256c('0x0'))(_0x256c('0x1'));var moment=require('moment');var BPromise=require(_0x256c('0x2'));var rp=require(_0x256c('0x3'));var fs=require('fs');var path=require(_0x256c('0x4'));var rimraf=require(_0x256c('0x5'));var config=require(_0x256c('0x6'));var attributes=require(_0x256c('0x7'));module['exports']=function(_0x5daf09,_0x4be5d2){return _0x5daf09[_0x256c('0x8')](_0x256c('0x9'),attributes,{'tableName':_0x256c('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x2849=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x54453f,_0x1bcb25){var _0x6390c7=function(_0x1b7ae5){while(--_0x1b7ae5){_0x54453f['push'](_0x54453f['shift']());}};_0x6390c7(++_0x1bcb25);}(_0x2849,0x1b6));var _0x9284=function(_0xaef48a,_0xf2ec94){_0xaef48a=_0xaef48a-0x0;var _0x53e0de=_0x2849[_0xaef48a];return _0x53e0de;};'use strict';var _=require(_0x9284('0x0'));var util=require(_0x9284('0x1'));var logger=require(_0x9284('0x2'))(_0x9284('0x3'));var moment=require(_0x9284('0x4'));var BPromise=require(_0x9284('0x5'));var rp=require(_0x9284('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9284('0x7'));var config=require(_0x9284('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x9284('0x9')]=function(_0x12ab9e,_0x79a53){return _0x12ab9e[_0x9284('0xa')](_0x9284('0xb'),attributes,{'tableName':_0x9284('0xc'),'paranoid':![],'indexes':[{'name':_0x9284('0xd'),'fields':[_0x9284('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index ad1280f..61ddded 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 _0x733c=['../../mysqldb','../../config/logger','rpc','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x733c,0x13c));var _0xc733=function(_0x10bb99,_0x37009c){_0x10bb99=_0x10bb99-0x0;var _0x7d4a6=_0x733c[_0x10bb99];return _0x7d4a6;};'use strict';var _=require(_0xc733('0x0'));var util=require('util');var moment=require(_0xc733('0x1'));var BPromise=require(_0xc733('0x2'));var rs=require(_0xc733('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc733('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc733('0x5'))(_0xc733('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc733('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ca919,_0x4ded55,_0x335bde){return new BPromise(function(_0x4bd14b,_0x55295a){return client[_0xc733('0x8')](_0x4ca919,_0x335bde)[_0xc733('0x9')](function(_0x1d05b5){logger[_0xc733('0xa')](_0xc733('0xb'),_0x4ded55,_0xc733('0xc'));logger[_0xc733('0xd')](_0xc733('0xe'),_0x4ded55,_0xc733('0xc'),JSON[_0xc733('0xf')](_0x1d05b5));if(_0x1d05b5[_0xc733('0x10')]){if(_0x1d05b5[_0xc733('0x10')][_0xc733('0x11')]===0x1f4){logger[_0xc733('0x10')](_0xc733('0xb'),_0x4ded55,_0x1d05b5[_0xc733('0x10')][_0xc733('0x12')]);return _0x55295a(_0x1d05b5[_0xc733('0x10')][_0xc733('0x12')]);}logger[_0xc733('0x10')](_0xc733('0xb'),_0x4ded55,_0x1d05b5[_0xc733('0x10')][_0xc733('0x12')]);return _0x4bd14b(_0x1d05b5[_0xc733('0x10')][_0xc733('0x12')]);}else{logger[_0xc733('0xa')](_0xc733('0xb'),_0x4ded55,'request\x20sent');_0x4bd14b(_0x1d05b5['result'][_0xc733('0x12')]);}})[_0xc733('0x13')](function(_0x6a7238){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4ded55,_0x6a7238);_0x55295a(_0x6a7238);});});} \ No newline at end of file +var _0xe2bf=['ioredis','../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','catch','util','moment','randomstring'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0xe2bf,0x95));var _0xfe2b=function(_0x72a890,_0x398f10){_0x72a890=_0x72a890-0x0;var _0x5c4eef=_0xe2bf[_0x72a890];return _0x5c4eef;};'use strict';var _=require('lodash');var util=require(_0xfe2b('0x0'));var moment=require(_0xfe2b('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe2b('0x2'));var fs=require('fs');var Redis=require(_0xfe2b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe2b('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfe2b('0x5'));var client=jayson[_0xfe2b('0x6')][_0xfe2b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f25f8,_0x20df7a,_0x23efe8){return new BPromise(function(_0x1c0be1,_0x267289){return client[_0xfe2b('0x8')](_0x1f25f8,_0x23efe8)[_0xfe2b('0x9')](function(_0x5002b8){logger[_0xfe2b('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0x20df7a,_0xfe2b('0xb'));logger[_0xfe2b('0xc')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x20df7a,'request\x20sent',JSON[_0xfe2b('0xd')](_0x5002b8));if(_0x5002b8[_0xfe2b('0xe')]){if(_0x5002b8[_0xfe2b('0xe')][_0xfe2b('0xf')]===0x1f4){logger[_0xfe2b('0xe')](_0xfe2b('0x10'),_0x20df7a,_0x5002b8[_0xfe2b('0xe')][_0xfe2b('0x11')]);return _0x267289(_0x5002b8[_0xfe2b('0xe')][_0xfe2b('0x11')]);}logger[_0xfe2b('0xe')](_0xfe2b('0x10'),_0x20df7a,_0x5002b8[_0xfe2b('0xe')][_0xfe2b('0x11')]);return _0x1c0be1(_0x5002b8[_0xfe2b('0xe')]['message']);}else{logger[_0xfe2b('0xa')](_0xfe2b('0x10'),_0x20df7a,_0xfe2b('0xb'));_0x1c0be1(_0x5002b8['result']['message']);}})[_0xfe2b('0x12')](function(_0x5dec79){logger['error'](_0xfe2b('0x10'),_0x20df7a,_0x5dec79);_0x267289(_0x5dec79);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index cccdd5d..7e369fd 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 _0x6ecc=['create','addSound','update','destroy','delete','/:id/sounds/:id2','removeSound','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post'];(function(_0x300efe,_0x37d503){var _0x4ff0b5=function(_0x2e91cd){while(--_0x2e91cd){_0x300efe['push'](_0x300efe['shift']());}};_0x4ff0b5(++_0x37d503);}(_0x6ecc,0x127));var _0xc6ec=function(_0x9ef8be,_0x502789){_0x9ef8be=_0x9ef8be-0x0;var _0x14ee25=_0x6ecc[_0x9ef8be];return _0x14ee25;};'use strict';var multer=require(_0xc6ec('0x0'));var util=require(_0xc6ec('0x1'));var path=require('path');var timeout=require(_0xc6ec('0x2'));var express=require(_0xc6ec('0x3'));var router=express[_0xc6ec('0x4')]();var fs_extra=require(_0xc6ec('0x5'));var auth=require(_0xc6ec('0x6'));var interaction=require(_0xc6ec('0x7'));var config=require(_0xc6ec('0x8'));var controller=require(_0xc6ec('0x9'));router[_0xc6ec('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc6ec('0xa')](_0xc6ec('0xb'),auth[_0xc6ec('0xc')](),controller[_0xc6ec('0xd')]);router['get'](_0xc6ec('0xe'),auth[_0xc6ec('0xc')](),controller[_0xc6ec('0xf')]);router[_0xc6ec('0x10')]('/',auth[_0xc6ec('0xc')](),controller[_0xc6ec('0x11')]);router[_0xc6ec('0x10')](_0xc6ec('0xe'),auth[_0xc6ec('0xc')](),controller[_0xc6ec('0x12')]);router['put'](_0xc6ec('0xb'),auth[_0xc6ec('0xc')](),controller[_0xc6ec('0x13')]);router['delete'](_0xc6ec('0xb'),auth['isAuthenticated'](),controller[_0xc6ec('0x14')]);router[_0xc6ec('0x15')](_0xc6ec('0x16'),auth[_0xc6ec('0xc')](),controller[_0xc6ec('0x17')]);module['exports']=router; \ No newline at end of file +var _0x7532=['update','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put'];(function(_0x453f93,_0x54e2d5){var _0x4549e7=function(_0x56fb05){while(--_0x56fb05){_0x453f93['push'](_0x453f93['shift']());}};_0x4549e7(++_0x54e2d5);}(_0x7532,0x15e));var _0x2753=function(_0x50aea5,_0x5dd077){_0x50aea5=_0x50aea5-0x0;var _0x4657f1=_0x7532[_0x50aea5];return _0x4657f1;};'use strict';var multer=require(_0x2753('0x0'));var util=require(_0x2753('0x1'));var path=require(_0x2753('0x2'));var timeout=require('connect-timeout');var express=require(_0x2753('0x3'));var router=express['Router']();var fs_extra=require(_0x2753('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2753('0x5'));var config=require(_0x2753('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x2753('0x7')]('/',auth[_0x2753('0x8')](),controller[_0x2753('0x9')]);router[_0x2753('0x7')](_0x2753('0xa'),auth[_0x2753('0x8')](),controller[_0x2753('0xb')]);router[_0x2753('0x7')](_0x2753('0xc'),auth['isAuthenticated'](),controller[_0x2753('0xd')]);router[_0x2753('0xe')]('/',auth[_0x2753('0x8')](),controller[_0x2753('0xf')]);router[_0x2753('0xe')](_0x2753('0xc'),auth[_0x2753('0x8')](),controller[_0x2753('0x10')]);router[_0x2753('0x11')](_0x2753('0xa'),auth[_0x2753('0x8')](),controller[_0x2753('0x12')]);router['delete'](_0x2753('0xa'),auth['isAuthenticated'](),controller[_0x2753('0x13')]);router['delete'](_0x2753('0x14'),auth[_0x2753('0x8')](),controller[_0x2753('0x15')]);module[_0x2753('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 0f2d02d..61039bf 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 _0x422d=['BOOLEAN','sequelize','exports','STRING','ENUM','files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x422d,0xdd));var _0xd422=function(_0x595a8a,_0x48e382){_0x595a8a=_0x595a8a-0x0;var _0xc79865=_0x422d[_0x595a8a];return _0xc79865;};'use strict';var Sequelize=require(_0xd422('0x0'));module[_0xd422('0x1')]={'name':{'type':Sequelize[_0xd422('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xd422('0x3')]('custom',_0xd422('0x4'),'mp3nb',_0xd422('0x5'),_0xd422('0x6'),_0xd422('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xd422('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd422('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd422('0x2')],'allowNull':!![],'defaultValue':_0xd422('0x8')},'format':{'type':Sequelize[_0xd422('0x2')],'allowNull':!![]},'stamp':{'type':_0xd422('0x9')},'defaultEntry':{'type':Sequelize[_0xd422('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x68c1=['alpha','TIMESTAMP','exports','STRING','name','ENUM','mp3nb','quietmp3','mp3'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68c1,0x17c));var _0x168c=function(_0x59f691,_0x1b656d){_0x59f691=_0x59f691-0x0;var _0x1f80bb=_0x68c1[_0x59f691];return _0x1f80bb;};'use strict';var Sequelize=require('sequelize');module[_0x168c('0x0')]={'name':{'type':Sequelize[_0x168c('0x1')],'allowNull':![],'unique':_0x168c('0x2')},'mode':{'type':Sequelize[_0x168c('0x3')]('custom','files',_0x168c('0x4'),'quietmp3nb',_0x168c('0x5'),_0x168c('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x168c('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x168c('0x1')],'allowNull':!![],'defaultValue':_0x168c('0x7')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x168c('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 e1f28c7..2a7d12c 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 _0x147a=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','removeSound','id2','createdAt','getSounds','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','destroy','then','MusicOnHolds','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','VoiceMusicOnHold','find','update','body','create','sequelize','transaction','files','directory','join','root','server/files/moh','mode','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x217181,_0x201229){var _0xbeef5=function(_0x3eb1cf){while(--_0x3eb1cf){_0x217181['push'](_0x217181['shift']());}};_0xbeef5(++_0x201229);}(_0x147a,0x1ee));var _0xa147=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x147a[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0xa147('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa147('0x1'));var jsonpatch=require(_0xa147('0x2'));var rp=require(_0xa147('0x3'));var moment=require('moment');var BPromise=require(_0xa147('0x4'));var Mustache=require(_0xa147('0x5'));var util=require('util');var path=require(_0xa147('0x6'));var sox=require(_0xa147('0x7'));var csv=require(_0xa147('0x8'));var ejs=require(_0xa147('0x9'));var fs=require('fs');var fs_extra=require(_0xa147('0xa'));var _=require(_0xa147('0xb'));var squel=require(_0xa147('0xc'));var crypto=require(_0xa147('0xd'));var jsforce=require(_0xa147('0xe'));var deskjs=require(_0xa147('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa147('0x10'));var Papa=require(_0xa147('0x11'));var Redis=require(_0xa147('0x12'));var authService=require(_0xa147('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa147('0x14'));var hardwareService=require(_0xa147('0x15'));var logger=require(_0xa147('0x16'))('api');var utils=require(_0xa147('0x17'));var config=require(_0xa147('0x18'));var licenseUtil=require(_0xa147('0x19'));var db=require(_0xa147('0x1a'))['db'];function respondWithStatusCode(_0x4b5482,_0x5654b5){_0x5654b5=_0x5654b5||0xcc;return function(_0x246bd7){if(_0x246bd7){return _0x4b5482[_0xa147('0x1b')](_0x5654b5);}return _0x4b5482[_0xa147('0x1c')](_0x5654b5)[_0xa147('0x1d')]();};}function respondWithResult(_0x46ebfe,_0x237004){_0x237004=_0x237004||0xc8;return function(_0x20fb79){if(_0x20fb79){return _0x46ebfe[_0xa147('0x1c')](_0x237004)[_0xa147('0x1e')](_0x20fb79);}};}function respondWithFilteredResult(_0x2f8ab9,_0x404f94){return function(_0x32033d){if(_0x32033d){var _0x4363d4=typeof _0x404f94[_0xa147('0x1f')]==='undefined'&&typeof _0x404f94['limit']===_0xa147('0x20');var _0x16ddeb=_0x32033d[_0xa147('0x21')];var _0x4b9fd1=_0x4363d4?0x0:_0x404f94[_0xa147('0x1f')];var _0x5d047e=_0x4363d4?_0x32033d[_0xa147('0x21')]:_0x404f94['offset']+_0x404f94[_0xa147('0x22')];var _0x35c6d1;if(_0x5d047e>=_0x16ddeb){_0x5d047e=_0x16ddeb;_0x35c6d1=0xc8;}else{_0x35c6d1=0xce;}_0x2f8ab9[_0xa147('0x1c')](_0x35c6d1);return _0x2f8ab9['set']('Content-Range',_0x4b9fd1+'-'+_0x5d047e+'/'+_0x16ddeb)['json'](_0x32033d);}return null;};}function patchUpdates(_0x5f1d87){return function(_0x37fa63){try{jsonpatch[_0xa147('0x23')](_0x37fa63,_0x5f1d87,!![]);}catch(_0xc49f97){return BPromise[_0xa147('0x24')](_0xc49f97);}return _0x37fa63[_0xa147('0x25')]();};}function saveUpdates(_0x703669,_0x6a8156){return function(_0x3bbcda){if(_0x3bbcda){return _0x3bbcda['update'](_0x703669)['then'](function(_0x330835){return _0x330835;});}return null;};}function removeEntity(_0x3257a6,_0x5b6674){return function(_0x1af37f){if(_0x1af37f){return _0x1af37f[_0xa147('0x26')]()[_0xa147('0x27')](function(){var _0x190a2e=_0x1af37f['get']({'plain':!![]});var _0x293217=_0xa147('0x28');return db[_0xa147('0x29')][_0xa147('0x26')]({'where':{'type':_0x293217,'resourceId':_0x190a2e['id']}})[_0xa147('0x27')](function(){return _0x1af37f;});})[_0xa147('0x27')](function(){_0x3257a6[_0xa147('0x1c')](0xcc)[_0xa147('0x1d')]();});}};}function handleEntityNotFound(_0x2b6006,_0x2fdc02){return function(_0x27d5b9){if(!_0x27d5b9){_0x2b6006['sendStatus'](0x194);}return _0x27d5b9;};}function handleError(_0x105125,_0x11076c){_0x11076c=_0x11076c||0x1f4;return function(_0x5c0db4){logger[_0xa147('0x2a')](_0x5c0db4['stack']);if(_0x5c0db4[_0xa147('0x2b')]){delete _0x5c0db4[_0xa147('0x2b')];}_0x105125[_0xa147('0x1c')](_0x11076c)[_0xa147('0x2c')](_0x5c0db4);};}exports[_0xa147('0x2d')]=function(_0x42ad1b,_0x12e8ec){var _0x59cda4={},_0x3ee7bd={},_0x3cdf11={'count':0x0,'rows':[]};var _0x1187f5=_['map'](db['VoiceMusicOnHold'][_0xa147('0x2e')],function(_0x4488b8){return{'name':_0x4488b8[_0xa147('0x2f')],'type':_0x4488b8[_0xa147('0x30')][_0xa147('0x31')]};});_0x3ee7bd[_0xa147('0x32')]=_[_0xa147('0x33')](_0x1187f5,_0xa147('0x2b'));_0x3ee7bd[_0xa147('0x34')]=_['keys'](_0x42ad1b[_0xa147('0x34')]);_0x3ee7bd[_0xa147('0x35')]=_[_0xa147('0x36')](_0x3ee7bd[_0xa147('0x32')],_0x3ee7bd['query']);_0x59cda4[_0xa147('0x37')]=_[_0xa147('0x36')](_0x3ee7bd[_0xa147('0x32')],qs[_0xa147('0x38')](_0x42ad1b[_0xa147('0x34')][_0xa147('0x38')]));_0x59cda4[_0xa147('0x37')]=_0x59cda4['attributes'][_0xa147('0x39')]?_0x59cda4[_0xa147('0x37')]:_0x3ee7bd[_0xa147('0x32')];if(!_0x42ad1b[_0xa147('0x34')][_0xa147('0x3a')](_0xa147('0x3b'))){_0x59cda4[_0xa147('0x22')]=qs[_0xa147('0x22')](_0x42ad1b[_0xa147('0x34')]['limit']);_0x59cda4[_0xa147('0x1f')]=qs[_0xa147('0x1f')](_0x42ad1b[_0xa147('0x34')][_0xa147('0x1f')]);}_0x59cda4[_0xa147('0x3c')]=qs[_0xa147('0x3d')](_0x42ad1b['query'][_0xa147('0x3d')]);delete _0x42ad1b[_0xa147('0x34')]['sort'];_0x59cda4[_0xa147('0x3e')]=qs[_0xa147('0x35')](_[_0xa147('0x3f')](_0x42ad1b[_0xa147('0x34')],_0x3ee7bd['filters']),_0x1187f5);if(_0x42ad1b['query'][_0xa147('0x40')]){_0x59cda4[_0xa147('0x3e')]=_[_0xa147('0x41')](_0x59cda4[_0xa147('0x3e')],{'$or':_['map'](_0x1187f5,function(_0x338aed){if(_0x338aed[_0xa147('0x30')]!==_0xa147('0x42')){var _0x41b78b={};_0x41b78b[_0x338aed[_0xa147('0x2b')]]={'$like':'%'+_0x42ad1b[_0xa147('0x34')][_0xa147('0x40')]+'%'};return _0x41b78b;}})});}_0x59cda4=_[_0xa147('0x41')]({},_0x59cda4,_0x42ad1b[_0xa147('0x43')]);var _0x54d47e={'where':_0x59cda4[_0xa147('0x3e')]};return db['VoiceMusicOnHold']['count'](_0x54d47e)[_0xa147('0x27')](function(_0x1b3a03){_0x3cdf11[_0xa147('0x21')]=_0x1b3a03;if(_0x42ad1b[_0xa147('0x34')]['includeAll']){_0x59cda4[_0xa147('0x44')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xa147('0x45')](_0x59cda4);})[_0xa147('0x27')](function(_0x39ccfc){_0x3cdf11[_0xa147('0x46')]=_0x39ccfc;return _0x3cdf11;})[_0xa147('0x27')](respondWithFilteredResult(_0x12e8ec,_0x59cda4))[_0xa147('0x47')](handleError(_0x12e8ec,null));};exports[_0xa147('0x48')]=function(_0x5363c2,_0xdd703c){var _0x24b816={'raw':![],'where':{'id':_0x5363c2[_0xa147('0x49')]['id']}},_0x46c3e9={};_0x46c3e9[_0xa147('0x32')]=_[_0xa147('0x4a')](db[_0xa147('0x4b')]['rawAttributes']);_0x46c3e9[_0xa147('0x34')]=_['keys'](_0x5363c2['query']);_0x46c3e9[_0xa147('0x35')]=_[_0xa147('0x36')](_0x46c3e9['model'],_0x46c3e9['query']);_0x24b816[_0xa147('0x37')]=_[_0xa147('0x36')](_0x46c3e9[_0xa147('0x32')],qs[_0xa147('0x38')](_0x5363c2[_0xa147('0x34')][_0xa147('0x38')]));_0x24b816[_0xa147('0x37')]=_0x24b816[_0xa147('0x37')][_0xa147('0x39')]?_0x24b816['attributes']:_0x46c3e9[_0xa147('0x32')];if(_0x5363c2['query']['includeAll']){_0x24b816['include']=[{'all':!![]}];}_0x24b816=_[_0xa147('0x41')]({},_0x24b816,_0x5363c2[_0xa147('0x43')]);return db[_0xa147('0x4b')][_0xa147('0x4c')](_0x24b816)['then'](handleEntityNotFound(_0xdd703c,null))[_0xa147('0x27')](respondWithResult(_0xdd703c,null))[_0xa147('0x47')](handleError(_0xdd703c,null));};exports[_0xa147('0x4d')]=function(_0x4d042d,_0x2cce5a){if(_0x4d042d[_0xa147('0x4e')]['id']){delete _0x4d042d['body']['id'];}return db[_0xa147('0x4b')]['find']({'where':{'id':_0x4d042d[_0xa147('0x49')]['id']}})[_0xa147('0x27')](handleEntityNotFound(_0x2cce5a,null))[_0xa147('0x27')](saveUpdates(_0x4d042d['body'],null))['then'](respondWithResult(_0x2cce5a,null))['catch'](handleError(_0x2cce5a,null));};exports[_0xa147('0x4f')]=function(_0x1db8a4,_0x41b237,_0xb8de00){return db[_0xa147('0x50')][_0xa147('0x51')](function(_0x23646c){if(_0x1db8a4[_0xa147('0x4e')]['mode']===_0xa147('0x52')){_0x1db8a4['body'][_0xa147('0x53')]=path[_0xa147('0x54')](config[_0xa147('0x55')],_0xa147('0x56'),_0x1db8a4[_0xa147('0x4e')]['name']);}return db[_0xa147('0x4b')][_0xa147('0x4f')](_0x1db8a4['body'],{'transaction':_0x23646c})[_0xa147('0x27')](function(_0x40ab93){if(_0x1db8a4[_0xa147('0x4e')][_0xa147('0x57')]===_0xa147('0x52')){fs['mkdirSync'](_0x40ab93[_0xa147('0x53')],parseInt(_0xa147('0x58'),0x8));}var _0x4a0eae=_0x1db8a4[_0xa147('0x59')][_0xa147('0x5a')]({'plain':!![]});if(!_0x4a0eae)throw new Error(_0xa147('0x5b'));if(_0x4a0eae[_0xa147('0x5c')]===_0xa147('0x59')){var _0x53fe79=_0x40ab93[_0xa147('0x5a')]({'plain':!![]});return db[_0xa147('0x5d')][_0xa147('0x4c')]({'where':{'name':_0xa147('0x28'),'userProfileId':_0x4a0eae[_0xa147('0x5e')]},'raw':!![]})[_0xa147('0x27')](function(_0x1afb7c){if(_0x1afb7c&&_0x1afb7c[_0xa147('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x53fe79[_0xa147('0x2b')],'resourceId':_0x53fe79['id'],'type':_0x1afb7c[_0xa147('0x2b')],'sectionId':_0x1afb7c['id']},{})[_0xa147('0x27')](function(){return _0x40ab93;});}else{return _0x40ab93;}})[_0xa147('0x47')](function(_0x198c9a){logger['error'](_0xa147('0x60'),_0x198c9a);});}return _0x40ab93;});})['then'](respondWithResult(_0x41b237,0xc9))[_0xa147('0x47')](handleError(_0x41b237,null));};exports['destroy']=function(_0x2ebe2a,_0x185d02,_0x5ebd2c){var _0x320753;return db[_0xa147('0x4b')][_0xa147('0x4c')]({'where':{'id':_0x2ebe2a[_0xa147('0x49')]['id']}})[_0xa147('0x27')](function(_0x437c9e){if(_0x437c9e){return db[_0xa147('0x50')][_0xa147('0x51')](function(_0x435122){return _0x437c9e[_0xa147('0x26')]({'transaction':_0x435122,'raw':!![]})[_0xa147('0x27')](function(_0xaf5187){if(_0xaf5187['directory']){fs[_0xa147('0x61')](_0xaf5187[_0xa147('0x53')])[_0xa147('0x62')](function(_0xd7d16d){fs[_0xa147('0x63')](path[_0xa147('0x54')](_0xaf5187[_0xa147('0x53')],_0xd7d16d));});fs[_0xa147('0x64')](_0xaf5187['directory']);}return _0xaf5187;});})[_0xa147('0x47')](function(_0x26ec78){throw new db[(_0xa147('0x65'))][(_0xa147('0x66'))](_0x26ec78[_0xa147('0x67')]);});}})['then'](handleEntityNotFound(_0x185d02,null))[_0xa147('0x27')](removeEntity(_0x185d02,null))[_0xa147('0x47')](handleError(_0x185d02,null));};exports[_0xa147('0x68')]=function(_0x2c3811,_0x40b10c,_0xb8f131){return db[_0xa147('0x50')]['transaction'](function(_0x320d62){var _0x3c1e3f;return db['VoiceMusicOnHold'][_0xa147('0x4c')]({'where':{'id':_0x2c3811[_0xa147('0x49')]['id']}})[_0xa147('0x27')](function(_0x23faa4){if(_0x23faa4){_0x3c1e3f=_0x23faa4;return _0x23faa4['addSound'](_0x2c3811['body']['id'],{'transaction':_0x320d62});}})[_0xa147('0x27')](function(_0x3c6519){if(_0x3c6519){return db[_0xa147('0x69')][_0xa147('0x6a')]({'where':{'id':_0x2c3811['body']['id']},'attributes':['id',_0xa147('0x2b'),_0xa147('0x6b'),_0xa147('0x6c'),'createdAt'],'raw':!![]});}})[_0xa147('0x27')](function(_0x2d82b6){if(_0x2d82b6){var _0x2f5a51=path[_0xa147('0x54')](config[_0xa147('0x55')],_0xa147('0x6d'),util[_0xa147('0x6e')](_0xa147('0x6f'),path[_0xa147('0x70')](_0x2d82b6[_0xa147('0x6b')],path['extname'](_0x2d82b6[_0xa147('0x6b')])),_0x2d82b6['converted_format']));var _0xd1a63c=path[_0xa147('0x54')](config[_0xa147('0x55')],_0xa147('0x56'),_0x3c1e3f[_0xa147('0x2b')],util[_0xa147('0x6e')](_0xa147('0x6f'),_0x2d82b6[_0xa147('0x2b')],_0x2d82b6[_0xa147('0x6c')]));fs[_0xa147('0x71')](_0x2f5a51,_0xd1a63c);return _0x2d82b6;}})['catch'](function(_0x176734){throw new db['Sequelize'][(_0xa147('0x66'))](_0x176734[_0xa147('0x67')]);});})[_0xa147('0x27')](handleEntityNotFound(_0x40b10c,null))[_0xa147('0x27')](respondWithResult(_0x40b10c,0xc9))['catch'](handleError(_0x40b10c,null));};exports[_0xa147('0x72')]=function(_0x36e1a9,_0x425469,_0x187d59){return db[_0xa147('0x50')]['transaction'](function(_0x354932){var _0xf0addc;return db[_0xa147('0x4b')][_0xa147('0x6a')]({'where':{'id':_0x36e1a9['params']['id']}})[_0xa147('0x27')](handleEntityNotFound(_0x425469,null))['then'](function(_0x17f075){if(_0x17f075){_0xf0addc=_0x17f075;return _0x17f075[_0xa147('0x72')](_0x36e1a9['params'][_0xa147('0x73')]);}})[_0xa147('0x27')](function(_0x3bb7ff){if(_0x3bb7ff){return db[_0xa147('0x69')][_0xa147('0x6a')]({'where':{'id':_0x36e1a9[_0xa147('0x49')][_0xa147('0x73')]},'attributes':['id','name',_0xa147('0x6b'),_0xa147('0x6c'),_0xa147('0x74')],'raw':!![]});}})['then'](function(_0xef2658){if(_0xef2658){fs['unlinkSync'](path[_0xa147('0x54')](_0xf0addc[_0xa147('0x53')],util['format']('%s.%s',_0xef2658['name'],_0xef2658['converted_format'])));return _0xef2658;}})[_0xa147('0x47')](function(_0x122782){throw new db[(_0xa147('0x65'))][(_0xa147('0x66'))](_0x122782[_0xa147('0x67')]);});})[_0xa147('0x27')](handleEntityNotFound(_0x425469,null))[_0xa147('0x27')](respondWithStatusCode(_0x425469,0xcc))[_0xa147('0x47')](handleError(_0x425469,null));};exports[_0xa147('0x75')]=function(_0x5d15f4,_0x3d6ff5,_0x2277aa){var _0x3685ad={};var _0x16ded5={};var _0x43c88c;var _0x14ce45;return db[_0xa147('0x4b')][_0xa147('0x6a')]({'where':{'id':_0x5d15f4['params']['id']}})[_0xa147('0x27')](handleEntityNotFound(_0x3d6ff5,null))['then'](function(_0x104a7c){if(_0x104a7c){_0x43c88c=_0x104a7c;_0x16ded5[_0xa147('0x32')]=_[_0xa147('0x4a')](db[_0xa147('0x69')][_0xa147('0x2e')]);_0x16ded5[_0xa147('0x34')]=_[_0xa147('0x4a')](_0x5d15f4[_0xa147('0x34')]);_0x16ded5[_0xa147('0x35')]=_['intersection'](_0x16ded5['model'],_0x16ded5['query']);_0x3685ad['attributes']=_['intersection'](_0x16ded5[_0xa147('0x32')],qs[_0xa147('0x38')](_0x5d15f4[_0xa147('0x34')][_0xa147('0x38')]));_0x3685ad[_0xa147('0x37')]=_0x3685ad[_0xa147('0x37')]['length']?_0x3685ad[_0xa147('0x37')]:_0x16ded5['model'];_0x3685ad[_0xa147('0x3c')]=qs[_0xa147('0x3d')](_0x5d15f4[_0xa147('0x34')][_0xa147('0x3d')]);_0x3685ad[_0xa147('0x3e')]=qs['filters'](_[_0xa147('0x3f')](_0x5d15f4[_0xa147('0x34')],_0x16ded5[_0xa147('0x35')]));if(_0x5d15f4[_0xa147('0x34')][_0xa147('0x40')]){_0x3685ad[_0xa147('0x3e')]=_[_0xa147('0x41')](_0x3685ad[_0xa147('0x3e')],{'$or':_[_0xa147('0x33')](_0x3685ad['attributes'],function(_0x11f698){var _0x21f9a1={};_0x21f9a1[_0x11f698]={'$like':'%'+_0x5d15f4[_0xa147('0x34')][_0xa147('0x40')]+'%'};return _0x21f9a1;})});}_0x3685ad=_[_0xa147('0x41')]({},_0x3685ad,_0x5d15f4[_0xa147('0x43')]);return _0x43c88c[_0xa147('0x75')](_0x3685ad);}})[_0xa147('0x27')](function(_0x3ca0a4){if(_0x3ca0a4){_0x14ce45=_0x3ca0a4[_0xa147('0x39')];if(!_0x5d15f4[_0xa147('0x34')][_0xa147('0x3a')](_0xa147('0x3b'))){_0x3685ad['limit']=qs[_0xa147('0x22')](_0x5d15f4[_0xa147('0x34')][_0xa147('0x22')]);_0x3685ad[_0xa147('0x1f')]=qs[_0xa147('0x1f')](_0x5d15f4['query'][_0xa147('0x1f')]);}return _0x43c88c['getSounds'](_0x3685ad);}})['then'](function(_0x3a5568){if(_0x3a5568){return _0x3a5568?{'count':_0x14ce45,'rows':_0x3a5568}:null;}})['then'](respondWithResult(_0x3d6ff5,null))[_0xa147('0x47')](handleError(_0x3d6ff5,null));}; \ No newline at end of file +var _0xf7c8=['0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','extname','format','symlinkSync','message','removeSound','id2','%s.%s','getSounds','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','body','sequelize','transaction','mode','files','directory','join','server/files/moh','create','mkdirSync'];(function(_0x4def54,_0x36de1d){var _0x137bee=function(_0x1dd6f4){while(--_0x1dd6f4){_0x4def54['push'](_0x4def54['shift']());}};_0x137bee(++_0x36de1d);}(_0xf7c8,0x89));var _0x8f7c=function(_0x14c940,_0x121b4c){_0x14c940=_0x14c940-0x0;var _0x2ae9f3=_0xf7c8[_0x14c940];return _0x2ae9f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f7c('0x0'));var zipdir=require(_0x8f7c('0x1'));var jsonpatch=require(_0x8f7c('0x2'));var rp=require(_0x8f7c('0x3'));var moment=require('moment');var BPromise=require(_0x8f7c('0x4'));var Mustache=require('mustache');var util=require(_0x8f7c('0x5'));var path=require(_0x8f7c('0x6'));var sox=require('sox');var csv=require(_0x8f7c('0x7'));var ejs=require(_0x8f7c('0x8'));var fs=require('fs');var fs_extra=require(_0x8f7c('0x9'));var _=require('lodash');var squel=require(_0x8f7c('0xa'));var crypto=require(_0x8f7c('0xb'));var jsforce=require(_0x8f7c('0xc'));var deskjs=require(_0x8f7c('0xd'));var toCsv=require(_0x8f7c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8f7c('0xe'));var authService=require(_0x8f7c('0xf'));var qs=require(_0x8f7c('0x10'));var as=require(_0x8f7c('0x11'));var hardwareService=require(_0x8f7c('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x8f7c('0x13'));var config=require(_0x8f7c('0x14'));var licenseUtil=require(_0x8f7c('0x15'));var db=require(_0x8f7c('0x16'))['db'];function respondWithStatusCode(_0x180824,_0xbf2e37){_0xbf2e37=_0xbf2e37||0xcc;return function(_0x4284c3){if(_0x4284c3){return _0x180824[_0x8f7c('0x17')](_0xbf2e37);}return _0x180824[_0x8f7c('0x18')](_0xbf2e37)[_0x8f7c('0x19')]();};}function respondWithResult(_0x48c732,_0x3a52d0){_0x3a52d0=_0x3a52d0||0xc8;return function(_0x5f368a){if(_0x5f368a){return _0x48c732[_0x8f7c('0x18')](_0x3a52d0)['json'](_0x5f368a);}};}function respondWithFilteredResult(_0x4f85db,_0x30b872){return function(_0x92058e){if(_0x92058e){var _0x5ee47f=typeof _0x30b872[_0x8f7c('0x1a')]==='undefined'&&typeof _0x30b872[_0x8f7c('0x1b')]===_0x8f7c('0x1c');var _0x2b10a4=_0x92058e[_0x8f7c('0x1d')];var _0x390cc4=_0x5ee47f?0x0:_0x30b872['offset'];var _0x34af07=_0x5ee47f?_0x92058e['count']:_0x30b872[_0x8f7c('0x1a')]+_0x30b872['limit'];var _0x498f94;if(_0x34af07>=_0x2b10a4){_0x34af07=_0x2b10a4;_0x498f94=0xc8;}else{_0x498f94=0xce;}_0x4f85db[_0x8f7c('0x18')](_0x498f94);return _0x4f85db['set'](_0x8f7c('0x1e'),_0x390cc4+'-'+_0x34af07+'/'+_0x2b10a4)[_0x8f7c('0x1f')](_0x92058e);}return null;};}function patchUpdates(_0x4fa2ea){return function(_0x22df6d){try{jsonpatch[_0x8f7c('0x20')](_0x22df6d,_0x4fa2ea,!![]);}catch(_0x4227cd){return BPromise[_0x8f7c('0x21')](_0x4227cd);}return _0x22df6d[_0x8f7c('0x22')]();};}function saveUpdates(_0xba6ee9,_0x5ea785){return function(_0x7f6a48){if(_0x7f6a48){return _0x7f6a48[_0x8f7c('0x23')](_0xba6ee9)[_0x8f7c('0x24')](function(_0x44d376){return _0x44d376;});}return null;};}function removeEntity(_0x23cf57,_0x5b4ae5){return function(_0x215771){if(_0x215771){return _0x215771[_0x8f7c('0x25')]()[_0x8f7c('0x24')](function(){var _0xd7b1bc=_0x215771['get']({'plain':!![]});var _0x248ec4=_0x8f7c('0x26');return db[_0x8f7c('0x27')][_0x8f7c('0x25')]({'where':{'type':_0x248ec4,'resourceId':_0xd7b1bc['id']}})[_0x8f7c('0x24')](function(){return _0x215771;});})['then'](function(){_0x23cf57[_0x8f7c('0x18')](0xcc)[_0x8f7c('0x19')]();});}};}function handleEntityNotFound(_0x4697cd,_0x4d5117){return function(_0xfc78e3){if(!_0xfc78e3){_0x4697cd['sendStatus'](0x194);}return _0xfc78e3;};}function handleError(_0x24bbef,_0x27bf7d){_0x27bf7d=_0x27bf7d||0x1f4;return function(_0x3c4319){logger[_0x8f7c('0x28')](_0x3c4319[_0x8f7c('0x29')]);if(_0x3c4319['name']){delete _0x3c4319[_0x8f7c('0x2a')];}_0x24bbef['status'](_0x27bf7d)[_0x8f7c('0x2b')](_0x3c4319);};}exports[_0x8f7c('0x2c')]=function(_0x32f249,_0x5b295a){var _0x7f69db={},_0x2c0140={},_0x5404fc={'count':0x0,'rows':[]};var _0x53fc36=_[_0x8f7c('0x2d')](db[_0x8f7c('0x2e')][_0x8f7c('0x2f')],function(_0x40953c){return{'name':_0x40953c[_0x8f7c('0x30')],'type':_0x40953c[_0x8f7c('0x31')]['key']};});_0x2c0140['model']=_['map'](_0x53fc36,_0x8f7c('0x2a'));_0x2c0140['query']=_[_0x8f7c('0x32')](_0x32f249[_0x8f7c('0x33')]);_0x2c0140[_0x8f7c('0x34')]=_[_0x8f7c('0x35')](_0x2c0140[_0x8f7c('0x36')],_0x2c0140['query']);_0x7f69db[_0x8f7c('0x37')]=_[_0x8f7c('0x35')](_0x2c0140['model'],qs[_0x8f7c('0x38')](_0x32f249['query'][_0x8f7c('0x38')]));_0x7f69db['attributes']=_0x7f69db[_0x8f7c('0x37')][_0x8f7c('0x39')]?_0x7f69db[_0x8f7c('0x37')]:_0x2c0140[_0x8f7c('0x36')];if(!_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x3a')](_0x8f7c('0x3b'))){_0x7f69db[_0x8f7c('0x1b')]=qs[_0x8f7c('0x1b')](_0x32f249['query'][_0x8f7c('0x1b')]);_0x7f69db[_0x8f7c('0x1a')]=qs[_0x8f7c('0x1a')](_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x1a')]);}_0x7f69db['order']=qs[_0x8f7c('0x3c')](_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x3c')]);delete _0x32f249[_0x8f7c('0x33')][_0x8f7c('0x3c')];_0x7f69db[_0x8f7c('0x3d')]=qs['filters'](_[_0x8f7c('0x3e')](_0x32f249['query'],_0x2c0140[_0x8f7c('0x34')]),_0x53fc36);if(_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x3f')]){_0x7f69db[_0x8f7c('0x3d')]=_[_0x8f7c('0x40')](_0x7f69db[_0x8f7c('0x3d')],{'$or':_[_0x8f7c('0x2d')](_0x53fc36,function(_0x522846){if(_0x522846['type']!==_0x8f7c('0x41')){var _0x377384={};_0x377384[_0x522846[_0x8f7c('0x2a')]]={'$like':'%'+_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x3f')]+'%'};return _0x377384;}})});}_0x7f69db=_['merge']({},_0x7f69db,_0x32f249[_0x8f7c('0x42')]);var _0x322590={'where':_0x7f69db[_0x8f7c('0x3d')]};return db[_0x8f7c('0x2e')][_0x8f7c('0x1d')](_0x322590)[_0x8f7c('0x24')](function(_0x574b75){_0x5404fc[_0x8f7c('0x1d')]=_0x574b75;if(_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x43')]){_0x7f69db['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x7f69db);})[_0x8f7c('0x24')](function(_0x428ca6){_0x5404fc[_0x8f7c('0x44')]=_0x428ca6;return _0x5404fc;})['then'](respondWithFilteredResult(_0x5b295a,_0x7f69db))[_0x8f7c('0x45')](handleError(_0x5b295a,null));};exports['show']=function(_0x7902c4,_0x1b79f2){var _0x4d761d={'raw':![],'where':{'id':_0x7902c4[_0x8f7c('0x46')]['id']}},_0xab2db7={};_0xab2db7[_0x8f7c('0x36')]=_[_0x8f7c('0x32')](db[_0x8f7c('0x2e')][_0x8f7c('0x2f')]);_0xab2db7['query']=_[_0x8f7c('0x32')](_0x7902c4['query']);_0xab2db7['filters']=_[_0x8f7c('0x35')](_0xab2db7[_0x8f7c('0x36')],_0xab2db7[_0x8f7c('0x33')]);_0x4d761d[_0x8f7c('0x37')]=_[_0x8f7c('0x35')](_0xab2db7[_0x8f7c('0x36')],qs[_0x8f7c('0x38')](_0x7902c4[_0x8f7c('0x33')][_0x8f7c('0x38')]));_0x4d761d[_0x8f7c('0x37')]=_0x4d761d[_0x8f7c('0x37')][_0x8f7c('0x39')]?_0x4d761d[_0x8f7c('0x37')]:_0xab2db7[_0x8f7c('0x36')];if(_0x7902c4[_0x8f7c('0x33')][_0x8f7c('0x43')]){_0x4d761d[_0x8f7c('0x47')]=[{'all':!![]}];}_0x4d761d=_[_0x8f7c('0x40')]({},_0x4d761d,_0x7902c4[_0x8f7c('0x42')]);return db[_0x8f7c('0x2e')][_0x8f7c('0x48')](_0x4d761d)[_0x8f7c('0x24')](handleEntityNotFound(_0x1b79f2,null))[_0x8f7c('0x24')](respondWithResult(_0x1b79f2,null))['catch'](handleError(_0x1b79f2,null));};exports['update']=function(_0x227706,_0x157705){if(_0x227706['body']['id']){delete _0x227706['body']['id'];}return db[_0x8f7c('0x2e')]['find']({'where':{'id':_0x227706[_0x8f7c('0x46')]['id']}})[_0x8f7c('0x24')](handleEntityNotFound(_0x157705,null))[_0x8f7c('0x24')](saveUpdates(_0x227706[_0x8f7c('0x49')],null))[_0x8f7c('0x24')](respondWithResult(_0x157705,null))['catch'](handleError(_0x157705,null));};exports['create']=function(_0x5a1ae3,_0x5d0f69,_0x3c0c44){return db[_0x8f7c('0x4a')][_0x8f7c('0x4b')](function(_0x556e23){if(_0x5a1ae3[_0x8f7c('0x49')][_0x8f7c('0x4c')]===_0x8f7c('0x4d')){_0x5a1ae3['body'][_0x8f7c('0x4e')]=path[_0x8f7c('0x4f')](config['root'],_0x8f7c('0x50'),_0x5a1ae3[_0x8f7c('0x49')][_0x8f7c('0x2a')]);}return db['VoiceMusicOnHold'][_0x8f7c('0x51')](_0x5a1ae3[_0x8f7c('0x49')],{'transaction':_0x556e23})[_0x8f7c('0x24')](function(_0x3f2709){if(_0x5a1ae3[_0x8f7c('0x49')]['mode']===_0x8f7c('0x4d')){fs[_0x8f7c('0x52')](_0x3f2709[_0x8f7c('0x4e')],parseInt(_0x8f7c('0x53'),0x8));}var _0x327c5c=_0x5a1ae3['user'][_0x8f7c('0x54')]({'plain':!![]});if(!_0x327c5c)throw new Error(_0x8f7c('0x55'));if(_0x327c5c[_0x8f7c('0x56')]===_0x8f7c('0x57')){var _0x3bef09=_0x3f2709[_0x8f7c('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x8f7c('0x48')]({'where':{'name':_0x8f7c('0x26'),'userProfileId':_0x327c5c['userProfileId']},'raw':!![]})[_0x8f7c('0x24')](function(_0x1f20d6){if(_0x1f20d6&&_0x1f20d6[_0x8f7c('0x58')]===0x0){return db['UserProfileResource'][_0x8f7c('0x51')]({'name':_0x3bef09['name'],'resourceId':_0x3bef09['id'],'type':_0x1f20d6[_0x8f7c('0x2a')],'sectionId':_0x1f20d6['id']},{})['then'](function(){return _0x3f2709;});}else{return _0x3f2709;}})[_0x8f7c('0x45')](function(_0x19c726){logger[_0x8f7c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19c726);});}return _0x3f2709;});})[_0x8f7c('0x24')](respondWithResult(_0x5d0f69,0xc9))[_0x8f7c('0x45')](handleError(_0x5d0f69,null));};exports[_0x8f7c('0x25')]=function(_0x42a50d,_0x110f11,_0x2f37a0){var _0x18805a;return db[_0x8f7c('0x2e')]['find']({'where':{'id':_0x42a50d['params']['id']}})['then'](function(_0x54a7f9){if(_0x54a7f9){return db[_0x8f7c('0x4a')]['transaction'](function(_0x4b7390){return _0x54a7f9[_0x8f7c('0x25')]({'transaction':_0x4b7390,'raw':!![]})[_0x8f7c('0x24')](function(_0x50b498){if(_0x50b498[_0x8f7c('0x4e')]){fs['readdirSync'](_0x50b498[_0x8f7c('0x4e')])[_0x8f7c('0x59')](function(_0x32b8e3){fs[_0x8f7c('0x5a')](path[_0x8f7c('0x4f')](_0x50b498[_0x8f7c('0x4e')],_0x32b8e3));});fs[_0x8f7c('0x5b')](_0x50b498[_0x8f7c('0x4e')]);}return _0x50b498;});})[_0x8f7c('0x45')](function(_0x5c55ce){throw new db[(_0x8f7c('0x5c'))][(_0x8f7c('0x5d'))](_0x5c55ce['message']);});}})[_0x8f7c('0x24')](handleEntityNotFound(_0x110f11,null))[_0x8f7c('0x24')](removeEntity(_0x110f11,null))['catch'](handleError(_0x110f11,null));};exports[_0x8f7c('0x5e')]=function(_0x4ac3d7,_0x2edc25,_0xff0d5d){return db[_0x8f7c('0x4a')][_0x8f7c('0x4b')](function(_0x55a23a){var _0x1f516d;return db['VoiceMusicOnHold'][_0x8f7c('0x48')]({'where':{'id':_0x4ac3d7[_0x8f7c('0x46')]['id']}})[_0x8f7c('0x24')](function(_0x24e3db){if(_0x24e3db){_0x1f516d=_0x24e3db;return _0x24e3db[_0x8f7c('0x5e')](_0x4ac3d7['body']['id'],{'transaction':_0x55a23a});}})['then'](function(_0x8e35be){if(_0x8e35be){return db[_0x8f7c('0x5f')][_0x8f7c('0x60')]({'where':{'id':_0x4ac3d7[_0x8f7c('0x49')]['id']},'attributes':['id',_0x8f7c('0x2a'),_0x8f7c('0x61'),_0x8f7c('0x62'),_0x8f7c('0x63')],'raw':!![]});}})[_0x8f7c('0x24')](function(_0x2cf8fb){if(_0x2cf8fb){var _0x4b8ad0=path['join'](config[_0x8f7c('0x64')],_0x8f7c('0x65'),util['format']('%s.%s',path['basename'](_0x2cf8fb[_0x8f7c('0x61')],path[_0x8f7c('0x66')](_0x2cf8fb[_0x8f7c('0x61')])),_0x2cf8fb['converted_format']));var _0x67120f=path[_0x8f7c('0x4f')](config[_0x8f7c('0x64')],'server/files/moh',_0x1f516d[_0x8f7c('0x2a')],util[_0x8f7c('0x67')]('%s.%s',_0x2cf8fb[_0x8f7c('0x2a')],_0x2cf8fb[_0x8f7c('0x62')]));fs[_0x8f7c('0x68')](_0x4b8ad0,_0x67120f);return _0x2cf8fb;}})['catch'](function(_0x40ef96){throw new db[(_0x8f7c('0x5c'))][(_0x8f7c('0x5d'))](_0x40ef96[_0x8f7c('0x69')]);});})[_0x8f7c('0x24')](handleEntityNotFound(_0x2edc25,null))['then'](respondWithResult(_0x2edc25,0xc9))[_0x8f7c('0x45')](handleError(_0x2edc25,null));};exports[_0x8f7c('0x6a')]=function(_0x406ba3,_0x5b0133,_0x7bd6bc){return db[_0x8f7c('0x4a')]['transaction'](function(_0x28fa86){var _0x2c7714;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x406ba3['params']['id']}})[_0x8f7c('0x24')](handleEntityNotFound(_0x5b0133,null))['then'](function(_0x20f661){if(_0x20f661){_0x2c7714=_0x20f661;return _0x20f661[_0x8f7c('0x6a')](_0x406ba3['params']['id2']);}})[_0x8f7c('0x24')](function(_0x1ddbb8){if(_0x1ddbb8){return db[_0x8f7c('0x5f')][_0x8f7c('0x60')]({'where':{'id':_0x406ba3[_0x8f7c('0x46')][_0x8f7c('0x6b')]},'attributes':['id','name',_0x8f7c('0x61'),_0x8f7c('0x62'),_0x8f7c('0x63')],'raw':!![]});}})[_0x8f7c('0x24')](function(_0x4cbe9d){if(_0x4cbe9d){fs['unlinkSync'](path[_0x8f7c('0x4f')](_0x2c7714[_0x8f7c('0x4e')],util[_0x8f7c('0x67')](_0x8f7c('0x6c'),_0x4cbe9d[_0x8f7c('0x2a')],_0x4cbe9d['converted_format'])));return _0x4cbe9d;}})[_0x8f7c('0x45')](function(_0xb516f0){throw new db[(_0x8f7c('0x5c'))][(_0x8f7c('0x5d'))](_0xb516f0[_0x8f7c('0x69')]);});})[_0x8f7c('0x24')](handleEntityNotFound(_0x5b0133,null))[_0x8f7c('0x24')](respondWithStatusCode(_0x5b0133,0xcc))[_0x8f7c('0x45')](handleError(_0x5b0133,null));};exports[_0x8f7c('0x6d')]=function(_0x522f3f,_0xa4cb34,_0x3c5ceb){var _0x42798d={};var _0xe4801={};var _0x36fbe5;var _0xb8b030;return db[_0x8f7c('0x2e')]['findOne']({'where':{'id':_0x522f3f[_0x8f7c('0x46')]['id']}})[_0x8f7c('0x24')](handleEntityNotFound(_0xa4cb34,null))[_0x8f7c('0x24')](function(_0x201ac7){if(_0x201ac7){_0x36fbe5=_0x201ac7;_0xe4801[_0x8f7c('0x36')]=_[_0x8f7c('0x32')](db[_0x8f7c('0x5f')]['rawAttributes']);_0xe4801[_0x8f7c('0x33')]=_[_0x8f7c('0x32')](_0x522f3f['query']);_0xe4801['filters']=_['intersection'](_0xe4801[_0x8f7c('0x36')],_0xe4801['query']);_0x42798d['attributes']=_['intersection'](_0xe4801['model'],qs[_0x8f7c('0x38')](_0x522f3f['query'][_0x8f7c('0x38')]));_0x42798d[_0x8f7c('0x37')]=_0x42798d[_0x8f7c('0x37')]['length']?_0x42798d['attributes']:_0xe4801['model'];_0x42798d['order']=qs[_0x8f7c('0x3c')](_0x522f3f[_0x8f7c('0x33')][_0x8f7c('0x3c')]);_0x42798d[_0x8f7c('0x3d')]=qs['filters'](_[_0x8f7c('0x3e')](_0x522f3f['query'],_0xe4801['filters']));if(_0x522f3f[_0x8f7c('0x33')][_0x8f7c('0x3f')]){_0x42798d['where']=_[_0x8f7c('0x40')](_0x42798d[_0x8f7c('0x3d')],{'$or':_[_0x8f7c('0x2d')](_0x42798d[_0x8f7c('0x37')],function(_0x28be73){var _0x1de451={};_0x1de451[_0x28be73]={'$like':'%'+_0x522f3f[_0x8f7c('0x33')]['filter']+'%'};return _0x1de451;})});}_0x42798d=_[_0x8f7c('0x40')]({},_0x42798d,_0x522f3f['options']);return _0x36fbe5['getSounds'](_0x42798d);}})[_0x8f7c('0x24')](function(_0x3814b0){if(_0x3814b0){_0xb8b030=_0x3814b0['length'];if(!_0x522f3f[_0x8f7c('0x33')][_0x8f7c('0x3a')](_0x8f7c('0x3b'))){_0x42798d[_0x8f7c('0x1b')]=qs[_0x8f7c('0x1b')](_0x522f3f[_0x8f7c('0x33')][_0x8f7c('0x1b')]);_0x42798d[_0x8f7c('0x1a')]=qs[_0x8f7c('0x1a')](_0x522f3f['query']['offset']);}return _0x36fbe5[_0x8f7c('0x6d')](_0x42798d);}})[_0x8f7c('0x24')](function(_0x528dd5){if(_0x528dd5){return _0x528dd5?{'count':_0xb8b030,'rows':_0x528dd5}:null;}})[_0x8f7c('0x24')](respondWithResult(_0xa4cb34,null))[_0x8f7c('0x45')](handleError(_0xa4cb34,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 39b24f5..49e45a7 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 _0xaa4c=['path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0xaa4c,0xa3));var _0xcaa4=function(_0x2fb5ca,_0x3c1282){_0x2fb5ca=_0x2fb5ca-0x0;var _0x15376f=_0xaa4c[_0x2fb5ca];return _0x15376f;};'use strict';var _=require(_0xcaa4('0x0'));var util=require(_0xcaa4('0x1'));var logger=require(_0xcaa4('0x2'))(_0xcaa4('0x3'));var moment=require(_0xcaa4('0x4'));var BPromise=require('bluebird');var rp=require(_0xcaa4('0x5'));var fs=require('fs');var path=require(_0xcaa4('0x6'));var rimraf=require(_0xcaa4('0x7'));var config=require('../../config/environment');var attributes=require(_0xcaa4('0x8'));module[_0xcaa4('0x9')]=function(_0x678e20,_0xd8e404){return _0x678e20[_0xcaa4('0xa')](_0xcaa4('0xb'),attributes,{'tableName':_0xcaa4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6baa=['./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x373f3c,_0x44e12b){var _0x555326=function(_0x5dd8d9){while(--_0x5dd8d9){_0x373f3c['push'](_0x373f3c['shift']());}};_0x555326(++_0x44e12b);}(_0x6baa,0xe0));var _0xa6ba=function(_0x203a3e,_0x3295c4){_0x203a3e=_0x203a3e-0x0;var _0x1e555d=_0x6baa[_0x203a3e];return _0x1e555d;};'use strict';var _=require(_0xa6ba('0x0'));var util=require(_0xa6ba('0x1'));var logger=require(_0xa6ba('0x2'))(_0xa6ba('0x3'));var moment=require(_0xa6ba('0x4'));var BPromise=require(_0xa6ba('0x5'));var rp=require(_0xa6ba('0x6'));var fs=require('fs');var path=require(_0xa6ba('0x7'));var rimraf=require(_0xa6ba('0x8'));var config=require(_0xa6ba('0x9'));var attributes=require(_0xa6ba('0xa'));module['exports']=function(_0x56d418,_0x2ac56a){return _0x56d418[_0xa6ba('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0xa6ba('0xc'),'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 146fdd1..77a07f4 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x55c7ce,_0x3622ce){var _0x6b8bb4=function(_0x5ae281){while(--_0x5ae281){_0x55c7ce['push'](_0x55c7ce['shift']());}};_0x6b8bb4(++_0x3622ce);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ 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(_0x48132e,_0x25eded){var _0x2547d7=function(_0x1644c8){while(--_0x1644c8){_0x48132e['push'](_0x48132e['shift']());}};_0x2547d7(++_0x25eded);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 5ad2bdd..4446ac1 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 _0x23fe=['/:id','isAuthenticated','/:id/users','getAgents','/:id/teams','create','post','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','/describe','describe'];(function(_0x58c053,_0x51c43f){var _0xe1079=function(_0x172345){while(--_0x172345){_0x58c053['push'](_0x58c053['shift']());}};_0xe1079(++_0x51c43f);}(_0x23fe,0x102));var _0xe23f=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x23fe[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0xe23f('0x0'));var util=require(_0xe23f('0x1'));var path=require('path');var timeout=require(_0xe23f('0x2'));var express=require(_0xe23f('0x3'));var router=express[_0xe23f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe23f('0x5'));var interaction=require(_0xe23f('0x6'));var config=require(_0xe23f('0x7'));var controller=require(_0xe23f('0x8'));router[_0xe23f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe23f('0xa'),auth['isAuthenticated'](),controller[_0xe23f('0xb')]);router[_0xe23f('0x9')](_0xe23f('0xc'),auth[_0xe23f('0xd')](),controller['show']);router[_0xe23f('0x9')](_0xe23f('0xe'),auth[_0xe23f('0xd')](),controller[_0xe23f('0xf')]);router[_0xe23f('0x9')](_0xe23f('0x10'),auth[_0xe23f('0xd')](),controller['getTeams']);router['post']('/',auth[_0xe23f('0xd')](),controller[_0xe23f('0x11')]);router[_0xe23f('0x12')]('/:id/users',auth[_0xe23f('0xd')](),controller[_0xe23f('0x13')]);router[_0xe23f('0x12')](_0xe23f('0x10'),auth['isAuthenticated'](),controller[_0xe23f('0x14')]);router[_0xe23f('0x15')](_0xe23f('0xc'),auth['isAuthenticated'](),controller[_0xe23f('0x16')]);router['delete'](_0xe23f('0xc'),auth[_0xe23f('0xd')](),controller['destroy']);router[_0xe23f('0x17')](_0xe23f('0xe'),auth[_0xe23f('0xd')](),controller[_0xe23f('0x18')]);router[_0xe23f('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe23f('0x19')]);module[_0xe23f('0x1a')]=router; \ No newline at end of file +var _0x6c84=['/:id/teams','getTeams','post','create','addAgents','addTeams','put','/:id','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x57a1aa,_0x3b6df4){var _0x200e42=function(_0x521aba){while(--_0x521aba){_0x57a1aa['push'](_0x57a1aa['shift']());}};_0x200e42(++_0x3b6df4);}(_0x6c84,0x112));var _0x46c8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6c84[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x46c8('0x0'));var util=require(_0x46c8('0x1'));var path=require(_0x46c8('0x2'));var timeout=require(_0x46c8('0x3'));var express=require(_0x46c8('0x4'));var router=express['Router']();var fs_extra=require(_0x46c8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x46c8('0x6'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x46c8('0x7')]('/',auth[_0x46c8('0x8')](),controller[_0x46c8('0x9')]);router[_0x46c8('0x7')](_0x46c8('0xa'),auth[_0x46c8('0x8')](),controller[_0x46c8('0xb')]);router[_0x46c8('0x7')]('/:id',auth[_0x46c8('0x8')](),controller['show']);router['get']('/:id/users',auth[_0x46c8('0x8')](),controller['getAgents']);router[_0x46c8('0x7')](_0x46c8('0xc'),auth[_0x46c8('0x8')](),controller[_0x46c8('0xd')]);router[_0x46c8('0xe')]('/',auth[_0x46c8('0x8')](),controller[_0x46c8('0xf')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x46c8('0x10')]);router['post'](_0x46c8('0xc'),auth[_0x46c8('0x8')](),controller[_0x46c8('0x11')]);router[_0x46c8('0x12')](_0x46c8('0x13'),auth['isAuthenticated'](),controller[_0x46c8('0x14')]);router[_0x46c8('0x15')]('/:id',auth[_0x46c8('0x8')](),controller[_0x46c8('0x16')]);router['delete']('/:id/users',auth[_0x46c8('0x8')](),controller[_0x46c8('0x17')]);router[_0x46c8('0x15')](_0x46c8('0xc'),auth[_0x46c8('0x8')](),controller[_0x46c8('0x18')]);module[_0x46c8('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b638c78..3caa61f 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 _0x94d9=['STRING','name','VIRTUAL','system-','sequelize','exports'];(function(_0x5deda9,_0xb06c05){var _0x453001=function(_0x35d17e){while(--_0x35d17e){_0x5deda9['push'](_0x5deda9['shift']());}};_0x453001(++_0xb06c05);}(_0x94d9,0x1a8));var _0x994d=function(_0x5c0d98,_0x4b4c50){_0x5c0d98=_0x5c0d98-0x0;var _0x1a41f5=_0x94d9[_0x5c0d98];return _0x1a41f5;};'use strict';var Sequelize=require(_0x994d('0x0'));module[_0x994d('0x1')]={'name':{'type':Sequelize[_0x994d('0x2')],'allowNull':![],'unique':_0x994d('0x3')},'prefix':{'type':Sequelize[_0x994d('0x4')],'get':function(_0x217880){return _0x994d('0x5')+this['getDataValue'](_0x994d('0x3'))+'-';}},'description':{'type':Sequelize[_0x994d('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc25b=['VIRTUAL','system-','getDataValue','sequelize','exports','STRING','name'];(function(_0x146cb2,_0x9db2e3){var _0x59aca6=function(_0x1f2127){while(--_0x1f2127){_0x146cb2['push'](_0x146cb2['shift']());}};_0x59aca6(++_0x9db2e3);}(_0xc25b,0x1a7));var _0xbc25=function(_0x3a2ab9,_0x7d8842){_0x3a2ab9=_0x3a2ab9-0x0;var _0x6bf614=_0xc25b[_0x3a2ab9];return _0x6bf614;};'use strict';var Sequelize=require(_0xbc25('0x0'));module[_0xbc25('0x1')]={'name':{'type':Sequelize[_0xbc25('0x2')],'allowNull':![],'unique':_0xbc25('0x3')},'prefix':{'type':Sequelize[_0xbc25('0x4')],'get':function(_0x5a9457){return _0xbc25('0x5')+this[_0xbc25('0x6')](_0xbc25('0x3'))+'-';}},'description':{'type':Sequelize[_0xbc25('0x2')]},'callerIdAll':{'type':Sequelize[_0xbc25('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index a381602..4f6b2bd 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 _0xd4a2=['appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','goto','charAt','system-','sequelize','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','nolimit','getTeams','Team','Agents','voicePause','interface','flatMap','addTeams','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','isEmpty','eml-format','fast-json-patch','moment','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/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','show','include','options','find','catch','params','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4a2,0x173));var _0x2d4a=function(_0x3d8c82,_0x2ac34b){_0x3d8c82=_0x3d8c82-0x0;var _0x11b6aa=_0xd4a2[_0x3d8c82];return _0x11b6aa;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];config[_0x2d4a('0x17')]=_[_0x2d4a('0x18')](config[_0x2d4a('0x17')],{'host':_0x2d4a('0x19'),'port':0x18eb});var socket=require(_0x2d4a('0x1a'))(new Redis(config[_0x2d4a('0x17')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x2a1d0f,_0x5b6c4f){_0x5b6c4f=_0x5b6c4f||0xcc;return function(_0x11c64a){if(_0x11c64a){return _0x2a1d0f[_0x2d4a('0x1b')](_0x5b6c4f);}return _0x2a1d0f[_0x2d4a('0x1c')](_0x5b6c4f)[_0x2d4a('0x1d')]();};}function respondWithResult(_0x4c5287,_0x5f825d){_0x5f825d=_0x5f825d||0xc8;return function(_0x5a6378){if(_0x5a6378){return _0x4c5287[_0x2d4a('0x1c')](_0x5f825d)['json'](_0x5a6378);}};}function respondWithFilteredResult(_0x435687,_0xd1dd52){return function(_0x2188b2){if(_0x2188b2){var _0x388371=typeof _0xd1dd52['offset']==='undefined'&&typeof _0xd1dd52['limit']===_0x2d4a('0x1e');var _0x1966d1=_0x2188b2[_0x2d4a('0x1f')];var _0x419df5=_0x388371?0x0:_0xd1dd52[_0x2d4a('0x20')];var _0x2e4069=_0x388371?_0x2188b2['count']:_0xd1dd52['offset']+_0xd1dd52[_0x2d4a('0x21')];var _0x1f3e17;if(_0x2e4069>=_0x1966d1){_0x2e4069=_0x1966d1;_0x1f3e17=0xc8;}else{_0x1f3e17=0xce;}_0x435687[_0x2d4a('0x1c')](_0x1f3e17);return _0x435687[_0x2d4a('0x22')](_0x2d4a('0x23'),_0x419df5+'-'+_0x2e4069+'/'+_0x1966d1)[_0x2d4a('0x24')](_0x2188b2);}return null;};}function patchUpdates(_0x22dd0b){return function(_0xa43fb1){try{jsonpatch['apply'](_0xa43fb1,_0x22dd0b,!![]);}catch(_0x26e7b8){return BPromise[_0x2d4a('0x25')](_0x26e7b8);}return _0xa43fb1[_0x2d4a('0x26')]();};}function saveUpdates(_0x42d813,_0x2c845c){return function(_0xed2822){if(_0xed2822){return _0xed2822[_0x2d4a('0x27')](_0x42d813)[_0x2d4a('0x28')](function(_0x54c910){return _0x54c910;});}return null;};}function removeEntity(_0x544b9b,_0x5cc7d8){return function(_0x2bb9f0){if(_0x2bb9f0){return _0x2bb9f0['destroy']()[_0x2d4a('0x28')](function(){var _0x3a2fd3=_0x2bb9f0[_0x2d4a('0x29')]({'plain':!![]});var _0x1d2fa6=_0x2d4a('0x2a');return db[_0x2d4a('0x2b')][_0x2d4a('0x2c')]({'where':{'type':_0x1d2fa6,'resourceId':_0x3a2fd3['id']}})[_0x2d4a('0x28')](function(){return _0x2bb9f0;});})['then'](function(){_0x544b9b[_0x2d4a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x221602,_0x9bac28){return function(_0xc497ce){if(!_0xc497ce){_0x221602[_0x2d4a('0x1b')](0x194);}return _0xc497ce;};}function handleError(_0x101382,_0x1dfc5d){_0x1dfc5d=_0x1dfc5d||0x1f4;return function(_0x25ac5c){logger[_0x2d4a('0x2d')](_0x25ac5c['stack']);if(_0x25ac5c[_0x2d4a('0x2e')]){delete _0x25ac5c[_0x2d4a('0x2e')];}_0x101382[_0x2d4a('0x1c')](_0x1dfc5d)[_0x2d4a('0x2f')](_0x25ac5c);};}exports[_0x2d4a('0x30')]=function(_0x57bf71,_0x217653){var _0x31d8ae={},_0x27015d={},_0x24bcc2={'count':0x0,'rows':[]};var _0x2bb93d=_['map'](db[_0x2d4a('0x31')][_0x2d4a('0x32')],function(_0x46b623){return{'name':_0x46b623[_0x2d4a('0x33')],'type':_0x46b623[_0x2d4a('0x34')][_0x2d4a('0x35')]};});_0x27015d['model']=_[_0x2d4a('0x36')](_0x2bb93d,_0x2d4a('0x2e'));_0x27015d[_0x2d4a('0x37')]=_[_0x2d4a('0x38')](_0x57bf71[_0x2d4a('0x37')]);_0x27015d['filters']=_[_0x2d4a('0x39')](_0x27015d[_0x2d4a('0x3a')],_0x27015d['query']);_0x31d8ae[_0x2d4a('0x3b')]=_[_0x2d4a('0x39')](_0x27015d[_0x2d4a('0x3a')],qs[_0x2d4a('0x3c')](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x3c')]));_0x31d8ae['attributes']=_0x31d8ae[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x31d8ae[_0x2d4a('0x3b')]:_0x27015d[_0x2d4a('0x3a')];if(!_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x3e')]('nolimit')){_0x31d8ae['limit']=qs[_0x2d4a('0x21')](_0x57bf71['query'][_0x2d4a('0x21')]);_0x31d8ae[_0x2d4a('0x20')]=qs['offset'](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x20')]);}_0x31d8ae[_0x2d4a('0x3f')]=qs[_0x2d4a('0x40')](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x40')]);_0x31d8ae[_0x2d4a('0x41')]=qs[_0x2d4a('0x42')](_[_0x2d4a('0x43')](_0x57bf71[_0x2d4a('0x37')],_0x27015d[_0x2d4a('0x42')]),_0x2bb93d);if(_0x57bf71['query'][_0x2d4a('0x44')]){_0x31d8ae[_0x2d4a('0x41')]=_[_0x2d4a('0x45')](_0x31d8ae[_0x2d4a('0x41')],{'$or':_[_0x2d4a('0x36')](_0x2bb93d,function(_0x483a40){if(_0x483a40['type']!=='VIRTUAL'){var _0x5af510={};_0x5af510[_0x483a40[_0x2d4a('0x2e')]]={'$like':'%'+_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x44')]+'%'};return _0x5af510;}})});}_0x31d8ae=_[_0x2d4a('0x45')]({},_0x31d8ae,_0x57bf71['options']);var _0x155f2d={'where':_0x31d8ae[_0x2d4a('0x41')]};return db['VoicePrefix'][_0x2d4a('0x1f')](_0x155f2d)[_0x2d4a('0x28')](function(_0x8a9375){_0x24bcc2[_0x2d4a('0x1f')]=_0x8a9375;if(_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x46')]){_0x31d8ae['include']=[{'all':!![]}];}return db[_0x2d4a('0x31')][_0x2d4a('0x47')](_0x31d8ae);})[_0x2d4a('0x28')](function(_0x365399){_0x24bcc2[_0x2d4a('0x48')]=_0x365399;return _0x24bcc2;})[_0x2d4a('0x28')](respondWithFilteredResult(_0x217653,_0x31d8ae))['catch'](handleError(_0x217653,null));};exports[_0x2d4a('0x49')]=function(_0x1f08a3,_0x10b723){var _0x4e1901={'raw':![],'where':{'id':_0x1f08a3['params']['id']}},_0x2585db={};_0x2585db[_0x2d4a('0x3a')]=_[_0x2d4a('0x38')](db[_0x2d4a('0x31')][_0x2d4a('0x32')]);_0x2585db[_0x2d4a('0x37')]=_['keys'](_0x1f08a3['query']);_0x2585db[_0x2d4a('0x42')]=_[_0x2d4a('0x39')](_0x2585db['model'],_0x2585db[_0x2d4a('0x37')]);_0x4e1901['attributes']=_[_0x2d4a('0x39')](_0x2585db[_0x2d4a('0x3a')],qs[_0x2d4a('0x3c')](_0x1f08a3['query'][_0x2d4a('0x3c')]));_0x4e1901['attributes']=_0x4e1901[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x4e1901[_0x2d4a('0x3b')]:_0x2585db[_0x2d4a('0x3a')];if(_0x1f08a3[_0x2d4a('0x37')][_0x2d4a('0x46')]){_0x4e1901[_0x2d4a('0x4a')]=[{'all':!![]}];}_0x4e1901=_[_0x2d4a('0x45')]({},_0x4e1901,_0x1f08a3[_0x2d4a('0x4b')]);return db[_0x2d4a('0x31')][_0x2d4a('0x4c')](_0x4e1901)['then'](handleEntityNotFound(_0x10b723,null))[_0x2d4a('0x28')](respondWithResult(_0x10b723,null))[_0x2d4a('0x4d')](handleError(_0x10b723,null));};exports[_0x2d4a('0x2c')]=function(_0x1467ab,_0x2d2e24){return db['VoicePrefix'][_0x2d4a('0x4c')]({'where':{'id':_0x1467ab[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x2d2e24,null))[_0x2d4a('0x28')](removeEntity(_0x2d2e24,null))[_0x2d4a('0x4d')](handleError(_0x2d2e24,null));};exports['describe']=function(_0x4b9a52,_0x43e74a){return db[_0x2d4a('0x31')]['describe']()[_0x2d4a('0x28')](respondWithResult(_0x43e74a,null))[_0x2d4a('0x4d')](handleError(_0x43e74a,null));};exports[_0x2d4a('0x4f')]=function(_0x19109b,_0x52a468){var _0x31576d;return db['sequelize'][_0x2d4a('0x50')](function(_0x3fe91b){return db[_0x2d4a('0x31')][_0x2d4a('0x4f')](_0x19109b[_0x2d4a('0x51')],{'transaction':_0x3fe91b})[_0x2d4a('0x28')](function(_0x25fb59){_0x31576d=_0x25fb59[_0x2d4a('0x29')]({'plain':!![]});return db['VoiceExtension'][_0x2d4a('0x4c')]({'where':{'id':_0x31576d[_0x2d4a('0x52')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x67ddff){return createVoicePrefixExtensions(_0x31576d,_0x67ddff,_0x3fe91b);});});})[_0x2d4a('0x28')](function(){var _0x334d6a=_0x19109b[_0x2d4a('0x53')][_0x2d4a('0x29')]({'plain':!![]});if(!_0x334d6a)throw new Error(_0x2d4a('0x54'));if(_0x334d6a[_0x2d4a('0x55')]===_0x2d4a('0x53')){var _0x113bc4=_0x31576d;return db[_0x2d4a('0x56')][_0x2d4a('0x4c')]({'where':{'name':_0x2d4a('0x2a'),'userProfileId':_0x334d6a[_0x2d4a('0x57')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x4cce5e){if(_0x4cce5e&&_0x4cce5e[_0x2d4a('0x58')]===0x0){return db[_0x2d4a('0x2b')]['create']({'name':_0x113bc4[_0x2d4a('0x2e')],'resourceId':_0x113bc4['id'],'type':_0x4cce5e[_0x2d4a('0x2e')],'sectionId':_0x4cce5e['id']},{})[_0x2d4a('0x28')](function(){return _0x31576d;});}else{return _0x31576d;}})[_0x2d4a('0x4d')](function(_0x165c00){logger[_0x2d4a('0x2d')](_0x2d4a('0x59'),_0x165c00);throw _0x165c00;});}return _0x31576d;})[_0x2d4a('0x28')](respondWithResult(_0x52a468,null))[_0x2d4a('0x4d')](handleError(_0x52a468,null));};function Extension(_0x352b50,_0x346f2b,_0x302323,_0x5c7cf9){this[_0x2d4a('0x5a')]=_0x2d4a('0x5b');this['exten']=_0x352b50;this[_0x2d4a('0x5c')]=_0x302323;this[_0x2d4a('0x34')]=_0x2d4a('0x5d');this[_0x2d4a('0x5e')]=_0x2d4a('0x5f');this[_0x2d4a('0x60')]=_0x346f2b;this[_0x2d4a('0x61')]=_0x5c7cf9;}function createVoicePrefixExtensions(_0x43e6a6,_0x1034d2,_0x282df8){return new BPromise(function(_0x5bbc96,_0x2bd137){var _0x8ae6bd=new Extension(formatPrefixName(_0x43e6a6[_0x2d4a('0x62')]),0x1,'NoOp',_0x2d4a('0x63'));_0x8ae6bd[_0x2d4a('0x64')]=_0x43e6a6['id'];return db[_0x2d4a('0x65')][_0x2d4a('0x4f')](_0x8ae6bd,{'transaction':_0x282df8})[_0x2d4a('0x28')](function(_0x278bbc){var _0x7e2699=_0x278bbc[_0x2d4a('0x29')]({'plain':!![]});var _0x1ed616=_['map'](addVoicePrefixExtensions(_0x43e6a6,_0x1034d2),function(_0x21b8e9){_0x21b8e9[_0x2d4a('0x52')]=_0x7e2699['id'];_0x21b8e9[_0x2d4a('0x64')]=_0x43e6a6['id'];return _0x21b8e9;});return db[_0x2d4a('0x65')][_0x2d4a('0x66')](_0x1ed616,{'transaction':_0x282df8})[_0x2d4a('0x28')](function(_0x53f52b){if(!_0x53f52b){return _0x2bd137(_0x2d4a('0x67'));}else{return _0x5bbc96(_0x53f52b);}})[_0x2d4a('0x4d')](function(_0x22707f){return _0x2bd137(_0x22707f);});});;});};function addVoicePrefixExtensions(_0x4809af,_0x465c89){var _0x442691=[];var _0x4f4a09=formatPrefixName(_0x4809af[_0x2d4a('0x62')]);_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x2,'Set',_0x2d4a('0x69')+_0x4809af['name']));if(_0x4809af['callerIdAll']){_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x3,_0x2d4a('0x6a'),_0x2d4a('0x6b')+_0x4809af[_0x2d4a('0x6c')]));}else{_0x442691['push'](new Extension(_0x4f4a09,0x3,_0x2d4a('0x6d'),_0x2d4a('0x6e')));}_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x4,_0x2d4a('0x6f'),_0x465c89['context']+','+'${EXTEN:'+(0x8+_0x4809af[_0x2d4a('0x2e')][_0x2d4a('0x3d')])+'}'+','+0x1));return _0x442691;}function formatPrefixName(_0x2a2441){var _0x2aa9e8='_';for(var _0x9e6321=0x0;_0x9e6321<_0x2a2441[_0x2d4a('0x3d')];_0x9e6321++){if(_0x2a2441[_0x2d4a('0x70')](_0x9e6321)=='-'){_0x2aa9e8+=_0x2a2441['charAt'](_0x9e6321);}else{_0x2aa9e8+='['+_0x2a2441[_0x2d4a('0x70')](_0x9e6321)+']';}}_0x2aa9e8+='.';return _0x2aa9e8;}exports[_0x2d4a('0x27')]=function(_0xf3d514,_0x398439,_0x59810d){var _0x299bdf=_0xf3d514[_0x2d4a('0x51')];_0x299bdf[_0x2d4a('0x62')]=_0x2d4a('0x71')+_0x299bdf['name']+'-';return db[_0x2d4a('0x72')][_0x2d4a('0x50')](function(_0x55d565){return db[_0x2d4a('0x31')][_0x2d4a('0x27')](_0x299bdf,{'where':{'id':_0x299bdf['id']},'transaction':_0x55d565})[_0x2d4a('0x28')](function(){return db['VoiceExtension'][_0x2d4a('0x2c')]({'where':{'VoicePrefixId':_0x299bdf['id']},'transaction':_0x55d565})[_0x2d4a('0x28')](function(){return db[_0x2d4a('0x65')][_0x2d4a('0x4c')]({'where':{'id':_0x299bdf[_0x2d4a('0x52')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x3bc965){return createVoicePrefixExtensions(_0x299bdf,_0x3bc965,_0x55d565);});});});})['then'](function(){return db[_0x2d4a('0x31')][_0x2d4a('0x73')](_0x299bdf['id']);})[_0x2d4a('0x28')](respondWithResult(_0x398439,null))[_0x2d4a('0x4d')](handleError(_0x398439,null));};exports[_0x2d4a('0x74')]=function(_0x55ebbb,_0x38e623,_0x5aead3){return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x55ebbb[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x38e623,null))[_0x2d4a('0x28')](function(_0x2ba9c2){if(_0x2ba9c2){return _0x2ba9c2[_0x2d4a('0x74')](_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')],_[_0x2d4a('0x76')](_0x55ebbb['body'],[_0x2d4a('0x75'),'id'])||{})['spread'](function(_0x3d7d7d){for(var _0x3c284d=0x0;_0x3c284d<_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')][_0x2d4a('0x3d')];_0x3c284d+=0x1){socket[_0x2d4a('0x77')](_0x2d4a('0x78'),{'UserId':Number(_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')][_0x3c284d]),'VoicePrefixId':Number(_0x55ebbb['params']['id'])});}return _0x3d7d7d;});}})[_0x2d4a('0x28')](respondWithResult(_0x38e623,null))[_0x2d4a('0x4d')](handleError(_0x38e623,null));};exports[_0x2d4a('0x79')]=function(_0xcdf787,_0x574285,_0x36d253){return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0xcdf787[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x574285,null))[_0x2d4a('0x28')](function(_0x5769be){if(_0x5769be){return _0x5769be[_0x2d4a('0x79')](_0xcdf787[_0x2d4a('0x37')]['ids'])[_0x2d4a('0x28')](function(){if(_[_0x2d4a('0x7a')](_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')])){for(var _0x429579=0x0;_0x429579<_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')][_0x2d4a('0x3d')];_0x429579+=0x1){socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':Number(_0xcdf787['query'][_0x2d4a('0x75')][_0x429579]),'VoicePrefixId':Number(_0xcdf787['params']['id'])});}}else{socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':Number(_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')]),'VoicePrefixId':Number(_0xcdf787[_0x2d4a('0x4e')]['id'])});}});}})[_0x2d4a('0x28')](respondWithStatusCode(_0x574285,null))[_0x2d4a('0x4d')](handleError(_0x574285,null));};exports['getAgents']=function(_0x119c59,_0x2ebb9e,_0xc11b2e){var _0xfc7b53={};var _0x47377e={};var _0x5e7f23;var _0x4ebda1;return db['VoicePrefix'][_0x2d4a('0x7c')]({'where':{'id':_0x119c59[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x2ebb9e,null))['then'](function(_0x135f58){if(_0x135f58){_0x5e7f23=_0x135f58;_0x47377e[_0x2d4a('0x3a')]=_[_0x2d4a('0x38')](db[_0x2d4a('0x7d')][_0x2d4a('0x32')]);_0x47377e[_0x2d4a('0x37')]=_['keys'](_0x119c59[_0x2d4a('0x37')]);_0x47377e['filters']=_[_0x2d4a('0x39')](_0x47377e[_0x2d4a('0x3a')],_0x47377e['query']);_0xfc7b53[_0x2d4a('0x3b')]=_['intersection'](_0x47377e['model'],qs['fields'](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x3c')]));_0xfc7b53[_0x2d4a('0x3b')]=_0xfc7b53['attributes'][_0x2d4a('0x3d')]?_0xfc7b53[_0x2d4a('0x3b')]:_0x47377e[_0x2d4a('0x3a')];_0xfc7b53[_0x2d4a('0x3f')]=qs['sort'](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x40')]);_0xfc7b53['where']=qs[_0x2d4a('0x42')](_[_0x2d4a('0x43')](_0x119c59['query'],_0x47377e[_0x2d4a('0x42')]));if(_0x119c59['query']['filter']){_0xfc7b53[_0x2d4a('0x41')]=_['merge'](_0xfc7b53[_0x2d4a('0x41')],{'$or':_[_0x2d4a('0x36')](_0xfc7b53[_0x2d4a('0x3b')],function(_0x44d3b3){var _0x5e939f={};_0x5e939f[_0x44d3b3]={'$like':'%'+_0x119c59[_0x2d4a('0x37')]['filter']+'%'};return _0x5e939f;})});}_0xfc7b53=_[_0x2d4a('0x45')]({},_0xfc7b53,_0x119c59[_0x2d4a('0x4b')]);return _0x5e7f23[_0x2d4a('0x7e')](_0xfc7b53);}})[_0x2d4a('0x28')](function(_0x45f6b7){if(_0x45f6b7){_0x4ebda1=_0x45f6b7['length'];if(!_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x3e')](_0x2d4a('0x7f'))){_0xfc7b53['limit']=qs[_0x2d4a('0x21')](_0x119c59['query']['limit']);_0xfc7b53[_0x2d4a('0x20')]=qs[_0x2d4a('0x20')](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x20')]);}return _0x5e7f23[_0x2d4a('0x7e')](_0xfc7b53);}})[_0x2d4a('0x28')](function(_0x2bffb4){if(_0x2bffb4){return _0x2bffb4?{'count':_0x4ebda1,'rows':_0x2bffb4}:null;}})[_0x2d4a('0x28')](respondWithResult(_0x2ebb9e,null))[_0x2d4a('0x4d')](handleError(_0x2ebb9e,null));};exports[_0x2d4a('0x80')]=function(_0x5ecf3e,_0x16c4fd,_0x2b29b1){var _0x4647cb={};var _0x10d86c={};var _0x36b067;var _0x1cb5b3;return db[_0x2d4a('0x31')][_0x2d4a('0x7c')]({'where':{'id':_0x5ecf3e['params']['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x16c4fd,null))[_0x2d4a('0x28')](function(_0xa4c947){if(_0xa4c947){_0x36b067=_0xa4c947;_0x10d86c['model']=_[_0x2d4a('0x38')](db['Team'][_0x2d4a('0x32')]);_0x10d86c[_0x2d4a('0x37')]=_[_0x2d4a('0x38')](_0x5ecf3e[_0x2d4a('0x37')]);_0x10d86c['filters']=_[_0x2d4a('0x39')](_0x10d86c['model'],_0x10d86c[_0x2d4a('0x37')]);_0x4647cb[_0x2d4a('0x3b')]=_[_0x2d4a('0x39')](_0x10d86c['model'],qs[_0x2d4a('0x3c')](_0x5ecf3e['query'][_0x2d4a('0x3c')]));_0x4647cb[_0x2d4a('0x3b')]=_0x4647cb[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x4647cb[_0x2d4a('0x3b')]:_0x10d86c[_0x2d4a('0x3a')];_0x4647cb[_0x2d4a('0x3f')]=qs[_0x2d4a('0x40')](_0x5ecf3e[_0x2d4a('0x37')]['sort']);_0x4647cb['where']=qs['filters'](_[_0x2d4a('0x43')](_0x5ecf3e['query'],_0x10d86c[_0x2d4a('0x42')]));if(_0x5ecf3e['query'][_0x2d4a('0x44')]){_0x4647cb[_0x2d4a('0x41')]=_['merge'](_0x4647cb['where'],{'$or':_[_0x2d4a('0x36')](_0x4647cb['attributes'],function(_0x279c26){var _0x643012={};_0x643012[_0x279c26]={'$like':'%'+_0x5ecf3e[_0x2d4a('0x37')]['filter']+'%'};return _0x643012;})});}_0x4647cb=_[_0x2d4a('0x45')]({},_0x4647cb,_0x5ecf3e[_0x2d4a('0x4b')]);return _0x36b067[_0x2d4a('0x80')](_0x4647cb);}})[_0x2d4a('0x28')](function(_0x1c3c0f){if(_0x1c3c0f){_0x1cb5b3=_0x1c3c0f[_0x2d4a('0x3d')];if(!_0x5ecf3e[_0x2d4a('0x37')][_0x2d4a('0x3e')](_0x2d4a('0x7f'))){_0x4647cb[_0x2d4a('0x21')]=qs[_0x2d4a('0x21')](_0x5ecf3e[_0x2d4a('0x37')]['limit']);_0x4647cb[_0x2d4a('0x20')]=qs[_0x2d4a('0x20')](_0x5ecf3e[_0x2d4a('0x37')]['offset']);}return _0x36b067[_0x2d4a('0x80')](_0x4647cb);}})[_0x2d4a('0x28')](function(_0x250a9c){if(_0x250a9c){return _0x250a9c?{'count':_0x1cb5b3,'rows':_0x250a9c}:null;}})[_0x2d4a('0x28')](respondWithResult(_0x16c4fd,null))[_0x2d4a('0x4d')](handleError(_0x16c4fd,null));};exports['addTeams']=function(_0x438769,_0x1483af,_0x5413c1){var _0x2d5122=_0x438769['body'][_0x2d4a('0x75')];var _0x1cd7fd;return db[_0x2d4a('0x81')][_0x2d4a('0x47')]({'where':{'id':_0x2d5122},'attributes':['id'],'include':[{'model':db[_0x2d4a('0x7d')],'as':_0x2d4a('0x82'),'attributes':['id',_0x2d4a('0x2e'),'online',_0x2d4a('0x83'),_0x2d4a('0x84')],'raw':!![]}]})[_0x2d4a('0x28')](function(_0x1e5be2){if(_0x1e5be2){_0x1cd7fd=_0x1e5be2;var _0x139e4e=_[_0x2d4a('0x85')](_0x1e5be2,function(_0x58b196){var _0x23577f=_0x58b196[_0x2d4a('0x29')]({'plain':!![]});return _0x23577f[_0x2d4a('0x82')];});return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x438769['params']['id']}})['then'](function(_0x3e276d){return db[_0x2d4a('0x72')][_0x2d4a('0x50')](function(_0x2fee11){return _0x3e276d[_0x2d4a('0x86')](_0x2d5122,{'transaction':_0x2fee11})[_0x2d4a('0x28')](function(){return BPromise[_0x2d4a('0x87')](_0x1cd7fd,function(_0x1adcbc){return db[_0x2d4a('0x88')]['upsert']({'TeamId':_0x1adcbc['id'],'VoicePrefixId':_0x438769['params']['id']},{'transaction':_0x2fee11});});})[_0x2d4a('0x28')](function(){return BPromise[_0x2d4a('0x87')](_0x139e4e,function(_0x3b4585){return db[_0x2d4a('0x89')][_0x2d4a('0x8a')]({'where':{'UserId':_0x3b4585['id'],'VoicePrefixId':_0x438769[_0x2d4a('0x4e')]['id']},'transaction':_0x2fee11});});})[_0x2d4a('0x28')](function(){_0x139e4e[_0x2d4a('0x8b')](function(_0x12914d){socket[_0x2d4a('0x77')](_0x2d4a('0x78'),{'UserId':_0x12914d['id'],'VoicePrefixId':_0x3e276d['id']});});});});});}})[_0x2d4a('0x28')](respondWithStatusCode(_0x1483af,null))['catch'](handleError(_0x1483af,null));};exports['removeTeams']=function(_0x51cba2,_0x448b4d,_0x4cefec){return db['Team'][_0x2d4a('0x47')]({'where':{'id':_0x51cba2[_0x2d4a('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2d4a('0x28')](handleEntityNotFound(_0x448b4d,null))[_0x2d4a('0x28')](function(_0x1e05c5){var _0x3e199a=_[_0x2d4a('0x36')](_0x1e05c5,'id');var _0x357dfc=[];var _0xd80165=[];var _0x448664=squel[_0x2d4a('0x8c')]();_0x448664[_0x2d4a('0x8d')]('tq.TeamId')[_0x2d4a('0x8e')](_0x2d4a('0x8f'),'tq')[_0x2d4a('0x90')](_0x2d4a('0x91'),'ut',_0x2d4a('0x92'))[_0x2d4a('0x41')]('VoicePrefixId\x20=\x20?',_0x51cba2[_0x2d4a('0x4e')]['id']);for(var _0x3030e1=0x0;_0x3030e1<_0x1e05c5['length'];_0x3030e1+=0x1){let _0xc5500=_0x1e05c5[_0x3030e1];for(var _0xe198b=0x0;_0xe198b<_0xc5500['Agents']['length'];_0xe198b+=0x1){let _0x497b03=_0xc5500['Agents'][_0xe198b];var _0xb81202=_0x448664['clone']();_0xb81202[_0x2d4a('0x41')](_0x2d4a('0x93'),_0x497b03['id']);_0xd80165[_0x2d4a('0x68')](db[_0x2d4a('0x72')][_0x2d4a('0x37')](_0xb81202[_0x2d4a('0x94')](),{'type':db[_0x2d4a('0x72')]['QueryTypes'][_0x2d4a('0x95')]})['then'](function(_0x2b6040){if(_0x2b6040[_0x2d4a('0x3d')]===0x1){return _0x497b03['id'];}else{var _0x137c57=_[_0x2d4a('0x96')](_[_0x2d4a('0x36')](_0x2b6040,_0x2d4a('0x97')),function(_0x29108f){return _['includes'](_0x3e199a,_0x29108f);});if(_0x137c57){return _0x497b03['id'];}}}));}}return BPromise[_0x2d4a('0x98')](_0xd80165)['then'](function(_0x1d4cc3){_0x357dfc=_(_0x357dfc)[_0x2d4a('0x99')](_0x1d4cc3)[_0x2d4a('0x9a')]()['value']();return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x51cba2[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](function(_0x108cd1){return db[_0x2d4a('0x72')]['transaction'](function(_0x29a294){return _0x108cd1['removeTeams'](_0x51cba2[_0x2d4a('0x37')]['ids'],{'transaction':_0x29a294})['then'](function(){if(!_[_0x2d4a('0x9b')](_0x357dfc)){return _0x108cd1['removeAgents'](_0x357dfc,{'transaction':_0x29a294});}})['then'](function(){_0x357dfc[_0x2d4a('0x8b')](function(_0x206717){socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':_0x206717,'VoicePrefixId':_0x108cd1['id']});});});});});});})[_0x2d4a('0x28')](respondWithStatusCode(_0x448b4d,null))[_0x2d4a('0x4d')](handleError(_0x448b4d,null));}; \ No newline at end of file +var _0x4991=['VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','describe','create','transaction','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','NoOp','goto','context','charAt','system-','findById','addAgents','ids','omit','emit','isArray','userVoicePrefix:remove','getAgents','findOne','pick','getTeams','Team','findAll','User','interface','Agents','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','every','includes','all','union','compact','value','isEmpty','removeAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','map'];(function(_0x4e63f1,_0x34a2db){var _0xdbd910=function(_0x40261f){while(--_0x40261f){_0x4e63f1['push'](_0x4e63f1['shift']());}};_0xdbd910(++_0x34a2db);}(_0x4991,0xf7));var _0x1499=function(_0x1e364e,_0x293295){_0x1e364e=_0x1e364e-0x0;var _0x4cd19d=_0x4991[_0x1e364e];return _0x4cd19d;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1499('0x17')]=_[_0x1499('0x18')](config[_0x1499('0x17')],{'host':_0x1499('0x19'),'port':0x18eb});var socket=require(_0x1499('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x1499('0x1b')](socket);function respondWithStatusCode(_0x4e5195,_0x37d99e){_0x37d99e=_0x37d99e||0xcc;return function(_0x12cde0){if(_0x12cde0){return _0x4e5195[_0x1499('0x1c')](_0x37d99e);}return _0x4e5195[_0x1499('0x1d')](_0x37d99e)['end']();};}function respondWithResult(_0x1ed43b,_0x373f57){_0x373f57=_0x373f57||0xc8;return function(_0x592c27){if(_0x592c27){return _0x1ed43b[_0x1499('0x1d')](_0x373f57)[_0x1499('0x1e')](_0x592c27);}};}function respondWithFilteredResult(_0x46b364,_0xc92272){return function(_0x1e45a9){if(_0x1e45a9){var _0x27e533=typeof _0xc92272['offset']==='undefined'&&typeof _0xc92272['limit']===_0x1499('0x1f');var _0xad534b=_0x1e45a9['count'];var _0x351da9=_0x27e533?0x0:_0xc92272[_0x1499('0x20')];var _0x28dff3=_0x27e533?_0x1e45a9[_0x1499('0x21')]:_0xc92272[_0x1499('0x20')]+_0xc92272[_0x1499('0x22')];var _0x2b0458;if(_0x28dff3>=_0xad534b){_0x28dff3=_0xad534b;_0x2b0458=0xc8;}else{_0x2b0458=0xce;}_0x46b364[_0x1499('0x1d')](_0x2b0458);return _0x46b364[_0x1499('0x23')](_0x1499('0x24'),_0x351da9+'-'+_0x28dff3+'/'+_0xad534b)[_0x1499('0x1e')](_0x1e45a9);}return null;};}function patchUpdates(_0x836081){return function(_0x223f4c){try{jsonpatch[_0x1499('0x25')](_0x223f4c,_0x836081,!![]);}catch(_0x4ec57a){return BPromise[_0x1499('0x26')](_0x4ec57a);}return _0x223f4c[_0x1499('0x27')]();};}function saveUpdates(_0x5615b4,_0x258e9c){return function(_0xc79f69){if(_0xc79f69){return _0xc79f69[_0x1499('0x28')](_0x5615b4)[_0x1499('0x29')](function(_0x3968e0){return _0x3968e0;});}return null;};}function removeEntity(_0x16d036,_0x54f3c2){return function(_0x501c0d){if(_0x501c0d){return _0x501c0d[_0x1499('0x2a')]()[_0x1499('0x29')](function(){var _0x3b9259=_0x501c0d[_0x1499('0x2b')]({'plain':!![]});var _0x32782a='VoicePrefixes';return db[_0x1499('0x2c')]['destroy']({'where':{'type':_0x32782a,'resourceId':_0x3b9259['id']}})['then'](function(){return _0x501c0d;});})['then'](function(){_0x16d036[_0x1499('0x1d')](0xcc)[_0x1499('0x2d')]();});}};}function handleEntityNotFound(_0x40932a,_0x1b460b){return function(_0x3dad86){if(!_0x3dad86){_0x40932a[_0x1499('0x1c')](0x194);}return _0x3dad86;};}function handleError(_0x3dd534,_0x5d3ec5){_0x5d3ec5=_0x5d3ec5||0x1f4;return function(_0x180171){logger[_0x1499('0x2e')](_0x180171[_0x1499('0x2f')]);if(_0x180171['name']){delete _0x180171[_0x1499('0x30')];}_0x3dd534[_0x1499('0x1d')](_0x5d3ec5)['send'](_0x180171);};}exports[_0x1499('0x31')]=function(_0x72ad,_0x497efd){var _0x464c5a={},_0x2eda80={},_0x15cc57={'count':0x0,'rows':[]};var _0x39f74f=_[_0x1499('0x32')](db[_0x1499('0x33')][_0x1499('0x34')],function(_0x18b662){return{'name':_0x18b662[_0x1499('0x35')],'type':_0x18b662[_0x1499('0x36')][_0x1499('0x37')]};});_0x2eda80[_0x1499('0x38')]=_[_0x1499('0x32')](_0x39f74f,_0x1499('0x30'));_0x2eda80[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x72ad[_0x1499('0x39')]);_0x2eda80[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],_0x2eda80['query']);_0x464c5a[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],qs[_0x1499('0x3e')](_0x72ad[_0x1499('0x39')][_0x1499('0x3e')]));_0x464c5a[_0x1499('0x3d')]=_0x464c5a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x464c5a[_0x1499('0x3d')]:_0x2eda80[_0x1499('0x38')];if(!_0x72ad['query']['hasOwnProperty'](_0x1499('0x40'))){_0x464c5a['limit']=qs[_0x1499('0x22')](_0x72ad['query'][_0x1499('0x22')]);_0x464c5a[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x72ad[_0x1499('0x39')]['offset']);}_0x464c5a[_0x1499('0x41')]=qs['sort'](_0x72ad[_0x1499('0x39')][_0x1499('0x42')]);_0x464c5a[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x72ad[_0x1499('0x39')],_0x2eda80[_0x1499('0x3b')]),_0x39f74f);if(_0x72ad[_0x1499('0x39')][_0x1499('0x44')]){_0x464c5a['where']=_[_0x1499('0x45')](_0x464c5a['where'],{'$or':_[_0x1499('0x32')](_0x39f74f,function(_0x38f449){if(_0x38f449[_0x1499('0x36')]!==_0x1499('0x46')){var _0x3ed978={};_0x3ed978[_0x38f449[_0x1499('0x30')]]={'$like':'%'+_0x72ad[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x3ed978;}})});}_0x464c5a=_[_0x1499('0x45')]({},_0x464c5a,_0x72ad[_0x1499('0x47')]);var _0x5ab521={'where':_0x464c5a[_0x1499('0x43')]};return db['VoicePrefix'][_0x1499('0x21')](_0x5ab521)[_0x1499('0x29')](function(_0x5646cf){_0x15cc57[_0x1499('0x21')]=_0x5646cf;if(_0x72ad[_0x1499('0x39')][_0x1499('0x48')]){_0x464c5a[_0x1499('0x49')]=[{'all':!![]}];}return db[_0x1499('0x33')]['findAll'](_0x464c5a);})['then'](function(_0x368fdb){_0x15cc57[_0x1499('0x4a')]=_0x368fdb;return _0x15cc57;})['then'](respondWithFilteredResult(_0x497efd,_0x464c5a))[_0x1499('0x4b')](handleError(_0x497efd,null));};exports[_0x1499('0x4c')]=function(_0x4a5529,_0x5de9b6){var _0x3814aa={'raw':![],'where':{'id':_0x4a5529[_0x1499('0x4d')]['id']}},_0x177147={};_0x177147['model']=_[_0x1499('0x3a')](db[_0x1499('0x33')][_0x1499('0x34')]);_0x177147[_0x1499('0x39')]=_['keys'](_0x4a5529[_0x1499('0x39')]);_0x177147[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],_0x177147['query']);_0x3814aa[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],qs['fields'](_0x4a5529['query'][_0x1499('0x3e')]));_0x3814aa['attributes']=_0x3814aa[_0x1499('0x3d')][_0x1499('0x3f')]?_0x3814aa[_0x1499('0x3d')]:_0x177147[_0x1499('0x38')];if(_0x4a5529[_0x1499('0x39')][_0x1499('0x48')]){_0x3814aa[_0x1499('0x49')]=[{'all':!![]}];}_0x3814aa=_['merge']({},_0x3814aa,_0x4a5529[_0x1499('0x47')]);return db['VoicePrefix'][_0x1499('0x4e')](_0x3814aa)[_0x1499('0x29')](handleEntityNotFound(_0x5de9b6,null))['then'](respondWithResult(_0x5de9b6,null))[_0x1499('0x4b')](handleError(_0x5de9b6,null));};exports[_0x1499('0x2a')]=function(_0x3de674,_0x4d1d24){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x3de674[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x4d1d24,null))[_0x1499('0x29')](removeEntity(_0x4d1d24,null))[_0x1499('0x4b')](handleError(_0x4d1d24,null));};exports[_0x1499('0x4f')]=function(_0x3b7a6b,_0x28822a){return db[_0x1499('0x33')]['describe']()[_0x1499('0x29')](respondWithResult(_0x28822a,null))[_0x1499('0x4b')](handleError(_0x28822a,null));};exports[_0x1499('0x50')]=function(_0x4dc648,_0x339471){var _0x2a7614;return db['sequelize'][_0x1499('0x51')](function(_0x162ddb){return db['VoicePrefix'][_0x1499('0x50')](_0x4dc648[_0x1499('0x52')],{'transaction':_0x162ddb})[_0x1499('0x29')](function(_0x30b27b){_0x2a7614=_0x30b27b[_0x1499('0x2b')]({'plain':!![]});return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x2a7614['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x2a9f23){return createVoicePrefixExtensions(_0x2a7614,_0x2a9f23,_0x162ddb);});});})[_0x1499('0x29')](function(){var _0x175b8d=_0x4dc648['user']['get']({'plain':!![]});if(!_0x175b8d)throw new Error(_0x1499('0x54'));if(_0x175b8d[_0x1499('0x55')]==='user'){var _0x3c3a20=_0x2a7614;return db[_0x1499('0x56')][_0x1499('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x175b8d['userProfileId']},'raw':!![]})['then'](function(_0x308ce2){if(_0x308ce2&&_0x308ce2[_0x1499('0x57')]===0x0){return db[_0x1499('0x2c')]['create']({'name':_0x3c3a20[_0x1499('0x30')],'resourceId':_0x3c3a20['id'],'type':_0x308ce2['name'],'sectionId':_0x308ce2['id']},{})[_0x1499('0x29')](function(){return _0x2a7614;});}else{return _0x2a7614;}})[_0x1499('0x4b')](function(_0x2fc6f9){logger[_0x1499('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fc6f9);throw _0x2fc6f9;});}return _0x2a7614;})['then'](respondWithResult(_0x339471,null))['catch'](handleError(_0x339471,null));};function Extension(_0x403832,_0x42629d,_0x1e9261,_0x28866f){this['context']=_0x1499('0x58');this[_0x1499('0x59')]=_0x403832;this['app']=_0x1e9261;this[_0x1499('0x36')]='system';this[_0x1499('0x5a')]=_0x1499('0x5b');this[_0x1499('0x5c')]=_0x42629d;this['appdata']=_0x28866f;}function createVoicePrefixExtensions(_0x739e63,_0xca5326,_0x253706){return new BPromise(function(_0x5b2dab,_0x761610){var _0x3ff1ce=new Extension(formatPrefixName(_0x739e63[_0x1499('0x5d')]),0x1,'NoOp',_0x1499('0x5e'));_0x3ff1ce[_0x1499('0x5f')]=_0x739e63['id'];return db[_0x1499('0x53')][_0x1499('0x50')](_0x3ff1ce,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x96a0ed){var _0x5c61dc=_0x96a0ed[_0x1499('0x2b')]({'plain':!![]});var _0x10b49f=_['map'](addVoicePrefixExtensions(_0x739e63,_0xca5326),function(_0x3839da){_0x3839da[_0x1499('0x60')]=_0x5c61dc['id'];_0x3839da[_0x1499('0x5f')]=_0x739e63['id'];return _0x3839da;});return db[_0x1499('0x53')][_0x1499('0x61')](_0x10b49f,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x5e5ee4){if(!_0x5e5ee4){return _0x761610(_0x1499('0x62'));}else{return _0x5b2dab(_0x5e5ee4);}})[_0x1499('0x4b')](function(_0x4eec83){return _0x761610(_0x4eec83);});});;});};function addVoicePrefixExtensions(_0x4a0487,_0x1ff29d){var _0x314d88=[];var _0x502474=formatPrefixName(_0x4a0487[_0x1499('0x5d')]);_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x2,_0x1499('0x64'),_0x1499('0x65')+_0x4a0487[_0x1499('0x30')]));if(_0x4a0487['callerIdAll']){_0x314d88['push'](new Extension(_0x502474,0x3,_0x1499('0x64'),'PREFIX-CALLERIDALL='+_0x4a0487['callerIdAll']));}else{_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x3,_0x1499('0x66'),'No\x20callerid\x20available'));}_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x4,_0x1499('0x67'),_0x1ff29d[_0x1499('0x68')]+','+'${EXTEN:'+(0x8+_0x4a0487['name'][_0x1499('0x3f')])+'}'+','+0x1));return _0x314d88;}function formatPrefixName(_0x2f3a3a){var _0x256893='_';for(var _0x392f6f=0x0;_0x392f6f<_0x2f3a3a[_0x1499('0x3f')];_0x392f6f++){if(_0x2f3a3a['charAt'](_0x392f6f)=='-'){_0x256893+=_0x2f3a3a[_0x1499('0x69')](_0x392f6f);}else{_0x256893+='['+_0x2f3a3a[_0x1499('0x69')](_0x392f6f)+']';}}_0x256893+='.';return _0x256893;}exports['update']=function(_0x358a76,_0x20e5f3,_0x44d970){var _0x5741e5=_0x358a76[_0x1499('0x52')];_0x5741e5[_0x1499('0x5d')]=_0x1499('0x6a')+_0x5741e5[_0x1499('0x30')]+'-';return db['sequelize'][_0x1499('0x51')](function(_0x74e09b){return db[_0x1499('0x33')]['update'](_0x5741e5,{'where':{'id':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x2a')]({'where':{'VoicePrefixId':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x5741e5['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x57e25b){return createVoicePrefixExtensions(_0x5741e5,_0x57e25b,_0x74e09b);});});});})['then'](function(){return db[_0x1499('0x33')][_0x1499('0x6b')](_0x5741e5['id']);})[_0x1499('0x29')](respondWithResult(_0x20e5f3,null))['catch'](handleError(_0x20e5f3,null));};exports['addAgents']=function(_0x320654,_0xb4a84b,_0x494d88){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x320654[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0xb4a84b,null))[_0x1499('0x29')](function(_0x3f6f36){if(_0x3f6f36){return _0x3f6f36[_0x1499('0x6c')](_0x320654['body'][_0x1499('0x6d')],_[_0x1499('0x6e')](_0x320654['body'],[_0x1499('0x6d'),'id'])||{})['spread'](function(_0x25a8c4){for(var _0x375576=0x0;_0x375576<_0x320654[_0x1499('0x52')][_0x1499('0x6d')]['length'];_0x375576+=0x1){socket[_0x1499('0x6f')]('userVoicePrefix:save',{'UserId':Number(_0x320654[_0x1499('0x52')]['ids'][_0x375576]),'VoicePrefixId':Number(_0x320654[_0x1499('0x4d')]['id'])});}return _0x25a8c4;});}})[_0x1499('0x29')](respondWithResult(_0xb4a84b,null))[_0x1499('0x4b')](handleError(_0xb4a84b,null));};exports['removeAgents']=function(_0x2349d7,_0x44511c,_0x585fe8){return db['VoicePrefix'][_0x1499('0x4e')]({'where':{'id':_0x2349d7['params']['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x44511c,null))['then'](function(_0x917508){if(_0x917508){return _0x917508['removeAgents'](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])[_0x1499('0x29')](function(){if(_[_0x1499('0x70')](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])){for(var _0x114aea=0x0;_0x114aea<_0x2349d7[_0x1499('0x39')]['ids'][_0x1499('0x3f')];_0x114aea+=0x1){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':Number(_0x2349d7['query'][_0x1499('0x6d')][_0x114aea]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}}else{socket['emit'](_0x1499('0x71'),{'UserId':Number(_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}});}})[_0x1499('0x29')](respondWithStatusCode(_0x44511c,null))['catch'](handleError(_0x44511c,null));};exports[_0x1499('0x72')]=function(_0x53700c,_0x5ed058,_0x5cc567){var _0x2a0525={};var _0x362d8c={};var _0x419d9a;var _0x23dfc0;return db[_0x1499('0x33')][_0x1499('0x73')]({'where':{'id':_0x53700c['params']['id']}})['then'](handleEntityNotFound(_0x5ed058,null))[_0x1499('0x29')](function(_0x20e0d7){if(_0x20e0d7){_0x419d9a=_0x20e0d7;_0x362d8c['model']=_[_0x1499('0x3a')](db['User'][_0x1499('0x34')]);_0x362d8c['query']=_[_0x1499('0x3a')](_0x53700c['query']);_0x362d8c[_0x1499('0x3b')]=_['intersection'](_0x362d8c[_0x1499('0x38')],_0x362d8c[_0x1499('0x39')]);_0x2a0525['attributes']=_[_0x1499('0x3c')](_0x362d8c[_0x1499('0x38')],qs['fields'](_0x53700c[_0x1499('0x39')][_0x1499('0x3e')]));_0x2a0525[_0x1499('0x3d')]=_0x2a0525[_0x1499('0x3d')][_0x1499('0x3f')]?_0x2a0525[_0x1499('0x3d')]:_0x362d8c[_0x1499('0x38')];_0x2a0525['order']=qs[_0x1499('0x42')](_0x53700c[_0x1499('0x39')]['sort']);_0x2a0525[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x53700c[_0x1499('0x39')],_0x362d8c[_0x1499('0x3b')]));if(_0x53700c['query'][_0x1499('0x44')]){_0x2a0525[_0x1499('0x43')]=_[_0x1499('0x45')](_0x2a0525[_0x1499('0x43')],{'$or':_[_0x1499('0x32')](_0x2a0525[_0x1499('0x3d')],function(_0x1f4794){var _0x43b74b={};_0x43b74b[_0x1f4794]={'$like':'%'+_0x53700c['query'][_0x1499('0x44')]+'%'};return _0x43b74b;})});}_0x2a0525=_[_0x1499('0x45')]({},_0x2a0525,_0x53700c[_0x1499('0x47')]);return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x3fa3a4){if(_0x3fa3a4){_0x23dfc0=_0x3fa3a4['length'];if(!_0x53700c['query']['hasOwnProperty'](_0x1499('0x40'))){_0x2a0525[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x53700c[_0x1499('0x39')][_0x1499('0x22')]);_0x2a0525[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x53700c[_0x1499('0x39')]['offset']);}return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x59a12f){if(_0x59a12f){return _0x59a12f?{'count':_0x23dfc0,'rows':_0x59a12f}:null;}})['then'](respondWithResult(_0x5ed058,null))[_0x1499('0x4b')](handleError(_0x5ed058,null));};exports['getTeams']=function(_0x52282e,_0x5666f5,_0x63c7b3){var _0x118d7a={};var _0x23fd46={};var _0x30ba76;var _0x3c91d2;return db['VoicePrefix']['findOne']({'where':{'id':_0x52282e[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x5666f5,null))[_0x1499('0x29')](function(_0x497619){if(_0x497619){_0x30ba76=_0x497619;_0x23fd46[_0x1499('0x38')]=_['keys'](db['Team'][_0x1499('0x34')]);_0x23fd46['query']=_[_0x1499('0x3a')](_0x52282e['query']);_0x23fd46[_0x1499('0x3b')]=_['intersection'](_0x23fd46[_0x1499('0x38')],_0x23fd46[_0x1499('0x39')]);_0x118d7a['attributes']=_[_0x1499('0x3c')](_0x23fd46['model'],qs[_0x1499('0x3e')](_0x52282e[_0x1499('0x39')][_0x1499('0x3e')]));_0x118d7a[_0x1499('0x3d')]=_0x118d7a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x118d7a[_0x1499('0x3d')]:_0x23fd46[_0x1499('0x38')];_0x118d7a[_0x1499('0x41')]=qs[_0x1499('0x42')](_0x52282e[_0x1499('0x39')][_0x1499('0x42')]);_0x118d7a[_0x1499('0x43')]=qs['filters'](_[_0x1499('0x74')](_0x52282e[_0x1499('0x39')],_0x23fd46[_0x1499('0x3b')]));if(_0x52282e[_0x1499('0x39')]['filter']){_0x118d7a[_0x1499('0x43')]=_[_0x1499('0x45')](_0x118d7a['where'],{'$or':_['map'](_0x118d7a[_0x1499('0x3d')],function(_0x1fbf21){var _0x2d4e5a={};_0x2d4e5a[_0x1fbf21]={'$like':'%'+_0x52282e[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x2d4e5a;})});}_0x118d7a=_[_0x1499('0x45')]({},_0x118d7a,_0x52282e[_0x1499('0x47')]);return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})[_0x1499('0x29')](function(_0x2dd404){if(_0x2dd404){_0x3c91d2=_0x2dd404['length'];if(!_0x52282e['query']['hasOwnProperty'](_0x1499('0x40'))){_0x118d7a[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x52282e[_0x1499('0x39')][_0x1499('0x22')]);_0x118d7a[_0x1499('0x20')]=qs['offset'](_0x52282e[_0x1499('0x39')][_0x1499('0x20')]);}return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})['then'](function(_0x4a11e4){if(_0x4a11e4){return _0x4a11e4?{'count':_0x3c91d2,'rows':_0x4a11e4}:null;}})[_0x1499('0x29')](respondWithResult(_0x5666f5,null))[_0x1499('0x4b')](handleError(_0x5666f5,null));};exports['addTeams']=function(_0x47f7e8,_0x4e5f60,_0x2f9c93){var _0x23e2c6=_0x47f7e8['body'][_0x1499('0x6d')];var _0x7dd273;return db[_0x1499('0x76')][_0x1499('0x77')]({'where':{'id':_0x23e2c6},'attributes':['id'],'include':[{'model':db[_0x1499('0x78')],'as':'Agents','attributes':['id','name','online','voicePause',_0x1499('0x79')],'raw':!![]}]})[_0x1499('0x29')](function(_0x14e4e8){if(_0x14e4e8){_0x7dd273=_0x14e4e8;var _0x5a675b=_['flatMap'](_0x14e4e8,function(_0x479936){var _0x2add75=_0x479936[_0x1499('0x2b')]({'plain':!![]});return _0x2add75[_0x1499('0x7a')];});return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x47f7e8[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](function(_0x420576){return db[_0x1499('0x7b')]['transaction'](function(_0x3f5aab){return _0x420576['addTeams'](_0x23e2c6,{'transaction':_0x3f5aab})[_0x1499('0x29')](function(){return BPromise[_0x1499('0x7c')](_0x7dd273,function(_0x425dac){return db[_0x1499('0x7d')][_0x1499('0x7e')]({'TeamId':_0x425dac['id'],'VoicePrefixId':_0x47f7e8[_0x1499('0x4d')]['id']},{'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){return BPromise['each'](_0x5a675b,function(_0x56507a){return db[_0x1499('0x7f')][_0x1499('0x80')]({'where':{'UserId':_0x56507a['id'],'VoicePrefixId':_0x47f7e8['params']['id']},'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){_0x5a675b[_0x1499('0x81')](function(_0x477bb9){socket['emit']('userVoicePrefix:save',{'UserId':_0x477bb9['id'],'VoicePrefixId':_0x420576['id']});});});});});}})[_0x1499('0x29')](respondWithStatusCode(_0x4e5f60,null))['catch'](handleError(_0x4e5f60,null));};exports[_0x1499('0x82')]=function(_0x3f366a,_0x11ef6,_0x548faf){return db['Team']['findAll']({'where':{'id':_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1499('0x7a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x11ef6,null))['then'](function(_0x10f4cf){var _0x5d1170=_['map'](_0x10f4cf,'id');var _0x52de11=[];var _0x2e39ac=[];var _0x4a9e81=squel[_0x1499('0x83')]();_0x4a9e81[_0x1499('0x84')](_0x1499('0x85'))[_0x1499('0x86')](_0x1499('0x87'),'tq')['join'](_0x1499('0x88'),'ut',_0x1499('0x89'))[_0x1499('0x43')]('VoicePrefixId\x20=\x20?',_0x3f366a[_0x1499('0x4d')]['id']);for(var _0x772b0c=0x0;_0x772b0c<_0x10f4cf[_0x1499('0x3f')];_0x772b0c+=0x1){let _0x27135a=_0x10f4cf[_0x772b0c];for(var _0x1e9c28=0x0;_0x1e9c28<_0x27135a[_0x1499('0x7a')][_0x1499('0x3f')];_0x1e9c28+=0x1){let _0x2c1793=_0x27135a['Agents'][_0x1e9c28];var _0x39d6a9=_0x4a9e81[_0x1499('0x8a')]();_0x39d6a9[_0x1499('0x43')]('ut.UserId\x20=\x20?',_0x2c1793['id']);_0x2e39ac[_0x1499('0x63')](db[_0x1499('0x7b')][_0x1499('0x39')](_0x39d6a9[_0x1499('0x8b')](),{'type':db[_0x1499('0x7b')][_0x1499('0x8c')]['SELECT']})[_0x1499('0x29')](function(_0x18d9bc){if(_0x18d9bc['length']===0x1){return _0x2c1793['id'];}else{var _0x271d85=_[_0x1499('0x8d')](_[_0x1499('0x32')](_0x18d9bc,'TeamId'),function(_0x53659b){return _[_0x1499('0x8e')](_0x5d1170,_0x53659b);});if(_0x271d85){return _0x2c1793['id'];}}}));}}return BPromise[_0x1499('0x8f')](_0x2e39ac)[_0x1499('0x29')](function(_0x6478eb){_0x52de11=_(_0x52de11)[_0x1499('0x90')](_0x6478eb)[_0x1499('0x91')]()[_0x1499('0x92')]();return db[_0x1499('0x33')]['find']({'where':{'id':_0x3f366a['params']['id']}})['then'](function(_0x335af4){return db[_0x1499('0x7b')]['transaction'](function(_0x2c5702){return _0x335af4['removeTeams'](_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')],{'transaction':_0x2c5702})['then'](function(){if(!_[_0x1499('0x93')](_0x52de11)){return _0x335af4[_0x1499('0x94')](_0x52de11,{'transaction':_0x2c5702});}})[_0x1499('0x29')](function(){_0x52de11['forEach'](function(_0x3e7f29){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':_0x3e7f29,'VoicePrefixId':_0x335af4['id']});});});});});});})[_0x1499('0x29')](respondWithStatusCode(_0x11ef6,null))[_0x1499('0x4b')](handleError(_0x11ef6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index bc711d6..a24dd5d 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 _0xe6d1=['events','../../mysqldb','VoicePrefix','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xe6d1,0x118));var _0x1e6d=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xe6d1[_0x29d94e];return _0x106237;};'use strict';var EventEmitter=require(_0x1e6d('0x0'));var VoicePrefix=require(_0x1e6d('0x1'))['db'][_0x1e6d('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1e6d('0x3'),'afterUpdate':_0x1e6d('0x4'),'afterDestroy':_0x1e6d('0x5')};function emitEvent(_0x5ae789){return function(_0x412575,_0x3efc25,_0x3c34d8){VoicePrefixEvents[_0x1e6d('0x6')](_0x5ae789+':'+_0x412575['id'],_0x412575);VoicePrefixEvents[_0x1e6d('0x6')](_0x5ae789,_0x412575);_0x3c34d8(null);};}for(var e in events){if(events[_0x1e6d('0x7')](e)){var event=events[e];VoicePrefix[_0x1e6d('0x8')](e,emitEvent(event));}}module[_0x1e6d('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x0335=['exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','hasOwnProperty','hook'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0335,0xd9));var _0x5033=function(_0x2dc069,_0x9fe901){_0x2dc069=_0x2dc069-0x0;var _0x24a59d=_0x0335[_0x2dc069];return _0x24a59d;};'use strict';var EventEmitter=require(_0x5033('0x0'));var VoicePrefix=require(_0x5033('0x1'))['db'][_0x5033('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x5033('0x3')](0x0);var events={'afterCreate':_0x5033('0x4'),'afterUpdate':_0x5033('0x5'),'afterDestroy':'remove'};function emitEvent(_0x69abb2){return function(_0x46db70,_0x4ccd59,_0x27276b){VoicePrefixEvents['emit'](_0x69abb2+':'+_0x46db70['id'],_0x46db70);VoicePrefixEvents['emit'](_0x69abb2,_0x46db70);_0x27276b(null);};}for(var e in events){if(events[_0x5033('0x6')](e)){var event=events[e];VoicePrefix[_0x5033('0x7')](e,emitEvent(event));}}module[_0x5033('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d7c0024..3d78f3c 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 _0x0bb1=['../../config/environment','./voicePrefix.attributes','define','VoicePrefix','lodash','../../config/logger','moment','request-promise','rimraf'];(function(_0x2e37d2,_0x30d735){var _0x16541e=function(_0xe997de){while(--_0xe997de){_0x2e37d2['push'](_0x2e37d2['shift']());}};_0x16541e(++_0x30d735);}(_0x0bb1,0x9d));var _0x10bb=function(_0x5e944a,_0x2847b4){_0x5e944a=_0x5e944a-0x0;var _0x38f07b=_0x0bb1[_0x5e944a];return _0x38f07b;};'use strict';var _=require(_0x10bb('0x0'));var util=require('util');var logger=require(_0x10bb('0x1'))('api');var moment=require(_0x10bb('0x2'));var BPromise=require('bluebird');var rp=require(_0x10bb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10bb('0x4'));var config=require(_0x10bb('0x5'));var attributes=require(_0x10bb('0x6'));module['exports']=function(_0x2fac57,_0x1f297a){return _0x2fac57[_0x10bb('0x7')](_0x10bb('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e9c=['request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','moment','bluebird'];(function(_0x55ac26,_0x3ce839){var _0x47adc1=function(_0x2f95de){while(--_0x2f95de){_0x55ac26['push'](_0x55ac26['shift']());}};_0x47adc1(++_0x3ce839);}(_0x4e9c,0x159));var _0xc4e9=function(_0x2a8879,_0x4afe54){_0x2a8879=_0x2a8879-0x0;var _0x30c04c=_0x4e9c[_0x2a8879];return _0x30c04c;};'use strict';var _=require(_0xc4e9('0x0'));var util=require('util');var logger=require(_0xc4e9('0x1'))(_0xc4e9('0x2'));var moment=require(_0xc4e9('0x3'));var BPromise=require(_0xc4e9('0x4'));var rp=require(_0xc4e9('0x5'));var fs=require('fs');var path=require(_0xc4e9('0x6'));var rimraf=require(_0xc4e9('0x7'));var config=require(_0xc4e9('0x8'));var attributes=require(_0xc4e9('0x9'));module[_0xc4e9('0xa')]=function(_0x14d79b,_0x472cae){return _0x14d79b[_0xc4e9('0xb')](_0xc4e9('0xc'),attributes,{'tableName':_0xc4e9('0xd'),'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 b897498..fc01ba7 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 _0xdf55=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring'];(function(_0xeefec8,_0x180a75){var _0x4ce5d1=function(_0x164775){while(--_0x164775){_0xeefec8['push'](_0xeefec8['shift']());}};_0x4ce5d1(++_0x180a75);}(_0xdf55,0x83));var _0x5df5=function(_0x3a90b6,_0x782086){_0x3a90b6=_0x3a90b6-0x0;var _0x56f71a=_0xdf55[_0x3a90b6];return _0x56f71a;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});config[_0x5df5('0xb')]=_[_0x5df5('0xc')](config[_0x5df5('0xb')],{'host':_0x5df5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5df5('0xb')]));require(_0x5df5('0xe'))[_0x5df5('0xf')](socket);function respondWithRpcPromise(_0x4787f1,_0x52ed26,_0x39711b){return new BPromise(function(_0x4e80bd,_0x45ad13){return client[_0x5df5('0x10')](_0x4787f1,_0x39711b)['then'](function(_0x59d273){logger[_0x5df5('0x11')](_0x5df5('0x12'),_0x52ed26,_0x5df5('0x13'));logger[_0x5df5('0x14')](_0x5df5('0x15'),_0x52ed26,_0x5df5('0x13'),JSON[_0x5df5('0x16')](_0x59d273));if(_0x59d273[_0x5df5('0x17')]){if(_0x59d273[_0x5df5('0x17')][_0x5df5('0x18')]===0x1f4){logger['error'](_0x5df5('0x12'),_0x52ed26,_0x59d273['error'][_0x5df5('0x19')]);return _0x45ad13(_0x59d273[_0x5df5('0x17')][_0x5df5('0x19')]);}logger[_0x5df5('0x17')](_0x5df5('0x12'),_0x52ed26,_0x59d273['error'][_0x5df5('0x19')]);return _0x4e80bd(_0x59d273[_0x5df5('0x17')]['message']);}else{logger[_0x5df5('0x11')](_0x5df5('0x12'),_0x52ed26,_0x5df5('0x13'));_0x4e80bd(_0x59d273[_0x5df5('0x1a')][_0x5df5('0x19')]);}})['catch'](function(_0x589093){logger[_0x5df5('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x52ed26,_0x589093);_0x45ad13(_0x589093);});});} \ No newline at end of file +var _0x6bab=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x457d42,_0x122187){var _0x51b2ab=function(_0x89a26b){while(--_0x89a26b){_0x457d42['push'](_0x457d42['shift']());}};_0x51b2ab(++_0x122187);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x6bab[_0x4f5108];return _0x2d56ca;};'use strict';var _=require(_0xb6ba('0x0'));var util=require(_0xb6ba('0x1'));var moment=require(_0xb6ba('0x2'));var BPromise=require(_0xb6ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6ba('0x4'));var db=require(_0xb6ba('0x5'))['db'];var utils=require(_0xb6ba('0x6'));var logger=require(_0xb6ba('0x7'))(_0xb6ba('0x8'));var config=require('../../config/environment');var jayson=require(_0xb6ba('0x9'));var client=jayson['client'][_0xb6ba('0xa')]({'port':0x232a});config[_0xb6ba('0xb')]=_[_0xb6ba('0xc')](config[_0xb6ba('0xb')],{'host':_0xb6ba('0xd'),'port':0x18eb});var socket=require(_0xb6ba('0xe'))(new Redis(config[_0xb6ba('0xb')]));require(_0xb6ba('0xf'))[_0xb6ba('0x10')](socket);function respondWithRpcPromise(_0x5ae28b,_0x16cb3a,_0x55a4b0){return new BPromise(function(_0x5c4eac,_0x5c556d){return client[_0xb6ba('0x11')](_0x5ae28b,_0x55a4b0)[_0xb6ba('0x12')](function(_0x1cb42c){logger['info'](_0xb6ba('0x13'),_0x16cb3a,_0xb6ba('0x14'));logger[_0xb6ba('0x15')](_0xb6ba('0x16'),_0x16cb3a,_0xb6ba('0x14'),JSON[_0xb6ba('0x17')](_0x1cb42c));if(_0x1cb42c[_0xb6ba('0x18')]){if(_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x19')]===0x1f4){logger[_0xb6ba('0x18')](_0xb6ba('0x13'),_0x16cb3a,_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x1a')]);return _0x5c556d(_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x1a')]);}logger[_0xb6ba('0x18')](_0xb6ba('0x13'),_0x16cb3a,_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x1a')]);return _0x5c4eac(_0x1cb42c['error'][_0xb6ba('0x1a')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x16cb3a,_0xb6ba('0x14'));_0x5c4eac(_0x1cb42c[_0xb6ba('0x1b')]['message']);}})[_0xb6ba('0x1c')](function(_0xf1e2f8){logger['error'](_0xb6ba('0x13'),_0x16cb3a,_0xf1e2f8);_0x5c556d(_0xf1e2f8);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7e7c963..91ef560 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 _0x6427=['update','removeListener','register','length','save','remove'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x6427,0xbe));var _0x7642=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x6427[_0x2dea24];return _0x309d58;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x7642('0x0'),_0x7642('0x1'),_0x7642('0x2')];function createListener(_0x36924b,_0x11ec1a){return function(_0x439df4){_0x11ec1a['emit'](_0x36924b,_0x439df4);};}function removeListener(_0x325bbc,_0x33af1f){return function(){VoicePrefixEvents[_0x7642('0x3')](_0x325bbc,_0x33af1f);};}exports[_0x7642('0x4')]=function(_0x2e2fa7){for(var _0x3788b1=0x0,_0x1cd5f4=events[_0x7642('0x5')];_0x3788b1<_0x1cd5f4;_0x3788b1++){var _0xd37092=events[_0x3788b1];var _0x30946f=createListener('voicePrefix:'+_0xd37092,_0x2e2fa7);VoicePrefixEvents['on'](_0xd37092,_0x30946f);}}; \ No newline at end of file +var _0xbb95=['voicePrefix:','./voicePrefix.events','save','emit','register','length'];(function(_0x3f164b,_0x530893){var _0x3f5c03=function(_0x1730dc){while(--_0x1730dc){_0x3f164b['push'](_0x3f164b['shift']());}};_0x3f5c03(++_0x530893);}(_0xbb95,0x7f));var _0x5bb9=function(_0x4ce237,_0x29373d){_0x4ce237=_0x4ce237-0x0;var _0x3ea6ca=_0xbb95[_0x4ce237];return _0x3ea6ca;};'use strict';var VoicePrefixEvents=require(_0x5bb9('0x0'));var events=[_0x5bb9('0x1'),'remove','update'];function createListener(_0x15492a,_0x2a9386){return function(_0x535716){_0x2a9386[_0x5bb9('0x2')](_0x15492a,_0x535716);};}function removeListener(_0x572ef3,_0x4ef42d){return function(){VoicePrefixEvents['removeListener'](_0x572ef3,_0x4ef42d);};}exports[_0x5bb9('0x3')]=function(_0x2b72aa){for(var _0x49b590=0x0,_0x180e69=events[_0x5bb9('0x4')];_0x49b590<_0x180e69;_0x49b590++){var _0x39f347=events[_0x49b590];var _0x5e8b1c=createListener(_0x5bb9('0x5')+_0x39f347,_0x2b72aa);VoicePrefixEvents['on'](_0x39f347,_0x5e8b1c);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 543120f..b486707 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(_0x3eee78,_0x5acc63){var _0x53a5e5=function(_0x472fb6){while(--_0x472fb6){_0x3eee78['push'](_0x3eee78['shift']());}};_0x53a5e5(++_0x5acc63);}(_0xb10b,0x12a));var _0xbb10=function(_0x41d9e7,_0x33ef4a){_0x41d9e7=_0x41d9e7-0x0;var _0x282c36=_0xb10b[_0x41d9e7];return _0x282c36;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x2fdaff,_0x27a994){var _0x3cf2e2=function(_0x2c514c){while(--_0x2c514c){_0x2fdaff['push'](_0x2fdaff['shift']());}};_0x3cf2e2(++_0x27a994);}(_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['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index abd316e..fb1e76e 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 _0x4e34=['AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','name','inbound','ENUM','ringall','random','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','outbound','preview','booked','roundrobin','INTEGER','yes','once','periodic_announce','split','joinempty','leavewhenempty','join','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','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)'];(function(_0x4fa1e9,_0x33cf28){var _0x487606=function(_0x21d3c6){while(--_0x21d3c6){_0x4fa1e9['push'](_0x4fa1e9['shift']());}};_0x487606(++_0x33cf28);}(_0x4e34,0xf6));var _0x44e3=function(_0x2b3110,_0x139b73){_0x2b3110=_0x2b3110-0x0;var _0x459f82=_0x4e34[_0x2b3110];return _0x459f82;};'use strict';var Sequelize=require(_0x44e3('0x0'));module['exports']={'name':{'type':Sequelize[_0x44e3('0x1')],'allowNull':![],'unique':_0x44e3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x44e3('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x44e3('0x3')},'musiconhold':{'type':Sequelize[_0x44e3('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x44e3('0x4')]('rr',_0x44e3('0x5'),'leastrecent','fewestcalls',_0x44e3('0x6'),'rrmemory',_0x44e3('0x7'),_0x44e3('0x8'),_0x44e3('0x9')),'allowNull':![],'defaultValue':'ringall','set':function(_0x520ef5){this[_0x44e3('0xa')](_0x44e3('0xb'),_0x520ef5?_0x520ef5:_0x44e3('0xc'));},'get':function(){var _0x4d6278=this[_0x44e3('0xd')](_0x44e3('0xe'));var _0x477833=this[_0x44e3('0xd')](_0x44e3('0xf'));var _0x182ed9=this[_0x44e3('0xd')](_0x44e3('0xb'));if(_0x4d6278===_0x44e3('0x10')){if(_0x477833===_0x44e3('0x11')){return null;}if(_0x477833===_0x44e3('0x12')&&![_0x44e3('0xc'),_0x44e3('0x13')]['includes'](_0x182ed9)){this[_0x44e3('0xa')](_0x44e3('0xb'),_0x44e3('0xc'));}}return _0x182ed9;}},'servicelevel':{'type':Sequelize[_0x44e3('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x44e3('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x44e3('0x14')](0xb)},'timeout':{'type':Sequelize[_0x44e3('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x44e3('0x1')]},'weight':{'type':Sequelize[_0x44e3('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x44e3('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x15'),'no'),'defaultValue':_0x44e3('0x15')},'autopause':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x44e3('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x44e3('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x44e3('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x44e3('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x44e3('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x44e3('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x44e3('0x15')},'announce_holdtime':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x15'),'no',_0x44e3('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x44e3('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x44e3('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x44e3('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x44e3('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x44e3('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x44e3('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x44e3('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x44e3('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x44e3('0x1')]},'queue_less_than':{'type':Sequelize[_0x44e3('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x3b2c43){this[_0x44e3('0xa')](_0x44e3('0x17'),_0x3b2c43?_0x3b2c43['join'](','):[]);},'get':function(){return this[_0x44e3('0xd')]('periodic_announce')?this['getDataValue']('periodic_announce')[_0x44e3('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0x44e3('0x1')],'defaultValue':'yes','set':function(_0x5ee4e9){this[_0x44e3('0xa')](_0x44e3('0x19'),_0x5ee4e9?_0x5ee4e9['join'](','):undefined);},'get':function(){return this[_0x44e3('0xd')](_0x44e3('0x19'))?this[_0x44e3('0xd')](_0x44e3('0x19'))[_0x44e3('0x18')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x2ccc42){this['setDataValue'](_0x44e3('0x1a'),_0x2ccc42?_0x2ccc42[_0x44e3('0x1b')](','):undefined);},'get':function(){return this[_0x44e3('0xd')]('leavewhenempty')?this[_0x44e3('0xd')](_0x44e3('0x1a'))[_0x44e3('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x44e3('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x44e3('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x44e3('0x1')]},'description':{'type':Sequelize[_0x44e3('0x1')]},'acw':{'type':Sequelize[_0x44e3('0x1c')],'defaultValue':0x0,'set':function(_0xe18be5){this['setDataValue'](_0x44e3('0x1d'),_0xe18be5);if(_0xe18be5){if(this[_0x44e3('0xd')](_0x44e3('0x1e'))<0x2){this[_0x44e3('0xa')](_0x44e3('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x44e3('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x44e3('0x1f')},'dialMethod':{'type':Sequelize['ENUM'](_0x44e3('0x11'),_0x44e3('0x20'),_0x44e3('0x21'),_0x44e3('0x22'),'booked'),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x44e3('0x14')](0x4)[_0x44e3('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x44e3('0x14')](0x4)[_0x44e3('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x44e3('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x44e3('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x44e3('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x26'),_0x44e3('0x27')),'defaultValue':_0x44e3('0x27'),'comment':_0x44e3('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x44e3('0x29')](0x2)[_0x44e3('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x44e3('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x44e3('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x44e3('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x44e3('0x1')],'defaultValue':_0x44e3('0x2c'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x44e3('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x44e3('0x2d')},'dialQueueProject':{'type':Sequelize[_0x44e3('0x1')],'comment':_0x44e3('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x44e3('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x44e3('0x14')](0x5)[_0x44e3('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x44e3('0x14')](0x3)[_0x44e3('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x44e3('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x44e3('0x14')](0x5)[_0x44e3('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x44e3('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x44e3('0x14')](0x3)[_0x44e3('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x44e3('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x44e3('0x31')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x44e3('0x32')},'dialTimezone':{'type':Sequelize[_0x44e3('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x44e3('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x44e3('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x33'),_0x44e3('0x34'),_0x44e3('0x35')),'defaultValue':_0x44e3('0x33')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x44e3('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x44e3('0x36')},'dialAMDGreeting':{'type':Sequelize[_0x44e3('0x14')](0x9)[_0x44e3('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x44e3('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x44e3('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x44e3('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x44e3('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x44e3('0x39')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x44e3('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x44e3('0x14')](0x9)[_0x44e3('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x44e3('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x44e3('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x44e3('0x14')](0x5)[_0x44e3('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x44e3('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x44e3('0x14')](0x9)[_0x44e3('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x44e3('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x44e3('0x14')](0x5)[_0x44e3('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x44e3('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x44e3('0x1c')],'defaultValue':0x0,'comment':_0x44e3('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x44e3('0x4')](_0x44e3('0x3f'),_0x44e3('0x40')),'defaultValue':_0x44e3('0x3f')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x44e3('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x44e3('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x44e3('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x44e3('0x14')](0x3)[_0x44e3('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x44e3('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x44e3('0x14')](0x3)[_0x44e3('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x44e3('0x14')](0x5)[_0x44e3('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x44e3('0x42')},'dialDropMaxRetry':{'type':Sequelize[_0x44e3('0x14')](0x3)[_0x44e3('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x44e3('0x43')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x44e3('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x44e3('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x44e3('0x14')](0x3)[_0x44e3('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x44e3('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x44e3('0x14')](0x5)[_0x44e3('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x44e3('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x44e3('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0x44e3('0x14')](0x5)[_0x44e3('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x44e3('0x14')](0x3)[_0x44e3('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x44e3('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x44e3('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x44e3('0x47'),'set':function(_0x29f17f){if(!_0x29f17f)this[_0x44e3('0xa')](_0x44e3('0x48'),null);this['setDataValue']('mandatoryDisposition',_0x29f17f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x44e3('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x44e3('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x44e3('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x44e3('0x14')](0x3)[_0x44e3('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x86c9=['join','periodic_announce','split','joinempty','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','predictive','booked','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview','roundrobin','includes','INTEGER','yes','once','TEXT'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x86c9,0x178));var _0x986c=function(_0x316dd9,_0x3b9921){_0x316dd9=_0x316dd9-0x0;var _0x345c07=_0x86c9[_0x316dd9];return _0x345c07;};'use strict';var Sequelize=require(_0x986c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x2'),_0x986c('0x3')),'allowNull':![],'defaultValue':_0x986c('0x2')},'musiconhold':{'type':Sequelize[_0x986c('0x4')],'defaultValue':_0x986c('0x5')},'announce':{'type':Sequelize[_0x986c('0x4')],'defaultValue':''},'strategy':{'type':Sequelize[_0x986c('0x1')]('rr',_0x986c('0x6'),_0x986c('0x7'),_0x986c('0x8'),_0x986c('0x9'),_0x986c('0xa'),'linear',_0x986c('0xb'),_0x986c('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x236fca){this[_0x986c('0xd')](_0x986c('0xe'),_0x236fca?_0x236fca:_0x986c('0xa'));},'get':function(){var _0x16c817=this[_0x986c('0xf')]('type');var _0x23abf4=this[_0x986c('0xf')](_0x986c('0x10'));var _0x125d16=this[_0x986c('0xf')](_0x986c('0xe'));if(_0x16c817===_0x986c('0x3')){if(_0x23abf4===_0x986c('0x11')){return null;}if(_0x23abf4==='booked'&&!['rrmemory',_0x986c('0x12')][_0x986c('0x13')](_0x125d16)){this[_0x986c('0xd')]('strategy','rrmemory');}}return _0x125d16;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x986c('0x14')](0xb)},'timeout':{'type':Sequelize[_0x986c('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x986c('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x986c('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x986c('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x986c('0x1')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x986c('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x986c('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x986c('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x986c('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x986c('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x986c('0x1')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x986c('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x986c('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x986c('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x986c('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x986c('0x1')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x986c('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x986c('0x4')]},'queue_youarenext':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x986c('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x986c('0x4')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x986c('0x4')]},'queue_less_than':{'type':Sequelize[_0x986c('0x4')]},'periodic_announce':{'type':Sequelize[_0x986c('0x17')],'set':function(_0x319d1b){this[_0x986c('0xd')]('periodic_announce',_0x319d1b?_0x319d1b[_0x986c('0x18')](','):[]);},'get':function(){return this[_0x986c('0xf')](_0x986c('0x19'))?this[_0x986c('0xf')](_0x986c('0x19'))[_0x986c('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x986c('0x4')],'defaultValue':_0x986c('0x15'),'set':function(_0xa57a45){this['setDataValue'](_0x986c('0x1b'),_0xa57a45?_0xa57a45[_0x986c('0x18')](','):undefined);},'get':function(){return this[_0x986c('0xf')](_0x986c('0x1b'))?this[_0x986c('0xf')](_0x986c('0x1b'))[_0x986c('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x986c('0x4')],'defaultValue':'no','set':function(_0xbda38){this[_0x986c('0xd')](_0x986c('0x1c'),_0xbda38?_0xbda38['join'](','):undefined);},'get':function(){return this[_0x986c('0xf')](_0x986c('0x1c'))?this[_0x986c('0xf')](_0x986c('0x1c'))[_0x986c('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x986c('0x4')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x4c70dd){this[_0x986c('0xd')]('acw',_0x4c70dd);if(_0x4c70dd){if(this[_0x986c('0xf')]('wrapuptime')<0x2){this['setDataValue'](_0x986c('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':0x0,'comment':_0x986c('0x1f')},'dialMethod':{'type':Sequelize['ENUM'](_0x986c('0x11'),_0x986c('0x20'),'power',_0x986c('0x21'),_0x986c('0x22')),'defaultValue':_0x986c('0x20'),'comment':_0x986c('0x23')},'dialLimitChannel':{'type':Sequelize[_0x986c('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x986c('0x24')},'dialLimitQueue':{'type':Sequelize[_0x986c('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x986c('0x25')](0x2)[_0x986c('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x986c('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x28'),_0x986c('0x29')),'defaultValue':_0x986c('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x986c('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x986c('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x986c('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x986c('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986c('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x986c('0x2d'),'comment':_0x986c('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986c('0x2f')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x986c('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986c('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'comment':_0x986c('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x986c('0x35')},'dialTimezone':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x986c('0x4')],'defaultValue':_0x986c('0x36')},'dialPrefix':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x37'),'never',_0x986c('0x38')),'defaultValue':_0x986c('0x37')},'dialAMDActive':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':0x0,'comment':_0x986c('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x986c('0x14')](0x9)[_0x986c('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x986c('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x986c('0x14')](0x9)[_0x986c('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x986c('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x986c('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x986c('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x986c('0x14')](0x9)[_0x986c('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x986c('0x14')](0x9)[_0x986c('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x986c('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x986c('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x986c('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x986c('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x986c('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x986c('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x986c('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x986c('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':0x0,'comment':_0x986c('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x986c('0x43'),_0x986c('0x44')),'defaultValue':_0x986c('0x43')},'dialQueueProject2':{'type':Sequelize[_0x986c('0x4')],'comment':_0x986c('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x986c('0x45')},'dialCutDigit':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986c('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986c('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x986c('0x14')],'allowNull':!![],'comment':_0x986c('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':![],'comment':_0x986c('0x4d'),'set':function(_0x4140b4){if(!_0x4140b4)this[_0x986c('0xd')](_0x986c('0x4e'),null);this[_0x986c('0xd')](_0x986c('0x4f'),_0x4140b4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 2656dcc..c62105f 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 _0x7217=['toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','emit','userVoiceQueue:remove','addAgents','isEmpty','removeAgents','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','fromQuery','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=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','type','find','name','UserProfileResource','end','error','send','index','VoiceQueue','fieldName','getOptions','where','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','options','create','user','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','body','merge','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','pick','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','online','flatMap','penalty','sequelize','transaction','addTeams','upsert','each','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','forEach','userVoiceQueue:save','removeTeams','Agents','select','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0x7217,0x19e));var _0x7721=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x7217[_0x18a79d];return _0x4f8848;};'use strict';var moment=require(_0x7721('0x0'));var BPromise=require('bluebird');var util=require(_0x7721('0x1'));var _=require(_0x7721('0x2'));var squel=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var qs=require(_0x7721('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x7721('0x6'));var db=require(_0x7721('0x7'))['db'];config[_0x7721('0x8')]=_[_0x7721('0x9')](config[_0x7721('0x8')],{'host':_0x7721('0xa'),'port':0x18eb});var socket=require(_0x7721('0xb'))(new Redis(config[_0x7721('0x8')]));require(_0x7721('0xc'))[_0x7721('0xd')](socket);function respondWithStatusCode(_0x3e6368,_0x2a66cb){_0x2a66cb=_0x2a66cb||0xcc;return function(_0xfa8835){if(_0xfa8835){return _0x3e6368[_0x7721('0xe')](_0x2a66cb);}return _0x3e6368[_0x7721('0xf')](_0x2a66cb)['end']();};}function respondWithResult(_0x461d1a,_0x29bc8f){_0x29bc8f=_0x29bc8f||0xc8;return function(_0x8729a6){if(_0x8729a6){return _0x461d1a[_0x7721('0xf')](_0x29bc8f)[_0x7721('0x10')](_0x8729a6);}};}function respondWithFilteredResult(_0x409b37,_0x1e7fd7){return function(_0x27b36b){if(_0x27b36b){var _0x55b4ca=typeof _0x1e7fd7[_0x7721('0x11')]===_0x7721('0x12')&&typeof _0x1e7fd7['limit']===_0x7721('0x12');var _0x30da54=_0x27b36b[_0x7721('0x13')];var _0x2e9752=_0x55b4ca?0x0:_0x1e7fd7['offset'];var _0x3cbce8=_0x55b4ca?_0x27b36b[_0x7721('0x13')]:_0x1e7fd7['offset']+_0x1e7fd7['limit'];var _0x4b183e;if(_0x3cbce8>=_0x30da54){_0x3cbce8=_0x30da54;_0x4b183e=0xc8;}else{_0x4b183e=0xce;}_0x409b37[_0x7721('0xf')](_0x4b183e);return _0x409b37[_0x7721('0x14')](_0x7721('0x15'),_0x2e9752+'-'+_0x3cbce8+'/'+_0x30da54)[_0x7721('0x10')](_0x27b36b);}return null;};}function saveUpdates(_0x5ed94b){return function(_0x20f669){if(_0x20f669){return _0x20f669['update'](_0x5ed94b)[_0x7721('0x16')](function(_0x5cb0e6){return _0x5cb0e6;});}return null;};}function removeEntity(_0xfec626){return function(_0x4e96fb){if(_0x4e96fb){return _0x4e96fb[_0x7721('0x17')]()[_0x7721('0x16')](function(){var _0x2286e5=_0x4e96fb[_0x7721('0x18')]({'plain':!![]});var _0x402820=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a'),'ignore':![]},{'name':_0x7721('0x1b'),'value':'outbound','ignore':![]}];var _0x288f7e=_(_0x402820)[_0x7721('0x1c')](_0x7721('0x1d'))[_0x7721('0x1e')]('value')[_0x7721('0x1f')]();if(_['includes'](_0x288f7e,_0x2286e5[_0x7721('0x20')])){return;}var _0x288e3a=_[_0x7721('0x21')](_0x402820,[_0x7721('0x1f'),_0x2286e5[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x23')]['destroy']({'where':{'type':_0x288e3a,'resourceId':_0x2286e5['id']}})[_0x7721('0x16')](function(){return _0x4e96fb;});})[_0x7721('0x16')](function(){_0xfec626[_0x7721('0xf')](0xcc)[_0x7721('0x24')]();});}};}function handleEntityNotFound(_0x40d550){return function(_0x16355a){if(!_0x16355a){_0x40d550[_0x7721('0xe')](0x194);}return _0x16355a;};}function handleError(_0xf753f1,_0x40f367){_0x40f367=_0x40f367||0x1f4;return function(_0x52316e){logger[_0x7721('0x25')](_0x52316e['stack']);if(_0x52316e['name']){delete _0x52316e[_0x7721('0x22')];}_0xf753f1[_0x7721('0xf')](_0x40f367)[_0x7721('0x26')](_0x52316e);};}exports[_0x7721('0x27')]=function(_0x1ea4d,_0x37b9f0){var _0xd7d703={};var _0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x1e')](db[_0x7721('0x28')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x29')],'type':_0x4a25c9[_0x7721('0x20')]['key']};});_0xd7d703=qs[_0x7721('0x2a')](_0x5c54f0,_0x1ea4d);var _0x4651b5={'where':_0xd7d703[_0x7721('0x2b')]};return db['VoiceQueue'][_0x7721('0x13')](_0x4651b5)[_0x7721('0x16')](function(_0x1492d4){_0x1da2d8[_0x7721('0x13')]=_0x1492d4;_0xd7d703[_0x7721('0x2c')]=qs['include'](_0x1ea4d[_0x7721('0x2d')]);return db[_0x7721('0x28')][_0x7721('0x2e')](_0xd7d703);})['then'](function(_0x35de7a){_0x1da2d8[_0x7721('0x2f')]=_0x35de7a;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x37b9f0,_0xd7d703))[_0x7721('0x30')](handleError(_0x37b9f0,null));};exports['show']=function(_0x2d6ba0,_0x326c50){var _0x19d082={'raw':![],'where':{'id':_0x2d6ba0[_0x7721('0x31')]['id']}},_0x1d894b={};_0x1d894b[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x28')][_0x7721('0x34')]);_0x1d894b[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x2d6ba0['query']);_0x1d894b[_0x7721('0x35')]=_['intersection'](_0x1d894b[_0x7721('0x32')],_0x1d894b[_0x7721('0x2d')]);_0x19d082[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1d894b[_0x7721('0x32')],qs[_0x7721('0x38')](_0x2d6ba0['query']['fields']));_0x19d082['attributes']=_0x19d082['attributes'][_0x7721('0x39')]?_0x19d082[_0x7721('0x36')]:_0x1d894b[_0x7721('0x32')];if(_0x2d6ba0[_0x7721('0x2d')]['includeAll']){_0x19d082[_0x7721('0x2c')]=[{'all':!![]}];}_0x19d082=_['merge']({},_0x19d082,_0x2d6ba0[_0x7721('0x3a')]);return db[_0x7721('0x28')]['find'](_0x19d082)[_0x7721('0x16')](handleEntityNotFound(_0x326c50,null))[_0x7721('0x16')](respondWithResult(_0x326c50,null))['catch'](handleError(_0x326c50,null));};exports['create']=function(_0x3d84d3,_0xfc4dc4){return db[_0x7721('0x28')][_0x7721('0x3b')](_0x3d84d3['body'],{})[_0x7721('0x16')](function(_0x120de9){var _0x40ce8c=_0x3d84d3[_0x7721('0x3c')][_0x7721('0x18')]({'plain':!![]});if(!_0x40ce8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40ce8c[_0x7721('0x3d')]==='user'){var _0xaa3216=_0x120de9['get']({'plain':!![]});var _0x2333b8=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':'QueueCampaigns','value':_0x7721('0x3e')}];var _0x11d853=_[_0x7721('0x21')](_0x2333b8,['value',_0xaa3216[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x11d853,'userProfileId':_0x40ce8c[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x463ccc){if(_0x463ccc&&_0x463ccc['autoAssociation']===0x0){return db['UserProfileResource'][_0x7721('0x3b')]({'name':_0xaa3216[_0x7721('0x22')],'resourceId':_0xaa3216['id'],'type':_0x463ccc[_0x7721('0x22')],'sectionId':_0x463ccc['id']},{})[_0x7721('0x16')](function(){return _0x120de9;});}else{return _0x120de9;}})[_0x7721('0x30')](function(_0x15181b){logger[_0x7721('0x25')](_0x7721('0x41'),_0x15181b);throw _0x15181b;});}return _0x120de9;})[_0x7721('0x16')](respondWithResult(_0xfc4dc4,0xc9))[_0x7721('0x30')](handleError(_0xfc4dc4,null));};exports['clone']=function(_0x578867,_0x5ed70d){var _0x6a4664={'where':{'id':_0x578867[_0x7721('0x31')]['id']}},_0x151f69={};_0x151f69['model']=_[_0x7721('0x33')](db[_0x7721('0x28')]['rawAttributes']);_0x6a4664[_0x7721('0x36')]=_['intersection'](_0x151f69[_0x7721('0x32')],qs['fields'](_0x578867[_0x7721('0x2d')][_0x7721('0x38')]));_0x6a4664[_0x7721('0x36')]=_0x6a4664['attributes'][_0x7721('0x39')]?_0x6a4664[_0x7721('0x36')]:_0x151f69['model'];if(_0x578867[_0x7721('0x2d')][_0x7721('0x42')]){_0x6a4664[_0x7721('0x2c')]=[{'all':!![]}];}_0x6a4664=_['merge']({},_0x6a4664,_0x578867[_0x7721('0x3a')]);return db['VoiceQueue'][_0x7721('0x21')](_0x6a4664)[_0x7721('0x16')](handleEntityNotFound(_0x5ed70d,null))[_0x7721('0x16')](function(_0x443503){if(_0x443503){var _0x1c95d8=_0x443503[_0x7721('0x18')]({'plain':!![]});_0x1c95d8=qs[_0x7721('0x43')](_0x1c95d8,['id',_0x7721('0x44'),_0x7721('0x45')]);_0x578867[_0x7721('0x46')]=_[_0x7721('0x43')](_0x578867[_0x7721('0x46')],['id',_0x7721('0x44'),_0x7721('0x45')]);return db[_0x7721('0x28')]['create'](_[_0x7721('0x47')](_0x1c95d8,_0x578867[_0x7721('0x46')]),{'include':_0x578867[_0x7721('0x2d')][_0x7721('0x42')]?[{'all':!![]}]:undefined})[_0x7721('0x16')](function(_0x315127){var _0x267f5e=_0x578867['user'][_0x7721('0x18')]({'plain':!![]});if(!_0x267f5e)throw new Error(_0x7721('0x48'));if(_0x267f5e[_0x7721('0x3d')]===_0x7721('0x3c')){var _0x1f1e84=_0x315127[_0x7721('0x18')]({'plain':!![]});var _0x7fbd6c=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':_0x7721('0x1b'),'value':_0x7721('0x3e')}];var _0x52e870=_[_0x7721('0x21')](_0x7fbd6c,[_0x7721('0x1f'),_0x1f1e84[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x52e870,'userProfileId':_0x267f5e[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x360882){if(_0x360882&&_0x360882[_0x7721('0x49')]===0x0){return db[_0x7721('0x23')][_0x7721('0x3b')]({'name':_0x1f1e84[_0x7721('0x22')],'resourceId':_0x1f1e84['id'],'type':_0x360882[_0x7721('0x22')],'sectionId':_0x360882['id']},{})[_0x7721('0x16')](function(){return _0x315127;});}else{return _0x315127;}})['catch'](function(_0x50e9e9){logger['error'](_0x7721('0x41'),_0x50e9e9);throw _0x50e9e9;});}return _0x315127;});}})['then'](respondWithResult(_0x5ed70d,0xc9))['catch'](handleError(_0x5ed70d,null));};exports['update']=function(_0x5d7036,_0x47925a){if(_0x5d7036[_0x7721('0x46')]['id']){delete _0x5d7036[_0x7721('0x46')]['id'];}return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x5d7036['params']['id']}})['then'](handleEntityNotFound(_0x47925a,null))['then'](saveUpdates(_0x5d7036[_0x7721('0x46')],null))['then'](respondWithResult(_0x47925a,null))['catch'](handleError(_0x47925a,null));};exports['destroy']=function(_0x160292,_0x2e9155){return db[_0x7721('0x28')]['find']({'where':{'id':_0x160292[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x2e9155,null))[_0x7721('0x16')](removeEntity(_0x2e9155,null))[_0x7721('0x30')](handleError(_0x2e9155,null));};exports[_0x7721('0x4a')]=function(_0x16e80b,_0xad43ce){var _0x3e3301={'raw':![],'where':{}};var _0x127f46={};var _0x197b73={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16e80b[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0xad43ce,null))[_0x7721('0x16')](function(_0x4cbd28){if(_0x4cbd28){_0x127f46[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x4c')][_0x7721('0x34')]);_0x127f46['query']=_[_0x7721('0x33')](_0x16e80b[_0x7721('0x2d')]);_0x127f46['filters']=_[_0x7721('0x37')](_0x127f46['model'],_0x127f46[_0x7721('0x2d')]);_0x3e3301[_0x7721('0x36')]=_[_0x7721('0x37')](_0x127f46[_0x7721('0x32')],qs[_0x7721('0x38')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x38')]));_0x3e3301[_0x7721('0x36')]=_0x3e3301[_0x7721('0x36')]['length']?_0x3e3301[_0x7721('0x36')]:_0x127f46[_0x7721('0x32')];if(!_0x16e80b[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x3e3301[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16e80b['query'][_0x7721('0x4f')]);_0x3e3301[_0x7721('0x11')]=qs['offset'](_0x16e80b[_0x7721('0x2d')]['offset']);}_0x3e3301[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x51')]);_0x3e3301[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x16e80b['query'],_0x127f46[_0x7721('0x35')]));_0x3e3301[_0x7721('0x2b')][_0x7721('0x53')]=_0x4cbd28['id'];if(_0x16e80b['query']['filter']){_0x3e3301['where']=_['merge'](_0x3e3301['where'],{'$or':_[_0x7721('0x1e')](_0x3e3301[_0x7721('0x36')],function(_0x580473){var _0x2d4b3a={};_0x2d4b3a[_0x580473]={'$like':'%'+_0x16e80b[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x2d4b3a;})});}_0x3e3301=_[_0x7721('0x47')]({},_0x3e3301,_0x16e80b['options']);return db[_0x7721('0x4c')][_0x7721('0x13')]({'where':_0x3e3301[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0x3cf3fd){_0x197b73['count']=_0x3cf3fd;if(_0x16e80b[_0x7721('0x2d')][_0x7721('0x42')]){_0x3e3301[_0x7721('0x2c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3e3301);})[_0x7721('0x16')](function(_0x752564){_0x197b73[_0x7721('0x2f')]=_0x752564;return _0x197b73;});}})[_0x7721('0x16')](respondWithFilteredResult(_0xad43ce,_0x3e3301))[_0x7721('0x30')](handleError(_0xad43ce,null));};exports['getHopperHistories']=function(_0x4ba35e,_0x263070){var _0x1bd97e={'raw':!![],'where':{}};var _0x68de4={};var _0x3c66b3={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x4ba35e[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x263070,null))[_0x7721('0x16')](function(_0x413185){if(_0x413185){_0x68de4[_0x7721('0x32')]=_['keys'](db[_0x7721('0x54')][_0x7721('0x34')]);_0x68de4[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x4ba35e['query']);_0x68de4['filters']=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],_0x68de4[_0x7721('0x2d')]);_0x1bd97e[_0x7721('0x36')]=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],qs['fields'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x38')]));_0x1bd97e[_0x7721('0x36')]=_0x1bd97e['attributes'][_0x7721('0x39')]?_0x1bd97e[_0x7721('0x36')]:_0x68de4[_0x7721('0x32')];if(!_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x1bd97e[_0x7721('0x4f')]=qs['limit'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1bd97e[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x11')]);}_0x1bd97e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x51')]);_0x1bd97e[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0x4ba35e[_0x7721('0x2d')],_0x68de4[_0x7721('0x35')]));_0x1bd97e['where'][_0x7721('0x53')]=_0x413185['id'];if(_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1bd97e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x1bd97e['where'],{'$or':_[_0x7721('0x1e')](_0x1bd97e[_0x7721('0x36')],function(_0x44326d){var _0x21b365={};_0x21b365[_0x44326d]={'$like':'%'+_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x21b365;})});}_0x1bd97e=_['merge']({},_0x1bd97e,_0x4ba35e[_0x7721('0x3a')]);return db[_0x7721('0x54')]['count']({'where':_0x1bd97e[_0x7721('0x2b')]})['then'](function(_0x453792){_0x3c66b3[_0x7721('0x13')]=_0x453792;if(_0x4ba35e['query'][_0x7721('0x42')]){_0x1bd97e['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1bd97e);})[_0x7721('0x16')](function(_0x20f12e){_0x3c66b3[_0x7721('0x2f')]=_0x20f12e;return _0x3c66b3;});}})['then'](respondWithFilteredResult(_0x263070,_0x1bd97e))['catch'](handleError(_0x263070,null));};exports['getHopperFinals']=function(_0x355aa8,_0x3f7923){var _0x3c9334={'raw':!![],'where':{}};var _0x4220cf={};var _0x3b02d7={'count':0x0,'rows':[]};return db[_0x7721('0x28')]['findOne']({'where':{'id':_0x355aa8[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3f7923,null))[_0x7721('0x16')](function(_0xcf5304){if(_0xcf5304){_0x4220cf[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x55')][_0x7721('0x34')]);_0x4220cf[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x355aa8[_0x7721('0x2d')]);_0x4220cf[_0x7721('0x35')]=_['intersection'](_0x4220cf['model'],_0x4220cf[_0x7721('0x2d')]);_0x3c9334[_0x7721('0x36')]=_['intersection'](_0x4220cf[_0x7721('0x32')],qs['fields'](_0x355aa8['query'][_0x7721('0x38')]));_0x3c9334['attributes']=_0x3c9334['attributes'][_0x7721('0x39')]?_0x3c9334[_0x7721('0x36')]:_0x4220cf[_0x7721('0x32')];if(!_0x355aa8[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x3c9334[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x355aa8[_0x7721('0x2d')][_0x7721('0x4f')]);_0x3c9334['offset']=qs['offset'](_0x355aa8[_0x7721('0x2d')][_0x7721('0x11')]);}_0x3c9334['order']=qs[_0x7721('0x51')](_0x355aa8[_0x7721('0x2d')]['sort']);_0x3c9334['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x355aa8[_0x7721('0x2d')],_0x4220cf[_0x7721('0x35')]));_0x3c9334[_0x7721('0x2b')][_0x7721('0x53')]=_0xcf5304['id'];if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x1c')]){_0x3c9334['where']=_[_0x7721('0x47')](_0x3c9334[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x3c9334[_0x7721('0x36')],function(_0xe1c795){var _0x9b5f60={};_0x9b5f60[_0xe1c795]={'$like':'%'+_0x355aa8[_0x7721('0x2d')]['filter']+'%'};return _0x9b5f60;})});}_0x3c9334=_[_0x7721('0x47')]({},_0x3c9334,_0x355aa8[_0x7721('0x3a')]);return db['CmHopperFinal'][_0x7721('0x13')]({'where':_0x3c9334[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0xb8547a){_0x3b02d7[_0x7721('0x13')]=_0xb8547a;if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x42')]){_0x3c9334[_0x7721('0x2c')]=[{'all':!![]}];}return db[_0x7721('0x55')][_0x7721('0x2e')](_0x3c9334);})['then'](function(_0x418954){_0x3b02d7[_0x7721('0x2f')]=_0x418954;return _0x3b02d7;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x3f7923,_0x3c9334))[_0x7721('0x30')](handleError(_0x3f7923,null));};exports[_0x7721('0x56')]=function(_0x47653d,_0x12869b){var _0x1cfee2={'raw':!![],'where':{}};var _0x425327={};var _0x42ee11={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x47653d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12869b,null))[_0x7721('0x16')](function(_0x461938){if(_0x461938){_0x425327[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x57')][_0x7721('0x34')]);_0x425327['query']=_[_0x7721('0x33')](_0x47653d['query']);_0x425327[_0x7721('0x35')]=_[_0x7721('0x37')](_0x425327[_0x7721('0x32')],_0x425327[_0x7721('0x2d')]);_0x1cfee2[_0x7721('0x36')]=_['intersection'](_0x425327['model'],qs['fields'](_0x47653d['query'][_0x7721('0x38')]));_0x1cfee2[_0x7721('0x36')]=_0x1cfee2[_0x7721('0x36')][_0x7721('0x39')]?_0x1cfee2[_0x7721('0x36')]:_0x425327['model'];if(!_0x47653d[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x1cfee2[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x47653d[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1cfee2[_0x7721('0x11')]=qs['offset'](_0x47653d[_0x7721('0x2d')]['offset']);}_0x1cfee2['order']=qs[_0x7721('0x51')](_0x47653d[_0x7721('0x2d')][_0x7721('0x51')]);_0x1cfee2[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x47653d[_0x7721('0x2d')],_0x425327[_0x7721('0x35')]));_0x1cfee2[_0x7721('0x2b')][_0x7721('0x53')]=_0x461938['id'];if(_0x47653d[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1cfee2[_0x7721('0x2b')]=_['merge'](_0x1cfee2[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x1cfee2[_0x7721('0x36')],function(_0x193326){var _0x1dbf47={};_0x1dbf47[_0x193326]={'$like':'%'+_0x47653d['query'][_0x7721('0x1c')]+'%'};return _0x1dbf47;})});}_0x1cfee2=_[_0x7721('0x47')]({},_0x1cfee2,_0x47653d[_0x7721('0x3a')]);return db['CmHopperBlack'][_0x7721('0x13')]({'where':_0x1cfee2[_0x7721('0x2b')]})['then'](function(_0x29403d){_0x42ee11[_0x7721('0x13')]=_0x29403d;if(_0x47653d[_0x7721('0x2d')][_0x7721('0x42')]){_0x1cfee2['include']=[{'all':!![]}];}return db[_0x7721('0x57')]['findAll'](_0x1cfee2);})[_0x7721('0x16')](function(_0x1c50c2){_0x42ee11['rows']=_0x1c50c2;return _0x42ee11;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x12869b,_0x1cfee2))[_0x7721('0x30')](handleError(_0x12869b,null));};exports['getTeams']=function(_0x29968c,_0x11733f){var _0x5e3816={};var _0x7fd3e8={};var _0x52e8b1;var _0x240b0a;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x29968c['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x11733f,null))['then'](function(_0x5a00be){if(_0x5a00be){_0x52e8b1=_0x5a00be;_0x7fd3e8[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x58')][_0x7721('0x34')]);_0x7fd3e8[_0x7721('0x2d')]=_['keys'](_0x29968c[_0x7721('0x2d')]);_0x7fd3e8[_0x7721('0x35')]=_[_0x7721('0x37')](_0x7fd3e8[_0x7721('0x32')],_0x7fd3e8[_0x7721('0x2d')]);_0x5e3816['attributes']=_[_0x7721('0x37')](_0x7fd3e8['model'],qs[_0x7721('0x38')](_0x29968c['query']['fields']));_0x5e3816[_0x7721('0x36')]=_0x5e3816['attributes']['length']?_0x5e3816[_0x7721('0x36')]:_0x7fd3e8[_0x7721('0x32')];_0x5e3816[_0x7721('0x50')]=qs['sort'](_0x29968c[_0x7721('0x2d')]['sort']);_0x5e3816['where']=qs['filters'](_[_0x7721('0x52')](_0x29968c[_0x7721('0x2d')],_0x7fd3e8[_0x7721('0x35')]));if(_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]){_0x5e3816[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x5e3816[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x5e3816[_0x7721('0x36')],function(_0x25bf32){var _0x4ec3c6={};_0x4ec3c6[_0x25bf32]={'$like':'%'+_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x4ec3c6;})});}_0x5e3816=_[_0x7721('0x47')]({},_0x5e3816,_0x29968c[_0x7721('0x3a')]);return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0xc7e4e9){if(_0xc7e4e9){_0x240b0a=_0xc7e4e9['length'];if(!_0x29968c['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x5e3816[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x29968c['query'][_0x7721('0x4f')]);_0x5e3816['offset']=qs[_0x7721('0x11')](_0x29968c['query'][_0x7721('0x11')]);}return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0x249a5b){if(_0x249a5b){return _0x249a5b?{'count':_0x240b0a,'rows':_0x249a5b}:null;}})[_0x7721('0x16')](respondWithResult(_0x11733f,null))[_0x7721('0x30')](handleError(_0x11733f,null));};exports['addTeams']=function(_0x509f2d,_0x4d2644){var _0x2b0968=_0x509f2d['body'][_0x7721('0x5a')];var _0x186ada=_['map'](_0x2b0968,'id');return db[_0x7721('0x58')][_0x7721('0x2e')]({'where':{'id':_0x186ada},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':'Agents','attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),'voicePause','interface'],'raw':!![]}]})[_0x7721('0x16')](function(_0xc85b9){if(_0xc85b9){var _0x58be49=_[_0x7721('0x5d')](_0xc85b9,function(_0x283716){var _0x4cd26e=_0x283716['get']({'plain':!![]});_0x4cd26e['Agents']['forEach'](function(_0x19be6b){_0x19be6b[_0x7721('0x5e')]=_[_0x7721('0x21')](_0x2b0968,{'id':_0x4cd26e['id']})['penalty'];});return _0x4cd26e['Agents'];});return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x509f2d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x14711c){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0x435455){return _0x14711c[_0x7721('0x61')](_0x186ada,{'transaction':_0x435455})['then'](function(){return BPromise['each'](_0x2b0968,function(_0x415445){return db['TeamVoiceQueue'][_0x7721('0x62')]({'TeamId':_0x415445['id'],'VoiceQueueId':_0x509f2d['params']['id'],'penalty':_0x415445[_0x7721('0x5e')]},{'transaction':_0x435455});});})['then'](function(){return BPromise[_0x7721('0x63')](_0x58be49,function(_0x14341e){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x14341e['id'],'VoiceQueueId':_0x509f2d[_0x7721('0x31')]['id']},'defaults':{'penalty':_0x14341e[_0x7721('0x5e')]},'transaction':_0x435455});});})[_0x7721('0x16')](function(){return BPromise[_0x7721('0x63')](_[_0x7721('0x1c')](_0x58be49,{'online':!![]}),function(_0x5e69d7){return db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x5e69d7[_0x7721('0x22')],'UserId':_0x5e69d7['id'],'queue_name':_0x14711c['name'],'VoiceQueueId':_0x14711c['id'],'interface':_[_0x7721('0x65')](_0x5e69d7[_0x7721('0x66')])?util[_0x7721('0x67')](_0x7721('0x68'),_0x5e69d7[_0x7721('0x22')]):_0x5e69d7[_0x7721('0x66')],'paused':_0x5e69d7[_0x7721('0x69')]||![],'penalty':_0x5e69d7[_0x7721('0x5e')]},{'transaction':_0x435455});});})[_0x7721('0x16')](function(){_0x58be49[_0x7721('0x6a')](function(_0x2a2d8a){socket['emit'](_0x7721('0x6b'),{'UserId':_0x2a2d8a['id'],'VoiceQueueId':_0x14711c['id']});});});});});}})[_0x7721('0x16')](respondWithStatusCode(_0x4d2644,null))[_0x7721('0x30')](handleError(_0x4d2644,null));};exports[_0x7721('0x6c')]=function(_0xcb843e,_0x35d3f1){return db[_0x7721('0x58')]['findAll']({'where':{'id':_0xcb843e[_0x7721('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':_0x7721('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x7721('0x16')](handleEntityNotFound(_0x35d3f1,null))[_0x7721('0x16')](function(_0x37b607){var _0x3d6d41=_['map'](_0x37b607,'id');var _0xbce1b=[];var _0x4d3ad1=[];var _0x4028fa=squel[_0x7721('0x6e')]();_0x4028fa[_0x7721('0x6f')]('tq.TeamId')[_0x7721('0x70')](_0x7721('0x71'),'tq')[_0x7721('0x72')](_0x7721('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7721('0x2b')](_0x7721('0x74'),_0xcb843e[_0x7721('0x31')]['id']);for(var _0x980f26=0x0;_0x980f26<_0x37b607['length'];_0x980f26+=0x1){let _0x40dd5e=_0x37b607[_0x980f26];for(var _0x3d143a=0x0;_0x3d143a<_0x40dd5e[_0x7721('0x6d')][_0x7721('0x39')];_0x3d143a+=0x1){let _0x53fa66=_0x40dd5e[_0x7721('0x6d')][_0x3d143a];var _0x1a95e6=_0x4028fa[_0x7721('0x75')]();_0x1a95e6[_0x7721('0x2b')](_0x7721('0x76'),_0x53fa66['id']);_0x4d3ad1[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x1a95e6[_0x7721('0x78')](),{'type':db['sequelize'][_0x7721('0x79')][_0x7721('0x7a')]})[_0x7721('0x16')](function(_0x1c246b){if(_0x1c246b[_0x7721('0x39')]===0x1){return _0x53fa66['id'];}else{var _0x31447d=_[_0x7721('0x7b')](_[_0x7721('0x1e')](_0x1c246b,_0x7721('0x7c')),function(_0x14fd97){return _[_0x7721('0x7d')](_0x3d6d41,_0x14fd97);});if(_0x31447d){return _0x53fa66['id'];}}}));}}return BPromise[_0x7721('0x7e')](_0x4d3ad1)[_0x7721('0x16')](function(_0x18ccdf){_0xbce1b=_(_0xbce1b)[_0x7721('0x7f')](_0x18ccdf)[_0x7721('0x80')]()['value']();return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xcb843e[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x157310){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0xdd0e7a){return _0x157310[_0x7721('0x6c')](_0xcb843e[_0x7721('0x2d')][_0x7721('0x81')],{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){if(!_['isEmpty'](_0xbce1b)){return _0x157310['removeAgents'](_0xbce1b,{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0xcb843e[_0x7721('0x31')]['id'],'UserId':_0xbce1b},'transaction':_0xdd0e7a});});}})[_0x7721('0x16')](function(){_0xbce1b['forEach'](function(_0x1ebc86){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':_0x1ebc86,'VoiceQueueId':_0x157310['id']});});});});});});})[_0x7721('0x16')](respondWithStatusCode(_0x35d3f1,null))[_0x7721('0x30')](handleError(_0x35d3f1,null));};exports[_0x7721('0x84')]=function(_0xc0f448,_0x3dc688){var _0x298aca,_0x45b430;return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xc0f448['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3dc688,null))[_0x7721('0x16')](function(_0x16e0cd){if(_0x16e0cd){_0x45b430=_0x16e0cd;return _0x16e0cd['addAgents'](_0xc0f448[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xc0f448['body'],[_0x7721('0x81'),'id'])||{})['spread'](function(_0x5f3dd2){for(var _0xa73193=0x0;_0xa73193<_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0x7721('0x39')];_0xa73193+=0x1){socket['emit'](_0x7721('0x6b'),{'UserId':Number(_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0xa73193]),'VoiceQueueId':Number(_0xc0f448[_0x7721('0x31')]['id'])});}return _0x5f3dd2;});}})[_0x7721('0x16')](function(_0x5b12c7){_0x298aca=_0x5b12c7||[];if(_0x45b430){return db[_0x7721('0x5b')][_0x7721('0x2e')]({'where':{'id':_0xc0f448[_0x7721('0x46')][_0x7721('0x81')]},'attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),_0x7721('0x69'),_0x7721('0x66')],'raw':!![]});}})[_0x7721('0x16')](function(_0x385c86){if(!_[_0x7721('0x85')](_0x385c86)){var _0xc18d1a=[];for(var _0x9575b3=0x0;_0x9575b3<_0x385c86[_0x7721('0x39')];_0x9575b3++){if(_0x385c86[_0x9575b3][_0x7721('0x5c')]){_0xc18d1a[_0x7721('0x77')](db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x385c86[_0x9575b3][_0x7721('0x22')],'UserId':_0x385c86[_0x9575b3]['id'],'queue_name':_0x45b430[_0x7721('0x22')],'VoiceQueueId':_0x45b430['id'],'interface':_[_0x7721('0x65')](_0x385c86[_0x9575b3][_0x7721('0x66')])?util['format'](_0x7721('0x68'),_0x385c86[_0x9575b3]['name']):_0x385c86[_0x9575b3][_0x7721('0x66')],'paused':_0x385c86[_0x9575b3][_0x7721('0x69')]||![],'penalty':_0xc0f448[_0x7721('0x46')][_0x7721('0x5e')]||0x0}));}}return BPromise['all'](_0xc18d1a);}})[_0x7721('0x16')](function(){return _0x298aca;})[_0x7721('0x16')](respondWithResult(_0x3dc688,null))['catch'](handleError(_0x3dc688,null));};exports[_0x7721('0x86')]=function(_0x3a8f89,_0x52aae1){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x3a8f89[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x52aae1,null))[_0x7721('0x16')](function(_0x55c43c){if(_0x55c43c){return _0x55c43c['removeAgents'](_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')])['then'](function(){if(_['isArray'](_0x3a8f89[_0x7721('0x2d')]['ids'])){for(var _0x1c23e3=0x0;_0x1c23e3<_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]['length'];_0x1c23e3+=0x1){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')][_0x1c23e3]),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}}else{socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')]['ids']),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}});}})[_0x7721('0x16')](function(_0x3c3c7e){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0x3a8f89['params']['id'],'UserId':_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]}})[_0x7721('0x16')](function(){return _0x3c3c7e;});})[_0x7721('0x16')](respondWithStatusCode(_0x52aae1,null))[_0x7721('0x30')](handleError(_0x52aae1,null));};exports[_0x7721('0x87')]=function(_0x16b110,_0x366323){var _0x14b49e={};var _0x12f568={};var _0x259640;var _0x4a0e50;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16b110[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x366323,null))[_0x7721('0x16')](function(_0x25e4db){if(_0x25e4db){_0x259640=_0x25e4db;_0x12f568[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x5b')][_0x7721('0x34')]);_0x12f568[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x16b110[_0x7721('0x2d')]);_0x12f568[_0x7721('0x35')]=_[_0x7721('0x37')](_0x12f568['model'],_0x12f568[_0x7721('0x2d')]);_0x14b49e['attributes']=_['intersection'](_0x12f568[_0x7721('0x32')],qs['fields'](_0x16b110[_0x7721('0x2d')][_0x7721('0x38')]));_0x14b49e[_0x7721('0x36')]=_0x14b49e[_0x7721('0x36')]['length']?_0x14b49e['attributes']:_0x12f568[_0x7721('0x32')];_0x14b49e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16b110[_0x7721('0x2d')][_0x7721('0x51')]);_0x14b49e[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x16b110[_0x7721('0x2d')],_0x12f568['filters']));if(_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]){_0x14b49e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x14b49e[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x14b49e[_0x7721('0x36')],function(_0x184f1b){var _0xa257a0={};_0xa257a0[_0x184f1b]={'$like':'%'+_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0xa257a0;})});}_0x14b49e=_[_0x7721('0x47')]({},_0x14b49e,_0x16b110[_0x7721('0x3a')]);return _0x259640[_0x7721('0x87')](_0x14b49e);}})[_0x7721('0x16')](function(_0x1ee0c1){if(_0x1ee0c1){_0x4a0e50=_0x1ee0c1[_0x7721('0x39')];if(!_0x16b110[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x14b49e[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16b110[_0x7721('0x2d')][_0x7721('0x4f')]);_0x14b49e[_0x7721('0x11')]=qs['offset'](_0x16b110[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x259640[_0x7721('0x87')](_0x14b49e);}})['then'](function(_0x1bdadb){if(_0x1bdadb){return _0x1bdadb?{'count':_0x4a0e50,'rows':_0x1bdadb}:null;}})['then'](respondWithResult(_0x366323,null))[_0x7721('0x30')](handleError(_0x366323,null));};exports['getMembers']=function(_0xe5e55f,_0x17ce3b){var _0xbc0a80={};var _0xf2dc08={};var _0x5b493a;var _0x45024c;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0xe5e55f[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x17ce3b,null))['then'](function(_0x12b255){if(_0x12b255){_0x5b493a=_0x12b255;_0xf2dc08['model']=_[_0x7721('0x33')](db[_0x7721('0x64')][_0x7721('0x34')]);_0xf2dc08[_0x7721('0x2d')]=_[_0x7721('0x33')](_0xe5e55f[_0x7721('0x2d')]);_0xf2dc08[_0x7721('0x35')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],_0xf2dc08['query']);_0xbc0a80[_0x7721('0x36')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],qs['fields'](_0xe5e55f['query'][_0x7721('0x38')]));_0xbc0a80[_0x7721('0x36')]=_0xbc0a80[_0x7721('0x36')][_0x7721('0x39')]?_0xbc0a80[_0x7721('0x36')]:_0xf2dc08[_0x7721('0x32')];_0xbc0a80['order']=qs[_0x7721('0x51')](_0xe5e55f[_0x7721('0x2d')]['sort']);_0xbc0a80[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0xe5e55f['query'],_0xf2dc08[_0x7721('0x35')]));if(_0xe5e55f['query']['filter']){_0xbc0a80['where']=_[_0x7721('0x47')](_0xbc0a80['where'],{'$or':_['map'](_0xbc0a80['attributes'],function(_0x52a1ee){var _0x41c991={};_0x41c991[_0x52a1ee]={'$like':'%'+_0xe5e55f[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x41c991;})});}_0xbc0a80=_[_0x7721('0x47')]({},_0xbc0a80,_0xe5e55f[_0x7721('0x3a')]);return _0x5b493a['getMembers'](_0xbc0a80);}})[_0x7721('0x16')](function(_0x22d4e0){if(_0x22d4e0){_0x45024c=_0x22d4e0['length'];if(!_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0xbc0a80[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4f')]);_0xbc0a80[_0x7721('0x11')]=qs['offset'](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x5b493a[_0x7721('0x88')](_0xbc0a80);}})[_0x7721('0x16')](function(_0x2fbb00){return _0x2fbb00?{'count':_0x45024c,'rows':_0x2fbb00}:null;})[_0x7721('0x16')](respondWithResult(_0x17ce3b,null))[_0x7721('0x30')](handleError(_0x17ce3b,null));};exports[_0x7721('0x89')]=function(_0x561235,_0x12ad4d){var _0x226081={};var _0x17c3e7={};var _0x250cbf;var _0x255b22;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x561235[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12ad4d,null))[_0x7721('0x16')](function(_0x396880){if(_0x396880){_0x250cbf=_0x396880;_0x17c3e7['model']=_[_0x7721('0x33')](db[_0x7721('0x8a')]['rawAttributes']);_0x17c3e7[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x561235[_0x7721('0x2d')]);_0x17c3e7[_0x7721('0x35')]=_[_0x7721('0x37')](_0x17c3e7['model'],_0x17c3e7[_0x7721('0x2d')]);_0x226081[_0x7721('0x36')]=_['intersection'](_0x17c3e7['model'],qs[_0x7721('0x38')](_0x561235[_0x7721('0x2d')][_0x7721('0x38')]));_0x226081['attributes']=_0x226081[_0x7721('0x36')]['length']?_0x226081['attributes']:_0x17c3e7[_0x7721('0x32')];_0x226081[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x561235[_0x7721('0x2d')][_0x7721('0x51')]);_0x226081['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x561235[_0x7721('0x2d')],_0x17c3e7[_0x7721('0x35')]));if(_0x561235[_0x7721('0x2d')]['filter']){_0x226081[_0x7721('0x2b')]=_['merge'](_0x226081[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x226081[_0x7721('0x36')],function(_0x5209ff){var _0x2583c1={};_0x2583c1[_0x5209ff]={'$like':'%'+_0x561235['query'][_0x7721('0x1c')]+'%'};return _0x2583c1;})});}_0x226081=_[_0x7721('0x47')]({},_0x226081,_0x561235[_0x7721('0x3a')]);return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x3235d8){if(_0x3235d8){_0x255b22=_0x3235d8[_0x7721('0x39')];if(!_0x561235[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x226081['limit']=qs[_0x7721('0x4f')](_0x561235[_0x7721('0x2d')][_0x7721('0x4f')]);_0x226081[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x561235['query'][_0x7721('0x11')]);}return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x501e31){if(_0x501e31){return _0x501e31?{'count':_0x255b22,'rows':_0x501e31}:null;}})[_0x7721('0x16')](respondWithResult(_0x12ad4d,null))[_0x7721('0x30')](handleError(_0x12ad4d,null));};exports[_0x7721('0x8b')]=function(_0xe325e1,_0x1aa1fc){var _0x560be6=moment()[_0x7721('0x67')](_0x7721('0x8c'));var _0x1bd066,_0xaa15c5;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xe325e1[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x1aa1fc,null))[_0x7721('0x16')](function(_0x42ffff){if(_0x42ffff){_0xaa15c5=_0x42ffff;return _0x42ffff[_0x7721('0x8b')](_0xe325e1[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xe325e1[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x3f19f5){var _0x28f11a;_0x1bd066=_0x3f19f5||[];var _0x3bc8f3=[];if(_0x3f19f5){for(var _0x26cea3=0x0;_0x26cea3<_0x3f19f5[_0x7721('0x39')];_0x26cea3+=0x1){var _0x57e928=_0x3f19f5[_0x26cea3]['get']({'plain':!![]});_0xaa15c5[_0x7721('0x8e')]=_0xe325e1[_0x7721('0x46')][_0x7721('0x8e')]?_0xe325e1[_0x7721('0x46')]['dialCheckDuplicateType']:_0xaa15c5[_0x7721('0x8e')];switch(_0xaa15c5['dialCheckDuplicateType']){case _0x7721('0x8f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')['fromQuery'](['phone',_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),'updatedAt'],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),'ListId')[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','updatedAt')['from'](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928['CmListId'][_0x7721('0x78')]())[_0x7721('0x2b')](_0x7721('0x9a'))[_0x7721('0x2b')](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9c'))[_0x7721('0x70')](_0x7721('0x9d'))['where'](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id']['toString']()))[_0x7721('0x2b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7721('0x6e')]()['field'](_0x7721('0x9e'))['from']('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0xe325e1[_0x7721('0x31')]['id']['toString']())))[_0x7721('0x78')]();break;case _0x7721('0x9f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')](_0x7721('0xa0'))[_0x7721('0xa1')](['phone',_0x7721('0x92'),_0x7721('0x93'),'ListId','VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field']('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))['from'](_0x7721('0x97'))['where']('deletedAt\x20IS\x20NULL')[_0x7721('0x2b')]('ListId\x20=\x20?',_0x57e928[_0x7721('0x96')]['toString']())[_0x7721('0x2b')](_0x7721('0x9a'))['where'](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9e'))[_0x7721('0x70')]('cm_hopper')[_0x7721('0x2b')](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')]())))[_0x7721('0x78')]();break;default:_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')[_0x7721('0xa1')]([_0x7721('0x95'),_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),'VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id',_0x7721('0x93'))['field'](_0x57e928['CmListId'][_0x7721('0x78')](),'ListId')['field'](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x44'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928[_0x7721('0x96')][_0x7721('0x78')]())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();}_0x3bc8f3[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x28f11a));}return BPromise[_0x7721('0x7e')](_0x3bc8f3);}})[_0x7721('0x16')](function(){var _0x5f53b3=[];var _0x8fc283=squel[_0x7721('0x90')]()['into'](_0x7721('0xa2'))['fromQuery']([_0x7721('0xa3'),_0x7721('0x95'),_0x7721('0xa4'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0xa5'))[_0x7721('0x6f')](_0x7721('0xa6'))[_0x7721('0x6f')](_0x7721('0xa7'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0xa8'),'ci')[_0x7721('0x72')](_0x7721('0xa0'),'h',_0x7721('0xa9'))['where'](_0x7721('0xaa'),_0x560be6)[_0x7721('0x2b')](_0x7721('0xab'),'PHONE'))[_0x7721('0x78')]();_0x5f53b3['push'](db['sequelize'][_0x7721('0x2d')](_0x8fc283));return BPromise[_0x7721('0x7e')](_0x5f53b3);})['then'](function(){return _0x1bd066;})[_0x7721('0x16')](respondWithResult(_0x1aa1fc,null))[_0x7721('0x30')](handleError(_0x1aa1fc,null));};exports[_0x7721('0xac')]=function(_0xbc4f13,_0x50f4bd){return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xbc4f13['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x50f4bd,null))[_0x7721('0x16')](function(_0x537831){if(_0x537831){return _0x537831[_0x7721('0xac')](_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')]);}})[_0x7721('0x16')](function(_0x49548e){if(_0x49548e){return db['CmHopper'][_0x7721('0x17')]({'where':{'ListId':_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0xbc4f13[_0x7721('0x31')]['id']}})['then'](function(){return _0x49548e;});}})['then'](respondWithStatusCode(_0x50f4bd,null))[_0x7721('0x30')](handleError(_0x50f4bd,null));};exports[_0x7721('0xad')]=function(_0x4ea8ac,_0x226556){var _0x4bd023={};var _0x50de45={};var _0x51ac8f;var _0x27ed5e;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x4ea8ac[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x226556,null))['then'](function(_0x4893c0){if(_0x4893c0){_0x51ac8f=_0x4893c0;_0x50de45[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x8a')][_0x7721('0x34')]);_0x50de45[_0x7721('0x2d')]=_['keys'](_0x4ea8ac[_0x7721('0x2d')]);_0x50de45[_0x7721('0x35')]=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],_0x50de45[_0x7721('0x2d')]);_0x4bd023['attributes']=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],qs[_0x7721('0x38')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x38')]));_0x4bd023[_0x7721('0x36')]=_0x4bd023['attributes']['length']?_0x4bd023[_0x7721('0x36')]:_0x50de45[_0x7721('0x32')];_0x4bd023[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x51')]);_0x4bd023[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x4ea8ac[_0x7721('0x2d')],_0x50de45[_0x7721('0x35')]));if(_0x4ea8ac['query'][_0x7721('0x1c')]){_0x4bd023[_0x7721('0x2b')]=_['merge'](_0x4bd023[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x4bd023[_0x7721('0x36')],function(_0x400273){var _0x42c438={};_0x42c438[_0x400273]={'$like':'%'+_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x42c438;})});}_0x4bd023=_[_0x7721('0x47')]({},_0x4bd023,_0x4ea8ac[_0x7721('0x3a')]);return _0x51ac8f[_0x7721('0xad')](_0x4bd023);}})[_0x7721('0x16')](function(_0x1192a8){if(_0x1192a8){_0x27ed5e=_0x1192a8[_0x7721('0x39')];if(!_0x4ea8ac['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x4bd023['limit']=qs[_0x7721('0x4f')](_0x4ea8ac['query'][_0x7721('0x4f')]);_0x4bd023[_0x7721('0x11')]=qs['offset'](_0x4ea8ac['query'][_0x7721('0x11')]);}return _0x51ac8f['getBlackLists'](_0x4bd023);}})[_0x7721('0x16')](function(_0x2f7067){if(_0x2f7067){return _0x2f7067?{'count':_0x27ed5e,'rows':_0x2f7067}:null;}})[_0x7721('0x16')](respondWithResult(_0x226556,null))[_0x7721('0x30')](handleError(_0x226556,null));};exports[_0x7721('0xae')]=function(_0x376f37,_0x5b157e){var _0x4b84b9;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x376f37[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x5b157e,null))[_0x7721('0x16')](function(_0x39d43b){if(_0x39d43b){return _0x39d43b['addBlackLists'](_0x376f37['body'][_0x7721('0x81')],_[_0x7721('0x43')](_0x376f37[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x430304){var _0x469b6b;_0x4b84b9=_0x430304||[];var _0x6766c6=[];if(_0x430304){for(var _0x37877c=0x0;_0x37877c<_0x430304['length'];_0x37877c+=0x1){var _0x259eaa=_0x430304[_0x37877c][_0x7721('0x18')]({'plain':!![]});_0x469b6b=squel['insert']()['into'](_0x7721('0xaf'))[_0x7721('0xa1')]([_0x7721('0x95'),'ContactId',_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x259eaa['CmListId'][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0x376f37[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field'](_0x7721('0xb0'),_0x7721('0x44'))[_0x7721('0x6f')](_0x7721('0xb0'),'updatedAt')[_0x7721('0x70')](_0x7721('0x97'))['where'](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x259eaa['CmListId']['toString']())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();_0x6766c6[_0x7721('0x77')](db['sequelize'][_0x7721('0x2d')](_0x469b6b));}return BPromise[_0x7721('0x7e')](_0x6766c6);}})['then'](function(){return _0x4b84b9;})[_0x7721('0x16')](respondWithResult(_0x5b157e,null))[_0x7721('0x30')](handleError(_0x5b157e,null));};exports[_0x7721('0xb1')]=function(_0x37da70,_0x54616a){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x37da70[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x54616a,null))[_0x7721('0x16')](function(_0x174e79){if(_0x174e79){return _0x174e79['removeBlackLists'](_0x37da70[_0x7721('0x2d')]['ids']);}})[_0x7721('0x16')](function(_0x4c1b63){if(_0x4c1b63){return db[_0x7721('0x57')][_0x7721('0x17')]({'where':{'ListId':_0x37da70[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0x37da70[_0x7721('0x31')]['id']}})['then'](function(){return _0x4c1b63;});}})[_0x7721('0x16')](respondWithStatusCode(_0x54616a,null))[_0x7721('0x30')](handleError(_0x54616a,null));}; \ No newline at end of file +var _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x9bfecb,_0x4b1b63){var _0x44beff=function(_0xe265fd){while(--_0xe265fd){_0x9bfecb['push'](_0x9bfecb['shift']());}};_0x44beff(++_0x4b1b63);}(_0xe14b,0x93));var _0xbe14=function(_0x5aef7d,_0x4b7468){_0x5aef7d=_0x5aef7d-0x0;var _0x320893=_0xe14b[_0x5aef7d];return _0x320893;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 9cbf4bc..749744a 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 _0xb28f=['hook','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xb28f,0xd9));var _0xfb28=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xb28f[_0x2ae2ad];return _0x26dbd7;};'use strict';var EventEmitter=require(_0xfb28('0x0'));var VoiceQueue=require(_0xfb28('0x1'))['db'][_0xfb28('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xfb28('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfb28('0x4'),'afterDestroy':_0xfb28('0x5')};function emitEvent(_0x3a07fb){return function(_0x51419e,_0x3d9f73,_0x44153d){VoiceQueueEvents[_0xfb28('0x6')](_0x3a07fb+':'+_0x51419e['id'],_0x51419e);VoiceQueueEvents[_0xfb28('0x6')](_0x3a07fb,_0x51419e);_0x44153d(null);};}for(var e in events){if(events[_0xfb28('0x7')](e)){var event=events[e];VoiceQueue[_0xfb28('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x3a73=['emit','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0x3a73,0x14b));var _0x33a7=function(_0x1a2db5,_0x785212){_0x1a2db5=_0x1a2db5-0x0;var _0xf6401b=_0x3a73[_0x1a2db5];return _0xf6401b;};'use strict';var EventEmitter=require(_0x33a7('0x0'));var VoiceQueue=require(_0x33a7('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x33a7('0x2'),'afterUpdate':_0x33a7('0x3'),'afterDestroy':_0x33a7('0x4')};function emitEvent(_0x14b377){return function(_0x297382,_0x1a5779,_0x2b3667){VoiceQueueEvents[_0x33a7('0x5')](_0x14b377+':'+_0x297382['id'],_0x297382);VoiceQueueEvents['emit'](_0x14b377,_0x297382);_0x2b3667(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x33a7('0x6')](e,emitEvent(event));}}module[_0x33a7('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 c084d96..376f880 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x5dcf48,_0x75cabd){var _0x2e9bed=function(_0x128bf8){while(--_0x128bf8){_0x5dcf48['push'](_0x5dcf48['shift']());}};_0x2e9bed(++_0x75cabd);}(_0xedd9,0xfc));var _0x9edd=function(_0x423615,_0x5617e7){_0x423615=_0x423615-0x0;var _0x288f4c=_0xedd9[_0x423615];return _0x288f4c;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x4cd2aa,_0x19a600){var _0x2c2c7e=function(_0x4ebfc5){while(--_0x4ebfc5){_0x4cd2aa['push'](_0x4cd2aa['shift']());}};_0x2c2c7e(++_0x19a600);}(_0x70e0,0x17b));var _0x070e=function(_0x1fd376,_0x235dc9){_0x1fd376=_0x1fd376-0x0;var _0x42d812=_0x70e0[_0x1fd376];return _0x42d812;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index f2ecb32..aa1d54e 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 _0x0bc6=['redis','defaults','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','find','where','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bc6,0x1d9));var _0x60bc=function(_0x47aad3,_0x7b789b){_0x47aad3=_0x47aad3-0x0;var _0x50c0cb=_0x0bc6[_0x47aad3];return _0x50c0cb;};'use strict';var _=require('lodash');var util=require(_0x60bc('0x0'));var moment=require(_0x60bc('0x1'));var BPromise=require('bluebird');var rs=require(_0x60bc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60bc('0x3'))['db'];var utils=require(_0x60bc('0x4'));var logger=require('../../config/logger')(_0x60bc('0x5'));var config=require(_0x60bc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x60bc('0x7')]['http']({'port':0x232a});config[_0x60bc('0x8')]=_[_0x60bc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x60bc('0xa'))(new Redis(config[_0x60bc('0x8')]));require(_0x60bc('0xb'))[_0x60bc('0xc')](socket);function respondWithRpcPromise(_0x1ba048,_0x5ed272,_0x41ee39){return new BPromise(function(_0x2f230f,_0x3da4a2){return client['request'](_0x1ba048,_0x41ee39)[_0x60bc('0xd')](function(_0xa0d67d){logger[_0x60bc('0xe')](_0x60bc('0xf'),_0x5ed272,_0x60bc('0x10'));logger[_0x60bc('0x11')](_0x60bc('0x12'),_0x5ed272,_0x60bc('0x10'),JSON['stringify'](_0xa0d67d));if(_0xa0d67d[_0x60bc('0x13')]){if(_0xa0d67d[_0x60bc('0x13')][_0x60bc('0x14')]===0x1f4){logger[_0x60bc('0x13')](_0x60bc('0xf'),_0x5ed272,_0xa0d67d['error']['message']);return _0x3da4a2(_0xa0d67d[_0x60bc('0x13')]['message']);}logger[_0x60bc('0x13')](_0x60bc('0xf'),_0x5ed272,_0xa0d67d[_0x60bc('0x13')][_0x60bc('0x15')]);return _0x2f230f(_0xa0d67d[_0x60bc('0x13')][_0x60bc('0x15')]);}else{logger[_0x60bc('0xe')](_0x60bc('0xf'),_0x5ed272,'request\x20sent');_0x2f230f(_0xa0d67d[_0x60bc('0x16')][_0x60bc('0x15')]);}})[_0x60bc('0x17')](function(_0x285cb0){logger[_0x60bc('0x13')](_0x60bc('0xf'),_0x5ed272,_0x285cb0);_0x3da4a2(_0x285cb0);});});}exports['GetVoiceQueue']=function(_0x5300c6){var _0x4ae0da=this;return new Promise(function(_0x45cbd9,_0x1d9031){return db[_0x60bc('0x18')][_0x60bc('0x19')]({'raw':_0x5300c6[_0x60bc('0x1a')]?_0x5300c6[_0x60bc('0x1a')][_0x60bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x5300c6[_0x60bc('0x1a')]?_0x5300c6[_0x60bc('0x1a')]['where']||null:null,'attributes':_0x5300c6['options']?_0x5300c6[_0x60bc('0x1a')][_0x60bc('0x1c')]||null:null,'limit':_0x5300c6[_0x60bc('0x1a')]?_0x5300c6[_0x60bc('0x1a')][_0x60bc('0x1d')]||null:null,'include':_0x5300c6[_0x60bc('0x1a')]?_0x5300c6[_0x60bc('0x1a')][_0x60bc('0x1e')]?_[_0x60bc('0x1f')](_0x5300c6[_0x60bc('0x1a')]['include'],function(_0x4eba45){return{'model':db[_0x4eba45[_0x60bc('0x20')]],'as':_0x4eba45['as'],'attributes':_0x4eba45[_0x60bc('0x1c')],'include':_0x4eba45[_0x60bc('0x1e')]?_[_0x60bc('0x1f')](_0x4eba45['include'],function(_0x3becec){return{'model':db[_0x3becec[_0x60bc('0x20')]],'as':_0x3becec['as'],'attributes':_0x3becec[_0x60bc('0x1c')],'include':_0x3becec['include']?_['map'](_0x3becec['include'],function(_0x4e11df){return{'model':db[_0x4e11df[_0x60bc('0x20')]],'as':_0x4e11df['as'],'attributes':_0x4e11df[_0x60bc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x60bc('0xd')](function(_0x3d6762){logger['info'](_0x60bc('0x21'),_0x5300c6);logger['debug']('GetVoiceQueue',_0x5300c6,JSON['stringify'](_0x3d6762));_0x45cbd9(_0x3d6762);})[_0x60bc('0x17')](function(_0x51fa3a){logger[_0x60bc('0x13')](_0x60bc('0x21'),_0x51fa3a['message'],_0x5300c6);_0x1d9031(_0x4ae0da[_0x60bc('0x13')](0x1f4,_0x51fa3a[_0x60bc('0x15')]));});});};exports[_0x60bc('0x22')]=function(_0x53df1a){var _0x498d4c=this;return new Promise(function(_0x3ab259,_0x5ee7b3){return db[_0x60bc('0x18')][_0x60bc('0x23')]({'raw':_0x53df1a['options']?_0x53df1a['options'][_0x60bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x53df1a[_0x60bc('0x1a')]?_0x53df1a['options'][_0x60bc('0x24')]||null:null,'attributes':_0x53df1a[_0x60bc('0x1a')]?_0x53df1a[_0x60bc('0x1a')][_0x60bc('0x1c')]||null:null,'include':_0x53df1a['options']?_0x53df1a['options'][_0x60bc('0x1e')]?_[_0x60bc('0x1f')](_0x53df1a[_0x60bc('0x1a')][_0x60bc('0x1e')],function(_0x5778c2){return{'model':db[_0x5778c2['model']],'as':_0x5778c2['as'],'attributes':_0x5778c2[_0x60bc('0x1c')],'include':_0x5778c2[_0x60bc('0x1e')]?_[_0x60bc('0x1f')](_0x5778c2[_0x60bc('0x1e')],function(_0x1d8d62){return{'model':db[_0x1d8d62['model']],'as':_0x1d8d62['as'],'attributes':_0x1d8d62[_0x60bc('0x1c')],'include':_0x1d8d62[_0x60bc('0x1e')]?_[_0x60bc('0x1f')](_0x1d8d62[_0x60bc('0x1e')],function(_0x175fd8){return{'model':db[_0x175fd8[_0x60bc('0x20')]],'as':_0x175fd8['as'],'attributes':_0x175fd8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1db201){logger[_0x60bc('0xe')](_0x60bc('0x22'),_0x53df1a);logger[_0x60bc('0x11')](_0x60bc('0x22'),_0x53df1a,JSON['stringify'](_0x1db201));_0x3ab259(_0x1db201);})[_0x60bc('0x17')](function(_0x11e737){logger['error']('ShowVoiceQueue',_0x11e737[_0x60bc('0x15')],_0x53df1a);_0x5ee7b3(_0x498d4c['error'](0x1f4,_0x11e737[_0x60bc('0x15')]));});});}; \ No newline at end of file +var _0x0147=['message','result','VoiceQueue,\x20%s,\x20%s','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowVoiceQueue','find','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5589c0,_0x260e57){var _0x1c9c03=function(_0x50e5a8){while(--_0x50e5a8){_0x5589c0['push'](_0x5589c0['shift']());}};_0x1c9c03(++_0x260e57);}(_0x0147,0x122));var _0x7014=function(_0x464292,_0x55ea64){_0x464292=_0x464292-0x0;var _0x4ff804=_0x0147[_0x464292];return _0x4ff804;};'use strict';var _=require(_0x7014('0x0'));var util=require('util');var moment=require(_0x7014('0x1'));var BPromise=require(_0x7014('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7014('0x3'))['db'];var utils=require(_0x7014('0x4'));var logger=require(_0x7014('0x5'))(_0x7014('0x6'));var config=require(_0x7014('0x7'));var jayson=require(_0x7014('0x8'));var client=jayson[_0x7014('0x9')][_0x7014('0xa')]({'port':0x232a});config[_0x7014('0xb')]=_[_0x7014('0xc')](config['redis'],{'host':_0x7014('0xd'),'port':0x18eb});var socket=require(_0x7014('0xe'))(new Redis(config[_0x7014('0xb')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x709ab,_0x334fac,_0x95ec82){return new BPromise(function(_0x2ae7cd,_0x3d08bc){return client['request'](_0x709ab,_0x95ec82)[_0x7014('0xf')](function(_0xfd39ae){logger[_0x7014('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x334fac,_0x7014('0x11'));logger['debug'](_0x7014('0x12'),_0x334fac,_0x7014('0x11'),JSON[_0x7014('0x13')](_0xfd39ae));if(_0xfd39ae['error']){if(_0xfd39ae[_0x7014('0x14')][_0x7014('0x15')]===0x1f4){logger[_0x7014('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x334fac,_0xfd39ae[_0x7014('0x14')]['message']);return _0x3d08bc(_0xfd39ae[_0x7014('0x14')][_0x7014('0x16')]);}logger[_0x7014('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x334fac,_0xfd39ae[_0x7014('0x14')][_0x7014('0x16')]);return _0x2ae7cd(_0xfd39ae[_0x7014('0x14')][_0x7014('0x16')]);}else{logger[_0x7014('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x334fac,_0x7014('0x11'));_0x2ae7cd(_0xfd39ae[_0x7014('0x17')][_0x7014('0x16')]);}})['catch'](function(_0x459143){logger[_0x7014('0x14')](_0x7014('0x18'),_0x334fac,_0x459143);_0x3d08bc(_0x459143);});});}exports[_0x7014('0x19')]=function(_0x108565){var _0x2525a8=this;return new Promise(function(_0x5bf2fa,_0xef09b6){return db[_0x7014('0x1a')][_0x7014('0x1b')]({'raw':_0x108565['options']?_0x108565[_0x7014('0x1c')][_0x7014('0x1d')]===undefined?!![]:![]:!![],'where':_0x108565[_0x7014('0x1c')]?_0x108565[_0x7014('0x1c')][_0x7014('0x1e')]||null:null,'attributes':_0x108565[_0x7014('0x1c')]?_0x108565[_0x7014('0x1c')][_0x7014('0x1f')]||null:null,'limit':_0x108565[_0x7014('0x1c')]?_0x108565[_0x7014('0x1c')][_0x7014('0x20')]||null:null,'include':_0x108565[_0x7014('0x1c')]?_0x108565[_0x7014('0x1c')][_0x7014('0x21')]?_['map'](_0x108565[_0x7014('0x1c')]['include'],function(_0x4c8ac9){return{'model':db[_0x4c8ac9[_0x7014('0x22')]],'as':_0x4c8ac9['as'],'attributes':_0x4c8ac9[_0x7014('0x1f')],'include':_0x4c8ac9[_0x7014('0x21')]?_[_0x7014('0x23')](_0x4c8ac9[_0x7014('0x21')],function(_0x408532){return{'model':db[_0x408532[_0x7014('0x22')]],'as':_0x408532['as'],'attributes':_0x408532[_0x7014('0x1f')],'include':_0x408532[_0x7014('0x21')]?_[_0x7014('0x23')](_0x408532[_0x7014('0x21')],function(_0x3a027e){return{'model':db[_0x3a027e['model']],'as':_0x3a027e['as'],'attributes':_0x3a027e['attributes']};}):[]};}):[]};}):[]:[]})[_0x7014('0xf')](function(_0x352ad3){logger[_0x7014('0x10')](_0x7014('0x19'),_0x108565);logger[_0x7014('0x24')](_0x7014('0x19'),_0x108565,JSON[_0x7014('0x13')](_0x352ad3));_0x5bf2fa(_0x352ad3);})['catch'](function(_0x5daf8a){logger[_0x7014('0x14')]('GetVoiceQueue',_0x5daf8a[_0x7014('0x16')],_0x108565);_0xef09b6(_0x2525a8[_0x7014('0x14')](0x1f4,_0x5daf8a[_0x7014('0x16')]));});});};exports[_0x7014('0x25')]=function(_0x14df02){var _0x3957ff=this;return new Promise(function(_0x409376,_0x51356f){return db[_0x7014('0x1a')][_0x7014('0x26')]({'raw':_0x14df02[_0x7014('0x1c')]?_0x14df02[_0x7014('0x1c')][_0x7014('0x1d')]===undefined?!![]:![]:!![],'where':_0x14df02[_0x7014('0x1c')]?_0x14df02[_0x7014('0x1c')][_0x7014('0x1e')]||null:null,'attributes':_0x14df02[_0x7014('0x1c')]?_0x14df02[_0x7014('0x1c')][_0x7014('0x1f')]||null:null,'include':_0x14df02[_0x7014('0x1c')]?_0x14df02[_0x7014('0x1c')][_0x7014('0x21')]?_['map'](_0x14df02[_0x7014('0x1c')][_0x7014('0x21')],function(_0x107152){return{'model':db[_0x107152[_0x7014('0x22')]],'as':_0x107152['as'],'attributes':_0x107152['attributes'],'include':_0x107152[_0x7014('0x21')]?_[_0x7014('0x23')](_0x107152[_0x7014('0x21')],function(_0xc25fd0){return{'model':db[_0xc25fd0[_0x7014('0x22')]],'as':_0xc25fd0['as'],'attributes':_0xc25fd0['attributes'],'include':_0xc25fd0['include']?_[_0x7014('0x23')](_0xc25fd0[_0x7014('0x21')],function(_0x14c16e){return{'model':db[_0x14c16e[_0x7014('0x22')]],'as':_0x14c16e['as'],'attributes':_0x14c16e['attributes']};}):[]};}):[]};}):[]:[]})[_0x7014('0xf')](function(_0x592995){logger[_0x7014('0x10')](_0x7014('0x25'),_0x14df02);logger[_0x7014('0x24')](_0x7014('0x25'),_0x14df02,JSON['stringify'](_0x592995));_0x409376(_0x592995);})['catch'](function(_0x512f0f){logger[_0x7014('0x14')](_0x7014('0x25'),_0x512f0f[_0x7014('0x16')],_0x14df02);_0x51356f(_0x3957ff['error'](0x1f4,_0x512f0f[_0x7014('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index e17cbf7..cb1c7a4 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 _0x8d67=['register','length','./voiceQueue.events','save','remove','emit','removeListener'];(function(_0x1dffd4,_0x31cb14){var _0x4dab8c=function(_0x40bc7f){while(--_0x40bc7f){_0x1dffd4['push'](_0x1dffd4['shift']());}};_0x4dab8c(++_0x31cb14);}(_0x8d67,0x183));var _0x78d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8d67[_0x321bb2];return _0x9c12ed;};'use strict';var VoiceQueueEvents=require(_0x78d6('0x0'));var events=[_0x78d6('0x1'),_0x78d6('0x2'),'update'];function createListener(_0x424156,_0x373945){return function(_0x34374f){_0x373945[_0x78d6('0x3')](_0x424156,_0x34374f);};}function removeListener(_0x3443f8,_0x13c886){return function(){VoiceQueueEvents[_0x78d6('0x4')](_0x3443f8,_0x13c886);};}exports[_0x78d6('0x5')]=function(_0x23b93a){for(var _0x21ff6f=0x0,_0x3332fa=events[_0x78d6('0x6')];_0x21ff6f<_0x3332fa;_0x21ff6f++){var _0x181867=events[_0x21ff6f];var _0x567ee9=createListener('voiceQueue:'+_0x181867,_0x23b93a);VoiceQueueEvents['on'](_0x181867,_0x567ee9);}}; \ No newline at end of file +var _0x9a6f=['removeListener','register','voiceQueue:','./voiceQueue.events','save','update'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x9a6f,0x1e3));var _0xf9a6=function(_0x1d1fdf,_0x33ba5a){_0x1d1fdf=_0x1d1fdf-0x0;var _0x3521d6=_0x9a6f[_0x1d1fdf];return _0x3521d6;};'use strict';var VoiceQueueEvents=require(_0xf9a6('0x0'));var events=[_0xf9a6('0x1'),'remove',_0xf9a6('0x2')];function createListener(_0x412fe4,_0x51d3d9){return function(_0x42463b){_0x51d3d9['emit'](_0x412fe4,_0x42463b);};}function removeListener(_0x5d9947,_0x46a5a5){return function(){VoiceQueueEvents[_0xf9a6('0x3')](_0x5d9947,_0x46a5a5);};}exports[_0xf9a6('0x4')]=function(_0x32e6d5){for(var _0x57b06d=0x0,_0x1003e3=events['length'];_0x57b06d<_0x1003e3;_0x57b06d++){var _0x25168e=events[_0x57b06d];var _0x5785e1=createListener(_0xf9a6('0x5')+_0x25168e,_0x32e6d5);VoiceQueueEvents['on'](_0x25168e,_0x5785e1);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 4416086..314efcd 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 _0x5c5f=['/describe','describe','/:id','post','create','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x5c5f,0xda));var _0xf5c5=function(_0x304600,_0x4ecdfe){_0x304600=_0x304600-0x0;var _0x337878=_0x5c5f[_0x304600];return _0x337878;};'use strict';var multer=require('multer');var util=require(_0xf5c5('0x0'));var path=require(_0xf5c5('0x1'));var timeout=require('connect-timeout');var express=require(_0xf5c5('0x2'));var router=express[_0xf5c5('0x3')]();var fs_extra=require(_0xf5c5('0x4'));var auth=require(_0xf5c5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5c5('0x6'));router[_0xf5c5('0x7')]('/',auth[_0xf5c5('0x8')](),controller[_0xf5c5('0x9')]);router[_0xf5c5('0x7')](_0xf5c5('0xa'),auth[_0xf5c5('0x8')](),controller[_0xf5c5('0xb')]);router[_0xf5c5('0x7')]('/index',auth[_0xf5c5('0x8')](),controller['getVoiceQueuesReport']);router[_0xf5c5('0x7')](_0xf5c5('0xc'),auth[_0xf5c5('0x8')](),controller['show']);router[_0xf5c5('0xd')]('/',auth[_0xf5c5('0x8')](),controller[_0xf5c5('0xe')]);router['put'](_0xf5c5('0xc'),auth[_0xf5c5('0x8')](),controller[_0xf5c5('0xf')]);router[_0xf5c5('0x10')]('/:id',auth[_0xf5c5('0x8')](),controller[_0xf5c5('0x11')]);module[_0xf5c5('0x12')]=router; \ No newline at end of file +var _0xd27b=['/index','getVoiceQueuesReport','/:id','show','post','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2020ea,_0x26fc4f){var _0x3657fe=function(_0x4cc17f){while(--_0x4cc17f){_0x2020ea['push'](_0x2020ea['shift']());}};_0x3657fe(++_0x26fc4f);}(_0xd27b,0x134));var _0xbd27=function(_0x190e94,_0x117fc1){_0x190e94=_0x190e94-0x0;var _0x3012a0=_0xd27b[_0x190e94];return _0x3012a0;};'use strict';var multer=require(_0xbd27('0x0'));var util=require('util');var path=require(_0xbd27('0x1'));var timeout=require(_0xbd27('0x2'));var express=require('express');var router=express[_0xbd27('0x3')]();var fs_extra=require(_0xbd27('0x4'));var auth=require(_0xbd27('0x5'));var interaction=require(_0xbd27('0x6'));var config=require(_0xbd27('0x7'));var controller=require(_0xbd27('0x8'));router[_0xbd27('0x9')]('/',auth[_0xbd27('0xa')](),controller[_0xbd27('0xb')]);router[_0xbd27('0x9')](_0xbd27('0xc'),auth['isAuthenticated'](),controller[_0xbd27('0xd')]);router[_0xbd27('0x9')](_0xbd27('0xe'),auth['isAuthenticated'](),controller[_0xbd27('0xf')]);router[_0xbd27('0x9')](_0xbd27('0x10'),auth[_0xbd27('0xa')](),controller[_0xbd27('0x11')]);router[_0xbd27('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbd27('0x13')](_0xbd27('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xbd27('0x14')](_0xbd27('0x10'),auth[_0xbd27('0xa')](),controller[_0xbd27('0x15')]);module[_0xbd27('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a892959..a37f671 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 _0x7b5c=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x5fb9da,_0x1ac0d0){var _0x528081=function(_0x24793f){while(--_0x24793f){_0x5fb9da['push'](_0x5fb9da['shift']());}};_0x528081(++_0x1ac0d0);}(_0x7b5c,0x160));var _0xc7b5=function(_0x4449de,_0x16e630){_0x4449de=_0x4449de-0x0;var _0x5e6c4a=_0x7b5c[_0x4449de];return _0x5e6c4a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc7b5('0x0'));module['exports']={'type':{'type':Sequelize[_0xc7b5('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc7b5('0x1')]},'calleridname':{'type':Sequelize[_0xc7b5('0x1')]},'queue':{'type':Sequelize[_0xc7b5('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xc7b5('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xc7b5('0x2')],'set':function(_0x1fd546){var _0x491db5=moment(_0x1fd546);var _0x3f6a03=moment(this[_0xc7b5('0x3')](_0xc7b5('0x4')))[_0xc7b5('0x5')](_0xc7b5('0x6'));var _0x3fd0ac=_0x491db5[_0xc7b5('0x7')](_0x3f6a03,_0xc7b5('0x8'));this[_0xc7b5('0x9')](_0xc7b5('0xa'),_0x1fd546);this[_0xc7b5('0x9')](_0xc7b5('0xb'),_0x3fd0ac||null);}},'position':{'type':Sequelize[_0xc7b5('0xc')]},'count':{'type':Sequelize[_0xc7b5('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc7b5('0x2')]},'queuecallercomplete':{'type':Sequelize[_0xc7b5('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc7b5('0x2')]},'queuecallerexit':{'type':Sequelize[_0xc7b5('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc7b5('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0xc7b5('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xc7b5('0xc')]},'channel':{'type':Sequelize[_0xc7b5('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc7b5('0x1')]},'connectedlinename':{'type':Sequelize[_0xc7b5('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc7b5('0x1')]},'holdtime':{'type':Sequelize[_0xc7b5('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc7b5('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc7b5('0x1')]},'transfer':{'type':Sequelize[_0xc7b5('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc7b5('0x1')],'comment':_0xc7b5('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xc7b5('0x1')]},'disposition':{'type':Sequelize[_0xc7b5('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xc7b5('0x1')]}}; \ No newline at end of file +var _0x4672=['queuecallerjoinAt','diff','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','getDataValue'];(function(_0x3504ee,_0x5bd0a5){var _0x31236f=function(_0x5a5905){while(--_0x5a5905){_0x3504ee['push'](_0x3504ee['shift']());}};_0x31236f(++_0x5bd0a5);}(_0x4672,0xac));var _0x2467=function(_0x2fbe5f,_0x4c5c13){_0x2fbe5f=_0x2fbe5f-0x0;var _0x21db60=_0x4672[_0x2fbe5f];return _0x21db60;};'use strict';var Sequelize=require(_0x2467('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x2467('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2467('0x1')]},'queue':{'type':Sequelize[_0x2467('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x2467('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x2467('0x2')],'set':function(_0x56dbb8){var _0xed3fee=moment(_0x56dbb8);var _0x1634c=moment(this[_0x2467('0x3')](_0x2467('0x4')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x492ee0=_0xed3fee[_0x2467('0x5')](_0x1634c,'seconds');this['setDataValue'](_0x2467('0x6'),_0x56dbb8);this[_0x2467('0x7')]('holdtime',_0x492ee0||null);}},'position':{'type':Sequelize[_0x2467('0x8')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x2467('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2467('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x2467('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2467('0x2')]},'queuecallerexit':{'type':Sequelize[_0x2467('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2467('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x2467('0x8')]},'channel':{'type':Sequelize[_0x2467('0x1')]},'connectedlinenum':{'type':Sequelize[_0x2467('0x1')]},'connectedlinename':{'type':Sequelize[_0x2467('0x1')]},'accountcode':{'type':Sequelize[_0x2467('0x1')]},'context':{'type':Sequelize[_0x2467('0x1')]},'exten':{'type':Sequelize[_0x2467('0x1')]},'priority':{'type':Sequelize[_0x2467('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2467('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2467('0x1')]},'transfer':{'type':Sequelize[_0x2467('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2467('0x1')],'comment':_0x2467('0xa')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2467('0x1')]},'disposition':{'type':Sequelize[_0x2467('0x1')]},'secondDisposition':{'type':Sequelize[_0x2467('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x2467('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b12f472..248bec2 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 _0xc780=['end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','keys','includeAll','find','create','body','params','describe','getVoiceQueuesReport','findAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status'];(function(_0x52f20f,_0x159520){var _0x2d1dda=function(_0x4488bc){while(--_0x4488bc){_0x52f20f['push'](_0x52f20f['shift']());}};_0x2d1dda(++_0x159520);}(_0xc780,0xdc));var _0x0c78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc780[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0c78('0x0'));var rimraf=require(_0x0c78('0x1'));var zipdir=require(_0x0c78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c78('0x3'));var moment=require(_0x0c78('0x4'));var BPromise=require(_0x0c78('0x5'));var Mustache=require(_0x0c78('0x6'));var util=require('util');var path=require(_0x0c78('0x7'));var sox=require(_0x0c78('0x8'));var csv=require(_0x0c78('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c78('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0c78('0xb'));var toCsv=require(_0x0c78('0x9'));var querystring=require(_0x0c78('0xc'));var Papa=require(_0x0c78('0xd'));var Redis=require(_0x0c78('0xe'));var authService=require(_0x0c78('0xf'));var qs=require(_0x0c78('0x10'));var as=require(_0x0c78('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c78('0x12'))(_0x0c78('0x13'));var utils=require(_0x0c78('0x14'));var config=require(_0x0c78('0x15'));var licenseUtil=require(_0x0c78('0x16'));var db=require(_0x0c78('0x17'))['db'];config[_0x0c78('0x18')]=_[_0x0c78('0x19')](config[_0x0c78('0x18')],{'host':_0x0c78('0x1a'),'port':0x18eb});var socket=require(_0x0c78('0x1b'))(new Redis(config[_0x0c78('0x18')]));require(_0x0c78('0x1c'))[_0x0c78('0x1d')](socket);function respondWithStatusCode(_0x8be2e2,_0x3fea90){_0x3fea90=_0x3fea90||0xcc;return function(_0x576c2e){if(_0x576c2e){return _0x8be2e2[_0x0c78('0x1e')](_0x3fea90);}return _0x8be2e2[_0x0c78('0x1f')](_0x3fea90)[_0x0c78('0x20')]();};}function respondWithResult(_0x4b8569,_0x22c9ab){_0x22c9ab=_0x22c9ab||0xc8;return function(_0x4de69d){if(_0x4de69d){return _0x4b8569[_0x0c78('0x1f')](_0x22c9ab)['json'](_0x4de69d);}};}function respondWithFilteredResult(_0xdb54f1,_0xe88861){return function(_0x8e1049){if(_0x8e1049){var _0x56ef83=typeof _0xe88861[_0x0c78('0x21')]===_0x0c78('0x22')&&typeof _0xe88861[_0x0c78('0x23')]===_0x0c78('0x22');var _0x4a6d5d=_0x8e1049['count'];var _0x49893e=_0x56ef83?0x0:_0xe88861[_0x0c78('0x21')];var _0x4bbc30=_0x56ef83?_0x8e1049[_0x0c78('0x24')]:_0xe88861['offset']+_0xe88861[_0x0c78('0x23')];var _0x452e3a;if(_0x4bbc30>=_0x4a6d5d){_0x4bbc30=_0x4a6d5d;_0x452e3a=0xc8;}else{_0x452e3a=0xce;}_0xdb54f1[_0x0c78('0x1f')](_0x452e3a);return _0xdb54f1[_0x0c78('0x25')](_0x0c78('0x26'),_0x49893e+'-'+_0x4bbc30+'/'+_0x4a6d5d)[_0x0c78('0x27')](_0x8e1049);}return null;};}function patchUpdates(_0x7000d9){return function(_0x2406c1){try{jsonpatch[_0x0c78('0x28')](_0x2406c1,_0x7000d9,!![]);}catch(_0x45f2c5){return BPromise[_0x0c78('0x29')](_0x45f2c5);}return _0x2406c1['save']();};}function saveUpdates(_0x8cbe7f,_0x153839){return function(_0x4b1770){if(_0x4b1770){return _0x4b1770[_0x0c78('0x2a')](_0x8cbe7f)[_0x0c78('0x2b')](function(_0x63db60){return _0x63db60;});}return null;};}function removeEntity(_0x5027cf,_0x1e6851){return function(_0x3e9575){if(_0x3e9575){return _0x3e9575[_0x0c78('0x2c')]()[_0x0c78('0x2b')](function(){_0x5027cf[_0x0c78('0x1f')](0xcc)[_0x0c78('0x20')]();});}};}function handleEntityNotFound(_0x2c6540,_0x256497){return function(_0x22a1dc){if(!_0x22a1dc){_0x2c6540[_0x0c78('0x1e')](0x194);}return _0x22a1dc;};}function handleError(_0x38b1c0,_0x2104a1){_0x2104a1=_0x2104a1||0x1f4;return function(_0x1c7d73){logger['error'](_0x1c7d73[_0x0c78('0x2d')]);if(_0x1c7d73['name']){delete _0x1c7d73['name'];}_0x38b1c0[_0x0c78('0x1f')](_0x2104a1)[_0x0c78('0x2e')](_0x1c7d73);};}exports[_0x0c78('0x2f')]=function(_0x2e3b7e,_0x325543){var _0x2b6375={},_0x14533c={},_0x180d2d={'count':0x0,'rows':[]};var _0x140956=_[_0x0c78('0x30')](db[_0x0c78('0x31')][_0x0c78('0x32')],function(_0x954f1b){return{'name':_0x954f1b[_0x0c78('0x33')],'type':_0x954f1b[_0x0c78('0x34')][_0x0c78('0x35')]};});_0x14533c[_0x0c78('0x36')]=_[_0x0c78('0x30')](_0x140956,_0x0c78('0x37'));_0x14533c[_0x0c78('0x38')]=_['keys'](_0x2e3b7e[_0x0c78('0x38')]);_0x14533c[_0x0c78('0x39')]=_[_0x0c78('0x3a')](_0x14533c[_0x0c78('0x36')],_0x14533c[_0x0c78('0x38')]);_0x2b6375['attributes']=_[_0x0c78('0x3a')](_0x14533c[_0x0c78('0x36')],qs[_0x0c78('0x3b')](_0x2e3b7e['query']['fields']));_0x2b6375[_0x0c78('0x3c')]=_0x2b6375[_0x0c78('0x3c')][_0x0c78('0x3d')]?_0x2b6375[_0x0c78('0x3c')]:_0x14533c['model'];if(!_0x2e3b7e[_0x0c78('0x38')][_0x0c78('0x3e')](_0x0c78('0x3f'))){_0x2b6375[_0x0c78('0x23')]=qs[_0x0c78('0x23')](_0x2e3b7e['query'][_0x0c78('0x23')]);_0x2b6375[_0x0c78('0x21')]=qs[_0x0c78('0x21')](_0x2e3b7e[_0x0c78('0x38')][_0x0c78('0x21')]);}_0x2b6375[_0x0c78('0x40')]=qs['sort'](_0x2e3b7e[_0x0c78('0x38')][_0x0c78('0x41')]);_0x2b6375[_0x0c78('0x42')]=qs[_0x0c78('0x39')](_[_0x0c78('0x43')](_0x2e3b7e['query'],_0x14533c[_0x0c78('0x39')]),_0x140956);if(_0x2e3b7e[_0x0c78('0x38')][_0x0c78('0x44')]){_0x2b6375[_0x0c78('0x42')]=_[_0x0c78('0x45')](_0x2b6375[_0x0c78('0x42')],{'$or':_[_0x0c78('0x30')](_0x140956,function(_0x35d0d9){if(_0x35d0d9[_0x0c78('0x34')]!==_0x0c78('0x46')){var _0x517498={};_0x517498[_0x35d0d9['name']]={'$like':'%'+_0x2e3b7e[_0x0c78('0x38')]['filter']+'%'};return _0x517498;}})});}_0x2b6375=_[_0x0c78('0x45')]({},_0x2b6375,_0x2e3b7e[_0x0c78('0x47')]);var _0x163cd3={'where':_0x2b6375[_0x0c78('0x42')]};return db[_0x0c78('0x31')][_0x0c78('0x24')](_0x163cd3)[_0x0c78('0x2b')](function(_0x520b1f){_0x180d2d[_0x0c78('0x24')]=_0x520b1f;if(_0x2e3b7e['query']['includeAll']){_0x2b6375[_0x0c78('0x48')]=[{'all':!![]}];}return db[_0x0c78('0x31')]['findAll'](_0x2b6375);})[_0x0c78('0x2b')](function(_0x2c9f8d){_0x180d2d[_0x0c78('0x49')]=_0x2c9f8d;return _0x180d2d;})[_0x0c78('0x2b')](respondWithFilteredResult(_0x325543,_0x2b6375))[_0x0c78('0x4a')](handleError(_0x325543,null));};exports['show']=function(_0x22cb10,_0x5cf39d){var _0x4acd7f={'raw':![],'where':{'id':_0x22cb10['params']['id']}},_0x23b54a={};_0x23b54a[_0x0c78('0x36')]=_['keys'](db[_0x0c78('0x31')][_0x0c78('0x32')]);_0x23b54a['query']=_[_0x0c78('0x4b')](_0x22cb10[_0x0c78('0x38')]);_0x23b54a[_0x0c78('0x39')]=_[_0x0c78('0x3a')](_0x23b54a[_0x0c78('0x36')],_0x23b54a[_0x0c78('0x38')]);_0x4acd7f[_0x0c78('0x3c')]=_[_0x0c78('0x3a')](_0x23b54a[_0x0c78('0x36')],qs[_0x0c78('0x3b')](_0x22cb10[_0x0c78('0x38')][_0x0c78('0x3b')]));_0x4acd7f[_0x0c78('0x3c')]=_0x4acd7f[_0x0c78('0x3c')][_0x0c78('0x3d')]?_0x4acd7f[_0x0c78('0x3c')]:_0x23b54a[_0x0c78('0x36')];if(_0x22cb10[_0x0c78('0x38')][_0x0c78('0x4c')]){_0x4acd7f['include']=[{'all':!![]}];}_0x4acd7f=_[_0x0c78('0x45')]({},_0x4acd7f,_0x22cb10['options']);return db[_0x0c78('0x31')][_0x0c78('0x4d')](_0x4acd7f)['then'](handleEntityNotFound(_0x5cf39d,null))[_0x0c78('0x2b')](respondWithResult(_0x5cf39d,null))['catch'](handleError(_0x5cf39d,null));};exports[_0x0c78('0x4e')]=function(_0x3dd6ac,_0x12f453){return db[_0x0c78('0x31')]['create'](_0x3dd6ac[_0x0c78('0x4f')],{})[_0x0c78('0x2b')](respondWithResult(_0x12f453,0xc9))['catch'](handleError(_0x12f453,null));};exports['update']=function(_0xa7b18b,_0x3698d1){if(_0xa7b18b['body']['id']){delete _0xa7b18b['body']['id'];}return db[_0x0c78('0x31')][_0x0c78('0x4d')]({'where':{'id':_0xa7b18b[_0x0c78('0x50')]['id']}})[_0x0c78('0x2b')](handleEntityNotFound(_0x3698d1,null))[_0x0c78('0x2b')](saveUpdates(_0xa7b18b['body'],null))[_0x0c78('0x2b')](respondWithResult(_0x3698d1,null))[_0x0c78('0x4a')](handleError(_0x3698d1,null));};exports[_0x0c78('0x2c')]=function(_0x5dd204,_0x436fac){return db['VoiceQueueReport'][_0x0c78('0x4d')]({'where':{'id':_0x5dd204[_0x0c78('0x50')]['id']}})[_0x0c78('0x2b')](handleEntityNotFound(_0x436fac,null))[_0x0c78('0x2b')](removeEntity(_0x436fac,null))[_0x0c78('0x4a')](handleError(_0x436fac,null));};exports['describe']=function(_0x2f240c,_0x178da4){return db[_0x0c78('0x31')][_0x0c78('0x51')]()[_0x0c78('0x2b')](respondWithResult(_0x178da4,null))[_0x0c78('0x4a')](handleError(_0x178da4,null));};exports[_0x0c78('0x52')]=function(_0xffda7f,_0x7f7248){var _0x591b64={},_0x682068={},_0x264c3e={'count':0x0,'rows':[]};_0x682068[_0x0c78('0x36')]=_[_0x0c78('0x4b')](db['VoiceQueueReport'][_0x0c78('0x32')]);_0x682068['query']=_[_0x0c78('0x4b')](_0xffda7f[_0x0c78('0x38')]);_0x682068[_0x0c78('0x39')]=_[_0x0c78('0x3a')](_0x682068[_0x0c78('0x36')],_0x682068[_0x0c78('0x38')]);_0x591b64[_0x0c78('0x3c')]=_[_0x0c78('0x3a')](_0x682068['model'],qs[_0x0c78('0x3b')](_0xffda7f[_0x0c78('0x38')][_0x0c78('0x3b')]));_0x591b64[_0x0c78('0x3c')]=_0x591b64[_0x0c78('0x3c')][_0x0c78('0x3d')]?_0x591b64[_0x0c78('0x3c')]:_0x682068['model'];if(!_0xffda7f[_0x0c78('0x38')][_0x0c78('0x3e')](_0x0c78('0x3f'))){_0x591b64[_0x0c78('0x23')]=qs[_0x0c78('0x23')](_0xffda7f['query']['limit']);_0x591b64[_0x0c78('0x21')]=qs[_0x0c78('0x21')](_0xffda7f['query'][_0x0c78('0x21')]);}_0x591b64[_0x0c78('0x40')]=qs['sort'](_0xffda7f['query'][_0x0c78('0x41')]);_0x591b64[_0x0c78('0x42')]=qs[_0x0c78('0x39')](_['pick'](_0xffda7f['query'],_0x682068[_0x0c78('0x39')]));if(_0xffda7f['query'][_0x0c78('0x44')]){_0x591b64[_0x0c78('0x42')]=_[_0x0c78('0x45')](_0x591b64[_0x0c78('0x42')],{'$or':_['map'](_0x591b64[_0x0c78('0x3c')],function(_0x3a7a96){var _0x4df547={};_0x4df547[_0x3a7a96]={'$like':'%'+_0xffda7f['query'][_0x0c78('0x44')]+'%'};return _0x4df547;})});}_0x591b64=_[_0x0c78('0x45')]({},_0x591b64,_0xffda7f[_0x0c78('0x47')]);var _0x2ee221={'where':_0x591b64['where']};return db[_0x0c78('0x31')][_0x0c78('0x24')](_0x2ee221)[_0x0c78('0x2b')](function(_0x41ea14){_0x264c3e[_0x0c78('0x24')]=_0x41ea14;if(_0xffda7f[_0x0c78('0x38')][_0x0c78('0x4c')]){_0x591b64[_0x0c78('0x48')]=[{'all':!![]}];}return db[_0x0c78('0x31')][_0x0c78('0x53')](_0x591b64);})[_0x0c78('0x2b')](function(_0x50c405){_0x264c3e['rows']=_0x50c405;return _0x264c3e;})[_0x0c78('0x2b')](respondWithFilteredResult(_0x7f7248,_0x591b64,_0x0c78('0x52')))[_0x0c78('0x4a')](handleError(_0x7f7248,null,_0x0c78('0x52')));}; \ No newline at end of file +var _0xd0c9=['send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','create','body','destroy','find','describe','getVoiceQueuesReport','length','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','sendStatus','error','stack','name'];(function(_0x5f162d,_0x4b0768){var _0x6a7375=function(_0x440ee1){while(--_0x440ee1){_0x5f162d['push'](_0x5f162d['shift']());}};_0x6a7375(++_0x4b0768);}(_0xd0c9,0xcc));var _0x9d0c=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xd0c9[_0x344a3f];return _0x264712;};'use strict';var emlformat=require(_0x9d0c('0x0'));var rimraf=require(_0x9d0c('0x1'));var zipdir=require(_0x9d0c('0x2'));var jsonpatch=require(_0x9d0c('0x3'));var rp=require('request-promise');var moment=require(_0x9d0c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9d0c('0x5'));var util=require(_0x9d0c('0x6'));var path=require('path');var sox=require(_0x9d0c('0x7'));var csv=require(_0x9d0c('0x8'));var ejs=require(_0x9d0c('0x9'));var fs=require('fs');var fs_extra=require(_0x9d0c('0xa'));var _=require(_0x9d0c('0xb'));var squel=require(_0x9d0c('0xc'));var crypto=require('crypto');var jsforce=require(_0x9d0c('0xd'));var deskjs=require(_0x9d0c('0xe'));var toCsv=require(_0x9d0c('0x8'));var querystring=require(_0x9d0c('0xf'));var Papa=require(_0x9d0c('0x10'));var Redis=require('ioredis');var authService=require(_0x9d0c('0x11'));var qs=require(_0x9d0c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d0c('0x13'));var logger=require('../../config/logger')(_0x9d0c('0x14'));var utils=require(_0x9d0c('0x15'));var config=require(_0x9d0c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d0c('0x17'))['db'];config[_0x9d0c('0x18')]=_['defaults'](config[_0x9d0c('0x18')],{'host':_0x9d0c('0x19'),'port':0x18eb});var socket=require(_0x9d0c('0x1a'))(new Redis(config[_0x9d0c('0x18')]));require(_0x9d0c('0x1b'))['register'](socket);function respondWithStatusCode(_0x4b255e,_0x13edc4){_0x13edc4=_0x13edc4||0xcc;return function(_0x325e9f){if(_0x325e9f){return _0x4b255e['sendStatus'](_0x13edc4);}return _0x4b255e['status'](_0x13edc4)['end']();};}function respondWithResult(_0x5729f9,_0x335e3c){_0x335e3c=_0x335e3c||0xc8;return function(_0x11eff9){if(_0x11eff9){return _0x5729f9[_0x9d0c('0x1c')](_0x335e3c)[_0x9d0c('0x1d')](_0x11eff9);}};}function respondWithFilteredResult(_0x1aaeaa,_0x5a4ba6){return function(_0x65b227){if(_0x65b227){var _0x58cd80=typeof _0x5a4ba6[_0x9d0c('0x1e')]===_0x9d0c('0x1f')&&typeof _0x5a4ba6['limit']===_0x9d0c('0x1f');var _0x4d3a18=_0x65b227[_0x9d0c('0x20')];var _0x22e119=_0x58cd80?0x0:_0x5a4ba6[_0x9d0c('0x1e')];var _0x2f307b=_0x58cd80?_0x65b227[_0x9d0c('0x20')]:_0x5a4ba6[_0x9d0c('0x1e')]+_0x5a4ba6[_0x9d0c('0x21')];var _0x4350ba;if(_0x2f307b>=_0x4d3a18){_0x2f307b=_0x4d3a18;_0x4350ba=0xc8;}else{_0x4350ba=0xce;}_0x1aaeaa[_0x9d0c('0x1c')](_0x4350ba);return _0x1aaeaa[_0x9d0c('0x22')]('Content-Range',_0x22e119+'-'+_0x2f307b+'/'+_0x4d3a18)['json'](_0x65b227);}return null;};}function patchUpdates(_0x1a717e){return function(_0x171d09){try{jsonpatch[_0x9d0c('0x23')](_0x171d09,_0x1a717e,!![]);}catch(_0x194f2f){return BPromise[_0x9d0c('0x24')](_0x194f2f);}return _0x171d09[_0x9d0c('0x25')]();};}function saveUpdates(_0x599293,_0x38818e){return function(_0x5640c2){if(_0x5640c2){return _0x5640c2[_0x9d0c('0x26')](_0x599293)[_0x9d0c('0x27')](function(_0x592e7b){return _0x592e7b;});}return null;};}function removeEntity(_0x451ed0,_0x13bfaf){return function(_0x509215){if(_0x509215){return _0x509215['destroy']()[_0x9d0c('0x27')](function(){_0x451ed0[_0x9d0c('0x1c')](0xcc)[_0x9d0c('0x28')]();});}};}function handleEntityNotFound(_0x1b39f3,_0x213fc3){return function(_0x4a403c){if(!_0x4a403c){_0x1b39f3[_0x9d0c('0x29')](0x194);}return _0x4a403c;};}function handleError(_0x514664,_0x1948a8){_0x1948a8=_0x1948a8||0x1f4;return function(_0x290f93){logger[_0x9d0c('0x2a')](_0x290f93[_0x9d0c('0x2b')]);if(_0x290f93[_0x9d0c('0x2c')]){delete _0x290f93['name'];}_0x514664['status'](_0x1948a8)[_0x9d0c('0x2d')](_0x290f93);};}exports[_0x9d0c('0x2e')]=function(_0x5aad2e,_0x3bb336){var _0xb0dc23={},_0x2eac85={},_0x396790={'count':0x0,'rows':[]};var _0x585480=_[_0x9d0c('0x2f')](db[_0x9d0c('0x30')][_0x9d0c('0x31')],function(_0x24bb2d){return{'name':_0x24bb2d[_0x9d0c('0x32')],'type':_0x24bb2d[_0x9d0c('0x33')]['key']};});_0x2eac85['model']=_['map'](_0x585480,'name');_0x2eac85[_0x9d0c('0x34')]=_[_0x9d0c('0x35')](_0x5aad2e[_0x9d0c('0x34')]);_0x2eac85['filters']=_[_0x9d0c('0x36')](_0x2eac85[_0x9d0c('0x37')],_0x2eac85[_0x9d0c('0x34')]);_0xb0dc23[_0x9d0c('0x38')]=_[_0x9d0c('0x36')](_0x2eac85[_0x9d0c('0x37')],qs['fields'](_0x5aad2e[_0x9d0c('0x34')][_0x9d0c('0x39')]));_0xb0dc23['attributes']=_0xb0dc23['attributes']['length']?_0xb0dc23['attributes']:_0x2eac85[_0x9d0c('0x37')];if(!_0x5aad2e[_0x9d0c('0x34')][_0x9d0c('0x3a')](_0x9d0c('0x3b'))){_0xb0dc23['limit']=qs[_0x9d0c('0x21')](_0x5aad2e[_0x9d0c('0x34')]['limit']);_0xb0dc23[_0x9d0c('0x1e')]=qs[_0x9d0c('0x1e')](_0x5aad2e[_0x9d0c('0x34')][_0x9d0c('0x1e')]);}_0xb0dc23[_0x9d0c('0x3c')]=qs[_0x9d0c('0x3d')](_0x5aad2e[_0x9d0c('0x34')][_0x9d0c('0x3d')]);_0xb0dc23['where']=qs[_0x9d0c('0x3e')](_[_0x9d0c('0x3f')](_0x5aad2e[_0x9d0c('0x34')],_0x2eac85[_0x9d0c('0x3e')]),_0x585480);if(_0x5aad2e[_0x9d0c('0x34')][_0x9d0c('0x40')]){_0xb0dc23['where']=_[_0x9d0c('0x41')](_0xb0dc23[_0x9d0c('0x42')],{'$or':_[_0x9d0c('0x2f')](_0x585480,function(_0x22ed9f){if(_0x22ed9f[_0x9d0c('0x33')]!==_0x9d0c('0x43')){var _0x4aa0bb={};_0x4aa0bb[_0x22ed9f['name']]={'$like':'%'+_0x5aad2e['query'][_0x9d0c('0x40')]+'%'};return _0x4aa0bb;}})});}_0xb0dc23=_[_0x9d0c('0x41')]({},_0xb0dc23,_0x5aad2e[_0x9d0c('0x44')]);var _0x1c2d08={'where':_0xb0dc23[_0x9d0c('0x42')]};return db[_0x9d0c('0x30')][_0x9d0c('0x20')](_0x1c2d08)[_0x9d0c('0x27')](function(_0x2ee621){_0x396790[_0x9d0c('0x20')]=_0x2ee621;if(_0x5aad2e['query']['includeAll']){_0xb0dc23['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x9d0c('0x45')](_0xb0dc23);})[_0x9d0c('0x27')](function(_0x2f2e91){_0x396790[_0x9d0c('0x46')]=_0x2f2e91;return _0x396790;})[_0x9d0c('0x27')](respondWithFilteredResult(_0x3bb336,_0xb0dc23))[_0x9d0c('0x47')](handleError(_0x3bb336,null));};exports[_0x9d0c('0x48')]=function(_0x382258,_0x96739d){var _0x4da2eb={'raw':![],'where':{'id':_0x382258[_0x9d0c('0x49')]['id']}},_0x2015a1={};_0x2015a1[_0x9d0c('0x37')]=_[_0x9d0c('0x35')](db[_0x9d0c('0x30')]['rawAttributes']);_0x2015a1[_0x9d0c('0x34')]=_[_0x9d0c('0x35')](_0x382258[_0x9d0c('0x34')]);_0x2015a1['filters']=_[_0x9d0c('0x36')](_0x2015a1['model'],_0x2015a1[_0x9d0c('0x34')]);_0x4da2eb[_0x9d0c('0x38')]=_[_0x9d0c('0x36')](_0x2015a1[_0x9d0c('0x37')],qs['fields'](_0x382258[_0x9d0c('0x34')]['fields']));_0x4da2eb[_0x9d0c('0x38')]=_0x4da2eb[_0x9d0c('0x38')]['length']?_0x4da2eb[_0x9d0c('0x38')]:_0x2015a1[_0x9d0c('0x37')];if(_0x382258[_0x9d0c('0x34')][_0x9d0c('0x4a')]){_0x4da2eb[_0x9d0c('0x4b')]=[{'all':!![]}];}_0x4da2eb=_[_0x9d0c('0x41')]({},_0x4da2eb,_0x382258[_0x9d0c('0x44')]);return db[_0x9d0c('0x30')]['find'](_0x4da2eb)[_0x9d0c('0x27')](handleEntityNotFound(_0x96739d,null))[_0x9d0c('0x27')](respondWithResult(_0x96739d,null))['catch'](handleError(_0x96739d,null));};exports[_0x9d0c('0x4c')]=function(_0x3393f0,_0x201b00){return db[_0x9d0c('0x30')]['create'](_0x3393f0[_0x9d0c('0x4d')],{})[_0x9d0c('0x27')](respondWithResult(_0x201b00,0xc9))['catch'](handleError(_0x201b00,null));};exports[_0x9d0c('0x26')]=function(_0x8de36b,_0x1a1cf4){if(_0x8de36b[_0x9d0c('0x4d')]['id']){delete _0x8de36b['body']['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x8de36b[_0x9d0c('0x49')]['id']}})[_0x9d0c('0x27')](handleEntityNotFound(_0x1a1cf4,null))[_0x9d0c('0x27')](saveUpdates(_0x8de36b[_0x9d0c('0x4d')],null))[_0x9d0c('0x27')](respondWithResult(_0x1a1cf4,null))[_0x9d0c('0x47')](handleError(_0x1a1cf4,null));};exports[_0x9d0c('0x4e')]=function(_0x52922f,_0x2b68aa){return db['VoiceQueueReport'][_0x9d0c('0x4f')]({'where':{'id':_0x52922f[_0x9d0c('0x49')]['id']}})[_0x9d0c('0x27')](handleEntityNotFound(_0x2b68aa,null))[_0x9d0c('0x27')](removeEntity(_0x2b68aa,null))[_0x9d0c('0x47')](handleError(_0x2b68aa,null));};exports[_0x9d0c('0x50')]=function(_0x404108,_0x316987){return db[_0x9d0c('0x30')][_0x9d0c('0x50')]()['then'](respondWithResult(_0x316987,null))['catch'](handleError(_0x316987,null));};exports[_0x9d0c('0x51')]=function(_0x1dac3c,_0x1c2a5e){var _0x50049a={},_0x330658={},_0x55c20c={'count':0x0,'rows':[]};_0x330658[_0x9d0c('0x37')]=_[_0x9d0c('0x35')](db[_0x9d0c('0x30')]['rawAttributes']);_0x330658['query']=_[_0x9d0c('0x35')](_0x1dac3c['query']);_0x330658[_0x9d0c('0x3e')]=_[_0x9d0c('0x36')](_0x330658[_0x9d0c('0x37')],_0x330658[_0x9d0c('0x34')]);_0x50049a['attributes']=_[_0x9d0c('0x36')](_0x330658['model'],qs['fields'](_0x1dac3c[_0x9d0c('0x34')][_0x9d0c('0x39')]));_0x50049a['attributes']=_0x50049a[_0x9d0c('0x38')][_0x9d0c('0x52')]?_0x50049a[_0x9d0c('0x38')]:_0x330658[_0x9d0c('0x37')];if(!_0x1dac3c[_0x9d0c('0x34')][_0x9d0c('0x3a')](_0x9d0c('0x3b'))){_0x50049a[_0x9d0c('0x21')]=qs[_0x9d0c('0x21')](_0x1dac3c['query'][_0x9d0c('0x21')]);_0x50049a[_0x9d0c('0x1e')]=qs[_0x9d0c('0x1e')](_0x1dac3c[_0x9d0c('0x34')][_0x9d0c('0x1e')]);}_0x50049a[_0x9d0c('0x3c')]=qs[_0x9d0c('0x3d')](_0x1dac3c[_0x9d0c('0x34')]['sort']);_0x50049a[_0x9d0c('0x42')]=qs[_0x9d0c('0x3e')](_['pick'](_0x1dac3c['query'],_0x330658[_0x9d0c('0x3e')]));if(_0x1dac3c[_0x9d0c('0x34')][_0x9d0c('0x40')]){_0x50049a[_0x9d0c('0x42')]=_['merge'](_0x50049a['where'],{'$or':_[_0x9d0c('0x2f')](_0x50049a['attributes'],function(_0xfa9959){var _0x35da9d={};_0x35da9d[_0xfa9959]={'$like':'%'+_0x1dac3c[_0x9d0c('0x34')]['filter']+'%'};return _0x35da9d;})});}_0x50049a=_[_0x9d0c('0x41')]({},_0x50049a,_0x1dac3c['options']);var _0x5547dd={'where':_0x50049a[_0x9d0c('0x42')]};return db[_0x9d0c('0x30')][_0x9d0c('0x20')](_0x5547dd)[_0x9d0c('0x27')](function(_0x515794){_0x55c20c['count']=_0x515794;if(_0x1dac3c[_0x9d0c('0x34')][_0x9d0c('0x4a')]){_0x50049a[_0x9d0c('0x4b')]=[{'all':!![]}];}return db[_0x9d0c('0x30')][_0x9d0c('0x45')](_0x50049a);})[_0x9d0c('0x27')](function(_0x326768){_0x55c20c['rows']=_0x326768;return _0x55c20c;})[_0x9d0c('0x27')](respondWithFilteredResult(_0x1c2a5e,_0x50049a,_0x9d0c('0x51')))[_0x9d0c('0x47')](handleError(_0x1c2a5e,null,_0x9d0c('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ef22c13..0ae352b 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 _0x38ec=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x5bc669,_0x47136c){var _0x559e12=function(_0x266f15){while(--_0x266f15){_0x5bc669['push'](_0x5bc669['shift']());}};_0x559e12(++_0x47136c);}(_0x38ec,0xfc));var _0xc38e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38ec[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xc38e('0x0'));var VoiceQueueReport=require(_0xc38e('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc38e('0x2')](0x0);var events={'afterCreate':_0xc38e('0x3'),'afterUpdate':_0xc38e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1eadbb){return function(_0xeb9436,_0x5990cf,_0x151243){VoiceQueueReportEvents[_0xc38e('0x5')](_0x1eadbb+':'+_0xeb9436['id'],_0xeb9436);VoiceQueueReportEvents[_0xc38e('0x5')](_0x1eadbb,_0xeb9436);_0x151243(null);};}for(var e in events){if(events[_0xc38e('0x6')](e)){var event=events[e];VoiceQueueReport[_0xc38e('0x7')](e,emitEvent(event));}}module[_0xc38e('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xc9a8=['emit','hasOwnProperty','hook','events','setMaxListeners','update','remove'];(function(_0x2f4aad,_0x1487fb){var _0x1ddcda=function(_0x29b9eb){while(--_0x29b9eb){_0x2f4aad['push'](_0x2f4aad['shift']());}};_0x1ddcda(++_0x1487fb);}(_0xc9a8,0x65));var _0x8c9a=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xc9a8[_0x8a969d];return _0x1d8dc7;};'use strict';var EventEmitter=require(_0x8c9a('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8c9a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8c9a('0x2'),'afterDestroy':_0x8c9a('0x3')};function emitEvent(_0x15f0d1){return function(_0x516397,_0x309422,_0xa44d7e){VoiceQueueReportEvents[_0x8c9a('0x4')](_0x15f0d1+':'+_0x516397['id'],_0x516397);VoiceQueueReportEvents[_0x8c9a('0x4')](_0x15f0d1,_0x516397);_0xa44d7e(null);};}for(var e in events){if(events[_0x8c9a('0x5')](e)){var event=events[e];VoiceQueueReport[_0x8c9a('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 22fbf6d..aa023ab 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 _0xf961=['calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xf961,0x1cf));var _0x1f96=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xf961[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0x1f96('0x0'));var util=require(_0x1f96('0x1'));var logger=require(_0x1f96('0x2'))(_0x1f96('0x3'));var moment=require('moment');var BPromise=require(_0x1f96('0x4'));var rp=require(_0x1f96('0x5'));var fs=require('fs');var path=require(_0x1f96('0x6'));var rimraf=require('rimraf');var config=require(_0x1f96('0x7'));var attributes=require(_0x1f96('0x8'));module[_0x1f96('0x9')]=function(_0x518062,_0x40caad){return _0x518062['define'](_0x1f96('0xa'),attributes,{'tableName':_0x1f96('0xb'),'paranoid':![],'indexes':[{'fields':[_0x1f96('0xc')]},{'fields':[_0x1f96('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f8a=['report_queue','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x3f8a,0x1a6));var _0xa3f8=function(_0x118f9f,_0x36dddb){_0x118f9f=_0x118f9f-0x0;var _0x118c89=_0x3f8a[_0x118f9f];return _0x118c89;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var rp=require(_0xa3f8('0x6'));var fs=require('fs');var path=require(_0xa3f8('0x7'));var rimraf=require(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var attributes=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x344f67,_0xf2008a){return _0x344f67['define']('VoiceQueueReport',attributes,{'tableName':_0xa3f8('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xa3f8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 71eea26..0e95ca6 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 _0xda0b=['where','limit','include','map','model','attributes','debug','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetVoiceQueueReport','findAll','options','raw'];(function(_0x19b8f8,_0x173e41){var _0x353935=function(_0x6bb440){while(--_0x6bb440){_0x19b8f8['push'](_0x19b8f8['shift']());}};_0x353935(++_0x173e41);}(_0xda0b,0xa9));var _0xbda0=function(_0x3a1130,_0x50b01e){_0x3a1130=_0x3a1130-0x0;var _0xfea215=_0xda0b[_0x3a1130];return _0xfea215;};'use strict';var _=require(_0xbda0('0x0'));var util=require(_0xbda0('0x1'));var moment=require(_0xbda0('0x2'));var BPromise=require(_0xbda0('0x3'));var rs=require(_0xbda0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbda0('0x5'))['db'];var utils=require(_0xbda0('0x6'));var logger=require(_0xbda0('0x7'))(_0xbda0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xbda0('0x9')]=_[_0xbda0('0xa')](config[_0xbda0('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x55a152,_0x440adf,_0x3e4f9){return new BPromise(function(_0x212636,_0x46b61a){return client['request'](_0x55a152,_0x3e4f9)[_0xbda0('0xb')](function(_0x318575){logger[_0xbda0('0xc')](_0xbda0('0xd'),_0x440adf,'request\x20sent');logger['debug'](_0xbda0('0xe'),_0x440adf,_0xbda0('0xf'),JSON[_0xbda0('0x10')](_0x318575));if(_0x318575['error']){if(_0x318575['error'][_0xbda0('0x11')]===0x1f4){logger[_0xbda0('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x440adf,_0x318575['error'][_0xbda0('0x13')]);return _0x46b61a(_0x318575[_0xbda0('0x12')][_0xbda0('0x13')]);}logger[_0xbda0('0x12')](_0xbda0('0xd'),_0x440adf,_0x318575[_0xbda0('0x12')]['message']);return _0x212636(_0x318575[_0xbda0('0x12')][_0xbda0('0x13')]);}else{logger[_0xbda0('0xc')](_0xbda0('0xd'),_0x440adf,_0xbda0('0xf'));_0x212636(_0x318575[_0xbda0('0x14')][_0xbda0('0x13')]);}})[_0xbda0('0x15')](function(_0x4b81ea){logger[_0xbda0('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x440adf,_0x4b81ea);_0x46b61a(_0x4b81ea);});});}exports[_0xbda0('0x16')]=function(_0x3c96d5){var _0x2efb5a=this;return new Promise(function(_0x41b1c8,_0x26f2a0){return db['VoiceQueueReport'][_0xbda0('0x17')]({'raw':_0x3c96d5[_0xbda0('0x18')]?_0x3c96d5['options'][_0xbda0('0x19')]===undefined?!![]:![]:!![],'where':_0x3c96d5[_0xbda0('0x18')]?_0x3c96d5['options'][_0xbda0('0x1a')]||null:null,'attributes':_0x3c96d5[_0xbda0('0x18')]?_0x3c96d5[_0xbda0('0x18')]['attributes']||null:null,'limit':_0x3c96d5[_0xbda0('0x18')]?_0x3c96d5[_0xbda0('0x18')][_0xbda0('0x1b')]||null:null,'include':_0x3c96d5[_0xbda0('0x18')]?_0x3c96d5[_0xbda0('0x18')][_0xbda0('0x1c')]?_[_0xbda0('0x1d')](_0x3c96d5['options'][_0xbda0('0x1c')],function(_0x2c9545){return{'model':db[_0x2c9545[_0xbda0('0x1e')]],'as':_0x2c9545['as'],'attributes':_0x2c9545[_0xbda0('0x1f')],'include':_0x2c9545[_0xbda0('0x1c')]?_['map'](_0x2c9545[_0xbda0('0x1c')],function(_0x71aa8e){return{'model':db[_0x71aa8e[_0xbda0('0x1e')]],'as':_0x71aa8e['as'],'attributes':_0x71aa8e['attributes'],'include':_0x71aa8e['include']?_[_0xbda0('0x1d')](_0x71aa8e[_0xbda0('0x1c')],function(_0x5b7b22){return{'model':db[_0x5b7b22[_0xbda0('0x1e')]],'as':_0x5b7b22['as'],'attributes':_0x5b7b22[_0xbda0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbda0('0xb')](function(_0x5b8d8a){logger[_0xbda0('0xc')](_0xbda0('0x16'),_0x3c96d5);logger[_0xbda0('0x20')]('GetVoiceQueueReport',_0x3c96d5,JSON[_0xbda0('0x10')](_0x5b8d8a));_0x41b1c8(_0x5b8d8a);})[_0xbda0('0x15')](function(_0x31488c){logger[_0xbda0('0x12')](_0xbda0('0x16'),_0x31488c['message'],_0x3c96d5);_0x26f2a0(_0x2efb5a[_0xbda0('0x12')](0x1f4,_0x31488c[_0xbda0('0x13')]));});});};exports[_0xbda0('0x21')]=function(_0x22bd37){var _0x4af2ce=this;return new Promise(function(_0x370063,_0x2d0e6e){return db[_0xbda0('0x22')][_0xbda0('0x23')](_0x22bd37[_0xbda0('0x24')],{'raw':_0x22bd37[_0xbda0('0x18')]?_0x22bd37['options'][_0xbda0('0x19')]===undefined?!![]:![]:!![]})[_0xbda0('0xb')](function(_0x5a8e64){logger['info'](_0xbda0('0x21'),_0x22bd37);logger[_0xbda0('0x20')](_0xbda0('0x21'),_0x22bd37,JSON[_0xbda0('0x10')](_0x5a8e64));_0x370063(_0x5a8e64);})[_0xbda0('0x15')](function(_0x5bbcdf){logger[_0xbda0('0x12')]('CreateVoiceQueueReport',_0x5bbcdf[_0xbda0('0x13')],_0x22bd37);_0x2d0e6e(_0x4af2ce[_0xbda0('0x12')](0x1f4,_0x5bbcdf['message']));});});};exports[_0xbda0('0x25')]=function(_0x5286cf){var _0x29db4f=this;return new Promise(function(_0xa6e7d4,_0x442e69){return db[_0xbda0('0x22')][_0xbda0('0x26')](_0x5286cf[_0xbda0('0x24')],{'raw':_0x5286cf[_0xbda0('0x18')]?_0x5286cf[_0xbda0('0x18')][_0xbda0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5286cf[_0xbda0('0x18')]?_0x5286cf[_0xbda0('0x18')][_0xbda0('0x1a')]||null:null,'attributes':_0x5286cf[_0xbda0('0x18')]?_0x5286cf[_0xbda0('0x18')][_0xbda0('0x1f')]||null:null,'limit':_0x5286cf[_0xbda0('0x18')]?_0x5286cf['options'][_0xbda0('0x1b')]||null:null})[_0xbda0('0xb')](function(_0x41aac9){logger[_0xbda0('0xc')](_0xbda0('0x25'),_0x5286cf);logger[_0xbda0('0x20')](_0xbda0('0x25'),_0x5286cf,JSON[_0xbda0('0x10')](_0x41aac9));_0xa6e7d4(_0x41aac9);})[_0xbda0('0x15')](function(_0x295ccb){logger[_0xbda0('0x12')](_0xbda0('0x25'),_0x295ccb[_0xbda0('0x13')],_0x5286cf);_0x442e69(_0x29db4f['error'](0x1f4,_0x295ccb[_0xbda0('0x13')]));});});}; \ No newline at end of file +var _0x20c3=['map','model','then','GetVoiceQueueReport','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','VoiceQueueReport','findAll','options','attributes','limit','include'];(function(_0x1c291d,_0x1e9835){var _0x3b6d0c=function(_0x286f92){while(--_0x286f92){_0x1c291d['push'](_0x1c291d['shift']());}};_0x3b6d0c(++_0x1e9835);}(_0x20c3,0xe8));var _0x320c=function(_0x2009d9,_0x58fb32){_0x2009d9=_0x2009d9-0x0;var _0x184540=_0x20c3[_0x2009d9];return _0x184540;};'use strict';var _=require('lodash');var util=require(_0x320c('0x0'));var moment=require(_0x320c('0x1'));var BPromise=require(_0x320c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x320c('0x3'));var db=require(_0x320c('0x4'))['db'];var utils=require(_0x320c('0x5'));var logger=require(_0x320c('0x6'))(_0x320c('0x7'));var config=require('../../config/environment');var jayson=require(_0x320c('0x8'));var client=jayson[_0x320c('0x9')][_0x320c('0xa')]({'port':0x232a});config[_0x320c('0xb')]=_[_0x320c('0xc')](config[_0x320c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x320c('0xd'))(new Redis(config[_0x320c('0xb')]));require(_0x320c('0xe'))[_0x320c('0xf')](socket);function respondWithRpcPromise(_0x541f9e,_0x3493cd,_0x429357){return new BPromise(function(_0x90e00,_0x573763){return client[_0x320c('0x10')](_0x541f9e,_0x429357)['then'](function(_0x49dbaf){logger[_0x320c('0x11')](_0x320c('0x12'),_0x3493cd,_0x320c('0x13'));logger[_0x320c('0x14')](_0x320c('0x15'),_0x3493cd,'request\x20sent',JSON[_0x320c('0x16')](_0x49dbaf));if(_0x49dbaf['error']){if(_0x49dbaf['error'][_0x320c('0x17')]===0x1f4){logger[_0x320c('0x18')](_0x320c('0x12'),_0x3493cd,_0x49dbaf[_0x320c('0x18')][_0x320c('0x19')]);return _0x573763(_0x49dbaf[_0x320c('0x18')][_0x320c('0x19')]);}logger['error'](_0x320c('0x12'),_0x3493cd,_0x49dbaf[_0x320c('0x18')][_0x320c('0x19')]);return _0x90e00(_0x49dbaf[_0x320c('0x18')][_0x320c('0x19')]);}else{logger[_0x320c('0x11')](_0x320c('0x12'),_0x3493cd,_0x320c('0x13'));_0x90e00(_0x49dbaf['result'][_0x320c('0x19')]);}})['catch'](function(_0xc3919){logger[_0x320c('0x18')](_0x320c('0x12'),_0x3493cd,_0xc3919);_0x573763(_0xc3919);});});}exports['GetVoiceQueueReport']=function(_0x3b5926){var _0x1d0f7f=this;return new Promise(function(_0x473981,_0x3e0013){return db[_0x320c('0x1a')][_0x320c('0x1b')]({'raw':_0x3b5926[_0x320c('0x1c')]?_0x3b5926['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b5926['options']?_0x3b5926['options']['where']||null:null,'attributes':_0x3b5926[_0x320c('0x1c')]?_0x3b5926['options'][_0x320c('0x1d')]||null:null,'limit':_0x3b5926[_0x320c('0x1c')]?_0x3b5926[_0x320c('0x1c')][_0x320c('0x1e')]||null:null,'include':_0x3b5926[_0x320c('0x1c')]?_0x3b5926[_0x320c('0x1c')][_0x320c('0x1f')]?_[_0x320c('0x20')](_0x3b5926['options'][_0x320c('0x1f')],function(_0x84c37f){return{'model':db[_0x84c37f['model']],'as':_0x84c37f['as'],'attributes':_0x84c37f[_0x320c('0x1d')],'include':_0x84c37f[_0x320c('0x1f')]?_[_0x320c('0x20')](_0x84c37f[_0x320c('0x1f')],function(_0x25c313){return{'model':db[_0x25c313[_0x320c('0x21')]],'as':_0x25c313['as'],'attributes':_0x25c313['attributes'],'include':_0x25c313[_0x320c('0x1f')]?_[_0x320c('0x20')](_0x25c313[_0x320c('0x1f')],function(_0x36b25b){return{'model':db[_0x36b25b[_0x320c('0x21')]],'as':_0x36b25b['as'],'attributes':_0x36b25b[_0x320c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x320c('0x22')](function(_0x21c27d){logger['info'](_0x320c('0x23'),_0x3b5926);logger[_0x320c('0x14')](_0x320c('0x23'),_0x3b5926,JSON[_0x320c('0x16')](_0x21c27d));_0x473981(_0x21c27d);})[_0x320c('0x24')](function(_0x196a50){logger['error'](_0x320c('0x23'),_0x196a50[_0x320c('0x19')],_0x3b5926);_0x3e0013(_0x1d0f7f[_0x320c('0x18')](0x1f4,_0x196a50[_0x320c('0x19')]));});});};exports[_0x320c('0x25')]=function(_0xa7517a){var _0x1cfcc1=this;return new Promise(function(_0x27bd87,_0x310b4d){return db[_0x320c('0x1a')][_0x320c('0x26')](_0xa7517a[_0x320c('0x27')],{'raw':_0xa7517a[_0x320c('0x1c')]?_0xa7517a[_0x320c('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x320c('0x22')](function(_0x1d2b93){logger[_0x320c('0x11')](_0x320c('0x25'),_0xa7517a);logger[_0x320c('0x14')]('CreateVoiceQueueReport',_0xa7517a,JSON['stringify'](_0x1d2b93));_0x27bd87(_0x1d2b93);})[_0x320c('0x24')](function(_0x3250e1){logger['error'](_0x320c('0x25'),_0x3250e1['message'],_0xa7517a);_0x310b4d(_0x1cfcc1['error'](0x1f4,_0x3250e1[_0x320c('0x19')]));});});};exports[_0x320c('0x28')]=function(_0x4e328c){var _0x359802=this;return new Promise(function(_0x70a23,_0x5bf637){return db[_0x320c('0x1a')][_0x320c('0x29')](_0x4e328c[_0x320c('0x27')],{'raw':_0x4e328c['options']?_0x4e328c[_0x320c('0x1c')][_0x320c('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e328c['options']?_0x4e328c[_0x320c('0x1c')][_0x320c('0x2b')]||null:null,'attributes':_0x4e328c[_0x320c('0x1c')]?_0x4e328c['options'][_0x320c('0x1d')]||null:null,'limit':_0x4e328c[_0x320c('0x1c')]?_0x4e328c[_0x320c('0x1c')][_0x320c('0x1e')]||null:null})[_0x320c('0x22')](function(_0x176989){logger[_0x320c('0x11')](_0x320c('0x28'),_0x4e328c);logger[_0x320c('0x14')]('UpdateVoiceQueueReport',_0x4e328c,JSON[_0x320c('0x16')](_0x176989));_0x70a23(_0x176989);})['catch'](function(_0x2f2be4){logger[_0x320c('0x18')](_0x320c('0x28'),_0x2f2be4[_0x320c('0x19')],_0x4e328c);_0x5bf637(_0x359802[_0x320c('0x18')](0x1f4,_0x2f2be4[_0x320c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b60b356..7a68ee0 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 _0x3edb=['removeListener','voiceQueueReport:','./voiceQueueReport.events','save','update'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x3edb,0x1c9));var _0xb3ed=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x3edb[_0xf50820];return _0x2a9b10;};'use strict';var VoiceQueueReportEvents=require(_0xb3ed('0x0'));var events=[_0xb3ed('0x1'),'remove',_0xb3ed('0x2')];function createListener(_0x118064,_0x1c88cc){return function(_0x423984){_0x1c88cc['emit'](_0x118064,_0x423984);};}function removeListener(_0x1992b6,_0x5bfbb5){return function(){VoiceQueueReportEvents[_0xb3ed('0x3')](_0x1992b6,_0x5bfbb5);};}exports['register']=function(_0xa51c35){for(var _0x28a1c6=0x0,_0xa0f681=events['length'];_0x28a1c6<_0xa0f681;_0x28a1c6++){var _0xcd6a84=events[_0x28a1c6];var _0x3c968c=createListener(_0xb3ed('0x4')+_0xcd6a84,_0xa51c35);VoiceQueueReportEvents['on'](_0xcd6a84,_0x3c968c);}}; \ No newline at end of file +var _0x85d8=['remove','update','emit','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_0x85d8,0x1b0));var _0x885d=function(_0x3dfa26,_0x3c45fc){_0x3dfa26=_0x3dfa26-0x0;var _0x409b3d=_0x85d8[_0x3dfa26];return _0x409b3d;};'use strict';var VoiceQueueReportEvents=require(_0x885d('0x0'));var events=[_0x885d('0x1'),_0x885d('0x2'),_0x885d('0x3')];function createListener(_0x3e5eab,_0x5bad48){return function(_0x328261){_0x5bad48[_0x885d('0x4')](_0x3e5eab,_0x328261);};}function removeListener(_0x320d7d,_0x3fe8a0){return function(){VoiceQueueReportEvents['removeListener'](_0x320d7d,_0x3fe8a0);};}exports['register']=function(_0x186504){for(var _0x30dcc2=0x0,_0x3715b4=events[_0x885d('0x5')];_0x30dcc2<_0x3715b4;_0x30dcc2++){var _0x18428b=events[_0x30dcc2];var _0x11e6d7=createListener(_0x885d('0x6')+_0x18428b,_0x186504);VoiceQueueReportEvents['on'](_0x18428b,_0x11e6d7);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3881c36..27b5be0 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 _0x9f29=['put','/:id','multer','util','path','connect-timeout','express','fs-extra','./voiceQueuesLog.controller','isAuthenticated','get','show','post','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9f29,0x64));var _0x99f2=function(_0x1cb218,_0x10223b){_0x1cb218=_0x1cb218-0x0;var _0x19da5c=_0x9f29[_0x1cb218];return _0x19da5c;};'use strict';var multer=require(_0x99f2('0x0'));var util=require(_0x99f2('0x1'));var path=require(_0x99f2('0x2'));var timeout=require(_0x99f2('0x3'));var express=require(_0x99f2('0x4'));var router=express['Router']();var fs_extra=require(_0x99f2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x99f2('0x6'));router['get']('/',auth[_0x99f2('0x7')](),controller['index']);router[_0x99f2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x99f2('0x9')]);router[_0x99f2('0xa')]('/',auth[_0x99f2('0x7')](),controller[_0x99f2('0xb')]);router[_0x99f2('0xc')](_0x99f2('0xd'),auth[_0x99f2('0x7')](),controller['update']);router['delete'](_0x99f2('0xd'),auth[_0x99f2('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x208d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5cb384,_0x2f14c7){var _0x38884a=function(_0x489527){while(--_0x489527){_0x5cb384['push'](_0x5cb384['shift']());}};_0x38884a(++_0x2f14c7);}(_0x208d,0xa4));var _0xd208=function(_0x1499c4,_0x57c5c3){_0x1499c4=_0x1499c4-0x0;var _0x3cf45a=_0x208d[_0x1499c4];return _0x3cf45a;};'use strict';var multer=require(_0xd208('0x0'));var util=require(_0xd208('0x1'));var path=require(_0xd208('0x2'));var timeout=require(_0xd208('0x3'));var express=require('express');var router=express[_0xd208('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd208('0x5'));var interaction=require(_0xd208('0x6'));var config=require(_0xd208('0x7'));var controller=require(_0xd208('0x8'));router[_0xd208('0x9')]('/',auth['isAuthenticated'](),controller[_0xd208('0xa')]);router[_0xd208('0x9')](_0xd208('0xb'),auth['isAuthenticated'](),controller[_0xd208('0xc')]);router[_0xd208('0xd')]('/',auth['isAuthenticated'](),controller[_0xd208('0xe')]);router[_0xd208('0xf')]('/:id',auth[_0xd208('0x10')](),controller[_0xd208('0x11')]);router[_0xd208('0x12')](_0xd208('0xb'),auth['isAuthenticated'](),controller[_0xd208('0x13')]);module[_0xd208('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 15b44d8..468a759 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 _0xf801=['sequelize','exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x13753b,_0x331b3e){var _0x1aed0c=function(_0x4b7189){while(--_0x4b7189){_0x13753b['push'](_0x13753b['shift']());}};_0x1aed0c(++_0x331b3e);}(_0xf801,0x87));var _0x1f80=function(_0x23a042,_0x169361){_0x23a042=_0x23a042-0x0;var _0x57543a=_0xf801[_0x23a042];return _0x57543a;};'use strict';var Sequelize=require(_0x1f80('0x0'));var moment=require('moment');module[_0x1f80('0x1')]={'time':{'type':Sequelize[_0x1f80('0x2')]},'callid':{'type':Sequelize[_0x1f80('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x1f80('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1f80('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1f80('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1f80('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x1f80('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x1f80('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1f80('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1f80('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x1f80('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1f80('0x3')](_0x1f80('0x4'))}}; \ No newline at end of file +var _0x301c=['sequelize','moment','exports','STRING','DATE','literal'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x301c,0x150));var _0xc301=function(_0x5a852b,_0x1694c2){_0x5a852b=_0x5a852b-0x0;var _0xd74d84=_0x301c[_0x5a852b];return _0xd74d84;};'use strict';var Sequelize=require(_0xc301('0x0'));var moment=require(_0xc301('0x1'));module[_0xc301('0x2')]={'time':{'type':Sequelize[_0xc301('0x3')]},'callid':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc301('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xc301('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 1cd5d8c..31c25c7 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 _0xe13c=['filters','model','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','intersection','fields','length','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','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','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','key','query','keys'];(function(_0x36aad0,_0x3d2e17){var _0x31e987=function(_0x2d0fe4){while(--_0x2d0fe4){_0x36aad0['push'](_0x36aad0['shift']());}};_0x31e987(++_0x3d2e17);}(_0xe13c,0x105));var _0xce13=function(_0x124bc9,_0x506af3){_0x124bc9=_0x124bc9-0x0;var _0x547b54=_0xe13c[_0x124bc9];return _0x547b54;};'use strict';var emlformat=require(_0xce13('0x0'));var rimraf=require(_0xce13('0x1'));var zipdir=require(_0xce13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xce13('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xce13('0x4'));var util=require(_0xce13('0x5'));var path=require(_0xce13('0x6'));var sox=require(_0xce13('0x7'));var csv=require('to-csv');var ejs=require(_0xce13('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce13('0x9'));var squel=require('squel');var crypto=require(_0xce13('0xa'));var jsforce=require(_0xce13('0xb'));var deskjs=require(_0xce13('0xc'));var toCsv=require(_0xce13('0xd'));var querystring=require(_0xce13('0xe'));var Papa=require(_0xce13('0xf'));var Redis=require(_0xce13('0x10'));var authService=require(_0xce13('0x11'));var qs=require(_0xce13('0x12'));var as=require(_0xce13('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce13('0x14'))(_0xce13('0x15'));var utils=require(_0xce13('0x16'));var config=require(_0xce13('0x17'));var licenseUtil=require(_0xce13('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x946e60,_0x299507){_0x299507=_0x299507||0xcc;return function(_0x5d7782){if(_0x5d7782){return _0x946e60[_0xce13('0x19')](_0x299507);}return _0x946e60[_0xce13('0x1a')](_0x299507)[_0xce13('0x1b')]();};}function respondWithResult(_0x58fd50,_0x1a4802){_0x1a4802=_0x1a4802||0xc8;return function(_0x476d06){if(_0x476d06){return _0x58fd50[_0xce13('0x1a')](_0x1a4802)['json'](_0x476d06);}};}function respondWithFilteredResult(_0x4ff447,_0x55f6a4){return function(_0x705175){if(_0x705175){var _0x2c0890=typeof _0x55f6a4[_0xce13('0x1c')]===_0xce13('0x1d')&&typeof _0x55f6a4['limit']===_0xce13('0x1d');var _0x1ca2b3=_0x705175['count'];var _0x1772e0=_0x2c0890?0x0:_0x55f6a4[_0xce13('0x1c')];var _0x47bf04=_0x2c0890?_0x705175[_0xce13('0x1e')]:_0x55f6a4[_0xce13('0x1c')]+_0x55f6a4[_0xce13('0x1f')];var _0x4c9fd6;if(_0x47bf04>=_0x1ca2b3){_0x47bf04=_0x1ca2b3;_0x4c9fd6=0xc8;}else{_0x4c9fd6=0xce;}_0x4ff447[_0xce13('0x1a')](_0x4c9fd6);return _0x4ff447[_0xce13('0x20')](_0xce13('0x21'),_0x1772e0+'-'+_0x47bf04+'/'+_0x1ca2b3)[_0xce13('0x22')](_0x705175);}return null;};}function patchUpdates(_0x54a661){return function(_0x120477){try{jsonpatch['apply'](_0x120477,_0x54a661,!![]);}catch(_0x27eee4){return BPromise[_0xce13('0x23')](_0x27eee4);}return _0x120477[_0xce13('0x24')]();};}function saveUpdates(_0x213fe8,_0x149fdc){return function(_0x4e1727){if(_0x4e1727){return _0x4e1727[_0xce13('0x25')](_0x213fe8)['then'](function(_0x21250d){return _0x21250d;});}return null;};}function removeEntity(_0x41c413,_0x41757b){return function(_0x5951e5){if(_0x5951e5){return _0x5951e5['destroy']()[_0xce13('0x26')](function(){_0x41c413[_0xce13('0x1a')](0xcc)[_0xce13('0x1b')]();});}};}function handleEntityNotFound(_0x46b8a9,_0x527101){return function(_0x170b03){if(!_0x170b03){_0x46b8a9[_0xce13('0x19')](0x194);}return _0x170b03;};}function handleError(_0x3464f2,_0x11a754){_0x11a754=_0x11a754||0x1f4;return function(_0x12f2c2){logger[_0xce13('0x27')](_0x12f2c2[_0xce13('0x28')]);if(_0x12f2c2[_0xce13('0x29')]){delete _0x12f2c2[_0xce13('0x29')];}_0x3464f2['status'](_0x11a754)[_0xce13('0x2a')](_0x12f2c2);};}exports[_0xce13('0x2b')]=function(_0x379ff7,_0xaebadb){var _0x8d87f5={},_0x15fb2e={},_0x148e92={'count':0x0,'rows':[]};var _0x4fbb5a=_[_0xce13('0x2c')](db[_0xce13('0x2d')]['rawAttributes'],function(_0x49d7d7){return{'name':_0x49d7d7[_0xce13('0x2e')],'type':_0x49d7d7[_0xce13('0x2f')][_0xce13('0x30')]};});_0x15fb2e['model']=_['map'](_0x4fbb5a,_0xce13('0x29'));_0x15fb2e[_0xce13('0x31')]=_[_0xce13('0x32')](_0x379ff7[_0xce13('0x31')]);_0x15fb2e[_0xce13('0x33')]=_['intersection'](_0x15fb2e[_0xce13('0x34')],_0x15fb2e['query']);_0x8d87f5[_0xce13('0x35')]=_['intersection'](_0x15fb2e['model'],qs['fields'](_0x379ff7[_0xce13('0x31')]['fields']));_0x8d87f5[_0xce13('0x35')]=_0x8d87f5['attributes']['length']?_0x8d87f5['attributes']:_0x15fb2e[_0xce13('0x34')];if(!_0x379ff7['query'][_0xce13('0x36')](_0xce13('0x37'))){_0x8d87f5[_0xce13('0x1f')]=qs[_0xce13('0x1f')](_0x379ff7[_0xce13('0x31')]['limit']);_0x8d87f5[_0xce13('0x1c')]=qs[_0xce13('0x1c')](_0x379ff7[_0xce13('0x31')][_0xce13('0x1c')]);}_0x8d87f5[_0xce13('0x38')]=qs[_0xce13('0x39')](_0x379ff7[_0xce13('0x31')]['sort']);_0x8d87f5['where']=qs[_0xce13('0x33')](_[_0xce13('0x3a')](_0x379ff7[_0xce13('0x31')],_0x15fb2e[_0xce13('0x33')]),_0x4fbb5a);if(_0x379ff7[_0xce13('0x31')][_0xce13('0x3b')]){_0x8d87f5[_0xce13('0x3c')]=_[_0xce13('0x3d')](_0x8d87f5[_0xce13('0x3c')],{'$or':_['map'](_0x4fbb5a,function(_0x456616){if(_0x456616[_0xce13('0x2f')]!==_0xce13('0x3e')){var _0x2e29bc={};_0x2e29bc[_0x456616[_0xce13('0x29')]]={'$like':'%'+_0x379ff7['query'][_0xce13('0x3b')]+'%'};return _0x2e29bc;}})});}_0x8d87f5=_[_0xce13('0x3d')]({},_0x8d87f5,_0x379ff7[_0xce13('0x3f')]);var _0x3ba62a={'where':_0x8d87f5['where']};return db[_0xce13('0x2d')][_0xce13('0x1e')](_0x3ba62a)[_0xce13('0x26')](function(_0x1a22dc){_0x148e92[_0xce13('0x1e')]=_0x1a22dc;if(_0x379ff7[_0xce13('0x31')][_0xce13('0x40')]){_0x8d87f5[_0xce13('0x41')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xce13('0x42')](_0x8d87f5);})[_0xce13('0x26')](function(_0x1a7d93){_0x148e92['rows']=_0x1a7d93;return _0x148e92;})['then'](respondWithFilteredResult(_0xaebadb,_0x8d87f5))['catch'](handleError(_0xaebadb,null));};exports[_0xce13('0x43')]=function(_0x2358d4,_0x19cd49){var _0x37cf80={'raw':!![],'where':{'id':_0x2358d4[_0xce13('0x44')]['id']}},_0x4d90b1={};_0x4d90b1[_0xce13('0x34')]=_[_0xce13('0x32')](db[_0xce13('0x2d')][_0xce13('0x45')]);_0x4d90b1[_0xce13('0x31')]=_[_0xce13('0x32')](_0x2358d4[_0xce13('0x31')]);_0x4d90b1[_0xce13('0x33')]=_['intersection'](_0x4d90b1['model'],_0x4d90b1[_0xce13('0x31')]);_0x37cf80[_0xce13('0x35')]=_[_0xce13('0x46')](_0x4d90b1[_0xce13('0x34')],qs[_0xce13('0x47')](_0x2358d4['query']['fields']));_0x37cf80[_0xce13('0x35')]=_0x37cf80['attributes'][_0xce13('0x48')]?_0x37cf80['attributes']:_0x4d90b1[_0xce13('0x34')];if(_0x2358d4['query'][_0xce13('0x40')]){_0x37cf80[_0xce13('0x41')]=[{'all':!![]}];}_0x37cf80=_[_0xce13('0x3d')]({},_0x37cf80,_0x2358d4[_0xce13('0x3f')]);return db[_0xce13('0x2d')][_0xce13('0x49')](_0x37cf80)['then'](handleEntityNotFound(_0x19cd49,null))[_0xce13('0x26')](respondWithResult(_0x19cd49,null))[_0xce13('0x4a')](handleError(_0x19cd49,null));};exports[_0xce13('0x4b')]=function(_0x5a62fe,_0x3e5cf2){return db['VoiceQueuesLog'][_0xce13('0x4b')](_0x5a62fe[_0xce13('0x4c')],{})[_0xce13('0x26')](respondWithResult(_0x3e5cf2,0xc9))['catch'](handleError(_0x3e5cf2,null));};exports['update']=function(_0x2065c6,_0x40403f){if(_0x2065c6[_0xce13('0x4c')]['id']){delete _0x2065c6[_0xce13('0x4c')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x2065c6[_0xce13('0x44')]['id']}})['then'](handleEntityNotFound(_0x40403f,null))[_0xce13('0x26')](saveUpdates(_0x2065c6[_0xce13('0x4c')],null))['then'](respondWithResult(_0x40403f,null))[_0xce13('0x4a')](handleError(_0x40403f,null));};exports[_0xce13('0x4d')]=function(_0x1295c6,_0x6114cc){return db[_0xce13('0x2d')][_0xce13('0x49')]({'where':{'id':_0x1295c6[_0xce13('0x44')]['id']}})[_0xce13('0x26')](handleEntityNotFound(_0x6114cc,null))[_0xce13('0x26')](removeEntity(_0x6114cc,null))[_0xce13('0x4a')](handleError(_0x6114cc,null));}; \ No newline at end of file +var _0xbe8a=['filter','VIRTUAL','merge','VoiceQueuesLog','includeAll','catch','show','params','include','options','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','end','status','json','offset','count','limit','set','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x2464c7,_0xed8be){var _0x5a52a7=function(_0xeb1a55){while(--_0xeb1a55){_0x2464c7['push'](_0x2464c7['shift']());}};_0x5a52a7(++_0xed8be);}(_0xbe8a,0x97));var _0xabe8=function(_0x1d0aee,_0x2c4454){_0x1d0aee=_0x1d0aee-0x0;var _0x34ee2c=_0xbe8a[_0x1d0aee];return _0x34ee2c;};'use strict';var emlformat=require(_0xabe8('0x0'));var rimraf=require(_0xabe8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xabe8('0x2'));var moment=require(_0xabe8('0x3'));var BPromise=require(_0xabe8('0x4'));var Mustache=require('mustache');var util=require(_0xabe8('0x5'));var path=require(_0xabe8('0x6'));var sox=require(_0xabe8('0x7'));var csv=require('to-csv');var ejs=require(_0xabe8('0x8'));var fs=require('fs');var fs_extra=require(_0xabe8('0x9'));var _=require(_0xabe8('0xa'));var squel=require(_0xabe8('0xb'));var crypto=require(_0xabe8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xabe8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xabe8('0xe'));var Papa=require(_0xabe8('0xf'));var Redis=require(_0xabe8('0x10'));var authService=require(_0xabe8('0x11'));var qs=require(_0xabe8('0x12'));var as=require(_0xabe8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabe8('0x14'))(_0xabe8('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xabe8('0x16'))['db'];function respondWithStatusCode(_0x1aba8a,_0x23993f){_0x23993f=_0x23993f||0xcc;return function(_0x5f32ec){if(_0x5f32ec){return _0x1aba8a['sendStatus'](_0x23993f);}return _0x1aba8a['status'](_0x23993f)[_0xabe8('0x17')]();};}function respondWithResult(_0x5f2fbb,_0x42f3c3){_0x42f3c3=_0x42f3c3||0xc8;return function(_0x39d4ef){if(_0x39d4ef){return _0x5f2fbb[_0xabe8('0x18')](_0x42f3c3)[_0xabe8('0x19')](_0x39d4ef);}};}function respondWithFilteredResult(_0xa00a8c,_0x392706){return function(_0x5d62c8){if(_0x5d62c8){var _0x16f786=typeof _0x392706[_0xabe8('0x1a')]==='undefined'&&typeof _0x392706['limit']==='undefined';var _0x266fe3=_0x5d62c8[_0xabe8('0x1b')];var _0xdb83eb=_0x16f786?0x0:_0x392706['offset'];var _0x514f64=_0x16f786?_0x5d62c8[_0xabe8('0x1b')]:_0x392706[_0xabe8('0x1a')]+_0x392706[_0xabe8('0x1c')];var _0x27e83a;if(_0x514f64>=_0x266fe3){_0x514f64=_0x266fe3;_0x27e83a=0xc8;}else{_0x27e83a=0xce;}_0xa00a8c['status'](_0x27e83a);return _0xa00a8c[_0xabe8('0x1d')]('Content-Range',_0xdb83eb+'-'+_0x514f64+'/'+_0x266fe3)[_0xabe8('0x19')](_0x5d62c8);}return null;};}function patchUpdates(_0x1121dd){return function(_0x3793a6){try{jsonpatch['apply'](_0x3793a6,_0x1121dd,!![]);}catch(_0x41cd13){return BPromise['reject'](_0x41cd13);}return _0x3793a6[_0xabe8('0x1e')]();};}function saveUpdates(_0x5c99b8,_0x5c35ce){return function(_0x408e6b){if(_0x408e6b){return _0x408e6b[_0xabe8('0x1f')](_0x5c99b8)[_0xabe8('0x20')](function(_0x5f3d73){return _0x5f3d73;});}return null;};}function removeEntity(_0x19e675,_0x375f1b){return function(_0x763ce3){if(_0x763ce3){return _0x763ce3['destroy']()[_0xabe8('0x20')](function(){_0x19e675[_0xabe8('0x18')](0xcc)[_0xabe8('0x17')]();});}};}function handleEntityNotFound(_0x5548aa,_0x4c99c6){return function(_0x42d3c2){if(!_0x42d3c2){_0x5548aa[_0xabe8('0x21')](0x194);}return _0x42d3c2;};}function handleError(_0x349417,_0x569d94){_0x569d94=_0x569d94||0x1f4;return function(_0x204f48){logger[_0xabe8('0x22')](_0x204f48['stack']);if(_0x204f48[_0xabe8('0x23')]){delete _0x204f48['name'];}_0x349417['status'](_0x569d94)[_0xabe8('0x24')](_0x204f48);};}exports[_0xabe8('0x25')]=function(_0xe88231,_0x10a9ef){var _0x2d7311={},_0x50aa57={},_0x209b96={'count':0x0,'rows':[]};var _0x50cc15=_[_0xabe8('0x26')](db['VoiceQueuesLog'][_0xabe8('0x27')],function(_0x58f0be){return{'name':_0x58f0be[_0xabe8('0x28')],'type':_0x58f0be[_0xabe8('0x29')][_0xabe8('0x2a')]};});_0x50aa57[_0xabe8('0x2b')]=_[_0xabe8('0x26')](_0x50cc15,'name');_0x50aa57[_0xabe8('0x2c')]=_[_0xabe8('0x2d')](_0xe88231['query']);_0x50aa57[_0xabe8('0x2e')]=_[_0xabe8('0x2f')](_0x50aa57[_0xabe8('0x2b')],_0x50aa57[_0xabe8('0x2c')]);_0x2d7311['attributes']=_[_0xabe8('0x2f')](_0x50aa57['model'],qs[_0xabe8('0x30')](_0xe88231['query'][_0xabe8('0x30')]));_0x2d7311['attributes']=_0x2d7311[_0xabe8('0x31')][_0xabe8('0x32')]?_0x2d7311['attributes']:_0x50aa57['model'];if(!_0xe88231['query'][_0xabe8('0x33')](_0xabe8('0x34'))){_0x2d7311['limit']=qs['limit'](_0xe88231[_0xabe8('0x2c')][_0xabe8('0x1c')]);_0x2d7311[_0xabe8('0x1a')]=qs['offset'](_0xe88231[_0xabe8('0x2c')][_0xabe8('0x1a')]);}_0x2d7311['order']=qs[_0xabe8('0x35')](_0xe88231[_0xabe8('0x2c')][_0xabe8('0x35')]);_0x2d7311[_0xabe8('0x36')]=qs['filters'](_[_0xabe8('0x37')](_0xe88231['query'],_0x50aa57[_0xabe8('0x2e')]),_0x50cc15);if(_0xe88231[_0xabe8('0x2c')][_0xabe8('0x38')]){_0x2d7311['where']=_['merge'](_0x2d7311['where'],{'$or':_[_0xabe8('0x26')](_0x50cc15,function(_0x4fc6fb){if(_0x4fc6fb[_0xabe8('0x29')]!==_0xabe8('0x39')){var _0x5ed9e3={};_0x5ed9e3[_0x4fc6fb[_0xabe8('0x23')]]={'$like':'%'+_0xe88231[_0xabe8('0x2c')][_0xabe8('0x38')]+'%'};return _0x5ed9e3;}})});}_0x2d7311=_[_0xabe8('0x3a')]({},_0x2d7311,_0xe88231['options']);var _0x23b14e={'where':_0x2d7311[_0xabe8('0x36')]};return db[_0xabe8('0x3b')]['count'](_0x23b14e)[_0xabe8('0x20')](function(_0x11184f){_0x209b96[_0xabe8('0x1b')]=_0x11184f;if(_0xe88231[_0xabe8('0x2c')][_0xabe8('0x3c')]){_0x2d7311['include']=[{'all':!![]}];}return db[_0xabe8('0x3b')]['findAll'](_0x2d7311);})[_0xabe8('0x20')](function(_0x1f6fab){_0x209b96['rows']=_0x1f6fab;return _0x209b96;})[_0xabe8('0x20')](respondWithFilteredResult(_0x10a9ef,_0x2d7311))[_0xabe8('0x3d')](handleError(_0x10a9ef,null));};exports[_0xabe8('0x3e')]=function(_0x14e4a4,_0x3da9eb){var _0x3a107e={'raw':!![],'where':{'id':_0x14e4a4[_0xabe8('0x3f')]['id']}},_0x458801={};_0x458801[_0xabe8('0x2b')]=_[_0xabe8('0x2d')](db['VoiceQueuesLog'][_0xabe8('0x27')]);_0x458801[_0xabe8('0x2c')]=_['keys'](_0x14e4a4[_0xabe8('0x2c')]);_0x458801[_0xabe8('0x2e')]=_[_0xabe8('0x2f')](_0x458801[_0xabe8('0x2b')],_0x458801['query']);_0x3a107e['attributes']=_[_0xabe8('0x2f')](_0x458801[_0xabe8('0x2b')],qs[_0xabe8('0x30')](_0x14e4a4['query'][_0xabe8('0x30')]));_0x3a107e[_0xabe8('0x31')]=_0x3a107e['attributes'][_0xabe8('0x32')]?_0x3a107e[_0xabe8('0x31')]:_0x458801['model'];if(_0x14e4a4[_0xabe8('0x2c')][_0xabe8('0x3c')]){_0x3a107e[_0xabe8('0x40')]=[{'all':!![]}];}_0x3a107e=_[_0xabe8('0x3a')]({},_0x3a107e,_0x14e4a4[_0xabe8('0x41')]);return db[_0xabe8('0x3b')][_0xabe8('0x42')](_0x3a107e)['then'](handleEntityNotFound(_0x3da9eb,null))[_0xabe8('0x20')](respondWithResult(_0x3da9eb,null))[_0xabe8('0x3d')](handleError(_0x3da9eb,null));};exports['create']=function(_0x52a4c5,_0x41d294){return db[_0xabe8('0x3b')][_0xabe8('0x43')](_0x52a4c5[_0xabe8('0x44')],{})['then'](respondWithResult(_0x41d294,0xc9))[_0xabe8('0x3d')](handleError(_0x41d294,null));};exports['update']=function(_0x15e8eb,_0x3be412){if(_0x15e8eb['body']['id']){delete _0x15e8eb[_0xabe8('0x44')]['id'];}return db['VoiceQueuesLog'][_0xabe8('0x42')]({'where':{'id':_0x15e8eb[_0xabe8('0x3f')]['id']}})[_0xabe8('0x20')](handleEntityNotFound(_0x3be412,null))[_0xabe8('0x20')](saveUpdates(_0x15e8eb['body'],null))['then'](respondWithResult(_0x3be412,null))[_0xabe8('0x3d')](handleError(_0x3be412,null));};exports['destroy']=function(_0x543c40,_0x1db813){return db[_0xabe8('0x3b')][_0xabe8('0x42')]({'where':{'id':_0x543c40[_0xabe8('0x3f')]['id']}})[_0xabe8('0x20')](handleEntityNotFound(_0x1db813,null))[_0xabe8('0x20')](removeEntity(_0x1db813,null))[_0xabe8('0x3d')](handleError(_0x1db813,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 5ccd085..b800d65 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 _0x32f8=['../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','event_dtm','dtm','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x32f8,0xaf));var _0x832f=function(_0x4ab08e,_0x118a81){_0x4ab08e=_0x4ab08e-0x0;var _0x51dac0=_0x32f8[_0x4ab08e];return _0x51dac0;};'use strict';var _=require(_0x832f('0x0'));var util=require(_0x832f('0x1'));var logger=require(_0x832f('0x2'))('api');var moment=require(_0x832f('0x3'));var BPromise=require(_0x832f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x832f('0x5'));var rimraf=require(_0x832f('0x6'));var config=require(_0x832f('0x7'));var attributes=require(_0x832f('0x8'));module['exports']=function(_0x19b137,_0xd496db){return _0x19b137[_0x832f('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x832f('0xa'),'paranoid':![],'indexes':[{'name':_0x832f('0xb'),'fields':['event',_0x832f('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xca66=['../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','api','moment','bluebird','path'];(function(_0x58474e,_0x2d1513){var _0x401b63=function(_0x475f83){while(--_0x475f83){_0x58474e['push'](_0x58474e['shift']());}};_0x401b63(++_0x2d1513);}(_0xca66,0x8b));var _0x6ca6=function(_0xcc1eb1,_0xe201b1){_0xcc1eb1=_0xcc1eb1-0x0;var _0x4136a6=_0xca66[_0xcc1eb1];return _0x4136a6;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ca6('0x1'));var moment=require(_0x6ca6('0x2'));var BPromise=require(_0x6ca6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ca6('0x4'));var rimraf=require('rimraf');var config=require(_0x6ca6('0x5'));var attributes=require('./voiceQueuesLog.attributes');module[_0x6ca6('0x6')]=function(_0x27d8c6,_0x34836f){return _0x27d8c6[_0x6ca6('0x7')](_0x6ca6('0x8'),attributes,{'tableName':_0x6ca6('0x9'),'paranoid':![],'indexes':[{'name':_0x6ca6('0xa'),'fields':['event',_0x6ca6('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0122cc5..d1c6bb0 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 _0xbaaa=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0xbaaa,0x9c));var _0xabaa=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xbaaa[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0xabaa('0x0'));var util=require(_0xabaa('0x1'));var moment=require('moment');var BPromise=require(_0xabaa('0x2'));var rs=require(_0xabaa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabaa('0x4'))['db'];var utils=require(_0xabaa('0x5'));var logger=require(_0xabaa('0x6'))(_0xabaa('0x7'));var config=require('../../config/environment');var jayson=require(_0xabaa('0x8'));var client=jayson[_0xabaa('0x9')][_0xabaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c9263,_0x1f418b,_0x668d6f){return new BPromise(function(_0x11ce12,_0xe70de){return client[_0xabaa('0xb')](_0x1c9263,_0x668d6f)['then'](function(_0x58a047){logger[_0xabaa('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1f418b,_0xabaa('0xd'));logger[_0xabaa('0xe')](_0xabaa('0xf'),_0x1f418b,'request\x20sent',JSON[_0xabaa('0x10')](_0x58a047));if(_0x58a047[_0xabaa('0x11')]){if(_0x58a047[_0xabaa('0x11')][_0xabaa('0x12')]===0x1f4){logger[_0xabaa('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1f418b,_0x58a047[_0xabaa('0x11')][_0xabaa('0x13')]);return _0xe70de(_0x58a047[_0xabaa('0x11')]['message']);}logger[_0xabaa('0x11')](_0xabaa('0x14'),_0x1f418b,_0x58a047[_0xabaa('0x11')][_0xabaa('0x13')]);return _0x11ce12(_0x58a047[_0xabaa('0x11')]['message']);}else{logger[_0xabaa('0xc')](_0xabaa('0x14'),_0x1f418b,_0xabaa('0xd'));_0x11ce12(_0x58a047[_0xabaa('0x15')][_0xabaa('0x13')]);}})[_0xabaa('0x16')](function(_0x2d488){logger['error'](_0xabaa('0x14'),_0x1f418b,_0x2d488);_0xe70de(_0x2d488);});});} \ No newline at end of file +var _0x6ae8=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x3fc15b,_0x1bfdce){var _0x2a0c57=function(_0x501f2a){while(--_0x501f2a){_0x3fc15b['push'](_0x3fc15b['shift']());}};_0x2a0c57(++_0x1bfdce);}(_0x6ae8,0x190));var _0x86ae=function(_0x582628,_0x45dc5d){_0x582628=_0x582628-0x0;var _0x4dfea5=_0x6ae8[_0x582628];return _0x4dfea5;};'use strict';var _=require(_0x86ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x86ae('0x1'));var rs=require(_0x86ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86ae('0x3'))['db'];var utils=require(_0x86ae('0x4'));var logger=require(_0x86ae('0x5'))(_0x86ae('0x6'));var config=require(_0x86ae('0x7'));var jayson=require(_0x86ae('0x8'));var client=jayson[_0x86ae('0x9')][_0x86ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c5579,_0x318365,_0x34a4bb){return new BPromise(function(_0x1be0a2,_0x2e1a5a){return client[_0x86ae('0xb')](_0x4c5579,_0x34a4bb)['then'](function(_0xa718b8){logger[_0x86ae('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x318365,_0x86ae('0xd'));logger[_0x86ae('0xe')](_0x86ae('0xf'),_0x318365,'request\x20sent',JSON[_0x86ae('0x10')](_0xa718b8));if(_0xa718b8[_0x86ae('0x11')]){if(_0xa718b8[_0x86ae('0x11')][_0x86ae('0x12')]===0x1f4){logger[_0x86ae('0x11')](_0x86ae('0x13'),_0x318365,_0xa718b8[_0x86ae('0x11')][_0x86ae('0x14')]);return _0x2e1a5a(_0xa718b8[_0x86ae('0x11')][_0x86ae('0x14')]);}logger[_0x86ae('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x318365,_0xa718b8['error']['message']);return _0x1be0a2(_0xa718b8['error'][_0x86ae('0x14')]);}else{logger[_0x86ae('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x318365,_0x86ae('0xd'));_0x1be0a2(_0xa718b8[_0x86ae('0x15')]['message']);}})[_0x86ae('0x16')](function(_0x57ce9e){logger['error'](_0x86ae('0x13'),_0x318365,_0x57ce9e);_0x2e1a5a(_0x57ce9e);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 99951fd..1a389fd 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 _0xe54e=['/:id/downloads','downloads','downloadTranscribe','create','runTranscribe','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x158794,_0x222553){var _0x24f9b7=function(_0x248157){while(--_0x248157){_0x158794['push'](_0x158794['shift']());}};_0x24f9b7(++_0x222553);}(_0xe54e,0x15d));var _0xee54=function(_0x334398,_0x15101c){_0x334398=_0x334398-0x0;var _0x4eef82=_0xe54e[_0x334398];return _0x4eef82;};'use strict';var multer=require(_0xee54('0x0'));var util=require(_0xee54('0x1'));var path=require(_0xee54('0x2'));var timeout=require(_0xee54('0x3'));var express=require(_0xee54('0x4'));var router=express[_0xee54('0x5')]();var fs_extra=require(_0xee54('0x6'));var auth=require(_0xee54('0x7'));var interaction=require(_0xee54('0x8'));var config=require('../../config/environment');var controller=require(_0xee54('0x9'));router[_0xee54('0xa')]('/',auth['isAuthenticated'](),controller[_0xee54('0xb')]);router[_0xee54('0xa')](_0xee54('0xc'),auth[_0xee54('0xd')](),controller[_0xee54('0xe')]);router[_0xee54('0xa')]('/:id',auth[_0xee54('0xd')](),controller['show']);router[_0xee54('0xa')]('/:id/download',auth[_0xee54('0xd')](),controller['download']);router[_0xee54('0xa')](_0xee54('0xf'),controller[_0xee54('0x10')]);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0xee54('0x11')]);router['post']('/',auth[_0xee54('0xd')](),controller[_0xee54('0x12')]);router['post']('/:id/transcribe',auth[_0xee54('0xd')](),controller[_0xee54('0x13')]);router[_0xee54('0x14')](_0xee54('0x15'),auth[_0xee54('0xd')](),controller[_0xee54('0x16')]);router[_0xee54('0x17')]('/:id',auth[_0xee54('0xd')](),controller[_0xee54('0x18')]);module[_0xee54('0x19')]=router; \ No newline at end of file +var _0x47f4=['util','path','express','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','runTranscribe','update','delete','destroy','exports','multer'];(function(_0x307b9b,_0x517387){var _0x15b860=function(_0x38b625){while(--_0x38b625){_0x307b9b['push'](_0x307b9b['shift']());}};_0x15b860(++_0x517387);}(_0x47f4,0x18f));var _0x447f=function(_0x555c90,_0x10e8b7){_0x555c90=_0x555c90-0x0;var _0x116545=_0x47f4[_0x555c90];return _0x116545;};'use strict';var multer=require(_0x447f('0x0'));var util=require(_0x447f('0x1'));var path=require(_0x447f('0x2'));var timeout=require('connect-timeout');var express=require(_0x447f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x447f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x447f('0x5'));var controller=require(_0x447f('0x6'));router[_0x447f('0x7')]('/',auth[_0x447f('0x8')](),controller[_0x447f('0x9')]);router[_0x447f('0x7')]('/describe',auth[_0x447f('0x8')](),controller[_0x447f('0xa')]);router[_0x447f('0x7')](_0x447f('0xb'),auth[_0x447f('0x8')](),controller[_0x447f('0xc')]);router[_0x447f('0x7')](_0x447f('0xd'),auth[_0x447f('0x8')](),controller[_0x447f('0xe')]);router['get'](_0x447f('0xf'),controller[_0x447f('0x10')]);router[_0x447f('0x7')]('/:id/transcribe',auth[_0x447f('0x8')](),controller[_0x447f('0x11')]);router[_0x447f('0x12')]('/',auth[_0x447f('0x8')](),controller[_0x447f('0x13')]);router[_0x447f('0x12')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x447f('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x447f('0x15')]);router[_0x447f('0x16')](_0x447f('0xb'),auth[_0x447f('0x8')](),controller[_0x447f('0x17')]);module[_0x447f('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 551787f..5d1aa24 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(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 f2d7cb1..406bd23 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 _0x956c=['Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','bucket','Sequelize','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','length','includeAll','create','body','find','describe','download','uniqueid','value','%s.cypher','decryptFile','secrets','existsSync','ValidationError','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','VoiceRecording\x20not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','recording'];(function(_0xb05d5b,_0x2d1d52){var _0x1f19ee=function(_0xd471ff){while(--_0xd471ff){_0xb05d5b['push'](_0xb05d5b['shift']());}};_0x1f19ee(++_0x2d1d52);}(_0x956c,0xbe));var _0xc956=function(_0x17f5b1,_0x2623df){_0x17f5b1=_0x17f5b1-0x0;var _0x2f1f51=_0x956c[_0x17f5b1];return _0x2f1f51;};'use strict';var emlformat=require(_0xc956('0x0'));var rimraf=require(_0xc956('0x1'));var zipdir=require(_0xc956('0x2'));var jsonpatch=require(_0xc956('0x3'));var rp=require(_0xc956('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc956('0x5'));var util=require(_0xc956('0x6'));var path=require(_0xc956('0x7'));var sox=require(_0xc956('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc956('0x9'));var _=require(_0xc956('0xa'));var squel=require(_0xc956('0xb'));var crypto=require(_0xc956('0xc'));var jsforce=require(_0xc956('0xd'));var deskjs=require(_0xc956('0xe'));var toCsv=require(_0xc956('0xf'));var querystring=require(_0xc956('0x10'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0xc956('0x11'));var Redis=require(_0xc956('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc956('0x13'));var as=require(_0xc956('0x14'));var hardwareService=require(_0xc956('0x15'));var logger=require(_0xc956('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc956('0x17'));var licenseUtil=require(_0xc956('0x18'));var db=require(_0xc956('0x19'))['db'];function respondWithStatusCode(_0x4beed8,_0x5b0aef){_0x5b0aef=_0x5b0aef||0xcc;return function(_0x336530){if(_0x336530){return _0x4beed8[_0xc956('0x1a')](_0x5b0aef);}return _0x4beed8[_0xc956('0x1b')](_0x5b0aef)[_0xc956('0x1c')]();};}function respondWithResult(_0x2039fd,_0x18a349){_0x18a349=_0x18a349||0xc8;return function(_0x2eefd3){if(_0x2eefd3){return _0x2039fd[_0xc956('0x1b')](_0x18a349)['json'](_0x2eefd3);}};}function respondWithFilteredResult(_0x230ae9,_0x55e0fc){return function(_0x3743a6){if(_0x3743a6){var _0x445252=typeof _0x55e0fc[_0xc956('0x1d')]===_0xc956('0x1e')&&typeof _0x55e0fc[_0xc956('0x1f')]==='undefined';var _0x3d64ff=_0x3743a6[_0xc956('0x20')];var _0x27228c=_0x445252?0x0:_0x55e0fc['offset'];var _0x308148=_0x445252?_0x3743a6[_0xc956('0x20')]:_0x55e0fc[_0xc956('0x1d')]+_0x55e0fc[_0xc956('0x1f')];var _0x1bf248;if(_0x308148>=_0x3d64ff){_0x308148=_0x3d64ff;_0x1bf248=0xc8;}else{_0x1bf248=0xce;}_0x230ae9[_0xc956('0x1b')](_0x1bf248);return _0x230ae9[_0xc956('0x21')](_0xc956('0x22'),_0x27228c+'-'+_0x308148+'/'+_0x3d64ff)[_0xc956('0x23')](_0x3743a6);}return null;};}function patchUpdates(_0x15973b){return function(_0x409334){try{jsonpatch[_0xc956('0x24')](_0x409334,_0x15973b,!![]);}catch(_0x2a79a0){return BPromise[_0xc956('0x25')](_0x2a79a0);}return _0x409334['save']();};}function saveUpdates(_0x3e6f1c,_0x4ab572){return function(_0x2c5776){if(_0x2c5776){return _0x2c5776[_0xc956('0x26')](_0x3e6f1c)['then'](function(_0x81e69c){return _0x81e69c;});}return null;};}function removeEntity(_0x3f647c,_0x1a8ee5){return function(_0x2cff4c){if(_0x2cff4c){return _0x2cff4c[_0xc956('0x27')]()[_0xc956('0x28')](function(){_0x3f647c[_0xc956('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573bf6,_0x386984){return function(_0x2073cc){if(!_0x2073cc){_0x573bf6['sendStatus'](0x194);}return _0x2073cc;};}function handleError(_0x28cb40,_0xecfe59){_0xecfe59=_0xecfe59||0x1f4;return function(_0x566812){logger['error'](_0x566812[_0xc956('0x29')]);if(_0x566812['name']){delete _0x566812[_0xc956('0x2a')];}_0x28cb40[_0xc956('0x1b')](_0xecfe59)[_0xc956('0x2b')](_0x566812);};}exports[_0xc956('0x2c')]=function(_0x2334f6,_0x7fa98d){var _0x33e9c5={},_0x54d638={},_0x14f10a={'count':0x0,'rows':[]};var _0x1efbef=_[_0xc956('0x2d')](db[_0xc956('0x2e')][_0xc956('0x2f')],function(_0x5bd7c5){return{'name':_0x5bd7c5[_0xc956('0x30')],'type':_0x5bd7c5[_0xc956('0x31')][_0xc956('0x32')]};});_0x54d638['model']=_[_0xc956('0x33')](_[_0xc956('0x2d')](_0x1efbef,_0xc956('0x2a')),[_0xc956('0x34')]);_0x54d638[_0xc956('0x35')]=_[_0xc956('0x36')](_0x2334f6[_0xc956('0x35')]);_0x54d638[_0xc956('0x37')]=_['intersection'](_0x54d638[_0xc956('0x38')],_0x54d638[_0xc956('0x35')]);_0x33e9c5[_0xc956('0x39')]=_[_0xc956('0x3a')](_0x54d638[_0xc956('0x38')],qs['fields'](_0x2334f6[_0xc956('0x35')][_0xc956('0x3b')]));_0x33e9c5['attributes']=_0x33e9c5[_0xc956('0x39')]['length']?_0x33e9c5['attributes']:_0x54d638[_0xc956('0x38')];if(!_0x2334f6[_0xc956('0x35')][_0xc956('0x3c')](_0xc956('0x3d'))){_0x33e9c5[_0xc956('0x1f')]=qs['limit'](_0x2334f6[_0xc956('0x35')][_0xc956('0x1f')]);_0x33e9c5[_0xc956('0x1d')]=qs[_0xc956('0x1d')](_0x2334f6[_0xc956('0x35')][_0xc956('0x1d')]);}_0x33e9c5[_0xc956('0x3e')]=qs['sort'](_0x2334f6[_0xc956('0x35')][_0xc956('0x3f')]);_0x33e9c5[_0xc956('0x40')]=qs[_0xc956('0x37')](_['pick'](_0x2334f6[_0xc956('0x35')],_0x54d638[_0xc956('0x37')]),_0x1efbef);if(_0x2334f6['query'][_0xc956('0x41')]){_0x33e9c5['where']=_['merge'](_0x33e9c5[_0xc956('0x40')],{'$or':_[_0xc956('0x2d')](_0x1efbef,function(_0x170084){if(_0x170084['type']!==_0xc956('0x42')){var _0x3ca4e3={};_0x3ca4e3[_0x170084['name']]={'$like':'%'+_0x2334f6[_0xc956('0x35')][_0xc956('0x41')]+'%'};return _0x3ca4e3;}})});}_0x33e9c5=_[_0xc956('0x43')]({},_0x33e9c5,_0x2334f6[_0xc956('0x44')]);var _0x1ba76c={'where':_0x33e9c5[_0xc956('0x40')]};return db[_0xc956('0x2e')][_0xc956('0x20')](_0x1ba76c)['then'](function(_0x57aa6b){_0x14f10a[_0xc956('0x20')]=_0x57aa6b;if(_0x2334f6['query']['includeAll']){_0x33e9c5[_0xc956('0x45')]=[{'all':!![]}];}return db[_0xc956('0x2e')][_0xc956('0x46')](_0x33e9c5);})[_0xc956('0x28')](function(_0x3f41f7){_0x14f10a[_0xc956('0x47')]=_0x3f41f7;return _0x14f10a;})[_0xc956('0x28')](respondWithFilteredResult(_0x7fa98d,_0x33e9c5))[_0xc956('0x48')](handleError(_0x7fa98d,null));};exports['show']=function(_0x102d16,_0x1c82cd){var _0x3bd379={'raw':![],'where':{'id':_0x102d16[_0xc956('0x49')]['id']}},_0x21d20a={};_0x21d20a[_0xc956('0x38')]=_[_0xc956('0x36')](db[_0xc956('0x2e')][_0xc956('0x2f')]);_0x21d20a['query']=_[_0xc956('0x36')](_0x102d16[_0xc956('0x35')]);_0x21d20a['filters']=_[_0xc956('0x3a')](_0x21d20a['model'],_0x21d20a[_0xc956('0x35')]);_0x3bd379[_0xc956('0x39')]=_[_0xc956('0x3a')](_0x21d20a['model'],qs[_0xc956('0x3b')](_0x102d16[_0xc956('0x35')][_0xc956('0x3b')]));_0x3bd379[_0xc956('0x39')]=_0x3bd379[_0xc956('0x39')][_0xc956('0x4a')]?_0x3bd379['attributes']:_0x21d20a['model'];if(_0x102d16[_0xc956('0x35')][_0xc956('0x4b')]){_0x3bd379[_0xc956('0x45')]=[{'all':!![]}];}_0x3bd379=_[_0xc956('0x43')]({},_0x3bd379,_0x102d16['options']);return db[_0xc956('0x2e')]['find'](_0x3bd379)[_0xc956('0x28')](handleEntityNotFound(_0x1c82cd,null))[_0xc956('0x28')](respondWithResult(_0x1c82cd,null))[_0xc956('0x48')](handleError(_0x1c82cd,null));};exports[_0xc956('0x4c')]=function(_0x24f3ac,_0x24ad9f){return db[_0xc956('0x2e')]['create'](_0x24f3ac['body'],{})['then'](respondWithResult(_0x24ad9f,0xc9))[_0xc956('0x48')](handleError(_0x24ad9f,null));};exports[_0xc956('0x26')]=function(_0x363412,_0x36f999){if(_0x363412[_0xc956('0x4d')]['id']){delete _0x363412['body']['id'];}return db[_0xc956('0x2e')][_0xc956('0x4e')]({'where':{'id':_0x363412[_0xc956('0x49')]['id']}})[_0xc956('0x28')](handleEntityNotFound(_0x36f999,null))[_0xc956('0x28')](saveUpdates(_0x363412[_0xc956('0x4d')],null))[_0xc956('0x28')](respondWithResult(_0x36f999,null))['catch'](handleError(_0x36f999,null));};exports[_0xc956('0x4f')]=function(_0x55f4c7,_0x18e45b){return db['VoiceRecording'][_0xc956('0x4f')]()['then'](respondWithResult(_0x18e45b,null))[_0xc956('0x48')](handleError(_0x18e45b,null));};exports[_0xc956('0x50')]=function(_0x42fff5,_0x2e3f5e,_0x4869e5){var _0xd2732e=require('../../components/encryptor');var _0x37add2=![];var _0x5dd04c={};if(_0x42fff5[_0xc956('0x35')][_0xc956('0x31')]&&_0x42fff5[_0xc956('0x35')][_0xc956('0x31')]===_0xc956('0x51')){_0x5dd04c['uniqueid']=_0x42fff5['params']['id'];}else{_0x5dd04c['id']=_0x42fff5[_0xc956('0x49')]['id'];}return db[_0xc956('0x2e')][_0xc956('0x4e')]({'where':_0x5dd04c,'attributes':['id',_0xc956('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x2e3f5e,null))[_0xc956('0x28')](function(_0x1a5d73){if(_0x1a5d73){var _0x167ce5=_0x1a5d73[_0xc956('0x52')];var _0x4247d4=util[_0xc956('0x34')](_0xc956('0x53'),_0x167ce5);if(fs['existsSync'](_0x4247d4)){_0x37add2=!![];return _0xd2732e[_0xc956('0x54')](_0x4247d4,_0x167ce5,config[_0xc956('0x55')]['recording'])[_0xc956('0x28')](function(){return _0x1a5d73;});}return _0x1a5d73;}})['then'](function(_0x5bf31b){if(_0x5bf31b){var _0x2e534d=_0x5bf31b[_0xc956('0x52')];if(!fs[_0xc956('0x56')](_0x2e534d)){throw new db['Sequelize'][(_0xc956('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x5bf31b[_0xc956('0x58')]){return _0x2e3f5e[_0xc956('0x50')](_0x2e534d,_0x5bf31b[_0xc956('0x58')]+path[_0xc956('0x59')](_0x2e534d),function(){if(_0x37add2){fs[_0xc956('0x5a')](_0x2e534d);}});}else{return _0x2e3f5e['download'](_0x2e534d,function(_0xcd3b45){if(_0x37add2){fs['unlink'](_0x2e534d);}});}}})['catch'](function(_0x2bcb34){if(_0x2bcb34[_0xc956('0x5b')]==='VoiceRecording\x20not\x20found'){_0x2e3f5e[_0xc956('0x1b')](0x194)[_0xc956('0x2b')](_0xc956('0x5c'));}else{return handleError(_0x2e3f5e,null);}});};exports[_0xc956('0x5d')]=function(_0x2aff22,_0x311bda,_0x498fbe){var _0x535292=require('../../components/encryptor');var _0x273c5f=![];var _0xb1b6a8={'$and':[db['sequelize'][_0xc956('0x40')](db[_0xc956('0x5e')]['fn'](_0xc956('0x5f'),db[_0xc956('0x5e')][_0xc956('0x60')](_0xc956('0x51'))),_0x2aff22[_0xc956('0x35')]['token'])]};if(_0x2aff22[_0xc956('0x35')][_0xc956('0x31')]&&_0x2aff22[_0xc956('0x35')][_0xc956('0x31')]==='uniqueid'){_0xb1b6a8[_0xc956('0x61')][_0xc956('0x62')]({'uniqueid':_0x2aff22[_0xc956('0x49')]['id']});}else{_0xb1b6a8['$and'][_0xc956('0x62')]({'id':_0x2aff22[_0xc956('0x49')]['id']});}return db[_0xc956('0x2e')]['find']({'where':_0xb1b6a8,'attributes':['id',_0xc956('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x311bda,null))[_0xc956('0x28')](function(_0x1dd845){if(_0x1dd845){var _0x5825fd=util['format'](_0xc956('0x53'),_0x1dd845[_0xc956('0x52')]);if(fs['existsSync'](_0x5825fd)){_0x273c5f=!![];return _0x535292[_0xc956('0x54')](_0x5825fd,_0x1dd845[_0xc956('0x52')],config[_0xc956('0x55')]['recording'])[_0xc956('0x28')](function(){return _0x1dd845;});}return _0x1dd845;}})['then'](function(_0x4c57b7){if(_0x4c57b7){if(!fs[_0xc956('0x56')](_0x4c57b7['value'])){throw new db['Sequelize'][(_0xc956('0x57'))](_0xc956('0x63'));}if(_0x4c57b7[_0xc956('0x58')]){return _0x311bda['download'](_0x4c57b7[_0xc956('0x52')],_0x4c57b7[_0xc956('0x58')]+path['extname'](_0x4c57b7['value']),function(){if(_0x273c5f){fs[_0xc956('0x5a')](_0x4c57b7[_0xc956('0x52')]);}});}else{return _0x311bda[_0xc956('0x50')](_0x4c57b7[_0xc956('0x52')],function(_0x475538){if(_0x273c5f){fs['unlink'](_0x4c57b7[_0xc956('0x52')]);}});}}})['catch'](handleError(_0x311bda,null));};exports['destroy']=function(_0x2a41e5,_0x3e3f1a){return db[_0xc956('0x2e')]['find']({'where':{'id':_0x2a41e5['params']['id']}})[_0xc956('0x28')](function(_0x3aedbc){if(_[_0xc956('0x64')](_0x3aedbc)){throw new ReferenceError(_0xc956('0x65'));}return _0x3aedbc;})['then'](function(_0x4cff65){var _0x1935a0=_0x4cff65[_0xc956('0x52')];logger[_0xc956('0x66')](_0xc956('0x67'),_0x1935a0);if(!_[_0xc956('0x64')](_0x4cff65[_0xc956('0x52')])&&fs[_0xc956('0x56')](_0x1935a0)){logger['info'](_0xc956('0x68')+_0x1935a0+_0xc956('0x69'));fs[_0xc956('0x6a')](_0x1935a0);}_0x1935a0=_0x1935a0+_0xc956('0x6b');if(!_[_0xc956('0x64')](_0x4cff65[_0xc956('0x52')])&&fs[_0xc956('0x56')](_0x1935a0)){logger['info'](_0xc956('0x68')+_0x1935a0+_0xc956('0x69'));fs[_0xc956('0x6a')](_0x1935a0);}return _0x4cff65;})['then'](function(_0x3996fd){if(!_0x3996fd)throw new InternalError();return _0x3996fd['destroy']();})[_0xc956('0x28')](function(){_0x3e3f1a[_0xc956('0x1b')](0xcc)['end']();})[_0xc956('0x48')](handleError(_0x3e3f1a,null));};function getBucketslist(_0x1ad039,_0x519d8c,_0x45dc31){return new Promise(function(_0x196d1d,_0x29d269){var _0x1ab4dc=new AWS['S3']({'accessKeyId':_0x519d8c,'secretAccessKey':_0x1ad039,'region':_0x45dc31});_0x1ab4dc[_0xc956('0x6c')]({},function(_0x44ce03,_0xa564a7){if(_0x44ce03){return _0x29d269(_0x44ce03);}else{return _0x196d1d(_0xa564a7);}});});}function createBucket(_0x78b9d3,_0xd9af1a,_0x127b23,_0x12ec55){return new Promise(function(_0xe6aa2c,_0x211911){var _0x41f0d0=new AWS['S3']({'accessKeyId':_0xd9af1a,'secretAccessKey':_0x78b9d3,'region':_0x127b23});_0x41f0d0[_0xc956('0x6d')]({'Bucket':_0x12ec55},function(_0xd2f221,_0x81596d){if(_0xd2f221){return _0x211911(_0xd2f221);}else{return _0xe6aa2c(_0x81596d);}});});}function uploadFile(_0x359461,_0x46648a,_0x5b1135,_0xf11317,_0x295b49,_0x5415d9){return new Promise(function(_0x94bbf5,_0x2afae1){var _0x73797c=new AWS['S3']({'accessKeyId':_0x46648a,'secretAccessKey':_0x359461,'region':_0x5b1135});_0x73797c[_0xc956('0x6e')]({'Bucket':_0xf11317,'Key':_0x295b49,'Body':_0x5415d9},function(_0xf113f8,_0x4a0a83){if(_0xf113f8){return _0x2afae1(_0xf113f8);}else{return _0x94bbf5(_0x4a0a83);}});});}function startTranscribe(_0x433164,_0x554f36,_0x50ae14,_0x32dc89,_0x3ceafa,_0x563bea){return new Promise(function(_0x5bd8ac,_0x11cf89){var _0x37fdf8=new AWS[(_0xc956('0x6f'))]({'accessKeyId':_0x554f36,'secretAccessKey':_0x433164,'region':_0x50ae14});_0x37fdf8[_0xc956('0x70')]({'TranscriptionJobName':_0x32dc89,'LanguageCode':_0x3ceafa,'Media':{'MediaFileUri':_0x563bea}},function(_0x5dc7df,_0x2bad3c){if(_0x5dc7df){return _0x11cf89(_0x5dc7df);}else{return _0x5bd8ac(_0x2bad3c);}});});}function transcribe(_0x5ed2e7,_0x37bb91,_0x24ecff,_0x507cf1,_0x3ed985,_0x2eae08,_0x46481f){return new Promise(function(_0x197b32,_0x15b8bf){var _0x554c22={};logger['info'](util['format'](_0xc956('0x71'),_0x5ed2e7,_0x3ed985));return uploadFile(_0x37bb91,_0x24ecff,_0x507cf1,_0x3ed985,path[_0xc956('0x72')](_0x2eae08),fs[_0xc956('0x73')](_0x2eae08))[_0xc956('0x28')](function(_0x3417a4){logger[_0xc956('0x66')](util['format'](_0xc956('0x74'),_0x5ed2e7,_0x3ed985,_0x3417a4[_0xc956('0x75')]));_0x554c22['bucket']=_0x3417a4['Bucket'];_0x554c22[_0xc956('0x76')]=_0x3417a4[_0xc956('0x75')];logger[_0xc956('0x66')](util[_0xc956('0x34')](_0xc956('0x77'),_0x5ed2e7));return startTranscribe(_0x37bb91,_0x24ecff,_0x507cf1,uuidv4(),_0x46481f,_0x3417a4['Location']);})[_0xc956('0x28')](function(_0x1acdd7){logger[_0xc956('0x66')](util[_0xc956('0x34')](_0xc956('0x78'),_0x5ed2e7,_0x1acdd7[_0xc956('0x79')][_0xc956('0x7a')]));_0x554c22[_0xc956('0x7b')]=_0x1acdd7[_0xc956('0x79')][_0xc956('0x7a')];_0x554c22[_0xc956('0x7c')]=_0x1acdd7[_0xc956('0x79')][_0xc956('0x7d')];return _0x197b32(_0x554c22);})['catch'](function(_0x4d2dc9){return _0x15b8bf(_0x4d2dc9);});});}exports[_0xc956('0x7e')]=function(_0x4ec7f6,_0x232749,_0x3c2f40){var _0x4ed9ef;var _0x53b070;var _0x245ba1;var _0x2ea4a5=require(_0xc956('0x7f'));return db['VoiceRecording'][_0xc956('0x80')]({'where':{'id':_0x4ec7f6[_0xc956('0x49')]['id']}})[_0xc956('0x28')](function(_0x1a056e){if(_0x1a056e){var _0x28ca99=util[_0xc956('0x34')]('%s.cypher',_0x1a056e[_0xc956('0x52')]);if(fs[_0xc956('0x56')](_0x28ca99)){cypher=!![];return _0x2ea4a5['decryptFile'](_0x28ca99,_0x1a056e[_0xc956('0x52')],config[_0xc956('0x55')][_0xc956('0x81')])[_0xc956('0x28')](function(){return _0x1a056e;});}return _0x1a056e;}})[_0xc956('0x28')](function(_0xeae5eb){if(!_0xeae5eb){throw new db['Sequelize']['ValidationError'](_0xc956('0x82'));}_0x53b070=_0xeae5eb;return db[_0xc956('0x83')][_0xc956('0x80')]({'where':{'id':0x1}});})[_0xc956('0x28')](handleEntityNotFound(_0x232749,null))[_0xc956('0x28')](function(_0x4a5c08){if(_0x4a5c08){_0x4ed9ef=_0x4a5c08;if(!_0x4ed9ef[_0xc956('0x84')]||!_0x4ed9ef[_0xc956('0x85')]||!_0x4ed9ef[_0xc956('0x86')]||!_0x4ed9ef['language']||!_0x4ed9ef[_0xc956('0x87')]){throw new db[(_0xc956('0x88'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x4ec7f6[_0xc956('0x4d')][_0xc956('0x89')]&&(!_0x4ed9ef[_0xc956('0x8a')]||!_0x4ed9ef[_0xc956('0x8b')]||!_0x4ed9ef[_0xc956('0x8c')]||!_0x4ed9ef[_0xc956('0x8d')]||!_0x4ed9ef[_0xc956('0x87')])){throw new db[(_0xc956('0x88'))][(_0xc956('0x57'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0xc956('0x80')]({'where':{'id':_0x4ed9ef[_0xc956('0x85')]}});}})[_0xc956('0x28')](function(_0x549b4e){if(!_0x549b4e){throw new db[(_0xc956('0x88'))][(_0xc956('0x57'))](_0xc956('0x8e'));}if(!_0x549b4e[_0xc956('0x8f')]||!_0x549b4e['data2']){throw new db['Sequelize'][(_0xc956('0x57'))]('Cloud\x20Provider\x20not\x20configured');}_0x245ba1=_0x549b4e;return getBucketslist(_0x245ba1[_0xc956('0x8f')],_0x245ba1[_0xc956('0x90')],_0x4ed9ef[_0xc956('0x86')]);})[_0xc956('0x28')](function(_0x41957f){if(_0x41957f&&_0x41957f[_0xc956('0x91')]){var _0x2373d3=_['find'](_0x41957f[_0xc956('0x91')],function(_0x341d6e){return _0x341d6e[_0xc956('0x92')]===_0x4ed9ef[_0xc956('0x87')];});if(!_0x2373d3){logger['info'](util[_0xc956('0x34')](_0xc956('0x93'),_0x4ec7f6[_0xc956('0x49')]['id'],_0x4ed9ef['bucket']));return createBucket(_0x245ba1[_0xc956('0x8f')],_0x245ba1[_0xc956('0x90')],_0x4ed9ef[_0xc956('0x86')],_0x4ed9ef['bucket']);}logger[_0xc956('0x66')](util[_0xc956('0x34')](_0xc956('0x94'),_0x4ec7f6[_0xc956('0x49')]['id'],_0x4ed9ef['bucket']));return;}})[_0xc956('0x28')](function(_0x363fad){if(_0x53b070[_0xc956('0x7c')]===_0xc956('0x95')){return transcribe(_0x4ec7f6['params']['id'],_0x245ba1[_0xc956('0x8f')],_0x245ba1[_0xc956('0x90')],_0x4ed9ef[_0xc956('0x86')],_0x4ed9ef[_0xc956('0x87')],_0x53b070[_0xc956('0x52')],_0x4ed9ef['language']);}else{logger['info'](util[_0xc956('0x34')](_0xc956('0x96'),_0x4ec7f6[_0xc956('0x49')]['id']));return{'transcribeStatus':_0xc956('0x97')};}})[_0xc956('0x28')](function(_0x250b48){if(_0x250b48){_0x250b48[_0xc956('0x98')]=_0x4ec7f6['body'][_0xc956('0x89')];return _0x53b070[_0xc956('0x99')](_0x250b48);}})[_0xc956('0x28')](respondWithResult(_0x232749,null))['catch'](handleError(_0x232749,null));};function writeFile(_0x5ae207,_0x783780){return new Promise(function(_0x5551e7,_0x226aee){fs[_0xc956('0x9a')](_0x783780,_0x5ae207,function(_0x337c58,_0x324ad8){if(_0x337c58){return _0x226aee(_0x337c58);}else{return _0x5551e7(_0x324ad8);}});});}exports[_0xc956('0x9b')]=function(_0x15d07b,_0x5b6143,_0x25d829){return db[_0xc956('0x2e')][_0xc956('0x80')]({'where':{'id':_0x15d07b[_0xc956('0x49')]['id']}})[_0xc956('0x28')](handleEntityNotFound(_0x5b6143))[_0xc956('0x28')](function(_0x4a2c21){if(_0x4a2c21&&_0x4a2c21[_0xc956('0x9c')]){var _0x1acec0=_0x4a2c21[_0xc956('0x9c')];var _0x512180=config[_0xc956('0x9d')]+_0xc956('0x9e')+_0x4a2c21['id']+'.txt';if(fs[_0xc956('0x56')](_0x512180)){return _0x512180;}return writeFile(_0x1acec0,_0x512180)[_0xc956('0x28')](function(){return _0x512180;});}else{throw new db[(_0xc956('0x88'))][(_0xc956('0x57'))](_0xc956('0x9f'));}})['then'](function(_0x3b6248){return _0x5b6143[_0xc956('0x50')](_0x3b6248);})[_0xc956('0x48')](handleError(_0x5b6143));}; \ No newline at end of file +var _0xda4a=['[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','decryptFile','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','aws-sdk','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','Content-Range','apply','save','update','destroy','then','end','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','create','body','describe','download','../../components/encryptor','uniqueid','params','find','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','token','push','$and','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','startTranscriptionJob'];(function(_0x1fe928,_0x5e908b){var _0x499b7a=function(_0xee1064){while(--_0xee1064){_0x1fe928['push'](_0x1fe928['shift']());}};_0x499b7a(++_0x5e908b);}(_0xda4a,0x169));var _0xada4=function(_0xd49c02,_0x51bbd4){_0xd49c02=_0xd49c02-0x0;var _0x2b346d=_0xda4a[_0xd49c02];return _0x2b346d;};'use strict';var emlformat=require(_0xada4('0x0'));var rimraf=require(_0xada4('0x1'));var zipdir=require(_0xada4('0x2'));var jsonpatch=require(_0xada4('0x3'));var rp=require(_0xada4('0x4'));var moment=require('moment');var BPromise=require(_0xada4('0x5'));var Mustache=require('mustache');var util=require(_0xada4('0x6'));var path=require(_0xada4('0x7'));var sox=require(_0xada4('0x8'));var csv=require(_0xada4('0x9'));var ejs=require(_0xada4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xada4('0xb'));var squel=require('squel');var crypto=require(_0xada4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xada4('0xd'));var toCsv=require(_0xada4('0x9'));var querystring=require(_0xada4('0xe'));var Papa=require(_0xada4('0xf'));var AWS=require(_0xada4('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0xada4('0x11'));var authService=require(_0xada4('0x12'));var qs=require(_0xada4('0x13'));var as=require(_0xada4('0x14'));var hardwareService=require(_0xada4('0x15'));var logger=require(_0xada4('0x16'))(_0xada4('0x17'));var utils=require(_0xada4('0x18'));var config=require(_0xada4('0x19'));var licenseUtil=require(_0xada4('0x1a'));var db=require(_0xada4('0x1b'))['db'];function respondWithStatusCode(_0x1ee7ed,_0x2e8835){_0x2e8835=_0x2e8835||0xcc;return function(_0x5cc839){if(_0x5cc839){return _0x1ee7ed[_0xada4('0x1c')](_0x2e8835);}return _0x1ee7ed['status'](_0x2e8835)['end']();};}function respondWithResult(_0x1fff04,_0x9424bd){_0x9424bd=_0x9424bd||0xc8;return function(_0x4d49bb){if(_0x4d49bb){return _0x1fff04[_0xada4('0x1d')](_0x9424bd)[_0xada4('0x1e')](_0x4d49bb);}};}function respondWithFilteredResult(_0x2978fd,_0x407327){return function(_0x2e32bd){if(_0x2e32bd){var _0x386b83=typeof _0x407327[_0xada4('0x1f')]===_0xada4('0x20')&&typeof _0x407327['limit']==='undefined';var _0x1c0613=_0x2e32bd[_0xada4('0x21')];var _0x5e682b=_0x386b83?0x0:_0x407327[_0xada4('0x1f')];var _0x538fc8=_0x386b83?_0x2e32bd[_0xada4('0x21')]:_0x407327[_0xada4('0x1f')]+_0x407327[_0xada4('0x22')];var _0x32d78f;if(_0x538fc8>=_0x1c0613){_0x538fc8=_0x1c0613;_0x32d78f=0xc8;}else{_0x32d78f=0xce;}_0x2978fd['status'](_0x32d78f);return _0x2978fd[_0xada4('0x23')](_0xada4('0x24'),_0x5e682b+'-'+_0x538fc8+'/'+_0x1c0613)[_0xada4('0x1e')](_0x2e32bd);}return null;};}function patchUpdates(_0xd840e0){return function(_0x2501c7){try{jsonpatch[_0xada4('0x25')](_0x2501c7,_0xd840e0,!![]);}catch(_0x318dce){return BPromise['reject'](_0x318dce);}return _0x2501c7[_0xada4('0x26')]();};}function saveUpdates(_0x287b90,_0x21d667){return function(_0x5a020d){if(_0x5a020d){return _0x5a020d[_0xada4('0x27')](_0x287b90)['then'](function(_0x4425e6){return _0x4425e6;});}return null;};}function removeEntity(_0x52c654,_0x3c8514){return function(_0x41a43c){if(_0x41a43c){return _0x41a43c[_0xada4('0x28')]()[_0xada4('0x29')](function(){_0x52c654[_0xada4('0x1d')](0xcc)[_0xada4('0x2a')]();});}};}function handleEntityNotFound(_0x361c6e,_0x364f33){return function(_0x1cf9a0){if(!_0x1cf9a0){_0x361c6e[_0xada4('0x1c')](0x194);}return _0x1cf9a0;};}function handleError(_0xd2436c,_0x17b169){_0x17b169=_0x17b169||0x1f4;return function(_0x2fff1f){logger['error'](_0x2fff1f[_0xada4('0x2b')]);if(_0x2fff1f['name']){delete _0x2fff1f[_0xada4('0x2c')];}_0xd2436c[_0xada4('0x1d')](_0x17b169)[_0xada4('0x2d')](_0x2fff1f);};}exports[_0xada4('0x2e')]=function(_0x246bb7,_0x1b0bb6){var _0xc17c9f={},_0x4a6423={},_0x5829bb={'count':0x0,'rows':[]};var _0xfcf5bf=_[_0xada4('0x2f')](db[_0xada4('0x30')][_0xada4('0x31')],function(_0x33918d){return{'name':_0x33918d[_0xada4('0x32')],'type':_0x33918d['type'][_0xada4('0x33')]};});_0x4a6423[_0xada4('0x34')]=_[_0xada4('0x35')](_[_0xada4('0x2f')](_0xfcf5bf,'name'),[_0xada4('0x36')]);_0x4a6423['query']=_[_0xada4('0x37')](_0x246bb7[_0xada4('0x38')]);_0x4a6423['filters']=_[_0xada4('0x39')](_0x4a6423[_0xada4('0x34')],_0x4a6423[_0xada4('0x38')]);_0xc17c9f[_0xada4('0x3a')]=_[_0xada4('0x39')](_0x4a6423[_0xada4('0x34')],qs[_0xada4('0x3b')](_0x246bb7['query'][_0xada4('0x3b')]));_0xc17c9f[_0xada4('0x3a')]=_0xc17c9f['attributes'][_0xada4('0x3c')]?_0xc17c9f[_0xada4('0x3a')]:_0x4a6423[_0xada4('0x34')];if(!_0x246bb7['query'][_0xada4('0x3d')]('nolimit')){_0xc17c9f[_0xada4('0x22')]=qs[_0xada4('0x22')](_0x246bb7[_0xada4('0x38')][_0xada4('0x22')]);_0xc17c9f[_0xada4('0x1f')]=qs[_0xada4('0x1f')](_0x246bb7[_0xada4('0x38')][_0xada4('0x1f')]);}_0xc17c9f[_0xada4('0x3e')]=qs[_0xada4('0x3f')](_0x246bb7[_0xada4('0x38')][_0xada4('0x3f')]);_0xc17c9f[_0xada4('0x40')]=qs[_0xada4('0x41')](_[_0xada4('0x42')](_0x246bb7['query'],_0x4a6423[_0xada4('0x41')]),_0xfcf5bf);if(_0x246bb7[_0xada4('0x38')][_0xada4('0x43')]){_0xc17c9f[_0xada4('0x40')]=_['merge'](_0xc17c9f[_0xada4('0x40')],{'$or':_[_0xada4('0x2f')](_0xfcf5bf,function(_0x512286){if(_0x512286[_0xada4('0x44')]!==_0xada4('0x45')){var _0x5519a2={};_0x5519a2[_0x512286[_0xada4('0x2c')]]={'$like':'%'+_0x246bb7['query'][_0xada4('0x43')]+'%'};return _0x5519a2;}})});}_0xc17c9f=_[_0xada4('0x46')]({},_0xc17c9f,_0x246bb7[_0xada4('0x47')]);var _0xf389c5={'where':_0xc17c9f['where']};return db['VoiceRecording']['count'](_0xf389c5)[_0xada4('0x29')](function(_0x5e19d9){_0x5829bb[_0xada4('0x21')]=_0x5e19d9;if(_0x246bb7['query'][_0xada4('0x48')]){_0xc17c9f[_0xada4('0x49')]=[{'all':!![]}];}return db[_0xada4('0x30')]['findAll'](_0xc17c9f);})[_0xada4('0x29')](function(_0x1c5448){_0x5829bb[_0xada4('0x4a')]=_0x1c5448;return _0x5829bb;})[_0xada4('0x29')](respondWithFilteredResult(_0x1b0bb6,_0xc17c9f))[_0xada4('0x4b')](handleError(_0x1b0bb6,null));};exports[_0xada4('0x4c')]=function(_0xf2645f,_0x43a87b){var _0x40da3b={'raw':![],'where':{'id':_0xf2645f['params']['id']}},_0x3fca78={};_0x3fca78[_0xada4('0x34')]=_['keys'](db[_0xada4('0x30')][_0xada4('0x31')]);_0x3fca78['query']=_[_0xada4('0x37')](_0xf2645f[_0xada4('0x38')]);_0x3fca78['filters']=_[_0xada4('0x39')](_0x3fca78[_0xada4('0x34')],_0x3fca78['query']);_0x40da3b['attributes']=_[_0xada4('0x39')](_0x3fca78[_0xada4('0x34')],qs[_0xada4('0x3b')](_0xf2645f[_0xada4('0x38')][_0xada4('0x3b')]));_0x40da3b[_0xada4('0x3a')]=_0x40da3b['attributes'][_0xada4('0x3c')]?_0x40da3b[_0xada4('0x3a')]:_0x3fca78[_0xada4('0x34')];if(_0xf2645f[_0xada4('0x38')][_0xada4('0x48')]){_0x40da3b[_0xada4('0x49')]=[{'all':!![]}];}_0x40da3b=_[_0xada4('0x46')]({},_0x40da3b,_0xf2645f[_0xada4('0x47')]);return db[_0xada4('0x30')]['find'](_0x40da3b)[_0xada4('0x29')](handleEntityNotFound(_0x43a87b,null))['then'](respondWithResult(_0x43a87b,null))['catch'](handleError(_0x43a87b,null));};exports[_0xada4('0x4d')]=function(_0x326487,_0x5441c9){return db['VoiceRecording'][_0xada4('0x4d')](_0x326487['body'],{})['then'](respondWithResult(_0x5441c9,0xc9))[_0xada4('0x4b')](handleError(_0x5441c9,null));};exports['update']=function(_0x2ddd8d,_0x4a0a0d){if(_0x2ddd8d[_0xada4('0x4e')]['id']){delete _0x2ddd8d[_0xada4('0x4e')]['id'];}return db[_0xada4('0x30')]['find']({'where':{'id':_0x2ddd8d['params']['id']}})[_0xada4('0x29')](handleEntityNotFound(_0x4a0a0d,null))[_0xada4('0x29')](saveUpdates(_0x2ddd8d[_0xada4('0x4e')],null))['then'](respondWithResult(_0x4a0a0d,null))[_0xada4('0x4b')](handleError(_0x4a0a0d,null));};exports['describe']=function(_0x212026,_0x1f900f){return db[_0xada4('0x30')][_0xada4('0x4f')]()['then'](respondWithResult(_0x1f900f,null))[_0xada4('0x4b')](handleError(_0x1f900f,null));};exports[_0xada4('0x50')]=function(_0x9c9cbb,_0x314301,_0x58359b){var _0x186108=require(_0xada4('0x51'));var _0x10fba9=![];var _0x114745={};if(_0x9c9cbb[_0xada4('0x38')][_0xada4('0x44')]&&_0x9c9cbb[_0xada4('0x38')][_0xada4('0x44')]===_0xada4('0x52')){_0x114745[_0xada4('0x52')]=_0x9c9cbb[_0xada4('0x53')]['id'];}else{_0x114745['id']=_0x9c9cbb['params']['id'];}return db[_0xada4('0x30')][_0xada4('0x54')]({'where':_0x114745,'attributes':['id',_0xada4('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x314301,null))[_0xada4('0x29')](function(_0x2c2f38){if(_0x2c2f38){var _0x1c14a9=_0x2c2f38['value'];var _0x12ab57=util[_0xada4('0x36')](_0xada4('0x56'),_0x1c14a9);if(fs[_0xada4('0x57')](_0x12ab57)){_0x10fba9=!![];return _0x186108['decryptFile'](_0x12ab57,_0x1c14a9,config[_0xada4('0x58')][_0xada4('0x59')])[_0xada4('0x29')](function(){return _0x2c2f38;});}return _0x2c2f38;}})[_0xada4('0x29')](function(_0x56329f){if(_0x56329f){var _0x3aefbc=_0x56329f[_0xada4('0x55')];if(!fs[_0xada4('0x57')](_0x3aefbc)){throw new db[(_0xada4('0x5a'))][(_0xada4('0x5b'))](_0xada4('0x5c'));}if(_0x56329f[_0xada4('0x5d')]){return _0x314301['download'](_0x3aefbc,_0x56329f[_0xada4('0x5d')]+path[_0xada4('0x5e')](_0x3aefbc),function(){if(_0x10fba9){fs[_0xada4('0x5f')](_0x3aefbc);}});}else{return _0x314301[_0xada4('0x50')](_0x3aefbc,function(_0x512ed5){if(_0x10fba9){fs[_0xada4('0x5f')](_0x3aefbc);}});}}})[_0xada4('0x4b')](function(_0x7ef85d){if(_0x7ef85d[_0xada4('0x60')]===_0xada4('0x5c')){_0x314301[_0xada4('0x1d')](0x194)[_0xada4('0x2d')](_0xada4('0x61'));}else{return handleError(_0x314301,null);}});};exports[_0xada4('0x62')]=function(_0x14671a,_0xa26657,_0x4a809f){var _0x29c79f=require(_0xada4('0x51'));var _0x6fb06d=![];var _0x58d847={'$and':[db[_0xada4('0x63')][_0xada4('0x40')](db[_0xada4('0x63')]['fn'](_0xada4('0x64'),db['sequelize']['col'](_0xada4('0x52'))),_0x14671a[_0xada4('0x38')][_0xada4('0x65')])]};if(_0x14671a[_0xada4('0x38')]['type']&&_0x14671a['query'][_0xada4('0x44')]==='uniqueid'){_0x58d847['$and'][_0xada4('0x66')]({'uniqueid':_0x14671a[_0xada4('0x53')]['id']});}else{_0x58d847[_0xada4('0x67')]['push']({'id':_0x14671a[_0xada4('0x53')]['id']});}return db[_0xada4('0x30')][_0xada4('0x54')]({'where':_0x58d847,'attributes':['id',_0xada4('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0xa26657,null))[_0xada4('0x29')](function(_0x246b73){if(_0x246b73){var _0x3e5d35=util['format'](_0xada4('0x56'),_0x246b73[_0xada4('0x55')]);if(fs[_0xada4('0x57')](_0x3e5d35)){_0x6fb06d=!![];return _0x29c79f['decryptFile'](_0x3e5d35,_0x246b73[_0xada4('0x55')],config[_0xada4('0x58')][_0xada4('0x59')])['then'](function(){return _0x246b73;});}return _0x246b73;}})[_0xada4('0x29')](function(_0x4315c7){if(_0x4315c7){if(!fs[_0xada4('0x57')](_0x4315c7[_0xada4('0x55')])){throw new db[(_0xada4('0x5a'))]['ValidationError'](_0xada4('0x5c'));}if(_0x4315c7['filename']){return _0xa26657['download'](_0x4315c7[_0xada4('0x55')],_0x4315c7[_0xada4('0x5d')]+path[_0xada4('0x5e')](_0x4315c7[_0xada4('0x55')]),function(){if(_0x6fb06d){fs[_0xada4('0x5f')](_0x4315c7[_0xada4('0x55')]);}});}else{return _0xa26657[_0xada4('0x50')](_0x4315c7[_0xada4('0x55')],function(_0x87e262){if(_0x6fb06d){fs[_0xada4('0x5f')](_0x4315c7[_0xada4('0x55')]);}});}}})[_0xada4('0x4b')](handleError(_0xa26657,null));};exports[_0xada4('0x28')]=function(_0x2bc88a,_0x172751){return db['VoiceRecording']['find']({'where':{'id':_0x2bc88a[_0xada4('0x53')]['id']}})[_0xada4('0x29')](function(_0x2aea02){if(_[_0xada4('0x68')](_0x2aea02)){throw new ReferenceError(_0xada4('0x69'));}return _0x2aea02;})[_0xada4('0x29')](function(_0x23143a){var _0x508810=_0x23143a[_0xada4('0x55')];logger['info'](_0xada4('0x6a'),_0x508810);if(!_[_0xada4('0x68')](_0x23143a['value'])&&fs[_0xada4('0x57')](_0x508810)){logger[_0xada4('0x6b')]('File:\x20\x22'+_0x508810+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xada4('0x6c')](_0x508810);}_0x508810=_0x508810+_0xada4('0x6d');if(!_['isNil'](_0x23143a[_0xada4('0x55')])&&fs[_0xada4('0x57')](_0x508810)){logger[_0xada4('0x6b')](_0xada4('0x6e')+_0x508810+_0xada4('0x6f'));fs[_0xada4('0x6c')](_0x508810);}return _0x23143a;})[_0xada4('0x29')](function(_0x1fc46d){if(!_0x1fc46d)throw new InternalError();return _0x1fc46d[_0xada4('0x28')]();})[_0xada4('0x29')](function(){_0x172751[_0xada4('0x1d')](0xcc)[_0xada4('0x2a')]();})[_0xada4('0x4b')](handleError(_0x172751,null));};function getBucketslist(_0x49363b,_0x1098ba,_0x50b67e){return new Promise(function(_0x471957,_0x1511c3){var _0x25c4b3=new AWS['S3']({'accessKeyId':_0x1098ba,'secretAccessKey':_0x49363b,'region':_0x50b67e});_0x25c4b3[_0xada4('0x70')]({},function(_0x5e9c8d,_0xbbdcb1){if(_0x5e9c8d){return _0x1511c3(_0x5e9c8d);}else{return _0x471957(_0xbbdcb1);}});});}function createBucket(_0x1f8e87,_0x39f1bc,_0x4b907b,_0x5ef92c){return new Promise(function(_0x20d7a2,_0x3e412c){var _0x1c033e=new AWS['S3']({'accessKeyId':_0x39f1bc,'secretAccessKey':_0x1f8e87,'region':_0x4b907b});_0x1c033e[_0xada4('0x71')]({'Bucket':_0x5ef92c},function(_0x49dc84,_0x1d9f20){if(_0x49dc84){return _0x3e412c(_0x49dc84);}else{return _0x20d7a2(_0x1d9f20);}});});}function uploadFile(_0x558cd4,_0x1a40cd,_0x2bd059,_0x23a9cd,_0x340f68,_0x15a72a){return new Promise(function(_0x54b7a8,_0xe049cb){var _0x2fea87=new AWS['S3']({'accessKeyId':_0x1a40cd,'secretAccessKey':_0x558cd4,'region':_0x2bd059});_0x2fea87[_0xada4('0x72')]({'Bucket':_0x23a9cd,'Key':_0x340f68,'Body':_0x15a72a},function(_0x26fc02,_0xc79880){if(_0x26fc02){return _0xe049cb(_0x26fc02);}else{return _0x54b7a8(_0xc79880);}});});}function startTranscribe(_0x453328,_0x4d3f9a,_0x2b6039,_0x4809f0,_0x50c2ee,_0x47269e){return new Promise(function(_0x3b1cea,_0x4c2be5){var _0x24b504=new AWS['TranscribeService']({'accessKeyId':_0x4d3f9a,'secretAccessKey':_0x453328,'region':_0x2b6039});_0x24b504[_0xada4('0x73')]({'TranscriptionJobName':_0x4809f0,'LanguageCode':_0x50c2ee,'Media':{'MediaFileUri':_0x47269e}},function(_0x582f8d,_0x3d7731){if(_0x582f8d){return _0x4c2be5(_0x582f8d);}else{return _0x3b1cea(_0x3d7731);}});});}function transcribe(_0x4c4034,_0x24b962,_0x150994,_0x3df0a0,_0x3e5128,_0x4305ac,_0x4682d4){return new Promise(function(_0x5e27ec,_0x10c652){var _0x1dca6f={};logger[_0xada4('0x6b')](util[_0xada4('0x36')](_0xada4('0x74'),_0x4c4034,_0x3e5128));return uploadFile(_0x24b962,_0x150994,_0x3df0a0,_0x3e5128,path[_0xada4('0x75')](_0x4305ac),fs['readFileSync'](_0x4305ac))[_0xada4('0x29')](function(_0x5da4a3){logger['info'](util['format'](_0xada4('0x76'),_0x4c4034,_0x3e5128,_0x5da4a3[_0xada4('0x77')]));_0x1dca6f[_0xada4('0x78')]=_0x5da4a3[_0xada4('0x79')];_0x1dca6f[_0xada4('0x7a')]=_0x5da4a3[_0xada4('0x77')];logger['info'](util['format'](_0xada4('0x7b'),_0x4c4034));return startTranscribe(_0x24b962,_0x150994,_0x3df0a0,uuidv4(),_0x4682d4,_0x5da4a3[_0xada4('0x77')]);})[_0xada4('0x29')](function(_0x40d4be){logger[_0xada4('0x6b')](util['format'](_0xada4('0x7c'),_0x4c4034,_0x40d4be[_0xada4('0x7d')][_0xada4('0x7e')]));_0x1dca6f[_0xada4('0x7f')]=_0x40d4be[_0xada4('0x7d')][_0xada4('0x7e')];_0x1dca6f[_0xada4('0x80')]=_0x40d4be[_0xada4('0x7d')][_0xada4('0x81')];return _0x5e27ec(_0x1dca6f);})[_0xada4('0x4b')](function(_0x3dbf86){return _0x10c652(_0x3dbf86);});});}exports[_0xada4('0x82')]=function(_0x2a0425,_0x41af15,_0xfa1399){var _0x7fac2c;var _0x53bb35;var _0x24c4e4;var _0x283787=require(_0xada4('0x51'));return db[_0xada4('0x30')]['findOne']({'where':{'id':_0x2a0425['params']['id']}})['then'](function(_0x3d1437){if(_0x3d1437){var _0x13e02a=util[_0xada4('0x36')](_0xada4('0x56'),_0x3d1437['value']);if(fs[_0xada4('0x57')](_0x13e02a)){cypher=!![];return _0x283787[_0xada4('0x83')](_0x13e02a,_0x3d1437[_0xada4('0x55')],config[_0xada4('0x58')][_0xada4('0x59')])[_0xada4('0x29')](function(){return _0x3d1437;});}return _0x3d1437;}})[_0xada4('0x29')](function(_0x72c58d){if(!_0x72c58d){throw new db[(_0xada4('0x5a'))][(_0xada4('0x5b'))](_0xada4('0x84'));}_0x53bb35=_0x72c58d;return db[_0xada4('0x85')][_0xada4('0x86')]({'where':{'id':0x1}});})[_0xada4('0x29')](handleEntityNotFound(_0x41af15,null))[_0xada4('0x29')](function(_0x46b5d0){if(_0x46b5d0){_0x7fac2c=_0x46b5d0;if(!_0x7fac2c['transcribe']||!_0x7fac2c[_0xada4('0x87')]||!_0x7fac2c[_0xada4('0x88')]||!_0x7fac2c[_0xada4('0x89')]||!_0x7fac2c[_0xada4('0x78')]){throw new db[(_0xada4('0x5a'))][(_0xada4('0x5b'))](_0xada4('0x8a'));}if(_0x2a0425[_0xada4('0x4e')][_0xada4('0x8b')]&&(!_0x7fac2c['sentiment']||!_0x7fac2c['sentimentAccountId']||!_0x7fac2c[_0xada4('0x8c')]||!_0x7fac2c['language']||!_0x7fac2c[_0xada4('0x78')])){throw new db['Sequelize'][(_0xada4('0x5b'))](_0xada4('0x8d'));}return db[_0xada4('0x8e')][_0xada4('0x86')]({'where':{'id':_0x7fac2c[_0xada4('0x87')]}});}})[_0xada4('0x29')](function(_0x2d6859){if(!_0x2d6859){throw new db['Sequelize'][(_0xada4('0x5b'))](_0xada4('0x8f'));}if(!_0x2d6859[_0xada4('0x90')]||!_0x2d6859[_0xada4('0x91')]){throw new db[(_0xada4('0x5a'))][(_0xada4('0x5b'))](_0xada4('0x92'));}_0x24c4e4=_0x2d6859;return getBucketslist(_0x24c4e4[_0xada4('0x90')],_0x24c4e4['data2'],_0x7fac2c[_0xada4('0x88')]);})['then'](function(_0x3ad1ef){if(_0x3ad1ef&&_0x3ad1ef[_0xada4('0x93')]){var _0x2f144f=_[_0xada4('0x54')](_0x3ad1ef[_0xada4('0x93')],function(_0x416dd7){return _0x416dd7[_0xada4('0x94')]===_0x7fac2c['bucket'];});if(!_0x2f144f){logger[_0xada4('0x6b')](util['format'](_0xada4('0x95'),_0x2a0425[_0xada4('0x53')]['id'],_0x7fac2c[_0xada4('0x78')]));return createBucket(_0x24c4e4[_0xada4('0x90')],_0x24c4e4[_0xada4('0x91')],_0x7fac2c[_0xada4('0x88')],_0x7fac2c[_0xada4('0x78')]);}logger[_0xada4('0x6b')](util[_0xada4('0x36')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2a0425[_0xada4('0x53')]['id'],_0x7fac2c[_0xada4('0x78')]));return;}})[_0xada4('0x29')](function(_0x30c84f){if(_0x53bb35[_0xada4('0x80')]===_0xada4('0x96')){return transcribe(_0x2a0425[_0xada4('0x53')]['id'],_0x24c4e4['data1'],_0x24c4e4[_0xada4('0x91')],_0x7fac2c[_0xada4('0x88')],_0x7fac2c[_0xada4('0x78')],_0x53bb35[_0xada4('0x55')],_0x7fac2c[_0xada4('0x89')]);}else{logger[_0xada4('0x6b')](util[_0xada4('0x36')](_0xada4('0x97'),_0x2a0425[_0xada4('0x53')]['id']));return{'transcribeStatus':_0xada4('0x98')};}})[_0xada4('0x29')](function(_0x13bba6){if(_0x13bba6){_0x13bba6[_0xada4('0x99')]=_0x2a0425[_0xada4('0x4e')][_0xada4('0x8b')];return _0x53bb35[_0xada4('0x9a')](_0x13bba6);}})[_0xada4('0x29')](respondWithResult(_0x41af15,null))[_0xada4('0x4b')](handleError(_0x41af15,null));};function writeFile(_0x326222,_0x1472eb){return new Promise(function(_0x209d98,_0x48b78f){fs['writeFile'](_0x1472eb,_0x326222,function(_0x32bd7a,_0x1ab061){if(_0x32bd7a){return _0x48b78f(_0x32bd7a);}else{return _0x209d98(_0x1ab061);}});});}exports['downloadTranscribe']=function(_0x25ebbb,_0x40c674,_0x4786ca){return db[_0xada4('0x30')][_0xada4('0x86')]({'where':{'id':_0x25ebbb[_0xada4('0x53')]['id']}})[_0xada4('0x29')](handleEntityNotFound(_0x40c674))[_0xada4('0x29')](function(_0x13b7a3){if(_0x13b7a3&&_0x13b7a3[_0xada4('0x9b')]){var _0x28ba10=_0x13b7a3[_0xada4('0x9b')];var _0x115b30=config[_0xada4('0x9c')]+'/server/files/transcribes/transcribe_'+_0x13b7a3['id']+_0xada4('0x9d');if(fs[_0xada4('0x57')](_0x115b30)){return _0x115b30;}return writeFile(_0x28ba10,_0x115b30)[_0xada4('0x29')](function(){return _0x115b30;});}else{throw new db[(_0xada4('0x5a'))]['ValidationError'](_0xada4('0x9e'));}})[_0xada4('0x29')](function(_0x2034d8){return _0x40c674['download'](_0x2034d8);})[_0xada4('0x4b')](handleError(_0x40c674));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 7ceff09..d0ca249 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 _0x402f=['transcribeStatus','./voiceRecording.attributes','VoiceRecording','voice_recordings','uniqueid'];(function(_0x48feee,_0xb71f92){var _0x2eb958=function(_0x6b5a1c){while(--_0x6b5a1c){_0x48feee['push'](_0x48feee['shift']());}};_0x2eb958(++_0xb71f92);}(_0x402f,0x6f));var _0xf402=function(_0x539b09,_0x410df9){_0x539b09=_0x539b09-0x0;var _0xf215c6=_0x402f[_0x539b09];return _0xf215c6;};'use strict';var attributes=require(_0xf402('0x0'));module['exports']=function(_0x15798b,_0x567587){return _0x15798b['define'](_0xf402('0x1'),attributes,{'tableName':_0xf402('0x2'),'paranoid':![],'indexes':[{'name':_0xf402('0x3'),'fields':['uniqueid']},{'name':_0xf402('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c2b=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings'];(function(_0x44f0b8,_0x40bcdc){var _0x6d5d5e=function(_0x13ea82){while(--_0x13ea82){_0x44f0b8['push'](_0x44f0b8['shift']());}};_0x6d5d5e(++_0x40bcdc);}(_0x0c2b,0x134));var _0xb0c2=function(_0x55cd8c,_0x302b88){_0x55cd8c=_0x55cd8c-0x0;var _0x1ba719=_0x0c2b[_0x55cd8c];return _0x1ba719;};'use strict';var attributes=require(_0xb0c2('0x0'));module[_0xb0c2('0x1')]=function(_0x4fbd93,_0x5e4432){return _0x4fbd93[_0xb0c2('0x2')]('VoiceRecording',attributes,{'tableName':_0xb0c2('0x3'),'paranoid':![],'indexes':[{'name':_0xb0c2('0x4'),'fields':[_0xb0c2('0x4')]},{'name':_0xb0c2('0x5'),'fields':[_0xb0c2('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 2487d36..75069dd 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 _0xba34=['body','options','attributes','limit','CreateVoiceRecording','Setting','findOne','create','callRecordingEncryption','existsSync','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update'];(function(_0xe248ff,_0x2f658b){var _0xc45e09=function(_0x211029){while(--_0x211029){_0xe248ff['push'](_0xe248ff['shift']());}};_0xc45e09(++_0x2f658b);}(_0xba34,0x119));var _0x4ba3=function(_0x48cdbd,_0x3457d5){_0x48cdbd=_0x48cdbd-0x0;var _0x5293bd=_0xba34[_0x48cdbd];return _0x5293bd;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});}exports[_0x4ba3('0x18')]=function(_0x5ff7ce){var _0x451c92=this;return new Promise(function(_0x556290,_0x2519bb){return db[_0x4ba3('0x19')][_0x4ba3('0x1a')](_0x5ff7ce[_0x4ba3('0x1b')],{'raw':_0x5ff7ce[_0x4ba3('0x1c')]?_0x5ff7ce[_0x4ba3('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ff7ce['options']?_0x5ff7ce[_0x4ba3('0x1c')]['where']||null:null,'attributes':_0x5ff7ce[_0x4ba3('0x1c')]?_0x5ff7ce[_0x4ba3('0x1c')][_0x4ba3('0x1d')]||null:null,'limit':_0x5ff7ce[_0x4ba3('0x1c')]?_0x5ff7ce[_0x4ba3('0x1c')][_0x4ba3('0x1e')]||null:null})['then'](function(_0x143c78){logger[_0x4ba3('0xd')]('UpdateVoiceRecording',_0x5ff7ce);logger[_0x4ba3('0x10')]('UpdateVoiceRecording',_0x5ff7ce,JSON[_0x4ba3('0x12')](_0x143c78));_0x556290(_0x143c78);})[_0x4ba3('0x17')](function(_0x11a917){logger[_0x4ba3('0x13')](_0x4ba3('0x18'),_0x11a917[_0x4ba3('0x15')],_0x5ff7ce);_0x2519bb(_0x451c92[_0x4ba3('0x13')](0x1f4,_0x11a917[_0x4ba3('0x15')]));});});};exports[_0x4ba3('0x1f')]=function(_0x2e67a0){var _0x50c729=this;return new Promise(function(_0x252f37,_0x13c353){var _0x2311ed=require('../../components/encryptor');var _0x10537e;return db[_0x4ba3('0x20')][_0x4ba3('0x21')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x4ba3('0xc')](function(_0x843276){_0x10537e=_0x843276;return db[_0x4ba3('0x19')][_0x4ba3('0x22')](_0x2e67a0['body']);})['then'](function(_0x38ef88){if(_0x10537e[_0x4ba3('0x23')]&&fs[_0x4ba3('0x24')](_0x38ef88[_0x4ba3('0x25')])){var _0x2cb5d5=util[_0x4ba3('0x26')]('%s.cypher',_0x38ef88[_0x4ba3('0x25')]);return _0x2311ed[_0x4ba3('0x27')](_0x38ef88[_0x4ba3('0x25')],_0x2cb5d5,config[_0x4ba3('0x28')][_0x4ba3('0x29')])[_0x4ba3('0xc')](function(){fs[_0x4ba3('0x2a')](_0x38ef88[_0x4ba3('0x25')]);logger[_0x4ba3('0xd')](_0x4ba3('0x2b'));return _0x38ef88;});}return _0x38ef88;})['then'](function(_0x5a453f){logger['info'](_0x4ba3('0x1f'),_0x2e67a0);logger[_0x4ba3('0x10')](_0x4ba3('0x1f'),_0x2e67a0,JSON[_0x4ba3('0x12')](_0x5a453f));_0x252f37(_0x5a453f);})[_0x4ba3('0x17')](function(_0x137f9b){logger[_0x4ba3('0x13')](_0x4ba3('0x1f'),_0x137f9b[_0x4ba3('0x15')],_0x2e67a0);_0x13c353(_0x50c729[_0x4ba3('0x13')](0x1f4,_0x137f9b[_0x4ba3('0x15')]));});});}; \ No newline at end of file +var _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x213ed5,_0x26712a){var _0x191514=function(_0x2d9305){while(--_0x2d9305){_0x213ed5['push'](_0x213ed5['shift']());}};_0x191514(++_0x26712a);}(_0xd943,0x15d));var _0x3d94=function(_0x55cbcf,_0xfd9502){_0x55cbcf=_0x55cbcf-0x0;var _0x5f31d9=_0xd943[_0x55cbcf];return _0x5f31d9;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index cae577c..99edb71 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 _0x65e9=['get','isAuthenticated','index','post','create','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65e9,0x1a7));var _0x965e=function(_0x547b7d,_0x49e4af){_0x547b7d=_0x547b7d-0x0;var _0x49d65c=_0x65e9[_0x547b7d];return _0x49d65c;};'use strict';var multer=require(_0x965e('0x0'));var util=require(_0x965e('0x1'));var path=require(_0x965e('0x2'));var timeout=require(_0x965e('0x3'));var express=require(_0x965e('0x4'));var router=express['Router']();var fs_extra=require(_0x965e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x965e('0x6'));var config=require(_0x965e('0x7'));var controller=require(_0x965e('0x8'));router[_0x965e('0x9')]('/',auth[_0x965e('0xa')](),controller[_0x965e('0xb')]);router[_0x965e('0x9')]('/describe',auth[_0x965e('0xa')](),controller['describe']);router[_0x965e('0x9')]('/:id',auth[_0x965e('0xa')](),controller['show']);router[_0x965e('0xc')]('/',auth[_0x965e('0xa')](),controller[_0x965e('0xd')]);router['put']('/:id',auth[_0x965e('0xa')](),controller[_0x965e('0xe')]);router[_0x965e('0xf')](_0x965e('0x10'),auth[_0x965e('0xa')](),controller[_0x965e('0x11')]);module['exports']=router; \ No newline at end of file +var _0xad81=['show','post','/:id','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xad81,0x183));var _0x1ad8=function(_0x270eac,_0x5d3d11){_0x270eac=_0x270eac-0x0;var _0x54f346=_0xad81[_0x270eac];return _0x54f346;};'use strict';var multer=require(_0x1ad8('0x0'));var util=require('util');var path=require(_0x1ad8('0x1'));var timeout=require(_0x1ad8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1ad8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1ad8('0x4'));var config=require(_0x1ad8('0x5'));var controller=require(_0x1ad8('0x6'));router['get']('/',auth[_0x1ad8('0x7')](),controller[_0x1ad8('0x8')]);router[_0x1ad8('0x9')](_0x1ad8('0xa'),auth[_0x1ad8('0x7')](),controller[_0x1ad8('0xb')]);router[_0x1ad8('0x9')]('/:id',auth[_0x1ad8('0x7')](),controller[_0x1ad8('0xc')]);router[_0x1ad8('0xd')]('/',auth[_0x1ad8('0x7')](),controller['create']);router['put'](_0x1ad8('0xe'),auth[_0x1ad8('0x7')](),controller[_0x1ad8('0xf')]);router[_0x1ad8('0x10')](_0x1ad8('0xe'),auth['isAuthenticated'](),controller[_0x1ad8('0x11')]);module[_0x1ad8('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 21cc477..2f88b0c 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 _0xa042=['STRING','Yes','sequelize','exports','ENUM','blind','attended'];(function(_0x401a37,_0xbcc39c){var _0x4d69f3=function(_0x226db0){while(--_0x226db0){_0x401a37['push'](_0x401a37['shift']());}};_0x4d69f3(++_0xbcc39c);}(_0xa042,0x1c9));var _0x2a04=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0xa042[_0x3a2118];return _0x1d181d;};'use strict';var Sequelize=require(_0x2a04('0x0'));var moment=require('moment');module[_0x2a04('0x1')]={'type':{'type':Sequelize[_0x2a04('0x2')](_0x2a04('0x3'),_0x2a04('0x4'))},'result':{'type':Sequelize[_0x2a04('0x5')]},'transfererchannel':{'type':Sequelize[_0x2a04('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x2a04('0x5')]},'transferercalleridname':{'type':Sequelize[_0x2a04('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x2a04('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x2a04('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x2a04('0x5')]},'transferercontext':{'type':Sequelize[_0x2a04('0x5')]},'transfererexten':{'type':Sequelize[_0x2a04('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x2a04('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x2a04('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x2a04('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2a04('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2a04('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x2a04('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x2a04('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x2a04('0x5')]},'isexternal':{'type':Sequelize[_0x2a04('0x2')](_0x2a04('0x6'),'No')},'context':{'type':Sequelize[_0x2a04('0x5')]},'extension':{'type':Sequelize[_0x2a04('0x5')]}}; \ No newline at end of file +var _0xd76d=['ENUM','blind','attended','STRING','Yes','sequelize','exports'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xd76d,0x139));var _0xdd76=function(_0x150469,_0x5ec8a2){_0x150469=_0x150469-0x0;var _0x110773=_0xd76d[_0x150469];return _0x110773;};'use strict';var Sequelize=require(_0xdd76('0x0'));var moment=require('moment');module[_0xdd76('0x1')]={'type':{'type':Sequelize[_0xdd76('0x2')](_0xdd76('0x3'),_0xdd76('0x4'))},'result':{'type':Sequelize[_0xdd76('0x5')]},'transfererchannel':{'type':Sequelize[_0xdd76('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xdd76('0x5')]},'transferercalleridname':{'type':Sequelize[_0xdd76('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xdd76('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xdd76('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xdd76('0x5')]},'transferercontext':{'type':Sequelize[_0xdd76('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xdd76('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xdd76('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xdd76('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xdd76('0x5')]},'transfereeexten':{'type':Sequelize[_0xdd76('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xdd76('0x2')](_0xdd76('0x6'),'No')},'context':{'type':Sequelize[_0xdd76('0x5')]},'extension':{'type':Sequelize[_0xdd76('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 5f9f156..a5bbb81 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 _0x6fb5=['end','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x4e4d5c,_0x25dd3a){var _0x56854a=function(_0x221d35){while(--_0x221d35){_0x4e4d5c['push'](_0x4e4d5c['shift']());}};_0x56854a(++_0x25dd3a);}(_0x6fb5,0x15e));var _0x56fb=function(_0x1f3c74,_0x1acefd){_0x1f3c74=_0x1f3c74-0x0;var _0x4f3219=_0x6fb5[_0x1f3c74];return _0x4f3219;};'use strict';var emlformat=require(_0x56fb('0x0'));var rimraf=require(_0x56fb('0x1'));var zipdir=require(_0x56fb('0x2'));var jsonpatch=require(_0x56fb('0x3'));var rp=require(_0x56fb('0x4'));var moment=require(_0x56fb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x56fb('0x6'));var util=require(_0x56fb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x56fb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56fb('0x9'));var squel=require(_0x56fb('0xa'));var crypto=require(_0x56fb('0xb'));var jsforce=require(_0x56fb('0xc'));var deskjs=require(_0x56fb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x56fb('0xe'));var Papa=require(_0x56fb('0xf'));var Redis=require(_0x56fb('0x10'));var authService=require(_0x56fb('0x11'));var qs=require(_0x56fb('0x12'));var as=require(_0x56fb('0x13'));var hardwareService=require(_0x56fb('0x14'));var logger=require(_0x56fb('0x15'))('api');var utils=require(_0x56fb('0x16'));var config=require(_0x56fb('0x17'));var licenseUtil=require(_0x56fb('0x18'));var db=require(_0x56fb('0x19'))['db'];function respondWithStatusCode(_0x1d9e29,_0x5684ea){_0x5684ea=_0x5684ea||0xcc;return function(_0x281562){if(_0x281562){return _0x1d9e29[_0x56fb('0x1a')](_0x5684ea);}return _0x1d9e29[_0x56fb('0x1b')](_0x5684ea)['end']();};}function respondWithResult(_0x5811f3,_0x3fc11a){_0x3fc11a=_0x3fc11a||0xc8;return function(_0x5f1fb2){if(_0x5f1fb2){return _0x5811f3[_0x56fb('0x1b')](_0x3fc11a)[_0x56fb('0x1c')](_0x5f1fb2);}};}function respondWithFilteredResult(_0x2d414e,_0xeb611){return function(_0x57c125){if(_0x57c125){var _0x428eb0=typeof _0xeb611[_0x56fb('0x1d')]===_0x56fb('0x1e')&&typeof _0xeb611[_0x56fb('0x1f')]===_0x56fb('0x1e');var _0x3e11e7=_0x57c125['count'];var _0x90bb1e=_0x428eb0?0x0:_0xeb611[_0x56fb('0x1d')];var _0xd3b3f2=_0x428eb0?_0x57c125[_0x56fb('0x20')]:_0xeb611[_0x56fb('0x1d')]+_0xeb611['limit'];var _0x32042e;if(_0xd3b3f2>=_0x3e11e7){_0xd3b3f2=_0x3e11e7;_0x32042e=0xc8;}else{_0x32042e=0xce;}_0x2d414e[_0x56fb('0x1b')](_0x32042e);return _0x2d414e[_0x56fb('0x21')](_0x56fb('0x22'),_0x90bb1e+'-'+_0xd3b3f2+'/'+_0x3e11e7)[_0x56fb('0x1c')](_0x57c125);}return null;};}function patchUpdates(_0x41eb41){return function(_0x5e377a){try{jsonpatch[_0x56fb('0x23')](_0x5e377a,_0x41eb41,!![]);}catch(_0x1703f3){return BPromise[_0x56fb('0x24')](_0x1703f3);}return _0x5e377a[_0x56fb('0x25')]();};}function saveUpdates(_0x9b9854,_0x47d0a6){return function(_0x4f6531){if(_0x4f6531){return _0x4f6531['update'](_0x9b9854)[_0x56fb('0x26')](function(_0x3f4b3c){return _0x3f4b3c;});}return null;};}function removeEntity(_0x5def9a,_0x2cbc4e){return function(_0x1bb324){if(_0x1bb324){return _0x1bb324[_0x56fb('0x27')]()['then'](function(){_0x5def9a[_0x56fb('0x1b')](0xcc)[_0x56fb('0x28')]();});}};}function handleEntityNotFound(_0x53b9ee,_0x48f7cb){return function(_0x3c0956){if(!_0x3c0956){_0x53b9ee[_0x56fb('0x1a')](0x194);}return _0x3c0956;};}function handleError(_0x1ca09f,_0x5ca9c1){_0x5ca9c1=_0x5ca9c1||0x1f4;return function(_0x139653){logger[_0x56fb('0x29')](_0x139653[_0x56fb('0x2a')]);if(_0x139653[_0x56fb('0x2b')]){delete _0x139653[_0x56fb('0x2b')];}_0x1ca09f[_0x56fb('0x1b')](_0x5ca9c1)[_0x56fb('0x2c')](_0x139653);};}exports[_0x56fb('0x2d')]=function(_0x123420,_0x210e1d){var _0x55b440={},_0xdf86c0={},_0x89bef2={'count':0x0,'rows':[]};var _0x36e9c5=_[_0x56fb('0x2e')](db[_0x56fb('0x2f')][_0x56fb('0x30')],function(_0x45cf58){return{'name':_0x45cf58[_0x56fb('0x31')],'type':_0x45cf58[_0x56fb('0x32')][_0x56fb('0x33')]};});_0xdf86c0[_0x56fb('0x34')]=_['map'](_0x36e9c5,'name');_0xdf86c0[_0x56fb('0x35')]=_[_0x56fb('0x36')](_0x123420[_0x56fb('0x35')]);_0xdf86c0[_0x56fb('0x37')]=_[_0x56fb('0x38')](_0xdf86c0[_0x56fb('0x34')],_0xdf86c0[_0x56fb('0x35')]);_0x55b440['attributes']=_['intersection'](_0xdf86c0[_0x56fb('0x34')],qs[_0x56fb('0x39')](_0x123420[_0x56fb('0x35')][_0x56fb('0x39')]));_0x55b440[_0x56fb('0x3a')]=_0x55b440[_0x56fb('0x3a')][_0x56fb('0x3b')]?_0x55b440[_0x56fb('0x3a')]:_0xdf86c0[_0x56fb('0x34')];if(!_0x123420[_0x56fb('0x35')][_0x56fb('0x3c')]('nolimit')){_0x55b440['limit']=qs['limit'](_0x123420['query'][_0x56fb('0x1f')]);_0x55b440[_0x56fb('0x1d')]=qs[_0x56fb('0x1d')](_0x123420[_0x56fb('0x35')][_0x56fb('0x1d')]);}_0x55b440[_0x56fb('0x3d')]=qs[_0x56fb('0x3e')](_0x123420[_0x56fb('0x35')][_0x56fb('0x3e')]);_0x55b440[_0x56fb('0x3f')]=qs[_0x56fb('0x37')](_[_0x56fb('0x40')](_0x123420['query'],_0xdf86c0['filters']),_0x36e9c5);if(_0x123420[_0x56fb('0x35')][_0x56fb('0x41')]){_0x55b440['where']=_[_0x56fb('0x42')](_0x55b440[_0x56fb('0x3f')],{'$or':_[_0x56fb('0x2e')](_0x36e9c5,function(_0x5f286a){if(_0x5f286a[_0x56fb('0x32')]!==_0x56fb('0x43')){var _0x52b28d={};_0x52b28d[_0x5f286a[_0x56fb('0x2b')]]={'$like':'%'+_0x123420[_0x56fb('0x35')]['filter']+'%'};return _0x52b28d;}})});}_0x55b440=_[_0x56fb('0x42')]({},_0x55b440,_0x123420[_0x56fb('0x44')]);var _0x303c38={'where':_0x55b440[_0x56fb('0x3f')]};return db[_0x56fb('0x2f')][_0x56fb('0x20')](_0x303c38)[_0x56fb('0x26')](function(_0x21db1d){_0x89bef2['count']=_0x21db1d;if(_0x123420[_0x56fb('0x35')][_0x56fb('0x45')]){_0x55b440['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x56fb('0x46')](_0x55b440);})[_0x56fb('0x26')](function(_0x4b8b59){_0x89bef2['rows']=_0x4b8b59;return _0x89bef2;})['then'](respondWithFilteredResult(_0x210e1d,_0x55b440))[_0x56fb('0x47')](handleError(_0x210e1d,null));};exports[_0x56fb('0x48')]=function(_0xa0e5eb,_0x453a0c){var _0x4f662f={'raw':!![],'where':{'id':_0xa0e5eb[_0x56fb('0x49')]['id']}},_0x272de5={};_0x272de5['model']=_[_0x56fb('0x36')](db[_0x56fb('0x2f')][_0x56fb('0x30')]);_0x272de5[_0x56fb('0x35')]=_['keys'](_0xa0e5eb[_0x56fb('0x35')]);_0x272de5[_0x56fb('0x37')]=_[_0x56fb('0x38')](_0x272de5[_0x56fb('0x34')],_0x272de5['query']);_0x4f662f['attributes']=_[_0x56fb('0x38')](_0x272de5[_0x56fb('0x34')],qs[_0x56fb('0x39')](_0xa0e5eb[_0x56fb('0x35')][_0x56fb('0x39')]));_0x4f662f[_0x56fb('0x3a')]=_0x4f662f[_0x56fb('0x3a')][_0x56fb('0x3b')]?_0x4f662f[_0x56fb('0x3a')]:_0x272de5[_0x56fb('0x34')];if(_0xa0e5eb[_0x56fb('0x35')][_0x56fb('0x45')]){_0x4f662f['include']=[{'all':!![]}];}_0x4f662f=_['merge']({},_0x4f662f,_0xa0e5eb['options']);return db['VoiceTransferReport']['find'](_0x4f662f)['then'](handleEntityNotFound(_0x453a0c,null))[_0x56fb('0x26')](respondWithResult(_0x453a0c,null))['catch'](handleError(_0x453a0c,null));};exports[_0x56fb('0x4a')]=function(_0x2fd2c1,_0x38767){return db[_0x56fb('0x2f')]['create'](_0x2fd2c1[_0x56fb('0x4b')],{})[_0x56fb('0x26')](respondWithResult(_0x38767,0xc9))['catch'](handleError(_0x38767,null));};exports['update']=function(_0x2be1f4,_0x5ac8c0){if(_0x2be1f4[_0x56fb('0x4b')]['id']){delete _0x2be1f4[_0x56fb('0x4b')]['id'];}return db[_0x56fb('0x2f')]['find']({'where':{'id':_0x2be1f4[_0x56fb('0x49')]['id']}})[_0x56fb('0x26')](handleEntityNotFound(_0x5ac8c0,null))['then'](saveUpdates(_0x2be1f4[_0x56fb('0x4b')],null))['then'](respondWithResult(_0x5ac8c0,null))[_0x56fb('0x47')](handleError(_0x5ac8c0,null));};exports[_0x56fb('0x27')]=function(_0x2e2dd2,_0x1feaa7){return db[_0x56fb('0x2f')][_0x56fb('0x4c')]({'where':{'id':_0x2e2dd2[_0x56fb('0x49')]['id']}})[_0x56fb('0x26')](handleEntityNotFound(_0x1feaa7,null))[_0x56fb('0x26')](removeEntity(_0x1feaa7,null))[_0x56fb('0x47')](handleError(_0x1feaa7,null));};exports[_0x56fb('0x4d')]=function(_0x4b3a8b,_0x2abd11){return db[_0x56fb('0x2f')]['describe']()[_0x56fb('0x26')](respondWithResult(_0x2abd11,null))[_0x56fb('0x47')](handleError(_0x2abd11,null));}; \ No newline at end of file +var _0x4d80=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x1ef1d6,_0x2c56cc){var _0xdd38f=function(_0x143a19){while(--_0x143a19){_0x1ef1d6['push'](_0x1ef1d6['shift']());}};_0xdd38f(++_0x2c56cc);}(_0x4d80,0xd5));var _0x04d8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4d80[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x04d8('0x0'));var rimraf=require(_0x04d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04d8('0x2'));var rp=require(_0x04d8('0x3'));var moment=require(_0x04d8('0x4'));var BPromise=require(_0x04d8('0x5'));var Mustache=require(_0x04d8('0x6'));var util=require(_0x04d8('0x7'));var path=require(_0x04d8('0x8'));var sox=require(_0x04d8('0x9'));var csv=require(_0x04d8('0xa'));var ejs=require(_0x04d8('0xb'));var fs=require('fs');var fs_extra=require(_0x04d8('0xc'));var _=require(_0x04d8('0xd'));var squel=require(_0x04d8('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x04d8('0xa'));var querystring=require(_0x04d8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x04d8('0x10'));var qs=require(_0x04d8('0x11'));var as=require(_0x04d8('0x12'));var hardwareService=require(_0x04d8('0x13'));var logger=require(_0x04d8('0x14'))(_0x04d8('0x15'));var utils=require(_0x04d8('0x16'));var config=require(_0x04d8('0x17'));var licenseUtil=require(_0x04d8('0x18'));var db=require(_0x04d8('0x19'))['db'];function respondWithStatusCode(_0x2b5f71,_0x11622b){_0x11622b=_0x11622b||0xcc;return function(_0x3c9dcd){if(_0x3c9dcd){return _0x2b5f71[_0x04d8('0x1a')](_0x11622b);}return _0x2b5f71[_0x04d8('0x1b')](_0x11622b)[_0x04d8('0x1c')]();};}function respondWithResult(_0x4bd1cc,_0x17aebb){_0x17aebb=_0x17aebb||0xc8;return function(_0x2a5ed6){if(_0x2a5ed6){return _0x4bd1cc[_0x04d8('0x1b')](_0x17aebb)[_0x04d8('0x1d')](_0x2a5ed6);}};}function respondWithFilteredResult(_0x42f615,_0x1f53ac){return function(_0x22f475){if(_0x22f475){var _0x5d3aa3=typeof _0x1f53ac[_0x04d8('0x1e')]===_0x04d8('0x1f')&&typeof _0x1f53ac[_0x04d8('0x20')]===_0x04d8('0x1f');var _0x3bddc6=_0x22f475[_0x04d8('0x21')];var _0x567f87=_0x5d3aa3?0x0:_0x1f53ac['offset'];var _0x54a773=_0x5d3aa3?_0x22f475['count']:_0x1f53ac['offset']+_0x1f53ac['limit'];var _0x5f59f6;if(_0x54a773>=_0x3bddc6){_0x54a773=_0x3bddc6;_0x5f59f6=0xc8;}else{_0x5f59f6=0xce;}_0x42f615[_0x04d8('0x1b')](_0x5f59f6);return _0x42f615['set'](_0x04d8('0x22'),_0x567f87+'-'+_0x54a773+'/'+_0x3bddc6)[_0x04d8('0x1d')](_0x22f475);}return null;};}function patchUpdates(_0x1cb979){return function(_0x42a0fa){try{jsonpatch[_0x04d8('0x23')](_0x42a0fa,_0x1cb979,!![]);}catch(_0x5a0472){return BPromise[_0x04d8('0x24')](_0x5a0472);}return _0x42a0fa[_0x04d8('0x25')]();};}function saveUpdates(_0x18e6f6,_0x12505f){return function(_0x68029e){if(_0x68029e){return _0x68029e['update'](_0x18e6f6)[_0x04d8('0x26')](function(_0x36f85b){return _0x36f85b;});}return null;};}function removeEntity(_0x227440,_0x35dd80){return function(_0x322ae3){if(_0x322ae3){return _0x322ae3[_0x04d8('0x27')]()[_0x04d8('0x26')](function(){_0x227440[_0x04d8('0x1b')](0xcc)[_0x04d8('0x1c')]();});}};}function handleEntityNotFound(_0x5b9f6a,_0x15c061){return function(_0xb74e58){if(!_0xb74e58){_0x5b9f6a[_0x04d8('0x1a')](0x194);}return _0xb74e58;};}function handleError(_0x316128,_0x3484d5){_0x3484d5=_0x3484d5||0x1f4;return function(_0x2bc110){logger['error'](_0x2bc110[_0x04d8('0x28')]);if(_0x2bc110[_0x04d8('0x29')]){delete _0x2bc110[_0x04d8('0x29')];}_0x316128[_0x04d8('0x1b')](_0x3484d5)[_0x04d8('0x2a')](_0x2bc110);};}exports[_0x04d8('0x2b')]=function(_0x465a13,_0x5f4549){var _0x2ca6fd={},_0x48e7b7={},_0x6084ad={'count':0x0,'rows':[]};var _0xdc6024=_[_0x04d8('0x2c')](db[_0x04d8('0x2d')][_0x04d8('0x2e')],function(_0x156702){return{'name':_0x156702[_0x04d8('0x2f')],'type':_0x156702[_0x04d8('0x30')][_0x04d8('0x31')]};});_0x48e7b7[_0x04d8('0x32')]=_[_0x04d8('0x2c')](_0xdc6024,_0x04d8('0x29'));_0x48e7b7[_0x04d8('0x33')]=_[_0x04d8('0x34')](_0x465a13[_0x04d8('0x33')]);_0x48e7b7[_0x04d8('0x35')]=_[_0x04d8('0x36')](_0x48e7b7[_0x04d8('0x32')],_0x48e7b7['query']);_0x2ca6fd[_0x04d8('0x37')]=_['intersection'](_0x48e7b7[_0x04d8('0x32')],qs[_0x04d8('0x38')](_0x465a13[_0x04d8('0x33')][_0x04d8('0x38')]));_0x2ca6fd[_0x04d8('0x37')]=_0x2ca6fd[_0x04d8('0x37')][_0x04d8('0x39')]?_0x2ca6fd['attributes']:_0x48e7b7[_0x04d8('0x32')];if(!_0x465a13[_0x04d8('0x33')]['hasOwnProperty']('nolimit')){_0x2ca6fd['limit']=qs[_0x04d8('0x20')](_0x465a13[_0x04d8('0x33')]['limit']);_0x2ca6fd[_0x04d8('0x1e')]=qs[_0x04d8('0x1e')](_0x465a13[_0x04d8('0x33')]['offset']);}_0x2ca6fd[_0x04d8('0x3a')]=qs['sort'](_0x465a13['query'][_0x04d8('0x3b')]);_0x2ca6fd[_0x04d8('0x3c')]=qs[_0x04d8('0x35')](_[_0x04d8('0x3d')](_0x465a13[_0x04d8('0x33')],_0x48e7b7['filters']),_0xdc6024);if(_0x465a13[_0x04d8('0x33')][_0x04d8('0x3e')]){_0x2ca6fd[_0x04d8('0x3c')]=_[_0x04d8('0x3f')](_0x2ca6fd[_0x04d8('0x3c')],{'$or':_['map'](_0xdc6024,function(_0x33f3b2){if(_0x33f3b2[_0x04d8('0x30')]!==_0x04d8('0x40')){var _0x1eb3a5={};_0x1eb3a5[_0x33f3b2[_0x04d8('0x29')]]={'$like':'%'+_0x465a13[_0x04d8('0x33')][_0x04d8('0x3e')]+'%'};return _0x1eb3a5;}})});}_0x2ca6fd=_['merge']({},_0x2ca6fd,_0x465a13[_0x04d8('0x41')]);var _0x78fa={'where':_0x2ca6fd[_0x04d8('0x3c')]};return db[_0x04d8('0x2d')]['count'](_0x78fa)[_0x04d8('0x26')](function(_0x1862b8){_0x6084ad[_0x04d8('0x21')]=_0x1862b8;if(_0x465a13[_0x04d8('0x33')]['includeAll']){_0x2ca6fd[_0x04d8('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x04d8('0x43')](_0x2ca6fd);})['then'](function(_0x3bf4eb){_0x6084ad[_0x04d8('0x44')]=_0x3bf4eb;return _0x6084ad;})[_0x04d8('0x26')](respondWithFilteredResult(_0x5f4549,_0x2ca6fd))['catch'](handleError(_0x5f4549,null));};exports[_0x04d8('0x45')]=function(_0x543f73,_0x27116f){var _0x3c6013={'raw':!![],'where':{'id':_0x543f73[_0x04d8('0x46')]['id']}},_0x3d36b6={};_0x3d36b6[_0x04d8('0x32')]=_['keys'](db[_0x04d8('0x2d')][_0x04d8('0x2e')]);_0x3d36b6[_0x04d8('0x33')]=_[_0x04d8('0x34')](_0x543f73['query']);_0x3d36b6[_0x04d8('0x35')]=_['intersection'](_0x3d36b6['model'],_0x3d36b6[_0x04d8('0x33')]);_0x3c6013['attributes']=_[_0x04d8('0x36')](_0x3d36b6['model'],qs[_0x04d8('0x38')](_0x543f73['query'][_0x04d8('0x38')]));_0x3c6013['attributes']=_0x3c6013['attributes'][_0x04d8('0x39')]?_0x3c6013['attributes']:_0x3d36b6[_0x04d8('0x32')];if(_0x543f73['query'][_0x04d8('0x47')]){_0x3c6013['include']=[{'all':!![]}];}_0x3c6013=_[_0x04d8('0x3f')]({},_0x3c6013,_0x543f73[_0x04d8('0x41')]);return db[_0x04d8('0x2d')][_0x04d8('0x48')](_0x3c6013)[_0x04d8('0x26')](handleEntityNotFound(_0x27116f,null))[_0x04d8('0x26')](respondWithResult(_0x27116f,null))[_0x04d8('0x49')](handleError(_0x27116f,null));};exports[_0x04d8('0x4a')]=function(_0x528566,_0x45c90d){return db[_0x04d8('0x2d')][_0x04d8('0x4a')](_0x528566[_0x04d8('0x4b')],{})[_0x04d8('0x26')](respondWithResult(_0x45c90d,0xc9))[_0x04d8('0x49')](handleError(_0x45c90d,null));};exports['update']=function(_0x1a9b03,_0xfc8923){if(_0x1a9b03[_0x04d8('0x4b')]['id']){delete _0x1a9b03[_0x04d8('0x4b')]['id'];}return db[_0x04d8('0x2d')][_0x04d8('0x48')]({'where':{'id':_0x1a9b03[_0x04d8('0x46')]['id']}})['then'](handleEntityNotFound(_0xfc8923,null))[_0x04d8('0x26')](saveUpdates(_0x1a9b03[_0x04d8('0x4b')],null))['then'](respondWithResult(_0xfc8923,null))[_0x04d8('0x49')](handleError(_0xfc8923,null));};exports[_0x04d8('0x27')]=function(_0x1396b4,_0x3c39a0){return db[_0x04d8('0x2d')][_0x04d8('0x48')]({'where':{'id':_0x1396b4[_0x04d8('0x46')]['id']}})[_0x04d8('0x26')](handleEntityNotFound(_0x3c39a0,null))['then'](removeEntity(_0x3c39a0,null))['catch'](handleError(_0x3c39a0,null));};exports['describe']=function(_0x3834ea,_0x28f647){return db[_0x04d8('0x2d')][_0x04d8('0x4c')]()[_0x04d8('0x26')](respondWithResult(_0x28f647,null))[_0x04d8('0x49')](handleError(_0x28f647,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 2712da7..a458021 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 _0x2043=['request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x2043,0x158));var _0x3204=function(_0x18f20f,_0x414454){_0x18f20f=_0x18f20f-0x0;var _0x25219b=_0x2043[_0x18f20f];return _0x25219b;};'use strict';var _=require(_0x3204('0x0'));var util=require(_0x3204('0x1'));var logger=require(_0x3204('0x2'))(_0x3204('0x3'));var moment=require(_0x3204('0x4'));var BPromise=require(_0x3204('0x5'));var rp=require(_0x3204('0x6'));var fs=require('fs');var path=require(_0x3204('0x7'));var rimraf=require(_0x3204('0x8'));var config=require(_0x3204('0x9'));var attributes=require(_0x3204('0xa'));module[_0x3204('0xb')]=function(_0x26fa5f,_0xe5282b){return _0x26fa5f[_0x3204('0xc')]('VoiceTransferReport',attributes,{'tableName':_0x3204('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef20=['request-promise','path','rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','bluebird'];(function(_0x4e9ff6,_0x28642d){var _0x59c86f=function(_0x255969){while(--_0x255969){_0x4e9ff6['push'](_0x4e9ff6['shift']());}};_0x59c86f(++_0x28642d);}(_0xef20,0x172));var _0x0ef2=function(_0x2da36e,_0x483d0f){_0x2da36e=_0x2da36e-0x0;var _0x3b426a=_0xef20[_0x2da36e];return _0x3b426a;};'use strict';var _=require('lodash');var util=require(_0x0ef2('0x0'));var logger=require(_0x0ef2('0x1'))(_0x0ef2('0x2'));var moment=require('moment');var BPromise=require(_0x0ef2('0x3'));var rp=require(_0x0ef2('0x4'));var fs=require('fs');var path=require(_0x0ef2('0x5'));var rimraf=require(_0x0ef2('0x6'));var config=require('../../config/environment');var attributes=require(_0x0ef2('0x7'));module[_0x0ef2('0x8')]=function(_0x1e78e0,_0x4d116f){return _0x1e78e0['define'](_0x0ef2('0x9'),attributes,{'tableName':_0x0ef2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 874dbf4..fcabcb9 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 _0xec25=['then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','options','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0xfa7cff,_0x42139f){var _0x35c707=function(_0x5aefd6){while(--_0x5aefd6){_0xfa7cff['push'](_0xfa7cff['shift']());}};_0x35c707(++_0x42139f);}(_0xec25,0x12c));var _0x5ec2=function(_0x484831,_0x2d9b0c){_0x484831=_0x484831-0x0;var _0x111299=_0xec25[_0x484831];return _0x111299;};'use strict';var _=require(_0x5ec2('0x0'));var util=require(_0x5ec2('0x1'));var moment=require(_0x5ec2('0x2'));var BPromise=require(_0x5ec2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ec2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ec2('0x5'));var logger=require(_0x5ec2('0x6'))(_0x5ec2('0x7'));var config=require('../../config/environment');var jayson=require(_0x5ec2('0x8'));var client=jayson[_0x5ec2('0x9')][_0x5ec2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d9cf6,_0x395e41,_0x11b34d){return new BPromise(function(_0x410269,_0x203029){return client[_0x5ec2('0xb')](_0x2d9cf6,_0x11b34d)[_0x5ec2('0xc')](function(_0x314d2d){logger[_0x5ec2('0xd')](_0x5ec2('0xe'),_0x395e41,_0x5ec2('0xf'));logger[_0x5ec2('0x10')](_0x5ec2('0x11'),_0x395e41,'request\x20sent',JSON[_0x5ec2('0x12')](_0x314d2d));if(_0x314d2d[_0x5ec2('0x13')]){if(_0x314d2d[_0x5ec2('0x13')]['code']===0x1f4){logger[_0x5ec2('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x395e41,_0x314d2d[_0x5ec2('0x13')][_0x5ec2('0x14')]);return _0x203029(_0x314d2d[_0x5ec2('0x13')][_0x5ec2('0x14')]);}logger[_0x5ec2('0x13')](_0x5ec2('0xe'),_0x395e41,_0x314d2d[_0x5ec2('0x13')][_0x5ec2('0x14')]);return _0x410269(_0x314d2d[_0x5ec2('0x13')]['message']);}else{logger[_0x5ec2('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x395e41,'request\x20sent');_0x410269(_0x314d2d[_0x5ec2('0x15')][_0x5ec2('0x14')]);}})['catch'](function(_0x33447a){logger[_0x5ec2('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x395e41,_0x33447a);_0x203029(_0x33447a);});});}exports[_0x5ec2('0x16')]=function(_0xbef6e9){var _0x204659=this;return new Promise(function(_0x5314db,_0x2b9afb){return db[_0x5ec2('0x17')][_0x5ec2('0x18')](_0xbef6e9['body'],{'raw':_0xbef6e9['options']?_0xbef6e9[_0x5ec2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5ec2('0xc')](function(_0x35e125){logger[_0x5ec2('0xd')](_0x5ec2('0x16'),_0xbef6e9);logger[_0x5ec2('0x10')](_0x5ec2('0x16'),_0xbef6e9,JSON[_0x5ec2('0x12')](_0x35e125));_0x5314db(_0x35e125);})['catch'](function(_0x221e2c){logger[_0x5ec2('0x13')](_0x5ec2('0x16'),_0x221e2c[_0x5ec2('0x14')],_0xbef6e9);_0x2b9afb(_0x204659[_0x5ec2('0x13')](0x1f4,_0x221e2c[_0x5ec2('0x14')]));});});}; \ No newline at end of file +var _0x9ce5=['options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','CreateVoiceTransferReport','VoiceTransferReport','create'];(function(_0x22034c,_0xe89146){var _0x38a302=function(_0x4dc069){while(--_0x4dc069){_0x22034c['push'](_0x22034c['shift']());}};_0x38a302(++_0xe89146);}(_0x9ce5,0x8a));var _0x59ce=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0x9ce5[_0x2e0443];return _0x52d450;};'use strict';var _=require(_0x59ce('0x0'));var util=require(_0x59ce('0x1'));var moment=require(_0x59ce('0x2'));var BPromise=require(_0x59ce('0x3'));var rs=require(_0x59ce('0x4'));var fs=require('fs');var Redis=require(_0x59ce('0x5'));var db=require(_0x59ce('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x59ce('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x59ce('0x8'));var client=jayson[_0x59ce('0x9')][_0x59ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x184f16,_0x51e7ae,_0x3e93ec){return new BPromise(function(_0x9c176c,_0x3815eb){return client[_0x59ce('0xb')](_0x184f16,_0x3e93ec)[_0x59ce('0xc')](function(_0x34e7ca){logger[_0x59ce('0xd')](_0x59ce('0xe'),_0x51e7ae,'request\x20sent');logger[_0x59ce('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x51e7ae,_0x59ce('0x10'),JSON[_0x59ce('0x11')](_0x34e7ca));if(_0x34e7ca['error']){if(_0x34e7ca[_0x59ce('0x12')]['code']===0x1f4){logger[_0x59ce('0x12')](_0x59ce('0xe'),_0x51e7ae,_0x34e7ca[_0x59ce('0x12')][_0x59ce('0x13')]);return _0x3815eb(_0x34e7ca[_0x59ce('0x12')][_0x59ce('0x13')]);}logger[_0x59ce('0x12')](_0x59ce('0xe'),_0x51e7ae,_0x34e7ca[_0x59ce('0x12')][_0x59ce('0x13')]);return _0x9c176c(_0x34e7ca[_0x59ce('0x12')]['message']);}else{logger[_0x59ce('0xd')](_0x59ce('0xe'),_0x51e7ae,_0x59ce('0x10'));_0x9c176c(_0x34e7ca[_0x59ce('0x14')][_0x59ce('0x13')]);}})['catch'](function(_0xf8a383){logger['error'](_0x59ce('0xe'),_0x51e7ae,_0xf8a383);_0x3815eb(_0xf8a383);});});}exports[_0x59ce('0x15')]=function(_0x502ad3){var _0x4e3388=this;return new Promise(function(_0x2bb3cd,_0x1c8414){return db[_0x59ce('0x16')][_0x59ce('0x17')](_0x502ad3['body'],{'raw':_0x502ad3[_0x59ce('0x18')]?_0x502ad3['options'][_0x59ce('0x19')]===undefined?!![]:![]:!![]})[_0x59ce('0xc')](function(_0x2a220c){logger[_0x59ce('0xd')](_0x59ce('0x15'),_0x502ad3);logger[_0x59ce('0xf')](_0x59ce('0x15'),_0x502ad3,JSON[_0x59ce('0x11')](_0x2a220c));_0x2bb3cd(_0x2a220c);})[_0x59ce('0x1a')](function(_0x3106c6){logger[_0x59ce('0x12')]('CreateVoiceTransferReport',_0x3106c6[_0x59ce('0x13')],_0x502ad3);_0x1c8414(_0x4e3388[_0x59ce('0x12')](0x1f4,_0x3106c6[_0x59ce('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 8052ea5..f6041dc 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 _0x00bb=['answer','hold','/unhold','unhold','calls','/transfer','exports','express','Router','../../components/auth/service','post','isAuthenticated','isWebrtcLicence','/hangup','/answer'];(function(_0x52de48,_0x5bc748){var _0x18f4c0=function(_0x44459e){while(--_0x44459e){_0x52de48['push'](_0x52de48['shift']());}};_0x18f4c0(++_0x5bc748);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x00bb[_0x47e7cb];return _0x2a8874;};'use strict';var express=require(_0xb00b('0x0'));var router=express[_0xb00b('0x1')]();var auth=require(_0xb00b('0x2'));var controller=require('./webbar.controller');router[_0xb00b('0x3')]('/originate',auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['originate']);router[_0xb00b('0x3')](_0xb00b('0x6'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['hangup']);router[_0xb00b('0x3')](_0xb00b('0x7'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x8')]);router[_0xb00b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x9')]);router[_0xb00b('0x3')](_0xb00b('0xa'),auth[_0xb00b('0x4')](),auth['isWebrtcLicence'](),controller[_0xb00b('0xb')]);router['post']('/calls',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0xc')]);router[_0xb00b('0x3')](_0xb00b('0xd'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['transfer']);module[_0xb00b('0xe')]=router; \ No newline at end of file +var _0xbec5=['exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0x4ac24a,_0x2b0781){var _0x537d5f=function(_0x1e9173){while(--_0x1e9173){_0x4ac24a['push'](_0x4ac24a['shift']());}};_0x537d5f(++_0x2b0781);}(_0xbec5,0xe5));var _0x5bec=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0xbec5[_0x5e3701];return _0x345dcf;};'use strict';var express=require(_0x5bec('0x0'));var router=express[_0x5bec('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5bec('0x2'));router[_0x5bec('0x3')](_0x5bec('0x4'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller['originate']);router[_0x5bec('0x3')](_0x5bec('0x7'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0x8')]);router[_0x5bec('0x3')](_0x5bec('0x9'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xa')]);router[_0x5bec('0x3')](_0x5bec('0xb'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller['hold']);router[_0x5bec('0x3')](_0x5bec('0xc'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0xd')]);router[_0x5bec('0x3')](_0x5bec('0xe'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xf')]);router['post'](_0x5bec('0x10'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0x11')]);module[_0x5bec('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index fa20857..6e836c9 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 _0x152f=['all','filter','rows','UserId','sessionId','sessionId\x20','originate\x20fired:','body','json','userId','callbackUrl','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','format','user:%s','hangup\x20executed!','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','hold\x20fired:','length','webbar:hold','hold\x20executed!','unhold\x20fired:','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','ioredis','defaults','localhost','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack','name','status','send','request','error','code','message','result','User','agent','then','VoiceChannels'];(function(_0x246380,_0x27ad62){var _0x24d795=function(_0x2792b9){while(--_0x2792b9){_0x246380['push'](_0x246380['shift']());}};_0x24d795(++_0x27ad62);}(_0x152f,0x144));var _0xf152=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x152f[_0x3054be];return _0x3df150;};'use strict';var path=require(_0xf152('0x0'));var fs=require('fs');var _=require(_0xf152('0x1'));var db=require(_0xf152('0x2'))['db'];var config=require(_0xf152('0x3'));var util=require(_0xf152('0x4'));var BPromise=require('bluebird');var jayson=require(_0xf152('0x5'));var amiClient=jayson[_0xf152('0x6')][_0xf152('0x7')]({'port':0x232a});var logger=require(_0xf152('0x8'))('webbarapi');var Redis=require(_0xf152('0x9'));config['redis']=_[_0xf152('0xa')](config['redis'],{'host':_0xf152('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0xf152('0xc'));var originateValidation=new Schema({'userId':{'type':_0xf152('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xf152('0xe'),'required':[!![],_0xf152('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xf152('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xf152('0xd'),'required':[!![],_0xf152('0x10')]},'sessionId':{'type':_0xf152('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf152('0xd'),'required':[!![],_0xf152('0x10')]},'sessionId':{'type':_0xf152('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf152('0xd'),'required':[!![],_0xf152('0x10')]},'sessionId':{'type':_0xf152('0xe'),'required':[!![],_0xf152('0x11')]},'transferNumber':{'type':_0xf152('0xe'),'required':[!![],_0xf152('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xf152('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf152('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf152('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf152('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf152('0xd'),'required':[!![],_0xf152('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf152('0x10')]}});function emit(_0x286f0a,_0x5f0cbf,_0x986a0){logger[_0xf152('0x13')](_0x286f0a,_0x5f0cbf,JSON[_0xf152('0x14')](_0x986a0));io['to'](_0x286f0a)[_0xf152('0x15')](_0x5f0cbf,_0x986a0);}function handleError(_0x491200){return function(_0x3d732e){console['log'](_0xf152('0x16'),_0x3d732e,_0x3d732e instanceof RangeError);logger['error'](_0x3d732e[_0xf152('0x17')]);if(_0x3d732e instanceof RangeError){if(_0x3d732e[_0xf152('0x18')]){delete _0x3d732e[_0xf152('0x18')];}_0x491200[_0xf152('0x19')](0x194)[_0xf152('0x1a')](_0x3d732e);}else{if(_0x3d732e[_0xf152('0x18')]){delete _0x3d732e['name'];}_0x491200[_0xf152('0x19')](0x1f4)[_0xf152('0x1a')](_0x3d732e);}};}function checkError(){return function(_0x2c0433){if(!_0x2c0433){throw new RangeError('NotFound');}return _0x2c0433;};}function respondWithRpcPromise(_0x470006,_0x1f2710){return new BPromise(function(_0x2cb87f,_0x35442a){var _0xc65d65=amiClient;return _0xc65d65[_0xf152('0x1b')](_0x470006,_0x1f2710)['then'](function(_0x56d7ea){if(_0x56d7ea[_0xf152('0x1c')]){if(_0x56d7ea[_0xf152('0x1c')][_0xf152('0x1d')]===0x1f4){return _0x35442a(_0x56d7ea[_0xf152('0x1c')]['message']);}return _0x2cb87f(_0x56d7ea[_0xf152('0x1c')][_0xf152('0x1e')]);}else{_0x2cb87f(_0x56d7ea[_0xf152('0x1f')]);}})['catch'](function(_0xea6589){_0x35442a(_0xea6589);});});}function getAgent(_0x408d68){return db[_0xf152('0x20')]['findOne']({'where':{'id':_0x408d68,'role':_0xf152('0x21')}})[_0xf152('0x22')](checkError());}function getAgentCheckSession(_0x3355f1,_0x1d1f9c){return new BPromise(function(_0x3d0644,_0x3ebb53){var _0x14b21b=respondWithRpcPromise(_0xf152('0x23'));var _0x48930b=getAgent(_0x3355f1);Promise[_0xf152('0x24')]([_0x14b21b,_0x48930b])['then'](function(_0x30a408){var _0x47e534=_0x30a408[0x0];var _0x3a9f08=_0x30a408[0x1];var _0x26bf4f=_[_0xf152('0x25')](_0x47e534[_0xf152('0x26')],function(_0x37cfe5){return _0x37cfe5[_0xf152('0x27')]==_0x3a9f08['id']&&_0x37cfe5[_0xf152('0x28')]==_0x1d1f9c;});if(_0x26bf4f['length']==0x1){_0x3d0644(_0x3a9f08);}else{_0x3ebb53(new RangeError(_0xf152('0x29')+_0x1d1f9c+'\x20not\x20found!'));}});});}exports['originate']=function(_0x10c580,_0x5770ba){logger[_0xf152('0x13')](_0xf152('0x2a'),_0x10c580[_0xf152('0x2b')]);var _0x3193e0=originateValidation[_0xf152('0xc')](_0x10c580['body']);if(_0x3193e0['length']>0x0){return _0x5770ba[_0xf152('0x19')](0x190)[_0xf152('0x2c')](_0x3193e0);}var _0x3e75ca=_0x10c580[_0xf152('0x2b')][_0xf152('0x2d')];var _0x40c4ad=_0x10c580[_0xf152('0x2b')]['callNumber'];var _0x3ea74a=_0x10c580[_0xf152('0x2b')]['callerId'];var _0x36b59d=_0x10c580[_0xf152('0x2b')][_0xf152('0x2e')];return getAgent(_0x3e75ca)['then'](function(_0x208360){logger[_0xf152('0x13')]('entityFound:',_0x208360[_0xf152('0x18')]);emit(util['format']('user:%s',_0x208360[_0xf152('0x18')]),_0xf152('0x2f'),{'callNumber':_0x40c4ad,'callerId':_0x3ea74a,'callbackUrl':_0x36b59d});return _0x5770ba['status'](0xc8)[_0xf152('0x2c')]({'error':![],'message':_0xf152('0x30')});})[_0xf152('0x31')](handleError(_0x5770ba));};exports[_0xf152('0x32')]=function(_0x50ded8,_0x21b688){logger[_0xf152('0x13')](_0xf152('0x33'),_0x50ded8[_0xf152('0x2b')]);var _0x13723f=hangupValidation['validate'](_0x50ded8[_0xf152('0x2b')]);if(_0x13723f['length']>0x0){return _0x21b688[_0xf152('0x19')](0x190)['json'](_0x13723f);}var _0x1000ba=_0x50ded8[_0xf152('0x2b')][_0xf152('0x2d')];var _0x3fcd54=_0x50ded8[_0xf152('0x2b')][_0xf152('0x28')];return getAgent(_0x1000ba)['then'](function(_0x5a9e6b){logger['info']('entityFound:',_0x5a9e6b['name']);emit(util[_0xf152('0x34')](_0xf152('0x35'),_0x5a9e6b[_0xf152('0x18')]),'webbar:hangup',{'sessionId':_0x3fcd54});return _0x21b688[_0xf152('0x19')](0xc8)[_0xf152('0x2c')]({'error':![],'message':_0xf152('0x36')});})[_0xf152('0x31')](handleError(_0x21b688));};exports['answer']=function(_0x2f878e,_0x871f0b){logger[_0xf152('0x13')](_0xf152('0x37'),_0x2f878e[_0xf152('0x2b')]);var _0x18d765=answerValidation[_0xf152('0xc')](_0x2f878e['body']);if(_0x18d765['length']>0x0){return _0x871f0b[_0xf152('0x19')](0x190)[_0xf152('0x2c')](_0x18d765);}var _0x5bf293=_0x2f878e[_0xf152('0x2b')][_0xf152('0x2d')];var _0x5ca89a=_0x2f878e[_0xf152('0x2b')][_0xf152('0x28')];return getAgent(_0x5bf293)['then'](function(_0x3560d4){logger['info'](_0xf152('0x38'),_0x3560d4[_0xf152('0x18')]);emit(util['format'](_0xf152('0x35'),_0x3560d4[_0xf152('0x18')]),_0xf152('0x39'),{'sessionId':_0x5ca89a});return _0x871f0b['status'](0xc8)['json']({'error':![],'message':_0xf152('0x3a')});})[_0xf152('0x31')](handleError(_0x871f0b));};exports['hold']=function(_0x38db56,_0x1bbdf4){logger['info'](_0xf152('0x3b'),_0x38db56[_0xf152('0x2b')]);var _0xe2cd=holdValidation['validate'](_0x38db56['body']);if(_0xe2cd[_0xf152('0x3c')]>0x0){return _0x1bbdf4['status'](0x190)['json'](_0xe2cd);}var _0x4590e6=_0x38db56[_0xf152('0x2b')][_0xf152('0x2d')];var _0x56c2f4=_0x38db56[_0xf152('0x2b')][_0xf152('0x28')];return getAgent(_0x4590e6)[_0xf152('0x22')](function(_0x4935f4){logger[_0xf152('0x13')](_0xf152('0x38'),_0x4935f4[_0xf152('0x18')]);emit(util[_0xf152('0x34')](_0xf152('0x35'),_0x4935f4['name']),_0xf152('0x3d'),{'sessionId':_0x56c2f4});return _0x1bbdf4[_0xf152('0x19')](0xc8)[_0xf152('0x2c')]({'error':![],'message':_0xf152('0x3e')});})['catch'](handleError(_0x1bbdf4));};exports['unhold']=function(_0x141896,_0x284d32){logger[_0xf152('0x13')](_0xf152('0x3f'),_0x141896['body']);var _0x329980=unholdValidation[_0xf152('0xc')](_0x141896[_0xf152('0x2b')]);if(_0x329980[_0xf152('0x3c')]>0x0){return _0x284d32[_0xf152('0x19')](0x190)[_0xf152('0x2c')](_0x329980);}var _0x24d0d0=_0x141896[_0xf152('0x2b')][_0xf152('0x2d')];var _0x535cf7=_0x141896['body'][_0xf152('0x28')];return getAgent(_0x24d0d0)['then'](function(_0x3d060a){logger[_0xf152('0x13')](_0xf152('0x38'),_0x3d060a[_0xf152('0x18')]);emit(util['format'](_0xf152('0x35'),_0x3d060a[_0xf152('0x18')]),'webbar:unhold',{'sessionId':_0x535cf7});return _0x284d32[_0xf152('0x19')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0xf152('0x31')](handleError(_0x284d32));};exports['calls']=function(_0x3ca402,_0xd39ef){logger['info'](_0xf152('0x40'),_0xd39ef[_0xf152('0x2b')]);var _0x75cea9=callsValidation[_0xf152('0xc')](_0x3ca402[_0xf152('0x2b')]);if(_0x75cea9[_0xf152('0x3c')]>0x0){return _0xd39ef[_0xf152('0x19')](0x190)[_0xf152('0x2c')](_0x75cea9);}var _0x4a670c=_0x3ca402['body']['userId'];var _0x1ebb7e=respondWithRpcPromise(_0xf152('0x23'));var _0x2e372d=getAgent(_0x4a670c);return Promise[_0xf152('0x24')]([_0x1ebb7e,_0x2e372d])[_0xf152('0x22')](function(_0x1704a1){var _0x4e89c5=_0x1704a1[0x0];var _0x346591=_0x1704a1[0x1];var _0x37b355=_[_0xf152('0x25')](_0x4e89c5[_0xf152('0x26')],function(_0x104d80){return _0x104d80[_0xf152('0x27')]==_0x346591['id'];});return _0xd39ef[_0xf152('0x19')](0xc8)[_0xf152('0x2c')]({'count':_0x37b355[_0xf152('0x3c')],'rows':_0x37b355});})[_0xf152('0x31')](handleError(_0xd39ef));};exports[_0xf152('0x41')]=function(_0x281f74,_0x301301){logger['info'](_0xf152('0x42'),_0x281f74['body']);var _0x6135aa=conferenceValidation[_0xf152('0xc')](_0x281f74['body']);if(_0x6135aa['length']>0x0){return _0x301301['status'](0x190)[_0xf152('0x2c')](_0x6135aa);}var _0x208b15=_0x281f74[_0xf152('0x2b')]['userId'];return getAgent(_0x208b15)[_0xf152('0x22')](function(_0x827476){logger[_0xf152('0x13')](_0xf152('0x38'),_0x827476['name']);emit(util['format']('user:%s',_0x827476[_0xf152('0x18')]),'webbar:conference');return _0x301301[_0xf152('0x19')](0xc8)[_0xf152('0x2c')]({'error':![],'message':_0xf152('0x43')});})[_0xf152('0x31')](handleError(_0x301301));};exports[_0xf152('0x44')]=function(_0x3e4eb8,_0xad0c59){logger[_0xf152('0x13')]('transfer\x20fired:',_0x3e4eb8[_0xf152('0x2b')]);var _0x201dc2=transferValidation[_0xf152('0xc')](_0x3e4eb8[_0xf152('0x2b')]);if(_0x201dc2['length']>0x0){return _0xad0c59[_0xf152('0x19')](0x190)[_0xf152('0x2c')](_0x201dc2);}var _0x55a906=_0x3e4eb8[_0xf152('0x2b')][_0xf152('0x2d')];var _0x8af7a2=_0x3e4eb8['body'][_0xf152('0x28')];var _0x5b3905=_0x3e4eb8[_0xf152('0x2b')][_0xf152('0x45')];return getAgent(_0x55a906)['then'](function(_0x23bb47){logger['info']('entityFound:',_0x23bb47[_0xf152('0x18')]);emit(util[_0xf152('0x34')](_0xf152('0x35'),_0x23bb47[_0xf152('0x18')]),_0xf152('0x46'),{'sessionId':_0x8af7a2,'transferNumber':_0x5b3905});return _0xad0c59['status'](0xc8)[_0xf152('0x2c')]({'error':![],'message':_0xf152('0x47')});})[_0xf152('0x31')](handleError(_0xad0c59));}; \ No newline at end of file +var _0xe3af=['webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','stringify','emit','handleError:','error','stack','name','send','status','NotFound','code','message','catch','User','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId\x20','\x20not\x20found!','info','body','length','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','hangup','hangup\x20fired:','sessionId'];(function(_0x38205b,_0x104099){var _0x62ae45=function(_0x1643a0){while(--_0x1643a0){_0x38205b['push'](_0x38205b['shift']());}};_0x62ae45(++_0x104099);}(_0xe3af,0xf4));var _0xfe3a=function(_0x282916,_0x29c453){_0x282916=_0x282916-0x0;var _0x317b39=_0xe3af[_0x282916];return _0x317b39;};'use strict';var path=require(_0xfe3a('0x0'));var fs=require('fs');var _=require(_0xfe3a('0x1'));var db=require(_0xfe3a('0x2'))['db'];var config=require(_0xfe3a('0x3'));var util=require(_0xfe3a('0x4'));var BPromise=require(_0xfe3a('0x5'));var jayson=require(_0xfe3a('0x6'));var amiClient=jayson['client'][_0xfe3a('0x7')]({'port':0x232a});var logger=require(_0xfe3a('0x8'))('webbarapi');var Redis=require(_0xfe3a('0x9'));config[_0xfe3a('0xa')]=_['defaults'](config[_0xfe3a('0xa')],{'host':_0xfe3a('0xb'),'port':0x18eb});var io=require(_0xfe3a('0xc'))(new Redis(config[_0xfe3a('0xa')]));var Schema=require(_0xfe3a('0xd'));var originateValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],_0xfe3a('0xf')]},'callNumber':{'type':_0xfe3a('0x10'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xfe3a('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfe3a('0xf')]},'sessionId':{'type':_0xfe3a('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],_0xfe3a('0xf')]},'sessionId':{'type':_0xfe3a('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],_0xfe3a('0xf')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xfe3a('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xfe3a('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],_0xfe3a('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfe3a('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x553c0f,_0x40985e,_0x224659){logger['info'](_0x553c0f,_0x40985e,JSON[_0xfe3a('0x11')](_0x224659));io['to'](_0x553c0f)[_0xfe3a('0x12')](_0x40985e,_0x224659);}function handleError(_0xc5199e){return function(_0x1c40ec){console['log'](_0xfe3a('0x13'),_0x1c40ec,_0x1c40ec instanceof RangeError);logger[_0xfe3a('0x14')](_0x1c40ec[_0xfe3a('0x15')]);if(_0x1c40ec instanceof RangeError){if(_0x1c40ec[_0xfe3a('0x16')]){delete _0x1c40ec[_0xfe3a('0x16')];}_0xc5199e['status'](0x194)[_0xfe3a('0x17')](_0x1c40ec);}else{if(_0x1c40ec[_0xfe3a('0x16')]){delete _0x1c40ec[_0xfe3a('0x16')];}_0xc5199e[_0xfe3a('0x18')](0x1f4)[_0xfe3a('0x17')](_0x1c40ec);}};}function checkError(){return function(_0x491e51){if(!_0x491e51){throw new RangeError(_0xfe3a('0x19'));}return _0x491e51;};}function respondWithRpcPromise(_0x5bf55a,_0x59b567){return new BPromise(function(_0x201997,_0x294d76){var _0x4de6c5=amiClient;return _0x4de6c5['request'](_0x5bf55a,_0x59b567)['then'](function(_0x599b9f){if(_0x599b9f[_0xfe3a('0x14')]){if(_0x599b9f[_0xfe3a('0x14')][_0xfe3a('0x1a')]===0x1f4){return _0x294d76(_0x599b9f[_0xfe3a('0x14')][_0xfe3a('0x1b')]);}return _0x201997(_0x599b9f[_0xfe3a('0x14')][_0xfe3a('0x1b')]);}else{_0x201997(_0x599b9f['result']);}})[_0xfe3a('0x1c')](function(_0x59eddf){_0x294d76(_0x59eddf);});});}function getAgent(_0x30147a){return db[_0xfe3a('0x1d')]['findOne']({'where':{'id':_0x30147a,'role':_0xfe3a('0x1e')}})[_0xfe3a('0x1f')](checkError());}function getAgentCheckSession(_0x2d9b5c,_0x144c45){return new BPromise(function(_0x592204,_0x63d623){var _0x48e29b=respondWithRpcPromise(_0xfe3a('0x20'));var _0x4b1a56=getAgent(_0x2d9b5c);Promise[_0xfe3a('0x21')]([_0x48e29b,_0x4b1a56])[_0xfe3a('0x1f')](function(_0x3b1da0){var _0x61b5de=_0x3b1da0[0x0];var _0x253067=_0x3b1da0[0x1];var _0x31f382=_[_0xfe3a('0x22')](_0x61b5de[_0xfe3a('0x23')],function(_0x17cecc){return _0x17cecc[_0xfe3a('0x24')]==_0x253067['id']&&_0x17cecc['sessionId']==_0x144c45;});if(_0x31f382['length']==0x1){_0x592204(_0x253067);}else{_0x63d623(new RangeError(_0xfe3a('0x25')+_0x144c45+_0xfe3a('0x26')));}});});}exports['originate']=function(_0x4a0a01,_0x10ce12){logger[_0xfe3a('0x27')]('originate\x20fired:',_0x4a0a01[_0xfe3a('0x28')]);var _0x32c4f2=originateValidation[_0xfe3a('0xd')](_0x4a0a01[_0xfe3a('0x28')]);if(_0x32c4f2[_0xfe3a('0x29')]>0x0){return _0x10ce12[_0xfe3a('0x18')](0x190)[_0xfe3a('0x2a')](_0x32c4f2);}var _0x3ee1c3=_0x4a0a01[_0xfe3a('0x28')][_0xfe3a('0x2b')];var _0x145645=_0x4a0a01[_0xfe3a('0x28')]['callNumber'];var _0x503a15=_0x4a0a01[_0xfe3a('0x28')][_0xfe3a('0x2c')];var _0x18f858=_0x4a0a01[_0xfe3a('0x28')][_0xfe3a('0x2d')];return getAgent(_0x3ee1c3)['then'](function(_0x3b73ab){logger['info'](_0xfe3a('0x2e'),_0x3b73ab[_0xfe3a('0x16')]);emit(util[_0xfe3a('0x2f')](_0xfe3a('0x30'),_0x3b73ab[_0xfe3a('0x16')]),'webbar:originate',{'callNumber':_0x145645,'callerId':_0x503a15,'callbackUrl':_0x18f858});return _0x10ce12[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'error':![],'message':'originate\x20executed!'});})[_0xfe3a('0x1c')](handleError(_0x10ce12));};exports[_0xfe3a('0x31')]=function(_0x358b5a,_0x24a9ef){logger['info'](_0xfe3a('0x32'),_0x358b5a[_0xfe3a('0x28')]);var _0x3e4961=hangupValidation[_0xfe3a('0xd')](_0x358b5a[_0xfe3a('0x28')]);if(_0x3e4961[_0xfe3a('0x29')]>0x0){return _0x24a9ef[_0xfe3a('0x18')](0x190)[_0xfe3a('0x2a')](_0x3e4961);}var _0x1ecce1=_0x358b5a[_0xfe3a('0x28')][_0xfe3a('0x2b')];var _0x58ab6d=_0x358b5a['body'][_0xfe3a('0x33')];return getAgent(_0x1ecce1)[_0xfe3a('0x1f')](function(_0x150b6b){logger[_0xfe3a('0x27')](_0xfe3a('0x2e'),_0x150b6b['name']);emit(util['format'](_0xfe3a('0x30'),_0x150b6b[_0xfe3a('0x16')]),_0xfe3a('0x34'),{'sessionId':_0x58ab6d});return _0x24a9ef['status'](0xc8)['json']({'error':![],'message':_0xfe3a('0x35')});})[_0xfe3a('0x1c')](handleError(_0x24a9ef));};exports[_0xfe3a('0x36')]=function(_0x5e97a9,_0x30ceea){logger[_0xfe3a('0x27')](_0xfe3a('0x37'),_0x5e97a9[_0xfe3a('0x28')]);var _0xe11294=answerValidation[_0xfe3a('0xd')](_0x5e97a9[_0xfe3a('0x28')]);if(_0xe11294[_0xfe3a('0x29')]>0x0){return _0x30ceea['status'](0x190)[_0xfe3a('0x2a')](_0xe11294);}var _0xe724e6=_0x5e97a9[_0xfe3a('0x28')][_0xfe3a('0x2b')];var _0xfc20cf=_0x5e97a9['body']['sessionId'];return getAgent(_0xe724e6)[_0xfe3a('0x1f')](function(_0xf2eae0){logger[_0xfe3a('0x27')](_0xfe3a('0x2e'),_0xf2eae0[_0xfe3a('0x16')]);emit(util[_0xfe3a('0x2f')](_0xfe3a('0x30'),_0xf2eae0[_0xfe3a('0x16')]),_0xfe3a('0x38'),{'sessionId':_0xfc20cf});return _0x30ceea[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'error':![],'message':_0xfe3a('0x39')});})[_0xfe3a('0x1c')](handleError(_0x30ceea));};exports[_0xfe3a('0x3a')]=function(_0x504b79,_0xb35f89){logger[_0xfe3a('0x27')](_0xfe3a('0x3b'),_0x504b79['body']);var _0x4b5ddf=holdValidation[_0xfe3a('0xd')](_0x504b79['body']);if(_0x4b5ddf[_0xfe3a('0x29')]>0x0){return _0xb35f89['status'](0x190)[_0xfe3a('0x2a')](_0x4b5ddf);}var _0x2b4532=_0x504b79['body'][_0xfe3a('0x2b')];var _0x4d9a53=_0x504b79[_0xfe3a('0x28')][_0xfe3a('0x33')];return getAgent(_0x2b4532)[_0xfe3a('0x1f')](function(_0x400c21){logger[_0xfe3a('0x27')](_0xfe3a('0x2e'),_0x400c21[_0xfe3a('0x16')]);emit(util[_0xfe3a('0x2f')](_0xfe3a('0x30'),_0x400c21[_0xfe3a('0x16')]),'webbar:hold',{'sessionId':_0x4d9a53});return _0xb35f89['status'](0xc8)['json']({'error':![],'message':_0xfe3a('0x3c')});})[_0xfe3a('0x1c')](handleError(_0xb35f89));};exports[_0xfe3a('0x3d')]=function(_0x134571,_0x458e76){logger[_0xfe3a('0x27')](_0xfe3a('0x3e'),_0x134571[_0xfe3a('0x28')]);var _0x2d26b0=unholdValidation[_0xfe3a('0xd')](_0x134571['body']);if(_0x2d26b0[_0xfe3a('0x29')]>0x0){return _0x458e76['status'](0x190)[_0xfe3a('0x2a')](_0x2d26b0);}var _0x5d1bf2=_0x134571[_0xfe3a('0x28')][_0xfe3a('0x2b')];var _0x2ed103=_0x134571['body'][_0xfe3a('0x33')];return getAgent(_0x5d1bf2)[_0xfe3a('0x1f')](function(_0x3cf03d){logger[_0xfe3a('0x27')](_0xfe3a('0x2e'),_0x3cf03d[_0xfe3a('0x16')]);emit(util[_0xfe3a('0x2f')](_0xfe3a('0x30'),_0x3cf03d['name']),_0xfe3a('0x3f'),{'sessionId':_0x2ed103});return _0x458e76[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'error':![],'message':_0xfe3a('0x40')});})[_0xfe3a('0x1c')](handleError(_0x458e76));};exports[_0xfe3a('0x41')]=function(_0x40e05a,_0x28264d){logger[_0xfe3a('0x27')]('calls\x20fired:',_0x28264d[_0xfe3a('0x28')]);var _0x43633b=callsValidation['validate'](_0x40e05a[_0xfe3a('0x28')]);if(_0x43633b[_0xfe3a('0x29')]>0x0){return _0x28264d[_0xfe3a('0x18')](0x190)[_0xfe3a('0x2a')](_0x43633b);}var _0x178759=_0x40e05a['body'][_0xfe3a('0x2b')];var _0x343d7c=respondWithRpcPromise(_0xfe3a('0x20'));var _0x5ce53e=getAgent(_0x178759);return Promise[_0xfe3a('0x21')]([_0x343d7c,_0x5ce53e])[_0xfe3a('0x1f')](function(_0x4d7292){var _0x39cae4=_0x4d7292[0x0];var _0x121a28=_0x4d7292[0x1];var _0x5d7da6=_['filter'](_0x39cae4[_0xfe3a('0x23')],function(_0x2895a8){return _0x2895a8[_0xfe3a('0x24')]==_0x121a28['id'];});return _0x28264d[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'count':_0x5d7da6['length'],'rows':_0x5d7da6});})[_0xfe3a('0x1c')](handleError(_0x28264d));};exports[_0xfe3a('0x42')]=function(_0x4af114,_0x123b9c){logger['info'](_0xfe3a('0x43'),_0x4af114[_0xfe3a('0x28')]);var _0x381982=conferenceValidation[_0xfe3a('0xd')](_0x4af114[_0xfe3a('0x28')]);if(_0x381982[_0xfe3a('0x29')]>0x0){return _0x123b9c[_0xfe3a('0x18')](0x190)[_0xfe3a('0x2a')](_0x381982);}var _0x5867d3=_0x4af114[_0xfe3a('0x28')][_0xfe3a('0x2b')];return getAgent(_0x5867d3)[_0xfe3a('0x1f')](function(_0x35ea54){logger[_0xfe3a('0x27')](_0xfe3a('0x2e'),_0x35ea54[_0xfe3a('0x16')]);emit(util[_0xfe3a('0x2f')](_0xfe3a('0x30'),_0x35ea54[_0xfe3a('0x16')]),_0xfe3a('0x44'));return _0x123b9c[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'error':![],'message':_0xfe3a('0x45')});})[_0xfe3a('0x1c')](handleError(_0x123b9c));};exports[_0xfe3a('0x46')]=function(_0x20ee8f,_0x3e93ac){logger[_0xfe3a('0x27')](_0xfe3a('0x47'),_0x20ee8f[_0xfe3a('0x28')]);var _0xe5073c=transferValidation['validate'](_0x20ee8f[_0xfe3a('0x28')]);if(_0xe5073c[_0xfe3a('0x29')]>0x0){return _0x3e93ac['status'](0x190)[_0xfe3a('0x2a')](_0xe5073c);}var _0x4ba899=_0x20ee8f[_0xfe3a('0x28')][_0xfe3a('0x2b')];var _0x3a52fb=_0x20ee8f[_0xfe3a('0x28')][_0xfe3a('0x33')];var _0x39734a=_0x20ee8f['body']['transferNumber'];return getAgent(_0x4ba899)[_0xfe3a('0x1f')](function(_0xd45362){logger['info'](_0xfe3a('0x2e'),_0xd45362[_0xfe3a('0x16')]);emit(util['format'](_0xfe3a('0x30'),_0xd45362[_0xfe3a('0x16')]),_0xfe3a('0x48'),{'sessionId':_0x3a52fb,'transferNumber':_0x39734a});return _0x3e93ac[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'error':![],'message':_0xfe3a('0x49')});})[_0xfe3a('0x1c')](handleError(_0x3e93ac));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 1dd2179..cca9a32 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 _0xd5b6=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','/:id','/:id/dispositions','isAuthenticated','getAnswers','/:id/users','getAgents','/:id/applications','post','create','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','send','put','destroy','removeDispositions','removeAnswers','delete','exports','multer','path'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0xd5b6,0x169));var _0x6d5b=function(_0x240613,_0x807f44){_0x240613=_0x240613-0x0;var _0x225621=_0xd5b6[_0x240613];return _0x225621;};'use strict';var multer=require(_0x6d5b('0x0'));var util=require('util');var path=require(_0x6d5b('0x1'));var timeout=require(_0x6d5b('0x2'));var express=require('express');var router=express[_0x6d5b('0x3')]();var fs_extra=require(_0x6d5b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6d5b('0x5'));var config=require(_0x6d5b('0x6'));var controller=require(_0x6d5b('0x7'));router[_0x6d5b('0x8')]('/',auth['isAuthenticated'](),controller[_0x6d5b('0x9')]);router[_0x6d5b('0x8')](_0x6d5b('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x6d5b('0x8')](_0x6d5b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x6d5b('0x8')](_0x6d5b('0xc'),auth[_0x6d5b('0xd')](),controller['getDispositions']);router[_0x6d5b('0x8')]('/:id/canned_answers',auth[_0x6d5b('0xd')](),controller[_0x6d5b('0xe')]);router[_0x6d5b('0x8')](_0x6d5b('0xf'),auth[_0x6d5b('0xd')](),controller[_0x6d5b('0x10')]);router['get'](_0x6d5b('0x11'),auth[_0x6d5b('0xd')](),controller['getApplications']);router[_0x6d5b('0x12')]('/',auth[_0x6d5b('0xd')](),controller[_0x6d5b('0x13')]);router[_0x6d5b('0x12')](_0x6d5b('0xc'),auth[_0x6d5b('0xd')](),controller['addDisposition']);router[_0x6d5b('0x12')](_0x6d5b('0x14'),auth['isAuthenticated'](),controller[_0x6d5b('0x15')]);router[_0x6d5b('0x12')]('/:id/users',auth[_0x6d5b('0xd')](),controller[_0x6d5b('0x16')]);router[_0x6d5b('0x12')]('/:id/applications',auth['isAuthenticated'](),controller[_0x6d5b('0x17')]);router[_0x6d5b('0x12')](_0x6d5b('0x18'),controller[_0x6d5b('0x19')]);router[_0x6d5b('0x12')]('/:id/send',auth['isAuthenticated'](),controller[_0x6d5b('0x1a')]);router[_0x6d5b('0x1b')](_0x6d5b('0xb'),auth[_0x6d5b('0xd')](),controller['update']);router['delete']('/:id',auth[_0x6d5b('0xd')](),controller[_0x6d5b('0x1c')]);router['delete'](_0x6d5b('0xc'),auth[_0x6d5b('0xd')](),controller[_0x6d5b('0x1d')]);router['delete']('/:id/canned_answers',auth[_0x6d5b('0xd')](),controller[_0x6d5b('0x1e')]);router[_0x6d5b('0x1f')](_0x6d5b('0xf'),auth[_0x6d5b('0xd')](),controller['removeAgents']);module[_0x6d5b('0x20')]=router; \ No newline at end of file +var _0x7fe2=['delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update'];(function(_0x1dfa53,_0x137031){var _0x3f377b=function(_0x2b2ba7){while(--_0x2b2ba7){_0x1dfa53['push'](_0x1dfa53['shift']());}};_0x3f377b(++_0x137031);}(_0x7fe2,0xa1));var _0x27fe=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x7fe2[_0x3cae69];return _0x3128eb;};'use strict';var multer=require('multer');var util=require(_0x27fe('0x0'));var path=require(_0x27fe('0x1'));var timeout=require(_0x27fe('0x2'));var express=require(_0x27fe('0x3'));var router=express[_0x27fe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x27fe('0x5'));var interaction=require(_0x27fe('0x6'));var config=require(_0x27fe('0x7'));var controller=require(_0x27fe('0x8'));router[_0x27fe('0x9')]('/',auth[_0x27fe('0xa')](),controller['index']);router['get'](_0x27fe('0xb'),auth[_0x27fe('0xa')](),controller[_0x27fe('0xc')]);router[_0x27fe('0x9')](_0x27fe('0xd'),auth[_0x27fe('0xa')](),controller['show']);router[_0x27fe('0x9')]('/:id/dispositions',auth[_0x27fe('0xa')](),controller[_0x27fe('0xe')]);router['get'](_0x27fe('0xf'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x10')]);router[_0x27fe('0x9')](_0x27fe('0x11'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x12')]);router[_0x27fe('0x9')](_0x27fe('0x13'),auth['isAuthenticated'](),controller[_0x27fe('0x14')]);router[_0x27fe('0x15')]('/',auth[_0x27fe('0xa')](),controller[_0x27fe('0x16')]);router['post'](_0x27fe('0x17'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x18')]);router['post']('/:id/canned_answers',auth[_0x27fe('0xa')](),controller[_0x27fe('0x19')]);router['post'](_0x27fe('0x11'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x1a')]);router['post']('/:id/applications',auth[_0x27fe('0xa')](),controller[_0x27fe('0x1b')]);router[_0x27fe('0x15')](_0x27fe('0x1c'),controller[_0x27fe('0x1d')]);router[_0x27fe('0x15')](_0x27fe('0x1e'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x1f')]);router[_0x27fe('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x27fe('0x21')]);router[_0x27fe('0x22')](_0x27fe('0xd'),auth[_0x27fe('0xa')](),controller['destroy']);router[_0x27fe('0x22')](_0x27fe('0x17'),auth['isAuthenticated'](),controller[_0x27fe('0x23')]);router[_0x27fe('0x22')](_0x27fe('0xf'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x24')]);router[_0x27fe('0x22')](_0x27fe('0x11'),auth['isAuthenticated'](),controller[_0x27fe('0x25')]);module[_0x27fe('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index accd90d..35358a0 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 _0x70cb=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x1da8f5,_0xc052c4){var _0x2973a4=function(_0x260e37){while(--_0x260e37){_0x1da8f5['push'](_0x1da8f5['shift']());}};_0x2973a4(++_0xc052c4);}(_0x70cb,0x147));var _0xb70c=function(_0x2bb4a7,_0x4b087a){_0x2bb4a7=_0x2bb4a7-0x0;var _0x3ee323=_0x70cb[_0x2bb4a7];return _0x3ee323;};'use strict';var Sequelize=require(_0xb70c('0x0'));var rs=require(_0xb70c('0x1'));module[_0xb70c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xb70c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xb70c('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb70c('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xb70c('0x3')]},'type':{'type':Sequelize[_0xb70c('0x4')](_0xb70c('0x5'),_0xb70c('0x6'))},'accountSid':{'type':Sequelize[_0xb70c('0x3')]},'baseUrl':{'type':Sequelize[_0xb70c('0x3')]},'authToken':{'type':Sequelize[_0xb70c('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb70c('0x7');}},'notificationSound':{'type':Sequelize[_0xb70c('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb70c('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb70c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb70c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb70c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb70c('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb70c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb70c('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xb70c('0x8')],'defaultValue':![],'comment':_0xb70c('0xb'),'set':function(_0x3a557e){if(!_0x3a557e){this[_0xb70c('0xc')]('mandatoryDispositionPauseId',null);}this[_0xb70c('0xc')](_0xb70c('0xd'),_0x3a557e);}},'description':{'type':Sequelize[_0xb70c('0x3')]}}; \ No newline at end of file +var _0x2071=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2071,0xb1));var _0x1207=function(_0x3a175b,_0x505d13){_0x3a175b=_0x3a175b-0x0;var _0x9b84fa=_0x2071[_0x3a175b];return _0x9b84fa;};'use strict';var Sequelize=require(_0x1207('0x0'));var rs=require(_0x1207('0x1'));module[_0x1207('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x1207('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1207('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x1207('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1207('0x5')]();}},'phone':{'type':Sequelize[_0x1207('0x4')]},'type':{'type':Sequelize[_0x1207('0x6')]('twilio',_0x1207('0x7'))},'accountSid':{'type':Sequelize[_0x1207('0x4')]},'baseUrl':{'type':Sequelize[_0x1207('0x4')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x1207('0x8')],'defaultValue':function(){return _0x1207('0x9');}},'notificationSound':{'type':Sequelize[_0x1207('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1207('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1207('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1207('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1207('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1207('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1207('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x1207('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x1207('0xa')],'defaultValue':![],'comment':_0x1207('0xd'),'set':function(_0x2c2fb3){if(!_0x2c2fb3){this[_0x1207('0xe')](_0x1207('0xf'),null);}this[_0x1207('0xe')](_0x1207('0x10'),_0x2c2fb3);}},'description':{'type':Sequelize[_0x1207('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 5c6df61..3e80792 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 _0xfda3=['ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','WhatsappAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','params','destroy','describe','addDisposition','Disposition','getDispositions','findOne','fields','WhatsappAccountId','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','MessageSid','from','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','messageId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x3bf1db,_0x3bbc11){var _0x5c25ec=function(_0x39a6f8){while(--_0x39a6f8){_0x3bf1db['push'](_0x3bf1db['shift']());}};_0x5c25ec(++_0x3bbc11);}(_0xfda3,0x187));var _0x3fda=function(_0x5ebe63,_0x2956bc){_0x5ebe63=_0x5ebe63-0x0;var _0x1f91ee=_0xfda3[_0x5ebe63];return _0x1f91ee;};'use strict';var emlformat=require(_0x3fda('0x0'));var rimraf=require(_0x3fda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fda('0x2'));var rp=require('request-promise');var moment=require(_0x3fda('0x3'));var BPromise=require(_0x3fda('0x4'));var Mustache=require(_0x3fda('0x5'));var util=require(_0x3fda('0x6'));var path=require(_0x3fda('0x7'));var sox=require(_0x3fda('0x8'));var csv=require('to-csv');var ejs=require(_0x3fda('0x9'));var fs=require('fs');var fs_extra=require(_0x3fda('0xa'));var _=require(_0x3fda('0xb'));var squel=require('squel');var crypto=require(_0x3fda('0xc'));var jsforce=require(_0x3fda('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3fda('0xe'));var querystring=require('querystring');var Papa=require(_0x3fda('0xf'));var Redis=require(_0x3fda('0x10'));var authService=require(_0x3fda('0x11'));var qs=require(_0x3fda('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3fda('0x13'));var logger=require('../../config/logger')(_0x3fda('0x14'));var utils=require('../../config/utils');var config=require(_0x3fda('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fda('0x16'))['db'];config[_0x3fda('0x17')]=_[_0x3fda('0x18')](config[_0x3fda('0x17')],{'host':_0x3fda('0x19'),'port':0x18eb});var socket=require(_0x3fda('0x1a'))(new Redis(config['redis']));require(_0x3fda('0x1b'))[_0x3fda('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3fda('0x1d')][_0x3fda('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x373d4d,_0x2be5c4,_0x248cc9,_0x5b794f){return new BPromise(function(_0x29bf48,_0x3b88bc){var _0xa64524=_0x5b794f||client;return _0xa64524[_0x3fda('0x1f')](_0x373d4d,_0x248cc9)[_0x3fda('0x20')](function(_0xb10b15){logger[_0x3fda('0x21')](_0x3fda('0x22'),_0x2be5c4,_0x3fda('0x23'));logger[_0x3fda('0x24')](_0x3fda('0x25'),_0x2be5c4,_0x3fda('0x23'),JSON[_0x3fda('0x26')](_0xb10b15));if(_0xb10b15[_0x3fda('0x27')]){if(_0xb10b15[_0x3fda('0x27')][_0x3fda('0x28')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2be5c4,_0xb10b15[_0x3fda('0x27')][_0x3fda('0x29')]);return _0x3b88bc(_0xb10b15['error'][_0x3fda('0x29')]);}logger[_0x3fda('0x27')](_0x3fda('0x22'),_0x2be5c4,_0xb10b15[_0x3fda('0x27')][_0x3fda('0x29')]);return _0x29bf48(_0xb10b15['error'][_0x3fda('0x29')]);}else{logger[_0x3fda('0x21')](_0x3fda('0x22'),_0x2be5c4,_0x3fda('0x23'));_0x29bf48(_0xb10b15[_0x3fda('0x2a')][_0x3fda('0x29')]);}})[_0x3fda('0x2b')](function(_0xad88e1){logger[_0x3fda('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x2be5c4,_0xad88e1);_0x3b88bc(_0xad88e1);});});}function respondWithStatusCode(_0x5d32a5,_0x2020cf){_0x2020cf=_0x2020cf||0xcc;return function(_0x4618a){if(_0x4618a){return _0x5d32a5[_0x3fda('0x2c')](_0x2020cf);}return _0x5d32a5['status'](_0x2020cf)[_0x3fda('0x2d')]();};}function respondWithResult(_0x53cb3f,_0x4beace){_0x4beace=_0x4beace||0xc8;return function(_0x1e9ac8){if(_0x1e9ac8){return _0x53cb3f[_0x3fda('0x2e')](_0x4beace)[_0x3fda('0x2f')](_0x1e9ac8);}};}function respondWithFilteredResult(_0x3bcc34,_0x2581cd){return function(_0x49f2a4){if(_0x49f2a4){var _0x5df4c3=typeof _0x2581cd[_0x3fda('0x30')]===_0x3fda('0x31')&&typeof _0x2581cd[_0x3fda('0x32')]===_0x3fda('0x31');var _0x2e128f=_0x49f2a4[_0x3fda('0x33')];var _0x5063d9=_0x5df4c3?0x0:_0x2581cd[_0x3fda('0x30')];var _0x2a5448=_0x5df4c3?_0x49f2a4[_0x3fda('0x33')]:_0x2581cd['offset']+_0x2581cd[_0x3fda('0x32')];var _0x5b87f1;if(_0x2a5448>=_0x2e128f){_0x2a5448=_0x2e128f;_0x5b87f1=0xc8;}else{_0x5b87f1=0xce;}_0x3bcc34[_0x3fda('0x2e')](_0x5b87f1);return _0x3bcc34[_0x3fda('0x34')](_0x3fda('0x35'),_0x5063d9+'-'+_0x2a5448+'/'+_0x2e128f)[_0x3fda('0x2f')](_0x49f2a4);}return null;};}function patchUpdates(_0x35704b){return function(_0xd132d2){try{jsonpatch['apply'](_0xd132d2,_0x35704b,!![]);}catch(_0x5b9b75){return BPromise[_0x3fda('0x36')](_0x5b9b75);}return _0xd132d2[_0x3fda('0x37')]();};}function saveUpdates(_0x1db72e,_0x67d770){return function(_0x3b3561){if(_0x3b3561){return _0x3b3561[_0x3fda('0x38')](_0x1db72e)[_0x3fda('0x20')](function(_0x29b462){return _0x29b462;});}return null;};}function removeEntity(_0x22e9af,_0x40154c){return function(_0x4183ae){if(_0x4183ae){return _0x4183ae['destroy']()[_0x3fda('0x20')](function(){var _0x2c0c4d=_0x4183ae[_0x3fda('0x39')]({'plain':!![]});var _0x38e812=_0x3fda('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x38e812,'resourceId':_0x2c0c4d['id']}})[_0x3fda('0x20')](function(){return _0x4183ae;});})[_0x3fda('0x20')](function(){_0x22e9af[_0x3fda('0x2e')](0xcc)[_0x3fda('0x2d')]();});}};}function handleEntityNotFound(_0x5d7fb8,_0x345b56){return function(_0x5e84ac){if(!_0x5e84ac){_0x5d7fb8[_0x3fda('0x2c')](0x194);}return _0x5e84ac;};}function handleError(_0x5cb60a,_0x39c168){_0x39c168=_0x39c168||0x1f4;return function(_0x470199){logger[_0x3fda('0x27')](_0x470199[_0x3fda('0x3b')]);if(_0x470199[_0x3fda('0x3c')]){delete _0x470199[_0x3fda('0x3c')];}_0x5cb60a[_0x3fda('0x2e')](_0x39c168)[_0x3fda('0x3d')](_0x470199);};}exports[_0x3fda('0x3e')]=function(_0x58b9db,_0x5d2f04){var _0x3a6ded={'include':[{'model':db[_0x3fda('0x3f')],'as':_0x3fda('0x40')}]},_0x31f59e={},_0x3036ae={'count':0x0,'rows':[]};var _0x43a4fa=_[_0x3fda('0x41')](db[_0x3fda('0x42')]['rawAttributes'],function(_0x50e218){return{'name':_0x50e218[_0x3fda('0x43')],'type':_0x50e218[_0x3fda('0x44')]['key']};});_0x31f59e[_0x3fda('0x45')]=_[_0x3fda('0x41')](_0x43a4fa,'name');_0x31f59e[_0x3fda('0x46')]=_[_0x3fda('0x47')](_0x58b9db[_0x3fda('0x46')]);_0x31f59e[_0x3fda('0x48')]=_[_0x3fda('0x49')](_0x31f59e[_0x3fda('0x45')],_0x31f59e['query']);_0x3a6ded[_0x3fda('0x4a')]=_['intersection'](_0x31f59e[_0x3fda('0x45')],qs['fields'](_0x58b9db[_0x3fda('0x46')]['fields']));_0x3a6ded['attributes']=_0x3a6ded[_0x3fda('0x4a')][_0x3fda('0x4b')]?_0x3a6ded[_0x3fda('0x4a')]:_0x31f59e['model'];if(!_0x58b9db[_0x3fda('0x46')][_0x3fda('0x4c')](_0x3fda('0x4d'))){_0x3a6ded[_0x3fda('0x32')]=qs[_0x3fda('0x32')](_0x58b9db[_0x3fda('0x46')]['limit']);_0x3a6ded[_0x3fda('0x30')]=qs['offset'](_0x58b9db[_0x3fda('0x46')][_0x3fda('0x30')]);}_0x3a6ded[_0x3fda('0x4e')]=qs[_0x3fda('0x4f')](_0x58b9db[_0x3fda('0x46')]['sort']);_0x3a6ded[_0x3fda('0x50')]=qs['filters'](_[_0x3fda('0x51')](_0x58b9db[_0x3fda('0x46')],_0x31f59e[_0x3fda('0x48')]),_0x43a4fa);if(_0x58b9db[_0x3fda('0x46')]['filter']){_0x3a6ded[_0x3fda('0x50')]=_[_0x3fda('0x52')](_0x3a6ded[_0x3fda('0x50')],{'$or':_[_0x3fda('0x41')](_0x43a4fa,function(_0xe29a7f){if(_0xe29a7f[_0x3fda('0x44')]!==_0x3fda('0x53')){var _0x11a54c={};_0x11a54c[_0xe29a7f[_0x3fda('0x3c')]]={'$like':'%'+_0x58b9db[_0x3fda('0x46')][_0x3fda('0x54')]+'%'};return _0x11a54c;}})});}_0x3a6ded=_['merge']({},_0x3a6ded,_0x58b9db['options']);var _0x4d3530={'where':_0x3a6ded[_0x3fda('0x50')]};return db['WhatsappAccount'][_0x3fda('0x33')](_0x4d3530)['then'](function(_0x2b8e37){_0x3036ae[_0x3fda('0x33')]=_0x2b8e37;if(_0x58b9db[_0x3fda('0x46')][_0x3fda('0x55')]){_0x3a6ded['include']=[{'all':!![]}];}return db[_0x3fda('0x42')][_0x3fda('0x56')](_0x3a6ded);})[_0x3fda('0x20')](function(_0x397f3e){_0x3036ae[_0x3fda('0x57')]=_0x397f3e;return _0x3036ae;})['then'](respondWithFilteredResult(_0x5d2f04,_0x3a6ded))[_0x3fda('0x2b')](handleError(_0x5d2f04,null));};exports[_0x3fda('0x58')]=function(_0x1b2e3d,_0x4adfd3){var _0x4241af={'raw':![],'where':{'id':_0x1b2e3d['params']['id']},'include':[{'model':db[_0x3fda('0x3f')],'as':_0x3fda('0x40')}]},_0x216d2c={};_0x216d2c['model']=_[_0x3fda('0x47')](db[_0x3fda('0x42')][_0x3fda('0x59')]);_0x216d2c['query']=_[_0x3fda('0x47')](_0x1b2e3d[_0x3fda('0x46')]);_0x216d2c['filters']=_['intersection'](_0x216d2c[_0x3fda('0x45')],_0x216d2c[_0x3fda('0x46')]);_0x4241af[_0x3fda('0x4a')]=_['intersection'](_0x216d2c['model'],qs['fields'](_0x1b2e3d['query']['fields']));_0x4241af['attributes']=_0x4241af[_0x3fda('0x4a')]['length']?_0x4241af[_0x3fda('0x4a')]:_0x216d2c[_0x3fda('0x45')];if(_0x1b2e3d[_0x3fda('0x46')][_0x3fda('0x55')]){_0x4241af['include']=[{'all':!![]}];}_0x4241af=_['merge']({},_0x4241af,_0x1b2e3d['options']);return db[_0x3fda('0x42')][_0x3fda('0x5a')](_0x4241af)['then'](handleEntityNotFound(_0x4adfd3,null))[_0x3fda('0x20')](respondWithResult(_0x4adfd3,null))['catch'](handleError(_0x4adfd3,null));};exports[_0x3fda('0x5b')]=function(_0x4a8416,_0x4c55b5){return db[_0x3fda('0x42')][_0x3fda('0x5b')](_0x4a8416[_0x3fda('0x5c')],{})[_0x3fda('0x20')](function(_0x217664){var _0x5a12eb=_0x4a8416[_0x3fda('0x5d')][_0x3fda('0x39')]({'plain':!![]});if(!_0x5a12eb)throw new Error(_0x3fda('0x5e'));if(_0x5a12eb['role']===_0x3fda('0x5d')){var _0x3493e1=_0x217664['get']({'plain':!![]});var _0x5ec8fd=_0x3fda('0x3a');return db[_0x3fda('0x5f')][_0x3fda('0x5a')]({'where':{'name':_0x5ec8fd,'userProfileId':_0x5a12eb[_0x3fda('0x60')]},'raw':!![]})['then'](function(_0x248de3){if(_0x248de3&&_0x248de3['autoAssociation']===0x0){return db['UserProfileResource'][_0x3fda('0x5b')]({'name':_0x3493e1[_0x3fda('0x3c')],'resourceId':_0x3493e1['id'],'type':_0x248de3[_0x3fda('0x3c')],'sectionId':_0x248de3['id']},{})[_0x3fda('0x20')](function(){return _0x217664;});}else{return _0x217664;}})[_0x3fda('0x2b')](function(_0x359568){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x359568);throw _0x359568;});}return _0x217664;})['then'](respondWithResult(_0x4c55b5,0xc9))[_0x3fda('0x2b')](handleError(_0x4c55b5,null));};exports[_0x3fda('0x38')]=function(_0x5c8c75,_0x4e20e4){if(_0x5c8c75[_0x3fda('0x5c')]['id']){delete _0x5c8c75['body']['id'];}return db[_0x3fda('0x42')][_0x3fda('0x5a')]({'where':{'id':_0x5c8c75[_0x3fda('0x61')]['id']},'include':[{'model':db[_0x3fda('0x3f')],'as':_0x3fda('0x40')}]})[_0x3fda('0x20')](handleEntityNotFound(_0x4e20e4,null))[_0x3fda('0x20')](saveUpdates(_0x5c8c75[_0x3fda('0x5c')],null))[_0x3fda('0x20')](respondWithResult(_0x4e20e4,null))[_0x3fda('0x2b')](handleError(_0x4e20e4,null));};exports[_0x3fda('0x62')]=function(_0x2e7699,_0x58992e){return db['WhatsappAccount'][_0x3fda('0x5a')]({'where':{'id':_0x2e7699[_0x3fda('0x61')]['id']}})[_0x3fda('0x20')](handleEntityNotFound(_0x58992e,null))[_0x3fda('0x20')](removeEntity(_0x58992e,null))[_0x3fda('0x2b')](handleError(_0x58992e,null));};exports[_0x3fda('0x63')]=function(_0xff9ab9,_0x1f7a0b){return db['WhatsappAccount']['describe']()['then'](respondWithResult(_0x1f7a0b,null))[_0x3fda('0x2b')](handleError(_0x1f7a0b,null));};exports[_0x3fda('0x64')]=function(_0x3454dc,_0x3b99d6,_0x45def3){if(_0x3454dc['body']['id']){delete _0x3454dc['body']['id'];}return db[_0x3fda('0x42')][_0x3fda('0x5a')]({'where':{'id':_0x3454dc['params']['id']}})['then'](handleEntityNotFound(_0x3b99d6,null))[_0x3fda('0x20')](function(_0x33a724){if(_0x33a724){_0x3454dc[_0x3fda('0x5c')]['WhatsappAccountId']=_0x33a724['id'];return db[_0x3fda('0x65')][_0x3fda('0x5b')](_0x3454dc['body']);}})[_0x3fda('0x20')](respondWithResult(_0x3b99d6,null))[_0x3fda('0x2b')](handleError(_0x3b99d6,null));};exports[_0x3fda('0x66')]=function(_0x1bfdfe,_0x48355c,_0x94a727){var _0x3b9bd5={'raw':![],'where':{}};var _0x43a658={};var _0x437aa6={'count':0x0,'rows':[]};return db[_0x3fda('0x42')][_0x3fda('0x67')]({'where':{'id':_0x1bfdfe['params']['id']}})[_0x3fda('0x20')](handleEntityNotFound(_0x48355c,null))[_0x3fda('0x20')](function(_0x69e9da){if(_0x69e9da){_0x43a658['model']=_['keys'](db[_0x3fda('0x65')][_0x3fda('0x59')]);_0x43a658['query']=_['keys'](_0x1bfdfe[_0x3fda('0x46')]);_0x43a658['filters']=_['intersection'](_0x43a658[_0x3fda('0x45')],_0x43a658[_0x3fda('0x46')]);_0x3b9bd5['attributes']=_[_0x3fda('0x49')](_0x43a658[_0x3fda('0x45')],qs[_0x3fda('0x68')](_0x1bfdfe[_0x3fda('0x46')]['fields']));_0x3b9bd5[_0x3fda('0x4a')]=_0x3b9bd5[_0x3fda('0x4a')]['length']?_0x3b9bd5[_0x3fda('0x4a')]:_0x43a658[_0x3fda('0x45')];if(!_0x1bfdfe[_0x3fda('0x46')]['hasOwnProperty'](_0x3fda('0x4d'))){_0x3b9bd5[_0x3fda('0x32')]=qs['limit'](_0x1bfdfe['query'][_0x3fda('0x32')]);_0x3b9bd5[_0x3fda('0x30')]=qs[_0x3fda('0x30')](_0x1bfdfe[_0x3fda('0x46')]['offset']);}_0x3b9bd5[_0x3fda('0x4e')]=qs[_0x3fda('0x4f')](_0x1bfdfe[_0x3fda('0x46')]['sort']);_0x3b9bd5[_0x3fda('0x50')]=qs[_0x3fda('0x48')](_[_0x3fda('0x51')](_0x1bfdfe[_0x3fda('0x46')],_0x43a658[_0x3fda('0x48')]));_0x3b9bd5[_0x3fda('0x50')][_0x3fda('0x69')]=_0x69e9da['id'];if(_0x1bfdfe[_0x3fda('0x46')][_0x3fda('0x54')]){_0x3b9bd5[_0x3fda('0x50')]=_['merge'](_0x3b9bd5[_0x3fda('0x50')],{'$or':_[_0x3fda('0x41')](_0x3b9bd5['attributes'],function(_0x36a26e){var _0x15f1e7={};_0x15f1e7[_0x36a26e]={'$like':'%'+_0x1bfdfe['query'][_0x3fda('0x54')]+'%'};return _0x15f1e7;})});}_0x3b9bd5=_[_0x3fda('0x52')]({},_0x3b9bd5,_0x1bfdfe[_0x3fda('0x6a')]);return db['Disposition']['count']({'where':_0x3b9bd5['where']})['then'](function(_0x35703b){_0x437aa6[_0x3fda('0x33')]=_0x35703b;if(_0x1bfdfe[_0x3fda('0x46')][_0x3fda('0x55')]){_0x3b9bd5['include']=[{'all':!![]}];}return db['Disposition'][_0x3fda('0x56')](_0x3b9bd5);})[_0x3fda('0x20')](function(_0x4f26a6){_0x437aa6[_0x3fda('0x57')]=_0x4f26a6;return _0x437aa6;});}})[_0x3fda('0x20')](respondWithFilteredResult(_0x48355c,_0x3b9bd5))[_0x3fda('0x2b')](handleError(_0x48355c,null));};exports['removeDispositions']=function(_0x448eab,_0x2e81d2,_0x5e95d0){return db[_0x3fda('0x42')]['find']({'where':{'id':_0x448eab['params']['id']}})[_0x3fda('0x20')](handleEntityNotFound(_0x2e81d2,null))[_0x3fda('0x20')](function(_0x91a7fe){if(_0x91a7fe){return _0x91a7fe[_0x3fda('0x6b')](_0x448eab[_0x3fda('0x46')][_0x3fda('0x6c')]);}})[_0x3fda('0x20')](respondWithStatusCode(_0x2e81d2,null))[_0x3fda('0x2b')](handleError(_0x2e81d2,null));};exports[_0x3fda('0x6d')]=function(_0x4ba4f5,_0xc3dd5f,_0x4b1a4e){if(_0x4ba4f5[_0x3fda('0x5c')]['id']){delete _0x4ba4f5['body']['id'];}return db[_0x3fda('0x42')][_0x3fda('0x5a')]({'where':{'id':_0x4ba4f5[_0x3fda('0x61')]['id']}})[_0x3fda('0x20')](handleEntityNotFound(_0xc3dd5f,null))[_0x3fda('0x20')](function(_0x52ea2a){if(_0x52ea2a){_0x4ba4f5[_0x3fda('0x5c')][_0x3fda('0x69')]=_0x52ea2a['id'];return db[_0x3fda('0x6e')]['create'](_0x4ba4f5[_0x3fda('0x5c')]);}})[_0x3fda('0x20')](respondWithResult(_0xc3dd5f,null))[_0x3fda('0x2b')](handleError(_0xc3dd5f,null));};exports[_0x3fda('0x6f')]=function(_0x3c910e,_0x3faa6a,_0x31ef20){var _0x145dc8={'raw':![],'where':{}};var _0x3660be={};var _0x31d246={'count':0x0,'rows':[]};return db[_0x3fda('0x42')][_0x3fda('0x67')]({'where':{'id':_0x3c910e[_0x3fda('0x61')]['id']}})[_0x3fda('0x20')](handleEntityNotFound(_0x3faa6a,null))['then'](function(_0x1da0a4){if(_0x1da0a4){_0x3660be[_0x3fda('0x45')]=_[_0x3fda('0x47')](db[_0x3fda('0x6e')][_0x3fda('0x59')]);_0x3660be['query']=_[_0x3fda('0x47')](_0x3c910e[_0x3fda('0x46')]);_0x3660be[_0x3fda('0x48')]=_[_0x3fda('0x49')](_0x3660be[_0x3fda('0x45')],_0x3660be[_0x3fda('0x46')]);_0x145dc8[_0x3fda('0x4a')]=_[_0x3fda('0x49')](_0x3660be[_0x3fda('0x45')],qs[_0x3fda('0x68')](_0x3c910e[_0x3fda('0x46')][_0x3fda('0x68')]));_0x145dc8['attributes']=_0x145dc8[_0x3fda('0x4a')][_0x3fda('0x4b')]?_0x145dc8['attributes']:_0x3660be[_0x3fda('0x45')];if(!_0x3c910e['query'][_0x3fda('0x4c')](_0x3fda('0x4d'))){_0x145dc8[_0x3fda('0x32')]=qs[_0x3fda('0x32')](_0x3c910e['query'][_0x3fda('0x32')]);_0x145dc8[_0x3fda('0x30')]=qs[_0x3fda('0x30')](_0x3c910e['query'][_0x3fda('0x30')]);}_0x145dc8['order']=qs[_0x3fda('0x4f')](_0x3c910e[_0x3fda('0x46')][_0x3fda('0x4f')]);_0x145dc8['where']=qs[_0x3fda('0x48')](_[_0x3fda('0x51')](_0x3c910e[_0x3fda('0x46')],_0x3660be[_0x3fda('0x48')]));_0x145dc8[_0x3fda('0x50')][_0x3fda('0x69')]=_0x1da0a4['id'];if(_0x3c910e[_0x3fda('0x46')][_0x3fda('0x54')]){_0x145dc8[_0x3fda('0x50')]=_[_0x3fda('0x52')](_0x145dc8['where'],{'$or':_[_0x3fda('0x41')](_0x145dc8[_0x3fda('0x4a')],function(_0x615d8b){var _0x1129e7={};_0x1129e7[_0x615d8b]={'$like':'%'+_0x3c910e[_0x3fda('0x46')][_0x3fda('0x54')]+'%'};return _0x1129e7;})});}_0x145dc8=_[_0x3fda('0x52')]({},_0x145dc8,_0x3c910e[_0x3fda('0x6a')]);return db[_0x3fda('0x6e')][_0x3fda('0x33')]({'where':_0x145dc8[_0x3fda('0x50')]})[_0x3fda('0x20')](function(_0xf1eb06){_0x31d246[_0x3fda('0x33')]=_0xf1eb06;if(_0x3c910e[_0x3fda('0x46')][_0x3fda('0x55')]){_0x145dc8['include']=[{'all':!![]}];}return db[_0x3fda('0x6e')][_0x3fda('0x56')](_0x145dc8);})[_0x3fda('0x20')](function(_0x1c5627){_0x31d246[_0x3fda('0x57')]=_0x1c5627;return _0x31d246;});}})[_0x3fda('0x20')](respondWithFilteredResult(_0x3faa6a,_0x145dc8))[_0x3fda('0x2b')](handleError(_0x3faa6a,null));};exports[_0x3fda('0x70')]=function(_0x31452d,_0x1dad31,_0x2e5d39){return db[_0x3fda('0x42')][_0x3fda('0x5a')]({'where':{'id':_0x31452d[_0x3fda('0x61')]['id']}})[_0x3fda('0x20')](handleEntityNotFound(_0x1dad31,null))['then'](function(_0x22882b){if(_0x22882b){return _0x22882b['removeAnswers'](_0x31452d[_0x3fda('0x46')]['ids']);}})[_0x3fda('0x20')](respondWithStatusCode(_0x1dad31,null))[_0x3fda('0x2b')](handleError(_0x1dad31,null));};exports[_0x3fda('0x71')]=function(_0x2a064e,_0x101340,_0x4877d9){return db['WhatsappAccount']['find']({'where':{'id':_0x2a064e[_0x3fda('0x61')]['id']}})[_0x3fda('0x20')](handleEntityNotFound(_0x101340,null))[_0x3fda('0x20')](function(_0x2ca17d){if(_0x2ca17d){return _0x2ca17d['addAgents'](_0x2a064e[_0x3fda('0x5c')][_0x3fda('0x6c')],_[_0x3fda('0x72')](_0x2a064e[_0x3fda('0x5c')],[_0x3fda('0x6c'),'id'])||{})[_0x3fda('0x73')](function(_0x53f32a){for(var _0x15ec98=0x0;_0x15ec98<_0x2a064e['body']['ids'][_0x3fda('0x4b')];_0x15ec98+=0x1){socket[_0x3fda('0x74')](_0x3fda('0x75'),{'UserId':Number(_0x2a064e['body']['ids'][_0x15ec98]),'WhatsappAccountId':Number(_0x2a064e[_0x3fda('0x61')]['id'])});}return _0x53f32a;});}})[_0x3fda('0x20')](respondWithResult(_0x101340,null))['catch'](handleError(_0x101340,null));};exports[_0x3fda('0x76')]=function(_0x59d12f,_0x165bc8,_0x443b6e){return db['WhatsappAccount']['find']({'where':{'id':_0x59d12f[_0x3fda('0x61')]['id']}})['then'](handleEntityNotFound(_0x165bc8,null))[_0x3fda('0x20')](function(_0x25d6fd){if(_0x25d6fd){return _0x25d6fd[_0x3fda('0x76')](_0x59d12f[_0x3fda('0x46')][_0x3fda('0x6c')])['then'](function(){if(_[_0x3fda('0x77')](_0x59d12f[_0x3fda('0x46')][_0x3fda('0x6c')])){for(var _0x241722=0x0;_0x241722<_0x59d12f[_0x3fda('0x46')]['ids'][_0x3fda('0x4b')];_0x241722+=0x1){socket[_0x3fda('0x74')](_0x3fda('0x78'),{'UserId':Number(_0x59d12f['query'][_0x3fda('0x6c')][_0x241722]),'WhatsappAccountId':Number(_0x59d12f[_0x3fda('0x61')]['id'])});}}else{socket[_0x3fda('0x74')](_0x3fda('0x78'),{'UserId':Number(_0x59d12f[_0x3fda('0x46')][_0x3fda('0x6c')]),'WhatsappAccountId':Number(_0x59d12f[_0x3fda('0x61')]['id'])});}});}})[_0x3fda('0x20')](respondWithStatusCode(_0x165bc8,null))['catch'](handleError(_0x165bc8,null));};exports[_0x3fda('0x79')]=function(_0x181709,_0x1bc635,_0x9c61f9){var _0x29a028={};var _0x2e6fdc={};var _0x2a360e;var _0xbe0134;return db[_0x3fda('0x42')][_0x3fda('0x67')]({'where':{'id':_0x181709[_0x3fda('0x61')]['id']}})[_0x3fda('0x20')](handleEntityNotFound(_0x1bc635,null))['then'](function(_0x482088){if(_0x482088){_0x2a360e=_0x482088;_0x2e6fdc[_0x3fda('0x45')]=_['keys'](db['User'][_0x3fda('0x59')]);_0x2e6fdc[_0x3fda('0x46')]=_[_0x3fda('0x47')](_0x181709[_0x3fda('0x46')]);_0x2e6fdc[_0x3fda('0x48')]=_[_0x3fda('0x49')](_0x2e6fdc[_0x3fda('0x45')],_0x2e6fdc['query']);_0x29a028[_0x3fda('0x4a')]=_['intersection'](_0x2e6fdc[_0x3fda('0x45')],qs[_0x3fda('0x68')](_0x181709[_0x3fda('0x46')]['fields']));_0x29a028[_0x3fda('0x4a')]=_0x29a028[_0x3fda('0x4a')][_0x3fda('0x4b')]?_0x29a028[_0x3fda('0x4a')]:_0x2e6fdc[_0x3fda('0x45')];_0x29a028['order']=qs[_0x3fda('0x4f')](_0x181709[_0x3fda('0x46')][_0x3fda('0x4f')]);_0x29a028[_0x3fda('0x50')]=qs[_0x3fda('0x48')](_[_0x3fda('0x51')](_0x181709[_0x3fda('0x46')],_0x2e6fdc[_0x3fda('0x48')]));if(_0x181709[_0x3fda('0x46')][_0x3fda('0x54')]){_0x29a028['where']=_[_0x3fda('0x52')](_0x29a028[_0x3fda('0x50')],{'$or':_[_0x3fda('0x41')](_0x29a028['attributes'],function(_0x35ea9f){var _0x22d44e={};_0x22d44e[_0x35ea9f]={'$like':'%'+_0x181709[_0x3fda('0x46')]['filter']+'%'};return _0x22d44e;})});}_0x29a028=_[_0x3fda('0x52')]({},_0x29a028,_0x181709[_0x3fda('0x6a')]);return _0x2a360e[_0x3fda('0x79')](_0x29a028);}})[_0x3fda('0x20')](function(_0x28766e){if(_0x28766e){_0xbe0134=_0x28766e[_0x3fda('0x4b')];if(!_0x181709['query'][_0x3fda('0x4c')](_0x3fda('0x4d'))){_0x29a028[_0x3fda('0x32')]=qs[_0x3fda('0x32')](_0x181709['query'][_0x3fda('0x32')]);_0x29a028['offset']=qs['offset'](_0x181709[_0x3fda('0x46')][_0x3fda('0x30')]);}return _0x2a360e[_0x3fda('0x79')](_0x29a028);}})[_0x3fda('0x20')](function(_0x1b081c){if(_0x1b081c){return _0x1b081c?{'count':_0xbe0134,'rows':_0x1b081c}:null;}})['then'](respondWithResult(_0x1bc635,null))[_0x3fda('0x2b')](handleError(_0x1bc635,null));};exports[_0x3fda('0x7a')]=function(_0x43cfea,_0x42bf24){var _0x1b12a0=_0x43cfea[_0x3fda('0x61')]['id'];var _0x97fe0c=_0x43cfea[_0x3fda('0x5c')];var _0x401d31=0xc8;var _0x191812=null;return db[_0x3fda('0x7b')][_0x3fda('0x7c')]({'isolationLevel':db[_0x3fda('0x7b')][_0x3fda('0x7d')][_0x3fda('0x7e')][_0x3fda('0x7f')]},function(_0x10d83b){return db[_0x3fda('0x42')][_0x3fda('0x67')]({'where':{'id':_0x1b12a0},'transaction':_0x10d83b})[_0x3fda('0x20')](function(_0x2284ab){if(_0x2284ab){return db['WhatsappApplication'][_0x3fda('0x62')]({'where':{'WhatsappAccountId':_0x1b12a0},'transaction':_0x10d83b})[_0x3fda('0x20')](function(){var _0x5c4584=_[_0x3fda('0x41')](_0x97fe0c,function(_0x2ae625){_0x2ae625[_0x3fda('0x69')]=_0x1b12a0;return _0x2ae625;});return db[_0x3fda('0x80')][_0x3fda('0x81')](_0x5c4584,{'transaction':_0x10d83b});});}else{_0x401d31=0x194;_0x191812=[];}});})[_0x3fda('0x20')](function(){if(_0x401d31!==0x194){return db['WhatsappApplication'][_0x3fda('0x82')]({'where':{'WhatsappAccountId':_0x1b12a0},'order':_0x3fda('0x83')})[_0x3fda('0x20')](function(_0x18b2a0){_0x191812=_0x18b2a0;});}})[_0x3fda('0x2b')](function(_0x5bf697){_0x401d31=0x1f4;logger['error'](_0x5bf697[_0x3fda('0x3b')]);if(_0x5bf697['name']){delete _0x5bf697[_0x3fda('0x3c')];}_0x191812=_0x5bf697;})[_0x3fda('0x84')](function(){if(_0x191812===null){_0x42bf24['sendStatus'](_0x401d31);}else{if(_0x401d31===0x1f4){_0x42bf24[_0x3fda('0x2e')](_0x401d31)[_0x3fda('0x3d')](_0x191812);}else{_0x42bf24[_0x3fda('0x2e')](_0x401d31)[_0x3fda('0x2f')](_0x191812);}}});};exports[_0x3fda('0x85')]=function(_0x291014,_0x640dcd,_0x252433){var _0x57e087={};var _0x3d0f86={};var _0x416fee;var _0xd65642;return db[_0x3fda('0x42')][_0x3fda('0x67')]({'where':{'id':_0x291014[_0x3fda('0x61')]['id']}})[_0x3fda('0x20')](handleEntityNotFound(_0x640dcd,null))['then'](function(_0x5f4386){if(_0x5f4386){_0x416fee=_0x5f4386;_0x3d0f86[_0x3fda('0x45')]=_[_0x3fda('0x47')](db['WhatsappApplication'][_0x3fda('0x59')]);_0x3d0f86[_0x3fda('0x46')]=_['keys'](_0x291014[_0x3fda('0x46')]);_0x3d0f86[_0x3fda('0x48')]=_[_0x3fda('0x49')](_0x3d0f86['model'],_0x3d0f86[_0x3fda('0x46')]);_0x57e087['attributes']=_[_0x3fda('0x49')](_0x3d0f86['model'],qs[_0x3fda('0x68')](_0x291014[_0x3fda('0x46')][_0x3fda('0x68')]));_0x57e087[_0x3fda('0x4a')]=_0x57e087[_0x3fda('0x4a')][_0x3fda('0x4b')]?_0x57e087[_0x3fda('0x4a')]:_0x3d0f86[_0x3fda('0x45')];_0x57e087[_0x3fda('0x4e')]=qs[_0x3fda('0x4f')](_0x291014[_0x3fda('0x46')][_0x3fda('0x4f')]);_0x57e087['where']=qs[_0x3fda('0x48')](_[_0x3fda('0x51')](_0x291014['query'],_0x3d0f86[_0x3fda('0x48')]));if(_0x291014[_0x3fda('0x46')][_0x3fda('0x54')]){_0x57e087['where']=_[_0x3fda('0x52')](_0x57e087[_0x3fda('0x50')],{'$or':_[_0x3fda('0x41')](_0x57e087[_0x3fda('0x4a')],function(_0x4b70ac){var _0x56e5fc={};_0x56e5fc[_0x4b70ac]={'$like':'%'+_0x291014[_0x3fda('0x46')][_0x3fda('0x54')]+'%'};return _0x56e5fc;})});}_0x57e087=_[_0x3fda('0x52')]({},_0x57e087,_0x291014['options']);return _0x416fee[_0x3fda('0x85')](_0x57e087);}})[_0x3fda('0x20')](function(_0xcb5531){if(_0xcb5531){_0xd65642=_0xcb5531[_0x3fda('0x4b')];if(!_0x291014[_0x3fda('0x46')][_0x3fda('0x4c')](_0x3fda('0x4d'))){_0x57e087[_0x3fda('0x32')]=qs['limit'](_0x291014[_0x3fda('0x46')]['limit']);_0x57e087[_0x3fda('0x30')]=qs['offset'](_0x291014[_0x3fda('0x46')]['offset']);}return _0x416fee[_0x3fda('0x85')](_0x57e087);}})[_0x3fda('0x20')](function(_0x18fac7){if(_0x18fac7){return _0x18fac7?{'count':_0xd65642,'rows':_0x18fac7}:null;}})['then'](respondWithResult(_0x640dcd,null))[_0x3fda('0x2b')](handleError(_0x640dcd,null));};exports[_0x3fda('0x86')]=function(_0x4d1cac,_0x56782c,_0x321e4d){var _0x518289={'channel':_0x3fda('0x87')};var _0x1dee7e=[];var _0x320bb9=[];var _0x5b9c80={};return db[_0x3fda('0x42')][_0x3fda('0x5a')]({'where':{'id':_0x4d1cac[_0x3fda('0x61')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x3fda('0x88')}]})['then'](handleEntityNotFound(_0x56782c,null))['then'](function(_0x407cbf){_0x518289['account']=_0x407cbf;if(_0x518289[_0x3fda('0x89')]&&_0x518289[_0x3fda('0x89')][_0x3fda('0x44')]===_0x3fda('0x8a')&&_0x4d1cac[_0x3fda('0x5c')][_0x3fda('0x8b')]){if(_0x4d1cac['body']['statuses']['length']===0x0)return;if(_0x4d1cac[_0x3fda('0x5c')][_0x3fda('0x8b')][0x0][_0x3fda('0x8c')]!==_0x3fda('0x8d'))return;return db[_0x3fda('0x8e')][_0x3fda('0x38')]({'read':!![],'readAt':_0x4d1cac[_0x3fda('0x5c')][_0x3fda('0x8b')][0x0][_0x3fda('0x8f')]},{'where':{'messageId':_0x4d1cac[_0x3fda('0x5c')][_0x3fda('0x8b')][0x0][_0x3fda('0x90')]},'individualHooks':!![]})['then'](function(_0x3a48a8){return _0x56782c[_0x3fda('0x2e')](0xc8)['json'](_0x3a48a8);});}_0x518289[_0x3fda('0x91')]=_[_0x3fda('0x92')](_0x407cbf[_0x3fda('0x88')],[_0x3fda('0x83')],['asc']);if(_0x518289[_0x3fda('0x89')]['Applications']){delete _0x518289[_0x3fda('0x89')][_0x3fda('0x88')];}return db[_0x3fda('0x93')][_0x3fda('0x63')]()[_0x3fda('0x20')](function(_0x530c16){if(!_0x530c16){throw new db[(_0x3fda('0x94'))][(_0x3fda('0x95'))]('no\x20available\x20attributes');}_0x1dee7e=_[_0x3fda('0x96')](_['keys'](_0x530c16),[_0x3fda('0x97'),_0x3fda('0x98')]);_0x320bb9=_[_0x3fda('0x96')](_[_0x3fda('0x47')](_0x530c16),['createdAt',_0x3fda('0x98'),_0x3fda('0x99'),_0x3fda('0x9a')]);_0x518289[_0x3fda('0x5c')]={'mapKey':_0x3fda('0x9b')};if(_0x518289[_0x3fda('0x89')]&&_0x518289[_0x3fda('0x89')]['type']===_0x3fda('0x9c')){_0x518289[_0x3fda('0x5c')]['from']=_0x4d1cac[_0x3fda('0x5c')][_0x3fda('0x9d')][_0x3fda('0x9e')](_0x3fda('0x9f'),'');_0x518289[_0x3fda('0x5c')][_0x3fda('0x5c')]=_0x4d1cac[_0x3fda('0x5c')][_0x3fda('0xa0')];_0x518289[_0x3fda('0x5c')]['messageId']=_0x4d1cac[_0x3fda('0x5c')][_0x3fda('0xa1')];}if(_0x518289[_0x3fda('0x89')]&&_0x518289[_0x3fda('0x89')]['type']===_0x3fda('0x8a')){_0x518289['body'][_0x3fda('0xa2')]=_0x4d1cac[_0x3fda('0x5c')]['notifications'][0x0]['from'];_0x518289[_0x3fda('0x5c')][_0x3fda('0x5c')]=_0x4d1cac[_0x3fda('0x5c')][_0x3fda('0xa3')][0x0][_0x3fda('0x29')][_0x3fda('0x5c')];_0x518289[_0x3fda('0x5c')]['messageId']=_0x4d1cac['body'][_0x3fda('0xa3')][0x0][_0x3fda('0x90')];}if(_0x518289[_0x3fda('0x5c')]['id']){delete _0x518289[_0x3fda('0x5c')]['id'];}if(_[_0x3fda('0xa4')](_0x518289['body'][_0x3fda('0xa2')])){throw new db[(_0x3fda('0x94'))][(_0x3fda('0x95'))]('from\x20is\x20mandatory');}if(_[_0x3fda('0xa4')](_0x518289[_0x3fda('0x5c')][_0x3fda('0x5c')])||_0x518289['body']['body']===''){throw new db[(_0x3fda('0x94'))][(_0x3fda('0x95'))](_0x3fda('0xa5'));}if(_['isNil'](_0x518289[_0x3fda('0x5c')][_0x3fda('0xa6')])){throw new db[(_0x3fda('0x94'))][(_0x3fda('0x95'))](_0x3fda('0xa7')+_0x320bb9);}if(!_['includes'](_0x320bb9,_0x518289[_0x3fda('0x5c')][_0x3fda('0xa6')])){throw new db['Sequelize'][(_0x3fda('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x320bb9);}_0x5b9c80[_0x518289[_0x3fda('0x5c')][_0x3fda('0xa6')]]=_0x518289[_0x3fda('0x5c')][_0x3fda('0xa2')];return db[_0x3fda('0xa8')][_0x3fda('0x5a')]({'where':{'id':_0x518289[_0x3fda('0x89')][_0x3fda('0x9a')]},'include':[{'model':db[_0x3fda('0x93')],'as':_0x3fda('0xa9'),'where':_0x5b9c80,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x3fda('0x20')](handleEntityNotFound(_0x56782c,null))[_0x3fda('0x20')](function(_0x38caae){if(_0x38caae){_0x518289['list']=_[_0x3fda('0x72')](_0x38caae,[_0x3fda('0xa9')]);if(_0x38caae['Contacts'][_0x3fda('0x4b')]){return _0x38caae['Contacts'][0x0];}var _0x543451=_['defaults'](_0x518289[_0x3fda('0x5c')],{'firstName':_0x518289[_0x3fda('0x5c')][_0x3fda('0xa2')],'ListId':_0x38caae['id']});_0x543451[_0x518289[_0x3fda('0x5c')][_0x3fda('0xa6')]]=_0x518289[_0x3fda('0x5c')][_0x3fda('0xa2')];return db[_0x3fda('0x93')][_0x3fda('0x5b')](_0x543451,{'fields':_0x1dee7e,'raw':!![]});}})[_0x3fda('0x20')](handleEntityNotFound(_0x56782c,null))[_0x3fda('0x20')](function(_0x8ac50){if(_0x8ac50){_0x518289[_0x3fda('0xaa')]=_0x8ac50;var _0x9787ed={'ContactId':_0x8ac50['id'],'phone':_0x518289['body'][_0x3fda('0xa2')],'WhatsappAccountId':_0x4d1cac[_0x3fda('0x61')]['id']};var _0x22e793={'ContactId':_0x8ac50['id'],'WhatsappAccountId':_0x4d1cac[_0x3fda('0x61')]['id'],'closed':![]};return db[_0x3fda('0xab')]['find']({'where':_0x22e793})[_0x3fda('0x20')](function(_0x4a641){if(_0x4a641){return[_0x4a641,![]];}return db['WhatsappInteraction'][_0x3fda('0x5b')](_0x9787ed)[_0x3fda('0x20')](function(_0x3d24b6){return[_0x3d24b6,!![]];});});}})[_0x3fda('0x73')](function(_0x556880,_0x532c44){_0x518289[_0x3fda('0xac')]=_0x556880['get']({'plain':!![]});_0x518289['interaction'][_0x3fda('0xad')]=![];if(_0x532c44){if(_0x518289[_0x3fda('0x89')][_0x3fda('0xae')]){_0x518289[_0x3fda('0x91')][_0x3fda('0xaf')]({'id':0x0,'priority':_0x518289[_0x3fda('0x91')][_0x3fda('0x4b')]+0x1,'app':_0x3fda('0xb0'),'appdata':_0x3fda('0xb1'),'interval':'*,*,*,*'});}_0x518289[_0x3fda('0xac')][_0x3fda('0xad')]=!![];}return db[_0x3fda('0x8e')][_0x3fda('0x5b')]({'phone':_0x518289['body'][_0x3fda('0xa2')],'messageId':_0x518289[_0x3fda('0x5c')][_0x3fda('0xb2')],'body':_0x518289[_0x3fda('0x5c')][_0x3fda('0x5c')],'WhatsappAccountId':_0x4d1cac['params']['id'],'WhatsappInteractionId':_0x556880['id'],'direction':'in','ContactId':_0x556880['ContactId'],'AttachmentId':_0x518289['body']['AttachmentId']});})[_0x3fda('0x20')](function(_0x4ecff0){_0x518289[_0x3fda('0x29')]=_0x4ecff0;if(!_0x518289[_0x3fda('0xac')][_0x3fda('0xb3')])return;return db['User'][_0x3fda('0x5a')]({'attributes':['id',_0x3fda('0x3c')],'where':{'id':_0x518289[_0x3fda('0xac')][_0x3fda('0xb3')]}});})[_0x3fda('0x20')](function(_0x333ae7){if(_0x333ae7){_0x518289['applications'][_0x3fda('0xb4')]({'id':0x0,'priority':0x0,'app':_0x3fda('0xb5'),'appdata':_0x333ae7[_0x3fda('0x3c')]+','+(_0x518289[_0x3fda('0x89')][_0x3fda('0xb6')]||0xa),'interval':_0x3fda('0xb7')});}if(!_0x518289[_0x3fda('0xac')]['queueId'])return;return db['WhatsappQueue']['find']({'attributes':['id',_0x3fda('0x3c')],'where':{'id':_0x518289[_0x3fda('0xac')][_0x3fda('0xb8')]}});})['then'](function(_0xbc8c9){if(_0xbc8c9){_0x518289[_0x3fda('0x91')][_0x3fda('0xb4')]({'id':0x0,'priority':0x1,'app':_0x3fda('0xb9'),'appdata':_0xbc8c9[_0x3fda('0x3c')]+','+(_0x518289[_0x3fda('0x89')][_0x3fda('0xba')]||0x12c),'interval':_0x3fda('0xb7')});}return respondWithRpcPromise(_0x3fda('0xbb'),_0x3fda('0xbc'),_0x518289);})[_0x3fda('0x20')](function(_0x1692fb){if(_0x1692fb){var _0x5d45f0=0xc8;var _0x446953='receiveMessage';logger['info'](_0x3fda('0x25'),_0x446953,_0x5d45f0,_0x3fda('0xbd'));logger[_0x3fda('0x24')](_0x3fda('0xbe'),_0x446953,_0x5d45f0,_0x3fda('0xbd'),JSON[_0x3fda('0x26')](_0x1692fb));if(_0x518289[_0x3fda('0x89')][_0x3fda('0x44')]===_0x3fda('0x9c')){return _0x56782c[_0x3fda('0x2e')](_0x5d45f0)[_0x3fda('0x34')](_0x3fda('0xbf'),_0x3fda('0xc0'))[_0x3fda('0x3d')](_0x3fda('0xc1'));}else{return _0x56782c[_0x3fda('0x2e')](_0x5d45f0)[_0x3fda('0x2f')](_0x1692fb);}}});})[_0x3fda('0x2b')](handleError(_0x56782c,null));};exports[_0x3fda('0x3d')]=function(_0x5142a5,_0x366ee1,_0x183fcd){var _0x423e9e,_0x6b3e51,_0x39f7d0;if(_[_0x3fda('0xa4')](_0x5142a5[_0x3fda('0x5c')]['body'])||_0x5142a5['body']['body']===''){throw new db[(_0x3fda('0x94'))][(_0x3fda('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3fda('0xa4')](_0x5142a5[_0x3fda('0x5c')]['to'])){throw new db[(_0x3fda('0x94'))][(_0x3fda('0x95'))](_0x3fda('0xc2'));}_0x423e9e=_0x5142a5[_0x3fda('0x5c')]['to'];return db['WhatsappAccount'][_0x3fda('0x5a')]({'where':{'id':_0x5142a5['params']['id']},'include':[{'model':db[_0x3fda('0xa8')],'as':_0x3fda('0xc3'),'include':[{'model':db[_0x3fda('0x93')],'as':_0x3fda('0xa9'),'where':{'mobile':_0x423e9e},'limit':0x1,'order':[[_0x3fda('0x98'),_0x3fda('0xc4')]]}]}]})['then'](handleEntityNotFound(_0x366ee1,null))[_0x3fda('0x20')](function(_0x5672eb){if(_0x5672eb&&_0x5672eb['List']){_0x6b3e51=_0x5672eb['get']({'plain':!![]});if(_0x6b3e51[_0x3fda('0xc3')]&&_0x6b3e51[_0x3fda('0xc3')][_0x3fda('0xa9')]['length']){return _0x6b3e51[_0x3fda('0xc3')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0x3fda('0x18')](_0x5142a5[_0x3fda('0x5c')],{'firstName':_0x423e9e,'mobile':_0x423e9e,'phone':_0x423e9e,'ListId':_0x6b3e51[_0x3fda('0x9a')]}));}})[_0x3fda('0x20')](handleEntityNotFound(_0x366ee1,null))[_0x3fda('0x20')](function(_0x4c1085){if(_0x4c1085){_0x39f7d0=_0x4c1085;return db['WhatsappInteraction'][_0x3fda('0x5a')]({'where':{'ContactId':_0x39f7d0['id'],'closed':![],'WhatsappAccountId':_0x6b3e51['id']}})[_0x3fda('0x20')](function(_0x5ba25b){if(_0x5ba25b){return[_0x5ba25b,![]];}return db[_0x3fda('0xab')][_0x3fda('0x5b')]({'UserId':_0x5142a5['user']['id'],'ContactId':_0x39f7d0['id'],'WhatsappAccountId':_0x6b3e51['id'],'phone':_0x423e9e,'firstMsgDirection':_0x3fda('0xc5'),'Messages':[_[_0x3fda('0x52')](_0x5142a5[_0x3fda('0x5c')],{'read':![],'body':_0x5142a5['body'][_0x3fda('0x5c')],'phone':_0x423e9e,'WhatsappAccountId':_0x6b3e51['id'],'UserId':_0x5142a5[_0x3fda('0x5d')]['id'],'ContactId':_0x39f7d0['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x3fda('0xc6')}]})[_0x3fda('0x20')](function(_0x33a663){return[_0x33a663,!![]];});});}})[_0x3fda('0x73')](function(_0x840b5,_0x29f8fd){if(_0x29f8fd){return _0x840b5;}return db['WhatsappMessage'][_0x3fda('0x5b')](_[_0x3fda('0x52')](_0x5142a5[_0x3fda('0x5c')],{'read':![],'body':_0x5142a5[_0x3fda('0x5c')]['body'],'phone':_0x423e9e,'WhatsappAccountId':_0x6b3e51['id'],'WhatsappInteractionId':_0x840b5['id'],'UserId':_0x5142a5[_0x3fda('0x5d')]['id'],'ContactId':_0x39f7d0['id']}))[_0x3fda('0x20')](function(_0x2ca529){_0x840b5[_0x3fda('0xc7')][_0x3fda('0xc6')]=[];_0x840b5[_0x3fda('0xc7')][_0x3fda('0xc6')]['push'](_0x2ca529['dataValues']);return _0x840b5;});})['then'](respondWithResult(_0x366ee1,null))[_0x3fda('0x2b')](handleError(_0x366ee1,null));}; \ No newline at end of file +var _0x8a64=['account','CmContact','Sequelize','difference','createdAt','CompanyId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','updatedAt','DESC','list','WhatsappInteraction','spread','interaction','autoclose','push','close','*,*,*,*','created','UserId','unshift','agent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','WhatsappAccount','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','Disposition','getDispositions','length','nolimit','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','Applications','sinch','statuses','state','read','WhatsappMessage','message_id','applications','orderBy'];(function(_0x167bb7,_0x2161cf){var _0x211b1f=function(_0x2b1810){while(--_0x2b1810){_0x167bb7['push'](_0x167bb7['shift']());}};_0x211b1f(++_0x2161cf);}(_0x8a64,0xfd));var _0x48a6=function(_0x1c46fb,_0x5ac26d){_0x1c46fb=_0x1c46fb-0x0;var _0x158e9b=_0x8a64[_0x1c46fb];return _0x158e9b;};'use strict';var emlformat=require(_0x48a6('0x0'));var rimraf=require(_0x48a6('0x1'));var zipdir=require(_0x48a6('0x2'));var jsonpatch=require(_0x48a6('0x3'));var rp=require('request-promise');var moment=require(_0x48a6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x48a6('0x5'));var util=require(_0x48a6('0x6'));var path=require(_0x48a6('0x7'));var sox=require(_0x48a6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x48a6('0x9'));var _=require(_0x48a6('0xa'));var squel=require(_0x48a6('0xb'));var crypto=require(_0x48a6('0xc'));var jsforce=require(_0x48a6('0xd'));var deskjs=require(_0x48a6('0xe'));var toCsv=require(_0x48a6('0xf'));var querystring=require(_0x48a6('0x10'));var Papa=require(_0x48a6('0x11'));var Redis=require(_0x48a6('0x12'));var authService=require(_0x48a6('0x13'));var qs=require(_0x48a6('0x14'));var as=require(_0x48a6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48a6('0x16'))(_0x48a6('0x17'));var utils=require(_0x48a6('0x18'));var config=require(_0x48a6('0x19'));var licenseUtil=require(_0x48a6('0x1a'));var db=require(_0x48a6('0x1b'))['db'];config['redis']=_[_0x48a6('0x1c')](config[_0x48a6('0x1d')],{'host':_0x48a6('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x48a6('0x1f'))[_0x48a6('0x20')](socket);var jayson=require(_0x48a6('0x21'));var client=jayson[_0x48a6('0x22')][_0x48a6('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x417189,_0x91f666,_0xbc3def,_0x1075d1){return new BPromise(function(_0x433bcb,_0x118bc1){var _0x1bea01=_0x1075d1||client;return _0x1bea01['request'](_0x417189,_0xbc3def)['then'](function(_0x515fcf){logger['info'](_0x48a6('0x24'),_0x91f666,'request\x20sent');logger[_0x48a6('0x25')](_0x48a6('0x26'),_0x91f666,'request\x20sent',JSON[_0x48a6('0x27')](_0x515fcf));if(_0x515fcf[_0x48a6('0x28')]){if(_0x515fcf[_0x48a6('0x28')][_0x48a6('0x29')]===0x1f4){logger['error'](_0x48a6('0x24'),_0x91f666,_0x515fcf['error'][_0x48a6('0x2a')]);return _0x118bc1(_0x515fcf['error'][_0x48a6('0x2a')]);}logger['error'](_0x48a6('0x24'),_0x91f666,_0x515fcf[_0x48a6('0x28')]['message']);return _0x433bcb(_0x515fcf[_0x48a6('0x28')]['message']);}else{logger[_0x48a6('0x2b')](_0x48a6('0x24'),_0x91f666,_0x48a6('0x2c'));_0x433bcb(_0x515fcf['result'][_0x48a6('0x2a')]);}})[_0x48a6('0x2d')](function(_0x11e046){logger[_0x48a6('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x91f666,_0x11e046);_0x118bc1(_0x11e046);});});}function respondWithStatusCode(_0x51ca4f,_0x3fca32){_0x3fca32=_0x3fca32||0xcc;return function(_0x3bf0c9){if(_0x3bf0c9){return _0x51ca4f[_0x48a6('0x2e')](_0x3fca32);}return _0x51ca4f['status'](_0x3fca32)[_0x48a6('0x2f')]();};}function respondWithResult(_0x38b91f,_0x11eb9a){_0x11eb9a=_0x11eb9a||0xc8;return function(_0x3e0e53){if(_0x3e0e53){return _0x38b91f[_0x48a6('0x30')](_0x11eb9a)[_0x48a6('0x31')](_0x3e0e53);}};}function respondWithFilteredResult(_0x12c40a,_0x1bb253){return function(_0x1df82d){if(_0x1df82d){var _0x513c93=typeof _0x1bb253['offset']===_0x48a6('0x32')&&typeof _0x1bb253[_0x48a6('0x33')]==='undefined';var _0x5c296c=_0x1df82d[_0x48a6('0x34')];var _0x43af16=_0x513c93?0x0:_0x1bb253[_0x48a6('0x35')];var _0x338eb3=_0x513c93?_0x1df82d[_0x48a6('0x34')]:_0x1bb253[_0x48a6('0x35')]+_0x1bb253['limit'];var _0x260c13;if(_0x338eb3>=_0x5c296c){_0x338eb3=_0x5c296c;_0x260c13=0xc8;}else{_0x260c13=0xce;}_0x12c40a[_0x48a6('0x30')](_0x260c13);return _0x12c40a[_0x48a6('0x36')](_0x48a6('0x37'),_0x43af16+'-'+_0x338eb3+'/'+_0x5c296c)[_0x48a6('0x31')](_0x1df82d);}return null;};}function patchUpdates(_0x51b27d){return function(_0x4d2323){try{jsonpatch['apply'](_0x4d2323,_0x51b27d,!![]);}catch(_0x1d5bb0){return BPromise[_0x48a6('0x38')](_0x1d5bb0);}return _0x4d2323[_0x48a6('0x39')]();};}function saveUpdates(_0x2a95c0,_0x15411e){return function(_0x3c048b){if(_0x3c048b){return _0x3c048b[_0x48a6('0x3a')](_0x2a95c0)['then'](function(_0x39ba17){return _0x39ba17;});}return null;};}function removeEntity(_0x1cd67d,_0x5494f6){return function(_0x51a9b5){if(_0x51a9b5){return _0x51a9b5[_0x48a6('0x3b')]()[_0x48a6('0x3c')](function(){var _0x36566f=_0x51a9b5['get']({'plain':!![]});var _0x5891b5=_0x48a6('0x3d');return db[_0x48a6('0x3e')]['destroy']({'where':{'type':_0x5891b5,'resourceId':_0x36566f['id']}})[_0x48a6('0x3c')](function(){return _0x51a9b5;});})[_0x48a6('0x3c')](function(){_0x1cd67d[_0x48a6('0x30')](0xcc)[_0x48a6('0x2f')]();});}};}function handleEntityNotFound(_0x3a2779,_0x3959d1){return function(_0x229352){if(!_0x229352){_0x3a2779[_0x48a6('0x2e')](0x194);}return _0x229352;};}function handleError(_0x263a1b,_0x3b6586){_0x3b6586=_0x3b6586||0x1f4;return function(_0x9643e0){logger[_0x48a6('0x28')](_0x9643e0[_0x48a6('0x3f')]);if(_0x9643e0[_0x48a6('0x40')]){delete _0x9643e0['name'];}_0x263a1b[_0x48a6('0x30')](_0x3b6586)[_0x48a6('0x41')](_0x9643e0);};}exports[_0x48a6('0x42')]=function(_0x45e29d,_0x43ea96){var _0xe26d9f={'include':[{'model':db[_0x48a6('0x43')],'as':_0x48a6('0x44')}]},_0x45b7d6={},_0x209a17={'count':0x0,'rows':[]};var _0xaadabf=_[_0x48a6('0x45')](db['WhatsappAccount'][_0x48a6('0x46')],function(_0x53ca1c){return{'name':_0x53ca1c[_0x48a6('0x47')],'type':_0x53ca1c['type'][_0x48a6('0x48')]};});_0x45b7d6['model']=_[_0x48a6('0x45')](_0xaadabf,_0x48a6('0x40'));_0x45b7d6[_0x48a6('0x49')]=_[_0x48a6('0x4a')](_0x45e29d[_0x48a6('0x49')]);_0x45b7d6[_0x48a6('0x4b')]=_[_0x48a6('0x4c')](_0x45b7d6['model'],_0x45b7d6[_0x48a6('0x49')]);_0xe26d9f[_0x48a6('0x4d')]=_[_0x48a6('0x4c')](_0x45b7d6[_0x48a6('0x4e')],qs[_0x48a6('0x4f')](_0x45e29d['query']['fields']));_0xe26d9f[_0x48a6('0x4d')]=_0xe26d9f[_0x48a6('0x4d')]['length']?_0xe26d9f['attributes']:_0x45b7d6[_0x48a6('0x4e')];if(!_0x45e29d[_0x48a6('0x49')][_0x48a6('0x50')]('nolimit')){_0xe26d9f[_0x48a6('0x33')]=qs[_0x48a6('0x33')](_0x45e29d[_0x48a6('0x49')][_0x48a6('0x33')]);_0xe26d9f['offset']=qs['offset'](_0x45e29d[_0x48a6('0x49')][_0x48a6('0x35')]);}_0xe26d9f[_0x48a6('0x51')]=qs[_0x48a6('0x52')](_0x45e29d['query']['sort']);_0xe26d9f[_0x48a6('0x53')]=qs[_0x48a6('0x4b')](_[_0x48a6('0x54')](_0x45e29d[_0x48a6('0x49')],_0x45b7d6[_0x48a6('0x4b')]),_0xaadabf);if(_0x45e29d[_0x48a6('0x49')][_0x48a6('0x55')]){_0xe26d9f[_0x48a6('0x53')]=_[_0x48a6('0x56')](_0xe26d9f['where'],{'$or':_[_0x48a6('0x45')](_0xaadabf,function(_0x2a3b33){if(_0x2a3b33[_0x48a6('0x57')]!==_0x48a6('0x58')){var _0x25fc07={};_0x25fc07[_0x2a3b33['name']]={'$like':'%'+_0x45e29d[_0x48a6('0x49')][_0x48a6('0x55')]+'%'};return _0x25fc07;}})});}_0xe26d9f=_[_0x48a6('0x56')]({},_0xe26d9f,_0x45e29d[_0x48a6('0x59')]);var _0x386ba5={'where':_0xe26d9f[_0x48a6('0x53')]};return db['WhatsappAccount'][_0x48a6('0x34')](_0x386ba5)[_0x48a6('0x3c')](function(_0x2f191f){_0x209a17[_0x48a6('0x34')]=_0x2f191f;if(_0x45e29d[_0x48a6('0x49')][_0x48a6('0x5a')]){_0xe26d9f[_0x48a6('0x5b')]=[{'all':!![]}];}return db[_0x48a6('0x5c')]['findAll'](_0xe26d9f);})[_0x48a6('0x3c')](function(_0x5020a6){_0x209a17['rows']=_0x5020a6;return _0x209a17;})[_0x48a6('0x3c')](respondWithFilteredResult(_0x43ea96,_0xe26d9f))[_0x48a6('0x2d')](handleError(_0x43ea96,null));};exports[_0x48a6('0x5d')]=function(_0x46cd41,_0x22eb56){var _0x405aeb={'raw':![],'where':{'id':_0x46cd41['params']['id']},'include':[{'model':db['Pause'],'as':_0x48a6('0x44')}]},_0x3e8878={};_0x3e8878[_0x48a6('0x4e')]=_[_0x48a6('0x4a')](db[_0x48a6('0x5c')]['rawAttributes']);_0x3e8878[_0x48a6('0x49')]=_[_0x48a6('0x4a')](_0x46cd41['query']);_0x3e8878[_0x48a6('0x4b')]=_[_0x48a6('0x4c')](_0x3e8878['model'],_0x3e8878[_0x48a6('0x49')]);_0x405aeb[_0x48a6('0x4d')]=_['intersection'](_0x3e8878['model'],qs[_0x48a6('0x4f')](_0x46cd41['query']['fields']));_0x405aeb['attributes']=_0x405aeb[_0x48a6('0x4d')]['length']?_0x405aeb[_0x48a6('0x4d')]:_0x3e8878[_0x48a6('0x4e')];if(_0x46cd41['query'][_0x48a6('0x5a')]){_0x405aeb['include']=[{'all':!![]}];}_0x405aeb=_[_0x48a6('0x56')]({},_0x405aeb,_0x46cd41[_0x48a6('0x59')]);return db[_0x48a6('0x5c')][_0x48a6('0x5e')](_0x405aeb)[_0x48a6('0x3c')](handleEntityNotFound(_0x22eb56,null))[_0x48a6('0x3c')](respondWithResult(_0x22eb56,null))[_0x48a6('0x2d')](handleError(_0x22eb56,null));};exports[_0x48a6('0x5f')]=function(_0x38d132,_0x22c9c2){return db[_0x48a6('0x5c')][_0x48a6('0x5f')](_0x38d132[_0x48a6('0x60')],{})['then'](function(_0x6b99a7){var _0x1059a5=_0x38d132[_0x48a6('0x61')][_0x48a6('0x62')]({'plain':!![]});if(!_0x1059a5)throw new Error(_0x48a6('0x63'));if(_0x1059a5[_0x48a6('0x64')]===_0x48a6('0x61')){var _0x394db0=_0x6b99a7[_0x48a6('0x62')]({'plain':!![]});var _0x47ac0e=_0x48a6('0x3d');return db[_0x48a6('0x65')][_0x48a6('0x5e')]({'where':{'name':_0x47ac0e,'userProfileId':_0x1059a5[_0x48a6('0x66')]},'raw':!![]})[_0x48a6('0x3c')](function(_0x1e0b07){if(_0x1e0b07&&_0x1e0b07[_0x48a6('0x67')]===0x0){return db[_0x48a6('0x3e')]['create']({'name':_0x394db0[_0x48a6('0x40')],'resourceId':_0x394db0['id'],'type':_0x1e0b07[_0x48a6('0x40')],'sectionId':_0x1e0b07['id']},{})[_0x48a6('0x3c')](function(){return _0x6b99a7;});}else{return _0x6b99a7;}})[_0x48a6('0x2d')](function(_0xd9e2c2){logger['error'](_0x48a6('0x68'),_0xd9e2c2);throw _0xd9e2c2;});}return _0x6b99a7;})['then'](respondWithResult(_0x22c9c2,0xc9))['catch'](handleError(_0x22c9c2,null));};exports['update']=function(_0x339c23,_0xa5b020){if(_0x339c23[_0x48a6('0x60')]['id']){delete _0x339c23['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x339c23[_0x48a6('0x69')]['id']},'include':[{'model':db[_0x48a6('0x43')],'as':_0x48a6('0x44')}]})[_0x48a6('0x3c')](handleEntityNotFound(_0xa5b020,null))['then'](saveUpdates(_0x339c23[_0x48a6('0x60')],null))[_0x48a6('0x3c')](respondWithResult(_0xa5b020,null))[_0x48a6('0x2d')](handleError(_0xa5b020,null));};exports[_0x48a6('0x3b')]=function(_0x3027e4,_0x31018e){return db[_0x48a6('0x5c')][_0x48a6('0x5e')]({'where':{'id':_0x3027e4[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x31018e,null))[_0x48a6('0x3c')](removeEntity(_0x31018e,null))[_0x48a6('0x2d')](handleError(_0x31018e,null));};exports[_0x48a6('0x6a')]=function(_0x19744e,_0x256d4c){return db[_0x48a6('0x5c')]['describe']()[_0x48a6('0x3c')](respondWithResult(_0x256d4c,null))['catch'](handleError(_0x256d4c,null));};exports['addDisposition']=function(_0x2f9a5b,_0x5d8e8b,_0x606a69){if(_0x2f9a5b[_0x48a6('0x60')]['id']){delete _0x2f9a5b[_0x48a6('0x60')]['id'];}return db[_0x48a6('0x5c')][_0x48a6('0x5e')]({'where':{'id':_0x2f9a5b[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x5d8e8b,null))[_0x48a6('0x3c')](function(_0x3d5570){if(_0x3d5570){_0x2f9a5b[_0x48a6('0x60')][_0x48a6('0x6b')]=_0x3d5570['id'];return db[_0x48a6('0x6c')][_0x48a6('0x5f')](_0x2f9a5b[_0x48a6('0x60')]);}})[_0x48a6('0x3c')](respondWithResult(_0x5d8e8b,null))['catch'](handleError(_0x5d8e8b,null));};exports[_0x48a6('0x6d')]=function(_0x39dca4,_0x34ccbb,_0x9bcf90){var _0x10d170={'raw':![],'where':{}};var _0x14e5ff={};var _0x3cfb0d={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x39dca4[_0x48a6('0x69')]['id']}})['then'](handleEntityNotFound(_0x34ccbb,null))[_0x48a6('0x3c')](function(_0x375d44){if(_0x375d44){_0x14e5ff[_0x48a6('0x4e')]=_[_0x48a6('0x4a')](db[_0x48a6('0x6c')]['rawAttributes']);_0x14e5ff[_0x48a6('0x49')]=_[_0x48a6('0x4a')](_0x39dca4['query']);_0x14e5ff[_0x48a6('0x4b')]=_[_0x48a6('0x4c')](_0x14e5ff[_0x48a6('0x4e')],_0x14e5ff['query']);_0x10d170[_0x48a6('0x4d')]=_[_0x48a6('0x4c')](_0x14e5ff[_0x48a6('0x4e')],qs[_0x48a6('0x4f')](_0x39dca4[_0x48a6('0x49')][_0x48a6('0x4f')]));_0x10d170[_0x48a6('0x4d')]=_0x10d170[_0x48a6('0x4d')][_0x48a6('0x6e')]?_0x10d170[_0x48a6('0x4d')]:_0x14e5ff[_0x48a6('0x4e')];if(!_0x39dca4[_0x48a6('0x49')][_0x48a6('0x50')](_0x48a6('0x6f'))){_0x10d170[_0x48a6('0x33')]=qs[_0x48a6('0x33')](_0x39dca4[_0x48a6('0x49')][_0x48a6('0x33')]);_0x10d170['offset']=qs[_0x48a6('0x35')](_0x39dca4['query'][_0x48a6('0x35')]);}_0x10d170[_0x48a6('0x51')]=qs[_0x48a6('0x52')](_0x39dca4[_0x48a6('0x49')]['sort']);_0x10d170[_0x48a6('0x53')]=qs[_0x48a6('0x4b')](_['pick'](_0x39dca4[_0x48a6('0x49')],_0x14e5ff[_0x48a6('0x4b')]));_0x10d170['where'][_0x48a6('0x6b')]=_0x375d44['id'];if(_0x39dca4['query'][_0x48a6('0x55')]){_0x10d170[_0x48a6('0x53')]=_[_0x48a6('0x56')](_0x10d170[_0x48a6('0x53')],{'$or':_['map'](_0x10d170['attributes'],function(_0x3679d9){var _0x3406d8={};_0x3406d8[_0x3679d9]={'$like':'%'+_0x39dca4['query'][_0x48a6('0x55')]+'%'};return _0x3406d8;})});}_0x10d170=_[_0x48a6('0x56')]({},_0x10d170,_0x39dca4['options']);return db[_0x48a6('0x6c')][_0x48a6('0x34')]({'where':_0x10d170[_0x48a6('0x53')]})[_0x48a6('0x3c')](function(_0x12f89e){_0x3cfb0d[_0x48a6('0x34')]=_0x12f89e;if(_0x39dca4[_0x48a6('0x49')][_0x48a6('0x5a')]){_0x10d170[_0x48a6('0x5b')]=[{'all':!![]}];}return db[_0x48a6('0x6c')][_0x48a6('0x70')](_0x10d170);})['then'](function(_0x170581){_0x3cfb0d[_0x48a6('0x71')]=_0x170581;return _0x3cfb0d;});}})[_0x48a6('0x3c')](respondWithFilteredResult(_0x34ccbb,_0x10d170))[_0x48a6('0x2d')](handleError(_0x34ccbb,null));};exports[_0x48a6('0x72')]=function(_0x363ebb,_0x19d94d,_0x448a31){return db[_0x48a6('0x5c')]['find']({'where':{'id':_0x363ebb[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x19d94d,null))[_0x48a6('0x3c')](function(_0x4c4ae9){if(_0x4c4ae9){return _0x4c4ae9[_0x48a6('0x72')](_0x363ebb[_0x48a6('0x49')][_0x48a6('0x73')]);}})[_0x48a6('0x3c')](respondWithStatusCode(_0x19d94d,null))['catch'](handleError(_0x19d94d,null));};exports[_0x48a6('0x74')]=function(_0x47febf,_0x231602,_0x583546){if(_0x47febf[_0x48a6('0x60')]['id']){delete _0x47febf['body']['id'];}return db[_0x48a6('0x5c')]['find']({'where':{'id':_0x47febf[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x231602,null))[_0x48a6('0x3c')](function(_0x810c42){if(_0x810c42){_0x47febf[_0x48a6('0x60')]['WhatsappAccountId']=_0x810c42['id'];return db[_0x48a6('0x75')][_0x48a6('0x5f')](_0x47febf[_0x48a6('0x60')]);}})[_0x48a6('0x3c')](respondWithResult(_0x231602,null))[_0x48a6('0x2d')](handleError(_0x231602,null));};exports[_0x48a6('0x76')]=function(_0x504633,_0xdc5882,_0x5a2476){var _0x550b6e={'raw':![],'where':{}};var _0x446239={};var _0x934b92={'count':0x0,'rows':[]};return db[_0x48a6('0x5c')][_0x48a6('0x77')]({'where':{'id':_0x504633['params']['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0xdc5882,null))[_0x48a6('0x3c')](function(_0x279631){if(_0x279631){_0x446239['model']=_['keys'](db['CannedAnswer'][_0x48a6('0x46')]);_0x446239[_0x48a6('0x49')]=_[_0x48a6('0x4a')](_0x504633[_0x48a6('0x49')]);_0x446239['filters']=_[_0x48a6('0x4c')](_0x446239[_0x48a6('0x4e')],_0x446239[_0x48a6('0x49')]);_0x550b6e[_0x48a6('0x4d')]=_[_0x48a6('0x4c')](_0x446239['model'],qs[_0x48a6('0x4f')](_0x504633['query'][_0x48a6('0x4f')]));_0x550b6e['attributes']=_0x550b6e['attributes'][_0x48a6('0x6e')]?_0x550b6e[_0x48a6('0x4d')]:_0x446239[_0x48a6('0x4e')];if(!_0x504633[_0x48a6('0x49')]['hasOwnProperty'](_0x48a6('0x6f'))){_0x550b6e[_0x48a6('0x33')]=qs['limit'](_0x504633['query'][_0x48a6('0x33')]);_0x550b6e[_0x48a6('0x35')]=qs[_0x48a6('0x35')](_0x504633['query'][_0x48a6('0x35')]);}_0x550b6e['order']=qs['sort'](_0x504633[_0x48a6('0x49')][_0x48a6('0x52')]);_0x550b6e['where']=qs[_0x48a6('0x4b')](_['pick'](_0x504633['query'],_0x446239[_0x48a6('0x4b')]));_0x550b6e[_0x48a6('0x53')]['WhatsappAccountId']=_0x279631['id'];if(_0x504633[_0x48a6('0x49')][_0x48a6('0x55')]){_0x550b6e[_0x48a6('0x53')]=_[_0x48a6('0x56')](_0x550b6e[_0x48a6('0x53')],{'$or':_[_0x48a6('0x45')](_0x550b6e[_0x48a6('0x4d')],function(_0x334135){var _0xe3e689={};_0xe3e689[_0x334135]={'$like':'%'+_0x504633[_0x48a6('0x49')][_0x48a6('0x55')]+'%'};return _0xe3e689;})});}_0x550b6e=_[_0x48a6('0x56')]({},_0x550b6e,_0x504633[_0x48a6('0x59')]);return db[_0x48a6('0x75')][_0x48a6('0x34')]({'where':_0x550b6e[_0x48a6('0x53')]})[_0x48a6('0x3c')](function(_0x274143){_0x934b92[_0x48a6('0x34')]=_0x274143;if(_0x504633[_0x48a6('0x49')][_0x48a6('0x5a')]){_0x550b6e[_0x48a6('0x5b')]=[{'all':!![]}];}return db[_0x48a6('0x75')][_0x48a6('0x70')](_0x550b6e);})[_0x48a6('0x3c')](function(_0x13931e){_0x934b92['rows']=_0x13931e;return _0x934b92;});}})[_0x48a6('0x3c')](respondWithFilteredResult(_0xdc5882,_0x550b6e))[_0x48a6('0x2d')](handleError(_0xdc5882,null));};exports['removeAnswers']=function(_0x12b029,_0x2cc766,_0x3953e1){return db[_0x48a6('0x5c')][_0x48a6('0x5e')]({'where':{'id':_0x12b029[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x2cc766,null))[_0x48a6('0x3c')](function(_0x128b73){if(_0x128b73){return _0x128b73['removeAnswers'](_0x12b029[_0x48a6('0x49')][_0x48a6('0x73')]);}})[_0x48a6('0x3c')](respondWithStatusCode(_0x2cc766,null))[_0x48a6('0x2d')](handleError(_0x2cc766,null));};exports[_0x48a6('0x78')]=function(_0x39fdce,_0x38a699,_0x237143){return db[_0x48a6('0x5c')][_0x48a6('0x5e')]({'where':{'id':_0x39fdce[_0x48a6('0x69')]['id']}})['then'](handleEntityNotFound(_0x38a699,null))['then'](function(_0x5a7464){if(_0x5a7464){return _0x5a7464[_0x48a6('0x78')](_0x39fdce[_0x48a6('0x60')][_0x48a6('0x73')],_[_0x48a6('0x79')](_0x39fdce[_0x48a6('0x60')],[_0x48a6('0x73'),'id'])||{})['spread'](function(_0x4b340b){for(var _0x5e302d=0x0;_0x5e302d<_0x39fdce[_0x48a6('0x60')][_0x48a6('0x73')][_0x48a6('0x6e')];_0x5e302d+=0x1){socket[_0x48a6('0x7a')](_0x48a6('0x7b'),{'UserId':Number(_0x39fdce['body'][_0x48a6('0x73')][_0x5e302d]),'WhatsappAccountId':Number(_0x39fdce[_0x48a6('0x69')]['id'])});}return _0x4b340b;});}})[_0x48a6('0x3c')](respondWithResult(_0x38a699,null))[_0x48a6('0x2d')](handleError(_0x38a699,null));};exports[_0x48a6('0x7c')]=function(_0x52b559,_0x1ab74f,_0x4893a7){return db[_0x48a6('0x5c')]['find']({'where':{'id':_0x52b559[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x1ab74f,null))[_0x48a6('0x3c')](function(_0xdb3df5){if(_0xdb3df5){return _0xdb3df5[_0x48a6('0x7c')](_0x52b559[_0x48a6('0x49')]['ids'])[_0x48a6('0x3c')](function(){if(_[_0x48a6('0x7d')](_0x52b559[_0x48a6('0x49')][_0x48a6('0x73')])){for(var _0x288db6=0x0;_0x288db6<_0x52b559[_0x48a6('0x49')][_0x48a6('0x73')][_0x48a6('0x6e')];_0x288db6+=0x1){socket['emit'](_0x48a6('0x7e'),{'UserId':Number(_0x52b559[_0x48a6('0x49')][_0x48a6('0x73')][_0x288db6]),'WhatsappAccountId':Number(_0x52b559[_0x48a6('0x69')]['id'])});}}else{socket[_0x48a6('0x7a')]('userWhatsappAccount:remove',{'UserId':Number(_0x52b559[_0x48a6('0x49')][_0x48a6('0x73')]),'WhatsappAccountId':Number(_0x52b559[_0x48a6('0x69')]['id'])});}});}})[_0x48a6('0x3c')](respondWithStatusCode(_0x1ab74f,null))['catch'](handleError(_0x1ab74f,null));};exports[_0x48a6('0x7f')]=function(_0x3e2a5e,_0x4f3e5c,_0x29b1d2){var _0x655bd0={};var _0x487f86={};var _0x527a8a;var _0x5d60f9;return db[_0x48a6('0x5c')][_0x48a6('0x77')]({'where':{'id':_0x3e2a5e[_0x48a6('0x69')]['id']}})['then'](handleEntityNotFound(_0x4f3e5c,null))[_0x48a6('0x3c')](function(_0xa05197){if(_0xa05197){_0x527a8a=_0xa05197;_0x487f86[_0x48a6('0x4e')]=_[_0x48a6('0x4a')](db[_0x48a6('0x80')][_0x48a6('0x46')]);_0x487f86[_0x48a6('0x49')]=_['keys'](_0x3e2a5e[_0x48a6('0x49')]);_0x487f86[_0x48a6('0x4b')]=_[_0x48a6('0x4c')](_0x487f86[_0x48a6('0x4e')],_0x487f86['query']);_0x655bd0[_0x48a6('0x4d')]=_[_0x48a6('0x4c')](_0x487f86[_0x48a6('0x4e')],qs[_0x48a6('0x4f')](_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x4f')]));_0x655bd0[_0x48a6('0x4d')]=_0x655bd0[_0x48a6('0x4d')]['length']?_0x655bd0[_0x48a6('0x4d')]:_0x487f86[_0x48a6('0x4e')];_0x655bd0[_0x48a6('0x51')]=qs[_0x48a6('0x52')](_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x52')]);_0x655bd0[_0x48a6('0x53')]=qs[_0x48a6('0x4b')](_[_0x48a6('0x54')](_0x3e2a5e[_0x48a6('0x49')],_0x487f86[_0x48a6('0x4b')]));if(_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x55')]){_0x655bd0[_0x48a6('0x53')]=_[_0x48a6('0x56')](_0x655bd0[_0x48a6('0x53')],{'$or':_['map'](_0x655bd0[_0x48a6('0x4d')],function(_0x33b5c0){var _0x2f31ee={};_0x2f31ee[_0x33b5c0]={'$like':'%'+_0x3e2a5e[_0x48a6('0x49')]['filter']+'%'};return _0x2f31ee;})});}_0x655bd0=_[_0x48a6('0x56')]({},_0x655bd0,_0x3e2a5e[_0x48a6('0x59')]);return _0x527a8a[_0x48a6('0x7f')](_0x655bd0);}})[_0x48a6('0x3c')](function(_0x3f5c90){if(_0x3f5c90){_0x5d60f9=_0x3f5c90[_0x48a6('0x6e')];if(!_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x50')]('nolimit')){_0x655bd0['limit']=qs[_0x48a6('0x33')](_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x33')]);_0x655bd0[_0x48a6('0x35')]=qs[_0x48a6('0x35')](_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x35')]);}return _0x527a8a[_0x48a6('0x7f')](_0x655bd0);}})[_0x48a6('0x3c')](function(_0x3f887a){if(_0x3f887a){return _0x3f887a?{'count':_0x5d60f9,'rows':_0x3f887a}:null;}})[_0x48a6('0x3c')](respondWithResult(_0x4f3e5c,null))['catch'](handleError(_0x4f3e5c,null));};exports[_0x48a6('0x81')]=function(_0x1b6f6d,_0x4992af){var _0x57847d=_0x1b6f6d[_0x48a6('0x69')]['id'];var _0x55bbe2=_0x1b6f6d[_0x48a6('0x60')];var _0xfdae20=0xc8;var _0x5970d2=null;return db['sequelize'][_0x48a6('0x82')]({'isolationLevel':db['sequelize'][_0x48a6('0x83')][_0x48a6('0x84')]['READ_COMMITTED']},function(_0x20c793){return db[_0x48a6('0x5c')][_0x48a6('0x77')]({'where':{'id':_0x57847d},'transaction':_0x20c793})['then'](function(_0x1d77eb){if(_0x1d77eb){return db['WhatsappApplication'][_0x48a6('0x3b')]({'where':{'WhatsappAccountId':_0x57847d},'transaction':_0x20c793})[_0x48a6('0x3c')](function(){var _0x4c91e3=_[_0x48a6('0x45')](_0x55bbe2,function(_0x47cea2){_0x47cea2[_0x48a6('0x6b')]=_0x57847d;return _0x47cea2;});return db[_0x48a6('0x85')][_0x48a6('0x86')](_0x4c91e3,{'transaction':_0x20c793});});}else{_0xfdae20=0x194;_0x5970d2=[];}});})[_0x48a6('0x3c')](function(){if(_0xfdae20!==0x194){return db['WhatsappApplication'][_0x48a6('0x87')]({'where':{'WhatsappAccountId':_0x57847d},'order':_0x48a6('0x88')})['then'](function(_0x18d974){_0x5970d2=_0x18d974;});}})[_0x48a6('0x2d')](function(_0x591b93){_0xfdae20=0x1f4;logger[_0x48a6('0x28')](_0x591b93[_0x48a6('0x3f')]);if(_0x591b93[_0x48a6('0x40')]){delete _0x591b93[_0x48a6('0x40')];}_0x5970d2=_0x591b93;})[_0x48a6('0x89')](function(){if(_0x5970d2===null){_0x4992af[_0x48a6('0x2e')](_0xfdae20);}else{if(_0xfdae20===0x1f4){_0x4992af[_0x48a6('0x30')](_0xfdae20)['send'](_0x5970d2);}else{_0x4992af[_0x48a6('0x30')](_0xfdae20)[_0x48a6('0x31')](_0x5970d2);}}});};exports[_0x48a6('0x8a')]=function(_0x44474c,_0x22f001,_0x5eaba3){var _0x3d3e68={};var _0x510fc6={};var _0x397f4c;var _0x5dd11c;return db['WhatsappAccount'][_0x48a6('0x77')]({'where':{'id':_0x44474c[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x22f001,null))[_0x48a6('0x3c')](function(_0x32ff82){if(_0x32ff82){_0x397f4c=_0x32ff82;_0x510fc6[_0x48a6('0x4e')]=_['keys'](db[_0x48a6('0x85')][_0x48a6('0x46')]);_0x510fc6[_0x48a6('0x49')]=_[_0x48a6('0x4a')](_0x44474c[_0x48a6('0x49')]);_0x510fc6[_0x48a6('0x4b')]=_['intersection'](_0x510fc6[_0x48a6('0x4e')],_0x510fc6[_0x48a6('0x49')]);_0x3d3e68[_0x48a6('0x4d')]=_[_0x48a6('0x4c')](_0x510fc6['model'],qs[_0x48a6('0x4f')](_0x44474c[_0x48a6('0x49')]['fields']));_0x3d3e68['attributes']=_0x3d3e68[_0x48a6('0x4d')][_0x48a6('0x6e')]?_0x3d3e68['attributes']:_0x510fc6['model'];_0x3d3e68[_0x48a6('0x51')]=qs[_0x48a6('0x52')](_0x44474c[_0x48a6('0x49')][_0x48a6('0x52')]);_0x3d3e68['where']=qs[_0x48a6('0x4b')](_[_0x48a6('0x54')](_0x44474c[_0x48a6('0x49')],_0x510fc6[_0x48a6('0x4b')]));if(_0x44474c['query'][_0x48a6('0x55')]){_0x3d3e68[_0x48a6('0x53')]=_[_0x48a6('0x56')](_0x3d3e68['where'],{'$or':_['map'](_0x3d3e68[_0x48a6('0x4d')],function(_0x3f68d4){var _0x5d24d2={};_0x5d24d2[_0x3f68d4]={'$like':'%'+_0x44474c[_0x48a6('0x49')]['filter']+'%'};return _0x5d24d2;})});}_0x3d3e68=_['merge']({},_0x3d3e68,_0x44474c[_0x48a6('0x59')]);return _0x397f4c[_0x48a6('0x8a')](_0x3d3e68);}})[_0x48a6('0x3c')](function(_0x315edb){if(_0x315edb){_0x5dd11c=_0x315edb[_0x48a6('0x6e')];if(!_0x44474c[_0x48a6('0x49')]['hasOwnProperty']('nolimit')){_0x3d3e68[_0x48a6('0x33')]=qs['limit'](_0x44474c[_0x48a6('0x49')]['limit']);_0x3d3e68[_0x48a6('0x35')]=qs[_0x48a6('0x35')](_0x44474c[_0x48a6('0x49')][_0x48a6('0x35')]);}return _0x397f4c[_0x48a6('0x8a')](_0x3d3e68);}})[_0x48a6('0x3c')](function(_0x2f09b4){if(_0x2f09b4){return _0x2f09b4?{'count':_0x5dd11c,'rows':_0x2f09b4}:null;}})[_0x48a6('0x3c')](respondWithResult(_0x22f001,null))[_0x48a6('0x2d')](handleError(_0x22f001,null));};exports[_0x48a6('0x8b')]=function(_0x296da2,_0x36aae9,_0x292ea9){var _0xc49947={'channel':'whatsapp'};var _0x3b8b60=[];var _0x2920cd=[];var _0x498bb9={};return db[_0x48a6('0x5c')]['find']({'where':{'id':_0x296da2[_0x48a6('0x69')]['id']},'include':[{'model':db[_0x48a6('0x85')],'as':_0x48a6('0x8c')}]})[_0x48a6('0x3c')](handleEntityNotFound(_0x36aae9,null))[_0x48a6('0x3c')](function(_0x6e84eb){_0xc49947['account']=_0x6e84eb;if(_0xc49947['account']&&_0xc49947['account'][_0x48a6('0x57')]===_0x48a6('0x8d')&&_0x296da2[_0x48a6('0x60')][_0x48a6('0x8e')]){if(_0x296da2[_0x48a6('0x60')][_0x48a6('0x8e')]['length']===0x0)return;if(_0x296da2[_0x48a6('0x60')]['statuses'][0x0][_0x48a6('0x8f')]!==_0x48a6('0x90'))return;return db[_0x48a6('0x91')][_0x48a6('0x3a')]({'read':!![],'readAt':_0x296da2[_0x48a6('0x60')][_0x48a6('0x8e')][0x0]['timestamp']},{'where':{'messageId':_0x296da2['body']['statuses'][0x0][_0x48a6('0x92')]},'individualHooks':!![]})[_0x48a6('0x3c')](function(_0x58fccc){return _0x36aae9['status'](0xc8)[_0x48a6('0x31')](_0x58fccc);});}_0xc49947[_0x48a6('0x93')]=_[_0x48a6('0x94')](_0x6e84eb[_0x48a6('0x8c')],['priority'],['asc']);if(_0xc49947[_0x48a6('0x95')][_0x48a6('0x8c')]){delete _0xc49947[_0x48a6('0x95')]['Applications'];}return db[_0x48a6('0x96')][_0x48a6('0x6a')]()[_0x48a6('0x3c')](function(_0x38e408){if(!_0x38e408){throw new db[(_0x48a6('0x97'))]['ValidationError']('no\x20available\x20attributes');}_0x3b8b60=_[_0x48a6('0x98')](_[_0x48a6('0x4a')](_0x38e408),[_0x48a6('0x99'),'updatedAt']);_0x2920cd=_['difference'](_[_0x48a6('0x4a')](_0x38e408),[_0x48a6('0x99'),'updatedAt',_0x48a6('0x9a'),'ListId']);_0xc49947[_0x48a6('0x60')]={'mapKey':_0x48a6('0x9b')};if(_0xc49947[_0x48a6('0x95')]&&_0xc49947[_0x48a6('0x95')][_0x48a6('0x57')]===_0x48a6('0x9c')){_0xc49947[_0x48a6('0x60')][_0x48a6('0x9d')]=_0x296da2['body'][_0x48a6('0x9e')][_0x48a6('0x9f')](_0x48a6('0xa0'),'');_0xc49947[_0x48a6('0x60')][_0x48a6('0x60')]=_0x296da2['body'][_0x48a6('0xa1')];_0xc49947[_0x48a6('0x60')][_0x48a6('0xa2')]=_0x296da2[_0x48a6('0x60')]['MessageSid'];}if(_0xc49947[_0x48a6('0x95')]&&_0xc49947[_0x48a6('0x95')][_0x48a6('0x57')]===_0x48a6('0x8d')){_0xc49947[_0x48a6('0x60')][_0x48a6('0x9d')]=_0x296da2[_0x48a6('0x60')][_0x48a6('0xa3')][0x0][_0x48a6('0x9d')];_0xc49947[_0x48a6('0x60')][_0x48a6('0x60')]=_0x296da2['body']['notifications'][0x0]['message'][_0x48a6('0x60')];_0xc49947['body'][_0x48a6('0xa2')]=_0x296da2[_0x48a6('0x60')][_0x48a6('0xa3')][0x0]['message_id'];}if(_0xc49947[_0x48a6('0x60')]['id']){delete _0xc49947['body']['id'];}if(_[_0x48a6('0xa4')](_0xc49947['body'][_0x48a6('0x9d')])){throw new db['Sequelize'][(_0x48a6('0xa5'))](_0x48a6('0xa6'));}if(_[_0x48a6('0xa4')](_0xc49947[_0x48a6('0x60')]['body'])||_0xc49947[_0x48a6('0x60')][_0x48a6('0x60')]===''){throw new db[(_0x48a6('0x97'))][(_0x48a6('0xa5'))](_0x48a6('0xa7'));}if(_[_0x48a6('0xa4')](_0xc49947[_0x48a6('0x60')][_0x48a6('0xa8')])){throw new db['Sequelize'][(_0x48a6('0xa5'))](_0x48a6('0xa9')+_0x2920cd);}if(!_['includes'](_0x2920cd,_0xc49947[_0x48a6('0x60')][_0x48a6('0xa8')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2920cd);}_0x498bb9[_0xc49947['body'][_0x48a6('0xa8')]]=_0xc49947[_0x48a6('0x60')][_0x48a6('0x9d')];return db[_0x48a6('0xaa')][_0x48a6('0x5e')]({'where':{'id':_0xc49947[_0x48a6('0x95')][_0x48a6('0xab')]},'include':[{'model':db[_0x48a6('0x96')],'as':_0x48a6('0xac'),'where':_0x498bb9,'limit':0x1,'order':[[_0x48a6('0xad'),_0x48a6('0xae')]]}]});})['then'](handleEntityNotFound(_0x36aae9,null))[_0x48a6('0x3c')](function(_0x5bf445){if(_0x5bf445){_0xc49947[_0x48a6('0xaf')]=_[_0x48a6('0x79')](_0x5bf445,[_0x48a6('0xac')]);if(_0x5bf445[_0x48a6('0xac')][_0x48a6('0x6e')]){return _0x5bf445[_0x48a6('0xac')][0x0];}var _0x4462e2=_[_0x48a6('0x1c')](_0xc49947[_0x48a6('0x60')],{'firstName':_0xc49947[_0x48a6('0x60')]['from'],'ListId':_0x5bf445['id']});_0x4462e2[_0xc49947[_0x48a6('0x60')]['mapKey']]=_0xc49947[_0x48a6('0x60')][_0x48a6('0x9d')];return db[_0x48a6('0x96')][_0x48a6('0x5f')](_0x4462e2,{'fields':_0x3b8b60,'raw':!![]});}})[_0x48a6('0x3c')](handleEntityNotFound(_0x36aae9,null))[_0x48a6('0x3c')](function(_0x4900f7){if(_0x4900f7){_0xc49947['contact']=_0x4900f7;var _0x3b331e={'ContactId':_0x4900f7['id'],'phone':_0xc49947[_0x48a6('0x60')]['from'],'WhatsappAccountId':_0x296da2[_0x48a6('0x69')]['id']};var _0x228f40={'ContactId':_0x4900f7['id'],'WhatsappAccountId':_0x296da2[_0x48a6('0x69')]['id'],'closed':![]};return db[_0x48a6('0xb0')][_0x48a6('0x5e')]({'where':_0x228f40})['then'](function(_0x338373){if(_0x338373){return[_0x338373,![]];}return db[_0x48a6('0xb0')]['create'](_0x3b331e)[_0x48a6('0x3c')](function(_0x1a97bb){return[_0x1a97bb,!![]];});});}})[_0x48a6('0xb1')](function(_0x497554,_0x26adcb){_0xc49947[_0x48a6('0xb2')]=_0x497554['get']({'plain':!![]});_0xc49947[_0x48a6('0xb2')]['created']=![];if(_0x26adcb){if(_0xc49947[_0x48a6('0x95')][_0x48a6('0xb3')]){_0xc49947[_0x48a6('0x93')][_0x48a6('0xb4')]({'id':0x0,'priority':_0xc49947[_0x48a6('0x93')][_0x48a6('0x6e')]+0x1,'app':_0x48a6('0xb5'),'appdata':'unmanaged','interval':_0x48a6('0xb6')});}_0xc49947['interaction'][_0x48a6('0xb7')]=!![];}return db['WhatsappMessage'][_0x48a6('0x5f')]({'phone':_0xc49947[_0x48a6('0x60')][_0x48a6('0x9d')],'messageId':_0xc49947[_0x48a6('0x60')][_0x48a6('0xa2')],'body':_0xc49947[_0x48a6('0x60')][_0x48a6('0x60')],'WhatsappAccountId':_0x296da2[_0x48a6('0x69')]['id'],'WhatsappInteractionId':_0x497554['id'],'direction':'in','ContactId':_0x497554['ContactId'],'AttachmentId':_0xc49947[_0x48a6('0x60')]['AttachmentId']});})[_0x48a6('0x3c')](function(_0x2f74b9){_0xc49947[_0x48a6('0x2a')]=_0x2f74b9;if(!_0xc49947['interaction'][_0x48a6('0xb8')])return;return db['User'][_0x48a6('0x5e')]({'attributes':['id','name'],'where':{'id':_0xc49947[_0x48a6('0xb2')][_0x48a6('0xb8')]}});})['then'](function(_0x5bd807){if(_0x5bd807){_0xc49947[_0x48a6('0x93')][_0x48a6('0xb9')]({'id':0x0,'priority':0x0,'app':_0x48a6('0xba'),'appdata':_0x5bd807[_0x48a6('0x40')]+','+(_0xc49947[_0x48a6('0x95')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0xc49947['interaction'][_0x48a6('0xbb')])return;return db['WhatsappQueue'][_0x48a6('0x5e')]({'attributes':['id','name'],'where':{'id':_0xc49947['interaction'][_0x48a6('0xbb')]}});})[_0x48a6('0x3c')](function(_0x2343df){if(_0x2343df){_0xc49947[_0x48a6('0x93')]['unshift']({'id':0x0,'priority':0x1,'app':_0x48a6('0xbc'),'appdata':_0x2343df[_0x48a6('0x40')]+','+(_0xc49947['account'][_0x48a6('0xbd')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x48a6('0xbe'),_0x48a6('0xbf'),_0xc49947);})['then'](function(_0x307fe2){if(_0x307fe2){var _0x3f23be=0xc8;var _0x1f6a11='receiveMessage';logger['info'](_0x48a6('0x26'),_0x1f6a11,_0x3f23be,_0x48a6('0xc0'));logger[_0x48a6('0x25')](_0x48a6('0xc1'),_0x1f6a11,_0x3f23be,'entity\x20found',JSON[_0x48a6('0x27')](_0x307fe2));if(_0xc49947[_0x48a6('0x95')][_0x48a6('0x57')]===_0x48a6('0x9c')){return _0x36aae9['status'](_0x3f23be)[_0x48a6('0x36')](_0x48a6('0xc2'),_0x48a6('0xc3'))[_0x48a6('0x41')](_0x48a6('0xc4'));}else{return _0x36aae9[_0x48a6('0x30')](_0x3f23be)[_0x48a6('0x31')](_0x307fe2);}}});})[_0x48a6('0x2d')](handleError(_0x36aae9,null));};exports[_0x48a6('0x41')]=function(_0x3c361c,_0x1dcf14,_0x56abfa){var _0x5a8b1a,_0x4cd7e7,_0x22e93e;if(_[_0x48a6('0xa4')](_0x3c361c[_0x48a6('0x60')][_0x48a6('0x60')])||_0x3c361c[_0x48a6('0x60')][_0x48a6('0x60')]===''){throw new db[(_0x48a6('0x97'))][(_0x48a6('0xa5'))](_0x48a6('0xa7'));}if(_[_0x48a6('0xa4')](_0x3c361c[_0x48a6('0x60')]['to'])){throw new db[(_0x48a6('0x97'))]['ValidationError']('to\x20is\x20mandatory');}_0x5a8b1a=_0x3c361c['body']['to'];return db[_0x48a6('0x5c')]['find']({'where':{'id':_0x3c361c[_0x48a6('0x69')]['id']},'include':[{'model':db[_0x48a6('0xaa')],'as':_0x48a6('0xc5'),'include':[{'model':db[_0x48a6('0x96')],'as':'Contacts','where':{'mobile':_0x5a8b1a},'limit':0x1,'order':[[_0x48a6('0xad'),_0x48a6('0xae')]]}]}]})[_0x48a6('0x3c')](handleEntityNotFound(_0x1dcf14,null))['then'](function(_0x1024e6){if(_0x1024e6&&_0x1024e6[_0x48a6('0xc5')]){_0x4cd7e7=_0x1024e6[_0x48a6('0x62')]({'plain':!![]});if(_0x4cd7e7[_0x48a6('0xc5')]&&_0x4cd7e7['List'][_0x48a6('0xac')][_0x48a6('0x6e')]){return _0x4cd7e7['List']['Contacts'][0x0];}return db[_0x48a6('0x96')][_0x48a6('0x5f')](_[_0x48a6('0x1c')](_0x3c361c[_0x48a6('0x60')],{'firstName':_0x5a8b1a,'mobile':_0x5a8b1a,'phone':_0x5a8b1a,'ListId':_0x4cd7e7[_0x48a6('0xab')]}));}})['then'](handleEntityNotFound(_0x1dcf14,null))[_0x48a6('0x3c')](function(_0x19892f){if(_0x19892f){_0x22e93e=_0x19892f;return db[_0x48a6('0xb0')][_0x48a6('0x5e')]({'where':{'ContactId':_0x22e93e['id'],'closed':![],'WhatsappAccountId':_0x4cd7e7['id']}})[_0x48a6('0x3c')](function(_0xa33be9){if(_0xa33be9){return[_0xa33be9,![]];}return db[_0x48a6('0xb0')]['create']({'UserId':_0x3c361c['user']['id'],'ContactId':_0x22e93e['id'],'WhatsappAccountId':_0x4cd7e7['id'],'phone':_0x5a8b1a,'firstMsgDirection':_0x48a6('0xc6'),'Messages':[_[_0x48a6('0x56')](_0x3c361c[_0x48a6('0x60')],{'read':![],'body':_0x3c361c[_0x48a6('0x60')][_0x48a6('0x60')],'phone':_0x5a8b1a,'WhatsappAccountId':_0x4cd7e7['id'],'UserId':_0x3c361c[_0x48a6('0x61')]['id'],'ContactId':_0x22e93e['id']})]},{'include':[{'model':db[_0x48a6('0x91')],'as':_0x48a6('0xc7')}]})[_0x48a6('0x3c')](function(_0x118620){return[_0x118620,!![]];});});}})[_0x48a6('0xb1')](function(_0x4624c5,_0x454c05){if(_0x454c05){return _0x4624c5;}return db['WhatsappMessage']['create'](_[_0x48a6('0x56')](_0x3c361c[_0x48a6('0x60')],{'read':![],'body':_0x3c361c[_0x48a6('0x60')][_0x48a6('0x60')],'phone':_0x5a8b1a,'WhatsappAccountId':_0x4cd7e7['id'],'WhatsappInteractionId':_0x4624c5['id'],'UserId':_0x3c361c[_0x48a6('0x61')]['id'],'ContactId':_0x22e93e['id']}))[_0x48a6('0x3c')](function(_0x1b93c0){_0x4624c5[_0x48a6('0xc8')]['Messages']=[];_0x4624c5[_0x48a6('0xc8')][_0x48a6('0xc7')][_0x48a6('0xb4')](_0x1b93c0[_0x48a6('0xc8')]);return _0x4624c5;});})[_0x48a6('0x3c')](respondWithResult(_0x1dcf14,null))[_0x48a6('0x2d')](handleError(_0x1dcf14,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 4ad601c..0c42d7c 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 _0xbbe0=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','emit'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xbbe0,0x1d1));var _0x0bbe=function(_0x560153,_0x58faaa){_0x560153=_0x560153-0x0;var _0x184f1a=_0xbbe0[_0x560153];return _0x184f1a;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x0bbe('0x0'))['db'][_0x0bbe('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4721f7){return function(_0x3408bc,_0x36b891,_0x291586){WhatsappAccountEvents[_0x0bbe('0x2')](_0x4721f7+':'+_0x3408bc['id'],_0x3408bc);WhatsappAccountEvents['emit'](_0x4721f7,_0x3408bc);_0x291586(null);};}for(var e in events){if(events[_0x0bbe('0x3')](e)){var event=events[e];WhatsappAccount[_0x0bbe('0x4')](e,emitEvent(event));}}module[_0x0bbe('0x5')]=WhatsappAccountEvents; \ No newline at end of file +var _0xc308=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save','update','remove'];(function(_0xdabd90,_0x53c625){var _0x291831=function(_0x1f2fc1){while(--_0x1f2fc1){_0xdabd90['push'](_0xdabd90['shift']());}};_0x291831(++_0x53c625);}(_0xc308,0xae));var _0x8c30=function(_0x3ce571,_0x52e126){_0x3ce571=_0x3ce571-0x0;var _0xcef624=_0xc308[_0x3ce571];return _0xcef624;};'use strict';var EventEmitter=require(_0x8c30('0x0'));var WhatsappAccount=require(_0x8c30('0x1'))['db'][_0x8c30('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c30('0x3'),'afterUpdate':_0x8c30('0x4'),'afterDestroy':_0x8c30('0x5')};function emitEvent(_0x1d979a){return function(_0x1a7f82,_0x468559,_0x3ba267){WhatsappAccountEvents[_0x8c30('0x6')](_0x1d979a+':'+_0x1a7f82['id'],_0x1a7f82);WhatsappAccountEvents['emit'](_0x1d979a,_0x1a7f82);_0x3ba267(null);};}for(var e in events){if(events[_0x8c30('0x7')](e)){var event=events[e];WhatsappAccount[_0x8c30('0x8')](e,emitEvent(event));}}module[_0x8c30('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 91b8996..3363a63 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 _0x74f7=['request-promise','rimraf','../../config/environment','exports','define','util','api','moment','bluebird'];(function(_0x203487,_0x1d1d06){var _0x225fd2=function(_0x5c6fdd){while(--_0x5c6fdd){_0x203487['push'](_0x203487['shift']());}};_0x225fd2(++_0x1d1d06);}(_0x74f7,0xdd));var _0x774f=function(_0x3a9083,_0x3c9f8d){_0x3a9083=_0x3a9083-0x0;var _0x160306=_0x74f7[_0x3a9083];return _0x160306;};'use strict';var _=require('lodash');var util=require(_0x774f('0x0'));var logger=require('../../config/logger')(_0x774f('0x1'));var moment=require(_0x774f('0x2'));var BPromise=require(_0x774f('0x3'));var rp=require(_0x774f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x774f('0x5'));var config=require(_0x774f('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x774f('0x7')]=function(_0x364304,_0x4f5500){return _0x364304[_0x774f('0x8')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcab3=['../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','lodash','api','request-promise'];(function(_0x32633e,_0x2a76f7){var _0x4e27c8=function(_0x54bb0d){while(--_0x54bb0d){_0x32633e['push'](_0x32633e['shift']());}};_0x4e27c8(++_0x2a76f7);}(_0xcab3,0x125));var _0x3cab=function(_0x2503fd,_0x193d94){_0x2503fd=_0x2503fd-0x0;var _0x275390=_0xcab3[_0x2503fd];return _0x275390;};'use strict';var _=require(_0x3cab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3cab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3cab('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3cab('0x3'));var attributes=require('./whatsappAccount.attributes');module[_0x3cab('0x4')]=function(_0x26a070,_0x10fcb9){return _0x26a070[_0x3cab('0x5')](_0x3cab('0x6'),attributes,{'tableName':_0x3cab('0x7'),'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 426af26..b2450e8 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 _0x7d73=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','attributes','model','lodash','util','moment'];(function(_0x41f2f5,_0x14f33c){var _0x3d49f1=function(_0x300207){while(--_0x300207){_0x41f2f5['push'](_0x41f2f5['shift']());}};_0x3d49f1(++_0x14f33c);}(_0x7d73,0x1aa));var _0x37d7=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x7d73[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x37d7('0x0'));var util=require(_0x37d7('0x1'));var moment=require(_0x37d7('0x2'));var BPromise=require('bluebird');var rs=require(_0x37d7('0x3'));var fs=require('fs');var Redis=require(_0x37d7('0x4'));var db=require(_0x37d7('0x5'))['db'];var utils=require(_0x37d7('0x6'));var logger=require(_0x37d7('0x7'))(_0x37d7('0x8'));var config=require(_0x37d7('0x9'));var jayson=require(_0x37d7('0xa'));var client=jayson['client'][_0x37d7('0xb')]({'port':0x232a});config['redis']=_[_0x37d7('0xc')](config[_0x37d7('0xd')],{'host':_0x37d7('0xe'),'port':0x18eb});var socket=require(_0x37d7('0xf'))(new Redis(config[_0x37d7('0xd')]));require(_0x37d7('0x10'))[_0x37d7('0x11')](socket);function respondWithRpcPromise(_0x2dee48,_0x12ad88,_0x4b3cdb){return new BPromise(function(_0x36cd05,_0x3a14d6){return client[_0x37d7('0x12')](_0x2dee48,_0x4b3cdb)[_0x37d7('0x13')](function(_0x58a3f5){logger[_0x37d7('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x12ad88,'request\x20sent');logger[_0x37d7('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x12ad88,_0x37d7('0x16'),JSON[_0x37d7('0x17')](_0x58a3f5));if(_0x58a3f5[_0x37d7('0x18')]){if(_0x58a3f5['error'][_0x37d7('0x19')]===0x1f4){logger[_0x37d7('0x18')](_0x37d7('0x1a'),_0x12ad88,_0x58a3f5['error'][_0x37d7('0x1b')]);return _0x3a14d6(_0x58a3f5[_0x37d7('0x18')][_0x37d7('0x1b')]);}logger[_0x37d7('0x18')](_0x37d7('0x1a'),_0x12ad88,_0x58a3f5[_0x37d7('0x18')][_0x37d7('0x1b')]);return _0x36cd05(_0x58a3f5[_0x37d7('0x18')][_0x37d7('0x1b')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x12ad88,_0x37d7('0x16'));_0x36cd05(_0x58a3f5['result']['message']);}})[_0x37d7('0x1c')](function(_0x42e788){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x12ad88,_0x42e788);_0x3a14d6(_0x42e788);});});}exports[_0x37d7('0x1d')]=function(_0x2110ae){var _0x351eda=this;return new Promise(function(_0x5f58f3,_0x528121){return db[_0x37d7('0x1e')][_0x37d7('0x1f')]({'raw':_0x2110ae['options']?_0x2110ae[_0x37d7('0x20')][_0x37d7('0x21')]===undefined?!![]:![]:!![],'where':_0x2110ae[_0x37d7('0x20')]?_0x2110ae[_0x37d7('0x20')][_0x37d7('0x22')]||null:null,'attributes':_0x2110ae['options']?_0x2110ae[_0x37d7('0x20')]['attributes']||null:null,'include':_0x2110ae[_0x37d7('0x20')]?_0x2110ae['options'][_0x37d7('0x23')]?_[_0x37d7('0x24')](_0x2110ae[_0x37d7('0x20')][_0x37d7('0x23')],function(_0x47f2b7){return{'model':db[_0x47f2b7['model']],'as':_0x47f2b7['as'],'attributes':_0x47f2b7[_0x37d7('0x25')],'include':_0x47f2b7['include']?_[_0x37d7('0x24')](_0x47f2b7[_0x37d7('0x23')],function(_0x12d95c){return{'model':db[_0x12d95c[_0x37d7('0x26')]],'as':_0x12d95c['as'],'attributes':_0x12d95c['attributes'],'include':_0x12d95c['include']?_[_0x37d7('0x24')](_0x12d95c[_0x37d7('0x23')],function(_0x41b90b){return{'model':db[_0x41b90b[_0x37d7('0x26')]],'as':_0x41b90b['as'],'attributes':_0x41b90b[_0x37d7('0x25')]};}):[]};}):[]};}):[]:[]})[_0x37d7('0x13')](function(_0x26527e){logger[_0x37d7('0x14')]('ShowWhatsappAccount',_0x2110ae);logger[_0x37d7('0x15')](_0x37d7('0x1d'),_0x2110ae,JSON[_0x37d7('0x17')](_0x26527e));_0x5f58f3(_0x26527e);})[_0x37d7('0x1c')](function(_0x2485d8){logger['error'](_0x37d7('0x1d'),_0x2485d8['message'],_0x2110ae);_0x528121(_0x351eda[_0x37d7('0x18')](0x1f4,_0x2485d8[_0x37d7('0x1b')]));});});}; \ No newline at end of file +var _0x98ac=['code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3df186,_0x12592c){var _0x5440fc=function(_0x2a7a70){while(--_0x2a7a70){_0x3df186['push'](_0x3df186['shift']());}};_0x5440fc(++_0x12592c);}(_0x98ac,0x109));var _0xc98a=function(_0x398f0b,_0x5e7d0b){_0x398f0b=_0x398f0b-0x0;var _0x3e7d69=_0x98ac[_0x398f0b];return _0x3e7d69;};'use strict';var _=require('lodash');var util=require(_0xc98a('0x0'));var moment=require(_0xc98a('0x1'));var BPromise=require(_0xc98a('0x2'));var rs=require(_0xc98a('0x3'));var fs=require('fs');var Redis=require(_0xc98a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc98a('0x5'));var logger=require(_0xc98a('0x6'))(_0xc98a('0x7'));var config=require(_0xc98a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc98a('0x9')][_0xc98a('0xa')]({'port':0x232a});config[_0xc98a('0xb')]=_['defaults'](config[_0xc98a('0xb')],{'host':_0xc98a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc98a('0xb')]));require(_0xc98a('0xd'))[_0xc98a('0xe')](socket);function respondWithRpcPromise(_0x210b45,_0x21d61f,_0x1ca875){return new BPromise(function(_0x5d354e,_0x875544){return client[_0xc98a('0xf')](_0x210b45,_0x1ca875)['then'](function(_0x23ebc1){logger[_0xc98a('0x10')](_0xc98a('0x11'),_0x21d61f,'request\x20sent');logger[_0xc98a('0x12')](_0xc98a('0x13'),_0x21d61f,_0xc98a('0x14'),JSON[_0xc98a('0x15')](_0x23ebc1));if(_0x23ebc1[_0xc98a('0x16')]){if(_0x23ebc1[_0xc98a('0x16')][_0xc98a('0x17')]===0x1f4){logger[_0xc98a('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x21d61f,_0x23ebc1[_0xc98a('0x16')][_0xc98a('0x18')]);return _0x875544(_0x23ebc1[_0xc98a('0x16')][_0xc98a('0x18')]);}logger[_0xc98a('0x16')](_0xc98a('0x11'),_0x21d61f,_0x23ebc1[_0xc98a('0x16')][_0xc98a('0x18')]);return _0x5d354e(_0x23ebc1[_0xc98a('0x16')][_0xc98a('0x18')]);}else{logger['info'](_0xc98a('0x11'),_0x21d61f,_0xc98a('0x14'));_0x5d354e(_0x23ebc1[_0xc98a('0x19')][_0xc98a('0x18')]);}})[_0xc98a('0x1a')](function(_0x3b7380){logger[_0xc98a('0x16')](_0xc98a('0x11'),_0x21d61f,_0x3b7380);_0x875544(_0x3b7380);});});}exports[_0xc98a('0x1b')]=function(_0x4619bc){var _0x17c2c6=this;return new Promise(function(_0x4b5619,_0x33d522){return db[_0xc98a('0x1c')]['find']({'raw':_0x4619bc[_0xc98a('0x1d')]?_0x4619bc[_0xc98a('0x1d')][_0xc98a('0x1e')]===undefined?!![]:![]:!![],'where':_0x4619bc[_0xc98a('0x1d')]?_0x4619bc[_0xc98a('0x1d')][_0xc98a('0x1f')]||null:null,'attributes':_0x4619bc[_0xc98a('0x1d')]?_0x4619bc[_0xc98a('0x1d')][_0xc98a('0x20')]||null:null,'include':_0x4619bc[_0xc98a('0x1d')]?_0x4619bc[_0xc98a('0x1d')][_0xc98a('0x21')]?_[_0xc98a('0x22')](_0x4619bc[_0xc98a('0x1d')]['include'],function(_0x5c9ccf){return{'model':db[_0x5c9ccf['model']],'as':_0x5c9ccf['as'],'attributes':_0x5c9ccf[_0xc98a('0x20')],'include':_0x5c9ccf[_0xc98a('0x21')]?_[_0xc98a('0x22')](_0x5c9ccf[_0xc98a('0x21')],function(_0x17f0c3){return{'model':db[_0x17f0c3[_0xc98a('0x23')]],'as':_0x17f0c3['as'],'attributes':_0x17f0c3[_0xc98a('0x20')],'include':_0x17f0c3[_0xc98a('0x21')]?_[_0xc98a('0x22')](_0x17f0c3[_0xc98a('0x21')],function(_0x2b5c8c){return{'model':db[_0x2b5c8c[_0xc98a('0x23')]],'as':_0x2b5c8c['as'],'attributes':_0x2b5c8c[_0xc98a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9a28a8){logger[_0xc98a('0x10')]('ShowWhatsappAccount',_0x4619bc);logger[_0xc98a('0x12')](_0xc98a('0x1b'),_0x4619bc,JSON['stringify'](_0x9a28a8));_0x4b5619(_0x9a28a8);})['catch'](function(_0x45232b){logger[_0xc98a('0x16')]('ShowWhatsappAccount',_0x45232b[_0xc98a('0x18')],_0x4619bc);_0x33d522(_0x17c2c6[_0xc98a('0x16')](0x1f4,_0x45232b[_0xc98a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index bbbc55f..8f2e184 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 _0x9152=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','remove','update','emit'];(function(_0x298025,_0x10aaaa){var _0x4a9075=function(_0x4e7649){while(--_0x4e7649){_0x298025['push'](_0x298025['shift']());}};_0x4a9075(++_0x10aaaa);}(_0x9152,0x15c));var _0x2915=function(_0x37383c,_0xbb3e2c){_0x37383c=_0x37383c-0x0;var _0x5e9da5=_0x9152[_0x37383c];return _0x5e9da5;};'use strict';var WhatsappAccountEvents=require(_0x2915('0x0'));var events=['save',_0x2915('0x1'),_0x2915('0x2')];function createListener(_0x247b46,_0x3928af){return function(_0x55dcee){_0x3928af[_0x2915('0x3')](_0x247b46,_0x55dcee);};}function removeListener(_0x3eacd9,_0x4aeadb){return function(){WhatsappAccountEvents[_0x2915('0x4')](_0x3eacd9,_0x4aeadb);};}exports[_0x2915('0x5')]=function(_0xe1f95a){for(var _0x5947f7=0x0,_0x1e9556=events[_0x2915('0x6')];_0x5947f7<_0x1e9556;_0x5947f7++){var _0x112c56=events[_0x5947f7];var _0x5071b6=createListener(_0x2915('0x7')+_0x112c56,_0xe1f95a);WhatsappAccountEvents['on'](_0x112c56,_0x5071b6);}}; \ No newline at end of file +var _0x2c0e=['whatsappAccount:','./whatsappAccount.events','remove','update','emit','register','length'];(function(_0xf965b2,_0x465120){var _0x5ca458=function(_0x4d3085){while(--_0x4d3085){_0xf965b2['push'](_0xf965b2['shift']());}};_0x5ca458(++_0x465120);}(_0x2c0e,0x1eb));var _0xe2c0=function(_0x3513a0,_0x3bdc88){_0x3513a0=_0x3513a0-0x0;var _0x2bdeb9=_0x2c0e[_0x3513a0];return _0x2bdeb9;};'use strict';var WhatsappAccountEvents=require(_0xe2c0('0x0'));var events=['save',_0xe2c0('0x1'),_0xe2c0('0x2')];function createListener(_0x4d3225,_0x2e6a9a){return function(_0x41679a){_0x2e6a9a[_0xe2c0('0x3')](_0x4d3225,_0x41679a);};}function removeListener(_0x558b2a,_0x5a0e80){return function(){WhatsappAccountEvents['removeListener'](_0x558b2a,_0x5a0e80);};}exports[_0xe2c0('0x4')]=function(_0x1aac3b){for(var _0x98b462=0x0,_0x3e4124=events[_0xe2c0('0x5')];_0x98b462<_0x3e4124;_0x98b462++){var _0x15b51d=events[_0x98b462];var _0x100291=createListener(_0xe2c0('0x6')+_0x15b51d,_0x1aac3b);WhatsappAccountEvents['on'](_0x15b51d,_0x100291);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index c12d80d..29e9c09 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 _0x8530=['show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x378ea4,_0x7b29ac){var _0x5928c9=function(_0x23c31a){while(--_0x23c31a){_0x378ea4['push'](_0x378ea4['shift']());}};_0x5928c9(++_0x7b29ac);}(_0x8530,0x195));var _0x0853=function(_0x255177,_0x2f5ad8){_0x255177=_0x255177-0x0;var _0x271edf=_0x8530[_0x255177];return _0x271edf;};'use strict';var multer=require(_0x0853('0x0'));var util=require(_0x0853('0x1'));var path=require(_0x0853('0x2'));var timeout=require(_0x0853('0x3'));var express=require(_0x0853('0x4'));var router=express[_0x0853('0x5')]();var fs_extra=require(_0x0853('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0853('0x7'));var config=require('../../config/environment');var controller=require(_0x0853('0x8'));router[_0x0853('0x9')]('/',auth['isAuthenticated'](),controller[_0x0853('0xa')]);router[_0x0853('0x9')](_0x0853('0xb'),auth[_0x0853('0xc')](),controller[_0x0853('0xd')]);router[_0x0853('0xe')]('/',auth[_0x0853('0xc')](),controller['create']);router[_0x0853('0xf')](_0x0853('0xb'),auth['isAuthenticated'](),controller[_0x0853('0x10')]);router['delete'](_0x0853('0xb'),auth[_0x0853('0xc')](),controller[_0x0853('0x11')]);module[_0x0853('0x12')]=router; \ No newline at end of file +var _0x14fc=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer'];(function(_0x432ac2,_0x238b44){var _0x5a17cf=function(_0x4e9e1a){while(--_0x4e9e1a){_0x432ac2['push'](_0x432ac2['shift']());}};_0x5a17cf(++_0x238b44);}(_0x14fc,0x84));var _0xc14f=function(_0x47fd17,_0x4f7037){_0x47fd17=_0x47fd17-0x0;var _0x353a4b=_0x14fc[_0x47fd17];return _0x353a4b;};'use strict';var multer=require(_0xc14f('0x0'));var util=require(_0xc14f('0x1'));var path=require(_0xc14f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc14f('0x3')]();var fs_extra=require(_0xc14f('0x4'));var auth=require(_0xc14f('0x5'));var interaction=require(_0xc14f('0x6'));var config=require(_0xc14f('0x7'));var controller=require(_0xc14f('0x8'));router['get']('/',auth[_0xc14f('0x9')](),controller[_0xc14f('0xa')]);router[_0xc14f('0xb')](_0xc14f('0xc'),auth[_0xc14f('0x9')](),controller[_0xc14f('0xd')]);router[_0xc14f('0xe')]('/',auth[_0xc14f('0x9')](),controller['create']);router[_0xc14f('0xf')](_0xc14f('0xc'),auth[_0xc14f('0x9')](),controller[_0xc14f('0x10')]);router[_0xc14f('0x11')](_0xc14f('0xc'),auth[_0xc14f('0x9')](),controller[_0xc14f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3147dcf..49c3f84 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 _0x8ed1=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x1cd0e0,_0x7db355){var _0x253c7f=function(_0x5085d3){while(--_0x5085d3){_0x1cd0e0['push'](_0x1cd0e0['shift']());}};_0x253c7f(++_0x7db355);}(_0x8ed1,0xed));var _0x18ed=function(_0x3ded60,_0x12f52d){_0x3ded60=_0x3ded60-0x0;var _0x1eda8d=_0x8ed1[_0x3ded60];return _0x1eda8d;};'use strict';var Sequelize=require(_0x18ed('0x0'));module['exports']={'priority':{'type':Sequelize[_0x18ed('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x18ed('0x2')],'allowNull':![],'defaultValue':_0x18ed('0x3')},'appdata':{'type':Sequelize[_0x18ed('0x4')]()},'description':{'type':Sequelize[_0x18ed('0x2')]},'interval':{'type':Sequelize[_0x18ed('0x2')],'defaultValue':_0x18ed('0x5')}}; \ No newline at end of file +var _0x8bdf=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x1c67ba,_0x52e86b){var _0x203f25=function(_0x14867e){while(--_0x14867e){_0x1c67ba['push'](_0x1c67ba['shift']());}};_0x203f25(++_0x52e86b);}(_0x8bdf,0xae));var _0xf8bd=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8bdf[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xf8bd('0x0'));module[_0xf8bd('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf8bd('0x2')],'allowNull':![],'defaultValue':_0xf8bd('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf8bd('0x2')],'defaultValue':_0xf8bd('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 36b1e8b..9199687 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 _0x9af6=['order','pick','filter','where','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','update','eml-format','rimraf','zip-dir','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../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','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','filters','intersection','model','query','attributes','length','hasOwnProperty','nolimit'];(function(_0x4baca0,_0x1558a4){var _0x526cf5=function(_0x51bc42){while(--_0x51bc42){_0x4baca0['push'](_0x4baca0['shift']());}};_0x526cf5(++_0x1558a4);}(_0x9af6,0x1d7));var _0x69af=function(_0x353a14,_0x2fd1ee){_0x353a14=_0x353a14-0x0;var _0x4b9a6b=_0x9af6[_0x353a14];return _0x4b9a6b;};'use strict';var emlformat=require(_0x69af('0x0'));var rimraf=require(_0x69af('0x1'));var zipdir=require(_0x69af('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x69af('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x69af('0x4'));var path=require(_0x69af('0x5'));var sox=require(_0x69af('0x6'));var csv=require('to-csv');var ejs=require(_0x69af('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x69af('0x8'));var squel=require(_0x69af('0x9'));var crypto=require(_0x69af('0xa'));var jsforce=require(_0x69af('0xb'));var deskjs=require(_0x69af('0xc'));var toCsv=require(_0x69af('0xd'));var querystring=require(_0x69af('0xe'));var Papa=require(_0x69af('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x69af('0x10'));var as=require(_0x69af('0x11'));var hardwareService=require(_0x69af('0x12'));var logger=require(_0x69af('0x13'))(_0x69af('0x14'));var utils=require(_0x69af('0x15'));var config=require(_0x69af('0x16'));var licenseUtil=require(_0x69af('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10aced,_0x3350e5){_0x3350e5=_0x3350e5||0xcc;return function(_0x145487){if(_0x145487){return _0x10aced[_0x69af('0x18')](_0x3350e5);}return _0x10aced['status'](_0x3350e5)[_0x69af('0x19')]();};}function respondWithResult(_0x24a78e,_0x3cbe74){_0x3cbe74=_0x3cbe74||0xc8;return function(_0x293297){if(_0x293297){return _0x24a78e[_0x69af('0x1a')](_0x3cbe74)[_0x69af('0x1b')](_0x293297);}};}function respondWithFilteredResult(_0x463cf7,_0x467fae){return function(_0x543ac0){if(_0x543ac0){var _0x11feb8=typeof _0x467fae[_0x69af('0x1c')]===_0x69af('0x1d')&&typeof _0x467fae[_0x69af('0x1e')]===_0x69af('0x1d');var _0x3ac9e6=_0x543ac0['count'];var _0xdf79c3=_0x11feb8?0x0:_0x467fae[_0x69af('0x1c')];var _0x2483b8=_0x11feb8?_0x543ac0[_0x69af('0x1f')]:_0x467fae[_0x69af('0x1c')]+_0x467fae[_0x69af('0x1e')];var _0x44c3a9;if(_0x2483b8>=_0x3ac9e6){_0x2483b8=_0x3ac9e6;_0x44c3a9=0xc8;}else{_0x44c3a9=0xce;}_0x463cf7[_0x69af('0x1a')](_0x44c3a9);return _0x463cf7['set'](_0x69af('0x20'),_0xdf79c3+'-'+_0x2483b8+'/'+_0x3ac9e6)[_0x69af('0x1b')](_0x543ac0);}return null;};}function patchUpdates(_0x484562){return function(_0x4a4c0f){try{jsonpatch[_0x69af('0x21')](_0x4a4c0f,_0x484562,!![]);}catch(_0x3f6395){return BPromise[_0x69af('0x22')](_0x3f6395);}return _0x4a4c0f[_0x69af('0x23')]();};}function saveUpdates(_0x463930,_0x5343e8){return function(_0xc58589){if(_0xc58589){return _0xc58589['update'](_0x463930)[_0x69af('0x24')](function(_0x41312e){return _0x41312e;});}return null;};}function removeEntity(_0x2dae36,_0x1803cb){return function(_0x281659){if(_0x281659){return _0x281659[_0x69af('0x25')]()[_0x69af('0x24')](function(){_0x2dae36[_0x69af('0x1a')](0xcc)[_0x69af('0x19')]();});}};}function handleEntityNotFound(_0x4fd6d8,_0x581eea){return function(_0x40d087){if(!_0x40d087){_0x4fd6d8[_0x69af('0x18')](0x194);}return _0x40d087;};}function handleError(_0x6f686b,_0x5cfb8c){_0x5cfb8c=_0x5cfb8c||0x1f4;return function(_0x57eaf9){logger[_0x69af('0x26')](_0x57eaf9[_0x69af('0x27')]);if(_0x57eaf9[_0x69af('0x28')]){delete _0x57eaf9['name'];}_0x6f686b[_0x69af('0x1a')](_0x5cfb8c)[_0x69af('0x29')](_0x57eaf9);};}exports['index']=function(_0x5b29da,_0x2cec15){var _0x58e7d0={},_0x41c479={},_0x1c32f7={'count':0x0,'rows':[]};var _0x48e727=_[_0x69af('0x2a')](db['WhatsappApplication'][_0x69af('0x2b')],function(_0x313ece){return{'name':_0x313ece[_0x69af('0x2c')],'type':_0x313ece['type'][_0x69af('0x2d')]};});_0x41c479['model']=_[_0x69af('0x2a')](_0x48e727,_0x69af('0x28'));_0x41c479['query']=_['keys'](_0x5b29da['query']);_0x41c479[_0x69af('0x2e')]=_[_0x69af('0x2f')](_0x41c479[_0x69af('0x30')],_0x41c479[_0x69af('0x31')]);_0x58e7d0[_0x69af('0x32')]=_[_0x69af('0x2f')](_0x41c479[_0x69af('0x30')],qs['fields'](_0x5b29da[_0x69af('0x31')]['fields']));_0x58e7d0['attributes']=_0x58e7d0[_0x69af('0x32')][_0x69af('0x33')]?_0x58e7d0[_0x69af('0x32')]:_0x41c479['model'];if(!_0x5b29da[_0x69af('0x31')][_0x69af('0x34')](_0x69af('0x35'))){_0x58e7d0[_0x69af('0x1e')]=qs[_0x69af('0x1e')](_0x5b29da[_0x69af('0x31')]['limit']);_0x58e7d0[_0x69af('0x1c')]=qs['offset'](_0x5b29da['query']['offset']);}_0x58e7d0[_0x69af('0x36')]=qs['sort'](_0x5b29da['query']['sort']);_0x58e7d0['where']=qs[_0x69af('0x2e')](_[_0x69af('0x37')](_0x5b29da[_0x69af('0x31')],_0x41c479['filters']),_0x48e727);if(_0x5b29da[_0x69af('0x31')][_0x69af('0x38')]){_0x58e7d0[_0x69af('0x39')]=_[_0x69af('0x3a')](_0x58e7d0[_0x69af('0x39')],{'$or':_[_0x69af('0x2a')](_0x48e727,function(_0x3eff33){if(_0x3eff33['type']!==_0x69af('0x3b')){var _0x1e2b70={};_0x1e2b70[_0x3eff33[_0x69af('0x28')]]={'$like':'%'+_0x5b29da['query'][_0x69af('0x38')]+'%'};return _0x1e2b70;}})});}_0x58e7d0=_['merge']({},_0x58e7d0,_0x5b29da[_0x69af('0x3c')]);var _0x41283a={'where':_0x58e7d0[_0x69af('0x39')]};return db[_0x69af('0x3d')][_0x69af('0x1f')](_0x41283a)['then'](function(_0x3e15cd){_0x1c32f7[_0x69af('0x1f')]=_0x3e15cd;if(_0x5b29da[_0x69af('0x31')][_0x69af('0x3e')]){_0x58e7d0[_0x69af('0x3f')]=[{'all':!![]}];}return db[_0x69af('0x3d')][_0x69af('0x40')](_0x58e7d0);})[_0x69af('0x24')](function(_0x3639f1){_0x1c32f7[_0x69af('0x41')]=_0x3639f1;return _0x1c32f7;})['then'](respondWithFilteredResult(_0x2cec15,_0x58e7d0))[_0x69af('0x42')](handleError(_0x2cec15,null));};exports[_0x69af('0x43')]=function(_0x45d8ba,_0x5ddf17){var _0x51b142={'raw':!![],'where':{'id':_0x45d8ba[_0x69af('0x44')]['id']}},_0x30fd43={};_0x30fd43[_0x69af('0x30')]=_[_0x69af('0x45')](db[_0x69af('0x3d')][_0x69af('0x2b')]);_0x30fd43[_0x69af('0x31')]=_['keys'](_0x45d8ba['query']);_0x30fd43['filters']=_[_0x69af('0x2f')](_0x30fd43[_0x69af('0x30')],_0x30fd43['query']);_0x51b142[_0x69af('0x32')]=_['intersection'](_0x30fd43['model'],qs[_0x69af('0x46')](_0x45d8ba['query']['fields']));_0x51b142[_0x69af('0x32')]=_0x51b142[_0x69af('0x32')]['length']?_0x51b142[_0x69af('0x32')]:_0x30fd43[_0x69af('0x30')];if(_0x45d8ba[_0x69af('0x31')]['includeAll']){_0x51b142[_0x69af('0x3f')]=[{'all':!![]}];}_0x51b142=_['merge']({},_0x51b142,_0x45d8ba[_0x69af('0x3c')]);return db[_0x69af('0x3d')][_0x69af('0x47')](_0x51b142)[_0x69af('0x24')](handleEntityNotFound(_0x5ddf17,null))[_0x69af('0x24')](respondWithResult(_0x5ddf17,null))['catch'](handleError(_0x5ddf17,null));};exports[_0x69af('0x48')]=function(_0x4ced80,_0x104806){return db['WhatsappApplication']['create'](_0x4ced80[_0x69af('0x49')],{})[_0x69af('0x24')](respondWithResult(_0x104806,0xc9))['catch'](handleError(_0x104806,null));};exports[_0x69af('0x4a')]=function(_0x5cddd0,_0x1b5aae){if(_0x5cddd0[_0x69af('0x49')]['id']){delete _0x5cddd0[_0x69af('0x49')]['id'];}return db[_0x69af('0x3d')]['find']({'where':{'id':_0x5cddd0['params']['id']}})[_0x69af('0x24')](handleEntityNotFound(_0x1b5aae,null))[_0x69af('0x24')](saveUpdates(_0x5cddd0[_0x69af('0x49')],null))[_0x69af('0x24')](respondWithResult(_0x1b5aae,null))['catch'](handleError(_0x1b5aae,null));};exports[_0x69af('0x25')]=function(_0x33f849,_0x390e9e){return db['WhatsappApplication'][_0x69af('0x47')]({'where':{'id':_0x33f849[_0x69af('0x44')]['id']}})['then'](handleEntityNotFound(_0x390e9e,null))['then'](removeEntity(_0x390e9e,null))[_0x69af('0x42')](handleError(_0x390e9e,null));}; \ No newline at end of file +var _0xb8cb=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra'];(function(_0xb7373d,_0x1b8704){var _0x474f7e=function(_0x46ddf7){while(--_0x46ddf7){_0xb7373d['push'](_0xb7373d['shift']());}};_0x474f7e(++_0x1b8704);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x575302,_0x8628a2){_0x575302=_0x575302-0x0;var _0x231ec8=_0xb8cb[_0x575302];return _0x231ec8;};'use strict';var emlformat=require(_0xbb8c('0x0'));var rimraf=require(_0xbb8c('0x1'));var zipdir=require(_0xbb8c('0x2'));var jsonpatch=require(_0xbb8c('0x3'));var rp=require(_0xbb8c('0x4'));var moment=require(_0xbb8c('0x5'));var BPromise=require(_0xbb8c('0x6'));var Mustache=require('mustache');var util=require(_0xbb8c('0x7'));var path=require(_0xbb8c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb8c('0x9'));var fs=require('fs');var fs_extra=require(_0xbb8c('0xa'));var _=require(_0xbb8c('0xb'));var squel=require('squel');var crypto=require(_0xbb8c('0xc'));var jsforce=require(_0xbb8c('0xd'));var deskjs=require(_0xbb8c('0xe'));var toCsv=require(_0xbb8c('0xf'));var querystring=require(_0xbb8c('0x10'));var Papa=require(_0xbb8c('0x11'));var Redis=require(_0xbb8c('0x12'));var authService=require(_0xbb8c('0x13'));var qs=require(_0xbb8c('0x14'));var as=require(_0xbb8c('0x15'));var hardwareService=require(_0xbb8c('0x16'));var logger=require(_0xbb8c('0x17'))('api');var utils=require(_0xbb8c('0x18'));var config=require(_0xbb8c('0x19'));var licenseUtil=require(_0xbb8c('0x1a'));var db=require(_0xbb8c('0x1b'))['db'];function respondWithStatusCode(_0x3ac367,_0x57e624){_0x57e624=_0x57e624||0xcc;return function(_0x275252){if(_0x275252){return _0x3ac367[_0xbb8c('0x1c')](_0x57e624);}return _0x3ac367[_0xbb8c('0x1d')](_0x57e624)[_0xbb8c('0x1e')]();};}function respondWithResult(_0x3a0fe2,_0x151bf2){_0x151bf2=_0x151bf2||0xc8;return function(_0x1de932){if(_0x1de932){return _0x3a0fe2['status'](_0x151bf2)[_0xbb8c('0x1f')](_0x1de932);}};}function respondWithFilteredResult(_0x1e6dc9,_0x425891){return function(_0x403710){if(_0x403710){var _0x2cc079=typeof _0x425891[_0xbb8c('0x20')]===_0xbb8c('0x21')&&typeof _0x425891[_0xbb8c('0x22')]===_0xbb8c('0x21');var _0x187ee5=_0x403710['count'];var _0x67712e=_0x2cc079?0x0:_0x425891[_0xbb8c('0x20')];var _0x2a02c9=_0x2cc079?_0x403710[_0xbb8c('0x23')]:_0x425891[_0xbb8c('0x20')]+_0x425891[_0xbb8c('0x22')];var _0x520ea9;if(_0x2a02c9>=_0x187ee5){_0x2a02c9=_0x187ee5;_0x520ea9=0xc8;}else{_0x520ea9=0xce;}_0x1e6dc9[_0xbb8c('0x1d')](_0x520ea9);return _0x1e6dc9[_0xbb8c('0x24')]('Content-Range',_0x67712e+'-'+_0x2a02c9+'/'+_0x187ee5)[_0xbb8c('0x1f')](_0x403710);}return null;};}function patchUpdates(_0x5e2803){return function(_0x44a56e){try{jsonpatch['apply'](_0x44a56e,_0x5e2803,!![]);}catch(_0x32b961){return BPromise[_0xbb8c('0x25')](_0x32b961);}return _0x44a56e[_0xbb8c('0x26')]();};}function saveUpdates(_0x546215,_0x4b4100){return function(_0x10f265){if(_0x10f265){return _0x10f265['update'](_0x546215)[_0xbb8c('0x27')](function(_0x1b764d){return _0x1b764d;});}return null;};}function removeEntity(_0x36163c,_0xec7fb5){return function(_0x362a2f){if(_0x362a2f){return _0x362a2f[_0xbb8c('0x28')]()[_0xbb8c('0x27')](function(){_0x36163c['status'](0xcc)[_0xbb8c('0x1e')]();});}};}function handleEntityNotFound(_0x5f4f96,_0x4a5684){return function(_0xe7475d){if(!_0xe7475d){_0x5f4f96['sendStatus'](0x194);}return _0xe7475d;};}function handleError(_0x47fb37,_0x26ea5f){_0x26ea5f=_0x26ea5f||0x1f4;return function(_0x283ec3){logger[_0xbb8c('0x29')](_0x283ec3['stack']);if(_0x283ec3['name']){delete _0x283ec3[_0xbb8c('0x2a')];}_0x47fb37[_0xbb8c('0x1d')](_0x26ea5f)['send'](_0x283ec3);};}exports[_0xbb8c('0x2b')]=function(_0x23bf3d,_0x292f11){var _0x4f0f13={},_0x271ad7={},_0x1e0e3={'count':0x0,'rows':[]};var _0x219976=_[_0xbb8c('0x2c')](db[_0xbb8c('0x2d')][_0xbb8c('0x2e')],function(_0x2f3db6){return{'name':_0x2f3db6[_0xbb8c('0x2f')],'type':_0x2f3db6[_0xbb8c('0x30')][_0xbb8c('0x31')]};});_0x271ad7['model']=_['map'](_0x219976,_0xbb8c('0x2a'));_0x271ad7[_0xbb8c('0x32')]=_[_0xbb8c('0x33')](_0x23bf3d[_0xbb8c('0x32')]);_0x271ad7[_0xbb8c('0x34')]=_['intersection'](_0x271ad7[_0xbb8c('0x35')],_0x271ad7[_0xbb8c('0x32')]);_0x4f0f13[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0x271ad7[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0x4f0f13[_0xbb8c('0x36')]=_0x4f0f13['attributes'][_0xbb8c('0x39')]?_0x4f0f13[_0xbb8c('0x36')]:_0x271ad7[_0xbb8c('0x35')];if(!_0x23bf3d['query']['hasOwnProperty'](_0xbb8c('0x3a'))){_0x4f0f13[_0xbb8c('0x22')]=qs[_0xbb8c('0x22')](_0x23bf3d[_0xbb8c('0x32')]['limit']);_0x4f0f13[_0xbb8c('0x20')]=qs[_0xbb8c('0x20')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x20')]);}_0x4f0f13[_0xbb8c('0x3b')]=qs['sort'](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3c')]);_0x4f0f13[_0xbb8c('0x3d')]=qs[_0xbb8c('0x34')](_['pick'](_0x23bf3d[_0xbb8c('0x32')],_0x271ad7[_0xbb8c('0x34')]),_0x219976);if(_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]){_0x4f0f13[_0xbb8c('0x3d')]=_[_0xbb8c('0x3f')](_0x4f0f13[_0xbb8c('0x3d')],{'$or':_[_0xbb8c('0x2c')](_0x219976,function(_0x423bba){if(_0x423bba[_0xbb8c('0x30')]!==_0xbb8c('0x40')){var _0x1f4d03={};_0x1f4d03[_0x423bba['name']]={'$like':'%'+_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]+'%'};return _0x1f4d03;}})});}_0x4f0f13=_[_0xbb8c('0x3f')]({},_0x4f0f13,_0x23bf3d[_0xbb8c('0x41')]);var _0x55a698={'where':_0x4f0f13[_0xbb8c('0x3d')]};return db['WhatsappApplication']['count'](_0x55a698)[_0xbb8c('0x27')](function(_0x1c5197){_0x1e0e3[_0xbb8c('0x23')]=_0x1c5197;if(_0x23bf3d['query'][_0xbb8c('0x42')]){_0x4f0f13[_0xbb8c('0x43')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xbb8c('0x44')](_0x4f0f13);})[_0xbb8c('0x27')](function(_0x3b8311){_0x1e0e3[_0xbb8c('0x45')]=_0x3b8311;return _0x1e0e3;})['then'](respondWithFilteredResult(_0x292f11,_0x4f0f13))[_0xbb8c('0x46')](handleError(_0x292f11,null));};exports[_0xbb8c('0x47')]=function(_0x17ffa5,_0x5b662e){var _0xa601d5={'raw':!![],'where':{'id':_0x17ffa5['params']['id']}},_0xff11d5={};_0xff11d5['model']=_[_0xbb8c('0x33')](db[_0xbb8c('0x2d')]['rawAttributes']);_0xff11d5['query']=_[_0xbb8c('0x33')](_0x17ffa5['query']);_0xff11d5[_0xbb8c('0x34')]=_['intersection'](_0xff11d5[_0xbb8c('0x35')],_0xff11d5['query']);_0xa601d5[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0xff11d5[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0xa601d5['attributes']=_0xa601d5[_0xbb8c('0x36')]['length']?_0xa601d5[_0xbb8c('0x36')]:_0xff11d5[_0xbb8c('0x35')];if(_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x42')]){_0xa601d5[_0xbb8c('0x43')]=[{'all':!![]}];}_0xa601d5=_[_0xbb8c('0x3f')]({},_0xa601d5,_0x17ffa5['options']);return db['WhatsappApplication'][_0xbb8c('0x48')](_0xa601d5)[_0xbb8c('0x27')](handleEntityNotFound(_0x5b662e,null))['then'](respondWithResult(_0x5b662e,null))[_0xbb8c('0x46')](handleError(_0x5b662e,null));};exports[_0xbb8c('0x49')]=function(_0x3f0a8b,_0x599e51){return db[_0xbb8c('0x2d')]['create'](_0x3f0a8b[_0xbb8c('0x4a')],{})[_0xbb8c('0x27')](respondWithResult(_0x599e51,0xc9))[_0xbb8c('0x46')](handleError(_0x599e51,null));};exports['update']=function(_0x1953f7,_0x295bb0){if(_0x1953f7[_0xbb8c('0x4a')]['id']){delete _0x1953f7[_0xbb8c('0x4a')]['id'];}return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x1953f7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x295bb0,null))[_0xbb8c('0x27')](saveUpdates(_0x1953f7[_0xbb8c('0x4a')],null))['then'](respondWithResult(_0x295bb0,null))[_0xbb8c('0x46')](handleError(_0x295bb0,null));};exports[_0xbb8c('0x28')]=function(_0x4400c7,_0x5c3373){return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x4400c7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x5c3373,null))[_0xbb8c('0x27')](removeEntity(_0x5c3373,null))[_0xbb8c('0x46')](handleError(_0x5c3373,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 2b9b2f5..f3a1a4b 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 _0x9a19=['exports','define','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9a19,0x114));var _0x99a1=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9a19[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x99a1('0xc')});}; \ No newline at end of file +var _0x423b=['utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0x43ce1b,_0x155d2f){var _0x2d758e=function(_0x1f1193){while(--_0x1f1193){_0x43ce1b['push'](_0x43ce1b['shift']());}};_0x2d758e(++_0x155d2f);}(_0x423b,0x12b));var _0xb423=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x423b[_0x11ce46];return _0x368a1e;};'use strict';var _=require('lodash');var util=require(_0xb423('0x0'));var logger=require('../../config/logger')(_0xb423('0x1'));var moment=require('moment');var BPromise=require(_0xb423('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb423('0x3'));var attributes=require(_0xb423('0x4'));module['exports']=function(_0x1be92e,_0x3e6b18){return _0x1be92e[_0xb423('0x5')](_0xb423('0x6'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb423('0x7'),'collate':_0xb423('0x8')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index eb6969a..df7f697 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 _0xed1f=['request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x16c98c,_0x24bf79){var _0x30f8e5=function(_0x2b2cd5){while(--_0x2b2cd5){_0x16c98c['push'](_0x16c98c['shift']());}};_0x30f8e5(++_0x24bf79);}(_0xed1f,0x6a));var _0xfed1=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xed1f[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file +var _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x312e79,_0x22669a){var _0x2a52b0=function(_0x4b5efa){while(--_0x4b5efa){_0x312e79['push'](_0x312e79['shift']());}};_0x2a52b0(++_0x22669a);}(_0x207c,0x1e8));var _0xc207=function(_0x236e77,_0x388743){_0x236e77=_0x236e77-0x0;var _0x59e31f=_0x207c[_0x236e77];return _0x59e31f;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 22faac8..78ea1a5 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 _0xd8b1=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','index','/describe','isAuthenticated','describe','get','show','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','exports'];(function(_0x9f1ec9,_0x347cfd){var _0x10af71=function(_0xd50d44){while(--_0xd50d44){_0x9f1ec9['push'](_0x9f1ec9['shift']());}};_0x10af71(++_0x347cfd);}(_0xd8b1,0x105));var _0x1d8b=function(_0x2d7103,_0x5dc5ff){_0x2d7103=_0x2d7103-0x0;var _0x519972=_0xd8b1[_0x2d7103];return _0x519972;};'use strict';var multer=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var path=require(_0x1d8b('0x2'));var timeout=require(_0x1d8b('0x3'));var express=require(_0x1d8b('0x4'));var router=express['Router']();var fs_extra=require(_0x1d8b('0x5'));var auth=require(_0x1d8b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d8b('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1d8b('0x8')]);router['get'](_0x1d8b('0x9'),auth[_0x1d8b('0xa')](),controller[_0x1d8b('0xb')]);router[_0x1d8b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1d8b('0xd')]);router['get']('/:id/messages',auth[_0x1d8b('0xa')](),controller['getMessages']);router[_0x1d8b('0xc')]('/:id/download',auth[_0x1d8b('0xa')](),controller[_0x1d8b('0xe')]);router[_0x1d8b('0xf')]('/',auth[_0x1d8b('0xa')](),controller[_0x1d8b('0x10')]);router[_0x1d8b('0xf')]('/:id/messages',auth[_0x1d8b('0xa')](),controller[_0x1d8b('0x11')]);router[_0x1d8b('0xf')](_0x1d8b('0x12'),auth[_0x1d8b('0xa')](),interaction[_0x1d8b('0x13')](_0x1d8b('0x14'),_0x1d8b('0x15')),controller['addTags']);router[_0x1d8b('0x16')](_0x1d8b('0x17'),auth[_0x1d8b('0xa')](),interaction[_0x1d8b('0x13')](_0x1d8b('0x14'),_0x1d8b('0x18')),controller[_0x1d8b('0x19')]);router['delete']('/:id',auth[_0x1d8b('0xa')](),interaction[_0x1d8b('0x13')](_0x1d8b('0x14'),_0x1d8b('0x1a')),controller[_0x1d8b('0x1b')]);router['delete'](_0x1d8b('0x12'),auth[_0x1d8b('0xa')](),controller['removeTags']);module[_0x1d8b('0x1c')]=router; \ No newline at end of file +var _0x9fe7=['download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','/:id/download'];(function(_0x2894e4,_0x39f2f7){var _0x341734=function(_0x855ec4){while(--_0x855ec4){_0x2894e4['push'](_0x2894e4['shift']());}};_0x341734(++_0x39f2f7);}(_0x9fe7,0x1df));var _0x79fe=function(_0x1d1bc9,_0x387e9a){_0x1d1bc9=_0x1d1bc9-0x0;var _0x333cd1=_0x9fe7[_0x1d1bc9];return _0x333cd1;};'use strict';var multer=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var path=require('path');var timeout=require(_0x79fe('0x2'));var express=require('express');var router=express[_0x79fe('0x3')]();var fs_extra=require(_0x79fe('0x4'));var auth=require(_0x79fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x79fe('0x6'));var controller=require(_0x79fe('0x7'));router[_0x79fe('0x8')]('/',auth['isAuthenticated'](),controller[_0x79fe('0x9')]);router[_0x79fe('0x8')](_0x79fe('0xa'),auth['isAuthenticated'](),controller[_0x79fe('0xb')]);router[_0x79fe('0x8')](_0x79fe('0xc'),auth[_0x79fe('0xd')](),controller[_0x79fe('0xe')]);router['get'](_0x79fe('0xf'),auth[_0x79fe('0xd')](),controller['getMessages']);router[_0x79fe('0x8')](_0x79fe('0x10'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x11')]);router['post']('/',auth[_0x79fe('0xd')](),controller[_0x79fe('0x12')]);router[_0x79fe('0x13')](_0x79fe('0xf'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x14')]);router[_0x79fe('0x13')](_0x79fe('0x15'),auth['isAuthenticated'](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),_0x79fe('0x18')),controller[_0x79fe('0x19')]);router[_0x79fe('0x1a')](_0x79fe('0xc'),auth['isAuthenticated'](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),_0x79fe('0x1b')),controller[_0x79fe('0x1c')]);router['delete'](_0x79fe('0xc'),auth[_0x79fe('0xd')](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x79fe('0x1d')](_0x79fe('0x15'),auth[_0x79fe('0xd')](),controller['removeTags']);module[_0x79fe('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 6033374..af101c0 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 _0xf4f4=['ENUM','out','INTEGER','sequelize','moment','BOOLEAN','DATE','STRING'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x394a0d,_0x417bf2){_0x394a0d=_0x394a0d-0x0;var _0x1f25c5=_0xf4f4[_0x394a0d];return _0x1f25c5;};'use strict';var Sequelize=require(_0x4f4f('0x0'));var moment=require(_0x4f4f('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4f4f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4f4f('0x3')]},'disposition':{'type':Sequelize[_0x4f4f('0x4')]},'secondDisposition':{'type':Sequelize[_0x4f4f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4f4f('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4f4f('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4f4f('0x5')]('in',_0x4f4f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4f4f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4f4f('0x5')]('in',_0x4f4f('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4f4f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4f4f('0x7')]}}; \ No newline at end of file +var _0xb90a=['out','INTEGER','sequelize','moment','BOOLEAN','STRING','DATE','ENUM'];(function(_0x4f92da,_0x542a92){var _0x3253b3=function(_0x26019f){while(--_0x26019f){_0x4f92da['push'](_0x4f92da['shift']());}};_0x3253b3(++_0x542a92);}(_0xb90a,0x12a));var _0xab90=function(_0x68078f,_0x19a7a4){_0x68078f=_0x68078f-0x0;var _0xe392a7=_0xb90a[_0x68078f];return _0xe392a7;};'use strict';var Sequelize=require(_0xab90('0x0'));var moment=require(_0xab90('0x1'));module['exports']={'closed':{'type':Sequelize[_0xab90('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xab90('0x3')]},'read1stAt':{'type':Sequelize[_0xab90('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xab90('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xab90('0x5')]('in',_0xab90('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xab90('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b56ccec..9be6fe8 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 _0xc88f=['User','fullname','push','CmContact','Contact','firstName','lastName','attachments','Messages','direction','secret','read','WhatsappAccount','Account','get','Whatsapp','Owner','N.A.','createdAt','closed','closedAt','disposition','Attachment','basename','createReadStream','pipe','out','System','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','log','err','sendStatus','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','json','undefined','limit','count','offset','set','update','then','destroy','end','error','stack','name','send','index','WhatsappInteraction','type','findAll','whatsapp','user','catch','params','model','rawAttributes','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','order','sort','where','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','toString','join','server','root','files','transcript-%d-%s.zip'];(function(_0x1db38e,_0x58eb4f){var _0x206f13=function(_0x125255){while(--_0x125255){_0x1db38e['push'](_0x1db38e['shift']());}};_0x206f13(++_0x58eb4f);}(_0xc88f,0x19b));var _0xfc88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc88f[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xfc88('0x0'));var zipdir=require(_0xfc88('0x1'));var moment=require(_0xfc88('0x2'));var BPromise=require(_0xfc88('0x3'));var util=require(_0xfc88('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfc88('0x5'));var Redis=require(_0xfc88('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xfc88('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xfc88('0x8'))(_0xfc88('0x9'));var config=require(_0xfc88('0xa'));var db=require(_0xfc88('0xb'))['db'];config[_0xfc88('0xc')]=_[_0xfc88('0xd')](config[_0xfc88('0xc')],{'host':_0xfc88('0xe'),'port':0x18eb});var socket=require(_0xfc88('0xf'))(new Redis(config['redis']));require(_0xfc88('0x10'))[_0xfc88('0x11')](socket);function respondWithStatusCode(_0x3c133a,_0x50397c){_0x50397c=_0x50397c||0xcc;return function(_0x214587){if(_0x214587){return _0x3c133a['sendStatus'](_0x50397c);}return _0x3c133a[_0xfc88('0x12')](_0x50397c)['end']();};}function respondWithResult(_0x3f3b2c,_0x104025){_0x104025=_0x104025||0xc8;return function(_0x273d87){if(_0x273d87){return _0x3f3b2c[_0xfc88('0x12')](_0x104025)[_0xfc88('0x13')](_0x273d87);}};}function respondWithFilteredResult(_0x4991c9,_0x2886b8){return function(_0x3c23ba){if(_0x3c23ba){var _0x1ba511=typeof _0x2886b8['offset']===_0xfc88('0x14')&&typeof _0x2886b8[_0xfc88('0x15')]===_0xfc88('0x14');var _0x1dfedf=_0x3c23ba[_0xfc88('0x16')];var _0x774edb=_0x1ba511?0x0:_0x2886b8[_0xfc88('0x17')];var _0x2034c0=_0x1ba511?_0x3c23ba[_0xfc88('0x16')]:_0x2886b8[_0xfc88('0x17')]+_0x2886b8['limit'];var _0x3fbcc3;if(_0x2034c0>=_0x1dfedf){_0x2034c0=_0x1dfedf;_0x3fbcc3=0xc8;}else{_0x3fbcc3=0xce;}_0x4991c9[_0xfc88('0x12')](_0x3fbcc3);return _0x4991c9[_0xfc88('0x18')]('Content-Range',_0x774edb+'-'+_0x2034c0+'/'+_0x1dfedf)[_0xfc88('0x13')](_0x3c23ba);}return null;};}function saveUpdates(_0x4684e5){return function(_0xbdf489){if(_0xbdf489){return _0xbdf489[_0xfc88('0x19')](_0x4684e5)[_0xfc88('0x1a')](function(_0x468e97){return _0x468e97;});}return null;};}function removeEntity(_0x33ca25){return function(_0x41b2e1){if(_0x41b2e1){return _0x41b2e1[_0xfc88('0x1b')]()[_0xfc88('0x1a')](function(){_0x33ca25[_0xfc88('0x12')](0xcc)[_0xfc88('0x1c')]();});}};}function handleEntityNotFound(_0xff68d5){return function(_0x29ce52){if(!_0x29ce52){_0xff68d5['sendStatus'](0x194);}return _0x29ce52;};}function handleError(_0x2ba851,_0x122097){_0x122097=_0x122097||0x1f4;return function(_0x207e81){logger[_0xfc88('0x1d')](_0x207e81[_0xfc88('0x1e')]);if(_0x207e81['name']){delete _0x207e81[_0xfc88('0x1f')];}_0x2ba851['status'](_0x122097)[_0xfc88('0x20')](_0x207e81);};}exports[_0xfc88('0x21')]=function(_0x5d56da,_0x2f5e34){var _0x484258={};var _0x4e30c9=_['map'](db[_0xfc88('0x22')]['rawAttributes'],function(_0x5c9736){return{'name':_0x5c9736['fieldName'],'type':_0x5c9736[_0xfc88('0x23')]['key']};});_0x484258=qs['getOptions'](_0x4e30c9,_0x5d56da);return interaction[_0xfc88('0x24')](_0xfc88('0x25'),_0x5d56da['query'],_0x5d56da[_0xfc88('0x26')],_0x484258,_0x4e30c9)[_0xfc88('0x1a')](respondWithFilteredResult(_0x2f5e34,_0x484258))[_0xfc88('0x27')](handleError(_0x2f5e34,null));};exports['show']=function(_0xf417b,_0x2ada5c){var _0x1d6ea9={'raw':![],'where':{'id':_0xf417b[_0xfc88('0x28')]['id']}},_0x32e0d7={};_0x32e0d7[_0xfc88('0x29')]=_['keys'](db[_0xfc88('0x22')][_0xfc88('0x2a')]);_0x32e0d7[_0xfc88('0x2b')]=_[_0xfc88('0x2c')](_0xf417b[_0xfc88('0x2b')]);_0x32e0d7[_0xfc88('0x2d')]=_[_0xfc88('0x2e')](_0x32e0d7[_0xfc88('0x29')],_0x32e0d7[_0xfc88('0x2b')]);_0x1d6ea9['attributes']=_[_0xfc88('0x2e')](_0x32e0d7[_0xfc88('0x29')],qs[_0xfc88('0x2f')](_0xf417b[_0xfc88('0x2b')][_0xfc88('0x2f')]));_0x1d6ea9[_0xfc88('0x30')]=_0x1d6ea9[_0xfc88('0x30')][_0xfc88('0x31')]?_0x1d6ea9['attributes']:_0x32e0d7[_0xfc88('0x29')];if(_0xf417b[_0xfc88('0x2b')][_0xfc88('0x32')]){_0x1d6ea9[_0xfc88('0x33')]=[{'all':!![]}];}_0x1d6ea9=_[_0xfc88('0x34')]({},_0x1d6ea9,_0xf417b[_0xfc88('0x35')]);return db['WhatsappInteraction'][_0xfc88('0x36')](_0x1d6ea9)['then'](handleEntityNotFound(_0x2ada5c,null))['then'](respondWithResult(_0x2ada5c,null))[_0xfc88('0x27')](handleError(_0x2ada5c,null));};exports[_0xfc88('0x37')]=function(_0x198fbc,_0x3e8aa2){return db['WhatsappInteraction'][_0xfc88('0x37')](_0x198fbc[_0xfc88('0x38')],{})[_0xfc88('0x1a')](respondWithResult(_0x3e8aa2,0xc9))[_0xfc88('0x27')](handleError(_0x3e8aa2,null));};exports[_0xfc88('0x19')]=function(_0x59e893,_0x54aa63){if(_0x59e893[_0xfc88('0x38')]['id']){delete _0x59e893[_0xfc88('0x38')]['id'];}return db['WhatsappInteraction'][_0xfc88('0x36')]({'where':{'id':_0x59e893[_0xfc88('0x28')]['id']}})[_0xfc88('0x1a')](handleEntityNotFound(_0x54aa63,null))[_0xfc88('0x1a')](saveUpdates(_0x59e893[_0xfc88('0x38')],null))[_0xfc88('0x1a')](respondWithResult(_0x54aa63,null))[_0xfc88('0x27')](handleError(_0x54aa63,null));};exports[_0xfc88('0x1b')]=function(_0x5293d8,_0x4be235){return db[_0xfc88('0x22')]['find']({'where':{'id':_0x5293d8[_0xfc88('0x28')]['id']}})[_0xfc88('0x1a')](handleEntityNotFound(_0x4be235,null))[_0xfc88('0x1a')](removeEntity(_0x4be235,null))[_0xfc88('0x27')](handleError(_0x4be235,null));};exports[_0xfc88('0x39')]=function(_0x50e7b7,_0x477cfb){return db[_0xfc88('0x22')]['describe']()[_0xfc88('0x1a')](respondWithResult(_0x477cfb,null))[_0xfc88('0x27')](handleError(_0x477cfb,null));};exports['addMessage']=function(_0xc30853,_0x55f142){return db['WhatsappMessage'][_0xfc88('0x36')]({'where':{'id':_0xc30853['params']['id']}})[_0xfc88('0x1a')](handleEntityNotFound(_0x55f142,null))[_0xfc88('0x1a')](function(_0x24c3d0){if(_0x24c3d0){return _0x24c3d0[_0xfc88('0x3a')](_0xc30853['body'][_0xfc88('0x3b')],_[_0xfc88('0x3c')](_0xc30853[_0xfc88('0x38')],[_0xfc88('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x55f142,null))[_0xfc88('0x27')](handleError(_0x55f142,null));};exports[_0xfc88('0x3d')]=function(_0x3ee89e,_0x137d2a){var _0x508694={'raw':![],'where':{}};var _0x23c21e={};var _0x17a135={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xfc88('0x3e')]({'where':{'id':_0x3ee89e[_0xfc88('0x28')]['id']}})[_0xfc88('0x1a')](handleEntityNotFound(_0x137d2a,null))[_0xfc88('0x1a')](function(_0x448876){if(_0x448876){_0x23c21e['model']=_[_0xfc88('0x2c')](db[_0xfc88('0x3f')][_0xfc88('0x2a')]);_0x23c21e[_0xfc88('0x2b')]=_[_0xfc88('0x2c')](_0x3ee89e[_0xfc88('0x2b')]);_0x23c21e[_0xfc88('0x2d')]=_[_0xfc88('0x2e')](_0x23c21e[_0xfc88('0x29')],_0x23c21e[_0xfc88('0x2b')]);_0x508694[_0xfc88('0x30')]=_[_0xfc88('0x2e')](_0x23c21e['model'],qs[_0xfc88('0x2f')](_0x3ee89e[_0xfc88('0x2b')][_0xfc88('0x2f')]));_0x508694[_0xfc88('0x30')]=_0x508694[_0xfc88('0x30')]['length']?_0x508694['attributes']:_0x23c21e['model'];if(!_0x3ee89e[_0xfc88('0x2b')][_0xfc88('0x40')](_0xfc88('0x41'))){_0x508694[_0xfc88('0x15')]=qs[_0xfc88('0x15')](_0x3ee89e[_0xfc88('0x2b')][_0xfc88('0x15')]);_0x508694[_0xfc88('0x17')]=qs[_0xfc88('0x17')](_0x3ee89e[_0xfc88('0x2b')][_0xfc88('0x17')]);}_0x508694[_0xfc88('0x42')]=qs[_0xfc88('0x43')](_0x3ee89e[_0xfc88('0x2b')][_0xfc88('0x43')]);_0x508694[_0xfc88('0x44')]=qs[_0xfc88('0x2d')](_['pick'](_0x3ee89e['query'],_0x23c21e[_0xfc88('0x2d')]));_0x508694[_0xfc88('0x44')]['WhatsappInteractionId']=_0x448876['id'];if(_0x3ee89e[_0xfc88('0x2b')]['filter']){_0x508694[_0xfc88('0x44')]=_['merge'](_0x508694[_0xfc88('0x44')],{'$or':_[_0xfc88('0x45')](_0x508694[_0xfc88('0x30')],function(_0x101a33){var _0x524393={};_0x524393[_0x101a33]={'$like':'%'+_0x3ee89e['query'][_0xfc88('0x46')]+'%'};return _0x524393;})});}if(_0x3ee89e[_0xfc88('0x2b')][_0xfc88('0x47')]){var _0xb2e422=_0x3ee89e[_0xfc88('0x2b')][_0xfc88('0x47')][_0xfc88('0x48')](',');var _0x79baf3={};_0x79baf3[_0xb2e422[0x0]]={'$gte':moment(_0xb2e422[0x1])[_0xfc88('0x49')](_0xfc88('0x4a'))};_0x508694[_0xfc88('0x44')]=_[_0xfc88('0x34')](_0x508694['where'],_0x79baf3);}_0x508694=_[_0xfc88('0x34')]({},_0x508694,_0x3ee89e['options']);return db['WhatsappMessage']['count']({'where':_0x508694[_0xfc88('0x44')]})[_0xfc88('0x1a')](function(_0x21d2f5){_0x17a135[_0xfc88('0x16')]=_0x21d2f5;if(_0x3ee89e[_0xfc88('0x2b')][_0xfc88('0x32')]){_0x508694['include']=[{'all':!![]}];}return db[_0xfc88('0x3f')]['findAll'](_0x508694);})['then'](function(_0x266257){_0x17a135['rows']=_0x266257;return _0x17a135;});}})[_0xfc88('0x1a')](respondWithFilteredResult(_0x137d2a,_0x508694))[_0xfc88('0x27')](handleError(_0x137d2a,null));};exports['addTags']=function(_0xfb8983,_0x5273d3){return db[_0xfc88('0x22')][_0xfc88('0x36')]({'where':{'id':_0xfb8983[_0xfc88('0x28')]['id']}})[_0xfc88('0x1a')](handleEntityNotFound(_0x5273d3,null))[_0xfc88('0x1a')](function(_0x45e799){if(_0x45e799){return _0x45e799[_0xfc88('0x4b')](_0xfb8983[_0xfc88('0x38')]['ids'],_['omit'](_0xfb8983['body'],[_0xfc88('0x3b'),'id'])||{})[_0xfc88('0x4c')](function(){return db[_0xfc88('0x4d')][_0xfc88('0x24')]({'attributes':['id',_0xfc88('0x1f'),_0xfc88('0x4e')],'where':{'id':_0xfb8983['body']['ids']}});})[_0xfc88('0x1a')](function(_0x2b9742){socket[_0xfc88('0x4f')](_0xfc88('0x50'),{'id':Number(_0xfb8983[_0xfc88('0x28')]['id']),'tags':_0x2b9742||[]});return{'id':Number(_0xfb8983[_0xfc88('0x28')]['id']),'tags':_0x2b9742||[]};});}})[_0xfc88('0x1a')](respondWithResult(_0x5273d3,null))[_0xfc88('0x27')](handleError(_0x5273d3,null));};exports['removeTags']=function(_0x101450,_0x316333){return db[_0xfc88('0x22')][_0xfc88('0x36')]({'where':{'id':_0x101450[_0xfc88('0x28')]['id']}})[_0xfc88('0x1a')](handleEntityNotFound(_0x316333,null))[_0xfc88('0x1a')](function(_0x1f018e){if(_0x1f018e){return _0x1f018e[_0xfc88('0x51')](_0x101450[_0xfc88('0x2b')]['ids']);}})[_0xfc88('0x1a')](respondWithStatusCode(_0x316333,null))['catch'](handleError(_0x316333,null));};exports[_0xfc88('0x52')]=function(_0x41ce8,_0x3996fb){var _0x5547f1=moment()['unix']()[_0xfc88('0x53')]();var _0x3b3eab=path[_0xfc88('0x54')](config['root'],_0xfc88('0x55'),'files','tmp');var _0x5a36b9=path[_0xfc88('0x54')](config[_0xfc88('0x56')],_0xfc88('0x55'),_0xfc88('0x57'),'attachments');var _0x204106=path['join'](_0x3b3eab,_0x5547f1);var _0x112610=util[_0xfc88('0x49')](_0xfc88('0x58'),_0x41ce8['params']['id'],_0x5547f1);var _0xf09c34=path['join'](_0x3b3eab,_0x112610);var _0x5f222f=[];_0x5f222f['push']({'model':db[_0xfc88('0x59')],'as':_0xfc88('0x59'),'attributes':['id',_0xfc88('0x5a')],'raw':!![]});_0x5f222f[_0xfc88('0x5b')]({'model':db[_0xfc88('0x5c')],'as':_0xfc88('0x5d'),'attributes':['id',_0xfc88('0x5e'),_0xfc88('0x5f')],'raw':!![]});if(_0x41ce8[_0xfc88('0x2b')][_0xfc88('0x60')]){_0x5f222f[_0xfc88('0x5b')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x129110=[{'model':db[_0xfc88('0x3f')],'as':_0xfc88('0x61'),'attributes':['id','body','createdAt',_0xfc88('0x62'),_0xfc88('0x63'),_0xfc88('0x64')],'include':_0x5f222f}];_0x129110['push']({'model':db[_0xfc88('0x65')],'as':_0xfc88('0x66'),'attributes':['id',_0xfc88('0x1f')]});_0x129110[_0xfc88('0x5b')]({'model':db[_0xfc88('0x59')],'as':'Owner','attributes':['id',_0xfc88('0x5a')]});return db[_0xfc88('0x22')]['find']({'where':{'id':_0x41ce8[_0xfc88('0x28')]['id']},'include':_0x129110})[_0xfc88('0x1a')](handleEntityNotFound(_0x3996fb,null))['then'](function(_0x56a436){if(_0x56a436){var _0x258e33=_0x56a436[_0xfc88('0x67')]({'plain':!![]});fs['mkdirSync'](_0x204106);var _0x347aa6={'channel':_0xfc88('0x68'),'account':_0x258e33[_0xfc88('0x66')]['name'],'agent':_0x258e33[_0xfc88('0x69')]?_0x258e33[_0xfc88('0x69')]['fullname']:_0xfc88('0x6a'),'createdAt':moment(_0x258e33[_0xfc88('0x6b')])[_0xfc88('0x49')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x258e33[_0xfc88('0x6c')]?moment(_0x258e33[_0xfc88('0x6d')])[_0xfc88('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfc88('0x53')]():'','disposition':_0x258e33[_0xfc88('0x6e')],'messages':_(_0x258e33['Messages'])[_0xfc88('0x46')]({'secret':![]})[_0xfc88('0x45')](function(_0x1d1e98){if(_0x1d1e98[_0xfc88('0x6f')]){var _0x37649d=path['join'](_0x5a36b9,_0x1d1e98[_0xfc88('0x6f')][_0xfc88('0x70')]);if(fs['existsSync'](_0x37649d)){fs[_0xfc88('0x71')](_0x37649d)[_0xfc88('0x72')](fs['createWriteStream'](path[_0xfc88('0x54')](_0x204106,_0x1d1e98['Attachment'][_0xfc88('0x70')])));}}return{'date':moment(_0x1d1e98[_0xfc88('0x6b')])[_0xfc88('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfc88('0x53')](),'sender':_0x1d1e98[_0xfc88('0x62')]===_0xfc88('0x73')?_0x1d1e98[_0xfc88('0x59')]?_0x1d1e98[_0xfc88('0x59')][_0xfc88('0x5a')]:_0xfc88('0x74'):_0x1d1e98[_0xfc88('0x5d')][_0xfc88('0x5e')]+(_0x1d1e98[_0xfc88('0x5d')][_0xfc88('0x5f')]?'\x20'+_0x1d1e98[_0xfc88('0x5d')][_0xfc88('0x5f')]:''),'body':_0x1d1e98[_0xfc88('0x6f')]?_0x1d1e98[_0xfc88('0x6f')][_0xfc88('0x70')]:_0x1d1e98[_0xfc88('0x38')],'direction':_0x1d1e98['direction']==='out'?'A':'C','secret':_0x1d1e98[_0xfc88('0x63')],'read':_0x1d1e98[_0xfc88('0x64')],'attachment':_0x1d1e98['Attachment']};})[_0xfc88('0x75')]()};return ejs[_0xfc88('0x76')](path[_0xfc88('0x54')](config[_0xfc88('0x56')],'server','views',_0xfc88('0x77')),{'interaction':_0x347aa6})['then'](function(_0x52cbc1){var _0x47ee46=path['join'](_0x204106,_0xfc88('0x78')+_0x258e33['id']+'-'+_0x5547f1+_0xfc88('0x79'));var _0xc7b430={'path':_0x47ee46,'channel':'Whatsapp','interactionId':_0x258e33['id']};return pdf['createPdfFromHTML'](_0x52cbc1,_0xc7b430);})['then'](function(){return new BPromise(function(_0x24488f,_0xc8fb9c){zipdir(_0x204106,{'saveTo':_0xf09c34},function(_0x3f8fd8,_0x584900){if(_0x3f8fd8)return _0xc8fb9c(_0x3f8fd8);return _0x24488f(_0x584900);});})['then'](function(){return new BPromise(function(_0x5a7c43,_0x2cab16){rimraf(_0x204106,function(_0x4f031a){if(_0x4f031a)_0x2cab16(_0x4f031a);return _0x5a7c43();});});})[_0xfc88('0x1a')](function(){return _0x3996fb[_0xfc88('0x52')](_0xf09c34,_0x112610,function(_0x1dc913){if(_0x1dc913){console[_0xfc88('0x7a')](_0xfc88('0x7b'),_0x1dc913);}else{fs['unlinkSync'](_0xf09c34);}});});});}else{return _0x3996fb[_0xfc88('0x7c')](0xc8);}})[_0xfc88('0x27')](handleError(_0x3996fb,null));}; \ No newline at end of file +var _0x752c=['value','renderFile','downloadInteraction.ejs','.pdf','Whatsapp','createPdfFromHTML','download','err','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','WhatsappInteraction','fieldName','key','getOptions','whatsapp','query','user','show','params','model','rawAttributes','filters','attributes','length','includeAll','options','find','catch','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','keys','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','Tag','findAll','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','Attachment','Messages','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','createdAt','closed','closedAt','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','direction','out','System','lastName'];(function(_0x13a5e2,_0x4e2d46){var _0x42c586=function(_0x935b12){while(--_0x935b12){_0x13a5e2['push'](_0x13a5e2['shift']());}};_0x42c586(++_0x4e2d46);}(_0x752c,0x10e));var _0xc752=function(_0x36e56f,_0x5495cd){_0x36e56f=_0x36e56f-0x0;var _0x15c27f=_0x752c[_0x36e56f];return _0x15c27f;};'use strict';var rimraf=require(_0xc752('0x0'));var zipdir=require(_0xc752('0x1'));var moment=require(_0xc752('0x2'));var BPromise=require('bluebird');var util=require(_0xc752('0x3'));var path=require(_0xc752('0x4'));var ejs=require(_0xc752('0x5'));var fs=require('fs');var _=require(_0xc752('0x6'));var Redis=require(_0xc752('0x7'));var interaction=require(_0xc752('0x8'));var qs=require(_0xc752('0x9'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xc752('0xa'));var config=require(_0xc752('0xb'));var db=require(_0xc752('0xc'))['db'];config[_0xc752('0xd')]=_[_0xc752('0xe')](config[_0xc752('0xd')],{'host':_0xc752('0xf'),'port':0x18eb});var socket=require(_0xc752('0x10'))(new Redis(config['redis']));require(_0xc752('0x11'))[_0xc752('0x12')](socket);function respondWithStatusCode(_0xd6c726,_0xbd0326){_0xbd0326=_0xbd0326||0xcc;return function(_0x260e1c){if(_0x260e1c){return _0xd6c726[_0xc752('0x13')](_0xbd0326);}return _0xd6c726[_0xc752('0x14')](_0xbd0326)[_0xc752('0x15')]();};}function respondWithResult(_0x5d30fb,_0x4a7077){_0x4a7077=_0x4a7077||0xc8;return function(_0x55b9e1){if(_0x55b9e1){return _0x5d30fb['status'](_0x4a7077)[_0xc752('0x16')](_0x55b9e1);}};}function respondWithFilteredResult(_0x287eb6,_0x2448a2){return function(_0x1c21ba){if(_0x1c21ba){var _0x602f42=typeof _0x2448a2[_0xc752('0x17')]===_0xc752('0x18')&&typeof _0x2448a2[_0xc752('0x19')]==='undefined';var _0x26a9ba=_0x1c21ba[_0xc752('0x1a')];var _0x3550fe=_0x602f42?0x0:_0x2448a2[_0xc752('0x17')];var _0x300e41=_0x602f42?_0x1c21ba[_0xc752('0x1a')]:_0x2448a2[_0xc752('0x17')]+_0x2448a2['limit'];var _0x1aa086;if(_0x300e41>=_0x26a9ba){_0x300e41=_0x26a9ba;_0x1aa086=0xc8;}else{_0x1aa086=0xce;}_0x287eb6['status'](_0x1aa086);return _0x287eb6[_0xc752('0x1b')](_0xc752('0x1c'),_0x3550fe+'-'+_0x300e41+'/'+_0x26a9ba)[_0xc752('0x16')](_0x1c21ba);}return null;};}function saveUpdates(_0xcf2d93){return function(_0x33ba53){if(_0x33ba53){return _0x33ba53[_0xc752('0x1d')](_0xcf2d93)[_0xc752('0x1e')](function(_0x46604f){return _0x46604f;});}return null;};}function removeEntity(_0x421adf){return function(_0x34e025){if(_0x34e025){return _0x34e025[_0xc752('0x1f')]()[_0xc752('0x1e')](function(){_0x421adf['status'](0xcc)[_0xc752('0x15')]();});}};}function handleEntityNotFound(_0x4b005a){return function(_0x2d9cd4){if(!_0x2d9cd4){_0x4b005a['sendStatus'](0x194);}return _0x2d9cd4;};}function handleError(_0x1a4f0a,_0x58c346){_0x58c346=_0x58c346||0x1f4;return function(_0x1cd01e){logger[_0xc752('0x20')](_0x1cd01e[_0xc752('0x21')]);if(_0x1cd01e[_0xc752('0x22')]){delete _0x1cd01e['name'];}_0x1a4f0a[_0xc752('0x14')](_0x58c346)[_0xc752('0x23')](_0x1cd01e);};}exports['index']=function(_0x152a8b,_0x50e474){var _0x128507={};var _0x124d3e=_['map'](db[_0xc752('0x24')]['rawAttributes'],function(_0x91ef54){return{'name':_0x91ef54[_0xc752('0x25')],'type':_0x91ef54['type'][_0xc752('0x26')]};});_0x128507=qs[_0xc752('0x27')](_0x124d3e,_0x152a8b);return interaction['findAll'](_0xc752('0x28'),_0x152a8b[_0xc752('0x29')],_0x152a8b[_0xc752('0x2a')],_0x128507,_0x124d3e)[_0xc752('0x1e')](respondWithFilteredResult(_0x50e474,_0x128507))['catch'](handleError(_0x50e474,null));};exports[_0xc752('0x2b')]=function(_0x16e78a,_0x17fa37){var _0x27648e={'raw':![],'where':{'id':_0x16e78a[_0xc752('0x2c')]['id']}},_0x1f8aa8={};_0x1f8aa8[_0xc752('0x2d')]=_['keys'](db[_0xc752('0x24')][_0xc752('0x2e')]);_0x1f8aa8[_0xc752('0x29')]=_['keys'](_0x16e78a['query']);_0x1f8aa8[_0xc752('0x2f')]=_['intersection'](_0x1f8aa8[_0xc752('0x2d')],_0x1f8aa8[_0xc752('0x29')]);_0x27648e[_0xc752('0x30')]=_['intersection'](_0x1f8aa8[_0xc752('0x2d')],qs['fields'](_0x16e78a[_0xc752('0x29')]['fields']));_0x27648e[_0xc752('0x30')]=_0x27648e[_0xc752('0x30')][_0xc752('0x31')]?_0x27648e['attributes']:_0x1f8aa8[_0xc752('0x2d')];if(_0x16e78a['query'][_0xc752('0x32')]){_0x27648e['include']=[{'all':!![]}];}_0x27648e=_['merge']({},_0x27648e,_0x16e78a[_0xc752('0x33')]);return db[_0xc752('0x24')][_0xc752('0x34')](_0x27648e)[_0xc752('0x1e')](handleEntityNotFound(_0x17fa37,null))[_0xc752('0x1e')](respondWithResult(_0x17fa37,null))[_0xc752('0x35')](handleError(_0x17fa37,null));};exports[_0xc752('0x36')]=function(_0xa86366,_0x1e622b){return db['WhatsappInteraction']['create'](_0xa86366[_0xc752('0x37')],{})['then'](respondWithResult(_0x1e622b,0xc9))[_0xc752('0x35')](handleError(_0x1e622b,null));};exports[_0xc752('0x1d')]=function(_0x12c137,_0x31398e){if(_0x12c137['body']['id']){delete _0x12c137[_0xc752('0x37')]['id'];}return db[_0xc752('0x24')]['find']({'where':{'id':_0x12c137[_0xc752('0x2c')]['id']}})[_0xc752('0x1e')](handleEntityNotFound(_0x31398e,null))[_0xc752('0x1e')](saveUpdates(_0x12c137[_0xc752('0x37')],null))[_0xc752('0x1e')](respondWithResult(_0x31398e,null))[_0xc752('0x35')](handleError(_0x31398e,null));};exports[_0xc752('0x1f')]=function(_0x3a7169,_0x1adc2b){return db[_0xc752('0x24')][_0xc752('0x34')]({'where':{'id':_0x3a7169['params']['id']}})['then'](handleEntityNotFound(_0x1adc2b,null))[_0xc752('0x1e')](removeEntity(_0x1adc2b,null))[_0xc752('0x35')](handleError(_0x1adc2b,null));};exports[_0xc752('0x38')]=function(_0x3adac1,_0x57eae5){return db[_0xc752('0x24')][_0xc752('0x38')]()[_0xc752('0x1e')](respondWithResult(_0x57eae5,null))[_0xc752('0x35')](handleError(_0x57eae5,null));};exports[_0xc752('0x39')]=function(_0x119cc1,_0x47e062){return db[_0xc752('0x3a')][_0xc752('0x34')]({'where':{'id':_0x119cc1['params']['id']}})['then'](handleEntityNotFound(_0x47e062,null))[_0xc752('0x1e')](function(_0x151c09){if(_0x151c09){return _0x151c09[_0xc752('0x39')](_0x119cc1[_0xc752('0x37')][_0xc752('0x3b')],_[_0xc752('0x3c')](_0x119cc1[_0xc752('0x37')],[_0xc752('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x47e062,null))[_0xc752('0x35')](handleError(_0x47e062,null));};exports[_0xc752('0x3d')]=function(_0x18d722,_0x1286b2){var _0xd700c3={'raw':![],'where':{}};var _0x15aa21={};var _0x51f797={'count':0x0,'rows':[]};return db[_0xc752('0x24')][_0xc752('0x3e')]({'where':{'id':_0x18d722[_0xc752('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1286b2,null))[_0xc752('0x1e')](function(_0x16970e){if(_0x16970e){_0x15aa21[_0xc752('0x2d')]=_[_0xc752('0x3f')](db['WhatsappMessage']['rawAttributes']);_0x15aa21[_0xc752('0x29')]=_['keys'](_0x18d722[_0xc752('0x29')]);_0x15aa21[_0xc752('0x2f')]=_[_0xc752('0x40')](_0x15aa21[_0xc752('0x2d')],_0x15aa21['query']);_0xd700c3[_0xc752('0x30')]=_[_0xc752('0x40')](_0x15aa21[_0xc752('0x2d')],qs[_0xc752('0x41')](_0x18d722[_0xc752('0x29')][_0xc752('0x41')]));_0xd700c3[_0xc752('0x30')]=_0xd700c3['attributes'][_0xc752('0x31')]?_0xd700c3[_0xc752('0x30')]:_0x15aa21[_0xc752('0x2d')];if(!_0x18d722[_0xc752('0x29')][_0xc752('0x42')](_0xc752('0x43'))){_0xd700c3['limit']=qs[_0xc752('0x19')](_0x18d722[_0xc752('0x29')]['limit']);_0xd700c3[_0xc752('0x17')]=qs['offset'](_0x18d722[_0xc752('0x29')][_0xc752('0x17')]);}_0xd700c3[_0xc752('0x44')]=qs['sort'](_0x18d722[_0xc752('0x29')][_0xc752('0x45')]);_0xd700c3['where']=qs['filters'](_['pick'](_0x18d722[_0xc752('0x29')],_0x15aa21[_0xc752('0x2f')]));_0xd700c3[_0xc752('0x46')]['WhatsappInteractionId']=_0x16970e['id'];if(_0x18d722[_0xc752('0x29')][_0xc752('0x47')]){_0xd700c3['where']=_[_0xc752('0x48')](_0xd700c3[_0xc752('0x46')],{'$or':_[_0xc752('0x49')](_0xd700c3[_0xc752('0x30')],function(_0x5205ad){var _0x26bb85={};_0x26bb85[_0x5205ad]={'$like':'%'+_0x18d722[_0xc752('0x29')][_0xc752('0x47')]+'%'};return _0x26bb85;})});}if(_0x18d722[_0xc752('0x29')][_0xc752('0x4a')]){var _0x284182=_0x18d722[_0xc752('0x29')][_0xc752('0x4a')][_0xc752('0x4b')](',');var _0x491a58={};_0x491a58[_0x284182[0x0]]={'$gte':moment(_0x284182[0x1])[_0xc752('0x4c')](_0xc752('0x4d'))};_0xd700c3[_0xc752('0x46')]=_[_0xc752('0x48')](_0xd700c3[_0xc752('0x46')],_0x491a58);}_0xd700c3=_[_0xc752('0x48')]({},_0xd700c3,_0x18d722[_0xc752('0x33')]);return db[_0xc752('0x3a')][_0xc752('0x1a')]({'where':_0xd700c3['where']})[_0xc752('0x1e')](function(_0x378ead){_0x51f797[_0xc752('0x1a')]=_0x378ead;if(_0x18d722[_0xc752('0x29')][_0xc752('0x32')]){_0xd700c3[_0xc752('0x4e')]=[{'all':!![]}];}return db[_0xc752('0x3a')]['findAll'](_0xd700c3);})[_0xc752('0x1e')](function(_0x2028a6){_0x51f797['rows']=_0x2028a6;return _0x51f797;});}})[_0xc752('0x1e')](respondWithFilteredResult(_0x1286b2,_0xd700c3))[_0xc752('0x35')](handleError(_0x1286b2,null));};exports[_0xc752('0x4f')]=function(_0x5aab12,_0xe93419){return db[_0xc752('0x24')]['find']({'where':{'id':_0x5aab12['params']['id']}})['then'](handleEntityNotFound(_0xe93419,null))[_0xc752('0x1e')](function(_0x3c80a3){if(_0x3c80a3){return _0x3c80a3[_0xc752('0x50')](_0x5aab12[_0xc752('0x37')][_0xc752('0x3b')],_[_0xc752('0x3c')](_0x5aab12['body'],[_0xc752('0x3b'),'id'])||{})['spread'](function(){return db[_0xc752('0x51')][_0xc752('0x52')]({'attributes':['id',_0xc752('0x22'),_0xc752('0x53')],'where':{'id':_0x5aab12[_0xc752('0x37')][_0xc752('0x3b')]}});})[_0xc752('0x1e')](function(_0x3974e9){socket[_0xc752('0x54')](_0xc752('0x55'),{'id':Number(_0x5aab12[_0xc752('0x2c')]['id']),'tags':_0x3974e9||[]});return{'id':Number(_0x5aab12['params']['id']),'tags':_0x3974e9||[]};});}})[_0xc752('0x1e')](respondWithResult(_0xe93419,null))[_0xc752('0x35')](handleError(_0xe93419,null));};exports[_0xc752('0x56')]=function(_0xefbaa8,_0x337765){return db[_0xc752('0x24')][_0xc752('0x34')]({'where':{'id':_0xefbaa8[_0xc752('0x2c')]['id']}})['then'](handleEntityNotFound(_0x337765,null))[_0xc752('0x1e')](function(_0x5805cc){if(_0x5805cc){return _0x5805cc[_0xc752('0x56')](_0xefbaa8[_0xc752('0x29')][_0xc752('0x3b')]);}})[_0xc752('0x1e')](respondWithStatusCode(_0x337765,null))[_0xc752('0x35')](handleError(_0x337765,null));};exports['download']=function(_0x5a23dd,_0x38f898){var _0xc9883d=moment()[_0xc752('0x57')]()[_0xc752('0x58')]();var _0xd07377=path[_0xc752('0x59')](config[_0xc752('0x5a')],'server',_0xc752('0x5b'),_0xc752('0x5c'));var _0x92d953=path['join'](config[_0xc752('0x5a')],_0xc752('0x5d'),_0xc752('0x5b'),_0xc752('0x5e'));var _0x1e86c7=path[_0xc752('0x59')](_0xd07377,_0xc9883d);var _0x408fdb=util[_0xc752('0x4c')](_0xc752('0x5f'),_0x5a23dd[_0xc752('0x2c')]['id'],_0xc9883d);var _0x57379c=path[_0xc752('0x59')](_0xd07377,_0x408fdb);var _0x10a13e=[];_0x10a13e[_0xc752('0x60')]({'model':db['User'],'as':_0xc752('0x61'),'attributes':['id',_0xc752('0x62')],'raw':!![]});_0x10a13e[_0xc752('0x60')]({'model':db['CmContact'],'as':_0xc752('0x63'),'attributes':['id',_0xc752('0x64'),'lastName'],'raw':!![]});if(_0x5a23dd[_0xc752('0x29')][_0xc752('0x5e')]){_0x10a13e['push']({'model':db[_0xc752('0x65')],'as':_0xc752('0x65'),'raw':!![]});}var _0x580509=[{'model':db[_0xc752('0x3a')],'as':_0xc752('0x66'),'attributes':['id',_0xc752('0x37'),'createdAt','direction',_0xc752('0x67'),_0xc752('0x68')],'include':_0x10a13e}];_0x580509[_0xc752('0x60')]({'model':db[_0xc752('0x69')],'as':_0xc752('0x6a'),'attributes':['id',_0xc752('0x22')]});_0x580509[_0xc752('0x60')]({'model':db[_0xc752('0x61')],'as':_0xc752('0x6b'),'attributes':['id',_0xc752('0x62')]});return db[_0xc752('0x24')][_0xc752('0x34')]({'where':{'id':_0x5a23dd[_0xc752('0x2c')]['id']},'include':_0x580509})[_0xc752('0x1e')](handleEntityNotFound(_0x38f898,null))['then'](function(_0x95e76f){if(_0x95e76f){var _0x2084c0=_0x95e76f[_0xc752('0x6c')]({'plain':!![]});fs[_0xc752('0x6d')](_0x1e86c7);var _0x1fbdd5={'channel':'Whatsapp','account':_0x2084c0[_0xc752('0x6a')]['name'],'agent':_0x2084c0['Owner']?_0x2084c0['Owner'][_0xc752('0x62')]:'N.A.','createdAt':moment(_0x2084c0[_0xc752('0x6e')])[_0xc752('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc752('0x58')](),'closedAt':_0x2084c0[_0xc752('0x6f')]?moment(_0x2084c0[_0xc752('0x70')])[_0xc752('0x4c')](_0xc752('0x4d'))[_0xc752('0x58')]():'','disposition':_0x2084c0[_0xc752('0x71')],'messages':_(_0x2084c0[_0xc752('0x66')])[_0xc752('0x47')]({'secret':![]})[_0xc752('0x49')](function(_0x44eb04){if(_0x44eb04['Attachment']){var _0x29c0c5=path[_0xc752('0x59')](_0x92d953,_0x44eb04[_0xc752('0x65')]['basename']);if(fs[_0xc752('0x72')](_0x29c0c5)){fs[_0xc752('0x73')](_0x29c0c5)[_0xc752('0x74')](fs[_0xc752('0x75')](path[_0xc752('0x59')](_0x1e86c7,_0x44eb04[_0xc752('0x65')][_0xc752('0x76')])));}}return{'date':moment(_0x44eb04[_0xc752('0x6e')])['format'](_0xc752('0x4d'))[_0xc752('0x58')](),'sender':_0x44eb04[_0xc752('0x77')]===_0xc752('0x78')?_0x44eb04['User']?_0x44eb04[_0xc752('0x61')][_0xc752('0x62')]:_0xc752('0x79'):_0x44eb04['Contact']['firstName']+(_0x44eb04['Contact'][_0xc752('0x7a')]?'\x20'+_0x44eb04[_0xc752('0x63')][_0xc752('0x7a')]:''),'body':_0x44eb04['Attachment']?_0x44eb04[_0xc752('0x65')][_0xc752('0x76')]:_0x44eb04[_0xc752('0x37')],'direction':_0x44eb04[_0xc752('0x77')]===_0xc752('0x78')?'A':'C','secret':_0x44eb04[_0xc752('0x67')],'read':_0x44eb04[_0xc752('0x68')],'attachment':_0x44eb04['Attachment']};})[_0xc752('0x7b')]()};return ejs[_0xc752('0x7c')](path['join'](config['root'],'server','views',_0xc752('0x7d')),{'interaction':_0x1fbdd5})['then'](function(_0x1bbd27){var _0x4f37fe=path[_0xc752('0x59')](_0x1e86c7,'transcript-'+_0x2084c0['id']+'-'+_0xc9883d+_0xc752('0x7e'));var _0x347f75={'path':_0x4f37fe,'channel':_0xc752('0x7f'),'interactionId':_0x2084c0['id']};return pdf[_0xc752('0x80')](_0x1bbd27,_0x347f75);})[_0xc752('0x1e')](function(){return new BPromise(function(_0x231d70,_0x1be823){zipdir(_0x1e86c7,{'saveTo':_0x57379c},function(_0x21ab35,_0x4f1c1c){if(_0x21ab35)return _0x1be823(_0x21ab35);return _0x231d70(_0x4f1c1c);});})['then'](function(){return new BPromise(function(_0xdff09,_0x4f2ca6){rimraf(_0x1e86c7,function(_0x397727){if(_0x397727)_0x4f2ca6(_0x397727);return _0xdff09();});});})[_0xc752('0x1e')](function(){return _0x38f898[_0xc752('0x81')](_0x57379c,_0x408fdb,function(_0x10e7cd){if(_0x10e7cd){console['log'](_0xc752('0x82'),_0x10e7cd);}else{fs['unlinkSync'](_0x57379c);}});});});}else{return _0x38f898[_0xc752('0x13')](0xc8);}})[_0xc752('0x35')](handleError(_0x38f898,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6450e5a..d8da13a 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 _0xe706=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0xe706,0xa3));var _0x6e70=function(_0x4874c2,_0x3ce845){_0x4874c2=_0x4874c2-0x0;var _0x3cdd3e=_0xe706[_0x4874c2];return _0x3cdd3e;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var WhatsappInteraction=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x6e70('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6e70('0x4')](0x0);var events={'afterCreate':_0x6e70('0x5'),'afterUpdate':_0x6e70('0x6'),'afterDestroy':_0x6e70('0x7')};function emitEvent(_0x2164a4){return function(_0x376a8d,_0x506db9,_0x1b0389){_0x376a8d[_0x6e70('0x8')]({'attributes':['id'],'raw':!![]})[_0x6e70('0x9')](function(_0x293ce7){_0x376a8d[_0x6e70('0xa')](_0x6e70('0xb'),_0x293ce7[_0x6e70('0xc')](function(_0x449b48){return{'id':_0x449b48['id']};}));return WhatsappMessage[_0x6e70('0xd')]({'where':{'WhatsappInteractionId':_0x376a8d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6e70('0x9')](function(_0x100eb7){_0x376a8d[_0x6e70('0xa')](_0x6e70('0xe'),_0x100eb7[_0x6e70('0xf')]);WhatsappInteractionEvents[_0x6e70('0x10')](_0x2164a4+':'+_0x376a8d['id'],_0x376a8d);WhatsappInteractionEvents[_0x6e70('0x10')](_0x2164a4,_0x376a8d);_0x1b0389(null);})['catch'](_0x1b0389(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x6e70('0x11')](e,emitEvent(event));}}module[_0x6e70('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x122a=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','update','setDataValue','Users','findAll','then'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x122a,0xba));var _0xa122=function(_0x1cb265,_0x55048e){_0x1cb265=_0x1cb265-0x0;var _0x42bf86=_0x122a[_0x1cb265];return _0x42bf86;};'use strict';var EventEmitter=require(_0xa122('0x0'));var WhatsappInteraction=require(_0xa122('0x1'))['db'][_0xa122('0x2')];var WhatsappMessage=require(_0xa122('0x1'))['db'][_0xa122('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa122('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c87aa){return function(_0xbd5f48,_0x3de7af,_0x3c8130){_0xbd5f48['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5157f6){_0xbd5f48[_0xa122('0x5')](_0xa122('0x6'),_0x5157f6['map'](function(_0x39cea5){return{'id':_0x39cea5['id']};}));return WhatsappMessage[_0xa122('0x7')]({'where':{'WhatsappInteractionId':_0xbd5f48['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa122('0x8')](function(_0x32314d){_0xbd5f48['setDataValue']('unreadMessages',_0x32314d['length']);WhatsappInteractionEvents[_0xa122('0x9')](_0x1c87aa+':'+_0xbd5f48['id'],_0xbd5f48);WhatsappInteractionEvents['emit'](_0x1c87aa,_0xbd5f48);_0x3c8130(null);})[_0xa122('0xa')](_0x3c8130(null));};}for(var e in events){if(events[_0xa122('0xb')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xa122('0xc')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 20d4371..6a98ee4 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 _0x8c48=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x302272,_0x25a74b){var _0x1bde97=function(_0x166d1b){while(--_0x166d1b){_0x302272['push'](_0x302272['shift']());}};_0x1bde97(++_0x25a74b);}(_0x8c48,0x7b));var _0x88c4=function(_0x1feb4f,_0x55d0b9){_0x1feb4f=_0x1feb4f-0x0;var _0x140428=_0x8c48[_0x1feb4f];return _0x140428;};'use strict';var _=require('lodash');var util=require(_0x88c4('0x0'));var logger=require(_0x88c4('0x1'))(_0x88c4('0x2'));var moment=require(_0x88c4('0x3'));var BPromise=require(_0x88c4('0x4'));var rp=require(_0x88c4('0x5'));var fs=require('fs');var path=require(_0x88c4('0x6'));var rimraf=require(_0x88c4('0x7'));var config=require('../../config/environment');var attributes=require(_0x88c4('0x8'));module[_0x88c4('0x9')]=function(_0x5f8bd7,_0x350767){return _0x5f8bd7[_0x88c4('0xa')](_0x88c4('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x10ac12,_0x89837e,_0x18f164){if(_0x10ac12['changed'](_0x88c4('0xc'))){_0x10ac12[_0x88c4('0xd')]=moment()['format'](_0x88c4('0xe'));}_0x18f164(null,_0x10ac12);}}});}; \ No newline at end of file +var _0x3419=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','WhatsappInteraction','whatsapp_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x5b79a9,_0x54de44){var _0x1935a2=function(_0x10f5c5){while(--_0x10f5c5){_0x5b79a9['push'](_0x5b79a9['shift']());}};_0x1935a2(++_0x54de44);}(_0x3419,0xb3));var _0x9341=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0x3419[_0x5c4d27];return _0x1dda1a;};'use strict';var _=require(_0x9341('0x0'));var util=require(_0x9341('0x1'));var logger=require(_0x9341('0x2'))(_0x9341('0x3'));var moment=require(_0x9341('0x4'));var BPromise=require('bluebird');var rp=require(_0x9341('0x5'));var fs=require('fs');var path=require(_0x9341('0x6'));var rimraf=require(_0x9341('0x7'));var config=require(_0x9341('0x8'));var attributes=require(_0x9341('0x9'));module['exports']=function(_0xa36232,_0x204ee){return _0xa36232['define'](_0x9341('0xa'),attributes,{'tableName':_0x9341('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x188d3b,_0x3b736e,_0x46a334){if(_0x188d3b[_0x9341('0xc')]('closed')){_0x188d3b[_0x9341('0xd')]=moment()['format'](_0x9341('0xe'));}_0x46a334(null,_0x188d3b);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c3b257a..0b36529 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 _0x98ce=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','find','where','addTags','omit','spread','AddTags','lodash','randomstring'];(function(_0x55d143,_0x4836e2){var _0x29c2f7=function(_0xa65606){while(--_0xa65606){_0x55d143['push'](_0x55d143['shift']());}};_0x29c2f7(++_0x4836e2);}(_0x98ce,0x1d2));var _0xe98c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x98ce[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe98c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe98c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe98c('0x2'));var logger=require(_0xe98c('0x3'))(_0xe98c('0x4'));var config=require(_0xe98c('0x5'));var jayson=require(_0xe98c('0x6'));var client=jayson[_0xe98c('0x7')][_0xe98c('0x8')]({'port':0x232a});config['redis']=_[_0xe98c('0x9')](config[_0xe98c('0xa')],{'host':_0xe98c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe98c('0xc'))[_0xe98c('0xd')](socket);function respondWithRpcPromise(_0x20ac25,_0x564c05,_0x427a2f){return new BPromise(function(_0x4a5575,_0x1479ce){return client[_0xe98c('0xe')](_0x20ac25,_0x427a2f)[_0xe98c('0xf')](function(_0x332853){logger[_0xe98c('0x10')](_0xe98c('0x11'),_0x564c05,'request\x20sent');logger[_0xe98c('0x12')](_0xe98c('0x13'),_0x564c05,'request\x20sent',JSON[_0xe98c('0x14')](_0x332853));if(_0x332853[_0xe98c('0x15')]){if(_0x332853[_0xe98c('0x15')][_0xe98c('0x16')]===0x1f4){logger[_0xe98c('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x564c05,_0x332853['error']['message']);return _0x1479ce(_0x332853[_0xe98c('0x15')]['message']);}logger[_0xe98c('0x15')](_0xe98c('0x11'),_0x564c05,_0x332853[_0xe98c('0x15')][_0xe98c('0x17')]);return _0x4a5575(_0x332853[_0xe98c('0x15')][_0xe98c('0x17')]);}else{logger[_0xe98c('0x10')](_0xe98c('0x11'),_0x564c05,_0xe98c('0x18'));_0x4a5575(_0x332853['result'][_0xe98c('0x17')]);}})[_0xe98c('0x19')](function(_0x1d52ec){logger[_0xe98c('0x15')](_0xe98c('0x11'),_0x564c05,_0x1d52ec);_0x1479ce(_0x1d52ec);});});}exports[_0xe98c('0x1a')]=function(_0x284ea6){var _0x39ca12=this;return new Promise(function(_0x146cbf,_0x5f3e36){return db[_0xe98c('0x1b')][_0xe98c('0x1c')](_0x284ea6[_0xe98c('0x1d')],{'raw':_0x284ea6['options']?_0x284ea6[_0xe98c('0x1e')][_0xe98c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x284ea6['options']?_0x284ea6['options']['where']||null:null,'attributes':_0x284ea6['options']?_0x284ea6[_0xe98c('0x1e')][_0xe98c('0x20')]||null:null,'limit':_0x284ea6[_0xe98c('0x1e')]?_0x284ea6['options']['limit']||null:null})[_0xe98c('0xf')](function(_0x596c93){logger[_0xe98c('0x10')](_0xe98c('0x1a'),_0x284ea6);logger[_0xe98c('0x12')](_0xe98c('0x1a'),_0x284ea6,JSON['stringify'](_0x596c93));_0x146cbf(_0x596c93);})[_0xe98c('0x19')](function(_0x42083a){logger[_0xe98c('0x15')]('UpdateWhatsappInteraction',_0x42083a['message'],_0x284ea6);_0x5f3e36(_0x39ca12[_0xe98c('0x15')](0x1f4,_0x42083a[_0xe98c('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0xc3da88){return new Promise(function(_0x5d5fe7,_0x8d37fb){return db['WhatsappInteraction'][_0xe98c('0x21')]({'where':_0xc3da88[_0xe98c('0x1e')]?_0xc3da88[_0xe98c('0x1e')][_0xe98c('0x22')]||null:null})[_0xe98c('0xf')](function(_0x1a76ed){if(_0x1a76ed){return _0x1a76ed[_0xe98c('0x23')](_0xc3da88[_0xe98c('0x1d')]['ids'],_[_0xe98c('0x24')](_0xc3da88[_0xe98c('0x1d')],['ids','id'])||{});}})[_0xe98c('0x25')](function(_0x366d79){logger['info']('AddTags',_0xc3da88);logger[_0xe98c('0x12')](_0xe98c('0x26'),_0xc3da88,JSON[_0xe98c('0x14')](_0x366d79));_0x5d5fe7(_0x366d79);})[_0xe98c('0x19')](function(_0x39248d){logger['error'](_0xe98c('0x26'),_0x39248d['message'],_0xc3da88);_0x8d37fb(_this[_0xe98c('0x15')](0x1f4,_0x39248d[_0xe98c('0x17')]));});});}; \ No newline at end of file +var _0xc502=['../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','raw','options','attributes','limit','then','AddTagsToWhatsappInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x41f4b7,_0x4c867d){var _0xe93221=function(_0x359cb5){while(--_0x359cb5){_0x41f4b7['push'](_0x41f4b7['shift']());}};_0xe93221(++_0x4c867d);}(_0xc502,0x81));var _0x2c50=function(_0x27af8e,_0x44328b){_0x27af8e=_0x27af8e-0x0;var _0x3d00f8=_0xc502[_0x27af8e];return _0x3d00f8;};'use strict';var _=require(_0x2c50('0x0'));var util=require(_0x2c50('0x1'));var moment=require('moment');var BPromise=require(_0x2c50('0x2'));var rs=require(_0x2c50('0x3'));var fs=require('fs');var Redis=require(_0x2c50('0x4'));var db=require(_0x2c50('0x5'))['db'];var utils=require(_0x2c50('0x6'));var logger=require(_0x2c50('0x7'))(_0x2c50('0x8'));var config=require(_0x2c50('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2c50('0xa')][_0x2c50('0xb')]({'port':0x232a});config['redis']=_[_0x2c50('0xc')](config[_0x2c50('0xd')],{'host':_0x2c50('0xe'),'port':0x18eb});var socket=require(_0x2c50('0xf'))(new Redis(config[_0x2c50('0xd')]));require(_0x2c50('0x10'))[_0x2c50('0x11')](socket);function respondWithRpcPromise(_0x4061d2,_0x1a9cef,_0x344cb2){return new BPromise(function(_0x27777d,_0x1b0d80){return client[_0x2c50('0x12')](_0x4061d2,_0x344cb2)['then'](function(_0x51a3a6){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x1a9cef,'request\x20sent');logger[_0x2c50('0x13')](_0x2c50('0x14'),_0x1a9cef,_0x2c50('0x15'),JSON[_0x2c50('0x16')](_0x51a3a6));if(_0x51a3a6[_0x2c50('0x17')]){if(_0x51a3a6[_0x2c50('0x17')][_0x2c50('0x18')]===0x1f4){logger[_0x2c50('0x17')](_0x2c50('0x19'),_0x1a9cef,_0x51a3a6[_0x2c50('0x17')][_0x2c50('0x1a')]);return _0x1b0d80(_0x51a3a6[_0x2c50('0x17')][_0x2c50('0x1a')]);}logger[_0x2c50('0x17')](_0x2c50('0x19'),_0x1a9cef,_0x51a3a6[_0x2c50('0x17')][_0x2c50('0x1a')]);return _0x27777d(_0x51a3a6[_0x2c50('0x17')][_0x2c50('0x1a')]);}else{logger[_0x2c50('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x1a9cef,'request\x20sent');_0x27777d(_0x51a3a6[_0x2c50('0x1c')]['message']);}})[_0x2c50('0x1d')](function(_0x158968){logger[_0x2c50('0x17')](_0x2c50('0x19'),_0x1a9cef,_0x158968);_0x1b0d80(_0x158968);});});}exports[_0x2c50('0x1e')]=function(_0x3211c5){var _0x40809d=this;return new Promise(function(_0x43bf44,_0xcf9058){return db[_0x2c50('0x1f')][_0x2c50('0x20')](_0x3211c5[_0x2c50('0x21')],{'raw':_0x3211c5['options']?_0x3211c5['options'][_0x2c50('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3211c5[_0x2c50('0x23')]?_0x3211c5[_0x2c50('0x23')]['where']||null:null,'attributes':_0x3211c5[_0x2c50('0x23')]?_0x3211c5['options'][_0x2c50('0x24')]||null:null,'limit':_0x3211c5[_0x2c50('0x23')]?_0x3211c5[_0x2c50('0x23')][_0x2c50('0x25')]||null:null})[_0x2c50('0x26')](function(_0x431491){logger[_0x2c50('0x1b')](_0x2c50('0x1e'),_0x3211c5);logger[_0x2c50('0x13')](_0x2c50('0x1e'),_0x3211c5,JSON[_0x2c50('0x16')](_0x431491));_0x43bf44(_0x431491);})[_0x2c50('0x1d')](function(_0x39d68a){logger[_0x2c50('0x17')](_0x2c50('0x1e'),_0x39d68a[_0x2c50('0x1a')],_0x3211c5);_0xcf9058(_0x40809d[_0x2c50('0x17')](0x1f4,_0x39d68a[_0x2c50('0x1a')]));});});};exports[_0x2c50('0x27')]=function(_0x142179){return new Promise(function(_0x35f69c,_0xbf1877){return db[_0x2c50('0x1f')]['find']({'where':_0x142179[_0x2c50('0x23')]?_0x142179[_0x2c50('0x23')][_0x2c50('0x28')]||null:null})[_0x2c50('0x26')](function(_0x172af5){if(_0x172af5){return _0x172af5[_0x2c50('0x29')](_0x142179[_0x2c50('0x21')][_0x2c50('0x2a')],_[_0x2c50('0x2b')](_0x142179['body'],['ids','id'])||{});}})[_0x2c50('0x2c')](function(_0x32972d){logger[_0x2c50('0x1b')](_0x2c50('0x2d'),_0x142179);logger[_0x2c50('0x13')](_0x2c50('0x2d'),_0x142179,JSON['stringify'](_0x32972d));_0x35f69c(_0x32972d);})[_0x2c50('0x1d')](function(_0x2b3546){logger[_0x2c50('0x17')](_0x2c50('0x2d'),_0x2b3546[_0x2c50('0x1a')],_0x142179);_0xbf1877(_this[_0x2c50('0x17')](0x1f4,_0x2b3546[_0x2c50('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index ae427cf..4b74b1d 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 _0xbc79=['register','length','whatsappInteraction:','./whatsappInteraction.events','remove','update'];(function(_0x540302,_0x5be2df){var _0x2e92a3=function(_0x2a350e){while(--_0x2a350e){_0x540302['push'](_0x540302['shift']());}};_0x2e92a3(++_0x5be2df);}(_0xbc79,0x1dd));var _0x9bc7=function(_0x59ae54,_0x1ad8ff){_0x59ae54=_0x59ae54-0x0;var _0x45633d=_0xbc79[_0x59ae54];return _0x45633d;};'use strict';var WhatsappInteractionEvents=require(_0x9bc7('0x0'));var events=['save',_0x9bc7('0x1'),_0x9bc7('0x2')];function createListener(_0x465a8a,_0x4b5f84){return function(_0x38c84a){_0x4b5f84['emit'](_0x465a8a,_0x38c84a);};}function removeListener(_0xedda36,_0x2f77c6){return function(){WhatsappInteractionEvents['removeListener'](_0xedda36,_0x2f77c6);};}exports[_0x9bc7('0x3')]=function(_0x47cfc6){for(var _0x53c6b9=0x0,_0x5e8a86=events[_0x9bc7('0x4')];_0x53c6b9<_0x5e8a86;_0x53c6b9++){var _0x35813a=events[_0x53c6b9];var _0x46453b=createListener(_0x9bc7('0x5')+_0x35813a,_0x47cfc6);WhatsappInteractionEvents['on'](_0x35813a,_0x46453b);}}; \ No newline at end of file +var _0x4f81=['register','length','whatsappInteraction:','./whatsappInteraction.events','emit','removeListener'];(function(_0x11f9a8,_0x577a6c){var _0x1d3ab0=function(_0x55782c){while(--_0x55782c){_0x11f9a8['push'](_0x11f9a8['shift']());}};_0x1d3ab0(++_0x577a6c);}(_0x4f81,0x105));var _0x14f8=function(_0x2db8fc,_0x44e6f7){_0x2db8fc=_0x2db8fc-0x0;var _0x182c1a=_0x4f81[_0x2db8fc];return _0x182c1a;};'use strict';var WhatsappInteractionEvents=require(_0x14f8('0x0'));var events=['save','remove','update'];function createListener(_0x19edfc,_0x12f2bf){return function(_0x758a38){_0x12f2bf[_0x14f8('0x1')](_0x19edfc,_0x758a38);};}function removeListener(_0x13544c,_0x2a81ac){return function(){WhatsappInteractionEvents[_0x14f8('0x2')](_0x13544c,_0x2a81ac);};}exports[_0x14f8('0x3')]=function(_0x5b7604){for(var _0x13a07f=0x0,_0x52396b=events[_0x14f8('0x4')];_0x13a07f<_0x52396b;_0x13a07f++){var _0x55c44d=events[_0x13a07f];var _0x3673c3=createListener(_0x14f8('0x5')+_0x55c44d,_0x5b7604);WhatsappInteractionEvents['on'](_0x55c44d,_0x3673c3);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 419d80a..2984d80 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 _0x338a=['/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','status','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get'];(function(_0x2b4df2,_0x794042){var _0x45c216=function(_0x30f87a){while(--_0x30f87a){_0x2b4df2['push'](_0x2b4df2['shift']());}};_0x45c216(++_0x794042);}(_0x338a,0x199));var _0xa338=function(_0x4716b6,_0xd37c3d){_0x4716b6=_0x4716b6-0x0;var _0x3e377b=_0x338a[_0x4716b6];return _0x3e377b;};'use strict';var multer=require(_0xa338('0x0'));var util=require('util');var path=require(_0xa338('0x1'));var timeout=require(_0xa338('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa338('0x3'));var auth=require(_0xa338('0x4'));var interaction=require(_0xa338('0x5'));var config=require(_0xa338('0x6'));var controller=require(_0xa338('0x7'));router['get']('/',auth[_0xa338('0x8')](),controller[_0xa338('0x9')]);router[_0xa338('0xa')](_0xa338('0xb'),auth[_0xa338('0x8')](),controller['describe']);router['get'](_0xa338('0xc'),auth['isAuthenticated'](),controller[_0xa338('0xd')]);router[_0xa338('0xe')]('/',auth[_0xa338('0x8')](),interaction[_0xa338('0xf')](_0xa338('0x10'),_0xa338('0x11')),controller[_0xa338('0x12')]);router['post']('/:id/status',controller[_0xa338('0x13')]);router[_0xa338('0x14')](_0xa338('0xc'),auth[_0xa338('0x8')](),controller[_0xa338('0x15')]);router[_0xa338('0x14')]('/:id/accept',auth[_0xa338('0x8')](),controller[_0xa338('0x16')]);router[_0xa338('0x14')](_0xa338('0x17'),auth[_0xa338('0x8')](),controller[_0xa338('0x18')]);router[_0xa338('0x19')](_0xa338('0xc'),auth[_0xa338('0x8')](),controller[_0xa338('0x1a')]);module[_0xa338('0x1b')]=router; \ No newline at end of file +var _0x0825=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','/:id','show','tracked','whatsappmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','reject','destroy','exports','multer'];(function(_0x14939b,_0x1c661b){var _0x2e02ad=function(_0x3f32ae){while(--_0x3f32ae){_0x14939b['push'](_0x14939b['shift']());}};_0x2e02ad(++_0x1c661b);}(_0x0825,0x185));var _0x5082=function(_0x2d95b2,_0x591e78){_0x2d95b2=_0x2d95b2-0x0;var _0x4f18e6=_0x0825[_0x2d95b2];return _0x4f18e6;};'use strict';var multer=require(_0x5082('0x0'));var util=require('util');var path=require(_0x5082('0x1'));var timeout=require('connect-timeout');var express=require(_0x5082('0x2'));var router=express[_0x5082('0x3')]();var fs_extra=require(_0x5082('0x4'));var auth=require(_0x5082('0x5'));var interaction=require(_0x5082('0x6'));var config=require(_0x5082('0x7'));var controller=require(_0x5082('0x8'));router[_0x5082('0x9')]('/',auth[_0x5082('0xa')](),controller['index']);router[_0x5082('0x9')](_0x5082('0xb'),auth[_0x5082('0xa')](),controller['describe']);router[_0x5082('0x9')](_0x5082('0xc'),auth[_0x5082('0xa')](),controller[_0x5082('0xd')]);router['post']('/',auth[_0x5082('0xa')](),interaction[_0x5082('0xe')]('whatsapp',_0x5082('0xf')),controller[_0x5082('0x10')]);router['post'](_0x5082('0x11'),controller[_0x5082('0x12')]);router['put'](_0x5082('0xc'),auth['isAuthenticated'](),controller[_0x5082('0x13')]);router[_0x5082('0x14')](_0x5082('0x15'),auth[_0x5082('0xa')](),controller[_0x5082('0x16')]);router['put']('/:id/reject',auth[_0x5082('0xa')](),controller[_0x5082('0x17')]);router['delete'](_0x5082('0xc'),auth[_0x5082('0xa')](),controller[_0x5082('0x18')]);module[_0x5082('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 851743d..b7a4249 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 _0x1650=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT','medium'];(function(_0x4eb954,_0x533f54){var _0x34ec5a=function(_0x5b1712){while(--_0x5b1712){_0x4eb954['push'](_0x4eb954['shift']());}};_0x34ec5a(++_0x533f54);}(_0x1650,0x13d));var _0x0165=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0x1650[_0x261b8a];return _0x3455e8;};'use strict';var Sequelize=require(_0x0165('0x0'));module['exports']={'body':{'type':Sequelize[_0x0165('0x1')](_0x0165('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0165('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0165('0x4')]('in',_0x0165('0x5')),'defaultValue':_0x0165('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x0165('0x6')]},'readAt':{'type':Sequelize[_0x0165('0x7')]},'secret':{'type':Sequelize[_0x0165('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0165('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdfe9=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xdfe9,0x199));var _0x9dfe=function(_0x397d5d,_0x559356){_0x397d5d=_0x397d5d-0x0;var _0x34cf7d=_0xdfe9[_0x397d5d];return _0x34cf7d;};'use strict';var Sequelize=require(_0x9dfe('0x0'));module[_0x9dfe('0x1')]={'body':{'type':Sequelize[_0x9dfe('0x2')](_0x9dfe('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9dfe('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9dfe('0x5')]('in',_0x9dfe('0x6')),'defaultValue':_0x9dfe('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x9dfe('0x7')]},'readAt':{'type':Sequelize[_0x9dfe('0x8')]},'secret':{'type':Sequelize[_0x9dfe('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9dfe('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 68e1d51..956b8f4 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 _0xe3c8=['../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappMessage.socket','register','http','client','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','WhatsappMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','show','params','length','includeAll','include','options','find','create','body','describe','whatsapp-interactions','whatsapp','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','null','RejectMessage','fullname','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x61eb70,_0x3121e2){var _0x1dbb57=function(_0x12e67c){while(--_0x12e67c){_0x61eb70['push'](_0x61eb70['shift']());}};_0x1dbb57(++_0x3121e2);}(_0xe3c8,0xfb));var _0x8e3c=function(_0x107efc,_0x51ca84){_0x107efc=_0x107efc-0x0;var _0x569134=_0xe3c8[_0x107efc];return _0x569134;};'use strict';var emlformat=require(_0x8e3c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e3c('0x1'));var jsonpatch=require(_0x8e3c('0x2'));var rp=require(_0x8e3c('0x3'));var moment=require(_0x8e3c('0x4'));var BPromise=require(_0x8e3c('0x5'));var Mustache=require(_0x8e3c('0x6'));var util=require(_0x8e3c('0x7'));var path=require(_0x8e3c('0x8'));var sox=require('sox');var csv=require(_0x8e3c('0x9'));var ejs=require(_0x8e3c('0xa'));var fs=require('fs');var fs_extra=require(_0x8e3c('0xb'));var _=require('lodash');var squel=require(_0x8e3c('0xc'));var crypto=require(_0x8e3c('0xd'));var jsforce=require(_0x8e3c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8e3c('0xf'));var Papa=require(_0x8e3c('0x10'));var Redis=require(_0x8e3c('0x11'));var authService=require(_0x8e3c('0x12'));var qs=require(_0x8e3c('0x13'));var as=require(_0x8e3c('0x14'));var hardwareService=require(_0x8e3c('0x15'));var logger=require(_0x8e3c('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x8e3c('0x17'));var licenseUtil=require(_0x8e3c('0x18'));var db=require(_0x8e3c('0x19'))['db'];config[_0x8e3c('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8e3c('0x1b'))(new Redis(config[_0x8e3c('0x1a')]));require(_0x8e3c('0x1c'))[_0x8e3c('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8e3c('0x1e')]({'port':0x232c});var client9002=jayson[_0x8e3c('0x1f')][_0x8e3c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x18ee78,_0x389348,_0x5dbc28,_0x5cc91e){return new BPromise(function(_0x428a7d,_0x469cba){var _0x244389=_0x5cc91e||client;return _0x244389['request'](_0x18ee78,_0x5dbc28)['then'](function(_0x16a006){logger['info'](_0x8e3c('0x20'),_0x389348,_0x8e3c('0x21'));logger[_0x8e3c('0x22')](_0x8e3c('0x23'),_0x389348,_0x8e3c('0x21'),JSON[_0x8e3c('0x24')](_0x16a006));if(_0x16a006[_0x8e3c('0x25')]){if(_0x16a006[_0x8e3c('0x25')]['code']===0x1f4){logger[_0x8e3c('0x25')](_0x8e3c('0x20'),_0x389348,_0x16a006['error'][_0x8e3c('0x26')]);return _0x469cba(_0x16a006[_0x8e3c('0x25')][_0x8e3c('0x26')]);}logger[_0x8e3c('0x25')](_0x8e3c('0x20'),_0x389348,_0x16a006['error']['message']);return _0x428a7d(_0x16a006[_0x8e3c('0x25')][_0x8e3c('0x26')]);}else{logger[_0x8e3c('0x27')](_0x8e3c('0x20'),_0x389348,_0x8e3c('0x21'));_0x428a7d(_0x16a006['result'][_0x8e3c('0x26')]);}})[_0x8e3c('0x28')](function(_0x1b53e3){logger[_0x8e3c('0x25')](_0x8e3c('0x20'),_0x389348,_0x1b53e3);_0x469cba(_0x1b53e3);});});}function respondWithStatusCode(_0x59579d,_0x36a3ad){_0x36a3ad=_0x36a3ad||0xcc;return function(_0x5a1003){if(_0x5a1003){return _0x59579d[_0x8e3c('0x29')](_0x36a3ad);}return _0x59579d[_0x8e3c('0x2a')](_0x36a3ad)[_0x8e3c('0x2b')]();};}function respondWithResult(_0x40894b,_0x10a3b1){_0x10a3b1=_0x10a3b1||0xc8;return function(_0x1ec004){if(_0x1ec004){return _0x40894b[_0x8e3c('0x2a')](_0x10a3b1)[_0x8e3c('0x2c')](_0x1ec004);}};}function respondWithFilteredResult(_0x157252,_0x2245c5){return function(_0x428905){if(_0x428905){var _0x36d486=typeof _0x2245c5[_0x8e3c('0x2d')]==='undefined'&&typeof _0x2245c5[_0x8e3c('0x2e')]===_0x8e3c('0x2f');var _0x862351=_0x428905[_0x8e3c('0x30')];var _0x406cba=_0x36d486?0x0:_0x2245c5[_0x8e3c('0x2d')];var _0x26be10=_0x36d486?_0x428905[_0x8e3c('0x30')]:_0x2245c5[_0x8e3c('0x2d')]+_0x2245c5['limit'];var _0x343bac;if(_0x26be10>=_0x862351){_0x26be10=_0x862351;_0x343bac=0xc8;}else{_0x343bac=0xce;}_0x157252[_0x8e3c('0x2a')](_0x343bac);return _0x157252['set'](_0x8e3c('0x31'),_0x406cba+'-'+_0x26be10+'/'+_0x862351)[_0x8e3c('0x2c')](_0x428905);}return null;};}function patchUpdates(_0x4487c9){return function(_0x18879e){try{jsonpatch[_0x8e3c('0x32')](_0x18879e,_0x4487c9,!![]);}catch(_0x449470){return BPromise[_0x8e3c('0x33')](_0x449470);}return _0x18879e['save']();};}function saveUpdates(_0x4cfb17,_0x24cf7a){return function(_0x874b33){if(_0x874b33){return _0x874b33[_0x8e3c('0x34')](_0x4cfb17)[_0x8e3c('0x35')](function(_0x280ec9){return _0x280ec9;});}return null;};}function removeEntity(_0x4e3879,_0x30109f){return function(_0x574dab){if(_0x574dab){return _0x574dab[_0x8e3c('0x36')]()[_0x8e3c('0x35')](function(){_0x4e3879[_0x8e3c('0x2a')](0xcc)[_0x8e3c('0x2b')]();});}};}function handleEntityNotFound(_0x2d0aba,_0xd54981){return function(_0x405d0d){if(!_0x405d0d){_0x2d0aba[_0x8e3c('0x29')](0x194);}return _0x405d0d;};}function handleError(_0x46fcc3,_0x4b8162){_0x4b8162=_0x4b8162||0x1f4;return function(_0x40e40f){logger[_0x8e3c('0x25')](_0x40e40f[_0x8e3c('0x37')]);if(_0x40e40f[_0x8e3c('0x38')]){delete _0x40e40f['name'];}_0x46fcc3[_0x8e3c('0x2a')](_0x4b8162)[_0x8e3c('0x39')](_0x40e40f);};}exports[_0x8e3c('0x3a')]=function(_0x38df3f,_0x82bf50){var _0x463226={},_0x175f35={},_0x2dd69a={'count':0x0,'rows':[]};var _0x4a07c4=_['map'](db[_0x8e3c('0x3b')][_0x8e3c('0x3c')],function(_0x52766a){return{'name':_0x52766a['fieldName'],'type':_0x52766a[_0x8e3c('0x3d')][_0x8e3c('0x3e')]};});_0x175f35[_0x8e3c('0x3f')]=_['map'](_0x4a07c4,_0x8e3c('0x38'));_0x175f35[_0x8e3c('0x40')]=_[_0x8e3c('0x41')](_0x38df3f[_0x8e3c('0x40')]);_0x175f35[_0x8e3c('0x42')]=_['intersection'](_0x175f35[_0x8e3c('0x3f')],_0x175f35['query']);_0x463226['attributes']=_[_0x8e3c('0x43')](_0x175f35['model'],qs[_0x8e3c('0x44')](_0x38df3f[_0x8e3c('0x40')][_0x8e3c('0x44')]));_0x463226[_0x8e3c('0x45')]=_0x463226[_0x8e3c('0x45')]['length']?_0x463226[_0x8e3c('0x45')]:_0x175f35['model'];if(!_0x38df3f['query']['hasOwnProperty'](_0x8e3c('0x46'))){_0x463226[_0x8e3c('0x2e')]=qs['limit'](_0x38df3f[_0x8e3c('0x40')][_0x8e3c('0x2e')]);_0x463226[_0x8e3c('0x2d')]=qs[_0x8e3c('0x2d')](_0x38df3f[_0x8e3c('0x40')][_0x8e3c('0x2d')]);}_0x463226[_0x8e3c('0x47')]=qs[_0x8e3c('0x48')](_0x38df3f[_0x8e3c('0x40')][_0x8e3c('0x48')]);_0x463226[_0x8e3c('0x49')]=qs[_0x8e3c('0x42')](_[_0x8e3c('0x4a')](_0x38df3f[_0x8e3c('0x40')],_0x175f35[_0x8e3c('0x42')]),_0x4a07c4);if(_0x38df3f[_0x8e3c('0x40')][_0x8e3c('0x4b')]){_0x463226[_0x8e3c('0x49')]=_['merge'](_0x463226[_0x8e3c('0x49')],{'$or':_['map'](_0x4a07c4,function(_0xf33194){if(_0xf33194[_0x8e3c('0x3d')]!==_0x8e3c('0x4c')){var _0x1e1d5d={};_0x1e1d5d[_0xf33194[_0x8e3c('0x38')]]={'$like':'%'+_0x38df3f[_0x8e3c('0x40')][_0x8e3c('0x4b')]+'%'};return _0x1e1d5d;}})});}_0x463226=_[_0x8e3c('0x4d')]({},_0x463226,_0x38df3f['options']);var _0x4c7bb8={'where':_0x463226[_0x8e3c('0x49')]};return db[_0x8e3c('0x3b')]['count'](_0x4c7bb8)['then'](function(_0x444095){_0x2dd69a[_0x8e3c('0x30')]=_0x444095;if(_0x38df3f[_0x8e3c('0x40')]['includeAll']){_0x463226['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x8e3c('0x4e')](_0x463226);})['then'](function(_0x853d30){_0x2dd69a[_0x8e3c('0x4f')]=_0x853d30;return _0x2dd69a;})[_0x8e3c('0x35')](respondWithFilteredResult(_0x82bf50,_0x463226))[_0x8e3c('0x28')](handleError(_0x82bf50,null));};exports[_0x8e3c('0x50')]=function(_0x2b9c64,_0x4533e0){var _0x51b004={'raw':!![],'where':{'id':_0x2b9c64[_0x8e3c('0x51')]['id']}},_0x4ad9aa={};_0x4ad9aa[_0x8e3c('0x3f')]=_['keys'](db[_0x8e3c('0x3b')][_0x8e3c('0x3c')]);_0x4ad9aa[_0x8e3c('0x40')]=_[_0x8e3c('0x41')](_0x2b9c64['query']);_0x4ad9aa[_0x8e3c('0x42')]=_[_0x8e3c('0x43')](_0x4ad9aa[_0x8e3c('0x3f')],_0x4ad9aa[_0x8e3c('0x40')]);_0x51b004['attributes']=_[_0x8e3c('0x43')](_0x4ad9aa[_0x8e3c('0x3f')],qs['fields'](_0x2b9c64[_0x8e3c('0x40')][_0x8e3c('0x44')]));_0x51b004[_0x8e3c('0x45')]=_0x51b004['attributes'][_0x8e3c('0x52')]?_0x51b004[_0x8e3c('0x45')]:_0x4ad9aa[_0x8e3c('0x3f')];if(_0x2b9c64[_0x8e3c('0x40')][_0x8e3c('0x53')]){_0x51b004[_0x8e3c('0x54')]=[{'all':!![]}];}_0x51b004=_[_0x8e3c('0x4d')]({},_0x51b004,_0x2b9c64[_0x8e3c('0x55')]);return db[_0x8e3c('0x3b')][_0x8e3c('0x56')](_0x51b004)[_0x8e3c('0x35')](handleEntityNotFound(_0x4533e0,null))[_0x8e3c('0x35')](respondWithResult(_0x4533e0,null))[_0x8e3c('0x28')](handleError(_0x4533e0,null));};exports[_0x8e3c('0x57')]=function(_0x5a315a,_0x319bea){return db[_0x8e3c('0x3b')][_0x8e3c('0x57')](_0x5a315a[_0x8e3c('0x58')],{})['then'](respondWithResult(_0x319bea,0xc9))[_0x8e3c('0x28')](handleError(_0x319bea,null));};exports[_0x8e3c('0x34')]=function(_0x349991,_0x448aa2){if(_0x349991[_0x8e3c('0x58')]['id']){delete _0x349991[_0x8e3c('0x58')]['id'];}return db['WhatsappMessage'][_0x8e3c('0x56')]({'where':{'id':_0x349991[_0x8e3c('0x51')]['id']}})['then'](handleEntityNotFound(_0x448aa2,null))['then'](saveUpdates(_0x349991[_0x8e3c('0x58')],null))[_0x8e3c('0x35')](respondWithResult(_0x448aa2,null))[_0x8e3c('0x28')](handleError(_0x448aa2,null));};exports[_0x8e3c('0x36')]=function(_0x5ed7de,_0x2b41e6){return db[_0x8e3c('0x3b')]['find']({'where':{'id':_0x5ed7de['params']['id']}})[_0x8e3c('0x35')](handleEntityNotFound(_0x2b41e6,null))[_0x8e3c('0x35')](removeEntity(_0x2b41e6,null))['catch'](handleError(_0x2b41e6,null));};exports[_0x8e3c('0x59')]=function(_0x1cf179,_0xdc851){return db[_0x8e3c('0x3b')][_0x8e3c('0x59')]()[_0x8e3c('0x35')](respondWithResult(_0xdc851,null))[_0x8e3c('0x28')](handleError(_0xdc851,null));};var interaction_log=require('../../config/logger')(_0x8e3c('0x5a'));exports['accept']=function(_0x187eac,_0x5c45b2,_0x577f7b){var _0x1143fa={'agent':{},'channel':_0x8e3c('0x5b')};if(_0x187eac[_0x8e3c('0x58')]['id']){delete _0x187eac['body']['id'];}_0x187eac['body']['read']=!![];_0x187eac[_0x8e3c('0x58')][_0x8e3c('0x5c')]=moment()['format'](_0x8e3c('0x5d'));_0x187eac[_0x8e3c('0x58')][_0x8e3c('0x5e')]=_0x187eac[_0x8e3c('0x58')][_0x8e3c('0x5e')]||_0x187eac[_0x8e3c('0x5f')]['id'];_0x1143fa[_0x8e3c('0x60')]['id']=_0x187eac[_0x8e3c('0x58')][_0x8e3c('0x5e')];return db[_0x8e3c('0x3b')][_0x8e3c('0x56')]({'where':{'id':_0x187eac['params']['id'],'UserId':null}})[_0x8e3c('0x35')](handleEntityNotFound(_0x5c45b2,null))[_0x8e3c('0x35')](saveUpdates(_0x187eac['body'],null))['then'](function(_0x4d4054){if(_0x4d4054){_0x1143fa[_0x8e3c('0x26')]=_0x4d4054[_0x8e3c('0x61')]({'plain':!![]});return db[_0x8e3c('0x62')][_0x8e3c('0x56')]({'where':{'id':_0x4d4054[_0x8e3c('0x63')]}});}return null;})[_0x8e3c('0x35')](handleEntityNotFound(_0x5c45b2,null))[_0x8e3c('0x35')](function(_0x66e1f8){if(_0x66e1f8){return _0x66e1f8[_0x8e3c('0x34')]({'UserId':_0x187eac[_0x8e3c('0x58')][_0x8e3c('0x5e')],'read1stAt':_[_0x8e3c('0x64')](_0x66e1f8[_0x8e3c('0x65')])?moment()[_0x8e3c('0x66')](_0x8e3c('0x5d')):undefined});}return null;})['then'](function(_0x1f8e17){if(_0x1f8e17){_0x1143fa['interaction']=_0x1f8e17['get']({'plain':!![]});interaction_log[_0x8e3c('0x27')](_0x8e3c('0x67'),_0x187eac[_0x8e3c('0x5f')]['id'],_0x187eac[_0x8e3c('0x5f')]['name'],_0x187eac[_0x8e3c('0x5f')][_0x8e3c('0x68')],_0x1143fa[_0x8e3c('0x69')]['id'],_0x187eac['body']?JSON[_0x8e3c('0x24')](_0x187eac['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x8e3c('0x6a'),_0x1143fa);}return null;})[_0x8e3c('0x35')](function(_0x3f3abd){var _0x2267a0=_0x8e3c('0x6b')+_0x3f3abd[_0x8e3c('0x26')][_0x8e3c('0x6c')];return db[_0x8e3c('0x6d')][_0x8e3c('0x40')](_0x2267a0,{'type':db[_0x8e3c('0x6e')]['QueryTypes'][_0x8e3c('0x6f')],'raw':!![]})['then'](function(_0x73ebc6){return _0x73ebc6;});})[_0x8e3c('0x35')](function(_0x2e9455){if(_0x2e9455){_0x1143fa['message'][_0x8e3c('0x70')]=_0x2e9455[0x0];if(!_0x187eac[_0x8e3c('0x58')]['UserId'])return;return db[_0x8e3c('0x71')]['find']({'where':{'id':_0x187eac[_0x8e3c('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x8e3c('0x38'),'fullname',_0x8e3c('0x72'),_0x8e3c('0x73')],'raw':!![]});}return null;})[_0x8e3c('0x35')](function(_0x545dd6){if(!_0x545dd6)return null;_0x1143fa[_0x8e3c('0x26')][_0x8e3c('0x60')]=_0x545dd6;return _0x1143fa;})[_0x8e3c('0x35')](function(_0x46f08b){if(_0x46f08b){if(_0x187eac[_0x8e3c('0x58')]['manual']){_0x1143fa['message'][_0x8e3c('0x74')]=util['format'](_0x8e3c('0x75'),_0x187eac[_0x8e3c('0x5f')][_0x8e3c('0x38')]);_0x1143fa[_0x8e3c('0x26')][_0x8e3c('0x76')]=_0x1143fa[_0x8e3c('0x76')];_0x1143fa[_0x8e3c('0x26')][_0x8e3c('0x77')]=_0x1143fa[_0x8e3c('0x76')];_0x1143fa['message'][_0x8e3c('0x78')]=_0x8e3c('0x79');return respondWithRpcPromise('EventManager',_0x8e3c('0x7a'),{'event':'acceptmessage','message':_0x1143fa[_0x8e3c('0x26')]},client9002)[_0x8e3c('0x35')](function(){return _0x1143fa;});}return _0x1143fa;}return null;})[_0x8e3c('0x35')](respondWithResult(_0x5c45b2,null))[_0x8e3c('0x28')](handleError(_0x5c45b2,null));};var interaction_log=require(_0x8e3c('0x16'))(_0x8e3c('0x5a'));exports[_0x8e3c('0x33')]=function(_0x59da69,_0x3ca1ac,_0x391a9e){var _0x35d720={'agent':{},'channel':'whatsapp'};if(_0x59da69[_0x8e3c('0x58')]['id']){delete _0x59da69[_0x8e3c('0x58')]['id'];}_0x59da69['body']['UserId']=_0x59da69[_0x8e3c('0x58')]['UserId']||_0x59da69[_0x8e3c('0x5f')]['id'];_0x35d720[_0x8e3c('0x60')]['id']=_0x59da69[_0x8e3c('0x58')][_0x8e3c('0x5e')];return db['WhatsappMessage']['find']({'where':{'id':_0x59da69[_0x8e3c('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ca1ac,null))[_0x8e3c('0x35')](function(_0xd5d64c){if(_0xd5d64c){_0x35d720[_0x8e3c('0x26')]=_0xd5d64c[_0x8e3c('0x61')]({'plain':!![]});return db[_0x8e3c('0x62')][_0x8e3c('0x56')]({'where':{'id':_0xd5d64c[_0x8e3c('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x3ca1ac,null))[_0x8e3c('0x35')](function(_0x5ea441){if(_0x5ea441){_0x35d720['interaction']=_0x5ea441[_0x8e3c('0x61')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x59da69[_0x8e3c('0x5f')]['id'],_0x59da69[_0x8e3c('0x5f')][_0x8e3c('0x38')],_0x59da69[_0x8e3c('0x5f')][_0x8e3c('0x68')],_0x35d720[_0x8e3c('0x69')]['id'],_0x59da69[_0x8e3c('0x58')]?JSON[_0x8e3c('0x24')](_0x59da69[_0x8e3c('0x58')]):_0x8e3c('0x7b'));return respondWithRpcPromise(_0x8e3c('0x7c'),'rejectMessage',_0x35d720);}return null;})[_0x8e3c('0x35')](function(_0x3fea6e){var _0x5273d8=_0x8e3c('0x6b')+_0x3fea6e[_0x8e3c('0x26')][_0x8e3c('0x6c')];return db['sequelize']['query'](_0x5273d8,{'type':db[_0x8e3c('0x6e')]['QueryTypes'][_0x8e3c('0x6f')],'raw':!![]})[_0x8e3c('0x35')](function(_0x2af782){return _0x2af782;});})[_0x8e3c('0x35')](function(_0x45536b){if(_0x45536b){_0x35d720[_0x8e3c('0x26')][_0x8e3c('0x70')]=_0x45536b[0x0];if(!_0x59da69[_0x8e3c('0x58')][_0x8e3c('0x5e')])return;return db['User'][_0x8e3c('0x56')]({'where':{'id':_0x59da69[_0x8e3c('0x58')][_0x8e3c('0x5e')],'role':'agent'},'attributes':['id',_0x8e3c('0x38'),_0x8e3c('0x7d'),_0x8e3c('0x72'),'internal'],'raw':!![]});}return null;})[_0x8e3c('0x35')](function(_0x5cd2eb){if(!_0x5cd2eb)return null;_0x35d720['message'][_0x8e3c('0x60')]=_0x5cd2eb;return _0x35d720;})[_0x8e3c('0x35')](function(_0x119788){if(_0x119788){_0x119788[_0x8e3c('0x26')][_0x8e3c('0x74')]=util[_0x8e3c('0x66')](_0x8e3c('0x75'),_0x59da69[_0x8e3c('0x5f')]['name']);_0x119788['message'][_0x8e3c('0x76')]=_0x35d720[_0x8e3c('0x76')];_0x119788[_0x8e3c('0x26')][_0x8e3c('0x77')]=_0x35d720[_0x8e3c('0x76')];_0x119788[_0x8e3c('0x26')]['event']=_0x8e3c('0x33');respondWithRpcPromise(_0x8e3c('0x7a'),_0x8e3c('0x7a'),{'event':_0x8e3c('0x7e'),'message':_0x119788[_0x8e3c('0x26')]},client9002);return _0x35d720;}return null;})[_0x8e3c('0x35')](respondWithResult(_0x3ca1ac,null))[_0x8e3c('0x28')](handleError(_0x3ca1ac,null));};exports['status']=function(_0x27b6e8,_0x263d20,_0x29f91d){if(_0x27b6e8['body']['id']){delete _0x27b6e8[_0x8e3c('0x58')]['id'];}var _0x418cb8;return db['WhatsappMessage'][_0x8e3c('0x56')]({'where':{'id':_0x27b6e8[_0x8e3c('0x51')]['id']}})[_0x8e3c('0x35')](handleEntityNotFound(_0x263d20,null))[_0x8e3c('0x35')](function(_0x1f7f98){if(_0x1f7f98){_0x418cb8=_0x1f7f98;return db['WhatsappAccount']['find']({'where':{'id':_0x1f7f98[_0x8e3c('0x7f')]}});}})[_0x8e3c('0x35')](handleEntityNotFound(_0x263d20,null))[_0x8e3c('0x35')](function(_0x47e806){if(_0x47e806){logger[_0x8e3c('0x22')](_0x8e3c('0x80'),_0x8e3c('0x2a'),_0x8e3c('0x81'),_0x47e806['type'],util[_0x8e3c('0x82')](_0x27b6e8[_0x8e3c('0x58')],{'showHidden':![],'depth':null}));switch(_0x47e806[_0x8e3c('0x3d')]){case _0x8e3c('0x83'):if(_0x27b6e8[_0x8e3c('0x58')]['MessageSid']&&_0x27b6e8[_0x8e3c('0x58')][_0x8e3c('0x84')]===_0x418cb8[_0x8e3c('0x85')]&&_0x27b6e8[_0x8e3c('0x58')]['MessageStatus']&&_0x27b6e8[_0x8e3c('0x58')][_0x8e3c('0x86')]===_0x8e3c('0x87')){return _0x418cb8[_0x8e3c('0x34')]({'read':!![]});}else{logger[_0x8e3c('0x25')](_0x8e3c('0x88'),_0x8e3c('0x2a'),_0x8e3c('0x83'),util[_0x8e3c('0x82')](_0x27b6e8[_0x8e3c('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x418cb8;}})[_0x8e3c('0x35')](respondWithResult(_0x263d20,null))[_0x8e3c('0x28')](handleError(_0x263d20,null));}; \ No newline at end of file +var _0x5505=['merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find','create','body','describe','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteractionId','isNil','read1stAt','format','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','QueryTypes','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','update','destroy','stack','name','send','index','map','WhatsappMessage','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter'];(function(_0x11a500,_0xaa37fd){var _0x2196a8=function(_0x3f31c0){while(--_0x3f31c0){_0x11a500['push'](_0x11a500['shift']());}};_0x2196a8(++_0xaa37fd);}(_0x5505,0x159));var _0x5550=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5505[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x5550('0x0'));var rimraf=require(_0x5550('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5550('0x2'));var rp=require(_0x5550('0x3'));var moment=require(_0x5550('0x4'));var BPromise=require(_0x5550('0x5'));var Mustache=require('mustache');var util=require(_0x5550('0x6'));var path=require(_0x5550('0x7'));var sox=require(_0x5550('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5550('0x9'));var _=require(_0x5550('0xa'));var squel=require(_0x5550('0xb'));var crypto=require(_0x5550('0xc'));var jsforce=require(_0x5550('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5550('0xe'));var querystring=require(_0x5550('0xf'));var Papa=require(_0x5550('0x10'));var Redis=require(_0x5550('0x11'));var authService=require(_0x5550('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5550('0x13'))(_0x5550('0x14'));var utils=require(_0x5550('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5550('0x16'));var db=require('../../mysqldb')['db'];config[_0x5550('0x17')]=_[_0x5550('0x18')](config['redis'],{'host':_0x5550('0x19'),'port':0x18eb});var socket=require(_0x5550('0x1a'))(new Redis(config[_0x5550('0x17')]));require(_0x5550('0x1b'))[_0x5550('0x1c')](socket);var jayson=require(_0x5550('0x1d'));var client=jayson[_0x5550('0x1e')][_0x5550('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4608a7,_0x37c810,_0x2dc22b,_0x32683e){return new BPromise(function(_0x5e8ab5,_0x19c7d5){var _0x39920d=_0x32683e||client;return _0x39920d['request'](_0x4608a7,_0x2dc22b)[_0x5550('0x20')](function(_0x330975){logger[_0x5550('0x21')](_0x5550('0x22'),_0x37c810,_0x5550('0x23'));logger[_0x5550('0x24')](_0x5550('0x25'),_0x37c810,_0x5550('0x23'),JSON[_0x5550('0x26')](_0x330975));if(_0x330975[_0x5550('0x27')]){if(_0x330975[_0x5550('0x27')][_0x5550('0x28')]===0x1f4){logger[_0x5550('0x27')](_0x5550('0x22'),_0x37c810,_0x330975['error'][_0x5550('0x29')]);return _0x19c7d5(_0x330975[_0x5550('0x27')][_0x5550('0x29')]);}logger[_0x5550('0x27')](_0x5550('0x22'),_0x37c810,_0x330975[_0x5550('0x27')]['message']);return _0x5e8ab5(_0x330975[_0x5550('0x27')][_0x5550('0x29')]);}else{logger[_0x5550('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x37c810,_0x5550('0x23'));_0x5e8ab5(_0x330975[_0x5550('0x2a')][_0x5550('0x29')]);}})['catch'](function(_0x46e4d7){logger['error'](_0x5550('0x22'),_0x37c810,_0x46e4d7);_0x19c7d5(_0x46e4d7);});});}function respondWithStatusCode(_0x297aa1,_0x34d2aa){_0x34d2aa=_0x34d2aa||0xcc;return function(_0x49223b){if(_0x49223b){return _0x297aa1[_0x5550('0x2b')](_0x34d2aa);}return _0x297aa1[_0x5550('0x2c')](_0x34d2aa)[_0x5550('0x2d')]();};}function respondWithResult(_0x1c1676,_0x2ac394){_0x2ac394=_0x2ac394||0xc8;return function(_0x28db90){if(_0x28db90){return _0x1c1676[_0x5550('0x2c')](_0x2ac394)[_0x5550('0x2e')](_0x28db90);}};}function respondWithFilteredResult(_0x34b2f8,_0x4c536f){return function(_0x4707cd){if(_0x4707cd){var _0x103e35=typeof _0x4c536f['offset']===_0x5550('0x2f')&&typeof _0x4c536f['limit']===_0x5550('0x2f');var _0x2a9de1=_0x4707cd[_0x5550('0x30')];var _0x3c1c72=_0x103e35?0x0:_0x4c536f[_0x5550('0x31')];var _0x4696ba=_0x103e35?_0x4707cd[_0x5550('0x30')]:_0x4c536f[_0x5550('0x31')]+_0x4c536f[_0x5550('0x32')];var _0x57da4e;if(_0x4696ba>=_0x2a9de1){_0x4696ba=_0x2a9de1;_0x57da4e=0xc8;}else{_0x57da4e=0xce;}_0x34b2f8[_0x5550('0x2c')](_0x57da4e);return _0x34b2f8[_0x5550('0x33')]('Content-Range',_0x3c1c72+'-'+_0x4696ba+'/'+_0x2a9de1)[_0x5550('0x2e')](_0x4707cd);}return null;};}function patchUpdates(_0x23177c){return function(_0x3c6ff8){try{jsonpatch[_0x5550('0x34')](_0x3c6ff8,_0x23177c,!![]);}catch(_0x45b80d){return BPromise[_0x5550('0x35')](_0x45b80d);}return _0x3c6ff8['save']();};}function saveUpdates(_0x501dd3,_0x31f4b3){return function(_0x597df2){if(_0x597df2){return _0x597df2[_0x5550('0x36')](_0x501dd3)[_0x5550('0x20')](function(_0x24217b){return _0x24217b;});}return null;};}function removeEntity(_0x76809e,_0x169adf){return function(_0x231566){if(_0x231566){return _0x231566[_0x5550('0x37')]()[_0x5550('0x20')](function(){_0x76809e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23988f,_0x415093){return function(_0xf59093){if(!_0xf59093){_0x23988f[_0x5550('0x2b')](0x194);}return _0xf59093;};}function handleError(_0x5b09f2,_0x5cda39){_0x5cda39=_0x5cda39||0x1f4;return function(_0x17773f){logger['error'](_0x17773f[_0x5550('0x38')]);if(_0x17773f[_0x5550('0x39')]){delete _0x17773f[_0x5550('0x39')];}_0x5b09f2[_0x5550('0x2c')](_0x5cda39)[_0x5550('0x3a')](_0x17773f);};}exports[_0x5550('0x3b')]=function(_0x15ebbf,_0x74e721){var _0x48d2d1={},_0xd972e2={},_0x361ae3={'count':0x0,'rows':[]};var _0x1b4f87=_[_0x5550('0x3c')](db[_0x5550('0x3d')]['rawAttributes'],function(_0x24a79a){return{'name':_0x24a79a[_0x5550('0x3e')],'type':_0x24a79a[_0x5550('0x3f')]['key']};});_0xd972e2[_0x5550('0x40')]=_[_0x5550('0x3c')](_0x1b4f87,_0x5550('0x39'));_0xd972e2['query']=_['keys'](_0x15ebbf[_0x5550('0x41')]);_0xd972e2[_0x5550('0x42')]=_[_0x5550('0x43')](_0xd972e2[_0x5550('0x40')],_0xd972e2[_0x5550('0x41')]);_0x48d2d1['attributes']=_['intersection'](_0xd972e2['model'],qs[_0x5550('0x44')](_0x15ebbf[_0x5550('0x41')]['fields']));_0x48d2d1[_0x5550('0x45')]=_0x48d2d1[_0x5550('0x45')]['length']?_0x48d2d1[_0x5550('0x45')]:_0xd972e2['model'];if(!_0x15ebbf[_0x5550('0x41')][_0x5550('0x46')]('nolimit')){_0x48d2d1[_0x5550('0x32')]=qs[_0x5550('0x32')](_0x15ebbf[_0x5550('0x41')][_0x5550('0x32')]);_0x48d2d1[_0x5550('0x31')]=qs['offset'](_0x15ebbf[_0x5550('0x41')][_0x5550('0x31')]);}_0x48d2d1['order']=qs[_0x5550('0x47')](_0x15ebbf[_0x5550('0x41')][_0x5550('0x47')]);_0x48d2d1[_0x5550('0x48')]=qs['filters'](_[_0x5550('0x49')](_0x15ebbf[_0x5550('0x41')],_0xd972e2[_0x5550('0x42')]),_0x1b4f87);if(_0x15ebbf[_0x5550('0x41')][_0x5550('0x4a')]){_0x48d2d1[_0x5550('0x48')]=_[_0x5550('0x4b')](_0x48d2d1['where'],{'$or':_[_0x5550('0x3c')](_0x1b4f87,function(_0x413c4e){if(_0x413c4e[_0x5550('0x3f')]!==_0x5550('0x4c')){var _0xb8e168={};_0xb8e168[_0x413c4e[_0x5550('0x39')]]={'$like':'%'+_0x15ebbf[_0x5550('0x41')]['filter']+'%'};return _0xb8e168;}})});}_0x48d2d1=_[_0x5550('0x4b')]({},_0x48d2d1,_0x15ebbf['options']);var _0x526978={'where':_0x48d2d1[_0x5550('0x48')]};return db['WhatsappMessage'][_0x5550('0x30')](_0x526978)['then'](function(_0x578091){_0x361ae3[_0x5550('0x30')]=_0x578091;if(_0x15ebbf[_0x5550('0x41')][_0x5550('0x4d')]){_0x48d2d1[_0x5550('0x4e')]=[{'all':!![]}];}return db[_0x5550('0x3d')][_0x5550('0x4f')](_0x48d2d1);})[_0x5550('0x20')](function(_0x1b947a){_0x361ae3['rows']=_0x1b947a;return _0x361ae3;})['then'](respondWithFilteredResult(_0x74e721,_0x48d2d1))[_0x5550('0x50')](handleError(_0x74e721,null));};exports[_0x5550('0x51')]=function(_0x127299,_0x2ba284){var _0x3c08d1={'raw':!![],'where':{'id':_0x127299[_0x5550('0x52')]['id']}},_0x108c6e={};_0x108c6e[_0x5550('0x40')]=_[_0x5550('0x53')](db[_0x5550('0x3d')][_0x5550('0x54')]);_0x108c6e[_0x5550('0x41')]=_[_0x5550('0x53')](_0x127299[_0x5550('0x41')]);_0x108c6e[_0x5550('0x42')]=_[_0x5550('0x43')](_0x108c6e[_0x5550('0x40')],_0x108c6e[_0x5550('0x41')]);_0x3c08d1['attributes']=_[_0x5550('0x43')](_0x108c6e['model'],qs[_0x5550('0x44')](_0x127299['query']['fields']));_0x3c08d1[_0x5550('0x45')]=_0x3c08d1[_0x5550('0x45')][_0x5550('0x55')]?_0x3c08d1[_0x5550('0x45')]:_0x108c6e[_0x5550('0x40')];if(_0x127299[_0x5550('0x41')]['includeAll']){_0x3c08d1[_0x5550('0x4e')]=[{'all':!![]}];}_0x3c08d1=_[_0x5550('0x4b')]({},_0x3c08d1,_0x127299['options']);return db['WhatsappMessage'][_0x5550('0x56')](_0x3c08d1)[_0x5550('0x20')](handleEntityNotFound(_0x2ba284,null))['then'](respondWithResult(_0x2ba284,null))['catch'](handleError(_0x2ba284,null));};exports[_0x5550('0x57')]=function(_0x60529e,_0x42b897){return db[_0x5550('0x3d')][_0x5550('0x57')](_0x60529e[_0x5550('0x58')],{})['then'](respondWithResult(_0x42b897,0xc9))[_0x5550('0x50')](handleError(_0x42b897,null));};exports[_0x5550('0x36')]=function(_0x2ae885,_0x4aeae3){if(_0x2ae885[_0x5550('0x58')]['id']){delete _0x2ae885['body']['id'];}return db[_0x5550('0x3d')][_0x5550('0x56')]({'where':{'id':_0x2ae885[_0x5550('0x52')]['id']}})[_0x5550('0x20')](handleEntityNotFound(_0x4aeae3,null))[_0x5550('0x20')](saveUpdates(_0x2ae885[_0x5550('0x58')],null))[_0x5550('0x20')](respondWithResult(_0x4aeae3,null))['catch'](handleError(_0x4aeae3,null));};exports[_0x5550('0x37')]=function(_0x4f9c81,_0x291252){return db[_0x5550('0x3d')][_0x5550('0x56')]({'where':{'id':_0x4f9c81['params']['id']}})[_0x5550('0x20')](handleEntityNotFound(_0x291252,null))[_0x5550('0x20')](removeEntity(_0x291252,null))[_0x5550('0x50')](handleError(_0x291252,null));};exports[_0x5550('0x59')]=function(_0x3aa400,_0xe7ba28){return db[_0x5550('0x3d')]['describe']()['then'](respondWithResult(_0xe7ba28,null))[_0x5550('0x50')](handleError(_0xe7ba28,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x5550('0x5a')]=function(_0x1aa7ac,_0x311810,_0x598402){var _0x1ee313={'agent':{},'channel':_0x5550('0x5b')};if(_0x1aa7ac[_0x5550('0x58')]['id']){delete _0x1aa7ac[_0x5550('0x58')]['id'];}_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5c')]=!![];_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5d')]=moment()['format'](_0x5550('0x5e'));_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5f')]=_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5f')]||_0x1aa7ac[_0x5550('0x60')]['id'];_0x1ee313[_0x5550('0x61')]['id']=_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5f')];return db[_0x5550('0x3d')][_0x5550('0x56')]({'where':{'id':_0x1aa7ac[_0x5550('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x311810,null))[_0x5550('0x20')](saveUpdates(_0x1aa7ac[_0x5550('0x58')],null))[_0x5550('0x20')](function(_0x1d0140){if(_0x1d0140){_0x1ee313[_0x5550('0x29')]=_0x1d0140['get']({'plain':!![]});return db['WhatsappInteraction'][_0x5550('0x56')]({'where':{'id':_0x1d0140[_0x5550('0x62')]}});}return null;})[_0x5550('0x20')](handleEntityNotFound(_0x311810,null))[_0x5550('0x20')](function(_0x27c4dd){if(_0x27c4dd){return _0x27c4dd[_0x5550('0x36')]({'UserId':_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5f')],'read1stAt':_[_0x5550('0x63')](_0x27c4dd[_0x5550('0x64')])?moment()[_0x5550('0x65')](_0x5550('0x5e')):undefined});}return null;})['then'](function(_0xba4a9c){if(_0xba4a9c){_0x1ee313[_0x5550('0x66')]=_0xba4a9c[_0x5550('0x67')]({'plain':!![]});interaction_log[_0x5550('0x21')](_0x5550('0x68'),_0x1aa7ac[_0x5550('0x60')]['id'],_0x1aa7ac[_0x5550('0x60')][_0x5550('0x39')],_0x1aa7ac[_0x5550('0x60')]['role'],_0x1ee313[_0x5550('0x66')]['id'],_0x1aa7ac[_0x5550('0x58')]?JSON[_0x5550('0x26')](_0x1aa7ac[_0x5550('0x58')]):_0x5550('0x69'));return respondWithRpcPromise('AcceptMessage',_0x5550('0x6a'),_0x1ee313);}return null;})[_0x5550('0x20')](function(_0x45c64b){var _0x3345e9=_0x5550('0x6b')+_0x45c64b['message'][_0x5550('0x6c')];return db[_0x5550('0x6d')][_0x5550('0x41')](_0x3345e9,{'type':db[_0x5550('0x6e')]['QueryTypes'][_0x5550('0x6f')],'raw':!![]})['then'](function(_0x4116c3){return _0x4116c3;});})[_0x5550('0x20')](function(_0x1cc2b3){if(_0x1cc2b3){_0x1ee313[_0x5550('0x29')][_0x5550('0x70')]=_0x1cc2b3[0x0];if(!_0x1aa7ac['body'][_0x5550('0x5f')])return;return db[_0x5550('0x71')][_0x5550('0x56')]({'where':{'id':_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5f')],'role':'agent'},'attributes':['id',_0x5550('0x39'),_0x5550('0x72'),_0x5550('0x73'),'internal'],'raw':!![]});}return null;})[_0x5550('0x20')](function(_0x234f97){if(!_0x234f97)return null;_0x1ee313[_0x5550('0x29')][_0x5550('0x61')]=_0x234f97;return _0x1ee313;})[_0x5550('0x20')](function(_0x440efc){if(_0x440efc){if(_0x1aa7ac[_0x5550('0x58')][_0x5550('0x74')]){_0x1ee313[_0x5550('0x29')][_0x5550('0x75')]=util[_0x5550('0x65')]('SIP/%s',_0x1aa7ac[_0x5550('0x60')]['name']);_0x1ee313[_0x5550('0x29')][_0x5550('0x76')]=_0x1ee313[_0x5550('0x76')];_0x1ee313[_0x5550('0x29')][_0x5550('0x77')]=_0x1ee313['channel'];_0x1ee313[_0x5550('0x29')][_0x5550('0x78')]=_0x5550('0x5a');return respondWithRpcPromise(_0x5550('0x79'),_0x5550('0x79'),{'event':_0x5550('0x7a'),'message':_0x1ee313[_0x5550('0x29')]},client9002)[_0x5550('0x20')](function(){return _0x1ee313;});}return _0x1ee313;}return null;})[_0x5550('0x20')](respondWithResult(_0x311810,null))[_0x5550('0x50')](handleError(_0x311810,null));};var interaction_log=require('../../config/logger')(_0x5550('0x7b'));exports[_0x5550('0x35')]=function(_0x4a1dba,_0x1ba637,_0x450f6e){var _0x3d60e2={'agent':{},'channel':_0x5550('0x5b')};if(_0x4a1dba['body']['id']){delete _0x4a1dba[_0x5550('0x58')]['id'];}_0x4a1dba['body'][_0x5550('0x5f')]=_0x4a1dba[_0x5550('0x58')][_0x5550('0x5f')]||_0x4a1dba[_0x5550('0x60')]['id'];_0x3d60e2[_0x5550('0x61')]['id']=_0x4a1dba[_0x5550('0x58')][_0x5550('0x5f')];return db[_0x5550('0x3d')]['find']({'where':{'id':_0x4a1dba[_0x5550('0x52')]['id'],'UserId':null}})[_0x5550('0x20')](handleEntityNotFound(_0x1ba637,null))[_0x5550('0x20')](function(_0x343dfd){if(_0x343dfd){_0x3d60e2['message']=_0x343dfd['get']({'plain':!![]});return db['WhatsappInteraction'][_0x5550('0x56')]({'where':{'id':_0x343dfd[_0x5550('0x62')]}});}return null;})[_0x5550('0x20')](handleEntityNotFound(_0x1ba637,null))[_0x5550('0x20')](function(_0x29ce0b){if(_0x29ce0b){_0x3d60e2[_0x5550('0x66')]=_0x29ce0b[_0x5550('0x67')]({'plain':!![]});interaction_log[_0x5550('0x21')](_0x5550('0x7c'),_0x4a1dba[_0x5550('0x60')]['id'],_0x4a1dba[_0x5550('0x60')][_0x5550('0x39')],_0x4a1dba[_0x5550('0x60')][_0x5550('0x7d')],_0x3d60e2[_0x5550('0x66')]['id'],_0x4a1dba['body']?JSON['stringify'](_0x4a1dba['body']):_0x5550('0x69'));return respondWithRpcPromise('RejectMessage',_0x5550('0x7e'),_0x3d60e2);}return null;})[_0x5550('0x20')](function(_0x15c6a2){var _0x30def5=_0x5550('0x6b')+_0x15c6a2[_0x5550('0x29')]['ContactId'];return db['sequelize']['query'](_0x30def5,{'type':db[_0x5550('0x6e')][_0x5550('0x7f')]['SELECT'],'raw':!![]})['then'](function(_0x2e7821){return _0x2e7821;});})[_0x5550('0x20')](function(_0x38c155){if(_0x38c155){_0x3d60e2[_0x5550('0x29')][_0x5550('0x70')]=_0x38c155[0x0];if(!_0x4a1dba['body'][_0x5550('0x5f')])return;return db[_0x5550('0x71')][_0x5550('0x56')]({'where':{'id':_0x4a1dba['body']['UserId'],'role':_0x5550('0x61')},'attributes':['id',_0x5550('0x39'),_0x5550('0x72'),_0x5550('0x73'),_0x5550('0x80')],'raw':!![]});}return null;})[_0x5550('0x20')](function(_0xf1f85f){if(!_0xf1f85f)return null;_0x3d60e2[_0x5550('0x29')]['agent']=_0xf1f85f;return _0x3d60e2;})['then'](function(_0x399cb6){if(_0x399cb6){_0x399cb6['message'][_0x5550('0x75')]=util['format']('SIP/%s',_0x4a1dba[_0x5550('0x60')][_0x5550('0x39')]);_0x399cb6['message']['channel']=_0x3d60e2['channel'];_0x399cb6[_0x5550('0x29')][_0x5550('0x77')]=_0x3d60e2[_0x5550('0x76')];_0x399cb6[_0x5550('0x29')][_0x5550('0x78')]='reject';respondWithRpcPromise(_0x5550('0x79'),'EventManager',{'event':_0x5550('0x81'),'message':_0x399cb6[_0x5550('0x29')]},client9002);return _0x3d60e2;}return null;})[_0x5550('0x20')](respondWithResult(_0x1ba637,null))['catch'](handleError(_0x1ba637,null));};exports[_0x5550('0x2c')]=function(_0x16bbe3,_0xfe5e9b,_0x26d7ba){if(_0x16bbe3[_0x5550('0x58')]['id']){delete _0x16bbe3[_0x5550('0x58')]['id'];}var _0x3087eb;return db['WhatsappMessage'][_0x5550('0x56')]({'where':{'id':_0x16bbe3[_0x5550('0x52')]['id']}})['then'](handleEntityNotFound(_0xfe5e9b,null))[_0x5550('0x20')](function(_0x2ad00a){if(_0x2ad00a){_0x3087eb=_0x2ad00a;return db[_0x5550('0x82')]['find']({'where':{'id':_0x2ad00a[_0x5550('0x83')]}});}})[_0x5550('0x20')](handleEntityNotFound(_0xfe5e9b,null))['then'](function(_0x2c4512){if(_0x2c4512){logger[_0x5550('0x24')](_0x5550('0x84'),'status',_0x5550('0x85'),_0x2c4512[_0x5550('0x3f')],util[_0x5550('0x86')](_0x16bbe3[_0x5550('0x58')],{'showHidden':![],'depth':null}));switch(_0x2c4512['type']){case _0x5550('0x87'):if(_0x16bbe3[_0x5550('0x58')]['MessageSid']&&_0x16bbe3[_0x5550('0x58')][_0x5550('0x88')]===_0x3087eb[_0x5550('0x89')]&&_0x16bbe3['body'][_0x5550('0x8a')]&&_0x16bbe3[_0x5550('0x58')][_0x5550('0x8a')]===_0x5550('0x5c')){return _0x3087eb['update']({'read':!![]});}else{logger['error'](_0x5550('0x8b'),'status',_0x5550('0x87'),util[_0x5550('0x86')](_0x16bbe3[_0x5550('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3087eb;}})[_0x5550('0x20')](respondWithResult(_0xfe5e9b,null))[_0x5550('0x50')](handleError(_0xfe5e9b,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 49b8de7..08b01c2 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 _0x2b65=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x185f7f,_0x42aa8b){var _0x15d436=function(_0x581235){while(--_0x581235){_0x185f7f['push'](_0x185f7f['shift']());}};_0x15d436(++_0x42aa8b);}(_0x2b65,0x131));var _0x52b6=function(_0x16fe01,_0x5039e1){_0x16fe01=_0x16fe01-0x0;var _0x56c48a=_0x2b65[_0x16fe01];return _0x56c48a;};'use strict';var EventEmitter=require(_0x52b6('0x0'));var WhatsappMessage=require(_0x52b6('0x1'))['db'][_0x52b6('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x52b6('0x3')](0x0);var events={'afterCreate':_0x52b6('0x4'),'afterUpdate':_0x52b6('0x5'),'afterDestroy':_0x52b6('0x6')};function emitEvent(_0x14f639){return function(_0x5582d0,_0x3b8e05,_0x2a1355){WhatsappMessageEvents[_0x52b6('0x7')](_0x14f639+':'+_0x5582d0['id'],_0x5582d0);WhatsappMessageEvents[_0x52b6('0x7')](_0x14f639,_0x5582d0);_0x2a1355(null);};}for(var e in events){if(events[_0x52b6('0x8')](e)){var event=events[e];WhatsappMessage[_0x52b6('0x9')](e,emitEvent(event));}}module[_0x52b6('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0xbee3=['emit','hook','exports','../../mysqldb','save','update'];(function(_0x9e6c5c,_0x37e32c){var _0x5eee91=function(_0x3f5390){while(--_0x3f5390){_0x9e6c5c['push'](_0x9e6c5c['shift']());}};_0x5eee91(++_0x37e32c);}(_0xbee3,0xd5));var _0x3bee=function(_0x272dc8,_0x1f7592){_0x272dc8=_0x272dc8-0x0;var _0x42602a=_0xbee3[_0x272dc8];return _0x42602a;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x3bee('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3bee('0x1'),'afterUpdate':_0x3bee('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4b354b){return function(_0x1956c1,_0x1cf379,_0x507c6a){WhatsappMessageEvents[_0x3bee('0x3')](_0x4b354b+':'+_0x1956c1['id'],_0x1956c1);WhatsappMessageEvents[_0x3bee('0x3')](_0x4b354b,_0x1956c1);_0x507c6a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x3bee('0x4')](e,emitEvent(event));}}module[_0x3bee('0x5')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index f781190..1a64245 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 _0x8230=['WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','catch','err','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','exports','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid'];(function(_0x4a39a8,_0x221bc1){var _0x59c147=function(_0x42e781){while(--_0x42e781){_0x4a39a8['push'](_0x4a39a8['shift']());}};_0x59c147(++_0x221bc1);}(_0x8230,0x143));var _0x0823=function(_0x3330c4,_0x517f67){_0x3330c4=_0x3330c4-0x0;var _0x2a7c76=_0x8230[_0x3330c4];return _0x2a7c76;};'use strict';var _=require(_0x0823('0x0'));var util=require('util');var logger=require(_0x0823('0x1'))(_0x0823('0x2'));var moment=require(_0x0823('0x3'));var BPromise=require(_0x0823('0x4'));var rp=require(_0x0823('0x5'));var fetch=require(_0x0823('0x6'));var fs=require('fs');var path=require(_0x0823('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x0823('0x8')]=function(_0x13f3fb,_0x5c8c92){return _0x13f3fb['define']('WhatsappMessage',attributes,{'tableName':_0x0823('0x9'),'paranoid':![],'indexes':[{'name':_0x0823('0xa'),'fields':[_0x0823('0xa')]},{'name':_0x0823('0xb'),'fields':[_0x0823('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x564125,_0x2704f0,_0x5bb760){var _0x2e977f=_0x13f3fb[_0x0823('0xd')];var _0x4fd0bb=_0x564125[_0x0823('0xe')]({'plain':!![]});if(_0x4fd0bb[_0x0823('0xf')][_0x0823('0x10')]()==='in'||_0x4fd0bb[_0x0823('0xf')][_0x0823('0x10')]()===_0x0823('0x11')&&!_0x4fd0bb[_0x0823('0x12')]&&!_[_0x0823('0x13')](_0x4fd0bb[_0x0823('0x14')])){_0x2e977f[_0x0823('0x15')][_0x0823('0x16')]({'where':{'id':_0x4fd0bb[_0x0823('0x17')]}})[_0x0823('0x18')](function(_0x54bb43){if(_0x54bb43){_0x54bb43[_0x0823('0x19')]({'lastMsgAt':_0x4fd0bb[_0x0823('0x1a')],'lastMsgDirection':_0x4fd0bb[_0x0823('0xf')][_0x0823('0x10')]()});}})['catch'](function(_0x5e0fbe){console[_0x0823('0x1b')](_0x5e0fbe);});}if(_0x4fd0bb[_0x0823('0xf')]===_0x0823('0x11')&&!_0x4fd0bb['secret']){var _0x1303a3;_0x2e977f[_0x0823('0x1c')][_0x0823('0x1d')]({'where':{'id':_0x4fd0bb[_0x0823('0x1e')]},'raw':!![]})[_0x0823('0x18')](function(_0x7c3a2e){_0x1303a3=_0x7c3a2e;if(_0x1303a3&&_0x1303a3[_0x0823('0x1f')]){switch(_0x1303a3[_0x0823('0x1f')]){case _0x0823('0x20'):var _0x24f35a=require(_0x0823('0x20'));if(_0x1303a3['accountSid']&&_0x1303a3[_0x0823('0x21')]&&_0x1303a3[_0x0823('0x22')]){var _0x4bcd70=new _0x24f35a(_0x1303a3[_0x0823('0x23')],_0x1303a3[_0x0823('0x21')]);_0x4bcd70[_0x0823('0x24')][_0x0823('0x25')]({'body':_0x4fd0bb['body'],'to':_0x0823('0x26')+_0x4fd0bb[_0x0823('0x22')],'from':_0x0823('0x26')+_0x1303a3['phone'],'statusCallback':_0x1303a3['remote']+_0x0823('0x27')+_0x4fd0bb['id']+_0x0823('0x28')+_0x1303a3[_0x0823('0x29')]})[_0x0823('0x18')](function(_0x2f9631){if(_0x2f9631['sid']){return _0x564125['update']({'messageId':_0x2f9631[_0x0823('0x2a')]});}})['catch'](function(_0x199167){logger['error'](_0x0823('0x2b'),_0x0823('0x2c'),_0x0823('0x20'),util[_0x0823('0x2d')](_0x199167,{'showHidden':![],'depth':null}));});}else{logger[_0x0823('0x1b')](_0x0823('0x2b'),'afterCreate',_0x0823('0x20'),_0x0823('0x2e'));}break;case _0x0823('0x2f'):var _0x21ee85=_0x1303a3[_0x0823('0x23')];var _0x2c3728=_0x1303a3[_0x0823('0x21')];var _0x41a6b5=_0x1303a3[_0x0823('0x30')]+_0x0823('0x31')+_0x21ee85+_0x0823('0x32');var _0x47999a={'to':[_0x4fd0bb[_0x0823('0x22')]],'message':{'type':_0x0823('0x33'),'text':_0x4fd0bb[_0x0823('0xc')]}};var _0x40c570={'method':_0x0823('0x34'),'uri':_0x41a6b5,'headers':{'Authorization':_0x0823('0x35')+_0x2c3728,'Content-Type':_0x0823('0x36')},'body':_0x47999a,'json':!![]};rp(_0x40c570)['then'](function(_0x19a04b){if(_0x19a04b['statuses'][0x0]['message_id']){return _0x564125['update']({'messageId':_0x19a04b[_0x0823('0x37')][0x0][_0x0823('0x38')]});}})[_0x0823('0x39')](function(_0x17742a){logger[_0x0823('0x3a')]('WhatsappMessage,\x20%s',_0x17742a);});break;}}})['finally'](function(){_0x5bb760();});}else{_0x5bb760();}}},'charset':_0x0823('0x3b'),'collate':_0x0823('0x3c')});}; \ No newline at end of file +var _0x5127=['WhatsappInteractionId','then','createdAt','toLowerCase','catch','secret','WhatsappAccount','WhatsappAccountId','type','authToken','phone','accountSid','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','twilio','inspect','afterCreate','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','message_id','statuses','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','get','direction','out','isNil','UserId','WhatsappInteraction','findOne'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5127,0x64));var _0x7512=function(_0x3a5248,_0x34e201){_0x3a5248=_0x3a5248-0x0;var _0x4175a1=_0x5127[_0x3a5248];return _0x4175a1;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var logger=require(_0x7512('0x2'))(_0x7512('0x3'));var moment=require('moment');var BPromise=require(_0x7512('0x4'));var rp=require(_0x7512('0x5'));var fetch=require(_0x7512('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7512('0x7'));var config=require(_0x7512('0x8'));var attributes=require(_0x7512('0x9'));module[_0x7512('0xa')]=function(_0x3140b3,_0x5d08ae){return _0x3140b3[_0x7512('0xb')](_0x7512('0xc'),attributes,{'tableName':_0x7512('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7512('0xe')]},{'name':_0x7512('0xf'),'fields':[_0x7512('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xdcde3d,_0x37f90c,_0x6303ed){var _0x508ee7=_0x3140b3['models'];var _0x15141d=_0xdcde3d[_0x7512('0x11')]({'plain':!![]});if(_0x15141d[_0x7512('0x12')]['toLowerCase']()==='in'||_0x15141d[_0x7512('0x12')]['toLowerCase']()===_0x7512('0x13')&&!_0x15141d['secret']&&!_[_0x7512('0x14')](_0x15141d[_0x7512('0x15')])){_0x508ee7[_0x7512('0x16')][_0x7512('0x17')]({'where':{'id':_0x15141d[_0x7512('0x18')]}})[_0x7512('0x19')](function(_0x25a711){if(_0x25a711){_0x25a711['update']({'lastMsgAt':_0x15141d[_0x7512('0x1a')],'lastMsgDirection':_0x15141d[_0x7512('0x12')][_0x7512('0x1b')]()});}})[_0x7512('0x1c')](function(_0x289d21){console['error'](_0x289d21);});}if(_0x15141d['direction']==='out'&&!_0x15141d[_0x7512('0x1d')]){var _0x81c072;_0x508ee7[_0x7512('0x1e')]['find']({'where':{'id':_0x15141d[_0x7512('0x1f')]},'raw':!![]})[_0x7512('0x19')](function(_0x5ce79f){_0x81c072=_0x5ce79f;if(_0x81c072&&_0x81c072[_0x7512('0x20')]){switch(_0x81c072[_0x7512('0x20')]){case'twilio':var _0xf319a7=require('twilio');if(_0x81c072['accountSid']&&_0x81c072[_0x7512('0x21')]&&_0x81c072[_0x7512('0x22')]){var _0x41f14d=new _0xf319a7(_0x81c072[_0x7512('0x23')],_0x81c072[_0x7512('0x21')]);_0x41f14d['messages'][_0x7512('0x24')]({'body':_0x15141d[_0x7512('0x10')],'to':_0x7512('0x25')+_0x15141d[_0x7512('0x22')],'from':_0x7512('0x25')+_0x81c072[_0x7512('0x22')],'statusCallback':_0x81c072[_0x7512('0x26')]+_0x7512('0x27')+_0x15141d['id']+_0x7512('0x28')+_0x81c072[_0x7512('0x29')]})[_0x7512('0x19')](function(_0x837a5){if(_0x837a5[_0x7512('0x2a')]){return _0xdcde3d[_0x7512('0x2b')]({'messageId':_0x837a5[_0x7512('0x2a')]});}})[_0x7512('0x1c')](function(_0x282758){logger[_0x7512('0x2c')](_0x7512('0x2d'),'afterCreate',_0x7512('0x2e'),util[_0x7512('0x2f')](_0x282758,{'showHidden':![],'depth':null}));});}else{logger[_0x7512('0x2c')](_0x7512('0x2d'),_0x7512('0x30'),_0x7512('0x2e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x7512('0x31'):var _0x51651d=_0x81c072[_0x7512('0x23')];var _0x2e13ab=_0x81c072[_0x7512('0x21')];var _0x1d3436=_0x81c072[_0x7512('0x32')]+_0x7512('0x33')+_0x51651d+'/messages/';var _0x46762d={'to':[_0x15141d[_0x7512('0x22')]],'message':{'type':_0x7512('0x34'),'text':_0x15141d[_0x7512('0x10')]}};var _0x5b8aea={'method':_0x7512('0x35'),'uri':_0x1d3436,'headers':{'Authorization':_0x7512('0x36')+_0x2e13ab,'Content-Type':_0x7512('0x37')},'body':_0x46762d,'json':!![]};rp(_0x5b8aea)[_0x7512('0x19')](function(_0x2d14cc){if(_0x2d14cc['statuses'][0x0][_0x7512('0x38')]){return _0xdcde3d[_0x7512('0x2b')]({'messageId':_0x2d14cc[_0x7512('0x39')][0x0][_0x7512('0x38')]});}})['catch'](function(_0xd81bd){logger[_0x7512('0x3a')]('WhatsappMessage,\x20%s',_0xd81bd);});break;}}})[_0x7512('0x3b')](function(){_0x6303ed();});}else{_0x6303ed();}}},'charset':_0x7512('0x3c'),'collate':_0x7512('0x3d')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 23db8cc..ff20afe 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 _0x65e3=['WhatsappMessage','body','options','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','CreateWhatsappMessage'];(function(_0x3ac09d,_0x30b817){var _0x2c48bd=function(_0x236b0e){while(--_0x236b0e){_0x3ac09d['push'](_0x3ac09d['shift']());}};_0x2c48bd(++_0x30b817);}(_0x65e3,0x160));var _0x365e=function(_0x4fe32e,_0x43fff3){_0x4fe32e=_0x4fe32e-0x0;var _0x3ca7d1=_0x65e3[_0x4fe32e];return _0x3ca7d1;};'use strict';var _=require(_0x365e('0x0'));var util=require(_0x365e('0x1'));var moment=require('moment');var BPromise=require(_0x365e('0x2'));var rs=require(_0x365e('0x3'));var fs=require('fs');var Redis=require(_0x365e('0x4'));var db=require(_0x365e('0x5'))['db'];var utils=require(_0x365e('0x6'));var logger=require(_0x365e('0x7'))('rpc');var config=require(_0x365e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x365e('0x9')][_0x365e('0xa')]({'port':0x232a});config[_0x365e('0xb')]=_[_0x365e('0xc')](config[_0x365e('0xb')],{'host':_0x365e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x365e('0xb')]));require(_0x365e('0xe'))[_0x365e('0xf')](socket);function respondWithRpcPromise(_0x25bd5a,_0x51aad7,_0x54ef17){return new BPromise(function(_0x56e8e1,_0x3af3c4){return client[_0x365e('0x10')](_0x25bd5a,_0x54ef17)['then'](function(_0x2c255f){logger[_0x365e('0x11')](_0x365e('0x12'),_0x51aad7,_0x365e('0x13'));logger['debug'](_0x365e('0x14'),_0x51aad7,'request\x20sent',JSON['stringify'](_0x2c255f));if(_0x2c255f['error']){if(_0x2c255f[_0x365e('0x15')]['code']===0x1f4){logger[_0x365e('0x15')](_0x365e('0x12'),_0x51aad7,_0x2c255f['error']['message']);return _0x3af3c4(_0x2c255f[_0x365e('0x15')][_0x365e('0x16')]);}logger[_0x365e('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x51aad7,_0x2c255f['error'][_0x365e('0x16')]);return _0x56e8e1(_0x2c255f['error'][_0x365e('0x16')]);}else{logger['info'](_0x365e('0x12'),_0x51aad7,'request\x20sent');_0x56e8e1(_0x2c255f[_0x365e('0x17')][_0x365e('0x16')]);}})['catch'](function(_0x1c6143){logger['error'](_0x365e('0x12'),_0x51aad7,_0x1c6143);_0x3af3c4(_0x1c6143);});});}exports[_0x365e('0x18')]=function(_0x915f98){var _0x1115e1=this;return new Promise(function(_0x3a014f,_0x3e70d6){return db[_0x365e('0x19')]['create'](_0x915f98[_0x365e('0x1a')],{'raw':_0x915f98[_0x365e('0x1b')]?_0x915f98['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x358747){logger['info']('CreateWhatsappMessage',_0x915f98);logger['debug']('CreateWhatsappMessage',_0x915f98,JSON[_0x365e('0x1c')](_0x358747));_0x3a014f(_0x358747);})['catch'](function(_0x3d6801){logger['error'](_0x365e('0x18'),_0x3d6801['message'],_0x915f98);_0x3e70d6(_0x1115e1[_0x365e('0x15')](0x1f4,_0x3d6801[_0x365e('0x16')]));});});}; \ No newline at end of file +var _0xb950=['redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x9ee6b8,_0xe55304){var _0x387838=function(_0x43c649){while(--_0x43c649){_0x9ee6b8['push'](_0x9ee6b8['shift']());}};_0x387838(++_0xe55304);}(_0xb950,0xe9));var _0x0b95=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xb950[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x0b95('0x0'));var util=require(_0x0b95('0x1'));var moment=require(_0x0b95('0x2'));var BPromise=require(_0x0b95('0x3'));var rs=require(_0x0b95('0x4'));var fs=require('fs');var Redis=require(_0x0b95('0x5'));var db=require(_0x0b95('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b95('0x7'))('rpc');var config=require(_0x0b95('0x8'));var jayson=require(_0x0b95('0x9'));var client=jayson[_0x0b95('0xa')][_0x0b95('0xb')]({'port':0x232a});config[_0x0b95('0xc')]=_['defaults'](config[_0x0b95('0xc')],{'host':_0x0b95('0xd'),'port':0x18eb});var socket=require(_0x0b95('0xe'))(new Redis(config[_0x0b95('0xc')]));require(_0x0b95('0xf'))[_0x0b95('0x10')](socket);function respondWithRpcPromise(_0x2b97e2,_0x5f4974,_0x97b545){return new BPromise(function(_0x584218,_0x188a03){return client[_0x0b95('0x11')](_0x2b97e2,_0x97b545)[_0x0b95('0x12')](function(_0x4f94a0){logger[_0x0b95('0x13')](_0x0b95('0x14'),_0x5f4974,_0x0b95('0x15'));logger[_0x0b95('0x16')](_0x0b95('0x17'),_0x5f4974,_0x0b95('0x15'),JSON['stringify'](_0x4f94a0));if(_0x4f94a0[_0x0b95('0x18')]){if(_0x4f94a0[_0x0b95('0x18')][_0x0b95('0x19')]===0x1f4){logger['error'](_0x0b95('0x14'),_0x5f4974,_0x4f94a0[_0x0b95('0x18')][_0x0b95('0x1a')]);return _0x188a03(_0x4f94a0[_0x0b95('0x18')][_0x0b95('0x1a')]);}logger[_0x0b95('0x18')](_0x0b95('0x14'),_0x5f4974,_0x4f94a0['error'][_0x0b95('0x1a')]);return _0x584218(_0x4f94a0[_0x0b95('0x18')][_0x0b95('0x1a')]);}else{logger[_0x0b95('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x5f4974,_0x0b95('0x15'));_0x584218(_0x4f94a0[_0x0b95('0x1b')][_0x0b95('0x1a')]);}})[_0x0b95('0x1c')](function(_0x54ccf3){logger[_0x0b95('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x5f4974,_0x54ccf3);_0x188a03(_0x54ccf3);});});}exports[_0x0b95('0x1d')]=function(_0x10655a){var _0x3b6032=this;return new Promise(function(_0x4b8ebc,_0x3a45e1){return db[_0x0b95('0x1e')][_0x0b95('0x1f')](_0x10655a[_0x0b95('0x20')],{'raw':_0x10655a['options']?_0x10655a[_0x0b95('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x0b95('0x12')](function(_0x19427e){logger[_0x0b95('0x13')](_0x0b95('0x1d'),_0x10655a);logger[_0x0b95('0x16')](_0x0b95('0x1d'),_0x10655a,JSON[_0x0b95('0x22')](_0x19427e));_0x4b8ebc(_0x19427e);})[_0x0b95('0x1c')](function(_0x2898f0){logger['error']('CreateWhatsappMessage',_0x2898f0[_0x0b95('0x1a')],_0x10655a);_0x3a45e1(_0x3b6032[_0x0b95('0x18')](0x1f4,_0x2898f0[_0x0b95('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index d9f3cc4..2df4c6e 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 _0x99fb=['emit','removeListener','length','whatsappMessage:','save'];(function(_0xd467f,_0x346d60){var _0x19ea07=function(_0x2c1100){while(--_0x2c1100){_0xd467f['push'](_0xd467f['shift']());}};_0x19ea07(++_0x346d60);}(_0x99fb,0x103));var _0xb99f=function(_0x5941bb,_0xa3f941){_0x5941bb=_0x5941bb-0x0;var _0x2ae5b0=_0x99fb[_0x5941bb];return _0x2ae5b0;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xb99f('0x0'),'remove','update'];function createListener(_0xe75f86,_0x5c4019){return function(_0x182d98){_0x5c4019[_0xb99f('0x1')](_0xe75f86,_0x182d98);};}function removeListener(_0x24089f,_0x3a94be){return function(){WhatsappMessageEvents[_0xb99f('0x2')](_0x24089f,_0x3a94be);};}exports['register']=function(_0x580ab6){for(var _0x3ea544=0x0,_0x2fc7e7=events[_0xb99f('0x3')];_0x3ea544<_0x2fc7e7;_0x3ea544++){var _0x1ad195=events[_0x3ea544];var _0x12d3e7=createListener(_0xb99f('0x4')+_0x1ad195,_0x580ab6);WhatsappMessageEvents['on'](_0x1ad195,_0x12d3e7);}}; \ No newline at end of file +var _0xce3c=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xce3c,0xbe));var _0xcce3=function(_0x4c15e7,_0x4ad7f5){_0x4c15e7=_0x4c15e7-0x0;var _0x1f119a=_0xce3c[_0x4c15e7];return _0x1f119a;};'use strict';var WhatsappMessageEvents=require(_0xcce3('0x0'));var events=[_0xcce3('0x1'),_0xcce3('0x2'),_0xcce3('0x3')];function createListener(_0x1764fa,_0x62b298){return function(_0x7df097){_0x62b298[_0xcce3('0x4')](_0x1764fa,_0x7df097);};}function removeListener(_0x110d45,_0x5bd1c4){return function(){WhatsappMessageEvents[_0xcce3('0x5')](_0x110d45,_0x5bd1c4);};}exports[_0xcce3('0x6')]=function(_0x206bb3){for(var _0x47fbb5=0x0,_0x47f66e=events[_0xcce3('0x7')];_0x47fbb5<_0x47f66e;_0x47fbb5++){var _0x2841aa=events[_0x47fbb5];var _0x52121b=createListener(_0xcce3('0x8')+_0x2841aa,_0x206bb3);WhatsappMessageEvents['on'](_0x2841aa,_0x52121b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 757d5a7..127d17b 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 _0x4b71=['removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','update','delete','removeTeams'];(function(_0x26bd98,_0x554941){var _0x5c0acf=function(_0x4dbde2){while(--_0x4dbde2){_0x26bd98['push'](_0x26bd98['shift']());}};_0x5c0acf(++_0x554941);}(_0x4b71,0x1a2));var _0x14b7=function(_0x5b3a87,_0x26a49e){_0x5b3a87=_0x5b3a87-0x0;var _0x1a42c6=_0x4b71[_0x5b3a87];return _0x1a42c6;};'use strict';var multer=require(_0x14b7('0x0'));var util=require(_0x14b7('0x1'));var path=require(_0x14b7('0x2'));var timeout=require(_0x14b7('0x3'));var express=require(_0x14b7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x14b7('0x5'));var interaction=require(_0x14b7('0x6'));var config=require(_0x14b7('0x7'));var controller=require('./whatsappQueue.controller');router[_0x14b7('0x8')]('/',auth[_0x14b7('0x9')](),controller[_0x14b7('0xa')]);router[_0x14b7('0x8')]('/describe',auth[_0x14b7('0x9')](),controller[_0x14b7('0xb')]);router[_0x14b7('0x8')](_0x14b7('0xc'),auth[_0x14b7('0x9')](),controller['show']);router[_0x14b7('0x8')](_0x14b7('0xd'),auth[_0x14b7('0x9')](),controller[_0x14b7('0xe')]);router[_0x14b7('0x8')](_0x14b7('0xf'),auth[_0x14b7('0x9')](),controller[_0x14b7('0x10')]);router[_0x14b7('0x8')](_0x14b7('0x11'),auth['isAuthenticated'](),controller[_0x14b7('0x12')]);router[_0x14b7('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth[_0x14b7('0x9')](),controller['addTeams']);router[_0x14b7('0x13')](_0x14b7('0x11'),auth[_0x14b7('0x9')](),controller[_0x14b7('0x14')]);router['put'](_0x14b7('0xc'),auth['isAuthenticated'](),controller[_0x14b7('0x15')]);router[_0x14b7('0x16')](_0x14b7('0xc'),auth[_0x14b7('0x9')](),controller['destroy']);router[_0x14b7('0x16')](_0x14b7('0xf'),auth[_0x14b7('0x9')](),controller[_0x14b7('0x17')]);router[_0x14b7('0x16')](_0x14b7('0x11'),auth[_0x14b7('0x9')](),controller[_0x14b7('0x18')]);module[_0x14b7('0x19')]=router; \ No newline at end of file +var _0x8e17=['put','/:id','update','delete','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','get','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8e17,0x146));var _0x78e1=function(_0x5d02c4,_0x1bbd82){_0x5d02c4=_0x5d02c4-0x0;var _0x1e74ba=_0x8e17[_0x5d02c4];return _0x1e74ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x78e1('0x0'));var timeout=require(_0x78e1('0x1'));var express=require(_0x78e1('0x2'));var router=express[_0x78e1('0x3')]();var fs_extra=require(_0x78e1('0x4'));var auth=require(_0x78e1('0x5'));var interaction=require(_0x78e1('0x6'));var config=require(_0x78e1('0x7'));var controller=require(_0x78e1('0x8'));router['get']('/',auth[_0x78e1('0x9')](),controller['index']);router[_0x78e1('0xa')](_0x78e1('0xb'),auth[_0x78e1('0x9')](),controller[_0x78e1('0xc')]);router[_0x78e1('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x78e1('0xd'),auth['isAuthenticated'](),controller[_0x78e1('0xe')]);router[_0x78e1('0xa')](_0x78e1('0xf'),auth[_0x78e1('0x9')](),controller[_0x78e1('0x10')]);router[_0x78e1('0xa')](_0x78e1('0x11'),auth[_0x78e1('0x9')](),controller[_0x78e1('0x12')]);router['post']('/',auth[_0x78e1('0x9')](),controller[_0x78e1('0x13')]);router[_0x78e1('0x14')]('/:id/teams',auth[_0x78e1('0x9')](),controller[_0x78e1('0x15')]);router[_0x78e1('0x14')](_0x78e1('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x78e1('0x16')](_0x78e1('0x17'),auth[_0x78e1('0x9')](),controller[_0x78e1('0x18')]);router[_0x78e1('0x19')]('/:id',auth[_0x78e1('0x9')](),controller['destroy']);router[_0x78e1('0x19')](_0x78e1('0xf'),auth[_0x78e1('0x9')](),controller[_0x78e1('0x1a')]);router[_0x78e1('0x19')](_0x78e1('0x11'),auth['isAuthenticated'](),controller[_0x78e1('0x1b')]);module[_0x78e1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index bea02b5..141d5e1 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 _0x6d4a=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6d4a,0x117));var _0xa6d4=function(_0x1c34e9,_0x409c07){_0x1c34e9=_0x1c34e9-0x0;var _0x1dbc8d=_0x6d4a[_0x1c34e9];return _0x1dbc8d;};'use strict';var Sequelize=require(_0xa6d4('0x0'));module['exports']={'name':{'type':Sequelize[_0xa6d4('0x1')],'unique':_0xa6d4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa6d4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa6d4('0x4')](_0xa6d4('0x5'),_0xa6d4('0x6'),_0xa6d4('0x7'))},'description':{'type':Sequelize[_0xa6d4('0x1')]}}; \ No newline at end of file +var _0xfa2f=['rrmemory','roundrobin','STRING','INTEGER','ENUM'];(function(_0x5b517d,_0x5ba318){var _0x2cd6cb=function(_0x2f378b){while(--_0x2f378b){_0x5b517d['push'](_0x5b517d['shift']());}};_0x2cd6cb(++_0x5ba318);}(_0xfa2f,0xe8));var _0xffa2=function(_0x21dba0,_0x1b1d86){_0x21dba0=_0x21dba0-0x0;var _0x3f4b35=_0xfa2f[_0x21dba0];return _0x3f4b35;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xffa2('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xffa2('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xffa2('0x2')](_0xffa2('0x3'),'beepall',_0xffa2('0x4'))},'description':{'type':Sequelize[_0xffa2('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index c100fea..88c577a 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 _0x620d=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappQueueId','filter','merge','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','push','every','TeamId','includes','all','union','compact','value','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','ioredis','../../components/parsers/qs','../../config/environment','redis','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','get','WhatsappQueues','UserProfileResource','destroy','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','include','query','findAll','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','options','find','create'];(function(_0x2edd8e,_0x2f5e3e){var _0x570e69=function(_0x30295a){while(--_0x30295a){_0x2edd8e['push'](_0x2edd8e['shift']());}};_0x570e69(++_0x2f5e3e);}(_0x620d,0x12c));var _0xd620=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x620d[_0x1d1779];return _0x2377e9;};'use strict';var BPromise=require(_0xd620('0x0'));var util=require(_0xd620('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xd620('0x2'));var qs=require(_0xd620('0x3'));var logger=require('../../config/logger')('api');var config=require(_0xd620('0x4'));var db=require('../../mysqldb')['db'];config[_0xd620('0x5')]=_['defaults'](config[_0xd620('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd620('0x5')]));require('./whatsappQueue.socket')[_0xd620('0x6')](socket);function respondWithStatusCode(_0x1d89b7,_0x4248e1){_0x4248e1=_0x4248e1||0xcc;return function(_0x43c601){if(_0x43c601){return _0x1d89b7[_0xd620('0x7')](_0x4248e1);}return _0x1d89b7[_0xd620('0x8')](_0x4248e1)['end']();};}function respondWithResult(_0x31ff4f,_0x3b4d54){_0x3b4d54=_0x3b4d54||0xc8;return function(_0x3f689a){if(_0x3f689a){return _0x31ff4f['status'](_0x3b4d54)[_0xd620('0x9')](_0x3f689a);}};}function respondWithFilteredResult(_0x335e0b,_0x3049ca){return function(_0x59b35e){if(_0x59b35e){var _0x6da7ef=typeof _0x3049ca[_0xd620('0xa')]===_0xd620('0xb')&&typeof _0x3049ca['limit']==='undefined';var _0x108c25=_0x59b35e[_0xd620('0xc')];var _0x3e2639=_0x6da7ef?0x0:_0x3049ca[_0xd620('0xa')];var _0x1e062c=_0x6da7ef?_0x59b35e[_0xd620('0xc')]:_0x3049ca[_0xd620('0xa')]+_0x3049ca[_0xd620('0xd')];var _0x5b3bb4;if(_0x1e062c>=_0x108c25){_0x1e062c=_0x108c25;_0x5b3bb4=0xc8;}else{_0x5b3bb4=0xce;}_0x335e0b[_0xd620('0x8')](_0x5b3bb4);return _0x335e0b[_0xd620('0xe')](_0xd620('0xf'),_0x3e2639+'-'+_0x1e062c+'/'+_0x108c25)[_0xd620('0x9')](_0x59b35e);}return null;};}function saveUpdates(_0xc84023){return function(_0x43cade){if(_0x43cade){return _0x43cade[_0xd620('0x10')](_0xc84023)[_0xd620('0x11')](function(_0x448faf){return _0x448faf;});}return null;};}function removeEntity(_0x2bf57f){return function(_0x357c78){if(_0x357c78){return _0x357c78['destroy']()[_0xd620('0x11')](function(){var _0x4d75b8=_0x357c78[_0xd620('0x12')]({'plain':!![]});var _0x5d6aee=_0xd620('0x13');return db[_0xd620('0x14')][_0xd620('0x15')]({'where':{'type':_0x5d6aee,'resourceId':_0x4d75b8['id']}})[_0xd620('0x11')](function(){return _0x357c78;});})[_0xd620('0x11')](function(){_0x2bf57f[_0xd620('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14e140){return function(_0xaa6a0e){if(!_0xaa6a0e){_0x14e140['sendStatus'](0x194);}return _0xaa6a0e;};}function handleError(_0xf178ce,_0x30717b){_0x30717b=_0x30717b||0x1f4;return function(_0x2ac396){logger['error'](_0x2ac396['stack']);if(_0x2ac396[_0xd620('0x16')]){delete _0x2ac396['name'];}_0xf178ce['status'](_0x30717b)[_0xd620('0x17')](_0x2ac396);};}exports[_0xd620('0x18')]=function(_0x277ddd,_0x2fe579){var _0x520005={};var _0x108e46={'count':0x0,'rows':[]};var _0x1a2258=_[_0xd620('0x19')](db[_0xd620('0x1a')][_0xd620('0x1b')],function(_0xd2cdf5){return{'name':_0xd2cdf5[_0xd620('0x1c')],'type':_0xd2cdf5[_0xd620('0x1d')][_0xd620('0x1e')]};});_0x520005=qs[_0xd620('0x1f')](_0x1a2258,_0x277ddd);var _0x3f71f7={'where':_0x520005['where']};return db[_0xd620('0x1a')][_0xd620('0xc')](_0x3f71f7)[_0xd620('0x11')](function(_0x45a48b){_0x108e46[_0xd620('0xc')]=_0x45a48b;_0x520005[_0xd620('0x20')]=qs[_0xd620('0x20')](_0x277ddd[_0xd620('0x21')]);return db['WhatsappQueue'][_0xd620('0x22')](_0x520005);})['then'](function(_0xbbfff1){_0x108e46['rows']=_0xbbfff1;return _0x108e46;})[_0xd620('0x11')](respondWithFilteredResult(_0x2fe579,_0x520005))[_0xd620('0x23')](handleError(_0x2fe579,null));};exports[_0xd620('0x24')]=function(_0x380859,_0x5522e7){var _0x1c409c={'raw':!![],'where':{'id':_0x380859['params']['id']}},_0x36813f={};_0x36813f[_0xd620('0x25')]=_['keys'](db[_0xd620('0x1a')]['rawAttributes']);_0x36813f['query']=_[_0xd620('0x26')](_0x380859[_0xd620('0x21')]);_0x36813f[_0xd620('0x27')]=_[_0xd620('0x28')](_0x36813f[_0xd620('0x25')],_0x36813f[_0xd620('0x21')]);_0x1c409c[_0xd620('0x29')]=_[_0xd620('0x28')](_0x36813f[_0xd620('0x25')],qs[_0xd620('0x2a')](_0x380859[_0xd620('0x21')]['fields']));_0x1c409c[_0xd620('0x29')]=_0x1c409c[_0xd620('0x29')][_0xd620('0x2b')]?_0x1c409c['attributes']:_0x36813f[_0xd620('0x25')];if(_0x380859[_0xd620('0x21')][_0xd620('0x2c')]){_0x1c409c[_0xd620('0x20')]=[{'all':!![]}];}_0x1c409c=_['merge']({},_0x1c409c,_0x380859[_0xd620('0x2d')]);return db['WhatsappQueue'][_0xd620('0x2e')](_0x1c409c)[_0xd620('0x11')](handleEntityNotFound(_0x5522e7,null))[_0xd620('0x11')](respondWithResult(_0x5522e7,null))[_0xd620('0x23')](handleError(_0x5522e7,null));};exports[_0xd620('0x2f')]=function(_0x10022f,_0xfa1184){return db[_0xd620('0x1a')]['create'](_0x10022f[_0xd620('0x30')],{})[_0xd620('0x11')](function(_0x5de391){var _0x49414e=_0x10022f[_0xd620('0x31')]['get']({'plain':!![]});if(!_0x49414e)throw new Error(_0xd620('0x32'));if(_0x49414e['role']===_0xd620('0x31')){var _0x780a50=_0x5de391[_0xd620('0x12')]({'plain':!![]});var _0x2dc024=_0xd620('0x13');return db[_0xd620('0x33')][_0xd620('0x2e')]({'where':{'name':_0x2dc024,'userProfileId':_0x49414e[_0xd620('0x34')]},'raw':!![]})['then'](function(_0x68f642){if(_0x68f642&&_0x68f642['autoAssociation']===0x0){return db[_0xd620('0x14')][_0xd620('0x2f')]({'name':_0x780a50['name'],'resourceId':_0x780a50['id'],'type':_0x68f642['name'],'sectionId':_0x68f642['id']},{})[_0xd620('0x11')](function(){return _0x5de391;});}else{return _0x5de391;}})[_0xd620('0x23')](function(_0xbe5b87){logger[_0xd620('0x35')](_0xd620('0x36'),_0xbe5b87);throw _0xbe5b87;});}return _0x5de391;})[_0xd620('0x11')](respondWithResult(_0xfa1184,0xc9))[_0xd620('0x23')](handleError(_0xfa1184,null));};exports[_0xd620('0x10')]=function(_0x288bfd,_0x265d6c){if(_0x288bfd[_0xd620('0x30')]['id']){delete _0x288bfd[_0xd620('0x30')]['id'];}return db[_0xd620('0x1a')][_0xd620('0x2e')]({'where':{'id':_0x288bfd[_0xd620('0x37')]['id']}})['then'](handleEntityNotFound(_0x265d6c,null))['then'](saveUpdates(_0x288bfd[_0xd620('0x30')],null))[_0xd620('0x11')](respondWithResult(_0x265d6c,null))['catch'](handleError(_0x265d6c,null));};exports['destroy']=function(_0x26db16,_0x568d92){return db['WhatsappQueue'][_0xd620('0x2e')]({'where':{'id':_0x26db16['params']['id']}})['then'](handleEntityNotFound(_0x568d92,null))['then'](removeEntity(_0x568d92,null))[_0xd620('0x23')](handleError(_0x568d92,null));};exports[_0xd620('0x38')]=function(_0x3a4ea5,_0x213da3){return db[_0xd620('0x1a')]['describe']()[_0xd620('0x11')](respondWithResult(_0x213da3,null))['catch'](handleError(_0x213da3,null));};exports[_0xd620('0x39')]=function(_0x9c8a5e,_0x5ec2ab){var _0x2326de={'raw':!![],'where':{}},_0x32f056={},_0x2ad16c;return db[_0xd620('0x1a')][_0xd620('0x3a')]({'where':{'id':_0x9c8a5e[_0xd620('0x37')]['id']}})[_0xd620('0x11')](handleEntityNotFound(_0x5ec2ab,null))[_0xd620('0x11')](function(_0x578f94){if(_0x578f94){_0x2ad16c=_0x578f94[_0xd620('0x12')]({'plain':!![]});_0x32f056[_0xd620('0x25')]=_['keys'](db[_0xd620('0x3b')][_0xd620('0x1b')]);_0x32f056[_0xd620('0x21')]=_[_0xd620('0x26')](_0x9c8a5e[_0xd620('0x21')]);_0x32f056['filters']=_[_0xd620('0x28')](_0x32f056[_0xd620('0x25')],_0x32f056[_0xd620('0x21')]);_0x2326de['attributes']=_[_0xd620('0x28')](_0x32f056['model'],qs[_0xd620('0x2a')](_0x9c8a5e[_0xd620('0x21')][_0xd620('0x2a')]));_0x2326de[_0xd620('0x29')]=_0x2326de[_0xd620('0x29')][_0xd620('0x2b')]?_0x2326de[_0xd620('0x29')]:_0x32f056[_0xd620('0x25')];if(!_0x9c8a5e[_0xd620('0x21')][_0xd620('0x3c')](_0xd620('0x3d'))){_0x2326de[_0xd620('0xd')]=qs[_0xd620('0xd')](_0x9c8a5e['query'][_0xd620('0xd')]);_0x2326de['offset']=qs[_0xd620('0xa')](_0x9c8a5e['query']['offset']);}_0x2326de[_0xd620('0x3e')]=qs[_0xd620('0x3f')](_0x9c8a5e[_0xd620('0x21')]['sort']);_0x2326de[_0xd620('0x40')]=qs[_0xd620('0x27')](_[_0xd620('0x41')](_0x9c8a5e[_0xd620('0x21')],_0x32f056[_0xd620('0x27')]));_0x2326de['where'][_0xd620('0x42')]=_0x578f94['id'];if(_0x9c8a5e['query'][_0xd620('0x43')]){_0x2326de['where']=_[_0xd620('0x44')](_0x2326de[_0xd620('0x40')],{'$or':_[_0xd620('0x19')](_0x2326de[_0xd620('0x29')],function(_0xaae4f0){var _0x46241a={};_0x46241a[_0xaae4f0]={'$like':'%'+_0x9c8a5e[_0xd620('0x21')][_0xd620('0x43')]+'%'};return _0x46241a;})});}_0x2326de=_[_0xd620('0x44')]({},_0x2326de,_0x9c8a5e[_0xd620('0x2d')]);return db['UserWhatsappQueue'][_0xd620('0x22')](_0x2326de);}})[_0xd620('0x11')](function(_0x1d9db9){if(_0x1d9db9){return db[_0xd620('0x45')]['findAndCountAll']({'where':{'id':_[_0xd620('0x19')](_0x1d9db9,_0xd620('0x46')),'role':_0xd620('0x47')},'attributes':['id','name',_0xd620('0x48'),_0xd620('0x49'),_0xd620('0x4a')]});}})[_0xd620('0x11')](function(_0x4448ae){if(_0x4448ae){return{'count':_0x4448ae[_0xd620('0xc')],'rows':_['map'](_0x4448ae['rows'],function(_0x237ffc){return{'membername':_0x237ffc[_0xd620('0x16')],'UserId':_0x237ffc['id'],'queue_name':_0x2ad16c[_0xd620('0x16')],'WhatsappQueueId':_0x2ad16c['id'],'interface':util[_0xd620('0x4b')](_0xd620('0x4c'),_0xd620('0x4d'),_0x237ffc[_0xd620('0x16')]),'penalty':0x0,'paused':_0x237ffc[_0xd620('0x48')],'createdAt':_0x237ffc[_0xd620('0x4a')],'updatedAt':_0x237ffc[_0xd620('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd620('0x11')](respondWithFilteredResult(_0x5ec2ab,_0x2326de))[_0xd620('0x23')](handleError(_0x5ec2ab,null));};exports[_0xd620('0x4e')]=function(_0xd8289c,_0x5ed334){var _0x2133eb={};var _0x5ab8b8={};var _0x3f9c5b;var _0x336e6e;return db[_0xd620('0x1a')][_0xd620('0x3a')]({'where':{'id':_0xd8289c[_0xd620('0x37')]['id']}})[_0xd620('0x11')](handleEntityNotFound(_0x5ed334,null))[_0xd620('0x11')](function(_0x5756a8){if(_0x5756a8){_0x3f9c5b=_0x5756a8;_0x5ab8b8[_0xd620('0x25')]=_[_0xd620('0x26')](db[_0xd620('0x4f')]['rawAttributes']);_0x5ab8b8['query']=_[_0xd620('0x26')](_0xd8289c[_0xd620('0x21')]);_0x5ab8b8['filters']=_[_0xd620('0x28')](_0x5ab8b8[_0xd620('0x25')],_0x5ab8b8[_0xd620('0x21')]);_0x2133eb['attributes']=_[_0xd620('0x28')](_0x5ab8b8[_0xd620('0x25')],qs['fields'](_0xd8289c['query'][_0xd620('0x2a')]));_0x2133eb[_0xd620('0x29')]=_0x2133eb[_0xd620('0x29')][_0xd620('0x2b')]?_0x2133eb[_0xd620('0x29')]:_0x5ab8b8[_0xd620('0x25')];_0x2133eb['order']=qs[_0xd620('0x3f')](_0xd8289c[_0xd620('0x21')][_0xd620('0x3f')]);_0x2133eb['where']=qs[_0xd620('0x27')](_[_0xd620('0x41')](_0xd8289c[_0xd620('0x21')],_0x5ab8b8[_0xd620('0x27')]));if(_0xd8289c['query'][_0xd620('0x43')]){_0x2133eb[_0xd620('0x40')]=_[_0xd620('0x44')](_0x2133eb['where'],{'$or':_[_0xd620('0x19')](_0x2133eb[_0xd620('0x29')],function(_0x69394c){var _0x5d66da={};_0x5d66da[_0x69394c]={'$like':'%'+_0xd8289c[_0xd620('0x21')]['filter']+'%'};return _0x5d66da;})});}_0x2133eb=_[_0xd620('0x44')]({},_0x2133eb,_0xd8289c[_0xd620('0x2d')]);return _0x3f9c5b['getTeams'](_0x2133eb);}})[_0xd620('0x11')](function(_0x58cfd7){if(_0x58cfd7){_0x336e6e=_0x58cfd7[_0xd620('0x2b')];if(!_0xd8289c[_0xd620('0x21')][_0xd620('0x3c')](_0xd620('0x3d'))){_0x2133eb[_0xd620('0xd')]=qs[_0xd620('0xd')](_0xd8289c[_0xd620('0x21')]['limit']);_0x2133eb[_0xd620('0xa')]=qs['offset'](_0xd8289c[_0xd620('0x21')]['offset']);}return _0x3f9c5b[_0xd620('0x4e')](_0x2133eb);}})[_0xd620('0x11')](function(_0x57c605){if(_0x57c605){return _0x57c605?{'count':_0x336e6e,'rows':_0x57c605}:null;}})[_0xd620('0x11')](respondWithResult(_0x5ed334,null))['catch'](handleError(_0x5ed334,null));};exports[_0xd620('0x50')]=function(_0x3c54ab,_0x2e13d7){var _0x158d6e=_0x3c54ab['body'][_0xd620('0x51')];return db['Team'][_0xd620('0x22')]({'where':{'id':_0x158d6e},'attributes':['id'],'include':[{'model':db[_0xd620('0x45')],'as':_0xd620('0x52'),'attributes':['id','name',_0xd620('0x53'),_0xd620('0x54'),'interface'],'raw':!![]}]})['then'](function(_0x7efe81){if(_0x7efe81){var _0x51b432=_[_0xd620('0x55')](_0x7efe81,function(_0x39eea4){var _0x5a089e=_0x39eea4[_0xd620('0x12')]({'plain':!![]});return _0x5a089e[_0xd620('0x52')];});return db['WhatsappQueue'][_0xd620('0x2e')]({'where':{'id':_0x3c54ab[_0xd620('0x37')]['id']}})[_0xd620('0x11')](function(_0x3c0890){return db[_0xd620('0x56')][_0xd620('0x57')](function(_0x608709){return _0x3c0890[_0xd620('0x50')](_0x158d6e,{'transaction':_0x608709})[_0xd620('0x11')](function(){return BPromise[_0xd620('0x58')](_0x51b432,function(_0x34005e){return db[_0xd620('0x3b')][_0xd620('0x59')]({'where':{'UserId':_0x34005e['id'],'WhatsappQueueId':_0x3c54ab[_0xd620('0x37')]['id']},'transaction':_0x608709});});})[_0xd620('0x11')](function(){_0x51b432[_0xd620('0x5a')](function(_0x2a67af){socket[_0xd620('0x5b')](_0xd620('0x5c'),{'UserId':_0x2a67af['id'],'WhatsappQueueId':_0x3c0890['id']});});});});});}})[_0xd620('0x11')](respondWithStatusCode(_0x2e13d7,null))['catch'](handleError(_0x2e13d7,null));};exports[_0xd620('0x5d')]=function(_0x5785d1,_0xe4b978){return db[_0xd620('0x4f')][_0xd620('0x22')]({'where':{'id':_0x5785d1[_0xd620('0x21')][_0xd620('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd620('0x52'),'attributes':['id'],'raw':!![]}]})[_0xd620('0x11')](handleEntityNotFound(_0xe4b978,null))[_0xd620('0x11')](function(_0x50e4ed){var _0xd654c9=_['map'](_0x50e4ed,'id');var _0x1deedb=[];var _0x1d3d4b=[];var _0x540cdc=squel[_0xd620('0x5e')]();_0x540cdc[_0xd620('0x5f')](_0xd620('0x60'))[_0xd620('0x61')](_0xd620('0x62'),'tq')[_0xd620('0x63')](_0xd620('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd620('0x65'),_0x5785d1[_0xd620('0x37')]['id']);for(var _0x531915=0x0;_0x531915<_0x50e4ed[_0xd620('0x2b')];_0x531915+=0x1){let _0x4c3c7c=_0x50e4ed[_0x531915];for(var _0x2d7bd3=0x0;_0x2d7bd3<_0x4c3c7c[_0xd620('0x52')][_0xd620('0x2b')];_0x2d7bd3+=0x1){let _0x52117d=_0x4c3c7c[_0xd620('0x52')][_0x2d7bd3];var _0x61f493=_0x540cdc[_0xd620('0x66')]();_0x61f493[_0xd620('0x40')]('ut.UserId\x20=\x20?',_0x52117d['id']);_0x1d3d4b[_0xd620('0x67')](db['sequelize'][_0xd620('0x21')](_0x61f493['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x39182e){if(_0x39182e[_0xd620('0x2b')]===0x1){return _0x52117d['id'];}else{var _0x1a89de=_[_0xd620('0x68')](_[_0xd620('0x19')](_0x39182e,_0xd620('0x69')),function(_0x40dfea){return _[_0xd620('0x6a')](_0xd654c9,_0x40dfea);});if(_0x1a89de){return _0x52117d['id'];}}}));}}return BPromise[_0xd620('0x6b')](_0x1d3d4b)[_0xd620('0x11')](function(_0x1f33d7){_0x1deedb=_(_0x1deedb)[_0xd620('0x6c')](_0x1f33d7)[_0xd620('0x6d')]()[_0xd620('0x6e')]();return db[_0xd620('0x1a')][_0xd620('0x2e')]({'where':{'id':_0x5785d1['params']['id']}})[_0xd620('0x11')](function(_0x7569e8){return db[_0xd620('0x56')][_0xd620('0x57')](function(_0x41aa03){return _0x7569e8[_0xd620('0x5d')](_0x5785d1[_0xd620('0x21')][_0xd620('0x51')],{'transaction':_0x41aa03})['then'](function(){if(!_['isEmpty'](_0x1deedb)){return _0x7569e8['removeAgents'](_0x1deedb,{'transaction':_0x41aa03});}})[_0xd620('0x11')](function(){_0x1deedb[_0xd620('0x5a')](function(_0x25611f){socket[_0xd620('0x5b')](_0xd620('0x6f'),{'UserId':_0x25611f,'WhatsappQueueId':_0x7569e8['id']});});});});});});})[_0xd620('0x11')](respondWithStatusCode(_0xe4b978,null))[_0xd620('0x23')](handleError(_0xe4b978,null));};exports[_0xd620('0x70')]=function(_0x41863b,_0x3138e4){return db[_0xd620('0x1a')]['find']({'where':{'id':_0x41863b[_0xd620('0x37')]['id']}})[_0xd620('0x11')](handleEntityNotFound(_0x3138e4,null))[_0xd620('0x11')](function(_0x1e0cc9){if(_0x1e0cc9){return _0x1e0cc9[_0xd620('0x70')](_0x41863b[_0xd620('0x30')][_0xd620('0x51')],_['omit'](_0x41863b[_0xd620('0x30')],[_0xd620('0x51'),'id'])||{})[_0xd620('0x71')](function(_0x4c1755){for(var _0x3240a5=0x0;_0x3240a5<_0x41863b[_0xd620('0x30')][_0xd620('0x51')][_0xd620('0x2b')];_0x3240a5+=0x1){socket['emit'](_0xd620('0x5c'),{'UserId':Number(_0x41863b[_0xd620('0x30')][_0xd620('0x51')][_0x3240a5]),'WhatsappQueueId':Number(_0x41863b[_0xd620('0x37')]['id'])});}return _0x4c1755;});}})[_0xd620('0x11')](respondWithResult(_0x3138e4,null))[_0xd620('0x23')](handleError(_0x3138e4,null));};exports['removeAgents']=function(_0x7efa46,_0x2f0852){return db[_0xd620('0x1a')][_0xd620('0x2e')]({'where':{'id':_0x7efa46[_0xd620('0x37')]['id']}})['then'](handleEntityNotFound(_0x2f0852,null))[_0xd620('0x11')](function(_0x42b737){if(_0x42b737){return _0x42b737['removeAgents'](_0x7efa46[_0xd620('0x21')][_0xd620('0x51')])[_0xd620('0x11')](function(){if(_[_0xd620('0x72')](_0x7efa46[_0xd620('0x21')][_0xd620('0x51')])){for(var _0x1a7103=0x0;_0x1a7103<_0x7efa46[_0xd620('0x21')]['ids']['length'];_0x1a7103+=0x1){socket['emit'](_0xd620('0x6f'),{'UserId':Number(_0x7efa46[_0xd620('0x21')][_0xd620('0x51')][_0x1a7103]),'WhatsappQueueId':Number(_0x7efa46[_0xd620('0x37')]['id'])});}}else{socket[_0xd620('0x5b')]('userWhatsappQueue:remove',{'UserId':Number(_0x7efa46[_0xd620('0x21')]['ids']),'WhatsappQueueId':Number(_0x7efa46[_0xd620('0x37')]['id'])});}});}})[_0xd620('0x11')](respondWithStatusCode(_0x2f0852,null))[_0xd620('0x23')](handleError(_0x2f0852,null));};exports[_0xd620('0x73')]=function(_0x2a49d0,_0x509189){var _0x3a5b14={};var _0x405ed0={};var _0x30f5f9;var _0x58dbbd;return db[_0xd620('0x1a')]['findOne']({'where':{'id':_0x2a49d0[_0xd620('0x37')]['id']}})[_0xd620('0x11')](handleEntityNotFound(_0x509189,null))[_0xd620('0x11')](function(_0x32c3b4){if(_0x32c3b4){_0x30f5f9=_0x32c3b4;_0x405ed0[_0xd620('0x25')]=_['keys'](db[_0xd620('0x45')][_0xd620('0x1b')]);_0x405ed0['query']=_[_0xd620('0x26')](_0x2a49d0[_0xd620('0x21')]);_0x405ed0[_0xd620('0x27')]=_['intersection'](_0x405ed0[_0xd620('0x25')],_0x405ed0['query']);_0x3a5b14['attributes']=_[_0xd620('0x28')](_0x405ed0[_0xd620('0x25')],qs[_0xd620('0x2a')](_0x2a49d0[_0xd620('0x21')][_0xd620('0x2a')]));_0x3a5b14[_0xd620('0x29')]=_0x3a5b14[_0xd620('0x29')][_0xd620('0x2b')]?_0x3a5b14[_0xd620('0x29')]:_0x405ed0[_0xd620('0x25')];_0x3a5b14[_0xd620('0x3e')]=qs[_0xd620('0x3f')](_0x2a49d0[_0xd620('0x21')][_0xd620('0x3f')]);_0x3a5b14['where']=qs[_0xd620('0x27')](_[_0xd620('0x41')](_0x2a49d0['query'],_0x405ed0[_0xd620('0x27')]));if(_0x2a49d0[_0xd620('0x21')][_0xd620('0x43')]){_0x3a5b14[_0xd620('0x40')]=_['merge'](_0x3a5b14[_0xd620('0x40')],{'$or':_[_0xd620('0x19')](_0x3a5b14['attributes'],function(_0x245c5d){var _0x5ef089={};_0x5ef089[_0x245c5d]={'$like':'%'+_0x2a49d0[_0xd620('0x21')][_0xd620('0x43')]+'%'};return _0x5ef089;})});}_0x3a5b14=_[_0xd620('0x44')]({},_0x3a5b14,_0x2a49d0[_0xd620('0x2d')]);return _0x30f5f9['getAgents'](_0x3a5b14);}})[_0xd620('0x11')](function(_0x3d68ff){if(_0x3d68ff){_0x58dbbd=_0x3d68ff['length'];if(!_0x2a49d0[_0xd620('0x21')][_0xd620('0x3c')](_0xd620('0x3d'))){_0x3a5b14[_0xd620('0xd')]=qs[_0xd620('0xd')](_0x2a49d0[_0xd620('0x21')][_0xd620('0xd')]);_0x3a5b14['offset']=qs['offset'](_0x2a49d0[_0xd620('0x21')][_0xd620('0xa')]);}return _0x30f5f9['getAgents'](_0x3a5b14);}})[_0xd620('0x11')](function(_0x14cb04){if(_0x14cb04){return _0x14cb04?{'count':_0x58dbbd,'rows':_0x14cb04}:null;}})[_0xd620('0x11')](respondWithResult(_0x509189,null))[_0xd620('0x23')](handleError(_0x509189,null));}; \ No newline at end of file +var _0x5cbc=['../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','json','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','length','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','all','union','compact','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x1331fb,_0x20da4f){var _0x547f5d=function(_0x972167){while(--_0x972167){_0x1331fb['push'](_0x1331fb['shift']());}};_0x547f5d(++_0x20da4f);}(_0x5cbc,0x74));var _0xc5cb=function(_0x4812c9,_0x154b76){_0x4812c9=_0x4812c9-0x0;var _0x4de61f=_0x5cbc[_0x4812c9];return _0x4de61f;};'use strict';var BPromise=require(_0xc5cb('0x0'));var util=require(_0xc5cb('0x1'));var _=require(_0xc5cb('0x2'));var squel=require(_0xc5cb('0x3'));var Redis=require(_0xc5cb('0x4'));var qs=require(_0xc5cb('0x5'));var logger=require(_0xc5cb('0x6'))(_0xc5cb('0x7'));var config=require(_0xc5cb('0x8'));var db=require('../../mysqldb')['db'];config[_0xc5cb('0x9')]=_[_0xc5cb('0xa')](config[_0xc5cb('0x9')],{'host':_0xc5cb('0xb'),'port':0x18eb});var socket=require(_0xc5cb('0xc'))(new Redis(config[_0xc5cb('0x9')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x3afa9f,_0x2f57b6){_0x2f57b6=_0x2f57b6||0xcc;return function(_0x396842){if(_0x396842){return _0x3afa9f[_0xc5cb('0xd')](_0x2f57b6);}return _0x3afa9f[_0xc5cb('0xe')](_0x2f57b6)[_0xc5cb('0xf')]();};}function respondWithResult(_0x262e25,_0x26e921){_0x26e921=_0x26e921||0xc8;return function(_0x22b889){if(_0x22b889){return _0x262e25['status'](_0x26e921)['json'](_0x22b889);}};}function respondWithFilteredResult(_0x456a51,_0x12c762){return function(_0x5eb3d9){if(_0x5eb3d9){var _0x25346d=typeof _0x12c762[_0xc5cb('0x10')]===_0xc5cb('0x11')&&typeof _0x12c762[_0xc5cb('0x12')]===_0xc5cb('0x11');var _0x213292=_0x5eb3d9[_0xc5cb('0x13')];var _0x42cf89=_0x25346d?0x0:_0x12c762[_0xc5cb('0x10')];var _0x2cf354=_0x25346d?_0x5eb3d9['count']:_0x12c762[_0xc5cb('0x10')]+_0x12c762[_0xc5cb('0x12')];var _0x2f27d0;if(_0x2cf354>=_0x213292){_0x2cf354=_0x213292;_0x2f27d0=0xc8;}else{_0x2f27d0=0xce;}_0x456a51['status'](_0x2f27d0);return _0x456a51['set']('Content-Range',_0x42cf89+'-'+_0x2cf354+'/'+_0x213292)[_0xc5cb('0x14')](_0x5eb3d9);}return null;};}function saveUpdates(_0x476b2f){return function(_0x45a4f5){if(_0x45a4f5){return _0x45a4f5[_0xc5cb('0x15')](_0x476b2f)[_0xc5cb('0x16')](function(_0x591752){return _0x591752;});}return null;};}function removeEntity(_0x419fc1){return function(_0x28bc9e){if(_0x28bc9e){return _0x28bc9e[_0xc5cb('0x17')]()[_0xc5cb('0x16')](function(){var _0x12a723=_0x28bc9e[_0xc5cb('0x18')]({'plain':!![]});var _0x472934=_0xc5cb('0x19');return db[_0xc5cb('0x1a')]['destroy']({'where':{'type':_0x472934,'resourceId':_0x12a723['id']}})[_0xc5cb('0x16')](function(){return _0x28bc9e;});})[_0xc5cb('0x16')](function(){_0x419fc1[_0xc5cb('0xe')](0xcc)[_0xc5cb('0xf')]();});}};}function handleEntityNotFound(_0x239c7b){return function(_0x2189a0){if(!_0x2189a0){_0x239c7b[_0xc5cb('0xd')](0x194);}return _0x2189a0;};}function handleError(_0x49cd5a,_0x1338f8){_0x1338f8=_0x1338f8||0x1f4;return function(_0x398b74){logger[_0xc5cb('0x1b')](_0x398b74[_0xc5cb('0x1c')]);if(_0x398b74['name']){delete _0x398b74[_0xc5cb('0x1d')];}_0x49cd5a[_0xc5cb('0xe')](_0x1338f8)['send'](_0x398b74);};}exports[_0xc5cb('0x1e')]=function(_0x447a4e,_0xa3d757){var _0x26ef23={};var _0x2a95a6={'count':0x0,'rows':[]};var _0x20808c=_[_0xc5cb('0x1f')](db[_0xc5cb('0x20')][_0xc5cb('0x21')],function(_0xb72e97){return{'name':_0xb72e97[_0xc5cb('0x22')],'type':_0xb72e97[_0xc5cb('0x23')][_0xc5cb('0x24')]};});_0x26ef23=qs[_0xc5cb('0x25')](_0x20808c,_0x447a4e);var _0x1d84ad={'where':_0x26ef23[_0xc5cb('0x26')]};return db[_0xc5cb('0x20')][_0xc5cb('0x13')](_0x1d84ad)[_0xc5cb('0x16')](function(_0x19f08f){_0x2a95a6[_0xc5cb('0x13')]=_0x19f08f;_0x26ef23[_0xc5cb('0x27')]=qs[_0xc5cb('0x27')](_0x447a4e[_0xc5cb('0x28')]);return db['WhatsappQueue'][_0xc5cb('0x29')](_0x26ef23);})['then'](function(_0x3abbff){_0x2a95a6['rows']=_0x3abbff;return _0x2a95a6;})[_0xc5cb('0x16')](respondWithFilteredResult(_0xa3d757,_0x26ef23))[_0xc5cb('0x2a')](handleError(_0xa3d757,null));};exports[_0xc5cb('0x2b')]=function(_0x299e2d,_0x3f5dc7){var _0x46f88a={'raw':!![],'where':{'id':_0x299e2d[_0xc5cb('0x2c')]['id']}},_0x4b934d={};_0x4b934d[_0xc5cb('0x2d')]=_[_0xc5cb('0x2e')](db['WhatsappQueue'][_0xc5cb('0x21')]);_0x4b934d['query']=_[_0xc5cb('0x2e')](_0x299e2d[_0xc5cb('0x28')]);_0x4b934d[_0xc5cb('0x2f')]=_[_0xc5cb('0x30')](_0x4b934d[_0xc5cb('0x2d')],_0x4b934d['query']);_0x46f88a[_0xc5cb('0x31')]=_[_0xc5cb('0x30')](_0x4b934d['model'],qs[_0xc5cb('0x32')](_0x299e2d['query'][_0xc5cb('0x32')]));_0x46f88a[_0xc5cb('0x31')]=_0x46f88a[_0xc5cb('0x31')]['length']?_0x46f88a[_0xc5cb('0x31')]:_0x4b934d[_0xc5cb('0x2d')];if(_0x299e2d[_0xc5cb('0x28')][_0xc5cb('0x33')]){_0x46f88a[_0xc5cb('0x27')]=[{'all':!![]}];}_0x46f88a=_[_0xc5cb('0x34')]({},_0x46f88a,_0x299e2d[_0xc5cb('0x35')]);return db['WhatsappQueue'][_0xc5cb('0x36')](_0x46f88a)[_0xc5cb('0x16')](handleEntityNotFound(_0x3f5dc7,null))['then'](respondWithResult(_0x3f5dc7,null))[_0xc5cb('0x2a')](handleError(_0x3f5dc7,null));};exports[_0xc5cb('0x37')]=function(_0x428e1f,_0x19a6dc){return db[_0xc5cb('0x20')][_0xc5cb('0x37')](_0x428e1f[_0xc5cb('0x38')],{})['then'](function(_0x966cc5){var _0x47ac2e=_0x428e1f[_0xc5cb('0x39')][_0xc5cb('0x18')]({'plain':!![]});if(!_0x47ac2e)throw new Error(_0xc5cb('0x3a'));if(_0x47ac2e[_0xc5cb('0x3b')]==='user'){var _0x271fa5=_0x966cc5[_0xc5cb('0x18')]({'plain':!![]});var _0xc5f736=_0xc5cb('0x19');return db[_0xc5cb('0x3c')][_0xc5cb('0x36')]({'where':{'name':_0xc5f736,'userProfileId':_0x47ac2e['userProfileId']},'raw':!![]})['then'](function(_0x1d2882){if(_0x1d2882&&_0x1d2882['autoAssociation']===0x0){return db[_0xc5cb('0x1a')][_0xc5cb('0x37')]({'name':_0x271fa5[_0xc5cb('0x1d')],'resourceId':_0x271fa5['id'],'type':_0x1d2882[_0xc5cb('0x1d')],'sectionId':_0x1d2882['id']},{})['then'](function(){return _0x966cc5;});}else{return _0x966cc5;}})[_0xc5cb('0x2a')](function(_0x370414){logger[_0xc5cb('0x1b')](_0xc5cb('0x3d'),_0x370414);throw _0x370414;});}return _0x966cc5;})[_0xc5cb('0x16')](respondWithResult(_0x19a6dc,0xc9))['catch'](handleError(_0x19a6dc,null));};exports[_0xc5cb('0x15')]=function(_0x68eec1,_0x14c493){if(_0x68eec1[_0xc5cb('0x38')]['id']){delete _0x68eec1[_0xc5cb('0x38')]['id'];}return db['WhatsappQueue'][_0xc5cb('0x36')]({'where':{'id':_0x68eec1[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](handleEntityNotFound(_0x14c493,null))[_0xc5cb('0x16')](saveUpdates(_0x68eec1[_0xc5cb('0x38')],null))[_0xc5cb('0x16')](respondWithResult(_0x14c493,null))[_0xc5cb('0x2a')](handleError(_0x14c493,null));};exports[_0xc5cb('0x17')]=function(_0x4463cd,_0x535931){return db[_0xc5cb('0x20')][_0xc5cb('0x36')]({'where':{'id':_0x4463cd['params']['id']}})[_0xc5cb('0x16')](handleEntityNotFound(_0x535931,null))['then'](removeEntity(_0x535931,null))[_0xc5cb('0x2a')](handleError(_0x535931,null));};exports[_0xc5cb('0x3e')]=function(_0x5648d6,_0x4b6bae){return db[_0xc5cb('0x20')][_0xc5cb('0x3e')]()[_0xc5cb('0x16')](respondWithResult(_0x4b6bae,null))[_0xc5cb('0x2a')](handleError(_0x4b6bae,null));};exports[_0xc5cb('0x3f')]=function(_0xa9413c,_0x2bc9c7){var _0x13dd36={'raw':!![],'where':{}},_0x2d8486={},_0xefb34e;return db[_0xc5cb('0x20')][_0xc5cb('0x40')]({'where':{'id':_0xa9413c[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](handleEntityNotFound(_0x2bc9c7,null))[_0xc5cb('0x16')](function(_0x3e4ab5){if(_0x3e4ab5){_0xefb34e=_0x3e4ab5[_0xc5cb('0x18')]({'plain':!![]});_0x2d8486[_0xc5cb('0x2d')]=_['keys'](db[_0xc5cb('0x41')][_0xc5cb('0x21')]);_0x2d8486[_0xc5cb('0x28')]=_[_0xc5cb('0x2e')](_0xa9413c[_0xc5cb('0x28')]);_0x2d8486[_0xc5cb('0x2f')]=_['intersection'](_0x2d8486[_0xc5cb('0x2d')],_0x2d8486['query']);_0x13dd36[_0xc5cb('0x31')]=_[_0xc5cb('0x30')](_0x2d8486['model'],qs[_0xc5cb('0x32')](_0xa9413c[_0xc5cb('0x28')][_0xc5cb('0x32')]));_0x13dd36[_0xc5cb('0x31')]=_0x13dd36[_0xc5cb('0x31')][_0xc5cb('0x42')]?_0x13dd36['attributes']:_0x2d8486[_0xc5cb('0x2d')];if(!_0xa9413c[_0xc5cb('0x28')][_0xc5cb('0x43')](_0xc5cb('0x44'))){_0x13dd36['limit']=qs[_0xc5cb('0x12')](_0xa9413c[_0xc5cb('0x28')][_0xc5cb('0x12')]);_0x13dd36[_0xc5cb('0x10')]=qs[_0xc5cb('0x10')](_0xa9413c[_0xc5cb('0x28')]['offset']);}_0x13dd36[_0xc5cb('0x45')]=qs[_0xc5cb('0x46')](_0xa9413c[_0xc5cb('0x28')][_0xc5cb('0x46')]);_0x13dd36[_0xc5cb('0x26')]=qs[_0xc5cb('0x2f')](_[_0xc5cb('0x47')](_0xa9413c[_0xc5cb('0x28')],_0x2d8486[_0xc5cb('0x2f')]));_0x13dd36[_0xc5cb('0x26')][_0xc5cb('0x48')]=_0x3e4ab5['id'];if(_0xa9413c['query'][_0xc5cb('0x49')]){_0x13dd36[_0xc5cb('0x26')]=_[_0xc5cb('0x34')](_0x13dd36['where'],{'$or':_[_0xc5cb('0x1f')](_0x13dd36[_0xc5cb('0x31')],function(_0x2692aa){var _0x1268f5={};_0x1268f5[_0x2692aa]={'$like':'%'+_0xa9413c[_0xc5cb('0x28')][_0xc5cb('0x49')]+'%'};return _0x1268f5;})});}_0x13dd36=_['merge']({},_0x13dd36,_0xa9413c[_0xc5cb('0x35')]);return db[_0xc5cb('0x41')][_0xc5cb('0x29')](_0x13dd36);}})[_0xc5cb('0x16')](function(_0x4ab855){if(_0x4ab855){return db[_0xc5cb('0x4a')][_0xc5cb('0x4b')]({'where':{'id':_[_0xc5cb('0x1f')](_0x4ab855,_0xc5cb('0x4c')),'role':_0xc5cb('0x4d')},'attributes':['id','name',_0xc5cb('0x4e'),_0xc5cb('0x4f'),_0xc5cb('0x50')]});}})['then'](function(_0x3abd71){if(_0x3abd71){return{'count':_0x3abd71[_0xc5cb('0x13')],'rows':_[_0xc5cb('0x1f')](_0x3abd71[_0xc5cb('0x51')],function(_0x2805ad){return{'membername':_0x2805ad['name'],'UserId':_0x2805ad['id'],'queue_name':_0xefb34e[_0xc5cb('0x1d')],'WhatsappQueueId':_0xefb34e['id'],'interface':util[_0xc5cb('0x52')](_0xc5cb('0x53'),_0xc5cb('0x54'),_0x2805ad[_0xc5cb('0x1d')]),'penalty':0x0,'paused':_0x2805ad[_0xc5cb('0x4e')],'createdAt':_0x2805ad[_0xc5cb('0x50')],'updatedAt':_0x2805ad[_0xc5cb('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc5cb('0x16')](respondWithFilteredResult(_0x2bc9c7,_0x13dd36))['catch'](handleError(_0x2bc9c7,null));};exports[_0xc5cb('0x55')]=function(_0x40d3e7,_0x40234a){var _0x5ab2d5={};var _0x37c13e={};var _0x1147fb;var _0x383866;return db['WhatsappQueue'][_0xc5cb('0x40')]({'where':{'id':_0x40d3e7[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](handleEntityNotFound(_0x40234a,null))[_0xc5cb('0x16')](function(_0x2a0d1c){if(_0x2a0d1c){_0x1147fb=_0x2a0d1c;_0x37c13e[_0xc5cb('0x2d')]=_['keys'](db[_0xc5cb('0x56')]['rawAttributes']);_0x37c13e[_0xc5cb('0x28')]=_[_0xc5cb('0x2e')](_0x40d3e7[_0xc5cb('0x28')]);_0x37c13e[_0xc5cb('0x2f')]=_[_0xc5cb('0x30')](_0x37c13e[_0xc5cb('0x2d')],_0x37c13e['query']);_0x5ab2d5[_0xc5cb('0x31')]=_['intersection'](_0x37c13e['model'],qs[_0xc5cb('0x32')](_0x40d3e7[_0xc5cb('0x28')][_0xc5cb('0x32')]));_0x5ab2d5[_0xc5cb('0x31')]=_0x5ab2d5[_0xc5cb('0x31')]['length']?_0x5ab2d5[_0xc5cb('0x31')]:_0x37c13e[_0xc5cb('0x2d')];_0x5ab2d5[_0xc5cb('0x45')]=qs[_0xc5cb('0x46')](_0x40d3e7[_0xc5cb('0x28')][_0xc5cb('0x46')]);_0x5ab2d5[_0xc5cb('0x26')]=qs[_0xc5cb('0x2f')](_[_0xc5cb('0x47')](_0x40d3e7['query'],_0x37c13e['filters']));if(_0x40d3e7['query'][_0xc5cb('0x49')]){_0x5ab2d5[_0xc5cb('0x26')]=_['merge'](_0x5ab2d5[_0xc5cb('0x26')],{'$or':_['map'](_0x5ab2d5[_0xc5cb('0x31')],function(_0x293f8f){var _0x2a6520={};_0x2a6520[_0x293f8f]={'$like':'%'+_0x40d3e7[_0xc5cb('0x28')][_0xc5cb('0x49')]+'%'};return _0x2a6520;})});}_0x5ab2d5=_[_0xc5cb('0x34')]({},_0x5ab2d5,_0x40d3e7[_0xc5cb('0x35')]);return _0x1147fb[_0xc5cb('0x55')](_0x5ab2d5);}})['then'](function(_0x21ed94){if(_0x21ed94){_0x383866=_0x21ed94['length'];if(!_0x40d3e7[_0xc5cb('0x28')]['hasOwnProperty'](_0xc5cb('0x44'))){_0x5ab2d5[_0xc5cb('0x12')]=qs[_0xc5cb('0x12')](_0x40d3e7['query'][_0xc5cb('0x12')]);_0x5ab2d5[_0xc5cb('0x10')]=qs[_0xc5cb('0x10')](_0x40d3e7[_0xc5cb('0x28')][_0xc5cb('0x10')]);}return _0x1147fb[_0xc5cb('0x55')](_0x5ab2d5);}})[_0xc5cb('0x16')](function(_0x2d1351){if(_0x2d1351){return _0x2d1351?{'count':_0x383866,'rows':_0x2d1351}:null;}})[_0xc5cb('0x16')](respondWithResult(_0x40234a,null))[_0xc5cb('0x2a')](handleError(_0x40234a,null));};exports['addTeams']=function(_0x3dbca8,_0x2a092e){var _0x5b6c84=_0x3dbca8[_0xc5cb('0x38')][_0xc5cb('0x57')];return db[_0xc5cb('0x56')][_0xc5cb('0x29')]({'where':{'id':_0x5b6c84},'attributes':['id'],'include':[{'model':db[_0xc5cb('0x4a')],'as':_0xc5cb('0x58'),'attributes':['id',_0xc5cb('0x1d'),_0xc5cb('0x59'),_0xc5cb('0x5a'),_0xc5cb('0x5b')],'raw':!![]}]})[_0xc5cb('0x16')](function(_0x3e0c64){if(_0x3e0c64){var _0x2fd380=_[_0xc5cb('0x5c')](_0x3e0c64,function(_0x3fe0b3){var _0x5c1aba=_0x3fe0b3[_0xc5cb('0x18')]({'plain':!![]});return _0x5c1aba[_0xc5cb('0x58')];});return db['WhatsappQueue'][_0xc5cb('0x36')]({'where':{'id':_0x3dbca8[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](function(_0x4d95fe){return db[_0xc5cb('0x5d')]['transaction'](function(_0x37d0b1){return _0x4d95fe[_0xc5cb('0x5e')](_0x5b6c84,{'transaction':_0x37d0b1})[_0xc5cb('0x16')](function(){return BPromise[_0xc5cb('0x5f')](_0x2fd380,function(_0xedc889){return db[_0xc5cb('0x41')][_0xc5cb('0x60')]({'where':{'UserId':_0xedc889['id'],'WhatsappQueueId':_0x3dbca8[_0xc5cb('0x2c')]['id']},'transaction':_0x37d0b1});});})['then'](function(){_0x2fd380[_0xc5cb('0x61')](function(_0x214c7e){socket['emit'](_0xc5cb('0x62'),{'UserId':_0x214c7e['id'],'WhatsappQueueId':_0x4d95fe['id']});});});});});}})[_0xc5cb('0x16')](respondWithStatusCode(_0x2a092e,null))[_0xc5cb('0x2a')](handleError(_0x2a092e,null));};exports[_0xc5cb('0x63')]=function(_0x42c4dd,_0x35bbe4){return db['Team']['findAll']({'where':{'id':_0x42c4dd[_0xc5cb('0x28')][_0xc5cb('0x57')]},'attributes':['id'],'include':[{'model':db[_0xc5cb('0x4a')],'as':_0xc5cb('0x58'),'attributes':['id'],'raw':!![]}]})[_0xc5cb('0x16')](handleEntityNotFound(_0x35bbe4,null))[_0xc5cb('0x16')](function(_0x35ad58){var _0x1a826b=_['map'](_0x35ad58,'id');var _0x454e38=[];var _0x2879be=[];var _0x145912=squel[_0xc5cb('0x64')]();_0x145912[_0xc5cb('0x65')](_0xc5cb('0x66'))['from'](_0xc5cb('0x67'),'tq')[_0xc5cb('0x68')](_0xc5cb('0x69'),'ut',_0xc5cb('0x6a'))[_0xc5cb('0x26')](_0xc5cb('0x6b'),_0x42c4dd[_0xc5cb('0x2c')]['id']);for(var _0x1a6d90=0x0;_0x1a6d90<_0x35ad58[_0xc5cb('0x42')];_0x1a6d90+=0x1){let _0x21e234=_0x35ad58[_0x1a6d90];for(var _0x520f6e=0x0;_0x520f6e<_0x21e234['Agents'][_0xc5cb('0x42')];_0x520f6e+=0x1){let _0x2b26e4=_0x21e234[_0xc5cb('0x58')][_0x520f6e];var _0x5c4c0f=_0x145912[_0xc5cb('0x6c')]();_0x5c4c0f[_0xc5cb('0x26')](_0xc5cb('0x6d'),_0x2b26e4['id']);_0x2879be[_0xc5cb('0x6e')](db['sequelize'][_0xc5cb('0x28')](_0x5c4c0f['toString'](),{'type':db[_0xc5cb('0x5d')][_0xc5cb('0x6f')][_0xc5cb('0x70')]})[_0xc5cb('0x16')](function(_0x5d32e3){if(_0x5d32e3[_0xc5cb('0x42')]===0x1){return _0x2b26e4['id'];}else{var _0x5e8f13=_['every'](_[_0xc5cb('0x1f')](_0x5d32e3,_0xc5cb('0x71')),function(_0x4bc618){return _['includes'](_0x1a826b,_0x4bc618);});if(_0x5e8f13){return _0x2b26e4['id'];}}}));}}return BPromise[_0xc5cb('0x72')](_0x2879be)[_0xc5cb('0x16')](function(_0x34305f){_0x454e38=_(_0x454e38)[_0xc5cb('0x73')](_0x34305f)[_0xc5cb('0x74')]()['value']();return db['WhatsappQueue'][_0xc5cb('0x36')]({'where':{'id':_0x42c4dd[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](function(_0x1c51b2){return db[_0xc5cb('0x5d')]['transaction'](function(_0x7e11aa){return _0x1c51b2[_0xc5cb('0x63')](_0x42c4dd[_0xc5cb('0x28')][_0xc5cb('0x57')],{'transaction':_0x7e11aa})['then'](function(){if(!_[_0xc5cb('0x75')](_0x454e38)){return _0x1c51b2[_0xc5cb('0x76')](_0x454e38,{'transaction':_0x7e11aa});}})[_0xc5cb('0x16')](function(){_0x454e38[_0xc5cb('0x61')](function(_0x2ca177){socket[_0xc5cb('0x77')](_0xc5cb('0x78'),{'UserId':_0x2ca177,'WhatsappQueueId':_0x1c51b2['id']});});});});});});})['then'](respondWithStatusCode(_0x35bbe4,null))[_0xc5cb('0x2a')](handleError(_0x35bbe4,null));};exports[_0xc5cb('0x79')]=function(_0x532492,_0x30f7ff){return db[_0xc5cb('0x20')][_0xc5cb('0x36')]({'where':{'id':_0x532492[_0xc5cb('0x2c')]['id']}})['then'](handleEntityNotFound(_0x30f7ff,null))[_0xc5cb('0x16')](function(_0x4c2a8a){if(_0x4c2a8a){return _0x4c2a8a[_0xc5cb('0x79')](_0x532492[_0xc5cb('0x38')]['ids'],_['omit'](_0x532492[_0xc5cb('0x38')],[_0xc5cb('0x57'),'id'])||{})['spread'](function(_0x24f86d){for(var _0x634ed0=0x0;_0x634ed0<_0x532492[_0xc5cb('0x38')][_0xc5cb('0x57')]['length'];_0x634ed0+=0x1){socket[_0xc5cb('0x77')](_0xc5cb('0x62'),{'UserId':Number(_0x532492[_0xc5cb('0x38')][_0xc5cb('0x57')][_0x634ed0]),'WhatsappQueueId':Number(_0x532492[_0xc5cb('0x2c')]['id'])});}return _0x24f86d;});}})[_0xc5cb('0x16')](respondWithResult(_0x30f7ff,null))[_0xc5cb('0x2a')](handleError(_0x30f7ff,null));};exports[_0xc5cb('0x76')]=function(_0x297af6,_0x35fbb9){return db[_0xc5cb('0x20')][_0xc5cb('0x36')]({'where':{'id':_0x297af6[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](handleEntityNotFound(_0x35fbb9,null))['then'](function(_0x1e259c){if(_0x1e259c){return _0x1e259c[_0xc5cb('0x76')](_0x297af6['query']['ids'])[_0xc5cb('0x16')](function(){if(_[_0xc5cb('0x7a')](_0x297af6['query'][_0xc5cb('0x57')])){for(var _0x309702=0x0;_0x309702<_0x297af6[_0xc5cb('0x28')][_0xc5cb('0x57')][_0xc5cb('0x42')];_0x309702+=0x1){socket[_0xc5cb('0x77')](_0xc5cb('0x78'),{'UserId':Number(_0x297af6[_0xc5cb('0x28')][_0xc5cb('0x57')][_0x309702]),'WhatsappQueueId':Number(_0x297af6[_0xc5cb('0x2c')]['id'])});}}else{socket[_0xc5cb('0x77')](_0xc5cb('0x78'),{'UserId':Number(_0x297af6[_0xc5cb('0x28')][_0xc5cb('0x57')]),'WhatsappQueueId':Number(_0x297af6[_0xc5cb('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x35fbb9,null))[_0xc5cb('0x2a')](handleError(_0x35fbb9,null));};exports['getAgents']=function(_0x2d5f5c,_0xe9116c){var _0x3c65b6={};var _0x147fa9={};var _0xd15313;var _0x1852de;return db[_0xc5cb('0x20')][_0xc5cb('0x40')]({'where':{'id':_0x2d5f5c['params']['id']}})['then'](handleEntityNotFound(_0xe9116c,null))[_0xc5cb('0x16')](function(_0x2df06f){if(_0x2df06f){_0xd15313=_0x2df06f;_0x147fa9[_0xc5cb('0x2d')]=_['keys'](db[_0xc5cb('0x4a')][_0xc5cb('0x21')]);_0x147fa9[_0xc5cb('0x28')]=_[_0xc5cb('0x2e')](_0x2d5f5c[_0xc5cb('0x28')]);_0x147fa9[_0xc5cb('0x2f')]=_[_0xc5cb('0x30')](_0x147fa9['model'],_0x147fa9[_0xc5cb('0x28')]);_0x3c65b6[_0xc5cb('0x31')]=_['intersection'](_0x147fa9[_0xc5cb('0x2d')],qs[_0xc5cb('0x32')](_0x2d5f5c[_0xc5cb('0x28')][_0xc5cb('0x32')]));_0x3c65b6[_0xc5cb('0x31')]=_0x3c65b6['attributes'][_0xc5cb('0x42')]?_0x3c65b6[_0xc5cb('0x31')]:_0x147fa9[_0xc5cb('0x2d')];_0x3c65b6[_0xc5cb('0x45')]=qs['sort'](_0x2d5f5c[_0xc5cb('0x28')][_0xc5cb('0x46')]);_0x3c65b6['where']=qs[_0xc5cb('0x2f')](_[_0xc5cb('0x47')](_0x2d5f5c['query'],_0x147fa9[_0xc5cb('0x2f')]));if(_0x2d5f5c[_0xc5cb('0x28')][_0xc5cb('0x49')]){_0x3c65b6['where']=_[_0xc5cb('0x34')](_0x3c65b6[_0xc5cb('0x26')],{'$or':_['map'](_0x3c65b6[_0xc5cb('0x31')],function(_0x541726){var _0x30d747={};_0x30d747[_0x541726]={'$like':'%'+_0x2d5f5c[_0xc5cb('0x28')][_0xc5cb('0x49')]+'%'};return _0x30d747;})});}_0x3c65b6=_['merge']({},_0x3c65b6,_0x2d5f5c[_0xc5cb('0x35')]);return _0xd15313['getAgents'](_0x3c65b6);}})['then'](function(_0x5f024a){if(_0x5f024a){_0x1852de=_0x5f024a[_0xc5cb('0x42')];if(!_0x2d5f5c['query'][_0xc5cb('0x43')](_0xc5cb('0x44'))){_0x3c65b6[_0xc5cb('0x12')]=qs[_0xc5cb('0x12')](_0x2d5f5c['query'][_0xc5cb('0x12')]);_0x3c65b6[_0xc5cb('0x10')]=qs[_0xc5cb('0x10')](_0x2d5f5c[_0xc5cb('0x28')][_0xc5cb('0x10')]);}return _0xd15313[_0xc5cb('0x7b')](_0x3c65b6);}})[_0xc5cb('0x16')](function(_0x3e2520){if(_0x3e2520){return _0x3e2520?{'count':_0x1852de,'rows':_0x3e2520}:null;}})['then'](respondWithResult(_0xe9116c,null))[_0xc5cb('0x2a')](handleError(_0xe9116c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 183419a..d3c120a 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 _0xfb2e=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue','update'];(function(_0x18d226,_0x154b44){var _0x16ef45=function(_0x26cc15){while(--_0x26cc15){_0x18d226['push'](_0x18d226['shift']());}};_0x16ef45(++_0x154b44);}(_0xfb2e,0x165));var _0xefb2=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xfb2e[_0x2b5eae];return _0x5f3ac9;};'use strict';var EventEmitter=require(_0xefb2('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xefb2('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xefb2('0x2'),'afterDestroy':_0xefb2('0x3')};function emitEvent(_0x2876bb){return function(_0x493912,_0x59a193,_0x54e264){WhatsappQueueEvents['emit'](_0x2876bb+':'+_0x493912['id'],_0x493912);WhatsappQueueEvents[_0xefb2('0x4')](_0x2876bb,_0x493912);_0x54e264(null);};}for(var e in events){if(events[_0xefb2('0x5')](e)){var event=events[e];WhatsappQueue[_0xefb2('0x6')](e,emitEvent(event));}}module[_0xefb2('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xd60c=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0xf485fd,_0x5f34e0){var _0x5010c2=function(_0x4ef3cc){while(--_0x4ef3cc){_0xf485fd['push'](_0xf485fd['shift']());}};_0x5010c2(++_0x5f34e0);}(_0xd60c,0x99));var _0xcd60=function(_0x55fed9,_0xc9729d){_0x55fed9=_0x55fed9-0x0;var _0x30ea64=_0xd60c[_0x55fed9];return _0x30ea64;};'use strict';var EventEmitter=require(_0xcd60('0x0'));var WhatsappQueue=require(_0xcd60('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xcd60('0x2')](0x0);var events={'afterCreate':_0xcd60('0x3'),'afterUpdate':_0xcd60('0x4'),'afterDestroy':_0xcd60('0x5')};function emitEvent(_0x3a1a1f){return function(_0x96c68c,_0x5d52b7,_0x145e5b){WhatsappQueueEvents['emit'](_0x3a1a1f+':'+_0x96c68c['id'],_0x96c68c);WhatsappQueueEvents[_0xcd60('0x6')](_0x3a1a1f,_0x96c68c);_0x145e5b(null);};}for(var e in events){if(events[_0xcd60('0x7')](e)){var event=events[e];WhatsappQueue[_0xcd60('0x8')](e,emitEvent(event));}}module[_0xcd60('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index cd672b2..2457efc 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 _0xad03=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x38ae4f,_0x1d3180){var _0x1e92db=function(_0x1a1cb9){while(--_0x1a1cb9){_0x38ae4f['push'](_0x38ae4f['shift']());}};_0x1e92db(++_0x1d3180);}(_0xad03,0xe7));var _0x3ad0=function(_0x5a7f22,_0x426a7c){_0x5a7f22=_0x5a7f22-0x0;var _0x5d0e3f=_0xad03[_0x5a7f22];return _0x5d0e3f;};'use strict';var _=require('lodash');var util=require(_0x3ad0('0x0'));var logger=require(_0x3ad0('0x1'))('api');var moment=require(_0x3ad0('0x2'));var BPromise=require(_0x3ad0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ad0('0x4'));var rimraf=require(_0x3ad0('0x5'));var config=require(_0x3ad0('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x3ad0('0x7')]=function(_0x216db6,_0x2f3750){return _0x216db6[_0x3ad0('0x8')](_0x3ad0('0x9'),attributes,{'tableName':_0x3ad0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf939=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueue','whatsapp_queues'];(function(_0x7ac741,_0x5d25b2){var _0x5cff77=function(_0x3f6a78){while(--_0x3f6a78){_0x7ac741['push'](_0x7ac741['shift']());}};_0x5cff77(++_0x5d25b2);}(_0xf939,0x1b0));var _0x9f93=function(_0x410ff7,_0x55c99c){_0x410ff7=_0x410ff7-0x0;var _0x5a0232=_0xf939[_0x410ff7];return _0x5a0232;};'use strict';var _=require(_0x9f93('0x0'));var util=require('util');var logger=require(_0x9f93('0x1'))(_0x9f93('0x2'));var moment=require(_0x9f93('0x3'));var BPromise=require(_0x9f93('0x4'));var rp=require(_0x9f93('0x5'));var fs=require('fs');var path=require(_0x9f93('0x6'));var rimraf=require(_0x9f93('0x7'));var config=require(_0x9f93('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0x9f93('0x9')]=function(_0xcc9996,_0x35f40a){return _0xcc9996['define'](_0x9f93('0xa'),attributes,{'tableName':_0x9f93('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 9af8867..9ce1ca2 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 _0x8b74=['error','code','WhatsappQueue,\x20%s,\x20%s','message','catch','GetWhatsappQueue','WhatsappQueue','options','raw','attributes','limit','include','model','map','info','ShowWhatsappQueue','find','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x396d59,_0x1d8b49){var _0x245256=function(_0x21c713){while(--_0x21c713){_0x396d59['push'](_0x396d59['shift']());}};_0x245256(++_0x1d8b49);}(_0x8b74,0x183));var _0x48b7=function(_0x41c2de,_0x4e99a8){_0x41c2de=_0x41c2de-0x0;var _0x3f89e2=_0x8b74[_0x41c2de];return _0x3f89e2;};'use strict';var _=require('lodash');var util=require(_0x48b7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x48b7('0x1'));var fs=require('fs');var Redis=require(_0x48b7('0x2'));var db=require(_0x48b7('0x3'))['db'];var utils=require(_0x48b7('0x4'));var logger=require(_0x48b7('0x5'))('rpc');var config=require(_0x48b7('0x6'));var jayson=require(_0x48b7('0x7'));var client=jayson[_0x48b7('0x8')][_0x48b7('0x9')]({'port':0x232a});config[_0x48b7('0xa')]=_['defaults'](config[_0x48b7('0xa')],{'host':_0x48b7('0xb'),'port':0x18eb});var socket=require(_0x48b7('0xc'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x48b7('0xd')](socket);function respondWithRpcPromise(_0x1f3f0b,_0x25f101,_0x549c56){return new BPromise(function(_0x3dc057,_0x634b25){return client[_0x48b7('0xe')](_0x1f3f0b,_0x549c56)[_0x48b7('0xf')](function(_0x13cc21){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x25f101,_0x48b7('0x10'));logger[_0x48b7('0x11')](_0x48b7('0x12'),_0x25f101,_0x48b7('0x10'),JSON[_0x48b7('0x13')](_0x13cc21));if(_0x13cc21[_0x48b7('0x14')]){if(_0x13cc21[_0x48b7('0x14')][_0x48b7('0x15')]===0x1f4){logger[_0x48b7('0x14')](_0x48b7('0x16'),_0x25f101,_0x13cc21[_0x48b7('0x14')]['message']);return _0x634b25(_0x13cc21[_0x48b7('0x14')]['message']);}logger['error'](_0x48b7('0x16'),_0x25f101,_0x13cc21[_0x48b7('0x14')][_0x48b7('0x17')]);return _0x3dc057(_0x13cc21[_0x48b7('0x14')][_0x48b7('0x17')]);}else{logger['info'](_0x48b7('0x16'),_0x25f101,_0x48b7('0x10'));_0x3dc057(_0x13cc21['result']['message']);}})[_0x48b7('0x18')](function(_0x5dc828){logger['error'](_0x48b7('0x16'),_0x25f101,_0x5dc828);_0x634b25(_0x5dc828);});});}exports[_0x48b7('0x19')]=function(_0x4011bf){var _0x5b9596=this;return new Promise(function(_0x54b88f,_0x40f3e0){return db[_0x48b7('0x1a')]['findAll']({'raw':_0x4011bf[_0x48b7('0x1b')]?_0x4011bf['options'][_0x48b7('0x1c')]===undefined?!![]:![]:!![],'where':_0x4011bf[_0x48b7('0x1b')]?_0x4011bf[_0x48b7('0x1b')]['where']||null:null,'attributes':_0x4011bf['options']?_0x4011bf[_0x48b7('0x1b')][_0x48b7('0x1d')]||null:null,'limit':_0x4011bf[_0x48b7('0x1b')]?_0x4011bf[_0x48b7('0x1b')][_0x48b7('0x1e')]||null:null,'include':_0x4011bf['options']?_0x4011bf[_0x48b7('0x1b')]['include']?_['map'](_0x4011bf[_0x48b7('0x1b')][_0x48b7('0x1f')],function(_0x2b923b){return{'model':db[_0x2b923b[_0x48b7('0x20')]],'as':_0x2b923b['as'],'attributes':_0x2b923b[_0x48b7('0x1d')],'include':_0x2b923b[_0x48b7('0x1f')]?_[_0x48b7('0x21')](_0x2b923b[_0x48b7('0x1f')],function(_0x27037c){return{'model':db[_0x27037c[_0x48b7('0x20')]],'as':_0x27037c['as'],'attributes':_0x27037c[_0x48b7('0x1d')],'include':_0x27037c[_0x48b7('0x1f')]?_[_0x48b7('0x21')](_0x27037c[_0x48b7('0x1f')],function(_0x47f72){return{'model':db[_0x47f72[_0x48b7('0x20')]],'as':_0x47f72['as'],'attributes':_0x47f72['attributes']};}):[]};}):[]};}):[]:[]})[_0x48b7('0xf')](function(_0x1eca32){logger[_0x48b7('0x22')]('GetWhatsappQueue',_0x4011bf);logger['debug']('GetWhatsappQueue',_0x4011bf,JSON['stringify'](_0x1eca32));_0x54b88f(_0x1eca32);})[_0x48b7('0x18')](function(_0x29dd8e){logger[_0x48b7('0x14')](_0x48b7('0x19'),_0x29dd8e['message'],_0x4011bf);_0x40f3e0(_0x5b9596[_0x48b7('0x14')](0x1f4,_0x29dd8e[_0x48b7('0x17')]));});});};exports[_0x48b7('0x23')]=function(_0x4848f6){var _0x2a1f18=this;return new Promise(function(_0xdf6f17,_0x158fa8){return db[_0x48b7('0x1a')][_0x48b7('0x24')]({'raw':_0x4848f6[_0x48b7('0x1b')]?_0x4848f6['options'][_0x48b7('0x1c')]===undefined?!![]:![]:!![],'where':_0x4848f6[_0x48b7('0x1b')]?_0x4848f6[_0x48b7('0x1b')]['where']||null:null,'attributes':_0x4848f6['options']?_0x4848f6['options'][_0x48b7('0x1d')]||null:null,'include':_0x4848f6[_0x48b7('0x1b')]?_0x4848f6['options']['include']?_['map'](_0x4848f6[_0x48b7('0x1b')][_0x48b7('0x1f')],function(_0xff9177){return{'model':db[_0xff9177[_0x48b7('0x20')]],'as':_0xff9177['as'],'attributes':_0xff9177[_0x48b7('0x1d')],'include':_0xff9177['include']?_['map'](_0xff9177[_0x48b7('0x1f')],function(_0x234b1a){return{'model':db[_0x234b1a['model']],'as':_0x234b1a['as'],'attributes':_0x234b1a['attributes'],'include':_0x234b1a[_0x48b7('0x1f')]?_[_0x48b7('0x21')](_0x234b1a[_0x48b7('0x1f')],function(_0x55b444){return{'model':db[_0x55b444[_0x48b7('0x20')]],'as':_0x55b444['as'],'attributes':_0x55b444[_0x48b7('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1120e2){logger[_0x48b7('0x22')](_0x48b7('0x23'),_0x4848f6);logger[_0x48b7('0x11')](_0x48b7('0x23'),_0x4848f6,JSON[_0x48b7('0x13')](_0x1120e2));_0xdf6f17(_0x1120e2);})[_0x48b7('0x18')](function(_0x2181c1){logger['error']('ShowWhatsappQueue',_0x2181c1[_0x48b7('0x17')],_0x4848f6);_0x158fa8(_0x2a1f18[_0x48b7('0x14')](0x1f4,_0x2181c1[_0x48b7('0x17')]));});});}; \ No newline at end of file +var _0x8b41=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit','include','map','model','attributes','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x351998,_0x23b175){var _0x2d836a=function(_0xe002d6){while(--_0xe002d6){_0x351998['push'](_0x351998['shift']());}};_0x2d836a(++_0x23b175);}(_0x8b41,0x7d));var _0x18b4=function(_0x180a80,_0xf10fc9){_0x180a80=_0x180a80-0x0;var _0x47a48b=_0x8b41[_0x180a80];return _0x47a48b;};'use strict';var _=require(_0x18b4('0x0'));var util=require(_0x18b4('0x1'));var moment=require(_0x18b4('0x2'));var BPromise=require(_0x18b4('0x3'));var rs=require(_0x18b4('0x4'));var fs=require('fs');var Redis=require(_0x18b4('0x5'));var db=require(_0x18b4('0x6'))['db'];var utils=require(_0x18b4('0x7'));var logger=require(_0x18b4('0x8'))(_0x18b4('0x9'));var config=require('../../config/environment');var jayson=require(_0x18b4('0xa'));var client=jayson[_0x18b4('0xb')][_0x18b4('0xc')]({'port':0x232a});config[_0x18b4('0xd')]=_[_0x18b4('0xe')](config[_0x18b4('0xd')],{'host':_0x18b4('0xf'),'port':0x18eb});var socket=require(_0x18b4('0x10'))(new Redis(config[_0x18b4('0xd')]));require(_0x18b4('0x11'))[_0x18b4('0x12')](socket);function respondWithRpcPromise(_0x57c0af,_0x31eac0,_0x194eb6){return new BPromise(function(_0x437db7,_0x49d5e0){return client[_0x18b4('0x13')](_0x57c0af,_0x194eb6)[_0x18b4('0x14')](function(_0x46b612){logger[_0x18b4('0x15')](_0x18b4('0x16'),_0x31eac0,_0x18b4('0x17'));logger[_0x18b4('0x18')](_0x18b4('0x19'),_0x31eac0,_0x18b4('0x17'),JSON[_0x18b4('0x1a')](_0x46b612));if(_0x46b612[_0x18b4('0x1b')]){if(_0x46b612[_0x18b4('0x1b')][_0x18b4('0x1c')]===0x1f4){logger[_0x18b4('0x1b')](_0x18b4('0x16'),_0x31eac0,_0x46b612[_0x18b4('0x1b')][_0x18b4('0x1d')]);return _0x49d5e0(_0x46b612[_0x18b4('0x1b')]['message']);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x31eac0,_0x46b612[_0x18b4('0x1b')]['message']);return _0x437db7(_0x46b612[_0x18b4('0x1b')][_0x18b4('0x1d')]);}else{logger[_0x18b4('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x31eac0,_0x18b4('0x17'));_0x437db7(_0x46b612[_0x18b4('0x1e')][_0x18b4('0x1d')]);}})[_0x18b4('0x1f')](function(_0x1e9619){logger[_0x18b4('0x1b')](_0x18b4('0x16'),_0x31eac0,_0x1e9619);_0x49d5e0(_0x1e9619);});});}exports[_0x18b4('0x20')]=function(_0x100c6b){var _0x530a8b=this;return new Promise(function(_0x47bbd7,_0x16e64e){return db[_0x18b4('0x21')]['findAll']({'raw':_0x100c6b['options']?_0x100c6b[_0x18b4('0x22')][_0x18b4('0x23')]===undefined?!![]:![]:!![],'where':_0x100c6b['options']?_0x100c6b['options'][_0x18b4('0x24')]||null:null,'attributes':_0x100c6b[_0x18b4('0x22')]?_0x100c6b[_0x18b4('0x22')]['attributes']||null:null,'limit':_0x100c6b['options']?_0x100c6b[_0x18b4('0x22')][_0x18b4('0x25')]||null:null,'include':_0x100c6b[_0x18b4('0x22')]?_0x100c6b[_0x18b4('0x22')][_0x18b4('0x26')]?_[_0x18b4('0x27')](_0x100c6b[_0x18b4('0x22')][_0x18b4('0x26')],function(_0x4ff512){return{'model':db[_0x4ff512[_0x18b4('0x28')]],'as':_0x4ff512['as'],'attributes':_0x4ff512[_0x18b4('0x29')],'include':_0x4ff512[_0x18b4('0x26')]?_[_0x18b4('0x27')](_0x4ff512[_0x18b4('0x26')],function(_0x5b4f0a){return{'model':db[_0x5b4f0a[_0x18b4('0x28')]],'as':_0x5b4f0a['as'],'attributes':_0x5b4f0a['attributes'],'include':_0x5b4f0a[_0x18b4('0x26')]?_['map'](_0x5b4f0a['include'],function(_0x2934f9){return{'model':db[_0x2934f9[_0x18b4('0x28')]],'as':_0x2934f9['as'],'attributes':_0x2934f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x18b4('0x14')](function(_0x3e5abf){logger[_0x18b4('0x15')](_0x18b4('0x20'),_0x100c6b);logger[_0x18b4('0x18')]('GetWhatsappQueue',_0x100c6b,JSON['stringify'](_0x3e5abf));_0x47bbd7(_0x3e5abf);})[_0x18b4('0x1f')](function(_0x122534){logger['error'](_0x18b4('0x20'),_0x122534[_0x18b4('0x1d')],_0x100c6b);_0x16e64e(_0x530a8b[_0x18b4('0x1b')](0x1f4,_0x122534[_0x18b4('0x1d')]));});});};exports[_0x18b4('0x2a')]=function(_0x446096){var _0x28fb7d=this;return new Promise(function(_0x38a99c,_0x5e69b3){return db[_0x18b4('0x21')][_0x18b4('0x2b')]({'raw':_0x446096['options']?_0x446096['options'][_0x18b4('0x23')]===undefined?!![]:![]:!![],'where':_0x446096[_0x18b4('0x22')]?_0x446096[_0x18b4('0x22')][_0x18b4('0x24')]||null:null,'attributes':_0x446096[_0x18b4('0x22')]?_0x446096[_0x18b4('0x22')][_0x18b4('0x29')]||null:null,'include':_0x446096['options']?_0x446096[_0x18b4('0x22')][_0x18b4('0x26')]?_[_0x18b4('0x27')](_0x446096[_0x18b4('0x22')][_0x18b4('0x26')],function(_0x5cb2f){return{'model':db[_0x5cb2f[_0x18b4('0x28')]],'as':_0x5cb2f['as'],'attributes':_0x5cb2f[_0x18b4('0x29')],'include':_0x5cb2f[_0x18b4('0x26')]?_[_0x18b4('0x27')](_0x5cb2f['include'],function(_0xae6acd){return{'model':db[_0xae6acd[_0x18b4('0x28')]],'as':_0xae6acd['as'],'attributes':_0xae6acd[_0x18b4('0x29')],'include':_0xae6acd['include']?_[_0x18b4('0x27')](_0xae6acd[_0x18b4('0x26')],function(_0x25526c){return{'model':db[_0x25526c[_0x18b4('0x28')]],'as':_0x25526c['as'],'attributes':_0x25526c[_0x18b4('0x29')]};}):[]};}):[]};}):[]:[]})[_0x18b4('0x14')](function(_0x29b9c7){logger['info'](_0x18b4('0x2a'),_0x446096);logger['debug'](_0x18b4('0x2a'),_0x446096,JSON['stringify'](_0x29b9c7));_0x38a99c(_0x29b9c7);})[_0x18b4('0x1f')](function(_0x22b644){logger[_0x18b4('0x1b')](_0x18b4('0x2a'),_0x22b644['message'],_0x446096);_0x5e69b3(_0x28fb7d['error'](0x1f4,_0x22b644['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c5f054b..d9a739a 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 _0x26ce=['whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x26ce,0x119));var _0xe26c=function(_0x29baac,_0x1d45e2){_0x29baac=_0x29baac-0x0;var _0x5e9631=_0x26ce[_0x29baac];return _0x5e9631;};'use strict';var WhatsappQueueEvents=require(_0xe26c('0x0'));var events=[_0xe26c('0x1'),_0xe26c('0x2'),_0xe26c('0x3')];function createListener(_0x247d3a,_0x2486e8){return function(_0x1957ae){_0x2486e8[_0xe26c('0x4')](_0x247d3a,_0x1957ae);};}function removeListener(_0x318ee3,_0x21190f){return function(){WhatsappQueueEvents[_0xe26c('0x5')](_0x318ee3,_0x21190f);};}exports['register']=function(_0x1e23c4){for(var _0x443583=0x0,_0x494699=events[_0xe26c('0x6')];_0x443583<_0x494699;_0x443583++){var _0xcea66b=events[_0x443583];var _0x4f84a0=createListener(_0xe26c('0x7')+_0xcea66b,_0x1e23c4);WhatsappQueueEvents['on'](_0xcea66b,_0x4f84a0);}}; \ No newline at end of file +var _0x5dbd=['save','update','emit','removeListener','length','whatsappQueue:'];(function(_0x1320e5,_0x24040a){var _0x48c1c1=function(_0x23b201){while(--_0x23b201){_0x1320e5['push'](_0x1320e5['shift']());}};_0x48c1c1(++_0x24040a);}(_0x5dbd,0x8a));var _0xd5db=function(_0x4039ed,_0x2ea228){_0x4039ed=_0x4039ed-0x0;var _0x1c967f=_0x5dbd[_0x4039ed];return _0x1c967f;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xd5db('0x0'),'remove',_0xd5db('0x1')];function createListener(_0x35a779,_0x4a3b8a){return function(_0xfed7dc){_0x4a3b8a[_0xd5db('0x2')](_0x35a779,_0xfed7dc);};}function removeListener(_0x230c69,_0x13028b){return function(){WhatsappQueueEvents[_0xd5db('0x3')](_0x230c69,_0x13028b);};}exports['register']=function(_0x347496){for(var _0x4ab7ec=0x0,_0x2283be=events[_0xd5db('0x4')];_0x4ab7ec<_0x2283be;_0x4ab7ec++){var _0x22bbaa=events[_0x4ab7ec];var _0x222007=createListener(_0xd5db('0x5')+_0x22bbaa,_0x347496);WhatsappQueueEvents['on'](_0x22bbaa,_0x222007);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index eae2b00..b186f7a 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 _0x7638=['show','post','put','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x16a6bf,_0x3fe7f7){var _0x58f9d4=function(_0x33108c){while(--_0x33108c){_0x16a6bf['push'](_0x16a6bf['shift']());}};_0x58f9d4(++_0x3fe7f7);}(_0x7638,0x18f));var _0x8763=function(_0x5f59ff,_0x116aa0){_0x5f59ff=_0x5f59ff-0x0;var _0x5bd895=_0x7638[_0x5f59ff];return _0x5bd895;};'use strict';var multer=require('multer');var util=require(_0x8763('0x0'));var path=require(_0x8763('0x1'));var timeout=require('connect-timeout');var express=require(_0x8763('0x2'));var router=express[_0x8763('0x3')]();var fs_extra=require(_0x8763('0x4'));var auth=require(_0x8763('0x5'));var interaction=require(_0x8763('0x6'));var config=require(_0x8763('0x7'));var controller=require(_0x8763('0x8'));router[_0x8763('0x9')]('/',auth['isAuthenticated'](),controller[_0x8763('0xa')]);router[_0x8763('0x9')](_0x8763('0xb'),auth[_0x8763('0xc')](),controller[_0x8763('0xd')]);router[_0x8763('0x9')](_0x8763('0xe'),auth[_0x8763('0xc')](),controller[_0x8763('0xf')]);router[_0x8763('0x10')]('/',auth[_0x8763('0xc')](),controller['create']);router[_0x8763('0x11')](_0x8763('0xe'),auth[_0x8763('0xc')](),controller['update']);router['delete'](_0x8763('0xe'),auth[_0x8763('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7b82=['./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xb02eed,_0x13d074){var _0x43455b=function(_0x2cdd32){while(--_0x2cdd32){_0xb02eed['push'](_0xb02eed['shift']());}};_0x43455b(++_0x13d074);}(_0x7b82,0x100));var _0x27b8=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x7b82[_0x2aa0e7];return _0x1472c0;};'use strict';var multer=require(_0x27b8('0x0'));var util=require(_0x27b8('0x1'));var path=require(_0x27b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x27b8('0x3'));var router=express[_0x27b8('0x4')]();var fs_extra=require(_0x27b8('0x5'));var auth=require(_0x27b8('0x6'));var interaction=require(_0x27b8('0x7'));var config=require('../../config/environment');var controller=require(_0x27b8('0x8'));router[_0x27b8('0x9')]('/',auth[_0x27b8('0xa')](),controller[_0x27b8('0xb')]);router[_0x27b8('0x9')](_0x27b8('0xc'),auth['isAuthenticated'](),controller[_0x27b8('0xd')]);router[_0x27b8('0x9')](_0x27b8('0xe'),auth['isAuthenticated'](),controller[_0x27b8('0xf')]);router[_0x27b8('0x10')]('/',auth['isAuthenticated'](),controller[_0x27b8('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x27b8('0x12')]);router[_0x27b8('0x13')]('/:id',auth[_0x27b8('0xa')](),controller[_0x27b8('0x14')]);module[_0x27b8('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 6392cec..0c41315 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(_0x27573a,_0x698a85){var _0x56056a=function(_0x435a7b){while(--_0x435a7b){_0x27573a['push'](_0x27573a['shift']());}};_0x56056a(++_0x698a85);}(_0x7a54,0x106));var _0x47a5=function(_0x21a295,_0x23bad1){_0x21a295=_0x21a295-0x0;var _0x34e1f0=_0x7a54[_0x21a295];return _0x34e1f0;};'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(_0x2e46f4,_0x511f32){var _0x48fd76=function(_0x1abaf9){while(--_0x1abaf9){_0x2e46f4['push'](_0x2e46f4['shift']());}};_0x48fd76(++_0x511f32);}(_0x7a54,0x106));var _0x47a5=function(_0x451bef,_0x14b042){_0x451bef=_0x451bef-0x0;var _0x5b4ab5=_0x7a54[_0x451bef];return _0x5b4ab5;};'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 35b261d..bf2c785 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 _0x5eb8=['rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','catch','show','params','keys','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../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','destroy','then','sendStatus','error','stack','name','send','map','WhatsappQueueReport'];(function(_0x497d8c,_0x2904c9){var _0xeafed7=function(_0x3b51e8){while(--_0x3b51e8){_0x497d8c['push'](_0x497d8c['shift']());}};_0xeafed7(++_0x2904c9);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x5eb8[_0x2272b5];return _0x110156;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];function respondWithStatusCode(_0x784583,_0x2f42ba){_0x2f42ba=_0x2f42ba||0xcc;return function(_0x259f72){if(_0x259f72){return _0x784583['sendStatus'](_0x2f42ba);}return _0x784583['status'](_0x2f42ba)[_0x85eb('0x19')]();};}function respondWithResult(_0x5c760a,_0x18ca53){_0x18ca53=_0x18ca53||0xc8;return function(_0x23a82a){if(_0x23a82a){return _0x5c760a[_0x85eb('0x1a')](_0x18ca53)[_0x85eb('0x1b')](_0x23a82a);}};}function respondWithFilteredResult(_0x183b0c,_0x49efdf){return function(_0x2e5c0a){if(_0x2e5c0a){var _0x59237b=typeof _0x49efdf[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x49efdf[_0x85eb('0x1e')]===_0x85eb('0x1d');var _0x5dbeda=_0x2e5c0a['count'];var _0x50d2a8=_0x59237b?0x0:_0x49efdf[_0x85eb('0x1c')];var _0x39ca96=_0x59237b?_0x2e5c0a[_0x85eb('0x1f')]:_0x49efdf[_0x85eb('0x1c')]+_0x49efdf[_0x85eb('0x1e')];var _0x34f875;if(_0x39ca96>=_0x5dbeda){_0x39ca96=_0x5dbeda;_0x34f875=0xc8;}else{_0x34f875=0xce;}_0x183b0c['status'](_0x34f875);return _0x183b0c[_0x85eb('0x20')](_0x85eb('0x21'),_0x50d2a8+'-'+_0x39ca96+'/'+_0x5dbeda)[_0x85eb('0x1b')](_0x2e5c0a);}return null;};}function patchUpdates(_0x4e8041){return function(_0x4b4b38){try{jsonpatch['apply'](_0x4b4b38,_0x4e8041,!![]);}catch(_0x55b9e4){return BPromise[_0x85eb('0x22')](_0x55b9e4);}return _0x4b4b38[_0x85eb('0x23')]();};}function saveUpdates(_0x329fc5,_0x255ca7){return function(_0x465c74){if(_0x465c74){return _0x465c74[_0x85eb('0x24')](_0x329fc5)['then'](function(_0x5491d5){return _0x5491d5;});}return null;};}function removeEntity(_0x5b48d9,_0x298e84){return function(_0x1426c8){if(_0x1426c8){return _0x1426c8[_0x85eb('0x25')]()[_0x85eb('0x26')](function(){_0x5b48d9[_0x85eb('0x1a')](0xcc)[_0x85eb('0x19')]();});}};}function handleEntityNotFound(_0x5dfc96,_0x39d3fe){return function(_0x3453cd){if(!_0x3453cd){_0x5dfc96[_0x85eb('0x27')](0x194);}return _0x3453cd;};}function handleError(_0x30e766,_0x3e2326){_0x3e2326=_0x3e2326||0x1f4;return function(_0x57a03c){logger[_0x85eb('0x28')](_0x57a03c[_0x85eb('0x29')]);if(_0x57a03c[_0x85eb('0x2a')]){delete _0x57a03c[_0x85eb('0x2a')];}_0x30e766[_0x85eb('0x1a')](_0x3e2326)[_0x85eb('0x2b')](_0x57a03c);};}exports['index']=function(_0x562792,_0x37515c){var _0x585f2a={},_0xa9b14f={},_0x5255eb={'count':0x0,'rows':[]};var _0x4229e9=_[_0x85eb('0x2c')](db[_0x85eb('0x2d')][_0x85eb('0x2e')],function(_0xa67e1c){return{'name':_0xa67e1c[_0x85eb('0x2f')],'type':_0xa67e1c[_0x85eb('0x30')]['key']};});_0xa9b14f[_0x85eb('0x31')]=_[_0x85eb('0x2c')](_0x4229e9,'name');_0xa9b14f[_0x85eb('0x32')]=_['keys'](_0x562792['query']);_0xa9b14f[_0x85eb('0x33')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],_0xa9b14f[_0x85eb('0x32')]);_0x585f2a[_0x85eb('0x35')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x562792[_0x85eb('0x32')][_0x85eb('0x36')]));_0x585f2a['attributes']=_0x585f2a[_0x85eb('0x35')][_0x85eb('0x37')]?_0x585f2a['attributes']:_0xa9b14f['model'];if(!_0x562792[_0x85eb('0x32')][_0x85eb('0x38')](_0x85eb('0x39'))){_0x585f2a[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1e')]);_0x585f2a[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1c')]);}_0x585f2a[_0x85eb('0x3a')]=qs[_0x85eb('0x3b')](_0x562792[_0x85eb('0x32')]['sort']);_0x585f2a[_0x85eb('0x3c')]=qs[_0x85eb('0x33')](_['pick'](_0x562792['query'],_0xa9b14f[_0x85eb('0x33')]),_0x4229e9);if(_0x562792[_0x85eb('0x32')]['filter']){_0x585f2a[_0x85eb('0x3c')]=_['merge'](_0x585f2a[_0x85eb('0x3c')],{'$or':_['map'](_0x4229e9,function(_0xaa27ca){if(_0xaa27ca['type']!==_0x85eb('0x3d')){var _0x5c618a={};_0x5c618a[_0xaa27ca[_0x85eb('0x2a')]]={'$like':'%'+_0x562792[_0x85eb('0x32')]['filter']+'%'};return _0x5c618a;}})});}_0x585f2a=_[_0x85eb('0x3e')]({},_0x585f2a,_0x562792['options']);var _0x2a6baa={'where':_0x585f2a[_0x85eb('0x3c')]};return db['WhatsappQueueReport'][_0x85eb('0x1f')](_0x2a6baa)['then'](function(_0x5495cf){_0x5255eb[_0x85eb('0x1f')]=_0x5495cf;if(_0x562792['query'][_0x85eb('0x3f')]){_0x585f2a[_0x85eb('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x585f2a);})[_0x85eb('0x26')](function(_0x422ec3){_0x5255eb['rows']=_0x422ec3;return _0x5255eb;})['then'](respondWithFilteredResult(_0x37515c,_0x585f2a))[_0x85eb('0x41')](handleError(_0x37515c,null));};exports[_0x85eb('0x42')]=function(_0x2211f9,_0x202681){var _0x3be961={'raw':!![],'where':{'id':_0x2211f9[_0x85eb('0x43')]['id']}},_0x5b7411={};_0x5b7411[_0x85eb('0x31')]=_[_0x85eb('0x44')](db[_0x85eb('0x2d')][_0x85eb('0x2e')]);_0x5b7411[_0x85eb('0x32')]=_[_0x85eb('0x44')](_0x2211f9[_0x85eb('0x32')]);_0x5b7411[_0x85eb('0x33')]=_['intersection'](_0x5b7411[_0x85eb('0x31')],_0x5b7411[_0x85eb('0x32')]);_0x3be961['attributes']=_[_0x85eb('0x34')](_0x5b7411[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x2211f9[_0x85eb('0x32')][_0x85eb('0x36')]));_0x3be961[_0x85eb('0x35')]=_0x3be961['attributes'][_0x85eb('0x37')]?_0x3be961[_0x85eb('0x35')]:_0x5b7411[_0x85eb('0x31')];if(_0x2211f9[_0x85eb('0x32')][_0x85eb('0x3f')]){_0x3be961[_0x85eb('0x40')]=[{'all':!![]}];}_0x3be961=_[_0x85eb('0x3e')]({},_0x3be961,_0x2211f9[_0x85eb('0x45')]);return db['WhatsappQueueReport'][_0x85eb('0x46')](_0x3be961)[_0x85eb('0x26')](handleEntityNotFound(_0x202681,null))[_0x85eb('0x26')](respondWithResult(_0x202681,null))[_0x85eb('0x41')](handleError(_0x202681,null));};exports[_0x85eb('0x47')]=function(_0x1a19c2,_0x3c387a){return db[_0x85eb('0x2d')][_0x85eb('0x47')](_0x1a19c2[_0x85eb('0x48')],{})[_0x85eb('0x26')](respondWithResult(_0x3c387a,0xc9))[_0x85eb('0x41')](handleError(_0x3c387a,null));};exports['update']=function(_0x11da79,_0x2c951b){if(_0x11da79[_0x85eb('0x48')]['id']){delete _0x11da79['body']['id'];}return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x11da79[_0x85eb('0x43')]['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x2c951b,null))[_0x85eb('0x26')](saveUpdates(_0x11da79['body'],null))[_0x85eb('0x26')](respondWithResult(_0x2c951b,null))[_0x85eb('0x41')](handleError(_0x2c951b,null));};exports[_0x85eb('0x25')]=function(_0x50e264,_0xc5cb43){return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x50e264['params']['id']}})['then'](handleEntityNotFound(_0xc5cb43,null))[_0x85eb('0x26')](removeEntity(_0xc5cb43,null))['catch'](handleError(_0xc5cb43,null));};exports['describe']=function(_0x3f0b0c,_0x593723){return db[_0x85eb('0x2d')][_0x85eb('0x49')]()['then'](respondWithResult(_0x593723,null))['catch'](handleError(_0x593723,null));}; \ No newline at end of file +var _0x087b=['name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','merge','find','create','body','update','params','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','error','stack'];(function(_0x2c9bd0,_0x230d57){var _0x1e0b7c=function(_0x592a21){while(--_0x592a21){_0x2c9bd0['push'](_0x2c9bd0['shift']());}};_0x1e0b7c(++_0x230d57);}(_0x087b,0x11a));var _0xb087=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x087b[_0x4e9d3c];return _0x2d0825;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];function respondWithStatusCode(_0x31f977,_0x323656){_0x323656=_0x323656||0xcc;return function(_0x51ceaa){if(_0x51ceaa){return _0x31f977[_0xb087('0x1b')](_0x323656);}return _0x31f977[_0xb087('0x1c')](_0x323656)[_0xb087('0x1d')]();};}function respondWithResult(_0x46410b,_0x11784c){_0x11784c=_0x11784c||0xc8;return function(_0x12d0db){if(_0x12d0db){return _0x46410b[_0xb087('0x1c')](_0x11784c)[_0xb087('0x1e')](_0x12d0db);}};}function respondWithFilteredResult(_0x24e1a3,_0x16d0b7){return function(_0x5193a4){if(_0x5193a4){var _0x43e576=typeof _0x16d0b7[_0xb087('0x1f')]==='undefined'&&typeof _0x16d0b7[_0xb087('0x20')]===_0xb087('0x21');var _0x2e9e74=_0x5193a4['count'];var _0x330005=_0x43e576?0x0:_0x16d0b7[_0xb087('0x1f')];var _0x17200d=_0x43e576?_0x5193a4[_0xb087('0x22')]:_0x16d0b7['offset']+_0x16d0b7[_0xb087('0x20')];var _0x28428e;if(_0x17200d>=_0x2e9e74){_0x17200d=_0x2e9e74;_0x28428e=0xc8;}else{_0x28428e=0xce;}_0x24e1a3[_0xb087('0x1c')](_0x28428e);return _0x24e1a3[_0xb087('0x23')]('Content-Range',_0x330005+'-'+_0x17200d+'/'+_0x2e9e74)['json'](_0x5193a4);}return null;};}function patchUpdates(_0x5ea3dc){return function(_0x49450a){try{jsonpatch[_0xb087('0x24')](_0x49450a,_0x5ea3dc,!![]);}catch(_0x17be8e){return BPromise[_0xb087('0x25')](_0x17be8e);}return _0x49450a[_0xb087('0x26')]();};}function saveUpdates(_0x1fb765,_0x258b4c){return function(_0x31ae01){if(_0x31ae01){return _0x31ae01['update'](_0x1fb765)[_0xb087('0x27')](function(_0x466397){return _0x466397;});}return null;};}function removeEntity(_0x1de654,_0x1cfb3e){return function(_0x3ad74e){if(_0x3ad74e){return _0x3ad74e['destroy']()[_0xb087('0x27')](function(){_0x1de654[_0xb087('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2dc6,_0x50745a){return function(_0x598b99){if(!_0x598b99){_0x5a2dc6['sendStatus'](0x194);}return _0x598b99;};}function handleError(_0x304840,_0x45685d){_0x45685d=_0x45685d||0x1f4;return function(_0x1d124f){logger[_0xb087('0x28')](_0x1d124f[_0xb087('0x29')]);if(_0x1d124f[_0xb087('0x2a')]){delete _0x1d124f[_0xb087('0x2a')];}_0x304840[_0xb087('0x1c')](_0x45685d)[_0xb087('0x2b')](_0x1d124f);};}exports[_0xb087('0x2c')]=function(_0x18058c,_0x31e3e6){var _0xb0baf6={},_0x263259={},_0x593b78={'count':0x0,'rows':[]};var _0x37393a=_[_0xb087('0x2d')](db[_0xb087('0x2e')][_0xb087('0x2f')],function(_0x22d441){return{'name':_0x22d441[_0xb087('0x30')],'type':_0x22d441[_0xb087('0x31')][_0xb087('0x32')]};});_0x263259['model']=_['map'](_0x37393a,_0xb087('0x2a'));_0x263259[_0xb087('0x33')]=_['keys'](_0x18058c[_0xb087('0x33')]);_0x263259[_0xb087('0x34')]=_[_0xb087('0x35')](_0x263259[_0xb087('0x36')],_0x263259[_0xb087('0x33')]);_0xb0baf6[_0xb087('0x37')]=_[_0xb087('0x35')](_0x263259[_0xb087('0x36')],qs[_0xb087('0x38')](_0x18058c[_0xb087('0x33')][_0xb087('0x38')]));_0xb0baf6[_0xb087('0x37')]=_0xb0baf6['attributes'][_0xb087('0x39')]?_0xb0baf6['attributes']:_0x263259[_0xb087('0x36')];if(!_0x18058c[_0xb087('0x33')][_0xb087('0x3a')](_0xb087('0x3b'))){_0xb0baf6[_0xb087('0x20')]=qs[_0xb087('0x20')](_0x18058c[_0xb087('0x33')][_0xb087('0x20')]);_0xb0baf6[_0xb087('0x1f')]=qs['offset'](_0x18058c['query'][_0xb087('0x1f')]);}_0xb0baf6[_0xb087('0x3c')]=qs[_0xb087('0x3d')](_0x18058c[_0xb087('0x33')][_0xb087('0x3d')]);_0xb0baf6['where']=qs[_0xb087('0x34')](_[_0xb087('0x3e')](_0x18058c['query'],_0x263259['filters']),_0x37393a);if(_0x18058c[_0xb087('0x33')][_0xb087('0x3f')]){_0xb0baf6[_0xb087('0x40')]=_['merge'](_0xb0baf6[_0xb087('0x40')],{'$or':_[_0xb087('0x2d')](_0x37393a,function(_0x1caa6e){if(_0x1caa6e[_0xb087('0x31')]!==_0xb087('0x41')){var _0x5db6b9={};_0x5db6b9[_0x1caa6e[_0xb087('0x2a')]]={'$like':'%'+_0x18058c['query'][_0xb087('0x3f')]+'%'};return _0x5db6b9;}})});}_0xb0baf6=_['merge']({},_0xb0baf6,_0x18058c[_0xb087('0x42')]);var _0xc9f9e9={'where':_0xb0baf6['where']};return db[_0xb087('0x2e')]['count'](_0xc9f9e9)[_0xb087('0x27')](function(_0x4a360c){_0x593b78[_0xb087('0x22')]=_0x4a360c;if(_0x18058c[_0xb087('0x33')][_0xb087('0x43')]){_0xb0baf6[_0xb087('0x44')]=[{'all':!![]}];}return db[_0xb087('0x2e')][_0xb087('0x45')](_0xb0baf6);})[_0xb087('0x27')](function(_0x5e7690){_0x593b78[_0xb087('0x46')]=_0x5e7690;return _0x593b78;})['then'](respondWithFilteredResult(_0x31e3e6,_0xb0baf6))[_0xb087('0x47')](handleError(_0x31e3e6,null));};exports[_0xb087('0x48')]=function(_0x5b6924,_0xb662bf){var _0x45dc6f={'raw':!![],'where':{'id':_0x5b6924['params']['id']}},_0x7650c5={};_0x7650c5[_0xb087('0x36')]=_['keys'](db[_0xb087('0x2e')][_0xb087('0x2f')]);_0x7650c5['query']=_[_0xb087('0x49')](_0x5b6924[_0xb087('0x33')]);_0x7650c5['filters']=_[_0xb087('0x35')](_0x7650c5[_0xb087('0x36')],_0x7650c5['query']);_0x45dc6f[_0xb087('0x37')]=_[_0xb087('0x35')](_0x7650c5[_0xb087('0x36')],qs[_0xb087('0x38')](_0x5b6924['query']['fields']));_0x45dc6f[_0xb087('0x37')]=_0x45dc6f[_0xb087('0x37')][_0xb087('0x39')]?_0x45dc6f[_0xb087('0x37')]:_0x7650c5[_0xb087('0x36')];if(_0x5b6924[_0xb087('0x33')]['includeAll']){_0x45dc6f['include']=[{'all':!![]}];}_0x45dc6f=_[_0xb087('0x4a')]({},_0x45dc6f,_0x5b6924['options']);return db[_0xb087('0x2e')][_0xb087('0x4b')](_0x45dc6f)[_0xb087('0x27')](handleEntityNotFound(_0xb662bf,null))[_0xb087('0x27')](respondWithResult(_0xb662bf,null))['catch'](handleError(_0xb662bf,null));};exports[_0xb087('0x4c')]=function(_0x562751,_0x2fe8a0){return db[_0xb087('0x2e')][_0xb087('0x4c')](_0x562751[_0xb087('0x4d')],{})[_0xb087('0x27')](respondWithResult(_0x2fe8a0,0xc9))['catch'](handleError(_0x2fe8a0,null));};exports[_0xb087('0x4e')]=function(_0xb15e28,_0x588d96){if(_0xb15e28['body']['id']){delete _0xb15e28[_0xb087('0x4d')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0xb15e28[_0xb087('0x4f')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x588d96,null))['then'](saveUpdates(_0xb15e28[_0xb087('0x4d')],null))[_0xb087('0x27')](respondWithResult(_0x588d96,null))[_0xb087('0x47')](handleError(_0x588d96,null));};exports['destroy']=function(_0x5ba160,_0x30cc83){return db['WhatsappQueueReport']['find']({'where':{'id':_0x5ba160[_0xb087('0x4f')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x30cc83,null))[_0xb087('0x27')](removeEntity(_0x30cc83,null))[_0xb087('0x47')](handleError(_0x30cc83,null));};exports[_0xb087('0x50')]=function(_0x148642,_0xbd849d){return db[_0xb087('0x2e')][_0xb087('0x50')]()[_0xb087('0x27')](respondWithResult(_0xbd849d,null))[_0xb087('0x47')](handleError(_0xbd849d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 20bb477..e7d47c4 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 _0x69dc=['uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x1dc539,_0x3658b8){var _0x1b7ffd=function(_0x2b3f3d){while(--_0x2b3f3d){_0x1dc539['push'](_0x1dc539['shift']());}};_0x1b7ffd(++_0x3658b8);}(_0x69dc,0xc1));var _0xc69d=function(_0xa4a4f9,_0x42a300){_0xa4a4f9=_0xa4a4f9-0x0;var _0x55de5e=_0x69dc[_0xa4a4f9];return _0x55de5e;};'use strict';var _=require(_0xc69d('0x0'));var util=require('util');var logger=require(_0xc69d('0x1'))(_0xc69d('0x2'));var moment=require('moment');var BPromise=require(_0xc69d('0x3'));var rp=require(_0xc69d('0x4'));var fs=require('fs');var path=require(_0xc69d('0x5'));var rimraf=require(_0xc69d('0x6'));var config=require(_0xc69d('0x7'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x48e34d,_0x35886c){return _0x48e34d[_0xc69d('0x8')](_0xc69d('0x9'),attributes,{'tableName':_0xc69d('0xa'),'paranoid':![],'indexes':[{'name':_0xc69d('0xb'),'fields':[_0xc69d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe49b=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util'];(function(_0x1aca6d,_0x106fde){var _0x203edc=function(_0xcd6e4c){while(--_0xcd6e4c){_0x1aca6d['push'](_0x1aca6d['shift']());}};_0x203edc(++_0x106fde);}(_0xe49b,0x110));var _0xbe49=function(_0x47b79c,_0x3616d8){_0x47b79c=_0x47b79c-0x0;var _0xbf6629=_0xe49b[_0x47b79c];return _0xbf6629;};'use strict';var _=require('lodash');var util=require(_0xbe49('0x0'));var logger=require(_0xbe49('0x1'))(_0xbe49('0x2'));var moment=require(_0xbe49('0x3'));var BPromise=require(_0xbe49('0x4'));var rp=require(_0xbe49('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbe49('0x6'));var attributes=require(_0xbe49('0x7'));module[_0xbe49('0x8')]=function(_0x16282e,_0x322232){return _0x16282e[_0xbe49('0x9')](_0xbe49('0xa'),attributes,{'tableName':_0xbe49('0xb'),'paranoid':![],'indexes':[{'name':_0xbe49('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 24df9b8..75c6cde 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 _0x13a9=['WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','stringify','UpdateWhatsappQueueReport','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3b81eb,_0x175f32){var _0x149491=function(_0x454753){while(--_0x454753){_0x3b81eb['push'](_0x3b81eb['shift']());}};_0x149491(++_0x175f32);}(_0x13a9,0xac));var _0x913a=function(_0xe49c42,_0x6674aa){_0xe49c42=_0xe49c42-0x0;var _0x1e7ec6=_0x13a9[_0xe49c42];return _0x1e7ec6;};'use strict';var _=require('lodash');var util=require(_0x913a('0x0'));var moment=require('moment');var BPromise=require(_0x913a('0x1'));var rs=require(_0x913a('0x2'));var fs=require('fs');var Redis=require(_0x913a('0x3'));var db=require(_0x913a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x913a('0x5'));var config=require(_0x913a('0x6'));var jayson=require(_0x913a('0x7'));var client=jayson[_0x913a('0x8')][_0x913a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17c56f,_0x4cd462,_0x4197b){return new BPromise(function(_0xcb0ca2,_0x3a1051){return client[_0x913a('0xa')](_0x17c56f,_0x4197b)['then'](function(_0x2b7741){logger['info'](_0x913a('0xb'),_0x4cd462,_0x913a('0xc'));logger[_0x913a('0xd')](_0x913a('0xe'),_0x4cd462,_0x913a('0xc'),JSON['stringify'](_0x2b7741));if(_0x2b7741[_0x913a('0xf')]){if(_0x2b7741[_0x913a('0xf')]['code']===0x1f4){logger[_0x913a('0xf')](_0x913a('0xb'),_0x4cd462,_0x2b7741[_0x913a('0xf')][_0x913a('0x10')]);return _0x3a1051(_0x2b7741['error'][_0x913a('0x10')]);}logger[_0x913a('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4cd462,_0x2b7741[_0x913a('0xf')]['message']);return _0xcb0ca2(_0x2b7741['error'][_0x913a('0x10')]);}else{logger[_0x913a('0x11')](_0x913a('0xb'),_0x4cd462,_0x913a('0xc'));_0xcb0ca2(_0x2b7741['result'][_0x913a('0x10')]);}})[_0x913a('0x12')](function(_0x357891){logger[_0x913a('0xf')](_0x913a('0xb'),_0x4cd462,_0x357891);_0x3a1051(_0x357891);});});}exports[_0x913a('0x13')]=function(_0x44ce5d){var _0x2a1185=this;return new Promise(function(_0x1a49bf,_0x5798cb){return db[_0x913a('0x14')][_0x913a('0x15')](_0x44ce5d[_0x913a('0x16')],{'raw':_0x44ce5d[_0x913a('0x17')]?_0x44ce5d[_0x913a('0x17')][_0x913a('0x18')]===undefined?!![]:![]:!![]})[_0x913a('0x19')](function(_0x189f7e){logger[_0x913a('0x11')](_0x913a('0x13'),_0x44ce5d);logger['debug'](_0x913a('0x13'),_0x44ce5d,JSON[_0x913a('0x1a')](_0x189f7e));_0x1a49bf(_0x189f7e);})[_0x913a('0x12')](function(_0x5363cb){logger[_0x913a('0xf')](_0x913a('0x13'),_0x5363cb[_0x913a('0x10')],_0x44ce5d);_0x5798cb(_0x2a1185[_0x913a('0xf')](0x1f4,_0x5363cb[_0x913a('0x10')]));});});};exports[_0x913a('0x1b')]=function(_0x4b5bc6){var _0x562cd7=this;return new Promise(function(_0x112161,_0x5dd6f9){return db[_0x913a('0x14')]['update'](_0x4b5bc6[_0x913a('0x16')],{'raw':_0x4b5bc6[_0x913a('0x17')]?_0x4b5bc6[_0x913a('0x17')][_0x913a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b5bc6[_0x913a('0x17')]?_0x4b5bc6[_0x913a('0x17')][_0x913a('0x1c')]||null:null,'attributes':_0x4b5bc6[_0x913a('0x17')]?_0x4b5bc6['options'][_0x913a('0x1d')]||null:null,'limit':_0x4b5bc6[_0x913a('0x17')]?_0x4b5bc6[_0x913a('0x17')][_0x913a('0x1e')]||null:null})[_0x913a('0x19')](function(_0x5c40d6){logger[_0x913a('0x11')]('UpdateWhatsappQueueReport',_0x4b5bc6);logger['debug'](_0x913a('0x1b'),_0x4b5bc6,JSON[_0x913a('0x1a')](_0x5c40d6));_0x112161(_0x5c40d6);})[_0x913a('0x12')](function(_0x15366c){logger[_0x913a('0xf')]('UpdateWhatsappQueueReport',_0x15366c['message'],_0x4b5bc6);_0x5dd6f9(_0x562cd7[_0x913a('0xf')](0x1f4,_0x15366c[_0x913a('0x10')]));});});}; \ No newline at end of file +var _0x1dce=['update','where','attributes','limit','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateWhatsappQueueReport','body','options','raw','then','debug','stringify','UpdateWhatsappQueueReport'];(function(_0x2ddd77,_0x498d09){var _0x3ccc36=function(_0x30190e){while(--_0x30190e){_0x2ddd77['push'](_0x2ddd77['shift']());}};_0x3ccc36(++_0x498d09);}(_0x1dce,0x1a9));var _0xe1dc=function(_0x5f1c73,_0x4f9432){_0x5f1c73=_0x5f1c73-0x0;var _0x3c1fa4=_0x1dce[_0x5f1c73];return _0x3c1fa4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe1dc('0x0'));var BPromise=require(_0xe1dc('0x1'));var rs=require(_0xe1dc('0x2'));var fs=require('fs');var Redis=require(_0xe1dc('0x3'));var db=require(_0xe1dc('0x4'))['db'];var utils=require(_0xe1dc('0x5'));var logger=require('../../config/logger')(_0xe1dc('0x6'));var config=require(_0xe1dc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe1dc('0x8')][_0xe1dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45058c,_0x83f751,_0x38ffb7){return new BPromise(function(_0xf01369,_0x553ff6){return client['request'](_0x45058c,_0x38ffb7)['then'](function(_0x420ffc){logger[_0xe1dc('0xa')](_0xe1dc('0xb'),_0x83f751,'request\x20sent');logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x83f751,_0xe1dc('0xc'),JSON['stringify'](_0x420ffc));if(_0x420ffc['error']){if(_0x420ffc[_0xe1dc('0xd')][_0xe1dc('0xe')]===0x1f4){logger[_0xe1dc('0xd')](_0xe1dc('0xb'),_0x83f751,_0x420ffc[_0xe1dc('0xd')]['message']);return _0x553ff6(_0x420ffc['error'][_0xe1dc('0xf')]);}logger[_0xe1dc('0xd')](_0xe1dc('0xb'),_0x83f751,_0x420ffc[_0xe1dc('0xd')][_0xe1dc('0xf')]);return _0xf01369(_0x420ffc[_0xe1dc('0xd')]['message']);}else{logger[_0xe1dc('0xa')](_0xe1dc('0xb'),_0x83f751,_0xe1dc('0xc'));_0xf01369(_0x420ffc[_0xe1dc('0x10')][_0xe1dc('0xf')]);}})['catch'](function(_0x343f03){logger['error'](_0xe1dc('0xb'),_0x83f751,_0x343f03);_0x553ff6(_0x343f03);});});}exports[_0xe1dc('0x11')]=function(_0x457018){var _0x31ff2c=this;return new Promise(function(_0x2b278a,_0x5d6946){return db['WhatsappQueueReport']['create'](_0x457018[_0xe1dc('0x12')],{'raw':_0x457018[_0xe1dc('0x13')]?_0x457018[_0xe1dc('0x13')][_0xe1dc('0x14')]===undefined?!![]:![]:!![]})[_0xe1dc('0x15')](function(_0x55dc94){logger[_0xe1dc('0xa')](_0xe1dc('0x11'),_0x457018);logger[_0xe1dc('0x16')](_0xe1dc('0x11'),_0x457018,JSON[_0xe1dc('0x17')](_0x55dc94));_0x2b278a(_0x55dc94);})['catch'](function(_0x5bf4f0){logger[_0xe1dc('0xd')](_0xe1dc('0x11'),_0x5bf4f0[_0xe1dc('0xf')],_0x457018);_0x5d6946(_0x31ff2c[_0xe1dc('0xd')](0x1f4,_0x5bf4f0[_0xe1dc('0xf')]));});});};exports[_0xe1dc('0x18')]=function(_0x5a6cb0){var _0x1652ce=this;return new Promise(function(_0x2f795e,_0x5eab84){return db['WhatsappQueueReport'][_0xe1dc('0x19')](_0x5a6cb0['body'],{'raw':_0x5a6cb0[_0xe1dc('0x13')]?_0x5a6cb0[_0xe1dc('0x13')][_0xe1dc('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a6cb0[_0xe1dc('0x13')]?_0x5a6cb0[_0xe1dc('0x13')][_0xe1dc('0x1a')]||null:null,'attributes':_0x5a6cb0[_0xe1dc('0x13')]?_0x5a6cb0[_0xe1dc('0x13')][_0xe1dc('0x1b')]||null:null,'limit':_0x5a6cb0[_0xe1dc('0x13')]?_0x5a6cb0[_0xe1dc('0x13')][_0xe1dc('0x1c')]||null:null})[_0xe1dc('0x15')](function(_0x369159){logger['info'](_0xe1dc('0x18'),_0x5a6cb0);logger[_0xe1dc('0x16')](_0xe1dc('0x18'),_0x5a6cb0,JSON[_0xe1dc('0x17')](_0x369159));_0x2f795e(_0x369159);})[_0xe1dc('0x1d')](function(_0x3472a7){logger[_0xe1dc('0xd')](_0xe1dc('0x18'),_0x3472a7[_0xe1dc('0xf')],_0x5a6cb0);_0x5eab84(_0x1652ce[_0xe1dc('0xd')](0x1f4,_0x3472a7[_0xe1dc('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index f1ba05d..df701e9 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 _0xeb30=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete'];(function(_0x4509cc,_0x420590){var _0x4ff1bd=function(_0x5a6b96){while(--_0x5a6b96){_0x4509cc['push'](_0x4509cc['shift']());}};_0x4ff1bd(++_0x420590);}(_0xeb30,0x152));var _0x0eb3=function(_0x409e30,_0x46da60){_0x409e30=_0x409e30-0x0;var _0x92875c=_0xeb30[_0x409e30];return _0x92875c;};'use strict';var multer=require(_0x0eb3('0x0'));var util=require(_0x0eb3('0x1'));var path=require(_0x0eb3('0x2'));var timeout=require(_0x0eb3('0x3'));var express=require(_0x0eb3('0x4'));var router=express[_0x0eb3('0x5')]();var fs_extra=require(_0x0eb3('0x6'));var auth=require(_0x0eb3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0eb3('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x0eb3('0x9')]('/',auth[_0x0eb3('0xa')](),controller[_0x0eb3('0xb')]);router[_0x0eb3('0x9')](_0x0eb3('0xc'),auth[_0x0eb3('0xa')](),controller['describe']);router['get'](_0x0eb3('0xd'),auth[_0x0eb3('0xa')](),controller['show']);router[_0x0eb3('0xe')]('/',auth[_0x0eb3('0xa')](),controller[_0x0eb3('0xf')]);router[_0x0eb3('0x10')](_0x0eb3('0xd'),auth['isAuthenticated'](),controller[_0x0eb3('0x11')]);router[_0x0eb3('0x12')](_0x0eb3('0xd'),auth['isAuthenticated'](),controller[_0x0eb3('0x13')]);module[_0x0eb3('0x14')]=router; \ No newline at end of file +var _0x09fb=['post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get','/describe','describe','/:id'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x09fb,0x1a8));var _0xb09f=function(_0x1c1d27,_0x125dc1){_0x1c1d27=_0x1c1d27-0x0;var _0x4c3a84=_0x09fb[_0x1c1d27];return _0x4c3a84;};'use strict';var multer=require('multer');var util=require(_0xb09f('0x0'));var path=require(_0xb09f('0x1'));var timeout=require(_0xb09f('0x2'));var express=require('express');var router=express[_0xb09f('0x3')]();var fs_extra=require(_0xb09f('0x4'));var auth=require(_0xb09f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb09f('0x6'));var controller=require(_0xb09f('0x7'));router['get']('/',auth[_0xb09f('0x8')](),controller['index']);router[_0xb09f('0x9')](_0xb09f('0xa'),auth[_0xb09f('0x8')](),controller[_0xb09f('0xb')]);router[_0xb09f('0x9')](_0xb09f('0xc'),auth[_0xb09f('0x8')](),controller['show']);router[_0xb09f('0xd')]('/',auth[_0xb09f('0x8')](),controller[_0xb09f('0xe')]);router[_0xb09f('0xf')]('/:id',auth[_0xb09f('0x8')](),controller[_0xb09f('0x10')]);router['delete']('/:id',auth[_0xb09f('0x8')](),controller[_0xb09f('0x11')]);module[_0xb09f('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 829b9f3..82ad746 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 _0xdf94=['ENUM','account','agent','queue','DATE','exports','STRING'];(function(_0x5bda89,_0x283da4){var _0x43f2a1=function(_0x23cd52){while(--_0x23cd52){_0x5bda89['push'](_0x5bda89['shift']());}};_0x43f2a1(++_0x283da4);}(_0xdf94,0xad));var _0x4df9=function(_0x126ba0,_0x23fd00){_0x126ba0=_0x126ba0-0x0;var _0x2a9e5e=_0xdf94[_0x126ba0];return _0x2a9e5e;};'use strict';var Sequelize=require('sequelize');module[_0x4df9('0x0')]={'uniqueid':{'type':Sequelize[_0x4df9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4df9('0x2')](_0x4df9('0x3'),_0x4df9('0x4'),_0x4df9('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4df9('0x6')]}}; \ No newline at end of file +var _0x0570=['exports','STRING','ENUM','agent','DATE'];(function(_0x579e00,_0x19ac52){var _0x414989=function(_0x17c83a){while(--_0x17c83a){_0x579e00['push'](_0x579e00['shift']());}};_0x414989(++_0x19ac52);}(_0x0570,0x172));var _0x0057=function(_0x1d8b47,_0x58fe60){_0x1d8b47=_0x1d8b47-0x0;var _0x2d4c5b=_0x0570[_0x1d8b47];return _0x2d4c5b;};'use strict';var Sequelize=require('sequelize');module[_0x0057('0x0')]={'uniqueid':{'type':Sequelize[_0x0057('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0057('0x2')]('account',_0x0057('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0057('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 7063f1b..0d8e7a5 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 _0xb2f3=['update','destroy','then','name','send','map','WhatsappTransferReport','fieldName','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save'];(function(_0x1d53c8,_0x935f19){var _0x49e5de=function(_0x488fb2){while(--_0x488fb2){_0x1d53c8['push'](_0x1d53c8['shift']());}};_0x49e5de(++_0x935f19);}(_0xb2f3,0xfd));var _0x3b2f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb2f3[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0x3b2f('0x0'));var rimraf=require(_0x3b2f('0x1'));var zipdir=require(_0x3b2f('0x2'));var jsonpatch=require(_0x3b2f('0x3'));var rp=require(_0x3b2f('0x4'));var moment=require(_0x3b2f('0x5'));var BPromise=require(_0x3b2f('0x6'));var Mustache=require('mustache');var util=require(_0x3b2f('0x7'));var path=require(_0x3b2f('0x8'));var sox=require(_0x3b2f('0x9'));var csv=require(_0x3b2f('0xa'));var ejs=require(_0x3b2f('0xb'));var fs=require('fs');var fs_extra=require(_0x3b2f('0xc'));var _=require(_0x3b2f('0xd'));var squel=require('squel');var crypto=require(_0x3b2f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3b2f('0xf'));var toCsv=require(_0x3b2f('0xa'));var querystring=require(_0x3b2f('0x10'));var Papa=require(_0x3b2f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3b2f('0x12'));var as=require(_0x3b2f('0x13'));var hardwareService=require(_0x3b2f('0x14'));var logger=require(_0x3b2f('0x15'))(_0x3b2f('0x16'));var utils=require(_0x3b2f('0x17'));var config=require(_0x3b2f('0x18'));var licenseUtil=require(_0x3b2f('0x19'));var db=require(_0x3b2f('0x1a'))['db'];function respondWithStatusCode(_0x322dda,_0x458f93){_0x458f93=_0x458f93||0xcc;return function(_0x2a9d0e){if(_0x2a9d0e){return _0x322dda[_0x3b2f('0x1b')](_0x458f93);}return _0x322dda[_0x3b2f('0x1c')](_0x458f93)[_0x3b2f('0x1d')]();};}function respondWithResult(_0x4fb033,_0x3f1015){_0x3f1015=_0x3f1015||0xc8;return function(_0x4da3bd){if(_0x4da3bd){return _0x4fb033[_0x3b2f('0x1c')](_0x3f1015)[_0x3b2f('0x1e')](_0x4da3bd);}};}function respondWithFilteredResult(_0x525978,_0x241937){return function(_0x4c028a){if(_0x4c028a){var _0x3c0b3f=typeof _0x241937[_0x3b2f('0x1f')]===_0x3b2f('0x20')&&typeof _0x241937[_0x3b2f('0x21')]==='undefined';var _0x52e91d=_0x4c028a[_0x3b2f('0x22')];var _0x6d8948=_0x3c0b3f?0x0:_0x241937[_0x3b2f('0x1f')];var _0x3040d3=_0x3c0b3f?_0x4c028a[_0x3b2f('0x22')]:_0x241937[_0x3b2f('0x1f')]+_0x241937[_0x3b2f('0x21')];var _0x3d94c0;if(_0x3040d3>=_0x52e91d){_0x3040d3=_0x52e91d;_0x3d94c0=0xc8;}else{_0x3d94c0=0xce;}_0x525978[_0x3b2f('0x1c')](_0x3d94c0);return _0x525978[_0x3b2f('0x23')](_0x3b2f('0x24'),_0x6d8948+'-'+_0x3040d3+'/'+_0x52e91d)[_0x3b2f('0x1e')](_0x4c028a);}return null;};}function patchUpdates(_0x1688f4){return function(_0x2deb04){try{jsonpatch['apply'](_0x2deb04,_0x1688f4,!![]);}catch(_0x6fdf3f){return BPromise[_0x3b2f('0x25')](_0x6fdf3f);}return _0x2deb04[_0x3b2f('0x26')]();};}function saveUpdates(_0xef73a0,_0x57e96a){return function(_0x1476a0){if(_0x1476a0){return _0x1476a0[_0x3b2f('0x27')](_0xef73a0)['then'](function(_0x429649){return _0x429649;});}return null;};}function removeEntity(_0x49b9ab,_0x28ef68){return function(_0x94aced){if(_0x94aced){return _0x94aced[_0x3b2f('0x28')]()[_0x3b2f('0x29')](function(){_0x49b9ab['status'](0xcc)[_0x3b2f('0x1d')]();});}};}function handleEntityNotFound(_0x2ee755,_0x48592c){return function(_0x4db72f){if(!_0x4db72f){_0x2ee755[_0x3b2f('0x1b')](0x194);}return _0x4db72f;};}function handleError(_0x44fa57,_0x9cf807){_0x9cf807=_0x9cf807||0x1f4;return function(_0x2ca527){logger['error'](_0x2ca527['stack']);if(_0x2ca527[_0x3b2f('0x2a')]){delete _0x2ca527[_0x3b2f('0x2a')];}_0x44fa57[_0x3b2f('0x1c')](_0x9cf807)[_0x3b2f('0x2b')](_0x2ca527);};}exports['index']=function(_0x39f342,_0x4b76ea){var _0x30d504={},_0x21c8a4={},_0x171f99={'count':0x0,'rows':[]};var _0x469fc9=_[_0x3b2f('0x2c')](db[_0x3b2f('0x2d')]['rawAttributes'],function(_0x1fbcb6){return{'name':_0x1fbcb6[_0x3b2f('0x2e')],'type':_0x1fbcb6['type']['key']};});_0x21c8a4[_0x3b2f('0x2f')]=_[_0x3b2f('0x2c')](_0x469fc9,'name');_0x21c8a4['query']=_[_0x3b2f('0x30')](_0x39f342[_0x3b2f('0x31')]);_0x21c8a4[_0x3b2f('0x32')]=_[_0x3b2f('0x33')](_0x21c8a4[_0x3b2f('0x2f')],_0x21c8a4[_0x3b2f('0x31')]);_0x30d504['attributes']=_[_0x3b2f('0x33')](_0x21c8a4[_0x3b2f('0x2f')],qs['fields'](_0x39f342[_0x3b2f('0x31')][_0x3b2f('0x34')]));_0x30d504[_0x3b2f('0x35')]=_0x30d504[_0x3b2f('0x35')]['length']?_0x30d504[_0x3b2f('0x35')]:_0x21c8a4[_0x3b2f('0x2f')];if(!_0x39f342[_0x3b2f('0x31')][_0x3b2f('0x36')]('nolimit')){_0x30d504['limit']=qs[_0x3b2f('0x21')](_0x39f342[_0x3b2f('0x31')][_0x3b2f('0x21')]);_0x30d504[_0x3b2f('0x1f')]=qs[_0x3b2f('0x1f')](_0x39f342['query']['offset']);}_0x30d504[_0x3b2f('0x37')]=qs[_0x3b2f('0x38')](_0x39f342[_0x3b2f('0x31')]['sort']);_0x30d504[_0x3b2f('0x39')]=qs[_0x3b2f('0x32')](_[_0x3b2f('0x3a')](_0x39f342['query'],_0x21c8a4[_0x3b2f('0x32')]),_0x469fc9);if(_0x39f342[_0x3b2f('0x31')][_0x3b2f('0x3b')]){_0x30d504['where']=_['merge'](_0x30d504[_0x3b2f('0x39')],{'$or':_['map'](_0x469fc9,function(_0x508ad5){if(_0x508ad5[_0x3b2f('0x3c')]!==_0x3b2f('0x3d')){var _0x4ac830={};_0x4ac830[_0x508ad5[_0x3b2f('0x2a')]]={'$like':'%'+_0x39f342[_0x3b2f('0x31')][_0x3b2f('0x3b')]+'%'};return _0x4ac830;}})});}_0x30d504=_[_0x3b2f('0x3e')]({},_0x30d504,_0x39f342[_0x3b2f('0x3f')]);var _0xad28b3={'where':_0x30d504[_0x3b2f('0x39')]};return db[_0x3b2f('0x2d')]['count'](_0xad28b3)[_0x3b2f('0x29')](function(_0x321d43){_0x171f99[_0x3b2f('0x22')]=_0x321d43;if(_0x39f342[_0x3b2f('0x31')][_0x3b2f('0x40')]){_0x30d504[_0x3b2f('0x41')]=[{'all':!![]}];}return db[_0x3b2f('0x2d')][_0x3b2f('0x42')](_0x30d504);})[_0x3b2f('0x29')](function(_0x507813){_0x171f99[_0x3b2f('0x43')]=_0x507813;return _0x171f99;})[_0x3b2f('0x29')](respondWithFilteredResult(_0x4b76ea,_0x30d504))[_0x3b2f('0x44')](handleError(_0x4b76ea,null));};exports['show']=function(_0x2e6258,_0x4a2cdd){var _0xe84703={'raw':!![],'where':{'id':_0x2e6258[_0x3b2f('0x45')]['id']}},_0x23b747={};_0x23b747[_0x3b2f('0x2f')]=_[_0x3b2f('0x30')](db[_0x3b2f('0x2d')]['rawAttributes']);_0x23b747[_0x3b2f('0x31')]=_['keys'](_0x2e6258[_0x3b2f('0x31')]);_0x23b747[_0x3b2f('0x32')]=_['intersection'](_0x23b747[_0x3b2f('0x2f')],_0x23b747[_0x3b2f('0x31')]);_0xe84703[_0x3b2f('0x35')]=_[_0x3b2f('0x33')](_0x23b747[_0x3b2f('0x2f')],qs['fields'](_0x2e6258['query'][_0x3b2f('0x34')]));_0xe84703['attributes']=_0xe84703[_0x3b2f('0x35')]['length']?_0xe84703[_0x3b2f('0x35')]:_0x23b747[_0x3b2f('0x2f')];if(_0x2e6258[_0x3b2f('0x31')][_0x3b2f('0x40')]){_0xe84703['include']=[{'all':!![]}];}_0xe84703=_[_0x3b2f('0x3e')]({},_0xe84703,_0x2e6258[_0x3b2f('0x3f')]);return db[_0x3b2f('0x2d')]['find'](_0xe84703)[_0x3b2f('0x29')](handleEntityNotFound(_0x4a2cdd,null))[_0x3b2f('0x29')](respondWithResult(_0x4a2cdd,null))[_0x3b2f('0x44')](handleError(_0x4a2cdd,null));};exports[_0x3b2f('0x46')]=function(_0x5e6666,_0x267af4){return db[_0x3b2f('0x2d')][_0x3b2f('0x46')](_0x5e6666[_0x3b2f('0x47')],{})[_0x3b2f('0x29')](respondWithResult(_0x267af4,0xc9))[_0x3b2f('0x44')](handleError(_0x267af4,null));};exports[_0x3b2f('0x27')]=function(_0x2e182e,_0x56be24){if(_0x2e182e[_0x3b2f('0x47')]['id']){delete _0x2e182e[_0x3b2f('0x47')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x2e182e['params']['id']}})[_0x3b2f('0x29')](handleEntityNotFound(_0x56be24,null))[_0x3b2f('0x29')](saveUpdates(_0x2e182e[_0x3b2f('0x47')],null))[_0x3b2f('0x29')](respondWithResult(_0x56be24,null))['catch'](handleError(_0x56be24,null));};exports[_0x3b2f('0x28')]=function(_0x67a4c0,_0x5c98c6){return db['WhatsappTransferReport']['find']({'where':{'id':_0x67a4c0[_0x3b2f('0x45')]['id']}})[_0x3b2f('0x29')](handleEntityNotFound(_0x5c98c6,null))['then'](removeEntity(_0x5c98c6,null))['catch'](handleError(_0x5c98c6,null));};exports['describe']=function(_0x48f1da,_0xfd3aa4){return db[_0x3b2f('0x2d')][_0x3b2f('0x48')]()[_0x3b2f('0x29')](respondWithResult(_0xfd3aa4,null))['catch'](handleError(_0xfd3aa4,null));}; \ No newline at end of file +var _0xe05d=['sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','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/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0xe05d,0xf1));var _0xde05=function(_0x1cdc96,_0x1cead6){_0x1cdc96=_0x1cdc96-0x0;var _0x350053=_0xe05d[_0x1cdc96];return _0x350053;};'use strict';var emlformat=require(_0xde05('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xde05('0x1'));var rp=require(_0xde05('0x2'));var moment=require(_0xde05('0x3'));var BPromise=require(_0xde05('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xde05('0x5'));var csv=require(_0xde05('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde05('0x7'));var _=require(_0xde05('0x8'));var squel=require(_0xde05('0x9'));var crypto=require(_0xde05('0xa'));var jsforce=require(_0xde05('0xb'));var deskjs=require(_0xde05('0xc'));var toCsv=require(_0xde05('0x6'));var querystring=require(_0xde05('0xd'));var Papa=require(_0xde05('0xe'));var Redis=require(_0xde05('0xf'));var authService=require(_0xde05('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xde05('0x11'));var hardwareService=require(_0xde05('0x12'));var logger=require(_0xde05('0x13'))(_0xde05('0x14'));var utils=require(_0xde05('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xde05('0x16'));var db=require(_0xde05('0x17'))['db'];function respondWithStatusCode(_0x201045,_0x3f01e9){_0x3f01e9=_0x3f01e9||0xcc;return function(_0x641b29){if(_0x641b29){return _0x201045[_0xde05('0x18')](_0x3f01e9);}return _0x201045['status'](_0x3f01e9)[_0xde05('0x19')]();};}function respondWithResult(_0x854f1f,_0x40a135){_0x40a135=_0x40a135||0xc8;return function(_0x362536){if(_0x362536){return _0x854f1f[_0xde05('0x1a')](_0x40a135)['json'](_0x362536);}};}function respondWithFilteredResult(_0x57f000,_0x210646){return function(_0x368fff){if(_0x368fff){var _0x165fac=typeof _0x210646[_0xde05('0x1b')]===_0xde05('0x1c')&&typeof _0x210646['limit']==='undefined';var _0x51cc92=_0x368fff[_0xde05('0x1d')];var _0x3f432c=_0x165fac?0x0:_0x210646[_0xde05('0x1b')];var _0x4dfbe5=_0x165fac?_0x368fff['count']:_0x210646[_0xde05('0x1b')]+_0x210646[_0xde05('0x1e')];var _0x2b1951;if(_0x4dfbe5>=_0x51cc92){_0x4dfbe5=_0x51cc92;_0x2b1951=0xc8;}else{_0x2b1951=0xce;}_0x57f000[_0xde05('0x1a')](_0x2b1951);return _0x57f000['set'](_0xde05('0x1f'),_0x3f432c+'-'+_0x4dfbe5+'/'+_0x51cc92)[_0xde05('0x20')](_0x368fff);}return null;};}function patchUpdates(_0x41bf0b){return function(_0x518061){try{jsonpatch[_0xde05('0x21')](_0x518061,_0x41bf0b,!![]);}catch(_0x4a68ad){return BPromise[_0xde05('0x22')](_0x4a68ad);}return _0x518061[_0xde05('0x23')]();};}function saveUpdates(_0x4e3a8f,_0x2c7764){return function(_0xaf3e10){if(_0xaf3e10){return _0xaf3e10[_0xde05('0x24')](_0x4e3a8f)[_0xde05('0x25')](function(_0x20bc85){return _0x20bc85;});}return null;};}function removeEntity(_0x429a3e,_0x26601d){return function(_0x1d0165){if(_0x1d0165){return _0x1d0165[_0xde05('0x26')]()['then'](function(){_0x429a3e['status'](0xcc)[_0xde05('0x19')]();});}};}function handleEntityNotFound(_0xc2cabf,_0x20b3d1){return function(_0xc8fe25){if(!_0xc8fe25){_0xc2cabf[_0xde05('0x18')](0x194);}return _0xc8fe25;};}function handleError(_0x22b881,_0x32d3f4){_0x32d3f4=_0x32d3f4||0x1f4;return function(_0x2bc1c4){logger[_0xde05('0x27')](_0x2bc1c4[_0xde05('0x28')]);if(_0x2bc1c4[_0xde05('0x29')]){delete _0x2bc1c4[_0xde05('0x29')];}_0x22b881[_0xde05('0x1a')](_0x32d3f4)[_0xde05('0x2a')](_0x2bc1c4);};}exports['index']=function(_0x2581e0,_0xdd5dcf){var _0x5bcc05={},_0x26e087={},_0x2143f9={'count':0x0,'rows':[]};var _0x1ea4df=_[_0xde05('0x2b')](db[_0xde05('0x2c')][_0xde05('0x2d')],function(_0x7cc13f){return{'name':_0x7cc13f[_0xde05('0x2e')],'type':_0x7cc13f[_0xde05('0x2f')][_0xde05('0x30')]};});_0x26e087[_0xde05('0x31')]=_['map'](_0x1ea4df,_0xde05('0x29'));_0x26e087[_0xde05('0x32')]=_[_0xde05('0x33')](_0x2581e0['query']);_0x26e087[_0xde05('0x34')]=_[_0xde05('0x35')](_0x26e087[_0xde05('0x31')],_0x26e087[_0xde05('0x32')]);_0x5bcc05[_0xde05('0x36')]=_[_0xde05('0x35')](_0x26e087['model'],qs['fields'](_0x2581e0[_0xde05('0x32')][_0xde05('0x37')]));_0x5bcc05[_0xde05('0x36')]=_0x5bcc05[_0xde05('0x36')][_0xde05('0x38')]?_0x5bcc05[_0xde05('0x36')]:_0x26e087['model'];if(!_0x2581e0['query'][_0xde05('0x39')](_0xde05('0x3a'))){_0x5bcc05['limit']=qs[_0xde05('0x1e')](_0x2581e0[_0xde05('0x32')]['limit']);_0x5bcc05['offset']=qs[_0xde05('0x1b')](_0x2581e0[_0xde05('0x32')]['offset']);}_0x5bcc05['order']=qs[_0xde05('0x3b')](_0x2581e0[_0xde05('0x32')][_0xde05('0x3b')]);_0x5bcc05['where']=qs[_0xde05('0x34')](_['pick'](_0x2581e0['query'],_0x26e087[_0xde05('0x34')]),_0x1ea4df);if(_0x2581e0[_0xde05('0x32')]['filter']){_0x5bcc05[_0xde05('0x3c')]=_[_0xde05('0x3d')](_0x5bcc05[_0xde05('0x3c')],{'$or':_[_0xde05('0x2b')](_0x1ea4df,function(_0x2471e6){if(_0x2471e6[_0xde05('0x2f')]!==_0xde05('0x3e')){var _0x20aec1={};_0x20aec1[_0x2471e6['name']]={'$like':'%'+_0x2581e0[_0xde05('0x32')][_0xde05('0x3f')]+'%'};return _0x20aec1;}})});}_0x5bcc05=_[_0xde05('0x3d')]({},_0x5bcc05,_0x2581e0[_0xde05('0x40')]);var _0x50bdfa={'where':_0x5bcc05[_0xde05('0x3c')]};return db['WhatsappTransferReport'][_0xde05('0x1d')](_0x50bdfa)[_0xde05('0x25')](function(_0x246dae){_0x2143f9[_0xde05('0x1d')]=_0x246dae;if(_0x2581e0[_0xde05('0x32')][_0xde05('0x41')]){_0x5bcc05[_0xde05('0x42')]=[{'all':!![]}];}return db[_0xde05('0x2c')]['findAll'](_0x5bcc05);})[_0xde05('0x25')](function(_0x58e7d2){_0x2143f9[_0xde05('0x43')]=_0x58e7d2;return _0x2143f9;})[_0xde05('0x25')](respondWithFilteredResult(_0xdd5dcf,_0x5bcc05))[_0xde05('0x44')](handleError(_0xdd5dcf,null));};exports[_0xde05('0x45')]=function(_0x4dfcb8,_0x5e9459){var _0x29c6c1={'raw':!![],'where':{'id':_0x4dfcb8[_0xde05('0x46')]['id']}},_0xacaa05={};_0xacaa05[_0xde05('0x31')]=_[_0xde05('0x33')](db[_0xde05('0x2c')][_0xde05('0x2d')]);_0xacaa05[_0xde05('0x32')]=_[_0xde05('0x33')](_0x4dfcb8['query']);_0xacaa05[_0xde05('0x34')]=_[_0xde05('0x35')](_0xacaa05['model'],_0xacaa05[_0xde05('0x32')]);_0x29c6c1[_0xde05('0x36')]=_['intersection'](_0xacaa05[_0xde05('0x31')],qs['fields'](_0x4dfcb8[_0xde05('0x32')][_0xde05('0x37')]));_0x29c6c1[_0xde05('0x36')]=_0x29c6c1['attributes'][_0xde05('0x38')]?_0x29c6c1['attributes']:_0xacaa05[_0xde05('0x31')];if(_0x4dfcb8['query']['includeAll']){_0x29c6c1['include']=[{'all':!![]}];}_0x29c6c1=_[_0xde05('0x3d')]({},_0x29c6c1,_0x4dfcb8[_0xde05('0x40')]);return db[_0xde05('0x2c')][_0xde05('0x47')](_0x29c6c1)[_0xde05('0x25')](handleEntityNotFound(_0x5e9459,null))[_0xde05('0x25')](respondWithResult(_0x5e9459,null))[_0xde05('0x44')](handleError(_0x5e9459,null));};exports[_0xde05('0x48')]=function(_0x3ec781,_0x4a9be9){return db[_0xde05('0x2c')][_0xde05('0x48')](_0x3ec781[_0xde05('0x49')],{})[_0xde05('0x25')](respondWithResult(_0x4a9be9,0xc9))[_0xde05('0x44')](handleError(_0x4a9be9,null));};exports[_0xde05('0x24')]=function(_0x105257,_0x173e2e){if(_0x105257[_0xde05('0x49')]['id']){delete _0x105257[_0xde05('0x49')]['id'];}return db[_0xde05('0x2c')][_0xde05('0x47')]({'where':{'id':_0x105257[_0xde05('0x46')]['id']}})[_0xde05('0x25')](handleEntityNotFound(_0x173e2e,null))[_0xde05('0x25')](saveUpdates(_0x105257[_0xde05('0x49')],null))['then'](respondWithResult(_0x173e2e,null))[_0xde05('0x44')](handleError(_0x173e2e,null));};exports[_0xde05('0x26')]=function(_0x46be16,_0x23b446){return db[_0xde05('0x2c')][_0xde05('0x47')]({'where':{'id':_0x46be16[_0xde05('0x46')]['id']}})[_0xde05('0x25')](handleEntityNotFound(_0x23b446,null))[_0xde05('0x25')](removeEntity(_0x23b446,null))[_0xde05('0x44')](handleError(_0x23b446,null));};exports['describe']=function(_0x5f107c,_0x385812){return db[_0xde05('0x2c')][_0xde05('0x4a')]()[_0xde05('0x25')](respondWithResult(_0x385812,null))[_0xde05('0x44')](handleError(_0x385812,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 2415d8e..11a1877 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 _0xbec3=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport'];(function(_0x10757c,_0x15d83a){var _0x4a143b=function(_0x136858){while(--_0x136858){_0x10757c['push'](_0x10757c['shift']());}};_0x4a143b(++_0x15d83a);}(_0xbec3,0x115));var _0x3bec=function(_0x32b3b3,_0x20f4d1){_0x32b3b3=_0x32b3b3-0x0;var _0x47c48d=_0xbec3[_0x32b3b3];return _0x47c48d;};'use strict';var _=require(_0x3bec('0x0'));var util=require(_0x3bec('0x1'));var logger=require(_0x3bec('0x2'))(_0x3bec('0x3'));var moment=require(_0x3bec('0x4'));var BPromise=require(_0x3bec('0x5'));var rp=require(_0x3bec('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3bec('0x7'));var attributes=require(_0x3bec('0x8'));module['exports']=function(_0x973c45,_0x10cf77){return _0x973c45[_0x3bec('0x9')](_0x3bec('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3bec('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc67=['api','moment','bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger'];(function(_0x335693,_0x51d436){var _0x556377=function(_0x141af5){while(--_0x141af5){_0x335693['push'](_0x335693['shift']());}};_0x556377(++_0x51d436);}(_0xdc67,0x73));var _0x7dc6=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0xdc67[_0x45ae0d];return _0x371826;};'use strict';var _=require('lodash');var util=require(_0x7dc6('0x0'));var logger=require(_0x7dc6('0x1'))(_0x7dc6('0x2'));var moment=require(_0x7dc6('0x3'));var BPromise=require(_0x7dc6('0x4'));var rp=require(_0x7dc6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7dc6('0x6'));var attributes=require(_0x7dc6('0x7'));module[_0x7dc6('0x8')]=function(_0x413be1,_0x2e06d0){return _0x413be1[_0x7dc6('0x9')](_0x7dc6('0xa'),attributes,{'tableName':_0x7dc6('0xb'),'paranoid':![],'indexes':[{'name':_0x7dc6('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index f5bdb50..e63741c 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 _0xb4d1=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xb4d1,0xf6));var _0x1b4d=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xb4d1[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x1b4d('0x0'));var util=require(_0x1b4d('0x1'));var moment=require(_0x1b4d('0x2'));var BPromise=require(_0x1b4d('0x3'));var rs=require(_0x1b4d('0x4'));var fs=require('fs');var Redis=require(_0x1b4d('0x5'));var db=require(_0x1b4d('0x6'))['db'];var utils=require(_0x1b4d('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1b4d('0x8'));var jayson=require(_0x1b4d('0x9'));var client=jayson[_0x1b4d('0xa')][_0x1b4d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56de4e,_0x443b3e,_0x9947b){return new BPromise(function(_0x2240b0,_0x20574b){return client[_0x1b4d('0xc')](_0x56de4e,_0x9947b)[_0x1b4d('0xd')](function(_0x3faaf4){logger[_0x1b4d('0xe')](_0x1b4d('0xf'),_0x443b3e,_0x1b4d('0x10'));logger[_0x1b4d('0x11')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x443b3e,_0x1b4d('0x10'),JSON[_0x1b4d('0x12')](_0x3faaf4));if(_0x3faaf4[_0x1b4d('0x13')]){if(_0x3faaf4[_0x1b4d('0x13')]['code']===0x1f4){logger[_0x1b4d('0x13')](_0x1b4d('0xf'),_0x443b3e,_0x3faaf4[_0x1b4d('0x13')][_0x1b4d('0x14')]);return _0x20574b(_0x3faaf4[_0x1b4d('0x13')]['message']);}logger[_0x1b4d('0x13')](_0x1b4d('0xf'),_0x443b3e,_0x3faaf4[_0x1b4d('0x13')][_0x1b4d('0x14')]);return _0x2240b0(_0x3faaf4[_0x1b4d('0x13')]['message']);}else{logger[_0x1b4d('0xe')](_0x1b4d('0xf'),_0x443b3e,_0x1b4d('0x10'));_0x2240b0(_0x3faaf4[_0x1b4d('0x15')]['message']);}})[_0x1b4d('0x16')](function(_0xdfe547){logger[_0x1b4d('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x443b3e,_0xdfe547);_0x20574b(_0xdfe547);});});} \ No newline at end of file +var _0x7f32=['info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f32,0x9a));var _0x27f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7f32[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x27f3('0x0'));var util=require(_0x27f3('0x1'));var moment=require('moment');var BPromise=require(_0x27f3('0x2'));var rs=require(_0x27f3('0x3'));var fs=require('fs');var Redis=require(_0x27f3('0x4'));var db=require(_0x27f3('0x5'))['db'];var utils=require(_0x27f3('0x6'));var logger=require(_0x27f3('0x7'))(_0x27f3('0x8'));var config=require(_0x27f3('0x9'));var jayson=require(_0x27f3('0xa'));var client=jayson['client'][_0x27f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ad5ee,_0x5616db,_0x226514){return new BPromise(function(_0x16811a,_0x5e49ba){return client[_0x27f3('0xc')](_0x5ad5ee,_0x226514)[_0x27f3('0xd')](function(_0x36a968){logger[_0x27f3('0xe')](_0x27f3('0xf'),_0x5616db,_0x27f3('0x10'));logger[_0x27f3('0x11')](_0x27f3('0x12'),_0x5616db,_0x27f3('0x10'),JSON[_0x27f3('0x13')](_0x36a968));if(_0x36a968[_0x27f3('0x14')]){if(_0x36a968[_0x27f3('0x14')]['code']===0x1f4){logger[_0x27f3('0x14')](_0x27f3('0xf'),_0x5616db,_0x36a968[_0x27f3('0x14')]['message']);return _0x5e49ba(_0x36a968[_0x27f3('0x14')][_0x27f3('0x15')]);}logger[_0x27f3('0x14')](_0x27f3('0xf'),_0x5616db,_0x36a968[_0x27f3('0x14')][_0x27f3('0x15')]);return _0x16811a(_0x36a968[_0x27f3('0x14')][_0x27f3('0x15')]);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x5616db,'request\x20sent');_0x16811a(_0x36a968[_0x27f3('0x16')]['message']);}})[_0x27f3('0x17')](function(_0x4b46fe){logger[_0x27f3('0x14')](_0x27f3('0xf'),_0x5616db,_0x4b46fe);_0x5e49ba(_0x4b46fe);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index b83fa71..bd23f46 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f9f=['default','listen','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','filter','online','join','Offline\x20apps:','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then'];(function(_0x3b8320,_0x4f2177){var _0x278859=function(_0x58a817){while(--_0x58a817){_0x3b8320['push'](_0x3b8320['shift']());}};_0x278859(++_0x4f2177);}(_0x0f9f,0xae));var _0xf0f9=function(_0x24fa8f,_0x56b265){_0x24fa8f=_0x24fa8f-0x0;var _0x380153=_0x0f9f[_0x24fa8f];return _0x380153;};'use strict';var _=require(_0xf0f9('0x0'));var db=require(_0xf0f9('0x1'))['db'];var seedDb=require(_0xf0f9('0x2'));var checkLicense=require(_0xf0f9('0x3'));var rpc=require(_0xf0f9('0x4'));var config=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var pm2=require(_0xf0f9('0x8'));var pm2Config=require(_0xf0f9('0x9'));var schedule=require(_0xf0f9('0xa'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xf0f9('0xb'));var transcribe=require(_0xf0f9('0xc'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xf0f9('0xd')][_0xf0f9('0xe')]()[_0xf0f9('0xf')](function(){if(config['seedDB']){return seedDb[_0xf0f9('0x10')]();}})[_0xf0f9('0xf')](function(){return checkLicense['default']();})[_0xf0f9('0xf')](function(){return rpc[_0xf0f9('0x11')]();})[_0xf0f9('0xf')](function(_0x3be7af){logger[_0xf0f9('0x12')](_0x3be7af);return chat[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return whatsapp[_0xf0f9('0x13')]();})['then'](function(){return schedule[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return transcribe[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return provider['start']();})[_0xf0f9('0xf')](function(_0xd4e645){logger['info'](_0xd4e645);return pm2[_0xf0f9('0x13')](pm2Config);})['then'](function(_0x538864){var _0x2c832a=_0x538864['filter'](function(_0x3e1587){return typeof _0x3e1587['exitCode']===_0xf0f9('0x14')&&_0x3e1587[_0xf0f9('0x15')]>=0x0;});if(_0x2c832a[_0xf0f9('0x16')]>0x0){throw new Error(_0x2c832a[_0xf0f9('0x16')]+_0xf0f9('0x17')+_[_0xf0f9('0x18')](_0x2c832a,function(_0x10dae6){return'\x22'+_0x10dae6['pm2_env'][_0xf0f9('0x19')]+'\x22';}));}logger[_0xf0f9('0x12')](_0xf0f9('0x1a'),_[_0xf0f9('0x18')](_[_0xf0f9('0x1b')](_0x538864,{'status':_0xf0f9('0x1c')}),_0xf0f9('0x19'))[_0xf0f9('0x1d')]());logger['info'](_0xf0f9('0x1e'),_['map'](_[_0xf0f9('0x1b')](_0x538864,function(_0x510119){return _0x510119[_0xf0f9('0x1f')]!==_0xf0f9('0x1c');}),_0xf0f9('0x19'))[_0xf0f9('0x1d')]()||_0xf0f9('0x20'));console[_0xf0f9('0x21')]('App\x20Ready!');})[_0xf0f9('0x22')](function(_0x535c2c){console[_0xf0f9('0x21')](_0xf0f9('0x23'),_0x535c2c);logger['error'](_0xf0f9('0x24'),_0x535c2c);process[_0xf0f9('0x25')](0x1);});}main(); \ No newline at end of file +var _0xc1fa=['map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','start','info','filter','exitCode','length'];(function(_0x3400ca,_0x27c04d){var _0x26e8d1=function(_0x2284e9){while(--_0x2284e9){_0x3400ca['push'](_0x3400ca['shift']());}};_0x26e8d1(++_0x27c04d);}(_0xc1fa,0x83));var _0xac1f=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0xc1fa[_0x2d61ac];return _0x3f7d3c;};'use strict';var _=require(_0xac1f('0x0'));var db=require(_0xac1f('0x1'))['db'];var seedDb=require(_0xac1f('0x2'));var checkLicense=require(_0xac1f('0x3'));var rpc=require(_0xac1f('0x4'));var config=require(_0xac1f('0x5'));var logger=require('./config/logger')(_0xac1f('0x6'));var pm2=require(_0xac1f('0x7'));var pm2Config=require(_0xac1f('0x8'));var schedule=require(_0xac1f('0x9'));var chat=require(_0xac1f('0xa'));var whatsapp=require(_0xac1f('0xb'));var transcribe=require(_0xac1f('0xc'));var provider=require(_0xac1f('0xd'));function main(){return db[_0xac1f('0xe')][_0xac1f('0xf')]()[_0xac1f('0x10')](function(){if(config[_0xac1f('0x11')]){return seedDb['default']();}})[_0xac1f('0x10')](function(){return checkLicense[_0xac1f('0x12')]();})[_0xac1f('0x10')](function(){return rpc[_0xac1f('0x13')]();})[_0xac1f('0x10')](function(_0x50fbcb){logger['info'](_0x50fbcb);return chat[_0xac1f('0x14')]();})['then'](function(){return whatsapp['start']();})[_0xac1f('0x10')](function(){return schedule[_0xac1f('0x14')]();})['then'](function(){return transcribe[_0xac1f('0x14')]();})[_0xac1f('0x10')](function(){return provider[_0xac1f('0x14')]();})[_0xac1f('0x10')](function(_0xb5005b){logger[_0xac1f('0x15')](_0xb5005b);return pm2[_0xac1f('0x14')](pm2Config);})[_0xac1f('0x10')](function(_0x2c7411){var _0x1ab6dc=_0x2c7411[_0xac1f('0x16')](function(_0x2671ec){return typeof _0x2671ec[_0xac1f('0x17')]==='number'&&_0x2671ec[_0xac1f('0x17')]>=0x0;});if(_0x1ab6dc[_0xac1f('0x18')]>0x0){throw new Error(_0x1ab6dc[_0xac1f('0x18')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xac1f('0x19')](_0x1ab6dc,function(_0x5c7847){return'\x22'+_0x5c7847[_0xac1f('0x1a')][_0xac1f('0x1b')]+'\x22';}));}logger[_0xac1f('0x15')](_0xac1f('0x1c'),_['map'](_[_0xac1f('0x16')](_0x2c7411,{'status':_0xac1f('0x1d')}),'name')[_0xac1f('0x1e')]());logger['info'](_0xac1f('0x1f'),_[_0xac1f('0x19')](_[_0xac1f('0x16')](_0x2c7411,function(_0x44a8c7){return _0x44a8c7[_0xac1f('0x20')]!==_0xac1f('0x1d');}),_0xac1f('0x1b'))[_0xac1f('0x1e')]()||'None');console['log'](_0xac1f('0x21'));})[_0xac1f('0x22')](function(_0x1c6281){console[_0xac1f('0x23')](_0xac1f('0x24'),_0x1c6281);logger[_0xac1f('0x25')](_0xac1f('0x26'),_0x1c6281);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5835e67..25f16f7 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 _0x436e=['HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','moment','role','name','internal','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','forceDownload','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','startsWith','Basic','User','find','then','pass','status','Wrong\x20credentials.','authorization','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','validatePasswordPattern','test','Sequelize','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','join','sign','secret','payload','options','promisify','verify','secrets','session','randomBytes','toString','hex','floor','now'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0x436e,0x8d));var _0xe436=function(_0x1e29f2,_0x3cd03c){_0x1e29f2=_0x1e29f2-0x0;var _0x22146d=_0x436e[_0x1e29f2];return _0x22146d;};'use strict';var db=require(_0xe436('0x0'))['db'];var config=require(_0xe436('0x1'));var hardwareConf=require(_0xe436('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xe436('0x3'));var _=require(_0xe436('0x4'));var jwt=require(_0xe436('0x5'));var expressJwt=require(_0xe436('0x6'));var compose=require(_0xe436('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0xe436('0x8'));var BPromise=require(_0xe436('0x9'));var util=require('util');var moment=require(_0xe436('0xa'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xe436('0xb'),'fullname',_0xe436('0xc'),_0xe436('0xd'),'email',_0xe436('0xe'),_0xe436('0xf'),_0xe436('0x10'),_0xe436('0x11'),_0xe436('0x12'),'mailPause',_0xe436('0x13'),_0xe436('0x14'),_0xe436('0x15'),'pauseType',_0xe436('0x16'),_0xe436('0x17'),_0xe436('0x18'),_0xe436('0x19'),_0xe436('0x1a'),_0xe436('0x1b'),_0xe436('0x1c'),_0xe436('0x1d'),_0xe436('0x1e'),'phoneBarDnd',_0xe436('0x1f'),_0xe436('0x20'),_0xe436('0x21'),'phoneBarExpires',_0xe436('0x22'),_0xe436('0x23'),_0xe436('0x24'),_0xe436('0x25'),_0xe436('0x26'),'userProfileId',_0xe436('0x27'),'settingsEnabled',_0xe436('0x28'),_0xe436('0x29'),_0xe436('0x2a'),'downloadAttachments',_0xe436('0x2b'),'selectRecallMeCampaign',_0xe436('0x2c'),_0xe436('0x2d'),'emailAutoanswer','emailAutoanswerDelay','smsAutoanswer',_0xe436('0x2e'),_0xe436('0x2f'),_0xe436('0x30'),'faxAutoanswer',_0xe436('0x31'),_0xe436('0x32'),_0xe436('0x33'),_0xe436('0x34')];exports[_0xe436('0x35')]=function(){return this['isAuthenticated'](!![])[_0xe436('0x36')](function(_0x4d890a,_0x4a05fd,_0x4be939){if(_0x4d890a[_0xe436('0x37')]){_0x4be939();}else{return db[_0xe436('0x38')][_0xe436('0x39')]({'where':{'id':_0x4d890a[_0xe436('0x3a')]['id']},'attributes':['id',_0xe436('0x3b'),_0xe436('0x3c')],'raw':!![]})['then'](function(_0x32327e){if(_0x32327e&&_0x32327e['closed']&&!_0x4d890a['query'][_0xe436('0x3d')]){return _0x4a05fd['status'](_0x32327e[_0xe436('0x3c')]===_0xe436('0x3e')?0x195:0x193)[_0xe436('0x3f')]({'message':_0x32327e['disposition']===_0xe436('0x3e')?_0xe436('0x40'):'Forbidden.'});}else{_0x4be939();}})[_0xe436('0x41')](function(_0x4d09dc){_0x4be939(_0x4d09dc);});}});};exports[_0xe436('0x42')]=function isAuthenticated(_0x35e4ef){return compose()[_0xe436('0x36')](function(_0x227515,_0x558185,_0x61a24f){var _0x5a9b73;if(_0x227515[_0xe436('0x43')]['authorization']){if(_[_0xe436('0x44')](_0x227515[_0xe436('0x43')]['authorization'],_0xe436('0x45'))){var _0x37dddc=basicAuth(_0x227515);db[_0xe436('0x46')][_0xe436('0x47')]({'where':{'name':_0x37dddc['name']}})[_0xe436('0x48')](function(_0xb3a27c){if(!_0xb3a27c||!_0xb3a27c['authenticate'](_0x37dddc[_0xe436('0x49')])){return _0x558185[_0xe436('0x4a')](0x191)[_0xe436('0x3f')]({'message':_0xe436('0x4b')});}_0x227515[_0xe436('0x37')]={'id':_0xb3a27c['id']};_0x61a24f();})['catch'](function(_0x1dba9b){_0x61a24f(_0x1dba9b);});}else if(_[_0xe436('0x44')](_0x227515[_0xe436('0x43')][_0xe436('0x4c')],_0xe436('0x4d'))){validateJwt(_0x227515,_0x558185,_0x61a24f);}else{if(_0x35e4ef){_0x61a24f();}else{return _0x558185[_0xe436('0x4a')](0x193)['json']({'message':_0xe436('0x4e')});}}}else if(_0x227515[_0xe436('0x4f')][_0xe436('0x50')]){try{var _0x1026ae={'audience':hardwareConf[_0xe436('0x51')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x227515[_0xe436('0x4f')]['apikey'],_0x1026ae)[_0xe436('0x48')](function(_0x549102){return db[_0xe436('0x46')][_0xe436('0x47')]({'where':{'id':_0x549102[_0xe436('0x52')]}})[_0xe436('0x48')](function(_0x106f20){_0x5a9b73=_0x106f20;return db[_0xe436('0x53')][_0xe436('0x39')]({'where':{'id':0x1},'attributes':[_0xe436('0x54'),_0xe436('0x55')],'raw':!![]});})[_0xe436('0x48')](function(_0x8c0f6e){if(!_0x5a9b73||!_[_0xe436('0x56')](_0x5a9b73['apiKeyNonce'],_0x549102[_0xe436('0x57')])){return _0x558185[_0xe436('0x4a')](0x191)[_0xe436('0x3f')]({'message':_0xe436('0x58')});}if(_0x5a9b73['disabled']){return _0x558185[_0xe436('0x4a')](0x191)[_0xe436('0x3f')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x5a9b73[_0xe436('0x59')]){if(_0x8c0f6e['blockDuration']>0x0){if(moment(_0x5a9b73[_0xe436('0x5a')])[_0xe436('0x5b')](_0x8c0f6e[_0xe436('0x55')],'minutes')>moment()){return _0x558185['status'](0x191)['json']({'message':_0xe436('0x5c')});}}else{return _0x558185[_0xe436('0x4a')](0x191)['json']({'message':_0xe436('0x5c')});}}_0x227515['user']={'id':_0x5a9b73['id']};_0x61a24f();});})['catch'](function(){return _0x558185[_0xe436('0x4a')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x3fe268){_0x61a24f(_0x3fe268);}}else if(_0x35e4ef){_0x61a24f();}else{return _0x558185[_0xe436('0x4a')](0x193)[_0xe436('0x3f')]({'message':_0xe436('0x4e')});}})[_0xe436('0x36')](function(_0x2934a0,_0xed3aff,_0x47bfb9){if(_0x2934a0['user']){db[_0xe436('0x46')]['find']({'where':{'id':_0x2934a0[_0xe436('0x37')]['id']},'attributes':userAttributes})[_0xe436('0x48')](function(_0xb3a494){if(!_0xb3a494){return _0xed3aff['status'](0x194)['json']({'message':_0xe436('0x5d')});}_0x2934a0['user']=_0xb3a494;_0x47bfb9();})[_0xe436('0x41')](function(_0x3f553b){_0x47bfb9(_0x3f553b);});}else if(_0x35e4ef){_0x47bfb9();}else{return _0xed3aff[_0xe436('0x4a')](0x194)[_0xe436('0x3f')]({'message':_0xe436('0x5e')});}});};exports[_0xe436('0x5f')]=function canUpdate(){return compose()[_0xe436('0x36')](function(_0x165988,_0x451dc8,_0x299ecf){return licenseUtil[_0xe436('0x60')]()[_0xe436('0x48')](function(_0x4362f8){if(_0x4362f8[_0xe436('0x61')]){_0x299ecf();}else{return _0x451dc8[_0xe436('0x4a')](0x193)[_0xe436('0x3f')]({'message':_0xe436('0x62')});}})[_0xe436('0x41')](function(_0x4cde8f){_0x299ecf(_0x4cde8f);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xe436('0x36')](function(_0x2fc5e6,_0xf9acf7,_0x551369){return licenseUtil['getLicense']()[_0xe436('0x48')](function(_0x3ffd5f){if(_0x3ffd5f['webrtc']){_0x551369();}else{return _0xf9acf7[_0xe436('0x4a')](0x193)[_0xe436('0x3f')]({'message':_0xe436('0x62')});}})[_0xe436('0x41')](function(_0x25cff6){_0x551369(_0x25cff6);});});};exports[_0xe436('0x63')]=function(_0x5f4e16,_0x4859c9,_0x1c85b1){_0x5f4e16[_0xe436('0x63')]=!![];return _0x1c85b1();};exports[_0xe436('0x64')]=function signToken(_0xe651ee){return signJwt(_0xe651ee);};exports[_0xe436('0x65')]=function(_0x20d086,_0x4e6680){if(!_0x20d086[_0xe436('0x37')]){return _0x4e6680[_0xe436('0x4a')](0x194)[_0xe436('0x3f')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x8b26a5={'payload':{'id':_0x20d086[_0xe436('0x37')]['id'],'role':_0x20d086[_0xe436('0x37')][_0xe436('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x8b26a5)[_0xe436('0x48')](function(_0x4bbfd3){_0x4e6680[_0xe436('0x66')](_0xe436('0x67'),_0x4bbfd3);_0x4e6680[_0xe436('0x68')](_0xe436('0x69'));})['catch'](function(_0x142b3b){return _0x4e6680['status'](0x1f4)['send'](_0x142b3b);});};exports[_0xe436('0x6a')]=function(_0x5ed87f){if(_[_0xe436('0x6b')](_0x5ed87f['apiKeyNonce'])||_[_0xe436('0x6b')](_0x5ed87f[_0xe436('0x6c')])){return null;}else{return createJwt(_0x5ed87f);}};exports[_0xe436('0x6d')]=function(_0x3b343b){_0x3b343b[_0xe436('0x6e')]=generateNonce();_0x3b343b['apiKeyIat']=generateIssuedAt();return createJwt(_0x3b343b);};exports[_0xe436('0x6f')]=function(_0x4a8970,_0x10d299){var _0x2d42ff=_0x4a8970['query'][_0xe436('0x50')];if(_0x2d42ff){var _0x34f670={'nonce':_0x10d299[_0xe436('0x6e')],'iat':_0x10d299[_0xe436('0x6c')],'audience':hardwareConf[_0xe436('0x51')](),'issuer':hardwareConf[_0xe436('0x51')]()};return verifyJwt(_0x2d42ff,_0x34f670)[_0xe436('0x48')](function(){return generateApiKey(_0x10d299);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xe436('0x70')]=function(_0x171d81){var _0x2c14af=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2c14af[_0xe436('0x71')](_0x171d81))throw new db[(_0xe436('0x72'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x5b6ca6,_0x4fa7a0,_0x537108){var _0xffa2ea=encryptor[_0xe436('0x73')](_0x4fa7a0)[_0xe436('0x74')](',');for(var _0xc32032=0x0;_0xc32032<_0x537108;_0xc32032++){if(!_0xffa2ea[_0xc32032])break;if(_0x5b6ca6[_0xe436('0x75')]()===_0xffa2ea[_0xc32032][_0xe436('0x75')]()){var _0x4fffa3=util[_0xe436('0x76')](_0xe436('0x77'),_0x537108);if(_0x537108===0x1){_0x4fffa3=_0xe436('0x78');}throw new db[(_0xe436('0x72'))][(_0xe436('0x79'))](_0x4fffa3);}}return;};exports[_0xe436('0x7a')]=function(_0xe64d18,_0x4320d7){var _0x2244a7=_0x4320d7?encryptor[_0xe436('0x73')](_0x4320d7)['split'](','):[];if(_0x2244a7[_0xe436('0x7b')]===0x5){_0x2244a7[_0xe436('0x7c')](-0x1,0x1);}_0x2244a7['unshift'](_0xe64d18);return encryptor['encryptString'](_0x2244a7[_0xe436('0x7d')](','));};function signJwt(_0x5b0bef){var _0x5e3249=BPromise['promisify'](jwt[_0xe436('0x7e')],{'context':jwt});var _0x28b1ce=_0x5b0bef[_0xe436('0x7f')]||config['secrets']['session'];return new BPromise(function(_0x1de5e5,_0x43bd6d){_0x5e3249(_0x5b0bef[_0xe436('0x80')],_0x28b1ce,_0x5b0bef[_0xe436('0x81')])[_0xe436('0x48')](function(_0x2a76ef){_0x1de5e5(_0x2a76ef);})[_0xe436('0x41')](function(_0x22b2f0){_0x43bd6d(_0x22b2f0);});});}function verifyJwt(_0x5129c6,_0x3190e5,_0x1c9dfe){var _0x1c6cf7=BPromise[_0xe436('0x82')](jwt[_0xe436('0x83')],{'context':jwt});var _0xb9b030=_0x1c9dfe||config[_0xe436('0x84')][_0xe436('0x85')];return new BPromise(function(_0x3690b8,_0x27d996){_0x1c6cf7(_0x5129c6,_0xb9b030,_0x3190e5)[_0xe436('0x48')](function(_0x1e3185){_0x3690b8(_0x1e3185);})['catch'](function(_0x3ef80f){_0x27d996(_0x3ef80f);});});}function generateNonce(){return crypto[_0xe436('0x86')](0x10)[_0xe436('0x87')](_0xe436('0x88'));}function generateIssuedAt(){return Math[_0xe436('0x89')](Date[_0xe436('0x8a')]()/0x3e8)['toString']();}function createJwt(_0x1256c8){var _0x5ea824={'payload':{'iat':_0x1256c8[_0xe436('0x6c')],'nonce':_0x1256c8[_0xe436('0x6e')]},'options':{'algorithm':_0xe436('0x8b'),'subject':_0x1256c8['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xe436('0x51')]()}};return signJwt(_0x5ea824)[_0xe436('0x48')](function(_0x930472){return{'iat':_0x1256c8[_0xe436('0x6c')],'nonce':_0x1256c8[_0xe436('0x6e')],'token':_0x930472};});} \ No newline at end of file +var _0xc1d5=['blockDuration','isEqual','apiKeyNonce','nonce','disabled','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','canUpdate','getLicense','update','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','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','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','userpic','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','params','closed','disposition','then','query','forceDownload','status','json','unmanaged','Unmanaged.','Forbidden.','use','authorization','startsWith','Basic','User','find','catch','Unknown\x20authorization\x20format','apikey','getUuid','sub','Setting','allowedLoginAttempts'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc1d5,0x146));var _0x5c1d=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xc1d5[_0x1d70db];return _0x3060c6;};'use strict';var db=require(_0x5c1d('0x0'))['db'];var config=require(_0x5c1d('0x1'));var hardwareConf=require(_0x5c1d('0x2'));var licenseUtil=require(_0x5c1d('0x3'));var encryptor=require('../encryptor');var _=require(_0x5c1d('0x4'));var jwt=require(_0x5c1d('0x5'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x5c1d('0x6'));var crypto=require(_0x5c1d('0x7'));var BPromise=require(_0x5c1d('0x8'));var util=require(_0x5c1d('0x9'));var moment=require(_0x5c1d('0xa'));var validateJwt=expressJwt({'secret':config[_0x5c1d('0xb')][_0x5c1d('0xc')]});var userAttributes=['id',_0x5c1d('0xd'),_0x5c1d('0xe'),_0x5c1d('0xf'),_0x5c1d('0x10'),'email',_0x5c1d('0x11'),'permissions','md5secret',_0x5c1d('0x12'),_0x5c1d('0x13'),_0x5c1d('0x14'),_0x5c1d('0x15'),'smsPause',_0x5c1d('0x16'),_0x5c1d('0x17'),_0x5c1d('0x18'),_0x5c1d('0x19'),_0x5c1d('0x1a'),_0x5c1d('0x1b'),'allowmessenger',_0x5c1d('0x1c'),_0x5c1d('0x1d'),_0x5c1d('0x1e'),_0x5c1d('0x1f'),_0x5c1d('0x20'),_0x5c1d('0x21'),_0x5c1d('0x22'),_0x5c1d('0x23'),_0x5c1d('0x24'),_0x5c1d('0x25'),_0x5c1d('0x26'),_0x5c1d('0x27'),'hotdesk',_0x5c1d('0x28'),_0x5c1d('0x29'),_0x5c1d('0x2a'),_0x5c1d('0x2b'),_0x5c1d('0x2c'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x5c1d('0x2d'),'ignorePauseForPreviewCalls',_0x5c1d('0x2e'),_0x5c1d('0x2f'),_0x5c1d('0x30'),'emailAutoanswer',_0x5c1d('0x31'),_0x5c1d('0x32'),_0x5c1d('0x33'),_0x5c1d('0x34'),'openchannelAutoanswerDelay',_0x5c1d('0x35'),_0x5c1d('0x36'),_0x5c1d('0x37'),_0x5c1d('0x38'),'messengerSoundNotification'];exports[_0x5c1d('0x39')]=function(){return this[_0x5c1d('0x3a')](!![])['use'](function(_0x157431,_0x1c474f,_0x4aae96){if(_0x157431[_0x5c1d('0x3b')]){_0x4aae96();}else{return db[_0x5c1d('0x3c')]['findOne']({'where':{'id':_0x157431[_0x5c1d('0x3d')]['id']},'attributes':['id',_0x5c1d('0x3e'),_0x5c1d('0x3f')],'raw':!![]})[_0x5c1d('0x40')](function(_0x400b33){if(_0x400b33&&_0x400b33['closed']&&!_0x157431[_0x5c1d('0x41')][_0x5c1d('0x42')]){return _0x1c474f[_0x5c1d('0x43')](_0x400b33[_0x5c1d('0x3f')]==='unmanaged'?0x195:0x193)[_0x5c1d('0x44')]({'message':_0x400b33[_0x5c1d('0x3f')]===_0x5c1d('0x45')?_0x5c1d('0x46'):_0x5c1d('0x47')});}else{_0x4aae96();}})['catch'](function(_0x426403){_0x4aae96(_0x426403);});}});};exports[_0x5c1d('0x3a')]=function isAuthenticated(_0x142b40){return compose()[_0x5c1d('0x48')](function(_0x1e6d97,_0x50de27,_0x5540e2){var _0x593d2e;if(_0x1e6d97['headers'][_0x5c1d('0x49')]){if(_[_0x5c1d('0x4a')](_0x1e6d97['headers'][_0x5c1d('0x49')],_0x5c1d('0x4b'))){var _0x49c645=basicAuth(_0x1e6d97);db[_0x5c1d('0x4c')][_0x5c1d('0x4d')]({'where':{'name':_0x49c645[_0x5c1d('0xf')]}})[_0x5c1d('0x40')](function(_0x1b85be){if(!_0x1b85be||!_0x1b85be['authenticate'](_0x49c645['pass'])){return _0x50de27['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x1e6d97['user']={'id':_0x1b85be['id']};_0x5540e2();})[_0x5c1d('0x4e')](function(_0x5bb087){_0x5540e2(_0x5bb087);});}else if(_[_0x5c1d('0x4a')](_0x1e6d97['headers'][_0x5c1d('0x49')],'Bearer')){validateJwt(_0x1e6d97,_0x50de27,_0x5540e2);}else{if(_0x142b40){_0x5540e2();}else{return _0x50de27[_0x5c1d('0x43')](0x193)[_0x5c1d('0x44')]({'message':_0x5c1d('0x4f')});}}}else if(_0x1e6d97[_0x5c1d('0x41')][_0x5c1d('0x50')]){try{var _0x117221={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5c1d('0x51')]()};verifyJwt(_0x1e6d97[_0x5c1d('0x41')]['apikey'],_0x117221)['then'](function(_0x29e36c){return db['User'][_0x5c1d('0x4d')]({'where':{'id':_0x29e36c[_0x5c1d('0x52')]}})['then'](function(_0x24d008){_0x593d2e=_0x24d008;return db[_0x5c1d('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x5c1d('0x54'),_0x5c1d('0x55')],'raw':!![]});})[_0x5c1d('0x40')](function(_0x54c524){if(!_0x593d2e||!_[_0x5c1d('0x56')](_0x593d2e[_0x5c1d('0x57')],_0x29e36c[_0x5c1d('0x58')])){return _0x50de27[_0x5c1d('0x43')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x593d2e[_0x5c1d('0x59')]){return _0x50de27[_0x5c1d('0x43')](0x191)[_0x5c1d('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x593d2e['blocked']){if(_0x54c524[_0x5c1d('0x55')]>0x0){if(moment(_0x593d2e[_0x5c1d('0x5a')])[_0x5c1d('0x5b')](_0x54c524[_0x5c1d('0x55')],_0x5c1d('0x5c'))>moment()){return _0x50de27[_0x5c1d('0x43')](0x191)[_0x5c1d('0x44')]({'message':_0x5c1d('0x5d')});}}else{return _0x50de27[_0x5c1d('0x43')](0x191)[_0x5c1d('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1e6d97['user']={'id':_0x593d2e['id']};_0x5540e2();});})[_0x5c1d('0x4e')](function(){return _0x50de27[_0x5c1d('0x43')](0x191)['json']({'message':_0x5c1d('0x5d')});});}catch(_0x3bd1d7){_0x5540e2(_0x3bd1d7);}}else if(_0x142b40){_0x5540e2();}else{return _0x50de27[_0x5c1d('0x43')](0x193)[_0x5c1d('0x44')]({'message':_0x5c1d('0x4f')});}})[_0x5c1d('0x48')](function(_0x1362f1,_0x4f97d9,_0x45ecc1){if(_0x1362f1[_0x5c1d('0x3b')]){db[_0x5c1d('0x4c')][_0x5c1d('0x4d')]({'where':{'id':_0x1362f1[_0x5c1d('0x3b')]['id']},'attributes':userAttributes})[_0x5c1d('0x40')](function(_0x50ed63){if(!_0x50ed63){return _0x4f97d9['status'](0x194)[_0x5c1d('0x44')]({'message':'User\x20not\x20found.'});}_0x1362f1[_0x5c1d('0x3b')]=_0x50ed63;_0x45ecc1();})[_0x5c1d('0x4e')](function(_0x179e0e){_0x45ecc1(_0x179e0e);});}else if(_0x142b40){_0x45ecc1();}else{return _0x4f97d9[_0x5c1d('0x43')](0x194)[_0x5c1d('0x44')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x5c1d('0x5e')]=function canUpdate(){return compose()[_0x5c1d('0x48')](function(_0x3d4790,_0x1e8c46,_0x4974ba){return licenseUtil[_0x5c1d('0x5f')]()[_0x5c1d('0x40')](function(_0x2b9c2c){if(_0x2b9c2c[_0x5c1d('0x60')]){_0x4974ba();}else{return _0x1e8c46[_0x5c1d('0x43')](0x193)[_0x5c1d('0x44')]({'message':'Forbidden'});}})[_0x5c1d('0x4e')](function(_0x52a463){_0x4974ba(_0x52a463);});});};exports[_0x5c1d('0x61')]=function isWebrtcLicence(){return compose()[_0x5c1d('0x48')](function(_0x49c6fe,_0x4ca9d7,_0x242f05){return licenseUtil[_0x5c1d('0x5f')]()[_0x5c1d('0x40')](function(_0x5b44b9){if(_0x5b44b9['webrtc']){_0x242f05();}else{return _0x4ca9d7[_0x5c1d('0x43')](0x193)[_0x5c1d('0x44')]({'message':'Forbidden'});}})[_0x5c1d('0x4e')](function(_0x336f2a){_0x242f05(_0x336f2a);});});};exports['isMiddleware']=function(_0x32995f,_0xd6b319,_0xeed2c){_0x32995f[_0x5c1d('0x62')]=!![];return _0xeed2c();};exports[_0x5c1d('0x63')]=function signToken(_0x1dfc8f){return signJwt(_0x1dfc8f);};exports[_0x5c1d('0x64')]=function(_0x148ba4,_0x28720a){if(!_0x148ba4[_0x5c1d('0x3b')]){return _0x28720a[_0x5c1d('0x43')](0x194)[_0x5c1d('0x44')]({'message':_0x5c1d('0x65')});}var _0x3d855a={'payload':{'id':_0x148ba4[_0x5c1d('0x3b')]['id'],'role':_0x148ba4[_0x5c1d('0x3b')][_0x5c1d('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3d855a)['then'](function(_0x4fb66f){_0x28720a['cookie'](_0x5c1d('0x66'),_0x4fb66f);_0x28720a[_0x5c1d('0x67')](_0x5c1d('0x68'));})[_0x5c1d('0x4e')](function(_0x5ecb5a){return _0x28720a[_0x5c1d('0x43')](0x1f4)[_0x5c1d('0x69')](_0x5ecb5a);});};exports[_0x5c1d('0x6a')]=function(_0x15633c){if(_[_0x5c1d('0x6b')](_0x15633c[_0x5c1d('0x57')])||_[_0x5c1d('0x6b')](_0x15633c[_0x5c1d('0x6c')])){return null;}else{return createJwt(_0x15633c);}};exports[_0x5c1d('0x6d')]=function(_0x211bca){_0x211bca['apiKeyNonce']=generateNonce();_0x211bca[_0x5c1d('0x6c')]=generateIssuedAt();return createJwt(_0x211bca);};exports[_0x5c1d('0x6e')]=function(_0x5f167b,_0x26bed2){var _0x1f549e=_0x5f167b[_0x5c1d('0x41')]['apikey'];if(_0x1f549e){var _0x15f0b9={'nonce':_0x26bed2[_0x5c1d('0x57')],'iat':_0x26bed2[_0x5c1d('0x6c')],'audience':hardwareConf[_0x5c1d('0x51')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x1f549e,_0x15f0b9)['then'](function(){return generateApiKey(_0x26bed2);});}else{throw{'message':_0x5c1d('0x6f')};}};exports[_0x5c1d('0x70')]=function(_0x655cd1){var _0xc43035=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xc43035['test'](_0x655cd1))throw new db[(_0x5c1d('0x71'))][(_0x5c1d('0x72'))](_0x5c1d('0x73'));return;};exports[_0x5c1d('0x74')]=function(_0x18a198,_0x172a0f,_0xa366f1){var _0x25ade0=encryptor[_0x5c1d('0x75')](_0x172a0f)['split'](',');for(var _0x5bdfa6=0x0;_0x5bdfa6<_0xa366f1;_0x5bdfa6++){if(!_0x25ade0[_0x5bdfa6])break;if(_0x18a198[_0x5c1d('0x76')]()===_0x25ade0[_0x5bdfa6][_0x5c1d('0x76')]()){var _0x545e79=util[_0x5c1d('0x77')](_0x5c1d('0x78'),_0xa366f1);if(_0xa366f1===0x1){_0x545e79='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x5c1d('0x71'))][(_0x5c1d('0x72'))](_0x545e79);}}return;};exports[_0x5c1d('0x79')]=function(_0xe65c1b,_0x163051){var _0x5ef8a2=_0x163051?encryptor[_0x5c1d('0x75')](_0x163051)[_0x5c1d('0x7a')](','):[];if(_0x5ef8a2[_0x5c1d('0x7b')]===0x5){_0x5ef8a2[_0x5c1d('0x7c')](-0x1,0x1);}_0x5ef8a2['unshift'](_0xe65c1b);return encryptor['encryptString'](_0x5ef8a2[_0x5c1d('0x7d')](','));};function signJwt(_0x1ee896){var _0x106bf8=BPromise['promisify'](jwt[_0x5c1d('0x7e')],{'context':jwt});var _0x36231f=_0x1ee896[_0x5c1d('0x7f')]||config['secrets'][_0x5c1d('0xc')];return new BPromise(function(_0x525a7d,_0x1a2f97){_0x106bf8(_0x1ee896[_0x5c1d('0x80')],_0x36231f,_0x1ee896[_0x5c1d('0x81')])[_0x5c1d('0x40')](function(_0x15405e){_0x525a7d(_0x15405e);})[_0x5c1d('0x4e')](function(_0x23b810){_0x1a2f97(_0x23b810);});});}function verifyJwt(_0x53de5e,_0x1b078f,_0x528427){var _0xae4213=BPromise[_0x5c1d('0x82')](jwt[_0x5c1d('0x83')],{'context':jwt});var _0x498668=_0x528427||config[_0x5c1d('0xb')]['session'];return new BPromise(function(_0x457e45,_0x451939){_0xae4213(_0x53de5e,_0x498668,_0x1b078f)[_0x5c1d('0x40')](function(_0x2f3fd7){_0x457e45(_0x2f3fd7);})[_0x5c1d('0x4e')](function(_0x14aea9){_0x451939(_0x14aea9);});});}function generateNonce(){return crypto[_0x5c1d('0x84')](0x10)[_0x5c1d('0x85')](_0x5c1d('0x86'));}function generateIssuedAt(){return Math[_0x5c1d('0x87')](Date[_0x5c1d('0x88')]()/0x3e8)[_0x5c1d('0x85')]();}function createJwt(_0x2e4f20){var _0x41af97={'payload':{'iat':_0x2e4f20[_0x5c1d('0x6c')],'nonce':_0x2e4f20[_0x5c1d('0x57')]},'options':{'algorithm':'HS512','subject':_0x2e4f20['id'][_0x5c1d('0x85')](),'issuer':hardwareConf[_0x5c1d('0x51')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x41af97)[_0x5c1d('0x40')](function(_0x5d01ed){return{'iat':_0x2e4f20[_0x5c1d('0x6c')],'nonce':_0x2e4f20[_0x5c1d('0x57')],'token':_0x5d01ed};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index e51e187..9909739 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 _0x5b0b=['tags','checkListsRestrictions','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','catch','describe','CmContact','keys','startsWith','map','CmCustomField','slice','all','cf_','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','user','clause'];(function(_0x40da94,_0x3404d3){var _0x2ffb89=function(_0x4b6114){while(--_0x4b6114){_0x40da94['push'](_0x40da94['shift']());}};_0x2ffb89(++_0x3404d3);}(_0x5b0b,0x7c));var _0xb5b0=function(_0x5e2e6f,_0x202e7a){_0x5e2e6f=_0x5e2e6f-0x0;var _0x1aa91e=_0x5b0b[_0x5e2e6f];return _0x1aa91e;};'use strict';var _=require(_0xb5b0('0x0'));var sqlUtils=require(_0xb5b0('0x1'));var db=require(_0xb5b0('0x2'))['db'];exports['findAll']=function(_0x59c560,_0x6b66c2,_0x52d401,_0x43bf89){var _0x331fa3={'count':0x0,'rows':[]};var _0x4d546f=sqlUtils[_0xb5b0('0x3')](_0x6b66c2,_0x59c560);if(_0x4d546f){return Promise[_0xb5b0('0x4')](_0x331fa3);}var _0x4ba05e=sqlUtils[_0xb5b0('0x5')]();var _0x23283d={};var _0x56e306=![];var _0xb1170b=![];return Promise[_0xb5b0('0x4')]()[_0xb5b0('0x6')](function(){if(_0x59c560['search']){return sqlUtils[_0xb5b0('0x7')](_0x59c560[_0xb5b0('0x8')],_0x43bf89);}else{return sqlUtils[_0xb5b0('0x9')](_0x59c560,_0x43bf89);}})[_0xb5b0('0x6')](function(_0x3e076b){_0x4ba05e[_0xb5b0('0xa')](_0x3e076b[_0xb5b0('0xb')]);_0x4ba05e[_0xb5b0('0xa')](_0x3e076b[_0xb5b0('0xc')]);_0x4ba05e['where'](_0x3e076b[_0xb5b0('0xd')]);_0x4ba05e[_0xb5b0('0xa')](_0x3e076b[_0xb5b0('0xe')][_0xb5b0('0xf')]);_0x23283d=_0x3e076b[_0xb5b0('0x10')];_0xb1170b=_0x3e076b[_0xb5b0('0xe')]['skip'];return sqlUtils[_0xb5b0('0x11')](_0x6b66c2,_0x59c560,_0xb1170b);})[_0xb5b0('0x6')](function(_0x1f32a8){_0x4ba05e[_0xb5b0('0xa')](_0x1f32a8);var _0x400fac=_0x59c560[_0xb5b0('0x8')]?_0x23283d['ids']:_0x59c560[_0xb5b0('0x12')];_0x56e306=_0x400fac?!![]:![];return sqlUtils[_0xb5b0('0x13')](_0x4ba05e,_0x400fac);})['then'](function(_0x3686e7){_0x331fa3[_0xb5b0('0x14')]=_0x3686e7;if(_0x331fa3[_0xb5b0('0x14')]===0x0){return;}if(_0x59c560[_0xb5b0('0x15')]){_0xb1170b=!![];}return sqlUtils[_0xb5b0('0x16')](_0x4ba05e,_0x59c560['fields'],_0x52d401,_0x56e306,_0x23283d[_0xb5b0('0xf')],_0xb1170b);})[_0xb5b0('0x6')](function(_0x3f4fa6){if(!_0x3f4fa6){return[];}return sqlUtils[_0xb5b0('0x17')](_0x3f4fa6,_0x59c560,_0x52d401);})[_0xb5b0('0x6')](function(_0x1cec74){_0x331fa3['rows']=_0x1cec74;return _0x331fa3;})[_0xb5b0('0x18')](function(_0x234ea0){throw _0x234ea0;});};exports[_0xb5b0('0x19')]=function(){var _0x194d12={};var _0x395ea6=[];return db[_0xb5b0('0x1a')][_0xb5b0('0x19')]()[_0xb5b0('0x6')](function(_0x39f01c){_0x194d12=_0x39f01c;var _0x4d10ca=Object[_0xb5b0('0x1b')](_0x194d12)['filter'](function(_0x2509fe){return _[_0xb5b0('0x1c')](_0x2509fe,'cf_')?_0x2509fe:undefined;});var _0x4adf96=_0x4d10ca[_0xb5b0('0x1d')](function(_0x39bced){return db[_0xb5b0('0x1e')]['findOne']({'where':{'id':_0x39bced[_0xb5b0('0x1f')](0x3)},'raw':!![]});});return Promise[_0xb5b0('0x20')](_0x4adf96);})[_0xb5b0('0x6')](function(_0xe1d052){for(var _0x37ce64=0x0;_0x37ce64<_0xe1d052['length'];_0x37ce64++){if(_0xe1d052[_0x37ce64]){var _0x4f8026=_0xb5b0('0x21')+_0xe1d052[_0x37ce64]['id'];_0x194d12[_0x4f8026]['fieldType']=_0xe1d052[_0x37ce64][_0xb5b0('0x22')];}}_0x395ea6=_[_0xb5b0('0x1d')](Object['keys'](_0x194d12),function(_0x48e0f3){return{'name':_0x48e0f3,'type':_0x194d12[_0x48e0f3]['type']};});return _0x395ea6;})[_0xb5b0('0x18')](function(_0x47646b){throw _0x47646b;});}; \ No newline at end of file +var _0x8153=['count','User','rows','catch','describe','CmContact','keys','startsWith','map','CmCustomField','findOne','slice','all','length','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','then','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter','clause','tags','user','skip','checkListsRestrictions','search','tag','countFilteredContacts'];(function(_0xc7eafd,_0x551802){var _0x3444bb=function(_0x2ea4e2){while(--_0x2ea4e2){_0xc7eafd['push'](_0xc7eafd['shift']());}};_0x3444bb(++_0x551802);}(_0x8153,0x9b));var _0x3815=function(_0x3d2db3,_0x5c1785){_0x3d2db3=_0x3d2db3-0x0;var _0x342149=_0x8153[_0x3d2db3];return _0x342149;};'use strict';var _=require(_0x3815('0x0'));var sqlUtils=require(_0x3815('0x1'));var db=require(_0x3815('0x2'))['db'];exports['findAll']=function(_0x26f029,_0x45017a,_0x3ecbca,_0x3af5ad){var _0x1625e6={'count':0x0,'rows':[]};var _0x42881f=sqlUtils[_0x3815('0x3')](_0x45017a,_0x26f029);if(_0x42881f){return Promise[_0x3815('0x4')](_0x1625e6);}var _0x150a30=sqlUtils['getContactsSubquery']();var _0x12abde={};var _0x1b8309=![];var _0x5b4439=![];return Promise['resolve']()[_0x3815('0x5')](function(){if(_0x26f029['search']){return sqlUtils[_0x3815('0x6')](_0x26f029['search'],_0x3af5ad);}else{return sqlUtils[_0x3815('0x7')](_0x26f029,_0x3af5ad);}})['then'](function(_0x174d70){_0x150a30['where'](_0x174d70[_0x3815('0x8')]);_0x150a30[_0x3815('0x9')](_0x174d70[_0x3815('0xa')]);_0x150a30['where'](_0x174d70[_0x3815('0xb')]);_0x150a30[_0x3815('0x9')](_0x174d70['user'][_0x3815('0xc')]);_0x12abde=_0x174d70[_0x3815('0xd')];_0x5b4439=_0x174d70[_0x3815('0xe')][_0x3815('0xf')];return sqlUtils[_0x3815('0x10')](_0x45017a,_0x26f029,_0x5b4439);})[_0x3815('0x5')](function(_0x7ec5aa){_0x150a30[_0x3815('0x9')](_0x7ec5aa);var _0x56ef4d=_0x26f029[_0x3815('0x11')]?_0x12abde['ids']:_0x26f029[_0x3815('0x12')];_0x1b8309=_0x56ef4d?!![]:![];return sqlUtils[_0x3815('0x13')](_0x150a30,_0x56ef4d);})['then'](function(_0x540d5a){_0x1625e6['count']=_0x540d5a;if(_0x1625e6[_0x3815('0x14')]===0x0){return;}if(_0x26f029[_0x3815('0x15')]){_0x5b4439=!![];}return sqlUtils['buildContactsQuery'](_0x150a30,_0x26f029[_0x3815('0xa')],_0x3ecbca,_0x1b8309,_0x12abde[_0x3815('0xc')],_0x5b4439);})[_0x3815('0x5')](function(_0x5e433f){if(!_0x5e433f){return[];}return sqlUtils['getFilteredContacts'](_0x5e433f,_0x26f029,_0x3ecbca);})['then'](function(_0x5bd730){_0x1625e6[_0x3815('0x16')]=_0x5bd730;return _0x1625e6;})[_0x3815('0x17')](function(_0x224232){throw _0x224232;});};exports[_0x3815('0x18')]=function(){var _0x358a81={};var _0x2603cc=[];return db[_0x3815('0x19')][_0x3815('0x18')]()[_0x3815('0x5')](function(_0xb54095){_0x358a81=_0xb54095;var _0x4caef4=Object[_0x3815('0x1a')](_0x358a81)['filter'](function(_0x24706f){return _[_0x3815('0x1b')](_0x24706f,'cf_')?_0x24706f:undefined;});var _0x1a719b=_0x4caef4[_0x3815('0x1c')](function(_0x4c622c){return db[_0x3815('0x1d')][_0x3815('0x1e')]({'where':{'id':_0x4c622c[_0x3815('0x1f')](0x3)},'raw':!![]});});return Promise[_0x3815('0x20')](_0x1a719b);})[_0x3815('0x5')](function(_0x1714c4){for(var _0xfda2bf=0x0;_0xfda2bf<_0x1714c4[_0x3815('0x21')];_0xfda2bf++){if(_0x1714c4[_0xfda2bf]){var _0x1dc313='cf_'+_0x1714c4[_0xfda2bf]['id'];_0x358a81[_0x1dc313]['fieldType']=_0x1714c4[_0xfda2bf][_0x3815('0x22')];}}_0x2603cc=_[_0x3815('0x1c')](Object['keys'](_0x358a81),function(_0xce1613){return{'name':_0xce1613,'type':_0x358a81[_0xce1613][_0x3815('0x22')]};});return _0x2603cc;})[_0x3815('0x17')](function(_0x21a051){throw _0x21a051;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 516e81e..ff3da4c 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 _0x6845=['c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','datetime','castTo','DATE','buildExpression','default','text','value','end','Tag','map','tags','clause','and','ids','user','skip','some','compact','Contact','User','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','filter','search','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','from','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','isEmpty','where','t.id\x20IN\x20?','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','ListId','true','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','t.id\x20=\x20ct.TagId','firstName','lastName','phone','fax','email','CompanyId','createdAt','deletedAt','includes','push','forEach','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.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?'];(function(_0x112b42,_0x17973a){var _0x767e9a=function(_0x450fdd){while(--_0x450fdd){_0x112b42['push'](_0x112b42['shift']());}};_0x767e9a(++_0x17973a);}(_0x6845,0x1e5));var _0x5684=function(_0x335a57,_0x3476f4){_0x335a57=_0x335a57-0x0;var _0x4c420e=_0x6845[_0x335a57];return _0x4c420e;};'use strict';var _=require(_0x5684('0x0'));var squel=require(_0x5684('0x1'));var as=require(_0x5684('0x2'));var qs=require(_0x5684('0x3'));var utils=require(_0x5684('0x4'));var db=require(_0x5684('0x5'))['db'];function skipContactsQuery(_0x55ecdf,_0x2e727a){var _0x290e69=![];if(_0x55ecdf[_0x5684('0x6')]===_0x5684('0x7')&&!_0x2e727a['search']&&!_0x2e727a[_0x5684('0x8')]&&_0x2e727a['autocomplete']!==_0x5684('0x9')){_0x290e69=!![];}return _0x290e69;}function getContactsSubquery(){return squel['select']()['from']('cm_contacts','c')['where'](_0x5684('0xa'));}function applyJoinClauses(_0x2ffa3f,_0x44f295){var _0x2222b8=_0x44f295?'c':_0x5684('0xb');_0x2ffa3f[_0x5684('0xc')](_0x5684('0xd'),'uc',_0x5684('0xe')+_0x2222b8+'.id')['left_join']('cm_contact_has_tags','ct','ct.CmContactId\x20=\x20'+_0x2222b8+_0x5684('0xf'))[_0x5684('0xc')]('tools_tags','t',_0x5684('0x10'));return _0x2ffa3f;}function addFieldsToQuery(_0x399db0,_0x3efeb9,_0x484329,_0x41ee94,_0x2a59ea){var _0xd3112c=_0x2a59ea?'c':_0x5684('0xb');if(!_0x3efeb9){_0x3efeb9=['id',_0x5684('0x11'),_0x5684('0x12'),_0x5684('0x13'),'mobile',_0x5684('0x14'),_0x5684('0x15'),_0x5684('0x8'),_0x5684('0x16'),_0x5684('0x17'),'updatedAt',_0x5684('0x18'),'TagIds'];}else if(!_0x3efeb9[_0x5684('0x19')]('id')){_0x3efeb9[_0x5684('0x1a')]('id');}var _0xdb3b23=_0x484329&&_0x2a59ea||!_0x484329&&!_0x2a59ea;if(_0x41ee94){_0xdb3b23=_0x41ee94&&_0x2a59ea||!_0x41ee94&&!_0x2a59ea;}_0x3efeb9[_0x5684('0x1b')](function(_0x33815a){if(_0x33815a===_0x5684('0x1c')){if(_0xdb3b23){_0x399db0[_0x5684('0x1d')](_0x5684('0x1e'),_0x33815a);}else if(_0x484329||_0x41ee94){_0x399db0[_0x5684('0x1d')](_0xd3112c+'.'+_0x33815a);}}else{_0x399db0[_0x5684('0x1d')](_0xd3112c+'.'+_0x33815a);}});return _0x399db0;}function getSqlClauses(){var _0x1fef13={'default':squel[_0x5684('0x1f')](),'fields':squel['expr'](),'filter':squel[_0x5684('0x1f')](),'tags':{'clause':squel[_0x5684('0x1f')](),'ids':null},'user':{'clause':squel[_0x5684('0x1f')](),'skip':![]}};return _0x1fef13;}function parseTagParameter(_0x545f07){var _0x111601=squel[_0x5684('0x1f')]();if(_0x545f07){var _0x44f9af=utils[_0x5684('0x20')](_0x545f07);_0x44f9af[_0x5684('0x1b')](function(_0x35ab8e){_0x111601['or'](_0x5684('0x21'),'%,'+_0x35ab8e+',%');});}return _0x111601;}function parseSearchFilter(_0x33e15b){var _0x1f075d=squel['expr']();if(_0x33e15b){var _0xa33c85=_0x33e15b['replace']('\x5c','\x5c\x5c')[_0x5684('0x22')](/'/g,'\x27\x27');if(_0xa33c85[_0x5684('0x23')]('\x20')[_0x5684('0x24')]>0x1){_0x1f075d['or'](_0x5684('0x25'),qs[_0x5684('0x26')](_0xa33c85,!![]),null);}else{if(qs[_0x5684('0x27')](_0xa33c85)){_0x1f075d['or'](_0x5684('0x28'),_0xa33c85+'%');_0x1f075d['or'](_0x5684('0x29'),_0xa33c85+'%');_0x1f075d['or'](_0x5684('0x2a'),_0xa33c85+'%');_0x1f075d['or'](_0x5684('0x2b'),_0xa33c85+'%');}else if(qs['isEmail'](_0xa33c85)){_0x1f075d['or'](_0x5684('0x2c'),_0xa33c85+'%');}else{_0x1f075d['or'](_0x5684('0x2d'),'%'+_0xa33c85+'%');_0x1f075d['or'](_0x5684('0x2e'),'%'+_0xa33c85+'%');_0x1f075d['or']('c.email\x20LIKE\x20?','%'+_0xa33c85+'%');}}}return _0x1f075d;}function parseAdvancedSearchFilter(_0x36e0c9,_0x3e491c){var _0xa27326=getSqlClauses();var _0x38d6b7=as[_0x5684('0x2f')](_0x36e0c9);var _0x5330c1=_0x38d6b7['sqlOperator'];for(var _0x5d3dd2=0x0;_0x5d3dd2<_0x38d6b7['conditions'][_0x5684('0x24')];_0x5d3dd2++){var _0x207a75=_0x38d6b7[_0x5684('0x30')][_0x5d3dd2];var _0x19e67f='c';var _0xceceb9=_[_0x5684('0x31')](_0x3e491c,[_0x5684('0x32'),_0x207a75[_0x5684('0x1d')]]);if(_0xceceb9){if(_0x207a75['field']===_0x5684('0x33')||_0xceceb9['fieldType']===_0x5684('0x34')){_0x207a75[_0x5684('0x35')]=_0x5684('0x36');}var _0x3a38d0=as[_0x5684('0x37')](_0x19e67f,_0xceceb9['type'],_0x207a75);_0xa27326[_0x5684('0x38')][_0x5330c1](_0x3a38d0[_0x5684('0x39')],_0x3a38d0[_0x5684('0x3a')]['start'],_0x3a38d0[_0x5684('0x3a')][_0x5684('0x3b')]);}else{if(_0x207a75[_0x5684('0x1d')]===_0x5684('0x3c')){var _0x5c7bee=_0x207a75['value'][_0x5684('0x23')](',')[_0x5684('0x3d')](function(_0x1a2c19){return Number(_0x1a2c19);});var _0x23e2f6=parseTagParameter(_0x5c7bee);_0xa27326[_0x5684('0x3e')][_0x5684('0x3f')][_0x5684('0x40')](_0x23e2f6);_0xa27326['tags'][_0x5684('0x41')]=_0x5c7bee;}else if(_0x207a75[_0x5684('0x1d')]==='User'){_0xa27326[_0x5684('0x42')][_0x5684('0x3f')]['and']('uc.UserId\x20=\x20?',_0x207a75[_0x5684('0x3a')]);_0xa27326[_0x5684('0x42')][_0x5684('0x43')]=!![];}}}return _0xa27326;}function parseModelFields(_0x3c1134,_0x32c473){var _0x1b7d4e=squel[_0x5684('0x1f')]();var _0x10ecda=_(_0x3c1134)['keys']()['map'](function(_0x3088a0){return _[_0x5684('0x44')](_0x32c473,[_0x5684('0x32'),_0x3088a0])?_0x3088a0:undefined;})[_0x5684('0x45')]()[_0x5684('0x3a')]();if(_0x3c1134[_0x5684('0x46')]){_0x10ecda[_0x5684('0x1a')](_0x5684('0x46'));}if(_0x3c1134[_0x5684('0x47')]){_0x10ecda['push'](_0x5684('0x47'));}if(_0x10ecda['length']>0x0){_0x10ecda[_0x5684('0x1b')](function(_0x414e15){if(_0x414e15===_0x5684('0x8')){_0x1b7d4e['and'](_0x5684('0x48'),[]['concat'](_0x3c1134[_0x414e15]));}else if(_0x414e15==='Contact'){var _0x36c169='%'+_0x3c1134[_0x414e15]+'%';_0x1b7d4e[_0x5684('0x40')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x36c169);}else if(_0x414e15===_0x5684('0x47')){_0x1b7d4e[_0x5684('0x40')]('uc.UserId\x20=\x20?',_0x3c1134[_0x414e15]);}else{_0x1b7d4e[_0x5684('0x40')]('c.'+_0x414e15+_0x5684('0x49'),_0x3c1134[_0x414e15]);}});}return _0x1b7d4e;}function parseQueryParameters(_0x593d12,_0x37fbc8){var _0xca0f9c=getSqlClauses();return Promise[_0x5684('0x4a')]()[_0x5684('0x4b')](function(){return parseModelFields(_0x593d12,_0x37fbc8);})[_0x5684('0x4b')](function(_0x298c84){_0xca0f9c['fields'][_0x5684('0x40')](_0x298c84);return parseTagParameter(_0x593d12['tag']);})['then'](function(_0x2544ce){_0xca0f9c[_0x5684('0x3e')][_0x5684('0x3f')]['and'](_0x2544ce);return parseSearchFilter(_0x593d12[_0x5684('0x4c')]);})['then'](function(_0xe5699a){_0xca0f9c['filter']=_0xe5699a;return _0xca0f9c;});}function checkListsRestrictions(_0x5a2c7c,_0x1f1451,_0x50faa2){var _0x4e814f=squel[_0x5684('0x1f')]();return Promise[_0x5684('0x4a')]()[_0x5684('0x4b')](function(){if(_0x1f1451[_0x5684('0x4d')]&&_0x5a2c7c['role']===_0x5684('0x7')&&!_0x50faa2){return _0x5a2c7c[_0x5684('0x4e')]({'attributes':['id'],'raw':!![]});}})[_0x5684('0x4b')](function(_0x5c1d65){if(_0x5c1d65){if(_0x5c1d65[_0x5684('0x24')]===0x0){_0x4e814f[_0x5684('0x40')](_0x5684('0x4f'));}else{_0x4e814f['and'](_0x5684('0x48'),_['map'](_0x5c1d65,'id'));}}})[_0x5684('0x4b')](function(){return _0x4e814f;});}function buildContactsQuery(_0xff4596,_0x3f2c1c,_0x37d49e,_0x2e44c1,_0x3f1849,_0x422b91){if(_0x3f2c1c){_0x3f2c1c=_0x37d49e[_0x5684('0x50')];}_0xff4596=addFieldsToQuery(_0xff4596,_0x3f2c1c,_0x2e44c1,_0x422b91,!![]);var _0x2b6f29=squel['select']();_0x2b6f29=addFieldsToQuery(_0x2b6f29,_0x3f2c1c,_0x2e44c1,_0x422b91,![]);if(_0x2e44c1||_0x422b91){_0xff4596=applyJoinClauses(_0xff4596,!![]);_0xff4596[_0x5684('0x51')](_0x5684('0x52'));if(_0x37d49e['limit']){_0x2b6f29[_0x5684('0x53')](_0x37d49e[_0x5684('0x53')]);}if(_0x37d49e[_0x5684('0x54')]){_0x2b6f29['offset'](_0x37d49e[_0x5684('0x54')]);}}else{_0x2b6f29=applyJoinClauses(_0x2b6f29,![]);_0x2b6f29[_0x5684('0x51')](_0x5684('0x55'));if(_0x37d49e[_0x5684('0x53')]){_0xff4596['limit'](_0x37d49e['limit']);}if(_0x37d49e[_0x5684('0x54')]){_0xff4596[_0x5684('0x54')](_0x37d49e[_0x5684('0x54')]);}}_0x2b6f29[_0x5684('0x56')](_0x3f1849);if(_0x37d49e[_0x5684('0x57')]){_0x37d49e[_0x5684('0x57')][_0x5684('0x1b')](function(_0x2a81a5){_0xff4596[_0x5684('0x57')]('c.'+_0x2a81a5[0x0],_0x2a81a5[0x1]==='DESC'?![]:!![]);_0x2b6f29[_0x5684('0x57')]('subqry.'+_0x2a81a5[0x0],_0x2a81a5[0x1]==='DESC'?![]:!![]);});}_0x2b6f29[_0x5684('0x58')](_0xff4596,_0x5684('0xb'));return _0x2b6f29;}function getFilteredContacts(_0x83b6b5){var _0x3f38f9=[];return db[_0x5684('0x3c')][_0x5684('0x59')]({'attributes':['id','name',_0x5684('0x5a')],'raw':!![]})['then'](function(_0xaab470){_0x3f38f9=_[_0x5684('0x5b')](_0xaab470,'id');var _0x5cabdd={'type':db[_0x5684('0x5c')][_0x5684('0x5d')][_0x5684('0x5e')],'model':db[_0x5684('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x5684('0x60')][_0x5684('0x61')](_0x83b6b5[_0x5684('0x62')](),_0x5cabdd);})['then'](function(_0x2b0315){_0x2b0315['forEach'](function(_0x5c2b1e){if(_0x5c2b1e['TagIds']){_0x5c2b1e[_0x5684('0x63')]=[];_0x5c2b1e[_0x5684('0x1c')]['split'](',')['forEach'](function(_0x936079){_0x5c2b1e[_0x5684('0x63')][_0x5684('0x1a')](_0x3f38f9[_0x936079]);});}delete _0x5c2b1e[_0x5684('0x1c')];});return _0x2b0315;});}function countFilteredContacts(_0x158854,_0x1ead06){var _0x3ec9d1=_0x158854[_0x5684('0x64')]();_0x3ec9d1[_0x5684('0x1d')]('COUNT(*)');_0x3ec9d1=applyJoinClauses(_0x3ec9d1,!![]);_0x158854[_0x5684('0x51')](_0x5684('0x52'));var _0xbc188a=utils[_0x5684('0x20')](_0x1ead06);if(!_[_0x5684('0x65')](_0xbc188a)){_0x3ec9d1[_0x5684('0x66')](_0x5684('0x67'),_0xbc188a);}var _0x2b4c58={'type':db['Sequelize']['QueryTypes'][_0x5684('0x5e')],'raw':!![]};return db[_0x5684('0x60')][_0x5684('0x61')](_0x3ec9d1[_0x5684('0x62')](),_0x2b4c58)[_0x5684('0x4b')](function(_0x17b1ea){return _0x17b1ea[0x0][_0x5684('0x68')];});}module[_0x5684('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xba29=['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.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','DATE','buildExpression','type','default','text','value','start','end','Tag','map','tags','clause','and','ids','User','user','skip','keys','some','compact','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','then','fields','resolve','search','getLists','attributes','group','c.id','limit','offset','order','DESC','from','findAll','color','Sequelize','CmContact','sequelize','query','toString','Tags','clone','isEmpty','t.id\x20IN\x20?','QueryTypes','SELECT','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../../mysqldb','role','agent','ListId','autocomplete','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','mobile','fax','CompanyId','createdAt','deletedAt','TagIds','includes','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field'];(function(_0x2b77ab,_0x1ebb5a){var _0x3499b0=function(_0x298bf8){while(--_0x298bf8){_0x2b77ab['push'](_0x2b77ab['shift']());}};_0x3499b0(++_0x1ebb5a);}(_0xba29,0x118));var _0x9ba2=function(_0x3d2ef4,_0x39ed4e){_0x3d2ef4=_0x3d2ef4-0x0;var _0x98028f=_0xba29[_0x3d2ef4];return _0x98028f;};'use strict';var _=require(_0x9ba2('0x0'));var squel=require(_0x9ba2('0x1'));var as=require(_0x9ba2('0x2'));var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0x9ba2('0x3'))['db'];function skipContactsQuery(_0x4ce81a,_0x3d28ff){var _0x1ebc21=![];if(_0x4ce81a[_0x9ba2('0x4')]===_0x9ba2('0x5')&&!_0x3d28ff['search']&&!_0x3d28ff[_0x9ba2('0x6')]&&_0x3d28ff[_0x9ba2('0x7')]!=='true'){_0x1ebc21=!![];}return _0x1ebc21;}function getContactsSubquery(){return squel[_0x9ba2('0x8')]()['from'](_0x9ba2('0x9'),'c')[_0x9ba2('0xa')](_0x9ba2('0xb'));}function applyJoinClauses(_0x19bee2,_0x54aa5d){var _0x599fe1=_0x54aa5d?'c':_0x9ba2('0xc');_0x19bee2[_0x9ba2('0xd')]('cm_user_has_contacts','uc',_0x9ba2('0xe')+_0x599fe1+'.id')[_0x9ba2('0xd')]('cm_contact_has_tags','ct',_0x9ba2('0xf')+_0x599fe1+_0x9ba2('0x10'))[_0x9ba2('0xd')](_0x9ba2('0x11'),'t',_0x9ba2('0x12'));return _0x19bee2;}function addFieldsToQuery(_0x401b96,_0x4ab41a,_0x5ae381,_0xf77599,_0x4265dc){var _0x4e967d=_0x4265dc?'c':'subqry';if(!_0x4ab41a){_0x4ab41a=['id','firstName','lastName','phone',_0x9ba2('0x13'),_0x9ba2('0x14'),'email',_0x9ba2('0x6'),_0x9ba2('0x15'),_0x9ba2('0x16'),'updatedAt',_0x9ba2('0x17'),_0x9ba2('0x18')];}else if(!_0x4ab41a[_0x9ba2('0x19')]('id')){_0x4ab41a['push']('id');}var _0x18d46d=_0x5ae381&&_0x4265dc||!_0x5ae381&&!_0x4265dc;if(_0xf77599){_0x18d46d=_0xf77599&&_0x4265dc||!_0xf77599&&!_0x4265dc;}_0x4ab41a[_0x9ba2('0x1a')](function(_0x4b2b6c){if(_0x4b2b6c==='TagIds'){if(_0x18d46d){_0x401b96['field'](_0x9ba2('0x1b'),_0x4b2b6c);}else if(_0x5ae381||_0xf77599){_0x401b96[_0x9ba2('0x1c')](_0x4e967d+'.'+_0x4b2b6c);}}else{_0x401b96[_0x9ba2('0x1c')](_0x4e967d+'.'+_0x4b2b6c);}});return _0x401b96;}function getSqlClauses(){var _0x5ba653={'default':squel[_0x9ba2('0x1d')](),'fields':squel['expr'](),'filter':squel[_0x9ba2('0x1d')](),'tags':{'clause':squel[_0x9ba2('0x1d')](),'ids':null},'user':{'clause':squel[_0x9ba2('0x1d')](),'skip':![]}};return _0x5ba653;}function parseTagParameter(_0xa60c2c){var _0x2e126e=squel[_0x9ba2('0x1d')]();if(_0xa60c2c){var _0x1303d1=utils[_0x9ba2('0x1e')](_0xa60c2c);_0x1303d1[_0x9ba2('0x1a')](function(_0x367021){_0x2e126e['or'](_0x9ba2('0x1f'),'%,'+_0x367021+',%');});}return _0x2e126e;}function parseSearchFilter(_0x27fd53){var _0x39d4a8=squel[_0x9ba2('0x1d')]();if(_0x27fd53){var _0x4a4cd7=_0x27fd53['replace']('\x5c','\x5c\x5c')[_0x9ba2('0x20')](/'/g,'\x27\x27');if(_0x4a4cd7[_0x9ba2('0x21')]('\x20')[_0x9ba2('0x22')]>0x1){_0x39d4a8['or'](_0x9ba2('0x23'),qs[_0x9ba2('0x24')](_0x4a4cd7,!![]),null);}else{if(qs[_0x9ba2('0x25')](_0x4a4cd7)){_0x39d4a8['or'](_0x9ba2('0x26'),_0x4a4cd7+'%');_0x39d4a8['or']('c.phone\x20LIKE\x20?',_0x4a4cd7+'%');_0x39d4a8['or'](_0x9ba2('0x27'),_0x4a4cd7+'%');_0x39d4a8['or'](_0x9ba2('0x28'),_0x4a4cd7+'%');}else if(qs['isEmail'](_0x4a4cd7)){_0x39d4a8['or']('c.email\x20LIKE\x20?',_0x4a4cd7+'%');}else{_0x39d4a8['or']('c.firstName\x20LIKE\x20?','%'+_0x4a4cd7+'%');_0x39d4a8['or'](_0x9ba2('0x29'),'%'+_0x4a4cd7+'%');_0x39d4a8['or']('c.email\x20LIKE\x20?','%'+_0x4a4cd7+'%');}}}return _0x39d4a8;}function parseAdvancedSearchFilter(_0x4e0378,_0x2d8a6c){var _0x5ec750=getSqlClauses();var _0x594004=as[_0x9ba2('0x2a')](_0x4e0378);var _0x4ddbd2=_0x594004[_0x9ba2('0x2b')];for(var _0x4f8b73=0x0;_0x4f8b73<_0x594004[_0x9ba2('0x2c')][_0x9ba2('0x22')];_0x4f8b73++){var _0x3a216a=_0x594004[_0x9ba2('0x2c')][_0x4f8b73];var _0x20dae4='c';var _0x3dbf30=_[_0x9ba2('0x2d')](_0x2d8a6c,[_0x9ba2('0x2e'),_0x3a216a['field']]);if(_0x3dbf30){if(_0x3a216a['field']===_0x9ba2('0x2f')||_0x3dbf30[_0x9ba2('0x30')]==='datetime'){_0x3a216a['castTo']=_0x9ba2('0x31');}var _0x56f01c=as[_0x9ba2('0x32')](_0x20dae4,_0x3dbf30[_0x9ba2('0x33')],_0x3a216a);_0x5ec750[_0x9ba2('0x34')][_0x4ddbd2](_0x56f01c[_0x9ba2('0x35')],_0x56f01c[_0x9ba2('0x36')][_0x9ba2('0x37')],_0x56f01c['value'][_0x9ba2('0x38')]);}else{if(_0x3a216a[_0x9ba2('0x1c')]===_0x9ba2('0x39')){var _0x5d8f5f=_0x3a216a[_0x9ba2('0x36')]['split'](',')[_0x9ba2('0x3a')](function(_0x1347a9){return Number(_0x1347a9);});var _0x2c144a=parseTagParameter(_0x5d8f5f);_0x5ec750[_0x9ba2('0x3b')][_0x9ba2('0x3c')][_0x9ba2('0x3d')](_0x2c144a);_0x5ec750[_0x9ba2('0x3b')][_0x9ba2('0x3e')]=_0x5d8f5f;}else if(_0x3a216a[_0x9ba2('0x1c')]===_0x9ba2('0x3f')){_0x5ec750[_0x9ba2('0x40')][_0x9ba2('0x3c')][_0x9ba2('0x3d')]('uc.UserId\x20=\x20?',_0x3a216a[_0x9ba2('0x36')]);_0x5ec750[_0x9ba2('0x40')][_0x9ba2('0x41')]=!![];}}}return _0x5ec750;}function parseModelFields(_0x429a67,_0x5b1a75){var _0xc18b7d=squel[_0x9ba2('0x1d')]();var _0x5c5966=_(_0x429a67)[_0x9ba2('0x42')]()[_0x9ba2('0x3a')](function(_0x1fae5e){return _[_0x9ba2('0x43')](_0x5b1a75,[_0x9ba2('0x2e'),_0x1fae5e])?_0x1fae5e:undefined;})[_0x9ba2('0x44')]()[_0x9ba2('0x36')]();if(_0x429a67[_0x9ba2('0x45')]){_0x5c5966['push'](_0x9ba2('0x45'));}if(_0x429a67[_0x9ba2('0x3f')]){_0x5c5966[_0x9ba2('0x46')](_0x9ba2('0x3f'));}if(_0x5c5966[_0x9ba2('0x22')]>0x0){_0x5c5966['forEach'](function(_0x43a025){if(_0x43a025===_0x9ba2('0x6')){_0xc18b7d[_0x9ba2('0x3d')](_0x9ba2('0x47'),[][_0x9ba2('0x48')](_0x429a67[_0x43a025]));}else if(_0x43a025===_0x9ba2('0x45')){var _0x4e1a5c='%'+_0x429a67[_0x43a025]+'%';_0xc18b7d['and'](_0x9ba2('0x49'),_0x4e1a5c);}else if(_0x43a025===_0x9ba2('0x3f')){_0xc18b7d[_0x9ba2('0x3d')](_0x9ba2('0x4a'),_0x429a67[_0x43a025]);}else{_0xc18b7d[_0x9ba2('0x3d')]('c.'+_0x43a025+'\x20=\x20?',_0x429a67[_0x43a025]);}});}return _0xc18b7d;}function parseQueryParameters(_0x3b4a9e,_0x195cbf){var _0x96cebd=getSqlClauses();return Promise['resolve']()[_0x9ba2('0x4b')](function(){return parseModelFields(_0x3b4a9e,_0x195cbf);})[_0x9ba2('0x4b')](function(_0x53475b){_0x96cebd[_0x9ba2('0x4c')][_0x9ba2('0x3d')](_0x53475b);return parseTagParameter(_0x3b4a9e['tag']);})[_0x9ba2('0x4b')](function(_0x581dcd){_0x96cebd[_0x9ba2('0x3b')][_0x9ba2('0x3c')][_0x9ba2('0x3d')](_0x581dcd);return parseSearchFilter(_0x3b4a9e['filter']);})[_0x9ba2('0x4b')](function(_0x530233){_0x96cebd['filter']=_0x530233;return _0x96cebd;});}function checkListsRestrictions(_0x5c8bf9,_0x5be0ae,_0x5dc17d){var _0x6913ac=squel[_0x9ba2('0x1d')]();return Promise[_0x9ba2('0x4d')]()[_0x9ba2('0x4b')](function(){if(_0x5be0ae[_0x9ba2('0x4e')]&&_0x5c8bf9[_0x9ba2('0x4')]===_0x9ba2('0x5')&&!_0x5dc17d){return _0x5c8bf9[_0x9ba2('0x4f')]({'attributes':['id'],'raw':!![]});}})[_0x9ba2('0x4b')](function(_0x3c112e){if(_0x3c112e){if(_0x3c112e['length']===0x0){_0x6913ac[_0x9ba2('0x3d')]('c.ListId\x20IS\x20NULL');}else{_0x6913ac[_0x9ba2('0x3d')]('c.ListId\x20IN\x20?',_[_0x9ba2('0x3a')](_0x3c112e,'id'));}}})[_0x9ba2('0x4b')](function(){return _0x6913ac;});}function buildContactsQuery(_0x3adb40,_0x1e65b2,_0x33a945,_0x424212,_0x40a113,_0x3980bf){if(_0x1e65b2){_0x1e65b2=_0x33a945[_0x9ba2('0x50')];}_0x3adb40=addFieldsToQuery(_0x3adb40,_0x1e65b2,_0x424212,_0x3980bf,!![]);var _0x2c12be=squel['select']();_0x2c12be=addFieldsToQuery(_0x2c12be,_0x1e65b2,_0x424212,_0x3980bf,![]);if(_0x424212||_0x3980bf){_0x3adb40=applyJoinClauses(_0x3adb40,!![]);_0x3adb40[_0x9ba2('0x51')](_0x9ba2('0x52'));if(_0x33a945[_0x9ba2('0x53')]){_0x2c12be['limit'](_0x33a945[_0x9ba2('0x53')]);}if(_0x33a945[_0x9ba2('0x54')]){_0x2c12be[_0x9ba2('0x54')](_0x33a945['offset']);}}else{_0x2c12be=applyJoinClauses(_0x2c12be,![]);_0x2c12be[_0x9ba2('0x51')]('subqry.id');if(_0x33a945[_0x9ba2('0x53')]){_0x3adb40[_0x9ba2('0x53')](_0x33a945[_0x9ba2('0x53')]);}if(_0x33a945[_0x9ba2('0x54')]){_0x3adb40[_0x9ba2('0x54')](_0x33a945[_0x9ba2('0x54')]);}}_0x2c12be['having'](_0x40a113);if(_0x33a945[_0x9ba2('0x55')]){_0x33a945['order'][_0x9ba2('0x1a')](function(_0x350cf4){_0x3adb40[_0x9ba2('0x55')]('c.'+_0x350cf4[0x0],_0x350cf4[0x1]===_0x9ba2('0x56')?![]:!![]);_0x2c12be['order']('subqry.'+_0x350cf4[0x0],_0x350cf4[0x1]===_0x9ba2('0x56')?![]:!![]);});}_0x2c12be[_0x9ba2('0x57')](_0x3adb40,'subqry');return _0x2c12be;}function getFilteredContacts(_0x117fc2){var _0x5ee258=[];return db[_0x9ba2('0x39')][_0x9ba2('0x58')]({'attributes':['id',_0x9ba2('0x2e'),_0x9ba2('0x59')],'raw':!![]})[_0x9ba2('0x4b')](function(_0x20286){_0x5ee258=_['keyBy'](_0x20286,'id');var _0x36f1df={'type':db[_0x9ba2('0x5a')]['QueryTypes']['SELECT'],'model':db[_0x9ba2('0x5b')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x9ba2('0x5c')][_0x9ba2('0x5d')](_0x117fc2[_0x9ba2('0x5e')](),_0x36f1df);})[_0x9ba2('0x4b')](function(_0x323eea){_0x323eea['forEach'](function(_0x483fd2){if(_0x483fd2['TagIds']){_0x483fd2['Tags']=[];_0x483fd2[_0x9ba2('0x18')][_0x9ba2('0x21')](',')[_0x9ba2('0x1a')](function(_0x9c292){_0x483fd2[_0x9ba2('0x5f')][_0x9ba2('0x46')](_0x5ee258[_0x9c292]);});}delete _0x483fd2[_0x9ba2('0x18')];});return _0x323eea;});}function countFilteredContacts(_0x2f9a9d,_0x113ff3){var _0x1d0d15=_0x2f9a9d[_0x9ba2('0x60')]();_0x1d0d15[_0x9ba2('0x1c')]('COUNT(*)');_0x1d0d15=applyJoinClauses(_0x1d0d15,!![]);_0x2f9a9d[_0x9ba2('0x51')]('c.id');var _0x197dbf=utils['getSelectedTags'](_0x113ff3);if(!_[_0x9ba2('0x61')](_0x197dbf)){_0x1d0d15['where'](_0x9ba2('0x62'),_0x197dbf);}var _0x268e72={'type':db[_0x9ba2('0x5a')][_0x9ba2('0x63')][_0x9ba2('0x64')],'raw':!![]};return db[_0x9ba2('0x5c')][_0x9ba2('0x5d')](_0x1d0d15[_0x9ba2('0x5e')](),_0x268e72)[_0x9ba2('0x4b')](function(_0x3e39cc){return _0x3e39cc[0x0][_0x9ba2('0x65')];});}module[_0x9ba2('0x66')]={'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 8baba89..acdfb7d 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 _0x6839=['encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','createDecipher','close','encryptString','base64','decryptString','utf8','bluebird','lodash','../../config/logger','app','secrets','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty'];(function(_0x3b5122,_0x5a3be2){var _0x5b13c4=function(_0x1ba8f0){while(--_0x1ba8f0){_0x3b5122['push'](_0x3b5122['shift']());}};_0x5b13c4(++_0x5a3be2);}(_0x6839,0x15a));var _0x9683=function(_0x51c560,_0x4e6c0e){_0x51c560=_0x51c560-0x0;var _0x594579=_0x6839[_0x51c560];return _0x594579;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x9683('0x0'));var _=require(_0x9683('0x1'));var config=require('../../config/environment');var logger=require(_0x9683('0x2'))(_0x9683('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x9683('0x4')]['session'],'algorithm':_0x9683('0x5')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0x9683('0x6')][_0x9683('0x7')]){var isSupported=isAlgorithmSupported(config[_0x9683('0x6')][_0x9683('0x7')]);if(isSupported){fileOptions[_0x9683('0x7')]=config['encrypt'][_0x9683('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x9683('0x8')](config[_0x9683('0x6')][_0x9683('0x7')],_0x9683('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x396828){return AES_SUPPORTED_RX[_0x9683('0xa')](_0x396828);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x9683('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x4c7d70){return getSupportedCiphers()[_0x9683('0xc')](_0x4c7d70)>-0x1;}function combineOptions(_0x2f80b9){var _0x13990a={};for(var _0x305d05 in fileOptions){if(fileOptions[_0x9683('0xd')](_0x305d05)){_0x13990a[_0x305d05]=fileOptions[_0x305d05];}}if(_0x2f80b9){for(var _0x304122 in _0x2f80b9){if(_0x2f80b9['hasOwnProperty'](_0x304122)){_0x13990a[_0x304122]=_0x2f80b9[_0x304122];}}}return _0x13990a;}exports[_0x9683('0xe')]=function(_0x4e986e,_0x376d90,_0xdb91f0,_0x407315){return new BPromise(function(_0x91e1e4,_0xb2096){_0x407315=combineOptions(_0x407315);var _0x20e2e5=new Buffer(_0xdb91f0);var _0x324fa7=fs[_0x9683('0xf')](_0x4e986e);var _0x3accb3=fs[_0x9683('0x10')](_0x376d90);var _0x5ceec0=crypto[_0x9683('0x11')](_0x407315[_0x9683('0x7')],_0x20e2e5);_0x324fa7['on'](_0x9683('0x12'),function(_0x5d5c25){var _0x23385e=new Buffer(_0x5ceec0[_0x9683('0x13')](_0x5d5c25),_0x9683('0x14'));_0x3accb3[_0x9683('0x15')](_0x23385e);});_0x324fa7['on'](_0x9683('0x16'),function(){try{var _0x478f33=new Buffer(_0x5ceec0[_0x9683('0x17')](_0x9683('0x14')),_0x9683('0x14'));_0x3accb3['write'](_0x478f33);_0x3accb3['end']();_0x3accb3['on']('close',function(){return _0x91e1e4(_0x376d90);});}catch(_0x2305a1){fs['unlink'](_0x376d90);return _0xb2096(_0x2305a1);}});});};exports['decryptFile']=function(_0xb38929,_0x3eada6,_0x56089b,_0x5ee5ae){return new BPromise(function(_0xe447f7,_0xaf3bb5){_0x5ee5ae=combineOptions(_0x5ee5ae);var _0x17e172=new Buffer(_0x56089b);var _0x44548a=fs[_0x9683('0xf')](_0xb38929);var _0x3ce265=fs['createWriteStream'](_0x3eada6);var _0x52da82=crypto[_0x9683('0x18')](_0x5ee5ae[_0x9683('0x7')],_0x17e172);_0x44548a['on'](_0x9683('0x12'),function(_0x506cee){var _0x3eaeaf=new Buffer(_0x52da82[_0x9683('0x13')](_0x506cee),_0x9683('0x14'));_0x3ce265[_0x9683('0x15')](_0x3eaeaf);});_0x44548a['on']('end',function(){try{var _0x51ea9f=new Buffer(_0x52da82['final'](_0x9683('0x14')),_0x9683('0x14'));_0x3ce265['write'](_0x51ea9f);_0x3ce265[_0x9683('0x16')]();_0x3ce265['on'](_0x9683('0x19'),function(){return _0xe447f7(_0x3eada6);});}catch(_0x3e583d){fs['unlink'](_0x3eada6);return _0xaf3bb5(_0x3e583d);}});});};exports[_0x9683('0x1a')]=function(_0x2ab14a,_0x2292aa,_0x3e5bc9){var _0x30b9b7=_0x3e5bc9||stringOptions[_0x9683('0x7')];var _0x36bffa=_0x2292aa||stringOptions['secret'];var _0x404720=crypto[_0x9683('0x11')](_0x30b9b7,_0x36bffa);var _0x1e09a2=_0x404720[_0x9683('0x13')](_0x2ab14a,'utf8',_0x9683('0x1b'));_0x1e09a2+=_0x404720[_0x9683('0x17')]('base64');return _0x1e09a2;};exports[_0x9683('0x1c')]=function(_0x5a4336,_0x5b8419,_0x2f9e75){var _0x16e3d3=_0x2f9e75||stringOptions[_0x9683('0x7')];var _0x74a469=_0x5b8419||stringOptions['secret'];var _0xbb56c9=crypto[_0x9683('0x18')](_0x16e3d3,_0x74a469);var _0x33b894=_0xbb56c9[_0x9683('0x13')](_0x5a4336,'base64',_0x9683('0x1d'));_0x33b894+=_0xbb56c9['final'](_0x9683('0x1d'));return _0x33b894;}; \ No newline at end of file +var _0xb7f0=['utf8','base64','decryptString','crypto','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','test','getCiphers','hasOwnProperty','encryptFile','createCipher','data','update','binary','final','close','unlink','decryptFile','createReadStream','createDecipher','write','end','encryptString','secret'];(function(_0x3dd9dd,_0x401b00){var _0x3d750d=function(_0x1d960b){while(--_0x1d960b){_0x3dd9dd['push'](_0x3dd9dd['shift']());}};_0x3d750d(++_0x401b00);}(_0xb7f0,0x99));var _0x0b7f=function(_0x241099,_0x2997a9){_0x241099=_0x241099-0x0;var _0x164e96=_0xb7f0[_0x241099];return _0x164e96;};'use strict';var crypto=require(_0x0b7f('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x0b7f('0x1'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0b7f('0x2')][_0x0b7f('0x3')],'algorithm':_0x0b7f('0x4')};const fileOptions={'algorithm':_0x0b7f('0x5')};if(config[_0x0b7f('0x6')]&&config[_0x0b7f('0x6')][_0x0b7f('0x7')]){var isSupported=isAlgorithmSupported(config[_0x0b7f('0x6')][_0x0b7f('0x7')]);if(isSupported){fileOptions[_0x0b7f('0x7')]=config[_0x0b7f('0x6')][_0x0b7f('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x0b7f('0x8')](config['encrypt'][_0x0b7f('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x19c6ba){return AES_SUPPORTED_RX[_0x0b7f('0x9')](_0x19c6ba);}function getSupportedCiphers(){return crypto[_0x0b7f('0xa')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x411fb4){return getSupportedCiphers()['indexOf'](_0x411fb4)>-0x1;}function combineOptions(_0x4ef070){var _0x95974d={};for(var _0x356141 in fileOptions){if(fileOptions[_0x0b7f('0xb')](_0x356141)){_0x95974d[_0x356141]=fileOptions[_0x356141];}}if(_0x4ef070){for(var _0x157f91 in _0x4ef070){if(_0x4ef070[_0x0b7f('0xb')](_0x157f91)){_0x95974d[_0x157f91]=_0x4ef070[_0x157f91];}}}return _0x95974d;}exports[_0x0b7f('0xc')]=function(_0x365936,_0x1eca6f,_0x3e562d,_0x376c0c){return new BPromise(function(_0x3c3608,_0xb0b405){_0x376c0c=combineOptions(_0x376c0c);var _0x2b8feb=new Buffer(_0x3e562d);var _0x5ebd1d=fs['createReadStream'](_0x365936);var _0x14cf38=fs['createWriteStream'](_0x1eca6f);var _0x525468=crypto[_0x0b7f('0xd')](_0x376c0c[_0x0b7f('0x7')],_0x2b8feb);_0x5ebd1d['on'](_0x0b7f('0xe'),function(_0x3ff42a){var _0x31776d=new Buffer(_0x525468[_0x0b7f('0xf')](_0x3ff42a),_0x0b7f('0x10'));_0x14cf38['write'](_0x31776d);});_0x5ebd1d['on']('end',function(){try{var _0xccdcee=new Buffer(_0x525468[_0x0b7f('0x11')](_0x0b7f('0x10')),_0x0b7f('0x10'));_0x14cf38['write'](_0xccdcee);_0x14cf38['end']();_0x14cf38['on'](_0x0b7f('0x12'),function(){return _0x3c3608(_0x1eca6f);});}catch(_0x1cea66){fs[_0x0b7f('0x13')](_0x1eca6f);return _0xb0b405(_0x1cea66);}});});};exports[_0x0b7f('0x14')]=function(_0x1a4728,_0x234ed8,_0x4f2fec,_0x1a7ffc){return new BPromise(function(_0x19c623,_0x4fa9f6){_0x1a7ffc=combineOptions(_0x1a7ffc);var _0x5491b7=new Buffer(_0x4f2fec);var _0x81e2db=fs[_0x0b7f('0x15')](_0x1a4728);var _0x504d34=fs['createWriteStream'](_0x234ed8);var _0x39e068=crypto[_0x0b7f('0x16')](_0x1a7ffc[_0x0b7f('0x7')],_0x5491b7);_0x81e2db['on'](_0x0b7f('0xe'),function(_0x33d6b5){var _0xa535e1=new Buffer(_0x39e068[_0x0b7f('0xf')](_0x33d6b5),_0x0b7f('0x10'));_0x504d34[_0x0b7f('0x17')](_0xa535e1);});_0x81e2db['on'](_0x0b7f('0x18'),function(){try{var _0x437760=new Buffer(_0x39e068[_0x0b7f('0x11')]('binary'),_0x0b7f('0x10'));_0x504d34[_0x0b7f('0x17')](_0x437760);_0x504d34[_0x0b7f('0x18')]();_0x504d34['on'](_0x0b7f('0x12'),function(){return _0x19c623(_0x234ed8);});}catch(_0x43a5e4){fs['unlink'](_0x234ed8);return _0x4fa9f6(_0x43a5e4);}});});};exports[_0x0b7f('0x19')]=function(_0x596ad2,_0x21a4de,_0x176356){var _0x20a7aa=_0x176356||stringOptions[_0x0b7f('0x7')];var _0x3b2aa2=_0x21a4de||stringOptions[_0x0b7f('0x1a')];var _0x1c602b=crypto[_0x0b7f('0xd')](_0x20a7aa,_0x3b2aa2);var _0x33b80f=_0x1c602b[_0x0b7f('0xf')](_0x596ad2,_0x0b7f('0x1b'),_0x0b7f('0x1c'));_0x33b80f+=_0x1c602b[_0x0b7f('0x11')](_0x0b7f('0x1c'));return _0x33b80f;};exports[_0x0b7f('0x1d')]=function(_0x7ece71,_0x2c55dd,_0x96744c){var _0x43f713=_0x96744c||stringOptions[_0x0b7f('0x7')];var _0x5f109b=_0x2c55dd||stringOptions[_0x0b7f('0x1a')];var _0x59f880=crypto[_0x0b7f('0x16')](_0x43f713,_0x5f109b);var _0x43c3c2=_0x59f880[_0x0b7f('0xf')](_0x7ece71,_0x0b7f('0x1c'),_0x0b7f('0x1b'));_0x43c3c2+=_0x59f880[_0x0b7f('0x11')]('utf8');return _0x43c3c2;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 6b12380..964fc4d 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 _0xab94=['update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport'];(function(_0x5392cd,_0x1d0112){var _0x18523a=function(_0x112670){while(--_0x112670){_0x5392cd['push'](_0x5392cd['shift']());}};_0x18523a(++_0x1d0112);}(_0xab94,0x1b5));var _0x4ab9=function(_0x2fc7b8,_0x176066){_0x2fc7b8=_0x2fc7b8-0x0;var _0x335da9=_0xab94[_0x2fc7b8];return _0x335da9;};'use strict';var util=require('util');var path=require(_0x4ab9('0x0'));var _=require(_0x4ab9('0x1'));var csv=require(_0x4ab9('0x2'));var fs=require('fs');var BPromise=require(_0x4ab9('0x3'));var zipdir=require(_0x4ab9('0x4'));var rimraf=require(_0x4ab9('0x5'));var db=require(_0x4ab9('0x6'))['db'];var dbH=require('../../mysqldb')[_0x4ab9('0x7')];var logger=require(_0x4ab9('0x8'))(_0x4ab9('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4ab9('0xa')][0x3];var PATH=process[_0x4ab9('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x504bf9,_0x49f6e2){var _0x2c69fb={'status':_0x504bf9};var _0x5e706a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x49f6e2){_0x2c69fb[_0x4ab9('0xb')]=_0x49f6e2;}return db[_0x4ab9('0xc')][_0x4ab9('0xd')](_0x2c69fb,_0x5e706a);}function main(){var _0xb42d4b=0x1388;var _0x5d13ec;logger[_0x4ab9('0xe')](util['format'](_0x4ab9('0xf'),EXTRACTED_REPORT_ID,_0x4ab9('0x10')));return db[_0x4ab9('0x11')][_0x4ab9('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4ab9('0x13'),_0x4ab9('0x14')]})[_0x4ab9('0x15')](function(_0x2510d5){if(_0x2510d5){_0x5d13ec=_0x2510d5;_0xb42d4b=_0x5d13ec[_0x4ab9('0x14')]||0x1388;}})[_0x4ab9('0x15')](function(){return dbH[_0x4ab9('0x16')]['query'](util[_0x4ab9('0x17')](_0x4ab9('0x18'),QUERY),{'type':dbH[_0x4ab9('0x16')][_0x4ab9('0x19')][_0x4ab9('0x1a')]});})[_0x4ab9('0x15')](function(_0x4c7fb6){if(!_0x4c7fb6[0x0][_0x4ab9('0x1b')]){return analyticExtractedReport('Empty');}var _0x25dbbe=[];var _0x5c365e=0x0;if(_0x5d13ec['split']){if(_0x4c7fb6&&_0x4c7fb6[_0x4ab9('0x1c')]){var _0x191619=_['range'](_0x4c7fb6[0x0]['num']/_0xb42d4b);var _0x4db801=Number[_0x4ab9('0x1d')](_0x4c7fb6[0x0][_0x4ab9('0x1b')]/_0xb42d4b)?_0x4c7fb6[0x0][_0x4ab9('0x1b')]%_0xb42d4b:0x0;_0x191619[_0x4ab9('0x1e')](function(_0x2c724e){if(_0x2c724e>0x0){_0x5c365e+=_0xb42d4b;}_0x25dbbe[_0x4ab9('0x1f')](dbH[_0x4ab9('0x16')][_0x4ab9('0x20')](util[_0x4ab9('0x17')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xb42d4b,_0x5c365e),{'type':dbH[_0x4ab9('0x16')][_0x4ab9('0x19')][_0x4ab9('0x1a')]}));});if(_0x4db801>0x0){_0x5c365e+=_0xb42d4b;_0x25dbbe[_0x4ab9('0x1f')](dbH[_0x4ab9('0x16')][_0x4ab9('0x20')](util[_0x4ab9('0x17')](_0x4ab9('0x21'),QUERY,_0x4db801,_0x5c365e),{'type':dbH['sequelize'][_0x4ab9('0x19')]['SELECT']}));}}}else{_0x25dbbe['push'](dbH[_0x4ab9('0x16')][_0x4ab9('0x20')](QUERY,{'type':dbH['sequelize'][_0x4ab9('0x19')][_0x4ab9('0x1a')]}));}var _0x4372d2=path['dirname'](PATH);var _0x2b23c3=path[_0x4ab9('0x22')](PATH,_0x4ab9('0x23'));var _0x2e619d=_0x5d13ec[_0x4ab9('0x13')]&&_0x25dbbe['length']>0x1;var _0x5b12d2=[];if(!fs['existsSync'](path[_0x4ab9('0x24')](_0x4372d2,_0x2b23c3))&&_0x2e619d){fs[_0x4ab9('0x25')](path['join'](_0x4372d2,_0x2b23c3));}return BPromise['each'](_0x25dbbe,function(_0x5e5c4a){_0x5b12d2[_0x4ab9('0x1f')](_0x5e5c4a);})[_0x4ab9('0x15')](function(){for(var _0x4bc3a0=0x0;_0x4bc3a0<_0x5b12d2[_0x4ab9('0x1c')];_0x4bc3a0+=0x1){var _0x1d5189;var _0x1b422d=_0x5b12d2[_0x4bc3a0];if(_0x2e619d){_0x1d5189=path[_0x4ab9('0x24')](_0x4372d2,_0x2b23c3,util['format'](_0x4ab9('0x26'),_0x2b23c3,_0x4bc3a0,_0x4ab9('0x27')));}else{_0x1d5189=path[_0x4ab9('0x24')](_0x4372d2,util['format'](_0x4ab9('0x28'),_0x2b23c3,_0x4ab9('0x27')));}fs[_0x4ab9('0x29')](_0x1d5189,csv(_0x1b422d));}})[_0x4ab9('0x15')](function(){if(_0x2e619d){return new Promise(function(_0x1d4b06){zipdir(path['join'](_0x4372d2,_0x2b23c3),{'saveTo':path['join'](_0x4372d2,util[_0x4ab9('0x17')](_0x4ab9('0x28'),_0x2b23c3,_0x4ab9('0x2a')))},function(_0x34ca91,_0x38d2c7){rimraf(path['join'](_0x4372d2,_0x2b23c3),function(){});_0x1d4b06(_0x4ab9('0x2b'));});});}})[_0x4ab9('0x15')](function(){logger[_0x4ab9('0xe')](util[_0x4ab9('0x17')](_0x4ab9('0x2c'),EXTRACTED_REPORT_ID,_0x4ab9('0x10')));return analyticExtractedReport(_0x4ab9('0x2d'),_0x2e619d?util['format'](_0x4ab9('0x28'),_0x2b23c3,_0x2e619d?_0x4ab9('0x2a'):'csv'):null);});})[_0x4ab9('0x2e')](function(_0x549df8){logger[_0x4ab9('0xe')](util[_0x4ab9('0x17')](_0x4ab9('0x2f'),EXTRACTED_REPORT_ID,_0x4ab9('0x10')),util['inspect'](_0x549df8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4ab9('0x30'));})['finally'](function(){process[_0x4ab9('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf746=['zip\x20finished','CSV','Completed','catch','inspect','Failed','exit','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length','range','isInteger','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s.%s','csv','zip'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xf746,0x69));var _0x6f74=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xf746[_0x2b5eae];return _0x5f3ac9;};'use strict';var util=require(_0x6f74('0x0'));var path=require(_0x6f74('0x1'));var _=require(_0x6f74('0x2'));var csv=require(_0x6f74('0x3'));var fs=require('fs');var BPromise=require(_0x6f74('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x6f74('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6f74('0x6'))[_0x6f74('0x7')];var logger=require('../../config/logger')(_0x6f74('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6f74('0x9')][0x3];var PATH=process[_0x6f74('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x279066,_0x1dac7b){var _0xa7ad5e={'status':_0x279066};var _0x3e4b61={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1dac7b){_0xa7ad5e[_0x6f74('0xa')]=_0x1dac7b;}return db[_0x6f74('0xb')][_0x6f74('0xc')](_0xa7ad5e,_0x3e4b61);}function main(){var _0x5e05e7=0x1388;var _0x6601f2;logger[_0x6f74('0xd')](util[_0x6f74('0xe')](_0x6f74('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x6f74('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6f74('0x11')]})[_0x6f74('0x12')](function(_0x143fd2){if(_0x143fd2){_0x6601f2=_0x143fd2;_0x5e05e7=_0x6601f2[_0x6f74('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x6f74('0x13')](util[_0x6f74('0xe')](_0x6f74('0x14'),QUERY),{'type':dbH['sequelize'][_0x6f74('0x15')][_0x6f74('0x16')]});})[_0x6f74('0x12')](function(_0x29d9f8){if(!_0x29d9f8[0x0][_0x6f74('0x17')]){return analyticExtractedReport('Empty');}var _0x1e7628=[];var _0x235beb=0x0;if(_0x6601f2[_0x6f74('0x18')]){if(_0x29d9f8&&_0x29d9f8[_0x6f74('0x19')]){var _0x3c3065=_[_0x6f74('0x1a')](_0x29d9f8[0x0][_0x6f74('0x17')]/_0x5e05e7);var _0xd8a4a0=Number[_0x6f74('0x1b')](_0x29d9f8[0x0][_0x6f74('0x17')]/_0x5e05e7)?_0x29d9f8[0x0]['num']%_0x5e05e7:0x0;_0x3c3065[_0x6f74('0x1c')](function(_0x2994cf){if(_0x2994cf>0x0){_0x235beb+=_0x5e05e7;}_0x1e7628[_0x6f74('0x1d')](dbH[_0x6f74('0x1e')]['query'](util['format'](_0x6f74('0x1f'),QUERY,_0x5e05e7,_0x235beb),{'type':dbH[_0x6f74('0x1e')][_0x6f74('0x15')][_0x6f74('0x16')]}));});if(_0xd8a4a0>0x0){_0x235beb+=_0x5e05e7;_0x1e7628['push'](dbH[_0x6f74('0x1e')]['query'](util[_0x6f74('0xe')](_0x6f74('0x1f'),QUERY,_0xd8a4a0,_0x235beb),{'type':dbH[_0x6f74('0x1e')][_0x6f74('0x15')]['SELECT']}));}}}else{_0x1e7628['push'](dbH[_0x6f74('0x1e')]['query'](QUERY,{'type':dbH[_0x6f74('0x1e')][_0x6f74('0x15')][_0x6f74('0x16')]}));}var _0x4d9643=path[_0x6f74('0x20')](PATH);var _0x8416ee=path[_0x6f74('0x21')](PATH,_0x6f74('0x22'));var _0x158f8f=_0x6601f2[_0x6f74('0x18')]&&_0x1e7628[_0x6f74('0x19')]>0x1;var _0x2e878f=[];if(!fs[_0x6f74('0x23')](path[_0x6f74('0x24')](_0x4d9643,_0x8416ee))&&_0x158f8f){fs[_0x6f74('0x25')](path['join'](_0x4d9643,_0x8416ee));}return BPromise[_0x6f74('0x26')](_0x1e7628,function(_0x46e46a){_0x2e878f['push'](_0x46e46a);})['then'](function(){for(var _0x2f56cb=0x0;_0x2f56cb<_0x2e878f['length'];_0x2f56cb+=0x1){var _0x2d9cd0;var _0x523a3b=_0x2e878f[_0x2f56cb];if(_0x158f8f){_0x2d9cd0=path[_0x6f74('0x24')](_0x4d9643,_0x8416ee,util[_0x6f74('0xe')]('%s%d.%s',_0x8416ee,_0x2f56cb,'csv'));}else{_0x2d9cd0=path[_0x6f74('0x24')](_0x4d9643,util['format'](_0x6f74('0x27'),_0x8416ee,_0x6f74('0x28')));}fs['writeFileSync'](_0x2d9cd0,csv(_0x523a3b));}})[_0x6f74('0x12')](function(){if(_0x158f8f){return new Promise(function(_0x549683){zipdir(path[_0x6f74('0x24')](_0x4d9643,_0x8416ee),{'saveTo':path[_0x6f74('0x24')](_0x4d9643,util[_0x6f74('0xe')](_0x6f74('0x27'),_0x8416ee,_0x6f74('0x29')))},function(_0x992dde,_0x166967){rimraf(path[_0x6f74('0x24')](_0x4d9643,_0x8416ee),function(){});_0x549683(_0x6f74('0x2a'));});});}})[_0x6f74('0x12')](function(){logger[_0x6f74('0xd')](util[_0x6f74('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6f74('0x2b')));return analyticExtractedReport(_0x6f74('0x2c'),_0x158f8f?util[_0x6f74('0xe')](_0x6f74('0x27'),_0x8416ee,_0x158f8f?'zip':_0x6f74('0x28')):null);});})[_0x6f74('0x2d')](function(_0x521f3b){logger[_0x6f74('0xd')](util[_0x6f74('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x6f74('0x2e')](_0x521f3b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6f74('0x2f'));})['finally'](function(){process[_0x6f74('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 89235c8..f1aa9be 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 _0x91b3=['\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','lodash','util','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','push','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','margin','landscape','\x20/\x20','Arial','black','right','num','Empty','then','splitSizePdf','split','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center'];(function(_0x33aefe,_0x371ccd){var _0x471d19=function(_0x566c26){while(--_0x566c26){_0x33aefe['push'](_0x33aefe['shift']());}};_0x471d19(++_0x371ccd);}(_0x91b3,0x187));var _0x391b=function(_0x2c7700,_0x14eae5){_0x2c7700=_0x2c7700-0x0;var _0x29f064=_0x91b3[_0x2c7700];return _0x29f064;};'use strict';var _=require(_0x391b('0x0'));var fs=require('fs');var util=require(_0x391b('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x391b('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x391b('0x3'));var rimraf=require(_0x391b('0x4'));var JSDOM=require(_0x391b('0x5'))[_0x391b('0x6')];var window=new JSDOM('')[_0x391b('0x7')];var BPromise=require(_0x391b('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0x391b('0x9'))['dbH'];var logger=require(_0x391b('0xa'))(_0x391b('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x391b('0xc')][0x2]);var QUERY=process[_0x391b('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x391b('0xc')][0x5];var FORMAT=_0x391b('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5a910b,_0x233f87){var _0x225cd9={'status':_0x5a910b};var _0xfc9074={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x233f87){_0x225cd9[_0x391b('0xe')]=_0x233f87;}return db[_0x391b('0xf')]['update'](_0x225cd9,_0xfc9074);}function getHeaders(_0x42d559){return _[_0x391b('0x10')](_0x42d559,function(_0x5a537c){return{'text':_0x5a537c,'style':_0x391b('0x11')};});}function getRows(_0x4f33dc,_0x2671e8){return _['map'](_0x2671e8,function(_0x18aadd){return _(_0x18aadd)[_0x391b('0x12')](_0x4f33dc)[_0x391b('0x10')](function(_0x253820){return _0x253820?_[_0x391b('0x13')](_0x253820):'';})[_0x391b('0x14')]();});}function createTable(_0x3b1ea2,_0x251894){var _0xb001b6={'widths':_[_0x391b('0x15')](Array(_0x3b1ea2[_0x391b('0x16')]),0x91),'heights':function(_0x501796){return _0x501796===0x0?_0x391b('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x76a60f=getHeaders(_0x3b1ea2);_0xb001b6['body'][_0x391b('0x18')](_0x76a60f);var _0x16bde9=getRows(_0x3b1ea2,_0x251894);_0xb001b6[_0x391b('0x19')]=_0xb001b6[_0x391b('0x19')][_0x391b('0x1a')](_0x16bde9);return _0xb001b6;}function createTables(_0x58318a){var _0x502ff5=[];var _0x57cb3b=_[_0x391b('0x1b')](Object[_0x391b('0x1c')](_0x58318a[0x0]),0x5);_0x57cb3b[_0x391b('0x1d')](function(_0x136691){_0x502ff5[_0x391b('0x18')](createTable(_0x136691,_0x58318a));});return _0x502ff5;}function getPDFDocDefinition(_0x55cb44){var _0x26b7c3=util[_0x391b('0x1e')](_0x391b('0x1f'),NAME,EXTRACTED_REPORT[_0x391b('0x20')],moment(EXTRACTED_REPORT[_0x391b('0x21')])[_0x391b('0x1e')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x391b('0x1e')](FORMAT));var _0x2d8f35=[];for(var _0x5cbf40=0x0;_0x5cbf40<_0x55cb44[_0x391b('0x16')];_0x5cbf40++){var _0x17d613=[];if(_0x5cbf40===0x0){_0x17d613[_0x391b('0x18')]({'text':_0x26b7c3,'style':_0x391b('0x22')});}var _0x27bd80={'table':_0x55cb44[_0x5cbf40]};if(_0x5cbf40>0x0){_0x27bd80[_0x391b('0x23')]=_0x391b('0x24');_0x27bd80[_0x391b('0x25')]=[0x0,0x46,0x0,0x0];}_0x17d613[_0x391b('0x18')](_0x27bd80);_0x2d8f35[_0x391b('0x18')](_0x17d613);}return{'pageSize':'A4','pageOrientation':_0x391b('0x26'),'content':_0x2d8f35,'footer':function(_0x1cdad4,_0x2852c2){return{'text':_0x1cdad4[_0x391b('0x13')]()+_0x391b('0x27')+_0x2852c2,'style':'footer'};},'defaultStyle':{'font':_0x391b('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x391b('0x29')},'footer':{'alignment':_0x391b('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5e65a7){var _0x220508=0x1388;var _0x493421;if(!_0x5e65a7[0x0][_0x391b('0x2b')]){return analyticExtractedReport(_0x391b('0x2c'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x391b('0x2d')](function(_0x16c996){if(_0x16c996){_0x493421=_0x16c996;_0x220508=_0x493421[_0x391b('0x2e')]||0x3e8;}})[_0x391b('0x2d')](function(){var _0x5ed27e=[];var _0x19ed9d=0x0;if(_0x493421[_0x391b('0x2f')]){if(_0x5e65a7&&_0x5e65a7[_0x391b('0x16')]){var _0x140740=_[_0x391b('0x30')](_0x5e65a7[0x0][_0x391b('0x2b')]/_0x220508);var _0x44bdd4=Number[_0x391b('0x31')](_0x5e65a7[0x0][_0x391b('0x2b')]/_0x220508)?_0x5e65a7[0x0][_0x391b('0x2b')]%_0x220508:0x0;_0x140740[_0x391b('0x1d')](function(_0xacfa1d){if(_0xacfa1d>0x0){_0x19ed9d+=_0x220508;}_0x5ed27e[_0x391b('0x18')](dbH[_0x391b('0x32')]['query'](util[_0x391b('0x1e')](_0x391b('0x33'),QUERY,_0x220508,_0x19ed9d),{'type':dbH[_0x391b('0x32')][_0x391b('0x34')][_0x391b('0x35')]}));});if(_0x44bdd4>0x0){_0x19ed9d+=_0x220508;_0x5ed27e[_0x391b('0x18')](dbH[_0x391b('0x32')]['query'](util[_0x391b('0x1e')](_0x391b('0x33'),QUERY,_0x44bdd4,_0x19ed9d),{'type':dbH[_0x391b('0x32')][_0x391b('0x34')][_0x391b('0x35')]}));}}}else{_0x5ed27e[_0x391b('0x18')](dbH[_0x391b('0x32')]['query'](QUERY,{'type':dbH[_0x391b('0x32')]['QueryTypes'][_0x391b('0x35')]}));}var _0x2311f2=path[_0x391b('0x36')](PATH);var _0x42c78d=path[_0x391b('0x37')](PATH,'.pdf');var _0x177d6d=_0x493421['split']&&_0x5ed27e[_0x391b('0x16')]>0x1;var _0x17590b=[];if(!fs[_0x391b('0x38')](path[_0x391b('0x39')](_0x2311f2,_0x42c78d))&&_0x177d6d){fs[_0x391b('0x3a')](path[_0x391b('0x39')](_0x2311f2,_0x42c78d));}return BPromise[_0x391b('0x3b')](_0x5ed27e,function(_0x22ba14){_0x17590b[_0x391b('0x18')](_0x22ba14);})[_0x391b('0x2d')](function(){var _0x49074e=[];for(var _0x2f25bb=0x0;_0x2f25bb<_0x17590b[_0x391b('0x16')];_0x2f25bb+=0x1){var _0x4602b2=_0x17590b[_0x2f25bb];var _0x522e02=createTables(_[_0x391b('0x3c')](_0x4602b2));var _0x4ae7be;var _0x3b28c9=getPDFDocDefinition(_0x522e02);var _0x5839dc=getPDFPrinter();var _0x32383d=_0x5839dc[_0x391b('0x3d')](_0x3b28c9);if(_0x177d6d){_0x4ae7be=path[_0x391b('0x39')](_0x2311f2,_0x42c78d,util[_0x391b('0x1e')](_0x391b('0x3e'),_0x42c78d,_0x2f25bb,_0x391b('0x3f')));}else{_0x4ae7be=path[_0x391b('0x39')](_0x2311f2,util[_0x391b('0x1e')](_0x391b('0x40'),_0x42c78d,'pdf'));}_0x49074e['push'](writePDFDocument(_0x32383d,_0x4ae7be));}return Promise[_0x391b('0x41')](_0x49074e);})[_0x391b('0x2d')](function(){if(_0x177d6d){return new Promise(function(_0x103343){zipdir(path[_0x391b('0x39')](_0x2311f2,_0x42c78d),{'saveTo':path[_0x391b('0x39')](_0x2311f2,util['format'](_0x391b('0x40'),_0x42c78d,_0x391b('0x42')))},function(){rimraf(path[_0x391b('0x39')](_0x2311f2,_0x42c78d),function(){});_0x103343('zip\x20finished');});});}})['then'](function(){if(!_0x177d6d)return;rimraf(path[_0x391b('0x39')](_0x2311f2,_0x42c78d),function(){});})['then'](function(){logger['info'](util[_0x391b('0x1e')](_0x391b('0x43'),EXTRACTED_REPORT_ID,_0x391b('0x44')));return analyticExtractedReport('Completed',_0x177d6d?util[_0x391b('0x1e')](_0x391b('0x40'),_0x42c78d,_0x177d6d?_0x391b('0x42'):_0x391b('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x391b('0x45')](util[_0x391b('0x1e')](_0x391b('0x46'),EXTRACTED_REPORT_ID,_0x391b('0x44')));return db[_0x391b('0xf')][_0x391b('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x391b('0x2d')](function(_0x42b16b){EXTRACTED_REPORT=_0x42b16b;return dbH[_0x391b('0x32')][_0x391b('0x48')](util[_0x391b('0x1e')](_0x391b('0x49'),QUERY),{'type':dbH[_0x391b('0x32')][_0x391b('0x34')]['SELECT']});})[_0x391b('0x2d')](extractReport)[_0x391b('0x4a')](function(_0x4a8cf2){logger[_0x391b('0x45')](util[_0x391b('0x1e')](_0x391b('0x4b'),EXTRACTED_REPORT_ID,_0x391b('0x44')),util[_0x391b('0x4c')](_0x4a8cf2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x391b('0x4d'));})[_0x391b('0x4e')](function(){process[_0x391b('0x4f')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x293984=new PdfPrinter({'Arial':{'normal':__dirname+_0x391b('0x50'),'bold':__dirname+_0x391b('0x51'),'italics':__dirname+_0x391b('0x52'),'bolditalics':__dirname+_0x391b('0x53')}});return _0x293984;}function getPDFDocDefinitionFromHTML(_0x224666,_0x318543){var _0x20add3=util['format'](_0x391b('0x54'),_0x318543[_0x391b('0x55')],_0x318543[_0x391b('0x56')]);var _0x2fc914=moment()['format'](_0x391b('0x57'))[_0x391b('0x13')]();var _0x13e8cd=htmlToPdfmake(_0x224666,{'window':window,'tableAutoSize':!![]});return{'content':[_0x13e8cd],'defaultStyle':{'font':_0x391b('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x391b('0x58'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x391b('0x58'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x391b('0x58')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x391b('0x22')}];},'footer':function(_0x39fb56,_0x5629c3){return[{'text':util['format'](_0x391b('0x59'),_0x20add3,_0x39fb56,_0x5629c3,_0x2fc914),'style':_0x391b('0x5a')}];}};}function writePDFDocument(_0x315b04,_0x225d15){return new Promise(function(_0x2fc182,_0x379c4e){var _0x16ae50=_0x315b04[_0x391b('0x5b')](fs[_0x391b('0x5c')](_0x225d15));_0x16ae50['on'](_0x391b('0x5d'),function(){_0x2fc182(_0x391b('0x5d'));});_0x16ae50['on'](_0x391b('0x5e'),function(_0x47fe07){_0x379c4e(_0x47fe07);});_0x315b04[_0x391b('0x5f')]();});}exports['createPdfFromHTML']=function(_0x213725,_0x171c12){var _0x2d1799=getPDFPrinter();var _0x319374=getPDFDocDefinitionFromHTML(_0x213725,_0x171c12);var _0x47686c=_0x2d1799[_0x391b('0x3d')](_0x319374);return writePDFDocument(_0x47686c,_0x171c12['path'])['catch'](function(_0x2a0e7f){throw _0x2a0e7f;});}; \ No newline at end of file +var _0x80e6=['map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','name','startDate','endDate','header','before','margin','landscape','footer','Arial','black','right','num','Empty','find','splitSizePdf','then','split','range','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','info','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','error','end','createPdfFromHTML','catch','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update'];(function(_0x5c504b,_0x79d69f){var _0x4fd9f5=function(_0xb46452){while(--_0xb46452){_0x5c504b['push'](_0x5c504b['shift']());}};_0x4fd9f5(++_0x79d69f);}(_0x80e6,0x1bb));var _0x680e=function(_0x1386e4,_0x40c521){_0x1386e4=_0x1386e4-0x0;var _0x5f2585=_0x80e6[_0x1386e4];return _0x5f2585;};'use strict';var _=require(_0x680e('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x680e('0x1'));var moment=require(_0x680e('0x2'));var htmlToPdfmake=require(_0x680e('0x3'));var PdfPrinter=require(_0x680e('0x4'));var zipdir=require(_0x680e('0x5'));var rimraf=require(_0x680e('0x6'));var JSDOM=require(_0x680e('0x7'))[_0x680e('0x8')];var window=new JSDOM('')[_0x680e('0x9')];var BPromise=require('bluebird');var db=require(_0x680e('0xa'))['db'];var dbH=require(_0x680e('0xa'))[_0x680e('0xb')];var logger=require('../../config/logger')(_0x680e('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x680e('0xd')][0x3];var PATH=process[_0x680e('0xd')][0x4];var NAME=process[_0x680e('0xd')][0x5];var FORMAT=_0x680e('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x8b784,_0x2582f9){var _0x13a13b={'status':_0x8b784};var _0x50e044={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2582f9){_0x13a13b['savename']=_0x2582f9;}return db[_0x680e('0xf')][_0x680e('0x10')](_0x13a13b,_0x50e044);}function getHeaders(_0x3e8b9e){return _[_0x680e('0x11')](_0x3e8b9e,function(_0x153498){return{'text':_0x153498,'style':_0x680e('0x12')};});}function getRows(_0x3550ab,_0xb97ad6){return _[_0x680e('0x11')](_0xb97ad6,function(_0x475cc8){return _(_0x475cc8)[_0x680e('0x13')](_0x3550ab)[_0x680e('0x11')](function(_0x3cda2c){return _0x3cda2c?_[_0x680e('0x14')](_0x3cda2c):'';})[_0x680e('0x15')]();});}function createTable(_0x142208,_0x2e6e29){var _0x27c29a={'widths':_[_0x680e('0x16')](Array(_0x142208[_0x680e('0x17')]),0x91),'heights':function(_0x24997f){return _0x24997f===0x0?_0x680e('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x17b334=getHeaders(_0x142208);_0x27c29a[_0x680e('0x19')][_0x680e('0x1a')](_0x17b334);var _0x4eb184=getRows(_0x142208,_0x2e6e29);_0x27c29a[_0x680e('0x19')]=_0x27c29a[_0x680e('0x19')][_0x680e('0x1b')](_0x4eb184);return _0x27c29a;}function createTables(_0x44eefa){var _0x131ab0=[];var _0x3bb28c=_[_0x680e('0x1c')](Object[_0x680e('0x1d')](_0x44eefa[0x0]),0x5);_0x3bb28c[_0x680e('0x1e')](function(_0x4ba565){_0x131ab0[_0x680e('0x1a')](createTable(_0x4ba565,_0x44eefa));});return _0x131ab0;}function getPDFDocDefinition(_0x47d1ec){var _0x1147b2=util[_0x680e('0x1f')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x680e('0x20')],moment(EXTRACTED_REPORT[_0x680e('0x21')])[_0x680e('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x680e('0x22')])['format'](FORMAT));var _0x4b7f92=[];for(var _0x77cb5=0x0;_0x77cb5<_0x47d1ec[_0x680e('0x17')];_0x77cb5++){var _0x15be47=[];if(_0x77cb5===0x0){_0x15be47[_0x680e('0x1a')]({'text':_0x1147b2,'style':_0x680e('0x23')});}var _0xad0da8={'table':_0x47d1ec[_0x77cb5]};if(_0x77cb5>0x0){_0xad0da8['pageBreak']=_0x680e('0x24');_0xad0da8[_0x680e('0x25')]=[0x0,0x46,0x0,0x0];}_0x15be47[_0x680e('0x1a')](_0xad0da8);_0x4b7f92[_0x680e('0x1a')](_0x15be47);}return{'pageSize':'A4','pageOrientation':_0x680e('0x26'),'content':_0x4b7f92,'footer':function(_0x4b69ba,_0x56607a){return{'text':_0x4b69ba[_0x680e('0x14')]()+'\x20/\x20'+_0x56607a,'style':_0x680e('0x27')};},'defaultStyle':{'font':_0x680e('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x680e('0x29')},'footer':{'alignment':_0x680e('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3f134a){var _0xb1509d=0x1388;var _0x4d3f49;if(!_0x3f134a[0x0][_0x680e('0x2b')]){return analyticExtractedReport(_0x680e('0x2c'));}return db['Setting'][_0x680e('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x680e('0x2e')]})[_0x680e('0x2f')](function(_0x21b9e9){if(_0x21b9e9){_0x4d3f49=_0x21b9e9;_0xb1509d=_0x4d3f49[_0x680e('0x2e')]||0x3e8;}})[_0x680e('0x2f')](function(){var _0x3eec78=[];var _0x18e4ad=0x0;if(_0x4d3f49[_0x680e('0x30')]){if(_0x3f134a&&_0x3f134a[_0x680e('0x17')]){var _0x2567b5=_[_0x680e('0x31')](_0x3f134a[0x0][_0x680e('0x2b')]/_0xb1509d);var _0x5a5a53=Number[_0x680e('0x32')](_0x3f134a[0x0][_0x680e('0x2b')]/_0xb1509d)?_0x3f134a[0x0][_0x680e('0x2b')]%_0xb1509d:0x0;_0x2567b5[_0x680e('0x1e')](function(_0x389479){if(_0x389479>0x0){_0x18e4ad+=_0xb1509d;}_0x3eec78[_0x680e('0x1a')](dbH[_0x680e('0x33')][_0x680e('0x34')](util[_0x680e('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xb1509d,_0x18e4ad),{'type':dbH[_0x680e('0x33')][_0x680e('0x35')][_0x680e('0x36')]}));});if(_0x5a5a53>0x0){_0x18e4ad+=_0xb1509d;_0x3eec78['push'](dbH[_0x680e('0x33')][_0x680e('0x34')](util[_0x680e('0x1f')](_0x680e('0x37'),QUERY,_0x5a5a53,_0x18e4ad),{'type':dbH['sequelize'][_0x680e('0x35')]['SELECT']}));}}}else{_0x3eec78[_0x680e('0x1a')](dbH[_0x680e('0x33')][_0x680e('0x34')](QUERY,{'type':dbH[_0x680e('0x33')][_0x680e('0x35')][_0x680e('0x36')]}));}var _0x3dde73=path[_0x680e('0x38')](PATH);var _0x2e22df=path[_0x680e('0x39')](PATH,'.pdf');var _0x269d35=_0x4d3f49[_0x680e('0x30')]&&_0x3eec78[_0x680e('0x17')]>0x1;var _0x9f7a54=[];if(!fs[_0x680e('0x3a')](path[_0x680e('0x3b')](_0x3dde73,_0x2e22df))&&_0x269d35){fs[_0x680e('0x3c')](path[_0x680e('0x3b')](_0x3dde73,_0x2e22df));}return BPromise[_0x680e('0x3d')](_0x3eec78,function(_0x28bf38){_0x9f7a54['push'](_0x28bf38);})['then'](function(){var _0x4de1da=[];for(var _0x4dfb6f=0x0;_0x4dfb6f<_0x9f7a54[_0x680e('0x17')];_0x4dfb6f+=0x1){var _0x45afdc=_0x9f7a54[_0x4dfb6f];var _0x5d3b37=createTables(_[_0x680e('0x3e')](_0x45afdc));var _0x3862c2;var _0x276687=getPDFDocDefinition(_0x5d3b37);var _0x5cb8dd=getPDFPrinter();var _0x38e63e=_0x5cb8dd[_0x680e('0x3f')](_0x276687);if(_0x269d35){_0x3862c2=path[_0x680e('0x3b')](_0x3dde73,_0x2e22df,util[_0x680e('0x1f')](_0x680e('0x40'),_0x2e22df,_0x4dfb6f,_0x680e('0x41')));}else{_0x3862c2=path['join'](_0x3dde73,util[_0x680e('0x1f')](_0x680e('0x42'),_0x2e22df,_0x680e('0x41')));}_0x4de1da[_0x680e('0x1a')](writePDFDocument(_0x38e63e,_0x3862c2));}return Promise['all'](_0x4de1da);})['then'](function(){if(_0x269d35){return new Promise(function(_0x59e175){zipdir(path[_0x680e('0x3b')](_0x3dde73,_0x2e22df),{'saveTo':path['join'](_0x3dde73,util[_0x680e('0x1f')](_0x680e('0x42'),_0x2e22df,'zip'))},function(){rimraf(path[_0x680e('0x3b')](_0x3dde73,_0x2e22df),function(){});_0x59e175('zip\x20finished');});});}})[_0x680e('0x2f')](function(){if(!_0x269d35)return;rimraf(path[_0x680e('0x3b')](_0x3dde73,_0x2e22df),function(){});})[_0x680e('0x2f')](function(){logger['info'](util[_0x680e('0x1f')](_0x680e('0x43'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x680e('0x44'),_0x269d35?util[_0x680e('0x1f')](_0x680e('0x42'),_0x2e22df,_0x269d35?_0x680e('0x45'):_0x680e('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x680e('0x1f')](_0x680e('0x46'),EXTRACTED_REPORT_ID,_0x680e('0x47')));return db['AnalyticExtractedReport'][_0x680e('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1362db){EXTRACTED_REPORT=_0x1362db;return dbH[_0x680e('0x33')][_0x680e('0x34')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x680e('0x33')]['QueryTypes'][_0x680e('0x36')]});})[_0x680e('0x2f')](extractReport)['catch'](function(_0x267273){logger[_0x680e('0x49')](util[_0x680e('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0x680e('0x4a')](_0x267273,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x680e('0x4b'));})['finally'](function(){process[_0x680e('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5e97db=new PdfPrinter({'Arial':{'normal':__dirname+_0x680e('0x4d'),'bold':__dirname+_0x680e('0x4e'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x680e('0x4f')}});return _0x5e97db;}function getPDFDocDefinitionFromHTML(_0x8d25f,_0x53bc0b){var _0x4b1906=util[_0x680e('0x1f')](_0x680e('0x50'),_0x53bc0b[_0x680e('0x51')],_0x53bc0b[_0x680e('0x52')]);var _0x59d9b8=moment()['format']('YYYY-MM-DD')[_0x680e('0x14')]();var _0x11c750=htmlToPdfmake(_0x8d25f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x11c750],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x680e('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x680e('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x680e('0x53')}},'header':function(){return[{'text':_0x680e('0x54'),'style':_0x680e('0x23')}];},'footer':function(_0x19a1fd,_0x4fdfa3){return[{'text':util['format'](_0x680e('0x55'),_0x4b1906,_0x19a1fd,_0x4fdfa3,_0x59d9b8),'style':'footer'}];}};}function writePDFDocument(_0x4b407c,_0x2bffd6){return new Promise(function(_0x38a0d3,_0x59a3a3){var _0x3aa7c5=_0x4b407c[_0x680e('0x56')](fs[_0x680e('0x57')](_0x2bffd6));_0x3aa7c5['on']('finish',function(){_0x38a0d3('finish');});_0x3aa7c5['on'](_0x680e('0x58'),function(_0xab7201){_0x59a3a3(_0xab7201);});_0x4b407c[_0x680e('0x59')]();});}exports[_0x680e('0x5a')]=function(_0x57d489,_0x293000){var _0xc6f853=getPDFPrinter();var _0xefcc47=getPDFDocDefinitionFromHTML(_0x57d489,_0x293000);var _0x1780fd=_0xc6f853[_0x680e('0x3f')](_0xefcc47);return writePDFDocument(_0x1780fd,_0x293000[_0x680e('0x1')])[_0x680e('0x5b')](function(_0x2cfc59){throw _0x2cfc59;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 4463f9d..e32e44b 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 _0x8bd6=['length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.xlsx','existsSync','join','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','num','Empty'];(function(_0x118e70,_0x5877f0){var _0x3226af=function(_0x203041){while(--_0x203041){_0x118e70['push'](_0x118e70['shift']());}};_0x3226af(++_0x5877f0);}(_0x8bd6,0x144));var _0x68bd=function(_0x479a84,_0x985e03){_0x479a84=_0x479a84-0x0;var _0xe5837a=_0x8bd6[_0x479a84];return _0xe5837a;};'use strict';var util=require(_0x68bd('0x0'));var path=require(_0x68bd('0x1'));var _=require(_0x68bd('0x2'));var fs=require('fs');var json2xls=require(_0x68bd('0x3'));var BPromise=require(_0x68bd('0x4'));var zipdir=require(_0x68bd('0x5'));var rimraf=require(_0x68bd('0x6'));var db=require(_0x68bd('0x7'))['db'];var dbH=require(_0x68bd('0x7'))[_0x68bd('0x8')];var logger=require(_0x68bd('0x9'))(_0x68bd('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x68bd('0xb')][0x2]);var QUERY=process[_0x68bd('0xb')][0x3];var PATH=process[_0x68bd('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd5c43,_0x4166c7){var _0x242c81={'status':_0xd5c43};var _0x5165a6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4166c7){_0x242c81['savename']=_0x4166c7;}return db['AnalyticExtractedReport'][_0x68bd('0xc')](_0x242c81,_0x5165a6);}function main(){var _0x4d6eac=0x1388;var _0x33b53f;logger[_0x68bd('0xd')](util[_0x68bd('0xe')](_0x68bd('0xf'),EXTRACTED_REPORT_ID,_0x68bd('0x10')));return db['Setting'][_0x68bd('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x68bd('0x12'),_0x68bd('0x13')]})[_0x68bd('0x14')](function(_0x266b78){if(_0x266b78){_0x33b53f=_0x266b78;_0x4d6eac=_0x33b53f[_0x68bd('0x13')]||0x1388;}})['then'](function(){return dbH[_0x68bd('0x15')][_0x68bd('0x16')](util[_0x68bd('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x68bd('0x15')][_0x68bd('0x17')]['SELECT']});})[_0x68bd('0x14')](function(_0x1c78ec){if(!_0x1c78ec[0x0][_0x68bd('0x18')]){return analyticExtractedReport(_0x68bd('0x19'));}var _0x437c=[];var _0x3013a3=0x0;if(_0x33b53f['split']){if(_0x1c78ec&&_0x1c78ec[_0x68bd('0x1a')]){var _0x47d994=_['range'](_0x1c78ec[0x0][_0x68bd('0x18')]/_0x4d6eac);var _0x4b25bf=Number[_0x68bd('0x1b')](_0x1c78ec[0x0][_0x68bd('0x18')]/_0x4d6eac)?_0x1c78ec[0x0]['num']%_0x4d6eac:0x0;_0x47d994[_0x68bd('0x1c')](function(_0x372a34){if(_0x372a34>0x0){_0x3013a3+=_0x4d6eac;}_0x437c[_0x68bd('0x1d')](dbH[_0x68bd('0x15')]['query'](util[_0x68bd('0xe')](_0x68bd('0x1e'),QUERY,_0x4d6eac,_0x3013a3),{'type':dbH[_0x68bd('0x15')][_0x68bd('0x17')][_0x68bd('0x1f')]}));});if(_0x4b25bf>0x0){_0x3013a3+=_0x4d6eac;_0x437c[_0x68bd('0x1d')](dbH[_0x68bd('0x15')]['query'](util[_0x68bd('0xe')](_0x68bd('0x1e'),QUERY,_0x4b25bf,_0x3013a3),{'type':dbH[_0x68bd('0x15')][_0x68bd('0x17')][_0x68bd('0x1f')]}));}}}else{_0x437c[_0x68bd('0x1d')](dbH[_0x68bd('0x15')]['query'](QUERY,{'type':dbH[_0x68bd('0x15')][_0x68bd('0x17')]['SELECT']}));}var _0x34d67d=path['dirname'](PATH);var _0x4c0362=path[_0x68bd('0x20')](PATH,_0x68bd('0x21'));var _0x2ec2e9=_0x33b53f['split']&&_0x437c[_0x68bd('0x1a')]>0x1;var _0x48566d=[];if(!fs[_0x68bd('0x22')](path[_0x68bd('0x23')](_0x34d67d,_0x4c0362))&&_0x2ec2e9){fs['mkdirSync'](path[_0x68bd('0x23')](_0x34d67d,_0x4c0362));}return BPromise['each'](_0x437c,function(_0x2cc7e6){_0x48566d['push'](_0x2cc7e6);})[_0x68bd('0x14')](function(){for(var _0x182b50=0x0;_0x182b50<_0x48566d[_0x68bd('0x1a')];_0x182b50+=0x1){var _0x63f96a;var _0x35b449=_0x48566d[_0x182b50];if(_0x2ec2e9){_0x63f96a=path[_0x68bd('0x23')](_0x34d67d,_0x4c0362,util[_0x68bd('0xe')]('%s%d.%s',_0x4c0362,_0x182b50,'xlsx'));}else{_0x63f96a=path[_0x68bd('0x23')](_0x34d67d,util[_0x68bd('0xe')](_0x68bd('0x24'),_0x4c0362,_0x68bd('0x25')));}fs[_0x68bd('0x26')](_0x63f96a,json2xls(_0x35b449),_0x68bd('0x27'));}})[_0x68bd('0x14')](function(){if(_0x2ec2e9){return new Promise(function(_0x5adc2b){zipdir(path[_0x68bd('0x23')](_0x34d67d,_0x4c0362),{'saveTo':path[_0x68bd('0x23')](_0x34d67d,util['format'](_0x68bd('0x24'),_0x4c0362,_0x68bd('0x28')))},function(_0x314ac5,_0x5a4444){rimraf(path[_0x68bd('0x23')](_0x34d67d,_0x4c0362),function(){});_0x5adc2b(_0x68bd('0x29'));});});}})[_0x68bd('0x14')](function(){logger[_0x68bd('0xd')](util[_0x68bd('0xe')](_0x68bd('0x2a'),EXTRACTED_REPORT_ID,_0x68bd('0x10')));return analyticExtractedReport(_0x68bd('0x2b'),_0x2ec2e9?util[_0x68bd('0xe')]('%s.%s',_0x4c0362,_0x2ec2e9?_0x68bd('0x28'):_0x68bd('0x25')):null);});})[_0x68bd('0x2c')](function(_0x4f49a6){logger[_0x68bd('0xd')](util['format'](_0x68bd('0x2d'),EXTRACTED_REPORT_ID,_0x68bd('0x10')),util[_0x68bd('0x2e')](_0x4f49a6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x68bd('0x2f'));})[_0x68bd('0x30')](function(){process[_0x68bd('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x7c7d=['basename','.xlsx','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','num','Empty','length','range','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname'];(function(_0x41000f,_0x1dda63){var _0x5a639e=function(_0x26c86e){while(--_0x26c86e){_0x41000f['push'](_0x41000f['shift']());}};_0x5a639e(++_0x1dda63);}(_0x7c7d,0x158));var _0xd7c7=function(_0x5cb4fc,_0x222fbb){_0x5cb4fc=_0x5cb4fc-0x0;var _0xe29f03=_0x7c7d[_0x5cb4fc];return _0xe29f03;};'use strict';var util=require(_0xd7c7('0x0'));var path=require(_0xd7c7('0x1'));var _=require(_0xd7c7('0x2'));var fs=require('fs');var json2xls=require(_0xd7c7('0x3'));var BPromise=require(_0xd7c7('0x4'));var zipdir=require(_0xd7c7('0x5'));var rimraf=require(_0xd7c7('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0xd7c7('0x7'))[_0xd7c7('0x8')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd7c7('0x9')][0x2]);var QUERY=process[_0xd7c7('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x6d7e8b,_0x2863f4){var _0x7d4690={'status':_0x6d7e8b};var _0x282537={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2863f4){_0x7d4690[_0xd7c7('0xa')]=_0x2863f4;}return db[_0xd7c7('0xb')][_0xd7c7('0xc')](_0x7d4690,_0x282537);}function main(){var _0x24954f=0x1388;var _0x54ae7d;logger[_0xd7c7('0xd')](util[_0xd7c7('0xe')](_0xd7c7('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xd7c7('0x10')][_0xd7c7('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd7c7('0x12'),_0xd7c7('0x13')]})['then'](function(_0x3539a4){if(_0x3539a4){_0x54ae7d=_0x3539a4;_0x24954f=_0x54ae7d['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0xd7c7('0x14')]['query'](util[_0xd7c7('0xe')](_0xd7c7('0x15'),QUERY),{'type':dbH[_0xd7c7('0x14')][_0xd7c7('0x16')][_0xd7c7('0x17')]});})[_0xd7c7('0x18')](function(_0x16843b){if(!_0x16843b[0x0][_0xd7c7('0x19')]){return analyticExtractedReport(_0xd7c7('0x1a'));}var _0x4df993=[];var _0x4326b0=0x0;if(_0x54ae7d['split']){if(_0x16843b&&_0x16843b[_0xd7c7('0x1b')]){var _0x4609a7=_[_0xd7c7('0x1c')](_0x16843b[0x0]['num']/_0x24954f);var _0x26be54=Number[_0xd7c7('0x1d')](_0x16843b[0x0][_0xd7c7('0x19')]/_0x24954f)?_0x16843b[0x0]['num']%_0x24954f:0x0;_0x4609a7['forEach'](function(_0x3df769){if(_0x3df769>0x0){_0x4326b0+=_0x24954f;}_0x4df993[_0xd7c7('0x1e')](dbH['sequelize'][_0xd7c7('0x1f')](util[_0xd7c7('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x24954f,_0x4326b0),{'type':dbH[_0xd7c7('0x14')]['QueryTypes'][_0xd7c7('0x17')]}));});if(_0x26be54>0x0){_0x4326b0+=_0x24954f;_0x4df993[_0xd7c7('0x1e')](dbH[_0xd7c7('0x14')][_0xd7c7('0x1f')](util['format'](_0xd7c7('0x20'),QUERY,_0x26be54,_0x4326b0),{'type':dbH[_0xd7c7('0x14')][_0xd7c7('0x16')][_0xd7c7('0x17')]}));}}}else{_0x4df993[_0xd7c7('0x1e')](dbH[_0xd7c7('0x14')][_0xd7c7('0x1f')](QUERY,{'type':dbH['sequelize'][_0xd7c7('0x16')][_0xd7c7('0x17')]}));}var _0x286654=path[_0xd7c7('0x21')](PATH);var _0x499d2e=path[_0xd7c7('0x22')](PATH,_0xd7c7('0x23'));var _0x48925b=_0x54ae7d['split']&&_0x4df993[_0xd7c7('0x1b')]>0x1;var _0x4ac32b=[];if(!fs['existsSync'](path['join'](_0x286654,_0x499d2e))&&_0x48925b){fs[_0xd7c7('0x24')](path[_0xd7c7('0x25')](_0x286654,_0x499d2e));}return BPromise[_0xd7c7('0x26')](_0x4df993,function(_0x58fe10){_0x4ac32b[_0xd7c7('0x1e')](_0x58fe10);})[_0xd7c7('0x18')](function(){for(var _0x161f0c=0x0;_0x161f0c<_0x4ac32b['length'];_0x161f0c+=0x1){var _0x52a46c;var _0x17ea52=_0x4ac32b[_0x161f0c];if(_0x48925b){_0x52a46c=path['join'](_0x286654,_0x499d2e,util[_0xd7c7('0xe')](_0xd7c7('0x27'),_0x499d2e,_0x161f0c,_0xd7c7('0x28')));}else{_0x52a46c=path[_0xd7c7('0x25')](_0x286654,util[_0xd7c7('0xe')](_0xd7c7('0x29'),_0x499d2e,_0xd7c7('0x28')));}fs['writeFileSync'](_0x52a46c,json2xls(_0x17ea52),_0xd7c7('0x2a'));}})[_0xd7c7('0x18')](function(){if(_0x48925b){return new Promise(function(_0x18bd42){zipdir(path[_0xd7c7('0x25')](_0x286654,_0x499d2e),{'saveTo':path[_0xd7c7('0x25')](_0x286654,util[_0xd7c7('0xe')]('%s.%s',_0x499d2e,'zip'))},function(_0x1932da,_0x337f72){rimraf(path[_0xd7c7('0x25')](_0x286654,_0x499d2e),function(){});_0x18bd42(_0xd7c7('0x2b'));});});}})['then'](function(){logger['info'](util[_0xd7c7('0xe')](_0xd7c7('0x2c'),EXTRACTED_REPORT_ID,_0xd7c7('0x2d')));return analyticExtractedReport(_0xd7c7('0x2e'),_0x48925b?util[_0xd7c7('0xe')](_0xd7c7('0x29'),_0x499d2e,_0x48925b?_0xd7c7('0x2f'):_0xd7c7('0x28')):null);});})[_0xd7c7('0x30')](function(_0x3a715c){logger[_0xd7c7('0xd')](util[_0xd7c7('0xe')](_0xd7c7('0x31'),EXTRACTED_REPORT_ID,_0xd7c7('0x2d')),util[_0xd7c7('0x32')](_0x3a715c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd7c7('0x33'));})[_0xd7c7('0x34')](function(){process[_0xd7c7('0x35')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index c8b5802..39d180a 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 _0x9d96=['*,*,*,*','intervals','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','toLowerCase','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','rewrite','lodash','Interval','findAll','then','models','IntervalId','VoiceExtension','uniq','map','exten','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','context','VoiceExtensionId','CDR(routeid)=','Set','CDR(destination)=','cutdigits','ExecIf','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','updatedAt','interval'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0x9d96,0x194));var _0x69d9=function(_0x3c9d09,_0x511ee7){_0x3c9d09=_0x3c9d09-0x0;var _0x3074be=_0x9d96[_0x3c9d09];return _0x3074be;};'use strict';var _=require(_0x69d9('0x0'));var util=require('util');function rewrite(_0x5f425b,_0x54c9bf){var _0x204909=this;return _0x5f425b['models'][_0x69d9('0x1')][_0x69d9('0x2')]({'raw':!![]})[_0x69d9('0x3')](function(_0x4af839){_0x204909['intervals']=_0x4af839;return _0x5f425b[_0x69d9('0x4')]['VoiceExtension'][_0x69d9('0x2')]({'where':{'IntervalId':_0x54c9bf[_0x69d9('0x5')]},'raw':!![]});})[_0x69d9('0x3')](function(_0x4427f5){return _0x5f425b[_0x69d9('0x4')][_0x69d9('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x69d9('0x7')](_[_0x69d9('0x8')](_0x4427f5,_0x69d9('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x69d9('0x3')](function(_0x5831c1){var _0x364620=_['filter'](_0x5831c1,{'priority':'1'});var _0x2139c1=_['filter'](_0x5831c1,{'isApp':0x1});var _0x148255=_[_0x69d9('0xa')](_0x2139c1,_0x69d9('0x9'));var _0x218b28=[_0x69d9('0xb'),'playback'];var _0x2e2584=[];var _0x584a8b=[];for(var _0x4ceb2b in _0x148255){if(_0x148255[_0x69d9('0xc')](_0x4ceb2b)){_0x204909[_0x69d9('0xd')]=0x2;_0x204909[_0x69d9('0xe')]=[];_0x204909[_0x69d9('0xf')]=_[_0x69d9('0x10')](_0x364620,{'exten':_0x148255[_0x4ceb2b][0x0]['exten']});_0x204909[_0x69d9('0xe')][_0x69d9('0x11')]({'type':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')],'app':'Set','appdata':util[_0x69d9('0x13')](_0x69d9('0x14'),_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')]),'context':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x15')],'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'priority':_0x204909[_0x69d9('0xd')]++,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]});if(_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')]==='inbound'){_0x204909['extensions'][_0x69d9('0x11')]({'type':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')],'app':'Set','appdata':_0x69d9('0x17')+_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')],'context':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x15')],'exten':_0x148255[_0x4ceb2b][0x0]['exten'],'priority':_0x204909['priority']++,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0]['VoiceExtensionId']});}else if(_0x148255[_0x4ceb2b][0x0]['type']==='outbound'){if(_0x204909[_0x69d9('0xf')]){_0x204909[_0x69d9('0xe')][_0x69d9('0x11')]({'type':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')],'app':_0x69d9('0x18'),'appdata':_0x69d9('0x19')+(_0x204909['extension'][_0x69d9('0x1a')]?'${EXTEN:'+_0x204909['extension']['cutdigits']+'}':'${EXTEN}'),'context':_0x148255[_0x4ceb2b][0x0]['context'],'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'priority':_0x204909[_0x69d9('0xd')]++,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]});}_0x204909[_0x69d9('0xe')]['push']({'type':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')],'app':_0x69d9('0x18'),'appdata':_0x69d9('0x17')+_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')],'context':_0x148255[_0x4ceb2b][0x0]['context'],'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'priority':_0x204909[_0x69d9('0xd')]++,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]});var _0x42a92a=_0x204909[_0x69d9('0xd')]++;_0x204909[_0x69d9('0xe')]['push']({'type':_0x148255[_0x4ceb2b][0x0]['type'],'app':_0x69d9('0x1b'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x42a92a+0x2)+'):Goto('+(_0x42a92a+0x1)+')','context':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x15')],'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'priority':_0x42a92a,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]});if(_0x204909[_0x69d9('0xf')]){_0x204909[_0x69d9('0xe')][_0x69d9('0x11')]({'type':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')],'app':_0x69d9('0x18'),'appdata':_0x204909[_0x69d9('0xf')][_0x69d9('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x204909[_0x69d9('0xf')]['cutdigits']+'}':_0x69d9('0x1c'),'context':_0x148255[_0x4ceb2b][0x0]['context'],'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'priority':_0x204909[_0x69d9('0xd')]++,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]});}_0x204909[_0x69d9('0xe')][_0x69d9('0x11')]({'type':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')],'app':'Set','appdata':_0x69d9('0x1d')+_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')],'context':_0x148255[_0x4ceb2b][0x0]['context'],'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'priority':_0x204909[_0x69d9('0xd')]++,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]});if(_0x204909[_0x69d9('0xf')]&&_0x204909['extension'][_0x69d9('0xc')](_0x69d9('0x1e'))&&_0x204909[_0x69d9('0xf')][_0x69d9('0x1e')]!==_0x69d9('0x1f')){_0x204909[_0x69d9('0xe')]['push']({'type':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x148255[_0x4ceb2b][0x0]['context'],'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'priority':_0x204909[_0x69d9('0xd')]++,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]});_0x204909['extensions']['push']({'type':_0x148255[_0x4ceb2b][0x0]['type'],'app':_0x69d9('0x18'),'appdata':_0x69d9('0x20')+_0x204909[_0x69d9('0xf')][_0x69d9('0x1e')]||'wav','context':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x15')],'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'priority':_0x204909[_0x69d9('0xd')]++,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]});}}_0x204909[_0x69d9('0xe')][_0x69d9('0x11')]({'type':_0x148255[_0x4ceb2b][0x0]['type'],'app':_0x69d9('0x18'),'appdata':_0x69d9('0x21'),'context':_0x148255[_0x4ceb2b][0x0]['context'],'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'priority':_0x204909[_0x69d9('0xd')]++,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0]['VoiceExtensionId']});_0x204909[_0x69d9('0xe')][_0x69d9('0x11')]({'type':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x15')],'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'priority':_0x204909[_0x69d9('0xd')]++,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]});_0x204909['extensions']['push']({'type':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')],'app':_0x69d9('0x18'),'appdata':_0x69d9('0x22'),'context':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x15')],'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'priority':_0x204909[_0x69d9('0xd')]++,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]});for(var _0x19268b=0x0,_0x44c2ca=0x0;_0x19268b<_0x148255[_0x4ceb2b]['length'];_0x19268b+=0x1,_0x44c2ca=0x0){var _0x4c433e=_0x148255[_0x4ceb2b][_0x19268b];if(_0x4c433e[_0x69d9('0x12')]){_0x4c433e[_0x69d9('0x12')]=_0x4c433e[_0x69d9('0x12')]['toLowerCase']();}var _0x3d1178=[];var _0x2e464a=[];delete _0x4c433e['id'];delete _0x4c433e['createdAt'];delete _0x4c433e[_0x69d9('0x23')];var _0xc1f9bf=_0x4c433e[_0x69d9('0x24')]!==_0x69d9('0x25')?[_0x4c433e['interval']]:_0x4c433e[_0x69d9('0x5')]?_[_0x69d9('0x8')](_['filter'](_0x204909[_0x69d9('0x26')],{'IntervalId':_0x4c433e[_0x69d9('0x5')]}),_0x69d9('0x24')):[];if(_0x4c433e[_0x69d9('0xc')](_0x69d9('0x27'))){if(_0x4c433e[_0x69d9('0x27')]&&_0x4c433e[_0x69d9('0x27')]!=='--'){_0x3d1178['push']({'type':_0x4c433e[_0x69d9('0x12')],'app':'Set','appdata':_0x69d9('0x28')+_0x4c433e[_0x69d9('0x27')],'context':_0x4c433e[_0x69d9('0x15')],'exten':_0x4c433e[_0x69d9('0x9')],'priority':_0xc1f9bf['length']+_0x204909[_0x69d9('0xd')]+_0x44c2ca++,'VoiceExtensionId':_0x4c433e[_0x69d9('0x16')]});}}if(_0x4c433e[_0x69d9('0x12')]===_0x69d9('0x29')&&_0x4c433e[_0x69d9('0xc')](_0x69d9('0x2a'))){if(_0x4c433e['callerID']){_0x3d1178[_0x69d9('0x11')]({'type':_0x4c433e[_0x69d9('0x12')],'app':_0x69d9('0x1b'),'appdata':_0x69d9('0x2b')+_0x4c433e[_0x69d9('0x2a')]+')','context':_0x4c433e['context'],'exten':_0x4c433e[_0x69d9('0x9')],'priority':_0xc1f9bf[_0x69d9('0x2c')]+_0x204909['priority']+_0x44c2ca++,'VoiceExtensionId':_0x4c433e[_0x69d9('0x16')]});}else{_0x3d1178[_0x69d9('0x11')]({'type':_0x4c433e['type'],'app':'ExecIf','appdata':_0x69d9('0x2d'),'context':_0x4c433e[_0x69d9('0x15')],'exten':_0x4c433e['exten'],'priority':_0xc1f9bf[_0x69d9('0x2c')]+_0x204909[_0x69d9('0xd')]+_0x44c2ca++,'VoiceExtensionId':_0x4c433e[_0x69d9('0x16')]});}}if(_0x4c433e['hasOwnProperty'](_0x69d9('0x2e'))){if(_0x218b28['indexOf'](_0x4c433e[_0x69d9('0x2f')][_0x69d9('0x30')]())>=0x0&&_0x4c433e['appType']!==_0x69d9('0x31')){if(_0x4c433e[_0x69d9('0x2e')]){_0x3d1178['push']({'type':_0x4c433e[_0x69d9('0x12')],'app':'ExecIf','appdata':_0x69d9('0x32'),'context':_0x4c433e['context'],'exten':_0x4c433e[_0x69d9('0x9')],'priority':_0xc1f9bf['length']+_0x204909['priority']+_0x44c2ca++,'VoiceExtensionId':_0x4c433e[_0x69d9('0x16')]});_0x3d1178[_0x69d9('0x11')]({'type':_0x4c433e['type'],'app':_0x69d9('0x18'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4c433e[_0x69d9('0x15')],'exten':_0x4c433e[_0x69d9('0x9')],'priority':_0xc1f9bf['length']+_0x204909[_0x69d9('0xd')]+_0x44c2ca++,'VoiceExtensionId':_0x4c433e[_0x69d9('0x16')]});}else{_0x3d1178['push']({'type':_0x4c433e[_0x69d9('0x12')],'app':_0x69d9('0x1b'),'appdata':_0x69d9('0x33'),'context':_0x4c433e[_0x69d9('0x15')],'exten':_0x4c433e[_0x69d9('0x9')],'priority':_0xc1f9bf[_0x69d9('0x2c')]+_0x204909[_0x69d9('0xd')]+_0x44c2ca++,'VoiceExtensionId':_0x4c433e[_0x69d9('0x16')]});_0x3d1178[_0x69d9('0x11')]({'type':_0x4c433e[_0x69d9('0x12')],'app':_0x69d9('0x18'),'appdata':_0x69d9('0x34'),'context':_0x4c433e['context'],'exten':_0x4c433e['exten'],'priority':_0xc1f9bf['length']+_0x204909[_0x69d9('0xd')]+_0x44c2ca++,'VoiceExtensionId':_0x4c433e['VoiceExtensionId']});}}}for(var _0x5ace6c=0x0;_0x5ace6c<_0xc1f9bf[_0x69d9('0x2c')];_0x5ace6c+=0x1){var _0x23e416=_0x204909[_0x69d9('0xd')]+_0xc1f9bf['length'];var _0x3844d9=_0x5ace6c===_0xc1f9bf[_0x69d9('0x2c')]-0x1?_0x204909[_0x69d9('0xd')]+_0x3d1178[_0x69d9('0x2c')]+_0x2e464a[_0x69d9('0x2c')]+0x2:_0x204909[_0x69d9('0xd')]+_0x5ace6c+0x1;_0x3d1178[_0x69d9('0x35')](_0x5ace6c,0x0,{'type':_0x4c433e[_0x69d9('0x12')],'app':_0x69d9('0x36'),'appdata':_0xc1f9bf[_0x5ace6c]+'?'+_0x4c433e['context']+_0x69d9('0x37')+_0x23e416+':'+_0x4c433e[_0x69d9('0x15')]+_0x69d9('0x37')+_0x3844d9,'exten':_0x4c433e[_0x69d9('0x9')],'context':_0x4c433e[_0x69d9('0x15')],'priority':_0x204909['priority']+_0x5ace6c,'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0]['VoiceExtensionId']});}_0x4c433e[_0x69d9('0xd')]=_0x3d1178[_0x69d9('0x2c')]?_[_0x69d9('0x38')](_0x3d1178)['priority']+0x1:_0x204909['priority'];_0x204909[_0x69d9('0xd')]=(_0x2e464a[_0x69d9('0x2c')]?_[_0x69d9('0x38')](_0x2e464a)[_0x69d9('0xd')]:_0x4c433e[_0x69d9('0xd')])+0x1;_0x204909['extensions']=_[_0x69d9('0x39')](_0x204909['extensions'],_0x3d1178,[_0x4c433e],_0x2e464a);}_0x204909['extensions'][_0x69d9('0x11')]({'type':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x12')],'app':_0x69d9('0x3a'),'exten':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x9')],'context':_0x148255[_0x4ceb2b][0x0]['context'],'priority':_0x204909[_0x69d9('0xd')],'VoiceExtensionId':_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]});_0x2e2584[_0x69d9('0x11')](_0x148255[_0x4ceb2b][0x0][_0x69d9('0x16')]);_0x584a8b=_[_0x69d9('0x39')](_0x584a8b,_0x204909[_0x69d9('0xe')]);}}return _0x5f425b[_0x69d9('0x3b')](function(_0x25df26){return _0x5f425b['models']['VoiceExtension'][_0x69d9('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x2e2584}},'transaction':_0x25df26})[_0x69d9('0x3')](function(_0x4cc909){return _0x5f425b[_0x69d9('0x4')][_0x69d9('0x6')][_0x69d9('0x3d')](_['sortBy'](_0x584a8b,'priority'),{'transaction':_0x25df26});});});})['catch'](function(_0x2c76dc){console['error'](_0x2c76dc);});}exports[_0x69d9('0x3e')]=rewrite; \ No newline at end of file +var _0x89e4=['find','push','type','format','CDR(type)=%s','inbound','extensions','Set','CDR(routeid)=','VoiceExtensionId','context','outbound','cutdigits','${EXTEN:','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','filter','queue','playback','hasOwnProperty','priority','extension'];(function(_0x4e912a,_0x34f952){var _0x99773d=function(_0x1b0b06){while(--_0x1b0b06){_0x4e912a['push'](_0x4e912a['shift']());}};_0x99773d(++_0x34f952);}(_0x89e4,0x19e));var _0x489e=function(_0xa7fc59,_0x3c90e8){_0xa7fc59=_0xa7fc59-0x0;var _0x31a399=_0x89e4[_0xa7fc59];return _0x31a399;};'use strict';var _=require(_0x489e('0x0'));var util=require(_0x489e('0x1'));function rewrite(_0x1fa71b,_0x5a2374){var _0x7eab59=this;return _0x1fa71b[_0x489e('0x2')][_0x489e('0x3')][_0x489e('0x4')]({'raw':!![]})[_0x489e('0x5')](function(_0x1bf5e8){_0x7eab59[_0x489e('0x6')]=_0x1bf5e8;return _0x1fa71b['models'][_0x489e('0x7')][_0x489e('0x4')]({'where':{'IntervalId':_0x5a2374[_0x489e('0x8')]},'raw':!![]});})[_0x489e('0x5')](function(_0x1d0c5d){return _0x1fa71b[_0x489e('0x2')][_0x489e('0x7')][_0x489e('0x4')]({'where':{'exten':{'$in':_[_0x489e('0x9')](_[_0x489e('0xa')](_0x1d0c5d,_0x489e('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x489e('0x5')](function(_0x1ed20f){var _0x4066e6=_[_0x489e('0xc')](_0x1ed20f,{'priority':'1'});var _0x5e1d26=_[_0x489e('0xc')](_0x1ed20f,{'isApp':0x1});var _0x3679d7=_['groupBy'](_0x5e1d26,_0x489e('0xb'));var _0x3750cd=[_0x489e('0xd'),_0x489e('0xe')];var _0x5b13ba=[];var _0x46418d=[];for(var _0x31429e in _0x3679d7){if(_0x3679d7[_0x489e('0xf')](_0x31429e)){_0x7eab59[_0x489e('0x10')]=0x2;_0x7eab59['extensions']=[];_0x7eab59[_0x489e('0x11')]=_[_0x489e('0x12')](_0x4066e6,{'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')]});_0x7eab59['extensions'][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':'Set','appdata':util[_0x489e('0x15')](_0x489e('0x16'),_0x3679d7[_0x31429e][0x0][_0x489e('0x14')]),'context':_0x3679d7[_0x31429e][0x0]['context'],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59['priority']++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0]['VoiceExtensionId']});if(_0x3679d7[_0x31429e][0x0][_0x489e('0x14')]===_0x489e('0x17')){_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x489e('0x1a')+_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')],'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0]['exten'],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});}else if(_0x3679d7[_0x31429e][0x0][_0x489e('0x14')]===_0x489e('0x1d')){if(_0x7eab59[_0x489e('0x11')]){_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':'Set','appdata':'CDR(destination)='+(_0x7eab59[_0x489e('0x11')][_0x489e('0x1e')]?_0x489e('0x1f')+_0x7eab59[_0x489e('0x11')]['cutdigits']+'}':_0x489e('0x20')),'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0]['VoiceExtensionId']});}_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x489e('0x1a')+_0x3679d7[_0x31429e][0x0]['VoiceExtensionId'],'context':_0x3679d7[_0x31429e][0x0]['context'],'exten':_0x3679d7[_0x31429e][0x0]['exten'],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});var _0x5da28d=_0x7eab59[_0x489e('0x10')]++;_0x7eab59[_0x489e('0x18')]['push']({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5da28d+0x2)+_0x489e('0x21')+(_0x5da28d+0x1)+')','context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0]['exten'],'priority':_0x5da28d,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});if(_0x7eab59['extension']){_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x7eab59[_0x489e('0x11')]['cutdigits']?_0x489e('0x22')+_0x7eab59[_0x489e('0x11')][_0x489e('0x1e')]+'}':_0x489e('0x23'),'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0]['exten'],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});}_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':'outboundrouteid='+_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')],'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});if(_0x7eab59['extension']&&_0x7eab59[_0x489e('0x11')][_0x489e('0xf')](_0x489e('0x24'))&&_0x7eab59[_0x489e('0x11')][_0x489e('0x24')]!=='none'){_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x489e('0x25'),'context':_0x3679d7[_0x31429e][0x0]['context'],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});_0x7eab59['extensions']['push']({'type':_0x3679d7[_0x31429e][0x0]['type'],'app':'Set','appdata':_0x489e('0x26')+_0x7eab59[_0x489e('0x11')][_0x489e('0x24')]||_0x489e('0x27'),'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});}}_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x489e('0x28'),'context':_0x3679d7[_0x31429e][0x0]['context'],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':'Set','appdata':_0x489e('0x29'),'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0]['VoiceExtensionId']});_0x7eab59[_0x489e('0x18')]['push']({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x489e('0x2a'),'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});for(var _0x46a453=0x0,_0x3dd9e5=0x0;_0x46a453<_0x3679d7[_0x31429e][_0x489e('0x2b')];_0x46a453+=0x1,_0x3dd9e5=0x0){var _0x3f1fb6=_0x3679d7[_0x31429e][_0x46a453];if(_0x3f1fb6[_0x489e('0x14')]){_0x3f1fb6[_0x489e('0x14')]=_0x3f1fb6[_0x489e('0x14')][_0x489e('0x2c')]();}var _0x201a60=[];var _0x28e464=[];delete _0x3f1fb6['id'];delete _0x3f1fb6[_0x489e('0x2d')];delete _0x3f1fb6['updatedAt'];var _0x3797e4=_0x3f1fb6['interval']!=='*,*,*,*'?[_0x3f1fb6[_0x489e('0x2e')]]:_0x3f1fb6[_0x489e('0x8')]?_['map'](_[_0x489e('0xc')](_0x7eab59[_0x489e('0x6')],{'IntervalId':_0x3f1fb6[_0x489e('0x8')]}),_0x489e('0x2e')):[];if(_0x3f1fb6['hasOwnProperty'](_0x489e('0x2f'))){if(_0x3f1fb6['tag']&&_0x3f1fb6[_0x489e('0x2f')]!=='--'){_0x201a60[_0x489e('0x13')]({'type':_0x3f1fb6[_0x489e('0x14')],'app':'Set','appdata':_0x489e('0x30')+_0x3f1fb6[_0x489e('0x2f')],'context':_0x3f1fb6[_0x489e('0x1c')],'exten':_0x3f1fb6[_0x489e('0xb')],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6[_0x489e('0x1b')]});}}if(_0x3f1fb6[_0x489e('0x14')]===_0x489e('0x1d')&&_0x3f1fb6[_0x489e('0xf')](_0x489e('0x31'))){if(_0x3f1fb6[_0x489e('0x31')]){_0x201a60['push']({'type':_0x3f1fb6[_0x489e('0x14')],'app':_0x489e('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3f1fb6[_0x489e('0x31')]+')','context':_0x3f1fb6[_0x489e('0x1c')],'exten':_0x3f1fb6['exten'],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6['VoiceExtensionId']});}else{_0x201a60[_0x489e('0x13')]({'type':_0x3f1fb6[_0x489e('0x14')],'app':_0x489e('0x32'),'appdata':_0x489e('0x33'),'context':_0x3f1fb6[_0x489e('0x1c')],'exten':_0x3f1fb6[_0x489e('0xb')],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6[_0x489e('0x1b')]});}}if(_0x3f1fb6[_0x489e('0xf')](_0x489e('0x34'))){if(_0x3750cd[_0x489e('0x35')](_0x3f1fb6[_0x489e('0x36')][_0x489e('0x2c')]())>=0x0&&_0x3f1fb6[_0x489e('0x37')]!==_0x489e('0x38')){if(_0x3f1fb6[_0x489e('0x34')]){_0x201a60['push']({'type':_0x3f1fb6[_0x489e('0x14')],'app':_0x489e('0x32'),'appdata':_0x489e('0x39'),'context':_0x3f1fb6[_0x489e('0x1c')],'exten':_0x3f1fb6[_0x489e('0xb')],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6[_0x489e('0x1b')]});_0x201a60['push']({'type':_0x3f1fb6[_0x489e('0x14')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3f1fb6['context'],'exten':_0x3f1fb6['exten'],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6['VoiceExtensionId']});}else{_0x201a60[_0x489e('0x13')]({'type':_0x3f1fb6[_0x489e('0x14')],'app':_0x489e('0x32'),'appdata':_0x489e('0x3a'),'context':_0x3f1fb6['context'],'exten':_0x3f1fb6[_0x489e('0xb')],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6[_0x489e('0x1b')]});_0x201a60[_0x489e('0x13')]({'type':_0x3f1fb6['type'],'app':'Set','appdata':_0x489e('0x3b'),'context':_0x3f1fb6[_0x489e('0x1c')],'exten':_0x3f1fb6[_0x489e('0xb')],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6[_0x489e('0x1b')]});}}}for(var _0x311b27=0x0;_0x311b27<_0x3797e4['length'];_0x311b27+=0x1){var _0xe0664b=_0x7eab59[_0x489e('0x10')]+_0x3797e4['length'];var _0x32bca2=_0x311b27===_0x3797e4[_0x489e('0x2b')]-0x1?_0x7eab59[_0x489e('0x10')]+_0x201a60[_0x489e('0x2b')]+_0x28e464[_0x489e('0x2b')]+0x2:_0x7eab59[_0x489e('0x10')]+_0x311b27+0x1;_0x201a60[_0x489e('0x3c')](_0x311b27,0x0,{'type':_0x3f1fb6['type'],'app':_0x489e('0x3d'),'appdata':_0x3797e4[_0x311b27]+'?'+_0x3f1fb6[_0x489e('0x1c')]+_0x489e('0x3e')+_0xe0664b+':'+_0x3f1fb6[_0x489e('0x1c')]+_0x489e('0x3e')+_0x32bca2,'exten':_0x3f1fb6[_0x489e('0xb')],'context':_0x3f1fb6[_0x489e('0x1c')],'priority':_0x7eab59['priority']+_0x311b27,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});}_0x3f1fb6[_0x489e('0x10')]=_0x201a60[_0x489e('0x2b')]?_[_0x489e('0x3f')](_0x201a60)[_0x489e('0x10')]+0x1:_0x7eab59['priority'];_0x7eab59[_0x489e('0x10')]=(_0x28e464[_0x489e('0x2b')]?_[_0x489e('0x3f')](_0x28e464)['priority']:_0x3f1fb6[_0x489e('0x10')])+0x1;_0x7eab59[_0x489e('0x18')]=_[_0x489e('0x40')](_0x7eab59[_0x489e('0x18')],_0x201a60,[_0x3f1fb6],_0x28e464);}_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':'Hangup','exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'priority':_0x7eab59[_0x489e('0x10')],'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});_0x5b13ba['push'](_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]);_0x46418d=_[_0x489e('0x40')](_0x46418d,_0x7eab59['extensions']);}}return _0x1fa71b[_0x489e('0x41')](function(_0x3178b3){return _0x1fa71b[_0x489e('0x2')][_0x489e('0x7')][_0x489e('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x5b13ba}},'transaction':_0x3178b3})[_0x489e('0x5')](function(_0x2420bd){return _0x1fa71b['models']['VoiceExtension'][_0x489e('0x43')](_[_0x489e('0x44')](_0x46418d,_0x489e('0x10')),{'transaction':_0x3178b3});});});})[_0x489e('0x45')](function(_0x47b2a7){console[_0x489e('0x46')](_0x47b2a7);});}exports[_0x489e('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 65c988c..abe0f17 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 _0xe566=['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','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','Error\x20while\x20creating\x20contact:\x20','message','cmContact','checkHopper','inspect','insert','into','fromQuery','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','cm_hopper','\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_contacts','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','findAll','BlackLists','get','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','stringify','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!'];(function(_0x1f91e9,_0x5b564c){var _0x232b5b=function(_0x2baf7a){while(--_0x2baf7a){_0x1f91e9['push'](_0x1f91e9['shift']());}};_0x232b5b(++_0x5b564c);}(_0xe566,0x1a9));var _0x6e56=function(_0x50a5aa,_0x578069){_0x50a5aa=_0x50a5aa-0x0;var _0x2b9f65=_0xe566[_0x50a5aa];return _0x2b9f65;};'use strict';var BPromise=require('bluebird');var util=require(_0x6e56('0x0'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x6e56('0x1'));var Redis=require(_0x6e56('0x2'));var db=require(_0x6e56('0x3'))['db'];var config=require(_0x6e56('0x4'));var logger=require(_0x6e56('0x5'))(_0x6e56('0x6'));config[_0x6e56('0x7')]=_[_0x6e56('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e56('0x7')]));require(_0x6e56('0x9'))['register'](socket);try{if(!process[_0x6e56('0xa')][0x2]||process[_0x6e56('0xa')][0x2]===_0x6e56('0xb')||process[_0x6e56('0xa')][0x2]===_0x6e56('0xc')){throw new Error(_0x6e56('0xd'));}var FILEPATH=process[_0x6e56('0xa')][0x2];if(!process[_0x6e56('0xa')][0x3]||process['argv'][0x3]===_0x6e56('0xb')||process[_0x6e56('0xa')][0x3]==='null'||!process[_0x6e56('0xa')][0x4]||process[_0x6e56('0xa')][0x4]==='undefined'||process[_0x6e56('0xa')][0x4]===_0x6e56('0xc')){throw new Error(_0x6e56('0xe'));}var FIELDS=_[_0x6e56('0xf')](process[_0x6e56('0xa')][0x3][_0x6e56('0x10')](','),process[_0x6e56('0xa')][0x4][_0x6e56('0x10')](','));if(!process[_0x6e56('0xa')][0x5]||process[_0x6e56('0xa')][0x5]===_0x6e56('0xb')||process['argv'][0x5]===_0x6e56('0xc')){throw new Error(_0x6e56('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x6e56('0xa')][0x6]&&process[_0x6e56('0xa')][0x6]!==_0x6e56('0xb')&&process['argv'][0x6]!==_0x6e56('0xc')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x6e56('0xa')][0x7]!==_0x6e56('0xc')?process['argv'][0x7]:null;if(!process[_0x6e56('0xa')][0x8]||process[_0x6e56('0xa')][0x8]===_0x6e56('0xb')||process['argv'][0x8]===_0x6e56('0xc')){throw new Error(_0x6e56('0x12'));}var SOCKET_TIMESTAMP=process[_0x6e56('0xa')][0x8];}catch(_0x20eb63){logger[_0x6e56('0x13')](_0x20eb63);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(_0x59c065,_0x3faaa1,_0x507cb1,_0x17715e){var _0x28aed0={'message':_0x3faaa1};_0x28aed0[_0x59c065]=!![];if(_0x507cb1){_0x28aed0[_0x6e56('0x14')]=_0x507cb1;}if(_0x17715e){_0x28aed0[_0x6e56('0x15')]=_0x17715e;}return _0x28aed0;}function isEmail(_0x1fbdf5){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))*$/[_0x6e56('0x16')](_0x1fbdf5);}function checkRow(_0x49e846,_0x1085d2,_0x19e927){return new BPromise(function(_0x4555b0,_0x6fa6a6){if(_[_0x6e56('0x17')](_0x49e846)){return _0x6fa6a6(handleCheckRowError('error',_0x6e56('0x18'),null,_0x19e927));}if(_0x49e846[_0x6e56('0x19')]&&_0x49e846[_0x6e56('0x19')]['length']){var _0x21c873=_[_0x6e56('0x1a')](_0x49e846[_0x6e56('0x19')],'message')[_0x6e56('0x1b')](';');return _0x6fa6a6(handleCheckRowError('error',_0x21c873,null,_0x19e927));}var _0x485fa5={};for(var _0x21c91a in FIELDS){if(FIELDS[_0x6e56('0x1c')](_0x21c91a)&&FIELDS[_0x21c91a]){_0x485fa5[_0x21c91a]=_0x49e846[_0x6e56('0x1d')][0x0][FIELDS[_0x21c91a]]||_0x49e846['data'][0x0]['\ufeff'+FIELDS[_0x21c91a]];}}if(!_0x485fa5[_0x6e56('0x1e')]){return _0x6fa6a6(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x19e927));}if(!_0x485fa5[_0x6e56('0x1f')]){return _0x6fa6a6(handleCheckRowError('error',_0x6e56('0x20'),null,_0x19e927));}if(_0x485fa5[_0x6e56('0x21')]){var _0x3f6915=moment(_0x485fa5[_0x6e56('0x21')],'YYYY-MM-DD');if(!_0x3f6915[_0x6e56('0x22')]()){return _0x6fa6a6(handleCheckRowError(_0x6e56('0x13'),_0x6e56('0x23'),null,_0x19e927));}}if(_0x485fa5[_0x6e56('0x24')]){if(!isEmail(_0x485fa5[_0x6e56('0x24')])){return _0x6fa6a6(handleCheckRowError(_0x6e56('0x13'),'email\x20format\x20is\x20not\x20valid!',null,_0x19e927));}}_0x485fa5[_0x6e56('0x25')]=LISTID;_0x485fa5[_0x6e56('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6e56('0x27')]&&_0x1085d2){var _0x1047d2={};for(var _0xfb38d9=0x0,_0x1fa601=DUPLICATES[_0x6e56('0x27')];_0xfb38d9<_0x1fa601;_0xfb38d9+=0x1){_0x1047d2[DUPLICATES[_0xfb38d9]]=_0x485fa5[DUPLICATES[_0xfb38d9]];}var _0x43db27=_[_0x6e56('0x28')](_0x1085d2,_0x1047d2);if(_0x43db27){return _0x6fa6a6(handleCheckRowError(_0x6e56('0x29'),_0x6e56('0x2a'),_0x43db27,_0x19e927));}}return db[_0x6e56('0x2b')][_0x6e56('0x2c')](_0x485fa5,{'raw':!![],'hooks':![],'fields':_[_0x6e56('0x2d')](_0x485fa5)})[_0x6e56('0x2e')](function(_0x2330c0){if(DUPLICATES&&DUPLICATES[_0x6e56('0x27')]&&_0x1085d2){_0x1085d2[_0x6e56('0x2f')](_['pick'](_0x485fa5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2330c0['id'];return _0x4555b0();})['catch'](function(_0x362d8){return _0x6fa6a6(handleCheckRowError(_0x6e56('0x13'),_0x6e56('0x30')+(_0x362d8[_0x6e56('0x31')]||JSON['stringify'](_0x362d8)),null,_0x19e927));});});}function checkHopper(){function _0x1f7394(){return function(_0xbc1c4a){logger['error'](_0x6e56('0x32'),_0x6e56('0x33'),util[_0x6e56('0x34')](_0xbc1c4a,{'showHidden':![],'depth':null}));};}var _0x3f3371=function(_0x2a929e,_0x5d22f6){var _0x1ca51c=squel[_0x6e56('0x35')]()[_0x6e56('0x36')]('cm_hopper')[_0x6e56('0x37')](['phone','scheduledAt',_0x6e56('0x38'),'ListId',_0x5d22f6,_0x6e56('0x39'),_0x6e56('0x3a')],squel[_0x6e56('0x3b')]()[_0x6e56('0x3c')](_0x6e56('0x1f'),_0x6e56('0x1f'))[_0x6e56('0x3c')](_0x6e56('0x3d'),_0x6e56('0x3e'))[_0x6e56('0x3c')]('id','ContactId')['field'](LISTID[_0x6e56('0x3f')](),'ListId')[_0x6e56('0x3c')](_0x2a929e['id'][_0x6e56('0x3f')](),_0x5d22f6)[_0x6e56('0x3c')](_0x6e56('0x3d'),_0x6e56('0x39'))[_0x6e56('0x3c')](_0x6e56('0x3d'),_0x6e56('0x3a'))['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x6e56('0x40')](_0x6e56('0x41'),LISTID['toString']())[_0x6e56('0x40')](_0x6e56('0x42'))[_0x6e56('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e56('0x3b')]()[_0x6e56('0x3c')]('phone')[_0x6e56('0x43')](_0x6e56('0x44'))[_0x6e56('0x40')](_0x5d22f6+_0x6e56('0x45'),_0x2a929e['id'][_0x6e56('0x3f')]())))[_0x6e56('0x3f')]();return _0x1ca51c;};var _0x2bc8ac=function(_0x71c319,_0x40caee){var _0x40d258=squel[_0x6e56('0x35')]()[_0x6e56('0x36')](_0x6e56('0x44'))[_0x6e56('0x37')]([_0x6e56('0x1f'),_0x6e56('0x3e'),_0x6e56('0x38'),'ListId',_0x40caee,_0x6e56('0x39'),_0x6e56('0x3a')],squel[_0x6e56('0x3b')]()[_0x6e56('0x3c')](_0x6e56('0x1f'),'phone')[_0x6e56('0x3c')](_0x6e56('0x3d'),'scheduledAt')[_0x6e56('0x3c')]('id',_0x6e56('0x38'))['field'](LISTID[_0x6e56('0x3f')](),_0x6e56('0x25'))[_0x6e56('0x3c')](_0x71c319['id'][_0x6e56('0x3f')](),_0x40caee)[_0x6e56('0x3c')]('NOW()',_0x6e56('0x39'))[_0x6e56('0x3c')](_0x6e56('0x3d'),_0x6e56('0x3a'))['from']('cm_contacts')[_0x6e56('0x40')](_0x6e56('0x46'))['where'](_0x6e56('0x41'),LISTID[_0x6e56('0x3f')]())['where'](_0x6e56('0x47'),squel[_0x6e56('0x48')](hopperContacts))[_0x6e56('0x40')](_0x6e56('0x42'))['where'](_0x6e56('0x49'),squel[_0x6e56('0x3b')]()['field'](_0x6e56('0x4a'))['from']('cm_hopper_final')[_0x6e56('0x40')](_0x40caee+_0x6e56('0x45'),_0x71c319['id'][_0x6e56('0x3f')]()))[_0x6e56('0x40')](_0x6e56('0x49'),squel['select']()['field'](_0x6e56('0x1f'))[_0x6e56('0x43')]('cm_hopper')[_0x6e56('0x40')](_0x40caee+_0x6e56('0x45'),_0x71c319['id'][_0x6e56('0x3f')]())))[_0x6e56('0x3f')]();return _0x40d258;};function _0xe884c8(_0x124e21,_0x13f6bd){var _0x51feba=squel[_0x6e56('0x35')]()[_0x6e56('0x36')](_0x6e56('0x44'))[_0x6e56('0x37')]([_0x6e56('0x1f'),_0x6e56('0x3e'),_0x6e56('0x38'),_0x6e56('0x25'),_0x13f6bd,_0x6e56('0x39'),'updatedAt'],squel[_0x6e56('0x3b')]()[_0x6e56('0x3c')](_0x6e56('0x1f'),'phone')[_0x6e56('0x3c')]('NOW()',_0x6e56('0x3e'))['field']('id',_0x6e56('0x38'))[_0x6e56('0x3c')](LISTID[_0x6e56('0x3f')](),'ListId')['field'](_0x124e21['id'][_0x6e56('0x3f')](),_0x13f6bd)[_0x6e56('0x3c')]('NOW()',_0x6e56('0x39'))['field'](_0x6e56('0x3d'),'updatedAt')['from'](_0x6e56('0x4b'))[_0x6e56('0x40')](_0x6e56('0x46'))[_0x6e56('0x40')](_0x6e56('0x41'),LISTID[_0x6e56('0x3f')]())[_0x6e56('0x40')](_0x6e56('0x47'),squel['str'](hopperContacts))[_0x6e56('0x40')](_0x6e56('0x42')))['toString']();return _0x51feba;}function _0x55ec6e(_0x59483b,_0x256b99){var _0x2522ab=squel[_0x6e56('0x35')]()[_0x6e56('0x36')]('cm_hopper_black')[_0x6e56('0x37')]([_0x6e56('0x1f'),'ContactId',_0x6e56('0x25'),_0x256b99,_0x6e56('0x39'),_0x6e56('0x3a')],squel[_0x6e56('0x3b')]()['field'](_0x6e56('0x1f'),_0x6e56('0x1f'))[_0x6e56('0x3c')]('id',_0x6e56('0x38'))['field'](LISTID[_0x6e56('0x3f')](),'ListId')[_0x6e56('0x3c')](_0x59483b['id']['toString'](),_0x256b99)[_0x6e56('0x3c')]('NOW()',_0x6e56('0x39'))[_0x6e56('0x3c')](_0x6e56('0x3d'),_0x6e56('0x3a'))[_0x6e56('0x43')]('cm_contacts')[_0x6e56('0x40')](_0x6e56('0x46'))[_0x6e56('0x40')]('ListId\x20=\x20?',LISTID[_0x6e56('0x3f')]())[_0x6e56('0x40')](_0x6e56('0x47'),squel[_0x6e56('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x6e56('0x3f')]();return _0x2522ab;}return db[_0x6e56('0x4c')]['findAll']({'where':{'type':_0x6e56('0x4d')},'attributes':['id',_0x6e56('0x4e')],'include':[{'model':db[_0x6e56('0x4f')],'as':_0x6e56('0x50'),'where':{'id':LISTID}}]})[_0x6e56('0x2e')](function(_0x1614c0){var _0x51e707=[];if(_0x1614c0){var _0x3305ca;for(var _0x7dbd4a=0x0,_0x17af51;_0x7dbd4a<_0x1614c0[_0x6e56('0x27')];_0x7dbd4a+=0x1){_0x17af51=_0x1614c0[_0x7dbd4a]['get']({'plain':!![]});switch(_0x17af51['dialCheckDuplicateType']){case _0x6e56('0x51'):_0x51e707[_0x6e56('0x2f')](db[_0x6e56('0x52')][_0x6e56('0x53')](_0x2bc8ac(_0x17af51,_0x6e56('0x54')))[_0x6e56('0x2e')](function(){})[_0x6e56('0x55')](_0x1f7394()));break;case _0x6e56('0x56'):_0x51e707[_0x6e56('0x2f')](db[_0x6e56('0x52')][_0x6e56('0x53')](_0x3f3371(_0x17af51,'VoiceQueueId'))['then'](function(){})[_0x6e56('0x55')](_0x1f7394()));break;default:_0x51e707['push'](db['sequelize'][_0x6e56('0x53')](_0xe884c8(_0x17af51,_0x6e56('0x54')))['then'](function(){})[_0x6e56('0x55')](_0x1f7394()));}}}return _0x51e707;})[_0x6e56('0x57')]()[_0x6e56('0x2e')](function(){return db[_0x6e56('0x4c')][_0x6e56('0x58')]({'where':{'type':_0x6e56('0x4d')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x6e56('0x59'),'where':{'id':LISTID}}]})[_0x6e56('0x2e')](function(_0x5039ce){var _0x1b0f6b=[];if(_0x5039ce){var _0x57c71f;for(var _0x5e60cb=0x0,_0x245ab1;_0x5e60cb<_0x5039ce[_0x6e56('0x27')];_0x5e60cb+=0x1){_0x245ab1=_0x5039ce[_0x5e60cb][_0x6e56('0x5a')]({'plain':!![]});_0x1b0f6b[_0x6e56('0x2f')](db[_0x6e56('0x52')][_0x6e56('0x53')](_0x55ec6e(_0x245ab1,_0x6e56('0x54')))['then'](function(){})[_0x6e56('0x55')](_0x1f7394()));}}return _0x1b0f6b;})[_0x6e56('0x57')]();})[_0x6e56('0x2e')](function(){return db[_0x6e56('0x5b')][_0x6e56('0x58')]({'attributes':['id',_0x6e56('0x4e')],'include':[{'model':db[_0x6e56('0x4f')],'as':_0x6e56('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x4269ae){var _0x5fe9b6=[];if(_0x4269ae){for(var _0x4c837a=0x0,_0x453601;_0x4c837a<_0x4269ae['length'];_0x4c837a+=0x1){_0x453601=_0x4269ae[_0x4c837a][_0x6e56('0x5a')]({'plain':!![]});switch(_0x453601[_0x6e56('0x4e')]){case'always':_0x5fe9b6[_0x6e56('0x2f')](db['sequelize'][_0x6e56('0x53')](_0x2bc8ac(_0x453601,'CampaignId'))[_0x6e56('0x2e')](function(){})[_0x6e56('0x55')](_0x1f7394()));break;case'onlyIfOpen':_0x5fe9b6[_0x6e56('0x2f')](db[_0x6e56('0x52')][_0x6e56('0x53')](_0x3f3371(_0x453601,_0x6e56('0x5c')))[_0x6e56('0x2e')](function(){})[_0x6e56('0x55')](_0x1f7394()));break;default:_0x5fe9b6[_0x6e56('0x2f')](db[_0x6e56('0x52')][_0x6e56('0x53')](_0xe884c8(_0x453601,_0x6e56('0x5c')))[_0x6e56('0x2e')](function(){})[_0x6e56('0x55')](_0x1f7394()));}}}return _0x5fe9b6;})[_0x6e56('0x57')]();})[_0x6e56('0x2e')](function(){return db['Campaign'][_0x6e56('0x58')]({'attributes':['id'],'include':[{'model':db[_0x6e56('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x26ae75){var _0x350bd8=[];if(_0x26ae75){for(var _0x58f700=0x0,_0x4287db;_0x58f700<_0x26ae75[_0x6e56('0x27')];_0x58f700+=0x1){_0x4287db=_0x26ae75[_0x58f700][_0x6e56('0x5a')]({'plain':!![]});_0x350bd8[_0x6e56('0x2f')](db['sequelize'][_0x6e56('0x53')](_0x55ec6e(_0x4287db,'CampaignId'))[_0x6e56('0x2e')](function(){})['catch'](_0x1f7394()));}}return _0x350bd8;})[_0x6e56('0x57')]();})[_0x6e56('0x55')](function(_0x554871){logger[_0x6e56('0x13')](_0x6e56('0x5d'),_0x6e56('0x5e'),_0x554871['message']);});}var processPromises=function(_0x55dc8d){return BPromise['all'](promises)[_0x6e56('0x2e')](function(_0x1a4032){})['catch'](function(_0x4df03f){logger[_0x6e56('0x13')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x4df03f));})[_0x6e56('0x5f')](function(){socket[_0x6e56('0x60')](_0x6e56('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x55dc8d){return _0x55dc8d[_0x6e56('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x6e56('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x6e56('0x2e')](function(){socket['emit'](_0x6e56('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6e56('0x63')](FILEPATH);}catch(_0x5b94da){logger[_0x6e56('0x13')](_0x6e56('0x64'),JSON[_0x6e56('0x65')](_0x5b94da));}finally{process['exit'](0x0);}});};process['on'](_0x6e56('0x66'),function(){logger['info'](_0x6e56('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0x6e56('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6e56('0x10')](',');return db[_0x6e56('0x2b')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x56c3a6){var _0x4d566b=fs[_0x6e56('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x4d566b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x385352,_0xbe861a){total+=0x1;var _0x340fea=total;promises[_0x6e56('0x2f')](checkRow(_0x385352,_0x56c3a6,_0x340fea)['then'](function(){success+=0x1;})[_0x6e56('0x55')](function(_0x37bc1f){if(_0x37bc1f['error']){errors+=0x1;delete _0x37bc1f[_0x6e56('0x13')];}else if(_0x37bc1f['duplicate']){duplicates+=0x1;delete _0x37bc1f[_0x6e56('0x29')];}rows[_0x6e56('0x2f')](_0x37bc1f);}));if(total%0xc8===0x0){_0xbe861a[_0x6e56('0x69')]();return processPromises(_0xbe861a);}},'complete':function(){return processPromises()['then'](function(){logger[_0x6e56('0x6a')](_0x6e56('0x6b'));endCsv();});},'error':function(_0x21b49a,_0x1af052){logger[_0x6e56('0x6a')](_0x6e56('0x6c'),JSON[_0x6e56('0x65')](_0x21b49a));endCsv();}});})[_0x6e56('0x55')](function(_0x3e9aff){logger[_0x6e56('0x13')](_0x6e56('0x6d'),JSON['stringify'](_0x3e9aff));});}main(); \ No newline at end of file +var _0x0118=['ioredis','../../../mysqldb','../../../config/environment','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','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','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','CmContact','create','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','insert','into','cm_hopper','fromQuery','scheduledAt','updatedAt','select','field','NOW()','ContactId','toString','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','createdAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','VoiceQueue','findAll','outbound','CmList','Lists','then','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resume','resolve','emit','contact:csv_','unlinkSync','exit','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash'];(function(_0x2caf3a,_0x1d65d6){var _0x34f044=function(_0x31410c){while(--_0x31410c){_0x2caf3a['push'](_0x2caf3a['shift']());}};_0x34f044(++_0x1d65d6);}(_0x0118,0x1b1));var _0x8011=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0118[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x8011('0x0'));var util=require(_0x8011('0x1'));var _=require(_0x8011('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x8011('0x3'));var db=require(_0x8011('0x4'))['db'];var config=require(_0x8011('0x5'));var logger=require('../../../config/logger')(_0x8011('0x6'));config[_0x8011('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8011('0x8'))(new Redis(config[_0x8011('0x7')]));require(_0x8011('0x9'))[_0x8011('0xa')](socket);try{if(!process['argv'][0x2]||process[_0x8011('0xb')][0x2]===_0x8011('0xc')||process[_0x8011('0xb')][0x2]===_0x8011('0xd')){throw new Error(_0x8011('0xe'));}var FILEPATH=process[_0x8011('0xb')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process[_0x8011('0xb')][0x3]===_0x8011('0xd')||!process[_0x8011('0xb')][0x4]||process['argv'][0x4]==='undefined'||process[_0x8011('0xb')][0x4]===_0x8011('0xd')){throw new Error(_0x8011('0xf'));}var FIELDS=_[_0x8011('0x10')](process[_0x8011('0xb')][0x3]['split'](','),process[_0x8011('0xb')][0x4][_0x8011('0x11')](','));if(!process[_0x8011('0xb')][0x5]||process[_0x8011('0xb')][0x5]===_0x8011('0xc')||process[_0x8011('0xb')][0x5]===_0x8011('0xd')){throw new Error(_0x8011('0x12'));}var LISTID=process[_0x8011('0xb')][0x5];var COMPANYID=process[_0x8011('0xb')][0x6]&&process[_0x8011('0xb')][0x6]!==_0x8011('0xc')&&process[_0x8011('0xb')][0x6]!==_0x8011('0xd')?process[_0x8011('0xb')][0x6]:null;var DUPLICATES=process[_0x8011('0xb')][0x7]&&process[_0x8011('0xb')][0x7]!==_0x8011('0xc')&&process[_0x8011('0xb')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x8011('0xb')][0x8]||process[_0x8011('0xb')][0x8]===_0x8011('0xc')||process['argv'][0x8]===_0x8011('0xd')){throw new Error(_0x8011('0x13'));}var SOCKET_TIMESTAMP=process[_0x8011('0xb')][0x8];}catch(_0x237fa1){logger[_0x8011('0x14')](_0x237fa1);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(_0x1ca64c,_0x983c97,_0x43c761,_0x39612b){var _0x1881a7={'message':_0x983c97};_0x1881a7[_0x1ca64c]=!![];if(_0x43c761){_0x1881a7[_0x8011('0x15')]=_0x43c761;}if(_0x39612b){_0x1881a7[_0x8011('0x16')]=_0x39612b;}return _0x1881a7;}function isEmail(_0x25ea70){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))*$/[_0x8011('0x17')](_0x25ea70);}function checkRow(_0x4906e9,_0x410bea,_0x3433e3){return new BPromise(function(_0x3c3164,_0x1b33c5){if(_[_0x8011('0x18')](_0x4906e9)){return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x8011('0x19'),null,_0x3433e3));}if(_0x4906e9[_0x8011('0x1a')]&&_0x4906e9[_0x8011('0x1a')][_0x8011('0x1b')]){var _0x539cec=_[_0x8011('0x1c')](_0x4906e9[_0x8011('0x1a')],_0x8011('0x1d'))['join'](';');return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x539cec,null,_0x3433e3));}var _0x2806c3={};for(var _0x1ba6d1 in FIELDS){if(FIELDS[_0x8011('0x1e')](_0x1ba6d1)&&FIELDS[_0x1ba6d1]){_0x2806c3[_0x1ba6d1]=_0x4906e9[_0x8011('0x1f')][0x0][FIELDS[_0x1ba6d1]]||_0x4906e9[_0x8011('0x1f')][0x0]['\ufeff'+FIELDS[_0x1ba6d1]];}}if(!_0x2806c3[_0x8011('0x20')]){return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x8011('0x21'),null,_0x3433e3));}if(!_0x2806c3[_0x8011('0x22')]){return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x8011('0x23'),null,_0x3433e3));}if(_0x2806c3[_0x8011('0x24')]){var _0x1ac97d=moment(_0x2806c3[_0x8011('0x24')],_0x8011('0x25'));if(!_0x1ac97d['isValid']()){return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x8011('0x26'),null,_0x3433e3));}}if(_0x2806c3[_0x8011('0x27')]){if(!isEmail(_0x2806c3['email'])){return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x8011('0x28'),null,_0x3433e3));}}_0x2806c3[_0x8011('0x29')]=LISTID;_0x2806c3[_0x8011('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x8011('0x1b')]&&_0x410bea){var _0x40795b={};for(var _0x34b0e3=0x0,_0x4dab9f=DUPLICATES[_0x8011('0x1b')];_0x34b0e3<_0x4dab9f;_0x34b0e3+=0x1){_0x40795b[DUPLICATES[_0x34b0e3]]=_0x2806c3[DUPLICATES[_0x34b0e3]];}var _0x1da126=_['find'](_0x410bea,_0x40795b);if(_0x1da126){return _0x1b33c5(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x1da126,_0x3433e3));}}return db[_0x8011('0x2b')][_0x8011('0x2c')](_0x2806c3,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2806c3)})['then'](function(_0x6a9961){if(DUPLICATES&&DUPLICATES['length']&&_0x410bea){_0x410bea[_0x8011('0x2d')](_['pick'](_0x2806c3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x6a9961['id'];return _0x3c3164();})[_0x8011('0x2e')](function(_0x4b438f){return _0x1b33c5(handleCheckRowError('error',_0x8011('0x2f')+(_0x4b438f['message']||JSON[_0x8011('0x30')](_0x4b438f)),null,_0x3433e3));});});}function checkHopper(){function _0x77c4ba(){return function(_0x3bc0de){logger[_0x8011('0x14')](_0x8011('0x31'),'checkHopper',util['inspect'](_0x3bc0de,{'showHidden':![],'depth':null}));};}var _0x3eca02=function(_0x145761,_0x16f0dc){var _0xab65d8=squel[_0x8011('0x32')]()[_0x8011('0x33')](_0x8011('0x34'))[_0x8011('0x35')]([_0x8011('0x22'),_0x8011('0x36'),'ContactId','ListId',_0x16f0dc,'createdAt',_0x8011('0x37')],squel[_0x8011('0x38')]()[_0x8011('0x39')](_0x8011('0x22'),'phone')[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x36'))[_0x8011('0x39')]('id',_0x8011('0x3b'))[_0x8011('0x39')](LISTID[_0x8011('0x3c')](),_0x8011('0x29'))[_0x8011('0x39')](_0x145761['id']['toString'](),_0x16f0dc)[_0x8011('0x39')](_0x8011('0x3a'),'createdAt')[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x37'))['from'](_0x8011('0x3d'))['where'](_0x8011('0x3e'))[_0x8011('0x3f')](_0x8011('0x40'),LISTID[_0x8011('0x3c')]())[_0x8011('0x3f')](_0x8011('0x41'))['where'](_0x8011('0x42'),squel[_0x8011('0x38')]()['field'](_0x8011('0x22'))[_0x8011('0x43')](_0x8011('0x34'))[_0x8011('0x3f')](_0x16f0dc+_0x8011('0x44'),_0x145761['id'][_0x8011('0x3c')]())))[_0x8011('0x3c')]();return _0xab65d8;};var _0x159a1a=function(_0x2f884c,_0x1facce){var _0x2a3aef=squel[_0x8011('0x32')]()[_0x8011('0x33')](_0x8011('0x34'))[_0x8011('0x35')](['phone',_0x8011('0x36'),'ContactId',_0x8011('0x29'),_0x1facce,_0x8011('0x45'),_0x8011('0x37')],squel[_0x8011('0x38')]()[_0x8011('0x39')](_0x8011('0x22'),_0x8011('0x22'))[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x36'))[_0x8011('0x39')]('id',_0x8011('0x3b'))[_0x8011('0x39')](LISTID[_0x8011('0x3c')](),_0x8011('0x29'))[_0x8011('0x39')](_0x2f884c['id'][_0x8011('0x3c')](),_0x1facce)[_0x8011('0x39')](_0x8011('0x3a'),'createdAt')[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x37'))[_0x8011('0x43')]('cm_contacts')['where'](_0x8011('0x3e'))['where'](_0x8011('0x40'),LISTID[_0x8011('0x3c')]())[_0x8011('0x3f')](_0x8011('0x46'),squel[_0x8011('0x47')](hopperContacts))[_0x8011('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x8011('0x3f')](_0x8011('0x42'),squel[_0x8011('0x38')]()[_0x8011('0x39')](_0x8011('0x48'))['from'](_0x8011('0x49'))[_0x8011('0x3f')](_0x1facce+_0x8011('0x44'),_0x2f884c['id'][_0x8011('0x3c')]()))[_0x8011('0x3f')](_0x8011('0x42'),squel[_0x8011('0x38')]()[_0x8011('0x39')](_0x8011('0x22'))[_0x8011('0x43')]('cm_hopper')[_0x8011('0x3f')](_0x1facce+'\x20=\x20?',_0x2f884c['id']['toString']())))[_0x8011('0x3c')]();return _0x2a3aef;};function _0x416018(_0x7449e8,_0x579a52){var _0x201e69=squel[_0x8011('0x32')]()[_0x8011('0x33')](_0x8011('0x34'))[_0x8011('0x35')]([_0x8011('0x22'),'scheduledAt',_0x8011('0x3b'),'ListId',_0x579a52,_0x8011('0x45'),_0x8011('0x37')],squel[_0x8011('0x38')]()['field'](_0x8011('0x22'),_0x8011('0x22'))[_0x8011('0x39')]('NOW()',_0x8011('0x36'))[_0x8011('0x39')]('id',_0x8011('0x3b'))[_0x8011('0x39')](LISTID[_0x8011('0x3c')](),'ListId')[_0x8011('0x39')](_0x7449e8['id'][_0x8011('0x3c')](),_0x579a52)[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x45'))[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x37'))[_0x8011('0x43')]('cm_contacts')['where'](_0x8011('0x3e'))[_0x8011('0x3f')]('ListId\x20=\x20?',LISTID[_0x8011('0x3c')]())[_0x8011('0x3f')](_0x8011('0x46'),squel[_0x8011('0x47')](hopperContacts))[_0x8011('0x3f')](_0x8011('0x41')))['toString']();return _0x201e69;}function _0x27506b(_0x2dbe4f,_0x59689c){var _0x5a1f8e=squel[_0x8011('0x32')]()[_0x8011('0x33')]('cm_hopper_black')['fromQuery']([_0x8011('0x22'),_0x8011('0x3b'),_0x8011('0x29'),_0x59689c,_0x8011('0x45'),_0x8011('0x37')],squel['select']()[_0x8011('0x39')]('phone','phone')[_0x8011('0x39')]('id',_0x8011('0x3b'))['field'](LISTID[_0x8011('0x3c')](),_0x8011('0x29'))['field'](_0x2dbe4f['id'][_0x8011('0x3c')](),_0x59689c)[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x45'))['field'](_0x8011('0x3a'),_0x8011('0x37'))[_0x8011('0x43')](_0x8011('0x3d'))[_0x8011('0x3f')](_0x8011('0x3e'))[_0x8011('0x3f')](_0x8011('0x40'),LISTID[_0x8011('0x3c')]())[_0x8011('0x3f')](_0x8011('0x46'),squel[_0x8011('0x47')](hopperContacts))[_0x8011('0x3f')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x5a1f8e;}return db[_0x8011('0x4a')][_0x8011('0x4b')]({'where':{'type':_0x8011('0x4c')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x8011('0x4d')],'as':_0x8011('0x4e'),'where':{'id':LISTID}}]})[_0x8011('0x4f')](function(_0x3af364){var _0x561aaa=[];if(_0x3af364){var _0x4baaf0;for(var _0x26bd3d=0x0,_0x1dd07c;_0x26bd3d<_0x3af364[_0x8011('0x1b')];_0x26bd3d+=0x1){_0x1dd07c=_0x3af364[_0x26bd3d][_0x8011('0x50')]({'plain':!![]});switch(_0x1dd07c[_0x8011('0x51')]){case _0x8011('0x52'):_0x561aaa['push'](db[_0x8011('0x53')][_0x8011('0x54')](_0x159a1a(_0x1dd07c,_0x8011('0x55')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));break;case _0x8011('0x56'):_0x561aaa[_0x8011('0x2d')](db['sequelize'][_0x8011('0x54')](_0x3eca02(_0x1dd07c,_0x8011('0x55')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));break;default:_0x561aaa[_0x8011('0x2d')](db[_0x8011('0x53')][_0x8011('0x54')](_0x416018(_0x1dd07c,_0x8011('0x55')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));}}}return _0x561aaa;})[_0x8011('0x57')]()['then'](function(){return db[_0x8011('0x4a')]['findAll']({'where':{'type':_0x8011('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x8011('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x540822){var _0x57bb5b=[];if(_0x540822){var _0x1ea707;for(var _0xc93e24=0x0,_0x406929;_0xc93e24<_0x540822[_0x8011('0x1b')];_0xc93e24+=0x1){_0x406929=_0x540822[_0xc93e24]['get']({'plain':!![]});_0x57bb5b['push'](db[_0x8011('0x53')][_0x8011('0x54')](_0x27506b(_0x406929,_0x8011('0x55')))['then'](function(){})[_0x8011('0x2e')](_0x77c4ba()));}}return _0x57bb5b;})[_0x8011('0x57')]();})['then'](function(){return db[_0x8011('0x59')][_0x8011('0x4b')]({'attributes':['id',_0x8011('0x51')],'include':[{'model':db[_0x8011('0x4d')],'as':_0x8011('0x4e'),'where':{'id':LISTID}}]})[_0x8011('0x4f')](function(_0x13972e){var _0x530638=[];if(_0x13972e){for(var _0x3912b9=0x0,_0x2896ff;_0x3912b9<_0x13972e[_0x8011('0x1b')];_0x3912b9+=0x1){_0x2896ff=_0x13972e[_0x3912b9][_0x8011('0x50')]({'plain':!![]});switch(_0x2896ff[_0x8011('0x51')]){case _0x8011('0x52'):_0x530638['push'](db['sequelize'][_0x8011('0x54')](_0x159a1a(_0x2896ff,_0x8011('0x5a')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));break;case _0x8011('0x56'):_0x530638['push'](db['sequelize'][_0x8011('0x54')](_0x3eca02(_0x2896ff,_0x8011('0x5a')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));break;default:_0x530638['push'](db[_0x8011('0x53')][_0x8011('0x54')](_0x416018(_0x2896ff,'CampaignId'))['then'](function(){})[_0x8011('0x2e')](_0x77c4ba()));}}}return _0x530638;})[_0x8011('0x57')]();})[_0x8011('0x4f')](function(){return db['Campaign'][_0x8011('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x8011('0x4d')],'as':_0x8011('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x36cedf){var _0x381acc=[];if(_0x36cedf){for(var _0x1957eb=0x0,_0x421243;_0x1957eb<_0x36cedf['length'];_0x1957eb+=0x1){_0x421243=_0x36cedf[_0x1957eb][_0x8011('0x50')]({'plain':!![]});_0x381acc[_0x8011('0x2d')](db[_0x8011('0x53')][_0x8011('0x54')](_0x27506b(_0x421243,_0x8011('0x5a')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));}}return _0x381acc;})[_0x8011('0x57')]();})[_0x8011('0x2e')](function(_0x4b997f){logger[_0x8011('0x14')](_0x8011('0x5b'),_0x8011('0x5c'),_0x4b997f[_0x8011('0x1d')]);});}var processPromises=function(_0x2ea623){return BPromise[_0x8011('0x57')](promises)[_0x8011('0x4f')](function(_0x149516){})[_0x8011('0x2e')](function(_0x28d80c){logger[_0x8011('0x14')](_0x8011('0x5d'),JSON['stringify'](_0x28d80c));})[_0x8011('0x5e')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2ea623){return _0x2ea623[_0x8011('0x5f')]();}});};var endCsv=function(){return BPromise[_0x8011('0x60')]()[_0x8011('0x4f')](function(){if(hopperContacts){return checkHopper();}})[_0x8011('0x4f')](function(){socket[_0x8011('0x61')](_0x8011('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8011('0x63')](FILEPATH);}catch(_0x2a786a){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x8011('0x30')](_0x2a786a));}finally{process[_0x8011('0x64')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x8011('0x65'));endCsv();});function main(){return BPromise[_0x8011('0x60')]()[_0x8011('0x4f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8011('0x11')](',');return db[_0x8011('0x2b')][_0x8011('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8011('0x4f')](function(_0x576e47){var _0x11b393=fs[_0x8011('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x8011('0x67')](_0x11b393,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5943f5,_0x4e9265){total+=0x1;var _0xd4d62b=total;promises[_0x8011('0x2d')](checkRow(_0x5943f5,_0x576e47,_0xd4d62b)[_0x8011('0x4f')](function(){success+=0x1;})[_0x8011('0x2e')](function(_0x17df77){if(_0x17df77[_0x8011('0x14')]){errors+=0x1;delete _0x17df77['error'];}else if(_0x17df77[_0x8011('0x68')]){duplicates+=0x1;delete _0x17df77[_0x8011('0x68')];}rows[_0x8011('0x2d')](_0x17df77);}));if(total%0xc8===0x0){_0x4e9265['pause']();return processPromises(_0x4e9265);}},'complete':function(){return processPromises()[_0x8011('0x4f')](function(){logger[_0x8011('0x69')](_0x8011('0x6a'));endCsv();});},'error':function(_0x3cc380,_0x3031b3){logger[_0x8011('0x69')](_0x8011('0x6b'),JSON['stringify'](_0x3cc380));endCsv();}});})['catch'](function(_0x3344e7){logger[_0x8011('0x14')](_0x8011('0x6c'),JSON[_0x8011('0x30')](_0x3344e7));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index f6327d5..78f1c07 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 _0xc319=['length','all','split','push','isNil','filter','CmContactHasItem','update','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.ListId','cm_hopper_black','cm_contacts','field','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','priority','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','keys','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','message','exit','errors','code','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','error','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','stringify','clone','socket_timestamp','root','server/files/tmp','.csv','header','ContactItemType','findAll','name','_description','writeFileSync','createReadStream','data','find','trim','replace','isValid','isNaN','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','hasOwnProperty','itemTypeId','SystemRow','appendFileSync','rows','contact:import:','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','CompanyId','contactTypeId','orderBy','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','No\x20agent\x20available','path','lodash','papaparse','bluebird','moment','ioredis','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','CmContact','AdditionalPhones','then'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0xc319,0x149));var _0x9c31=function(_0x57a486,_0x28fc94){_0x57a486=_0x57a486-0x0;var _0x42679f=_0xc319[_0x57a486];return _0x42679f;};'use strict';var fs=require('fs');var path=require(_0x9c31('0x0'));var _=require(_0x9c31('0x1'));var Papa=require(_0x9c31('0x2'));var util=require('util');var BPromise=require(_0x9c31('0x3'));var moment=require(_0x9c31('0x4'));var squel=require('squel');var Redis=require(_0x9c31('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x9c31('0x6'));var shared=require(_0x9c31('0x7'));var logger=require('../../../config/logger')(_0x9c31('0x8'));config[_0x9c31('0x9')]=_[_0x9c31('0xa')](config[_0x9c31('0x9')],{'host':_0x9c31('0xb'),'port':0x18eb});var socket=require(_0x9c31('0xc'))(new Redis(config[_0x9c31('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x9c31('0xd')](_0x9c31('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x9c31('0xd')](_0x9c31('0xe'));function isEmail(_0x4c644a){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4c644a);}function selectNotIn(_0x52f89c,_0x382176,_0x5de516,_0x32d1fd,_0x20d1c7){return squel[_0x9c31('0xf')]()['field'](_0x9c31('0x10'))[_0x9c31('0x11')](_0x32d1fd)[_0x9c31('0x12')](_0x382176,null,_0x382176+_0x9c31('0x13')+_0x32d1fd+'.'+_0x5de516)[_0x9c31('0x14')](_0x32d1fd+'.'+_0x5de516+_0x9c31('0x15')+_0x52f89c+'.'+_0x5de516)[_0x9c31('0x14')](_0x382176+'.dialCheckDuplicateType\x20IN\x20('+_0x20d1c7['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x12d064,_0x21fb6e){promisesAdditionalPhones=[];return db[_0x9c31('0x16')]['findAll']({'raw':!![],'attributes':['id',_0x9c31('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x9c31('0x18')](function(_0x414605){if(_0x414605!==null){var _0x1372e0=[];for(var _0xf352de=0x0;_0xf352de<_0x414605[_0x9c31('0x19')];_0xf352de++){var _0x4029e6=_0x414605[_0xf352de];_0x1372e0['push'](insertAdditionalPhones(_0x4029e6));}}Promise[_0x9c31('0x1a')](_0x1372e0)[_0x9c31('0x18')](function(){_0x12d064({'val':0x1});});});});}function insertAdditionalPhones(_0x44cd98){return new Promise(function(_0x57911e,_0x4737e0){var _0x1d564f=_0x44cd98[_0x9c31('0x17')];var _0x4ae90e=_0x1d564f[_0x9c31('0x1b')](';');var _0x464481=[];orderBy=0x0;for(var _0x453cb3=0x0;_0x453cb3<_0x4ae90e[_0x9c31('0x19')];_0x453cb3++){_0x464481[_0x9c31('0x1c')](splitAdditionalPhone(_0x44cd98['id'],_0x4ae90e[_0x453cb3]));}Promise['all'](_0x464481)[_0x9c31('0x18')](function(){_0x57911e({'val':_0x4ae90e['length']});});});}function splitAdditionalPhone(_0x26e41d,_0x4592af){return new Promise(function(_0x18eff1,_0x2f18e1){var _0x5f2ad9=_0x4592af[_0x9c31('0x1b')](':');var _0x408f1c=_0x5f2ad9[0x0];var _0x1e0acc=_0x5f2ad9[0x1];if(!_[_0x9c31('0x1d')](_0x1e0acc)){var _0x263175=_0x1e0acc[_0x9c31('0x1b')]('|');var _0x200b08=[];for(var _0x5bf76d=0x0;_0x5bf76d<_0x263175[_0x9c31('0x19')];_0x5bf76d++){if(_0x263175[_0x5bf76d]!==''){var _0x1a16b3=_[_0x9c31('0x1e')](promisesAdditionalPhones,{'contactId':_0x26e41d,'phone':_0x263175[_0x5bf76d]});if(_0x1a16b3[_0x9c31('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x9c31('0x1c')]({'contactId':_0x26e41d,'contactTypeId':_0x408f1c,'phone':_0x263175[_0x5bf76d],'orderBy':orderBy});}}}_0x18eff1({'ok':0x1});}else _0x18eff1({'res':0x0});});}function createAdditionalPhone(_0x479d3b,_0x4fe847,_0x2ed24c,_0x4d105a){var _0x503933='';var _0x2e4880='';var _0x1f34b9=_0x2ed24c['split']('§');_0x503933=_0x1f34b9[0x0];if(_0x1f34b9[_0x9c31('0x19')]==0x2)_0x2e4880=_0x1f34b9[0x1];return new Promise(function(_0x9340ef,_0x591f15){return db[_0x9c31('0x1f')]['findOne']({'where':{'CmContactId':_0x479d3b,'item':_0x503933}})[_0x9c31('0x18')](function(_0x26d6e3){if(_0x26d6e3){return db[_0x9c31('0x1f')][_0x9c31('0x20')]({'ItemTypeId':_0x4fe847,'description':_0x2e4880,'OrderBy':_0x4d105a},{'where':{'CmContactId':_0x479d3b,'item':_0x503933}})[_0x9c31('0x18')](function(_0x201922){_0x9340ef({'res':'updated'});});}else{return db[_0x9c31('0x1f')][_0x9c31('0x21')]({'CmContactId':_0x479d3b,'item':_0x503933,'description':_0x2e4880,'ItemTypeId':_0x4fe847,'OrderBy':_0x4d105a,'ItemClass':_0x9c31('0x22')})[_0x9c31('0x18')](function(_0x536789){_0x9340ef({'res':'inserted'});});}});});}function insertCmHopper(_0x4b4a72,_0x4016e1,_0x2dc896,_0xe2b5cb,_0x21f829){var _0x2a8219=[_0x9c31('0x23'),_0x9c31('0x24'),_0x9c31('0x25'),'cm_contacts.ListId',_0x4016e1+'.'+_0xe2b5cb,_0x9c31('0x26'),_0x9c31('0x27'),_0x9c31('0x28'),_0x9c31('0x29'),'\x22'+_0x21f829+'\x22'];return squel[_0x9c31('0x2a')]()[_0x9c31('0x2b')](_0x9c31('0x2c'))[_0x9c31('0x2d')]([_0x9c31('0x10'),'scheduledat',_0x9c31('0x2e'),_0x9c31('0x2f'),_0xe2b5cb,_0x9c31('0x30'),_0x9c31('0x31'),'priority',_0x9c31('0x32'),'recallme'],squel[_0x9c31('0xf')]()[_0x9c31('0x33')](_0x2a8219)[_0x9c31('0x11')](_0x4016e1)['join']('cm_contacts',null,_0x9c31('0x34')+_0x4016e1+_0x9c31('0x35'))[_0x9c31('0x12')](_0x2dc896,null,_0x2dc896+_0x9c31('0x13')+_0x4016e1+'.'+_0xe2b5cb)['where'](_0x4016e1+_0x9c31('0x36'),_0x4b4a72)[_0x9c31('0x14')](_0x9c31('0x37'),NOW)[_0x9c31('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4016e1,_0x2dc896,_0xe2b5cb,_0x9c31('0x2c'),[_0x9c31('0x38'),_0x9c31('0x39')]))['where'](_0x9c31('0x3a'),selectNotIn(_0x4016e1,_0x2dc896,_0xe2b5cb,_0x9c31('0x2c'),[_0x9c31('0x38')])))['toString']();}function insertCmHopperBlack(_0x3d7274,_0x2ce40c,_0x11de67,_0x292b51){var _0x35ab37=[_0x9c31('0x23'),'cm_contacts.id',_0x9c31('0x3b'),_0x2ce40c+'.'+_0x292b51,_0x9c31('0x26'),_0x9c31('0x27')];return squel[_0x9c31('0x2a')]()[_0x9c31('0x2b')](_0x9c31('0x3c'))[_0x9c31('0x2d')]([_0x9c31('0x10'),_0x9c31('0x2e'),_0x9c31('0x2f'),_0x292b51,_0x9c31('0x30'),_0x9c31('0x31')],squel[_0x9c31('0xf')]()[_0x9c31('0x33')](_0x35ab37)[_0x9c31('0x11')](_0x2ce40c)[_0x9c31('0x12')](_0x9c31('0x3d'),null,_0x9c31('0x34')+_0x2ce40c+_0x9c31('0x35'))[_0x9c31('0x12')](_0x11de67,null,_0x11de67+'.id\x20=\x20'+_0x2ce40c+'.'+_0x292b51)['where'](_0x2ce40c+_0x9c31('0x36'),_0x3d7274)[_0x9c31('0x14')](_0x9c31('0x37'),NOW)[_0x9c31('0x14')](_0x9c31('0x3a'),squel[_0x9c31('0xf')]()[_0x9c31('0x3e')]('phone')['from']('cm_hopper_black')[_0x9c31('0x14')]('ListId\x20=\x20?',_0x3d7274)['where'](_0x292b51+'\x20=\x20'+_0x2ce40c+'.'+_0x292b51)))[_0x9c31('0x3f')]();}function insertTzCmHopper(_0x591c80,_0x504722,_0x239525,_0x2ba86e,_0x15e934,_0x36738b){var _0x44155e=[_0x9c31('0x23'),_0x9c31('0x40')+_0x36738b+_0x9c31('0x41'),_0x9c31('0x25'),_0x9c31('0x3b'),_0x504722+'.'+_0x2ba86e,_0x9c31('0x26'),_0x9c31('0x27'),_0x9c31('0x28'),_0x9c31('0x29'),'\x22'+_0x15e934+'\x22'];var _0x282f18=squel['insert']()[_0x9c31('0x2b')]('cm_hopper')[_0x9c31('0x2d')]([_0x9c31('0x10'),_0x9c31('0x42'),_0x9c31('0x2e'),'ListId',_0x2ba86e,'createdAt','updatedAt',_0x9c31('0x43'),'UserId','recallme'],squel[_0x9c31('0xf')]()['fields'](_0x44155e)[_0x9c31('0x11')](_0x504722)[_0x9c31('0x12')](_0x9c31('0x3d'),null,_0x9c31('0x34')+_0x504722+'.CmListId')[_0x9c31('0x12')](_0x239525,null,_0x239525+'.id\x20=\x20'+_0x504722+'.'+_0x2ba86e)['join'](_0x36738b,null,_0x36738b+_0x9c31('0x13')+_0x504722+'.'+_0x2ba86e)[_0x9c31('0x14')](_0x504722+_0x9c31('0x36'),_0x591c80)['where'](_0x9c31('0x37'),NOW)['where'](_0x9c31('0x3a'),selectNotIn(_0x504722,_0x239525,_0x2ba86e,_0x9c31('0x2c'),[_0x9c31('0x38'),'\x22onlyIfOpen\x22']))[_0x9c31('0x14')](_0x9c31('0x3a'),selectNotIn(_0x504722,_0x239525,_0x2ba86e,'cm_hopper',['\x22always\x22'])))['toString']();return _0x282f18;}function insertTzCmHopperBlack(_0x48d133,_0x2bf962,_0x55fa9b,_0x4548be){var _0x270fcc=[_0x9c31('0x23'),_0x9c31('0x25'),_0x9c31('0x3b'),_0x2bf962+'.'+_0x4548be,_0x9c31('0x26'),_0x9c31('0x27')];return squel[_0x9c31('0x2a')]()[_0x9c31('0x2b')](_0x9c31('0x3c'))[_0x9c31('0x2d')]([_0x9c31('0x10'),_0x9c31('0x2e'),_0x9c31('0x2f'),_0x4548be,_0x9c31('0x30'),_0x9c31('0x31')],squel[_0x9c31('0xf')]()[_0x9c31('0x33')](_0x270fcc)['from'](_0x2bf962)[_0x9c31('0x12')](_0x9c31('0x3d'),null,_0x9c31('0x34')+_0x2bf962+'.CmListId')[_0x9c31('0x12')](_0x55fa9b,null,_0x55fa9b+_0x9c31('0x13')+_0x2bf962+'.'+_0x4548be)[_0x9c31('0x14')](_0x2bf962+_0x9c31('0x36'),_0x48d133)[_0x9c31('0x14')](_0x9c31('0x37'),NOW)[_0x9c31('0x14')](_0x9c31('0x3a'),squel[_0x9c31('0xf')]()[_0x9c31('0x3e')](_0x9c31('0x10'))[_0x9c31('0x11')](_0x9c31('0x3c'))[_0x9c31('0x14')](_0x9c31('0x44'),_0x48d133)[_0x9c31('0x14')](_0x4548be+_0x9c31('0x15')+_0x2bf962+'.'+_0x4548be)))[_0x9c31('0x3f')]();}function insertCmHopperAdditionalPhones(_0x18fb87){var _0x5e8ccd=[_0x9c31('0x45'),_0x9c31('0x46'),_0x9c31('0x47'),'cm_contact_has_items.createdAt',_0x9c31('0x48')];return squel[_0x9c31('0x2a')]()[_0x9c31('0x2b')](_0x9c31('0x49'))['fromQuery']([_0x9c31('0x4a'),'phone',_0x9c31('0x4b'),_0x9c31('0x30'),'updatedAt'],squel[_0x9c31('0xf')]()[_0x9c31('0x33')](_0x5e8ccd)['from'](_0x9c31('0x2c'))[_0x9c31('0x12')]('cm_contacts',null,_0x9c31('0x4c'))[_0x9c31('0x12')](_0x9c31('0x4d'),null,_0x9c31('0x4e'))['where']('cm_hopper.ListId\x20=\x20?',_0x18fb87)[_0x9c31('0x14')](_0x9c31('0x37'),NOW))[_0x9c31('0x3f')]();}function insertCmContact(_0x1037c8,_0x56abf8,_0x3c936d,_0x13bde6){var _0x533452=_['concat'](_[_0x9c31('0x4f')](_0x13bde6),[_0x9c31('0x2f'),'CompanyId',_0x9c31('0x30'),_0x9c31('0x31'),_0x9c31('0x50')]);return squel[_0x9c31('0x2a')]()[_0x9c31('0x2b')]('cm_contacts')[_0x9c31('0x2d')](_0x533452,squel[_0x9c31('0xf')]()[_0x9c31('0x33')](_0x533452)[_0x9c31('0x11')](_0x56abf8)[_0x9c31('0x14')]('('+_0x3c936d[_0x9c31('0x12')](',')+_0x9c31('0x51'),squel['select']()[_0x9c31('0x33')](_0x3c936d)[_0x9c31('0x11')](_0x9c31('0x3d'))[_0x9c31('0x14')](_0x9c31('0x44'),_0x1037c8)[_0x9c31('0x14')](_0x9c31('0x52')))['where'](_0x9c31('0x53'),squel[_0x9c31('0xf')]()['field']('MIN(id)',_0x9c31('0x54'))[_0x9c31('0x11')](_0x56abf8)['group'](_0x3c936d[_0x9c31('0x12')](','))))['toString']();}function handleStop(){logger[_0x9c31('0x55')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x40aa0d){logger['error'](_0x40aa0d[_0x9c31('0x56')]);process[_0x9c31('0x57')](0x1);}function handleError(_0x4c02bf,_0x3fbac8){stats[_0x9c31('0x58')][_0x9c31('0x1c')]({'name':_0x3fbac8[_0x9c31('0x59')],'message':_0x3fbac8[_0x9c31('0x56')],'row':_0x4c02bf});}function handleQuery(_0x458d4a){logger['info'](_0x458d4a);return db[_0x9c31('0x5a')][_0x9c31('0x5b')](_0x458d4a)['spread'](function(_0x1e5ef7){results[_0x9c31('0x1c')](_0x1e5ef7);})[_0x9c31('0x5c')](function(_0xa045ef){logger['error'](_0xa045ef[_0x9c31('0x56')]);});}function updateTzCampaigns(_0x39f208){return new Promise(function(_0x1a1b43,_0xe3a82a){var _0x59ca01=squel[_0x9c31('0xf')]()[_0x9c31('0x33')]([_0x9c31('0x5d'),_0x9c31('0x5e')])[_0x9c31('0x11')]('campaigns')[_0x9c31('0x12')]('campaigns_has_cm_lists',null,_0x9c31('0x5f'))['where'](_0x9c31('0x60')+_0x39f208);db[_0x9c31('0x5a')][_0x9c31('0x5b')](_0x59ca01[_0x9c31('0x3f')]())[_0x9c31('0x61')](function(_0x1a525d){var _0x28785d=[];for(var _0x286371=0x0;_0x286371<_0x1a525d[_0x9c31('0x19')];_0x286371++){_0x28785d[_0x9c31('0x1c')](getTimezoneData(_0x1a525d[_0x286371],tmp_campaigns));}BPromise[_0x9c31('0x1a')](_0x28785d)['then'](function(){_0x1a1b43({'val':0x1});});})[_0x9c31('0x5c')](function(_0x7b4fb8){logger[_0x9c31('0x62')](_0x7b4fb8[_0x9c31('0x56')]);_0x1a1b43({'val':0x0});});});}function updateTzVoiceQueues(_0x396b7a){return new Promise(function(_0x5bbf4e,_0x178ac8){var _0x4aa20d=squel['select']()['fields']([_0x9c31('0x63'),_0x9c31('0x64')])[_0x9c31('0x11')](_0x9c31('0x65'))['join'](_0x9c31('0x66'),null,_0x9c31('0x67'))[_0x9c31('0x14')](_0x9c31('0x68')+_0x396b7a);db[_0x9c31('0x5a')][_0x9c31('0x5b')](_0x4aa20d[_0x9c31('0x3f')]())['spread'](function(_0x423593){var _0x47a9dc=[];for(var _0x44a393=0x0;_0x44a393<_0x423593[_0x9c31('0x19')];_0x44a393++){_0x47a9dc[_0x9c31('0x1c')](getTimezoneData(_0x423593[_0x44a393],tmp_voice_queues));}BPromise[_0x9c31('0x1a')](_0x47a9dc)['then'](function(){_0x5bbf4e({'val':0x1});});})[_0x9c31('0x5c')](function(_0x334da0){logger[_0x9c31('0x62')](_0x334da0['message']);_0x5bbf4e({'val':0x0});});});}function getTimezoneData(_0x565e78,_0x4f4854){return new Promise(function(_0x537fab,_0x3cabda){var _0x49759e=shared[_0x9c31('0x69')];var _0x430deb=_0x49759e[_0x565e78[_0x9c31('0x6a')]];if(_[_0x9c31('0x1d')](_0x430deb)){_0x537fab({'ret':0x1});}else{var _0x36a2fd=_0x430deb[_0x9c31('0x6b')];var _0x3d1748=squel[_0x9c31('0x2a')]()[_0x9c31('0x2b')](_0x4f4854)[_0x9c31('0x6c')]('id',_0x565e78['id'])['set'](_0x9c31('0x6d'),_0x36a2fd)[_0x9c31('0x6c')](_0x9c31('0x6a'),_0x565e78[_0x9c31('0x6a')])['toString']();return db[_0x9c31('0x5a')][_0x9c31('0x5b')](_0x3d1748)[_0x9c31('0x61')](function(_0x369cda){_0x537fab({'ret':0x1});})[_0x9c31('0x5c')](function(_0x17fcf2){logger[_0x9c31('0x62')](_0x17fcf2['message']);_0x3cabda({'ret':0x1});});}});}function handleTZQuery(_0x1eac30){logger['info'](_0x1eac30);return db['sequelize'][_0x9c31('0x5b')](_0x1eac30)['spread'](function(_0x3ad918){})['catch'](function(_0x3f377f){logger[_0x9c31('0x62')](_0x3f377f[_0x9c31('0x56')]);});}function main(_0x1bd30b,_0x4c02c5,_0x25f909,_0x1bee3b){logger['info'](_0x9c31('0x6e'),_0x1bd30b,JSON[_0x9c31('0x6f')](_0x4c02c5));process['send']('start');var _0x57be96=_0x4c02c5['binding'];var _0x1fad82=_[_0x9c31('0x70')](_0x57be96);var _0x58e34e=_0x4c02c5[_0x9c31('0x71')];var _0x3f4560=path[_0x9c31('0x12')](config[_0x9c31('0x72')],_0x9c31('0x73'),_0x58e34e+_0x9c31('0x74'));hasTZ=_[_0x9c31('0x4f')](_0x57be96)['includes']('dialTimezone');var _0x699b39=_[_0x9c31('0x4f')](_0x57be96)[_0x9c31('0x12')]();logger[_0x9c31('0x55')](_0x9c31('0x75'),_0x699b39);db[_0x9c31('0x76')][_0x9c31('0x77')]({'raw':!![],'attributes':['id',_0x9c31('0x78')]})[_0x9c31('0x18')](function(_0x2bbd9c){for(var _0x3e1487=0x0;_0x3e1487<_0x2bbd9c[_0x9c31('0x19')];_0x3e1487++){if(_0x2bbd9c[_0x3e1487][_0x9c31('0x78')]in _0x57be96){contactItemTypes['push'](_0x2bbd9c[_0x3e1487]);delete _0x1fad82[_0x2bbd9c[_0x3e1487][_0x9c31('0x78')]];hasAdditionalPhones=!![];}for(var _0x402cad in _0x57be96){if(_0x2bbd9c[_0x3e1487][_0x9c31('0x78')]+_0x9c31('0x79')===_0x402cad){phoneDescriptions[_0x9c31('0x1c')]({'itemTypeId':_0x2bbd9c[_0x3e1487]['id'],'description':_0x402cad});delete _0x1fad82[_0x402cad];}}}if(hasAdditionalPhones)_0x1fad82[_0x9c31('0x17')]='';var _0x193c6d=_[_0x9c31('0x4f')](_0x1fad82)[_0x9c31('0x12')]();logger['info']('header',_0x193c6d);fs[_0x9c31('0x7a')](_0x3f4560,_0x193c6d+'\x0a');Papa['parse'](fs[_0x9c31('0x7b')](_0x1bd30b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4db9d9,_0x339fb6){try{for(var _0xce4b05=0x0,_0x3fe93d=[];_0xce4b05<_0x4db9d9[_0x9c31('0x7c')][_0x9c31('0x19')];_0xce4b05++){stats['rows']+=0x1;if(_0x4db9d9[_0x9c31('0x58')][_0xce4b05]){handleError(_0x4db9d9[_0x9c31('0x7c')][_0xce4b05],_0x4db9d9[_0x9c31('0x58')][_0xce4b05]);}else{var _0x4d8243=[];var _0xc25856=[];var _0x51cc41={};for(var _0x4fdbbb in _0x57be96){let _0x585818=contactItemTypes[_0x9c31('0x7d')](_0x1457c9=>_0x1457c9['name']===_0x4fdbbb);let _0x6b0ae9=contactItemTypes['find'](_0x1a03cb=>_0x1a03cb['name']+_0x9c31('0x79')===_0x4fdbbb);if(_['isNil'](_0x585818)&&_[_0x9c31('0x1d')](_0x6b0ae9)){if(_0x57be96['hasOwnProperty'](_0x4fdbbb)){if(_0x4db9d9[_0x9c31('0x7c')][_0xce4b05][_0x57be96[_0x4fdbbb]]){var _0x5d4b80=_[_0x9c31('0x7e')](_0x4db9d9['data'][_0xce4b05][_0x57be96[_0x4fdbbb]][_0x9c31('0x7f')](/"/g,'\x27'));switch(_0x4fdbbb){case _0x9c31('0x42'):var _0xbc39b9=moment(_0x5d4b80,_0x9c31('0xe'),!![]);if(_0xbc39b9[_0x9c31('0x80')]()){_0x3fe93d['push']('\x22'+_0x5d4b80+'\x22');}else{_0x4d8243[_0x9c31('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x9c31('0x43'):var _0x37c27b=parseInt(_0x5d4b80);_0x5d4b80=_[_0x9c31('0x81')](_0x37c27b)||_0x37c27b<0x0||_0x37c27b>0x4?_0x1bee3b?0x3:0x2:_0x37c27b;_0x3fe93d[_0x9c31('0x1c')]('\x22'+_0x5d4b80+'\x22');break;case _0x9c31('0x32'):var _0x2f4194=parseInt(_0x5d4b80);if(_[_0x9c31('0x82')](_0x2f4194)&&_[_0x9c31('0x83')](_0x25f909,_0x2f4194)){_0x3fe93d[_0x9c31('0x1c')]('\x22'+_0x2f4194+'\x22');}else{_0x4d8243[_0x9c31('0x1c')]('agent\x20not\x20exists');}break;case _0x9c31('0x84'):if(isEmail(_0x5d4b80)){_0x3fe93d[_0x9c31('0x1c')]('\x22'+_0x5d4b80+'\x22');}else{_0x4d8243[_0x9c31('0x1c')](_0x9c31('0x85'));}break;case'dateOfBirth':var _0x5f2dc4=moment(_0x5d4b80,_0x9c31('0x86'),!![]);if(_0x5f2dc4[_0x9c31('0x80')]()){_0x3fe93d[_0x9c31('0x1c')]('\x22'+_0x5d4b80+'\x22');}else{_0x4d8243[_0x9c31('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x9c31('0x6a'):var _0xe64550=shared['timezones'];var _0x3fbe8a=_0xe64550[_0x5d4b80];if(!_[_0x9c31('0x1d')](_0x3fbe8a)){var _0x12bdea=_0x3fbe8a[_0x9c31('0x6b')];_0x3fe93d['push']('\x22'+_0x5d4b80+'\x22');_0x3fe93d[_0x9c31('0x1c')]('\x22'+_0x12bdea+'\x22');}break;default:_0x3fe93d['push']('\x22'+_0x5d4b80+'\x22');}}else{switch(_0x4fdbbb){case'firstName':case _0x9c31('0x10'):_0x4d8243[_0x9c31('0x1c')](_0x4fdbbb+'\x20not\x20specified');break;default:_0x3fe93d['push']('\x22\x22');}}}}else{var _0xcdc12d='';if(!_['isNil'](_0x585818)){if(!_0x51cc41[_0x9c31('0x87')](_0x585818['id'])){if(!_[_0x9c31('0x1d')](_0x4db9d9[_0x9c31('0x7c')][_0xce4b05][_0x57be96[_0x4fdbbb]])){var _0x5d4b80=_[_0x9c31('0x7e')](_0x4db9d9[_0x9c31('0x7c')][_0xce4b05][_0x57be96[_0x4fdbbb]]['replace'](/"/g,'\x27'));var _0x91b5d1=phoneDescriptions[_0x9c31('0x7d')](_0x3fb012=>_0x3fb012[_0x9c31('0x88')]===_0x585818['id']);if(!_['isNil'](_0x91b5d1)){var _0xe7c31b=_[_0x9c31('0x7e')](_0x4db9d9['data'][_0xce4b05][_0x57be96[_0x91b5d1['description']]]['replace'](/"/g,'\x27'));if(!_[_0x9c31('0x1d')](_0xe7c31b))_0x5d4b80=_0x5d4b80+'§'+_0xe7c31b;}if(_0xcdc12d=='')_0xcdc12d=_0x5d4b80;else _0xcdc12d+='|'+_0x5d4b80;}_0xc25856[_0x9c31('0x1c')](_0x585818['id']+':'+_0xcdc12d);_0x51cc41[_0x585818['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3fe93d[_0x9c31('0x1c')]('\x22'+_0xc25856[_0x9c31('0x12')](';')+'\x22');}if(_0x4d8243[_0x9c31('0x19')]){handleError(_0x4db9d9['data'][_0xce4b05],{'code':_0x9c31('0x89'),'message':_0x4d8243[_0x9c31('0x12')]()});}else{fs[_0x9c31('0x8a')](_0x3f4560,_0x3fe93d[_0x9c31('0x12')]()+'\x0a');}_0x3fe93d=[];}if(!(stats[_0x9c31('0x8b')]%0xc8)){socket['emit'](_0x9c31('0x8c')+_0x58e34e,stats);stats[_0x9c31('0x58')]=[];}}if(stopped){logger[_0x9c31('0x55')]('Abort\x20parser');_0x339fb6['abort']();}}catch(_0x3868c0){handleError(_0x4db9d9['data'][_0xce4b05],{'code':_0x9c31('0x8d'),'message':_0x3868c0[_0x9c31('0x56')]});logger[_0x9c31('0x62')]('step',_0x3868c0[_0x9c31('0x56')]);}},'complete':function(){try{var _0x44c623=[];var _0x44a15e=[];var _0x251b1d=_0x9c31('0x3d');if(_0x4c02c5[_0x9c31('0x8e')]&&_0x4c02c5['duplicates']['length']){_0x251b1d=_0x9c31('0x8f')+_0x58e34e;_0x44c623[_0x9c31('0x1c')](_0x9c31('0x90')+_0x251b1d+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x9c31('0x91')+_0x58e34e;tmp_voice_queues=_0x9c31('0x92')+_0x58e34e;_0x44a15e[_0x9c31('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x9c31('0x93'));_0x44a15e[_0x9c31('0x1c')](_0x9c31('0x90')+tmp_voice_queues+_0x9c31('0x93'));BPromise[_0x9c31('0x94')](_0x44a15e,handleTZQuery)[_0x9c31('0x18')](function(_0x283184){updateTzCampaigns(_0x4c02c5[_0x9c31('0x2f')])[_0x9c31('0x18')](function(_0x1d246e){updateTzVoiceQueues(_0x4c02c5[_0x9c31('0x2f')])[_0x9c31('0x18')](function(_0x388bec){if(hasTZ)_0x193c6d=_0x193c6d[_0x9c31('0x7f')](_0x9c31('0x6a'),'dialTimezone,utcOffset');var _0x5e93a9=util[_0x9c31('0xd')]('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',_0x3f4560,_0x251b1d,_0x193c6d,_0x4c02c5['ListId'],_0x4c02c5[_0x9c31('0x95')]||null,NOW,NOW);if(_[_0x9c31('0x1d')](_0x57be96[_0x9c31('0x42')])){_0x5e93a9+=',\x20scheduledAt\x20=\x20NOW()';}_0x44c623[_0x9c31('0x1c')](_0x5e93a9);if(_0x4c02c5['duplicates']&&_0x4c02c5[_0x9c31('0x8e')][_0x9c31('0x19')]){_0x44c623[_0x9c31('0x1c')](insertCmContact(_0x4c02c5[_0x9c31('0x2f')],_0x251b1d,_0x4c02c5[_0x9c31('0x8e')],_0x57be96));_0x44c623[_0x9c31('0x1c')]('DROP\x20TABLE\x20'+_0x251b1d+';');}BPromise[_0x9c31('0x94')](_0x44c623,handleQuery)['then'](function(_0x47944c){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x44c623=[];for(var _0x493261=0x0;_0x493261\x20\x20','root','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','then','push','all','AdditionalPhones','split','length','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','phone','scheduledat','ListId','createdAt','updatedAt','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper','toString','cm_hopper_black','cm_contacts','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ContactId','priority','recallme','\x22onlyIfOpen\x22','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','offset','set','main','stringify','binding','clone','socket_timestamp','.csv','keys','includes','header','ContactItemType','findAll','name','writeFileSync','parse','createReadStream','data'];(function(_0xc53cc5,_0x7d229e){var _0x394081=function(_0x44eb1d){while(--_0x44eb1d){_0xc53cc5['push'](_0xc53cc5['shift']());}};_0x394081(++_0x7d229e);}(_0x78c2,0x1bc));var _0x278c=function(_0x1dd122,_0x4dcca5){_0x1dd122=_0x1dd122-0x0;var _0x4e3713=_0x78c2[_0x1dd122];return _0x4e3713;};'use strict';var fs=require('fs');var path=require(_0x278c('0x0'));var _=require(_0x278c('0x1'));var Papa=require(_0x278c('0x2'));var util=require(_0x278c('0x3'));var BPromise=require('bluebird');var moment=require(_0x278c('0x4'));var squel=require(_0x278c('0x5'));var Redis=require(_0x278c('0x6'));var db=require(_0x278c('0x7'))['db'];var config=require(_0x278c('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x278c('0x9'))(_0x278c('0xa'));config['redis']=_[_0x278c('0xb')](config[_0x278c('0xc')],{'host':_0x278c('0xd'),'port':0x18eb});var socket=require(_0x278c('0xe'))(new Redis(config[_0x278c('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x278c('0xf')](_0x278c('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x278c('0xf')](_0x278c('0x10'));function isEmail(_0x47b2d8){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x47b2d8);}function selectNotIn(_0x133da1,_0x309d63,_0x578c3a,_0x2bff5d,_0x28736b){return squel[_0x278c('0x11')]()[_0x278c('0x12')]('phone')[_0x278c('0x13')](_0x2bff5d)[_0x278c('0x14')](_0x309d63,null,_0x309d63+_0x278c('0x15')+_0x2bff5d+'.'+_0x578c3a)[_0x278c('0x16')](_0x2bff5d+'.'+_0x578c3a+_0x278c('0x17')+_0x133da1+'.'+_0x578c3a)[_0x278c('0x16')](_0x309d63+_0x278c('0x18')+_0x28736b[_0x278c('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4efaec,_0x504c8f){promisesAdditionalPhones=[];return db[_0x278c('0x19')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x278c('0x1a')](function(_0x2bf528){if(_0x2bf528!==null){var _0x5bf57f=[];for(var _0x4acb26=0x0;_0x4acb26<_0x2bf528['length'];_0x4acb26++){var _0x314b00=_0x2bf528[_0x4acb26];_0x5bf57f[_0x278c('0x1b')](insertAdditionalPhones(_0x314b00));}}Promise[_0x278c('0x1c')](_0x5bf57f)[_0x278c('0x1a')](function(){_0x4efaec({'val':0x1});});});});}function insertAdditionalPhones(_0xd49bda){return new Promise(function(_0x182053,_0x4ca0ec){var _0x4452e6=_0xd49bda[_0x278c('0x1d')];var _0x45cb5c=_0x4452e6[_0x278c('0x1e')](';');var _0x1cba58=[];orderBy=0x0;for(var _0x3c730e=0x0;_0x3c730e<_0x45cb5c[_0x278c('0x1f')];_0x3c730e++){_0x1cba58[_0x278c('0x1b')](splitAdditionalPhone(_0xd49bda['id'],_0x45cb5c[_0x3c730e]));}Promise['all'](_0x1cba58)['then'](function(){_0x182053({'val':_0x45cb5c[_0x278c('0x1f')]});});});}function splitAdditionalPhone(_0x3fadb5,_0x41e255){return new Promise(function(_0x2a8701,_0x3ccd9e){var _0x1f2e6d=_0x41e255[_0x278c('0x1e')](':');var _0x5538af=_0x1f2e6d[0x0];var _0x1d4c5b=_0x1f2e6d[0x1];if(!_['isNil'](_0x1d4c5b)){var _0x4b0306=_0x1d4c5b[_0x278c('0x1e')]('|');var _0x26d60f=[];for(var _0x167aac=0x0;_0x167aac<_0x4b0306[_0x278c('0x1f')];_0x167aac++){if(_0x4b0306[_0x167aac]!==''){var _0x515e80=_['filter'](promisesAdditionalPhones,{'contactId':_0x3fadb5,'phone':_0x4b0306[_0x167aac]});if(_0x515e80[_0x278c('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0x278c('0x1b')]({'contactId':_0x3fadb5,'contactTypeId':_0x5538af,'phone':_0x4b0306[_0x167aac],'orderBy':orderBy});}}}_0x2a8701({'ok':0x1});}else _0x2a8701({'res':0x0});});}function createAdditionalPhone(_0x4468b0,_0x2b95b0,_0x22bda0,_0x538425){var _0x3d04da='';var _0x5efd5e='';var _0x463cbb=_0x22bda0[_0x278c('0x1e')]('§');_0x3d04da=_0x463cbb[0x0];if(_0x463cbb['length']==0x2)_0x5efd5e=_0x463cbb[0x1];return new Promise(function(_0x339729,_0x2b99d3){return db[_0x278c('0x20')]['findOne']({'where':{'CmContactId':_0x4468b0,'item':_0x3d04da}})[_0x278c('0x1a')](function(_0x44143a){if(_0x44143a){return db['CmContactHasItem'][_0x278c('0x21')]({'ItemTypeId':_0x2b95b0,'description':_0x5efd5e,'OrderBy':_0x538425},{'where':{'CmContactId':_0x4468b0,'item':_0x3d04da}})[_0x278c('0x1a')](function(_0x3e5e6e){_0x339729({'res':_0x278c('0x22')});});}else{return db[_0x278c('0x20')][_0x278c('0x23')]({'CmContactId':_0x4468b0,'item':_0x3d04da,'description':_0x5efd5e,'ItemTypeId':_0x2b95b0,'OrderBy':_0x538425,'ItemClass':_0x278c('0x24')})[_0x278c('0x1a')](function(_0x23020b){_0x339729({'res':_0x278c('0x25')});});}});});}function insertCmHopper(_0x53be46,_0x54484c,_0x3f3a77,_0x2d577a,_0x1b4568){var _0x51d829=[_0x278c('0x26'),'cm_contacts.scheduledat',_0x278c('0x27'),_0x278c('0x28'),_0x54484c+'.'+_0x2d577a,_0x278c('0x29'),_0x278c('0x2a'),_0x278c('0x2b'),_0x278c('0x2c'),'\x22'+_0x1b4568+'\x22'];return squel[_0x278c('0x2d')]()[_0x278c('0x2e')]('cm_hopper')[_0x278c('0x2f')]([_0x278c('0x30'),_0x278c('0x31'),'ContactId',_0x278c('0x32'),_0x2d577a,_0x278c('0x33'),_0x278c('0x34'),'priority',_0x278c('0x35'),'recallme'],squel[_0x278c('0x11')]()[_0x278c('0x36')](_0x51d829)['from'](_0x54484c)['join']('cm_contacts',null,_0x278c('0x37')+_0x54484c+_0x278c('0x38'))[_0x278c('0x14')](_0x3f3a77,null,_0x3f3a77+'.id\x20=\x20'+_0x54484c+'.'+_0x2d577a)[_0x278c('0x16')](_0x54484c+_0x278c('0x39'),_0x53be46)[_0x278c('0x16')](_0x278c('0x3a'),NOW)[_0x278c('0x16')](_0x278c('0x3b'),selectNotIn(_0x54484c,_0x3f3a77,_0x2d577a,'cm_hopper',[_0x278c('0x3c'),'\x22onlyIfOpen\x22']))[_0x278c('0x16')](_0x278c('0x3b'),selectNotIn(_0x54484c,_0x3f3a77,_0x2d577a,_0x278c('0x3d'),[_0x278c('0x3c')])))[_0x278c('0x3e')]();}function insertCmHopperBlack(_0x3fb13e,_0x46758e,_0x41d595,_0x2463d9){var _0x45851f=[_0x278c('0x26'),_0x278c('0x27'),_0x278c('0x28'),_0x46758e+'.'+_0x2463d9,_0x278c('0x29'),_0x278c('0x2a')];return squel['insert']()[_0x278c('0x2e')](_0x278c('0x3f'))[_0x278c('0x2f')]([_0x278c('0x30'),'ContactId','ListId',_0x2463d9,'createdAt',_0x278c('0x34')],squel[_0x278c('0x11')]()['fields'](_0x45851f)[_0x278c('0x13')](_0x46758e)[_0x278c('0x14')](_0x278c('0x40'),null,_0x278c('0x37')+_0x46758e+_0x278c('0x38'))['join'](_0x41d595,null,_0x41d595+_0x278c('0x15')+_0x46758e+'.'+_0x2463d9)['where'](_0x46758e+_0x278c('0x39'),_0x3fb13e)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x278c('0x16')](_0x278c('0x3b'),squel[_0x278c('0x11')]()['field'](_0x278c('0x30'))['from'](_0x278c('0x3f'))['where'](_0x278c('0x41'),_0x3fb13e)[_0x278c('0x16')](_0x2463d9+_0x278c('0x17')+_0x46758e+'.'+_0x2463d9)))['toString']();}function insertTzCmHopper(_0x231aed,_0x1460a3,_0x22c0b4,_0x99a5c9,_0x1a267e,_0x26351b){var _0xf55daf=['cm_contacts.phone',_0x278c('0x42')+_0x26351b+_0x278c('0x43'),_0x278c('0x27'),'cm_contacts.ListId',_0x1460a3+'.'+_0x99a5c9,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x278c('0x2b'),_0x278c('0x2c'),'\x22'+_0x1a267e+'\x22'];var _0x2dce5b=squel[_0x278c('0x2d')]()[_0x278c('0x2e')](_0x278c('0x3d'))[_0x278c('0x2f')](['phone','scheduledat',_0x278c('0x44'),_0x278c('0x32'),_0x99a5c9,_0x278c('0x33'),_0x278c('0x34'),_0x278c('0x45'),_0x278c('0x35'),_0x278c('0x46')],squel[_0x278c('0x11')]()[_0x278c('0x36')](_0xf55daf)[_0x278c('0x13')](_0x1460a3)[_0x278c('0x14')](_0x278c('0x40'),null,_0x278c('0x37')+_0x1460a3+_0x278c('0x38'))['join'](_0x22c0b4,null,_0x22c0b4+_0x278c('0x15')+_0x1460a3+'.'+_0x99a5c9)[_0x278c('0x14')](_0x26351b,null,_0x26351b+_0x278c('0x15')+_0x1460a3+'.'+_0x99a5c9)['where'](_0x1460a3+_0x278c('0x39'),_0x231aed)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x278c('0x16')](_0x278c('0x3b'),selectNotIn(_0x1460a3,_0x22c0b4,_0x99a5c9,_0x278c('0x3d'),['\x22always\x22',_0x278c('0x47')]))[_0x278c('0x16')](_0x278c('0x3b'),selectNotIn(_0x1460a3,_0x22c0b4,_0x99a5c9,'cm_hopper',['\x22always\x22'])))['toString']();return _0x2dce5b;}function insertTzCmHopperBlack(_0x5d27f3,_0x5abec7,_0x125a1c,_0x25a215){var _0xfcadcc=[_0x278c('0x26'),_0x278c('0x27'),_0x278c('0x28'),_0x5abec7+'.'+_0x25a215,_0x278c('0x29'),'cm_contacts.updatedAt'];return squel[_0x278c('0x2d')]()[_0x278c('0x2e')](_0x278c('0x3f'))[_0x278c('0x2f')]([_0x278c('0x30'),_0x278c('0x44'),_0x278c('0x32'),_0x25a215,_0x278c('0x33'),_0x278c('0x34')],squel[_0x278c('0x11')]()[_0x278c('0x36')](_0xfcadcc)[_0x278c('0x13')](_0x5abec7)[_0x278c('0x14')](_0x278c('0x40'),null,'cm_contacts.ListId\x20=\x20'+_0x5abec7+_0x278c('0x38'))[_0x278c('0x14')](_0x125a1c,null,_0x125a1c+_0x278c('0x15')+_0x5abec7+'.'+_0x25a215)[_0x278c('0x16')](_0x5abec7+_0x278c('0x39'),_0x5d27f3)[_0x278c('0x16')](_0x278c('0x3a'),NOW)[_0x278c('0x16')](_0x278c('0x3b'),squel['select']()[_0x278c('0x12')](_0x278c('0x30'))[_0x278c('0x13')](_0x278c('0x3f'))[_0x278c('0x16')]('ListId\x20=\x20?',_0x5d27f3)[_0x278c('0x16')](_0x25a215+_0x278c('0x17')+_0x5abec7+'.'+_0x25a215)))[_0x278c('0x3e')]();}function insertCmHopperAdditionalPhones(_0x458eee){var _0x5e354e=[_0x278c('0x48'),_0x278c('0x49'),_0x278c('0x4a'),_0x278c('0x4b'),_0x278c('0x4c')];return squel[_0x278c('0x2d')]()['into'](_0x278c('0x4d'))['fromQuery'](['CmHopperId','phone','OrderBy',_0x278c('0x33'),'updatedAt'],squel[_0x278c('0x11')]()[_0x278c('0x36')](_0x5e354e)[_0x278c('0x13')](_0x278c('0x3d'))['join'](_0x278c('0x40'),null,_0x278c('0x4e'))[_0x278c('0x14')](_0x278c('0x4f'),null,_0x278c('0x50'))[_0x278c('0x16')](_0x278c('0x51'),_0x458eee)[_0x278c('0x16')](_0x278c('0x3a'),NOW))[_0x278c('0x3e')]();}function insertCmContact(_0x1e8983,_0x12f96d,_0x16efbf,_0xb4ef4f){var _0x3ce1ba=_[_0x278c('0x52')](_['keys'](_0xb4ef4f),[_0x278c('0x32'),_0x278c('0x53'),_0x278c('0x33'),_0x278c('0x34'),_0x278c('0x54')]);return squel[_0x278c('0x2d')]()[_0x278c('0x2e')](_0x278c('0x40'))[_0x278c('0x2f')](_0x3ce1ba,squel[_0x278c('0x11')]()[_0x278c('0x36')](_0x3ce1ba)[_0x278c('0x13')](_0x12f96d)[_0x278c('0x16')]('('+_0x16efbf[_0x278c('0x14')](',')+_0x278c('0x55'),squel['select']()[_0x278c('0x36')](_0x16efbf)[_0x278c('0x13')](_0x278c('0x40'))[_0x278c('0x16')](_0x278c('0x41'),_0x1e8983)[_0x278c('0x16')](_0x278c('0x56')))[_0x278c('0x16')](_0x278c('0x57'),squel['select']()['field'](_0x278c('0x58'),_0x278c('0x59'))[_0x278c('0x13')](_0x12f96d)[_0x278c('0x5a')](_0x16efbf[_0x278c('0x14')](','))))['toString']();}function handleStop(){logger[_0x278c('0x5b')](_0x278c('0x5c'));stopped=!![];}function handleUncaughtException(_0x267da9){logger[_0x278c('0x5d')](_0x267da9[_0x278c('0x5e')]);process[_0x278c('0x5f')](0x1);}function handleError(_0x4af79c,_0x202e8b){stats[_0x278c('0x60')][_0x278c('0x1b')]({'name':_0x202e8b[_0x278c('0x61')],'message':_0x202e8b[_0x278c('0x5e')],'row':_0x4af79c});}function handleQuery(_0x56397b){logger[_0x278c('0x5b')](_0x56397b);return db[_0x278c('0x62')][_0x278c('0x63')](_0x56397b)[_0x278c('0x64')](function(_0x52c8ff){results['push'](_0x52c8ff);})['catch'](function(_0x1a143e){logger['error'](_0x1a143e[_0x278c('0x5e')]);});}function updateTzCampaigns(_0x99faf3){return new Promise(function(_0x280aea,_0x3951d2){var _0x4d1d5c=squel[_0x278c('0x11')]()[_0x278c('0x36')]([_0x278c('0x65'),_0x278c('0x66')])['from']('campaigns')[_0x278c('0x14')](_0x278c('0x67'),null,_0x278c('0x68'))[_0x278c('0x16')]('campaigns_has_cm_lists.CmListId='+_0x99faf3);db[_0x278c('0x62')]['query'](_0x4d1d5c[_0x278c('0x3e')]())[_0x278c('0x64')](function(_0x28a197){var _0x5c39fc=[];for(var _0x2c72de=0x0;_0x2c72de<_0x28a197[_0x278c('0x1f')];_0x2c72de++){_0x5c39fc[_0x278c('0x1b')](getTimezoneData(_0x28a197[_0x2c72de],tmp_campaigns));}BPromise['all'](_0x5c39fc)['then'](function(){_0x280aea({'val':0x1});});})[_0x278c('0x69')](function(_0x50f957){logger['error'](_0x50f957[_0x278c('0x5e')]);_0x280aea({'val':0x0});});});}function updateTzVoiceQueues(_0x3181d1){return new Promise(function(_0x4a85c7,_0x59323d){var _0x3d7a82=squel[_0x278c('0x11')]()['fields']([_0x278c('0x6a'),_0x278c('0x6b')])[_0x278c('0x13')]('voice_queues')[_0x278c('0x14')]('voice_queues_has_cm_lists',null,_0x278c('0x6c'))[_0x278c('0x16')](_0x278c('0x6d')+_0x3181d1);db['sequelize'][_0x278c('0x63')](_0x3d7a82[_0x278c('0x3e')]())['spread'](function(_0x38bc12){var _0x5041f2=[];for(var _0x19341f=0x0;_0x19341f<_0x38bc12[_0x278c('0x1f')];_0x19341f++){_0x5041f2[_0x278c('0x1b')](getTimezoneData(_0x38bc12[_0x19341f],tmp_voice_queues));}BPromise[_0x278c('0x1c')](_0x5041f2)[_0x278c('0x1a')](function(){_0x4a85c7({'val':0x1});});})[_0x278c('0x69')](function(_0x11cd3f){logger['error'](_0x11cd3f[_0x278c('0x5e')]);_0x4a85c7({'val':0x0});});});}function getTimezoneData(_0x368e71,_0x4ab206){return new Promise(function(_0x12825f,_0x5bd2ce){var _0xde0e72=shared[_0x278c('0x6e')];var _0x200332=_0xde0e72[_0x368e71[_0x278c('0x6f')]];if(_[_0x278c('0x70')](_0x200332)){_0x12825f({'ret':0x1});}else{var _0x5226f0=_0x200332[_0x278c('0x71')];var _0x2672e2=squel[_0x278c('0x2d')]()[_0x278c('0x2e')](_0x4ab206)['set']('id',_0x368e71['id'])['set'](_0x278c('0x72'),_0x5226f0)[_0x278c('0x73')](_0x278c('0x6f'),_0x368e71[_0x278c('0x6f')])[_0x278c('0x3e')]();return db[_0x278c('0x62')][_0x278c('0x63')](_0x2672e2)[_0x278c('0x64')](function(_0x3bcae2){_0x12825f({'ret':0x1});})['catch'](function(_0x24b054){logger[_0x278c('0x5d')](_0x24b054[_0x278c('0x5e')]);_0x5bd2ce({'ret':0x1});});}});}function handleTZQuery(_0x5db6b1){logger[_0x278c('0x5b')](_0x5db6b1);return db[_0x278c('0x62')][_0x278c('0x63')](_0x5db6b1)['spread'](function(_0x480386){})['catch'](function(_0x5fd55e){logger[_0x278c('0x5d')](_0x5fd55e['message']);});}function main(_0x4e968d,_0x16a95c,_0x2a15a5,_0x24cc2c){logger[_0x278c('0x5b')](_0x278c('0x74'),_0x4e968d,JSON[_0x278c('0x75')](_0x16a95c));process['send']('start');var _0x528e32=_0x16a95c[_0x278c('0x76')];var _0x476aa7=_[_0x278c('0x77')](_0x528e32);var _0x5a8ed7=_0x16a95c[_0x278c('0x78')];var _0x5906e4=path['join'](config['root'],'server/files/tmp',_0x5a8ed7+_0x278c('0x79'));hasTZ=_[_0x278c('0x7a')](_0x528e32)[_0x278c('0x7b')](_0x278c('0x6f'));var _0x293ae7=_['keys'](_0x528e32)[_0x278c('0x14')]();logger[_0x278c('0x5b')](_0x278c('0x7c'),_0x293ae7);db[_0x278c('0x7d')][_0x278c('0x7e')]({'raw':!![],'attributes':['id',_0x278c('0x7f')]})[_0x278c('0x1a')](function(_0x950369){for(var _0x45aeea=0x0;_0x45aeea<_0x950369[_0x278c('0x1f')];_0x45aeea++){if(_0x950369[_0x45aeea][_0x278c('0x7f')]in _0x528e32){contactItemTypes[_0x278c('0x1b')](_0x950369[_0x45aeea]);delete _0x476aa7[_0x950369[_0x45aeea][_0x278c('0x7f')]];hasAdditionalPhones=!![];}for(var _0x5dbbfe in _0x528e32){if(_0x950369[_0x45aeea][_0x278c('0x7f')]+'_description'===_0x5dbbfe){phoneDescriptions[_0x278c('0x1b')]({'itemTypeId':_0x950369[_0x45aeea]['id'],'description':_0x5dbbfe});delete _0x476aa7[_0x5dbbfe];}}}if(hasAdditionalPhones)_0x476aa7[_0x278c('0x1d')]='';var _0x83c74=_['keys'](_0x476aa7)[_0x278c('0x14')]();logger[_0x278c('0x5b')]('header',_0x83c74);fs[_0x278c('0x80')](_0x5906e4,_0x83c74+'\x0a');Papa[_0x278c('0x81')](fs[_0x278c('0x82')](_0x4e968d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x54e899,_0x19a4cd){try{for(var _0x30c7af=0x0,_0x4c33c4=[];_0x30c7af<_0x54e899[_0x278c('0x83')][_0x278c('0x1f')];_0x30c7af++){stats['rows']+=0x1;if(_0x54e899[_0x278c('0x60')][_0x30c7af]){handleError(_0x54e899[_0x278c('0x83')][_0x30c7af],_0x54e899['errors'][_0x30c7af]);}else{var _0x21248b=[];var _0x52ff81=[];var _0x392578={};for(var _0x2cae33 in _0x528e32){let _0x3a17ac=contactItemTypes[_0x278c('0x84')](_0x3245e5=>_0x3245e5[_0x278c('0x7f')]===_0x2cae33);let _0x40f519=contactItemTypes[_0x278c('0x84')](_0x3bcb0b=>_0x3bcb0b[_0x278c('0x7f')]+_0x278c('0x85')===_0x2cae33);if(_[_0x278c('0x70')](_0x3a17ac)&&_['isNil'](_0x40f519)){if(_0x528e32['hasOwnProperty'](_0x2cae33)){if(_0x54e899[_0x278c('0x83')][_0x30c7af][_0x528e32[_0x2cae33]]){var _0x30b2a5=_[_0x278c('0x86')](_0x54e899['data'][_0x30c7af][_0x528e32[_0x2cae33]]['replace'](/"/g,'\x27'));switch(_0x2cae33){case _0x278c('0x31'):var _0x102590=moment(_0x30b2a5,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x102590[_0x278c('0x87')]()){_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x30b2a5+'\x22');}else{_0x21248b['push'](_0x278c('0x88'));}break;case'priority':var _0xcc87d0=parseInt(_0x30b2a5);_0x30b2a5=_[_0x278c('0x89')](_0xcc87d0)||_0xcc87d0<0x0||_0xcc87d0>0x4?_0x24cc2c?0x3:0x2:_0xcc87d0;_0x4c33c4['push']('\x22'+_0x30b2a5+'\x22');break;case'UserId':var _0x5d84ad=parseInt(_0x30b2a5);if(_['isNumber'](_0x5d84ad)&&_['includes'](_0x2a15a5,_0x5d84ad)){_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x5d84ad+'\x22');}else{_0x21248b['push']('agent\x20not\x20exists');}break;case _0x278c('0x8a'):if(isEmail(_0x30b2a5)){_0x4c33c4['push']('\x22'+_0x30b2a5+'\x22');}else{_0x21248b[_0x278c('0x1b')](_0x278c('0x8b'));}break;case _0x278c('0x8c'):var _0x41b9e2=moment(_0x30b2a5,_0x278c('0x8d'),!![]);if(_0x41b9e2['isValid']()){_0x4c33c4['push']('\x22'+_0x30b2a5+'\x22');}else{_0x21248b[_0x278c('0x1b')](_0x278c('0x8e'));}break;case _0x278c('0x6f'):var _0x326fee=shared['timezones'];var _0x183e03=_0x326fee[_0x30b2a5];if(!_[_0x278c('0x70')](_0x183e03)){var _0x185cc1=_0x183e03[_0x278c('0x71')];_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x30b2a5+'\x22');_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x185cc1+'\x22');}break;default:_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x30b2a5+'\x22');}}else{switch(_0x2cae33){case _0x278c('0x8f'):case _0x278c('0x30'):_0x21248b[_0x278c('0x1b')](_0x2cae33+'\x20not\x20specified');break;default:_0x4c33c4[_0x278c('0x1b')]('\x22\x22');}}}}else{var _0x495267='';if(!_[_0x278c('0x70')](_0x3a17ac)){if(!_0x392578[_0x278c('0x90')](_0x3a17ac['id'])){if(!_[_0x278c('0x70')](_0x54e899['data'][_0x30c7af][_0x528e32[_0x2cae33]])){var _0x30b2a5=_[_0x278c('0x86')](_0x54e899['data'][_0x30c7af][_0x528e32[_0x2cae33]][_0x278c('0x91')](/"/g,'\x27'));var _0x21260e=phoneDescriptions[_0x278c('0x84')](_0x37cca2=>_0x37cca2['itemTypeId']===_0x3a17ac['id']);if(!_[_0x278c('0x70')](_0x21260e)){var _0x34e7b8=_[_0x278c('0x86')](_0x54e899[_0x278c('0x83')][_0x30c7af][_0x528e32[_0x21260e[_0x278c('0x92')]]][_0x278c('0x91')](/"/g,'\x27'));if(!_[_0x278c('0x70')](_0x34e7b8))_0x30b2a5=_0x30b2a5+'§'+_0x34e7b8;}if(_0x495267=='')_0x495267=_0x30b2a5;else _0x495267+='|'+_0x30b2a5;}_0x52ff81['push'](_0x3a17ac['id']+':'+_0x495267);_0x392578[_0x3a17ac['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x52ff81['join'](';')+'\x22');}if(_0x21248b[_0x278c('0x1f')]){handleError(_0x54e899[_0x278c('0x83')][_0x30c7af],{'code':_0x278c('0x93'),'message':_0x21248b[_0x278c('0x14')]()});}else{fs[_0x278c('0x94')](_0x5906e4,_0x4c33c4['join']()+'\x0a');}_0x4c33c4=[];}if(!(stats['rows']%0xc8)){socket[_0x278c('0x95')](_0x278c('0x96')+_0x5a8ed7,stats);stats[_0x278c('0x60')]=[];}}if(stopped){logger[_0x278c('0x5b')](_0x278c('0x97'));_0x19a4cd['abort']();}}catch(_0x3fa953){handleError(_0x54e899[_0x278c('0x83')][_0x30c7af],{'code':_0x278c('0x98'),'message':_0x3fa953[_0x278c('0x5e')]});logger['error'](_0x278c('0x99'),_0x3fa953['message']);}},'complete':function(){try{var _0xa9e83a=[];var _0x1fc2fc=[];var _0x4ffda=_0x278c('0x40');if(_0x16a95c['duplicates']&&_0x16a95c['duplicates'][_0x278c('0x1f')]){_0x4ffda=_0x278c('0x9a')+_0x5a8ed7;_0xa9e83a[_0x278c('0x1b')]('CREATE\x20TABLE\x20'+_0x4ffda+_0x278c('0x9b'));}tmp_campaigns=_0x278c('0x9c')+_0x5a8ed7;tmp_voice_queues=_0x278c('0x9d')+_0x5a8ed7;_0x1fc2fc[_0x278c('0x1b')](_0x278c('0x9e')+tmp_campaigns+_0x278c('0x9f'));_0x1fc2fc[_0x278c('0x1b')](_0x278c('0x9e')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x278c('0xa0')](_0x1fc2fc,handleTZQuery)[_0x278c('0x1a')](function(_0xba7a0f){updateTzCampaigns(_0x16a95c[_0x278c('0x32')])[_0x278c('0x1a')](function(_0x30e1d2){updateTzVoiceQueues(_0x16a95c[_0x278c('0x32')])[_0x278c('0x1a')](function(_0x5bb576){if(hasTZ)_0x83c74=_0x83c74[_0x278c('0x91')]('dialTimezone',_0x278c('0xa1'));var _0x10e81e=util[_0x278c('0xf')](_0x278c('0xa2'),_0x5906e4,_0x4ffda,_0x83c74,_0x16a95c[_0x278c('0x32')],_0x16a95c['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x528e32[_0x278c('0x31')])){_0x10e81e+=_0x278c('0xa3');}_0xa9e83a[_0x278c('0x1b')](_0x10e81e);if(_0x16a95c[_0x278c('0xa4')]&&_0x16a95c[_0x278c('0xa4')][_0x278c('0x1f')]){_0xa9e83a['push'](insertCmContact(_0x16a95c[_0x278c('0x32')],_0x4ffda,_0x16a95c[_0x278c('0xa4')],_0x528e32));_0xa9e83a[_0x278c('0x1b')](_0x278c('0xa5')+_0x4ffda+';');}BPromise[_0x278c('0xa0')](_0xa9e83a,handleQuery)[_0x278c('0x1a')](function(_0x330885){BPromise[_0x278c('0x1c')]([handleAdditionalPhones()])[_0x278c('0x1a')](function(){_0xa9e83a=[];for(var _0x470e36=0x0;_0x470e36\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','phone','from','\x20=\x20','where'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0xa057,0x123));var _0x7a05=function(_0x1eb637,_0x444e9b){_0x1eb637=_0x1eb637-0x0;var _0x1702af=_0xa057[_0x1eb637];return _0x1702af;};'use strict';var fs=require('fs');var path=require(_0x7a05('0x0'));var _=require(_0x7a05('0x1'));var Papa=require('papaparse');var util=require(_0x7a05('0x2'));var BPromise=require(_0x7a05('0x3'));var moment=require(_0x7a05('0x4'));var squel=require('squel');var Redis=require(_0x7a05('0x5'));var db=require(_0x7a05('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x7a05('0x7'))('import');config['redis']=_[_0x7a05('0x8')](config[_0x7a05('0x9')],{'host':_0x7a05('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a05('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x7a05('0xb')](_0x7a05('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x7a05('0xb')](_0x7a05('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x417ca9){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))*$/[_0x7a05('0xe')](_0x417ca9);}function selectNotIn(_0x1e2f9e,_0xa3c03e,_0x4a7a63,_0x73b0d8,_0x463a80){return squel['select']()['field'](_0x7a05('0xf'))[_0x7a05('0x10')](_0x73b0d8)['join'](_0xa3c03e,null,_0xa3c03e+'.id\x20=\x20'+_0x73b0d8+'.'+_0x4a7a63)['where'](_0x73b0d8+'.'+_0x4a7a63+_0x7a05('0x11')+_0x1e2f9e+'.'+_0x4a7a63)[_0x7a05('0x12')](_0xa3c03e+_0x7a05('0x13')+_0x463a80[_0x7a05('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x31c140,_0x351ac2){promisesAdditionalPhones=[];promisesContact=[];return db[_0x7a05('0x15')][_0x7a05('0x16')]('select\x20*\x20from\x20'+tempTableName)['spread'](function(_0x37d394){if(_0x37d394!==null){var _0x8ad482=[];for(var _0x480c8b=0x0;_0x480c8b<_0x37d394[_0x7a05('0x17')];_0x480c8b++){var _0x3b45e9=_0x37d394[_0x480c8b];if(!_['isNil'](_0x3b45e9[_0x7a05('0xf')])){if(!_[_0x7a05('0x18')](_0x3b45e9[_0x7a05('0x19')]))_0x8ad482['push'](insertAdditionalPhones(_0x3b45e9));promisesContact['push']({'contact':_0x3b45e9});}}}Promise[_0x7a05('0x1a')](_0x8ad482)['then'](function(){_0x31c140({'val':0x1});});})[_0x7a05('0x1b')](function(_0x37a562){logger['error'](_0x37a562['message']);});});}function insertAdditionalPhones(_0x4d8c17){return new Promise(function(_0x2acc80,_0x296177){var _0x443f33=_0x4d8c17[_0x7a05('0x19')];if(_['isNil'](_0x443f33))_0x296177({'val':0x0});else{var _0x1db649=_0x443f33[_0x7a05('0x1c')](';');var _0x3e9ef2=[];orderBy=0x0;for(var _0x593c1b=0x0;_0x593c1b<_0x1db649[_0x7a05('0x17')];_0x593c1b++){_0x3e9ef2[_0x7a05('0x1d')](splitAdditionalPhone(_0x4d8c17['id'],_0x1db649[_0x593c1b]));}Promise[_0x7a05('0x1a')](_0x3e9ef2)[_0x7a05('0x1e')](function(){_0x2acc80({'val':_0x1db649[_0x7a05('0x17')]});});}});}function splitAdditionalPhone(_0x472bdd,_0xb23a2a){return new Promise(function(_0x29c958,_0x133f49){var _0x219a94=_0xb23a2a[_0x7a05('0x1c')](':');var _0x4beb4a=_0x219a94[0x0];var _0x591ab5=_0x219a94[0x1];if(_0x591ab5!==''){var _0x5a2fc5=_0x591ab5[_0x7a05('0x1c')]('|');var _0x172d79=[];for(var _0x124697=0x0;_0x124697<_0x5a2fc5[_0x7a05('0x17')];_0x124697++){if(_0x5a2fc5[_0x124697]!==''){var _0x465dd6=_[_0x7a05('0x1f')](promisesAdditionalPhones,{'contactId':_0x472bdd,'phone':_0x5a2fc5[_0x124697]});if(_0x465dd6[_0x7a05('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x7a05('0x1d')]({'contactId':_0x472bdd,'contactTypeId':_0x4beb4a,'phone':_0x5a2fc5[_0x124697],'orderBy':orderBy});}}}_0x29c958({'ok':0x1});}else _0x29c958({'res':0x0});});}function createAdditionalPhone(_0xc45b3e,_0x4a5cf8,_0x49e37b,_0x20a4f2){var _0x57e4e2='';var _0x4f26bc='';var _0x2cd660=_0x49e37b[_0x7a05('0x1c')]('§');_0x57e4e2=_0x2cd660[0x0];if(_0x2cd660[_0x7a05('0x17')]==0x2)_0x4f26bc=_0x2cd660[0x1];return new Promise(function(_0x210c6f,_0x37a4f6){return db['CmContactHasItem'][_0x7a05('0x20')]({'where':{'CmContactId':_0xc45b3e,'item':_0x57e4e2}})[_0x7a05('0x1e')](function(_0x37dbf1){if(_0x37dbf1){return db['CmContactHasItem'][_0x7a05('0x21')]({'ItemTypeId':_0x4a5cf8,'description':_0x4f26bc,'OrderBy':_0x20a4f2},{'where':{'CmContactId':_0xc45b3e,'item':_0x57e4e2}})[_0x7a05('0x1e')](function(_0xae8ebe){_0x210c6f({'res':'updated'});});}else{return db[_0x7a05('0x22')][_0x7a05('0x23')]({'CmContactId':_0xc45b3e,'item':_0x57e4e2,'ItemTypeId':_0x4a5cf8,'description':_0x4f26bc,'OrderBy':_0x20a4f2,'ItemClass':_0x7a05('0x24')})[_0x7a05('0x1e')](function(_0x5a8587){_0x210c6f({'res':_0x7a05('0x25')});});}});});}function updateContact(_0x4dd3b1){return new Promise(function(_0x2580fe,_0x41ec2a){var _0x560575=_0x4dd3b1['id'];delete _0x4dd3b1['id'];return db[_0x7a05('0x26')][_0x7a05('0x21')](_0x4dd3b1,{'where':{'id':_0x560575}})[_0x7a05('0x1e')](function(_0x4e52bd){updatedRows+=0x1;return db[_0x7a05('0x27')][_0x7a05('0x21')]({'phone':_0x4dd3b1['phone']},{'where':{'ContactId':_0x560575}})[_0x7a05('0x1e')](function(_0x40ed80){_0x2580fe({'ret':'OK'});});});});}function insertCmHopper(_0x4f0fb6,_0x5ec5e1,_0x3de609,_0x423418,_0x547c40){var _0x1a62a6=[_0x7a05('0x28'),_0x7a05('0x29'),_0x7a05('0x2a'),'cm_contacts.ListId',_0x5ec5e1+'.'+_0x423418,_0x7a05('0x2b'),_0x7a05('0x2c'),_0x7a05('0x2d'),_0x7a05('0x2e'),'\x22'+_0x547c40+'\x22'];return squel['insert']()['into'](_0x7a05('0x2f'))['fromQuery']([_0x7a05('0xf'),'scheduledat','ContactId',_0x7a05('0x30'),_0x423418,_0x7a05('0x31'),_0x7a05('0x32'),_0x7a05('0x33'),_0x7a05('0x34'),_0x7a05('0x35')],squel[_0x7a05('0x36')]()[_0x7a05('0x37')](_0x1a62a6)[_0x7a05('0x10')](_0x5ec5e1)[_0x7a05('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x5ec5e1+_0x7a05('0x38'))[_0x7a05('0x14')](_0x3de609,null,_0x3de609+_0x7a05('0x39')+_0x5ec5e1+'.'+_0x423418)[_0x7a05('0x12')](_0x5ec5e1+'.CmListId\x20=\x20?',_0x4f0fb6)[_0x7a05('0x12')](_0x7a05('0x3a'),NOW)['where'](_0x7a05('0x3b'),selectNotIn(_0x5ec5e1,_0x3de609,_0x423418,_0x7a05('0x2f'),[_0x7a05('0x3c'),_0x7a05('0x3d')]))[_0x7a05('0x12')](_0x7a05('0x3b'),selectNotIn(_0x5ec5e1,_0x3de609,_0x423418,_0x7a05('0x2f'),[_0x7a05('0x3c')])))['toString']();}function insertCmHopperBlack(_0x411f47,_0x1ab496,_0x255d61,_0x487e85){var _0x12d5f0=[_0x7a05('0x28'),_0x7a05('0x2a'),_0x7a05('0x3e'),_0x1ab496+'.'+_0x487e85,'cm_contacts.createdAt',_0x7a05('0x2c')];return squel['insert']()['into'](_0x7a05('0x3f'))[_0x7a05('0x40')](['phone',_0x7a05('0x41'),_0x7a05('0x30'),_0x487e85,_0x7a05('0x31'),_0x7a05('0x32')],squel[_0x7a05('0x36')]()[_0x7a05('0x37')](_0x12d5f0)[_0x7a05('0x10')](_0x1ab496)[_0x7a05('0x14')](_0x7a05('0x42'),null,_0x7a05('0x43')+_0x1ab496+_0x7a05('0x38'))[_0x7a05('0x14')](_0x255d61,null,_0x255d61+_0x7a05('0x39')+_0x1ab496+'.'+_0x487e85)[_0x7a05('0x12')](_0x1ab496+_0x7a05('0x44'),_0x411f47)['where'](_0x7a05('0x3a'),NOW)[_0x7a05('0x12')](_0x7a05('0x3b'),squel[_0x7a05('0x36')]()['field'](_0x7a05('0xf'))[_0x7a05('0x10')](_0x7a05('0x3f'))[_0x7a05('0x12')]('ListId\x20=\x20?',_0x411f47)[_0x7a05('0x12')](_0x487e85+'\x20=\x20?',_0x1ab496+'.'+_0x487e85)))[_0x7a05('0x45')]();}function insertCmHopperAdditionalPhones(_0x3b871f){var _0x4876f0=[_0x7a05('0x46'),_0x7a05('0x47'),_0x7a05('0x48'),'cm_contact_has_items.createdAt',_0x7a05('0x49')];return squel[_0x7a05('0x4a')]()[_0x7a05('0x4b')](_0x7a05('0x4c'))['fromQuery']([_0x7a05('0x4d'),'phone',_0x7a05('0x4e'),_0x7a05('0x31'),_0x7a05('0x32')],squel[_0x7a05('0x36')]()[_0x7a05('0x37')](_0x4876f0)[_0x7a05('0x10')](_0x7a05('0x2f'))[_0x7a05('0x14')](_0x7a05('0x42'),null,_0x7a05('0x4f'))['join'](_0x7a05('0x50'),null,_0x7a05('0x51'))[_0x7a05('0x12')](_0x7a05('0x52'),_0x3b871f)[_0x7a05('0x12')](_0x7a05('0x3a'),NOW))[_0x7a05('0x45')]();}function insertCmContact(_0x54a5d8,_0x197b83,_0x27eff0,_0x254202){var _0x50d1c0=_['concat'](_[_0x7a05('0x53')](_0x254202),[_0x7a05('0x30'),'CompanyId',_0x7a05('0x31'),_0x7a05('0x32')]);return squel[_0x7a05('0x4a')]()[_0x7a05('0x4b')](_0x7a05('0x42'))[_0x7a05('0x40')](_0x50d1c0,squel[_0x7a05('0x36')]()['fields'](_0x50d1c0)[_0x7a05('0x10')](_0x197b83)[_0x7a05('0x12')]('('+_0x27eff0[_0x7a05('0x14')](',')+_0x7a05('0x54'),squel[_0x7a05('0x36')]()[_0x7a05('0x37')](_0x27eff0)[_0x7a05('0x10')](_0x7a05('0x42'))[_0x7a05('0x12')](_0x7a05('0x55'),_0x54a5d8))[_0x7a05('0x12')]('id\x20IN\x20?',squel[_0x7a05('0x36')]()[_0x7a05('0x56')](_0x7a05('0x57'),_0x7a05('0x58'))[_0x7a05('0x10')](_0x197b83)['group'](_0x27eff0['join'](','))))[_0x7a05('0x45')]();}function handleStop(){logger[_0x7a05('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4e98d7){logger[_0x7a05('0x5a')](_0x4e98d7[_0x7a05('0x5b')]);process['exit'](0x1);}function handleError(_0x14ffa8,_0x42183a){stats[_0x7a05('0x5c')][_0x7a05('0x1d')]({'name':_0x42183a[_0x7a05('0x5d')],'message':_0x42183a[_0x7a05('0x5b')],'row':_0x14ffa8});}function handleQuery(_0x8ebae){logger[_0x7a05('0x59')](_0x8ebae);return db['sequelize'][_0x7a05('0x16')](_0x8ebae)[_0x7a05('0x5e')](function(_0x9bf39a){results[_0x7a05('0x1d')](_0x9bf39a);})['catch'](function(_0xc3e758){logger[_0x7a05('0x5a')](_0xc3e758['message']);});}function main(_0x5e618f,_0x5703f3,_0x2247b1,_0x4e405d){logger['info'](_0x7a05('0x5f'),_0x5e618f,JSON['stringify'](_0x5703f3));process[_0x7a05('0x60')](_0x7a05('0x61'));var _0x3bbab7=_0x5703f3[_0x7a05('0x62')];var _0x6c4afd=_[_0x7a05('0x63')](_0x3bbab7);var _0x40e672=_0x5703f3[_0x7a05('0x64')];var _0xb46043=path[_0x7a05('0x14')](config[_0x7a05('0x65')],_0x7a05('0x66'),_0x40e672+'.csv');logger[_0x7a05('0x59')](_0x7a05('0x67'),_0x5703f3);db[_0x7a05('0x68')][_0x7a05('0x69')]({'raw':!![],'attributes':['id',_0x7a05('0x6a')]})[_0x7a05('0x1e')](function(_0x3984d2){for(var _0x87560d=0x0;_0x87560d<_0x3984d2[_0x7a05('0x17')];_0x87560d++){if(_0x3984d2[_0x87560d][_0x7a05('0x6a')]in _0x3bbab7){contactItemTypes[_0x7a05('0x1d')](_0x3984d2[_0x87560d]);delete _0x6c4afd[_0x3984d2[_0x87560d][_0x7a05('0x6a')]];hasAdditionalPhones=!![];}for(var _0x2758e6 in _0x3bbab7){if(_0x3984d2[_0x87560d][_0x7a05('0x6a')]+'_description'===_0x2758e6){phoneDescriptions['push']({'itemTypeId':_0x3984d2[_0x87560d]['id'],'description':_0x2758e6});delete _0x6c4afd[_0x2758e6];}}}if(hasAdditionalPhones)_0x6c4afd[_0x7a05('0x19')]='';var _0x414260=_[_0x7a05('0x53')](_0x6c4afd)['join']();logger['info'](_0x7a05('0x6b'),_0x414260);fs[_0x7a05('0x6c')](_0xb46043,_0x414260+'\x0a');Papa[_0x7a05('0x6d')](fs['createReadStream'](_0x5e618f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x147bb0,_0x4d7bd4){try{for(var _0x2e3031=0x0,_0x54a209=[];_0x2e3031<_0x147bb0['data'][_0x7a05('0x17')];_0x2e3031++){stats[_0x7a05('0x6e')]+=0x1;if(_0x147bb0[_0x7a05('0x5c')][_0x2e3031]){handleError(_0x147bb0['data'][_0x2e3031],_0x147bb0[_0x7a05('0x5c')][_0x2e3031]);}else{var _0x3b3b5d=[];var _0x530db9=[];var _0x3e9dff={};for(var _0x1788db in _0x3bbab7){let _0x37b696=contactItemTypes[_0x7a05('0x6f')](_0x418f4a=>_0x418f4a[_0x7a05('0x6a')]===_0x1788db);let _0xeedb6a=contactItemTypes[_0x7a05('0x6f')](_0x4503e0=>_0x4503e0[_0x7a05('0x6a')]+'_description'===_0x1788db);if(_[_0x7a05('0x18')](_0x37b696)&&_['isNil'](_0xeedb6a)){if(_0x3bbab7[_0x7a05('0x70')](_0x1788db)){if(_0x147bb0[_0x7a05('0x71')][_0x2e3031][_0x3bbab7[_0x1788db]]){var _0x45e46d=_[_0x7a05('0x72')](_0x147bb0[_0x7a05('0x71')][_0x2e3031][_0x3bbab7[_0x1788db]]['replace'](/"/g,'\x27'));switch(_0x1788db){case'scheduledat':var _0x544c5c=moment(_0x45e46d,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x544c5c[_0x7a05('0x73')]()){_0x54a209['push']('\x22'+_0x45e46d+'\x22');}else{_0x3b3b5d[_0x7a05('0x1d')](_0x7a05('0x74'));}break;case'priority':var _0x112095=parseInt(_0x45e46d);_0x45e46d=_['isNaN'](_0x112095)||_0x112095<0x0||_0x112095>0x4?_0x4e405d?0x3:0x2:_0x112095;_0x54a209[_0x7a05('0x1d')]('\x22'+_0x45e46d+'\x22');break;case _0x7a05('0x34'):var _0x108a30=parseInt(_0x45e46d);if(_['isNumber'](_0x108a30)&&_[_0x7a05('0x75')](_0x2247b1,_0x108a30)){_0x54a209['push']('\x22'+_0x108a30+'\x22');}else{_0x3b3b5d[_0x7a05('0x1d')](_0x7a05('0x76'));}break;case _0x7a05('0x77'):if(isEmail(_0x45e46d)){_0x54a209[_0x7a05('0x1d')]('\x22'+_0x45e46d+'\x22');}else{_0x3b3b5d[_0x7a05('0x1d')](_0x7a05('0x78'));}break;case'dateOfBirth':var _0x5ee102=moment(_0x45e46d,'YYYY-MM-DD',!![]);if(_0x5ee102[_0x7a05('0x73')]()){_0x54a209['push']('\x22'+_0x45e46d+'\x22');}else{_0x3b3b5d[_0x7a05('0x1d')](_0x7a05('0x79'));}break;default:_0x54a209['push']('\x22'+_0x45e46d+'\x22');}}else{switch(_0x1788db){case _0x7a05('0x7a'):case _0x7a05('0xf'):_0x3b3b5d[_0x7a05('0x1d')](_0x1788db+_0x7a05('0x7b'));break;default:_0x54a209[_0x7a05('0x1d')]('\x22\x22');}}}}else{var _0x2c40ee='';if(!_['isNil'](_0x37b696)){if(!_0x3e9dff[_0x7a05('0x70')](_0x37b696['id'])){for(var _0xfd9395=0x0;_0xfd9395<_0x3bbab7[_0x1788db]['length'];_0xfd9395++){var _0x45e46d=_[_0x7a05('0x72')](_0x147bb0[_0x7a05('0x71')][_0x2e3031][_0x3bbab7[_0x1788db][_0xfd9395]][_0x7a05('0x7c')](/"/g,'\x27'));var _0x2cefdf=phoneDescriptions[_0x7a05('0x6f')](_0xbcb153=>_0xbcb153['itemTypeId']===_0x37b696['id']);if(!_[_0x7a05('0x18')](_0x2cefdf)){var _0x1e3344=_[_0x7a05('0x72')](_0x147bb0[_0x7a05('0x71')][_0x2e3031][_0x3bbab7[_0x2cefdf[_0x7a05('0x7d')]][0x0]][_0x7a05('0x7c')](/"/g,'\x27'));if(!_[_0x7a05('0x18')](_0x1e3344))_0x45e46d=_0x45e46d+'§'+_0x1e3344;}if(_0x2c40ee=='')_0x2c40ee=_0x45e46d;else _0x2c40ee+='|'+_0x45e46d;}_0x530db9[_0x7a05('0x1d')](_0x37b696['id']+':'+_0x2c40ee);_0x3e9dff[_0x37b696['id']]=0x1;}}}}if(hasAdditionalPhones){_0x54a209[_0x7a05('0x1d')]('\x22'+_0x530db9['join'](';')+'\x22');}if(_0x3b3b5d[_0x7a05('0x17')]){handleError(_0x147bb0[_0x7a05('0x71')][_0x2e3031],{'code':_0x7a05('0x7e'),'message':_0x3b3b5d[_0x7a05('0x14')]()});}else{fs[_0x7a05('0x7f')](_0xb46043,_0x54a209[_0x7a05('0x14')]()+'\x0a');}_0x54a209=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x40e672,stats);stats['errors']=[];}}if(stopped){logger[_0x7a05('0x59')](_0x7a05('0x80'));_0x4d7bd4[_0x7a05('0x81')]();}}catch(_0x2a0f66){handleError(_0x147bb0['data'][_0x2e3031],{'code':_0x7a05('0x82'),'message':_0x2a0f66[_0x7a05('0x5b')]});logger[_0x7a05('0x5a')](_0x7a05('0x83'),_0x2a0f66['message']);}},'complete':function(){try{var _0x572c6b=[];var _0x1ffe0c=tempTableName;_0x572c6b[_0x7a05('0x1d')](_0x7a05('0x84')+_0x1ffe0c+_0x7a05('0x85'));logger[_0x7a05('0x59')]('CIS\x20len',contactItemTypes[_0x7a05('0x17')]);var _0x51a993=util['format'](_0x7a05('0x86'),_0xb46043,_0x1ffe0c,_0x414260,_0x5703f3[_0x7a05('0x30')],_0x5703f3[_0x7a05('0x87')]||null,NOW,NOW);if(_['isNil'](_0x3bbab7[_0x7a05('0x88')])){_0x51a993+=',\x20scheduledAt\x20=\x20NOW()';}_0x572c6b[_0x7a05('0x1d')](_0x51a993);BPromise[_0x7a05('0x89')](_0x572c6b,handleQuery)[_0x7a05('0x1e')](function(_0x1e6e83){BPromise[_0x7a05('0x1a')]([handleAdditionalPhones()])[_0x7a05('0x1e')](function(){_0x572c6b=[];for(var _0x4df7a5=0x0;_0x4df7a5_0x2c7493[_0xcbc2('0x6e')]===_0x1fce8);let _0x4e2e6d=contactItemTypes[_0xcbc2('0x75')](_0x23581=>_0x23581[_0xcbc2('0x6e')]+'_description'===_0x1fce8);if(_[_0xcbc2('0x1f')](_0x50ee03)&&_['isNil'](_0x4e2e6d)){if(_0x37ac62['hasOwnProperty'](_0x1fce8)){if(_0x5e9378[_0xcbc2('0x72')][_0x2ebfb8][_0x37ac62[_0x1fce8]]){var _0x9e118a=_[_0xcbc2('0x76')](_0x5e9378[_0xcbc2('0x72')][_0x2ebfb8][_0x37ac62[_0x1fce8]]['replace'](/"/g,'\x27'));switch(_0x1fce8){case _0xcbc2('0x3a'):var _0x26b2fe=moment(_0x9e118a,_0xcbc2('0xd'),!![]);if(_0x26b2fe['isValid']()){_0x2d1664['push']('\x22'+_0x9e118a+'\x22');}else{_0x45b9e1[_0xcbc2('0x28')](_0xcbc2('0x77'));}break;case _0xcbc2('0x3c'):var _0x2dd379=parseInt(_0x9e118a);_0x9e118a=_[_0xcbc2('0x78')](_0x2dd379)||_0x2dd379<0x0||_0x2dd379>0x4?_0x19cb8a?0x3:0x2:_0x2dd379;_0x2d1664[_0xcbc2('0x28')]('\x22'+_0x9e118a+'\x22');break;case _0xcbc2('0x3d'):var _0x39adc8=parseInt(_0x9e118a);if(_[_0xcbc2('0x79')](_0x39adc8)&&_[_0xcbc2('0x7a')](_0x27ff9c,_0x39adc8)){_0x2d1664[_0xcbc2('0x28')]('\x22'+_0x39adc8+'\x22');}else{_0x45b9e1['push']('agent\x20not\x20exists');}break;case _0xcbc2('0x7b'):if(isEmail(_0x9e118a)){_0x2d1664[_0xcbc2('0x28')]('\x22'+_0x9e118a+'\x22');}else{_0x45b9e1[_0xcbc2('0x28')](_0xcbc2('0x7c'));}break;case'dateOfBirth':var _0x345976=moment(_0x9e118a,_0xcbc2('0x7d'),!![]);if(_0x345976[_0xcbc2('0x7e')]()){_0x2d1664['push']('\x22'+_0x9e118a+'\x22');}else{_0x45b9e1[_0xcbc2('0x28')](_0xcbc2('0x7f'));}break;default:_0x2d1664[_0xcbc2('0x28')]('\x22'+_0x9e118a+'\x22');}}else{switch(_0x1fce8){case _0xcbc2('0x80'):case _0xcbc2('0x14'):_0x45b9e1[_0xcbc2('0x28')](_0x1fce8+_0xcbc2('0x81'));break;default:_0x2d1664[_0xcbc2('0x28')]('\x22\x22');}}}}else{var _0x240a38='';if(!_[_0xcbc2('0x1f')](_0x50ee03)){if(!_0x4ab3f4[_0xcbc2('0x82')](_0x50ee03['id'])){for(var _0x368075=0x0;_0x368075<_0x37ac62[_0x1fce8][_0xcbc2('0x27')];_0x368075++){var _0x9e118a=_[_0xcbc2('0x76')](_0x5e9378[_0xcbc2('0x72')][_0x2ebfb8][_0x37ac62[_0x1fce8][_0x368075]][_0xcbc2('0x83')](/"/g,'\x27'));var _0x137cb8=phoneDescriptions[_0xcbc2('0x75')](_0x3df0be=>_0x3df0be[_0xcbc2('0x84')]===_0x50ee03['id']);if(!_[_0xcbc2('0x1f')](_0x137cb8)){var _0x9895e4=_['trim'](_0x5e9378[_0xcbc2('0x72')][_0x2ebfb8][_0x37ac62[_0x137cb8[_0xcbc2('0x85')]][0x0]][_0xcbc2('0x83')](/"/g,'\x27'));if(!_[_0xcbc2('0x1f')](_0x9895e4))_0x9e118a=_0x9e118a+'§'+_0x9895e4;}if(_0x240a38=='')_0x240a38=_0x9e118a;else _0x240a38+='|'+_0x9e118a;}_0x244f07[_0xcbc2('0x28')](_0x50ee03['id']+':'+_0x240a38);_0x4ab3f4[_0x50ee03['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2d1664[_0xcbc2('0x28')]('\x22'+_0x244f07[_0xcbc2('0x16')](';')+'\x22');}if(_0x45b9e1[_0xcbc2('0x27')]){handleError(_0x5e9378['data'][_0x2ebfb8],{'code':_0xcbc2('0x86'),'message':_0x45b9e1[_0xcbc2('0x16')]()});}else{fs[_0xcbc2('0x87')](_0x301986,_0x2d1664[_0xcbc2('0x16')]()+'\x0a');}_0x2d1664=[];}if(!(stats['rows']%0xc8)){socket[_0xcbc2('0x88')](_0xcbc2('0x89')+_0x346a63,stats);stats[_0xcbc2('0x74')]=[];}}if(stopped){logger[_0xcbc2('0x5e')](_0xcbc2('0x8a'));_0x374ed1[_0xcbc2('0x8b')]();}}catch(_0x492da5){handleError(_0x5e9378['data'][_0x2ebfb8],{'code':_0xcbc2('0x8c'),'message':_0x492da5[_0xcbc2('0x25')]});logger[_0xcbc2('0x24')](_0xcbc2('0x8d'),_0x492da5[_0xcbc2('0x25')]);}},'complete':function(){try{var _0x2347d9=[];var _0x564c7c=tempTableName;_0x2347d9[_0xcbc2('0x28')](_0xcbc2('0x8e')+_0x564c7c+'\x20LIKE\x20cm_contacts;');logger['info'](_0xcbc2('0x8f'),contactItemTypes['length']);var _0x5e20da=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x301986,_0x564c7c,_0x392e2e,_0x1a1e30[_0xcbc2('0x59')],_0x1a1e30[_0xcbc2('0x5a')]||null,NOW,NOW);if(_[_0xcbc2('0x1f')](_0x37ac62[_0xcbc2('0x3a')])){_0x5e20da+=_0xcbc2('0x90');}_0x2347d9['push'](_0x5e20da);BPromise[_0xcbc2('0x91')](_0x2347d9,handleQuery)['then'](function(_0x47a7a8){BPromise[_0xcbc2('0x21')]([handleAdditionalPhones()])[_0xcbc2('0x22')](function(){_0x2347d9=[];for(var _0x253720=0x0;_0x253720\x20\x20');}var _0x1e92a5=path[_0xcbc2('0x16')](config['root'],_0xcbc2('0x69'),process[_0xcbc2('0x98')][0x2]);if(!fs[_0xcbc2('0x99')](_0x1e92a5)){throw new Error(_0xcbc2('0x9a'));}var _0x2aba43={};try{_0x2aba43=JSON[_0xcbc2('0x9b')](process['argv'][0x3]);if(!_0x2aba43['binding']){throw new Error(_0xcbc2('0x9c'));}var _0x448299=0x0;if(_0x2aba43[_0xcbc2('0x65')][_0xcbc2('0x3d')]){_0x448299=0x1;}if(!_0x2aba43[_0xcbc2('0x59')]){throw new Error(_0xcbc2('0x9d'));}}catch(_0x1681be){throw new Error(_0xcbc2('0x9e'));}var _0x318f89=[];try{_0x318f89=_[_0xcbc2('0x9f')](JSON[_0xcbc2('0x9b')](process[_0xcbc2('0x98')][0x4]),'id');}catch(_0x4df207){logger[_0xcbc2('0x5e')](_0xcbc2('0xa0'));}main(_0x1e92a5,_0x2aba43,_0x318f89,_0x448299);}validate();process['on'](_0xcbc2('0xa1'),handleStop);process['on'](_0xcbc2('0xa2'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index b9317a6..6265896 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc06=['Duration','duration','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','Talk\x20Time','outbound','Called\x20Number','membername','starttime','Answer\x20Time','answertime'];(function(_0xea10ae,_0x7259f6){var _0x10061d=function(_0x1ed125){while(--_0x1ed125){_0xea10ae['push'](_0xea10ae['shift']());}};_0x10061d(++_0x7259f6);}(_0xbc06,0x1bf));var _0x6bc0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbc06[_0x321bb2];return _0x9c12ed;};'use strict';exports['getSubjects']=function(_0x1c0149,_0x2a1a93){var _0x3bc1c6=[{'type':_0x6bc0('0x0'),'content':_0x6bc0('0x1'),'variableName':null}];switch(_0x1c0149[_0x6bc0('0x2')]()){case _0x6bc0('0x3'):switch(_0x2a1a93[_0x6bc0('0x2')]()){case _0x6bc0('0x4'):_0x3bc1c6[_0x6bc0('0x5')]({'type':'variable','content':'','variableName':_0x6bc0('0x6')});_0x3bc1c6['push']({'type':_0x6bc0('0x7'),'content':'','variableName':_0x6bc0('0x8')});break;case'outbound':_0x3bc1c6[_0x6bc0('0x5')]({'type':_0x6bc0('0x0'),'content':_0x6bc0('0x9'),'variableName':null});_0x3bc1c6[_0x6bc0('0x5')]({'type':_0x6bc0('0x7'),'content':'','variableName':_0x6bc0('0xa')});break;}}return _0x3bc1c6;};exports[_0x6bc0('0xb')]=function(_0x8fb06b,_0x5e4d5a){var _0x52dd26=[];switch(_0x8fb06b['toLowerCase']()){case _0x6bc0('0x3'):switch(_0x5e4d5a[_0x6bc0('0x2')]()){case _0x6bc0('0x4'):_0x52dd26=[{'type':_0x6bc0('0x0'),'content':_0x6bc0('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x6bc0('0xd'),'content':'','key':'Caller\x20Number','keyType':_0x6bc0('0x7'),'variableName':_0x6bc0('0x8')},{'type':_0x6bc0('0xd'),'content':'','key':_0x6bc0('0xe'),'keyType':'variable','variableName':'calleridname'},{'type':'keyValue','content':'','key':'Call\x20To','keyType':'variable','variableName':_0x6bc0('0xf')},{'type':_0x6bc0('0xd'),'content':'','key':_0x6bc0('0x10'),'keyType':_0x6bc0('0x7'),'variableName':'queue'},{'type':_0x6bc0('0xd'),'content':'','key':_0x6bc0('0x11'),'keyType':_0x6bc0('0x7'),'variableName':_0x6bc0('0x12')},{'type':_0x6bc0('0xd'),'content':'','key':_0x6bc0('0x13'),'keyType':'variable','variableName':_0x6bc0('0x14')},{'type':_0x6bc0('0x0'),'content':_0x6bc0('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x6bc0('0xd'),'content':'','key':_0x6bc0('0x16'),'keyType':_0x6bc0('0x7'),'variableName':_0x6bc0('0x17')},{'type':_0x6bc0('0xd'),'content':'','key':_0x6bc0('0x18'),'keyType':_0x6bc0('0x7'),'variableName':'destcalleridnum'},{'type':'string','content':_0x6bc0('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x6bc0('0xd'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0x6bc0('0x14')},{'type':'keyValue','content':'','key':_0x6bc0('0x1a'),'keyType':_0x6bc0('0x7'),'variableName':'agentconnectAt'},{'type':_0x6bc0('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0x6bc0('0x7'),'variableName':'agentcompleteAt'},{'type':_0x6bc0('0xd'),'content':'','key':'Hold\x20Time','keyType':'variable','variableName':'holdtime'},{'type':'keyValue','content':'','key':_0x6bc0('0x1b'),'keyType':'variable','variableName':'talktime'}];break;case _0x6bc0('0x1c'):_0x52dd26=[{'type':_0x6bc0('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x6bc0('0xd'),'content':'','key':_0x6bc0('0x1d'),'keyType':_0x6bc0('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x6bc0('0xd'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0x6bc0('0x1e')},{'type':_0x6bc0('0xd'),'content':'','key':_0x6bc0('0x11'),'keyType':_0x6bc0('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':_0x6bc0('0xd'),'content':'','key':'Date','keyType':_0x6bc0('0x7'),'keyContent':'','variableName':_0x6bc0('0x1f')},{'type':_0x6bc0('0x0'),'content':_0x6bc0('0x19')},{'type':_0x6bc0('0xd'),'content':'','key':_0x6bc0('0x20'),'keyType':_0x6bc0('0x7'),'keyContent':'','variableName':_0x6bc0('0x21')},{'type':_0x6bc0('0xd'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':_0x6bc0('0x22'),'keyType':_0x6bc0('0x7'),'keyContent':'','variableName':_0x6bc0('0x23')},{'type':_0x6bc0('0xd'),'content':'','key':'Billable\x20Time','keyType':_0x6bc0('0x7'),'keyContent':'','variableName':_0x6bc0('0x24')}];break;}}return _0x52dd26;}; \ No newline at end of file +var _0xb58d=['destexten','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','Member\x20Name','membername','Answer\x20Time','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','push','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','Call\x20To'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xb58d,0x75));var _0xdb58=function(_0x7a213e,_0x50d8ff){_0x7a213e=_0x7a213e-0x0;var _0x3278f2=_0xb58d[_0x7a213e];return _0x3278f2;};'use strict';exports[_0xdb58('0x0')]=function(_0x145fff,_0xd6f4ed){var _0x584414=[{'type':_0xdb58('0x1'),'content':_0xdb58('0x2'),'variableName':null}];switch(_0x145fff[_0xdb58('0x3')]()){case _0xdb58('0x4'):switch(_0xd6f4ed['toLowerCase']()){case _0xdb58('0x5'):_0x584414['push']({'type':_0xdb58('0x6'),'content':'','variableName':_0xdb58('0x7')});_0x584414[_0xdb58('0x8')]({'type':_0xdb58('0x6'),'content':'','variableName':_0xdb58('0x9')});break;case'outbound':_0x584414[_0xdb58('0x8')]({'type':'string','content':_0xdb58('0xa'),'variableName':null});_0x584414[_0xdb58('0x8')]({'type':_0xdb58('0x6'),'content':'','variableName':_0xdb58('0xb')});break;}}return _0x584414;};exports[_0xdb58('0xc')]=function(_0x71598a,_0x1d5015){var _0x181ecb=[];switch(_0x71598a[_0xdb58('0x3')]()){case _0xdb58('0x4'):switch(_0x1d5015['toLowerCase']()){case _0xdb58('0x5'):_0x181ecb=[{'type':_0xdb58('0x1'),'content':_0xdb58('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xdb58('0xe'),'content':'','key':'Caller\x20Number','keyType':_0xdb58('0x6'),'variableName':_0xdb58('0x9')},{'type':'keyValue','content':'','key':_0xdb58('0xf'),'keyType':'variable','variableName':_0xdb58('0x10')},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x11'),'keyType':'variable','variableName':_0xdb58('0x12')},{'type':_0xdb58('0xe'),'content':'','key':'Queue','keyType':_0xdb58('0x6'),'variableName':_0xdb58('0x7')},{'type':'keyValue','content':'','key':_0xdb58('0x13'),'keyType':'variable','variableName':_0xdb58('0x14')},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x15'),'keyType':_0xdb58('0x6'),'variableName':_0xdb58('0x16')},{'type':'string','content':_0xdb58('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x18'),'keyType':'variable','variableName':_0xdb58('0x19')},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x1a'),'keyType':_0xdb58('0x6'),'variableName':_0xdb58('0xb')},{'type':_0xdb58('0x1'),'content':_0xdb58('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x1c'),'keyType':_0xdb58('0x6'),'variableName':_0xdb58('0x16')},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x1d'),'keyType':_0xdb58('0x6'),'variableName':_0xdb58('0x1e')},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x1f'),'keyType':'variable','variableName':_0xdb58('0x20')},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x21'),'keyType':_0xdb58('0x6'),'variableName':_0xdb58('0x22')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0xdb58('0x6'),'variableName':_0xdb58('0x23')}];break;case'outbound':_0x181ecb=[{'type':'string','content':_0xdb58('0xd'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0xdb58('0x6'),'keyContent':'','variableName':_0xdb58('0xb')},{'type':'keyValue','content':'','key':_0xdb58('0x24'),'keyType':_0xdb58('0x6'),'keyContent':'','variableName':_0xdb58('0x25')},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x13'),'keyType':_0xdb58('0x6'),'keyContent':'','variableName':_0xdb58('0x14')},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x15'),'keyType':_0xdb58('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0xdb58('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x26'),'keyType':_0xdb58('0x6'),'keyContent':'','variableName':_0xdb58('0x27')},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x28'),'keyType':_0xdb58('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x29'),'keyType':_0xdb58('0x6'),'keyContent':'','variableName':_0xdb58('0x2a')},{'type':_0xdb58('0xe'),'content':'','key':_0xdb58('0x2b'),'keyType':'variable','keyContent':'','variableName':_0xdb58('0x2c')}];break;}}return _0x181ecb;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 233dd63..1f9e7b6 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fe6=['search','parseAdvancedSearchFilter','parseQueryParameters','then','body','where','default','fields','user','having','read','tags','checkAccountsRestrictions','group','i.id','ids','count','length','order','forEach','contactName','DESC','getClosedOrderClause','getFilteredInteractions','rows','catch','query','clone','html','phone','fax','mobile','findAll','skipInteractionsQuery','getInteractionsQuery'];(function(_0x4015ca,_0x59e168){var _0xa1a1a7=function(_0x13798a){while(--_0x13798a){_0x4015ca['push'](_0x4015ca['shift']());}};_0xa1a1a7(++_0x59e168);}(_0x4fe6,0x138));var _0x64fe=function(_0x24c3cd,_0x1ecef2){_0x24c3cd=_0x24c3cd-0x0;var _0xdd4380=_0x4fe6[_0x24c3cd];return _0xdd4380;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var utils=require('./utils');exports[_0x64fe('0x0')]=function(_0x40a16a,_0x169179,_0x1e5542,_0x1f2bd4,_0x5bb101){var _0x569acd={'count':0x0,'rows':[]};var _0xf532e6=sqlUtils[_0x64fe('0x1')](_0x40a16a,_0x1e5542,_0x169179);if(_0xf532e6){return Promise['resolve'](_0x569acd);}var _0x4eece2=sqlUtils[_0x64fe('0x2')](_0x40a16a);var _0x267ce4={};return Promise['resolve']()['then'](function(){if(_0x169179[_0x64fe('0x3')]){return sqlUtils[_0x64fe('0x4')](_0x169179['search'],_0x5bb101);}else{return sqlUtils[_0x64fe('0x5')](_0x40a16a,_0x169179,_0x5bb101);}})[_0x64fe('0x6')](function(_0x4abf94){_0x4eece2['where'](_0x4abf94[_0x64fe('0x7')]);_0x4eece2[_0x64fe('0x8')](_0x4abf94['contact']);_0x4eece2[_0x64fe('0x8')](_0x4abf94[_0x64fe('0x9')]);_0x4eece2[_0x64fe('0x8')](_0x4abf94[_0x64fe('0xa')]);_0x4eece2[_0x64fe('0x8')](_0x4abf94['filter']);_0x4eece2['where'](_0x4abf94[_0x64fe('0xb')]);_0x4eece2[_0x64fe('0xc')](_0x4abf94[_0x64fe('0xd')]);_0x267ce4=_0x4abf94[_0x64fe('0xe')];return sqlUtils[_0x64fe('0xf')](_0x40a16a,_0x1e5542,_0x169179);})[_0x64fe('0x6')](function(_0x3d52bb){_0x4eece2[_0x64fe('0x8')](_0x3d52bb);_0x4eece2[_0x64fe('0x10')](_0x64fe('0x11'));var _0x4bc8ed=_0x169179[_0x64fe('0x3')]?_0x267ce4[_0x64fe('0x12')]:_0x169179['tag'];return sqlUtils['countFilteredInteractions'](_0x4eece2,_0x4bc8ed);})[_0x64fe('0x6')](function(_0x5d9ba){_0x569acd[_0x64fe('0x13')]=_0x5d9ba[_0x64fe('0x14')];if(_0x569acd[_0x64fe('0x13')]===0x0){return[];}_0x4eece2[_0x64fe('0xc')](_0x267ce4['clause']);if(_0x1f2bd4[_0x64fe('0x15')]){_0x1f2bd4[_0x64fe('0x15')][_0x64fe('0x16')](function(_0x471227){var _0x51fe22=_0x471227[0x0]===_0x64fe('0x17')?_0x471227[0x0]:'i.'+_0x471227[0x0];_0x4eece2[_0x64fe('0x15')](_0x51fe22,_0x471227[0x1]===_0x64fe('0x18')?![]:!![]);if(_0x471227[0x0]==='closed'){var _0x31ed3d=sqlUtils[_0x64fe('0x19')](_0x40a16a,_0x169179);_0x4eece2['order'](_0x31ed3d,_0x471227[0x1]===_0x64fe('0x18')?![]:!![]);}});}return sqlUtils[_0x64fe('0x1a')](_0x40a16a,_0x4eece2,_0x169179,_0x1f2bd4);})['then'](function(_0x1486cf){_0x569acd[_0x64fe('0x1b')]=_0x1486cf;return _0x569acd;})[_0x64fe('0x1c')](function(_0x40d4da){throw _0x40d4da;});};exports['tracked']=function(_0x5a4f9e,_0x3b4baa){return function(_0x4fdbbc,_0x434e94,_0x3b93c2){var _0x165b88=_0x4fdbbc[_0x64fe('0xb')];var _0x50a731={};var _0x44dd29=_0x4fdbbc[_0x64fe('0x1d')];if(_0x50a731){_0x50a731=_[_0x64fe('0x1e')](_0x4fdbbc[_0x64fe('0x7')]);_0x50a731=_['omit'](_0x50a731,['body',_0x64fe('0x1f'),_0x64fe('0x20'),_0x64fe('0x21'),_0x64fe('0x22')]);}utils['updateUser'](_0x165b88,_0x50a731,_0x44dd29,_0x5a4f9e,_0x3b4baa);_0x3b93c2(null);};}; \ No newline at end of file +var _0x87b9=['catch','clone','omit','html','fax','mobile','updateUser','lodash','./sql-utils','findAll','getInteractionsQuery','resolve','then','search','parseQueryParameters','where','body','contact','fields','filter','user','checkAccountsRestrictions','group','i.id','tag','count','length','clause','order','forEach','DESC','closed','getClosedOrderClause','getFilteredInteractions'];(function(_0x43321a,_0x50f30a){var _0x97c0e9=function(_0x5462d6){while(--_0x5462d6){_0x43321a['push'](_0x43321a['shift']());}};_0x97c0e9(++_0x50f30a);}(_0x87b9,0x17d));var _0x987b=function(_0x346378,_0xfe4e76){_0x346378=_0x346378-0x0;var _0x1d1b67=_0x87b9[_0x346378];return _0x1d1b67;};'use strict';var _=require(_0x987b('0x0'));var sqlUtils=require(_0x987b('0x1'));var utils=require('./utils');exports[_0x987b('0x2')]=function(_0x46eaeb,_0x1ea96a,_0x4513a9,_0x45ff8c,_0x399cfe){var _0xebe951={'count':0x0,'rows':[]};var _0x455563=sqlUtils['skipInteractionsQuery'](_0x46eaeb,_0x4513a9,_0x1ea96a);if(_0x455563){return Promise['resolve'](_0xebe951);}var _0x13651c=sqlUtils[_0x987b('0x3')](_0x46eaeb);var _0x20a663={};return Promise[_0x987b('0x4')]()[_0x987b('0x5')](function(){if(_0x1ea96a[_0x987b('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1ea96a[_0x987b('0x6')],_0x399cfe);}else{return sqlUtils[_0x987b('0x7')](_0x46eaeb,_0x1ea96a,_0x399cfe);}})['then'](function(_0x358c48){_0x13651c[_0x987b('0x8')](_0x358c48[_0x987b('0x9')]);_0x13651c[_0x987b('0x8')](_0x358c48[_0x987b('0xa')]);_0x13651c['where'](_0x358c48['default']);_0x13651c[_0x987b('0x8')](_0x358c48[_0x987b('0xb')]);_0x13651c[_0x987b('0x8')](_0x358c48[_0x987b('0xc')]);_0x13651c[_0x987b('0x8')](_0x358c48[_0x987b('0xd')]);_0x13651c['having'](_0x358c48['read']);_0x20a663=_0x358c48['tags'];return sqlUtils[_0x987b('0xe')](_0x46eaeb,_0x4513a9,_0x1ea96a);})[_0x987b('0x5')](function(_0x1d17c6){_0x13651c['where'](_0x1d17c6);_0x13651c[_0x987b('0xf')](_0x987b('0x10'));var _0x2b913b=_0x1ea96a[_0x987b('0x6')]?_0x20a663['ids']:_0x1ea96a[_0x987b('0x11')];return sqlUtils['countFilteredInteractions'](_0x13651c,_0x2b913b);})[_0x987b('0x5')](function(_0x2ed2a1){_0xebe951[_0x987b('0x12')]=_0x2ed2a1[_0x987b('0x13')];if(_0xebe951[_0x987b('0x12')]===0x0){return[];}_0x13651c['having'](_0x20a663[_0x987b('0x14')]);if(_0x45ff8c[_0x987b('0x15')]){_0x45ff8c[_0x987b('0x15')][_0x987b('0x16')](function(_0x3cb371){var _0xe6f724=_0x3cb371[0x0]==='contactName'?_0x3cb371[0x0]:'i.'+_0x3cb371[0x0];_0x13651c[_0x987b('0x15')](_0xe6f724,_0x3cb371[0x1]===_0x987b('0x17')?![]:!![]);if(_0x3cb371[0x0]===_0x987b('0x18')){var _0x33927d=sqlUtils[_0x987b('0x19')](_0x46eaeb,_0x1ea96a);_0x13651c['order'](_0x33927d,_0x3cb371[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0x987b('0x1a')](_0x46eaeb,_0x13651c,_0x1ea96a,_0x45ff8c);})[_0x987b('0x5')](function(_0x4bc659){_0xebe951['rows']=_0x4bc659;return _0xebe951;})[_0x987b('0x1b')](function(_0x5bd172){throw _0x5bd172;});};exports['tracked']=function(_0x13cd97,_0x2c0c27){return function(_0x46133d,_0x1e44e3,_0x1b1a9e){var _0x16e501=_0x46133d['user'];var _0x3e05ec={};var _0x3bca81=_0x46133d['query'];if(_0x3e05ec){_0x3e05ec=_[_0x987b('0x1c')](_0x46133d[_0x987b('0x9')]);_0x3e05ec=_[_0x987b('0x1d')](_0x3e05ec,[_0x987b('0x9'),_0x987b('0x1e'),'phone',_0x987b('0x1f'),_0x987b('0x20')]);}utils[_0x987b('0x21')](_0x16e501,_0x3e05ec,_0x3bca81,_0x13cd97,_0x2c0c27);_0x1b1a9e(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 0a47b9d..73f36e2 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafcf=['createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','filter','get','chat','Websites','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','query','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.secondDisposition','i.to','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','sequelize','toString','groupBy','findOne','all','clone','COUNT(*)','getSelectedTags','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','getAccountFK','role','search','field','color','tools_tags','getInteractionFK','_interactions','select','u.id','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','forEach','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','whatsapp','i.fax\x20LIKE\x20?','openchannel','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.email\x20LIKE\x20?','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','name','buildExpression','type','default','text','value','start','end','read','and','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','tags','ids','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','user','body','plainBody','keys','some','compact','concat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafcf,0x18a));var _0xfafc=function(_0x2110bb,_0x5bf49e){_0x2110bb=_0x2110bb-0x0;var _0x5cf87c=_0xafcf[_0x2110bb];return _0x5cf87c;};'use strict';var _=require(_0xfafc('0x0'));var squel=require(_0xfafc('0x1'));var as=require(_0xfafc('0x2'));var qs=require(_0xfafc('0x3'));var updateInteraction=require(_0xfafc('0x4'))['updateInteraction'];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x12d6f6,_0x3f0132,_0x88b0a7){var _0x3c341a=![];var _0x5d5683=utils[_0xfafc('0x5')](_0x12d6f6);if(_0x3f0132[_0xfafc('0x6')]==='agent'&&!_0x88b0a7[_0xfafc('0x7')]&&!_0x88b0a7[_0x5d5683]){_0x3c341a=!![];}return _0x3c341a;}function getTagsQuery(){return squel['select']()[_0xfafc('0x8')]('id')[_0xfafc('0x8')]('name')[_0xfafc('0x8')](_0xfafc('0x9'))['from'](_0xfafc('0xa'));}function getUsersQuery(_0xce2eec,_0x227e3e){var _0x5474d9=utils[_0xfafc('0xb')](_0xce2eec);var _0x5238c5='user_has_'+_0xce2eec+_0xfafc('0xc');var _0x1baf4d=squel[_0xfafc('0xd')]()[_0xfafc('0x8')](_0xfafc('0xe'))[_0xfafc('0x8')](_0xfafc('0xf'))['field'](_0xfafc('0x10')+_0x5474d9)[_0xfafc('0x11')](_0x5238c5,'ui')[_0xfafc('0x12')](_0xfafc('0x13'),'u',_0xfafc('0x14'));if(_0x227e3e[_0xfafc('0x15')]>0x0){_0x1baf4d[_0xfafc('0x16')](_0xfafc('0x10')+_0x5474d9+_0xfafc('0x17'),_[_0xfafc('0x18')](_0x227e3e,'id'));}return _0x1baf4d;}function getInteractionsQuery(_0xef4374){var _0x5eedc7=utils[_0xfafc('0x19')](_0xef4374);var _0xffcfac=utils[_0xfafc('0x5')](_0xef4374);var _0x17dae6=utils[_0xfafc('0xb')](_0xef4374);return squel[_0xfafc('0xd')]()[_0xfafc('0x11')](_0x5eedc7[_0xfafc('0x1a')],'i')[_0xfafc('0x12')](_0xfafc('0x1b'),'c',_0xfafc('0x1c'))[_0xfafc('0x12')]('users','o','o.id\x20=\x20i.UserId')[_0xfafc('0x12')](_0x5eedc7[_0xfafc('0x1d')],'a','a.id\x20=\x20i.'+_0xffcfac)['left_join'](_0x5eedc7[_0xfafc('0x1e')],'me',_0xfafc('0x1f')+_0x17dae6+_0xfafc('0x20'))['left_join'](_0x5eedc7[_0xfafc('0x21')],'it',_0xfafc('0x22')+_0x17dae6+_0xfafc('0x20'))[_0xfafc('0x12')](_0xfafc('0xa'),'t',_0xfafc('0x23'));}function getSqlClauses(){var _0x48273e={'body':squel[_0xfafc('0x24')](),'contact':squel[_0xfafc('0x24')](),'default':squel['expr'](),'fields':squel[_0xfafc('0x24')](),'filter':squel[_0xfafc('0x24')](),'read':squel[_0xfafc('0x24')](),'tags':{'clause':squel[_0xfafc('0x24')](),'ids':null},'user':squel[_0xfafc('0x24')]()};return _0x48273e;}function parseTagParameter(_0x3cd71b){var _0x20047a=squel[_0xfafc('0x24')]();if(_0x3cd71b){var _0x2b28d8=utils['getSelectedTags'](_0x3cd71b);_0x2b28d8[_0xfafc('0x25')](function(_0x2a91c0){_0x20047a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a91c0+',%');});}return _0x20047a;}function parseReadParameter(_0x14b947){var _0x338fab='';if(_0x14b947){_0x338fab='unreadMessages\x20{OPERATOR}\x200';if(_0x14b947==='1'){_0x338fab=_0x338fab[_0xfafc('0x26')](_0xfafc('0x27'),'=');}else{_0x338fab=_0x338fab[_0xfafc('0x26')]('{OPERATOR}','>');}}return _0x338fab;}function parseSearchFilter(_0x40e9d5,_0x3fc822){var _0x402f98=squel[_0xfafc('0x24')]();if(_0x3fc822){var _0x15ade5=_0x3fc822[_0xfafc('0x26')]('\x5c','\x5c\x5c')[_0xfafc('0x26')](/'/g,'\x27\x27');if(qs[_0xfafc('0x28')](_0x15ade5)){_0x402f98['or'](_0xfafc('0x29'),_0x15ade5+'%');switch(_0x40e9d5){case'sms':case _0xfafc('0x2a'):_0x402f98['or']('i.phone\x20LIKE\x20?',_0x15ade5+'%');break;case'fax':_0x402f98['or'](_0xfafc('0x2b'),_0x15ade5+'%');break;case _0xfafc('0x2c'):_0x402f98['or']('i.from\x20LIKE\x20?',_0x15ade5+'%');break;case _0xfafc('0x2d'):_0x402f98['or'](_0xfafc('0x2e'),qs[_0xfafc('0x2f')](_0x15ade5,!![]))['or'](_0xfafc('0x30'),qs[_0xfafc('0x2f')](_0x15ade5));break;}}else if(_0x40e9d5===_0xfafc('0x2d')&&qs['isEmail'](_0x15ade5)){_0x402f98['or'](_0xfafc('0x31'),_0x15ade5+'%');}else{if(_0x40e9d5==='mail'){_0x402f98['or'](_0xfafc('0x2e'),qs[_0xfafc('0x2f')](_0x15ade5,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x15ade5));}else if(_0x40e9d5!==_0xfafc('0x32')){_0x402f98['or'](_0xfafc('0x33'),qs[_0xfafc('0x2f')](_0x15ade5));}_0x402f98['or'](_0xfafc('0x34'),qs['getFullTextValue'](_0x15ade5,!![]),null);}}return _0x402f98;}function parseAdvancedSearchFilter(_0x5ceca7,_0xfb083a){var _0x590459=getSqlClauses();var _0x5eb7ea=as[_0xfafc('0x35')](_0x5ceca7);var _0x3419a9=_0x5eb7ea[_0xfafc('0x36')];for(var _0x43b774=0x0;_0x43b774<_0x5eb7ea[_0xfafc('0x37')][_0xfafc('0x15')];_0x43b774++){var _0x3827ed=_0x5eb7ea[_0xfafc('0x37')][_0x43b774];var _0x5c2e7a='i';var _0x2a4f44=_[_0xfafc('0x38')](_0xfb083a,[_0xfafc('0x39'),_0x3827ed[_0xfafc('0x8')]]);if(_0x2a4f44){var _0x1ad23e=as[_0xfafc('0x3a')](_0x5c2e7a,_0x2a4f44[_0xfafc('0x3b')],_0x3827ed);_0x590459[_0xfafc('0x3c')][_0x3419a9](_0x1ad23e[_0xfafc('0x3d')],_0x1ad23e[_0xfafc('0x3e')][_0xfafc('0x3f')],_0x1ad23e[_0xfafc('0x3e')][_0xfafc('0x40')]);}else{switch(_0x3827ed[_0xfafc('0x8')]){case'unreadMessages':var _0x2ea8a7=parseReadParameter(_0x3827ed[_0xfafc('0x3e')]);_0x590459[_0xfafc('0x41')][_0xfafc('0x42')](_0x2ea8a7);break;case'Contact':if(_0x3827ed[_0xfafc('0x43')]===_0xfafc('0x44')){if(_0x3827ed[_0xfafc('0x3e')][_0xfafc('0x45')]('\x20')[_0xfafc('0x15')]>0x1){_0x590459[_0xfafc('0x46')][_0x3419a9](_0xfafc('0x34'),qs[_0xfafc('0x2f')](_0x3827ed[_0xfafc('0x3e')],!![]),null);}else{var _0x27551f='%'+_0x3827ed[_0xfafc('0x3e')]+'%';_0x590459[_0xfafc('0x46')][_0x3419a9](_0xfafc('0x47'),_0x27551f,_0x27551f,_0x27551f);}}else{_0x2a4f44=_['find'](_0xfb083a,['name','ContactId']);_0x3827ed['field']='ContactId';_0x1ad23e=as['buildExpression'](_0x5c2e7a,_0x2a4f44['type'],_0x3827ed);_0x590459[_0xfafc('0x46')][_0x3419a9](_0x1ad23e[_0xfafc('0x3d')],_0x1ad23e[_0xfafc('0x3e')]['start'],_0x1ad23e[_0xfafc('0x3e')]['end']);}break;case'Tag':var _0x45a9b6=_0x3827ed['value'][_0xfafc('0x45')](',')['map'](function(_0x5458de){return Number(_0x5458de);});var _0x104cf0=parseTagParameter(_0x45a9b6);_0x590459[_0xfafc('0x48')]['clause'][_0xfafc('0x42')](_0x104cf0);_0x590459[_0xfafc('0x48')][_0xfafc('0x49')]=_0x45a9b6;break;case'User':if(_0x3827ed[_0xfafc('0x43')]===_0xfafc('0x44')){_0x590459['user'][_0x3419a9](_0xfafc('0x4a'),'%'+_0x3827ed['value']+'%',null);}else{_0x2a4f44=_[_0xfafc('0x38')](_0xfb083a,['name',_0xfafc('0x4b')]);_0x3827ed[_0xfafc('0x8')]=_0xfafc('0x4b');_0x1ad23e=as[_0xfafc('0x3a')](_0x5c2e7a,_0x2a4f44['type'],_0x3827ed);_0x590459[_0xfafc('0x4c')][_0x3419a9](_0x1ad23e[_0xfafc('0x3d')],_0x1ad23e[_0xfafc('0x3e')][_0xfafc('0x3f')],_0x1ad23e[_0xfafc('0x3e')][_0xfafc('0x40')]);}break;case _0xfafc('0x4d'):case _0xfafc('0x4e'):_0x1ad23e=as[_0xfafc('0x3a')]('me',null,_0x3827ed);_0x590459[_0xfafc('0x4d')][_0x3419a9](_0x1ad23e[_0xfafc('0x3d')],_0x1ad23e[_0xfafc('0x3e')][_0xfafc('0x3f')],_0x1ad23e[_0xfafc('0x3e')][_0xfafc('0x40')]);break;}}}return _0x590459;}function parseModelFields(_0x1df58e,_0x3af058,_0x2da4c5){var _0x4bf890=utils[_0xfafc('0x5')](_0x1df58e);var _0x5e4346=squel[_0xfafc('0x24')]();var _0x3189e6=_(_0x3af058)[_0xfafc('0x4f')]()[_0xfafc('0x18')](function(_0xf536f8){return _[_0xfafc('0x50')](_0x2da4c5,[_0xfafc('0x39'),_0xf536f8])?_0xf536f8:undefined;})[_0xfafc('0x51')]()[_0xfafc('0x3e')]();if(_0x3189e6[_0xfafc('0x15')]>0x0){_0x3189e6[_0xfafc('0x25')](function(_0x745b88){if(_0x745b88===_0x4bf890){_0x5e4346[_0xfafc('0x42')]('i.'+_0x4bf890+_0xfafc('0x17'),[][_0xfafc('0x52')](_0x3af058[_0x745b88]));}else if(_0x745b88===_0xfafc('0x53')){var _0x3fff12=JSON[_0xfafc('0x54')](_0x3af058[_0x745b88])[_0xfafc('0x55')];var _0x5a6e8f=JSON[_0xfafc('0x54')](_0x3af058[_0x745b88])[_0xfafc('0x56')];_0x5e4346[_0xfafc('0x42')](_0xfafc('0x57'),_0x3fff12,_0x5a6e8f);}else{if(_0x3af058[_0x745b88]===_0xfafc('0x58')){_0x5e4346[_0xfafc('0x42')]('i.'+_0x745b88+_0xfafc('0x59'));}else{_0x5e4346[_0xfafc('0x42')]('i.'+_0x745b88+_0xfafc('0x5a'),_0x3af058[_0x745b88]);}}});}return _0x5e4346;}function parseQueryParameters(_0x416161,_0x3fcc78,_0x5944be){var _0x159845=getSqlClauses();return Promise[_0xfafc('0x5b')]()[_0xfafc('0x5c')](function(){return parseModelFields(_0x416161,_0x3fcc78,_0x5944be);})[_0xfafc('0x5c')](function(_0x268a4a){_0x159845[_0xfafc('0x5d')][_0xfafc('0x42')](_0x268a4a);return parseReadParameter(_0x3fcc78['read']);})[_0xfafc('0x5c')](function(_0x36828c){_0x159845['read']['and'](_0x36828c);return parseTagParameter(_0x3fcc78['tag']);})[_0xfafc('0x5c')](function(_0x21c729){_0x159845[_0xfafc('0x48')]['clause']['and'](_0x21c729);return parseSearchFilter(_0x416161,_0x3fcc78[_0xfafc('0x5e')]);})[_0xfafc('0x5c')](function(_0x5bf634){_0x159845[_0xfafc('0x5e')]=_0x5bf634;return _0x159845;});}function checkAccountsRestrictions(_0x777b3a,_0x18ef32,_0x53f010){var _0x39cd9d=utils[_0xfafc('0x5')](_0x777b3a);var _0xf75ddc=_0xfafc('0x5f')+_['capitalize'](_0x777b3a)+(_0x777b3a===_0xfafc('0x60')?_0xfafc('0x61'):'Accounts');var _0x2b89d3=squel[_0xfafc('0x24')]();return Promise[_0xfafc('0x5b')]()[_0xfafc('0x5c')](function(){if(_0x53f010['search']&&_0x18ef32[_0xfafc('0x6')]===_0xfafc('0x62')){return _0x18ef32[_0xf75ddc]({'attributes':['id'],'raw':!![]});}})[_0xfafc('0x5c')](function(_0xa02dc){if(_0xa02dc){if(_0xa02dc[_0xfafc('0x15')]===0x0){_0x2b89d3['and']('i.'+_0x39cd9d+'\x20IS\x20NULL');}else{_0x2b89d3[_0xfafc('0x42')]('i.'+_0x39cd9d+'\x20IN\x20?',_['map'](_0xa02dc,'id'));}}else if(!_0x53f010[_0x39cd9d]){_0x2b89d3[_0xfafc('0x42')]('i.'+_0x39cd9d+_0xfafc('0x63'));}})[_0xfafc('0x5c')](function(){return _0x2b89d3;});}function getClosedOrderClause(_0x34be67,_0x2d13ce){var _0x2f7bb1='';var _0x577198=[_0xfafc('0x64'),'i.secondDisposition',_0xfafc('0x65')];if(_0x34be67===_0xfafc('0x2d')){_0x577198['unshift'](_0xfafc('0x66'));}if(_0x2d13ce['closed']==='0'&&_0x34be67===_0xfafc('0x2d')){_0x2f7bb1=_0xfafc('0x66');}else{if(_0x2d13ce[_0xfafc('0x67')]==='1'){_0x577198[_0xfafc('0x68')]();}_0x2f7bb1=_0xfafc('0x69')+_0x577198[_0xfafc('0x6a')](',\x20')+')';}return _0x2f7bb1;}function getFilteredInteractions(_0x4567e7,_0x323830,_0x25b002,_0x1e5d2f){var _0x143230=utils[_0xfafc('0xb')](_0x4567e7);var _0x1aade5=_['capitalize'](_0x4567e7)+_0xfafc('0x6b');var _0x131248=[];var _0x26a6df=getTagsQuery();var _0x85fc77={'type':db[_0xfafc('0x6c')][_0xfafc('0x6d')][_0xfafc('0x6e')],'raw':!![]};var _0x12100b=[];var _0x2f0cbf=[];return db['sequelize'][_0xfafc('0x6f')](_0x26a6df['toString'](),_0x85fc77)['then'](function(_0x3d30d2){_0x131248=_[_0xfafc('0x70')](_0x3d30d2,'id');_0x85fc77=_[_0xfafc('0x71')](_0x85fc77,{'model':db[_0x1aade5],'mapToModel':!![],'nest':!![]});if(_0x25b002[_0xfafc('0x5d')]){_0x1e5d2f[_0xfafc('0x72')]['forEach'](function(_0x455fa8){_0x323830[_0xfafc('0x8')]('i.'+_0x455fa8);});}else{_0x323830[_0xfafc('0x8')](_0xfafc('0x73'),_0xfafc('0x74'));_0x323830[_0xfafc('0x8')]('a.key',_0xfafc('0x75'));_0x323830[_0xfafc('0x8')](_0xfafc('0x76'),_0xfafc('0x77'));if(_0x4567e7==='mail'){_0x323830['field'](_0xfafc('0x78'),'Account.email');_0x323830[_0xfafc('0x8')]('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',_0xfafc('0x79'));_0x323830[_0xfafc('0x8')](_0xfafc('0x7a'));_0x323830[_0xfafc('0x8')](_0xfafc('0x7b'));_0x323830['field'](_0xfafc('0x7c'));_0x323830[_0xfafc('0x8')](_0xfafc('0x7d'));_0x323830[_0xfafc('0x8')](_0xfafc('0x7e'));_0x323830[_0xfafc('0x8')](_0xfafc('0x7f'));_0x323830[_0xfafc('0x8')](_0xfafc('0x80'));_0x323830[_0xfafc('0x8')]('i.lastMsgDirection');_0x323830[_0xfafc('0x8')]('i.subject');_0x323830[_0xfafc('0x8')](_0xfafc('0x65'));_0x323830[_0xfafc('0x8')](_0xfafc('0x81'));_0x323830[_0xfafc('0x8')]('i.thirdDisposition');_0x323830[_0xfafc('0x8')](_0xfafc('0x66'));_0x323830['field'](_0xfafc('0x82'));_0x323830[_0xfafc('0x8')]('i.ContactId');_0x323830[_0xfafc('0x8')]('i.MailAccountId');_0x323830[_0xfafc('0x8')](_0xfafc('0x83'));}else if(_0x4567e7===_0xfafc('0x2c')){_0x323830[_0xfafc('0x8')](_0xfafc('0x84'),'contactName');}else{_0x323830['field'](_0xfafc('0x85'),'contactName');}if(_0x4567e7!==_0xfafc('0x2d')){_0x323830[_0xfafc('0x8')](_0xfafc('0x86'));}_0x323830[_0xfafc('0x8')]('c.firstName',_0xfafc('0x87'));_0x323830[_0xfafc('0x8')](_0xfafc('0x88'),'Contact.lastName');_0x323830['field'](_0xfafc('0x89'),_0xfafc('0x8a'));_0x323830[_0xfafc('0x8')](_0xfafc('0x8b'),_0xfafc('0x8c'));_0x323830[_0xfafc('0x8')](_0xfafc('0x8d'),_0xfafc('0x8e'));_0x323830[_0xfafc('0x8')](_0xfafc('0x8f'),'Contact.fax');_0x323830['field'](_0xfafc('0x90'),_0xfafc('0x91'));_0x323830[_0xfafc('0x8')]('o.internal','Owner.internal');_0x323830[_0xfafc('0x8')](_0xfafc('0x92'),'TagIds');}if(_0x1e5d2f[_0xfafc('0x93')]){_0x323830['limit'](_0x1e5d2f[_0xfafc('0x93')]);}if(_0x1e5d2f['offset']){_0x323830['offset'](_0x1e5d2f[_0xfafc('0x94')]);}return db[_0xfafc('0x95')][_0xfafc('0x6f')](_0x323830[_0xfafc('0x96')](),_0x85fc77);})[_0xfafc('0x5c')](function(_0x5babcf){_0x12100b=_0x5babcf;var _0x3992cc=getUsersQuery(_0x4567e7,_0x12100b);return db[_0xfafc('0x95')][_0xfafc('0x6f')](_0x3992cc['toString'](),_0x85fc77);})[_0xfafc('0x5c')](function(_0x55641e){_0x2f0cbf=_[_0xfafc('0x97')](_0x55641e,_0x143230);if(_0x4567e7==='mail'){return db['Setting'][_0xfafc('0x98')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xfafc('0x5c')](function(_0x5526af){var _0x1fa1ae=_0x5526af?_0x5526af['enableEmailPreview']:undefined;var _0x2ff95f=_0x12100b[_0xfafc('0x18')](function(_0x2a49f9){return updateInteraction(_0x2a49f9,_0x131248,_0x2f0cbf,_0x1fa1ae);});return Promise[_0xfafc('0x99')](_0x2ff95f);});}function countFilteredInteractions(_0x46d4ad,_0x15e3d0){var _0xf2bb23=_0x46d4ad[_0xfafc('0x9a')]();_0xf2bb23[_0xfafc('0x8')](_0xfafc('0x9b'));_0xf2bb23[_0xfafc('0x8')](_0xfafc('0x73'),'unreadMessages');var _0x21a8f1=utils[_0xfafc('0x9c')](_0x15e3d0);if(!_['isEmpty'](_0x21a8f1)){_0xf2bb23['where'](_0xfafc('0x9d'),_0x21a8f1);}var _0x559c98={'type':db[_0xfafc('0x6c')][_0xfafc('0x6d')][_0xfafc('0x6e')],'raw':!![]};return db['sequelize'][_0xfafc('0x6f')](_0xf2bb23[_0xfafc('0x96')](),_0x559c98);}module[_0xfafc('0x9e')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xa2af=['i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','getInteractionFK','Interaction','Sequelize','QueryTypes','SELECT','query','toString','keyBy','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.to','i.ContactId','i.MailAccountId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','Setting','enableEmailPreview','clone','COUNT(*)','getSelectedTags','isEmpty','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','field','name','color','from','tools_tags','user_has_','_interactions','u.fullname','ui.','left_join','users','length','where','\x20IN\x20?','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','messages','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','buildExpression','type','text','start','value','end','unreadMessages','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','map','tags','clause','and','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','keys','some','compact','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','read','tag','filter','get','capitalize','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','unshift'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0xa2af,0xe0));var _0xfa2a=function(_0x596769,_0x2c273c){_0x596769=_0x596769-0x0;var _0x2635a5=_0xa2af[_0x596769];return _0x2635a5;};'use strict';var _=require(_0xfa2a('0x0'));var squel=require(_0xfa2a('0x1'));var as=require(_0xfa2a('0x2'));var qs=require(_0xfa2a('0x3'));var updateInteraction=require(_0xfa2a('0x4'))[_0xfa2a('0x5')];var utils=require(_0xfa2a('0x6'));var db=require(_0xfa2a('0x7'))['db'];function skipInteractionsQuery(_0x261e0b,_0x462403,_0x4f1731){var _0x4b7984=![];var _0x512087=utils[_0xfa2a('0x8')](_0x261e0b);if(_0x462403['role']===_0xfa2a('0x9')&&!_0x4f1731[_0xfa2a('0xa')]&&!_0x4f1731[_0x512087]){_0x4b7984=!![];}return _0x4b7984;}function getTagsQuery(){return squel[_0xfa2a('0xb')]()[_0xfa2a('0xc')]('id')[_0xfa2a('0xc')](_0xfa2a('0xd'))[_0xfa2a('0xc')](_0xfa2a('0xe'))[_0xfa2a('0xf')](_0xfa2a('0x10'));}function getUsersQuery(_0x533d7d,_0x5134ca){var _0x412afe=utils['getInteractionFK'](_0x533d7d);var _0x4eef64=_0xfa2a('0x11')+_0x533d7d+_0xfa2a('0x12');var _0x38af1e=squel['select']()[_0xfa2a('0xc')]('u.id')[_0xfa2a('0xc')](_0xfa2a('0x13'))[_0xfa2a('0xc')](_0xfa2a('0x14')+_0x412afe)[_0xfa2a('0xf')](_0x4eef64,'ui')[_0xfa2a('0x15')](_0xfa2a('0x16'),'u','u.id\x20=\x20ui.UserId');if(_0x5134ca[_0xfa2a('0x17')]>0x0){_0x38af1e[_0xfa2a('0x18')]('ui.'+_0x412afe+_0xfa2a('0x19'),_['map'](_0x5134ca,'id'));}return _0x38af1e;}function getInteractionsQuery(_0x123ee4){var _0x205a1f=utils['getInteractionsTables'](_0x123ee4);var _0x445078=utils[_0xfa2a('0x8')](_0x123ee4);var _0x5e75d9=utils['getInteractionFK'](_0x123ee4);return squel[_0xfa2a('0xb')]()[_0xfa2a('0xf')](_0x205a1f['interactions'],'i')[_0xfa2a('0x15')]('cm_contacts','c',_0xfa2a('0x1a'))[_0xfa2a('0x15')](_0xfa2a('0x16'),'o',_0xfa2a('0x1b'))[_0xfa2a('0x15')](_0x205a1f[_0xfa2a('0x1c')],'a','a.id\x20=\x20i.'+_0x445078)[_0xfa2a('0x15')](_0x205a1f[_0xfa2a('0x1d')],'me',_0xfa2a('0x1e')+_0x5e75d9+_0xfa2a('0x1f'))[_0xfa2a('0x15')](_0x205a1f[_0xfa2a('0x20')],'it','it.'+_0x5e75d9+_0xfa2a('0x1f'))[_0xfa2a('0x15')]('tools_tags','t',_0xfa2a('0x21'));}function getSqlClauses(){var _0x172454={'body':squel['expr'](),'contact':squel[_0xfa2a('0x22')](),'default':squel[_0xfa2a('0x22')](),'fields':squel[_0xfa2a('0x22')](),'filter':squel[_0xfa2a('0x22')](),'read':squel[_0xfa2a('0x22')](),'tags':{'clause':squel[_0xfa2a('0x22')](),'ids':null},'user':squel[_0xfa2a('0x22')]()};return _0x172454;}function parseTagParameter(_0x4afaa8){var _0x435e39=squel[_0xfa2a('0x22')]();if(_0x4afaa8){var _0x1f4e21=utils['getSelectedTags'](_0x4afaa8);_0x1f4e21[_0xfa2a('0x23')](function(_0x2ee7d5){_0x435e39['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2ee7d5+',%');});}return _0x435e39;}function parseReadParameter(_0x193670){var _0xfbb07f='';if(_0x193670){_0xfbb07f=_0xfa2a('0x24');if(_0x193670==='1'){_0xfbb07f=_0xfbb07f[_0xfa2a('0x25')](_0xfa2a('0x26'),'=');}else{_0xfbb07f=_0xfbb07f['replace'](_0xfa2a('0x26'),'>');}}return _0xfbb07f;}function parseSearchFilter(_0x4134f2,_0x150513){var _0x3b9c03=squel[_0xfa2a('0x22')]();if(_0x150513){var _0x17917c=_0x150513[_0xfa2a('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xfa2a('0x27')](_0x17917c)){_0x3b9c03['or'](_0xfa2a('0x28'),_0x17917c+'%');switch(_0x4134f2){case _0xfa2a('0x29'):case _0xfa2a('0x2a'):_0x3b9c03['or'](_0xfa2a('0x2b'),_0x17917c+'%');break;case _0xfa2a('0x2c'):_0x3b9c03['or'](_0xfa2a('0x2d'),_0x17917c+'%');break;case _0xfa2a('0x2e'):_0x3b9c03['or']('i.from\x20LIKE\x20?',_0x17917c+'%');break;case _0xfa2a('0x2f'):_0x3b9c03['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfa2a('0x30')](_0x17917c,!![]))['or'](_0xfa2a('0x31'),qs[_0xfa2a('0x30')](_0x17917c));break;}}else if(_0x4134f2===_0xfa2a('0x2f')&&qs['isEmail'](_0x17917c)){_0x3b9c03['or']('c.email\x20LIKE\x20?',_0x17917c+'%');}else{if(_0x4134f2===_0xfa2a('0x2f')){_0x3b9c03['or'](_0xfa2a('0x32'),qs[_0xfa2a('0x30')](_0x17917c,!![]))['or'](_0xfa2a('0x31'),qs['getFullTextValue'](_0x17917c));}else if(_0x4134f2!=='fax'){_0x3b9c03['or'](_0xfa2a('0x33'),qs[_0xfa2a('0x30')](_0x17917c));}_0x3b9c03['or'](_0xfa2a('0x34'),qs['getFullTextValue'](_0x17917c,!![]),null);}}return _0x3b9c03;}function parseAdvancedSearchFilter(_0x57a21a,_0x1218ed){var _0x36ebdb=getSqlClauses();var _0x5a1be0=as[_0xfa2a('0x35')](_0x57a21a);var _0x358145=_0x5a1be0['sqlOperator'];for(var _0x245b04=0x0;_0x245b04<_0x5a1be0['conditions']['length'];_0x245b04++){var _0x43e7b5=_0x5a1be0[_0xfa2a('0x36')][_0x245b04];var _0x320558='i';var _0x359cf5=_[_0xfa2a('0x37')](_0x1218ed,['name',_0x43e7b5['field']]);if(_0x359cf5){var _0x214c71=as[_0xfa2a('0x38')](_0x320558,_0x359cf5[_0xfa2a('0x39')],_0x43e7b5);_0x36ebdb['default'][_0x358145](_0x214c71[_0xfa2a('0x3a')],_0x214c71['value'][_0xfa2a('0x3b')],_0x214c71[_0xfa2a('0x3c')][_0xfa2a('0x3d')]);}else{switch(_0x43e7b5[_0xfa2a('0xc')]){case _0xfa2a('0x3e'):var _0x4f5030=parseReadParameter(_0x43e7b5['value']);_0x36ebdb['read']['and'](_0x4f5030);break;case _0xfa2a('0x3f'):if(_0x43e7b5[_0xfa2a('0x40')]===_0xfa2a('0x41')){if(_0x43e7b5[_0xfa2a('0x3c')][_0xfa2a('0x42')]('\x20')[_0xfa2a('0x17')]>0x1){_0x36ebdb[_0xfa2a('0x43')][_0x358145]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfa2a('0x30')](_0x43e7b5['value'],!![]),null);}else{var _0x3cd1ac='%'+_0x43e7b5[_0xfa2a('0x3c')]+'%';_0x36ebdb['contact'][_0x358145](_0xfa2a('0x44'),_0x3cd1ac,_0x3cd1ac,_0x3cd1ac);}}else{_0x359cf5=_[_0xfa2a('0x37')](_0x1218ed,['name',_0xfa2a('0x45')]);_0x43e7b5[_0xfa2a('0xc')]='ContactId';_0x214c71=as[_0xfa2a('0x38')](_0x320558,_0x359cf5[_0xfa2a('0x39')],_0x43e7b5);_0x36ebdb['contact'][_0x358145](_0x214c71[_0xfa2a('0x3a')],_0x214c71['value'][_0xfa2a('0x3b')],_0x214c71[_0xfa2a('0x3c')][_0xfa2a('0x3d')]);}break;case _0xfa2a('0x46'):var _0xdb017d=_0x43e7b5[_0xfa2a('0x3c')][_0xfa2a('0x42')](',')[_0xfa2a('0x47')](function(_0x3c45c6){return Number(_0x3c45c6);});var _0x2373de=parseTagParameter(_0xdb017d);_0x36ebdb[_0xfa2a('0x48')][_0xfa2a('0x49')][_0xfa2a('0x4a')](_0x2373de);_0x36ebdb[_0xfa2a('0x48')][_0xfa2a('0x4b')]=_0xdb017d;break;case _0xfa2a('0x4c'):if(_0x43e7b5['operator']===_0xfa2a('0x41')){_0x36ebdb[_0xfa2a('0x4d')][_0x358145](_0xfa2a('0x4e'),'%'+_0x43e7b5[_0xfa2a('0x3c')]+'%',null);}else{_0x359cf5=_[_0xfa2a('0x37')](_0x1218ed,[_0xfa2a('0xd'),_0xfa2a('0x4f')]);_0x43e7b5['field']='UserId';_0x214c71=as[_0xfa2a('0x38')](_0x320558,_0x359cf5[_0xfa2a('0x39')],_0x43e7b5);_0x36ebdb[_0xfa2a('0x4d')][_0x358145](_0x214c71[_0xfa2a('0x3a')],_0x214c71[_0xfa2a('0x3c')][_0xfa2a('0x3b')],_0x214c71[_0xfa2a('0x3c')]['end']);}break;case _0xfa2a('0x50'):case'plainBody':_0x214c71=as[_0xfa2a('0x38')]('me',null,_0x43e7b5);_0x36ebdb[_0xfa2a('0x50')][_0x358145](_0x214c71['text'],_0x214c71[_0xfa2a('0x3c')][_0xfa2a('0x3b')],_0x214c71[_0xfa2a('0x3c')][_0xfa2a('0x3d')]);break;}}}return _0x36ebdb;}function parseModelFields(_0x46770b,_0x3ceeca,_0x44eeda){var _0x11ae96=utils['getAccountFK'](_0x46770b);var _0x10d0a7=squel[_0xfa2a('0x22')]();var _0x44d565=_(_0x3ceeca)[_0xfa2a('0x51')]()[_0xfa2a('0x47')](function(_0x58668f){return _[_0xfa2a('0x52')](_0x44eeda,['name',_0x58668f])?_0x58668f:undefined;})[_0xfa2a('0x53')]()[_0xfa2a('0x3c')]();if(_0x44d565['length']>0x0){_0x44d565[_0xfa2a('0x23')](function(_0x284911){if(_0x284911===_0x11ae96){_0x10d0a7[_0xfa2a('0x4a')]('i.'+_0x11ae96+_0xfa2a('0x19'),[][_0xfa2a('0x54')](_0x3ceeca[_0x284911]));}else if(_0x284911===_0xfa2a('0x55')){var _0x1b1bd7=JSON[_0xfa2a('0x56')](_0x3ceeca[_0x284911])['$gte'];var _0x340b47=JSON[_0xfa2a('0x56')](_0x3ceeca[_0x284911])[_0xfa2a('0x57')];_0x10d0a7['and'](_0xfa2a('0x58'),_0x1b1bd7,_0x340b47);}else{if(_0x3ceeca[_0x284911]===_0xfa2a('0x59')){_0x10d0a7[_0xfa2a('0x4a')]('i.'+_0x284911+_0xfa2a('0x5a'));}else{_0x10d0a7[_0xfa2a('0x4a')]('i.'+_0x284911+_0xfa2a('0x5b'),_0x3ceeca[_0x284911]);}}});}return _0x10d0a7;}function parseQueryParameters(_0x10f2b8,_0x40cbf9,_0x15de6e){var _0xd7a366=getSqlClauses();return Promise[_0xfa2a('0x5c')]()[_0xfa2a('0x5d')](function(){return parseModelFields(_0x10f2b8,_0x40cbf9,_0x15de6e);})['then'](function(_0x1f963b){_0xd7a366['fields'][_0xfa2a('0x4a')](_0x1f963b);return parseReadParameter(_0x40cbf9[_0xfa2a('0x5e')]);})[_0xfa2a('0x5d')](function(_0x3d9758){_0xd7a366[_0xfa2a('0x5e')][_0xfa2a('0x4a')](_0x3d9758);return parseTagParameter(_0x40cbf9[_0xfa2a('0x5f')]);})['then'](function(_0xfffce2){_0xd7a366[_0xfa2a('0x48')]['clause']['and'](_0xfffce2);return parseSearchFilter(_0x10f2b8,_0x40cbf9[_0xfa2a('0x60')]);})[_0xfa2a('0x5d')](function(_0x4e358e){_0xd7a366[_0xfa2a('0x60')]=_0x4e358e;return _0xd7a366;});}function checkAccountsRestrictions(_0x1168bf,_0x12b0c7,_0x2a452c){var _0x230a39=utils[_0xfa2a('0x8')](_0x1168bf);var _0x40e89e=_0xfa2a('0x61')+_[_0xfa2a('0x62')](_0x1168bf)+(_0x1168bf==='chat'?_0xfa2a('0x63'):_0xfa2a('0x64'));var _0x4b3805=squel['expr']();return Promise[_0xfa2a('0x5c')]()[_0xfa2a('0x5d')](function(){if(_0x2a452c[_0xfa2a('0xa')]&&_0x12b0c7[_0xfa2a('0x65')]===_0xfa2a('0x9')){return _0x12b0c7[_0x40e89e]({'attributes':['id'],'raw':!![]});}})[_0xfa2a('0x5d')](function(_0x83f7e9){if(_0x83f7e9){if(_0x83f7e9['length']===0x0){_0x4b3805[_0xfa2a('0x4a')]('i.'+_0x230a39+_0xfa2a('0x5a'));}else{_0x4b3805['and']('i.'+_0x230a39+_0xfa2a('0x19'),_[_0xfa2a('0x47')](_0x83f7e9,'id'));}}else if(!_0x2a452c[_0x230a39]){_0x4b3805['and']('i.'+_0x230a39+_0xfa2a('0x66'));}})[_0xfa2a('0x5d')](function(){return _0x4b3805;});}function getClosedOrderClause(_0xc5bff2,_0x94fbca){var _0x586e5b='';var _0x395985=[_0xfa2a('0x67'),_0xfa2a('0x68'),'i.disposition'];if(_0xc5bff2==='mail'){_0x395985[_0xfa2a('0x69')](_0xfa2a('0x6a'));}if(_0x94fbca[_0xfa2a('0x6b')]==='0'&&_0xc5bff2===_0xfa2a('0x2f')){_0x586e5b=_0xfa2a('0x6a');}else{if(_0x94fbca['closed']==='1'){_0x395985[_0xfa2a('0x6c')]();}_0x586e5b=_0xfa2a('0x6d')+_0x395985[_0xfa2a('0x6e')](',\x20')+')';}return _0x586e5b;}function getFilteredInteractions(_0x4c5e44,_0x18fbf1,_0x4378ce,_0x17a248){var _0x4235a9=utils[_0xfa2a('0x6f')](_0x4c5e44);var _0x9207a7=_['capitalize'](_0x4c5e44)+_0xfa2a('0x70');var _0x2c559b=[];var _0x4a782c=getTagsQuery();var _0x4c29e9={'type':db[_0xfa2a('0x71')][_0xfa2a('0x72')][_0xfa2a('0x73')],'raw':!![]};var _0x46fe3c=[];var _0x37af1f=[];return db['sequelize'][_0xfa2a('0x74')](_0x4a782c[_0xfa2a('0x75')](),_0x4c29e9)['then'](function(_0x95d8c7){_0x2c559b=_[_0xfa2a('0x76')](_0x95d8c7,'id');_0x4c29e9=_[_0xfa2a('0x77')](_0x4c29e9,{'model':db[_0x9207a7],'mapToModel':!![],'nest':!![]});if(_0x4378ce[_0xfa2a('0x78')]){_0x17a248['attributes'][_0xfa2a('0x23')](function(_0x5b2063){_0x18fbf1['field']('i.'+_0x5b2063);});}else{_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x79'),_0xfa2a('0x3e'));_0x18fbf1['field'](_0xfa2a('0x7a'),_0xfa2a('0x7b'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x7c'),'Account.mandatoryDisposition');if(_0x4c5e44===_0xfa2a('0x2f')){_0x18fbf1['field'](_0xfa2a('0x7d'),_0xfa2a('0x7e'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x7f'),_0xfa2a('0x80'));_0x18fbf1[_0xfa2a('0xc')]('i.id');_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x81'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x82'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x83'));_0x18fbf1[_0xfa2a('0xc')]('i.closedAt');_0x18fbf1['field'](_0xfa2a('0x84'));_0x18fbf1['field'](_0xfa2a('0x85'));_0x18fbf1[_0xfa2a('0xc')]('i.lastMsgDirection');_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x86'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x87'));_0x18fbf1[_0xfa2a('0xc')]('i.secondDisposition');_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x67'));_0x18fbf1['field']('i.substatus');_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x88'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x89'));_0x18fbf1['field'](_0xfa2a('0x8a'));_0x18fbf1[_0xfa2a('0xc')]('i.UserId');}else if(_0x4c5e44===_0xfa2a('0x2e')){_0x18fbf1['field'](_0xfa2a('0x8b'),_0xfa2a('0x80'));}else{_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x8c'),_0xfa2a('0x80'));}if(_0x4c5e44!==_0xfa2a('0x2f')){_0x18fbf1[_0xfa2a('0xc')]('i.*');}_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x8d'),_0xfa2a('0x8e'));_0x18fbf1[_0xfa2a('0xc')]('c.lastName',_0xfa2a('0x8f'));_0x18fbf1['field']('c.email',_0xfa2a('0x90'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x91'),_0xfa2a('0x92'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x93'),_0xfa2a('0x94'));_0x18fbf1['field'](_0xfa2a('0x95'),_0xfa2a('0x96'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x97'),_0xfa2a('0x98'));_0x18fbf1[_0xfa2a('0xc')]('o.internal','Owner.internal');_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x99'),_0xfa2a('0x9a'));}if(_0x17a248[_0xfa2a('0x9b')]){_0x18fbf1['limit'](_0x17a248[_0xfa2a('0x9b')]);}if(_0x17a248[_0xfa2a('0x9c')]){_0x18fbf1['offset'](_0x17a248[_0xfa2a('0x9c')]);}return db['sequelize'][_0xfa2a('0x74')](_0x18fbf1[_0xfa2a('0x75')](),_0x4c29e9);})[_0xfa2a('0x5d')](function(_0x304f50){_0x46fe3c=_0x304f50;var _0x3de171=getUsersQuery(_0x4c5e44,_0x46fe3c);return db[_0xfa2a('0x9d')][_0xfa2a('0x74')](_0x3de171['toString'](),_0x4c29e9);})[_0xfa2a('0x5d')](function(_0x120bda){_0x37af1f=_[_0xfa2a('0x9e')](_0x120bda,_0x4235a9);if(_0x4c5e44===_0xfa2a('0x2f')){return db[_0xfa2a('0x9f')]['findOne']({'attributes':[_0xfa2a('0xa0')],'raw':!![]});}})[_0xfa2a('0x5d')](function(_0x128f0b){var _0x3d39e2=_0x128f0b?_0x128f0b[_0xfa2a('0xa0')]:undefined;var _0x497294=_0x46fe3c[_0xfa2a('0x47')](function(_0x39dc8a){return updateInteraction(_0x39dc8a,_0x2c559b,_0x37af1f,_0x3d39e2);});return Promise['all'](_0x497294);});}function countFilteredInteractions(_0x22fc0d,_0x13bca3){var _0x407eb7=_0x22fc0d[_0xfa2a('0xa1')]();_0x407eb7[_0xfa2a('0xc')](_0xfa2a('0xa2'));_0x407eb7['field'](_0xfa2a('0x79'),_0xfa2a('0x3e'));var _0x34ac23=utils[_0xfa2a('0xa3')](_0x13bca3);if(!_[_0xfa2a('0xa4')](_0x34ac23)){_0x407eb7[_0xfa2a('0x18')]('t.id\x20IN\x20?',_0x34ac23);}var _0x55716a={'type':db['Sequelize'][_0xfa2a('0x72')][_0xfa2a('0x73')],'raw':!![]};return db['sequelize'][_0xfa2a('0x74')](_0x407eb7[_0xfa2a('0x75')](),_0x55716a);}module['exports']={'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 65fc74d..fcb4d58 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 _0x7dc5=['UserId','talking','MailMessage','findOne','out','-id','lastMsgText','trimStart','plainBody','catch','updateInteraction','Users','TagIds','then','Tags','../../mysqldb','fullname','split','forEach','waiting','answered','unmanaged','abandoned','total','closed','disposition'];(function(_0x4077e5,_0x55ba6a){var _0xf43f17=function(_0x3e2f14){while(--_0x3e2f14){_0x4077e5['push'](_0x4077e5['shift']());}};_0xf43f17(++_0x55ba6a);}(_0x7dc5,0xdf));var _0x57dc=function(_0x4b85a3,_0x55a93f){_0x4b85a3=_0x4b85a3-0x0;var _0xcf8bc7=_0x7dc5[_0x4b85a3];return _0xcf8bc7;};'use strict';var _=require('lodash');var db=require(_0x57dc('0x0'))['db'];function getInteractionUsers(_0x5f46bd,_0x127a9b){return new Promise(function(_0x499eb1,_0x3ca228){try{var _0x25d32d=[];if(_0x127a9b[_0x5f46bd]){_0x25d32d=_0x127a9b[_0x5f46bd]['map'](function(_0x4849a){return{'id':_0x4849a['id'],'fullname':_0x4849a[_0x57dc('0x1')]};});}return _0x499eb1(_0x25d32d);}catch(_0x22459f){_0x3ca228(_0x22459f);}});}function getInteractionTags(_0x2aa31f,_0x42dcd0){var _0x78561=[];if(_0x2aa31f){_0x2aa31f[_0x57dc('0x2')](',')[_0x57dc('0x3')](function(_0x4f3f9d){_0x78561['push'](_0x42dcd0[_0x4f3f9d]);});}return _0x78561;}function updateWaitingCounter(_0x13bb20){if(_0x13bb20['waiting']){_0x13bb20[_0x57dc('0x4')]-=0x1;}}function updateInteractionCounters(_0x21e507){_0x21e507[_0x57dc('0x4')]=0x0;_0x21e507['talking']=0x0;_0x21e507[_0x57dc('0x5')]=0x0;_0x21e507[_0x57dc('0x6')]=0x0;_0x21e507[_0x57dc('0x7')]=0x0;_0x21e507[_0x57dc('0x8')]=0x0;if(_0x21e507[_0x57dc('0x9')]){if(_0x21e507[_0x57dc('0xa')]===_0x57dc('0x7')){_0x21e507[_0x57dc('0x7')]+=0x1;updateWaitingCounter(_0x21e507);}if(_0x21e507[_0x57dc('0xb')]){_0x21e507['answered']+=0x1;if(_0x21e507[_0x57dc('0xc')]){_0x21e507['talking']-=0x1;}}else{if(_0x21e507[_0x57dc('0xa')]){_0x21e507['unmanaged']+=0x1;updateWaitingCounter(_0x21e507);}}}else{if(!_0x21e507['UserId']){_0x21e507[_0x57dc('0x4')]+=0x1;}if(_0x21e507[_0x57dc('0xb')]){_0x21e507[_0x57dc('0xc')]+=0x1;updateWaitingCounter(_0x21e507);}}_0x21e507[_0x57dc('0x8')]+=0x1;return _0x21e507;}function getLastMessageText(_0x4c0dd1){return db[_0x57dc('0xd')][_0x57dc('0xe')]({'where':{'$and':[{'MailInteractionId':_0x4c0dd1['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x57dc('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x57dc('0x10'),'raw':!![]})['then'](function(_0x176bed){if(_0x176bed&&_0x176bed['plainBody']){_0x4c0dd1[_0x57dc('0x11')]=_[_0x57dc('0x12')](_0x176bed[_0x57dc('0x13')]);}return _0x4c0dd1;})[_0x57dc('0x14')](function(_0x4cafeb){throw _0x4cafeb;});}exports[_0x57dc('0x15')]=function(_0x35efe1,_0x52e1e4,_0x4e88dc,_0x5f2db6){return new Promise(function(_0x245923,_0xeb6953){return getInteractionUsers(_0x35efe1['id'],_0x4e88dc)['then'](function(_0x24483c){_0x35efe1[_0x57dc('0x16')]=_0x24483c;return getInteractionTags(_0x35efe1[_0x57dc('0x17')],_0x52e1e4);})[_0x57dc('0x18')](function(_0x1cedc6){_0x35efe1[_0x57dc('0x19')]=_0x1cedc6;delete _0x35efe1[_0x57dc('0x17')];return updateInteractionCounters(_0x35efe1);})['then'](function(_0x267c6b){if(_0x5f2db6){return getLastMessageText(_0x267c6b);}else{return _0x267c6b;}})[_0x57dc('0x18')](function(_0x4489a6){_0x245923(_0x4489a6);})[_0x57dc('0x14')](function(_0x1c1aa6){_0xeb6953(_0x1c1aa6);});});}; \ No newline at end of file +var _0xd671=['../../mysqldb','map','fullname','split','push','waiting','talking','answered','abandoned','total','closed','disposition','UserId','unmanaged','findOne','out','plainBody','then','catch','Users','TagIds','Tags'];(function(_0x584a51,_0x3dcc2a){var _0x25d14d=function(_0x34fb5b){while(--_0x34fb5b){_0x584a51['push'](_0x584a51['shift']());}};_0x25d14d(++_0x3dcc2a);}(_0xd671,0x84));var _0x1d67=function(_0x562cd7,_0x5ae8e7){_0x562cd7=_0x562cd7-0x0;var _0x30f50d=_0xd671[_0x562cd7];return _0x30f50d;};'use strict';var _=require('lodash');var db=require(_0x1d67('0x0'))['db'];function getInteractionUsers(_0x5d3ac3,_0x5d7524){return new Promise(function(_0x14550b,_0x57f271){try{var _0x2436e3=[];if(_0x5d7524[_0x5d3ac3]){_0x2436e3=_0x5d7524[_0x5d3ac3][_0x1d67('0x1')](function(_0x453c40){return{'id':_0x453c40['id'],'fullname':_0x453c40[_0x1d67('0x2')]};});}return _0x14550b(_0x2436e3);}catch(_0x33a7ca){_0x57f271(_0x33a7ca);}});}function getInteractionTags(_0x1dd7da,_0x3b8476){var _0x5dbf58=[];if(_0x1dd7da){_0x1dd7da[_0x1d67('0x3')](',')['forEach'](function(_0x2a649c){_0x5dbf58[_0x1d67('0x4')](_0x3b8476[_0x2a649c]);});}return _0x5dbf58;}function updateWaitingCounter(_0x2135bf){if(_0x2135bf[_0x1d67('0x5')]){_0x2135bf[_0x1d67('0x5')]-=0x1;}}function updateInteractionCounters(_0x6521a9){_0x6521a9[_0x1d67('0x5')]=0x0;_0x6521a9[_0x1d67('0x6')]=0x0;_0x6521a9[_0x1d67('0x7')]=0x0;_0x6521a9['unmanaged']=0x0;_0x6521a9[_0x1d67('0x8')]=0x0;_0x6521a9[_0x1d67('0x9')]=0x0;if(_0x6521a9[_0x1d67('0xa')]){if(_0x6521a9[_0x1d67('0xb')]===_0x1d67('0x8')){_0x6521a9[_0x1d67('0x8')]+=0x1;updateWaitingCounter(_0x6521a9);}if(_0x6521a9[_0x1d67('0xc')]){_0x6521a9[_0x1d67('0x7')]+=0x1;if(_0x6521a9[_0x1d67('0x6')]){_0x6521a9[_0x1d67('0x6')]-=0x1;}}else{if(_0x6521a9[_0x1d67('0xb')]){_0x6521a9[_0x1d67('0xd')]+=0x1;updateWaitingCounter(_0x6521a9);}}}else{if(!_0x6521a9[_0x1d67('0xc')]){_0x6521a9['waiting']+=0x1;}if(_0x6521a9['UserId']){_0x6521a9[_0x1d67('0x6')]+=0x1;updateWaitingCounter(_0x6521a9);}}_0x6521a9[_0x1d67('0x9')]+=0x1;return _0x6521a9;}function getLastMessageText(_0x1f2865){return db['MailMessage'][_0x1d67('0xe')]({'where':{'$and':[{'MailInteractionId':_0x1f2865['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1d67('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1d67('0x10')],'order':'-id','raw':!![]})[_0x1d67('0x11')](function(_0x1801f0){if(_0x1801f0&&_0x1801f0[_0x1d67('0x10')]){_0x1f2865['lastMsgText']=_['trimStart'](_0x1801f0['plainBody']);}return _0x1f2865;})[_0x1d67('0x12')](function(_0x23f0bc){throw _0x23f0bc;});}exports['updateInteraction']=function(_0x566ebd,_0x34364a,_0x471907,_0x104bf8){return new Promise(function(_0x4cb388,_0x2aa750){return getInteractionUsers(_0x566ebd['id'],_0x471907)['then'](function(_0x3ba324){_0x566ebd[_0x1d67('0x13')]=_0x3ba324;return getInteractionTags(_0x566ebd[_0x1d67('0x14')],_0x34364a);})[_0x1d67('0x11')](function(_0x125bb0){_0x566ebd[_0x1d67('0x15')]=_0x125bb0;delete _0x566ebd[_0x1d67('0x14')];return updateInteractionCounters(_0x566ebd);})[_0x1d67('0x11')](function(_0x2670bf){if(_0x104bf8){return getLastMessageText(_0x2670bf);}else{return _0x2670bf;}})[_0x1d67('0x11')](function(_0x30821e){_0x4cb388(_0x30821e);})[_0x1d67('0x12')](function(_0x484159){_0x2aa750(_0x484159);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 94a9124..393a463 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 _0xdba2=['../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','findOne','then','update','catch','exports','lodash'];(function(_0xfd1a60,_0x5b858a){var _0x1cb545=function(_0x22aaca){while(--_0x22aaca){_0xfd1a60['push'](_0xfd1a60['shift']());}};_0x1cb545(++_0x5b858a);}(_0xdba2,0x65));var _0x2dba=function(_0xa7242,_0x4e1f07){_0xa7242=_0xa7242-0x0;var _0x35e329=_0xdba2[_0xa7242];return _0x35e329;};'use strict';var _=require(_0x2dba('0x0'));var db=require(_0x2dba('0x1'))['db'];var loggers={'openchannel':require(_0x2dba('0x2'))(_0x2dba('0x3')),'mail':require('../../config/logger')(_0x2dba('0x4')),'fax':require(_0x2dba('0x2'))(_0x2dba('0x5')),'sms':require(_0x2dba('0x2'))(_0x2dba('0x6')),'chat':require('../../config/logger')(_0x2dba('0x7')),'whatsapp':require(_0x2dba('0x2'))(_0x2dba('0x8'))};function getAccountFK(_0x6bca72){return _[_0x2dba('0x9')](_0x6bca72)+(_0x6bca72===_0x2dba('0xa')?_0x2dba('0xb'):_0x2dba('0xc'))+'Id';}function getInteractionFK(_0x23823b){return _[_0x2dba('0x9')](_0x23823b)+_0x2dba('0xd');}function getInteractionId(_0x54fe99,_0x545f43,_0x545f00){if(_0x54fe99&&_0x54fe99[_[_0x2dba('0xe')](_0x545f00)+_0x2dba('0xd')]){return _0x54fe99[_[_0x2dba('0xe')](_0x545f00)+_0x2dba('0xd')];}else if(_0x54fe99&&_0x54fe99['id']){return _0x54fe99['id'];}else if(_0x545f43&&_0x545f43['id']){return _0x545f43['id'];}else{return _0x2dba('0xf');}}function getInteractionsTables(_0x4f0129){return{'accounts':_0x4f0129+'_'+(_0x4f0129===_0x2dba('0xa')?_0x2dba('0x10'):_0x2dba('0x11')),'interactions':_0x4f0129+_0x2dba('0x12'),'interactionsTags':_0x4f0129+_0x2dba('0x13'),'messages':_0x4f0129+_0x2dba('0x14'),'userInteractions':_0x2dba('0x15')+_0x4f0129+'_interactions'};}function getSelectedTags(_0x3a64b0){var _0x466110=[];if(_0x3a64b0){_0x466110=Array[_0x2dba('0x16')](_0x3a64b0)?_0x3a64b0:[_0x3a64b0];}return _0x466110;}function log(_0x10d1eb,_0xc20d11,_0x50eb78,_0x53a580,_0x28130d,_0x608ed6){loggers[_0x28130d[_0x2dba('0x17')]()][_0x10d1eb](_0x2dba('0x18'),_0x608ed6[_0x2dba('0x19')](),_0xc20d11?_0xc20d11['id']:null,_0xc20d11?_0xc20d11['name']:null,_0xc20d11?_0xc20d11[_0x2dba('0x1a')]:null,getInteractionId(_0x50eb78,_0x53a580,_0x28130d),_0x50eb78?JSON[_0x2dba('0x1b')](_0x50eb78):_0x2dba('0x1c'));}function updateUser(_0x42aade,_0x43024c,_0x20f662,_0x5b8e25,_0x28f396){db[_[_0x2dba('0xe')](_0x5b8e25)+'Interaction'][_0x2dba('0x1d')]({'where':{'id':getInteractionId(_0x43024c,_0x20f662,_0x5b8e25)}})[_0x2dba('0x1e')](function(_0xb9c7aa){if(_0xb9c7aa){return _0xb9c7aa[_0x2dba('0x1f')]({'UserId':_0x42aade?_0x42aade['id']:null});}})['then'](function(_0x3850c7){if(_0x3850c7){log('info',_0x42aade,_0x43024c,_0x20f662,_0x5b8e25,_0x28f396);}})[_0x2dba('0x20')](function(){log('error',_0x42aade,_0x43024c,_0x20f662,_0x5b8e25,_0x28f396);});}module[_0x2dba('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xcf65=['_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','Interaction','then','catch','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','InteractionId','unknown','websites','accounts'];(function(_0x5e0e81,_0x31614a){var _0x12cd9c=function(_0x51ec94){while(--_0x51ec94){_0x5e0e81['push'](_0x5e0e81['shift']());}};_0x12cd9c(++_0x31614a);}(_0xcf65,0x169));var _0x5cf6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcf65[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5cf6('0x0'));var db=require(_0x5cf6('0x1'))['db'];var loggers={'openchannel':require(_0x5cf6('0x2'))(_0x5cf6('0x3')),'mail':require('../../config/logger')(_0x5cf6('0x4')),'fax':require(_0x5cf6('0x2'))(_0x5cf6('0x5')),'sms':require(_0x5cf6('0x2'))(_0x5cf6('0x6')),'chat':require('../../config/logger')(_0x5cf6('0x7')),'whatsapp':require(_0x5cf6('0x2'))(_0x5cf6('0x8'))};function getAccountFK(_0x398350){return _[_0x5cf6('0x9')](_0x398350)+(_0x398350===_0x5cf6('0xa')?_0x5cf6('0xb'):'Account')+'Id';}function getInteractionFK(_0xcef7d6){return _[_0x5cf6('0x9')](_0xcef7d6)+_0x5cf6('0xc');}function getInteractionId(_0x4f344e,_0x560383,_0x2da7ff){if(_0x4f344e&&_0x4f344e[_['upperFirst'](_0x2da7ff)+_0x5cf6('0xc')]){return _0x4f344e[_['upperFirst'](_0x2da7ff)+_0x5cf6('0xc')];}else if(_0x4f344e&&_0x4f344e['id']){return _0x4f344e['id'];}else if(_0x560383&&_0x560383['id']){return _0x560383['id'];}else{return _0x5cf6('0xd');}}function getInteractionsTables(_0x3f6046){return{'accounts':_0x3f6046+'_'+(_0x3f6046===_0x5cf6('0xa')?_0x5cf6('0xe'):_0x5cf6('0xf')),'interactions':_0x3f6046+_0x5cf6('0x10'),'interactionsTags':_0x3f6046+_0x5cf6('0x11'),'messages':_0x3f6046+_0x5cf6('0x12'),'userInteractions':'user_has_'+_0x3f6046+_0x5cf6('0x10')};}function getSelectedTags(_0x1e8791){var _0x428bab=[];if(_0x1e8791){_0x428bab=Array[_0x5cf6('0x13')](_0x1e8791)?_0x1e8791:[_0x1e8791];}return _0x428bab;}function log(_0x48f61f,_0x4974bd,_0x2cbbf6,_0x50626b,_0x534952,_0x1ed203){loggers[_0x534952[_0x5cf6('0x14')]()][_0x48f61f](_0x5cf6('0x15'),_0x1ed203['toUpperCase'](),_0x4974bd?_0x4974bd['id']:null,_0x4974bd?_0x4974bd[_0x5cf6('0x16')]:null,_0x4974bd?_0x4974bd[_0x5cf6('0x17')]:null,getInteractionId(_0x2cbbf6,_0x50626b,_0x534952),_0x2cbbf6?JSON['stringify'](_0x2cbbf6):_0x5cf6('0x18'));}function updateUser(_0x2708f8,_0x548eb8,_0x20d185,_0xc49066,_0x55412e){db[_['upperFirst'](_0xc49066)+_0x5cf6('0x19')]['findOne']({'where':{'id':getInteractionId(_0x548eb8,_0x20d185,_0xc49066)}})[_0x5cf6('0x1a')](function(_0x379454){if(_0x379454){return _0x379454['update']({'UserId':_0x2708f8?_0x2708f8['id']:null});}})[_0x5cf6('0x1a')](function(_0x243c28){if(_0x243c28){log('info',_0x2708f8,_0x548eb8,_0x20d185,_0xc49066,_0x55412e);}})[_0x5cf6('0x1b')](function(){log('error',_0x2708f8,_0x548eb8,_0x20d185,_0xc49066,_0x55412e);});}module[_0x5cf6('0x1c')]={'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 e70bddd..9c90b07 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 _0x9528=['count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','crypto','util','composable-middleware','../../mysqldb','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','final','utf8','parse','hasOwnProperty','License','findOne','then'];(function(_0x5c4d27,_0x5b0822){var _0x1dda1a=function(_0x5ea638){while(--_0x5ea638){_0x5c4d27['push'](_0x5c4d27['shift']());}};_0x1dda1a(++_0x5b0822);}(_0x9528,0x1cf));var _0x8952=function(_0x15dfd9,_0x228082){_0x15dfd9=_0x15dfd9-0x0;var _0x2ffd52=_0x9528[_0x15dfd9];return _0x2ffd52;};'use strict';var crypto=require(_0x8952('0x0'));var util=require(_0x8952('0x1'));var compose=require(_0x8952('0x2'));var db=require(_0x8952('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4da428,_0x543b2a){if(_0x4da428&&_0x543b2a){if(_0x543b2a['data1']&&_0x543b2a[_0x8952('0x4')]){var _0x4b455c=_0x543b2a['data1'];var _0x343bfc=_0x543b2a[_0x8952('0x4')];var _0x3856a8=_0x4b455c[_0x8952('0x5')]('-')[0x4];var _0x34be5f=_0x4b455c[_0x8952('0x5')]('-')[0x0];var _0x9e822=crypto[_0x8952('0x6')](_0x8952('0x7'),util[_0x8952('0x8')](_0x8952('0x9'),_0x3856a8,_0x4b455c,_0x34be5f));var _0x270b6d=_0x9e822['update'](_0x343bfc,'base64','utf8');_0x270b6d+=_0x9e822[_0x8952('0xa')](_0x8952('0xb'));var _0x2f9bf5=JSON[_0x8952('0xc')](_0x270b6d);return _0x2f9bf5[_0x8952('0xd')](_0x4da428)?_0x2f9bf5[_0x4da428]:null;}}return null;}function isLimit(_0x27171a,_0x335450,_0x27d601,_0x28d9c1){var _0xfed8db=_0x335450;return compose()['use'](function(_0x2819c4,_0x51c09f,_0x4a0957){return db[_0x8952('0xe')][_0x8952('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x8952('0x10')](function(_0x228fb8){var _0x208c24=getValueFromLicense(_0x27171a,_0x228fb8);return _0x208c24?_0x208c24:_0xfed8db;})[_0x8952('0x10')](function(_0x31cf0c){_0xfed8db=_0x31cf0c;return _0x27d601[_0x8952('0x11')](_0x28d9c1);})[_0x8952('0x10')](function(_0x4022d9){if(_0x4022d9>=_0xfed8db){return _0x51c09f['status'](0x193)[_0x8952('0x12')]({'message':util[_0x8952('0x8')](_0x8952('0x13'),_0x27171a)});}_0x4a0957();})[_0x8952('0x14')](function(_0x1db247){_0x4a0957(_0x1db247);});});}function isUserLimit(){return isLimit(_0x8952('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0x8952('0x16')},{'role':_0x8952('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x3e8b=['status','json','catch','users','admin','user','isUserLimit','util','composable-middleware','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count'];(function(_0x27fe29,_0x2822fe){var _0x1c07d9=function(_0x221167){while(--_0x221167){_0x27fe29['push'](_0x27fe29['shift']());}};_0x1c07d9(++_0x2822fe);}(_0x3e8b,0x84));var _0xb3e8=function(_0x363898,_0x558c0f){_0x363898=_0x363898-0x0;var _0x32ff6c=_0x3e8b[_0x363898];return _0x32ff6c;};'use strict';var crypto=require('crypto');var util=require(_0xb3e8('0x0'));var compose=require(_0xb3e8('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x2dfb67,_0x124432){if(_0x2dfb67&&_0x124432){if(_0x124432[_0xb3e8('0x2')]&&_0x124432[_0xb3e8('0x3')]){var _0xa86395=_0x124432[_0xb3e8('0x2')];var _0x515a9a=_0x124432[_0xb3e8('0x3')];var _0x1d1923=_0xa86395['split']('-')[0x4];var _0x42bda6=_0xa86395[_0xb3e8('0x4')]('-')[0x0];var _0x55d4ae=crypto['createDecipher'](_0xb3e8('0x5'),util[_0xb3e8('0x6')](_0xb3e8('0x7'),_0x1d1923,_0xa86395,_0x42bda6));var _0x3fbbf3=_0x55d4ae[_0xb3e8('0x8')](_0x515a9a,_0xb3e8('0x9'),_0xb3e8('0xa'));_0x3fbbf3+=_0x55d4ae[_0xb3e8('0xb')](_0xb3e8('0xa'));var _0x408b9f=JSON[_0xb3e8('0xc')](_0x3fbbf3);return _0x408b9f[_0xb3e8('0xd')](_0x2dfb67)?_0x408b9f[_0x2dfb67]:null;}}return null;}function isLimit(_0x5ebdfe,_0xef3a22,_0x2eb9e9,_0x4e23df){var _0x542178=_0xef3a22;return compose()[_0xb3e8('0xe')](function(_0xdbe314,_0xacc78,_0x4587f1){return db[_0xb3e8('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xb3e8('0x10')](function(_0x466009){var _0xefa19d=getValueFromLicense(_0x5ebdfe,_0x466009);return _0xefa19d?_0xefa19d:_0x542178;})['then'](function(_0x9137ea){_0x542178=_0x9137ea;return _0x2eb9e9[_0xb3e8('0x11')](_0x4e23df);})[_0xb3e8('0x10')](function(_0x4b45c2){if(_0x4b45c2>=_0x542178){return _0xacc78[_0xb3e8('0x12')](0x193)[_0xb3e8('0x13')]({'message':util[_0xb3e8('0x6')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x5ebdfe)});}_0x4587f1();})[_0xb3e8('0x14')](function(_0x1fada3){_0x4587f1(_0x1fada3);});});}function isUserLimit(){return isLimit(_0xb3e8('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0xb3e8('0x16')},{'role':_0xb3e8('0x17')}]}});}exports[_0xb3e8('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index a1e2b5c..d83270b 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 _0x96ce=['$endsWith','LIKE\x20?','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','text','CAST(','field','\x20AS\x20','castTo','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith'];(function(_0x57c7f5,_0xe06db6){var _0x2f4768=function(_0x4fe798){while(--_0x4fe798){_0x57c7f5['push'](_0x57c7f5['shift']());}};_0x2f4768(++_0xe06db6);}(_0x96ce,0x176));var _0xe96c=function(_0x820843,_0x4b6f7e){_0x820843=_0x820843-0x0;var _0x2077c2=_0x96ce[_0x820843];return _0x2077c2;};'use strict';var _=require(_0xe96c('0x0'));var moment=require(_0xe96c('0x1'));exports[_0xe96c('0x2')]=function(_0x17a6b7){var _0x90d17c={'conditions':[]};_0x90d17c[_0xe96c('0x3')]=_[_0xe96c('0x4')](_0x17a6b7,_0xe96c('0x5'))?'or':_0xe96c('0x6');var _0x1aede0=_0x17a6b7[_0xe96c('0x7')](_0xe96c('0x8'),'')[_0xe96c('0x7')](_0xe96c('0x5'),'')['split']('||');for(var _0x5f17d7=0x0;_0x5f17d7<_0x1aede0[_0xe96c('0x9')];_0x5f17d7++){var _0x3ce795=_0x1aede0[_0x5f17d7][_0xe96c('0xa')](':=');var _0x15e63e=_0x3ce795[0x0];var _0x527d14=_0x3ce795['slice'](0x1);_0x527d14[_0xe96c('0xb')](function(_0x2802b2){var _0x1625bb=_0x2802b2['split']('[')[_0xe96c('0xc')]();var _0x1d38ed=_0x2802b2[_0xe96c('0xd')](/\[(.*?)\]/g);_0x1d38ed[_0xe96c('0xb')](function(_0x527f23){var _0x58f8e4=_0x527f23[_0xe96c('0xa')]('[')[_0xe96c('0xe')](function(_0x2692c3){return _0x2692c3[_0xe96c('0xf')](']')>-0x1;})[_0xe96c('0x10')](function(_0x11befe){return _0x11befe[_0xe96c('0xa')](']')[0x0];})[0x0];_0x90d17c[_0xe96c('0x11')][_0xe96c('0x12')]({'field':_0x15e63e,'operator':_0x1625bb,'value':_0x58f8e4});});});}return _0x90d17c;};exports[_0xe96c('0x13')]=function(_0x499992,_0x4e9264,_0x59d918){var _0x1bb9e4={};if(_0x4e9264===_0xe96c('0x14')){if(_0x59d918[_0xe96c('0x15')]===_0xe96c('0x16')){_0x59d918['operator']=_0xe96c('0x17');_0x59d918[_0xe96c('0x18')]+=','+_0x59d918[_0xe96c('0x18')];}else if(_[_0xe96c('0x19')]([_0xe96c('0x1a'),_0xe96c('0x1b')],_0x59d918[_0xe96c('0x15')])){_0x59d918[_0xe96c('0x18')]=moment(_0x59d918[_0xe96c('0x18')])['add'](0x1,_0xe96c('0x1c'))[_0xe96c('0x1d')](_0xe96c('0x1e'));}}if(_0x59d918['castTo']){_0x4e9264=_0x59d918['castTo'];_0x1bb9e4[_0xe96c('0x1f')]=_0xe96c('0x20')+_0x499992+'.'+_0x59d918[_0xe96c('0x21')]+_0xe96c('0x22')+_0x59d918[_0xe96c('0x23')]+')\x20'+parseOperator(_0x59d918[_0xe96c('0x15')]);}else{_0x1bb9e4['text']=_0x499992+'.'+_0x59d918[_0xe96c('0x21')]+'\x20'+parseOperator(_0x59d918['operator']);}if(_[_0xe96c('0x19')]([_0xe96c('0x24'),_0xe96c('0x25')],_0x59d918[_0xe96c('0x15')]))_0x1bb9e4['text']='('+_0x1bb9e4[_0xe96c('0x1f')]+_0xe96c('0x26')+_0x499992+'.'+_0x59d918[_0xe96c('0x21')]+_0xe96c('0x27');_0x1bb9e4[_0xe96c('0x18')]=parseValue(_0x4e9264,_0x59d918[_0xe96c('0x15')],_0x59d918[_0xe96c('0x18')]);return _0x1bb9e4;};function parseOperator(_0x4c2502){var _0x43f34e;switch(_0x4c2502){case _0xe96c('0x28'):_0x43f34e='IN\x20?';break;case _0xe96c('0x25'):_0x43f34e=_0xe96c('0x29');break;case'$eq':_0x43f34e=_0xe96c('0x2a');break;case _0xe96c('0x24'):_0x43f34e=_0xe96c('0x2b');break;case _0xe96c('0x2c'):case _0xe96c('0x2d'):case _0xe96c('0x2e'):_0x43f34e=_0xe96c('0x2f');break;case'$lt':_0x43f34e=_0xe96c('0x30');break;case _0xe96c('0x1a'):_0x43f34e=_0xe96c('0x31');break;case _0xe96c('0x1b'):_0x43f34e='<=\x20?';break;case _0xe96c('0x32'):_0x43f34e=_0xe96c('0x33');break;case'$between':_0x43f34e=_0xe96c('0x34');break;}return _0x43f34e;}function parseValue(_0x46f4d9,_0x4cb1b5,_0x43a1ec){var _0x1845ad={'start':undefined,'end':undefined};switch(_0x4cb1b5){case'$in':case _0xe96c('0x25'):_0x1845ad[_0xe96c('0x35')]=_0x43a1ec['split'](',');break;case _0xe96c('0x2c'):_0x1845ad[_0xe96c('0x35')]='%'+_0x43a1ec+'%';break;case _0xe96c('0x2d'):_0x1845ad[_0xe96c('0x35')]=_0x43a1ec+'%';break;case _0xe96c('0x2e'):_0x1845ad[_0xe96c('0x35')]='%'+_0x43a1ec;break;case _0xe96c('0x17'):var _0x1a007a=_0x43a1ec['split'](',');var _0x43a1ec=_0x1a007a[_0xe96c('0xc')]();var _0x18873a=_0x1a007a[_0xe96c('0x36')]();if(_0x46f4d9===_0xe96c('0x14')){_0x43a1ec=moment(_0x43a1ec)[_0xe96c('0x37')](0x0,!![])['format']();_0x18873a=moment(_0x18873a)[_0xe96c('0x37')](0x0,!![])['add'](0x17,_0xe96c('0x38'))[_0xe96c('0x39')](0x3b,_0xe96c('0x3a'))['add'](0x3b,_0xe96c('0x3b'))['format']();}_0x1845ad={'start':_0x43a1ec,'end':_0x18873a};break;default:_0x1845ad[_0xe96c('0x35')]=_0x43a1ec;break;}return _0x1845ad;} \ No newline at end of file +var _0x76fe=['$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','seconds','lodash','moment','sqlOperator','startsWith','[$or]','replace','split','forEach','shift','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','<>\x20?','$substring','$startsWith'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x76fe,0x13e));var _0xe76f=function(_0x5938c8,_0x4a9ca){_0x5938c8=_0x5938c8-0x0;var _0x4353f7=_0x76fe[_0x5938c8];return _0x4353f7;};'use strict';var _=require(_0xe76f('0x0'));var moment=require(_0xe76f('0x1'));exports['parseSearch']=function(_0x971d1c){var _0x483412={'conditions':[]};_0x483412[_0xe76f('0x2')]=_[_0xe76f('0x3')](_0x971d1c,_0xe76f('0x4'))?'or':'and';var _0x202c34=_0x971d1c[_0xe76f('0x5')]('[$and]','')['replace']('[$or]','')[_0xe76f('0x6')]('||');for(var _0x8b85ad=0x0;_0x8b85ad<_0x202c34['length'];_0x8b85ad++){var _0x24ecef=_0x202c34[_0x8b85ad][_0xe76f('0x6')](':=');var _0x46091e=_0x24ecef[0x0];var _0x5a002e=_0x24ecef['slice'](0x1);_0x5a002e[_0xe76f('0x7')](function(_0xc2d67d){var _0x41d001=_0xc2d67d[_0xe76f('0x6')]('[')[_0xe76f('0x8')]();var _0x1ad402=_0xc2d67d['match'](/\[(.*?)\]/g);_0x1ad402[_0xe76f('0x7')](function(_0x2f0139){var _0xb16b0b=_0x2f0139[_0xe76f('0x6')]('[')[_0xe76f('0x9')](function(_0xefaa82){return _0xefaa82[_0xe76f('0xa')](']')>-0x1;})[_0xe76f('0xb')](function(_0x432bfa){return _0x432bfa['split'](']')[0x0];})[0x0];_0x483412[_0xe76f('0xc')][_0xe76f('0xd')]({'field':_0x46091e,'operator':_0x41d001,'value':_0xb16b0b});});});}return _0x483412;};exports[_0xe76f('0xe')]=function(_0x21bb04,_0x37485f,_0x71b1d0){var _0x1a2565={};if(_0x37485f===_0xe76f('0xf')){if(_0x71b1d0[_0xe76f('0x10')]===_0xe76f('0x11')){_0x71b1d0[_0xe76f('0x10')]=_0xe76f('0x12');_0x71b1d0[_0xe76f('0x13')]+=','+_0x71b1d0[_0xe76f('0x13')];}else if(_['includes']([_0xe76f('0x14'),_0xe76f('0x15')],_0x71b1d0[_0xe76f('0x10')])){_0x71b1d0[_0xe76f('0x13')]=moment(_0x71b1d0[_0xe76f('0x13')])[_0xe76f('0x16')](0x1,_0xe76f('0x17'))[_0xe76f('0x18')](_0xe76f('0x19'));}}if(_0x71b1d0['castTo']){_0x37485f=_0x71b1d0[_0xe76f('0x1a')];_0x1a2565[_0xe76f('0x1b')]=_0xe76f('0x1c')+_0x21bb04+'.'+_0x71b1d0[_0xe76f('0x1d')]+'\x20AS\x20'+_0x71b1d0[_0xe76f('0x1a')]+')\x20'+parseOperator(_0x71b1d0[_0xe76f('0x10')]);}else{_0x1a2565['text']=_0x21bb04+'.'+_0x71b1d0[_0xe76f('0x1d')]+'\x20'+parseOperator(_0x71b1d0[_0xe76f('0x10')]);}if(_['includes']([_0xe76f('0x1e'),_0xe76f('0x1f')],_0x71b1d0[_0xe76f('0x10')]))_0x1a2565[_0xe76f('0x1b')]='('+_0x1a2565[_0xe76f('0x1b')]+_0xe76f('0x20')+_0x21bb04+'.'+_0x71b1d0[_0xe76f('0x1d')]+_0xe76f('0x21');_0x1a2565[_0xe76f('0x13')]=parseValue(_0x37485f,_0x71b1d0[_0xe76f('0x10')],_0x71b1d0[_0xe76f('0x13')]);return _0x1a2565;};function parseOperator(_0x428796){var _0x3dbd22;switch(_0x428796){case _0xe76f('0x22'):_0x3dbd22=_0xe76f('0x23');break;case _0xe76f('0x1f'):_0x3dbd22='NOT\x20IN\x20?';break;case _0xe76f('0x11'):_0x3dbd22='=\x20?';break;case _0xe76f('0x1e'):_0x3dbd22=_0xe76f('0x24');break;case _0xe76f('0x25'):case _0xe76f('0x26'):case _0xe76f('0x27'):_0x3dbd22=_0xe76f('0x28');break;case _0xe76f('0x29'):_0x3dbd22=_0xe76f('0x2a');break;case'$gt':_0x3dbd22='>\x20?';break;case _0xe76f('0x15'):_0x3dbd22=_0xe76f('0x2b');break;case _0xe76f('0x2c'):_0x3dbd22=_0xe76f('0x2d');break;case'$between':_0x3dbd22=_0xe76f('0x2e');break;}return _0x3dbd22;}function parseValue(_0xb9c5bd,_0x51957d,_0x440a0e){var _0x24b110={'start':undefined,'end':undefined};switch(_0x51957d){case _0xe76f('0x22'):case _0xe76f('0x1f'):_0x24b110[_0xe76f('0x2f')]=_0x440a0e[_0xe76f('0x6')](',');break;case _0xe76f('0x25'):_0x24b110[_0xe76f('0x2f')]='%'+_0x440a0e+'%';break;case _0xe76f('0x26'):_0x24b110[_0xe76f('0x2f')]=_0x440a0e+'%';break;case _0xe76f('0x27'):_0x24b110['start']='%'+_0x440a0e;break;case'$between':var _0x324d92=_0x440a0e['split'](',');var _0x440a0e=_0x324d92['shift']();var _0x4c723d=_0x324d92[_0xe76f('0x30')]();if(_0xb9c5bd==='DATE'){_0x440a0e=moment(_0x440a0e)[_0xe76f('0x31')](0x0,!![])[_0xe76f('0x18')]();_0x4c723d=moment(_0x4c723d)[_0xe76f('0x31')](0x0,!![])['add'](0x17,'hours')[_0xe76f('0x16')](0x3b,'minutes')[_0xe76f('0x16')](0x3b,_0xe76f('0x32'))[_0xe76f('0x18')]();}_0x24b110={'start':_0x440a0e,'end':_0x4c723d};break;default:_0x24b110['start']=_0x440a0e;break;}return _0x24b110;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index fc3f604..43195e6 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 _0xc928=['isNumeric','match','isEmail','\x22{EXPR}\x22','{EXPR}','forEach','replace','join','query','$id','intersection','attributes','nolimit','where','filter','object','includes','columns','value','merge','map','type','lower','options','push','include','lodash','sequelize','moment','../../mysqldb','keys','parse','model','alias','fields','raw','split','filters','isEmpty','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isObject','isString','hasOwnProperty'];(function(_0xd3fbff,_0x37d108){var _0x48dc7b=function(_0x1562c5){while(--_0x1562c5){_0xd3fbff['push'](_0xd3fbff['shift']());}};_0x48dc7b(++_0x37d108);}(_0xc928,0xe0));var _0x8c92=function(_0x3545e5,_0x2a2f9c){_0x3545e5=_0x3545e5-0x0;var _0xc2264a=_0xc928[_0x3545e5];return _0xc2264a;};'use strict';var _=require(_0x8c92('0x0'));var sequelize=require(_0x8c92('0x1'));var moment=require(_0x8c92('0x2'));var db=require(_0x8c92('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x15d6ed){var _0xcb9f8=['ne'];try{var _0x414322=JSON['parse'](_0x15d6ed);var _0x2e3aeb=Object[_0x8c92('0x4')](_0x414322)[0x0];return _0xcb9f8['includes'](_0x2e3aeb);}catch(_0x3beb2b){return![];}}function getOperatorValue(_0x142f69){var _0x45d083=JSON[_0x8c92('0x5')](_0x142f69);var _0x30d3c1=Object[_0x8c92('0x4')](_0x45d083)[0x0];var _0x3b1cb7=_0x45d083[_0x30d3c1];return{['$'+_0x30d3c1]:_0x3b1cb7};}function parseIncludeModel(_0x598007){var _0xb7172f=JSON['parse'](_0x598007);return{'model':db[_0xb7172f[_0x8c92('0x6')]],'as':_0xb7172f[_0x8c92('0x7')],'attributes':_0xb7172f[_0x8c92('0x8')],'raw':_0xb7172f[_0x8c92('0x9')]};}exports[_0x8c92('0x8')]=function(_0x1e9b87){var _0x45eb73=null;if(_0x1e9b87){_0x45eb73=_0x1e9b87[_0x8c92('0xa')](',');}return _0x45eb73;};exports[_0x8c92('0xb')]=function(_0x52ca68,_0x2c0e68){var _0x39892f={};if(!_[_0x8c92('0xc')](_0x52ca68)){_['forOwn'](_0x52ca68,function(_0x5102a2,_0x4727b3){try{if(_0x2c0e68){var _0x52ff26=_['find'](_0x2c0e68,{'name':_0x4727b3})||{};if(hasSequelizeOperator(_0x5102a2)){_0x39892f[_0x4727b3]=getOperatorValue(_0x5102a2);}else if(_0x52ff26['type']===_0x8c92('0xd')&&_[_0x8c92('0xe')](_0x5102a2)){var _0x4b7dbd=JSON[_0x8c92('0x5')](_0x5102a2);var _0xcc962e={'$gte':moment(moment(_0x4b7dbd[_0x8c92('0xf')])['format'](_0x8c92('0x10')))[_0x8c92('0x11')]()[_0x8c92('0x12')](),'$lte':moment(moment(_0x4b7dbd[_0x8c92('0x13')])[_0x8c92('0x12')](_0x8c92('0x10')))[_0x8c92('0x11')]()[_0x8c92('0x14')](0x1,'s')[_0x8c92('0x12')]()};_0x39892f[_0x4727b3]=_0xcc962e;}else if(_0x52ff26[_0x8c92('0x15')]===_0x8c92('0x16')){_0x39892f[_0x4727b3]=_0x5102a2;}else{_0x39892f[_0x4727b3]=_[_0x8c92('0x17')](_0x5102a2)?_0x5102a2:JSON['parse'](_0x5102a2);}}else{_0x39892f[_0x4727b3]=_[_0x8c92('0x17')](_0x5102a2)?_0x5102a2:JSON['parse'](_0x5102a2);}}catch(_0x581f82){_0x39892f[_0x4727b3]=_0x5102a2['split'](',');}});}return _0x39892f;};exports[_0x8c92('0x18')]=function(_0x37eb16){_0x37eb16=parseInt(_0x37eb16,0xa);if(!_0x37eb16||_0x37eb16<0x0){_0x37eb16=LIMIT_VALUE;}return _0x37eb16;};exports[_0x8c92('0x19')]=function(_0x4340bf){_0x4340bf=parseInt(_0x4340bf,0xa);if(!_0x4340bf||_0x4340bf<0x0){_0x4340bf=0x0;}return _0x4340bf;};exports[_0x8c92('0x1a')]=function(_0x172e85){var _0x54cb5b,_0xe55c41=null;if(_0x172e85){_0x54cb5b=_0x172e85[_0x8c92('0xa')](',');_0xe55c41=_['map'](_0x54cb5b,function(_0x40b252){if(_0x40b252[_0x8c92('0x1b')]('-')===0x0){return[_0x40b252===_0x8c92('0x1c')?sequelize['cast'](sequelize[_0x8c92('0x1d')](_0x8c92('0x1c')),_0x8c92('0x1e')):_0x40b252[_0x8c92('0x1f')](0x1),_0x8c92('0x20')];}else{return[_0x40b252===_0x8c92('0x1c')?sequelize[_0x8c92('0x21')](sequelize['col'](_0x8c92('0x1c')),_0x8c92('0x1e')):_0x40b252,_0x8c92('0x22')];}});}return _0xe55c41;};exports[_0x8c92('0x23')]=function(_0x1bc261,_0x10aa04){if(_[_0x8c92('0xc')](_0x1bc261)){return _0x1bc261;}if(_[_0x8c92('0x17')](_0x1bc261)){for(var _0x26a969=0x0;_0x26a969<_0x1bc261[_0x8c92('0x24')];_0x26a969+=0x1){_0x1bc261[_0x26a969]=this['omit'](_0x1bc261[_0x26a969],_0x10aa04);}return _0x1bc261;}if(!_[_0x8c92('0x25')](_0x1bc261)){return _0x1bc261;}if(_[_0x8c92('0x26')](_0x10aa04)){_0x10aa04=[_0x10aa04];}if(!_[_0x8c92('0x17')](_0x10aa04)){return _0x1bc261;}for(var _0x26e005=0x0;_0x26e005<_0x10aa04[_0x8c92('0x24')];_0x26e005+=0x1){_['unset'](_0x1bc261,_0x10aa04[_0x26e005]);}for(var _0x245165 in _0x1bc261){if(_0x1bc261[_0x8c92('0x27')](_0x245165)){_0x1bc261[_0x245165]=this[_0x8c92('0x23')](_0x1bc261[_0x245165],_0x10aa04);}}return _0x1bc261;};exports[_0x8c92('0x28')]=function(_0x472d9e){return _0x472d9e[_0x8c92('0x29')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x8c92('0x2a')]=function(_0x558e60){return _0x558e60[_0x8c92('0x29')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x2291c4,_0x4ed69d){var _0x55893b=[];var _0x1da4f2=/[ `!@#$%^&*()_\-?~]/;var _0x10136a=_0x4ed69d?_0x8c92('0x2b'):_0x8c92('0x2c');_0x2291c4[_0x8c92('0xa')](/[ ,]+/)[_0x8c92('0x2d')](function(_0x57d75b){_0x57d75b=_0x57d75b[_0x8c92('0x2e')](/([^:]")"+/g,'$1');_0x57d75b='+'+_0x57d75b+'*';var _0x17bbd6=_0x57d75b[_0x8c92('0x29')](_0x1da4f2);if(_0x17bbd6){_0x57d75b='\x22'+_0x57d75b+'\x22';}_0x55893b['push'](_0x57d75b);});_0x10136a=_0x10136a['replace'](_0x8c92('0x2c'),_0x55893b[_0x8c92('0x2f')]('\x20'));return _0x10136a;};exports['getOptions']=function(_0x3ded1c,_0x149b78,_0x576d3e){var _0x363db6={},_0x2b2749={};if(_0x149b78[_0x8c92('0x30')][_0x8c92('0x31')]){_0x149b78[_0x8c92('0x30')]['id']=_0x149b78[_0x8c92('0x30')]['$id'];delete _0x149b78[_0x8c92('0x30')][_0x8c92('0x31')];}_0x363db6[_0x8c92('0x6')]=_['map'](_0x3ded1c,_0x8c92('0x15'));_0x363db6[_0x8c92('0x30')]=_[_0x8c92('0x4')](_0x149b78['query']);_0x363db6[_0x8c92('0xb')]=_[_0x8c92('0x32')](_0x363db6[_0x8c92('0x6')],_0x363db6[_0x8c92('0x30')]);_0x2b2749['attributes']=_[_0x8c92('0x32')](_0x363db6[_0x8c92('0x6')],this[_0x8c92('0x8')](_0x149b78[_0x8c92('0x30')][_0x8c92('0x8')]));_0x2b2749[_0x8c92('0x33')]=_0x2b2749[_0x8c92('0x33')][_0x8c92('0x24')]?_0x2b2749[_0x8c92('0x33')]:_0x363db6['model'];if(!_0x149b78[_0x8c92('0x30')]['hasOwnProperty'](_0x8c92('0x34'))){_0x2b2749[_0x8c92('0x18')]=this[_0x8c92('0x18')](_0x149b78[_0x8c92('0x30')][_0x8c92('0x18')]);_0x2b2749[_0x8c92('0x19')]=this[_0x8c92('0x19')](_0x149b78[_0x8c92('0x30')][_0x8c92('0x19')]);}_0x2b2749['order']=this[_0x8c92('0x1a')](_0x149b78[_0x8c92('0x30')][_0x8c92('0x1a')]);_0x2b2749[_0x8c92('0x35')]=this[_0x8c92('0xb')](_['pick'](_0x149b78[_0x8c92('0x30')],_0x363db6[_0x8c92('0xb')]),_0x3ded1c);if(_0x149b78['query'][_0x8c92('0x36')]){var _0x439733=_0x3ded1c;var _0x2f9e7d=_0x149b78[_0x8c92('0x30')][_0x8c92('0x36')];if(typeof _0x2f9e7d===_0x8c92('0x37')){_0x439733=_[_0x8c92('0x36')](_0x3ded1c,function(_0x4e65df){return _[_0x8c92('0x38')](_0x2f9e7d[_0x8c92('0x39')],_0x4e65df['name']);});_0x2f9e7d=_0x2f9e7d[_0x8c92('0x3a')];}_0x2b2749[_0x8c92('0x35')]=_[_0x8c92('0x3b')](_0x2b2749[_0x8c92('0x35')],{'$or':_[_0x8c92('0x3c')](_0x439733,function(_0x15c5c7){if(_0x15c5c7[_0x8c92('0x3d')]!=='VIRTUAL'){if(_0x576d3e){return sequelize[_0x8c92('0x35')](sequelize['fn'](_0x8c92('0x3e'),sequelize[_0x8c92('0x1d')](_0x15c5c7[_0x8c92('0x15')])),{'$like':sequelize['fn'](_0x8c92('0x3e'),'%'+_0x149b78[_0x8c92('0x30')][_0x8c92('0x36')]+'%')});}else{var _0x53d10d={};_0x53d10d[_0x15c5c7[_0x8c92('0x15')]]={'$like':'%'+_0x149b78['query']['filter']+'%'};return _0x53d10d;}}})});}_0x2b2749=_[_0x8c92('0x3b')]({},_0x2b2749,_0x149b78[_0x8c92('0x3f')]);return _0x2b2749;};exports['include']=function(_0x277dd7){var _0x16cc2b=[];if(_0x277dd7['includeAll']){_0x16cc2b[_0x8c92('0x40')]({'all':!![]});}else if(_0x277dd7['include']){if(Array[_0x8c92('0x17')](_0x277dd7[_0x8c92('0x41')])){_0x16cc2b=Object[_0x8c92('0x4')](_0x277dd7[_0x8c92('0x41')])[_0x8c92('0x3c')](function(_0x424861){return parseIncludeModel(_0x277dd7['include'][_0x424861]);});}else{var _0xf7cf0d=parseIncludeModel(_0x277dd7[_0x8c92('0x41')]);_0x16cc2b[_0x8c92('0x40')](_0xf7cf0d);}}return _0x16cc2b;}; \ No newline at end of file +var _0x2b83=['isEmail','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','{EXPR}','join','getOptions','$id','query','map','name','intersection','model','attributes','nolimit','order','where','filter','object','columns','merge','lower','options','include','sequelize','moment','keys','includes','parse','fields','split','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','isArray','limit','offset','sort','priority','col','unsigned','substr','DESC','cast','ASC','omit','isEmpty','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$'];(function(_0x196871,_0x46d5b1){var _0x251a31=function(_0x2d94eb){while(--_0x2d94eb){_0x196871['push'](_0x196871['shift']());}};_0x251a31(++_0x46d5b1);}(_0x2b83,0x1d3));var _0x32b8=function(_0x4bdc34,_0x5dcfe2){_0x4bdc34=_0x4bdc34-0x0;var _0x108d87=_0x2b83[_0x4bdc34];return _0x108d87;};'use strict';var _=require('lodash');var sequelize=require(_0x32b8('0x0'));var moment=require(_0x32b8('0x1'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3fcbdc){var _0x287f16=['ne'];try{var _0x304105=JSON['parse'](_0x3fcbdc);var _0x51d3b4=Object[_0x32b8('0x2')](_0x304105)[0x0];return _0x287f16[_0x32b8('0x3')](_0x51d3b4);}catch(_0x58ecbf){return![];}}function getOperatorValue(_0x6bbc3d){var _0x55abd0=JSON[_0x32b8('0x4')](_0x6bbc3d);var _0x342a03=Object[_0x32b8('0x2')](_0x55abd0)[0x0];var _0x10a967=_0x55abd0[_0x342a03];return{['$'+_0x342a03]:_0x10a967};}function parseIncludeModel(_0x5cc6b2){var _0x46be90=JSON[_0x32b8('0x4')](_0x5cc6b2);return{'model':db[_0x46be90['model']],'as':_0x46be90['alias'],'attributes':_0x46be90[_0x32b8('0x5')],'raw':_0x46be90['raw']};}exports[_0x32b8('0x5')]=function(_0x31b795){var _0x465672=null;if(_0x31b795){_0x465672=_0x31b795[_0x32b8('0x6')](',');}return _0x465672;};exports['filters']=function(_0xd52d3e,_0x3b6bc6){var _0x5725d2={};if(!_['isEmpty'](_0xd52d3e)){_[_0x32b8('0x7')](_0xd52d3e,function(_0x5a0ef2,_0x41594c){try{if(_0x3b6bc6){var _0x4b838f=_[_0x32b8('0x8')](_0x3b6bc6,{'name':_0x41594c})||{};if(hasSequelizeOperator(_0x5a0ef2)){_0x5725d2[_0x41594c]=getOperatorValue(_0x5a0ef2);}else if(_0x4b838f[_0x32b8('0x9')]===_0x32b8('0xa')&&_[_0x32b8('0xb')](_0x5a0ef2)){var _0x2645b0=JSON['parse'](_0x5a0ef2);var _0x4c8fc9={'$gte':moment(moment(_0x2645b0[_0x32b8('0xc')])['format']('YYYY-MM-DD'))['utc']()[_0x32b8('0xd')](),'$lte':moment(moment(_0x2645b0['$lte'])['format'](_0x32b8('0xe')))[_0x32b8('0xf')]()[_0x32b8('0x10')](0x1,'s')[_0x32b8('0xd')]()};_0x5725d2[_0x41594c]=_0x4c8fc9;}else if(_0x4b838f['name']==='uniqueid'){_0x5725d2[_0x41594c]=_0x5a0ef2;}else{_0x5725d2[_0x41594c]=_['isArray'](_0x5a0ef2)?_0x5a0ef2:JSON[_0x32b8('0x4')](_0x5a0ef2);}}else{_0x5725d2[_0x41594c]=_[_0x32b8('0x11')](_0x5a0ef2)?_0x5a0ef2:JSON[_0x32b8('0x4')](_0x5a0ef2);}}catch(_0x445da1){_0x5725d2[_0x41594c]=_0x5a0ef2['split'](',');}});}return _0x5725d2;};exports[_0x32b8('0x12')]=function(_0x3ddc5f){_0x3ddc5f=parseInt(_0x3ddc5f,0xa);if(!_0x3ddc5f||_0x3ddc5f<0x0){_0x3ddc5f=LIMIT_VALUE;}return _0x3ddc5f;};exports[_0x32b8('0x13')]=function(_0x39a4f1){_0x39a4f1=parseInt(_0x39a4f1,0xa);if(!_0x39a4f1||_0x39a4f1<0x0){_0x39a4f1=0x0;}return _0x39a4f1;};exports[_0x32b8('0x14')]=function(_0xde1a5a){var _0x222c77,_0xcd4b26=null;if(_0xde1a5a){_0x222c77=_0xde1a5a['split'](',');_0xcd4b26=_['map'](_0x222c77,function(_0xbbdb27){if(_0xbbdb27['indexOf']('-')===0x0){return[_0xbbdb27===_0x32b8('0x15')?sequelize['cast'](sequelize[_0x32b8('0x16')](_0x32b8('0x15')),_0x32b8('0x17')):_0xbbdb27[_0x32b8('0x18')](0x1),_0x32b8('0x19')];}else{return[_0xbbdb27==='priority'?sequelize[_0x32b8('0x1a')](sequelize[_0x32b8('0x16')](_0x32b8('0x15')),_0x32b8('0x17')):_0xbbdb27,_0x32b8('0x1b')];}});}return _0xcd4b26;};exports[_0x32b8('0x1c')]=function(_0x57a6a3,_0x4022f7){if(_[_0x32b8('0x1d')](_0x57a6a3)){return _0x57a6a3;}if(_[_0x32b8('0x11')](_0x57a6a3)){for(var _0x3e1598=0x0;_0x3e1598<_0x57a6a3[_0x32b8('0x1e')];_0x3e1598+=0x1){_0x57a6a3[_0x3e1598]=this[_0x32b8('0x1c')](_0x57a6a3[_0x3e1598],_0x4022f7);}return _0x57a6a3;}if(!_[_0x32b8('0x1f')](_0x57a6a3)){return _0x57a6a3;}if(_[_0x32b8('0x20')](_0x4022f7)){_0x4022f7=[_0x4022f7];}if(!_[_0x32b8('0x11')](_0x4022f7)){return _0x57a6a3;}for(var _0xa225ec=0x0;_0xa225ec<_0x4022f7[_0x32b8('0x1e')];_0xa225ec+=0x1){_[_0x32b8('0x21')](_0x57a6a3,_0x4022f7[_0xa225ec]);}for(var _0x1fcba2 in _0x57a6a3){if(_0x57a6a3['hasOwnProperty'](_0x1fcba2)){_0x57a6a3[_0x1fcba2]=this[_0x32b8('0x1c')](_0x57a6a3[_0x1fcba2],_0x4022f7);}}return _0x57a6a3;};exports[_0x32b8('0x22')]=function(_0x383b0e){return _0x383b0e[_0x32b8('0x23')](RegExp(_0x32b8('0x24')))?!![]:![];};exports[_0x32b8('0x25')]=function(_0x85d4d3){return _0x85d4d3[_0x32b8('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x32b8('0x26')]=function(_0x15f152,_0x521bf4){var _0x1833af=[];var _0x3c1122=/[ `!@#$%^&*()_\-?~]/;var _0x44b38a=_0x521bf4?_0x32b8('0x27'):'{EXPR}';_0x15f152['split'](/[ ,]+/)[_0x32b8('0x28')](function(_0x431b59){_0x431b59=_0x431b59[_0x32b8('0x29')](/([^:]")"+/g,'$1');_0x431b59='+'+_0x431b59+'*';var _0x12ff7d=_0x431b59['match'](_0x3c1122);if(_0x12ff7d){_0x431b59='\x22'+_0x431b59+'\x22';}_0x1833af[_0x32b8('0x2a')](_0x431b59);});_0x44b38a=_0x44b38a[_0x32b8('0x29')](_0x32b8('0x2b'),_0x1833af[_0x32b8('0x2c')]('\x20'));return _0x44b38a;};exports[_0x32b8('0x2d')]=function(_0x399980,_0x2ffbcd,_0x22bdaf){var _0x591ba8={},_0x10f17e={};if(_0x2ffbcd['query'][_0x32b8('0x2e')]){_0x2ffbcd[_0x32b8('0x2f')]['id']=_0x2ffbcd[_0x32b8('0x2f')][_0x32b8('0x2e')];delete _0x2ffbcd[_0x32b8('0x2f')][_0x32b8('0x2e')];}_0x591ba8['model']=_[_0x32b8('0x30')](_0x399980,_0x32b8('0x31'));_0x591ba8[_0x32b8('0x2f')]=_['keys'](_0x2ffbcd[_0x32b8('0x2f')]);_0x591ba8['filters']=_[_0x32b8('0x32')](_0x591ba8[_0x32b8('0x33')],_0x591ba8[_0x32b8('0x2f')]);_0x10f17e[_0x32b8('0x34')]=_['intersection'](_0x591ba8[_0x32b8('0x33')],this[_0x32b8('0x5')](_0x2ffbcd[_0x32b8('0x2f')]['fields']));_0x10f17e['attributes']=_0x10f17e[_0x32b8('0x34')][_0x32b8('0x1e')]?_0x10f17e[_0x32b8('0x34')]:_0x591ba8['model'];if(!_0x2ffbcd['query']['hasOwnProperty'](_0x32b8('0x35'))){_0x10f17e[_0x32b8('0x12')]=this[_0x32b8('0x12')](_0x2ffbcd['query'][_0x32b8('0x12')]);_0x10f17e[_0x32b8('0x13')]=this[_0x32b8('0x13')](_0x2ffbcd[_0x32b8('0x2f')][_0x32b8('0x13')]);}_0x10f17e[_0x32b8('0x36')]=this[_0x32b8('0x14')](_0x2ffbcd[_0x32b8('0x2f')]['sort']);_0x10f17e[_0x32b8('0x37')]=this['filters'](_['pick'](_0x2ffbcd['query'],_0x591ba8['filters']),_0x399980);if(_0x2ffbcd[_0x32b8('0x2f')]['filter']){var _0x2a3968=_0x399980;var _0x52709b=_0x2ffbcd['query'][_0x32b8('0x38')];if(typeof _0x52709b===_0x32b8('0x39')){_0x2a3968=_[_0x32b8('0x38')](_0x399980,function(_0x5caaba){return _[_0x32b8('0x3')](_0x52709b[_0x32b8('0x3a')],_0x5caaba[_0x32b8('0x31')]);});_0x52709b=_0x52709b['value'];}_0x10f17e['where']=_[_0x32b8('0x3b')](_0x10f17e['where'],{'$or':_[_0x32b8('0x30')](_0x2a3968,function(_0x502205){if(_0x502205[_0x32b8('0x9')]!=='VIRTUAL'){if(_0x22bdaf){return sequelize[_0x32b8('0x37')](sequelize['fn'](_0x32b8('0x3c'),sequelize[_0x32b8('0x16')](_0x502205[_0x32b8('0x31')])),{'$like':sequelize['fn']('lower','%'+_0x2ffbcd['query'][_0x32b8('0x38')]+'%')});}else{var _0x14a4e6={};_0x14a4e6[_0x502205[_0x32b8('0x31')]]={'$like':'%'+_0x2ffbcd['query']['filter']+'%'};return _0x14a4e6;}}})});}_0x10f17e=_[_0x32b8('0x3b')]({},_0x10f17e,_0x2ffbcd[_0x32b8('0x3d')]);return _0x10f17e;};exports['include']=function(_0x2b0a80){var _0x582998=[];if(_0x2b0a80['includeAll']){_0x582998['push']({'all':!![]});}else if(_0x2b0a80[_0x32b8('0x3e')]){if(Array[_0x32b8('0x11')](_0x2b0a80[_0x32b8('0x3e')])){_0x582998=Object[_0x32b8('0x2')](_0x2b0a80['include'])[_0x32b8('0x30')](function(_0x447c55){return parseIncludeModel(_0x2b0a80[_0x32b8('0x3e')][_0x447c55]);});}else{var _0x29a413=parseIncludeModel(_0x2b0a80[_0x32b8('0x3e')]);_0x582998[_0x32b8('0x2a')](_0x29a413);}}return _0x582998;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 9d11be2..ebc62a0 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 _0x4f81=['role','mailStatusTime','mailCapacity','whatsappCurrentCapacity','destconnectedlinenum','onhold','screenrecording','getRealtimeAgentsQueryFields','../../mysqldb','http','client','chatPause','mailPause','smsPause','voicePause','every','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','getRealtimeAgents','getAgentStatus','startCase','Queue','map','findOne','all','flatten','uniq','value','filter','includes','busy','resolve','findAll','name','faxPause','find','globalStatus','getSortedAgentsIdsByStatus','order','startsWith','fullname,internal','fullname','internal','substring','indexOf','validateSortParameter','sort','pauseType','toLowerCase','DESC','sortAgentsByStatus','userpic','online','lastPauseAt','openchannelPause','chatCapacity','openchannelCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','whatsappPause','filterAgentAttributes'];(function(_0x3f6a5d,_0x20f67f){var _0x25367d=function(_0xcf5dba){while(--_0xcf5dba){_0x3f6a5d['push'](_0x3f6a5d['shift']());}};_0x25367d(++_0x20f67f);}(_0x4f81,0x1e3));var _0x14f8=function(_0x3c206a,_0x2e3da4){_0x3c206a=_0x3c206a-0x0;var _0x1e42a9=_0x4f81[_0x3c206a];return _0x1e42a9;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var db=require(_0x14f8('0x0'))['db'];var amiClient=jayson['client'][_0x14f8('0x1')]({'port':0x232a});var routingClient=jayson[_0x14f8('0x2')][_0x14f8('0x1')]({'port':0x232c});function isAgentPaused(_0x5c7891,_0x320726){var _0x146c12=[_0x5c7891[_0x14f8('0x3')],_0x5c7891['faxPause'],_0x5c7891[_0x14f8('0x4')],_0x5c7891['openchannelPause'],_0x5c7891[_0x14f8('0x5')],_0x5c7891[_0x14f8('0x6')],_0x5c7891['whatsappPause']];if(!_0x320726)return _[_0x14f8('0x7')](_0x146c12);var _0x4169c3=_['filter'](_0x146c12);return _0x4169c3[_0x14f8('0x8')]>0x0&&_0x4169c3['length']<_0x146c12['length']?!![]:![];}function isIdle(_0x19a1d0){return _0x19a1d0===_0x14f8('0x9')||_0x19a1d0===_0x14f8('0xa')||_0x19a1d0===_0x14f8('0xb')||_0x19a1d0===_0x14f8('0xc')||_[_0x14f8('0xd')](_0x19a1d0);}function isAgentIdle(_0x1fa3e8){if(_0x1fa3e8[_0x14f8('0xe')]!==_0x14f8('0x9')&&_0x1fa3e8[_0x14f8('0x6')]){_0x1fa3e8[_0x14f8('0xe')]=_0x14f8('0xf');return![];}return _['every']([_0x1fa3e8[_0x14f8('0x10')],_0x1fa3e8[_0x14f8('0x11')],_0x1fa3e8[_0x14f8('0x12')],_0x1fa3e8[_0x14f8('0x13')],_0x1fa3e8[_0x14f8('0x14')],_0x1fa3e8[_0x14f8('0xe')],_0x1fa3e8[_0x14f8('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x14f8('0x16')](_0x14f8('0x17'),{})[_0x14f8('0x18')](function(_0x57e917){if(_0x57e917[_0x14f8('0x19')]){throw new Error(_0x14f8('0x1a'));}var _0x463944=_0x57e917[_0x14f8('0x1b')];return routingClient[_0x14f8('0x16')](_0x14f8('0x17'),{})[_0x14f8('0x18')](function(_0x4a1a90){if(_0x4a1a90[_0x14f8('0x19')]){throw new Error(_0x14f8('0x1c'));}var _0x4c9dc9=_0x4a1a90['result'];return _['merge']({},_0x463944,_0x4c9dc9);});})[_0x14f8('0x1d')](function(_0x471a81){throw _0x471a81;});}exports[_0x14f8('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x5225c0){var _0x476c1c=_0x14f8('0xa');if(isAgentPaused(_0x5225c0))_0x476c1c=_0x14f8('0xf');else if(isAgentPaused(_0x5225c0,!![]))_0x476c1c='*pause';else if(isAgentIdle(_0x5225c0))_0x476c1c=_0x14f8('0x9');else _0x476c1c='busy';return _0x476c1c;}exports[_0x14f8('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x14fa31,_0x4bfacd){var _0x575a23=_['isArray'](_0x14fa31)?_0x14fa31:[_0x14fa31];var _0x4a471c=_[_0x14f8('0x20')](_0x4bfacd)+_0x14f8('0x21');var _0x15995a=_[_0x14f8('0x22')](_0x575a23,function(_0x12122d){return db[_0x4a471c][_0x14f8('0x23')]({'where':{'id':_0x12122d}})['then'](function(_0x4193a2){if(!_0x4193a2)return[];return _0x4193a2['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x14f8('0x24')](_0x15995a)[_0x14f8('0x18')](function(_0x1e938b){var _0x52fe4d=_(_0x1e938b)[_0x14f8('0x25')]()['map']('id')[_0x14f8('0x26')]()[_0x14f8('0x27')]();return _0x52fe4d;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1ccbb5,_0xbe6007,_0x344d39){try{if(_0xbe6007['length']>0x0){_0x1ccbb5=_0x1ccbb5[_0x14f8('0x28')](function(_0x43bb3d){return _0xbe6007[_0x14f8('0x29')](_0x43bb3d['id']);});}var _0x58ba3b=_0x1ccbb5[_0x14f8('0x28')](function(_0x2ae3ed){var _0x28cc4a=_0x14f8('0x2a');if(isAgentIdle(_0x2ae3ed)){_0x28cc4a=_0x14f8('0x9');}return _0x28cc4a===_0x344d39;});return _[_0x14f8('0x22')](_0x58ba3b,'id');}catch(_0x21a482){throw _0x21a482;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xdb42ff,_0x56d271,_0x5afec9){return Promise[_0x14f8('0x2b')]()['then'](function(){if(_0x56d271[_0x14f8('0x8')]>0x0){_0xdb42ff=_0xdb42ff[_0x14f8('0x28')](function(_0x320ead){return _0x56d271[_0x14f8('0x29')](_0x320ead['id']);});}return _0xdb42ff;})[_0x14f8('0x18')](function(){return db['User'][_0x14f8('0x2c')]({'attributes':['id',_0x14f8('0x2d'),'fullname','chatPause',_0x14f8('0x2e'),_0x14f8('0x4'),'openchannelPause',_0x14f8('0x5'),'voicePause','whatsappPause','pauseType'],'where':{'id':{'$in':_[_0x14f8('0x22')](_0xdb42ff,'id')}},'raw':!![]});})[_0x14f8('0x18')](function(_0x1e8aae){return _0x1e8aae['map'](function(_0x291397){var _0x4ac7b0=_[_0x14f8('0x2f')](_0xdb42ff,['id',_0x291397['id']]);var _0x2109d1=filterAgentAttributes(_0x4ac7b0);_['merge'](_0x291397,_0x2109d1);_0x291397[_0x14f8('0x30')]=getAgentStatus(_0x291397);return _0x291397;});})[_0x14f8('0x18')](function(_0x5dd6bb){var _0x1668c1=sortAgentsByStatus(_0x5dd6bb,_0x5afec9);return _[_0x14f8('0x22')](_0x1668c1,'id');})[_0x14f8('0x1d')](function(_0x262ef9){throw _0x262ef9;});}exports[_0x14f8('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x7a6efc){var _0x519f8b={'fields':[],'order':null};var _0x10ccc7=_0x7a6efc['split'](',');_0x519f8b['fields']=_[_0x14f8('0x28')](_0x10ccc7,function(_0x4ffe30){if(!_0x4ffe30['includes'](_0x14f8('0x30'))){return!![];}_0x519f8b[_0x14f8('0x32')]=_[_0x14f8('0x33')](_0x4ffe30,'-')?'DESC':'ASC';return![];});return _0x519f8b;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x256d74){if(!_0x256d74){_0x256d74=_0x14f8('0x34');}if(_0x256d74[_0x14f8('0x29')](_0x14f8('0x35'))&&!_0x256d74[_0x14f8('0x29')](_0x14f8('0x36'))){var _0x3ed8bc=_0x256d74[_0x14f8('0x37')](0x0,_0x256d74[_0x14f8('0x38')]('fullname'));_0x256d74+=','+_0x3ed8bc+'internal';}return _0x256d74;}exports[_0x14f8('0x39')]=validateSortParameter;function sortAgentsByStatus(_0x1e5e75,_0x1d89e5){var _0x459200=_0x1e5e75[_0x14f8('0x3a')](function(_0x4942d2,_0x101adc){if(_0x4942d2[_0x14f8('0x30')]===_0x101adc[_0x14f8('0x30')]){if(_0x4942d2[_0x14f8('0x30')]===_0x14f8('0xf')){if(_0x1d89e5==='DESC'){return(_0x4942d2[_0x14f8('0x3b')]||'')<(_0x101adc[_0x14f8('0x3b')]||'')||_0x4942d2['fullname'][_0x14f8('0x3c')]()>_0x101adc[_0x14f8('0x35')]['toLowerCase']()?0x1:-0x1;}else{return(_0x4942d2[_0x14f8('0x3b')]||'')<(_0x101adc[_0x14f8('0x3b')]||'')||_0x4942d2[_0x14f8('0x35')][_0x14f8('0x3c')]()>_0x101adc['fullname'][_0x14f8('0x3c')]()?-0x1:0x1;}}else{if(_0x1d89e5==='DESC'){return _0x4942d2[_0x14f8('0x35')][_0x14f8('0x3c')]()<_0x101adc[_0x14f8('0x35')][_0x14f8('0x3c')]()?0x1:-0x1;}else{return _0x4942d2[_0x14f8('0x35')]['toLowerCase']()<_0x101adc[_0x14f8('0x35')][_0x14f8('0x3c')]()?-0x1:0x1;}}}else{if(_0x1d89e5===_0x14f8('0x3d')){return _0x4942d2[_0x14f8('0x30')]<_0x101adc[_0x14f8('0x30')]?0x1:-0x1;}else{return _0x4942d2[_0x14f8('0x30')]<_0x101adc[_0x14f8('0x30')]?-0x1:0x1;}}});return _0x459200;}exports[_0x14f8('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x3644fa){var _0xaaa54c=[_0x14f8('0x3f'),_0x14f8('0x40'),'lastLoginAt',_0x14f8('0x41'),'pauseType',_0x14f8('0x41'),_0x14f8('0x36'),'address',_0x14f8('0x3'),_0x14f8('0x42'),_0x14f8('0x4'),_0x14f8('0x5'),'whatsappPause',_0x14f8('0x2e'),'voicePause',_0x14f8('0x43'),_0x14f8('0x44'),'mailCapacity','smsCapacity',_0x14f8('0x45'),_0x14f8('0x46'),_0x14f8('0x47'),_0x14f8('0x48'),_0x14f8('0x49'),_0x14f8('0x4a'),'whatsappCurrentCapacity',_0x14f8('0x4b'),_0x14f8('0x10'),_0x14f8('0x13'),'mailStatus','smsStatus',_0x14f8('0x15'),_0x14f8('0x11'),_0x14f8('0xe'),_0x14f8('0x4c'),_0x14f8('0x4d'),'mailStatusTime',_0x14f8('0x4e'),_0x14f8('0x4f'),_0x14f8('0x50'),_0x14f8('0x51'),_0x14f8('0x52'),'destconnectedlinenum','screenrecording',_0x14f8('0x53'),_0x14f8('0x54')];var _0x2f3bde=[_0x14f8('0x3'),'openchannelPause',_0x14f8('0x4'),_0x14f8('0x5'),_0x14f8('0x55'),_0x14f8('0x2e'),'voicePause',_0x14f8('0x40')];var _0x57c872=_(_0x3644fa)['omit'](_0x2f3bde)['pick'](_0xaaa54c)[_0x14f8('0x27')]();return _0x57c872;}exports[_0x14f8('0x56')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x14f8('0x2d'),_0x14f8('0x35'),_0x14f8('0x57'),_0x14f8('0x36'),_0x14f8('0x40'),_0x14f8('0x30'),_0x14f8('0x3f'),'lastLoginAt',_0x14f8('0x3b'),'lastPauseAt',_0x14f8('0x2e'),_0x14f8('0x3'),_0x14f8('0x4'),'openchannelPause',_0x14f8('0x5'),'voicePause','whatsappPause','chatStatus',_0x14f8('0x11'),_0x14f8('0x12'),'openchannelStatus','smsStatus',_0x14f8('0xe'),'whatsappStatus','chatStatusTime',_0x14f8('0x50'),_0x14f8('0x58'),_0x14f8('0x4d'),_0x14f8('0x4e'),_0x14f8('0x51'),_0x14f8('0x4f'),'chatCapacity',_0x14f8('0x46'),_0x14f8('0x59'),'openchannelCapacity','smsCapacity',_0x14f8('0x45'),'chatCurrentCapacity',_0x14f8('0x4b'),'mailCurrentCapacity',_0x14f8('0x48'),_0x14f8('0x4a'),_0x14f8('0x5a'),_0x14f8('0x53'),_0x14f8('0x54'),_0x14f8('0x5b'),_0x14f8('0x5c'),_0x14f8('0x52'),_0x14f8('0x5d')];}exports[_0x14f8('0x5e')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x0f97=['filterAgentAttributes','name','userpic','chatCapacity','faxCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','ringing','isNil','voiceStatus','pause','every','chatStatus','mailStatus','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','unknown','*pause','busy','isArray','Queue','map','findOne','getAgents','all','flatten','uniq','value','includes','idle','getAgentIdsByStatus','resolve','User','findAll','fullname','mailPause','pauseType','find','globalStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','substring','indexOf','internal','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','faxPause','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','openchannelStatus','smsStatus','whatsappStatus','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','pick'];(function(_0x2bdd70,_0x4c173a){var _0x31299f=function(_0x4909a2){while(--_0x4909a2){_0x2bdd70['push'](_0x2bdd70['shift']());}};_0x31299f(++_0x4c173a);}(_0x0f97,0x196));var _0x70f9=function(_0x54bb04,_0x3aaec2){_0x54bb04=_0x54bb04-0x0;var _0xf7a4f4=_0x0f97[_0x54bb04];return _0xf7a4f4;};'use strict';var _=require(_0x70f9('0x0'));var jayson=require(_0x70f9('0x1'));var db=require(_0x70f9('0x2'))['db'];var amiClient=jayson[_0x70f9('0x3')][_0x70f9('0x4')]({'port':0x232a});var routingClient=jayson[_0x70f9('0x3')][_0x70f9('0x4')]({'port':0x232c});function isAgentPaused(_0x163bbc,_0xa00b08){var _0x279d71=[_0x163bbc[_0x70f9('0x5')],_0x163bbc['faxPause'],_0x163bbc['mailPause'],_0x163bbc[_0x70f9('0x6')],_0x163bbc[_0x70f9('0x7')],_0x163bbc[_0x70f9('0x8')],_0x163bbc[_0x70f9('0x9')]];if(!_0xa00b08)return _['every'](_0x279d71);var _0x523d32=_[_0x70f9('0xa')](_0x279d71);return _0x523d32[_0x70f9('0xb')]>0x0&&_0x523d32[_0x70f9('0xb')]<_0x279d71[_0x70f9('0xb')]?!![]:![];}function isIdle(_0x481fc2){return _0x481fc2==='idle'||_0x481fc2==='unknown'||_0x481fc2==='unavailable'||_0x481fc2===_0x70f9('0xc')||_[_0x70f9('0xd')](_0x481fc2);}function isAgentIdle(_0x5951be){if(_0x5951be[_0x70f9('0xe')]!=='idle'&&_0x5951be[_0x70f9('0x8')]){_0x5951be[_0x70f9('0xe')]=_0x70f9('0xf');return![];}return _[_0x70f9('0x10')]([_0x5951be[_0x70f9('0x11')],_0x5951be['faxStatus'],_0x5951be[_0x70f9('0x12')],_0x5951be['openchannelStatus'],_0x5951be['smsStatus'],_0x5951be['voiceStatus'],_0x5951be['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x70f9('0x13')]('Agents',{})[_0x70f9('0x14')](function(_0x36044f){if(_0x36044f[_0x70f9('0x15')]){throw new Error(_0x70f9('0x16'));}var _0x25b88f=_0x36044f[_0x70f9('0x17')];return routingClient[_0x70f9('0x13')](_0x70f9('0x18'),{})[_0x70f9('0x14')](function(_0x4b6e93){if(_0x4b6e93[_0x70f9('0x15')]){throw new Error(_0x70f9('0x19'));}var _0x5817b5=_0x4b6e93[_0x70f9('0x17')];return _[_0x70f9('0x1a')]({},_0x25b88f,_0x5817b5);});})[_0x70f9('0x1b')](function(_0x22f7f7){throw _0x22f7f7;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x57caca){var _0x14de5c=_0x70f9('0x1c');if(isAgentPaused(_0x57caca))_0x14de5c=_0x70f9('0xf');else if(isAgentPaused(_0x57caca,!![]))_0x14de5c=_0x70f9('0x1d');else if(isAgentIdle(_0x57caca))_0x14de5c='idle';else _0x14de5c=_0x70f9('0x1e');return _0x14de5c;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x454339,_0x309afd){var _0x3ce965=_[_0x70f9('0x1f')](_0x454339)?_0x454339:[_0x454339];var _0x2e4e0a=_['startCase'](_0x309afd)+_0x70f9('0x20');var _0x38479d=_[_0x70f9('0x21')](_0x3ce965,function(_0x5d5372){return db[_0x2e4e0a][_0x70f9('0x22')]({'where':{'id':_0x5d5372}})[_0x70f9('0x14')](function(_0xcc9c19){if(!_0xcc9c19)return[];return _0xcc9c19[_0x70f9('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x70f9('0x24')](_0x38479d)['then'](function(_0x3a8209){var _0x74b33c=_(_0x3a8209)[_0x70f9('0x25')]()[_0x70f9('0x21')]('id')[_0x70f9('0x26')]()[_0x70f9('0x27')]();return _0x74b33c;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x470d0c,_0x37d551,_0x1a0da5){try{if(_0x37d551[_0x70f9('0xb')]>0x0){_0x470d0c=_0x470d0c[_0x70f9('0xa')](function(_0x701ff2){return _0x37d551[_0x70f9('0x28')](_0x701ff2['id']);});}var _0x28a8c6=_0x470d0c['filter'](function(_0x5381fa){var _0xd56d2d=_0x70f9('0x1e');if(isAgentIdle(_0x5381fa)){_0xd56d2d=_0x70f9('0x29');}return _0xd56d2d===_0x1a0da5;});return _['map'](_0x28a8c6,'id');}catch(_0x562f5e){throw _0x562f5e;}}exports[_0x70f9('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xe9d41f,_0x4d0f9e,_0x55696d){return Promise[_0x70f9('0x2b')]()[_0x70f9('0x14')](function(){if(_0x4d0f9e['length']>0x0){_0xe9d41f=_0xe9d41f[_0x70f9('0xa')](function(_0x227845){return _0x4d0f9e['includes'](_0x227845['id']);});}return _0xe9d41f;})[_0x70f9('0x14')](function(){return db[_0x70f9('0x2c')][_0x70f9('0x2d')]({'attributes':['id','name',_0x70f9('0x2e'),_0x70f9('0x5'),'faxPause',_0x70f9('0x2f'),_0x70f9('0x6'),'smsPause',_0x70f9('0x8'),_0x70f9('0x9'),_0x70f9('0x30')],'where':{'id':{'$in':_[_0x70f9('0x21')](_0xe9d41f,'id')}},'raw':!![]});})[_0x70f9('0x14')](function(_0x36e93d){return _0x36e93d[_0x70f9('0x21')](function(_0x4b1c17){var _0x3a7e9e=_[_0x70f9('0x31')](_0xe9d41f,['id',_0x4b1c17['id']]);var _0x242101=filterAgentAttributes(_0x3a7e9e);_[_0x70f9('0x1a')](_0x4b1c17,_0x242101);_0x4b1c17[_0x70f9('0x32')]=getAgentStatus(_0x4b1c17);return _0x4b1c17;});})[_0x70f9('0x14')](function(_0x5adf6e){var _0x2caf65=sortAgentsByStatus(_0x5adf6e,_0x55696d);return _[_0x70f9('0x21')](_0x2caf65,'id');})['catch'](function(_0x2dabd6){throw _0x2dabd6;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x375d84){var _0x58aa1c={'fields':[],'order':null};var _0x53b955=_0x375d84[_0x70f9('0x33')](',');_0x58aa1c[_0x70f9('0x34')]=_[_0x70f9('0xa')](_0x53b955,function(_0x14a88d){if(!_0x14a88d[_0x70f9('0x28')](_0x70f9('0x32'))){return!![];}_0x58aa1c[_0x70f9('0x35')]=_[_0x70f9('0x36')](_0x14a88d,'-')?_0x70f9('0x37'):'ASC';return![];});return _0x58aa1c;}exports[_0x70f9('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x66549f){if(!_0x66549f){_0x66549f=_0x70f9('0x39');}if(_0x66549f[_0x70f9('0x28')](_0x70f9('0x2e'))&&!_0x66549f[_0x70f9('0x28')]('internal')){var _0x36a97b=_0x66549f[_0x70f9('0x3a')](0x0,_0x66549f[_0x70f9('0x3b')](_0x70f9('0x2e')));_0x66549f+=','+_0x36a97b+_0x70f9('0x3c');}return _0x66549f;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x2953de,_0x48d698){var _0x8ca1a6=_0x2953de['sort'](function(_0x40cdd2,_0x54452c){if(_0x40cdd2[_0x70f9('0x32')]===_0x54452c['globalStatus']){if(_0x40cdd2['globalStatus']===_0x70f9('0xf')){if(_0x48d698==='DESC'){return(_0x40cdd2[_0x70f9('0x30')]||'')<(_0x54452c['pauseType']||'')||_0x40cdd2[_0x70f9('0x2e')][_0x70f9('0x3d')]()>_0x54452c[_0x70f9('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x40cdd2['pauseType']||'')<(_0x54452c[_0x70f9('0x30')]||'')||_0x40cdd2[_0x70f9('0x2e')]['toLowerCase']()>_0x54452c[_0x70f9('0x2e')][_0x70f9('0x3d')]()?-0x1:0x1;}}else{if(_0x48d698===_0x70f9('0x37')){return _0x40cdd2[_0x70f9('0x2e')][_0x70f9('0x3d')]()<_0x54452c[_0x70f9('0x2e')][_0x70f9('0x3d')]()?0x1:-0x1;}else{return _0x40cdd2['fullname'][_0x70f9('0x3d')]()<_0x54452c[_0x70f9('0x2e')][_0x70f9('0x3d')]()?-0x1:0x1;}}}else{if(_0x48d698===_0x70f9('0x37')){return _0x40cdd2['globalStatus']<_0x54452c[_0x70f9('0x32')]?0x1:-0x1;}else{return _0x40cdd2[_0x70f9('0x32')]<_0x54452c[_0x70f9('0x32')]?-0x1:0x1;}}});return _0x8ca1a6;}exports[_0x70f9('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x24a88a){var _0x46818c=['userpic',_0x70f9('0x3f'),_0x70f9('0x40'),_0x70f9('0x41'),_0x70f9('0x30'),'lastPauseAt',_0x70f9('0x3c'),'address',_0x70f9('0x5'),'openchannelPause',_0x70f9('0x2f'),_0x70f9('0x7'),_0x70f9('0x9'),_0x70f9('0x42'),_0x70f9('0x8'),'chatCapacity',_0x70f9('0x43'),'mailCapacity',_0x70f9('0x44'),_0x70f9('0x45'),_0x70f9('0x46'),_0x70f9('0x47'),_0x70f9('0x48'),'mailCurrentCapacity',_0x70f9('0x49'),'whatsappCurrentCapacity','faxCurrentCapacity',_0x70f9('0x11'),_0x70f9('0x4a'),'mailStatus',_0x70f9('0x4b'),_0x70f9('0x4c'),_0x70f9('0x4d'),_0x70f9('0xe'),_0x70f9('0x4e'),_0x70f9('0x4f'),_0x70f9('0x50'),_0x70f9('0x51'),_0x70f9('0x52'),_0x70f9('0x53'),'voiceStatusTime',_0x70f9('0x54'),_0x70f9('0x55'),'screenrecording',_0x70f9('0x56'),_0x70f9('0x57')];var _0x3ec5f4=[_0x70f9('0x5'),'openchannelPause',_0x70f9('0x2f'),'smsPause',_0x70f9('0x9'),_0x70f9('0x42'),_0x70f9('0x8'),_0x70f9('0x3f')];var _0x4b4cd7=_(_0x24a88a)['omit'](_0x3ec5f4)[_0x70f9('0x58')](_0x46818c)['value']();return _0x4b4cd7;}exports[_0x70f9('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x70f9('0x5a'),_0x70f9('0x2e'),'role',_0x70f9('0x3c'),_0x70f9('0x3f'),_0x70f9('0x32'),_0x70f9('0x5b'),_0x70f9('0x40'),_0x70f9('0x30'),_0x70f9('0x41'),_0x70f9('0x42'),_0x70f9('0x5'),_0x70f9('0x2f'),_0x70f9('0x6'),_0x70f9('0x7'),'voicePause',_0x70f9('0x9'),_0x70f9('0x11'),'faxStatus',_0x70f9('0x12'),_0x70f9('0x4a'),_0x70f9('0x4b'),_0x70f9('0xe'),'whatsappStatus',_0x70f9('0x4e'),'faxStatusTime','mailStatusTime','openchannelStatusTime',_0x70f9('0x51'),'voiceStatusTime',_0x70f9('0x52'),_0x70f9('0x5c'),_0x70f9('0x46'),'mailCapacity',_0x70f9('0x43'),_0x70f9('0x44'),_0x70f9('0x45'),_0x70f9('0x47'),_0x70f9('0x5d'),_0x70f9('0x5e'),_0x70f9('0x48'),'smsCurrentCapacity',_0x70f9('0x5f'),_0x70f9('0x56'),_0x70f9('0x57'),_0x70f9('0x55'),_0x70f9('0x60'),'queue',_0x70f9('0x61')];}exports[_0x70f9('0x62')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 6ceac1e..2a31dd9 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a17=['dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','concat','outbound','map','loggedIn','busy','originated','find','merge','pick','client','available','paused','waiting','loggedInDb','notInUse','onHold','ringing','talking','unknown','pTalking','message','statusMessage','dialMethod','Trunk','startPredictive','erlangCallToSecond'];(function(_0x7b1b6f,_0x17afb7){var _0x1ed949=function(_0x430abe){while(--_0x430abe){_0x7b1b6f['push'](_0x7b1b6f['shift']());}};_0x1ed949(++_0x17afb7);}(_0x0a17,0x1c8));var _0x70a1=function(_0xbc8b39,_0x46b710){_0xbc8b39=_0xbc8b39-0x0;var _0x3462df=_0x0a17[_0xbc8b39];return _0x3462df;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var util=require('util');var amiClient=jayson[_0x70a1('0x0')]['http']({'port':0x232a});var routingClient=jayson[_0x70a1('0x0')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x70a1('0x1'),'loggedIn',_0x70a1('0x2'),_0x70a1('0x3')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse','invalid',_0x70a1('0x4'),_0x70a1('0x5'),_0x70a1('0x6'),_0x70a1('0x7'),'ringInUse',_0x70a1('0x8'),'unavailable',_0x70a1('0x9')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x70a1('0xa'),'originated',_0x70a1('0xb'),_0x70a1('0xc'),'dialActive',_0x70a1('0xd'),_0x70a1('0xe'),_0x70a1('0xf'),'startProgressive','erlangCalls',_0x70a1('0x10'),'erlangAbandonmentRate','erlangBusyFactor',_0x70a1('0x11'),_0x70a1('0x12'),_0x70a1('0x13'),_0x70a1('0x14'),'predictiveIntervalTotalCalls',_0x70a1('0x15'),_0x70a1('0x16'),_0x70a1('0x17'),'predictiveIntervalAvgHoldtime',_0x70a1('0x18')];function getRealtimeQueues(_0x387f28,_0x4bb277){var _0x49e430=_0x4bb277===_0x70a1('0x19')?amiClient:routingClient;return _0x49e430[_0x70a1('0x1a')](_['startCase'](_0x4bb277)+_0x70a1('0x1b'),_0x387f28)['then'](function(_0x40ec9f){if(_0x40ec9f[_0x70a1('0x1c')])throw new Error(util[_0x70a1('0x1d')](_0x70a1('0x1e'),_0x4bb277));return _0x40ec9f[_0x70a1('0x1f')];})[_0x70a1('0x20')](function(_0x1e5daf){throw _0x1e5daf;});}exports[_0x70a1('0x21')]=getRealtimeQueues;function initializeQueues(_0x42f305,_0x5cf6a5,_0x1ba244,_0x3cb21d){var _0x1e05f4=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1ba244===_0x70a1('0x19')){if(_0x3cb21d==='inbound'){_0x1e05f4=_0x1e05f4[_0x70a1('0x22')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3cb21d===_0x70a1('0x23')){_0x1e05f4=_0x1e05f4['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x42f305[_0x70a1('0x24')](function(_0x5e6c26){var _0x4af645=_0x5e6c26['get']({'plain':!![]});_0x4af645[_0x70a1('0x2')]=0x0;_0x4af645[_0x70a1('0x4')]=0x0;_0x4af645[_0x70a1('0x25')]=0x0;_0x4af645[_0x70a1('0x1')]=0x0;_0x4af645[_0x70a1('0x3')]=0x0;if(_0x1ba244===_0x70a1('0x19')){_0x4af645[_0x70a1('0x8')]=0x0;_0x4af645[_0x70a1('0x26')]=0x0;if(_0x3cb21d==='outbound'){_0x4af645[_0x70a1('0xa')]=0x0;_0x4af645[_0x70a1('0x27')]=0x0;}}var _0x1abb69=_[_0x70a1('0x28')](_0x5cf6a5,['id',_0x4af645['id']]);if(_0x1abb69){_[_0x70a1('0x29')](_0x4af645,_[_0x70a1('0x2a')](_0x1abb69,_0x1e05f4));}return _0x4af645;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x91ef=['predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','outbound','map','get','paused','pTalking','find','merge','initializeQueues','lodash','jayson/promise','client','http','available','loggedIn','waiting','busy','inUse','invalid','loggedInDb','notInUse','ringing','talking','unavailable','unknown','originated','message','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable'];(function(_0x5d89e5,_0x2d9dfb){var _0x2e53f8=function(_0x1f9264){while(--_0x1f9264){_0x5d89e5['push'](_0x5d89e5['shift']());}};_0x2e53f8(++_0x2d9dfb);}(_0x91ef,0xaf));var _0xf91e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x91ef[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xf91e('0x0'));var jayson=require(_0xf91e('0x1'));var util=require('util');var amiClient=jayson[_0xf91e('0x2')][_0xf91e('0x3')]({'port':0x232a});var routingClient=jayson[_0xf91e('0x2')][_0xf91e('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xf91e('0x4'),_0xf91e('0x5'),'paused',_0xf91e('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0xf91e('0x7'),_0xf91e('0x8'),_0xf91e('0x9'),_0xf91e('0xa'),_0xf91e('0xb'),'onHold',_0xf91e('0xc'),'ringInUse',_0xf91e('0xd'),_0xf91e('0xe'),_0xf91e('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xf91e('0x10'),_0xf91e('0x11'),_0xf91e('0x12'),'dialActive',_0xf91e('0x13'),_0xf91e('0x14'),_0xf91e('0x15'),_0xf91e('0x16'),_0xf91e('0x17'),'erlangCallToSecond',_0xf91e('0x18'),_0xf91e('0x19'),'dialPredictiveInterval',_0xf91e('0x1a'),_0xf91e('0x1b'),_0xf91e('0x1c'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0xf91e('0x1d'),_0xf91e('0x1e'),_0xf91e('0x1f'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x495b3f,_0x32191e){var _0x140132=_0x32191e===_0xf91e('0x20')?amiClient:routingClient;return _0x140132[_0xf91e('0x21')](_['startCase'](_0x32191e)+_0xf91e('0x22'),_0x495b3f)[_0xf91e('0x23')](function(_0x1f09b4){if(_0x1f09b4[_0xf91e('0x24')])throw new Error(util[_0xf91e('0x25')](_0xf91e('0x26'),_0x32191e));return _0x1f09b4[_0xf91e('0x27')];})[_0xf91e('0x28')](function(_0x439536){throw _0x439536;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x5bb3b2,_0x295c1a,_0x345f14,_0x5d1215){var _0x3a8b96=DEFAULT_QUEUE_ATTRIBUTES;if(_0x345f14===_0xf91e('0x20')){if(_0x5d1215===_0xf91e('0x29')){_0x3a8b96=_0x3a8b96[_0xf91e('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5d1215===_0xf91e('0x2b')){_0x3a8b96=_0x3a8b96[_0xf91e('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x5bb3b2[_0xf91e('0x2c')](function(_0x7718fb){var _0x2d1334=_0x7718fb[_0xf91e('0x2d')]({'plain':!![]});_0x2d1334[_0xf91e('0x2e')]=0x0;_0x2d1334[_0xf91e('0xa')]=0x0;_0x2d1334[_0xf91e('0x5')]=0x0;_0x2d1334['available']=0x0;_0x2d1334[_0xf91e('0x6')]=0x0;if(_0x345f14===_0xf91e('0x20')){_0x2d1334[_0xf91e('0xd')]=0x0;_0x2d1334[_0xf91e('0x7')]=0x0;if(_0x5d1215===_0xf91e('0x2b')){_0x2d1334[_0xf91e('0x2f')]=0x0;_0x2d1334[_0xf91e('0x10')]=0x0;}}var _0x20179e=_[_0xf91e('0x30')](_0x295c1a,['id',_0x2d1334['id']]);if(_0x20179e){_[_0xf91e('0x31')](_0x2d1334,_['pick'](_0x20179e,_0x3a8b96));}return _0x2d1334;});}exports[_0xf91e('0x32')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index d23a90b..d08692b 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(_0x14a862,_0x2b559d){var _0x245eb5=function(_0x6e014c){while(--_0x6e014c){_0x14a862['push'](_0x14a862['shift']());}};_0x245eb5(++_0x2b559d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x45b9c6,_0x1ec45c){var _0xfc724e=function(_0x3db2be){while(--_0x3db2be){_0x45b9c6['push'](_0x45b9c6['shift']());}};_0xfc724e(++_0x1ec45c);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index dfebdac..d7eaaf3 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 _0x24e7=['mac','00:00:00:00:00:00','address','127.0.0.1','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash','crypto','execSync','../environment','networkInterfaces','keys','length','family','internal','head'];(function(_0x4a8b80,_0x5c911a){var _0x1c9664=function(_0x1431c9){while(--_0x1431c9){_0x4a8b80['push'](_0x4a8b80['shift']());}};_0x1c9664(++_0x5c911a);}(_0x24e7,0x96));var _0x724e=function(_0x2a7d11,_0x2b6d5d){_0x2a7d11=_0x2a7d11-0x0;var _0x41dfb5=_0x24e7[_0x2a7d11];return _0x41dfb5;};'use strict';var _=require(_0x724e('0x0'));var os=require('os');var crypto=require(_0x724e('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x724e('0x2')];var config=require(_0x724e('0x3'));function getInterfaces(){var _0x1103d7=[];var _0x4d1f48=os[_0x724e('0x4')]();var _0x5b6250=_['orderBy'](_[_0x724e('0x5')](_0x4d1f48));for(var _0x17a24e=0x0;_0x17a24e<_0x5b6250[_0x724e('0x6')];_0x17a24e++){var _0x3aee9e=_0x4d1f48[_0x5b6250[_0x17a24e]]['filter'](function(_0x3777be){return _0x3777be[_0x724e('0x7')]==='IPv4'&&_0x3777be[_0x724e('0x8')]===![];});_0x1103d7=_0x1103d7['concat'](_0x3aee9e);}return _0x1103d7;}function getFirstInterface(){var _0xdad098=_[_0x724e('0x9')](getInterfaces());return{'macAddress':_0xdad098&&_0xdad098[_0x724e('0xa')]?_0xdad098['mac']:_0x724e('0xb'),'ipAddress':_0xdad098&&_0xdad098[_0x724e('0xc')]?_0xdad098[_0x724e('0xc')]:_0x724e('0xd')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xb6dcdd=_['orderBy'](os['cpus']()[_0x724e('0xe')](function(_0x5a8543){return _0x5a8543[_0x724e('0xf')];}))[_0x724e('0x10')](':');return crypto[_0x724e('0x11')](_0x724e('0x12'))[_0x724e('0x13')](_0xb6dcdd)[_0x724e('0x14')](_0x724e('0x15'));}exports[_0x724e('0x16')]=function(){var _0x1a18f1=os[_0x724e('0x17')]();var _0x4c294d=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x4c294d[_0x724e('0x18')](config[_0x724e('0x19')])){return config[_0x724e('0x19')];}else if(_0x1a18f1==='win32'){return exec(_0x724e('0x1a'),{'encoding':_0x724e('0x1b')})[_0x724e('0x1c')]('\x0d\x0a','');}else{var _0x45a4cb=getFirstInterface();var _0x18e0a5=getCPUhash();var _0x42cd6f=_0x18e0a5+'|'+os['hostname']()+'|'+_0x45a4cb[_0x724e('0x1d')]+'|'+_0x45a4cb[_0x724e('0x1e')];var _0x18b9ad=crypto[_0x724e('0x11')](_0x724e('0x12'))[_0x724e('0x13')](_0x42cd6f)[_0x724e('0x14')]('hex');return _0x18b9ad['substring'](0x0,0x8)+'-'+_0x18b9ad[_0x724e('0x1f')](0x8,0xc)+'-'+_0x18b9ad[_0x724e('0x1f')](0xc,0x10)+'-'+_0x18b9ad[_0x724e('0x1f')](0x10,0x14)+'-'+_0x18b9ad[_0x724e('0x1f')](0x14);}}; \ No newline at end of file +var _0x2971=['networkInterfaces','orderBy','keys','filter','family','IPv4','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','update','digest','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment'];(function(_0xa1fc51,_0x4fe945){var _0x150463=function(_0xe9fe79){while(--_0xe9fe79){_0xa1fc51['push'](_0xa1fc51['shift']());}};_0x150463(++_0x4fe945);}(_0x2971,0x86));var _0x1297=function(_0x8af94,_0x1533c9){_0x8af94=_0x8af94-0x0;var _0x14a3d5=_0x2971[_0x8af94];return _0x14a3d5;};'use strict';var _=require(_0x1297('0x0'));var os=require('os');var crypto=require(_0x1297('0x1'));var machine=require(_0x1297('0x2'));var exec=require(_0x1297('0x3'))[_0x1297('0x4')];var config=require(_0x1297('0x5'));function getInterfaces(){var _0x1c9d42=[];var _0x455ee5=os[_0x1297('0x6')]();var _0x12b4f7=_[_0x1297('0x7')](_[_0x1297('0x8')](_0x455ee5));for(var _0x3e20b6=0x0;_0x3e20b6<_0x12b4f7['length'];_0x3e20b6++){var _0x596017=_0x455ee5[_0x12b4f7[_0x3e20b6]][_0x1297('0x9')](function(_0x118b7a){return _0x118b7a[_0x1297('0xa')]===_0x1297('0xb')&&_0x118b7a['internal']===![];});_0x1c9d42=_0x1c9d42[_0x1297('0xc')](_0x596017);}return _0x1c9d42;}function getFirstInterface(){var _0x3be0da=_['head'](getInterfaces());return{'macAddress':_0x3be0da&&_0x3be0da[_0x1297('0xd')]?_0x3be0da[_0x1297('0xd')]:_0x1297('0xe'),'ipAddress':_0x3be0da&&_0x3be0da[_0x1297('0xf')]?_0x3be0da[_0x1297('0xf')]:_0x1297('0x10')};}exports[_0x1297('0x11')]=getFirstInterface;function getCPUhash(){var _0x245be4=_[_0x1297('0x7')](os['cpus']()[_0x1297('0x12')](function(_0x1023c7){return _0x1023c7[_0x1297('0x13')];}))[_0x1297('0x14')](':');return crypto[_0x1297('0x15')](_0x1297('0x16'))[_0x1297('0x17')](_0x245be4)[_0x1297('0x18')]('hex');}exports['getUuid']=function(){var _0x588e08=os['platform']();var _0x5959b5=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5959b5[_0x1297('0x19')](config[_0x1297('0x1a')])){return config[_0x1297('0x1a')];}else if(_0x588e08===_0x1297('0x1b')){return exec(_0x1297('0x1c'),{'encoding':_0x1297('0x1d')})[_0x1297('0x1e')]('\x0d\x0a','');}else{var _0x4dec80=getFirstInterface();var _0x39ab8c=getCPUhash();var _0x3c92a0=_0x39ab8c+'|'+os['hostname']()+'|'+_0x4dec80[_0x1297('0x1f')]+'|'+_0x4dec80[_0x1297('0x20')];var _0x2dab40=crypto[_0x1297('0x15')]('md5')['update'](_0x3c92a0)['digest'](_0x1297('0x21'));return _0x2dab40['substring'](0x0,0x8)+'-'+_0x2dab40['substring'](0x8,0xc)+'-'+_0x2dab40[_0x1297('0x22')](0xc,0x10)+'-'+_0x2dab40[_0x1297('0x22')](0x10,0x14)+'-'+_0x2dab40[_0x1297('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 0af2322..a206525 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 _0x97f4=['license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger'];(function(_0x388e19,_0x1340d5){var _0x239141=function(_0x1261bc){while(--_0x1261bc){_0x388e19['push'](_0x388e19['shift']());}};_0x239141(++_0x1340d5);}(_0x97f4,0x98));var _0x497f=function(_0x4636a5,_0x223b12){_0x4636a5=_0x4636a5-0x0;var _0x15db70=_0x97f4[_0x4636a5];return _0x15db70;};'use strict';var util=require('util');var moment=require(_0x497f('0x0'));var rp=require(_0x497f('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x497f('0x2'))(module,_0x497f('0x3'));var db=require(_0x497f('0x4'))['db'];var encryptor=require(_0x497f('0x5'));var hardware=require(_0x497f('0x6'));var logger=require(_0x497f('0x7'))(_0x497f('0x8'));var HOST=_0x497f('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x29dcbc){return new BPromise(function(_0x171f8b,_0x3a43bd){var _0x54d2a6=util[_0x497f('0xa')](_0x497f('0xb'),HOST,_0x29dcbc,module[_0x497f('0xc')][_0x497f('0x3')]);if(oldToken){_0x54d2a6=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x29dcbc,module['exports'][_0x497f('0x3')],oldToken);}var _0x477060={'uri':_0x54d2a6,'method':_0x497f('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x477060)[_0x497f('0xe')](function(_0x39d2cb){_0x171f8b(_0x39d2cb);})[_0x497f('0xf')](function(_0x3d0c92){_0x3a43bd(_0x3d0c92);});});}function manageLicense(_0x57c4e3,_0x128b5b){var _0x29ea6d=_0x128b5b['get']({'plain':!![]});if(!isOldTokenSent&&_0x29ea6d[_0x497f('0x10')]!==_0x57c4e3&&!_0x29ea6d['data2']){oldToken=_0x29ea6d['data1'];}httpRequest(_0x57c4e3)['then'](function(_0x482da7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x482da7[_0x497f('0x11')]){isOldTokenSent=![];if(!_0x29ea6d['license']&&_0x29ea6d[_0x497f('0x8')]!=_0x482da7[_0x497f('0x8')]||_0x29ea6d['license']&&_0x29ea6d[_0x497f('0x12')]){logger[_0x497f('0x13')](_0x497f('0x14'));}if(_0x29ea6d[_0x497f('0x8')]&&!_0x29ea6d[_0x497f('0x12')]&&_0x29ea6d[_0x497f('0x8')]!=_0x482da7[_0x497f('0x8')]){logger[_0x497f('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x29ea6d[_0x497f('0x8')]&&!_0x29ea6d['data2']&&_0x29ea6d['license']==_0x482da7[_0x497f('0x8')]){return _0x128b5b;}return _0x128b5b[_0x497f('0x15')]({'data1':_0x57c4e3,'data2':null,'license':_0x482da7[_0x497f('0x8')]});}else{if(_0x482da7[_0x497f('0x8')]||_0x29ea6d[_0x497f('0x8')]){if(!_0x29ea6d[_0x497f('0x12')]){if(_0x29ea6d['data1']==_0x57c4e3){GRAY_PERIOD_REASON=_0x497f('0x16');logger[_0x497f('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x497f('0x17');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x29ea6d[_0x497f('0x10')],_0x57c4e3);}logger['info'](_0x497f('0x18'),GRAY_PERIOD_REASON[_0x497f('0x19')](),moment()[_0x497f('0xa')](_0x497f('0x1a')));return _0x128b5b[_0x497f('0x15')]({'data2':encryptor[_0x497f('0x1b')](moment()['format'](_0x497f('0x1a')))});}else{if(moment()[_0x497f('0x1c')](encryptor[_0x497f('0x1d')](_0x29ea6d[_0x497f('0x12')]),_0x497f('0x1e'))>DAYS){logger[_0x497f('0x13')]('DEMO\x20START\x20AT\x20%s',moment()[_0x497f('0xa')](_0x497f('0x1a')));isOldTokenSent=![];return _0x128b5b[_0x497f('0x15')]({'data1':_0x57c4e3,'data2':null,'license':null});}}}else{if(_0x29ea6d[_0x497f('0x10')]!=_0x57c4e3){logger[_0x497f('0x13')](_0x497f('0x1f'),_0x29ea6d['data1'],_0x57c4e3);return _0x128b5b[_0x497f('0x15')]({'data1':_0x57c4e3,'data2':null,'license':null});}}}return _0x128b5b;})[_0x497f('0xe')](function(_0x4a21ea){_0x128b5b=_0x4a21ea;})['catch'](function(_0x55d153){logger[_0x497f('0x20')](_0x55d153[_0x497f('0x21')]);})[_0x497f('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x497f('0x23')](),_0x128b5b);},TIME);});}function defaultLicense(){var _0xab50e0=hardware[_0x497f('0x23')]();if(_0xab50e0){return db['License'][_0x497f('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0xab50e0}})[_0x497f('0x25')](function(_0x26d3d9,_0x163e05){logger[_0x497f('0x13')](_0x497f('0x26'),_0xab50e0);manageLicense(_0xab50e0,_0x26d3d9);})[_0x497f('0xf')](function(_0x39fef6){logger[_0x497f('0x20')](_0x39fef6[_0x497f('0x21')]);});}}exports[_0x497f('0x27')]=defaultLicense; \ No newline at end of file +var _0x5aaa=['get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5aaa,0xda));var _0xa5aa=function(_0x2e2779,_0x4cda24){_0x2e2779=_0x2e2779-0x0;var _0x49a171=_0x5aaa[_0x2e2779];return _0x49a171;};'use strict';var util=require(_0xa5aa('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0xa5aa('0x1'));var pkginfo=require(_0xa5aa('0x2'))(module,_0xa5aa('0x3'));var db=require(_0xa5aa('0x4'))['db'];var encryptor=require(_0xa5aa('0x5'));var hardware=require('./hardware');var logger=require(_0xa5aa('0x6'))(_0xa5aa('0x7'));var HOST=_0xa5aa('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xb3c62a){return new BPromise(function(_0x3be337,_0x46c67e){var _0x2312b0=util[_0xa5aa('0x9')](_0xa5aa('0xa'),HOST,_0xb3c62a,module[_0xa5aa('0xb')]['version']);if(oldToken){_0x2312b0=util[_0xa5aa('0x9')](_0xa5aa('0xc'),HOST,_0xb3c62a,module[_0xa5aa('0xb')][_0xa5aa('0x3')],oldToken);}var _0x37deae={'uri':_0x2312b0,'method':_0xa5aa('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x37deae)[_0xa5aa('0xe')](function(_0x44f8f4){_0x3be337(_0x44f8f4);})[_0xa5aa('0xf')](function(_0x28278f){_0x46c67e(_0x28278f);});});}function manageLicense(_0x2a6efa,_0x758bc){var _0x203943=_0x758bc[_0xa5aa('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x203943[_0xa5aa('0x11')]!==_0x2a6efa&&!_0x203943[_0xa5aa('0x12')]){oldToken=_0x203943[_0xa5aa('0x11')];}httpRequest(_0x2a6efa)[_0xa5aa('0xe')](function(_0x212b56){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x212b56['active']){isOldTokenSent=![];if(!_0x203943['license']&&_0x203943[_0xa5aa('0x7')]!=_0x212b56[_0xa5aa('0x7')]||_0x203943[_0xa5aa('0x7')]&&_0x203943[_0xa5aa('0x12')]){logger[_0xa5aa('0x13')](_0xa5aa('0x14'));}if(_0x203943[_0xa5aa('0x7')]&&!_0x203943[_0xa5aa('0x12')]&&_0x203943['license']!=_0x212b56['license']){logger['info'](_0xa5aa('0x15'));}if(_0x203943[_0xa5aa('0x7')]&&!_0x203943['data2']&&_0x203943['license']==_0x212b56[_0xa5aa('0x7')]){return _0x758bc;}return _0x758bc[_0xa5aa('0x16')]({'data1':_0x2a6efa,'data2':null,'license':_0x212b56['license']});}else{if(_0x212b56[_0xa5aa('0x7')]||_0x203943[_0xa5aa('0x7')]){if(!_0x203943['data2']){if(_0x203943['data1']==_0x2a6efa){GRAY_PERIOD_REASON=_0xa5aa('0x17');logger[_0xa5aa('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xa5aa('0x18');logger[_0xa5aa('0x13')](_0xa5aa('0x19'),_0x203943[_0xa5aa('0x11')],_0x2a6efa);}logger['info'](_0xa5aa('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xa5aa('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x758bc['update']({'data2':encryptor['encryptString'](moment()[_0xa5aa('0x9')](_0xa5aa('0x1b')))});}else{if(moment()['diff'](encryptor[_0xa5aa('0x1c')](_0x203943['data2']),_0xa5aa('0x1d'))>DAYS){logger[_0xa5aa('0x13')](_0xa5aa('0x1e'),moment()[_0xa5aa('0x9')](_0xa5aa('0x1b')));isOldTokenSent=![];return _0x758bc['update']({'data1':_0x2a6efa,'data2':null,'license':null});}}}else{if(_0x203943['data1']!=_0x2a6efa){logger[_0xa5aa('0x13')](_0xa5aa('0x19'),_0x203943[_0xa5aa('0x11')],_0x2a6efa);return _0x758bc[_0xa5aa('0x16')]({'data1':_0x2a6efa,'data2':null,'license':null});}}}return _0x758bc;})[_0xa5aa('0xe')](function(_0x5e429b){_0x758bc=_0x5e429b;})[_0xa5aa('0xf')](function(_0x6ec59c){logger['error'](_0x6ec59c[_0xa5aa('0x1f')]);})[_0xa5aa('0x20')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x758bc);},TIME);});}function defaultLicense(){var _0x5c04ce=hardware[_0xa5aa('0x21')]();if(_0x5c04ce){return db[_0xa5aa('0x22')][_0xa5aa('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x5c04ce}})['spread'](function(_0x175ac5,_0x134f3a){logger['info'](_0xa5aa('0x24'),_0x5c04ce);manageLicense(_0x5c04ce,_0x175ac5);})[_0xa5aa('0xf')](function(_0x257f36){logger[_0xa5aa('0x25')](_0x257f36[_0xa5aa('0x1f')]);});}}exports[_0xa5aa('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 2827b97..0c76e96 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 _0x4401=['deadline','add','format','machineUuid','disabled','message','findAll','role','sequelize','COUNT','col','admin','telephone','user','count','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','then','catch','uuid','license','isEmpty','data1','data2','split','decryptString','gray'];(function(_0x511b9e,_0x4ea780){var _0x2f5c28=function(_0x212f20){while(--_0x212f20){_0x511b9e['push'](_0x511b9e['shift']());}};_0x2f5c28(++_0x4ea780);}(_0x4401,0xab));var _0x1440=function(_0x5c02e4,_0x298ce5){_0x5c02e4=_0x5c02e4-0x0;var _0x42a05a=_0x4401[_0x5c02e4];return _0x42a05a;};'use strict';var util=require(_0x1440('0x0'));var _=require(_0x1440('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x1440('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0x1440('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1440('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x1440('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1440('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x1440('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x342ecb){return new BPromise(function(_0x401496,_0x273cd0){return db[_0x1440('0x7')][_0x1440('0x8')](_['defaults'](_0x342ecb,{'raw':!![],'where':{'id':0x1}}))[_0x1440('0x9')](function(_0x982cb6){return checkLicense(_0x982cb6,null);})['then'](function(_0x2b7dba){_0x401496(_0x2b7dba);return;})[_0x1440('0xa')](function(_0x5dcbef){_0x273cd0(_0x5dcbef);});});}function checkLicense(_0x30f085,_0xf19759){if(!_0x30f085){demoLicense[_0x1440('0xb')]=_0x30f085['data1'];return demoLicense;}try{var _0xbc97b7=_0xf19759||_0x30f085[_0x1440('0xc')];if(_[_0x1440('0xd')](_0xbc97b7)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x2ab07f=_0x30f085[_0x1440('0xe')];var _0x1fb2bc=_0x30f085[_0x1440('0xf')];var _0x2fdea7=_0x2ab07f[_0x1440('0x10')]('-')[0x4];var _0x424688=_0x2ab07f[_0x1440('0x10')]('-')[0x0];var _0x312169=encryptor[_0x1440('0x11')](_0xbc97b7,util['format']('%s:%s:%s',_0x2fdea7,_0x2ab07f,_0x424688));var _0x471c7b=JSON['parse'](_0x312169);_0x471c7b['demo']=![];_0x471c7b[_0x1440('0xb')]=_0x2ab07f;_0x471c7b['machineUuid']=hardware[_0x1440('0x6')]();if(_0x1fb2bc){var _0x5e5ae0=encryptor[_0x1440('0x11')](_0x1fb2bc);_0x471c7b[_0x1440('0x12')]=_0x5e5ae0;_0x471c7b[_0x1440('0x13')]=moment(_0x5e5ae0)[_0x1440('0x14')](0x7,'days')[_0x1440('0x15')]();_0x471c7b['grayReason']=_0x471c7b[_0x1440('0xb')]!=_0x471c7b[_0x1440('0x16')]?'changed':_0x1440('0x17');}return _0x471c7b;}catch(_0x465b4c){breakingLicense[_0x1440('0xb')]=_0x30f085['data1'];breakingLicense[_0x1440('0x18')]=_0x465b4c[_0x1440('0x18')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x48de6c,_0x3aca4a){getLicense()['then'](function(_0xdb75f0){return db['User'][_0x1440('0x19')]({'attributes':[_0x1440('0x1a'),[db[_0x1440('0x1b')]['fn'](_0x1440('0x1c'),db['sequelize'][_0x1440('0x1d')]('role')),'count']],'group':_0x1440('0x1a'),'where':{'role':{'$or':[_0x1440('0x1e'),'user',_0x1440('0x1f')]}},'raw':!![]})[_0x1440('0x9')](function(_0x57197c){var _0xae5694={'user':_0xdb75f0['users']||0x0,'telephone':_0xdb75f0['telephones']||0x0};_0x57197c['forEach'](function(_0x359963){var _0xaae3aa=_0x359963[_0x1440('0x1a')]==='admin'?_0x1440('0x20'):_0x359963[_0x1440('0x1a')];_0xae5694[_0xaae3aa]-=_0x359963[_0x1440('0x21')];if(_0xae5694[_0xaae3aa]<0x0)_0xae5694[_0xaae3aa]=0x0;});_0x48de6c(_0xae5694);return;});})['catch'](function(_0x24b57f){_0x3aca4a(_0x24b57f);});});}function checkUserLimits(_0x52d46f){return new BPromise(function(_0x360347,_0x2cbdb3){getLimits()[_0x1440('0x9')](function(_0x1c9783){var _0x191094=_[_0x1440('0x22')](_[_0x1440('0x23')](_0x52d46f,'role'),[_0x1440('0x1e'),_0x1440('0x20'),_0x1440('0x1f')]);var _0x3248d7=(_0x191094[_0x1440('0x1e')]||0x0)+(_0x191094[_0x1440('0x20')]||0x0);var _0x5d0ea9=_0x191094['telephone']||0x0;if(_0x3248d7>_0x1c9783[_0x1440('0x20')])return _0x2cbdb3('License\x20limit\x20reached\x20for\x20users');if(_0x5d0ea9>_0x1c9783[_0x1440('0x1f')])return _0x2cbdb3(_0x1440('0x24'));return _0x360347();})['catch'](function(_0xd2f2fc){_0x2cbdb3(_0xd2f2fc);});});}module[_0x1440('0x25')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6bf6=['moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Breaking\x20license','License','defaults','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','decryptString','%s:%s:%s','parse','demo','gray','deadline','add','format','grayReason','machineUuid','changed','message','User','findAll','role','sequelize','COUNT','count','admin','telephone','telephones','user','catch','then','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash'];(function(_0xd8f4d2,_0x4cffcc){var _0x27212d=function(_0x55ce15){while(--_0x55ce15){_0xd8f4d2['push'](_0xd8f4d2['shift']());}};_0x27212d(++_0x4cffcc);}(_0x6bf6,0x100));var _0x66bf=function(_0x26cab7,_0x1ccfca){_0x26cab7=_0x26cab7-0x0;var _0x31ba06=_0x6bf6[_0x26cab7];return _0x31ba06;};'use strict';var util=require(_0x66bf('0x0'));var _=require(_0x66bf('0x1'));var moment=require(_0x66bf('0x2'));var BPromise=require('bluebird');var hardware=require(_0x66bf('0x3'));var encryptor=require(_0x66bf('0x4'));var db=require(_0x66bf('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x66bf('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x66bf('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x66bf('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4fc11a){return new BPromise(function(_0x532a69,_0x588455){return db[_0x66bf('0x8')]['find'](_[_0x66bf('0x9')](_0x4fc11a,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3724fb){return checkLicense(_0x3724fb,null);})['then'](function(_0x2e24ec){_0x532a69(_0x2e24ec);return;})['catch'](function(_0x5b59e8){_0x588455(_0x5b59e8);});});}function checkLicense(_0x37ca95,_0x2d23cf){if(!_0x37ca95){demoLicense[_0x66bf('0xa')]=_0x37ca95[_0x66bf('0xb')];return demoLicense;}try{var _0x35a36b=_0x2d23cf||_0x37ca95['license'];if(_[_0x66bf('0xc')](_0x35a36b)){throw new Error(_0x66bf('0xd'));}var _0x45b49e=_0x37ca95[_0x66bf('0xb')];var _0x26abe8=_0x37ca95[_0x66bf('0xe')];var _0x17f194=_0x45b49e['split']('-')[0x4];var _0x54e89e=_0x45b49e['split']('-')[0x0];var _0xc038a8=encryptor[_0x66bf('0xf')](_0x35a36b,util['format'](_0x66bf('0x10'),_0x17f194,_0x45b49e,_0x54e89e));var _0x4a1d65=JSON[_0x66bf('0x11')](_0xc038a8);_0x4a1d65[_0x66bf('0x12')]=![];_0x4a1d65[_0x66bf('0xa')]=_0x45b49e;_0x4a1d65['machineUuid']=hardware['getUuid']();if(_0x26abe8){var _0x4bdba7=encryptor[_0x66bf('0xf')](_0x26abe8);_0x4a1d65[_0x66bf('0x13')]=_0x4bdba7;_0x4a1d65[_0x66bf('0x14')]=moment(_0x4bdba7)[_0x66bf('0x15')](0x7,'days')[_0x66bf('0x16')]();_0x4a1d65[_0x66bf('0x17')]=_0x4a1d65[_0x66bf('0xa')]!=_0x4a1d65[_0x66bf('0x18')]?_0x66bf('0x19'):'disabled';}return _0x4a1d65;}catch(_0x192bd3){breakingLicense[_0x66bf('0xa')]=_0x37ca95[_0x66bf('0xb')];breakingLicense[_0x66bf('0x1a')]=_0x192bd3[_0x66bf('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x297111,_0x31e461){getLicense()['then'](function(_0x38028b){return db[_0x66bf('0x1b')][_0x66bf('0x1c')]({'attributes':[_0x66bf('0x1d'),[db[_0x66bf('0x1e')]['fn'](_0x66bf('0x1f'),db['sequelize']['col']('role')),_0x66bf('0x20')]],'group':_0x66bf('0x1d'),'where':{'role':{'$or':[_0x66bf('0x21'),'user',_0x66bf('0x22')]}},'raw':!![]})['then'](function(_0x90c870){var _0x4e840c={'user':_0x38028b['users']||0x0,'telephone':_0x38028b[_0x66bf('0x23')]||0x0};_0x90c870['forEach'](function(_0x2beb36){var _0x1b1e8c=_0x2beb36['role']===_0x66bf('0x21')?_0x66bf('0x24'):_0x2beb36['role'];_0x4e840c[_0x1b1e8c]-=_0x2beb36[_0x66bf('0x20')];if(_0x4e840c[_0x1b1e8c]<0x0)_0x4e840c[_0x1b1e8c]=0x0;});_0x297111(_0x4e840c);return;});})[_0x66bf('0x25')](function(_0x2d45dd){_0x31e461(_0x2d45dd);});});}function checkUserLimits(_0x1437ac){return new BPromise(function(_0x121cc4,_0x35438d){getLimits()[_0x66bf('0x26')](function(_0x4f9da9){var _0x13a9f4=_[_0x66bf('0x27')](_['countBy'](_0x1437ac,_0x66bf('0x1d')),[_0x66bf('0x21'),_0x66bf('0x24'),_0x66bf('0x22')]);var _0x1f0843=(_0x13a9f4['admin']||0x0)+(_0x13a9f4['user']||0x0);var _0x2d3512=_0x13a9f4['telephone']||0x0;if(_0x1f0843>_0x4f9da9[_0x66bf('0x24')])return _0x35438d(_0x66bf('0x28'));if(_0x2d3512>_0x4f9da9[_0x66bf('0x22')])return _0x35438d(_0x66bf('0x29'));return _0x121cc4();})[_0x66bf('0x25')](function(_0x28ebe6){_0x35438d(_0x28ebe6);});});}module[_0x66bf('0x2a')]={'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 8aca01a..72c5664 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 _0x36ee=['myappanuglar-secret','secret'];(function(_0x5e3659,_0x1f7d2e){var _0x2209ef=function(_0xdc9300){while(--_0xdc9300){_0x5e3659['push'](_0x5e3659['shift']());}};_0x2209ef(++_0x1f7d2e);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xe36e('0x0'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe36e('0x1'),'DEBUG':''}; \ No newline at end of file +var _0x7916=['myappanuglar-secret','app-id','exports'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0x7916,0x128));var _0x6791=function(_0x1825ca,_0x226c42){_0x1825ca=_0x1825ca-0x0;var _0x2b6413=_0x7916[_0x1825ca];return _0x2b6413;};'use strict';module[_0x6791('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x6791('0x1'),'GOOGLE_ID':_0x6791('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index eeb7285..2c30427 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3625=['exports','fileLogger'];(function(_0x1ad842,_0x5266ec){var _0x46f9c8=function(_0x326333){while(--_0x326333){_0x1ad842['push'](_0x1ad842['shift']());}};_0x46f9c8(++_0x5266ec);}(_0x3625,0xfd));var _0x5362=function(_0x30aeff,_0x2c8c91){_0x30aeff=_0x30aeff-0x0;var _0x499f9a=_0x3625[_0x30aeff];return _0x499f9a;};'use strict';var fileLogger=require('../utils/loggers')[_0x5362('0x0')];module[_0x5362('0x1')]=fileLogger; \ No newline at end of file +var _0xb1b6=['exports','../utils/loggers'];(function(_0x42df8b,_0x358bcc){var _0x523cec=function(_0x1947e3){while(--_0x1947e3){_0x42df8b['push'](_0x42df8b['shift']());}};_0x523cec(++_0x358bcc);}(_0xb1b6,0x6d));var _0x6b1b=function(_0x217696,_0x3ee511){_0x217696=_0x217696-0x0;var _0x369747=_0xb1b6[_0x217696];return _0x369747;};'use strict';var fileLogger=require(_0x6b1b('0x0'))['fileLogger'];module[_0x6b1b('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f345cc4..33d910e 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 _0x1bca=['resolve','join','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','xdr','../../services/xdr/index.js','exports','path','../../config/environment'];(function(_0x5db59c,_0x11cc79){var _0x2a1f41=function(_0x35cfa4){while(--_0x35cfa4){_0x5db59c['push'](_0x5db59c['shift']());}};_0x2a1f41(++_0x11cc79);}(_0x1bca,0xde));var _0xa1bc=function(_0x420048,_0x2c2393){_0x420048=_0x420048-0x0;var _0x4d4c73=_0x1bca[_0x420048];return _0x4d4c73;};'use strict';var path=require(_0xa1bc('0x0'));var cfg=require(_0xa1bc('0x1'));var env={'NODE_PATH':path[_0xa1bc('0x2')](path[_0xa1bc('0x3')](cfg['root'],_0xa1bc('0x4')))};var pm2config={'apps':[{'name':_0xa1bc('0x5'),'script':path[_0xa1bc('0x3')](__dirname,_0xa1bc('0x6')),'env':env},{'name':_0xa1bc('0x7'),'script':path[_0xa1bc('0x3')](__dirname,_0xa1bc('0x8')),'env':env},{'name':_0xa1bc('0x9'),'script':path['join'](__dirname,_0xa1bc('0xa')),'env':env},{'name':_0xa1bc('0xb'),'script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':_0xa1bc('0xc'),'script':path[_0xa1bc('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xa1bc('0xd'),'script':path['join'](__dirname,_0xa1bc('0xe')),'env':env}]};module[_0xa1bc('0xf')]=pm2config; \ No newline at end of file +var _0x6fe2=['../../services/email/index.js','../../services/routing/index.js','../../services/xdr/index.js','exports','path','resolve','join','legacy-libs','express','agi','../../services/agi/index.js','email'];(function(_0x2e08db,_0x2409df){var _0x1e0ce1=function(_0x5ac97c){while(--_0x5ac97c){_0x2e08db['push'](_0x2e08db['shift']());}};_0x1e0ce1(++_0x2409df);}(_0x6fe2,0x1a8));var _0x26fe=function(_0x8c930b,_0x1db75a){_0x8c930b=_0x8c930b-0x0;var _0x24c4bc=_0x6fe2[_0x8c930b];return _0x24c4bc;};'use strict';var path=require(_0x26fe('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x26fe('0x1')](path[_0x26fe('0x2')](cfg['root'],_0x26fe('0x3')))};var pm2config={'apps':[{'name':_0x26fe('0x4'),'script':path['join'](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path[_0x26fe('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x26fe('0x5'),'script':path[_0x26fe('0x2')](__dirname,_0x26fe('0x6')),'env':env},{'name':_0x26fe('0x7'),'script':path[_0x26fe('0x2')](__dirname,_0x26fe('0x8')),'env':env},{'name':'routing','script':path[_0x26fe('0x2')](__dirname,_0x26fe('0x9')),'env':env},{'name':'xdr','script':path[_0x26fe('0x2')](__dirname,_0x26fe('0xa')),'env':env}]};module[_0x26fe('0xb')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index a487ca7..b6b46d3 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 _0x719c=['dump','saved','pm2','bluebird','connect','connected','start','then','disconnect','restart','list','describe'];(function(_0x4e41d1,_0x436a57){var _0x544de0=function(_0x27df99){while(--_0x27df99){_0x4e41d1['push'](_0x4e41d1['shift']());}};_0x544de0(++_0x436a57);}(_0x719c,0x9e));var _0xc719=function(_0x481317,_0x3397dd){_0x481317=_0x481317-0x0;var _0x1dfb20=_0x719c[_0x481317];return _0x1dfb20;};'use strict';var pm2=require(_0xc719('0x0'));var BPromise=require(_0xc719('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0xdf890c,_0x4326a5){return pm2[_0xc719('0x2')](function(_0x16c839){if(_0x16c839){return _0x4326a5(_0x16c839);}return _0xdf890c(_0xc719('0x3'));});});};exports[_0xc719('0x4')]=function(_0x11c8e8){return connect()[_0xc719('0x5')](function(){return new BPromise(function(_0x1f126b,_0x4556e5){return pm2['start'](_0x11c8e8,function(_0x110cfb,_0x34cdad){if(_0x110cfb){return _0x4556e5(_0x110cfb);}pm2[_0xc719('0x6')]();return _0x1f126b(_0x34cdad);});});});};exports['stop']=function(_0x27d509){return connect()[_0xc719('0x5')](function(){return new BPromise(function(_0x534417,_0x2a5946){return pm2['stop'](_0x27d509,function(_0x51b410,_0x29a2bb){if(_0x51b410){return _0x2a5946(_0x51b410);}pm2[_0xc719('0x6')]();return _0x534417(_0x29a2bb);});});});};exports['restart']=function(_0x5a6e48){return connect()['then'](function(){return new BPromise(function(_0x5b67d0,_0x240a18){return pm2[_0xc719('0x7')](_0x5a6e48,function(_0x1a7e61,_0x4c4a37){if(_0x1a7e61){return _0x240a18(_0x1a7e61);}pm2[_0xc719('0x6')]();return _0x5b67d0(_0x4c4a37);});});});};exports[_0xc719('0x8')]=function(){return connect()[_0xc719('0x5')](function(){return new BPromise(function(_0x508d29,_0x1160f9){return pm2[_0xc719('0x8')](function(_0x574be5,_0x4dbeef){if(_0x574be5){return _0x1160f9(_0x574be5);}pm2['disconnect']();return _0x508d29(_0x4dbeef);});});});};exports[_0xc719('0x9')]=function(_0x1053ff){return connect()[_0xc719('0x5')](function(){return new BPromise(function(_0x34694c,_0x11abce){return pm2['describe'](_0x1053ff,function(_0x108591,_0x544b5e){if(_0x108591){return _0x11abce(_0x108591);}pm2[_0xc719('0x6')]();return _0x34694c(_0x544b5e);});});});};exports['delete']=function(_0x59677e){return connect()[_0xc719('0x5')](function(){return new BPromise(function(_0x4d0c59,_0x25f758){return pm2['delete'](_0x59677e,function(_0x24b977,_0x4cb789){if(_0x24b977){return _0x25f758(_0x24b977);}pm2[_0xc719('0x6')]();return _0x4d0c59(_0x4cb789);});});});};exports[_0xc719('0xa')]=function(){return connect()[_0xc719('0x5')](function(){return new BPromise(function(_0xc7f8c,_0x1c8909){return pm2[_0xc719('0xa')](function(_0x4f30ff){if(_0x4f30ff){return _0x1c8909(_0x4f30ff);}return _0xc7f8c(_0xc719('0xb'));});});});}; \ No newline at end of file +var _0x6a43=['restart','list','describe','delete','dump','pm2','./config','connect','start','then','disconnect','stop'];(function(_0x49d610,_0x3b14e2){var _0x4c6a73=function(_0x2f3215){while(--_0x2f3215){_0x49d610['push'](_0x49d610['shift']());}};_0x4c6a73(++_0x3b14e2);}(_0x6a43,0x19d));var _0x36a4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x6a43[_0xf50820];return _0x2a9b10;};'use strict';var pm2=require(_0x36a4('0x0'));var BPromise=require('bluebird');var config=require(_0x36a4('0x1'));function connect(){return new BPromise(function(_0x42eaf7,_0x4501da){return pm2[_0x36a4('0x2')](function(_0x1bd844){if(_0x1bd844){return _0x4501da(_0x1bd844);}return _0x42eaf7('connected');});});};exports[_0x36a4('0x3')]=function(_0x32d197){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0xa87d6,_0x1f8025){return pm2[_0x36a4('0x3')](_0x32d197,function(_0xcadf01,_0xeacdbb){if(_0xcadf01){return _0x1f8025(_0xcadf01);}pm2[_0x36a4('0x5')]();return _0xa87d6(_0xeacdbb);});});});};exports[_0x36a4('0x6')]=function(_0x2cf13d){return connect()['then'](function(){return new BPromise(function(_0x1a6fb6,_0x1cf41b){return pm2[_0x36a4('0x6')](_0x2cf13d,function(_0x333e41,_0x3e51f6){if(_0x333e41){return _0x1cf41b(_0x333e41);}pm2[_0x36a4('0x5')]();return _0x1a6fb6(_0x3e51f6);});});});};exports[_0x36a4('0x7')]=function(_0x17bbc5){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0x3c1d0f,_0x257e1a){return pm2[_0x36a4('0x7')](_0x17bbc5,function(_0x31c62c,_0x1791b8){if(_0x31c62c){return _0x257e1a(_0x31c62c);}pm2[_0x36a4('0x5')]();return _0x3c1d0f(_0x1791b8);});});});};exports[_0x36a4('0x8')]=function(){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0x4f0a39,_0xfee391){return pm2[_0x36a4('0x8')](function(_0x5be769,_0x3101fd){if(_0x5be769){return _0xfee391(_0x5be769);}pm2[_0x36a4('0x5')]();return _0x4f0a39(_0x3101fd);});});});};exports[_0x36a4('0x9')]=function(_0x4c2773){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0x2eb376,_0x51307b){return pm2['describe'](_0x4c2773,function(_0x2482c8,_0x35e8bf){if(_0x2482c8){return _0x51307b(_0x2482c8);}pm2['disconnect']();return _0x2eb376(_0x35e8bf);});});});};exports['delete']=function(_0x49636a){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0x52147e,_0x57316e){return pm2[_0x36a4('0xa')](_0x49636a,function(_0xe5684a,_0xdb8e3c){if(_0xe5684a){return _0x57316e(_0xe5684a);}pm2[_0x36a4('0x5')]();return _0x52147e(_0xdb8e3c);});});});};exports[_0x36a4('0xb')]=function(){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0x20472e,_0x3020b5){return pm2['dump'](function(_0x2ec587){if(_0x2ec587){return _0x3020b5(_0x2ec587);}return _0x20472e('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 92b99d0..41a67c0 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 _0x8a92=['defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x8a92,0x14b));var _0x28a9=function(_0x4b0ef1,_0x18e525){_0x4b0ef1=_0x4b0ef1-0x0;var _0x1da2cc=_0x8a92[_0x4b0ef1];return _0x1da2cc;};'use strict';var _=require(_0x28a9('0x0'));var moment=require(_0x28a9('0x1'));var Redis=require(_0x28a9('0x2'));var util=require(_0x28a9('0x3'));var config=require(_0x28a9('0x4'));var db=require(_0x28a9('0x5'))['db'];var logger=require(_0x28a9('0x6'))(_0x28a9('0x7'));config[_0x28a9('0x8')]=_[_0x28a9('0x9')](config['redis'],{'host':_0x28a9('0xa'),'port':0x18eb});var io=require(_0x28a9('0xb'))(new Redis(config['redis']));function closeInteractions(){var _0x26607b=0x0;var _0x49c292=[];return db[_0x28a9('0xc')][_0x28a9('0xd')]({'raw':!![],'attributes':['id',_0x28a9('0xe')],'where':{'id':0x1}})['then'](function(_0x2d90b4){_0x26607b=_0x2d90b4[_0x28a9('0xe')];if(_0x26607b){return db[_0x28a9('0xf')]['findAll']({'raw':!![],'attributes':['id',_0x28a9('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x28a9('0x11')](_0x2d90b4[_0x28a9('0xe')],_0x28a9('0x12'))}}});}else{return[];}})[_0x28a9('0x13')](function(_0x58a377){if(_0x58a377&&_0x58a377[_0x28a9('0x14')]){_0x49c292=_[_0x28a9('0x15')](_0x58a377||[],'id');logger[_0x28a9('0x16')](_0x28a9('0x17'),_0x49c292['join']());return db[_0x28a9('0xf')][_0x28a9('0x18')]({'closeReason':_0x28a9('0x19'),'disposition':_0x28a9('0x1a'),'closed':!![],'closedAt':moment()[_0x28a9('0x1b')](_0x28a9('0x1c'))},{'where':{'id':_0x49c292}});}})['then'](function(){if(_0x49c292&&_0x49c292[_0x28a9('0x14')]){logger[_0x28a9('0x16')](_0x28a9('0x1d'),_0x49c292[_0x28a9('0x1e')]());for(var _0x46b68b=0x0;_0x46b68b<_0x49c292[_0x28a9('0x14')];_0x46b68b++){io['emit'](_0x28a9('0x1f'),{'id':_0x49c292[_0x46b68b],'closed':!![]});}}})['catch'](function(_0x51a8f3){logger['error'](_0x28a9('0x20'),_0x51a8f3?util[_0x28a9('0x21')](_0x51a8f3,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa37b=['moment','ioredis','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash'];(function(_0x2a3bf8,_0x4fbd0c){var _0x34b2ca=function(_0x694fb5){while(--_0x694fb5){_0x2a3bf8['push'](_0x2a3bf8['shift']());}};_0x34b2ca(++_0x4fbd0c);}(_0xa37b,0x16a));var _0xba37=function(_0x3fafb9,_0x5d6612){_0x3fafb9=_0x3fafb9-0x0;var _0xada4d4=_0xa37b[_0x3fafb9];return _0xada4d4;};'use strict';var _=require(_0xba37('0x0'));var moment=require(_0xba37('0x1'));var Redis=require(_0xba37('0x2'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xba37('0x3'))(_0xba37('0x4'));config[_0xba37('0x5')]=_[_0xba37('0x6')](config[_0xba37('0x5')],{'host':_0xba37('0x7'),'port':0x18eb});var io=require(_0xba37('0x8'))(new Redis(config[_0xba37('0x5')]));function closeInteractions(){var _0x48315b=0x0;var _0x5d553a=[];return db[_0xba37('0x9')][_0xba37('0xa')]({'raw':!![],'attributes':['id',_0xba37('0xb')],'where':{'id':0x1}})[_0xba37('0xc')](function(_0x70d59e){_0x48315b=_0x70d59e[_0xba37('0xb')];if(_0x48315b){return db['ChatInteraction'][_0xba37('0xd')]({'raw':!![],'attributes':['id',_0xba37('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xba37('0xf')](_0x70d59e[_0xba37('0xb')],_0xba37('0x10'))}}});}else{return[];}})[_0xba37('0xc')](function(_0x409707){if(_0x409707&&_0x409707[_0xba37('0x11')]){_0x5d553a=_['map'](_0x409707||[],'id');logger[_0xba37('0x12')](_0xba37('0x13'),_0x5d553a['join']());return db[_0xba37('0x14')][_0xba37('0x15')]({'closeReason':_0xba37('0x16'),'disposition':_0xba37('0x17'),'closed':!![],'closedAt':moment()[_0xba37('0x18')](_0xba37('0x19'))},{'where':{'id':_0x5d553a}});}})['then'](function(){if(_0x5d553a&&_0x5d553a[_0xba37('0x11')]){logger[_0xba37('0x12')](_0xba37('0x1a'),_0x5d553a['join']());for(var _0x5df616=0x0;_0x5df616<_0x5d553a['length'];_0x5df616++){io[_0xba37('0x1b')](_0xba37('0x1c'),{'id':_0x5d553a[_0x5df616],'closed':!![]});}}})[_0xba37('0x1d')](function(_0x44ee71){logger[_0xba37('0x1e')](_0xba37('0x1f'),_0x44ee71?util['inspect'](_0x44ee71,{'showHidden':![],'depth':null}):'');});}exports[_0xba37('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 6b3302a..220da8c 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 _0x1a84=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x1a84,0x7b));var _0x41a8=function(_0x20961b,_0x121bba){_0x20961b=_0x20961b-0x0;var _0x48ad1c=_0x1a84[_0x20961b];return _0x48ad1c;};'use strict';function start(){var _0x5cee53=require(_0x41a8('0x0'));return _0x5cee53['startAllRefreshIntervals']();}module[_0x41a8('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x8f4e=['startAllRefreshIntervals'];(function(_0x284d70,_0x4e5330){var _0x5a40f8=function(_0x5507e7){while(--_0x5507e7){_0x284d70['push'](_0x284d70['shift']());}};_0x5a40f8(++_0x4e5330);}(_0x8f4e,0x19f));var _0xe8f4=function(_0x545fb0,_0x17c087){_0x545fb0=_0x545fb0-0x0;var _0x355463=_0x8f4e[_0x545fb0];return _0x355463;};'use strict';function start(){var _0x4f6a20=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x4f6a20[_0xe8f4('0x0')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index b44848c..f46075c 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 _0x8f6d=['still\x20loading','data','Unrecognized\x20status:','entity','attempt','\x20Attempt\x20#:','dataValues','report\x20status:','isNil','subtractNumber','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','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','intersection','difference','length','exists','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','active','startAt','add','start','endAt','update','stop\x20cron','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','AnalyticExtractedReport','findOne','then','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','format','basename','zip','existsSync','Sent','attachments','text','status','message','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','SendMail','error\x20mail','stringify','catch','case\x20loading','currentAttempt','retryOptions','retries','job','operation','stop'];(function(_0x39d7b3,_0x243a2a){var _0x31d483=function(_0x2f953b){while(--_0x2f953b){_0x39d7b3['push'](_0x39d7b3['shift']());}};_0x31d483(++_0x243a2a);}(_0x8f6d,0x100));var _0xd8f6=function(_0x1104bb,_0x31fbda){_0x1104bb=_0x1104bb-0x0;var _0x1c1c47=_0x8f6d[_0x1104bb];return _0x1c1c47;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xd8f6('0x0'));var _=require('lodash');var moment=require(_0xd8f6('0x1'));var CronJobManager=require(_0xd8f6('0x2'));var jayson=require(_0xd8f6('0x3'));var BPromise=require(_0xd8f6('0x4'));var logger=require(_0xd8f6('0x5'))(_0xd8f6('0x6'));var db=require('../../mysqldb')['db'];const retry=require(_0xd8f6('0x7'));var analyticCustomReportController=require(_0xd8f6('0x8'));var analyticDefaultReportController=require(_0xd8f6('0x9'));var client=jayson['client'][_0xd8f6('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x2792fb){const _0x498c54={};if(typeof _0x2792fb==='number'){_0x498c54['id']=_0x2792fb;}return db[_0xd8f6('0xb')][_0xd8f6('0xc')]({'where':_0x498c54})[_0xd8f6('0xd')](function(_0xe6cc3d){return _0xe6cc3d;})['catch'](function(_0x6b5515){logger[_0xd8f6('0xe')](_0x6b5515);});}function handleSendEmail(_0x258ca8,_0xd08d34){logger[_0xd8f6('0xf')](_0xd8f6('0x10'),_0x258ca8[_0xd8f6('0x11')]);var _0x5af53a=!![];var _0x4eec79=_0x258ca8[_0xd8f6('0x12')]['getSmtpOptions']();var _0x104bc6={'account':_0x4eec79,'message':{'from':util['format'](_0xd8f6('0x13'),_0x258ca8['MailAccount'][_0xd8f6('0x14')],_0x258ca8['MailAccount']['email']||_0x258ca8['MailAccount'][_0xd8f6('0x15')][_0xd8f6('0x16')]),'to':_0x258ca8['email'],'cc':_0x258ca8['cc'],'bcc':_0x258ca8[_0xd8f6('0x17')],'subject':util['format'](_0xd8f6('0x18'),_0xd08d34[_0xd8f6('0x14')],_0x258ca8['subtractNumber'],_0x258ca8[_0xd8f6('0x19')])}};var _0x18d69a=path[_0xd8f6('0x1a')](__dirname,_0xd8f6('0x1b'));var _0xf62af7=_0xd08d34[_0xd8f6('0x1c')];var _0x470154=util[_0xd8f6('0x1d')]('%s.%s',path[_0xd8f6('0x1e')](_0xd08d34['savename'],path['extname'](_0xd08d34['savename'])),_0xd8f6('0x1f'));var _0x2dd4c0=path[_0xd8f6('0x1a')](_0x18d69a,_0xf62af7);var _0x449439=path[_0xd8f6('0x1a')](_0x18d69a,_0x470154);if(fs[_0xd8f6('0x20')](_0x2dd4c0)){_0xd08d34['status']=_0xd8f6('0x21');_0x104bc6['message'][_0xd8f6('0x22')]=[{'filename':_0xf62af7,'path':_0x2dd4c0}];_0x104bc6['message'][_0xd8f6('0x23')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0xd08d34,null,0x2));}else if(fs[_0xd8f6('0x20')](_0x449439)){_0xd08d34[_0xd8f6('0x24')]=_0xd8f6('0x21');_0x104bc6[_0xd8f6('0x25')]['attachments']=[{'filename':_0x470154,'path':_0x449439}];}else{if(_0xd08d34[_0xd8f6('0x24')]===_0xd8f6('0x26')){_0x104bc6[_0xd8f6('0x25')]['text']=_0xd8f6('0x27');if(!_0x258ca8[_0xd8f6('0x28')]){_0x5af53a=![];logger['info'](_0xd8f6('0x29'));}}else if(_0xd08d34[_0xd8f6('0x24')]===_0xd8f6('0x2a')){_0x104bc6[_0xd8f6('0x25')]['text']='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0xd08d34[_0xd8f6('0x24')]===_0xd8f6('0x2b')){_0x104bc6[_0xd8f6('0x25')][_0xd8f6('0x23')]=_0xd8f6('0x2c');}else if(_0xd08d34['status']===_0xd8f6('0x2d')){_0x104bc6[_0xd8f6('0x25')]['text']=_0xd8f6('0x2e');}else{logger['error']('[handleSendEmail]\x20Unrecognized\x20status:',_0xd08d34['status']);}}if(_0x5af53a){return client[_0xd8f6('0x2f')](_0xd8f6('0x30'),_0x104bc6)[_0xd8f6('0xd')](function(_0x588432){if(_0x588432[_0xd8f6('0xe')]){return logger[_0xd8f6('0xe')](_0xd8f6('0x31'),JSON[_0xd8f6('0x32')](_0x588432));}return logger['info']('email\x20sent');})[_0xd8f6('0x33')](function(_0x30899d){return logger[_0xd8f6('0xe')]('error\x20mail',JSON[_0xd8f6('0x32')](_0x30899d));});}}function handleError(){return function(_0x765e65){return logger['error'](JSON[_0xd8f6('0x32')](_0x765e65));};}function loading(_0x24c43e){logger[_0xd8f6('0xf')](_0xd8f6('0x34'));if(_0x24c43e[_0xd8f6('0x35')]===_0x24c43e[_0xd8f6('0x36')][_0xd8f6('0x37')]){handleSendEmail(_0x24c43e[_0xd8f6('0x38')],_0x24c43e['data']);_0x24c43e[_0xd8f6('0x39')][_0xd8f6('0x3a')]();}else{_0x24c43e[_0xd8f6('0x39')]['retry'](_0xd8f6('0x3b'));}}function completed(_0x330aad){logger[_0xd8f6('0xf')]('case\x20completed');handleSendEmail(_0x330aad['job'],_0x330aad[_0xd8f6('0x3c')]);_0x330aad[_0xd8f6('0x39')]['stop']();}function empty(_0x117e3f){logger[_0xd8f6('0xf')]('case\x20empty');handleSendEmail(_0x117e3f[_0xd8f6('0x38')],_0x117e3f['data']);_0x117e3f['operation'][_0xd8f6('0x3a')]();}function failed(_0x2eca1a){logger[_0xd8f6('0xf')]('case\x20failed');handleSendEmail(_0x2eca1a['job'],_0x2eca1a[_0xd8f6('0x3c')]);_0x2eca1a['operation'][_0xd8f6('0x3a')]();}function urecognized(_0x4103aa){logger[_0xd8f6('0xe')](_0xd8f6('0x3d'),_0x4103aa[_0xd8f6('0x3e')]['dataValues'][_0xd8f6('0x24')]);_0x4103aa[_0xd8f6('0x39')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x2b602c,_0xa9f1ee){const _0x377ab3={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x309978=retry['operation'](_0x377ab3);_0x309978[_0xd8f6('0x3f')](_0xc58e3a=>{logger[_0xd8f6('0xf')]('Job\x20ID\x20'+_0x2b602c['id']+_0xd8f6('0x40')+_0xc58e3a);try{getReportData(_0xa9f1ee['id'])['then'](function(_0x3d7667){_0xa9f1ee=_0x3d7667;logger[_0xd8f6('0xf')]('report\x20status:',_0x3d7667[_0xd8f6('0x41')]['status']);if(!reportStatusStrategies[_0x3d7667[_0xd8f6('0x41')][_0xd8f6('0x24')]]){logger[_0xd8f6('0xe')](_0xd8f6('0x42'),_0x3d7667[_0xd8f6('0x41')][_0xd8f6('0x24')]);_0x309978['retry']();}reportStatusStrategies[_0x3d7667[_0xd8f6('0x41')][_0xd8f6('0x24')]]({'operation':_0x309978,'currentAttempt':_0xc58e3a,'retryOptions':_0x377ab3,'job':_0x2b602c,'data':_0xa9f1ee,'entity':_0x3d7667});});}catch(_0x2884ca){_0x309978[_0xd8f6('0x7')](_0x2884ca);}});}function handleResult(_0x530140){return function(_0x1230e8){if(_0x530140['sendMail']&&_0x530140['MailAccount']&&_0x530140[_0xd8f6('0x12')][_0xd8f6('0x15')]&&!_['isNil'](_0x530140['email'])){retryer(_0x530140,_0x1230e8);}};}function handleJob(_0x1d3913){return function(){try{if(_[_0xd8f6('0x43')](_0x1d3913[_0xd8f6('0x44')])){return logger[_0xd8f6('0xf')](_0xd8f6('0x45'));}if(_[_0xd8f6('0x43')](_0x1d3913[_0xd8f6('0x19')])){return logger[_0xd8f6('0xf')](_0xd8f6('0x46'));}var _0x269dfb={'startDate':moment()[_0xd8f6('0x47')](_0x1d3913['subtractNumber'],_0x1d3913[_0xd8f6('0x19')])[_0xd8f6('0x1d')](_0xd8f6('0x48')),'endDate':moment()[_0xd8f6('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xd8f6('0x49'),'output':_0x1d3913[_0xd8f6('0x4a')],'name':_0x1d3913[_0xd8f6('0x14')]};if(!_[_0xd8f6('0x43')](_0x1d3913[_0xd8f6('0x4b')])){logger[_0xd8f6('0xf')](_0xd8f6('0x4c'),_0x1d3913['DefaultReportId']);return analyticDefaultReportController[_0xd8f6('0x4d')]({'id':_0x1d3913[_0xd8f6('0x4b')]},_0x269dfb)[_0xd8f6('0xd')](handleResult(_0x1d3913))[_0xd8f6('0x33')](handleError());}if(!_['isNil'](_0x1d3913['CustomReportId'])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x1d3913[_0xd8f6('0x4e')]);return analyticCustomReportController[_0xd8f6('0x4d')]({'id':_0x1d3913[_0xd8f6('0x4e')]},_0x269dfb)[_0xd8f6('0xd')](handleResult(_0x1d3913))[_0xd8f6('0x33')](handleError());}}catch(_0x29d648){logger['error'](JSON[_0xd8f6('0x32')](_0x29d648));}return logger[_0xd8f6('0xf')](_0xd8f6('0x4f'));};}function getJobs(_0x15c1b0){var _0x2ddaff={};if(_0x15c1b0){_0x2ddaff['id']=_0x15c1b0;}return db[_0xd8f6('0x50')][_0xd8f6('0x51')]({'where':_0x2ddaff,'include':[{'model':db[_0xd8f6('0x12')],'attributes':['id',_0xd8f6('0x14'),'email'],'include':[{'model':db[_0xd8f6('0x52')],'as':_0xd8f6('0x15'),'include':[{'model':db['CloudProvider'],'as':_0xd8f6('0x53')}]}]}]})[_0xd8f6('0xd')](function(_0x4d30d4){var _0x35dd44=_[_0xd8f6('0x54')](manager['jobs']);var _0x2c7ba7=_[_0xd8f6('0x55')](_0x4d30d4,function(_0x563a08){return _0x563a08['id'][_0xd8f6('0x56')]();});var _0x82c53e=_[_0xd8f6('0x57')](_0x4d30d4,function(_0x51bc67){return _0x51bc67['id'][_0xd8f6('0x56')]();});var _0x361a1d=_0x15c1b0?_0x2c7ba7:_['difference'](_0x2c7ba7,_0x35dd44);var _0x1fb907=_[_0xd8f6('0x58')](_0x2c7ba7,_0x35dd44);var _0x55d3e4=_[_0xd8f6('0x59')](_0x35dd44,_0x2c7ba7);var _0x4526fd;var _0x5c55b3;for(_0x4526fd=0x0;_0x4526fd<_0x55d3e4[_0xd8f6('0x5a')]&&!_0x15c1b0;_0x4526fd+=0x1){_0x5c55b3=_0x55d3e4[_0x4526fd][_0xd8f6('0x56')]();if(manager[_0xd8f6('0x5b')](_0x5c55b3)){manager['stop'](_0x5c55b3);manager[_0xd8f6('0x5c')](_0x5c55b3);logger[_0xd8f6('0xf')](_0xd8f6('0x5d'),_0x5c55b3);}}logger[_0xd8f6('0xf')](_0xd8f6('0x5e'),JSON[_0xd8f6('0x32')](_0x361a1d));for(_0x4526fd=0x0;_0x4526fd<_0x361a1d[_0xd8f6('0x5a')];_0x4526fd+=0x1){_0x5c55b3=_0x361a1d[_0x4526fd][_0xd8f6('0x56')]();if(_0x15c1b0){logger[_0xd8f6('0xf')](JSON[_0xd8f6('0x32')](_0x82c53e[_0x5c55b3]));BPromise[_0xd8f6('0x5f')]()[_0xd8f6('0xd')](handleJob(_0x82c53e[_0x5c55b3]));logger[_0xd8f6('0xf')](_0xd8f6('0x60'),_0x82c53e[_0x5c55b3][_0xd8f6('0x14')],_0x82c53e[_0x5c55b3][_0xd8f6('0x61')]);}else if(_0x82c53e[_0x5c55b3][_0xd8f6('0x61')]&&_0x82c53e[_0x5c55b3][_0xd8f6('0x62')]&&moment()['isBetween'](_0x82c53e[_0x5c55b3][_0xd8f6('0x63')],_0x82c53e[_0x5c55b3]['endAt'])){manager[_0xd8f6('0x64')](_0x5c55b3,_0x82c53e[_0x5c55b3][_0xd8f6('0x61')],handleJob(_0x82c53e[_0x5c55b3]));manager[_0xd8f6('0x65')](_0x5c55b3);logger['info']('add\x20cron',_0x82c53e[_0x5c55b3][_0xd8f6('0x14')],_0x82c53e[_0x5c55b3][_0xd8f6('0x61')]);}else if(manager[_0xd8f6('0x5b')](_0x5c55b3)){manager[_0xd8f6('0x3a')](_0x5c55b3);manager[_0xd8f6('0x5c')](_0x5c55b3);logger[_0xd8f6('0xf')]('stop\x20cron',_0x82c53e[_0x5c55b3][_0xd8f6('0x14')],_0x82c53e[_0x5c55b3]['cron']);}}for(_0x4526fd=0x0,_0x5c55b3;_0x4526fd<_0x1fb907[_0xd8f6('0x5a')]&&!_0x15c1b0;_0x4526fd+=0x1){_0x5c55b3=_0x1fb907[_0x4526fd][_0xd8f6('0x56')]();if(manager[_0xd8f6('0x5b')](_0x5c55b3)){if(_0x82c53e[_0x5c55b3][_0xd8f6('0x61')]&&_0x82c53e[_0x5c55b3][_0xd8f6('0x62')]&&moment()['isBetween'](_0x82c53e[_0x5c55b3][_0xd8f6('0x63')],_0x82c53e[_0x5c55b3][_0xd8f6('0x66')])){manager[_0xd8f6('0x67')](_0x5c55b3,_0x82c53e[_0x5c55b3][_0xd8f6('0x61')],handleJob(_0x82c53e[_0x5c55b3]));logger['info']('update\x20cron',_0x82c53e[_0x5c55b3][_0xd8f6('0x14')],_0x82c53e[_0x5c55b3]['cron']);}else{manager[_0xd8f6('0x3a')](_0x5c55b3);manager[_0xd8f6('0x5c')](_0x5c55b3);logger[_0xd8f6('0xf')](_0xd8f6('0x68'),_0x82c53e[_0x5c55b3][_0xd8f6('0x14')],_0x82c53e[_0x5c55b3][_0xd8f6('0x61')]);}}}})[_0xd8f6('0x33')](function(_0x19dd2a){logger['error'](JSON[_0xd8f6('0x32')](_0x19dd2a));});}exports['run']=function(_0x227fe3){return getJobs(_0x227fe3);};exports[_0xd8f6('0x65')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x871a=['path','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','findOne','error','info','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','join','../../files/reports','savename','%s.%s','extname','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','catch','error\x20mail','case\x20loading','currentAttempt','retryOptions','retries','job','data','operation','stop','still\x20loading','case\x20completed','case\x20empty','case\x20failed','Unrecognized\x20status:','attempt','Job\x20ID\x20','dataValues','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection','length','delete\x20cron','toRun','run\x20job','active','isBetween','startAt','endAt','add','cron','add\x20cron','exists','deleteJob','stop\x20cron','update','update\x20cron','run','start','util'];(function(_0x32745c,_0x24984a){var _0x45cb9d=function(_0xdf6de5){while(--_0xdf6de5){_0x32745c['push'](_0x32745c['shift']());}};_0x45cb9d(++_0x24984a);}(_0x871a,0xdb));var _0xa871=function(_0x197837,_0x439ae2){_0x197837=_0x197837-0x0;var _0x3eed5f=_0x871a[_0x197837];return _0x3eed5f;};'use strict';var fs=require('fs');var util=require(_0xa871('0x0'));var path=require(_0xa871('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0xa871('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0xa871('0x3'));var logger=require(_0xa871('0x4'))(_0xa871('0x5'));var db=require(_0xa871('0x6'))['db'];const retry=require(_0xa871('0x7'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xa871('0x8'));var client=jayson[_0xa871('0x9')][_0xa871('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0xa38209){const _0x2fa2ec={};if(typeof _0xa38209===_0xa871('0xb')){_0x2fa2ec['id']=_0xa38209;}return db[_0xa871('0xc')][_0xa871('0xd')]({'where':_0x2fa2ec})['then'](function(_0x2e2c08){return _0x2e2c08;})['catch'](function(_0x2701b9){logger[_0xa871('0xe')](_0x2701b9);});}function handleSendEmail(_0x310de9,_0x3a6952){logger[_0xa871('0xf')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x310de9[_0xa871('0x10')]);var _0x270766=!![];var _0x37408f=_0x310de9['MailAccount'][_0xa871('0x11')]();var _0xeb40f3={'account':_0x37408f,'message':{'from':util[_0xa871('0x12')](_0xa871('0x13'),_0x310de9[_0xa871('0x14')]['name'],_0x310de9['MailAccount'][_0xa871('0x10')]||_0x310de9[_0xa871('0x14')][_0xa871('0x15')][_0xa871('0x16')]),'to':_0x310de9[_0xa871('0x10')],'cc':_0x310de9['cc'],'bcc':_0x310de9[_0xa871('0x17')],'subject':util['format'](_0xa871('0x18'),_0x3a6952[_0xa871('0x19')],_0x310de9['subtractNumber'],_0x310de9['subtractUnit'])}};var _0xa663c6=path[_0xa871('0x1a')](__dirname,_0xa871('0x1b'));var _0x1c8db8=_0x3a6952[_0xa871('0x1c')];var _0x4f107d=util[_0xa871('0x12')](_0xa871('0x1d'),path['basename'](_0x3a6952[_0xa871('0x1c')],path[_0xa871('0x1e')](_0x3a6952['savename'])),'zip');var _0x46756b=path[_0xa871('0x1a')](_0xa663c6,_0x1c8db8);var _0x440606=path['join'](_0xa663c6,_0x4f107d);if(fs[_0xa871('0x1f')](_0x46756b)){_0x3a6952[_0xa871('0x20')]=_0xa871('0x21');_0xeb40f3[_0xa871('0x22')][_0xa871('0x23')]=[{'filename':_0x1c8db8,'path':_0x46756b}];_0xeb40f3[_0xa871('0x22')][_0xa871('0x24')]=util['format'](_0xa871('0x25'),JSON[_0xa871('0x26')](_0x3a6952,null,0x2));}else if(fs['existsSync'](_0x440606)){_0x3a6952[_0xa871('0x20')]=_0xa871('0x21');_0xeb40f3[_0xa871('0x22')]['attachments']=[{'filename':_0x4f107d,'path':_0x440606}];}else{if(_0x3a6952[_0xa871('0x20')]==='Empty'){_0xeb40f3[_0xa871('0x22')][_0xa871('0x24')]=_0xa871('0x27');if(!_0x310de9[_0xa871('0x28')]){_0x270766=![];logger[_0xa871('0xf')](_0xa871('0x29'));}}else if(_0x3a6952[_0xa871('0x20')]===_0xa871('0x2a')){_0xeb40f3[_0xa871('0x22')][_0xa871('0x24')]=_0xa871('0x2b');}else if(_0x3a6952[_0xa871('0x20')]===_0xa871('0x2c')){_0xeb40f3[_0xa871('0x22')][_0xa871('0x24')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x3a6952[_0xa871('0x20')]===_0xa871('0x2d')){_0xeb40f3[_0xa871('0x22')][_0xa871('0x24')]=_0xa871('0x2e');}else{logger[_0xa871('0xe')](_0xa871('0x2f'),_0x3a6952[_0xa871('0x20')]);}}if(_0x270766){return client[_0xa871('0x30')](_0xa871('0x31'),_0xeb40f3)['then'](function(_0xcde725){if(_0xcde725[_0xa871('0xe')]){return logger['error']('error\x20mail',JSON['stringify'](_0xcde725));}return logger[_0xa871('0xf')]('email\x20sent');})[_0xa871('0x32')](function(_0xa5e46f){return logger[_0xa871('0xe')](_0xa871('0x33'),JSON['stringify'](_0xa5e46f));});}}function handleError(){return function(_0x5b363e){return logger[_0xa871('0xe')](JSON[_0xa871('0x26')](_0x5b363e));};}function loading(_0x4e450c){logger[_0xa871('0xf')](_0xa871('0x34'));if(_0x4e450c[_0xa871('0x35')]===_0x4e450c[_0xa871('0x36')][_0xa871('0x37')]){handleSendEmail(_0x4e450c[_0xa871('0x38')],_0x4e450c[_0xa871('0x39')]);_0x4e450c[_0xa871('0x3a')][_0xa871('0x3b')]();}else{_0x4e450c['operation']['retry'](_0xa871('0x3c'));}}function completed(_0x26c5af){logger[_0xa871('0xf')](_0xa871('0x3d'));handleSendEmail(_0x26c5af['job'],_0x26c5af[_0xa871('0x39')]);_0x26c5af['operation'][_0xa871('0x3b')]();}function empty(_0x3d1128){logger[_0xa871('0xf')](_0xa871('0x3e'));handleSendEmail(_0x3d1128[_0xa871('0x38')],_0x3d1128[_0xa871('0x39')]);_0x3d1128[_0xa871('0x3a')]['stop']();}function failed(_0x20e0fa){logger[_0xa871('0xf')](_0xa871('0x3f'));handleSendEmail(_0x20e0fa[_0xa871('0x38')],_0x20e0fa[_0xa871('0x39')]);_0x20e0fa[_0xa871('0x3a')]['stop']();}function urecognized(_0x49d58f){logger[_0xa871('0xe')](_0xa871('0x40'),_0x49d58f['entity']['dataValues'][_0xa871('0x20')]);_0x49d58f[_0xa871('0x3a')][_0xa871('0x3b')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x55b2ce,_0x4e1b0c){const _0x411c3d={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x56b8c6=retry[_0xa871('0x3a')](_0x411c3d);_0x56b8c6[_0xa871('0x41')](_0xf7157f=>{logger[_0xa871('0xf')](_0xa871('0x42')+_0x55b2ce['id']+'\x20Attempt\x20#:'+_0xf7157f);try{getReportData(_0x4e1b0c['id'])['then'](function(_0x267cd8){_0x4e1b0c=_0x267cd8;logger[_0xa871('0xf')]('report\x20status:',_0x267cd8[_0xa871('0x43')][_0xa871('0x20')]);if(!reportStatusStrategies[_0x267cd8[_0xa871('0x43')][_0xa871('0x20')]]){logger[_0xa871('0xe')]('report\x20status:',_0x267cd8[_0xa871('0x43')][_0xa871('0x20')]);_0x56b8c6[_0xa871('0x7')]();}reportStatusStrategies[_0x267cd8[_0xa871('0x43')]['status']]({'operation':_0x56b8c6,'currentAttempt':_0xf7157f,'retryOptions':_0x411c3d,'job':_0x55b2ce,'data':_0x4e1b0c,'entity':_0x267cd8});});}catch(_0x1c3aaa){_0x56b8c6[_0xa871('0x7')](_0x1c3aaa);}});}function handleResult(_0x558c4c){return function(_0x3772bd){if(_0x558c4c['sendMail']&&_0x558c4c[_0xa871('0x14')]&&_0x558c4c['MailAccount'][_0xa871('0x15')]&&!_[_0xa871('0x44')](_0x558c4c[_0xa871('0x10')])){retryer(_0x558c4c,_0x3772bd);}};}function handleJob(_0x43f895){return function(){try{if(_['isNil'](_0x43f895[_0xa871('0x45')])){return logger[_0xa871('0xf')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xa871('0x44')](_0x43f895['subtractUnit'])){return logger[_0xa871('0xf')](_0xa871('0x46'));}var _0x4e1274={'startDate':moment()[_0xa871('0x47')](_0x43f895['subtractNumber'],_0x43f895[_0xa871('0x48')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xa871('0x12')](_0xa871('0x49')),'type':_0xa871('0x4a'),'output':_0x43f895[_0xa871('0x4b')],'name':_0x43f895[_0xa871('0x19')]};if(!_[_0xa871('0x44')](_0x43f895[_0xa871('0x4c')])){logger[_0xa871('0xf')]('exec\x20defaul\x20report\x20id:%s',_0x43f895[_0xa871('0x4c')]);return analyticDefaultReportController[_0xa871('0x4d')]({'id':_0x43f895[_0xa871('0x4c')]},_0x4e1274)[_0xa871('0x4e')](handleResult(_0x43f895))[_0xa871('0x32')](handleError());}if(!_[_0xa871('0x44')](_0x43f895['CustomReportId'])){logger[_0xa871('0xf')](_0xa871('0x4f'),_0x43f895[_0xa871('0x50')]);return analyticCustomReportController['runReport']({'id':_0x43f895[_0xa871('0x50')]},_0x4e1274)[_0xa871('0x4e')](handleResult(_0x43f895))[_0xa871('0x32')](handleError());}}catch(_0x3fa9c6){logger[_0xa871('0xe')](JSON[_0xa871('0x26')](_0x3fa9c6));}return logger[_0xa871('0xf')](_0xa871('0x51'));};}function getJobs(_0x1e38ba){var _0x5ee9fb={};if(_0x1e38ba){_0x5ee9fb['id']=_0x1e38ba;}return db[_0xa871('0x52')][_0xa871('0x53')]({'where':_0x5ee9fb,'include':[{'model':db[_0xa871('0x14')],'attributes':['id',_0xa871('0x19'),_0xa871('0x10')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xa871('0x54')}]}]}]})[_0xa871('0x4e')](function(_0xe62219){var _0x17e2a3=_[_0xa871('0x55')](manager[_0xa871('0x56')]);var _0x57c587=_[_0xa871('0x57')](_0xe62219,function(_0x46f3e6){return _0x46f3e6['id']['toString']();});var _0x1ed617=_[_0xa871('0x58')](_0xe62219,function(_0x35f38d){return _0x35f38d['id'][_0xa871('0x59')]();});var _0x374360=_0x1e38ba?_0x57c587:_[_0xa871('0x5a')](_0x57c587,_0x17e2a3);var _0x47bf28=_[_0xa871('0x5b')](_0x57c587,_0x17e2a3);var _0xf7c8=_[_0xa871('0x5a')](_0x17e2a3,_0x57c587);var _0x584efb;var _0x19a0da;for(_0x584efb=0x0;_0x584efb<_0xf7c8[_0xa871('0x5c')]&&!_0x1e38ba;_0x584efb+=0x1){_0x19a0da=_0xf7c8[_0x584efb][_0xa871('0x59')]();if(manager['exists'](_0x19a0da)){manager[_0xa871('0x3b')](_0x19a0da);manager['deleteJob'](_0x19a0da);logger[_0xa871('0xf')](_0xa871('0x5d'),_0x19a0da);}}logger['info'](_0xa871('0x5e'),JSON[_0xa871('0x26')](_0x374360));for(_0x584efb=0x0;_0x584efb<_0x374360[_0xa871('0x5c')];_0x584efb+=0x1){_0x19a0da=_0x374360[_0x584efb][_0xa871('0x59')]();if(_0x1e38ba){logger[_0xa871('0xf')](JSON[_0xa871('0x26')](_0x1ed617[_0x19a0da]));BPromise['resolve']()[_0xa871('0x4e')](handleJob(_0x1ed617[_0x19a0da]));logger[_0xa871('0xf')](_0xa871('0x5f'),_0x1ed617[_0x19a0da][_0xa871('0x19')],_0x1ed617[_0x19a0da]['cron']);}else if(_0x1ed617[_0x19a0da]['cron']&&_0x1ed617[_0x19a0da][_0xa871('0x60')]&&moment()[_0xa871('0x61')](_0x1ed617[_0x19a0da][_0xa871('0x62')],_0x1ed617[_0x19a0da][_0xa871('0x63')])){manager[_0xa871('0x64')](_0x19a0da,_0x1ed617[_0x19a0da][_0xa871('0x65')],handleJob(_0x1ed617[_0x19a0da]));manager['start'](_0x19a0da);logger['info'](_0xa871('0x66'),_0x1ed617[_0x19a0da][_0xa871('0x19')],_0x1ed617[_0x19a0da][_0xa871('0x65')]);}else if(manager[_0xa871('0x67')](_0x19a0da)){manager[_0xa871('0x3b')](_0x19a0da);manager[_0xa871('0x68')](_0x19a0da);logger[_0xa871('0xf')](_0xa871('0x69'),_0x1ed617[_0x19a0da][_0xa871('0x19')],_0x1ed617[_0x19a0da][_0xa871('0x65')]);}}for(_0x584efb=0x0,_0x19a0da;_0x584efb<_0x47bf28[_0xa871('0x5c')]&&!_0x1e38ba;_0x584efb+=0x1){_0x19a0da=_0x47bf28[_0x584efb][_0xa871('0x59')]();if(manager['exists'](_0x19a0da)){if(_0x1ed617[_0x19a0da][_0xa871('0x65')]&&_0x1ed617[_0x19a0da][_0xa871('0x60')]&&moment()['isBetween'](_0x1ed617[_0x19a0da][_0xa871('0x62')],_0x1ed617[_0x19a0da][_0xa871('0x63')])){manager[_0xa871('0x6a')](_0x19a0da,_0x1ed617[_0x19a0da][_0xa871('0x65')],handleJob(_0x1ed617[_0x19a0da]));logger['info'](_0xa871('0x6b'),_0x1ed617[_0x19a0da][_0xa871('0x19')],_0x1ed617[_0x19a0da][_0xa871('0x65')]);}else{manager['stop'](_0x19a0da);manager[_0xa871('0x68')](_0x19a0da);logger[_0xa871('0xf')](_0xa871('0x69'),_0x1ed617[_0x19a0da][_0xa871('0x19')],_0x1ed617[_0x19a0da][_0xa871('0x65')]);}}}})[_0xa871('0x32')](function(_0x1c2863){logger[_0xa871('0xe')](JSON['stringify'](_0x1c2863));});}exports[_0xa871('0x6c')]=function(_0x74e04){return getJobs(_0x74e04);};exports[_0xa871('0x6d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index a655ca9..6de8328 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 _0x5525=['inspect','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','data1','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','Negative','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','push'];(function(_0x5099ee,_0x331450){var _0x5e72b9=function(_0x3a04b7){while(--_0x3a04b7){_0x5099ee['push'](_0x5099ee['shift']());}};_0x5e72b9(++_0x331450);}(_0x5525,0xd1));var _0x5552=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5525[_0x321bb2];return _0x9c12ed;};var _=require(_0x5552('0x0'));var AWS=require(_0x5552('0x1'));var rp=require(_0x5552('0x2'));var util=require(_0x5552('0x3'));var BPromise=require(_0x5552('0x4'));var db=require(_0x5552('0x5'))['db'];var logger=require(_0x5552('0x6'))('transcribe');function getTranscriptionJob(_0x285566,_0x1a52e2,_0x5bc6fe,_0x28ce98){return new Promise(function(_0x3fe1fb,_0x96ff0a){var _0x1ce9f6=new AWS[(_0x5552('0x7'))]({'accessKeyId':_0x1a52e2,'secretAccessKey':_0x285566,'region':_0x5bc6fe});_0x1ce9f6[_0x5552('0x8')]({'TranscriptionJobName':_0x28ce98},function(_0x164626,_0x25a789){if(_0x164626){return _0x96ff0a(_0x164626);}else{return _0x3fe1fb(_0x25a789);}});});}function sentiment(_0x547022,_0x272ca1,_0x568e10,_0x12880a,_0x4aaf71){return new Promise(function(_0x364d20,_0x51075e){var _0x47d924=new AWS[(_0x5552('0x9'))]({'accessKeyId':_0x272ca1,'secretAccessKey':_0x547022,'region':_0x568e10});_0x47d924['detectSentiment']({'Text':_0x12880a,'LanguageCode':_0x4aaf71[_0x5552('0xa')](0x0,0x2)},function(_0x92444a,_0x237c11){if(_0x92444a){return _0x51075e(_0x92444a);}else{return _0x364d20(_0x237c11);}});});}function checkTranscribeJob(_0x37aff3,_0x2a183a,_0x4ee81a){var _0x194ca5;return new BPromise(function(_0x48b39e,_0x4e8550){logger[_0x5552('0xb')](util[_0x5552('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x37aff3['id'],_0x37aff3['transcribeName']));return getTranscriptionJob(_0x4ee81a[_0x5552('0xd')],_0x4ee81a[_0x5552('0xe')],_0x2a183a[_0x5552('0xf')],_0x37aff3[_0x5552('0x10')])[_0x5552('0x11')](function(_0x36b6e1){logger[_0x5552('0xb')](util[_0x5552('0xc')](_0x5552('0x12'),_0x37aff3['id'],_0x37aff3['transcribeName'],_0x36b6e1[_0x5552('0x13')][_0x5552('0x14')]));if(!_0x37aff3['fileText']){switch(_0x36b6e1['TranscriptionJob']['TranscriptionJobStatus']){case _0x5552('0x15'):var _0x5b1642={'transcribeStatus':_0x36b6e1['TranscriptionJob'][_0x5552('0x14')],'fileUri':_0x36b6e1[_0x5552('0x13')]['Transcript'][_0x5552('0x16')]};logger['info'](util[_0x5552('0xc')](_0x5552('0x17'),_0x37aff3['id']));return rp({'uri':_0x36b6e1['TranscriptionJob']['Transcript'][_0x5552('0x16')],'json':!![]})[_0x5552('0x11')](function(_0x4cc6e2){logger[_0x5552('0xb')](util[_0x5552('0xc')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x37aff3['id']));if(_0x4cc6e2&&_0x4cc6e2[_0x5552('0x18')]&&_0x4cc6e2[_0x5552('0x18')][_0x5552('0x19')]&&_0x4cc6e2[_0x5552('0x18')][_0x5552('0x19')][_0x5552('0x1a')]){_0x5b1642[_0x5552('0x1b')]='';for(var _0x59ad39=0x0;_0x59ad39<_0x4cc6e2[_0x5552('0x18')][_0x5552('0x19')][_0x5552('0x1a')];_0x59ad39++){_0x5b1642[_0x5552('0x1b')]+=_0x4cc6e2[_0x5552('0x18')][_0x5552('0x19')][_0x59ad39][_0x5552('0x1c')]+'';}}return _0x37aff3[_0x5552('0x1d')](_0x5b1642);})[_0x5552('0x11')](function(){logger['info'](util['format'](_0x5552('0x1e'),_0x37aff3['id']));if(!_0x37aff3[_0x5552('0x1f')]){throw new db[(_0x5552('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2a183a[_0x5552('0x21')]||!_0x2a183a['sentimentAccountId']||!_0x2a183a[_0x5552('0x22')]||!_0x2a183a[_0x5552('0x23')]||!_0x2a183a[_0x5552('0x24')]){throw new db[(_0x5552('0x20'))][(_0x5552('0x25'))](_0x5552('0x26'));}if(!_0x5b1642[_0x5552('0x1b')]){throw new Error(_0x5552('0x27'));}if(_0x2a183a[_0x5552('0x28')]===_0x4ee81a['id']){return _0x4ee81a;}else{return db[_0x5552('0x29')][_0x5552('0x2a')]({'where':{'id':_settings[_0x5552('0x28')]}});}})[_0x5552('0x11')](function(_0x3b9a1b){if(!_0x3b9a1b){throw new db[(_0x5552('0x20'))]['ValidationError'](_0x5552('0x2b'));}if(!_0x3b9a1b['data1']||!_0x3b9a1b[_0x5552('0xe')]){throw new db[(_0x5552('0x20'))][(_0x5552('0x25'))](_0x5552('0x2c'));}_0x194ca5=_0x3b9a1b;logger[_0x5552('0xb')](util[_0x5552('0xc')](_0x5552('0x2d'),_0x37aff3['id']));return sentiment(_0x194ca5['data1'],_0x194ca5[_0x5552('0xe')],_0x2a183a[_0x5552('0x22')],_0x5b1642[_0x5552('0x1b')],_0x2a183a['language']);})[_0x5552('0x11')](function(_0x2abf70){logger[_0x5552('0xb')](util['format'](_0x5552('0x2e'),_0x37aff3['id']));return _0x37aff3['update']({'sentiment':_0x2abf70[_0x5552('0x2f')],'sPositive':_0x2abf70[_0x5552('0x30')][_0x5552('0x31')],'sNegative':_0x2abf70['SentimentScore']['Negative'],'sMixed':_0x2abf70['SentimentScore'][_0x5552('0x32')],'sNeutral':_0x2abf70[_0x5552('0x30')][_0x5552('0x33')]});})[_0x5552('0x11')](function(){logger['info'](util['format'](_0x5552('0x1e'),_0x37aff3['id']));_0x48b39e();});case'FAILED':return _0x37aff3['update']({'transcribeStatus':_0x5552('0x34'),'failureReason':_0x36b6e1[_0x5552('0x13')]['FailureReason']})[_0x5552('0x11')](function(){logger[_0x5552('0xb')](util[_0x5552('0xc')](_0x5552('0x1e'),_0x37aff3['id']));_0x48b39e();});default:logger[_0x5552('0xb')](util[_0x5552('0xc')](_0x5552('0x35'),_0x37aff3['id']));break;}}else{return BPromise['resolve']()[_0x5552('0x11')](function(){if(!_0x37aff3[_0x5552('0x1f')]){throw new db[(_0x5552('0x20'))][(_0x5552('0x25'))](_0x5552('0x36'));}if(!_0x2a183a[_0x5552('0x21')]||!_0x2a183a[_0x5552('0x28')]||!_0x2a183a[_0x5552('0x22')]||!_0x2a183a[_0x5552('0x23')]||!_0x2a183a[_0x5552('0x24')]){throw new db[(_0x5552('0x20'))][(_0x5552('0x25'))](_0x5552('0x26'));}if(!_0x37aff3[_0x5552('0x1b')]){throw new Error(_0x5552('0x27'));}if(_0x2a183a[_0x5552('0x28')]===_0x4ee81a['id']){return _0x4ee81a;}else{return db['CloudProvider'][_0x5552('0x2a')]({'where':{'id':_settings[_0x5552('0x28')]}});}})[_0x5552('0x11')](function(_0x2bac4d){if(!_0x2bac4d){throw new db[(_0x5552('0x20'))][(_0x5552('0x25'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2bac4d['data1']||!_0x2bac4d[_0x5552('0xe')]){throw new db['Sequelize'][(_0x5552('0x25'))](_0x5552('0x2c'));}_0x194ca5=_0x2bac4d;logger[_0x5552('0xb')](util[_0x5552('0xc')](_0x5552('0x2d'),_0x37aff3['id']));return sentiment(_0x194ca5[_0x5552('0xd')],_0x194ca5[_0x5552('0xe')],_0x2a183a[_0x5552('0x22')],_0x37aff3[_0x5552('0x1b')],_0x2a183a[_0x5552('0x23')]);})[_0x5552('0x11')](function(_0x3ab548){logger[_0x5552('0xb')](util[_0x5552('0xc')](_0x5552('0x2e'),_0x37aff3['id']));return _0x37aff3[_0x5552('0x1d')]({'sentiment':_0x3ab548[_0x5552('0x2f')],'sPositive':_0x3ab548['SentimentScore'][_0x5552('0x31')],'sNegative':_0x3ab548['SentimentScore'][_0x5552('0x37')],'sMixed':_0x3ab548[_0x5552('0x30')][_0x5552('0x32')],'sNeutral':_0x3ab548[_0x5552('0x30')][_0x5552('0x33')],'transcribeStatus':'COMPLETED'});})[_0x5552('0x11')](function(){logger[_0x5552('0xb')](util[_0x5552('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x37aff3['id']));_0x48b39e();});}})[_0x5552('0x38')](function(_0x471d0c){if(_0x471d0c){if(!_0x471d0c[_0x5552('0x39')]||_0x471d0c[_0x5552('0x39')]!=='SequelizeValidationError'){logger['error'](util[_0x5552('0xc')](_0x5552('0x3a'),_0x37aff3['id']),util['inspect'](_0x471d0c,{'showHidden':![],'depth':null}));}}_0x48b39e();});});}function checkTranscribe(){var _0x425538;var _0x2fcebd;var _0x20118a;return db[_0x5552('0x3b')]['findAll']({'where':{'transcribeStatus':_0x5552('0x3c')}})[_0x5552('0x11')](function(_0x1d083d){if(!_0x1d083d||!_0x1d083d[_0x5552('0x1a')]){throw new db['Sequelize'][(_0x5552('0x25'))](_0x5552('0x3d'));}_0x425538=_0x1d083d;return db[_0x5552('0x3e')][_0x5552('0x2a')]({'where':{'id':0x1}});})[_0x5552('0x11')](function(_0x5ce5d9){if(!_0x5ce5d9){throw new db[(_0x5552('0x20'))][(_0x5552('0x25'))](_0x5552('0x3f'));}_0x2fcebd=_0x5ce5d9;if(!_0x2fcebd[_0x5552('0x40')]||!_0x2fcebd[_0x5552('0x41')]||!_0x2fcebd[_0x5552('0xf')]||!_0x2fcebd['language']||!_0x2fcebd[_0x5552('0x24')]){throw new db[(_0x5552('0x20'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x5552('0x29')][_0x5552('0x2a')]({'where':{'id':_0x2fcebd['transcribeAccountId']}});})[_0x5552('0x11')](function(_0x2cd4eb){if(!_0x2cd4eb){throw new db[(_0x5552('0x20'))][(_0x5552('0x25'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2cd4eb['data1']||!_0x2cd4eb[_0x5552('0xe')]){throw new db[(_0x5552('0x20'))][(_0x5552('0x25'))](_0x5552('0x2c'));}_0x20118a=_0x2cd4eb;var _0x123f8b=[];_0x425538['forEach'](function(_0x628df1){_0x123f8b[_0x5552('0x42')](checkTranscribeJob(_0x628df1,_0x2fcebd,_0x20118a));});return BPromise['all'](_0x123f8b);})['catch'](function(_0xdd090){if(_0xdd090){if(!_0xdd090[_0x5552('0x39')]||_0xdd090[_0x5552('0x39')]!=='SequelizeValidationError'){logger['error'](util[_0x5552('0x43')](_0xdd090,{'showHidden':![],'depth':null}));}}});}exports[_0x5552('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xb9a7=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Transcribe\x20not\x20configured','transcribeAccountId','push','all','catch','aws-sdk','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','bucket','Sequelize','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','format','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','resolve','Sentiment\x20Analysis\x20not\x20configured'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0xb9a7,0x112));var _0x7b9a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb9a7[_0x17b6e3];return _0x3906f3;};var _=require('lodash');var AWS=require(_0x7b9a('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0x7b9a('0x1'))['db'];var logger=require('../../config/logger')(_0x7b9a('0x2'));function getTranscriptionJob(_0x40ef7d,_0x37b25b,_0x24cae3,_0x5cd5da){return new Promise(function(_0xf6dae2,_0x22764f){var _0x7019fd=new AWS[(_0x7b9a('0x3'))]({'accessKeyId':_0x37b25b,'secretAccessKey':_0x40ef7d,'region':_0x24cae3});_0x7019fd[_0x7b9a('0x4')]({'TranscriptionJobName':_0x5cd5da},function(_0x4d3f20,_0x43d8e2){if(_0x4d3f20){return _0x22764f(_0x4d3f20);}else{return _0xf6dae2(_0x43d8e2);}});});}function sentiment(_0x3e84f1,_0x56a199,_0x511e28,_0x47e220,_0x15bc5b){return new Promise(function(_0x31f3b7,_0x4cf090){var _0x32c85d=new AWS['Comprehend']({'accessKeyId':_0x56a199,'secretAccessKey':_0x3e84f1,'region':_0x511e28});_0x32c85d[_0x7b9a('0x5')]({'Text':_0x47e220,'LanguageCode':_0x15bc5b['substring'](0x0,0x2)},function(_0x3af176,_0x1584a2){if(_0x3af176){return _0x4cf090(_0x3af176);}else{return _0x31f3b7(_0x1584a2);}});});}function checkTranscribeJob(_0x291591,_0x5948ca,_0x32f616){var _0xec5949;return new BPromise(function(_0x5e3875,_0x67553c){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x7'),_0x291591['id'],_0x291591[_0x7b9a('0x8')]));return getTranscriptionJob(_0x32f616[_0x7b9a('0x9')],_0x32f616[_0x7b9a('0xa')],_0x5948ca[_0x7b9a('0xb')],_0x291591[_0x7b9a('0x8')])[_0x7b9a('0xc')](function(_0x35e602){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0xd'),_0x291591['id'],_0x291591['transcribeName'],_0x35e602[_0x7b9a('0xe')][_0x7b9a('0xf')]));if(!_0x291591[_0x7b9a('0x10')]){switch(_0x35e602[_0x7b9a('0xe')][_0x7b9a('0xf')]){case _0x7b9a('0x11'):var _0x27ad55={'transcribeStatus':_0x35e602[_0x7b9a('0xe')][_0x7b9a('0xf')],'fileUri':_0x35e602[_0x7b9a('0xe')][_0x7b9a('0x12')][_0x7b9a('0x13')]};logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x14'),_0x291591['id']));return rp({'uri':_0x35e602['TranscriptionJob'][_0x7b9a('0x12')]['TranscriptFileUri'],'json':!![]})[_0x7b9a('0xc')](function(_0x331ae6){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x15'),_0x291591['id']));if(_0x331ae6&&_0x331ae6[_0x7b9a('0x16')]&&_0x331ae6['results'][_0x7b9a('0x17')]&&_0x331ae6[_0x7b9a('0x16')][_0x7b9a('0x17')][_0x7b9a('0x18')]){_0x27ad55[_0x7b9a('0x10')]='';for(var _0x5b2f52=0x0;_0x5b2f52<_0x331ae6[_0x7b9a('0x16')][_0x7b9a('0x17')]['length'];_0x5b2f52++){_0x27ad55[_0x7b9a('0x10')]+=_0x331ae6['results'][_0x7b9a('0x17')][_0x5b2f52][_0x7b9a('0x19')]+'';}}return _0x291591['update'](_0x27ad55);})['then'](function(){logger[_0x7b9a('0x6')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x291591['id']));if(!_0x291591[_0x7b9a('0x1a')]){throw new db['Sequelize']['ValidationError'](_0x7b9a('0x1b'));}if(!_0x5948ca['sentiment']||!_0x5948ca[_0x7b9a('0x1c')]||!_0x5948ca[_0x7b9a('0x1d')]||!_0x5948ca['language']||!_0x5948ca[_0x7b9a('0x1e')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x27ad55[_0x7b9a('0x10')]){throw new Error(_0x7b9a('0x21'));}if(_0x5948ca[_0x7b9a('0x1c')]===_0x32f616['id']){return _0x32f616;}else{return db[_0x7b9a('0x22')][_0x7b9a('0x23')]({'where':{'id':_settings[_0x7b9a('0x1c')]}});}})['then'](function(_0x4aa495){if(!_0x4aa495){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x24'));}if(!_0x4aa495['data1']||!_0x4aa495[_0x7b9a('0xa')]){throw new db[(_0x7b9a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xec5949=_0x4aa495;logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x291591['id']));return sentiment(_0xec5949[_0x7b9a('0x9')],_0xec5949[_0x7b9a('0xa')],_0x5948ca[_0x7b9a('0x1d')],_0x27ad55[_0x7b9a('0x10')],_0x5948ca[_0x7b9a('0x26')]);})['then'](function(_0x46bcd0){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')](_0x7b9a('0x27'),_0x291591['id']));return _0x291591[_0x7b9a('0x28')]({'sentiment':_0x46bcd0[_0x7b9a('0x29')],'sPositive':_0x46bcd0['SentimentScore']['Positive'],'sNegative':_0x46bcd0[_0x7b9a('0x2a')][_0x7b9a('0x2b')],'sMixed':_0x46bcd0['SentimentScore'][_0x7b9a('0x2c')],'sNeutral':_0x46bcd0[_0x7b9a('0x2a')][_0x7b9a('0x2d')]});})['then'](function(){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x291591['id']));_0x5e3875();});case'FAILED':return _0x291591[_0x7b9a('0x28')]({'transcribeStatus':_0x7b9a('0x2e'),'failureReason':_0x35e602[_0x7b9a('0xe')][_0x7b9a('0x2f')]})[_0x7b9a('0xc')](function(){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')](_0x7b9a('0x30'),_0x291591['id']));_0x5e3875();});default:logger['info'](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x291591['id']));break;}}else{return BPromise[_0x7b9a('0x31')]()[_0x7b9a('0xc')](function(){if(!_0x291591[_0x7b9a('0x1a')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x1b'));}if(!_0x5948ca['sentiment']||!_0x5948ca[_0x7b9a('0x1c')]||!_0x5948ca[_0x7b9a('0x1d')]||!_0x5948ca[_0x7b9a('0x26')]||!_0x5948ca[_0x7b9a('0x1e')]){throw new db['Sequelize'][(_0x7b9a('0x20'))](_0x7b9a('0x32'));}if(!_0x291591[_0x7b9a('0x10')]){throw new Error(_0x7b9a('0x21'));}if(_0x5948ca['sentimentAccountId']===_0x32f616['id']){return _0x32f616;}else{return db[_0x7b9a('0x22')]['findOne']({'where':{'id':_settings[_0x7b9a('0x1c')]}});}})[_0x7b9a('0xc')](function(_0x432e44){if(!_0x432e44){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x24'));}if(!_0x432e44['data1']||!_0x432e44[_0x7b9a('0xa')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0xec5949=_0x432e44;logger['info'](util[_0x7b9a('0x25')](_0x7b9a('0x33'),_0x291591['id']));return sentiment(_0xec5949[_0x7b9a('0x9')],_0xec5949[_0x7b9a('0xa')],_0x5948ca[_0x7b9a('0x1d')],_0x291591[_0x7b9a('0x10')],_0x5948ca['language']);})['then'](function(_0x5c9eac){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x291591['id']));return _0x291591[_0x7b9a('0x28')]({'sentiment':_0x5c9eac[_0x7b9a('0x29')],'sPositive':_0x5c9eac[_0x7b9a('0x2a')]['Positive'],'sNegative':_0x5c9eac[_0x7b9a('0x2a')]['Negative'],'sMixed':_0x5c9eac[_0x7b9a('0x2a')][_0x7b9a('0x2c')],'sNeutral':_0x5c9eac[_0x7b9a('0x2a')][_0x7b9a('0x2d')],'transcribeStatus':_0x7b9a('0x11')});})['then'](function(){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x30'),_0x291591['id']));_0x5e3875();});}})['catch'](function(_0x4f1b2e){if(_0x4f1b2e){if(!_0x4f1b2e[_0x7b9a('0x34')]||_0x4f1b2e[_0x7b9a('0x34')]!==_0x7b9a('0x35')){logger[_0x7b9a('0x36')](util[_0x7b9a('0x25')](_0x7b9a('0x37'),_0x291591['id']),util[_0x7b9a('0x38')](_0x4f1b2e,{'showHidden':![],'depth':null}));}}_0x5e3875();});});}function checkTranscribe(){var _0x31506d;var _0x1d034b;var _0x5088c7;return db[_0x7b9a('0x39')][_0x7b9a('0x3a')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x5dd42d){if(!_0x5dd42d||!_0x5dd42d[_0x7b9a('0x18')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x3b'));}_0x31506d=_0x5dd42d;return db['Setting'][_0x7b9a('0x23')]({'where':{'id':0x1}});})[_0x7b9a('0xc')](function(_0x287dea){if(!_0x287dea){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))]('Settings\x20not\x20available');}_0x1d034b=_0x287dea;if(!_0x1d034b[_0x7b9a('0x2')]||!_0x1d034b['transcribeAccountId']||!_0x1d034b[_0x7b9a('0xb')]||!_0x1d034b[_0x7b9a('0x26')]||!_0x1d034b[_0x7b9a('0x1e')]){throw new db[(_0x7b9a('0x1f'))]['ValidationError'](_0x7b9a('0x3c'));}return db[_0x7b9a('0x22')][_0x7b9a('0x23')]({'where':{'id':_0x1d034b[_0x7b9a('0x3d')]}});})[_0x7b9a('0xc')](function(_0x3e2f1b){if(!_0x3e2f1b){throw new db[(_0x7b9a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x3e2f1b['data1']||!_0x3e2f1b[_0x7b9a('0xa')]){throw new db[(_0x7b9a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x5088c7=_0x3e2f1b;var _0x58527d=[];_0x31506d['forEach'](function(_0x7c800f){_0x58527d[_0x7b9a('0x3e')](checkTranscribeJob(_0x7c800f,_0x1d034b,_0x5088c7));});return BPromise[_0x7b9a('0x3f')](_0x58527d);})[_0x7b9a('0x40')](function(_0x34f552){if(_0x34f552){if(!_0x34f552[_0x7b9a('0x34')]||_0x34f552[_0x7b9a('0x34')]!==_0x7b9a('0x35')){logger['error'](util[_0x7b9a('0x38')](_0x34f552,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 33c37f1..fa5958f 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 _0x4436=['info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','length','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','subtract','then','map'];(function(_0x325572,_0x6b0b5b){var _0x31af17=function(_0x610e95){while(--_0x610e95){_0x325572['push'](_0x325572['shift']());}};_0x31af17(++_0x6b0b5b);}(_0x4436,0x7c));var _0x6443=function(_0x24c7f0,_0x327044){_0x24c7f0=_0x24c7f0-0x0;var _0x549790=_0x4436[_0x24c7f0];return _0x549790;};'use strict';var _=require(_0x6443('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require('util');var config=require(_0x6443('0x1'));var db=require(_0x6443('0x2'))['db'];var logger=require('../logger')('schedule');config[_0x6443('0x3')]=_[_0x6443('0x4')](config[_0x6443('0x3')],{'host':_0x6443('0x5'),'port':0x18eb});var io=require(_0x6443('0x6'))(new Redis(config[_0x6443('0x3')]));function closeInteractions(){var _0xb30de5=[];return db[_0x6443('0x7')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6443('0x8')](0x18,'hours')}}})[_0x6443('0x9')](function(_0x25ef50){if(_0x25ef50&&_0x25ef50['length']){_0xb30de5=_[_0x6443('0xa')](_0x25ef50||[],'id');logger[_0x6443('0xb')](_0x6443('0xc'),_0xb30de5[_0x6443('0xd')]());return db[_0x6443('0x7')]['update']({'closeReason':_0x6443('0xe'),'disposition':_0x6443('0xf'),'closed':!![],'closedAt':moment()[_0x6443('0x10')](_0x6443('0x11'))},{'where':{'id':_0xb30de5}});}})[_0x6443('0x9')](function(){if(_0xb30de5&&_0xb30de5['length']){logger[_0x6443('0xb')](_0x6443('0x12'),_0xb30de5[_0x6443('0xd')]());for(var _0x351b10=0x0;_0x351b10<_0xb30de5[_0x6443('0x13')];_0x351b10++){io[_0x6443('0x14')](_0x6443('0x15'),{'id':_0xb30de5[_0x351b10],'closed':!![]});}}})[_0x6443('0x16')](function(_0x58e694){logger[_0x6443('0x17')](_0x6443('0x18'),_0x58e694?util[_0x6443('0x19')](_0x58e694,{'showHidden':![],'depth':null}):'');});}exports[_0x6443('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9bbf=['info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','schedule','defaults','redis','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','system','timeout','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x9bbf,0x15d));var _0xf9bb=function(_0x39d2e5,_0x2b4e52){_0x39d2e5=_0x39d2e5-0x0;var _0x94c0b3=_0x9bbf[_0x39d2e5];return _0x94c0b3;};'use strict';var _=require(_0xf9bb('0x0'));var moment=require(_0xf9bb('0x1'));var Redis=require(_0xf9bb('0x2'));var util=require(_0xf9bb('0x3'));var config=require('../../config/environment');var db=require(_0xf9bb('0x4'))['db'];var logger=require('../logger')(_0xf9bb('0x5'));config['redis']=_[_0xf9bb('0x6')](config[_0xf9bb('0x7')],{'host':_0xf9bb('0x8'),'port':0x18eb});var io=require(_0xf9bb('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x42cdea=[];return db['WhatsappInteraction'][_0xf9bb('0xa')]({'raw':!![],'attributes':['id',_0xf9bb('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf9bb('0xc')](0x18,_0xf9bb('0xd'))}}})[_0xf9bb('0xe')](function(_0x2559f4){if(_0x2559f4&&_0x2559f4[_0xf9bb('0xf')]){_0x42cdea=_[_0xf9bb('0x10')](_0x2559f4||[],'id');logger['info'](_0xf9bb('0x11'),_0x42cdea[_0xf9bb('0x12')]());return db[_0xf9bb('0x13')]['update']({'closeReason':_0xf9bb('0x14'),'disposition':_0xf9bb('0x15'),'closed':!![],'closedAt':moment()['format'](_0xf9bb('0x16'))},{'where':{'id':_0x42cdea}});}})['then'](function(){if(_0x42cdea&&_0x42cdea['length']){logger[_0xf9bb('0x17')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x42cdea[_0xf9bb('0x12')]());for(var _0x1bb352=0x0;_0x1bb352<_0x42cdea[_0xf9bb('0xf')];_0x1bb352++){io[_0xf9bb('0x18')](_0xf9bb('0x19'),{'id':_0x42cdea[_0x1bb352],'closed':!![]});}}})[_0xf9bb('0x1a')](function(_0x2a652a){logger[_0xf9bb('0x1b')](_0xf9bb('0x1c'),_0x2a652a?util[_0xf9bb('0x1d')](_0x2a652a,{'showHidden':![],'depth':null}):'');});}exports[_0xf9bb('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 8b83c20..f9c9e4e 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2633=['Biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','util','../mysqldb','push','innocenzo.biondo','@xcally.com','now','Innocenzo'];(function(_0x5cc19c,_0x36d946){var _0x3fab24=function(_0x49f30e){while(--_0x49f30e){_0x5cc19c['push'](_0x5cc19c['shift']());}};_0x3fab24(++_0x36d946);}(_0x2633,0xca));var _0x3263=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x2633[_0x46aff0];return _0x9d78cf;};'use strict';var util=require(_0x3263('0x0'));var db=require(_0x3263('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3263('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x3263('0x3')+i+_0x3263('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3263('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3263('0x5')](),'updatedAt':Date[_0x3263('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x3263('0x6')+i,'lastName':_0x3263('0x7')+i,'phone':0xf879fb460+i,'email':_0x3263('0x3')+i+_0x3263('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x3263('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3263('0x5')](),'updatedAt':Date[_0x3263('0x5')]()});}db[_0x3263('0x8')][_0x3263('0x9')]({'where':{}})[_0x3263('0xa')](function(){return db[_0x3263('0x8')][_0x3263('0xb')](contacts);})[_0x3263('0xa')](function(){console[_0x3263('0xc')](_0x3263('0xd'),_0x3263('0xe'));return db[_0x3263('0xf')][_0x3263('0x9')]({'where':{}});})[_0x3263('0xa')](function(){return db[_0x3263('0xf')][_0x3263('0xb')](hopper);})[_0x3263('0xa')](function(){console['log'](_0x3263('0xd'),_0x3263('0x10'));return db[_0x3263('0x8')]['bulkCreate'](contacts2);})[_0x3263('0xa')](function(){console[_0x3263('0xc')]('finished\x20populating',_0x3263('0x11'));return db[_0x3263('0xf')]['bulkCreate'](hopper2);})[_0x3263('0xa')](function(){console[_0x3263('0xc')]('finished\x20populating',_0x3263('0x12'));})['catch'](function(_0x13afa4){console['log'](_0x13afa4);}); \ No newline at end of file +var _0xa978=['push','innocenzo.biondo','CmContact','destroy','bulkCreate','then','log','contacts1','CmHopper','finished\x20populating','contacts2','catch','Innocenzo','Biondo','@xcally.com','now'];(function(_0xbc1624,_0x41e527){var _0x5ef458=function(_0x56697e){while(--_0x56697e){_0xbc1624['push'](_0xbc1624['shift']());}};_0x5ef458(++_0x41e527);}(_0xa978,0x1ec));var _0x8a97=function(_0x52aed2,_0x1e6c18){_0x52aed2=_0x52aed2-0x0;var _0x3bed79=_0xa978[_0x52aed2];return _0x3bed79;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x8a97('0x0')+i,'lastName':_0x8a97('0x1')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x8a97('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x8a97('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x8a97('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8a97('0x4')]({'id':i,'firstName':_0x8a97('0x0')+i,'lastName':_0x8a97('0x1')+i,'phone':0xf879fb460+i,'email':_0x8a97('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x8a97('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8a97('0x3')](),'updatedAt':Date[_0x8a97('0x3')]()});}db[_0x8a97('0x6')][_0x8a97('0x7')]({'where':{}})['then'](function(){return db['CmContact'][_0x8a97('0x8')](contacts);})[_0x8a97('0x9')](function(){console[_0x8a97('0xa')]('finished\x20populating',_0x8a97('0xb'));return db[_0x8a97('0xc')][_0x8a97('0x7')]({'where':{}});})[_0x8a97('0x9')](function(){return db['CmHopper'][_0x8a97('0x8')](hopper);})[_0x8a97('0x9')](function(){console[_0x8a97('0xa')](_0x8a97('0xd'),'hopper1');return db[_0x8a97('0x6')][_0x8a97('0x8')](contacts2);})[_0x8a97('0x9')](function(){console[_0x8a97('0xa')](_0x8a97('0xd'),_0x8a97('0xe'));return db['CmHopper'][_0x8a97('0x8')](hopper2);})[_0x8a97('0x9')](function(){console['log']('finished\x20populating','hopper2');})[_0x8a97('0xf')](function(_0x2b8184){console[_0x8a97('0xa')](_0x2b8184);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3c22e73..deb0516 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8296=['then','catch','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','wss','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate'];(function(_0x56f4f2,_0x2fd8c0){var _0x2a27e1=function(_0xa4498f){while(--_0xa4498f){_0x56f4f2['push'](_0x56f4f2['shift']());}};_0x2a27e1(++_0x2fd8c0);}(_0x8296,0xc9));var _0x6829=function(_0x23bc96,_0x282ed4){_0x23bc96=_0x23bc96-0x0;var _0x4b244e=_0x8296[_0x23bc96];return _0x4b244e;};'use strict';var util=require(_0x6829('0x0'));var db=require(_0x6829('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6829('0x2')]({'name':util[_0x6829('0x3')](_0x6829('0x4'),'agent',i),'fullname':util[_0x6829('0x3')](_0x6829('0x4'),_0x6829('0x5'),i),'email':util[_0x6829('0x3')](_0x6829('0x6'),_0x6829('0x5'),i),'role':'agent','password':_0x6829('0x7'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x6829('0x8')],'disallow':['all'],'allow':[_0x6829('0x9')],'defaultuser':util[_0x6829('0x3')](_0x6829('0x4'),_0x6829('0x5'),i),'encryption':_0x6829('0xa'),'avpf':_0x6829('0xa'),'force_avp':_0x6829('0xa'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x6829('0xb'),'dtlssetup':_0x6829('0xc'),'callerid':util[_0x6829('0x3')]('\x22%s\x22\x20<%s>',util[_0x6829('0x3')](_0x6829('0x4'),_0x6829('0x5'),i),0xfa0+i)});}db[_0x6829('0xd')][_0x6829('0xe')](users)[_0x6829('0xf')](function(){console['log']('add\x20user');})[_0x6829('0x10')](function(_0x48881c){console[_0x6829('0x11')](_0x48881c);}); \ No newline at end of file +var _0x5a3d=['log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5a3d,0xc9));var _0xd5a3=function(_0x54ebbb,_0x2c7983){_0x54ebbb=_0x54ebbb-0x0;var _0x210b1e=_0x5a3d[_0x54ebbb];return _0x210b1e;};'use strict';var util=require('util');var db=require(_0xd5a3('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd5a3('0x1')]({'name':util[_0xd5a3('0x2')](_0xd5a3('0x3'),_0xd5a3('0x4'),i),'fullname':util[_0xd5a3('0x2')](_0xd5a3('0x3'),_0xd5a3('0x4'),i),'email':util['format'](_0xd5a3('0x5'),_0xd5a3('0x4'),i),'role':_0xd5a3('0x4'),'password':_0xd5a3('0x6'),'internal':0xfa0+i,'type':_0xd5a3('0x7'),'transport':[_0xd5a3('0x8'),'ws','wss'],'disallow':[_0xd5a3('0x9')],'allow':[_0xd5a3('0xa')],'defaultuser':util[_0xd5a3('0x2')]('%s%s',_0xd5a3('0x4'),i),'encryption':_0xd5a3('0xb'),'avpf':'yes','force_avp':_0xd5a3('0xb'),'icesupport':_0xd5a3('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xd5a3('0xc'),'callerid':util[_0xd5a3('0x2')](_0xd5a3('0xd'),util['format'](_0xd5a3('0x3'),_0xd5a3('0x4'),i),0xfa0+i)});}db[_0xd5a3('0xe')]['bulkCreate'](users)['then'](function(){console[_0xd5a3('0xf')](_0xd5a3('0x10'));})[_0xd5a3('0x11')](function(_0x991336){console[_0xd5a3('0xf')](_0x991336);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index ed55adb..948f3a5 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x826c=['removeWhatsappInteractions','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','log','nsp','disconnect','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','MailQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','map','where','telephone','Campaign','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','format','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','FaxQueues','FaxQueue','SmsQueue','OpenchannelQueues','IvrCampaigns','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','openchannel','whatsapp','telephone:%s','campaign:%s:%s','user_has_chat_interactions:remove','leave','MailInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove'];(function(_0x398cf3,_0x430256){var _0x2e7fff=function(_0x36c2ae){while(--_0x36c2ae){_0x398cf3['push'](_0x398cf3['shift']());}};_0x2e7fff(++_0x430256);}(_0x826c,0xc8));var _0xc826=function(_0x399f23,_0x5e44c5){_0x399f23=_0x399f23-0x0;var _0x59e58b=_0x826c[_0x399f23];return _0x59e58b;};'use strict';var _=require(_0xc826('0x0'));var util=require(_0xc826('0x1'));var BPromise=require(_0xc826('0x2'));var db=require(_0xc826('0x3'))['db'];var config=require(_0xc826('0x4'));var queryQueues={'attributes':['id',_0xc826('0x5')],'include':[{'as':_0xc826('0x6'),'model':db[_0xc826('0x7')],'attributes':['id',_0xc826('0x5'),_0xc826('0x8')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc826('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xc826('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xc826('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc826('0x5'),_0xc826('0xa')],'where':{'type':_0xc826('0xb')}};function getAssociatedResources(_0x3d3f80,_0x3ece3f,_0x50a96b){return db[_0xc826('0xc')][_0xc826('0xd')]({'where':{'name':_0x3d3f80,'userProfileId':_0x3ece3f},'raw':!![]})[_0xc826('0xe')](function(_0x5c315c){if(_0x5c315c){if(_0x5c315c[_0xc826('0xf')]){switch(_0x3d3f80){case'VoiceQueues':case _0xc826('0x10'):case'FaxQueues':case'SmsQueues':case _0xc826('0x11'):case'OpenchannelQueues':case _0xc826('0x12'):return db[_0x50a96b][_0xc826('0x13')](queryQueues);case _0xc826('0x14'):return db[_0x50a96b][_0xc826('0x13')](queryTelephones);case'Trunks':return db[_0x50a96b][_0xc826('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x50a96b][_0xc826('0x13')](queryCampaigns);}}else{return db[_0xc826('0x15')][_0xc826('0x13')]({'attributes':[_0xc826('0x16')],'where':{'sectionId':_0x5c315c['id']},'raw':!![]})[_0xc826('0xe')](function(_0x3cd94c){if(_0x3cd94c){var _0x3e1bd1={'where':{'id':_[_0xc826('0x17')](_0x3cd94c,'resourceId')},'raw':!![]};switch(_0x50a96b){case _0xc826('0x7'):_0x3e1bd1[_0xc826('0x18')]['role']=_0xc826('0x19');break;case _0xc826('0x1a'):_0x3e1bd1[_0xc826('0x18')][_0xc826('0xa')]=_0xc826('0xb');break;}return db[_0x50a96b][_0xc826('0x13')](_0x3e1bd1);}else{return[];}});}}else{return[];}})[_0xc826('0xe')](function(_0x55fba7){return _0x55fba7;});}function joinOrLeaveQueues(_0x1949bf,_0x2eeeb3,_0x2b7b3d,_0x4d02f1){_0x1949bf[_0x2eeeb3](util['format']('%s:queue:%s',_0x2b7b3d,_0x4d02f1[_0xc826('0x5')]));if(_0x4d02f1[_0xc826('0x6')]){for(var _0x2423f5=0x0;_0x2423f5<_0x4d02f1[_0xc826('0x6')][_0xc826('0x1b')];_0x2423f5+=0x1){_0x1949bf[_0x2eeeb3](util['format'](_0xc826('0x1c'),_0x4d02f1[_0xc826('0x6')][_0x2423f5][_0xc826('0x5')]));}}}function joinOrLeave(_0x18bb5b,_0x428e5f,_0x146a7e){var _0x3cd7d6;if(_0x18bb5b[_0xc826('0x1d')][_0xc826('0x1e')]['id']){db['User'][_0xc826('0x1f')]({'attributes':['id',_0xc826('0x5'),'role',_0xc826('0x20')],'where':{'id':_0x18bb5b['handshake'][_0xc826('0x1e')]['id']},'include':[{'model':db[_0xc826('0x21')],'as':_0xc826('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xc826('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xc826('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xc826('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc826('0x26')],'as':_0xc826('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xc826('0x28'),'attributes':['id'],'raw':!![]}]})[_0xc826('0xe')](function(_0x5e269){if(_0x5e269){_0x3cd7d6=_0x5e269;_0x18bb5b[_0x428e5f](util[_0xc826('0x29')](_0xc826('0x1c'),_0x5e269['name']));var _0x332000=[];switch(_0x5e269[_0xc826('0x8')]){case _0xc826('0x2a'):_0x18bb5b[_0x428e5f](_0xc826('0x2b'));_0x18bb5b[_0x428e5f](_0xc826('0x2c'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0xc826('0x2d')];}_0x332000[_0xc826('0x2e')](db[_0xc826('0x2f')][_0xc826('0x13')](queryQueues));_0x332000[_0xc826('0x2e')](db[_0xc826('0x30')][_0xc826('0x13')](queryQueues));_0x332000[_0xc826('0x2e')](db['FaxQueue']['findAll'](queryQueues));_0x332000[_0xc826('0x2e')](db['SmsQueue'][_0xc826('0x13')](queryQueues));_0x332000['push'](db[_0xc826('0x31')]['findAll'](queryQueues));_0x332000[_0xc826('0x2e')](db[_0xc826('0x32')][_0xc826('0x13')](queryQueues));_0x332000[_0xc826('0x2e')](db[_0xc826('0x33')]['findAll'](queryQueues));_0x332000[_0xc826('0x2e')](db['User'][_0xc826('0x13')](queryTelephones));_0x332000[_0xc826('0x2e')](db[_0xc826('0x34')][_0xc826('0x13')](queryTrunks));_0x332000[_0xc826('0x2e')](db[_0xc826('0x1a')][_0xc826('0x13')](queryCampaigns));_0x332000['push'](db[_0xc826('0x7')][_0xc826('0x13')](queryAgents));break;case _0xc826('0x35'):_0x18bb5b[_0x428e5f](_0xc826('0x2b'));_0x18bb5b[_0x428e5f](_0xc826('0x2c'));_0x332000[_0xc826('0x2e')](getAssociatedResources('VoiceQueues',_0x5e269[_0xc826('0x20')],'VoiceQueue'));_0x332000['push'](getAssociatedResources('ChatQueues',_0x5e269[_0xc826('0x20')],_0xc826('0x30')));_0x332000[_0xc826('0x2e')](getAssociatedResources(_0xc826('0x36'),_0x5e269[_0xc826('0x20')],_0xc826('0x37')));_0x332000['push'](getAssociatedResources('SmsQueues',_0x5e269[_0xc826('0x20')],_0xc826('0x38')));_0x332000[_0xc826('0x2e')](getAssociatedResources(_0xc826('0x11'),_0x5e269[_0xc826('0x20')],_0xc826('0x31')));_0x332000[_0xc826('0x2e')](getAssociatedResources(_0xc826('0x39'),_0x5e269[_0xc826('0x20')],'OpenchannelQueue'));_0x332000[_0xc826('0x2e')](getAssociatedResources(_0xc826('0x12'),_0x5e269['userProfileId'],'WhatsappQueue'));_0x332000[_0xc826('0x2e')](getAssociatedResources(_0xc826('0x14'),_0x5e269[_0xc826('0x20')],_0xc826('0x7')));_0x332000[_0xc826('0x2e')](getAssociatedResources('Trunks',_0x5e269[_0xc826('0x20')],_0xc826('0x34')));_0x332000[_0xc826('0x2e')](getAssociatedResources(_0xc826('0x3a'),_0x5e269[_0xc826('0x20')],_0xc826('0x1a')));_0x332000[_0xc826('0x2e')](db[_0xc826('0x7')]['findAll'](queryAgents));break;case _0xc826('0x9'):_0x18bb5b[_0x428e5f](_0xc826('0x2b'));_0x18bb5b[_0x428e5f](_0xc826('0x2c'));_0x332000[_0xc826('0x2e')](_0x5e269['getVoiceQueues']({'attributes':['id',_0xc826('0x5')]}));_0x332000[_0xc826('0x2e')](_0x5e269[_0xc826('0x3b')]({'attributes':['id','name']}));_0x332000[_0xc826('0x2e')](_0x5e269[_0xc826('0x3c')]({'attributes':['id',_0xc826('0x5')]}));_0x332000[_0xc826('0x2e')](_0x5e269[_0xc826('0x3d')]({'attributes':['id',_0xc826('0x5')]}));_0x332000[_0xc826('0x2e')](_0x5e269['getMailQueues']({'attributes':['id',_0xc826('0x5')]}));_0x332000[_0xc826('0x2e')](_0x5e269[_0xc826('0x3e')]({'attributes':['id','name']}));_0x332000[_0xc826('0x2e')](_0x5e269[_0xc826('0x3f')]({'attributes':['id',_0xc826('0x5')]}));break;}return BPromise[_0xc826('0x40')](_0x332000);}})[_0xc826('0xe')](function(_0xcc7c2){if(_0xcc7c2&&_0xcc7c2['length']){for(var _0x375613=0x0;_0x375613<_0xcc7c2['length'];_0x375613+=0x1){for(var _0x432d99=0x0;_0x432d99<_0xcc7c2[_0x375613][_0xc826('0x1b')];_0x432d99+=0x1){switch(_0x375613){case 0x0:joinOrLeaveQueues(_0x18bb5b,_0x428e5f,_0xc826('0x41'),_0xcc7c2[_0x375613][_0x432d99]);break;case 0x1:joinOrLeaveQueues(_0x18bb5b,_0x428e5f,_0xc826('0x42'),_0xcc7c2[_0x375613][_0x432d99]);break;case 0x2:joinOrLeaveQueues(_0x18bb5b,_0x428e5f,'fax',_0xcc7c2[_0x375613][_0x432d99]);break;case 0x3:joinOrLeaveQueues(_0x18bb5b,_0x428e5f,'sms',_0xcc7c2[_0x375613][_0x432d99]);break;case 0x4:joinOrLeaveQueues(_0x18bb5b,_0x428e5f,'mail',_0xcc7c2[_0x375613][_0x432d99]);break;case 0x5:joinOrLeaveQueues(_0x18bb5b,_0x428e5f,_0xc826('0x43'),_0xcc7c2[_0x375613][_0x432d99]);break;case 0x6:joinOrLeaveQueues(_0x18bb5b,_0x428e5f,_0xc826('0x44'),_0xcc7c2[_0x375613][_0x432d99]);break;case 0x7:if(_0x3cd7d6[_0xc826('0x8')]!=='agent')_0x18bb5b[_0x428e5f](util[_0xc826('0x29')](_0xc826('0x45'),_0xcc7c2[_0x375613][_0x432d99]['name']));break;case 0x8:if(_0x3cd7d6[_0xc826('0x8')]!==_0xc826('0x9'))_0x18bb5b[_0x428e5f](util[_0xc826('0x29')]('trunk:%s',_0xcc7c2[_0x375613][_0x432d99]['name']));break;case 0x9:if(_0x3cd7d6[_0xc826('0x8')]!=='agent')_0x18bb5b[_0x428e5f](util[_0xc826('0x29')](_0xc826('0x46'),_0xcc7c2[_0x375613][_0x432d99][_0xc826('0xa')],_0xcc7c2[_0x375613][_0x432d99][_0xc826('0x5')]));break;case 0xa:_0x18bb5b[_0x428e5f](util[_0xc826('0x29')](_0xc826('0x1c'),_0xcc7c2[_0x375613][_0x432d99][_0xc826('0x5')]));break;}}}}})[_0xc826('0xe')](function(){if(_0x428e5f==='leave'){var _0x34ec9a=_[_0xc826('0x17')](_0x3cd7d6[_0xc826('0x22')],'id');return _0x3cd7d6['removeChatInteractions'](_0x34ec9a)[_0xc826('0xe')](function(){for(var _0xe91f20=0x0;_0xe91f20<_0x34ec9a[_0xc826('0x1b')];_0xe91f20+=0x1){_0x146a7e['emit'](_0xc826('0x47'),{'ChatInteractionId':Number(_0x34ec9a[_0xe91f20]),'UserId':Number(_0x3cd7d6['id'])});}});}})['then'](function(){if(_0x428e5f===_0xc826('0x48')){var _0x5b1634=_['map'](_0x3cd7d6[_0xc826('0x49')],'id');return _0x3cd7d6[_0xc826('0x4a')](_0x5b1634)['then'](function(){for(var _0x43ccd7=0x0;_0x43ccd7<_0x5b1634[_0xc826('0x1b')];_0x43ccd7+=0x1){_0x146a7e[_0xc826('0x4b')](_0xc826('0x4c'),{'MailInteractionId':Number(_0x5b1634[_0x43ccd7]),'UserId':Number(_0x3cd7d6['id'])});}});}})[_0xc826('0xe')](function(){if(_0x428e5f===_0xc826('0x48')){var _0x1572c8=_['map'](_0x3cd7d6['FaxInteractions'],'id');return _0x3cd7d6[_0xc826('0x4d')](_0x1572c8)[_0xc826('0xe')](function(){for(var _0x1c5fc3=0x0;_0x1c5fc3<_0x1572c8[_0xc826('0x1b')];_0x1c5fc3+=0x1){_0x146a7e[_0xc826('0x4b')](_0xc826('0x4e'),{'FaxInteractionId':Number(_0x1572c8[_0x1c5fc3]),'UserId':Number(_0x3cd7d6['id'])});}});}})[_0xc826('0xe')](function(){if(_0x428e5f===_0xc826('0x48')){var _0x45ecfb=_[_0xc826('0x17')](_0x3cd7d6['SmsInteractions'],'id');return _0x3cd7d6[_0xc826('0x4f')](_0x45ecfb)[_0xc826('0xe')](function(){for(var _0x335ab4=0x0;_0x335ab4<_0x45ecfb[_0xc826('0x1b')];_0x335ab4+=0x1){_0x146a7e[_0xc826('0x4b')](_0xc826('0x50'),{'SmsInteractionId':Number(_0x45ecfb[_0x335ab4]),'UserId':Number(_0x3cd7d6['id'])});}});}})[_0xc826('0xe')](function(){if(_0x428e5f==='leave'){var _0x31fbcf=_[_0xc826('0x17')](_0x3cd7d6[_0xc826('0x27')],'id');return _0x3cd7d6['removeOpenchannelInteractions'](_0x31fbcf)[_0xc826('0xe')](function(){for(var _0x1c1a22=0x0;_0x1c1a22<_0x31fbcf[_0xc826('0x1b')];_0x1c1a22+=0x1){_0x146a7e[_0xc826('0x4b')](_0xc826('0x51'),{'OpenchannelInteractionId':Number(_0x31fbcf[_0x1c1a22]),'UserId':Number(_0x3cd7d6['id'])});}});}})['then'](function(){if(_0x428e5f===_0xc826('0x48')){var _0x2c0dc9=_[_0xc826('0x17')](_0x3cd7d6['WhatsappInteractions'],'id');return _0x3cd7d6[_0xc826('0x52')](_0x2c0dc9)[_0xc826('0xe')](function(){for(var _0xf2fb1a=0x0;_0xf2fb1a<_0x2c0dc9['length'];_0xf2fb1a+=0x1){_0x146a7e['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2c0dc9[_0xf2fb1a]),'UserId':Number(_0x3cd7d6['id'])});}});}})['catch'](function(_0x18c9ed){_0x18bb5b['log'](_0x18c9ed);});}}function onDisconnect(_0x2169ab,_0x4efb42){joinOrLeave(_0x2169ab,'leave',_0x4efb42);}function onConnect(_0x57a6fa){joinOrLeave(_0x57a6fa,_0xc826('0x53'));}exports[_0xc826('0x54')]=function(_0x1842a5){_0x1842a5['on'](_0xc826('0x55'),function(_0x228836){_0x228836[_0xc826('0x56')](0x0);_0x228836[_0xc826('0x57')]=_0x228836[_0xc826('0x58')][_0xc826('0x55')][_0xc826('0x59')]+':'+_0x228836[_0xc826('0x58')][_0xc826('0x55')][_0xc826('0x5a')];_0x228836['connectedAt']=new Date();_0x228836[_0xc826('0x5b')]=function(_0x59a5f3){console[_0xc826('0x5b')]('SocketIO\x20'+_0x228836[_0xc826('0x5c')][_0xc826('0x5')]+'['+_0x228836['address']+']',_0x59a5f3);};_0x228836['on'](_0xc826('0x5d'),function(){onDisconnect(_0x228836,_0x1842a5);_0x228836[_0xc826('0x5b')]('DISCONNECTED');});onConnect(_0x228836);_0x228836[_0xc826('0x5b')]('CONNECTED');});}; \ No newline at end of file +var _0xeec6=['OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','request','remotePort','connectedAt','SocketIO\x20','nsp','address','DISCONNECTED','lodash','../mysqldb','./environment','name','Agents','role','telephone','agent','type','findOne','autoAssociation','VoiceQueues','MailQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','User','where','Campaign','ivr','then','format','%s:queue:%s','handshake','query','userProfileId','ChatInteractions','MailInteraction','MailInteractions','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','user:%s','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','getVoiceQueues','getFaxQueues','getSmsQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xeec6,0x125));var _0x6eec=function(_0x3e779c,_0x546ea2){_0x3e779c=_0x3e779c-0x0;var _0x22ab11=_0xeec6[_0x3e779c];return _0x22ab11;};'use strict';var _=require(_0x6eec('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x6eec('0x1'))['db'];var config=require(_0x6eec('0x2'));var queryQueues={'attributes':['id',_0x6eec('0x3')],'include':[{'as':_0x6eec('0x4'),'model':db['User'],'attributes':['id',_0x6eec('0x3'),_0x6eec('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6eec('0x3')],'where':{'role':_0x6eec('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x6eec('0x3')],'where':{'role':_0x6eec('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6eec('0x3'),_0x6eec('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x1205a7,_0x392e0a,_0x422d71){return db['UserProfileSection'][_0x6eec('0x9')]({'where':{'name':_0x1205a7,'userProfileId':_0x392e0a},'raw':!![]})['then'](function(_0x13d892){if(_0x13d892){if(_0x13d892[_0x6eec('0xa')]){switch(_0x1205a7){case _0x6eec('0xb'):case'ChatQueues':case'FaxQueues':case'SmsQueues':case _0x6eec('0xc'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x422d71]['findAll'](queryQueues);case _0x6eec('0xd'):return db[_0x422d71][_0x6eec('0xe')](queryTelephones);case _0x6eec('0xf'):return db[_0x422d71]['findAll'](queryTrunks);case _0x6eec('0x10'):return db[_0x422d71][_0x6eec('0xe')](queryCampaigns);}}else{return db[_0x6eec('0x11')][_0x6eec('0xe')]({'attributes':['resourceId'],'where':{'sectionId':_0x13d892['id']},'raw':!![]})['then'](function(_0x3fb003){if(_0x3fb003){var _0x43947e={'where':{'id':_[_0x6eec('0x12')](_0x3fb003,_0x6eec('0x13'))},'raw':!![]};switch(_0x422d71){case _0x6eec('0x14'):_0x43947e[_0x6eec('0x15')][_0x6eec('0x5')]=_0x6eec('0x6');break;case _0x6eec('0x16'):_0x43947e[_0x6eec('0x15')]['type']=_0x6eec('0x17');break;}return db[_0x422d71][_0x6eec('0xe')](_0x43947e);}else{return[];}});}}else{return[];}})[_0x6eec('0x18')](function(_0x5f3b6d){return _0x5f3b6d;});}function joinOrLeaveQueues(_0x5af05a,_0xd2927c,_0x5f3704,_0x389457){_0x5af05a[_0xd2927c](util[_0x6eec('0x19')](_0x6eec('0x1a'),_0x5f3704,_0x389457[_0x6eec('0x3')]));if(_0x389457[_0x6eec('0x4')]){for(var _0x240030=0x0;_0x240030<_0x389457['Agents']['length'];_0x240030+=0x1){_0x5af05a[_0xd2927c](util['format']('user:%s',_0x389457[_0x6eec('0x4')][_0x240030][_0x6eec('0x3')]));}}}function joinOrLeave(_0x59fcbe,_0x2489c2,_0x4d91d9){var _0x36cd69;if(_0x59fcbe[_0x6eec('0x1b')][_0x6eec('0x1c')]['id']){db['User']['find']({'attributes':['id',_0x6eec('0x3'),'role',_0x6eec('0x1d')],'where':{'id':_0x59fcbe[_0x6eec('0x1b')][_0x6eec('0x1c')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x6eec('0x1e'),'attributes':['id'],'raw':!![]},{'model':db[_0x6eec('0x1f')],'as':_0x6eec('0x20'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x6eec('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x6eec('0x22')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x6eec('0x23'),'attributes':['id'],'raw':!![]}]})[_0x6eec('0x18')](function(_0x4b862c){if(_0x4b862c){_0x36cd69=_0x4b862c;_0x59fcbe[_0x2489c2](util[_0x6eec('0x19')](_0x6eec('0x24'),_0x4b862c[_0x6eec('0x3')]));var _0x1759d2=[];switch(_0x4b862c[_0x6eec('0x5')]){case'admin':_0x59fcbe[_0x2489c2](_0x6eec('0x25'));_0x59fcbe[_0x2489c2](_0x6eec('0x26'));if(queryQueues[_0x6eec('0x27')](_0x6eec('0x28'))){delete queryQueues[_0x6eec('0x28')];}_0x1759d2['push'](db[_0x6eec('0x29')][_0x6eec('0xe')](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x2b')][_0x6eec('0xe')](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x2c')]['findAll'](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x2d')][_0x6eec('0xe')](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x2e')]['findAll'](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x2f')][_0x6eec('0xe')](queryQueues));_0x1759d2[_0x6eec('0x2a')](db['WhatsappQueue'][_0x6eec('0xe')](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x14')][_0x6eec('0xe')](queryTelephones));_0x1759d2['push'](db[_0x6eec('0x30')][_0x6eec('0xe')](queryTrunks));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x16')]['findAll'](queryCampaigns));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x14')]['findAll'](queryAgents));break;case'user':_0x59fcbe[_0x2489c2]('voice:inbound');_0x59fcbe[_0x2489c2](_0x6eec('0x26'));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0xb'),_0x4b862c[_0x6eec('0x1d')],'VoiceQueue'));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0x31'),_0x4b862c[_0x6eec('0x1d')],_0x6eec('0x2b')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0x32'),_0x4b862c[_0x6eec('0x1d')],'FaxQueue'));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0x33'),_0x4b862c[_0x6eec('0x1d')],_0x6eec('0x2d')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0xc'),_0x4b862c['userProfileId'],_0x6eec('0x2e')));_0x1759d2['push'](getAssociatedResources(_0x6eec('0x34'),_0x4b862c[_0x6eec('0x1d')],_0x6eec('0x2f')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources('WhatsappQueues',_0x4b862c[_0x6eec('0x1d')],_0x6eec('0x35')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0xd'),_0x4b862c['userProfileId'],_0x6eec('0x14')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0xf'),_0x4b862c['userProfileId'],_0x6eec('0x30')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0x10'),_0x4b862c[_0x6eec('0x1d')],_0x6eec('0x16')));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x14')][_0x6eec('0xe')](queryAgents));break;case'agent':_0x59fcbe[_0x2489c2](_0x6eec('0x25'));_0x59fcbe[_0x2489c2](_0x6eec('0x26'));_0x1759d2[_0x6eec('0x2a')](_0x4b862c[_0x6eec('0x36')]({'attributes':['id',_0x6eec('0x3')]}));_0x1759d2[_0x6eec('0x2a')](_0x4b862c['getChatQueues']({'attributes':['id','name']}));_0x1759d2[_0x6eec('0x2a')](_0x4b862c[_0x6eec('0x37')]({'attributes':['id',_0x6eec('0x3')]}));_0x1759d2[_0x6eec('0x2a')](_0x4b862c[_0x6eec('0x38')]({'attributes':['id',_0x6eec('0x3')]}));_0x1759d2[_0x6eec('0x2a')](_0x4b862c['getMailQueues']({'attributes':['id',_0x6eec('0x3')]}));_0x1759d2['push'](_0x4b862c['getOpenchannelQueues']({'attributes':['id','name']}));_0x1759d2[_0x6eec('0x2a')](_0x4b862c['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x6eec('0x39')](_0x1759d2);}})['then'](function(_0x2b9c21){if(_0x2b9c21&&_0x2b9c21[_0x6eec('0x3a')]){for(var _0x3e31cb=0x0;_0x3e31cb<_0x2b9c21[_0x6eec('0x3a')];_0x3e31cb+=0x1){for(var _0x400cf5=0x0;_0x400cf5<_0x2b9c21[_0x3e31cb]['length'];_0x400cf5+=0x1){switch(_0x3e31cb){case 0x0:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x3b'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x1:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x3c'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x2:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x3d'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x3:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x3e'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x4:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x3f'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x5:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x40'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x6:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x41'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x7:if(_0x36cd69['role']!=='agent')_0x59fcbe[_0x2489c2](util[_0x6eec('0x19')](_0x6eec('0x42'),_0x2b9c21[_0x3e31cb][_0x400cf5][_0x6eec('0x3')]));break;case 0x8:if(_0x36cd69[_0x6eec('0x5')]!==_0x6eec('0x7'))_0x59fcbe[_0x2489c2](util['format'](_0x6eec('0x43'),_0x2b9c21[_0x3e31cb][_0x400cf5][_0x6eec('0x3')]));break;case 0x9:if(_0x36cd69[_0x6eec('0x5')]!==_0x6eec('0x7'))_0x59fcbe[_0x2489c2](util[_0x6eec('0x19')](_0x6eec('0x44'),_0x2b9c21[_0x3e31cb][_0x400cf5]['type'],_0x2b9c21[_0x3e31cb][_0x400cf5][_0x6eec('0x3')]));break;case 0xa:_0x59fcbe[_0x2489c2](util[_0x6eec('0x19')]('user:%s',_0x2b9c21[_0x3e31cb][_0x400cf5][_0x6eec('0x3')]));break;}}}}})[_0x6eec('0x18')](function(){if(_0x2489c2===_0x6eec('0x45')){var _0x4a2bd2=_[_0x6eec('0x12')](_0x36cd69[_0x6eec('0x1e')],'id');return _0x36cd69[_0x6eec('0x46')](_0x4a2bd2)[_0x6eec('0x18')](function(){for(var _0x4779fd=0x0;_0x4779fd<_0x4a2bd2[_0x6eec('0x3a')];_0x4779fd+=0x1){_0x4d91d9[_0x6eec('0x47')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x4a2bd2[_0x4779fd]),'UserId':Number(_0x36cd69['id'])});}});}})['then'](function(){if(_0x2489c2==='leave'){var _0x5700d0=_['map'](_0x36cd69[_0x6eec('0x20')],'id');return _0x36cd69[_0x6eec('0x48')](_0x5700d0)[_0x6eec('0x18')](function(){for(var _0x196af0=0x0;_0x196af0<_0x5700d0[_0x6eec('0x3a')];_0x196af0+=0x1){_0x4d91d9[_0x6eec('0x47')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x5700d0[_0x196af0]),'UserId':Number(_0x36cd69['id'])});}});}})['then'](function(){if(_0x2489c2===_0x6eec('0x45')){var _0x1e4515=_[_0x6eec('0x12')](_0x36cd69['FaxInteractions'],'id');return _0x36cd69['removeFaxInteractions'](_0x1e4515)['then'](function(){for(var _0x526bf4=0x0;_0x526bf4<_0x1e4515[_0x6eec('0x3a')];_0x526bf4+=0x1){_0x4d91d9['emit'](_0x6eec('0x49'),{'FaxInteractionId':Number(_0x1e4515[_0x526bf4]),'UserId':Number(_0x36cd69['id'])});}});}})[_0x6eec('0x18')](function(){if(_0x2489c2==='leave'){var _0x172be8=_[_0x6eec('0x12')](_0x36cd69['SmsInteractions'],'id');return _0x36cd69['removeSmsInteractions'](_0x172be8)[_0x6eec('0x18')](function(){for(var _0x3c95fb=0x0;_0x3c95fb<_0x172be8[_0x6eec('0x3a')];_0x3c95fb+=0x1){_0x4d91d9[_0x6eec('0x47')](_0x6eec('0x4a'),{'SmsInteractionId':Number(_0x172be8[_0x3c95fb]),'UserId':Number(_0x36cd69['id'])});}});}})[_0x6eec('0x18')](function(){if(_0x2489c2==='leave'){var _0x3d5882=_[_0x6eec('0x12')](_0x36cd69[_0x6eec('0x4b')],'id');return _0x36cd69[_0x6eec('0x4c')](_0x3d5882)[_0x6eec('0x18')](function(){for(var _0xc87dfb=0x0;_0xc87dfb<_0x3d5882['length'];_0xc87dfb+=0x1){_0x4d91d9[_0x6eec('0x47')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x3d5882[_0xc87dfb]),'UserId':Number(_0x36cd69['id'])});}});}})['then'](function(){if(_0x2489c2===_0x6eec('0x45')){var _0x57d38d=_[_0x6eec('0x12')](_0x36cd69['WhatsappInteractions'],'id');return _0x36cd69[_0x6eec('0x4d')](_0x57d38d)['then'](function(){for(var _0x286c49=0x0;_0x286c49<_0x57d38d[_0x6eec('0x3a')];_0x286c49+=0x1){_0x4d91d9[_0x6eec('0x47')](_0x6eec('0x4e'),{'WhatsappInteractionId':Number(_0x57d38d[_0x286c49]),'UserId':Number(_0x36cd69['id'])});}});}})[_0x6eec('0x4f')](function(_0x2df25f){_0x59fcbe[_0x6eec('0x50')](_0x2df25f);});}}function onDisconnect(_0x4dc248,_0x311e0c){joinOrLeave(_0x4dc248,'leave',_0x311e0c);}function onConnect(_0x2ebb11){joinOrLeave(_0x2ebb11,_0x6eec('0x51'));}exports[_0x6eec('0x52')]=function(_0x2577f7){_0x2577f7['on'](_0x6eec('0x53'),function(_0x567a48){_0x567a48[_0x6eec('0x54')](0x0);_0x567a48['address']=_0x567a48[_0x6eec('0x55')][_0x6eec('0x53')]['remoteAddress']+':'+_0x567a48[_0x6eec('0x55')][_0x6eec('0x53')][_0x6eec('0x56')];_0x567a48[_0x6eec('0x57')]=new Date();_0x567a48[_0x6eec('0x50')]=function(_0x1c86cf){console['log'](_0x6eec('0x58')+_0x567a48[_0x6eec('0x59')]['name']+'['+_0x567a48[_0x6eec('0x5a')]+']',_0x1c86cf);};_0x567a48['on']('disconnect',function(){onDisconnect(_0x567a48,_0x2577f7);_0x567a48[_0x6eec('0x50')](_0x6eec('0x5b'));});onConnect(_0x567a48);_0x567a48[_0x6eec('0x50')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 02290dc..33afc48 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 _0x546d=['query','Sequelize','QueryTypes','then','contact','UserId','interface','format','SIP/%s','name','agent','incomingmessage','catch','AfterCreateMessage','offlineMessage','opened','SELECT','changed','substatus','ContactId','AfterUpdate','User','fullname','internal','length','hasOwnProperty','model','toLowerCase','condition','../../mysqldb','jayson/promise','triggers','client','http','Chat','afterCreate','ChatInteraction','afterUpdate','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','closedinteraction','WhatsappInteraction','Fax','FaxInteraction','newinteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','info','Trigger,\x20%s','error','code','get','channel','motionChannel','event','resolve','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize'];(function(_0x3b380e,_0x3b54a8){var _0x5c327e=function(_0x1f2616){while(--_0x1f2616){_0x3b380e['push'](_0x3b380e['shift']());}};_0x5c327e(++_0x3b54a8);}(_0x546d,0xa5));var _0xd546=function(_0x81c46a,_0xf561f2){_0x81c46a=_0x81c46a-0x0;var _0x5002d0=_0x546d[_0x81c46a];return _0x5002d0;};'use strict';var util=require('util');var db=require(_0xd546('0x0'))['db'];var jayson=require(_0xd546('0x1'));var logger=require('../logger')(_0xd546('0x2'));var client=jayson[_0xd546('0x3')][_0xd546('0x4')]({'port':0x232a});var triggers=[{'channel':_0xd546('0x5'),'model':'ChatInteraction','event':_0xd546('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd546('0x5'),'model':_0xd546('0x7'),'event':_0xd546('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xd546('0x5'),'model':_0xd546('0x9'),'event':_0xd546('0x6'),'condition':_0xd546('0xa'),'callback':afterCreateMessage},{'channel':_0xd546('0x5'),'model':_0xd546('0xb'),'event':_0xd546('0x6'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0xd546('0xc'),'model':'SmsInteraction','event':_0xd546('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd546('0xc'),'model':_0xd546('0xd'),'event':'afterUpdate','condition':_0xd546('0xe'),'callback':afterUpdate},{'channel':_0xd546('0xc'),'model':'SmsMessage','event':'afterCreate','condition':_0xd546('0xa'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xd546('0xf'),'event':_0xd546('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0xd546('0xf'),'event':_0xd546('0x8'),'condition':_0xd546('0xe'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0xd546('0x6'),'condition':_0xd546('0xa'),'callback':afterCreateMessage},{'channel':_0xd546('0x10'),'model':_0xd546('0x11'),'event':_0xd546('0x6'),'condition':_0xd546('0x12'),'callback':afterCreate},{'channel':_0xd546('0x10'),'model':_0xd546('0x11'),'event':_0xd546('0x8'),'condition':_0xd546('0xe'),'callback':afterUpdate},{'channel':_0xd546('0x10'),'model':_0xd546('0x13'),'event':_0xd546('0x6'),'condition':_0xd546('0xa'),'callback':afterCreateMessage},{'channel':_0xd546('0x14'),'model':_0xd546('0x15'),'event':'afterCreate','condition':_0xd546('0x12'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':'afterUpdate','condition':_0xd546('0xe'),'callback':afterUpdate},{'channel':_0xd546('0x14'),'model':_0xd546('0x16'),'event':_0xd546('0x6'),'condition':_0xd546('0xa'),'callback':afterCreateMessage},{'channel':_0xd546('0x17'),'model':_0xd546('0x18'),'event':_0xd546('0x6'),'condition':_0xd546('0x12'),'callback':afterCreate},{'channel':_0xd546('0x17'),'model':_0xd546('0x18'),'event':_0xd546('0x8'),'condition':_0xd546('0xe'),'callback':afterUpdate},{'channel':_0xd546('0x17'),'model':'OpenchannelMessage','event':_0xd546('0x6'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x1ff7b5){return client[_0xd546('0x19')](_0xd546('0x1a'),_0x1ff7b5)['then'](function(_0x4d987c){logger[_0xd546('0x1b')](_0xd546('0x1c'),'EventManager',_0x4d987c);if(_0x4d987c['error']){if(_0x4d987c[_0xd546('0x1d')][_0xd546('0x1e')]===0x1f4){logger[_0xd546('0x1d')]('Trigger,\x20%s',_0xd546('0x1a'),_0x4d987c[_0xd546('0x1d')]);}}})['catch'](function(_0x8bf1e7){logger['error'](_0xd546('0x1c'),_0xd546('0x1a'),_0x8bf1e7);});}function afterCreateMessage(_0x27fc37){return function(_0x351abb){_0x351abb=_0x351abb[_0xd546('0x1f')]({'plain':!![]});_0x351abb[_0xd546('0x20')]=_0x27fc37;_0x351abb[_0xd546('0x21')]=_0x27fc37;_0x351abb[_0xd546('0x22')]=_0x351abb['direction'];Promise[_0xd546('0x23')]()['then'](function(){if(typeof _0x351abb['ContactId']===_0xd546('0x24'))return null;var _0x4730b7=_0xd546('0x25')+_0x351abb['ContactId'];return db[_0xd546('0x26')][_0xd546('0x27')](_0x4730b7,{'type':db[_0xd546('0x28')][_0xd546('0x29')]['SELECT'],'raw':!![]});})[_0xd546('0x2a')](function(_0x250161){if(_0x250161){_0x351abb[_0xd546('0x2b')]=_0x250161[0x0];}if(typeof _0x351abb[_0xd546('0x2c')]==='undefined')return;return getAgent(_0x351abb[_0xd546('0x2c')]);})[_0xd546('0x2a')](function(_0x700ffc){if(_0x700ffc){_0x351abb[_0xd546('0x2d')]=util[_0xd546('0x2e')](_0xd546('0x2f'),_0x700ffc[_0xd546('0x30')]);_0x351abb[_0xd546('0x31')]=_0x700ffc;_0x351abb[_0xd546('0x20')]=_0x27fc37;return request({'event':_0xd546('0x32'),'message':_0x351abb});}else{return request({'event':'outgoingmessage','message':_0x351abb});}})[_0xd546('0x33')](function(_0x4d9ec2){logger['error'](_0xd546('0x1c'),_0xd546('0x34'),_0x4d9ec2);});};}function afterCreateOfflineMessage(_0x4fecbc){return function(_0x19efb8){_0x19efb8=_0x19efb8[_0xd546('0x1f')]({'plain':!![]});_0x19efb8[_0xd546('0x20')]=_0x4fecbc;_0x19efb8[_0xd546('0x21')]=_0x4fecbc;_0x19efb8['event']=_0xd546('0x35');return request({'event':_0x19efb8[_0xd546('0x22')],'message':_0x19efb8});};}function afterCreate(_0x238515,_0x25997a){return function(_0x2c06fc){_0x2c06fc=_0x2c06fc[_0xd546('0x1f')]({'plain':!![]});_0x2c06fc[_0xd546('0x20')]=_0x238515;_0x2c06fc[_0xd546('0x21')]=_0x238515;_0x2c06fc[_0xd546('0x22')]=_0xd546('0x36');Promise[_0xd546('0x23')]()[_0xd546('0x2a')](function(){var _0x2f0756=_0xd546('0x25')+_0x2c06fc['ContactId'];return db[_0xd546('0x26')]['query'](_0x2f0756,{'type':db[_0xd546('0x28')][_0xd546('0x29')][_0xd546('0x37')],'raw':!![]});})[_0xd546('0x2a')](function(_0x1a49f2){if(_0x1a49f2){_0x2c06fc[_0xd546('0x2b')]=_0x1a49f2[0x0];}if(typeof _0x2c06fc[_0xd546('0x2c')]===_0xd546('0x24'))return;return getAgent(_0x2c06fc[_0xd546('0x2c')]);})[_0xd546('0x2a')](function(_0x45a0ce){if(_0x45a0ce){_0x2c06fc[_0xd546('0x2d')]=util['format']('SIP/%s',_0x45a0ce[_0xd546('0x30')]);_0x2c06fc[_0xd546('0x31')]=_0x45a0ce;}return request({'event':_0x25997a,'message':_0x2c06fc});})[_0xd546('0x33')](function(_0x31b9e9){logger[_0xd546('0x1d')]('Trigger,\x20%s','AfterCreate',_0x31b9e9);});};}function afterUpdate(_0x5115b9){return function(_0x5b0e8d){var _0x2eba7b=_0x5b0e8d[_0xd546('0x38')]('closed')&&_0x5b0e8d['closed'];var _0x54f51a=_0x5b0e8d[_0xd546('0x38')](_0xd546('0x39'));if(_0x2eba7b||_0x54f51a){var _0x4f5e5=_0x2eba7b?'closedinteraction':_0xd546('0x39');var _0x11f62f=_0x5b0e8d[_0xd546('0x1f')]({'plain':!![]});_0x11f62f[_0xd546('0x20')]=_0x5115b9;_0x11f62f[_0xd546('0x21')]=_0x5115b9;_0x11f62f['event']=_0x2eba7b?'closed':_0xd546('0x39');var _0x12b5db=_0xd546('0x25')+_0x11f62f[_0xd546('0x3a')];return db['sequelize'][_0xd546('0x27')](_0x12b5db,{'type':db[_0xd546('0x28')]['QueryTypes'][_0xd546('0x37')],'raw':!![]})[_0xd546('0x2a')](function(_0xca074a){if(_0xca074a){_0x11f62f['contact']=_0xca074a[0x0];}if(typeof _0x11f62f[_0xd546('0x2c')]===_0xd546('0x24'))return;return getAgent(_0x11f62f[_0xd546('0x2c')]);})[_0xd546('0x2a')](function(_0x282b37){if(_0x282b37){_0x11f62f[_0xd546('0x2d')]=util['format'](_0xd546('0x2f'),_0x282b37[_0xd546('0x30')]);_0x11f62f['agent']=_0x282b37;}return request({'event':_0x4f5e5,'message':_0x11f62f});})['catch'](function(_0x338383){logger[_0xd546('0x1d')](_0xd546('0x1c'),_0xd546('0x3b'),_0x338383);});}};}function getAgent(_0x2145da){return db[_0xd546('0x3c')]['find']({'where':{'id':_0x2145da},'attributes':['id','name',_0xd546('0x3d'),'email',_0xd546('0x3e')],'raw':!![]})[_0xd546('0x2a')](function(_0x1f1f3f){return _0x1f1f3f;});}exports['default']=function(){for(var _0x48893f=0x0;_0x48893f=_0x4cbd67['agents']){throw Error(_0xc7ed('0x14'));}_0x4e7e11(_0x333be4);})[_0xc7ed('0x15')](function(_0x378ca9){_0x2b1968(_0x378ca9);});});}; \ No newline at end of file +var _0xa89a=['agent','getLicense','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','./license/util','voice','mail','chat','fax','whatsapp','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes','role','User','count'];(function(_0x9a2978,_0x3b3ea4){var _0x5c74f5=function(_0xd5ce7d){while(--_0xd5ce7d){_0x9a2978['push'](_0x9a2978['shift']());}};_0x5c74f5(++_0x3b3ea4);}(_0xa89a,0x1aa));var _0xaa89=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xa89a[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var BPromise=require(_0xaa89('0x0'));var db=require('../mysqldb')['db'];var util=require(_0xaa89('0x1'));var channels=[_0xaa89('0x2'),_0xaa89('0x3'),_0xaa89('0x4'),_0xaa89('0x5'),'sms',_0xaa89('0x6'),'openchannel'];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x21b59a){_0x21b59a=_0x21b59a[_0xaa89('0x7')]();return _[_0xaa89('0x8')](channels,_0x21b59a);};exports[_0xaa89('0x9')]=function(_0x508ea8,_0x260a64,_0x15e426,_0x555c30){var _0x44eed2={'loginAttempts':_0x260a64,'blocked':_0x15e426};if(!_['isUndefined'](_0x555c30)){_0x44eed2[_0xaa89('0xa')]=_0x555c30;}return _0x508ea8[_0xaa89('0xb')](_0x44eed2);};exports['getLicense']=function(_0x4e645e){return new BPromise(function(_0x17a7e4,_0x2b1d9c){var _0xce4053=0x0;if(_0x4e645e[_0xaa89('0xc')]!=='agent'){_0x17a7e4(_0x4e645e);}db[_0xaa89('0xd')][_0xaa89('0xe')]({'where':{'role':_0xaa89('0xf'),'online':!![],'id':{'$ne':_0x4e645e['id']}}})['then'](function(_0x2f7784){_0xce4053=_0x2f7784;return util[_0xaa89('0x10')]();})[_0xaa89('0x11')](function(_0xae91a0){if(_0xae91a0&&_0xae91a0[_0xaa89('0x12')]&&_0xce4053>=_0xae91a0[_0xaa89('0x12')]){throw Error(_0xaa89('0x13'));}_0x17a7e4(_0x4e645e);})[_0xaa89('0x14')](function(_0x57b8a5){_0x2b1d9c(_0x57b8a5);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 16af219..8d951d7 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82ec=['OutOfInterval','Resource\x20Conflict','Not\x20Found','Conflict','error','statusMessage','status','send','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x82ec,0x110));var _0xc82e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x82ec[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0xc82e('0x0'));var logger=require(_0xc82e('0x1'))(_0xc82e('0x2'));var APIError=function(_0x5c7bc8,_0x1759e6){this[_0xc82e('0x3')]=_0x5c7bc8||'Internal\x20Server\x20Error';this[_0xc82e('0x4')]=_0x1759e6||_0xc82e('0x5');util[_0xc82e('0x6')](APIError,Error);};var APIBadRequestError=function(_0x1b722c){this[_0xc82e('0x3')]=_0x1b722c||_0xc82e('0x7');this[_0xc82e('0x4')]=_0xc82e('0x7');util[_0xc82e('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x2b882f){this[_0xc82e('0x3')]=_0x2b882f||'Forbidden';this[_0xc82e('0x4')]=_0xc82e('0x8');util[_0xc82e('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0xeeb08){this[_0xc82e('0x3')]=_0xeeb08||_0xc82e('0x9');this['name']='Not\x20Found';util[_0xc82e('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2734a1){this[_0xc82e('0x3')]=_0x2734a1||_0xc82e('0xa');this[_0xc82e('0x4')]=_0xc82e('0xb');this[_0xc82e('0xc')]=0x193;this[_0xc82e('0xd')]={'type':_0xc82e('0xe')};util[_0xc82e('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x563eac){this[_0xc82e('0x3')]=_0x563eac||_0xc82e('0xf');this['name']='Conflict';util[_0xc82e('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x4c01b5){switch(_0x4c01b5){case'Bad\x20Request':return 0x190;case _0xc82e('0x8'),_0xc82e('0xb'):return 0x193;case _0xc82e('0x10'):return 0x194;case _0xc82e('0x11'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x38a340){if(_0x38a340===_0xc82e('0xb'))return _0x38a340;return null;}function handleError(_0x97f3f9){return function(_0x3893c7){logger[_0xc82e('0x12')](_0x3893c7['stack']);var _0x44cfd9=getStatusCode(_0x3893c7['name']);var _0x9260a0=getCustomStatusMessage(_0x3893c7[_0xc82e('0x4')]);if(_0x3893c7[_0xc82e('0x4')]){delete _0x3893c7[_0xc82e('0x4')];}if(_0x9260a0){_0x97f3f9[_0xc82e('0x13')]=_0x9260a0;}return _0x97f3f9[_0xc82e('0x14')](_0x44cfd9)[_0xc82e('0x15')](_0x3893c7);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xc5cb=['send','util','../config/logger','api','message','name','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','details','OutOfInterval','Resource\x20Conflict','Out\x20Of\x20Interval','Conflict','error','statusMessage','status'];(function(_0x3d8588,_0x4e514f){var _0x386d48=function(_0x2190cf){while(--_0x2190cf){_0x3d8588['push'](_0x3d8588['shift']());}};_0x386d48(++_0x4e514f);}(_0xc5cb,0x79));var _0xbc5c=function(_0x710dba,_0x32f351){_0x710dba=_0x710dba-0x0;var _0x4676bf=_0xc5cb[_0x710dba];return _0x4676bf;};'use strict';var util=require(_0xbc5c('0x0'));var logger=require(_0xbc5c('0x1'))(_0xbc5c('0x2'));var APIError=function(_0x3c22b4,_0x591923){this[_0xbc5c('0x3')]=_0x3c22b4||'Internal\x20Server\x20Error';this[_0xbc5c('0x4')]=_0x591923||'Error';util[_0xbc5c('0x5')](APIError,Error);};var APIBadRequestError=function(_0x213896){this[_0xbc5c('0x3')]=_0x213896||'Bad\x20Request';this[_0xbc5c('0x4')]=_0xbc5c('0x6');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x5ca480){this['message']=_0x5ca480||'Forbidden';this[_0xbc5c('0x4')]=_0xbc5c('0x7');util[_0xbc5c('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x488b7e){this[_0xbc5c('0x3')]=_0x488b7e||_0xbc5c('0x8');this[_0xbc5c('0x4')]=_0xbc5c('0x9');util[_0xbc5c('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x19e2a8){this['message']=_0x19e2a8||_0xbc5c('0xa');this[_0xbc5c('0x4')]='Out\x20Of\x20Interval';this['code']=0x193;this[_0xbc5c('0xb')]={'type':_0xbc5c('0xc')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1fbb81){this[_0xbc5c('0x3')]=_0x1fbb81||_0xbc5c('0xd');this[_0xbc5c('0x4')]='Conflict';util[_0xbc5c('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x28be25){switch(_0x28be25){case _0xbc5c('0x6'):return 0x190;case'Forbidden',_0xbc5c('0xe'):return 0x193;case _0xbc5c('0x9'):return 0x194;case _0xbc5c('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x5cb9f5){if(_0x5cb9f5===_0xbc5c('0xe'))return _0x5cb9f5;return null;}function handleError(_0x2e92bf){return function(_0x27e744){logger[_0xbc5c('0x10')](_0x27e744['stack']);var _0x997f0a=getStatusCode(_0x27e744[_0xbc5c('0x4')]);var _0x169c2c=getCustomStatusMessage(_0x27e744['name']);if(_0x27e744[_0xbc5c('0x4')]){delete _0x27e744[_0xbc5c('0x4')];}if(_0x169c2c){_0x2e92bf[_0xbc5c('0x11')]=_0x169c2c;}return _0x2e92bf[_0xbc5c('0x12')](_0x997f0a)[_0xbc5c('0x13')](_0x27e744);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 40049d8..8c89128 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7cd6=['exports','status','json','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7cd6,0x1f4));var _0x67cd=function(_0x170253,_0x28238b){_0x170253=_0x170253-0x0;var _0x24d663=_0x7cd6[_0x170253];return _0x24d663;};'use strict';module[_0x67cd('0x0')][0x194]=function pageNotFound(_0x2dd6b8,_0x11fd44){var _0x5f3d68='404';var _0x57bb38=0x194;var _0xf2d2bf={'status':_0x57bb38};_0x11fd44[_0x67cd('0x1')](_0xf2d2bf[_0x67cd('0x1')]);_0x11fd44['render'](_0x5f3d68,{},function(_0x2c56d6,_0x5d7957){if(_0x2c56d6){return _0x11fd44[_0x67cd('0x1')](_0xf2d2bf[_0x67cd('0x1')])[_0x67cd('0x2')](_0xf2d2bf);}_0x11fd44[_0x67cd('0x3')](_0x5d7957);});}; \ No newline at end of file +var _0xbafb=['404','status','render','json','send'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xbafb,0xf0));var _0xbbaf=function(_0x23b01d,_0x5e5a41){_0x23b01d=_0x23b01d-0x0;var _0x17e94d=_0xbafb[_0x23b01d];return _0x17e94d;};'use strict';module['exports'][0x194]=function pageNotFound(_0x517de3,_0x5c6764){var _0x46b0fd=_0xbbaf('0x0');var _0x1d9347=0x194;var _0x251ac4={'status':_0x1d9347};_0x5c6764[_0xbbaf('0x1')](_0x251ac4[_0xbbaf('0x1')]);_0x5c6764[_0xbbaf('0x2')](_0x46b0fd,{},function(_0x593fd8,_0x2de5d1){if(_0x593fd8){return _0x5c6764['status'](_0x251ac4[_0xbbaf('0x1')])[_0xbbaf('0x3')](_0x251ac4);}_0x5c6764[_0xbbaf('0x4')](_0x2de5d1);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ee470f0..2ad56e7 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x130d=['ChatQueue','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','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','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','hasOne','cascade','UserId','userSetting','VoiceRecording','Recordings','VoiceQueuesRt','hasMany','Extensions','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','UserNotifications','SenderId','CmHopper','SET\x20NULL','belongsTo','userProfileId','belongsToMany','chat_group_has_users','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','FaxQueues','SmsQueue','OpenchannelQueues','cm_user_has_lists','ChatWebsites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','VoiceExtension','SpiedAgents','ChanSpyId','Sounds','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','MailAccount','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','List','ListId','TemplateId','mandatoryDispositionPause','Account','ContactId','Owner','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Attachments','ChatWebsiteId','ChatOfflineMessageId','MailApplication','Dashboard','Items','Dispositions','FaxAccountId','CannedAnswer','FaxApplication','TagId','FaxInteractionId','Tags','fax_interaction_has_tags','user_has_fax_interactions','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','Interactions','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteraction','OpenchannelMessage','Applications','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','ChatProactiveAction','Website','CompanyId','CmContactHasItem','Phones','CmContactId','Hoppers','Company','AdditionalPhones','CmHopperId','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Automation','Any','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','CustomReportId','Mohs','moh_has_sounds','cm_contact_has_tags','whatsapp_interaction_has_tags','ItemType','Hopper','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','DefaultReportId','MetricId','SalesforceConfiguration','Configurations','Subjects','Descriptions','AccountId','Subject','SubjectId','Description','Field','FieldId','VariableId','SugarcrmField','DescriptionId','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerField','ServicenowConfiguration','ServicenowField','Dynamics365Field','FromId','ToId','JscriptyQuestionReport','SmsQueueReport','ProjectId','team_has_mail_queues','SmsQueues','WhatsappQueues','TrunkId','SquareProject','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToQueue','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','user','exports','../config/environment','sequelize','lodash','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8','sequelizeHistory','utf8mb4','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../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','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model'];(function(_0x18637c,_0x17396c){var _0x562662=function(_0x3ffa8e){while(--_0x3ffa8e){_0x18637c['push'](_0x18637c['shift']());}};_0x562662(++_0x17396c);}(_0x130d,0x19d));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var config=require(_0xd130('0x0'));var Sequelize=require(_0xd130('0x1'));var _=require(_0xd130('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xd130('0x1')]=_[_0xd130('0x3')](config[_0xd130('0x1')],{'database':_0xd130('0x4'),'username':_0xd130('0x5'),'password':_0xd130('0x6'),'options':{'host':_0xd130('0x7'),'port':0xcea,'dialect':_0xd130('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xd130('0x9')](),'define':{'charset':_0xd130('0xa'),'collate':'utf8_general_ci'}}});config[_0xd130('0xb')]=_['defaultsDeep'](config[_0xd130('0xb')],{'database':_0xd130('0x4'),'username':_0xd130('0x5'),'password':'xC@LL1234','options':{'host':_0xd130('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xd130('0xc')},'logging':![],'timezone':timezone[_0xd130('0x9')](),'define':{'charset':_0xd130('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd130('0x1')][_0xd130('0xd')],config[_0xd130('0x1')][_0xd130('0xe')],config[_0xd130('0x1')][_0xd130('0xf')],config[_0xd130('0x1')][_0xd130('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd130('0xb')]['database'],config[_0xd130('0xb')][_0xd130('0xe')],config[_0xd130('0xb')]['password'],config[_0xd130('0xb')]['options'])};db['User']=db['sequelize'][_0xd130('0x11')](_0xd130('0x12'));db[_0xd130('0x13')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x14'));db[_0xd130('0x15')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x16'));db[_0xd130('0x17')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x18'));db[_0xd130('0x19')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x1a'));db['VoiceRecording']=db[_0xd130('0x1')]['import'](_0xd130('0x1b'));db[_0xd130('0x1c')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x1d'));db[_0xd130('0x1e')]=db[_0xd130('0x1')]['import'](_0xd130('0x1f'));db[_0xd130('0x20')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x21'));db['VoiceCallReport']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x22'));db['VoiceDialReport']=db['sequelize'][_0xd130('0x11')](_0xd130('0x23'));db[_0xd130('0x24')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xd130('0x25')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x26'));db['MemberReport']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x27'));db['Trunk']=db[_0xd130('0x1')]['import'](_0xd130('0x28'));db[_0xd130('0x29')]=db[_0xd130('0x1')]['import'](_0xd130('0x2a'));db[_0xd130('0x2b')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x2c'));db[_0xd130('0x2d')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x2e'));db[_0xd130('0x2f')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x30'));db[_0xd130('0x31')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x32'));db[_0xd130('0x33')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x34'));db[_0xd130('0x35')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/userSmsQueue/userSmsQueue.model');db[_0xd130('0x36')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x37'));db[_0xd130('0x38')]=db['sequelize']['import'](_0xd130('0x39'));db[_0xd130('0x3a')]=db[_0xd130('0x1')]['import'](_0xd130('0x3b'));db[_0xd130('0x3c')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x3d'));db['MailAccount']=db[_0xd130('0x1')]['import'](_0xd130('0x3e'));db[_0xd130('0x3f')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x40'));db['MailSubstatus']=db['sequelize'][_0xd130('0x11')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xd130('0x1')]['import']('../api/mailInteraction/mailInteraction.model');db[_0xd130('0x41')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x42'));db['MailApplication']=db['sequelize']['import'](_0xd130('0x43'));db[_0xd130('0x44')]=db[_0xd130('0x1')]['import'](_0xd130('0x45'));db['Dashboard']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x46'));db[_0xd130('0x47')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/dashboardItem/dashboardItem.model');db[_0xd130('0x48')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x49'));db['FaxApplication']=db[_0xd130('0x1')][_0xd130('0x11')]('../api/faxApplication/faxApplication.model');db[_0xd130('0x4a')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x4b'));db[_0xd130('0x4c')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x4d'));db[_0xd130('0x4e')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x4f'));db[_0xd130('0x50')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x51'));db[_0xd130('0x52')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x53'));db[_0xd130('0x54')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db['sequelize'][_0xd130('0x11')]('../api/smsInteraction/smsInteraction.model');db[_0xd130('0x55')]=db['sequelize']['import'](_0xd130('0x56'));db['SmsQueue']=db['sequelize'][_0xd130('0x11')](_0xd130('0x57'));db[_0xd130('0x58')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/openchannelAccount/openchannelAccount.model');db[_0xd130('0x59')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x5a'));db['OpenchannelMessage']=db[_0xd130('0x1')][_0xd130('0x11')]('../api/openchannelMessage/openchannelMessage.model');db[_0xd130('0x5b')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x5c'));db[_0xd130('0x5d')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x5e'));db[_0xd130('0x5f')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x60'));db[_0xd130('0x61')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x62'));db[_0xd130('0x63')]=db[_0xd130('0x1')]['import'](_0xd130('0x64'));db[_0xd130('0x65')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x66'));db[_0xd130('0x67')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x68'));db[_0xd130('0x69')]=db['sequelize'][_0xd130('0x11')]('../api/chatQueue/chatQueue.model');db[_0xd130('0x6a')]=db['sequelize'][_0xd130('0x11')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x6b'));db[_0xd130('0x6c')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x6d'));db[_0xd130('0x6e')]=db[_0xd130('0x1')]['import']('../api/cmContact/cmContact.model');db['CmHopper']=db['sequelize'][_0xd130('0x11')](_0xd130('0x6f'));db[_0xd130('0x70')]=db[_0xd130('0x1')]['import'](_0xd130('0x71'));db[_0xd130('0x72')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x73'));db[_0xd130('0x74')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x75'));db['CmCustomField']=db[_0xd130('0x1')][_0xd130('0x11')]('../api/cmCustomField/cmCustomField.model');db[_0xd130('0x76')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x77'));db['Automation']=db[_0xd130('0x1')]['import']('../api/automation/automation.model');db['CannedAnswer']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x78'));db[_0xd130('0x79')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x7a'));db[_0xd130('0x7b')]=db[_0xd130('0x1')]['import'](_0xd130('0x7c'));db[_0xd130('0x7d')]=db[_0xd130('0x1')]['import'](_0xd130('0x7e'));db[_0xd130('0x7f')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x80'));db['Cdr']=db['sequelize'][_0xd130('0x11')](_0xd130('0x81'));db[_0xd130('0x82')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x83'));db[_0xd130('0x84')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x85'));db[_0xd130('0x86')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x87'));db[_0xd130('0x88')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x89'));db[_0xd130('0x8a')]=db['sequelize'][_0xd130('0x11')]('../api/contactItemType/contactItemType.model');db['CmContactHasItem']=db['sequelize'][_0xd130('0x11')](_0xd130('0x8b'));db[_0xd130('0x8c')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x8d'));db[_0xd130('0x8e')]=db[_0xd130('0x1')]['import']('../api/template/template.model');db[_0xd130('0x8f')]=db[_0xd130('0x1')]['import'](_0xd130('0x90'));db[_0xd130('0x91')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x92'));db['Integration']=db['sequelize']['import']('../api/integration/integration.model');db[_0xd130('0x93')]=db[_0xd130('0x1')]['import'](_0xd130('0x94'));db[_0xd130('0x95')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x96'));db['AnalyticDefaultReport']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x97'));db['AnalyticExtractedReport']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x98'));db[_0xd130('0x99')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x9a'));db[_0xd130('0x9b')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x9c'));db[_0xd130('0x9d')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x9e'));db[_0xd130('0x9f')]=db[_0xd130('0x1')]['import'](_0xd130('0xa0'));db['SalesforceConfiguration']=db[_0xd130('0x1')]['import'](_0xd130('0xa1'));db[_0xd130('0xa2')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xa3'));db[_0xd130('0xa4')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xa5'));db[_0xd130('0xa6')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xa7'));db['SugarcrmField']=db[_0xd130('0x1')][_0xd130('0x11')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xd130('0xa8')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xa9'));db[_0xd130('0xaa')]=db['sequelize'][_0xd130('0x11')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xd130('0xab')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xac'));db[_0xd130('0xad')]=db['sequelize'][_0xd130('0x11')](_0xd130('0xae'));db['ZohoConfiguration']=db['sequelize'][_0xd130('0x11')](_0xd130('0xaf'));db[_0xd130('0xb0')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/intZohoField/intZohoField.model');db[_0xd130('0xb1')]=db[_0xd130('0x1')]['import'](_0xd130('0xb2'));db[_0xd130('0xb3')]=db['sequelize'][_0xd130('0x11')](_0xd130('0xb4'));db['ZendeskField']=db[_0xd130('0x1')][_0xd130('0x11')]('../api/intZendeskField/intZendeskField.model');db[_0xd130('0xb5')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xb6'));db['FreshdeskConfiguration']=db[_0xd130('0x1')][_0xd130('0x11')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xd130('0xb7')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xb8'));db[_0xd130('0xb9')]=db[_0xd130('0x1')]['import'](_0xd130('0xba'));db[_0xd130('0xbb')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db['sequelize'][_0xd130('0x11')](_0xd130('0xbc'));db[_0xd130('0xbd')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xbe'));db['ServicenowField']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xbf'));db[_0xd130('0xc0')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xc1'));db[_0xd130('0xc2')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xc3'));db['Dynamics365Field']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xc4'));db[_0xd130('0xc5')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xd130('0xc6')]=db['sequelize'][_0xd130('0x11')](_0xd130('0xc7'));db[_0xd130('0xc8')]=db['sequelize']['import'](_0xd130('0xc9'));db['Integration']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xca'));db[_0xd130('0xcb')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xcc'));db[_0xd130('0xcd')]=db['sequelize'][_0xd130('0x11')]('../api/chatQueueReport/chatQueueReport.model');db[_0xd130('0xce')]=db[_0xd130('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0xd130('0xcf')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xd0'));db['JscriptyQuestionReport']=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xd130('0xd1')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xd2'));db['SmsQueueReport']=db['sequelize'][_0xd130('0x11')](_0xd130('0xd3'));db[_0xd130('0xd4')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xd5'));db[_0xd130('0xd6')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xd7'));db[_0xd130('0xd8')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xd9'));db[_0xd130('0xda')]=db[_0xd130('0x1')]['import'](_0xd130('0xdb'));db[_0xd130('0xdc')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xdd'));db['SquareProject']=db[_0xd130('0x1')][_0xd130('0x11')]('../api/squareProject/squareProject.model');db[_0xd130('0xde')]=db[_0xd130('0x1')]['import'](_0xd130('0xdf'));db[_0xd130('0xe0')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/squareMessage/squareMessage.model');db[_0xd130('0xe1')]=db[_0xd130('0x1')]['import'](_0xd130('0xe2'));db[_0xd130('0xe3')]=db[_0xd130('0x1')]['import'](_0xd130('0xe4'));db['Campaign']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xe5'));db[_0xd130('0xe6')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/migration/migration.model');db[_0xd130('0xe7')]=db['sequelize'][_0xd130('0x11')](_0xd130('0xe8'));db[_0xd130('0xe9')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xea'));db['MailTransferReport']=db[_0xd130('0x1')]['import'](_0xd130('0xeb'));db[_0xd130('0xec')]=db['sequelize'][_0xd130('0x11')]('../api/chatTransferReport/chatTransferReport.model');db[_0xd130('0xed')]=db['sequelize'][_0xd130('0x11')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xee'));db['SmsTransferReport']=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xef'));db[_0xd130('0xf0')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xf1'));db[_0xd130('0xf2')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xf3'));db[_0xd130('0xf4')]=db[_0xd130('0x1')]['import'](_0xd130('0xf5'));db[_0xd130('0xf6')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/userProfileSection/userProfileSection.model');db[_0xd130('0xf7')]=db['sequelize'][_0xd130('0x11')]('../api/userProfileResource/userProfileResource.model');db[_0xd130('0xf8')]=db['sequelize']['import'](_0xd130('0xf9'));db[_0xd130('0xfa')]=db['sequelize'][_0xd130('0x11')](_0xd130('0xfb'));db[_0xd130('0xfc')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0xfd'));db[_0xd130('0xfe')]=db[_0xd130('0x1')]['import'](_0xd130('0xff'));db[_0xd130('0x100')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x101'));db['WhatsappQueueReport']=db[_0xd130('0x1')]['import'](_0xd130('0x102'));db[_0xd130('0x103')]=db[_0xd130('0x1')][_0xd130('0x11')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xd130('0x104')]=db[_0xd130('0x1')]['import'](_0xd130('0x105'));db[_0xd130('0x106')]=db['sequelize']['import'](_0xd130('0x107'));db[_0xd130('0x108')]=db[_0xd130('0x1')]['import'](_0xd130('0x109'));db[_0xd130('0x10a')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x10b'));db[_0xd130('0x10c')]=db[_0xd130('0x1')][_0xd130('0x11')](_0xd130('0x10d'));db[_0xd130('0x10e')]=db[_0xd130('0x1')]['import'](_0xd130('0x10f'));db[_0xd130('0x110')]=db['sequelize'][_0xd130('0x11')](_0xd130('0x111'));db[_0xd130('0x112')][_0xd130('0x113')](db['VoiceMail'],{'as':_0xd130('0x1e'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x115')});db[_0xd130('0x112')][_0xd130('0x113')](db['UserSetting'],{'as':_0xd130('0x116'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x115')});db['User']['hasMany'](db[_0xd130('0x117')],{'as':_0xd130('0x118'),'foreignKey':_0xd130('0x115')});db[_0xd130('0x112')]['hasMany'](db[_0xd130('0x2b')],{'as':_0xd130('0x119'),'foreignKey':_0xd130('0x115')});db['User'][_0xd130('0x11a')](db['VoiceExtension'],{'as':_0xd130('0x11b'),'onDelete':_0xd130('0x114'),'hooks':!![]});db[_0xd130('0x112')][_0xd130('0x11a')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd130('0x115')});db['User'][_0xd130('0x11a')](db[_0xd130('0x74')],{'as':_0xd130('0x11c'),'foreignKey':_0xd130('0x115')});db[_0xd130('0x112')][_0xd130('0x11a')](db[_0xd130('0x11d')],{'as':_0xd130('0x11d'),'foreignKey':_0xd130('0x115')});db[_0xd130('0x112')][_0xd130('0x11a')](db['OpenchannelInteraction'],{'as':_0xd130('0x11e'),'foreignKey':'UserId'});db[_0xd130('0x112')][_0xd130('0x11a')](db[_0xd130('0x63')],{'as':_0xd130('0x11f'),'foreignKey':_0xd130('0x115')});db[_0xd130('0x112')][_0xd130('0x11a')](db[_0xd130('0x120')],{'as':_0xd130('0x121'),'foreignKey':_0xd130('0x115')});db['User'][_0xd130('0x11a')](db[_0xd130('0x4a')],{'as':_0xd130('0x122'),'foreignKey':_0xd130('0x115')});db[_0xd130('0x112')][_0xd130('0x11a')](db[_0xd130('0x123')],{'as':_0xd130('0x124'),'foreignKey':_0xd130('0x115')});db[_0xd130('0x112')]['hasMany'](db[_0xd130('0xfe')],{'as':'WhatsappInteractions','foreignKey':_0xd130('0x115')});db[_0xd130('0x112')][_0xd130('0x11a')](db[_0xd130('0xf8')],{'as':_0xd130('0x125'),'foreignKey':_0xd130('0x126')});db[_0xd130('0x112')][_0xd130('0x11a')](db[_0xd130('0x127')],{'as':'Hoppers','foreignKey':_0xd130('0x115'),'onDelete':_0xd130('0x128')});db[_0xd130('0x112')][_0xd130('0x129')](db[_0xd130('0xf4')],{'as':'UserProfile','foreignKey':_0xd130('0x12a')});db[_0xd130('0x112')][_0xd130('0x12b')](db[_0xd130('0x6a')],{'as':'Groups','through':_0xd130('0x12c')});db[_0xd130('0x112')]['belongsToMany'](db[_0xd130('0x6e')],{'as':'Contacts','through':_0xd130('0x12d')});db[_0xd130('0x112')][_0xd130('0x12b')](db[_0xd130('0xf0')],{'as':_0xd130('0x12e'),'through':'cm_user_has_lists'});db[_0xd130('0x112')]['belongsToMany'](db['Team'],{'through':_0xd130('0x12f')});db[_0xd130('0x112')][_0xd130('0x12b')](db[_0xd130('0x123')],{'as':'MailInteractions','through':_0xd130('0x130')});db[_0xd130('0x112')][_0xd130('0x12b')](db[_0xd130('0x63')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db['User'][_0xd130('0x12b')](db[_0xd130('0x4a')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0xd130('0x112')][_0xd130('0x12b')](db[_0xd130('0x120')],{'as':_0xd130('0x121'),'through':_0xd130('0x131')});db[_0xd130('0x112')][_0xd130('0x12b')](db['OpenchannelInteraction'],{'as':_0xd130('0x11e'),'through':'user_has_openchannel_interactions'});db[_0xd130('0x112')][_0xd130('0x12b')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0xd130('0x132')});db[_0xd130('0x112')][_0xd130('0x12b')](db['VoiceQueue'],{'as':_0xd130('0x133'),'through':'UserVoiceQueue','required':![]});db[_0xd130('0x112')][_0xd130('0x12b')](db[_0xd130('0xf2')],{'as':_0xd130('0x134'),'through':_0xd130('0x10c'),'required':![]});db[_0xd130('0x112')][_0xd130('0x12b')](db[_0xd130('0x3f')],{'as':_0xd130('0x135'),'through':_0xd130('0x31'),'required':![]});db[_0xd130('0x112')][_0xd130('0x12b')](db[_0xd130('0x69')],{'as':'ChatQueues','through':_0xd130('0x2f'),'required':![],'hooks':!![]});db[_0xd130('0x112')][_0xd130('0x12b')](db['FaxQueue'],{'as':_0xd130('0x136'),'through':_0xd130('0x33'),'required':![]});db[_0xd130('0x112')]['belongsToMany'](db[_0xd130('0x137')],{'as':'SmsQueues','through':_0xd130('0x35'),'required':![]});db['User'][_0xd130('0x12b')](db[_0xd130('0x5b')],{'as':_0xd130('0x138'),'through':_0xd130('0x36'),'required':![]});db[_0xd130('0x112')][_0xd130('0x12b')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0xd130('0x38'),'required':![]});db[_0xd130('0x112')][_0xd130('0x12b')](db['CmList'],{'through':_0xd130('0x139')});db[_0xd130('0x112')][_0xd130('0x12b')](db[_0xd130('0x5d')],{'as':_0xd130('0x13a'),'through':'user_has_chat_websites'});db['User']['belongsToMany'](db[_0xd130('0x48')],{'as':_0xd130('0x13b'),'through':_0xd130('0x13c')});db['User']['belongsToMany'](db['MailAccount'],{'as':'MailAccounts','through':_0xd130('0x13d')});db[_0xd130('0x112')][_0xd130('0x12b')](db[_0xd130('0x58')],{'as':_0xd130('0x13e'),'through':'user_has_openchannel_accounts'});db[_0xd130('0x112')][_0xd130('0x12b')](db[_0xd130('0x52')],{'as':'SmsAccounts','through':_0xd130('0x13f')});db[_0xd130('0x112')]['belongsToMany'](db[_0xd130('0xfa')],{'as':_0xd130('0x140'),'through':_0xd130('0x141')});db[_0xd130('0x13')][_0xd130('0x11a')](db[_0xd130('0x142')],{'as':_0xd130('0x143'),'onDelete':'cascade','foreignKey':_0xd130('0x144')});db[_0xd130('0x15')][_0xd130('0x11a')](db['VoiceExtension'],{'onDelete':_0xd130('0x114')});db[_0xd130('0x142')][_0xd130('0x11a')](db[_0xd130('0x142')],{'as':'Applications','onDelete':_0xd130('0x114')});db[_0xd130('0x17')][_0xd130('0x12b')](db[_0xd130('0x86')],{'as':_0xd130('0x145'),'through':'moh_has_sounds'});db[_0xd130('0x19')][_0xd130('0x11a')](db[_0xd130('0x2b')],{'as':'Members','foreignKey':_0xd130('0x146')});db[_0xd130('0x19')][_0xd130('0x11a')](db[_0xd130('0x127')],{'as':'Hoppers','foreignKey':_0xd130('0x146')});db[_0xd130('0x19')][_0xd130('0x11a')](db[_0xd130('0x72')],{'as':_0xd130('0x147'),'foreignKey':_0xd130('0x146')});db[_0xd130('0x19')][_0xd130('0x11a')](db['CmHopperHistory'],{'as':_0xd130('0x148'),'foreignKey':_0xd130('0x146')});db[_0xd130('0x19')][_0xd130('0x11a')](db[_0xd130('0x11d')],{'as':_0xd130('0x11d'),'foreignKey':_0xd130('0x146')});db[_0xd130('0x19')]['hasMany'](db[_0xd130('0x70')],{'as':_0xd130('0x149'),'foreignKey':_0xd130('0x146')});db[_0xd130('0x19')][_0xd130('0x11a')](db['JscriptySessionReport'],{'as':_0xd130('0x14a'),'foreignKey':_0xd130('0x146')});db['VoiceQueue'][_0xd130('0x129')](db[_0xd130('0x14b')],{'as':_0xd130('0x14b'),'foreignKey':'TrunkId'});db[_0xd130('0x19')][_0xd130('0x129')](db[_0xd130('0x14b')],{'as':_0xd130('0x14c'),'foreignKey':_0xd130('0x14d')});db[_0xd130('0x19')][_0xd130('0x129')](db[_0xd130('0x7d')],{'as':_0xd130('0x7d'),'foreignKey':_0xd130('0x14e')});db[_0xd130('0x19')][_0xd130('0x129')](db[_0xd130('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0xd130('0x14f')});db[_0xd130('0x19')][_0xd130('0x12b')](db[_0xd130('0xf0')],{'as':_0xd130('0x12e'),'through':_0xd130('0x150')});db[_0xd130('0x19')][_0xd130('0x12b')](db['User'],{'as':_0xd130('0x151'),'through':_0xd130('0x2d')});db[_0xd130('0x19')][_0xd130('0x12b')](db[_0xd130('0xe1')],{'as':_0xd130('0x152'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0xd130('0x12b')](db[_0xd130('0xf0')],{'as':_0xd130('0x153'),'through':_0xd130('0x154')});db['VoiceRecording']['belongsTo'](db[_0xd130('0x112')],{'as':_0xd130('0x112'),'foreignKey':_0xd130('0x115')});db[_0xd130('0x1c')][_0xd130('0x129')](db['User'],{'as':'User','foreignKey':_0xd130('0x115')});db['VoiceMail'][_0xd130('0x11a')](db[_0xd130('0x20')],{'as':_0xd130('0x155'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x156'),'sourceKey':_0xd130('0x157')});db[_0xd130('0x20')][_0xd130('0x129')](db['VoiceMail'],{'foreignKey':_0xd130('0x156'),'targetKey':_0xd130('0x157')});db[_0xd130('0x158')][_0xd130('0x11a')](db[_0xd130('0x25')],{'as':_0xd130('0x159'),'foreignKey':_0xd130('0x15a'),'constraints':![]});db['VoiceCallReport'][_0xd130('0x11a')](db['VoiceAgentReport'],{'as':_0xd130('0x15b'),'foreignKey':_0xd130('0x15a'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db['User'],{'as':_0xd130('0x112'),'foreignKey':_0xd130('0x115')});db['VoiceCallReport']['belongsTo'](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':'ContactId'});db['MailServerIn'][_0xd130('0x129')](db[_0xd130('0x15d')],{'as':_0xd130('0x15d'),'foreignKey':_0xd130('0x15e')});db[_0xd130('0x3a')][_0xd130('0x129')](db[_0xd130('0x106')],{'as':_0xd130('0x106'),'foreignKey':_0xd130('0x15f'),'onDelete':'restrict'});db[_0xd130('0x3c')]['belongsTo'](db[_0xd130('0x15d')],{'as':_0xd130('0x15d'),'foreignKey':_0xd130('0x15e')});db[_0xd130('0x3c')][_0xd130('0x129')](db['CloudProvider'],{'as':_0xd130('0x106'),'foreignKey':_0xd130('0x15f'),'onDelete':_0xd130('0x160')});db[_0xd130('0x15d')][_0xd130('0x113')](db[_0xd130('0x3a')],{'as':_0xd130('0x161'),'onDelete':_0xd130('0x114')});db[_0xd130('0x15d')][_0xd130('0x113')](db['MailServerOut'],{'as':_0xd130('0x162'),'onDelete':_0xd130('0x114')});db[_0xd130('0x15d')][_0xd130('0x11a')](db[_0xd130('0x79')],{'as':'Dispositions','foreignKey':_0xd130('0x15e'),'onDelete':_0xd130('0x114')});db['MailAccount'][_0xd130('0x11a')](db['CannedAnswer'],{'as':_0xd130('0x163'),'foreignKey':_0xd130('0x15e')});db[_0xd130('0x15d')][_0xd130('0x11a')](db[_0xd130('0x41')],{'as':_0xd130('0x155'),'foreignKey':'MailAccountId'});db[_0xd130('0x15d')][_0xd130('0x11a')](db['MailInteraction'],{'as':'Interactions'});db[_0xd130('0x15d')][_0xd130('0x11a')](db['MailApplication'],{'as':'Applications','foreignKey':_0xd130('0x15e'),'onDelete':_0xd130('0x114')});db[_0xd130('0x15d')][_0xd130('0x129')](db[_0xd130('0xf0')],{'as':_0xd130('0x164'),'foreignKey':_0xd130('0x165')});db[_0xd130('0x15d')][_0xd130('0x129')](db[_0xd130('0x8e')],{'as':_0xd130('0x8e'),'foreignKey':_0xd130('0x166')});db[_0xd130('0x15d')][_0xd130('0x129')](db[_0xd130('0x7f')],{'as':_0xd130('0x167'),'foreignKey':_0xd130('0x14f')});db['MailAccount'][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':'Agents','through':_0xd130('0x13d')});db['MailQueue'][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x151'),'through':_0xd130('0x31')});db[_0xd130('0x3f')][_0xd130('0x12b')](db[_0xd130('0xe1')],{'through':'team_has_mail_queues','as':_0xd130('0x152')});db[_0xd130('0x123')][_0xd130('0x11a')](db['MailMessage'],{'as':_0xd130('0x155'),'onDelete':_0xd130('0x114'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0xd130('0x129')](db[_0xd130('0x15d')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x15e')});db[_0xd130('0x123')][_0xd130('0x129')](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x169')});db[_0xd130('0x123')][_0xd130('0x129')](db[_0xd130('0x112')],{'as':_0xd130('0x16a'),'foreignKey':'UserId'});db['MailInteraction'][_0xd130('0x12b')](db[_0xd130('0x88')],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0xd130('0x123')][_0xd130('0x12b')](db[_0xd130('0x88')],{'through':_0xd130('0x16b'),'as':_0xd130('0x16c')});db[_0xd130('0x123')][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x16d'),'through':'user_has_mail_interactions','foreignKey':_0xd130('0x16e')});db['MailMessage'][_0xd130('0x11a')](db[_0xd130('0xe7')],{'as':_0xd130('0x16f'),'onDelete':'cascade'});db[_0xd130('0x41')][_0xd130('0x129')](db[_0xd130('0x112')],{'as':_0xd130('0x112')});db[_0xd130('0x41')][_0xd130('0x129')](db[_0xd130('0x6e')],{'onDelete':_0xd130('0x114'),'as':_0xd130('0x15c')});db[_0xd130('0x41')]['belongsTo'](db[_0xd130('0x123')],{'as':'Interaction','foreignKey':_0xd130('0x16e')});db[_0xd130('0x41')][_0xd130('0x129')](db[_0xd130('0x15d')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x15e')});db[_0xd130('0x41')]['belongsTo'](db[_0xd130('0x5d')],{'as':_0xd130('0x5d'),'foreignKey':_0xd130('0x170')});db['MailMessage'][_0xd130('0x129')](db[_0xd130('0x67')],{'as':_0xd130('0x67'),'foreignKey':_0xd130('0x171')});db[_0xd130('0x172')][_0xd130('0x129')](db['User'],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db['MailQueue'],{'onDelete':_0xd130('0x160')});db[_0xd130('0x172')][_0xd130('0x129')](db[_0xd130('0x15d')],{'onDelete':_0xd130('0x160')});db[_0xd130('0x172')][_0xd130('0x129')](db[_0xd130('0x7d')],{'onDelete':_0xd130('0x160'),'foreignKey':'IntervalId'});db[_0xd130('0x172')][_0xd130('0x129')](db[_0xd130('0x88')],{'onDelete':_0xd130('0x160'),'foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db[_0xd130('0x15d')],{});db[_0xd130('0x44')][_0xd130('0x129')](db[_0xd130('0xf0')],{'as':_0xd130('0x164'),'foreignKey':_0xd130('0x165')});db[_0xd130('0x44')][_0xd130('0x129')](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x169')});db[_0xd130('0x44')][_0xd130('0x129')](db[_0xd130('0x123')],{});db[_0xd130('0x44')][_0xd130('0x129')](db[_0xd130('0x41')],{});db['MailQueueReport'][_0xd130('0x129')](db[_0xd130('0x112')],{});db[_0xd130('0x44')][_0xd130('0x129')](db['MailQueue'],{});db[_0xd130('0x173')][_0xd130('0x11a')](db[_0xd130('0x47')],{'as':_0xd130('0x174'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0xd130('0x79')],{'as':_0xd130('0x175'),'foreignKey':_0xd130('0x176'),'onDelete':_0xd130('0x114')});db[_0xd130('0x48')][_0xd130('0x11a')](db[_0xd130('0x177')],{'as':_0xd130('0x163'),'foreignKey':_0xd130('0x176')});db[_0xd130('0x48')][_0xd130('0x11a')](db[_0xd130('0x4a')],{'as':'Interactions'});db[_0xd130('0x48')][_0xd130('0x11a')](db[_0xd130('0x178')],{'as':'Applications','foreignKey':_0xd130('0x176'),'onDelete':'cascade'});db[_0xd130('0x48')][_0xd130('0x11a')](db[_0xd130('0x142')],{'as':'Exntensions','onDelete':_0xd130('0x114')});db[_0xd130('0x48')][_0xd130('0x11a')](db['FaxMessage'],{'as':_0xd130('0x155')});db[_0xd130('0x48')]['belongsTo'](db[_0xd130('0x14b')],{'as':'Trunk'});db['FaxAccount'][_0xd130('0x129')](db[_0xd130('0xf0')],{'as':_0xd130('0x164'),'foreignKey':'ListId'});db['FaxAccount'][_0xd130('0x129')](db[_0xd130('0x7f')],{'as':_0xd130('0x167'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x151'),'through':'user_has_fax_accounts'});db[_0xd130('0x178')][_0xd130('0x129')](db[_0xd130('0x112')],{'onDelete':_0xd130('0x160')});db[_0xd130('0x178')]['belongsTo'](db[_0xd130('0x4e')],{'onDelete':_0xd130('0x160')});db[_0xd130('0x178')][_0xd130('0x129')](db[_0xd130('0x48')],{'onDelete':'restrict'});db[_0xd130('0x178')][_0xd130('0x129')](db[_0xd130('0x88')],{'onDelete':'restrict','foreignKey':_0xd130('0x179')});db[_0xd130('0x4a')][_0xd130('0x11a')](db['FaxMessage'],{'as':_0xd130('0x155'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x17a')});db[_0xd130('0x4a')][_0xd130('0x129')](db['FaxAccount'],{'as':'Account','foreignKey':_0xd130('0x176')});db[_0xd130('0x4a')][_0xd130('0x129')](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x169')});db['FaxInteraction'][_0xd130('0x129')](db[_0xd130('0x112')],{'as':_0xd130('0x16a'),'foreignKey':_0xd130('0x115')});db[_0xd130('0x4a')][_0xd130('0x12b')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xd130('0x17b')});db['FaxInteraction'][_0xd130('0x12b')](db[_0xd130('0x88')],{'through':_0xd130('0x17c'),'as':_0xd130('0x16c')});db[_0xd130('0x4a')]['belongsToMany'](db[_0xd130('0x112')],{'as':_0xd130('0x16d'),'through':_0xd130('0x17d'),'foreignKey':_0xd130('0x17a')});db[_0xd130('0x4c')][_0xd130('0x129')](db[_0xd130('0x112')],{'onDelete':_0xd130('0x114'),'as':_0xd130('0x112')});db[_0xd130('0x4c')][_0xd130('0x129')](db[_0xd130('0x4a')],{'as':_0xd130('0x17e'),'foreignKey':_0xd130('0x17a')});db[_0xd130('0x4c')][_0xd130('0x129')](db[_0xd130('0x6e')],{'onDelete':_0xd130('0x114'),'as':'Contact'});db[_0xd130('0x4c')]['belongsTo'](db[_0xd130('0xe7')],{'as':'Attachment','foreignKey':_0xd130('0x17f')});db[_0xd130('0x4c')]['belongsTo'](db[_0xd130('0x48')],{'as':_0xd130('0x168'),'foreignKey':'FaxAccountId'});db[_0xd130('0x4e')][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x151'),'through':_0xd130('0x33')});db[_0xd130('0x4e')][_0xd130('0x12b')](db[_0xd130('0xe1')],{'through':_0xd130('0x180'),'as':_0xd130('0x152')});db['FaxQueueReport'][_0xd130('0x129')](db[_0xd130('0x48')],{});db[_0xd130('0x50')][_0xd130('0x129')](db['CmList'],{'as':_0xd130('0x164'),'foreignKey':_0xd130('0x165')});db[_0xd130('0x50')][_0xd130('0x129')](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0xd130('0x129')](db['FaxInteraction'],{});db[_0xd130('0x50')][_0xd130('0x129')](db['FaxMessage'],{});db[_0xd130('0x50')]['belongsTo'](db[_0xd130('0x112')],{});db['FaxQueueReport'][_0xd130('0x129')](db[_0xd130('0x4e')],{});db[_0xd130('0x52')][_0xd130('0x11a')](db[_0xd130('0x79')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0xd130('0x114')});db[_0xd130('0x52')][_0xd130('0x11a')](db[_0xd130('0x177')],{'as':'Answers','foreignKey':_0xd130('0x181')});db[_0xd130('0x52')]['hasMany'](db[_0xd130('0x55')],{'as':_0xd130('0x155'),'foreignKey':_0xd130('0x181')});db[_0xd130('0x52')][_0xd130('0x11a')](db[_0xd130('0x120')],{'as':_0xd130('0x182')});db[_0xd130('0x52')][_0xd130('0x11a')](db[_0xd130('0x54')],{'as':'Applications','foreignKey':_0xd130('0x181'),'onDelete':_0xd130('0x114')});db[_0xd130('0x52')][_0xd130('0x129')](db['CmList'],{'as':_0xd130('0x164'),'foreignKey':_0xd130('0x165')});db['SmsAccount'][_0xd130('0x129')](db[_0xd130('0x7f')],{'as':_0xd130('0x167'),'foreignKey':_0xd130('0x14f')});db['SmsAccount'][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x151'),'through':'user_has_sms_accounts'});db[_0xd130('0x54')]['belongsTo'](db[_0xd130('0x112')],{'onDelete':_0xd130('0x160')});db[_0xd130('0x54')][_0xd130('0x129')](db['SmsQueue'],{'onDelete':_0xd130('0x160')});db['SmsApplication']['belongsTo'](db[_0xd130('0x52')],{'onDelete':_0xd130('0x160')});db[_0xd130('0x54')][_0xd130('0x129')](db[_0xd130('0x7d')],{'onDelete':_0xd130('0x160'),'foreignKey':_0xd130('0x14e')});db[_0xd130('0x54')][_0xd130('0x129')](db[_0xd130('0x88')],{'onDelete':'restrict','foreignKey':_0xd130('0x179')});db[_0xd130('0x120')][_0xd130('0x11a')](db[_0xd130('0x55')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xd130('0x183')});db[_0xd130('0x120')][_0xd130('0x129')](db[_0xd130('0x52')],{'as':'Account','foreignKey':_0xd130('0x181')});db[_0xd130('0x120')][_0xd130('0x129')](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':'ContactId'});db[_0xd130('0x120')][_0xd130('0x129')](db[_0xd130('0x112')],{'as':'Owner','foreignKey':_0xd130('0x115')});db[_0xd130('0x120')][_0xd130('0x12b')](db[_0xd130('0x88')],{'through':_0xd130('0x184'),'as':_0xd130('0x17b')});db[_0xd130('0x120')][_0xd130('0x12b')](db[_0xd130('0x88')],{'through':_0xd130('0x184'),'as':_0xd130('0x16c')});db['SmsInteraction']['belongsToMany'](db['User'],{'as':_0xd130('0x16d'),'through':_0xd130('0x131'),'foreignKey':_0xd130('0x183')});db['SmsMessage']['belongsTo'](db[_0xd130('0x112')],{'as':_0xd130('0x112')});db[_0xd130('0x55')]['belongsTo'](db[_0xd130('0x6e')],{'onDelete':'cascade','as':'Contact'});db[_0xd130('0x55')][_0xd130('0x129')](db[_0xd130('0x120')],{'onDelete':_0xd130('0x114'),'as':_0xd130('0x17e'),'foreignKey':_0xd130('0x183')});db['SmsMessage'][_0xd130('0x129')](db[_0xd130('0x52')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xd130('0x137')][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':'Agents','through':_0xd130('0x35'),'foreignKey':_0xd130('0x185')});db['SmsQueue'][_0xd130('0x12b')](db['Team'],{'through':_0xd130('0x186'),'as':'Teams'});db[_0xd130('0x58')][_0xd130('0x11a')](db['Disposition'],{'as':_0xd130('0x175'),'foreignKey':'OpenchannelAccountId','onDelete':_0xd130('0x114')});db['OpenchannelAccount'][_0xd130('0x11a')](db['CannedAnswer'],{'as':_0xd130('0x163'),'foreignKey':_0xd130('0x187')});db['OpenchannelAccount'][_0xd130('0x11a')](db[_0xd130('0x188')],{'as':_0xd130('0x182'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0xd130('0x189')],{'as':_0xd130('0x155'),'foreignKey':'OpenchannelAccountId'});db[_0xd130('0x58')][_0xd130('0x11a')](db[_0xd130('0x59')],{'as':_0xd130('0x18a'),'foreignKey':'OpenchannelAccountId','onDelete':_0xd130('0x114')});db['OpenchannelAccount'][_0xd130('0x129')](db[_0xd130('0xf0')],{'as':_0xd130('0x164'),'foreignKey':_0xd130('0x165')});db[_0xd130('0x58')][_0xd130('0x129')](db[_0xd130('0x7f')],{'as':_0xd130('0x167'),'foreignKey':_0xd130('0x14f')});db[_0xd130('0x58')][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x151'),'through':_0xd130('0x18b')});db[_0xd130('0x59')][_0xd130('0x129')](db[_0xd130('0x112')],{'onDelete':_0xd130('0x160')});db['OpenchannelApplication']['belongsTo'](db[_0xd130('0x5b')],{'onDelete':_0xd130('0x160'),'foreignKey':_0xd130('0x18c')});db[_0xd130('0x59')][_0xd130('0x129')](db[_0xd130('0x58')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0xd130('0x129')](db[_0xd130('0x7d')],{'onDelete':_0xd130('0x160'),'foreignKey':_0xd130('0x14e')});db[_0xd130('0x59')][_0xd130('0x129')](db[_0xd130('0x88')],{'onDelete':_0xd130('0x160'),'foreignKey':_0xd130('0x179')});db['OpenchannelInteraction'][_0xd130('0x11a')](db[_0xd130('0x189')],{'as':_0xd130('0x155'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x18d')});db[_0xd130('0x188')]['belongsTo'](db[_0xd130('0x58')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x187')});db[_0xd130('0x188')][_0xd130('0x129')](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x169')});db[_0xd130('0x188')][_0xd130('0x129')](db[_0xd130('0x112')],{'as':_0xd130('0x16a'),'foreignKey':_0xd130('0x115')});db['OpenchannelInteraction']['belongsToMany'](db[_0xd130('0x88')],{'through':'openchannel_interaction_has_tags','as':_0xd130('0x17b')});db[_0xd130('0x188')][_0xd130('0x12b')](db[_0xd130('0x88')],{'through':_0xd130('0x18e'),'as':'ThroughTags'});db[_0xd130('0x188')][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x16d'),'through':_0xd130('0x18f'),'foreignKey':_0xd130('0x18d')});db[_0xd130('0x189')][_0xd130('0x129')](db[_0xd130('0x112')],{'onDelete':_0xd130('0x114'),'as':'User'});db[_0xd130('0x189')][_0xd130('0x129')](db[_0xd130('0x6e')],{'onDelete':_0xd130('0x114'),'as':_0xd130('0x15c')});db[_0xd130('0x189')][_0xd130('0x129')](db[_0xd130('0x188')],{'onDelete':_0xd130('0x114'),'as':_0xd130('0x17e'),'foreignKey':_0xd130('0x18d')});db[_0xd130('0x189')][_0xd130('0x129')](db[_0xd130('0xe7')],{'as':_0xd130('0xe7'),'foreignKey':_0xd130('0x17f')});db[_0xd130('0x189')][_0xd130('0x129')](db[_0xd130('0x58')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x187')});db[_0xd130('0x5b')][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x151'),'through':'UserOpenchannelQueue','foreignKey':_0xd130('0x18c')});db[_0xd130('0x5b')][_0xd130('0x12b')](db[_0xd130('0xe1')],{'through':_0xd130('0x190'),'as':_0xd130('0x152')});db[_0xd130('0x5d')][_0xd130('0x11a')](db[_0xd130('0x79')],{'as':_0xd130('0x175'),'foreignKey':_0xd130('0x170'),'onDelete':_0xd130('0x114')});db[_0xd130('0x5d')]['hasMany'](db[_0xd130('0x177')],{'as':_0xd130('0x163'),'foreignKey':_0xd130('0x170')});db[_0xd130('0x5d')][_0xd130('0x11a')](db['ChatProactiveAction'],{'as':_0xd130('0x191')});db['ChatWebsite'][_0xd130('0x11a')](db[_0xd130('0x63')],{'as':_0xd130('0x182')});db[_0xd130('0x5d')]['hasMany'](db[_0xd130('0x61')],{'as':_0xd130('0x18a'),'foreignKey':'ChatWebsiteId','onDelete':_0xd130('0x114')});db[_0xd130('0x5d')][_0xd130('0x11a')](db[_0xd130('0x65')],{'as':_0xd130('0x155')});db['ChatWebsite']['belongsTo'](db[_0xd130('0xf0')],{'as':'List','foreignKey':_0xd130('0x165')});db[_0xd130('0x5d')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0xd130('0x5d')]['belongsTo'](db['MailAccount'],{'as':_0xd130('0x15d'),'foreignKey':_0xd130('0x15e')});db[_0xd130('0x5d')][_0xd130('0x129')](db[_0xd130('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xd130('0x5d')][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x151'),'through':_0xd130('0x192')});db[_0xd130('0x5f')][_0xd130('0x129')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0xd130('0x129')](db[_0xd130('0xf0')],{'as':_0xd130('0x164'),'foreignKey':_0xd130('0x165')});db[_0xd130('0x5f')][_0xd130('0x129')](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0xd130('0x129')](db['OpenchannelInteraction'],{});db[_0xd130('0x5f')][_0xd130('0x129')](db['OpenchannelMessage'],{});db[_0xd130('0x5f')][_0xd130('0x129')](db[_0xd130('0x112')],{});db['OpenchannelQueueReport'][_0xd130('0x129')](db[_0xd130('0x5b')],{});db[_0xd130('0x61')]['belongsTo'](db[_0xd130('0x112')],{'as':_0xd130('0x193'),'foreignKey':_0xd130('0x115'),'onDelete':_0xd130('0x160')});db['ChatApplication'][_0xd130('0x129')](db['ChatQueue'],{'as':_0xd130('0x194'),'foreignKey':_0xd130('0x195'),'onDelete':_0xd130('0x160')});db[_0xd130('0x61')][_0xd130('0x129')](db[_0xd130('0x5d')],{'as':'Website','foreignKey':_0xd130('0x170'),'onDelete':_0xd130('0x160')});db['ChatApplication'][_0xd130('0x129')](db[_0xd130('0x88')],{'onDelete':_0xd130('0x160'),'foreignKey':'TagId'});db[_0xd130('0x63')][_0xd130('0x11a')](db[_0xd130('0x65')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xd130('0x196')});db[_0xd130('0x63')][_0xd130('0x129')](db[_0xd130('0x5d')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x170')});db[_0xd130('0x63')][_0xd130('0x129')](db['CmContact'],{'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x169')});db[_0xd130('0x63')][_0xd130('0x129')](db['User'],{'as':_0xd130('0x16a'),'foreignKey':_0xd130('0x115')});db['ChatInteraction'][_0xd130('0x12b')](db[_0xd130('0x88')],{'through':_0xd130('0x197'),'as':'Tags'});db[_0xd130('0x63')]['belongsToMany'](db[_0xd130('0x88')],{'through':_0xd130('0x197'),'as':_0xd130('0x16c')});db[_0xd130('0x63')][_0xd130('0x12b')](db['User'],{'as':_0xd130('0x16d'),'through':'user_has_chat_interactions','foreignKey':_0xd130('0x196')});db['ChatMessage'][_0xd130('0x129')](db[_0xd130('0x112')],{'onDelete':_0xd130('0x114'),'as':'User'});db[_0xd130('0x65')][_0xd130('0x129')](db[_0xd130('0x6e')],{'onDelete':_0xd130('0x114'),'as':_0xd130('0x15c'),'foreignKey':'ContactId'});db[_0xd130('0x65')]['belongsTo'](db[_0xd130('0x63')],{'onDelete':'cascade','as':_0xd130('0x17e'),'foreignKey':_0xd130('0x196')});db[_0xd130('0x65')]['belongsTo'](db[_0xd130('0xe7')],{'as':_0xd130('0xe7'),'foreignKey':_0xd130('0x17f')});db[_0xd130('0x65')][_0xd130('0x129')](db[_0xd130('0x5d')],{'as':'Account','foreignKey':_0xd130('0x170')});db[_0xd130('0x67')][_0xd130('0x11a')](db[_0xd130('0xe7')],{'as':_0xd130('0x16f'),'foreignKey':_0xd130('0x171'),'onDelete':_0xd130('0x114'),'hooks':!![]});db['ChatOfflineMessage'][_0xd130('0x129')](db[_0xd130('0x6e')],{'onDelete':_0xd130('0x114'),'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x169')});db[_0xd130('0x67')]['belongsTo'](db[_0xd130('0x5d')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x170')});db[_0xd130('0x69')]['belongsToMany'](db[_0xd130('0x112')],{'as':'Agents','through':_0xd130('0x2f'),'hooks':!![]});db[_0xd130('0x69')][_0xd130('0x12b')](db[_0xd130('0xe1')],{'through':_0xd130('0x198'),'as':'Teams'});db[_0xd130('0x6a')][_0xd130('0x11a')](db[_0xd130('0xce')],{'as':_0xd130('0x155'),'foreignKey':_0xd130('0x199'),'onDelete':_0xd130('0x114')});db[_0xd130('0x6a')]['belongsToMany'](db[_0xd130('0x112')],{'as':'Members','through':'chat_group_has_users'});db[_0xd130('0x19a')][_0xd130('0x129')](db[_0xd130('0x5d')],{'as':_0xd130('0x19b'),'foreignKey':_0xd130('0x170')});db[_0xd130('0x6c')][_0xd130('0x11a')](db[_0xd130('0x6e')],{'as':'Contacts','foreignKey':_0xd130('0x19c')});db[_0xd130('0x6e')][_0xd130('0x11a')](db[_0xd130('0x19d')],{'as':_0xd130('0x19e'),'foreignKey':_0xd130('0x19f')});db[_0xd130('0x6e')][_0xd130('0x11a')](db['CmHopper'],{'as':_0xd130('0x1a0'),'foreignKey':'ContactId'});db[_0xd130('0x6e')][_0xd130('0x11a')](db[_0xd130('0x72')],{'as':_0xd130('0x147'),'foreignKey':_0xd130('0x169')});db[_0xd130('0x6e')][_0xd130('0x11a')](db[_0xd130('0x74')],{'as':'HopperHistories','foreignKey':_0xd130('0x169')});db[_0xd130('0x6e')][_0xd130('0x11a')](db[_0xd130('0x11d')],{'as':_0xd130('0x11d'),'foreignKey':'ContactId'});db[_0xd130('0x6e')][_0xd130('0x11a')](db['JscriptySessionReport'],{'as':_0xd130('0x14a'),'foreignKey':_0xd130('0x169')});db[_0xd130('0x6e')][_0xd130('0x11a')](db[_0xd130('0x188')],{'as':_0xd130('0x11e'),'foreignKey':_0xd130('0x169'),'onDelete':_0xd130('0x160')});db['CmContact']['hasMany'](db[_0xd130('0x63')],{'as':_0xd130('0x11f'),'foreignKey':_0xd130('0x169'),'onDelete':_0xd130('0x160')});db['CmContact'][_0xd130('0x11a')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xd130('0x169'),'onDelete':'restrict'});db[_0xd130('0x6e')][_0xd130('0x11a')](db[_0xd130('0x4a')],{'as':_0xd130('0x122'),'foreignKey':_0xd130('0x169'),'onDelete':_0xd130('0x160')});db['CmContact']['hasMany'](db[_0xd130('0x123')],{'as':_0xd130('0x124'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact']['belongsTo'](db['CmCompany'],{'as':_0xd130('0x1a1'),'foreignKey':_0xd130('0x19c')});db['CmContact']['belongsTo'](db[_0xd130('0xf0')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0xd130('0x6e')][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x16d'),'through':_0xd130('0x12d')});db[_0xd130('0x6e')]['belongsToMany'](db[_0xd130('0x88')],{'as':_0xd130('0x17b'),'through':'cm_contact_has_tags'});db[_0xd130('0x6e')][_0xd130('0x12b')](db[_0xd130('0x88')],{'through':'cm_contact_has_tags','as':_0xd130('0x16c')});db[_0xd130('0x127')]['hasMany'](db[_0xd130('0x8c')],{'as':_0xd130('0x1a2'),'foreignKey':_0xd130('0x1a3')});db[_0xd130('0x127')]['belongsTo'](db[_0xd130('0x6e')],{'as':'Contact','foreignKey':_0xd130('0x169'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0xd130('0xf0')],{'as':'List','foreignKey':_0xd130('0x165'),'onDelete':_0xd130('0x114')});db[_0xd130('0x127')][_0xd130('0x129')](db['User'],{'as':'Agent','foreignKey':_0xd130('0x115')});db['CmHopper']['belongsTo'](db[_0xd130('0x19')],{'as':_0xd130('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xd130('0x127')][_0xd130('0x129')](db[_0xd130('0x1a4')],{'as':_0xd130('0x1a4'),'foreignKey':_0xd130('0x1a5'),'onDelete':'cascade'});db[_0xd130('0x127')][_0xd130('0x129')](db[_0xd130('0x112')],{'as':_0xd130('0x16a'),'foreignKey':_0xd130('0x1a6')});db['CmHopperBlack'][_0xd130('0x129')](db['CmContact'],{'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x169'),'onDelete':'cascade'});db[_0xd130('0x70')][_0xd130('0x129')](db[_0xd130('0xf0')],{'as':_0xd130('0x164'),'foreignKey':_0xd130('0x165'),'onDelete':'cascade'});db[_0xd130('0x70')][_0xd130('0x129')](db[_0xd130('0x19')],{'as':_0xd130('0x194'),'foreignKey':'VoiceQueueId','onDelete':_0xd130('0x114')});db[_0xd130('0x70')][_0xd130('0x129')](db[_0xd130('0x1a4')],{'as':'Campaign','foreignKey':_0xd130('0x1a5'),'onDelete':_0xd130('0x114')});db['Automation']['hasMany'](db[_0xd130('0x7b')],{'as':{'plural':_0xd130('0x1a7'),'singular':_0xd130('0x1a8')},'foreignKey':_0xd130('0x1a9'),'onDelete':_0xd130('0x114'),'hooks':!![]});db[_0xd130('0x1aa')][_0xd130('0x11a')](db[_0xd130('0x7b')],{'as':{'plural':_0xd130('0x1ab'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0xd130('0x114'),'hooks':!![]});db[_0xd130('0x1aa')]['hasMany'](db['Action'],{'as':'Actions','foreignKey':_0xd130('0x1ac'),'onDelete':_0xd130('0x114'),'hooks':!![]});db[_0xd130('0x79')][_0xd130('0x11a')](db[_0xd130('0x79')],{'as':_0xd130('0x175'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0xd130('0x7d')][_0xd130('0x11a')](db[_0xd130('0x7d')],{'as':_0xd130('0x1ad'),'foreignKey':_0xd130('0x14e'),'onDelete':_0xd130('0x114'),'hooks':!![],'required':![]});db[_0xd130('0x7d')][_0xd130('0x11a')](db[_0xd130('0x142')],{'as':'Extensions','foreignKey':_0xd130('0x14e'),'onDelete':'restrict'});db[_0xd130('0x7d')][_0xd130('0x11a')](db[_0xd130('0x172')],{'as':_0xd130('0x1ae'),'foreignKey':'IntervalId'});db[_0xd130('0x7d')][_0xd130('0x11a')](db[_0xd130('0x61')],{'as':_0xd130('0x1af'),'foreignKey':_0xd130('0x14e')});db[_0xd130('0x7d')][_0xd130('0x11a')](db[_0xd130('0x178')],{'as':_0xd130('0x1b0'),'foreignKey':'IntervalId'});db[_0xd130('0x7d')][_0xd130('0x11a')](db[_0xd130('0x54')],{'as':_0xd130('0x1b1'),'foreignKey':_0xd130('0x14e')});db[_0xd130('0x84')][_0xd130('0x129')](db[_0xd130('0x15d')],{});db[_0xd130('0x84')][_0xd130('0x129')](db[_0xd130('0x1b2')],{'foreignKey':'DefaultReportId'});db[_0xd130('0x84')][_0xd130('0x129')](db[_0xd130('0x95')],{'foreignKey':_0xd130('0x1b3')});db[_0xd130('0x86')]['belongsToMany'](db[_0xd130('0x17')],{'as':_0xd130('0x1b4'),'through':_0xd130('0x1b5'),'onDelete':'restrict'});db['Tag'][_0xd130('0x12b')](db[_0xd130('0x6e')],{'through':_0xd130('0x1b6')});db[_0xd130('0x88')][_0xd130('0x12b')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0xd130('0x88')]['belongsToMany'](db[_0xd130('0x123')],{'through':_0xd130('0x16b')});db[_0xd130('0x88')][_0xd130('0x12b')](db[_0xd130('0x120')],{'through':_0xd130('0x184')});db[_0xd130('0x88')][_0xd130('0x12b')](db[_0xd130('0x4a')],{'through':_0xd130('0x17c')});db[_0xd130('0x88')][_0xd130('0x12b')](db[_0xd130('0x188')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0xd130('0x12b')](db[_0xd130('0xfe')],{'through':_0xd130('0x1b7')});db[_0xd130('0x19d')]['belongsTo'](db[_0xd130('0x8a')],{'as':_0xd130('0x1b8'),'foreignKey':'ItemTypeId'});db['CmHopperAdditionalPhone'][_0xd130('0x129')](db[_0xd130('0x127')],{'as':_0xd130('0x1b9'),'foreignKey':_0xd130('0x1a3')});db[_0xd130('0x19d')]['belongsTo'](db['CmContact'],{'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x19f')});db[_0xd130('0x8f')][_0xd130('0x11a')](db['Condition'],{'as':{'plural':_0xd130('0x1ba'),'singular':_0xd130('0x1bb')},'foreignKey':'TriggerAllId','onDelete':_0xd130('0x114'),'hooks':!![]});db[_0xd130('0x8f')][_0xd130('0x11a')](db[_0xd130('0x7b')],{'as':{'plural':_0xd130('0x1bc'),'singular':_0xd130('0x1bd')},'foreignKey':_0xd130('0x1be'),'onDelete':'cascade','hooks':!![]});db[_0xd130('0x8f')]['hasMany'](db[_0xd130('0x76')],{'as':'Actions','foreignKey':_0xd130('0x1bf'),'onDelete':_0xd130('0x114'),'hooks':!![]});db[_0xd130('0x95')][_0xd130('0x11a')](db['AnalyticFieldReport'],{'as':_0xd130('0x1c0'),'onDelete':'cascade','foreignKey':_0xd130('0x1b3'),'hooks':!![]});db[_0xd130('0x1b2')][_0xd130('0x11a')](db[_0xd130('0x9b')],{'as':_0xd130('0x1c0'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1c1')});db['AnalyticMetric'][_0xd130('0x11a')](db[_0xd130('0x9b')],{'as':_0xd130('0x1c0'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0xd130('0x99')],{'foreignKey':_0xd130('0x1c2')});db[_0xd130('0x9f')]['hasMany'](db[_0xd130('0x1c3')],{'as':_0xd130('0x1c4'),'onDelete':_0xd130('0x114'),'foreignKey':'AccountId'});db[_0xd130('0x1c3')][_0xd130('0x11a')](db[_0xd130('0xa2')],{'as':_0xd130('0x1c5'),'onDelete':_0xd130('0x114'),'foreignKey':'SubjectId'});db[_0xd130('0x1c3')][_0xd130('0x11a')](db[_0xd130('0xa2')],{'as':_0xd130('0x1c6'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xd130('0x1c3')][_0xd130('0x11a')](db[_0xd130('0xa2')],{'as':_0xd130('0x1c0'),'onDelete':_0xd130('0x114'),'foreignKey':'FieldId'});db[_0xd130('0x1c3')][_0xd130('0x129')](db[_0xd130('0x9f')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x1c7')});db[_0xd130('0xa2')]['hasMany'](db['SalesforceField'],{'as':_0xd130('0x1c8'),'foreignKey':_0xd130('0x1c9')});db[_0xd130('0xa2')][_0xd130('0x11a')](db['SalesforceField'],{'as':_0xd130('0x1ca'),'foreignKey':'DescriptionId'});db[_0xd130('0xa2')][_0xd130('0x11a')](db['SalesforceField'],{'as':_0xd130('0x1cb'),'foreignKey':_0xd130('0x1cc')});db[_0xd130('0xa2')][_0xd130('0x129')](db[_0xd130('0x91')],{'as':'Variable','foreignKey':_0xd130('0x1cd')});db[_0xd130('0xa4')][_0xd130('0x11a')](db['SugarcrmConfiguration'],{'as':_0xd130('0x1c4'),'onDelete':_0xd130('0x114'),'foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0xd130('0x11a')](db[_0xd130('0x1ce')],{'as':_0xd130('0x1c5'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1c9')});db[_0xd130('0xa6')][_0xd130('0x11a')](db[_0xd130('0x1ce')],{'as':_0xd130('0x1c6'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1cf')});db[_0xd130('0xa6')][_0xd130('0x11a')](db[_0xd130('0x1ce')],{'as':_0xd130('0x1c0'),'onDelete':_0xd130('0x114'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0xd130('0x129')](db['SugarcrmAccount'],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x1c7')});db[_0xd130('0x1ce')][_0xd130('0x11a')](db['SugarcrmField'],{'as':_0xd130('0x1c8'),'foreignKey':'SubjectId'});db[_0xd130('0x1ce')][_0xd130('0x11a')](db['SugarcrmField'],{'as':'Description','foreignKey':_0xd130('0x1cf')});db[_0xd130('0x1ce')][_0xd130('0x11a')](db[_0xd130('0x1ce')],{'as':_0xd130('0x1cb'),'foreignKey':'FieldId'});db[_0xd130('0x1ce')][_0xd130('0x129')](db[_0xd130('0x91')],{'as':_0xd130('0x91'),'foreignKey':'VariableId'});db['DeskAccount'][_0xd130('0x11a')](db[_0xd130('0xaa')],{'as':_0xd130('0x1c4'),'onDelete':_0xd130('0x114'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0xd130('0x11a')](db[_0xd130('0xab')],{'as':'Subjects','onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1c9')});db[_0xd130('0xaa')][_0xd130('0x11a')](db[_0xd130('0xab')],{'as':_0xd130('0x1c6'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1cf')});db[_0xd130('0xaa')]['hasMany'](db['DeskField'],{'as':_0xd130('0x1c0'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xd130('0xaa')][_0xd130('0x129')](db[_0xd130('0xa8')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x1c7')});db[_0xd130('0xaa')][_0xd130('0x12b')](db[_0xd130('0x88')],{'through':_0xd130('0x1d0')});db[_0xd130('0xab')][_0xd130('0x11a')](db[_0xd130('0xab')],{'as':_0xd130('0x1c8'),'foreignKey':_0xd130('0x1c9')});db[_0xd130('0xab')][_0xd130('0x11a')](db[_0xd130('0xab')],{'as':_0xd130('0x1ca'),'foreignKey':_0xd130('0x1cf')});db[_0xd130('0xab')][_0xd130('0x11a')](db[_0xd130('0xab')],{'as':'Field','foreignKey':'FieldId'});db[_0xd130('0xab')]['belongsTo'](db[_0xd130('0x91')],{'as':_0xd130('0x91'),'foreignKey':'VariableId'});db[_0xd130('0xad')][_0xd130('0x11a')](db[_0xd130('0x1d1')],{'as':'Configurations','onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1c7')});db[_0xd130('0x1d1')][_0xd130('0x11a')](db['ZohoField'],{'as':_0xd130('0x1c5'),'onDelete':'cascade','foreignKey':_0xd130('0x1c9')});db[_0xd130('0x1d1')][_0xd130('0x11a')](db['ZohoField'],{'as':_0xd130('0x1c6'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1cf')});db[_0xd130('0x1d1')][_0xd130('0x11a')](db[_0xd130('0xb0')],{'as':_0xd130('0x1c0'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1cc')});db[_0xd130('0x1d1')]['belongsTo'](db[_0xd130('0xad')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x1c7')});db[_0xd130('0xb0')][_0xd130('0x11a')](db['ZohoField'],{'as':_0xd130('0x1c8'),'foreignKey':_0xd130('0x1c9')});db[_0xd130('0xb0')]['hasMany'](db[_0xd130('0xb0')],{'as':'Description','foreignKey':_0xd130('0x1cf')});db[_0xd130('0xb0')][_0xd130('0x11a')](db[_0xd130('0xb0')],{'as':_0xd130('0x1cb'),'foreignKey':_0xd130('0x1cc')});db[_0xd130('0xb0')][_0xd130('0x129')](db[_0xd130('0x91')],{'as':'Variable','foreignKey':_0xd130('0x1cd')});db[_0xd130('0xb1')]['hasMany'](db[_0xd130('0xb3')],{'as':_0xd130('0x1c4'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xd130('0xb3')][_0xd130('0x11a')](db[_0xd130('0x1d2')],{'as':_0xd130('0x1c5'),'foreignKey':'SubjectId'});db[_0xd130('0xb3')]['hasMany'](db[_0xd130('0x1d2')],{'as':_0xd130('0x1c6'),'foreignKey':_0xd130('0x1cf')});db[_0xd130('0xb3')][_0xd130('0x11a')](db[_0xd130('0x1d2')],{'as':_0xd130('0x1c0'),'foreignKey':_0xd130('0x1cc')});db[_0xd130('0xb3')][_0xd130('0x129')](db[_0xd130('0xb1')],{'as':'Account','foreignKey':'AccountId'});db[_0xd130('0xb3')][_0xd130('0x12b')](db[_0xd130('0x88')],{'through':_0xd130('0x1d3')});db[_0xd130('0x1d2')][_0xd130('0x11a')](db[_0xd130('0x1d2')],{'as':_0xd130('0x1c8'),'foreignKey':'SubjectId'});db[_0xd130('0x1d2')][_0xd130('0x11a')](db[_0xd130('0x1d2')],{'as':_0xd130('0x1ca'),'foreignKey':_0xd130('0x1cf')});db['ZendeskField'][_0xd130('0x11a')](db[_0xd130('0x1d2')],{'as':_0xd130('0x1cb'),'foreignKey':_0xd130('0x1cc')});db[_0xd130('0x1d2')][_0xd130('0x129')](db[_0xd130('0x91')],{'as':'Variable','foreignKey':_0xd130('0x1cd')});db[_0xd130('0xb5')]['hasMany'](db[_0xd130('0x1d4')],{'as':_0xd130('0x1c4'),'onDelete':'cascade','foreignKey':_0xd130('0x1c7')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0xd130('0x1c5'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1c9')});db[_0xd130('0x1d4')][_0xd130('0x11a')](db[_0xd130('0xb7')],{'as':_0xd130('0x1c6'),'onDelete':_0xd130('0x114'),'foreignKey':'DescriptionId'});db[_0xd130('0x1d4')]['hasMany'](db['FreshdeskField'],{'as':_0xd130('0x1c0'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1cc')});db[_0xd130('0x1d4')][_0xd130('0x129')](db[_0xd130('0xb5')],{'as':_0xd130('0x168'),'foreignKey':'AccountId'});db['FreshdeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0xd130('0x1d5')});db[_0xd130('0xb7')][_0xd130('0x11a')](db[_0xd130('0xb7')],{'as':_0xd130('0x1c8'),'foreignKey':_0xd130('0x1c9')});db[_0xd130('0xb7')][_0xd130('0x11a')](db[_0xd130('0xb7')],{'as':_0xd130('0x1ca'),'foreignKey':_0xd130('0x1cf')});db['FreshdeskField'][_0xd130('0x11a')](db[_0xd130('0xb7')],{'as':_0xd130('0x1cb'),'foreignKey':_0xd130('0x1cc')});db[_0xd130('0xb7')]['belongsTo'](db[_0xd130('0x91')],{'as':'Variable','foreignKey':_0xd130('0x1cd')});db['VtigerAccount'][_0xd130('0x11a')](db['VtigerConfiguration'],{'as':_0xd130('0x1c4'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1c7')});db[_0xd130('0xbb')]['hasMany'](db[_0xd130('0x1d6')],{'as':'Subjects','foreignKey':_0xd130('0x1c9')});db[_0xd130('0xbb')][_0xd130('0x11a')](db['VtigerField'],{'as':_0xd130('0x1c6'),'foreignKey':_0xd130('0x1cf')});db[_0xd130('0xbb')]['hasMany'](db['VtigerField'],{'as':'Fields','foreignKey':'FieldId'});db[_0xd130('0xbb')][_0xd130('0x129')](db[_0xd130('0xb9')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x1c7')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xd130('0x1d6')][_0xd130('0x11a')](db['VtigerField'],{'as':_0xd130('0x1ca'),'foreignKey':'DescriptionId'});db[_0xd130('0x1d6')][_0xd130('0x11a')](db['VtigerField'],{'as':_0xd130('0x1cb'),'foreignKey':_0xd130('0x1cc')});db['VtigerField'][_0xd130('0x129')](db[_0xd130('0x91')],{'as':_0xd130('0x91'),'foreignKey':_0xd130('0x1cd')});db[_0xd130('0xbd')][_0xd130('0x11a')](db[_0xd130('0x1d7')],{'as':'Configurations','onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1c7')});db[_0xd130('0x1d7')][_0xd130('0x11a')](db['ServicenowField'],{'as':_0xd130('0x1c5'),'foreignKey':'SubjectId'});db[_0xd130('0x1d7')][_0xd130('0x11a')](db[_0xd130('0x1d8')],{'as':_0xd130('0x1c6'),'foreignKey':_0xd130('0x1cf')});db[_0xd130('0x1d7')]['hasMany'](db[_0xd130('0x1d8')],{'as':_0xd130('0x1c0'),'foreignKey':_0xd130('0x1cc')});db[_0xd130('0x1d7')][_0xd130('0x129')](db[_0xd130('0xbd')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x1c7')});db[_0xd130('0x1d8')][_0xd130('0x11a')](db[_0xd130('0x1d8')],{'as':_0xd130('0x1c8'),'foreignKey':_0xd130('0x1c9')});db['ServicenowField']['hasMany'](db[_0xd130('0x1d8')],{'as':_0xd130('0x1ca'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0xd130('0x11a')](db[_0xd130('0x1d8')],{'as':'Field','foreignKey':_0xd130('0x1cc')});db[_0xd130('0x1d8')][_0xd130('0x129')](db[_0xd130('0x91')],{'as':_0xd130('0x91'),'foreignKey':_0xd130('0x1cd')});db[_0xd130('0xc0')][_0xd130('0x11a')](db[_0xd130('0xc2')],{'as':_0xd130('0x1c4'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1c7')});db[_0xd130('0xc0')][_0xd130('0x129')](db[_0xd130('0x106')],{'as':_0xd130('0x106'),'foreignKey':_0xd130('0x15f')});db[_0xd130('0xc2')]['hasMany'](db[_0xd130('0x1d9')],{'as':_0xd130('0x1c5'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1c9')});db[_0xd130('0xc2')][_0xd130('0x11a')](db[_0xd130('0x1d9')],{'as':'Descriptions','onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1cf')});db[_0xd130('0xc2')]['hasMany'](db[_0xd130('0x1d9')],{'as':_0xd130('0x1c0'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1cc')});db[_0xd130('0xc2')][_0xd130('0x129')](db[_0xd130('0xc0')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x1c7')});db['Dynamics365Field'][_0xd130('0x11a')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0xd130('0x1c9')});db['Dynamics365Field'][_0xd130('0x11a')](db[_0xd130('0x1d9')],{'as':_0xd130('0x1ca'),'foreignKey':'DescriptionId'});db[_0xd130('0x1d9')]['hasMany'](db[_0xd130('0x1d9')],{'as':_0xd130('0x1cb'),'foreignKey':_0xd130('0x1cc')});db[_0xd130('0x1d9')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xd130('0x1cd')});db[_0xd130('0xc5')][_0xd130('0x11a')](db[_0xd130('0xc6')],{'as':_0xd130('0x1c4'),'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1c7')});db[_0xd130('0xc6')][_0xd130('0x11a')](db[_0xd130('0xc8')],{'as':_0xd130('0x1c5'),'foreignKey':_0xd130('0x1c9')});db['FreshsalesConfiguration'][_0xd130('0x11a')](db[_0xd130('0xc8')],{'as':_0xd130('0x1c6'),'foreignKey':'DescriptionId'});db[_0xd130('0xc6')][_0xd130('0x11a')](db[_0xd130('0xc8')],{'as':_0xd130('0x1c0'),'foreignKey':'FieldId'});db[_0xd130('0xc6')][_0xd130('0x129')](db[_0xd130('0xc5')],{'as':'Account','foreignKey':_0xd130('0x1c7')});db[_0xd130('0xc8')]['hasMany'](db[_0xd130('0xc8')],{'as':'Subject','foreignKey':_0xd130('0x1c9')});db[_0xd130('0xc8')]['hasMany'](db[_0xd130('0xc8')],{'as':_0xd130('0x1ca'),'foreignKey':_0xd130('0x1cf')});db['FreshsalesField'][_0xd130('0x11a')](db['FreshsalesField'],{'as':_0xd130('0x1cb'),'foreignKey':_0xd130('0x1cc')});db[_0xd130('0xc8')][_0xd130('0x129')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xd130('0xcd')][_0xd130('0x129')](db[_0xd130('0x5d')],{});db[_0xd130('0xcd')][_0xd130('0x129')](db[_0xd130('0xf0')],{'as':_0xd130('0x164'),'foreignKey':_0xd130('0x165')});db[_0xd130('0xcd')][_0xd130('0x129')](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x169')});db[_0xd130('0xcd')][_0xd130('0x129')](db[_0xd130('0x63')],{});db[_0xd130('0xcd')][_0xd130('0x129')](db['ChatMessage'],{});db['ChatQueueReport'][_0xd130('0x129')](db[_0xd130('0x112')],{});db[_0xd130('0xcd')]['belongsTo'](db[_0xd130('0x69')],{});db[_0xd130('0xce')][_0xd130('0x129')](db[_0xd130('0x112')],{'onDelete':_0xd130('0x114'),'foreignKey':_0xd130('0x1da')});db['ChatInternalMessage'][_0xd130('0x129')](db['User'],{'onDelete':'cascade','foreignKey':_0xd130('0x1db')});db['JscriptySessionReport'][_0xd130('0x11a')](db[_0xd130('0x1dc')],{'foreignKey':'SessionId','onDelete':_0xd130('0x114')});db[_0xd130('0xd1')][_0xd130('0x11a')](db[_0xd130('0xcf')],{'foreignKey':'SessionId','onDelete':_0xd130('0x114')});db['SmsQueueReport'][_0xd130('0x129')](db[_0xd130('0x52')],{});db['SmsQueueReport'][_0xd130('0x129')](db[_0xd130('0xf0')],{'as':_0xd130('0x164'),'foreignKey':_0xd130('0x165')});db[_0xd130('0x1dd')][_0xd130('0x129')](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x169')});db[_0xd130('0x1dd')][_0xd130('0x129')](db[_0xd130('0x120')],{});db['SmsQueueReport'][_0xd130('0x129')](db[_0xd130('0x55')],{});db[_0xd130('0x1dd')]['belongsTo'](db[_0xd130('0x112')],{});db[_0xd130('0x1dd')]['belongsTo'](db[_0xd130('0x137')],{});db[_0xd130('0xd8')][_0xd130('0x11a')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db[_0xd130('0xd8')][_0xd130('0x11a')](db['JscriptyQuestionReport'],{'foreignKey':_0xd130('0x1de')});db['JscriptyProject'][_0xd130('0x11a')](db[_0xd130('0xcf')],{'foreignKey':_0xd130('0x1de')});db[_0xd130('0xe1')]['belongsToMany'](db[_0xd130('0x112')],{'as':'Agents','through':_0xd130('0x12f')});db[_0xd130('0xe1')][_0xd130('0x12b')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0xd130('0x133')});db['Team'][_0xd130('0x12b')](db[_0xd130('0x3f')],{'through':_0xd130('0x1df'),'as':_0xd130('0x135')});db['Team'][_0xd130('0x12b')](db[_0xd130('0x69')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xd130('0xe1')]['belongsToMany'](db[_0xd130('0x4e')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0xd130('0xe1')]['belongsToMany'](db['SmsQueue'],{'through':_0xd130('0x186'),'as':_0xd130('0x1e0')});db[_0xd130('0xe1')][_0xd130('0x12b')](db[_0xd130('0x5b')],{'through':_0xd130('0x190'),'as':_0xd130('0x138')});db[_0xd130('0xe1')]['belongsToMany'](db[_0xd130('0x104')],{'through':'team_has_whatsapp_queues','as':_0xd130('0x1e1')});db[_0xd130('0xe1')]['belongsToMany'](db[_0xd130('0xf2')],{'through':_0xd130('0x10a'),'as':_0xd130('0x134')});db[_0xd130('0x1a4')][_0xd130('0x11a')](db[_0xd130('0x127')],{'as':'Hoppers','foreignKey':_0xd130('0x1a5')});db[_0xd130('0x1a4')]['hasMany'](db['CmHopperFinal'],{'as':_0xd130('0x147'),'foreignKey':_0xd130('0x1a5')});db['Campaign'][_0xd130('0x11a')](db[_0xd130('0x74')],{'as':_0xd130('0x148'),'foreignKey':_0xd130('0x1a5')});db[_0xd130('0x1a4')][_0xd130('0x11a')](db[_0xd130('0x70')],{'as':_0xd130('0x149'),'foreignKey':_0xd130('0x1a5')});db[_0xd130('0x1a4')][_0xd130('0x129')](db['Trunk'],{'as':_0xd130('0x14b'),'foreignKey':_0xd130('0x1e2')});db[_0xd130('0x1a4')][_0xd130('0x129')](db[_0xd130('0x14b')],{'as':'TrunkBackup','foreignKey':_0xd130('0x14d')});db[_0xd130('0x1a4')][_0xd130('0x129')](db[_0xd130('0x7d')],{'as':_0xd130('0x7d'),'foreignKey':_0xd130('0x14e')});db[_0xd130('0x1a4')][_0xd130('0x129')](db[_0xd130('0x1e3')],{'as':_0xd130('0x1e3'),'foreignKey':'SquareProjectId'});db[_0xd130('0x1a4')][_0xd130('0x12b')](db['CmList'],{'as':_0xd130('0x12e'),'through':_0xd130('0x1e4')});db[_0xd130('0x1a4')][_0xd130('0x12b')](db[_0xd130('0xf0')],{'as':_0xd130('0x153'),'through':_0xd130('0x1e5')});db['Attachment']['belongsTo'](db[_0xd130('0x67')],{'as':'ChatOfflineMessage','foreignKey':_0xd130('0x171')});db[_0xd130('0x1e6')][_0xd130('0x129')](db[_0xd130('0x41')],{});db[_0xd130('0x1e6')][_0xd130('0x129')](db[_0xd130('0x123')],{});db['MailTransferReport'][_0xd130('0x129')](db[_0xd130('0x15d')],{'foreignKey':_0xd130('0x1e7'),'as':_0xd130('0x1e8')});db[_0xd130('0x1e6')][_0xd130('0x129')](db[_0xd130('0x112')],{'foreignKey':_0xd130('0x1e9'),'as':_0xd130('0x1ea')});db[_0xd130('0x1e6')][_0xd130('0x129')](db[_0xd130('0x112')],{'foreignKey':'ToUserId','as':_0xd130('0x1eb')});db[_0xd130('0x1e6')][_0xd130('0x129')](db[_0xd130('0x3f')],{'foreignKey':_0xd130('0x1ec'),'as':'ToQueue'});db['MailTransferReport'][_0xd130('0x129')](db['MailAccount'],{'foreignKey':_0xd130('0x1ed'),'as':_0xd130('0x1ee')});db[_0xd130('0xec')]['belongsTo'](db[_0xd130('0x65')],{});db[_0xd130('0xec')][_0xd130('0x129')](db[_0xd130('0x63')],{});db[_0xd130('0xec')][_0xd130('0x129')](db['ChatWebsite'],{'foreignKey':_0xd130('0x1ef'),'as':_0xd130('0x1e8')});db[_0xd130('0xec')][_0xd130('0x129')](db['User'],{'foreignKey':_0xd130('0x1e9'),'as':_0xd130('0x1ea')});db[_0xd130('0xec')][_0xd130('0x129')](db[_0xd130('0x112')],{'foreignKey':_0xd130('0x1f0'),'as':_0xd130('0x1eb')});db[_0xd130('0xec')]['belongsTo'](db[_0xd130('0x69')],{'foreignKey':'ToChatQueueId','as':_0xd130('0x1f1')});db[_0xd130('0xec')]['belongsTo'](db[_0xd130('0x5d')],{'foreignKey':'ToChatWebsiteId','as':_0xd130('0x1ee')});db['FaxTransferReport'][_0xd130('0x129')](db['FaxMessage'],{});db[_0xd130('0xed')][_0xd130('0x129')](db['FaxInteraction'],{});db[_0xd130('0xed')][_0xd130('0x129')](db[_0xd130('0x48')],{'foreignKey':_0xd130('0x1f2'),'as':'FromAccount'});db[_0xd130('0xed')][_0xd130('0x129')](db[_0xd130('0x112')],{'foreignKey':_0xd130('0x1e9'),'as':'FromAgent'});db[_0xd130('0xed')][_0xd130('0x129')](db[_0xd130('0x112')],{'foreignKey':_0xd130('0x1f0'),'as':_0xd130('0x1eb')});db['FaxTransferReport'][_0xd130('0x129')](db[_0xd130('0x4e')],{'foreignKey':'ToFaxQueueId','as':_0xd130('0x1f1')});db[_0xd130('0xed')][_0xd130('0x129')](db[_0xd130('0x48')],{'foreignKey':_0xd130('0x1f3'),'as':'ToAccount'});db['OpenchannelTransferReport'][_0xd130('0x129')](db[_0xd130('0x189')],{});db['OpenchannelTransferReport'][_0xd130('0x129')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xd130('0x129')](db[_0xd130('0x58')],{'foreignKey':'FromOpenchannelAccountId','as':_0xd130('0x1e8')});db[_0xd130('0x1f4')][_0xd130('0x129')](db[_0xd130('0x112')],{'foreignKey':'FromUserId','as':_0xd130('0x1ea')});db[_0xd130('0x1f4')][_0xd130('0x129')](db['User'],{'foreignKey':_0xd130('0x1f0'),'as':_0xd130('0x1eb')});db['OpenchannelTransferReport'][_0xd130('0x129')](db['OpenchannelQueue'],{'foreignKey':_0xd130('0x1f5'),'as':_0xd130('0x1f1')});db['OpenchannelTransferReport'][_0xd130('0x129')](db[_0xd130('0x58')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0xd130('0x1f6')][_0xd130('0x129')](db[_0xd130('0x55')],{});db['SmsTransferReport'][_0xd130('0x129')](db['SmsInteraction'],{});db[_0xd130('0x1f6')][_0xd130('0x129')](db[_0xd130('0x52')],{'foreignKey':_0xd130('0x1f7'),'as':_0xd130('0x1e8')});db[_0xd130('0x1f6')][_0xd130('0x129')](db['User'],{'foreignKey':_0xd130('0x1e9'),'as':'FromAgent'});db[_0xd130('0x1f6')][_0xd130('0x129')](db[_0xd130('0x112')],{'foreignKey':_0xd130('0x1f0'),'as':_0xd130('0x1eb')});db[_0xd130('0x1f6')][_0xd130('0x129')](db[_0xd130('0x137')],{'foreignKey':_0xd130('0x1f8'),'as':_0xd130('0x1f1')});db[_0xd130('0x1f6')][_0xd130('0x129')](db['SmsAccount'],{'foreignKey':_0xd130('0x1f9'),'as':'ToAccount'});db[_0xd130('0xf0')][_0xd130('0x11a')](db['Disposition'],{'as':_0xd130('0x175'),'foreignKey':'ListId','onDelete':_0xd130('0x114')});db[_0xd130('0xf0')][_0xd130('0x11a')](db['CmCustomField'],{'as':_0xd130('0x1fa'),'foreignKey':_0xd130('0x165')});db[_0xd130('0xf0')]['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':'cascade','foreignKey':_0xd130('0x165')});db[_0xd130('0xf0')][_0xd130('0x11a')](db[_0xd130('0x72')],{'as':_0xd130('0x147'),'foreignKey':'ListId'});db[_0xd130('0xf0')][_0xd130('0x11a')](db[_0xd130('0x74')],{'as':_0xd130('0x11c'),'foreignKey':_0xd130('0x165')});db['CmList'][_0xd130('0x11a')](db['ReportAgentPreview'],{'as':_0xd130('0x11d'),'foreignKey':_0xd130('0x165')});db[_0xd130('0xf0')][_0xd130('0x12b')](db[_0xd130('0x19')],{'as':'Queues','through':_0xd130('0x150')});db['CmList'][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x151'),'through':_0xd130('0x139')});db[_0xd130('0xf2')][_0xd130('0x11a')](db['VoiceExtension'],{'as':_0xd130('0x11b'),'onDelete':_0xd130('0x114')});db[_0xd130('0xf2')]['belongsToMany'](db[_0xd130('0x112')],{'as':_0xd130('0x151'),'through':_0xd130('0x10c')});db[_0xd130('0xf2')][_0xd130('0x12b')](db[_0xd130('0xe1')],{'through':_0xd130('0x10a'),'as':_0xd130('0x152')});db[_0xd130('0xf4')][_0xd130('0x11a')](db['User'],{'as':_0xd130('0x16d'),'foreignKey':_0xd130('0x12a')});db[_0xd130('0xf4')][_0xd130('0x11a')](db[_0xd130('0xf6')],{'as':'UserProfileSections','foreignKey':_0xd130('0x12a'),'onDelete':'cascade'});db[_0xd130('0xf6')][_0xd130('0x11a')](db[_0xd130('0xf7')],{'as':_0xd130('0x1fb'),'foreignKey':_0xd130('0x1fc'),'onDelete':'cascade'});db[_0xd130('0xfa')][_0xd130('0x11a')](db['Disposition'],{'as':_0xd130('0x175'),'foreignKey':_0xd130('0x1fd'),'onDelete':'cascade'});db['WhatsappAccount'][_0xd130('0x11a')](db[_0xd130('0x177')],{'as':_0xd130('0x163'),'foreignKey':_0xd130('0x1fd')});db[_0xd130('0xfa')][_0xd130('0x11a')](db[_0xd130('0x100')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0xd130('0xfa')][_0xd130('0x11a')](db[_0xd130('0xfe')],{'as':_0xd130('0x182')});db['WhatsappAccount'][_0xd130('0x11a')](db[_0xd130('0xfc')],{'as':_0xd130('0x18a'),'foreignKey':_0xd130('0x1fd'),'onDelete':_0xd130('0x114')});db[_0xd130('0xfa')]['belongsTo'](db[_0xd130('0xf0')],{'as':_0xd130('0x164'),'foreignKey':'ListId'});db[_0xd130('0xfa')][_0xd130('0x129')](db[_0xd130('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0xd130('0x14f')});db['WhatsappAccount']['belongsToMany'](db[_0xd130('0x112')],{'as':_0xd130('0x151'),'through':'user_has_whatsapp_accounts'});db[_0xd130('0xfc')][_0xd130('0x129')](db[_0xd130('0x112')],{'onDelete':_0xd130('0x160')});db['WhatsappApplication'][_0xd130('0x129')](db[_0xd130('0x104')],{'onDelete':_0xd130('0x160')});db[_0xd130('0xfc')][_0xd130('0x129')](db['WhatsappAccount'],{'onDelete':_0xd130('0x160')});db[_0xd130('0xfc')][_0xd130('0x129')](db[_0xd130('0x7d')],{'onDelete':_0xd130('0x160'),'foreignKey':_0xd130('0x14e')});db[_0xd130('0xfc')][_0xd130('0x129')](db[_0xd130('0x88')],{'onDelete':_0xd130('0x160'),'foreignKey':_0xd130('0x179')});db[_0xd130('0xfe')]['hasMany'](db['WhatsappMessage'],{'as':_0xd130('0x155'),'onDelete':_0xd130('0x114'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0xd130('0x129')](db['WhatsappAccount'],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x1fd')});db['WhatsappInteraction']['belongsTo'](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x169')});db[_0xd130('0xfe')][_0xd130('0x129')](db[_0xd130('0x112')],{'as':'Owner','foreignKey':_0xd130('0x115')});db[_0xd130('0xfe')][_0xd130('0x12b')](db['Tag'],{'through':_0xd130('0x1b7'),'as':_0xd130('0x17b')});db[_0xd130('0xfe')][_0xd130('0x12b')](db[_0xd130('0x88')],{'through':_0xd130('0x1b7'),'as':_0xd130('0x16c')});db[_0xd130('0xfe')][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x16d'),'through':_0xd130('0x132'),'foreignKey':_0xd130('0x1fe')});db[_0xd130('0x100')][_0xd130('0x129')](db[_0xd130('0x112')],{'as':_0xd130('0x112')});db[_0xd130('0x100')][_0xd130('0x129')](db[_0xd130('0x6e')],{'onDelete':_0xd130('0x114'),'as':'Contact'});db[_0xd130('0x100')][_0xd130('0x129')](db[_0xd130('0xfe')],{'onDelete':_0xd130('0x114'),'as':_0xd130('0x17e'),'foreignKey':'WhatsappInteractionId'});db[_0xd130('0x100')][_0xd130('0x129')](db[_0xd130('0xfa')],{'as':_0xd130('0x168'),'foreignKey':_0xd130('0x1fd')});db[_0xd130('0x1ff')][_0xd130('0x129')](db[_0xd130('0xfa')],{});db[_0xd130('0x1ff')][_0xd130('0x129')](db[_0xd130('0xf0')],{'as':'List','foreignKey':_0xd130('0x165')});db[_0xd130('0x1ff')][_0xd130('0x129')](db[_0xd130('0x6e')],{'as':_0xd130('0x15c'),'foreignKey':_0xd130('0x169')});db['WhatsappQueueReport'][_0xd130('0x129')](db[_0xd130('0xfe')],{});db['WhatsappQueueReport'][_0xd130('0x129')](db[_0xd130('0x104')],{});db[_0xd130('0x1ff')][_0xd130('0x129')](db['WhatsappMessage'],{});db[_0xd130('0x1ff')][_0xd130('0x129')](db[_0xd130('0x112')],{});db[_0xd130('0x103')]['belongsTo'](db[_0xd130('0x100')],{});db['WhatsappTransferReport'][_0xd130('0x129')](db[_0xd130('0xfe')],{});db['WhatsappTransferReport'][_0xd130('0x129')](db[_0xd130('0xfa')],{'foreignKey':_0xd130('0x200'),'as':'FromAccount'});db[_0xd130('0x103')][_0xd130('0x129')](db[_0xd130('0xfa')],{'foreignKey':_0xd130('0x201'),'as':_0xd130('0x1ee')});db[_0xd130('0x103')][_0xd130('0x129')](db['WhatsappQueue'],{'foreignKey':_0xd130('0x202'),'as':_0xd130('0x1f1')});db[_0xd130('0x103')]['belongsTo'](db['User'],{'foreignKey':_0xd130('0x1e9'),'as':_0xd130('0x1ea')});db[_0xd130('0x103')][_0xd130('0x129')](db[_0xd130('0x112')],{'foreignKey':_0xd130('0x1f0'),'as':_0xd130('0x1eb')});db[_0xd130('0x104')][_0xd130('0x12b')](db[_0xd130('0x112')],{'as':_0xd130('0x151'),'through':_0xd130('0x38'),'foreignKey':'WhatsappQueueId'});db[_0xd130('0x104')]['belongsToMany'](db[_0xd130('0xe1')],{'through':_0xd130('0x203'),'as':'Teams'});db[_0xd130('0x10e')][_0xd130('0x129')](db[_0xd130('0x112')],{'as':_0xd130('0x204'),'foreignKey':_0xd130('0x115'),'onDelete':_0xd130('0x114'),'hooks':!![]});db[_0xd130('0x106')][_0xd130('0x113')](db[_0xd130('0xc0')],{'as':_0xd130('0xc0'),'onDelete':_0xd130('0x160')});db['CloudProvider'][_0xd130('0x113')](db[_0xd130('0x3a')],{'as':'Imap','onDelete':_0xd130('0x160')});db['CloudProvider'][_0xd130('0x113')](db[_0xd130('0x3c')],{'as':'Smtp','onDelete':'restrict'});module[_0xd130('0x205')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x7aab=['../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmHopper/cmHopper.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','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','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','Campaign','../api/campaign/campaign.model','Migration','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../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','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','UserId','User','userSetting','hasMany','Recordings','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','CmHopper','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueues','UserMailQueue','ChatQueues','FaxQueues','UserSmsQueue','UserOpenchannelQueue','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','cascade','VoiceContext','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','CmHopperBlack','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','uniqueid','VoiceAgentReport','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','Interactions','List','TemplateId','mandatoryDispositionPauseId','MailQueue','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatOfflineMessage','TagId','ListId','Dashboard','Items','Dispositions','FaxAccountId','FaxApplication','user_has_fax_accounts','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','SmsAccountId','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','CmCompany','CompanyId','Phones','CmContactId','ChatInteractions','cm_contact_has_tags','AdditionalPhones','CmHopperId','OwnerId','CampaignId','Condition','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','Mohs','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','DefaultReportId','MetricId','AccountId','Subjects','FieldId','SubjectId','Description','Field','VariableId','Configurations','DescriptionId','DeskAccount','Descriptions','int_desk_configuration_has_tags','Subject','ZohoConfiguration','ZohoField','ZendeskAccount','ZendeskField','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerField','ServicenowAccount','ServicenowConfiguration','FromId','ToId','JscriptyQuestionReport','SmsQueueReport','ProjectId','VoiceQueues','team_has_chat_queues','SmsQueues','OpenchannelQueues','team_has_whatsapp_queues','VoicePrefixes','SquareProject','SquareProjectId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','FromUserId','ToFaxAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','UserVoicePrefix','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','sequelize','lodash','jstz','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','xcall','database','username','password','options','import','VoiceChanSpy','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport'];(function(_0x26da5e,_0x2f4830){var _0x19932c=function(_0x681c95){while(--_0x681c95){_0x26da5e['push'](_0x26da5e['shift']());}};_0x19932c(++_0x2f4830);}(_0x7aab,0x1e5));var _0xb7aa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7aab[_0x14add3];return _0x4a174f;};'use strict';var config=require(_0xb7aa('0x0'));var Sequelize=require(_0xb7aa('0x1'));var _=require(_0xb7aa('0x2'));var jstz=require(_0xb7aa('0x3'));var timezone=jstz['determine']();config['sequelize']=_[_0xb7aa('0x4')](config[_0xb7aa('0x1')],{'database':'motion2','username':'xcall','password':_0xb7aa('0x5'),'options':{'host':_0xb7aa('0x6'),'port':0xcea,'dialect':_0xb7aa('0x7'),'dialectOptions':{'charset':_0xb7aa('0x8')},'logging':![],'timezone':timezone[_0xb7aa('0x9')](),'define':{'charset':_0xb7aa('0xa'),'collate':_0xb7aa('0xb')}}});config['sequelizeHistory']=_[_0xb7aa('0x4')](config[_0xb7aa('0xc')],{'database':_0xb7aa('0xd'),'username':_0xb7aa('0xe'),'password':_0xb7aa('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xb7aa('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xb7aa('0x9')](),'define':{'charset':_0xb7aa('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb7aa('0x1')][_0xb7aa('0xf')],config['sequelize'][_0xb7aa('0x10')],config[_0xb7aa('0x1')][_0xb7aa('0x11')],config['sequelize'][_0xb7aa('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb7aa('0xc')][_0xb7aa('0xf')],config[_0xb7aa('0xc')]['username'],config[_0xb7aa('0xc')][_0xb7aa('0x11')],config[_0xb7aa('0xc')][_0xb7aa('0x12')])};db['User']=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/user/user.model');db[_0xb7aa('0x14')]=db[_0xb7aa('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db['sequelize'][_0xb7aa('0x13')]('../api/voiceContext/voiceContext.model');db[_0xb7aa('0x15')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x16'));db['VoiceMusicOnHold']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x17'));db[_0xb7aa('0x18')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x19'));db[_0xb7aa('0x1a')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x1b'));db['ScreenRecording']=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/screenRecording/screenRecording.model');db[_0xb7aa('0x1c')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x1d'));db['VoiceMailMessage']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x1e'));db[_0xb7aa('0x1f')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x20'));db[_0xb7aa('0x21')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x22'));db[_0xb7aa('0x23')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x24'));db[_0xb7aa('0x25')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x26'));db[_0xb7aa('0x27')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x28'));db[_0xb7aa('0x29')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x2a'));db[_0xb7aa('0x2b')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x2c'));db[_0xb7aa('0x2d')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xb7aa('0x2e')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x2f'));db['UserMailQueue']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x30'));db[_0xb7aa('0x31')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x32'));db['UserOpenchannelQueue']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x33'));db[_0xb7aa('0x34')]=db[_0xb7aa('0x1')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xb7aa('0x35')]=db['sequelize'][_0xb7aa('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0xb7aa('0x36')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x37'));db[_0xb7aa('0x38')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x39'));db['MailQueue']=db['sequelize']['import'](_0xb7aa('0x3a'));db['MailSubstatus']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x3b'));db[_0xb7aa('0x3c')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x3d'));db[_0xb7aa('0x3e')]=db[_0xb7aa('0x1')]['import']('../api/mailMessage/mailMessage.model');db[_0xb7aa('0x3f')]=db['sequelize'][_0xb7aa('0x13')]('../api/mailApplication/mailApplication.model');db[_0xb7aa('0x40')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x41'));db['Dashboard']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x42'));db[_0xb7aa('0x43')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x44'));db[_0xb7aa('0x45')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x46'));db['FaxApplication']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x47'));db[_0xb7aa('0x48')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x49'));db[_0xb7aa('0x4a')]=db['sequelize'][_0xb7aa('0x13')]('../api/faxMessage/faxMessage.model');db[_0xb7aa('0x4b')]=db[_0xb7aa('0x1')]['import']('../api/faxQueue/faxQueue.model');db[_0xb7aa('0x4c')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x4d'));db[_0xb7aa('0x4e')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/smsAccount/smsAccount.model');db[_0xb7aa('0x4f')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x50'));db[_0xb7aa('0x51')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x52'));db[_0xb7aa('0x53')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x54'));db[_0xb7aa('0x55')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x56'));db[_0xb7aa('0x57')]=db['sequelize'][_0xb7aa('0x13')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x58'));db[_0xb7aa('0x59')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x5a'));db[_0xb7aa('0x5b')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x5c'));db[_0xb7aa('0x5d')]=db[_0xb7aa('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xb7aa('0x5e')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x5f'));db[_0xb7aa('0x60')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xb7aa('0x61')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x62'));db[_0xb7aa('0x63')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x64'));db['ChatMessage']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x65'));db['ChatOfflineMessage']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x66'));db[_0xb7aa('0x67')]=db['sequelize']['import'](_0xb7aa('0x68'));db[_0xb7aa('0x69')]=db['sequelize'][_0xb7aa('0x13')]('../api/chatGroup/chatGroup.model');db[_0xb7aa('0x6a')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x6b'));db['CmCompany']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x6c'));db['CmContact']=db[_0xb7aa('0x1')]['import']('../api/cmContact/cmContact.model');db['CmHopper']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x6d'));db['CmHopperBlack']=db[_0xb7aa('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0xb7aa('0x6e')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xb7aa('0x6f')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x70'));db[_0xb7aa('0x71')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xb7aa('0x72')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0xb7aa('0x73')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/action/action.model');db[_0xb7aa('0x74')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x75'));db[_0xb7aa('0x76')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x77'));db[_0xb7aa('0x78')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x79'));db['Condition']=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x7a'));db[_0xb7aa('0x7b')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x7c'));db[_0xb7aa('0x7d')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x7e'));db[_0xb7aa('0x7f')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x80'));db['VoiceQueuesLog']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x81'));db[_0xb7aa('0x82')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x83'));db[_0xb7aa('0x84')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/sound/sound.model');db[_0xb7aa('0x85')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x86'));db[_0xb7aa('0x87')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x88'));db[_0xb7aa('0x89')]=db[_0xb7aa('0x1')]['import']('../api/cmContactHasItem/cmContactHasItem.model');db[_0xb7aa('0x8a')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x8b'));db[_0xb7aa('0x8c')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x8d'));db['Trigger']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x8e'));db[_0xb7aa('0x8f')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x90'));db['Integration']=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/integration/integration.model');db[_0xb7aa('0x91')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x92'));db[_0xb7aa('0x93')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x94'));db[_0xb7aa('0x95')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x96'));db[_0xb7aa('0x97')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x98'));db[_0xb7aa('0x99')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x9a'));db['AnalyticFieldReport']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x9b'));db[_0xb7aa('0x9c')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xb7aa('0x9d')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x9e'));db[_0xb7aa('0x9f')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xa0'));db[_0xb7aa('0xa1')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0xb7aa('0xa2')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xa3'));db[_0xb7aa('0xa4')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xa5'));db[_0xb7aa('0xa6')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xa7'));db['DeskAccount']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xa8'));db[_0xb7aa('0xa9')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xaa'));db[_0xb7aa('0xab')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xac'));db[_0xb7aa('0xad')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xae'));db['ZohoConfiguration']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xaf'));db['ZohoField']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb0'));db['ZendeskAccount']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb1'));db[_0xb7aa('0xb2')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xb3'));db['ZendeskField']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb4'));db[_0xb7aa('0xb5')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb6'));db['FreshdeskConfiguration']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb7'));db[_0xb7aa('0xb8')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb9'));db[_0xb7aa('0xba')]=db['sequelize']['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xb7aa('0xbb')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xbc'));db['VtigerField']=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xbd'));db['ServicenowConfiguration']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xbe'));db[_0xb7aa('0xbf')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xc0'));db[_0xb7aa('0xc1')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xc2'));db[_0xb7aa('0xc3')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xc4'));db[_0xb7aa('0xc5')]=db['sequelize']['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xb7aa('0xc6')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xb7aa('0xc7')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xb7aa('0xc8')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xc9'));db[_0xb7aa('0xca')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xcb'));db[_0xb7aa('0xcc')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xcd'));db[_0xb7aa('0xce')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xcf'));db[_0xb7aa('0xd0')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xd1'));db[_0xb7aa('0xd2')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xd3'));db['JscriptySessionReport']=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xd4'));db['SmsQueueReport']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xd5'));db[_0xb7aa('0xd6')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xd7'));db[_0xb7aa('0xd8')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xd9'));db[_0xb7aa('0xda')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xdb'));db[_0xb7aa('0xdc')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xdd'));db[_0xb7aa('0xde')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xdf'));db['SquareProject']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xe0'));db[_0xb7aa('0xe1')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xe2'));db[_0xb7aa('0xe3')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xe4'));db[_0xb7aa('0xe5')]=db['sequelize']['import']('../api/team/team.model');db['License']=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/license/license.model');db[_0xb7aa('0xe6')]=db['sequelize']['import'](_0xb7aa('0xe7'));db[_0xb7aa('0xe8')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/migration/migration.model');db['Attachment']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xe9'));db[_0xb7aa('0xea')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xeb'));db[_0xb7aa('0xec')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xb7aa('0xed')]=db['sequelize']['import'](_0xb7aa('0xee'));db['FaxTransferReport']=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xef'));db[_0xb7aa('0xf0')]=db[_0xb7aa('0x1')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xb7aa('0xf1')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xf2'));db[_0xb7aa('0xf3')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xf4'));db[_0xb7aa('0xf5')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xf6'));db[_0xb7aa('0xf7')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xf8'));db[_0xb7aa('0xf9')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xfa'));db[_0xb7aa('0xfb')]=db['sequelize']['import'](_0xb7aa('0xfc'));db[_0xb7aa('0xfd')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xfe'));db[_0xb7aa('0xff')]=db['sequelize']['import'](_0xb7aa('0x100'));db[_0xb7aa('0x101')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x102'));db['WhatsappInteraction']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x103'));db['WhatsappMessage']=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x104'));db[_0xb7aa('0x105')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x106'));db[_0xb7aa('0x107')]=db['sequelize']['import'](_0xb7aa('0x108'));db[_0xb7aa('0x109')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0xb7aa('0x10a')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x10b'));db[_0xb7aa('0x10c')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x10d'));db[_0xb7aa('0x10e')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x10f'));db['UserVoicePrefix']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x110'));db[_0xb7aa('0x111')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x112'));db[_0xb7aa('0x113')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x114'));db['User'][_0xb7aa('0x115')](db[_0xb7aa('0x1c')],{'as':_0xb7aa('0x1c'),'onDelete':'cascade','foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')]['hasOne'](db[_0xb7aa('0x111')],{'as':_0xb7aa('0x118'),'onDelete':'cascade','foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')][_0xb7aa('0x119')](db['VoiceRecording'],{'as':_0xb7aa('0x11a'),'foreignKey':_0xb7aa('0x116')});db['User'][_0xb7aa('0x119')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0xb7aa('0x116')});db['User'][_0xb7aa('0x119')](db[_0xb7aa('0x15')],{'as':_0xb7aa('0x11b'),'onDelete':'cascade','hooks':!![]});db[_0xb7aa('0x117')]['hasMany'](db[_0xb7aa('0x6e')],{'as':_0xb7aa('0x11c'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')]['hasMany'](db['CmHopperHistory'],{'as':_0xb7aa('0x11d'),'foreignKey':'UserId'});db[_0xb7aa('0x117')][_0xb7aa('0x119')](db['ReportAgentPreview'],{'as':_0xb7aa('0x71'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')][_0xb7aa('0x119')](db[_0xb7aa('0x59')],{'as':_0xb7aa('0x11e'),'foreignKey':_0xb7aa('0x116')});db['User'][_0xb7aa('0x119')](db[_0xb7aa('0x63')],{'as':'ChatInteractions','foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')][_0xb7aa('0x119')](db['SmsInteraction'],{'as':_0xb7aa('0x11f'),'foreignKey':_0xb7aa('0x116')});db['User'][_0xb7aa('0x119')](db[_0xb7aa('0x48')],{'as':'FaxInteractions','foreignKey':_0xb7aa('0x116')});db['User'][_0xb7aa('0x119')](db[_0xb7aa('0x3c')],{'as':_0xb7aa('0x120'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')][_0xb7aa('0x119')](db[_0xb7aa('0x121')],{'as':_0xb7aa('0x122'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')]['hasMany'](db['UserNotification'],{'as':_0xb7aa('0x123'),'foreignKey':'SenderId'});db[_0xb7aa('0x117')]['hasMany'](db[_0xb7aa('0x124')],{'as':_0xb7aa('0x125'),'foreignKey':_0xb7aa('0x116'),'onDelete':_0xb7aa('0x126')});db['User'][_0xb7aa('0x127')](db[_0xb7aa('0xf7')],{'as':'UserProfile','foreignKey':_0xb7aa('0x128')});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db['ChatGroup'],{'as':_0xb7aa('0x12a'),'through':_0xb7aa('0x12b')});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x12d'),'through':_0xb7aa('0x12e')});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x12f'),'through':'cm_user_has_lists'});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x130')});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0x3c')],{'as':_0xb7aa('0x120'),'through':'user_has_mail_interactions'});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x63')],{'as':'ChatInteractions','through':_0xb7aa('0x131')});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x48')],{'as':_0xb7aa('0x132'),'through':_0xb7aa('0x133')});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0x51')],{'as':_0xb7aa('0x11f'),'through':_0xb7aa('0x134')});db[_0xb7aa('0x117')]['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0xb7aa('0x135')});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0x121')],{'as':_0xb7aa('0x122'),'through':_0xb7aa('0x136')});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x18')],{'as':'VoiceQueues','through':_0xb7aa('0x2d'),'required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0xf5')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db['MailQueue'],{'as':_0xb7aa('0x137'),'through':_0xb7aa('0x138'),'required':![]});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0x67')],{'as':_0xb7aa('0x139'),'through':_0xb7aa('0x2e'),'required':![],'hooks':!![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x4b')],{'as':_0xb7aa('0x13a'),'through':_0xb7aa('0x31'),'required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x55')],{'as':'SmsQueues','through':_0xb7aa('0x13b'),'required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x5d')],{'as':'OpenchannelQueues','through':_0xb7aa('0x13c'),'required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x109')],{'as':_0xb7aa('0x13d'),'through':_0xb7aa('0x34'),'required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0xf3')],{'through':_0xb7aa('0x13e')});db['User'][_0xb7aa('0x129')](db[_0xb7aa('0x5e')],{'as':_0xb7aa('0x13f'),'through':_0xb7aa('0x140')});db['User'][_0xb7aa('0x129')](db[_0xb7aa('0x45')],{'as':_0xb7aa('0x141'),'through':'user_has_fax_accounts'});db['User'][_0xb7aa('0x129')](db[_0xb7aa('0x38')],{'as':'MailAccounts','through':_0xb7aa('0x142')});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0x57')],{'as':_0xb7aa('0x143'),'through':_0xb7aa('0x144')});db[_0xb7aa('0x117')]['belongsToMany'](db['SmsAccount'],{'as':_0xb7aa('0x145'),'through':_0xb7aa('0x146')});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0xff')],{'as':_0xb7aa('0x147'),'through':'user_has_whatsapp_accounts'});db[_0xb7aa('0x14')][_0xb7aa('0x119')](db[_0xb7aa('0x15')],{'as':_0xb7aa('0x148'),'onDelete':_0xb7aa('0x149'),'foreignKey':'ChanSpyId'});db[_0xb7aa('0x14a')][_0xb7aa('0x119')](db['VoiceExtension'],{'onDelete':_0xb7aa('0x149')});db['VoiceExtension'][_0xb7aa('0x119')](db[_0xb7aa('0x15')],{'as':_0xb7aa('0x14b'),'onDelete':'cascade'});db[_0xb7aa('0x14c')][_0xb7aa('0x129')](db[_0xb7aa('0x84')],{'as':_0xb7aa('0x14d'),'through':_0xb7aa('0x14e')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x2b')],{'as':_0xb7aa('0x14f'),'foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x124')],{'as':_0xb7aa('0x125'),'foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x6e')],{'as':_0xb7aa('0x11c'),'foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db['CmHopperHistory'],{'as':_0xb7aa('0x151'),'foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x71')],{'as':_0xb7aa('0x71'),'foreignKey':'VoiceQueueId'});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x152')],{'as':'HopperBlacks','foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x153')],{'as':_0xb7aa('0x154'),'foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')]['belongsTo'](db[_0xb7aa('0x27')],{'as':_0xb7aa('0x27'),'foreignKey':_0xb7aa('0x155')});db[_0xb7aa('0x18')][_0xb7aa('0x127')](db['Trunk'],{'as':_0xb7aa('0x156'),'foreignKey':_0xb7aa('0x157')});db[_0xb7aa('0x18')]['belongsTo'](db[_0xb7aa('0x7b')],{'as':_0xb7aa('0x7b'),'foreignKey':_0xb7aa('0x158')});db['VoiceQueue']['belongsTo'](db['Pause'],{'as':_0xb7aa('0x159'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb7aa('0x18')][_0xb7aa('0x129')](db['CmList'],{'as':_0xb7aa('0x12f'),'through':_0xb7aa('0x15a')});db[_0xb7aa('0x18')]['belongsToMany'](db['User'],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x2d')});db['VoiceQueue'][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'as':_0xb7aa('0x15c'),'through':'TeamVoiceQueue'});db[_0xb7aa('0x18')][_0xb7aa('0x129')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x15d'),'through':_0xb7aa('0x15e')});db[_0xb7aa('0x1a')][_0xb7aa('0x127')](db['User'],{'as':'User','foreignKey':'UserId'});db['ScreenRecording']['belongsTo'](db['User'],{'as':'User','foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x1c')]['hasMany'](db[_0xb7aa('0x15f')],{'as':_0xb7aa('0x160'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x161'),'sourceKey':_0xb7aa('0x162')});db[_0xb7aa('0x15f')]['belongsTo'](db[_0xb7aa('0x1c')],{'foreignKey':'mailboxuser','targetKey':_0xb7aa('0x162')});db[_0xb7aa('0x1f')][_0xb7aa('0x119')](db[_0xb7aa('0x23')],{'as':'QueueCalls','foreignKey':_0xb7aa('0x163'),'constraints':![]});db[_0xb7aa('0x1f')][_0xb7aa('0x119')](db[_0xb7aa('0x164')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xb7aa('0x1f')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x117'),'foreignKey':_0xb7aa('0x116')});db['VoiceCallReport'][_0xb7aa('0x127')](db['CmContact'],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x35')][_0xb7aa('0x127')](db['MailAccount'],{'as':_0xb7aa('0x38'),'foreignKey':_0xb7aa('0x167')});db['MailServerIn'][_0xb7aa('0x127')](db['CloudProvider'],{'as':_0xb7aa('0x10a'),'foreignKey':_0xb7aa('0x168'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x36')]['belongsTo'](db[_0xb7aa('0x38')],{'as':_0xb7aa('0x38'),'foreignKey':_0xb7aa('0x167')});db['MailServerOut']['belongsTo'](db[_0xb7aa('0x10a')],{'as':_0xb7aa('0x10a'),'foreignKey':_0xb7aa('0x168'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x38')][_0xb7aa('0x115')](db[_0xb7aa('0x35')],{'as':_0xb7aa('0x16a'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x38')][_0xb7aa('0x115')](db[_0xb7aa('0x36')],{'as':_0xb7aa('0x16b'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x38')][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':'Dispositions','foreignKey':_0xb7aa('0x167'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x38')][_0xb7aa('0x119')](db[_0xb7aa('0x76')],{'as':_0xb7aa('0x16c'),'foreignKey':_0xb7aa('0x167')});db[_0xb7aa('0x38')][_0xb7aa('0x119')](db[_0xb7aa('0x3e')],{'as':'Messages','foreignKey':_0xb7aa('0x167')});db[_0xb7aa('0x38')][_0xb7aa('0x119')](db[_0xb7aa('0x3c')],{'as':_0xb7aa('0x16d')});db[_0xb7aa('0x38')][_0xb7aa('0x119')](db['MailApplication'],{'as':'Applications','foreignKey':_0xb7aa('0x167'),'onDelete':'cascade'});db[_0xb7aa('0x38')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':'ListId'});db[_0xb7aa('0x38')]['belongsTo'](db['Template'],{'as':'Template','foreignKey':_0xb7aa('0x16f')});db[_0xb7aa('0x38')][_0xb7aa('0x127')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xb7aa('0x170')});db['MailAccount'][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':'Agents','through':_0xb7aa('0x142')});db[_0xb7aa('0x171')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':'Agents','through':'UserMailQueue'});db[_0xb7aa('0x171')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x172'),'as':'Teams'});db[_0xb7aa('0x3c')][_0xb7aa('0x119')](db['MailMessage'],{'as':_0xb7aa('0x160'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x173')});db['MailInteraction'][_0xb7aa('0x127')](db[_0xb7aa('0x38')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x167')});db[_0xb7aa('0x3c')][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':'Contact','foreignKey':'ContactId'});db[_0xb7aa('0x3c')]['belongsTo'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x175'),'foreignKey':'UserId'});db[_0xb7aa('0x3c')]['belongsToMany'](db[_0xb7aa('0x85')],{'through':'mail_interaction_has_tags','as':_0xb7aa('0x176')});db[_0xb7aa('0x3c')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':_0xb7aa('0x177'),'as':_0xb7aa('0x178')});db[_0xb7aa('0x3c')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x179'),'through':'user_has_mail_interactions','foreignKey':_0xb7aa('0x173')});db[_0xb7aa('0x3e')][_0xb7aa('0x119')](db[_0xb7aa('0x17a')],{'as':_0xb7aa('0x17b'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x3e')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x117')});db['MailMessage']['belongsTo'](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x165')});db['MailMessage'][_0xb7aa('0x127')](db['MailInteraction'],{'as':_0xb7aa('0x17c'),'foreignKey':_0xb7aa('0x173')});db[_0xb7aa('0x3e')][_0xb7aa('0x127')](db[_0xb7aa('0x38')],{'as':'Account','foreignKey':_0xb7aa('0x167')});db[_0xb7aa('0x3e')]['belongsTo'](db[_0xb7aa('0x5e')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db['MailMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x17d')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xb7aa('0x3f')]['belongsTo'](db[_0xb7aa('0x117')],{'onDelete':'restrict'});db[_0xb7aa('0x3f')][_0xb7aa('0x127')](db['MailQueue'],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x3f')]['belongsTo'](db[_0xb7aa('0x38')],{'onDelete':_0xb7aa('0x169')});db['MailApplication']['belongsTo'](db[_0xb7aa('0x7b')],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x3f')]['belongsTo'](db[_0xb7aa('0x85')],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x17e')});db[_0xb7aa('0x40')]['belongsTo'](db[_0xb7aa('0x38')],{});db[_0xb7aa('0x40')][_0xb7aa('0x127')](db['CmList'],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x40')][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':'ContactId'});db[_0xb7aa('0x40')][_0xb7aa('0x127')](db[_0xb7aa('0x3c')],{});db[_0xb7aa('0x40')]['belongsTo'](db['MailMessage'],{});db['MailQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{});db[_0xb7aa('0x40')]['belongsTo'](db[_0xb7aa('0x171')],{});db[_0xb7aa('0x180')]['hasMany'](db[_0xb7aa('0x43')],{'as':_0xb7aa('0x181'),'onDelete':_0xb7aa('0x149')});db['FaxAccount'][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':_0xb7aa('0x182'),'foreignKey':_0xb7aa('0x183'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x45')][_0xb7aa('0x119')](db['CannedAnswer'],{'as':_0xb7aa('0x16c'),'foreignKey':_0xb7aa('0x183')});db['FaxAccount']['hasMany'](db[_0xb7aa('0x48')],{'as':'Interactions'});db[_0xb7aa('0x45')][_0xb7aa('0x119')](db[_0xb7aa('0x184')],{'as':'Applications','foreignKey':_0xb7aa('0x183'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x45')]['hasMany'](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x45')][_0xb7aa('0x119')](db[_0xb7aa('0x4a')],{'as':'Messages'});db['FaxAccount'][_0xb7aa('0x127')](db[_0xb7aa('0x27')],{'as':_0xb7aa('0x27')});db['FaxAccount'][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':'List','foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x45')]['belongsTo'](db[_0xb7aa('0x7d')],{'as':_0xb7aa('0x159'),'foreignKey':_0xb7aa('0x170')});db[_0xb7aa('0x45')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':'Agents','through':_0xb7aa('0x185')});db[_0xb7aa('0x184')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':'restrict'});db[_0xb7aa('0x184')][_0xb7aa('0x127')](db[_0xb7aa('0x4b')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x184')]['belongsTo'](db[_0xb7aa('0x45')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x184')][_0xb7aa('0x127')](db[_0xb7aa('0x85')],{'onDelete':'restrict','foreignKey':_0xb7aa('0x17e')});db[_0xb7aa('0x48')]['hasMany'](db[_0xb7aa('0x4a')],{'as':_0xb7aa('0x160'),'onDelete':_0xb7aa('0x149'),'foreignKey':'FaxInteractionId'});db[_0xb7aa('0x48')][_0xb7aa('0x127')](db[_0xb7aa('0x45')],{'as':'Account','foreignKey':_0xb7aa('0x183')});db['FaxInteraction'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db['FaxInteraction'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':'Owner','foreignKey':'UserId'});db['FaxInteraction'][_0xb7aa('0x129')](db['Tag'],{'through':_0xb7aa('0x186'),'as':'Tags'});db[_0xb7aa('0x48')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':'fax_interaction_has_tags','as':_0xb7aa('0x178')});db[_0xb7aa('0x48')]['belongsToMany'](db['User'],{'as':_0xb7aa('0x179'),'through':_0xb7aa('0x133'),'foreignKey':'FaxInteractionId'});db[_0xb7aa('0x4a')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x117')});db[_0xb7aa('0x4a')][_0xb7aa('0x127')](db[_0xb7aa('0x48')],{'as':'Interaction','foreignKey':_0xb7aa('0x187')});db[_0xb7aa('0x4a')][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':'Contact'});db[_0xb7aa('0x4a')][_0xb7aa('0x127')](db[_0xb7aa('0x17a')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xb7aa('0x4a')]['belongsTo'](db['FaxAccount'],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x183')});db[_0xb7aa('0x4b')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x31')});db[_0xb7aa('0x4b')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x188'),'as':'Teams'});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0x45')],{});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':'List','foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0x48')],{});db[_0xb7aa('0x4c')]['belongsTo'](db[_0xb7aa('0x4a')],{});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0x4b')],{});db[_0xb7aa('0x4e')][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':'Dispositions','foreignKey':_0xb7aa('0x189'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x4e')][_0xb7aa('0x119')](db[_0xb7aa('0x76')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0xb7aa('0x4e')]['hasMany'](db[_0xb7aa('0x53')],{'as':_0xb7aa('0x160'),'foreignKey':_0xb7aa('0x189')});db['SmsAccount'][_0xb7aa('0x119')](db['SmsInteraction'],{'as':'Interactions'});db[_0xb7aa('0x4e')][_0xb7aa('0x119')](db[_0xb7aa('0x4f')],{'as':_0xb7aa('0x14b'),'foreignKey':'SmsAccountId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x4e')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x4e')]['belongsTo'](db[_0xb7aa('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0xb7aa('0x170')});db[_0xb7aa('0x4e')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x146')});db[_0xb7aa('0x4f')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x4f')]['belongsTo'](db[_0xb7aa('0x55')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x4f')]['belongsTo'](db[_0xb7aa('0x4e')],{'onDelete':_0xb7aa('0x169')});db['SmsApplication']['belongsTo'](db[_0xb7aa('0x7b')],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x158')});db['SmsApplication'][_0xb7aa('0x127')](db[_0xb7aa('0x85')],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x17e')});db['SmsInteraction'][_0xb7aa('0x119')](db[_0xb7aa('0x53')],{'as':_0xb7aa('0x160'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xb7aa('0x51')][_0xb7aa('0x127')](db[_0xb7aa('0x4e')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x189')});db[_0xb7aa('0x51')]['belongsTo'](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db['SmsInteraction'][_0xb7aa('0x127')](db['User'],{'as':'Owner','foreignKey':_0xb7aa('0x116')});db['SmsInteraction'][_0xb7aa('0x129')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xb7aa('0x176')});db[_0xb7aa('0x51')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':'sms_interaction_has_tags','as':_0xb7aa('0x178')});db[_0xb7aa('0x51')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':'Users','through':_0xb7aa('0x134'),'foreignKey':_0xb7aa('0x18a')});db[_0xb7aa('0x53')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':'User'});db['SmsMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x165')});db['SmsMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x51')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x17c'),'foreignKey':'SmsInteractionId'});db[_0xb7aa('0x53')][_0xb7aa('0x127')](db['SmsAccount'],{'as':'Account','foreignKey':_0xb7aa('0x189')});db[_0xb7aa('0x55')][_0xb7aa('0x129')](db['User'],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x13b'),'foreignKey':_0xb7aa('0x18b')});db[_0xb7aa('0x55')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x18c'),'as':_0xb7aa('0x15c')});db[_0xb7aa('0x57')][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0xb7aa('0x149')});db['OpenchannelAccount']['hasMany'](db['CannedAnswer'],{'as':_0xb7aa('0x16c'),'foreignKey':_0xb7aa('0x18d')});db[_0xb7aa('0x57')][_0xb7aa('0x119')](db[_0xb7aa('0x59')],{'as':'Interactions','foreignKey':_0xb7aa('0x18d')});db[_0xb7aa('0x57')][_0xb7aa('0x119')](db['OpenchannelMessage'],{'as':_0xb7aa('0x160'),'foreignKey':_0xb7aa('0x18d')});db[_0xb7aa('0x57')][_0xb7aa('0x119')](db[_0xb7aa('0x18e')],{'as':'Applications','foreignKey':_0xb7aa('0x18d'),'onDelete':_0xb7aa('0x149')});db['OpenchannelAccount'][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db['OpenchannelAccount'][_0xb7aa('0x127')](db['Pause'],{'as':_0xb7aa('0x159'),'foreignKey':_0xb7aa('0x170')});db[_0xb7aa('0x57')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':'Agents','through':_0xb7aa('0x144')});db[_0xb7aa('0x18e')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x18e')]['belongsTo'](db[_0xb7aa('0x5d')],{'onDelete':'restrict','foreignKey':_0xb7aa('0x18f')});db[_0xb7aa('0x18e')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0xb7aa('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0xb7aa('0x18e')][_0xb7aa('0x127')](db[_0xb7aa('0x7b')],{'onDelete':'restrict','foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x18e')][_0xb7aa('0x127')](db['Tag'],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x17e')});db[_0xb7aa('0x59')][_0xb7aa('0x119')](db[_0xb7aa('0x5b')],{'as':'Messages','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x190')});db[_0xb7aa('0x59')][_0xb7aa('0x127')](db[_0xb7aa('0x57')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x18d')});db[_0xb7aa('0x59')]['belongsTo'](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':'ContactId'});db[_0xb7aa('0x59')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x175'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x59')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':'openchannel_interaction_has_tags','as':_0xb7aa('0x176')});db['OpenchannelInteraction'][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':'openchannel_interaction_has_tags','as':_0xb7aa('0x178')});db[_0xb7aa('0x59')][_0xb7aa('0x129')](db['User'],{'as':_0xb7aa('0x179'),'through':_0xb7aa('0x135'),'foreignKey':_0xb7aa('0x190')});db[_0xb7aa('0x5b')][_0xb7aa('0x127')](db['User'],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x117')});db[_0xb7aa('0x5b')][_0xb7aa('0x127')](db['CmContact'],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x165')});db[_0xb7aa('0x5b')]['belongsTo'](db[_0xb7aa('0x59')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x17c'),'foreignKey':'OpenchannelInteractionId'});db[_0xb7aa('0x5b')][_0xb7aa('0x127')](db[_0xb7aa('0x17a')],{'as':'Attachment','foreignKey':_0xb7aa('0x191')});db[_0xb7aa('0x5b')][_0xb7aa('0x127')](db[_0xb7aa('0x57')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x18d')});db[_0xb7aa('0x5d')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x13c'),'foreignKey':_0xb7aa('0x18f')});db[_0xb7aa('0x5d')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x192'),'as':_0xb7aa('0x15c')});db[_0xb7aa('0x5e')][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':_0xb7aa('0x182'),'foreignKey':_0xb7aa('0x193'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x5e')][_0xb7aa('0x119')](db[_0xb7aa('0x76')],{'as':'Answers','foreignKey':_0xb7aa('0x193')});db[_0xb7aa('0x5e')]['hasMany'](db[_0xb7aa('0x6a')],{'as':_0xb7aa('0x194')});db[_0xb7aa('0x5e')]['hasMany'](db[_0xb7aa('0x63')],{'as':_0xb7aa('0x16d')});db[_0xb7aa('0x5e')][_0xb7aa('0x119')](db[_0xb7aa('0x61')],{'as':_0xb7aa('0x14b'),'foreignKey':'ChatWebsiteId','onDelete':_0xb7aa('0x149')});db['ChatWebsite'][_0xb7aa('0x119')](db[_0xb7aa('0x195')],{'as':_0xb7aa('0x160')});db['ChatWebsite']['belongsTo'](db[_0xb7aa('0xf3')],{'as':'List','foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x5e')]['belongsTo'](db[_0xb7aa('0x7b')],{'as':'Interval','foreignKey':_0xb7aa('0x158')});db['ChatWebsite']['belongsTo'](db[_0xb7aa('0x38')],{'as':'MailAccount','foreignKey':_0xb7aa('0x167')});db[_0xb7aa('0x5e')]['belongsTo'](db[_0xb7aa('0x7d')],{'as':_0xb7aa('0x159'),'foreignKey':_0xb7aa('0x170')});db[_0xb7aa('0x5e')][_0xb7aa('0x129')](db['User'],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x140')});db[_0xb7aa('0x60')]['belongsTo'](db[_0xb7aa('0x57')],{});db[_0xb7aa('0x60')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':'List','foreignKey':_0xb7aa('0x17f')});db['OpenchannelQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':'ContactId'});db[_0xb7aa('0x60')][_0xb7aa('0x127')](db[_0xb7aa('0x59')],{});db[_0xb7aa('0x60')][_0xb7aa('0x127')](db[_0xb7aa('0x5b')],{});db['OpenchannelQueueReport'][_0xb7aa('0x127')](db['User'],{});db[_0xb7aa('0x60')][_0xb7aa('0x127')](db['OpenchannelQueue'],{});db[_0xb7aa('0x61')]['belongsTo'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x196'),'foreignKey':_0xb7aa('0x116'),'onDelete':_0xb7aa('0x169')});db['ChatApplication'][_0xb7aa('0x127')](db[_0xb7aa('0x67')],{'as':_0xb7aa('0x197'),'foreignKey':_0xb7aa('0x198'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x61')][_0xb7aa('0x127')](db['ChatWebsite'],{'as':_0xb7aa('0x199'),'foreignKey':_0xb7aa('0x193'),'onDelete':_0xb7aa('0x169')});db['ChatApplication'][_0xb7aa('0x127')](db[_0xb7aa('0x85')],{'onDelete':'restrict','foreignKey':_0xb7aa('0x17e')});db[_0xb7aa('0x63')][_0xb7aa('0x119')](db[_0xb7aa('0x195')],{'as':_0xb7aa('0x160'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x19a')});db[_0xb7aa('0x63')]['belongsTo'](db[_0xb7aa('0x5e')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x193')});db[_0xb7aa('0x63')]['belongsTo'](db[_0xb7aa('0x12c')],{'as':'Contact','foreignKey':'ContactId'});db[_0xb7aa('0x63')][_0xb7aa('0x127')](db['User'],{'as':_0xb7aa('0x175'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x63')]['belongsToMany'](db[_0xb7aa('0x85')],{'through':_0xb7aa('0x19b'),'as':'Tags'});db[_0xb7aa('0x63')][_0xb7aa('0x129')](db['Tag'],{'through':_0xb7aa('0x19b'),'as':_0xb7aa('0x178')});db[_0xb7aa('0x63')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x179'),'through':_0xb7aa('0x131'),'foreignKey':_0xb7aa('0x19a')});db[_0xb7aa('0x195')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x117')});db[_0xb7aa('0x195')][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x195')]['belongsTo'](db[_0xb7aa('0x63')],{'onDelete':'cascade','as':_0xb7aa('0x17c'),'foreignKey':_0xb7aa('0x19a')});db[_0xb7aa('0x195')]['belongsTo'](db['Attachment'],{'as':_0xb7aa('0x17a'),'foreignKey':_0xb7aa('0x191')});db[_0xb7aa('0x195')][_0xb7aa('0x127')](db[_0xb7aa('0x5e')],{'as':_0xb7aa('0x174'),'foreignKey':'ChatWebsiteId'});db[_0xb7aa('0x17d')][_0xb7aa('0x119')](db[_0xb7aa('0x17a')],{'as':_0xb7aa('0x17b'),'foreignKey':_0xb7aa('0x19c'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':'Contact','foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x17d')][_0xb7aa('0x127')](db['ChatWebsite'],{'as':_0xb7aa('0x174'),'foreignKey':'ChatWebsiteId'});db[_0xb7aa('0x67')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0xb7aa('0x67')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':'team_has_chat_queues','as':_0xb7aa('0x15c')});db[_0xb7aa('0x69')][_0xb7aa('0x119')](db[_0xb7aa('0xd0')],{'as':_0xb7aa('0x160'),'foreignKey':'ChatGroupId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x69')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x14f'),'through':_0xb7aa('0x12b')});db[_0xb7aa('0x6a')][_0xb7aa('0x127')](db[_0xb7aa('0x5e')],{'as':_0xb7aa('0x199'),'foreignKey':_0xb7aa('0x193')});db[_0xb7aa('0x19d')][_0xb7aa('0x119')](db[_0xb7aa('0x12c')],{'as':'Contacts','foreignKey':_0xb7aa('0x19e')});db['CmContact'][_0xb7aa('0x119')](db[_0xb7aa('0x89')],{'as':_0xb7aa('0x19f'),'foreignKey':_0xb7aa('0x1a0')});db[_0xb7aa('0x12c')]['hasMany'](db[_0xb7aa('0x124')],{'as':_0xb7aa('0x125'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x6e')],{'as':_0xb7aa('0x11c'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x6f')],{'as':_0xb7aa('0x151'),'foreignKey':_0xb7aa('0x166')});db['CmContact'][_0xb7aa('0x119')](db['ReportAgentPreview'],{'as':_0xb7aa('0x71'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x153')],{'as':_0xb7aa('0x154'),'foreignKey':'ContactId'});db[_0xb7aa('0x12c')]['hasMany'](db[_0xb7aa('0x59')],{'as':_0xb7aa('0x11e'),'foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x63')],{'as':_0xb7aa('0x1a1'),'foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x51')],{'as':'SmsInteractions','foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x48')],{'as':_0xb7aa('0x132'),'foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x3c')],{'as':_0xb7aa('0x120'),'foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x12c')][_0xb7aa('0x127')](db[_0xb7aa('0x19d')],{'as':'Company','foreignKey':_0xb7aa('0x19e')});db[_0xb7aa('0x12c')]['belongsTo'](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f'),'onDelete':'cascade'});db[_0xb7aa('0x12c')][_0xb7aa('0x129')](db['User'],{'as':_0xb7aa('0x179'),'through':_0xb7aa('0x12e')});db[_0xb7aa('0x12c')]['belongsToMany'](db[_0xb7aa('0x85')],{'as':'Tags','through':_0xb7aa('0x1a2')});db[_0xb7aa('0x12c')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':_0xb7aa('0x1a2'),'as':'ThroughTags'});db[_0xb7aa('0x124')][_0xb7aa('0x119')](db['CmHopperAdditionalPhone'],{'as':_0xb7aa('0x1a3'),'foreignKey':_0xb7aa('0x1a4')});db['CmHopper'][_0xb7aa('0x127')](db['CmContact'],{'as':'Contact','foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x124')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':'List','foreignKey':_0xb7aa('0x17f'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x124')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x196'),'foreignKey':'UserId'});db[_0xb7aa('0x124')][_0xb7aa('0x127')](db['VoiceQueue'],{'as':_0xb7aa('0x197'),'foreignKey':_0xb7aa('0x150'),'onDelete':_0xb7aa('0x149')});db['CmHopper']['belongsTo'](db[_0xb7aa('0xe6')],{'as':_0xb7aa('0xe6'),'foreignKey':'CampaignId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x124')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x175'),'foreignKey':_0xb7aa('0x1a5')});db['CmHopperBlack'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x152')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x152')][_0xb7aa('0x127')](db[_0xb7aa('0x18')],{'as':_0xb7aa('0x197'),'foreignKey':_0xb7aa('0x150'),'onDelete':_0xb7aa('0x149')});db['CmHopperBlack']['belongsTo'](db[_0xb7aa('0xe6')],{'as':_0xb7aa('0xe6'),'foreignKey':_0xb7aa('0x1a6'),'onDelete':'cascade'});db[_0xb7aa('0x74')][_0xb7aa('0x119')](db[_0xb7aa('0x1a7')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xb7aa('0x1a8'),'onDelete':_0xb7aa('0x149'),'hooks':!![]});db['Automation'][_0xb7aa('0x119')](db[_0xb7aa('0x1a7')],{'as':{'plural':_0xb7aa('0x1a9'),'singular':_0xb7aa('0x1aa')},'foreignKey':_0xb7aa('0x1ab'),'onDelete':_0xb7aa('0x149'),'hooks':!![]});db['Automation'][_0xb7aa('0x119')](db[_0xb7aa('0x73')],{'as':_0xb7aa('0x1ac'),'foreignKey':'AutomationId','onDelete':_0xb7aa('0x149'),'hooks':!![]});db[_0xb7aa('0x78')][_0xb7aa('0x119')](db['Disposition'],{'as':_0xb7aa('0x182'),'foreignKey':_0xb7aa('0x1ad'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x7b')][_0xb7aa('0x119')](db[_0xb7aa('0x7b')],{'as':_0xb7aa('0x1ae'),'foreignKey':_0xb7aa('0x158'),'onDelete':_0xb7aa('0x149'),'hooks':!![],'required':![]});db['Interval'][_0xb7aa('0x119')](db['VoiceExtension'],{'as':_0xb7aa('0x11b'),'foreignKey':_0xb7aa('0x158'),'onDelete':'restrict'});db[_0xb7aa('0x7b')][_0xb7aa('0x119')](db['MailApplication'],{'as':_0xb7aa('0x1af'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x7b')][_0xb7aa('0x119')](db[_0xb7aa('0x61')],{'as':_0xb7aa('0x1b0'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x7b')][_0xb7aa('0x119')](db[_0xb7aa('0x184')],{'as':_0xb7aa('0x1b1'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x7b')][_0xb7aa('0x119')](db[_0xb7aa('0x4f')],{'as':_0xb7aa('0x1b2'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x82')][_0xb7aa('0x127')](db[_0xb7aa('0x38')],{});db['Schedule'][_0xb7aa('0x127')](db[_0xb7aa('0x95')],{'foreignKey':'DefaultReportId'});db[_0xb7aa('0x82')][_0xb7aa('0x127')](db['AnalyticCustomReport'],{'foreignKey':_0xb7aa('0x1b3')});db[_0xb7aa('0x84')][_0xb7aa('0x129')](db['VoiceMusicOnHold'],{'as':_0xb7aa('0x1b4'),'through':_0xb7aa('0x14e'),'onDelete':_0xb7aa('0x169')});db['Tag'][_0xb7aa('0x129')](db[_0xb7aa('0x12c')],{'through':_0xb7aa('0x1a2')});db[_0xb7aa('0x85')][_0xb7aa('0x129')](db[_0xb7aa('0x63')],{'through':_0xb7aa('0x19b')});db[_0xb7aa('0x85')][_0xb7aa('0x129')](db[_0xb7aa('0x3c')],{'through':'mail_interaction_has_tags'});db[_0xb7aa('0x85')][_0xb7aa('0x129')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0xb7aa('0x85')][_0xb7aa('0x129')](db[_0xb7aa('0x48')],{'through':_0xb7aa('0x186')});db[_0xb7aa('0x85')][_0xb7aa('0x129')](db[_0xb7aa('0x59')],{'through':_0xb7aa('0x1b5')});db[_0xb7aa('0x85')]['belongsToMany'](db[_0xb7aa('0x121')],{'through':_0xb7aa('0x1b6')});db[_0xb7aa('0x89')]['belongsTo'](db[_0xb7aa('0x87')],{'as':'ItemType','foreignKey':'ItemTypeId'});db[_0xb7aa('0x8a')][_0xb7aa('0x127')](db[_0xb7aa('0x124')],{'as':_0xb7aa('0x1b7'),'foreignKey':_0xb7aa('0x1a4')});db[_0xb7aa('0x89')][_0xb7aa('0x127')](db['CmContact'],{'as':'Contact','foreignKey':_0xb7aa('0x1a0')});db[_0xb7aa('0x1b8')][_0xb7aa('0x119')](db[_0xb7aa('0x1a7')],{'as':{'plural':_0xb7aa('0x1b9'),'singular':_0xb7aa('0x1ba')},'foreignKey':_0xb7aa('0x1bb'),'onDelete':'cascade','hooks':!![]});db[_0xb7aa('0x1b8')][_0xb7aa('0x119')](db['Condition'],{'as':{'plural':_0xb7aa('0x1bc'),'singular':_0xb7aa('0x1bd')},'foreignKey':_0xb7aa('0x1be'),'onDelete':_0xb7aa('0x149'),'hooks':!![]});db[_0xb7aa('0x1b8')][_0xb7aa('0x119')](db[_0xb7aa('0x73')],{'as':'Actions','foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0xb7aa('0x93')][_0xb7aa('0x119')](db[_0xb7aa('0x1bf')],{'as':_0xb7aa('0x1c0'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1b3'),'hooks':!![]});db['AnalyticDefaultReport'][_0xb7aa('0x119')](db[_0xb7aa('0x1bf')],{'as':_0xb7aa('0x1c0'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c1')});db[_0xb7aa('0x99')][_0xb7aa('0x119')](db['AnalyticFieldReport'],{'as':_0xb7aa('0x1c0'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c2')});db[_0xb7aa('0x1bf')][_0xb7aa('0x127')](db[_0xb7aa('0x99')],{'foreignKey':_0xb7aa('0x1c2')});db[_0xb7aa('0x9d')][_0xb7aa('0x119')](db[_0xb7aa('0x9f')],{'as':'Configurations','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0x9f')][_0xb7aa('0x119')](db[_0xb7aa('0xa1')],{'as':_0xb7aa('0x1c4'),'onDelete':_0xb7aa('0x149'),'foreignKey':'SubjectId'});db[_0xb7aa('0x9f')][_0xb7aa('0x119')](db[_0xb7aa('0xa1')],{'as':'Descriptions','onDelete':_0xb7aa('0x149'),'foreignKey':'DescriptionId'});db[_0xb7aa('0x9f')]['hasMany'](db['SalesforceField'],{'as':_0xb7aa('0x1c0'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x9f')][_0xb7aa('0x127')](db['SalesforceAccount'],{'as':_0xb7aa('0x174'),'foreignKey':'AccountId'});db['SalesforceField'][_0xb7aa('0x119')](db[_0xb7aa('0xa1')],{'as':'Subject','foreignKey':_0xb7aa('0x1c6')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0xb7aa('0x1c7'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0xb7aa('0x119')](db[_0xb7aa('0xa1')],{'as':_0xb7aa('0x1c8'),'foreignKey':'FieldId'});db[_0xb7aa('0xa1')][_0xb7aa('0x127')](db['Variable'],{'as':_0xb7aa('0x8f'),'foreignKey':_0xb7aa('0x1c9')});db['SugarcrmAccount'][_0xb7aa('0x119')](db['SugarcrmConfiguration'],{'as':_0xb7aa('0x1ca'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xa4')][_0xb7aa('0x119')](db[_0xb7aa('0xa6')],{'as':_0xb7aa('0x1c4'),'onDelete':_0xb7aa('0x149'),'foreignKey':'SubjectId'});db[_0xb7aa('0xa4')]['hasMany'](db[_0xb7aa('0xa6')],{'as':'Descriptions','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xa4')][_0xb7aa('0x119')](db['SugarcrmField'],{'as':'Fields','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c5')});db['SugarcrmConfiguration'][_0xb7aa('0x127')](db[_0xb7aa('0xa2')],{'as':_0xb7aa('0x174'),'foreignKey':'AccountId'});db[_0xb7aa('0xa6')][_0xb7aa('0x119')](db[_0xb7aa('0xa6')],{'as':'Subject','foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0xa6')]['hasMany'](db[_0xb7aa('0xa6')],{'as':_0xb7aa('0x1c7'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xa6')][_0xb7aa('0x119')](db[_0xb7aa('0xa6')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0xa6')][_0xb7aa('0x127')](db['Variable'],{'as':_0xb7aa('0x8f'),'foreignKey':_0xb7aa('0x1c9')});db[_0xb7aa('0x1cc')][_0xb7aa('0x119')](db[_0xb7aa('0xa9')],{'as':_0xb7aa('0x1ca'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xa9')][_0xb7aa('0x119')](db['DeskField'],{'as':_0xb7aa('0x1c4'),'onDelete':_0xb7aa('0x149'),'foreignKey':'SubjectId'});db[_0xb7aa('0xa9')]['hasMany'](db[_0xb7aa('0xab')],{'as':_0xb7aa('0x1cd'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xa9')][_0xb7aa('0x119')](db['DeskField'],{'as':'Fields','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c5')});db['DeskConfiguration'][_0xb7aa('0x127')](db[_0xb7aa('0x1cc')],{'as':'Account','foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xa9')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':_0xb7aa('0x1ce')});db[_0xb7aa('0xab')][_0xb7aa('0x119')](db[_0xb7aa('0xab')],{'as':_0xb7aa('0x1cf'),'foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0xab')][_0xb7aa('0x119')](db[_0xb7aa('0xab')],{'as':_0xb7aa('0x1c7'),'foreignKey':'DescriptionId'});db[_0xb7aa('0xab')][_0xb7aa('0x119')](db[_0xb7aa('0xab')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0xab')][_0xb7aa('0x127')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xb7aa('0xad')]['hasMany'](db['ZohoConfiguration'],{'as':_0xb7aa('0x1ca'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1c3')});db['ZohoConfiguration'][_0xb7aa('0x119')](db['ZohoField'],{'as':'Subjects','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0x1d0')][_0xb7aa('0x119')](db[_0xb7aa('0x1d1')],{'as':_0xb7aa('0x1cd'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1cb')});db['ZohoConfiguration'][_0xb7aa('0x119')](db[_0xb7aa('0x1d1')],{'as':'Fields','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d0')]['belongsTo'](db[_0xb7aa('0xad')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x1c3')});db['ZohoField'][_0xb7aa('0x119')](db[_0xb7aa('0x1d1')],{'as':_0xb7aa('0x1cf'),'foreignKey':'SubjectId'});db[_0xb7aa('0x1d1')][_0xb7aa('0x119')](db[_0xb7aa('0x1d1')],{'as':_0xb7aa('0x1c7'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0x1d1')]['hasMany'](db[_0xb7aa('0x1d1')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d1')]['belongsTo'](db[_0xb7aa('0x8f')],{'as':'Variable','foreignKey':_0xb7aa('0x1c9')});db[_0xb7aa('0x1d2')][_0xb7aa('0x119')](db['ZendeskConfiguration'],{'as':_0xb7aa('0x1ca'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xb2')][_0xb7aa('0x119')](db['ZendeskField'],{'as':_0xb7aa('0x1c4'),'foreignKey':'SubjectId'});db[_0xb7aa('0xb2')][_0xb7aa('0x119')](db[_0xb7aa('0x1d3')],{'as':_0xb7aa('0x1cd'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xb2')]['hasMany'](db['ZendeskField'],{'as':_0xb7aa('0x1c0'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xb7aa('0x127')](db[_0xb7aa('0x1d2')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xb2')][_0xb7aa('0x129')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0xb7aa('0x1d3')][_0xb7aa('0x119')](db[_0xb7aa('0x1d3')],{'as':_0xb7aa('0x1cf'),'foreignKey':_0xb7aa('0x1c6')});db['ZendeskField'][_0xb7aa('0x119')](db[_0xb7aa('0x1d3')],{'as':_0xb7aa('0x1c7'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0x1d3')][_0xb7aa('0x119')](db['ZendeskField'],{'as':'Field','foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d3')][_0xb7aa('0x127')](db[_0xb7aa('0x8f')],{'as':_0xb7aa('0x8f'),'foreignKey':'VariableId'});db[_0xb7aa('0xb5')]['hasMany'](db[_0xb7aa('0x1d4')],{'as':_0xb7aa('0x1ca'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db['FreshdeskConfiguration'][_0xb7aa('0x119')](db[_0xb7aa('0xb8')],{'as':_0xb7aa('0x1c4'),'onDelete':_0xb7aa('0x149'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0xb7aa('0x119')](db[_0xb7aa('0xb8')],{'as':'Descriptions','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0x1d4')]['hasMany'](db[_0xb7aa('0xb8')],{'as':_0xb7aa('0x1c0'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d4')]['belongsTo'](db[_0xb7aa('0xb5')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0x1d4')]['belongsToMany'](db['Tag'],{'through':_0xb7aa('0x1d5')});db[_0xb7aa('0xb8')][_0xb7aa('0x119')](db['FreshdeskField'],{'as':_0xb7aa('0x1cf'),'foreignKey':'SubjectId'});db[_0xb7aa('0xb8')][_0xb7aa('0x119')](db['FreshdeskField'],{'as':'Description','foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xb8')][_0xb7aa('0x119')](db[_0xb7aa('0xb8')],{'as':'Field','foreignKey':'FieldId'});db[_0xb7aa('0xb8')][_0xb7aa('0x127')](db['Variable'],{'as':_0xb7aa('0x8f'),'foreignKey':'VariableId'});db[_0xb7aa('0xba')][_0xb7aa('0x119')](db['VtigerConfiguration'],{'as':_0xb7aa('0x1ca'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xb7aa('0xbb')]['hasMany'](db['VtigerField'],{'as':'Descriptions','foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xbb')][_0xb7aa('0x119')](db[_0xb7aa('0x1d6')],{'as':_0xb7aa('0x1c0'),'foreignKey':_0xb7aa('0x1c5')});db['VtigerConfiguration'][_0xb7aa('0x127')](db[_0xb7aa('0xba')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0x1d6')]['hasMany'](db['VtigerField'],{'as':_0xb7aa('0x1cf'),'foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0x1d6')][_0xb7aa('0x119')](db[_0xb7aa('0x1d6')],{'as':_0xb7aa('0x1c7'),'foreignKey':'DescriptionId'});db['VtigerField'][_0xb7aa('0x119')](db[_0xb7aa('0x1d6')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d6')][_0xb7aa('0x127')](db[_0xb7aa('0x8f')],{'as':'Variable','foreignKey':_0xb7aa('0x1c9')});db[_0xb7aa('0x1d7')][_0xb7aa('0x119')](db[_0xb7aa('0x1d8')],{'as':_0xb7aa('0x1ca'),'onDelete':'cascade','foreignKey':'AccountId'});db['ServicenowConfiguration']['hasMany'](db[_0xb7aa('0xbf')],{'as':_0xb7aa('0x1c4'),'foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0x1d8')][_0xb7aa('0x119')](db[_0xb7aa('0xbf')],{'as':_0xb7aa('0x1cd'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0x1d8')][_0xb7aa('0x119')](db[_0xb7aa('0xbf')],{'as':_0xb7aa('0x1c0'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d8')][_0xb7aa('0x127')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xbf')][_0xb7aa('0x119')](db[_0xb7aa('0xbf')],{'as':_0xb7aa('0x1cf'),'foreignKey':_0xb7aa('0x1c6')});db['ServicenowField'][_0xb7aa('0x119')](db[_0xb7aa('0xbf')],{'as':'Description','foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xbf')]['hasMany'](db[_0xb7aa('0xbf')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0xbf')][_0xb7aa('0x127')](db[_0xb7aa('0x8f')],{'as':_0xb7aa('0x8f'),'foreignKey':_0xb7aa('0x1c9')});db[_0xb7aa('0xc1')][_0xb7aa('0x119')](db[_0xb7aa('0xc3')],{'as':_0xb7aa('0x1ca'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xc1')][_0xb7aa('0x127')](db[_0xb7aa('0x10a')],{'as':_0xb7aa('0x10a'),'foreignKey':'CloudProviderId'});db[_0xb7aa('0xc3')][_0xb7aa('0x119')](db[_0xb7aa('0xc5')],{'as':'Subjects','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0xc3')][_0xb7aa('0x119')](db[_0xb7aa('0xc5')],{'as':_0xb7aa('0x1cd'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xc3')][_0xb7aa('0x119')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xb7aa('0x149'),'foreignKey':'FieldId'});db['Dynamics365Configuration']['belongsTo'](db[_0xb7aa('0xc1')],{'as':'Account','foreignKey':'AccountId'});db[_0xb7aa('0xc5')][_0xb7aa('0x119')](db[_0xb7aa('0xc5')],{'as':_0xb7aa('0x1cf'),'foreignKey':'SubjectId'});db[_0xb7aa('0xc5')][_0xb7aa('0x119')](db[_0xb7aa('0xc5')],{'as':_0xb7aa('0x1c7'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xc5')]['hasMany'](db[_0xb7aa('0xc5')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db['Dynamics365Field'][_0xb7aa('0x127')](db[_0xb7aa('0x8f')],{'as':_0xb7aa('0x8f'),'foreignKey':_0xb7aa('0x1c9')});db['FreshsalesAccount'][_0xb7aa('0x119')](db[_0xb7aa('0xc7')],{'as':_0xb7aa('0x1ca'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xc7')][_0xb7aa('0x119')](db['FreshsalesField'],{'as':_0xb7aa('0x1c4'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration']['hasMany'](db[_0xb7aa('0xc8')],{'as':_0xb7aa('0x1cd'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xc7')][_0xb7aa('0x119')](db[_0xb7aa('0xc8')],{'as':'Fields','foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0xc7')][_0xb7aa('0x127')](db[_0xb7aa('0xc6')],{'as':'Account','foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xc8')][_0xb7aa('0x119')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0xc8')][_0xb7aa('0x119')](db[_0xb7aa('0xc8')],{'as':_0xb7aa('0x1c7'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xc8')][_0xb7aa('0x119')](db[_0xb7aa('0xc8')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db['FreshsalesField'][_0xb7aa('0x127')](db[_0xb7aa('0x8f')],{'as':_0xb7aa('0x8f'),'foreignKey':_0xb7aa('0x1c9')});db[_0xb7aa('0xce')][_0xb7aa('0x127')](db[_0xb7aa('0x5e')],{});db[_0xb7aa('0xce')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0xce')]['belongsTo'](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0xce')][_0xb7aa('0x127')](db[_0xb7aa('0x63')],{});db[_0xb7aa('0xce')][_0xb7aa('0x127')](db[_0xb7aa('0x195')],{});db['ChatQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{});db['ChatQueueReport'][_0xb7aa('0x127')](db['ChatQueue'],{});db['ChatInternalMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1d9')});db['ChatInternalMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':'cascade','foreignKey':_0xb7aa('0x1da')});db[_0xb7aa('0x153')]['hasMany'](db[_0xb7aa('0x1db')],{'foreignKey':'SessionId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x153')][_0xb7aa('0x119')](db[_0xb7aa('0xd2')],{'foreignKey':'SessionId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x1dc')][_0xb7aa('0x127')](db[_0xb7aa('0x4e')],{});db[_0xb7aa('0x1dc')]['belongsTo'](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db['SmsQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db['SmsQueueReport'][_0xb7aa('0x127')](db['SmsInteraction'],{});db['SmsQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x53')],{});db['SmsQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{});db['SmsQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x55')],{});db[_0xb7aa('0xda')][_0xb7aa('0x119')](db[_0xb7aa('0x153')],{'foreignKey':_0xb7aa('0x1dd')});db[_0xb7aa('0xda')]['hasMany'](db[_0xb7aa('0x1db')],{'foreignKey':'ProjectId'});db[_0xb7aa('0xda')][_0xb7aa('0x119')](db[_0xb7aa('0xd2')],{'foreignKey':_0xb7aa('0x1dd')});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':'user_has_teams'});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0x18')],{'through':_0xb7aa('0x10c'),'as':_0xb7aa('0x1de')});db[_0xb7aa('0xe5')]['belongsToMany'](db['MailQueue'],{'through':'team_has_mail_queues','as':_0xb7aa('0x137')});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db['ChatQueue'],{'through':_0xb7aa('0x1df'),'as':_0xb7aa('0x139')});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0x4b')],{'through':_0xb7aa('0x188'),'as':_0xb7aa('0x13a')});db[_0xb7aa('0xe5')]['belongsToMany'](db[_0xb7aa('0x55')],{'through':'team_has_sms_queues','as':_0xb7aa('0x1e0')});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0x5d')],{'through':_0xb7aa('0x192'),'as':_0xb7aa('0x1e1')});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0x109')],{'through':_0xb7aa('0x1e2'),'as':'WhatsappQueues'});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0xf5')],{'through':_0xb7aa('0x10e'),'as':_0xb7aa('0x1e3')});db[_0xb7aa('0xe6')][_0xb7aa('0x119')](db['CmHopper'],{'as':_0xb7aa('0x125'),'foreignKey':_0xb7aa('0x1a6')});db[_0xb7aa('0xe6')][_0xb7aa('0x119')](db['CmHopperFinal'],{'as':_0xb7aa('0x11c'),'foreignKey':_0xb7aa('0x1a6')});db[_0xb7aa('0xe6')]['hasMany'](db['CmHopperHistory'],{'as':_0xb7aa('0x151'),'foreignKey':_0xb7aa('0x1a6')});db[_0xb7aa('0xe6')][_0xb7aa('0x119')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign']['belongsTo'](db[_0xb7aa('0x27')],{'as':'Trunk','foreignKey':_0xb7aa('0x155')});db[_0xb7aa('0xe6')][_0xb7aa('0x127')](db[_0xb7aa('0x27')],{'as':_0xb7aa('0x156'),'foreignKey':_0xb7aa('0x157')});db[_0xb7aa('0xe6')][_0xb7aa('0x127')](db['Interval'],{'as':_0xb7aa('0x7b'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0xe6')]['belongsTo'](db[_0xb7aa('0x1e4')],{'as':_0xb7aa('0x1e4'),'foreignKey':_0xb7aa('0x1e5')});db['Campaign'][_0xb7aa('0x129')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x12f'),'through':'campaigns_has_cm_lists'});db[_0xb7aa('0xe6')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0xb7aa('0x17a')]['belongsTo'](db[_0xb7aa('0x17d')],{'as':_0xb7aa('0x17d'),'foreignKey':_0xb7aa('0x19c')});db[_0xb7aa('0xec')][_0xb7aa('0x127')](db[_0xb7aa('0x3e')],{});db[_0xb7aa('0xec')]['belongsTo'](db[_0xb7aa('0x3c')],{});db[_0xb7aa('0xec')][_0xb7aa('0x127')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0xb7aa('0x1e6')});db[_0xb7aa('0xec')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'foreignKey':'FromUserId','as':_0xb7aa('0x1e7')});db['MailTransferReport'][_0xb7aa('0x127')](db['User'],{'foreignKey':_0xb7aa('0x1e8'),'as':_0xb7aa('0x1e9')});db['MailTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x171')],{'foreignKey':_0xb7aa('0x1ea'),'as':'ToQueue'});db[_0xb7aa('0xec')][_0xb7aa('0x127')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0xb7aa('0x1eb')});db[_0xb7aa('0xed')][_0xb7aa('0x127')](db['ChatMessage'],{});db[_0xb7aa('0xed')][_0xb7aa('0x127')](db[_0xb7aa('0x63')],{});db[_0xb7aa('0xed')][_0xb7aa('0x127')](db['ChatWebsite'],{'foreignKey':_0xb7aa('0x1ec'),'as':'FromAccount'});db['ChatTransferReport'][_0xb7aa('0x127')](db['User'],{'foreignKey':'FromUserId','as':_0xb7aa('0x1e7')});db[_0xb7aa('0xed')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'foreignKey':_0xb7aa('0x1e8'),'as':'ToAgent'});db[_0xb7aa('0xed')][_0xb7aa('0x127')](db[_0xb7aa('0x67')],{'foreignKey':_0xb7aa('0x1ed'),'as':_0xb7aa('0x1ee')});db['ChatTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x5e')],{'foreignKey':_0xb7aa('0x1ef'),'as':'ToAccount'});db['FaxTransferReport'][_0xb7aa('0x127')](db['FaxMessage'],{});db['FaxTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x48')],{});db[_0xb7aa('0x1f0')][_0xb7aa('0x127')](db[_0xb7aa('0x45')],{'foreignKey':_0xb7aa('0x1f1'),'as':_0xb7aa('0x1e6')});db[_0xb7aa('0x1f0')]['belongsTo'](db[_0xb7aa('0x117')],{'foreignKey':_0xb7aa('0x1f2'),'as':_0xb7aa('0x1e7')});db[_0xb7aa('0x1f0')][_0xb7aa('0x127')](db['User'],{'foreignKey':_0xb7aa('0x1e8'),'as':_0xb7aa('0x1e9')});db[_0xb7aa('0x1f0')][_0xb7aa('0x127')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0xb7aa('0x1ee')});db[_0xb7aa('0x1f0')][_0xb7aa('0x127')](db[_0xb7aa('0x45')],{'foreignKey':_0xb7aa('0x1f3'),'as':_0xb7aa('0x1eb')});db['OpenchannelTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x5b')],{});db[_0xb7aa('0xf0')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xb7aa('0xf0')]['belongsTo'](db[_0xb7aa('0x57')],{'foreignKey':'FromOpenchannelAccountId','as':_0xb7aa('0x1e6')});db[_0xb7aa('0xf0')]['belongsTo'](db[_0xb7aa('0x117')],{'foreignKey':'FromUserId','as':_0xb7aa('0x1e7')});db[_0xb7aa('0xf0')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'foreignKey':_0xb7aa('0x1e8'),'as':_0xb7aa('0x1e9')});db[_0xb7aa('0xf0')][_0xb7aa('0x127')](db[_0xb7aa('0x5d')],{'foreignKey':'ToOpenchannelQueueId','as':_0xb7aa('0x1ee')});db[_0xb7aa('0xf0')][_0xb7aa('0x127')](db['OpenchannelAccount'],{'foreignKey':_0xb7aa('0x1f4'),'as':'ToAccount'});db[_0xb7aa('0xf1')]['belongsTo'](db[_0xb7aa('0x53')],{});db[_0xb7aa('0xf1')][_0xb7aa('0x127')](db[_0xb7aa('0x51')],{});db[_0xb7aa('0xf1')]['belongsTo'](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0xb7aa('0x1e6')});db[_0xb7aa('0xf1')]['belongsTo'](db['User'],{'foreignKey':_0xb7aa('0x1f2'),'as':'FromAgent'});db[_0xb7aa('0xf1')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'foreignKey':_0xb7aa('0x1e8'),'as':_0xb7aa('0x1e9')});db['SmsTransferReport']['belongsTo'](db['SmsQueue'],{'foreignKey':_0xb7aa('0x1f5'),'as':_0xb7aa('0x1ee')});db['SmsTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x4e')],{'foreignKey':_0xb7aa('0x1f6'),'as':'ToAccount'});db[_0xb7aa('0xf3')][_0xb7aa('0x119')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xb7aa('0x17f'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0xf3')][_0xb7aa('0x119')](db[_0xb7aa('0x72')],{'as':_0xb7aa('0x1f7'),'foreignKey':_0xb7aa('0x17f')});db['CmList']['hasMany'](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x12d'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0xf3')][_0xb7aa('0x119')](db[_0xb7aa('0x6e')],{'as':'HopperFinals','foreignKey':_0xb7aa('0x17f')});db['CmList'][_0xb7aa('0x119')](db['CmHopperHistory'],{'as':_0xb7aa('0x11d'),'foreignKey':'ListId'});db[_0xb7aa('0xf3')][_0xb7aa('0x119')](db[_0xb7aa('0x71')],{'as':'ReportAgentPreview','foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0xf3')][_0xb7aa('0x129')](db[_0xb7aa('0x18')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0xb7aa('0xf3')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':'cm_user_has_lists'});db[_0xb7aa('0xf5')][_0xb7aa('0x119')](db[_0xb7aa('0x15')],{'as':_0xb7aa('0x11b'),'onDelete':_0xb7aa('0x149')});db['VoicePrefix'][_0xb7aa('0x129')](db['User'],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x1f8')});db[_0xb7aa('0xf5')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x10e'),'as':_0xb7aa('0x15c')});db[_0xb7aa('0xf7')][_0xb7aa('0x119')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x179'),'foreignKey':_0xb7aa('0x128')});db[_0xb7aa('0xf7')][_0xb7aa('0x119')](db['UserProfileSection'],{'as':_0xb7aa('0x1f9'),'foreignKey':_0xb7aa('0x128'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0xf9')][_0xb7aa('0x119')](db[_0xb7aa('0xfb')],{'as':_0xb7aa('0x1fa'),'foreignKey':_0xb7aa('0x1fb'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0xff')][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':_0xb7aa('0x182'),'foreignKey':_0xb7aa('0x1fc'),'onDelete':_0xb7aa('0x149')});db['WhatsappAccount'][_0xb7aa('0x119')](db[_0xb7aa('0x76')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xb7aa('0xff')]['hasMany'](db[_0xb7aa('0x1fd')],{'as':_0xb7aa('0x160'),'foreignKey':_0xb7aa('0x1fc')});db[_0xb7aa('0xff')][_0xb7aa('0x119')](db[_0xb7aa('0x121')],{'as':_0xb7aa('0x16d')});db[_0xb7aa('0xff')][_0xb7aa('0x119')](db['WhatsappApplication'],{'as':_0xb7aa('0x14b'),'foreignKey':'WhatsappAccountId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0xff')][_0xb7aa('0x127')](db['CmList'],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0xff')][_0xb7aa('0x127')](db[_0xb7aa('0x7d')],{'as':_0xb7aa('0x159'),'foreignKey':_0xb7aa('0x170')});db[_0xb7aa('0xff')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':'Agents','through':_0xb7aa('0x1fe')});db[_0xb7aa('0x101')][_0xb7aa('0x127')](db['User'],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x101')][_0xb7aa('0x127')](db[_0xb7aa('0x109')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x101')][_0xb7aa('0x127')](db[_0xb7aa('0xff')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x101')][_0xb7aa('0x127')](db[_0xb7aa('0x7b')],{'onDelete':'restrict','foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x101')][_0xb7aa('0x127')](db[_0xb7aa('0x85')],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x17e')});db[_0xb7aa('0x121')][_0xb7aa('0x119')](db[_0xb7aa('0x1fd')],{'as':_0xb7aa('0x160'),'onDelete':_0xb7aa('0x149'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction']['belongsTo'](db[_0xb7aa('0xff')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x1fc')});db[_0xb7aa('0x121')]['belongsTo'](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x121')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x175'),'foreignKey':_0xb7aa('0x116')});db['WhatsappInteraction'][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':'whatsapp_interaction_has_tags','as':_0xb7aa('0x176')});db[_0xb7aa('0x121')]['belongsToMany'](db['Tag'],{'through':_0xb7aa('0x1b6'),'as':_0xb7aa('0x178')});db['WhatsappInteraction'][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x179'),'through':_0xb7aa('0x136'),'foreignKey':'WhatsappInteractionId'});db[_0xb7aa('0x1fd')][_0xb7aa('0x127')](db['User'],{'as':_0xb7aa('0x117')});db[_0xb7aa('0x1fd')]['belongsTo'](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x165')});db['WhatsappMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x121')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x17c'),'foreignKey':_0xb7aa('0x1ff')});db['WhatsappMessage']['belongsTo'](db[_0xb7aa('0xff')],{'as':_0xb7aa('0x174'),'foreignKey':'WhatsappAccountId'});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db['WhatsappAccount'],{});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db['CmContact'],{'as':'Contact','foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db[_0xb7aa('0x121')],{});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db[_0xb7aa('0x109')],{});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db[_0xb7aa('0x1fd')],{});db['WhatsappQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{});db['WhatsappTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x1fd')],{});db[_0xb7aa('0x107')][_0xb7aa('0x127')](db['WhatsappInteraction'],{});db[_0xb7aa('0x107')][_0xb7aa('0x127')](db[_0xb7aa('0xff')],{'foreignKey':_0xb7aa('0x200'),'as':_0xb7aa('0x1e6')});db[_0xb7aa('0x107')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xb7aa('0x201'),'as':_0xb7aa('0x1eb')});db['WhatsappTransferReport'][_0xb7aa('0x127')](db['WhatsappQueue'],{'foreignKey':_0xb7aa('0x202'),'as':_0xb7aa('0x1ee')});db['WhatsappTransferReport']['belongsTo'](db[_0xb7aa('0x117')],{'foreignKey':'FromUserId','as':_0xb7aa('0x1e7')});db[_0xb7aa('0x107')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'foreignKey':_0xb7aa('0x1e8'),'as':_0xb7aa('0x1e9')});db['WhatsappQueue']['belongsToMany'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x34'),'foreignKey':_0xb7aa('0x203')});db['WhatsappQueue'][_0xb7aa('0x129')](db['Team'],{'through':_0xb7aa('0x1e2'),'as':_0xb7aa('0x15c')});db[_0xb7aa('0x111')]['belongsTo'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x204'),'foreignKey':_0xb7aa('0x116'),'onDelete':_0xb7aa('0x149'),'hooks':!![]});db['CloudProvider'][_0xb7aa('0x115')](db[_0xb7aa('0xc1')],{'as':_0xb7aa('0xc1'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x10a')][_0xb7aa('0x115')](db[_0xb7aa('0x35')],{'as':'Imap','onDelete':_0xb7aa('0x169')});db['CloudProvider'][_0xb7aa('0x115')](db[_0xb7aa('0x36')],{'as':_0xb7aa('0x16b'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f9f00cf..3f84f6b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x647c=['/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/cm/companies','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/migrations','./api/migration','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','path','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage'];(function(_0x5cfa9e,_0x91f5f5){var _0x1cd028=function(_0x353e23){while(--_0x353e23){_0x5cfa9e['push'](_0x5cfa9e['shift']());}};_0x1cd028(++_0x91f5f5);}(_0x647c,0x1d3));var _0xc647=function(_0x50d8b2,_0x46f88d){_0x50d8b2=_0x50d8b2-0x0;var _0x2f9972=_0x647c[_0x50d8b2];return _0x2f9972;};'use strict';var path=require(_0xc647('0x0'));var express=require('express');var errors=require(_0xc647('0x1'));var config=require(_0xc647('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0xc647('0x3')];var clientSideLogs=require(_0xc647('0x4'));exports[_0xc647('0x5')]=function(_0x339174){return setupLoggers(_0x339174)[_0xc647('0x6')](function(){_0x339174['use'](_0xc647('0x7'),require(_0xc647('0x8')));_0x339174[_0xc647('0x9')](_0xc647('0xa'),require(_0xc647('0xb')));_0x339174[_0xc647('0x9')]('/api/voice/contexts',require('./api/voiceContext'));_0x339174[_0xc647('0x9')](_0xc647('0xc'),require(_0xc647('0xd')));_0x339174['use'](_0xc647('0xe'),require(_0xc647('0xf')));_0x339174[_0xc647('0x9')](_0xc647('0x10'),require(_0xc647('0x11')));_0x339174[_0xc647('0x9')](_0xc647('0x12'),require('./api/voiceRecording'));_0x339174[_0xc647('0x9')](_0xc647('0x13'),require(_0xc647('0x14')));_0x339174[_0xc647('0x9')](_0xc647('0x15'),require(_0xc647('0x16')));_0x339174[_0xc647('0x9')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x339174[_0xc647('0x9')]('/api/voice/calls/reports',require(_0xc647('0x17')));_0x339174['use'](_0xc647('0x18'),require(_0xc647('0x19')));_0x339174[_0xc647('0x9')]('/api/voice/agents/reports',require(_0xc647('0x1a')));_0x339174[_0xc647('0x9')]('/api/voice/queues/reports',require(_0xc647('0x1b')));_0x339174[_0xc647('0x9')](_0xc647('0x1c'),require(_0xc647('0x1d')));_0x339174[_0xc647('0x9')](_0xc647('0x1e'),require('./api/trunk'));_0x339174['use'](_0xc647('0x1f'),require(_0xc647('0x20')));_0x339174[_0xc647('0x9')](_0xc647('0x21'),require(_0xc647('0x22')));_0x339174[_0xc647('0x9')]('/api/mail/accounts',require(_0xc647('0x23')));_0x339174[_0xc647('0x9')](_0xc647('0x24'),require(_0xc647('0x25')));_0x339174['use'](_0xc647('0x26'),require(_0xc647('0x27')));_0x339174[_0xc647('0x9')]('/api/mail/interactions',require('./api/mailInteraction'));_0x339174[_0xc647('0x9')](_0xc647('0x28'),require('./api/mailMessage'));_0x339174['use'](_0xc647('0x29'),require(_0xc647('0x2a')));_0x339174[_0xc647('0x9')](_0xc647('0x2b'),require(_0xc647('0x2c')));_0x339174['use'](_0xc647('0x2d'),require(_0xc647('0x2e')));_0x339174[_0xc647('0x9')]('/api/dashboards/items',require(_0xc647('0x2f')));_0x339174['use']('/api/fax/accounts',require('./api/faxAccount'));_0x339174[_0xc647('0x9')](_0xc647('0x30'),require(_0xc647('0x31')));_0x339174[_0xc647('0x9')](_0xc647('0x32'),require(_0xc647('0x33')));_0x339174[_0xc647('0x9')](_0xc647('0x34'),require(_0xc647('0x35')));_0x339174[_0xc647('0x9')]('/api/fax/queues',require('./api/faxQueue'));_0x339174[_0xc647('0x9')](_0xc647('0x36'),require(_0xc647('0x37')));_0x339174[_0xc647('0x9')](_0xc647('0x38'),require('./api/smsAccount'));_0x339174[_0xc647('0x9')]('/api/sms/applications',require(_0xc647('0x39')));_0x339174[_0xc647('0x9')](_0xc647('0x3a'),require('./api/smsInteraction'));_0x339174[_0xc647('0x9')](_0xc647('0x3b'),require(_0xc647('0x3c')));_0x339174[_0xc647('0x9')](_0xc647('0x3d'),require(_0xc647('0x3e')));_0x339174[_0xc647('0x9')](_0xc647('0x3f'),require(_0xc647('0x40')));_0x339174[_0xc647('0x9')](_0xc647('0x41'),require(_0xc647('0x42')));_0x339174['use'](_0xc647('0x43'),require(_0xc647('0x44')));_0x339174[_0xc647('0x9')](_0xc647('0x45'),require(_0xc647('0x46')));_0x339174['use']('/api/openchannel/queues',require(_0xc647('0x47')));_0x339174[_0xc647('0x9')](_0xc647('0x48'),require(_0xc647('0x49')));_0x339174[_0xc647('0x9')](_0xc647('0x4a'),require(_0xc647('0x4b')));_0x339174[_0xc647('0x9')](_0xc647('0x4c'),require(_0xc647('0x4d')));_0x339174[_0xc647('0x9')](_0xc647('0x4e'),require(_0xc647('0x4f')));_0x339174[_0xc647('0x9')]('/api/chat/messages',require(_0xc647('0x50')));_0x339174[_0xc647('0x9')](_0xc647('0x51'),require(_0xc647('0x52')));_0x339174['use'](_0xc647('0x53'),require(_0xc647('0x54')));_0x339174[_0xc647('0x9')](_0xc647('0x55'),require('./api/chatGroup'));_0x339174[_0xc647('0x9')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x339174[_0xc647('0x9')](_0xc647('0x56'),require('./api/cmCompany'));_0x339174[_0xc647('0x9')](_0xc647('0x57'),require(_0xc647('0x58')));_0x339174[_0xc647('0x9')]('/api/cm/hopper',require(_0xc647('0x59')));_0x339174['use'](_0xc647('0x5a'),require(_0xc647('0x5b')));_0x339174['use']('/api/cm/hopper_final',require(_0xc647('0x5c')));_0x339174[_0xc647('0x9')](_0xc647('0x5d'),require(_0xc647('0x5e')));_0x339174[_0xc647('0x9')](_0xc647('0x5f'),require('./api/cmCustomField'));_0x339174[_0xc647('0x9')](_0xc647('0x60'),require(_0xc647('0x61')));_0x339174[_0xc647('0x9')]('/api/automations',require(_0xc647('0x62')));_0x339174[_0xc647('0x9')](_0xc647('0x63'),require(_0xc647('0x64')));_0x339174['use'](_0xc647('0x65'),require('./api/disposition'));_0x339174[_0xc647('0x9')](_0xc647('0x66'),require(_0xc647('0x67')));_0x339174['use'](_0xc647('0x68'),require(_0xc647('0x69')));_0x339174[_0xc647('0x9')]('/api/pauses',require(_0xc647('0x6a')));_0x339174[_0xc647('0x9')](_0xc647('0x6b'),require(_0xc647('0x6c')));_0x339174[_0xc647('0x9')]('/api/voiceQueuesLog',require(_0xc647('0x6d')));_0x339174[_0xc647('0x9')](_0xc647('0x6e'),require(_0xc647('0x6f')));_0x339174['use'](_0xc647('0x70'),require(_0xc647('0x71')));_0x339174[_0xc647('0x9')](_0xc647('0x72'),require(_0xc647('0x73')));_0x339174[_0xc647('0x9')](_0xc647('0x74'),require(_0xc647('0x75')));_0x339174[_0xc647('0x9')](_0xc647('0x76'),require(_0xc647('0x77')));_0x339174[_0xc647('0x9')](_0xc647('0x78'),require(_0xc647('0x79')));_0x339174[_0xc647('0x9')](_0xc647('0x7a'),require(_0xc647('0x7b')));_0x339174['use'](_0xc647('0x7c'),require(_0xc647('0x7d')));_0x339174['use'](_0xc647('0x7e'),require(_0xc647('0x7f')));_0x339174[_0xc647('0x9')]('/api/integrations',require(_0xc647('0x80')));_0x339174['use']('/api/integrations/reports',require(_0xc647('0x81')));_0x339174[_0xc647('0x9')]('/api/analytics/custom_reports',require(_0xc647('0x82')));_0x339174['use'](_0xc647('0x83'),require(_0xc647('0x84')));_0x339174[_0xc647('0x9')](_0xc647('0x85'),require(_0xc647('0x86')));_0x339174['use'](_0xc647('0x87'),require(_0xc647('0x88')));_0x339174[_0xc647('0x9')](_0xc647('0x89'),require(_0xc647('0x8a')));_0x339174['use'](_0xc647('0x8b'),require(_0xc647('0x8c')));_0x339174[_0xc647('0x9')](_0xc647('0x8d'),require(_0xc647('0x8e')));_0x339174[_0xc647('0x9')](_0xc647('0x8f'),require(_0xc647('0x90')));_0x339174[_0xc647('0x9')](_0xc647('0x91'),require('./api/intSalesforceField'));_0x339174[_0xc647('0x9')](_0xc647('0x92'),require(_0xc647('0x93')));_0x339174[_0xc647('0x9')]('/api/integrations/sugarcrm/configurations',require(_0xc647('0x94')));_0x339174['use'](_0xc647('0x95'),require(_0xc647('0x96')));_0x339174[_0xc647('0x9')](_0xc647('0x97'),require(_0xc647('0x98')));_0x339174[_0xc647('0x9')](_0xc647('0x99'),require(_0xc647('0x9a')));_0x339174['use'](_0xc647('0x9b'),require(_0xc647('0x9c')));_0x339174[_0xc647('0x9')]('/api/integrations/zoho/accounts',require(_0xc647('0x9d')));_0x339174[_0xc647('0x9')](_0xc647('0x9e'),require(_0xc647('0x9f')));_0x339174[_0xc647('0x9')](_0xc647('0xa0'),require(_0xc647('0xa1')));_0x339174[_0xc647('0x9')](_0xc647('0xa2'),require('./api/intZendeskAccount'));_0x339174['use'](_0xc647('0xa3'),require('./api/intZendeskConfiguration'));_0x339174[_0xc647('0x9')](_0xc647('0xa4'),require(_0xc647('0xa5')));_0x339174['use'](_0xc647('0xa6'),require(_0xc647('0xa7')));_0x339174[_0xc647('0x9')](_0xc647('0xa8'),require(_0xc647('0xa9')));_0x339174[_0xc647('0x9')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x339174[_0xc647('0x9')]('/api/integrations/vtiger/accounts',require(_0xc647('0xaa')));_0x339174[_0xc647('0x9')]('/api/integrations/vtiger/configurations',require(_0xc647('0xab')));_0x339174[_0xc647('0x9')](_0xc647('0xac'),require(_0xc647('0xad')));_0x339174[_0xc647('0x9')](_0xc647('0xae'),require(_0xc647('0xaf')));_0x339174['use']('/api/integrations/servicenow/configurations',require(_0xc647('0xb0')));_0x339174[_0xc647('0x9')]('/api/integrations/servicenow/fields',require(_0xc647('0xb1')));_0x339174[_0xc647('0x9')]('/api/integrations/dynamics365/accounts',require(_0xc647('0xb2')));_0x339174[_0xc647('0x9')](_0xc647('0xb3'),require(_0xc647('0xb4')));_0x339174[_0xc647('0x9')](_0xc647('0xb5'),require(_0xc647('0xb6')));_0x339174[_0xc647('0x9')]('/api/integrations/freshsales/accounts',require(_0xc647('0xb7')));_0x339174[_0xc647('0x9')]('/api/integrations/freshsales/configurations',require(_0xc647('0xb8')));_0x339174['use'](_0xc647('0xb9'),require('./api/intFreshsalesField'));_0x339174[_0xc647('0x9')](_0xc647('0xba'),require(_0xc647('0xbb')));_0x339174[_0xc647('0x9')](_0xc647('0xbc'),require(_0xc647('0xbd')));_0x339174['use']('/api/chat/internal/messages',require(_0xc647('0xbe')));_0x339174['use'](_0xc647('0xbf'),require(_0xc647('0xc0')));_0x339174[_0xc647('0x9')](_0xc647('0xc1'),require(_0xc647('0xc2')));_0x339174[_0xc647('0x9')]('/api/jscripty/sessions/reports',require(_0xc647('0xc3')));_0x339174[_0xc647('0x9')]('/api/sms/reports/queue',require(_0xc647('0xc4')));_0x339174['use'](_0xc647('0xc5'),require(_0xc647('0xc6')));_0x339174[_0xc647('0x9')](_0xc647('0xc7'),require('./api/squareReportDetail'));_0x339174['use']('/api/jscripty/projects',require(_0xc647('0xc8')));_0x339174['use']('/api/settings',require(_0xc647('0xc9')));_0x339174[_0xc647('0x9')](_0xc647('0xca'),require(_0xc647('0xcb')));_0x339174['use'](_0xc647('0xcc'),require(_0xc647('0xcd')));_0x339174[_0xc647('0x9')](_0xc647('0xce'),require(_0xc647('0xcf')));_0x339174[_0xc647('0x9')]('/api/square/messages',require(_0xc647('0xd0')));_0x339174[_0xc647('0x9')]('/api/teams',require(_0xc647('0xd1')));_0x339174[_0xc647('0x9')](_0xc647('0xd2'),require(_0xc647('0xd3')));_0x339174['use']('/api/campaigns',require('./api/campaign'));_0x339174[_0xc647('0x9')](_0xc647('0xd4'),require(_0xc647('0xd5')));_0x339174[_0xc647('0x9')]('/api/attachments',require(_0xc647('0xd6')));_0x339174['use']('/api/plugins',require(_0xc647('0xd7')));_0x339174[_0xc647('0x9')](_0xc647('0xd8'),require(_0xc647('0xd9')));_0x339174[_0xc647('0x9')](_0xc647('0xda'),require(_0xc647('0xdb')));_0x339174[_0xc647('0x9')](_0xc647('0xdc'),require(_0xc647('0xdd')));_0x339174[_0xc647('0x9')](_0xc647('0xde'),require(_0xc647('0xdf')));_0x339174[_0xc647('0x9')](_0xc647('0xe0'),require(_0xc647('0xe1')));_0x339174[_0xc647('0x9')](_0xc647('0xe2'),require(_0xc647('0xe3')));_0x339174[_0xc647('0x9')](_0xc647('0xe4'),require(_0xc647('0xe5')));_0x339174['use'](_0xc647('0xe6'),require(_0xc647('0xe7')));_0x339174[_0xc647('0x9')](_0xc647('0xe8'),require(_0xc647('0xe9')));_0x339174[_0xc647('0x9')]('/api/userProfile/resources',require(_0xc647('0xea')));_0x339174[_0xc647('0x9')](_0xc647('0xeb'),require('./api/userNotification'));_0x339174[_0xc647('0x9')](_0xc647('0xec'),require(_0xc647('0xed')));_0x339174[_0xc647('0x9')](_0xc647('0xee'),require('./api/whatsappApplication'));_0x339174[_0xc647('0x9')](_0xc647('0xef'),require('./api/whatsappInteraction'));_0x339174[_0xc647('0x9')](_0xc647('0xf0'),require(_0xc647('0xf1')));_0x339174[_0xc647('0x9')](_0xc647('0xf2'),require(_0xc647('0xf3')));_0x339174[_0xc647('0x9')]('/api/whatsapp/reports/transfer',require(_0xc647('0xf4')));_0x339174[_0xc647('0x9')](_0xc647('0xf5'),require('./api/whatsappQueue'));_0x339174['use'](_0xc647('0xf6'),require('./api/cloudProvider'));_0x339174[_0xc647('0x9')]('/api/realtime',require(_0xc647('0xf7')));_0x339174[_0xc647('0x9')](_0xc647('0xf8'),require(_0xc647('0xf9')));_0x339174[_0xc647('0x9')](_0xc647('0xfa'),require(_0xc647('0xfb')));_0x339174[_0xc647('0x9')](_0xc647('0xfc'),require('./api/authLocal'));_0x339174['use']('/api/auth/google',require('./api/authGoogle'));_0x339174[_0xc647('0x9')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x339174[_0xc647('0x9')]('/api/jira',require('./api/jira'));_0x339174[_0xc647('0x9')]('/api/rpc',require('./api/rpc'));_0x339174[_0xc647('0x9')](_0xc647('0xfd'),require(_0xc647('0xfe')));_0x339174['use'](_0xc647('0xff'),require('./api/system'));_0x339174[_0xc647('0x9')](_0xc647('0x100'),require(_0xc647('0x101')));_0x339174['use'](_0xc647('0x102'),require('./api/webbar'));_0x339174[_0xc647('0x9')]('/api/logs',clientSideLogs);_0x339174['use'](_0xc647('0x103'),express[_0xc647('0x104')](path[_0xc647('0x105')](config[_0xc647('0x106')],_0xc647('0x103'))));_0x339174[_0xc647('0x9')](_0xc647('0x107'),express[_0xc647('0x104')](path['join'](config[_0xc647('0x106')],_0xc647('0x107'))));_0x339174[_0xc647('0x9')](_0xc647('0x108'),express[_0xc647('0x104')](path[_0xc647('0x105')](config[_0xc647('0x106')],_0xc647('0x108'))));_0x339174['use'](_0xc647('0x109'),express[_0xc647('0x104')](path[_0xc647('0x105')](config['root'],_0xc647('0x10a'),'3.10.1')));_0x339174[_0xc647('0x9')](_0xc647('0x10b'),express['static'](path['join'](config[_0xc647('0x106')],_0xc647('0x10c'))));_0x339174['route'](_0xc647('0x10d'))[_0xc647('0x10e')](errors[0x194]);_0x339174[_0xc647('0x10f')]('/*')['get'](function(_0x91b8e3,_0xa1de56){_0xa1de56[_0xc647('0x110')](path[_0xc647('0x111')](_0x339174['get'](_0xc647('0x112'))+'/index.html'));});return _0x339174;});}; \ No newline at end of file +var _0xc029=['/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/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/actions','./api/action','./api/automation','/api/dispositions','./api/condition','/api/intervals','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/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/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','/api/teams','./api/license','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','/api/auth/local','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','3.10.1','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','get','sendFile','resolve','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxQueue'];(function(_0x39a094,_0x41d3e0){var _0x156701=function(_0x411d3d){while(--_0x411d3d){_0x39a094['push'](_0x39a094['shift']());}};_0x156701(++_0x41d3e0);}(_0xc029,0x1df));var _0x9c02=function(_0x1425e8,_0x2c195b){_0x1425e8=_0x1425e8-0x0;var _0x1cd239=_0xc029[_0x1425e8];return _0x1cd239;};'use strict';var path=require(_0x9c02('0x0'));var express=require(_0x9c02('0x1'));var errors=require(_0x9c02('0x2'));var config=require(_0x9c02('0x3'));var setupLoggers=require(_0x9c02('0x4'))[_0x9c02('0x5')];var clientSideLogs=require(_0x9c02('0x6'));exports[_0x9c02('0x7')]=function(_0x39c897){return setupLoggers(_0x39c897)[_0x9c02('0x8')](function(){_0x39c897[_0x9c02('0x9')](_0x9c02('0xa'),require(_0x9c02('0xb')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc'),require(_0x9c02('0xd')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xe'),require('./api/voiceContext'));_0x39c897[_0x9c02('0x9')]('/api/voice/extensions',require(_0x9c02('0xf')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x10'),require(_0x9c02('0x11')));_0x39c897['use'](_0x9c02('0x12'),require('./api/voiceQueue'));_0x39c897[_0x9c02('0x9')]('/api/voice/recordings',require(_0x9c02('0x13')));_0x39c897[_0x9c02('0x9')]('/api/screen/recordings',require(_0x9c02('0x14')));_0x39c897[_0x9c02('0x9')]('/api/voice/mails',require(_0x9c02('0x15')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x16'),require('./api/voiceMailMessage'));_0x39c897['use'](_0x9c02('0x17'),require(_0x9c02('0x18')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x19'),require('./api/voiceDialReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x1a'),require(_0x9c02('0x1b')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x1c'),require('./api/voiceQueueReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x1d'),require(_0x9c02('0x1e')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x1f'),require(_0x9c02('0x20')));_0x39c897['use'](_0x9c02('0x21'),require(_0x9c02('0x22')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x23'),require(_0x9c02('0x24')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x25'),require(_0x9c02('0x26')));_0x39c897[_0x9c02('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0x39c897['use'](_0x9c02('0x27'),require('./api/mailSubstatus'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x28'),require(_0x9c02('0x29')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x2a'),require(_0x9c02('0x2b')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x2c'),require('./api/mailApplication'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x2d'),require(_0x9c02('0x2e')));_0x39c897['use']('/api/dashboards',require('./api/dashboard'));_0x39c897['use'](_0x9c02('0x2f'),require(_0x9c02('0x30')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x31'),require(_0x9c02('0x32')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x33'),require(_0x9c02('0x34')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x35'),require('./api/faxInteraction'));_0x39c897[_0x9c02('0x9')]('/api/fax/messages',require('./api/faxMessage'));_0x39c897[_0x9c02('0x9')]('/api/fax/queues',require(_0x9c02('0x36')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x37'),require(_0x9c02('0x38')));_0x39c897[_0x9c02('0x9')]('/api/sms/accounts',require(_0x9c02('0x39')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x3a'),require(_0x9c02('0x3b')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x3c'),require(_0x9c02('0x3d')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x3e'),require(_0x9c02('0x3f')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x40'),require(_0x9c02('0x41')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x42'),require('./api/openchannelAccount'));_0x39c897['use']('/api/openchannel/applications',require(_0x9c02('0x43')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x44'),require(_0x9c02('0x45')));_0x39c897[_0x9c02('0x9')]('/api/openchannel/messages',require(_0x9c02('0x46')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x47'),require(_0x9c02('0x48')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x49'),require(_0x9c02('0x4a')));_0x39c897['use'](_0x9c02('0x4b'),require(_0x9c02('0x4c')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x4d'),require(_0x9c02('0x4e')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x4f'),require(_0x9c02('0x50')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x51'),require(_0x9c02('0x52')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x53'),require(_0x9c02('0x54')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x55'),require('./api/chatQueue'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x56'),require(_0x9c02('0x57')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x58'),require(_0x9c02('0x59')));_0x39c897[_0x9c02('0x9')]('/api/cm/companies',require(_0x9c02('0x5a')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x5b'),require(_0x9c02('0x5c')));_0x39c897[_0x9c02('0x9')]('/api/cm/hopper',require(_0x9c02('0x5d')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x5e'),require(_0x9c02('0x5f')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x60'),require(_0x9c02('0x61')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x62'),require(_0x9c02('0x63')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x64'),require('./api/cmCustomField'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x65'),require(_0x9c02('0x66')));_0x39c897['use']('/api/automations',require(_0x9c02('0x67')));_0x39c897[_0x9c02('0x9')]('/api/canned_answers',require('./api/cannedAnswer'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x68'),require('./api/disposition'));_0x39c897['use']('/api/conditions',require(_0x9c02('0x69')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x6a'),require('./api/interval'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x6b'),require('./api/pause'));_0x39c897[_0x9c02('0x9')]('/api/cdr',require(_0x9c02('0x6c')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x6d'),require('./api/voiceQueuesLog'));_0x39c897[_0x9c02('0x9')]('/api/schedules',require(_0x9c02('0x6e')));_0x39c897['use']('/api/sounds',require(_0x9c02('0x6f')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x70'),require(_0x9c02('0x71')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x72'),require('./api/contactItemType'));_0x39c897['use'](_0x9c02('0x73'),require(_0x9c02('0x74')));_0x39c897['use'](_0x9c02('0x75'),require('./api/cmHopperAdditionalPhone'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x76'),require('./api/template'));_0x39c897[_0x9c02('0x9')]('/api/triggers',require(_0x9c02('0x77')));_0x39c897['use'](_0x9c02('0x78'),require(_0x9c02('0x79')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x7a'),require(_0x9c02('0x7b')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x7c'),require(_0x9c02('0x7d')));_0x39c897[_0x9c02('0x9')]('/api/analytics/custom_reports',require(_0x9c02('0x7e')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x7f'),require(_0x9c02('0x80')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x81'),require(_0x9c02('0x82')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x83'),require(_0x9c02('0x84')));_0x39c897['use'](_0x9c02('0x85'),require(_0x9c02('0x86')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x87'),require(_0x9c02('0x88')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x89'),require(_0x9c02('0x8a')));_0x39c897[_0x9c02('0x9')]('/api/integrations/salesforce/configurations',require(_0x9c02('0x8b')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x8c'),require('./api/intSalesforceField'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x8d'),require(_0x9c02('0x8e')));_0x39c897['use'](_0x9c02('0x8f'),require(_0x9c02('0x90')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x91'),require(_0x9c02('0x92')));_0x39c897['use'](_0x9c02('0x93'),require(_0x9c02('0x94')));_0x39c897[_0x9c02('0x9')]('/api/integrations/desk/configurations',require(_0x9c02('0x95')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x96'),require(_0x9c02('0x97')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x98'),require('./api/intZohoAccount'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x99'),require(_0x9c02('0x9a')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x9b'),require(_0x9c02('0x9c')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x9d'),require(_0x9c02('0x9e')));_0x39c897['use'](_0x9c02('0x9f'),require('./api/intZendeskConfiguration'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xa0'),require(_0x9c02('0xa1')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xa2'),require(_0x9c02('0xa3')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xa4'),require('./api/intFreshdeskConfiguration'));_0x39c897['use']('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xa5'),require(_0x9c02('0xa6')));_0x39c897['use'](_0x9c02('0xa7'),require('./api/intVtigerConfiguration'));_0x39c897['use'](_0x9c02('0xa8'),require(_0x9c02('0xa9')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xaa'),require('./api/intServicenowAccount'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xab'),require('./api/intServicenowConfiguration'));_0x39c897[_0x9c02('0x9')]('/api/integrations/servicenow/fields',require(_0x9c02('0xac')));_0x39c897['use']('/api/integrations/dynamics365/accounts',require(_0x9c02('0xad')));_0x39c897[_0x9c02('0x9')]('/api/integrations/dynamics365/configurations',require(_0x9c02('0xae')));_0x39c897['use'](_0x9c02('0xaf'),require('./api/intDynamics365Field'));_0x39c897[_0x9c02('0x9')]('/api/integrations/freshsales/accounts',require(_0x9c02('0xb0')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xb1'),require(_0x9c02('0xb2')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xb3'),require(_0x9c02('0xb4')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xb5'),require(_0x9c02('0xb6')));_0x39c897[_0x9c02('0x9')]('/api/chat/reports/queue',require(_0x9c02('0xb7')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xb8'),require(_0x9c02('0xb9')));_0x39c897['use'](_0x9c02('0xba'),require(_0x9c02('0xbb')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xbc'),require('./api/jscriptyQuestionReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xbd'),require(_0x9c02('0xbe')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xbf'),require('./api/smsQueueReport'));_0x39c897['use'](_0x9c02('0xc0'),require(_0x9c02('0xc1')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc2'),require(_0x9c02('0xc3')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc4'),require(_0x9c02('0xc5')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc6'),require('./api/setting'));_0x39c897[_0x9c02('0x9')]('/api/square/odbc',require(_0x9c02('0xc7')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc8'),require('./api/squareProject'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc9'),require('./api/squareRecording'));_0x39c897['use'](_0x9c02('0xca'),require('./api/squareMessage'));_0x39c897['use'](_0x9c02('0xcb'),require('./api/team'));_0x39c897[_0x9c02('0x9')]('/api/license',require(_0x9c02('0xcc')));_0x39c897[_0x9c02('0x9')]('/api/campaigns',require('./api/campaign'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xcd'),require(_0x9c02('0xce')));_0x39c897['use'](_0x9c02('0xcf'),require(_0x9c02('0xd0')));_0x39c897['use']('/api/plugins',require(_0x9c02('0xd1')));_0x39c897['use'](_0x9c02('0xd2'),require(_0x9c02('0xd3')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xd4'),require('./api/chatTransferReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xd5'),require('./api/faxTransferReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xd6'),require(_0x9c02('0xd7')));_0x39c897['use']('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xd8'),require(_0x9c02('0xd9')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xda'),require(_0x9c02('0xdb')));_0x39c897['use'](_0x9c02('0xdc'),require(_0x9c02('0xdd')));_0x39c897[_0x9c02('0x9')]('/api/userProfile/sections',require(_0x9c02('0xde')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xdf'),require(_0x9c02('0xe0')));_0x39c897[_0x9c02('0x9')]('/api/userNotifications',require('./api/userNotification'));_0x39c897['use']('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xe1'),require('./api/whatsappApplication'));_0x39c897['use'](_0x9c02('0xe2'),require(_0x9c02('0xe3')));_0x39c897[_0x9c02('0x9')]('/api/whatsapp/messages',require(_0x9c02('0xe4')));_0x39c897['use']('/api/whatsapp/reports/queue',require(_0x9c02('0xe5')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xe6'),require(_0x9c02('0xe7')));_0x39c897['use'](_0x9c02('0xe8'),require(_0x9c02('0xe9')));_0x39c897[_0x9c02('0x9')]('/api/cloudProviders',require('./api/cloudProvider'));_0x39c897['use'](_0x9c02('0xea'),require(_0x9c02('0xeb')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xec'),require(_0x9c02('0xed')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xee'),require('./api/mailInteractionHasTag'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xef'),require('./api/authLocal'));_0x39c897['use']('/api/auth/google',require(_0x9c02('0xf0')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xf1'),require(_0x9c02('0xf2')));_0x39c897[_0x9c02('0x9')]('/api/jira',require('./api/jira'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xf3'),require(_0x9c02('0xf4')));_0x39c897[_0x9c02('0x9')]('/api/version',require(_0x9c02('0xf5')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xf6'),require('./api/system'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xf7'),require(_0x9c02('0xf8')));_0x39c897['use']('/api/webbar',require(_0x9c02('0xf9')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xfa'),clientSideLogs);_0x39c897[_0x9c02('0x9')](_0x9c02('0xfb'),express[_0x9c02('0xfc')](path[_0x9c02('0xfd')](config[_0x9c02('0xfe')],_0x9c02('0xfb'))));_0x39c897[_0x9c02('0x9')](_0x9c02('0xff'),express[_0x9c02('0xfc')](path[_0x9c02('0xfd')](config['root'],_0x9c02('0xff'))));_0x39c897[_0x9c02('0x9')](_0x9c02('0x100'),express[_0x9c02('0xfc')](path[_0x9c02('0xfd')](config[_0x9c02('0xfe')],_0x9c02('0x100'))));_0x39c897[_0x9c02('0x9')](_0x9c02('0x101'),express[_0x9c02('0xfc')](path['join'](config[_0x9c02('0xfe')],'snippet',_0x9c02('0x102'))));_0x39c897['use'](_0x9c02('0x103'),express[_0x9c02('0xfc')](path[_0x9c02('0xfd')](config['root'],_0x9c02('0x104'))));_0x39c897['route'](_0x9c02('0x105'))['get'](errors[0x194]);_0x39c897[_0x9c02('0x106')]('/*')[_0x9c02('0x107')](function(_0x4af2c7,_0x2af821){_0x2af821[_0x9c02('0x108')](path[_0x9c02('0x109')](_0x39c897['get'](_0x9c02('0x10a'))+'/index.html'));});return _0x39c897;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index fd16848..101b331 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdda2=['../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareOdbc/squareOdbc.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'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0xdda2,0x122));var _0x2dda=function(_0x5d88bc,_0x81648b){_0x5d88bc=_0x5d88bc-0x0;var _0x1390cb=_0xdda2[_0x5d88bc];return _0x1390cb;};'use strict';var jayson=require(_0x2dda('0x0'));var _=require('lodash');var config=require(_0x2dda('0x1'));exports['listen']=function(){return new Promise(function(_0x14df1c,_0x378f60){var _0x2fb723={};_0x2fb723=_['merge'](_0x2fb723,require('../api/user/user.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x3')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/voiceQueue/voiceQueue.rpc'));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x4')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x5')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x6')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x7')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x8')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x9')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0xa')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0xb')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/mailServerIn/mailServerIn.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0xc')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0xd')));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0xe')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0xf')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x10')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x11')));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x12')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x13')));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x14')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x15')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x16')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x17')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/smsAccount/smsAccount.rpc'));_0x2fb723=_['merge'](_0x2fb723,require('../api/smsInteraction/smsInteraction.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x18')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/smsQueue/smsQueue.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x19')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x1a')));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x1b')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x1c')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x1d')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x1e')));_0x2fb723=_['merge'](_0x2fb723,require('../api/chatQueue/chatQueue.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x1f')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x20')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x21')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x22')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x23')));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x24')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x25')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x26')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x27')));_0x2fb723=_['merge'](_0x2fb723,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x28')));_0x2fb723=_['merge'](_0x2fb723,require('../api/trigger/trigger.rpc'));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x29')));_0x2fb723=_['merge'](_0x2fb723,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x2a')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x2b')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x2c')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x2d')));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x2e')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x2f')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x30')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x31')));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x32')));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x33')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/squareReport/squareReport.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/setting/setting.rpc'));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x34')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x35')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/squareRecording/squareRecording.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x36')));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x37')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x38')));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x39')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x3a')));_0x2fb723=_['merge'](_0x2fb723,require(_0x2dda('0x3b')));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2fb723=_[_0x2dda('0x2')](_0x2fb723,require(_0x2dda('0x3c')));var _0xe71cc1=jayson['server'](_0x2fb723)[_0x2dda('0x3d')]();var _0x65853d=config['rpc'][_0x2dda('0x3e')]||config['port']+0x1;var _0x3d815e=config[_0x2dda('0x3f')]['ip']||_0x2dda('0x40');_0xe71cc1['on']('error',function(_0x4ed371){return _0x378f60(_0x4ed371);});_0xe71cc1['listen'](_0x65853d,_0x3d815e,function(){console[_0x2dda('0x41')](_0x2dda('0x42'),_0x3d815e,_0x65853d);require(_0x2dda('0x43'))[_0x2dda('0x44')]();return _0x14df1c(_0x2dda('0x45')+_0x3d815e+':'+_0x65853d);});});}; \ No newline at end of file +var _0x2619=['../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/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','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x2619,0x119));var _0x9261=function(_0x5e8a9a,_0x4b1d76){_0x5e8a9a=_0x5e8a9a-0x0;var _0x5eb0af=_0x2619[_0x5e8a9a];return _0x5eb0af;};'use strict';var jayson=require(_0x9261('0x0'));var _=require(_0x9261('0x1'));var config=require(_0x9261('0x2'));exports['listen']=function(){return new Promise(function(_0x21a976,_0xddff77){var _0xa5a6b8={};_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x4')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x5')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x6')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x7')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x8')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x9')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0xa')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0xb')));_0xa5a6b8=_['merge'](_0xa5a6b8,require('../api/trunk/trunk.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0xc')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0xd')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/mailServerIn/mailServerIn.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/mailAccount/mailAccount.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0xe')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0xf')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x10')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x11')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x12')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x13')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x14')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x15')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x16')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x17')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/faxQueueReport/faxQueueReport.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x18')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x19')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/smsMessage/smsMessage.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1a')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/openchannelApplication/openchannelApplication.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1b')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1c')));_0xa5a6b8=_['merge'](_0xa5a6b8,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1d')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1e')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1f')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/chatQueue/chatQueue.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/cmContact/cmContact.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x20')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x21')));_0xa5a6b8=_['merge'](_0xa5a6b8,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x22')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x23')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x24')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x25')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/sound/sound.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x26')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/template/template.rpc'));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x27')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x28')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x29')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2a')));_0xa5a6b8=_['merge'](_0xa5a6b8,require('../api/intDeskAccount/intDeskAccount.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2b')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2c')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2d')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2e')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2f')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x30')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x31')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x32')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x33')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x34')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x35')));_0xa5a6b8=_['merge'](_0xa5a6b8,require('../api/setting/setting.rpc'));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x36')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x37')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x38')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x39')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3a')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3b')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3c')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3d')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3e')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3f')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x172430=jayson['server'](_0xa5a6b8)['http']();var _0xc6a1e1=config[_0x9261('0x40')][_0x9261('0x41')]||config[_0x9261('0x41')]+0x1;var _0x3caf8a=config[_0x9261('0x40')]['ip']||_0x9261('0x42');_0x172430['on'](_0x9261('0x43'),function(_0x4760b8){return _0xddff77(_0x4760b8);});_0x172430[_0x9261('0x44')](_0xc6a1e1,_0x3caf8a,function(){console[_0x9261('0x45')](_0x9261('0x46'),_0x3caf8a,_0xc6a1e1);require('../config/triggers')[_0x9261('0x47')]();return _0x21a976(_0x9261('0x48')+_0x3caf8a+':'+_0xc6a1e1);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index a1ad89c..f84f3e7 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 _0x1763=['./error','utf8','setEncoding','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','command','write','sendRequest','sync','answer','prototype','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','join','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','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','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x1763,0x128));var _0x3176=function(_0x5ba280,_0x178f07){_0x5ba280=_0x5ba280-0x0;var _0x57fd68=_0x1763[_0x5ba280];return _0x57fd68;};'use strict';var util=require(_0x3176('0x0'));var _=require(_0x3176('0x1'));var EventEmitter=require('events')[_0x3176('0x2')];var AGIReply=require(_0x3176('0x3'));var AGIError=require(_0x3176('0x4'));function AGIChannel(_0x4d3f0d){var _0x2a66ff=this,_0xb7ce56=new AGIReply(),_0x12b83f=![],_0x5acf23={};EventEmitter['call'](_0x2a66ff);_0x4d3f0d['setEncoding'](_0x3176('0x5'));_0x4d3f0d['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0xb7ce56[_0x3176('0x6')](_0x3176('0x5'));_0xb7ce56['on'](_0x3176('0x7'),function(_0x98fd34){for(var _0x23f7d2 in _0x98fd34){_0x2a66ff[_0x23f7d2]=_0x98fd34[_0x23f7d2];}_0x2a66ff[_0x3176('0x8')]('ready');});_0xb7ce56['on'](_0x3176('0x9'),function(_0x1617b2){if(_0x1617b2[_0x3176('0xa')]()==_0x3176('0xb')){_0x2a66ff[_0x3176('0x8')](_0x3176('0xb'));return;}if(_0x1617b2[_0x3176('0xc')](0x0,0xb)==_0x3176('0xd')){_0x12b83f=!![];}if(_0x12b83f){_0x5acf23['rx']+=_0x1617b2+'\x0a';if(_0x1617b2[_0x3176('0xe')](_0x3176('0xf'))!=-0x1){_0x12b83f=![];}}else{_0x5acf23['rx']=_0x1617b2;}if(_0x12b83f){return;}if(typeof _0x5acf23['cb']==_0x3176('0x10')){var _0xb70c8a=_0x5acf23['rx']['substring'](0x0,0x3),_0x59fa58=null,_0x54d9bf=null;_0xb70c8a=parseInt(_0xb70c8a);if(isNaN(_0xb70c8a)){_0x5acf23['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3176('0x11')});return;}if(_0xb70c8a!=0xc8){_0x5acf23['cb'](null,{'code':_0xb70c8a,'result':-0x1,'extra':'KO'});return;}_0x59fa58=_0x5acf23['rx'][_0x3176('0xc')](0x4)[_0x3176('0x12')]('result=','');if(_0x59fa58[_0x3176('0x13')]('\x20')!=-0x1){_0x59fa58=_0x59fa58[_0x3176('0x14')](0x0,_0x59fa58[_0x3176('0x13')]('\x20'));}if(_['startsWith'](_0x59fa58,'-1')){_0x59fa58=parseInt(_0x59fa58);}_0x54d9bf=_0x5acf23['rx'][_0x3176('0x15')]('\x20');if(_0x54d9bf['length']==0x3){_0x54d9bf=_0x54d9bf[0x2][_0x3176('0xc')](0x1,_0x54d9bf[0x2][_0x3176('0x16')]-0x1);}else if(_0x54d9bf[_0x3176('0x16')]>0x3){var _0x6450a6=/\((.+)\)/;var _0x255b33=_0x5acf23['rx'][_0x3176('0x17')](_0x6450a6);if(_0x255b33){_0x54d9bf=_0x255b33[0x1];}else{_0x54d9bf=null;}}else{_0x54d9bf=null;}_0x5acf23['cb'](null,{'code':_0xb70c8a,'result':_0x59fa58,'extra':_0x54d9bf});}});_0x4d3f0d['on']('error',function(_0x555be6){_0x2a66ff['emit'](_0x3176('0x18'),new AGIError(_0x3176('0x19'),_0x555be6[_0x3176('0x1a')]));});_0x4d3f0d['on'](_0x3176('0x1b'),function(){_0x2a66ff[_0x3176('0x8')](_0x3176('0x1b'),new AGIError(_0x3176('0x1c')));});_0x4d3f0d['on'](_0x3176('0x1d'),function(){_0x2a66ff[_0x3176('0x8')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4d3f0d[_0x3176('0x1e')]();});_0x4d3f0d['pipe'](_0xb7ce56);this[_0x3176('0x1f')]=function(_0x371b52,_0x1a5bb1){var _0x371b52=_0x371b52||'',_0x1a5bb1=typeof _0x1a5bb1==_0x3176('0x10')?_0x1a5bb1:new Function();_0x5acf23={'tx':_0x371b52,'rx':'','cb':_0x1a5bb1};_0x4d3f0d[_0x3176('0x20')](_0x371b52+'\x0a');},this['close']=function(){_0x4d3f0d[_0x3176('0x1e')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x3176('0x21')]=function(_0x278a16){return this[_0x3176('0x1f')][_0x3176('0x22')](this,_0x278a16);};AGIChannel['prototype'][_0x3176('0x23')]=function(){return this[_0x3176('0x21')]('ANSWER');};AGIChannel[_0x3176('0x24')]['getData']=function(_0x9e7496,_0x138937,_0x261c29){_0x9e7496=_0x9e7496===undefined?_0x3176('0x25'):_0x9e7496;_0x138937=_0x138937===undefined?'5':_0x138937;_0x261c29=_0x261c29===undefined?'1':_0x261c29;return this[_0x3176('0x21')](util['format'](_0x3176('0x26'),_0x9e7496,_0x138937*0x3e8,_0x261c29));};AGIChannel['prototype']['noop']=function(_0x2c9142){_0x2c9142=_0x2c9142||_0x3176('0x27');return this['sendRequest'](util[_0x3176('0x28')]('VERBOSE\x20\x22%s\x22',_0x2c9142));};AGIChannel[_0x3176('0x24')][_0x3176('0x29')]=function(_0x23604f,_0x157425){if(_[_0x3176('0x2a')](_0x157425)){return this['sendRequest'](util[_0x3176('0x28')](_0x3176('0x2b'),_0x23604f,_0x157425[_0x3176('0x2c')](',')));}return this[_0x3176('0x21')](util[_0x3176('0x28')](_0x3176('0x2b'),_0x23604f,_0x157425));};AGIChannel[_0x3176('0x24')]['setContext']=function(_0x116284){return this[_0x3176('0x21')](util['format']('SET\x20CONTEXT\x20%s',_0x116284));};AGIChannel[_0x3176('0x24')][_0x3176('0x2d')]=function(_0x12a199){return this[_0x3176('0x21')](util[_0x3176('0x28')]('SET\x20EXTENSION\x20%s',_0x12a199));};AGIChannel[_0x3176('0x24')][_0x3176('0x2e')]=function(_0x16e91a){return this[_0x3176('0x21')](util['format'](_0x3176('0x2f'),_0x16e91a));};AGIChannel[_0x3176('0x24')][_0x3176('0xb')]=function(){return this[_0x3176('0x21')](_0x3176('0x30'));};AGIChannel[_0x3176('0x24')][_0x3176('0x31')]=function(_0x37bd83,_0x47f5ef){var _0x38040d=_[_0x3176('0x32')](_0x47f5ef)||_['isNumber'](_0x47f5ef)?_0x47f5ef[_0x3176('0x33')]():_0x47f5ef;return this[_0x3176('0x21')](util[_0x3176('0x28')](_0x3176('0x34'),_0x37bd83,_0x38040d?_0x38040d[_0x3176('0x33')]()[_0x3176('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3176('0x24')]['sayNumber']=function(_0x3146e1,_0x14f68d){return this[_0x3176('0x21')](util[_0x3176('0x28')](_0x3176('0x35'),_0x3146e1,_0x14f68d));};AGIChannel[_0x3176('0x24')][_0x3176('0x36')]=function(_0x480c3,_0x1cef27){return this[_0x3176('0x21')](util[_0x3176('0x28')](_0x3176('0x37'),_0x480c3,_0x1cef27));};AGIChannel['prototype'][_0x3176('0x38')]=function(_0x4d6f98,_0x1c740d){return this[_0x3176('0x21')](util[_0x3176('0x28')](_0x3176('0x39'),_0x4d6f98,_0x1c740d));};AGIChannel[_0x3176('0x24')][_0x3176('0x3a')]=function(_0x3ec8af,_0x1d4587,_0x149776){_0x1d4587=_0x1d4587||this[_0x3176('0x3b')];_0x149776=_0x149776||0x1;this[_0x3176('0x3c')](_0x3ec8af);this[_0x3176('0x2d')](_0x1d4587);this[_0x3176('0x2e')](_0x149776);return this[_0x3176('0x3d')](util[_0x3176('0x28')](_0x3176('0x3e'),_0x3ec8af,_0x1d4587,_0x149776));};AGIChannel[_0x3176('0x24')][_0x3176('0x3f')]=function(_0x4f82c0){return this[_0x3176('0x21')](util[_0x3176('0x28')](_0x3176('0x40'),_0x4f82c0));};AGIChannel['prototype']['recordFile']=function(_0x38cee0,_0x3985a2,_0x2c6147,_0x438c58,_0x50c170,_0x2ef44c){_0x3985a2=_0x3985a2||_0x3176('0x41');_0x2c6147=_0x2c6147||'';_0x438c58=_0x438c58===undefined?-0x1:_0x438c58==='-1'?-0x1:_0x438c58*0x3e8;_0x50c170=_0x50c170===undefined?'':'s='+_0x50c170;_0x2ef44c=_0x2ef44c?'BEEP':'';return this['sendRequest'](util[_0x3176('0x28')](_0x3176('0x42'),_0x38cee0,_0x3985a2,_0x2c6147,_0x438c58,_0x2ef44c,_0x50c170));};AGIChannel[_0x3176('0x24')][_0x3176('0x43')]=function(_0x127bab,_0x51840d){_0x51840d=_0x51840d||'';return this[_0x3176('0x21')](util['format'](_0x3176('0x44'),_0x127bab,_0x51840d));};AGIChannel[_0x3176('0x24')][_0x3176('0x45')]=function(_0x875a05){return this[_0x3176('0x29')](_0x3176('0x46'),_0x875a05);};AGIChannel['prototype']['wait']=function(_0x13cc8d){return this['exec'](_0x3176('0x47'),_0x13cc8d);};AGIChannel['prototype'][_0x3176('0x18')]=function(_0x15820a,_0x3bba4d){this[_0x3176('0x3d')](util[_0x3176('0x28')](_0x3176('0x48'),_0x15820a['id'],_0x15820a[_0x3176('0x49')],_0x3bba4d));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3176('0x4a')]=AGIChannel; \ No newline at end of file +var _0xe864=['./error','call','setEncoding','setTimeout','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','startsWith','split','length','error','code','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe','write','destroy','inherits','prototype','command','sync','answer','sendRequest','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','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','label','exports','util','lodash','events','EventEmitter','./reply'];(function(_0x4b8156,_0x437af2){var _0x4a819c=function(_0xe21347){while(--_0xe21347){_0x4b8156['push'](_0x4b8156['shift']());}};_0x4a819c(++_0x437af2);}(_0xe864,0x14b));var _0x4e86=function(_0x5fb82b,_0x537519){_0x5fb82b=_0x5fb82b-0x0;var _0x5c6805=_0xe864[_0x5fb82b];return _0x5c6805;};'use strict';var util=require(_0x4e86('0x0'));var _=require(_0x4e86('0x1'));var EventEmitter=require(_0x4e86('0x2'))[_0x4e86('0x3')];var AGIReply=require(_0x4e86('0x4'));var AGIError=require(_0x4e86('0x5'));function AGIChannel(_0x4ee8c6){var _0x234187=this,_0x2adf42=new AGIReply(),_0xe87690=![],_0x21b162={};EventEmitter[_0x4e86('0x6')](_0x234187);_0x4ee8c6[_0x4e86('0x7')]('utf8');_0x4ee8c6[_0x4e86('0x8')](0x8*0x3c*0x3c*0x3e8);_0x2adf42[_0x4e86('0x7')]('utf8');_0x2adf42['on'](_0x4e86('0x9'),function(_0x3d1cb5){for(var _0x4117e0 in _0x3d1cb5){_0x234187[_0x4117e0]=_0x3d1cb5[_0x4117e0];}_0x234187[_0x4e86('0xa')](_0x4e86('0xb'));});_0x2adf42['on'](_0x4e86('0xc'),function(_0x5e0b28){if(_0x5e0b28['toLowerCase']()==_0x4e86('0xd')){_0x234187['emit'](_0x4e86('0xd'));return;}if(_0x5e0b28[_0x4e86('0xe')](0x0,0xb)==_0x4e86('0xf')){_0xe87690=!![];}if(_0xe87690){_0x21b162['rx']+=_0x5e0b28+'\x0a';if(_0x5e0b28[_0x4e86('0x10')](_0x4e86('0x11'))!=-0x1){_0xe87690=![];}}else{_0x21b162['rx']=_0x5e0b28;}if(_0xe87690){return;}if(typeof _0x21b162['cb']==_0x4e86('0x12')){var _0x42e677=_0x21b162['rx']['substring'](0x0,0x3),_0x49a67b=null,_0x196f60=null;_0x42e677=parseInt(_0x42e677);if(isNaN(_0x42e677)){_0x21b162['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x42e677!=0xc8){_0x21b162['cb'](null,{'code':_0x42e677,'result':-0x1,'extra':'KO'});return;}_0x49a67b=_0x21b162['rx']['substring'](0x4)[_0x4e86('0x13')](_0x4e86('0x14'),'');if(_0x49a67b[_0x4e86('0x15')]('\x20')!=-0x1){_0x49a67b=_0x49a67b[_0x4e86('0x16')](0x0,_0x49a67b[_0x4e86('0x15')]('\x20'));}if(_[_0x4e86('0x17')](_0x49a67b,'-1')){_0x49a67b=parseInt(_0x49a67b);}_0x196f60=_0x21b162['rx'][_0x4e86('0x18')]('\x20');if(_0x196f60[_0x4e86('0x19')]==0x3){_0x196f60=_0x196f60[0x2][_0x4e86('0xe')](0x1,_0x196f60[0x2][_0x4e86('0x19')]-0x1);}else if(_0x196f60[_0x4e86('0x19')]>0x3){var _0x5185b5=/\((.+)\)/;var _0x5788b7=_0x21b162['rx']['match'](_0x5185b5);if(_0x5788b7){_0x196f60=_0x5788b7[0x1];}else{_0x196f60=null;}}else{_0x196f60=null;}_0x21b162['cb'](null,{'code':_0x42e677,'result':_0x49a67b,'extra':_0x196f60});}});_0x4ee8c6['on'](_0x4e86('0x1a'),function(_0x5abd95){_0x234187[_0x4e86('0xa')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x5abd95[_0x4e86('0x1b')]));});_0x4ee8c6['on']('close',function(){_0x234187[_0x4e86('0xa')](_0x4e86('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4ee8c6['on']('timeout',function(){_0x234187[_0x4e86('0xa')](_0x4e86('0x1d'),new AGIError(_0x4e86('0x1e')));_0x4ee8c6['destroy']();});_0x4ee8c6[_0x4e86('0x1f')](_0x2adf42);this['command']=function(_0x57c7c2,_0x30331b){var _0x57c7c2=_0x57c7c2||'',_0x30331b=typeof _0x30331b==_0x4e86('0x12')?_0x30331b:new Function();_0x21b162={'tx':_0x57c7c2,'rx':'','cb':_0x30331b};_0x4ee8c6[_0x4e86('0x20')](_0x57c7c2+'\x0a');},this['close']=function(){_0x4ee8c6[_0x4e86('0x21')]();};}util[_0x4e86('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x4e86('0x23')]['sendRequest']=function(_0x388cb7){return this[_0x4e86('0x24')][_0x4e86('0x25')](this,_0x388cb7);};AGIChannel[_0x4e86('0x23')][_0x4e86('0x26')]=function(){return this[_0x4e86('0x27')](_0x4e86('0x28'));};AGIChannel[_0x4e86('0x23')]['getData']=function(_0x1c167d,_0x47f1f1,_0x5e72e4){_0x1c167d=_0x1c167d===undefined?_0x4e86('0x29'):_0x1c167d;_0x47f1f1=_0x47f1f1===undefined?'5':_0x47f1f1;_0x5e72e4=_0x5e72e4===undefined?'1':_0x5e72e4;return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x2b'),_0x1c167d,_0x47f1f1*0x3e8,_0x5e72e4));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x2c')]=function(_0x4a5c7d){_0x4a5c7d=_0x4a5c7d||_0x4e86('0x2d');return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x2e'),_0x4a5c7d));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x2f')]=function(_0x8f2658,_0x559168){if(_[_0x4e86('0x30')](_0x559168)){return this[_0x4e86('0x27')](util['format'](_0x4e86('0x31'),_0x8f2658,_0x559168[_0x4e86('0x32')](',')));}return this[_0x4e86('0x27')](util['format'](_0x4e86('0x31'),_0x8f2658,_0x559168));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x33')]=function(_0x497bb2){return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x34'),_0x497bb2));};AGIChannel['prototype'][_0x4e86('0x35')]=function(_0x19b2ee){return this[_0x4e86('0x27')](util['format'](_0x4e86('0x36'),_0x19b2ee));};AGIChannel[_0x4e86('0x23')]['setPriority']=function(_0x26e41a){return this[_0x4e86('0x27')](util['format'](_0x4e86('0x37'),_0x26e41a));};AGIChannel[_0x4e86('0x23')][_0x4e86('0xd')]=function(){return this[_0x4e86('0x27')](_0x4e86('0x38'));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x39')]=function(_0x29b54a,_0x141580){var _0x2167d7=_[_0x4e86('0x3a')](_0x141580)||_[_0x4e86('0x3b')](_0x141580)?_0x141580['toString']():_0x141580;return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x3c'),_0x29b54a,_0x2167d7?_0x2167d7[_0x4e86('0x3d')]()[_0x4e86('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x3e')]=function(_0x11a7e3,_0x433b33){return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x3f'),_0x11a7e3,_0x433b33));};AGIChannel['prototype'][_0x4e86('0x40')]=function(_0x20ad14,_0x5c3c88){return this[_0x4e86('0x27')](util['format'](_0x4e86('0x41'),_0x20ad14,_0x5c3c88));};AGIChannel['prototype'][_0x4e86('0x42')]=function(_0x17fca6,_0x1a8847){return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x43'),_0x17fca6,_0x1a8847));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x44')]=function(_0x34d5d8,_0x17083a,_0x3760ff){_0x17083a=_0x17083a||this[_0x4e86('0x45')];_0x3760ff=_0x3760ff||0x1;this['setContext'](_0x34d5d8);this[_0x4e86('0x35')](_0x17083a);this[_0x4e86('0x46')](_0x3760ff);return this['noop'](util[_0x4e86('0x2a')](_0x4e86('0x47'),_0x34d5d8,_0x17083a,_0x3760ff));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x48')]=function(_0x8ddf7b){return this['sendRequest'](util[_0x4e86('0x2a')]('GET\x20VARIABLE\x20\x22%s\x22',_0x8ddf7b));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x49')]=function(_0x33492e,_0x4b39bb,_0x48907e,_0x140349,_0x36338e,_0x1529d1){_0x4b39bb=_0x4b39bb||_0x4e86('0x4a');_0x48907e=_0x48907e||'';_0x140349=_0x140349===undefined?-0x1:_0x140349==='-1'?-0x1:_0x140349*0x3e8;_0x36338e=_0x36338e===undefined?'':'s='+_0x36338e;_0x1529d1=_0x1529d1?'BEEP':'';return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x4b'),_0x33492e,_0x4b39bb,_0x48907e,_0x140349,_0x1529d1,_0x36338e));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x4c')]=function(_0x57cade,_0x3a2e65){_0x3a2e65=_0x3a2e65||'';return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x4d'),_0x57cade,_0x3a2e65));};AGIChannel['prototype'][_0x4e86('0x4e')]=function(_0xde98a8){return this['exec'](_0x4e86('0x4f'),_0xde98a8);};AGIChannel[_0x4e86('0x23')][_0x4e86('0x50')]=function(_0x5a592e){return this[_0x4e86('0x2f')](_0x4e86('0x51'),_0x5a592e);};AGIChannel[_0x4e86('0x23')][_0x4e86('0x1a')]=function(_0x4436bf,_0x512ada){this['noop'](util[_0x4e86('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x4436bf['id'],_0x4436bf[_0x4e86('0x52')],_0x512ada));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4e86('0x53')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 1b9c7b4..292a549 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 _0xa86f=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Undefined\x20error.'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0xa86f,0x13e));var _0xfa86=function(_0x36ce6b,_0x1e97a2){_0x36ce6b=_0x36ce6b-0x0;var _0x2d1380=_0xa86f[_0x36ce6b];return _0x2d1380;};'use strict';var util=require(_0xfa86('0x0'));var error={'E_AGI_UNDEFINED':_0xfa86('0x1'),'E_AGI_ARGUMENT_PORT':_0xfa86('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xfa86('0x3'),'E_AGI_SOCKET_ERROR':_0xfa86('0x4'),'E_AGI_SOCKET_CLOSE':_0xfa86('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xfa86('0x6'),'E_AGI_COMMAND_EMPTY':_0xfa86('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xfa86('0x8'),'E_AGI_IVR_ENTRY':_0xfa86('0x9')};function AGIError(_0x6225b9){var _0x6225b9=_0x6225b9||null,_0x4eb841=_0x4eb841||[],_0x712b6b=0x1,_0x16bb29='';if(!error[_0x6225b9]){_0x6225b9=_0xfa86('0xa');}_0x4eb841[_0xfa86('0xb')](error[_0x6225b9]);while(arguments[_0x712b6b]){_0x4eb841['push'](arguments[_0x712b6b]);_0x712b6b++;}_0x16bb29=util[_0xfa86('0xc')][_0xfa86('0xd')](util,_0x4eb841);this[_0xfa86('0xe')]=_0x16bb29;this['name']=_0x6225b9;}module[_0xfa86('0xf')]=AGIError; \ No newline at end of file +var _0x622e=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util'];(function(_0x530e56,_0x4646e1){var _0x4ff308=function(_0x10aaa8){while(--_0x10aaa8){_0x530e56['push'](_0x530e56['shift']());}};_0x4ff308(++_0x4646e1);}(_0x622e,0x179));var _0xe622=function(_0xc88e0e,_0x130618){_0xc88e0e=_0xc88e0e-0x0;var _0xd89aa8=_0x622e[_0xc88e0e];return _0xd89aa8;};'use strict';var util=require(_0xe622('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xe622('0x1'),'E_AGI_SERVER_ERROR':_0xe622('0x2'),'E_AGI_SERVER_CLOSE':_0xe622('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xe622('0x4'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xe622('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xe622('0x6')};function AGIError(_0x2bf0bd){var _0x2bf0bd=_0x2bf0bd||null,_0x5ccab1=_0x5ccab1||[],_0x19cab0=0x1,_0x42c821='';if(!error[_0x2bf0bd]){_0x2bf0bd=_0xe622('0x7');}_0x5ccab1[_0xe622('0x8')](error[_0x2bf0bd]);while(arguments[_0x19cab0]){_0x5ccab1[_0xe622('0x8')](arguments[_0x19cab0]);_0x19cab0++;}_0x42c821=util[_0xe622('0x9')][_0xe622('0xa')](util,_0x5ccab1);this[_0xe622('0xb')]=_0x42c821;this[_0xe622('0xc')]=_0x2bf0bd;}module[_0xe622('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index a82b2e6..5feae10 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 _0xaa04=['../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','parse','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa04,0x18a));var _0x4aa0=function(_0x177b53,_0x2a5566){_0x177b53=_0x177b53-0x0;var _0x26da5a=_0xaa04[_0x177b53];return _0x26da5a;};'use strict';var _=require('lodash');var EventEmitter=require(_0x4aa0('0x0'))[_0x4aa0('0x1')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x4aa0('0x2'));config[_0x4aa0('0x3')]=_[_0x4aa0('0x4')](config['redis'],{'host':_0x4aa0('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x4aa0('0x3')]);sub[_0x4aa0('0x6')](_0x4aa0('0x7'),function(_0x24b620){if(_0x24b620)return eventEmitter[_0x4aa0('0x8')](_0x4aa0('0x9'),new AGIError(_0x4aa0('0xa'),_0x24b620));});sub['on']('message',function(_0x4bffb5,_0x10b8dd){if(_0x4bffb5!==_0x4aa0('0x7'))return;try{var _0x344c61=JSON[_0x4aa0('0xb')](_0x10b8dd);eventEmitter['emit']('projectUpdate',_0x344c61);}catch(_0x556bca){eventEmitter[_0x4aa0('0x8')](_0x4aa0('0x9'),new AGIError(_0x4aa0('0xa'),_0x556bca));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x3360=['emit','E_AGI_SERVER_ERROR','message','error','exports','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi'];(function(_0x5e465a,_0x3e0f32){var _0x52c7db=function(_0x2c9dea){while(--_0x2c9dea){_0x5e465a['push'](_0x5e465a['shift']());}};_0x52c7db(++_0x3e0f32);}(_0x3360,0x1a9));var _0x0336=function(_0x417662,_0x48698c){_0x417662=_0x417662-0x0;var _0x287ce5=_0x3360[_0x417662];return _0x287ce5;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x0336('0x0')];var Redis=require(_0x0336('0x1'));var AGIError=require(_0x0336('0x2'));var config=require(_0x0336('0x3'));config[_0x0336('0x4')]=_[_0x0336('0x5')](config['redis'],{'host':_0x0336('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x0336('0x7')](_0x0336('0x8'),function(_0x4360e7){if(_0x4360e7)return eventEmitter[_0x0336('0x9')]('error',new AGIError(_0x0336('0xa'),_0x4360e7));});sub['on'](_0x0336('0xb'),function(_0x588ae3,_0xefa8a7){if(_0x588ae3!==_0x0336('0x8'))return;try{var _0x59222c=JSON['parse'](_0xefa8a7);eventEmitter[_0x0336('0x9')]('projectUpdate',_0x59222c);}catch(_0x302ef7){eventEmitter[_0x0336('0x9')](_0x0336('0xc'),new AGIError(_0x0336('0xa'),_0x302ef7));}});module[_0x0336('0xd')]={'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 953d4b9..848a6bf 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 _0x3f81=['relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','lodash','agi','menu','getdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push','size'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x3f81,0x1a7));var _0x13f8=function(_0x44096a,_0x37f002){_0x44096a=_0x44096a-0x0;var _0x5c538a=_0x3f81[_0x44096a];return _0x5c538a;};'use strict';var _=require(_0x13f8('0x0'));var logger=require('../../../config/logger')(_0x13f8('0x1'));var verticesWithRetry=[_0x13f8('0x2'),_0x13f8('0x3'),'getsecretdigits'];var Graph=function(){this[_0x13f8('0x4')]={};this['edges']={};this[_0x13f8('0x5')]=0x0;};Graph[_0x13f8('0x6')][_0x13f8('0x7')]=function(_0x391c86){this[_0x13f8('0x4')][_0x391c86['id']]=_0x391c86;this[_0x13f8('0x8')][_0x391c86['id']]=[];};Graph['prototype'][_0x13f8('0x9')]=function(_0x290f85,_0x3faa4f,_0x20d150){this[_0x13f8('0x8')][_0x290f85][_0x13f8('0xa')]({'target':_0x3faa4f,'condition':_0x20d150});this['numberOfEdges']+=0x1;};Graph['prototype']['size']=function(){return _[_0x13f8('0xb')](this[_0x13f8('0x4')]);};Graph[_0x13f8('0x6')][_0x13f8('0xc')]=function(){return this['numberOfEdges'];};Graph[_0x13f8('0x6')][_0x13f8('0xd')]=function(_0x1db2c7){return this['vertices'][_0x1db2c7];};Graph[_0x13f8('0x6')][_0x13f8('0xe')]=function(_0x453153,_0x487d95){if(!this['vertices'][_0x453153]){return logger[_0x13f8('0xf')](_0x13f8('0x10'));}var _0x67cb87=_0x487d95(this[_0x13f8('0x4')][_0x453153]);if(!_0x67cb87){return logger['info']('stop\x20traverse');}if(this[_0x13f8('0x8')][_0x453153][_0x13f8('0x11')]===0x0){return logger['info']('no\x20edge/s\x20available');}for(var _0x5ede1c=0x0,_0x30af54=[],_0x353212=![];_0x5ede1c\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','arg_1','callerid','evtHangup','then','catch','hasOwnProperty','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening'];(function(_0x35245b,_0x35b417){var _0x5d09cf=function(_0x2848f0){while(--_0x2848f0){_0x35245b['push'](_0x35245b['shift']());}};_0x5d09cf(++_0x35b417);}(_0x902f,0x115));var _0xf902=function(_0x5c5be9,_0x2b1d64){_0x5c5be9=_0x5c5be9-0x0;var _0x40e8a4=_0x902f[_0x5c5be9];return _0x40e8a4;};'use strict';var _=require(_0xf902('0x0'));var syncho=require('syncho');var util=require(_0xf902('0x1'));var config=require(_0xf902('0x2'));var logger=require(_0xf902('0x3'))('agi');var utilLicense=require(_0xf902('0x4'));var rpc=require(_0xf902('0x5'));var Project=require(_0xf902('0x6'));var AGIEmitter=require('./events')[_0xf902('0x7')];var projects=[];config[_0xf902('0x8')]=_[_0xf902('0x9')](config['agi'],{'ip':_0xf902('0xa'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x541d7b){process[_0xf902('0xb')](function(){syncho(function(){try{setChannelVariables(_0x541d7b);agiHandler(_0x541d7b);}catch(_0xf918b3){logger[_0xf902('0xc')](_0xf918b3[_0xf902('0xd')]);}});});}function projectUpdateHandler(_0x3031ee){try{var _0x527743=_[_0xf902('0xe')](projects,['id',_0x3031ee['id']]);if(_0x527743>-0x1){if(_0x3031ee['deleted']===!![]){projects['splice'](_0x527743,0x1);}else{projects[_0x527743]=_0x3031ee;}}else{projects[_0xf902('0xf')](_0x3031ee);}}catch(_0x529886){logger[_0xf902('0xc')](_0x529886[_0xf902('0xd')]);}}function listeningHandler(){console[_0xf902('0x10')](_0xf902('0x11'),config['agi'][_0xf902('0x12')]);logger[_0xf902('0x13')](util[_0xf902('0x14')](_0xf902('0x15'),config[_0xf902('0x8')]['ip'],config[_0xf902('0x8')][_0xf902('0x12')]));}function errorHandler(_0x357d8e){if(_0x357d8e&&_0x357d8e['name']&&_0x357d8e[_0xf902('0x16')]){logger['error'](util[_0xf902('0x14')](_0xf902('0x17'),_0x357d8e['name'],_0x357d8e[_0xf902('0x16')]));}else{logger[_0xf902('0xc')](util['format']('[ERROR]\x20%s',_0x357d8e['stack']));}}function closeHandler(){logger[_0xf902('0x13')](util['format'](_0xf902('0x18'),this['arg_1'],this['calleridname'],this['callerid'],this[_0xf902('0x19')],this[_0xf902('0x1a')]));try{createSquareReport(this);}catch(_0x2a04de){logger[_0xf902('0xc')](_0x2a04de[_0xf902('0xd')]);}}function timeoutHandler(){logger[_0xf902('0x13')](util[_0xf902('0x14')](_0xf902('0x1b'),this['arg_1'],this[_0xf902('0x1c')],this['callerid'],this[_0xf902('0x19')],this[_0xf902('0x1a')]));}function hangupHandler(){logger[_0xf902('0x13')](util[_0xf902('0x14')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xf902('0x1d')],this[_0xf902('0x1c')],this[_0xf902('0x1e')],this['dnid'],this[_0xf902('0x1a')]));this[_0xf902('0x1f')]=!![];}function createSquareReport(_0x1a7d8a,_0x157109){rpc['createSquareReport'](_0x1a7d8a)[_0xf902('0x20')](function(_0x2e1df2){if(_0x157109){_0x157109(null,_0x2e1df2);}})[_0xf902('0x21')](function(_0x47bfef){if(_0x157109){_0x157109(null,_0x47bfef);}});}function setChannelVariables(_0x2271d2){for(var _0x28b652 in _0x2271d2){if(_0x2271d2[_0xf902('0x22')](_0x28b652)){if(_0x28b652['indexOf']('agi_')===0x0){_0x2271d2[_0x28b652['substring'](0x4)]=_0x2271d2[_0x28b652];delete _0x2271d2[_0x28b652];}}}}function agiHandler(_0x11f02c){logger['debug'](_0xf902('0x23'),JSON[_0xf902('0x24')](_0x11f02c,null,0x2));logger['info'](util[_0xf902('0x14')](_0xf902('0x25'),_0x11f02c[_0xf902('0x1d')],_0x11f02c[_0xf902('0x1c')],_0x11f02c['callerid'],_0x11f02c[_0xf902('0x19')],_0x11f02c[_0xf902('0x1a')]));_0x11f02c['on'](_0xf902('0xc'),errorHandler);_0x11f02c['on']('close',closeHandler);_0x11f02c['on'](_0xf902('0x26'),timeoutHandler);_0x11f02c[_0xf902('0x1f')]=![];_0x11f02c['on']('hangup',hangupHandler);var _0x5b3f65=_[_0xf902('0x27')](projects,['name',_0x11f02c[_0xf902('0x1d')]]);if(!_0x5b3f65)return Project[_0xf902('0x28')](_0x11f02c);if(!_0x5b3f65[_0xf902('0x29')])return Project['handleUnpublished'](_0x11f02c);return Project[_0xf902('0x2a')](_0x5b3f65,_0x11f02c);}function main(){var _0x32a6de;return utilLicense[_0xf902('0x2b')]()['then'](function(_0x4045ad){if(!_0x4045ad)return;if(_0x4045ad[_0xf902('0x2c')]){if(_0x4045ad[_0xf902('0x2d')]&&_0x4045ad[_0xf902('0x2d')]>0x0){logger[_0xf902('0x13')](util[_0xf902('0x14')](_0xf902('0x2e'),_0x4045ad[_0xf902('0x2d')]));_0x32a6de=_0x4045ad[_0xf902('0x2d')];}else{logger['info'](_0xf902('0x2f'));}}else{logger[_0xf902('0x13')](_0xf902('0x30'));_0x32a6de=-0x1;}})[_0xf902('0x20')](function(){return Project[_0xf902('0x31')]();})['then'](function(_0x25eb6d){projects=_0x25eb6d;return;})[_0xf902('0x21')](function(_0x51bda5){logger[_0xf902('0xc')]('[LICENSE]',_0x51bda5['stack']);})[_0xf902('0x32')](function(){var _0x1c1ba0=require(_0xf902('0x33'))(config[_0xf902('0x8')]['port'],config[_0xf902('0x8')]['ip'],_0x32a6de);_0x1c1ba0['on'](_0xf902('0xc'),errorHandler);_0x1c1ba0['on'](_0xf902('0x34'),listeningHandler);_0x1c1ba0['on'](_0xf902('0x35'),connectionHandler);_0x1c1ba0['on'](_0xf902('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0x9ff4=['projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','[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','callerid','dnid','uniqueid','[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','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','util','../../config/logger','agi','./rpc','./project','EventEmitter','defaults'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x9ff4,0x1ef));var _0x49ff=function(_0x2fb9b6,_0x5412d0){_0x2fb9b6=_0x2fb9b6-0x0;var _0x3b676a=_0x9ff4[_0x2fb9b6];return _0x3b676a;};'use strict';var _=require(_0x49ff('0x0'));var syncho=require(_0x49ff('0x1'));var util=require(_0x49ff('0x2'));var config=require('../../config/environment');var logger=require(_0x49ff('0x3'))(_0x49ff('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x49ff('0x5'));var Project=require(_0x49ff('0x6'));var AGIEmitter=require('./events')[_0x49ff('0x7')];var projects=[];config['agi']=_[_0x49ff('0x8')](config[_0x49ff('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x49ff('0x9'),projectUpdateHandler);function connectionHandler(_0x19cb72){process[_0x49ff('0xa')](function(){syncho(function(){try{setChannelVariables(_0x19cb72);agiHandler(_0x19cb72);}catch(_0x4990db){logger[_0x49ff('0xb')](_0x4990db[_0x49ff('0xc')]);}});});}function projectUpdateHandler(_0x1da294){try{var _0xe7f8b8=_[_0x49ff('0xd')](projects,['id',_0x1da294['id']]);if(_0xe7f8b8>-0x1){if(_0x1da294[_0x49ff('0xe')]===!![]){projects[_0x49ff('0xf')](_0xe7f8b8,0x1);}else{projects[_0xe7f8b8]=_0x1da294;}}else{projects[_0x49ff('0x10')](_0x1da294);}}catch(_0x505cce){logger[_0x49ff('0xb')](_0x505cce[_0x49ff('0xc')]);}}function listeningHandler(){console[_0x49ff('0x11')](_0x49ff('0x12'),config[_0x49ff('0x4')]['port']);logger['info'](util[_0x49ff('0x13')](_0x49ff('0x14'),config[_0x49ff('0x4')]['ip'],config[_0x49ff('0x4')][_0x49ff('0x15')]));}function errorHandler(_0x17292f){if(_0x17292f&&_0x17292f[_0x49ff('0x16')]&&_0x17292f[_0x49ff('0x17')]){logger[_0x49ff('0xb')](util['format'](_0x49ff('0x18'),_0x17292f[_0x49ff('0x16')],_0x17292f['message']));}else{logger[_0x49ff('0xb')](util[_0x49ff('0x13')](_0x49ff('0x19'),_0x17292f[_0x49ff('0xc')]));}}function closeHandler(){logger[_0x49ff('0x1a')](util[_0x49ff('0x13')](_0x49ff('0x1b'),this[_0x49ff('0x1c')],this[_0x49ff('0x1d')],this[_0x49ff('0x1e')],this[_0x49ff('0x1f')],this[_0x49ff('0x20')]));try{createSquareReport(this);}catch(_0x2217d7){logger[_0x49ff('0xb')](_0x2217d7[_0x49ff('0xc')]);}}function timeoutHandler(){logger[_0x49ff('0x1a')](util['format'](_0x49ff('0x21'),this[_0x49ff('0x1c')],this[_0x49ff('0x1d')],this[_0x49ff('0x1e')],this[_0x49ff('0x1f')],this[_0x49ff('0x20')]));}function hangupHandler(){logger[_0x49ff('0x1a')](util[_0x49ff('0x13')](_0x49ff('0x22'),this[_0x49ff('0x1c')],this[_0x49ff('0x1d')],this['callerid'],this['dnid'],this[_0x49ff('0x20')]));this[_0x49ff('0x23')]=!![];}function createSquareReport(_0x60bd72,_0x348d67){rpc[_0x49ff('0x24')](_0x60bd72)[_0x49ff('0x25')](function(_0x267e7a){if(_0x348d67){_0x348d67(null,_0x267e7a);}})[_0x49ff('0x26')](function(_0x4476fe){if(_0x348d67){_0x348d67(null,_0x4476fe);}});}function setChannelVariables(_0x4d7b27){for(var _0x19a905 in _0x4d7b27){if(_0x4d7b27[_0x49ff('0x27')](_0x19a905)){if(_0x19a905[_0x49ff('0x28')](_0x49ff('0x29'))===0x0){_0x4d7b27[_0x19a905[_0x49ff('0x2a')](0x4)]=_0x4d7b27[_0x19a905];delete _0x4d7b27[_0x19a905];}}}}function agiHandler(_0x16c712){logger[_0x49ff('0x2b')](_0x49ff('0x2c'),JSON[_0x49ff('0x2d')](_0x16c712,null,0x2));logger['info'](util[_0x49ff('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x16c712[_0x49ff('0x1c')],_0x16c712[_0x49ff('0x1d')],_0x16c712[_0x49ff('0x1e')],_0x16c712[_0x49ff('0x1f')],_0x16c712[_0x49ff('0x20')]));_0x16c712['on'](_0x49ff('0xb'),errorHandler);_0x16c712['on'](_0x49ff('0x2e'),closeHandler);_0x16c712['on'](_0x49ff('0x2f'),timeoutHandler);_0x16c712[_0x49ff('0x23')]=![];_0x16c712['on'](_0x49ff('0x30'),hangupHandler);var _0x1ef38a=_[_0x49ff('0x31')](projects,[_0x49ff('0x16'),_0x16c712[_0x49ff('0x1c')]]);if(!_0x1ef38a)return Project[_0x49ff('0x32')](_0x16c712);if(!_0x1ef38a[_0x49ff('0x33')])return Project[_0x49ff('0x34')](_0x16c712);return Project[_0x49ff('0x35')](_0x1ef38a,_0x16c712);}function main(){var _0x5e2099;return utilLicense[_0x49ff('0x36')]()['then'](function(_0x203f65){if(!_0x203f65)return;if(_0x203f65['voice']){if(_0x203f65[_0x49ff('0x37')]&&_0x203f65[_0x49ff('0x37')]>0x0){logger[_0x49ff('0x1a')](util[_0x49ff('0x13')](_0x49ff('0x38'),_0x203f65[_0x49ff('0x37')]));_0x5e2099=_0x203f65[_0x49ff('0x37')];}else{logger[_0x49ff('0x1a')](_0x49ff('0x39'));}}else{logger['info'](_0x49ff('0x3a'));_0x5e2099=-0x1;}})[_0x49ff('0x25')](function(){return Project['getAll']();})['then'](function(_0x438b8b){projects=_0x438b8b;return;})['catch'](function(_0x4bd3cd){logger[_0x49ff('0xb')](_0x49ff('0x3b'),_0x4bd3cd[_0x49ff('0xc')]);})['finally'](function(){var _0x47f623=require(_0x49ff('0x3c'))(config[_0x49ff('0x4')][_0x49ff('0x15')],config[_0x49ff('0x4')]['ip'],_0x5e2099);_0x47f623['on']('error',errorHandler);_0x47f623['on'](_0x49ff('0x3d'),listeningHandler);_0x47f623['on'](_0x49ff('0x3e'),connectionHandler);_0x47f623['on'](_0x49ff('0x2e'),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 5797fee..d165d67 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 _0xefbc=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result','catch'];(function(_0x1d95d2,_0x1cb02b){var _0x3b5373=function(_0x2f4922){while(--_0x2f4922){_0x1d95d2['push'](_0x1d95d2['shift']());}};_0x3b5373(++_0x1cb02b);}(_0xefbc,0x140));var _0xcefb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xefbc[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xcefb('0x0'));var jayson=require(_0xcefb('0x1'));var client=jayson[_0xcefb('0x2')][_0xcefb('0x3')]({'port':0x232b});function request(_0x17ebf2,_0x282dac){return new BPromise(function(_0x582bff,_0x3f03cd){return client[_0xcefb('0x4')](_0x17ebf2,_0x282dac)[_0xcefb('0x5')](function(_0x22703c){if(_0x22703c['error']){return _0x3f03cd(_0x22703c[_0xcefb('0x6')][_0xcefb('0x7')]);}else{return _0x582bff(_0x22703c[_0xcefb('0x8')]);}})[_0xcefb('0x9')](function(_0x595b46){return _0x3f03cd(_0x595b46);});});}exports['sendMailMessage']=function(_0x3605d2,_0x19c06a){return request(_0xcefb('0xa'),{'account':_0x3605d2,'message':_0x19c06a});}; \ No newline at end of file +var _0x5401=['SendMail','jayson/promise','client','request','then','error','message','catch','sendMailMessage'];(function(_0x27aede,_0x2eb391){var _0x41abb5=function(_0x5e895d){while(--_0x5e895d){_0x27aede['push'](_0x27aede['shift']());}};_0x41abb5(++_0x2eb391);}(_0x5401,0xf4));var _0x1540=function(_0x4f8909,_0x127885){_0x4f8909=_0x4f8909-0x0;var _0x8b66ef=_0x5401[_0x4f8909];return _0x8b66ef;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1540('0x0'));var client=jayson[_0x1540('0x1')]['http']({'port':0x232b});function request(_0x7564d7,_0x4fa7e8){return new BPromise(function(_0xc30b97,_0x397d6f){return client[_0x1540('0x2')](_0x7564d7,_0x4fa7e8)[_0x1540('0x3')](function(_0x32ed2b){if(_0x32ed2b[_0x1540('0x4')]){return _0x397d6f(_0x32ed2b[_0x1540('0x4')][_0x1540('0x5')]);}else{return _0xc30b97(_0x32ed2b['result']);}})[_0x1540('0x6')](function(_0x2ddb23){return _0x397d6f(_0x2ddb23);});});}exports[_0x1540('0x7')]=function(_0x2d8bec,_0x4f5450){return request(_0x1540('0x8'),{'account':_0x2d8bec,'message':_0x4f5450});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index cc5a599..7b19e21 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 _0xeb3f=['calleridname','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','catch','stack','agicommand','retry','maxRetry','hasOwnProperty','isArray','length','source','target','value','mxGraphModel','root','inspect','start','stringify','joinAt','omit','mxCell','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','debug','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','toString','error','agicommand\x20not\x20found','finally','traverseBFS','clear','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xeb3f,0x7d));var _0xfeb3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xeb3f[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xfeb3('0x0'));var moment=require('moment');var parser=require(_0xfeb3('0x1'));var util=require(_0xfeb3('0x2'));var logger=require(_0xfeb3('0x3'))(_0xfeb3('0x4'));var rpc=require(_0xfeb3('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0xfeb3('0x6'));var Vertices=require(_0xfeb3('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xfeb3('0x8')](function(_0xc74c3c){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0xc74c3c[_0xfeb3('0x9')]);return[];});}function addVertex(_0x3147b2,_0x3fa351,_0x9ee518){_0x3fa351[_0xfeb3('0xa')]=_0x9ee518;if(_0x3fa351['hasOwnProperty'](_0xfeb3('0xb'))){_0x3fa351[_0xfeb3('0xc')]=parseInt(_0x3fa351[_0xfeb3('0xb')],0xa);}_0x3147b2['addVertex'](_['omit'](_0x3fa351,'mxCell'));}function initGraph(_0x4b8dde,_0x1d2dd3){var _0x2b6684=new Graph();for(var _0x448bb4 in _0x4b8dde){if(_0x4b8dde[_0xfeb3('0xd')](_0x448bb4)){if(_[_0xfeb3('0xe')](_0x4b8dde[_0x448bb4])){for(var _0x3bc973=0x0;_0x3bc973<_0x4b8dde[_0x448bb4]['length'];_0x3bc973+=0x1){addVertex(_0x2b6684,_0x4b8dde[_0x448bb4][_0x3bc973],_0x448bb4);}}else{addVertex(_0x2b6684,_0x4b8dde[_0x448bb4],_0x448bb4);}}}for(var _0x4bbfcd=0x0;_0x4bbfcd<_0x1d2dd3[_0xfeb3('0xf')];_0x4bbfcd+=0x1){if(_0x1d2dd3[_0x4bbfcd][_0xfeb3('0x10')]&&_0x1d2dd3[_0x4bbfcd][_0xfeb3('0x11')]){_0x2b6684['addEdge'](_0x1d2dd3[_0x4bbfcd]['source'],_0x1d2dd3[_0x4bbfcd][_0xfeb3('0x11')],_0x1d2dd3[_0x4bbfcd][_0xfeb3('0x12')]);}}return _0x2b6684;}function getRoot(_0x5ec804){return parser['toJson'](_0x5ec804,{'object':!![]})[_0xfeb3('0x13')][_0xfeb3('0x14')];}function inspect(_0x5315f6){return util[_0xfeb3('0x15')](_0x5315f6,{'showHidden':![],'depth':null});}function initialize(_0x2340e5,_0x8dd88b){var _0xd46923=getRoot(_0x2340e5['production']);if(!_0xd46923||!_0xd46923[_0xfeb3('0x16')])return;var _0x1ce3d2,_0x53a97e,_0x27c4fe;logger['debug'](_0xfeb3('0x14'),JSON[_0xfeb3('0x17')](_0xd46923,null,0x2));_0x8dd88b[_0xfeb3('0x18')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1ce3d2=initGraph(_[_0xfeb3('0x19')](_0xd46923,_0xfeb3('0x1a')),_0xd46923[_0xfeb3('0x1a')]);_0x53a97e=new Vertices(_0x8dd88b,rpc,mailRpc);logger[_0xfeb3('0x1b')](util[_0xfeb3('0x1c')](_0xfeb3('0x1d'),_0x8dd88b[_0xfeb3('0x1e')],_0x8dd88b['calleridname'],_0x8dd88b[_0xfeb3('0x1f')],_0x8dd88b[_0xfeb3('0x20')],_0x8dd88b[_0xfeb3('0x21')]));_0x1ce3d2['traverseBFS'](_0xd46923[_0xfeb3('0x16')]['id'],function(_0x3f32a0){try{_0x3f32a0=_0x53a97e['clear'](_0x3f32a0);logger[_0xfeb3('0x22')]('vertex',JSON[_0xfeb3('0x17')](_0x3f32a0,null,0x2));if(_0x3f32a0['agicommand']===_0xfeb3('0x23')){logger['info'](_0xfeb3('0x24'));_0x8dd88b[_0xfeb3('0x25')]=_0x3f32a0[_0xfeb3('0x25')]||_0x8dd88b[_0xfeb3('0x25')];_0x8dd88b['extension']=_0x3f32a0[_0xfeb3('0x26')];_0x8dd88b[_0xfeb3('0x27')]=_0x3f32a0['priority']?_0x3f32a0['priority']-0x1:0x1;return null;}else if(_0x3f32a0&&_0x53a97e[_0x3f32a0['agicommand']]){_0x27c4fe=_0x53a97e[_0x3f32a0[_0xfeb3('0xa')]](_0x3f32a0);logger[_0xfeb3('0x1b')](_0xfeb3('0x28'),JSON['stringify'](_0x27c4fe,null,0x2));if(_0x27c4fe&&_0x27c4fe['code']===AGI_CODE_SUCCESS&&_0x27c4fe[_0xfeb3('0x29')]!==AGI_RESULT_ERROR&&!_0x8dd88b[_0xfeb3('0x2a')]){logger[_0xfeb3('0x22')](_0xfeb3('0x28'),inspect(_0x27c4fe));return _[_0xfeb3('0x2b')](_0x27c4fe['result'])?null:_0x27c4fe[_0xfeb3('0x29')][_0xfeb3('0x2c')]();}else{logger[_0xfeb3('0x2d')]('response',inspect(_0x27c4fe));return null;}}else{logger[_0xfeb3('0x2d')](_0xfeb3('0x2e'));return null;}}catch(_0x5109f4){logger[_0xfeb3('0x2d')](_0x5109f4[_0xfeb3('0x9')]);return null;}});if(_0xd46923[_0xfeb3('0x2f')]){logger[_0xfeb3('0x1b')](util[_0xfeb3('0x1c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x8dd88b['arg_1'],_0x8dd88b['calleridname'],_0x8dd88b['callerid'],_0x8dd88b[_0xfeb3('0x20')],_0x8dd88b[_0xfeb3('0x21')]));_0x1ce3d2[_0xfeb3('0x30')](_0xd46923[_0xfeb3('0x2f')]['id'],function(_0x3df254){try{_0x3df254=_0x53a97e[_0xfeb3('0x31')](_0x3df254);logger['debug'](_0xfeb3('0x32'),JSON[_0xfeb3('0x17')](_0x3df254,null,0x2));if(_0x3df254&&_0x53a97e[_0x3df254[_0xfeb3('0xa')]]){_0x27c4fe=_0x53a97e[_0x3df254[_0xfeb3('0xa')]](_0x3df254);if(_0x27c4fe){logger[_0xfeb3('0x22')]('response',inspect(_0x27c4fe));return _['isUndefined'](_0x27c4fe[_0xfeb3('0x29')])?null:_0x27c4fe[_0xfeb3('0x29')]['toString']();}else{logger['error'](_0xfeb3('0x28'),inspect(_0x27c4fe));return null;}}else{logger['error'](_0xfeb3('0x2e'));return null;}}catch(_0x227894){logger[_0xfeb3('0x2d')](_0x227894[_0xfeb3('0x9')]);return null;}});}logger['info'](util[_0xfeb3('0x1c')](_0xfeb3('0x33'),_0x8dd88b[_0xfeb3('0x1e')],_0x8dd88b[_0xfeb3('0x34')],_0x8dd88b['callerid'],_0x8dd88b['dnid'],_0x8dd88b[_0xfeb3('0x21')]));logger[_0xfeb3('0x1b')](util[_0xfeb3('0x1c')](_0xfeb3('0x35'),_0x8dd88b[_0xfeb3('0x25')],_0x8dd88b[_0xfeb3('0x26')],parseInt(_0x8dd88b[_0xfeb3('0x27')],0xa)+0x1));_0x8dd88b[_0xfeb3('0x36')](_0x8dd88b['context'],_0x8dd88b[_0xfeb3('0x26')],parseInt(_0x8dd88b['priority'],0xa)+0x1);_0x8dd88b[_0xfeb3('0x37')]();}function handleNotFound(_0x13eeab){logger[_0xfeb3('0x2d')](util[_0xfeb3('0x1c')](_0xfeb3('0x38'),_0x13eeab['arg_1']));_0x13eeab['continueAt'](_0x13eeab[_0xfeb3('0x25')],_0x13eeab['extension'],parseInt(_0x13eeab[_0xfeb3('0x27')],0xa)+0x1);_0x13eeab[_0xfeb3('0x37')]();}function handleUnpublished(_0x2f1347){logger[_0xfeb3('0x2d')](util[_0xfeb3('0x1c')](_0xfeb3('0x39'),_0x2f1347[_0xfeb3('0x1e')]));_0x2f1347[_0xfeb3('0x36')](_0x2f1347['context'],_0x2f1347['extension'],parseInt(_0x2f1347['priority'],0xa)+0x1);_0x2f1347[_0xfeb3('0x37')]();}module[_0xfeb3('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xdb0f=['addEdge','value','toJson','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','xml2json','util','agi','./rpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','omit','mxCell','isArray','length','source','target'];(function(_0x13c34d,_0x42434b){var _0x5b1a5b=function(_0x107576){while(--_0x107576){_0x13c34d['push'](_0x13c34d['shift']());}};_0x5b1a5b(++_0x42434b);}(_0xdb0f,0x191));var _0xfdb0=function(_0x319e1c,_0x3b4634){_0x319e1c=_0x319e1c-0x0;var _0x49c88d=_0xdb0f[_0x319e1c];return _0x49c88d;};'use strict';var _=require(_0xfdb0('0x0'));var moment=require('moment');var parser=require(_0xfdb0('0x1'));var util=require(_0xfdb0('0x2'));var logger=require('../../config/logger')(_0xfdb0('0x3'));var rpc=require(_0xfdb0('0x4'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0xfdb0('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xfdb0('0x6')]()[_0xfdb0('0x7')](function(_0x4ac025){logger[_0xfdb0('0x8')](_0xfdb0('0x9'),_0x4ac025['stack']);return[];});}function addVertex(_0x5829e2,_0x1c3755,_0x1419c0){_0x1c3755[_0xfdb0('0xa')]=_0x1419c0;if(_0x1c3755[_0xfdb0('0xb')]('retry')){_0x1c3755['maxRetry']=parseInt(_0x1c3755[_0xfdb0('0xc')],0xa);}_0x5829e2['addVertex'](_[_0xfdb0('0xd')](_0x1c3755,_0xfdb0('0xe')));}function initGraph(_0x48a114,_0x750e73){var _0x513dbb=new Graph();for(var _0x321bec in _0x48a114){if(_0x48a114['hasOwnProperty'](_0x321bec)){if(_[_0xfdb0('0xf')](_0x48a114[_0x321bec])){for(var _0x208d66=0x0;_0x208d66<_0x48a114[_0x321bec][_0xfdb0('0x10')];_0x208d66+=0x1){addVertex(_0x513dbb,_0x48a114[_0x321bec][_0x208d66],_0x321bec);}}else{addVertex(_0x513dbb,_0x48a114[_0x321bec],_0x321bec);}}}for(var _0x5a2303=0x0;_0x5a2303<_0x750e73['length'];_0x5a2303+=0x1){if(_0x750e73[_0x5a2303][_0xfdb0('0x11')]&&_0x750e73[_0x5a2303][_0xfdb0('0x12')]){_0x513dbb[_0xfdb0('0x13')](_0x750e73[_0x5a2303][_0xfdb0('0x11')],_0x750e73[_0x5a2303]['target'],_0x750e73[_0x5a2303][_0xfdb0('0x14')]);}}return _0x513dbb;}function getRoot(_0x6cba8d){return parser[_0xfdb0('0x15')](_0x6cba8d,{'object':!![]})['mxGraphModel'][_0xfdb0('0x16')];}function inspect(_0x577705){return util[_0xfdb0('0x17')](_0x577705,{'showHidden':![],'depth':null});}function initialize(_0x3db43d,_0x503e13){var _0x3ec9c6=getRoot(_0x3db43d[_0xfdb0('0x18')]);if(!_0x3ec9c6||!_0x3ec9c6[_0xfdb0('0x19')])return;var _0x3798c8,_0x195457,_0x8215f5;logger[_0xfdb0('0x1a')](_0xfdb0('0x16'),JSON[_0xfdb0('0x1b')](_0x3ec9c6,null,0x2));_0x503e13[_0xfdb0('0x1c')]=moment()[_0xfdb0('0x1d')](_0xfdb0('0x1e'));_0x3798c8=initGraph(_[_0xfdb0('0xd')](_0x3ec9c6,_0xfdb0('0xe')),_0x3ec9c6[_0xfdb0('0xe')]);_0x195457=new Vertices(_0x503e13,rpc,mailRpc);logger[_0xfdb0('0x1f')](util[_0xfdb0('0x1d')](_0xfdb0('0x20'),_0x503e13[_0xfdb0('0x21')],_0x503e13[_0xfdb0('0x22')],_0x503e13[_0xfdb0('0x23')],_0x503e13[_0xfdb0('0x24')],_0x503e13[_0xfdb0('0x25')]));_0x3798c8[_0xfdb0('0x26')](_0x3ec9c6[_0xfdb0('0x19')]['id'],function(_0x195daf){try{_0x195daf=_0x195457[_0xfdb0('0x27')](_0x195daf);logger[_0xfdb0('0x1a')]('vertex',JSON[_0xfdb0('0x1b')](_0x195daf,null,0x2));if(_0x195daf['agicommand']===_0xfdb0('0x28')){logger[_0xfdb0('0x1f')](_0xfdb0('0x29'));_0x503e13[_0xfdb0('0x2a')]=_0x195daf[_0xfdb0('0x2a')]||_0x503e13['context'];_0x503e13[_0xfdb0('0x2b')]=_0x195daf[_0xfdb0('0x2b')];_0x503e13[_0xfdb0('0x2c')]=_0x195daf[_0xfdb0('0x2c')]?_0x195daf[_0xfdb0('0x2c')]-0x1:0x1;return null;}else if(_0x195daf&&_0x195457[_0x195daf[_0xfdb0('0xa')]]){_0x8215f5=_0x195457[_0x195daf['agicommand']](_0x195daf);logger[_0xfdb0('0x1f')](_0xfdb0('0x2d'),JSON[_0xfdb0('0x1b')](_0x8215f5,null,0x2));if(_0x8215f5&&_0x8215f5[_0xfdb0('0x2e')]===AGI_CODE_SUCCESS&&_0x8215f5[_0xfdb0('0x2f')]!==AGI_RESULT_ERROR&&!_0x503e13[_0xfdb0('0x30')]){logger[_0xfdb0('0x1a')](_0xfdb0('0x2d'),inspect(_0x8215f5));return _[_0xfdb0('0x31')](_0x8215f5[_0xfdb0('0x2f')])?null:_0x8215f5[_0xfdb0('0x2f')][_0xfdb0('0x32')]();}else{logger['error'](_0xfdb0('0x2d'),inspect(_0x8215f5));return null;}}else{logger[_0xfdb0('0x8')](_0xfdb0('0x33'));return null;}}catch(_0x2d184d){logger['error'](_0x2d184d[_0xfdb0('0x34')]);return null;}});if(_0x3ec9c6[_0xfdb0('0x35')]){logger['info'](util[_0xfdb0('0x1d')](_0xfdb0('0x36'),_0x503e13[_0xfdb0('0x21')],_0x503e13['calleridname'],_0x503e13['callerid'],_0x503e13[_0xfdb0('0x24')],_0x503e13[_0xfdb0('0x25')]));_0x3798c8[_0xfdb0('0x26')](_0x3ec9c6[_0xfdb0('0x35')]['id'],function(_0x51e368){try{_0x51e368=_0x195457['clear'](_0x51e368);logger[_0xfdb0('0x1a')](_0xfdb0('0x37'),JSON[_0xfdb0('0x1b')](_0x51e368,null,0x2));if(_0x51e368&&_0x195457[_0x51e368[_0xfdb0('0xa')]]){_0x8215f5=_0x195457[_0x51e368['agicommand']](_0x51e368);if(_0x8215f5){logger['debug'](_0xfdb0('0x2d'),inspect(_0x8215f5));return _['isUndefined'](_0x8215f5[_0xfdb0('0x2f')])?null:_0x8215f5['result']['toString']();}else{logger[_0xfdb0('0x8')](_0xfdb0('0x2d'),inspect(_0x8215f5));return null;}}else{logger[_0xfdb0('0x8')](_0xfdb0('0x33'));return null;}}catch(_0x3a3543){logger[_0xfdb0('0x8')](_0x3a3543[_0xfdb0('0x34')]);return null;}});}logger[_0xfdb0('0x1f')](util[_0xfdb0('0x1d')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x503e13[_0xfdb0('0x21')],_0x503e13[_0xfdb0('0x22')],_0x503e13[_0xfdb0('0x23')],_0x503e13[_0xfdb0('0x24')],_0x503e13['uniqueid']));logger[_0xfdb0('0x1f')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x503e13[_0xfdb0('0x2a')],_0x503e13[_0xfdb0('0x2b')],parseInt(_0x503e13[_0xfdb0('0x2c')],0xa)+0x1));_0x503e13[_0xfdb0('0x38')](_0x503e13[_0xfdb0('0x2a')],_0x503e13[_0xfdb0('0x2b')],parseInt(_0x503e13[_0xfdb0('0x2c')],0xa)+0x1);_0x503e13[_0xfdb0('0x39')]();}function handleNotFound(_0x64906f){logger[_0xfdb0('0x8')](util['format'](_0xfdb0('0x3a'),_0x64906f[_0xfdb0('0x21')]));_0x64906f[_0xfdb0('0x38')](_0x64906f[_0xfdb0('0x2a')],_0x64906f['extension'],parseInt(_0x64906f[_0xfdb0('0x2c')],0xa)+0x1);_0x64906f[_0xfdb0('0x39')]();}function handleUnpublished(_0x3c17e2){logger[_0xfdb0('0x8')](util[_0xfdb0('0x1d')]('Project\x20%s\x20not\x20published',_0x3c17e2[_0xfdb0('0x21')]));_0x3c17e2[_0xfdb0('0x38')](_0x3c17e2[_0xfdb0('0x2a')],_0x3c17e2['extension'],parseInt(_0x3c17e2[_0xfdb0('0x2c')],0xa)+0x1);_0x3c17e2[_0xfdb0('0x39')]();}module[_0xfdb0('0x3b')]={'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 203b090..9dae5b2 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 _0xa87e=['\x0d\x0a\x0d\x0a','toString','substring','length','indexOf','slice','trim','emit','headers','line','exports','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x481af3,_0x483fac){var _0x3354ea=function(_0x2e3de5){while(--_0x2e3de5){_0x481af3['push'](_0x481af3['shift']());}};_0x3354ea(++_0x483fac);}(_0xa87e,0x173));var _0xea87=function(_0x362145,_0x30c642){_0x362145=_0x362145-0x0;var _0x52a93f=_0xa87e[_0x362145];return _0x52a93f;};'use strict';var util=require('util');var Transform=require(_0xea87('0x0'))[_0xea87('0x1')];function AGIReply(_0x4522db){Transform['call'](this,_0x4522db);this[_0xea87('0x2')]='';this[_0xea87('0x3')]=![];}util[_0xea87('0x4')](AGIReply,Transform);AGIReply[_0xea87('0x5')][_0xea87('0x6')]=function(_0x58c432,_0x7c91df,_0x13c12b){var _0x586100='\x0a',_0x2f3c3a=['\x0a\x0a',_0xea87('0x7')],_0x1b566a=-0x1,_0x36352b=-0x1,_0xd0dd3b='',_0xa7d4f=0x0,_0x51ff78='',_0x257197='';this['_localBuffer']+=_0x58c432[_0xea87('0x8')]();_0x51ff78=this[_0xea87('0x2')];if(!this['_inBody']){_0xa7d4f=0x0;while(_0x2f3c3a[_0xa7d4f]){while((_0x36352b=_0x51ff78['indexOf'](_0x2f3c3a[_0xa7d4f]))!=-0x1){_0xd0dd3b=_0x2f3c3a[_0xa7d4f];_0x257197=_0x51ff78[_0xea87('0x9')](0x0,_0x36352b);_0x51ff78=_0x51ff78[_0xea87('0x9')](_0x36352b+_0xd0dd3b[_0xea87('0xa')]);var _0xaf397b=_0x257197['split'](_0x586100),_0x227fa0=0x0,_0x4c8d2d={},_0x4f8ee0='',_0x107001='',_0x2b33f8=-0x1;while(_0xaf397b[_0x227fa0]){_0x2b33f8=_0xaf397b[_0x227fa0][_0xea87('0xb')](':');if(_0x2b33f8!=-0x1){_0x4f8ee0=_0xaf397b[_0x227fa0][_0xea87('0xc')](0x0,_0x2b33f8)['trim']();_0x107001=_0xaf397b[_0x227fa0][_0xea87('0xc')](_0x2b33f8+0x1)[_0xea87('0xd')]();if(_0x4f8ee0[_0xea87('0xa')]>0x0){_0x4c8d2d[_0x4f8ee0]=_0x107001;}}else{}_0x227fa0++;}this[_0xea87('0xe')](_0xea87('0xf'),_0x4c8d2d);this[_0xea87('0x3')]=!![];}_0xa7d4f++;}this['_localBuffer']=_0x51ff78;}else{while((_0x1b566a=_0x51ff78[_0xea87('0xb')](_0x586100))!=-0x1){_0x257197=_0x51ff78[_0xea87('0x9')](0x0,_0x1b566a);this['emit'](_0xea87('0x10'),_0x257197);_0x51ff78=_0x51ff78[_0xea87('0x9')](_0x1b566a+_0x586100[_0xea87('0xa')]);}this[_0xea87('0x2')]=_0x51ff78;}_0x13c12b();};module[_0xea87('0x11')]=AGIReply; \ No newline at end of file +var _0x5025=['exports','util','stream','call','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','_inBody','indexOf','substring','length','split','slice','trim','emit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5025,0x177));var _0x5502=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x5025[_0x1dac7a];return _0x4cb363;};'use strict';var util=require(_0x5502('0x0'));var Transform=require(_0x5502('0x1'))['Transform'];function AGIReply(_0x3142fc){Transform[_0x5502('0x2')](this,_0x3142fc);this['_localBuffer']='';this['_inBody']=![];}util[_0x5502('0x3')](AGIReply,Transform);AGIReply[_0x5502('0x4')][_0x5502('0x5')]=function(_0x3aeead,_0x1909dd,_0x1b4c66){var _0xf2f00c='\x0a',_0x14663f=['\x0a\x0a',_0x5502('0x6')],_0x5a476b=-0x1,_0x43bdfc=-0x1,_0x4adc7a='',_0x504756=0x0,_0x29bf89='',_0x2a0f7f='';this[_0x5502('0x7')]+=_0x3aeead['toString']();_0x29bf89=this[_0x5502('0x7')];if(!this[_0x5502('0x8')]){_0x504756=0x0;while(_0x14663f[_0x504756]){while((_0x43bdfc=_0x29bf89[_0x5502('0x9')](_0x14663f[_0x504756]))!=-0x1){_0x4adc7a=_0x14663f[_0x504756];_0x2a0f7f=_0x29bf89['substring'](0x0,_0x43bdfc);_0x29bf89=_0x29bf89[_0x5502('0xa')](_0x43bdfc+_0x4adc7a[_0x5502('0xb')]);var _0x5d0261=_0x2a0f7f[_0x5502('0xc')](_0xf2f00c),_0x1dc31a=0x0,_0x5ebf28={},_0x2c4a92='',_0x27ab63='',_0xc13729=-0x1;while(_0x5d0261[_0x1dc31a]){_0xc13729=_0x5d0261[_0x1dc31a][_0x5502('0x9')](':');if(_0xc13729!=-0x1){_0x2c4a92=_0x5d0261[_0x1dc31a][_0x5502('0xd')](0x0,_0xc13729)['trim']();_0x27ab63=_0x5d0261[_0x1dc31a][_0x5502('0xd')](_0xc13729+0x1)[_0x5502('0xe')]();if(_0x2c4a92[_0x5502('0xb')]>0x0){_0x5ebf28[_0x2c4a92]=_0x27ab63;}}else{}_0x1dc31a++;}this['emit']('headers',_0x5ebf28);this['_inBody']=!![];}_0x504756++;}this[_0x5502('0x7')]=_0x29bf89;}else{while((_0x5a476b=_0x29bf89['indexOf'](_0xf2f00c))!=-0x1){_0x2a0f7f=_0x29bf89[_0x5502('0xa')](0x0,_0x5a476b);this[_0x5502('0xf')]('line',_0x2a0f7f);_0x29bf89=_0x29bf89[_0x5502('0xa')](_0x5a476b+_0xf2f00c[_0x5502('0xb')]);}this[_0x5502('0x7')]=_0x29bf89;}_0x1b4c66();};module[_0x5502('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 2013a2a..043741d 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 _0x9221=['email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','ShowSmsAccount','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','http','request','then','error','result','catch','GetSquareProjects','production','getSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','name'];(function(_0x46c01f,_0x40482d){var _0x34e590=function(_0x5ac4d1){while(--_0x5ac4d1){_0x46c01f['push'](_0x46c01f['shift']());}};_0x34e590(++_0x40482d);}(_0x9221,0x64));var _0x1922=function(_0x3a62c9,_0x4656c3){_0x3a62c9=_0x3a62c9-0x0;var _0x26f7b2=_0x9221[_0x3a62c9];return _0x26f7b2;};'use strict';var _=require('lodash');var moment=require(_0x1922('0x0'));var jayson=require(_0x1922('0x1'));var client=jayson['client'][_0x1922('0x2')]({'port':0x2329});function request(_0x1099ca,_0x5f14f2){return new Promise(function(_0x309b6b,_0x43c8a3){return client[_0x1922('0x3')](_0x1099ca,_0x5f14f2)[_0x1922('0x4')](function(_0x263f7f){if(_0x263f7f[_0x1922('0x5')]){return _0x43c8a3(_0x263f7f[_0x1922('0x5')]['message']);}else{return _0x309b6b(_0x263f7f[_0x1922('0x6')]);}})[_0x1922('0x7')](function(_0x195fa4){return _0x43c8a3(_0x195fa4);});});}exports['getSquareProjects']=function(){return request(_0x1922('0x8'),{'options':{'raw':![],'attributes':['id','name',_0x1922('0x9')]}});};exports[_0x1922('0xa')]=function(_0x1082d8){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x1082d8},'attributes':[_0x1922('0x9')]}});};exports[_0x1922('0xb')]=function(_0x5c488f){return request(_0x1922('0xc'),{'options':{'raw':![],'where':{'id':_0x5c488f},'include':[{'model':'MailServerOut','as':_0x1922('0xd'),'include':[{'model':'CloudProvider','as':_0x1922('0xe')}]}],'attributes':['id',_0x1922('0xf'),_0x1922('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x514b6d){return request(_0x1922('0x11'),{'options':{'where':{'id':_0x514b6d},'attributes':[_0x1922('0xf')]}});};exports[_0x1922('0x12')]=function(_0x3116dc){return request(_0x1922('0x13'),{'options':{'where':{'id':_0x3116dc},'attributes':['name']}});};exports[_0x1922('0x14')]=function(_0x4cb94e){return request(_0x1922('0x15'),{'options':{'where':{'id':_0x4cb94e},'attributes':[_0x1922('0xf')]}});};exports[_0x1922('0x16')]=function(_0x207ff4){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x207ff4},'attributes':[_0x1922('0x17')]}});};exports[_0x1922('0x18')]=function(_0x2c9ed9){return request('ShowUser',{'options':{'where':{'id':_0x2c9ed9},'attributes':['name']}});};exports[_0x1922('0x19')]=function(_0x51acda){return request(_0x1922('0x1a'),{'options':{'where':{'phone':_0x51acda[_0x1922('0x1b')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x4c60f8){return request(_0x1922('0x1c'),{'options':{'where':{'id':_0x4c60f8},'attributes':['name']}});};exports[_0x1922('0x1d')]=function(_0x199997){return request(_0x1922('0x1e'),{'options':{'where':{'id':_0x199997},'attributes':[_0x1922('0x1f')]}});};exports['getIntervalById']=function(_0x2f2c49){return request(_0x1922('0x20'),{'options':{'raw':![],'where':{'id':_0x2f2c49},'include':[{'model':_0x1922('0x21'),'as':_0x1922('0x22')}]}});};exports['getSmsAccountById']=function(_0xa5a368){return request(_0x1922('0x23'),{'options':{'where':{'id':_0xa5a368},'attributes':['id',_0x1922('0xf')]}});};exports['createSmsMessage']=function(_0x29b92f){return request('CreateSmsMessage',{'body':_0x29b92f});};exports['createSquareDetailsReport']=function(_0x82372b){return request(_0x1922('0x24'),{'body':_0x82372b});};exports[_0x1922('0x25')]=function(_0x17deb3){return request(_0x1922('0x26'),{'body':_[_0x1922('0x27')](_0x17deb3,{'project_name':_0x17deb3[_0x1922('0x28')],'prev_project_name':_0x17deb3[_0x1922('0x29')]||'','is_subproject':_0x17deb3[_0x1922('0x29')]?!![]:![],'leaveAt':moment()[_0x1922('0x2a')](_0x1922('0x2b'))})});};exports['createSquareRecording']=function(_0x3db249){return request('CreateSquareRecording',{'body':_0x3db249});};exports[_0x1922('0x2c')]=function(_0x43f56c){return request(_0x1922('0x2d'),{'body':_0x43f56c});};exports[_0x1922('0x2e')]=function(_0x1bb708){return request(_0x1922('0x2f'),{'options':{'raw':![],'where':{'phone':_0x1bb708[_0x1922('0x1b')],'ListId':_0x1bb708[_0x1922('0x30')]}}})[_0x1922('0x4')](function(_0x4b0799){if(_0x4b0799){return _0x4b0799;}return request(_0x1922('0x31'),{'body':_0x1bb708});});};exports[_0x1922('0x32')]=function(_0x353c71){return request(_0x1922('0x33'),{'options':{'where':{'id':_0x353c71},'attributes':[_0x1922('0xf')]}});};exports['agentLogin']=function(_0x10f398,_0x39d7d5){return request(_0x1922('0x34'),{'body':{'interface':_0x39d7d5},'options':{'where':_0x10f398}});};exports[_0x1922('0x35')]=function(_0x2a4215,_0x474e85,_0x17a45b){return request('PauseUser',{'body':{'type':_0x474e85,'uniqueid':_0x17a45b},'options':{'where':_0x2a4215}});};exports[_0x1922('0x36')]=function(_0x3f9435){return request(_0x1922('0x37'),{'body':{},'options':{'where':_0x3f9435}});};exports[_0x1922('0x38')]=function(_0x40234e){return request(_0x1922('0x39'),{'body':{},'options':{'where':_0x40234e}});}; \ No newline at end of file +var _0x177a=['getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','client','http','then','error','message','result','catch','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','getContactByPhone','GetContactByPhone','ShowTrunk','getSoundById','save_name','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','CreateSquareMessage','ShowCmHopper','phone'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x177a,0xdd));var _0xa177=function(_0x41bf9f,_0x248efc){_0x41bf9f=_0x41bf9f-0x0;var _0x5d519d=_0x177a[_0x41bf9f];return _0x5d519d;};'use strict';var _=require(_0xa177('0x0'));var moment=require('moment');var jayson=require('jayson/promise');var client=jayson[_0xa177('0x1')][_0xa177('0x2')]({'port':0x2329});function request(_0x5becaa,_0x42e769){return new Promise(function(_0x4275db,_0x471a81){return client['request'](_0x5becaa,_0x42e769)[_0xa177('0x3')](function(_0x3ef9d4){if(_0x3ef9d4[_0xa177('0x4')]){return _0x471a81(_0x3ef9d4[_0xa177('0x4')][_0xa177('0x5')]);}else{return _0x4275db(_0x3ef9d4[_0xa177('0x6')]);}})[_0xa177('0x7')](function(_0x11a535){return _0x471a81(_0x11a535);});});}exports['getSquareProjects']=function(){return request(_0xa177('0x8'),{'options':{'raw':![],'attributes':['id','name',_0xa177('0x9')]}});};exports[_0xa177('0xa')]=function(_0x4433d2){return request(_0xa177('0xb'),{'options':{'raw':![],'where':{'name':_0x4433d2},'attributes':[_0xa177('0x9')]}});};exports[_0xa177('0xc')]=function(_0x2d0ffe){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x2d0ffe},'include':[{'model':_0xa177('0xd'),'as':_0xa177('0xe'),'include':[{'model':_0xa177('0xf'),'as':_0xa177('0xf')}]}],'attributes':['id',_0xa177('0x10'),_0xa177('0x11')],'smtp':!![]}});};exports[_0xa177('0x12')]=function(_0x548bbf){return request('ShowSquareProject',{'options':{'where':{'id':_0x548bbf},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x13')]=function(_0x39d274){return request(_0xa177('0x14'),{'options':{'where':{'id':_0x39d274},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x15')]=function(_0x258985){return request(_0xa177('0x16'),{'options':{'where':{'id':_0x258985},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x17')]=function(_0x26be7a){return request(_0xa177('0x18'),{'options':{'where':{'id':_0x26be7a},'attributes':['dsn']}});};exports[_0xa177('0x19')]=function(_0x43fc77){return request('ShowUser',{'options':{'where':{'id':_0x43fc77},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x1a')]=function(_0x11b060){return request(_0xa177('0x1b'),{'options':{'where':{'phone':_0x11b060['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x516acf){return request(_0xa177('0x1c'),{'options':{'where':{'id':_0x516acf},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x1d')]=function(_0x2b0ad1){return request('ShowSound',{'options':{'where':{'id':_0x2b0ad1},'attributes':[_0xa177('0x1e')]}});};exports['getIntervalById']=function(_0x3b2fa6){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3b2fa6},'include':[{'model':_0xa177('0x1f'),'as':_0xa177('0x20')}]}});};exports[_0xa177('0x21')]=function(_0x279632){return request('ShowSmsAccount',{'options':{'where':{'id':_0x279632},'attributes':['id',_0xa177('0x10')]}});};exports[_0xa177('0x22')]=function(_0x1ad5da){return request('CreateSmsMessage',{'body':_0x1ad5da});};exports['createSquareDetailsReport']=function(_0x4e0159){return request('CreateSquareDetailsReport',{'body':_0x4e0159});};exports[_0xa177('0x23')]=function(_0x382a61){return request(_0xa177('0x24'),{'body':_[_0xa177('0x25')](_0x382a61,{'project_name':_0x382a61[_0xa177('0x26')],'prev_project_name':_0x382a61['arg_2']||'','is_subproject':_0x382a61[_0xa177('0x27')]?!![]:![],'leaveAt':moment()[_0xa177('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x182160){return request('CreateSquareRecording',{'body':_0x182160});};exports['createSquareMessage']=function(_0x59d40d){return request(_0xa177('0x29'),{'body':_0x59d40d});};exports['createCmContact']=function(_0x216cab){return request(_0xa177('0x2a'),{'options':{'raw':![],'where':{'phone':_0x216cab[_0xa177('0x2b')],'ListId':_0x216cab['ListId']}}})[_0xa177('0x3')](function(_0x1d0319){if(_0x1d0319){return _0x1d0319;}return request('CreateCmContact',{'body':_0x216cab});});};exports[_0xa177('0x2c')]=function(_0x1681b4){return request(_0xa177('0x2d'),{'options':{'where':{'id':_0x1681b4},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x2e')]=function(_0xe7a886,_0x435e56){return request(_0xa177('0x2f'),{'body':{'interface':_0x435e56},'options':{'where':_0xe7a886}});};exports['agentPause']=function(_0x384281,_0x40ca8f,_0x4c4ce4){return request(_0xa177('0x30'),{'body':{'type':_0x40ca8f,'uniqueid':_0x4c4ce4},'options':{'where':_0x384281}});};exports[_0xa177('0x31')]=function(_0x5e6f40){return request(_0xa177('0x32'),{'body':{},'options':{'where':_0x5e6f40}});};exports[_0xa177('0x33')]=function(_0x558c8c){return request(_0xa177('0x34'),{'body':{},'options':{'where':_0x558c8c}});}; \ 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 a5c1f82..5d9b7d2 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 _0xd819=['exports','./lex'];(function(_0x2905a6,_0x1d2ee0){var _0x436e0a=function(_0x4d04d3){while(--_0x4d04d3){_0x2905a6['push'](_0x2905a6['shift']());}};_0x436e0a(++_0x1d2ee0);}(_0xd819,0x181));var _0x9d81=function(_0x2fc5db,_0x2253b1){_0x2fc5db=_0x2fc5db-0x0;var _0x1ef11b=_0xd819[_0x2fc5db];return _0x1ef11b;};var polly=require('./polly');var lex=require(_0x9d81('0x0'));module[_0x9d81('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5bd7=['./lex','exports'];(function(_0x17091d,_0x13ed8d){var _0x3a8352=function(_0x2022f0){while(--_0x2022f0){_0x17091d['push'](_0x17091d['shift']());}};_0x3a8352(++_0x13ed8d);}(_0x5bd7,0x12a));var _0x75bd=function(_0x1d16b3,_0x198237){_0x1d16b3=_0x1d16b3-0x0;var _0x37e344=_0x5bd7[_0x1d16b3];return _0x37e344;};var polly=require('./polly');var lex=require(_0x75bd('0x0'));module[_0x75bd('0x1')]={'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 3adce63..7e8cfca 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 _0x9354=['exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9354,0x96));var _0x4935=function(_0x5e5568,_0x300d0d){_0x5e5568=_0x5e5568-0x0;var _0x557045=_0x9354[_0x5e5568];return _0x557045;};'use strict';var lex=require('./lib/api');module[_0x4935('0x0')]=function(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc){return lex(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc);}; \ No newline at end of file +var _0xb43b=['./lib/api','exports'];(function(_0x3f3c46,_0x33e972){var _0x7d1132=function(_0x2c7b56){while(--_0x2c7b56){_0x3f3c46['push'](_0x3f3c46['shift']());}};_0x7d1132(++_0x33e972);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4f7cd5,_0x41e771){_0x4f7cd5=_0x4f7cd5-0x0;var _0x12fb1f=_0xb43b[_0x4f7cd5];return _0x12fb1f;};'use strict';var lex=require(_0xbb43('0x0'));module[_0xbb43('0x1')]=function(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e){return lex(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e);}; \ 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 b47fc53..1d79d24 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(_0x2962dc,_0x3483ac){var _0x4a275d=function(_0x39cf0f){while(--_0x39cf0f){_0x2962dc['push'](_0x2962dc['shift']());}};_0x4a275d(++_0x3483ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x1e1eda,_0x1e10c2){var _0x162989=function(_0xe0ed7c){while(--_0xe0ed7c){_0x1e1eda['push'](_0x1e1eda['shift']());}};_0x162989(++_0x1e10c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 5f57f0b..222a994 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 _0xc0ee=['exports'];(function(_0x5b2832,_0x202b69){var _0x36a99c=function(_0x275a4f){while(--_0x275a4f){_0x5b2832['push'](_0x5b2832['shift']());}};_0x36a99c(++_0x202b69);}(_0xc0ee,0x1c0));var _0xec0e=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0xc0ee[_0x365be9];return _0x185c12;};'use strict';var polly=require('./lib/api');module[_0xec0e('0x0')]=function(_0x1393a7,_0x276e86,_0x11a850,_0x154aa5,_0x2456b1,_0x7db03d,_0x3afd7e){return polly(_0x1393a7,_0x276e86,_0x11a850,_0x154aa5,_0x2456b1,_0x7db03d,_0x3afd7e);}; \ No newline at end of file +var _0x4e5f=['exports','./lib/api'];(function(_0x2bbaf0,_0x3506b9){var _0x58572e=function(_0x2bc20a){while(--_0x2bc20a){_0x2bbaf0['push'](_0x2bbaf0['shift']());}};_0x58572e(++_0x3506b9);}(_0x4e5f,0x197));var _0xf4e5=function(_0x14444f,_0x1b5674){_0x14444f=_0x14444f-0x0;var _0x1e6eec=_0x4e5f[_0x14444f];return _0x1e6eec;};'use strict';var polly=require(_0xf4e5('0x0'));module[_0xf4e5('0x1')]=function(_0x14ca89,_0x2c65c6,_0x2d2e41,_0x2a4bc0,_0x515bce,_0x521b77,_0x4dd703){return polly(_0x14ca89,_0x2c65c6,_0x2d2e41,_0x2a4bc0,_0x515bce,_0x521b77,_0x4dd703);}; \ 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 7a81288..518bd5f 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 _0x11fc=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','aws-sdk','AudioStream'];(function(_0x5f2b6a,_0x1297ca){var _0x5cb22c=function(_0x5a1786){while(--_0x5a1786){_0x5f2b6a['push'](_0x5f2b6a['shift']());}};_0x5cb22c(++_0x1297ca);}(_0x11fc,0xed));var _0xc11f=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x11fc[_0x1d1779];return _0x2377e9;};'use strict';var fs=require('fs');var path=require(_0xc11f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0xc11f('0x1'));function pollyResult(_0x5cd15b,_0x35a787,_0x4f8c6d){return new BPromise(function(_0x52dea0,_0x1f8f17){_0x5cd15b['synthesizeSpeech'](_0x35a787,function(_0x4896a3,_0x4045bb){if(_0x4896a3){_0x1f8f17(_0x4896a3);}else if(_0x4045bb){if(_0x4045bb[_0xc11f('0x2')]instanceof Buffer){fs['writeFile'](_0x4f8c6d,_0x4045bb[_0xc11f('0x2')],function(_0x2e83cc){if(_0x2e83cc){_0x1f8f17(_0x2e83cc);}else{_0x52dea0();}});}else{_0x1f8f17(new Error(_0xc11f('0x3')));}}else{_0x1f8f17(new Error(_0xc11f('0x4')));}});});}module[_0xc11f('0x5')]=function(_0x5b7bbb,_0x49f731,_0x3aa599,_0x5a3a22,_0x5b956a,_0x3d6b28,_0xb27ad6){var _0x2edee6=new AWS[(_0xc11f('0x6'))]({'accessKeyId':_0x5b7bbb,'secretAccessKey':_0x49f731,'region':_0x3aa599});var _0x1e857d={'Text':_0x5b956a,'TextType':_0x3d6b28||_0xc11f('0x7'),'OutputFormat':'mp3','VoiceId':_0x5a3a22};return pollyResult(_0x2edee6,_0x1e857d,_0xb27ad6);}; \ No newline at end of file +var _0xc143=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0xc143,0x13a));var _0x3c14=function(_0x68c77,_0x3184da){_0x68c77=_0x68c77-0x0;var _0xaa1099=_0xc143[_0x68c77];return _0xaa1099;};'use strict';var fs=require('fs');var path=require(_0x3c14('0x0'));var BPromise=require(_0x3c14('0x1'));var rs=require('randomstring');var AWS=require(_0x3c14('0x2'));function pollyResult(_0x7b7ae6,_0x444104,_0x109de1){return new BPromise(function(_0x5989bf,_0x4a2629){_0x7b7ae6[_0x3c14('0x3')](_0x444104,function(_0x493e9e,_0x228ad7){if(_0x493e9e){_0x4a2629(_0x493e9e);}else if(_0x228ad7){if(_0x228ad7['AudioStream']instanceof Buffer){fs['writeFile'](_0x109de1,_0x228ad7[_0x3c14('0x4')],function(_0x1a9e21){if(_0x1a9e21){_0x4a2629(_0x1a9e21);}else{_0x5989bf();}});}else{_0x4a2629(new Error(_0x3c14('0x5')));}}else{_0x4a2629(new Error(_0x3c14('0x6')));}});});}module[_0x3c14('0x7')]=function(_0x409622,_0x14e992,_0x54e87c,_0x3d355c,_0x1742f8,_0x56d435,_0x1a1151){var _0x199707=new AWS['Polly']({'accessKeyId':_0x409622,'secretAccessKey':_0x14e992,'region':_0x54e87c});var _0x269edc={'Text':_0x1742f8,'TextType':_0x56d435||'text','OutputFormat':'mp3','VoiceId':_0x3d355c};return pollyResult(_0x199707,_0x269edc,_0x1a1151);}; \ 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 96d8ac4..fe44c0e 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 _0xc48f=['exports','./lib/api'];(function(_0x5daf58,_0x137f6e){var _0x489511=function(_0x397d7a){while(--_0x397d7a){_0x5daf58['push'](_0x5daf58['shift']());}};_0x489511(++_0x137f6e);}(_0xc48f,0xa9));var _0xfc48=function(_0x5c45a3,_0x59e28e){_0x5c45a3=_0x5c45a3-0x0;var _0x22e728=_0xc48f[_0x5c45a3];return _0x22e728;};'use strict';var asr=require(_0xfc48('0x0'));module[_0xfc48('0x1')]=function(_0x14e056,_0x3f503f,_0x4b5401,_0x49e108){return asr(_0x14e056,_0x3f503f,_0x4b5401);}; \ No newline at end of file +var _0x2dbd=['exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2dbd,0xe5));var _0xd2db=function(_0x4d8dee,_0x183089){_0x4d8dee=_0x4d8dee-0x0;var _0x4ab943=_0x2dbd[_0x4d8dee];return _0x4ab943;};'use strict';var asr=require('./lib/api');module[_0xd2db('0x0')]=function(_0x59095e,_0x345474,_0x7d88be,_0x3e1d34){return asr(_0x59095e,_0x345474,_0x7d88be);}; \ 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 250d526..e701e79 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 _0xd737=['8000','url','https://speech.googleapis.com','filepath\x20should\x20be\x20a\x20string','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64','/v1/speech:recognize?key='];(function(_0x41f8c2,_0x5bdcd6){var _0x19bfe9=function(_0xb11c16){while(--_0xb11c16){_0x41f8c2['push'](_0x41f8c2['shift']());}};_0x19bfe9(++_0x5bdcd6);}(_0xd737,0x85));var _0x7d73=function(_0x68359d,_0x51477f){_0x68359d=_0x68359d-0x0;var _0x15d875=_0xd737[_0x68359d];return _0x15d875;};'use strict';var url=require(_0x7d73('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x7d73('0x1');module['exports']=function(_0x1a6b12,_0x26854a,_0x2bd982){return new BPromise(function(_0x5cfa01,_0x5369be){var _0x3e19ad;if(typeof _0x1a6b12!=='string'||_0x1a6b12['length']===0x0){return _0x5369be(_0x7d73('0x2'));}if(typeof _0x26854a!==_0x7d73('0x3')||_0x26854a[_0x7d73('0x4')]===0x0){return _0x5369be(_0x7d73('0x5'));}if(typeof _0x2bd982!==_0x7d73('0x6')&&(typeof _0x2bd982!==_0x7d73('0x3')||_0x2bd982[_0x7d73('0x4')]===0x0)){return _0x5369be(_0x7d73('0x7'));}try{_0x3e19ad=fs['readFileSync'](_0x1a6b12)['toString'](_0x7d73('0x8'));}catch(_0x3252fc){return _0x5369be(_0x3252fc);}return _0x5cfa01({'method':'POST','uri':host+_0x7d73('0x9')+_0x26854a,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x7d73('0xa'),'languageCode':_0x2bd982},'audio':{'content':_0x3e19ad}},'json':!![]});});}; \ No newline at end of file +var _0xae79=['readFileSync','toString','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0xae79,0x1d3));var _0x9ae7=function(_0x24a71f,_0x4e9f35){_0x24a71f=_0x24a71f-0x0;var _0x362de3=_0xae79[_0x24a71f];return _0x362de3;};'use strict';var url=require(_0x9ae7('0x0'));var BPromise=require(_0x9ae7('0x1'));var fs=require('fs');var host=_0x9ae7('0x2');module[_0x9ae7('0x3')]=function(_0x1f75bc,_0x2cc556,_0x26b6a7){return new BPromise(function(_0x43f4d9,_0x988f5e){var _0x27817e;if(typeof _0x1f75bc!==_0x9ae7('0x4')||_0x1f75bc[_0x9ae7('0x5')]===0x0){return _0x988f5e(_0x9ae7('0x6'));}if(typeof _0x2cc556!==_0x9ae7('0x4')||_0x2cc556[_0x9ae7('0x5')]===0x0){return _0x988f5e('key\x20should\x20be\x20a\x20string');}if(typeof _0x26b6a7!==_0x9ae7('0x7')&&(typeof _0x26b6a7!==_0x9ae7('0x4')||_0x26b6a7[_0x9ae7('0x5')]===0x0)){return _0x988f5e(_0x9ae7('0x8'));}try{_0x27817e=fs[_0x9ae7('0x9')](_0x1f75bc)[_0x9ae7('0xa')]('base64');}catch(_0x410529){return _0x988f5e(_0x410529);}return _0x43f4d9({'method':'POST','uri':host+_0x9ae7('0xb')+_0x2cc556,'body':{'config':{'encoding':_0x9ae7('0xc'),'sampleRateHertz':_0x9ae7('0xd'),'languageCode':_0x26b6a7},'audio':{'content':_0x27817e}},'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 f1654c4..f6f2b84 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 _0xac45=['exports'];(function(_0x1c9e0d,_0x3fe7bb){var _0x5dbad7=function(_0x3c6cee){while(--_0x3c6cee){_0x1c9e0d['push'](_0x1c9e0d['shift']());}};_0x5dbad7(++_0x3fe7bb);}(_0xac45,0x186));var _0x5ac4=function(_0x4c966c,_0x314563){_0x4c966c=_0x4c966c-0x0;var _0x37ee3e=_0xac45[_0x4c966c];return _0x37ee3e;};var asr=require('./asr');module[_0x5ac4('0x0')]={'asr':asr}; \ No newline at end of file +var _0xaeae=['./asr','exports'];(function(_0x24b600,_0x12ac99){var _0x10c5d3=function(_0x26b752){while(--_0x26b752){_0x24b600['push'](_0x24b600['shift']());}};_0x10c5d3(++_0x12ac99);}(_0xaeae,0xfa));var _0xeaea=function(_0x3c3623,_0xfc48f3){_0x3c3623=_0x3c3623-0x0;var _0x42bfbe=_0xaeae[_0x3c3623];return _0x42bfbe;};var asr=require(_0xeaea('0x0'));module[_0xeaea('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 613905a..303e33e 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 _0xb32f=['parse\x20response\x20failed:\x0a','goggleTTS\x20path','asr','uri','results','map','alternatives','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','queryText','responseId','tildeASR','transcript','Tilde\x20ASR\x20confidence','awsPolly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','close','data','wav','error\x20convert','end','info','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','then','unlink','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','POST','resolve','.mp3','from','audioContent','base64','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','jQ1olc','stringify','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist'];(function(_0x130faf,_0x142193){var _0x2b86c8=function(_0x2046a2){while(--_0x2046a2){_0x130faf['push'](_0x130faf['shift']());}};_0x2b86c8(++_0x142193);}(_0xb32f,0xc3));var _0xfb32=function(_0x1eb771,_0xb3075b){_0x1eb771=_0x1eb771-0x0;var _0x1689f3=_0xb32f[_0x1eb771];return _0x1689f3;};'use strict';var apiai=require(_0xfb32('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xfb32('0x1'));var https=require(_0xfb32('0x2'));var md5=require('md5');var path=require(_0xfb32('0x3'));var querystring=require(_0xfb32('0x4'));var rp=require(_0xfb32('0x5'));var rs=require(_0xfb32('0x6'));var sox=require(_0xfb32('0x7'));var tts=require(_0xfb32('0x8'));var urlParse=require(_0xfb32('0x9'))[_0xfb32('0xa')];var util=require(_0xfb32('0xb'));var aws=require('./aws');var google=require(_0xfb32('0xc'));var sestek=require(_0xfb32('0xd'));var tilde=require(_0xfb32('0xe'));var logger=require(_0xfb32('0xf'))(_0xfb32('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x267166,_0x2bbdf5){return new BPromise(function(_0x39ef88,_0xe6bc99){var _0x3f33b7=urlParse(_0x267166);var _0x1010c1=_0x3f33b7[_0xfb32('0x11')]===_0xfb32('0x12')?https:http;var _0xff4b16={'host':_0x3f33b7[_0xfb32('0x13')],'path':_0x3f33b7[_0xfb32('0x3')],'headers':{'user-agent':_0xfb32('0x14')}};_0x1010c1[_0xfb32('0x15')](_0xff4b16,function(_0x503165){if(_0x503165[_0xfb32('0x16')]!==0xc8){logger[_0xfb32('0x17')](_0xfb32('0x18')+_0x267166+_0xfb32('0x19')+_0x503165[_0xfb32('0x16')]+'\x20('+_0x503165['statusMessage']+')');_0xe6bc99(new Error(_0xfb32('0x18')+_0x267166+_0xfb32('0x19')+_0x503165[_0xfb32('0x16')]+'\x20('+_0x503165[_0xfb32('0x1a')]+')'));return;}var _0x380c7e=fs[_0xfb32('0x1b')](_0x2bbdf5);_0x380c7e['on'](_0xfb32('0x1c'),function(){logger['info']('finish\x20download\x20file');_0x380c7e[_0xfb32('0x1d')](_0x39ef88);});_0x380c7e['on']('error',function(_0x2018ce){fs['unlink'](_0x2bbdf5);logger[_0xfb32('0x17')]('download\x20error',_0x2018ce);_0xe6bc99(_0x2018ce);});_0x503165['pipe'](_0x380c7e);})['on'](_0xfb32('0x17'),function(_0xf9880){logger[_0xfb32('0x17')](_0xf9880);_0xe6bc99(_0xf9880);})['end']();});}function uploadFile(_0x2f8bef){return new BPromise(function(_0x13de97,_0x52353a){var _0x30d9f1=urlParse(_0x2f8bef);var _0x2c3b99=_0x30d9f1[_0xfb32('0x11')]===_0xfb32('0x12')?https:http;var _0x265f5c={'host':_0x30d9f1['host'],'path':_0x30d9f1[_0xfb32('0x3')],'headers':{'user-agent':_0xfb32('0x14')}};_0x2c3b99[_0xfb32('0x15')](_0x265f5c,function(_0x5b4c5f){if(_0x5b4c5f[_0xfb32('0x16')]!==0xc8){_0x52353a(new Error('request\x20to\x20'+_0x2f8bef+_0xfb32('0x19')+_0x5b4c5f['statusCode']+'\x20('+_0x5b4c5f[_0xfb32('0x1a')]+')'));return;}var _0x397be2='';_0x5b4c5f['on'](_0xfb32('0x1e'),function(_0x4ecc79){_0x397be2+=_0x4ecc79;});_0x5b4c5f['on']('end',function(){_0x13de97(_0x397be2);});})['on'](_0xfb32('0x17'),function(_0x5604f7){_0x52353a(_0x5604f7);})['end']();});}function convertFile(_0x4b14c6,_0x3ce803){return new BPromise(function(_0x3eb622,_0x382b08){var _0x29ae94=sox['transcode'](_0x4b14c6,_0x3ce803,{'sampleRate':0x1f40,'format':_0xfb32('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x29ae94['on']('error',function(_0x4a0de6){logger['error'](_0xfb32('0x20'),_0x4a0de6);_0x382b08(_0x4a0de6);});_0x29ae94['on'](_0xfb32('0x21'),function(){logger[_0xfb32('0x22')](_0xfb32('0x23'));_0x3eb622();});_0x29ae94[_0xfb32('0x24')]();});}function base64Decode(_0x729553,_0x3218d4){var _0x4c799c=path['resolve'](__dirname,_0xfb32('0x25'),rs[_0xfb32('0x26')](0x4)+_0xfb32('0x27'));fs[_0xfb32('0x28')](_0x4c799c,_0x729553,'base64');return convertFile(_0x4c799c,_0x3218d4)[_0xfb32('0x29')](function(){try{fs[_0xfb32('0x2a')](_0x4c799c);fs[_0xfb32('0x2b')](_0x3218d4,_0xfb32('0x2c'));}catch(_0x3d947c){logger[_0xfb32('0x17')](_0x3d947c);}return _0x3218d4[_0xfb32('0x2d')]('.')[0x0];});}function base64Encode(_0x37843b){var _0x548173=fs['readFileSync'](_0x37843b);return new Buffer(_0x548173)[_0xfb32('0x2e')]('base64');}exports[_0xfb32('0x2f')]=function(_0x1dbc74,_0x5a8a03,_0x5508a4,_0x3d4c7a,_0x28cc83,_0x5d3a53){var _0x1a419e,_0x29f667;var _0x808983=_0xfb32('0x30');var _0x571c1d=_0xfb32('0x31')+_0x1dbc74;var _0x20891a={};if(_0x5a8a03===_0xfb32('0x32')){_0x20891a[_0xfb32('0x33')]={'ssml':_0x5508a4};}else{_0x20891a[_0xfb32('0x33')]={'text':_0x5508a4};};_0x20891a['voice']={'languageCode':_0x3d4c7a,'ssmlGender':_0x28cc83};_0x20891a['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x4a7bff={'url':_0x808983+'text:synthesize'+_0x571c1d,'method':_0xfb32('0x34'),'json':!![],'body':_0x20891a};return rp(_0x4a7bff)[_0xfb32('0x29')](function(_0x59fe53){return new BPromise(function(_0x3a05ae,_0x1436e4){_0x1a419e=path[_0xfb32('0x35')](__dirname,_0xfb32('0x25'),rs[_0xfb32('0x26')](0x4)+_0xfb32('0x36'));var _0x3dff02=Buffer[_0xfb32('0x37')](_0x59fe53[_0xfb32('0x38')],_0xfb32('0x39'));return fs[_0xfb32('0x3a')](_0x1a419e,_0x3dff02,function(_0x33b537){_0x1436e4(_0x33b537);},function(_0x1e6789){fs[_0xfb32('0x2b')](_0x1a419e,_0xfb32('0x2c'));_0x3a05ae(_0x1e6789);});});})['then'](function(_0xfb8017){_0x29f667=path['resolve'](__dirname,_0xfb32('0x25'),rs[_0xfb32('0x26')](0x4)+_0xfb32('0x27'));return convertFile(_0x1a419e,_0x29f667);})['then'](function(){try{fs['unlink'](_0x1a419e);fs[_0xfb32('0x2b')](_0x29f667,_0xfb32('0x2c'));}catch(_0x59224b){logger[_0xfb32('0x17')](_0x59224b);}logger[_0xfb32('0x22')](_0xfb32('0x3b'),_0x29f667[_0xfb32('0x2d')]('.')[0x0]);return _0x29f667[_0xfb32('0x2d')]('.')[0x0];});};exports[_0xfb32('0x3c')]=function(_0xa752ff,_0x33f06a){var _0x21a22d=_0xfb32('0x3d');var _0x39cb32,_0x45ebc1;var _0x21350b;var _0x210a07={'encoding':_0xfb32('0x3e'),'method':_0xfb32('0x34'),'timeout':0x2710,'url':_0x21a22d,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xfb32('0x3f')+encodeURIComponent(JSON['stringify']([[[_0xfb32('0x40'),JSON[_0xfb32('0x41')]([_0xa752ff,_0x33f06a||'en',![],_0xfb32('0x42')]),null,_0xfb32('0x43')]]]))};return rp(_0x210a07)[_0xfb32('0x29')](function(_0x24e0fe){try{_0x21350b=eval(_0x24e0fe[_0xfb32('0x44')](0x5))[0x0][0x2];}catch(_0x99ddce){throw new Error('parse\x20response\x20failed:\x0a'+_0x24e0fe[_0xfb32('0x1e')]);}if(!_0x21350b){if(_0xa752ff[_0xfb32('0x45')]>0xc8){throw new Error(_0xfb32('0x46'));}else{throw new Error(_0xfb32('0x47')+_0x33f06a+_0xfb32('0x48'));}}try{_0x21350b=eval(_0x21350b)[0x0];}catch(_0x1be910){throw new Error(_0xfb32('0x49')+res[_0xfb32('0x1e')]);}const _0x28977d=_0x21350b;_0x39cb32=path[_0xfb32('0x35')](__dirname,_0xfb32('0x25'),rs['generate'](0x4)+_0xfb32('0x36'));fs[_0xfb32('0x28')](_0x39cb32,_0x21350b,{'encoding':'base64'});_0x45ebc1=path['resolve'](__dirname,_0xfb32('0x25'),rs[_0xfb32('0x26')](0x4)+'.wav');return convertFile(_0x39cb32,_0x45ebc1);})[_0xfb32('0x29')](function(){try{fs[_0xfb32('0x2a')](_0x39cb32);fs[_0xfb32('0x2b')](_0x45ebc1,_0xfb32('0x2c'));}catch(_0x4745db){logger[_0xfb32('0x17')](_0x4745db);}logger[_0xfb32('0x22')](_0xfb32('0x4a'),_0x45ebc1[_0xfb32('0x2d')]('.')[0x0]);return _0x45ebc1['split']('.')[0x0];});};exports['googleASR']=function(_0x3ab9e5,_0x4e212c,_0x9e14c2){return google[_0xfb32('0x4b')](_0x3ab9e5,_0x4e212c,_0x9e14c2)['then'](function(_0x2e026b){logger[_0xfb32('0x22')](_0x2e026b[_0xfb32('0x4c')]);return rp(_0x2e026b);})[_0xfb32('0x29')](function(_0x7f7ca8){var _0x3fc371='';var _0x519e6c=0x0;try{fs['unlink'](_0x3ab9e5);}catch(_0x1cf907){logger[_0xfb32('0x17')](_0x1cf907);}if(_0x7f7ca8&&_0x7f7ca8[_0xfb32('0x4d')]){_0x3fc371=_0x7f7ca8['results'][_0xfb32('0x4e')](function(_0x4678f7){return _0x4678f7&&_0x4678f7[_0xfb32('0x4f')][0x0]&&_0x4678f7[_0xfb32('0x4f')][0x0]['transcript']?_0x4678f7[_0xfb32('0x4f')][0x0]['transcript']:'';})[_0xfb32('0x50')]('\x0a');_0x519e6c=_0x7f7ca8[_0xfb32('0x4d')][_0xfb32('0x4e')](function(_0x1bc136){return _0x1bc136&&_0x1bc136[_0xfb32('0x4f')][0x0]&&_0x1bc136[_0xfb32('0x4f')][0x0]['confidence']?_0x1bc136[_0xfb32('0x4f')][0x0][_0xfb32('0x51')]:0x0;})[_0xfb32('0x50')]('\x0a');}logger['info']('googleASR\x20transcription',_0x3fc371);logger[_0xfb32('0x22')](_0xfb32('0x52'),_0x519e6c);return{'transcript':_0x3fc371,'confidence':_0x519e6c};})[_0xfb32('0x53')](function(_0x17998c){logger['error'](_0xfb32('0x54'),_0x17998c[_0xfb32('0x16')],_0x17998c[_0xfb32('0x55')],_0x17998c[_0xfb32('0x56')]);});};exports[_0xfb32('0x57')]=function(_0x4c4063,_0x330497,_0x5af648,_0x342ed9){var _0x26e3af=apiai(_0x330497,{'language':_0x342ed9||'en'});return _0x26e3af[_0xfb32('0x58')](_0x5af648,{'sessionId':md5(_0x4c4063)})['then'](function(_0x3db366){logger['info'](JSON['stringify'](_0x3db366));return{'source':_0x3db366[_0xfb32('0x59')][_0xfb32('0x5a')],'resolvedQuery':_0x3db366[_0xfb32('0x59')][_0xfb32('0x5b')],'action':_0x3db366[_0xfb32('0x59')]['action'],'actionIncomplete':_0x3db366[_0xfb32('0x59')][_0xfb32('0x5c')],'speech':_0x3db366['result'][_0xfb32('0x5d')][_0xfb32('0x5e')],'score':_0x3db366['result']['score'],'statusCode':_0x3db366[_0xfb32('0x5f')][_0xfb32('0x60')],'endConversation':_0x3db366['result'][_0xfb32('0x61')][_0xfb32('0x62')]||![],'isFallbackIntent':_0x3db366[_0xfb32('0x59')][_0xfb32('0x61')][_0xfb32('0x63')]};});};exports[_0xfb32('0x64')]=function(_0xd76cb6,_0x2081d0,_0x21c9a0,_0x507997,_0x5cb4fe,_0x570289){var _0x5e7623=_0x507997['replace'](/\\n/g,'\x0a');var _0x88294a={'credentials':{'private_key':_0x5e7623,'client_email':_0x21c9a0}};var _0x245ece=new dialogflow['SessionsClient'](_0x88294a);var _0x5ec206=_0x245ece[_0xfb32('0x65')](_0x2081d0,md5(_0xd76cb6));var _0x655dca={'session':_0x5ec206,'queryInput':{'text':{'text':_0x5cb4fe,'languageCode':_0x570289}}};return _0x245ece[_0xfb32('0x66')](_0x655dca)[_0xfb32('0x29')](function(_0x3d3462){if(_0x3d3462&&_0x3d3462[_0xfb32('0x45')]){logger[_0xfb32('0x22')](_0xfb32('0x67'),JSON[_0xfb32('0x41')](_0x3d3462));var _0x29baf4=_0x3d3462[0x0];if(_0x29baf4){var _0x357895={'action':_0x29baf4[_0xfb32('0x68')][_0xfb32('0x69')],'allRequiredParamsPresent':_0x29baf4[_0xfb32('0x68')][_0xfb32('0x6a')],'endConversation':_0x29baf4[_0xfb32('0x68')][_0xfb32('0x6b')]&&_0x29baf4[_0xfb32('0x68')][_0xfb32('0x6b')][_0xfb32('0x6c')]?_0x29baf4[_0xfb32('0x68')][_0xfb32('0x6b')][_0xfb32('0x6c')][_0xfb32('0x6d')][_0xfb32('0x6e')]:![],'fulfillmentText':_0x29baf4[_0xfb32('0x68')][_0xfb32('0x6f')],'intentName':_0x29baf4[_0xfb32('0x68')][_0xfb32('0x70')][_0xfb32('0x55')],'intentDisplayName':_0x29baf4['queryResult'][_0xfb32('0x70')]['displayName'],'isFallbackIntent':_0x29baf4[_0xfb32('0x68')][_0xfb32('0x70')][_0xfb32('0x71')],'languageCode':_0x29baf4['queryResult']['languageCode'],'queryText':_0x29baf4[_0xfb32('0x68')][_0xfb32('0x72')],'responseId':_0x29baf4[_0xfb32('0x73')],'score':_0x29baf4['queryResult']['intentDetectionConfidence'],'speech':_0x29baf4['queryResult'][_0xfb32('0x6f')],'providerResponse':JSON[_0xfb32('0x41')](_0x3d3462)};return _0x357895;}}});};exports[_0xfb32('0x74')]=function(_0x23063e,_0x527f0b,_0x57a468,_0x143ae6){return tilde['asr'](_0x23063e,_0x527f0b,_0x57a468,_0x143ae6)[_0xfb32('0x29')](function(_0x5dfa2d){try{fs['unlink'](_0x23063e);}catch(_0x893b0e){logger[_0xfb32('0x17')](_0x893b0e);}logger[_0xfb32('0x22')]('Tilde\x20ASR\x20transcription',_0x5dfa2d[_0xfb32('0x75')]);logger[_0xfb32('0x22')](_0xfb32('0x76'),_0x5dfa2d[_0xfb32('0x51')]);return _0x5dfa2d;});};exports[_0xfb32('0x77')]=function(_0x11340d,_0x5a33bb,_0x5dffa0,_0xe985f4,_0x3509ee,_0x368f16){var _0x44e643=path[_0xfb32('0x35')](__dirname,_0xfb32('0x25'),rs[_0xfb32('0x26')](0x4)+_0xfb32('0x36'));var _0x112beb;return aws['polly'](_0x11340d,_0x5a33bb,_0x5dffa0,_0xe985f4,_0x3509ee,_0x368f16,_0x44e643)[_0xfb32('0x29')](function(){_0x112beb=path[_0xfb32('0x35')](__dirname,_0xfb32('0x25'),rs[_0xfb32('0x26')](0x4)+_0xfb32('0x27'));return convertFile(_0x44e643,_0x112beb);})[_0xfb32('0x29')](function(){try{fs[_0xfb32('0x2a')](_0x44e643);fs['chmodSync'](_0x112beb,_0xfb32('0x2c'));}catch(_0x4fb167){logger[_0xfb32('0x17')](_0x4fb167);}return _0x112beb[_0xfb32('0x2d')]('.')[0x0];});};exports['awsLex']=function(_0x31d03e,_0x30c77a,_0x1b6fda,_0x5e2079,_0x4c5849,_0x137394){return aws[_0xfb32('0x78')](_0x31d03e,_0x30c77a,_0x1b6fda,_0x5e2079,_0x4c5849,_0x137394)[_0xfb32('0x29')](function(_0x55d9ce){logger[_0xfb32('0x22')](JSON[_0xfb32('0x41')](_0x55d9ce));return _0x55d9ce;});};exports[_0xfb32('0x79')]=function(_0x415fc1,_0x334bd1,_0x39224a,_0x2b11ab){var _0x366725=util[_0xfb32('0x7a')](_0xfb32('0x7b'),ISPEECH_API,_0x415fc1,encodeURIComponent(_0x334bd1),_0x39224a,_0x2b11ab);var _0x55e1a9=path['resolve'](__dirname,'tmp',rs[_0xfb32('0x26')](0x4)+'.mp3');var _0x2faec8;return downloadFile(_0x366725,_0x55e1a9)[_0xfb32('0x29')](function(){_0x2faec8=path[_0xfb32('0x35')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x55e1a9,_0x2faec8);})[_0xfb32('0x29')](function(){try{fs[_0xfb32('0x2a')](_0x55e1a9);fs[_0xfb32('0x2b')](_0x2faec8,_0xfb32('0x2c'));}catch(_0x1a5328){logger[_0xfb32('0x17')](_0x1a5328);}return _0x2faec8[_0xfb32('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x4d15d0,_0x521273,_0x1fc0ef,_0x579413){var _0x315c78=util[_0xfb32('0x7a')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x521273,_0x1fc0ef,base64Encode(_0x4d15d0),_0x579413?util[_0xfb32('0x7a')](_0xfb32('0x7c'),encodeURIComponent(_0x579413)):_0xfb32('0x7d'));return uploadFile(_0x315c78)[_0xfb32('0x29')](function(_0x426fb7){return querystring['parse'](_0x426fb7);});};exports['sestekNDA']=function(_0x51c712,_0x32c2ac){return sestek[_0xfb32('0x7e')](_0x51c712,_0x32c2ac)[_0xfb32('0x29')](function(_0x4eef46){logger[_0xfb32('0x22')](JSON['stringify'](_0x4eef46));var _0x2f0696={'speech':_0x4eef46[_0xfb32('0x7f')],'action':_0x4eef46[_0xfb32('0x80')]?_0x4eef46[_0xfb32('0x80')][_0xfb32('0x81')]:undefined,'actiondata':_0x4eef46[_0xfb32('0x80')]?_0x4eef46[_0xfb32('0x80')][_0xfb32('0x82')]:undefined};if(_0x4eef46[_0xfb32('0x80')]&&_0x4eef46[_0xfb32('0x80')]['AudioFromTts']){return base64Decode(_0x4eef46['channelData'][_0xfb32('0x83')][_0xfb32('0x84')],path[_0xfb32('0x35')](__dirname,_0xfb32('0x25'),rs[_0xfb32('0x26')](0x4)+_0xfb32('0x27')))[_0xfb32('0x29')](function(_0x17e259){_0x2f0696['audiofile']=_0x17e259;return _0x2f0696;});}return _0x2f0696;});};exports[_0xfb32('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0xcb12=['http','path','querystring','randomstring','sox','util','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','close','error','unlink','download\x20error','host','data','end','transcode','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','.mp3','from','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','parse','sestekNDA','nda','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','bluebird'];(function(_0x54f6e4,_0x151b23){var _0x50f6db=function(_0x391e0f){while(--_0x391e0f){_0x54f6e4['push'](_0x54f6e4['shift']());}};_0x50f6db(++_0x151b23);}(_0xcb12,0x84));var _0x2cb1=function(_0x2bd24c,_0x44274c){_0x2bd24c=_0x2bd24c-0x0;var _0x574fc4=_0xcb12[_0x2bd24c];return _0x574fc4;};'use strict';var apiai=require(_0x2cb1('0x0'));var BPromise=require(_0x2cb1('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x2cb1('0x2'));var https=require('https');var md5=require('md5');var path=require(_0x2cb1('0x3'));var querystring=require(_0x2cb1('0x4'));var rp=require('request-promise');var rs=require(_0x2cb1('0x5'));var sox=require(_0x2cb1('0x6'));var tts=require('google-tts-api');var urlParse=require('url')['parse'];var util=require(_0x2cb1('0x7'));var aws=require('./aws');var google=require('./google');var sestek=require(_0x2cb1('0x8'));var tilde=require(_0x2cb1('0x9'));var logger=require('../../../config/logger')(_0x2cb1('0xa'));var ISPEECH_API=_0x2cb1('0xb');function downloadFile(_0x51b06e,_0x41504d){return new BPromise(function(_0xbf8352,_0x47a405){var _0x2b2c93=urlParse(_0x51b06e);var _0xb46011=_0x2b2c93[_0x2cb1('0xc')]==='https:'?https:http;var _0x37fa69={'host':_0x2b2c93['host'],'path':_0x2b2c93[_0x2cb1('0x3')],'headers':{'user-agent':_0x2cb1('0xd')}};_0xb46011[_0x2cb1('0xe')](_0x37fa69,function(_0xae99e0){if(_0xae99e0[_0x2cb1('0xf')]!==0xc8){logger['error'](_0x2cb1('0x10')+_0x51b06e+_0x2cb1('0x11')+_0xae99e0[_0x2cb1('0xf')]+'\x20('+_0xae99e0['statusMessage']+')');_0x47a405(new Error(_0x2cb1('0x10')+_0x51b06e+_0x2cb1('0x11')+_0xae99e0[_0x2cb1('0xf')]+'\x20('+_0xae99e0[_0x2cb1('0x12')]+')'));return;}var _0x5d7528=fs['createWriteStream'](_0x41504d);_0x5d7528['on'](_0x2cb1('0x13'),function(){logger['info'](_0x2cb1('0x14'));_0x5d7528[_0x2cb1('0x15')](_0xbf8352);});_0x5d7528['on'](_0x2cb1('0x16'),function(_0x305024){fs[_0x2cb1('0x17')](_0x41504d);logger[_0x2cb1('0x16')](_0x2cb1('0x18'),_0x305024);_0x47a405(_0x305024);});_0xae99e0['pipe'](_0x5d7528);})['on'](_0x2cb1('0x16'),function(_0x5ef56c){logger[_0x2cb1('0x16')](_0x5ef56c);_0x47a405(_0x5ef56c);})['end']();});}function uploadFile(_0x45b74f){return new BPromise(function(_0x257b60,_0x3e1f6b){var _0x37ddaa=urlParse(_0x45b74f);var _0x30b2f6=_0x37ddaa['protocol']==='https:'?https:http;var _0x2f8430={'host':_0x37ddaa[_0x2cb1('0x19')],'path':_0x37ddaa['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x30b2f6['get'](_0x2f8430,function(_0x126095){if(_0x126095[_0x2cb1('0xf')]!==0xc8){_0x3e1f6b(new Error(_0x2cb1('0x10')+_0x45b74f+'\x20failed,\x20status\x20code\x20=\x20'+_0x126095['statusCode']+'\x20('+_0x126095[_0x2cb1('0x12')]+')'));return;}var _0x416015='';_0x126095['on'](_0x2cb1('0x1a'),function(_0x119d86){_0x416015+=_0x119d86;});_0x126095['on'](_0x2cb1('0x1b'),function(){_0x257b60(_0x416015);});})['on'](_0x2cb1('0x16'),function(_0x1c1137){_0x3e1f6b(_0x1c1137);})[_0x2cb1('0x1b')]();});}function convertFile(_0x3e57ac,_0x356203){return new BPromise(function(_0x15a68b,_0x18616d){var _0x245273=sox[_0x2cb1('0x1c')](_0x3e57ac,_0x356203,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x245273['on'](_0x2cb1('0x16'),function(_0x2e3c07){logger['error']('error\x20convert',_0x2e3c07);_0x18616d(_0x2e3c07);});_0x245273['on'](_0x2cb1('0x1b'),function(){logger[_0x2cb1('0x1d')](_0x2cb1('0x1e'));_0x15a68b();});_0x245273[_0x2cb1('0x1f')]();});}function base64Decode(_0x7efec7,_0x4f4a20){var _0x8bb799=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x23'));fs['writeFileSync'](_0x8bb799,_0x7efec7,_0x2cb1('0x24'));return convertFile(_0x8bb799,_0x4f4a20)[_0x2cb1('0x25')](function(){try{fs[_0x2cb1('0x17')](_0x8bb799);fs[_0x2cb1('0x26')](_0x4f4a20,_0x2cb1('0x27'));}catch(_0x344fc4){logger[_0x2cb1('0x16')](_0x344fc4);}return _0x4f4a20[_0x2cb1('0x28')]('.')[0x0];});}function base64Encode(_0x3935cc){var _0x1aa746=fs[_0x2cb1('0x29')](_0x3935cc);return new Buffer(_0x1aa746)[_0x2cb1('0x2a')]('base64');}exports['googleCloudTTS']=function(_0xf22b1,_0x28def2,_0x49778c,_0x5dd16e,_0x53edd0,_0x4cd305){var _0x72ec82,_0x57eb41;var _0x448744=_0x2cb1('0x2b');var _0x3e3f07=_0x2cb1('0x2c')+_0xf22b1;var _0x8de132={};if(_0x28def2===_0x2cb1('0x2d')){_0x8de132[_0x2cb1('0x2e')]={'ssml':_0x49778c};}else{_0x8de132[_0x2cb1('0x2e')]={'text':_0x49778c};};_0x8de132[_0x2cb1('0x2f')]={'languageCode':_0x5dd16e,'ssmlGender':_0x53edd0};_0x8de132[_0x2cb1('0x30')]={'audioEncoding':_0x2cb1('0x31'),'sampleRateHertz':0x1f40};var _0x121313={'url':_0x448744+'text:synthesize'+_0x3e3f07,'method':_0x2cb1('0x32'),'json':!![],'body':_0x8de132};return rp(_0x121313)['then'](function(_0x372068){return new BPromise(function(_0x5f3e44,_0x30c3cd){_0x72ec82=path['resolve'](__dirname,_0x2cb1('0x21'),rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x33'));var _0x3499f9=Buffer[_0x2cb1('0x34')](_0x372068['audioContent'],'base64');return fs['writeFile'](_0x72ec82,_0x3499f9,function(_0xfc5a86){_0x30c3cd(_0xfc5a86);},function(_0x4940ec){fs[_0x2cb1('0x26')](_0x72ec82,_0x2cb1('0x27'));_0x5f3e44(_0x4940ec);});});})[_0x2cb1('0x25')](function(_0x4dedd5){_0x57eb41=path['resolve'](__dirname,'tmp',rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x23'));return convertFile(_0x72ec82,_0x57eb41);})[_0x2cb1('0x25')](function(){try{fs[_0x2cb1('0x17')](_0x72ec82);fs[_0x2cb1('0x26')](_0x57eb41,_0x2cb1('0x27'));}catch(_0x267309){logger['error'](_0x267309);}logger[_0x2cb1('0x1d')](_0x2cb1('0x35'),_0x57eb41[_0x2cb1('0x28')]('.')[0x0]);return _0x57eb41[_0x2cb1('0x28')]('.')[0x0];});};exports['googleTTS']=function(_0x328045,_0x21bb19){var _0x54fa42=_0x2cb1('0x36');var _0x129348,_0x361155;var _0x4d28ae;var _0x516855={'encoding':_0x2cb1('0x37'),'method':_0x2cb1('0x32'),'timeout':0x2710,'url':_0x54fa42,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x2cb1('0x38')+encodeURIComponent(JSON[_0x2cb1('0x39')]([[[_0x2cb1('0x3a'),JSON['stringify']([_0x328045,_0x21bb19||'en',![],_0x2cb1('0x3b')]),null,_0x2cb1('0x3c')]]]))};return rp(_0x516855)[_0x2cb1('0x25')](function(_0x4b0bc0){try{_0x4d28ae=eval(_0x4b0bc0[_0x2cb1('0x3d')](0x5))[0x0][0x2];}catch(_0x4b78e5){throw new Error(_0x2cb1('0x3e')+_0x4b0bc0[_0x2cb1('0x1a')]);}if(!_0x4d28ae){if(_0x328045[_0x2cb1('0x3f')]>0xc8){throw new Error(_0x2cb1('0x40'));}else{throw new Error(_0x2cb1('0x41')+_0x21bb19+_0x2cb1('0x42'));}}try{_0x4d28ae=eval(_0x4d28ae)[0x0];}catch(_0xd640f0){throw new Error(_0x2cb1('0x3e')+res[_0x2cb1('0x1a')]);}const _0x342caa=_0x4d28ae;_0x129348=path[_0x2cb1('0x20')](__dirname,'tmp',rs['generate'](0x4)+_0x2cb1('0x33'));fs[_0x2cb1('0x43')](_0x129348,_0x4d28ae,{'encoding':_0x2cb1('0x24')});_0x361155=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x23'));return convertFile(_0x129348,_0x361155);})[_0x2cb1('0x25')](function(){try{fs[_0x2cb1('0x17')](_0x129348);fs[_0x2cb1('0x26')](_0x361155,'777');}catch(_0x5a86b9){logger[_0x2cb1('0x16')](_0x5a86b9);}logger[_0x2cb1('0x1d')](_0x2cb1('0x44'),_0x361155[_0x2cb1('0x28')]('.')[0x0]);return _0x361155[_0x2cb1('0x28')]('.')[0x0];});};exports['googleASR']=function(_0x17752b,_0x558bc0,_0x336ef0){return google[_0x2cb1('0x45')](_0x17752b,_0x558bc0,_0x336ef0)['then'](function(_0x1c3759){logger[_0x2cb1('0x1d')](_0x1c3759[_0x2cb1('0x46')]);return rp(_0x1c3759);})['then'](function(_0x4547ea){var _0x5311b3='';var _0x1456e7=0x0;try{fs[_0x2cb1('0x17')](_0x17752b);}catch(_0xcd1d9c){logger[_0x2cb1('0x16')](_0xcd1d9c);}if(_0x4547ea&&_0x4547ea[_0x2cb1('0x47')]){_0x5311b3=_0x4547ea[_0x2cb1('0x47')]['map'](function(_0x49930e){return _0x49930e&&_0x49930e[_0x2cb1('0x48')][0x0]&&_0x49930e[_0x2cb1('0x48')][0x0][_0x2cb1('0x49')]?_0x49930e['alternatives'][0x0]['transcript']:'';})[_0x2cb1('0x4a')]('\x0a');_0x1456e7=_0x4547ea[_0x2cb1('0x47')][_0x2cb1('0x4b')](function(_0x3540a0){return _0x3540a0&&_0x3540a0[_0x2cb1('0x48')][0x0]&&_0x3540a0[_0x2cb1('0x48')][0x0][_0x2cb1('0x4c')]?_0x3540a0[_0x2cb1('0x48')][0x0][_0x2cb1('0x4c')]:0x0;})[_0x2cb1('0x4a')]('\x0a');}logger[_0x2cb1('0x1d')](_0x2cb1('0x4d'),_0x5311b3);logger[_0x2cb1('0x1d')](_0x2cb1('0x4e'),_0x1456e7);return{'transcript':_0x5311b3,'confidence':_0x1456e7};})[_0x2cb1('0x4f')](function(_0x5711a0){logger[_0x2cb1('0x16')]('[%s]\x20%s:%s',_0x5711a0[_0x2cb1('0xf')],_0x5711a0[_0x2cb1('0x50')],_0x5711a0[_0x2cb1('0x51')]);});};exports[_0x2cb1('0x52')]=function(_0x1cbfa8,_0x564239,_0x2d9e15,_0x2743a9){var _0x5696b5=apiai(_0x564239,{'language':_0x2743a9||'en'});return _0x5696b5[_0x2cb1('0x53')](_0x2d9e15,{'sessionId':md5(_0x1cbfa8)})[_0x2cb1('0x25')](function(_0x4949b9){logger[_0x2cb1('0x1d')](JSON[_0x2cb1('0x39')](_0x4949b9));return{'source':_0x4949b9[_0x2cb1('0x54')][_0x2cb1('0x55')],'resolvedQuery':_0x4949b9['result']['resolvedQuery'],'action':_0x4949b9['result'][_0x2cb1('0x56')],'actionIncomplete':_0x4949b9['result'][_0x2cb1('0x57')],'speech':_0x4949b9['result'][_0x2cb1('0x58')][_0x2cb1('0x59')],'score':_0x4949b9[_0x2cb1('0x54')][_0x2cb1('0x5a')],'statusCode':_0x4949b9['status'][_0x2cb1('0x5b')],'endConversation':_0x4949b9[_0x2cb1('0x54')]['metadata'][_0x2cb1('0x5c')]||![],'isFallbackIntent':_0x4949b9[_0x2cb1('0x54')][_0x2cb1('0x5d')][_0x2cb1('0x5e')]};});};exports[_0x2cb1('0x5f')]=function(_0x2ead84,_0x4e43bc,_0x1eb27d,_0x141850,_0x50978c,_0xfd2cf2){var _0x2f45ef=_0x141850[_0x2cb1('0x60')](/\\n/g,'\x0a');var _0x54b97e={'credentials':{'private_key':_0x2f45ef,'client_email':_0x1eb27d}};var _0x245680=new dialogflow[(_0x2cb1('0x61'))](_0x54b97e);var _0x978e38=_0x245680[_0x2cb1('0x62')](_0x4e43bc,md5(_0x2ead84));var _0x4a06d2={'session':_0x978e38,'queryInput':{'text':{'text':_0x50978c,'languageCode':_0xfd2cf2}}};return _0x245680[_0x2cb1('0x63')](_0x4a06d2)[_0x2cb1('0x25')](function(_0x480a58){if(_0x480a58&&_0x480a58[_0x2cb1('0x3f')]){logger[_0x2cb1('0x1d')](_0x2cb1('0x64'),JSON[_0x2cb1('0x39')](_0x480a58));var _0x2b4705=_0x480a58[0x0];if(_0x2b4705){var _0x1942b7={'action':_0x2b4705['queryResult'][_0x2cb1('0x56')],'allRequiredParamsPresent':_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x66')],'endConversation':_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x67')]&&_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x67')][_0x2cb1('0x68')]?_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x67')][_0x2cb1('0x68')][_0x2cb1('0x69')][_0x2cb1('0x6a')]:![],'fulfillmentText':_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x6b')],'intentName':_0x2b4705['queryResult'][_0x2cb1('0x6c')][_0x2cb1('0x50')],'intentDisplayName':_0x2b4705['queryResult'][_0x2cb1('0x6c')][_0x2cb1('0x6d')],'isFallbackIntent':_0x2b4705['queryResult'][_0x2cb1('0x6c')][_0x2cb1('0x6e')],'languageCode':_0x2b4705['queryResult'][_0x2cb1('0x6f')],'queryText':_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x70')],'responseId':_0x2b4705['responseId'],'score':_0x2b4705[_0x2cb1('0x65')]['intentDetectionConfidence'],'speech':_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x6b')],'providerResponse':JSON['stringify'](_0x480a58)};return _0x1942b7;}}});};exports[_0x2cb1('0x71')]=function(_0x5ae0b9,_0x1c2d7c,_0x512768,_0x393ec9){return tilde[_0x2cb1('0x45')](_0x5ae0b9,_0x1c2d7c,_0x512768,_0x393ec9)[_0x2cb1('0x25')](function(_0xbc7fd2){try{fs[_0x2cb1('0x17')](_0x5ae0b9);}catch(_0x53a1e3){logger[_0x2cb1('0x16')](_0x53a1e3);}logger['info'](_0x2cb1('0x72'),_0xbc7fd2[_0x2cb1('0x49')]);logger[_0x2cb1('0x1d')](_0x2cb1('0x73'),_0xbc7fd2['confidence']);return _0xbc7fd2;});};exports[_0x2cb1('0x74')]=function(_0x3a0854,_0x52d140,_0xa7383b,_0x47c736,_0x1c2266,_0x14da4d){var _0x355d6b=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs['generate'](0x4)+_0x2cb1('0x33'));var _0x489b99;return aws[_0x2cb1('0x75')](_0x3a0854,_0x52d140,_0xa7383b,_0x47c736,_0x1c2266,_0x14da4d,_0x355d6b)['then'](function(){_0x489b99=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs['generate'](0x4)+_0x2cb1('0x23'));return convertFile(_0x355d6b,_0x489b99);})[_0x2cb1('0x25')](function(){try{fs[_0x2cb1('0x17')](_0x355d6b);fs[_0x2cb1('0x26')](_0x489b99,_0x2cb1('0x27'));}catch(_0x2576a6){logger['error'](_0x2576a6);}return _0x489b99[_0x2cb1('0x28')]('.')[0x0];});};exports[_0x2cb1('0x76')]=function(_0x20cbd9,_0x381e9a,_0x1ac583,_0x1b15e4,_0x3535db,_0x415be1){return aws[_0x2cb1('0x77')](_0x20cbd9,_0x381e9a,_0x1ac583,_0x1b15e4,_0x3535db,_0x415be1)['then'](function(_0x3da7fa){logger['info'](JSON[_0x2cb1('0x39')](_0x3da7fa));return _0x3da7fa;});};exports[_0x2cb1('0x78')]=function(_0x546feb,_0x40238b,_0x47d0ca,_0x5f4acc){var _0x5985f2=util[_0x2cb1('0x79')](_0x2cb1('0x7a'),ISPEECH_API,_0x546feb,encodeURIComponent(_0x40238b),_0x47d0ca,_0x5f4acc);var _0x1529e8=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs['generate'](0x4)+'.mp3');var _0x2a58e3;return downloadFile(_0x5985f2,_0x1529e8)[_0x2cb1('0x25')](function(){_0x2a58e3=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x23'));return convertFile(_0x1529e8,_0x2a58e3);})['then'](function(){try{fs[_0x2cb1('0x17')](_0x1529e8);fs[_0x2cb1('0x26')](_0x2a58e3,_0x2cb1('0x27'));}catch(_0x5bcebf){logger[_0x2cb1('0x16')](_0x5bcebf);}return _0x2a58e3[_0x2cb1('0x28')]('.')[0x0];});};exports[_0x2cb1('0x7b')]=function(_0x3524c1,_0x395c9a,_0x50b793,_0x93c5bc){var _0x3fd662=util[_0x2cb1('0x79')](_0x2cb1('0x7c'),ISPEECH_API,_0x395c9a,_0x50b793,base64Encode(_0x3524c1),_0x93c5bc?util['format'](_0x2cb1('0x7d'),encodeURIComponent(_0x93c5bc)):'freeform=3');return uploadFile(_0x3fd662)['then'](function(_0x1ae5b5){return querystring[_0x2cb1('0x7e')](_0x1ae5b5);});};exports[_0x2cb1('0x7f')]=function(_0x1f9a44,_0x1b59db){return sestek[_0x2cb1('0x80')](_0x1f9a44,_0x1b59db)['then'](function(_0x6c0b0f){logger[_0x2cb1('0x1d')](JSON['stringify'](_0x6c0b0f));var _0x34cd14={'speech':_0x6c0b0f['text'],'action':_0x6c0b0f[_0x2cb1('0x81')]?_0x6c0b0f[_0x2cb1('0x81')][_0x2cb1('0x82')]:undefined,'actiondata':_0x6c0b0f[_0x2cb1('0x81')]?_0x6c0b0f[_0x2cb1('0x81')]['CustomActionData']:undefined};if(_0x6c0b0f[_0x2cb1('0x81')]&&_0x6c0b0f[_0x2cb1('0x81')][_0x2cb1('0x83')]){return base64Decode(_0x6c0b0f[_0x2cb1('0x81')]['AudioFromTts']['Data'],path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x23')))[_0x2cb1('0x25')](function(_0x285a60){_0x34cd14[_0x2cb1('0x84')]=_0x285a60;return _0x34cd14;});}return _0x34cd14;});};exports[_0x2cb1('0x85')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index d961aed..f86e8bb 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 _0xb764=['exports'];(function(_0x24c65d,_0x4a04ec){var _0x57d458=function(_0x49cce8){while(--_0x49cce8){_0x24c65d['push'](_0x24c65d['shift']());}};_0x57d458(++_0x4a04ec);}(_0xb764,0xc5));var _0x4b76=function(_0x38753d,_0x149b6d){_0x38753d=_0x38753d-0x0;var _0x1857b7=_0xb764[_0x38753d];return _0x1857b7;};var nda=require('./nda');module[_0x4b76('0x0')]={'nda':nda}; \ No newline at end of file +var _0xca49=['exports','./nda'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0xca49,0xe1));var _0x9ca4=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0xca49[_0x3ff2f9];return _0x3b0913;};var nda=require(_0x9ca4('0x0'));module[_0x9ca4('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 afd6a73..f9c7469 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 _0x220b=['agi','exports','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','channelData','project','ndagenerate_audio','body','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x220b,0x1a2));var _0xb220=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x220b[_0x673722];return _0x21249c;};'use strict';var rp=require('request-promise');var url=require(_0xb220('0x0'));var logger=require(_0xb220('0x1'))(_0xb220('0x2'));module[_0xb220('0x3')]=function(_0x53992c,_0x2d2ad3){var _0x5582f3={'method':_0xb220('0x4'),'uri':url['resolve'](_0x2d2ad3[_0xb220('0x5')],_0xb220('0x6')),'form':{'grant_type':_0xb220('0x7'),'username':_0x2d2ad3[_0xb220('0x8')],'password':_0x2d2ad3['password']},'json':!![]};return rp(_0x5582f3)[_0xb220('0x9')](function(_0x7fa0dd){var _0x5b83b9={'method':_0xb220('0x4'),'uri':url[_0xb220('0xa')](_0x2d2ad3[_0xb220('0xb')],_0xb220('0xc')),'body':{'type':_0x2d2ad3[_0xb220('0xd')]||_0xb220('0xe'),'channelId':_0xb220('0xf'),'conversation':{'id':_0x53992c[_0xb220('0x10')]},'from':{'id':_0x53992c[_0xb220('0x11')],'name':_0x53992c['calleridname']},'recipient':{'id':_0x53992c[_0xb220('0x12')],'name':_0x53992c[_0xb220('0x13')]},'text':_0x2d2ad3['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x7fa0dd['access_token']},'json':!![]};if(_0x2d2ad3['project']){_0x5b83b9['body'][_0xb220('0x14')]['ProjectName']=_0x2d2ad3[_0xb220('0x15')];}if(_0x2d2ad3[_0xb220('0x16')]=='1'){_0x5b83b9[_0xb220('0x17')][_0xb220('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x2d2ad3[_0xb220('0x18')]){_0x5b83b9[_0xb220('0x17')][_0xb220('0x14')][_0xb220('0x19')]=_0x2d2ad3[_0xb220('0x18')];if(_0x2d2ad3[_0xb220('0x1a')]){_0x5b83b9[_0xb220('0x17')][_0xb220('0x14')][_0xb220('0x1b')]=_0x2d2ad3[_0xb220('0x1a')];}}logger[_0xb220('0x1c')](JSON[_0xb220('0x1d')](_0x5b83b9));return rp(_0x5b83b9);});}; \ No newline at end of file +var _0x4a47=['ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','body','channelData'];(function(_0x1f5303,_0x354414){var _0x84ef1a=function(_0x27e275){while(--_0x27e275){_0x1f5303['push'](_0x1f5303['shift']());}};_0x84ef1a(++_0x354414);}(_0x4a47,0xb5));var _0x74a4=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0x4a47[_0x514260];return _0x4ac81b;};'use strict';var rp=require(_0x74a4('0x0'));var url=require(_0x74a4('0x1'));var logger=require(_0x74a4('0x2'))(_0x74a4('0x3'));module[_0x74a4('0x4')]=function(_0x54d63a,_0x24cff9){var _0x55c541={'method':_0x74a4('0x5'),'uri':url[_0x74a4('0x6')](_0x24cff9['ndauth_url'],_0x74a4('0x7')),'form':{'grant_type':_0x74a4('0x8'),'username':_0x24cff9[_0x74a4('0x9')],'password':_0x24cff9['password']},'json':!![]};return rp(_0x55c541)[_0x74a4('0xa')](function(_0x55e8a1){var _0x3122ba={'method':'POST','uri':url[_0x74a4('0x6')](_0x24cff9[_0x74a4('0xb')],_0x74a4('0xc')),'body':{'type':_0x24cff9[_0x74a4('0xd')]||'message','channelId':_0x74a4('0xe'),'conversation':{'id':_0x54d63a[_0x74a4('0xf')]},'from':{'id':_0x54d63a[_0x74a4('0x10')],'name':_0x54d63a[_0x74a4('0x11')]},'recipient':{'id':_0x54d63a['dnid'],'name':_0x54d63a[_0x74a4('0x12')]},'text':_0x24cff9[_0x74a4('0x13')],'channelData':{}},'headers':{'Authorization':_0x74a4('0x14')+_0x55e8a1['access_token']},'json':!![]};if(_0x24cff9['project']){_0x3122ba[_0x74a4('0x15')][_0x74a4('0x16')][_0x74a4('0x17')]=_0x24cff9[_0x74a4('0x18')];}if(_0x24cff9[_0x74a4('0x19')]=='1'){_0x3122ba[_0x74a4('0x15')][_0x74a4('0x16')][_0x74a4('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x74a4('0x1b')};}if(_0x24cff9[_0x74a4('0x1c')]){_0x3122ba[_0x74a4('0x15')][_0x74a4('0x16')][_0x74a4('0x1d')]=_0x24cff9[_0x74a4('0x1c')];if(_0x24cff9[_0x74a4('0x1e')]){_0x3122ba[_0x74a4('0x15')]['channelData'][_0x74a4('0x1f')]=_0x24cff9[_0x74a4('0x1e')];}}logger[_0x74a4('0x20')](JSON[_0x74a4('0x21')](_0x3122ba));return rp(_0x3122ba);});}; \ 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 44d8916..d5dfbb7 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 _0x3534=['./lib/api','exports'];(function(_0x1fe7fe,_0x41cc8a){var _0x119376=function(_0x4e66d9){while(--_0x4e66d9){_0x1fe7fe['push'](_0x1fe7fe['shift']());}};_0x119376(++_0x41cc8a);}(_0x3534,0x1dc));var _0x4353=function(_0x5ed354,_0x3468d0){_0x5ed354=_0x5ed354-0x0;var _0x548eb3=_0x3534[_0x5ed354];return _0x548eb3;};'use strict';var asr=require(_0x4353('0x0'));module[_0x4353('0x1')]=function(_0x52b8ff,_0x3d4298,_0x3456d5,_0x7b597b){return asr(_0x52b8ff,_0x3d4298,_0x3456d5,_0x7b597b);}; \ No newline at end of file +var _0xbd15=['./lib/api'];(function(_0x4072cf,_0x4ef470){var _0x3bfcd1=function(_0x2f3b1a){while(--_0x2f3b1a){_0x4072cf['push'](_0x4072cf['shift']());}};_0x3bfcd1(++_0x4ef470);}(_0xbd15,0x179));var _0x5bd1=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0xbd15[_0x5c8827];return _0x50ffd5;};'use strict';var asr=require(_0x5bd1('0x0'));module['exports']=function(_0x5e64da,_0x22c2a9,_0x5aa0cd,_0x14fb6c){return asr(_0x5e64da,_0x22c2a9,_0x5aa0cd,_0x14fb6c);}; \ 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 1b309f6..f9b99f0 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 _0x54b7=['Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.'];(function(_0x494483,_0x4be464){var _0x4789aa=function(_0x19cbf6){while(--_0x19cbf6){_0x494483['push'](_0x494483['shift']());}};_0x4789aa(++_0x4be464);}(_0x54b7,0xa5));var _0x754b=function(_0x4b65b6,_0x548c59){_0x4b65b6=_0x4b65b6-0x0;var _0x1f4398=_0x54b7[_0x4b65b6];return _0x1f4398;};'use strict';var BPromise=require(_0x754b('0x0'));var _=require(_0x754b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x754b('0x2'));var logger=require(_0x754b('0x3'))(_0x754b('0x4'));module[_0x754b('0x5')]=function(_0xb402d9,_0x580590,_0x4a18e8,_0x594378){return new BPromise(function(_0x2db8fe,_0x2a65ec){logger[_0x754b('0x6')](_0x754b('0x7'),_0x594378||_0x754b('0x8'));var _0x5f633e=new WebSocket(_0x594378||_0x754b('0x8'),{'perMessageDeflate':![]});var _0x146bc1='';var _0x295c00='0';var _0x2ad415='1';var _0x31da59='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x5b3c46(_0x34ff09){var _0x32318c=crypto[_0x754b('0x9')](_0x754b('0xa'));_0x32318c[_0x754b('0xb')](_0x34ff09);return _0x32318c[_0x754b('0xc')]('hex');}function _0x5bae33(){try{logger[_0x754b('0x6')](_0x754b('0xd'));var _0x50bad3=moment()[_0x754b('0xe')]();var _0x3dac45=_0x5b3c46(_0x50bad3+_0x580590+_0x4a18e8);_0x5f633e[_0x754b('0xf')](JSON[_0x754b('0x10')]({'appID':_0x580590,'timestamp':_0x50bad3,'appKey':_0x3dac45}));var _0x5cf040=fs[_0x754b('0x11')](_0xb402d9);_0x5cf040['on']('data',function(_0xd1c86e){_0x5f633e[_0x754b('0xf')](_0xd1c86e);});_0x5cf040['on'](_0x754b('0x12'),function(){_0x5f633e[_0x754b('0xf')](_0x754b('0x13'));});}catch(_0x5dc510){logger[_0x754b('0x14')](_0x754b('0x15'),JSON['stringify'](_0x5dc510));_0x5f633e[_0x754b('0x16')]();}}function _0x62d173(_0x28eac3){try{if(_0x28eac3){var _0xf0daaf=JSON[_0x754b('0x17')](_0x28eac3);switch(_0xf0daaf[_0x754b('0x18')]){case 0x0:if(_0xf0daaf[_0x754b('0x19')]){if(_0xf0daaf['result']['final']){logger[_0x754b('0x6')](_0x754b('0x1a'),JSON['stringify'](_0xf0daaf[_0x754b('0x19')][_0x754b('0x1b')]));_0x146bc1=_0xf0daaf[_0x754b('0x19')]['hypotheses'][0x0]['transcript'];_0x295c00=_0xf0daaf[_0x754b('0x19')][_0x754b('0x1b')][0x0][_0x754b('0x1c')];_0x2ad415='0';_0x31da59=_0x754b('0x1d');_0x5f633e[_0x754b('0x16')]();}}break;case 0x1:logger[_0x754b('0x6')](_0x754b('0x1e'));_0x2ad415='1';_0x31da59=_0x754b('0x1e');break;case 0x2:logger[_0x754b('0x6')](_0x754b('0x1f'));_0x2ad415='2';_0x31da59=_0x754b('0x1f');break;case 0x9:logger[_0x754b('0x6')](_0x754b('0x20'));_0x2ad415='9';_0x31da59=_0x754b('0x20');break;case 0xa:logger[_0x754b('0x6')](_0x754b('0x21'));_0x2ad415='10';_0x31da59=_0x754b('0x21');break;case 0xb:logger[_0x754b('0x6')](_0x754b('0x22'));_0x2ad415='11';_0x31da59='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x11d5f9){logger['error'](_0x754b('0x23'),JSON['stringify'](_0x11d5f9));_0x5f633e[_0x754b('0x16')]();}}function _0x3cd1f5(){logger['info'](_0x754b('0x24'));_0x2db8fe({'transcript':_0x146bc1,'confidence':_0x295c00,'status':_0x2ad415,'status_message':_0x31da59});}function _0xad35de(_0x37c885){logger['error'](_0x754b('0x25'));if(!_['isNil'](_0x37c885)){logger[_0x754b('0x14')](_['isObject'](_0x37c885)?JSON[_0x754b('0x10')](_0x37c885):_0x37c885);}}_0x5f633e['on'](_0x754b('0x26'),_0x5bae33);_0x5f633e['on'](_0x754b('0x27'),_0x62d173);_0x5f633e['on'](_0x754b('0x12'),_0x3cd1f5);_0x5f633e['on'](_0x754b('0x14'),_0xad35de);});}; \ No newline at end of file +var _0x2dc9=['moment','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','lodash'];(function(_0x15cde0,_0x555748){var _0x4e096b=function(_0xbc1c53){while(--_0xbc1c53){_0x15cde0['push'](_0x15cde0['shift']());}};_0x4e096b(++_0x555748);}(_0x2dc9,0x74));var _0x92dc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2dc9[_0xbca1b1];return _0x4e1686;};'use strict';var BPromise=require('bluebird');var _=require(_0x92dc('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x92dc('0x1'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x92dc('0x2'));module[_0x92dc('0x3')]=function(_0xe847be,_0x356124,_0x3b8f49,_0x41c223){return new BPromise(function(_0x2c08e2,_0x524350){logger[_0x92dc('0x4')](_0x92dc('0x5'),_0x41c223||_0x92dc('0x6'));var _0x2f8022=new WebSocket(_0x41c223||_0x92dc('0x6'),{'perMessageDeflate':![]});var _0x2d306d='';var _0x4a1f0b='0';var _0x1e6bbe='1';var _0x4d5ecf='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x52d0e4(_0x4fe386){var _0x51b034=crypto[_0x92dc('0x7')]('sha1');_0x51b034['update'](_0x4fe386);return _0x51b034[_0x92dc('0x8')](_0x92dc('0x9'));}function _0x4d1e03(){try{logger[_0x92dc('0x4')](_0x92dc('0xa'));var _0x4d0633=moment()[_0x92dc('0xb')]();var _0x317823=_0x52d0e4(_0x4d0633+_0x356124+_0x3b8f49);_0x2f8022[_0x92dc('0xc')](JSON[_0x92dc('0xd')]({'appID':_0x356124,'timestamp':_0x4d0633,'appKey':_0x317823}));var _0x33cbb4=fs[_0x92dc('0xe')](_0xe847be);_0x33cbb4['on'](_0x92dc('0xf'),function(_0x1ecae4){_0x2f8022[_0x92dc('0xc')](_0x1ecae4);});_0x33cbb4['on'](_0x92dc('0x10'),function(){_0x2f8022[_0x92dc('0xc')](_0x92dc('0x11'));});}catch(_0x54789a){logger['error'](_0x92dc('0x12'),JSON[_0x92dc('0xd')](_0x54789a));_0x2f8022['terminate']();}}function _0x29ff8c(_0x38dd49){try{if(_0x38dd49){var _0x2285b3=JSON['parse'](_0x38dd49);switch(_0x2285b3[_0x92dc('0x13')]){case 0x0:if(_0x2285b3[_0x92dc('0x14')]){if(_0x2285b3[_0x92dc('0x14')][_0x92dc('0x15')]){logger[_0x92dc('0x4')](_0x92dc('0x16'),JSON[_0x92dc('0xd')](_0x2285b3[_0x92dc('0x14')][_0x92dc('0x17')]));_0x2d306d=_0x2285b3[_0x92dc('0x14')][_0x92dc('0x17')][0x0][_0x92dc('0x18')];_0x4a1f0b=_0x2285b3[_0x92dc('0x14')]['hypotheses'][0x0][_0x92dc('0x19')];_0x1e6bbe='0';_0x4d5ecf='Success.';_0x2f8022['terminate']();}}break;case 0x1:logger[_0x92dc('0x4')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1e6bbe='1';_0x4d5ecf=_0x92dc('0x1a');break;case 0x2:logger['info'](_0x92dc('0x1b'));_0x1e6bbe='2';_0x4d5ecf=_0x92dc('0x1b');break;case 0x9:logger['info'](_0x92dc('0x1c'));_0x1e6bbe='9';_0x4d5ecf=_0x92dc('0x1c');break;case 0xa:logger[_0x92dc('0x4')](_0x92dc('0x1d'));_0x1e6bbe='10';_0x4d5ecf=_0x92dc('0x1d');break;case 0xb:logger[_0x92dc('0x4')](_0x92dc('0x1e'));_0x1e6bbe='11';_0x4d5ecf=_0x92dc('0x1e');}}}catch(_0x474fb8){logger[_0x92dc('0x1f')](_0x92dc('0x20'),JSON[_0x92dc('0xd')](_0x474fb8));_0x2f8022[_0x92dc('0x21')]();}}function _0x24eee7(){logger[_0x92dc('0x4')](_0x92dc('0x22'));_0x2c08e2({'transcript':_0x2d306d,'confidence':_0x4a1f0b,'status':_0x1e6bbe,'status_message':_0x4d5ecf});}function _0x2d38b2(_0x58a529){logger[_0x92dc('0x1f')](_0x92dc('0x23'));if(!_['isNil'](_0x58a529)){logger[_0x92dc('0x1f')](_[_0x92dc('0x24')](_0x58a529)?JSON[_0x92dc('0xd')](_0x58a529):_0x58a529);}}_0x2f8022['on'](_0x92dc('0x25'),_0x4d1e03);_0x2f8022['on'](_0x92dc('0x26'),_0x29ff8c);_0x2f8022['on'](_0x92dc('0x10'),_0x24eee7);_0x2f8022['on']('error',_0x2d38b2);});}; \ 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 734930b..b2824ef 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 _0xa8ae=['exports','./asr'];(function(_0x283bec,_0x291a49){var _0x2f53f2=function(_0x3f4a14){while(--_0x3f4a14){_0x283bec['push'](_0x283bec['shift']());}};_0x2f53f2(++_0x291a49);}(_0xa8ae,0x143));var _0xea8a=function(_0x40d67d,_0x4c8ed3){_0x40d67d=_0x40d67d-0x0;var _0x4e805a=_0xa8ae[_0x40d67d];return _0x4e805a;};var asr=require(_0xea8a('0x0'));module[_0xea8a('0x1')]={'asr':asr}; \ No newline at end of file +var _0x6bad=['exports','./asr'];(function(_0x1476cf,_0x38254d){var _0x569a8b=function(_0x37b801){while(--_0x37b801){_0x1476cf['push'](_0x1476cf['shift']());}};_0x569a8b(++_0x38254d);}(_0x6bad,0x185));var _0xd6ba=function(_0x1e2cf1,_0x5dcf28){_0x1e2cf1=_0x1e2cf1-0x0;var _0x41555d=_0x6bad[_0x1e2cf1];return _0x41555d;};var asr=require(_0xd6ba('0x0'));module[_0xd6ba('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 1ad3f9a..16a2df1 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x5650b4,_0x2723ba){var _0x297a62=function(_0x4ceedf){while(--_0x4ceedf){_0x5650b4['push'](_0x5650b4['shift']());}};_0x297a62(++_0x2723ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x258257,_0x32042d){var _0xafb58a=function(_0x506b5a){while(--_0x506b5a){_0x258257['push'](_0x258257['shift']());}};_0xafb58a(++_0x32042d);}(_0xe706,0xa3));var _0x6e70=function(_0x19f000,_0x39ac54){_0x19f000=_0x19f000-0x0;var _0x81cee0=_0xe706[_0x19f000];return _0x81cee0;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index ad45601..c2ccfd0 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 _0x0689=['agentLogout','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','isString','saveRestApiResult','isArray','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','label','noop','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','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','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','out','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','getData','test','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','goalname','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','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\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','menu','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','Executed\x20command\x20%s\x20%s','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','toLowerCase','QUEUE','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','email','subject','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0x0689,0x161));var _0x9068=function(_0x11eb54,_0x35c410){_0x11eb54=_0x11eb54-0x0;var _0x248fe0=_0x0689[_0x11eb54];return _0x248fe0;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x9068('0x0'));var sh=require('shelljs');var odbc=require(_0x9068('0x1'))();var rs=require(_0x9068('0x2'));var moment=require(_0x9068('0x3'));var Mustache=require(_0x9068('0x4'));var rp=require(_0x9068('0x5'));var logger=require(_0x9068('0x6'))(_0x9068('0x7'));var config=require(_0x9068('0x8'));var scripts=require(_0x9068('0x9'));var FILES_PATH=_0x9068('0xa');var recursiveMapAttributes=['rawHeaders',_0x9068('0xb')];var verticesWithRetry=['menu','getdigits',_0x9068('0xc')];var AGIVertices=function(_0x184746,_0x3e76cc,_0x77a2db){this[_0x9068('0xd')]=_0x184746;this[_0x9068('0xe')]=_0x3e76cc;this[_0x9068('0xf')]=_0x77a2db;};AGIVertices[_0x9068('0x10')][_0x9068('0x11')]=function(_0x4ff7aa,_0x364bd5){this[_0x9068('0xe')][_0x9068('0x12')](_0x4ff7aa)[_0x9068('0x13')](function(_0x47995d){_0x364bd5(null,_0x47995d?_0x47995d[_0x9068('0x14')]:![]);})[_0x9068('0x15')](function(_0x39eae8){_0x364bd5(_0x39eae8);});};AGIVertices['prototype'][_0x9068('0x16')]=function(_0x226d2f,_0x414054){this['rpc'][_0x9068('0x17')](_0x226d2f)[_0x9068('0x13')](function(_0x57bc1a){_0x414054(null,_0x57bc1a?_0x57bc1a[_0x9068('0x14')]:![]);})[_0x9068('0x15')](function(_0x486714){_0x414054(_0x486714);});};AGIVertices[_0x9068('0x10')][_0x9068('0x18')]=function(_0x74df53,_0x430000){this['rpc'][_0x9068('0x19')](_0x74df53)[_0x9068('0x13')](function(_0x3ab698){_0x430000(null,_0x3ab698?_0x3ab698[_0x9068('0x14')]:![]);})[_0x9068('0x15')](function(_0x1d09bf){_0x430000(_0x1d09bf);});};AGIVertices[_0x9068('0x10')][_0x9068('0x1a')]=function(_0xddd745,_0x5844b6){this[_0x9068('0xe')][_0x9068('0x1b')](_0xddd745)[_0x9068('0x13')](function(_0x475eaf){_0x5844b6(null,_0x475eaf?_0x475eaf[_0x9068('0x1c')]:![]);})[_0x9068('0x15')](function(_0x5d1345){_0x5844b6(_0x5d1345);});};AGIVertices[_0x9068('0x10')]['getUser']=function(_0x5787fd,_0x48a2de){this[_0x9068('0xe')]['getUserById'](_0x5787fd)['then'](function(_0xa13014){_0x48a2de(null,_0xa13014?_0xa13014[_0x9068('0x14')]:![]);})[_0x9068('0x15')](function(_0x3673b9){_0x48a2de(_0x3673b9);});};AGIVertices['prototype'][_0x9068('0x1d')]=function(_0x36c473,_0x2c1800){this[_0x9068('0xe')][_0x9068('0x1e')](_0x36c473)[_0x9068('0x13')](function(_0x4b93d9){_0x2c1800(null,_0x4b93d9?_0x4b93d9[_0x9068('0x14')]:![]);})[_0x9068('0x15')](function(_0x4f48c3){_0x2c1800(_0x4f48c3);});};AGIVertices[_0x9068('0x10')][_0x9068('0x1f')]=function(_0x54f0f2,_0x50480e){var _0x23b31d=this;this['rpc'][_0x9068('0x20')](_0x54f0f2)[_0x9068('0x13')](function(_0x422e89){_0x50480e(null,_0x422e89?_0x23b31d[_0x9068('0x21')](_0x422e89[_0x9068('0x22')]):![]);})['catch'](function(_0x94b290){_0x50480e(_0x94b290);});};AGIVertices[_0x9068('0x10')][_0x9068('0x23')]=function(_0x24500d,_0x5abbb6){this['rpc'][_0x9068('0x24')](_0x24500d)[_0x9068('0x13')](function(_0xb58f9){_0x5abbb6(null,_0xb58f9?_0xb58f9:![]);})[_0x9068('0x15')](function(_0x412526){_0x5abbb6(_0x412526);});};AGIVertices[_0x9068('0x10')][_0x9068('0x25')]=function(_0x31d1f6,_0xcd8a0d,_0x339b03){this['mailRpc'][_0x9068('0x25')](_0x31d1f6,_0xcd8a0d)[_0x9068('0x13')](function(){_0x339b03(null);})[_0x9068('0x15')](function(_0x5f3049){_0x339b03(_0x5f3049);});};AGIVertices[_0x9068('0x10')][_0x9068('0x26')]=function(_0x231fef,_0x1a8026){this['rpc'][_0x9068('0x27')](_0x231fef)['then'](function(_0x416eef){if(_0x416eef){if(_0x416eef['IntervalId']){_0x1a8026(null,[_0x416eef[_0x9068('0x28')]]);}else{_0x1a8026(null,_[_0x9068('0x29')](_0x416eef[_0x9068('0x2a')],_0x9068('0x28')));}}else{_0x1a8026(null,![]);}})[_0x9068('0x15')](function(_0x519da4){_0x1a8026(_0x519da4);});};AGIVertices[_0x9068('0x10')][_0x9068('0x21')]=function(_0x301c8f){return util[_0x9068('0x2b')](_0x9068('0x2c'),FILES_PATH,_0x301c8f);};AGIVertices[_0x9068('0x10')][_0x9068('0x2d')]=function(_0xf626cf,_0x12c752,_0x509483){odbc[_0x9068('0x2e')](_0xf626cf,function(_0x3443fb){if(_0x3443fb){logger[_0x9068('0x2f')](_0x9068('0x30'),_0x3443fb);_0x509483(_0x3443fb);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x9068('0x31')](_0x12c752,function(_0x276fc1,_0x1a9d0b){if(_0x276fc1){logger[_0x9068('0x32')](_0x9068('0x33'),_0x12c752);_0x509483(_0x276fc1);}else{logger[_0x9068('0x32')](_0x9068('0x34'),_0x12c752);odbc[_0x9068('0x35')](function(_0x13a5a4){if(_0x13a5a4){logger[_0x9068('0x2f')](_0x9068('0x36'),_0x13a5a4);}_0x509483(null,_0x1a9d0b);});}});}});};AGIVertices[_0x9068('0x10')][_0x9068('0x37')]=function(_0x3749ff,_0x3c0ccd){this[_0x9068('0xe')][_0x9068('0x38')](_0x3749ff)[_0x9068('0x13')](function(_0x53201f){_0x3c0ccd(null,_0x53201f?_0x53201f:![]);})[_0x9068('0x15')](function(_0x45eb4c){_0x3c0ccd(_0x45eb4c);});};AGIVertices[_0x9068('0x10')][_0x9068('0x39')]=function(_0x49f711,_0x4235be){this['rpc'][_0x9068('0x39')](_0x49f711)['then'](function(_0x11956b){_0x4235be(null,_0x11956b);})[_0x9068('0x15')](function(_0x3a8fdf){_0x4235be(_0x3a8fdf);});};AGIVertices[_0x9068('0x10')]['createSquareDetailsReport']=function(_0x399dfd,_0x2e7480,_0x23203e){this[_0x9068('0xe')][_0x9068('0x3a')]({'uniqueid':this[_0x9068('0xd')]['uniqueid'],'node':_0x399dfd['label'],'application':_0x399dfd[_0x9068('0x3b')],'data':_0x2e7480||null,'project_name':this[_0x9068('0xd')][_0x9068('0x3c')],'callerid':this[_0x9068('0xd')][_0x9068('0x3d')]})[_0x9068('0x13')](function(_0x2af438){if(_0x23203e){_0x23203e(null,_0x2af438);}})[_0x9068('0x15')](function(_0x13baa6){if(_0x23203e){_0x23203e(_0x13baa6);}});};AGIVertices[_0x9068('0x10')]['createSquareRecording']=function(_0x2a8409,_0x3d8264,_0x5e381f,_0x1cc7a0){this['rpc'][_0x9068('0x3e')]({'uniqueid':this['channel'][_0x9068('0x3f')],'callerid':this[_0x9068('0xd')]['callerid'],'calleridname':this[_0x9068('0xd')][_0x9068('0x40')],'context':this[_0x9068('0xd')][_0x9068('0x41')],'extension':this['channel'][_0x9068('0x42')],'priority':this[_0x9068('0xd')]['priority'],'accountcode':this[_0x9068('0xd')][_0x9068('0x43')],'dnid':this[_0x9068('0xd')][_0x9068('0x44')],'projectName':this[_0x9068('0xd')][_0x9068('0x3c')],'saveName':_0x3d8264,'filename':_0x2a8409[_0x9068('0x45')]||_0x3d8264,'savePath':_0x5e381f})['then'](function(_0x49513f){_0x1cc7a0(null,_0x49513f);})['catch'](function(_0x5e29b5){_0x1cc7a0(_0x5e29b5);});};AGIVertices['prototype'][_0x9068('0x46')]=function(_0xca8d6b,_0xebc12f,_0x23d7e8,_0xcc3df7,_0x4578e5){this['rpc'][_0x9068('0x46')]({'uniqueid':this['channel'][_0x9068('0x3f')],'body':_0xca8d6b,'direction':_0xebc12f,'providerName':_0x23d7e8,'providerResponse':_0xcc3df7})[_0x9068('0x13')](function(_0x4df418){if(_0x4578e5){_0x4578e5(null,_0x4df418);}})[_0x9068('0x15')](function(_0xb170ef){if(_0x4578e5){_0x4578e5(_0xb170ef);}});};AGIVertices[_0x9068('0x10')][_0x9068('0x47')]=function(_0x447113,_0x2a6deb){this[_0x9068('0xe')][_0x9068('0x47')]({'firstName':_[_0x9068('0x48')](_0x447113[_0x9068('0x14')])||_[_0x9068('0x49')](_0x447113[_0x9068('0x14')])?_0x9068('0x4a')+Math[_0x9068('0x4b')]():_0x447113[_0x9068('0x14')],'lastName':_[_0x9068('0x48')](_0x447113[_0x9068('0x4c')])||_[_0x9068('0x49')](_0x447113[_0x9068('0x4c')])?null:_0x447113['lastName'],'phone':_0x447113[_0x9068('0x4d')],'ListId':_0x447113[_0x9068('0x4e')],'scheduledat':_0x447113['scheduledAt'],'callbackUniqueid':this[_0x9068('0xd')]['uniqueid'],'tags':_0x9068('0x4f'),'description':_0x9068('0x50')+_0x447113[_0x9068('0x51')][_0x9068('0x52')](),'priority':_0x447113[_0x9068('0x53')]})[_0x9068('0x13')](function(_0x53959e){_0x2a6deb(null,_0x53959e);})[_0x9068('0x15')](function(_0x7ca565){_0x2a6deb(_0x7ca565);});};AGIVertices[_0x9068('0x10')][_0x9068('0x54')]=function(_0x201606,_0x5c56e2){this[_0x9068('0xe')][_0x9068('0x55')](_0x201606)[_0x9068('0x13')](function(_0x5a65e9){_0x5c56e2(null,_0x5a65e9?_0x5a65e9['name']:![]);})[_0x9068('0x15')](function(_0x46eec1){_0x5c56e2(_0x46eec1);});};AGIVertices[_0x9068('0x10')][_0x9068('0x56')]=function(_0x5dedd8,_0x5d8e43,_0x5c8106){var _0x33d22c={'role':_0x9068('0x57')};_0x33d22c[_0x5dedd8]=this['channel']['callerid'];this[_0x9068('0xe')][_0x9068('0x56')](_0x33d22c,_0x5d8e43,this[_0x9068('0xd')][_0x9068('0x3f')])[_0x9068('0x13')](function(_0x55ef3b){_0x5c8106(null,_[_0x9068('0x49')](_0x55ef3b)?![]:!![]);})[_0x9068('0x15')](function(_0xab8731){logger[_0x9068('0x2f')](_0xab8731);_0x5c8106(null,![]);});};AGIVertices[_0x9068('0x10')][_0x9068('0x58')]=function(_0x20b3fc,_0x29cb57){var _0x12ff1={'role':_0x9068('0x57')};_0x12ff1[_0x20b3fc]=this[_0x9068('0xd')][_0x9068('0x3d')];this[_0x9068('0xe')]['agentUnpause'](_0x12ff1)[_0x9068('0x13')](function(_0x1f18af){_0x29cb57(null,_['isNil'](_0x1f18af)?![]:!![]);})[_0x9068('0x15')](function(_0x2f0777){logger[_0x9068('0x2f')](_0x2f0777);_0x29cb57(null,![]);});};AGIVertices[_0x9068('0x10')][_0x9068('0x59')]=function(_0x114184,_0x25e16f){var _0x4836cb={'role':'agent'};_0x4836cb[_0x114184]=this[_0x9068('0xd')]['callerid'];this[_0x9068('0xe')][_0x9068('0x59')](_0x4836cb)[_0x9068('0x13')](function(_0x3cceb9){_0x25e16f(null,_[_0x9068('0x49')](_0x3cceb9)?![]:!![]);})[_0x9068('0x15')](function(_0x1d4d2c){logger['error'](_0x1d4d2c);_0x25e16f(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x57bfec,_0xaf4045){var _0x5da182={'role':_0x9068('0x57')};_0x5da182[_0x57bfec]=this[_0x9068('0xd')]['callerid'];var _0x21daf8=_0x57bfec!=_0x9068('0x5a')?util[_0x9068('0x2b')](_0x9068('0x5b'),_0x9068('0x5c'),this[_0x9068('0xd')][_0x9068('0x3d')]):undefined;this[_0x9068('0xe')]['agentLogin'](_0x5da182,_0x21daf8)[_0x9068('0x13')](function(_0x102eb2){_0xaf4045(null,_[_0x9068('0x49')](_0x102eb2)?![]:!![]);})[_0x9068('0x15')](function(_0x15bb67){logger[_0x9068('0x2f')](_0x15bb67);_0xaf4045(null,![]);});};AGIVertices[_0x9068('0x10')][_0x9068('0x5d')]=function(_0x1c4ca7,_0x137321){sh['exec'](_[_0x9068('0x5e')](_0x1c4ca7),function(_0x5bbaf3,_0x51c6e6){var _0x5bebbf=_0x51c6e6[_0x9068('0x5f')](/(\r\n|\n|\r)/gm,'');_0x137321(null,_0x5bebbf);});};AGIVertices[_0x9068('0x10')]['googleCloudTTS']=function(_0x35c528,_0x6edf6d){scripts[_0x9068('0x60')](_0x35c528[_0x9068('0x61')],_0x35c528['google_cloud_tts_text_type']||_0x9068('0x62'),_0x35c528['text'],_0x35c528[_0x9068('0x63')]||_0x9068('0x64'),_0x35c528[_0x9068('0x65')]||_0x9068('0x66'),_0x35c528[_0x9068('0x67')]||_0x9068('0x68'))[_0x9068('0x13')](function(_0x285ea8){_0x6edf6d(null,_0x285ea8);})['catch'](function(_0x2db291){_0x6edf6d(_0x2db291);});};AGIVertices['prototype']['googleTTS']=function(_0x318a7f,_0x3323f0){scripts['googleTTS'](_0x318a7f[_0x9068('0x62')],_0x318a7f[_0x9068('0x69')]||'en',0x1)[_0x9068('0x13')](function(_0x3478d0){_0x3323f0(null,_0x3478d0);})['catch'](function(_0x171e75){_0x3323f0(_0x171e75);});};AGIVertices['prototype'][_0x9068('0x6a')]=function(_0x436e2a,_0x6eb3a4){var _0x47f4fc={'uri':_0x436e2a[_0x9068('0x6b')],'method':_0x436e2a[_0x9068('0x6c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x436e2a[_0x9068('0x6d')])===_0x9068('0x6e')&&parseInt(_0x436e2a[_0x9068('0x6d')])>=0x1?parseInt(_0x436e2a['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x9068('0x6f')](['POST',_0x9068('0x70')],_0x47f4fc[_0x9068('0x6c')][_0x9068('0x71')]())){try{_0x47f4fc[_0x9068('0x72')]=_0x436e2a[_0x9068('0xb')]?JSON[_0x9068('0x73')](_0x436e2a[_0x9068('0xb')]):{};}catch(_0x46838c){logger[_0x9068('0x2f')](_0x9068('0x74'),_0x46838c);}}try{_0x47f4fc['headers']=_0x436e2a[_0x9068('0x75')]?JSON[_0x9068('0x73')](_0x436e2a[_0x9068('0x75')]):{};}catch(_0x59c254){logger['error'](_0x9068('0x76'),_0x59c254);}if(_0x436e2a[_0x9068('0x77')]){try{var _0x1ffeb8=require(_0x436e2a[_0x9068('0x77')])[_0x9068('0x78')](this,_0x47f4fc);_0x47f4fc[_0x9068('0x79')]=Mustache[_0x9068('0x7a')](_0x436e2a[_0x9068('0x6b')],_0x1ffeb8,{},['$$','$$']);if(_0x47f4fc[_0x9068('0x7b')]){_0x47f4fc[_0x9068('0x7b')]=JSON[_0x9068('0x73')](Mustache[_0x9068('0x7a')](JSON[_0x9068('0x7c')](_0x47f4fc[_0x9068('0x7b')]),_0x1ffeb8,{},['$$','$$']));}if(_0x47f4fc[_0x9068('0x72')]){_0x47f4fc[_0x9068('0x72')]=JSON[_0x9068('0x73')](Mustache[_0x9068('0x7a')](JSON['stringify'](_0x47f4fc[_0x9068('0x72')]),_0x1ffeb8,{},['$$','$$']));}}catch(_0x7a4b55){logger[_0x9068('0x2f')](_0x9068('0x7d'),_0x7a4b55);}}rp(_0x47f4fc)[_0x9068('0x13')](function(_0x50240a){var _0x1f11d7={'statusCode':_0x50240a['statusCode']||0xc8,'statusMessage':_0x50240a[_0x9068('0x7e')]||'OK','headers':_0x50240a[_0x9068('0x7b')]||{},'body':_0x50240a[_0x9068('0x72')]||{}};_0x6eb3a4(null,_0x1f11d7);})[_0x9068('0x15')](function(_0x137aea){var _0xaef15b={'statusCode':_0x137aea[_0x9068('0x7f')]||0x1f4,'statusMessage':_0x137aea[_0x9068('0x80')]||_0x9068('0x81'),'headers':_0x137aea[_0x9068('0x82')]['headers']||{},'body':_0x137aea['options'][_0x9068('0x72')]||{}};_0x6eb3a4(null,_0xaef15b);});};AGIVertices['prototype'][_0x9068('0x83')]=function(_0x573216,_0x49dae4){scripts['googleDialogflow'](this[_0x9068('0xd')][_0x9068('0x3f')],_0x573216[_0x9068('0x84')],_0x573216[_0x9068('0x62')],_0x573216['dialogflow_language']||'en')[_0x9068('0x13')](function(_0x398863){_0x49dae4(null,_0x398863);})[_0x9068('0x15')](function(_0x5705fd){_0x49dae4(_0x5705fd);});};AGIVertices[_0x9068('0x10')]['googleDialogflowV2']=function(_0x2d9ae4,_0x130e1f){scripts[_0x9068('0x85')](this[_0x9068('0xd')][_0x9068('0x3f')],_0x2d9ae4[_0x9068('0x86')],_0x2d9ae4['client_email'],_0x2d9ae4[_0x9068('0x87')],_0x2d9ae4[_0x9068('0x62')],_0x2d9ae4[_0x9068('0x88')]||'en')[_0x9068('0x13')](function(_0x8e8abb){_0x130e1f(null,_0x8e8abb);})[_0x9068('0x15')](function(_0x256f7e){_0x130e1f(_0x256f7e);});};AGIVertices[_0x9068('0x10')][_0x9068('0x89')]=function(_0x49c0bd,_0x3463a7){scripts[_0x9068('0x89')](this[_0x9068('0xd')],_0x49c0bd)[_0x9068('0x13')](function(_0x15016b){_0x3463a7(null,_0x15016b);})[_0x9068('0x15')](function(_0x515170){_0x3463a7(_0x515170);});};AGIVertices[_0x9068('0x10')][_0x9068('0x8a')]=function(_0xf45df,_0x2984cd){scripts[_0x9068('0x8a')](_0xf45df[_0x9068('0x84')],_0xf45df[_0x9068('0x62')],_0xf45df[_0x9068('0x8b')]||_0x9068('0x64'),_0xf45df[_0x9068('0x8c')])[_0x9068('0x13')](function(_0x383821){_0x2984cd(null,_0x383821);})[_0x9068('0x15')](function(_0x1ba2f2){_0x2984cd(_0x1ba2f2);});};AGIVertices[_0x9068('0x10')][_0x9068('0x8d')]=function(_0x2a322b,_0x5f21a9,_0x485b69){scripts[_0x9068('0x8d')](_0x5f21a9,_0x2a322b[_0x9068('0x84')],_0x2a322b['ispeech_asr_language']||_0x9068('0x64'),this[_0x9068('0x8e')](_0x2a322b[_0x9068('0x8f')])?_0x2a322b['model']:undefined)[_0x9068('0x13')](function(_0x247cf9){_0x485b69(null,_0x247cf9);})[_0x9068('0x15')](function(_0x497919){_0x485b69(_0x497919);});};AGIVertices[_0x9068('0x10')]['awsPolly']=function(_0x1d8a3f,_0x5b7fa6){scripts[_0x9068('0x90')](_0x1d8a3f[_0x9068('0x91')],_0x1d8a3f['aws_secret_access_key'],_0x1d8a3f[_0x9068('0x92')],_0x1d8a3f[_0x9068('0x93')]||'Amy',_0x1d8a3f[_0x9068('0x62')],_0x1d8a3f['aws_text_type']||_0x9068('0x62'))[_0x9068('0x13')](function(_0x28fa9f){_0x5b7fa6(null,_0x28fa9f);})[_0x9068('0x15')](function(_0x12e73d){_0x5b7fa6(_0x12e73d);});};AGIVertices[_0x9068('0x10')][_0x9068('0x94')]=function(_0x34e8fd,_0xb3b134){scripts[_0x9068('0x94')](this['channel'][_0x9068('0x3f')],_0x34e8fd['aws_access_key_id'],_0x34e8fd[_0x9068('0x95')],_0x34e8fd[_0x9068('0x96')],_0x34e8fd['text'],_0x34e8fd[_0x9068('0x97')])[_0x9068('0x13')](function(_0x530e74){_0xb3b134(null,_0x530e74);})[_0x9068('0x15')](function(_0x1b7a8c){_0xb3b134(_0x1b7a8c);});};AGIVertices[_0x9068('0x10')][_0x9068('0x98')]=function(_0x549040,_0x2c4113,_0x35c448){scripts[_0x9068('0x98')](_0x2c4113,_0x549040[_0x9068('0x84')],_0x549040[_0x9068('0x99')]||_0x9068('0x64'))[_0x9068('0x13')](function(_0x5969d1){_0x35c448(null,_0x5969d1);})[_0x9068('0x15')](function(_0x486de7){_0x35c448(_0x486de7);});};AGIVertices[_0x9068('0x10')][_0x9068('0x9a')]=function(_0x43b3f3,_0x1aa9fe,_0x3b837e){scripts['tildeASR'](_0x1aa9fe,_0x43b3f3[_0x9068('0x9b')],_0x43b3f3[_0x9068('0x9c')],_0x43b3f3[_0x9068('0x79')])[_0x9068('0x13')](function(_0x28e3bc){_0x3b837e(null,_0x28e3bc);})['catch'](function(_0x207767){_0x3b837e(_0x207767);});};AGIVertices[_0x9068('0x10')][_0x9068('0x9d')]=function(_0x5699f1){var _0x465848=_['includes'](verticesWithRetry,_0x5699f1[_0x9068('0x3b')])?_0x5699f1:_[_0x9068('0x9e')](_0x5699f1);for(var _0x362589 in _0x465848){if(_0x465848[_0x9068('0x9f')](_0x362589)){if(_0x465848[_0x362589]&&_['isString'](_0x465848[_0x362589])){if(_['includes'](recursiveMapAttributes,_0x362589)){_0x465848[_0x362589]=this[_0x9068('0xa0')](_0x465848[_0x362589]);}else{_0x465848[_0x362589]=this[_0x9068('0xa1')](_0x465848[_0x362589]);}}}}return _0x465848;};AGIVertices[_0x9068('0x10')][_0x9068('0xa2')]=function(_0x4abdbb){for(var _0x1a4a08 in _0x4abdbb){if(_0x4abdbb['hasOwnProperty'](_0x1a4a08)){if(_[_0x9068('0xa3')](_0x4abdbb[_0x1a4a08])){this[_0x9068('0xa2')](_0x4abdbb[_0x1a4a08]);}else if(_['isArray'](_0x4abdbb[_0x1a4a08])){for(var _0x5d68c1=0x0;_0x5d68c1<_0x4abdbb[_0x1a4a08][_0x9068('0xa4')];_0x5d68c1++){this['recursiveNodeIndex'](_0x4abdbb[_0x1a4a08][_0x5d68c1]);}}else if(_[_0x9068('0xa5')](_0x4abdbb[_0x1a4a08])){_0x4abdbb[_0x1a4a08]=this['replaceAllVariables'](_0x4abdbb[_0x1a4a08]);}}}};AGIVertices[_0x9068('0x10')][_0x9068('0xa6')]=function(_0x117cc5,_0x1fa15c){for(var _0x3a3dcf in _0x117cc5){if(_0x117cc5[_0x9068('0x9f')](_0x3a3dcf)){if(_[_0x9068('0xa3')](_0x117cc5[_0x3a3dcf])){if(!_['isEmpty'](_0x117cc5[_0x3a3dcf])){this[_0x9068('0xa6')](_0x117cc5[_0x3a3dcf],util[_0x9068('0x2b')]('%s.%s',_0x1fa15c,_0x3a3dcf));}}else if(_[_0x9068('0xa7')](_0x117cc5[_0x3a3dcf])){for(var _0x13798b=0x0;_0x13798b<_0x117cc5[_0x3a3dcf][_0x9068('0xa4')];_0x13798b++){this['saveRestApiResult'](_0x117cc5[_0x3a3dcf][_0x13798b],util[_0x9068('0x2b')](_0x9068('0xa8'),_0x1fa15c,_0x3a3dcf+'['+_0x13798b+']'));}}else{if(!_['isNil'](_0x117cc5[_0x3a3dcf])){this['channel'][_0x9068('0xa9')](util[_0x9068('0x2b')](_0x9068('0xa8'),_0x1fa15c,_0x3a3dcf),_0x117cc5[_0x3a3dcf]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0xdd83dc){try{var _0x7017b7=JSON[_0x9068('0x73')](_0xdd83dc);this[_0x9068('0xa2')](_0x7017b7);return JSON[_0x9068('0x7c')](_0x7017b7);}catch(_0x2d51d9){return this[_0x9068('0xa1')](_0xdd83dc);}};AGIVertices['prototype'][_0x9068('0xa1')]=function(_0x2cc718){var _0x5bb0b9=_0x2cc718[_0x9068('0xaa')]('{');for(var _0x3c5f15=0x1;_0x3c5f15<_0x5bb0b9[_0x9068('0xa4')];_0x3c5f15+=0x1){var _0x2f2d12=_0x5bb0b9[_0x3c5f15][_0x9068('0xaa')]('}');if(_0x2f2d12[_0x9068('0xa4')]>0x1){_0x2cc718=_0x2cc718[_0x9068('0xab')]('{'+_0x2f2d12[0x0]+'}',this['channel'][_0x9068('0x11')](_0x2f2d12[0x0])[_0x9068('0xac')]||_0x2f2d12[0x0]);}}if(_0x5bb0b9['length']===0x1){return _0x2cc718[_0x9068('0x52')]();}return this[_0x9068('0xa1')](_0x2cc718);};AGIVertices[_0x9068('0x10')][_0x9068('0xad')]=function(_0x585e6a,_0x409c85){var _0xab511c=this[_0x9068('0xd')]['getVariable'](_0x585e6a);if(_0xab511c[_0x9068('0xae')]===-0x1){return _0xab511c;}logger[_0x9068('0x32')](util['format'](_0x9068('0xaf'),_0x409c85,_0xab511c['extra']));return this[_0x9068('0xd')][_0x9068('0xa9')](_0x409c85,_0xab511c[_0x9068('0xac')]);};AGIVertices[_0x9068('0x10')]['isConfigured']=function(_0x4401b9){return _0x4401b9&&_0x4401b9!=='0'&&_0x4401b9!=='-1'&&_0x4401b9!=='';};AGIVertices[_0x9068('0x10')][_0x9068('0xb0')]=function(_0x1d1fd6){this[_0x9068('0x3a')][_0x9068('0x78')](this,_0x1d1fd6,'-');_0x1d1fd6[_0x9068('0xb1')]=_0x1d1fd6[_0x9068('0xb0')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x9068('0xb2')]=function(_0x1a6edc){logger[_0x9068('0x32')](util[_0x9068('0x2b')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x1a6edc[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x1a6edc[_0x9068('0x62')])){return this[_0x9068('0xd')][_0x9068('0xb4')]('no\x20text\x20configured');}var _0x695efa='\x22'+_0x1a6edc[_0x9068('0x62')]+'\x22';if(this[_0x9068('0x8e')](_0x1a6edc[_0x9068('0x82')])){_0x695efa+=','+_0x1a6edc[_0x9068('0x82')];}var _0x3ae3f3=this['channel'][_0x9068('0xb5')](_0x9068('0xb6'),_0x695efa);if(_0x3ae3f3[_0x9068('0xae')]===-0x1){return _0x3ae3f3;}return this['channel']['noop'](util[_0x9068('0x2b')](_0x9068('0xb7'),_0x695efa));};AGIVertices[_0x9068('0x10')][_0x9068('0xb8')]=function(_0x566bce){logger['info'](util['format'](_0x9068('0xb9'),_0x566bce['label']));if(!this['isConfigured'](_0x566bce['grammar'])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xba'));}var _0xc844a3=_0x566bce[_0x9068('0xbb')];if(this[_0x9068('0x8e')](_0x566bce[_0x9068('0x82')])){_0xc844a3+=','+_0x566bce[_0x9068('0x82')];}var _0x3559a5=this[_0x9068('0xd')]['exec'](_0x9068('0xbc'),_0xc844a3);if(_0x3559a5[_0x9068('0xae')]===-0x1){return _0x3559a5;}var _0x47c216=this[_0x9068('0xad')](_0x9068('0xbd'),_0x9068('0xbe'));if(_0x47c216[_0x9068('0xae')]===-0x1){return _0x47c216;}var _0xbacb5d=this[_0x9068('0xad')](_0x9068('0xbf'),_0x9068('0xc0'));if(_0xbacb5d['result']===-0x1){return _0xbacb5d;}var _0x38c214=this[_0x9068('0xad')](_0x9068('0xc1'),_0x9068('0xc2'));if(_0x38c214[_0x9068('0xae')]===-0x1){return _0x38c214;}return this['channel'][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0xc3'),_0xc844a3));};AGIVertices[_0x9068('0x10')][_0x9068('0x7')]=function(_0x14b06d){logger[_0x9068('0x32')](util['format'](_0x9068('0xc4'),_0x14b06d[_0x9068('0xb3')]));return this[_0x9068('0xd')][_0x9068('0x7')]([_0x14b06d[_0x9068('0xc5')],_0x14b06d[_0x9068('0xc6')]]);};AGIVertices['prototype'][_0x9068('0xc7')]=function(_0x3f6b18){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0xc8'),_0x3f6b18['label']));if(this['isConfigured'](_0x3f6b18[_0x9068('0x6d')])){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0xc9'),_0x3f6b18[_0x9068('0x6d')]));var _0x48b867=this[_0x9068('0xd')]['wait'](_0x3f6b18[_0x9068('0x6d')]);if(_0x48b867[_0x9068('0xae')]===-0x1){return _0x48b867;}}return this[_0x9068('0xd')]['answer']();};AGIVertices[_0x9068('0x10')][_0x9068('0x4f')]=function(_0xd3bc17){logger[_0x9068('0x32')](util['format'](_0x9068('0xca'),_0xd3bc17[_0x9068('0xb3')]));if(!this['isConfigured'](_0xd3bc17[_0x9068('0x4e')])){return this[_0x9068('0xd')][_0x9068('0x2f')](_0xd3bc17,_0x9068('0xcb'));}_0xd3bc17[_0x9068('0x51')]=moment();if(this['isConfigured'](_0xd3bc17[_0x9068('0xcc')])){_0xd3bc17[_0x9068('0x51')]=moment()[_0x9068('0xcd')](_0xd3bc17['delay'],'minutes');}if(!this[_0x9068('0x8e')](_0xd3bc17['callback_priority'])){_0xd3bc17[_0x9068('0x53')]=0x2;}this[_0x9068('0x47')]['sync'](this,_0xd3bc17);return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xd3bc17[_0x9068('0x4d')],_0xd3bc17[_0x9068('0x4e')],_0xd3bc17[_0x9068('0x51')]));};AGIVertices[_0x9068('0x10')][_0x9068('0xce')]=function(_0x2689ec){logger[_0x9068('0x32')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2689ec[_0x9068('0xb3')]));var _0x2b05d9=this[_0x9068('0xd')][_0x9068('0xb5')](_0x2689ec['application'],_0x2689ec[_0x9068('0x82')]);if(_0x2b05d9[_0x9068('0xae')]===-0x1){return _0x2b05d9;}return this[_0x9068('0xd')]['noop'](util[_0x9068('0x2b')]('Executed\x20command\x20%s\x20%s',_0x2689ec[_0x9068('0xcf')],_0x2689ec[_0x9068('0x82')]));};AGIVertices[_0x9068('0x10')][_0x9068('0xd0')]=function(_0x14fb59){logger['info'](util[_0x9068('0x2b')](_0x9068('0xd1'),_0x14fb59['label']));if(!this[_0x9068('0x8e')](_0x14fb59['text'])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xd2'));}var _0x31feb8='\x22'+_0x14fb59['text']+'\x22';if(this['isConfigured'](_0x14fb59[_0x9068('0x82')])){_0x31feb8+=','+_0x14fb59[_0x9068('0x82')];}var _0x2095f0=this[_0x9068('0xd')][_0x9068('0xb5')](_0x9068('0xb6'),_0x31feb8);if(_0x2095f0[_0x9068('0xae')]===-0x1){return _0x2095f0;}return this[_0x9068('0xd')]['noop'](util[_0x9068('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x31feb8));};AGIVertices['prototype'][_0x9068('0xd3')]=function(_0x443e4d){logger['info'](util[_0x9068('0x2b')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x443e4d[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x443e4d[_0x9068('0x62')])){return this['channel'][_0x9068('0xb4')](_0x9068('0xd2'));}var _0x50e954='\x22'+_0x443e4d[_0x9068('0x62')]+'\x22';if(this[_0x9068('0x8e')](_0x443e4d['options'])){_0x50e954+=','+_0x443e4d[_0x9068('0x82')];}var _0x4ff41f=this[_0x9068('0xd')][_0x9068('0xb5')]('MRCPSynth',_0x50e954);if(_0x4ff41f['result']===-0x1){return _0x4ff41f;}return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0xb7'),_0x50e954));};AGIVertices[_0x9068('0x10')]['lumenvoxasr']=function(_0x368e4f){logger[_0x9068('0x32')](util[_0x9068('0x2b')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x368e4f[_0x9068('0xb3')]));if(!this['isConfigured'](_0x368e4f['grammar'])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xba'));}var _0x2c84f3=_0x368e4f[_0x9068('0xbb')];if(this[_0x9068('0x8e')](_0x368e4f[_0x9068('0x82')])){_0x2c84f3+=','+_0x368e4f[_0x9068('0x82')];}var _0x53b2cf=this['channel'][_0x9068('0xb5')](_0x9068('0xbc'),_0x2c84f3);if(_0x53b2cf[_0x9068('0xae')]===-0x1){return _0x53b2cf;}var _0x4cdf6c=this[_0x9068('0xad')](_0x9068('0xbd'),_0x9068('0xd4'));if(_0x4cdf6c[_0x9068('0xae')]===-0x1){return _0x4cdf6c;}var _0x187af5=this[_0x9068('0xad')](_0x9068('0xbf'),_0x9068('0xd5'));if(_0x187af5[_0x9068('0xae')]===-0x1){return _0x187af5;}var _0x299051=this['getAndSetVariable'](_0x9068('0xc1'),'LUMENVOX_ASR_INSTANCE');if(_0x299051[_0x9068('0xae')]===-0x1){return _0x299051;}return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2c84f3));};AGIVertices['prototype']['sestekasr']=function(_0x3f4729){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0xd6'),_0x3f4729[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x3f4729[_0x9068('0xbb')])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xba'));}var _0x43a5f7=_0x3f4729[_0x9068('0xbb')];if(this[_0x9068('0x8e')](_0x3f4729[_0x9068('0x82')])){_0x43a5f7+=','+_0x3f4729[_0x9068('0x82')];}var _0x2da3e0=this[_0x9068('0xd')][_0x9068('0xb5')](_0x9068('0xbc'),_0x43a5f7);if(_0x2da3e0[_0x9068('0xae')]===-0x1){return _0x2da3e0;}var _0x4b2b09=this[_0x9068('0xad')](_0x9068('0xbd'),_0x9068('0xd7'));if(_0x4b2b09[_0x9068('0xae')]===-0x1){return _0x4b2b09;}var _0x268551=this[_0x9068('0xad')](_0x9068('0xbf'),_0x9068('0xd8'));if(_0x268551[_0x9068('0xae')]===-0x1){return _0x268551;}var _0x33aa56=this[_0x9068('0xad')](_0x9068('0xc1'),_0x9068('0xd9'));if(_0x33aa56['result']===-0x1){return _0x33aa56;}return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0xc3'),_0x43a5f7));};AGIVertices[_0x9068('0x10')]['database']=function(_0x51ee0c){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0xda'),_0x51ee0c[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x51ee0c[_0x9068('0xdb')])){return this[_0x9068('0xd')]['error'](_0x51ee0c,'no\x20database\x20selected');}var _0x161834=this[_0x9068('0x1a')][_0x9068('0x78')](this,_0x51ee0c[_0x9068('0xdb')]);if(!_0x161834){return this[_0x9068('0xd')]['error'](_0x51ee0c,_0x9068('0xdc'));}if(!this[_0x9068('0x8e')](_0x51ee0c[_0x9068('0x31')])){return this['channel']['error'](_0x51ee0c,_0x9068('0xdd'));}var _0xe9ee85=_0x51ee0c[_0x9068('0x31')][_0x9068('0x5f')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9068('0xd')][_0x9068('0xb4')](util['format'](_0x9068('0xde'),_0xe9ee85));var _0x8e3ce9=this[_0x9068('0x2d')][_0x9068('0x78')](this,_0x161834,_0xe9ee85);this[_0x9068('0x3a')][_0x9068('0x78')](this,_0x51ee0c,_0xe9ee85);if(!this[_0x9068('0x8e')](_0x51ee0c['variable_id'])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xdf'));}var _0x5c7d5d=this[_0x9068('0x11')]['sync'](this,_0x51ee0c[_0x9068('0xe0')]);if(!_0x5c7d5d){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x51ee0c,'no\x20variable\x20found');}var _0xfa20ba=this;_0x8e3ce9[_0x9068('0xe1')](function(_0x4eaf0d,_0x4a0860){Object['keys'](_0x4eaf0d)[_0x9068('0xe1')](function(_0x30529e){_0xfa20ba['channel'][_0x9068('0xa9')](util[_0x9068('0x2b')]('%s[%s][%s]',_0x5c7d5d,_0x4a0860,_0x30529e),_0x4eaf0d[_0x30529e]);});});this[_0x9068('0xd')]['setVariable'](util[_0x9068('0x2b')](_0x9068('0xe2'),_0x5c7d5d),_0x8e3ce9[_0x9068('0xa4')]);return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0xe3'),_0x5c7d5d));};AGIVertices[_0x9068('0x10')]['dial']=function(_0xfea464){logger[_0x9068('0xe4')](util[_0x9068('0x2b')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xfea464[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0xfea464[_0x9068('0xe5')])){return this[_0x9068('0xd')][_0x9068('0x2f')](_0xfea464,_0x9068('0xe6'));}var _0x4e2457=this['getUser'][_0x9068('0x78')](this,_0xfea464[_0x9068('0xe5')]);if(!_0x4e2457){return this[_0x9068('0xd')]['error'](_0xfea464,'no\x20user\x20found');}var _0x54db44=this[_0x9068('0xd')][_0x9068('0xb5')](_0x9068('0xe7'),[util['format'](_0x9068('0xe8'),_0x4e2457),_0xfea464[_0x9068('0x6d')],_0xfea464['opts'],_0xfea464[_0x9068('0x6b')]]);if(_0x54db44[_0x9068('0xae')]===-0x1){return _0x54db44;}return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0xe9'),'DIAL'));};AGIVertices[_0x9068('0x10')][_0x9068('0xea')]=function(_0x40a993){logger['info'](util[_0x9068('0x2b')](_0x9068('0xeb'),_0x40a993[_0x9068('0xb3')]));if(!this['isConfigured'](_0x40a993[_0x9068('0x84')])){return this['channel'][_0x9068('0xb4')](_0x9068('0xec'));}if(!this[_0x9068('0x8e')](_0x40a993[_0x9068('0x62')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x9068('0xd')][_0x9068('0xed')]=!![];this[_0x9068('0x3a')](_0x40a993);this['createSquareMessage'](_0x40a993[_0x9068('0x62')],'in','','');this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')]('Trying\x20Dialogflow:\x20%s',_0x40a993[_0x9068('0x62')]));var _0x2407d9=this[_0x9068('0x83')][_0x9068('0x78')](this,_0x40a993);if(_0x2407d9){for(var _0x5ba24c in _0x2407d9){if(_0x2407d9[_0x9068('0x9f')](_0x5ba24c)){this['channel'][_0x9068('0xa9')](util[_0x9068('0x2b')](_0x9068('0xee'),_0x5ba24c['toUpperCase']()),_0x2407d9[_0x5ba24c]);}}this[_0x9068('0x46')](_0x2407d9['speech'],_0x9068('0xef'),_0x9068('0xea'),'');return this['channel']['noop'](util['format']('Dialogflow\x20Result\x20%s',_0x2407d9[_0x9068('0xf0')]));}return this[_0x9068('0xd')][_0x9068('0x2f')](_0x40a993,_0x9068('0xf1'));};AGIVertices[_0x9068('0x10')][_0x9068('0xf2')]=function(_0x169df7){logger[_0x9068('0x32')](util['format'](_0x9068('0xf3'),_0x169df7['label']));if(!this[_0x9068('0x8e')](_0x169df7[_0x9068('0x86')])){return this['channel'][_0x9068('0xb4')](_0x9068('0xf4'));}if(!this[_0x9068('0x8e')](_0x169df7[_0x9068('0xf5')])){return this['channel'][_0x9068('0xb4')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x169df7['private_key'])){return this['channel'][_0x9068('0xb4')](_0x9068('0xf6'));}if(!this['isConfigured'](_0x169df7[_0x9068('0x88')])){return this['channel'][_0x9068('0xb4')]('no\x20anguage\x20configured');}if(!this[_0x9068('0x8e')](_0x169df7['text'])){return this[_0x9068('0xd')]['noop'](_0x9068('0xd2'));}this[_0x9068('0xd')][_0x9068('0xed')]=!![];this[_0x9068('0x3a')](_0x169df7);this[_0x9068('0x46')](_0x169df7[_0x9068('0x62')],'in','','');this[_0x9068('0xd')]['noop'](util['format'](_0x9068('0xf7'),_0x169df7[_0x9068('0x62')]));var _0xcc6a5f=this[_0x9068('0x85')][_0x9068('0x78')](this,_0x169df7);if(_0xcc6a5f){for(var _0x508a4b in _0xcc6a5f){if(_0xcc6a5f['hasOwnProperty'](_0x508a4b)){if(_0x508a4b!==_0x9068('0xf8')){this[_0x9068('0xd')][_0x9068('0xa9')](util[_0x9068('0x2b')]('DIALOGFLOW_%s',_0x508a4b[_0x9068('0x71')]()),_0xcc6a5f[_0x508a4b]);}}}this['createSquareMessage'](_0xcc6a5f['speech'],_0x9068('0xef'),'dialogflowV2',_0xcc6a5f[_0x9068('0xf8')]);return this['channel'][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0xf9'),_0xcc6a5f['speech']));}return this['channel'][_0x9068('0x2f')](_0x169df7,_0x9068('0xfa'));};AGIVertices[_0x9068('0x10')][_0x9068('0xfb')]=function(_0xcb4d6a){logger[_0x9068('0x32')](util[_0x9068('0x2b')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xcb4d6a['label']));if(!this[_0x9068('0x8e')](_0xcb4d6a[_0x9068('0xfc')])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xfd'));}if(!this[_0x9068('0x8e')](_0xcb4d6a['username'])){return this['channel'][_0x9068('0xb4')](_0x9068('0xfe'));}if(!this['isConfigured'](_0xcb4d6a[_0x9068('0xff')])){return this['channel'][_0x9068('0xb4')](_0x9068('0x100'));}if(!this[_0x9068('0x8e')](_0xcb4d6a[_0x9068('0x101')])){return this['channel'][_0x9068('0xb4')](_0x9068('0xd2'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0xcb4d6a);this[_0x9068('0x46')](_0xcb4d6a[_0x9068('0x62')],'in','','');this[_0x9068('0xd')][_0x9068('0xb4')](util['format']('Trying\x20SestekNDA:\x20%s',_0xcb4d6a[_0x9068('0x62')]));var _0x44d799=this[_0x9068('0x89')]['sync'](this,_0xcb4d6a);if(_0x44d799){for(var _0x93c2c4 in _0x44d799){if(_0x44d799[_0x9068('0x9f')](_0x93c2c4)){this[_0x9068('0xd')][_0x9068('0xa9')](util[_0x9068('0x2b')](_0x9068('0x102'),_0x93c2c4['toUpperCase']()),_0x44d799[_0x93c2c4]);}}this[_0x9068('0x46')](_0x44d799[_0x9068('0xf0')],_0x9068('0xef'),_0x9068('0xfb'),'');if(_0x44d799[_0x9068('0x103')]){this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x44d799[_0x9068('0x103')]));var _0x202361=this['channel']['streamFile'](_0x44d799[_0x9068('0x103')]);try{fs[_0x9068('0x104')](_0x44d799[_0x9068('0x103')]+'.wav');}catch(_0x25dd8e){logger['error'](_0x25dd8e);}return _0x202361;}else{return this[_0x9068('0xd')]['noop'](util['format'](_0x9068('0x105'),_0x44d799[_0x9068('0xf0')]));}}return this[_0x9068('0xd')][_0x9068('0x2f')](_0xcb4d6a,_0x9068('0x106'));};AGIVertices[_0x9068('0x10')]['end']=function(_0x309497){logger[_0x9068('0x32')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x309497[_0x9068('0xb3')]));return this[_0x9068('0xd')][_0x9068('0xb4')]('end');};AGIVertices[_0x9068('0x10')][_0x9068('0x107')]=function(_0x461b94){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x108'),_0x461b94[_0x9068('0xb3')]));var _0x3d9aa4='';if(_0x461b94[_0x9068('0x109')]){if(!this[_0x9068('0x8e')](_0x461b94[_0x9068('0x109')])){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x461b94,_0x9068('0x10a'));}else{var _0x4e8cd5=parseInt(_0x461b94['trunk_id'],0xa);if(isNaN(_0x4e8cd5)){_0x3d9aa4=_0x461b94['trunk_id'];}else{_0x3d9aa4=this[_0x9068('0x1d')][_0x9068('0x78')](this,_0x461b94[_0x9068('0x109')]);if(!_0x3d9aa4){return this[_0x9068('0xd')]['error'](_0x461b94,_0x9068('0x10b'));}}}}else if(_0x461b94[_0x9068('0x10c')]){_0x3d9aa4=_0x461b94['trunk_name'];}else{return this[_0x9068('0xd')][_0x9068('0x2f')](_0x461b94,'no\x20trunk\x20selected');}var _0x10da1d=this[_0x9068('0xd')][_0x9068('0xb5')](_0x9068('0xe7'),[util[_0x9068('0x2b')](_0x9068('0x10d'),_0x3d9aa4,_0x461b94[_0x9068('0x4d')]),_0x461b94[_0x9068('0x6d')],_0x461b94[_0x9068('0x10e')],_0x461b94[_0x9068('0x6b')]]);if(_0x10da1d[_0x9068('0xae')]===-0x1){return _0x10da1d;}return this['channel']['noop'](util['format'](_0x9068('0xe9'),_0x9068('0xe7')));};AGIVertices[_0x9068('0x10')]['finally']=function(_0x210138){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x10f'),_0x210138[_0x9068('0xb3')]));return this['channel'][_0x9068('0xb4')]('finally');};AGIVertices[_0x9068('0x10')]['getdigits']=function(_0x384b24){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x110'),_0x384b24[_0x9068('0xb3')]));if(_0x384b24[_0x9068('0xb1')]===0x0){return this['maxRetry'](_0x384b24);}_0x384b24[_0x9068('0xb1')]-=0x1;if(!this[_0x9068('0x8e')](_0x384b24['file_id'])){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x384b24,_0x9068('0x111'));}var _0xc3db7e=this[_0x9068('0x1f')][_0x9068('0x78')](this,_0x384b24[_0x9068('0x112')]);if(!_0xc3db7e){return this['channel'][_0x9068('0x2f')](_0x384b24,'no\x20file\x20audio\x20found');}if(!this[_0x9068('0x8e')](_0x384b24[_0x9068('0xe0')])){return this['channel'][_0x9068('0x2f')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x8aca04=this[_0x9068('0xd')][_0x9068('0x113')](_0xc3db7e,_0x384b24['response'],_0x384b24['maxdigit']);var _0x3f1a1d=_0x8aca04[_0x9068('0xae')]?_0x8aca04[_0x9068('0xae')][_0x9068('0x52')]():'';logger[_0x9068('0x32')](_0x9068('0x114'),JSON[_0x9068('0x7c')](_0x8aca04));if(_0x8aca04['result']===-0x1){this[_0x9068('0x3a')][_0x9068('0x78')](this,_0x384b24,_0x3f1a1d);return _0x8aca04;}else if(_0x8aca04[_0x9068('0xac')]===_0x9068('0x6d')){_0x8aca04[_0x9068('0xae')]=_0x3f1a1d[_0x9068('0xa4')]>=parseInt(_0x384b24[_0x9068('0x115')])?'x':'i';}else{_0x8aca04['result']=_0x3f1a1d[_0x9068('0xa4')]>=parseInt(_0x384b24[_0x9068('0x115')])&&_0x3f1a1d[_0x9068('0xa4')]<=parseInt(_0x384b24[_0x9068('0x116')])?'x':'i';}var _0x26a78f=this[_0x9068('0x11')]['sync'](this,_0x384b24['variable_id']);if(!_0x26a78f){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x384b24,_0x9068('0x117'));}this[_0x9068('0xd')][_0x9068('0xa9')](_0x26a78f,_0x3f1a1d);if(this[_0x9068('0x8e')](_0x384b24[_0x9068('0x118')])){var _0x5e365c=parseInt(_0x384b24[_0x9068('0x118')],0xa);var _0x42393f=rs[_0x9068('0x119')]({'charset':'*','length':_0x5e365c});var _0x541534=_0x3f1a1d['length'];if(_0x541534>0x0){if(_0x541534>_0x5e365c){this[_0x9068('0x3a')]['sync'](this,_0x384b24,_0x384b24[_0x9068('0x11a')]===_0x9068('0x11b')?_0x42393f+_0x3f1a1d['substr'](_0x5e365c):_0x3f1a1d[_0x9068('0x11c')](0x0,_0x541534-_0x5e365c)+_0x42393f);}else{this[_0x9068('0x3a')][_0x9068('0x78')](this,_0x384b24,rs[_0x9068('0x119')]({'charset':'*','length':_0x541534}));}}else{this[_0x9068('0x3a')][_0x9068('0x78')](this,_0x384b24,'');}}else{this[_0x9068('0x3a')][_0x9068('0x78')](this,_0x384b24,_0x3f1a1d);}return _0x8aca04;};AGIVertices[_0x9068('0x10')][_0x9068('0xc')]=function(_0x34425a){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x11d'),_0x34425a[_0x9068('0xb3')]));return this[_0x9068('0x11e')](_0x34425a);};AGIVertices[_0x9068('0x10')][_0x9068('0x11f')]=function(_0x2e61ae){logger[_0x9068('0x32')](util[_0x9068('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x2e61ae['label']));this[_0x9068('0x3a')][_0x9068('0x78')](this,_0x2e61ae,_0x2e61ae[_0x9068('0x120')]);return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')]('GOAL\x20%s',_0x2e61ae[_0x9068('0x120')]));};AGIVertices['prototype']['awspolly']=function(_0x266635){logger[_0x9068('0x32')](util[_0x9068('0x2b')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x266635[_0x9068('0xb3')]));if(!this['isConfigured'](_0x266635['aws_access_key_id'])||!this[_0x9068('0x8e')](_0x266635['aws_secret_access_key'])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0x121'));}if(!this[_0x9068('0x8e')](_0x266635['text'])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xd2'));}this[_0x9068('0xd')][_0x9068('0xb4')](util['format'](_0x9068('0x122'),_0x266635[_0x9068('0x62')]));var _0x47910e=this['awsPolly'][_0x9068('0x78')](this,_0x266635);if(_0x47910e){this['channel'][_0x9068('0xb4')](util['format'](_0x9068('0x123'),_0x47910e));var _0x13ff0a=this[_0x9068('0xd')][_0x9068('0x124')](_0x47910e);try{fs[_0x9068('0x104')](_0x47910e+_0x9068('0x125'));}catch(_0x397fd0){logger[_0x9068('0x2f')](_0x397fd0);}return _0x13ff0a;}return this[_0x9068('0xd')][_0x9068('0x2f')](_0x266635,_0x9068('0x126'));};AGIVertices[_0x9068('0x10')][_0x9068('0x127')]=function(_0x51b0c6){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x128'),_0x51b0c6[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x51b0c6[_0x9068('0x91')])||!this[_0x9068('0x8e')](_0x51b0c6[_0x9068('0x95')])){return this['channel'][_0x9068('0xb4')](_0x9068('0x121'));}if(!this[_0x9068('0x8e')](_0x51b0c6[_0x9068('0x97')])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0x129'));}if(!this[_0x9068('0x8e')](_0x51b0c6[_0x9068('0x62')])){return this['channel'][_0x9068('0xb4')](_0x9068('0xd2'));}this[_0x9068('0xd')][_0x9068('0xed')]=!![];this[_0x9068('0x3a')](_0x51b0c6);this['createSquareMessage'](_0x51b0c6[_0x9068('0x62')],'in','','');this['channel']['noop'](util[_0x9068('0x2b')](_0x9068('0x12a'),_0x51b0c6['text']));var _0x212b78=this[_0x9068('0x94')][_0x9068('0x78')](this,_0x51b0c6);if(_0x212b78){for(var _0x36a668 in _0x212b78){if(_0x212b78[_0x9068('0x9f')](_0x36a668)&&_[_0x9068('0xa5')](_0x212b78[_0x36a668])){this[_0x9068('0xd')]['setVariable'](util[_0x9068('0x2b')](_0x9068('0x12b'),_0x36a668['toUpperCase']()),_0x212b78[_0x36a668]);}}if(_['isNil'](_0x212b78[_0x9068('0x80')])){return this[_0x9068('0xd')][_0x9068('0xb4')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x9068('0x46')](_0x212b78['message'],_0x9068('0xef'),_0x9068('0x12c'),'');return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x12d'),_0x212b78['message']));}}return this[_0x9068('0xd')]['error'](_0x51b0c6,_0x9068('0x12e'));};AGIVertices[_0x9068('0x10')][_0x9068('0x12f')]=function(_0x2c8791){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x130'),_0x2c8791[_0x9068('0xb3')],_0x2c8791['timeout']));if(!this[_0x9068('0x8e')](_0x2c8791[_0x9068('0x84')])){return this['channel'][_0x9068('0xb4')](_0x9068('0xec'));}var _0x40b3f9=_0x9068('0x131');var _0x28dda9=util[_0x9068('0x2b')](_0x9068('0x132'),FILES_PATH,rs['generate'](0x4));var _0x3ca27f=util[_0x9068('0x2b')]('%s.%s',_0x28dda9,_0x40b3f9);var _0x189d42=!![];if(_0x2c8791[_0x9068('0x133')]===_0x9068('0x134')){_0x189d42=![];}var _0x57495b=this[_0x9068('0xd')][_0x9068('0x135')](_0x28dda9,_0x40b3f9,_0x2c8791['intKey'],_0x2c8791[_0x9068('0x6d')],undefined,_0x189d42);if(_0x57495b[_0x9068('0xae')]!==-0x1){this['channel']['noop'](util[_0x9068('0x2b')]('google\x20%s\x20file\x20created',_0x3ca27f));var _0x19e37e=this['googleASR']['sync'](this,_0x2c8791,_0x3ca27f);if(_0x19e37e){for(var _0x549720 in _0x19e37e){if(_0x19e37e['hasOwnProperty'](_0x549720)){this[_0x9068('0xd')][_0x9068('0xa9')](util[_0x9068('0x2b')](_0x9068('0x136'),_0x549720[_0x9068('0x71')]()),_0x19e37e[_0x549720]);}}return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x19e37e)));}}return _0x57495b;};AGIVertices[_0x9068('0x10')][_0x9068('0x137')]=function(_0x4f8b36){logger['info'](util['format'](_0x9068('0x138'),_0x4f8b36[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x4f8b36['appid'])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0x139'));}if(!this['isConfigured'](_0x4f8b36[_0x9068('0x9c')])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0x13a'));}var _0x283a32='wav';var _0x447d15=util[_0x9068('0x2b')](_0x9068('0x132'),FILES_PATH,rs[_0x9068('0x119')](0x4));var _0x229a64=util[_0x9068('0x2b')](_0x9068('0xa8'),_0x447d15,_0x283a32);var _0x1c1b90=!![];if(_0x4f8b36[_0x9068('0x133')]===_0x9068('0x134')){_0x1c1b90=![];}var _0x14fe6f=this[_0x9068('0xd')][_0x9068('0x135')](_0x447d15,_0x283a32,_0x4f8b36['intKey'],_0x4f8b36[_0x9068('0x6d')],undefined,_0x1c1b90);if(_0x14fe6f[_0x9068('0xae')]!==-0x1){this[_0x9068('0xd')]['noop'](util[_0x9068('0x2b')]('tilde\x20%s\x20file\x20created',_0x229a64));var _0x13732b=this['tildeASR'][_0x9068('0x78')](this,_0x4f8b36,_0x229a64);if(_0x13732b){for(var _0x1e7be3 in _0x13732b){if(_0x13732b[_0x9068('0x9f')](_0x1e7be3)){this['channel']['setVariable'](util[_0x9068('0x2b')]('TILDE_ASR_%s',_0x1e7be3[_0x9068('0x71')]()),_0x13732b[_0x1e7be3]);}}return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x13b'),JSON[_0x9068('0x7c')](_0x13732b)));}}return _0x14fe6f;};AGIVertices['prototype'][_0x9068('0x13c')]=function(_0x806428){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x13d'),_0x806428[_0x9068('0xb3')]));return this['channel'][_0x9068('0x13e')](_0x806428[_0x9068('0x41')],_0x806428['extension'],_0x806428[_0x9068('0x13f')]);};AGIVertices['prototype'][_0x9068('0x140')]=function(_0x5cbae9){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x141'),_0x5cbae9['label']));if(!this[_0x9068('0x8e')](_0x5cbae9[_0x9068('0x142')])){return this['channel'][_0x9068('0x2f')](_0x5cbae9,_0x9068('0x143'));}try{var _0x4ab966=eval(_0x5cbae9[_0x9068('0x142')])?_0x9068('0x144'):_0x9068('0x145');this['channel'][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x146'),_0x5cbae9[_0x9068('0x142')],_0x4ab966));return{'code':0xc8,'result':_0x4ab966};}catch(_0x3eabd3){return{'code':0xc8,'result':_0x9068('0x145')};}};AGIVertices[_0x9068('0x10')][_0x9068('0x147')]=function(_0x20b808){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x148'),_0x20b808[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x20b808['interval_id'])){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x20b808,'no\x20interval\x20configured');}var _0x1abcbe=this[_0x9068('0x26')]['sync'](this,_0x20b808[_0x9068('0x149')]);if(!_0x1abcbe){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x20b808,_0x9068('0x14a'));}for(var _0x24579c=0x0;_0x24579c<_0x1abcbe[_0x9068('0xa4')];_0x24579c+=0x1){var _0xe96417=this[_0x9068('0xd')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x1abcbe[_0x24579c]));if(_0xe96417[_0x9068('0xae')]===-0x1){return _0xe96417;}logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x14b'),_0x1abcbe[_0x24579c],_0xe96417[_0x9068('0xac')]));if(_0xe96417[_0x9068('0xac')]===_0x9068('0x144')){logger['info'](util[_0x9068('0x2b')](_0x9068('0x14b'),_0x1abcbe[_0x24579c],_0x9068('0x144')));this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x14b'),_0x1abcbe[_0x24579c],_0x9068('0x144')));return{'code':0xc8,'result':_0x9068('0x144')};}else{logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x14b'),_0x1abcbe[_0x24579c],'false'));this['channel']['noop'](util[_0x9068('0x2b')](_0x9068('0x14b'),_0x1abcbe[_0x24579c],_0x9068('0x145')));}}return{'code':0xc8,'result':_0x9068('0x145')};};AGIVertices[_0x9068('0x10')][_0x9068('0x14c')]=function(_0x42cedc){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x14d'),_0x42cedc[_0x9068('0xb3')]));return this[_0x9068('0xd')][_0x9068('0x14c')]();};AGIVertices['prototype'][_0x9068('0x14e')]=function(_0x1890f4){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x14f'),_0x1890f4[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x1890f4[_0x9068('0x84')])){return this['channel'][_0x9068('0xb4')]('no\x20key\x20configured');}var _0x4a217f=_0x9068('0x131');var _0x2061d6=util[_0x9068('0x2b')](_0x9068('0x132'),FILES_PATH,rs[_0x9068('0x119')](0x4));var _0x2f7adc=util[_0x9068('0x2b')](_0x9068('0xa8'),_0x2061d6,_0x4a217f);var _0x396d3f=!![];if(_0x1890f4[_0x9068('0x133')]==='NOBEEP'){_0x396d3f=![];}var _0x1affc8=this[_0x9068('0xd')]['recordFile'](_0x2061d6,_0x4a217f,_0x1890f4[_0x9068('0x150')],_0x1890f4['timeout'],undefined,_0x396d3f);if(_0x1affc8[_0x9068('0xae')]!==-0x1){this['channel'][_0x9068('0xb4')](util['format']('ispeech\x20%s\x20file\x20created',_0x2f7adc));var _0x58c0aa=this[_0x9068('0x8d')][_0x9068('0x78')](this,_0x1890f4,_0x2f7adc);if(_0x58c0aa){for(var _0xd3c11c in _0x58c0aa){if(_0x58c0aa[_0x9068('0x9f')](_0xd3c11c)){this[_0x9068('0xd')]['setVariable'](util[_0x9068('0x2b')](_0x9068('0x151'),_0xd3c11c[_0x9068('0x71')]()),_0x58c0aa[_0xd3c11c]);}}return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x152'),JSON[_0x9068('0x7c')](_0x58c0aa)));}}return _0x1affc8;};AGIVertices[_0x9068('0x10')]['ispeechtts']=function(_0x58f4df){logger['info'](util[_0x9068('0x2b')](_0x9068('0x153'),_0x58f4df[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x58f4df[_0x9068('0x84')])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xec'));}if(!this['isConfigured'](_0x58f4df['text'])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xd2'));}this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')]('Trying\x20ispeech\x20TTS\x20%s',_0x58f4df[_0x9068('0x62')]));var _0x4f4c1d=this['ispeechTTS'][_0x9068('0x78')](this,_0x58f4df);if(_0x4f4c1d){this['channel'][_0x9068('0xb4')](util['format']('ispeech\x20%s\x20file\x20created',_0x4f4c1d));var _0x13ec39=this[_0x9068('0xd')][_0x9068('0x124')](_0x4f4c1d,_0x58f4df[_0x9068('0x150')]);try{fs[_0x9068('0x104')](_0x4f4c1d+'.wav');}catch(_0x4036d2){logger['error'](_0x4036d2);}return _0x13ec39;}return this[_0x9068('0xd')]['error'](_0x58f4df,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x9068('0x10')]['login']=function(_0x48f42d){logger[_0x9068('0x32')](util[_0x9068('0x2b')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x48f42d[_0x9068('0xb3')]));if(!this['isConfigured'](_0x48f42d[_0x9068('0x154')])){return this['channel'][_0x9068('0x2f')](_0x48f42d,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x9068('0x155'),this[_0x9068('0xd')]['callerid'],_0x48f42d[_0x9068('0x154')]));var _0x21501e=this['agentLogin'][_0x9068('0x78')](this,_0x48f42d['findBy']);if(_0x21501e){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x156'),this[_0x9068('0xd')]['callerid'],_0x48f42d['findBy']));this['channel'][_0x9068('0xb4')](util['format'](_0x9068('0x156'),this['channel'][_0x9068('0x3d')],_0x48f42d[_0x9068('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9068('0x32')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9068('0xd')]['callerid'],_0x48f42d[_0x9068('0x154')]));this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x157'),this['channel'][_0x9068('0x3d')],_0x48f42d[_0x9068('0x154')]));return{'code':0xc8,'result':_0x9068('0x158')};}};AGIVertices['prototype']['logout']=function(_0x4778de){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x159'),_0x4778de['label']));if(!this[_0x9068('0x8e')](_0x4778de[_0x9068('0x154')])){return this['channel'][_0x9068('0x2f')](_0x4778de,_0x9068('0x15a'));}logger['info'](util[_0x9068('0x2b')](_0x9068('0x155'),this[_0x9068('0xd')]['callerid'],_0x4778de[_0x9068('0x154')]));var _0x16ae3c=this[_0x9068('0x59')][_0x9068('0x78')](this,_0x4778de['findBy']);if(_0x16ae3c){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x156'),this[_0x9068('0xd')][_0x9068('0x3d')],_0x4778de[_0x9068('0x154')]));this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9068('0xd')][_0x9068('0x3d')],_0x4778de['findBy']));return{'code':0xc8,'result':_0x9068('0x15b')};}else{logger['info'](util[_0x9068('0x2b')](_0x9068('0x157'),this[_0x9068('0xd')][_0x9068('0x3d')],_0x4778de[_0x9068('0x154')]));this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x157'),this[_0x9068('0xd')][_0x9068('0x3d')],_0x4778de[_0x9068('0x154')]));return{'code':0xc8,'result':_0x9068('0x158')};}};AGIVertices['prototype']['math']=function(_0x17e1c7){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x15c'),_0x17e1c7[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x17e1c7[_0x9068('0x15d')])){return this['channel'][_0x9068('0x2f')](_0x17e1c7,_0x9068('0x15e'));}this['channel']['noop'](util[_0x9068('0x2b')]('math\x20%s',_0x17e1c7[_0x9068('0x15d')]));var _0x2854e6=eval(_0x17e1c7[_0x9068('0x15d')]);if(!this[_0x9068('0x8e')](_0x17e1c7['variable_id'])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xdf'));}var _0x3da2a5=this[_0x9068('0x11')][_0x9068('0x78')](this,_0x17e1c7[_0x9068('0xe0')]);if(!_0x3da2a5){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x17e1c7,'no\x20variable\x20found');}if(_[_0x9068('0xa7')](_0x2854e6)){var _0x8ef144=this;_0x2854e6['forEach'](function(_0x131f4e,_0x5adc3f){_0x8ef144[_0x9068('0xd')][_0x9068('0xa9')](util['format'](_0x9068('0x15f'),_0x3da2a5,_0x5adc3f),_0x131f4e);});return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x160'),_0x3da2a5));}else{return this[_0x9068('0xd')][_0x9068('0xa9')](_0x3da2a5,_0x2854e6);}};AGIVertices['prototype'][_0x9068('0x161')]=function(_0x5b92b7){logger[_0x9068('0x32')](util[_0x9068('0x2b')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x5b92b7[_0x9068('0xb3')]));if(_0x5b92b7['retry']===0x0){return this[_0x9068('0xb0')](_0x5b92b7);}_0x5b92b7[_0x9068('0xb1')]-=0x1;if(!this['isConfigured'](_0x5b92b7[_0x9068('0x112')])){return this['channel'][_0x9068('0x2f')](_0x5b92b7,_0x9068('0x111'));}var _0x4a8c79=this[_0x9068('0x1f')][_0x9068('0x78')](this,_0x5b92b7[_0x9068('0x112')]);if(!_0x4a8c79){return this['channel']['error'](_0x5b92b7,'no\x20file\x20audio\x20found');}var _0x1e4270=this[_0x9068('0xd')][_0x9068('0x113')](_0x4a8c79,_0x5b92b7[_0x9068('0x162')],_0x5b92b7[_0x9068('0x163')]);var _0x126608=_0x1e4270[_0x9068('0xae')];if(_0x1e4270[_0x9068('0xae')]===-0x1){this[_0x9068('0x3a')][_0x9068('0x78')](this,_0x5b92b7,'-1');return _0x1e4270;}else if(_0x1e4270[_0x9068('0xac')]===_0x9068('0x6d')){_0x1e4270[_0x9068('0xae')]=_0x1e4270['result'][_0x9068('0xa4')]>0x0?_0x1e4270[_0x9068('0xae')]:'t';}else if(_[_0x9068('0x48')](_0x1e4270[_0x9068('0xae')])){_0x1e4270['result']='#';_0x126608='#';}if(!this[_0x9068('0x8e')](_0x5b92b7[_0x9068('0xe0')])){this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xdf'));}else{var _0x57a8fd=this['getVariable'][_0x9068('0x78')](this,_0x5b92b7[_0x9068('0xe0')]);if(!_0x57a8fd){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x5b92b7,_0x9068('0x117'));}this[_0x9068('0xd')][_0x9068('0xa9')](_0x57a8fd,_0x126608);}this[_0x9068('0x3a')]['sync'](this,_0x5b92b7,_0x126608);return _0x1e4270;};AGIVertices['prototype'][_0x9068('0xb4')]=function(_0x20c49b){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x164'),_0x20c49b['label']));return this['channel'][_0x9068('0xb4')](_0x20c49b['output']||_0x20c49b[_0x9068('0xb3')]);};AGIVertices[_0x9068('0x10')][_0x9068('0x165')]=function(_0x28c812){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x166'),_0x28c812[_0x9068('0xb3')]));if(!this['isConfigured'](_0x28c812[_0x9068('0x154')])){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x28c812,'no\x20find\x20by\x20configured');}logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x155'),this[_0x9068('0xd')]['callerid'],_0x28c812['findBy']));var _0x709232=this[_0x9068('0x54')][_0x9068('0x78')](this,_0x28c812[_0x9068('0x167')]);var _0x2bc73c=this['agentPause']['sync'](this,_0x28c812['findBy'],_0x709232);if(_0x2bc73c){logger['info'](util[_0x9068('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9068('0xd')][_0x9068('0x3d')],_0x28c812['findBy']));this[_0x9068('0xd')][_0x9068('0xb4')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x9068('0xd')]['callerid'],_0x28c812[_0x9068('0x154')]));return{'code':0xc8,'result':_0x9068('0x15b')};}else{logger['info'](util[_0x9068('0x2b')](_0x9068('0x157'),this['channel']['callerid'],_0x28c812['findBy']));this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x9068('0x3d')],_0x28c812[_0x9068('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9068('0x10')][_0x9068('0x168')]=function(_0x57c343){logger['info'](util[_0x9068('0x2b')](_0x9068('0x169'),_0x57c343[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x57c343['file_id'])){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x57c343,_0x9068('0x111'));}var _0x3fe20a=this[_0x9068('0x1f')]['sync'](this,_0x57c343[_0x9068('0x112')]);if(!_0x3fe20a){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x57c343,_0x9068('0x16a'));}var _0x576123=this[_0x9068('0xd')]['exec'](_0x9068('0x16b'),[_0x3fe20a,_0x57c343[_0x9068('0x10e')]]);if(_0x576123[_0x9068('0xae')]===-0x1){return _0x576123;}return this[_0x9068('0xd')][_0x9068('0xb4')](util['format'](_0x9068('0x16c'),_0x9068('0x16b'),_0x3fe20a));};AGIVertices[_0x9068('0x10')]['queue']=function(_0x1930da){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x16d'),_0x1930da[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x1930da['queue_id'])){return this['channel'][_0x9068('0x2f')](_0x1930da,'no\x20queue\x20selected');}var _0x141128='';var _0x684bf4=parseInt(_0x1930da[_0x9068('0x16e')],0xa);if(isNaN(_0x684bf4)){_0x141128=_0x1930da[_0x9068('0x16e')];}else{_0x141128=this[_0x9068('0x16')][_0x9068('0x78')](this,_0x1930da[_0x9068('0x16e')]);if(!_0x141128){return this[_0x9068('0xd')]['error'](_0x1930da,'no\x20queue\x20found');}}var _0x445cc8='';if(this[_0x9068('0x8e')](_0x1930da['file_id'])){var _0x5b901d=this[_0x9068('0x1f')][_0x9068('0x78')](this,_0x1930da[_0x9068('0x112')]);if(_0x5b901d){_0x445cc8=_0x5b901d;}}this[_0x9068('0x3a')][_0x9068('0x78')](this,_0x1930da,_0x141128);if(_0x1930da['opts'][_0x9068('0x16f')]('x')<0x0){_0x1930da[_0x9068('0x10e')]+='x';}if(_0x1930da[_0x9068('0x10e')][_0x9068('0x16f')]('X')<0x0){_0x1930da[_0x9068('0x10e')]+='X';}this[_0x9068('0xd')]['setVariable']('XMCS-QUEUE',_0x141128?_0x141128[_0x9068('0x170')]():'');var _0x6340ef=this['channel']['exec'](_0x9068('0x171'),[_0x141128,_0x1930da['opts'],_0x1930da['url'],_0x445cc8,_0x1930da[_0x9068('0x6d')],_0x1930da[_0x9068('0x7')],_0x1930da['macro'],_0x1930da[_0x9068('0x172')],'',_0x1930da[_0x9068('0x173')]]);if(_0x6340ef['result']===-0x1){return _0x6340ef;}return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x16c'),'QUEUE',_0x141128));};AGIVertices[_0x9068('0x10')][_0x9068('0x174')]=function(_0x362437){logger['info'](util[_0x9068('0x2b')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x362437[_0x9068('0xb3')]));var _0x34e3e1=_0x362437[_0x9068('0x175')]||_0x9068('0x131');var _0x3ee549=util['format'](_0x9068('0x176'),this[_0x9068('0xd')][_0x9068('0x3f')],rs[_0x9068('0x119')](0x5));var _0x1946c9=util[_0x9068('0x2b')](_0x9068('0x177'),FILES_PATH,_0x3ee549,_0x34e3e1);var _0x539710=util[_0x9068('0x2b')]('%s/recordings/%s',FILES_PATH,_0x3ee549);this[_0x9068('0x3e')][_0x9068('0x78')](this,_0x362437,_0x3ee549,_0x1946c9);this[_0x9068('0xd')]['setVariable']('RECORDING_SAVENAME',_0x3ee549);logger['info'](_0x9068('0x178'),_0x539710,_0x34e3e1,_0x362437[_0x9068('0x179')],_0x362437[_0x9068('0x6d')]);return this[_0x9068('0xd')][_0x9068('0x135')](_0x539710,_0x34e3e1,_0x362437['escape_digits'],_0x362437['timeout'],undefined,!![]);};AGIVertices[_0x9068('0x10')]['restapi']=function(_0x502217){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x17a'),_0x502217[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x502217[_0x9068('0x6b')])){return this[_0x9068('0xd')]['noop'](_0x9068('0x17b'));}var _0x132113=this[_0x9068('0x6a')][_0x9068('0x78')](this,_0x502217);logger[_0x9068('0x32')](util[_0x9068('0x2b')]('Response:',util[_0x9068('0x17c')](_0x132113,{'showHidden':![],'depth':null})));if(!this[_0x9068('0x8e')](_0x502217['variable_id'])){return this['channel']['noop'](_0x9068('0x17d'));}var _0x81e90a=this['getVariable']['sync'](this,_0x502217['variable_id']);if(!_0x81e90a){return this[_0x9068('0xd')]['error'](_0x502217,_0x9068('0x117'));}this['channel'][_0x9068('0xa9')](util[_0x9068('0x2b')](_0x9068('0x17e'),_0x81e90a),_0x132113[_0x9068('0x7f')]?_0x132113['statusCode']:_0x9068('0x17f'));this[_0x9068('0xd')][_0x9068('0xa9')](util[_0x9068('0x2b')](_0x9068('0x180'),_0x81e90a),_0x132113[_0x9068('0x7e')]?_0x132113[_0x9068('0x7e')]:'OK');if(_0x132113[_0x9068('0x72')]){try{this[_0x9068('0xa6')](_0x132113[_0x9068('0x72')],_0x81e90a);}catch(_0x47d7db){logger[_0x9068('0x2f')](util[_0x9068('0x2b')](_0x9068('0x181'),_0x81e90a));}}return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0xe3'),_0x81e90a));};AGIVertices[_0x9068('0x10')][_0x9068('0x182')]=function(_0x26343e){logger[_0x9068('0x32')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x26343e['label']));return this[_0x9068('0xd')]['sayDigits'](_0x26343e[_0x9068('0x183')][_0x9068('0x5f')](/\s+/g,''),_0x26343e[_0x9068('0x179')]);};AGIVertices[_0x9068('0x10')][_0x9068('0x184')]=function(_0x4dddf0){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x185'),_0x4dddf0['label']));return this[_0x9068('0xd')]['sayNumber'](_0x4dddf0['number'][_0x9068('0x5f')](/\s+/g,''),_0x4dddf0[_0x9068('0x179')]);};AGIVertices[_0x9068('0x10')]['sayphonetic']=function(_0x10d666){logger['info'](util[_0x9068('0x2b')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x10d666[_0x9068('0xb3')]));return this[_0x9068('0xd')][_0x9068('0x186')](_0x10d666[_0x9068('0x62')],_0x10d666[_0x9068('0x179')]);};AGIVertices[_0x9068('0x10')][_0x9068('0x187')]=function(_0x8e8900){logger['info'](util['format'](_0x9068('0x188'),_0x8e8900['label']));if(!this[_0x9068('0x8e')](_0x8e8900[_0x9068('0x189')])){return this[_0x9068('0xd')]['noop'](_0x9068('0x18a'));}var _0x398563=this[_0x9068('0x23')][_0x9068('0x78')](this,_0x8e8900['account_id']);if(!_0x398563||!_0x398563[_0x9068('0x18b')]){return this[_0x9068('0xd')]['error'](_0x8e8900,'no\x20mail\x20account\x20found');}var _0x335d79={'from':util[_0x9068('0x2b')]('\x22%s\x22\x20<%s>',_0x398563['name'],_0x398563[_0x9068('0x18c')]||_0x398563[_0x9068('0x18b')]['user']),'to':_0x8e8900['to']||'','cc':_0x8e8900['cc']||'','bcc':_0x8e8900['bcc']||'','subject':_0x8e8900[_0x9068('0x18d')],'html':_0x8e8900[_0x9068('0x62')],'text':_0x8e8900['text']};if(this[_0x9068('0x8e')](_0x8e8900['template_id'])){}logger[_0x9068('0xe4')]('sendMail\x20message',JSON[_0x9068('0x7c')](_0x335d79));this[_0x9068('0x3a')]['sync'](this,_0x8e8900,_0x8e8900['account_id']);this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x18e'),_0x398563['name']));this[_0x9068('0x25')][_0x9068('0x78')](this,_0x398563['smtpOptions'],_0x335d79);return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0x18f'));};AGIVertices[_0x9068('0x10')][_0x9068('0x190')]=function(_0x3ab218){logger['info'](util[_0x9068('0x2b')](_0x9068('0x191'),_0x3ab218['label']));return this['channel'][_0x9068('0xb4')](_0x9068('0x192'));};AGIVertices[_0x9068('0x10')][_0x9068('0x193')]=function(_0x4bccf8){logger['info'](util['format'](_0x9068('0x194'),_0x4bccf8[_0x9068('0xb3')]));if(!this['isConfigured'](_0x4bccf8[_0x9068('0x195')])){return this[_0x9068('0xd')][_0x9068('0xb4')]('no\x20sms\x20account\x20configured');}var _0xc70b78=this[_0x9068('0x37')][_0x9068('0x78')](this,_0x4bccf8[_0x9068('0x195')]);if(!_0xc70b78){return this['channel'][_0x9068('0x2f')](_0x4bccf8,_0x9068('0x196'));}var _0xe5744e={'body':_0x4bccf8[_0x9068('0x197')],'phone':_0x4bccf8['to']||'','SmsAccountId':_0xc70b78['id']};logger[_0x9068('0xe4')]('sendSMS\x20message',JSON[_0x9068('0x7c')](_0xe5744e));this['createSquareDetailsReport'][_0x9068('0x78')](this,_0x4bccf8,_0x4bccf8[_0x9068('0x195')]);this[_0x9068('0xd')]['noop'](util[_0x9068('0x2b')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0xc70b78['name']));this[_0x9068('0x39')][_0x9068('0x78')](this,_0xe5744e);return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0x198'));};AGIVertices[_0x9068('0x10')]['set']=function(_0x30df54){logger[_0x9068('0x32')](util[_0x9068('0x2b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x30df54[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x30df54[_0x9068('0xe0')])){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x30df54,_0x9068('0x199'));}var _0x4bccf6=this[_0x9068('0x11')][_0x9068('0x78')](this,_0x30df54[_0x9068('0xe0')]);if(!_0x4bccf6){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x30df54,_0x9068('0x117'));}return this[_0x9068('0xd')][_0x9068('0xa9')](_0x4bccf6,_0x30df54[_0x9068('0x19a')]);};AGIVertices[_0x9068('0x10')][_0x9068('0x19b')]=function(_0x3de23b){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x19c'),_0x3de23b[_0x9068('0xb3')]));this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0x19d'));var _0x50c137=this[_0x9068('0xd')][_0x9068('0x11')]('XMCS-UNIQUEID');if(!_['isEmpty'](_0x50c137['extra'])){this['channel']['uniqueid']=_0x50c137[_0x9068('0xac')];}if(_0x3de23b[_0x9068('0xc7')]===_0x9068('0x19e')){this[_0x9068('0xd')][_0x9068('0xb4')]('Answer');return this['channel']['answer']();}return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0x19f'));};AGIVertices[_0x9068('0x10')][_0x9068('0x1a0')]=function(_0x4afafc){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x1a1'),_0x4afafc[_0x9068('0xb3')]));if(!this[_0x9068('0x8e')](_0x4afafc[_0x9068('0x1a2')])){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x4afafc,'no\x20subproject\x20selected');}var _0x2407ca=this['getSquareProject'][_0x9068('0x78')](this,_0x4afafc[_0x9068('0x1a2')]);if(!this['isConfigured'](_0x2407ca)){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x4afafc,util[_0x9068('0x2b')](_0x9068('0x1a3'),_0x4afafc[_0x9068('0x1a2')]));}if(_0x2407ca===this[_0x9068('0xd')][_0x9068('0x3c')]){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x4afafc,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x9068('0x3a')][_0x9068('0x78')](this,_0x4afafc,_0x2407ca);var _0x10cab2=this['channel']['exec'](_0x9068('0x1a4'),util[_0x9068('0x2b')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x9068('0x1a5')]||_0x9068('0x1a6'),_0x2407ca,this[_0x9068('0xd')][_0x9068('0x3c')]));if(_0x10cab2['result']===-0x1){return _0x10cab2;}return this[_0x9068('0xd')]['noop'](util[_0x9068('0x2b')](_0x9068('0x16c'),_0x9068('0x1a4'),_0x2407ca));};AGIVertices['prototype']['system']=function(_0x454583){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x1a7'),_0x454583['label']));var _0x5c79fa=this[_0x9068('0x5d')][_0x9068('0x78')](this,_0x454583[_0x9068('0xc5')]);this['createSquareDetailsReport']['sync'](this,_0x454583,_0x454583['command']);if(this['isConfigured'](_0x454583['variable_id'])){var _0x41a360=this[_0x9068('0x11')][_0x9068('0x78')](this,_0x454583[_0x9068('0xe0')]);if(_0x41a360){this['channel'][_0x9068('0xa9')](_0x41a360,_0x5c79fa);return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x1a8'),_0x454583[_0x9068('0xc5')],_0x41a360));}}return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x1a9'),_0x454583[_0x9068('0xc5')]));};AGIVertices[_0x9068('0x10')][_0x9068('0x1aa')]=function(_0x377d89){logger['info'](util[_0x9068('0x2b')](_0x9068('0x1ab'),_0x377d89[_0x9068('0xb3')]));_0x377d89['text']=_0x377d89['text'][_0x9068('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9068('0x8e')](_0x377d89[_0x9068('0x61')])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0x1ac'));}if(!this['isConfigured'](_0x377d89[_0x9068('0x62')])){return this[_0x9068('0xd')][_0x9068('0xb4')](_0x9068('0xd2'));}this[_0x9068('0xd')]['noop'](util[_0x9068('0x2b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x377d89['text']));var _0x330fd6=this[_0x9068('0x60')][_0x9068('0x78')](this,_0x377d89);if(_0x330fd6){this[_0x9068('0xd')]['noop'](util[_0x9068('0x2b')](_0x9068('0x1ad'),_0x330fd6));var _0x2ef0ac=this['channel'][_0x9068('0x124')](_0x330fd6);try{fs[_0x9068('0x104')](_0x330fd6+_0x9068('0x125'));}catch(_0x59e56a){logger['error'](_0x59e56a);}return _0x2ef0ac;}return this['channel'][_0x9068('0x2f')](_0x377d89,_0x9068('0x1ae'));};AGIVertices[_0x9068('0x10')][_0x9068('0x1af')]=function(_0xcd44c4){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x1b0'),_0xcd44c4[_0x9068('0xb3')]));_0xcd44c4[_0x9068('0x62')]=_0xcd44c4[_0x9068('0x62')][_0x9068('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9068('0x8e')](_0xcd44c4['text'])){return this[_0x9068('0xd')][_0x9068('0xb4')]('no\x20text\x20configured');}this[_0x9068('0xd')][_0x9068('0xb4')](util['format']('Trying\x20Google\x20TTS\x20%s',_0xcd44c4[_0x9068('0x62')]));var _0x1d4fc9=this['googleTTS'][_0x9068('0x78')](this,_0xcd44c4);if(_0x1d4fc9){this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x1b1'),_0x1d4fc9));var _0x3546c1=this[_0x9068('0xd')][_0x9068('0x124')](_0x1d4fc9);try{fs[_0x9068('0x104')](_0x1d4fc9+_0x9068('0x125'));}catch(_0x3a3ed8){logger['error'](_0x3a3ed8);}return _0x3546c1;}return this['channel']['error'](_0xcd44c4,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x9068('0x10')][_0x9068('0x1b2')]=function(_0x505738){logger[_0x9068('0x32')](util['format'](_0x9068('0x1b3'),_0x505738['label']));if(!this[_0x9068('0x8e')](_0x505738[_0x9068('0x154')])){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x505738,_0x9068('0x15a'));}logger[_0x9068('0x32')](util['format'](_0x9068('0x155'),this[_0x9068('0xd')]['callerid'],_0x505738[_0x9068('0x154')]));var _0x2d8abb=this[_0x9068('0x58')][_0x9068('0x78')](this,_0x505738[_0x9068('0x154')]);if(_0x2d8abb){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x156'),this[_0x9068('0xd')][_0x9068('0x3d')],_0x505738[_0x9068('0x154')]));this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x156'),this[_0x9068('0xd')]['callerid'],_0x505738['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x157'),this[_0x9068('0xd')][_0x9068('0x3d')],_0x505738['findBy']));this['channel'][_0x9068('0xb4')](util[_0x9068('0x2b')](_0x9068('0x157'),this['channel'][_0x9068('0x3d')],_0x505738['findBy']));return{'code':0xc8,'result':_0x9068('0x158')};}};AGIVertices[_0x9068('0x10')][_0x9068('0x1b4')]=function(_0x2280e9){logger['info'](util[_0x9068('0x2b')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x2280e9[_0x9068('0xb3')]));var _0xc7b624=this['channel']['exec'](_0x9068('0x1b5'),[_0x2280e9[_0x9068('0x1b6')],_0x2280e9[_0x9068('0x82')]]);if(_0xc7b624['result']===-0x1){return _0xc7b624;}return this[_0x9068('0xd')][_0x9068('0xb4')](util[_0x9068('0x2b')]('Executed\x20command\x20%s\x20%s',_0x9068('0x1b5'),_0x2280e9[_0x9068('0x1b6')]));};AGIVertices[_0x9068('0x10')]['vswitch']=function(_0x2b0926){logger[_0x9068('0x32')](util[_0x9068('0x2b')](_0x9068('0x1b7'),_0x2b0926[_0x9068('0xb3')]));if(!this['isConfigured'](_0x2b0926['variable_id'])){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x2b0926,'no\x20variable\x20selected');}var _0x10545a=this[_0x9068('0x11')]['sync'](this,_0x2b0926[_0x9068('0xe0')]);if(!_0x10545a){return this[_0x9068('0xd')][_0x9068('0x2f')](_0x2b0926,_0x9068('0x117'));}var _0x5cff56=this[_0x9068('0xd')][_0x9068('0x11')](_0x10545a);return{'code':0xc8,'result':_0x5cff56[_0x9068('0xac')]?_0x5cff56['extra']:'-'};};String[_0x9068('0x10')][_0x9068('0xab')]=function(_0x3ed326,_0x1df524){return this[_0x9068('0xaa')](_0x3ed326)[_0x9068('0x1b8')](_0x1df524);};module[_0x9068('0x1b9')]=AGIVertices; \ No newline at end of file +var _0x2b83=['127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','failure','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','lodash','shelljs','randomstring','moment','mustache','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','mailRpc','getVariable','rpc','then','getVoiceQueue','getVoiceQueueById','name','catch','getSquareOdbcById','dsn','prototype','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','error','createSmsMessage','createSquareDetailsReport','channel','label','agicommand','callerid','createSquareRecording','uniqueid','calleridname','context','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','url','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','aws_lex_region','aws_bot_name','google_asr_language','tildeASR','appid','appsecret','uri','clear','clone','hasOwnProperty','isString','includes','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','%s.%s','isArray','setVariable','replaceObjectAllVariables','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','exec','MRCPRecog','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','googleDialogflowV2','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','.wav','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','intKey','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','recordFile','restapi','no\x20url\x20configured','Response:','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','email','bcc','subject','template_id','sendMail\x20message','smtpOptions','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22'];(function(_0x4b2d05,_0x3fe05b){var _0x30b7b2=function(_0x4ac31f){while(--_0x4ac31f){_0x4b2d05['push'](_0x4b2d05['shift']());}};_0x30b7b2(++_0x3fe05b);}(_0x2b83,0x1d3));var _0x32b8=function(_0x5da5bc,_0x1f422c){_0x5da5bc=_0x5da5bc-0x0;var _0x5ae2a8=_0x2b83[_0x5da5bc];return _0x5ae2a8;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x32b8('0x0'));var sh=require(_0x32b8('0x1'));var odbc=require('odbc')();var rs=require(_0x32b8('0x2'));var moment=require(_0x32b8('0x3'));var Mustache=require(_0x32b8('0x4'));var rp=require('request-promise');var logger=require('../../config/logger')(_0x32b8('0x5'));var config=require(_0x32b8('0x6'));var scripts=require('./scripts');var FILES_PATH=_0x32b8('0x7');var recursiveMapAttributes=['rawHeaders',_0x32b8('0x8')];var verticesWithRetry=[_0x32b8('0x9'),_0x32b8('0xa'),_0x32b8('0xb')];var AGIVertices=function(_0x5cc6b2,_0x46be90,_0x2c9e57){this['channel']=_0x5cc6b2;this['rpc']=_0x46be90;this[_0x32b8('0xc')]=_0x2c9e57;};AGIVertices['prototype'][_0x32b8('0xd')]=function(_0x31b795,_0x465672){this[_0x32b8('0xe')]['getVariableById'](_0x31b795)[_0x32b8('0xf')](function(_0x3b6bc6){_0x465672(null,_0x3b6bc6?_0x3b6bc6['name']:![]);})['catch'](function(_0x30d00a){_0x465672(_0x30d00a);});};AGIVertices['prototype'][_0x32b8('0x10')]=function(_0x4b838f,_0x37aa93){this[_0x32b8('0xe')][_0x32b8('0x11')](_0x4b838f)[_0x32b8('0xf')](function(_0x2645b0){_0x37aa93(null,_0x2645b0?_0x2645b0['name']:![]);})['catch'](function(_0x5e7b4f){_0x37aa93(_0x5e7b4f);});};AGIVertices['prototype']['getSquareProject']=function(_0x576593,_0x834da1){this['rpc']['getSquareProjectById'](_0x576593)[_0x32b8('0xf')](function(_0x2ce0ea){_0x834da1(null,_0x2ce0ea?_0x2ce0ea[_0x32b8('0x12')]:![]);})[_0x32b8('0x13')](function(_0x599bc3){_0x834da1(_0x599bc3);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x38f02b,_0x2ffea2){this[_0x32b8('0xe')][_0x32b8('0x14')](_0x38f02b)['then'](function(_0x34cf64){_0x2ffea2(null,_0x34cf64?_0x34cf64[_0x32b8('0x15')]:![]);})[_0x32b8('0x13')](function(_0x39a4f1){_0x2ffea2(_0x39a4f1);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x17')]=function(_0x222c77,_0xcd4b26){this['rpc']['getUserById'](_0x222c77)[_0x32b8('0xf')](function(_0x4c7471){_0xcd4b26(null,_0x4c7471?_0x4c7471[_0x32b8('0x12')]:![]);})['catch'](function(_0x1a4c2b){_0xcd4b26(_0x1a4c2b);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x18')]=function(_0x189c4a,_0x2df3dc){this['rpc'][_0x32b8('0x19')](_0x189c4a)[_0x32b8('0xf')](function(_0x3eea54){_0x2df3dc(null,_0x3eea54?_0x3eea54[_0x32b8('0x12')]:![]);})[_0x32b8('0x13')](function(_0x29988d){_0x2df3dc(_0x29988d);});};AGIVertices['prototype'][_0x32b8('0x1a')]=function(_0x15a8bf,_0x3b0049){var _0x3e1598=this;this[_0x32b8('0xe')][_0x32b8('0x1b')](_0x15a8bf)[_0x32b8('0xf')](function(_0x39ce15){_0x3b0049(null,_0x39ce15?_0x3e1598[_0x32b8('0x1c')](_0x39ce15[_0x32b8('0x1d')]):![]);})[_0x32b8('0x13')](function(_0x2bc3ce){_0x3b0049(_0x2bc3ce);});};AGIVertices[_0x32b8('0x16')]['getMailAccount']=function(_0x424721,_0x21c9fb){this[_0x32b8('0xe')][_0x32b8('0x1e')](_0x424721)[_0x32b8('0xf')](function(_0x1d83a5){_0x21c9fb(null,_0x1d83a5?_0x1d83a5:![]);})[_0x32b8('0x13')](function(_0x28ed75){_0x21c9fb(_0x28ed75);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1f')]=function(_0x521bf4,_0x1833af,_0x3c1122){this[_0x32b8('0xc')][_0x32b8('0x1f')](_0x521bf4,_0x1833af)['then'](function(){_0x3c1122(null);})['catch'](function(_0x287a6b){_0x3c1122(_0x287a6b);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x20')]=function(_0x12ff7d,_0x523736){this[_0x32b8('0xe')][_0x32b8('0x21')](_0x12ff7d)[_0x32b8('0xf')](function(_0x42e9bc){if(_0x42e9bc){if(_0x42e9bc[_0x32b8('0x22')]){_0x523736(null,[_0x42e9bc[_0x32b8('0x23')]]);}else{_0x523736(null,_[_0x32b8('0x24')](_0x42e9bc[_0x32b8('0x25')],'interval'));}}else{_0x523736(null,![]);}})[_0x32b8('0x13')](function(_0x5e8af2){_0x523736(_0x5e8af2);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1c')]=function(_0xcf7b7){return util[_0x32b8('0x26')](_0x32b8('0x27'),FILES_PATH,_0xcf7b7);};AGIVertices[_0x32b8('0x16')]['getQueryOdbc']=function(_0x152209,_0x22ed5a,_0x7e13a9){odbc['open'](_0x152209,function(_0x470653){if(_0x470653){logger['error'](_0x32b8('0x28'),_0x470653);_0x7e13a9(_0x470653);}else{logger[_0x32b8('0x29')](_0x32b8('0x2a'));odbc[_0x32b8('0x2b')](_0x22ed5a,function(_0x5e7b75,_0x140cce){if(_0x5e7b75){logger[_0x32b8('0x29')](_0x32b8('0x2c'),_0x22ed5a);_0x7e13a9(_0x5e7b75);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x22ed5a);odbc[_0x32b8('0x2d')](function(_0x385e5d){if(_0x385e5d){logger[_0x32b8('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x385e5d);}_0x7e13a9(null,_0x140cce);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x1aa6ef,_0x1dff0e){this[_0x32b8('0xe')]['getSmsAccountById'](_0x1aa6ef)[_0x32b8('0xf')](function(_0x14c109){_0x1dff0e(null,_0x14c109?_0x14c109:![]);})[_0x32b8('0x13')](function(_0x273d5f){_0x1dff0e(_0x273d5f);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x2f')]=function(_0x8dd996,_0x24bdaf){this['rpc'][_0x32b8('0x2f')](_0x8dd996)['then'](function(_0x5c0416){_0x24bdaf(null,_0x5c0416);})['catch'](function(_0x5eb159){_0x24bdaf(_0x5eb159);});};AGIVertices[_0x32b8('0x16')]['createSquareDetailsReport']=function(_0x2a3968,_0x52709b,_0x5bd1de){this[_0x32b8('0xe')][_0x32b8('0x30')]({'uniqueid':this[_0x32b8('0x31')]['uniqueid'],'node':_0x2a3968[_0x32b8('0x32')],'application':_0x2a3968[_0x32b8('0x33')],'data':_0x52709b||null,'project_name':this[_0x32b8('0x31')]['arg_1'],'callerid':this['channel'][_0x32b8('0x34')]})['then'](function(_0xb7406c){if(_0x5bd1de){_0x5bd1de(null,_0xb7406c);}})['catch'](function(_0x25957b){if(_0x5bd1de){_0x5bd1de(_0x25957b);}});};AGIVertices['prototype'][_0x32b8('0x35')]=function(_0x43b294,_0x155ed6,_0x17791d,_0x47eea4){this['rpc'][_0x32b8('0x35')]({'uniqueid':this[_0x32b8('0x31')][_0x32b8('0x36')],'callerid':this['channel']['callerid'],'calleridname':this[_0x32b8('0x31')][_0x32b8('0x37')],'context':this['channel'][_0x32b8('0x38')],'extension':this['channel']['extension'],'priority':this['channel'][_0x32b8('0x39')],'accountcode':this[_0x32b8('0x31')][_0x32b8('0x3a')],'dnid':this[_0x32b8('0x31')]['dnid'],'projectName':this[_0x32b8('0x31')][_0x32b8('0x3b')],'saveName':_0x155ed6,'filename':_0x43b294[_0x32b8('0x3c')]||_0x155ed6,'savePath':_0x17791d})[_0x32b8('0xf')](function(_0x1a5bd4){_0x47eea4(null,_0x1a5bd4);})[_0x32b8('0x13')](function(_0x25a2a8){_0x47eea4(_0x25a2a8);});};AGIVertices['prototype'][_0x32b8('0x3d')]=function(_0xf99c9d,_0x2eee28,_0x17d6bb,_0x13f936,_0x2726bf){this[_0x32b8('0xe')][_0x32b8('0x3d')]({'uniqueid':this[_0x32b8('0x31')]['uniqueid'],'body':_0xf99c9d,'direction':_0x2eee28,'providerName':_0x17d6bb,'providerResponse':_0x13f936})['then'](function(_0x4032f1){if(_0x2726bf){_0x2726bf(null,_0x4032f1);}})[_0x32b8('0x13')](function(_0x3694dc){if(_0x2726bf){_0x2726bf(_0x3694dc);}});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x3e')]=function(_0x17c46a,_0x4f7c6f){this[_0x32b8('0xe')][_0x32b8('0x3e')]({'firstName':_[_0x32b8('0x3f')](_0x17c46a[_0x32b8('0x12')])||_['isNil'](_0x17c46a[_0x32b8('0x12')])?_0x32b8('0x40')+Math[_0x32b8('0x41')]():_0x17c46a['name'],'lastName':_[_0x32b8('0x3f')](_0x17c46a[_0x32b8('0x42')])||_[_0x32b8('0x43')](_0x17c46a[_0x32b8('0x42')])?null:_0x17c46a[_0x32b8('0x42')],'phone':_0x17c46a[_0x32b8('0x44')],'ListId':_0x17c46a[_0x32b8('0x45')],'scheduledat':_0x17c46a['scheduledAt'],'callbackUniqueid':this[_0x32b8('0x31')]['uniqueid'],'tags':'callback','description':_0x32b8('0x46')+_0x17c46a[_0x32b8('0x47')][_0x32b8('0x48')](),'priority':_0x17c46a[_0x32b8('0x49')]})[_0x32b8('0xf')](function(_0x5e3e6f){_0x4f7c6f(null,_0x5e3e6f);})[_0x32b8('0x13')](function(_0x3b9694){_0x4f7c6f(_0x3b9694);});};AGIVertices[_0x32b8('0x16')]['getPause']=function(_0x1dbe22,_0x2e41ee){this[_0x32b8('0xe')]['getPauseById'](_0x1dbe22)[_0x32b8('0xf')](function(_0x531b62){_0x2e41ee(null,_0x531b62?_0x531b62[_0x32b8('0x12')]:![]);})[_0x32b8('0x13')](function(_0x40e1dd){_0x2e41ee(_0x40e1dd);});};AGIVertices[_0x32b8('0x16')]['agentPause']=function(_0xa39ab2,_0x567733,_0x7b4b88){var _0x5a6b2c={'role':'agent'};_0x5a6b2c[_0xa39ab2]=this['channel'][_0x32b8('0x34')];this[_0x32b8('0xe')][_0x32b8('0x4a')](_0x5a6b2c,_0x567733,this[_0x32b8('0x31')]['uniqueid'])[_0x32b8('0xf')](function(_0x391244){_0x7b4b88(null,_[_0x32b8('0x43')](_0x391244)?![]:!![]);})[_0x32b8('0x13')](function(_0x5077e4){logger[_0x32b8('0x2e')](_0x5077e4);_0x7b4b88(null,![]);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x4b')]=function(_0x43003e,_0x43c677){var _0x5fdb5a={'role':'agent'};_0x5fdb5a[_0x43003e]=this[_0x32b8('0x31')]['callerid'];this['rpc'][_0x32b8('0x4b')](_0x5fdb5a)[_0x32b8('0xf')](function(_0x216faf){_0x43c677(null,_['isNil'](_0x216faf)?![]:!![]);})[_0x32b8('0x13')](function(_0x1d2c07){logger[_0x32b8('0x2e')](_0x1d2c07);_0x43c677(null,![]);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x4c')]=function(_0x58fc0a,_0x1d6d52){var _0x8fddf8={'role':_0x32b8('0x4d')};_0x8fddf8[_0x58fc0a]=this['channel'][_0x32b8('0x34')];this[_0x32b8('0xe')]['agentLogout'](_0x8fddf8)[_0x32b8('0xf')](function(_0x9b7424){_0x1d6d52(null,_[_0x32b8('0x43')](_0x9b7424)?![]:!![]);})[_0x32b8('0x13')](function(_0x4118ac){logger[_0x32b8('0x2e')](_0x4118ac);_0x1d6d52(null,![]);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x4e')]=function(_0x2b5963,_0x532664){var _0x1add74={'role':_0x32b8('0x4d')};_0x1add74[_0x2b5963]=this['channel'][_0x32b8('0x34')];var _0x527986=_0x2b5963!=_0x32b8('0x4f')?util[_0x32b8('0x26')](_0x32b8('0x50'),_0x32b8('0x51'),this[_0x32b8('0x31')][_0x32b8('0x34')]):undefined;this[_0x32b8('0xe')][_0x32b8('0x4e')](_0x1add74,_0x527986)['then'](function(_0x4f745d){_0x532664(null,_[_0x32b8('0x43')](_0x4f745d)?![]:!![]);})['catch'](function(_0x195b37){logger[_0x32b8('0x2e')](_0x195b37);_0x532664(null,![]);});};AGIVertices[_0x32b8('0x16')]['shellCommand']=function(_0x17a175,_0x21c969){sh['exec'](_[_0x32b8('0x52')](_0x17a175),function(_0x4f4d5c,_0xeb73b8){var _0x308ebd=_0xeb73b8[_0x32b8('0x53')](/(\r\n|\n|\r)/gm,'');_0x21c969(null,_0x308ebd);});};AGIVertices[_0x32b8('0x16')]['googleCloudTTS']=function(_0x374be5,_0x58a585){scripts[_0x32b8('0x54')](_0x374be5[_0x32b8('0x55')],_0x374be5['google_cloud_tts_text_type']||'text',_0x374be5[_0x32b8('0x56')],_0x374be5[_0x32b8('0x57')]||_0x32b8('0x58'),_0x374be5[_0x32b8('0x59')]||_0x32b8('0x5a'),_0x374be5[_0x32b8('0x5b')]||_0x32b8('0x5c'))['then'](function(_0x1c7bd3){_0x58a585(null,_0x1c7bd3);})['catch'](function(_0x16bb7b){_0x58a585(_0x16bb7b);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x5d')]=function(_0x5655ae,_0x4d3044){scripts[_0x32b8('0x5d')](_0x5655ae[_0x32b8('0x56')],_0x5655ae[_0x32b8('0x5e')]||'en',0x1)[_0x32b8('0xf')](function(_0x504530){_0x4d3044(null,_0x504530);})[_0x32b8('0x13')](function(_0xcc2677){_0x4d3044(_0xcc2677);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x5f')]=function(_0x4c84b0,_0x570c4c){var _0x3a389={'uri':_0x4c84b0['url'],'method':_0x4c84b0[_0x32b8('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4c84b0[_0x32b8('0x61')])==='number'&&parseInt(_0x4c84b0[_0x32b8('0x61')])>=0x1?parseInt(_0x4c84b0[_0x32b8('0x61')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x32b8('0x62'),'PUT'],_0x3a389[_0x32b8('0x60')][_0x32b8('0x63')]())){try{_0x3a389[_0x32b8('0x64')]=_0x4c84b0[_0x32b8('0x8')]?JSON[_0x32b8('0x65')](_0x4c84b0['rawBody']):{};}catch(_0x245785){logger[_0x32b8('0x2e')](_0x32b8('0x66'),_0x245785);}}try{_0x3a389[_0x32b8('0x67')]=_0x4c84b0[_0x32b8('0x68')]?JSON[_0x32b8('0x65')](_0x4c84b0[_0x32b8('0x68')]):{};}catch(_0x17f806){logger['error'](_0x32b8('0x69'),_0x17f806);}if(_0x4c84b0['computedVariables']){try{var _0x238c22=require(_0x4c84b0['computedVariables'])[_0x32b8('0x6a')](this,_0x3a389);_0x3a389['uri']=Mustache['render'](_0x4c84b0[_0x32b8('0x6b')],_0x238c22,{},['$$','$$']);if(_0x3a389[_0x32b8('0x67')]){_0x3a389['headers']=JSON[_0x32b8('0x65')](Mustache[_0x32b8('0x6c')](JSON[_0x32b8('0x6d')](_0x3a389[_0x32b8('0x67')]),_0x238c22,{},['$$','$$']));}if(_0x3a389['body']){_0x3a389[_0x32b8('0x64')]=JSON[_0x32b8('0x65')](Mustache['render'](JSON[_0x32b8('0x6d')](_0x3a389['body']),_0x238c22,{},['$$','$$']));}}catch(_0x3f4034){logger[_0x32b8('0x2e')](_0x32b8('0x6e'),_0x3f4034);}}rp(_0x3a389)[_0x32b8('0xf')](function(_0x39ee79){var _0x311055={'statusCode':_0x39ee79[_0x32b8('0x6f')]||0xc8,'statusMessage':_0x39ee79[_0x32b8('0x70')]||'OK','headers':_0x39ee79[_0x32b8('0x67')]||{},'body':_0x39ee79['body']||{}};_0x570c4c(null,_0x311055);})[_0x32b8('0x13')](function(_0x1f8918){var _0x2b08fd={'statusCode':_0x1f8918[_0x32b8('0x6f')]||0x1f4,'statusMessage':_0x1f8918[_0x32b8('0x71')]||_0x32b8('0x72'),'headers':_0x1f8918[_0x32b8('0x73')][_0x32b8('0x67')]||{},'body':_0x1f8918[_0x32b8('0x73')][_0x32b8('0x64')]||{}};_0x570c4c(null,_0x2b08fd);});};AGIVertices[_0x32b8('0x16')]['googleDialogflow']=function(_0x56e39c,_0x534990){scripts[_0x32b8('0x74')](this['channel'][_0x32b8('0x36')],_0x56e39c[_0x32b8('0x75')],_0x56e39c[_0x32b8('0x56')],_0x56e39c['dialogflow_language']||'en')[_0x32b8('0xf')](function(_0x235ebc){_0x534990(null,_0x235ebc);})['catch'](function(_0x2a5cb0){_0x534990(_0x2a5cb0);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x4d78ae,_0x543331){scripts['googleDialogflowV2'](this['channel'][_0x32b8('0x36')],_0x4d78ae['dialogflowV2_project_id'],_0x4d78ae[_0x32b8('0x76')],_0x4d78ae['private_key'],_0x4d78ae[_0x32b8('0x56')],_0x4d78ae[_0x32b8('0x77')]||'en')[_0x32b8('0xf')](function(_0x2524a5){_0x543331(null,_0x2524a5);})[_0x32b8('0x13')](function(_0x3eaa5b){_0x543331(_0x3eaa5b);});};AGIVertices['prototype']['sestekNDA']=function(_0x435b12,_0x25835f){scripts[_0x32b8('0x78')](this[_0x32b8('0x31')],_0x435b12)['then'](function(_0x4a4784){_0x25835f(null,_0x4a4784);})['catch'](function(_0x2a74f9){_0x25835f(_0x2a74f9);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x79')]=function(_0x4cc70b,_0x68be4a){scripts['ispeechTTS'](_0x4cc70b[_0x32b8('0x75')],_0x4cc70b[_0x32b8('0x56')],_0x4cc70b[_0x32b8('0x7a')]||_0x32b8('0x58'),_0x4cc70b[_0x32b8('0x7b')])['then'](function(_0x2b1e0f){_0x68be4a(null,_0x2b1e0f);})[_0x32b8('0x13')](function(_0x34738b){_0x68be4a(_0x34738b);});};AGIVertices['prototype']['ispeechASR']=function(_0x34b5c9,_0x49112b,_0x407889){scripts[_0x32b8('0x7c')](_0x49112b,_0x34b5c9[_0x32b8('0x75')],_0x34b5c9['ispeech_asr_language']||_0x32b8('0x58'),this[_0x32b8('0x7d')](_0x34b5c9[_0x32b8('0x7e')])?_0x34b5c9['model']:undefined)[_0x32b8('0xf')](function(_0x37dc1e){_0x407889(null,_0x37dc1e);})['catch'](function(_0x4d1606){_0x407889(_0x4d1606);});};AGIVertices[_0x32b8('0x16')]['awsPolly']=function(_0x8eb753,_0x12576d){scripts[_0x32b8('0x7f')](_0x8eb753[_0x32b8('0x80')],_0x8eb753[_0x32b8('0x81')],_0x8eb753[_0x32b8('0x82')],_0x8eb753['aws_polly_voice']||_0x32b8('0x83'),_0x8eb753[_0x32b8('0x56')],_0x8eb753[_0x32b8('0x84')]||_0x32b8('0x56'))[_0x32b8('0xf')](function(_0x2f755e){_0x12576d(null,_0x2f755e);})[_0x32b8('0x13')](function(_0x447166){_0x12576d(_0x447166);});};AGIVertices['prototype']['awsLex']=function(_0x1d7d11,_0x42b81a){scripts['awsLex'](this[_0x32b8('0x31')][_0x32b8('0x36')],_0x1d7d11[_0x32b8('0x80')],_0x1d7d11['aws_secret_access_key'],_0x1d7d11[_0x32b8('0x85')],_0x1d7d11[_0x32b8('0x56')],_0x1d7d11[_0x32b8('0x86')])[_0x32b8('0xf')](function(_0xde7870){_0x42b81a(null,_0xde7870);})[_0x32b8('0x13')](function(_0x358a9e){_0x42b81a(_0x358a9e);});};AGIVertices[_0x32b8('0x16')]['googleASR']=function(_0x3b833e,_0x42e387,_0x46f1c0){scripts['googleASR'](_0x42e387,_0x3b833e[_0x32b8('0x75')],_0x3b833e[_0x32b8('0x87')]||'en-US')[_0x32b8('0xf')](function(_0x2ed151){_0x46f1c0(null,_0x2ed151);})['catch'](function(_0x2ec386){_0x46f1c0(_0x2ec386);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x88')]=function(_0x481746,_0xbe98ae,_0x23c08d){scripts[_0x32b8('0x88')](_0xbe98ae,_0x481746[_0x32b8('0x89')],_0x481746[_0x32b8('0x8a')],_0x481746[_0x32b8('0x8b')])[_0x32b8('0xf')](function(_0x354f94){_0x23c08d(null,_0x354f94);})['catch'](function(_0x2cb2a8){_0x23c08d(_0x2cb2a8);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x8c')]=function(_0x286a12){var _0x29f9cf=_['includes'](verticesWithRetry,_0x286a12[_0x32b8('0x33')])?_0x286a12:_[_0x32b8('0x8d')](_0x286a12);for(var _0x41d6db in _0x29f9cf){if(_0x29f9cf[_0x32b8('0x8e')](_0x41d6db)){if(_0x29f9cf[_0x41d6db]&&_[_0x32b8('0x8f')](_0x29f9cf[_0x41d6db])){if(_[_0x32b8('0x90')](recursiveMapAttributes,_0x41d6db)){_0x29f9cf[_0x41d6db]=this['replaceObjectAllVariables'](_0x29f9cf[_0x41d6db]);}else{_0x29f9cf[_0x41d6db]=this[_0x32b8('0x91')](_0x29f9cf[_0x41d6db]);}}}}return _0x29f9cf;};AGIVertices[_0x32b8('0x16')][_0x32b8('0x92')]=function(_0x1e29a1){for(var _0x1ee08f in _0x1e29a1){if(_0x1e29a1[_0x32b8('0x8e')](_0x1ee08f)){if(_[_0x32b8('0x93')](_0x1e29a1[_0x1ee08f])){this[_0x32b8('0x92')](_0x1e29a1[_0x1ee08f]);}else if(_['isArray'](_0x1e29a1[_0x1ee08f])){for(var _0x2591dc=0x0;_0x2591dc<_0x1e29a1[_0x1ee08f]['length'];_0x2591dc++){this[_0x32b8('0x92')](_0x1e29a1[_0x1ee08f][_0x2591dc]);}}else if(_[_0x32b8('0x8f')](_0x1e29a1[_0x1ee08f])){_0x1e29a1[_0x1ee08f]=this['replaceAllVariables'](_0x1e29a1[_0x1ee08f]);}}}};AGIVertices['prototype'][_0x32b8('0x94')]=function(_0x2d666b,_0x69b331){for(var _0x33becf in _0x2d666b){if(_0x2d666b[_0x32b8('0x8e')](_0x33becf)){if(_['isPlainObject'](_0x2d666b[_0x33becf])){if(!_['isEmpty'](_0x2d666b[_0x33becf])){this[_0x32b8('0x94')](_0x2d666b[_0x33becf],util[_0x32b8('0x26')](_0x32b8('0x95'),_0x69b331,_0x33becf));}}else if(_[_0x32b8('0x96')](_0x2d666b[_0x33becf])){for(var _0x317164=0x0;_0x317164<_0x2d666b[_0x33becf]['length'];_0x317164++){this[_0x32b8('0x94')](_0x2d666b[_0x33becf][_0x317164],util['format'](_0x32b8('0x95'),_0x69b331,_0x33becf+'['+_0x317164+']'));}}else{if(!_[_0x32b8('0x43')](_0x2d666b[_0x33becf])){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x95'),_0x69b331,_0x33becf),_0x2d666b[_0x33becf]);}}}}};AGIVertices['prototype'][_0x32b8('0x98')]=function(_0x58c791){try{var _0x164369=JSON[_0x32b8('0x65')](_0x58c791);this['recursiveNodeIndex'](_0x164369);return JSON[_0x32b8('0x6d')](_0x164369);}catch(_0x3e44f8){return this['replaceAllVariables'](_0x58c791);}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x91')]=function(_0x5ed377){var _0x2788b0=_0x5ed377[_0x32b8('0x99')]('{');for(var _0x40ebaa=0x1;_0x40ebaa<_0x2788b0[_0x32b8('0x9a')];_0x40ebaa+=0x1){var _0x528755=_0x2788b0[_0x40ebaa][_0x32b8('0x99')]('}');if(_0x528755[_0x32b8('0x9a')]>0x1){_0x5ed377=_0x5ed377[_0x32b8('0x9b')]('{'+_0x528755[0x0]+'}',this[_0x32b8('0x31')]['getVariable'](_0x528755[0x0])[_0x32b8('0x9c')]||_0x528755[0x0]);}}if(_0x2788b0[_0x32b8('0x9a')]===0x1){return _0x5ed377[_0x32b8('0x48')]();}return this[_0x32b8('0x91')](_0x5ed377);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x9d')]=function(_0x1a2d68,_0x4cc34c){var _0x12c3ab=this[_0x32b8('0x31')][_0x32b8('0xd')](_0x1a2d68);if(_0x12c3ab[_0x32b8('0x9e')]===-0x1){return _0x12c3ab;}logger['info'](util[_0x32b8('0x26')](_0x32b8('0x9f'),_0x4cc34c,_0x12c3ab[_0x32b8('0x9c')]));return this['channel']['setVariable'](_0x4cc34c,_0x12c3ab['extra']);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x7d')]=function(_0x344ed7){return _0x344ed7&&_0x344ed7!=='0'&&_0x344ed7!=='-1'&&_0x344ed7!=='';};AGIVertices['prototype']['maxRetry']=function(_0x32c588){this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x32c588,'-');_0x32c588['retry']=_0x32c588[_0x32b8('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x32b8('0x16')]['mrcpsynth']=function(_0x93dfa4){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xa1'),_0x93dfa4[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x93dfa4[_0x32b8('0x56')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}var _0x14320f='\x22'+_0x93dfa4[_0x32b8('0x56')]+'\x22';if(this[_0x32b8('0x7d')](_0x93dfa4[_0x32b8('0x73')])){_0x14320f+=','+_0x93dfa4['options'];}var _0x4c26aa=this[_0x32b8('0x31')]['exec'](_0x32b8('0xa3'),_0x14320f);if(_0x4c26aa[_0x32b8('0x9e')]===-0x1){return _0x4c26aa;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xa5'),_0x14320f));};AGIVertices['prototype'][_0x32b8('0xa6')]=function(_0x29095e){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xa7'),_0x29095e['label']));if(!this[_0x32b8('0x7d')](_0x29095e[_0x32b8('0xa8')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa9'));}var _0x52ac94=_0x29095e[_0x32b8('0xa8')];if(this[_0x32b8('0x7d')](_0x29095e[_0x32b8('0x73')])){_0x52ac94+=','+_0x29095e['options'];}var _0x43fee6=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xab'),_0x52ac94);if(_0x43fee6['result']===-0x1){return _0x43fee6;}var _0x40ec2d=this[_0x32b8('0x9d')]('RECOG_CONFIDENCE()',_0x32b8('0xac'));if(_0x40ec2d[_0x32b8('0x9e')]===-0x1){return _0x40ec2d;}var _0x4a390f=this[_0x32b8('0x9d')]('RECOG_INPUT()',_0x32b8('0xad'));if(_0x4a390f[_0x32b8('0x9e')]===-0x1){return _0x4a390f;}var _0x45cb59=this[_0x32b8('0x9d')]('RECOG_INSTANCE()',_0x32b8('0xae'));if(_0x45cb59[_0x32b8('0x9e')]===-0x1){return _0x45cb59;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x52ac94));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x5')]=function(_0x46d1d5){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xaf'),_0x46d1d5[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0x5')]([_0x46d1d5[_0x32b8('0xb0')],_0x46d1d5[_0x32b8('0xb1')]]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0xb2')]=function(_0x23f9ae){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xb3'),_0x23f9ae[_0x32b8('0x32')]));if(this[_0x32b8('0x7d')](_0x23f9ae[_0x32b8('0x61')])){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xb4'),_0x23f9ae[_0x32b8('0x61')]));var _0x226e17=this['channel'][_0x32b8('0xb5')](_0x23f9ae[_0x32b8('0x61')]);if(_0x226e17['result']===-0x1){return _0x226e17;}}return this[_0x32b8('0x31')][_0x32b8('0xb2')]();};AGIVertices[_0x32b8('0x16')][_0x32b8('0xb6')]=function(_0x4b695a){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4b695a[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x4b695a[_0x32b8('0x45')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4b695a,'no\x20list\x20selected');}_0x4b695a[_0x32b8('0x47')]=moment();if(this['isConfigured'](_0x4b695a[_0x32b8('0xb7')])){_0x4b695a['scheduledAt']=moment()[_0x32b8('0xb8')](_0x4b695a[_0x32b8('0xb7')],_0x32b8('0xb9'));}if(!this[_0x32b8('0x7d')](_0x4b695a[_0x32b8('0x49')])){_0x4b695a[_0x32b8('0x49')]=0x2;}this[_0x32b8('0x3e')]['sync'](this,_0x4b695a);return this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x4b695a[_0x32b8('0x44')],_0x4b695a[_0x32b8('0x45')],_0x4b695a[_0x32b8('0x47')]));};AGIVertices['prototype'][_0x32b8('0xba')]=function(_0x5d0cd0){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xbb'),_0x5d0cd0[_0x32b8('0x32')]));var _0x135da4=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x5d0cd0[_0x32b8('0xbc')],_0x5d0cd0[_0x32b8('0x73')]);if(_0x135da4[_0x32b8('0x9e')]===-0x1){return _0x135da4;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format'](_0x32b8('0xbd'),_0x5d0cd0['application'],_0x5d0cd0['options']));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xbe')]=function(_0x29cc73){logger['info'](util[_0x32b8('0x26')](_0x32b8('0xbf'),_0x29cc73[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x29cc73[_0x32b8('0x56')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}var _0x40ced6='\x22'+_0x29cc73[_0x32b8('0x56')]+'\x22';if(this[_0x32b8('0x7d')](_0x29cc73['options'])){_0x40ced6+=','+_0x29cc73[_0x32b8('0x73')];}var _0x16d088=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xa3'),_0x40ced6);if(_0x16d088['result']===-0x1){return _0x16d088;}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xa5'),_0x40ced6));};AGIVertices[_0x32b8('0x16')]['sestektts']=function(_0x4c09fe){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xc0'),_0x4c09fe[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x4c09fe[_0x32b8('0x56')])){return this['channel'][_0x32b8('0xa4')](_0x32b8('0xa2'));}var _0x2b1dfa='\x22'+_0x4c09fe[_0x32b8('0x56')]+'\x22';if(this[_0x32b8('0x7d')](_0x4c09fe[_0x32b8('0x73')])){_0x2b1dfa+=','+_0x4c09fe['options'];}var _0x53d7f7=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xa3'),_0x2b1dfa);if(_0x53d7f7[_0x32b8('0x9e')]===-0x1){return _0x53d7f7;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xa5'),_0x2b1dfa));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xc1')]=function(_0x554068){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xc2'),_0x554068[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x554068[_0x32b8('0xa8')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa9'));}var _0x339b89=_0x554068[_0x32b8('0xa8')];if(this[_0x32b8('0x7d')](_0x554068[_0x32b8('0x73')])){_0x339b89+=','+_0x554068[_0x32b8('0x73')];}var _0x138b01=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xab'),_0x339b89);if(_0x138b01[_0x32b8('0x9e')]===-0x1){return _0x138b01;}var _0x48b45f=this[_0x32b8('0x9d')](_0x32b8('0xc3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x48b45f[_0x32b8('0x9e')]===-0x1){return _0x48b45f;}var _0x4d29c3=this[_0x32b8('0x9d')]('RECOG_INPUT()',_0x32b8('0xc4'));if(_0x4d29c3[_0x32b8('0x9e')]===-0x1){return _0x4d29c3;}var _0x2c8691=this['getAndSetVariable'](_0x32b8('0xc5'),_0x32b8('0xc6'));if(_0x2c8691[_0x32b8('0x9e')]===-0x1){return _0x2c8691;}return this[_0x32b8('0x31')]['noop'](util['format'](_0x32b8('0xc7'),_0x339b89));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xc8')]=function(_0x47dc87){logger[_0x32b8('0x29')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x47dc87[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x47dc87['grammar'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa9'));}var _0x5e1472=_0x47dc87['grammar'];if(this[_0x32b8('0x7d')](_0x47dc87[_0x32b8('0x73')])){_0x5e1472+=','+_0x47dc87[_0x32b8('0x73')];}var _0x5486a9=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xab'),_0x5e1472);if(_0x5486a9['result']===-0x1){return _0x5486a9;}var _0x1ee61f=this[_0x32b8('0x9d')](_0x32b8('0xc3'),'SESTEK_ASR_CONFIDENCE');if(_0x1ee61f[_0x32b8('0x9e')]===-0x1){return _0x1ee61f;}var _0x555a81=this[_0x32b8('0x9d')]('RECOG_INPUT()',_0x32b8('0xc9'));if(_0x555a81[_0x32b8('0x9e')]===-0x1){return _0x555a81;}var _0x53c69f=this[_0x32b8('0x9d')](_0x32b8('0xc5'),_0x32b8('0xca'));if(_0x53c69f[_0x32b8('0x9e')]===-0x1){return _0x53c69f;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xc7'),_0x5e1472));};AGIVertices[_0x32b8('0x16')]['database']=function(_0x3badd1){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xcb'),_0x3badd1['label']));if(!this['isConfigured'](_0x3badd1[_0x32b8('0xcc')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,_0x32b8('0xcd'));}var _0x27da1f=this[_0x32b8('0xce')]['sync'](this,_0x3badd1[_0x32b8('0xcc')]);if(!_0x27da1f){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,'no\x20odbc\x20database\x20found');}if(!this[_0x32b8('0x7d')](_0x3badd1['query'])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,'no\x20query\x20configured');}var _0x25c1c6=_0x3badd1[_0x32b8('0x2b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')](_0x32b8('0xcf'),_0x25c1c6));var _0x4a5f66=this[_0x32b8('0xd0')][_0x32b8('0x6a')](this,_0x27da1f,_0x25c1c6);this[_0x32b8('0x30')]['sync'](this,_0x3badd1,_0x25c1c6);if(!this['isConfigured'](_0x3badd1['variable_id'])){return this['channel'][_0x32b8('0xa4')](_0x32b8('0xd1'));}var _0xb189be=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x3badd1[_0x32b8('0xd2')]);if(!_0xb189be){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,'no\x20variable\x20found');}var _0x23ff8d=this;_0x4a5f66[_0x32b8('0xd3')](function(_0x5dbe57,_0x25f220){Object[_0x32b8('0xd4')](_0x5dbe57)[_0x32b8('0xd3')](function(_0x3633ea){_0x23ff8d[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0xd5'),_0xb189be,_0x25f220,_0x3633ea),_0x5dbe57[_0x3633ea]);});});this[_0x32b8('0x31')][_0x32b8('0x97')](util['format'](_0x32b8('0xd6'),_0xb189be),_0x4a5f66[_0x32b8('0x9a')]);return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xd7'),_0xb189be));};AGIVertices[_0x32b8('0x16')]['dial']=function(_0x2bc9b5){logger[_0x32b8('0xd8')](util[_0x32b8('0x26')](_0x32b8('0xd9'),_0x2bc9b5[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x2bc9b5['sip_id'])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x2bc9b5,'no\x20user\x20selected');}var _0xa90509=this[_0x32b8('0x17')]['sync'](this,_0x2bc9b5['sip_id']);if(!_0xa90509){return this[_0x32b8('0x31')]['error'](_0x2bc9b5,_0x32b8('0xda'));}var _0x219891=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xdb'),[util[_0x32b8('0x26')](_0x32b8('0xdc'),_0xa90509),_0x2bc9b5[_0x32b8('0x61')],_0x2bc9b5[_0x32b8('0xdd')],_0x2bc9b5[_0x32b8('0x6b')]]);if(_0x219891['result']===-0x1){return _0x219891;}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xde'),_0x32b8('0xdb')));};AGIVertices[_0x32b8('0x16')]['dialogflow']=function(_0x504f12){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xdf'),_0x504f12[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x504f12[_0x32b8('0x75')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xe0'));}if(!this[_0x32b8('0x7d')](_0x504f12[_0x32b8('0x56')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this['channel'][_0x32b8('0xe1')]=!![];this['createSquareDetailsReport'](_0x504f12);this[_0x32b8('0x3d')](_0x504f12['text'],'in','','');this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('Trying\x20Dialogflow:\x20%s',_0x504f12[_0x32b8('0x56')]));var _0x120c12=this[_0x32b8('0x74')][_0x32b8('0x6a')](this,_0x504f12);if(_0x120c12){for(var _0x1b46c4 in _0x120c12){if(_0x120c12[_0x32b8('0x8e')](_0x1b46c4)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0xe2'),_0x1b46c4[_0x32b8('0x63')]()),_0x120c12[_0x1b46c4]);}}this[_0x32b8('0x3d')](_0x120c12[_0x32b8('0xe3')],_0x32b8('0xe4'),_0x32b8('0xe5'),'');return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xe6'),_0x120c12[_0x32b8('0xe3')]));}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x504f12,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x32b8('0x16')][_0x32b8('0xe7')]=function(_0x5cb7f2){logger['info'](util[_0x32b8('0x26')](_0x32b8('0xe8'),_0x5cb7f2[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0xe9')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xea'));}if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0x76')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xeb'));}if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0xec')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xed'));}if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0x77')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20anguage\x20configured');}if(!this[_0x32b8('0x7d')](_0x5cb7f2['text'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')]['bot']=!![];this[_0x32b8('0x30')](_0x5cb7f2);this[_0x32b8('0x3d')](_0x5cb7f2['text'],'in','','');this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Trying\x20DialogflowV2:\x20%s',_0x5cb7f2[_0x32b8('0x56')]));var _0x9a0be=this[_0x32b8('0xee')][_0x32b8('0x6a')](this,_0x5cb7f2);if(_0x9a0be){for(var _0x4dcafc in _0x9a0be){if(_0x9a0be[_0x32b8('0x8e')](_0x4dcafc)){if(_0x4dcafc!==_0x32b8('0xef')){this[_0x32b8('0x31')]['setVariable'](util['format'](_0x32b8('0xe2'),_0x4dcafc[_0x32b8('0x63')]()),_0x9a0be[_0x4dcafc]);}}}this[_0x32b8('0x3d')](_0x9a0be[_0x32b8('0xe3')],_0x32b8('0xe4'),_0x32b8('0xe7'),_0x9a0be['providerResponse']);return this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('DialogflowV2\x20Result\x20%s',_0x9a0be[_0x32b8('0xe3')]));}return this[_0x32b8('0x31')]['error'](_0x5cb7f2,_0x32b8('0xf0'));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xf1')]=function(_0xac9ae9){logger['info'](util[_0x32b8('0x26')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xac9ae9[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf2')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xf3'));}if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf4')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xf5'));}if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf6')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xf7'));}if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf8')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}this['channel'][_0x32b8('0xe1')]=!![];this[_0x32b8('0x30')](_0xac9ae9);this['createSquareMessage'](_0xac9ae9[_0x32b8('0x56')],'in','','');this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xf9'),_0xac9ae9[_0x32b8('0x56')]));var _0x34a831=this[_0x32b8('0x78')][_0x32b8('0x6a')](this,_0xac9ae9);if(_0x34a831){for(var _0x35400 in _0x34a831){if(_0x34a831[_0x32b8('0x8e')](_0x35400)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0xfa'),_0x35400['toUpperCase']()),_0x34a831[_0x35400]);}}this[_0x32b8('0x3d')](_0x34a831[_0x32b8('0xe3')],_0x32b8('0xe4'),_0x32b8('0xf1'),'');if(_0x34a831[_0x32b8('0xfb')]){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x34a831[_0x32b8('0xfb')]));var _0x303852=this[_0x32b8('0x31')]['streamFile'](_0x34a831[_0x32b8('0xfb')]);try{fs['unlink'](_0x34a831['audiofile']+_0x32b8('0xfc'));}catch(_0x26c06e){logger[_0x32b8('0x2e')](_0x26c06e);}return _0x303852;}else{return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('SestekNDA\x20Result\x20%s',_0x34a831[_0x32b8('0xe3')]));}}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xac9ae9,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype']['end']=function(_0x324d2f){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xfd'),_0x324d2f[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xfe'));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xff')]=function(_0xde691a){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x100'),_0xde691a[_0x32b8('0x32')]));var _0x15e414='';if(_0xde691a[_0x32b8('0x101')]){if(!this[_0x32b8('0x7d')](_0xde691a[_0x32b8('0x101')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xde691a,_0x32b8('0x102'));}else{var _0x9acaf0=parseInt(_0xde691a[_0x32b8('0x101')],0xa);if(isNaN(_0x9acaf0)){_0x15e414=_0xde691a[_0x32b8('0x101')];}else{_0x15e414=this[_0x32b8('0x18')][_0x32b8('0x6a')](this,_0xde691a[_0x32b8('0x101')]);if(!_0x15e414){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xde691a,'no\x20trunk\x20found');}}}}else if(_0xde691a[_0x32b8('0x103')]){_0x15e414=_0xde691a[_0x32b8('0x103')];}else{return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xde691a,_0x32b8('0x102'));}var _0x1b2830=this['channel']['exec'](_0x32b8('0xdb'),[util[_0x32b8('0x26')](_0x32b8('0x104'),_0x15e414,_0xde691a['phone']),_0xde691a[_0x32b8('0x61')],_0xde691a[_0x32b8('0xdd')],_0xde691a[_0x32b8('0x6b')]]);if(_0x1b2830[_0x32b8('0x9e')]===-0x1){return _0x1b2830;}return this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0xde'),_0x32b8('0xdb')));};AGIVertices[_0x32b8('0x16')]['finally']=function(_0x309194){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x309194[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x105'));};AGIVertices['prototype']['getdigits']=function(_0x4d3ed8){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x106'),_0x4d3ed8[_0x32b8('0x32')]));if(_0x4d3ed8[_0x32b8('0x107')]===0x0){return this[_0x32b8('0xa0')](_0x4d3ed8);}_0x4d3ed8['retry']-=0x1;if(!this['isConfigured'](_0x4d3ed8[_0x32b8('0x108')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4d3ed8,'no\x20file\x20audio\x20selected');}var _0x338acf=this[_0x32b8('0x1a')][_0x32b8('0x6a')](this,_0x4d3ed8[_0x32b8('0x108')]);if(!_0x338acf){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4d3ed8,_0x32b8('0x109'));}if(!this[_0x32b8('0x7d')](_0x4d3ed8[_0x32b8('0xd2')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x32b8('0xd1'));}var _0x115017=this['channel'][_0x32b8('0x10a')](_0x338acf,_0x4d3ed8[_0x32b8('0x10b')],_0x4d3ed8[_0x32b8('0x10c')]);var _0x540b5e=_0x115017[_0x32b8('0x9e')]?_0x115017[_0x32b8('0x9e')][_0x32b8('0x48')]():'';logger[_0x32b8('0x29')](_0x32b8('0x10d'),JSON['stringify'](_0x115017));if(_0x115017[_0x32b8('0x9e')]===-0x1){this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x4d3ed8,_0x540b5e);return _0x115017;}else if(_0x115017[_0x32b8('0x9c')]===_0x32b8('0x61')){_0x115017[_0x32b8('0x9e')]=_0x540b5e[_0x32b8('0x9a')]>=parseInt(_0x4d3ed8[_0x32b8('0x10e')])?'x':'i';}else{_0x115017[_0x32b8('0x9e')]=_0x540b5e[_0x32b8('0x9a')]>=parseInt(_0x4d3ed8[_0x32b8('0x10e')])&&_0x540b5e[_0x32b8('0x9a')]<=parseInt(_0x4d3ed8[_0x32b8('0x10c')])?'x':'i';}var _0x3d44ef=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x4d3ed8[_0x32b8('0xd2')]);if(!_0x3d44ef){return this['channel'][_0x32b8('0x2e')](_0x4d3ed8,_0x32b8('0x10f'));}this[_0x32b8('0x31')][_0x32b8('0x97')](_0x3d44ef,_0x540b5e);if(this[_0x32b8('0x7d')](_0x4d3ed8['hiddendigitsnum'])){var _0x82aba5=parseInt(_0x4d3ed8[_0x32b8('0x110')],0xa);var _0x3a3f66=rs[_0x32b8('0x111')]({'charset':'*','length':_0x82aba5});var _0x43ff42=_0x540b5e[_0x32b8('0x9a')];if(_0x43ff42>0x0){if(_0x43ff42>_0x82aba5){this[_0x32b8('0x30')]['sync'](this,_0x4d3ed8,_0x4d3ed8[_0x32b8('0x112')]===_0x32b8('0x113')?_0x3a3f66+_0x540b5e['substr'](_0x82aba5):_0x540b5e[_0x32b8('0x114')](0x0,_0x43ff42-_0x82aba5)+_0x3a3f66);}else{this['createSquareDetailsReport']['sync'](this,_0x4d3ed8,rs[_0x32b8('0x111')]({'charset':'*','length':_0x43ff42}));}}else{this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x4d3ed8,'');}}else{this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x4d3ed8,_0x540b5e);}return _0x115017;};AGIVertices[_0x32b8('0x16')]['getsecretdigits']=function(_0x179470){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x115'),_0x179470['label']));return this['getdigits'](_0x179470);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x116')]=function(_0x3c110c){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x117'),_0x3c110c[_0x32b8('0x32')]));this['createSquareDetailsReport'][_0x32b8('0x6a')](this,_0x3c110c,_0x3c110c[_0x32b8('0x118')]);return this['channel']['noop'](util[_0x32b8('0x26')](_0x32b8('0x119'),_0x3c110c[_0x32b8('0x118')]));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x11a')]=function(_0x26ea0f){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x26ea0f[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x26ea0f['aws_access_key_id'])||!this[_0x32b8('0x7d')](_0x26ea0f[_0x32b8('0x81')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x26ea0f['text'])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x26ea0f[_0x32b8('0x56')]));var _0x218656=this[_0x32b8('0x7f')][_0x32b8('0x6a')](this,_0x26ea0f);if(_0x218656){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x11b'),_0x218656));var _0x1c5728=this[_0x32b8('0x31')][_0x32b8('0x11c')](_0x218656);try{fs[_0x32b8('0x11d')](_0x218656+'.wav');}catch(_0x15dacc){logger[_0x32b8('0x2e')](_0x15dacc);}return _0x1c5728;}return this['channel']['error'](_0x26ea0f,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x32b8('0x11e')]=function(_0x16649c){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x16649c['label']));if(!this['isConfigured'](_0x16649c['aws_access_key_id'])||!this['isConfigured'](_0x16649c['aws_secret_access_key'])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0x11f'));}if(!this[_0x32b8('0x7d')](_0x16649c[_0x32b8('0x86')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x120'));}if(!this[_0x32b8('0x7d')](_0x16649c['text'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xe1')]=!![];this['createSquareDetailsReport'](_0x16649c);this[_0x32b8('0x3d')](_0x16649c[_0x32b8('0x56')],'in','','');this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x121'),_0x16649c[_0x32b8('0x56')]));var _0x3e48be=this[_0x32b8('0x122')][_0x32b8('0x6a')](this,_0x16649c);if(_0x3e48be){for(var _0x170295 in _0x3e48be){if(_0x3e48be['hasOwnProperty'](_0x170295)&&_[_0x32b8('0x8f')](_0x3e48be[_0x170295])){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x123'),_0x170295[_0x32b8('0x63')]()),_0x3e48be[_0x170295]);}}if(_[_0x32b8('0x43')](_0x3e48be[_0x32b8('0x71')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0x124'));}else{this[_0x32b8('0x3d')](_0x3e48be[_0x32b8('0x71')],_0x32b8('0xe4'),_0x32b8('0x125'),'');return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x126'),_0x3e48be[_0x32b8('0x71')]));}}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x16649c,_0x32b8('0x127'));};AGIVertices['prototype'][_0x32b8('0x128')]=function(_0x598866){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x129'),_0x598866[_0x32b8('0x32')],_0x598866[_0x32b8('0x61')]));if(!this[_0x32b8('0x7d')](_0x598866['key'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20key\x20configured');}var _0x36bfcb=_0x32b8('0x12a');var _0x18785c=util[_0x32b8('0x26')](_0x32b8('0x12b'),FILES_PATH,rs[_0x32b8('0x111')](0x4));var _0x106d8d=util[_0x32b8('0x26')](_0x32b8('0x95'),_0x18785c,_0x36bfcb);var _0x224bac=!![];if(_0x598866[_0x32b8('0x12c')]==='NOBEEP'){_0x224bac=![];}var _0x33cca8=this[_0x32b8('0x31')]['recordFile'](_0x18785c,_0x36bfcb,_0x598866[_0x32b8('0x12d')],_0x598866['timeout'],undefined,_0x224bac);if(_0x33cca8[_0x32b8('0x9e')]!==-0x1){this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')]('google\x20%s\x20file\x20created',_0x106d8d));var _0x32ce9b=this[_0x32b8('0x12e')][_0x32b8('0x6a')](this,_0x598866,_0x106d8d);if(_0x32ce9b){for(var _0xcf2eba in _0x32ce9b){if(_0x32ce9b[_0x32b8('0x8e')](_0xcf2eba)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x12f'),_0xcf2eba['toUpperCase']()),_0x32ce9b[_0xcf2eba]);}}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x130'),JSON['stringify'](_0x32ce9b)));}}return _0x33cca8;};AGIVertices[_0x32b8('0x16')]['tildeasr']=function(_0x59d1fb){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x131'),_0x59d1fb[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x59d1fb['appid'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20appid\x20configured');}if(!this[_0x32b8('0x7d')](_0x59d1fb[_0x32b8('0x8a')])){return this[_0x32b8('0x31')]['noop']('no\x20appsecret\x20configured');}var _0x1e3e4d=_0x32b8('0x12a');var _0xe464b5=util['format'](_0x32b8('0x12b'),FILES_PATH,rs[_0x32b8('0x111')](0x4));var _0x308b68=util[_0x32b8('0x26')](_0x32b8('0x95'),_0xe464b5,_0x1e3e4d);var _0x5de46d=!![];if(_0x59d1fb['beep']==='NOBEEP'){_0x5de46d=![];}var _0x5da5a0=this[_0x32b8('0x31')]['recordFile'](_0xe464b5,_0x1e3e4d,_0x59d1fb[_0x32b8('0x12d')],_0x59d1fb[_0x32b8('0x61')],undefined,_0x5de46d);if(_0x5da5a0[_0x32b8('0x9e')]!==-0x1){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x132'),_0x308b68));var _0x45c9c7=this['tildeASR']['sync'](this,_0x59d1fb,_0x308b68);if(_0x45c9c7){for(var _0x30da9c in _0x45c9c7){if(_0x45c9c7['hasOwnProperty'](_0x30da9c)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x133'),_0x30da9c[_0x32b8('0x63')]()),_0x45c9c7[_0x30da9c]);}}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x134'),JSON[_0x32b8('0x6d')](_0x45c9c7)));}}return _0x5da5a0;};AGIVertices['prototype'][_0x32b8('0x135')]=function(_0x3a20d0){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3a20d0['label']));return this[_0x32b8('0x31')]['continueAt'](_0x3a20d0['context'],_0x3a20d0[_0x32b8('0x136')],_0x3a20d0[_0x32b8('0x39')]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x137')]=function(_0x53a793){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x138'),_0x53a793[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x53a793[_0x32b8('0x139')])){return this['channel'][_0x32b8('0x2e')](_0x53a793,_0x32b8('0x13a'));}try{var _0x5c2461=eval(_0x53a793[_0x32b8('0x139')])?_0x32b8('0x13b'):'false';this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')]('EVAL\x20CONDITION\x20%s\x20%s',_0x53a793[_0x32b8('0x139')],_0x5c2461));return{'code':0xc8,'result':_0x5c2461};}catch(_0x140aad){return{'code':0xc8,'result':_0x32b8('0x13c')};}};AGIVertices['prototype'][_0x32b8('0x13d')]=function(_0x5203f6){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5203f6[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x5203f6['interval_id'])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x5203f6,_0x32b8('0x13e'));}var _0x510a83=this[_0x32b8('0x20')][_0x32b8('0x6a')](this,_0x5203f6[_0x32b8('0x13f')]);if(!_0x510a83){return this[_0x32b8('0x31')]['error'](_0x5203f6,'no\x20intervals\x20found');}for(var _0xd7d100=0x0;_0xd7d100<_0x510a83[_0x32b8('0x9a')];_0xd7d100+=0x1){var _0x3945fb=this[_0x32b8('0x31')]['getVariable'](util[_0x32b8('0x26')](_0x32b8('0x140'),_0x510a83[_0xd7d100]));if(_0x3945fb['result']===-0x1){return _0x3945fb;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x510a83[_0xd7d100],_0x3945fb['extra']));if(_0x3945fb['extra']===_0x32b8('0x13b')){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],'true'));this['channel']['noop'](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],_0x32b8('0x13b')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],'false'));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],_0x32b8('0x13c')));}}return{'code':0xc8,'result':_0x32b8('0x13c')};};AGIVertices[_0x32b8('0x16')][_0x32b8('0x142')]=function(_0x3d4e58){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x143'),_0x3d4e58[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0x142')]();};AGIVertices['prototype'][_0x32b8('0x144')]=function(_0x1f937d){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x145'),_0x1f937d[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x1f937d[_0x32b8('0x75')])){return this['channel'][_0x32b8('0xa4')]('no\x20key\x20configured');}var _0x298300=_0x32b8('0x12a');var _0x512f90=util[_0x32b8('0x26')](_0x32b8('0x12b'),FILES_PATH,rs[_0x32b8('0x111')](0x4));var _0x165a1e=util['format'](_0x32b8('0x95'),_0x512f90,_0x298300);var _0x1f7cf7=!![];if(_0x1f937d['beep']===_0x32b8('0x146')){_0x1f7cf7=![];}var _0x1667ce=this['channel']['recordFile'](_0x512f90,_0x298300,_0x1f937d[_0x32b8('0x12d')],_0x1f937d[_0x32b8('0x61')],undefined,_0x1f7cf7);if(_0x1667ce[_0x32b8('0x9e')]!==-0x1){this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x147'),_0x165a1e));var _0x38b33e=this[_0x32b8('0x7c')]['sync'](this,_0x1f937d,_0x165a1e);if(_0x38b33e){for(var _0x536fdb in _0x38b33e){if(_0x38b33e[_0x32b8('0x8e')](_0x536fdb)){this[_0x32b8('0x31')][_0x32b8('0x97')](util['format'](_0x32b8('0x148'),_0x536fdb[_0x32b8('0x63')]()),_0x38b33e[_0x536fdb]);}}return this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0x149'),JSON['stringify'](_0x38b33e)));}}return _0x1667ce;};AGIVertices['prototype'][_0x32b8('0x14a')]=function(_0x2e47d2){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x14b'),_0x2e47d2['label']));if(!this[_0x32b8('0x7d')](_0x2e47d2[_0x32b8('0x75')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xe0'));}if(!this[_0x32b8('0x7d')](_0x2e47d2['text'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('Trying\x20ispeech\x20TTS\x20%s',_0x2e47d2['text']));var _0x30c4f3=this['ispeechTTS']['sync'](this,_0x2e47d2);if(_0x30c4f3){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x147'),_0x30c4f3));var _0x2534ea=this[_0x32b8('0x31')][_0x32b8('0x11c')](_0x30c4f3,_0x2e47d2['intKey']);try{fs[_0x32b8('0x11d')](_0x30c4f3+_0x32b8('0xfc'));}catch(_0x348fff){logger['error'](_0x348fff);}return _0x2534ea;}return this['channel'][_0x32b8('0x2e')](_0x2e47d2,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x32b8('0x16')][_0x32b8('0x14c')]=function(_0x41b00a){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x14d'),_0x41b00a[_0x32b8('0x32')]));if(!this['isConfigured'](_0x41b00a[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x41b00a,_0x32b8('0x14f'));}logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x150'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));var _0x2d3580=this['agentLogin'][_0x32b8('0x6a')](this,_0x41b00a[_0x32b8('0x14e')]);if(_0x2d3580){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a['findBy']));this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x32b8('0x152'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format'](_0x32b8('0x152'),this['channel'][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x32b8('0x153')]=function(_0x38956b){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x154'),_0x38956b['label']));if(!this[_0x32b8('0x7d')](_0x38956b[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x38956b,'no\x20find\x20by\x20configured');}logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x150'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x38956b[_0x32b8('0x14e')]));var _0x4712be=this[_0x32b8('0x4c')][_0x32b8('0x6a')](this,_0x38956b['findBy']);if(_0x4712be){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x151'),this['channel'][_0x32b8('0x34')],_0x38956b['findBy']));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x32b8('0x34')],_0x38956b[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x155')};}else{logger[_0x32b8('0x29')](util['format'](_0x32b8('0x152'),this['channel']['callerid'],_0x38956b[_0x32b8('0x14e')]));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x152'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x38956b[_0x32b8('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x156')]=function(_0x38019b){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x157'),_0x38019b['label']));if(!this[_0x32b8('0x7d')](_0x38019b[_0x32b8('0x158')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x38019b,_0x32b8('0x159'));}this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')](_0x32b8('0x15a'),_0x38019b[_0x32b8('0x158')]));var _0x5cc34d=eval(_0x38019b['operation']);if(!this[_0x32b8('0x7d')](_0x38019b['variable_id'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xd1'));}var _0x580d89=this['getVariable']['sync'](this,_0x38019b[_0x32b8('0xd2')]);if(!_0x580d89){return this[_0x32b8('0x31')]['error'](_0x38019b,_0x32b8('0x10f'));}if(_[_0x32b8('0x96')](_0x5cc34d)){var _0x140687=this;_0x5cc34d[_0x32b8('0xd3')](function(_0x2c8f86,_0x38de5b){_0x140687[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')]('%s[%s]',_0x580d89,_0x38de5b),_0x2c8f86);});return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('variable\x20%s[key]\x20set',_0x580d89));}else{return this[_0x32b8('0x31')][_0x32b8('0x97')](_0x580d89,_0x5cc34d);}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x9')]=function(_0x35aae6){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x15b'),_0x35aae6[_0x32b8('0x32')]));if(_0x35aae6[_0x32b8('0x107')]===0x0){return this[_0x32b8('0xa0')](_0x35aae6);}_0x35aae6[_0x32b8('0x107')]-=0x1;if(!this[_0x32b8('0x7d')](_0x35aae6['file_id'])){return this['channel'][_0x32b8('0x2e')](_0x35aae6,_0x32b8('0x15c'));}var _0x4337fd=this['getSound'][_0x32b8('0x6a')](this,_0x35aae6[_0x32b8('0x108')]);if(!_0x4337fd){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x35aae6,_0x32b8('0x109'));}var _0x2dbdb1=this[_0x32b8('0x31')]['getData'](_0x4337fd,_0x35aae6[_0x32b8('0x10b')],_0x35aae6[_0x32b8('0x15d')]);var _0x5ed878=_0x2dbdb1[_0x32b8('0x9e')];if(_0x2dbdb1[_0x32b8('0x9e')]===-0x1){this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x35aae6,'-1');return _0x2dbdb1;}else if(_0x2dbdb1['extra']===_0x32b8('0x61')){_0x2dbdb1[_0x32b8('0x9e')]=_0x2dbdb1[_0x32b8('0x9e')]['length']>0x0?_0x2dbdb1[_0x32b8('0x9e')]:'t';}else if(_['isEmpty'](_0x2dbdb1['result'])){_0x2dbdb1['result']='#';_0x5ed878='#';}if(!this['isConfigured'](_0x35aae6['variable_id'])){this['channel'][_0x32b8('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x98b97e=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x35aae6[_0x32b8('0xd2')]);if(!_0x98b97e){return this['channel'][_0x32b8('0x2e')](_0x35aae6,'no\x20variable\x20found');}this[_0x32b8('0x31')][_0x32b8('0x97')](_0x98b97e,_0x5ed878);}this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x35aae6,_0x5ed878);return _0x2dbdb1;};AGIVertices[_0x32b8('0x16')][_0x32b8('0xa4')]=function(_0x179b7d){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x15e'),_0x179b7d[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x179b7d[_0x32b8('0x15f')]||_0x179b7d['label']);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x160')]=function(_0x4ad3ae){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4ad3ae[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x4ad3ae[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4ad3ae,_0x32b8('0x14f'));}logger['info'](util['format'](_0x32b8('0x150'),this[_0x32b8('0x31')]['callerid'],_0x4ad3ae[_0x32b8('0x14e')]));var _0x19077c=this['getPause'][_0x32b8('0x6a')](this,_0x4ad3ae[_0x32b8('0x161')]);var _0x471c1f=this['agentPause']['sync'](this,_0x4ad3ae[_0x32b8('0x14e')],_0x19077c);if(_0x471c1f){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x151'),this['channel'][_0x32b8('0x34')],_0x4ad3ae['findBy']));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x4ad3ae[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x155')};}else{logger[_0x32b8('0x29')](util['format'](_0x32b8('0x152'),this['channel'][_0x32b8('0x34')],_0x4ad3ae['findBy']));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x4ad3ae[_0x32b8('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x162')]=function(_0x57e2bb){logger['info'](util['format'](_0x32b8('0x163'),_0x57e2bb[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x57e2bb[_0x32b8('0x108')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x57e2bb,_0x32b8('0x15c'));}var _0x110969=this[_0x32b8('0x1a')]['sync'](this,_0x57e2bb[_0x32b8('0x108')]);if(!_0x110969){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x57e2bb,_0x32b8('0x109'));}var _0xa2747d=this[_0x32b8('0x31')][_0x32b8('0xaa')]('PLAYBACK',[_0x110969,_0x57e2bb['opts']]);if(_0xa2747d[_0x32b8('0x9e')]===-0x1){return _0xa2747d;}return this[_0x32b8('0x31')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x32b8('0x164'),_0x110969));};AGIVertices[_0x32b8('0x16')]['queue']=function(_0x1cdf43){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x165'),_0x1cdf43[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x1cdf43[_0x32b8('0x166')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1cdf43,_0x32b8('0x167'));}var _0x2f1eb6='';var _0x5a4058=parseInt(_0x1cdf43[_0x32b8('0x166')],0xa);if(isNaN(_0x5a4058)){_0x2f1eb6=_0x1cdf43['queue_id'];}else{_0x2f1eb6=this[_0x32b8('0x10')][_0x32b8('0x6a')](this,_0x1cdf43['queue_id']);if(!_0x2f1eb6){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1cdf43,_0x32b8('0x168'));}}var _0x172724='';if(this[_0x32b8('0x7d')](_0x1cdf43['file_id'])){var _0x28a615=this[_0x32b8('0x1a')][_0x32b8('0x6a')](this,_0x1cdf43[_0x32b8('0x108')]);if(_0x28a615){_0x172724=_0x28a615;}}this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x1cdf43,_0x2f1eb6);if(_0x1cdf43['opts']['indexOf']('x')<0x0){_0x1cdf43['opts']+='x';}if(_0x1cdf43[_0x32b8('0xdd')][_0x32b8('0x169')]('X')<0x0){_0x1cdf43[_0x32b8('0xdd')]+='X';}this[_0x32b8('0x31')]['setVariable'](_0x32b8('0x16a'),_0x2f1eb6?_0x2f1eb6['toLowerCase']():'');var _0x38a1b1=this['channel'][_0x32b8('0xaa')]('QUEUE',[_0x2f1eb6,_0x1cdf43[_0x32b8('0xdd')],_0x1cdf43['url'],_0x172724,_0x1cdf43[_0x32b8('0x61')],_0x1cdf43[_0x32b8('0x5')],_0x1cdf43[_0x32b8('0x16b')],_0x1cdf43[_0x32b8('0x16c')],'',_0x1cdf43[_0x32b8('0x16d')]]);if(_0x38a1b1[_0x32b8('0x9e')]===-0x1){return _0x38a1b1;}return this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x2f1eb6));};AGIVertices['prototype'][_0x32b8('0x16e')]=function(_0x310e8b){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x16f'),_0x310e8b['label']));var _0x47b85a=_0x310e8b[_0x32b8('0x170')]||_0x32b8('0x12a');var _0x696acd=util[_0x32b8('0x26')](_0x32b8('0x171'),this[_0x32b8('0x31')]['uniqueid'],rs[_0x32b8('0x111')](0x5));var _0x1e9a63=util[_0x32b8('0x26')](_0x32b8('0x172'),FILES_PATH,_0x696acd,_0x47b85a);var _0x2a1aaf=util['format']('%s/recordings/%s',FILES_PATH,_0x696acd);this[_0x32b8('0x35')][_0x32b8('0x6a')](this,_0x310e8b,_0x696acd,_0x1e9a63);this[_0x32b8('0x31')][_0x32b8('0x97')](_0x32b8('0x173'),_0x696acd);logger[_0x32b8('0x29')](_0x32b8('0x174'),_0x2a1aaf,_0x47b85a,_0x310e8b[_0x32b8('0x175')],_0x310e8b[_0x32b8('0x61')]);return this[_0x32b8('0x31')][_0x32b8('0x176')](_0x2a1aaf,_0x47b85a,_0x310e8b[_0x32b8('0x175')],_0x310e8b[_0x32b8('0x61')],undefined,!![]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x177')]=function(_0x241c74){logger[_0x32b8('0x29')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x241c74[_0x32b8('0x32')]));if(!this['isConfigured'](_0x241c74[_0x32b8('0x6b')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x178'));}var _0x5669a9=this[_0x32b8('0x5f')]['sync'](this,_0x241c74);logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x179'),util['inspect'](_0x5669a9,{'showHidden':![],'depth':null})));if(!this[_0x32b8('0x7d')](_0x241c74[_0x32b8('0xd2')])){return this[_0x32b8('0x31')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x42b69b=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x241c74[_0x32b8('0xd2')]);if(!_0x42b69b){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x241c74,_0x32b8('0x10f'));}this[_0x32b8('0x31')][_0x32b8('0x97')](util['format']('%s_STATUS_CODE',_0x42b69b),_0x5669a9[_0x32b8('0x6f')]?_0x5669a9['statusCode']:'200');this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x17a'),_0x42b69b),_0x5669a9[_0x32b8('0x70')]?_0x5669a9[_0x32b8('0x70')]:'OK');if(_0x5669a9[_0x32b8('0x64')]){try{this['saveRestApiResult'](_0x5669a9[_0x32b8('0x64')],_0x42b69b);}catch(_0x1d7036){logger[_0x32b8('0x2e')](util[_0x32b8('0x26')](_0x32b8('0x17b'),_0x42b69b));}}return this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('variable\x20%s\x20set',_0x42b69b));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x17c')]=function(_0x3c7119){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x17d'),_0x3c7119['label']));return this[_0x32b8('0x31')][_0x32b8('0x17e')](_0x3c7119[_0x32b8('0x17f')][_0x32b8('0x53')](/\s+/g,''),_0x3c7119[_0x32b8('0x175')]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x180')]=function(_0x26880c){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x181'),_0x26880c[_0x32b8('0x32')]));return this['channel'][_0x32b8('0x182')](_0x26880c[_0x32b8('0x183')][_0x32b8('0x53')](/\s+/g,''),_0x26880c[_0x32b8('0x175')]);};AGIVertices[_0x32b8('0x16')]['sayphonetic']=function(_0xdc33df){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x184'),_0xdc33df['label']));return this[_0x32b8('0x31')]['sayPhonetic'](_0xdc33df[_0x32b8('0x56')],_0xdc33df[_0x32b8('0x175')]);};AGIVertices['prototype']['sendMail']=function(_0x2d4095){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x185'),_0x2d4095[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x2d4095[_0x32b8('0x186')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x187'));}var _0x45bb2a=this[_0x32b8('0x188')]['sync'](this,_0x2d4095[_0x32b8('0x186')]);if(!_0x45bb2a||!_0x45bb2a[_0x32b8('0x189')]){return this[_0x32b8('0x31')]['error'](_0x2d4095,_0x32b8('0x18a'));}var _0x41269e={'from':util[_0x32b8('0x26')]('\x22%s\x22\x20<%s>',_0x45bb2a[_0x32b8('0x12')],_0x45bb2a[_0x32b8('0x18b')]||_0x45bb2a[_0x32b8('0x189')]['user']),'to':_0x2d4095['to']||'','cc':_0x2d4095['cc']||'','bcc':_0x2d4095[_0x32b8('0x18c')]||'','subject':_0x2d4095[_0x32b8('0x18d')],'html':_0x2d4095[_0x32b8('0x56')],'text':_0x2d4095['text']};if(this[_0x32b8('0x7d')](_0x2d4095[_0x32b8('0x18e')])){}logger['debug'](_0x32b8('0x18f'),JSON[_0x32b8('0x6d')](_0x41269e));this['createSquareDetailsReport'][_0x32b8('0x6a')](this,_0x2d4095,_0x2d4095[_0x32b8('0x186')]);this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x45bb2a[_0x32b8('0x12')]));this[_0x32b8('0x1f')]['sync'](this,_0x45bb2a[_0x32b8('0x190')],_0x41269e);return this[_0x32b8('0x31')][_0x32b8('0xa4')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x32b8('0x16')]['sendFax']=function(_0x3cd177){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x191'),_0x3cd177['label']));return this['channel']['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x32b8('0x16')][_0x32b8('0x192')]=function(_0x41e410){logger['info'](util['format'](_0x32b8('0x193'),_0x41e410[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x41e410[_0x32b8('0x194')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x195'));}var _0xec689a=this[_0x32b8('0x196')][_0x32b8('0x6a')](this,_0x41e410[_0x32b8('0x194')]);if(!_0xec689a){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x41e410,'no\x20sms\x20account\x20found');}var _0xc209bd={'body':_0x41e410['sms_text'],'phone':_0x41e410['to']||'','SmsAccountId':_0xec689a['id']};logger[_0x32b8('0xd8')](_0x32b8('0x197'),JSON[_0x32b8('0x6d')](_0xc209bd));this[_0x32b8('0x30')]['sync'](this,_0x41e410,_0x41e410[_0x32b8('0x194')]);this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0x198'),_0xec689a[_0x32b8('0x12')]));this[_0x32b8('0x2f')]['sync'](this,_0xc209bd);return this[_0x32b8('0x31')]['noop'](_0x32b8('0x199'));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x19a')]=function(_0x1b1e29){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x19b'),_0x1b1e29[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x1b1e29[_0x32b8('0xd2')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1b1e29,_0x32b8('0x19c'));}var _0x1a7098=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x1b1e29[_0x32b8('0xd2')]);if(!_0x1a7098){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1b1e29,_0x32b8('0x10f'));}return this[_0x32b8('0x31')][_0x32b8('0x97')](_0x1a7098,_0x1b1e29['variable_value']);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x19d')]=function(_0x1bc2fb){logger['info'](util['format'](_0x32b8('0x19e'),_0x1bc2fb['label']));this[_0x32b8('0x31')]['noop'](_0x32b8('0x19f'));var _0x5d570f=this[_0x32b8('0x31')][_0x32b8('0xd')]('XMCS-UNIQUEID');if(!_[_0x32b8('0x3f')](_0x5d570f[_0x32b8('0x9c')])){this['channel']['uniqueid']=_0x5d570f[_0x32b8('0x9c')];}if(_0x1bc2fb[_0x32b8('0xb2')]===_0x32b8('0x1a0')){this[_0x32b8('0x31')]['noop']('Answer');return this[_0x32b8('0x31')][_0x32b8('0xb2')]();}return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x1a1'));};AGIVertices['prototype'][_0x32b8('0x1a2')]=function(_0x4e2706){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x1a3'),_0x4e2706[_0x32b8('0x32')]));if(!this['isConfigured'](_0x4e2706[_0x32b8('0x1a4')])){return this['channel']['error'](_0x4e2706,_0x32b8('0x1a5'));}var _0x1ef7bf=this['getSquareProject'][_0x32b8('0x6a')](this,_0x4e2706[_0x32b8('0x1a4')]);if(!this[_0x32b8('0x7d')](_0x1ef7bf)){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4e2706,util['format'](_0x32b8('0x1a6'),_0x4e2706[_0x32b8('0x1a4')]));}if(_0x1ef7bf===this[_0x32b8('0x31')][_0x32b8('0x3b')]){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4e2706,_0x32b8('0x1a7'));}this['createSquareDetailsReport'][_0x32b8('0x6a')](this,_0x4e2706,_0x1ef7bf);var _0xd2fce2=this['channel'][_0x32b8('0xaa')]('AGI',util['format'](_0x32b8('0x1a8'),config[_0x32b8('0x5')]['host']||_0x32b8('0x1a9'),_0x1ef7bf,this[_0x32b8('0x31')][_0x32b8('0x3b')]));if(_0xd2fce2[_0x32b8('0x9e')]===-0x1){return _0xd2fce2;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xbd'),_0x32b8('0x1aa'),_0x1ef7bf));};AGIVertices[_0x32b8('0x16')]['system']=function(_0x5ac6b2){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x1ab'),_0x5ac6b2[_0x32b8('0x32')]));var _0x4d4dc1=this[_0x32b8('0x1ac')][_0x32b8('0x6a')](this,_0x5ac6b2[_0x32b8('0xb0')]);this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x5ac6b2,_0x5ac6b2[_0x32b8('0xb0')]);if(this[_0x32b8('0x7d')](_0x5ac6b2['variable_id'])){var _0x1bab8c=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x5ac6b2[_0x32b8('0xd2')]);if(_0x1bab8c){this[_0x32b8('0x31')][_0x32b8('0x97')](_0x1bab8c,_0x4d4dc1);return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x1ad'),_0x5ac6b2[_0x32b8('0xb0')],_0x1bab8c));}}return this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0x1ae'),_0x5ac6b2[_0x32b8('0xb0')]));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1af')]=function(_0x4c1d96){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x1b0'),_0x4c1d96[_0x32b8('0x32')]));_0x4c1d96[_0x32b8('0x56')]=_0x4c1d96['text'][_0x32b8('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x32b8('0x7d')](_0x4c1d96[_0x32b8('0x55')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0x1b1'));}if(!this[_0x32b8('0x7d')](_0x4c1d96[_0x32b8('0x56')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x4c1d96[_0x32b8('0x56')]));var _0x16a8c5=this['googleCloudTTS'][_0x32b8('0x6a')](this,_0x4c1d96);if(_0x16a8c5){this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x16a8c5));var _0x214267=this[_0x32b8('0x31')]['streamFile'](_0x16a8c5);try{fs[_0x32b8('0x11d')](_0x16a8c5+_0x32b8('0xfc'));}catch(_0x3aabdf){logger[_0x32b8('0x2e')](_0x3aabdf);}return _0x214267;}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4c1d96,_0x32b8('0x1b2'));};AGIVertices[_0x32b8('0x16')]['tts']=function(_0x179cb3){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x1b3'),_0x179cb3['label']));_0x179cb3[_0x32b8('0x56')]=_0x179cb3[_0x32b8('0x56')][_0x32b8('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x32b8('0x7d')](_0x179cb3[_0x32b8('0x56')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x1b4'),_0x179cb3[_0x32b8('0x56')]));var _0x2a2120=this[_0x32b8('0x5d')][_0x32b8('0x6a')](this,_0x179cb3);if(_0x2a2120){this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format'](_0x32b8('0x1b5'),_0x2a2120));var _0x4afef6=this[_0x32b8('0x31')]['streamFile'](_0x2a2120);try{fs[_0x32b8('0x11d')](_0x2a2120+_0x32b8('0xfc'));}catch(_0x20c503){logger[_0x32b8('0x2e')](_0x20c503);}return _0x4afef6;}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x179cb3,_0x32b8('0x1b6'));};AGIVertices['prototype'][_0x32b8('0x1b7')]=function(_0x228417){logger['info'](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x228417['label']));if(!this[_0x32b8('0x7d')](_0x228417[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x228417,'no\x20find\x20by\x20configured');}logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x150'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));var _0x4744c7=this[_0x32b8('0x4b')][_0x32b8('0x6a')](this,_0x228417[_0x32b8('0x14e')]);if(_0x4744c7){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x155')};}else{logger[_0x32b8('0x29')](util['format'](_0x32b8('0x152'),this['channel'][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')](_0x32b8('0x152'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x1b8')};}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1b9')]=function(_0x353bfa){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x1ba'),_0x353bfa['label']));var _0x30de5c=this[_0x32b8('0x31')]['exec'](_0x32b8('0x1bb'),[_0x353bfa['mailbox'],_0x353bfa[_0x32b8('0x73')]]);if(_0x30de5c['result']===-0x1){return _0x30de5c;}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xbd'),'VOICEMAIL',_0x353bfa['mailbox']));};AGIVertices['prototype'][_0x32b8('0x1bc')]=function(_0xdf2888){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x1bd'),_0xdf2888[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0xdf2888[_0x32b8('0xd2')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xdf2888,_0x32b8('0x19c'));}var _0x118bf5=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0xdf2888[_0x32b8('0xd2')]);if(!_0x118bf5){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xdf2888,_0x32b8('0x10f'));}var _0xd9151b=this[_0x32b8('0x31')][_0x32b8('0xd')](_0x118bf5);return{'code':0xc8,'result':_0xd9151b[_0x32b8('0x9c')]?_0xd9151b[_0x32b8('0x9c')]:'-'};};String[_0x32b8('0x16')][_0x32b8('0x9b')]=function(_0x7ed552,_0x428395){return this[_0x32b8('0x99')](_0x7ed552)['join'](_0x428395);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 4dddca8..6512ec9 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 _0x7398=['hangup','syncHangup','bind','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','updateAcw','timers','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','ACW','name','mandatoryDispositionPause','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','queue','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','update','catch','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','deleteChannelAfterTimeout','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','channels','agentconnect','hanguprequest','syncHangupRequest'];(function(_0xd46333,_0x1b05c1){var _0x336108=function(_0x4a39ad){while(--_0x4a39ad){_0xd46333['push'](_0xd46333['shift']());}};_0x336108(++_0x1b05c1);}(_0x7398,0x105));var _0x8739=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x7398[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x8739('0x0'));var moment=require(_0x8739('0x1'));var ami=require(_0x8739('0x2'));var logger=require('../../../config/logger')(_0x8739('0x3'));var RpcUser=require(_0x8739('0x4'));var RpcVoiceAgentReport=require(_0x8739('0x5'));function Acw(_0x51463f){this[_0x8739('0x6')]=_0x51463f['voiceQueues'];this[_0x8739('0x7')]=_0x51463f['agents'];this['timers']=_0x51463f['timers'];this[_0x8739('0x8')]={};ami['on'](_0x8739('0x9'),this['syncAgentConnect']['bind'](this));ami['on'](_0x8739('0xa'),this[_0x8739('0xb')]['bind'](this));ami['on'](_0x8739('0xc'),this[_0x8739('0xd')][_0x8739('0xe')](this));ami['on'](_0x8739('0xf'),this[_0x8739('0x10')][_0x8739('0xe')](this));ami['on'](_0x8739('0x11'),this[_0x8739('0x12')][_0x8739('0xe')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x8739('0xe')](this));ami['on'](_0x8739('0x13'),this[_0x8739('0x14')][_0x8739('0xe')](this));}function getDiff(_0x4a452d){var _0x2f866c=moment()[_0x8739('0x15')](0x0);var _0x3b65f9=moment(_0x4a452d)['milliseconds'](0x0);return _0x2f866c['diff'](_0x3b65f9,_0x8739('0x16'));}Acw[_0x8739('0x17')][_0x8739('0x18')]=function(_0x157f35,_0x1b0e69){var _0x5469a5=this;var _0x3e02ef=getDiff(_0x5469a5[_0x8739('0x19')][_0x157f35][_0x8739('0x1a')]);clearTimeout(_0x5469a5[_0x8739('0x19')][_0x157f35][_0x8739('0x1b')]);_0x5469a5[_0x8739('0x19')][_0x157f35][_0x8739('0x1b')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x3e02ef},_0x5469a5[_0x8739('0x19')][_0x157f35][_0x8739('0x1c')],_0x157f35)[_0x8739('0x1d')](function(_0x3d8ccc){logger[_0x8739('0x1e')](_0x8739('0x1f'),_0x1b0e69,_0x3e02ef,_0x3d8ccc);})['catch'](function(_0x56a027){logger[_0x8739('0x20')](_0x8739('0x21'),_0x1b0e69,_0x56a027);})[_0x8739('0x22')](function(){delete _0x5469a5['timers'][_0x157f35];});};Acw[_0x8739('0x17')][_0x8739('0x23')]=function(_0x532ba0){try{var _0x476b70=this;var _0x36dee2=this[_0x8739('0x8')][_0x532ba0][_0x8739('0x24')];var _0x28aaf3=this['channels'][_0x532ba0]['queue'];var _0x25934b=this[_0x8739('0x6')][_0x28aaf3];var _0x25217e=![];var _0x459949=_0x8739('0x25');if(_0x25934b['mandatoryDisposition']&&_0x25934b['mandatoryDispositionPause'][_0x8739('0x26')]){_0x25217e=!![];_0x459949=_0x25934b[_0x8739('0x27')]['name'];}return ami[_0x8739('0x28')]({'action':_0x8739('0x29'),'interface':_0x36dee2,'paused':!![],'reason':_0x459949})[_0x8739('0x1d')](function(){if(_0x476b70['agents'][_0x36dee2]){return RpcUser[_0x8739('0x2a')](_0x476b70[_0x8739('0x7')][_0x36dee2]['id'])[_0x8739('0x1d')](function(_0x5786f6){if(!_0x5786f6||_0x5786f6[_0x8739('0x2b')]){logger['info'](_0x8739('0x2c'),_0x532ba0,_0x36dee2,_0x28aaf3);return;}logger[_0x8739('0x1e')](_0x8739('0x2d'),_0x532ba0,_0x36dee2,_0x28aaf3);var _0x732760=_0x476b70[_0x8739('0x8')][_0x532ba0][_0x8739('0x2e')]&&_0x476b70[_0x8739('0x8')][_0x532ba0][_0x8739('0x2f')]?_0x476b70[_0x8739('0x8')][_0x532ba0]['destlinkedid']:_0x532ba0;return RpcUser[_0x8739('0x30')](_0x476b70[_0x8739('0x7')][_0x36dee2],_0x459949,_0x732760)[_0x8739('0x1d')](function(_0x2154ab){_0x476b70[_0x8739('0x6')][_0x28aaf3][_0x8739('0x31')]-=0x1;_0x476b70[_0x8739('0x6')][_0x28aaf3][_0x8739('0x32')]+=0x1;return _0x2154ab;});})[_0x8739('0x1d')](function(_0x2c4380){if(_0x25217e||!_0x2c4380){return;}_0x476b70['timers'][_0x36dee2]={};logger[_0x8739('0x1e')](_0x8739('0x33'),_0x532ba0,_0x476b70[_0x8739('0x6')][_0x28aaf3][_0x8739('0x34')],_0x36dee2,_0x28aaf3);_0x476b70[_0x8739('0x19')][_0x36dee2][_0x8739('0x1b')]=setTimeout(_0x476b70[_0x8739('0x35')]['bind'](_0x476b70,_0x36dee2),_0x476b70[_0x8739('0x6')][_0x28aaf3][_0x8739('0x34')]*0x3e8);_0x476b70[_0x8739('0x19')][_0x36dee2]['lastPauseAt']=moment()['format'](_0x8739('0x36'));_0x476b70[_0x8739('0x19')][_0x36dee2][_0x8739('0x1c')]=_0x532ba0;_0x476b70[_0x8739('0x19')][_0x36dee2][_0x8739('0x37')]=_0x28aaf3;_0x476b70[_0x8739('0x19')][_0x36dee2][_0x8739('0x18')]=_0x476b70[_0x8739('0x18')][_0x8739('0xe')](_0x476b70,_0x36dee2,_0x532ba0);});}})['catch'](function(){logger['error'](_0x8739('0x33'),_0x532ba0,_0x476b70[_0x8739('0x6')][_0x28aaf3][_0x8739('0x34')],_0x36dee2,_0x28aaf3);})['finally'](function(){delete _0x476b70[_0x8739('0x8')][_0x532ba0];});}catch(_0x4ad6b8){logger[_0x8739('0x20')]('[ACW][START]\x20%s',_0x4ad6b8[_0x8739('0x38')]);}};Acw[_0x8739('0x17')][_0x8739('0x35')]=function(_0x599776){try{var _0x1bce78=this;if(_0x1bce78['timers'][_0x599776]){_0x1bce78[_0x8739('0x19')][_0x599776][_0x8739('0x1b')]=![];var _0xaee6bd=_0x1bce78[_0x8739('0x19')][_0x599776][_0x8739('0x1c')];var _0x14df90=_0x1bce78['timers'][_0x599776][_0x8739('0x37')];var _0x407d1f=_0x1bce78[_0x8739('0x6')][_0x14df90]['acwTimeout'];logger[_0x8739('0x1e')](_0x8739('0x39'),_0xaee6bd,_0x599776);RpcUser['getAgent'](this[_0x8739('0x7')][_0x599776]['id'])[_0x8739('0x1d')](function(_0x575ab6){if(_0x575ab6[_0x8739('0x3a')]==='ACW'){return RpcUser['saveUnpause'](_0x1bce78['agents'][_0x599776]);}});RpcVoiceAgentReport[_0x8739('0x3b')]({'acwtime':_0x407d1f,'agentacw':!![]},_0xaee6bd,_0x599776)['then'](function(_0x350960){logger[_0x8739('0x1e')]('[%s][UPDATE][ACWTIME:%s]',_0xaee6bd,_0x407d1f,_0x350960);})[_0x8739('0x3c')](function(_0x2c64ab){logger[_0x8739('0x20')]('[%s][UPDATE][ERRORS:%s]',_0xaee6bd,_0x2c64ab);});}else{logger[_0x8739('0x20')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x599776);if(_0x1bce78[_0x8739('0x19')]){logger['info'](_0x8739('0x3d'),JSON[_0x8739('0x3e')](_0x1bce78['timers']));}}}catch(_0xfacfc2){logger[_0x8739('0x20')](_0x8739('0x3f'),_0xfacfc2[_0x8739('0x38')]);}};Acw[_0x8739('0x17')]['syncAgentConnect']=function(_0x4bd288){try{if(this[_0x8739('0x6')][_0x4bd288['queue']]&&(this[_0x8739('0x6')][_0x4bd288[_0x8739('0x37')]][_0x8739('0x3')]||this[_0x8739('0x6')][_0x4bd288[_0x8739('0x37')]]['mandatoryDisposition'])){if(this['agents'][_0x4bd288['interface']]){this[_0x8739('0x8')][_0x4bd288[_0x8739('0x1c')]]={'queue':_0x4bd288[_0x8739('0x37')],'interface':_0x4bd288['interface'],'destlinkedid':_0x4bd288[_0x8739('0x2f')]};}}}catch(_0x31aa1d){logger[_0x8739('0x20')](_0x8739('0x40'),_0x31aa1d[_0x8739('0x38')]);}};Acw[_0x8739('0x17')]['syncAgentConnectPreview']=function(_0x4c4e1e){try{if(this[_0x8739('0x6')][_0x4c4e1e[_0x8739('0x37')]]&&(this[_0x8739('0x6')][_0x4c4e1e[_0x8739('0x37')]][_0x8739('0x3')]||this[_0x8739('0x6')][_0x4c4e1e[_0x8739('0x37')]][_0x8739('0x41')])){if(this['agents'][_0x4c4e1e['interface']]){this[_0x8739('0x8')][_0x4c4e1e[_0x8739('0x1c')]]={'queue':_0x4c4e1e[_0x8739('0x37')],'interface':_0x4c4e1e[_0x8739('0x24')]};}}}catch(_0x5debcc){logger['error'](_0x8739('0x42'),_0x5debcc[_0x8739('0x38')]);}};Acw[_0x8739('0x17')][_0x8739('0xb')]=function(_0x258434){try{if(this[_0x8739('0x8')][_0x258434[_0x8739('0x1c')]]&&_[_0x8739('0x43')](this[_0x8739('0x8')][_0x258434[_0x8739('0x1c')]][_0x8739('0x2e')])){logger[_0x8739('0x1e')](_0x8739('0x44'),_0x258434[_0x8739('0x1c')]);this[_0x8739('0x23')](_0x258434['uniqueid']);}else if(this[_0x8739('0x8')][_0x258434[_0x8739('0x45')]]&&_[_0x8739('0x43')](this['channels'][_0x258434[_0x8739('0x45')]]['attended'])){logger[_0x8739('0x1e')]('[%s][HANGUP:LINKEDID]',_0x258434[_0x8739('0x45')]);this[_0x8739('0x23')](_0x258434[_0x8739('0x45')]);}}catch(_0x44ba40){logger[_0x8739('0x20')](_0x8739('0x46'),_0x44ba40[_0x8739('0x38')]);}};Acw[_0x8739('0x17')]['syncHangup']=function(_0xcfbbb){try{if(this[_0x8739('0x8')][_0xcfbbb[_0x8739('0x1c')]]&&this[_0x8739('0x8')][_0xcfbbb['uniqueid']][_0x8739('0x2e')]){logger[_0x8739('0x1e')](_0x8739('0x47'),_0xcfbbb[_0x8739('0x1c')]);this[_0x8739('0x23')](_0xcfbbb[_0x8739('0x1c')]);}else if(this[_0x8739('0x8')][_0xcfbbb[_0x8739('0x45')]]&&this[_0x8739('0x8')][_0xcfbbb[_0x8739('0x45')]][_0x8739('0x2e')]){logger[_0x8739('0x1e')](_0x8739('0x48'),_0xcfbbb[_0x8739('0x45')]);this[_0x8739('0x23')](_0xcfbbb['linkedid']);}}catch(_0xfaa486){logger[_0x8739('0x20')](_0x8739('0x49'),_0xfaa486[_0x8739('0x38')]);}};Acw['prototype'][_0x8739('0x12')]=function(_0x166427){try{if(!_[_0x8739('0x4a')](this['channels'][_0x166427[_0x8739('0x4b')]])){this[_0x8739('0x23')](_0x166427['transfereeuniqueid']);if(this['channels'][_0x166427['secondtransfereruniqueid']]){this['channels'][_0x166427[_0x8739('0x4c')]][_0x8739('0x2e')]=!![];this[_0x8739('0x8')][_0x166427[_0x8739('0x4d')]]=this[_0x8739('0x8')][_0x166427[_0x8739('0x4c')]];this['deleteChannelAfterTimeout'](_0x166427[_0x8739('0x4c')]);}}else if(!_[_0x8739('0x4a')](this['channels'][_0x166427[_0x8739('0x4d')]])){this[_0x8739('0x23')](_0x166427['transfertargetuniqueid']);if(this['channels'][_0x166427[_0x8739('0x4e')]]){this[_0x8739('0x8')][_0x166427[_0x8739('0x4e')]][_0x8739('0x2e')]=!![];this[_0x8739('0x8')][_0x166427['transfereeuniqueid']]=this[_0x8739('0x8')][_0x166427[_0x8739('0x4e')]];this[_0x8739('0x4f')](_0x166427['origtransfereruniqueid']);}}}catch(_0x50fca3){logger[_0x8739('0x20')]('[ACW][syncAttendedTransfer]\x20%s',_0x50fca3[_0x8739('0x38')]);}};Acw[_0x8739('0x17')][_0x8739('0x50')]=function(_0x26fc60){try{if(this[_0x8739('0x8')][_0x26fc60['transfereruniqueid']]){logger[_0x8739('0x1e')](_0x8739('0x51'),JSON['stringify'](_0x26fc60[_0x8739('0x52')]));this[_0x8739('0x23')](_0x26fc60[_0x8739('0x52')]);}else if(this['channels'][_0x26fc60[_0x8739('0x53')]]){logger[_0x8739('0x1e')](_0x8739('0x54'),JSON['stringify'](_0x26fc60[_0x8739('0x53')]));this['startAcw'](_0x26fc60[_0x8739('0x53')]);}}catch(_0xf3e06c){logger[_0x8739('0x20')](_0x8739('0x55'),_0xf3e06c['message']);}};Acw['prototype'][_0x8739('0x10')]=function(_0x3d7664){try{if(this['voiceQueues'][_0x3d7664[_0x8739('0x37')]]&&this[_0x8739('0x6')][_0x3d7664[_0x8739('0x37')]][_0x8739('0x56')]===_0x8739('0x57')){if(this['agents'][_0x3d7664[_0x8739('0x24')]]){logger[_0x8739('0x1e')](_0x8739('0x58'),_0x3d7664[_0x8739('0x1c')],_0x3d7664['interface'],_0x3d7664[_0x8739('0x37')]);return RpcUser['savePause'](this[_0x8739('0x7')][_0x3d7664[_0x8739('0x24')]],_0x8739('0x59'),_0x3d7664[_0x8739('0x1c')]);}}}catch(_0x299307){logger[_0x8739('0x20')](_0x8739('0x5a'),_0x299307[_0x8739('0x38')]);}};Acw['prototype'][_0x8739('0x4f')]=function(_0x451591,_0x5ac7d3=0x2710){if(this[_0x8739('0x8')][_0x451591]){setTimeout(()=>{delete this['channels'][_0x451591];},_0x5ac7d3);}};module['exports']=Acw; \ No newline at end of file +var _0xed9d=['stopAcw','lastPauseAt','format','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','isUndefined','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','attendedtransfer','syncAttendedTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','interface','queue','mandatoryDisposition','name','mandatoryDispositionPause','Action','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','acwTimeout'];(function(_0x1877f6,_0x36065d){var _0xc063c5=function(_0x16970c){while(--_0x16970c){_0x1877f6['push'](_0x1877f6['shift']());}};_0xc063c5(++_0x36065d);}(_0xed9d,0x120));var _0xded9=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xed9d[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xded9('0x0'));var moment=require(_0xded9('0x1'));var ami=require(_0xded9('0x2'));var logger=require(_0xded9('0x3'))(_0xded9('0x4'));var RpcUser=require(_0xded9('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3b546a){this[_0xded9('0x6')]=_0x3b546a[_0xded9('0x6')];this['agents']=_0x3b546a[_0xded9('0x7')];this[_0xded9('0x8')]=_0x3b546a['timers'];this[_0xded9('0x9')]={};ami['on'](_0xded9('0xa'),this[_0xded9('0xb')][_0xded9('0xc')](this));ami['on'](_0xded9('0xd'),this[_0xded9('0xe')][_0xded9('0xc')](this));ami['on'](_0xded9('0xf'),this['syncHangup'][_0xded9('0xc')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xded9('0xc')](this));ami['on'](_0xded9('0x10'),this[_0xded9('0x11')][_0xded9('0xc')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xded9('0xc')](this));ami['on'](_0xded9('0x12'),this[_0xded9('0x13')]['bind'](this));}function getDiff(_0x5ad929){var _0x48bf57=moment()[_0xded9('0x14')](0x0);var _0x383019=moment(_0x5ad929)[_0xded9('0x14')](0x0);return _0x48bf57[_0xded9('0x15')](_0x383019,_0xded9('0x16'));}Acw[_0xded9('0x17')][_0xded9('0x18')]=function(_0x37390c,_0x3c87be){var _0x23d8cb=this;var _0x2e6977=getDiff(_0x23d8cb[_0xded9('0x8')][_0x37390c]['lastPauseAt']);clearTimeout(_0x23d8cb[_0xded9('0x8')][_0x37390c][_0xded9('0x19')]);_0x23d8cb[_0xded9('0x8')][_0x37390c][_0xded9('0x19')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x2e6977},_0x23d8cb['timers'][_0x37390c][_0xded9('0x1a')],_0x37390c)[_0xded9('0x1b')](function(_0x50c28c){logger[_0xded9('0x1c')](_0xded9('0x1d'),_0x3c87be,_0x2e6977,_0x50c28c);})[_0xded9('0x1e')](function(_0x4ffff3){logger[_0xded9('0x1f')](_0xded9('0x20'),_0x3c87be,_0x4ffff3);})[_0xded9('0x21')](function(){delete _0x23d8cb[_0xded9('0x8')][_0x37390c];});};Acw[_0xded9('0x17')]['startAcw']=function(_0x37ce32){try{var _0x3f5afa=this;var _0x5194bc=this[_0xded9('0x9')][_0x37ce32][_0xded9('0x22')];var _0x22677c=this[_0xded9('0x9')][_0x37ce32][_0xded9('0x23')];var _0x2fdf62=this[_0xded9('0x6')][_0x22677c];var _0x6f8cf2=![];var _0x455227='ACW';if(_0x2fdf62[_0xded9('0x24')]&&_0x2fdf62['mandatoryDispositionPause'][_0xded9('0x25')]){_0x6f8cf2=!![];_0x455227=_0x2fdf62[_0xded9('0x26')][_0xded9('0x25')];}return ami[_0xded9('0x27')]({'action':'QueuePause','interface':_0x5194bc,'paused':!![],'reason':_0x455227})['then'](function(){if(_0x3f5afa[_0xded9('0x7')][_0x5194bc]){return RpcUser[_0xded9('0x28')](_0x3f5afa[_0xded9('0x7')][_0x5194bc]['id'])[_0xded9('0x1b')](function(_0x15b62a){if(!_0x15b62a||_0x15b62a['voicePause']){logger[_0xded9('0x1c')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x37ce32,_0x5194bc,_0x22677c);return;}logger[_0xded9('0x1c')](_0xded9('0x29'),_0x37ce32,_0x5194bc,_0x22677c);var _0x1c0e75=_0x3f5afa[_0xded9('0x9')][_0x37ce32][_0xded9('0x2a')]&&_0x3f5afa[_0xded9('0x9')][_0x37ce32][_0xded9('0x2b')]?_0x3f5afa[_0xded9('0x9')][_0x37ce32]['destlinkedid']:_0x37ce32;return RpcUser[_0xded9('0x2c')](_0x3f5afa[_0xded9('0x7')][_0x5194bc],_0x455227,_0x1c0e75)[_0xded9('0x1b')](function(_0x20640d){_0x3f5afa[_0xded9('0x6')][_0x22677c][_0xded9('0x2d')]-=0x1;_0x3f5afa['voiceQueues'][_0x22677c][_0xded9('0x2e')]+=0x1;return _0x20640d;});})[_0xded9('0x1b')](function(_0x1b1d06){if(_0x6f8cf2||!_0x1b1d06){return;}_0x3f5afa[_0xded9('0x8')][_0x5194bc]={};logger[_0xded9('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x37ce32,_0x3f5afa[_0xded9('0x6')][_0x22677c][_0xded9('0x2f')],_0x5194bc,_0x22677c);_0x3f5afa[_0xded9('0x8')][_0x5194bc][_0xded9('0x19')]=setTimeout(_0x3f5afa[_0xded9('0x30')][_0xded9('0xc')](_0x3f5afa,_0x5194bc),_0x3f5afa[_0xded9('0x6')][_0x22677c][_0xded9('0x2f')]*0x3e8);_0x3f5afa['timers'][_0x5194bc][_0xded9('0x31')]=moment()[_0xded9('0x32')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f5afa[_0xded9('0x8')][_0x5194bc][_0xded9('0x1a')]=_0x37ce32;_0x3f5afa[_0xded9('0x8')][_0x5194bc][_0xded9('0x23')]=_0x22677c;_0x3f5afa['timers'][_0x5194bc][_0xded9('0x18')]=_0x3f5afa[_0xded9('0x18')][_0xded9('0xc')](_0x3f5afa,_0x5194bc,_0x37ce32);});}})['catch'](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x37ce32,_0x3f5afa['voiceQueues'][_0x22677c][_0xded9('0x2f')],_0x5194bc,_0x22677c);})[_0xded9('0x21')](function(){delete _0x3f5afa[_0xded9('0x9')][_0x37ce32];});}catch(_0x1b1482){logger['error'](_0xded9('0x33'),_0x1b1482[_0xded9('0x34')]);}};Acw[_0xded9('0x17')]['stopAcw']=function(_0x2c5224){try{var _0x42f6d4=this;if(_0x42f6d4['timers'][_0x2c5224]){_0x42f6d4[_0xded9('0x8')][_0x2c5224][_0xded9('0x19')]=![];var _0x374475=_0x42f6d4[_0xded9('0x8')][_0x2c5224][_0xded9('0x1a')];var _0x4e1862=_0x42f6d4[_0xded9('0x8')][_0x2c5224][_0xded9('0x23')];var _0xc9df88=_0x42f6d4[_0xded9('0x6')][_0x4e1862][_0xded9('0x2f')];logger['info'](_0xded9('0x35'),_0x374475,_0x2c5224);RpcUser[_0xded9('0x28')](this[_0xded9('0x7')][_0x2c5224]['id'])[_0xded9('0x1b')](function(_0x4a949f){if(_0x4a949f[_0xded9('0x36')]==='ACW'){return RpcUser[_0xded9('0x37')](_0x42f6d4['agents'][_0x2c5224]);}});RpcVoiceAgentReport[_0xded9('0x38')]({'acwtime':_0xc9df88,'agentacw':!![]},_0x374475,_0x2c5224)['then'](function(_0x20ecb7){logger['info'](_0xded9('0x1d'),_0x374475,_0xc9df88,_0x20ecb7);})[_0xded9('0x1e')](function(_0x42eda6){logger[_0xded9('0x1f')](_0xded9('0x20'),_0x374475,_0x42eda6);});}else{logger[_0xded9('0x1f')](_0xded9('0x39'),_0x2c5224);if(_0x42f6d4[_0xded9('0x8')]){logger[_0xded9('0x1c')]('[ACW][TIMERS]',JSON[_0xded9('0x3a')](_0x42f6d4[_0xded9('0x8')]));}}}catch(_0x115925){logger['error'](_0xded9('0x3b'),_0x115925[_0xded9('0x34')]);}};Acw[_0xded9('0x17')][_0xded9('0xb')]=function(_0x158bb2){try{if(this[_0xded9('0x6')][_0x158bb2[_0xded9('0x23')]]&&(this['voiceQueues'][_0x158bb2['queue']]['acw']||this[_0xded9('0x6')][_0x158bb2['queue']][_0xded9('0x24')])){if(this[_0xded9('0x7')][_0x158bb2[_0xded9('0x22')]]){this['channels'][_0x158bb2['uniqueid']]={'queue':_0x158bb2[_0xded9('0x23')],'interface':_0x158bb2[_0xded9('0x22')],'destlinkedid':_0x158bb2[_0xded9('0x2b')]};}}}catch(_0x4c5ee0){logger[_0xded9('0x1f')](_0xded9('0x3c'),_0x4c5ee0[_0xded9('0x34')]);}};Acw['prototype'][_0xded9('0x13')]=function(_0x3a0485){try{if(this[_0xded9('0x6')][_0x3a0485['queue']]&&(this['voiceQueues'][_0x3a0485[_0xded9('0x23')]]['acw']||this['voiceQueues'][_0x3a0485[_0xded9('0x23')]]['mandatoryDisposition'])){if(this['agents'][_0x3a0485[_0xded9('0x22')]]){this[_0xded9('0x9')][_0x3a0485[_0xded9('0x1a')]]={'queue':_0x3a0485[_0xded9('0x23')],'interface':_0x3a0485[_0xded9('0x22')]};}}}catch(_0x369823){logger[_0xded9('0x1f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x369823[_0xded9('0x34')]);}};Acw[_0xded9('0x17')][_0xded9('0xe')]=function(_0x45ee54){try{if(this[_0xded9('0x9')][_0x45ee54[_0xded9('0x1a')]]&&_[_0xded9('0x3d')](this['channels'][_0x45ee54['uniqueid']][_0xded9('0x2a')])){logger[_0xded9('0x1c')]('[%s][HANGUP:UNIQUEID]',_0x45ee54[_0xded9('0x1a')]);this[_0xded9('0x3e')](_0x45ee54[_0xded9('0x1a')]);}else if(this[_0xded9('0x9')][_0x45ee54['linkedid']]&&_['isUndefined'](this[_0xded9('0x9')][_0x45ee54[_0xded9('0x3f')]]['attended'])){logger['info'](_0xded9('0x40'),_0x45ee54[_0xded9('0x3f')]);this[_0xded9('0x3e')](_0x45ee54[_0xded9('0x3f')]);}}catch(_0x1e3c06){logger['error'](_0xded9('0x41'),_0x1e3c06['message']);}};Acw[_0xded9('0x17')][_0xded9('0x42')]=function(_0x289ae9){try{if(this[_0xded9('0x9')][_0x289ae9['uniqueid']]&&this[_0xded9('0x9')][_0x289ae9[_0xded9('0x1a')]][_0xded9('0x2a')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x289ae9[_0xded9('0x1a')]);this[_0xded9('0x3e')](_0x289ae9['uniqueid']);}else if(this[_0xded9('0x9')][_0x289ae9[_0xded9('0x3f')]]&&this['channels'][_0x289ae9['linkedid']][_0xded9('0x2a')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x289ae9[_0xded9('0x3f')]);this[_0xded9('0x3e')](_0x289ae9[_0xded9('0x3f')]);}}catch(_0xb818cf){logger[_0xded9('0x1f')]('[ACW][syncHangup]\x20%s',_0xb818cf['message']);}};Acw[_0xded9('0x17')][_0xded9('0x11')]=function(_0x2ed6d4){try{if(!_[_0xded9('0x43')](this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x44')]])){this[_0xded9('0x3e')](_0x2ed6d4['transfereeuniqueid']);if(this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x45')]]){this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x45')]][_0xded9('0x2a')]=!![];this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x46')]]=this['channels'][_0x2ed6d4[_0xded9('0x45')]];this[_0xded9('0x47')](_0x2ed6d4[_0xded9('0x45')]);}}else if(!_[_0xded9('0x43')](this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x46')]])){this[_0xded9('0x3e')](_0x2ed6d4['transfertargetuniqueid']);if(this[_0xded9('0x9')][_0x2ed6d4['origtransfereruniqueid']]){this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x48')]][_0xded9('0x2a')]=!![];this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x44')]]=this['channels'][_0x2ed6d4['origtransfereruniqueid']];this[_0xded9('0x47')](_0x2ed6d4[_0xded9('0x48')]);}}}catch(_0x53dee5){logger[_0xded9('0x1f')](_0xded9('0x49'),_0x53dee5[_0xded9('0x34')]);}};Acw['prototype'][_0xded9('0x4a')]=function(_0x3b2c15){try{if(this[_0xded9('0x9')][_0x3b2c15['transfereruniqueid']]){logger['info'](_0xded9('0x4b'),JSON[_0xded9('0x3a')](_0x3b2c15['transfereruniqueid']));this[_0xded9('0x3e')](_0x3b2c15[_0xded9('0x4c')]);}else if(this[_0xded9('0x9')][_0x3b2c15[_0xded9('0x4d')]]){logger[_0xded9('0x1c')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xded9('0x3a')](_0x3b2c15[_0xded9('0x4d')]));this[_0xded9('0x3e')](_0x3b2c15[_0xded9('0x4d')]);}}catch(_0x13b1b8){logger[_0xded9('0x1f')](_0xded9('0x4e'),_0x13b1b8['message']);}};Acw[_0xded9('0x17')]['syncAgentRingNoAnswer']=function(_0x3153ec){try{if(this[_0xded9('0x6')][_0x3153ec['queue']]&&this[_0xded9('0x6')][_0x3153ec['queue']][_0xded9('0x4f')]===_0xded9('0x50')){if(this[_0xded9('0x7')][_0x3153ec['interface']]){logger[_0xded9('0x1c')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3153ec[_0xded9('0x1a')],_0x3153ec[_0xded9('0x22')],_0x3153ec[_0xded9('0x23')]);return RpcUser[_0xded9('0x2c')](this['agents'][_0x3153ec[_0xded9('0x22')]],_0xded9('0x51'),_0x3153ec[_0xded9('0x1a')]);}}}catch(_0xb6faa8){logger[_0xded9('0x1f')](_0xded9('0x52'),_0xb6faa8[_0xded9('0x34')]);}};Acw[_0xded9('0x17')][_0xded9('0x47')]=function(_0x41f6a4,_0x346673=0x2710){if(this[_0xded9('0x9')][_0x41f6a4]){setTimeout(()=>{delete this['channels'][_0x41f6a4];},_0x346673);}};module[_0xded9('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d957dd7..e185f3c 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 _0xcf2d=['catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then'];(function(_0x10bb78,_0x35f5d7){var _0x44602a=function(_0x552188){while(--_0x552188){_0x10bb78['push'](_0x10bb78['shift']());}};_0x44602a(++_0x35f5d7);}(_0xcf2d,0x1b3));var _0xdcf2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf2d[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require(_0xdcf2('0x0'));var BPromise=require(_0xdcf2('0x1'));var util=require(_0xdcf2('0x2'));var logger=require(_0xdcf2('0x3'))(_0xdcf2('0x4'));var config=require(_0xdcf2('0x5'));var ami=new Manager(config[_0xdcf2('0x6')][_0xdcf2('0x7')],config[_0xdcf2('0x6')]['ip'],config[_0xdcf2('0x6')][_0xdcf2('0x8')],config[_0xdcf2('0x6')][_0xdcf2('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xdcf2('0xa')](ami['action']);function error(_0x45db65){logger[_0xdcf2('0xb')](util[_0xdcf2('0xc')](_0xdcf2('0xd'),config['asterisk'][_0xdcf2('0x8')],config[_0xdcf2('0x6')]['ip'],config[_0xdcf2('0x6')][_0xdcf2('0x7')],util[_0xdcf2('0xe')](_0x45db65,![],null)));}function close(){logger['error'](util[_0xdcf2('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0xdcf2('0x8')],config[_0xdcf2('0x6')]['ip'],config['asterisk'][_0xdcf2('0x7')]));}ami[_0xdcf2('0xf')]=function(){return function(){return ami[_0xdcf2('0x10')]({'action':_0xdcf2('0x11')});};};ami[_0xdcf2('0x12')]=function(){return function(){return ami[_0xdcf2('0x10')]({'action':_0xdcf2('0x13')});};};ami[_0xdcf2('0x14')]=function(){return function(){return ami[_0xdcf2('0x10')]({'action':'sippeerstatus'});};};ami[_0xdcf2('0x15')]=function(){return function(){return ami['Action']({'action':_0xdcf2('0x16')});};};ami[_0xdcf2('0x17')]=function(){return function(){return ami[_0xdcf2('0x10')]({'action':'coreshowchannels'});};};function connect(){logger[_0xdcf2('0x18')](util[_0xdcf2('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk']['username'],config[_0xdcf2('0x6')]['ip'],config[_0xdcf2('0x6')]['port']));ami['once'](_0xdcf2('0xb'),error);ami[_0xdcf2('0x19')](_0xdcf2('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0xdcf2('0x1b'),function(_0x26a2d7){logger['info'](util['format'](_0xdcf2('0x1c'),config[_0xdcf2('0x6')][_0xdcf2('0x8')],config[_0xdcf2('0x6')]['ip'],config[_0xdcf2('0x6')][_0xdcf2('0x7')],util[_0xdcf2('0xe')](_0x26a2d7,![],null)));});ami['on'](_0xdcf2('0x1d'),function(){logger[_0xdcf2('0x18')](util[_0xdcf2('0xc')](_0xdcf2('0x1e'),config['asterisk'][_0xdcf2('0x8')],config['asterisk']['ip'],config[_0xdcf2('0x6')][_0xdcf2('0x7')]));return Promise[_0xdcf2('0x1f')]()[_0xdcf2('0x20')](ami[_0xdcf2('0xf')]())[_0xdcf2('0x20')](ami[_0xdcf2('0x12')]())[_0xdcf2('0x20')](ami[_0xdcf2('0x14')]())[_0xdcf2('0x20')](ami[_0xdcf2('0x15')]())[_0xdcf2('0x20')](ami[_0xdcf2('0x17')]())[_0xdcf2('0x21')](function(_0x51e41b){logger[_0xdcf2('0xb')](_0xdcf2('0x22'),util[_0xdcf2('0xe')](_0x51e41b,{'showHidden':![],'depth':null}));});});ami[_0xdcf2('0x19')]('error',error);ami[_0xdcf2('0x19')](_0xdcf2('0x1a'),close);module[_0xdcf2('0x23')]=ami; \ No newline at end of file +var _0xfc2f=['actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionQueueSummary','catch','[ami.js][fullybooted]','close','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','username','keepConnected','Action','action','error','format','port','inspect'];(function(_0xade2e7,_0x373f3f){var _0x5778aa=function(_0x56234){while(--_0x56234){_0xade2e7['push'](_0xade2e7['shift']());}};_0x5778aa(++_0x373f3f);}(_0xfc2f,0x1c0));var _0xffc2=function(_0x15924d,_0x792b1a){_0x15924d=_0x15924d-0x0;var _0x213f0c=_0xfc2f[_0x15924d];return _0x213f0c;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xffc2('0x0'));var util=require(_0xffc2('0x1'));var logger=require(_0xffc2('0x2'))(_0xffc2('0x3'));var config=require(_0xffc2('0x4'));var ami=new Manager(config['asterisk']['port'],config[_0xffc2('0x5')]['ip'],config[_0xffc2('0x5')][_0xffc2('0x6')],config[_0xffc2('0x5')]['password'],!![]);ami[_0xffc2('0x7')]();ami[_0xffc2('0x8')]=BPromise['promisify'](ami[_0xffc2('0x9')]);function error(_0x2ae3b7){logger[_0xffc2('0xa')](util[_0xffc2('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xffc2('0x6')],config[_0xffc2('0x5')]['ip'],config[_0xffc2('0x5')][_0xffc2('0xc')],util[_0xffc2('0xd')](_0x2ae3b7,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xffc2('0x5')]['username'],config[_0xffc2('0x5')]['ip'],config[_0xffc2('0x5')]['port']));}ami[_0xffc2('0xe')]=function(){return function(){return ami[_0xffc2('0x8')]({'action':'sipshowregistry'});};};ami[_0xffc2('0xf')]=function(){return function(){return ami[_0xffc2('0x8')]({'action':_0xffc2('0x10')});};};ami[_0xffc2('0x11')]=function(){return function(){return ami[_0xffc2('0x8')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xffc2('0x8')]({'action':_0xffc2('0x12')});};};ami[_0xffc2('0x13')]=function(){return function(){return ami[_0xffc2('0x8')]({'action':_0xffc2('0x14')});};};function connect(){logger[_0xffc2('0x15')](util[_0xffc2('0xb')](_0xffc2('0x16'),config['asterisk']['username'],config[_0xffc2('0x5')]['ip'],config[_0xffc2('0x5')]['port']));ami['once'](_0xffc2('0xa'),error);ami[_0xffc2('0x17')]('close',close);}ami['on']('connect',connect);ami['on'](_0xffc2('0x18'),function(_0x443cd8){logger['info'](util[_0xffc2('0xb')](_0xffc2('0x19'),config[_0xffc2('0x5')][_0xffc2('0x6')],config['asterisk']['ip'],config[_0xffc2('0x5')][_0xffc2('0xc')],util[_0xffc2('0xd')](_0x443cd8,![],null)));});ami['on'](_0xffc2('0x1a'),function(){logger[_0xffc2('0x15')](util[_0xffc2('0xb')](_0xffc2('0x1b'),config['asterisk'][_0xffc2('0x6')],config[_0xffc2('0x5')]['ip'],config[_0xffc2('0x5')][_0xffc2('0xc')]));return Promise['resolve']()[_0xffc2('0x1c')](ami[_0xffc2('0xe')]())[_0xffc2('0x1c')](ami[_0xffc2('0xf')]())['then'](ami[_0xffc2('0x11')]())['then'](ami[_0xffc2('0x1d')]())['then'](ami[_0xffc2('0x13')]())[_0xffc2('0x1e')](function(_0x51c33e){logger[_0xffc2('0xa')](_0xffc2('0x1f'),util[_0xffc2('0xd')](_0x51c33e,{'showHidden':![],'depth':null}));});});ami[_0xffc2('0x17')](_0xffc2('0xa'),error);ami['once'](_0xffc2('0x20'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index d98e786..87d1f40 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x4817f9,_0x4070d1){var _0x2dcfa6=function(_0x408973){while(--_0x408973){_0x4817f9['push'](_0x4817f9['shift']());}};_0x2dcfa6(++_0x4070d1);}(_0xac4a,0x13f));var _0xaac4=function(_0x2fca2a,_0x174cb5){_0x2fca2a=_0x2fca2a-0x0;var _0x17a9fc=_0xac4a[_0x2fca2a];return _0x17a9fc;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0x9ffd=['catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','memberReport','error','result'];(function(_0x381bed,_0x3780d6){var _0x23110f=function(_0x51aea0){while(--_0x51aea0){_0x381bed['push'](_0x381bed['shift']());}};_0x23110f(++_0x3780d6);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2e8c90,_0x491151){_0x2e8c90=_0x2e8c90-0x0;var _0x5ab6ad=_0x9ffd[_0x2e8c90];return _0x5ab6ad;};'use strict';var jayson=require(_0xd9ff('0x0'));var BPromise=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('ami');var client=jayson[_0xd9ff('0x3')][_0xd9ff('0x4')]({'port':0x2329});client[_0xd9ff('0x5')]=function(_0x5493ae,_0x53e962){return new BPromise(function(_0x1c9460,_0x111697){return client['request'](_0x5493ae,_0x53e962)[_0xd9ff('0x6')](function(_0x2982c3){logger[_0xd9ff('0x7')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x53e962,_0x2982c3);if(_0x2982c3[_0xd9ff('0xa')]){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x2982c3['error']['message'],_0x53e962);return _0x111697(_0x2982c3['error']['message']);}else{return _0x1c9460(_0x2982c3[_0xd9ff('0xb')]);}})[_0xd9ff('0xc')](function(_0x193537){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x193537,_0x53e962);return _0x111697(_0x193537);});});};module[_0xd9ff('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 741bb39..db80d6e 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 _0xc363=['[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','stateGlobal','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','loggedIn','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','[countReScheduled]\x20','checkIsBlackList','tryOriginatePredictive','dialOrderByScheduledAt','checkContactEmpty','checkContactLowerLimitOriginate','countReScheduled','[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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','m\x20=\x20','[busyFactor]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice:queue:%s','name','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\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','erlangCallToSecond','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','active','format','SIP/%s','status','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','content','indexOf','catch','Action','then','true','all','some','\x20Interval\x20is\x20overtime:\x20','syncCampaigns','undefined','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','predictive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','responsetime','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','callAdditionalPhoneAfterMin','voiceQueue','additional','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','swapAdditionalPhones','actions','channel','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','merge','pick','idHopper','preview','run','[Catch][Preview][syncQueueStatusComplete]','rescheduleContact','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','getQueue','response','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','outboundAnswerAgiCallsDay','AMD','custom:amd','countcongestionretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','membername','[syncHangupInAMDIvr][createHistory]','MACHINE','Machine','countbusyretry','countnoanswerretry','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Normal\x20Clearing','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','running','INACTIVE','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','dialPreviewRecallmeReminder','filter','online','reachable','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0xc363,0xd0));var _0x3c36=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0xc363[_0x124298];return _0x35ac24;};'use strict';var util=require(_0x3c36('0x0'));var _=require(_0x3c36('0x1'));var uuid=require(_0x3c36('0x2'));var moment=require(_0x3c36('0x3'));var rr=require('rr');var Redis=require(_0x3c36('0x4'));var utils=require(_0x3c36('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0x3c36('0x6'));var config=require(_0x3c36('0x7'));var logger=require(_0x3c36('0x8'))(_0x3c36('0x9'));var loggerBooked=require(_0x3c36('0x8'))(_0x3c36('0xa'));var loggerPredictive=require(_0x3c36('0x8'))('predictive');var loggerPredictiveCalls=require(_0x3c36('0x8'))(_0x3c36('0xb'));var loggerSyncQueueSummary=require(_0x3c36('0x8'))(_0x3c36('0xc'));var ami=require(_0x3c36('0xd'));config[_0x3c36('0xe')]=_[_0x3c36('0xf')](config['redis'],{'host':_0x3c36('0x10'),'port':0x18eb});var io=require(_0x3c36('0x11'))(new Redis(config[_0x3c36('0xe')]));var cmHopper=require(_0x3c36('0x12'));var voiceQueueRt=require(_0x3c36('0x13'));var RpcSetting=require(_0x3c36('0x14'));var Interval=require('../rpc/interval');var Action=require(_0x3c36('0x15'));var History=require(_0x3c36('0x16'));var Final=require(_0x3c36('0x17'));var AgentComplete=require(_0x3c36('0x18'));var QueueCallerAbandon=require(_0x3c36('0x19'));var Hangup=require(_0x3c36('0x1a'));var ipAgi=process[_0x3c36('0x1b')][_0x3c36('0x1c')]||_0x3c36('0x1d');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x3c36('0x1e')]['enqueue']=function(_0x2d63a7){this['tail']=this[_0x3c36('0x1f')]?this[_0x3c36('0x1f')][_0x3c36('0x20')](_0x2d63a7):_0x2d63a7();};function Dialer(_0x2292ff,_0x1011ef){this['sequence']=new Sequence();this['preview']=_0x1011ef;this['voiceQueues']=_0x2292ff[_0x3c36('0x21')];this[_0x3c36('0x22')]=_0x2292ff[_0x3c36('0x22')];this[_0x3c36('0x23')]=_0x2292ff[_0x3c36('0x23')];this[_0x3c36('0x24')]=_0x2292ff[_0x3c36('0x24')];this[_0x3c36('0x25')]=config[_0x3c36('0x25')]||0x2;this[_0x3c36('0x26')]={};this['actions']={};this[_0x3c36('0x27')]={};this[_0x3c36('0x28')]={};this[_0x3c36('0x29')]={};this[_0x3c36('0x2a')]={};this[_0x3c36('0x2b')]={};this[_0x3c36('0x2c')]={};this[_0x3c36('0x2d')]={};this[_0x3c36('0x2e')]={};this[_0x3c36('0x2f')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x3c36('0x30')](this));ami['on'](_0x3c36('0x31'),this['syncQueueCallerAbandon'][_0x3c36('0x30')](this));ami['on'](_0x3c36('0x32'),this[_0x3c36('0x33')][_0x3c36('0x30')](this));ami['on'](_0x3c36('0x34'),this[_0x3c36('0x35')][_0x3c36('0x30')](this));ami['on'](_0x3c36('0x36'),this[_0x3c36('0xc')]['bind'](this));ami['on'](_0x3c36('0x37'),this[_0x3c36('0x38')]['bind'](this));ami['on'](_0x3c36('0x39'),this[_0x3c36('0x3a')][_0x3c36('0x30')](this));ami['on']('newexten',this[_0x3c36('0x3b')]['bind'](this));ami['on'](_0x3c36('0x3c'),this[_0x3c36('0x3d')]['bind'](this));ami['on'](_0x3c36('0x3e'),this[_0x3c36('0x3f')][_0x3c36('0x30')](this));ami['on'](_0x3c36('0x40'),this[_0x3c36('0x41')][_0x3c36('0x30')](this));this[_0x3c36('0x42')]();this['loopClearZombieChannels']();RpcSetting[_0x3c36('0x43')]()['then'](function(_0x5d5121){previewRecallmeReminderInterval=_0x5d5121['previewRecallmeReminderInterval'];});}function isNotNull(_0x45d9e9){return _0x45d9e9!==null&&!_[_0x3c36('0x44')](_0x45d9e9);}function msgResponse(_0x3c4253,_0x3edb6a,_0x4dbadd){return{'action':_0x3c4253,'response':_0x3edb6a,'message':_0x4dbadd,'stack':_0x4dbadd};}function emit(_0x3ff6c1,_0x280ce5,_0x1f54b7){io['to'](_0x3ff6c1)[_0x3c36('0x45')](_0x280ce5,_0x1f54b7);}function emitOutboundVoiceQueueSummary(_0x305d87){if(_0x305d87[_0x3c36('0x46')]==='outbound'){logger[_0x3c36('0x47')](_0x3c36('0x48'),util['inspect'](_0x305d87,{'showHidden':![],'depth':null}));emit(util['format'](_0x3c36('0x49'),_0x305d87[_0x3c36('0x4a')]),_0x3c36('0x4b'),_0x305d87);}}function checkGetDataPredictive(_0x2e04e9){if(isNotNull(_0x2e04e9)&&!_[_0x3c36('0x4c')](_0x2e04e9)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x4e'),_0x2e04e9[_0x3c36('0x4f')]);loggerPredictive['info'](_0x3c36('0x50'),_0x2e04e9[_0x3c36('0x51')]);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x52'),_0x2e04e9['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x53'),_0x2e04e9[_0x3c36('0x54')]);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x55'),_0x2e04e9[_0x3c36('0x56')]);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x57'),_0x2e04e9[_0x3c36('0x58')]);loggerPredictive[_0x3c36('0x4d')]('---------------------------');if(_0x2e04e9[_0x3c36('0x4f')]>0x0){if(!_['isUndefined'](_0x2e04e9['predictiveIntervalAvgTalktime'])&&_0x2e04e9[_0x3c36('0x58')]>0x0){return!![];}loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x59'));if(!_['isUndefined'](_0x2e04e9[_0x3c36('0x56')])&&_0x2e04e9[_0x3c36('0x56')]>0x0){return!![];}loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x5a'));}else{loggerPredictive['info'](_0x3c36('0x5b'));}}else{loggerPredictive[_0x3c36('0x4d')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x29f76a){return function(_0x2444df){loggerPredictive['info'](_0x3c36('0x5c'));loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x5d'),_0x2444df[_0x3c36('0x5e')]);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x5f'),_0x2444df[_0x3c36('0x60')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2444df['erlangAbandonmentRate']);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x61'),_0x2444df[_0x3c36('0x62')]);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x63'),_0x2444df[_0x3c36('0x64')]);loggerPredictive['info']('---------------------------');_['merge'](_0x29f76a,_0x2444df);};}function ifInterval(_0x3fd665,_0x466011){if(_[_0x3c36('0x44')](_0x466011)){return![];}return utils[_0x3c36('0x65')](undefined,_0x466011)<_0x3fd665*0x3c;}function clearPredictiveAttributes(_0x377ad5){if(_0x377ad5[_0x3c36('0x2b')]){_0x377ad5[_0x3c36('0x2b')]=undefined;loggerPredictive[_0x3c36('0x47')](_0x377ad5[_0x3c36('0x4a')],_0x3c36('0x66'));}if(_0x377ad5[_0x3c36('0x2a')]){_0x377ad5[_0x3c36('0x2a')]=undefined;loggerPredictive[_0x3c36('0x47')](_0x377ad5['name'],_0x3c36('0x67'));}if(_0x377ad5[_0x3c36('0x68')]){clearInterval(_0x377ad5[_0x3c36('0x68')]);_0x377ad5[_0x3c36('0x68')]=undefined;loggerPredictive[_0x3c36('0x47')](_0x377ad5[_0x3c36('0x4a')],_0x3c36('0x69'));}}function loggerCatchPredictive(_0x1dc94e,_0x7b177e){return function(_0x3b78b1){loggerPredictive[_0x3c36('0x6a')](_0x7b177e['name'],_0x1dc94e);loggerPredictive[_0x3c36('0x6a')](_0x3b78b1[_0x3c36('0x6b')]);clearPredictiveAttributes(_0x7b177e);};}function loggerCatch(_0xa6d534){return function(_0x5b933c){logger[_0x3c36('0x6a')](_0xa6d534,util[_0x3c36('0x6c')](_0x5b933c,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x267a41,_0x107a3c,_0x8fc96c){return function(_0x4450e5){utils['checkContactLowerLimitOriginate'](_0x107a3c,_0x8fc96c,0x0);_0x107a3c['temp']=0x0;logger[_0x3c36('0x6a')](_0x267a41,util['inspect'](_0x4450e5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x56caed){return function(_0x17d8cc){if(isNotNull(_0x17d8cc)&&isNotNull(_0x17d8cc[0x0])){if(_0x17d8cc[0x0][_0x3c36('0x6d')]>0x0){_0x56caed[_0x3c36('0x6e')]=utils[_0x3c36('0x6f')][_0x3c36('0x70')];logger['info'](_0x3c36('0x71')+_0x56caed[_0x3c36('0x4a')],_0x17d8cc[0x0][_0x3c36('0x6d')],'contacts');}else{_0x56caed[_0x3c36('0x6e')]=utils[_0x3c36('0x6f')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0x3c36('0x72')+_0x56caed[_0x3c36('0x4a')]);}}};}function createObjHistory(_0x38cd41,_0x5cd5a5,_0x237f40,_0x2787a2,_0x1805a8){_0x38cd41[_0x3c36('0x6e')]=_0x237f40;var _0x581ea1=new Action(_0x38cd41,_0x5cd5a5);var _0x431f05=new History(_0x581ea1);_0x431f05[_0x3c36('0x73')]=_0x2787a2;_0x431f05[_0x3c36('0x74')]=_0x1805a8;_0x431f05[_0x3c36('0x75')]=_0x581ea1[_0x3c36('0x76')];return _0x431f05;}function unlockQueueStatus(_0x55b3ea,_0xb19cc){setTimeout(function(){if(_[_0x3c36('0x44')](_0x55b3ea[_0x3c36('0x77')])){loggerBooked[_0x3c36('0x6a')](_0x3c36('0x78'),_0xb19cc);}_0x55b3ea[_0x3c36('0x77')]=!![];loggerBooked[_0x3c36('0x4d')](_0x3c36('0x79'),_0xb19cc,JSON[_0x3c36('0x7a')](_['pick'](_0x55b3ea,[_0x3c36('0x4a'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x43d1f8){return function(){if(!isNotNull(_0x43d1f8['Interval'])){_0x43d1f8[_0x3c36('0x6e')]=utils[_0x3c36('0x6f')][_0x3c36('0x7b')];throw _0x43d1f8[_0x3c36('0x4a')]+_0x3c36('0x7c');}if(!isNotNull(_0x43d1f8[_0x3c36('0x7d')][_0x3c36('0x7e')])){_0x43d1f8[_0x3c36('0x6e')]=utils[_0x3c36('0x6f')][_0x3c36('0x7b')];throw _0x43d1f8['name']+_0x3c36('0x7c');}if(!isNotNull(_['isEmpty'](_0x43d1f8[_0x3c36('0x7d')][_0x3c36('0x7e')]))){_0x43d1f8[_0x3c36('0x6e')]=utils[_0x3c36('0x6f')][_0x3c36('0x7b')];throw _0x43d1f8[_0x3c36('0x4a')]+_0x3c36('0x7c');}};}function checkIsIVRCampaignActive(_0x1bea30){return function(){if(!utils[_0x3c36('0x7f')](_0x1bea30)){_0x1bea30[_0x3c36('0x6e')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x1bea30[_0x3c36('0x4a')]+_0x3c36('0x80');}};}function emitCampaignSummary(_0x12a3ac){if(utils[_0x3c36('0x81')](_0x12a3ac)){emit(util['format'](_0x3c36('0x82'),_0x12a3ac[_0x3c36('0x4a')]),_0x3c36('0x83'),_0x12a3ac);}}function loggerCatchQueueSummary(_0x2eb3bc,_0x53a628){return function(_0x4e878f){clearPredictiveAttributes(_0x53a628);emitCampaignSummary(_0x53a628);loggerSyncQueueSummary[_0x3c36('0x47')](_0x2eb3bc,util['inspect'](_0x4e878f,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4d4111){if(_0x4d4111[_0x3c36('0x84')]){if(_0x4d4111[_0x3c36('0x85')]===0x0){_0x4d4111['sendMessageOneNotActive']=![];_0x4d4111['message']=utils[_0x3c36('0x6f')]['INACTIVE'];loggerSyncQueueSummary[_0x3c36('0x47')](_0x3c36('0x86'),_0x4d4111['name'],_0x3c36('0x87'));}else{_0x4d4111[_0x3c36('0x6e')]=utils[_0x3c36('0x6f')][_0x3c36('0x88')];loggerSyncQueueSummary[_0x3c36('0x47')](_0x3c36('0x86'),_0x4d4111[_0x3c36('0x4a')],_0x3c36('0x89'));}emitCampaignSummary(_0x4d4111);}}function myreject(_0x5164b6){return function(_0x1a9a8e){return _0x5164b6(msgResponse(_0x3c36('0x8a'),_0x3c36('0x8b'),JSON[_0x3c36('0x7a')](_0x1a9a8e)));};}Dialer[_0x3c36('0x1e')]['isTrunkReachable']=function(_0x445c6f){return!_[_0x3c36('0x44')](_0x445c6f)&&_0x445c6f&&!_['isUndefined'](_0x445c6f[_0x3c36('0x4a')])&&!_[_0x3c36('0x44')](_0x445c6f[_0x3c36('0x8c')])&&_0x445c6f[_0x3c36('0x8c')]&&(this[_0x3c36('0x24')][util[_0x3c36('0x8d')](_0x3c36('0x8e'),_0x445c6f[_0x3c36('0x4a')])][_0x3c36('0x8f')]==='reachable'||this[_0x3c36('0x24')][util['format'](_0x3c36('0x8e'),_0x445c6f[_0x3c36('0x4a')])][_0x3c36('0x8f')]===_0x3c36('0x90'));};Dialer[_0x3c36('0x1e')][_0x3c36('0x91')]=function(_0x1f58b5){var _0x4ff1ff=this;return function(){if(!_0x4ff1ff[_0x3c36('0x92')](_0x1f58b5[_0x3c36('0x93')])){if(!_0x4ff1ff['isTrunkReachable'](_0x1f58b5[_0x3c36('0x94')])){_0x1f58b5[_0x3c36('0x6e')]=utils[_0x3c36('0x6f')][_0x3c36('0x95')];throw _0x1f58b5[_0x3c36('0x4a')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0x3c36('0x96')]=function(_0x7d419d,_0x116d02,_0x45d675,_0x3e4a70){var _0x197df5=this;return function(){var _0x31a806=!![];return _0x197df5['ifTimeIvr'](_0x7d419d,_0x116d02,_0x45d675,_0x3e4a70,_0x31a806);};};Dialer[_0x3c36('0x1e')][_0x3c36('0x97')]=function(_0x1fda3a,_0x31c253,_0x126dd3,_0x186501){var _0x5f7303=this;return function(){var _0x315f52=![];return _0x5f7303[_0x3c36('0x98')](_0x1fda3a[_0x3c36('0x7e')],_0x31c253,_0x126dd3,_0x186501,_0x315f52);};};Dialer['prototype'][_0x3c36('0x98')]=function(_0x365234,_0x32b519,_0x274ab4,_0x14c6ac,_0x7f5c53){var _0x56faf9=[];return new Promise(function(_0x839449,_0x552cbd){if(!isNotNull(_0x365234)){_0x14c6ac[_0x3c36('0x6e')]=utils[_0x3c36('0x6f')][_0x3c36('0x7b')];return _0x552cbd(msgResponse('ifTime',_0x3c36('0x99'),_0x274ab4+_0x3c36('0x9a')));}if(_[_0x3c36('0x4c')](_0x365234)){_0x14c6ac[_0x3c36('0x6e')]=utils[_0x3c36('0x6f')][_0x3c36('0x9b')];return _0x552cbd(msgResponse(_0x3c36('0x9c'),'Failure',_0x274ab4+_0x3c36('0x9d')));}if(_0x32b519&&_['isUndefined'](config[_0x3c36('0x9e')][_0x32b519])){_0x14c6ac[_0x3c36('0x6e')]=utils[_0x3c36('0x6f')][_0x3c36('0x9f')];return _0x552cbd(msgResponse(_0x3c36('0x9c'),_0x3c36('0x99'),_0x274ab4+_0x3c36('0xa0')+_0x32b519));}if(_[_0x3c36('0xa1')](_0x365234)){for(var _0x49b70b=0x0;_0x49b70b<_0x365234[_0x3c36('0xa2')];_0x49b70b+=0x1){_0x56faf9[_0x3c36('0xa3')](ami['Action']({'action':_0x3c36('0xa4'),'command':util[_0x3c36('0x8d')](_0x3c36('0xa5'),_0x365234[_0x49b70b][_0x3c36('0xa6')],!_[_0x3c36('0x44')](config[_0x3c36('0x9e')][_0x32b519])?_0x32b519:'')})['then'](function(_0x34aa10){return _0x34aa10[_0x3c36('0xa7')][_0x3c36('0xa8')]('true')>=0x0;})[_0x3c36('0xa9')](myreject(_0x552cbd)));}}else{_0x56faf9['push'](ami[_0x3c36('0xaa')]({'action':_0x3c36('0xa4'),'command':util[_0x3c36('0x8d')]('iftime\x20%s,%s',_0x365234,!_['isUndefined'](config[_0x3c36('0x9e')][_0x32b519])?_0x32b519:'')})[_0x3c36('0xab')](function(_0x518a66){return _0x518a66[_0x3c36('0xa7')][_0x3c36('0xa8')](_0x3c36('0xac'))>=0x0;})[_0x3c36('0xa9')](myreject(_0x552cbd)));}Promise[_0x3c36('0xad')](_0x56faf9)[_0x3c36('0xab')](function(_0x526c7a){var _0x548c11=_[_0x3c36('0xae')](_0x526c7a);if(_0x548c11){return _0x839449(_0x548c11);}else{_0x14c6ac[_0x3c36('0x6e')]=_0x7f5c53?utils[_0x3c36('0x6f')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x3c36('0x6f')]['OVERTIME_INTERVAL'];return _0x552cbd(msgResponse('[ifTime][promiseAll]',_0x3c36('0x99'),'Global:\x20'+_0x7f5c53+'\x20'+_0x274ab4+_0x3c36('0xaf')+util[_0x3c36('0x6c')](_0x365234,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x32b519));}})[_0x3c36('0xa9')](function(_0x126b93){return _0x552cbd(msgResponse('ifTime',_0x3c36('0x99'),JSON[_0x3c36('0x7a')](_0x126b93)));});});};Dialer[_0x3c36('0x1e')][_0x3c36('0x42')]=function(){var _0x4f5973=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x3c36('0xab')](function(){setInterval(function(){_0x4f5973[_0x3c36('0xb0')]();},0x3e8);});};Dialer['prototype']['syncCampaigns']=function(){var _0x3cf6b5=this;var _0x28e36a;for(var _0x50d57c in this[_0x3c36('0x22')]){if(typeof this[_0x3c36('0x22')][_0x50d57c]!==_0x3c36('0xb1')){_0x28e36a=this['campaigns'][_0x50d57c];if(utils['isIVRCampaign'](_0x28e36a)&&utils[_0x3c36('0x7f')](_0x28e36a)){_0x28e36a[_0x3c36('0x84')]=!![];Promise[_0x3c36('0xb2')]()[_0x3c36('0xab')](checkIsIVRCampaignActive(_0x28e36a))['then'](checkInterval(_0x28e36a))[_0x3c36('0xab')](_0x3cf6b5['checkIsTrunkReachable'](_0x28e36a))['then'](_0x3cf6b5[_0x3c36('0x96')](_0x28e36a['dialGlobalInterval'],_0x28e36a['dialTimezone'],_0x28e36a[_0x3c36('0x4a')],_0x28e36a))[_0x3c36('0xab')](_0x3cf6b5['checkIfTimeIntervals'](_0x28e36a[_0x3c36('0x7d')],_0x28e36a[_0x3c36('0xb3')],_0x28e36a[_0x3c36('0x4a')],_0x28e36a))[_0x3c36('0xab')](_0x3cf6b5[_0x3c36('0xb4')](_0x28e36a))['catch'](loggerCatchQueueSummary(_0x3c36('0xb5'),_0x28e36a));}else{notSendMessagesCampaign(_0x28e36a);}}}};Dialer['prototype'][_0x3c36('0xb6')]=function(_0x118861){if(_0x118861[_0x3c36('0xb7')]!==_0x3c36('0xb8')){clearPredictiveAttributes(_0x118861);}switch(_0x118861[_0x3c36('0xb7')]){case'progressive':this[_0x3c36('0xb9')](_0x118861,0x1);break;case _0x3c36('0xba'):this[_0x3c36('0xb9')](_0x118861,_0x118861[_0x3c36('0xbb')]);break;case _0x3c36('0xb8'):this[_0x3c36('0xb8')](_0x118861);break;case'booked':this[_0x3c36('0xb9')](_0x118861,0x1);break;default:logger[_0x3c36('0x6a')](_0x3c36('0xbc'),_0x118861[_0x3c36('0x4a')],_0x3c36('0xbd'));}};Dialer[_0x3c36('0x1e')][_0x3c36('0x9c')]=function(_0x5e7e4b,_0x5dd2f1){var _0xcf3ab9=_0x5e7e4b[_0x3c36('0xb3')];var _0xa7271d=_0x5dd2f1?_0x5e7e4b['dialGlobalInterval']:_0x5e7e4b[_0x3c36('0x7d')][_0x3c36('0x7e')];logger[_0x3c36('0xbe')](_0x3c36('0xbf'),_0xa7271d,_0xcf3ab9,_0x5e7e4b[_0x3c36('0x4a')],util[_0x3c36('0x8d')]('Voice\x20Queue\x20%s\x20$s',_0x5e7e4b[_0x3c36('0x4a')],_0x5e7e4b['id']));var _0xa83dc2=null;return Interval['intervalIftime'](_0xa7271d,_0xcf3ab9)['then'](function(_0x3aae9b){if(_0x3aae9b===!![]){return _0x3aae9b;}else{_0x5e7e4b['message']=_0x5dd2f1?utils[_0x3c36('0x6f')][_0x3c36('0xc0')]:utils[_0x3c36('0x6f')]['OVERTIME_INTERVAL'];_0xa83dc2=msgResponse(_0x3c36('0xc1'),_0x3c36('0x99'),_0x3c36('0xc2')+_0x5dd2f1+'\x20'+_0x5e7e4b[_0x3c36('0x4a')]+_0x3c36('0xaf')+util[_0x3c36('0x6c')](_0xa7271d,{'showHidden':![],'depth':null})+_0x3c36('0xc3')+_0xcf3ab9);}if(_0xa83dc2!==null){logger[_0x3c36('0xbe')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0xa83dc2);_0xa83dc2[_0x3c36('0xc4')]=_0x5dd2f1;throw _0xa83dc2;}})[_0x3c36('0xa9')](function(_0xf3b340){logger[_0x3c36('0x6a')](_0x3c36('0xc5'),_0xf3b340);throw msgResponse(_0x3c36('0x8a'),_0x3c36('0x8b'),util['inspect'](_0xf3b340,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x3c36('0xc6')]=function(_0x10d6d1){if(this[_0x3c36('0x21')][_0x10d6d1[_0x3c36('0xc7')]]){if(this[_0x3c36('0x28')][_0x10d6d1['uniqueid']]&&this[_0x3c36('0x28')][_0x10d6d1[_0x3c36('0xc8')]]['type']!==_0x3c36('0xc9')){this[_0x3c36('0xca')](this[_0x3c36('0x21')][_0x10d6d1[_0x3c36('0xc7')]]);this[_0x3c36('0x28')][_0x10d6d1[_0x3c36('0xc8')]]['answertime']=moment()[_0x3c36('0x8d')](_0x3c36('0xcb'));}}};Dialer[_0x3c36('0x1e')][_0x3c36('0x35')]=function(_0x805402){var _0x2ded88=this[_0x3c36('0x28')][_0x805402[_0x3c36('0xc8')]];if(this[_0x3c36('0x21')][_0x805402[_0x3c36('0xc7')]]){if(_0x2ded88&&_0x2ded88['type']!==_0x3c36('0xc9')){delete this[_0x3c36('0x28')][_0x805402[_0x3c36('0xc8')]];this[_0x3c36('0x21')][_0x805402[_0x3c36('0xc7')]][_0x3c36('0xcc')]+=0x1;var _0x5e2989=new AgentComplete(_0x2ded88,_0x805402);if(_0x805402[_0x3c36('0xcd')]===_0x3c36('0xce')){_0x5e2989[_0x3c36('0xcf')]=this[_0x3c36('0x21')][_0x805402[_0x3c36('0xc7')]][_0x3c36('0xd0')]&&this[_0x3c36('0x21')][_0x805402[_0x3c36('0xc7')]][_0x3c36('0xd1')]?moment()[_0x3c36('0x8d')](_0x3c36('0xcb')):undefined;}hopperUtils[_0x3c36('0xd2')](_0x5e2989)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x3c36('0xd3')](_0x5e2989)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0xd4')));}}};Dialer[_0x3c36('0x1e')][_0x3c36('0xd5')]=function(_0x16edd1){var _0x5f0844=this['uniqueId'][_0x16edd1[_0x3c36('0xc8')]];var _0x3eeb9c=this;var _0x2ec6c2=![];var _0x4db54a;var _0x2f9d1a;if(this[_0x3c36('0x21')][_0x16edd1[_0x3c36('0xc7')]]){if(_0x5f0844&&_0x5f0844[_0x3c36('0x46')]!==_0x3c36('0xc9')){delete this[_0x3c36('0x28')][_0x16edd1[_0x3c36('0xc8')]];this[_0x3c36('0xca')](this[_0x3c36('0x21')][_0x16edd1[_0x3c36('0xc7')]]);_0x5f0844[_0x3c36('0xd6')]=moment()[_0x3c36('0x8d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x66d55b=new QueueCallerAbandon(_0x5f0844,_0x16edd1);if(utils[_0x3c36('0x65')](_0x5f0844['droptime'],_0x5f0844[_0x3c36('0xd7')])>=_0x5f0844['dialQueueTimeout']){this['voiceQueues'][_0x16edd1[_0x3c36('0xc7')]][_0x3c36('0xd8')]+=0x1;this[_0x3c36('0x21')][_0x16edd1[_0x3c36('0xc7')]][_0x3c36('0xd9')]+=0x1;this[_0x3c36('0x21')][_0x16edd1['queue']][_0x3c36('0xda')]+=0x1;_0x66d55b[_0x3c36('0x73')]=0xa;_0x66d55b[_0x3c36('0x74')]='Drop';_0x66d55b[_0x3c36('0xdb')]=_0x3c36('0xdc');_0x66d55b[_0x3c36('0xcf')]=this[_0x3c36('0x21')][_0x16edd1[_0x3c36('0xc7')]][_0x3c36('0xd0')]?moment()[_0x3c36('0x8d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x66d55b['countdropretry']+=0x1;_0x66d55b[_0x3c36('0xdd')]+=0x1;_0x4db54a=this['voiceQueues'][_0x16edd1[_0x3c36('0xc7')]][_0x3c36('0xde')];_0x2f9d1a=this[_0x3c36('0x21')][_0x16edd1['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x3c36('0xdf')](_0x66d55b,_0x66d55b[_0x3c36('0x73')],_0x5f0844['voiceQueue'])[_0x3c36('0xab')](function(_0x190c51){_0x2ec6c2=_0x190c51['additional']==0x1;if(_0x66d55b[_0x3c36('0xe0')]>=_0x3eeb9c[_0x3c36('0x21')][_0x16edd1['queue']][_0x3c36('0xe1')]){_0x3eeb9c[_0x3c36('0xe2')](_0x66d55b,_0x190c51['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x66d55b[_0x3c36('0xe0')],'scheduledat':moment()[_0x3c36('0xe3')](_0x3eeb9c[_0x3c36('0x21')][_0x16edd1[_0x3c36('0xc7')]][_0x3c36('0xde')],_0x3c36('0xe4'))['format'](_0x3c36('0xcb')),'ContactId':_0x5f0844[_0x3c36('0xe5')],'ListId':_0x5f0844[_0x3c36('0xe6')],'VoiceQueueId':_0x5f0844[_0x3c36('0xe7')]||undefined,'CampaignId':_0x5f0844[_0x3c36('0xe8')]||undefined})[_0x3c36('0xa9')](loggerCatch(_0x3c36('0xe9')));var _0x5cb848=new History(_0x66d55b);_0x5cb848[_0x3c36('0x73')]=0xa;_0x5cb848['statedesc']=_0x3c36('0xea');_0x5cb848['starttime']=moment()[_0x3c36('0x8d')](_0x3c36('0xcb'));_0x5cb848['endtime']=_0x5cb848[_0x3c36('0x76')];_0x5cb848[_0x3c36('0xeb')]=_0x66d55b[_0x3c36('0xeb')];_0x5cb848[_0x3c36('0xec')]=_0x66d55b['calleridnum'];hopperUtils[_0x3c36('0xd2')](_0x5cb848)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0xed')));}})['then'](function(){if(_0x2ec6c2)hopperUtils['swapAdditionalPhones'](_0x66d55b,_0x4db54a,_0x2f9d1a)['then'](function(){return 0x1;});});}else{this[_0x3c36('0x21')][_0x16edd1[_0x3c36('0xc7')]][_0x3c36('0x54')]+=0x1;this[_0x3c36('0x21')][_0x16edd1[_0x3c36('0xc7')]][_0x3c36('0xee')]+=0x1;_0x66d55b[_0x3c36('0x73')]=0xb;_0x66d55b['statedesc']=_0x3c36('0xef');_0x66d55b[_0x3c36('0xdb')]=_0x3c36('0xf0');_0x66d55b[_0x3c36('0xf1')]+=0x1;_0x66d55b[_0x3c36('0xdd')]+=0x1;_0x4db54a=this[_0x3c36('0x21')][_0x16edd1[_0x3c36('0xc7')]]['dialAbandonedRetryFrequency'];_0x2f9d1a=this[_0x3c36('0x21')][_0x16edd1[_0x3c36('0xc7')]][_0x3c36('0xf2')];hopperUtils[_0x3c36('0xdf')](_0x66d55b,_0x66d55b[_0x3c36('0x73')],_0x5f0844[_0x3c36('0xf3')])[_0x3c36('0xab')](function(_0x53c723){if(_0x66d55b['countabandonedretry']>=_0x3eeb9c[_0x3c36('0x21')][_0x16edd1['queue']]['dialAbandonedMaxRetry']){_0x3eeb9c[_0x3c36('0xe2')](_0x66d55b,_0x53c723[_0x3c36('0xf4')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x66d55b[_0x3c36('0xf1')],'scheduledat':moment()[_0x3c36('0xe3')](_0x3eeb9c[_0x3c36('0x21')][_0x16edd1[_0x3c36('0xc7')]][_0x3c36('0xf5')],_0x3c36('0xe4'))['format'](_0x3c36('0xcb')),'ContactId':_0x5f0844[_0x3c36('0xe5')],'ListId':_0x5f0844[_0x3c36('0xe6')],'VoiceQueueId':_0x5f0844[_0x3c36('0xe7')]||undefined,'CampaignId':_0x5f0844[_0x3c36('0xe8')]||undefined})['catch'](loggerCatch(_0x3c36('0xf6')));var _0x544082=new History(_0x66d55b);_0x544082[_0x3c36('0x73')]=0xb;_0x544082[_0x3c36('0x74')]=_0x3c36('0xef');_0x544082[_0x3c36('0x76')]=moment()[_0x3c36('0x8d')](_0x3c36('0xcb'));_0x544082['endtime']=_0x544082[_0x3c36('0x76')];_0x544082[_0x3c36('0xeb')]=_0x66d55b[_0x3c36('0xeb')];_0x544082[_0x3c36('0xec')]=_0x66d55b[_0x3c36('0xec')];hopperUtils[_0x3c36('0xd2')](_0x544082)[_0x3c36('0xa9')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x2ec6c2)hopperUtils[_0x3c36('0xf7')](_0x66d55b,_0x4db54a,_0x2f9d1a)[_0x3c36('0xab')](function(){return 0x1;});});}}}};Dialer[_0x3c36('0x1e')][_0x3c36('0x3b')]=function(_0x1a6650){if(this[_0x3c36('0xf8')][_0x1a6650[_0x3c36('0xc8')]]){this[_0x3c36('0xf8')][_0x1a6650[_0x3c36('0xc8')]][_0x3c36('0xf9')]=_0x1a6650[_0x3c36('0xf9')];}if(this[_0x3c36('0x28')][_0x1a6650[_0x3c36('0xc8')]]){this[_0x3c36('0x28')][_0x1a6650['uniqueid']]['channel']=_0x1a6650[_0x3c36('0xf9')];}};Dialer['prototype'][_0x3c36('0x3f')]=function(_0x1ecd79){if(!this[_0x3c36('0xf8')][_0x1ecd79[_0x3c36('0xfa')]]){return;}var _0x26f49e=this[_0x3c36('0x21')][this['actions'][_0x1ecd79['actionid']][_0x3c36('0xc7')]][_0x3c36('0xfb')]||_0x3c36('0xfc');if(_0x26f49e===_0x3c36('0xfd')){if(this[_0x3c36('0xf8')][_0x1ecd79[_0x3c36('0xfa')]]&&_['isNil'](this[_0x3c36('0xf8')][_0x1ecd79[_0x3c36('0xfa')]][_0x3c36('0xfe')])&&_0x1ecd79[_0x3c36('0x8f')]==='1'&&_0x1ecd79[_0x3c36('0xff')]==='0'){if(this['agents'][_0x1ecd79['stateinterface']]){if(!this[_0x3c36('0x23')][_0x1ecd79[_0x3c36('0x100')]][_0x3c36('0xfe')]){this['agents'][_0x1ecd79['stateinterface']][_0x3c36('0xfe')]=!![];this[_0x3c36('0xf8')][_0x1ecd79[_0x3c36('0xfa')]][_0x3c36('0xfe')]=!![];this[_0x3c36('0xf8')][_0x1ecd79['actionid']][_0x3c36('0x100')]=_0x1ecd79[_0x3c36('0x100')];}}}}else if(_0x26f49e===_0x3c36('0xfc')){if(this['actions'][_0x1ecd79[_0x3c36('0xfa')]]){if(this[_0x3c36('0x23')][_0x1ecd79['stateinterface']]){this[_0x3c36('0xf8')][_0x1ecd79[_0x3c36('0xfa')]][_0x3c36('0x100')]=_0x1ecd79[_0x3c36('0x100')];if(_[_0x3c36('0x101')](this[_0x3c36('0x2d')][this[_0x3c36('0xf8')][_0x1ecd79['actionid']][_0x3c36('0xc7')]])){this[_0x3c36('0x2d')][this[_0x3c36('0xf8')][_0x1ecd79[_0x3c36('0xfa')]][_0x3c36('0xc7')]]=[];}this[_0x3c36('0x2d')][this[_0x3c36('0xf8')][_0x1ecd79[_0x3c36('0xfa')]][_0x3c36('0xc7')]][_0x3c36('0xa3')](_[_0x3c36('0x102')](_[_0x3c36('0x103')](this[_0x3c36('0xf8')][_0x1ecd79[_0x3c36('0xfa')]],[_0x3c36('0x104'),_0x3c36('0x100')]),{'status':_0x1ecd79[_0x3c36('0x8f')],'paused':_0x1ecd79[_0x3c36('0xff')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0xdba02a){if(!this[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]]){return;}var _0x4f0ebc=this;var _0x253dfa=this[_0x3c36('0x21')][this[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]][_0x3c36('0xc7')]];var _0x470955=_0x253dfa[_0x3c36('0xfb')]||_0x3c36('0xfc');if(_0x470955==='roundrobin'){if(this[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]]&&this[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]][_0x3c36('0x100')]){this[_0x3c36('0x105')][_0x3c36('0x106')](this[_0x3c36('0xf8')][_0xdba02a['actionid']][_0x3c36('0x104')],this['actions'][_0xdba02a[_0x3c36('0xfa')]][_0x3c36('0x100')])[_0x3c36('0xa9')](function(_0x3fe3de){logger[_0x3c36('0x6a')](_0x3c36('0x107'),util['inspect'](_0x3fe3de,{'showHidden':![],'depth':null}));})['finally'](function(){_0x4f0ebc[_0x3c36('0xca')](_0x4f0ebc['voiceQueues'][_0x4f0ebc['actions'][_0xdba02a[_0x3c36('0xfa')]]['queue']]);_0x4f0ebc[_0x3c36('0x23')][_0x4f0ebc[_0x3c36('0xf8')][_0xdba02a['actionid']][_0x3c36('0x100')]][_0x3c36('0xfe')]=![];delete _0x4f0ebc[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]];unlockQueueStatus(_0x253dfa);});}else{this['updateOriginated'](this['voiceQueues'][this[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]][_0x3c36('0xc7')]]);hopperUtils[_0x3c36('0x108')]({'active':![],'ContactId':this[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]][_0x3c36('0xe5')],'ListId':this[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]][_0x3c36('0xe6')],'VoiceQueueId':this[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]][_0x3c36('0xe7')]||undefined,'CampaignId':this['actions'][_0xdba02a['actionid']]['CampaignId']||undefined})['catch'](loggerCatch(_0x3c36('0x109')));delete this['actions'][_0xdba02a['actionid']];unlockQueueStatus(_0x253dfa);}}else if(_0x470955==='rrmemory'){var _0xc3f8a7;if(this[_0x3c36('0xf8')][_0xdba02a['actionid']]&&!_['isEmpty'](this[_0x3c36('0x2d')][this['actions'][_0xdba02a[_0x3c36('0xfa')]][_0x3c36('0xc7')]])){if(this['queueBookedRR'][_0x4f0ebc[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]][_0x3c36('0xc7')]]){this[_0x3c36('0x2e')][_0x4f0ebc[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]]['queue']]=this[_0x3c36('0x2e')][this[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]][_0x3c36('0xc7')]]?this[_0x3c36('0x2e')][this['actions'][_0xdba02a[_0x3c36('0xfa')]]['queue']]:this[_0x3c36('0x2d')][this[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]][_0x3c36('0xc7')]]?this['queueBooked'][this[_0x3c36('0xf8')][_0xdba02a[_0x3c36('0xfa')]]['queue']][_0x3c36('0x10a')]||0x0:0x0;}this[_0x3c36('0x2d')][this['actions'][_0xdba02a[_0x3c36('0xfa')]]['queue']][_0x3c36('0x10a')]=this[_0x3c36('0x2e')][this['actions'][_0xdba02a[_0x3c36('0xfa')]]['queue']];for(var _0xd8a715=0x0;_0xd8a715=_0x482148[_0x3c36('0x126')]){_0x4871d5['stateGlobal'](_0x3ee570,_0x54fecd,_0x129126,_0x3c36('0x127'));}else{if(_0x3ee570[_0x3c36('0x124')]>=_0x482148[_0x3c36('0x128')]){_0x4871d5[_0x3c36('0x129')](_0x3ee570,_0x54fecd,_0x129126,_0x3c36('0x12a'));}else{hopperUtils[_0x3c36('0x108')]({'active':![],'countmachineretry':_0x3ee570[_0x3c36('0x124')],'scheduledat':moment()[_0x3c36('0xe3')](_0x482148['dialMachineRetryFrequency'],_0x3c36('0xe4'))[_0x3c36('0x8d')](_0x3c36('0xcb')),'ContactId':_0x3ee570[_0x3c36('0xe5')],'ListId':_0x3ee570[_0x3c36('0xe6')],'VoiceQueueId':_0x3ee570[_0x3c36('0xe7')]||undefined,'CampaignId':_0x3ee570[_0x3c36('0xe8')]||undefined})[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x12b')));_0x54fecd({'reschedule':0x1});}}});}if(_0x165818[_0x3c36('0x46')]===_0x3c36('0xc9')&&this[_0x3c36('0x22')][_0x165818[_0x3c36('0xc7')]][_0x3c36('0x117')]&&_0x340ecd[_0x3c36('0x118')]==='HANGUP'){delete this[_0x3c36('0x28')][_0x340ecd['uniqueid']];this[_0x3c36('0xca')](this[_0x3c36('0x22')][_0x165818['queue']]);_0x5a50d3=new Hangup(_0x165818,_0x340ecd);_0x5a50d3[_0x3c36('0x73')]=0x12;_0x5a50d3[_0x3c36('0x74')]='HangupInAMD';_0x5a50d3[_0x3c36('0x12c')]=_0x3c36('0x120');ami[_0x3c36('0x45')](_0x3c36('0x121'),ut[_0x3c36('0x11a')](_0x5a50d3,'amd'));this['saveInDb'](_0x5a50d3,_0x3c36('0x12d'),'[syncHangupInAMDIvr]');}if(_0x165818['type']===_0x3c36('0xc9')&&this[_0x3c36('0x22')][_0x165818[_0x3c36('0xc7')]]['dialAMDActive']&&_0x340ecd[_0x3c36('0x118')]===_0x3c36('0x12e')){return new Promise(function(_0x27da25,_0x3a4af6){delete _0x4871d5['uniqueId'][_0x340ecd[_0x3c36('0xc8')]];_0x4871d5[_0x3c36('0xca')](_0x4871d5['campaigns'][_0x165818['queue']]);_0x4871d5['campaigns'][_0x165818[_0x3c36('0xc7')]][_0x3c36('0xcc')]+=0x1;_0x4871d5[_0x3c36('0x22')][_0x165818[_0x3c36('0xc7')]][_0x3c36('0x11f')]+=0x1;var _0x3cb7d8=_0x4871d5[_0x3c36('0x22')][_0x165818['queue']];var _0x34d31f=new Hangup(_0x165818,_0x340ecd);_0x34d31f[_0x3c36('0x73')]=0x13;_0x34d31f[_0x3c36('0x74')]=_0x3c36('0x12f');_0x34d31f[_0x3c36('0x12c')]='AMD';_0x34d31f[_0x3c36('0x124')]+=0x1;_0x34d31f[_0x3c36('0xdd')]+=0x1;_0x34d31f[_0x3c36('0x11b')]=!![];ami[_0x3c36('0x45')]('custom:amd',ut[_0x3c36('0x11a')](_0x34d31f,_0x3c36('0x11b')));hopperUtils[_0x3c36('0xd2')](_0x34d31f)[_0x3c36('0xa9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x34d31f[_0x3c36('0x130')]+_0x34d31f[_0x3c36('0x122')]+_0x34d31f[_0x3c36('0x131')]+_0x34d31f[_0x3c36('0x123')]+_0x34d31f['countdropretry']+_0x34d31f[_0x3c36('0xf1')]+_0x34d31f['countmachineretry']+_0x34d31f['countagentrejectretry']>=_0x3cb7d8[_0x3c36('0x126')]){_0x4871d5['stateGlobal'](_0x34d31f,_0x27da25,_0x3a4af6,_0x3c36('0x127'));}else{if(_0x34d31f[_0x3c36('0x124')]>=_0x3cb7d8[_0x3c36('0x128')]){_0x4871d5[_0x3c36('0x129')](_0x34d31f,_0x27da25,_0x3a4af6,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x34d31f['countmachineretry'],'scheduledat':moment()['add'](_0x3cb7d8[_0x3c36('0x132')],_0x3c36('0xe4'))[_0x3c36('0x8d')](_0x3c36('0xcb')),'ContactId':_0x34d31f[_0x3c36('0xe5')],'ListId':_0x34d31f['ListId'],'VoiceQueueId':_0x34d31f[_0x3c36('0xe7')]||undefined,'CampaignId':_0x34d31f[_0x3c36('0xe8')]||undefined})['catch'](loggerCatch(_0x3c36('0x12b')));_0x27da25({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x3c36('0x3a')]=function(_0x23a64a){var _0x3ab995=this['uniqueId'][_0x23a64a['uniqueid']];var _0x4652d0;if(_0x3ab995&&_0x3ab995['type']==='ivr'){delete this[_0x3c36('0x28')][_0x23a64a[_0x3c36('0xc8')]];this[_0x3c36('0xca')](this[_0x3c36('0x22')][_0x3ab995[_0x3c36('0xc7')]]);this[_0x3c36('0x22')][_0x3ab995['queue']][_0x3c36('0x133')]+=0x1;_0x4652d0=new Hangup(_0x3ab995,_0x23a64a);hopperUtils['createHistory'](_0x4652d0)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x134')));hopperUtils[_0x3c36('0xd3')](_0x4652d0)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x135')));}if(_0x3ab995&&_0x3ab995['type']!==_0x3c36('0xc9')&&isNotNull(this[_0x3c36('0x21')][_0x3ab995['queue']][_0x3c36('0x136')])){delete this[_0x3c36('0x28')][_0x23a64a[_0x3c36('0xc8')]];this[_0x3c36('0xca')](this[_0x3c36('0x21')][_0x3ab995[_0x3c36('0xc7')]]);this[_0x3c36('0x21')][_0x3ab995[_0x3c36('0xc7')]][_0x3c36('0xcc')]+=0x1;this[_0x3c36('0x21')][_0x3ab995[_0x3c36('0xc7')]][_0x3c36('0x11f')]+=0x1;_0x4652d0=new Hangup(_0x3ab995,_0x23a64a);_0x4652d0['state']=0x10;_0x4652d0[_0x3c36('0x74')]=_0x3c36('0x137');_0x4652d0[_0x3c36('0x12c')]=_0x3c36('0x138');hopperUtils[_0x3c36('0xd2')](_0x4652d0)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x3c36('0xd3')](_0x4652d0)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x135')));}if(_0x3ab995&&_0x3ab995['type']!==_0x3c36('0xc9')&&!isNotNull(this[_0x3c36('0x21')][_0x3ab995[_0x3c36('0xc7')]][_0x3c36('0x136')])){if(_0x23a64a[_0x3c36('0x139')]===_0x3c36('0x13a')){delete this['uniqueId'][_0x23a64a[_0x3c36('0xc8')]];this[_0x3c36('0x21')][_0x3ab995[_0x3c36('0xc7')]][_0x3c36('0xcc')]+=0x1;const _0x1b9c30=new AgentComplete(_0x3ab995,_0x23a64a);_0x1b9c30[_0x3c36('0xe8')]=this[_0x3c36('0x21')][_0x3ab995[_0x3c36('0xc7')]]['id'];hopperUtils[_0x3c36('0xd2')](_0x1b9c30)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x13b')));hopperUtils[_0x3c36('0xd3')](_0x1b9c30)['catch'](loggerCatch(_0x3c36('0xd4')));}else{delete this['uniqueId'][_0x23a64a[_0x3c36('0xc8')]];this[_0x3c36('0xca')](this[_0x3c36('0x21')][_0x3ab995[_0x3c36('0xc7')]]);this[_0x3c36('0x21')][_0x3ab995['queue']][_0x3c36('0x13c')]+=0x1;_0x4652d0=new Hangup(_0x3ab995,_0x23a64a);_0x4652d0['state']=0xc;_0x4652d0[_0x3c36('0x74')]=_0x23a64a[_0x3c36('0x139')];_0x4652d0[_0x3c36('0x12c')]='Unknow';hopperUtils[_0x3c36('0xd2')](_0x4652d0)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x134')));hopperUtils[_0x3c36('0xd3')](_0x4652d0)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x135')));}}};Dialer[_0x3c36('0x1e')]['syncQueueSummary']=function(_0x35ffba){var _0x3f9590=this;if(!_0x3f9590[_0x3c36('0x2f')][_0x35ffba['name']]){_0x3f9590[_0x3c36('0x2f')][_0x35ffba[_0x3c36('0x4a')]]={'running':![]};}else if(_0x3f9590[_0x3c36('0x2f')][_0x35ffba['name']][_0x3c36('0x13d')]===!![]){return;}else if(_0x3f9590[_0x3c36('0x2f')][_0x35ffba[_0x3c36('0x4a')]][_0x3c36('0x13d')]===![]){_0x3f9590[_0x3c36('0x2f')][_0x35ffba[_0x3c36('0x4a')]]['running']=!![];}var _0x1b3f9c=_0x3f9590[_0x3c36('0x21')][_0x35ffba[_0x3c36('0x4a')]];var _0xb59666=_0x1b3f9c[_0x3c36('0x6e')]!==utils[_0x3c36('0x6f')][_0x3c36('0x13e')];var _0x24c5e5=utils[_0x3c36('0x13f')](_0x1b3f9c);_0x1b3f9c['statusMessage']=utils[_0x3c36('0x140')](_0x1b3f9c,_0x3f9590[_0x3c36('0x24')]);Promise['resolve']()[_0x3c36('0xab')](function(){if(_0x1b3f9c[_0x3c36('0x141')]===utils[_0x3c36('0x6f')][_0x3c36('0x13e')]){if(_0xb59666){clearPredictiveAttributes(_0x1b3f9c);_0x35ffba[_0x3c36('0x2a')]=undefined;_0x35ffba[_0x3c36('0x2b')]=undefined;}if(_0x1b3f9c[_0x3c36('0x141')]===utils[_0x3c36('0x6f')][_0x3c36('0x13e')]){_0x35ffba[_0x3c36('0x142')]=0x0;_0x35ffba[_0x3c36('0xff')]=0x0;_0x35ffba[_0x3c36('0x143')]=0x0;_0x35ffba[_0x3c36('0x144')]=0x0;_0x35ffba['pTalking']=0x0;}}else if(_0x1b3f9c[_0x3c36('0x141')]===utils['CAMPAIGN_STATUS'][_0x3c36('0x145')]&&!_0x24c5e5){return _0x3f9590[_0x3c36('0x9c')](_0x1b3f9c,!![])[_0x3c36('0xab')](function(){return _0x3f9590[_0x3c36('0x9c')](_0x1b3f9c,![]);})['then'](function(){return _0x3f9590[_0x3c36('0xb6')](_0x1b3f9c);})[_0x3c36('0xa9')](function(_0x5316bd){loggerSyncQueueSummary['debug'](_0x3c36('0x146'),util[_0x3c36('0x6c')](_0x5316bd,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1b3f9c);});}else{clearPredictiveAttributes(_0x1b3f9c);}})['then'](function(){var _0x379479=_0x35ffba['compareToOutboundQueue'](_0x1b3f9c);if(_0x379479||_0x1b3f9c[_0x3c36('0x147')]){_0x1b3f9c['queueSummaryCountersUpdated']=![];_0x35ffba[_0x3c36('0x148')](_0x1b3f9c);Object[_0x3c36('0x149')](_0x1b3f9c,_0x35ffba);emitOutboundVoiceQueueSummary(_0x35ffba);}_0x3f9590[_0x3c36('0x2f')][_0x1b3f9c[_0x3c36('0x4a')]]['running']=![];})['catch'](function(_0x1e80da){logger['error'](_0x3c36('0x146'),util['inspect'](_0x1e80da,{'showHidden':![],'depth':null}));_0x3f9590[_0x3c36('0x2f')][_0x1b3f9c[_0x3c36('0x4a')]][_0x3c36('0x13d')]=![];});};Dialer[_0x3c36('0x1e')][_0x3c36('0x38')]=_[_0x3c36('0x14a')](function(){var _0x5731a3=_['filter'](this[_0x3c36('0x21')],function(_0x5b5021){return _0x5b5021[_0x3c36('0x14b')];});var _0x3841d8=_[_0x3c36('0x14c')](this[_0x3c36('0x23')],function(_0x5ea212){return _0x5ea212[_0x3c36('0x14d')]&&_0x5ea212['status']===_0x3c36('0x14e');});if(_0x5731a3['length']>0x0&&_0x3841d8['length']>0x0){return Promise['resolve']()[_0x3c36('0xab')](cmHopper['handlePreviewRecallNotifications'](_[_0x3c36('0x14f')](_0x5731a3,'id'),previewRecallmeReminderInterval,_[_0x3c36('0x14f')](_0x3841d8,'id')))[_0x3c36('0xab')](function(_0x4f2f87){for(var _0x472705=0x0;_0x472705<_0x4f2f87[_0x3c36('0xa2')];_0x472705++){var _0x53e617=_0x4f2f87[_0x472705][_0x3c36('0x150')][_0x3c36('0x4a')];if(_0x53e617)io['to'](util[_0x3c36('0x8d')](_0x3c36('0x151'),_0x53e617))['emit'](_0x3c36('0x152'),{'hopper':_0x4f2f87[_0x472705]});}})[_0x3c36('0xa9')](function(_0x334134){logger[_0x3c36('0x6a')](_0x3c36('0x153'),_0x334134);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3c36('0x1e')][_0x3c36('0x154')]=function(){var _0x18da15=this;setInterval(function(){_0x18da15[_0x3c36('0x155')](_0x18da15[_0x3c36('0x28')],_0x3c36('0x156'));_0x18da15[_0x3c36('0x155')](_0x18da15['actions'],'[actions]');},0x32c8);};Dialer['prototype'][_0x3c36('0x155')]=function(_0xa4bfce,_0x45e80e){var _0x472141=this;for(var _0x5c9877 in _0xa4bfce){if(typeof _0xa4bfce[_0x5c9877]!=='undefined'){this['sequence'][_0x3c36('0x157')](function(){if(!_[_0x3c36('0x101')](_0xa4bfce[_0x5c9877])){return ami[_0x3c36('0xaa')]({'action':_0x3c36('0x8f'),'channel':_0xa4bfce[_0x5c9877]['channel']})[_0x3c36('0xa9')](function(_0xed86fb){if(_0xed86fb['message']===_0x3c36('0x158')){setTimeout(function(){if(_0xa4bfce[_0x5c9877]&&_0xa4bfce[_0x5c9877]['type']!==_0x3c36('0xc9')){_0x472141[_0x3c36('0xca')](_0x472141[_0x3c36('0x21')][_0xa4bfce[_0x5c9877][_0x3c36('0xc7')]]);logger[_0x3c36('0x6a')](_0x3c36('0x159'),_0x45e80e,_0x5c9877,_0xa4bfce[_0x5c9877][_0x3c36('0xc7')]);delete _0xa4bfce[_0x5c9877];}if(_0xa4bfce[_0x5c9877]&&_0xa4bfce[_0x5c9877][_0x3c36('0x46')]===_0x3c36('0xc9')){_0x472141[_0x3c36('0xca')](_0x472141[_0x3c36('0x22')][_0xa4bfce[_0x5c9877][_0x3c36('0xc7')]]);logger[_0x3c36('0x6a')](_0x3c36('0x15a'),_0x45e80e,_0x5c9877,_0xa4bfce[_0x5c9877][_0x3c36('0xc7')]);delete _0xa4bfce[_0x5c9877];}},0x2328);}});}});}}};Dialer[_0x3c36('0x1e')][_0x3c36('0x15b')]=function(_0x2827aa){return Promise[_0x3c36('0xb2')]()[_0x3c36('0xab')](voiceQueueRt['getVoiceQueueRtPauses'](_0x2827aa))[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x15c')));};Dialer[_0x3c36('0x1e')][_0x3c36('0xca')]=function(_0x3d7053){if(!_['isUndefined'](_0x3d7053)&&_0x3d7053!==null){if(typeof _0x3d7053[_0x3c36('0x85')]!=='undefined'){if(_0x3d7053[_0x3c36('0x85')]>0x0){_0x3d7053[_0x3c36('0x85')]-=0x1;}else{logger[_0x3c36('0x6a')](_0x3c36('0x15d'));}}}else{logger['error'](_0x3c36('0x15e'));}};Dialer['prototype'][_0x3c36('0x15f')]=function(_0x221470,_0x17ac47){var _0x54720b=this;return function(_0x261a0d){_0x54720b['updateOriginated'](_0x17ac47);logger[_0x3c36('0x6a')](_0x221470,util[_0x3c36('0x6c')](_0x261a0d,{'showHidden':![],'depth':null}));};};Dialer[_0x3c36('0x1e')][_0x3c36('0x160')]=function(_0x557b2f,_0x570cb3,_0x1e02db){var _0x2392e5={'state':0x19,'statedesc':_0x3c36('0x161')};this[_0x3c36('0xca')](_0x570cb3);this[_0x3c36('0x11c')](_[_0x3c36('0x102')](_0x2392e5,_[_0x3c36('0x103')](_0x1e02db,[_0x3c36('0xe5'),_0x3c36('0xe6'),'UserId',_0x3c36('0xe7'),_0x3c36('0xe8')])),_0x3c36('0x162'),_0x3c36('0x163'));logger[_0x3c36('0x6a')](_0x557b2f);};Dialer[_0x3c36('0x1e')]['saveInDb']=function(_0x262c5e,_0x4bc801,_0x57908b){hopperUtils[_0x3c36('0xd2')](_0x262c5e)[_0x3c36('0xa9')](loggerCatch(_0x4bc801));hopperUtils[_0x3c36('0xd3')](_0x262c5e)[_0x3c36('0xa9')](loggerCatch(_0x57908b));};Dialer[_0x3c36('0x1e')][_0x3c36('0xe2')]=function(_0x1cfc8e,_0x1ed331){hopperUtils[_0x3c36('0xd2')](_0x1cfc8e)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x1ed331==0x0){hopperUtils['moveContactManagedDialer'](_0x1cfc8e)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x164')));}};Dialer[_0x3c36('0x1e')]['checkPreviewRecallReminder']=function(_0x38a704){return Promise[_0x3c36('0xb2')]()[_0x3c36('0xab')](cmHopper['handlePreviewRecallNotifications'](_0x38a704['id'],previewRecallmeReminderInterval))[_0x3c36('0xab')](function(_0x3aaaae){for(var _0x4c1008=0x0;_0x4c1008<_0x3aaaae[_0x3c36('0xa2')];_0x4c1008++){var _0x33883e=_0x3aaaae[_0x4c1008][_0x3c36('0x150')][_0x3c36('0x4a')];if(_0x33883e)io['to'](util['format'](_0x3c36('0x151'),_0x33883e))[_0x3c36('0x45')](_0x3c36('0x152'),{'hopper':_0x3aaaae[_0x4c1008]});}})[_0x3c36('0xa9')](function(){});};Dialer[_0x3c36('0x1e')][_0x3c36('0xb4')]=function(_0x33defe){var _0x331754=this;return function(){_0x331754[_0x3c36('0x165')](_0x33defe);};};Dialer[_0x3c36('0x1e')][_0x3c36('0x166')]=function(_0x54e50c,_0x1399c6){var _0x4a82d6=this;var _0x443a08=uuid['v4']();this[_0x3c36('0xf8')][_0x443a08]=new Action(_0x54e50c,_0x1399c6,_0x443a08);return new Promise(function(_0x24bb21,_0x4c5356){if(_[_0x3c36('0x44')](_0x54e50c)&&typeof _0x54e50c!=='object'){return _0x4c5356(msgResponse('originate',_0x3c36('0x99'),'voiceQueue\x20is\x20undefine'));}if(_[_0x3c36('0x44')](_0x1399c6[_0x3c36('0x167')])||_0x1399c6['phone']===null){return _0x4c5356(msgResponse(_0x3c36('0x168'),_0x3c36('0x99'),_0x3c36('0x169')));}var _0x20311b={'XMD-CALLERID':_0x4a82d6[_0x3c36('0xf8')][_0x443a08][_0x3c36('0x16a')](),'XMD-AGI':_0x54e50c['dialQueueProject']?util[_0x3c36('0x8d')](_0x3c36('0x16b'),ipAgi,_0x54e50c[_0x3c36('0x136')]):_0x3c36('0x16c'),'XMD-AGIAFTER':_0x54e50c[_0x3c36('0xd0')]?util[_0x3c36('0x8d')]('\x22agi://%s/square,%s\x22',ipAgi,_0x54e50c[_0x3c36('0xd0')]):_0x3c36('0x16c'),'XMD-QUEUE':utils[_0x3c36('0x16d')](_0x54e50c)?util[_0x3c36('0x8d')](_0x3c36('0x16e'),_0x54e50c['name'],_0x54e50c[_0x3c36('0x16f')]||'',_0x54e50c[_0x3c36('0xd1')]?'c':'',_0x54e50c[_0x3c36('0x170')]||0x3):_0x3c36('0x16c'),'XMD-CONTACTID':_0x1399c6['ContactId'],'XMD-CDRTYPE':_0x3c36('0x9'),'CALLERID(all)':_0x4a82d6[_0x3c36('0xf8')][_0x443a08][_0x3c36('0x16a')](),'XMD-AMD':_0x54e50c[_0x3c36('0x117')]?'ACTIVE':_0x3c36('0x16c'),'XMD-DESTINATION':_0x3c36('0x116')};if(_0x54e50c['dialAMDActive']){_0x20311b[_0x3c36('0x171')]=_0x54e50c[_0x3c36('0x172')]||0x9c4;_0x20311b[_0x3c36('0x173')]=_0x54e50c[_0x3c36('0x174')]||0x5dc;_0x20311b[_0x3c36('0x175')]=_0x54e50c[_0x3c36('0x176')]||0x320;_0x20311b['XMD-AMDTOTALANALYSISTIME']=_0x54e50c[_0x3c36('0x177')]||0x1388;_0x20311b[_0x3c36('0x178')]=_0x54e50c['dialAMDMinWordLength']||0x64;_0x20311b[_0x3c36('0x179')]=_0x54e50c['dialAMDBetweenWordsSilence']||0x32;_0x20311b[_0x3c36('0x17a')]=_0x54e50c['dialAMDMaximumNumberOfWords']||0x3;_0x20311b[_0x3c36('0x17b')]=_0x54e50c[_0x3c36('0x17c')]||0x100;_0x20311b[_0x3c36('0x17d')]=_0x54e50c[_0x3c36('0x17e')]||0x1388;}if(utils['isOutboundQueue'](_0x54e50c)){_0x20311b[_0x3c36('0x17f')]=_0x1399c6[_0x3c36('0xe7')];}else{_0x20311b[_0x3c36('0x180')]=_0x1399c6[_0x3c36('0xe8')];}var _0x45d132=utils[_0x3c36('0x181')](_0x1399c6[_0x3c36('0x182')]);Object[_0x3c36('0x149')](_0x20311b,_0x45d132);var _0x142cf3=_0x4a82d6['isTrunkReachable'](_0x54e50c[_0x3c36('0x93')])?utils[_0x3c36('0x183')](_0x54e50c[_0x3c36('0x93')]['callerid'],_0x54e50c[_0x3c36('0x184')],_0x54e50c[_0x3c36('0x185')]>0x0?utils['getCallerIdRandom'](_0x54e50c[_0x3c36('0x186')],_0x54e50c['dialRandomLastDigitCallerIdNumber']):_0x54e50c['dialOriginateCallerIdNumber']):utils[_0x3c36('0x183')](_['isNil'](_0x54e50c['TrunkBackup'])?_0x54e50c[_0x3c36('0x93')][_0x3c36('0x187')]:_0x54e50c[_0x3c36('0x94')][_0x3c36('0x187')],_0x54e50c[_0x3c36('0x184')],_0x54e50c[_0x3c36('0x185')]>0x0?utils[_0x3c36('0x188')](_0x54e50c['dialOriginateCallerIdNumber'],_0x54e50c[_0x3c36('0x185')]):_0x54e50c[_0x3c36('0x186')]);if(_0x142cf3){_0x20311b[_0x3c36('0x189')]=_0x4a82d6['actions'][_0x443a08]['originatecalleridname']=utils[_0x3c36('0x18a')](_0x142cf3);_0x20311b[_0x3c36('0x18b')]=_0x1399c6[_0x3c36('0x167')];}_0x54e50c[_0x3c36('0x18c')]=_0x20311b;return ami[_0x3c36('0xaa')]({'actionid':_0x443a08,'action':_0x3c36('0x168'),'channel':_0x4a82d6[_0x3c36('0x92')](_0x54e50c[_0x3c36('0x93')])?util[_0x3c36('0x8d')]('SIP/%s/%s%s',_0x54e50c[_0x3c36('0x93')][_0x3c36('0x4a')],isNotNull(_0x54e50c['dialPrefix'])?_0x54e50c[_0x3c36('0x18d')][_0x3c36('0x18e')]()||'':'',_0x54e50c[_0x3c36('0x18f')]>0x0?_0x1399c6['phone'][_0x3c36('0x190')](_0x54e50c[_0x3c36('0x18f')]):_0x1399c6[_0x3c36('0x167')]):util[_0x3c36('0x8d')]('SIP/%s/%s%s',_[_0x3c36('0x101')](_0x54e50c[_0x3c36('0x94')])?_0x54e50c['Trunk'][_0x3c36('0x4a')]:_0x54e50c[_0x3c36('0x94')][_0x3c36('0x4a')],isNotNull(_0x54e50c[_0x3c36('0x18d')])?_0x54e50c['dialPrefix'][_0x3c36('0x18e')]()||'':'',_0x54e50c[_0x3c36('0x18f')]>0x0?_0x1399c6[_0x3c36('0x167')]['substring'](_0x54e50c['dialCutDigit']):_0x1399c6['phone']),'callerid':_0x142cf3,'Exten':_0x3c36('0x116'),'Context':_0x3c36('0x191'),'Priority':'1','variable':_0x20311b,'timeout':(_0x54e50c[_0x3c36('0x192')]||0x1e)*0x3e8,'async':!![],'channelid':_0x443a08})['then'](function(_0x331539){return _0x24bb21(_0x331539);})['catch'](function(_0x1b0d0d){_0x54e50c[_0x3c36('0x193')]+=0x1;var _0x3bf506=new History(_0x4a82d6[_0x3c36('0xf8')][_0x443a08]);logger['error'](util[_0x3c36('0x8d')]('[originateError]:\x20%s',JSON['stringify'](_0x1b0d0d)));_0x3bf506[_0x3c36('0x73')]=0xe;_0x3bf506[_0x3c36('0x74')]='OriginateError';_0x3bf506[_0x3c36('0x76')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3bf506['endtime']=_0x3bf506[_0x3c36('0x76')];hopperUtils[_0x3c36('0xd2')](_0x3bf506)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x194')));_0x4a82d6[_0x3c36('0xd3')](_0x3bf506)['catch'](loggerCatch(_0x3c36('0x194')))[_0x3c36('0x20')](function(){delete _0x4a82d6[_0x3c36('0xf8')][_0x443a08];return _0x4c5356(msgResponse(_0x3c36('0x168'),'Error','originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x3c36('0x195')]=function(_0x43ab61,_0x18c357,_0x3e98f0){var _0x33e144=new History(_0x18c357);if(_0x33e144[_0x3c36('0x130')]+_0x33e144['countcongestionretry']+_0x33e144[_0x3c36('0x131')]+_0x33e144['countnosuchnumberretry']+_0x33e144[_0x3c36('0xe0')]+_0x33e144['countabandonedretry']+_0x33e144[_0x3c36('0x124')]+_0x33e144[_0x3c36('0x125')]>=_0x3e98f0['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x43ab61){case 0x3:if(_0x33e144[_0x3c36('0x131')]>=_0x3e98f0[_0x3c36('0x196')]-0x1){return!![];}hopperUtils[_0x3c36('0x108')]({'active':![],'countnoanswerretry':_0x33e144[_0x3c36('0x131')]+=0x1,'scheduledat':moment()['add'](_0x3e98f0[_0x3c36('0x197')],_0x3c36('0xe4'))[_0x3c36('0x8d')](_0x3c36('0xcb')),'ContactId':_0x33e144[_0x3c36('0xe5')],'ListId':_0x33e144[_0x3c36('0xe6')],'VoiceQueueId':_0x33e144[_0x3c36('0xe7')]||undefined,'CampaignId':_0x33e144[_0x3c36('0xe8')]||undefined})[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x198')));break;case 0x5:if(_0x33e144[_0x3c36('0x130')]>=_0x3e98f0[_0x3c36('0x199')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x33e144[_0x3c36('0x130')]+=0x1,'scheduledat':moment()['add'](_0x3e98f0['dialBusyRetryFrequency'],_0x3c36('0xe4'))[_0x3c36('0x8d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33e144[_0x3c36('0xe5')],'ListId':_0x33e144[_0x3c36('0xe6')],'VoiceQueueId':_0x33e144[_0x3c36('0xe7')]||undefined,'CampaignId':_0x33e144['CampaignId']||undefined})[_0x3c36('0xa9')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x33e144[_0x3c36('0x122')]>=_0x3e98f0[_0x3c36('0x19a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x33e144['countcongestionretry']+=0x1,'scheduledat':moment()[_0x3c36('0xe3')](_0x3e98f0[_0x3c36('0x19b')],_0x3c36('0xe4'))[_0x3c36('0x8d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33e144[_0x3c36('0xe5')],'ListId':_0x33e144[_0x3c36('0xe6')],'VoiceQueueId':_0x33e144[_0x3c36('0xe7')]||undefined,'CampaignId':_0x33e144[_0x3c36('0xe8')]||undefined})[_0x3c36('0xa9')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x33e144[_0x3c36('0x123')]>=_0x3e98f0[_0x3c36('0x19c')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x33e144[_0x3c36('0x123')]+=0x1,'scheduledat':moment()[_0x3c36('0xe3')](_0x3e98f0[_0x3c36('0x19d')],'minutes')['format'](_0x3c36('0xcb')),'ContactId':_0x33e144[_0x3c36('0xe5')],'ListId':_0x33e144[_0x3c36('0xe6')],'VoiceQueueId':_0x33e144['VoiceQueueId']||undefined,'CampaignId':_0x33e144[_0x3c36('0xe8')]||undefined})[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x19e')));}break;case 0xa:if(_0x33e144[_0x3c36('0xe0')]>=_0x3e98f0[_0x3c36('0xe1')]-0x1){return!![];}hopperUtils[_0x3c36('0x108')]({'active':![],'countdropretry':_0x33e144[_0x3c36('0xe0')]+=0x1,'scheduledat':moment()[_0x3c36('0xe3')](_0x3e98f0[_0x3c36('0xde')],_0x3c36('0xe4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33e144[_0x3c36('0xe5')],'ListId':_0x33e144[_0x3c36('0xe6')],'VoiceQueueId':_0x33e144[_0x3c36('0xe7')]||undefined,'CampaignId':_0x33e144[_0x3c36('0xe8')]||undefined})[_0x3c36('0xa9')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x33e144[_0x3c36('0xf1')]>=_0x3e98f0[_0x3c36('0x19f')]-0x1){return!![];}hopperUtils[_0x3c36('0x108')]({'active':![],'countabandonedretry':_0x33e144['countabandonedretry']+=0x1,'scheduledat':moment()[_0x3c36('0xe3')](_0x3e98f0[_0x3c36('0xf5')],_0x3c36('0xe4'))[_0x3c36('0x8d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33e144[_0x3c36('0xe5')],'ListId':_0x33e144[_0x3c36('0xe6')],'VoiceQueueId':_0x33e144[_0x3c36('0xe7')]||undefined,'CampaignId':_0x33e144[_0x3c36('0xe8')]||undefined})['catch'](loggerCatch(_0x3c36('0xf6')));break;case 0x13:if(_0x33e144[_0x3c36('0x124')]>=_0x3e98f0['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x3c36('0x108')]({'active':![],'countmachineretry':_0x33e144[_0x3c36('0x124')]+=0x1,'scheduledat':moment()[_0x3c36('0xe3')](_0x3e98f0[_0x3c36('0x132')],'minutes')[_0x3c36('0x8d')](_0x3c36('0xcb')),'ContactId':_0x33e144[_0x3c36('0xe5')],'ListId':_0x33e144[_0x3c36('0xe6')],'VoiceQueueId':_0x33e144[_0x3c36('0xe7')]||undefined,'CampaignId':_0x33e144[_0x3c36('0xe8')]||undefined})['catch'](loggerCatch(_0x3c36('0x12b')));break;case 0x14:if(_0x33e144[_0x3c36('0x125')]>=_0x3e98f0[_0x3c36('0x1a0')]-0x1){return!![];}hopperUtils[_0x3c36('0x108')]({'active':![],'countagentrejectretry':_0x33e144[_0x3c36('0x125')]+=0x1,'scheduledat':moment()[_0x3c36('0xe3')](_0x3e98f0[_0x3c36('0x1a1')],'minutes')[_0x3c36('0x8d')](_0x3c36('0xcb')),'ContactId':_0x33e144[_0x3c36('0xe5')],'ListId':_0x33e144[_0x3c36('0xe6')],'VoiceQueueId':_0x33e144[_0x3c36('0xe7')]||undefined,'CampaignId':_0x33e144['CampaignId']||undefined})[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x1a2')));break;default:return!![];}};Dialer[_0x3c36('0x1e')][_0x3c36('0x112')]=function(_0x35497b,_0x1b58d3,_0x31ca2b){var _0x97e1fb=this;var _0x138de3=new History(_0x35497b);var _0x5c5251=![];var _0x52c525;var _0x1fe5f3;return new Promise(function(_0x426935,_0x5da3d0){if(_[_0x3c36('0x44')](_0x1b58d3)&&typeof _0x1b58d3!==_0x3c36('0x1a3')){return _0x5da3d0(msgResponse(_0x3c36('0x1a4'),_0x3c36('0x99'),_0x3c36('0x1a5')));}if(_[_0x3c36('0x44')](_0x31ca2b)&&typeof _0x31ca2b!==_0x3c36('0x1a3')){return _0x5da3d0(msgResponse('[callProgressDetecting]',_0x3c36('0x99'),_0x3c36('0x1a6')));}hopperUtils['verifyAdditionalPhones'](_0x138de3,_0x31ca2b[_0x3c36('0xcd')],_0x1b58d3)[_0x3c36('0xab')](function(_0x19ba6b){if(_0x19ba6b[_0x3c36('0xf4')]==0x1)_0x5c5251=!![];switch(_0x31ca2b[_0x3c36('0xcd')]){case'0':_0x1b58d3[_0x3c36('0x1a7')]+=0x1;_0x138de3[_0x3c36('0x73')]=0x0;_0x138de3[_0x3c36('0x74')]=_0x3c36('0x1a8');_0x138de3[_0x3c36('0x123')]+=0x1;_0x138de3[_0x3c36('0xdd')]+=0x1;ami[_0x3c36('0x45')](_0x3c36('0x1a9'),ut['buildObj'](_0x35497b,_0x3c36('0x1aa')));_0x52c525=_0x1b58d3[_0x3c36('0x19d')];_0x1fe5f3=_0x1b58d3[_0x3c36('0xf2')];hopperUtils['createHistory'](_0x138de3)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x1ab')));if(_0x97e1fb[_0x3c36('0x195')](0x0,_0x35497b,_0x1b58d3)&&!_0x5c5251){if(_0x138de3[_0x3c36('0x123')]>=_0x1b58d3[_0x3c36('0x19c')]){_0x97e1fb[_0x3c36('0x129')](_0x138de3,_0x426935,_0x5da3d0,_0x3c36('0x1ac'));}else{_0x97e1fb[_0x3c36('0x1ad')](_0x138de3,_0x426935,_0x5da3d0,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1b58d3[_0x3c36('0x1ae')]+=0x1;_0x138de3[_0x3c36('0x73')]=0x3;_0x138de3['statedesc']='NoAnswer';_0x138de3[_0x3c36('0x131')]+=0x1;_0x138de3[_0x3c36('0xdd')]+=0x1;var _0x752847=ut[_0x3c36('0x1af')](_0x35497b,_0x1b58d3);ami['emit'](_0x3c36('0x1b0'),_0x752847);_0x52c525=_0x1b58d3[_0x3c36('0x197')];_0x1fe5f3=_0x1b58d3[_0x3c36('0xf2')];hopperUtils['createHistory'](_0x138de3)['catch'](loggerCatch(_0x3c36('0x1b1')));if(_0x97e1fb['checkRetriveMax'](0x3,_0x35497b,_0x1b58d3)&&!_0x5c5251){if(_0x138de3['countnoanswerretry']>=_0x1b58d3[_0x3c36('0x196')]){_0x97e1fb['createStateFinal'](_0x138de3,_0x426935,_0x5da3d0,'reason\x203\x20ringing\x20no\x20answer');}else{_0x97e1fb[_0x3c36('0x1ad')](_0x138de3,_0x426935,_0x5da3d0,_0x3c36('0x1b2'));}}break;case'5':_0x1b58d3[_0x3c36('0x1b3')]+=0x1;_0x138de3[_0x3c36('0x73')]=0x5;_0x138de3['statedesc']=_0x3c36('0x1b4');_0x138de3[_0x3c36('0x130')]+=0x1;_0x138de3[_0x3c36('0xdd')]+=0x1;ami[_0x3c36('0x45')](_0x3c36('0x1b5'),ut[_0x3c36('0x11a')](_0x35497b,_0x3c36('0x1b6')));_0x52c525=_0x1b58d3[_0x3c36('0x1b7')];_0x1fe5f3=_0x1b58d3[_0x3c36('0xf2')];hopperUtils[_0x3c36('0xd2')](_0x138de3)[_0x3c36('0xa9')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x97e1fb[_0x3c36('0x195')](0x5,_0x35497b,_0x1b58d3)&&!_0x5c5251){if(_0x138de3[_0x3c36('0x130')]>=_0x1b58d3['dialBusyMaxRetry']){_0x97e1fb[_0x3c36('0x129')](_0x138de3,_0x426935,_0x5da3d0,_0x3c36('0x1b8'));}else{_0x97e1fb[_0x3c36('0x1ad')](_0x138de3,_0x426935,_0x5da3d0,_0x3c36('0x1b8'));}}break;case'8':_0x1b58d3[_0x3c36('0x1b9')]+=0x1;_0x138de3[_0x3c36('0x73')]=0x8;_0x138de3[_0x3c36('0x74')]=_0x3c36('0x1ba');_0x138de3['countcongestionretry']+=0x1;_0x138de3[_0x3c36('0xdd')]+=0x1;_0x52c525=_0x1b58d3['dialCongestionRetryFrequency'];_0x1fe5f3=_0x1b58d3[_0x3c36('0xf2')];ami[_0x3c36('0x45')](_0x3c36('0x1bb'),ut['buildObj'](_0x35497b,_0x3c36('0x1bc')));hopperUtils[_0x3c36('0xd2')](_0x138de3)['catch'](loggerCatch(_0x3c36('0x1bd')));if(_0x97e1fb[_0x3c36('0x195')](0x8,_0x35497b,_0x1b58d3)&&!_0x5c5251){if(_0x138de3[_0x3c36('0x122')]>=_0x1b58d3[_0x3c36('0x19a')]){_0x97e1fb['createStateFinal'](_0x138de3,_0x426935,_0x5da3d0,'reason\x208\x20congestion');}else{_0x97e1fb[_0x3c36('0x1ad')](_0x138de3,_0x426935,_0x5da3d0,_0x3c36('0x1be'));}}break;case'11':_0x1b58d3[_0x3c36('0x1bf')]+=0x1;_0x138de3[_0x3c36('0x73')]=0xb;_0x138de3[_0x3c36('0x74')]=_0x3c36('0xef');_0x138de3['countabandonedretry']+=0x1;_0x138de3[_0x3c36('0xdd')]+=0x1;_0x52c525=_0x1b58d3[_0x3c36('0xf5')];_0x1fe5f3=_0x1b58d3[_0x3c36('0xf2')];hopperUtils[_0x3c36('0xd2')](_0x138de3)[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x1c0')));if(_0x97e1fb[_0x3c36('0x195')](0xb,_0x35497b,_0x1b58d3)&&!_0x5c5251){if(_0x138de3['countabandonedretry']>=_0x1b58d3['dialAbandonedMaxRetry']){_0x97e1fb[_0x3c36('0x129')](_0x138de3,_0x426935,_0x5da3d0,_0x3c36('0x1c1'));}else{_0x97e1fb[_0x3c36('0x1ad')](_0x138de3,_0x426935,_0x5da3d0,_0x3c36('0x1c1'));}}break;case'20':_0x1b58d3[_0x3c36('0x1c2')]+=0x1;_0x138de3[_0x3c36('0x73')]=0x14;_0x138de3['statedesc']=_0x3c36('0x1c3');_0x138de3[_0x3c36('0x125')]+=0x1;_0x138de3[_0x3c36('0xdd')]+=0x1;_0x52c525=_0x1b58d3[_0x3c36('0x1a1')];_0x1fe5f3=_0x1b58d3[_0x3c36('0xf2')];ami[_0x3c36('0x45')]('custom:agentreject',ut[_0x3c36('0x11a')](_0x35497b,'agentreject'));hopperUtils[_0x3c36('0xd2')](_0x138de3)[_0x3c36('0xa9')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x97e1fb['checkRetriveMax'](0x14,_0x35497b,_0x1b58d3)&&!_0x5c5251){if(_0x138de3['countagentrejectretry']>=_0x1b58d3[_0x3c36('0x1a0')]){_0x97e1fb[_0x3c36('0x129')](_0x138de3,_0x426935,_0x5da3d0,_0x3c36('0x1c4'));}else{_0x97e1fb[_0x3c36('0x1ad')](_0x138de3,_0x426935,_0x5da3d0,_0x3c36('0x1c4'));}}break;default:_0x1b58d3[_0x3c36('0x13c')]+=0x1;_0x138de3[_0x3c36('0x73')]=0xc;_0x138de3[_0x3c36('0x74')]=_0x31ca2b[_0x3c36('0xcd')];_0x52c525=_0x1b58d3['dialAgentRejectRetryFrequency'];_0x1fe5f3=_0x1b58d3['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x138de3)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x97e1fb[_0x3c36('0x195')](_0x31ca2b[_0x3c36('0xcd')],_0x35497b,_0x1b58d3)&&!_0x5c5251){if(_0x138de3[_0x3c36('0x130')]+_0x138de3[_0x3c36('0x122')]+_0x138de3[_0x3c36('0x131')]+_0x138de3[_0x3c36('0x123')]+_0x138de3[_0x3c36('0xe0')]+_0x138de3[_0x3c36('0xf1')]+_0x138de3[_0x3c36('0x124')]+_0x138de3[_0x3c36('0x125')]>=_0x1b58d3[_0x3c36('0x126')]){_0x97e1fb[_0x3c36('0x1ad')](_0x138de3,_0x426935,_0x5da3d0,_0x31ca2b['reason']);}else{_0x97e1fb[_0x3c36('0x129')](_0x138de3,_0x426935,_0x5da3d0,_0x31ca2b['reason']);}}}})['then'](function(){if(_0x5c5251){hopperUtils['swapAdditionalPhones'](_0x138de3,_0x52c525,_0x1fe5f3)[_0x3c36('0xab')](function(){return _0x426935(0x1);});}});});};Dialer[_0x3c36('0x1e')][_0x3c36('0x1ad')]=function(_0x209110,_0x17df20,_0x47cb87,_0x4d2500){var _0x297901=new Final(_0x209110);_0x297901[_0x3c36('0x73')]=0xf;_0x297901[_0x3c36('0x74')]=_0x3c36('0x1c5');this[_0x3c36('0x129')](_0x297901,_0x17df20,_0x47cb87,_0x4d2500);};Dialer[_0x3c36('0x1e')][_0x3c36('0x129')]=function(_0xfdf90d,_0x3da75b,_0x3c4da3,_0x2bcfc3){hopperUtils[_0x3c36('0xd3')](_0xfdf90d)[_0x3c36('0xab')](function(){return _0x3da75b(msgResponse(_0x3c36('0x1a4'),'Success',_0x2bcfc3));})[_0x3c36('0xa9')](function(){return _0x3c4da3(msgResponse('[moveContactManagedDialer][0]','Failure',_0x3c36('0x1c6')));});};Dialer[_0x3c36('0x1e')]['predictive']=function(_0x1702b4){var _0xdd0d0d=_0x1702b4['dialPredictiveOptimizationPercentage']/0x64;var _0x3f49d3=_0x1702b4[_0x3c36('0xd9')]/(_0x1702b4[_0x3c36('0xd9')]+_0x1702b4[_0x3c36('0xcc')]);var _0x6a5215=Math[_0x3c36('0x1c7')](_0x1702b4[_0x3c36('0x1c8')]*(_0x1702b4[_0x3c36('0x1c9')]/0x64));var _0x5b2a95=Math[_0x3c36('0x1c7')](_0x1702b4[_0x3c36('0x1c8')]*(_0x1702b4[_0x3c36('0x1ca')]/0x64));var _0x4acf2f=_0x1702b4['available']+_0x1702b4[_0x3c36('0x144')];var _0x31269e=Math[_0x3c36('0x1cb')](_0x1702b4[_0x3c36('0x5e')]*_0x1702b4[_0x3c36('0x64')]*_0x1702b4['predictiveIntervalHitRate']*_0x1702b4['predictiveIntervalMultiplicativeFactor']);if(_[_0x3c36('0x44')](_0x1702b4['startProgressive'])){if(!_[_0x3c36('0x44')](_0x1702b4['startPredictive'])){_0x1702b4[_0x3c36('0x2a')]=undefined;loggerPredictive[_0x3c36('0x6a')](_0x3c36('0x1cc'),_0x3c36('0x1cd'));}if(!_[_0x3c36('0x44')](_0x1702b4['handlePredictive'])){loggerPredictive[_0x3c36('0x6a')](_0x3c36('0x1cc'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x1702b4[_0x3c36('0x68')]);_0x1702b4[_0x3c36('0x68')]=undefined;}_0x1702b4['startProgressive']=moment()['format'](_0x3c36('0xcb'));loggerPredictive[_0x3c36('0x4d')](_0x1702b4['name'],_0x3c36('0x1ce'),_0x1702b4[_0x3c36('0x2b')]);this[_0x3c36('0xb9')](_0x1702b4,0x1);}else if(ifInterval(_0x1702b4[_0x3c36('0x1cf')],_0x1702b4[_0x3c36('0x2b')])){this[_0x3c36('0xb9')](_0x1702b4,0x1);loggerPredictiveCalls[_0x3c36('0x4d')](_0x3c36('0x1d0'),_0x1702b4[_0x3c36('0x2b')],_0x1702b4[_0x3c36('0x4a')]);_0x1702b4[_0x3c36('0x5e')]=0x0;_0x1702b4[_0x3c36('0xda')]=0x0;}else if(_0xdd0d0d<_0x3f49d3&&_0x1702b4['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x1702b4);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x1d1'),_0x3c36('0x1d2'),_0x3f49d3,_0x3c36('0x2b'),_0x1702b4['name']);}else if(_0x31269e<_0x1702b4[_0x3c36('0xda')]&&_0x1702b4[_0x3c36('0x1d3')]===_0x3c36('0x1d4')){clearPredictiveAttributes(_0x1702b4);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x1d5'),_0x3c36('0x1d6'),_0x31269e,'Drop\x20in\x20this\x20interval',_0x1702b4[_0x3c36('0xda')],_0x3c36('0x2b'),_0x1702b4[_0x3c36('0x4a')]);}else if(!ifInterval(_0x1702b4[_0x3c36('0x1cf')],_0x1702b4[_0x3c36('0x2b')])&&_[_0x3c36('0x44')](_0x1702b4[_0x3c36('0x2a')])&&!_[_0x3c36('0x44')](_0x1702b4[_0x3c36('0x2b')])){_0x1702b4[_0x3c36('0x2a')]=moment()['format'](_0x3c36('0xcb'));loggerPredictive['info'](_0x1702b4[_0x3c36('0x4a')],'started\x20in\x20predictive\x20at',_0x1702b4[_0x3c36('0x2a')]);hopperUtils[_0x3c36('0x1d7')](_0x1702b4[_0x3c36('0x1cf')])['then'](this[_0x3c36('0x1d8')](_0x1702b4))[_0x3c36('0xab')](mergeDataErlangB(_0x1702b4))[_0x3c36('0xab')](this['startMethodPredictive'](_0x1702b4))['catch'](loggerCatchPredictive(_0x3c36('0x1d9'),_0x1702b4));}else if(!ifInterval(_0x1702b4['dialPredictiveInterval'],_0x1702b4['startPredictive'])){_0x1702b4[_0x3c36('0xda')]=0x0;_0x1702b4[_0x3c36('0x2a')]=moment()['format'](_0x3c36('0xcb'));loggerPredictive[_0x3c36('0x4d')](_0x1702b4[_0x3c36('0x4a')],_0x3c36('0x1da'),_0x1702b4[_0x3c36('0x2a')]);clearInterval(_0x1702b4[_0x3c36('0x68')]);_0x1702b4[_0x3c36('0x68')]=undefined;hopperUtils[_0x3c36('0x1d7')](_0x1702b4[_0x3c36('0x1cf')])[_0x3c36('0xab')](this[_0x3c36('0x1d8')](_0x1702b4))[_0x3c36('0xab')](mergeDataErlangB(_0x1702b4))[_0x3c36('0xab')](this[_0x3c36('0x1db')](_0x1702b4))[_0x3c36('0xa9')](loggerCatchPredictive(_0x3c36('0x1dc'),_0x1702b4));}else if(_0x1702b4['predictiveIntervalAvailable']&&_0x4acf2f<_0x1702b4[_0x3c36('0x1c8')]-_0x5b2a95){clearPredictiveAttributes(_0x1702b4);loggerPredictive['info'](_0x1702b4['name'],_0x3c36('0x1dd'),_0x4acf2f,_0x3c36('0x1de'),_0x1702b4[_0x3c36('0x1c8')],'-',_0x5b2a95,'=',_0x1702b4['predictiveIntervalAvailable']-_0x5b2a95,')');}else if(_0x1702b4[_0x3c36('0x1c8')]&&_0x4acf2f>_0x1702b4[_0x3c36('0x1c8')]+_0x6a5215){clearPredictiveAttributes(_0x1702b4);loggerPredictive['info'](_0x1702b4[_0x3c36('0x4a')],_0x3c36('0x1dd'),_0x4acf2f,_0x3c36('0x1df'),_0x1702b4[_0x3c36('0x1c8')],'+',_0x6a5215,'=',_0x1702b4[_0x3c36('0x1c8')]+_0x6a5215,')');}};Dialer[_0x3c36('0x1e')][_0x3c36('0x1d8')]=function(_0x5c889f){var _0x3face3=this;return function(_0x53c0ae){return new Promise(function(_0x588bd4,_0x658dea){_[_0x3c36('0x102')](_0x5c889f,_0x53c0ae[0x0]);if(checkGetDataPredictive(_0x53c0ae[0x0])){var _0x4ea903=_0x5c889f['predictiveIntervalAvailable']=_0x5c889f['talking']+_0x5c889f['available'];var _0x2abc71=_0x5c889f['dialPredictiveInterval']*0x3c;var _0x1f2cf5=_0x53c0ae[0x0][_0x3c36('0x58')]+_0x53c0ae[0x0]['predictiveIntervalAvgHoldtime'];var _0x348a09=(_0x53c0ae[0x0]['predictiveIntervalAnsweredCalls']+_0x53c0ae[0x0][_0x3c36('0xd8')]+_0x53c0ae[0x0][_0x3c36('0x54')])/_0x53c0ae[0x0][_0x3c36('0x4f')];_0x5c889f[_0x3c36('0x1e0')]=_0x348a09>0x0?_0x348a09:0x1;switch(_0x5c889f[_0x3c36('0x1d3')]){case _0x3c36('0x1d4'):var _0x41ed78=_0x5c889f['dialPredictiveOptimizationPercentage']/0x64;return _0x3face3[_0x3c36('0x1e1')](_0x4ea903,_0x2abc71,_0x1f2cf5,_0x348a09,_0x41ed78)[_0x3c36('0xab')](function(_0xe71b8a){return _0x588bd4(_0xe71b8a);});case _0x3c36('0x1e2'):var _0x280820=_0x5c889f[_0x3c36('0x1e3')]/0x64;return _0x3face3[_0x3c36('0x1e4')](_0x4ea903,_0x2abc71,_0x1f2cf5,_0x348a09,_0x280820)[_0x3c36('0xab')](function(_0x24175b){return _0x588bd4(_0x24175b);});default:return _0x658dea(msgResponse(_0x3c36('0x1e5'),'Failure',_0x3c36('0x1e6')));}}else{return _0x658dea(msgResponse('[getDataPredictive]',_0x3c36('0x99'),_0x3c36('0x1e7')));}});};};Dialer['prototype'][_0x3c36('0x1e8')]=function(_0x308a72){var _0x288686=this;return function(_0xf3d37b){return new Promise(function(_0x5bf463,_0x508f51){_[_0x3c36('0x102')](_0x308a72,_0xf3d37b[0x0]);if(checkGetDataPredictive(_0xf3d37b[0x0])){loggerPredictive[_0x3c36('0x4d')](JSON[_0x3c36('0x7a')](_0xf3d37b[0x0]));if(_0x308a72[_0x3c36('0x1d3')]===_0x3c36('0x1d4')){return _0x288686['getVoiceQueueRtPauses'](_0x308a72['id'])['then'](function(_0x3b5784){var _0x5df7aa=_0x308a72['loggedIn']-_0x3b5784[0x0]['outboundQueuePauses'];var _0x847cbe=_0x308a72[_0x3c36('0x1cf')]*0x3c;var _0x13a0a6=_0xf3d37b[0x0][_0x3c36('0x58')]+_0xf3d37b[0x0][_0x3c36('0x56')];var _0x4d35d6=(_0xf3d37b[0x0][_0x3c36('0x51')]+_0xf3d37b[0x0][_0x3c36('0xd8')]+_0xf3d37b[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xf3d37b[0x0][_0x3c36('0x4f')];var _0x542ab4=_0x308a72[_0x3c36('0x1e3')]/0x64;_0x308a72[_0x3c36('0x1e9')]=_0x3b5784[0x0][_0x3c36('0x1ea')]||0x0;_0x308a72[_0x3c36('0x1e0')]=_0x4d35d6>0x0?_0x4d35d6:0x1;return _0x288686[_0x3c36('0x1e1')](_0x5df7aa,_0x847cbe,_0x13a0a6,_0x4d35d6,_0x542ab4);})['then'](function(_0x8840a8){return _0x5bf463(_0x8840a8);})['catch'](function(_0x3e316b){return _0x508f51(msgResponse(_0x3c36('0x1eb'),_0x3c36('0x99'),JSON[_0x3c36('0x7a')](_0x3e316b)));});}if(_0x308a72[_0x3c36('0x1d3')]===_0x3c36('0x1e2')){return _0x288686[_0x3c36('0x15b')](_0x308a72['id'])[_0x3c36('0xab')](function(_0x49f59a){var _0x354dc4=_0x308a72[_0x3c36('0x1ec')]-_0x49f59a[0x0][_0x3c36('0x1ea')];var _0x260b10=_0x308a72[_0x3c36('0x1cf')]*0x3c;var _0x4ee770=_0xf3d37b[0x0][_0x3c36('0x58')]+_0xf3d37b[0x0]['predictiveIntervalAvgHoldtime'];var _0x2ea33a=(_0xf3d37b[0x0][_0x3c36('0x51')]+_0xf3d37b[0x0][_0x3c36('0xd8')]+_0xf3d37b[0x0][_0x3c36('0x54')])/_0xf3d37b[0x0][_0x3c36('0x4f')];var _0x3ab421=_0x308a72[_0x3c36('0x1e3')]/0x64;_0x308a72[_0x3c36('0x1e9')]=_0x49f59a[0x0][_0x3c36('0x1ea')]||0x0;_0x308a72[_0x3c36('0x1e0')]=_0x2ea33a>0x0?_0x2ea33a:0x1;return _0x288686[_0x3c36('0x1e4')](_0x354dc4,_0x260b10,_0x4ee770,_0x2ea33a,_0x3ab421);})[_0x3c36('0xab')](function(_0x4e8d2a){return _0x5bf463(_0x4e8d2a);})['catch'](function(_0x19b7fd){return _0x508f51(msgResponse(_0x3c36('0x1eb'),_0x3c36('0x99'),JSON[_0x3c36('0x7a')](_0x19b7fd)));});}}else{return _0x508f51(msgResponse(_0x3c36('0x1e5'),'Failure',_0x3c36('0x1e7')));}});};};Dialer[_0x3c36('0x1e')][_0x3c36('0x1db')]=function(_0x40cf58){var _0x465b72=this;return function(){var _0x5016d2=0x0;var _0x2db88e=Math[_0x3c36('0x1cb')](_0x40cf58[_0x3c36('0x60')]*0x3e8);if(_0x2db88e>0x0){_0x2db88e=_0x2db88e<0x64?0x64:_0x2db88e;loggerPredictive[_0x3c36('0x4d')](_0x40cf58[_0x3c36('0x4a')],_0x3c36('0x1ed'),_0x2db88e,_0x3c36('0x1ee'));_0x40cf58[_0x3c36('0x68')]=setInterval(function(){_0x465b72['handlePredictive'](_0x40cf58);loggerPredictiveCalls[_0x3c36('0x4d')](_0x3c36('0x1ef'),_0x5016d2+=0x1);},_0x2db88e);}else{loggerPredictive[_0x3c36('0x4d')](_0x40cf58[_0x3c36('0x4a')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x3c36('0x1e')][_0x3c36('0x1f0')]=function(_0x29609b,_0x4b8ab2){var _0x314de6=this;return function(_0x426dd1){if(_[_0x3c36('0x4c')](_0x426dd1)){if(_[_0x3c36('0x101')](_0x4b8ab2[_0x3c36('0x1f1')])||!_0x4b8ab2[_0x3c36('0x1f2')]){if(_0x29609b[_0x3c36('0xb7')]===_0x3c36('0xa')){_0x29609b[_0x3c36('0x77')]=_[_0x3c36('0x44')](_0x29609b[_0x3c36('0x77')])?!![]:_0x29609b[_0x3c36('0x77')];var _0x49a0fe=uuid['v4']();_0x314de6[_0x3c36('0xf8')][_0x49a0fe]=new Action(_0x29609b,_0x4b8ab2,_0x49a0fe);loggerBooked['info'](_0x3c36('0x1f3'),_0x49a0fe,_0x3c36('0x1f4'),JSON['stringify'](_0x29609b[_0x3c36('0x77')]),_0x3c36('0x1f5'),_0x29609b['name']);if(_0x29609b[_0x3c36('0x77')]){_0x29609b[_0x3c36('0x77')]=![];_0x314de6['queueBooked'][_0x314de6[_0x3c36('0xf8')][_0x49a0fe][_0x3c36('0xc7')]]=[];ami[_0x3c36('0xaa')]({'actionid':_0x49a0fe,'action':_0x3c36('0x1f6'),'queue':_0x29609b[_0x3c36('0x4a')]})['catch'](function(){_0x314de6[_0x3c36('0xca')](_0x29609b);hopperUtils[_0x3c36('0x108')]({'active':![],'ContactId':_0x314de6['actions'][_0x49a0fe]['ContactId'],'ListId':_0x314de6['actions'][_0x49a0fe][_0x3c36('0xe6')],'VoiceQueueId':_0x314de6[_0x3c36('0xf8')][_0x49a0fe][_0x3c36('0xe7')]||undefined,'CampaignId':_0x314de6[_0x3c36('0xf8')][_0x49a0fe][_0x3c36('0xe8')]||undefined})[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x1f7')));delete _0x314de6[_0x3c36('0xf8')][_0x49a0fe];});}else{loggerBooked[_0x3c36('0x4d')](_0x3c36('0x1f8'),JSON[_0x3c36('0x7a')](_0x29609b[_0x3c36('0x77')]),_0x3c36('0x1f5'),_0x29609b[_0x3c36('0x4a')]);_0x314de6['updateOriginated'](_0x29609b);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x314de6[_0x3c36('0xf8')][_0x49a0fe][_0x3c36('0xe5')],'ListId':_0x314de6[_0x3c36('0xf8')][_0x49a0fe][_0x3c36('0xe6')],'VoiceQueueId':_0x314de6[_0x3c36('0xf8')][_0x49a0fe]['VoiceQueueId']||undefined,'CampaignId':_0x314de6['actions'][_0x49a0fe]['CampaignId']||undefined})['catch'](loggerCatch(_0x3c36('0x1f7')));delete _0x314de6[_0x3c36('0xf8')][_0x49a0fe];}}else{return _0x314de6[_0x3c36('0x166')](_0x29609b,_0x4b8ab2);}}else{if(utils[_0x3c36('0x65')](undefined,_0x4b8ab2[_0x3c36('0x1f9')])<_0x29609b[_0x3c36('0x1fa')]*0x3c){if(_0x4b8ab2[_0x3c36('0x150')]&&!_0x4b8ab2[_0x3c36('0x150')][_0x3c36('0x1fb')]){_0x314de6[_0x3c36('0x105')][_0x3c36('0x106')](_0x4b8ab2['id'])[_0x3c36('0x20')](function(){_0x314de6['updateOriginated'](_0x29609b);});}else{hopperUtils[_0x3c36('0x1fc')]({'active':![]},_0x4b8ab2['id'],0x1)['finally'](function(){_0x314de6[_0x3c36('0xca')](_0x29609b);});}}else{_0x29609b[_0x3c36('0x1fd')]+=0x1;_0x314de6['updateOriginated'](_0x29609b);if(_0x29609b[_0x3c36('0x1fe')]){hopperUtils[_0x3c36('0x108')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4b8ab2[_0x3c36('0xe5')],'ListId':_0x4b8ab2['ListId'],'VoiceQueueId':_0x4b8ab2[_0x3c36('0xe7')]||undefined,'CampaignId':_0x4b8ab2[_0x3c36('0xe8')]||undefined})['catch'](loggerCatch(_0x3c36('0x1ff')));hopperUtils[_0x3c36('0xd2')](createObjHistory(_0x29609b,_0x4b8ab2,utils['CAMPAIGN_STATUS'][_0x3c36('0x200')],0x17,_0x3c36('0x201')))[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x202')));}else{_0x314de6['saveInDb'](createObjHistory(_0x29609b,_0x4b8ab2,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0x3c36('0x203')),_0x3c36('0x204'),'[Originate][HistoryRecallClose]');}}}}else{_0x29609b[_0x3c36('0x205')]+=0x1;_0x314de6[_0x3c36('0x11c')](createObjHistory(_0x29609b,_0x4b8ab2,utils[_0x3c36('0x6f')][_0x3c36('0x206')],0xd,_0x3c36('0x207')),'[Originate][historyBlacklist]',_0x3c36('0x208'));throw _0x3c36('0x209');}};};Dialer[_0x3c36('0x1e')][_0x3c36('0x165')]=function(_0x16285a){var _0x3fe7b7=this;var _0x4b852c=_0x16285a[_0x3c36('0x20a')]-_0x16285a['originated'];emitCampaignSummary(_0x16285a);if(_0x4b852c>0x0&&_0x16285a[_0x3c36('0x20b')]==0x0){if(_0x4b852c>this['maxNumberOriginate']){_0x4b852c=this['maxNumberOriginate'];}_0x16285a[_0x3c36('0x20b')]=0x1;hopperUtils[_0x3c36('0x20c')](_0x16285a,_0x4b852c)[_0x3c36('0xab')](function(_0x51da0d){_0x16285a[_0x3c36('0x20b')]=0x0;if(_0x51da0d){if(!utils['checkContactEmpty'](_0x51da0d)){_0x16285a['message']=utils[_0x3c36('0x6f')][_0x3c36('0x20d')];logger[_0x3c36('0x4d')](_0x3c36('0x20e')+_0x16285a[_0x3c36('0x4a')]);}else{_0x16285a[_0x3c36('0x85')]+=_0x51da0d[_0x3c36('0xa2')];_0x16285a['message']=utils[_0x3c36('0x6f')][_0x3c36('0x20f')];for(var _0x436208=0x0;_0x436208<_0x51da0d['length'];_0x436208+=0x1){_0x16285a['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x51da0d[_0x436208])||_[_0x3c36('0x101')](_0x51da0d[_0x436208][_0x3c36('0x182')])||_[_0x3c36('0x101')](_0x51da0d[_0x436208][_0x3c36('0x167')])){_0x3fe7b7[_0x3c36('0x160')](_0x3c36('0x210'),_0x16285a,_0x51da0d[_0x436208]);}else{hopperUtils[_0x3c36('0x211')](_[_0x3c36('0x103')](_0x51da0d[_0x436208],[_0x3c36('0xe8'),_0x3c36('0x167')]))[_0x3c36('0xab')](_0x3fe7b7[_0x3c36('0x1f0')](_0x16285a,_0x51da0d[_0x436208]))[_0x3c36('0xa9')](_0x3fe7b7[_0x3c36('0x15f')](_0x3c36('0x212'),_0x16285a));}}}}})[_0x3c36('0xa9')](loggerGetContactDialer(_0x3c36('0x213'),_0x16285a,_0x4b852c));}};Dialer['prototype'][_0x3c36('0xb9')]=function(_0x5fe494,_0x5481be){var _0x28fe21=this;var _0x3e71ea=[];if(_0x5481be<0x1||_0x5fe494[_0x3c36('0xb7')]===_0x3c36('0xa')){_0x5481be=0x1;}var _0x39a759=Math[_0x3c36('0x1cb')](_0x5fe494['available']*_0x5481be)-_0x5fe494['originated'];if(_0x5fe494[_0x3c36('0x214')]>0x0){var _0x3448ad=_0x5fe494[_0x3c36('0x214')]-_0x5fe494[_0x3c36('0x85')]-_0x5fe494[_0x3c36('0x144')]-_0x5fe494[_0x3c36('0x215')];if(_0x39a759>_0x3448ad){_0x39a759=_0x3448ad;}}if(_0x39a759>0x0&&_0x5fe494[_0x3c36('0x20b')]==0x0){if(_0x5fe494['dialMethod']===_0x3c36('0xa')){_0x39a759=0x1;}if(_0x39a759>this['maxNumberOriginate']){_0x39a759=this[_0x3c36('0x25')];}for(var _0x1d1f6d in this['agents']){if(typeof this[_0x3c36('0x23')][_0x1d1f6d]!==_0x3c36('0xb1')){if(this[_0x3c36('0x23')][_0x1d1f6d][_0x3c36('0x73')]===_0x3c36('0x216')&&this[_0x3c36('0x23')][_0x1d1f6d][_0x3c36('0x8f')]===_0x3c36('0x14e')){_0x3e71ea[_0x3c36('0xa3')](this[_0x3c36('0x23')][_0x1d1f6d]['id']);}}}_0x5fe494[_0x3c36('0x20b')]=0x1;hopperUtils[_0x3c36('0x217')](_0x5fe494,_0x3e71ea,_0x39a759)[_0x3c36('0xab')](function(_0x571467){_0x5fe494[_0x3c36('0x20b')]=0x0;if(_0x571467){if(!utils['checkContactEmpty'](_0x571467)){hopperUtils['countReScheduled'](_0x5fe494)['then'](sendMessageReschedule(_0x5fe494))[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x218')));}else{_0x5fe494['originated']+=_0x571467[_0x3c36('0xa2')];_0x5fe494[_0x3c36('0x6e')]=_0x5fe494[_0x3c36('0xb7')]===_0x3c36('0xa')?utils[_0x3c36('0x6f')]['ACTIVE']:utils['CAMPAIGN_STATUS'][_0x3c36('0x20f')];for(var _0x23c502=0x0;_0x23c502<_0x571467[_0x3c36('0xa2')];_0x23c502+=0x1){if(_[_0x3c36('0x101')](_0x571467[_0x23c502])||_['isNil'](_0x571467[_0x23c502][_0x3c36('0x182')])||_['isNil'](_0x571467[_0x23c502][_0x3c36('0x167')])){_0x28fe21[_0x3c36('0x160')](_0x3c36('0x210'),_0x5fe494,_0x571467[_0x23c502]);}else{hopperUtils[_0x3c36('0x219')](_[_0x3c36('0x103')](_0x571467[_0x23c502],[_0x3c36('0xe7'),'phone']))[_0x3c36('0xab')](_0x28fe21['checkContactBlack'](_0x5fe494,_0x571467[_0x23c502]))['catch'](_0x28fe21['loggerHandler'](_0x3c36('0x210'),_0x5fe494));}}}}})[_0x3c36('0xa9')](loggerGetContactDialer('[getContactDialer2]',_0x5fe494,_0x39a759));}};Dialer['prototype']['handlePredictive']=function(_0x35e45c){if(_0x35e45c['dialLimitQueue']>0x0){var _0x4d5ac5=_0x35e45c[_0x3c36('0x214')]-_0x35e45c[_0x3c36('0x85')]-_0x35e45c[_0x3c36('0x144')];if(_0x4d5ac5>0x0&&_0x35e45c[_0x3c36('0x20b')]==0x0){this[_0x3c36('0x21a')](_0x35e45c);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x3c36('0x21a')](_0x35e45c);}};Dialer[_0x3c36('0x1e')][_0x3c36('0x21a')]=function(_0x6f80a2){var _0x143f39=this;var _0x43137e=[];_0x6f80a2[_0x3c36('0x85')]+=0x1;for(var _0x304e25 in this[_0x3c36('0x23')]){if(typeof this[_0x3c36('0x23')][_0x304e25]!==_0x3c36('0xb1')){if(this[_0x3c36('0x23')][_0x304e25][_0x3c36('0x73')]===_0x3c36('0x216')&&this[_0x3c36('0x23')][_0x304e25][_0x3c36('0x8f')]===_0x3c36('0x14e')){_0x43137e[_0x3c36('0xa3')](this['agents'][_0x304e25]['id']);}}}_0x6f80a2[_0x3c36('0x20b')]=0x1;return this[_0x3c36('0x217')](_0x6f80a2['id'],_0x43137e,0x1,_0x6f80a2[_0x3c36('0x21b')],_0x6f80a2)['then'](function(_0x4eb900){_0x6f80a2[_0x3c36('0x20b')]=0x1;if(_0x4eb900){if(!utils[_0x3c36('0x21c')](_0x4eb900)){utils[_0x3c36('0x21d')](_0x6f80a2,0x1,0x0);return hopperUtils[_0x3c36('0x21e')](_0x6f80a2)[_0x3c36('0xab')](sendMessageReschedule(_0x6f80a2))[_0x3c36('0xa9')](loggerCatch(_0x3c36('0x218')));}else{_0x6f80a2[_0x3c36('0x6e')]=utils[_0x3c36('0x6f')]['RUNNING'];if(_['isNil'](_0x4eb900[0x0])||_[_0x3c36('0x101')](_0x4eb900[0x0]['Contact'])||_[_0x3c36('0x101')](_0x4eb900[0x0][_0x3c36('0x167')])){_0x143f39[_0x3c36('0x160')](_0x3c36('0x210'),_0x6f80a2,_0x4eb900[0x0]);}else{return hopperUtils[_0x3c36('0x219')](_[_0x3c36('0x103')](_0x4eb900[0x0],[_0x3c36('0xe7'),_0x3c36('0x167')]))[_0x3c36('0xab')](_0x143f39[_0x3c36('0x1f0')](_0x6f80a2,_0x4eb900[0x0]))[_0x3c36('0xa9')](_0x143f39[_0x3c36('0x15f')]('[actionOriginatePredictive]\x20',_0x6f80a2));}}}})[_0x3c36('0xa9')](loggerGetContactDialer(_0x3c36('0x21f'),_0x6f80a2,0x1));};Dialer[_0x3c36('0x1e')][_0x3c36('0x1e1')]=function(_0x3f3cc4,_0x67fe93,_0x1f8f5a,_0x1c1eb8,_0x42e0fb,_0x410da5){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x220'),_0x3f3cc4);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x221'),_0x67fe93);loggerPredictive['info'](_0x3c36('0x222'),_0x1f8f5a);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x223'),_0x1c1eb8);loggerPredictive['info'](_0x3c36('0x224'),_0x42e0fb);loggerPredictive[_0x3c36('0x4d')]('---------------------------');return new Promise(function(_0x16df83,_0x3d9bc7){if(_0x3f3cc4<=0x0||isNaN(_0x3f3cc4)){return _0x3d9bc7(msgResponse('[abandonmentRate]',_0x3c36('0x8b'),'m\x20=\x20'+_0x3f3cc4));}if(_0x1f8f5a<=0x0||isNaN(_0x1f8f5a)){return _0x3d9bc7(msgResponse('[abandonmentRate]','Error','Ts\x20=\x20'+_0x1f8f5a));}if(_0x1c1eb8<=0x0||isNaN(_0x1c1eb8)){return _0x3d9bc7(msgResponse(_0x3c36('0x225'),_0x3c36('0x8b'),_0x3c36('0x226')+_0x1c1eb8));}if(_0x67fe93<=0x0||isNaN(_0x67fe93)){return _0x3d9bc7(msgResponse(_0x3c36('0x225'),_0x3c36('0x8b'),'interval\x20=\x20'+_0x67fe93));}if(_0x42e0fb<=0x0||isNaN(_0x42e0fb)){return _0x3d9bc7(msgResponse(_0x3c36('0x225'),_0x3c36('0x8b'),_0x3c36('0x227')+_0x42e0fb));}_0x410da5=_0x410da5||0x0;var _0x27e43d=0x1/_0x1f8f5a;var _0x2c58eb=0x0;var _0x3430a3=0x0;var _0x39c5a5=0x0;var _0xc4c44=0x0;for(var _0x4b57c6=0x0;_0x39c5a5<_0x42e0fb;_0x4b57c6+=0x1){_0x3430a3=_0x4b57c6/_0x67fe93;_0x2c58eb=(_0x1c1eb8*_0x3430a3+_0x410da5)/_0x27e43d;_0x39c5a5=utils[_0x3c36('0x228')](_0x2c58eb,_0x3f3cc4);_0xc4c44=_0x2c58eb/_0x3f3cc4*(0x1-utils[_0x3c36('0x228')](_0x2c58eb,_0x3f3cc4));}return _0x16df83({'erlangCalls':_0x4b57c6,'erlangCallToSecond':_0x67fe93/_0x4b57c6,'erlangAbandonmentRate':_0x39c5a5,'erlangBusyFactor':_0xc4c44});});};Dialer[_0x3c36('0x1e')][_0x3c36('0x1e4')]=function(_0x2d0c48,_0x9c39c6,_0x524390,_0x529b75,_0xc92a35,_0xfa084d){loggerPredictive['info'](_0x3c36('0x229'));loggerPredictive[_0x3c36('0x4d')]('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',_0x2d0c48);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x221'),_0x9c39c6);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x524390);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x223'),_0x529b75);loggerPredictive['info'](_0x3c36('0x22a'),_0xc92a35);loggerPredictive[_0x3c36('0x4d')](_0x3c36('0x22b'));return new Promise(function(_0x1217dc,_0x19588e){if(_0x2d0c48<=0x0||isNaN(_0x2d0c48)){return _0x19588e(msgResponse('[busyFactor]','Error',_0x3c36('0x22c')+_0x2d0c48));}if(_0x524390<=0x0||isNaN(_0x524390)){return _0x19588e(msgResponse(_0x3c36('0x22d'),_0x3c36('0x8b'),_0x3c36('0x22e')+_0x524390));}if(_0x529b75<=0x0||isNaN(_0x529b75)){return _0x19588e(msgResponse(_0x3c36('0x22d'),'Error',_0x3c36('0x226')+_0x529b75));}if(_0x9c39c6<=0x0||isNaN(_0x9c39c6)){return _0x19588e(msgResponse(_0x3c36('0x22d'),_0x3c36('0x8b'),_0x3c36('0x22f')+_0x9c39c6));}if(_0xc92a35<=0x0||isNaN(_0xc92a35)){return _0x19588e(msgResponse(_0x3c36('0x22d'),'Error',_0x3c36('0x230')+_0xc92a35));}_0xfa084d=_0xfa084d||0x0;var _0x2340e2=0x1/_0x524390;var _0x36a467=0x0;var _0x57cc4d=0x0;var _0x441a65=0x0;var _0x408c6d=0x0;for(var _0x9a8f6e=0x0;_0x408c6d<_0xc92a35;_0x9a8f6e+=0x1){_0x57cc4d=_0x9a8f6e/_0x9c39c6;_0x36a467=(_0x529b75*_0x57cc4d+_0xfa084d)/_0x2340e2;_0x441a65=utils[_0x3c36('0x228')](_0x36a467,_0x2d0c48);_0x408c6d=_0x36a467/_0x2d0c48*(0x1-utils[_0x3c36('0x228')](_0x36a467,_0x2d0c48));}return _0x1217dc({'erlangCalls':_0x9a8f6e,'erlangCallToSecond':_0x9c39c6/_0x9a8f6e,'erlangAbandonmentRate':_0x441a65,'erlangBusyFactor':_0x408c6d});});};module[_0x3c36('0x231')]=Dialer; \ No newline at end of file +var _0x14c6=['dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','[rescheduleContact][Machine]','HANGUP','createStateFinal','[syncHangupIvr][createHistory]','dialQueueProject','AGI','moveContactManagedDialer','[syncHangupIvr]','Normal\x20Clearing','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','talking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','voiceQueue\x20is\x20undefine','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','Trunk','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','phone','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','endtime','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','available','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalHitRate','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getVoiceQueueRtPauses','loggedIn','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','outboundQueuePauses','floor','one\x20call\x20every:','milliseconds','checkContactBlack','recallme','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','getContactDialerIvr','checkContactEmpty','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','countReScheduled','RUNNING','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','getContactDialer','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','contactsId','uniqueId','startProgressive','queueBooked','queueBookedRR','agentconnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','CAMPAIGN_STATUS','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','message','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','Intervals','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','isTrunkReachable','SIP/%s','status','reachable','trunks','unmonitored','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','content','Action','indexOf','catch','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','Error','syncAgentConnect','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','droptime','getSeconds','responsetime','dialQueueTimeout','state','statedesc','Drop','dropreason','dialQueueProject2','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','dialDropMaxRetry','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','voiceQueue','dialAbandonedMaxRetry','queueCallerAbandonCreateState','dialAbandonedRetryFrequency','ContactId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','strategy','roundrobin','actionid','isNil','locked','paused','stateinterface','rrmemory','merge','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','rescheduleContact','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry'];(function(_0x16051a,_0x5e4326){var _0x35d20d=function(_0x52b02e){while(--_0x52b02e){_0x16051a['push'](_0x16051a['shift']());}};_0x35d20d(++_0x5e4326);}(_0x14c6,0xfc));var _0x614c=function(_0x450a63,_0x33254d){_0x450a63=_0x450a63-0x0;var _0x4dc906=_0x14c6[_0x450a63];return _0x4dc906;};'use strict';var util=require(_0x614c('0x0'));var _=require(_0x614c('0x1'));var uuid=require(_0x614c('0x2'));var moment=require(_0x614c('0x3'));var rr=require('rr');var Redis=require(_0x614c('0x4'));var utils=require(_0x614c('0x5'));var hopperUtils=require(_0x614c('0x6'));var ut=require(_0x614c('0x7'));var config=require(_0x614c('0x8'));var logger=require(_0x614c('0x9'))(_0x614c('0xa'));var loggerBooked=require(_0x614c('0x9'))(_0x614c('0xb'));var loggerPredictive=require(_0x614c('0x9'))('predictive');var loggerPredictiveCalls=require(_0x614c('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x614c('0xc'));var ami=require(_0x614c('0xd'));config[_0x614c('0xe')]=_['defaults'](config[_0x614c('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x614c('0xf'))(new Redis(config[_0x614c('0xe')]));var cmHopper=require(_0x614c('0x10'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x614c('0x11'));var Interval=require(_0x614c('0x12'));var Action=require('./models/action');var History=require('./models/history');var Final=require(_0x614c('0x13'));var AgentComplete=require(_0x614c('0x14'));var QueueCallerAbandon=require(_0x614c('0x15'));var Hangup=require(_0x614c('0x16'));var ipAgi=process[_0x614c('0x17')][_0x614c('0x18')]||_0x614c('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x614c('0x1a')][_0x614c('0x1b')]=function(_0x264acf){this[_0x614c('0x1c')]=this[_0x614c('0x1c')]?this['tail'][_0x614c('0x1d')](_0x264acf):_0x264acf();};function Dialer(_0x3f5546,_0x1f9781){this[_0x614c('0x1e')]=new Sequence();this[_0x614c('0x1f')]=_0x1f9781;this[_0x614c('0x20')]=_0x3f5546[_0x614c('0x20')];this[_0x614c('0x21')]=_0x3f5546[_0x614c('0x21')];this['agents']=_0x3f5546[_0x614c('0x22')];this['trunks']=_0x3f5546['trunks'];this[_0x614c('0x23')]=config['maxNumberOriginate']||0x2;this[_0x614c('0x24')]={};this[_0x614c('0x25')]={};this[_0x614c('0x26')]={};this[_0x614c('0x27')]={};this['optionPredictive']={};this['startPredictive']={};this[_0x614c('0x28')]={};this['ivrOriginated']={};this[_0x614c('0x29')]={};this[_0x614c('0x2a')]={};this['queuesSummary']={};ami['on'](_0x614c('0x2b'),this['syncAgentConnect'][_0x614c('0x2c')](this));ami['on']('queuecallerabandon',this[_0x614c('0x2d')]['bind'](this));ami['on'](_0x614c('0x2e'),this[_0x614c('0x2f')][_0x614c('0x2c')](this));ami['on'](_0x614c('0x30'),this[_0x614c('0x31')][_0x614c('0x2c')](this));ami['on']('custom:queuesummary',this[_0x614c('0xc')][_0x614c('0x2c')](this));ami['on'](_0x614c('0x32'),this[_0x614c('0x33')]['bind'](this));ami['on'](_0x614c('0x34'),this[_0x614c('0x35')][_0x614c('0x2c')](this));ami['on'](_0x614c('0x36'),this[_0x614c('0x37')][_0x614c('0x2c')](this));ami['on'](_0x614c('0x38'),this[_0x614c('0x39')][_0x614c('0x2c')](this));ami['on']('queuemember',this[_0x614c('0x3a')]['bind'](this));ami['on'](_0x614c('0x3b'),this[_0x614c('0x3c')][_0x614c('0x2c')](this));this[_0x614c('0x3d')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0x614c('0x3e')](function(_0x10694f){previewRecallmeReminderInterval=_0x10694f[_0x614c('0x3f')];});}function isNotNull(_0x343a55){return _0x343a55!==null&&!_[_0x614c('0x40')](_0x343a55);}function msgResponse(_0x22b87f,_0x2be9fc,_0x1cef30){return{'action':_0x22b87f,'response':_0x2be9fc,'message':_0x1cef30,'stack':_0x1cef30};}function emit(_0x393d1a,_0x2ddb29,_0x262e73){io['to'](_0x393d1a)[_0x614c('0x41')](_0x2ddb29,_0x262e73);}function emitOutboundVoiceQueueSummary(_0xbdec88){if(_0xbdec88[_0x614c('0x42')]===_0x614c('0x43')){logger[_0x614c('0x44')](_0x614c('0x45'),util[_0x614c('0x46')](_0xbdec88,{'showHidden':![],'depth':null}));emit(util[_0x614c('0x47')](_0x614c('0x48'),_0xbdec88[_0x614c('0x49')]),_0x614c('0x4a'),_0xbdec88);}}function checkGetDataPredictive(_0x1aa755){if(isNotNull(_0x1aa755)&&!_[_0x614c('0x4b')](_0x1aa755)){loggerPredictive[_0x614c('0x4c')](_0x614c('0x4d'));loggerPredictive['info'](_0x614c('0x4e'),_0x1aa755[_0x614c('0x4f')]);loggerPredictive[_0x614c('0x4c')](_0x614c('0x50'),_0x1aa755[_0x614c('0x51')]);loggerPredictive[_0x614c('0x4c')](_0x614c('0x52'),_0x1aa755[_0x614c('0x53')]);loggerPredictive[_0x614c('0x4c')](_0x614c('0x54'),_0x1aa755['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x614c('0x4c')](_0x614c('0x55'),_0x1aa755['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1aa755[_0x614c('0x56')]);loggerPredictive['info']('---------------------------');if(_0x1aa755[_0x614c('0x4f')]>0x0){if(!_[_0x614c('0x40')](_0x1aa755['predictiveIntervalAvgTalktime'])&&_0x1aa755['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x614c('0x4c')](_0x614c('0x57'));if(!_[_0x614c('0x40')](_0x1aa755[_0x614c('0x58')])&&_0x1aa755[_0x614c('0x58')]>0x0){return!![];}loggerPredictive[_0x614c('0x4c')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x614c('0x4c')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x614c('0x4c')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1b1688){return function(_0x3e9619){loggerPredictive[_0x614c('0x4c')](_0x614c('0x59'));loggerPredictive[_0x614c('0x4c')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e9619[_0x614c('0x5a')]);loggerPredictive[_0x614c('0x4c')](_0x614c('0x5b'),_0x3e9619[_0x614c('0x5c')]);loggerPredictive[_0x614c('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e9619[_0x614c('0x5d')]);loggerPredictive[_0x614c('0x4c')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e9619[_0x614c('0x5e')]);loggerPredictive[_0x614c('0x4c')](_0x614c('0x5f'),_0x3e9619['erlangAbandonmentRate']);loggerPredictive['info'](_0x614c('0x60'));_['merge'](_0x1b1688,_0x3e9619);};}function ifInterval(_0x31e4f2,_0x372eda){if(_[_0x614c('0x40')](_0x372eda)){return![];}return utils['getSeconds'](undefined,_0x372eda)<_0x31e4f2*0x3c;}function clearPredictiveAttributes(_0x229744){if(_0x229744[_0x614c('0x28')]){_0x229744['startProgressive']=undefined;loggerPredictive['debug'](_0x229744[_0x614c('0x49')],_0x614c('0x61'));}if(_0x229744['startPredictive']){_0x229744[_0x614c('0x62')]=undefined;loggerPredictive[_0x614c('0x44')](_0x229744[_0x614c('0x49')],_0x614c('0x63'));}if(_0x229744[_0x614c('0x64')]){clearInterval(_0x229744[_0x614c('0x64')]);_0x229744[_0x614c('0x64')]=undefined;loggerPredictive[_0x614c('0x44')](_0x229744[_0x614c('0x49')],_0x614c('0x65'));}}function loggerCatchPredictive(_0x4ecb98,_0xa8fd66){return function(_0x24ba21){loggerPredictive[_0x614c('0x66')](_0xa8fd66[_0x614c('0x49')],_0x4ecb98);loggerPredictive[_0x614c('0x66')](_0x24ba21[_0x614c('0x67')]);clearPredictiveAttributes(_0xa8fd66);};}function loggerCatch(_0x1dc684){return function(_0x5a7bf8){logger[_0x614c('0x66')](_0x1dc684,util[_0x614c('0x46')](_0x5a7bf8,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x9cfe9e,_0x121637,_0x2ba1b6){return function(_0x377c0a){utils[_0x614c('0x68')](_0x121637,_0x2ba1b6,0x0);_0x121637['temp']=0x0;logger[_0x614c('0x66')](_0x9cfe9e,util[_0x614c('0x46')](_0x377c0a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x588097){return function(_0x359ab4){if(isNotNull(_0x359ab4)&&isNotNull(_0x359ab4[0x0])){if(_0x359ab4[0x0]['contactsRescheduled']>0x0){_0x588097['message']=utils[_0x614c('0x69')]['CONTACTS_RESCHEDULED'];logger[_0x614c('0x4c')]('[getContactDialer2][ReScheduled]'+_0x588097[_0x614c('0x49')],_0x359ab4[0x0][_0x614c('0x6a')],_0x614c('0x6b'));}else{_0x588097['message']=utils['CAMPAIGN_STATUS'][_0x614c('0x6c')];logger[_0x614c('0x4c')](_0x614c('0x6d')+_0x588097[_0x614c('0x49')]);}}};}function createObjHistory(_0x595925,_0x2eee49,_0x11b6b4,_0x23c949,_0x1b6d5f){_0x595925[_0x614c('0x6e')]=_0x11b6b4;var _0x93cbc2=new Action(_0x595925,_0x2eee49);var _0x5f1707=new History(_0x93cbc2);_0x5f1707['state']=_0x23c949;_0x5f1707['statedesc']=_0x1b6d5f;_0x5f1707['endtime']=_0x93cbc2[_0x614c('0x6f')];return _0x5f1707;}function unlockQueueStatus(_0x59bf71,_0x36bbab){setTimeout(function(){if(_[_0x614c('0x40')](_0x59bf71[_0x614c('0x70')])){loggerBooked[_0x614c('0x66')](_0x614c('0x71'),_0x36bbab);}_0x59bf71[_0x614c('0x70')]=!![];loggerBooked[_0x614c('0x4c')](_0x614c('0x72'),_0x36bbab,JSON[_0x614c('0x73')](_[_0x614c('0x74')](_0x59bf71,[_0x614c('0x49'),_0x614c('0x70')])));},0x1f3);}function checkInterval(_0x1f9f10){return function(){if(!isNotNull(_0x1f9f10[_0x614c('0x75')])){_0x1f9f10[_0x614c('0x6e')]=utils[_0x614c('0x69')]['NULL_INTERVAL'];throw _0x1f9f10['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x1f9f10[_0x614c('0x75')][_0x614c('0x76')])){_0x1f9f10[_0x614c('0x6e')]=utils[_0x614c('0x69')][_0x614c('0x77')];throw _0x1f9f10[_0x614c('0x49')]+_0x614c('0x78');}if(!isNotNull(_[_0x614c('0x4b')](_0x1f9f10[_0x614c('0x75')][_0x614c('0x76')]))){_0x1f9f10[_0x614c('0x6e')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x1f9f10[_0x614c('0x49')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x271a8b){return function(){if(!utils[_0x614c('0x79')](_0x271a8b)){_0x271a8b['message']=utils[_0x614c('0x69')][_0x614c('0x7a')];throw _0x271a8b[_0x614c('0x49')]+_0x614c('0x7b');}};}function emitCampaignSummary(_0x259f94){if(utils[_0x614c('0x7c')](_0x259f94)){emit(util['format'](_0x614c('0x7d'),_0x259f94[_0x614c('0x49')]),_0x614c('0x7e'),_0x259f94);}}function loggerCatchQueueSummary(_0xaffb7e,_0xbf3d27){return function(_0x4e2932){clearPredictiveAttributes(_0xbf3d27);emitCampaignSummary(_0xbf3d27);loggerSyncQueueSummary[_0x614c('0x44')](_0xaffb7e,util[_0x614c('0x46')](_0x4e2932,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x334432){if(_0x334432[_0x614c('0x7f')]){if(_0x334432[_0x614c('0x80')]===0x0){_0x334432[_0x614c('0x7f')]=![];_0x334432['message']=utils[_0x614c('0x69')][_0x614c('0x7a')];loggerSyncQueueSummary[_0x614c('0x44')](_0x614c('0x81'),_0x334432[_0x614c('0x49')],_0x614c('0x82'));}else{_0x334432[_0x614c('0x6e')]=utils[_0x614c('0x69')]['DISACTIVED'];loggerSyncQueueSummary[_0x614c('0x44')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x334432['name'],_0x614c('0x83'));}emitCampaignSummary(_0x334432);}}function myreject(_0x1a7bd5){return function(_0xa05af9){return _0x1a7bd5(msgResponse(_0x614c('0x84'),'Error',JSON[_0x614c('0x73')](_0xa05af9)));};}Dialer[_0x614c('0x1a')][_0x614c('0x85')]=function(_0x5c2117){return!_[_0x614c('0x40')](_0x5c2117)&&_0x5c2117&&!_[_0x614c('0x40')](_0x5c2117['name'])&&!_[_0x614c('0x40')](_0x5c2117['active'])&&_0x5c2117['active']&&(this['trunks'][util[_0x614c('0x47')](_0x614c('0x86'),_0x5c2117[_0x614c('0x49')])][_0x614c('0x87')]===_0x614c('0x88')||this[_0x614c('0x89')][util[_0x614c('0x47')](_0x614c('0x86'),_0x5c2117['name'])][_0x614c('0x87')]===_0x614c('0x8a'));};Dialer['prototype'][_0x614c('0x8b')]=function(_0x468091){var _0x15f352=this;return function(){if(!_0x15f352[_0x614c('0x85')](_0x468091['Trunk'])){if(!_0x15f352['isTrunkReachable'](_0x468091[_0x614c('0x8c')])){_0x468091['message']=utils[_0x614c('0x69')][_0x614c('0x8d')];throw _0x468091['name']+_0x614c('0x8e');}}};};Dialer['prototype'][_0x614c('0x8f')]=function(_0x6f541e,_0x2d314c,_0x30b074,_0x500820){var _0x1ab3e5=this;return function(){var _0x48ad8b=!![];return _0x1ab3e5[_0x614c('0x90')](_0x6f541e,_0x2d314c,_0x30b074,_0x500820,_0x48ad8b);};};Dialer[_0x614c('0x1a')][_0x614c('0x91')]=function(_0x526a67,_0x4708c2,_0x1579f7,_0x5378b5){var _0x5a8cc6=this;return function(){var _0x2c6f3e=![];return _0x5a8cc6[_0x614c('0x90')](_0x526a67[_0x614c('0x76')],_0x4708c2,_0x1579f7,_0x5378b5,_0x2c6f3e);};};Dialer['prototype'][_0x614c('0x90')]=function(_0x121c62,_0x283d8f,_0x5156f6,_0x359c07,_0x58783e){var _0x5aa32c=[];return new Promise(function(_0x5b6791,_0x481acc){if(!isNotNull(_0x121c62)){_0x359c07[_0x614c('0x6e')]=utils[_0x614c('0x69')][_0x614c('0x77')];return _0x481acc(msgResponse(_0x614c('0x92'),_0x614c('0x93'),_0x5156f6+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x614c('0x4b')](_0x121c62)){_0x359c07['message']=utils[_0x614c('0x69')][_0x614c('0x94')];return _0x481acc(msgResponse(_0x614c('0x92'),'Failure',_0x5156f6+_0x614c('0x95')));}if(_0x283d8f&&_[_0x614c('0x40')](config[_0x614c('0x96')][_0x283d8f])){_0x359c07[_0x614c('0x6e')]=utils[_0x614c('0x69')][_0x614c('0x97')];return _0x481acc(msgResponse(_0x614c('0x92'),_0x614c('0x93'),_0x5156f6+_0x614c('0x98')+_0x283d8f));}if(_[_0x614c('0x99')](_0x121c62)){for(var _0x5f128d=0x0;_0x5f128d<_0x121c62[_0x614c('0x9a')];_0x5f128d+=0x1){_0x5aa32c[_0x614c('0x9b')](ami['Action']({'action':_0x614c('0x9c'),'command':util['format'](_0x614c('0x9d'),_0x121c62[_0x5f128d][_0x614c('0x9e')],!_[_0x614c('0x40')](config[_0x614c('0x96')][_0x283d8f])?_0x283d8f:'')})[_0x614c('0x3e')](function(_0x30a12d){return _0x30a12d[_0x614c('0x9f')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x481acc)));}}else{_0x5aa32c[_0x614c('0x9b')](ami[_0x614c('0xa0')]({'action':'command','command':util[_0x614c('0x47')]('iftime\x20%s,%s',_0x121c62,!_[_0x614c('0x40')](config['timezones'][_0x283d8f])?_0x283d8f:'')})['then'](function(_0x1cbc02){return _0x1cbc02['content'][_0x614c('0xa1')]('true')>=0x0;})[_0x614c('0xa2')](myreject(_0x481acc)));}Promise[_0x614c('0xa3')](_0x5aa32c)[_0x614c('0x3e')](function(_0x55a228){var _0x5b3af5=_['some'](_0x55a228);if(_0x5b3af5){return _0x5b6791(_0x5b3af5);}else{_0x359c07['message']=_0x58783e?utils[_0x614c('0x69')][_0x614c('0xa4')]:utils[_0x614c('0x69')][_0x614c('0xa5')];return _0x481acc(msgResponse(_0x614c('0xa6'),'Failure','Global:\x20'+_0x58783e+'\x20'+_0x5156f6+_0x614c('0xa7')+util[_0x614c('0x46')](_0x121c62,{'showHidden':![],'depth':null})+_0x614c('0xa8')+_0x283d8f));}})['catch'](function(_0x29b024){return _0x481acc(msgResponse(_0x614c('0x92'),_0x614c('0x93'),JSON[_0x614c('0x73')](_0x29b024)));});});};Dialer[_0x614c('0x1a')][_0x614c('0x3d')]=function(){var _0x30a185=this;return cmHopper[_0x614c('0xa9')]({'active':![]},{'where':{'active':!![]}})[_0x614c('0x3e')](function(){setInterval(function(){_0x30a185[_0x614c('0xaa')]();},0x3e8);});};Dialer[_0x614c('0x1a')]['syncCampaigns']=function(){var _0x576876=this;var _0x52d66a;for(var _0xf1963 in this[_0x614c('0x21')]){if(typeof this[_0x614c('0x21')][_0xf1963]!==_0x614c('0xab')){_0x52d66a=this[_0x614c('0x21')][_0xf1963];if(utils[_0x614c('0x7c')](_0x52d66a)&&utils[_0x614c('0x79')](_0x52d66a)){_0x52d66a[_0x614c('0x7f')]=!![];Promise['resolve']()[_0x614c('0x3e')](checkIsIVRCampaignActive(_0x52d66a))[_0x614c('0x3e')](checkInterval(_0x52d66a))[_0x614c('0x3e')](_0x576876[_0x614c('0x8b')](_0x52d66a))['then'](_0x576876['checkIfTime'](_0x52d66a['dialGlobalInterval'],_0x52d66a[_0x614c('0xac')],_0x52d66a['name'],_0x52d66a))[_0x614c('0x3e')](_0x576876[_0x614c('0x91')](_0x52d66a[_0x614c('0x75')],_0x52d66a['dialTimezone'],_0x52d66a[_0x614c('0x49')],_0x52d66a))[_0x614c('0x3e')](_0x576876[_0x614c('0xad')](_0x52d66a))[_0x614c('0xa2')](loggerCatchQueueSummary(_0x614c('0xae'),_0x52d66a));}else{notSendMessagesCampaign(_0x52d66a);}}}};Dialer[_0x614c('0x1a')][_0x614c('0xaf')]=function(_0x10addb){if(_0x10addb[_0x614c('0xb0')]!=='predictive'){clearPredictiveAttributes(_0x10addb);}switch(_0x10addb[_0x614c('0xb0')]){case _0x614c('0xb1'):this[_0x614c('0xb2')](_0x10addb,0x1);break;case _0x614c('0xb3'):this[_0x614c('0xb2')](_0x10addb,_0x10addb[_0x614c('0xb4')]);break;case _0x614c('0xb5'):this[_0x614c('0xb5')](_0x10addb);break;case'booked':this[_0x614c('0xb2')](_0x10addb,0x1);break;default:logger[_0x614c('0x66')](_0x614c('0xb6'),_0x10addb[_0x614c('0x49')],_0x614c('0xb7'));}};Dialer[_0x614c('0x1a')][_0x614c('0x92')]=function(_0x493308,_0x26f10b){var _0x4c65c9=_0x493308[_0x614c('0xac')];var _0xcd9eef=_0x26f10b?_0x493308['dialGlobalInterval']:_0x493308[_0x614c('0x75')][_0x614c('0x76')];logger['silly'](_0x614c('0xb8'),_0xcd9eef,_0x4c65c9,_0x493308[_0x614c('0x49')],util[_0x614c('0x47')](_0x614c('0xb9'),_0x493308[_0x614c('0x49')],_0x493308['id']));var _0x7b0955=null;return Interval['intervalIftime'](_0xcd9eef,_0x4c65c9)['then'](function(_0x1e057c){if(_0x1e057c===!![]){return _0x1e057c;}else{_0x493308['message']=_0x26f10b?utils[_0x614c('0x69')][_0x614c('0xa4')]:utils[_0x614c('0x69')][_0x614c('0xa5')];_0x7b0955=msgResponse(_0x614c('0xa6'),_0x614c('0x93'),_0x614c('0xba')+_0x26f10b+'\x20'+_0x493308[_0x614c('0x49')]+_0x614c('0xa7')+util[_0x614c('0x46')](_0xcd9eef,{'showHidden':![],'depth':null})+_0x614c('0xa8')+_0x4c65c9);}if(_0x7b0955!==null){logger['silly'](_0x614c('0xbb'),_0x7b0955);_0x7b0955['isGlobal']=_0x26f10b;throw _0x7b0955;}})[_0x614c('0xa2')](function(_0x491614){logger[_0x614c('0x66')](_0x614c('0xbc'),_0x491614);throw msgResponse('[ifTime][Action]',_0x614c('0xbd'),util[_0x614c('0x46')](_0x491614,{'showHidden':![],'depth':null}));});};Dialer[_0x614c('0x1a')][_0x614c('0xbe')]=function(_0x1443ea){if(this[_0x614c('0x20')][_0x1443ea[_0x614c('0xbf')]]){if(this['uniqueId'][_0x1443ea[_0x614c('0xc0')]]&&this[_0x614c('0x27')][_0x1443ea['uniqueid']][_0x614c('0x42')]!==_0x614c('0xc1')){this[_0x614c('0xc2')](this[_0x614c('0x20')][_0x1443ea[_0x614c('0xbf')]]);this[_0x614c('0x27')][_0x1443ea['uniqueid']]['answertime']=moment()[_0x614c('0x47')](_0x614c('0xc3'));}}};Dialer[_0x614c('0x1a')][_0x614c('0x31')]=function(_0x416e87){var _0x5d4611=this[_0x614c('0x27')][_0x416e87[_0x614c('0xc0')]];if(this[_0x614c('0x20')][_0x416e87['queue']]){if(_0x5d4611&&_0x5d4611[_0x614c('0x42')]!==_0x614c('0xc1')){delete this['uniqueId'][_0x416e87[_0x614c('0xc0')]];this[_0x614c('0x20')][_0x416e87[_0x614c('0xbf')]][_0x614c('0xc4')]+=0x1;var _0x2f87f1=new AgentComplete(_0x5d4611,_0x416e87);if(_0x416e87['reason']===_0x614c('0xc5')){_0x2f87f1[_0x614c('0xc6')]=this['voiceQueues'][_0x416e87[_0x614c('0xbf')]]['dialQueueProject2']&&this['voiceQueues'][_0x416e87[_0x614c('0xbf')]][_0x614c('0xc7')]?moment()[_0x614c('0x47')](_0x614c('0xc3')):undefined;}hopperUtils[_0x614c('0xc8')](_0x2f87f1)[_0x614c('0xa2')](loggerCatch(_0x614c('0xc9')));hopperUtils['moveContactManagedDialer'](_0x2f87f1)[_0x614c('0xa2')](loggerCatch(_0x614c('0xca')));}}};Dialer['prototype'][_0x614c('0x2d')]=function(_0x27f2c6){var _0x9b6f70=this['uniqueId'][_0x27f2c6[_0x614c('0xc0')]];var _0x747be6=this;var _0x4faf11=![];var _0x2fb153;var _0x2ebff0;if(this['voiceQueues'][_0x27f2c6['queue']]){if(_0x9b6f70&&_0x9b6f70[_0x614c('0x42')]!=='ivr'){delete this[_0x614c('0x27')][_0x27f2c6[_0x614c('0xc0')]];this['updateOriginated'](this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]]);_0x9b6f70[_0x614c('0xcb')]=moment()[_0x614c('0x47')](_0x614c('0xc3'));var _0x2d707c=new QueueCallerAbandon(_0x9b6f70,_0x27f2c6);if(utils[_0x614c('0xcc')](_0x9b6f70[_0x614c('0xcb')],_0x9b6f70[_0x614c('0xcd')])>=_0x9b6f70[_0x614c('0xce')]){this[_0x614c('0x20')][_0x27f2c6['queue']][_0x614c('0x53')]+=0x1;this['voiceQueues'][_0x27f2c6[_0x614c('0xbf')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2d707c[_0x614c('0xcf')]=0xa;_0x2d707c[_0x614c('0xd0')]=_0x614c('0xd1');_0x2d707c[_0x614c('0xd2')]='TIMEOUT';_0x2d707c[_0x614c('0xc6')]=this['voiceQueues'][_0x27f2c6['queue']][_0x614c('0xd3')]?moment()[_0x614c('0x47')](_0x614c('0xc3')):undefined;_0x2d707c[_0x614c('0xd4')]+=0x1;_0x2d707c['countglobal']+=0x1;_0x2fb153=this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]][_0x614c('0xd5')];_0x2ebff0=this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]][_0x614c('0xd6')];hopperUtils[_0x614c('0xd7')](_0x2d707c,_0x2d707c[_0x614c('0xcf')],_0x9b6f70['voiceQueue'])[_0x614c('0x3e')](function(_0x1375c0){_0x4faf11=_0x1375c0[_0x614c('0xd8')]==0x1;if(_0x2d707c['countdropretry']>=_0x747be6[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]][_0x614c('0xd9')]){_0x747be6['queueCallerAbandonCreateState'](_0x2d707c,_0x1375c0['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2d707c[_0x614c('0xd4')],'scheduledat':moment()['add'](_0x747be6[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]][_0x614c('0xd5')],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0x9b6f70['ContactId'],'ListId':_0x9b6f70[_0x614c('0xdb')],'VoiceQueueId':_0x9b6f70[_0x614c('0xdc')]||undefined,'CampaignId':_0x9b6f70[_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0xde')));var _0x257326=new History(_0x2d707c);_0x257326['state']=0xa;_0x257326[_0x614c('0xd0')]=_0x614c('0xd1');_0x257326[_0x614c('0x6f')]=moment()[_0x614c('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x257326['endtime']=_0x257326['starttime'];_0x257326['calleridname']=_0x2d707c[_0x614c('0xdf')];_0x257326[_0x614c('0xe0')]=_0x2d707c[_0x614c('0xe0')];hopperUtils[_0x614c('0xc8')](_0x257326)[_0x614c('0xa2')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x4faf11)hopperUtils[_0x614c('0xe1')](_0x2d707c,_0x2fb153,_0x2ebff0)['then'](function(){return 0x1;});});}else{this[_0x614c('0x20')][_0x27f2c6['queue']][_0x614c('0xe2')]+=0x1;this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]][_0x614c('0xe3')]+=0x1;_0x2d707c[_0x614c('0xcf')]=0xb;_0x2d707c[_0x614c('0xd0')]=_0x614c('0xe4');_0x2d707c[_0x614c('0xd2')]=_0x614c('0xe5');_0x2d707c[_0x614c('0xe6')]+=0x1;_0x2d707c['countglobal']+=0x1;_0x2fb153=this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]]['dialAbandonedRetryFrequency'];_0x2ebff0=this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x2d707c,_0x2d707c['state'],_0x9b6f70[_0x614c('0xe7')])[_0x614c('0x3e')](function(_0x548864){if(_0x2d707c['countabandonedretry']>=_0x747be6[_0x614c('0x20')][_0x27f2c6['queue']][_0x614c('0xe8')]){_0x747be6[_0x614c('0xe9')](_0x2d707c,_0x548864[_0x614c('0xd8')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x2d707c['countabandonedretry'],'scheduledat':moment()['add'](_0x747be6[_0x614c('0x20')][_0x27f2c6['queue']][_0x614c('0xea')],_0x614c('0xda'))[_0x614c('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x9b6f70[_0x614c('0xeb')],'ListId':_0x9b6f70[_0x614c('0xdb')],'VoiceQueueId':_0x9b6f70['VoiceQueueId']||undefined,'CampaignId':_0x9b6f70['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0xec')));var _0x3fed6d=new History(_0x2d707c);_0x3fed6d[_0x614c('0xcf')]=0xb;_0x3fed6d[_0x614c('0xd0')]=_0x614c('0xe4');_0x3fed6d[_0x614c('0x6f')]=moment()['format'](_0x614c('0xc3'));_0x3fed6d['endtime']=_0x3fed6d['starttime'];_0x3fed6d[_0x614c('0xdf')]=_0x2d707c[_0x614c('0xdf')];_0x3fed6d[_0x614c('0xe0')]=_0x2d707c['calleridnum'];hopperUtils['createHistory'](_0x3fed6d)[_0x614c('0xa2')](loggerCatch(_0x614c('0xed')));}})[_0x614c('0x3e')](function(){if(_0x4faf11)hopperUtils[_0x614c('0xe1')](_0x2d707c,_0x2fb153,_0x2ebff0)[_0x614c('0x3e')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x614c('0x37')]=function(_0x5dfa47){if(this['actions'][_0x5dfa47[_0x614c('0xc0')]]){this[_0x614c('0x25')][_0x5dfa47[_0x614c('0xc0')]]['channel']=_0x5dfa47[_0x614c('0xee')];}if(this[_0x614c('0x27')][_0x5dfa47[_0x614c('0xc0')]]){this[_0x614c('0x27')][_0x5dfa47['uniqueid']][_0x614c('0xee')]=_0x5dfa47[_0x614c('0xee')];}};Dialer[_0x614c('0x1a')][_0x614c('0x3a')]=function(_0x4960c8){if(!this[_0x614c('0x25')][_0x4960c8['actionid']]){return;}var _0x44556a=this[_0x614c('0x20')][this[_0x614c('0x25')][_0x4960c8['actionid']]['queue']][_0x614c('0xef')]||'rrmemory';if(_0x44556a===_0x614c('0xf0')){if(this[_0x614c('0x25')][_0x4960c8[_0x614c('0xf1')]]&&_[_0x614c('0xf2')](this['actions'][_0x4960c8[_0x614c('0xf1')]][_0x614c('0xf3')])&&_0x4960c8[_0x614c('0x87')]==='1'&&_0x4960c8[_0x614c('0xf4')]==='0'){if(this[_0x614c('0x22')][_0x4960c8[_0x614c('0xf5')]]){if(!this[_0x614c('0x22')][_0x4960c8[_0x614c('0xf5')]][_0x614c('0xf3')]){this[_0x614c('0x22')][_0x4960c8[_0x614c('0xf5')]][_0x614c('0xf3')]=!![];this[_0x614c('0x25')][_0x4960c8['actionid']][_0x614c('0xf3')]=!![];this[_0x614c('0x25')][_0x4960c8[_0x614c('0xf1')]][_0x614c('0xf5')]=_0x4960c8[_0x614c('0xf5')];}}}}else if(_0x44556a===_0x614c('0xf6')){if(this[_0x614c('0x25')][_0x4960c8[_0x614c('0xf1')]]){if(this[_0x614c('0x22')][_0x4960c8[_0x614c('0xf5')]]){this[_0x614c('0x25')][_0x4960c8[_0x614c('0xf1')]][_0x614c('0xf5')]=_0x4960c8[_0x614c('0xf5')];if(_['isNil'](this[_0x614c('0x29')][this['actions'][_0x4960c8[_0x614c('0xf1')]][_0x614c('0xbf')]])){this[_0x614c('0x29')][this['actions'][_0x4960c8[_0x614c('0xf1')]]['queue']]=[];}this[_0x614c('0x29')][this[_0x614c('0x25')][_0x4960c8[_0x614c('0xf1')]][_0x614c('0xbf')]][_0x614c('0x9b')](_[_0x614c('0xf7')](_[_0x614c('0x74')](this['actions'][_0x4960c8[_0x614c('0xf1')]],[_0x614c('0xf8'),_0x614c('0xf5')]),{'status':_0x4960c8[_0x614c('0x87')],'paused':_0x4960c8[_0x614c('0xf4')]}));}}}};Dialer[_0x614c('0x1a')]['syncQueueStatusComplete']=function(_0x335600){if(!this[_0x614c('0x25')][_0x335600['actionid']]){return;}var _0x329ddb=this;var _0x3159f0=this[_0x614c('0x20')][this[_0x614c('0x25')][_0x335600['actionid']]['queue']];var _0x297ab7=_0x3159f0[_0x614c('0xef')]||_0x614c('0xf6');if(_0x297ab7==='roundrobin'){if(this[_0x614c('0x25')][_0x335600['actionid']]&&this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xf5')]){this[_0x614c('0x1f')][_0x614c('0xf9')](this['actions'][_0x335600[_0x614c('0xf1')]][_0x614c('0xf8')],this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xf5')])['catch'](function(_0x1fa20d){logger[_0x614c('0x66')](_0x614c('0xfa'),util[_0x614c('0x46')](_0x1fa20d,{'showHidden':![],'depth':null}));})[_0x614c('0x1d')](function(){_0x329ddb[_0x614c('0xc2')](_0x329ddb[_0x614c('0x20')][_0x329ddb[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]]);_0x329ddb[_0x614c('0x22')][_0x329ddb[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xf5')]][_0x614c('0xf3')]=![];delete _0x329ddb[_0x614c('0x25')][_0x335600['actionid']];unlockQueueStatus(_0x3159f0);});}else{this['updateOriginated'](this[_0x614c('0x20')][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]]);hopperUtils[_0x614c('0xfb')]({'active':![],'ContactId':this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xeb')],'ListId':this['actions'][_0x335600[_0x614c('0xf1')]][_0x614c('0xdb')],'VoiceQueueId':this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0xfc')));delete this[_0x614c('0x25')][_0x335600['actionid']];unlockQueueStatus(_0x3159f0);}}else if(_0x297ab7==='rrmemory'){var _0x4b84b3;if(this['actions'][_0x335600[_0x614c('0xf1')]]&&!_['isEmpty'](this['queueBooked'][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]])){if(this[_0x614c('0x2a')][_0x329ddb[_0x614c('0x25')][_0x335600['actionid']][_0x614c('0xbf')]]){this['queueBookedRR'][_0x329ddb[_0x614c('0x25')][_0x335600['actionid']][_0x614c('0xbf')]]=this['queueBookedRR'][this['actions'][_0x335600[_0x614c('0xf1')]]['queue']]?this[_0x614c('0x2a')][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]]:this['queueBooked'][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]]?this['queueBooked'][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]][_0x614c('0xfd')]||0x0:0x0;}this[_0x614c('0x29')][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]]['queue']][_0x614c('0xfd')]=this[_0x614c('0x2a')][this[_0x614c('0x25')][_0x335600['actionid']]['queue']];for(var _0x167c39=0x0;_0x167c39=_0x3b1d35[_0x614c('0x120')]){_0x2b94b7[_0x614c('0x121')](_0x497190,_0xe1ba43,_0x51d674,_0x614c('0x122'));}else{if(_0x497190['countmachineretry']>=_0x3b1d35[_0x614c('0x123')]){_0x2b94b7['createStateFinal'](_0x497190,_0xe1ba43,_0x51d674,_0x614c('0x124'));}else{hopperUtils[_0x614c('0xfb')]({'active':![],'countmachineretry':_0x497190[_0x614c('0x117')],'scheduledat':moment()[_0x614c('0x125')](_0x3b1d35[_0x614c('0x126')],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0x497190[_0x614c('0xeb')],'ListId':_0x497190[_0x614c('0xdb')],'VoiceQueueId':_0x497190[_0x614c('0xdc')]||undefined,'CampaignId':_0x497190['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0x127')));_0xe1ba43({'reschedule':0x1});}}});}if(_0x4b29fc['type']===_0x614c('0xc1')&&this[_0x614c('0x21')][_0x4b29fc[_0x614c('0xbf')]]['dialAMDActive']&&_0x5bb180[_0x614c('0x10b')]===_0x614c('0x128')){delete this[_0x614c('0x27')][_0x5bb180[_0x614c('0xc0')]];this['updateOriginated'](this['campaigns'][_0x4b29fc[_0x614c('0xbf')]]);_0x568339=new Hangup(_0x4b29fc,_0x5bb180);_0x568339[_0x614c('0xcf')]=0x12;_0x568339['statedesc']='HangupInAMD';_0x568339[_0x614c('0x10e')]=_0x614c('0x10f');ami[_0x614c('0x41')](_0x614c('0x119'),ut[_0x614c('0x110')](_0x568339,'amd'));this[_0x614c('0x112')](_0x568339,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x4b29fc['type']==='ivr'&&this[_0x614c('0x21')][_0x4b29fc[_0x614c('0xbf')]][_0x614c('0x10a')]&&_0x5bb180['value']===_0x614c('0x115')){return new Promise(function(_0x371abd,_0x4bdef8){delete _0x2b94b7[_0x614c('0x27')][_0x5bb180[_0x614c('0xc0')]];_0x2b94b7[_0x614c('0xc2')](_0x2b94b7[_0x614c('0x21')][_0x4b29fc[_0x614c('0xbf')]]);_0x2b94b7['campaigns'][_0x4b29fc[_0x614c('0xbf')]][_0x614c('0xc4')]+=0x1;_0x2b94b7[_0x614c('0x21')][_0x4b29fc[_0x614c('0xbf')]][_0x614c('0x10c')]+=0x1;var _0x231dce=_0x2b94b7[_0x614c('0x21')][_0x4b29fc[_0x614c('0xbf')]];var _0xd70d05=new Hangup(_0x4b29fc,_0x5bb180);_0xd70d05['state']=0x13;_0xd70d05[_0x614c('0xd0')]=_0x614c('0x116');_0xd70d05[_0x614c('0x10e')]=_0x614c('0x10f');_0xd70d05[_0x614c('0x117')]+=0x1;_0xd70d05[_0x614c('0x118')]+=0x1;_0xd70d05['amd']=!![];ami['emit']('custom:amd',ut[_0x614c('0x110')](_0xd70d05,'amd'));hopperUtils[_0x614c('0xc8')](_0xd70d05)[_0x614c('0xa2')](loggerCatch(_0x614c('0x11a')));if(_0xd70d05[_0x614c('0x11b')]+_0xd70d05[_0x614c('0x11c')]+_0xd70d05[_0x614c('0x11d')]+_0xd70d05[_0x614c('0x11e')]+_0xd70d05[_0x614c('0xd4')]+_0xd70d05[_0x614c('0xe6')]+_0xd70d05['countmachineretry']+_0xd70d05['countagentrejectretry']>=_0x231dce[_0x614c('0x120')]){_0x2b94b7['stateGlobal'](_0xd70d05,_0x371abd,_0x4bdef8,_0x614c('0x122'));}else{if(_0xd70d05['countmachineretry']>=_0x231dce['dialMachineMaxRetry']){_0x2b94b7[_0x614c('0x129')](_0xd70d05,_0x371abd,_0x4bdef8,_0x614c('0x124'));}else{hopperUtils[_0x614c('0xfb')]({'active':![],'countmachineretry':_0xd70d05[_0x614c('0x117')],'scheduledat':moment()[_0x614c('0x125')](_0x231dce['dialMachineRetryFrequency'],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0xd70d05[_0x614c('0xeb')],'ListId':_0xd70d05[_0x614c('0xdb')],'VoiceQueueId':_0xd70d05['VoiceQueueId']||undefined,'CampaignId':_0xd70d05['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0x127')));_0x371abd({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x614c('0x35')]=function(_0x42abb9){var _0x3a60fd=this['uniqueId'][_0x42abb9[_0x614c('0xc0')]];var _0x215052;if(_0x3a60fd&&_0x3a60fd['type']===_0x614c('0xc1')){delete this[_0x614c('0x27')][_0x42abb9[_0x614c('0xc0')]];this[_0x614c('0xc2')](this[_0x614c('0x21')][_0x3a60fd[_0x614c('0xbf')]]);this[_0x614c('0x21')][_0x3a60fd[_0x614c('0xbf')]]['ivrAnswerCallsDay']+=0x1;_0x215052=new Hangup(_0x3a60fd,_0x42abb9);hopperUtils[_0x614c('0xc8')](_0x215052)[_0x614c('0xa2')](loggerCatch(_0x614c('0x12a')));hopperUtils['moveContactManagedDialer'](_0x215052)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x3a60fd&&_0x3a60fd[_0x614c('0x42')]!==_0x614c('0xc1')&&isNotNull(this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]][_0x614c('0x12b')])){delete this['uniqueId'][_0x42abb9[_0x614c('0xc0')]];this[_0x614c('0xc2')](this['voiceQueues'][_0x3a60fd[_0x614c('0xbf')]]);this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]][_0x614c('0xc4')]+=0x1;this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]][_0x614c('0x10c')]+=0x1;_0x215052=new Hangup(_0x3a60fd,_0x42abb9);_0x215052[_0x614c('0xcf')]=0x10;_0x215052[_0x614c('0xd0')]='AnswerAGI';_0x215052[_0x614c('0x10e')]=_0x614c('0x12c');hopperUtils[_0x614c('0xc8')](_0x215052)[_0x614c('0xa2')](loggerCatch(_0x614c('0x12a')));hopperUtils[_0x614c('0x12d')](_0x215052)[_0x614c('0xa2')](loggerCatch(_0x614c('0x12e')));}if(_0x3a60fd&&_0x3a60fd[_0x614c('0x42')]!==_0x614c('0xc1')&&!isNotNull(this[_0x614c('0x20')][_0x3a60fd['queue']][_0x614c('0x12b')])){if(_0x42abb9['cause-txt']===_0x614c('0x12f')){delete this[_0x614c('0x27')][_0x42abb9['uniqueid']];this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]][_0x614c('0xc4')]+=0x1;const _0x1abc11=new AgentComplete(_0x3a60fd,_0x42abb9);_0x1abc11[_0x614c('0xdd')]=this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]]['id'];hopperUtils[_0x614c('0xc8')](_0x1abc11)[_0x614c('0xa2')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x1abc11)['catch'](loggerCatch(_0x614c('0xca')));}else{delete this[_0x614c('0x27')][_0x42abb9[_0x614c('0xc0')]];this['updateOriginated'](this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]]);this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]][_0x614c('0x130')]+=0x1;_0x215052=new Hangup(_0x3a60fd,_0x42abb9);_0x215052[_0x614c('0xcf')]=0xc;_0x215052[_0x614c('0xd0')]=_0x42abb9[_0x614c('0x131')];_0x215052[_0x614c('0x10e')]=_0x614c('0x132');hopperUtils[_0x614c('0xc8')](_0x215052)[_0x614c('0xa2')](loggerCatch(_0x614c('0x12a')));hopperUtils['moveContactManagedDialer'](_0x215052)[_0x614c('0xa2')](loggerCatch(_0x614c('0x12e')));}}};Dialer[_0x614c('0x1a')][_0x614c('0xc')]=function(_0x559d0f){var _0x2367ef=this;if(!_0x2367ef['queuesSummary'][_0x559d0f[_0x614c('0x49')]]){_0x2367ef[_0x614c('0x133')][_0x559d0f[_0x614c('0x49')]]={'running':![]};}else if(_0x2367ef[_0x614c('0x133')][_0x559d0f[_0x614c('0x49')]][_0x614c('0x134')]===!![]){return;}else if(_0x2367ef[_0x614c('0x133')][_0x559d0f[_0x614c('0x49')]][_0x614c('0x134')]===![]){_0x2367ef[_0x614c('0x133')][_0x559d0f['name']][_0x614c('0x134')]=!![];}var _0x505f3f=_0x2367ef['voiceQueues'][_0x559d0f[_0x614c('0x49')]];var _0x4c6c5f=_0x505f3f[_0x614c('0x6e')]!==utils['CAMPAIGN_STATUS'][_0x614c('0x7a')];var _0x4c8a09=utils[_0x614c('0x135')](_0x505f3f);_0x505f3f[_0x614c('0x136')]=utils[_0x614c('0x137')](_0x505f3f,_0x2367ef['trunks']);Promise[_0x614c('0x138')]()[_0x614c('0x3e')](function(){if(_0x505f3f[_0x614c('0x136')]===utils[_0x614c('0x69')][_0x614c('0x7a')]){if(_0x4c6c5f){clearPredictiveAttributes(_0x505f3f);_0x559d0f[_0x614c('0x62')]=undefined;_0x559d0f[_0x614c('0x28')]=undefined;}if(_0x505f3f[_0x614c('0x136')]===utils[_0x614c('0x69')][_0x614c('0x7a')]){_0x559d0f['available']=0x0;_0x559d0f['paused']=0x0;_0x559d0f['inUse']=0x0;_0x559d0f[_0x614c('0x139')]=0x0;_0x559d0f['pTalking']=0x0;}}else if(_0x505f3f['statusMessage']===utils[_0x614c('0x69')]['ACTIVE']&&!_0x4c8a09){return _0x2367ef[_0x614c('0x92')](_0x505f3f,!![])[_0x614c('0x3e')](function(){return _0x2367ef[_0x614c('0x92')](_0x505f3f,![]);})[_0x614c('0x3e')](function(){return _0x2367ef[_0x614c('0xaf')](_0x505f3f);})[_0x614c('0xa2')](function(_0x462e65){loggerSyncQueueSummary[_0x614c('0x44')](_0x614c('0x13a'),util['inspect'](_0x462e65,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x505f3f);});}else{clearPredictiveAttributes(_0x505f3f);}})[_0x614c('0x3e')](function(){var _0x5bae5e=_0x559d0f[_0x614c('0x13b')](_0x505f3f);if(_0x5bae5e||_0x505f3f['queueSummaryCountersUpdated']){_0x505f3f[_0x614c('0x13c')]=![];_0x559d0f['updateReportFromOutboundQueue'](_0x505f3f);Object['assign'](_0x505f3f,_0x559d0f);emitOutboundVoiceQueueSummary(_0x559d0f);}_0x2367ef['queuesSummary'][_0x505f3f[_0x614c('0x49')]]['running']=![];})[_0x614c('0xa2')](function(_0xc0869b){logger[_0x614c('0x66')](_0x614c('0x13a'),util[_0x614c('0x46')](_0xc0869b,{'showHidden':![],'depth':null}));_0x2367ef[_0x614c('0x133')][_0x505f3f[_0x614c('0x49')]][_0x614c('0x134')]=![];});};Dialer['prototype'][_0x614c('0x33')]=_[_0x614c('0x13d')](function(){var _0x4d1cc5=_[_0x614c('0x13e')](this[_0x614c('0x20')],function(_0x4bf5f0){return _0x4bf5f0[_0x614c('0x13f')];});var _0x5f55be=_[_0x614c('0x13e')](this[_0x614c('0x22')],function(_0x6b0756){return _0x6b0756[_0x614c('0x140')]&&_0x6b0756[_0x614c('0x87')]==='reachable';});if(_0x4d1cc5[_0x614c('0x9a')]>0x0&&_0x5f55be[_0x614c('0x9a')]>0x0){return Promise[_0x614c('0x138')]()[_0x614c('0x3e')](cmHopper[_0x614c('0x141')](_[_0x614c('0x142')](_0x4d1cc5,'id'),previewRecallmeReminderInterval,_[_0x614c('0x142')](_0x5f55be,'id')))[_0x614c('0x3e')](function(_0x2e59ad){for(var _0x2231ea=0x0;_0x2231ea<_0x2e59ad['length'];_0x2231ea++){var _0x232794=_0x2e59ad[_0x2231ea][_0x614c('0x143')][_0x614c('0x49')];if(_0x232794)io['to'](util[_0x614c('0x47')](_0x614c('0x144'),_0x232794))['emit'](_0x614c('0x145'),{'hopper':_0x2e59ad[_0x2231ea]});}})[_0x614c('0xa2')](function(_0x4e10f7){logger[_0x614c('0x66')](_0x614c('0x146'),_0x4e10f7);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x445cad=this;setInterval(function(){_0x445cad['clearZombieChannels'](_0x445cad[_0x614c('0x27')],_0x614c('0x147'));_0x445cad[_0x614c('0x148')](_0x445cad['actions'],'[actions]');},0x32c8);};Dialer[_0x614c('0x1a')][_0x614c('0x148')]=function(_0x13fea4,_0x12918c){var _0x2a4828=this;for(var _0x269252 in _0x13fea4){if(typeof _0x13fea4[_0x269252]!=='undefined'){this[_0x614c('0x1e')][_0x614c('0x1b')](function(){if(!_[_0x614c('0xf2')](_0x13fea4[_0x269252])){return ami[_0x614c('0xa0')]({'action':'status','channel':_0x13fea4[_0x269252]['channel']})[_0x614c('0xa2')](function(_0x2e5de3){if(_0x2e5de3['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x13fea4[_0x269252]&&_0x13fea4[_0x269252][_0x614c('0x42')]!==_0x614c('0xc1')){_0x2a4828[_0x614c('0xc2')](_0x2a4828[_0x614c('0x20')][_0x13fea4[_0x269252][_0x614c('0xbf')]]);logger[_0x614c('0x66')](_0x614c('0x149'),_0x12918c,_0x269252,_0x13fea4[_0x269252][_0x614c('0xbf')]);delete _0x13fea4[_0x269252];}if(_0x13fea4[_0x269252]&&_0x13fea4[_0x269252][_0x614c('0x42')]===_0x614c('0xc1')){_0x2a4828[_0x614c('0xc2')](_0x2a4828[_0x614c('0x21')][_0x13fea4[_0x269252][_0x614c('0xbf')]]);logger[_0x614c('0x66')](_0x614c('0x14a'),_0x12918c,_0x269252,_0x13fea4[_0x269252][_0x614c('0xbf')]);delete _0x13fea4[_0x269252];}},0x2328);}});}});}}};Dialer[_0x614c('0x1a')]['getVoiceQueueRtPauses']=function(_0x261de6){return Promise[_0x614c('0x138')]()[_0x614c('0x3e')](voiceQueueRt['getVoiceQueueRtPauses'](_0x261de6))[_0x614c('0xa2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x614c('0x1a')][_0x614c('0xc2')]=function(_0x3a4950){if(!_[_0x614c('0x40')](_0x3a4950)&&_0x3a4950!==null){if(typeof _0x3a4950['originated']!=='undefined'){if(_0x3a4950[_0x614c('0x80')]>0x0){_0x3a4950[_0x614c('0x80')]-=0x1;}else{logger[_0x614c('0x66')](_0x614c('0x14b'));}}}else{logger[_0x614c('0x66')](_0x614c('0x14c'));}};Dialer[_0x614c('0x1a')][_0x614c('0x14d')]=function(_0x5d8000,_0x248e58){var _0x754825=this;return function(_0x7673a6){_0x754825[_0x614c('0xc2')](_0x248e58);logger['error'](_0x5d8000,util[_0x614c('0x46')](_0x7673a6,{'showHidden':![],'depth':null}));};};Dialer[_0x614c('0x1a')][_0x614c('0x14e')]=function(_0x79cd61,_0x248f29,_0xe5fff3){var _0x1085a2={'state':0x19,'statedesc':_0x614c('0x14f')};this[_0x614c('0xc2')](_0x248f29);this[_0x614c('0x112')](_[_0x614c('0xf7')](_0x1085a2,_[_0x614c('0x74')](_0xe5fff3,[_0x614c('0xeb'),_0x614c('0xdb'),_0x614c('0x150'),'VoiceQueueId','CampaignId'])),_0x614c('0x151'),_0x614c('0x152'));logger[_0x614c('0x66')](_0x79cd61);};Dialer[_0x614c('0x1a')]['saveInDb']=function(_0x36e8c1,_0x1e542c,_0x33ac05){hopperUtils['createHistory'](_0x36e8c1)[_0x614c('0xa2')](loggerCatch(_0x1e542c));hopperUtils[_0x614c('0x12d')](_0x36e8c1)['catch'](loggerCatch(_0x33ac05));};Dialer['prototype'][_0x614c('0xe9')]=function(_0x303cee,_0x83b4a){hopperUtils[_0x614c('0xc8')](_0x303cee)[_0x614c('0xa2')](loggerCatch(_0x614c('0xc9')));if(_0x83b4a==0x0){hopperUtils[_0x614c('0x12d')](_0x303cee)[_0x614c('0xa2')](loggerCatch(_0x614c('0x153')));}};Dialer[_0x614c('0x1a')][_0x614c('0x146')]=function(_0xe6b72e){return Promise[_0x614c('0x138')]()[_0x614c('0x3e')](cmHopper['handlePreviewRecallNotifications'](_0xe6b72e['id'],previewRecallmeReminderInterval))[_0x614c('0x3e')](function(_0x4e80a9){for(var _0xa7c425=0x0;_0xa7c425<_0x4e80a9[_0x614c('0x9a')];_0xa7c425++){var _0x5eb587=_0x4e80a9[_0xa7c425][_0x614c('0x143')][_0x614c('0x49')];if(_0x5eb587)io['to'](util[_0x614c('0x47')](_0x614c('0x144'),_0x5eb587))[_0x614c('0x41')](_0x614c('0x145'),{'hopper':_0x4e80a9[_0xa7c425]});}})[_0x614c('0xa2')](function(){});};Dialer[_0x614c('0x1a')][_0x614c('0xad')]=function(_0x244897){var _0x33d65a=this;return function(){_0x33d65a['handleIvr'](_0x244897);};};Dialer[_0x614c('0x1a')][_0x614c('0x154')]=function(_0x2e84c7,_0x4f3a2f){var _0x3127de=this;var _0x456fa4=uuid['v4']();this[_0x614c('0x25')][_0x456fa4]=new Action(_0x2e84c7,_0x4f3a2f,_0x456fa4);return new Promise(function(_0x582351,_0xb0650e){if(_[_0x614c('0x40')](_0x2e84c7)&&typeof _0x2e84c7!==_0x614c('0x155')){return _0xb0650e(msgResponse('originate',_0x614c('0x93'),_0x614c('0x156')));}if(_[_0x614c('0x40')](_0x4f3a2f['phone'])||_0x4f3a2f['phone']===null){return _0xb0650e(msgResponse(_0x614c('0x157'),_0x614c('0x93'),_0x614c('0x158')));}var _0x9a9c6f={'XMD-CALLERID':_0x3127de['actions'][_0x456fa4][_0x614c('0x159')](),'XMD-AGI':_0x2e84c7[_0x614c('0x12b')]?util[_0x614c('0x47')](_0x614c('0x15a'),ipAgi,_0x2e84c7[_0x614c('0x12b')]):'NONE','XMD-AGIAFTER':_0x2e84c7[_0x614c('0xd3')]?util[_0x614c('0x47')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2e84c7[_0x614c('0xd3')]):_0x614c('0x15b'),'XMD-QUEUE':utils[_0x614c('0x15c')](_0x2e84c7)?util['format']('\x22%s,%s%s,,,%s\x22',_0x2e84c7['name'],_0x2e84c7[_0x614c('0x15d')]||'',_0x2e84c7['dialAgiAfterHangupAgent']?'c':'',_0x2e84c7[_0x614c('0xce')]||0x3):'NONE','XMD-CONTACTID':_0x4f3a2f[_0x614c('0xeb')],'XMD-CDRTYPE':_0x614c('0xa'),'CALLERID(all)':_0x3127de['actions'][_0x456fa4][_0x614c('0x159')](),'XMD-AMD':_0x2e84c7[_0x614c('0x10a')]?_0x614c('0x15e'):'NONE','XMD-DESTINATION':_0x614c('0x109')};if(_0x2e84c7[_0x614c('0x10a')]){_0x9a9c6f[_0x614c('0x15f')]=_0x2e84c7[_0x614c('0x160')]||0x9c4;_0x9a9c6f[_0x614c('0x161')]=_0x2e84c7[_0x614c('0x162')]||0x5dc;_0x9a9c6f[_0x614c('0x163')]=_0x2e84c7[_0x614c('0x164')]||0x320;_0x9a9c6f[_0x614c('0x165')]=_0x2e84c7[_0x614c('0x166')]||0x1388;_0x9a9c6f[_0x614c('0x167')]=_0x2e84c7[_0x614c('0x168')]||0x64;_0x9a9c6f[_0x614c('0x169')]=_0x2e84c7[_0x614c('0x16a')]||0x32;_0x9a9c6f[_0x614c('0x16b')]=_0x2e84c7[_0x614c('0x16c')]||0x3;_0x9a9c6f[_0x614c('0x16d')]=_0x2e84c7[_0x614c('0x16e')]||0x100;_0x9a9c6f['XMD-AMDMAXIMUMWORDLENGTH']=_0x2e84c7[_0x614c('0x16f')]||0x1388;}if(utils[_0x614c('0x15c')](_0x2e84c7)){_0x9a9c6f[_0x614c('0x170')]=_0x4f3a2f[_0x614c('0xdc')];}else{_0x9a9c6f[_0x614c('0x171')]=_0x4f3a2f['CampaignId'];}var _0x769d58=utils[_0x614c('0x172')](_0x4f3a2f['Contact']);Object['assign'](_0x9a9c6f,_0x769d58);var _0x195a6e=_0x3127de[_0x614c('0x85')](_0x2e84c7['Trunk'])?utils['getCallerId'](_0x2e84c7['Trunk'][_0x614c('0x173')],_0x2e84c7['dialOriginateCallerIdName'],_0x2e84c7[_0x614c('0x174')]>0x0?utils[_0x614c('0x175')](_0x2e84c7[_0x614c('0x176')],_0x2e84c7[_0x614c('0x174')]):_0x2e84c7[_0x614c('0x176')]):utils[_0x614c('0x177')](_[_0x614c('0xf2')](_0x2e84c7[_0x614c('0x8c')])?_0x2e84c7[_0x614c('0x178')][_0x614c('0x173')]:_0x2e84c7[_0x614c('0x8c')][_0x614c('0x173')],_0x2e84c7['dialOriginateCallerIdName'],_0x2e84c7['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x614c('0x175')](_0x2e84c7['dialOriginateCallerIdNumber'],_0x2e84c7['dialRandomLastDigitCallerIdNumber']):_0x2e84c7[_0x614c('0x176')]);if(_0x195a6e){_0x9a9c6f[_0x614c('0x179')]=_0x3127de['actions'][_0x456fa4]['originatecalleridname']=utils[_0x614c('0x17a')](_0x195a6e);_0x9a9c6f[_0x614c('0x17b')]=_0x4f3a2f[_0x614c('0x17c')];}_0x2e84c7['variables']=_0x9a9c6f;return ami[_0x614c('0xa0')]({'actionid':_0x456fa4,'action':'originate','channel':_0x3127de[_0x614c('0x85')](_0x2e84c7['Trunk'])?util[_0x614c('0x47')](_0x614c('0x17d'),_0x2e84c7[_0x614c('0x178')][_0x614c('0x49')],isNotNull(_0x2e84c7[_0x614c('0x17e')])?_0x2e84c7[_0x614c('0x17e')][_0x614c('0x17f')]()||'':'',_0x2e84c7[_0x614c('0x180')]>0x0?_0x4f3a2f[_0x614c('0x17c')][_0x614c('0x181')](_0x2e84c7['dialCutDigit']):_0x4f3a2f[_0x614c('0x17c')]):util[_0x614c('0x47')]('SIP/%s/%s%s',_[_0x614c('0xf2')](_0x2e84c7[_0x614c('0x8c')])?_0x2e84c7[_0x614c('0x178')]['name']:_0x2e84c7['TrunkBackup']['name'],isNotNull(_0x2e84c7['dialPrefix'])?_0x2e84c7[_0x614c('0x17e')][_0x614c('0x17f')]()||'':'',_0x2e84c7['dialCutDigit']>0x0?_0x4f3a2f[_0x614c('0x17c')][_0x614c('0x181')](_0x2e84c7['dialCutDigit']):_0x4f3a2f[_0x614c('0x17c')]),'callerid':_0x195a6e,'Exten':_0x614c('0x109'),'Context':_0x614c('0x182'),'Priority':'1','variable':_0x9a9c6f,'timeout':(_0x2e84c7[_0x614c('0x183')]||0x1e)*0x3e8,'async':!![],'channelid':_0x456fa4})['then'](function(_0x5a10a3){return _0x582351(_0x5a10a3);})[_0x614c('0xa2')](function(_0x534151){_0x2e84c7[_0x614c('0x184')]+=0x1;var _0x3b4db7=new History(_0x3127de['actions'][_0x456fa4]);logger[_0x614c('0x66')](util['format'](_0x614c('0x185'),JSON[_0x614c('0x73')](_0x534151)));_0x3b4db7[_0x614c('0xcf')]=0xe;_0x3b4db7[_0x614c('0xd0')]=_0x614c('0x186');_0x3b4db7['starttime']=moment()[_0x614c('0x47')](_0x614c('0xc3'));_0x3b4db7[_0x614c('0x187')]=_0x3b4db7[_0x614c('0x6f')];hopperUtils['createHistory'](_0x3b4db7)['catch'](loggerCatch(_0x614c('0x188')));_0x3127de[_0x614c('0x12d')](_0x3b4db7)[_0x614c('0xa2')](loggerCatch(_0x614c('0x188')))[_0x614c('0x1d')](function(){delete _0x3127de['actions'][_0x456fa4];return _0xb0650e(msgResponse(_0x614c('0x157'),_0x614c('0xbd'),_0x614c('0x189')));});});});};Dialer['prototype'][_0x614c('0x18a')]=function(_0x4e62be,_0x4f612e,_0x2a4ebb){var _0x5b34a5=new History(_0x4f612e);if(_0x5b34a5[_0x614c('0x11b')]+_0x5b34a5[_0x614c('0x11c')]+_0x5b34a5['countnoanswerretry']+_0x5b34a5[_0x614c('0x11e')]+_0x5b34a5[_0x614c('0xd4')]+_0x5b34a5[_0x614c('0xe6')]+_0x5b34a5[_0x614c('0x117')]+_0x5b34a5['countagentrejectretry']>=_0x2a4ebb[_0x614c('0x120')]-0x1){return!![];}switch(_0x4e62be){case 0x3:if(_0x5b34a5[_0x614c('0x11d')]>=_0x2a4ebb[_0x614c('0x18b')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countnoanswerretry':_0x5b34a5['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x614c('0x125')](_0x2a4ebb[_0x614c('0x18c')],_0x614c('0xda'))['format'](_0x614c('0xc3')),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5[_0x614c('0xdb')],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5[_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x5b34a5[_0x614c('0x11b')]>=_0x2a4ebb[_0x614c('0x18d')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countbusyretry':_0x5b34a5[_0x614c('0x11b')]+=0x1,'scheduledat':moment()['add'](_0x2a4ebb[_0x614c('0x18e')],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5['ListId'],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5[_0x614c('0xdd')]||undefined})['catch'](loggerCatch(_0x614c('0x18f')));break;case 0x8:if(_0x5b34a5['countcongestionretry']>=_0x2a4ebb[_0x614c('0x190')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countcongestionretry':_0x5b34a5[_0x614c('0x11c')]+=0x1,'scheduledat':moment()[_0x614c('0x125')](_0x2a4ebb[_0x614c('0x191')],'minutes')[_0x614c('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5[_0x614c('0xdb')],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5[_0x614c('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x5b34a5[_0x614c('0x11e')]>=_0x2a4ebb[_0x614c('0x192')]-0x1){return!![];}else{hopperUtils[_0x614c('0xfb')]({'active':![],'countnosuchnumberretry':_0x5b34a5[_0x614c('0x11e')]+=0x1,'scheduledat':moment()[_0x614c('0x125')](_0x2a4ebb[_0x614c('0x193')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5[_0x614c('0xdb')],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x5b34a5['countdropretry']>=_0x2a4ebb[_0x614c('0xd9')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countdropretry':_0x5b34a5[_0x614c('0xd4')]+=0x1,'scheduledat':moment()['add'](_0x2a4ebb[_0x614c('0xd5')],'minutes')['format'](_0x614c('0xc3')),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5['ListId'],'VoiceQueueId':_0x5b34a5['VoiceQueueId']||undefined,'CampaignId':_0x5b34a5[_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x5b34a5[_0x614c('0xe6')]>=_0x2a4ebb[_0x614c('0xe8')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countabandonedretry':_0x5b34a5[_0x614c('0xe6')]+=0x1,'scheduledat':moment()[_0x614c('0x125')](_0x2a4ebb[_0x614c('0xea')],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0x5b34a5['ContactId'],'ListId':_0x5b34a5['ListId'],'VoiceQueueId':_0x5b34a5['VoiceQueueId']||undefined,'CampaignId':_0x5b34a5[_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0xec')));break;case 0x13:if(_0x5b34a5[_0x614c('0x117')]>=_0x2a4ebb['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countmachineretry':_0x5b34a5[_0x614c('0x117')]+=0x1,'scheduledat':moment()['add'](_0x2a4ebb[_0x614c('0x126')],_0x614c('0xda'))['format'](_0x614c('0xc3')),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5['ListId'],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0x127')));break;case 0x14:if(_0x5b34a5[_0x614c('0x11f')]>=_0x2a4ebb[_0x614c('0x194')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countagentrejectretry':_0x5b34a5['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x614c('0x125')](_0x2a4ebb[_0x614c('0x195')],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0x5b34a5['ContactId'],'ListId':_0x5b34a5['ListId'],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5['CampaignId']||undefined})['catch'](loggerCatch(_0x614c('0x196')));break;default:return!![];}};Dialer[_0x614c('0x1a')][_0x614c('0x105')]=function(_0x3dfd62,_0x5c8be2,_0x2fe290){var _0x48df80=this;var _0x590533=new History(_0x3dfd62);var _0x142ecb=![];var _0x569180;var _0x224859;return new Promise(function(_0x271b3c,_0x3d9543){if(_['isUndefined'](_0x5c8be2)&&typeof _0x5c8be2!==_0x614c('0x155')){return _0x3d9543(msgResponse(_0x614c('0x197'),_0x614c('0x93'),_0x614c('0x198')));}if(_['isUndefined'](_0x2fe290)&&typeof _0x2fe290!=='object'){return _0x3d9543(msgResponse(_0x614c('0x197'),'Failure',_0x614c('0x199')));}hopperUtils[_0x614c('0xd7')](_0x590533,_0x2fe290[_0x614c('0x19a')],_0x5c8be2)[_0x614c('0x3e')](function(_0x31f280){if(_0x31f280[_0x614c('0xd8')]==0x1)_0x142ecb=!![];switch(_0x2fe290[_0x614c('0x19a')]){case'0':_0x5c8be2[_0x614c('0x19b')]+=0x1;_0x590533[_0x614c('0xcf')]=0x0;_0x590533[_0x614c('0xd0')]=_0x614c('0x19c');_0x590533[_0x614c('0x11e')]+=0x1;_0x590533[_0x614c('0x118')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x614c('0x110')](_0x3dfd62,'nosuchnumber'));_0x569180=_0x5c8be2[_0x614c('0x193')];_0x224859=_0x5c8be2['callAdditionalPhoneAfterMin'];hopperUtils[_0x614c('0xc8')](_0x590533)[_0x614c('0xa2')](loggerCatch(_0x614c('0x11a')));if(_0x48df80[_0x614c('0x18a')](0x0,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533['countnosuchnumberretry']>=_0x5c8be2[_0x614c('0x192')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x19d'));}else{_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x19d'));}}break;case'3':_0x5c8be2[_0x614c('0x19e')]+=0x1;_0x590533[_0x614c('0xcf')]=0x3;_0x590533['statedesc']=_0x614c('0x19f');_0x590533[_0x614c('0x11d')]+=0x1;_0x590533[_0x614c('0x118')]+=0x1;var _0x2eb943=ut[_0x614c('0x1a0')](_0x3dfd62,_0x5c8be2);ami[_0x614c('0x41')](_0x614c('0x1a1'),_0x2eb943);_0x569180=_0x5c8be2[_0x614c('0x18c')];_0x224859=_0x5c8be2[_0x614c('0xd6')];hopperUtils[_0x614c('0xc8')](_0x590533)[_0x614c('0xa2')](loggerCatch(_0x614c('0x1a2')));if(_0x48df80[_0x614c('0x18a')](0x3,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533[_0x614c('0x11d')]>=_0x5c8be2[_0x614c('0x18b')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1a3'));}else{_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1a3'));}}break;case'5':_0x5c8be2[_0x614c('0x1a4')]+=0x1;_0x590533[_0x614c('0xcf')]=0x5;_0x590533[_0x614c('0xd0')]=_0x614c('0x1a5');_0x590533[_0x614c('0x11b')]+=0x1;_0x590533[_0x614c('0x118')]+=0x1;ami[_0x614c('0x41')](_0x614c('0x1a6'),ut[_0x614c('0x110')](_0x3dfd62,_0x614c('0x1a7')));_0x569180=_0x5c8be2['dialBusyRetryFrequency'];_0x224859=_0x5c8be2[_0x614c('0xd6')];hopperUtils[_0x614c('0xc8')](_0x590533)['catch'](loggerCatch(_0x614c('0x1a8')));if(_0x48df80[_0x614c('0x18a')](0x5,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533[_0x614c('0x11b')]>=_0x5c8be2[_0x614c('0x18d')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1a9'));}else{_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,'reason\x205\x20busy');}}break;case'8':_0x5c8be2['outboundCongestionCallsDay']+=0x1;_0x590533['state']=0x8;_0x590533['statedesc']=_0x614c('0x1aa');_0x590533['countcongestionretry']+=0x1;_0x590533['countglobal']+=0x1;_0x569180=_0x5c8be2[_0x614c('0x191')];_0x224859=_0x5c8be2[_0x614c('0xd6')];ami[_0x614c('0x41')](_0x614c('0x1ab'),ut['buildObj'](_0x3dfd62,'congestion'));hopperUtils[_0x614c('0xc8')](_0x590533)['catch'](loggerCatch(_0x614c('0x1ac')));if(_0x48df80[_0x614c('0x18a')](0x8,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533[_0x614c('0x11c')]>=_0x5c8be2[_0x614c('0x190')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1ad'));}else{_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1ad'));}}break;case'11':_0x5c8be2['outboundAbandonedCallsDay']+=0x1;_0x590533[_0x614c('0xcf')]=0xb;_0x590533[_0x614c('0xd0')]=_0x614c('0xe4');_0x590533[_0x614c('0xe6')]+=0x1;_0x590533['countglobal']+=0x1;_0x569180=_0x5c8be2[_0x614c('0xea')];_0x224859=_0x5c8be2[_0x614c('0xd6')];hopperUtils[_0x614c('0xc8')](_0x590533)[_0x614c('0xa2')](loggerCatch(_0x614c('0xed')));if(_0x48df80[_0x614c('0x18a')](0xb,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533['countabandonedretry']>=_0x5c8be2[_0x614c('0xe8')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1ae'));}else{_0x48df80['stateGlobal'](_0x590533,_0x271b3c,_0x3d9543,'reason\x2011\x20abandoned');}}break;case'20':_0x5c8be2[_0x614c('0x1af')]+=0x1;_0x590533[_0x614c('0xcf')]=0x14;_0x590533[_0x614c('0xd0')]=_0x614c('0x1b0');_0x590533[_0x614c('0x11f')]+=0x1;_0x590533[_0x614c('0x118')]+=0x1;_0x569180=_0x5c8be2[_0x614c('0x195')];_0x224859=_0x5c8be2[_0x614c('0xd6')];ami[_0x614c('0x41')](_0x614c('0x1b1'),ut[_0x614c('0x110')](_0x3dfd62,_0x614c('0x1b2')));hopperUtils[_0x614c('0xc8')](_0x590533)[_0x614c('0xa2')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x48df80['checkRetriveMax'](0x14,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533[_0x614c('0x11f')]>=_0x5c8be2[_0x614c('0x194')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,'reason\x2020\x20agentreject');}else{_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1b3'));}}break;default:_0x5c8be2[_0x614c('0x130')]+=0x1;_0x590533[_0x614c('0xcf')]=0xc;_0x590533['statedesc']=_0x2fe290[_0x614c('0x19a')];_0x569180=_0x5c8be2[_0x614c('0x195')];_0x224859=_0x5c8be2[_0x614c('0xd6')];hopperUtils['createHistory'](_0x590533)['catch'](loggerCatch(_0x614c('0x1b4')));if(_0x48df80[_0x614c('0x18a')](_0x2fe290[_0x614c('0x19a')],_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533[_0x614c('0x11b')]+_0x590533[_0x614c('0x11c')]+_0x590533[_0x614c('0x11d')]+_0x590533['countnosuchnumberretry']+_0x590533[_0x614c('0xd4')]+_0x590533[_0x614c('0xe6')]+_0x590533[_0x614c('0x117')]+_0x590533['countagentrejectretry']>=_0x5c8be2[_0x614c('0x120')]){_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,_0x2fe290[_0x614c('0x19a')]);}else{_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x2fe290[_0x614c('0x19a')]);}}}})[_0x614c('0x3e')](function(){if(_0x142ecb){hopperUtils[_0x614c('0xe1')](_0x590533,_0x569180,_0x224859)[_0x614c('0x3e')](function(){return _0x271b3c(0x1);});}});});};Dialer['prototype'][_0x614c('0x121')]=function(_0x184665,_0x48c4e8,_0x494157,_0x4708b8){var _0x59551f=new Final(_0x184665);_0x59551f[_0x614c('0xcf')]=0xf;_0x59551f[_0x614c('0xd0')]=_0x614c('0x1b5');this[_0x614c('0x129')](_0x59551f,_0x48c4e8,_0x494157,_0x4708b8);};Dialer[_0x614c('0x1a')][_0x614c('0x129')]=function(_0x1a53f8,_0x2973f6,_0x4327ca,_0x3eb343){hopperUtils[_0x614c('0x12d')](_0x1a53f8)[_0x614c('0x3e')](function(){return _0x2973f6(msgResponse(_0x614c('0x197'),'Success',_0x3eb343));})[_0x614c('0xa2')](function(){return _0x4327ca(msgResponse(_0x614c('0x1b6'),'Failure',_0x614c('0x1b7')));});};Dialer[_0x614c('0x1a')][_0x614c('0xb5')]=function(_0x15bd7b){var _0x2d508e=_0x15bd7b[_0x614c('0x1b8')]/0x64;var _0x710213=_0x15bd7b[_0x614c('0x1b9')]/(_0x15bd7b[_0x614c('0x1b9')]+_0x15bd7b[_0x614c('0xc4')]);var _0x369fa1=Math[_0x614c('0x1ba')](_0x15bd7b[_0x614c('0x1bb')]*(_0x15bd7b[_0x614c('0x1bc')]/0x64));var _0x4fda7e=Math[_0x614c('0x1ba')](_0x15bd7b['predictiveIntervalAvailable']*(_0x15bd7b['predictiveIntervalMinThreshold']/0x64));var _0x6e6051=_0x15bd7b[_0x614c('0x1bd')]+_0x15bd7b['talking'];var _0x167bfb=Math['floor'](_0x15bd7b['erlangCalls']*_0x15bd7b[_0x614c('0x5d')]*_0x15bd7b['predictiveIntervalHitRate']*_0x15bd7b[_0x614c('0x1be')]);if(_['isUndefined'](_0x15bd7b['startProgressive'])){if(!_['isUndefined'](_0x15bd7b[_0x614c('0x62')])){_0x15bd7b[_0x614c('0x62')]=undefined;loggerPredictive[_0x614c('0x66')]('[startMethodPredictive][StartProgressive]',_0x614c('0x1bf'));}if(!_[_0x614c('0x40')](_0x15bd7b[_0x614c('0x64')])){loggerPredictive[_0x614c('0x66')]('[startMethodPredictive][StartProgressive]',_0x614c('0x1c0'));clearInterval(_0x15bd7b[_0x614c('0x64')]);_0x15bd7b['handlePredictive']=undefined;}_0x15bd7b[_0x614c('0x28')]=moment()['format'](_0x614c('0xc3'));loggerPredictive[_0x614c('0x4c')](_0x15bd7b[_0x614c('0x49')],'collection\x20data\x20in\x20progressive\x20at',_0x15bd7b['startProgressive']);this[_0x614c('0xb2')](_0x15bd7b,0x1);}else if(ifInterval(_0x15bd7b[_0x614c('0x1c1')],_0x15bd7b[_0x614c('0x28')])){this[_0x614c('0xb2')](_0x15bd7b,0x1);loggerPredictiveCalls[_0x614c('0x4c')](_0x614c('0x1c2'),_0x15bd7b[_0x614c('0x28')],_0x15bd7b['name']);_0x15bd7b[_0x614c('0x5a')]=0x0;_0x15bd7b[_0x614c('0x1c3')]=0x0;}else if(_0x2d508e<_0x710213&&_0x15bd7b['dialPredictiveOptimization']===_0x614c('0x1c4')){clearPredictiveAttributes(_0x15bd7b);loggerPredictive[_0x614c('0x4c')](_0x614c('0x1c5'),_0x614c('0x1c6'),_0x710213,_0x614c('0x28'),_0x15bd7b['name']);}else if(_0x167bfb<_0x15bd7b[_0x614c('0x1c3')]&&_0x15bd7b[_0x614c('0x1c7')]==='dropRate'){clearPredictiveAttributes(_0x15bd7b);loggerPredictive[_0x614c('0x4c')](_0x614c('0x1c8'),_0x614c('0x1c9'),_0x167bfb,_0x614c('0x1ca'),_0x15bd7b[_0x614c('0x1c3')],'startProgressive',_0x15bd7b[_0x614c('0x49')]);}else if(!ifInterval(_0x15bd7b['dialPredictiveInterval'],_0x15bd7b[_0x614c('0x28')])&&_[_0x614c('0x40')](_0x15bd7b[_0x614c('0x62')])&&!_[_0x614c('0x40')](_0x15bd7b[_0x614c('0x28')])){_0x15bd7b['startPredictive']=moment()[_0x614c('0x47')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x614c('0x4c')](_0x15bd7b[_0x614c('0x49')],'started\x20in\x20predictive\x20at',_0x15bd7b['startPredictive']);hopperUtils[_0x614c('0x1cb')](_0x15bd7b[_0x614c('0x1c1')])[_0x614c('0x3e')](this['getDataPredictive'](_0x15bd7b))['then'](mergeDataErlangB(_0x15bd7b))[_0x614c('0x3e')](this[_0x614c('0x1cc')](_0x15bd7b))[_0x614c('0xa2')](loggerCatchPredictive(_0x614c('0x1cd'),_0x15bd7b));}else if(!ifInterval(_0x15bd7b[_0x614c('0x1c1')],_0x15bd7b[_0x614c('0x62')])){_0x15bd7b[_0x614c('0x1c3')]=0x0;_0x15bd7b[_0x614c('0x62')]=moment()['format'](_0x614c('0xc3'));loggerPredictive[_0x614c('0x4c')](_0x15bd7b[_0x614c('0x49')],_0x614c('0x1ce'),_0x15bd7b[_0x614c('0x62')]);clearInterval(_0x15bd7b['handlePredictive']);_0x15bd7b[_0x614c('0x64')]=undefined;hopperUtils[_0x614c('0x1cb')](_0x15bd7b['dialPredictiveInterval'])[_0x614c('0x3e')](this[_0x614c('0x1cf')](_0x15bd7b))['then'](mergeDataErlangB(_0x15bd7b))[_0x614c('0x3e')](this[_0x614c('0x1cc')](_0x15bd7b))[_0x614c('0xa2')](loggerCatchPredictive(_0x614c('0x1d0'),_0x15bd7b));}else if(_0x15bd7b['predictiveIntervalAvailable']&&_0x6e6051<_0x15bd7b[_0x614c('0x1bb')]-_0x4fda7e){clearPredictiveAttributes(_0x15bd7b);loggerPredictive['info'](_0x15bd7b[_0x614c('0x49')],_0x614c('0x1d1'),_0x6e6051,')\x20are\x20less\x20than\x20threshold\x20(',_0x15bd7b['predictiveIntervalAvailable'],'-',_0x4fda7e,'=',_0x15bd7b[_0x614c('0x1bb')]-_0x4fda7e,')');}else if(_0x15bd7b[_0x614c('0x1bb')]&&_0x6e6051>_0x15bd7b[_0x614c('0x1bb')]+_0x369fa1){clearPredictiveAttributes(_0x15bd7b);loggerPredictive[_0x614c('0x4c')](_0x15bd7b[_0x614c('0x49')],_0x614c('0x1d1'),_0x6e6051,_0x614c('0x1d2'),_0x15bd7b[_0x614c('0x1bb')],'+',_0x369fa1,'=',_0x15bd7b['predictiveIntervalAvailable']+_0x369fa1,')');}};Dialer[_0x614c('0x1a')][_0x614c('0x1cf')]=function(_0x260907){var _0x35caf9=this;return function(_0x5d343b){return new Promise(function(_0x4ffa38,_0x4c0d00){_['merge'](_0x260907,_0x5d343b[0x0]);if(checkGetDataPredictive(_0x5d343b[0x0])){var _0x5f4236=_0x260907[_0x614c('0x1bb')]=_0x260907['talking']+_0x260907[_0x614c('0x1bd')];var _0x7a8d42=_0x260907[_0x614c('0x1c1')]*0x3c;var _0x58e2ab=_0x5d343b[0x0]['predictiveIntervalAvgTalktime']+_0x5d343b[0x0][_0x614c('0x58')];var _0x2017f2=(_0x5d343b[0x0][_0x614c('0x51')]+_0x5d343b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5d343b[0x0][_0x614c('0xe2')])/_0x5d343b[0x0]['predictiveIntervalTotalCalls'];_0x260907[_0x614c('0x1d3')]=_0x2017f2>0x0?_0x2017f2:0x1;switch(_0x260907['dialPredictiveOptimization']){case _0x614c('0x1c4'):var _0x190c89=_0x260907['dialPredictiveOptimizationPercentage']/0x64;return _0x35caf9[_0x614c('0x1d4')](_0x5f4236,_0x7a8d42,_0x58e2ab,_0x2017f2,_0x190c89)[_0x614c('0x3e')](function(_0x536674){return _0x4ffa38(_0x536674);});case'agentBusyFactor':var _0x1adb0f=_0x260907[_0x614c('0x1b8')]/0x64;return _0x35caf9[_0x614c('0x1d5')](_0x5f4236,_0x7a8d42,_0x58e2ab,_0x2017f2,_0x1adb0f)[_0x614c('0x3e')](function(_0x440dc1){return _0x4ffa38(_0x440dc1);});default:return _0x4c0d00(msgResponse(_0x614c('0x1d6'),_0x614c('0x93'),_0x614c('0x1d7')));}}else{return _0x4c0d00(msgResponse(_0x614c('0x1d6'),_0x614c('0x93'),_0x614c('0x1d8')));}});};};Dialer[_0x614c('0x1a')]['getDataPredictiveOld']=function(_0x1bfa0b){var _0x44e3c0=this;return function(_0x2de070){return new Promise(function(_0xff64ff,_0x5a96c2){_['merge'](_0x1bfa0b,_0x2de070[0x0]);if(checkGetDataPredictive(_0x2de070[0x0])){loggerPredictive[_0x614c('0x4c')](JSON[_0x614c('0x73')](_0x2de070[0x0]));if(_0x1bfa0b[_0x614c('0x1c7')]===_0x614c('0x1c4')){return _0x44e3c0[_0x614c('0x1d9')](_0x1bfa0b['id'])['then'](function(_0x13f654){var _0x2b549f=_0x1bfa0b[_0x614c('0x1da')]-_0x13f654[0x0]['outboundQueuePauses'];var _0x126e3c=_0x1bfa0b[_0x614c('0x1c1')]*0x3c;var _0x5b5aa1=_0x2de070[0x0][_0x614c('0x56')]+_0x2de070[0x0][_0x614c('0x58')];var _0x44422d=(_0x2de070[0x0][_0x614c('0x51')]+_0x2de070[0x0][_0x614c('0x53')]+_0x2de070[0x0][_0x614c('0xe2')])/_0x2de070[0x0][_0x614c('0x4f')];var _0x25e5ed=_0x1bfa0b[_0x614c('0x1b8')]/0x64;_0x1bfa0b[_0x614c('0x1db')]=_0x13f654[0x0]['outboundQueuePauses']||0x0;_0x1bfa0b['predictiveIntervalHitRate']=_0x44422d>0x0?_0x44422d:0x1;return _0x44e3c0['abandonmentRate'](_0x2b549f,_0x126e3c,_0x5b5aa1,_0x44422d,_0x25e5ed);})['then'](function(_0xdd19ea){return _0xff64ff(_0xdd19ea);})['catch'](function(_0x4e0607){return _0x5a96c2(msgResponse(_0x614c('0x1dc'),_0x614c('0x93'),JSON[_0x614c('0x73')](_0x4e0607)));});}if(_0x1bfa0b[_0x614c('0x1c7')]===_0x614c('0x1dd')){return _0x44e3c0[_0x614c('0x1d9')](_0x1bfa0b['id'])[_0x614c('0x3e')](function(_0x21b920){var _0xb6f7d9=_0x1bfa0b[_0x614c('0x1da')]-_0x21b920[0x0][_0x614c('0x1de')];var _0x4f9d0c=_0x1bfa0b[_0x614c('0x1c1')]*0x3c;var _0x53693a=_0x2de070[0x0][_0x614c('0x56')]+_0x2de070[0x0][_0x614c('0x58')];var _0x426d67=(_0x2de070[0x0][_0x614c('0x51')]+_0x2de070[0x0][_0x614c('0x53')]+_0x2de070[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2de070[0x0][_0x614c('0x4f')];var _0x59ec4b=_0x1bfa0b[_0x614c('0x1b8')]/0x64;_0x1bfa0b[_0x614c('0x1db')]=_0x21b920[0x0][_0x614c('0x1de')]||0x0;_0x1bfa0b[_0x614c('0x1d3')]=_0x426d67>0x0?_0x426d67:0x1;return _0x44e3c0['busyFactor'](_0xb6f7d9,_0x4f9d0c,_0x53693a,_0x426d67,_0x59ec4b);})['then'](function(_0x2a96b2){return _0xff64ff(_0x2a96b2);})['catch'](function(_0xe1043d){return _0x5a96c2(msgResponse(_0x614c('0x1dc'),_0x614c('0x93'),JSON[_0x614c('0x73')](_0xe1043d)));});}}else{return _0x5a96c2(msgResponse(_0x614c('0x1d6'),_0x614c('0x93'),_0x614c('0x1d8')));}});};};Dialer[_0x614c('0x1a')][_0x614c('0x1cc')]=function(_0x37c364){var _0x4c61ed=this;return function(){var _0x1ff94b=0x0;var _0xd78f5e=Math[_0x614c('0x1df')](_0x37c364['erlangCallToSecond']*0x3e8);if(_0xd78f5e>0x0){_0xd78f5e=_0xd78f5e<0x64?0x64:_0xd78f5e;loggerPredictive[_0x614c('0x4c')](_0x37c364[_0x614c('0x49')],_0x614c('0x1e0'),_0xd78f5e,_0x614c('0x1e1'));_0x37c364[_0x614c('0x64')]=setInterval(function(){_0x4c61ed['handlePredictive'](_0x37c364);loggerPredictiveCalls['info']('[handlePredictive]',_0x1ff94b+=0x1);},_0xd78f5e);}else{loggerPredictive[_0x614c('0x4c')](_0x37c364['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x614c('0x1a')][_0x614c('0x1e2')]=function(_0x405ebe,_0x4b7c8c){var _0x31ad35=this;return function(_0xd169e7){if(_[_0x614c('0x4b')](_0xd169e7)){if(_[_0x614c('0xf2')](_0x4b7c8c[_0x614c('0x150')])||!_0x4b7c8c[_0x614c('0x1e3')]){if(_0x405ebe[_0x614c('0xb0')]===_0x614c('0xb')){_0x405ebe['queueStatusComplete']=_[_0x614c('0x40')](_0x405ebe['queueStatusComplete'])?!![]:_0x405ebe[_0x614c('0x70')];var _0x1040d9=uuid['v4']();_0x31ad35[_0x614c('0x25')][_0x1040d9]=new Action(_0x405ebe,_0x4b7c8c,_0x1040d9);loggerBooked[_0x614c('0x4c')]('[booked][checkContactBlack]',_0x1040d9,'queueStatusComplete:\x20',JSON[_0x614c('0x73')](_0x405ebe['queueStatusComplete']),_0x614c('0x1e4'),_0x405ebe[_0x614c('0x49')]);if(_0x405ebe[_0x614c('0x70')]){_0x405ebe['queueStatusComplete']=![];_0x31ad35[_0x614c('0x29')][_0x31ad35[_0x614c('0x25')][_0x1040d9]['queue']]=[];ami[_0x614c('0xa0')]({'actionid':_0x1040d9,'action':'queuestatus','queue':_0x405ebe[_0x614c('0x49')]})[_0x614c('0xa2')](function(){_0x31ad35[_0x614c('0xc2')](_0x405ebe);hopperUtils[_0x614c('0xfb')]({'active':![],'ContactId':_0x31ad35[_0x614c('0x25')][_0x1040d9]['ContactId'],'ListId':_0x31ad35[_0x614c('0x25')][_0x1040d9]['ListId'],'VoiceQueueId':_0x31ad35[_0x614c('0x25')][_0x1040d9]['VoiceQueueId']||undefined,'CampaignId':_0x31ad35[_0x614c('0x25')][_0x1040d9][_0x614c('0xdd')]||undefined})['catch'](loggerCatch(_0x614c('0x1e5')));delete _0x31ad35['actions'][_0x1040d9];});}else{loggerBooked['info'](_0x614c('0x1e6'),JSON[_0x614c('0x73')](_0x405ebe[_0x614c('0x70')]),_0x614c('0x1e4'),_0x405ebe['name']);_0x31ad35['updateOriginated'](_0x405ebe);hopperUtils[_0x614c('0xfb')]({'active':![],'ContactId':_0x31ad35[_0x614c('0x25')][_0x1040d9][_0x614c('0xeb')],'ListId':_0x31ad35[_0x614c('0x25')][_0x1040d9][_0x614c('0xdb')],'VoiceQueueId':_0x31ad35['actions'][_0x1040d9]['VoiceQueueId']||undefined,'CampaignId':_0x31ad35['actions'][_0x1040d9]['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0x1e5')));delete _0x31ad35[_0x614c('0x25')][_0x1040d9];}}else{return _0x31ad35[_0x614c('0x154')](_0x405ebe,_0x4b7c8c);}}else{if(utils[_0x614c('0xcc')](undefined,_0x4b7c8c['scheduledat'])<_0x405ebe[_0x614c('0x1e7')]*0x3c){if(_0x4b7c8c['Agent']&&!_0x4b7c8c[_0x614c('0x143')][_0x614c('0x1e8')]){_0x31ad35[_0x614c('0x1f')]['run'](_0x4b7c8c['id'])['finally'](function(){_0x31ad35[_0x614c('0xc2')](_0x405ebe);});}else{hopperUtils['unlockContact']({'active':![]},_0x4b7c8c['id'],0x1)['finally'](function(){_0x31ad35[_0x614c('0xc2')](_0x405ebe);});}}else{_0x405ebe['outboundReCallsDay']+=0x1;_0x31ad35[_0x614c('0xc2')](_0x405ebe);if(_0x405ebe[_0x614c('0x1e9')]){hopperUtils[_0x614c('0xfb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4b7c8c[_0x614c('0xeb')],'ListId':_0x4b7c8c['ListId'],'VoiceQueueId':_0x4b7c8c['VoiceQueueId']||undefined,'CampaignId':_0x4b7c8c[_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0x1ea')));hopperUtils[_0x614c('0xc8')](createObjHistory(_0x405ebe,_0x4b7c8c,utils['CAMPAIGN_STATUS'][_0x614c('0x1eb')],0x17,_0x614c('0x1ec')))[_0x614c('0xa2')](loggerCatch(_0x614c('0x1ed')));}else{_0x31ad35[_0x614c('0x112')](createObjHistory(_0x405ebe,_0x4b7c8c,utils[_0x614c('0x69')][_0x614c('0x1ee')],0x16,_0x614c('0x1ef')),_0x614c('0x1f0'),_0x614c('0x1f1'));}}}}else{_0x405ebe[_0x614c('0x1f2')]+=0x1;_0x31ad35['saveInDb'](createObjHistory(_0x405ebe,_0x4b7c8c,utils[_0x614c('0x69')][_0x614c('0x1f3')],0xd,'Blacklist'),'[Originate][historyBlacklist]',_0x614c('0x1f4'));throw _0x614c('0x1f5');}};};Dialer[_0x614c('0x1a')][_0x614c('0x1f6')]=function(_0x33bf64){var _0x33db0e=this;var _0x5aa3d0=_0x33bf64[_0x614c('0x1f7')]-_0x33bf64[_0x614c('0x80')];emitCampaignSummary(_0x33bf64);if(_0x5aa3d0>0x0&&_0x33bf64[_0x614c('0x1f8')]==0x0){if(_0x5aa3d0>this[_0x614c('0x23')]){_0x5aa3d0=this[_0x614c('0x23')];}_0x33bf64[_0x614c('0x1f8')]=0x1;hopperUtils[_0x614c('0x1f9')](_0x33bf64,_0x5aa3d0)[_0x614c('0x3e')](function(_0x1a7a14){_0x33bf64[_0x614c('0x1f8')]=0x0;if(_0x1a7a14){if(!utils[_0x614c('0x1fa')](_0x1a7a14)){_0x33bf64[_0x614c('0x6e')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x614c('0x4c')]('[getContactCampaign2][Empty]'+_0x33bf64[_0x614c('0x49')]);}else{_0x33bf64[_0x614c('0x80')]+=_0x1a7a14[_0x614c('0x9a')];_0x33bf64['message']=utils[_0x614c('0x69')]['RUNNING'];for(var _0x327c37=0x0;_0x327c37<_0x1a7a14[_0x614c('0x9a')];_0x327c37+=0x1){_0x33bf64[_0x614c('0x1fb')]+=0x1;if(_[_0x614c('0xf2')](_0x1a7a14[_0x327c37])||_[_0x614c('0xf2')](_0x1a7a14[_0x327c37][_0x614c('0x1fc')])||_[_0x614c('0xf2')](_0x1a7a14[_0x327c37][_0x614c('0x17c')])){_0x33db0e[_0x614c('0x14e')](_0x614c('0x1fd'),_0x33bf64,_0x1a7a14[_0x327c37]);}else{hopperUtils[_0x614c('0x1fe')](_[_0x614c('0x74')](_0x1a7a14[_0x327c37],[_0x614c('0xdd'),_0x614c('0x17c')]))[_0x614c('0x3e')](_0x33db0e[_0x614c('0x1e2')](_0x33bf64,_0x1a7a14[_0x327c37]))[_0x614c('0xa2')](_0x33db0e['loggerHandler'](_0x614c('0x1ff'),_0x33bf64));}}}}})[_0x614c('0xa2')](loggerGetContactDialer('[getContactCampaign2]',_0x33bf64,_0x5aa3d0));}};Dialer['prototype'][_0x614c('0xb2')]=function(_0x1e778a,_0x5abedc){var _0x4504ca=this;var _0x44bcf0=[];if(_0x5abedc<0x1||_0x1e778a[_0x614c('0xb0')]===_0x614c('0xb')){_0x5abedc=0x1;}var _0x2b2c6d=Math[_0x614c('0x1df')](_0x1e778a['available']*_0x5abedc)-_0x1e778a['originated'];if(_0x1e778a[_0x614c('0x200')]>0x0){var _0x16f403=_0x1e778a[_0x614c('0x200')]-_0x1e778a[_0x614c('0x80')]-_0x1e778a[_0x614c('0x139')]-_0x1e778a[_0x614c('0x201')];if(_0x2b2c6d>_0x16f403){_0x2b2c6d=_0x16f403;}}if(_0x2b2c6d>0x0&&_0x1e778a[_0x614c('0x1f8')]==0x0){if(_0x1e778a[_0x614c('0xb0')]===_0x614c('0xb')){_0x2b2c6d=0x1;}if(_0x2b2c6d>this[_0x614c('0x23')]){_0x2b2c6d=this['maxNumberOriginate'];}for(var _0x79fee3 in this[_0x614c('0x22')]){if(typeof this[_0x614c('0x22')][_0x79fee3]!==_0x614c('0xab')){if(this[_0x614c('0x22')][_0x79fee3]['state']==='not_inuse'&&this['agents'][_0x79fee3][_0x614c('0x87')]===_0x614c('0x88')){_0x44bcf0[_0x614c('0x9b')](this[_0x614c('0x22')][_0x79fee3]['id']);}}}_0x1e778a[_0x614c('0x1f8')]=0x1;hopperUtils['getContactDialer'](_0x1e778a,_0x44bcf0,_0x2b2c6d)['then'](function(_0x18af7a){_0x1e778a[_0x614c('0x1f8')]=0x0;if(_0x18af7a){if(!utils[_0x614c('0x1fa')](_0x18af7a)){hopperUtils[_0x614c('0x202')](_0x1e778a)['then'](sendMessageReschedule(_0x1e778a))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x1e778a[_0x614c('0x80')]+=_0x18af7a['length'];_0x1e778a[_0x614c('0x6e')]=_0x1e778a['dialMethod']===_0x614c('0xb')?utils[_0x614c('0x69')][_0x614c('0x15e')]:utils[_0x614c('0x69')][_0x614c('0x203')];for(var _0x15644b=0x0;_0x15644b<_0x18af7a[_0x614c('0x9a')];_0x15644b+=0x1){if(_[_0x614c('0xf2')](_0x18af7a[_0x15644b])||_[_0x614c('0xf2')](_0x18af7a[_0x15644b][_0x614c('0x1fc')])||_[_0x614c('0xf2')](_0x18af7a[_0x15644b][_0x614c('0x17c')])){_0x4504ca[_0x614c('0x14e')](_0x614c('0x1fd'),_0x1e778a,_0x18af7a[_0x15644b]);}else{hopperUtils[_0x614c('0x204')](_[_0x614c('0x74')](_0x18af7a[_0x15644b],[_0x614c('0xdc'),_0x614c('0x17c')]))[_0x614c('0x3e')](_0x4504ca[_0x614c('0x1e2')](_0x1e778a,_0x18af7a[_0x15644b]))[_0x614c('0xa2')](_0x4504ca[_0x614c('0x14d')](_0x614c('0x1fd'),_0x1e778a));}}}}})['catch'](loggerGetContactDialer(_0x614c('0x205'),_0x1e778a,_0x2b2c6d));}};Dialer[_0x614c('0x1a')][_0x614c('0x64')]=function(_0x8a0689){if(_0x8a0689[_0x614c('0x200')]>0x0){var _0x330700=_0x8a0689[_0x614c('0x200')]-_0x8a0689[_0x614c('0x80')]-_0x8a0689[_0x614c('0x139')];if(_0x330700>0x0&&_0x8a0689[_0x614c('0x1f8')]==0x0){this[_0x614c('0x206')](_0x8a0689);}else{loggerPredictiveCalls['info'](_0x614c('0x207'));}}else{this[_0x614c('0x206')](_0x8a0689);}};Dialer['prototype'][_0x614c('0x206')]=function(_0x3faad0){var _0x2c50da=this;var _0x9b273f=[];_0x3faad0[_0x614c('0x80')]+=0x1;for(var _0x27f297 in this['agents']){if(typeof this[_0x614c('0x22')][_0x27f297]!==_0x614c('0xab')){if(this['agents'][_0x27f297][_0x614c('0xcf')]===_0x614c('0x208')&&this['agents'][_0x27f297][_0x614c('0x87')]===_0x614c('0x88')){_0x9b273f[_0x614c('0x9b')](this[_0x614c('0x22')][_0x27f297]['id']);}}}_0x3faad0[_0x614c('0x1f8')]=0x1;return this[_0x614c('0x209')](_0x3faad0['id'],_0x9b273f,0x1,_0x3faad0['dialOrderByScheduledAt'],_0x3faad0)['then'](function(_0x397e67){_0x3faad0['temp']=0x1;if(_0x397e67){if(!utils[_0x614c('0x1fa')](_0x397e67)){utils[_0x614c('0x68')](_0x3faad0,0x1,0x0);return hopperUtils['countReScheduled'](_0x3faad0)[_0x614c('0x3e')](sendMessageReschedule(_0x3faad0))[_0x614c('0xa2')](loggerCatch(_0x614c('0x20a')));}else{_0x3faad0[_0x614c('0x6e')]=utils[_0x614c('0x69')][_0x614c('0x203')];if(_[_0x614c('0xf2')](_0x397e67[0x0])||_['isNil'](_0x397e67[0x0][_0x614c('0x1fc')])||_[_0x614c('0xf2')](_0x397e67[0x0]['phone'])){_0x2c50da[_0x614c('0x14e')]('[actionOriginate]\x20',_0x3faad0,_0x397e67[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x614c('0x74')](_0x397e67[0x0],[_0x614c('0xdc'),_0x614c('0x17c')]))[_0x614c('0x3e')](_0x2c50da['checkContactBlack'](_0x3faad0,_0x397e67[0x0]))['catch'](_0x2c50da[_0x614c('0x14d')](_0x614c('0x20b'),_0x3faad0));}}}})[_0x614c('0xa2')](loggerGetContactDialer(_0x614c('0x20c'),_0x3faad0,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x2fbeca,_0x7ff7ac,_0x404142,_0x49e6b3,_0x5b4324,_0x41c18c){loggerPredictive[_0x614c('0x4c')](_0x614c('0x20d'));loggerPredictive[_0x614c('0x4c')](_0x614c('0x20e'),_0x2fbeca);loggerPredictive[_0x614c('0x4c')](_0x614c('0x20f'),_0x7ff7ac);loggerPredictive[_0x614c('0x4c')](_0x614c('0x210'),_0x404142);loggerPredictive[_0x614c('0x4c')](_0x614c('0x211'),_0x49e6b3);loggerPredictive[_0x614c('0x4c')](_0x614c('0x212'),_0x5b4324);loggerPredictive['info']('---------------------------');return new Promise(function(_0x1ccd1e,_0x2796b4){if(_0x2fbeca<=0x0||isNaN(_0x2fbeca)){return _0x2796b4(msgResponse(_0x614c('0x213'),'Error',_0x614c('0x214')+_0x2fbeca));}if(_0x404142<=0x0||isNaN(_0x404142)){return _0x2796b4(msgResponse(_0x614c('0x213'),_0x614c('0xbd'),'Ts\x20=\x20'+_0x404142));}if(_0x49e6b3<=0x0||isNaN(_0x49e6b3)){return _0x2796b4(msgResponse(_0x614c('0x213'),_0x614c('0xbd'),_0x614c('0x215')+_0x49e6b3));}if(_0x7ff7ac<=0x0||isNaN(_0x7ff7ac)){return _0x2796b4(msgResponse(_0x614c('0x213'),_0x614c('0xbd'),'interval\x20=\x20'+_0x7ff7ac));}if(_0x5b4324<=0x0||isNaN(_0x5b4324)){return _0x2796b4(msgResponse(_0x614c('0x213'),_0x614c('0xbd'),_0x614c('0x216')+_0x5b4324));}_0x41c18c=_0x41c18c||0x0;var _0x4b6032=0x1/_0x404142;var _0x2f79f1=0x0;var _0x32c816=0x0;var _0x4f941a=0x0;var _0x25dc73=0x0;for(var _0x14772b=0x0;_0x4f941a<_0x5b4324;_0x14772b+=0x1){_0x32c816=_0x14772b/_0x7ff7ac;_0x2f79f1=(_0x49e6b3*_0x32c816+_0x41c18c)/_0x4b6032;_0x4f941a=utils[_0x614c('0x217')](_0x2f79f1,_0x2fbeca);_0x25dc73=_0x2f79f1/_0x2fbeca*(0x1-utils[_0x614c('0x217')](_0x2f79f1,_0x2fbeca));}return _0x1ccd1e({'erlangCalls':_0x14772b,'erlangCallToSecond':_0x7ff7ac/_0x14772b,'erlangAbandonmentRate':_0x4f941a,'erlangBusyFactor':_0x25dc73});});};Dialer[_0x614c('0x1a')][_0x614c('0x1d5')]=function(_0x58b63e,_0x2c5195,_0x5646ec,_0x3878dc,_0x233a5e,_0x47539e){loggerPredictive[_0x614c('0x4c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x614c('0x20e'),_0x58b63e);loggerPredictive['info'](_0x614c('0x20f'),_0x2c5195);loggerPredictive[_0x614c('0x4c')](_0x614c('0x210'),_0x5646ec);loggerPredictive[_0x614c('0x4c')](_0x614c('0x211'),_0x3878dc);loggerPredictive['info'](_0x614c('0x218'),_0x233a5e);loggerPredictive[_0x614c('0x4c')](_0x614c('0x60'));return new Promise(function(_0x5918d1,_0x3d9ee2){if(_0x58b63e<=0x0||isNaN(_0x58b63e)){return _0x3d9ee2(msgResponse(_0x614c('0x219'),_0x614c('0xbd'),'m\x20=\x20'+_0x58b63e));}if(_0x5646ec<=0x0||isNaN(_0x5646ec)){return _0x3d9ee2(msgResponse(_0x614c('0x219'),_0x614c('0xbd'),'Ts\x20=\x20'+_0x5646ec));}if(_0x3878dc<=0x0||isNaN(_0x3878dc)){return _0x3d9ee2(msgResponse(_0x614c('0x219'),_0x614c('0xbd'),'p\x20=\x20'+_0x3878dc));}if(_0x2c5195<=0x0||isNaN(_0x2c5195)){return _0x3d9ee2(msgResponse(_0x614c('0x219'),'Error',_0x614c('0x21a')+_0x2c5195));}if(_0x233a5e<=0x0||isNaN(_0x233a5e)){return _0x3d9ee2(msgResponse(_0x614c('0x219'),_0x614c('0xbd'),_0x614c('0x21b')+_0x233a5e));}_0x47539e=_0x47539e||0x0;var _0x4bc066=0x1/_0x5646ec;var _0x42211d=0x0;var _0x58216d=0x0;var _0x46fdaf=0x0;var _0x4111a5=0x0;for(var _0x18b761=0x0;_0x4111a5<_0x233a5e;_0x18b761+=0x1){_0x58216d=_0x18b761/_0x2c5195;_0x42211d=(_0x3878dc*_0x58216d+_0x47539e)/_0x4bc066;_0x46fdaf=utils[_0x614c('0x217')](_0x42211d,_0x58b63e);_0x4111a5=_0x42211d/_0x58b63e*(0x1-utils['erlangb'](_0x42211d,_0x58b63e));}return _0x5918d1({'erlangCalls':_0x18b761,'erlangCallToSecond':_0x2c5195/_0x18b761,'erlangAbandonmentRate':_0x46fdaf,'erlangBusyFactor':_0x4111a5});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index e7f0aa2..24fe188 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1ef=['string','voiceQueue','uniqueid','name','phone','firstName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','ContactFirstName','Contact','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','queue','lodash','moment','isNil'];(function(_0x190afd,_0x1cded2){var _0x553569=function(_0x558188){while(--_0x558188){_0x190afd['push'](_0x190afd['shift']());}};_0x553569(++_0x1cded2);}(_0xf1ef,0x1cb));var _0xff1e=function(_0x27806b,_0x594fdf){_0x27806b=_0x27806b-0x0;var _0x2b48cd=_0xf1ef[_0x27806b];return _0x2b48cd;};'use strict';var util=require('util');var _=require(_0xff1e('0x0'));var moment=require(_0xff1e('0x1'));function checkNameSurname(_0x7e5ef6,_0x3c62e5,_0x1e4a12){var _0x23ab11='';if(!_[_0xff1e('0x2')](_0x3c62e5)&&_0xff1e('0x3')===typeof _0x3c62e5){_0x23ab11+=_0x3c62e5;}if(!_[_0xff1e('0x2')](_0x1e4a12)&&'string'===typeof _0x1e4a12){_0x23ab11+='\x20'+_0x1e4a12;}if(_0x23ab11!==''){return _0x23ab11;}return _0x7e5ef6;}function Action(_0x5a2241,_0x1fbdfe,_0x398ea2){this[_0xff1e('0x4')]=_0x5a2241;this[_0xff1e('0x5')]=_0x398ea2||undefined;this[_0xff1e('0x6')]=checkNameSurname(_0x1fbdfe['Contact'][_0xff1e('0x7')],_0x1fbdfe['Contact'][_0xff1e('0x8')],_0x1fbdfe['Contact']['lastName']);this['number']=_0x1fbdfe[_0xff1e('0x7')];this['queue']=_0x5a2241[_0xff1e('0x6')];this[_0xff1e('0x9')]=_0x1fbdfe[_0xff1e('0x9')]||![];this[_0xff1e('0xa')]=_0x5a2241['type'];this[_0xff1e('0xb')]=_0x5a2241['dialQueueTimeout']||0x3;this[_0xff1e('0xc')]=_0x1fbdfe[_0xff1e('0xc')];this[_0xff1e('0xd')]=_0x1fbdfe[_0xff1e('0xd')];this[_0xff1e('0xe')]=_0x1fbdfe[_0xff1e('0xe')];this[_0xff1e('0xf')]=_0x1fbdfe[_0xff1e('0xf')];this[_0xff1e('0x10')]=_0x1fbdfe['countnosuchnumberretry'];this[_0xff1e('0x11')]=_0x1fbdfe[_0xff1e('0x11')];this[_0xff1e('0x12')]=_0x1fbdfe[_0xff1e('0x12')];this['countmachineretry']=_0x1fbdfe[_0xff1e('0x13')];this[_0xff1e('0x14')]=_0x1fbdfe[_0xff1e('0x14')];this[_0xff1e('0x15')]=_0x1fbdfe[_0xff1e('0x15')];this[_0xff1e('0x16')]=_0x1fbdfe[_0xff1e('0x16')];this[_0xff1e('0x17')]=_0x1fbdfe['UserId'];this[_0xff1e('0x18')]=_0x1fbdfe[_0xff1e('0x18')];this['CampaignId']=_0x1fbdfe['CampaignId'];this['idHopper']=_0x1fbdfe['id'];this[_0xff1e('0x19')]=_0x1fbdfe[_0xff1e('0x1a')][_0xff1e('0x8')]||'';this['starttime']=moment()['format'](_0xff1e('0x1b'));this[_0xff1e('0x1c')]=_0x1fbdfe[_0xff1e('0x1c')];this[_0xff1e('0x1d')]=_0x1fbdfe[_0xff1e('0x1d')];this['callbackat']=_0x1fbdfe[_0xff1e('0x1e')];this[_0xff1e('0x1f')]=_0x1fbdfe[_0xff1e('0x1f')];this[_0xff1e('0x20')]='';this['originatecalleridname']='';}Action[_0xff1e('0x21')][_0xff1e('0x22')]=function(){return util[_0xff1e('0x23')](_0xff1e('0x24'),this['name'],this['voiceQueue'][_0xff1e('0x25')]>0x0?this['number'][_0xff1e('0x26')](this[_0xff1e('0x4')][_0xff1e('0x25')]):this[_0xff1e('0x27')]);};Action[_0xff1e('0x21')][_0xff1e('0x28')]=function(){return this[_0xff1e('0x29')];};module['exports']=Action; \ No newline at end of file +var _0xaaef=['callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','exports','lodash','moment','isNil','voiceQueue','uniqueid','name','Contact','firstName','lastName','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid'];(function(_0x3a459c,_0x185992){var _0x52fecc=function(_0x1c9e64){while(--_0x1c9e64){_0x3a459c['push'](_0x3a459c['shift']());}};_0x52fecc(++_0x185992);}(_0xaaef,0x112));var _0xfaae=function(_0x40850b,_0x3c8fce){_0x40850b=_0x40850b-0x0;var _0x167c78=_0xaaef[_0x40850b];return _0x167c78;};'use strict';var util=require('util');var _=require(_0xfaae('0x0'));var moment=require(_0xfaae('0x1'));function checkNameSurname(_0x3d5f7f,_0x490193,_0x379c59){var _0x190d1d='';if(!_[_0xfaae('0x2')](_0x490193)&&'string'===typeof _0x490193){_0x190d1d+=_0x490193;}if(!_[_0xfaae('0x2')](_0x379c59)&&'string'===typeof _0x379c59){_0x190d1d+='\x20'+_0x379c59;}if(_0x190d1d!==''){return _0x190d1d;}return _0x3d5f7f;}function Action(_0x9c20f8,_0x264170,_0x346446){this[_0xfaae('0x3')]=_0x9c20f8;this[_0xfaae('0x4')]=_0x346446||undefined;this[_0xfaae('0x5')]=checkNameSurname(_0x264170[_0xfaae('0x6')]['phone'],_0x264170[_0xfaae('0x6')][_0xfaae('0x7')],_0x264170[_0xfaae('0x6')][_0xfaae('0x8')]);this['number']=_0x264170[_0xfaae('0x9')];this[_0xfaae('0xa')]=_0x9c20f8[_0xfaae('0x5')];this[_0xfaae('0xb')]=_0x264170[_0xfaae('0xb')]||![];this[_0xfaae('0xc')]=_0x9c20f8[_0xfaae('0xc')];this[_0xfaae('0xd')]=_0x9c20f8[_0xfaae('0xd')]||0x3;this[_0xfaae('0xe')]=_0x264170[_0xfaae('0xe')];this[_0xfaae('0xf')]=_0x264170[_0xfaae('0xf')];this[_0xfaae('0x10')]=_0x264170[_0xfaae('0x10')];this[_0xfaae('0x11')]=_0x264170['countnoanswerretry'];this[_0xfaae('0x12')]=_0x264170['countnosuchnumberretry'];this[_0xfaae('0x13')]=_0x264170['countdropretry'];this[_0xfaae('0x14')]=_0x264170[_0xfaae('0x14')];this['countmachineretry']=_0x264170[_0xfaae('0x15')];this[_0xfaae('0x16')]=_0x264170[_0xfaae('0x16')];this[_0xfaae('0x17')]=_0x264170['ContactId'];this[_0xfaae('0x18')]=_0x264170[_0xfaae('0x18')];this[_0xfaae('0x19')]=_0x264170[_0xfaae('0x19')];this[_0xfaae('0x1a')]=_0x264170[_0xfaae('0x1a')];this[_0xfaae('0x1b')]=_0x264170['CampaignId'];this[_0xfaae('0x1c')]=_0x264170['id'];this[_0xfaae('0x1d')]=_0x264170[_0xfaae('0x6')][_0xfaae('0x7')]||'';this['starttime']=moment()[_0xfaae('0x1e')](_0xfaae('0x1f'));this[_0xfaae('0x20')]=_0x264170[_0xfaae('0x20')];this['callbackuniqueid']=_0x264170[_0xfaae('0x21')];this[_0xfaae('0x22')]=_0x264170[_0xfaae('0x22')];this[_0xfaae('0x23')]=_0x264170[_0xfaae('0x23')];this[_0xfaae('0x24')]='';this[_0xfaae('0x25')]='';}Action[_0xfaae('0x26')]['getCaller']=function(){return util[_0xfaae('0x1e')](_0xfaae('0x27'),this[_0xfaae('0x5')],this[_0xfaae('0x3')][_0xfaae('0x28')]>0x0?this['number'][_0xfaae('0x29')](this[_0xfaae('0x3')][_0xfaae('0x28')]):this[_0xfaae('0x2a')]);};Action[_0xfaae('0x26')]['getQueue']=function(){return this['queue'];};module[_0xfaae('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 5bdb59a..05d5b9c 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f57=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridnum','starttime','responsetime','answertime','endtime','format','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','scheduledat','type'];(function(_0x4bc491,_0x184bde){var _0x5b29e8=function(_0x279a1d){while(--_0x279a1d){_0x4bc491['push'](_0x4bc491['shift']());}};_0x5b29e8(++_0x184bde);}(_0x0f57,0x15a));var _0x70f5=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x0f57[_0x622035];return _0x326cf2;};'use strict';var moment=require(_0x70f5('0x0'));var utils=require(_0x70f5('0x1'));function AgentComplete(_0x38f949,_0xd750bf){this[_0x70f5('0x2')]=0x4;this[_0x70f5('0x3')]='Answer';this['scheduledat']=_0x38f949[_0x70f5('0x4')];this[_0x70f5('0x5')]=_0x38f949[_0x70f5('0x5')];this[_0x70f5('0x6')]=_0x38f949[_0x70f5('0x5')]===_0x70f5('0x7')?_0x70f5('0x8'):_0x38f949['type'];this[_0x70f5('0x9')]=_0x38f949[_0x70f5('0x9')];this[_0x70f5('0xa')]=_0x38f949[_0x70f5('0xa')];this[_0x70f5('0xb')]=_0x38f949[_0x70f5('0xb')];this[_0x70f5('0xc')]=_0x38f949[_0x70f5('0x9')]+_0x38f949[_0x70f5('0xa')]+_0x38f949[_0x70f5('0xb')]+_0x38f949[_0x70f5('0xd')]+_0x38f949[_0x70f5('0xe')]+_0x38f949['countabandonedretry']+_0x38f949[_0x70f5('0xf')]+_0x38f949[_0x70f5('0x10')];this['countnosuchnumberretry']=_0x38f949[_0x70f5('0xd')];this[_0x70f5('0xe')]=_0x38f949['countdropretry'];this[_0x70f5('0x11')]=_0x38f949[_0x70f5('0x11')];this[_0x70f5('0xf')]=_0x38f949['countmachineretry'];this[_0x70f5('0x10')]=_0x38f949[_0x70f5('0x10')];this['uniqueid']=_0xd750bf[_0x70f5('0x12')];this['calleridname']=_0x38f949['name'];this[_0x70f5('0x13')]=_0x38f949['number'];this[_0x70f5('0x14')]=_0x38f949[_0x70f5('0x14')];this[_0x70f5('0x15')]=_0x38f949[_0x70f5('0x15')];this[_0x70f5('0x16')]=_0x38f949[_0x70f5('0x16')];this[_0x70f5('0x17')]=moment()[_0x70f5('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x70f5('0x19')]=utils[_0x70f5('0x1a')](_0x38f949['responsetime'],_0x38f949['starttime']);this[_0x70f5('0x1b')]=utils['getSeconds'](_0x38f949[_0x70f5('0x16')],_0x38f949[_0x70f5('0x15')]);this[_0x70f5('0x1c')]=utils[_0x70f5('0x1a')](this[_0x70f5('0x17')],_0x38f949['answertime']);this[_0x70f5('0x8')]=_0xd750bf[_0x70f5('0x8')];this[_0x70f5('0x1d')]=_0xd750bf[_0x70f5('0x1d')];this[_0x70f5('0x1e')]=_0xd750bf[_0x70f5('0x1e')];this[_0x70f5('0x1f')]=_0x38f949['callback'];this[_0x70f5('0x20')]=_0x38f949[_0x70f5('0x20')];this[_0x70f5('0x21')]=_0x38f949[_0x70f5('0x21')];this[_0x70f5('0x22')]=_0x38f949[_0x70f5('0x22')];this[_0x70f5('0x23')]=_0x38f949[_0x70f5('0x23')];this[_0x70f5('0x24')]=_0x38f949[_0x70f5('0x24')];this['UserId']=_0x38f949[_0x70f5('0x25')];this[_0x70f5('0x26')]=_0x38f949[_0x70f5('0x26')];this[_0x70f5('0x27')]=_0x38f949[_0x70f5('0x27')];this[_0x70f5('0x28')]=_0x38f949['originatecalleridnum']||'';this[_0x70f5('0x29')]=_0x38f949[_0x70f5('0x29')]||'';this[_0x70f5('0x2a')]=_0x38f949[_0x70f5('0x2a')];}module[_0x70f5('0x2b')]=AgentComplete; \ No newline at end of file +var _0x8186=['answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','starttime','holdtime','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','responsetime'];(function(_0xd30fed,_0x390b94){var _0x1207b4=function(_0x2f8e28){while(--_0x2f8e28){_0xd30fed['push'](_0xd30fed['shift']());}};_0x1207b4(++_0x390b94);}(_0x8186,0x16d));var _0x6818=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x8186[_0x211632];return _0x5a1da1;};'use strict';var moment=require(_0x6818('0x0'));var utils=require('../utils');function AgentComplete(_0x507895,_0x211a42){this[_0x6818('0x1')]=0x4;this[_0x6818('0x2')]=_0x6818('0x3');this[_0x6818('0x4')]=_0x507895['scheduledat'];this[_0x6818('0x5')]=_0x507895[_0x6818('0x5')];this[_0x6818('0x6')]=_0x507895[_0x6818('0x5')]===_0x6818('0x7')?_0x6818('0x8'):_0x507895[_0x6818('0x5')];this[_0x6818('0x9')]=_0x507895[_0x6818('0x9')];this['countcongestionretry']=_0x507895[_0x6818('0xa')];this[_0x6818('0xb')]=_0x507895['countnoanswerretry'];this[_0x6818('0xc')]=_0x507895[_0x6818('0x9')]+_0x507895[_0x6818('0xa')]+_0x507895['countnoanswerretry']+_0x507895[_0x6818('0xd')]+_0x507895[_0x6818('0xe')]+_0x507895[_0x6818('0xf')]+_0x507895[_0x6818('0x10')]+_0x507895[_0x6818('0x11')];this[_0x6818('0xd')]=_0x507895[_0x6818('0xd')];this['countdropretry']=_0x507895[_0x6818('0xe')];this[_0x6818('0xf')]=_0x507895['countabandonedretry'];this['countmachineretry']=_0x507895['countmachineretry'];this['countagentrejectretry']=_0x507895[_0x6818('0x11')];this[_0x6818('0x12')]=_0x211a42[_0x6818('0x12')];this['calleridname']=_0x507895['name'];this[_0x6818('0x13')]=_0x507895[_0x6818('0x14')];this['starttime']=_0x507895['starttime'];this[_0x6818('0x15')]=_0x507895[_0x6818('0x15')];this[_0x6818('0x16')]=_0x507895[_0x6818('0x16')];this[_0x6818('0x17')]=moment()[_0x6818('0x18')](_0x6818('0x19'));this[_0x6818('0x1a')]=utils[_0x6818('0x1b')](_0x507895[_0x6818('0x15')],_0x507895[_0x6818('0x1c')]);this[_0x6818('0x1d')]=utils[_0x6818('0x1b')](_0x507895[_0x6818('0x16')],_0x507895[_0x6818('0x15')]);this['talktime']=utils['getSeconds'](this[_0x6818('0x17')],_0x507895[_0x6818('0x16')]);this[_0x6818('0x8')]=_0x211a42[_0x6818('0x8')];this['membername']=_0x211a42['membername'];this[_0x6818('0x1e')]=_0x211a42[_0x6818('0x1e')];this[_0x6818('0x1f')]=_0x507895[_0x6818('0x1f')];this['callbackuniqueid']=_0x507895['callbackuniqueid'];this[_0x6818('0x20')]=_0x507895[_0x6818('0x20')];this[_0x6818('0x21')]=_0x507895[_0x6818('0x21')];this[_0x6818('0x22')]=_0x507895['ContactId'];this[_0x6818('0x23')]=_0x507895[_0x6818('0x23')];this[_0x6818('0x24')]=_0x507895[_0x6818('0x24')];this[_0x6818('0x25')]=_0x507895['VoiceQueueId'];this[_0x6818('0x26')]=_0x507895['CampaignId'];this[_0x6818('0x27')]=_0x507895[_0x6818('0x27')]||'';this['originatecalleridname']=_0x507895[_0x6818('0x28')]||'';this[_0x6818('0x29')]=_0x507895['agiafterat'];}module[_0x6818('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 4e4f105..42f7cd1 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec17=['callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime'];(function(_0x2e9296,_0x522768){var _0x5ef22c=function(_0x2804b0){while(--_0x2804b0){_0x2e9296['push'](_0x2e9296['shift']());}};_0x5ef22c(++_0x522768);}(_0xec17,0x160));var _0x7ec1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xec17[_0x40a045];return _0x1a687c;};'use strict';function Final(_0x3a3e28){this[_0x7ec1('0x0')]=_0x3a3e28[_0x7ec1('0x0')];this[_0x7ec1('0x1')]=_0x3a3e28['scheduledat'];this[_0x7ec1('0x2')]=_0x3a3e28['type'];this[_0x7ec1('0x3')]=_0x3a3e28[_0x7ec1('0x2')]==='outbound'?'queue':_0x3a3e28[_0x7ec1('0x2')];this[_0x7ec1('0x4')]=_0x3a3e28[_0x7ec1('0x4')];this[_0x7ec1('0x5')]=_0x3a3e28[_0x7ec1('0x5')];this[_0x7ec1('0x6')]=_0x3a3e28[_0x7ec1('0x6')];this['countglobal']=_0x3a3e28[_0x7ec1('0x4')]+_0x3a3e28[_0x7ec1('0x5')]+_0x3a3e28['countnoanswerretry']+_0x3a3e28[_0x7ec1('0x7')]+_0x3a3e28[_0x7ec1('0x8')]+_0x3a3e28['countabandonedretry']+_0x3a3e28['countmachineretry']+_0x3a3e28[_0x7ec1('0x9')];this[_0x7ec1('0x7')]=_0x3a3e28['countnosuchnumberretry'];this[_0x7ec1('0x8')]=_0x3a3e28[_0x7ec1('0x8')];this[_0x7ec1('0xa')]=_0x3a3e28[_0x7ec1('0xa')];this[_0x7ec1('0xb')]=_0x3a3e28[_0x7ec1('0xb')];this['countagentrejectretry']=_0x3a3e28[_0x7ec1('0x9')];this[_0x7ec1('0xc')]=_0x3a3e28[_0x7ec1('0xc')];this[_0x7ec1('0xd')]=_0x3a3e28['calleridname'];this[_0x7ec1('0xe')]=_0x3a3e28[_0x7ec1('0xe')];this[_0x7ec1('0xf')]=_0x3a3e28[_0x7ec1('0xf')];this[_0x7ec1('0x10')]=_0x3a3e28[_0x7ec1('0x10')];this['endtime']=_0x3a3e28[_0x7ec1('0x10')];this[_0x7ec1('0x11')]=_0x3a3e28[_0x7ec1('0x11')]||0x0;this[_0x7ec1('0x12')]=_0x3a3e28[_0x7ec1('0x12')]||0x0;this[_0x7ec1('0x13')]=_0x3a3e28[_0x7ec1('0x13')]||0x0;this['callback']=_0x3a3e28[_0x7ec1('0x14')];this[_0x7ec1('0x15')]=_0x3a3e28[_0x7ec1('0x15')];this[_0x7ec1('0x16')]=_0x3a3e28[_0x7ec1('0x16')];this['recallme']=_0x3a3e28[_0x7ec1('0x17')];this['ContactId']=_0x3a3e28['ContactId'];this['ListId']=_0x3a3e28[_0x7ec1('0x18')];this[_0x7ec1('0x19')]=_0x3a3e28[_0x7ec1('0x19')];this[_0x7ec1('0x1a')]=_0x3a3e28[_0x7ec1('0x1a')];this[_0x7ec1('0x1b')]=_0x3a3e28[_0x7ec1('0x1b')];this['originatecalleridnum']=_0x3a3e28['originatecalleridnum']||'';this[_0x7ec1('0x1c')]=_0x3a3e28['originatecalleridname']||'';this[_0x7ec1('0x1d')]=_0x3a3e28[_0x7ec1('0x1d')];this['statedesc']=_0x3a3e28[_0x7ec1('0x1e')];}module['exports']=Final; \ No newline at end of file +var _0x3846=['responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x3846,0xa2));var _0x6384=function(_0x26393b,_0x449a84){_0x26393b=_0x26393b-0x0;var _0x57230a=_0x3846[_0x26393b];return _0x57230a;};'use strict';function Final(_0x2369fa){this[_0x6384('0x0')]=_0x2369fa['uniqueid'];this[_0x6384('0x1')]=_0x2369fa['scheduledat'];this[_0x6384('0x2')]=_0x2369fa[_0x6384('0x2')];this[_0x6384('0x3')]=_0x2369fa['type']===_0x6384('0x4')?_0x6384('0x5'):_0x2369fa[_0x6384('0x2')];this[_0x6384('0x6')]=_0x2369fa[_0x6384('0x6')];this[_0x6384('0x7')]=_0x2369fa[_0x6384('0x7')];this[_0x6384('0x8')]=_0x2369fa['countnoanswerretry'];this[_0x6384('0x9')]=_0x2369fa['countbusyretry']+_0x2369fa[_0x6384('0x7')]+_0x2369fa['countnoanswerretry']+_0x2369fa[_0x6384('0xa')]+_0x2369fa[_0x6384('0xb')]+_0x2369fa[_0x6384('0xc')]+_0x2369fa[_0x6384('0xd')]+_0x2369fa[_0x6384('0xe')];this['countnosuchnumberretry']=_0x2369fa[_0x6384('0xa')];this[_0x6384('0xb')]=_0x2369fa[_0x6384('0xb')];this[_0x6384('0xc')]=_0x2369fa['countabandonedretry'];this[_0x6384('0xd')]=_0x2369fa[_0x6384('0xd')];this[_0x6384('0xe')]=_0x2369fa['countagentrejectretry'];this[_0x6384('0x5')]=_0x2369fa['queue'];this['calleridname']=_0x2369fa[_0x6384('0xf')];this[_0x6384('0x10')]=_0x2369fa['calleridnum'];this[_0x6384('0x11')]=_0x2369fa['starttime'];this[_0x6384('0x12')]=_0x2369fa[_0x6384('0x12')];this[_0x6384('0x13')]=_0x2369fa[_0x6384('0x12')];this['ringtime']=_0x2369fa['ringtime']||0x0;this[_0x6384('0x14')]=_0x2369fa[_0x6384('0x14')]||0x0;this[_0x6384('0x15')]=_0x2369fa[_0x6384('0x15')]||0x0;this['callback']=_0x2369fa[_0x6384('0x16')];this[_0x6384('0x17')]=_0x2369fa[_0x6384('0x17')];this[_0x6384('0x18')]=_0x2369fa[_0x6384('0x18')];this[_0x6384('0x19')]=_0x2369fa['recallme'];this[_0x6384('0x1a')]=_0x2369fa[_0x6384('0x1a')];this[_0x6384('0x1b')]=_0x2369fa['ListId'];this[_0x6384('0x1c')]=_0x2369fa[_0x6384('0x1c')];this[_0x6384('0x1d')]=_0x2369fa[_0x6384('0x1d')];this[_0x6384('0x1e')]=_0x2369fa[_0x6384('0x1e')];this[_0x6384('0x1f')]=_0x2369fa[_0x6384('0x1f')]||'';this[_0x6384('0x20')]=_0x2369fa[_0x6384('0x20')]||'';this[_0x6384('0x21')]=_0x2369fa['state'];this[_0x6384('0x22')]=_0x2369fa[_0x6384('0x22')];}module[_0x6384('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index a5d0bcd..93ca82d 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9eb1=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','Answer','scheduledat','type','queue','amd'];(function(_0x173f13,_0x4ea3cf){var _0x585942=function(_0x96d7d5){while(--_0x96d7d5){_0x173f13['push'](_0x173f13['shift']());}};_0x585942(++_0x4ea3cf);}(_0x9eb1,0x111));var _0x19eb=function(_0x3eb57e,_0x515967){_0x3eb57e=_0x3eb57e-0x0;var _0x45f057=_0x9eb1[_0x3eb57e];return _0x45f057;};'use strict';var moment=require(_0x19eb('0x0'));var utils=require(_0x19eb('0x1'));function Hangup(_0x3f9a9e,_0x1f8aab){this['state']=0x4;this['statedesc']=_0x19eb('0x2');this[_0x19eb('0x3')]=_0x3f9a9e[_0x19eb('0x3')];this[_0x19eb('0x4')]=_0x3f9a9e[_0x19eb('0x4')];this['campaigntype']=_0x3f9a9e['type']==='outbound'?_0x19eb('0x5'):_0x3f9a9e['type'];this[_0x19eb('0x6')]=_0x3f9a9e[_0x19eb('0x6')]||![];this[_0x19eb('0x7')]=_0x3f9a9e[_0x19eb('0x7')];this[_0x19eb('0x8')]=_0x3f9a9e[_0x19eb('0x8')];this[_0x19eb('0x9')]=_0x3f9a9e[_0x19eb('0x9')];this[_0x19eb('0xa')]=_0x3f9a9e['countbusyretry']+_0x3f9a9e[_0x19eb('0x8')]+_0x3f9a9e[_0x19eb('0x9')]+_0x3f9a9e['countnosuchnumberretry']+_0x3f9a9e[_0x19eb('0xb')]+_0x3f9a9e[_0x19eb('0xc')]+_0x3f9a9e[_0x19eb('0xd')]+_0x3f9a9e[_0x19eb('0xe')];this[_0x19eb('0xf')]=_0x3f9a9e[_0x19eb('0xf')];this[_0x19eb('0xb')]=_0x3f9a9e[_0x19eb('0xb')];this[_0x19eb('0xc')]=_0x3f9a9e[_0x19eb('0xc')];this[_0x19eb('0xd')]=_0x3f9a9e[_0x19eb('0xd')];this['countagentrejectretry']=_0x3f9a9e[_0x19eb('0xe')];this[_0x19eb('0x10')]=_0x1f8aab['uniqueid'];this[_0x19eb('0x11')]=_0x3f9a9e[_0x19eb('0x12')];this['calleridnum']=_0x3f9a9e[_0x19eb('0x13')];this[_0x19eb('0x14')]=_0x3f9a9e['starttime'];this[_0x19eb('0x15')]=_0x3f9a9e[_0x19eb('0x15')];this[_0x19eb('0x16')]=moment()['format'](_0x19eb('0x17'));this['ringtime']=utils[_0x19eb('0x18')](_0x3f9a9e[_0x19eb('0x15')],_0x3f9a9e[_0x19eb('0x14')]);this[_0x19eb('0x19')]=0x0;this[_0x19eb('0x1a')]=utils['getSeconds'](this[_0x19eb('0x16')],_0x3f9a9e['responsetime']);this[_0x19eb('0x5')]=_0x3f9a9e['queue'];this[_0x19eb('0x1b')]='IVR';this[_0x19eb('0x1c')]=_0x1f8aab[_0x19eb('0x1d')];this[_0x19eb('0x1e')]=_0x3f9a9e[_0x19eb('0x1e')];this[_0x19eb('0x1f')]=_0x3f9a9e[_0x19eb('0x1f')];this['callbackat']=_0x3f9a9e[_0x19eb('0x20')];this[_0x19eb('0x21')]=_0x3f9a9e[_0x19eb('0x21')];this[_0x19eb('0x22')]=_0x3f9a9e[_0x19eb('0x22')];this[_0x19eb('0x23')]=_0x3f9a9e['ListId'];this[_0x19eb('0x24')]=_0x3f9a9e['UserId'];this['VoiceQueueId']=_0x3f9a9e[_0x19eb('0x25')];this[_0x19eb('0x26')]=_0x3f9a9e[_0x19eb('0x26')];}module[_0x19eb('0x27')]=Hangup; \ No newline at end of file +var _0xdeaf=['amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue'];(function(_0x49857e,_0x140009){var _0x4bbb3a=function(_0x438217){while(--_0x438217){_0x49857e['push'](_0x49857e['shift']());}};_0x4bbb3a(++_0x140009);}(_0xdeaf,0x13f));var _0xfdea=function(_0x40ec34,_0x534096){_0x40ec34=_0x40ec34-0x0;var _0x597948=_0xdeaf[_0x40ec34];return _0x597948;};'use strict';var moment=require(_0xfdea('0x0'));var utils=require(_0xfdea('0x1'));function Hangup(_0x3e36e3,_0x1d712a){this[_0xfdea('0x2')]=0x4;this['statedesc']=_0xfdea('0x3');this['scheduledat']=_0x3e36e3[_0xfdea('0x4')];this[_0xfdea('0x5')]=_0x3e36e3['type'];this[_0xfdea('0x6')]=_0x3e36e3[_0xfdea('0x5')]===_0xfdea('0x7')?_0xfdea('0x8'):_0x3e36e3[_0xfdea('0x5')];this[_0xfdea('0x9')]=_0x3e36e3[_0xfdea('0x9')]||![];this[_0xfdea('0xa')]=_0x3e36e3[_0xfdea('0xa')];this['countcongestionretry']=_0x3e36e3[_0xfdea('0xb')];this['countnoanswerretry']=_0x3e36e3[_0xfdea('0xc')];this['countglobal']=_0x3e36e3[_0xfdea('0xa')]+_0x3e36e3[_0xfdea('0xb')]+_0x3e36e3[_0xfdea('0xc')]+_0x3e36e3['countnosuchnumberretry']+_0x3e36e3[_0xfdea('0xd')]+_0x3e36e3[_0xfdea('0xe')]+_0x3e36e3[_0xfdea('0xf')]+_0x3e36e3[_0xfdea('0x10')];this[_0xfdea('0x11')]=_0x3e36e3[_0xfdea('0x11')];this[_0xfdea('0xd')]=_0x3e36e3['countdropretry'];this[_0xfdea('0xe')]=_0x3e36e3[_0xfdea('0xe')];this[_0xfdea('0xf')]=_0x3e36e3[_0xfdea('0xf')];this[_0xfdea('0x10')]=_0x3e36e3[_0xfdea('0x10')];this[_0xfdea('0x12')]=_0x1d712a[_0xfdea('0x12')];this['calleridname']=_0x3e36e3[_0xfdea('0x13')];this['calleridnum']=_0x3e36e3[_0xfdea('0x14')];this[_0xfdea('0x15')]=_0x3e36e3[_0xfdea('0x15')];this[_0xfdea('0x16')]=_0x3e36e3[_0xfdea('0x16')];this[_0xfdea('0x17')]=moment()[_0xfdea('0x18')](_0xfdea('0x19'));this[_0xfdea('0x1a')]=utils[_0xfdea('0x1b')](_0x3e36e3[_0xfdea('0x16')],_0x3e36e3[_0xfdea('0x15')]);this['holdtime']=0x0;this[_0xfdea('0x1c')]=utils[_0xfdea('0x1b')](this['endtime'],_0x3e36e3[_0xfdea('0x16')]);this[_0xfdea('0x8')]=_0x3e36e3[_0xfdea('0x8')];this[_0xfdea('0x1d')]=_0xfdea('0x1e');this[_0xfdea('0x1f')]=_0x1d712a['cause-txt'];this[_0xfdea('0x20')]=_0x3e36e3['callback'];this[_0xfdea('0x21')]=_0x3e36e3[_0xfdea('0x21')];this[_0xfdea('0x22')]=_0x3e36e3[_0xfdea('0x22')];this[_0xfdea('0x23')]=_0x3e36e3[_0xfdea('0x23')];this['ContactId']=_0x3e36e3[_0xfdea('0x24')];this[_0xfdea('0x25')]=_0x3e36e3['ListId'];this[_0xfdea('0x26')]=_0x3e36e3[_0xfdea('0x26')];this[_0xfdea('0x27')]=_0x3e36e3['VoiceQueueId'];this[_0xfdea('0x28')]=_0x3e36e3[_0xfdea('0x28')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 594bd9f..7b72293 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c8c=['callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0x1c8c,0x1ed));var _0xc1c8=function(_0x2f23a6,_0x4e1b85){_0x2f23a6=_0x2f23a6-0x0;var _0x1df5c9=_0x1c8c[_0x2f23a6];return _0x1df5c9;};'use strict';var utils=require(_0xc1c8('0x0'));function History(_0x49bdd7){this[_0xc1c8('0x1')]=_0x49bdd7[_0xc1c8('0x1')];this[_0xc1c8('0x2')]=_0x49bdd7['scheduledat']||undefined;this[_0xc1c8('0x3')]=_0x49bdd7[_0xc1c8('0x3')];this[_0xc1c8('0x4')]=_0x49bdd7[_0xc1c8('0x3')]===_0xc1c8('0x5')?_0xc1c8('0x6'):_0x49bdd7[_0xc1c8('0x3')];this[_0xc1c8('0x7')]=_0x49bdd7[_0xc1c8('0x7')];this[_0xc1c8('0x8')]=_0x49bdd7[_0xc1c8('0x8')];this[_0xc1c8('0x9')]=_0x49bdd7[_0xc1c8('0x9')];this[_0xc1c8('0xa')]=_0x49bdd7[_0xc1c8('0x7')]+_0x49bdd7[_0xc1c8('0x8')]+_0x49bdd7[_0xc1c8('0x9')]+_0x49bdd7[_0xc1c8('0xb')]+_0x49bdd7['countdropretry']+_0x49bdd7[_0xc1c8('0xc')]+_0x49bdd7[_0xc1c8('0xd')]+_0x49bdd7[_0xc1c8('0xe')];this['countnosuchnumberretry']=_0x49bdd7[_0xc1c8('0xb')];this[_0xc1c8('0xf')]=_0x49bdd7[_0xc1c8('0xf')];this[_0xc1c8('0xc')]=_0x49bdd7[_0xc1c8('0xc')];this[_0xc1c8('0xd')]=_0x49bdd7[_0xc1c8('0xd')];this[_0xc1c8('0xe')]=_0x49bdd7[_0xc1c8('0xe')];this['queue']=_0x49bdd7[_0xc1c8('0x6')];this[_0xc1c8('0x10')]=_0x49bdd7[_0xc1c8('0x11')];this[_0xc1c8('0x12')]=_0x49bdd7[_0xc1c8('0x13')];this[_0xc1c8('0x14')]=_0x49bdd7[_0xc1c8('0x14')];this[_0xc1c8('0x15')]=_0x49bdd7[_0xc1c8('0x15')];this[_0xc1c8('0x16')]=_0x49bdd7['responsetime'];this[_0xc1c8('0x17')]=utils[_0xc1c8('0x18')](_0x49bdd7[_0xc1c8('0x15')],_0x49bdd7[_0xc1c8('0x14')]);this[_0xc1c8('0x19')]=0x0;this[_0xc1c8('0x1a')]=0x0;this[_0xc1c8('0x1b')]=_0x49bdd7[_0xc1c8('0x1b')];this[_0xc1c8('0x1c')]=_0x49bdd7[_0xc1c8('0x1c')];this[_0xc1c8('0x1d')]=_0x49bdd7['callbackat'];this['recallme']=_0x49bdd7['recallme'];this[_0xc1c8('0x1e')]=_0x49bdd7[_0xc1c8('0x1e')];this['ListId']=_0x49bdd7[_0xc1c8('0x1f')];this[_0xc1c8('0x20')]=_0x49bdd7[_0xc1c8('0x20')];this[_0xc1c8('0x21')]=_0x49bdd7[_0xc1c8('0x21')];this[_0xc1c8('0x22')]=_0x49bdd7[_0xc1c8('0x22')];this[_0xc1c8('0x23')]=_0x49bdd7['originatecalleridnum']||'';this[_0xc1c8('0x24')]=_0x49bdd7[_0xc1c8('0x24')]||'';this[_0xc1c8('0x25')]=_0x49bdd7[_0xc1c8('0x25')];this[_0xc1c8('0x26')]=_0x49bdd7[_0xc1c8('0x26')];}module[_0xc1c8('0x27')]=History; \ No newline at end of file +var _0x024d=['responsetime','endtime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','name','number','starttime'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x024d,0x184));var _0xd024=function(_0x2dfda3,_0x25ec02){_0x2dfda3=_0x2dfda3-0x0;var _0x29f92d=_0x024d[_0x2dfda3];return _0x29f92d;};'use strict';var utils=require(_0xd024('0x0'));function History(_0x1d54e7){this['uniqueid']=_0x1d54e7[_0xd024('0x1')];this[_0xd024('0x2')]=_0x1d54e7[_0xd024('0x2')]||undefined;this[_0xd024('0x3')]=_0x1d54e7[_0xd024('0x3')];this[_0xd024('0x4')]=_0x1d54e7[_0xd024('0x3')]===_0xd024('0x5')?_0xd024('0x6'):_0x1d54e7['type'];this[_0xd024('0x7')]=_0x1d54e7['countbusyretry'];this[_0xd024('0x8')]=_0x1d54e7[_0xd024('0x8')];this[_0xd024('0x9')]=_0x1d54e7[_0xd024('0x9')];this['countglobal']=_0x1d54e7['countbusyretry']+_0x1d54e7['countcongestionretry']+_0x1d54e7['countnoanswerretry']+_0x1d54e7['countnosuchnumberretry']+_0x1d54e7[_0xd024('0xa')]+_0x1d54e7[_0xd024('0xb')]+_0x1d54e7['countmachineretry']+_0x1d54e7[_0xd024('0xc')];this[_0xd024('0xd')]=_0x1d54e7[_0xd024('0xd')];this[_0xd024('0xa')]=_0x1d54e7[_0xd024('0xa')];this[_0xd024('0xb')]=_0x1d54e7[_0xd024('0xb')];this[_0xd024('0xe')]=_0x1d54e7['countmachineretry'];this[_0xd024('0xc')]=_0x1d54e7[_0xd024('0xc')];this[_0xd024('0x6')]=_0x1d54e7['queue'];this[_0xd024('0xf')]=_0x1d54e7[_0xd024('0x10')];this['calleridnum']=_0x1d54e7[_0xd024('0x11')];this[_0xd024('0x12')]=_0x1d54e7[_0xd024('0x12')];this[_0xd024('0x13')]=_0x1d54e7['responsetime'];this[_0xd024('0x14')]=_0x1d54e7[_0xd024('0x13')];this[_0xd024('0x15')]=utils[_0xd024('0x16')](_0x1d54e7['responsetime'],_0x1d54e7[_0xd024('0x12')]);this[_0xd024('0x17')]=0x0;this['talktime']=0x0;this[_0xd024('0x18')]=_0x1d54e7[_0xd024('0x18')];this[_0xd024('0x19')]=_0x1d54e7[_0xd024('0x19')];this['callbackat']=_0x1d54e7[_0xd024('0x1a')];this['recallme']=_0x1d54e7[_0xd024('0x1b')];this[_0xd024('0x1c')]=_0x1d54e7[_0xd024('0x1c')];this['ListId']=_0x1d54e7['ListId'];this[_0xd024('0x1d')]=_0x1d54e7['UserId'];this['VoiceQueueId']=_0x1d54e7[_0xd024('0x1e')];this[_0xd024('0x1f')]=_0x1d54e7[_0xd024('0x1f')];this['originatecalleridnum']=_0x1d54e7[_0xd024('0x20')]||'';this[_0xd024('0x21')]=_0x1d54e7[_0xd024('0x21')]||'';this[_0xd024('0x22')]=_0x1d54e7[_0xd024('0x22')];this['statedesc']=_0x1d54e7[_0xd024('0x23')];}module[_0xd024('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 7147058..b027fe0 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcac=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename'];(function(_0x16e6ea,_0x44978e){var _0x29ae3c=function(_0x54da81){while(--_0x54da81){_0x16e6ea['push'](_0x16e6ea['shift']());}};_0x29ae3c(++_0x44978e);}(_0xfcac,0x1c8));var _0xcfca=function(_0x204dc1,_0x48b9c9){_0x204dc1=_0x204dc1-0x0;var _0x18995d=_0xfcac[_0x204dc1];return _0x18995d;};'use strict';var utils=require(_0xcfca('0x0'));function QueueCallerAbandon(_0x72500d,_0x219ee5){this[_0xcfca('0x1')]=_0x72500d['scheduledat'];this[_0xcfca('0x2')]=_0x72500d[_0xcfca('0x2')];this['campaigntype']=_0x72500d[_0xcfca('0x2')]==='outbound'?_0xcfca('0x3'):_0x72500d[_0xcfca('0x2')];this['countbusyretry']=_0x72500d['countbusyretry'];this[_0xcfca('0x4')]=_0x72500d[_0xcfca('0x4')];this[_0xcfca('0x5')]=_0x72500d[_0xcfca('0x5')];this[_0xcfca('0x6')]=_0x72500d[_0xcfca('0x7')]+_0x72500d[_0xcfca('0x4')]+_0x72500d['countnoanswerretry']+_0x72500d[_0xcfca('0x8')]+_0x72500d[_0xcfca('0x9')]+_0x72500d['countabandonedretry']+_0x72500d['countmachineretry']+_0x72500d[_0xcfca('0xa')];this[_0xcfca('0x8')]=_0x72500d[_0xcfca('0x8')];this[_0xcfca('0x9')]=_0x72500d[_0xcfca('0x9')];this[_0xcfca('0xb')]=_0x72500d[_0xcfca('0xb')];this[_0xcfca('0xc')]=_0x72500d[_0xcfca('0xc')];this[_0xcfca('0xa')]=_0x72500d[_0xcfca('0xa')];this[_0xcfca('0xd')]=_0x219ee5[_0xcfca('0xd')];this[_0xcfca('0xe')]=_0x72500d['name'];this[_0xcfca('0xf')]=_0x72500d[_0xcfca('0x10')];this[_0xcfca('0x11')]=_0x72500d[_0xcfca('0x11')];this[_0xcfca('0x12')]=_0x72500d[_0xcfca('0x12')];this[_0xcfca('0x13')]=_0x72500d[_0xcfca('0x13')];this['dropreason']=_0x72500d[_0xcfca('0x14')];this[_0xcfca('0x15')]=this[_0xcfca('0x13')];this[_0xcfca('0x16')]=utils['getSeconds'](_0x72500d['responsetime'],_0x72500d[_0xcfca('0x11')]);this[_0xcfca('0x17')]=utils[_0xcfca('0x18')](this[_0xcfca('0x13')],_0x72500d[_0xcfca('0x12')]);this[_0xcfca('0x19')]=0x0;this[_0xcfca('0x3')]=_0x219ee5['queue'];this[_0xcfca('0x1a')]=_0x219ee5[_0xcfca('0x1b')];this[_0xcfca('0x1c')]=_0x219ee5[_0xcfca('0x1c')];this[_0xcfca('0x1d')]=_0x72500d[_0xcfca('0x1d')];this['callbackuniqueid']=_0x72500d[_0xcfca('0x1e')];this['callbackat']=_0x72500d[_0xcfca('0x1f')];this['recallme']=_0x72500d[_0xcfca('0x20')];this['ContactId']=_0x72500d[_0xcfca('0x21')];this['ListId']=_0x72500d[_0xcfca('0x22')];this[_0xcfca('0x23')]=_0x72500d[_0xcfca('0x23')];this[_0xcfca('0x24')]=_0x72500d[_0xcfca('0x24')];this[_0xcfca('0x25')]=_0x72500d[_0xcfca('0x25')];this[_0xcfca('0x26')]=_0x72500d['originatecalleridnum']||'';this[_0xcfca('0x27')]=_0x72500d[_0xcfca('0x27')]||'';this[_0xcfca('0x28')]=_0x72500d[_0xcfca('0x28')];this[_0xcfca('0x29')]=_0x72500d[_0xcfca('0x29')];this[_0xcfca('0x2a')]=_0x72500d[_0xcfca('0x2a')];}module[_0xcfca('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0x141d=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype'];(function(_0x129df0,_0x2d6a1f){var _0x4e63d5=function(_0x5c2c6d){while(--_0x5c2c6d){_0x129df0['push'](_0x129df0['shift']());}};_0x4e63d5(++_0x2d6a1f);}(_0x141d,0x1be));var _0xd141=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x141d[_0x4709c0];return _0x13348b;};'use strict';var utils=require(_0xd141('0x0'));function QueueCallerAbandon(_0x674f5c,_0x273478){this[_0xd141('0x1')]=_0x674f5c[_0xd141('0x1')];this['type']=_0x674f5c[_0xd141('0x2')];this[_0xd141('0x3')]=_0x674f5c[_0xd141('0x2')]===_0xd141('0x4')?_0xd141('0x5'):_0x674f5c[_0xd141('0x2')];this[_0xd141('0x6')]=_0x674f5c['countbusyretry'];this['countcongestionretry']=_0x674f5c[_0xd141('0x7')];this[_0xd141('0x8')]=_0x674f5c[_0xd141('0x8')];this[_0xd141('0x9')]=_0x674f5c[_0xd141('0x6')]+_0x674f5c[_0xd141('0x7')]+_0x674f5c['countnoanswerretry']+_0x674f5c[_0xd141('0xa')]+_0x674f5c[_0xd141('0xb')]+_0x674f5c[_0xd141('0xc')]+_0x674f5c[_0xd141('0xd')]+_0x674f5c[_0xd141('0xe')];this[_0xd141('0xa')]=_0x674f5c['countnosuchnumberretry'];this[_0xd141('0xb')]=_0x674f5c[_0xd141('0xb')];this['countabandonedretry']=_0x674f5c['countabandonedretry'];this[_0xd141('0xd')]=_0x674f5c['countmachineretry'];this[_0xd141('0xe')]=_0x674f5c[_0xd141('0xe')];this[_0xd141('0xf')]=_0x273478[_0xd141('0xf')];this['calleridname']=_0x674f5c[_0xd141('0x10')];this[_0xd141('0x11')]=_0x674f5c[_0xd141('0x12')];this[_0xd141('0x13')]=_0x674f5c['starttime'];this['responsetime']=_0x674f5c[_0xd141('0x14')];this[_0xd141('0x15')]=_0x674f5c[_0xd141('0x15')];this[_0xd141('0x16')]=_0x674f5c[_0xd141('0x16')];this[_0xd141('0x17')]=this[_0xd141('0x15')];this[_0xd141('0x18')]=utils[_0xd141('0x19')](_0x674f5c[_0xd141('0x14')],_0x674f5c[_0xd141('0x13')]);this[_0xd141('0x1a')]=utils[_0xd141('0x19')](this[_0xd141('0x15')],_0x674f5c['responsetime']);this[_0xd141('0x1b')]=0x0;this[_0xd141('0x5')]=_0x273478[_0xd141('0x5')];this[_0xd141('0x1c')]=_0x273478[_0xd141('0x1d')];this[_0xd141('0x1e')]=_0x273478['reason'];this['callback']=_0x674f5c[_0xd141('0x1f')];this[_0xd141('0x20')]=_0x674f5c[_0xd141('0x20')];this[_0xd141('0x21')]=_0x674f5c['callbackat'];this[_0xd141('0x22')]=_0x674f5c[_0xd141('0x22')];this[_0xd141('0x23')]=_0x674f5c[_0xd141('0x23')];this[_0xd141('0x24')]=_0x674f5c[_0xd141('0x24')];this[_0xd141('0x25')]=_0x674f5c[_0xd141('0x25')];this[_0xd141('0x26')]=_0x674f5c[_0xd141('0x26')];this[_0xd141('0x27')]=_0x674f5c['CampaignId'];this['originatecalleridnum']=_0x674f5c['originatecalleridnum']||'';this[_0xd141('0x28')]=_0x674f5c['originatecalleridname']||'';this[_0xd141('0x29')]=_0x674f5c[_0xd141('0x29')];this['state']=_0x674f5c[_0xd141('0x2a')];this[_0xd141('0x2b')]=_0x674f5c['statedesc'];}module[_0xd141('0x2c')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 30419d7..89b3a45 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71ab=['[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]'];(function(_0x3db300,_0x3fcc99){var _0x5150cb=function(_0x3a5514){while(--_0x3a5514){_0x3db300['push'](_0x3db300['shift']());}};_0x5150cb(++_0x3fcc99);}(_0x71ab,0x64));var _0xb71a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x71ab[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var logger=require(_0xb71a('0x0'))('dialer');var cmHopper=require(_0xb71a('0x1'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0xb71a('0x2'));var cmHopperHistory=require(_0xb71a('0x3'));function inspectError(_0x20fd9c){return util[_0xb71a('0x4')](_0x20fd9c,{'showHidden':![],'depth':null});}function getContactDialer(_0x37ce74,_0x3c6438,_0x2192e8){return cmHopper[_0xb71a('0x5')](_0x37ce74['id'],_0x3c6438,_0x2192e8,_0x37ce74[_0xb71a('0x6')])[_0xb71a('0x7')](function(_0x4358ce){_0x37ce74[_0xb71a('0x8')]=0x0;logger[_0xb71a('0x9')](_0xb71a('0xa'),inspectError(_0x4358ce));});}exports[_0xb71a('0x5')]=getContactDialer;function getContactDialerIvr(_0xbfef18,_0x378c96){return cmHopper[_0xb71a('0xb')](_0xbfef18['id'],_0x378c96,_0xbfef18['dialOrderByScheduledAt'])[_0xb71a('0x7')](function(_0x58956d){_0xbfef18[_0xb71a('0x8')]=0x0;logger[_0xb71a('0x9')](_0xb71a('0xc'),inspectError(_0x58956d));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x3909b4){return cmHopper['countReScheduled'](_0x3909b4)[_0xb71a('0x7')](function(_0x50030d){logger['error'](_0xb71a('0xd'),inspectError(_0x50030d));});}exports[_0xb71a('0xe')]=countReScheduled;function rescheduleContact(_0x315ca8){return cmHopper[_0xb71a('0xf')](_0x315ca8)['catch'](function(_0x47ee48){logger['error'](_0xb71a('0x10'),inspectError(_0x47ee48));});}exports[_0xb71a('0xf')]=rescheduleContact;function unlockContact(_0x15252a,_0x42fc55,_0x3cd0f0){return cmHopper[_0xb71a('0x11')](_0x15252a,_0x42fc55,_0x3cd0f0)[_0xb71a('0x7')](function(_0x2ec64a){logger[_0xb71a('0x9')]('[unlockContact]',inspectError(_0x2ec64a));});}exports[_0xb71a('0x11')]=unlockContact;function moveContactManagedDialer(_0x2d6369){return cmHopper[_0xb71a('0x12')](_0x2d6369)[_0xb71a('0x7')](function(_0x2bdb61){logger[_0xb71a('0x9')](_0xb71a('0x13'),inspectError(_0x2bdb61));});}exports[_0xb71a('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x20bdfe){return cmHopperBlack[_0xb71a('0x14')](_0x20bdfe)[_0xb71a('0x7')](function(_0x494899){logger['error'](_0xb71a('0x15'),inspectError(_0x494899));});}exports[_0xb71a('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x4a4f4e){return cmHopperBlack['checkIsBlackListIvr'](_0x4a4f4e)[_0xb71a('0x7')](function(_0x4fe4fb){logger[_0xb71a('0x9')](_0xb71a('0x16'),inspectError(_0x4fe4fb));});}exports[_0xb71a('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x18fa8d,_0x38a728,_0x14b2a1){return cmHopperAdditionalPhone[_0xb71a('0x18')](_0x18fa8d,_0x38a728,_0x14b2a1)[_0xb71a('0x7')](function(_0x5f3f19){logger[_0xb71a('0x9')](_0xb71a('0x19'),inspectError(_0x5f3f19));});}exports[_0xb71a('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0xa0743a,_0x3401f7,_0x1a010d){return cmHopperAdditionalPhone[_0xb71a('0x1a')](_0xa0743a,_0x3401f7,_0x1a010d)[_0xb71a('0x7')](function(_0x31085b){logger[_0xb71a('0x9')](_0xb71a('0x1b'),inspectError(_0x31085b));});}exports[_0xb71a('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x160f0f){return cmHopperHistory['avgHandleTime'](_0x160f0f)[_0xb71a('0x7')](function(_0x39d874){logger[_0xb71a('0x9')](_0xb71a('0x1c'),inspectError(_0x39d874));});}exports[_0xb71a('0x1d')]=avgHandleTime;function createHistory(_0x38178c){return cmHopperHistory[_0xb71a('0x1e')](_0x38178c)[_0xb71a('0x7')](function(_0x42c086){logger[_0xb71a('0x9')](_0xb71a('0x1f'),inspectError(_0x42c086));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x6455=['[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones'];(function(_0x20d57c,_0x3c4206){var _0x181dc9=function(_0xcf3bc0){while(--_0xcf3bc0){_0x20d57c['push'](_0x20d57c['shift']());}};_0x181dc9(++_0x3c4206);}(_0x6455,0x97));var _0x5645=function(_0x127178,_0x354187){_0x127178=_0x127178-0x0;var _0x4cc403=_0x6455[_0x127178];return _0x4cc403;};'use strict';var util=require(_0x5645('0x0'));var logger=require('../../../../config/logger')(_0x5645('0x1'));var cmHopper=require(_0x5645('0x2'));var cmHopperAdditionalPhone=require(_0x5645('0x3'));var cmHopperBlack=require(_0x5645('0x4'));var cmHopperHistory=require(_0x5645('0x5'));function inspectError(_0x35c21e){return util['inspect'](_0x35c21e,{'showHidden':![],'depth':null});}function getContactDialer(_0x233875,_0x29cefe,_0x282ef3){return cmHopper[_0x5645('0x6')](_0x233875['id'],_0x29cefe,_0x282ef3,_0x233875[_0x5645('0x7')])[_0x5645('0x8')](function(_0xa14a06){_0x233875[_0x5645('0x9')]=0x0;logger['error']('[getContactDialer]',inspectError(_0xa14a06));});}exports[_0x5645('0x6')]=getContactDialer;function getContactDialerIvr(_0x37c03a,_0x38c07a){return cmHopper[_0x5645('0xa')](_0x37c03a['id'],_0x38c07a,_0x37c03a[_0x5645('0x7')])[_0x5645('0x8')](function(_0x587c61){_0x37c03a[_0x5645('0x9')]=0x0;logger[_0x5645('0xb')](_0x5645('0xc'),inspectError(_0x587c61));});}exports[_0x5645('0xa')]=getContactDialerIvr;function countReScheduled(_0x5a6092){return cmHopper[_0x5645('0xd')](_0x5a6092)['catch'](function(_0x42f5cd){logger[_0x5645('0xb')](_0x5645('0xe'),inspectError(_0x42f5cd));});}exports[_0x5645('0xd')]=countReScheduled;function rescheduleContact(_0x2d982f){return cmHopper[_0x5645('0xf')](_0x2d982f)[_0x5645('0x8')](function(_0x2270a1){logger['error'](_0x5645('0x10'),inspectError(_0x2270a1));});}exports[_0x5645('0xf')]=rescheduleContact;function unlockContact(_0x25863f,_0x4cbd46,_0x4b3be6){return cmHopper[_0x5645('0x11')](_0x25863f,_0x4cbd46,_0x4b3be6)[_0x5645('0x8')](function(_0x511aed){logger[_0x5645('0xb')](_0x5645('0x12'),inspectError(_0x511aed));});}exports[_0x5645('0x11')]=unlockContact;function moveContactManagedDialer(_0x5179fd){return cmHopper[_0x5645('0x13')](_0x5179fd)[_0x5645('0x8')](function(_0x22a6cf){logger[_0x5645('0xb')]('[moveContactManagedDialer]',inspectError(_0x22a6cf));});}exports[_0x5645('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x52ac46){return cmHopperBlack['checkIsBlackList'](_0x52ac46)[_0x5645('0x8')](function(_0x1e2cba){logger[_0x5645('0xb')]('[checkIsBlackList]',inspectError(_0x1e2cba));});}exports[_0x5645('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x50ed38){return cmHopperBlack[_0x5645('0x15')](_0x50ed38)['catch'](function(_0x4f82d0){logger[_0x5645('0xb')]('[checkIsBlackListIvr]',inspectError(_0x4f82d0));});}exports[_0x5645('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x379cbd,_0x502c2e,_0x18680f){return cmHopperAdditionalPhone[_0x5645('0x16')](_0x379cbd,_0x502c2e,_0x18680f)[_0x5645('0x8')](function(_0x50fa82){logger[_0x5645('0xb')](_0x5645('0x17'),inspectError(_0x50fa82));});}exports[_0x5645('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x46b33a,_0x568fd6,_0x4bc484){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x46b33a,_0x568fd6,_0x4bc484)['catch'](function(_0x472982){logger['error']('[swapAdditionalPhone]',inspectError(_0x472982));});}exports[_0x5645('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x12f43a){return cmHopperHistory[_0x5645('0x19')](_0x12f43a)[_0x5645('0x8')](function(_0x3a5c61){logger[_0x5645('0xb')](_0x5645('0x1a'),inspectError(_0x3a5c61));});}exports[_0x5645('0x19')]=avgHandleTime;function createHistory(_0x4493e6){return cmHopperHistory[_0x5645('0x1b')](_0x4493e6)[_0x5645('0x8')](function(_0x2154a7){logger[_0x5645('0xb')](_0x5645('0x1c'),inspectError(_0x2154a7));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index b2de5c0..58ce0fe 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c5e=['Intervals','NULL_INTERVAL','UNKNOWN_TIMEZONE','reachable','TrunkBackup','includes','status','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','match','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','toString','error','decrementOriginate','erlangb','checkContactLowerLimitOriginate','tags','undefined','length','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval'];(function(_0x3a781c,_0x4bad1a){var _0x5a4557=function(_0x45475d){while(--_0x45475d){_0x3a781c['push'](_0x3a781c['shift']());}};_0x5a4557(++_0x4bad1a);}(_0x4c5e,0x1b9));var _0xe4c5=function(_0x35bd33,_0x2d26ab){_0x35bd33=_0x35bd33-0x0;var _0x501f27=_0x4c5e[_0x35bd33];return _0x501f27;};'use strict';var _=require(_0xe4c5('0x0'));var moment=require(_0xe4c5('0x1'));var util=require(_0xe4c5('0x2'));var logger=require(_0xe4c5('0x3'))(_0xe4c5('0x4'));var timezones=require(_0xe4c5('0x5'))[_0xe4c5('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0xe4c5('0x7'),'BLACKLIST':_0xe4c5('0x8'),'CONTACTS_RESCHEDULED':_0xe4c5('0x9'),'DEACTIVATED':_0xe4c5('0xa'),'DISACTIVED':_0xe4c5('0xb'),'EMPTY_INTERVAL':_0xe4c5('0xc'),'INACTIVE':_0xe4c5('0xd'),'NO_AGENTS_LOGGED':_0xe4c5('0xe'),'NO_AVAILABLE_CONTACTS':_0xe4c5('0xf'),'NULL_INTERVAL':_0xe4c5('0x10'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xe4c5('0x11'),'RECALL_TIMEOUT':_0xe4c5('0x12'),'RUNNING':_0xe4c5('0x13'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xe4c5('0x14')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3e62e9){return _0x3e62e9[_0xe4c5('0x15')]===_0xe4c5('0x16');}exports[_0xe4c5('0x17')]=isPreviewCampaign;function isIVRCampaign(_0x16ffcc){return _0x16ffcc[_0xe4c5('0x18')]===_0xe4c5('0x19');}exports[_0xe4c5('0x1a')]=isIVRCampaign;function isOutboundQueue(_0x183f2c){return _0x183f2c['type']==='outbound';}exports[_0xe4c5('0x1b')]=isOutboundQueue;function isQueueCampaignActive(_0x56f8ea){return _0x56f8ea[_0xe4c5('0x1c')];}exports[_0xe4c5('0x1d')]=isQueueCampaignActive;function isIVRCampaignActive(_0x151677){return _0x151677[_0xe4c5('0x1e')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x53b861,_0x2d2b25){var _0x495812=moment(_0x53b861)[_0xe4c5('0x1f')](0x0);var _0x66e610=moment(_0x2d2b25)['milliseconds'](0x0);return _0x495812[_0xe4c5('0x20')](_0x66e610,'seconds');}exports[_0xe4c5('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x1e5bd8,_0x4506e5){var _0x28df32=![];var _0x220aff=_0x1e5bd8[_0xe4c5('0x15')]!==_0x4506e5[_0xe4c5('0x15')]||_0x1e5bd8[_0xe4c5('0x1c')]!==_0x4506e5[_0xe4c5('0x1c')]||_0x1e5bd8['message']!==_0x4506e5[_0xe4c5('0x22')];var _0x4381cd=_0x1e5bd8['available']!==_0x4506e5[_0xe4c5('0x23')]||_0x1e5bd8[_0xe4c5('0x24')]!==_0x4506e5['loggedIn']||_0x1e5bd8[_0xe4c5('0x25')]!==_0x4506e5[_0xe4c5('0x25')]||_0x1e5bd8[_0xe4c5('0x26')]!==_0x4506e5[_0xe4c5('0x26')]||_0x1e5bd8[_0xe4c5('0x27')]!==_0x4506e5[_0xe4c5('0x27')]||_0x1e5bd8['pTalking']!==_0x4506e5[_0xe4c5('0x28')]||_0x1e5bd8[_0xe4c5('0x29')]!==_0x4506e5[_0xe4c5('0x29')]||_0x1e5bd8['inUse']!==_0x4506e5[_0xe4c5('0x2a')]||_0x1e5bd8[_0xe4c5('0x2b')]!==_0x4506e5[_0xe4c5('0x2b')];if(_0x1e5bd8[_0xe4c5('0x2c')]&&_0x4506e5[_0xe4c5('0x2c')]){_0x28df32=_0x1e5bd8[_0xe4c5('0x2c')][_0xe4c5('0x2d')]!==_0x4506e5[_0xe4c5('0x2c')][_0xe4c5('0x2d')]||_0x1e5bd8['Trunk'][_0xe4c5('0x1e')]!==_0x4506e5[_0xe4c5('0x2c')][_0xe4c5('0x1e')];}return _0x220aff||_0x4381cd||_0x28df32;}exports[_0xe4c5('0x2e')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x39bc9d){var _0x2ac73a=null;var _0xaddb08=_0x39bc9d[_0xe4c5('0x2f')];if(_['isNil'](_0x39bc9d[_0xe4c5('0x30')])||_[_0xe4c5('0x31')](_0x39bc9d['Interval'])||_[_0xe4c5('0x31')](_0x39bc9d[_0xe4c5('0x32')][_0xe4c5('0x33')])){_0x2ac73a=CAMPAIGN_STATUS[_0xe4c5('0x34')];}else if(_['isEmpty'](_0x39bc9d[_0xe4c5('0x30')])||_['isEmpty'](_0x39bc9d['Interval'][_0xe4c5('0x33')])){_0x2ac73a=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0xaddb08&&!timezones[_0xaddb08]){_0x2ac73a=CAMPAIGN_STATUS[_0xe4c5('0x35')];}return _0x2ac73a;}function checkAnyValidTrunk(_0x383c4b,_0x25fe16){var _0x18845f=null;var _0x155188='SIP/';var _0x375eaa=[_0xe4c5('0x36'),'unmonitored'];var _0x338591=!![];if(_0x383c4b[_0xe4c5('0x2c')]&&_0x383c4b[_0xe4c5('0x2c')][_0xe4c5('0x1e')]){_0x155188+=_0x383c4b[_0xe4c5('0x2c')][_0xe4c5('0x2d')];_0x18845f=_0x25fe16[_0x155188];_0x338591=_0x375eaa['includes'](_0x18845f['status']);}else if(_0x383c4b[_0xe4c5('0x37')]&&_0x383c4b[_0xe4c5('0x37')]['active']){_0x155188+=_0x383c4b[_0xe4c5('0x37')][_0xe4c5('0x2d')];_0x18845f=_0x25fe16[_0x155188];_0x338591=_0x375eaa[_0xe4c5('0x38')](_0x18845f[_0xe4c5('0x39')]);}return _0x338591;}function getQueueCampaignStatusMessage(_0x362e64,_0xa97b38){var _0x5c5441=CAMPAIGN_STATUS['ACTIVE'];var _0x4ecc48=isPreviewCampaign(_0x362e64);if(!isQueueCampaignActive(_0x362e64)){if(_0x4ecc48){_0x5c5441=CAMPAIGN_STATUS[_0xe4c5('0x3a')];}else{if(_0x362e64[_0xe4c5('0x2b')]===0x0&&_0x362e64[_0xe4c5('0x27')]===0x0&&_0x362e64[_0xe4c5('0x29')]===0x0&&(_0x362e64[_0xe4c5('0x28')]||0x0)===0x0){_0x5c5441=CAMPAIGN_STATUS[_0xe4c5('0x3a')];}else{_0x5c5441=CAMPAIGN_STATUS[_0xe4c5('0x3b')];}}}else if(_0x362e64[_0xe4c5('0x24')]===0x0){_0x5c5441=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x362e64,_0xa97b38)){_0x5c5441=CAMPAIGN_STATUS[_0xe4c5('0x3c')];}else if(!isPreviewCampaign(_0x362e64)){var _0x2e1bd4=checkAnyValidQueueCampaignInterval(_0x362e64);if(_0x2e1bd4){_0x5c5441=_0x2e1bd4;}}return _0x5c5441;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2cd59d){var _0x51d4b1=CAMPAIGN_STATUS[_0xe4c5('0x3b')];if(_0x2cd59d[_0xe4c5('0x2b')]===0x0&&_0x2cd59d[_0xe4c5('0x27')]===0x0&&_0x2cd59d[_0xe4c5('0x29')]===0x0&&(_0x2cd59d[_0xe4c5('0x28')]||0x0)===0x0){_0x51d4b1=CAMPAIGN_STATUS[_0xe4c5('0x3a')];}return _0x51d4b1;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1f75ae){var _0x4816b7=_0x1f75ae[_0xe4c5('0x3d')](/"(.*?)"/);return _0x4816b7?_0x4816b7[0x1]:_0x1f75ae;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x98dd36,_0x444a20,_0x427482){if(!_[_0xe4c5('0x3e')](_0x427482)&&typeof _0x427482===_0xe4c5('0x3f')&&!_[_0xe4c5('0x40')](_0x427482)){if(!_[_0xe4c5('0x3e')](_0x444a20)&&typeof _0x444a20===_0xe4c5('0x3f')&&!_[_0xe4c5('0x40')](_0x444a20)){return util[_0xe4c5('0x41')](_0xe4c5('0x42'),_0x444a20,_0x427482);}return util[_0xe4c5('0x41')](_0xe4c5('0x42'),_0x427482,_0x427482);}if(!_['isUndefined'](_0x98dd36)&&typeof _0x98dd36===_0xe4c5('0x3f')&&!_[_0xe4c5('0x40')](_0x98dd36)){return _0x98dd36;}return _0xe4c5('0x43');}exports[_0xe4c5('0x44')]=getCallerId;function getCallerIdRandom(_0x51ff3d,_0x367f1b){var _0x460659;var _0x58e33e;var _0x4866ca;if(_0x367f1b<=0x0){_0x367f1b=0x1;}_0x460659=new RegExp('\x5cw{0,'+_0x367f1b+'}$');_0x58e33e=Math[_0xe4c5('0x45')](0xa,_0x367f1b-0x1);_0x4866ca=Math[_0xe4c5('0x45')](0xa,_0x367f1b)-0x1;return util[_0xe4c5('0x41')]('%s',_[_0xe4c5('0x46')](_0x51ff3d,_0x460659,_['random'](_0x58e33e,_0x4866ca)[_0xe4c5('0x47')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x5b2a68){if(_0x5b2a68['originated']&&_0x5b2a68[_0xe4c5('0x2b')]>0x0){_0x5b2a68[_0xe4c5('0x2b')]-=0x1;}else{logger[_0xe4c5('0x48')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0xe4c5('0x49')]=decrementOriginate;function checkContactEmpty(_0x3c8df7){return _0x3c8df7&&_0x3c8df7['length']>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x2d00ce,_0x16fd6f){if(_0x16fd6f===0x0){return 0x0;}var _0x30261e=0x1;for(var _0xeab4d3=0x1;_0xeab4d3<=_0x16fd6f;_0xeab4d3+=0x1){_0x30261e=0x1+_0x30261e*_0xeab4d3/_0x2d00ce;}return 0x1/_0x30261e;}exports[_0xe4c5('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x58b6fe,_0x14597d,_0x38cf33){if(_0x14597d>_0x38cf33){for(var _0x295e1f=0x0;_0x295e1f<_0x14597d-_0x38cf33;_0x295e1f+=0x1){decrementOriginate(_0x58b6fe);}}}exports[_0xe4c5('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x454f08){var _0x3d29ef={};var _0x2b8b15=['id','createdAt',_0xe4c5('0x4c'),'updatedAt'];const _0x1897c9=0xfa;if(_0x454f08){for(var _0x2b4d23 in _0x454f08){if(typeof _0x454f08[_0x2b4d23]!==_0xe4c5('0x4d')){if(!_[_0xe4c5('0x31')](_0x454f08[_0x2b4d23])&&!_0x2b8b15[_0xe4c5('0x38')](_0x2b4d23)){if(_0x2b4d23==='description'&&_0x454f08[_0x2b4d23][_0xe4c5('0x4e')]>_0x1897c9){_0x3d29ef[_0xe4c5('0x4f')+_0x2b4d23[_0xe4c5('0x50')]()]=_0x454f08[_0x2b4d23][_0xe4c5('0x47')]()['substring'](0x0,_0x1897c9);}else{_0x3d29ef[_0xe4c5('0x4f')+_0x2b4d23['toUpperCase']()]=_0x454f08[_0x2b4d23];}}}}}return _0x3d29ef;}exports[_0xe4c5('0x51')]=setXMDContactVariables; \ No newline at end of file +var _0x2672=['toUpperCase','substring','setXMDContactVariables','util','../../../../config/logger','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','tags','undefined','description','XMD-'];(function(_0xdac13f,_0x4cb23d){var _0x4e7584=function(_0x3f3b92){while(--_0x3f3b92){_0xdac13f['push'](_0xdac13f['shift']());}};_0x4e7584(++_0x4cb23d);}(_0x2672,0x10b));var _0x2267=function(_0x20df65,_0x18c4d3){_0x20df65=_0x20df65-0x0;var _0x42506b=_0x2672[_0x20df65];return _0x42506b;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x2267('0x0'));var logger=require(_0x2267('0x1'))('dialer');var timezones=require(_0x2267('0x2'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x2267('0x3'),'BLACKLIST':_0x2267('0x4'),'CONTACTS_RESCHEDULED':_0x2267('0x5'),'DEACTIVATED':_0x2267('0x6'),'DISACTIVED':_0x2267('0x7'),'EMPTY_INTERVAL':_0x2267('0x8'),'INACTIVE':_0x2267('0x9'),'NO_AGENTS_LOGGED':_0x2267('0xa'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x2267('0xb'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x2267('0xc'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x2267('0xd'),'UNKNOWN_TIMEZONE':_0x2267('0xe'),'UNREACHABLE_TRUNK':_0x2267('0xf')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x49f4c2){return _0x49f4c2['dialMethod']==='preview';}exports[_0x2267('0x10')]=isPreviewCampaign;function isIVRCampaign(_0x30c49c){return _0x30c49c[_0x2267('0x11')]===_0x2267('0x12');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x1b87cd){return _0x1b87cd[_0x2267('0x11')]===_0x2267('0x13');}exports[_0x2267('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x511e79){return _0x511e79['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0xe310ac){return _0xe310ac[_0x2267('0x15')];}exports[_0x2267('0x16')]=isIVRCampaignActive;function getSeconds(_0x3ba0d7,_0x20ae4f){var _0x17e011=moment(_0x3ba0d7)[_0x2267('0x17')](0x0);var _0x4a68f6=moment(_0x20ae4f)[_0x2267('0x17')](0x0);return _0x17e011[_0x2267('0x18')](_0x4a68f6,_0x2267('0x19'));}exports[_0x2267('0x1a')]=getSeconds;function hasQueueCampaignDataChanged(_0x325da7,_0x4d9703){var _0x130b7d=![];var _0x57d8cc=_0x325da7[_0x2267('0x1b')]!==_0x4d9703[_0x2267('0x1b')]||_0x325da7[_0x2267('0x1c')]!==_0x4d9703[_0x2267('0x1c')]||_0x325da7['message']!==_0x4d9703[_0x2267('0x1d')];var _0x1cf334=_0x325da7[_0x2267('0x1e')]!==_0x4d9703[_0x2267('0x1e')]||_0x325da7[_0x2267('0x1f')]!==_0x4d9703['loggedIn']||_0x325da7[_0x2267('0x20')]!==_0x4d9703[_0x2267('0x20')]||_0x325da7['paused']!==_0x4d9703[_0x2267('0x21')]||_0x325da7['talking']!==_0x4d9703[_0x2267('0x22')]||_0x325da7['pTalking']!==_0x4d9703[_0x2267('0x23')]||_0x325da7[_0x2267('0x24')]!==_0x4d9703[_0x2267('0x24')]||_0x325da7['inUse']!==_0x4d9703[_0x2267('0x25')]||_0x325da7[_0x2267('0x26')]!==_0x4d9703[_0x2267('0x26')];if(_0x325da7[_0x2267('0x27')]&&_0x4d9703['Trunk']){_0x130b7d=_0x325da7['Trunk'][_0x2267('0x28')]!==_0x4d9703[_0x2267('0x27')]['name']||_0x325da7[_0x2267('0x27')][_0x2267('0x15')]!==_0x4d9703[_0x2267('0x27')][_0x2267('0x15')];}return _0x57d8cc||_0x1cf334||_0x130b7d;}exports[_0x2267('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x207cb0){var _0x48deb4=null;var _0x4ce025=_0x207cb0[_0x2267('0x2a')];if(_['isNil'](_0x207cb0['dialGlobalInterval'])||_[_0x2267('0x2b')](_0x207cb0['Interval'])||_[_0x2267('0x2b')](_0x207cb0[_0x2267('0x2c')][_0x2267('0x2d')])){_0x48deb4=CAMPAIGN_STATUS[_0x2267('0x2e')];}else if(_[_0x2267('0x2f')](_0x207cb0[_0x2267('0x30')])||_[_0x2267('0x2f')](_0x207cb0['Interval']['Intervals'])){_0x48deb4=CAMPAIGN_STATUS[_0x2267('0x31')];}else if(_0x4ce025&&!timezones[_0x4ce025]){_0x48deb4=CAMPAIGN_STATUS[_0x2267('0x32')];}return _0x48deb4;}function checkAnyValidTrunk(_0x4f975e,_0x21eb1e){var _0x403d84=null;var _0x2d9cc5='SIP/';var _0x35ff8a=[_0x2267('0x33'),'unmonitored'];var _0x506976=!![];if(_0x4f975e['Trunk']&&_0x4f975e[_0x2267('0x27')][_0x2267('0x15')]){_0x2d9cc5+=_0x4f975e['Trunk'][_0x2267('0x28')];_0x403d84=_0x21eb1e[_0x2d9cc5];_0x506976=_0x35ff8a['includes'](_0x403d84[_0x2267('0x34')]);}else if(_0x4f975e[_0x2267('0x35')]&&_0x4f975e[_0x2267('0x35')][_0x2267('0x15')]){_0x2d9cc5+=_0x4f975e[_0x2267('0x35')][_0x2267('0x28')];_0x403d84=_0x21eb1e[_0x2d9cc5];_0x506976=_0x35ff8a[_0x2267('0x36')](_0x403d84[_0x2267('0x34')]);}return _0x506976;}function getQueueCampaignStatusMessage(_0x6051b2,_0x19bd1c){var _0x112779=CAMPAIGN_STATUS[_0x2267('0x3')];var _0x328202=isPreviewCampaign(_0x6051b2);if(!isQueueCampaignActive(_0x6051b2)){if(_0x328202){_0x112779=CAMPAIGN_STATUS[_0x2267('0x37')];}else{if(_0x6051b2[_0x2267('0x26')]===0x0&&_0x6051b2[_0x2267('0x22')]===0x0&&_0x6051b2[_0x2267('0x24')]===0x0&&(_0x6051b2[_0x2267('0x23')]||0x0)===0x0){_0x112779=CAMPAIGN_STATUS['INACTIVE'];}else{_0x112779=CAMPAIGN_STATUS[_0x2267('0x38')];}}}else if(_0x6051b2[_0x2267('0x1f')]===0x0){_0x112779=CAMPAIGN_STATUS[_0x2267('0x39')];}else if(!checkAnyValidTrunk(_0x6051b2,_0x19bd1c)){_0x112779=CAMPAIGN_STATUS[_0x2267('0x3a')];}else if(!isPreviewCampaign(_0x6051b2)){var _0x1af985=checkAnyValidQueueCampaignInterval(_0x6051b2);if(_0x1af985){_0x112779=_0x1af985;}}return _0x112779;}exports[_0x2267('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3fd39c){var _0xe192fb=CAMPAIGN_STATUS[_0x2267('0x38')];if(_0x3fd39c[_0x2267('0x26')]===0x0&&_0x3fd39c[_0x2267('0x22')]===0x0&&_0x3fd39c['waiting']===0x0&&(_0x3fd39c[_0x2267('0x23')]||0x0)===0x0){_0xe192fb=CAMPAIGN_STATUS[_0x2267('0x37')];}return _0xe192fb;}exports[_0x2267('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x324808){var _0x4886a8=_0x324808[_0x2267('0x3d')](/"(.*?)"/);return _0x4886a8?_0x4886a8[0x1]:_0x324808;}exports[_0x2267('0x3e')]=extractCalleridName;function getCallerId(_0x4673bc,_0x3fa9ca,_0x27e41d){if(!_[_0x2267('0x3f')](_0x27e41d)&&typeof _0x27e41d===_0x2267('0x40')&&!_[_0x2267('0x2f')](_0x27e41d)){if(!_[_0x2267('0x3f')](_0x3fa9ca)&&typeof _0x3fa9ca==='string'&&!_[_0x2267('0x2f')](_0x3fa9ca)){return util[_0x2267('0x41')](_0x2267('0x42'),_0x3fa9ca,_0x27e41d);}return util[_0x2267('0x41')]('\x22%s\x22\x20<%s>',_0x27e41d,_0x27e41d);}if(!_[_0x2267('0x3f')](_0x4673bc)&&typeof _0x4673bc===_0x2267('0x40')&&!_[_0x2267('0x2f')](_0x4673bc)){return _0x4673bc;}return _0x2267('0x43');}exports[_0x2267('0x44')]=getCallerId;function getCallerIdRandom(_0x29357c,_0xbe52c3){var _0x5d6017;var _0x2b2239;var _0x1239ed;if(_0xbe52c3<=0x0){_0xbe52c3=0x1;}_0x5d6017=new RegExp(_0x2267('0x45')+_0xbe52c3+'}$');_0x2b2239=Math[_0x2267('0x46')](0xa,_0xbe52c3-0x1);_0x1239ed=Math[_0x2267('0x46')](0xa,_0xbe52c3)-0x1;return util['format']('%s',_['replace'](_0x29357c,_0x5d6017,_[_0x2267('0x47')](_0x2b2239,_0x1239ed)[_0x2267('0x48')]()));}exports[_0x2267('0x49')]=getCallerIdRandom;function decrementOriginate(_0x23cc37){if(_0x23cc37[_0x2267('0x26')]&&_0x23cc37['originated']>0x0){_0x23cc37[_0x2267('0x26')]-=0x1;}else{logger[_0x2267('0x4a')](_0x2267('0x4b'));}}exports[_0x2267('0x4c')]=decrementOriginate;function checkContactEmpty(_0x2e36de){return _0x2e36de&&_0x2e36de[_0x2267('0x4d')]>0x0;}exports[_0x2267('0x4e')]=checkContactEmpty;function erlangb(_0x465e2c,_0x5180d2){if(_0x5180d2===0x0){return 0x0;}var _0x37c079=0x1;for(var _0x51a98c=0x1;_0x51a98c<=_0x5180d2;_0x51a98c+=0x1){_0x37c079=0x1+_0x37c079*_0x51a98c/_0x465e2c;}return 0x1/_0x37c079;}exports[_0x2267('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x317f35,_0x3c2f22,_0x324852){if(_0x3c2f22>_0x324852){for(var _0x256dcf=0x0;_0x256dcf<_0x3c2f22-_0x324852;_0x256dcf+=0x1){decrementOriginate(_0x317f35);}}}exports[_0x2267('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x21d7f5){var _0x3373e3={};var _0x172da4=['id','createdAt',_0x2267('0x51'),'updatedAt'];const _0x560f41=0xfa;if(_0x21d7f5){for(var _0x34a9b2 in _0x21d7f5){if(typeof _0x21d7f5[_0x34a9b2]!==_0x2267('0x52')){if(!_[_0x2267('0x2b')](_0x21d7f5[_0x34a9b2])&&!_0x172da4[_0x2267('0x36')](_0x34a9b2)){if(_0x34a9b2===_0x2267('0x53')&&_0x21d7f5[_0x34a9b2][_0x2267('0x4d')]>_0x560f41){_0x3373e3[_0x2267('0x54')+_0x34a9b2[_0x2267('0x55')]()]=_0x21d7f5[_0x34a9b2]['toString']()[_0x2267('0x56')](0x0,_0x560f41);}else{_0x3373e3[_0x2267('0x54')+_0x34a9b2[_0x2267('0x55')]()]=_0x21d7f5[_0x34a9b2];}}}}}return _0x3373e3;}exports[_0x2267('0x57')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 0cfdada..01a2ed8 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(_0x231128,_0x7b5bdb){var _0x4bf137=function(_0x20dfcb){while(--_0x20dfcb){_0x231128['push'](_0x231128['shift']());}};_0x4bf137(++_0x7b5bdb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x36f9a3,_0xa80747){var _0x3ecdfd=function(_0x19e3bc){while(--_0x19e3bc){_0x36f9a3['push'](_0x36f9a3['shift']());}};_0x3ecdfd(++_0xa80747);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 a819bde..7a00f1d 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 _0xbd90=['[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','deleteChannelAfterTimeout','exports','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','newstate','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncOriginateResponse','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','syncVarSet','variable','value','syncNewState','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','then','notify','\x20notify\x20','stringify','catch','error','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored'];(function(_0xb96557,_0x17f6e5){var _0x5d1f39=function(_0x57fbd7){while(--_0x57fbd7){_0xb96557['push'](_0xb96557['shift']());}};_0x5d1f39(++_0x17f6e5);}(_0xbd90,0x81));var _0x0bd9=function(_0x3e8804,_0x4f5297){_0x3e8804=_0x3e8804-0x0;var _0x239bb1=_0xbd90[_0x3e8804];return _0x239bb1;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x0bd9('0x0'));var path=require(_0x0bd9('0x1'));var tiff2pdf=require(_0x0bd9('0x2'));var gs=require(_0x0bd9('0x3'));var logger=require(_0x0bd9('0x4'))(_0x0bd9('0x5'));var ami=require(_0x0bd9('0x6'));var rpcDb=require(_0x0bd9('0x7'));var Channel=require(_0x0bd9('0x8'));var ut=require(_0x0bd9('0x9'));var Action=require(_0x0bd9('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x0bd9('0xb'));function Fax(_0x6b721b){this[_0x0bd9('0xc')]={};this['faxAccounts']=_0x6b721b[_0x0bd9('0xd')];this['trunks']=_0x6b721b[_0x0bd9('0xe')];this[_0x0bd9('0xf')]={};ami['on']('newchannel',this[_0x0bd9('0x10')][_0x0bd9('0x11')](this));ami['on']('varset',this['syncVarSet'][_0x0bd9('0x11')](this));ami['on'](_0x0bd9('0x12'),this['syncNewState'][_0x0bd9('0x11')](this));ami['on'](_0x0bd9('0x13'),this['syncNewExten'][_0x0bd9('0x11')](this));ami['on'](_0x0bd9('0x14'),this[_0x0bd9('0x15')]['bind'](this));ami['on'](_0x0bd9('0x16'),this[_0x0bd9('0x17')][_0x0bd9('0x11')](this));ami['on']('hangup',this['syncHangup'][_0x0bd9('0x11')](this));ami['on']('originateresponse',this[_0x0bd9('0x18')][_0x0bd9('0x11')](this));}Fax['prototype'][_0x0bd9('0x10')]=function(_0x364bda){if(_0x364bda[_0x0bd9('0x19')]==='from-voip-provider'){for(var _0x589938 in this['faxAccounts']){if(this[_0x0bd9('0xd')][_0x0bd9('0x1a')](_0x589938)){if(_0x364bda[_0x0bd9('0x1b')]===this['faxAccounts'][_0x589938][_0x0bd9('0x1c')]){this[_0x0bd9('0xc')][_0x364bda[_0x0bd9('0x1d')]]={};this['channels'][_0x364bda[_0x0bd9('0x1d')]]['channel']=_0x364bda[_0x0bd9('0x1e')];this[_0x0bd9('0xc')][_0x364bda['uniqueid']]['id']=this['faxAccounts'][_0x589938]['id'];this[_0x0bd9('0xc')][_0x364bda[_0x0bd9('0x1d')]][_0x0bd9('0x1f')]=this[_0x0bd9('0xd')][_0x589938]['name'];logger['info'](_0x364bda[_0x0bd9('0x1d')],_0x0bd9('0x20'));}}}}if(this[_0x0bd9('0xf')][_0x364bda['uniqueid']]){this[_0x0bd9('0xc')][_0x364bda[_0x0bd9('0x1d')]]={};this[_0x0bd9('0xc')][_0x364bda[_0x0bd9('0x1d')]][_0x0bd9('0x1e')]=_0x364bda['channel'];logger[_0x0bd9('0x21')](_0x364bda[_0x0bd9('0x1d')],_0x0bd9('0x20'));}};Fax[_0x0bd9('0x22')][_0x0bd9('0x23')]=function(_0x25072a){if(this[_0x0bd9('0xc')][_0x25072a[_0x0bd9('0x1d')]]){for(var _0x483b61 in _0x25072a[_0x0bd9('0x24')]){if(_0x25072a[_0x0bd9('0x24')][_0x0bd9('0x1a')](_0x483b61)){this[_0x0bd9('0xc')][_0x25072a[_0x0bd9('0x1d')]][_0x483b61]=_0x25072a[_0x0bd9('0x25')];}}}};Fax['prototype'][_0x0bd9('0x26')]=function(_0xfbd88a){if(this[_0x0bd9('0xc')][_0xfbd88a['uniqueid']]){this[_0x0bd9('0xc')][_0xfbd88a[_0x0bd9('0x1d')]][_0x0bd9('0x27')]=_0xfbd88a[_0x0bd9('0x27')];this['channels'][_0xfbd88a['uniqueid']][_0x0bd9('0x28')]=_0xfbd88a[_0x0bd9('0x28')];}};Fax[_0x0bd9('0x22')][_0x0bd9('0x29')]=function(_0x3a1ae2){if(this['channels'][_0x3a1ae2['uniqueid']]){for(var _0x16b3cb in _0x3a1ae2[_0x0bd9('0x24')]){if(_0x3a1ae2['variable']['hasOwnProperty'](_0x16b3cb)){this[_0x0bd9('0xc')][_0x3a1ae2['uniqueid']][_0x16b3cb]=_0x3a1ae2['value'];}}}};Fax[_0x0bd9('0x22')][_0x0bd9('0x15')]=function(_0x1c0edf){if(this[_0x0bd9('0xc')][_0x1c0edf[_0x0bd9('0x1d')]]){this['channels'][_0x1c0edf[_0x0bd9('0x1d')]][_0x0bd9('0x2a')]=_0x1c0edf[_0x0bd9('0x2a')];this[_0x0bd9('0xc')][_0x1c0edf[_0x0bd9('0x1d')]][_0x0bd9('0x2b')]=_0x1c0edf[_0x0bd9('0x2b')];this[_0x0bd9('0xc')][_0x1c0edf[_0x0bd9('0x1d')]][_0x0bd9('0x1c')]=_0x1c0edf[_0x0bd9('0x1c')];this[_0x0bd9('0xc')][_0x1c0edf[_0x0bd9('0x1d')]][_0x0bd9('0x2c')]=_0x1c0edf['filename'];logger[_0x0bd9('0x21')](_0x1c0edf['uniqueid'],_0x0bd9('0x2d'));}};Fax[_0x0bd9('0x22')][_0x0bd9('0x17')]=function(_0x26122a){var _0xf182f9=this;if(this[_0x0bd9('0xc')][_0x26122a[_0x0bd9('0x1d')]]){var _0x12d65f=this['channels'][_0x26122a[_0x0bd9('0x1d')]]['id'];this[_0x0bd9('0xc')][_0x26122a[_0x0bd9('0x1d')]][_0x0bd9('0x2e')]=_0x26122a[_0x0bd9('0x2e')];this[_0x0bd9('0xc')][_0x26122a[_0x0bd9('0x1d')]]['pagestransferred']=_0x26122a[_0x0bd9('0x2f')];this[_0x0bd9('0xc')][_0x26122a['uniqueid']][_0x0bd9('0x1c')]=_0x26122a['localstationid'];this[_0x0bd9('0xc')][_0x26122a[_0x0bd9('0x1d')]][_0x0bd9('0x30')]=_0x26122a[_0x0bd9('0x30')];this[_0x0bd9('0xc')][_0x26122a['uniqueid']]['transferrate']=_0x26122a[_0x0bd9('0x31')];this[_0x0bd9('0xc')][_0x26122a[_0x0bd9('0x1d')]]['filename']=_0x26122a[_0x0bd9('0x2c')];this[_0x0bd9('0xc')][_0x26122a[_0x0bd9('0x1d')]]['calleridnum']=_0x26122a[_0x0bd9('0x32')];if(this[_0x0bd9('0xc')][_0x26122a[_0x0bd9('0x1d')]][_0x0bd9('0x2f')]>0x0){tiff2pdf(_0x26122a[_0x0bd9('0x2c')],_0x0bd9('0x33'),function(_0x5191ec){logger[_0x0bd9('0x21')](_0x26122a[_0x0bd9('0x1d')],_0x0bd9('0x34'),_0x5191ec['message']);attachment['create']({'name':path['parse'](_0x26122a['filename'])['name'],'basename':path[_0x0bd9('0x35')](_0x26122a['filename'])[_0x0bd9('0x1f')]+_0x0bd9('0x36'),'type':'application/pdf'})[_0x0bd9('0x37')](function(_0x1e71bc){faxAccount[_0x0bd9('0x38')](_0x12d65f,{'from':_0x26122a[_0x0bd9('0x32')],'mapKey':_0x0bd9('0x5'),'body':path[_0x0bd9('0x35')](_0x26122a[_0x0bd9('0x2c')])['name']+_0x0bd9('0x36'),'AttachmentId':_0x1e71bc['id']})['catch'](function(_0x1526e5){logger['error'](_0x26122a[_0x0bd9('0x1d')],_0x0bd9('0x39'),JSON[_0x0bd9('0x3a')](_0x1526e5));});})[_0x0bd9('0x3b')](function(_0x533e10){logger[_0x0bd9('0x3c')](_0x26122a[_0x0bd9('0x1d')],_0x0bd9('0x3d'),JSON[_0x0bd9('0x3a')](_0x533e10));});});}logger[_0x0bd9('0x21')](_0x26122a['uniqueid'],_0x0bd9('0x3d'));}};Fax['prototype'][_0x0bd9('0x18')]=function(_0x2ee28a){if(this[_0x0bd9('0xf')][_0x2ee28a[_0x0bd9('0x1d')]]){_[_0x0bd9('0x3e')](this['channels'][_0x2ee28a['uniqueid']],_[_0x0bd9('0x3f')](_0x2ee28a,[_0x0bd9('0x40'),_0x0bd9('0x41')]));}};function updateStatus(_0x288772){if(_0x288772['AttachmentId']){faxMessage[_0x0bd9('0x42')](_0x288772[_0x0bd9('0x43')],{'failMessage':_0x0bd9('0x44')})[_0x0bd9('0x37')](function(_0x590779){ut[_0x0bd9('0x45')](_0x0bd9('0x46'),_0x590779);})[_0x0bd9('0x3b')](function(_0x1b3b0c){ut[_0x0bd9('0x45')](_0x0bd9('0x47'),_0x1b3b0c);});}else{ut['logger'](_0x0bd9('0x48'));}}Fax[_0x0bd9('0x22')][_0x0bd9('0x49')]=function(_0x5995ab,_0x3dd73c,_0xca9a45){var _0x528214=this;var _0x2f0d07={};if(_0x3dd73c){_0x2f0d07={'read':_0x3dd73c};}else{_0x2f0d07={'failMessage':_0xca9a45};}if(this[_0x0bd9('0xf')][_0x5995ab][_0x0bd9('0x43')]){faxMessage[_0x0bd9('0x42')](this['actions'][_0x5995ab]['AttachmentId'],_0x2f0d07)[_0x0bd9('0x37')](function(_0x248ca1){ut[_0x0bd9('0x45')](_0x0bd9('0x4a'),_0x248ca1);})[_0x0bd9('0x3b')](function(_0x3cbd75){ut['logger'](_0x0bd9('0x4b'),_0x3cbd75);})[_0x0bd9('0x4c')](function(){delete _0x528214[_0x0bd9('0xc')][_0x5995ab];delete _0x528214[_0x0bd9('0xf')][_0x5995ab];});}else{ut[_0x0bd9('0x45')](_0x0bd9('0x4d'));this['deleteChannelAfterTimeout'](_0x5995ab);delete this[_0x0bd9('0xf')][_0x5995ab];}};Fax['prototype'][_0x0bd9('0x4e')]=function(_0x17b488){var _0x875180=this;if(this[_0x0bd9('0xc')][_0x17b488['uniqueid']]){if(this[_0x0bd9('0xf')][_0x17b488[_0x0bd9('0x1d')]]){this[_0x0bd9('0xc')][_0x17b488[_0x0bd9('0x1d')]]['id']=this[_0x0bd9('0xf')][_0x17b488[_0x0bd9('0x1d')]]['id'];this[_0x0bd9('0xc')][_0x17b488['uniqueid']][_0x0bd9('0x1f')]=this[_0x0bd9('0xf')][_0x17b488[_0x0bd9('0x1d')]][_0x0bd9('0x1f')];}logger[_0x0bd9('0x21')](_0x17b488[_0x0bd9('0x1d')],this['actions'][_0x17b488['uniqueid']]?_0x0bd9('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0x0bd9('0x3a')](this[_0x0bd9('0xc')][_0x17b488[_0x0bd9('0x1d')]]));if(this[_0x0bd9('0xf')][_0x17b488[_0x0bd9('0x1d')]]){if(this[_0x0bd9('0xc')][_0x17b488[_0x0bd9('0x1d')]][_0x0bd9('0x50')]>0x0&&this[_0x0bd9('0xc')][_0x17b488[_0x0bd9('0x1d')]]['faxstatus']===_0x0bd9('0x51')){this[_0x0bd9('0x49')](_0x17b488[_0x0bd9('0x1d')],!![]);}else{this[_0x0bd9('0x49')](_0x17b488[_0x0bd9('0x1d')],![],this[_0x0bd9('0xc')][_0x17b488['uniqueid']][_0x0bd9('0x52')]?'SENDING\x20FAILED:\x20'+this[_0x0bd9('0xc')][_0x17b488[_0x0bd9('0x1d')]][_0x0bd9('0x52')]:_0x0bd9('0x53'));}}}};Fax['prototype'][_0x0bd9('0x54')]=function(_0x13c0a3){var _0x56abbc=this;return new BPromise(function(_0xcac05,_0x48a9b8){_0x56abbc[_0x0bd9('0x55')](_0x13c0a3,_0x56abbc[_0x0bd9('0xd')][_0x13c0a3['FaxAccountId']])[_0x0bd9('0x37')](function(_0x7717c3){ut[_0x0bd9('0x45')](_0x0bd9('0x56'),_0x7717c3);_0xcac05(ut[_0x0bd9('0x57')](_0x0bd9('0x58')));})['catch'](function(_0x1869cf){ut[_0x0bd9('0x45')]('[Fax][execOriginate][failure]',_0x1869cf);updateStatus(_0x13c0a3);_0x48a9b8(ut[_0x0bd9('0x57')](_0x0bd9('0x59')));});});};Fax[_0x0bd9('0x22')][_0x0bd9('0x5a')]=function(_0x25de00){var _0x26f454=this;return new BPromise(function(_0x3671a1,_0x14b0b7){var _0x58470c=_0x26f454[_0x0bd9('0x5b')](_0x26f454[_0x0bd9('0xd')][_0x25de00[_0x0bd9('0x5c')]][_0x0bd9('0x5d')],_0x25de00);if(_0x58470c[_0x0bd9('0x5e')]){_0x3671a1(ut[_0x0bd9('0x57')]('Trunk\x20Reachable'));}else{_0x14b0b7(ut[_0x0bd9('0x57')](_0x58470c[_0x0bd9('0x57')]));}});};function originate(_0x39506,_0x1318a3,_0x3c22a6){return new BPromise(function(_0x5b261a,_0x27b2a0){if(_0x3c22a6){var _0x39d629=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x39506[_0x0bd9('0x1')])[_0x0bd9('0x1f')],_0x39506[_0x0bd9('0x1')]);gs[_0x0bd9('0x5f')](_0x39d629)[_0x0bd9('0x37')](function(){_0x39506[_0x0bd9('0x1')]=util[_0x0bd9('0x60')](_0x0bd9('0x61'),path[_0x0bd9('0x35')](_0x39506[_0x0bd9('0x1')])[_0x0bd9('0x62')],path[_0x0bd9('0x35')](_0x39506[_0x0bd9('0x1')])['name']);_0x1318a3[_0x0bd9('0x63')]=_0x39506[_0x0bd9('0x1')];ut[_0x0bd9('0x45')](_0x0bd9('0x64'),'');ami[_0x0bd9('0x65')](ut[_0x0bd9('0x66')](_0x39506,_0x1318a3))[_0x0bd9('0x37')](function(_0x18f5be){_0x5b261a(_0x18f5be);})[_0x0bd9('0x3b')](function(_0x53c73a){_0x27b2a0(_0x53c73a);});})[_0x0bd9('0x3b')](function(_0x5344da){_0x27b2a0(_0x5344da);});}else{ami['Action'](ut['variablesAction'](_0x39506,_0x1318a3))[_0x0bd9('0x37')](function(_0x1edd08){_0x5b261a(_0x1edd08);})[_0x0bd9('0x3b')](function(_0x35aac4){_0x27b2a0(_0x35aac4);});}});}Fax[_0x0bd9('0x22')][_0x0bd9('0x55')]=function(_0x567d1e,_0x35f235){var _0x475c73=this;return new BPromise(function(_0x4c64f4,_0x1a51f5){var _0x2fe635=uuid['v4']();var _0x393342=ut[_0x0bd9('0x67')](_0x567d1e,_0x35f235);_0x475c73[_0x0bd9('0xf')][_0x2fe635]=new Action(_0x2fe635,_0x35f235,_0x567d1e);var _0x428ce3=_0x475c73[_0x0bd9('0xf')][_0x2fe635];if(path[_0x0bd9('0x35')](_0x567d1e['path'])[_0x0bd9('0x68')]===_0x0bd9('0x36')){originate(_0x428ce3,_0x393342,!![])[_0x0bd9('0x37')](function(_0x309f79){_0x4c64f4(_0x309f79);})[_0x0bd9('0x3b')](function(_0x2dcfb5){_0x1a51f5(_0x2dcfb5);});}else{originate(_0x428ce3,_0x393342,![])['then'](function(_0x71dad5){_0x4c64f4(_0x71dad5);})[_0x0bd9('0x3b')](function(_0x1ed9bc){_0x1a51f5(_0x1ed9bc);});}});};Fax[_0x0bd9('0x22')][_0x0bd9('0x69')]=function(_0x365f6d){return!_[_0x0bd9('0x6a')](_0x365f6d)&&!_['isNil'](_0x365f6d[_0x0bd9('0x1f')])&&!_[_0x0bd9('0x6a')](_0x365f6d[_0x0bd9('0x6b')])&&_0x365f6d[_0x0bd9('0x6b')]&&!_['isNil'](this[_0x0bd9('0xe')][util[_0x0bd9('0x60')](_0x0bd9('0x6c'),_0x365f6d[_0x0bd9('0x1f')])])&&!_['isNil'](this[_0x0bd9('0xe')][util[_0x0bd9('0x60')](_0x0bd9('0x6c'),_0x365f6d[_0x0bd9('0x1f')])][_0x0bd9('0x2b')])&&(this['trunks'][util[_0x0bd9('0x60')](_0x0bd9('0x6c'),_0x365f6d[_0x0bd9('0x1f')])][_0x0bd9('0x2b')]===_0x0bd9('0x6d')||this[_0x0bd9('0xe')][util[_0x0bd9('0x60')](_0x0bd9('0x6c'),_0x365f6d[_0x0bd9('0x1f')])][_0x0bd9('0x2b')]===_0x0bd9('0x6e'));};Fax['prototype'][_0x0bd9('0x5b')]=function(_0x6fc622,_0x16d6a4){if(!this[_0x0bd9('0x69')](_0x6fc622)){ut['logger'](_0x0bd9('0x6f'),_[_0x0bd9('0x6a')](_0x6fc622)?'':_0x6fc622[_0x0bd9('0x1f')]+_0x0bd9('0x70'));return{'isValid':![],'message':_0x0bd9('0x71')};}if(_[_0x0bd9('0x6a')](_0x16d6a4[_0x0bd9('0x5')])){ut[_0x0bd9('0x45')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x0bd9('0x3a')](_0x16d6a4));return{'isValid':![],'message':_0x0bd9('0x72')};}if(_[_0x0bd9('0x6a')](_0x16d6a4[_0x0bd9('0x1')])){ut[_0x0bd9('0x45')](_0x0bd9('0x73'),JSON['stringify'](_0x16d6a4));return{'isValid':![],'message':_0x0bd9('0x74')};}return{'isValid':!![],'message':_0x0bd9('0x75')};};Fax['prototype'][_0x0bd9('0x76')]=function(_0x4721e9,_0x46b39d=0x2710){if(this[_0x0bd9('0xc')][_0x4721e9]){setTimeout(()=>{delete this[_0x0bd9('0xc')][_0x4721e9];},_0x46b39d);}};module[_0x0bd9('0x77')]=Fax; \ No newline at end of file +var _0x2f3d=['[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','uuid','moment','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','bind','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','.pdf','application/pdf','then','notify','parse','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','%s/%s.tif','path','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax'];(function(_0x5a0b83,_0x375001){var _0xff5670=function(_0x113b62){while(--_0x113b62){_0x5a0b83['push'](_0x5a0b83['shift']());}};_0xff5670(++_0x375001);}(_0x2f3d,0x76));var _0xd2f3=function(_0xdb8c64,_0x39e8f0){_0xdb8c64=_0xdb8c64-0x0;var _0x338e69=_0x2f3d[_0xdb8c64];return _0x338e69;};'use strict';var util=require(_0xd2f3('0x0'));var _=require(_0xd2f3('0x1'));var BPromise=require('bluebird');var uuid=require(_0xd2f3('0x2'));var moment=require(_0xd2f3('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0xd2f3('0x4'));var logger=require(_0xd2f3('0x5'))(_0xd2f3('0x6'));var ami=require(_0xd2f3('0x7'));var rpcDb=require(_0xd2f3('0x8'));var Channel=require('./channel');var ut=require(_0xd2f3('0x9'));var Action=require(_0xd2f3('0xa'));var faxAccount=require(_0xd2f3('0xb'));var attachment=require(_0xd2f3('0xc'));var faxMessage=require(_0xd2f3('0xd'));function Fax(_0xfbab16){this[_0xd2f3('0xe')]={};this['faxAccounts']=_0xfbab16[_0xd2f3('0xf')];this[_0xd2f3('0x10')]=_0xfbab16['trunks'];this['actions']={};ami['on'](_0xd2f3('0x11'),this[_0xd2f3('0x12')]['bind'](this));ami['on'](_0xd2f3('0x13'),this['syncVarSet'][_0xd2f3('0x14')](this));ami['on']('newstate',this[_0xd2f3('0x15')][_0xd2f3('0x14')](this));ami['on'](_0xd2f3('0x16'),this[_0xd2f3('0x17')][_0xd2f3('0x14')](this));ami['on'](_0xd2f3('0x18'),this[_0xd2f3('0x19')][_0xd2f3('0x14')](this));ami['on'](_0xd2f3('0x1a'),this[_0xd2f3('0x1b')]['bind'](this));ami['on'](_0xd2f3('0x1c'),this['syncHangup'][_0xd2f3('0x14')](this));ami['on'](_0xd2f3('0x1d'),this['syncOriginateResponse'][_0xd2f3('0x14')](this));}Fax[_0xd2f3('0x1e')]['syncNewchannel']=function(_0x5e9d39){if(_0x5e9d39[_0xd2f3('0x1f')]===_0xd2f3('0x20')){for(var _0x47b23e in this[_0xd2f3('0xf')]){if(this['faxAccounts'][_0xd2f3('0x21')](_0x47b23e)){if(_0x5e9d39[_0xd2f3('0x22')]===this[_0xd2f3('0xf')][_0x47b23e][_0xd2f3('0x23')]){this['channels'][_0x5e9d39[_0xd2f3('0x24')]]={};this[_0xd2f3('0xe')][_0x5e9d39[_0xd2f3('0x24')]][_0xd2f3('0x25')]=_0x5e9d39[_0xd2f3('0x25')];this['channels'][_0x5e9d39[_0xd2f3('0x24')]]['id']=this['faxAccounts'][_0x47b23e]['id'];this['channels'][_0x5e9d39[_0xd2f3('0x24')]]['name']=this[_0xd2f3('0xf')][_0x47b23e][_0xd2f3('0x26')];logger[_0xd2f3('0x27')](_0x5e9d39['uniqueid'],_0xd2f3('0x28'));}}}}if(this['actions'][_0x5e9d39[_0xd2f3('0x24')]]){this[_0xd2f3('0xe')][_0x5e9d39[_0xd2f3('0x24')]]={};this['channels'][_0x5e9d39['uniqueid']][_0xd2f3('0x25')]=_0x5e9d39['channel'];logger[_0xd2f3('0x27')](_0x5e9d39[_0xd2f3('0x24')],'\x20syncNewchannel\x20');}};Fax[_0xd2f3('0x1e')][_0xd2f3('0x29')]=function(_0x13c6ea){if(this[_0xd2f3('0xe')][_0x13c6ea[_0xd2f3('0x24')]]){for(var _0x7fc0e2 in _0x13c6ea[_0xd2f3('0x2a')]){if(_0x13c6ea[_0xd2f3('0x2a')][_0xd2f3('0x21')](_0x7fc0e2)){this['channels'][_0x13c6ea[_0xd2f3('0x24')]][_0x7fc0e2]=_0x13c6ea[_0xd2f3('0x2b')];}}}};Fax[_0xd2f3('0x1e')][_0xd2f3('0x15')]=function(_0x3a7747){if(this[_0xd2f3('0xe')][_0x3a7747[_0xd2f3('0x24')]]){this[_0xd2f3('0xe')][_0x3a7747[_0xd2f3('0x24')]][_0xd2f3('0x2c')]=_0x3a7747[_0xd2f3('0x2c')];this[_0xd2f3('0xe')][_0x3a7747['uniqueid']]['channelstatedesc']=_0x3a7747[_0xd2f3('0x2d')];}};Fax[_0xd2f3('0x1e')]['syncNewExten']=function(_0x235dd7){if(this['channels'][_0x235dd7['uniqueid']]){for(var _0x25f507 in _0x235dd7[_0xd2f3('0x2a')]){if(_0x235dd7[_0xd2f3('0x2a')][_0xd2f3('0x21')](_0x25f507)){this[_0xd2f3('0xe')][_0x235dd7[_0xd2f3('0x24')]][_0x25f507]=_0x235dd7[_0xd2f3('0x2b')];}}}};Fax[_0xd2f3('0x1e')]['syncFaxStatus']=function(_0x37f935){if(this[_0xd2f3('0xe')][_0x37f935[_0xd2f3('0x24')]]){this[_0xd2f3('0xe')][_0x37f935[_0xd2f3('0x24')]][_0xd2f3('0x2e')]=_0x37f935[_0xd2f3('0x2e')];this[_0xd2f3('0xe')][_0x37f935[_0xd2f3('0x24')]]['status']=_0x37f935[_0xd2f3('0x2f')];this[_0xd2f3('0xe')][_0x37f935['uniqueid']]['localstationid']=_0x37f935[_0xd2f3('0x23')];this[_0xd2f3('0xe')][_0x37f935[_0xd2f3('0x24')]][_0xd2f3('0x30')]=_0x37f935[_0xd2f3('0x30')];logger['info'](_0x37f935['uniqueid'],_0xd2f3('0x31'));}};Fax[_0xd2f3('0x1e')][_0xd2f3('0x1b')]=function(_0x62b996){var _0x4319c0=this;if(this[_0xd2f3('0xe')][_0x62b996[_0xd2f3('0x24')]]){var _0x2efce9=this['channels'][_0x62b996[_0xd2f3('0x24')]]['id'];this[_0xd2f3('0xe')][_0x62b996['uniqueid']][_0xd2f3('0x32')]=_0x62b996[_0xd2f3('0x32')];this['channels'][_0x62b996['uniqueid']][_0xd2f3('0x33')]=_0x62b996[_0xd2f3('0x33')];this['channels'][_0x62b996['uniqueid']][_0xd2f3('0x23')]=_0x62b996[_0xd2f3('0x23')];this[_0xd2f3('0xe')][_0x62b996[_0xd2f3('0x24')]][_0xd2f3('0x34')]=_0x62b996[_0xd2f3('0x34')];this['channels'][_0x62b996[_0xd2f3('0x24')]]['transferrate']=_0x62b996['transferrate'];this[_0xd2f3('0xe')][_0x62b996['uniqueid']][_0xd2f3('0x30')]=_0x62b996[_0xd2f3('0x30')];this['channels'][_0x62b996[_0xd2f3('0x24')]][_0xd2f3('0x35')]=_0x62b996[_0xd2f3('0x35')];if(this[_0xd2f3('0xe')][_0x62b996[_0xd2f3('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x62b996[_0xd2f3('0x30')],_0xd2f3('0x36'),function(_0x1fcacc){logger[_0xd2f3('0x27')](_0x62b996[_0xd2f3('0x24')],_0xd2f3('0x37'),_0x1fcacc[_0xd2f3('0x38')]);attachment['create']({'name':path['parse'](_0x62b996['filename'])[_0xd2f3('0x26')],'basename':path['parse'](_0x62b996[_0xd2f3('0x30')])['name']+_0xd2f3('0x39'),'type':_0xd2f3('0x3a')})[_0xd2f3('0x3b')](function(_0x4cf9d1){faxAccount[_0xd2f3('0x3c')](_0x2efce9,{'from':_0x62b996[_0xd2f3('0x35')],'mapKey':'fax','body':path[_0xd2f3('0x3d')](_0x62b996[_0xd2f3('0x30')])[_0xd2f3('0x26')]+_0xd2f3('0x39'),'AttachmentId':_0x4cf9d1['id']})[_0xd2f3('0x3e')](function(_0x2de8ec){logger[_0xd2f3('0x3f')](_0x62b996[_0xd2f3('0x24')],_0xd2f3('0x40'),JSON[_0xd2f3('0x41')](_0x2de8ec));});})[_0xd2f3('0x3e')](function(_0x537efe){logger[_0xd2f3('0x3f')](_0x62b996[_0xd2f3('0x24')],_0xd2f3('0x42'),JSON[_0xd2f3('0x41')](_0x537efe));});});}logger['info'](_0x62b996[_0xd2f3('0x24')],_0xd2f3('0x42'));}};Fax['prototype']['syncOriginateResponse']=function(_0x57eeb8){if(this[_0xd2f3('0x43')][_0x57eeb8[_0xd2f3('0x24')]]){_['merge'](this[_0xd2f3('0xe')][_0x57eeb8[_0xd2f3('0x24')]],_[_0xd2f3('0x44')](_0x57eeb8,[_0xd2f3('0x45'),_0xd2f3('0x46')]));}};function updateStatus(_0x1a1ede){if(_0x1a1ede[_0xd2f3('0x47')]){faxMessage[_0xd2f3('0x48')](_0x1a1ede[_0xd2f3('0x47')],{'failMessage':_0xd2f3('0x49')})[_0xd2f3('0x3b')](function(_0x109c9b){ut['logger'](_0xd2f3('0x4a'),_0x109c9b);})[_0xd2f3('0x3e')](function(_0x33083f){ut[_0xd2f3('0x4b')](_0xd2f3('0x4c'),_0x33083f);});}else{ut[_0xd2f3('0x4b')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xd2f3('0x1e')][_0xd2f3('0x4d')]=function(_0x4682c0,_0x38ba4c,_0x265cd0){var _0x111af9=this;var _0x3f2fb6={};if(_0x38ba4c){_0x3f2fb6={'read':_0x38ba4c};}else{_0x3f2fb6={'failMessage':_0x265cd0};}if(this[_0xd2f3('0x43')][_0x4682c0][_0xd2f3('0x47')]){faxMessage[_0xd2f3('0x48')](this[_0xd2f3('0x43')][_0x4682c0][_0xd2f3('0x47')],_0x3f2fb6)[_0xd2f3('0x3b')](function(_0xacf41d){ut[_0xd2f3('0x4b')](_0xd2f3('0x4e'),_0xacf41d);})['catch'](function(_0x573b39){ut['logger']('[Fax][Message][NoUpdate1]',_0x573b39);})['finally'](function(){delete _0x111af9[_0xd2f3('0xe')][_0x4682c0];delete _0x111af9['actions'][_0x4682c0];});}else{ut['logger'](_0xd2f3('0x4f'));this[_0xd2f3('0x50')](_0x4682c0);delete this[_0xd2f3('0x43')][_0x4682c0];}};Fax['prototype'][_0xd2f3('0x51')]=function(_0x2ef4dc){var _0x2e4bb0=this;if(this[_0xd2f3('0xe')][_0x2ef4dc['uniqueid']]){if(this[_0xd2f3('0x43')][_0x2ef4dc[_0xd2f3('0x24')]]){this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]]['id']=this[_0xd2f3('0x43')][_0x2ef4dc[_0xd2f3('0x24')]]['id'];this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]][_0xd2f3('0x26')]=this[_0xd2f3('0x43')][_0x2ef4dc[_0xd2f3('0x24')]][_0xd2f3('0x26')];}logger[_0xd2f3('0x27')](_0x2ef4dc['uniqueid'],this[_0xd2f3('0x43')][_0x2ef4dc[_0xd2f3('0x24')]]?_0xd2f3('0x52'):_0xd2f3('0x53'),JSON[_0xd2f3('0x41')](this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]]));if(this['actions'][_0x2ef4dc[_0xd2f3('0x24')]]){if(this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]][_0xd2f3('0x54')]>0x0&&this[_0xd2f3('0xe')][_0x2ef4dc['uniqueid']][_0xd2f3('0x18')]===_0xd2f3('0x55')){this[_0xd2f3('0x4d')](_0x2ef4dc[_0xd2f3('0x24')],!![]);}else{this[_0xd2f3('0x4d')](_0x2ef4dc['uniqueid'],![],this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]]['faxstatusstring']?_0xd2f3('0x56')+this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0xd2f3('0x1e')]['send']=function(_0x4902ad){var _0x2f221d=this;return new BPromise(function(_0x355253,_0x51b5cd){_0x2f221d[_0xd2f3('0x57')](_0x4902ad,_0x2f221d[_0xd2f3('0xf')][_0x4902ad[_0xd2f3('0x58')]])[_0xd2f3('0x3b')](function(_0x2402a7){ut[_0xd2f3('0x4b')](_0xd2f3('0x59'),_0x2402a7);_0x355253(ut[_0xd2f3('0x38')](_0xd2f3('0x5a')));})[_0xd2f3('0x3e')](function(_0x4cd6b5){ut[_0xd2f3('0x4b')](_0xd2f3('0x5b'),_0x4cd6b5);updateStatus(_0x4902ad);_0x51b5cd(ut['message']('Fax\x20failed'));});});};Fax[_0xd2f3('0x1e')]['checkAfterSend']=function(_0x27af5d){var _0x44b043=this;return new BPromise(function(_0x37b6bb,_0x20924c){var _0x516d48=_0x44b043[_0xd2f3('0x5c')](_0x44b043[_0xd2f3('0xf')][_0x27af5d[_0xd2f3('0x58')]][_0xd2f3('0x5d')],_0x27af5d);if(_0x516d48[_0xd2f3('0x5e')]){_0x37b6bb(ut['message'](_0xd2f3('0x5f')));}else{_0x20924c(ut[_0xd2f3('0x38')](_0x516d48[_0xd2f3('0x38')]));}});};function originate(_0x1d259f,_0x16469b,_0xa475bb){return new BPromise(function(_0x1a8155,_0x4553a4){if(_0xa475bb){var _0x288690=util[_0xd2f3('0x60')]('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[_0xd2f3('0x3d')](_0x1d259f['path'])['name'],_0x1d259f['path']);gs['execute'](_0x288690)[_0xd2f3('0x3b')](function(){_0x1d259f['path']=util[_0xd2f3('0x60')](_0xd2f3('0x61'),path[_0xd2f3('0x3d')](_0x1d259f[_0xd2f3('0x62')])[_0xd2f3('0x63')],path['parse'](_0x1d259f[_0xd2f3('0x62')])[_0xd2f3('0x26')]);_0x16469b[_0xd2f3('0x64')]=_0x1d259f[_0xd2f3('0x62')];ut[_0xd2f3('0x4b')]('Convert\x20pdf\x20to\x20tif','');ami[_0xd2f3('0x65')](ut[_0xd2f3('0x66')](_0x1d259f,_0x16469b))[_0xd2f3('0x3b')](function(_0x43ce9e){_0x1a8155(_0x43ce9e);})['catch'](function(_0x3f5699){_0x4553a4(_0x3f5699);});})['catch'](function(_0x3be921){_0x4553a4(_0x3be921);});}else{ami[_0xd2f3('0x65')](ut[_0xd2f3('0x66')](_0x1d259f,_0x16469b))['then'](function(_0x3b8861){_0x1a8155(_0x3b8861);})[_0xd2f3('0x3e')](function(_0x5ae00a){_0x4553a4(_0x5ae00a);});}});}Fax[_0xd2f3('0x1e')][_0xd2f3('0x57')]=function(_0x4bfee9,_0x55267c){var _0x1bad84=this;return new BPromise(function(_0x1f04ee,_0x4bb319){var _0x51c837=uuid['v4']();var _0x4142e7=ut[_0xd2f3('0x67')](_0x4bfee9,_0x55267c);_0x1bad84[_0xd2f3('0x43')][_0x51c837]=new Action(_0x51c837,_0x55267c,_0x4bfee9);var _0x5e01b2=_0x1bad84[_0xd2f3('0x43')][_0x51c837];if(path[_0xd2f3('0x3d')](_0x4bfee9[_0xd2f3('0x62')])[_0xd2f3('0x68')]===_0xd2f3('0x39')){originate(_0x5e01b2,_0x4142e7,!![])[_0xd2f3('0x3b')](function(_0x44a9e2){_0x1f04ee(_0x44a9e2);})[_0xd2f3('0x3e')](function(_0x255bb6){_0x4bb319(_0x255bb6);});}else{originate(_0x5e01b2,_0x4142e7,![])[_0xd2f3('0x3b')](function(_0x1f6858){_0x1f04ee(_0x1f6858);})['catch'](function(_0x2ba60f){_0x4bb319(_0x2ba60f);});}});};Fax[_0xd2f3('0x1e')][_0xd2f3('0x69')]=function(_0xea42){return!_[_0xd2f3('0x6a')](_0xea42)&&!_['isNil'](_0xea42['name'])&&!_[_0xd2f3('0x6a')](_0xea42['active'])&&_0xea42['active']&&!_['isNil'](this[_0xd2f3('0x10')][util[_0xd2f3('0x60')](_0xd2f3('0x6b'),_0xea42[_0xd2f3('0x26')])])&&!_[_0xd2f3('0x6a')](this[_0xd2f3('0x10')][util['format'](_0xd2f3('0x6b'),_0xea42[_0xd2f3('0x26')])]['status'])&&(this[_0xd2f3('0x10')][util[_0xd2f3('0x60')](_0xd2f3('0x6b'),_0xea42['name'])][_0xd2f3('0x2f')]===_0xd2f3('0x6c')||this[_0xd2f3('0x10')][util['format'](_0xd2f3('0x6b'),_0xea42[_0xd2f3('0x26')])]['status']===_0xd2f3('0x6d'));};Fax[_0xd2f3('0x1e')]['checkTrunk']=function(_0x41b612,_0xb33396){if(!this[_0xd2f3('0x69')](_0x41b612)){ut[_0xd2f3('0x4b')](_0xd2f3('0x6e'),_['isNil'](_0x41b612)?'':_0x41b612[_0xd2f3('0x26')]+_0xd2f3('0x6f'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0xb33396['fax'])){ut['logger'](_0xd2f3('0x70'),JSON[_0xd2f3('0x41')](_0xb33396));return{'isValid':![],'message':_0xd2f3('0x71')};}if(_[_0xd2f3('0x6a')](_0xb33396['path'])){ut[_0xd2f3('0x4b')](_0xd2f3('0x72'),JSON[_0xd2f3('0x41')](_0xb33396));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0xd2f3('0x1e')][_0xd2f3('0x50')]=function(_0x4336bb,_0x13a03a=0x2710){if(this[_0xd2f3('0xe')][_0x4336bb]){setTimeout(()=>{delete this['channels'][_0x4336bb];},_0x13a03a);}};module[_0xd2f3('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index a1fbcaa..e27c25c 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 _0x648e=['inspect','resolve','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x18aa28,_0x1b38e5){var _0x446eed=function(_0x366e1c){while(--_0x366e1c){_0x18aa28['push'](_0x18aa28['shift']());}};_0x446eed(++_0x1b38e5);}(_0x648e,0x14a));var _0xe648=function(_0x4d8e1b,_0x17c24d){_0x4d8e1b=_0x4d8e1b-0x0;var _0x11d3aa=_0x648e[_0x4d8e1b];return _0x11d3aa;};'use strict';var util=require(_0xe648('0x0'));var BPromise=require(_0xe648('0x1'));var logger=require(_0xe648('0x2'))(_0xe648('0x3'));var _=require(_0xe648('0x4'));var faxAccount=require(_0xe648('0x5'));function loggerCatch(_0x216edc){return function(_0x54a36b){logger['error'](_0x216edc,util[_0xe648('0x6')](_0x54a36b,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2aa8d0,_0x395b21){return BPromise[_0xe648('0x7')]()['then'](faxAccount['notify'](_0x2aa8d0,_0x395b21))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x6aba=['lodash','../rpc/faxAccount','inspect','notify','then','catch','bluebird','../../../config/logger','preview'];(function(_0xe38764,_0x28ce79){var _0x5979cf=function(_0x1fedef){while(--_0x1fedef){_0xe38764['push'](_0xe38764['shift']());}};_0x5979cf(++_0x28ce79);}(_0x6aba,0x180));var _0xa6ab=function(_0x3c6694,_0x91cd0d){_0x3c6694=_0x3c6694-0x0;var _0x5a48c9=_0x6aba[_0x3c6694];return _0x5a48c9;};'use strict';var util=require('util');var BPromise=require(_0xa6ab('0x0'));var logger=require(_0xa6ab('0x1'))(_0xa6ab('0x2'));var _=require(_0xa6ab('0x3'));var faxAccount=require(_0xa6ab('0x4'));function loggerCatch(_0x3f73f6){return function(_0x4e66ad){logger['error'](_0x3f73f6,util[_0xa6ab('0x5')](_0x4e66ad,{'showHidden':![],'depth':null}));};}exports[_0xa6ab('0x6')]=function(_0x598d18,_0x3666fa){return BPromise['resolve']()[_0xa6ab('0x7')](faxAccount[_0xa6ab('0x6')](_0x598d18,_0x3666fa))[_0xa6ab('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 097c6e9..b8cdd4f 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 _0x1a41=['info','Exec\x20gs','\x20Error\x20:','util','fax','exec','execute'];(function(_0x2be32f,_0x241987){var _0x37d538=function(_0x3b9ace){while(--_0x3b9ace){_0x2be32f['push'](_0x2be32f['shift']());}};_0x37d538(++_0x241987);}(_0x1a41,0x192));var _0x11a4=function(_0x471826,_0x1f70d1){_0x471826=_0x471826-0x0;var _0x572fd6=_0x1a41[_0x471826];return _0x572fd6;};'use strict';var util=require(_0x11a4('0x0'));var logger=require('../../../../config/logger')(_0x11a4('0x1'));var BPromise=require('bluebird');var exec=require('child_process')[_0x11a4('0x2')];exports[_0x11a4('0x3')]=function(_0x55ed99){return new BPromise(function(_0xfc2bdc,_0x41eab7){exec(_0x55ed99,function(_0x2004f4,_0x3e4d7e,_0x32e552){logger[_0x11a4('0x4')]('Exec\x20gs',_0x3e4d7e);if(_0x2004f4){logger[_0x11a4('0x4')](_0x11a4('0x5'),_0x11a4('0x6'),util['inspect'](_0x2004f4,{'showHidden':![],'depth':null}),_0x3e4d7e,_0x32e552);_0x41eab7(_0x2004f4);}_0xfc2bdc(_0x3e4d7e);});});}; \ No newline at end of file +var _0x3ca1=['bluebird','child_process','exec','info','Exec\x20gs','inspect','util'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x3ca1,0x1e9));var _0x13ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca1[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x13ca('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x13ca('0x1'));var exec=require(_0x13ca('0x2'))[_0x13ca('0x3')];exports['execute']=function(_0x46cee6){return new BPromise(function(_0xc2fe1d,_0x14d02f){exec(_0x46cee6,function(_0x977e8e,_0x2c7754,_0x19c88e){logger[_0x13ca('0x4')](_0x13ca('0x5'),_0x2c7754);if(_0x977e8e){logger[_0x13ca('0x4')](_0x13ca('0x5'),'\x20Error\x20:',util[_0x13ca('0x6')](_0x977e8e,{'showHidden':![],'depth':null}),_0x2c7754,_0x19c88e);_0x14d02f(_0x977e8e);}_0xc2fe1d(_0x2c7754);});});}; \ 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 4e92872..0aaf52c 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 _0x8985=['localstationid','uniqueid','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','variablesAction','channel','xcally-motion-fax','\x22%s\x22\x20<%s>'];(function(_0x4acd56,_0x335b17){var _0xef11b7=function(_0x573a89){while(--_0x573a89){_0x4acd56['push'](_0x4acd56['shift']());}};_0xef11b7(++_0x335b17);}(_0x8985,0x120));var _0x5898=function(_0x54379d,_0x13880c){_0x54379d=_0x54379d-0x0;var _0x28a430=_0x8985[_0x54379d];return _0x28a430;};'use strict';var util=require('util');var _=require(_0x5898('0x0'));var moment=require(_0x5898('0x1'));var logger=require(_0x5898('0x2'))(_0x5898('0x3'));exports[_0x5898('0x4')]=function(_0x59e317){return{'message':_0x59e317};};exports[_0x5898('0x5')]=function(_0x4deaaa,_0x1d7c6a){logger[_0x5898('0x6')](_0x4deaaa,util[_0x5898('0x7')](_0x1d7c6a,{'showHidden':![],'depth':null}));};exports[_0x5898('0x8')]=function(_0x125869,_0x5704d3){var _0x4fda52={'XMF-ECM':_0x5704d3['ecm'],'XMF-HEADERINFO':_0x5704d3[_0x5898('0x9')],'XMF-MINRATE':_0x5704d3[_0x5898('0xa')],'XMF-MAXRATE':_0x5704d3[_0x5898('0xb')],'XMF-MODEM':util[_0x5898('0xc')](_0x5898('0xd'),_0x5704d3['modem']),'XMF-GATEWAY':_0x5704d3[_0x5898('0xe')],'XMF-FAXDETECT':_0x5704d3[_0x5898('0xf')],'XMF-T38TIMEOUT':_0x5704d3['t38timeout'],'XMF-LOCALSTATIONID':_0x5704d3['localstationid'],'XMF-PATH':_0x125869['path']};return _0x4fda52;};exports[_0x5898('0x10')]=function(_0x29f41b,_0x381cae){return{'actionid':_0x29f41b['uniqueid'],'action':'originate','channel':_0x29f41b[_0x5898('0x11')],'Exten':_0x5898('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0x5898('0xc')](_0x5898('0x13'),_0x29f41b[_0x5898('0x9')]?_0x29f41b[_0x5898('0x9')]:'',_0x29f41b[_0x5898('0x14')]),'variable':_0x381cae,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x29f41b[_0x5898('0x15')]};}; \ No newline at end of file +var _0x6757=['inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','from-sip','uniqueid','util','lodash','moment','../../../../config/logger','fax','message','info'];(function(_0x2cbf7d,_0x32af04){var _0x2be66e=function(_0x53d98e){while(--_0x53d98e){_0x2cbf7d['push'](_0x2cbf7d['shift']());}};_0x2be66e(++_0x32af04);}(_0x6757,0x149));var _0x7675=function(_0x57c870,_0x33a544){_0x57c870=_0x57c870-0x0;var _0x4ef473=_0x6757[_0x57c870];return _0x4ef473;};'use strict';var util=require(_0x7675('0x0'));var _=require(_0x7675('0x1'));var moment=require(_0x7675('0x2'));var logger=require(_0x7675('0x3'))(_0x7675('0x4'));exports[_0x7675('0x5')]=function(_0x5de28a){return{'message':_0x5de28a};};exports['logger']=function(_0x38a860,_0x2d3770){logger[_0x7675('0x6')](_0x38a860,util[_0x7675('0x7')](_0x2d3770,{'showHidden':![],'depth':null}));};exports[_0x7675('0x8')]=function(_0x4ab639,_0x18349e){var _0x462683={'XMF-ECM':_0x18349e[_0x7675('0x9')],'XMF-HEADERINFO':_0x18349e[_0x7675('0xa')],'XMF-MINRATE':_0x18349e[_0x7675('0xb')],'XMF-MAXRATE':_0x18349e[_0x7675('0xc')],'XMF-MODEM':util[_0x7675('0xd')]('\x22%s\x22',_0x18349e['modem']),'XMF-GATEWAY':_0x18349e[_0x7675('0xe')],'XMF-FAXDETECT':_0x18349e[_0x7675('0xf')],'XMF-T38TIMEOUT':_0x18349e[_0x7675('0x10')],'XMF-LOCALSTATIONID':_0x18349e[_0x7675('0x11')],'XMF-PATH':_0x4ab639[_0x7675('0x12')]};return _0x462683;};exports[_0x7675('0x13')]=function(_0x97c126,_0x3ce608){return{'actionid':_0x97c126['uniqueid'],'action':_0x7675('0x14'),'channel':_0x97c126[_0x7675('0x15')],'Exten':'xcally-motion-fax','Context':_0x7675('0x16'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x97c126[_0x7675('0xa')]?_0x97c126[_0x7675('0xa')]:'',_0x97c126['localstationid']),'variable':_0x3ce608,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x97c126[_0x7675('0x17')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 5086df4..9ff429f 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 _0x4951=['getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','moment','./server','./report','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x4951,0x114));var _0x1495=function(_0x3e08e6,_0x20b1b1){_0x3e08e6=_0x3e08e6-0x0;var _0x17dc92=_0x4951[_0x3e08e6];return _0x17dc92;};'use strict';var util=require('util');var moment=require(_0x1495('0x0'));var server=require(_0x1495('0x1'));var Realtime=require('./realtime');var Report=require(_0x1495('0x2'));var Acw=require('./acw');var Trigger=require(_0x1495('0x3'));var Dialer=require('./dialer');var Preview=require(_0x1495('0x4'));var Fax=require(_0x1495('0x5'));var user=require('./rpc/user');var voiceQueue=require(_0x1495('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x1495('0x7'));var trigger=require('./rpc/trigger');var template=require(_0x1495('0x8'));var cmHopperHistory=require(_0x1495('0x9'));var campaign=require(_0x1495('0xa'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x1495('0xb'));var salesforce=require(_0x1495('0xc'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x1495('0xd'));var desk=require(_0x1495('0xe'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x1495('0xf'));var freshsales=require(_0x1495('0x10'));var servicenow=require(_0x1495('0x11'));var dynamics365=require(_0x1495('0x12'));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(_0x1495('0x13'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1495('0x14')](_0x1495('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1495('0x14')](_0x1495('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x1495('0x16')]()[_0x1495('0x17')](user[_0x1495('0x18')]())[_0x1495('0x17')](realtime[_0x1495('0x19')]())[_0x1495('0x17')](user[_0x1495('0x1a')]())[_0x1495('0x17')](realtime[_0x1495('0x1b')]())['then'](trunk[_0x1495('0x1c')]())[_0x1495('0x17')](realtime['initTrunks']())['then'](voiceQueue['getVoiceQueues']())[_0x1495('0x17')](realtime[_0x1495('0x1d')]())[_0x1495('0x17')](trigger[_0x1495('0x1e')]())[_0x1495('0x17')](realtime[_0x1495('0x1f')]())[_0x1495('0x17')](template['getTemplates']())[_0x1495('0x17')](realtime[_0x1495('0x20')]())[_0x1495('0x17')](zendesk[_0x1495('0x21')]())['then'](realtime['initZendeskAccounts']())['then'](salesforce[_0x1495('0x22')]())[_0x1495('0x17')](realtime['initSalesforceAccounts']())[_0x1495('0x17')](sugarcrm[_0x1495('0x23')]())[_0x1495('0x17')](realtime[_0x1495('0x24')]())[_0x1495('0x17')](freshdesk['getFreshdeskAccounts']())[_0x1495('0x17')](realtime['initFreshdeskAccounts']())[_0x1495('0x17')](desk[_0x1495('0x25')]())[_0x1495('0x17')](realtime['initDeskAccounts']())['then'](zoho[_0x1495('0x26')]())[_0x1495('0x17')](realtime[_0x1495('0x27')]())[_0x1495('0x17')](vtiger['getVtigerAccounts']())[_0x1495('0x17')](realtime[_0x1495('0x28')]())[_0x1495('0x17')](freshsales[_0x1495('0x29')]())[_0x1495('0x17')](realtime['initFreshsalesAccounts']())[_0x1495('0x17')](servicenow['getServicenowAccounts']())['then'](realtime['initServicenowAccounts']())['then'](dynamics365[_0x1495('0x2a')]())[_0x1495('0x17')](realtime[_0x1495('0x2b')]())[_0x1495('0x17')](campaign[_0x1495('0x2c')]())[_0x1495('0x17')](realtime['initCampaigns']())[_0x1495('0x17')](voiceExtension[_0x1495('0x2d')]())[_0x1495('0x17')](realtime[_0x1495('0x2e')]())['then'](faxAccount[_0x1495('0x2f')]())[_0x1495('0x17')](realtime[_0x1495('0x30')]())[_0x1495('0x17')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x1495('0x17')](voiceQueueReport[_0x1495('0x31')]())[_0x1495('0x17')](realtime[_0x1495('0x32')]())[_0x1495('0x17')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x1495('0x17')](realtime['initVoiceQueueHopperHistory']())[_0x1495('0x17')](cmHopperHistory[_0x1495('0x33')]())['then'](realtime[_0x1495('0x34')]())[_0x1495('0x17')](voiceCallReport[_0x1495('0x35')]())[_0x1495('0x17')](realtime[_0x1495('0x36')]())[_0x1495('0x37')](function(_0x2327cc){logger[_0x1495('0x38')](_0x1495('0x39'),util[_0x1495('0x3a')](_0x2327cc,{'showHidden':![],'depth':null}));});}function main(){return server[_0x1495('0x3b')](realtime,preview,fax)[_0x1495('0x17')](function(){return initRealtime();})[_0x1495('0x17')](function(){return initParams();})[_0x1495('0x17')](function(){report[_0x1495('0x3c')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x29a135){logger[_0x1495('0x38')](_0x1495('0x3d'),util['inspect'](_0x29a135,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x4716=['getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','initVoiceQueueReports','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','ami','get','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts'];(function(_0x29bafc,_0x61c845){var _0xf6d52f=function(_0x46721f){while(--_0x46721f){_0x29bafc['push'](_0x29bafc['shift']());}};_0xf6d52f(++_0x61c845);}(_0x4716,0x130));var _0x6471=function(_0x1dc15f,_0xbd7f8f){_0x1dc15f=_0x1dc15f-0x0;var _0xd0a506=_0x4716[_0x1dc15f];return _0xd0a506;};'use strict';var util=require(_0x6471('0x0'));var moment=require(_0x6471('0x1'));var server=require(_0x6471('0x2'));var Realtime=require('./realtime');var Report=require(_0x6471('0x3'));var Acw=require(_0x6471('0x4'));var Trigger=require(_0x6471('0x5'));var Dialer=require(_0x6471('0x6'));var Preview=require('./preview');var Fax=require(_0x6471('0x7'));var user=require(_0x6471('0x8'));var voiceQueue=require(_0x6471('0x9'));var voiceQueueReport=require(_0x6471('0xa'));var voiceCallReport=require(_0x6471('0xb'));var trunk=require(_0x6471('0xc'));var trigger=require(_0x6471('0xd'));var template=require(_0x6471('0xe'));var cmHopperHistory=require(_0x6471('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x6471('0x10'));var zendesk=require(_0x6471('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x6471('0x12'));var freshdesk=require(_0x6471('0x13'));var desk=require(_0x6471('0x14'));var zoho=require(_0x6471('0x15'));var vtiger=require(_0x6471('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x6471('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x6471('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6471('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6471('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x6471('0x1a')](user[_0x6471('0x1b')]())[_0x6471('0x1a')](realtime[_0x6471('0x1c')]())[_0x6471('0x1a')](user[_0x6471('0x1d')]())[_0x6471('0x1a')](realtime[_0x6471('0x1e')]())['then'](trunk[_0x6471('0x1f')]())[_0x6471('0x1a')](realtime[_0x6471('0x20')]())[_0x6471('0x1a')](voiceQueue[_0x6471('0x21')]())[_0x6471('0x1a')](realtime[_0x6471('0x22')]())[_0x6471('0x1a')](trigger[_0x6471('0x23')]())[_0x6471('0x1a')](realtime['initTriggers']())[_0x6471('0x1a')](template[_0x6471('0x24')]())[_0x6471('0x1a')](realtime[_0x6471('0x25')]())[_0x6471('0x1a')](zendesk[_0x6471('0x26')]())[_0x6471('0x1a')](realtime[_0x6471('0x27')]())[_0x6471('0x1a')](salesforce[_0x6471('0x28')]())[_0x6471('0x1a')](realtime['initSalesforceAccounts']())[_0x6471('0x1a')](sugarcrm[_0x6471('0x29')]())[_0x6471('0x1a')](realtime[_0x6471('0x2a')]())[_0x6471('0x1a')](freshdesk[_0x6471('0x2b')]())[_0x6471('0x1a')](realtime[_0x6471('0x2c')]())['then'](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())[_0x6471('0x1a')](zoho[_0x6471('0x2d')]())[_0x6471('0x1a')](realtime[_0x6471('0x2e')]())['then'](vtiger[_0x6471('0x2f')]())[_0x6471('0x1a')](realtime[_0x6471('0x30')]())[_0x6471('0x1a')](freshsales['getFreshsalesAccounts']())[_0x6471('0x1a')](realtime[_0x6471('0x31')]())[_0x6471('0x1a')](servicenow[_0x6471('0x32')]())['then'](realtime[_0x6471('0x33')]())['then'](dynamics365['getDynamics365Accounts']())['then'](realtime['initDynamics365Accounts']())['then'](campaign['getCampaigns']())[_0x6471('0x1a')](realtime[_0x6471('0x34')]())[_0x6471('0x1a')](voiceExtension[_0x6471('0x35')]())[_0x6471('0x1a')](realtime[_0x6471('0x36')]())[_0x6471('0x1a')](faxAccount[_0x6471('0x37')]())[_0x6471('0x1a')](realtime[_0x6471('0x38')]())[_0x6471('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x6471('0x39')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x6471('0x1a')](realtime[_0x6471('0x3a')]())[_0x6471('0x1a')](cmHopperHistory[_0x6471('0x3b')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0x6471('0x1a')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x6471('0x3c')]())['then'](realtime[_0x6471('0x3d')]())[_0x6471('0x3e')](function(_0x32eb34){logger[_0x6471('0x3f')](_0x6471('0x40'),util[_0x6471('0x41')](_0x32eb34,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6471('0x42')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x6471('0x1a')](function(){return initParams();})[_0x6471('0x1a')](function(){report[_0x6471('0x43')]();setInterval(initRealtime,0x1388);})[_0x6471('0x3e')](function(_0x2f677b){logger[_0x6471('0x3f')](_0x6471('0x44'),util[_0x6471('0x41')](_0x2f677b,{'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 5405f48..a606a89 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 _0xb35f=['format','user:%s','emit','user:ami:update','exports','util','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stringify'];(function(_0x4e9310,_0x5296e4){var _0x346b79=function(_0x2b0d41){while(--_0x2b0d41){_0x4e9310['push'](_0x4e9310['shift']());}};_0x346b79(++_0x5296e4);}(_0xb35f,0x1c8));var _0xfb35=function(_0x9631bc,_0x382cfe){_0x9631bc=_0x9631bc-0x0;var _0x5d2217=_0xb35f[_0x9631bc];return _0x5d2217;};'use strict';var _=require('lodash');var util=require(_0xfb35('0x0'));var moment=require(_0xfb35('0x1'));var md5=require(_0xfb35('0x2'));var Redis=require(_0xfb35('0x3'));var config=require(_0xfb35('0x4'));config['redis']=_[_0xfb35('0x5')](config[_0xfb35('0x6')],{'host':_0xfb35('0x7'),'port':0x18eb});var io=require(_0xfb35('0x8'))(new Redis(config['redis']));function Agent(_0x30eae8){this['id']=_0x30eae8['id']||0x0;this[_0xfb35('0x9')]=_0x30eae8['name']||'';this[_0xfb35('0xa')]=_0x30eae8['email']||'';this[_0xfb35('0xb')]=_0x30eae8['accountcode']||'';this['fullname']=_0x30eae8[_0xfb35('0xc')]||'';this[_0xfb35('0xd')]=_0xfb35('0xe');this[_0xfb35('0xf')]=0x0;this[_0xfb35('0x10')]=_0xfb35('0xe');this[_0xfb35('0x11')]='';this[_0xfb35('0x12')]='';this[_0xfb35('0x13')]='';this[_0xfb35('0x14')]='';this[_0xfb35('0x15')]=_0x30eae8['online']||![];this[_0xfb35('0x16')]=_0xfb35('0xe');this[_0xfb35('0x17')]=0x0;this[_0xfb35('0x18')]='';this[_0xfb35('0x19')]='';this[_0xfb35('0x1a')]=![];this['local']=![];this[_0xfb35('0x2')]='';}Agent[_0xfb35('0x1b')][_0xfb35('0x1c')]=function(_0x5af5c3){var _0x380157;if(_0x5af5c3&&_0x5af5c3[_0xfb35('0xd')]){_0x380157=_0x5af5c3[_0xfb35('0xd')][_0xfb35('0x1d')]();switch(_0x380157){case _0xfb35('0x1e'):_0x380157=_0xfb35('0x1f');break;case _0xfb35('0x20'):_0x380157=_0xfb35('0x21');break;}}if(_0x380157&&this[_0xfb35('0x16')]!==_0x380157||_0x5af5c3[_0xfb35('0x22')]){this[_0xfb35('0x17')]=_['toNumber'](moment()['format']('x'));}if(_0x380157){this[_0xfb35('0x16')]=_0x380157;}var _0x93da3={'id':this['id'],'name':this['name'],'email':this[_0xfb35('0xa')],'accountcode':this[_0xfb35('0xb')],'fullname':this['fullname'],'state':this[_0xfb35('0xd')],'stateTime':this['stateTime'],'status':this[_0xfb35('0x10')],'address':this[_0xfb35('0x11')],'online':this[_0xfb35('0x15')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xfb35('0x17')],'voiceStatusCallerIdNumber':this[_0xfb35('0x18')],'voiceStatusQueue':this[_0xfb35('0x19')],'interface':this[_0xfb35('0x14')],'onhold':this[_0xfb35('0x1a')]};var _0x54eaec=md5(JSON[_0xfb35('0x23')](_0x93da3));if(this[_0xfb35('0x2')]!==_0x54eaec){this[_0xfb35('0x2')]=_0x54eaec;io['to'](util[_0xfb35('0x24')](_0xfb35('0x25'),_0x93da3[_0xfb35('0x9')]))[_0xfb35('0x26')](_0xfb35('0x27'),_['omit'](_0x93da3,['online']));io[_0xfb35('0x26')]('user:presence',_0x93da3);}};module[_0xfb35('0x28')]=Agent; \ No newline at end of file +var _0x7b3d=['phone','interface','voiceStatus','voiceStatusTime','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','online','voiceStatusCallerIdNumber','voiceStatusQueue','format','user:%s','user:ami:update','omit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x9cbdaf,_0x1df031){var _0x5d6fef=function(_0x2a0357){while(--_0x2a0357){_0x9cbdaf['push'](_0x9cbdaf['shift']());}};_0x5d6fef(++_0x1df031);}(_0x7b3d,0x1cf));var _0xd7b3=function(_0x2b49d1,_0x59aa7f){_0x2b49d1=_0x2b49d1-0x0;var _0x22eb64=_0x7b3d[_0x2b49d1];return _0x22eb64;};'use strict';var _=require('lodash');var util=require(_0xd7b3('0x0'));var moment=require(_0xd7b3('0x1'));var md5=require(_0xd7b3('0x2'));var Redis=require(_0xd7b3('0x3'));var config=require(_0xd7b3('0x4'));config['redis']=_[_0xd7b3('0x5')](config['redis'],{'host':_0xd7b3('0x6'),'port':0x18eb});var io=require(_0xd7b3('0x7'))(new Redis(config[_0xd7b3('0x8')]));function Agent(_0x2197ef){this['id']=_0x2197ef['id']||0x0;this[_0xd7b3('0x9')]=_0x2197ef[_0xd7b3('0x9')]||'';this['email']=_0x2197ef[_0xd7b3('0xa')]||'';this['accountcode']=_0x2197ef[_0xd7b3('0xb')]||'';this['fullname']=_0x2197ef[_0xd7b3('0xc')]||'';this[_0xd7b3('0xd')]=_0xd7b3('0xe');this[_0xd7b3('0xf')]=0x0;this[_0xd7b3('0x10')]=_0xd7b3('0xe');this['address']='';this[_0xd7b3('0x11')]='';this['mobile']='';this[_0xd7b3('0x12')]='';this['online']=_0x2197ef['online']||![];this[_0xd7b3('0x13')]=_0xd7b3('0xe');this[_0xd7b3('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0xd7b3('0x15')]=![];this[_0xd7b3('0x16')]=![];this['md5']='';}Agent[_0xd7b3('0x17')][_0xd7b3('0x18')]=function(_0x59fd67){var _0x22f231;if(_0x59fd67&&_0x59fd67[_0xd7b3('0xd')]){_0x22f231=_0x59fd67[_0xd7b3('0xd')][_0xd7b3('0x19')]();switch(_0x22f231){case _0xd7b3('0x1a'):_0x22f231=_0xd7b3('0x1b');break;case _0xd7b3('0x1c'):_0x22f231=_0xd7b3('0x1d');break;}}if(_0x22f231&&this[_0xd7b3('0x13')]!==_0x22f231||_0x59fd67[_0xd7b3('0x1e')]){this['voiceStatusTime']=_['toNumber'](moment()['format']('x'));}if(_0x22f231){this[_0xd7b3('0x13')]=_0x22f231;}var _0x49b9e5={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0xd7b3('0xb')],'fullname':this[_0xd7b3('0xc')],'state':this[_0xd7b3('0xd')],'stateTime':this[_0xd7b3('0xf')],'status':this[_0xd7b3('0x10')],'address':this['address'],'online':this[_0xd7b3('0x1f')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xd7b3('0x14')],'voiceStatusCallerIdNumber':this[_0xd7b3('0x20')],'voiceStatusQueue':this[_0xd7b3('0x21')],'interface':this[_0xd7b3('0x12')],'onhold':this['onhold']};var _0x4839c6=md5(JSON['stringify'](_0x49b9e5));if(this['md5']!==_0x4839c6){this[_0xd7b3('0x2')]=_0x4839c6;io['to'](util[_0xd7b3('0x22')](_0xd7b3('0x23'),_0x49b9e5['name']))['emit'](_0xd7b3('0x24'),_[_0xd7b3('0x25')](_0x49b9e5,['online']));io['emit'](_0xd7b3('0x26'),_0x49b9e5);}};module[_0xd7b3('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 9635b00..e7cfdcb 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 _0x6045=['dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0xd14e35,_0xb669c1){var _0x1a6c21=function(_0x430da5){while(--_0x430da5){_0xd14e35['push'](_0xd14e35['shift']());}};_0x1a6c21(++_0xb669c1);}(_0x6045,0x1a5));var _0x5604=function(_0x5340ee,_0x3096d7){_0x5340ee=_0x5340ee-0x0;var _0x25c7dc=_0x6045[_0x5340ee];return _0x25c7dc;};'use strict';function Campaign(_0x1f213c){this['id']=_0x1f213c['id']||0x0;this[_0x5604('0x0')]=_0x1f213c[_0x5604('0x0')]||'';this[_0x5604('0x1')]=_0x1f213c['type']||'campaign';this['originated']=0x0;this[_0x5604('0x2')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x5604('0x3')]=0x0;this['message']='';this[_0x5604('0x4')]=!![];this[_0x5604('0x5')]=_0x1f213c[_0x5604('0x5')];this[_0x5604('0x6')]=_0x1f213c[_0x5604('0x6')];this[_0x5604('0x7')]=_0x1f213c[_0x5604('0x7')]||null;this[_0x5604('0x8')]=_0x1f213c[_0x5604('0x8')]?_0x1f213c[_0x5604('0x8')]:null;this[_0x5604('0x9')]=_0x1f213c[_0x5604('0x9')];this[_0x5604('0xa')]=_0x1f213c['dialOriginateCallerIdNumber'];this[_0x5604('0xb')]=_0x1f213c['dialOriginateTimeout']||0x1e;this[_0x5604('0xc')]=_0x1f213c[_0x5604('0xc')];this[_0x5604('0xd')]=_0x1f213c[_0x5604('0xd')];this['dialBusyMaxRetry']=_0x1f213c['dialBusyMaxRetry'];this[_0x5604('0xe')]=_0x1f213c[_0x5604('0xe')];this[_0x5604('0xf')]=_0x1f213c[_0x5604('0xf')];this['dialNoAnswerRetryFrequency']=_0x1f213c[_0x5604('0x10')];this[_0x5604('0x11')]=_0x1f213c[_0x5604('0x11')];this[_0x5604('0x12')]=_0x1f213c[_0x5604('0x12')]||0x3;this[_0x5604('0x13')]=_0x1f213c[_0x5604('0x13')]||0x96;this['dialDropMaxRetry']=_0x1f213c[_0x5604('0x14')]||0x3;this[_0x5604('0x15')]=_0x1f213c[_0x5604('0x15')]||0x96;this[_0x5604('0x16')]=_0x1f213c[_0x5604('0x16')]||0x3;this[_0x5604('0x17')]=_0x1f213c[_0x5604('0x17')]||0x96;this[_0x5604('0x18')]=_0x1f213c['dialMachineMaxRetry']||0x3;this[_0x5604('0x19')]=_0x1f213c['dialMachineRetryFrequency']||0x96;this[_0x5604('0x1a')]=_0x1f213c[_0x5604('0x1a')]||0x3;this[_0x5604('0x1b')]=_0x1f213c[_0x5604('0x1b')]||0x96;this[_0x5604('0x1c')]=_0x1f213c[_0x5604('0x1c')]||_0x5604('0x1d');this[_0x5604('0x1e')]=_0x1f213c[_0x5604('0x1e')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x1f213c[_0x5604('0x1f')]||undefined;this[_0x5604('0x20')]=_0x1f213c['dialCutDigit']||undefined;this[_0x5604('0x21')]=_0x1f213c[_0x5604('0x21')]?_0x1f213c[_0x5604('0x21')]:undefined;this[_0x5604('0x22')]=_0x1f213c[_0x5604('0x22')]?_0x1f213c[_0x5604('0x22')]:undefined;this[_0x5604('0x23')]=_0x1f213c['Interval']?_0x1f213c[_0x5604('0x23')]:undefined;this[_0x5604('0x24')]=_0x1f213c[_0x5604('0x24')]?_0x1f213c[_0x5604('0x24')]:undefined;this[_0x5604('0x25')]=_0x1f213c['SquareProject']?_0x1f213c[_0x5604('0x24')][_0x5604('0x0')]:undefined;this[_0x5604('0x26')]=_0x1f213c[_0x5604('0x26')]||![];this[_0x5604('0x27')]=_0x1f213c[_0x5604('0x27')];this[_0x5604('0x28')]=_0x1f213c[_0x5604('0x28')];this['dialAMDAfterGreetingSilence']=_0x1f213c[_0x5604('0x29')];this[_0x5604('0x2a')]=_0x1f213c[_0x5604('0x2a')];this[_0x5604('0x2b')]=_0x1f213c[_0x5604('0x2b')];this[_0x5604('0x2c')]=_0x1f213c['dialAMDBetweenWordsSilence'];this[_0x5604('0x2d')]=_0x1f213c[_0x5604('0x2d')];this['dialAMDSilenceThreshold']=_0x1f213c[_0x5604('0x2e')];this[_0x5604('0x2f')]=_0x1f213c[_0x5604('0x2f')];}module[_0x5604('0x30')]=Campaign; \ No newline at end of file +var _0x8af6=['temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','originated'];(function(_0x131679,_0x298f2b){var _0x3c8158=function(_0x53da41){while(--_0x53da41){_0x131679['push'](_0x131679['shift']());}};_0x3c8158(++_0x298f2b);}(_0x8af6,0xc2));var _0x68af=function(_0x2b67c3,_0x5cbb09){_0x2b67c3=_0x2b67c3-0x0;var _0x5c0b64=_0x8af6[_0x2b67c3];return _0x5c0b64;};'use strict';function Campaign(_0x141fa8){this['id']=_0x141fa8['id']||0x0;this[_0x68af('0x0')]=_0x141fa8[_0x68af('0x0')]||'';this['type']=_0x141fa8['type']||'campaign';this[_0x68af('0x1')]=0x0;this[_0x68af('0x2')]=0x0;this[_0x68af('0x3')]=0x0;this[_0x68af('0x4')]=0x0;this[_0x68af('0x5')]='';this[_0x68af('0x6')]=!![];this[_0x68af('0x7')]=_0x141fa8['active'];this['limitCalls']=_0x141fa8[_0x68af('0x8')];this[_0x68af('0x9')]=_0x141fa8[_0x68af('0x9')]||null;this['dialGlobalInterval']=_0x141fa8[_0x68af('0xa')]?_0x141fa8[_0x68af('0xa')]:null;this[_0x68af('0xb')]=_0x141fa8[_0x68af('0xb')];this[_0x68af('0xc')]=_0x141fa8[_0x68af('0xc')];this[_0x68af('0xd')]=_0x141fa8[_0x68af('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x141fa8['dialCongestionMaxRetry'];this[_0x68af('0xe')]=_0x141fa8[_0x68af('0xe')];this['dialBusyMaxRetry']=_0x141fa8['dialBusyMaxRetry'];this[_0x68af('0xf')]=_0x141fa8[_0x68af('0xf')];this[_0x68af('0x10')]=_0x141fa8[_0x68af('0x10')];this[_0x68af('0x11')]=_0x141fa8[_0x68af('0x11')];this[_0x68af('0x12')]=_0x141fa8[_0x68af('0x12')];this[_0x68af('0x13')]=_0x141fa8[_0x68af('0x13')]||0x3;this[_0x68af('0x14')]=_0x141fa8[_0x68af('0x14')]||0x96;this[_0x68af('0x15')]=_0x141fa8[_0x68af('0x15')]||0x3;this[_0x68af('0x16')]=_0x141fa8['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x141fa8[_0x68af('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x141fa8[_0x68af('0x18')]||0x96;this[_0x68af('0x19')]=_0x141fa8[_0x68af('0x19')]||0x3;this[_0x68af('0x1a')]=_0x141fa8['dialMachineRetryFrequency']||0x96;this[_0x68af('0x1b')]=_0x141fa8[_0x68af('0x1b')]||0x3;this[_0x68af('0x1c')]=_0x141fa8[_0x68af('0x1c')]||0x96;this[_0x68af('0x1d')]=_0x141fa8[_0x68af('0x1d')]||_0x68af('0x1e');this['dialPrefix']=_0x141fa8[_0x68af('0x1f')]||undefined;this[_0x68af('0x20')]=_0x141fa8[_0x68af('0x20')]||undefined;this[_0x68af('0x21')]=_0x141fa8['dialCutDigit']||undefined;this['TrunkBackup']=_0x141fa8['TrunkBackup']?_0x141fa8[_0x68af('0x22')]:undefined;this[_0x68af('0x23')]=_0x141fa8['Trunk']?_0x141fa8[_0x68af('0x23')]:undefined;this[_0x68af('0x24')]=_0x141fa8[_0x68af('0x24')]?_0x141fa8[_0x68af('0x24')]:undefined;this[_0x68af('0x25')]=_0x141fa8[_0x68af('0x25')]?_0x141fa8[_0x68af('0x25')]:undefined;this[_0x68af('0x26')]=_0x141fa8['SquareProject']?_0x141fa8[_0x68af('0x25')][_0x68af('0x0')]:undefined;this[_0x68af('0x27')]=_0x141fa8[_0x68af('0x27')]||![];this['dialAMDInitialSilence']=_0x141fa8[_0x68af('0x28')];this[_0x68af('0x29')]=_0x141fa8[_0x68af('0x29')];this['dialAMDAfterGreetingSilence']=_0x141fa8[_0x68af('0x2a')];this[_0x68af('0x2b')]=_0x141fa8[_0x68af('0x2b')];this[_0x68af('0x2c')]=_0x141fa8[_0x68af('0x2c')];this[_0x68af('0x2d')]=_0x141fa8[_0x68af('0x2d')];this[_0x68af('0x2e')]=_0x141fa8['dialAMDMaximumNumberOfWords'];this[_0x68af('0x2f')]=_0x141fa8[_0x68af('0x2f')];this[_0x68af('0x30')]=_0x141fa8[_0x68af('0x30')];}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 d8865da..74cbe13 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 _0xbc7a=['type','tag','disposition','queue','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','billableseconds','holdtime'];(function(_0x1e0974,_0x44d99a){var _0x27ccaf=function(_0x2eb32){while(--_0x2eb32){_0x1e0974['push'](_0x1e0974['shift']());}};_0x27ccaf(++_0x44d99a);}(_0xbc7a,0xa4));var _0xabc7=function(_0x26d9cc,_0xa60a54){_0x26d9cc=_0x26d9cc-0x0;var _0x3b44f4=_0xbc7a[_0x26d9cc];return _0x3b44f4;};'use strict';function Channel(){this[_0xabc7('0x0')]=null;this[_0xabc7('0x1')]='';this[_0xabc7('0x2')]='';this['calleridnum']=0x0;this[_0xabc7('0x3')]='';this[_0xabc7('0x4')]=undefined;this[_0xabc7('0x5')]=undefined;this[_0xabc7('0x6')]=0x0;this[_0xabc7('0x7')]='';this[_0xabc7('0x8')]=0x0;this['linkedid']=0x0;this[_0xabc7('0x9')]=0x0;this[_0xabc7('0xa')]=![];this[_0xabc7('0xb')]=null;this[_0xabc7('0xc')]=null;this[_0xabc7('0xd')]=![];this[_0xabc7('0xe')]=![];this['lastapplication']='';this[_0xabc7('0xf')]='';this['duration']=0x0;this[_0xabc7('0x10')]=0x0;this[_0xabc7('0x11')]=0x0;this[_0xabc7('0x12')]=null;this[_0xabc7('0x13')]=null;this[_0xabc7('0x14')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0xabc7('0x15')]=null;this['monitors']=[];this[_0xabc7('0x16')]=undefined;this[_0xabc7('0x17')]=undefined;this[_0xabc7('0x18')]=undefined;this['mohtime']=0x0;}module[_0xabc7('0x19')]=Channel; \ No newline at end of file +var _0x0c19=['lastdata','duration','billableseconds','type','tag','monitor','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastapplication'];(function(_0x38f69c,_0x3c8b14){var _0x17e74e=function(_0x15d616){while(--_0x15d616){_0x38f69c['push'](_0x38f69c['shift']());}};_0x17e74e(++_0x3c8b14);}(_0x0c19,0xf5));var _0x90c1=function(_0x3c1358,_0x318ad0){_0x3c1358=_0x3c1358-0x0;var _0x435442=_0x0c19[_0x3c1358];return _0x435442;};'use strict';function Channel(){this[_0x90c1('0x0')]=null;this[_0x90c1('0x1')]='';this[_0x90c1('0x2')]='';this[_0x90c1('0x3')]=0x0;this[_0x90c1('0x4')]='';this[_0x90c1('0x5')]=undefined;this['connectedlinename']=undefined;this[_0x90c1('0x6')]=0x0;this[_0x90c1('0x7')]='';this[_0x90c1('0x8')]=0x0;this['linkedid']=0x0;this[_0x90c1('0x9')]=0x0;this[_0x90c1('0xa')]=![];this['answertime']=null;this[_0x90c1('0xb')]=null;this[_0x90c1('0xc')]=![];this[_0x90c1('0xd')]=![];this[_0x90c1('0xe')]='';this[_0x90c1('0xf')]='';this[_0x90c1('0x10')]=0x0;this[_0x90c1('0x11')]=0x0;this['holdtime']=0x0;this[_0x90c1('0x12')]=null;this[_0x90c1('0x13')]=null;this['disposition']=null;this[_0x90c1('0x14')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x90c1('0x15')]=[];this['transfercalleridnum']=undefined;this[_0x90c1('0x16')]=undefined;this[_0x90c1('0x17')]=undefined;this[_0x90c1('0x18')]=0x0;}module[_0x90c1('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 9948943..f044977 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 _0xf0d7=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x4f1d54,_0x34404f){var _0xc954c6=function(_0x298b5a){while(--_0x298b5a){_0x4f1d54['push'](_0x4f1d54['shift']());}};_0xc954c6(++_0x34404f);}(_0xf0d7,0x1ba));var _0x7f0d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf0d7[_0x3bf83f];return _0x22c4a9;};'use strict';function DeskAccount(_0x4280b2){this['id']=_0x4280b2['id']||0x0;this[_0x7f0d('0x0')]=_0x4280b2[_0x7f0d('0x0')]||'';this[_0x7f0d('0x1')]=_0x4280b2[_0x7f0d('0x1')]||'';this[_0x7f0d('0x2')]=_0x4280b2[_0x7f0d('0x2')]||'';this[_0x7f0d('0x3')]=_0x4280b2['authType']||'';this[_0x7f0d('0x4')]=_0x4280b2[_0x7f0d('0x4')]||'';this[_0x7f0d('0x5')]=_0x4280b2['consumerKey']||'';this[_0x7f0d('0x6')]=_0x4280b2[_0x7f0d('0x6')]||'';this[_0x7f0d('0x7')]=_0x4280b2['token']||'';this['tokenSecret']=_0x4280b2[_0x7f0d('0x8')]||'';this[_0x7f0d('0x9')]=_0x4280b2[_0x7f0d('0x9')]||'';this[_0x7f0d('0xa')]=_0x4280b2[_0x7f0d('0xa')]||'';this[_0x7f0d('0xb')]=_0x4280b2[_0x7f0d('0xb')]||{};}module[_0x7f0d('0xc')]=DeskAccount; \ No newline at end of file +var _0xef2f=['username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x44c3d9,_0x507687){var _0x69eb1b=function(_0xf759dd){while(--_0xf759dd){_0x44c3d9['push'](_0x44c3d9['shift']());}};_0x69eb1b(++_0x507687);}(_0xef2f,0x18b));var _0xfef2=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xef2f[_0x40ac5e];return _0x2839d6;};'use strict';function DeskAccount(_0x448644){this['id']=_0x448644['id']||0x0;this[_0xfef2('0x0')]=_0x448644[_0xfef2('0x0')]||'';this[_0xfef2('0x1')]=_0x448644[_0xfef2('0x1')]||'';this[_0xfef2('0x2')]=_0x448644[_0xfef2('0x2')]||'';this['authType']=_0x448644['authType']||'';this['password']=_0x448644[_0xfef2('0x3')]||'';this[_0xfef2('0x4')]=_0x448644[_0xfef2('0x4')]||'';this[_0xfef2('0x5')]=_0x448644[_0xfef2('0x5')]||'';this[_0xfef2('0x6')]=_0x448644[_0xfef2('0x6')]||'';this[_0xfef2('0x7')]=_0x448644['tokenSecret']||'';this[_0xfef2('0x8')]=_0x448644[_0xfef2('0x8')]||'';this[_0xfef2('0x9')]=_0x448644[_0xfef2('0x9')]||'';this[_0xfef2('0xa')]=_0x448644['Configurations']||{};}module[_0xfef2('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index f4ebdca..ad379d9 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 _0xa1b1=['Configurations','CloudProvider','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x31bd70,_0x18dce3){var _0x346caf=function(_0x4c582d){while(--_0x4c582d){_0x31bd70['push'](_0x31bd70['shift']());}};_0x346caf(++_0x18dce3);}(_0xa1b1,0x1b0));var _0x1a1b=function(_0x338c8c,_0x19df14){_0x338c8c=_0x338c8c-0x0;var _0x371a9a=_0xa1b1[_0x338c8c];return _0x371a9a;};'use strict';function Dynamics365Account(_0x33b0cd){this['id']=_0x33b0cd['id']||0x0;this['name']=_0x33b0cd['name']||'';this[_0x1a1b('0x0')]=_0x33b0cd[_0x1a1b('0x0')]||'';this[_0x1a1b('0x1')]=_0x33b0cd[_0x1a1b('0x1')]||'';this[_0x1a1b('0x2')]=_0x33b0cd[_0x1a1b('0x2')]||'';this[_0x1a1b('0x3')]=_0x33b0cd[_0x1a1b('0x3')]||'';this[_0x1a1b('0x4')]=_0x33b0cd[_0x1a1b('0x4')]||'';this[_0x1a1b('0x5')]=_0x33b0cd[_0x1a1b('0x5')]||{};this[_0x1a1b('0x6')]=_0x33b0cd[_0x1a1b('0x6')]||'';this[_0x1a1b('0x7')]=_0x33b0cd[_0x1a1b('0x7')]||![];this[_0x1a1b('0x8')]=_0x33b0cd['Configurations']||{};this[_0x1a1b('0x9')]=_0x33b0cd[_0x1a1b('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x87c8=['name','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x1d9246,_0x354366){var _0x1f9141=function(_0x582883){while(--_0x582883){_0x1d9246['push'](_0x1d9246['shift']());}};_0x1f9141(++_0x354366);}(_0x87c8,0xa5));var _0x887c=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x87c8[_0x51c819];return _0x15c5d2;};'use strict';function Dynamics365Account(_0x3781e8){this['id']=_0x3781e8['id']||0x0;this[_0x887c('0x0')]=_0x3781e8[_0x887c('0x0')]||'';this['username']=_0x3781e8[_0x887c('0x1')]||'';this['password']=_0x3781e8[_0x887c('0x2')]||'';this['remoteUri']=_0x3781e8[_0x887c('0x3')]||'';this[_0x887c('0x4')]=_0x3781e8[_0x887c('0x4')]||'';this[_0x887c('0x5')]=_0x3781e8[_0x887c('0x5')]||'';this['clientSecret']=_0x3781e8[_0x887c('0x6')]||{};this['serverUrl']=_0x3781e8['serverUrl']||'';this[_0x887c('0x7')]=_0x3781e8[_0x887c('0x7')]||![];this['Configurations']=_0x3781e8[_0x887c('0x8')]||{};this[_0x887c('0x9')]=_0x3781e8[_0x887c('0x9')]||{};}module[_0x887c('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index b3e9895..ba74112 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 _0x0e6a=['minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x8b6f3,_0x94c494){var _0x38d34d=function(_0x621a9d){while(--_0x621a9d){_0x8b6f3['push'](_0x8b6f3['shift']());}};_0x38d34d(++_0x94c494);}(_0x0e6a,0xd8));var _0xa0e6=function(_0x855b1c,_0x131bc8){_0x855b1c=_0x855b1c-0x0;var _0x5b4c9e=_0x0e6a[_0x855b1c];return _0x5b4c9e;};'use strict';function FaxAccount(_0x35f999){this['id']=_0x35f999['id']||0x0;this[_0xa0e6('0x0')]=_0x35f999[_0xa0e6('0x0')]||'';this[_0xa0e6('0x1')]=_0x35f999[_0xa0e6('0x1')];this[_0xa0e6('0x2')]=_0x35f999[_0xa0e6('0x2')];this[_0xa0e6('0x3')]=_0x35f999['headerinfo'];this[_0xa0e6('0x4')]=_0x35f999[_0xa0e6('0x4')];this[_0xa0e6('0x5')]=_0x35f999[_0xa0e6('0x5')]||0x960;this[_0xa0e6('0x6')]=_0x35f999[_0xa0e6('0x6')]||0x3840;this[_0xa0e6('0x7')]=_0x35f999[_0xa0e6('0x7')]||'v17,v27,v29';this[_0xa0e6('0x8')]=_0x35f999['gateway']||'no';this[_0xa0e6('0x9')]=_0x35f999[_0xa0e6('0x9')]||'no';this['t38timeout']=_0x35f999[_0xa0e6('0xa')]||0x1388;this[_0xa0e6('0xb')]=_0x35f999[_0xa0e6('0xb')]||_0xa0e6('0xc');this[_0xa0e6('0xd')]=_0x35f999[_0xa0e6('0xd')]?_0x35f999[_0xa0e6('0xd')]:undefined;this['ListId']=_0x35f999[_0xa0e6('0xe')];this[_0xa0e6('0xf')]=_0x35f999[_0xa0e6('0xf')];}module[_0xa0e6('0x10')]=FaxAccount; \ No newline at end of file +var _0x04b4=['modem','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x169ce3,_0x229916){var _0x3298f5=function(_0x53c3ba){while(--_0x53c3ba){_0x169ce3['push'](_0x169ce3['shift']());}};_0x3298f5(++_0x229916);}(_0x04b4,0xd6));var _0x404b=function(_0x4f17ec,_0x32d016){_0x4f17ec=_0x4f17ec-0x0;var _0x322022=_0x04b4[_0x4f17ec];return _0x322022;};'use strict';function FaxAccount(_0x3ed4b3){this['id']=_0x3ed4b3['id']||0x0;this[_0x404b('0x0')]=_0x3ed4b3[_0x404b('0x0')]||'';this[_0x404b('0x1')]=_0x3ed4b3[_0x404b('0x1')];this[_0x404b('0x2')]=_0x3ed4b3['ecm'];this[_0x404b('0x3')]=_0x3ed4b3[_0x404b('0x3')];this['localstationid']=_0x3ed4b3[_0x404b('0x4')];this[_0x404b('0x5')]=_0x3ed4b3['minrate']||0x960;this[_0x404b('0x6')]=_0x3ed4b3[_0x404b('0x6')]||0x3840;this[_0x404b('0x7')]=_0x3ed4b3['modem']||_0x404b('0x8');this[_0x404b('0x9')]=_0x3ed4b3[_0x404b('0x9')]||'no';this['faxdetect']=_0x3ed4b3[_0x404b('0xa')]||'no';this['t38timeout']=_0x3ed4b3['t38timeout']||0x1388;this[_0x404b('0xb')]=_0x3ed4b3['tech']||_0x404b('0xc');this[_0x404b('0xd')]=_0x3ed4b3[_0x404b('0xd')]?_0x3ed4b3[_0x404b('0xd')]:undefined;this[_0x404b('0xe')]=_0x3ed4b3['ListId'];this[_0x404b('0xf')]=_0x3ed4b3[_0x404b('0xf')];}module[_0x404b('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d6515eb..f6210e9 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 _0xc514=['username','token','remoteUri','serverUrl','Configurations','name'];(function(_0x1b5646,_0x3f20cd){var _0x3d0e8e=function(_0x3ef93b){while(--_0x3ef93b){_0x1b5646['push'](_0x1b5646['shift']());}};_0x3d0e8e(++_0x3f20cd);}(_0xc514,0x18b));var _0x4c51=function(_0x46dab8,_0x4ef8ed){_0x46dab8=_0x46dab8-0x0;var _0x3d1e3a=_0xc514[_0x46dab8];return _0x3d1e3a;};'use strict';function FreshdeskAccount(_0xb6a4ab){this['id']=_0xb6a4ab['id']||0x0;this[_0x4c51('0x0')]=_0xb6a4ab['name']||'';this[_0x4c51('0x1')]=_0xb6a4ab[_0x4c51('0x1')]||'';this['apiKey']=_0xb6a4ab[_0x4c51('0x2')]||'';this[_0x4c51('0x3')]=_0xb6a4ab[_0x4c51('0x3')]||'';this['serverUrl']=_0xb6a4ab[_0x4c51('0x4')]||'';this[_0x4c51('0x5')]=_0xb6a4ab[_0x4c51('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x77b7=['exports','name','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x52e718,_0x37c582){var _0x20ffb4=function(_0xb76e39){while(--_0xb76e39){_0x52e718['push'](_0x52e718['shift']());}};_0x20ffb4(++_0x37c582);}(_0x77b7,0x1c1));var _0x777b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x77b7[_0x5b644e];return _0x49c6bf;};'use strict';function FreshdeskAccount(_0x187b3e){this['id']=_0x187b3e['id']||0x0;this[_0x777b('0x0')]=_0x187b3e[_0x777b('0x0')]||'';this['username']=_0x187b3e['username']||'';this[_0x777b('0x1')]=_0x187b3e[_0x777b('0x2')]||'';this[_0x777b('0x3')]=_0x187b3e[_0x777b('0x3')]||'';this[_0x777b('0x4')]=_0x187b3e[_0x777b('0x4')]||'';this['Configurations']=_0x187b3e[_0x777b('0x5')]||{};}module[_0x777b('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 898df9b..4c4332b 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 _0xfdbd=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x31055b,_0x37ab92){var _0x1f6650=function(_0x51591b){while(--_0x51591b){_0x31055b['push'](_0x31055b['shift']());}};_0x1f6650(++_0x37ab92);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0xfdbd[_0x128bef];return _0x1ba862;};'use strict';function FreshsalesAccount(_0x3c863c){this['id']=_0x3c863c['id']||0x0;this[_0xdfdb('0x0')]=_0x3c863c[_0xdfdb('0x0')]||'';this[_0xdfdb('0x1')]=_0x3c863c[_0xdfdb('0x1')]||'';this[_0xdfdb('0x2')]=_0x3c863c[_0xdfdb('0x3')]||'';this[_0xdfdb('0x4')]=_0x3c863c[_0xdfdb('0x4')]||'';this['serverUrl']=_0x3c863c[_0xdfdb('0x5')]||'';this['Configurations']=_0x3c863c[_0xdfdb('0x6')]||{};}module[_0xdfdb('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x2c24=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x17141f,_0x4d7c4b){var _0x3ee900=function(_0x5ec0f4){while(--_0x5ec0f4){_0x17141f['push'](_0x17141f['shift']());}};_0x3ee900(++_0x4d7c4b);}(_0x2c24,0x1e6));var _0x42c2=function(_0xf32c5a,_0x5d0a3f){_0xf32c5a=_0xf32c5a-0x0;var _0x14b92d=_0x2c24[_0xf32c5a];return _0x14b92d;};'use strict';function FreshsalesAccount(_0x4e4493){this['id']=_0x4e4493['id']||0x0;this[_0x42c2('0x0')]=_0x4e4493[_0x42c2('0x0')]||'';this[_0x42c2('0x1')]=_0x4e4493[_0x42c2('0x1')]||'';this[_0x42c2('0x2')]=_0x4e4493[_0x42c2('0x3')]||'';this[_0x42c2('0x4')]=_0x4e4493[_0x42c2('0x4')]||'';this['serverUrl']=_0x4e4493[_0x42c2('0x5')]||'';this[_0x42c2('0x6')]=_0x4e4493['Configurations']||{};}module[_0x42c2('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8954a05..421bd18 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 _0x3f07=['queue','queuecallerleaveAt','position','queuecallerabandonAt','queuecallercomplete','queuecallerexit','channel','connectedlinename','accountcode','exten','priority','assigned','lastAssignedTo','voice','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname'];(function(_0x51a6fe,_0x43bb1b){var _0x5f15a0=function(_0x1408aa){while(--_0x1408aa){_0x51a6fe['push'](_0x51a6fe['shift']());}};_0x5f15a0(++_0x43bb1b);}(_0x3f07,0x79));var _0x73f0=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x3f07[_0x2ff739];return _0x12dc13;};'use strict';function QueueReport(){this[_0x73f0('0x0')]=_0x73f0('0x1');this[_0x73f0('0x2')]='';this[_0x73f0('0x3')]='';this[_0x73f0('0x4')]='';this[_0x73f0('0x5')]='';this['queuecallerjoinAt']=null;this[_0x73f0('0x6')]=null;this[_0x73f0('0x7')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x73f0('0x8')]=null;this[_0x73f0('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x73f0('0xa')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0x73f0('0xb')]='';this['connectedlinenum']='';this[_0x73f0('0xc')]='';this[_0x73f0('0xd')]='';this['context']='';this[_0x73f0('0xe')]='';this[_0x73f0('0xf')]='';this['holdtime']=0x0;this[_0x73f0('0x10')]=![];this[_0x73f0('0x11')]='';this['motionChannel']=_0x73f0('0x12');this[_0x73f0('0x13')]=0x0;this[_0x73f0('0x14')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xce67=['calleridnum','calleridname','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','motionChannel','voice','mohtime','variables','exports','type','uniqueid'];(function(_0x17ec4f,_0x7311ad){var _0x92afb9=function(_0x528908){while(--_0x528908){_0x17ec4f['push'](_0x17ec4f['shift']());}};_0x92afb9(++_0x7311ad);}(_0xce67,0x1ae));var _0x7ce6=function(_0x5c788b,_0x2bb446){_0x5c788b=_0x5c788b-0x0;var _0x21d67a=_0xce67[_0x5c788b];return _0x21d67a;};'use strict';function QueueReport(){this[_0x7ce6('0x0')]='inbound';this[_0x7ce6('0x1')]='';this[_0x7ce6('0x2')]='';this[_0x7ce6('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x7ce6('0x4')]=null;this[_0x7ce6('0x5')]=0x1;this[_0x7ce6('0x6')]=0x1;this[_0x7ce6('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x7ce6('0x8')]=![];this['queuecallercompleteAt']=null;this[_0x7ce6('0x9')]=![];this[_0x7ce6('0xa')]=null;this[_0x7ce6('0xb')]=0x1;this['channel']='';this[_0x7ce6('0xc')]='';this[_0x7ce6('0xd')]='';this[_0x7ce6('0xe')]='';this[_0x7ce6('0xf')]='';this[_0x7ce6('0x10')]='';this[_0x7ce6('0x11')]='';this['holdtime']=0x0;this[_0x7ce6('0x12')]=![];this['lastAssignedTo']='';this[_0x7ce6('0x13')]=_0x7ce6('0x14');this[_0x7ce6('0x15')]=0x0;this[_0x7ce6('0x16')]={};}module[_0x7ce6('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 dbe0831..79ec09b 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 _0xbedb=['Configurations','exports','name','username','password','clientId','clientSecret','securityToken','type','serverUrl'];(function(_0x1d0958,_0x889004){var _0x5c6f67=function(_0x37232d){while(--_0x37232d){_0x1d0958['push'](_0x1d0958['shift']());}};_0x5c6f67(++_0x889004);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x58691a){this['id']=_0x58691a['id']||0x0;this['name']=_0x58691a[_0xbbed('0x0')]||'';this[_0xbbed('0x1')]=_0x58691a[_0xbbed('0x1')]||'';this['remoteUri']=_0x58691a['remoteUri']||'';this[_0xbbed('0x2')]=_0x58691a[_0xbbed('0x2')]||'';this[_0xbbed('0x3')]=_0x58691a[_0xbbed('0x3')]||'';this[_0xbbed('0x4')]=_0x58691a[_0xbbed('0x4')]||'';this[_0xbbed('0x5')]=_0x58691a[_0xbbed('0x5')]||'';this[_0xbbed('0x6')]=_0x58691a[_0xbbed('0x6')]||'integrationTab';this[_0xbbed('0x7')]=_0x58691a['serverUrl']||'';this['Configurations']=_0x58691a[_0xbbed('0x8')]||{};}module[_0xbbed('0x9')]=SalesforceAccount; \ No newline at end of file +var _0xef4d=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xef4d,0x165));var _0xdef4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xef4d[_0x138adb];return _0x1b27f2;};'use strict';function SalesforceAccount(_0x35665b){this['id']=_0x35665b['id']||0x0;this[_0xdef4('0x0')]=_0x35665b[_0xdef4('0x0')]||'';this[_0xdef4('0x1')]=_0x35665b[_0xdef4('0x1')]||'';this[_0xdef4('0x2')]=_0x35665b[_0xdef4('0x2')]||'';this[_0xdef4('0x3')]=_0x35665b[_0xdef4('0x3')]||'';this[_0xdef4('0x4')]=_0x35665b[_0xdef4('0x4')]||'';this[_0xdef4('0x5')]=_0x35665b[_0xdef4('0x5')]||'';this['securityToken']=_0x35665b[_0xdef4('0x6')]||'';this[_0xdef4('0x7')]=_0x35665b[_0xdef4('0x7')]||_0xdef4('0x8');this[_0xdef4('0x9')]=_0x35665b[_0xdef4('0x9')]||'';this[_0xdef4('0xa')]=_0x35665b[_0xdef4('0xa')]||{};}module[_0xdef4('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 08bcd67..a67dbc9 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 _0xca38=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0xca38,0x153));var _0x8ca3=function(_0x208c01,_0x2dd63d){_0x208c01=_0x208c01-0x0;var _0x54a5fc=_0xca38[_0x208c01];return _0x54a5fc;};'use strict';function ServicenowAccount(_0x4a4f5d){this['id']=_0x4a4f5d['id']||0x0;this[_0x8ca3('0x0')]=_0x4a4f5d[_0x8ca3('0x0')]||'';this[_0x8ca3('0x1')]=_0x4a4f5d['username']||'';this[_0x8ca3('0x2')]=_0x4a4f5d['password']||'';this['remoteUri']=_0x4a4f5d[_0x8ca3('0x3')]||'';this[_0x8ca3('0x4')]=_0x4a4f5d['serverUrl']||'';this['Configurations']=_0x4a4f5d[_0x8ca3('0x5')]||{};}module[_0x8ca3('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xb082=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0xb082,0x129));var _0x2b08=function(_0x5a8b85,_0x5d1417){_0x5a8b85=_0x5a8b85-0x0;var _0x27e843=_0xb082[_0x5a8b85];return _0x27e843;};'use strict';function ServicenowAccount(_0x385944){this['id']=_0x385944['id']||0x0;this[_0x2b08('0x0')]=_0x385944['name']||'';this['username']=_0x385944[_0x2b08('0x1')]||'';this[_0x2b08('0x2')]=_0x385944[_0x2b08('0x2')]||'';this[_0x2b08('0x3')]=_0x385944[_0x2b08('0x3')]||'';this[_0x2b08('0x4')]=_0x385944[_0x2b08('0x4')]||'';this[_0x2b08('0x5')]=_0x385944[_0x2b08('0x5')]||{};}module[_0x2b08('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 e119f4f..01ad8fb 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 _0x5ad4=['username','password','remoteUri','serverUrl','exports'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x5ad4,0x1d1));var _0x45ad=function(_0x43fbc0,_0x3f72c2){_0x43fbc0=_0x43fbc0-0x0;var _0x5e55a6=_0x5ad4[_0x43fbc0];return _0x5e55a6;};'use strict';function SugarcrmAccount(_0x3833ac){this['id']=_0x3833ac['id']||0x0;this['name']=_0x3833ac['name']||'';this[_0x45ad('0x0')]=_0x3833ac['username']||'';this[_0x45ad('0x1')]=_0x3833ac[_0x45ad('0x1')]||'';this[_0x45ad('0x2')]=_0x3833ac[_0x45ad('0x2')]||'';this[_0x45ad('0x3')]=_0x3833ac['serverUrl']||'';this['Configurations']=_0x3833ac['Configurations']||{};}module[_0x45ad('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0x689c=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x30476a,_0x11f97e){var _0x56e66c=function(_0x5ea604){while(--_0x5ea604){_0x30476a['push'](_0x30476a['shift']());}};_0x56e66c(++_0x11f97e);}(_0x689c,0x9e));var _0xc689=function(_0x8bde1c,_0x16b915){_0x8bde1c=_0x8bde1c-0x0;var _0x241e7a=_0x689c[_0x8bde1c];return _0x241e7a;};'use strict';function SugarcrmAccount(_0x57fc19){this['id']=_0x57fc19['id']||0x0;this['name']=_0x57fc19[_0xc689('0x0')]||'';this[_0xc689('0x1')]=_0x57fc19[_0xc689('0x1')]||'';this[_0xc689('0x2')]=_0x57fc19[_0xc689('0x2')]||'';this[_0xc689('0x3')]=_0x57fc19['remoteUri']||'';this[_0xc689('0x4')]=_0x57fc19['serverUrl']||'';this['Configurations']=_0x57fc19[_0xc689('0x5')]||{};}module[_0xc689('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 8357c76..cc7067f 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 _0x2064=['exports','name','accountcode','unknown','status','address'];(function(_0x50547f,_0x2da4f8){var _0x4b8608=function(_0xfc2672){while(--_0xfc2672){_0x50547f['push'](_0x50547f['shift']());}};_0x4b8608(++_0x2da4f8);}(_0x2064,0x79));var _0x4206=function(_0x17a0b0,_0x247cb7){_0x17a0b0=_0x17a0b0-0x0;var _0x445ead=_0x2064[_0x17a0b0];return _0x445ead;};'use strict';function Telephone(_0x463504){this['id']=_0x463504['id']||0x0;this[_0x4206('0x0')]=_0x463504[_0x4206('0x0')]||'';this[_0x4206('0x1')]=_0x463504[_0x4206('0x1')]||'';this['state']=_0x4206('0x2');this['stateTime']=0x0;this[_0x4206('0x3')]=_0x4206('0x2');this[_0x4206('0x4')]='';}module[_0x4206('0x5')]=Telephone; \ No newline at end of file +var _0xae3f=['state','unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x4990c1,_0x442d33){var _0x37715e=function(_0x12e115){while(--_0x12e115){_0x4990c1['push'](_0x4990c1['shift']());}};_0x37715e(++_0x442d33);}(_0xae3f,0x136));var _0xfae3=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xae3f[_0x1da527];return _0x40fc7c;};'use strict';function Telephone(_0x11eacf){this['id']=_0x11eacf['id']||0x0;this[_0xfae3('0x0')]=_0x11eacf[_0xfae3('0x0')]||'';this[_0xfae3('0x1')]=_0x11eacf[_0xfae3('0x1')]||'';this[_0xfae3('0x2')]=_0xfae3('0x3');this[_0xfae3('0x4')]=0x0;this[_0xfae3('0x5')]=_0xfae3('0x3');this[_0xfae3('0x6')]='';}module[_0xfae3('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 6181610..3d65206 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x1c0ca0,_0x1fbf3e){var _0x4c9968=function(_0x7c6e0f){while(--_0x7c6e0f){_0x1c0ca0['push'](_0x1c0ca0['shift']());}};_0x4c9968(++_0x1fbf3e);}(_0xb10b,0x12a));var _0xbb10=function(_0x91fbc7,_0x207e4c){_0x91fbc7=_0x91fbc7-0x0;var _0x32a811=_0xb10b[_0x91fbc7];return _0x32a811;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x3a82cb,_0x455170){var _0x5ae24c=function(_0x34c465){while(--_0x34c465){_0x3a82cb['push'](_0x3a82cb['shift']());}};_0x5ae24c(++_0x455170);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 61bde4e..5c7b0f9 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 _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x4c2623,_0x4838bb){var _0x2be431=function(_0x55829d){while(--_0x55829d){_0x4c2623['push'](_0x4c2623['shift']());}};_0x2be431(++_0x4838bb);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x5eb8[_0x3eff21];return _0x1945bb;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x26a5cf,_0x31be5f){var _0x4c5568=function(_0x2ef8ae){while(--_0x2ef8ae){_0x26a5cf['push'](_0x26a5cf['shift']());}};_0x4c5568(++_0x31be5f);}(_0x4fc2,0x111));var _0x24fc=function(_0x371f0d,_0x5cfcc2){_0x371f0d=_0x371f0d-0x0;var _0x1728a4=_0x4fc2[_0x371f0d];return _0x1728a4;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 92326a6..c781381 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 _0xe925=['stateRegistry','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','host','port','domain'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xe925,0xc7));var _0x5e92=function(_0x228481,_0x51386e){_0x228481=_0x228481-0x0;var _0x1f3a85=_0xe925[_0x228481];return _0x1f3a85;};'use strict';function Trunk(_0x11d2e7){this['id']=_0x11d2e7['id']||0x0;this[_0x5e92('0x0')]=_0x11d2e7[_0x5e92('0x0')]||![];this[_0x5e92('0x1')]=_0x11d2e7[_0x5e92('0x1')]||'';this[_0x5e92('0x2')]=_0x5e92('0x3');this[_0x5e92('0x4')]=0x0;this[_0x5e92('0x5')]=_0x5e92('0x3');this['registry']=_0x11d2e7[_0x5e92('0x6')]&&_0x11d2e7[_0x5e92('0x6')][_0x5e92('0x7')](':')?_0x11d2e7[_0x5e92('0x6')]['split'](':')[0x0]:'';this[_0x5e92('0x8')]='';this[_0x5e92('0x9')]='';this[_0x5e92('0xa')]='';this['domainport']='';this['refresh']='';this[_0x5e92('0xb')]=_0x5e92('0x3');this['registrationtime']='';this['address']='';this[_0x5e92('0xc')]=_0x11d2e7[_0x5e92('0xc')]||'';}module[_0x5e92('0xd')]=Trunk; \ No newline at end of file +var _0x306f=['exports','active','name','state','unknown','stateTime','registry','indexOf','port','domain','refresh','stateRegistry'];(function(_0x555bbd,_0x196748){var _0x3184d7=function(_0x274943){while(--_0x274943){_0x555bbd['push'](_0x555bbd['shift']());}};_0x3184d7(++_0x196748);}(_0x306f,0x109));var _0xf306=function(_0x2e7044,_0x5409b8){_0x2e7044=_0x2e7044-0x0;var _0x26a3c2=_0x306f[_0x2e7044];return _0x26a3c2;};'use strict';function Trunk(_0x1a1695){this['id']=_0x1a1695['id']||0x0;this[_0xf306('0x0')]=_0x1a1695[_0xf306('0x0')]||![];this[_0xf306('0x1')]=_0x1a1695[_0xf306('0x1')]||'';this[_0xf306('0x2')]=_0xf306('0x3');this[_0xf306('0x4')]=0x0;this['status']=_0xf306('0x3');this[_0xf306('0x5')]=_0x1a1695[_0xf306('0x5')]&&_0x1a1695[_0xf306('0x5')][_0xf306('0x6')](':')?_0x1a1695[_0xf306('0x5')]['split'](':')[0x0]:'';this['host']='';this[_0xf306('0x7')]='';this[_0xf306('0x8')]='';this['domainport']='';this[_0xf306('0x9')]='';this[_0xf306('0xa')]=_0xf306('0x3');this['registrationtime']='';this['address']='';this['defaultuser']=_0x1a1695['defaultuser']||'';}module[_0xf306('0xb')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 8a6291f..fc0c8ac 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 _0x3953=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3953,0x1da));var _0x3395=function(_0x1c70dd,_0xb86584){_0x1c70dd=_0x1c70dd-0x0;var _0xf6dcff=_0x3953[_0x1c70dd];return _0xf6dcff;};'use strict';function voiceExtension(_0xdf8dee){this['id']=_0xdf8dee['id']||0x0;this['exten']=_0xdf8dee[_0x3395('0x0')]||'';this[_0x3395('0x1')]=_0xdf8dee[_0x3395('0x1')]||_0x3395('0x2');this[_0x3395('0x3')]=_0xdf8dee[_0x3395('0x3')]||![];}module[_0x3395('0x4')]=voiceExtension; \ No newline at end of file +var _0x4ba1=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0xbf43e,_0x39ee2b){var _0x2966fb=function(_0x11fff8){while(--_0x11fff8){_0xbf43e['push'](_0xbf43e['shift']());}};_0x2966fb(++_0x39ee2b);}(_0x4ba1,0x132));var _0x14ba=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4ba1[_0x1d1779];return _0x2377e9;};'use strict';function voiceExtension(_0x4397c7){this['id']=_0x4397c7['id']||0x0;this[_0x14ba('0x0')]=_0x4397c7[_0x14ba('0x0')]||'';this[_0x14ba('0x1')]=_0x4397c7[_0x14ba('0x1')]||_0x14ba('0x2');this[_0x14ba('0x3')]=_0x4397c7['mandatoryDisposition']||![];}module[_0x14ba('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 cfcdc15..9c2950b 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 _0x2a9a=['ringInUse','unavailable','unknown','acwTimeout','autopause','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','wav','gsm','linear','random','ringall','roundrobin','rrmemory','wrandom','name','inbound','waiting','total','answered','sumHoldTime','sumBillable','abandoned','available','busy','inUse','loggedIn','notInUse','onHold','paused','ringing'];(function(_0x3d37a1,_0x2e7a78){var _0x1d759c=function(_0x4865de){while(--_0x4865de){_0x3d37a1['push'](_0x3d37a1['shift']());}};_0x1d759c(++_0x2e7a78);}(_0x2a9a,0x64));var _0xa2a9=function(_0x3fcaf4,_0x18aa39){_0x3fcaf4=_0x3fcaf4-0x0;var _0x3ea70b=_0x2a9a[_0x3fcaf4];return _0x3ea70b;};'use strict';var monitorFormat={'wav':_0xa2a9('0x0'),'wav49':'wav49','gsm':_0xa2a9('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':_0xa2a9('0x2'),'random':_0xa2a9('0x3'),'ringall':_0xa2a9('0x4'),'rr':_0xa2a9('0x5'),'rrmemory':_0xa2a9('0x6'),'rrordered':'rrordered','wrandom':_0xa2a9('0x7')};function VoiceQueue(_0x2c31a4){this['id']=_0x2c31a4['id']||0x0;this[_0xa2a9('0x8')]=_0x2c31a4[_0xa2a9('0x8')]||'';this['monitor_format']=_0x2c31a4['monitor_format']||'';this['type']=_0x2c31a4['type']||_0xa2a9('0x9');this[_0xa2a9('0xa')]=0x0;this[_0xa2a9('0xb')]=0x0;this[_0xa2a9('0xc')]=0x0;this['sumDuration']=0x0;this[_0xa2a9('0xd')]=0x0;this[_0xa2a9('0xe')]=0x0;this['unmanaged']=0x0;this[_0xa2a9('0xf')]=0x0;this[_0xa2a9('0x10')]=0x0;this[_0xa2a9('0x11')]=0x0;this[_0xa2a9('0x12')]=0x0;this['invalid']=0x0;this[_0xa2a9('0x13')]=0x0;this[_0xa2a9('0x14')]=0x0;this[_0xa2a9('0x15')]=0x0;this[_0xa2a9('0x16')]=0x0;this[_0xa2a9('0x17')]=0x0;this[_0xa2a9('0x18')]=0x0;this['talking']=0x0;this[_0xa2a9('0x19')]=0x0;this[_0xa2a9('0x1a')]=0x0;this['acw']=_0x2c31a4['acw']||![];this['acwTimeout']=_0x2c31a4[_0xa2a9('0x1b')]||0xa;this['autopause']=_0x2c31a4[_0xa2a9('0x1c')]||'no';this['sendMessageOneNotActive']=!![];this[_0xa2a9('0x1d')]='';this[_0xa2a9('0x1e')]='';this[_0xa2a9('0x1f')]=0x0;this[_0xa2a9('0x20')]=0x0;this['dialTimezone']=_0x2c31a4[_0xa2a9('0x21')]||null;this['dialGlobalInterval']=_0x2c31a4[_0xa2a9('0x22')]?_0x2c31a4['dialGlobalInterval']:null;this[_0xa2a9('0x23')]=_0x2c31a4['dialActive'];this[_0xa2a9('0x24')]=_0x2c31a4[_0xa2a9('0x24')]||_0xa2a9('0x25');this[_0xa2a9('0x26')]=_0x2c31a4[_0xa2a9('0x26')]||0x0;this[_0xa2a9('0x27')]=_0x2c31a4[_0xa2a9('0x27')]||0x0;this[_0xa2a9('0x28')]=_0x2c31a4[_0xa2a9('0x28')]||0x1;this[_0xa2a9('0x29')]=_0x2c31a4['dialPredictiveOptimization']||_0xa2a9('0x2a');this[_0xa2a9('0x2b')]=_0x2c31a4[_0xa2a9('0x2b')]||0.03;this[_0xa2a9('0x2c')]=_0x2c31a4[_0xa2a9('0x2c')]||0x258;this[_0xa2a9('0x2d')]=_0x2c31a4['dialOriginateCallerIdName']||_0xa2a9('0x2e');this['dialOriginateCallerIdNumber']=_0x2c31a4['dialOriginateCallerIdNumber']||'anonymous';this[_0xa2a9('0x2f')]=_0x2c31a4[_0xa2a9('0x2f')]||0x1e;this['dialQueueOptions']=_0x2c31a4[_0xa2a9('0x30')]||_0xa2a9('0x31');this[_0xa2a9('0x32')]=_0x2c31a4[_0xa2a9('0x32')]||0x3;this['dialQueueProject']=_0x2c31a4[_0xa2a9('0x33')]||undefined;this[_0xa2a9('0x34')]=_0x2c31a4[_0xa2a9('0x34')]||0x3;this['dialCongestionRetryFrequency']=_0x2c31a4[_0xa2a9('0x35')]||0x96;this[_0xa2a9('0x36')]=_0x2c31a4[_0xa2a9('0x36')]||0x3;this['dialBusyRetryFrequency']=_0x2c31a4['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x2c31a4[_0xa2a9('0x37')]||0x3;this[_0xa2a9('0x38')]=_0x2c31a4[_0xa2a9('0x38')]||0x96;this[_0xa2a9('0x39')]=_0x2c31a4[_0xa2a9('0x39')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2c31a4[_0xa2a9('0x3a')]||0x96;this[_0xa2a9('0x3b')]=_0x2c31a4[_0xa2a9('0x3b')]||0x3;this[_0xa2a9('0x3c')]=_0x2c31a4[_0xa2a9('0x3c')]||0x96;this['dialAbandonedMaxRetry']=_0x2c31a4['dialAbandonedMaxRetry']||0x3;this[_0xa2a9('0x3d')]=_0x2c31a4['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x2c31a4[_0xa2a9('0x3e')]||0x3;this[_0xa2a9('0x3f')]=_0x2c31a4[_0xa2a9('0x3f')]||0x96;this['dialAgentRejectMaxRetry']=_0x2c31a4[_0xa2a9('0x40')]||0x3;this[_0xa2a9('0x41')]=_0x2c31a4[_0xa2a9('0x41')]||0x96;this[_0xa2a9('0x42')]=_0x2c31a4['callAdditionalPhoneAfterMin']||0x3;this[_0xa2a9('0x43')]=_0x2c31a4[_0xa2a9('0x43')]||0x4;this[_0xa2a9('0x44')]=_0x2c31a4[_0xa2a9('0x44')]?_0x2c31a4['Trunk']:undefined;this[_0xa2a9('0x45')]=_0x2c31a4['TrunkBackup']?_0x2c31a4[_0xa2a9('0x45')]:undefined;this['dialPrefix']=_0x2c31a4[_0xa2a9('0x46')]||undefined;this[_0xa2a9('0x47')]=_0x2c31a4[_0xa2a9('0x47')]?_0x2c31a4['Interval']:undefined;this['dialOrderByScheduledAt']=_0x2c31a4[_0xa2a9('0x48')]||'DESC';this[_0xa2a9('0x49')]=_0x2c31a4['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xa2a9('0x4a')]=_0x2c31a4['dialCutDigit']||undefined;this[_0xa2a9('0x4b')]=strategy[_0x2c31a4['strategy']];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x2c31a4['dialAMDActive']||![];this[_0xa2a9('0x4c')]=_0x2c31a4[_0xa2a9('0x4c')];this[_0xa2a9('0x4d')]=_0x2c31a4['dialAMDGreeting'];this[_0xa2a9('0x4e')]=_0x2c31a4[_0xa2a9('0x4e')];this['dialAMDTotalAnalysisTime']=_0x2c31a4['dialAMDTotalAnalysisTime'];this[_0xa2a9('0x4f')]=_0x2c31a4[_0xa2a9('0x4f')];this['dialAMDBetweenWordsSilence']=_0x2c31a4[_0xa2a9('0x50')];this[_0xa2a9('0x51')]=_0x2c31a4['dialAMDMaximumNumberOfWords'];this[_0xa2a9('0x52')]=_0x2c31a4[_0xa2a9('0x52')];this[_0xa2a9('0x53')]=_0x2c31a4[_0xa2a9('0x53')];this[_0xa2a9('0x54')]=0x0;this[_0xa2a9('0x55')]=0x0;this[_0xa2a9('0x56')]=_0x2c31a4[_0xa2a9('0x56')];this[_0xa2a9('0x57')]=0x0;this[_0xa2a9('0x58')]=0x0;this[_0xa2a9('0x59')]=0x0;this[_0xa2a9('0x5a')]=0x0;this[_0xa2a9('0x5b')]=0x0;this[_0xa2a9('0x5c')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xa2a9('0x5d')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xa2a9('0x5e')]=0x0;this[_0xa2a9('0x5f')]=0x0;this[_0xa2a9('0x60')]=0x0;this[_0xa2a9('0x61')]=0x0;this[_0xa2a9('0x62')]=0x0;this[_0xa2a9('0x63')]=undefined;this['startPredictive']=undefined;this[_0xa2a9('0x64')]=undefined;this[_0xa2a9('0x65')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xa2a9('0x66')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xa2a9('0x67')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xa2a9('0x68')]=_0x2c31a4[_0xa2a9('0x69')]||0x14;this[_0xa2a9('0x6a')]=_0x2c31a4['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xa2a9('0x6b')]=0x0;this[_0xa2a9('0x6c')]=0x0;this[_0xa2a9('0x6d')]=0x1;this['erlangCalls']=0x0;this[_0xa2a9('0x6e')]=0x0;this[_0xa2a9('0x6f')]=0x0;this[_0xa2a9('0x70')]=0x0;this[_0xa2a9('0x71')]=_0x2c31a4[_0xa2a9('0x71')]||0x1e;this[_0xa2a9('0x72')]=_0x2c31a4[_0xa2a9('0x72')]||![];this[_0xa2a9('0x73')]=!!_0x2c31a4[_0xa2a9('0x73')]||![];this[_0xa2a9('0x74')]=!!_0x2c31a4[_0xa2a9('0x74')]||![];this[_0xa2a9('0x75')]=_0x2c31a4[_0xa2a9('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x2c31a4[_0xa2a9('0x76')]||![];this[_0xa2a9('0x77')]=_0x2c31a4[_0xa2a9('0x77')]||![];this[_0xa2a9('0x78')]=monitorFormat[_0x2c31a4[_0xa2a9('0x78')]]?monitorFormat[_0x2c31a4[_0xa2a9('0x78')]]:undefined;this[_0xa2a9('0x79')]=_0x2c31a4[_0xa2a9('0x79')]||![];this['mandatoryDispositionPause']=_0x2c31a4[_0xa2a9('0x7a')]?_0x2c31a4[_0xa2a9('0x7a')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xa2a9('0x7b')]=VoiceQueue; \ No newline at end of file +var _0xe6e9=['erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','linear','random','ringall','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','sumBillable','unmanaged','available','busy','invalid','loggedIn','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond'];(function(_0x4583dc,_0x5ad92f){var _0x358122=function(_0x598127){while(--_0x598127){_0x4583dc['push'](_0x4583dc['shift']());}};_0x358122(++_0x5ad92f);}(_0xe6e9,0x182));var _0x9e6e=function(_0x6fe3d8,_0x5d7a58){_0x6fe3d8=_0x6fe3d8-0x0;var _0x476f18=_0xe6e9[_0x6fe3d8];return _0x476f18;};'use strict';var monitorFormat={'wav':_0x9e6e('0x0'),'wav49':_0x9e6e('0x1'),'gsm':_0x9e6e('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x9e6e('0x3'),'linear':_0x9e6e('0x4'),'random':_0x9e6e('0x5'),'ringall':_0x9e6e('0x6'),'rr':_0x9e6e('0x7'),'rrmemory':'rrmemory','rrordered':_0x9e6e('0x8'),'wrandom':_0x9e6e('0x9')};function VoiceQueue(_0x206572){this['id']=_0x206572['id']||0x0;this[_0x9e6e('0xa')]=_0x206572[_0x9e6e('0xa')]||'';this['monitor_format']=_0x206572[_0x9e6e('0xb')]||'';this[_0x9e6e('0xc')]=_0x206572[_0x9e6e('0xc')]||_0x9e6e('0xd');this[_0x9e6e('0xe')]=0x0;this[_0x9e6e('0xf')]=0x0;this['answered']=0x0;this[_0x9e6e('0x10')]=0x0;this[_0x9e6e('0x11')]=0x0;this[_0x9e6e('0x12')]=0x0;this[_0x9e6e('0x13')]=0x0;this['abandoned']=0x0;this[_0x9e6e('0x14')]=0x0;this[_0x9e6e('0x15')]=0x0;this['inUse']=0x0;this[_0x9e6e('0x16')]=0x0;this[_0x9e6e('0x17')]=0x0;this[_0x9e6e('0x18')]=0x0;this[_0x9e6e('0x19')]=0x0;this['paused']=0x0;this[_0x9e6e('0x1a')]=0x0;this[_0x9e6e('0x1b')]=0x0;this[_0x9e6e('0x1c')]=0x0;this[_0x9e6e('0x1d')]=0x0;this[_0x9e6e('0x1e')]=0x0;this[_0x9e6e('0x1f')]=_0x206572[_0x9e6e('0x1f')]||![];this[_0x9e6e('0x20')]=_0x206572[_0x9e6e('0x20')]||0xa;this[_0x9e6e('0x21')]=_0x206572[_0x9e6e('0x21')]||'no';this[_0x9e6e('0x22')]=!![];this[_0x9e6e('0x23')]='';this[_0x9e6e('0x24')]='';this[_0x9e6e('0x25')]=0x0;this[_0x9e6e('0x26')]=0x0;this[_0x9e6e('0x27')]=_0x206572[_0x9e6e('0x27')]||null;this[_0x9e6e('0x28')]=_0x206572[_0x9e6e('0x28')]?_0x206572[_0x9e6e('0x28')]:null;this['dialActive']=_0x206572['dialActive'];this['dialMethod']=_0x206572[_0x9e6e('0x29')]||_0x9e6e('0x2a');this[_0x9e6e('0x2b')]=_0x206572[_0x9e6e('0x2b')]||0x0;this[_0x9e6e('0x2c')]=_0x206572[_0x9e6e('0x2c')]||0x0;this[_0x9e6e('0x2d')]=_0x206572[_0x9e6e('0x2d')]||0x1;this[_0x9e6e('0x2e')]=_0x206572[_0x9e6e('0x2e')]||_0x9e6e('0x2f');this[_0x9e6e('0x30')]=_0x206572[_0x9e6e('0x30')]||0.03;this[_0x9e6e('0x31')]=_0x206572[_0x9e6e('0x31')]||0x258;this[_0x9e6e('0x32')]=_0x206572['dialOriginateCallerIdName']||_0x9e6e('0x33');this[_0x9e6e('0x34')]=_0x206572[_0x9e6e('0x34')]||_0x9e6e('0x33');this['dialOriginateTimeout']=_0x206572['dialOriginateTimeout']||0x1e;this[_0x9e6e('0x35')]=_0x206572[_0x9e6e('0x35')]||_0x9e6e('0x36');this['dialQueueTimeout']=_0x206572['dialQueueTimeout']||0x3;this[_0x9e6e('0x37')]=_0x206572[_0x9e6e('0x37')]||undefined;this[_0x9e6e('0x38')]=_0x206572[_0x9e6e('0x38')]||0x3;this['dialCongestionRetryFrequency']=_0x206572['dialCongestionRetryFrequency']||0x96;this[_0x9e6e('0x39')]=_0x206572['dialBusyMaxRetry']||0x3;this[_0x9e6e('0x3a')]=_0x206572['dialBusyRetryFrequency']||0x96;this[_0x9e6e('0x3b')]=_0x206572[_0x9e6e('0x3b')]||0x3;this['dialNoAnswerRetryFrequency']=_0x206572[_0x9e6e('0x3c')]||0x96;this[_0x9e6e('0x3d')]=_0x206572[_0x9e6e('0x3d')]||0x3;this[_0x9e6e('0x3e')]=_0x206572['dialNoSuchNumberRetryFrequency']||0x96;this[_0x9e6e('0x3f')]=_0x206572['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x206572[_0x9e6e('0x40')]||0x96;this['dialAbandonedMaxRetry']=_0x206572[_0x9e6e('0x41')]||0x3;this[_0x9e6e('0x42')]=_0x206572[_0x9e6e('0x42')]||0x96;this[_0x9e6e('0x43')]=_0x206572['dialMachineMaxRetry']||0x3;this[_0x9e6e('0x44')]=_0x206572['dialMachineRetryFrequency']||0x96;this[_0x9e6e('0x45')]=_0x206572['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x206572[_0x9e6e('0x46')]||0x96;this[_0x9e6e('0x47')]=_0x206572[_0x9e6e('0x47')]||0x3;this['dialGlobalMaxRetry']=_0x206572[_0x9e6e('0x48')]||0x4;this[_0x9e6e('0x49')]=_0x206572[_0x9e6e('0x49')]?_0x206572['Trunk']:undefined;this[_0x9e6e('0x4a')]=_0x206572[_0x9e6e('0x4a')]?_0x206572[_0x9e6e('0x4a')]:undefined;this['dialPrefix']=_0x206572['dialPrefix']||undefined;this['Interval']=_0x206572[_0x9e6e('0x4b')]?_0x206572[_0x9e6e('0x4b')]:undefined;this['dialOrderByScheduledAt']=_0x206572[_0x9e6e('0x4c')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x206572[_0x9e6e('0x4d')]||undefined;this[_0x9e6e('0x4e')]=_0x206572[_0x9e6e('0x4e')]||undefined;this['strategy']=strategy[_0x206572[_0x9e6e('0x4f')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x206572[_0x9e6e('0x50')]||![];this[_0x9e6e('0x51')]=_0x206572[_0x9e6e('0x51')];this['dialAMDGreeting']=_0x206572[_0x9e6e('0x52')];this[_0x9e6e('0x53')]=_0x206572[_0x9e6e('0x53')];this[_0x9e6e('0x54')]=_0x206572[_0x9e6e('0x54')];this[_0x9e6e('0x55')]=_0x206572['dialAMDMinWordLength'];this[_0x9e6e('0x56')]=_0x206572[_0x9e6e('0x56')];this['dialAMDMaximumNumberOfWords']=_0x206572[_0x9e6e('0x57')];this[_0x9e6e('0x58')]=_0x206572[_0x9e6e('0x58')];this[_0x9e6e('0x59')]=_0x206572['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x9e6e('0x5a')]=0x0;this['timeout']=_0x206572['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0x9e6e('0x5b')]=0x0;this[_0x9e6e('0x5c')]=0x0;this[_0x9e6e('0x5d')]=0x0;this[_0x9e6e('0x5e')]=0x0;this[_0x9e6e('0x5f')]=0x0;this[_0x9e6e('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x9e6e('0x61')]=0x0;this[_0x9e6e('0x62')]=0x0;this[_0x9e6e('0x63')]=0x0;this[_0x9e6e('0x64')]=undefined;this[_0x9e6e('0x65')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x9e6e('0x66')]=0x0;this[_0x9e6e('0x67')]=0x0;this[_0x9e6e('0x68')]=0x0;this[_0x9e6e('0x69')]=0x0;this[_0x9e6e('0x6a')]=0x0;this[_0x9e6e('0x6b')]=0x0;this[_0x9e6e('0x6c')]=0x0;this['predictiveIntervalMaxThreshold']=_0x206572[_0x9e6e('0x6d')]||0x14;this[_0x9e6e('0x6e')]=_0x206572['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x9e6e('0x6f')]=0x0;this[_0x9e6e('0x70')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x9e6e('0x71')]=0x0;this[_0x9e6e('0x72')]=0x0;this[_0x9e6e('0x73')]=0x0;this['dialRecallMeTimeout']=_0x206572[_0x9e6e('0x74')]||0x1e;this[_0x9e6e('0x75')]=_0x206572[_0x9e6e('0x75')]||![];this[_0x9e6e('0x76')]=!!_0x206572[_0x9e6e('0x76')]||![];this['dialPreviewRecallmeReminder']=!!_0x206572['dialPreviewRecallmeReminder']||![];this[_0x9e6e('0x77')]=_0x206572[_0x9e6e('0x77')]||undefined;this['dialAgiAfterHangupClient']=_0x206572['dialAgiAfterHangupClient']||![];this[_0x9e6e('0x78')]=_0x206572[_0x9e6e('0x78')]||![];this['monitor_format']=monitorFormat[_0x206572[_0x9e6e('0xb')]]?monitorFormat[_0x206572[_0x9e6e('0xb')]]:undefined;this[_0x9e6e('0x79')]=_0x206572[_0x9e6e('0x79')]||![];this[_0x9e6e('0x7a')]=_0x206572[_0x9e6e('0x7a')]?_0x206572[_0x9e6e('0x7a')]:undefined;this[_0x9e6e('0x7b')]=![];}module[_0x9e6e('0x7c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 3816031..6d249e1 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x291c=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','loggedin','callers','length','online','incall','includes','status','notInUse','booked','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','prototype','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName'];(function(_0x114bea,_0x4487b2){var _0x37b591=function(_0x382e33){while(--_0x382e33){_0x114bea['push'](_0x114bea['shift']());}};_0x37b591(++_0x4487b2);}(_0x291c,0x137));var _0xc291=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x291c[_0x21a9d9];return _0x46adce;};'use strict';var INBOUND_COUNTERS=[_0xc291('0x0'),_0xc291('0x1'),_0xc291('0x2'),_0xc291('0x3'),_0xc291('0x4'),_0xc291('0x5'),_0xc291('0x6')];var OUTBOUND_COUNTERS=[_0xc291('0x0'),_0xc291('0x7'),_0xc291('0x8'),_0xc291('0x1'),'loggedInDb',_0xc291('0x9'),'outboundAbandonedCallsDay','outboundAnswerCallsDay',_0xc291('0xa'),_0xc291('0xb'),_0xc291('0xc'),_0xc291('0xd'),'outboundNoSuchCallsDay',_0xc291('0xe'),_0xc291('0xf'),_0xc291('0x10'),_0xc291('0x3'),_0xc291('0x11'),_0xc291('0x5'),_0xc291('0x12'),_0xc291('0x13'),'total','waiting'];function VoiceQueueSummary(_0x57e78d){this['id']=_0x57e78d['id'];this[_0xc291('0x14')]=_0x57e78d[_0xc291('0x14')];this[_0xc291('0x15')]=_0x57e78d['strategy'];this[_0xc291('0x16')]=_0x57e78d['abandoned']||0x0;this[_0xc291('0x7')]=_0x57e78d[_0xc291('0x7')]||0x0;this[_0xc291('0x0')]=_0x57e78d[_0xc291('0x0')]||0x0;this[_0xc291('0x17')]=_0x57e78d[_0xc291('0x17')]||0x0;this[_0xc291('0x8')]=_0x57e78d[_0xc291('0x8')]||0x0;this[_0xc291('0x18')]=_0x57e78d[_0xc291('0x18')]||0x0;this['loggedIn']=_0x57e78d[_0xc291('0x1')]||0x0;this[_0xc291('0x2')]=_0x57e78d['loggedInDb']||0x0;this[_0xc291('0x19')]=_0x57e78d['onHold']||0x0;this['notInUse']=_0x57e78d['notInUse']||0x0;this[_0xc291('0x3')]=_0x57e78d[_0xc291('0x3')]||0x0;this[_0xc291('0x4')]=_0x57e78d[_0xc291('0x4')]||0x0;this[_0xc291('0x1a')]=_0x57e78d[_0xc291('0x1a')];this[_0xc291('0x12')]=_0x57e78d[_0xc291('0x12')];this[_0xc291('0x13')]=_0x57e78d[_0xc291('0x13')];this['sumHoldTime']=_0x57e78d[_0xc291('0x1b')]||0x0;this[_0xc291('0x5')]=_0x57e78d[_0xc291('0x5')]||0x0;this['total']=_0x57e78d[_0xc291('0x1c')]||0x0;this['type']=_0x57e78d[_0xc291('0x1d')];this[_0xc291('0x1e')]=_0x57e78d['unavailable']||0x0;this['unknown']=_0x57e78d[_0xc291('0x1f')]||0x0;this[_0xc291('0x20')]=_0x57e78d[_0xc291('0x20')]||0x0;this['waiting']=_0x57e78d[_0xc291('0x6')]||0x0;if(_0x57e78d['type']===_0xc291('0x21')){this[_0xc291('0x11')]=_0x57e78d[_0xc291('0x11')]||0x0;this[_0xc291('0x22')]=_0x57e78d[_0xc291('0x22')];this[_0xc291('0x23')]=_0x57e78d[_0xc291('0x23')];this[_0xc291('0x24')]=_0x57e78d['dialOriginateCallerIdName'];this[_0xc291('0x25')]=_0x57e78d[_0xc291('0x25')];this[_0xc291('0x26')]=_0x57e78d['dialOriginateTimeout'];this[_0xc291('0x27')]=_0x57e78d[_0xc291('0x27')];this[_0xc291('0x28')]=_0x57e78d[_0xc291('0x28')];this[_0xc291('0x29')]=_0x57e78d['outboundAnswerAgiCallsDay'];this[_0xc291('0x2a')]=_0x57e78d[_0xc291('0x2a')];this[_0xc291('0xa')]=_0x57e78d['outboundBlacklistCallsDay'];this[_0xc291('0xb')]=_0x57e78d[_0xc291('0xb')];this[_0xc291('0xc')]=_0x57e78d[_0xc291('0xc')];this['outboundDropCallsDayACS']=_0x57e78d['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x57e78d[_0xc291('0x2b')];this['outboundDropCallsDayTimeout']=_0x57e78d['outboundDropCallsDayTimeout'];this[_0xc291('0xd')]=_0x57e78d[_0xc291('0xd')];this[_0xc291('0x2c')]=_0x57e78d[_0xc291('0x2c')];this[_0xc291('0x2d')]=_0x57e78d[_0xc291('0x2d')];this[_0xc291('0xe')]=_0x57e78d[_0xc291('0xe')];this[_0xc291('0xf')]=_0x57e78d['outboundRejectCallsDay'];this[_0xc291('0x10')]=_0x57e78d['outboundUnknownCallsDay'];this[_0xc291('0x2e')]=_0x57e78d[_0xc291('0x2e')];this[_0xc291('0x2f')]=_0x57e78d['predictiveIntervalAvgHoldtime'];this[_0xc291('0x30')]=_0x57e78d[_0xc291('0x30')];this['predictiveIntervalDroppedCallsCallersExit']=_0x57e78d[_0xc291('0x31')];this[_0xc291('0x32')]=_0x57e78d[_0xc291('0x32')];this[_0xc291('0x33')]=_0x57e78d[_0xc291('0x33')];this[_0xc291('0x34')]=_0x57e78d[_0xc291('0x34')];this[_0xc291('0x35')]=_0x57e78d[_0xc291('0x35')];this[_0xc291('0x36')]=_0x57e78d['predictiveIntervalMultiplicativeFactor'];this[_0xc291('0x37')]=_0x57e78d[_0xc291('0x37')];this[_0xc291('0x38')]=_0x57e78d[_0xc291('0x38')];this[_0xc291('0x39')]=_0x57e78d[_0xc291('0x39')];this['originated']=_0x57e78d[_0xc291('0x9')];this['erlangCalls']=_0x57e78d['erlangCalls'];this[_0xc291('0x3a')]=_0x57e78d[_0xc291('0x3a')];this[_0xc291('0x3b')]=_0x57e78d[_0xc291('0x3b')];this['erlangBusyFactor']=_0x57e78d['erlangBusyFactor'];this[_0xc291('0x3c')]=_0x57e78d['startPredictive'];this['startProgressive']=_0x57e78d[_0xc291('0x3d')];this[_0xc291('0x3e')]=_0x57e78d['message'];this[_0xc291('0x3f')]=_0x57e78d['statusMessage'];}if(_0x57e78d[_0xc291('0x40')]){this[_0xc291('0x40')]={'id':_0x57e78d[_0xc291('0x40')]['id'],'name':_0x57e78d[_0xc291('0x40')][_0xc291('0x14')],'active':_0x57e78d[_0xc291('0x40')]['active'],'callerid':_0x57e78d[_0xc291('0x40')][_0xc291('0x41')]};}}VoiceQueueSummary['prototype']['createReport']=function(_0x31f0b1,_0x1f3133,_0x295661,_0x4871af){this[_0xc291('0x2')]=0x0;this[_0xc291('0x5')]=0x0;this['paused']=0x0;this[_0xc291('0x1f')]=0x0;this['notInUse']=0x0;this[_0xc291('0x8')]=0x0;this[_0xc291('0x17')]=0x0;this['invalid']=0x0;this[_0xc291('0x1e')]=0x0;this[_0xc291('0x4')]=0x0;this[_0xc291('0x1a')]=0x0;this[_0xc291('0x19')]=0x0;if(_0x295661){if(_0x295661[_0xc291('0x0')]){this[_0xc291('0x0')]=Number(_0x295661['available']);}if(_0x295661[_0xc291('0x42')]){this[_0xc291('0x1')]=Number(_0x295661[_0xc291('0x42')]);}if(_0x295661[_0xc291('0x43')]){this[_0xc291('0x6')]=Number(_0x295661['callers']);}}for(var _0x5f0e83=0x0;_0x5f0e83<_0x31f0b1[_0xc291('0x44')];_0x5f0e83++){var _0x4bd4f6=_0x1f3133['SIP/'+_0x31f0b1[_0x5f0e83][_0xc291('0x14')]];if(_0x4bd4f6&&_0x4bd4f6[_0xc291('0x45')]){this[_0xc291('0x2')]+=0x1;}if(_0x31f0b1[_0x5f0e83][_0xc291('0x46')]==='1'){this[_0xc291('0x5')]+=0x1;}if(_0x31f0b1[_0x5f0e83][_0xc291('0x3')]==='1'&&!['2','7','8'][_0xc291('0x47')](_0x31f0b1[_0x5f0e83][_0xc291('0x48')])){this[_0xc291('0x3')]+=0x1;}switch(_0x31f0b1[_0x5f0e83][_0xc291('0x48')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xc291('0x49')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xc291('0x17')]+=0x1;break;case'4':this[_0xc291('0x18')]+=0x1;break;case'5':this[_0xc291('0x1e')]+=0x1;break;case'6':this[_0xc291('0x4')]+=0x1;break;case'7':this[_0xc291('0x1a')]+=0x1;break;case'8':this[_0xc291('0x19')]+=0x1;break;}}if(this['dialMethod']===_0xc291('0x4a')){var _0x2a90f6=Object[_0xc291('0x4b')](_0x4871af);for(var _0x3f4c27=0x0;_0x3f4c27<_0x2a90f6[_0xc291('0x44')];_0x3f4c27++){var _0x4b8c9f=_0x2a90f6[_0x3f4c27];var _0x5d2571=_0x4871af[_0x4b8c9f];if(_0x5d2571['queue']===this['name']&&_0x5d2571['type']===_0xc291('0x4c')&&_0x5d2571[_0xc291('0x4d')]===_0xc291('0x4e')){this[_0xc291('0x5')]+=0x1;}}if(this['talking']>this[_0xc291('0x8')]){this[_0xc291('0x5')]=this['inUse'];}this[_0xc291('0x11')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0xc291('0x4f')]=function(_0x4b4ba7){var _0x37d6a5=![];if(_0x4b4ba7){_0x37d6a5=INBOUND_COUNTERS[_0xc291('0x50')](function(_0x3d3e9b){return this[_0x3d3e9b]!==_0x4b4ba7[_0x3d3e9b];},this);}return _0x37d6a5;};VoiceQueueSummary[_0xc291('0x51')]['compareToOutboundQueue']=function(_0x5e4976){var _0x12167c=![];var _0x1605ea=![];var _0x4150b5=![];if(_0x5e4976){_0x12167c=this[_0xc291('0x23')]!==_0x5e4976[_0xc291('0x23')]||this[_0xc291('0x22')]!==_0x5e4976[_0xc291('0x22')]||this[_0xc291('0x3e')]!==_0x5e4976[_0xc291('0x3e')]||this[_0xc291('0x3f')]!==_0x5e4976[_0xc291('0x3f')];_0x1605ea=OUTBOUND_COUNTERS[_0xc291('0x50')](function(_0x36739d){return this[_0x36739d]!==_0x5e4976[_0x36739d];},this);if(this[_0xc291('0x40')]&&_0x5e4976[_0xc291('0x40')]){_0x4150b5=this[_0xc291('0x40')][_0xc291('0x14')]!==_0x5e4976[_0xc291('0x40')][_0xc291('0x14')]||this[_0xc291('0x40')]['active']!==_0x5e4976[_0xc291('0x40')][_0xc291('0x52')];}}return _0x12167c||_0x1605ea||_0x4150b5;};VoiceQueueSummary[_0xc291('0x51')][_0xc291('0x53')]=function(_0x6ef257){this[_0xc291('0x7')]=_0x6ef257['answered'];this[_0xc291('0x3e')]=_0x6ef257['message'];this['statusMessage']=_0x6ef257[_0xc291('0x3f')];this[_0xc291('0x9')]=_0x6ef257['originated'];this[_0xc291('0x54')]=_0x6ef257[_0xc291('0x54')];this[_0xc291('0x2a')]=_0x6ef257[_0xc291('0x2a')];this[_0xc291('0xa')]=_0x6ef257[_0xc291('0xa')];this[_0xc291('0xb')]=_0x6ef257[_0xc291('0xb')];this[_0xc291('0xc')]=_0x6ef257[_0xc291('0xc')];this[_0xc291('0xd')]=_0x6ef257[_0xc291('0xd')];this[_0xc291('0x2c')]=_0x6ef257[_0xc291('0x2c')];this[_0xc291('0xe')]=_0x6ef257[_0xc291('0xe')];this[_0xc291('0xf')]=_0x6ef257['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x6ef257[_0xc291('0x10')];this[_0xc291('0x12')]=_0x6ef257['sumBillable'];this[_0xc291('0x13')]=_0x6ef257[_0xc291('0x13')];this['total']=_0x6ef257[_0xc291('0x1c')];if(this[_0xc291('0x23')]===_0xc291('0x55')){this[_0xc291('0x11')]=_0x6ef257['pTalking'];}};module[_0xc291('0x56')]=VoiceQueueSummary; \ No newline at end of file +var _0x5900=['erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','createReport','paused','loggedin','callers','online','incall','includes','status','booked','keys','length','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','prototype','compareToOutboundQueue','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','loggedIn','loggedInDb','ringing','talking','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','available','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','unavailable','unknown','unmanaged','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls'];(function(_0x337a10,_0x5191c7){var _0x575f98=function(_0x3851cd){while(--_0x3851cd){_0x337a10['push'](_0x337a10['shift']());}};_0x575f98(++_0x5191c7);}(_0x5900,0xd2));var _0x0590=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x5900[_0xf26d40];return _0x50b68c;};'use strict';var INBOUND_COUNTERS=['available',_0x0590('0x0'),_0x0590('0x1'),'paused',_0x0590('0x2'),_0x0590('0x3'),_0x0590('0x4')];var OUTBOUND_COUNTERS=['available',_0x0590('0x5'),_0x0590('0x6'),'loggedIn',_0x0590('0x1'),_0x0590('0x7'),'outboundAbandonedCallsDay',_0x0590('0x8'),_0x0590('0x9'),_0x0590('0xa'),_0x0590('0xb'),_0x0590('0xc'),_0x0590('0xd'),_0x0590('0xe'),_0x0590('0xf'),_0x0590('0x10'),'paused',_0x0590('0x11'),_0x0590('0x3'),'sumBillable',_0x0590('0x12'),_0x0590('0x13'),'waiting'];function VoiceQueueSummary(_0x563c07){this['id']=_0x563c07['id'];this[_0x0590('0x14')]=_0x563c07['name'];this[_0x0590('0x15')]=_0x563c07[_0x0590('0x15')];this[_0x0590('0x16')]=_0x563c07[_0x0590('0x16')]||0x0;this[_0x0590('0x5')]=_0x563c07['answered']||0x0;this[_0x0590('0x17')]=_0x563c07[_0x0590('0x17')]||0x0;this['busy']=_0x563c07[_0x0590('0x18')]||0x0;this[_0x0590('0x6')]=_0x563c07[_0x0590('0x6')]||0x0;this['invalid']=_0x563c07[_0x0590('0x19')]||0x0;this['loggedIn']=_0x563c07[_0x0590('0x0')]||0x0;this[_0x0590('0x1')]=_0x563c07[_0x0590('0x1')]||0x0;this[_0x0590('0x1a')]=_0x563c07[_0x0590('0x1a')]||0x0;this[_0x0590('0x1b')]=_0x563c07[_0x0590('0x1b')]||0x0;this['paused']=_0x563c07['paused']||0x0;this[_0x0590('0x2')]=_0x563c07[_0x0590('0x2')]||0x0;this['ringInUse']=_0x563c07[_0x0590('0x1c')];this[_0x0590('0x1d')]=_0x563c07[_0x0590('0x1d')];this['sumDuration']=_0x563c07['sumDuration'];this[_0x0590('0x1e')]=_0x563c07['sumHoldTime']||0x0;this['talking']=_0x563c07[_0x0590('0x3')]||0x0;this[_0x0590('0x13')]=_0x563c07[_0x0590('0x13')]||0x0;this['type']=_0x563c07['type'];this[_0x0590('0x1f')]=_0x563c07[_0x0590('0x1f')]||0x0;this[_0x0590('0x20')]=_0x563c07['unknown']||0x0;this[_0x0590('0x21')]=_0x563c07[_0x0590('0x21')]||0x0;this[_0x0590('0x4')]=_0x563c07[_0x0590('0x4')]||0x0;if(_0x563c07[_0x0590('0x22')]===_0x0590('0x23')){this['pTalking']=_0x563c07['pTalking']||0x0;this[_0x0590('0x24')]=_0x563c07['dialActive'];this[_0x0590('0x25')]=_0x563c07[_0x0590('0x25')];this[_0x0590('0x26')]=_0x563c07[_0x0590('0x26')];this['dialOriginateCallerIdNumber']=_0x563c07[_0x0590('0x27')];this[_0x0590('0x28')]=_0x563c07[_0x0590('0x28')];this[_0x0590('0x29')]=_0x563c07[_0x0590('0x29')];this['temp']=_0x563c07[_0x0590('0x2a')];this[_0x0590('0x2b')]=_0x563c07[_0x0590('0x2b')];this[_0x0590('0x8')]=_0x563c07[_0x0590('0x8')];this[_0x0590('0x9')]=_0x563c07[_0x0590('0x9')];this[_0x0590('0xa')]=_0x563c07[_0x0590('0xa')];this[_0x0590('0xb')]=_0x563c07[_0x0590('0xb')];this[_0x0590('0x2c')]=_0x563c07['outboundDropCallsDayACS'];this[_0x0590('0x2d')]=_0x563c07[_0x0590('0x2d')];this[_0x0590('0x2e')]=_0x563c07[_0x0590('0x2e')];this[_0x0590('0xc')]=_0x563c07[_0x0590('0xc')];this[_0x0590('0xd')]=_0x563c07[_0x0590('0xd')];this[_0x0590('0x2f')]=_0x563c07[_0x0590('0x2f')];this[_0x0590('0xe')]=_0x563c07[_0x0590('0xe')];this[_0x0590('0xf')]=_0x563c07['outboundRejectCallsDay'];this[_0x0590('0x10')]=_0x563c07[_0x0590('0x10')];this[_0x0590('0x30')]=_0x563c07[_0x0590('0x30')];this['predictiveIntervalAvgHoldtime']=_0x563c07[_0x0590('0x31')];this[_0x0590('0x32')]=_0x563c07['predictiveIntervalAvgTalktime'];this[_0x0590('0x33')]=_0x563c07[_0x0590('0x33')];this[_0x0590('0x34')]=_0x563c07[_0x0590('0x34')];this[_0x0590('0x35')]=_0x563c07['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x563c07[_0x0590('0x36')];this[_0x0590('0x37')]=_0x563c07['predictiveIntervalHitRate'];this[_0x0590('0x38')]=_0x563c07[_0x0590('0x38')];this[_0x0590('0x39')]=_0x563c07[_0x0590('0x39')];this[_0x0590('0x3a')]=_0x563c07['predictiveIntervalAvailable'];this[_0x0590('0x3b')]=_0x563c07[_0x0590('0x3b')];this[_0x0590('0x7')]=_0x563c07[_0x0590('0x7')];this[_0x0590('0x3c')]=_0x563c07[_0x0590('0x3c')];this[_0x0590('0x3d')]=_0x563c07[_0x0590('0x3d')];this['erlangAbandonmentRate']=_0x563c07[_0x0590('0x3e')];this[_0x0590('0x3f')]=_0x563c07[_0x0590('0x3f')];this[_0x0590('0x40')]=_0x563c07[_0x0590('0x40')];this[_0x0590('0x41')]=_0x563c07[_0x0590('0x41')];this[_0x0590('0x42')]=_0x563c07[_0x0590('0x42')];this[_0x0590('0x43')]=_0x563c07[_0x0590('0x43')];}if(_0x563c07[_0x0590('0x44')]){this['Trunk']={'id':_0x563c07[_0x0590('0x44')]['id'],'name':_0x563c07[_0x0590('0x44')]['name'],'active':_0x563c07[_0x0590('0x44')]['active'],'callerid':_0x563c07['Trunk']['callerid']};}}VoiceQueueSummary['prototype'][_0x0590('0x45')]=function(_0x150841,_0x53adbe,_0x32ead9,_0x351d05){this[_0x0590('0x1')]=0x0;this[_0x0590('0x3')]=0x0;this[_0x0590('0x46')]=0x0;this[_0x0590('0x20')]=0x0;this[_0x0590('0x1b')]=0x0;this['inUse']=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0x0590('0x1f')]=0x0;this[_0x0590('0x2')]=0x0;this[_0x0590('0x1c')]=0x0;this['onHold']=0x0;if(_0x32ead9){if(_0x32ead9[_0x0590('0x17')]){this[_0x0590('0x17')]=Number(_0x32ead9[_0x0590('0x17')]);}if(_0x32ead9[_0x0590('0x47')]){this[_0x0590('0x0')]=Number(_0x32ead9[_0x0590('0x47')]);}if(_0x32ead9[_0x0590('0x48')]){this[_0x0590('0x4')]=Number(_0x32ead9[_0x0590('0x48')]);}}for(var _0x3bec79=0x0;_0x3bec79<_0x150841['length'];_0x3bec79++){var _0x578687=_0x53adbe['SIP/'+_0x150841[_0x3bec79][_0x0590('0x14')]];if(_0x578687&&_0x578687[_0x0590('0x49')]){this[_0x0590('0x1')]+=0x1;}if(_0x150841[_0x3bec79][_0x0590('0x4a')]==='1'){this[_0x0590('0x3')]+=0x1;}if(_0x150841[_0x3bec79][_0x0590('0x46')]==='1'&&!['2','7','8'][_0x0590('0x4b')](_0x150841[_0x3bec79][_0x0590('0x4c')])){this['paused']+=0x1;}switch(_0x150841[_0x3bec79]['status']){case'0':this[_0x0590('0x20')]+=0x1;break;case'1':this[_0x0590('0x1b')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x0590('0x18')]+=0x1;break;case'4':this[_0x0590('0x19')]+=0x1;break;case'5':this[_0x0590('0x1f')]+=0x1;break;case'6':this[_0x0590('0x2')]+=0x1;break;case'7':this[_0x0590('0x1c')]+=0x1;break;case'8':this[_0x0590('0x1a')]+=0x1;break;}}if(this['dialMethod']===_0x0590('0x4d')){var _0x58e7a9=Object[_0x0590('0x4e')](_0x351d05);for(var _0x33ac86=0x0;_0x33ac86<_0x58e7a9[_0x0590('0x4f')];_0x33ac86++){var _0x1058d8=_0x58e7a9[_0x33ac86];var _0x42aef8=_0x351d05[_0x1058d8];if(_0x42aef8['queue']===this['name']&&_0x42aef8['type']===_0x0590('0x50')&&_0x42aef8[_0x0590('0x51')]===_0x0590('0x52')){this[_0x0590('0x3')]+=0x1;}}if(this['talking']>this[_0x0590('0x6')]){this[_0x0590('0x3')]=this['inUse'];}this[_0x0590('0x11')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x0590('0x53')]=function(_0x2dda01){var _0x398f07=![];if(_0x2dda01){_0x398f07=INBOUND_COUNTERS[_0x0590('0x54')](function(_0x2a297){return this[_0x2a297]!==_0x2dda01[_0x2a297];},this);}return _0x398f07;};VoiceQueueSummary[_0x0590('0x55')][_0x0590('0x56')]=function(_0x3005ad){var _0x5ee4c9=![];var _0x5e878f=![];var _0xcaea9d=![];if(_0x3005ad){_0x5ee4c9=this[_0x0590('0x25')]!==_0x3005ad[_0x0590('0x25')]||this[_0x0590('0x24')]!==_0x3005ad[_0x0590('0x24')]||this['message']!==_0x3005ad[_0x0590('0x42')]||this['statusMessage']!==_0x3005ad['statusMessage'];_0x5e878f=OUTBOUND_COUNTERS[_0x0590('0x54')](function(_0x1abddd){return this[_0x1abddd]!==_0x3005ad[_0x1abddd];},this);if(this[_0x0590('0x44')]&&_0x3005ad[_0x0590('0x44')]){_0xcaea9d=this[_0x0590('0x44')][_0x0590('0x14')]!==_0x3005ad[_0x0590('0x44')][_0x0590('0x14')]||this[_0x0590('0x44')][_0x0590('0x57')]!==_0x3005ad[_0x0590('0x44')][_0x0590('0x57')];}}return _0x5ee4c9||_0x5e878f||_0xcaea9d;};VoiceQueueSummary[_0x0590('0x55')][_0x0590('0x58')]=function(_0x2f028f){this['answered']=_0x2f028f[_0x0590('0x5')];this[_0x0590('0x42')]=_0x2f028f[_0x0590('0x42')];this[_0x0590('0x43')]=_0x2f028f[_0x0590('0x43')];this[_0x0590('0x7')]=_0x2f028f['originated'];this['outboundAbandonedCallsDay']=_0x2f028f[_0x0590('0x59')];this[_0x0590('0x8')]=_0x2f028f['outboundAnswerCallsDay'];this[_0x0590('0x9')]=_0x2f028f[_0x0590('0x9')];this[_0x0590('0xa')]=_0x2f028f[_0x0590('0xa')];this[_0x0590('0xb')]=_0x2f028f[_0x0590('0xb')];this[_0x0590('0xc')]=_0x2f028f[_0x0590('0xc')];this[_0x0590('0xd')]=_0x2f028f[_0x0590('0xd')];this[_0x0590('0xe')]=_0x2f028f[_0x0590('0xe')];this[_0x0590('0xf')]=_0x2f028f[_0x0590('0xf')];this[_0x0590('0x10')]=_0x2f028f[_0x0590('0x10')];this[_0x0590('0x1d')]=_0x2f028f[_0x0590('0x1d')];this[_0x0590('0x12')]=_0x2f028f[_0x0590('0x12')];this[_0x0590('0x13')]=_0x2f028f[_0x0590('0x13')];if(this[_0x0590('0x25')]==='preview'){this[_0x0590('0x11')]=_0x2f028f['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 50a5b7d..998c88a 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 _0xdade=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1664cb,_0x4a3d02){var _0x4ad1d3=function(_0x340135){while(--_0x340135){_0x1664cb['push'](_0x1664cb['shift']());}};_0x4ad1d3(++_0x4a3d02);}(_0xdade,0x108));var _0xedad=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xdade[_0x3e44fa];return _0x2a0aba;};'use strict';function VtigerAccount(_0x18e5d3){this['id']=_0x18e5d3['id']||0x0;this['name']=_0x18e5d3[_0xedad('0x0')]||'';this[_0xedad('0x1')]=_0x18e5d3[_0xedad('0x1')]||'';this[_0xedad('0x2')]=_0x18e5d3['accessKey']||'';this[_0xedad('0x3')]=_0x18e5d3['remoteUri']||'';this[_0xedad('0x4')]=_0x18e5d3[_0xedad('0x4')]||'';this['Configurations']=_0x18e5d3[_0xedad('0x5')]||{};}module[_0xedad('0x6')]=VtigerAccount; \ No newline at end of file +var _0xff75=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1cd618,_0x471bc1){var _0x118174=function(_0x47d34c){while(--_0x47d34c){_0x1cd618['push'](_0x1cd618['shift']());}};_0x118174(++_0x471bc1);}(_0xff75,0xbf));var _0x5ff7=function(_0x36f661,_0x3a0ced){_0x36f661=_0x36f661-0x0;var _0x262bb2=_0xff75[_0x36f661];return _0x262bb2;};'use strict';function VtigerAccount(_0x14439a){this['id']=_0x14439a['id']||0x0;this[_0x5ff7('0x0')]=_0x14439a[_0x5ff7('0x0')]||'';this['username']=_0x14439a[_0x5ff7('0x1')]||'';this['accessKey']=_0x14439a['accessKey']||'';this[_0x5ff7('0x2')]=_0x14439a[_0x5ff7('0x2')]||'';this[_0x5ff7('0x3')]=_0x14439a['serverUrl']||'';this[_0x5ff7('0x4')]=_0x14439a[_0x5ff7('0x4')]||{};}module[_0x5ff7('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 41857d9..2956992 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 _0x8f56=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x18e3d0,_0x4dac5b){var _0x3970f0=function(_0x598783){while(--_0x598783){_0x18e3d0['push'](_0x18e3d0['shift']());}};_0x3970f0(++_0x4dac5b);}(_0x8f56,0x1e9));var _0x68f5=function(_0xbf546f,_0x29e51d){_0xbf546f=_0xbf546f-0x0;var _0x552dbb=_0x8f56[_0xbf546f];return _0x552dbb;};'use strict';function ZendeskAccount(_0x2557b8){this['id']=_0x2557b8['id']||0x0;this[_0x68f5('0x0')]=_0x2557b8[_0x68f5('0x0')]||'';this[_0x68f5('0x1')]=_0x2557b8[_0x68f5('0x1')]||'';this[_0x68f5('0x2')]=_0x2557b8['password']||'';this[_0x68f5('0x3')]=_0x2557b8[_0x68f5('0x3')]||'';this[_0x68f5('0x4')]=_0x2557b8[_0x68f5('0x4')]||'';this[_0x68f5('0x5')]=_0x2557b8['authType']||'';this[_0x68f5('0x6')]=_0x2557b8[_0x68f5('0x6')]||_0x68f5('0x7');this['serverUrl']=_0x2557b8[_0x68f5('0x8')]||'';this[_0x68f5('0x9')]=_0x2557b8['Configurations']||{};}module[_0x68f5('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x8a49=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x26fc3b,_0x2b1be3){var _0x380e31=function(_0x391a02){while(--_0x391a02){_0x26fc3b['push'](_0x26fc3b['shift']());}};_0x380e31(++_0x2b1be3);}(_0x8a49,0x7c));var _0x98a4=function(_0x26eb88,_0x5efcf1){_0x26eb88=_0x26eb88-0x0;var _0x5a1b15=_0x8a49[_0x26eb88];return _0x5a1b15;};'use strict';function ZendeskAccount(_0x4d2bc6){this['id']=_0x4d2bc6['id']||0x0;this[_0x98a4('0x0')]=_0x4d2bc6[_0x98a4('0x0')]||'';this[_0x98a4('0x1')]=_0x4d2bc6[_0x98a4('0x1')]||'';this[_0x98a4('0x2')]=_0x4d2bc6[_0x98a4('0x2')]||'';this[_0x98a4('0x3')]=_0x4d2bc6[_0x98a4('0x3')]||'';this['remoteUri']=_0x4d2bc6[_0x98a4('0x4')]||'';this[_0x98a4('0x5')]=_0x4d2bc6[_0x98a4('0x5')]||'';this[_0x98a4('0x6')]=_0x4d2bc6['type']||_0x98a4('0x7');this[_0x98a4('0x8')]=_0x4d2bc6['serverUrl']||'';this[_0x98a4('0x9')]=_0x4d2bc6[_0x98a4('0x9')]||{};}module[_0x98a4('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 59a14ab..0e37684 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 _0x9964=['exports','name','description','host','zone','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x29c2a2,_0xdb3146){var _0x3002d4=function(_0x1d468b){while(--_0x1d468b){_0x29c2a2['push'](_0x29c2a2['shift']());}};_0x3002d4(++_0xdb3146);}(_0x9964,0xab));var _0x4996=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x9964[_0x186d17];return _0x5d4b89;};'use strict';function ZohoAccount(_0x3398c7){this['id']=_0x3398c7['id']||0x0;this[_0x4996('0x0')]=_0x3398c7['name']||'';this[_0x4996('0x1')]=_0x3398c7['description']||'';this['host']=_0x3398c7[_0x4996('0x2')]||'';this[_0x4996('0x3')]=_0x3398c7[_0x4996('0x3')]||'';this['clientId']=_0x3398c7['clientId']||'';this['clientSecret']=_0x3398c7[_0x4996('0x4')]||'';this[_0x4996('0x5')]=_0x3398c7[_0x4996('0x5')]||'';this[_0x4996('0x6')]=_0x3398c7[_0x4996('0x6')]||'';this[_0x4996('0x7')]=_0x3398c7[_0x4996('0x7')]||'';this[_0x4996('0x8')]=_0x3398c7[_0x4996('0x8')]||{};}module[_0x4996('0x9')]=ZohoAccount; \ No newline at end of file +var _0x49de=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x3aa091,_0x4a938a){var _0x1823d7=function(_0x3e690a){while(--_0x3e690a){_0x3aa091['push'](_0x3aa091['shift']());}};_0x1823d7(++_0x4a938a);}(_0x49de,0xed));var _0xe49d=function(_0x5c3143,_0x12d54c){_0x5c3143=_0x5c3143-0x0;var _0x42708d=_0x49de[_0x5c3143];return _0x42708d;};'use strict';function ZohoAccount(_0x1718e0){this['id']=_0x1718e0['id']||0x0;this[_0xe49d('0x0')]=_0x1718e0[_0xe49d('0x0')]||'';this[_0xe49d('0x1')]=_0x1718e0[_0xe49d('0x1')]||'';this[_0xe49d('0x2')]=_0x1718e0[_0xe49d('0x2')]||'';this['zone']=_0x1718e0[_0xe49d('0x3')]||'';this[_0xe49d('0x4')]=_0x1718e0[_0xe49d('0x4')]||'';this[_0xe49d('0x5')]=_0x1718e0['clientSecret']||'';this['serverUrl']=_0x1718e0[_0xe49d('0x6')]||'';this['code']=_0x1718e0[_0xe49d('0x7')]||'';this[_0xe49d('0x8')]=_0x1718e0['refreshToken']||'';this['Configurations']=_0x1718e0[_0xe49d('0x9')]||{};}module[_0xe49d('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 0675c45..e6f4be2 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 _0x896e=['Contact','phone','firstName','lastName','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','queue','membername','Agent','format','SIP/%s','calleridname'];(function(_0x20983f,_0x1b48d7){var _0x577804=function(_0x14f237){while(--_0x14f237){_0x20983f['push'](_0x20983f['shift']());}};_0x577804(++_0x1b48d7);}(_0x896e,0x1e9));var _0xe896=function(_0x4b8e54,_0x4fe401){_0x4b8e54=_0x4b8e54-0x0;var _0x380763=_0x896e[_0x4b8e54];return _0x380763;};'use strict';var util=require(_0xe896('0x0'));var _=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));function checkNameSurname(_0x229b59,_0x36085e,_0x26d296){var _0x2af995='';if(!_[_0xe896('0x3')](_0x36085e)&&_0xe896('0x4')===typeof _0x36085e){_0x2af995+=_0x36085e;}if(!_[_0xe896('0x3')](_0x26d296)&&_0xe896('0x4')===typeof _0x26d296){_0x2af995+='\x20'+_0x26d296;}if(_0x2af995!==''){return _0x2af995;}return _0x229b59;}function Action(_0x318a7b,_0x52ac80,_0x24c430,_0x7a0721,_0x3b902c){this[_0xe896('0x5')]=_0x24c430||undefined;this[_0xe896('0x6')]=_0x318a7b['id'];this['queue']=_0x52ac80[_0xe896('0x7')];this[_0xe896('0x8')]=_0x52ac80[_0xe896('0x8')];this['campaigntype']=_0xe896('0x9');this['dialAnswer']=![];this[_0xe896('0xa')]=_['isNil'](_0x318a7b[_0xe896('0xb')])?undefined:_0x318a7b[_0xe896('0xb')][_0xe896('0x7')];this['channelAgent']=this[_0xe896('0xa')]?util[_0xe896('0xc')](_0xe896('0xd'),this['membername']):_0x7a0721||undefined;this[_0xe896('0xe')]=checkNameSurname(_0x318a7b[_0xe896('0xf')][_0xe896('0x10')],_0x318a7b['Contact'][_0xe896('0x11')],_0x318a7b[_0xe896('0xf')][_0xe896('0x12')]);this['active']=_0x318a7b['active']||![];this[_0xe896('0x13')]=_0x318a7b[_0xe896('0x10')];this['scheduledat']=_0x318a7b['scheduledat'];this[_0xe896('0x14')]=_0x318a7b[_0xe896('0x14')]||0x0;this['countcongestionretry']=_0x318a7b[_0xe896('0x15')]||0x0;this['countnoanswerretry']=_0x318a7b[_0xe896('0x16')]||0x0;this[_0xe896('0x17')]=(_0x318a7b[_0xe896('0x14')]||0x0)+(_0x318a7b['countcongestionretry']||0x0)+(_0x318a7b[_0xe896('0x16')]||0x0)+(_0x318a7b[_0xe896('0x18')]||0x0)+(_0x318a7b[_0xe896('0x19')]||0x0)+(_0x318a7b[_0xe896('0x1a')]||0x0)+(_0x318a7b[_0xe896('0x1b')]||0x0)+(_0x318a7b[_0xe896('0x1c')]||0x0);this[_0xe896('0x18')]=_0x318a7b[_0xe896('0x18')]||0x0;this['countdropretry']=_0x318a7b[_0xe896('0x19')]||0x0;this['countabandonedretry']=_0x318a7b['countabandonedretry']||0x0;this[_0xe896('0x1b')]=_0x318a7b[_0xe896('0x1b')]||0x0;this[_0xe896('0x1c')]=_0x318a7b[_0xe896('0x1c')]||0x0;this['callback']=_0x318a7b[_0xe896('0x1d')];this['callbackuniqueid']=_0x318a7b['callbackuniqueid'];this[_0xe896('0x1e')]=_0x318a7b[_0xe896('0x1e')];this[_0xe896('0x1f')]=_0x318a7b[_0xe896('0x1f')];this[_0xe896('0x20')]=_0x318a7b[_0xe896('0x20')];this[_0xe896('0x21')]=_0x318a7b['ListId'];this[_0xe896('0x22')]=_[_0xe896('0x3')](_0x318a7b[_0xe896('0xb')])?_0x318a7b['UserId']:_0x318a7b[_0xe896('0xb')]['id'];this[_0xe896('0x23')]=_0x318a7b[_0xe896('0x23')];this[_0xe896('0x24')]='';this[_0xe896('0x25')]='';}Action[_0xe896('0x26')]['getCaller']=function(){return util[_0xe896('0xc')](_0xe896('0x27'),this[_0xe896('0xe')],this[_0xe896('0x28')]);};module[_0xe896('0x29')]=Action; \ No newline at end of file +var _0x9582=['phone','lastName','calleridnum','scheduledat','countcongestionretry','countglobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','uniqueid','name','type','queue','membername','Agent','format','SIP/%s','calleridname','Contact'];(function(_0x581853,_0x378622){var _0x32646d=function(_0x54f645){while(--_0x54f645){_0x581853['push'](_0x581853['shift']());}};_0x32646d(++_0x378622);}(_0x9582,0x95));var _0x2958=function(_0x169533,_0x2ad97f){_0x169533=_0x169533-0x0;var _0x1dfea6=_0x9582[_0x169533];return _0x1dfea6;};'use strict';var util=require(_0x2958('0x0'));var _=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));function checkNameSurname(_0x3d6d1f,_0x42752c,_0x176287){var _0x559a01='';if(!_[_0x2958('0x3')](_0x42752c)&&_0x2958('0x4')===typeof _0x42752c){_0x559a01+=_0x42752c;}if(!_[_0x2958('0x3')](_0x176287)&&_0x2958('0x4')===typeof _0x176287){_0x559a01+='\x20'+_0x176287;}if(_0x559a01!==''){return _0x559a01;}return _0x3d6d1f;}function Action(_0x2f15c9,_0xbde128,_0x88ffaa,_0x309525,_0xa385ec){this[_0x2958('0x5')]=_0x88ffaa||undefined;this['idContact']=_0x2f15c9['id'];this['queue']=_0xbde128[_0x2958('0x6')];this['type']=_0xbde128[_0x2958('0x7')];this['campaigntype']=_0x2958('0x8');this['dialAnswer']=![];this[_0x2958('0x9')]=_[_0x2958('0x3')](_0x2f15c9[_0x2958('0xa')])?undefined:_0x2f15c9[_0x2958('0xa')][_0x2958('0x6')];this['channelAgent']=this[_0x2958('0x9')]?util[_0x2958('0xb')](_0x2958('0xc'),this[_0x2958('0x9')]):_0x309525||undefined;this[_0x2958('0xd')]=checkNameSurname(_0x2f15c9[_0x2958('0xe')][_0x2958('0xf')],_0x2f15c9[_0x2958('0xe')]['firstName'],_0x2f15c9[_0x2958('0xe')][_0x2958('0x10')]);this['active']=_0x2f15c9['active']||![];this[_0x2958('0x11')]=_0x2f15c9[_0x2958('0xf')];this['scheduledat']=_0x2f15c9[_0x2958('0x12')];this['countbusyretry']=_0x2f15c9['countbusyretry']||0x0;this[_0x2958('0x13')]=_0x2f15c9[_0x2958('0x13')]||0x0;this['countnoanswerretry']=_0x2f15c9['countnoanswerretry']||0x0;this[_0x2958('0x14')]=(_0x2f15c9[_0x2958('0x15')]||0x0)+(_0x2f15c9[_0x2958('0x13')]||0x0)+(_0x2f15c9[_0x2958('0x16')]||0x0)+(_0x2f15c9[_0x2958('0x17')]||0x0)+(_0x2f15c9['countdropretry']||0x0)+(_0x2f15c9[_0x2958('0x18')]||0x0)+(_0x2f15c9[_0x2958('0x19')]||0x0)+(_0x2f15c9[_0x2958('0x1a')]||0x0);this['countnosuchnumberretry']=_0x2f15c9[_0x2958('0x17')]||0x0;this['countdropretry']=_0x2f15c9[_0x2958('0x1b')]||0x0;this['countabandonedretry']=_0x2f15c9['countabandonedretry']||0x0;this[_0x2958('0x19')]=_0x2f15c9[_0x2958('0x19')]||0x0;this[_0x2958('0x1a')]=_0x2f15c9[_0x2958('0x1a')]||0x0;this[_0x2958('0x1c')]=_0x2f15c9[_0x2958('0x1c')];this[_0x2958('0x1d')]=_0x2f15c9[_0x2958('0x1d')];this[_0x2958('0x1e')]=_0x2f15c9[_0x2958('0x1e')];this[_0x2958('0x1f')]=_0x2f15c9[_0x2958('0x1f')];this[_0x2958('0x20')]=_0x2f15c9[_0x2958('0x20')];this[_0x2958('0x21')]=_0x2f15c9['ListId'];this['UserId']=_[_0x2958('0x3')](_0x2f15c9[_0x2958('0xa')])?_0x2f15c9[_0x2958('0x22')]:_0x2f15c9[_0x2958('0xa')]['id'];this['VoiceQueueId']=_0x2f15c9[_0x2958('0x23')];this['originatecalleridnum']='';this[_0x2958('0x24')]='';}Action[_0x2958('0x25')][_0x2958('0x26')]=function(){return util[_0x2958('0xb')](_0x2958('0x27'),this[_0x2958('0xd')],this[_0x2958('0x28')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 52fa933..276adf7 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x43b8c9,_0x77e4d5){var _0x53d2fc=function(_0x16817d){while(--_0x16817d){_0x43b8c9['push'](_0x43b8c9['shift']());}};_0x53d2fc(++_0x77e4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x1ec7ba,_0xb004bf){var _0x551796=function(_0x472e3d){while(--_0x472e3d){_0x1ec7ba['push'](_0x1ec7ba['shift']());}};_0x551796(++_0xb004bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 79f3c87..86eca3b 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 _0x3f27=['[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','createHistory','catch','resolve','[createHistory]\x20'];(function(_0x5dbc6a,_0x55c7c6){var _0x33c9c7=function(_0x376bf8){while(--_0x376bf8){_0x5dbc6a['push'](_0x5dbc6a['shift']());}};_0x33c9c7(++_0x55c7c6);}(_0x3f27,0x11b));var _0x73f2=function(_0x59d219,_0x108a35){_0x59d219=_0x59d219-0x0;var _0x46f3e5=_0x3f27[_0x59d219];return _0x46f3e5;};'use strict';var util=require('util');var BPromise=require(_0x73f2('0x0'));var logger=require(_0x73f2('0x1'))(_0x73f2('0x2'));var cmHopper=require(_0x73f2('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x73f2('0x4'));var agentReportPreview=require(_0x73f2('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x3547f0){return function(_0x1b7c5f){logger[_0x73f2('0x6')](_0x3547f0,util['inspect'](_0x1b7c5f,{'showHidden':![],'depth':null}));};}function create(_0x58d3fb){return cmHopperHistory[_0x73f2('0x7')](_0x58d3fb)[_0x73f2('0x8')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x470c3b){return BPromise[_0x73f2('0x9')]()['then'](agentReportPreview[_0x73f2('0x7')](_0x470c3b))[_0x73f2('0x8')](loggerCatch(_0x73f2('0xa')));}function moveContact(_0x3f8326){return cmHopper['moveContactManagedDialer'](_0x3f8326,!![])[_0x73f2('0x8')](loggerCatch(_0x73f2('0xb')));}exports[_0x73f2('0xc')]=function(_0x32fa37){return cmHopperBlack[_0x73f2('0xc')](_0x32fa37)[_0x73f2('0x8')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x73f2('0xd')]=function(_0x558e54){return BPromise[_0x73f2('0x9')]()[_0x73f2('0xe')](cmHopper[_0x73f2('0xd')](_0x558e54))[_0x73f2('0x8')](loggerCatch(_0x73f2('0xf')));};exports[_0x73f2('0x7')]=function(_0x25c926,_0x1301f4){create(_0x25c926)['catch'](loggerCatch(_0x1301f4));moveContact(_0x25c926)[_0x73f2('0x8')](loggerCatch(_0x1301f4));};exports[_0x73f2('0x10')]=function(_0x149240,_0x567c19){createAgent(_0x149240)[_0x73f2('0x8')](loggerCatch(_0x567c19));};exports[_0x73f2('0x11')]=function(_0x282ec3,_0xb8f35e){create(_0x282ec3)[_0x73f2('0x8')](loggerCatch(_0xb8f35e));};exports['createCustomerFinal']=function(_0x1d327f,_0xdedc71){moveContact(_0x1d327f)[_0x73f2('0x8')](loggerCatch(_0xdedc71));};exports[_0x73f2('0x12')]=function(_0x28dbf7,_0x5f451d,_0x39a932){if(_0x5f451d){_0x28dbf7[_0x73f2('0x13')]=null;}if(_0x39a932){_0x28dbf7['active']=![];}return cmHopper['rescheduleContact'](_0x28dbf7)[_0x73f2('0x8')](loggerCatch(_0x73f2('0x14')));};exports[_0x73f2('0x15')]=function(_0x3c05ad){return cmHopper[_0x73f2('0x15')](_0x3c05ad)[_0x73f2('0x8')](loggerCatch(_0x73f2('0x16')));};exports[_0x73f2('0x17')]=function(_0x47fb3f){return cmHopper['unlockContact']({'UserId':null},_0x47fb3f,0x1)[_0x73f2('0x8')](loggerCatch(_0x73f2('0x18')));};exports[_0x73f2('0x19')]=function(_0x513a52){return cmHopper[_0x73f2('0x17')]({'active':![]},_0x513a52,0x1)[_0x73f2('0x8')](loggerCatch(_0x73f2('0x1a')));};exports[_0x73f2('0x1b')]=function(_0x1f3787){var _0x5b7cc5={};_0x5b7cc5[_0x73f2('0x1c')]=_0x1f3787[_0x73f2('0x1c')];_0x5b7cc5[_0x73f2('0x1d')]=_0x1f3787[_0x73f2('0x1d')];_0x5b7cc5[_0x73f2('0x1e')]=_0x1f3787[_0x73f2('0x1e')];_0x5b7cc5['calleridname']=_0x1f3787[_0x73f2('0x1f')];_0x5b7cc5[_0x73f2('0x20')]=_0x1f3787['queue'];_0x5b7cc5['queuecallerjoinAt']=_0x1f3787[_0x73f2('0x21')];_0x5b7cc5['queuecallerleaveAt']=_0x1f3787[_0x73f2('0x21')];_0x5b7cc5['queuecallercomplete']=0x1;_0x5b7cc5['queuecallercompleteAt']=_0x1f3787[_0x73f2('0x22')];_0x5b7cc5[_0x73f2('0x23')]=_0x1f3787['membername'];_0x5b7cc5[_0x73f2('0x24')]=_0x73f2('0x25');_0x5b7cc5[_0x73f2('0x26')]=_0x73f2('0x27');_0x5b7cc5[_0x73f2('0x28')]=0x0;_0x5b7cc5[_0x73f2('0x29')]=0x1;_0x5b7cc5[_0x73f2('0x2a')]=_0x1f3787[_0x73f2('0x2b')];_0x5b7cc5[_0x73f2('0x2c')]='COMPLETED';return BPromise['resolve']()[_0x73f2('0xe')](voiceQueueReport[_0x73f2('0x2d')](_0x5b7cc5))[_0x73f2('0x8')](loggerCatch(_0x73f2('0x2e')));};exports[_0x73f2('0x2f')]=function(_0x3fc63f,_0x43e8a1){return BPromise[_0x73f2('0x9')]()[_0x73f2('0xe')](cmHopper['getContactRecallMe'](_0x3fc63f,_0x43e8a1))[_0x73f2('0x8')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x14cdf8){return cmHopper[_0x73f2('0x12')](_0x14cdf8,!![],!![])[_0x73f2('0x8')](loggerCatch(_0x73f2('0x30')));}; \ No newline at end of file +var _0x7779=['util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','endtime','connectedlinename','context','exten','xcally-motion-preview','holdtime','assigned','membername','queuecallerexitreason','[voiceQueueReport]\x20','resolve','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x4f2626,_0x1078da){var _0xa80c7=function(_0x1737fa){while(--_0x1737fa){_0x4f2626['push'](_0x4f2626['shift']());}};_0xa80c7(++_0x1078da);}(_0x7779,0x126));var _0x9777=function(_0x378830,_0xb532d7){_0x378830=_0x378830-0x0;var _0x4e4348=_0x7779[_0x378830];return _0x4e4348;};'use strict';var util=require(_0x9777('0x0'));var BPromise=require(_0x9777('0x1'));var logger=require(_0x9777('0x2'))(_0x9777('0x3'));var cmHopper=require(_0x9777('0x4'));var cmHopperHistory=require(_0x9777('0x5'));var cmHopperBlack=require(_0x9777('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x3f3b3e){return function(_0x4986c5){logger['error'](_0x3f3b3e,util[_0x9777('0x7')](_0x4986c5,{'showHidden':![],'depth':null}));};}function create(_0x239a06){return cmHopperHistory[_0x9777('0x8')](_0x239a06)[_0x9777('0x9')](loggerCatch(_0x9777('0xa')));}function createAgent(_0x3ec08e){return BPromise['resolve']()[_0x9777('0xb')](agentReportPreview[_0x9777('0x8')](_0x3ec08e))[_0x9777('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2420f3){return cmHopper[_0x9777('0xc')](_0x2420f3,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x541c67){return cmHopperBlack[_0x9777('0xd')](_0x541c67)['catch'](loggerCatch(_0x9777('0xe')));};exports[_0x9777('0xf')]=function(_0x216816){return BPromise['resolve']()[_0x9777('0xb')](cmHopper[_0x9777('0xf')](_0x216816))['catch'](loggerCatch(_0x9777('0x10')));};exports[_0x9777('0x8')]=function(_0x28b0cf,_0x1b6a71){create(_0x28b0cf)[_0x9777('0x9')](loggerCatch(_0x1b6a71));moveContact(_0x28b0cf)[_0x9777('0x9')](loggerCatch(_0x1b6a71));};exports[_0x9777('0x11')]=function(_0x2238d2,_0x2b96e6){createAgent(_0x2238d2)[_0x9777('0x9')](loggerCatch(_0x2b96e6));};exports[_0x9777('0x12')]=function(_0x384e74,_0x2c9289){create(_0x384e74)[_0x9777('0x9')](loggerCatch(_0x2c9289));};exports['createCustomerFinal']=function(_0x426a2f,_0x3c8eaf){moveContact(_0x426a2f)[_0x9777('0x9')](loggerCatch(_0x3c8eaf));};exports[_0x9777('0x13')]=function(_0x127a93,_0x1cae68,_0x172420){if(_0x1cae68){_0x127a93[_0x9777('0x14')]=null;}if(_0x172420){_0x127a93['active']=![];}return cmHopper[_0x9777('0x13')](_0x127a93)[_0x9777('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x21ccbe){return cmHopper[_0x9777('0x15')](_0x21ccbe)[_0x9777('0x9')](loggerCatch(_0x9777('0x16')));};exports['unlockContact']=function(_0x321e10){return cmHopper[_0x9777('0x17')]({'UserId':null},_0x321e10,0x1)[_0x9777('0x9')](loggerCatch(_0x9777('0x18')));};exports[_0x9777('0x19')]=function(_0x531a81){return cmHopper[_0x9777('0x17')]({'active':![]},_0x531a81,0x1)[_0x9777('0x9')](loggerCatch('[activeContact]\x20'));};exports[_0x9777('0x1a')]=function(_0x492ac2){var _0x43c6a6={};_0x43c6a6[_0x9777('0x1b')]=_0x492ac2[_0x9777('0x1b')];_0x43c6a6[_0x9777('0x1c')]=_0x492ac2[_0x9777('0x1c')];_0x43c6a6[_0x9777('0x1d')]=_0x492ac2[_0x9777('0x1d')];_0x43c6a6[_0x9777('0x1e')]=_0x492ac2[_0x9777('0x1e')];_0x43c6a6[_0x9777('0x1f')]=_0x492ac2['queue'];_0x43c6a6[_0x9777('0x20')]=_0x492ac2[_0x9777('0x21')];_0x43c6a6['queuecallerleaveAt']=_0x492ac2[_0x9777('0x21')];_0x43c6a6[_0x9777('0x22')]=0x1;_0x43c6a6['queuecallercompleteAt']=_0x492ac2[_0x9777('0x23')];_0x43c6a6[_0x9777('0x24')]=_0x492ac2['membername'];_0x43c6a6[_0x9777('0x25')]='from-sip';_0x43c6a6[_0x9777('0x26')]=_0x9777('0x27');_0x43c6a6[_0x9777('0x28')]=0x0;_0x43c6a6[_0x9777('0x29')]=0x1;_0x43c6a6['lastAssignedTo']=_0x492ac2[_0x9777('0x2a')];_0x43c6a6[_0x9777('0x2b')]='COMPLETED';return BPromise['resolve']()[_0x9777('0xb')](voiceQueueReport['create'](_0x43c6a6))['catch'](loggerCatch(_0x9777('0x2c')));};exports['getContactRecallMe']=function(_0x48e30b,_0x51c4de){return BPromise[_0x9777('0x2d')]()[_0x9777('0xb')](cmHopper['getContactRecallMe'](_0x48e30b,_0x51c4de))['catch'](loggerCatch(_0x9777('0x2e')));};exports[_0x9777('0x2f')]=function(_0x5bb765){return cmHopper[_0x9777('0x13')](_0x5bb765,!![],!![])['catch'](loggerCatch(_0x9777('0x30')));}; \ 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 19b1a6e..afa7dae 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 _0xdf55=['info','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','statedesc','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','isFailure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','voice','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','match','variables','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','inspect','logger'];(function(_0x5118ab,_0x3ad8ef){var _0xdd090=function(_0x42431a){while(--_0x42431a){_0x5118ab['push'](_0x5118ab['shift']());}};_0xdd090(++_0x3ad8ef);}(_0xdf55,0x83));var _0x5df5=function(_0x16765f,_0x3dd736){_0x16765f=_0x16765f-0x0;var _0x1326d4=_0xdf55[_0x16765f];return _0x1326d4;};'use strict';var util=require(_0x5df5('0x0'));var _=require(_0x5df5('0x1'));var moment=require('moment');var logger=require(_0x5df5('0x2'))(_0x5df5('0x3'));var ipAgi=process['env'][_0x5df5('0x4')]||_0x5df5('0x5');var utils=require(_0x5df5('0x6'));exports['loggerCatch']=function(_0x289af4){return function(_0x417341){logger[_0x5df5('0x7')](_0x289af4,util[_0x5df5('0x8')](_0x417341,{'showHidden':![],'depth':null}));};};exports[_0x5df5('0x9')]=function(_0x2b7ed9,_0x4722a2){logger[_0x5df5('0xa')](_0x2b7ed9,util['inspect'](_0x4722a2,{'showHidden':![],'depth':null}));};exports[_0x5df5('0xb')]=function(_0x403d8b,_0x41941e){logger['error'](_0x403d8b,util['inspect'](_0x41941e,{'showHidden':![],'depth':null}));};exports[_0x5df5('0xc')]=function(_0x4e80bd){return function(_0x45ad13){logger[_0x5df5('0xa')](_0x4e80bd,util['inspect'](_0x45ad13,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x40322d,_0xba664a,_0x1d0b7e){return{'message':_0x40322d,'unlock':_0xba664a,'active':_0x1d0b7e};};exports[_0x5df5('0xd')]=function(_0xe8bcd8,_0xb4a4fe,_0x37a747){if(!_[_0x5df5('0xe')](_0x37a747)&&_0x5df5('0xf')===typeof _0x37a747&&!_[_0x5df5('0x10')](_0x37a747)){if(!_['isUndefined'](_0xb4a4fe)&&_0x5df5('0xf')===typeof _0xb4a4fe&&!_['isEmpty'](_0xb4a4fe)){return util[_0x5df5('0x11')](_0x5df5('0x12'),_0xb4a4fe,_0x37a747);}return util[_0x5df5('0x11')](_0x5df5('0x12'),_0x37a747,_0x37a747);}if(!_[_0x5df5('0xe')](_0xe8bcd8)&&'string'===typeof _0xe8bcd8&&!_[_0x5df5('0x10')](_0xe8bcd8)){return _0xe8bcd8;}return _0x5df5('0x13');};exports['isActive']=function(_0x9a52c9){if(_[_0x5df5('0x14')](_0x9a52c9)){return![];}return _0x9a52c9;};exports[_0x5df5('0x15')]=function(_0x44f700,_0x215d59,_0x4b499d,_0x589093,_0x48c824,_0x5d8dfd){var _0x58152a={'XMD-QUEUE':_0x215d59[_0x5df5('0x16')]?_0x215d59[_0x5df5('0x16')][_0x5df5('0x17')]:'','XMD-CALLERID':_0x589093,'XMD-CALLERID-PREVIEW':_0x5d8dfd?util[_0x5df5('0x11')]('\x22%s\x22\x20<%s>',_0x5d8dfd[_0x5df5('0x18')],_0x5d8dfd[_0x5df5('0x19')]):_0x589093,'XMD-DIALID':_0x48c824,'XMD-CONTACTID':_0x215d59[_0x5df5('0x1a')],'XMD-CDRTYPE':_0x5df5('0x1b'),'CALLERID(all)':_0x589093,'XMD-VOICEQUEUEID':_0x215d59[_0x5df5('0x1c')],'XMD-DIALCHANNEL':_0x4b499d,'XMD-DIALTIMEOUT':_0x44f700[_0x5df5('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x5df5('0x1e'),_0x44f700[_0x5df5('0x1f')]?'g':'',_[_0x5df5('0x10')](_0x44f700[_0x5df5('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x44f700[_0x5df5('0x21')]||'','XMD-AGI':_0x44f700[_0x5df5('0x22')]?util[_0x5df5('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x44f700['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x44f700[_0x5df5('0x1f')]?util[_0x5df5('0x11')](_0x5df5('0x23'),ipAgi,_0x44f700[_0x5df5('0x1f')]):_0x5df5('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x5d8dfd?_0x5d8dfd[_0x5df5('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x5d8dfd?_0x5d8dfd[_0x5df5('0x26')]:'','XMD-DESTINATION':_0x5df5('0x27'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x5df5('0x10')](_0x44f700['monitor_format'])){_0x58152a[util[_0x5df5('0x11')]('%s',_0x5df5('0x28'))]=_0x44f700['monitor_format'];_0x58152a[util[_0x5df5('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x48c824;}return _0x58152a;};exports[_0x5df5('0x29')]=function(_0x4cccf1){var _0x2e1885={};for(var _0x4afe36 in _0x4cccf1){if(_0x4cccf1[_0x5df5('0x2a')](_0x4afe36)){_0x2e1885[util['format']('%s',_[_0x5df5('0x2b')](_0x4afe36))]=_0x4cccf1[_0x4afe36];}}return{'variables':_0x2e1885};};exports[_0x5df5('0x2c')]=function(_0x4784ca,_0x485484){if(!_[_0x5df5('0x14')](_0x4784ca)){if(_0x4784ca[_0x5df5('0x2a')](_0x5df5('0x2d'))){if(_0x4784ca[_0x5df5('0x2d')]>0x0){_0x4784ca[_0x5df5('0x2d')]-=0x1;}else{logger[_0x5df5('0x7')](_0x5df5('0x2e'),_0x485484);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x485484);}};exports[_0x5df5('0x2f')]=function(_0x3f9f45){var _0x3bbd2b=moment()[_0x5df5('0x11')](_0x5df5('0x30'));_0x3f9f45[_0x5df5('0x31')]=0xd;_0x3f9f45['statedesc']=_0x5df5('0x32');_0x3f9f45[_0x5df5('0x33')]=_0x3bbd2b;_0x3f9f45[_0x5df5('0x34')]=_0x3bbd2b;_0x3f9f45[_0x5df5('0x35')]=_0x3bbd2b;};exports['logAgent']=function(_0x14ee6b,_0x4e7561,_0x325e65){var _0x394676=moment()['format'](_0x5df5('0x30'));_0x14ee6b['state']=_0x4e7561;_0x14ee6b[_0x5df5('0x36')]=_0x325e65;_0x14ee6b[_0x5df5('0x34')]=_0x394676;_0x14ee6b[_0x5df5('0x37')]=utils[_0x5df5('0x38')](_0x14ee6b['responsetime'],_0x14ee6b[_0x5df5('0x33')]);};exports[_0x5df5('0x39')]=function(_0x28459a,_0x25b6ad,_0x47f0d3){_0x28459a[_0x5df5('0x3a')]=_0x25b6ad;_0x28459a[_0x5df5('0x3b')]=_0x47f0d3;};exports[_0x5df5('0x3c')]=function(_0x18b597,_0x46c501,_0x47f34f){var _0x25c8b3=moment()['format'](_0x5df5('0x30'));_0x18b597[_0x5df5('0x31')]=_0x46c501;_0x18b597['statedesc']=_0x47f34f;_0x18b597[_0x5df5('0x34')]=_0x18b597[_0x5df5('0x34')]?_0x18b597['responsetime']:_0x25c8b3;_0x18b597[_0x5df5('0x35')]=_0x18b597[_0x5df5('0x35')]?_0x18b597[_0x5df5('0x35')]:_0x25c8b3;_0x18b597[_0x5df5('0x37')]=utils[_0x5df5('0x38')](_0x18b597[_0x5df5('0x34')]||0x0,_0x18b597[_0x5df5('0x33')]||0x0);_0x18b597[_0x5df5('0x3d')]=_0x18b597['answertime']?utils['getSeconds'](_0x18b597[_0x5df5('0x35')],_0x18b597['answertime']):0x0;};exports[_0x5df5('0x3e')]=function(_0x156a03){return _0x156a03==='Failure';};exports[_0x5df5('0x3f')]=function(_0x78dedd,_0x23e592,_0x353ebc,_0x2cb16f,_0x278e99){var _0x56a07a=_0x2cb16f?_0x5df5('0x40'):_0x78dedd['calleridname'];_0x56a07a=_0x278e99?_0x5df5('0x41'):_0x56a07a;return{'actionid':_0x78dedd['uniqueid'],'action':_0x5df5('0x42'),'channel':_0x78dedd[_0x5df5('0x43')],'callerid':util[_0x5df5('0x11')](_0x5df5('0x12'),_0x56a07a,_0x78dedd[_0x5df5('0x19')]),'Exten':'xcally-motion-preview','Context':_0x5df5('0x44'),'Priority':'1','variable':_0x353ebc,'timeout':(_0x23e592[_0x5df5('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x78dedd[_0x5df5('0x46')]};};exports['totalGlobal']=function(_0x3c9098){return _0x3c9098[_0x5df5('0x47')]+_0x3c9098['countcongestionretry']+_0x3c9098[_0x5df5('0x48')]+_0x3c9098[_0x5df5('0x49')]+_0x3c9098[_0x5df5('0x4a')];};exports[_0x5df5('0x4b')]=function(_0x4de416){var _0x2aea56=_[_0x5df5('0x4c')](_0x4de416);_0x2aea56['state']=0xf;_0x2aea56[_0x5df5('0x36')]=_0x5df5('0x4d');return _0x2aea56;};exports[_0x5df5('0x4e')]=function(_0x48e5a8,_0x36e254,_0x3842d0){var _0x108916={};_0x108916[_0x36e254]=_0x48e5a8[_0x36e254];_0x108916[_0x5df5('0x4f')]=![];_0x108916['scheduledat']=moment()[_0x5df5('0x50')](_0x3842d0,_0x5df5('0x51'))[_0x5df5('0x11')](_0x5df5('0x30'));_0x108916[_0x5df5('0x1a')]=_0x48e5a8['ContactId'];_0x108916['ListId']=_0x48e5a8[_0x5df5('0x52')];_0x108916['VoiceQueueId']=_0x48e5a8[_0x5df5('0x1c')]||undefined;return _0x108916;};exports[_0x5df5('0x53')]=function(_0x2f43bf,_0x28108e){if(!_['isNil'](_0x2f43bf)){if(_0x2f43bf[_0x5df5('0x54')]>0x0){_0x2f43bf[_0x5df5('0x54')]-=0x1;}else{logger[_0x5df5('0x7')](_0x28108e,_0x5df5('0x55'));}}else{logger[_0x5df5('0x7')](_0x28108e,_0x5df5('0x56'));}};exports['IsNotLoggedIn']=function(_0x1bf1e2){if(_0x1bf1e2<=0x0){return!![];}return![];};function buildObj(_0x51fd67,_0x279f6b,_0x432fd0){_0x51fd67[_0x5df5('0x57')]=_0x279f6b;_0x51fd67['name']=_0x51fd67[_0x5df5('0x58')];_0x51fd67['interface']=_0x51fd67[_0x5df5('0x43')];_0x51fd67['motionChannel']=_0x5df5('0x59');if(_0x432fd0){_0x51fd67[_0x5df5('0x5a')]=_0x432fd0[_0x5df5('0x5a')];}return _0x51fd67;}exports['buildObj']=buildObj;exports[_0x5df5('0x5b')]=function(_0x2ab7d4){var _0x478b8e=[];for(var _0x429768 in _0x2ab7d4){if(_0x2ab7d4[_0x5df5('0x2a')](_0x429768)){if(!_[_0x5df5('0x14')](_0x2ab7d4[_0x429768])&&_0x2ab7d4[_0x429768][_0x5df5('0x31')]===_0x5df5('0x5c')&&_0x2ab7d4[_0x429768][_0x5df5('0x5d')]===_0x5df5('0x5e')){_0x478b8e['push'](_0x2ab7d4[_0x429768]['id']);}}}return _0x478b8e;};exports[_0x5df5('0x5f')]=function(_0x526c0b){var _0x134e36=moment()[_0x5df5('0x60')](0x0);var _0x211913=moment(_0x526c0b)[_0x5df5('0x60')](0x0);return _0x134e36[_0x5df5('0x61')](_0x211913,_0x5df5('0x62'));};exports[_0x5df5('0x63')]=function(_0x23e5ca){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x23e5ca['ContactId'],'ListId':_0x23e5ca[_0x5df5('0x52')],'VoiceQueueId':_0x23e5ca[_0x5df5('0x1c')]||undefined,'CampaignId':_0x23e5ca[_0x5df5('0x64')]||undefined};};exports[_0x5df5('0x65')]=function(_0x13c69a){if(_0x13c69a==='uniqueid'||_0x13c69a===_0x5df5('0x66')||_0x13c69a==='queue'||_0x13c69a==='type'||_0x13c69a===_0x5df5('0x67')||_0x13c69a===_0x5df5('0x68')||_0x13c69a===_0x5df5('0x3a')||_0x13c69a===_0x5df5('0x43')||_0x13c69a===_0x5df5('0x18')||_0x13c69a===_0x5df5('0x4f')||_0x13c69a==='calleridnum'||_0x13c69a===_0x5df5('0x69')||_0x13c69a===_0x5df5('0x47')||_0x13c69a==='countcongestionretry'||_0x13c69a==='countnoanswerretry'||_0x13c69a===_0x5df5('0x6a')||_0x13c69a===_0x5df5('0x6b')||_0x13c69a===_0x5df5('0x6c')||_0x13c69a===_0x5df5('0x6d')||_0x13c69a===_0x5df5('0x6e')||_0x13c69a===_0x5df5('0x1a')||_0x13c69a==='ListId'||_0x13c69a==='UserId'||_0x13c69a==='VoiceQueueId'||_0x13c69a===_0x5df5('0x6f')||_0x13c69a===_0x5df5('0x70')||_0x13c69a==='xmd-queue'||_0x13c69a===_0x5df5('0x71')||_0x13c69a===_0x5df5('0x72')||_0x13c69a===_0x5df5('0x73')||_0x13c69a===_0x5df5('0x74')||_0x13c69a===_0x5df5('0x75')||_0x13c69a===_0x5df5('0x76')||_0x13c69a===_0x5df5('0x77')||_0x13c69a===_0x5df5('0x78')||_0x13c69a===_0x5df5('0x79')||_0x13c69a==='xmd-callerid'||_0x13c69a===_0x5df5('0x7a')||_0x13c69a===_0x5df5('0x7b')||_0x13c69a===_0x5df5('0x7c')||_0x13c69a===_0x5df5('0x7d')||_0x13c69a===_0x5df5('0x7e')||_0x13c69a===_0x5df5('0x7f')||_0x13c69a===_0x5df5('0x80')||_0x13c69a===_0x5df5('0x81')||_0x13c69a===_0x5df5('0x82')||_0x13c69a===_0x5df5('0x83')||_0x13c69a===_0x5df5('0x7c')||_0x13c69a===_0x5df5('0x7d')||_0x13c69a==='rtpaudioqosjitter'||_0x13c69a===_0x5df5('0x7f')||_0x13c69a===_0x5df5('0x80')||_0x13c69a==='rtpaudioqoslossbridged'||_0x13c69a===_0x5df5('0x82')||_0x13c69a===_0x5df5('0x83')||_0x13c69a===_0x5df5('0x84')||_0x13c69a===_0x5df5('0x85')||_0x13c69a==='state'||_0x13c69a===_0x5df5('0x36')){return![];}return!![];};exports[_0x5df5('0x86')]=function(_0x5e73ee,_0x54e677){var _0x9e7e57,_0x21b665,_0x9e61ef;if(_0x54e677<=0x0){_0x54e677=0x1;}_0x9e7e57=new RegExp('\x5cw{0,'+_0x54e677+'}$');_0x21b665=Math['pow'](0xa,_0x54e677-0x1);_0x9e61ef=Math[_0x5df5('0x87')](0xa,_0x54e677)-0x1;return util[_0x5df5('0x11')]('%s',_['replace'](_0x5e73ee,_0x9e7e57,_[_0x5df5('0x88')](_0x21b665,_0x9e61ef)));};exports[_0x5df5('0x89')]=function(_0x960460){var _0x743ff9=_0x960460[_0x5df5('0x8a')](/"(.*?)"/);return _0x743ff9?_0x743ff9[0x1]:_0x960460;};exports['extractCalleridNumber']=function(_0x9674a7){var _0x24eb6b=_0x9674a7[_0x5df5('0x8a')](/<(.*?)>/);return _0x24eb6b?_0x24eb6b[0x1]:_0x9674a7;};function buildNoAnswerEventPayload(_0x2398b3,_0x4e6e48){var _0x434909=buildObj(_0x2398b3,'noanswer');if(!_[_0x5df5('0x10')](_0x4e6e48[_0x5df5('0x8b')])){Object['keys'](_0x4e6e48[_0x5df5('0x8b')])['forEach'](function(_0x179392){_0x434909[_0x179392['toLowerCase']()]=_0x4e6e48[_0x5df5('0x8b')][_0x179392];});}return _0x434909;}exports[_0x5df5('0x8c')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xa3b2=['reachable','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','type','dialAnswer','membername','countnoanswerretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','127.0.0.1','../../dialer/utils','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','format','calleridname','calleridnum','dialer','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','getSeconds','starttime','UserId','logCustomer','talktime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countagentrejectretry','countnosuchnumberretry','active','scheduledat','add','minutes','ContactId','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','hasOwnProperty','not_inuse','status'];(function(_0x175b4b,_0x2c2658){var _0x23f354=function(_0x521db3){while(--_0x521db3){_0x175b4b['push'](_0x175b4b['shift']());}};_0x23f354(++_0x2c2658);}(_0xa3b2,0x1e0));var _0x2a3b=function(_0x41fb98,_0x470189){_0x41fb98=_0x41fb98-0x0;var _0x4b0044=_0xa3b2[_0x41fb98];return _0x4b0044;};'use strict';var util=require(_0x2a3b('0x0'));var _=require(_0x2a3b('0x1'));var moment=require(_0x2a3b('0x2'));var logger=require(_0x2a3b('0x3'))('preview');var ipAgi=process[_0x2a3b('0x4')]['XCALLY_IP_AGI']||_0x2a3b('0x5');var utils=require(_0x2a3b('0x6'));exports['loggerCatch']=function(_0x3eafb4){return function(_0x3ca582){logger[_0x2a3b('0x7')](_0x3eafb4,util[_0x2a3b('0x8')](_0x3ca582,{'showHidden':![],'depth':null}));};};exports[_0x2a3b('0x9')]=function(_0x366e34,_0x131c37){logger[_0x2a3b('0xa')](_0x366e34,util[_0x2a3b('0x8')](_0x131c37,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1134ab,_0x153695){logger[_0x2a3b('0x7')](_0x1134ab,util[_0x2a3b('0x8')](_0x153695,{'showHidden':![],'depth':null}));};exports[_0x2a3b('0xb')]=function(_0x409f29){return function(_0xc03b25){logger[_0x2a3b('0xa')](_0x409f29,util[_0x2a3b('0x8')](_0xc03b25,{'showHidden':![],'depth':null}));};};exports[_0x2a3b('0xc')]=function(_0xb74b2b,_0x10fd2e,_0x319f46){return{'message':_0xb74b2b,'unlock':_0x10fd2e,'active':_0x319f46};};exports[_0x2a3b('0xd')]=function(_0x2b596f,_0x28927b,_0x43b185){if(!_[_0x2a3b('0xe')](_0x43b185)&&'string'===typeof _0x43b185&&!_['isEmpty'](_0x43b185)){if(!_[_0x2a3b('0xe')](_0x28927b)&&_0x2a3b('0xf')===typeof _0x28927b&&!_[_0x2a3b('0x10')](_0x28927b)){return util['format'](_0x2a3b('0x11'),_0x28927b,_0x43b185);}return util['format'](_0x2a3b('0x11'),_0x43b185,_0x43b185);}if(!_[_0x2a3b('0xe')](_0x2b596f)&&_0x2a3b('0xf')===typeof _0x2b596f&&!_[_0x2a3b('0x10')](_0x2b596f)){return _0x2b596f;}return _0x2a3b('0x12');};exports[_0x2a3b('0x13')]=function(_0x12c776){if(_[_0x2a3b('0x14')](_0x12c776)){return![];}return _0x12c776;};exports[_0x2a3b('0x15')]=function(_0x43e5c2,_0x226b75,_0x4f931a,_0x16c0f8,_0x26ee26,_0x28158f){var _0x4fba2e={'XMD-QUEUE':_0x226b75[_0x2a3b('0x16')]?_0x226b75['Queue'][_0x2a3b('0x17')]:'','XMD-CALLERID':_0x16c0f8,'XMD-CALLERID-PREVIEW':_0x28158f?util[_0x2a3b('0x18')]('\x22%s\x22\x20<%s>',_0x28158f[_0x2a3b('0x19')],_0x28158f[_0x2a3b('0x1a')]):_0x16c0f8,'XMD-DIALID':_0x26ee26,'XMD-CONTACTID':_0x226b75['ContactId'],'XMD-CDRTYPE':_0x2a3b('0x1b'),'CALLERID(all)':_0x16c0f8,'XMD-VOICEQUEUEID':_0x226b75['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4f931a,'XMD-DIALTIMEOUT':_0x43e5c2[_0x2a3b('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x2a3b('0x18')]('\x22rtTxX%s%s\x22',_0x43e5c2[_0x2a3b('0x1d')]?'g':'',_[_0x2a3b('0x10')](_0x43e5c2['monitor_format'])?'':_0x2a3b('0x1e')),'XMD-DIALURL':_0x43e5c2[_0x2a3b('0x1f')]||'','XMD-AGI':_0x43e5c2[_0x2a3b('0x20')]?util[_0x2a3b('0x18')](_0x2a3b('0x21'),ipAgi,_0x43e5c2[_0x2a3b('0x20')]):'NONE','XMD-AGIAFTER':_0x43e5c2[_0x2a3b('0x1d')]?util[_0x2a3b('0x18')](_0x2a3b('0x21'),ipAgi,_0x43e5c2[_0x2a3b('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x28158f?_0x28158f[_0x2a3b('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x28158f?_0x28158f[_0x2a3b('0x23')]:'','XMD-DESTINATION':_0x2a3b('0x24'),'SIPADDHEADER':_0x2a3b('0x25')};if(!_[_0x2a3b('0x10')](_0x43e5c2['monitor_format'])){_0x4fba2e[util[_0x2a3b('0x18')]('%s',_0x2a3b('0x26'))]=_0x43e5c2['monitor_format'];_0x4fba2e[util[_0x2a3b('0x18')]('%s',_0x2a3b('0x27'))]=_0x26ee26;}return _0x4fba2e;};exports[_0x2a3b('0x28')]=function(_0x1457f3){var _0x286c22={};for(var _0x27128f in _0x1457f3){if(_0x1457f3['hasOwnProperty'](_0x27128f)){_0x286c22[util[_0x2a3b('0x18')]('%s',_[_0x2a3b('0x29')](_0x27128f))]=_0x1457f3[_0x27128f];}}return{'variables':_0x286c22};};exports[_0x2a3b('0x2a')]=function(_0x1d3cba,_0x3475a0){if(!_[_0x2a3b('0x14')](_0x1d3cba)){if(_0x1d3cba['hasOwnProperty'](_0x2a3b('0x2b'))){if(_0x1d3cba[_0x2a3b('0x2b')]>0x0){_0x1d3cba[_0x2a3b('0x2b')]-=0x1;}else{logger[_0x2a3b('0x7')](_0x2a3b('0x2c'),_0x3475a0);}}}else{logger[_0x2a3b('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3475a0);}};exports[_0x2a3b('0x2d')]=function(_0x45e4e6){var _0x20891b=moment()[_0x2a3b('0x18')](_0x2a3b('0x2e'));_0x45e4e6[_0x2a3b('0x2f')]=0xd;_0x45e4e6[_0x2a3b('0x30')]=_0x2a3b('0x31');_0x45e4e6['starttime']=_0x20891b;_0x45e4e6[_0x2a3b('0x32')]=_0x20891b;_0x45e4e6[_0x2a3b('0x33')]=_0x20891b;};exports[_0x2a3b('0x34')]=function(_0x3c4cc3,_0x14a27e,_0x4be7c3){var _0x4513bb=moment()['format'](_0x2a3b('0x2e'));_0x3c4cc3[_0x2a3b('0x2f')]=_0x14a27e;_0x3c4cc3[_0x2a3b('0x30')]=_0x4be7c3;_0x3c4cc3[_0x2a3b('0x32')]=_0x4513bb;_0x3c4cc3[_0x2a3b('0x35')]=utils[_0x2a3b('0x36')](_0x3c4cc3[_0x2a3b('0x32')],_0x3c4cc3[_0x2a3b('0x37')]);};exports['logLookAgent']=function(_0x4f98bc,_0x49e68a,_0x128958){_0x4f98bc['membername']=_0x49e68a;_0x4f98bc[_0x2a3b('0x38')]=_0x128958;};exports[_0x2a3b('0x39')]=function(_0x1c9d55,_0xc8bb59,_0x528843){var _0x335ba1=moment()[_0x2a3b('0x18')](_0x2a3b('0x2e'));_0x1c9d55[_0x2a3b('0x2f')]=_0xc8bb59;_0x1c9d55[_0x2a3b('0x30')]=_0x528843;_0x1c9d55[_0x2a3b('0x32')]=_0x1c9d55[_0x2a3b('0x32')]?_0x1c9d55[_0x2a3b('0x32')]:_0x335ba1;_0x1c9d55[_0x2a3b('0x33')]=_0x1c9d55[_0x2a3b('0x33')]?_0x1c9d55[_0x2a3b('0x33')]:_0x335ba1;_0x1c9d55[_0x2a3b('0x35')]=utils[_0x2a3b('0x36')](_0x1c9d55[_0x2a3b('0x32')]||0x0,_0x1c9d55[_0x2a3b('0x37')]||0x0);_0x1c9d55[_0x2a3b('0x3a')]=_0x1c9d55['answertime']?utils['getSeconds'](_0x1c9d55['endtime'],_0x1c9d55['answertime']):0x0;};exports[_0x2a3b('0x3b')]=function(_0x26ea4d){return _0x26ea4d==='Failure';};exports[_0x2a3b('0x3c')]=function(_0x5bcdf3,_0x389147,_0x5a113d,_0x8463f6,_0x24e51a){var _0x13151e=_0x8463f6?_0x2a3b('0x3d'):_0x5bcdf3[_0x2a3b('0x19')];_0x13151e=_0x24e51a?_0x2a3b('0x3e'):_0x13151e;return{'actionid':_0x5bcdf3[_0x2a3b('0x3f')],'action':_0x2a3b('0x40'),'channel':_0x5bcdf3[_0x2a3b('0x41')],'callerid':util[_0x2a3b('0x18')](_0x2a3b('0x11'),_0x13151e,_0x5bcdf3[_0x2a3b('0x1a')]),'Exten':_0x2a3b('0x24'),'Context':_0x2a3b('0x42'),'Priority':'1','variable':_0x5a113d,'timeout':(_0x389147['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5bcdf3['uniqueid']};};exports[_0x2a3b('0x43')]=function(_0x21e562){return _0x21e562[_0x2a3b('0x44')]+_0x21e562['countcongestionretry']+_0x21e562['countnoanswerretry']+_0x21e562[_0x2a3b('0x45')]+_0x21e562[_0x2a3b('0x46')];};exports['cloneAction']=function(_0x26eaea){var _0x1dfb4b=_['clone'](_0x26eaea);_0x1dfb4b[_0x2a3b('0x2f')]=0xf;_0x1dfb4b['statedesc']='Global';return _0x1dfb4b;};exports['scheduledAt']=function(_0x37f004,_0x5d190f,_0x27da8b){var _0x2df385={};_0x2df385[_0x5d190f]=_0x37f004[_0x5d190f];_0x2df385[_0x2a3b('0x47')]=![];_0x2df385[_0x2a3b('0x48')]=moment()[_0x2a3b('0x49')](_0x27da8b,_0x2a3b('0x4a'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2df385[_0x2a3b('0x4b')]=_0x37f004['ContactId'];_0x2df385[_0x2a3b('0x4c')]=_0x37f004[_0x2a3b('0x4c')];_0x2df385[_0x2a3b('0x4d')]=_0x37f004[_0x2a3b('0x4d')]||undefined;return _0x2df385;};exports['decrementTalkink']=function(_0x1b6e23,_0x1c48a8){if(!_['isNil'](_0x1b6e23)){if(_0x1b6e23[_0x2a3b('0x4e')]>0x0){_0x1b6e23[_0x2a3b('0x4e')]-=0x1;}else{logger['error'](_0x1c48a8,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x2a3b('0x7')](_0x1c48a8,_0x2a3b('0x4f'));}};exports[_0x2a3b('0x50')]=function(_0x45cc6d){if(_0x45cc6d<=0x0){return!![];}return![];};function buildObj(_0x1ce548,_0x435183,_0x3a23e7){_0x1ce548[_0x2a3b('0x51')]=_0x435183;_0x1ce548[_0x2a3b('0x17')]=_0x1ce548[_0x2a3b('0x52')];_0x1ce548[_0x2a3b('0x53')]=_0x1ce548[_0x2a3b('0x41')];_0x1ce548[_0x2a3b('0x54')]=_0x2a3b('0x55');if(_0x3a23e7){_0x1ce548[_0x2a3b('0x56')]=_0x3a23e7['mandatoryDisposition'];}return _0x1ce548;}exports[_0x2a3b('0x57')]=buildObj;exports[_0x2a3b('0x58')]=function(_0x537625){var _0x97941c=[];for(var _0x54b205 in _0x537625){if(_0x537625[_0x2a3b('0x59')](_0x54b205)){if(!_[_0x2a3b('0x14')](_0x537625[_0x54b205])&&_0x537625[_0x54b205][_0x2a3b('0x2f')]===_0x2a3b('0x5a')&&_0x537625[_0x54b205][_0x2a3b('0x5b')]===_0x2a3b('0x5c')){_0x97941c[_0x2a3b('0x5d')](_0x537625[_0x54b205]['id']);}}}return _0x97941c;};exports[_0x2a3b('0x5e')]=function(_0x2dbbdb){var _0x4b0628=moment()['milliseconds'](0x0);var _0x45b4e1=moment(_0x2dbbdb)[_0x2a3b('0x5f')](0x0);return _0x4b0628[_0x2a3b('0x60')](_0x45b4e1,_0x2a3b('0x61'));};exports['createBody']=function(_0x3ef5a0){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ef5a0[_0x2a3b('0x4b')],'ListId':_0x3ef5a0[_0x2a3b('0x4c')],'VoiceQueueId':_0x3ef5a0['VoiceQueueId']||undefined,'CampaignId':_0x3ef5a0[_0x2a3b('0x62')]||undefined};};exports[_0x2a3b('0x63')]=function(_0x12d169){if(_0x12d169===_0x2a3b('0x3f')||_0x12d169==='idContact'||_0x12d169===_0x2a3b('0x52')||_0x12d169===_0x2a3b('0x64')||_0x12d169==='campaigntype'||_0x12d169===_0x2a3b('0x65')||_0x12d169===_0x2a3b('0x66')||_0x12d169===_0x2a3b('0x41')||_0x12d169===_0x2a3b('0x19')||_0x12d169==='active'||_0x12d169===_0x2a3b('0x1a')||_0x12d169===_0x2a3b('0x48')||_0x12d169===_0x2a3b('0x44')||_0x12d169==='countcongestionretry'||_0x12d169===_0x2a3b('0x67')||_0x12d169==='countglobal'||_0x12d169===_0x2a3b('0x68')||_0x12d169===_0x2a3b('0x69')||_0x12d169===_0x2a3b('0x6a')||_0x12d169===_0x2a3b('0x6b')||_0x12d169==='ContactId'||_0x12d169==='ListId'||_0x12d169===_0x2a3b('0x38')||_0x12d169===_0x2a3b('0x4d')||_0x12d169===_0x2a3b('0x6c')||_0x12d169===_0x2a3b('0x6d')||_0x12d169===_0x2a3b('0x6e')||_0x12d169===_0x2a3b('0x6f')||_0x12d169===_0x2a3b('0x70')||_0x12d169===_0x2a3b('0x71')||_0x12d169===_0x2a3b('0x72')||_0x12d169==='xmd-dialoptions'||_0x12d169==='xmd-dialid'||_0x12d169===_0x2a3b('0x73')||_0x12d169==='xmd-contactid'||_0x12d169===_0x2a3b('0x74')||_0x12d169===_0x2a3b('0x75')||_0x12d169===_0x2a3b('0x76')||_0x12d169===_0x2a3b('0x77')||_0x12d169==='rtpaudioqos'||_0x12d169===_0x2a3b('0x78')||_0x12d169===_0x2a3b('0x79')||_0x12d169===_0x2a3b('0x7a')||_0x12d169===_0x2a3b('0x7b')||_0x12d169===_0x2a3b('0x7c')||_0x12d169==='rtpaudioqosrtt'||_0x12d169===_0x2a3b('0x7d')||_0x12d169===_0x2a3b('0x7e')||_0x12d169===_0x2a3b('0x78')||_0x12d169===_0x2a3b('0x79')||_0x12d169===_0x2a3b('0x7a')||_0x12d169===_0x2a3b('0x7b')||_0x12d169===_0x2a3b('0x7c')||_0x12d169===_0x2a3b('0x7f')||_0x12d169===_0x2a3b('0x7d')||_0x12d169===_0x2a3b('0x80')||_0x12d169===_0x2a3b('0x81')||_0x12d169===_0x2a3b('0x2f')||_0x12d169===_0x2a3b('0x30')){return![];}return!![];};exports[_0x2a3b('0x82')]=function(_0x404459,_0x2aa6b7){var _0xcb2c51,_0x113dd5,_0x4f85dc;if(_0x2aa6b7<=0x0){_0x2aa6b7=0x1;}_0xcb2c51=new RegExp(_0x2a3b('0x83')+_0x2aa6b7+'}$');_0x113dd5=Math['pow'](0xa,_0x2aa6b7-0x1);_0x4f85dc=Math[_0x2a3b('0x84')](0xa,_0x2aa6b7)-0x1;return util[_0x2a3b('0x18')]('%s',_[_0x2a3b('0x85')](_0x404459,_0xcb2c51,_[_0x2a3b('0x86')](_0x113dd5,_0x4f85dc)));};exports[_0x2a3b('0x87')]=function(_0xe8c19d){var _0x1a572e=_0xe8c19d['match'](/"(.*?)"/);return _0x1a572e?_0x1a572e[0x1]:_0xe8c19d;};exports[_0x2a3b('0x88')]=function(_0x4c889a){var _0x37403e=_0x4c889a[_0x2a3b('0x89')](/<(.*?)>/);return _0x37403e?_0x37403e[0x1]:_0x4c889a;};function buildNoAnswerEventPayload(_0x33fb9d,_0x3e83a2){var _0x2cb007=buildObj(_0x33fb9d,_0x2a3b('0x8a'));if(!_['isEmpty'](_0x3e83a2[_0x2a3b('0x8b')])){Object[_0x2a3b('0x8c')](_0x3e83a2[_0x2a3b('0x8b')])['forEach'](function(_0x663df7){_0x2cb007[_0x663df7[_0x2a3b('0x8d')]()]=_0x3e83a2[_0x2a3b('0x8b')][_0x663df7];});}return _0x2cb007;}exports[_0x2a3b('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index eeb76c9..f8b5309 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 _0xff20=['voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number','boolean','queueremove','queuepause','reload'];(function(_0x56c491,_0x2eecb1){var _0x541c76=function(_0x106f7f){while(--_0x106f7f){_0x56c491['push'](_0x56c491['shift']());}};_0x541c76(++_0x2eecb1);}(_0xff20,0x157));var _0x0ff2=function(_0x21bfcd,_0x48e609){_0x21bfcd=_0x21bfcd-0x0;var _0xe9acb0=_0xff20[_0x21bfcd];return _0xe9acb0;};'use strict';exports[_0x0ff2('0x0')]={'queue':{'type':_0x0ff2('0x1'),'required':!![]},'interface':{'type':_0x0ff2('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x0ff2('0x2'),'required':![]},'paused':{'type':_0x0ff2('0x3'),'required':![]}};exports[_0x0ff2('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x0ff2('0x5')]={'interface':{'type':_0x0ff2('0x1'),'required':!![]},'paused':{'type':_0x0ff2('0x3')},'reason':{'type':_0x0ff2('0x1'),'required':![]}};exports[_0x0ff2('0x6')]={'module':{'type':_0x0ff2('0x1'),'required':![]}};exports[_0x0ff2('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x0ff2('0x8')]={'uniqueid':{'type':_0x0ff2('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x0ff2('0x1')},'mixmonitorid':{'type':_0x0ff2('0x1')}};exports[_0x0ff2('0x9')]={'uniqueid':{'type':_0x0ff2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x0ff2('0x1'),'required':!![]},'exten':{'type':_0x0ff2('0x1'),'required':!![]},'context':{'type':_0x0ff2('0x1')}}; \ No newline at end of file +var _0xd417=['queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queueremove'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xd417,0x1eb));var _0x7d41=function(_0x56247d,_0x53c5e0){_0x56247d=_0x56247d-0x0;var _0xf99eea=_0xd417[_0x56247d];return _0xf99eea;};'use strict';exports['queueadd']={'queue':{'type':_0x7d41('0x0'),'required':!![]},'interface':{'type':_0x7d41('0x0'),'required':!![]},'membername':{'type':_0x7d41('0x0'),'required':!![]},'penalty':{'type':_0x7d41('0x1'),'required':![]},'paused':{'type':_0x7d41('0x2'),'required':![]}};exports[_0x7d41('0x3')]={'queue':{'type':_0x7d41('0x0'),'required':!![]},'interface':{'type':_0x7d41('0x0'),'required':!![]}};exports[_0x7d41('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x7d41('0x2')},'reason':{'type':_0x7d41('0x0'),'required':![]}};exports[_0x7d41('0x5')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x7d41('0x0'),'required':!![]}};exports[_0x7d41('0x6')]={'uniqueid':{'type':_0x7d41('0x0'),'required':!![]},'filename':{'type':_0x7d41('0x0')},'format':{'type':_0x7d41('0x0')},'mixmonitorid':{'type':_0x7d41('0x0')}};exports[_0x7d41('0x7')]={'uniqueid':{'type':_0x7d41('0x0'),'required':!![]}};exports[_0x7d41('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x7d41('0x0'),'required':!![]},'context':{'type':_0x7d41('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 033b950..f329f16 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 _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2032,0xd9));var _0x2203=function(_0x38b55b,_0x5c1eff){_0x38b55b=_0x38b55b-0x0;var _0x344223=_0x2032[_0x38b55b];return _0x344223;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0xde9523,_0x222038){var _0x3e6fd7=function(_0x4dd770){while(--_0x4dd770){_0xde9523['push'](_0xde9523['shift']());}};_0x3e6fd7(++_0x222038);}(_0xdb28,0x106));var _0x8db2=function(_0x4f19c0,_0x5550ca){_0x4f19c0=_0x4f19c0-0x0;var _0x5eb00b=_0xdb28[_0x4f19c0];return _0x5eb00b;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index e84027a..47e55c2 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';function mergeDBDataToRealtime(_0x297baa,_0x48a996){var _0x211d15=Object['assign']({},_0x297baa);for(var _0x5639e6 in _0x48a996){if(_0x211d15['hasOwnProperty'](_0x5639e6)){_0x211d15[_0x5639e6]=_0x48a996[_0x5639e6];}}return _0x211d15;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x0f83=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0x310e30,_0x42446c){var _0x489897=function(_0x510d2c){while(--_0x510d2c){_0x310e30['push'](_0x310e30['shift']());}};_0x489897(++_0x42446c);}(_0x0f83,0x1c7));var _0x30f8=function(_0x5e3a45,_0x45f0c5){_0x5e3a45=_0x5e3a45-0x0;var _0x13419f=_0x0f83[_0x5e3a45];return _0x13419f;};'use strict';function mergeDBDataToRealtime(_0x51a21e,_0x48728e){var _0x52daaa=Object['assign']({},_0x51a21e);for(var _0x5d9c8d in _0x48728e){if(_0x52daaa[_0x30f8('0x0')](_0x5d9c8d)){_0x52daaa[_0x5d9c8d]=_0x48728e[_0x5d9c8d];}}return _0x52daaa;}exports[_0x30f8('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 4c265b0..d7185b7 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 _0xaeb1=['lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','isNil','type','getCallType','UserId','monitor','monitors','filename','createdAt','connectedlinenum','connectedlinename','membername','exten','xcally-motion-dialer','isArray','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','name','find','accountcode','interface','format','SIP/%s','length','findAgent','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','channel','split','calleridnum','outbound','internal','destination','dialer','queue'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xaeb1,0x80));var _0x1aeb=function(_0x46d161,_0x50d4d5){_0x46d161=_0x46d161-0x0;var _0x32807f=_0xaeb1[_0x46d161];return _0x32807f;};'use strict';var _=require(_0x1aeb('0x0'));var moment=require(_0x1aeb('0x1'));var util=require(_0x1aeb('0x2'));var config=require(_0x1aeb('0x3'));var ami=require(_0x1aeb('0x4'));var RpcVoiceAgentReport=require(_0x1aeb('0x5'));var RpcVoiceCallReport=require(_0x1aeb('0x6'));var RpcVoiceDialReport=require(_0x1aeb('0x7'));var RpcMemberReport=require(_0x1aeb('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x1aeb('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x1aeb('0xa'));var VoiceCallReport=require(_0x1aeb('0xb'));var VoiceAgentReport=require(_0x1aeb('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x1aeb('0xd'));function Report(_0x3586bf){this[_0x1aeb('0xe')]=_0x3586bf;this[_0x1aeb('0xf')]=_0x3586bf[_0x1aeb('0xf')];this[_0x1aeb('0x10')]=_0x3586bf[_0x1aeb('0x10')];}Report[_0x1aeb('0x11')][_0x1aeb('0x12')]=function(_0x25a5ba){var _0x56a065=new VoiceQueueReport(this[_0x1aeb('0xe')]);var _0x18dc38=new VoiceAgentReport(this[_0x1aeb('0xe')]);var _0x3d3aad=new VoiceDialReport(this[_0x1aeb('0xe')]);var _0x30ac2c=new VoiceCallReport(this[_0x1aeb('0xe')]);var _0x3520cd=new UserReport(this[_0x1aeb('0xe')]);if(config[_0x1aeb('0x13')]&&config[_0x1aeb('0x13')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x1aeb('0x14')][_0x1aeb('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x1aeb('0x16')][_0x1aeb('0x15')](this));ami['on'](_0x1aeb('0x17'),this[_0x1aeb('0x18')][_0x1aeb('0x15')](this));ami['on'](_0x1aeb('0x19'),this[_0x1aeb('0x1a')][_0x1aeb('0x15')](this));ami['on'](_0x1aeb('0x1b'),this[_0x1aeb('0x1c')]['bind'](this));ami['on']('attendedtransfer',this[_0x1aeb('0x1d')][_0x1aeb('0x15')](this));}};Report[_0x1aeb('0x11')]['findAgent']=function(_0x428d15){var _0x2841ef;_0x2841ef=_['find'](this[_0x1aeb('0xf')],function(_0x4119e1){return _0x4119e1['accountcode']==_0x428d15||_0x4119e1[_0x1aeb('0x1e')]==_0x428d15;});if(_['isNil'](_0x2841ef)){var _0xec3bbb=_[_0x1aeb('0x1f')](this['telephones'],function(_0xa1d422){return _0xa1d422[_0x1aeb('0x20')]==_0x428d15||_0xa1d422[_0x1aeb('0x1e')]==_0x428d15;});if(_0xec3bbb){_0x2841ef=_['find'](this['agents'],function(_0x2c36b1){return _0x2c36b1[_0x1aeb('0x21')]==util[_0x1aeb('0x22')](_0x1aeb('0x23'),_0xec3bbb['name']);});}}return _0x2841ef;};Report[_0x1aeb('0x11')]['voiceQueueReport']=function(_0x540b85){for(var _0x33fbec=0x0;_0x33fbec<_0x540b85[_0x1aeb('0x24')];_0x33fbec+=0x1){var _0x1b4c1e=this[_0x1aeb('0x25')](_0x540b85[_0x33fbec]['connectedlinenum']);if(_0x1b4c1e){_0x540b85[_0x33fbec][_0x1aeb('0x20')]=_0x1b4c1e[_0x1aeb('0x20')];_0x540b85[_0x33fbec][_0x1aeb('0x26')]=!![];_0x540b85[_0x33fbec][_0x1aeb('0x27')]=_0x1b4c1e[_0x1aeb('0x1e')];_0x540b85[_0x33fbec]['interface']=_['isNil'](_0x1b4c1e[_0x1aeb('0x21')])?util['format'](_0x1aeb('0x23'),_0x1b4c1e['name']):_0x1b4c1e['interface'];if(_0x540b85[_0x33fbec][_0x1aeb('0x28')]){_0x540b85[_0x33fbec]['queuecallercompleteAt']=moment()[_0x1aeb('0x22')](_0x1aeb('0x29'));}if(_0x540b85[_0x33fbec][_0x1aeb('0x2a')]){_0x540b85[_0x33fbec][_0x1aeb('0x2b')]=moment()[_0x1aeb('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x1aeb('0x14')](_0x540b85[_0x33fbec]);}RpcVoiceQueueReport[_0x1aeb('0x2c')](_0x540b85[_0x33fbec]);}};function extractCalleridNumber(_0x46aedc){var _0x194e5a=_0x46aedc['match'](/<(.*?)>/);return _0x194e5a?_0x194e5a[0x1]:_0x46aedc;}Report[_0x1aeb('0x11')][_0x1aeb('0x2d')]=function(_0x6c7601){for(var _0x2fcd0c=0x0;_0x2fcd0c','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitors'];(function(_0x3ae327,_0x3b6807){var _0x5cfb23=function(_0x3f15e3){while(--_0x3f15e3){_0x3ae327['push'](_0x3ae327['shift']());}};_0x5cfb23(++_0x3b6807);}(_0x6e2f,0x135));var _0xf6e2=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6e2f[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xf6e2('0x0'));var moment=require(_0xf6e2('0x1'));var util=require('util');var config=require(_0xf6e2('0x2'));var ami=require(_0xf6e2('0x3'));var RpcVoiceAgentReport=require(_0xf6e2('0x4'));var RpcVoiceCallReport=require(_0xf6e2('0x5'));var RpcVoiceDialReport=require(_0xf6e2('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xf6e2('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xf6e2('0x8'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xf6e2('0x9'));function Report(_0x52bb06){this[_0xf6e2('0xa')]=_0x52bb06;this[_0xf6e2('0xb')]=_0x52bb06['agents'];this[_0xf6e2('0xc')]=_0x52bb06[_0xf6e2('0xc')];}Report[_0xf6e2('0xd')][_0xf6e2('0xe')]=function(_0x154e8d){var _0x290f3a=new VoiceQueueReport(this[_0xf6e2('0xa')]);var _0x5cf5da=new VoiceAgentReport(this[_0xf6e2('0xa')]);var _0x51de6d=new VoiceDialReport(this['realtime']);var _0x2cd04f=new VoiceCallReport(this['realtime']);var _0x4854b3=new UserReport(this[_0xf6e2('0xa')]);if(config[_0xf6e2('0xf')]&&config['xdr'][_0xf6e2('0x10')]){ami['on'](_0xf6e2('0x11'),this[_0xf6e2('0x12')]['bind'](this));ami['on'](_0xf6e2('0x13'),this[_0xf6e2('0x14')]['bind'](this));ami['on'](_0xf6e2('0x15'),this[_0xf6e2('0x16')]['bind'](this));ami['on'](_0xf6e2('0x17'),this[_0xf6e2('0x18')]['bind'](this));ami['on'](_0xf6e2('0x19'),this[_0xf6e2('0x1a')][_0xf6e2('0x1b')](this));ami['on'](_0xf6e2('0x1c'),this[_0xf6e2('0x1d')][_0xf6e2('0x1b')](this));}};Report[_0xf6e2('0xd')][_0xf6e2('0x1e')]=function(_0x269610){var _0x530751;_0x530751=_[_0xf6e2('0x1f')](this['agents'],function(_0x25ca6c){return _0x25ca6c['accountcode']==_0x269610||_0x25ca6c[_0xf6e2('0x20')]==_0x269610;});if(_[_0xf6e2('0x21')](_0x530751)){var _0x4d8e85=_['find'](this[_0xf6e2('0xc')],function(_0x441da8){return _0x441da8[_0xf6e2('0x22')]==_0x269610||_0x441da8[_0xf6e2('0x20')]==_0x269610;});if(_0x4d8e85){_0x530751=_[_0xf6e2('0x1f')](this[_0xf6e2('0xb')],function(_0x118bf1){return _0x118bf1[_0xf6e2('0x23')]==util[_0xf6e2('0x24')]('SIP/%s',_0x4d8e85[_0xf6e2('0x20')]);});}}return _0x530751;};Report[_0xf6e2('0xd')]['voiceQueueReport']=function(_0x1694db){for(var _0x7cc9b9=0x0;_0x7cc9b9<_0x1694db[_0xf6e2('0x25')];_0x7cc9b9+=0x1){var _0x5190f1=this[_0xf6e2('0x1e')](_0x1694db[_0x7cc9b9]['connectedlinenum']);if(_0x5190f1){_0x1694db[_0x7cc9b9][_0xf6e2('0x22')]=_0x5190f1['accountcode'];_0x1694db[_0x7cc9b9][_0xf6e2('0x26')]=!![];_0x1694db[_0x7cc9b9][_0xf6e2('0x27')]=_0x5190f1['name'];_0x1694db[_0x7cc9b9][_0xf6e2('0x23')]=_[_0xf6e2('0x21')](_0x5190f1[_0xf6e2('0x23')])?util[_0xf6e2('0x24')](_0xf6e2('0x28'),_0x5190f1[_0xf6e2('0x20')]):_0x5190f1[_0xf6e2('0x23')];if(_0x1694db[_0x7cc9b9][_0xf6e2('0x29')]){_0x1694db[_0x7cc9b9]['queuecallercompleteAt']=moment()[_0xf6e2('0x24')](_0xf6e2('0x2a'));}if(_0x1694db[_0x7cc9b9][_0xf6e2('0x2b')]){_0x1694db[_0x7cc9b9][_0xf6e2('0x2c')]=moment()['format'](_0xf6e2('0x2a'));}RpcMemberReport[_0xf6e2('0x12')](_0x1694db[_0x7cc9b9]);}RpcVoiceQueueReport[_0xf6e2('0x2d')](_0x1694db[_0x7cc9b9]);}};function extractCalleridNumber(_0x2fa989){var _0x4e6de8=_0x2fa989[_0xf6e2('0x2e')](/<(.*?)>/);return _0x4e6de8?_0x4e6de8[0x1]:_0x2fa989;}Report[_0xf6e2('0xd')][_0xf6e2('0x2f')]=function(_0x37f021){for(var _0x4abdcc=0x0;_0x4abdcc{delete this[_0xa044('0xb')][_0x589f6d];},_0x5d8ad1);}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xabae=['[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','syncMusicOnHoldStart','channel','substring','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','exports','lodash','util','ioredis','../../../config/environment','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','emit','isUndefined','prototype','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','voice','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','lastevent','connect','pick','destconnectedlinenum','name','exten','custom:agentconnect','user:%s','user:agentconnect','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','assign','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','agentacw','omit'];(function(_0x354704,_0x59b29f){var _0x130631=function(_0x507513){while(--_0x507513){_0x354704['push'](_0x354704['shift']());}};_0x130631(++_0x59b29f);}(_0xabae,0x162));var _0xeaba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xabae[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeaba('0x0'));var moment=require('moment');var util=require(_0xeaba('0x1'));var Redis=require(_0xeaba('0x2'));var config=require(_0xeaba('0x3'));var logger=require('../../../config/logger')(_0xeaba('0x4'));var ami=require('../ami');config[_0xeaba('0x5')]=_[_0xeaba('0x6')](config['redis'],{'host':_0xeaba('0x7'),'port':0x18eb});var io=require(_0xeaba('0x8'))(new Redis(config[_0xeaba('0x5')]));function VoiceAgentReport(_0x1f7f4f){this[_0xeaba('0x9')]={};this[_0xeaba('0xa')]=_0x1f7f4f[_0xeaba('0x9')];this[_0xeaba('0xb')]=_0x1f7f4f[_0xeaba('0xb')];this[_0xeaba('0xc')]=_0x1f7f4f[_0xeaba('0xc')];this[_0xeaba('0xd')]={};ami['on'](_0xeaba('0xe'),this[_0xeaba('0xf')][_0xeaba('0x10')](this));ami['on'](_0xeaba('0x11'),this[_0xeaba('0x12')][_0xeaba('0x10')](this));ami['on'](_0xeaba('0x13'),this['syncAgentRingNoAnswer'][_0xeaba('0x10')](this));ami['on'](_0xeaba('0x14'),this[_0xeaba('0x15')][_0xeaba('0x10')](this));ami['on'](_0xeaba('0x16'),this[_0xeaba('0x17')][_0xeaba('0x10')](this));ami['on']('varset',this[_0xeaba('0x18')][_0xeaba('0x10')](this));ami['on'](_0xeaba('0x19'),this[_0xeaba('0x1a')][_0xeaba('0x10')](this));ami['on'](_0xeaba('0x1b'),this['syncMusicOnHoldStart'][_0xeaba('0x10')](this));ami['on'](_0xeaba('0x1c'),this[_0xeaba('0x1d')][_0xeaba('0x10')](this));ami['on'](_0xeaba('0x1e'),this[_0xeaba('0x1f')][_0xeaba('0x10')](this));ami['on'](_0xeaba('0x20'),this['syncBlindTransfer'][_0xeaba('0x10')](this));}VoiceAgentReport['prototype'][_0xeaba('0x21')]=function(_0x23bc07,_0x567efc,_0x7147a6){io['to'](_0x23bc07)[_0xeaba('0x21')](_0x567efc,_0x7147a6);};VoiceAgentReport['prototype']['isNotNull']=function(_0x44b0ee){return _0x44b0ee!==null&&!_[_0xeaba('0x22')](_0x44b0ee);};VoiceAgentReport[_0xeaba('0x23')][_0xeaba('0xf')]=function(_0x2560c4){try{if(this[_0xeaba('0x24')](_0x2560c4)){logger[_0xeaba('0x25')](_0xeaba('0x26'),_0x2560c4[_0xeaba('0x27')],_0x2560c4[_0xeaba('0x28')],_0x2560c4[_0xeaba('0x29')]);logger[_0xeaba('0x2a')](_0xeaba('0x2b'),_0x2560c4[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x2560c4,{'showHidden':![],'depth':null}));if(_[_0xeaba('0x22')](this[_0xeaba('0x9')][_0x2560c4[_0xeaba('0x27')]])){this['channels'][_0x2560c4['uniqueid']]={};}var _0x328a30=this[_0xeaba('0xc')][_0x2560c4[_0xeaba('0x2d')]];var _0x464e94=this['channels'][_0x2560c4[_0xeaba('0x27')]][_0x2560c4[_0xeaba('0x29')]];var _0x427749=this[_0xeaba('0xb')][_0x2560c4[_0xeaba('0x2e')]];var _0x2c3bb1=this[_0xeaba('0xd')][_0x2560c4['uniqueid']];if(_[_0xeaba('0x22')](_0x464e94)){_0x464e94={'agentcalledAt':moment()[_0xeaba('0x2f')](_0xeaba('0x30')),'lastevent':'called','mandatoryDisposition':_0x427749&&_0x427749[_0xeaba('0x31')]?_0x427749[_0xeaba('0x31')]:![],'type':_0x427749&&_0x427749[_0xeaba('0x32')]?_0x427749[_0xeaba('0x32')]:_0xeaba('0x33'),'variables':_0x2c3bb1,'motionChannel':_0xeaba('0x34')};}Object['assign'](_0x464e94,_['omit'](_0x2560c4,['event',_0xeaba('0x35')]));this['channels'][_0x2560c4['uniqueid']][_0x2560c4[_0xeaba('0x29')]]=_0x464e94;logger[_0xeaba('0x2a')](_0xeaba('0x36'),_0x2560c4[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x464e94,{'showHidden':![],'depth':null}));ami[_0xeaba('0x21')](_0xeaba('0x37'),_0x464e94);var _0x5864b0={'id':_0x328a30['id'],'calleridnum':_0x464e94[_0xeaba('0x38')],'queue':_0x464e94['queue'],'variables':_0x464e94[_0xeaba('0xd')],'uniqueid':_0x2560c4[_0xeaba('0x27')]};logger[_0xeaba('0x2a')](_0xeaba('0x39'),_0x2560c4[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x5864b0,{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x2560c4[_0xeaba('0x28')]),_0xeaba('0x3a'),_0x5864b0);}}catch(_0xe914e5){logger['error']('[%s][voiceAgentReport][agentcalled]',_0x2560c4['uniqueid'],util['inspect'](_0xe914e5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xeaba('0x23')][_0xeaba('0x12')]=function(_0x427a9c){try{if(this[_0xeaba('0x24')](_0x427a9c)){if(this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]]){for(var _0x169339 in this[_0xeaba('0x9')][_0x427a9c['uniqueid']]){if(this[_0xeaba('0x9')][_0x427a9c['uniqueid']][_0xeaba('0x3b')](_0x169339)){if(_0x427a9c[_0xeaba('0x29')]===_0x169339){logger[_0xeaba('0x25')](_0xeaba('0x3c'),_0x427a9c['uniqueid'],_0x427a9c['membername'],_0x427a9c[_0xeaba('0x29')]);this['channels'][_0x427a9c[_0xeaba('0x27')]][_0x169339][_0xeaba('0x3d')]=moment()['format'](_0xeaba('0x30'));this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]][_0x169339][_0xeaba('0x3e')]=_0x427a9c[_0xeaba('0x3e')];this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]][_0x169339]['connectedlinenum']=_0x427a9c[_0xeaba('0x3f')];this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]][_0x169339][_0xeaba('0x40')]=_0x427a9c[_0xeaba('0x40')];this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]][_0x169339]['destchannelstatedesc']=_0x427a9c['destchannelstatedesc'];this['channels'][_0x427a9c[_0xeaba('0x27')]][_0x169339]['holdtime']=_0x427a9c['holdtime'];this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]][_0x169339][_0xeaba('0x41')]=_0xeaba('0x42');_['merge'](this[_0xeaba('0xc')][_0x427a9c[_0xeaba('0x2d')]],_[_0xeaba('0x43')](_0x427a9c,['queue',_0xeaba('0x44')]));var _0xc7e0d7=this[_0xeaba('0xc')][_0x427a9c[_0xeaba('0x2d')]];var _0x5652ae={'id':_0xc7e0d7['id'],'name':_0xc7e0d7[_0xeaba('0x45')],'agentconnected':!![],'destaccountcode':_0xc7e0d7['accountcode'],'destconnectedlinenum':this[_0xeaba('0x9')][_0x427a9c['uniqueid']][_0x427a9c['destuniqueid']][_0xeaba('0x46')],'queue':this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]][_0x427a9c[_0xeaba('0x29')]]['queue'],'uniqueid':this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]][_0x427a9c[_0xeaba('0x29')]][_0xeaba('0x27')]};ami[_0xeaba('0x21')](_0xeaba('0x47'),this['channels'][_0x427a9c['uniqueid']][_0x427a9c[_0xeaba('0x29')]]);this[_0xeaba('0x21')](util[_0xeaba('0x2f')](_0xeaba('0x48'),_0x427a9c[_0xeaba('0x28')]),_0xeaba('0x49'),_0x5652ae);}else if(!this[_0xeaba('0x9')][_0x427a9c['uniqueid']][_0x169339][_0xeaba('0x13')]&&!this['channels'][_0x427a9c['uniqueid']][_0x169339]['agentcomplete']){logger[_0xeaba('0x25')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x427a9c[_0xeaba('0x27')],this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]][_0x169339][_0xeaba('0x28')],_0x169339);this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]][_0x169339]['agentringnoanswer']=!![];this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]][_0x169339][_0xeaba('0x4a')]=moment()[_0xeaba('0x2f')](_0xeaba('0x30'));this[_0xeaba('0x9')][_0x427a9c['uniqueid']][_0x169339][_0xeaba('0x4b')]=_0x427a9c[_0xeaba('0x29')];this['channels'][_0x427a9c[_0xeaba('0x27')]][_0x169339][_0xeaba('0x4c')]=_0x427a9c['membername'];this['channels'][_0x427a9c[_0xeaba('0x27')]][_0x169339]['lastevent']=_0xeaba('0x4d');this['channels'][_0x427a9c['uniqueid']][_0x169339][_0xeaba('0x4e')]=_0xeaba('0x4d');logger[_0xeaba('0x2a')](_0xeaba('0x4f'),_0x427a9c[_0xeaba('0x27')],util['inspect'](this[_0xeaba('0x9')][_0x427a9c['uniqueid']][_0x169339],{'showHidden':![],'depth':null}));ami[_0xeaba('0x21')](_0xeaba('0x50'),this[_0xeaba('0x9')][_0x427a9c[_0xeaba('0x27')]][_0x169339]);}else{logger['debug']('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x427a9c[_0xeaba('0x27')]);}}}}}}catch(_0x4c334b){logger[_0xeaba('0x51')](_0xeaba('0x52'),_0x427a9c['uniqueid'],util[_0xeaba('0x2c')](_0x4c334b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xeaba('0x23')][_0xeaba('0x53')]=function(_0x17af83){try{if(this[_0xeaba('0x24')](_0x17af83)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x17af83['uniqueid'],util[_0xeaba('0x2c')](_0x17af83,{'showHidden':![],'depth':null}));if(this['channels'][_0x17af83[_0xeaba('0x27')]]&&this[_0xeaba('0x9')][_0x17af83['uniqueid']][_0x17af83[_0xeaba('0x29')]]){logger[_0xeaba('0x25')](_0xeaba('0x54'),_0x17af83[_0xeaba('0x27')],_0x17af83['membername'],_0x17af83[_0xeaba('0x29')]);var _0x4e5e2d=this[_0xeaba('0xc')][_0x17af83['interface']];var _0xe9c006=this[_0xeaba('0x9')][_0x17af83[_0xeaba('0x27')]][_0x17af83[_0xeaba('0x29')]];_0xe9c006['agentringnoanswer']=!![];_0xe9c006[_0xeaba('0x4a')]=moment()[_0xeaba('0x2f')](_0xeaba('0x30'));_0xe9c006[_0xeaba('0x41')]='rejected';_0xe9c006[_0xeaba('0x4e')]=_0xeaba('0x55');var _0xc371e6={'id':_0x4e5e2d['id'],'name':_0x4e5e2d[_0xeaba('0x45')],'queue':_0xe9c006[_0xeaba('0x2e')],'uniqueid':_0xe9c006[_0xeaba('0x27')]};logger['debug'](_0xeaba('0x56'),_0x17af83[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0xc371e6,{'showHidden':![],'depth':null}));this['emit'](util[_0xeaba('0x2f')]('user:%s',_0x4e5e2d['name']),_0xeaba('0x57'),_0xc371e6);ami[_0xeaba('0x21')]('custom:agentringnoanswer',_0xe9c006);this[_0xeaba('0x9')][_0x17af83['uniqueid']][_0x17af83['destuniqueid']]=Object[_0xeaba('0x58')]({},_0xe9c006);}}}catch(_0x583426){logger[_0xeaba('0x51')](_0xeaba('0x59'),_0x17af83[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x583426,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xeaba('0x15')]=function(_0xcd844d){try{if(this[_0xeaba('0x24')](_0xcd844d)){logger[_0xeaba('0x2a')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0xcd844d['uniqueid'],util[_0xeaba('0x2c')](_0xcd844d,{'showHidden':![],'depth':null}));if(this['channels'][_0xcd844d[_0xeaba('0x27')]]){for(var _0x435520 in this[_0xeaba('0x9')][_0xcd844d[_0xeaba('0x27')]]){if(this[_0xeaba('0x9')][_0xcd844d[_0xeaba('0x27')]][_0xeaba('0x3b')](_0x435520)&&!this[_0xeaba('0x9')][_0xcd844d[_0xeaba('0x27')]][_0x435520][_0xeaba('0x13')]&&!this[_0xeaba('0x9')][_0xcd844d[_0xeaba('0x27')]][_0x435520][_0xeaba('0x16')]){logger['info'](_0xeaba('0x5a'),_0xcd844d[_0xeaba('0x27')],this[_0xeaba('0x9')][_0xcd844d[_0xeaba('0x27')]][_0x435520][_0xeaba('0x28')],_0x435520);this[_0xeaba('0x9')][_0xcd844d['uniqueid']][_0x435520][_0xeaba('0x13')]=!![];this[_0xeaba('0x9')][_0xcd844d[_0xeaba('0x27')]][_0x435520][_0xeaba('0x4a')]=moment()['format'](_0xeaba('0x30'));this[_0xeaba('0x9')][_0xcd844d[_0xeaba('0x27')]][_0x435520]['lastevent']=_0xeaba('0x5b');this[_0xeaba('0x9')][_0xcd844d[_0xeaba('0x27')]][_0x435520][_0xeaba('0x4e')]=_0xeaba('0x5b');logger[_0xeaba('0x2a')](_0xeaba('0x5c'),_0xcd844d[_0xeaba('0x27')],util[_0xeaba('0x2c')](this['channels'][_0xcd844d[_0xeaba('0x27')]][_0x435520],{'showHidden':![],'depth':null}));ami[_0xeaba('0x21')](_0xeaba('0x5d'),this[_0xeaba('0x9')][_0xcd844d[_0xeaba('0x27')]][_0x435520]);}}}}}catch(_0x1a8fee){logger['error'](_0xeaba('0x5e'),_0xcd844d[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x1a8fee,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xeaba('0x17')]=function(_0x1bf24d){try{if(this[_0xeaba('0x24')](_0x1bf24d)){logger[_0xeaba('0x2a')](_0xeaba('0x5f'),_0x1bf24d[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x1bf24d,{'showHidden':![],'depth':null}));if(this[_0xeaba('0x9')][_0x1bf24d['uniqueid']]){for(var _0x4f7d3a in this[_0xeaba('0x9')][_0x1bf24d['uniqueid']]){if(this[_0xeaba('0x9')][_0x1bf24d['uniqueid']]['hasOwnProperty'](_0x4f7d3a)){if(this['channels'][_0x1bf24d[_0xeaba('0x27')]][_0x4f7d3a]['agentconnectAt']&&!this['channels'][_0x1bf24d[_0xeaba('0x27')]][_0x4f7d3a][_0xeaba('0x16')]){logger[_0xeaba('0x25')](_0xeaba('0x60'),_0x1bf24d[_0xeaba('0x27')],this[_0xeaba('0x9')][_0x1bf24d[_0xeaba('0x27')]][_0x4f7d3a][_0xeaba('0x28')],_0x4f7d3a);this[_0xeaba('0x9')][_0x1bf24d[_0xeaba('0x27')]][_0x4f7d3a][_0xeaba('0x16')]=!![];this[_0xeaba('0x9')][_0x1bf24d['uniqueid']][_0x4f7d3a][_0xeaba('0x61')]=moment()['format'](_0xeaba('0x30'));this[_0xeaba('0x9')][_0x1bf24d[_0xeaba('0x27')]][_0x4f7d3a][_0xeaba('0x41')]=_0xeaba('0x62');this[_0xeaba('0x9')][_0x1bf24d[_0xeaba('0x27')]][_0x4f7d3a][_0xeaba('0x4e')]=_0x1bf24d[_0xeaba('0x4e')]==_0xeaba('0x63')?'agent':_0x1bf24d[_0xeaba('0x4e')];this[_0xeaba('0x9')][_0x1bf24d['uniqueid']][_0x4f7d3a][_0xeaba('0x64')]=_0x1bf24d[_0xeaba('0x64')];if(this[_0xeaba('0xb')][_0x1bf24d['queue']]&&this['voiceQueues'][_0x1bf24d[_0xeaba('0x2e')]][_0xeaba('0x65')]){this[_0xeaba('0x9')][_0x1bf24d['uniqueid']][_0x4f7d3a][_0xeaba('0x66')]=this[_0xeaba('0xb')][_0x1bf24d['queue']]['acwTimeout'];this[_0xeaba('0x9')][_0x1bf24d['uniqueid']][_0x4f7d3a][_0xeaba('0x67')]=!![];}this['agents'][_0x1bf24d['interface']]=_[_0xeaba('0x68')](this['agents'][_0x1bf24d[_0xeaba('0x2d')]],['queue',_0xeaba('0x44')]);logger[_0xeaba('0x2a')](_0xeaba('0x69'),_0x1bf24d[_0xeaba('0x27')],util['inspect'](this[_0xeaba('0x9')][_0x1bf24d[_0xeaba('0x27')]][_0x4f7d3a],{'showHidden':![],'depth':null}));ami[_0xeaba('0x21')]('custom:agentcomplete',this[_0xeaba('0x9')][_0x1bf24d[_0xeaba('0x27')]][_0x4f7d3a]);logger[_0xeaba('0x2a')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x1bf24d[_0xeaba('0x27')],util[_0xeaba('0x2c')]({'id':this['agents'][_0x1bf24d[_0xeaba('0x2d')]]['id'],'destaccountcode':_0x1bf24d['destaccountcode']},{'showHidden':![],'depth':null}));this[_0xeaba('0x21')](util[_0xeaba('0x2f')]('user:%s',_0x1bf24d[_0xeaba('0x28')]),_0xeaba('0x6a'),{'id':this['agents'][_0x1bf24d[_0xeaba('0x2d')]]['id'],'destaccountcode':Number(_0x1bf24d[_0xeaba('0x6b')])});}}}}}}catch(_0x29c072){logger[_0xeaba('0x51')](_0xeaba('0x6c'),_0x1bf24d[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x29c072,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x45223e){try{if(this['isNotNull'](_0x45223e)){logger['debug'](_0xeaba('0x6d'),_0x45223e[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x45223e,{'showHidden':![],'depth':null}));this[_0xeaba('0x6e')](_0x45223e[_0xeaba('0x27')],_[_0xeaba('0x6f')](_0x45223e[_0xeaba('0x70')])[0x0],_0x45223e['value']);if(this[_0xeaba('0x9')][_0x45223e[_0xeaba('0x27')]]){for(var _0x536964 in this[_0xeaba('0x9')][_0x45223e[_0xeaba('0x27')]]){if(this[_0xeaba('0x9')][_0x45223e['uniqueid']][_0xeaba('0x3b')](_0x536964)){logger[_0xeaba('0x25')](_0xeaba('0x71'),_0x45223e['uniqueid'],_0x536964,_[_0xeaba('0x6f')](_0x45223e[_0xeaba('0x70')])[0x0],_0x45223e['value']);if(_[_0xeaba('0x22')](this[_0xeaba('0x9')][_0x45223e['uniqueid']][_0x536964][_0xeaba('0xd')])){this[_0xeaba('0x9')][_0x45223e[_0xeaba('0x27')]][_0x536964]['variables']={};}this[_0xeaba('0x9')][_0x45223e[_0xeaba('0x27')]][_0x536964][_0xeaba('0xd')]=this[_0xeaba('0xd')][_0x45223e[_0xeaba('0x27')]];}}}}}catch(_0x114503){logger[_0xeaba('0x51')](_0xeaba('0x72'),_0x45223e['uniqueid'],util[_0xeaba('0x2c')](_0x114503,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x367eeb,_0x2404dc,_0x25f38a){var _0x2390f1=['rtpaudioqos',_0xeaba('0x73'),_0xeaba('0x74'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xeaba('0x75'),_0xeaba('0x76'),'rtpaudioqosrttbridged',_0xeaba('0x77'),_0xeaba('0x78'),_0xeaba('0x79'),'bridgepvtcallid',_0xeaba('0x7a'),'memberdynamic',_0xeaba('0x7b'),_0xeaba('0x7c'),_0xeaba('0x28'),_0xeaba('0x7d'),_0xeaba('0x7e')];if(!_[_0xeaba('0x7f')](_0x2404dc)&&!_[_0xeaba('0x80')](_0x2390f1,_0x2404dc)){if(_[_0xeaba('0x22')](this[_0xeaba('0xd')][_0x367eeb])){this[_0xeaba('0xd')][_0x367eeb]={};}this[_0xeaba('0xd')][_0x367eeb][_0x2404dc]=_0x25f38a;}};VoiceAgentReport['prototype'][_0xeaba('0x1a')]=function(_0x51175a){try{if(this['isNotNull'](_0x51175a)){logger[_0xeaba('0x2a')](_0xeaba('0x81'),_0x51175a[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x51175a,{'showHidden':![],'depth':null}));if(this[_0xeaba('0x9')][_0x51175a[_0xeaba('0x27')]]){for(var _0x39edc8 in this[_0xeaba('0x9')][_0x51175a[_0xeaba('0x27')]]){if(this[_0xeaba('0x9')][_0x51175a[_0xeaba('0x27')]]['hasOwnProperty'](_0x39edc8)){if(this[_0xeaba('0x9')][_0x51175a[_0xeaba('0x27')]][_0x39edc8]['reason']==_0xeaba('0x63')&&this[_0xeaba('0x9')][_0x51175a[_0xeaba('0x27')]][_0x39edc8][_0xeaba('0x16')]){logger[_0xeaba('0x25')](_0xeaba('0x82'),_0x51175a[_0xeaba('0x27')],_0x39edc8);this['channels'][_0x51175a['uniqueid']][_0x39edc8][_0xeaba('0x61')]=moment()[_0xeaba('0x2f')](_0xeaba('0x30'));}}}logger[_0xeaba('0x2a')](_0xeaba('0x83'),_0x51175a[_0xeaba('0x27')],util['inspect'](_[_0xeaba('0x84')](this[_0xeaba('0x9')][_0x51175a[_0xeaba('0x27')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xeaba('0x85'),_[_0xeaba('0x84')](this[_0xeaba('0x9')][_0x51175a['uniqueid']]));this[_0xeaba('0x86')](_0x51175a[_0xeaba('0x27')]);}if(this[_0xeaba('0xd')][_0x51175a[_0xeaba('0x27')]]){delete this[_0xeaba('0xd')][_0x51175a[_0xeaba('0x27')]];}}}catch(_0x3003d0){logger[_0xeaba('0x51')]('[%s][voiceAgentReport][hangup]',_0x51175a[_0xeaba('0x27')],util['inspect'](_0x3003d0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xeaba('0x23')][_0xeaba('0x1f')]=function(_0x53eb99){try{if(this['isNotNull'](_0x53eb99)){logger[_0xeaba('0x2a')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x53eb99[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x53eb99,{'showHidden':![],'depth':null}));if(this['channels'][_0x53eb99[_0xeaba('0x87')]]){for(var _0x20fae7 in this[_0xeaba('0x9')][_0x53eb99[_0xeaba('0x87')]]){if(this[_0xeaba('0x9')][_0x53eb99['transfereeuniqueid']][_0xeaba('0x3b')](_0x20fae7)){if(_0x53eb99[_0xeaba('0x88')]===_0x20fae7){logger['info'](_0xeaba('0x89'),_0x53eb99[_0xeaba('0x27')],this['channels'][_0x53eb99[_0xeaba('0x87')]][_0x20fae7][_0xeaba('0x28')],_0x20fae7);var _0x105095=moment();this['channels'][_0x53eb99['transfereeuniqueid']][_0x20fae7]['agentcomplete']=!![];this[_0xeaba('0x9')][_0x53eb99[_0xeaba('0x87')]][_0x20fae7][_0xeaba('0x61')]=moment()[_0xeaba('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xeaba('0x9')][_0x53eb99['transfereeuniqueid']][_0x20fae7][_0xeaba('0x41')]='complete';this[_0xeaba('0x9')][_0x53eb99['transfereeuniqueid']][_0x20fae7][_0xeaba('0x4e')]=_0xeaba('0x63');this['channels'][_0x53eb99[_0xeaba('0x87')]][_0x20fae7][_0xeaba('0x64')]=_0x105095[_0xeaba('0x8a')](this[_0xeaba('0x9')][_0x53eb99[_0xeaba('0x87')]][_0x20fae7]['agentconnectAt'],_0xeaba('0x8b'));}}}}if(this[_0xeaba('0x9')][_0x53eb99[_0xeaba('0x8c')]]){var _0x34a377=this[_0xeaba('0x9')][_0x53eb99[_0xeaba('0x8c')]];this[_0xeaba('0x9')][_0x53eb99[_0xeaba('0x8c')]]=this[_0xeaba('0x9')][_0x53eb99['transfereeuniqueid']];this[_0xeaba('0x9')][_0x53eb99['transfereeuniqueid']]=_0x34a377;}}}catch(_0x309b81){logger[_0xeaba('0x51')](_0xeaba('0x8d'),_0x53eb99[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x309b81,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xeaba('0x23')]['syncBlindTransfer']=function(_0x178399){try{if(this['isNotNull'](_0x178399)){logger[_0xeaba('0x2a')](_0xeaba('0x8e'),_0x178399['uniqueid'],util[_0xeaba('0x2c')](_0x178399,{'showHidden':![],'depth':null}));if(this[_0xeaba('0x9')][_0x178399[_0xeaba('0x87')]]){for(var _0x5b7fe5 in this['channels'][_0x178399[_0xeaba('0x87')]]){if(this[_0xeaba('0x9')][_0x178399['transfereeuniqueid']][_0xeaba('0x3b')](_0x5b7fe5)){if(_0x178399[_0xeaba('0x8f')]===_0x5b7fe5){logger[_0xeaba('0x25')](_0xeaba('0x90'),_0x178399[_0xeaba('0x27')],this[_0xeaba('0x9')][_0x178399[_0xeaba('0x87')]][_0x5b7fe5]['membername'],_0x5b7fe5);var _0xdc1e4c=moment();this[_0xeaba('0x9')][_0x178399[_0xeaba('0x87')]][_0x5b7fe5][_0xeaba('0x16')]=!![];this[_0xeaba('0x9')][_0x178399['transfereeuniqueid']][_0x5b7fe5][_0xeaba('0x61')]=_0xdc1e4c;this[_0xeaba('0x9')][_0x178399[_0xeaba('0x87')]][_0x5b7fe5][_0xeaba('0x41')]='complete';this[_0xeaba('0x9')][_0x178399[_0xeaba('0x87')]][_0x5b7fe5][_0xeaba('0x4e')]=_0xeaba('0x63');this[_0xeaba('0x9')][_0x178399['transfereeuniqueid']][_0x5b7fe5][_0xeaba('0x64')]=_0xdc1e4c[_0xeaba('0x8a')](this['channels'][_0x178399[_0xeaba('0x87')]][_0x5b7fe5]['agentconnectAt'],_0xeaba('0x8b'));}}}}}}catch(_0x1f53db){logger[_0xeaba('0x51')]('[%s][voiceAgentReport][blindtransfer]',_0x178399['uniqueid'],util[_0xeaba('0x2c')](_0x1f53db,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xeaba('0x23')][_0xeaba('0x91')]=function(_0x58ac19){var _0xd09f26='';try{if(this[_0xeaba('0x24')](_0x58ac19)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x58ac19[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x58ac19,{'showHidden':![],'depth':null}));if(_0x58ac19[_0xeaba('0x92')]){_0xd09f26=_0x58ac19[_0xeaba('0x92')][_0xeaba('0x93')](0x0,_0x58ac19[_0xeaba('0x92')]['lastIndexOf']('-'));if(this['agents'][_0xd09f26]){logger[_0xeaba('0x25')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x58ac19[_0xeaba('0x27')],_0xd09f26);this['agents'][_0xd09f26][_0xeaba('0x94')]=!![];}}}}catch(_0x3dcffb){logger[_0xeaba('0x51')](_0xeaba('0x95'),_0x58ac19['uniqueid'],util[_0xeaba('0x2c')](_0x3dcffb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xeaba('0x23')][_0xeaba('0x1d')]=function(_0x5134fa){var _0xa99a2b='';try{if(this[_0xeaba('0x24')](_0x5134fa)){logger[_0xeaba('0x2a')](_0xeaba('0x96'),_0x5134fa[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x5134fa,{'showHidden':![],'depth':null}));if(_0x5134fa[_0xeaba('0x92')]){_0xa99a2b=_0x5134fa[_0xeaba('0x92')]['substring'](0x0,_0x5134fa[_0xeaba('0x92')][_0xeaba('0x97')]('-'));if(this[_0xeaba('0xc')][_0xa99a2b]){logger[_0xeaba('0x25')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x5134fa['uniqueid'],_0xa99a2b);this['agents'][_0xa99a2b][_0xeaba('0x94')]=![];}}}}catch(_0x1ee8fc){logger[_0xeaba('0x51')]('[%s][voiceAgentReport][musiconholdstop]',_0x5134fa[_0xeaba('0x27')],util[_0xeaba('0x2c')](_0x1ee8fc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xeaba('0x23')]['deleteChannelAfterTimeout']=function(_0x5e3f1f,_0x601841=0x2710){if(this[_0xeaba('0x9')][_0x5e3f1f]){setTimeout(()=>{delete this[_0xeaba('0x9')][_0x5e3f1f];},_0x601841);}};module[_0xeaba('0x98')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 114fd38..367016c 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 _0x66d3=['[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','some','origtransfererlinkedid','outbound','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BlindTransfer','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','../ami','../model/channel','../rpc/setting','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','blindTransfers','coreshowchannel','syncNewExten','newexten','newchannel','syncNewChannel','bind','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','syncBlindTransfer','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','uniqueid','linkedid','channels','merge','pick','context','from-sip','agents','channel','split','xcally-motion-preview','destconnectedlinenum','connectedlinenum','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','format','disposition','toNumber','channelstate','keys','undefined','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','set','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','connectedlinename','destinationchannel','membername','holdtime','UserId','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','replace','.wav49','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','[%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','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','then','transferToInternal','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum'];(function(_0x7c0e3d,_0x2c07e9){var _0x67d0f5=function(_0x16ce2a){while(--_0x16ce2a){_0x7c0e3d['push'](_0x7c0e3d['shift']());}};_0x67d0f5(++_0x2c07e9);}(_0x66d3,0xdb));var _0x366d=function(_0x4a75f4,_0x2660ed){_0x4a75f4=_0x4a75f4-0x0;var _0x3d222d=_0x66d3[_0x4a75f4];return _0x3d222d;};'use strict';var _=require(_0x366d('0x0'));var moment=require(_0x366d('0x1'));var util=require(_0x366d('0x2'));var path=require('path');var Redis=require('ioredis');var config=require(_0x366d('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0x366d('0x4'));var Channel=require(_0x366d('0x5'));var RpcSetting=require(_0x366d('0x6'));var applications=['set',_0x366d('0x7'),_0x366d('0x8'),_0x366d('0x9'),_0x366d('0xa'),_0x366d('0xb')];var dispositions=[_0x366d('0xc'),'FAILED',_0x366d('0xd'),'NO\x20ANSWER',_0x366d('0xc'),_0x366d('0xc'),_0x366d('0xe'),_0x366d('0xf'),_0x366d('0xd'),_0x366d('0xd'),_0x366d('0xd')];config[_0x366d('0x10')]=_[_0x366d('0x11')](config[_0x366d('0x10')],{'host':_0x366d('0x12'),'port':0x18eb});var io=require(_0x366d('0x13'))(new Redis(config[_0x366d('0x10')]));function VoiceCallReport(_0x2d0b3a){this['channels']=_0x2d0b3a['channels'];this['agents']=_0x2d0b3a['agents'];this[_0x366d('0x14')]={};ami['on'](_0x366d('0x15'),this[_0x366d('0x16')]['bind'](this));ami['on'](_0x366d('0x17'),this[_0x366d('0x16')]['bind'](this));ami['on'](_0x366d('0x18'),this[_0x366d('0x19')][_0x366d('0x1a')](this));ami['on']('newstate',this[_0x366d('0x1b')]['bind'](this));ami['on']('varset',this[_0x366d('0x1c')][_0x366d('0x1a')](this));ami['on'](_0x366d('0x1d'),this[_0x366d('0x1e')][_0x366d('0x1a')](this));ami['on'](_0x366d('0x1f'),this[_0x366d('0x20')][_0x366d('0x1a')](this));ami['on']('attendedtransfer',this[_0x366d('0x21')][_0x366d('0x1a')](this));ami['on']('blindtransfer',this[_0x366d('0x22')][_0x366d('0x1a')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart']['bind'](this));ami['on']('musiconholdstop',this[_0x366d('0x23')]['bind'](this));try{logger[_0x366d('0x24')](_0x366d('0x25'));ami[_0x366d('0x26')]();}catch(_0x7ef99){logger[_0x366d('0x27')](_0x366d('0x28'),util[_0x366d('0x29')](_0x7ef99,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x366d('0x2a')]['isNotNull']=function(_0x4b7507){return _0x4b7507!==null&&!_[_0x366d('0x2b')](_0x4b7507);};VoiceCallReport[_0x366d('0x2a')][_0x366d('0x2c')]=function(_0x353b12,_0x48c3dd,_0x41cd03){io['to'](_0x353b12)[_0x366d('0x2c')](_0x48c3dd,_0x41cd03);};VoiceCallReport[_0x366d('0x2a')]['syncNewCallerId']=function(_0x14b7d5){try{if(this[_0x366d('0x2d')](_0x14b7d5)){logger[_0x366d('0x24')](_0x366d('0x2e'),_0x14b7d5['uniqueid'],_0x14b7d5[_0x366d('0x2f')],_0x14b7d5[_0x366d('0x30')]);logger[_0x366d('0x31')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x14b7d5[_0x366d('0x32')],util[_0x366d('0x29')](_0x14b7d5,{'showHidden':![],'depth':null}));if(_0x14b7d5[_0x366d('0x32')]===_0x14b7d5[_0x366d('0x33')]){if(!_[_0x366d('0x2b')](this[_0x366d('0x34')][_0x14b7d5['uniqueid']])){_[_0x366d('0x35')](this[_0x366d('0x34')][_0x14b7d5['uniqueid']],_[_0x366d('0x36')](_0x14b7d5,_['keys'](this[_0x366d('0x34')][_0x14b7d5[_0x366d('0x32')]])));}}if(_0x14b7d5[_0x366d('0x37')]===_0x366d('0x38')){var _0x318aaa=this[_0x366d('0x39')][_0x14b7d5[_0x366d('0x3a')][_0x366d('0x3b')]('-')[0x0]];if(_0x318aaa){if(_0x14b7d5['exten']==_0x366d('0x3c')){_0x318aaa[_0x366d('0x3d')]=_0x14b7d5[_0x366d('0x3e')];this['emit'](util['format'](_0x366d('0x3f'),_0x318aaa[_0x366d('0x40')]),_0x366d('0x41'),{'id':_0x318aaa['id'],'destaccountcode':_0x318aaa[_0x366d('0x42')],'destconnectedlinenum':_0x14b7d5[_0x366d('0x3e')]});}}}}}catch(_0x45a9b0){logger[_0x366d('0x27')]('[%s][voiceCallReport][newcallerid]',_0x14b7d5[_0x366d('0x32')],util[_0x366d('0x29')](_0x45a9b0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x366d('0x2a')][_0x366d('0x19')]=function(_0x2eec41){try{if(this[_0x366d('0x2d')](_0x2eec41)){logger['debug'](_0x366d('0x43'),_0x2eec41['uniqueid'],util[_0x366d('0x29')](_0x2eec41,{'showHidden':![],'depth':null}));if(this[_0x366d('0x34')][_0x2eec41[_0x366d('0x32')]]){return;}if(_0x2eec41[_0x366d('0x3a')]===_0x366d('0x44')){return;}if(_0x2eec41[_0x366d('0x32')]!==_0x2eec41[_0x366d('0x33')]&&!this[_0x366d('0x14')][_0x2eec41[_0x366d('0x33')]]){return;}logger[_0x366d('0x24')](_0x366d('0x45'),_0x2eec41['uniqueid'],_0x2eec41[_0x366d('0x37')],_0x2eec41[_0x366d('0x46')]);this[_0x366d('0x34')][_0x2eec41[_0x366d('0x32')]]=new Channel();this[_0x366d('0x34')][_0x2eec41['uniqueid']][_0x366d('0x47')]=moment()[_0x366d('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x366d('0x34')][_0x2eec41[_0x366d('0x32')]][_0x366d('0x49')]=dispositions[_[_0x366d('0x4a')](_0x2eec41[_0x366d('0x4b')])];_[_0x366d('0x35')](this[_0x366d('0x34')][_0x2eec41['uniqueid']],_[_0x366d('0x36')](_0x2eec41,_[_0x366d('0x4c')](this[_0x366d('0x34')][_0x2eec41[_0x366d('0x32')]])));if(_0x2eec41['context']===_0x366d('0x38')){var _0x590a76=this[_0x366d('0x39')][_0x2eec41[_0x366d('0x3a')]['split']('-')[0x0]];if(_0x590a76&&typeof _0x590a76['destconnectedlinenum']===_0x366d('0x4d')){_0x590a76[_0x366d('0x3d')]=_0x2eec41[_0x366d('0x46')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x2eec41[_0x366d('0x32')],util[_0x366d('0x29')]({'id':_0x590a76['id'],'destaccountcode':_0x590a76[_0x366d('0x42')],'destconnectedlinenum':_0x2eec41[_0x366d('0x46')]},{'showHidden':![],'depth':null}));this[_0x366d('0x2c')](util[_0x366d('0x48')]('user:%s',_0x590a76['name']),_0x366d('0x41'),{'id':_0x590a76['id'],'destaccountcode':_0x590a76[_0x366d('0x42')],'destconnectedlinenum':_0x2eec41[_0x366d('0x46')]});}}}}catch(_0x3aeb8c){logger[_0x366d('0x27')](_0x366d('0x4e'),_0x2eec41[_0x366d('0x32')],util[_0x366d('0x29')](_0x3aeb8c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x366d('0x2a')][_0x366d('0x16')]=function(_0x5a4fed){try{if(this[_0x366d('0x2d')](_0x5a4fed)){logger[_0x366d('0x31')]('[%s][voiceCallReport][newexten]\x20event:',_0x5a4fed['uniqueid'],util[_0x366d('0x29')](_0x5a4fed,{'showHidden':![],'depth':null}));if(_0x5a4fed[_0x366d('0x3a')]===_0x366d('0x44')||_0x5a4fed['exten']==='h')return;if(_0x5a4fed[_0x366d('0x32')]===_0x5a4fed[_0x366d('0x33')]||this[_0x366d('0x14')][_0x5a4fed['linkedid']]){_0x5a4fed['application']=_0x5a4fed[_0x366d('0x4f')]?_0x5a4fed[_0x366d('0x4f')][_0x366d('0x50')]():undefined;_0x5a4fed[_0x366d('0x51')]=_0x5a4fed[_0x366d('0x52')]||_0x5a4fed[_0x366d('0x51')];if(_0x5a4fed[_0x366d('0x52')]&&_0x5a4fed['application']!==_0x366d('0x7')){_0x5a4fed[_0x366d('0x51')]=_0x5a4fed['applicationdata'][_0x366d('0x50')]();}logger[_0x366d('0x24')](_0x366d('0x53'),_0x5a4fed[_0x366d('0x32')],_0x5a4fed[_0x366d('0x4f')],_0x5a4fed[_0x366d('0x51')]);if(_[_0x366d('0x2b')](this[_0x366d('0x34')][_0x5a4fed[_0x366d('0x32')]])){this[_0x366d('0x34')][_0x5a4fed['uniqueid']]=new Channel();this[_0x366d('0x34')][_0x5a4fed[_0x366d('0x32')]][_0x366d('0x47')]=_0x5a4fed[_0x366d('0x54')]?moment()[_0x366d('0x55')](moment[_0x366d('0x54')](_0x5a4fed[_0x366d('0x54')])[_0x366d('0x56')](),_0x366d('0x56'))[_0x366d('0x48')](_0x366d('0x57')):moment()[_0x366d('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x366d('0x34')][_0x5a4fed[_0x366d('0x32')]]['disposition']='NO\x20ANSWER';}_['merge'](this[_0x366d('0x34')][_0x5a4fed['uniqueid']],_[_0x366d('0x36')](_0x5a4fed,_['keys'](this[_0x366d('0x34')][_0x5a4fed[_0x366d('0x32')]])));if(_[_0x366d('0x58')](applications,_0x5a4fed['application'])){this[_0x366d('0x34')][_0x5a4fed[_0x366d('0x32')]][_0x366d('0x59')]=_0x5a4fed['application'];this[_0x366d('0x34')][_0x5a4fed['uniqueid']][_0x366d('0x5a')]=_0x5a4fed[_0x366d('0x51')];if(_0x5a4fed[_0x366d('0x4f')]===_0x366d('0x5b')&&_['startsWith'](_0x5a4fed['applicationdata'][_0x366d('0x50')](),_0x366d('0x5c'))){var _0x563921=_0x5a4fed['applicationdata'][_0x366d('0x3b')]('=');var _0x20b216=_0x563921[0x0][_0x366d('0x50')]()[_0x366d('0x5d')](/cdr\((.*)\)/);if(_0x20b216){if(_0x20b216[0x1]===_0x366d('0x5e')&&!_[_0x366d('0x5f')](this[_0x366d('0x34')][_0x5a4fed[_0x366d('0x32')]][_0x20b216[0x1]]))return;this[_0x366d('0x34')][_0x5a4fed[_0x366d('0x32')]][_0x20b216[0x1]]=_0x563921[0x1];}}else if(_0x5a4fed[_0x366d('0x4f')]===_0x366d('0x7')){this[_0x366d('0x34')][_0x5a4fed[_0x366d('0x32')]][_0x366d('0x7')]=_0x5a4fed['applicationdata'][_0x366d('0x3b')](',')[0x0];}}}}}catch(_0x4f200d){logger[_0x366d('0x27')](_0x366d('0x60'),_0x5a4fed[_0x366d('0x32')],util[_0x366d('0x29')](_0x4f200d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x366d('0x2a')]['syncNewState']=function(_0x57333a){try{if(this[_0x366d('0x2d')](_0x57333a)){logger[_0x366d('0x24')](_0x366d('0x61'),_0x57333a['uniqueid'],_0x57333a[_0x366d('0x33')],_0x57333a[_0x366d('0x2f')],_0x57333a[_0x366d('0x30')]);logger[_0x366d('0x31')](_0x366d('0x62'),_0x57333a[_0x366d('0x32')],util[_0x366d('0x29')](_0x57333a,{'showHidden':![],'depth':null}));if(_0x57333a[_0x366d('0x4b')]!=='6')return;var _0x4cf7df=this['agents'][_0x57333a[_0x366d('0x3a')][_0x366d('0x3b')]('-')[0x0]];if(_0x57333a[_0x366d('0x32')]!==_0x57333a[_0x366d('0x33')]){var _0x51ca4d=moment();if(this[_0x366d('0x34')][_0x57333a[_0x366d('0x33')]]){if(!this['channels'][_0x57333a[_0x366d('0x33')]][_0x366d('0x63')]){this['channels'][_0x57333a[_0x366d('0x33')]][_0x366d('0x63')]=!![];this[_0x366d('0x34')][_0x57333a[_0x366d('0x33')]][_0x366d('0x64')]=_0x51ca4d[_0x366d('0x48')](_0x366d('0x57'));if(this['channels'][_0x57333a[_0x366d('0x33')]][_0x366d('0x47')]){this['channels'][_0x57333a[_0x366d('0x33')]]['holdtime']=_0x51ca4d[_0x366d('0x65')](this[_0x366d('0x34')][_0x57333a[_0x366d('0x33')]][_0x366d('0x47')],_0x366d('0x56'));}}this['channels'][_0x57333a['linkedid']][_0x366d('0x33')]=_0x57333a['uniqueid'];if(_0x57333a['calleridnum']!==_0x366d('0x3c')){this[_0x366d('0x34')][_0x57333a['linkedid']][_0x366d('0x3e')]=_0x57333a['calleridnum'];}this['channels'][_0x57333a[_0x366d('0x33')]][_0x366d('0x66')]=_0x57333a['calleridname'];this[_0x366d('0x34')][_0x57333a['linkedid']][_0x366d('0x67')]=_0x57333a[_0x366d('0x3a')];this[_0x366d('0x34')][_0x57333a[_0x366d('0x33')]][_0x366d('0x49')]=dispositions[_['toNumber'](_0x57333a[_0x366d('0x4b')])];if(_0x4cf7df){this['channels'][_0x57333a['linkedid']]['UserId']=_0x4cf7df['id'];this['channels'][_0x57333a[_0x366d('0x33')]][_0x366d('0x68')]=_0x4cf7df[_0x366d('0x40')];}}if(this[_0x366d('0x34')][_0x57333a[_0x366d('0x32')]]){if(!this[_0x366d('0x34')][_0x57333a['uniqueid']]['answered']){this[_0x366d('0x34')][_0x57333a['uniqueid']][_0x366d('0x63')]=!![];this['channels'][_0x57333a['uniqueid']][_0x366d('0x64')]=_0x51ca4d[_0x366d('0x48')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x366d('0x34')][_0x57333a['uniqueid']][_0x366d('0x47')]){this['channels'][_0x57333a[_0x366d('0x32')]][_0x366d('0x69')]=_0x51ca4d[_0x366d('0x65')](this[_0x366d('0x34')][_0x57333a[_0x366d('0x32')]]['starttime'],_0x366d('0x56'));}}if(_0x57333a[_0x366d('0x30')]!==_0x366d('0x3c')){this[_0x366d('0x34')][_0x57333a[_0x366d('0x32')]][_0x366d('0x3e')]=_0x57333a[_0x366d('0x30')];}this[_0x366d('0x34')][_0x57333a['uniqueid']][_0x366d('0x66')]=_0x57333a['calleridname'];this['channels'][_0x57333a['uniqueid']][_0x366d('0x67')]=_0x57333a['channel'];this[_0x366d('0x34')][_0x57333a[_0x366d('0x32')]][_0x366d('0x49')]=dispositions[_['toNumber'](_0x57333a[_0x366d('0x4b')])];}}else{if(this['channels'][_0x57333a[_0x366d('0x32')]]){if(_0x4cf7df){this[_0x366d('0x34')][_0x57333a[_0x366d('0x32')]][_0x366d('0x6a')]=_0x4cf7df['id'];this[_0x366d('0x34')][_0x57333a[_0x366d('0x32')]][_0x366d('0x68')]=_0x4cf7df['name'];}}}if(_0x57333a[_0x366d('0x37')]===_0x366d('0x38')){if(_0x4cf7df){_0x4cf7df[_0x366d('0x3d')]=_0x57333a[_0x366d('0x46')];var _0x3e869f;if(this[_0x366d('0x34')][_0x57333a['uniqueid']]){_0x3e869f=this['channels'][_0x57333a[_0x366d('0x32')]][_0x366d('0x7')];}else if(this[_0x366d('0x34')][_0x57333a[_0x366d('0x33')]]){_0x3e869f=this[_0x366d('0x34')][_0x57333a[_0x366d('0x33')]][_0x366d('0x7')];}_0x4cf7df[_0x366d('0x7')]=_0x3e869f;var _0x12e921={'id':_0x4cf7df['id'],'name':_0x4cf7df['name'],'agentconnected':!![],'destaccountcode':_0x4cf7df['accountcode'],'destconnectedlinenum':_0x57333a[_0x366d('0x46')],'queue':_0x3e869f||undefined,'uniqueid':_0x57333a[_0x366d('0x33')]};logger[_0x366d('0x31')](_0x366d('0x6b'),_0x57333a['uniqueid'],util['inspect'](_0x12e921,{'showHidden':![],'depth':null}));this[_0x366d('0x2c')](util['format'](_0x366d('0x3f'),_0x4cf7df[_0x366d('0x40')]),_0x366d('0x41'),_0x12e921);}}}}catch(_0x1bfcab){logger[_0x366d('0x27')]('[%s][voiceCallReport][newstate]',_0x57333a[_0x366d('0x32')],util[_0x366d('0x29')](_0x1bfcab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x366d('0x2a')][_0x366d('0x6c')]=function(_0x56bd8d,_0x1e169c){try{if(this[_0x366d('0x34')][_0x56bd8d]){logger[_0x366d('0x24')](_0x366d('0x6d'),_0x56bd8d,_0x1e169c);this[_0x366d('0x34')][_0x56bd8d]['monitor']=!![];if(_[_0x366d('0x6e')](_0x1e169c,'.wav49')){_0x1e169c=_0x1e169c[_0x366d('0x6f')](_0x366d('0x70'),'.WAV');}this['channels'][_0x56bd8d][_0x366d('0x71')]=_0x1e169c;var _0x5ec398=_[_0x366d('0x72')](this[_0x366d('0x34')][_0x56bd8d]['monitors'],{'filename':_0x1e169c});if(_[_0x366d('0x5f')](_0x5ec398)){this['channels'][_0x56bd8d][_0x366d('0x73')][_0x366d('0x74')]({'filename':_0x1e169c,'createdAt':moment()['format'](_0x366d('0x57')),'mixmonitorid':'','status':_0x366d('0x75')});}}}catch(_0x556d56){logger[_0x366d('0x27')](_0x366d('0x76'),_0x56bd8d,util['inspect'](_0x556d56,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x366d('0x2a')][_0x366d('0x1c')]=function(_0x236b80){try{if(this['isNotNull'](_0x236b80)){logger[_0x366d('0x31')]('[%s][voiceCallReport][varset]\x20event:',_0x236b80['uniqueid'],util[_0x366d('0x29')](_0x236b80,{'showHidden':![],'depth':null}));if(this['channels'][_0x236b80[_0x366d('0x32')]]&&_0x236b80[_0x366d('0x3a')]!=_0x366d('0x44')){if(this[_0x366d('0x2d')](_0x236b80[_0x366d('0x77')])){if(this['isNotNull'](_0x236b80[_0x366d('0x77')]['mixmonitor_filename'])){logger['info'](_0x366d('0x78'),_0x236b80[_0x366d('0x32')],_0x236b80['value']);this[_0x366d('0x6c')](_0x236b80[_0x366d('0x32')],_0x236b80[_0x366d('0x79')]);}else if(this[_0x366d('0x2d')](_0x236b80[_0x366d('0x77')][_0x366d('0x7a')])){logger[_0x366d('0x24')](_0x366d('0x7b'),_0x236b80[_0x366d('0x32')],_0x236b80[_0x366d('0x79')]);this['channels'][_0x236b80['uniqueid']]['calleridnum']=_0x236b80[_0x366d('0x79')];}else if(this['isNotNull'](_0x236b80[_0x366d('0x77')][_0x366d('0x7c')])){logger[_0x366d('0x24')](_0x366d('0x7d'),_0x236b80['uniqueid'],_0x236b80[_0x366d('0x79')]);this[_0x366d('0x34')][_0x236b80[_0x366d('0x32')]][_0x366d('0x7e')]=_0x236b80[_0x366d('0x79')];}else if(this[_0x366d('0x2d')](_0x236b80['variable']['xmd-cdrtype'])){logger[_0x366d('0x24')](_0x366d('0x7f'),_0x236b80[_0x366d('0x32')],_0x236b80[_0x366d('0x79')]);this[_0x366d('0x34')][_0x236b80[_0x366d('0x32')]][_0x366d('0x5e')]=_0x236b80['value'];}else if(this['isNotNull'](_0x236b80[_0x366d('0x77')][_0x366d('0x80')])){logger[_0x366d('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x236b80[_0x366d('0x32')],_0x236b80['value']['split'](',')[0x0]);this['channels'][_0x236b80[_0x366d('0x32')]][_0x366d('0x7')]=_0x236b80['value'][_0x366d('0x3b')](',')[0x0];}else if(this[_0x366d('0x2d')](_0x236b80['variable']['xmd-originatecalleridnum'])){logger['info'](_0x366d('0x81'),_0x236b80[_0x366d('0x32')],_0x236b80[_0x366d('0x79')]);this[_0x366d('0x34')][_0x236b80[_0x366d('0x32')]][_0x366d('0x82')]=_0x236b80[_0x366d('0x79')];}else if(this[_0x366d('0x2d')](_0x236b80[_0x366d('0x77')]['xmd-destination'])){logger['info'](_0x366d('0x83'),_0x236b80[_0x366d('0x32')],_0x236b80[_0x366d('0x79')]);this[_0x366d('0x34')][_0x236b80[_0x366d('0x32')]][_0x366d('0x84')]=_0x236b80[_0x366d('0x79')];}else if(this[_0x366d('0x2d')](_0x236b80[_0x366d('0x77')][_0x366d('0x85')])){logger[_0x366d('0x24')](_0x366d('0x86'),_0x236b80[_0x366d('0x32')],_0x236b80[_0x366d('0x79')]);this[_0x366d('0x34')][_0x236b80[_0x366d('0x32')]][_0x366d('0x87')]=_0x236b80[_0x366d('0x79')];}else if(this[_0x366d('0x2d')](_0x236b80['variable'][_0x366d('0x88')])){logger[_0x366d('0x24')](_0x366d('0x89'),_0x236b80[_0x366d('0x32')],_0x236b80[_0x366d('0x79')]);this[_0x366d('0x34')][_0x236b80['uniqueid']][_0x366d('0x7')]=_0x236b80[_0x366d('0x79')];}else if(this['isNotNull'](_0x236b80[_0x366d('0x77')][_0x366d('0x8a')])){logger[_0x366d('0x24')](_0x366d('0x8b'),_0x236b80[_0x366d('0x32')],_0x236b80['value']);this['channels'][_0x236b80['uniqueid']][_0x366d('0x8c')]=_0x236b80['value'];}}}else if(this[_0x366d('0x2d')](_0x236b80['variable'][_0x366d('0x8d')])){if(_0x236b80[_0x366d('0x79')]){var _0xd91d08=path[_0x366d('0x8e')](_0x236b80[_0x366d('0x79')])[_0x366d('0x40')];logger[_0x366d('0x24')](_0x366d('0x78'),_0xd91d08,_0x236b80[_0x366d('0x79')]);this[_0x366d('0x6c')](_0xd91d08,_0x236b80[_0x366d('0x79')]);}}else if(this['channels'][_0x236b80[_0x366d('0x33')]]){if(this[_0x366d('0x2d')](_0x236b80[_0x366d('0x77')])){if(this[_0x366d('0x2d')](_0x236b80['variable'][_0x366d('0x8a')])){logger[_0x366d('0x24')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x236b80[_0x366d('0x33')],_0x236b80[_0x366d('0x79')]);this[_0x366d('0x34')][_0x236b80[_0x366d('0x33')]][_0x366d('0x8f')]=_0x236b80['value'];}}}}}catch(_0x1571b4){logger[_0x366d('0x27')](_0x366d('0x90'),_0x236b80[_0x366d('0x32')],util[_0x366d('0x29')](_0x1571b4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x366d('0x2a')][_0x366d('0x1e')]=function(_0x36c8b6){try{if(this['isNotNull'](_0x36c8b6)){logger[_0x366d('0x31')](_0x366d('0x91'),_0x36c8b6[_0x366d('0x32')],util['inspect'](_0x36c8b6,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x36c8b6[_0x366d('0x33')]]){if(this[_0x366d('0x34')][this['blindTransfers'][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x33')]]){this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x33')]][_0x366d('0x32')]=_0x36c8b6[_0x366d('0x32')];this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x33')]]['answered']=this['channels'][_0x36c8b6[_0x366d('0x32')]][_0x366d('0x63')];this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x33')]]['answertime']=this[_0x366d('0x34')][_0x36c8b6[_0x366d('0x32')]][_0x366d('0x64')];this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x33')]][_0x366d('0x67')]=this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x33')]][_0x366d('0x3a')];this[_0x366d('0x34')][this['blindTransfers'][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x33')]][_0x366d('0x49')]=this[_0x366d('0x34')][_0x36c8b6['uniqueid']][_0x366d('0x49')];this['channels'][_0x36c8b6[_0x366d('0x32')]]=this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6['linkedid']][_0x366d('0x33')]];this[_0x366d('0x92')](this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x33')]);}else if(this['channels'][this[_0x366d('0x14')][_0x36c8b6['linkedid']][_0x366d('0x32')]]){this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x32')]]['uniqueid']=[this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x32')]]['linkedid'],this['channels'][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x32')]]['linkedid']=this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x32')]][_0x366d('0x32')]][0x0];this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x32')]]['answered']=this[_0x366d('0x34')][_0x36c8b6[_0x366d('0x32')]][_0x366d('0x63')];this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x32')]][_0x366d('0x64')]=this[_0x366d('0x34')][_0x36c8b6[_0x366d('0x32')]]['answertime'];this[_0x366d('0x34')][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x32')]][_0x366d('0x67')]=this[_0x366d('0x34')][this['blindTransfers'][_0x36c8b6['linkedid']][_0x366d('0x32')]][_0x366d('0x3a')];this['channels'][this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]]['uniqueid']][_0x366d('0x49')]=this['channels'][_0x36c8b6[_0x366d('0x32')]][_0x366d('0x49')];this[_0x366d('0x34')][_0x36c8b6['uniqueid']]=this[_0x366d('0x34')][this['blindTransfers'][_0x36c8b6['linkedid']]['uniqueid']];this[_0x366d('0x92')](this[_0x366d('0x14')][_0x36c8b6[_0x366d('0x33')]][_0x366d('0x32')]);}}if(this[_0x366d('0x34')][_0x36c8b6[_0x366d('0x32')]]){logger[_0x366d('0x24')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x36c8b6[_0x366d('0x32')],_0x36c8b6['cause-txt']);var _0x230528=moment();this[_0x366d('0x34')][_0x36c8b6[_0x366d('0x32')]]['endtime']=_0x230528['format'](_0x366d('0x57'));this[_0x366d('0x34')][_0x36c8b6[_0x366d('0x32')]][_0x366d('0x54')]=_0x230528['diff'](this[_0x366d('0x34')][_0x36c8b6['uniqueid']][_0x366d('0x47')],_0x366d('0x56'));if(this[_0x366d('0x34')][_0x36c8b6[_0x366d('0x32')]]['answered']){this[_0x366d('0x34')][_0x36c8b6[_0x366d('0x32')]][_0x366d('0x93')]=_0x230528[_0x366d('0x65')](this[_0x366d('0x34')][_0x36c8b6[_0x366d('0x32')]][_0x366d('0x64')],_0x366d('0x56'));this['channels'][_0x36c8b6[_0x366d('0x32')]][_0x366d('0x69')]=this[_0x366d('0x34')][_0x36c8b6[_0x366d('0x32')]][_0x366d('0x54')]-this[_0x366d('0x34')][_0x36c8b6[_0x366d('0x32')]][_0x366d('0x93')];}if(_0x36c8b6[_0x366d('0x37')]===_0x366d('0x38')){if(this[_0x366d('0x39')][_0x36c8b6['channel'][_0x366d('0x3b')]('-')[0x0]]){this[_0x366d('0x39')][_0x36c8b6[_0x366d('0x3a')][_0x366d('0x3b')]('-')[0x0]]=_[_0x366d('0x94')](this[_0x366d('0x39')][_0x36c8b6[_0x366d('0x3a')]['split']('-')[0x0]],[_0x366d('0x3d')]);logger['debug'](_0x366d('0x95'),_0x36c8b6[_0x366d('0x32')],util[_0x366d('0x29')]({'id':this[_0x366d('0x39')][_0x36c8b6[_0x366d('0x3a')][_0x366d('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x366d('0x39')][_0x36c8b6[_0x366d('0x3a')][_0x366d('0x3b')]('-')[0x0]][_0x366d('0x42')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x366d('0x48')](_0x366d('0x3f'),this[_0x366d('0x39')][_0x36c8b6[_0x366d('0x3a')][_0x366d('0x3b')]('-')[0x0]]['name']),_0x366d('0x96'),{'id':this[_0x366d('0x39')][_0x36c8b6[_0x366d('0x3a')][_0x366d('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x366d('0x39')][_0x36c8b6[_0x366d('0x3a')][_0x366d('0x3b')]('-')[0x0]][_0x366d('0x42')]});for(var _0x372474=0x0;_0x372474{delete this[_0x366d('0x34')][_0x420b1d];},_0x3332a5);}};module[_0x366d('0xbf')]=VoiceCallReport; \ No newline at end of file +var _0xae21=['routeid','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohstarttime','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','../rpc/setting','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','socket.io-emitter','redis','channels','coreshowchannel','bind','newexten','varset','syncVarSet','syncHangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','linkedid','merge','pick','keys','context','agents','channel','split','xcally-motion-preview','destconnectedlinenum','connectedlinenum','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','format','toNumber','channelstate','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','syncNewExten','[%s][voiceCallReport][newexten]\x20event:','blindTransfers','application','toLowerCase','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','subtract','duration','seconds','disposition','includes','lastapplication','lastdata','cdr(','match','type','isNil','queue','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20event:','answertime','YYYY-MM-DD\x20HH:mm:ss','holdtime','diff','calleridname','destinationchannel','UserId','membername','name','answered','connectedlinename','from-sip','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-callerid','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','resolve','then','transferToInternal','stopRecordingOnTransfer','StopMixMonitor','catch','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfereeuniqueid','ATTENDED','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','transferType'];(function(_0x4acd4c,_0x55bd71){var _0x74edd6=function(_0x56bcb5){while(--_0x56bcb5){_0x4acd4c['push'](_0x4acd4c['shift']());}};_0x74edd6(++_0x55bd71);}(_0xae21,0x196));var _0x1ae2=function(_0x4ffc0f,_0x1dd900){_0x4ffc0f=_0x4ffc0f-0x0;var _0x1ea40d=_0xae21[_0x4ffc0f];return _0x1ea40d;};'use strict';var _=require(_0x1ae2('0x0'));var moment=require(_0x1ae2('0x1'));var util=require(_0x1ae2('0x2'));var path=require('path');var Redis=require(_0x1ae2('0x3'));var config=require(_0x1ae2('0x4'));var logger=require(_0x1ae2('0x5'))('ami');var ami=require(_0x1ae2('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0x1ae2('0x7'));var applications=[_0x1ae2('0x8'),'queue',_0x1ae2('0x9'),_0x1ae2('0xa'),_0x1ae2('0xb'),_0x1ae2('0xc')];var dispositions=[_0x1ae2('0xd'),_0x1ae2('0xe'),_0x1ae2('0xe'),_0x1ae2('0xd'),_0x1ae2('0xd'),_0x1ae2('0xd'),_0x1ae2('0xf'),_0x1ae2('0x10'),_0x1ae2('0xe'),_0x1ae2('0xe'),_0x1ae2('0xe')];config['redis']=_[_0x1ae2('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1ae2('0x12'))(new Redis(config[_0x1ae2('0x13')]));function VoiceCallReport(_0x3d654d){this['channels']=_0x3d654d[_0x1ae2('0x14')];this['agents']=_0x3d654d['agents'];this['blindTransfers']={};ami['on'](_0x1ae2('0x15'),this['syncNewExten'][_0x1ae2('0x16')](this));ami['on'](_0x1ae2('0x17'),this['syncNewExten']['bind'](this));ami['on']('newchannel',this['syncNewChannel'][_0x1ae2('0x16')](this));ami['on']('newstate',this['syncNewState'][_0x1ae2('0x16')](this));ami['on'](_0x1ae2('0x18'),this[_0x1ae2('0x19')][_0x1ae2('0x16')](this));ami['on']('hangup',this[_0x1ae2('0x1a')][_0x1ae2('0x16')](this));ami['on']('newcallerid',this[_0x1ae2('0x1b')][_0x1ae2('0x16')](this));ami['on']('attendedtransfer',this[_0x1ae2('0x1c')][_0x1ae2('0x16')](this));ami['on'](_0x1ae2('0x1d'),this[_0x1ae2('0x1e')][_0x1ae2('0x16')](this));ami['on'](_0x1ae2('0x1f'),this['syncMusicOnHoldStart'][_0x1ae2('0x16')](this));ami['on'](_0x1ae2('0x20'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x1ae2('0x21')](_0x1ae2('0x22'));ami[_0x1ae2('0x23')]();}catch(_0x5cd453){logger[_0x1ae2('0x24')](_0x1ae2('0x25'),util[_0x1ae2('0x26')](_0x5cd453,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x28')]=function(_0xdfbab7){return _0xdfbab7!==null&&!_[_0x1ae2('0x29')](_0xdfbab7);};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x2a')]=function(_0x27374a,_0x3c8aed,_0x4ad414){io['to'](_0x27374a)[_0x1ae2('0x2a')](_0x3c8aed,_0x4ad414);};VoiceCallReport[_0x1ae2('0x27')]['syncNewCallerId']=function(_0xef4d1){try{if(this[_0x1ae2('0x28')](_0xef4d1)){logger['info'](_0x1ae2('0x2b'),_0xef4d1[_0x1ae2('0x2c')],_0xef4d1['calleridname'],_0xef4d1[_0x1ae2('0x2d')]);logger[_0x1ae2('0x2e')]('[%s][voiceCallReport][newcallerid]\x20event:',_0xef4d1[_0x1ae2('0x2c')],util['inspect'](_0xef4d1,{'showHidden':![],'depth':null}));if(_0xef4d1[_0x1ae2('0x2c')]===_0xef4d1[_0x1ae2('0x2f')]){if(!_[_0x1ae2('0x29')](this[_0x1ae2('0x14')][_0xef4d1[_0x1ae2('0x2c')]])){_[_0x1ae2('0x30')](this[_0x1ae2('0x14')][_0xef4d1['uniqueid']],_[_0x1ae2('0x31')](_0xef4d1,_[_0x1ae2('0x32')](this['channels'][_0xef4d1[_0x1ae2('0x2c')]])));}}if(_0xef4d1[_0x1ae2('0x33')]==='from-sip'){var _0x3b6853=this[_0x1ae2('0x34')][_0xef4d1[_0x1ae2('0x35')][_0x1ae2('0x36')]('-')[0x0]];if(_0x3b6853){if(_0xef4d1['exten']==_0x1ae2('0x37')){_0x3b6853[_0x1ae2('0x38')]=_0xef4d1[_0x1ae2('0x39')];this[_0x1ae2('0x2a')](util['format']('user:%s',_0x3b6853['name']),_0x1ae2('0x3a'),{'id':_0x3b6853['id'],'destaccountcode':_0x3b6853[_0x1ae2('0x3b')],'destconnectedlinenum':_0xef4d1[_0x1ae2('0x39')]});}}}}}catch(_0x3787b6){logger['error'](_0x1ae2('0x3c'),_0xef4d1[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x3787b6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x3d')]=function(_0x2ed081){try{if(this[_0x1ae2('0x28')](_0x2ed081)){logger[_0x1ae2('0x2e')](_0x1ae2('0x3e'),_0x2ed081[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x2ed081,{'showHidden':![],'depth':null}));if(this[_0x1ae2('0x14')][_0x2ed081[_0x1ae2('0x2c')]]){return;}if(_0x2ed081['channel']===_0x1ae2('0x3f')){return;}if(_0x2ed081[_0x1ae2('0x2c')]!==_0x2ed081[_0x1ae2('0x2f')]&&!this['blindTransfers'][_0x2ed081['linkedid']]){return;}logger[_0x1ae2('0x21')](_0x1ae2('0x40'),_0x2ed081[_0x1ae2('0x2c')],_0x2ed081[_0x1ae2('0x33')],_0x2ed081[_0x1ae2('0x41')]);this[_0x1ae2('0x14')][_0x2ed081[_0x1ae2('0x2c')]]=new Channel();this[_0x1ae2('0x14')][_0x2ed081['uniqueid']][_0x1ae2('0x42')]=moment()[_0x1ae2('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ae2('0x14')][_0x2ed081['uniqueid']]['disposition']=dispositions[_[_0x1ae2('0x44')](_0x2ed081[_0x1ae2('0x45')])];_[_0x1ae2('0x30')](this[_0x1ae2('0x14')][_0x2ed081['uniqueid']],_[_0x1ae2('0x31')](_0x2ed081,_[_0x1ae2('0x32')](this[_0x1ae2('0x14')][_0x2ed081[_0x1ae2('0x2c')]])));if(_0x2ed081[_0x1ae2('0x33')]==='from-sip'){var _0x10bb78=this[_0x1ae2('0x34')][_0x2ed081[_0x1ae2('0x35')]['split']('-')[0x0]];if(_0x10bb78&&typeof _0x10bb78[_0x1ae2('0x38')]===_0x1ae2('0x46')){_0x10bb78['destconnectedlinenum']=_0x2ed081[_0x1ae2('0x41')];logger['debug'](_0x1ae2('0x47'),_0x2ed081[_0x1ae2('0x2c')],util['inspect']({'id':_0x10bb78['id'],'destaccountcode':_0x10bb78['accountcode'],'destconnectedlinenum':_0x2ed081[_0x1ae2('0x41')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x1ae2('0x43')]('user:%s',_0x10bb78['name']),'user:agentconnect',{'id':_0x10bb78['id'],'destaccountcode':_0x10bb78[_0x1ae2('0x3b')],'destconnectedlinenum':_0x2ed081[_0x1ae2('0x41')]});}}}}catch(_0x546b4f){logger[_0x1ae2('0x24')](_0x1ae2('0x48'),_0x2ed081[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x546b4f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x49')]=function(_0x4dbf6c){try{if(this[_0x1ae2('0x28')](_0x4dbf6c)){logger[_0x1ae2('0x2e')](_0x1ae2('0x4a'),_0x4dbf6c[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x4dbf6c,{'showHidden':![],'depth':null}));if(_0x4dbf6c['channel']===_0x1ae2('0x3f')||_0x4dbf6c['exten']==='h')return;if(_0x4dbf6c['uniqueid']===_0x4dbf6c[_0x1ae2('0x2f')]||this[_0x1ae2('0x4b')][_0x4dbf6c['linkedid']]){_0x4dbf6c[_0x1ae2('0x4c')]=_0x4dbf6c[_0x1ae2('0x4c')]?_0x4dbf6c['application'][_0x1ae2('0x4d')]():undefined;_0x4dbf6c['applicationdata']=_0x4dbf6c[_0x1ae2('0x4e')]||_0x4dbf6c['applicationdata'];if(_0x4dbf6c[_0x1ae2('0x4e')]&&_0x4dbf6c[_0x1ae2('0x4c')]!=='queue'){_0x4dbf6c['applicationdata']=_0x4dbf6c['applicationdata'][_0x1ae2('0x4d')]();}logger[_0x1ae2('0x21')](_0x1ae2('0x4f'),_0x4dbf6c[_0x1ae2('0x2c')],_0x4dbf6c['application'],_0x4dbf6c[_0x1ae2('0x50')]);if(_['isUndefined'](this['channels'][_0x4dbf6c['uniqueid']])){this['channels'][_0x4dbf6c[_0x1ae2('0x2c')]]=new Channel();this['channels'][_0x4dbf6c[_0x1ae2('0x2c')]][_0x1ae2('0x42')]=_0x4dbf6c['duration']?moment()[_0x1ae2('0x51')](moment[_0x1ae2('0x52')](_0x4dbf6c[_0x1ae2('0x52')])[_0x1ae2('0x53')](),_0x1ae2('0x53'))[_0x1ae2('0x43')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ae2('0x14')][_0x4dbf6c[_0x1ae2('0x2c')]][_0x1ae2('0x54')]='NO\x20ANSWER';}_[_0x1ae2('0x30')](this['channels'][_0x4dbf6c['uniqueid']],_[_0x1ae2('0x31')](_0x4dbf6c,_[_0x1ae2('0x32')](this[_0x1ae2('0x14')][_0x4dbf6c['uniqueid']])));if(_[_0x1ae2('0x55')](applications,_0x4dbf6c['application'])){this[_0x1ae2('0x14')][_0x4dbf6c['uniqueid']][_0x1ae2('0x56')]=_0x4dbf6c[_0x1ae2('0x4c')];this['channels'][_0x4dbf6c[_0x1ae2('0x2c')]][_0x1ae2('0x57')]=_0x4dbf6c[_0x1ae2('0x50')];if(_0x4dbf6c['application']===_0x1ae2('0x8')&&_['startsWith'](_0x4dbf6c[_0x1ae2('0x50')][_0x1ae2('0x4d')](),_0x1ae2('0x58'))){var _0x401820=_0x4dbf6c[_0x1ae2('0x50')]['split']('=');var _0x3d338d=_0x401820[0x0][_0x1ae2('0x4d')]()[_0x1ae2('0x59')](/cdr\((.*)\)/);if(_0x3d338d){if(_0x3d338d[0x1]===_0x1ae2('0x5a')&&!_[_0x1ae2('0x5b')](this[_0x1ae2('0x14')][_0x4dbf6c['uniqueid']][_0x3d338d[0x1]]))return;this[_0x1ae2('0x14')][_0x4dbf6c[_0x1ae2('0x2c')]][_0x3d338d[0x1]]=_0x401820[0x1];}}else if(_0x4dbf6c[_0x1ae2('0x4c')]==='queue'){this['channels'][_0x4dbf6c[_0x1ae2('0x2c')]][_0x1ae2('0x5c')]=_0x4dbf6c[_0x1ae2('0x50')]['split'](',')[0x0];}}}}}catch(_0x18045b){logger[_0x1ae2('0x24')](_0x1ae2('0x5d'),_0x4dbf6c[_0x1ae2('0x2c')],util['inspect'](_0x18045b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x5e')]=function(_0x22a4fa){try{if(this[_0x1ae2('0x28')](_0x22a4fa)){logger[_0x1ae2('0x21')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x22a4fa[_0x1ae2('0x2c')],_0x22a4fa['linkedid'],_0x22a4fa['calleridname'],_0x22a4fa[_0x1ae2('0x2d')]);logger['debug'](_0x1ae2('0x5f'),_0x22a4fa[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x22a4fa,{'showHidden':![],'depth':null}));if(_0x22a4fa[_0x1ae2('0x45')]!=='6')return;var _0x10407b=this[_0x1ae2('0x34')][_0x22a4fa[_0x1ae2('0x35')]['split']('-')[0x0]];if(_0x22a4fa[_0x1ae2('0x2c')]!==_0x22a4fa[_0x1ae2('0x2f')]){var _0xe1e991=moment();if(this[_0x1ae2('0x14')][_0x22a4fa['linkedid']]){if(!this[_0x1ae2('0x14')][_0x22a4fa['linkedid']]['answered']){this[_0x1ae2('0x14')][_0x22a4fa['linkedid']]['answered']=!![];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x60')]=_0xe1e991[_0x1ae2('0x43')](_0x1ae2('0x61'));if(this['channels'][_0x22a4fa[_0x1ae2('0x2f')]]['starttime']){this['channels'][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x62')]=_0xe1e991[_0x1ae2('0x63')](this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]]['starttime'],'seconds');}}this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x2f')]=_0x22a4fa[_0x1ae2('0x2c')];if(_0x22a4fa['calleridnum']!=='xcally-motion-preview'){this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]]['connectedlinenum']=_0x22a4fa[_0x1ae2('0x2d')];}this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]]['connectedlinename']=_0x22a4fa[_0x1ae2('0x64')];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x65')]=_0x22a4fa['channel'];this['channels'][_0x22a4fa['linkedid']][_0x1ae2('0x54')]=dispositions[_['toNumber'](_0x22a4fa[_0x1ae2('0x45')])];if(_0x10407b){this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x66')]=_0x10407b['id'];this[_0x1ae2('0x14')][_0x22a4fa['linkedid']][_0x1ae2('0x67')]=_0x10407b[_0x1ae2('0x68')];}}if(this['channels'][_0x22a4fa[_0x1ae2('0x2c')]]){if(!this['channels'][_0x22a4fa['uniqueid']][_0x1ae2('0x69')]){this['channels'][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x69')]=!![];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x60')]=_0xe1e991[_0x1ae2('0x43')](_0x1ae2('0x61'));if(this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x42')]){this['channels'][_0x22a4fa[_0x1ae2('0x2c')]]['holdtime']=_0xe1e991[_0x1ae2('0x63')](this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]]['starttime'],_0x1ae2('0x53'));}}if(_0x22a4fa['calleridnum']!==_0x1ae2('0x37')){this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x39')]=_0x22a4fa[_0x1ae2('0x2d')];}this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x6a')]=_0x22a4fa[_0x1ae2('0x64')];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x65')]=_0x22a4fa['channel'];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x54')]=dispositions[_[_0x1ae2('0x44')](_0x22a4fa[_0x1ae2('0x45')])];}}else{if(this[_0x1ae2('0x14')][_0x22a4fa['uniqueid']]){if(_0x10407b){this['channels'][_0x22a4fa[_0x1ae2('0x2c')]]['UserId']=_0x10407b['id'];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x67')]=_0x10407b[_0x1ae2('0x68')];}}}if(_0x22a4fa[_0x1ae2('0x33')]===_0x1ae2('0x6b')){if(_0x10407b){_0x10407b[_0x1ae2('0x38')]=_0x22a4fa[_0x1ae2('0x41')];var _0x2e19f0;if(this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]]){_0x2e19f0=this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]]['queue'];}else if(this[_0x1ae2('0x14')][_0x22a4fa['linkedid']]){_0x2e19f0=this['channels'][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x5c')];}_0x10407b[_0x1ae2('0x5c')]=_0x2e19f0;var _0x348ea3={'id':_0x10407b['id'],'name':_0x10407b['name'],'agentconnected':!![],'destaccountcode':_0x10407b[_0x1ae2('0x3b')],'destconnectedlinenum':_0x22a4fa['exten'],'queue':_0x2e19f0||undefined,'uniqueid':_0x22a4fa[_0x1ae2('0x2f')]};logger['debug'](_0x1ae2('0x6c'),_0x22a4fa[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x348ea3,{'showHidden':![],'depth':null}));this[_0x1ae2('0x2a')](util['format'](_0x1ae2('0x6d'),_0x10407b[_0x1ae2('0x68')]),_0x1ae2('0x3a'),_0x348ea3);}}}}catch(_0x393879){logger[_0x1ae2('0x24')](_0x1ae2('0x6e'),_0x22a4fa[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x393879,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x6f')]=function(_0x17ce3b,_0x4c4ecf){try{if(this[_0x1ae2('0x14')][_0x17ce3b]){logger['info'](_0x1ae2('0x70'),_0x17ce3b,_0x4c4ecf);this['channels'][_0x17ce3b][_0x1ae2('0x71')]=!![];if(_['endsWith'](_0x4c4ecf,_0x1ae2('0x72'))){_0x4c4ecf=_0x4c4ecf[_0x1ae2('0x73')](_0x1ae2('0x72'),_0x1ae2('0x74'));}this[_0x1ae2('0x14')][_0x17ce3b][_0x1ae2('0x75')]=_0x4c4ecf;var _0x4e9716=_['find'](this[_0x1ae2('0x14')][_0x17ce3b][_0x1ae2('0x76')],{'filename':_0x4c4ecf});if(_['isNil'](_0x4e9716)){this[_0x1ae2('0x14')][_0x17ce3b][_0x1ae2('0x76')]['push']({'filename':_0x4c4ecf,'createdAt':moment()[_0x1ae2('0x43')](_0x1ae2('0x61')),'mixmonitorid':'','status':_0x1ae2('0x77')});}}}catch(_0x121b69){logger[_0x1ae2('0x24')](_0x1ae2('0x78'),_0x17ce3b,util[_0x1ae2('0x26')](_0x121b69,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')]['syncVarSet']=function(_0x52f8f6){try{if(this[_0x1ae2('0x28')](_0x52f8f6)){logger[_0x1ae2('0x2e')]('[%s][voiceCallReport][varset]\x20event:',_0x52f8f6['uniqueid'],util['inspect'](_0x52f8f6,{'showHidden':![],'depth':null}));if(this['channels'][_0x52f8f6['uniqueid']]&&_0x52f8f6[_0x1ae2('0x35')]!=_0x1ae2('0x3f')){if(this['isNotNull'](_0x52f8f6[_0x1ae2('0x79')])){if(this[_0x1ae2('0x28')](_0x52f8f6['variable']['mixmonitor_filename'])){logger['info'](_0x1ae2('0x7a'),_0x52f8f6['uniqueid'],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x6f')](_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6[_0x1ae2('0x7b')]);}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['xmd-phone'])){logger[_0x1ae2('0x21')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x52f8f6['uniqueid'],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6['uniqueid']][_0x1ae2('0x2d')]=_0x52f8f6[_0x1ae2('0x7b')];}else if(this[_0x1ae2('0x28')](_0x52f8f6['variable'][_0x1ae2('0x7c')])){logger[_0x1ae2('0x21')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x52f8f6['uniqueid'],_0x52f8f6[_0x1ae2('0x7b')]);this['channels'][_0x52f8f6[_0x1ae2('0x2c')]]['callerid']=_0x52f8f6[_0x1ae2('0x7b')];}else if(this['isNotNull'](_0x52f8f6[_0x1ae2('0x79')]['xmd-cdrtype'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]]['type']=_0x52f8f6[_0x1ae2('0x7b')];}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['xmd-queue'])){logger[_0x1ae2('0x21')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x52f8f6['uniqueid'],_0x52f8f6[_0x1ae2('0x7b')]['split'](',')[0x0]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]][_0x1ae2('0x5c')]=_0x52f8f6['value']['split'](',')[0x0];}else if(this[_0x1ae2('0x28')](_0x52f8f6['variable'][_0x1ae2('0x7d')])){logger['info'](_0x1ae2('0x7e'),_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]][_0x1ae2('0x7f')]=_0x52f8f6[_0x1ae2('0x7b')];}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['xmd-destination'])){logger[_0x1ae2('0x21')](_0x1ae2('0x80'),_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6['value']);this[_0x1ae2('0x14')][_0x52f8f6['uniqueid']][_0x1ae2('0x81')]=_0x52f8f6[_0x1ae2('0x7b')];}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['xmd-callerid-preview'])){logger[_0x1ae2('0x21')](_0x1ae2('0x82'),_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]][_0x1ae2('0x83')]=_0x52f8f6[_0x1ae2('0x7b')];}else if(this['isNotNull'](_0x52f8f6[_0x1ae2('0x79')][_0x1ae2('0x84')])){logger['info'](_0x1ae2('0x85'),_0x52f8f6['uniqueid'],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]]['queue']=_0x52f8f6[_0x1ae2('0x7b')];}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['sipcallid'])){logger[_0x1ae2('0x21')](_0x1ae2('0x86'),_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]][_0x1ae2('0x87')]=_0x52f8f6['value'];}}}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['mixmonitor_filename'])){if(_0x52f8f6[_0x1ae2('0x7b')]){var _0x57c3f0=path[_0x1ae2('0x88')](_0x52f8f6['value'])[_0x1ae2('0x68')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x57c3f0,_0x52f8f6['value']);this['syncMixMonitorFilename'](_0x57c3f0,_0x52f8f6[_0x1ae2('0x7b')]);}}else if(this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2f')]]){if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')])){if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')][_0x1ae2('0x89')])){logger[_0x1ae2('0x21')](_0x1ae2('0x86'),_0x52f8f6['linkedid'],_0x52f8f6['value']);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2f')]][_0x1ae2('0x8a')]=_0x52f8f6[_0x1ae2('0x7b')];}}}}}catch(_0xd67400){logger[_0x1ae2('0x24')](_0x1ae2('0x8b'),_0x52f8f6[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0xd67400,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x1a')]=function(_0xd4fbf3){try{if(this[_0x1ae2('0x28')](_0xd4fbf3)){logger[_0x1ae2('0x2e')](_0x1ae2('0x8c'),_0xd4fbf3[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0xd4fbf3,{'showHidden':![],'depth':null}));if(this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]){if(this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']][_0x1ae2('0x2f')]]){this[_0x1ae2('0x14')][this['blindTransfers'][_0xd4fbf3['linkedid']]['linkedid']]['uniqueid']=_0xd4fbf3[_0x1ae2('0x2c')];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['linkedid']][_0x1ae2('0x69')]=this[_0x1ae2('0x14')][_0xd4fbf3['uniqueid']][_0x1ae2('0x69')];this['channels'][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']][_0x1ae2('0x2f')]][_0x1ae2('0x60')]=this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x60')];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2f')]]['destinationchannel']=this['channels'][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2f')]]['channel'];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['linkedid']][_0x1ae2('0x54')]=this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x54')];this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]]=this['channels'][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']]['linkedid']];this[_0x1ae2('0x8d')](this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2f')]);}else if(this[_0x1ae2('0x14')][this['blindTransfers'][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2c')]]){this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']][_0x1ae2('0x2c')]][_0x1ae2('0x2c')]=[this['channels'][this['blindTransfers'][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2c')]][_0x1ae2('0x2f')],this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']][_0x1ae2('0x2c')]][_0x1ae2('0x2f')]=this['channels'][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2c')]][_0x1ae2('0x2c')]][0x0];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['uniqueid']][_0x1ae2('0x69')]=this['channels'][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x69')];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2c')]][_0x1ae2('0x60')]=this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x60')];this['channels'][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['uniqueid']][_0x1ae2('0x65')]=this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']]['uniqueid']]['channel'];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['uniqueid']][_0x1ae2('0x54')]=this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x54')];this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]]=this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2c')]];this[_0x1ae2('0x8d')](this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['uniqueid']);}}if(this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]]){logger[_0x1ae2('0x21')](_0x1ae2('0x8e'),_0xd4fbf3[_0x1ae2('0x2c')],_0xd4fbf3['cause-txt']);var _0x19aa82=moment();this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x8f')]=_0x19aa82['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ae2('0x14')][_0xd4fbf3['uniqueid']][_0x1ae2('0x52')]=_0x19aa82['diff'](this['channels'][_0xd4fbf3[_0x1ae2('0x2c')]]['starttime'],_0x1ae2('0x53'));if(this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x69')]){this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x90')]=_0x19aa82[_0x1ae2('0x63')](this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]]['answertime'],_0x1ae2('0x53'));this['channels'][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x62')]=this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]]['duration']-this['channels'][_0xd4fbf3['uniqueid']][_0x1ae2('0x90')];}if(_0xd4fbf3['context']===_0x1ae2('0x6b')){if(this[_0x1ae2('0x34')][_0xd4fbf3[_0x1ae2('0x35')]['split']('-')[0x0]]){this['agents'][_0xd4fbf3[_0x1ae2('0x35')]['split']('-')[0x0]]=_[_0x1ae2('0x91')](this[_0x1ae2('0x34')][_0xd4fbf3[_0x1ae2('0x35')][_0x1ae2('0x36')]('-')[0x0]],[_0x1ae2('0x38')]);logger[_0x1ae2('0x2e')](_0x1ae2('0x92'),_0xd4fbf3[_0x1ae2('0x2c')],util[_0x1ae2('0x26')]({'id':this[_0x1ae2('0x34')][_0xd4fbf3['channel'][_0x1ae2('0x36')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0xd4fbf3[_0x1ae2('0x35')][_0x1ae2('0x36')]('-')[0x0]][_0x1ae2('0x3b')]},{'showHidden':![],'depth':null}));this[_0x1ae2('0x2a')](util[_0x1ae2('0x43')]('user:%s',this['agents'][_0xd4fbf3[_0x1ae2('0x35')]['split']('-')[0x0]][_0x1ae2('0x68')]),_0x1ae2('0x93'),{'id':this[_0x1ae2('0x34')][_0xd4fbf3[_0x1ae2('0x35')][_0x1ae2('0x36')]('-')[0x0]]['id'],'destaccountcode':this[_0x1ae2('0x34')][_0xd4fbf3[_0x1ae2('0x35')][_0x1ae2('0x36')]('-')[0x0]][_0x1ae2('0x3b')]});for(var _0x241f9b=0x0;_0x241f9b{delete this[_0x1ae2('0x14')][_0x4e6c04];},_0x5c9bd7);}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index b23e6bd..1e34009 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09eb=['set','applicationdata','toLowerCase','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','syncDialBegin','bind','dialend','varset','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','emit','prototype','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','lastIndexOf','channel','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','applications','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','variable','variables','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','duration','endtime','diff','starttime','complete','total','answered','holdtime','seconds','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','application'];(function(_0x2501fe,_0x203a72){var _0x2db038=function(_0x4365cf){while(--_0x4365cf){_0x2501fe['push'](_0x2501fe['shift']());}};_0x2db038(++_0x203a72);}(_0x09eb,0x1d9));var _0xb09e=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x09eb[_0x445101];return _0x3c3d04;};'use strict';var _=require(_0xb09e('0x0'));var moment=require(_0xb09e('0x1'));var util=require('util');var Redis=require(_0xb09e('0x2'));var config=require(_0xb09e('0x3'));var logger=require(_0xb09e('0x4'))(_0xb09e('0x5'));var ami=require('../ami');config[_0xb09e('0x6')]=_[_0xb09e('0x7')](config[_0xb09e('0x6')],{'host':_0xb09e('0x8'),'port':0x18eb});var io=require(_0xb09e('0x9'))(new Redis(config[_0xb09e('0x6')]));function VoiceDialReport(_0x277a66){this[_0xb09e('0xa')]=_0x277a66[_0xb09e('0xb')];this['outbound']=_0x277a66[_0xb09e('0xc')];this['applications']={};this['variables']={};ami['on']('dialbegin',this[_0xb09e('0xd')][_0xb09e('0xe')](this));ami['on'](_0xb09e('0xf'),this['syncDialEnd'][_0xb09e('0xe')](this));ami['on'](_0xb09e('0x10'),this[_0xb09e('0x11')]['bind'](this));ami['on'](_0xb09e('0x12'),this[_0xb09e('0x13')][_0xb09e('0xe')](this));}VoiceDialReport['prototype'][_0xb09e('0x14')]=function(_0xec91f7){return _0xec91f7!==null&&!_[_0xb09e('0x15')](_0xec91f7);};VoiceDialReport['prototype'][_0xb09e('0x16')]=function(_0x12cf6f,_0x80c6c8,_0x571ec9){io['to'](_0x12cf6f)[_0xb09e('0x16')](_0x80c6c8,_0x571ec9);};VoiceDialReport[_0xb09e('0x17')][_0xb09e('0xd')]=function(_0x42ce13){try{if(this[_0xb09e('0x14')](_0x42ce13)){logger['debug'](_0xb09e('0x18'),_0x42ce13[_0xb09e('0x19')],util[_0xb09e('0x1a')](_0x42ce13,{'showHidden':![],'depth':null}));if(this[_0xb09e('0xa')][_0x42ce13[_0xb09e('0x19')]]){_[_0xb09e('0x1b')](this[_0xb09e('0xa')][_0x42ce13[_0xb09e('0x19')]],{'starttime':moment()[_0xb09e('0x1c')](_0xb09e('0x1d')),'lastevent':_0xb09e('0x1e'),'interface':_0x42ce13['channel'][_0xb09e('0x1f')](0x0,_0x42ce13['channel'][_0xb09e('0x20')]('-')),'membername':_0x42ce13[_0xb09e('0x21')][_0xb09e('0x1f')](_0x42ce13[_0xb09e('0x21')]['lastIndexOf']('/')+0x1,_0x42ce13[_0xb09e('0x21')]['lastIndexOf']('-'))},_['omit'](_0x42ce13,[_0xb09e('0x22'),'privilege']));logger[_0xb09e('0x23')](_0xb09e('0x24'),_0x42ce13[_0xb09e('0x19')],this[_0xb09e('0xa')][_0x42ce13[_0xb09e('0x19')]][_0xb09e('0x25')],this[_0xb09e('0xa')][_0x42ce13[_0xb09e('0x19')]]['interface']);logger[_0xb09e('0x26')](_0xb09e('0x27'),_0x42ce13['uniqueid'],util[_0xb09e('0x1a')](this['channels'][_0x42ce13[_0xb09e('0x19')]],{'showHidden':![],'depth':null}));if(this[_0xb09e('0x28')][_0x42ce13[_0xb09e('0x19')]])_[_0xb09e('0x1b')](this[_0xb09e('0xa')][_0x42ce13[_0xb09e('0x19')]],this[_0xb09e('0x28')][_0x42ce13[_0xb09e('0x19')]]);this[_0xb09e('0x16')]('voice:outbound','voice_outbound_channel:save',this[_0xb09e('0xa')][_0x42ce13[_0xb09e('0x19')]]);logger['debug'](_0xb09e('0x29'),_0x42ce13[_0xb09e('0x19')],util['inspect'](this[_0xb09e('0xa')][_0x42ce13[_0xb09e('0x19')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialbegin',this['channels'][_0x42ce13[_0xb09e('0x19')]]);}}}catch(_0x530e0f){logger['error'](_0xb09e('0x2a'),_0x42ce13[_0xb09e('0x19')],util['inspect'](_0x530e0f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb09e('0x17')][_0xb09e('0x2b')]=function(_0x1b2c84){try{if(this[_0xb09e('0x14')](_0x1b2c84)){logger[_0xb09e('0x26')](_0xb09e('0x2c'),_0x1b2c84['uniqueid'],util['inspect'](_0x1b2c84,{'showHidden':![],'depth':null}));if(this[_0xb09e('0xa')][_0x1b2c84[_0xb09e('0x19')]]){this[_0xb09e('0xa')][_0x1b2c84[_0xb09e('0x19')]][_0xb09e('0x2d')]=_0x1b2c84[_0xb09e('0x2d')];if(_0x1b2c84['dialstatus']===_0xb09e('0x2e')){this['channels'][_0x1b2c84[_0xb09e('0x19')]]['connectedlinenum']=_0x1b2c84['connectedlinenum'];this['channels'][_0x1b2c84['uniqueid']][_0xb09e('0x2f')]=_0x1b2c84['connectedlinename'];this[_0xb09e('0xa')][_0x1b2c84[_0xb09e('0x19')]][_0xb09e('0x30')]=moment()[_0xb09e('0x1c')](_0xb09e('0x1d'));this['channels'][_0x1b2c84[_0xb09e('0x19')]][_0xb09e('0x31')]=_0xb09e('0x32');logger[_0xb09e('0x23')](_0xb09e('0x33'),_0x1b2c84[_0xb09e('0x19')],_0x1b2c84['channel'][_0xb09e('0x1f')](_0x1b2c84[_0xb09e('0x21')][_0xb09e('0x20')]('/')+0x1,_0x1b2c84[_0xb09e('0x21')][_0xb09e('0x20')]('-')));logger[_0xb09e('0x26')](_0xb09e('0x34'),_0x1b2c84[_0xb09e('0x19')],util[_0xb09e('0x1a')](this[_0xb09e('0xa')][_0x1b2c84[_0xb09e('0x19')]],{'showHidden':![],'depth':null}));ami[_0xb09e('0x16')](_0xb09e('0x35'),this[_0xb09e('0xa')][_0x1b2c84[_0xb09e('0x19')]]);}logger[_0xb09e('0x26')](_0xb09e('0x36'),_0x1b2c84['uniqueid'],util[_0xb09e('0x1a')](this['channels'][_0x1b2c84[_0xb09e('0x19')]],{'showHidden':![],'depth':null}));this[_0xb09e('0x16')]('voice:outbound',_0xb09e('0x37'),this[_0xb09e('0xa')][_0x1b2c84[_0xb09e('0x19')]]);}}}catch(_0x3bd9f2){logger[_0xb09e('0x38')](_0xb09e('0x39'),_0x1b2c84[_0xb09e('0x19')],util['inspect'](_0x3bd9f2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb09e('0x17')][_0xb09e('0x11')]=function(_0x4c95f1){try{if(this['isNotNull'](_0x4c95f1)){logger[_0xb09e('0x26')](_0xb09e('0x3a'),_0x4c95f1[_0xb09e('0x19')],util['inspect'](_0x4c95f1,{'showHidden':![],'depth':null}));this['addVariable'](_0x4c95f1[_0xb09e('0x19')],_['keys'](_0x4c95f1[_0xb09e('0x3b')])[0x0],_0x4c95f1['value']);if(this[_0xb09e('0x14')](_0x4c95f1[_0xb09e('0x3b')])&&this[_0xb09e('0x14')](_0x4c95f1[_0xb09e('0x3b')]['outboundrouteid'])){if(_[_0xb09e('0x15')](this['channels'][_0x4c95f1['uniqueid']])){this['channels'][_0x4c95f1['uniqueid']]={'routeId':_0x4c95f1['value'],'variables':this[_0xb09e('0x3c')][_0x4c95f1[_0xb09e('0x19')]],'motionChannel':_0xb09e('0x3d')};logger[_0xb09e('0x23')](_0xb09e('0x3e'),_0x4c95f1[_0xb09e('0x19')],_0x4c95f1[_0xb09e('0x3b')][_0xb09e('0x3f')],_[_0xb09e('0x40')](_0x4c95f1[_0xb09e('0x3b')])[0x0],_0x4c95f1['value']);logger[_0xb09e('0x26')](_0xb09e('0x41'),_0x4c95f1[_0xb09e('0x19')],util[_0xb09e('0x1a')](this['channels'][_0x4c95f1['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xb09e('0x42'),_0xb09e('0x37'),this[_0xb09e('0xa')][_0x4c95f1[_0xb09e('0x19')]]);}}}}catch(_0x459513){logger[_0xb09e('0x38')](_0xb09e('0x43'),_0x4c95f1[_0xb09e('0x19')],util[_0xb09e('0x1a')](_0x459513,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb09e('0x17')]['addVariable']=function(_0x2e25b1,_0x5c2ed1,_0x373b0a){var _0x6f6979=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter',_0xb09e('0x44'),_0xb09e('0x45'),_0xb09e('0x46'),_0xb09e('0x47'),_0xb09e('0x48'),_0xb09e('0x49'),_0xb09e('0x4a'),_0xb09e('0x4b'),_0xb09e('0x4c'),'membercalls',_0xb09e('0x4d'),'memberinterface',_0xb09e('0x4e'),_0xb09e('0x25'),'memberpenalty',_0xb09e('0x4f')];if(!_[_0xb09e('0x50')](_0x5c2ed1)&&!_[_0xb09e('0x51')](_0x6f6979,_0x5c2ed1)){if(_[_0xb09e('0x15')](this[_0xb09e('0x3c')][_0x2e25b1])){this[_0xb09e('0x3c')][_0x2e25b1]={};}this[_0xb09e('0x3c')][_0x2e25b1][_0x5c2ed1]=_0x373b0a;}};VoiceDialReport[_0xb09e('0x17')][_0xb09e('0x13')]=function(_0x25e368){try{if(this[_0xb09e('0x14')](_0x25e368)){logger[_0xb09e('0x26')](_0xb09e('0x52'),_0x25e368['uniqueid'],util[_0xb09e('0x1a')](_0x25e368,{'showHidden':![],'depth':null}));if(this[_0xb09e('0xa')][_0x25e368['uniqueid']]){logger[_0xb09e('0x23')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x25e368[_0xb09e('0x19')],_0x25e368[_0xb09e('0x53')]);this[_0xb09e('0xa')][_0x25e368['uniqueid']]['endtime']=moment()[_0xb09e('0x1c')](_0xb09e('0x1d'));this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]][_0xb09e('0x54')]=moment(this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]][_0xb09e('0x55')])[_0xb09e('0x56')](this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]][_0xb09e('0x57')],'seconds');this['channels'][_0x25e368[_0xb09e('0x19')]][_0xb09e('0x31')]=_0xb09e('0x58');this[_0xb09e('0xc')][_0xb09e('0x59')]+=0x1;if(this['channels'][_0x25e368[_0xb09e('0x19')]]['answertime']){this[_0xb09e('0xc')][_0xb09e('0x5a')]+=0x1;this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]][_0xb09e('0x5b')]=moment(this['channels'][_0x25e368[_0xb09e('0x19')]]['answertime'])['diff'](this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]]['starttime'],_0xb09e('0x5c'));this['channels'][_0x25e368[_0xb09e('0x19')]]['billableseconds']=moment(this[_0xb09e('0xa')][_0x25e368['uniqueid']][_0xb09e('0x55')])[_0xb09e('0x56')](this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]]['answertime'],'seconds');this['outbound']['sumHoldTime']+=this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]][_0xb09e('0x5b')]||0x0;this[_0xb09e('0xc')][_0xb09e('0x5d')]+=this[_0xb09e('0xa')][_0x25e368['uniqueid']][_0xb09e('0x5e')];}this['outbound'][_0xb09e('0x5f')]+=this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]]['duration'];logger['debug'](_0xb09e('0x60'),_0x25e368[_0xb09e('0x19')],util['inspect'](this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]],{'showHidden':![],'depth':null}));ami[_0xb09e('0x16')](_0xb09e('0x61'),this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]]);logger['debug'](_0xb09e('0x62'),_0x25e368[_0xb09e('0x19')],util[_0xb09e('0x1a')](this[_0xb09e('0xa')][_0x25e368['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xb09e('0x16')]('custom:dialend',this['channels'][_0x25e368[_0xb09e('0x19')]]);logger[_0xb09e('0x26')](_0xb09e('0x63'),_0x25e368[_0xb09e('0x19')],util[_0xb09e('0x1a')](this['channels'][_0x25e368['uniqueid']],{'showHidden':![],'depth':null}));this[_0xb09e('0x16')](_0xb09e('0x42'),_0xb09e('0x64'),this[_0xb09e('0xc')]);logger[_0xb09e('0x23')](_0xb09e('0x65'),JSON[_0xb09e('0x66')](this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]]));logger[_0xb09e('0x26')](_0xb09e('0x67'),_0x25e368[_0xb09e('0x19')],util[_0xb09e('0x1a')](this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x19')]],{'showHidden':![],'depth':null}));this[_0xb09e('0x16')](_0xb09e('0x42'),'voice_outbound_channel:remove',this[_0xb09e('0xa')][_0x25e368['uniqueid']]);this[_0xb09e('0x68')](_0x25e368['uniqueid']);}else if(this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x69')]]){this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x69')]][_0xb09e('0x19')]=this[_0xb09e('0xa')][_0x25e368[_0xb09e('0x69')]]['destuniqueid'];}if(this[_0xb09e('0x3c')][_0x25e368[_0xb09e('0x19')]]){delete this[_0xb09e('0x3c')][_0x25e368[_0xb09e('0x19')]];}}}catch(_0x1597c8){logger[_0xb09e('0x38')]('[%s][voiceDialReport][hangup]',_0x25e368[_0xb09e('0x19')],util[_0xb09e('0x1a')](_0x1597c8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb09e('0x17')]['syncNewExten']=function(_0x47e63f){try{if(this['isNotNull'](_0x47e63f)){logger['debug']('[%s][voiceDialReport][newexten]\x20event:',_0x47e63f[_0xb09e('0x19')],util['inspect'](_0x47e63f,{'showHidden':![],'depth':null}));if(_0x47e63f[_0xb09e('0x6a')]['toLowerCase']()===_0xb09e('0x6b')){_0x47e63f[_0xb09e('0x6c')]=(_0x47e63f['appdata']||_0x47e63f[_0xb09e('0x6c')])[_0xb09e('0x6d')]();if(_[_0xb09e('0x6e')](_0x47e63f[_0xb09e('0x6c')],_0xb09e('0x6f'))){if(_['isUndefined'](this[_0xb09e('0x28')][_0x47e63f[_0xb09e('0x19')]]))this['applications'][_0x47e63f[_0xb09e('0x19')]]={};logger[_0xb09e('0x23')](_0xb09e('0x70'),_0x47e63f[_0xb09e('0x19')],_0x47e63f[_0xb09e('0x6a')],_0x47e63f['applicationdata']);var _0x93f0d6=_0x47e63f[_0xb09e('0x6c')]['split']('=');var _0x43dbe3=_0x93f0d6[0x0][_0xb09e('0x71')](/cdr\((.*)\)/);if(_0x43dbe3)this[_0xb09e('0x28')][_0x47e63f['uniqueid']][_0x43dbe3[0x1]]=_0x93f0d6[0x1];}}}}catch(_0x17e9f7){logger[_0xb09e('0x38')](_0xb09e('0x72'),_0x47e63f['uniqueid'],util[_0xb09e('0x1a')](_0x17e9f7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb09e('0x17')][_0xb09e('0x68')]=function(_0x4467d5,_0x57a9b7=0x2710){if(this[_0xb09e('0xa')][_0x4467d5]){setTimeout(()=>{delete this['channels'][_0x4467d5];},_0x57a9b7);}};module[_0xb09e('0x73')]=VoiceDialReport; \ No newline at end of file +var _0xc066=['[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','variables','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','diff','seconds','complete','total','answered','holdtime','starttime','sumHoldTime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','toLowerCase','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','varset','syncVarSet','hangup','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','isNotNull'];(function(_0x17202,_0x28c231){var _0x5507c1=function(_0x5064c9){while(--_0x5064c9){_0x17202['push'](_0x17202['shift']());}};_0x5507c1(++_0x28c231);}(_0xc066,0xd1));var _0x6c06=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc066[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x6c06('0x0'));var moment=require(_0x6c06('0x1'));var util=require('util');var Redis=require(_0x6c06('0x2'));var config=require(_0x6c06('0x3'));var logger=require(_0x6c06('0x4'))('ami');var ami=require(_0x6c06('0x5'));config[_0x6c06('0x6')]=_[_0x6c06('0x7')](config[_0x6c06('0x6')],{'host':_0x6c06('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6c06('0x6')]));function VoiceDialReport(_0x33ff95){this[_0x6c06('0x9')]=_0x33ff95[_0x6c06('0xa')];this[_0x6c06('0xb')]=_0x33ff95[_0x6c06('0xb')];this[_0x6c06('0xc')]={};this['variables']={};ami['on'](_0x6c06('0xd'),this[_0x6c06('0xe')]['bind'](this));ami['on'](_0x6c06('0xf'),this[_0x6c06('0x10')][_0x6c06('0x11')](this));ami['on'](_0x6c06('0x12'),this[_0x6c06('0x13')][_0x6c06('0x11')](this));ami['on'](_0x6c06('0x14'),this['syncHangup']['bind'](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x1a91ac){return _0x1a91ac!==null&&!_[_0x6c06('0x15')](_0x1a91ac);};VoiceDialReport[_0x6c06('0x16')][_0x6c06('0x17')]=function(_0x5798e5,_0xb0eb33,_0x4a7e78){io['to'](_0x5798e5)[_0x6c06('0x17')](_0xb0eb33,_0x4a7e78);};VoiceDialReport[_0x6c06('0x16')][_0x6c06('0xe')]=function(_0x4222b2){try{if(this['isNotNull'](_0x4222b2)){logger[_0x6c06('0x18')](_0x6c06('0x19'),_0x4222b2[_0x6c06('0x1a')],util['inspect'](_0x4222b2,{'showHidden':![],'depth':null}));if(this[_0x6c06('0x9')][_0x4222b2[_0x6c06('0x1a')]]){_[_0x6c06('0x1b')](this['channels'][_0x4222b2[_0x6c06('0x1a')]],{'starttime':moment()[_0x6c06('0x1c')](_0x6c06('0x1d')),'lastevent':'called','interface':_0x4222b2[_0x6c06('0x1e')][_0x6c06('0x1f')](0x0,_0x4222b2[_0x6c06('0x1e')][_0x6c06('0x20')]('-')),'membername':_0x4222b2[_0x6c06('0x1e')][_0x6c06('0x1f')](_0x4222b2[_0x6c06('0x1e')]['lastIndexOf']('/')+0x1,_0x4222b2[_0x6c06('0x1e')]['lastIndexOf']('-'))},_['omit'](_0x4222b2,[_0x6c06('0x21'),_0x6c06('0x22')]));logger['info'](_0x6c06('0x23'),_0x4222b2[_0x6c06('0x1a')],this[_0x6c06('0x9')][_0x4222b2[_0x6c06('0x1a')]][_0x6c06('0x24')],this['channels'][_0x4222b2[_0x6c06('0x1a')]][_0x6c06('0x25')]);logger[_0x6c06('0x18')](_0x6c06('0x26'),_0x4222b2[_0x6c06('0x1a')],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x4222b2[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0x6c06('0xc')][_0x4222b2[_0x6c06('0x1a')]])_[_0x6c06('0x1b')](this['channels'][_0x4222b2[_0x6c06('0x1a')]],this[_0x6c06('0xc')][_0x4222b2['uniqueid']]);this[_0x6c06('0x17')]('voice:outbound',_0x6c06('0x28'),this[_0x6c06('0x9')][_0x4222b2[_0x6c06('0x1a')]]);logger[_0x6c06('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x4222b2[_0x6c06('0x1a')],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x4222b2[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6c06('0x29'),this['channels'][_0x4222b2[_0x6c06('0x1a')]]);}}}catch(_0x103a6b){logger[_0x6c06('0x2a')](_0x6c06('0x2b'),_0x4222b2[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x103a6b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6c06('0x16')][_0x6c06('0x10')]=function(_0x496271){try{if(this[_0x6c06('0x2c')](_0x496271)){logger[_0x6c06('0x18')](_0x6c06('0x2d'),_0x496271[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x496271,{'showHidden':![],'depth':null}));if(this[_0x6c06('0x9')][_0x496271[_0x6c06('0x1a')]]){this['channels'][_0x496271['uniqueid']][_0x6c06('0x2e')]=_0x496271[_0x6c06('0x2e')];if(_0x496271[_0x6c06('0x2e')]===_0x6c06('0x2f')){this[_0x6c06('0x9')][_0x496271[_0x6c06('0x1a')]]['connectedlinenum']=_0x496271[_0x6c06('0x30')];this[_0x6c06('0x9')][_0x496271[_0x6c06('0x1a')]]['connectedlinename']=_0x496271[_0x6c06('0x31')];this['channels'][_0x496271['uniqueid']][_0x6c06('0x32')]=moment()[_0x6c06('0x1c')](_0x6c06('0x1d'));this[_0x6c06('0x9')][_0x496271[_0x6c06('0x1a')]][_0x6c06('0x33')]=_0x6c06('0x34');logger[_0x6c06('0x35')](_0x6c06('0x36'),_0x496271['uniqueid'],_0x496271[_0x6c06('0x1e')][_0x6c06('0x1f')](_0x496271[_0x6c06('0x1e')][_0x6c06('0x20')]('/')+0x1,_0x496271[_0x6c06('0x1e')][_0x6c06('0x20')]('-')));logger[_0x6c06('0x18')](_0x6c06('0x37'),_0x496271[_0x6c06('0x1a')],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x496271[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x6c06('0x17')]('custom:dialconnect',this[_0x6c06('0x9')][_0x496271['uniqueid']]);}logger[_0x6c06('0x18')](_0x6c06('0x38'),_0x496271[_0x6c06('0x1a')],util[_0x6c06('0x27')](this['channels'][_0x496271[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));this[_0x6c06('0x17')]('voice:outbound',_0x6c06('0x28'),this['channels'][_0x496271['uniqueid']]);}}}catch(_0x5bb6b6){logger[_0x6c06('0x2a')](_0x6c06('0x39'),_0x496271[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x5bb6b6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6c06('0x16')]['syncVarSet']=function(_0x5eecd4){try{if(this[_0x6c06('0x2c')](_0x5eecd4)){logger['debug'](_0x6c06('0x3a'),_0x5eecd4[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x5eecd4,{'showHidden':![],'depth':null}));this['addVariable'](_0x5eecd4[_0x6c06('0x1a')],_[_0x6c06('0x3b')](_0x5eecd4[_0x6c06('0x3c')])[0x0],_0x5eecd4['value']);if(this[_0x6c06('0x2c')](_0x5eecd4[_0x6c06('0x3c')])&&this[_0x6c06('0x2c')](_0x5eecd4[_0x6c06('0x3c')]['outboundrouteid'])){if(_[_0x6c06('0x15')](this[_0x6c06('0x9')][_0x5eecd4[_0x6c06('0x1a')]])){this['channels'][_0x5eecd4[_0x6c06('0x1a')]]={'routeId':_0x5eecd4[_0x6c06('0x3d')],'variables':this[_0x6c06('0x3e')][_0x5eecd4[_0x6c06('0x1a')]],'motionChannel':_0x6c06('0x3f')};logger['info'](_0x6c06('0x40'),_0x5eecd4[_0x6c06('0x1a')],_0x5eecd4[_0x6c06('0x3c')][_0x6c06('0x41')],_[_0x6c06('0x3b')](_0x5eecd4[_0x6c06('0x3c')])[0x0],_0x5eecd4[_0x6c06('0x3d')]);logger['debug'](_0x6c06('0x42'),_0x5eecd4[_0x6c06('0x1a')],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x5eecd4['uniqueid']],{'showHidden':![],'depth':null}));this[_0x6c06('0x17')](_0x6c06('0x43'),_0x6c06('0x28'),this['channels'][_0x5eecd4[_0x6c06('0x1a')]]);}}}}catch(_0x437ee2){logger[_0x6c06('0x2a')](_0x6c06('0x44'),_0x5eecd4[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x437ee2,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x6c06('0x45')]=function(_0x92dfb4,_0x493a69,_0x1004fa){var _0x5cddb3=[_0x6c06('0x46'),'rtpaudioqosbridged',_0x6c06('0x47'),_0x6c06('0x48'),_0x6c06('0x49'),_0x6c06('0x4a'),_0x6c06('0x4b'),_0x6c06('0x4c'),_0x6c06('0x4d'),_0x6c06('0x4e'),'bridgepeer',_0x6c06('0x4f'),_0x6c06('0x50'),_0x6c06('0x51'),'memberinterface',_0x6c06('0x52'),_0x6c06('0x24'),'memberpenalty',_0x6c06('0x53')];if(!_[_0x6c06('0x54')](_0x493a69)&&!_[_0x6c06('0x55')](_0x5cddb3,_0x493a69)){if(_[_0x6c06('0x15')](this[_0x6c06('0x3e')][_0x92dfb4])){this['variables'][_0x92dfb4]={};}this['variables'][_0x92dfb4][_0x493a69]=_0x1004fa;}};VoiceDialReport['prototype'][_0x6c06('0x56')]=function(_0x58c7ea){try{if(this['isNotNull'](_0x58c7ea)){logger[_0x6c06('0x18')](_0x6c06('0x57'),_0x58c7ea[_0x6c06('0x1a')],util['inspect'](_0x58c7ea,{'showHidden':![],'depth':null}));if(this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]]){logger[_0x6c06('0x35')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x58c7ea[_0x6c06('0x1a')],_0x58c7ea[_0x6c06('0x58')]);this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x59')]=moment()[_0x6c06('0x1c')](_0x6c06('0x1d'));this[_0x6c06('0x9')][_0x58c7ea['uniqueid']][_0x6c06('0x5a')]=moment(this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x59')])[_0x6c06('0x5b')](this['channels'][_0x58c7ea[_0x6c06('0x1a')]]['starttime'],_0x6c06('0x5c'));this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]]['lastevent']=_0x6c06('0x5d');this[_0x6c06('0xb')][_0x6c06('0x5e')]+=0x1;if(this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]]['answertime']){this['outbound'][_0x6c06('0x5f')]+=0x1;this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x60')]=moment(this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x32')])[_0x6c06('0x5b')](this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x61')],_0x6c06('0x5c'));this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]]['billableseconds']=moment(this['channels'][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x59')])[_0x6c06('0x5b')](this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x32')],'seconds');this[_0x6c06('0xb')][_0x6c06('0x62')]+=this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x60')]||0x0;this[_0x6c06('0xb')]['sumBillable']+=this['channels'][_0x58c7ea['uniqueid']][_0x6c06('0x63')];}this[_0x6c06('0xb')][_0x6c06('0x64')]+=this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x5a')];logger[_0x6c06('0x18')](_0x6c06('0x65'),_0x58c7ea[_0x6c06('0x1a')],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x6c06('0x17')](_0x6c06('0x66'),this['channels'][_0x58c7ea[_0x6c06('0x1a')]]);logger[_0x6c06('0x18')](_0x6c06('0x67'),_0x58c7ea['uniqueid'],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x6c06('0x17')](_0x6c06('0x68'),this[_0x6c06('0x9')][_0x58c7ea['uniqueid']]);logger[_0x6c06('0x18')](_0x6c06('0x69'),_0x58c7ea[_0x6c06('0x1a')],util['inspect'](this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));this[_0x6c06('0x17')](_0x6c06('0x43'),_0x6c06('0x6a'),this['outbound']);logger[_0x6c06('0x35')](_0x6c06('0x6b'),JSON[_0x6c06('0x6c')](this['channels'][_0x58c7ea[_0x6c06('0x1a')]]));logger['debug'](_0x6c06('0x6d'),_0x58c7ea[_0x6c06('0x1a')],util[_0x6c06('0x27')](this['channels'][_0x58c7ea['uniqueid']],{'showHidden':![],'depth':null}));this[_0x6c06('0x17')](_0x6c06('0x43'),_0x6c06('0x6e'),this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]]);this[_0x6c06('0x6f')](_0x58c7ea[_0x6c06('0x1a')]);}else if(this['channels'][_0x58c7ea[_0x6c06('0x70')]]){this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x70')]][_0x6c06('0x1a')]=this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x70')]][_0x6c06('0x71')];}if(this[_0x6c06('0x3e')][_0x58c7ea[_0x6c06('0x1a')]]){delete this[_0x6c06('0x3e')][_0x58c7ea[_0x6c06('0x1a')]];}}}catch(_0x4dcd87){logger['error'](_0x6c06('0x72'),_0x58c7ea['uniqueid'],util[_0x6c06('0x27')](_0x4dcd87,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6c06('0x16')][_0x6c06('0x73')]=function(_0x10d59d){try{if(this[_0x6c06('0x2c')](_0x10d59d)){logger['debug'](_0x6c06('0x74'),_0x10d59d[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x10d59d,{'showHidden':![],'depth':null}));if(_0x10d59d[_0x6c06('0x75')]['toLowerCase']()===_0x6c06('0x76')){_0x10d59d[_0x6c06('0x77')]=(_0x10d59d['appdata']||_0x10d59d[_0x6c06('0x77')])[_0x6c06('0x78')]();if(_[_0x6c06('0x79')](_0x10d59d[_0x6c06('0x77')],_0x6c06('0x7a'))){if(_[_0x6c06('0x15')](this[_0x6c06('0xc')][_0x10d59d[_0x6c06('0x1a')]]))this[_0x6c06('0xc')][_0x10d59d[_0x6c06('0x1a')]]={};logger[_0x6c06('0x35')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x10d59d[_0x6c06('0x1a')],_0x10d59d[_0x6c06('0x75')],_0x10d59d[_0x6c06('0x77')]);var _0x162511=_0x10d59d[_0x6c06('0x77')][_0x6c06('0x7b')]('=');var _0x4a57e6=_0x162511[0x0][_0x6c06('0x7c')](/cdr\((.*)\)/);if(_0x4a57e6)this[_0x6c06('0xc')][_0x10d59d[_0x6c06('0x1a')]][_0x4a57e6[0x1]]=_0x162511[0x1];}}}}catch(_0x5f222e){logger['error'](_0x6c06('0x7d'),_0x10d59d[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x5f222e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6c06('0x16')][_0x6c06('0x6f')]=function(_0x3845f2,_0x5580d2=0x2710){if(this['channels'][_0x3845f2]){setTimeout(()=>{delete this[_0x6c06('0x9')][_0x3845f2];},_0x5580d2);}};module[_0x6c06('0x7e')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index e4cd0e5..4da1481 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58be=['syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','channels','switch','Action','status','channel','catch','message','error','[%s][voiceQueueReport][checkVariables]','inspect','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','queue','voice_queue_presence:save','ATTENDEDTRANSFER','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','type','inbound','name','voice_queue:save','isUndefined','clearZombieChannels','queues','isRunning','then','handleInboundQueueSummaryReport','compareToInboundQueue','assign','emitInboundVoiceQueueSummary','queuestatus','actionid','outbound','createQueueSummaryReport','statusRequests','completeEvent','syncQueueMember','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummary]','custom:queuesummarycomplete','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerexitreason','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','lastAssignedTo','membername','queuecallerexitAt','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','FORWARDTRANSFER','transfertype','FORWARD','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','linkedid','COMPLETEDBY','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','handleHangup','length','diff','seconds','sumDuration','queuecallerjoinAt','total','answered','sumBillable','milliseconds','unmanaged','lastevent','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumHoldTime','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][hangup]','transfereeuniqueid','transferexten','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][musiconholdstop]','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','set','appdata','applicationdata','cdr(','application','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuemember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop'];(function(_0x42fe11,_0x3011dd){var _0x35212a=function(_0x4e3018){while(--_0x4e3018){_0x42fe11['push'](_0x42fe11['shift']());}};_0x35212a(++_0x3011dd);}(_0x58be,0x1b6));var _0xe58b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x58be[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe58b('0x0'));var moment=require(_0xe58b('0x1'));var util=require(_0xe58b('0x2'));var Redis=require(_0xe58b('0x3'));var config=require(_0xe58b('0x4'));var logger=require(_0xe58b('0x5'))(_0xe58b('0x6'));var ami=require('../ami');var QueueReport=require(_0xe58b('0x7'));var VoiceQueueSummary=require(_0xe58b('0x8'));config[_0xe58b('0x9')]=_[_0xe58b('0xa')](config['redis'],{'host':_0xe58b('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe58b('0x9')]));var Sequence=function(){};Sequence[_0xe58b('0xc')][_0xe58b('0xd')]=function(_0x289c46){this[_0xe58b('0xe')]=this[_0xe58b('0xe')]?this[_0xe58b('0xe')][_0xe58b('0xf')](_0x289c46):_0x289c46();};function VoiceQueueReport(_0x42895d){this[_0xe58b('0x10')]=new Sequence();this[_0xe58b('0x11')]={};this[_0xe58b('0x12')]=_0x42895d;this['agents']=_0x42895d[_0xe58b('0x13')];this['channels']=_0x42895d[_0xe58b('0x14')];this[_0xe58b('0x15')]=_0x42895d[_0xe58b('0x15')];this[_0xe58b('0x16')]=_0x42895d['campaigns'];this[_0xe58b('0x17')]=initializeSummary();this[_0xe58b('0x18')]={};ami['on'](_0xe58b('0x19'),this[_0xe58b('0x1a')]['bind'](this));ami['on'](_0xe58b('0x1b'),this[_0xe58b('0x1c')][_0xe58b('0x1d')](this));ami['on'](_0xe58b('0x1e'),this['syncQueueMember'][_0xe58b('0x1d')](this));ami['on'](_0xe58b('0x1f'),this[_0xe58b('0x20')][_0xe58b('0x1d')](this));ami['on'](_0xe58b('0x21'),this[_0xe58b('0x22')]['bind'](this));ami['on'](_0xe58b('0x23'),this[_0xe58b('0x24')]['bind'](this));ami['on'](_0xe58b('0x25'),this['syncQueueCallerLeave'][_0xe58b('0x1d')](this));ami['on'](_0xe58b('0x26'),this[_0xe58b('0x27')][_0xe58b('0x1d')](this));ami['on'](_0xe58b('0x28'),this[_0xe58b('0x29')]['bind'](this));ami['on'](_0xe58b('0x2a'),this[_0xe58b('0x2b')][_0xe58b('0x1d')](this));ami['on'](_0xe58b('0x2c'),this[_0xe58b('0x2d')][_0xe58b('0x1d')](this));ami['on'](_0xe58b('0x2e'),this[_0xe58b('0x2f')][_0xe58b('0x1d')](this));ami['on']('musiconholdstart',this[_0xe58b('0x30')]['bind'](this));ami['on'](_0xe58b('0x31'),this[_0xe58b('0x32')][_0xe58b('0x1d')](this));ami['on'](_0xe58b('0x33'),this[_0xe58b('0x34')]['bind'](this));ami['on'](_0xe58b('0x35'),this[_0xe58b('0x36')][_0xe58b('0x1d')](this));this[_0xe58b('0x37')]();this[_0xe58b('0x38')]();}function clearChannels(_0x1eed64){if(!_[_0xe58b('0x39')](_0x1eed64)){for(var _0x222eaa in _0x1eed64){if(_0x1eed64[_0xe58b('0x3a')](_0x222eaa)){delete _0x1eed64[_0x222eaa];}}}}function clearCampaigns(_0x27438f){if(!_['isEmpty'](_0x27438f)){for(var _0x4c8f09 in _0x27438f){if(_0x27438f['hasOwnProperty'](_0x4c8f09)){_0x27438f[_0x4c8f09][_0xe58b('0x3b')]=0x0;}}}}function clearVoiceQueues(_0x22ece4){if(!_[_0xe58b('0x39')](_0x22ece4)){for(var _0x277503 in _0x22ece4){if(_0x22ece4['hasOwnProperty'](_0x277503)){_0x22ece4[_0x277503][_0xe58b('0x3b')]=0x0;_0x22ece4[_0x277503]['talking']=0x0;_0x22ece4[_0x277503][_0xe58b('0x3c')]=0x0;_0x22ece4[_0x277503][_0xe58b('0x3d')]=0x0;_0x22ece4[_0x277503][_0xe58b('0x3e')]=!![];}}}}function clearAgentBooked(_0x909094){if(!_[_0xe58b('0x39')](_0x909094)){for(var _0x5d6618 in _0x909094){if(_0x909094[_0xe58b('0x3a')](_0x5d6618)){_0x909094[_0x5d6618][_0xe58b('0x3f')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x5d8282){return _0x5d8282[_0xe58b('0x40')]||_0x5d8282[_0xe58b('0x23')]||_0x5d8282[_0xe58b('0x41')];}VoiceQueueReport[_0xe58b('0xc')]['clearZombieChannels']=function(){var _0x461aba=this;for(var _0x13bf2f in this[_0xe58b('0x42')]){if(this['channels'][_0xe58b('0x3a')](_0x13bf2f)&&!this['channels'][_0x13bf2f][_0xe58b('0x43')]){this[_0xe58b('0x10')][_0xe58b('0xd')](function(){if(!_['isNil'](_0x461aba[_0xe58b('0x42')][_0x13bf2f])){return ami[_0xe58b('0x44')]({'action':_0xe58b('0x45'),'channel':_0x461aba[_0xe58b('0x42')][_0x13bf2f][_0xe58b('0x46')]})[_0xe58b('0x47')](function(_0x562ad3){if(_0x562ad3[_0xe58b('0x48')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x461aba['channels'][_0x13bf2f]){delete _0x461aba[_0xe58b('0x42')][_0x13bf2f];logger[_0xe58b('0x49')]('[%s][voiceQueueReport][checkChannel]',_0x13bf2f,util['inspect'](_0x562ad3,{'showHidden':![],'depth':null}));}if(_0x461aba[_0xe58b('0x11')][_0x13bf2f]){delete _0x461aba[_0xe58b('0x11')][_0x13bf2f];logger[_0xe58b('0x49')]('[%s][voiceQueueReport][checkQueueReport]',_0x13bf2f,util['inspect'](_0x562ad3,{'showHidden':![],'depth':null}));}if(_0x461aba['variables'][_0x13bf2f]){delete _0x461aba['variables'][_0x13bf2f];logger[_0xe58b('0x49')](_0xe58b('0x4a'),_0x13bf2f,util[_0xe58b('0x4b')](_0x562ad3,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xe58b('0xc')][_0xe58b('0x2f')]=function(){logger[_0xe58b('0x49')](_0xe58b('0x4c'));clearChannels(this[_0xe58b('0x42')]);this[_0xe58b('0x4d')](this[_0xe58b('0x11')]);clearAgentBooked(this[_0xe58b('0x13')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xe58b('0x16')]);this[_0xe58b('0x17')]=initializeSummary();};VoiceQueueReport[_0xe58b('0xc')]['clearQueueReport']=function(_0x18d99a){var _0x4f6aa6=this;if(!_[_0xe58b('0x39')](_0x18d99a)){for(var _0x3be885 in _0x18d99a){if(_0x18d99a['hasOwnProperty'](_0x3be885)){_0x4f6aa6[_0xe58b('0x4e')](_0x18d99a[_0x3be885],_0xe58b('0x4f'));delete _0x18d99a[_0x3be885];}}}};VoiceQueueReport[_0xe58b('0xc')][_0xe58b('0x50')]=function(_0x1275cc,_0x56c6a2,_0x3db7f6){io['to'](_0x1275cc)[_0xe58b('0x50')](_0x56c6a2,_0x3db7f6);};VoiceQueueReport[_0xe58b('0xc')][_0xe58b('0x51')]=function(_0x153fd1,_0x49daeb){logger[_0xe58b('0x52')](_0xe58b('0x53')+_0x49daeb+_0xe58b('0x54'),_0x153fd1[_0xe58b('0x55')],util['inspect'](_0x153fd1,{'showHidden':![],'depth':null}));this[_0xe58b('0x50')](util[_0xe58b('0x56')]('voice:queue:%s',_0x153fd1[_0xe58b('0x57')]),'voice_queue_channel:save',_0x153fd1);io['emit'](_0xe58b('0x58'),_0x153fd1);};VoiceQueueReport[_0xe58b('0xc')][_0xe58b('0x4e')]=function(_0x33b8d6,_0x301195){logger[_0xe58b('0x52')](_0xe58b('0x53')+_0x301195+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x33b8d6[_0xe58b('0x55')],util[_0xe58b('0x4b')](_0x33b8d6,{'showHidden':![],'depth':null}));if(_0x33b8d6['queuecallerexitreason']===_0xe58b('0x59')){return;}this[_0xe58b('0x50')](util['format'](_0xe58b('0x5a'),_0x33b8d6['queue']),_0xe58b('0x5b'),_0x33b8d6);io['emit'](_0xe58b('0x5c'),_0x33b8d6);};VoiceQueueReport[_0xe58b('0xc')]['emitInboundVoiceQueueSummary']=function(_0xfa4eb8){if(_0xfa4eb8[_0xe58b('0x5d')]===_0xe58b('0x5e')){logger[_0xe58b('0x52')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0xfa4eb8,{'showHidden':![],'depth':null}));this[_0xe58b('0x50')](util['format'](_0xe58b('0x5a'),_0xfa4eb8[_0xe58b('0x5f')]),_0xe58b('0x60'),_0xfa4eb8);}};VoiceQueueReport[_0xe58b('0xc')]['isNotNull']=function(_0x557b90){return _0x557b90!==null&&!_[_0xe58b('0x61')](_0x557b90);};VoiceQueueReport['prototype'][_0xe58b('0x38')]=function(){var _0x194aed=this;setInterval(function(){_0x194aed[_0xe58b('0x62')]();ami[_0xe58b('0x44')]({'action':_0xe58b('0x63')})[_0xe58b('0x47')](function(_0x1d0401){logger[_0xe58b('0x49')]('[voiceQueueReport][queues]',util[_0xe58b('0x4b')](_0x1d0401,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xe58b('0xc')][_0xe58b('0x37')]=function(){var _0x547316=this;setInterval(function(){if(!_0x547316['summary'][_0xe58b('0x64')]){return ami['Action']({'action':_0xe58b('0x19')})[_0xe58b('0x65')](function(_0x113f66){_0x547316[_0xe58b('0x17')]['id']=_0x113f66['actionid'];_0x547316[_0xe58b('0x17')][_0xe58b('0x64')]=!![];_0x547316[_0xe58b('0x17')]['queuestatus'][_0x113f66['actionid']]={};})[_0xe58b('0x47')](function(_0xccab38){logger[_0xe58b('0x49')]('[voiceQueueReport][queuesummary]',util[_0xe58b('0x4b')](_0xccab38,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xe58b('0xc')]['createQueueSummaryReport']=function(_0x2dbfd2,_0x32f137){var _0x6fe821;if(this['summary']&&this[_0xe58b('0x17')]['queues']&&this['summary']['queues'][_0x2dbfd2[_0xe58b('0x5f')]]){_0x6fe821=this[_0xe58b('0x17')]['queues'][_0x2dbfd2[_0xe58b('0x5f')]]['summaryEvent'];}var _0x6f4b2d=new VoiceQueueSummary(_0x2dbfd2);return _0x6f4b2d['createReport'](_0x32f137[_0xe58b('0x13')],this['agents'],_0x6fe821,this[_0xe58b('0x12')][_0xe58b('0x42')]);};VoiceQueueReport['prototype'][_0xe58b('0x66')]=function(_0x40f815,_0x4545df){var _0x5971a4=this['createQueueSummaryReport'](_0x40f815,_0x4545df);var _0x31179c=![];_0x31179c=_0x5971a4[_0xe58b('0x67')](_0x40f815);if(_0x31179c){Object[_0xe58b('0x68')](_0x40f815,_0x5971a4);this[_0xe58b('0x12')][_0xe58b('0x15')][_0x40f815[_0xe58b('0x5f')]]=_0x40f815;this[_0xe58b('0x69')](_0x5971a4);}};VoiceQueueReport[_0xe58b('0xc')][_0xe58b('0x20')]=function(_0x23307e){var _0x33d7f0=null;var _0x5a2147=this[_0xe58b('0x17')]['id'];if(this['summary'][_0xe58b('0x6a')][_0x5a2147]){_0x33d7f0=this['summary'][_0xe58b('0x6a')][_0x5a2147][_0x23307e[_0xe58b('0x6b')]];}if(!_0x33d7f0){this[_0xe58b('0x17')]=initializeSummary();return;}var _0x19b78a=this[_0xe58b('0x15')][_0x33d7f0[_0xe58b('0x57')]];if(_0x19b78a[_0xe58b('0x5d')]===_0xe58b('0x5e')){this['handleInboundQueueSummaryReport'](_0x19b78a,_0x33d7f0);}else if(_0x19b78a[_0xe58b('0x5d')]===_0xe58b('0x6c')){var _0x43254d=this[_0xe58b('0x6d')](_0x19b78a,_0x33d7f0);ami[_0xe58b('0x50')]('custom:queuesummary',_0x43254d);}this['summary'][_0xe58b('0x6e')]-=0x1;var _0x28a0ed=this['summary'][_0xe58b('0x6e')]>0x0?!![]:![];if(!_0x28a0ed){return this[_0xe58b('0x1c')](this[_0xe58b('0x17')][_0xe58b('0x6f')]);}};VoiceQueueReport[_0xe58b('0xc')][_0xe58b('0x70')]=function(_0x469570){var _0x206cd5=this[_0xe58b('0x17')]['id'];if(this['summary'][_0xe58b('0x6a')][_0x206cd5]&&this[_0xe58b('0x17')][_0xe58b('0x6a')][_0x206cd5][_0x469570[_0xe58b('0x6b')]]){this['summary'][_0xe58b('0x6a')][_0x206cd5][_0x469570[_0xe58b('0x6b')]]['agents']['push'](_0x469570);}};VoiceQueueReport[_0xe58b('0xc')][_0xe58b('0x1a')]=function(_0x4e9abf){var _0x5cb6d1=this;try{if(this[_0xe58b('0x71')](_0x4e9abf)&&this['isNotNull'](_0x4e9abf['queue'])){logger['debug'](_0xe58b('0x72'),util[_0xe58b('0x4b')](_0x4e9abf,{'showHidden':![],'depth':null}));var _0x3d92c=this[_0xe58b('0x15')][_0x4e9abf['queue']];if(_0x3d92c){logger[_0xe58b('0x52')](_0xe58b('0x73'),_0x3d92c[_0xe58b('0x5f')]);this[_0xe58b('0x17')][_0xe58b('0x63')][_0x3d92c[_0xe58b('0x5f')]]={'summaryEvent':_0x4e9abf};this[_0xe58b('0x17')][_0xe58b('0x6e')]+=0x1;return ami[_0xe58b('0x44')]({'action':_0xe58b('0x6a'),'queue':_0x3d92c[_0xe58b('0x5f')]})[_0xe58b('0x65')](function(_0x7b7200){if(!_0x5cb6d1[_0xe58b('0x17')][_0xe58b('0x6a')][_0x4e9abf[_0xe58b('0x6b')]]){_0x5cb6d1[_0xe58b('0x17')][_0xe58b('0x6a')][_0x4e9abf[_0xe58b('0x6b')]]={};}_0x5cb6d1[_0xe58b('0x17')][_0xe58b('0x6a')][_0x4e9abf[_0xe58b('0x6b')]][_0x7b7200[_0xe58b('0x6b')]]={'queue':_0x3d92c['name'],'agents':[]};})['catch'](function(_0x54786a){throw _0x54786a;});}}}catch(_0x5712ca){logger['error'](_0xe58b('0x74'),util[_0xe58b('0x4b')](_0x5712ca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe58b('0xc')]['syncQueueSummaryComplete']=function(_0x17bd80){if(this[_0xe58b('0x17')][_0xe58b('0x6e')]>0x0){this[_0xe58b('0x17')][_0xe58b('0x6f')]=_0x17bd80;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xe58b('0x4b')](_0x17bd80,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xe58b('0x50')](_0xe58b('0x75'),{});};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x2be5b1){try{if(this[_0xe58b('0x71')](_0x2be5b1)){logger[_0xe58b('0x52')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2be5b1[_0xe58b('0x55')],util[_0xe58b('0x4b')](_0x2be5b1,{'showHidden':![],'depth':null}));if(_[_0xe58b('0x61')](this['queueReports'][_0x2be5b1[_0xe58b('0x55')]])){this[_0xe58b('0x11')][_0x2be5b1[_0xe58b('0x55')]]=[];}if(_[_0xe58b('0x61')](this[_0xe58b('0x42')][_0x2be5b1[_0xe58b('0x55')]])){this[_0xe58b('0x42')][_0x2be5b1[_0xe58b('0x55')]]={};}var _0x13e7ab=new QueueReport();_0x13e7ab[_0xe58b('0x57')]=_0x2be5b1[_0xe58b('0x57')];_0x13e7ab[_0xe58b('0x5d')]=this[_0xe58b('0x15')][_0x13e7ab[_0xe58b('0x57')]]&&this[_0xe58b('0x15')][_0x13e7ab[_0xe58b('0x57')]][_0xe58b('0x5d')]?this[_0xe58b('0x15')][_0x13e7ab['queue']][_0xe58b('0x5d')]||'inbound':_0xe58b('0x5e');_0x13e7ab['queuecallerjoinAt']=moment()[_0xe58b('0x56')](_0xe58b('0x76'));_0x13e7ab[_0xe58b('0x77')]=_0x2be5b1[_0xe58b('0x77')];_0x13e7ab[_0xe58b('0x78')]=_0x2be5b1['count'];_0x13e7ab[_0xe58b('0x55')]=_0x2be5b1[_0xe58b('0x55')];logger[_0xe58b('0x79')](_0xe58b('0x7a'),_0x13e7ab[_0xe58b('0x57')],_0x13e7ab[_0xe58b('0x5d')]);Object['assign'](_0x13e7ab,_[_0xe58b('0x7b')](_0x2be5b1,_[_0xe58b('0x7c')](_0x13e7ab)));this[_0xe58b('0x11')][_0x2be5b1[_0xe58b('0x55')]]['push'](_0x13e7ab);this[_0xe58b('0x42')][_0x2be5b1[_0xe58b('0x55')]]=_0x13e7ab;this[_0xe58b('0x51')](_0x13e7ab,_0xe58b('0x21'));}}catch(_0x3a6378){logger[_0xe58b('0x49')](_0xe58b('0x7d'),_0x2be5b1['uniqueid'],util[_0xe58b('0x4b')](_0x3a6378,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe58b('0xc')][_0xe58b('0x24')]=function(_0x3befae){try{if(this[_0xe58b('0x71')](_0x3befae)){logger[_0xe58b('0x52')](_0xe58b('0x7e'),_0x3befae[_0xe58b('0x55')],util[_0xe58b('0x4b')](_0x3befae,{'showHidden':![],'depth':null}));if(this[_0xe58b('0x11')][_0x3befae[_0xe58b('0x55')]]){var _0x2f083f=_[_0xe58b('0x7f')](this['queueReports'][_0x3befae['uniqueid']]);_0x2f083f[_0xe58b('0x41')]=![];_0x2f083f[_0xe58b('0x80')]=null;_0x2f083f[_0xe58b('0x81')]=_0x3befae[_0xe58b('0x81')];_0x2f083f[_0xe58b('0x82')]=_0x3befae[_0xe58b('0x82')];_0x2f083f[_0xe58b('0x23')]=!![];_0x2f083f['queuecallerabandonAt']=moment()['format'](_0xe58b('0x76'));_0x2f083f[_0xe58b('0x83')]='ABANDONED';_0x2f083f['lastAssignedTo']=null;logger[_0xe58b('0x79')](_0xe58b('0x84'),_0x2f083f[_0xe58b('0x57')],_0x2f083f['type']);this[_0xe58b('0x42')][_0x3befae[_0xe58b('0x55')]]=_0x2f083f;this[_0xe58b('0x4e')](_0x2f083f,_0xe58b('0x23'));}}}catch(_0x10be59){logger[_0xe58b('0x49')]('[%s][voiceQueueReport][queuecallerabandon]',_0x3befae['uniqueid'],util[_0xe58b('0x4b')](_0x10be59,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe58b('0xc')]['syncQueueCallerLeave']=function(_0x17ba8a){try{if(this[_0xe58b('0x71')](_0x17ba8a)){logger[_0xe58b('0x52')](_0xe58b('0x85'),_0x17ba8a[_0xe58b('0x55')],util[_0xe58b('0x4b')](_0x17ba8a,{'showHidden':![],'depth':null}));if(this[_0xe58b('0x11')][_0x17ba8a[_0xe58b('0x55')]]){var _0x1e5873=_[_0xe58b('0x7f')](this['queueReports'][_0x17ba8a[_0xe58b('0x55')]]);_0x1e5873[_0xe58b('0x86')]=moment()['format'](_0xe58b('0x76'));_0x1e5873[_0xe58b('0x87')]=_0x17ba8a[_0xe58b('0x87')];_0x1e5873[_0xe58b('0x88')]=_0x17ba8a[_0xe58b('0x88')];logger[_0xe58b('0x79')](_0xe58b('0x89'),_0x1e5873[_0xe58b('0x57')],_0x1e5873[_0xe58b('0x5d')],_0x17ba8a['connectedlinenum'],_0x17ba8a[_0xe58b('0x88')]);this[_0xe58b('0x42')][_0x17ba8a[_0xe58b('0x55')]]=_0x1e5873;this['emitVoiceQueueChannelSave'](_0x1e5873,_0xe58b('0x25'));}}}catch(_0x8ee39f){logger[_0xe58b('0x49')](_0xe58b('0x85'),_0x17ba8a['uniqueid'],util[_0xe58b('0x4b')](_0x8ee39f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe58b('0xc')][_0xe58b('0x29')]=function(_0x601d34){try{if(this[_0xe58b('0x71')](_0x601d34)){logger[_0xe58b('0x52')]('[%s][voiceQueueReport][agentconnect]',_0x601d34[_0xe58b('0x55')],util[_0xe58b('0x4b')](_0x601d34,{'showHidden':![],'depth':null}));if(this[_0xe58b('0x11')][_0x601d34[_0xe58b('0x55')]]){var _0x14ec96=_[_0xe58b('0x7f')](this['queueReports'][_0x601d34['uniqueid']]);_0x14ec96['queuecallercomplete']=!![];_0x14ec96[_0xe58b('0x83')]=_0xe58b('0x8a');logger[_0xe58b('0x79')](_0xe58b('0x8b'),_0x14ec96[_0xe58b('0x57')],_0x14ec96[_0xe58b('0x5d')]);}}}catch(_0xf2fb9){logger[_0xe58b('0x49')](_0xe58b('0x8c'),_0x601d34[_0xe58b('0x55')],util[_0xe58b('0x4b')](_0xf2fb9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe58b('0xc')]['syncAgentComplete']=function(_0x4726fa){try{if(this['isNotNull'](_0x4726fa)){logger[_0xe58b('0x52')](_0xe58b('0x8d'),_0x4726fa['uniqueid'],util[_0xe58b('0x4b')](_0x4726fa,{'showHidden':![],'depth':null}));if(this[_0xe58b('0x11')][_0x4726fa[_0xe58b('0x55')]]){var _0x3e4afa=_[_0xe58b('0x7f')](this[_0xe58b('0x11')][_0x4726fa[_0xe58b('0x55')]]);_0x3e4afa[_0xe58b('0x23')]=![];_0x3e4afa['queuecallerabandonAt']=null;_0x3e4afa[_0xe58b('0x8e')]=!![];_0x3e4afa[_0xe58b('0x8f')]=_0x4726fa[_0xe58b('0x90')];_0x3e4afa[_0xe58b('0x81')]=_0x4726fa[_0xe58b('0x81')];_0x3e4afa[_0xe58b('0x41')]=!![];_0x3e4afa['queuecallerexit']=![];_0x3e4afa[_0xe58b('0x91')]=null;if(!_0x3e4afa[_0xe58b('0x92')]){if(_0x4726fa['reason']==_0xe58b('0x92')){_0x3e4afa[_0xe58b('0x83')]=_0xe58b('0x93');logger[_0xe58b('0x79')](_0xe58b('0x94'),_0x3e4afa[_0xe58b('0x57')],_0x3e4afa[_0xe58b('0x5d')]);}else{if(_[_0xe58b('0x95')](_0x4726fa[_0xe58b('0x46')][_0xe58b('0x96')](),'local/')){if(this[_0xe58b('0x11')][_0x4726fa['linkedid']]){var _0x1928a6=_['last'](this[_0xe58b('0x11')][_0x4726fa['linkedid']]);_0x1928a6[_0xe58b('0x41')]=![];_0x1928a6[_0xe58b('0x40')]=!![];_0x1928a6[_0xe58b('0x91')]=moment(_0x3e4afa['queuecallerjoinAt'])['add'](_0x4726fa[_0xe58b('0x81')],'seconds')[_0xe58b('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x1928a6[_0xe58b('0x83')]=_0xe58b('0x97');_0x1928a6['transfer']=!![];_0x1928a6[_0xe58b('0x98')]=_0xe58b('0x99');_0x1928a6['transferexten']=_0x4726fa[_0xe58b('0x9a')];_0x1928a6['transferuniqueid']=_0x4726fa[_0xe58b('0x55')];logger[_0xe58b('0x79')](_0xe58b('0x9b'),_0x1928a6['queue'],_0x1928a6[_0xe58b('0x5d')]);var _0x8e7aee=this[_0xe58b('0x11')][_0x4726fa[_0xe58b('0x9c')]];this[_0xe58b('0x11')][_0x4726fa[_0xe58b('0x9c')]]=this[_0xe58b('0x11')][_0x4726fa[_0xe58b('0x55')]];this[_0xe58b('0x11')][_0x4726fa[_0xe58b('0x55')]]=_0x8e7aee;}}else{_0x3e4afa[_0xe58b('0x83')]=_0xe58b('0x9d')+_0x4726fa[_0xe58b('0x9e')][_0xe58b('0x9f')]();logger[_0xe58b('0x79')](_0xe58b('0xa0'),_0x3e4afa[_0xe58b('0x57')],_0x3e4afa[_0xe58b('0x5d')],_0x3e4afa[_0xe58b('0x83')]);}}}this[_0xe58b('0x42')][_0x4726fa[_0xe58b('0x55')]]=_0x3e4afa;}}}catch(_0x342788){logger[_0xe58b('0x49')](_0xe58b('0x8d'),_0x4726fa[_0xe58b('0x55')],util[_0xe58b('0x4b')](_0x342788,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x32db96){try{if(this['isNotNull'](_0x32db96)){logger[_0xe58b('0x52')](_0xe58b('0xa1'),_0x32db96['uniqueid'],util[_0xe58b('0x4b')](_0x32db96,{'showHidden':![],'depth':null}));this[_0xe58b('0xa2')](_0x32db96['uniqueid'],_['keys'](_0x32db96[_0xe58b('0xa3')])[0x0],_0x32db96[_0xe58b('0xa4')]);if(this[_0xe58b('0x11')][_0x32db96[_0xe58b('0x55')]]){var _0x10f702=_[_0xe58b('0x7f')](this[_0xe58b('0x11')][_0x32db96['uniqueid']]);if(_0x10f702){if(this[_0xe58b('0x71')](_0x32db96[_0xe58b('0xa3')])&&this['isNotNull'](_0x32db96[_0xe58b('0xa3')][_0xe58b('0x6a')])){switch(_0x32db96[_0xe58b('0xa4')]){case _0xe58b('0xa5'):_0x10f702[_0xe58b('0x40')]=![];_0x10f702['queuecallerexitAt']=null;break;case _0xe58b('0xa6'):_0x10f702['lastevent']=_0xe58b('0xa7');_0x10f702['queuecallerexit']=!![];_0x10f702[_0xe58b('0x91')]=moment()['format'](_0xe58b('0x76'));_0x10f702[_0xe58b('0x86')]=moment()[_0xe58b('0x56')](_0xe58b('0x76'));logger[_0xe58b('0x52')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x32db96[_0xe58b('0x55')],util[_0xe58b('0x4b')](_0x10f702,{'showHidden':![],'depth':null}));ami[_0xe58b('0x50')]('custom:timeout',_0x10f702);break;default:_0x10f702[_0xe58b('0x40')]=!![];_0x10f702['queuecallerexitAt']=moment()[_0xe58b('0x56')](_0xe58b('0x76'));_0x10f702[_0xe58b('0x86')]=moment()[_0xe58b('0x56')](_0xe58b('0x76'));}_0x10f702[_0xe58b('0x23')]=![];_0x10f702['queuecallerabandonAt']=null;_0x10f702[_0xe58b('0x83')]=_0x32db96[_0xe58b('0xa4')];this[_0xe58b('0x42')][_0x32db96[_0xe58b('0x55')]]=_0x10f702;this[_0xe58b('0x4e')](_0x10f702,_0xe58b('0x2a'));}else if(this[_0xe58b('0x71')](_0x32db96[_0xe58b('0xa3')])&&this['isNotNull'](_0x32db96[_0xe58b('0xa3')][_0xe58b('0xa8')])){if(!_0x10f702[_0xe58b('0x23')]){_0x10f702[_0xe58b('0x40')]=!![];_0x10f702[_0xe58b('0x91')]=moment()[_0xe58b('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x10f702[_0xe58b('0x83')]='EXITWITHKEY';_0x10f702[_0xe58b('0x86')]=moment()[_0xe58b('0x56')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe58b('0x42')][_0x32db96[_0xe58b('0x55')]]=_0x10f702;}}logger[_0xe58b('0x79')](_0xe58b('0xa9'),_0x32db96[_0xe58b('0x55')],_0x10f702[_0xe58b('0x57')],_0x10f702[_0xe58b('0x5d')],_[_0xe58b('0x7c')](_0x32db96[_0xe58b('0xa3')])[0x0],_0x32db96[_0xe58b('0xa4')]);_0x10f702['variables']=this[_0xe58b('0x18')][_0x32db96[_0xe58b('0x55')]];}}}}catch(_0x900d37){logger[_0xe58b('0x49')](_0xe58b('0xa1'),_0x32db96['uniqueid'],util[_0xe58b('0x4b')](_0x900d37,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe58b('0xc')][_0xe58b('0xa2')]=function(_0x57f47e,_0x39c72a,_0x51a5c1){var _0x4b1ed7=[_0xe58b('0xaa'),_0xe58b('0xab'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xe58b('0xac'),_0xe58b('0xad'),'rtpaudioqosrtt',_0xe58b('0xae'),_0xe58b('0xaf'),_0xe58b('0xb0'),_0xe58b('0xb1'),_0xe58b('0xb2'),'membercalls',_0xe58b('0xb3'),'memberinterface',_0xe58b('0xb4'),_0xe58b('0x90'),_0xe58b('0xb5'),_0xe58b('0xb6')];if(!_[_0xe58b('0xb7')](_0x39c72a)&&!_[_0xe58b('0xb8')](_0x4b1ed7,_0x39c72a)){if(_[_0xe58b('0x61')](this[_0xe58b('0x18')][_0x57f47e])){this[_0xe58b('0x18')][_0x57f47e]={};}this[_0xe58b('0x18')][_0x57f47e][_0x39c72a]=_0x51a5c1;}};VoiceQueueReport['prototype'][_0xe58b('0xb9')]=function(_0xf64ad6,_0x1862b4,_0xa88f94){try{var _0x11350f={};if(this[_0xe58b('0x11')][_0xf64ad6]){for(var _0x3374c1=0x0;_0x3374c1{delete this[_0xe58b('0x42')][_0x4a9ad9];},_0x2d63d1);}};module[_0xe58b('0xf3')]=VoiceQueueReport; \ No newline at end of file +var _0xc83f=['outbound','custom:queuesummary','syncQueueSummaryComplete','completeEvent','push','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','then','statusRequests','[voiceQueueReport][queuesummarycomplete]\x20event:','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','pick','keys','queuecallerjoin','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','lastAssignedTo','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','membername','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','[%s][voiceQueueReport][varset]','value','variable','CONTINUE','queuecallerexitAt','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','handleHangup','length','diff','milliseconds','total','answered','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','transfereeuniqueid','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][attendedtransfer]','extension','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','lodash','moment','util','ioredis','ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','queuesummarycomplete','queuemember','syncQueueMember','bind','queuestatuscomplete','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','syncHangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','clearZombieChannels','channels','switch','isNil','Action','status','channel','catch','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','actionid','isRunning','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','realtime','handleInboundQueueSummaryReport','compareToInboundQueue','assign','type'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc83f,0x83));var _0xfc83=function(_0x3cca3e,_0x950fc5){_0x3cca3e=_0x3cca3e-0x0;var _0x382338=_0xc83f[_0x3cca3e];return _0x382338;};'use strict';var _=require(_0xfc83('0x0'));var moment=require(_0xfc83('0x1'));var util=require(_0xfc83('0x2'));var Redis=require(_0xfc83('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xfc83('0x4'));var ami=require('../ami');var QueueReport=require(_0xfc83('0x5'));var VoiceQueueSummary=require(_0xfc83('0x6'));config[_0xfc83('0x7')]=_[_0xfc83('0x8')](config[_0xfc83('0x7')],{'host':_0xfc83('0x9'),'port':0x18eb});var io=require(_0xfc83('0xa'))(new Redis(config[_0xfc83('0x7')]));var Sequence=function(){};Sequence[_0xfc83('0xb')][_0xfc83('0xc')]=function(_0x4d224b){this['tail']=this[_0xfc83('0xd')]?this[_0xfc83('0xd')][_0xfc83('0xe')](_0x4d224b):_0x4d224b();};function VoiceQueueReport(_0x17db77){this[_0xfc83('0xf')]=new Sequence();this[_0xfc83('0x10')]={};this['realtime']=_0x17db77;this[_0xfc83('0x11')]=_0x17db77['agents'];this['channels']=_0x17db77[_0xfc83('0x12')];this[_0xfc83('0x13')]=_0x17db77[_0xfc83('0x13')];this['campaigns']=_0x17db77[_0xfc83('0x14')];this[_0xfc83('0x15')]=initializeSummary();this[_0xfc83('0x16')]={};ami['on'](_0xfc83('0x17'),this[_0xfc83('0x18')]['bind'](this));ami['on'](_0xfc83('0x19'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0xfc83('0x1a'),this[_0xfc83('0x1b')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x1d'),this['syncQueueStatusComplete'][_0xfc83('0x1c')](this));ami['on']('queuecallerjoin',this[_0xfc83('0x1e')]['bind'](this));ami['on']('queuecallerabandon',this[_0xfc83('0x1f')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x20'),this[_0xfc83('0x21')]['bind'](this));ami['on'](_0xfc83('0x22'),this[_0xfc83('0x23')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x24'),this[_0xfc83('0x25')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x26'),this[_0xfc83('0x27')][_0xfc83('0x1c')](this));ami['on']('hangup',this[_0xfc83('0x28')][_0xfc83('0x1c')](this));ami['on']('fullybooted',this[_0xfc83('0x29')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x2a'),this[_0xfc83('0x2b')]['bind'](this));ami['on'](_0xfc83('0x2c'),this[_0xfc83('0x2d')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x2e'),this[_0xfc83('0x2f')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x30'),this[_0xfc83('0x31')][_0xfc83('0x1c')](this));this[_0xfc83('0x32')]();this['loopQueueShow']();}function clearChannels(_0x120818){if(!_[_0xfc83('0x33')](_0x120818)){for(var _0x5cb724 in _0x120818){if(_0x120818[_0xfc83('0x34')](_0x5cb724)){delete _0x120818[_0x5cb724];}}}}function clearCampaigns(_0x1bc459){if(!_[_0xfc83('0x33')](_0x1bc459)){for(var _0x3b9d14 in _0x1bc459){if(_0x1bc459[_0xfc83('0x34')](_0x3b9d14)){_0x1bc459[_0x3b9d14][_0xfc83('0x35')]=0x0;}}}}function clearVoiceQueues(_0x35416c){if(!_[_0xfc83('0x33')](_0x35416c)){for(var _0x214759 in _0x35416c){if(_0x35416c[_0xfc83('0x34')](_0x214759)){_0x35416c[_0x214759][_0xfc83('0x35')]=0x0;_0x35416c[_0x214759][_0xfc83('0x36')]=0x0;_0x35416c[_0x214759][_0xfc83('0x37')]=0x0;_0x35416c[_0x214759][_0xfc83('0x38')]=0x0;_0x35416c[_0x214759][_0xfc83('0x39')]=!![];}}}}function clearAgentBooked(_0x4b072f){if(!_['isEmpty'](_0x4b072f)){for(var _0x2f827d in _0x4b072f){if(_0x4b072f[_0xfc83('0x34')](_0x2f827d)){_0x4b072f[_0x2f827d][_0xfc83('0x3a')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x1e53b1){return _0x1e53b1[_0xfc83('0x3b')]||_0x1e53b1['queuecallerabandon']||_0x1e53b1[_0xfc83('0x3c')];}VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x3d')]=function(){var _0x1ee38c=this;for(var _0x33882f in this[_0xfc83('0x3e')]){if(this[_0xfc83('0x3e')]['hasOwnProperty'](_0x33882f)&&!this[_0xfc83('0x3e')][_0x33882f][_0xfc83('0x3f')]){this[_0xfc83('0xf')][_0xfc83('0xc')](function(){if(!_[_0xfc83('0x40')](_0x1ee38c[_0xfc83('0x3e')][_0x33882f])){return ami[_0xfc83('0x41')]({'action':_0xfc83('0x42'),'channel':_0x1ee38c['channels'][_0x33882f][_0xfc83('0x43')]})[_0xfc83('0x44')](function(_0x272d2b){if(_0x272d2b['message']===_0xfc83('0x45')){setTimeout(function(){if(_0x1ee38c[_0xfc83('0x3e')][_0x33882f]){delete _0x1ee38c[_0xfc83('0x3e')][_0x33882f];logger[_0xfc83('0x46')](_0xfc83('0x47'),_0x33882f,util[_0xfc83('0x48')](_0x272d2b,{'showHidden':![],'depth':null}));}if(_0x1ee38c[_0xfc83('0x10')][_0x33882f]){delete _0x1ee38c['queueReports'][_0x33882f];logger[_0xfc83('0x46')](_0xfc83('0x49'),_0x33882f,util[_0xfc83('0x48')](_0x272d2b,{'showHidden':![],'depth':null}));}if(_0x1ee38c[_0xfc83('0x16')][_0x33882f]){delete _0x1ee38c[_0xfc83('0x16')][_0x33882f];logger[_0xfc83('0x46')](_0xfc83('0x4a'),_0x33882f,util[_0xfc83('0x48')](_0x272d2b,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x29')]=function(){logger['error']('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xfc83('0x3e')]);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this[_0xfc83('0x11')]);clearVoiceQueues(this[_0xfc83('0x13')]);clearCampaigns(this['campaigns']);this[_0xfc83('0x15')]=initializeSummary();};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x4b')]=function(_0x38ad4d){var _0x2c81fd=this;if(!_['isEmpty'](_0x38ad4d)){for(var _0x21992a in _0x38ad4d){if(_0x38ad4d[_0xfc83('0x34')](_0x21992a)){_0x2c81fd[_0xfc83('0x4c')](_0x38ad4d[_0x21992a],'clearqueuereport');delete _0x38ad4d[_0x21992a];}}}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x4d')]=function(_0x10a836,_0x5a62ff,_0x300798){io['to'](_0x10a836)[_0xfc83('0x4d')](_0x5a62ff,_0x300798);};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x4e')]=function(_0x7016d4,_0xe69f36){logger[_0xfc83('0x4f')](_0xfc83('0x50')+_0xe69f36+_0xfc83('0x51'),_0x7016d4[_0xfc83('0x52')],util['inspect'](_0x7016d4,{'showHidden':![],'depth':null}));this[_0xfc83('0x4d')](util[_0xfc83('0x53')](_0xfc83('0x54'),_0x7016d4[_0xfc83('0x55')]),'voice_queue_channel:save',_0x7016d4);io[_0xfc83('0x4d')](_0xfc83('0x56'),_0x7016d4);};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x4c')]=function(_0x207dc2,_0x1e13cc){logger[_0xfc83('0x4f')](_0xfc83('0x50')+_0x1e13cc+_0xfc83('0x57'),_0x207dc2['uniqueid'],util[_0xfc83('0x48')](_0x207dc2,{'showHidden':![],'depth':null}));if(_0x207dc2[_0xfc83('0x58')]===_0xfc83('0x59')){return;}this[_0xfc83('0x4d')](util[_0xfc83('0x53')](_0xfc83('0x54'),_0x207dc2[_0xfc83('0x55')]),_0xfc83('0x5a'),_0x207dc2);io[_0xfc83('0x4d')](_0xfc83('0x5b'),_0x207dc2);};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x5c')]=function(_0x16367b){if(_0x16367b['type']===_0xfc83('0x5d')){logger[_0xfc83('0x4f')](_0xfc83('0x5e'),util[_0xfc83('0x48')](_0x16367b,{'showHidden':![],'depth':null}));this[_0xfc83('0x4d')](util[_0xfc83('0x53')](_0xfc83('0x54'),_0x16367b[_0xfc83('0x5f')]),_0xfc83('0x60'),_0x16367b);}};VoiceQueueReport['prototype']['isNotNull']=function(_0x59085f){return _0x59085f!==null&&!_[_0xfc83('0x61')](_0x59085f);};VoiceQueueReport['prototype'][_0xfc83('0x62')]=function(){var _0xbcf5db=this;setInterval(function(){_0xbcf5db[_0xfc83('0x3d')]();ami[_0xfc83('0x41')]({'action':_0xfc83('0x63')})[_0xfc83('0x44')](function(_0x49ef81){logger[_0xfc83('0x46')](_0xfc83('0x64'),util['inspect'](_0x49ef81,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xfc83('0xb')]['loopQueueSummary']=function(){var _0x258d5a=this;setInterval(function(){if(!_0x258d5a[_0xfc83('0x15')]['isRunning']){return ami['Action']({'action':'queuesummary'})['then'](function(_0x472075){_0x258d5a[_0xfc83('0x15')]['id']=_0x472075[_0xfc83('0x65')];_0x258d5a['summary'][_0xfc83('0x66')]=!![];_0x258d5a['summary'][_0xfc83('0x67')][_0x472075[_0xfc83('0x65')]]={};})[_0xfc83('0x44')](function(_0x3348db){logger[_0xfc83('0x46')](_0xfc83('0x68'),util['inspect'](_0x3348db,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x69')]=function(_0x31f958,_0x2a9e3b){var _0xeb49fd;if(this[_0xfc83('0x15')]&&this['summary']['queues']&&this[_0xfc83('0x15')]['queues'][_0x31f958['name']]){_0xeb49fd=this[_0xfc83('0x15')]['queues'][_0x31f958[_0xfc83('0x5f')]][_0xfc83('0x6a')];}var _0x1f5ff0=new VoiceQueueSummary(_0x31f958);return _0x1f5ff0[_0xfc83('0x6b')](_0x2a9e3b[_0xfc83('0x11')],this[_0xfc83('0x11')],_0xeb49fd,this[_0xfc83('0x6c')]['channels']);};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x6d')]=function(_0x317178,_0x354534){var _0x4196c5=this[_0xfc83('0x69')](_0x317178,_0x354534);var _0x5ade22=![];_0x5ade22=_0x4196c5[_0xfc83('0x6e')](_0x317178);if(_0x5ade22){Object[_0xfc83('0x6f')](_0x317178,_0x4196c5);this[_0xfc83('0x6c')]['voiceQueues'][_0x317178[_0xfc83('0x5f')]]=_0x317178;this[_0xfc83('0x5c')](_0x4196c5);}};VoiceQueueReport['prototype']['syncQueueStatusComplete']=function(_0x4997e1){var _0x7365de=null;var _0x42d843=this[_0xfc83('0x15')]['id'];if(this[_0xfc83('0x15')][_0xfc83('0x67')][_0x42d843]){_0x7365de=this[_0xfc83('0x15')][_0xfc83('0x67')][_0x42d843][_0x4997e1[_0xfc83('0x65')]];}if(!_0x7365de){this['summary']=initializeSummary();return;}var _0x1a0b99=this['voiceQueues'][_0x7365de[_0xfc83('0x55')]];if(_0x1a0b99['type']===_0xfc83('0x5d')){this[_0xfc83('0x6d')](_0x1a0b99,_0x7365de);}else if(_0x1a0b99[_0xfc83('0x70')]===_0xfc83('0x71')){var _0x329039=this[_0xfc83('0x69')](_0x1a0b99,_0x7365de);ami[_0xfc83('0x4d')](_0xfc83('0x72'),_0x329039);}this['summary']['statusRequests']-=0x1;var _0x2933c0=this[_0xfc83('0x15')]['statusRequests']>0x0?!![]:![];if(!_0x2933c0){return this[_0xfc83('0x73')](this[_0xfc83('0x15')][_0xfc83('0x74')]);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0xf2962b){var _0x56be8a=this[_0xfc83('0x15')]['id'];if(this[_0xfc83('0x15')][_0xfc83('0x67')][_0x56be8a]&&this['summary'][_0xfc83('0x67')][_0x56be8a][_0xf2962b[_0xfc83('0x65')]]){this[_0xfc83('0x15')][_0xfc83('0x67')][_0x56be8a][_0xf2962b[_0xfc83('0x65')]]['agents'][_0xfc83('0x75')](_0xf2962b);}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x18')]=function(_0x206186){var _0x30437a=this;try{if(this[_0xfc83('0x76')](_0x206186)&&this['isNotNull'](_0x206186['queue'])){logger[_0xfc83('0x4f')](_0xfc83('0x77'),util[_0xfc83('0x48')](_0x206186,{'showHidden':![],'depth':null}));var _0x12b4ce=this[_0xfc83('0x13')][_0x206186[_0xfc83('0x55')]];if(_0x12b4ce){logger[_0xfc83('0x4f')](_0xfc83('0x78'),_0x12b4ce[_0xfc83('0x5f')]);this[_0xfc83('0x15')]['queues'][_0x12b4ce[_0xfc83('0x5f')]]={'summaryEvent':_0x206186};this[_0xfc83('0x15')]['statusRequests']+=0x1;return ami[_0xfc83('0x41')]({'action':_0xfc83('0x67'),'queue':_0x12b4ce['name']})[_0xfc83('0x79')](function(_0x2af460){if(!_0x30437a[_0xfc83('0x15')][_0xfc83('0x67')][_0x206186['actionid']]){_0x30437a[_0xfc83('0x15')][_0xfc83('0x67')][_0x206186[_0xfc83('0x65')]]={};}_0x30437a[_0xfc83('0x15')][_0xfc83('0x67')][_0x206186[_0xfc83('0x65')]][_0x2af460['actionid']]={'queue':_0x12b4ce[_0xfc83('0x5f')],'agents':[]};})['catch'](function(_0x5a229e){throw _0x5a229e;});}}}catch(_0x1f9090){logger[_0xfc83('0x46')](_0xfc83('0x68'),util[_0xfc83('0x48')](_0x1f9090,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x73')]=function(_0x15fd1b){if(this[_0xfc83('0x15')][_0xfc83('0x7a')]>0x0){this[_0xfc83('0x15')][_0xfc83('0x74')]=_0x15fd1b;return;}logger[_0xfc83('0x4f')](_0xfc83('0x7b'),util['inspect'](_0x15fd1b,{'showHidden':![],'depth':null}));this[_0xfc83('0x15')]=initializeSummary();ami[_0xfc83('0x4d')]('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype'][_0xfc83('0x1e')]=function(_0x477845){try{if(this[_0xfc83('0x76')](_0x477845)){logger[_0xfc83('0x4f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x477845[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x477845,{'showHidden':![],'depth':null}));if(_[_0xfc83('0x61')](this[_0xfc83('0x10')][_0x477845[_0xfc83('0x52')]])){this[_0xfc83('0x10')][_0x477845[_0xfc83('0x52')]]=[];}if(_['isUndefined'](this[_0xfc83('0x3e')][_0x477845[_0xfc83('0x52')]])){this[_0xfc83('0x3e')][_0x477845[_0xfc83('0x52')]]={};}var _0x4b4b55=new QueueReport();_0x4b4b55[_0xfc83('0x55')]=_0x477845[_0xfc83('0x55')];_0x4b4b55[_0xfc83('0x70')]=this[_0xfc83('0x13')][_0x4b4b55[_0xfc83('0x55')]]&&this[_0xfc83('0x13')][_0x4b4b55[_0xfc83('0x55')]][_0xfc83('0x70')]?this[_0xfc83('0x13')][_0x4b4b55[_0xfc83('0x55')]][_0xfc83('0x70')]||_0xfc83('0x5d'):_0xfc83('0x5d');_0x4b4b55[_0xfc83('0x7c')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));_0x4b4b55[_0xfc83('0x7e')]=_0x477845[_0xfc83('0x7e')];_0x4b4b55['count']=_0x477845[_0xfc83('0x7f')];_0x4b4b55[_0xfc83('0x52')]=_0x477845['uniqueid'];logger[_0xfc83('0x80')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4b4b55[_0xfc83('0x55')],_0x4b4b55['type']);Object[_0xfc83('0x6f')](_0x4b4b55,_[_0xfc83('0x81')](_0x477845,_[_0xfc83('0x82')](_0x4b4b55)));this[_0xfc83('0x10')][_0x477845[_0xfc83('0x52')]][_0xfc83('0x75')](_0x4b4b55);this[_0xfc83('0x3e')][_0x477845[_0xfc83('0x52')]]=_0x4b4b55;this['emitVoiceQueueChannelSave'](_0x4b4b55,_0xfc83('0x83'));}}catch(_0x540ead){logger[_0xfc83('0x46')](_0xfc83('0x84'),_0x477845['uniqueid'],util[_0xfc83('0x48')](_0x540ead,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x1f')]=function(_0x4e4e75){try{if(this[_0xfc83('0x76')](_0x4e4e75)){logger['debug'](_0xfc83('0x85'),_0x4e4e75[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x4e4e75,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4e4e75['uniqueid']]){var _0x39be53=_[_0xfc83('0x86')](this[_0xfc83('0x10')][_0x4e4e75['uniqueid']]);_0x39be53[_0xfc83('0x3c')]=![];_0x39be53[_0xfc83('0x87')]=null;_0x39be53[_0xfc83('0x88')]=_0x4e4e75[_0xfc83('0x88')];_0x39be53[_0xfc83('0x89')]=_0x4e4e75[_0xfc83('0x89')];_0x39be53[_0xfc83('0x8a')]=!![];_0x39be53[_0xfc83('0x8b')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));_0x39be53['queuecallerexitreason']='ABANDONED';_0x39be53[_0xfc83('0x8c')]=null;logger[_0xfc83('0x80')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x39be53[_0xfc83('0x55')],_0x39be53[_0xfc83('0x70')]);this['channels'][_0x4e4e75['uniqueid']]=_0x39be53;this[_0xfc83('0x4c')](_0x39be53,'queuecallerabandon');}}}catch(_0xccd9d0){logger[_0xfc83('0x46')](_0xfc83('0x85'),_0x4e4e75[_0xfc83('0x52')],util[_0xfc83('0x48')](_0xccd9d0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x21')]=function(_0x4d6c9c){try{if(this[_0xfc83('0x76')](_0x4d6c9c)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x4d6c9c[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x4d6c9c,{'showHidden':![],'depth':null}));if(this[_0xfc83('0x10')][_0x4d6c9c[_0xfc83('0x52')]]){var _0x5f0d5f=_[_0xfc83('0x86')](this[_0xfc83('0x10')][_0x4d6c9c[_0xfc83('0x52')]]);_0x5f0d5f[_0xfc83('0x8d')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));_0x5f0d5f[_0xfc83('0x8e')]=_0x4d6c9c['connectedlinenum'];_0x5f0d5f[_0xfc83('0x8f')]=_0x4d6c9c[_0xfc83('0x8f')];logger[_0xfc83('0x80')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5f0d5f[_0xfc83('0x55')],_0x5f0d5f['type'],_0x4d6c9c[_0xfc83('0x8e')],_0x4d6c9c[_0xfc83('0x8f')]);this[_0xfc83('0x3e')][_0x4d6c9c[_0xfc83('0x52')]]=_0x5f0d5f;this['emitVoiceQueueChannelSave'](_0x5f0d5f,_0xfc83('0x20'));}}}catch(_0x1199b8){logger[_0xfc83('0x46')](_0xfc83('0x90'),_0x4d6c9c[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x1199b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x25')]=function(_0x536f4e){try{if(this[_0xfc83('0x76')](_0x536f4e)){logger[_0xfc83('0x4f')](_0xfc83('0x91'),_0x536f4e[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x536f4e,{'showHidden':![],'depth':null}));if(this[_0xfc83('0x10')][_0x536f4e['uniqueid']]){var _0x16231d=_[_0xfc83('0x86')](this['queueReports'][_0x536f4e[_0xfc83('0x52')]]);_0x16231d[_0xfc83('0x3c')]=!![];_0x16231d[_0xfc83('0x58')]=_0xfc83('0x92');logger['info'](_0xfc83('0x93'),_0x16231d[_0xfc83('0x55')],_0x16231d[_0xfc83('0x70')]);}}}catch(_0x4600f2){logger['error'](_0xfc83('0x91'),_0x536f4e[_0xfc83('0x52')],util['inspect'](_0x4600f2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x23')]=function(_0x27c489){try{if(this[_0xfc83('0x76')](_0x27c489)){logger[_0xfc83('0x4f')]('[%s][voiceQueueReport][agentcomplete]',_0x27c489[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x27c489,{'showHidden':![],'depth':null}));if(this[_0xfc83('0x10')][_0x27c489[_0xfc83('0x52')]]){var _0x1490e8=_[_0xfc83('0x86')](this[_0xfc83('0x10')][_0x27c489[_0xfc83('0x52')]]);_0x1490e8[_0xfc83('0x8a')]=![];_0x1490e8[_0xfc83('0x8b')]=null;_0x1490e8['assigned']=!![];_0x1490e8[_0xfc83('0x8c')]=_0x27c489[_0xfc83('0x94')];_0x1490e8['holdtime']=_0x27c489['holdtime'];_0x1490e8[_0xfc83('0x3c')]=!![];_0x1490e8[_0xfc83('0x3b')]=![];_0x1490e8['queuecallerexitAt']=null;if(!_0x1490e8[_0xfc83('0x95')]){if(_0x27c489[_0xfc83('0x96')]=='transfer'){_0x1490e8[_0xfc83('0x58')]=_0xfc83('0x97');logger[_0xfc83('0x80')](_0xfc83('0x98'),_0x1490e8['queue'],_0x1490e8[_0xfc83('0x70')]);}else{if(_[_0xfc83('0x99')](_0x27c489['channel'][_0xfc83('0x9a')](),_0xfc83('0x9b'))){if(this['queueReports'][_0x27c489['linkedid']]){var _0x297904=_['last'](this[_0xfc83('0x10')][_0x27c489[_0xfc83('0x9c')]]);_0x297904[_0xfc83('0x3c')]=![];_0x297904[_0xfc83('0x3b')]=!![];_0x297904['queuecallerexitAt']=moment(_0x1490e8[_0xfc83('0x7c')])[_0xfc83('0x9d')](_0x27c489['holdtime'],_0xfc83('0x9e'))[_0xfc83('0x53')](_0xfc83('0x7d'));_0x297904[_0xfc83('0x58')]=_0xfc83('0x9f');_0x297904['transfer']=!![];_0x297904[_0xfc83('0xa0')]=_0xfc83('0xa1');_0x297904[_0xfc83('0xa2')]=_0x27c489[_0xfc83('0xa3')];_0x297904['transferuniqueid']=_0x27c489['uniqueid'];logger[_0xfc83('0x80')](_0xfc83('0xa4'),_0x297904['queue'],_0x297904[_0xfc83('0x70')]);var _0x4509cb=this[_0xfc83('0x10')][_0x27c489['linkedid']];this[_0xfc83('0x10')][_0x27c489[_0xfc83('0x9c')]]=this['queueReports'][_0x27c489[_0xfc83('0x52')]];this[_0xfc83('0x10')][_0x27c489[_0xfc83('0x52')]]=_0x4509cb;}}else{_0x1490e8[_0xfc83('0x58')]='COMPLETEDBY'+_0x27c489[_0xfc83('0x96')]['toUpperCase']();logger[_0xfc83('0x80')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1490e8[_0xfc83('0x55')],_0x1490e8[_0xfc83('0x70')],_0x1490e8[_0xfc83('0x58')]);}}}this[_0xfc83('0x3e')][_0x27c489['uniqueid']]=_0x1490e8;}}}catch(_0x461f2a){logger[_0xfc83('0x46')]('[%s][voiceQueueReport][agentcomplete]',_0x27c489['uniqueid'],util[_0xfc83('0x48')](_0x461f2a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x27')]=function(_0xc96c99){try{if(this[_0xfc83('0x76')](_0xc96c99)){logger[_0xfc83('0x4f')](_0xfc83('0xa5'),_0xc96c99['uniqueid'],util['inspect'](_0xc96c99,{'showHidden':![],'depth':null}));this['addVariable'](_0xc96c99['uniqueid'],_[_0xfc83('0x82')](_0xc96c99['variable'])[0x0],_0xc96c99[_0xfc83('0xa6')]);if(this['queueReports'][_0xc96c99[_0xfc83('0x52')]]){var _0x1759f3=_[_0xfc83('0x86')](this[_0xfc83('0x10')][_0xc96c99[_0xfc83('0x52')]]);if(_0x1759f3){if(this['isNotNull'](_0xc96c99[_0xfc83('0xa7')])&&this[_0xfc83('0x76')](_0xc96c99[_0xfc83('0xa7')][_0xfc83('0x67')])){switch(_0xc96c99[_0xfc83('0xa6')]){case _0xfc83('0xa8'):_0x1759f3[_0xfc83('0x3b')]=![];_0x1759f3[_0xfc83('0xa9')]=null;break;case'TIMEOUT':_0x1759f3[_0xfc83('0xaa')]=_0xfc83('0xab');_0x1759f3['queuecallerexit']=!![];_0x1759f3[_0xfc83('0xa9')]=moment()['format'](_0xfc83('0x7d'));_0x1759f3[_0xfc83('0x8d')]=moment()[_0xfc83('0x53')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xfc83('0x4f')](_0xfc83('0xac'),_0xc96c99[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x1759f3,{'showHidden':![],'depth':null}));ami[_0xfc83('0x4d')](_0xfc83('0xad'),_0x1759f3);break;default:_0x1759f3[_0xfc83('0x3b')]=!![];_0x1759f3['queuecallerexitAt']=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));_0x1759f3[_0xfc83('0x8d')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));}_0x1759f3[_0xfc83('0x8a')]=![];_0x1759f3['queuecallerabandonAt']=null;_0x1759f3[_0xfc83('0x58')]=_0xc96c99[_0xfc83('0xa6')];this['channels'][_0xc96c99[_0xfc83('0x52')]]=_0x1759f3;this[_0xfc83('0x4c')](_0x1759f3,'varset');}else if(this[_0xfc83('0x76')](_0xc96c99[_0xfc83('0xa7')])&&this[_0xfc83('0x76')](_0xc96c99['variable'][_0xfc83('0xae')])){if(!_0x1759f3[_0xfc83('0x8a')]){_0x1759f3['queuecallerexit']=!![];_0x1759f3[_0xfc83('0xa9')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));_0x1759f3[_0xfc83('0x58')]=_0xfc83('0xaf');_0x1759f3[_0xfc83('0x8d')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));this[_0xfc83('0x3e')][_0xc96c99[_0xfc83('0x52')]]=_0x1759f3;}}logger[_0xfc83('0x80')](_0xfc83('0xb0'),_0xc96c99['uniqueid'],_0x1759f3['queue'],_0x1759f3[_0xfc83('0x70')],_['keys'](_0xc96c99[_0xfc83('0xa7')])[0x0],_0xc96c99[_0xfc83('0xa6')]);_0x1759f3[_0xfc83('0x16')]=this[_0xfc83('0x16')][_0xc96c99[_0xfc83('0x52')]];}}}}catch(_0x1fc33d){logger[_0xfc83('0x46')](_0xfc83('0xa5'),_0xc96c99[_0xfc83('0x52')],util['inspect'](_0x1fc33d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0xb1')]=function(_0x1447c8,_0x185a36,_0x19e962){var _0x379b94=[_0xfc83('0xb2'),_0xfc83('0xb3'),_0xfc83('0xb4'),'rtpaudioqosjitterbridged',_0xfc83('0xb5'),_0xfc83('0xb6'),'rtpaudioqosrtt',_0xfc83('0xb7'),_0xfc83('0xb8'),'sipuri','bridgepeer','bridgepvtcallid','membercalls',_0xfc83('0xb9'),_0xfc83('0xba'),_0xfc83('0xbb'),_0xfc83('0x94'),_0xfc83('0xbc'),_0xfc83('0xbd')];if(!_[_0xfc83('0x40')](_0x185a36)&&!_[_0xfc83('0xbe')](_0x379b94,_0x185a36)){if(_[_0xfc83('0x61')](this[_0xfc83('0x16')][_0x1447c8])){this[_0xfc83('0x16')][_0x1447c8]={};}this[_0xfc83('0x16')][_0x1447c8][_0x185a36]=_0x19e962;}};VoiceQueueReport['prototype'][_0xfc83('0xbf')]=function(_0x4f56c1,_0x160bc0,_0xfcb9b7){try{var _0x3d0eb9={};if(this[_0xfc83('0x10')][_0x4f56c1]){for(var _0x188384=0x0;_0x188384{delete this[_0xfc83('0x3e')][_0x510b18];},_0x369cfe);}};module['exports']=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index cab581e..465de6b 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc53c=['Request','CreateReportAgentPreview','../client','createHistory','campaign','queue'];(function(_0x5abef4,_0x5622c7){var _0x3f7c20=function(_0x156246){while(--_0x156246){_0x5abef4['push'](_0x5abef4['shift']());}};_0x3f7c20(++_0x5622c7);}(_0xc53c,0xe0));var _0xcc53=function(_0x245c42,_0x1953e7){_0x245c42=_0x245c42-0x0;var _0x243649=_0xc53c[_0x245c42];return _0x243649;};'use strict';var client=require(_0xcc53('0x0'));exports[_0xcc53('0x1')]=function(_0x451c2b){return function(){_0x451c2b[_0xcc53('0x2')]=_0x451c2b[_0xcc53('0x3')];return client[_0xcc53('0x4')](_0xcc53('0x5'),{'body':_0x451c2b,'log':_0xcc53('0x5')});};}; \ No newline at end of file +var _0x0e08=['queue','../client','createHistory'];(function(_0x866e2f,_0x5a91d4){var _0x50ad80=function(_0x2c8d00){while(--_0x2c8d00){_0x866e2f['push'](_0x866e2f['shift']());}};_0x50ad80(++_0x5a91d4);}(_0x0e08,0x8b));var _0x80e0=function(_0x3e8f4c,_0x249f6d){_0x3e8f4c=_0x3e8f4c-0x0;var _0x1b00ae=_0x0e08[_0x3e8f4c];return _0x1b00ae;};'use strict';var client=require(_0x80e0('0x0'));exports[_0x80e0('0x1')]=function(_0x434ae8){return function(){_0x434ae8['campaign']=_0x434ae8[_0x80e0('0x2')];return client['Request']('CreateReportAgentPreview',{'body':_0x434ae8,'log':'CreateReportAgentPreview'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index c150fdb..4b28d5b 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9cc0=['CreateAttachment','../client','create','Request'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x9cc0,0x81));var _0x09cc=function(_0x1c7586,_0x1d46bd){_0x1c7586=_0x1c7586-0x0;var _0x3bd9a1=_0x9cc0[_0x1c7586];return _0x3bd9a1;};'use strict';var client=require(_0x09cc('0x0'));exports[_0x09cc('0x1')]=function(_0x3feac3){return client[_0x09cc('0x2')](_0x09cc('0x3'),{'body':_0x3feac3,'log':_0x09cc('0x3')});}; \ No newline at end of file +var _0x3695=['../client'];(function(_0x372df5,_0x4c3340){var _0x55d332=function(_0x3890ca){while(--_0x3890ca){_0x372df5['push'](_0x372df5['shift']());}};_0x55d332(++_0x4c3340);}(_0x3695,0x1df));var _0x5369=function(_0x4b56e9,_0x24f7d4){_0x4b56e9=_0x4b56e9-0x0;var _0x459cec=_0x3695[_0x4b56e9];return _0x459cec;};'use strict';var client=require(_0x5369('0x0'));exports['create']=function(_0x133f75){return client['Request']('CreateAttachment',{'body':_0x133f75,'log':'CreateAttachment'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 0685d59..0c19293 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','Trunk','callerid','TrunkBackup','Interval','Intervals','interval','SquareProject','../client','getCampaigns','Request','GetCampaign','name','type','active','limitCalls'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5e6d0c,_0x9668fc){_0x5e6d0c=_0x5e6d0c-0x0;var _0x37e3a6=_0x5f2f[_0x5e6d0c];return _0x37e3a6;};'use strict';var client=require(_0xf5f2('0x0'));exports[_0xf5f2('0x1')]=function(){return function(){return client[_0xf5f2('0x2')](_0xf5f2('0x3'),{'options':{'raw':![],'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'dialNoAnswerRetryFrequency',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'dialDropMaxRetry',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'dialMachineMaxRetry',_0xf5f2('0x14'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0xf5f2('0x15'),_0xf5f2('0x16'),'dialAMDActive',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'dialAMDMaximumNumberOfWords',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21'),'dialCutDigit'],'include':[{'model':_0xf5f2('0x22'),'as':_0xf5f2('0x22'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x23'),_0xf5f2('0x6')]},{'model':_0xf5f2('0x22'),'as':_0xf5f2('0x24'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x23'),_0xf5f2('0x6')]},{'model':_0xf5f2('0x25'),'as':_0xf5f2('0x25'),'attributes':['id',_0xf5f2('0x4')],'include':[{'model':_0xf5f2('0x25'),'as':_0xf5f2('0x26'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x27')]}]},{'model':'SquareProject','as':_0xf5f2('0x28'),'attributes':['id',_0xf5f2('0x4')]}]},'log':'getCampaign'});};}; \ No newline at end of file +var _0x7a54=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','callerid','active','Interval','Intervals','interval','SquareProject','../client','getCampaigns','Request','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry'];(function(_0x2c052d,_0x28f3e0){var _0x30ea3c=function(_0x178756){while(--_0x178756){_0x2c052d['push'](_0x2c052d['shift']());}};_0x30ea3c(++_0x28f3e0);}(_0x7a54,0x106));var _0x47a5=function(_0x6b1cc9,_0x3b49d1){_0x6b1cc9=_0x6b1cc9-0x0;var _0x5dbce6=_0x7a54[_0x6b1cc9];return _0x5dbce6;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(){return client[_0x47a5('0x2')]('GetCampaign',{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),_0x47a5('0x4'),'active',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'dialCongestionRetryFrequency',_0x47a5('0xa'),'dialBusyRetryFrequency',_0x47a5('0xb'),_0x47a5('0xc'),'dialGlobalMaxRetry',_0x47a5('0xd'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency',_0x47a5('0xe'),_0x47a5('0xf'),'dialMachineMaxRetry',_0x47a5('0x10'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'dialAMDMinWordLength',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f')],'include':[{'model':'Trunk','as':_0x47a5('0x20'),'attributes':['id',_0x47a5('0x3'),_0x47a5('0x21'),_0x47a5('0x22')]},{'model':_0x47a5('0x20'),'as':'TrunkBackup','attributes':['id','name',_0x47a5('0x21'),'active']},{'model':'Interval','as':_0x47a5('0x23'),'attributes':['id',_0x47a5('0x3')],'include':[{'model':_0x47a5('0x23'),'as':_0x47a5('0x24'),'attributes':['id',_0x47a5('0x3'),_0x47a5('0x25')]}]},{'model':_0x47a5('0x26'),'as':_0x47a5('0x26'),'attributes':['id',_0x47a5('0x3')]}]},'log':'getCampaign'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index e288077..3849d7d 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cd8=['CreateCmContact','getContacts','GetCmContact','../client','createContact','Request'];(function(_0x535d2e,_0x5392e1){var _0x1bdca5=function(_0x920f8b){while(--_0x920f8b){_0x535d2e['push'](_0x535d2e['shift']());}};_0x1bdca5(++_0x5392e1);}(_0x4cd8,0x87));var _0x84cd=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x4cd8[_0x5caf7e];return _0x5c3435;};'use strict';var client=require(_0x84cd('0x0'));exports[_0x84cd('0x1')]=function(_0x12416d){return function(){return client[_0x84cd('0x2')]('CreateCmContact',{'body':_0x12416d,'log':_0x84cd('0x3')});};};exports[_0x84cd('0x4')]=function(_0x16b28a){return function(){return client[_0x84cd('0x2')](_0x84cd('0x5'),{'options':_0x16b28a,'log':_0x84cd('0x5')});};}; \ No newline at end of file +var _0xedcb=['createContact','Request','CreateCmContact','getContacts','GetCmContact'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xedcb,0x1c7));var _0xbedc=function(_0x47b89f,_0x13f5de){_0x47b89f=_0x47b89f-0x0;var _0x1d5963=_0xedcb[_0x47b89f];return _0x1d5963;};'use strict';var client=require('../client');exports[_0xbedc('0x0')]=function(_0x1d6964){return function(){return client[_0xbedc('0x1')]('CreateCmContact',{'body':_0x1d6964,'log':_0xbedc('0x2')});};};exports[_0xbedc('0x3')]=function(_0x395b77){return function(){return client['Request'](_0xbedc('0x4'),{'options':_0x395b77,'log':_0xbedc('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 240d86e..17445e6 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31af=['GetCmHopperPreview','name','VoiceQueue','Queue','unlockContact','User','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','Request','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','format','priority','DESC','scheduledat','ASC','getContactDialerIvr','GetContactDialerIvr','moveContactManagedDialer','campaign','MoveContactManagedDialer','CountReScheduled','countReScheduled'];(function(_0x200f86,_0x1163f2){var _0x597e59=function(_0x18a4eb){while(--_0x18a4eb){_0x200f86['push'](_0x200f86['shift']());}};_0x597e59(++_0x1163f2);}(_0x31af,0xde));var _0xf31a=function(_0x399146,_0x58dd4c){_0x399146=_0x399146-0x0;var _0x32fbb7=_0x31af[_0x399146];return _0x32fbb7;};'use strict';var client=require(_0xf31a('0x0'));var moment=require(_0xf31a('0x1'));exports[_0xf31a('0x2')]=function(_0x4d5e50,_0x5f5639){return function(){return client[_0xf31a('0x3')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x4d5e50},'include':[{'model':_0xf31a('0x4'),'as':_0xf31a('0x5')}],'limit':_0x5f5639,'raw':![]},'log':_0xf31a('0x6')});};};exports[_0xf31a('0x7')]=function(_0x5ad096,_0x8d7853,_0x209fcc){return function(){return client[_0xf31a('0x3')](_0xf31a('0x8'),{'body':_0x5ad096,'options':{'where':{'VoiceQueueId':_0x8d7853,'scheduledat':{'$lte':moment()['format'](_0xf31a('0x9'))}},'limit':_0x209fcc},'log':_0xf31a('0x8')});};};exports[_0xf31a('0xa')]=function(_0xee6b4a){return client['Request'](_0xf31a('0x8'),{'body':_0xee6b4a,'options':{'where':{'ContactId':_0xee6b4a[_0xf31a('0xb')],'ListId':_0xee6b4a[_0xf31a('0xc')],'VoiceQueueId':_0xee6b4a[_0xf31a('0xd')],'CampaignId':_0xee6b4a[_0xf31a('0xe')]}},'log':'rescheduleContact'});};exports[_0xf31a('0xf')]=function(_0x1e31d3,_0x40d344,_0x3f0cc8){return function(){return client['Request'](_0xf31a('0x10'),{'options':{'where':{'VoiceQueueId':_0x1e31d3,'ListId':_0x40d344,'ContactId':_0x3f0cc8}},'log':_0xf31a('0x10')});};};exports['getContactDialer']=function(_0x355f32,_0x46345c,_0x46bdd3,_0x18d266){return client[_0xf31a('0x3')](_0xf31a('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x355f32,'active':![],'scheduledat':{'$lte':moment()[_0xf31a('0x12')](_0xf31a('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x46345c}}]},'order':[[_0xf31a('0x13'),_0xf31a('0x14')],[_0xf31a('0x15'),_0x18d266],['id',_0xf31a('0x16')]],'raw':!![],'limit':_0x46bdd3},'log':_0xf31a('0x11')});};exports[_0xf31a('0x17')]=function(_0x1429c8,_0x5c40bc,_0x454836){return client[_0xf31a('0x3')](_0xf31a('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x1429c8,'active':![],'scheduledat':{'$lte':moment()[_0xf31a('0x12')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0xf31a('0x4'),'as':_0xf31a('0x5')}],'order':[[_0xf31a('0x13'),_0xf31a('0x14')],[_0xf31a('0x15'),_0x454836],['id','ASC']],'raw':!![],'limit':_0x5c40bc},'log':_0xf31a('0x18')});};exports[_0xf31a('0x19')]=function(_0x5861df,_0x22c9c3){_0x5861df[_0xf31a('0x1a')]=_0x5861df['queue'];return client[_0xf31a('0x3')](_0xf31a('0x1b'),{'body':_0x5861df,'options':{'where':{'ContactId':_0x5861df['ContactId'],'ListId':_0x5861df['ListId'],'VoiceQueueId':_0x5861df['VoiceQueueId'],'CampaignId':_0x5861df[_0xf31a('0xe')],'active':_0x22c9c3?undefined:!![]}},'log':_0xf31a('0x1b')});};exports['countReScheduled']=function(_0x41d359){return client[_0xf31a('0x3')](_0xf31a('0x1c'),{'options':{'where':{'VoiceQueueId':_0x41d359['id']?_0x41d359['id']||null:null}},'log':_0xf31a('0x1d')});};exports['getContactPreview']=function(_0x5d8083){return function(){return client[_0xf31a('0x3')](_0xf31a('0x1e'),{'options':{'where':{'id':_0x5d8083},'include':[{'model':'CmContact','as':'Contact'},{'model':'User','as':'Agent','attributes':['id',_0xf31a('0x1f')]},{'model':_0xf31a('0x20'),'as':_0xf31a('0x21'),'attributes':['id','name']}],'raw':!![]},'log':_0xf31a('0x6')});};};exports[_0xf31a('0x22')]=function(_0x125e98,_0x2aa749,_0x347a20){return client['Request'](_0xf31a('0x8'),{'body':_0x125e98,'options':{'where':{'id':_0x2aa749},'limit':_0x347a20},'log':_0xf31a('0x8')});};exports['getContactRecallMe']=function(_0x52da7d,_0x203f28){return function(){return client[_0xf31a('0x3')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x52da7d,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xf31a('0x12')](_0xf31a('0x9'))},'UserId':{'$in':_0x203f28}},'order':[[_0xf31a('0x13'),'DESC'],[_0xf31a('0x15'),_0xf31a('0x14')],['id',_0xf31a('0x16')]],'include':[{'model':_0xf31a('0x4'),'as':_0xf31a('0x5')},{'model':_0xf31a('0x23'),'as':'Agent','attributes':['id',_0xf31a('0x1f'),_0xf31a('0x24')]}],'group':_0xf31a('0x25'),'raw':!![]},'log':_0xf31a('0x11')});};};exports[_0xf31a('0x26')]=function(_0x42d1a6,_0xfd9c73){return client[_0xf31a('0x3')](_0xf31a('0x27'),{'body':_0x42d1a6,'options':_0xfd9c73||{},'log':_0xf31a('0x27')});};exports[_0xf31a('0x28')]=function(_0x31ccee,_0x315947,_0x25cd42){return function(){return client[_0xf31a('0x3')](_0xf31a('0x29'),{'body':{'where':{'voiceQueueIds':_0x31ccee,'interval':_0x315947,'availableAgentsIds':_0x25cd42}},'log':_0xf31a('0x28')});};}; \ No newline at end of file +var _0x88b0=['GetCmHopper','CmContact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ListId','CampaignId','DestroyCmHopper','getContactDialer','GetContactDialer','priority','scheduledat','ASC','getContactDialerIvr','DESC','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','VoiceQueueId','countReScheduled','getContactPreview','GetCmHopperPreview','Contact','User','Agent','VoiceQueue','Queue','name','unlockContact','getContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','Request'];(function(_0x30e2d1,_0xf999eb){var _0x5848b1=function(_0x21ab91){while(--_0x21ab91){_0x30e2d1['push'](_0x30e2d1['shift']());}};_0x5848b1(++_0xf999eb);}(_0x88b0,0x1cb));var _0x088b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x88b0[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x088b('0x0'));var moment=require(_0x088b('0x1'));exports['getContacts']=function(_0x550558,_0x3f8d4a){return function(){return client[_0x088b('0x2')](_0x088b('0x3'),{'options':{'where':{'VoiceQueueId':_0x550558},'include':[{'model':_0x088b('0x4'),'as':'Contact'}],'limit':_0x3f8d4a,'raw':![]},'log':_0x088b('0x5')});};};exports[_0x088b('0x6')]=function(_0xc1e9cd,_0x5af8a4,_0x4a9986){return function(){return client[_0x088b('0x2')](_0x088b('0x7'),{'body':_0xc1e9cd,'options':{'where':{'VoiceQueueId':_0x5af8a4,'scheduledat':{'$lte':moment()[_0x088b('0x8')](_0x088b('0x9'))}},'limit':_0x4a9986},'log':_0x088b('0x7')});};};exports[_0x088b('0xa')]=function(_0x40436c){return client['Request'](_0x088b('0x7'),{'body':_0x40436c,'options':{'where':{'ContactId':_0x40436c['ContactId'],'ListId':_0x40436c[_0x088b('0xb')],'VoiceQueueId':_0x40436c['VoiceQueueId'],'CampaignId':_0x40436c[_0x088b('0xc')]}},'log':_0x088b('0xa')});};exports['destroyContact']=function(_0x4b6d34,_0x278ce,_0x290c6c){return function(){return client[_0x088b('0x2')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x4b6d34,'ListId':_0x278ce,'ContactId':_0x290c6c}},'log':_0x088b('0xd')});};};exports[_0x088b('0xe')]=function(_0x1ea6d7,_0x4fa81a,_0x1d2829,_0x2a1e5c){return client[_0x088b('0x2')](_0x088b('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1ea6d7,'active':![],'scheduledat':{'$lte':moment()[_0x088b('0x8')](_0x088b('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4fa81a}}]},'order':[[_0x088b('0x10'),'DESC'],[_0x088b('0x11'),_0x2a1e5c],['id',_0x088b('0x12')]],'raw':!![],'limit':_0x1d2829},'log':_0x088b('0xf')});};exports[_0x088b('0x13')]=function(_0x41bf62,_0x2e47af,_0x54a27e){return client[_0x088b('0x2')](_0x088b('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x41bf62,'active':![],'scheduledat':{'$lte':moment()[_0x088b('0x8')](_0x088b('0x9'))}},'include':[{'model':_0x088b('0x4'),'as':'Contact'}],'order':[['priority',_0x088b('0x14')],[_0x088b('0x11'),_0x54a27e],['id',_0x088b('0x12')]],'raw':!![],'limit':_0x2e47af},'log':_0x088b('0x15')});};exports[_0x088b('0x16')]=function(_0x6ecfbe,_0x565220){_0x6ecfbe[_0x088b('0x17')]=_0x6ecfbe[_0x088b('0x18')];return client[_0x088b('0x2')]('MoveContactManagedDialer',{'body':_0x6ecfbe,'options':{'where':{'ContactId':_0x6ecfbe['ContactId'],'ListId':_0x6ecfbe[_0x088b('0xb')],'VoiceQueueId':_0x6ecfbe[_0x088b('0x19')],'CampaignId':_0x6ecfbe[_0x088b('0xc')],'active':_0x565220?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports[_0x088b('0x1a')]=function(_0xcfc1c6){return client['Request']('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0xcfc1c6['id']?_0xcfc1c6['id']||null:null}},'log':'countReScheduled'});};exports[_0x088b('0x1b')]=function(_0x4e88fb){return function(){return client[_0x088b('0x2')](_0x088b('0x1c'),{'options':{'where':{'id':_0x4e88fb},'include':[{'model':_0x088b('0x4'),'as':_0x088b('0x1d')},{'model':_0x088b('0x1e'),'as':_0x088b('0x1f'),'attributes':['id','name']},{'model':_0x088b('0x20'),'as':_0x088b('0x21'),'attributes':['id',_0x088b('0x22')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x088b('0x23')]=function(_0x1ab855,_0x1a668b,_0x3ed176){return client['Request']('UpdateCmHopper',{'body':_0x1ab855,'options':{'where':{'id':_0x1a668b},'limit':_0x3ed176},'log':_0x088b('0x7')});};exports[_0x088b('0x24')]=function(_0x3921c8,_0x193a00){return function(){return client[_0x088b('0x2')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x3921c8,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x088b('0x8')](_0x088b('0x9'))},'UserId':{'$in':_0x193a00}},'order':[[_0x088b('0x10'),_0x088b('0x14')],[_0x088b('0x11'),'DESC'],['id',_0x088b('0x12')]],'include':[{'model':_0x088b('0x4'),'as':_0x088b('0x1d')},{'model':_0x088b('0x1e'),'as':_0x088b('0x1f'),'attributes':['id',_0x088b('0x22'),_0x088b('0x25')]}],'group':_0x088b('0x26'),'raw':!![]},'log':_0x088b('0xf')});};};exports[_0x088b('0x27')]=function(_0x46c0c0,_0x58daf0){return client[_0x088b('0x2')](_0x088b('0x28'),{'body':_0x46c0c0,'options':_0x58daf0||{},'log':_0x088b('0x28')});};exports[_0x088b('0x29')]=function(_0x4e2ed8,_0x15b694,_0x5a7a9f){return function(){return client[_0x088b('0x2')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x4e2ed8,'interval':_0x15b694,'availableAgentsIds':_0x5a7a9f}},'log':_0x088b('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 24d938a..fbbadc4 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b2f=['VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request'];(function(_0x13b70c,_0x40be1c){var _0x2d0edd=function(_0x485ea4){while(--_0x485ea4){_0x13b70c['push'](_0x13b70c['shift']());}};_0x2d0edd(++_0x40be1c);}(_0x9b2f,0x6d));var _0xf9b2=function(_0x3186aa,_0x34c21e){_0x3186aa=_0x3186aa-0x0;var _0x2d8c36=_0x9b2f[_0x3186aa];return _0x2d8c36;};'use strict';var client=require(_0xf9b2('0x0'));exports[_0xf9b2('0x1')]=function(_0x5d7f78,_0x4000bb,_0x32e7f8){return client[_0xf9b2('0x2')](_0xf9b2('0x3'),{'body':_0x5d7f78,'reason':_0x4000bb,'entity':_0x32e7f8,'log':_0xf9b2('0x3')});};exports[_0xf9b2('0x4')]=function(_0x5b2bc2,_0x550546,_0x219355){return client[_0xf9b2('0x2')](_0xf9b2('0x5'),{'body':_0x5b2bc2,'duration':_0x550546,'waitTime':_0x219355,'log':_0xf9b2('0x5')});};exports[_0xf9b2('0x6')]=function(_0x6d9a1c){return function(){return client[_0xf9b2('0x2')]('IncrementPreviewCounters',{'body':_0x6d9a1c,'log':_0xf9b2('0x7')});};}; \ No newline at end of file +var _0xb5c3=['VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','IncrementPreviewCounters','verifyAdditionalPhones','Request'];(function(_0x27dca2,_0x3cb87f){var _0x44d252=function(_0x15c430){while(--_0x15c430){_0x27dca2['push'](_0x27dca2['shift']());}};_0x44d252(++_0x3cb87f);}(_0xb5c3,0xfa));var _0x3b5c=function(_0x28b2dd,_0x54ec7c){_0x28b2dd=_0x28b2dd-0x0;var _0x3bc8a2=_0xb5c3[_0x28b2dd];return _0x3bc8a2;};'use strict';var client=require('../client');exports[_0x3b5c('0x0')]=function(_0x544b97,_0x942db2,_0x3d5a32){return client[_0x3b5c('0x1')](_0x3b5c('0x2'),{'body':_0x544b97,'reason':_0x942db2,'entity':_0x3d5a32,'log':_0x3b5c('0x2')});};exports[_0x3b5c('0x3')]=function(_0xb7537c,_0xa6042b,_0x385b01){return client[_0x3b5c('0x1')](_0x3b5c('0x4'),{'body':_0xb7537c,'duration':_0xa6042b,'waitTime':_0x385b01,'log':_0x3b5c('0x4')});};exports['incrementPreviewCounters']=function(_0x195473){return function(){return client[_0x3b5c('0x1')](_0x3b5c('0x5'),{'body':_0x195473,'log':_0x3b5c('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 3edf3e7..3cf8338 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9af=['checkIsBlackList','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','../client'];(function(_0x4251fd,_0x42c3e0){var _0x2aba9a=function(_0x4ed38e){while(--_0x4ed38e){_0x4251fd['push'](_0x4251fd['shift']());}};_0x2aba9a(++_0x42c3e0);}(_0xe9af,0x67));var _0xfe9a=function(_0x18eff0,_0x2fc591){_0x18eff0=_0x18eff0-0x0;var _0x5a13b3=_0xe9af[_0x18eff0];return _0x5a13b3;};'use strict';var client=require(_0xfe9a('0x0'));exports[_0xfe9a('0x1')]=function(_0x2290f9){return client['Request'](_0xfe9a('0x2'),{'options':{'where':{'VoiceQueueId':_0x2290f9[_0xfe9a('0x3')],'phone':_0x2290f9[_0xfe9a('0x4')]},'raw':![]},'log':_0xfe9a('0x2')});};exports[_0xfe9a('0x5')]=function(_0x5f46cd){return client['Request'](_0xfe9a('0x2'),{'options':{'where':{'CampaignId':_0x5f46cd[_0xfe9a('0x6')],'phone':_0x5f46cd['phone']},'raw':![]},'log':_0xfe9a('0x7')});}; \ No newline at end of file +var _0xe833=['phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','Request','GetCmHopperBlack'];(function(_0x681b6e,_0x31a5f9){var _0x379f1e=function(_0x15677d){while(--_0x15677d){_0x681b6e['push'](_0x681b6e['shift']());}};_0x379f1e(++_0x31a5f9);}(_0xe833,0xec));var _0x3e83=function(_0x1d8181,_0x41ecbc){_0x1d8181=_0x1d8181-0x0;var _0x1603d1=_0xe833[_0x1d8181];return _0x1603d1;};'use strict';var client=require(_0x3e83('0x0'));exports[_0x3e83('0x1')]=function(_0x4db4b6){return client[_0x3e83('0x2')](_0x3e83('0x3'),{'options':{'where':{'VoiceQueueId':_0x4db4b6['VoiceQueueId'],'phone':_0x4db4b6[_0x3e83('0x4')]},'raw':![]},'log':_0x3e83('0x3')});};exports[_0x3e83('0x5')]=function(_0x446a6d){return client[_0x3e83('0x2')](_0x3e83('0x3'),{'options':{'where':{'CampaignId':_0x446a6d[_0x3e83('0x6')],'phone':_0x446a6d[_0x3e83('0x4')]},'raw':![]},'log':_0x3e83('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 636a8bb..15c5845 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d77=['CreateCmHopperFinal','../client','campaign','Request'];(function(_0x2b6e62,_0x542ffd){var _0x787459=function(_0x4e923b){while(--_0x4e923b){_0x2b6e62['push'](_0x2b6e62['shift']());}};_0x787459(++_0x542ffd);}(_0x8d77,0x199));var _0x78d7=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x8d77[_0x5bd426];return _0x23a7eb;};'use strict';var client=require(_0x78d7('0x0'));exports['createContact']=function(_0x26cdcf){return function(){_0x26cdcf[_0x78d7('0x1')]=_0x26cdcf['queue'];return client[_0x78d7('0x2')](_0x78d7('0x3'),{'body':_0x26cdcf,'log':_0x78d7('0x3')});};}; \ No newline at end of file +var _0xca7f=['CreateCmHopperFinal','createContact','campaign','Request'];(function(_0x4a5222,_0xb36584){var _0x3df28f=function(_0x2128bf){while(--_0x2128bf){_0x4a5222['push'](_0x4a5222['shift']());}};_0x3df28f(++_0xb36584);}(_0xca7f,0x171));var _0xfca7=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xca7f[_0x2763f2];return _0x3ef471;};'use strict';var client=require('../client');exports[_0xfca7('0x0')]=function(_0x264cef){return function(){_0x264cef[_0xfca7('0x1')]=_0x264cef['queue'];return client[_0xfca7('0x2')]('CreateCmHopperFinal',{'body':_0x264cef,'log':_0xfca7('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index bee63d2..6ad06eb 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2317=['../client','createHistory','campaign','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day','endOf','queue','getCampaignHopperHistory','GetCampaignHopperHistory','ivr'];(function(_0x1cc423,_0x2da640){var _0x5cdea9=function(_0x2f5809){while(--_0x2f5809){_0x1cc423['push'](_0x1cc423['shift']());}};_0x5cdea9(++_0x2da640);}(_0x2317,0x69));var _0x7231=function(_0x3fc0d7,_0x4dbc8c){_0x3fc0d7=_0x3fc0d7-0x0;var _0x45147d=_0x2317[_0x3fc0d7];return _0x45147d;};'use strict';var client=require(_0x7231('0x0'));var moment=require('moment');exports[_0x7231('0x1')]=function(_0x36e99f){_0x36e99f[_0x7231('0x2')]=_0x36e99f['queue'];return client[_0x7231('0x3')](_0x7231('0x4'),{'body':_0x36e99f,'log':_0x7231('0x4')});};exports[_0x7231('0x5')]=function(_0x2078e9){return client[_0x7231('0x3')](_0x7231('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0x7231('0x7')](_0x2078e9,_0x7231('0x8'))[_0x7231('0x9')](_0x7231('0xa')),moment()[_0x7231('0x9')](_0x7231('0xa'))]}},'raw':![]},'log':_0x7231('0xb')});};exports[_0x7231('0xc')]=function(){return function(){return client[_0x7231('0x3')](_0x7231('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x7231('0xe')](_0x7231('0xf'))['format'](_0x7231('0xa')),moment()[_0x7231('0x10')](_0x7231('0xf'))['format'](_0x7231('0xa'))]},'campaigntype':_0x7231('0x11')},'raw':![]},'log':_0x7231('0xd')});};};exports[_0x7231('0x12')]=function(){return function(){return client[_0x7231('0x3')](_0x7231('0x13'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x7231('0xe')](_0x7231('0xf'))[_0x7231('0x9')](_0x7231('0xa')),moment()['endOf'](_0x7231('0xf'))[_0x7231('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x7231('0x14')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file +var _0x0046=['Request','CreateCmHopperHistory','avgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day','endOf','queue','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','../client','createHistory','campaign'];(function(_0x5a0430,_0x40b555){var _0x5187c2=function(_0x1c1679){while(--_0x1c1679){_0x5a0430['push'](_0x5a0430['shift']());}};_0x5187c2(++_0x40b555);}(_0x0046,0x1c9));var _0x6004=function(_0x1edfd6,_0x398afa){_0x1edfd6=_0x1edfd6-0x0;var _0x27f747=_0x0046[_0x1edfd6];return _0x27f747;};'use strict';var client=require(_0x6004('0x0'));var moment=require('moment');exports[_0x6004('0x1')]=function(_0xa78a38){_0xa78a38[_0x6004('0x2')]=_0xa78a38['queue'];return client[_0x6004('0x3')]('CreateCmHopperHistory',{'body':_0xa78a38,'log':_0x6004('0x4')});};exports[_0x6004('0x5')]=function(_0x10ce51){return client[_0x6004('0x3')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x6004('0x6')](_0x10ce51,_0x6004('0x7'))[_0x6004('0x8')](_0x6004('0x9')),moment()[_0x6004('0x8')](_0x6004('0x9'))]}},'raw':![]},'log':_0x6004('0xa')});};exports[_0x6004('0xb')]=function(){return function(){return client[_0x6004('0x3')](_0x6004('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x6004('0xd')](_0x6004('0xe'))[_0x6004('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x6004('0xf')](_0x6004('0xe'))[_0x6004('0x8')](_0x6004('0x9'))]},'campaigntype':_0x6004('0x10')},'raw':![]},'log':_0x6004('0xc')});};};exports[_0x6004('0x11')]=function(){return function(){return client[_0x6004('0x3')](_0x6004('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x6004('0xe'))['format'](_0x6004('0x9')),moment()[_0x6004('0xf')](_0x6004('0xe'))[_0x6004('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x6004('0x13')},'raw':![]},'log':_0x6004('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index aca6d98..5bc0a39 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a21=['tech','ListId','key','Trunk','callerid','active','getFaxAccount','notify','Request','NotifyFaxAccount','../client','GetFaxAccount','name','description','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8a21,0x1d8));var _0x18a2=function(_0x10b7de,_0x51cf9d){_0x10b7de=_0x10b7de-0x0;var _0xd51c81=_0x8a21[_0x10b7de];return _0xd51c81;};'use strict';var client=require(_0x18a2('0x0'));exports['getFaxAccounts']=function(){return function(){return client['Request'](_0x18a2('0x1'),{'options':{'raw':![],'attributes':['id',_0x18a2('0x2'),_0x18a2('0x3'),'ecm','headerinfo',_0x18a2('0x4'),_0x18a2('0x5'),_0x18a2('0x6'),_0x18a2('0x7'),_0x18a2('0x8'),_0x18a2('0x9'),_0x18a2('0xa'),_0x18a2('0xb'),'TrunkId',_0x18a2('0xc'),_0x18a2('0xd')],'include':[{'model':_0x18a2('0xe'),'as':'Trunk','attributes':['id',_0x18a2('0x2'),_0x18a2('0xf'),_0x18a2('0x10')]}]},'log':_0x18a2('0x11')});};};exports[_0x18a2('0x12')]=function(_0x54ce08,_0x44c60c){return client[_0x18a2('0x13')]('NotifyFaxAccount',{'account':{'id':_0x54ce08},'body':_0x44c60c,'log':_0x18a2('0x14')});}; \ No newline at end of file +var _0x2581=['localstationid','minrate','maxrate','modem','gateway','faxdetect','tech','TrunkId','ListId','key','Trunk','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','name','ecm','headerinfo'];(function(_0x49ab04,_0x5a01e){var _0x330fb2=function(_0x45bf7f){while(--_0x45bf7f){_0x49ab04['push'](_0x49ab04['shift']());}};_0x330fb2(++_0x5a01e);}(_0x2581,0xcb));var _0x1258=function(_0x1a2407,_0x29165a){_0x1a2407=_0x1a2407-0x0;var _0x1f1ea5=_0x2581[_0x1a2407];return _0x1f1ea5;};'use strict';var client=require(_0x1258('0x0'));exports[_0x1258('0x1')]=function(){return function(){return client[_0x1258('0x2')](_0x1258('0x3'),{'options':{'raw':![],'attributes':['id',_0x1258('0x4'),'description',_0x1258('0x5'),_0x1258('0x6'),_0x1258('0x7'),_0x1258('0x8'),_0x1258('0x9'),_0x1258('0xa'),_0x1258('0xb'),_0x1258('0xc'),'t38timeout',_0x1258('0xd'),_0x1258('0xe'),_0x1258('0xf'),_0x1258('0x10')],'include':[{'model':_0x1258('0x11'),'as':_0x1258('0x11'),'attributes':['id',_0x1258('0x4'),'callerid','active']}]},'log':_0x1258('0x12')});};};exports[_0x1258('0x13')]=function(_0x15eea2,_0x1fe32a){return client['Request'](_0x1258('0x14'),{'account':{'id':_0x15eea2},'body':_0x1fe32a,'log':_0x1258('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 8e8376a..94ee512 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x226e=['update','Request','UpdateFaxMessage','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x226e,0x1c7));var _0xe226=function(_0x3c21f3,_0x560e86){_0x3c21f3=_0x3c21f3-0x0;var _0x6ba1be=_0x226e[_0x3c21f3];return _0x6ba1be;};'use strict';var client=require(_0xe226('0x0'));exports[_0xe226('0x1')]=function(_0x473030,_0x2b92db){return client[_0xe226('0x2')](_0xe226('0x3'),{'body':_0x2b92db,'options':{'where':{'AttachmentId':_0x473030}},'log':_0xe226('0x3')});}; \ No newline at end of file +var _0x7d34=['../client','update','Request','UpdateFaxMessage'];(function(_0x140c76,_0x1c66eb){var _0x2f27bb=function(_0x667f9){while(--_0x667f9){_0x140c76['push'](_0x140c76['shift']());}};_0x2f27bb(++_0x1c66eb);}(_0x7d34,0x128));var _0x47d3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7d34[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x47d3('0x0'));exports[_0x47d3('0x1')]=function(_0x189035,_0x477aaf){return client[_0x47d3('0x2')](_0x47d3('0x3'),{'body':_0x477aaf,'options':{'where':{'AttachmentId':_0x189035}},'log':'UpdateFaxMessage'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 3ab2795..782e6c7 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5a9=['Tags','../../client','getDeskAccounts','password','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','content','variableName','Variable','name','key','DeskField','Fields','idField','nameField','customField','Tag'];(function(_0x1d0992,_0x19c94e){var _0x129b92=function(_0x3ccfed){while(--_0x3ccfed){_0x1d0992['push'](_0x1d0992['shift']());}};_0x129b92(++_0x19c94e);}(_0xc5a9,0x151));var _0x9c5a=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xc5a9[_0x62c958];return _0x57ec61;};'use strict';var client=require(_0x9c5a('0x0'));exports[_0x9c5a('0x1')]=function(){return function(_0x3027c6){return client['Request']('GetDeskAccount',{'options':{'raw':![],'attributes':['id','name','description','username',_0x9c5a('0x2'),_0x9c5a('0x3'),_0x9c5a('0x4'),_0x9c5a('0x5'),_0x9c5a('0x6')],'include':[{'model':_0x9c5a('0x7'),'as':_0x9c5a('0x8'),'attributes':['id','name'],'include':[{'model':'DeskField','as':'Subjects','attributes':['id',_0x9c5a('0x5'),_0x9c5a('0x9'),_0x9c5a('0xa')],'include':[{'model':_0x9c5a('0xb'),'as':'Variable','attributes':['id',_0x9c5a('0xc')]}]},{'model':'DeskField','as':'Descriptions','attributes':['id',_0x9c5a('0x5'),_0x9c5a('0x9'),_0x9c5a('0xd'),'keyType','keyContent','variableName'],'include':[{'model':_0x9c5a('0xb'),'as':_0x9c5a('0xb'),'attributes':['id',_0x9c5a('0xc')]}]},{'model':_0x9c5a('0xe'),'as':_0x9c5a('0xf'),'attributes':['id',_0x9c5a('0x5'),_0x9c5a('0x9'),_0x9c5a('0x10'),_0x9c5a('0x11'),_0x9c5a('0x12'),'variableName'],'include':[{'model':'Variable','as':_0x9c5a('0xb'),'attributes':['id',_0x9c5a('0xc')]}]},{'model':_0x9c5a('0x13'),'as':_0x9c5a('0x14'),'attributes':['id',_0x9c5a('0xc')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0xde36=['Fields','customField','Tag','Tags','../../client','getDeskAccounts','Request','GetDeskAccount','name','description','username','password','type','serverUrl','DeskConfiguration','DeskField','content','Variable','Descriptions','key','keyType','keyContent','variableName'];(function(_0x5ba38a,_0x132834){var _0x28eebe=function(_0x56946a){while(--_0x56946a){_0x5ba38a['push'](_0x5ba38a['shift']());}};_0x28eebe(++_0x132834);}(_0xde36,0x146));var _0x6de3=function(_0x492ebc,_0x42a9d2){_0x492ebc=_0x492ebc-0x0;var _0x3d6c9b=_0xde36[_0x492ebc];return _0x3d6c9b;};'use strict';var client=require(_0x6de3('0x0'));exports[_0x6de3('0x1')]=function(){return function(_0x38ae03){return client[_0x6de3('0x2')](_0x6de3('0x3'),{'options':{'raw':![],'attributes':['id',_0x6de3('0x4'),_0x6de3('0x5'),_0x6de3('0x6'),_0x6de3('0x7'),'remoteUri','authType',_0x6de3('0x8'),_0x6de3('0x9')],'include':[{'model':_0x6de3('0xa'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x6de3('0xb'),'as':'Subjects','attributes':['id','type',_0x6de3('0xc'),'variableName'],'include':[{'model':'Variable','as':_0x6de3('0xd'),'attributes':['id','name']}]},{'model':_0x6de3('0xb'),'as':_0x6de3('0xe'),'attributes':['id',_0x6de3('0x8'),_0x6de3('0xc'),_0x6de3('0xf'),_0x6de3('0x10'),_0x6de3('0x11'),_0x6de3('0x12')],'include':[{'model':_0x6de3('0xd'),'as':_0x6de3('0xd'),'attributes':['id',_0x6de3('0x4')]}]},{'model':_0x6de3('0xb'),'as':_0x6de3('0x13'),'attributes':['id',_0x6de3('0x8'),'content','idField','nameField',_0x6de3('0x14'),_0x6de3('0x12')],'include':[{'model':'Variable','as':_0x6de3('0xd'),'attributes':['id',_0x6de3('0x4')]}]},{'model':_0x6de3('0x15'),'as':_0x6de3('0x16'),'attributes':['id',_0x6de3('0x4')]}]}]},'log':_0x6de3('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 53b13a4..e062c1e 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5df=['data2','data5','data7','GetDynamics365Account','Request','username','password','remoteUri','tenantId','clientId','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','name','moduleCreate','additionalSearchContact','Dynamics365Field','Subjects','content','variableName','Variable','Descriptions','type','key','keyType','Fields','idField','customField','CloudProvider'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xc5df,0x80));var _0xfc5d=function(_0x26a59c,_0x583c59){_0x26a59c=_0x26a59c-0x0;var _0x3f571d=_0xc5df[_0x26a59c];return _0x3f571d;};'use strict';var client=require('../../client');exports['getDynamics365Accounts']=function(){return function(_0x2772d7){return client[_0xfc5d('0x0')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id','name',_0xfc5d('0x1'),_0xfc5d('0x2'),_0xfc5d('0x3'),_0xfc5d('0x4'),_0xfc5d('0x5'),'clientSecret',_0xfc5d('0x6'),_0xfc5d('0x7'),_0xfc5d('0x8')],'include':[{'model':_0xfc5d('0x9'),'as':_0xfc5d('0xa'),'attributes':['id',_0xfc5d('0xb'),'ticketType',_0xfc5d('0xc'),_0xfc5d('0xd'),'openNewTab'],'include':[{'model':_0xfc5d('0xe'),'as':_0xfc5d('0xf'),'attributes':['id','type',_0xfc5d('0x10'),_0xfc5d('0x11')],'include':[{'model':_0xfc5d('0x12'),'as':_0xfc5d('0x12'),'attributes':['id','name']}]},{'model':_0xfc5d('0xe'),'as':_0xfc5d('0x13'),'attributes':['id',_0xfc5d('0x14'),'content',_0xfc5d('0x15'),_0xfc5d('0x16'),'keyContent',_0xfc5d('0x11')],'include':[{'model':'Variable','as':_0xfc5d('0x12'),'attributes':['id','name']}]},{'model':_0xfc5d('0xe'),'as':_0xfc5d('0x17'),'attributes':['id',_0xfc5d('0x14'),_0xfc5d('0x10'),_0xfc5d('0x18'),'nameField',_0xfc5d('0x19'),_0xfc5d('0x11')],'include':[{'model':'Variable','as':_0xfc5d('0x12'),'attributes':['id','name']}]}]},{'model':_0xfc5d('0x1a'),'as':'CloudProvider','attributes':['id',_0xfc5d('0x1b'),_0xfc5d('0x1c'),_0xfc5d('0x1d')]}]},'log':_0xfc5d('0x1e')});};}; \ No newline at end of file +var _0x3070=['Configurations','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','customField','CloudProvider','data2','data5','data7','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','remoteUri','clientSecret','serverUrl','description','modernAuthentication'];(function(_0x23292a,_0x1e08ea){var _0x4564f2=function(_0x1ae201){while(--_0x1ae201){_0x23292a['push'](_0x23292a['shift']());}};_0x4564f2(++_0x1e08ea);}(_0x3070,0x75));var _0x0307=function(_0x324b5a,_0x1358f8){_0x324b5a=_0x324b5a-0x0;var _0x38f63f=_0x3070[_0x324b5a];return _0x38f63f;};'use strict';var client=require('../../client');exports[_0x0307('0x0')]=function(){return function(_0x50afb5){return client[_0x0307('0x1')](_0x0307('0x2'),{'options':{'raw':![],'attributes':['id',_0x0307('0x3'),_0x0307('0x4'),_0x0307('0x5'),_0x0307('0x6'),'tenantId','clientId',_0x0307('0x7'),_0x0307('0x8'),_0x0307('0x9'),_0x0307('0xa')],'include':[{'model':'Dynamics365Configuration','as':_0x0307('0xb'),'attributes':['id',_0x0307('0x3'),'ticketType',_0x0307('0xc'),_0x0307('0xd'),_0x0307('0xe')],'include':[{'model':_0x0307('0xf'),'as':_0x0307('0x10'),'attributes':['id',_0x0307('0x11'),_0x0307('0x12'),_0x0307('0x13')],'include':[{'model':_0x0307('0x14'),'as':'Variable','attributes':['id',_0x0307('0x3')]}]},{'model':'Dynamics365Field','as':_0x0307('0x15'),'attributes':['id',_0x0307('0x11'),_0x0307('0x12'),_0x0307('0x16'),_0x0307('0x17'),_0x0307('0x18'),_0x0307('0x13')],'include':[{'model':_0x0307('0x14'),'as':_0x0307('0x14'),'attributes':['id',_0x0307('0x3')]}]},{'model':_0x0307('0xf'),'as':_0x0307('0x19'),'attributes':['id',_0x0307('0x11'),_0x0307('0x12'),_0x0307('0x1a'),'nameField',_0x0307('0x1b'),_0x0307('0x13')],'include':[{'model':_0x0307('0x14'),'as':'Variable','attributes':['id','name']}]}]},{'model':_0x0307('0x1c'),'as':_0x0307('0x1c'),'attributes':['id',_0x0307('0x1d'),_0x0307('0x1e'),_0x0307('0x1f')]}]},'log':_0x0307('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index edb258e..8077fbb 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3306=['content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','customField','../../client','getFreshdeskAccounts','Request','name','username','apiKey','remoteUri','serverUrl','Configurations','Tag','FreshdeskField','Subjects','type'];(function(_0x5f0eeb,_0x167108){var _0x217545=function(_0x59170f){while(--_0x59170f){_0x5f0eeb['push'](_0x5f0eeb['shift']());}};_0x217545(++_0x167108);}(_0x3306,0x107));var _0x6330=function(_0x16aaa7,_0x461022){_0x16aaa7=_0x16aaa7-0x0;var _0x1b2e9f=_0x3306[_0x16aaa7];return _0x1b2e9f;};'use strict';var client=require(_0x6330('0x0'));exports[_0x6330('0x1')]=function(){return function(_0x396230){return client[_0x6330('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0x6330('0x3'),_0x6330('0x4'),_0x6330('0x5'),_0x6330('0x6'),_0x6330('0x7')],'include':[{'model':'FreshdeskConfiguration','as':_0x6330('0x8'),'attributes':['id',_0x6330('0x3')],'include':[{'model':_0x6330('0x9'),'attributes':['id',_0x6330('0x3')]},{'model':_0x6330('0xa'),'as':_0x6330('0xb'),'attributes':['id',_0x6330('0xc'),_0x6330('0xd'),_0x6330('0xe')],'include':[{'model':_0x6330('0xf'),'as':'Variable','attributes':['id',_0x6330('0x3')]}]},{'model':'FreshdeskField','as':_0x6330('0x10'),'attributes':['id',_0x6330('0xc'),_0x6330('0xd'),_0x6330('0x11'),_0x6330('0x12'),_0x6330('0x13'),_0x6330('0xe')],'include':[{'model':_0x6330('0xf'),'as':'Variable','attributes':['id','name']}]},{'model':_0x6330('0xa'),'as':_0x6330('0x14'),'attributes':['id',_0x6330('0xc'),_0x6330('0xd'),_0x6330('0x15'),'nameField',_0x6330('0x16'),_0x6330('0xe')],'include':[{'model':_0x6330('0xf'),'as':_0x6330('0xf'),'attributes':['id','name']}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file +var _0xd5a2=['Variable','content','key','keyType','keyContent','idField','nameField','customField','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type'];(function(_0x3ceb87,_0x4104bf){var _0x14cc27=function(_0x3a6f6f){while(--_0x3a6f6f){_0x3ceb87['push'](_0x3ceb87['shift']());}};_0x14cc27(++_0x4104bf);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x56d051,_0x13f3e2){_0x56d051=_0x56d051-0x0;var _0x3ec67f=_0xd5a2[_0x56d051];return _0x3ec67f;};'use strict';var client=require('../../client');exports[_0x2d5a('0x0')]=function(){return function(_0x217b8c){return client[_0x2d5a('0x1')](_0x2d5a('0x2'),{'options':{'raw':![],'attributes':['id',_0x2d5a('0x3'),'username',_0x2d5a('0x4'),_0x2d5a('0x5'),_0x2d5a('0x6')],'include':[{'model':_0x2d5a('0x7'),'as':_0x2d5a('0x8'),'attributes':['id',_0x2d5a('0x3')],'include':[{'model':_0x2d5a('0x9'),'attributes':['id',_0x2d5a('0x3')]},{'model':_0x2d5a('0xa'),'as':_0x2d5a('0xb'),'attributes':['id',_0x2d5a('0xc'),'content','variableName'],'include':[{'model':_0x2d5a('0xd'),'as':'Variable','attributes':['id',_0x2d5a('0x3')]}]},{'model':_0x2d5a('0xa'),'as':'Descriptions','attributes':['id',_0x2d5a('0xc'),_0x2d5a('0xe'),_0x2d5a('0xf'),_0x2d5a('0x10'),_0x2d5a('0x11'),'variableName'],'include':[{'model':_0x2d5a('0xd'),'as':_0x2d5a('0xd'),'attributes':['id',_0x2d5a('0x3')]}]},{'model':_0x2d5a('0xa'),'as':'Fields','attributes':['id','type',_0x2d5a('0xe'),_0x2d5a('0x12'),_0x2d5a('0x13'),_0x2d5a('0x14'),'variableName'],'include':[{'model':_0x2d5a('0xd'),'as':_0x2d5a('0xd'),'attributes':['id',_0x2d5a('0x3')]}]}]}]},'log':_0x2d5a('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index fc4bf1b..f8dff8d 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa23f=['Variable','Descriptions','key','keyContent','../../client','getFreshsalesAccounts','GetFreshsalesAccount','name','username','apiKey','serverUrl','Configurations','FreshsalesField','Subjects','content'];(function(_0x3e1283,_0x40ae7b){var _0x1ca86f=function(_0x192950){while(--_0x192950){_0x3e1283['push'](_0x3e1283['shift']());}};_0x1ca86f(++_0x40ae7b);}(_0xa23f,0x7c));var _0xfa23=function(_0x5ccab1,_0x4dba31){_0x5ccab1=_0x5ccab1-0x0;var _0x2a9f91=_0xa23f[_0x5ccab1];return _0x2a9f91;};'use strict';var client=require(_0xfa23('0x0'));exports[_0xfa23('0x1')]=function(){return function(_0x56a4e3){return client['Request'](_0xfa23('0x2'),{'options':{'raw':![],'attributes':['id',_0xfa23('0x3'),_0xfa23('0x4'),_0xfa23('0x5'),'remoteUri',_0xfa23('0x6')],'include':[{'model':'FreshsalesConfiguration','as':_0xfa23('0x7'),'attributes':['id',_0xfa23('0x3')],'include':[{'model':_0xfa23('0x8'),'as':_0xfa23('0x9'),'attributes':['id','type',_0xfa23('0xa'),'variableName'],'include':[{'model':_0xfa23('0xb'),'as':_0xfa23('0xb'),'attributes':['id',_0xfa23('0x3')]}]},{'model':_0xfa23('0x8'),'as':_0xfa23('0xc'),'attributes':['id','type','content',_0xfa23('0xd'),'keyType',_0xfa23('0xe'),'variableName'],'include':[{'model':_0xfa23('0xb'),'as':_0xfa23('0xb'),'attributes':['id',_0xfa23('0x3')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0x4c60=['Request','name','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','Variable','key','keyContent','variableName','GetFreshsalesccount','../../client','getFreshsalesAccounts'];(function(_0x556735,_0x3b36bf){var _0x506efa=function(_0x5e5a8b){while(--_0x5e5a8b){_0x556735['push'](_0x556735['shift']());}};_0x506efa(++_0x3b36bf);}(_0x4c60,0xc1));var _0x04c6=function(_0x237ce6,_0x5680c8){_0x237ce6=_0x237ce6-0x0;var _0x235f4c=_0x4c60[_0x237ce6];return _0x235f4c;};'use strict';var client=require(_0x04c6('0x0'));exports[_0x04c6('0x1')]=function(){return function(_0x1d5492){return client[_0x04c6('0x2')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x04c6('0x3'),'username','apiKey','remoteUri','serverUrl'],'include':[{'model':_0x04c6('0x4'),'as':_0x04c6('0x5'),'attributes':['id',_0x04c6('0x3')],'include':[{'model':_0x04c6('0x6'),'as':_0x04c6('0x7'),'attributes':['id',_0x04c6('0x8'),_0x04c6('0x9'),'variableName'],'include':[{'model':_0x04c6('0xa'),'as':_0x04c6('0xa'),'attributes':['id',_0x04c6('0x3')]}]},{'model':_0x04c6('0x6'),'as':'Descriptions','attributes':['id','type','content',_0x04c6('0xb'),'keyType',_0x04c6('0xc'),_0x04c6('0xd')],'include':[{'model':'Variable','as':_0x04c6('0xa'),'attributes':['id',_0x04c6('0x3')]}]}]}]},'log':_0x04c6('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index ffc5f12..9da133c 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8e8=['../../client','getSalesforceAccounts','GetSalesforceAccount','name','remoteUri','clientSecret','securityToken','serverUrl','type','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','Subjects','Variable','Descriptions','SalesforceField','Fields'];(function(_0xad0aa8,_0x482480){var _0x4aee59=function(_0x5c95d0){while(--_0x5c95d0){_0xad0aa8['push'](_0xad0aa8['shift']());}};_0x4aee59(++_0x482480);}(_0xe8e8,0xc6));var _0x8e8e=function(_0x3873cf,_0x2e8eff){_0x3873cf=_0x3873cf-0x0;var _0x1277f9=_0xe8e8[_0x3873cf];return _0x1277f9;};'use strict';var client=require(_0x8e8e('0x0'));exports[_0x8e8e('0x1')]=function(){return function(_0x5e0004){return client['Request'](_0x8e8e('0x2'),{'options':{'raw':![],'attributes':['id',_0x8e8e('0x3'),'username','password',_0x8e8e('0x4'),'clientId',_0x8e8e('0x5'),_0x8e8e('0x6'),_0x8e8e('0x7'),_0x8e8e('0x8')],'include':[{'model':'SalesforceConfiguration','as':_0x8e8e('0x9'),'attributes':['id','name',_0x8e8e('0xa'),_0x8e8e('0xb'),_0x8e8e('0xc'),_0x8e8e('0xd'),_0x8e8e('0xe'),_0x8e8e('0xf'),_0x8e8e('0x10')],'include':[{'model':'SalesforceField','as':_0x8e8e('0x11'),'include':[{'model':_0x8e8e('0x12'),'as':_0x8e8e('0x12'),'attributes':['id',_0x8e8e('0x3')]}]},{'model':'SalesforceField','as':_0x8e8e('0x13'),'include':[{'model':_0x8e8e('0x12'),'as':_0x8e8e('0x12'),'attributes':['id',_0x8e8e('0x3')]}]},{'model':_0x8e8e('0x14'),'as':_0x8e8e('0x15'),'include':[{'model':_0x8e8e('0x12'),'as':_0x8e8e('0x12'),'attributes':['id',_0x8e8e('0x3')]}]}]}]},'log':_0x8e8e('0x2')});};}; \ No newline at end of file +var _0xfb0b=['remoteUri','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','Subjects','Variable','SalesforceField','Fields','../../client','getSalesforceAccounts','GetSalesforceAccount','name'];(function(_0x2a2edb,_0x2410fc){var _0x9e0c38=function(_0x2350ed){while(--_0x2350ed){_0x2a2edb['push'](_0x2a2edb['shift']());}};_0x9e0c38(++_0x2410fc);}(_0xfb0b,0x94));var _0xbfb0=function(_0x593c84,_0x3692b8){_0x593c84=_0x593c84-0x0;var _0xe8c2da=_0xfb0b[_0x593c84];return _0xe8c2da;};'use strict';var client=require(_0xbfb0('0x0'));exports[_0xbfb0('0x1')]=function(){return function(_0x2d627f){return client['Request'](_0xbfb0('0x2'),{'options':{'raw':![],'attributes':['id',_0xbfb0('0x3'),'username','password',_0xbfb0('0x4'),'clientId',_0xbfb0('0x5'),_0xbfb0('0x6'),_0xbfb0('0x7'),_0xbfb0('0x8')],'include':[{'model':_0xbfb0('0x9'),'as':_0xbfb0('0xa'),'attributes':['id','name',_0xbfb0('0xb'),_0xbfb0('0xc'),_0xbfb0('0xd'),_0xbfb0('0xe'),'additionalSearchAccount','additionalSearchContact','additionalSearchLead'],'include':[{'model':'SalesforceField','as':_0xbfb0('0xf'),'include':[{'model':_0xbfb0('0x10'),'as':_0xbfb0('0x10'),'attributes':['id','name']}]},{'model':_0xbfb0('0x11'),'as':'Descriptions','include':[{'model':_0xbfb0('0x10'),'as':_0xbfb0('0x10'),'attributes':['id',_0xbfb0('0x3')]}]},{'model':_0xbfb0('0x11'),'as':_0xbfb0('0x12'),'include':[{'model':_0xbfb0('0x10'),'as':'Variable','attributes':['id',_0xbfb0('0x3')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 0080eaf..0af7dc2 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['GetServicenowAccount','name','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','content','type','keyType','keyContent','variableName','Variable','idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7a54,0x106));var _0x47a5=function(_0x3a951c,_0x3f3b46){_0x3a951c=_0x3a951c-0x0;var _0x55da42=_0x7a54[_0x3a951c];return _0x55da42;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(_0x44b31e){return client['Request'](_0x47a5('0x2'),{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),'description',_0x47a5('0x4'),_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8')],'include':[{'model':'ServicenowConfiguration','as':_0x47a5('0x9'),'attributes':['id','name'],'include':[{'model':_0x47a5('0xa'),'as':_0x47a5('0xb'),'attributes':['id','type',_0x47a5('0xc'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x47a5('0x3')]}]},{'model':_0x47a5('0xa'),'as':'Descriptions','attributes':['id',_0x47a5('0xd'),'content','key',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'include':[{'model':_0x47a5('0x11'),'as':_0x47a5('0x11'),'attributes':['id',_0x47a5('0x3')]}]},{'model':_0x47a5('0xa'),'as':'Fields','attributes':['id',_0x47a5('0xd'),_0x47a5('0xc'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x10')],'include':[{'model':_0x47a5('0x11'),'as':_0x47a5('0x11'),'attributes':['id','name']}]}]}]},'log':_0x47a5('0x15')});};}; \ No newline at end of file +var _0x187d=['../../client','Request','GetServicenowAccount','name','description','username','email','remoteUri','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','idField','nameField'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x187d,0x93));var _0xd187=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x187d[_0x138f59];return _0x3d114d;};'use strict';var client=require(_0xd187('0x0'));exports['getServicenowAccounts']=function(){return function(_0x3b9b6d){return client[_0xd187('0x1')](_0xd187('0x2'),{'options':{'raw':![],'attributes':['id',_0xd187('0x3'),_0xd187('0x4'),_0xd187('0x5'),'password',_0xd187('0x6'),_0xd187('0x7'),'serverUrl'],'include':[{'model':_0xd187('0x8'),'as':_0xd187('0x9'),'attributes':['id',_0xd187('0x3')],'include':[{'model':_0xd187('0xa'),'as':_0xd187('0xb'),'attributes':['id',_0xd187('0xc'),_0xd187('0xd'),_0xd187('0xe')],'include':[{'model':'Variable','as':_0xd187('0xf'),'attributes':['id',_0xd187('0x3')]}]},{'model':_0xd187('0xa'),'as':_0xd187('0x10'),'attributes':['id',_0xd187('0xc'),_0xd187('0xd'),'key',_0xd187('0x11'),_0xd187('0x12'),_0xd187('0xe')],'include':[{'model':'Variable','as':_0xd187('0xf'),'attributes':['id',_0xd187('0x3')]}]},{'model':_0xd187('0xa'),'as':'Fields','attributes':['id',_0xd187('0xc'),_0xd187('0xd'),_0xd187('0x13'),_0xd187('0x14'),'customField',_0xd187('0xe')],'include':[{'model':_0xd187('0xf'),'as':_0xd187('0xf'),'attributes':['id',_0xd187('0x3')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index f221be3..b9666f3 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['name','username','password','remoteUri','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','nameField','getSugarcrmAccounts','GetSugarcrmAccount'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x57ca,0x108));var _0xa57c=function(_0xf09634,_0x2c4b84){_0xf09634=_0xf09634-0x0;var _0x1c5b73=_0x57ca[_0xf09634];return _0x1c5b73;};'use strict';var client=require('../../client');exports[_0xa57c('0x0')]=function(){return function(_0x4ad696){return client['Request'](_0xa57c('0x1'),{'options':{'raw':![],'attributes':['id',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),'serverUrl'],'include':[{'model':_0xa57c('0x6'),'as':_0xa57c('0x7'),'attributes':['id',_0xa57c('0x2')],'include':[{'model':_0xa57c('0x8'),'as':_0xa57c('0x9'),'attributes':['id',_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc')],'include':[{'model':'Variable','as':_0xa57c('0xd'),'attributes':['id','name']}]},{'model':_0xa57c('0x8'),'as':_0xa57c('0xe'),'attributes':['id','type',_0xa57c('0xb'),'key',_0xa57c('0xf'),_0xa57c('0x10'),'variableName'],'include':[{'model':_0xa57c('0xd'),'as':'Variable','attributes':['id',_0xa57c('0x2')]}]},{'model':_0xa57c('0x8'),'as':_0xa57c('0x11'),'attributes':['id',_0xa57c('0xa'),_0xa57c('0xb'),'idField',_0xa57c('0x12'),'customField',_0xa57c('0xc')],'include':[{'model':_0xa57c('0xd'),'as':_0xa57c('0xd'),'attributes':['id',_0xa57c('0x2')]}]}]}]},'log':_0xa57c('0x1')});};}; \ No newline at end of file +var _0x57ca=['name','username','password','remoteUri','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','nameField','getSugarcrmAccounts','GetSugarcrmAccount'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x57ca,0x108));var _0xa57c=function(_0x49e9c5,_0x5c4b22){_0x49e9c5=_0x49e9c5-0x0;var _0xc7daa8=_0x57ca[_0x49e9c5];return _0xc7daa8;};'use strict';var client=require('../../client');exports[_0xa57c('0x0')]=function(){return function(_0x4ad696){return client['Request'](_0xa57c('0x1'),{'options':{'raw':![],'attributes':['id',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),'serverUrl'],'include':[{'model':_0xa57c('0x6'),'as':_0xa57c('0x7'),'attributes':['id',_0xa57c('0x2')],'include':[{'model':_0xa57c('0x8'),'as':_0xa57c('0x9'),'attributes':['id',_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc')],'include':[{'model':'Variable','as':_0xa57c('0xd'),'attributes':['id','name']}]},{'model':_0xa57c('0x8'),'as':_0xa57c('0xe'),'attributes':['id','type',_0xa57c('0xb'),'key',_0xa57c('0xf'),_0xa57c('0x10'),'variableName'],'include':[{'model':_0xa57c('0xd'),'as':'Variable','attributes':['id',_0xa57c('0x2')]}]},{'model':_0xa57c('0x8'),'as':_0xa57c('0x11'),'attributes':['id',_0xa57c('0xa'),_0xa57c('0xb'),'idField',_0xa57c('0x12'),'customField',_0xa57c('0xc')],'include':[{'model':_0xa57c('0xd'),'as':_0xa57c('0xd'),'attributes':['id',_0xa57c('0x2')]}]}]}]},'log':_0xa57c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 89e1fcc..2b8695c 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6f1=['Variable','Descriptions','content','key','keyType','Fields','nameField','customField','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey','remoteUri','Configurations','VtigerField','Subjects','type','variableName'];(function(_0x28ce97,_0x4aa1fa){var _0x7210cf=function(_0x410fc9){while(--_0x410fc9){_0x28ce97['push'](_0x28ce97['shift']());}};_0x7210cf(++_0x4aa1fa);}(_0xc6f1,0x71));var _0x1c6f=function(_0x3c59b5,_0x40975c){_0x3c59b5=_0x3c59b5-0x0;var _0x40a8a1=_0xc6f1[_0x3c59b5];return _0x40a8a1;};'use strict';var client=require('../../client');exports[_0x1c6f('0x0')]=function(){return function(_0x4e75bf){return client[_0x1c6f('0x1')](_0x1c6f('0x2'),{'options':{'raw':![],'attributes':['id',_0x1c6f('0x3'),_0x1c6f('0x4'),_0x1c6f('0x5'),_0x1c6f('0x6'),_0x1c6f('0x7'),'serverUrl'],'include':[{'model':'VtigerConfiguration','as':_0x1c6f('0x8'),'attributes':['id',_0x1c6f('0x3')],'include':[{'model':_0x1c6f('0x9'),'as':_0x1c6f('0xa'),'attributes':['id',_0x1c6f('0xb'),'content',_0x1c6f('0xc')],'include':[{'model':_0x1c6f('0xd'),'as':_0x1c6f('0xd'),'attributes':['id',_0x1c6f('0x3')]}]},{'model':_0x1c6f('0x9'),'as':_0x1c6f('0xe'),'attributes':['id',_0x1c6f('0xb'),_0x1c6f('0xf'),_0x1c6f('0x10'),_0x1c6f('0x11'),'keyContent',_0x1c6f('0xc')],'include':[{'model':_0x1c6f('0xd'),'as':'Variable','attributes':['id',_0x1c6f('0x3')]}]},{'model':_0x1c6f('0x9'),'as':_0x1c6f('0x12'),'attributes':['id',_0x1c6f('0xb'),_0x1c6f('0xf'),'idField',_0x1c6f('0x13'),_0x1c6f('0x14'),_0x1c6f('0xc')],'include':[{'model':'Variable','as':_0x1c6f('0xd'),'attributes':['id',_0x1c6f('0x3')]}]}]}]},'log':_0x1c6f('0x2')});};}; \ No newline at end of file +var _0xdc01=['Configurations','VtigerField','Subjects','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','type','idField','nameField','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','remoteUri'];(function(_0x310877,_0xb9ac7c){var _0x1c2252=function(_0x56cb7e){while(--_0x56cb7e){_0x310877['push'](_0x310877['shift']());}};_0x1c2252(++_0xb9ac7c);}(_0xdc01,0x196));var _0x1dc0=function(_0x279f32,_0x473f86){_0x279f32=_0x279f32-0x0;var _0x483bb2=_0xdc01[_0x279f32];return _0x483bb2;};'use strict';var client=require(_0x1dc0('0x0'));exports[_0x1dc0('0x1')]=function(){return function(_0x181edd){return client[_0x1dc0('0x2')](_0x1dc0('0x3'),{'options':{'raw':![],'attributes':['id',_0x1dc0('0x4'),_0x1dc0('0x5'),_0x1dc0('0x6'),'accessKey',_0x1dc0('0x7'),'serverUrl'],'include':[{'model':'VtigerConfiguration','as':_0x1dc0('0x8'),'attributes':['id',_0x1dc0('0x4')],'include':[{'model':_0x1dc0('0x9'),'as':_0x1dc0('0xa'),'attributes':['id','type',_0x1dc0('0xb'),_0x1dc0('0xc')],'include':[{'model':_0x1dc0('0xd'),'as':_0x1dc0('0xd'),'attributes':['id',_0x1dc0('0x4')]}]},{'model':_0x1dc0('0x9'),'as':_0x1dc0('0xe'),'attributes':['id','type','content',_0x1dc0('0xf'),_0x1dc0('0x10'),_0x1dc0('0x11'),_0x1dc0('0xc')],'include':[{'model':'Variable','as':_0x1dc0('0xd'),'attributes':['id',_0x1dc0('0x4')]}]},{'model':_0x1dc0('0x9'),'as':_0x1dc0('0x12'),'attributes':['id',_0x1dc0('0x13'),'content',_0x1dc0('0x14'),_0x1dc0('0x15'),_0x1dc0('0x16'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x1dc0('0x4')]}]}]}]},'log':_0x1dc0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index f8e61f0..8266a74 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05ab=['Request','GetZendeskAccount','username','password','token','remoteUri','authType','serverUrl','ZendeskConfiguration','Configurations','name','Tag','ZendeskField','Subjects','content','variableName','Variable','Descriptions','type','keyType','keyContent','Fields','idField','../../client','getZendeskAccounts'];(function(_0xa04235,_0x41ada4){var _0x16caff=function(_0x4d4e71){while(--_0x4d4e71){_0xa04235['push'](_0xa04235['shift']());}};_0x16caff(++_0x41ada4);}(_0x05ab,0x94));var _0xb05a=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x05ab[_0x6cf19c];return _0xce14f3;};'use strict';var client=require(_0xb05a('0x0'));exports[_0xb05a('0x1')]=function(){return function(_0x223223){return client[_0xb05a('0x2')](_0xb05a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xb05a('0x4'),_0xb05a('0x5'),_0xb05a('0x6'),_0xb05a('0x7'),_0xb05a('0x8'),_0xb05a('0x9'),'type'],'include':[{'model':_0xb05a('0xa'),'as':_0xb05a('0xb'),'attributes':['id',_0xb05a('0xc')],'include':[{'model':_0xb05a('0xd'),'attributes':['id',_0xb05a('0xc')]},{'model':_0xb05a('0xe'),'as':_0xb05a('0xf'),'attributes':['id','type',_0xb05a('0x10'),_0xb05a('0x11')],'include':[{'model':_0xb05a('0x12'),'as':'Variable','attributes':['id',_0xb05a('0xc')]}]},{'model':_0xb05a('0xe'),'as':_0xb05a('0x13'),'attributes':['id',_0xb05a('0x14'),_0xb05a('0x10'),'key',_0xb05a('0x15'),_0xb05a('0x16'),_0xb05a('0x11')],'include':[{'model':_0xb05a('0x12'),'as':_0xb05a('0x12'),'attributes':['id',_0xb05a('0xc')]}]},{'model':'ZendeskField','as':_0xb05a('0x17'),'attributes':['id','type','content',_0xb05a('0x18'),'nameField','customField','variableName'],'include':[{'model':_0xb05a('0x12'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xb05a('0x3')});};}; \ No newline at end of file +var _0x842f=['Subjects','content','Variable','key','keyContent','Fields','nameField','customField','variableName','../../client','getZendeskAccounts','Request','name','username','token','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField'];(function(_0x23e366,_0xdb00e7){var _0x4c6977=function(_0x48d60b){while(--_0x48d60b){_0x23e366['push'](_0x23e366['shift']());}};_0x4c6977(++_0xdb00e7);}(_0x842f,0x190));var _0xf842=function(_0x5c5e95,_0x740a18){_0x5c5e95=_0x5c5e95-0x0;var _0x55c9aa=_0x842f[_0x5c5e95];return _0x55c9aa;};'use strict';var client=require(_0xf842('0x0'));exports[_0xf842('0x1')]=function(){return function(_0x24effa){return client[_0xf842('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0xf842('0x3'),_0xf842('0x4'),'password',_0xf842('0x5'),_0xf842('0x6'),_0xf842('0x7'),_0xf842('0x8'),_0xf842('0x9')],'include':[{'model':_0xf842('0xa'),'as':_0xf842('0xb'),'attributes':['id',_0xf842('0x3')],'include':[{'model':_0xf842('0xc'),'attributes':['id',_0xf842('0x3')]},{'model':_0xf842('0xd'),'as':_0xf842('0xe'),'attributes':['id',_0xf842('0x9'),_0xf842('0xf'),'variableName'],'include':[{'model':_0xf842('0x10'),'as':'Variable','attributes':['id',_0xf842('0x3')]}]},{'model':_0xf842('0xd'),'as':'Descriptions','attributes':['id',_0xf842('0x9'),_0xf842('0xf'),_0xf842('0x11'),'keyType',_0xf842('0x12'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0xf842('0xd'),'as':_0xf842('0x13'),'attributes':['id',_0xf842('0x9'),'content','idField',_0xf842('0x14'),_0xf842('0x15'),_0xf842('0x16')],'include':[{'model':_0xf842('0x10'),'as':_0xf842('0x10'),'attributes':['id',_0xf842('0x3')]}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index bdc7c5c..d9f7d92 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa733=['zone','clientId','clientSecret','Configurations','moduleCreate','ZohoField','type','content','variableName','Variable','Descriptions','key','keyContent','idField','nameField','customField','../../client','getZohoAccounts','GetZohoAccount','name','description','host'];(function(_0x55de06,_0x56c551){var _0x2feab2=function(_0x3dc6ec){while(--_0x3dc6ec){_0x55de06['push'](_0x55de06['shift']());}};_0x2feab2(++_0x56c551);}(_0xa733,0x1b2));var _0x3a73=function(_0x22d1c5,_0x3a3182){_0x22d1c5=_0x22d1c5-0x0;var _0x188c2a=_0xa733[_0x22d1c5];return _0x188c2a;};'use strict';var client=require(_0x3a73('0x0'));exports[_0x3a73('0x1')]=function(){return function(_0x1c6ef5){return client['Request'](_0x3a73('0x2'),{'options':{'raw':![],'attributes':['id',_0x3a73('0x3'),_0x3a73('0x4'),_0x3a73('0x5'),_0x3a73('0x6'),_0x3a73('0x7'),_0x3a73('0x8'),'serverUrl','code','refreshToken'],'include':[{'model':'ZohoConfiguration','as':_0x3a73('0x9'),'attributes':['id',_0x3a73('0x3'),_0x3a73('0xa'),'moduleSearch',_0x3a73('0x4')],'include':[{'model':_0x3a73('0xb'),'as':'Subjects','attributes':['id',_0x3a73('0xc'),_0x3a73('0xd'),_0x3a73('0xe')],'include':[{'model':_0x3a73('0xf'),'as':'Variable','attributes':['id',_0x3a73('0x3')]}]},{'model':_0x3a73('0xb'),'as':_0x3a73('0x10'),'attributes':['id',_0x3a73('0xc'),_0x3a73('0xd'),_0x3a73('0x11'),'keyType',_0x3a73('0x12'),_0x3a73('0xe')],'include':[{'model':_0x3a73('0xf'),'as':'Variable','attributes':['id',_0x3a73('0x3')]}]},{'model':_0x3a73('0xb'),'as':'Fields','attributes':['id',_0x3a73('0xc'),'content',_0x3a73('0x13'),_0x3a73('0x14'),_0x3a73('0x15'),_0x3a73('0xe')],'include':[{'model':_0x3a73('0xf'),'as':_0x3a73('0xf'),'attributes':['id','name']}]}]}]},'log':_0x3a73('0x2')});};}; \ No newline at end of file +var _0x6b44=['getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientId','clientSecret','code','ZohoConfiguration','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField'];(function(_0xa00ee3,_0x45fa48){var _0x5ee090=function(_0xbdd52c){while(--_0xbdd52c){_0xa00ee3['push'](_0xa00ee3['shift']());}};_0x5ee090(++_0x45fa48);}(_0x6b44,0x134));var _0x46b4=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x6b44[_0x22f8ab];return _0x2a70e5;};'use strict';var client=require('../../client');exports[_0x46b4('0x0')]=function(){return function(_0x3e2f84){return client[_0x46b4('0x1')](_0x46b4('0x2'),{'options':{'raw':![],'attributes':['id',_0x46b4('0x3'),_0x46b4('0x4'),_0x46b4('0x5'),_0x46b4('0x6'),_0x46b4('0x7'),_0x46b4('0x8'),'serverUrl',_0x46b4('0x9'),'refreshToken'],'include':[{'model':_0x46b4('0xa'),'as':_0x46b4('0xb'),'attributes':['id',_0x46b4('0x3'),_0x46b4('0xc'),_0x46b4('0xd'),'description'],'include':[{'model':_0x46b4('0xe'),'as':_0x46b4('0xf'),'attributes':['id',_0x46b4('0x10'),_0x46b4('0x11'),_0x46b4('0x12')],'include':[{'model':_0x46b4('0x13'),'as':_0x46b4('0x13'),'attributes':['id',_0x46b4('0x3')]}]},{'model':'ZohoField','as':_0x46b4('0x14'),'attributes':['id',_0x46b4('0x10'),_0x46b4('0x11'),_0x46b4('0x15'),_0x46b4('0x16'),_0x46b4('0x17'),_0x46b4('0x12')],'include':[{'model':_0x46b4('0x13'),'as':_0x46b4('0x13'),'attributes':['id',_0x46b4('0x3')]}]},{'model':_0x46b4('0xe'),'as':_0x46b4('0x18'),'attributes':['id',_0x46b4('0x10'),_0x46b4('0x11'),_0x46b4('0x19'),_0x46b4('0x1a'),_0x46b4('0x1b'),_0x46b4('0x12')],'include':[{'model':_0x46b4('0x13'),'as':'Variable','attributes':['id','name']}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 27e325c..bf1810f 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb100=['map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','silly','intervalIftime\x20called\x20with','length','resolve','every','number','string'];(function(_0x548c83,_0x38fef3){var _0xcddab6=function(_0xf81535){while(--_0xf81535){_0x548c83['push'](_0x548c83['shift']());}};_0xcddab6(++_0x38fef3);}(_0xb100,0x116));var _0x0b10=function(_0x16d3f8,_0x3f5dd3){_0x16d3f8=_0x16d3f8-0x0;var _0x49a172=_0xb100[_0x16d3f8];return _0x49a172;};var logger=require(_0x0b10('0x0'))(_0x0b10('0x1'));var client=require(_0x0b10('0x2'));function intervalIftime(_0x3a34e5,_0x49e338){const _0x55fdfb=new Error()['stack']['replace'](/^Error/,'')['trim']();logger[_0x0b10('0x3')](_0x0b10('0x4'),_0x3a34e5,_0x49e338,_0x55fdfb);const _0x174440=Array['isArray'](_0x3a34e5);if(!_0x3a34e5||_0x174440&&_0x3a34e5[_0x0b10('0x5')]===0x0){return Promise[_0x0b10('0x6')](![]);}else{var _0xf2071=[];var _0x56f090=[];var _0x471e13=_0x174440?_0x3a34e5:[_0x3a34e5];var _0x235d51=_0x471e13[_0x0b10('0x7')](function(_0x4cbb77){return typeof _0x4cbb77===_0x0b10('0x8');});var _0x26ff14=_0x471e13[_0x0b10('0x7')](function(_0x1e0e0f){return typeof _0x1e0e0f===_0x0b10('0x9');});if(!_0x235d51&&!_0x26ff14){_0xf2071=_0x471e13[_0x0b10('0xa')](function(_0xb862dd){return _0xb862dd['id'];});if(_0xf2071['length']===0x0){_0x56f090=_0x471e13[_0x0b10('0xa')](function(_0x175a18){return _0x175a18[_0x0b10('0xb')];});}}else{if(_0x235d51){_0xf2071=_0xf2071[_0x0b10('0xc')](_0x471e13);}if(_0x26ff14){_0x56f090=_0x56f090[_0x0b10('0xc')](_0x471e13);}}return client[_0x0b10('0xd')](_0x0b10('0xe'),{'intervalIds':_0xf2071,'intervals':_0x56f090,'timezone':_0x49e338,'log':'IntervalIftime'});}}exports[_0x0b10('0xf')]=intervalIftime; \ No newline at end of file +var _0x6a52=['string','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','stack','replace','isArray','length','resolve','number','every'];(function(_0x194882,_0x3b8125){var _0x1b37ad=function(_0x50e644){while(--_0x50e644){_0x194882['push'](_0x194882['shift']());}};_0x1b37ad(++_0x3b8125);}(_0x6a52,0xbb));var _0x26a5=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x6a52[_0x2c7b86];return _0x256735;};var logger=require(_0x26a5('0x0'))('dialer');var client=require('../client');function intervalIftime(_0x2f3372,_0xa99176){const _0x375a09=new Error()[_0x26a5('0x1')][_0x26a5('0x2')](/^Error/,'')['trim']();logger['silly']('intervalIftime\x20called\x20with',_0x2f3372,_0xa99176,_0x375a09);const _0x3a3693=Array[_0x26a5('0x3')](_0x2f3372);if(!_0x2f3372||_0x3a3693&&_0x2f3372[_0x26a5('0x4')]===0x0){return Promise[_0x26a5('0x5')](![]);}else{var _0x1338cd=[];var _0x16661f=[];var _0xb0bb28=_0x3a3693?_0x2f3372:[_0x2f3372];var _0x2b8b9c=_0xb0bb28['every'](function(_0x521a00){return typeof _0x521a00===_0x26a5('0x6');});var _0x3115bf=_0xb0bb28[_0x26a5('0x7')](function(_0x6c7511){return typeof _0x6c7511===_0x26a5('0x8');});if(!_0x2b8b9c&&!_0x3115bf){_0x1338cd=_0xb0bb28[_0x26a5('0x9')](function(_0x42b763){return _0x42b763['id'];});if(_0x1338cd[_0x26a5('0x4')]===0x0){_0x16661f=_0xb0bb28[_0x26a5('0x9')](function(_0x3f4197){return _0x3f4197[_0x26a5('0xa')];});}}else{if(_0x2b8b9c){_0x1338cd=_0x1338cd[_0x26a5('0xb')](_0xb0bb28);}if(_0x3115bf){_0x16661f=_0x16661f[_0x26a5('0xb')](_0xb0bb28);}}return client[_0x26a5('0xc')]('IntervalIftime',{'intervalIds':_0x1338cd,'intervals':_0x16661f,'timezone':_0xa99176,'log':_0x26a5('0xd')});}}exports[_0x26a5('0xe')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 83bac2a..f5a704a 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0f6=['agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','diff','seconds','outbound','moment','lodash','util','../client','voiceQueueReport','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','queuecallerleaveAt','inbound','calleridnum','exten'];(function(_0xeb2969,_0xee087e){var _0xc51e23=function(_0x150d7d){while(--_0x150d7d){_0xeb2969['push'](_0xeb2969['shift']());}};_0xc51e23(++_0xee087e);}(_0xa0f6,0x1c5));var _0x6a0f=function(_0x1b86d8,_0x42780f){_0x1b86d8=_0x1b86d8-0x0;var _0x23b8b2=_0xa0f6[_0x1b86d8];return _0x23b8b2;};'use strict';var moment=require(_0x6a0f('0x0'));var _=require(_0x6a0f('0x1'));var util=require(_0x6a0f('0x2'));var client=require(_0x6a0f('0x3'));exports[_0x6a0f('0x4')]=function(_0x5c16bf){var _0x46c68a=_0x5c16bf['queuecallercompleteAt']||_0x5c16bf['queuecallerexitAt'];return client[_0x6a0f('0x5')](_0x6a0f('0x6'),{'body':{'channel':_0x6a0f('0x7'),'membername':_0x5c16bf[_0x6a0f('0x8')],'interface':_[_0x6a0f('0x9')](_0x5c16bf[_0x6a0f('0xa')])?util['format']('SIP/%s',_0x5c16bf[_0x6a0f('0x8')]):_0x5c16bf['interface'],'type':'TALKING','enterAt':_0x5c16bf[_0x6a0f('0xb')],'exitAt':_0x46c68a,'duration':moment(_0x46c68a)['diff'](_0x5c16bf[_0x6a0f('0xb')],'seconds'),'data1':_0x6a0f('0xc'),'data2':_0x5c16bf[_0x6a0f('0xd')],'data3':_0x5c16bf[_0x6a0f('0xe')],'data4':null,'data5':_0x5c16bf['queue'],'role':_0x6a0f('0xf'),'internal':_0x5c16bf[_0x6a0f('0x10')]?_[_0x6a0f('0x11')](_0x5c16bf[_0x6a0f('0x10')]):undefined,'uniqueid':_0x5c16bf[_0x6a0f('0x12')]},'log':_0x6a0f('0x6')});};exports[_0x6a0f('0x13')]=function(_0x432894){return client[_0x6a0f('0x5')](_0x6a0f('0x6'),{'body':{'channel':'voice','membername':_0x432894[_0x6a0f('0x14')],'interface':_0x432894[_0x6a0f('0xa')],'type':'TALKING','enterAt':_0x432894[_0x6a0f('0x15')],'exitAt':_0x432894[_0x6a0f('0x16')],'duration':moment(_0x432894[_0x6a0f('0x16')])[_0x6a0f('0x17')](_0x432894[_0x6a0f('0x15')],'seconds')>=0x0?moment(_0x432894[_0x6a0f('0x16')])[_0x6a0f('0x17')](_0x432894['starttime'],_0x6a0f('0x18')):null,'data1':_0x6a0f('0x19'),'data2':_0x432894['accountcode'],'data3':_0x432894[_0x6a0f('0xe')],'data4':_0x432894['dialstring']||null,'role':_0x6a0f('0xf'),'internal':_0x432894[_0x6a0f('0x10')]?_['toNumber'](_0x432894[_0x6a0f('0x10')]):undefined,'uniqueid':_0x432894['uniqueid']},'log':_0x6a0f('0x6')});}; \ No newline at end of file +var _0x84e9=['voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','endtime','outbound','dialstring','toNumber','moment','lodash','util','../client','queuecallercompleteAt','Request'];(function(_0x143ce6,_0x46e089){var _0x33ed64=function(_0x5a6856){while(--_0x5a6856){_0x143ce6['push'](_0x143ce6['shift']());}};_0x33ed64(++_0x46e089);}(_0x84e9,0x144));var _0x984e=function(_0x157662,_0x4ac1d0){_0x157662=_0x157662-0x0;var _0x15f584=_0x84e9[_0x157662];return _0x15f584;};'use strict';var moment=require(_0x984e('0x0'));var _=require(_0x984e('0x1'));var util=require(_0x984e('0x2'));var client=require(_0x984e('0x3'));exports['voiceQueueReport']=function(_0x149672){var _0x260a14=_0x149672[_0x984e('0x4')]||_0x149672['queuecallerexitAt'];return client[_0x984e('0x5')]('CreateMemberReport',{'body':{'channel':_0x984e('0x6'),'membername':_0x149672[_0x984e('0x7')],'interface':_[_0x984e('0x8')](_0x149672[_0x984e('0x9')])?util[_0x984e('0xa')](_0x984e('0xb'),_0x149672[_0x984e('0x7')]):_0x149672[_0x984e('0x9')],'type':_0x984e('0xc'),'enterAt':_0x149672[_0x984e('0xd')],'exitAt':_0x260a14,'duration':moment(_0x260a14)['diff'](_0x149672[_0x984e('0xd')],_0x984e('0xe')),'data1':_0x984e('0xf'),'data2':_0x149672[_0x984e('0x10')],'data3':_0x149672[_0x984e('0x11')],'data4':null,'data5':_0x149672[_0x984e('0x12')],'role':_0x984e('0x13'),'internal':_0x149672[_0x984e('0x14')]?_['toNumber'](_0x149672['accountcode']):undefined,'uniqueid':_0x149672[_0x984e('0x15')]},'log':_0x984e('0x16')});};exports[_0x984e('0x17')]=function(_0x422ca4){return client[_0x984e('0x5')](_0x984e('0x16'),{'body':{'channel':_0x984e('0x6'),'membername':_0x422ca4[_0x984e('0x18')],'interface':_0x422ca4['interface'],'type':'TALKING','enterAt':_0x422ca4[_0x984e('0x19')],'exitAt':_0x422ca4[_0x984e('0x1a')],'duration':moment(_0x422ca4['endtime'])['diff'](_0x422ca4[_0x984e('0x19')],_0x984e('0xe'))>=0x0?moment(_0x422ca4[_0x984e('0x1a')])['diff'](_0x422ca4[_0x984e('0x19')],_0x984e('0xe')):null,'data1':_0x984e('0x1b'),'data2':_0x422ca4['accountcode'],'data3':_0x422ca4[_0x984e('0x11')],'data4':_0x422ca4[_0x984e('0x1c')]||null,'role':_0x984e('0x13'),'internal':_0x422ca4['accountcode']?_[_0x984e('0x1d')](_0x422ca4[_0x984e('0x14')]):undefined,'uniqueid':_0x422ca4['uniqueid']},'log':_0x984e('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 6da9f3e..c9f9132 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 _0x7708=['getSettings','ShowSetting','../client'];(function(_0x572b4c,_0x11e726){var _0x4db83f=function(_0xc02925){while(--_0xc02925){_0x572b4c['push'](_0x572b4c['shift']());}};_0x4db83f(++_0x11e726);}(_0x7708,0x188));var _0x8770=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0x7708[_0x5a7f64];return _0x3d30f1;};'use strict';var client=require(_0x8770('0x0'));exports[_0x8770('0x1')]=function(){return client['Request'](_0x8770('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0x3eae=['previewRecallmeReminderInterval','GetSettings','Request','ShowSetting'];(function(_0x4e1c19,_0x223b5b){var _0x17de84=function(_0x180aa4){while(--_0x180aa4){_0x4e1c19['push'](_0x4e1c19['shift']());}};_0x17de84(++_0x223b5b);}(_0x3eae,0x66));var _0xe3ea=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x3eae[_0x46d0c9];return _0x174506;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xe3ea('0x0')](_0xe3ea('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0xe3ea('0x2')]},'log':_0xe3ea('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 4e93caf..7ab3a9a 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 _0x0195=['../client','getTemplates','Request','GetTemplate'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x0195,0x168));var _0x5019=function(_0x11f690,_0x3ce16a){_0x11f690=_0x11f690-0x0;var _0x1b08c6=_0x0195[_0x11f690];return _0x1b08c6;};'use strict';var client=require(_0x5019('0x0'));exports[_0x5019('0x1')]=function(_0x2512bf){return function(_0x300f7a){return client[_0x5019('0x2')](_0x5019('0x3'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xca79=['name','html','GetTemplate','../client','Request'];(function(_0x26c562,_0xe4be5c){var _0x462368=function(_0x38db51){while(--_0x38db51){_0x26c562['push'](_0x26c562['shift']());}};_0x462368(++_0xe4be5c);}(_0xca79,0xe4));var _0x9ca7=function(_0x5021de,_0x3f2181){_0x5021de=_0x5021de-0x0;var _0x3b797b=_0xca79[_0x5021de];return _0x3b797b;};'use strict';var client=require(_0x9ca7('0x0'));exports['getTemplates']=function(_0x470ca4){return function(_0x4bb8f9){return client[_0x9ca7('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x9ca7('0x2'),_0x9ca7('0x3')]},'log':_0x9ca7('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 650981b..7007ff0 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 _0x63a5=['data4','data5','data6','data7','../client','GetTrigger','name','channel','status','Condition','field','operator','value','AnyConditions','Actions','data1'];(function(_0x57e11c,_0x1423b7){var _0x4107f2=function(_0x8fae16){while(--_0x8fae16){_0x57e11c['push'](_0x57e11c['shift']());}};_0x4107f2(++_0x1423b7);}(_0x63a5,0x184));var _0x563a=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x63a5[_0x29d94e];return _0x106237;};'use strict';var client=require(_0x563a('0x0'));exports['getTriggers']=function(_0x1fc7cf){return function(_0x5462a5){return client['Request'](_0x563a('0x1'),{'options':{'raw':![],'attributes':['id',_0x563a('0x2'),_0x563a('0x3'),_0x563a('0x4')],'include':[{'model':_0x563a('0x5'),'as':'AllConditions','attributes':['id',_0x563a('0x6'),_0x563a('0x7'),_0x563a('0x8')]},{'model':'Condition','as':_0x563a('0x9'),'attributes':['id','field',_0x563a('0x7'),_0x563a('0x8')]},{'model':'Action','as':_0x563a('0xa'),'attributes':['id','action',_0x563a('0xb'),'data2','data3',_0x563a('0xc'),_0x563a('0xd'),_0x563a('0xe'),_0x563a('0xf')]}]},'log':_0x563a('0x1')});};}; \ No newline at end of file +var _0x3873=['operator','value','Action','Actions','action','data1','data2','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3873,0x89));var _0x3387=function(_0x1f148e,_0x4d2841){_0x1f148e=_0x1f148e-0x0;var _0x40ef6d=_0x3873[_0x1f148e];return _0x40ef6d;};'use strict';var client=require(_0x3387('0x0'));exports[_0x3387('0x1')]=function(_0x35b7c4){return function(_0x32f60e){return client[_0x3387('0x2')](_0x3387('0x3'),{'options':{'raw':![],'attributes':['id',_0x3387('0x4'),_0x3387('0x5'),_0x3387('0x6')],'include':[{'model':_0x3387('0x7'),'as':_0x3387('0x8'),'attributes':['id',_0x3387('0x9'),_0x3387('0xa'),_0x3387('0xb')]},{'model':_0x3387('0x7'),'as':'AnyConditions','attributes':['id',_0x3387('0x9'),_0x3387('0xa'),_0x3387('0xb')]},{'model':_0x3387('0xc'),'as':_0x3387('0xd'),'attributes':['id',_0x3387('0xe'),_0x3387('0xf'),_0x3387('0x10'),'data3',_0x3387('0x11'),_0x3387('0x12'),_0x3387('0x13'),_0x3387('0x14')]}]},'log':_0x3387('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ac7968f..c4b9d4f 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 _0x097c=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0x363876,_0x2a4a14){var _0x2956b7=function(_0x5d19b3){while(--_0x5d19b3){_0x363876['push'](_0x363876['shift']());}};_0x2956b7(++_0x2a4a14);}(_0x097c,0x1d5));var _0xc097=function(_0x119119,_0x5b146f){_0x119119=_0x119119-0x0;var _0x20b522=_0x097c[_0x119119];return _0x20b522;};'use strict';var client=require(_0xc097('0x0'));exports[_0xc097('0x1')]=function(_0x334a7c){return function(_0x4b26f6){return client[_0xc097('0x2')](_0xc097('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc097('0x4'),_0xc097('0x5'),'defaultuser']},'log':_0xc097('0x3')});};}; \ No newline at end of file +var _0x59c3=['defaultuser','../client','getTrunks','Request','GetTrunk','registry'];(function(_0x12c3d1,_0x3c6ae7){var _0x282840=function(_0x4ae0d2){while(--_0x4ae0d2){_0x12c3d1['push'](_0x12c3d1['shift']());}};_0x282840(++_0x3c6ae7);}(_0x59c3,0x133));var _0x359c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x59c3[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x359c('0x0'));exports[_0x359c('0x1')]=function(_0x3f470b){return function(_0x26f8f6){return client[_0x359c('0x2')](_0x359c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x359c('0x4'),_0x359c('0x5')]},'log':_0x359c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 473ed59..d5bb328 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe706,0xa3));var _0x6e70=function(_0x2cbd8c,_0x4f5428){_0x2cbd8c=_0x2cbd8c-0x0;var _0xf554ad=_0xe706[_0x2cbd8c];return _0xf554ad;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x3de2e7,_0x1f9e26){var _0xc03ce1=function(_0x13780b){while(--_0x13780b){_0x3de2e7['push'](_0x3de2e7['shift']());}};_0xc03ce1(++_0x1f9e26);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0xcb91[_0x1ee0a1];return _0x1d2d5b;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index f26eb4e..345c1ac 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 _0x2c3d=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0xd2fac6,_0x13199e){var _0x1ae0f3=function(_0x30f202){while(--_0x30f202){_0xd2fac6['push'](_0xd2fac6['shift']());}};_0x1ae0f3(++_0x13199e);}(_0x2c3d,0x7c));var _0xd2c3=function(_0x2b060b,_0x29d66a){_0x2b060b=_0x2b060b-0x0;var _0x16d74e=_0x2c3d[_0x2b060b];return _0x16d74e;};'use strict';var client=require('../client');exports[_0xd2c3('0x0')]=function(_0xec999c){return client[_0xd2c3('0x1')](_0xd2c3('0x2'),{'body':_0xec999c,'log':_0xd2c3('0x2')});};exports[_0xd2c3('0x3')]=function(_0xbb4d62,_0x10e5d2,_0x1f4a86){return client[_0xd2c3('0x1')]('UpdateVoiceAgentReport',{'body':_0xbb4d62,'options':{'where':{'uniqueid':_0x10e5d2,'interface':_0x1f4a86,'agentcomplete':!![]}},'log':_0xd2c3('0x4')});}; \ No newline at end of file +var _0x73d9=['create','Request','update','UpdateVoiceAgentReport','../client'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x73d9,0x176));var _0x973d=function(_0x2a8d86,_0x4654e6){_0x2a8d86=_0x2a8d86-0x0;var _0x817ab3=_0x73d9[_0x2a8d86];return _0x817ab3;};'use strict';var client=require(_0x973d('0x0'));exports[_0x973d('0x1')]=function(_0x549d5d){return client[_0x973d('0x2')]('CreateVoiceAgentReport',{'body':_0x549d5d,'log':'CreateVoiceAgentReport'});};exports[_0x973d('0x3')]=function(_0x35c80c,_0x319723,_0xf2922){return client[_0x973d('0x2')](_0x973d('0x4'),{'body':_0x35c80c,'options':{'where':{'uniqueid':_0x319723,'interface':_0xf2922,'agentcomplete':!![]}},'log':_0x973d('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 1fb3aad..59a95c3 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 _0xf641=['callerid','DOCUMENTATION','Request','GetVoiceCallReport','outbound','startOf','format','day','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','CreateVoiceCallReport','context'];(function(_0x3be658,_0x5b5905){var _0x8382ed=function(_0x361b7d){while(--_0x361b7d){_0x3be658['push'](_0x3be658['shift']());}};_0x8382ed(++_0x5b5905);}(_0xf641,0x1ee));var _0x1f64=function(_0x3d2243,_0x5d4acf){_0x3d2243=_0x3d2243-0x0;var _0xf009a8=_0xf641[_0x3d2243];return _0xf009a8;};'use strict';var moment=require('moment');var util=require(_0x1f64('0x0'));var _=require(_0x1f64('0x1'));var client=require(_0x1f64('0x2'));exports[_0x1f64('0x3')]=function(_0x5e4636){return client['Request'](_0x1f64('0x4'),{'body':_['merge'](_0x5e4636,{'source':_0x5e4636['calleridnum'],'destinationcontext':_0x5e4636[_0x1f64('0x5')],'callerid':_0x5e4636[_0x1f64('0x6')],'amaflags':_0x1f64('0x7')}),'log':_0x1f64('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x1f64('0x8')](_0x1f64('0x9'),{'options':{'where':{'type':[_0x1f64('0xa')],'createdAt':{'$between':[moment()[_0x1f64('0xb')]('day')[_0x1f64('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x1f64('0xd'))[_0x1f64('0xc')](_0x1f64('0xe'))]}},'attributes':[_0x1f64('0xf'),_0x1f64('0x10'),_0x1f64('0x11'),_0x1f64('0x12')]},'log':_0x1f64('0x13')});};}; \ No newline at end of file +var _0x771d=['create','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','lodash','../client'];(function(_0x2fed16,_0x5e9eac){var _0x4419bd=function(_0x45cc74){while(--_0x45cc74){_0x2fed16['push'](_0x2fed16['shift']());}};_0x4419bd(++_0x5e9eac);}(_0x771d,0x1e1));var _0xd771=function(_0x3472c4,_0x6f57fa){_0x3472c4=_0x3472c4-0x0;var _0x39b61a=_0x771d[_0x3472c4];return _0x39b61a;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0xd771('0x0'));var client=require(_0xd771('0x1'));exports[_0xd771('0x2')]=function(_0x307696){return client[_0xd771('0x3')](_0xd771('0x4'),{'body':_['merge'](_0x307696,{'source':_0x307696[_0xd771('0x5')],'destinationcontext':_0x307696[_0xd771('0x6')],'callerid':_0x307696[_0xd771('0x7')],'amaflags':_0xd771('0x8')}),'log':_0xd771('0x4')});};exports[_0xd771('0x9')]=function(){return function(){return client['Request'](_0xd771('0xa'),{'options':{'where':{'type':[_0xd771('0xb')],'createdAt':{'$between':[moment()['startOf'](_0xd771('0xc'))[_0xd771('0xd')](_0xd771('0xe')),moment()[_0xd771('0xf')](_0xd771('0xc'))[_0xd771('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xd771('0x10'),_0xd771('0x11'),_0xd771('0x12'),_0xd771('0x13')]},'log':_0xd771('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 715e902..8632a33 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 _0xfd17=['../client','create','Request','CreateVoiceDialReport'];(function(_0xc911b0,_0x4b667a){var _0x8c0c77=function(_0x534140){while(--_0x534140){_0xc911b0['push'](_0xc911b0['shift']());}};_0x8c0c77(++_0x4b667a);}(_0xfd17,0x17c));var _0x7fd1=function(_0x412b2a,_0x11fb8a){_0x412b2a=_0x412b2a-0x0;var _0x5872e3=_0xfd17[_0x412b2a];return _0x5872e3;};'use strict';var client=require(_0x7fd1('0x0'));exports[_0x7fd1('0x1')]=function(_0x1fc6d1){return client[_0x7fd1('0x2')](_0x7fd1('0x3'),{'body':_0x1fc6d1,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x2787=['CreateVoiceDialReport','../client','create','Request'];(function(_0x574c71,_0x5964c3){var _0xb7550=function(_0x1d0463){while(--_0x1d0463){_0x574c71['push'](_0x574c71['shift']());}};_0xb7550(++_0x5964c3);}(_0x2787,0xe9));var _0x7278=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2787[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0x7278('0x0'));exports[_0x7278('0x1')]=function(_0x2bc9cb){return client[_0x7278('0x2')]('CreateVoiceDialReport',{'body':_0x2bc9cb,'log':_0x7278('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ffd5624..5e697a3 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 _0x87ae=['recordingFormat','getVoiceExtensions','Request'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x87ae,0xf5));var _0xe87a=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x87ae[_0x1cd47d];return _0x29d52f;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0xe87a('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0xe87a('0x1')],'where':{'VoiceExtensionId':null}},'log':_0xe87a('0x2')});};}; \ No newline at end of file +var _0x4876=['Request','recordingFormat'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x6487('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x6487('0x1')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 00cc944..4fea971 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 _0x0cf7=['dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x240b4c,_0x1f2a97){var _0x7ef9b2=function(_0x1cc14c){while(--_0x1cc14c){_0x240b4c['push'](_0x240b4c['shift']());}};_0x7ef9b2(++_0x1f2a97);}(_0x0cf7,0xf2));var _0x70cf=function(_0x452f43,_0x405adc){_0x452f43=_0x452f43-0x0;var _0x4ecad6=_0x0cf7[_0x452f43];return _0x4ecad6;};'use strict';var client=require(_0x70cf('0x0'));exports[_0x70cf('0x1')]=function(){return function(){return client[_0x70cf('0x2')](_0x70cf('0x3'),{'options':{'raw':![],'attributes':['id',_0x70cf('0x4'),_0x70cf('0x5'),'acwTimeout',_0x70cf('0x6'),_0x70cf('0x7'),'type',_0x70cf('0x8'),_0x70cf('0x9'),'dialLimitChannel',_0x70cf('0xa'),_0x70cf('0xb'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x70cf('0xc'),_0x70cf('0xd'),'dialOriginateTimeout',_0x70cf('0xe'),'dialQueueTimeout',_0x70cf('0xf'),_0x70cf('0x10'),_0x70cf('0x11'),_0x70cf('0x12'),_0x70cf('0x13'),_0x70cf('0x14'),_0x70cf('0x15'),_0x70cf('0x16'),_0x70cf('0x17'),_0x70cf('0x18'),_0x70cf('0x19'),_0x70cf('0x1a'),_0x70cf('0x1b'),'dialAMDInitialSilence',_0x70cf('0x1c'),_0x70cf('0x1d'),_0x70cf('0x1e'),'dialAMDMinWordLength',_0x70cf('0x1f'),_0x70cf('0x20'),_0x70cf('0x21'),_0x70cf('0x22'),_0x70cf('0x23'),_0x70cf('0x24'),_0x70cf('0x25'),_0x70cf('0x26'),_0x70cf('0x27'),_0x70cf('0x28'),_0x70cf('0x29'),'monitor_format','strategy',_0x70cf('0x2a'),_0x70cf('0x2b'),_0x70cf('0x2c'),_0x70cf('0x2d'),_0x70cf('0x2e'),_0x70cf('0x2f'),_0x70cf('0x30'),'dialAbandonedRetryFrequency',_0x70cf('0x31'),_0x70cf('0x32'),_0x70cf('0x33'),'dialAgentRejectRetryFrequency',_0x70cf('0x34'),_0x70cf('0x35'),'dialPredictiveIntervalMinThreshold',_0x70cf('0x36'),_0x70cf('0x37')],'include':[{'model':_0x70cf('0x38'),'as':'Trunk','attributes':['id',_0x70cf('0x4'),_0x70cf('0x39'),_0x70cf('0x3a')]},{'model':_0x70cf('0x3b'),'as':_0x70cf('0x3c'),'attributes':['id',_0x70cf('0x4')]},{'model':_0x70cf('0x38'),'as':_0x70cf('0x3d'),'attributes':['id',_0x70cf('0x4'),_0x70cf('0x39'),_0x70cf('0x3a')]},{'model':_0x70cf('0x3e'),'as':_0x70cf('0x3e'),'attributes':['id','name'],'include':[{'model':_0x70cf('0x3e'),'as':'Intervals','attributes':['id',_0x70cf('0x4'),_0x70cf('0x3f')]}]}]},'log':_0x70cf('0x1')});};}; \ No newline at end of file +var _0x6f07=['TrunkBackup','Interval','Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0x6f07,0x126));var _0x76f0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f07[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x76f0('0x0')]=function(){return function(){return client['Request'](_0x76f0('0x1'),{'options':{'raw':![],'attributes':['id',_0x76f0('0x2'),_0x76f0('0x3'),'acwTimeout',_0x76f0('0x4'),_0x76f0('0x5'),_0x76f0('0x6'),_0x76f0('0x7'),'dialMethod',_0x76f0('0x8'),'dialLimitQueue',_0x76f0('0x9'),_0x76f0('0xa'),_0x76f0('0xb'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x76f0('0xc'),_0x76f0('0xd'),_0x76f0('0xe'),_0x76f0('0xf'),'dialQueueProject',_0x76f0('0x10'),'dialCongestionRetryFrequency',_0x76f0('0x11'),_0x76f0('0x12'),_0x76f0('0x13'),_0x76f0('0x14'),_0x76f0('0x15'),_0x76f0('0x16'),'dialGlobalInterval','dialPrefix',_0x76f0('0x17'),_0x76f0('0x18'),_0x76f0('0x19'),'dialAMDGreeting',_0x76f0('0x1a'),_0x76f0('0x1b'),_0x76f0('0x1c'),_0x76f0('0x1d'),'dialAMDMaximumNumberOfWords',_0x76f0('0x1e'),_0x76f0('0x1f'),'timeout',_0x76f0('0x20'),'dialRecallInQueue',_0x76f0('0x21'),_0x76f0('0x22'),_0x76f0('0x23'),_0x76f0('0x24'),_0x76f0('0x5'),'strategy',_0x76f0('0x25'),_0x76f0('0x26'),_0x76f0('0x27'),_0x76f0('0x28'),_0x76f0('0x29'),'dialDropRetryFrequency',_0x76f0('0x2a'),'dialAbandonedRetryFrequency',_0x76f0('0x2b'),_0x76f0('0x2c'),_0x76f0('0x2d'),_0x76f0('0x2e'),'mandatoryDisposition',_0x76f0('0x2f'),'dialPredictiveIntervalMinThreshold',_0x76f0('0x30'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x76f0('0x31'),'as':_0x76f0('0x31'),'attributes':['id','name',_0x76f0('0x32'),_0x76f0('0x33')]},{'model':_0x76f0('0x34'),'as':_0x76f0('0x35'),'attributes':['id',_0x76f0('0x2')]},{'model':'Trunk','as':_0x76f0('0x36'),'attributes':['id',_0x76f0('0x2'),_0x76f0('0x32'),_0x76f0('0x33')]},{'model':_0x76f0('0x37'),'as':_0x76f0('0x37'),'attributes':['id','name'],'include':[{'model':_0x76f0('0x37'),'as':_0x76f0('0x38'),'attributes':['id',_0x76f0('0x2'),_0x76f0('0x39')]}]}]},'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 0913ec4..5fe52c8 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(_0x269984,_0x20c344){var _0x5669cf=function(_0x57b3b7){while(--_0x57b3b7){_0x269984['push'](_0x269984['shift']());}};_0x5669cf(++_0x20c344);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x53e2c2,_0x4ad5c5){var _0x934f83=function(_0x41112e){while(--_0x41112e){_0x53e2c2['push'](_0x53e2c2['shift']());}};_0x934f83(++_0x4ad5c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 c5d5ba9..9e36d9b 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 _0xa231=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x2ef06d,_0x203977){var _0x5753c8=function(_0x44ee31){while(--_0x44ee31){_0x2ef06d['push'](_0x2ef06d['shift']());}};_0x5753c8(++_0x203977);}(_0xa231,0x159));var _0x1a23=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0xa231[_0x51ab83];return _0x14b6de;};'use strict';var client=require(_0x1a23('0x0'));exports[_0x1a23('0x1')]=function(_0x194727){return function(){return client[_0x1a23('0x2')](_0x1a23('0x3'),{'options':{'where':{'VoiceQueueId':_0x194727,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xd55d=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x344d20,_0x68ab4b){var _0x1e8353=function(_0x5e8835){while(--_0x5e8835){_0x344d20['push'](_0x344d20['shift']());}};_0x1e8353(++_0x68ab4b);}(_0xd55d,0xce));var _0xdd55=function(_0x51dbfa,_0x1d89cc){_0x51dbfa=_0x51dbfa-0x0;var _0x1b94ab=_0xd55d[_0x51dbfa];return _0x1b94ab;};'use strict';var client=require('../client');exports[_0xdd55('0x0')]=function(_0x5e407a){return function(){return client[_0xdd55('0x1')](_0xdd55('0x2'),{'options':{'where':{'VoiceQueueId':_0x5e407a,'paused':!![]},'raw':!![]},'log':_0xdd55('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index a447bce..4ec2106 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(_0x173ea0,_0x258885){var _0x1a77b3=function(_0x39d415){while(--_0x39d415){_0x173ea0['push'](_0x173ea0['shift']());}};_0x1a77b3(++_0x258885);}(_0x7a54,0x106));var _0x47a5=function(_0x22db6a,_0x1353a5){_0x22db6a=_0x22db6a-0x0;var _0x2fd09c=_0x7a54[_0x22db6a];return _0x2fd09c;};'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(_0x12c299,_0x3c4028){var _0x1963c8=function(_0x5894d7){while(--_0x5894d7){_0x12c299['push'](_0x12c299['shift']());}};_0x1963c8(++_0x3c4028);}(_0x7a54,0x106));var _0x47a5=function(_0x51c0fe,_0x4c0f58){_0x51c0fe=_0x51c0fe-0x0;var _0x2ce3c9=_0x7a54[_0x51c0fe];return _0x2ce3c9;};'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 f9a8e7c..9cd8328 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 _0x6f6d=['Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','extension','blind','attendedTransfer'];(function(_0x50c0e8,_0x59d95d){var _0x79f9a5=function(_0x2420e8){while(--_0x2420e8){_0x50c0e8['push'](_0x50c0e8['shift']());}};_0x79f9a5(++_0x59d95d);}(_0x6f6d,0x198));var _0xd6f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f6d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xd6f6('0x0')]={};exports[_0xd6f6('0x1')]=function(_0x1f72a2){return client['Request'](_0xd6f6('0x2'),{'body':{'result':_0x1f72a2[_0xd6f6('0x3')],'transfererchannel':_0x1f72a2[_0xd6f6('0x4')],'transferercalleridnum':_0x1f72a2['transferercalleridnum'],'transferercalleridname':_0x1f72a2['transferercalleridname'],'transfererconnectedlinenum':_0x1f72a2['transfererconnectedlinenum'],'transfererconnectedlinename':_0x1f72a2[_0xd6f6('0x5')],'transfereraccountcode':_0x1f72a2[_0xd6f6('0x6')],'transferercontext':_0x1f72a2[_0xd6f6('0x7')],'transfererexten':_0x1f72a2[_0xd6f6('0x8')],'transfererlinkedid':_0x1f72a2[_0xd6f6('0x9')],'transfereechannel':_0x1f72a2[_0xd6f6('0xa')],'transfereecalleridnum':_0x1f72a2[_0xd6f6('0xb')],'transfereecalleridname':_0x1f72a2[_0xd6f6('0xc')],'transfereeconnectedlinenum':_0x1f72a2[_0xd6f6('0xd')],'transfereeconnectedlinename':_0x1f72a2['transfereeconnectedlinename'],'transfereeaccountcode':_0x1f72a2[_0xd6f6('0xe')],'transfereecontext':_0x1f72a2[_0xd6f6('0xf')],'transfereeexten':_0x1f72a2[_0xd6f6('0x10')],'transfereelinkedid':_0x1f72a2['transfereelinkedid'],'isexternal':_0x1f72a2[_0xd6f6('0x11')],'context':_0x1f72a2['context'],'extension':_0x1f72a2[_0xd6f6('0x12')],'type':_0xd6f6('0x13')},'log':_0xd6f6('0x2')});};exports[_0xd6f6('0x14')]=function(_0x58961f){return client[_0xd6f6('0x15')]('CreateVoiceTransferReport',{'body':{'result':_0x58961f[_0xd6f6('0x3')],'transfererchannel':_0x58961f[_0xd6f6('0x16')],'transferercalleridnum':_0x58961f[_0xd6f6('0x17')],'transferercalleridname':_0x58961f[_0xd6f6('0x18')],'transfererconnectedlinenum':_0x58961f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x58961f[_0xd6f6('0x19')],'transfereraccountcode':_0x58961f['origtransfereraccountcode'],'transferercontext':_0x58961f[_0xd6f6('0x1a')],'transfererexten':_0x58961f[_0xd6f6('0x1b')],'transfererlinkedid':_0x58961f[_0xd6f6('0x1c')],'transfereechannel':_0x58961f['transfertargetchannel'],'transfereecalleridnum':_0x58961f[_0xd6f6('0x1d')],'transfereecalleridname':_0x58961f[_0xd6f6('0x1e')],'transfereeconnectedlinenum':_0x58961f[_0xd6f6('0x1f')],'transfereeconnectedlinename':_0x58961f[_0xd6f6('0x20')],'transfereeaccountcode':_0x58961f[_0xd6f6('0x21')],'transfereecontext':_0x58961f[_0xd6f6('0x22')],'transfereeexten':_0x58961f[_0xd6f6('0x23')],'transfereelinkedid':_0x58961f['transfertargetlinkedid'],'isexternal':_0x58961f[_0xd6f6('0x11')],'context':_0x58961f[_0xd6f6('0x24')],'extension':_0x58961f[_0xd6f6('0x25')],'type':_0xd6f6('0x26')},'log':_0xd6f6('0x2')});}; \ No newline at end of file +var _0x65cb=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','CreateVoiceTransferReport','attendedTransfer','Request','origtransferercalleridnum','origtransferercalleridname'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x65cb,0x1a8));var _0xb65c=function(_0x4e5bfc,_0x11bb75){_0x4e5bfc=_0x4e5bfc-0x0;var _0xc19602=_0x65cb[_0x4e5bfc];return _0xc19602;};'use strict';var client=require(_0xb65c('0x0'));exports['transfers']={};exports[_0xb65c('0x1')]=function(_0x18dd6e){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x18dd6e[_0xb65c('0x2')],'transfererchannel':_0x18dd6e[_0xb65c('0x3')],'transferercalleridnum':_0x18dd6e[_0xb65c('0x4')],'transferercalleridname':_0x18dd6e[_0xb65c('0x5')],'transfererconnectedlinenum':_0x18dd6e[_0xb65c('0x6')],'transfererconnectedlinename':_0x18dd6e[_0xb65c('0x7')],'transfereraccountcode':_0x18dd6e[_0xb65c('0x8')],'transferercontext':_0x18dd6e[_0xb65c('0x9')],'transfererexten':_0x18dd6e[_0xb65c('0xa')],'transfererlinkedid':_0x18dd6e[_0xb65c('0xb')],'transfereechannel':_0x18dd6e[_0xb65c('0xc')],'transfereecalleridnum':_0x18dd6e[_0xb65c('0xd')],'transfereecalleridname':_0x18dd6e[_0xb65c('0xe')],'transfereeconnectedlinenum':_0x18dd6e['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x18dd6e[_0xb65c('0xf')],'transfereeaccountcode':_0x18dd6e[_0xb65c('0x10')],'transfereecontext':_0x18dd6e[_0xb65c('0x11')],'transfereeexten':_0x18dd6e[_0xb65c('0x12')],'transfereelinkedid':_0x18dd6e['transfereelinkedid'],'isexternal':_0x18dd6e[_0xb65c('0x13')],'context':_0x18dd6e[_0xb65c('0x14')],'extension':_0x18dd6e[_0xb65c('0x15')],'type':'blind'},'log':_0xb65c('0x16')});};exports[_0xb65c('0x17')]=function(_0x34e8c6){return client[_0xb65c('0x18')]('CreateVoiceTransferReport',{'body':{'result':_0x34e8c6[_0xb65c('0x2')],'transfererchannel':_0x34e8c6['origtransfererchannel'],'transferercalleridnum':_0x34e8c6[_0xb65c('0x19')],'transferercalleridname':_0x34e8c6[_0xb65c('0x1a')],'transfererconnectedlinenum':_0x34e8c6[_0xb65c('0x1b')],'transfererconnectedlinename':_0x34e8c6[_0xb65c('0x1c')],'transfereraccountcode':_0x34e8c6['origtransfereraccountcode'],'transferercontext':_0x34e8c6['secondtransferercontext'],'transfererexten':_0x34e8c6[_0xb65c('0x1d')],'transfererlinkedid':_0x34e8c6[_0xb65c('0x1e')],'transfereechannel':_0x34e8c6[_0xb65c('0x1f')],'transfereecalleridnum':_0x34e8c6[_0xb65c('0x20')],'transfereecalleridname':_0x34e8c6[_0xb65c('0x21')],'transfereeconnectedlinenum':_0x34e8c6[_0xb65c('0x22')],'transfereeconnectedlinename':_0x34e8c6[_0xb65c('0x23')],'transfereeaccountcode':_0x34e8c6['transfertargetaccountcode'],'transfereecontext':_0x34e8c6['transfertargetcontext'],'transfereeexten':_0x34e8c6[_0xb65c('0x24')],'transfereelinkedid':_0x34e8c6[_0xb65c('0x25')],'isexternal':_0x34e8c6[_0xb65c('0x13')],'context':_0x34e8c6[_0xb65c('0x26')],'extension':_0x34e8c6[_0xb65c('0x27')],'type':_0xb65c('0x28')},'log':_0xb65c('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index ab0d441..6224de5 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x5b1779,_0x8aec73){var _0x162240=function(_0x219168){while(--_0x219168){_0x5b1779['push'](_0x5b1779['shift']());}};_0x162240(++_0x8aec73);}(_0x7a54,0x106));var _0x47a5=function(_0x456fda,_0x39d0ff){_0x456fda=_0x456fda-0x0;var _0x47b77a=_0x7a54[_0x456fda];return _0x47b77a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x22ca3f,_0x38a6d9){var _0x157b64=function(_0x5cffe6){while(--_0x5cffe6){_0x22ca3f['push'](_0x22ca3f['shift']());}};_0x157b64(++_0x38a6d9);}(_0xb10b,0x12a));var _0xbb10=function(_0x1569bd,_0x1a1461){_0x1569bd=_0x1569bd-0x0;var _0x40e370=_0xb10b[_0x1569bd];return _0x40e370;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 4ae48b4..891dd53 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 _0x8da1=['[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','merge','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','[CM][%s][%s]','emit','exec','data2','isNil','data5','ListId','data3','split','map','routeId','destcalleridnum','calleridnum','firstName','phone','mobile','fax','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','info','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4'];(function(_0x2d5f95,_0x1beb95){var _0x3a29e8=function(_0x58e119){while(--_0x58e119){_0x2d5f95['push'](_0x2d5f95['shift']());}};_0x3a29e8(++_0x1beb95);}(_0x8da1,0x1a6));var _0x18da=function(_0xace953,_0x338468){_0xace953=_0xace953-0x0;var _0x5b5c4b=_0x8da1[_0xace953];return _0x5b5c4b;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x18da('0x0'));var util=require(_0x18da('0x1'));var config=require(_0x18da('0x2'));var logger=require(_0x18da('0x3'))(_0x18da('0x4'));var cmContactRpc=require(_0x18da('0x5'));config[_0x18da('0x6')]=_['defaults'](config[_0x18da('0x6')],{'host':_0x18da('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x18da('0x6')]));function emit(_0x5e55d0,_0x4fd348,_0x349199,_0x22ff47,_0x57f6a8){logger['info'](_0x18da('0x8'),_0x5e55d0,_0x4fd348['id'],_0x349199,_0x22ff47,JSON['stringify'](_0x57f6a8));io['to'](_0x349199)[_0x18da('0x9')](_0x22ff47,_0x57f6a8);}exports[_0x18da('0xa')]=function(_0x528899,_0x30c4d6,_0x1bf5a4,_0xf9a287){var _0x8765fc,_0x51f0ba;var _0x16cd67={};var _0x177755;var _0x599d4a=Number(_0x1bf5a4['data1']);var _0x351d79=_0x1bf5a4[_0x18da('0xb')]?Boolean(Number(_0x1bf5a4[_0x18da('0xb')])):![];var _0x455c48;var _0x4d6cb6=![];if(!_[_0x18da('0xc')](_0x1bf5a4[_0x18da('0xd')])){if(_0x1bf5a4['data5']=='1')_0x4d6cb6=!![];}if(!_0x4d6cb6){if(_0xf9a287['xmd-contactid']){_0x16cd67['id']=_0xf9a287['xmd-contactid'];}}if(!_0x16cd67['id']){_0x16cd67[_0x18da('0xe')]=_0x599d4a;_0x455c48=_0x1bf5a4[_0x18da('0xf')]&&_0x1bf5a4[_0x18da('0xf')]!=='0'?_0x1bf5a4[_0x18da('0xf')][_0x18da('0x10')](','):['phone'];_0x16cd67['$or']=_[_0x18da('0x11')](_0x455c48,function(_0x31dd7d){var _0x51fb2d={};_0x51fb2d[_0x31dd7d]=_0xf9a287[_0x18da('0x12')]?_0xf9a287[_0x18da('0x13')]:_0xf9a287['calleridnum'];return _0x51fb2d;});_0x177755=_0xf9a287[_0x18da('0x12')]?_0xf9a287[_0x18da('0x13')]:_0xf9a287[_0x18da('0x14')];}var _0xc7033e=['id',_0x18da('0x15'),'lastName',_0x18da('0x16'),_0x18da('0x17'),_0x18da('0x18'),_0x18da('0xe'),_0x18da('0x19'),_0x18da('0x1a'),_0x18da('0x1b')];var _0x77f516=_[_0x18da('0x1c')](_0xc7033e,_0x455c48);BPromise['resolve']()[_0x18da('0x1d')](cmContactRpc[_0x18da('0x1e')]({'attributes':_0x77f516,'where':_0x16cd67,'phone':_0x177755}))['then'](function(_0x183f63){_0x51f0ba=_0x183f63;if(!_[_0x18da('0x1f')](_0x51f0ba)){if(_0x51f0ba[_0x18da('0x20')]===0x1){_0x8765fc=_0x51f0ba[0x0];logger[_0x18da('0x21')]('[CM][%s][%s]\x20Contact\x20found:%s',_0xf9a287[_0x18da('0x22')],_0x30c4d6['id'],_0x8765fc['id']);}else{logger[_0x18da('0x21')](_0x18da('0x23'),_0xf9a287['uniqueid'],_0x30c4d6['id'],_['map'](_0x51f0ba,'id')['join'](','));}return;}else{logger[_0x18da('0x21')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0xf9a287[_0x18da('0x22')],_0x30c4d6['id']);var _0x1ccba3={'ListId':_0x599d4a};var _0x6957b8=_0x1bf5a4[_0x18da('0x24')]&&_0x1bf5a4[_0x18da('0x24')]!=='0'?_0x1bf5a4[_0x18da('0x24')]:_0x18da('0x16');if(_0x351d79){logger['info'](_0x18da('0x25'),_0xf9a287[_0x18da('0x22')],_0x30c4d6['id']);_0x1ccba3[_0x6957b8]=_[_0x18da('0xc')](_0xf9a287[_0x18da('0x12')])?_0xf9a287[_0x18da('0x14')]:_0xf9a287[_0x18da('0x13')];if(_['isNil'](_0xf9a287[_0x18da('0x12')])){_0x1ccba3[_0x18da('0x15')]=_0xf9a287[_0x18da('0x26')]&&_0xf9a287[_0x18da('0x26')]!==_0x18da('0x27')?_0xf9a287[_0x18da('0x26')]:_0x18da('0x28');}else{_0x1ccba3[_0x18da('0x15')]=_0xf9a287[_0x18da('0x29')]&&_0xf9a287[_0x18da('0x29')]!==''?_0xf9a287[_0x18da('0x29')]:_0x18da('0x28');}return BPromise[_0x18da('0x2a')]()[_0x18da('0x1d')](cmContactRpc['createContact'](_0x1ccba3))[_0x18da('0x1d')](function(_0x5bf992){_0x8765fc=_0x5bf992;_0x51f0ba[_0x18da('0x2b')](_0x5bf992);if(_0x8765fc){logger[_0x18da('0x21')](_0x18da('0x2c'),_0xf9a287[_0x18da('0x22')],_0x30c4d6['id'],_0x8765fc['id']);}return;});}else{logger[_0x18da('0x21')](_0x18da('0x2d'),_0xf9a287[_0x18da('0x22')],_0x30c4d6['id']);_0x1ccba3[_0x6957b8]=_['isNil'](_0xf9a287[_0x18da('0x12')])?_0xf9a287['calleridnum']:_0xf9a287[_0x18da('0x13')];if(_[_0x18da('0xc')](_0xf9a287[_0x18da('0x12')])){_0x1ccba3[_0x18da('0x15')]=_0xf9a287[_0x18da('0x26')]&&_0xf9a287[_0x18da('0x26')]!==''?_0xf9a287['calleridname']:_0x18da('0x28');}else{_0x1ccba3['firstName']=_0xf9a287[_0x18da('0x29')]&&_0xf9a287[_0x18da('0x29')]!==_0x18da('0x27')?_0xf9a287['destcalleridname']:_0x18da('0x28');}_0x8765fc=_0x1ccba3;_0x51f0ba['push'](_0x1ccba3);return;}}})['then'](function(){if(_0x528899){emit(_0xf9a287[_0x18da('0x22')],_0x30c4d6,util[_0x18da('0x2e')](_0x18da('0x2f'),_0x528899[_0x18da('0x30')]),util[_0x18da('0x2e')](_0x18da('0x31'),_0x1bf5a4['action']['toLowerCase']()),{'evt':_[_0x18da('0x32')](_0xf9a287,{'autoCreate':_0x351d79}),'contact':_0x8765fc===undefined?{}:_0x8765fc,'contacts':_0x51f0ba[_0x18da('0x20')]===0x0?undefined:_0x51f0ba});}});}; \ No newline at end of file +var _0x3a67=['scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','firstName','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','action','toLowerCase','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','routeId','calleridnum','destcalleridnum','fax'];(function(_0x3eaa8f,_0x12d15d){var _0x48900b=function(_0x5b7550){while(--_0x5b7550){_0x3eaa8f['push'](_0x3eaa8f['shift']());}};_0x48900b(++_0x12d15d);}(_0x3a67,0x89));var _0x73a6=function(_0x5ec2bd,_0x231a1c){_0x5ec2bd=_0x5ec2bd-0x0;var _0x57613b=_0x3a67[_0x5ec2bd];return _0x57613b;};'use strict';var _=require(_0x73a6('0x0'));var BPromise=require(_0x73a6('0x1'));var Redis=require('ioredis');var util=require(_0x73a6('0x2'));var config=require(_0x73a6('0x3'));var logger=require(_0x73a6('0x4'))(_0x73a6('0x5'));var cmContactRpc=require(_0x73a6('0x6'));config[_0x73a6('0x7')]=_[_0x73a6('0x8')](config[_0x73a6('0x7')],{'host':_0x73a6('0x9'),'port':0x18eb});var io=require(_0x73a6('0xa'))(new Redis(config[_0x73a6('0x7')]));function emit(_0x1f467f,_0x5c8b2e,_0x4168c8,_0x5bb5bd,_0x3fbfba){logger[_0x73a6('0xb')]('[CM][%s][%s]',_0x1f467f,_0x5c8b2e['id'],_0x4168c8,_0x5bb5bd,JSON[_0x73a6('0xc')](_0x3fbfba));io['to'](_0x4168c8)[_0x73a6('0xd')](_0x5bb5bd,_0x3fbfba);}exports[_0x73a6('0xe')]=function(_0x55a935,_0x54904b,_0x464501,_0x5d00ec){var _0x2efae0,_0x186d7d;var _0x4607a2={};var _0x394d91;var _0x5ba64f=Number(_0x464501[_0x73a6('0xf')]);var _0x16285e=_0x464501[_0x73a6('0x10')]?Boolean(Number(_0x464501[_0x73a6('0x10')])):![];var _0x1282dc;var _0xc20450=![];if(!_[_0x73a6('0x11')](_0x464501[_0x73a6('0x12')])){if(_0x464501['data5']=='1')_0xc20450=!![];}if(!_0xc20450){if(_0x5d00ec[_0x73a6('0x13')]){_0x4607a2['id']=_0x5d00ec[_0x73a6('0x13')];}}if(!_0x4607a2['id']){_0x4607a2[_0x73a6('0x14')]=_0x5ba64f;_0x1282dc=_0x464501['data3']&&_0x464501[_0x73a6('0x15')]!=='0'?_0x464501['data3'][_0x73a6('0x16')](','):[_0x73a6('0x17')];_0x4607a2['$or']=_['map'](_0x1282dc,function(_0x417960){var _0x2ccb95={};_0x2ccb95[_0x417960]=_0x5d00ec[_0x73a6('0x18')]?_0x5d00ec['destcalleridnum']:_0x5d00ec[_0x73a6('0x19')];return _0x2ccb95;});_0x394d91=_0x5d00ec[_0x73a6('0x18')]?_0x5d00ec[_0x73a6('0x1a')]:_0x5d00ec[_0x73a6('0x19')];}var _0x53d202=['id','firstName','lastName','phone','mobile',_0x73a6('0x1b'),'ListId','createdAt',_0x73a6('0x1c'),_0x73a6('0x1d')];var _0x59c405=_[_0x73a6('0x1e')](_0x53d202,_0x1282dc);BPromise[_0x73a6('0x1f')]()[_0x73a6('0x20')](cmContactRpc[_0x73a6('0x21')]({'attributes':_0x59c405,'where':_0x4607a2,'phone':_0x394d91}))[_0x73a6('0x20')](function(_0x334384){_0x186d7d=_0x334384;if(!_[_0x73a6('0x22')](_0x186d7d)){if(_0x186d7d[_0x73a6('0x23')]===0x1){_0x2efae0=_0x186d7d[0x0];logger[_0x73a6('0xb')](_0x73a6('0x24'),_0x5d00ec[_0x73a6('0x25')],_0x54904b['id'],_0x2efae0['id']);}else{logger[_0x73a6('0xb')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x5d00ec[_0x73a6('0x25')],_0x54904b['id'],_[_0x73a6('0x26')](_0x186d7d,'id')['join'](','));}return;}else{logger[_0x73a6('0xb')](_0x73a6('0x27'),_0x5d00ec[_0x73a6('0x25')],_0x54904b['id']);var _0x3fe561={'ListId':_0x5ba64f};var _0x216fa0=_0x464501[_0x73a6('0x28')]&&_0x464501[_0x73a6('0x28')]!=='0'?_0x464501[_0x73a6('0x28')]:'phone';if(_0x16285e){logger[_0x73a6('0xb')](_0x73a6('0x29'),_0x5d00ec['uniqueid'],_0x54904b['id']);_0x3fe561[_0x216fa0]=_['isNil'](_0x5d00ec[_0x73a6('0x18')])?_0x5d00ec[_0x73a6('0x19')]:_0x5d00ec[_0x73a6('0x1a')];if(_[_0x73a6('0x11')](_0x5d00ec[_0x73a6('0x18')])){_0x3fe561['firstName']=_0x5d00ec[_0x73a6('0x2a')]&&_0x5d00ec['calleridname']!==_0x73a6('0x2b')?_0x5d00ec[_0x73a6('0x2a')]:_0x73a6('0x2c');}else{_0x3fe561[_0x73a6('0x2d')]=_0x5d00ec[_0x73a6('0x2e')]&&_0x5d00ec[_0x73a6('0x2e')]!==_0x73a6('0x2b')?_0x5d00ec[_0x73a6('0x2e')]:_0x73a6('0x2c');}return BPromise['resolve']()[_0x73a6('0x20')](cmContactRpc[_0x73a6('0x2f')](_0x3fe561))[_0x73a6('0x20')](function(_0x4c951f){_0x2efae0=_0x4c951f;_0x186d7d[_0x73a6('0x30')](_0x4c951f);if(_0x2efae0){logger[_0x73a6('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x5d00ec[_0x73a6('0x25')],_0x54904b['id'],_0x2efae0['id']);}return;});}else{logger[_0x73a6('0xb')](_0x73a6('0x31'),_0x5d00ec[_0x73a6('0x25')],_0x54904b['id']);_0x3fe561[_0x216fa0]=_[_0x73a6('0x11')](_0x5d00ec[_0x73a6('0x18')])?_0x5d00ec[_0x73a6('0x19')]:_0x5d00ec[_0x73a6('0x1a')];if(_[_0x73a6('0x11')](_0x5d00ec[_0x73a6('0x18')])){_0x3fe561[_0x73a6('0x2d')]=_0x5d00ec['calleridname']&&_0x5d00ec[_0x73a6('0x2a')]!==_0x73a6('0x2b')?_0x5d00ec[_0x73a6('0x2a')]:'Unknown';}else{_0x3fe561['firstName']=_0x5d00ec[_0x73a6('0x2e')]&&_0x5d00ec[_0x73a6('0x2e')]!==_0x73a6('0x2b')?_0x5d00ec[_0x73a6('0x2e')]:_0x73a6('0x2c');}_0x2efae0=_0x3fe561;_0x186d7d[_0x73a6('0x30')](_0x3fe561);return;}}})[_0x73a6('0x20')](function(){if(_0x55a935){emit(_0x5d00ec[_0x73a6('0x25')],_0x54904b,util[_0x73a6('0x32')](_0x73a6('0x33'),_0x55a935['name']),util[_0x73a6('0x32')](_0x73a6('0x34'),_0x464501[_0x73a6('0x35')][_0x73a6('0x36')]()),{'evt':_['merge'](_0x5d00ec,{'autoCreate':_0x16285e}),'contact':_0x2efae0===undefined?{}:_0x2efae0,'contacts':_0x186d7d['length']===0x0?undefined:_0x186d7d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2026f84..92b4283 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 _0x960c=['event','queue','agent','membername','lastevent','null','substatus','offlineMessage','created','equals','exports','util','url','ioredis','./urlforward','./integration','./script','../../../config/environment','../ami','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','status','merge','variables','length','Actions','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','buildUri','isNil','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','data3','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','exec','integration','routeId','urlforward','script','parse','query','replace','checkTrigger','channel','AllConditions','every','checkConditions','AnyConditions','some','debug','checkTrigger:\x20trigger','inspect','evt','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','message'];(function(_0x450b00,_0x1cc659){var _0x219b54=function(_0x46fd91){while(--_0x46fd91){_0x450b00['push'](_0x450b00['shift']());}};_0x219b54(++_0x1cc659);}(_0x960c,0x113));var _0xc960=function(_0x456fa9,_0x4b4e81){_0x456fa9=_0x456fa9-0x0;var _0x1b7514=_0x960c[_0x456fa9];return _0x1b7514;};'use strict';var util=require(_0xc960('0x0'));var _=require('lodash');var url=require(_0xc960('0x1'));var Mustache=require('mustache');var Redis=require(_0xc960('0x2'));var urlforward=require(_0xc960('0x3'));var integration=require(_0xc960('0x4'));var cmContact=require('./cmContact');var script=require(_0xc960('0x5'));var config=require(_0xc960('0x6'));var logger=require('../../../config/logger')('trigger');var ami=require(_0xc960('0x7'));config[_0xc960('0x8')]=_[_0xc960('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc960('0xa'))(new Redis(config[_0xc960('0x8')]));var operators={'equals':function(_0x5a198f,_0x566cec){return _0x5a198f==_0x566cec;},'not_equals':function(_0xcf6929,_0x27b0d6){return _0xcf6929!=_0x27b0d6;}};var barAndWebActions=[_0xc960('0xb'),_0xc960('0x1'),_0xc960('0xc')];function Trigger(_0x5358d0){this[_0xc960('0xd')]=_0x5358d0[_0xc960('0xd')];this[_0xc960('0xe')]=_0x5358d0[_0xc960('0xe')];this[_0xc960('0xf')]=_0x5358d0[_0xc960('0xf')];this[_0xc960('0x10')]=_0x5358d0[_0xc960('0x10')];this[_0xc960('0x11')]=_0x5358d0[_0xc960('0x11')];this[_0xc960('0x12')]=_0x5358d0['zendeskAccounts'];this[_0xc960('0x13')]=_0x5358d0[_0xc960('0x13')];this[_0xc960('0x14')]=_0x5358d0[_0xc960('0x14')];this['sugarcrmAccounts']=_0x5358d0[_0xc960('0x15')];this[_0xc960('0x16')]=_0x5358d0[_0xc960('0x16')];this[_0xc960('0x17')]=_0x5358d0[_0xc960('0x17')];this[_0xc960('0x18')]=_0x5358d0[_0xc960('0x18')];this[_0xc960('0x19')]=_0x5358d0[_0xc960('0x19')];this[_0xc960('0x1a')]=_0x5358d0[_0xc960('0x1a')];this[_0xc960('0x1b')]=_0x5358d0[_0xc960('0x1b')];this[_0xc960('0x1c')]={'zendesk':this[_0xc960('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xc960('0x13')],'sugarcrm':this[_0xc960('0x15')],'zoho':this[_0xc960('0x16')],'desk':this[_0xc960('0x17')],'vtiger':this[_0xc960('0x18')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xc960('0x1b')],'servicenow':this[_0xc960('0x19')]};ami['on'](_0xc960('0x1d'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on'](_0xc960('0x20'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on'](_0xc960('0x21'),this['syncCustomEvent']['bind'](this));ami['on'](_0xc960('0x22'),this['syncCustomEvent'][_0xc960('0x1f')](this));ami['on'](_0xc960('0x23'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on'](_0xc960('0x24'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on'](_0xc960('0x25'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on']('custom:agentcongestion',this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on'](_0xc960('0x26'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on'](_0xc960('0x27'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent']['bind'](this));ami['on'](_0xc960('0x28'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on'](_0xc960('0x29'),this['syncAgentDial']['bind'](this));ami['on'](_0xc960('0x2a'),this[_0xc960('0x2b')][_0xc960('0x1f')](this));ami['on'](_0xc960('0x2c'),this[_0xc960('0x2b')]['bind'](this));ami['on'](_0xc960('0x2d'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on']('custom:closedinteraction',this[_0xc960('0x1e')]['bind'](this));ami['on'](_0xc960('0x2e'),this['syncCustomEvent'][_0xc960('0x1f')](this));ami['on'](_0xc960('0x2f'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on'](_0xc960('0x30'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0xc960('0x1f')](this));ami['on'](_0xc960('0x31'),this[_0xc960('0x1e')][_0xc960('0x1f')](this));ami['on']('custom:offlineMessage',this[_0xc960('0x1e')][_0xc960('0x1f')](this));}Trigger[_0xc960('0x32')][_0xc960('0x33')]=function(_0x36e2a7,_0x2a8a8d,_0x2aebee){logger[_0xc960('0x34')](_0x36e2a7,_0x2a8a8d,JSON[_0xc960('0x35')](_0x2aebee));io['to'](_0x36e2a7)[_0xc960('0x33')](_0x2a8a8d,_0x2aebee);};Trigger[_0xc960('0x32')]['syncCustomEvent']=function(_0x54936f){var _0x1b9e8c=_[_0xc960('0x36')](_0x54936f);if(typeof _0x1b9e8c[_0xc960('0x37')]===_0xc960('0x38')){_0x1b9e8c[_0xc960('0x37')]=_0xc960('0x39');}logger['debug'](_0xc960('0x1e'),util['inspect'](_0x1b9e8c,{'showHidden':!![],'depth':null}));this[_0xc960('0x3a')](_0x1b9e8c);};Trigger[_0xc960('0x32')][_0xc960('0x2b')]=function(_0x224cbe){if(this[_0xc960('0xe')][_0x224cbe[_0xc960('0x3b')]]){this[_0xc960('0x1e')](_0x224cbe);}};Trigger['prototype'][_0xc960('0x3a')]=function(_0x195fc9){var _0x123edc;for(var _0x4a16a0 in this[_0xc960('0xd')]){if(this['triggers'][_0xc960('0x3c')](_0x4a16a0)){if(this[_0xc960('0xd')][_0x4a16a0][_0xc960('0x3d')]){_0x123edc=this['checkTrigger'](this[_0xc960('0xd')][_0x4a16a0],_0x195fc9);if(_0x123edc){_[_0xc960('0x3e')](_0x195fc9,_0x195fc9[_0xc960('0x3f')]);for(var _0x2f136a=0x0,_0x21cd87,_0x1ce91c,_0x1849a6;_0x2f136a0x0){_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 +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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe14b,0x93));var _0xbe14=function(_0x59f628,_0xdeaae1){_0x59f628=_0x59f628-0x0;var _0x332501=_0xe14b[_0x59f628];return _0x332501;};'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 6fca177..0cf3d0f 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 _0x74cf=['idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','calleridnum','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','../../../../config/logger','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','POST','clientId','username','password','clientSecret','then','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','outbound','destcalleridnum','/systemusers(','body','odata-entityid','substring','lastIndexOf','enduserId','catch','toLowerCase','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','value','contactid','nothing',']\x20Enduser\x20created!','forEach','picklist','type','nameField','customField'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0x74cf,0x9e));var _0xf74c=function(_0x25300c,_0x8d65be){_0x25300c=_0x25300c-0x0;var _0x2dd3e4=_0x74cf[_0x25300c];return _0x2dd3e4;};'use strict';var _=require(_0xf74c('0x0'));var rp=require('request-promise');var util=require(_0xf74c('0x1'));var intUtil=require(_0xf74c('0x2'));var md5=require(_0xf74c('0x3'));var Redis=require('ioredis');var logger=require(_0xf74c('0x4'))('dynamics365');var config=require('../../../../config/environment');config[_0xf74c('0x5')]=_['defaults'](config[_0xf74c('0x5')],{'host':_0xf74c('0x6'),'port':0x18eb});var io=require(_0xf74c('0x7'))(new Redis(config[_0xf74c('0x5')]));function getAuthToken(_0xd015d3,_0x79e297,_0x17459f){if(_0xd015d3[_0xf74c('0x8')]){_0xd015d3[_0xf74c('0x9')]=_0xd015d3[_0xf74c('0xa')][_0xf74c('0xb')];_0xd015d3['tenantId']=_0xd015d3['CloudProvider'][_0xf74c('0xc')];return Promise[_0xf74c('0xd')](_0xd015d3[_0xf74c('0xa')]['data5']);}var _0x521b58={'method':_0xf74c('0xe'),'uri':_0x79e297,'form':{'client_id':_0xd015d3[_0xf74c('0xf')],'resource':_0xd015d3['remoteUri'],'username':_0xd015d3[_0xf74c('0x10')],'password':_0xd015d3[_0xf74c('0x11')],'grant_type':_0xf74c('0x11'),'client_secret':_0xd015d3[_0xf74c('0x12')]},'json':!![]};return rp(_0x521b58)[_0xf74c('0x13')](function(_0x3afbc0){return _0x3afbc0['access_token'];})['catch'](function(_0x110681){logger[_0xf74c('0x14')]('['+[_0x17459f['toUpperCase']()]+_0xf74c('0x15'));return _0x110681[_0xf74c('0x16')];});}function getUser(_0x243c36,_0x59d104,_0x2e7783,_0x12eab2,_0x1b10f5,_0x5b21a2){return new Promise(function(_0x3dfc97,_0x38273e){return getAuthToken(_0x59d104,_0x12eab2,_0x5b21a2)[_0xf74c('0x13')](function(_0x1f3cf8){var _0x5a0ae3={'method':_0xf74c('0x17'),'uri':_0x1b10f5+_0xf74c('0x18'),'headers':{'Authorization':_0xf74c('0x19')+_0x1f3cf8,'OData-Version':_0xf74c('0x1a')},'json':!![]};return rp(_0x5a0ae3);})[_0xf74c('0x13')](function(_0xaa8124){var _0x4e6de5=_0xaa8124['value'];var _0xf9a5c8=![];var _0x3c2861=null;if(!_[_0xf74c('0x1b')](_0x2e7783)){if(intUtil[_0xf74c('0x1c')](_0x2e7783[_0xf74c('0x1d')])){_0x243c36[_0xf74c('0x1e')]=_0x2e7783['email'];for(_0x3c2861=0x0;_0x3c2861<_0x4e6de5[_0xf74c('0x1f')];_0x3c2861++){if(_0x4e6de5[_0x3c2861][_0xf74c('0x20')]===_0x2e7783[_0xf74c('0x1d')]&&!_0x4e6de5[_0x3c2861][_0xf74c('0x21')]){_0xf9a5c8=!![];logger[_0xf74c('0x22')]('['+[_0x5b21a2[_0xf74c('0x23')]()]+_0xf74c('0x24')+_0x4e6de5[_0x3c2861][_0xf74c('0x25')]+'!');_0x243c36[_0xf74c('0x26')]=_0x4e6de5[_0x3c2861]['systemuserid'];}}}}if(!_0xf9a5c8){logger[_0xf74c('0x22')]('['+[_0x5b21a2['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x243c36['userEmail']=_0x59d104['username'];for(_0x3c2861=0x0;_0x3c2861<_0x4e6de5[_0xf74c('0x1f')];_0x3c2861++){if(_0x4e6de5[_0x3c2861][_0xf74c('0x20')]===_0x59d104['username']){_0x243c36[_0xf74c('0x26')]=_0x4e6de5[_0x3c2861][_0xf74c('0x25')];}}}_0x3dfc97(_0x243c36);})['catch'](function(_0x33bd02){_0x38273e(_0x33bd02[_0xf74c('0x16')]);});});}function createEndUser(_0x58f8ff,_0x4f3978,_0x3b9d40,_0x26438b,_0x27ea3f,_0x3ee36d,_0x55fc5e){return new Promise(function(_0x49e7ae,_0x20cd32){return getAuthToken(_0x4f3978,_0x3b9d40,_0x3ee36d)[_0xf74c('0x13')](function(_0x46fe5f){var _0xc26140=_0x3ee36d['toLowerCase']()===_0xf74c('0x27')?_0x27ea3f[_0xf74c('0x28')]:_0x27ea3f['calleridnum'];var _0x5c1dc5={'method':'POST','uri':_0x26438b+'contacts','body':{'fullname':_0xc26140,'firstname':_0xc26140,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf74c('0x29')+_0x58f8ff['userId']+')'},'headers':{'Authorization':_0xf74c('0x19')+_0x46fe5f,'OData-Version':_0xf74c('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x5c1dc5[_0xf74c('0x2a')][_0x55fc5e]=_0xc26140;return rp(_0x5c1dc5);})['then'](function(_0x3aafcb){var _0x12a66d=_0x3aafcb['headers'][_0xf74c('0x2b')];var _0x2511b7=_0x12a66d[_0xf74c('0x2c')](_0x12a66d[_0xf74c('0x2d')]('(')+0x1,_0x12a66d['lastIndexOf'](')'));_0x58f8ff[_0xf74c('0x2e')]=_0x2511b7;_0x49e7ae(_0x58f8ff);})[_0xf74c('0x2f')](function(_0x203998){_0x20cd32(_0x203998[_0xf74c('0x16')]);});});}function getEndUser(_0x1236ed,_0x32599c,_0x4541dd,_0x43154c,_0xf03a7d,_0xeb414b,_0x2dbdc8,_0x56ed7d){var _0x4d7887=_0xeb414b[_0xf74c('0x30')]()===_0xf74c('0x27')?_0xf03a7d[_0xf74c('0x28')]:_0xf03a7d['calleridnum'];return getAuthToken(_0x32599c,_0x4541dd,_0xeb414b)[_0xf74c('0x13')](function(_0x163940){_0x56ed7d=_0x56ed7d?_0x56ed7d:_0xf74c('0x31');var _0x38adc1={'method':_0xf74c('0x17'),'uri':_0x43154c+_0xf74c('0x32')+_0x56ed7d+_0xf74c('0x33')+_0x56ed7d+_0xf74c('0x34')+_0x4d7887['replace']('+','%2b')+'\x27','headers':{'Authorization':_0xf74c('0x19')+_0x163940,'If-None-Match':null,'OData-Version':_0xf74c('0x1a')},'json':!![]};return rp(_0x38adc1);})['then'](function(_0x12b618){var _0x5b2885=![];if(!_0x12b618)return _0x5b2885;var _0xc6e0a3=_0x12b618[_0xf74c('0x35')];for(var _0x4373cd=0x0;_0x4373cd<_0xc6e0a3[_0xf74c('0x1f')];_0x4373cd++){if(_0xc6e0a3[_0x4373cd][_0x56ed7d]===_0x4d7887){_0x5b2885=!![];_0x1236ed[_0xf74c('0x2e')]=_0xc6e0a3[_0x4373cd][_0xf74c('0x36')];}}return _0x5b2885;})[_0xf74c('0x13')](function(_0x10eca6){if(_0x10eca6)return _0x1236ed;if(_0x2dbdc8===_0xf74c('0x37')){logger[_0xf74c('0x22')]('['+[_0xeb414b[_0xf74c('0x23')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x1236ed;}return createEndUser(_0x1236ed,_0x32599c,_0x4541dd,_0x43154c,_0xf03a7d,_0xeb414b,_0x56ed7d)[_0xf74c('0x13')](function(_0x2b2ddb){logger[_0xf74c('0x22')]('['+[_0xeb414b['toUpperCase']()]+_0xf74c('0x38'),_0x2b2ddb['enduserId']);return _0x2b2ddb;});});}function getCustomFields(_0xeec20b,_0x3ab6f6,_0x600cc){var _0xa23867={};if(_0xeec20b[_0xf74c('0x1f')]>0x0){_[_0xf74c('0x39')](_0xeec20b,function(_0x5d54a8){if(_['includes'](['string',_0xf74c('0x3a')],_0x5d54a8[_0xf74c('0x3b')])&&_0x5d54a8[_0xf74c('0x3c')]&&!_0x5d54a8[_0xf74c('0x3d')]){var _0x52e61a=_0x5d54a8[_0xf74c('0x3e')][_0xf74c('0x30')]();var _0x500594=_0x52e61a[_0xf74c('0x2c')](0x0,_0x52e61a[_0xf74c('0x3f')]('_'));var _0x131cab=_0x52e61a[_0xf74c('0x2c')](_0x52e61a['indexOf']('_')+0x1);if(_0x500594===_0x600cc){_0xa23867[_0x131cab]=_0x5d54a8[_0xf74c('0x40')];}}});}return _0xa23867;}function getTicket(_0xde9bb7,_0x2f54e5,_0x1d1a28,_0x37711e,_0x337f1b,_0x2d6d75,_0x12ba37){return new Promise(function(_0x399288,_0x3cdfd3){var _0x288406;return getAuthToken(_0x2f54e5,_0x1d1a28,_0x12ba37)[_0xf74c('0x13')](function(_0xd7e1b4){if(_0x2d6d75[_0xf74c('0x41')]===_0xf74c('0x42')){_0x288406={'method':_0xf74c('0xe'),'uri':_0x37711e+_0xf74c('0x43'),'body':Object[_0xf74c('0x44')]({},{'title':intUtil[_0xf74c('0x45')](_0x2d6d75[_0xf74c('0x46')],_0x337f1b,'\x20'),'description':intUtil['getString'](_0x2d6d75[_0xf74c('0x47')],_0x337f1b,'\x0a'),'customerid_contact@odata.bind':_0xde9bb7[_0xf74c('0x2e')]?_0xf74c('0x48')+_0xde9bb7[_0xf74c('0x2e')]+')':undefined,'ownerid@odata.bind':_0xf74c('0x29')+_0xde9bb7[_0xf74c('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x2d6d75[_0xf74c('0x49')],_0x337f1b,_0x2d6d75[_0xf74c('0x41')])),'headers':{'Authorization':_0xf74c('0x19')+_0xd7e1b4,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2d6d75[_0xf74c('0x41')]===_0xf74c('0x4a')){var _0x1e60e3=_0xde9bb7[_0xf74c('0x2e')]?[{'partyid_systemuser@odata.bind':_0xf74c('0x29')+_0xde9bb7[_0xf74c('0x26')]+')','participationtypemask':_0xde9bb7[_0xf74c('0x4b')]===_0xf74c('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0xf74c('0x48')+_0xde9bb7[_0xf74c('0x2e')]+')','participationtypemask':_0xde9bb7[_0xf74c('0x4b')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0xde9bb7[_0xf74c('0x26')]+')','participationtypemask':_0xde9bb7['callDirection']===_0xf74c('0x4c')?0x2:0x1}];_0x288406={'method':_0xf74c('0xe'),'uri':_0x37711e+_0xf74c('0x4d'),'body':Object[_0xf74c('0x44')]({},{'subject':intUtil[_0xf74c('0x45')](_0x2d6d75[_0xf74c('0x46')],_0x337f1b,'\x20'),'phonenumber':String(_0x337f1b[_0xf74c('0x4e')]),'description':intUtil[_0xf74c('0x45')](_0x2d6d75[_0xf74c('0x47')],_0x337f1b,'\x0a'),'regardingobjectid_contact@odata.bind':_0xde9bb7[_0xf74c('0x2e')]?_0xf74c('0x48')+_0xde9bb7[_0xf74c('0x2e')]+')':undefined,'ownerid@odata.bind':_0xf74c('0x29')+_0xde9bb7['userId']+')','directioncode':_0xde9bb7[_0xf74c('0x4b')]===_0xf74c('0x4c')?![]:!![],'phonecall_activity_parties':_0x1e60e3},getCustomFields(_0x2d6d75[_0xf74c('0x49')],_0x337f1b,_0x2d6d75[_0xf74c('0x41')])),'headers':{'Authorization':_0xf74c('0x19')+_0xd7e1b4,'OData-Version':_0xf74c('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x288406);})[_0xf74c('0x13')](function(_0x11a356){var _0x3e1fe5=_0x11a356[_0xf74c('0x4f')][_0xf74c('0x2b')];var _0x374aae=_0x3e1fe5[_0xf74c('0x2c')](_0x3e1fe5[_0xf74c('0x2d')]('(')+0x1,_0x3e1fe5['lastIndexOf'](')'));_0xde9bb7[_0xf74c('0x50')]=_0x374aae;_0x399288(_0xde9bb7);})[_0xf74c('0x2f')](function(_0x44073b){_0x3cdfd3(_0x44073b['message']);});});}function emit(_0x316522,_0x5178ac,_0x2fa63e,_0x30a316){var _0x5e4eff={'uri':util[_0xf74c('0x51')](_0xf74c('0x52'),_0x316522,_0x2fa63e,_0x30a316)};io['to'](util['format'](_0xf74c('0x53'),_0x5178ac))[_0xf74c('0x54')](_0xf74c('0x55'),_0x5e4eff);}exports['cs']=function(_0x4fdca3,_0x4e84f9,_0x340df0,_0x91be3,_0x5041a1,_0x115037,_0x5def73,_0x59e47b){var _0x281de9={};_0x115037[_0xf74c('0x9')]=_0x115037[_0xf74c('0x8')]?intUtil[_0xf74c('0x56')](_0x115037['CloudProvider'][_0xf74c('0xb')]):intUtil[_0xf74c('0x56')](_0x115037['remoteUri']);_0x115037[_0xf74c('0x57')]=intUtil['stripTrailingSlash'](_0x115037[_0xf74c('0x57')]);_0x281de9['callDirection']=_0x59e47b===_0xf74c('0x4c')||_0x59e47b==='unmanaged'?_0xf74c('0x4c'):_0xf74c('0x27');var _0x47aba1=_0x115037[_0xf74c('0x8')]?util[_0xf74c('0x51')](_0xf74c('0x58'),_0x115037[_0xf74c('0xa')]['data7']):util[_0xf74c('0x51')](_0xf74c('0x58'),_0x115037[_0xf74c('0x9')]);var _0x5645cc=util[_0xf74c('0x51')](_0xf74c('0x59'),_0x115037['tenantId']);var _0x5cf2c5=util['format'](_0xf74c('0x5a'),_0x115037[_0xf74c('0x57')],_0x4e84f9[_0xf74c('0x5b')],md5(_0x4e84f9['uniqueid']));if(_0x5041a1&&_0x5041a1[_0xf74c('0x5c')]){logger[_0xf74c('0x22')](_0xf74c('0x5d'),_0xf74c('0x5e'));_0x4e84f9[_0xf74c('0x5f')]=_0x5cf2c5;}else if(_0x5def73&&_0x5def73['recordingFormat']&&_0x5def73[_0xf74c('0x60')]!==_0xf74c('0x61')){logger[_0xf74c('0x22')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4e84f9[_0xf74c('0x5f')]=_0x5cf2c5;}else{_0x4e84f9[_0xf74c('0x5f')]='';}return getUser(_0x281de9,_0x115037,_0x91be3,_0x5645cc,_0x47aba1,_0x59e47b)[_0xf74c('0x13')](function(_0x4aad1f){logger[_0xf74c('0x22')]('['+_0x59e47b[_0xf74c('0x23')]()+_0xf74c('0x62'),_0x4aad1f[_0xf74c('0x26')]);logger['info']('['+_0x59e47b['toUpperCase']()+_0xf74c('0x63'),_0x4aad1f[_0xf74c('0x1e')]);return getEndUser(_0x4aad1f,_0x115037,_0x5645cc,_0x47aba1,_0x4e84f9,_0x59e47b,_0x340df0[_0xf74c('0x64')],_0x340df0[_0xf74c('0x65')]);})[_0xf74c('0x13')](function(_0x1df265){logger[_0xf74c('0x22')]('['+_0x59e47b[_0xf74c('0x23')]()+_0xf74c('0x66'),_0x1df265[_0xf74c('0x2e')]);logger[_0xf74c('0x22')]('['+_0x59e47b['toUpperCase']()+_0xf74c('0x67'),_0x4e84f9[_0xf74c('0x4e')]);return getTicket(_0x1df265,_0x115037,_0x5645cc,_0x47aba1,_0x4e84f9,_0x340df0,_0x59e47b);})[_0xf74c('0x13')](function(_0x89acbf){logger[_0xf74c('0x22')](util[_0xf74c('0x51')]('['+_0x59e47b[_0xf74c('0x23')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x340df0[_0xf74c('0x41')],_0x89acbf[_0xf74c('0x50')]));logger['info'](util[_0xf74c('0x51')]('['+_0x59e47b[_0xf74c('0x23')]()+']\x20Call\x20direction:\x20%s',_0x59e47b));if(_0x59e47b!==_0xf74c('0x68')&&_0x340df0[_0xf74c('0x69')]){logger[_0xf74c('0x22')]('['+_0x59e47b['toUpperCase']()+']',_0xf74c('0x6a'));emit(_0x115037[_0xf74c('0x9')],_0x91be3[_0xf74c('0x6b')],_0x340df0[_0xf74c('0x41')],_0x89acbf['ticketId']);}})[_0xf74c('0x2f')](function(_0x59b239){logger[_0xf74c('0x14')]('['+_0x59e47b[_0xf74c('0x23')]()+_0xf74c('0x6c'),_0x59b239[_0xf74c('0x16')]);console[_0xf74c('0x14')](_0xf74c('0x6d'),_0x59b239);});}; \ No newline at end of file +var _0xe52b=['systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','internalemailaddress','email','isdisabled',']\x20Agent\x20found\x20','systemuserid','info','userEmail','length','userId','catch','toLowerCase','destcalleridnum','/systemusers(','headers','substring','lastIndexOf','enduserId','outbound','calleridnum','telephone1','GET','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','picklist','type','nameField','idField','indexOf','content','incidents','assign','getString','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','Subjects','Descriptions','odata-entityid','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact','ticketId','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','then'];(function(_0x482d82,_0xa261ff){var _0x43f33e=function(_0x46f200){while(--_0x46f200){_0x482d82['push'](_0x482d82['shift']());}};_0x43f33e(++_0xa261ff);}(_0xe52b,0x198));var _0xbe52=function(_0x39d1c2,_0x170148){_0x39d1c2=_0x39d1c2-0x0;var _0x369078=_0xe52b[_0x39d1c2];return _0x369078;};'use strict';var _=require(_0xbe52('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0xbe52('0x1'));var md5=require(_0xbe52('0x2'));var Redis=require(_0xbe52('0x3'));var logger=require(_0xbe52('0x4'))(_0xbe52('0x5'));var config=require('../../../../config/environment');config[_0xbe52('0x6')]=_[_0xbe52('0x7')](config[_0xbe52('0x6')],{'host':_0xbe52('0x8'),'port':0x18eb});var io=require(_0xbe52('0x9'))(new Redis(config[_0xbe52('0x6')]));function getAuthToken(_0x5cd798,_0x3668e0,_0x359a33){if(_0x5cd798[_0xbe52('0xa')]){_0x5cd798['remoteUri']=_0x5cd798[_0xbe52('0xb')][_0xbe52('0xc')];_0x5cd798[_0xbe52('0xd')]=_0x5cd798['CloudProvider'][_0xbe52('0xe')];return Promise[_0xbe52('0xf')](_0x5cd798[_0xbe52('0xb')][_0xbe52('0x10')]);}var _0x3a1739={'method':_0xbe52('0x11'),'uri':_0x3668e0,'form':{'client_id':_0x5cd798[_0xbe52('0x12')],'resource':_0x5cd798[_0xbe52('0x13')],'username':_0x5cd798[_0xbe52('0x14')],'password':_0x5cd798[_0xbe52('0x15')],'grant_type':_0xbe52('0x15'),'client_secret':_0x5cd798[_0xbe52('0x16')]},'json':!![]};return rp(_0x3a1739)['then'](function(_0xaad97a){return _0xaad97a[_0xbe52('0x17')];})['catch'](function(_0x484780){logger['error']('['+[_0x359a33[_0xbe52('0x18')]()]+_0xbe52('0x19'));return _0x484780[_0xbe52('0x1a')];});}function getUser(_0x116735,_0x52311c,_0xeef5f4,_0x5c8253,_0xc0d869,_0x35db44){return new Promise(function(_0x5ee14a,_0x4d0367){return getAuthToken(_0x52311c,_0x5c8253,_0x35db44)[_0xbe52('0x1b')](function(_0xdc1bb){var _0x45cc48={'method':'GET','uri':_0xc0d869+_0xbe52('0x1c'),'headers':{'Authorization':_0xbe52('0x1d')+_0xdc1bb,'OData-Version':_0xbe52('0x1e')},'json':!![]};return rp(_0x45cc48);})[_0xbe52('0x1b')](function(_0x17787c){var _0x32452a=_0x17787c[_0xbe52('0x1f')];var _0x73de6c=![];var _0x427724=null;if(!_[_0xbe52('0x20')](_0xeef5f4)){if(intUtil[_0xbe52('0x21')](_0xeef5f4['email'])){_0x116735['userEmail']=_0xeef5f4['email'];for(_0x427724=0x0;_0x427724<_0x32452a['length'];_0x427724++){if(_0x32452a[_0x427724][_0xbe52('0x22')]===_0xeef5f4[_0xbe52('0x23')]&&!_0x32452a[_0x427724][_0xbe52('0x24')]){_0x73de6c=!![];logger['info']('['+[_0x35db44[_0xbe52('0x18')]()]+_0xbe52('0x25')+_0x32452a[_0x427724][_0xbe52('0x26')]+'!');_0x116735['userId']=_0x32452a[_0x427724][_0xbe52('0x26')];}}}}if(!_0x73de6c){logger[_0xbe52('0x27')]('['+[_0x35db44['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x116735[_0xbe52('0x28')]=_0x52311c[_0xbe52('0x14')];for(_0x427724=0x0;_0x427724<_0x32452a[_0xbe52('0x29')];_0x427724++){if(_0x32452a[_0x427724][_0xbe52('0x22')]===_0x52311c[_0xbe52('0x14')]){_0x116735[_0xbe52('0x2a')]=_0x32452a[_0x427724][_0xbe52('0x26')];}}}_0x5ee14a(_0x116735);})[_0xbe52('0x2b')](function(_0x58738a){_0x4d0367(_0x58738a[_0xbe52('0x1a')]);});});}function createEndUser(_0x5bea81,_0x5e2215,_0x289758,_0x472953,_0x508299,_0x3f310b,_0x54a168){return new Promise(function(_0x33e9b0,_0x40e01a){return getAuthToken(_0x5e2215,_0x289758,_0x3f310b)[_0xbe52('0x1b')](function(_0x594605){var _0x4d57c6=_0x3f310b[_0xbe52('0x2c')]()==='outbound'?_0x508299[_0xbe52('0x2d')]:_0x508299['calleridnum'];var _0x22f3fd={'method':_0xbe52('0x11'),'uri':_0x472953+'contacts','body':{'fullname':_0x4d57c6,'firstname':_0x4d57c6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xbe52('0x2e')+_0x5bea81[_0xbe52('0x2a')]+')'},'headers':{'Authorization':_0xbe52('0x1d')+_0x594605,'OData-Version':_0xbe52('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x22f3fd['body'][_0x54a168]=_0x4d57c6;return rp(_0x22f3fd);})[_0xbe52('0x1b')](function(_0x96ed77){var _0x648b1a=_0x96ed77[_0xbe52('0x2f')]['odata-entityid'];var _0x398ac0=_0x648b1a[_0xbe52('0x30')](_0x648b1a[_0xbe52('0x31')]('(')+0x1,_0x648b1a[_0xbe52('0x31')](')'));_0x5bea81[_0xbe52('0x32')]=_0x398ac0;_0x33e9b0(_0x5bea81);})[_0xbe52('0x2b')](function(_0x40dccf){_0x40e01a(_0x40dccf[_0xbe52('0x1a')]);});});}function getEndUser(_0x21976c,_0x517abb,_0x228357,_0x196c59,_0x2bb08b,_0x20a792,_0x98627f,_0x21a20d){var _0x33484c=_0x20a792[_0xbe52('0x2c')]()===_0xbe52('0x33')?_0x2bb08b[_0xbe52('0x2d')]:_0x2bb08b[_0xbe52('0x34')];return getAuthToken(_0x517abb,_0x228357,_0x20a792)[_0xbe52('0x1b')](function(_0x251f1b){_0x21a20d=_0x21a20d?_0x21a20d:_0xbe52('0x35');var _0x549670={'method':_0xbe52('0x36'),'uri':_0x196c59+_0xbe52('0x37')+_0x21a20d+'&$filter='+_0x21a20d+_0xbe52('0x38')+_0x33484c[_0xbe52('0x39')]('+',_0xbe52('0x3a'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x251f1b,'If-None-Match':null,'OData-Version':_0xbe52('0x1e')},'json':!![]};return rp(_0x549670);})[_0xbe52('0x1b')](function(_0x2c6f29){var _0x2be20c=![];if(!_0x2c6f29)return _0x2be20c;var _0x2f1a3d=_0x2c6f29['value'];for(var _0xf6379d=0x0;_0xf6379d<_0x2f1a3d[_0xbe52('0x29')];_0xf6379d++){if(_0x2f1a3d[_0xf6379d][_0x21a20d]===_0x33484c){_0x2be20c=!![];_0x21976c['enduserId']=_0x2f1a3d[_0xf6379d][_0xbe52('0x3b')];}}return _0x2be20c;})[_0xbe52('0x1b')](function(_0x199e3c){if(_0x199e3c)return _0x21976c;if(_0x98627f===_0xbe52('0x3c')){logger[_0xbe52('0x27')]('['+[_0x20a792[_0xbe52('0x18')]()]+_0xbe52('0x3d'));return _0x21976c;}return createEndUser(_0x21976c,_0x517abb,_0x228357,_0x196c59,_0x2bb08b,_0x20a792,_0x21a20d)[_0xbe52('0x1b')](function(_0x3e221e){logger[_0xbe52('0x27')]('['+[_0x20a792[_0xbe52('0x18')]()]+_0xbe52('0x3e'),_0x3e221e[_0xbe52('0x32')]);return _0x3e221e;});});}function getCustomFields(_0x3b6d9b,_0x472e06,_0x581ec4){var _0x4fbfbe={};if(_0x3b6d9b['length']>0x0){_['forEach'](_0x3b6d9b,function(_0x41c952){if(_[_0xbe52('0x3f')]([_0xbe52('0x40'),_0xbe52('0x41')],_0x41c952[_0xbe52('0x42')])&&_0x41c952[_0xbe52('0x43')]&&!_0x41c952['customField']){var _0x1e967d=_0x41c952[_0xbe52('0x44')][_0xbe52('0x2c')]();var _0x28e73b=_0x1e967d[_0xbe52('0x30')](0x0,_0x1e967d[_0xbe52('0x45')]('_'));var _0xb4e370=_0x1e967d[_0xbe52('0x30')](_0x1e967d[_0xbe52('0x45')]('_')+0x1);if(_0x28e73b===_0x581ec4){_0x4fbfbe[_0xb4e370]=_0x41c952[_0xbe52('0x46')];}}});}return _0x4fbfbe;}function getTicket(_0x592d15,_0x1767b8,_0x4ae43a,_0xb54f5d,_0x4e70a6,_0x31e131,_0x8cdfbd){return new Promise(function(_0x4291fd,_0x2a6b69){var _0x5e7ef1;return getAuthToken(_0x1767b8,_0x4ae43a,_0x8cdfbd)[_0xbe52('0x1b')](function(_0x451b61){if(_0x31e131['ticketType']==='incident'){_0x5e7ef1={'method':_0xbe52('0x11'),'uri':_0xb54f5d+_0xbe52('0x47'),'body':Object[_0xbe52('0x48')]({},{'title':intUtil['getString'](_0x31e131['Subjects'],_0x4e70a6,'\x20'),'description':intUtil[_0xbe52('0x49')](_0x31e131['Descriptions'],_0x4e70a6,'\x0a'),'customerid_contact@odata.bind':_0x592d15['enduserId']?_0xbe52('0x4a')+_0x592d15['enduserId']+')':undefined,'ownerid@odata.bind':_0xbe52('0x2e')+_0x592d15[_0xbe52('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x31e131[_0xbe52('0x4b')],_0x4e70a6,_0x31e131[_0xbe52('0x4c')])),'headers':{'Authorization':_0xbe52('0x1d')+_0x451b61,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x31e131[_0xbe52('0x4c')]===_0xbe52('0x4d')){var _0x496fc4=_0x592d15[_0xbe52('0x32')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x592d15[_0xbe52('0x2a')]+')','participationtypemask':_0x592d15['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xbe52('0x4a')+_0x592d15[_0xbe52('0x32')]+')','participationtypemask':_0x592d15[_0xbe52('0x4e')]===_0xbe52('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x592d15['userId']+')','participationtypemask':_0x592d15['callDirection']===_0xbe52('0x4f')?0x2:0x1}];_0x5e7ef1={'method':_0xbe52('0x11'),'uri':_0xb54f5d+_0xbe52('0x50'),'body':Object[_0xbe52('0x48')]({},{'subject':intUtil[_0xbe52('0x49')](_0x31e131[_0xbe52('0x51')],_0x4e70a6,'\x20'),'phonenumber':String(_0x4e70a6[_0xbe52('0x34')]),'description':intUtil[_0xbe52('0x49')](_0x31e131[_0xbe52('0x52')],_0x4e70a6,'\x0a'),'regardingobjectid_contact@odata.bind':_0x592d15[_0xbe52('0x32')]?_0xbe52('0x4a')+_0x592d15[_0xbe52('0x32')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x592d15['userId']+')','directioncode':_0x592d15[_0xbe52('0x4e')]===_0xbe52('0x4f')?![]:!![],'phonecall_activity_parties':_0x496fc4},getCustomFields(_0x31e131[_0xbe52('0x4b')],_0x4e70a6,_0x31e131[_0xbe52('0x4c')])),'headers':{'Authorization':_0xbe52('0x1d')+_0x451b61,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5e7ef1);})[_0xbe52('0x1b')](function(_0x5199f9){var _0x469882=_0x5199f9[_0xbe52('0x2f')][_0xbe52('0x53')];var _0x4a0592=_0x469882[_0xbe52('0x30')](_0x469882[_0xbe52('0x31')]('(')+0x1,_0x469882[_0xbe52('0x31')](')'));_0x592d15['ticketId']=_0x4a0592;_0x4291fd(_0x592d15);})[_0xbe52('0x2b')](function(_0x2bd149){_0x2a6b69(_0x2bd149[_0xbe52('0x1a')]);});});}function emit(_0x31c191,_0x2cc71f,_0x5b1c27,_0x340ee1){var _0x47daae={'uri':util['format'](_0xbe52('0x54'),_0x31c191,_0x5b1c27,_0x340ee1)};io['to'](util[_0xbe52('0x55')](_0xbe52('0x56'),_0x2cc71f))['emit'](_0xbe52('0x57'),_0x47daae);}exports['cs']=function(_0x38a1d5,_0x4241cb,_0x520dad,_0x269e92,_0x4e6ade,_0x513116,_0x27d747,_0x1f1855){var _0x5757f5={};_0x513116[_0xbe52('0x13')]=_0x513116['modernAuthentication']?intUtil[_0xbe52('0x58')](_0x513116[_0xbe52('0xb')][_0xbe52('0xc')]):intUtil[_0xbe52('0x58')](_0x513116[_0xbe52('0x13')]);_0x513116[_0xbe52('0x59')]=intUtil[_0xbe52('0x58')](_0x513116[_0xbe52('0x59')]);_0x5757f5[_0xbe52('0x4e')]=_0x1f1855===_0xbe52('0x4f')||_0x1f1855==='unmanaged'?_0xbe52('0x4f'):_0xbe52('0x33');var _0x3d6ab1=_0x513116[_0xbe52('0xa')]?util['format']('%s/api/data/v9.0/',_0x513116[_0xbe52('0xb')][_0xbe52('0xc')]):util['format'](_0xbe52('0x5a'),_0x513116[_0xbe52('0x13')]);var _0x2ff50d=util[_0xbe52('0x55')]('https://login.microsoftonline.com/%s/oauth2/token',_0x513116[_0xbe52('0xd')]);var _0x5a28a8=util[_0xbe52('0x55')](_0xbe52('0x5b'),_0x513116[_0xbe52('0x59')],_0x4241cb['uniqueid'],md5(_0x4241cb[_0xbe52('0x5c')]));if(_0x4e6ade&&_0x4e6ade[_0xbe52('0x5d')]){logger[_0xbe52('0x27')](_0xbe52('0x5e'),_0xbe52('0x5f'));_0x4241cb[_0xbe52('0x60')]=_0x5a28a8;}else if(_0x27d747&&_0x27d747['recordingFormat']&&_0x27d747[_0xbe52('0x61')]!==_0xbe52('0x62')){logger['info'](_0xbe52('0x63'),_0xbe52('0x5f'));_0x4241cb[_0xbe52('0x60')]=_0x5a28a8;}else{_0x4241cb[_0xbe52('0x60')]='';}return getUser(_0x5757f5,_0x513116,_0x269e92,_0x2ff50d,_0x3d6ab1,_0x1f1855)[_0xbe52('0x1b')](function(_0x538dc8){logger[_0xbe52('0x27')]('['+_0x1f1855['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x538dc8[_0xbe52('0x2a')]);logger['info']('['+_0x1f1855[_0xbe52('0x18')]()+_0xbe52('0x64'),_0x538dc8[_0xbe52('0x28')]);return getEndUser(_0x538dc8,_0x513116,_0x2ff50d,_0x3d6ab1,_0x4241cb,_0x1f1855,_0x520dad[_0xbe52('0x65')],_0x520dad[_0xbe52('0x66')]);})[_0xbe52('0x1b')](function(_0xbe737c){logger['info']('['+_0x1f1855[_0xbe52('0x18')]()+']\x20The\x20Enduser\x20ID\x20is:',_0xbe737c[_0xbe52('0x32')]);logger[_0xbe52('0x27')]('['+_0x1f1855[_0xbe52('0x18')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x4241cb[_0xbe52('0x34')]);return getTicket(_0xbe737c,_0x513116,_0x2ff50d,_0x3d6ab1,_0x4241cb,_0x520dad,_0x1f1855);})[_0xbe52('0x1b')](function(_0x4be9d6){logger[_0xbe52('0x27')](util[_0xbe52('0x55')]('['+_0x1f1855[_0xbe52('0x18')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x520dad[_0xbe52('0x4c')],_0x4be9d6[_0xbe52('0x67')]));logger[_0xbe52('0x27')](util[_0xbe52('0x55')]('['+_0x1f1855[_0xbe52('0x18')]()+']\x20Call\x20direction:\x20%s',_0x1f1855));if(_0x1f1855!==_0xbe52('0x68')&&_0x520dad['openNewTab']){logger[_0xbe52('0x27')]('['+_0x1f1855[_0xbe52('0x18')]()+']',_0xbe52('0x69'));emit(_0x513116[_0xbe52('0x13')],_0x269e92['name'],_0x520dad[_0xbe52('0x4c')],_0x4be9d6[_0xbe52('0x67')]);}})['catch'](function(_0x4d842a){logger[_0xbe52('0x6a')]('['+_0x1f1855['toUpperCase']()+_0xbe52('0x6b'),_0x4d842a[_0xbe52('0x1a')]);console['error'](_0xbe52('0x6c'),_0x4d842a);});}; \ 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 58fd716..68f0e05 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 _0xd2c2=['variable','variableName','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','format','then','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\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','nameField','toLowerCase','content','type','idField','customField','push'];(function(_0x3f0765,_0x4455a4){var _0xdcb9ec=function(_0x543d73){while(--_0x543d73){_0x3f0765['push'](_0x3f0765['shift']());}};_0xdcb9ec(++_0x4455a4);}(_0xd2c2,0x1e1));var _0x2d2c=function(_0xdafabc,_0x209a64){_0xdafabc=_0xdafabc-0x0;var _0x1e90e5=_0xd2c2[_0xdafabc];return _0x1e90e5;};'use strict';var _=require('lodash');var rp=require(_0x2d2c('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x2d2c('0x1'));var intUtil=require(_0x2d2c('0x2'));var config=require(_0x2d2c('0x3'));var logger=require(_0x2d2c('0x4'))(_0x2d2c('0x5'));config['redis']=_[_0x2d2c('0x6')](config[_0x2d2c('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x2d2c('0x8')};function emit(_0x216b0a,_0x4f3c07,_0x4e211e){io['to'](_0x216b0a)[_0x2d2c('0x9')](_0x4f3c07,_0x4e211e);}function getTicket(_0x5d56aa,_0x2fd70f,_0x55adb6,_0x288cec,_0x3d0745){logger['info'](_0x2d2c('0xa'));var _0x1e1562=_[_0x2d2c('0xb')]({'responder_id':_0x2fd70f['id'],'requester_id':_0x55adb6['id'],'name':util['format'](_0x2d2c('0xc'),_0x3d0745[_0x2d2c('0xd')]),'phone':_0x3d0745[_0x2d2c('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2d2c('0xf')](_0x288cec['Subjects'],_0x3d0745,'\x20'),'description':intUtil['getString'](_0x288cec[_0x2d2c('0x10')],_0x3d0745,_0x2d2c('0x11')),'tags':getTags(_0x288cec[_0x2d2c('0x12')],'name')},getCustomFields(_0x288cec['Fields'],_0x3d0745));_0x1e1562['custom_fields']=_['mapValues'](_[_0x2d2c('0x13')](_0x1e1562[_0x2d2c('0x14')],'id'),_0x2d2c('0x15'));return request({'uri':util['format'](_0x2d2c('0x16'),_0x5d56aa[_0x2d2c('0x17')]),'method':_0x2d2c('0x18'),'body':_0x1e1562})['then'](function(_0x299675){logger[_0x2d2c('0x19')](_0x2d2c('0x1a'));return _0x299675;});}function getUser(_0x2c704a,_0x3d294c){if(intUtil['validateEmail'](_0x3d294c)){return request({'uri':util[_0x2d2c('0x1b')]('%s/api/v2/agents',_0x2c704a[_0x2d2c('0x17')]),'qs':{'email':_0x3d294c}})[_0x2d2c('0x1c')](function(_0x4d2ffa){if(_0x4d2ffa[_0x2d2c('0x1d')]){logger[_0x2d2c('0x19')](_0x2d2c('0x1e'));return _[_0x2d2c('0x1f')](_0x4d2ffa,function(_0x1d4503){return _0x1d4503[_0x2d2c('0x20')][_0x2d2c('0x21')]===_0x3d294c;});}else{logger[_0x2d2c('0x19')](_0x2d2c('0x22'));return request({'uri':util[_0x2d2c('0x1b')](_0x2d2c('0x23'),_0x2c704a['remoteUri'])})['then'](function(_0x8096b5){logger['info'](_0x2d2c('0x24'));return _0x8096b5;});}});}else{logger['info'](_0x2d2c('0x25'));return request({'uri':util[_0x2d2c('0x1b')]('%s/api/v2/agents/me',_0x2c704a['remoteUri'])})[_0x2d2c('0x1c')](function(_0xbea287){logger[_0x2d2c('0x19')](_0x2d2c('0x24'));return _0xbea287;});}}function getEndUser(_0x2d56d4,_0xe023d9,_0x595c2e){logger[_0x2d2c('0x19')]('Searching\x20enduser\x20with\x20phone',_0x595c2e);return request({'uri':util[_0x2d2c('0x1b')](_0x2d2c('0x26'),_0x2d56d4[_0x2d2c('0x17')]),'qs':{'phone':_0x595c2e}})[_0x2d2c('0x1c')](function(_0x31c920){if(_0x31c920[_0x2d2c('0x1d')]){logger[_0x2d2c('0x19')](_0x2d2c('0x27'));return _[_0x2d2c('0x1f')](_0x31c920,{'phone':_0x595c2e});}else{logger[_0x2d2c('0x19')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x2d2c('0x1b')]('%s/api/v2/contacts',_0x2d56d4[_0x2d2c('0x17')]),'method':'POST','body':{'name':_0xe023d9,'phone':_0x595c2e}})[_0x2d2c('0x1c')](function(_0x4d3651){logger[_0x2d2c('0x19')](_0x2d2c('0x28'));return _0x4d3651;});}});}function getAuth(_0x520ea1){return util[_0x2d2c('0x1b')]('Basic\x20%s',new Buffer(_0x520ea1[_0x2d2c('0x29')]+':X')[_0x2d2c('0x2a')](_0x2d2c('0x2b')));}function request(_0x51a29b){logger[_0x2d2c('0x2c')](_0x2d2c('0x2d'),JSON[_0x2d2c('0x2e')](_0x51a29b));return rp(_[_0x2d2c('0x6')](_0x51a29b,{'method':_0x2d2c('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x4dcf88,_0x3ca519){var _0x8d6826=[];if(_0x4dcf88&&_0x4dcf88[_0x2d2c('0x1d')]>0x0){_0x8d6826=_['map'](_0x4dcf88,_0x3ca519);}return _0x8d6826;}function getCustomFields(_0x4e31c0,_0x5baa3e){var _0x491934=[];var _0x399e95={'custom_fields':[]};if(_0x4e31c0[_0x2d2c('0x1d')]>0x0){_[_0x2d2c('0x30')](_0x4e31c0,function(_0x5c65b0){if(_[_0x2d2c('0x31')]([_0x2d2c('0x32'),_0x2d2c('0x33')],_0x5c65b0['type'])&&_0x5c65b0[_0x2d2c('0x34')]&&!_0x5c65b0['customField']){_0x399e95[_0x5c65b0['nameField'][_0x2d2c('0x35')]()]=_0x5c65b0[_0x2d2c('0x36')]['toString']();}else if(_['includes']([_0x2d2c('0x32'),'picklist'],_0x5c65b0[_0x2d2c('0x37')])&&_0x5c65b0[_0x2d2c('0x38')]&&_0x5c65b0[_0x2d2c('0x39')]){_0x399e95[_0x2d2c('0x14')][_0x2d2c('0x3a')]({'id':_0x5c65b0[_0x2d2c('0x38')],'value':_0x5c65b0['content']['toString']()});}else if(_0x5c65b0[_0x2d2c('0x37')]===_0x2d2c('0x3b')&&_0x5c65b0[_0x2d2c('0x3c')]&&_0x5c65b0[_0x2d2c('0x38')]&&_0x5c65b0[_0x2d2c('0x39')]){_0x5baa3e[_0x5c65b0[_0x2d2c('0x3c')]]&&_0x399e95['custom_fields'][_0x2d2c('0x3a')]({'id':_0x5c65b0[_0x2d2c('0x38')],'value':_0x5baa3e[_0x5c65b0['variableName']]['toString']()});}else if(_0x5c65b0['type']==='customVariable'&&_0x5c65b0[_0x2d2c('0x3d')]&&_0x5c65b0[_0x2d2c('0x3d')][_0x2d2c('0x3e')]&&_0x5c65b0[_0x2d2c('0x38')]&&_0x5c65b0[_0x2d2c('0x39')]){_0x5baa3e[_0x5c65b0[_0x2d2c('0x3d')][_0x2d2c('0x3e')][_0x2d2c('0x35')]()]&&_0x399e95[_0x2d2c('0x14')][_0x2d2c('0x3a')]({'id':_0x5c65b0['idField'],'value':_0x5baa3e[_0x5c65b0['Variable'][_0x2d2c('0x3e')]['toLowerCase']()]['toString']()});}});}return _0x399e95;}exports[_0x2d2c('0x3f')]=function(_0xe19c07,_0xf2482e,_0x4301ed,_0x131b92,_0x4ffcb8,_0x43c931){var _0x26e6fc,_0x25e42f;_0x43c931[_0x2d2c('0x17')]=intUtil[_0x2d2c('0x40')](_0x43c931[_0x2d2c('0x17')]);_0x43c931['serverUrl']=intUtil[_0x2d2c('0x40')](_0x43c931[_0x2d2c('0x41')]);if(_0x4ffcb8&&_0x4ffcb8[_0x2d2c('0x42')]){logger[_0x2d2c('0x19')](_0x2d2c('0x43'),'Recording\x20is\x20enabled!');_0xf2482e[_0x2d2c('0x44')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x43c931['serverUrl'],_0xf2482e['uniqueid'],md5(_0xf2482e[_0x2d2c('0x45')]));}else{_0xf2482e[_0x2d2c('0x44')]='';}headers[_0x2d2c('0x46')]=getAuth(_0x43c931);return getUser(_0x43c931,_0x131b92[_0x2d2c('0x21')])['then'](function(_0x4e79c5){_0x26e6fc=_0x4e79c5;logger[_0x2d2c('0x19')](_0x2d2c('0x47'),_0x26e6fc['id']);return getEndUser(_0x43c931,_0xf2482e[_0x2d2c('0xd')],_0xf2482e[_0x2d2c('0xe')]);})[_0x2d2c('0x1c')](function(_0x2d4bb6){_0x25e42f=_0x2d4bb6;logger[_0x2d2c('0x19')](_0x2d2c('0x48'),_0x25e42f['id']);return getTicket(_0x43c931,_0x26e6fc,_0x25e42f,_0x4301ed,_0xf2482e);})[_0x2d2c('0x1c')](function(_0x27f8f6){if(_0x27f8f6&&_0x27f8f6['id']){logger[_0x2d2c('0x19')](_0x2d2c('0x1a'));logger[_0x2d2c('0x19')]('The\x20Ticket\x20ID\x20is:',_0x27f8f6['id']);logger[_0x2d2c('0x19')](_0x2d2c('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2d2c('0x1b')](_0x2d2c('0x49'),_0x131b92[_0x2d2c('0x3e')]),_0x2d2c('0x4a'),{'uri':util[_0x2d2c('0x1b')]('%s/helpdesk/tickets/%d',_0x43c931[_0x2d2c('0x17')],_0x27f8f6['id'])});}})['catch'](function(_0x2f97d4){logger[_0x2d2c('0x4b')](_0x2d2c('0x43'),JSON['stringify'](_0x2f97d4));});};exports[_0x2d2c('0x4c')]=function(_0x1dbb19,_0xba3a16,_0x1d16dd,_0x41daa9,_0x54f33,_0x1e5de6,_0x1042fe){var _0x250778,_0x5aa319;_0x1e5de6['remoteUri']=intUtil[_0x2d2c('0x40')](_0x1e5de6[_0x2d2c('0x17')]);_0x1e5de6['serverUrl']=intUtil[_0x2d2c('0x40')](_0x1e5de6[_0x2d2c('0x41')]);if(_0x1042fe&&_0x1042fe[_0x2d2c('0x4d')]&&_0x1042fe['recordingFormat']!==_0x2d2c('0x4e')){logger[_0x2d2c('0x19')](_0x2d2c('0x4f'),_0x2d2c('0x50'));_0xba3a16[_0x2d2c('0x44')]=util[_0x2d2c('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1e5de6[_0x2d2c('0x41')],_0xba3a16[_0x2d2c('0x45')],md5(_0xba3a16[_0x2d2c('0x45')]));}headers[_0x2d2c('0x46')]=getAuth(_0x1e5de6);return getUser(_0x1e5de6,_0x41daa9[_0x2d2c('0x21')])[_0x2d2c('0x1c')](function(_0x1677be){_0x250778=_0x1677be;logger['info'](_0x2d2c('0x47'),_0x250778['id']);return getEndUser(_0x1e5de6,_0xba3a16[_0x2d2c('0x51')],_0xba3a16[_0x2d2c('0x52')]);})[_0x2d2c('0x1c')](function(_0x23e285){_0x5aa319=_0x23e285;logger[_0x2d2c('0x19')]('The\x20Enduser\x20ID\x20is:',_0x5aa319['id']);return getTicket(_0x1e5de6,_0x250778,_0x5aa319,_0x1d16dd,_0xba3a16);})[_0x2d2c('0x1c')](function(_0x433d09){if(_0x433d09&&_0x433d09['id']){logger['info'](_0x2d2c('0x1a'));logger['info'](_0x2d2c('0x53'),_0x433d09['id']);logger[_0x2d2c('0x19')](_0x2d2c('0x4f'),_0x2d2c('0x54'));emit(util[_0x2d2c('0x1b')](_0x2d2c('0x49'),_0x41daa9[_0x2d2c('0x3e')]),_0x2d2c('0x4a'),{'uri':util[_0x2d2c('0x1b')](_0x2d2c('0x55'),_0x1e5de6[_0x2d2c('0x17')],_0x433d09['id'])});}})[_0x2d2c('0x56')](function(_0x2d91c6){logger[_0x2d2c('0x4b')](_0x2d2c('0x4f'),JSON['stringify'](_0x2d91c6));});};exports[_0x2d2c('0x57')]=function(_0x23ff24,_0x18e565,_0xede3eb,_0x1fe2ab,_0x1c7da6,_0x26ec6b){var _0x347fc0,_0x9bc69a;_0x26ec6b[_0x2d2c('0x17')]=intUtil[_0x2d2c('0x40')](_0x26ec6b[_0x2d2c('0x17')]);_0x26ec6b[_0x2d2c('0x41')]=intUtil[_0x2d2c('0x40')](_0x26ec6b['serverUrl']);if(_0x1c7da6&&_0x1c7da6[_0x2d2c('0x42')]){logger[_0x2d2c('0x19')]('['+_0x18e565['lastevent'][_0x2d2c('0x58')]()+']','Recording\x20is\x20enabled!');_0x18e565['recordingURL']=util[_0x2d2c('0x1b')](_0x2d2c('0x59'),_0x26ec6b[_0x2d2c('0x41')],_0x18e565[_0x2d2c('0x45')],md5(_0x18e565[_0x2d2c('0x45')]));}else{_0x18e565['recordingURL']='';}headers['Authorization']=getAuth(_0x26ec6b);return getUser(_0x26ec6b,'')['then'](function(_0x2871ce){_0x347fc0=_0x2871ce;logger[_0x2d2c('0x19')](_0x2d2c('0x47'),_0x347fc0['id']);return getEndUser(_0x26ec6b,_0x18e565[_0x2d2c('0xd')],_0x18e565['calleridnum']);})[_0x2d2c('0x1c')](function(_0x40a3e8){_0x9bc69a=_0x40a3e8;logger[_0x2d2c('0x19')]('The\x20Enduser\x20ID\x20is:',_0x9bc69a['id']);return getTicket(_0x26ec6b,_0x347fc0,_0x9bc69a,_0xede3eb,_0x18e565);})[_0x2d2c('0x1c')](function(_0x3f0ec5){if(_0x3f0ec5){logger[_0x2d2c('0x19')](_0x2d2c('0x1a'));logger[_0x2d2c('0x19')](_0x2d2c('0x53'),_0x3f0ec5['id']);}})['catch'](function(_0x41fdba){logger[_0x2d2c('0x4b')]('['+_0x18e565['lastevent'][_0x2d2c('0x58')]()+']',JSON[_0x2d2c('0x2e')](_0x41fdba));});}; \ No newline at end of file +var _0xedbc=['info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20created.','toString','base64','debug','[HTTP]','GET','map','forEach','includes','string','type','customField','nameField','toLowerCase','picklist','variable','variableName','idField','push','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridname','The\x20Enduser\x20ID\x20is:','stringify','unmanaged','lastevent','toUpperCase','Authorization','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit'];(function(_0x1da778,_0x39d34c){var _0x87ed15=function(_0xbb966f){while(--_0xbb966f){_0x1da778['push'](_0x1da778['shift']());}};_0x87ed15(++_0x39d34c);}(_0xedbc,0xad));var _0xcedb=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xedbc[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xcedb('0x0'));var rp=require(_0xcedb('0x1'));var md5=require(_0xcedb('0x2'));var util=require(_0xcedb('0x3'));var Redis=require(_0xcedb('0x4'));var intUtil=require('./util');var config=require(_0xcedb('0x5'));var logger=require('../../../../config/logger')(_0xcedb('0x6'));config[_0xcedb('0x7')]=_[_0xcedb('0x8')](config[_0xcedb('0x7')],{'host':_0xcedb('0x9'),'port':0x18eb});var io=require(_0xcedb('0xa'))(new Redis(config[_0xcedb('0x7')]));var headers={'Content-Type':_0xcedb('0xb'),'Accept':_0xcedb('0xb')};function emit(_0x4bd1f0,_0x405cc6,_0x218e52){io['to'](_0x4bd1f0)[_0xcedb('0xc')](_0x405cc6,_0x218e52);}function getTicket(_0x45f5f8,_0x591ede,_0x3e86a9,_0x206da5,_0x126f61){logger[_0xcedb('0xd')](_0xcedb('0xe'));var _0x437215=_[_0xcedb('0xf')]({'responder_id':_0x591ede['id'],'requester_id':_0x3e86a9['id'],'name':util[_0xcedb('0x10')](_0xcedb('0x11'),_0x126f61[_0xcedb('0x12')]),'phone':_0x126f61['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xcedb('0x13')](_0x206da5[_0xcedb('0x14')],_0x126f61,'\x20'),'description':intUtil['getString'](_0x206da5[_0xcedb('0x15')],_0x126f61,_0xcedb('0x16')),'tags':getTags(_0x206da5[_0xcedb('0x17')],_0xcedb('0x18'))},getCustomFields(_0x206da5['Fields'],_0x126f61));_0x437215[_0xcedb('0x19')]=_[_0xcedb('0x1a')](_[_0xcedb('0x1b')](_0x437215[_0xcedb('0x19')],'id'),_0xcedb('0x1c'));return request({'uri':util['format'](_0xcedb('0x1d'),_0x45f5f8[_0xcedb('0x1e')]),'method':_0xcedb('0x1f'),'body':_0x437215})[_0xcedb('0x20')](function(_0x235d67){logger['info'](_0xcedb('0x21'));return _0x235d67;});}function getUser(_0x5f4c97,_0x7af3aa){if(intUtil[_0xcedb('0x22')](_0x7af3aa)){return request({'uri':util['format'](_0xcedb('0x23'),_0x5f4c97[_0xcedb('0x1e')]),'qs':{'email':_0x7af3aa}})['then'](function(_0x310b87){if(_0x310b87[_0xcedb('0x24')]){logger['info'](_0xcedb('0x25'));return _['find'](_0x310b87,function(_0x32f6fd){return _0x32f6fd[_0xcedb('0x26')]['email']===_0x7af3aa;});}else{logger[_0xcedb('0xd')](_0xcedb('0x27'));return request({'uri':util[_0xcedb('0x10')]('%s/api/v2/agents/me',_0x5f4c97[_0xcedb('0x1e')])})[_0xcedb('0x20')](function(_0x69dbf0){logger['info'](_0xcedb('0x28'));return _0x69dbf0;});}});}else{logger[_0xcedb('0xd')](_0xcedb('0x29'));return request({'uri':util[_0xcedb('0x10')](_0xcedb('0x2a'),_0x5f4c97['remoteUri'])})[_0xcedb('0x20')](function(_0x276569){logger['info'](_0xcedb('0x28'));return _0x276569;});}}function getEndUser(_0x456632,_0x3d3f54,_0x102779){logger[_0xcedb('0xd')](_0xcedb('0x2b'),_0x102779);return request({'uri':util[_0xcedb('0x10')]('%s/api/v2/contacts',_0x456632[_0xcedb('0x1e')]),'qs':{'phone':_0x102779}})['then'](function(_0x4d739a){if(_0x4d739a[_0xcedb('0x24')]){logger[_0xcedb('0xd')](_0xcedb('0x2c'));return _['find'](_0x4d739a,{'phone':_0x102779});}else{logger[_0xcedb('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/api/v2/contacts',_0x456632['remoteUri']),'method':_0xcedb('0x1f'),'body':{'name':_0x3d3f54,'phone':_0x102779}})[_0xcedb('0x20')](function(_0x171cf0){logger['info'](_0xcedb('0x2d'));return _0x171cf0;});}});}function getAuth(_0x115749){return util[_0xcedb('0x10')]('Basic\x20%s',new Buffer(_0x115749['apiKey']+':X')[_0xcedb('0x2e')](_0xcedb('0x2f')));}function request(_0x3d4124){logger[_0xcedb('0x30')](_0xcedb('0x31'),JSON['stringify'](_0x3d4124));return rp(_['defaults'](_0x3d4124,{'method':_0xcedb('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x2d460d,_0xa73e95){var _0x365a53=[];if(_0x2d460d&&_0x2d460d[_0xcedb('0x24')]>0x0){_0x365a53=_[_0xcedb('0x33')](_0x2d460d,_0xa73e95);}return _0x365a53;}function getCustomFields(_0x32d430,_0x10d9ee){var _0x9e815b=[];var _0x139c1f={'custom_fields':[]};if(_0x32d430[_0xcedb('0x24')]>0x0){_[_0xcedb('0x34')](_0x32d430,function(_0xc3ff20){if(_[_0xcedb('0x35')]([_0xcedb('0x36'),'picklist'],_0xc3ff20[_0xcedb('0x37')])&&_0xc3ff20['nameField']&&!_0xc3ff20[_0xcedb('0x38')]){_0x139c1f[_0xc3ff20[_0xcedb('0x39')][_0xcedb('0x3a')]()]=_0xc3ff20['content']['toString']();}else if(_[_0xcedb('0x35')]([_0xcedb('0x36'),_0xcedb('0x3b')],_0xc3ff20[_0xcedb('0x37')])&&_0xc3ff20['idField']&&_0xc3ff20[_0xcedb('0x38')]){_0x139c1f[_0xcedb('0x19')]['push']({'id':_0xc3ff20['idField'],'value':_0xc3ff20['content'][_0xcedb('0x2e')]()});}else if(_0xc3ff20['type']===_0xcedb('0x3c')&&_0xc3ff20[_0xcedb('0x3d')]&&_0xc3ff20[_0xcedb('0x3e')]&&_0xc3ff20['customField']){_0x10d9ee[_0xc3ff20[_0xcedb('0x3d')]]&&_0x139c1f[_0xcedb('0x19')][_0xcedb('0x3f')]({'id':_0xc3ff20[_0xcedb('0x3e')],'value':_0x10d9ee[_0xc3ff20[_0xcedb('0x3d')]][_0xcedb('0x2e')]()});}else if(_0xc3ff20[_0xcedb('0x37')]===_0xcedb('0x40')&&_0xc3ff20[_0xcedb('0x41')]&&_0xc3ff20[_0xcedb('0x41')][_0xcedb('0x18')]&&_0xc3ff20['idField']&&_0xc3ff20[_0xcedb('0x38')]){_0x10d9ee[_0xc3ff20[_0xcedb('0x41')]['name'][_0xcedb('0x3a')]()]&&_0x139c1f[_0xcedb('0x19')]['push']({'id':_0xc3ff20['idField'],'value':_0x10d9ee[_0xc3ff20[_0xcedb('0x41')][_0xcedb('0x18')][_0xcedb('0x3a')]()][_0xcedb('0x2e')]()});}});}return _0x139c1f;}exports['queue']=function(_0x231671,_0x209628,_0x582ee3,_0x422c68,_0x3fc4e8,_0x4eb49d){var _0x476bef,_0x200d7c;_0x4eb49d['remoteUri']=intUtil[_0xcedb('0x42')](_0x4eb49d['remoteUri']);_0x4eb49d[_0xcedb('0x43')]=intUtil[_0xcedb('0x42')](_0x4eb49d['serverUrl']);if(_0x3fc4e8&&_0x3fc4e8[_0xcedb('0x44')]){logger['info'](_0xcedb('0x45'),'Recording\x20is\x20enabled!');_0x209628[_0xcedb('0x46')]=util[_0xcedb('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4eb49d[_0xcedb('0x43')],_0x209628[_0xcedb('0x47')],md5(_0x209628[_0xcedb('0x47')]));}else{_0x209628[_0xcedb('0x46')]='';}headers['Authorization']=getAuth(_0x4eb49d);return getUser(_0x4eb49d,_0x422c68['email'])[_0xcedb('0x20')](function(_0x3bb0e){_0x476bef=_0x3bb0e;logger['info'](_0xcedb('0x48'),_0x476bef['id']);return getEndUser(_0x4eb49d,_0x209628[_0xcedb('0x12')],_0x209628[_0xcedb('0x49')]);})[_0xcedb('0x20')](function(_0x2180b0){_0x200d7c=_0x2180b0;logger[_0xcedb('0xd')]('The\x20Enduser\x20ID\x20is:',_0x200d7c['id']);return getTicket(_0x4eb49d,_0x476bef,_0x200d7c,_0x582ee3,_0x209628);})[_0xcedb('0x20')](function(_0x42509d){if(_0x42509d&&_0x42509d['id']){logger[_0xcedb('0xd')]('Ticket\x20created!');logger[_0xcedb('0xd')](_0xcedb('0x4a'),_0x42509d['id']);logger[_0xcedb('0xd')](_0xcedb('0x45'),_0xcedb('0x4b'));emit(util[_0xcedb('0x10')](_0xcedb('0x4c'),_0x422c68[_0xcedb('0x18')]),_0xcedb('0x4d'),{'uri':util[_0xcedb('0x10')](_0xcedb('0x4e'),_0x4eb49d['remoteUri'],_0x42509d['id'])});}})[_0xcedb('0x4f')](function(_0x133a35){logger[_0xcedb('0x50')](_0xcedb('0x45'),JSON['stringify'](_0x133a35));});};exports['outbound']=function(_0x3f83fb,_0x5f0973,_0x1bc019,_0x5f4d81,_0xa38c24,_0x5ad3cf,_0x49a004){var _0x304913,_0x37bf4f;_0x5ad3cf[_0xcedb('0x1e')]=intUtil[_0xcedb('0x42')](_0x5ad3cf[_0xcedb('0x1e')]);_0x5ad3cf[_0xcedb('0x43')]=intUtil['stripTrailingSlash'](_0x5ad3cf[_0xcedb('0x43')]);if(_0x49a004&&_0x49a004[_0xcedb('0x51')]&&_0x49a004[_0xcedb('0x51')]!==_0xcedb('0x52')){logger[_0xcedb('0xd')](_0xcedb('0x53'),_0xcedb('0x54'));_0x5f0973[_0xcedb('0x46')]=util[_0xcedb('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ad3cf[_0xcedb('0x43')],_0x5f0973[_0xcedb('0x47')],md5(_0x5f0973[_0xcedb('0x47')]));}headers['Authorization']=getAuth(_0x5ad3cf);return getUser(_0x5ad3cf,_0x5f4d81[_0xcedb('0x55')])[_0xcedb('0x20')](function(_0xc42b30){_0x304913=_0xc42b30;logger[_0xcedb('0xd')]('The\x20User\x20ID\x20is:',_0x304913['id']);return getEndUser(_0x5ad3cf,_0x5f0973[_0xcedb('0x56')],_0x5f0973['destcalleridnum']);})[_0xcedb('0x20')](function(_0x7491be){_0x37bf4f=_0x7491be;logger[_0xcedb('0xd')](_0xcedb('0x57'),_0x37bf4f['id']);return getTicket(_0x5ad3cf,_0x304913,_0x37bf4f,_0x1bc019,_0x5f0973);})[_0xcedb('0x20')](function(_0x5a863c){if(_0x5a863c&&_0x5a863c['id']){logger['info'](_0xcedb('0x21'));logger[_0xcedb('0xd')]('The\x20Ticket\x20ID\x20is:',_0x5a863c['id']);logger[_0xcedb('0xd')](_0xcedb('0x53'),_0xcedb('0x4b'));emit(util[_0xcedb('0x10')](_0xcedb('0x4c'),_0x5f4d81[_0xcedb('0x18')]),_0xcedb('0x4d'),{'uri':util['format'](_0xcedb('0x4e'),_0x5ad3cf[_0xcedb('0x1e')],_0x5a863c['id'])});}})[_0xcedb('0x4f')](function(_0x3f356f){logger[_0xcedb('0x50')](_0xcedb('0x53'),JSON[_0xcedb('0x58')](_0x3f356f));});};exports[_0xcedb('0x59')]=function(_0x53471d,_0xf84ead,_0x5a9a55,_0x16e42d,_0x278ee7,_0xf7fcd2){var _0x201fe4,_0x5c9d85;_0xf7fcd2[_0xcedb('0x1e')]=intUtil[_0xcedb('0x42')](_0xf7fcd2[_0xcedb('0x1e')]);_0xf7fcd2['serverUrl']=intUtil[_0xcedb('0x42')](_0xf7fcd2[_0xcedb('0x43')]);if(_0x278ee7&&_0x278ee7['monitor_format']){logger[_0xcedb('0xd')]('['+_0xf84ead[_0xcedb('0x5a')][_0xcedb('0x5b')]()+']',_0xcedb('0x54'));_0xf84ead[_0xcedb('0x46')]=util[_0xcedb('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf7fcd2[_0xcedb('0x43')],_0xf84ead[_0xcedb('0x47')],md5(_0xf84ead[_0xcedb('0x47')]));}else{_0xf84ead[_0xcedb('0x46')]='';}headers[_0xcedb('0x5c')]=getAuth(_0xf7fcd2);return getUser(_0xf7fcd2,'')[_0xcedb('0x20')](function(_0x497b18){_0x201fe4=_0x497b18;logger[_0xcedb('0xd')]('The\x20User\x20ID\x20is:',_0x201fe4['id']);return getEndUser(_0xf7fcd2,_0xf84ead[_0xcedb('0x12')],_0xf84ead[_0xcedb('0x49')]);})[_0xcedb('0x20')](function(_0x162d22){_0x5c9d85=_0x162d22;logger[_0xcedb('0xd')]('The\x20Enduser\x20ID\x20is:',_0x5c9d85['id']);return getTicket(_0xf7fcd2,_0x201fe4,_0x5c9d85,_0x5a9a55,_0xf84ead);})[_0xcedb('0x20')](function(_0x228f58){if(_0x228f58){logger['info'](_0xcedb('0x21'));logger[_0xcedb('0xd')](_0xcedb('0x4a'),_0x228f58['id']);}})['catch'](function(_0x442c87){logger[_0xcedb('0x50')]('['+_0xf84ead['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x442c87));});}; \ 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 a706399..1d39345 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 _0x6f10=['Subjects','Descriptions','add','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','name','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','users','length','adminId','Admin\x20found:','catch','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','email','User\x20found:','userId','Admin\x20selected','userEmail','adminEmail','Requested\x20Resource\x20not\x20Found','error','/api/lookup?q=','&entities=contact','then','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','message','getString'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f10,0x72));var _0x06f1=function(_0x5a4cf9,_0x183e7f){_0x5a4cf9=_0x5a4cf9-0x0;var _0x374fa8=_0x6f10[_0x5a4cf9];return _0x374fa8;};'use strict';var _=require(_0x06f1('0x0'));var rp=require(_0x06f1('0x1'));var md5=require(_0x06f1('0x2'));var util=require(_0x06f1('0x3'));var moment=require('moment');var Promise=require(_0x06f1('0x4'));var Redis=require(_0x06f1('0x5'));var intUtil=require(_0x06f1('0x6'));var config=require(_0x06f1('0x7'));var logger=require(_0x06f1('0x8'))('freshsales');config['redis']=_[_0x06f1('0x9')](config[_0x06f1('0xa')],{'host':_0x06f1('0xb'),'port':0x18eb});var io=require(_0x06f1('0xc'))(new Redis(config['redis']));function getAdminId(_0x35e890,_0x23caa9,_0x13dc6c,_0x49d467){return new Promise(function(_0x229d09,_0x2ecbc3){var _0x5ec645=![];var _0x42e4bc={'method':_0x06f1('0xd'),'uri':_0x49d467+_0x06f1('0xe'),'json':!![]};_0x42e4bc[_0x06f1('0xf')]=_0x13dc6c;logger[_0x06f1('0x10')]('Getting\x20admin\x20information');return rp(_0x42e4bc)['then'](function(_0x108eab){if(_0x108eab){var _0x377afd=_0x108eab[_0x06f1('0x11')];var _0x2b9e1e=null;for(_0x2b9e1e=0x0;_0x2b9e1e<_0x377afd[_0x06f1('0x12')];_0x2b9e1e++){if(_0x377afd[_0x2b9e1e]['email']===_0x35e890['adminEmail']){_0x35e890[_0x06f1('0x13')]=_0x377afd[_0x2b9e1e]['id'];_0x5ec645=!![];}}if(_0x5ec645){logger['info'](_0x06f1('0x14'),_0x35e890[_0x06f1('0x13')]);_0x229d09(_0x35e890);}else{_0x2ecbc3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2ecbc3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x06f1('0x15')](function(_0x5133d8){logger['error']('['+[_0x23caa9[_0x06f1('0x16')]()]+']',_0x5133d8['message']);_0x2ecbc3(_0x5133d8);});});}function getUser(_0x26bc5d,_0x31c90e,_0x29d71f){return function(_0x1dac58){return new Promise(function(_0x8c71b0,_0x9f6079){var _0x37c5e4={'method':_0x06f1('0xd'),'uri':_0x29d71f+_0x06f1('0xe'),'json':!![]};_0x37c5e4[_0x06f1('0xf')]=_0x31c90e;logger[_0x06f1('0x10')](_0x06f1('0x17'));return rp(_0x37c5e4)['then'](function(_0x4e3ea8){if(_0x4e3ea8){var _0x964690=_0x4e3ea8[_0x06f1('0x11')];var _0x565493=![];var _0x30f993=null;if(_0x1dac58[_0x06f1('0x18')]!==null){logger[_0x06f1('0x10')](_0x06f1('0x19'),_0x1dac58[_0x06f1('0x18')]);_0x1dac58['userEmail']=_0x1dac58[_0x06f1('0x18')];for(_0x30f993=0x0;_0x30f993<_0x964690['length'];_0x30f993++){if(_0x964690[_0x30f993][_0x06f1('0x1a')]===_0x1dac58[_0x06f1('0x18')]){_0x565493=!![];_0x1dac58['userId']=_0x964690[_0x30f993]['id'];logger[_0x06f1('0x10')](_0x06f1('0x1b'),_0x1dac58[_0x06f1('0x1c')]);}}}if(!_0x565493){logger['info'](_0x06f1('0x1d'));_0x1dac58[_0x06f1('0x1e')]=_0x1dac58[_0x06f1('0x1f')];_0x1dac58[_0x06f1('0x1c')]=_0x1dac58[_0x06f1('0x13')];_0x565493=!![];}if(_0x565493){_0x8c71b0(_0x1dac58);}else{_0x9f6079({'statusCode':0x194,'message':_0x06f1('0x20')});}}else{_0x9f6079({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x06f1('0x15')](function(_0x4073c2){logger[_0x06f1('0x21')]('['+[_0x26bc5d['toUpperCase']()]+']',_0x4073c2['message']);_0x9f6079(_0x4073c2);});});};}function searchContact(_0x58ed55,_0x8e6cac,_0x15dd16,_0x3274f2){return new Promise(function(_0x5b15c,_0x2d8c2c){var _0x53a3ce={'method':_0x06f1('0xd'),'headers':_0x8e6cac,'uri':_0x58ed55+_0x06f1('0x22')+_0x3274f2+'&f='+_0x15dd16+_0x06f1('0x23'),'json':!![]};rp(_0x53a3ce)[_0x06f1('0x24')](function(_0x5b665b){var _0x3aaf6f=_[_0x06f1('0x25')](_0x5b665b[_0x06f1('0x26')]['contacts'],[_0x15dd16,_0x3274f2]);_0x5b15c(_0x3aaf6f);})[_0x06f1('0x15')](function(_0x22bc63){_0x2d8c2c(_0x22bc63);});});}function getEndUser(_0x1295ce,_0x437957,_0x2a8ae8){return function(_0x37b4f6){return new Promise(function(_0x400ccb,_0x5c971f){logger[_0x06f1('0x10')](util[_0x06f1('0x27')](_0x06f1('0x28'),_0x37b4f6[_0x06f1('0x29')]));searchContact(_0x2a8ae8,_0x437957,_0x06f1('0x2a'),_0x37b4f6[_0x06f1('0x29')])[_0x06f1('0x24')](function(_0x2a704f){if(_0x2a704f){_0x37b4f6[_0x06f1('0x2b')]=_0x2a704f['id'];logger[_0x06f1('0x10')](_0x06f1('0x2c'),_0x37b4f6[_0x06f1('0x2b')]);return _0x400ccb(_0x37b4f6);}searchContact(_0x2a8ae8,_0x437957,_0x06f1('0x2d'),_0x37b4f6[_0x06f1('0x29')])['then'](function(_0x19856a){if(_0x19856a){_0x37b4f6[_0x06f1('0x2b')]=_0x19856a['id'];logger[_0x06f1('0x10')]('Contact\x20found\x20work_number:',_0x37b4f6[_0x06f1('0x2b')]);return _0x400ccb(_0x37b4f6);}createEndUser(_0x37b4f6,_0x1295ce,_0x437957,_0x2a8ae8)[_0x06f1('0x24')](function(_0x1e4668){logger[_0x06f1('0x10')](_0x06f1('0x2e'),_0x1e4668[_0x06f1('0x2b')]);return _0x400ccb(_0x1e4668);});});})[_0x06f1('0x15')](function(_0x13179f){_0x5c971f(_0x13179f);});});};}function createEndUser(_0x449015,_0xa07b32,_0x47399c,_0x4bdbe5){return new Promise(function(_0x255a4e,_0x3d35e7){var _0x3c4efc=moment();var _0x21ab26={'method':_0x06f1('0x2f'),'uri':_0x4bdbe5+'/api/contacts','body':{'contact':{'last_name':_0x449015[_0x06f1('0x29')],'work_number':_0x449015['contactNumber'],'mobile_number':_0x449015[_0x06f1('0x29')],'owner_id':_0x449015[_0x06f1('0x1c')],'created_at':_0x3c4efc[_0x06f1('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x21ab26[_0x06f1('0xf')]=_0x47399c;logger[_0x06f1('0x10')](_0x06f1('0x30'));return rp(_0x21ab26)['then'](function(_0x5c1c93){_0x449015[_0x06f1('0x2b')]=_0x5c1c93[_0x06f1('0x31')]['id'];_0x255a4e(_0x449015);})[_0x06f1('0x15')](function(_0x4e4548){logger[_0x06f1('0x21')]('['+[_0xa07b32[_0x06f1('0x16')]()]+']',_0x4e4548[_0x06f1('0x32')]);_0x3d35e7(_0x4e4548['message']);});});}function getTicket(_0x1eae17,_0x499d8a,_0x4935de,_0xadd06a,_0x29f419){return function(_0xbddca1){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x2f8e7e,_0x1be4c7){var _0x492f80=moment();var _0x2e81df={'method':_0x06f1('0x2f'),'uri':_0x4935de+'/api/tasks','body':{'title':intUtil[_0x06f1('0x33')](_0xadd06a[_0x06f1('0x34')],_0x29f419,'\x20'),'description':intUtil[_0x06f1('0x33')](_0xadd06a[_0x06f1('0x35')],_0x29f419,'\x0a'),'owner_id':_0xbddca1[_0x06f1('0x1c')],'creater_id':_0xbddca1[_0x06f1('0x13')],'targetable_id':_0xbddca1[_0x06f1('0x2b')],'targetable_type':'Contact','created_at':_0x492f80[_0x06f1('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x492f80[_0x06f1('0x36')](0x1e,'m')[_0x06f1('0x27')](_0x06f1('0x37'))},'json':!![]};_0x2e81df[_0x06f1('0xf')]=_0x499d8a;return rp(_0x2e81df)['then'](function(_0x3dffc2){_0xbddca1[_0x06f1('0x38')]=_0x3dffc2[_0x06f1('0x39')]['id'];logger[_0x06f1('0x10')](_0x06f1('0x3a'),_0xbddca1[_0x06f1('0x38')]);_0x2f8e7e(_0xbddca1);})[_0x06f1('0x15')](function(_0x48a015){logger['error']('['+[_0x1eae17[_0x06f1('0x16')]()]+']',_0x48a015[_0x06f1('0x32')]);_0x1be4c7(_0x48a015[_0x06f1('0x32')]);});});};}function emit(_0x5de5d1,_0x53681a,_0xfb0666){var _0x4710dc={'uri':_0x5de5d1+'/contacts/'+_0xfb0666};io['to'](util['format'](_0x06f1('0x3b'),_0x53681a))[_0x06f1('0x3c')](_0x06f1('0x3d'),_0x4710dc);}exports['cs']=function(_0x6e8993,_0x7cb924,_0x3e13e0,_0x3ea21a,_0x115f03,_0xafefdf,_0x47e82a,_0xa5230c){var _0x4de438={};var _0xccec04={'Authorization':_0x06f1('0x3e')+_0xafefdf[_0x06f1('0x3f')]};_0xafefdf['remoteUri']=intUtil['stripTrailingSlash'](_0xafefdf[_0x06f1('0x40')]);_0xafefdf['serverUrl']=intUtil[_0x06f1('0x41')](_0xafefdf[_0x06f1('0x42')]);var _0x41b9ce=_0xafefdf['remoteUri'];_0x4de438['adminEmail']=_0xafefdf['username'];_0x4de438[_0x06f1('0x29')]=_0xa5230c[_0x06f1('0x43')]()===_0x06f1('0x44')?_0x7cb924[_0x06f1('0x45')]:_0x7cb924[_0x06f1('0x46')];_0x4de438[_0x06f1('0x47')]=_0xa5230c===_0x06f1('0x48')||_0xa5230c===_0x06f1('0x49')?_0x06f1('0x48'):_0x06f1('0x44');if(_0x3ea21a){_0x4de438[_0x06f1('0x18')]=_0x3ea21a[_0x06f1('0x1a')];}var _0x32fa18=util[_0x06f1('0x27')](_0x06f1('0x4a'),_0xafefdf[_0x06f1('0x42')],_0x7cb924['uniqueid'],md5(_0x7cb924[_0x06f1('0x4b')]));if(_0x115f03&&_0x115f03[_0x06f1('0x4c')]){logger[_0x06f1('0x10')]('[QUEUE]',_0x06f1('0x4d'));_0x7cb924[_0x06f1('0x4e')]=_0x32fa18;}else if(_0x47e82a&&_0x47e82a[_0x06f1('0x4f')]&&_0x47e82a[_0x06f1('0x4f')]!=='none'){logger['info'](_0x06f1('0x50'),'Recording\x20is\x20enabled!');_0x7cb924[_0x06f1('0x4e')]=_0x32fa18;}else{_0x7cb924[_0x06f1('0x4e')]='';}return getAdminId(_0x4de438,_0xa5230c,_0xccec04,_0x41b9ce)[_0x06f1('0x24')](getUser(_0xa5230c,_0xccec04,_0x41b9ce))[_0x06f1('0x24')](getEndUser(_0xa5230c,_0xccec04,_0x41b9ce))[_0x06f1('0x24')](getTicket(_0xa5230c,_0xccec04,_0x41b9ce,_0x3e13e0,_0x7cb924))[_0x06f1('0x24')](function(_0x484b0d){logger[_0x06f1('0x10')](util[_0x06f1('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x484b0d[_0x06f1('0x38')]));if(_0xa5230c!=='unmanaged'){logger['info']('['+[_0xa5230c[_0x06f1('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x41b9ce,_0x3ea21a[_0x06f1('0x51')],_0x484b0d[_0x06f1('0x2b')]);}})[_0x06f1('0x15')](function(_0x1606c5){logger['error']('['+[_0xa5230c[_0x06f1('0x16')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x06f1('0x52')](_0x1606c5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb68b=['serverUrl','toLowerCase','calleridnum','callDirection','queue','unmanaged','outbound','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','bluebird','../../../../config/environment','redis','localhost','socket.io-emitter','GET','/api/selector/owners','Getting\x20admin\x20information','then','users','length','email','adminId','info','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','agentEmail','userEmail','userId','adminEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','getString','Descriptions','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash'];(function(_0xeac03f,_0x1f8291){var _0x2c2d82=function(_0x58b8c2){while(--_0x58b8c2){_0xeac03f['push'](_0xeac03f['shift']());}};_0x2c2d82(++_0x1f8291);}(_0xb68b,0x1d4));var _0xbb68=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xb68b[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var rp=require(_0xbb68('0x0'));var md5=require(_0xbb68('0x1'));var util=require('util');var moment=require('moment');var Promise=require(_0xbb68('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xbb68('0x3'));var logger=require('../../../../config/logger')('freshsales');config[_0xbb68('0x4')]=_['defaults'](config[_0xbb68('0x4')],{'host':_0xbb68('0x5'),'port':0x18eb});var io=require(_0xbb68('0x6'))(new Redis(config[_0xbb68('0x4')]));function getAdminId(_0x3fc703,_0x215cc2,_0x39f88f,_0xd62c0){return new Promise(function(_0x10a7cc,_0x591704){var _0x2474d5=![];var _0x2d4010={'method':_0xbb68('0x7'),'uri':_0xd62c0+_0xbb68('0x8'),'json':!![]};_0x2d4010['headers']=_0x39f88f;logger['info'](_0xbb68('0x9'));return rp(_0x2d4010)[_0xbb68('0xa')](function(_0x4a0165){if(_0x4a0165){var _0x4a63b7=_0x4a0165[_0xbb68('0xb')];var _0x4be3cd=null;for(_0x4be3cd=0x0;_0x4be3cd<_0x4a63b7[_0xbb68('0xc')];_0x4be3cd++){if(_0x4a63b7[_0x4be3cd][_0xbb68('0xd')]===_0x3fc703['adminEmail']){_0x3fc703[_0xbb68('0xe')]=_0x4a63b7[_0x4be3cd]['id'];_0x2474d5=!![];}}if(_0x2474d5){logger[_0xbb68('0xf')]('Admin\x20found:',_0x3fc703['adminId']);_0x10a7cc(_0x3fc703);}else{_0x591704({'statusCode':0x194,'message':_0xbb68('0x10')});}}else{_0x591704({'statusCode':0x194,'message':_0xbb68('0x10')});}})[_0xbb68('0x11')](function(_0x5d03cc){logger[_0xbb68('0x12')]('['+[_0x215cc2[_0xbb68('0x13')]()]+']',_0x5d03cc[_0xbb68('0x14')]);_0x591704(_0x5d03cc);});});}function getUser(_0x4d5f7b,_0x567ea8,_0xfb10cc){return function(_0xb7f06d){return new Promise(function(_0x564fa0,_0x4bec2f){var _0x3057d3={'method':_0xbb68('0x7'),'uri':_0xfb10cc+'/api/selector/owners','json':!![]};_0x3057d3[_0xbb68('0x15')]=_0x567ea8;logger['info']('Getting\x20user\x20list');return rp(_0x3057d3)[_0xbb68('0xa')](function(_0x4cacdd){if(_0x4cacdd){var _0x11eb26=_0x4cacdd[_0xbb68('0xb')];var _0x498239=![];var _0x190b4a=null;if(_0xb7f06d['agentEmail']!==null){logger[_0xbb68('0xf')]('Getting\x20user\x20with\x20email',_0xb7f06d[_0xbb68('0x16')]);_0xb7f06d[_0xbb68('0x17')]=_0xb7f06d[_0xbb68('0x16')];for(_0x190b4a=0x0;_0x190b4a<_0x11eb26[_0xbb68('0xc')];_0x190b4a++){if(_0x11eb26[_0x190b4a]['email']===_0xb7f06d[_0xbb68('0x16')]){_0x498239=!![];_0xb7f06d[_0xbb68('0x18')]=_0x11eb26[_0x190b4a]['id'];logger[_0xbb68('0xf')]('User\x20found:',_0xb7f06d[_0xbb68('0x18')]);}}}if(!_0x498239){logger[_0xbb68('0xf')]('Admin\x20selected');_0xb7f06d['userEmail']=_0xb7f06d[_0xbb68('0x19')];_0xb7f06d[_0xbb68('0x18')]=_0xb7f06d['adminId'];_0x498239=!![];}if(_0x498239){_0x564fa0(_0xb7f06d);}else{_0x4bec2f({'statusCode':0x194,'message':_0xbb68('0x10')});}}else{_0x4bec2f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x1ab653){logger['error']('['+[_0x4d5f7b[_0xbb68('0x13')]()]+']',_0x1ab653[_0xbb68('0x14')]);_0x4bec2f(_0x1ab653);});});};}function searchContact(_0x980273,_0x154d6f,_0x5ba031,_0x5f0734){return new Promise(function(_0x242559,_0x177d6f){var _0x3b82c0={'method':'GET','headers':_0x154d6f,'uri':_0x980273+_0xbb68('0x1a')+_0x5f0734+_0xbb68('0x1b')+_0x5ba031+_0xbb68('0x1c'),'json':!![]};rp(_0x3b82c0)[_0xbb68('0xa')](function(_0x265f01){var _0x2e004a=_[_0xbb68('0x1d')](_0x265f01[_0xbb68('0x1e')]['contacts'],[_0x5ba031,_0x5f0734]);_0x242559(_0x2e004a);})['catch'](function(_0xc1359){_0x177d6f(_0xc1359);});});}function getEndUser(_0x5332ce,_0x58cd70,_0x1b50ef){return function(_0x2defb2){return new Promise(function(_0x351bee,_0x452ea3){logger[_0xbb68('0xf')](util[_0xbb68('0x1f')](_0xbb68('0x20'),_0x2defb2[_0xbb68('0x21')]));searchContact(_0x1b50ef,_0x58cd70,'mobile_number',_0x2defb2[_0xbb68('0x21')])[_0xbb68('0xa')](function(_0x3f82e5){if(_0x3f82e5){_0x2defb2[_0xbb68('0x22')]=_0x3f82e5['id'];logger['info'](_0xbb68('0x23'),_0x2defb2[_0xbb68('0x22')]);return _0x351bee(_0x2defb2);}searchContact(_0x1b50ef,_0x58cd70,_0xbb68('0x24'),_0x2defb2['contactNumber'])[_0xbb68('0xa')](function(_0x15501e){if(_0x15501e){_0x2defb2[_0xbb68('0x22')]=_0x15501e['id'];logger['info'](_0xbb68('0x25'),_0x2defb2[_0xbb68('0x22')]);return _0x351bee(_0x2defb2);}createEndUser(_0x2defb2,_0x5332ce,_0x58cd70,_0x1b50ef)['then'](function(_0x1ea753){logger[_0xbb68('0xf')](_0xbb68('0x26'),_0x1ea753[_0xbb68('0x22')]);return _0x351bee(_0x1ea753);});});})[_0xbb68('0x11')](function(_0x28bd7f){_0x452ea3(_0x28bd7f);});});};}function createEndUser(_0xfc7475,_0x31491d,_0x280397,_0x19f8d4){return new Promise(function(_0x2d3522,_0x2ea84c){var _0xe94e54=moment();var _0x5805e4={'method':'POST','uri':_0x19f8d4+_0xbb68('0x27'),'body':{'contact':{'last_name':_0xfc7475[_0xbb68('0x21')],'work_number':_0xfc7475[_0xbb68('0x21')],'mobile_number':_0xfc7475[_0xbb68('0x21')],'owner_id':_0xfc7475[_0xbb68('0x18')],'created_at':_0xe94e54[_0xbb68('0x1f')](_0xbb68('0x28'))}},'json':!![]};_0x5805e4['headers']=_0x280397;logger[_0xbb68('0xf')](_0xbb68('0x29'));return rp(_0x5805e4)[_0xbb68('0xa')](function(_0x1b9f6c){_0xfc7475[_0xbb68('0x22')]=_0x1b9f6c[_0xbb68('0x2a')]['id'];_0x2d3522(_0xfc7475);})[_0xbb68('0x11')](function(_0x571458){logger['error']('['+[_0x31491d[_0xbb68('0x13')]()]+']',_0x571458[_0xbb68('0x14')]);_0x2ea84c(_0x571458[_0xbb68('0x14')]);});});}function getTicket(_0x5f5419,_0x5e2f7d,_0x101325,_0x1ad65a,_0x2244b5){return function(_0x4c0ccf){logger[_0xbb68('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x381006,_0x273e8a){var _0x132657=moment();var _0x23d96c={'method':_0xbb68('0x2b'),'uri':_0x101325+_0xbb68('0x2c'),'body':{'title':intUtil[_0xbb68('0x2d')](_0x1ad65a['Subjects'],_0x2244b5,'\x20'),'description':intUtil[_0xbb68('0x2d')](_0x1ad65a[_0xbb68('0x2e')],_0x2244b5,'\x0a'),'owner_id':_0x4c0ccf['userId'],'creater_id':_0x4c0ccf[_0xbb68('0xe')],'targetable_id':_0x4c0ccf[_0xbb68('0x22')],'targetable_type':'Contact','created_at':_0x132657['format'](_0xbb68('0x28')),'due_date':_0x132657[_0xbb68('0x2f')](0x1e,'m')[_0xbb68('0x1f')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x23d96c['headers']=_0x5e2f7d;return rp(_0x23d96c)[_0xbb68('0xa')](function(_0x260bdf){_0x4c0ccf[_0xbb68('0x30')]=_0x260bdf['task']['id'];logger[_0xbb68('0xf')](_0xbb68('0x31'),_0x4c0ccf[_0xbb68('0x30')]);_0x381006(_0x4c0ccf);})[_0xbb68('0x11')](function(_0xdabab4){logger[_0xbb68('0x12')]('['+[_0x5f5419[_0xbb68('0x13')]()]+']',_0xdabab4[_0xbb68('0x14')]);_0x273e8a(_0xdabab4['message']);});});};}function emit(_0x1d6e0b,_0x20ba47,_0x53252e){var _0x5e2da6={'uri':_0x1d6e0b+_0xbb68('0x32')+_0x53252e};io['to'](util[_0xbb68('0x1f')](_0xbb68('0x33'),_0x20ba47))[_0xbb68('0x34')](_0xbb68('0x35'),_0x5e2da6);}exports['cs']=function(_0x57399c,_0x36a42f,_0xc1476c,_0xb385ea,_0x2023e3,_0x3151a0,_0x2604b0,_0x5208ca){var _0x28c8d0={};var _0x3c6871={'Authorization':_0xbb68('0x36')+_0x3151a0['apiKey']};_0x3151a0[_0xbb68('0x37')]=intUtil[_0xbb68('0x38')](_0x3151a0[_0xbb68('0x37')]);_0x3151a0[_0xbb68('0x39')]=intUtil['stripTrailingSlash'](_0x3151a0[_0xbb68('0x39')]);var _0x5501f6=_0x3151a0[_0xbb68('0x37')];_0x28c8d0[_0xbb68('0x19')]=_0x3151a0['username'];_0x28c8d0[_0xbb68('0x21')]=_0x5208ca[_0xbb68('0x3a')]()==='outbound'?_0x36a42f['destcalleridnum']:_0x36a42f[_0xbb68('0x3b')];_0x28c8d0[_0xbb68('0x3c')]=_0x5208ca===_0xbb68('0x3d')||_0x5208ca===_0xbb68('0x3e')?_0xbb68('0x3d'):_0xbb68('0x3f');if(_0xb385ea){_0x28c8d0[_0xbb68('0x16')]=_0xb385ea[_0xbb68('0xd')];}var _0x3fc8db=util[_0xbb68('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3151a0[_0xbb68('0x39')],_0x36a42f['uniqueid'],md5(_0x36a42f[_0xbb68('0x40')]));if(_0x2023e3&&_0x2023e3['monitor_format']){logger[_0xbb68('0xf')](_0xbb68('0x41'),_0xbb68('0x42'));_0x36a42f['recordingURL']=_0x3fc8db;}else if(_0x2604b0&&_0x2604b0[_0xbb68('0x43')]&&_0x2604b0[_0xbb68('0x43')]!==_0xbb68('0x44')){logger[_0xbb68('0xf')]('[OUTBOUND]',_0xbb68('0x42'));_0x36a42f['recordingURL']=_0x3fc8db;}else{_0x36a42f[_0xbb68('0x45')]='';}return getAdminId(_0x28c8d0,_0x5208ca,_0x3c6871,_0x5501f6)[_0xbb68('0xa')](getUser(_0x5208ca,_0x3c6871,_0x5501f6))['then'](getEndUser(_0x5208ca,_0x3c6871,_0x5501f6))[_0xbb68('0xa')](getTicket(_0x5208ca,_0x3c6871,_0x5501f6,_0xc1476c,_0x36a42f))[_0xbb68('0xa')](function(_0x484fa8){logger[_0xbb68('0xf')](util[_0xbb68('0x1f')](_0xbb68('0x46'),_0x484fa8[_0xbb68('0x30')]));if(_0x5208ca!==_0xbb68('0x3e')){logger[_0xbb68('0xf')]('['+[_0x5208ca[_0xbb68('0x13')]()]+']',_0xbb68('0x47'));emit(_0x5501f6,_0xb385ea[_0xbb68('0x48')],_0x484fa8['endUserId']);}})[_0xbb68('0x11')](function(_0x3c4686){logger[_0xbb68('0x12')]('['+[_0x5208ca['toUpperCase']()]+_0xbb68('0x49'),util[_0xbb68('0x4a')](_0x3c4686,{'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 7c90d2d..c57382b 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 _0x62fd=['Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','toLowerCase','unknown\x20integration','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','data1','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62fd,0x1c8));var _0xd62f=function(_0x6b22da,_0x110e58){_0x6b22da=_0x6b22da-0x0;var _0x894698=_0x62fd[_0x6b22da];return _0x894698;};'use strict';var _=require(_0xd62f('0x0'));var util=require('util');var zendesk=require(_0xd62f('0x1'));var salesforce=require(_0xd62f('0x2'));var sugarcrm=require(_0xd62f('0x3'));var freshdesk=require(_0xd62f('0x4'));var zoho=require(_0xd62f('0x5'));var desk=require(_0xd62f('0x6'));var vtiger=require(_0xd62f('0x7'));var servicenow=require(_0xd62f('0x8'));var dynamics365=require(_0xd62f('0x9'));var freshsales=require(_0xd62f('0xa'));var integrations=[_0xd62f('0xb'),_0xd62f('0xc'),_0xd62f('0xd'),_0xd62f('0xe'),_0xd62f('0xf'),_0xd62f('0x10'),_0xd62f('0x11'),_0xd62f('0x12'),'freshsales',_0xd62f('0x13')];exports[_0xd62f('0x14')]=function(_0x2ba324,_0x166e4c,_0x141e2c,_0x16593c,_0x601c42,_0x3e7c32){if(_0x141e2c){if(_[_0xd62f('0x15')](integrations,_0x2ba324[_0xd62f('0x16')]['toLowerCase']())){try{var _0x10bb27=null;var _0x39a2be='';var _0x1f530c=_0x141e2c[_0x2ba324['data1']['toLowerCase']()];if(_0x1f530c){var _0xaeae57=_0x1f530c[_0x2ba324['data2']];if(_0xaeae57){var _0x13092b=_[_0xd62f('0x17')](_0xaeae57[_0xd62f('0x18')],{'id':parseInt(_0x2ba324[_0xd62f('0x19')],0xa)});if(_0x13092b){if(_0x16593c){if(_0x601c42&&_0x166e4c['queue']){_0x39a2be=_0xd62f('0x1a');}else if(_0x166e4c[_0xd62f('0x1b')]){_0x39a2be=_0xd62f('0x1c');}else{console[_0xd62f('0x1d')](_0xd62f('0x1e'),_0x166e4c);}}else{_0x39a2be=_0xd62f('0x1f');}switch(_0x2ba324['data1'][_0xd62f('0x20')]()){case'zendesk':zendesk[_0x39a2be](_0x2ba324,_0x166e4c,_0x13092b,_0x16593c,_0x601c42,_0xaeae57,_0x3e7c32);break;case _0xd62f('0xc'):salesforce[_0x39a2be](_0x2ba324,_0x166e4c,_0x13092b,_0x16593c,_0x601c42,_0xaeae57,_0x3e7c32);break;case _0xd62f('0xd'):sugarcrm[_0x39a2be](_0x2ba324,_0x166e4c,_0x13092b,_0x16593c,_0x601c42,_0xaeae57,_0x3e7c32);break;case _0xd62f('0xe'):freshdesk[_0x39a2be](_0x2ba324,_0x166e4c,_0x13092b,_0x16593c,_0x601c42,_0xaeae57,_0x3e7c32);break;case _0xd62f('0xf'):zoho[_0x39a2be](_0x2ba324,_0x166e4c,_0x13092b,_0x16593c,_0x601c42,_0xaeae57,_0x3e7c32);break;case _0xd62f('0x10'):desk[_0x39a2be](_0x2ba324,_0x166e4c,_0x13092b,_0x16593c,_0x601c42,_0xaeae57,_0x3e7c32);break;case'vtiger':vtiger[_0x39a2be](_0x2ba324,_0x166e4c,_0x13092b,_0x16593c,_0x601c42,_0xaeae57,_0x3e7c32);break;case'freshsales':freshsales['cs'](_0x2ba324,_0x166e4c,_0x13092b,_0x16593c,_0x601c42,_0xaeae57,_0x3e7c32,_0x39a2be);break;case _0xd62f('0x13'):servicenow['cs'](_0x2ba324,_0x166e4c,_0x13092b,_0x16593c,_0x601c42,_0xaeae57,_0x3e7c32,_0x39a2be);break;case'dynamics365':dynamics365['cs'](_0x2ba324,_0x166e4c,_0x13092b,_0x16593c,_0x601c42,_0xaeae57,_0x3e7c32,_0x39a2be);break;default:console[_0xd62f('0x1d')](_0xd62f('0x21'));}}else{_0x10bb27=require('../../../../config/logger')(_0x2ba324[_0xd62f('0x16')][_0xd62f('0x20')]());_0x10bb27[_0xd62f('0x22')]('[EXEC]',util[_0xd62f('0x23')](_0xd62f('0x24'),_0x2ba324[_0xd62f('0x16')][_0xd62f('0x20')](),_0x2ba324['data3']));}}else{_0x10bb27=require('../../../../config/logger')(_0x2ba324['data1'][_0xd62f('0x20')]());_0x10bb27[_0xd62f('0x22')](_0xd62f('0x25'),util[_0xd62f('0x23')](_0xd62f('0x26'),_0x2ba324[_0xd62f('0x16')][_0xd62f('0x20')](),_0x2ba324[_0xd62f('0x27')]));}}else{}}catch(_0x57c112){console['error'](_0x57c112);}}}}; \ No newline at end of file +var _0x29a1=['freshsales','exec','includes','toLowerCase','queue','outbound','log','EVENT\x20UNKNOWN','data1','salesforce','zoho','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','desk','vtiger'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x29a1,0x124));var _0x129a=function(_0x396956,_0x4401b4){_0x396956=_0x396956-0x0;var _0x236b1c=_0x29a1[_0x396956];return _0x236b1c;};'use strict';var _=require('lodash');var util=require(_0x129a('0x0'));var zendesk=require(_0x129a('0x1'));var salesforce=require(_0x129a('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x129a('0x3'));var zoho=require('./zoho');var desk=require(_0x129a('0x4'));var vtiger=require(_0x129a('0x5'));var servicenow=require(_0x129a('0x6'));var dynamics365=require(_0x129a('0x7'));var freshsales=require(_0x129a('0x8'));var integrations=[_0x129a('0x9'),'salesforce',_0x129a('0xa'),_0x129a('0xb'),'zoho',_0x129a('0xc'),_0x129a('0xd'),'dynamics365',_0x129a('0xe'),'servicenow'];exports[_0x129a('0xf')]=function(_0x10fc46,_0x40cf93,_0x44e8b6,_0x59d7aa,_0xc71d30,_0x413074){if(_0x44e8b6){if(_[_0x129a('0x10')](integrations,_0x10fc46['data1'][_0x129a('0x11')]())){try{var _0x23dc2b=null;var _0x5db74a='';var _0x1322a3=_0x44e8b6[_0x10fc46['data1'][_0x129a('0x11')]()];if(_0x1322a3){var _0x2e4eaf=_0x1322a3[_0x10fc46['data2']];if(_0x2e4eaf){var _0x4e5016=_['find'](_0x2e4eaf['Configurations'],{'id':parseInt(_0x10fc46['data3'],0xa)});if(_0x4e5016){if(_0x59d7aa){if(_0xc71d30&&_0x40cf93[_0x129a('0x12')]){_0x5db74a='queue';}else if(_0x40cf93['routeId']){_0x5db74a=_0x129a('0x13');}else{console[_0x129a('0x14')](_0x129a('0x15'),_0x40cf93);}}else{_0x5db74a='unmanaged';}switch(_0x10fc46[_0x129a('0x16')][_0x129a('0x11')]()){case _0x129a('0x9'):zendesk[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case _0x129a('0x17'):salesforce[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case _0x129a('0xa'):sugarcrm[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case'freshdesk':freshdesk[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case _0x129a('0x18'):zoho[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case _0x129a('0xc'):desk[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case'vtiger':vtiger[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case _0x129a('0xe'):freshsales['cs'](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074,_0x5db74a);break;case _0x129a('0x19'):servicenow['cs'](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074,_0x5db74a);break;case'dynamics365':dynamics365['cs'](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074,_0x5db74a);break;default:console[_0x129a('0x14')](_0x129a('0x1a'));}}else{_0x23dc2b=require(_0x129a('0x1b'))(_0x10fc46['data1'][_0x129a('0x11')]());_0x23dc2b[_0x129a('0x1c')](_0x129a('0x1d'),util[_0x129a('0x1e')](_0x129a('0x1f'),_0x10fc46[_0x129a('0x16')][_0x129a('0x11')](),_0x10fc46[_0x129a('0x20')]));}}else{_0x23dc2b=require(_0x129a('0x1b'))(_0x10fc46[_0x129a('0x16')][_0x129a('0x11')]());_0x23dc2b['error'](_0x129a('0x1d'),util[_0x129a('0x1e')](_0x129a('0x21'),_0x10fc46[_0x129a('0x16')][_0x129a('0x11')](),_0x10fc46['data2']));}}else{}}catch(_0x54b36d){console[_0x129a('0x1c')](_0x54b36d);}}}}; \ 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 c368007..19ee120 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 _0x8fbf=['find','execute','then','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','length','cloneDeep','additionalSearchLead','sobject','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','contact','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','create','forEach','string','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','catch','error','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','Subjects','getString','ticketType','Task','utc','IsRecurrence','endUserType','lead','account','ContactId','AccountId','isNil','User'];(function(_0x11aee5,_0x27fa94){var _0x2e8c9d=function(_0x33ff83){while(--_0x33ff83){_0x11aee5['push'](_0x11aee5['shift']());}};_0x2e8c9d(++_0x27fa94);}(_0x8fbf,0xe0));var _0xf8fb=function(_0x5884d2,_0x3bb28e){_0x5884d2=_0x5884d2-0x0;var _0x259d7b=_0x8fbf[_0x5884d2];return _0x259d7b;};'use strict';var _=require(_0xf8fb('0x0'));var rp=require(_0xf8fb('0x1'));var moment=require('moment');var BPromise=require(_0xf8fb('0x2'));var md5=require(_0xf8fb('0x3'));var jsforce=require(_0xf8fb('0x4'));var util=require(_0xf8fb('0x5'));var Redis=require('ioredis');var intUtil=require(_0xf8fb('0x6'));var config=require(_0xf8fb('0x7'));var logger=require(_0xf8fb('0x8'))(_0xf8fb('0x9'));config[_0xf8fb('0xa')]=_[_0xf8fb('0xb')](config[_0xf8fb('0xa')],{'host':_0xf8fb('0xc'),'port':0x18eb});var io=require(_0xf8fb('0xd'))(new Redis(config[_0xf8fb('0xa')]));function emit(_0x29ad86,_0x9ec3b7,_0x35e7e1){io['to'](_0x29ad86)[_0xf8fb('0xe')](_0x9ec3b7,_0x35e7e1);}function getTicket(_0x311755,_0x297f3c,_0x1aed1e,_0xe8cd77,_0x1c37bd,_0x515d28,_0x4a0e28,_0x1a69b5){var _0x2f0998=Object['assign']({},{'OwnerId':_0x297f3c['id'],'Subject':intUtil['getString'](_0xe8cd77[_0xf8fb('0xf')],_0x1c37bd,'\x20'),'Description':intUtil[_0xf8fb('0x10')](_0xe8cd77['Descriptions'],_0x1c37bd,'\x0a')},getCustomFields(_0x515d28,_0x1c37bd));if(_0x1aed1e){if(_0xe8cd77[_0xf8fb('0x11')]===_0xf8fb('0x12')){_0x2f0998['ActivityDate']=moment[_0xf8fb('0x13')]();_0x2f0998['IsReminderSet']=![];_0x2f0998[_0xf8fb('0x14')]=![];if(_0x1aed1e[_0xf8fb('0x15')]==='contact'||_0x1aed1e[_0xf8fb('0x15')]===_0xf8fb('0x16')){_0x2f0998['WhoId']=_0x1aed1e['id'];}else if(_0x1aed1e[_0xf8fb('0x15')]===_0xf8fb('0x17')){_0x2f0998['WhatId']=_0x1aed1e['id'];}}else if(_0xe8cd77['ticketType']==='Case'){if(_0x1aed1e[_0xf8fb('0x15')]==='contact'){_0x2f0998[_0xf8fb('0x18')]=_0x1aed1e['id'];}else if(_0x1aed1e[_0xf8fb('0x15')]===_0xf8fb('0x17')){_0x2f0998[_0xf8fb('0x19')]=_0x1aed1e['id'];}else if(_0x1aed1e[_0xf8fb('0x15')]===_0xf8fb('0x16')&&_0xe8cd77['leadId']){_0x2f0998[_0xe8cd77['leadId']]=_0x1aed1e['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4a0e28['sobject'](_0xe8cd77[_0xf8fb('0x11')])['create'](_0x2f0998);}function getUser(_0x30e510,_0x45139f,_0x4e64dd){if(!_[_0xf8fb('0x1a')](_0x45139f)&&intUtil['validateEmail'](_0x45139f)){var _0x35aa54={'Email':_0x45139f};var _0x189ba5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4e64dd['sobject'](_0xf8fb('0x1b'))[_0xf8fb('0x1c')](_0x35aa54,_0x189ba5)[_0xf8fb('0x1d')]()[_0xf8fb('0x1e')](function(_0x618d04){if(_0x618d04['length']){var _0x21cdc8=_[_0xf8fb('0x1c')](_0x618d04,function(_0xaf9f1){return _0xaf9f1[_0xf8fb('0x1f')]===_0x45139f;});if(_0x21cdc8){logger[_0xf8fb('0x20')](_0xf8fb('0x21'),_0x45139f);return BPromise[_0xf8fb('0x22')]({'id':_0x21cdc8['Id'],'name':_0x21cdc8[_0xf8fb('0x23')]});}}else{logger[_0xf8fb('0x20')](_0xf8fb('0x24'),_0x45139f);return _0x4e64dd[_0xf8fb('0x25')]()[_0xf8fb('0x1e')](function(_0x1a6e2f){return BPromise[_0xf8fb('0x22')]({'id':_0x1a6e2f[_0xf8fb('0x26')],'name':_0x1a6e2f['display_name']});});}});}else{logger[_0xf8fb('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x45139f);return _0x4e64dd[_0xf8fb('0x25')]()[_0xf8fb('0x1e')](function(_0x4d0281){return BPromise[_0xf8fb('0x22')]({'id':_0x4d0281[_0xf8fb('0x26')],'name':_0x4d0281['display_name']});});}}function getEndUser(_0x29cf7f,_0x4eedd9,_0x5955b3,_0x454cad,_0x57227f){var _0x15cb9f={'$or':{'Phone':_0x454cad}};var _0x4640e9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf8fb('0x22')]()[_0xf8fb('0x1e')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x454cad,_0x4eedd9[_0xf8fb('0x27')]);switch(_0x4eedd9[_0xf8fb('0x27')]){case _0xf8fb('0x28'):var _0x4f2d72=_['cloneDeep'](_0x15cb9f);if(_0x4eedd9['additionalSearchContact']){var _0x1b58f6={};_0x1b58f6[_0x4eedd9[_0xf8fb('0x29')]]=_0x454cad;_[_0xf8fb('0x2a')](_0x4f2d72[_0xf8fb('0x2b')],_0x1b58f6);}return _0x57227f['sobject'](_0xf8fb('0x2c'))['find'](_0x4f2d72,_0x4640e9)[_0xf8fb('0x1d')]()[_0xf8fb('0x1e')](function(_0xbe6184){if(_0xbe6184&&_0xbe6184[_0xf8fb('0x2d')]){return _0xbe6184;}else{var _0x469305=_[_0xf8fb('0x2e')](_0x15cb9f);if(_0x4eedd9['additionalSearchLead']){var _0x339f6a={};_0x339f6a[_0x4eedd9[_0xf8fb('0x2f')]]=_0x454cad;_[_0xf8fb('0x2a')](_0x469305['$or'],_0x339f6a);}return _0x57227f[_0xf8fb('0x30')](_0xf8fb('0x31'))[_0xf8fb('0x1c')](_0x469305,_0x4640e9);}});case _0xf8fb('0x32'):var _0x3ec4fe=_[_0xf8fb('0x2e')](_0x15cb9f);if(_0x4eedd9[_0xf8fb('0x33')]){var _0x1b58f6={};_0x1b58f6[_0x4eedd9[_0xf8fb('0x33')]]=_0x454cad;_[_0xf8fb('0x2a')](_0x3ec4fe[_0xf8fb('0x2b')],_0x1b58f6);}return _0x57227f[_0xf8fb('0x30')](_0xf8fb('0x34'))[_0xf8fb('0x1c')](_0x3ec4fe,_0x4640e9)[_0xf8fb('0x1d')]()[_0xf8fb('0x1e')](function(_0x6f9d97){if(_0x6f9d97&&_0x6f9d97[_0xf8fb('0x2d')]){return _0x6f9d97;}else{var _0x2e25be=_[_0xf8fb('0x2e')](_0x15cb9f);if(_0x4eedd9[_0xf8fb('0x29')]){var _0x18a8fa={};_0x18a8fa[_0x4eedd9[_0xf8fb('0x29')]]=_0x454cad;_['merge'](_0x2e25be[_0xf8fb('0x2b')],_0x18a8fa);}return _0x57227f[_0xf8fb('0x30')](_0xf8fb('0x2c'))['find'](_0x2e25be,_0x4640e9)['then'](function(_0x42ccbc){if(_0x42ccbc&&_0x42ccbc['length']){return _0x42ccbc;}else{var _0x1f616c=_['cloneDeep'](_0x15cb9f);if(_0x4eedd9[_0xf8fb('0x2f')]){var _0xcab66d={};_0xcab66d[_0x4eedd9[_0xf8fb('0x2f')]]=_0x454cad;_[_0xf8fb('0x2a')](_0x1f616c[_0xf8fb('0x2b')],_0xcab66d);}return _0x57227f['sobject']('Lead')['find'](_0x1f616c,_0x4640e9);}});}});case'contact':var _0x4f2d72=_[_0xf8fb('0x2e')](_0x15cb9f);if(_0x4eedd9[_0xf8fb('0x29')]){var _0x1b58f6={};_0x1b58f6[_0x4eedd9[_0xf8fb('0x29')]]=_0x454cad;_['merge'](_0x4f2d72['$or'],_0x1b58f6);}return _0x57227f['sobject'](_0xf8fb('0x2c'))[_0xf8fb('0x1c')](_0x4f2d72,_0x4640e9)[_0xf8fb('0x1d')]();case _0xf8fb('0x16'):var _0x379a34=_['cloneDeep'](_0x15cb9f);if(_0x4eedd9['additionalSearchLead']){var _0x1b58f6={};_0x1b58f6[_0x4eedd9[_0xf8fb('0x2f')]]=_0x454cad;_[_0xf8fb('0x2a')](_0x379a34[_0xf8fb('0x2b')],_0x1b58f6);}return _0x57227f['sobject'](_0xf8fb('0x31'))[_0xf8fb('0x1c')](_0x379a34,_0x4640e9);case'account':var _0x3ec4fe=_[_0xf8fb('0x2e')](_0x15cb9f);if(_0x4eedd9[_0xf8fb('0x33')]){var _0x1b58f6={};_0x1b58f6[_0x4eedd9['additionalSearchAccount']]=_0x454cad;_[_0xf8fb('0x2a')](_0x3ec4fe[_0xf8fb('0x2b')],_0x1b58f6);}return _0x57227f[_0xf8fb('0x30')]('Account')['find'](_0x3ec4fe,_0x4640e9);default:return null;}})['then'](function(_0x2eb27d){if(_0x2eb27d&&_0x2eb27d['length']){var _0x5d7dae=_[_0xf8fb('0x35')](_0x2eb27d);if(_0x5d7dae){return BPromise[_0xf8fb('0x22')]({'id':_0x5d7dae['Id'],'name':_0x5d7dae[_0xf8fb('0x23')],'phone':_0x5d7dae[_0xf8fb('0x36')],'endUserType':_0x5d7dae[_0xf8fb('0x37')][_0xf8fb('0x38')][_0xf8fb('0x39')]()});}}})[_0xf8fb('0x1e')](function(_0x4834f1){if(_0x4834f1){logger[_0xf8fb('0x20')](_0xf8fb('0x3a'),_0x4834f1[_0xf8fb('0x15')],_0x454cad);return BPromise['resolve'](_0x4834f1);}else{logger[_0xf8fb('0x20')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x454cad);var _0x247088={'Phone':_0x454cad};if(_0x4eedd9[_0xf8fb('0x3b')]){if(_0x4eedd9[_0xf8fb('0x3b')]===_0xf8fb('0x3c')){logger[_0xf8fb('0x20')](_0xf8fb('0x3d'),_0x454cad,_0x4eedd9[_0xf8fb('0x3b')]);_0x247088[_0xf8fb('0x3e')]=_0x5955b3!==_0xf8fb('0x3f')?_0x5955b3:util[_0xf8fb('0x40')](_0xf8fb('0x41'),_0x454cad);}else if(_0x4eedd9[_0xf8fb('0x3b')]===_0xf8fb('0x16')){logger['info'](_0xf8fb('0x3d'),_0x454cad,_0x4eedd9['moduleCreate']);_0x247088[_0xf8fb('0x3e')]=_0x5955b3!==''?_0x5955b3:util[_0xf8fb('0x40')](_0xf8fb('0x41'),_0x454cad);_0x247088[_0xf8fb('0x42')]=_0xf8fb('0x43');}else if(_0x4eedd9[_0xf8fb('0x3b')]===_0xf8fb('0x17')){logger[_0xf8fb('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x454cad,_0x4eedd9[_0xf8fb('0x3b')]);_0x247088[_0xf8fb('0x23')]=_0x5955b3!==''?_0x5955b3:util[_0xf8fb('0x40')]('Caller\x20-\x20%s',_0x454cad);}else{return null;}}return _0x57227f[_0xf8fb('0x30')](_[_0xf8fb('0x44')](_0x4eedd9[_0xf8fb('0x3b')]))[_0xf8fb('0x45')](_0x247088)[_0xf8fb('0x1e')](function(_0xe2c37e){return BPromise[_0xf8fb('0x22')]({'id':_0xe2c37e['id'],'endUserType':_0x4eedd9[_0xf8fb('0x3b')]});});}});}function getCustomFields(_0xaa539a,_0x4159aa){var _0x525d25={};if(_0xaa539a['length']>0x0){_[_0xf8fb('0x46')](_0xaa539a,function(_0x4e83bc){if(_['includes']([_0xf8fb('0x47'),'picklist'],_0x4e83bc[_0xf8fb('0x38')])&&_0x4e83bc[_0xf8fb('0x48')]){_0x525d25[_0x4e83bc[_0xf8fb('0x48')]]=_0x4e83bc[_0xf8fb('0x49')][_0xf8fb('0x4a')]();}else if(_0x4e83bc['type']===_0xf8fb('0x4b')&&_0x4e83bc[_0xf8fb('0x4c')]&&_0x4e83bc[_0xf8fb('0x48')]){_0x4159aa[_0x4e83bc[_0xf8fb('0x4c')]]&&(_0x525d25[_0x4e83bc[_0xf8fb('0x48')]]=_0x4159aa[_0x4e83bc[_0xf8fb('0x4c')]]['toString']());}else if(_0x4e83bc[_0xf8fb('0x38')]===_0xf8fb('0x4d')&&_0x4e83bc[_0xf8fb('0x4e')]&&_0x4e83bc[_0xf8fb('0x4e')][_0xf8fb('0x4f')]&&_0x4e83bc['idField']){_0x4159aa[_0x4e83bc[_0xf8fb('0x4e')][_0xf8fb('0x4f')][_0xf8fb('0x39')]()]&&(_0x525d25[_0x4e83bc['idField']]=_0x4159aa[_0x4e83bc[_0xf8fb('0x4e')]['name']['toLowerCase']()][_0xf8fb('0x4a')]());}});}return _0x525d25;}function getConnection(_0x20e957){var _0x11675b=_0x20e957['password'][_0xf8fb('0x50')](_0x20e957[_0xf8fb('0x51')]);var _0x3e4185=new jsforce[(_0xf8fb('0x52'))]({'oauth2':{'loginUrl':_0x20e957[_0xf8fb('0x53')]||_0xf8fb('0x54'),'clientId':_0x20e957[_0xf8fb('0x55')],'clientSecret':_0x20e957[_0xf8fb('0x56')]}});return _0x3e4185[_0xf8fb('0x57')](_0x20e957[_0xf8fb('0x58')],_0x11675b)[_0xf8fb('0x1e')](function(){logger['info'](_0xf8fb('0x59'));return _0x3e4185;});}exports[_0xf8fb('0x5a')]=function(_0x3d3755,_0x436a45,_0x1efd3b,_0x2e2d55,_0x50ebcb,_0x573710){var _0x29b2ad,_0x540826,_0x43a287,_0x221989;_0x573710[_0xf8fb('0x5b')]=intUtil[_0xf8fb('0x5c')](_0x573710[_0xf8fb('0x5b')]);_0x573710[_0xf8fb('0x53')]=intUtil[_0xf8fb('0x5c')](_0x573710['remoteUri']);if(_0x50ebcb&&_0x50ebcb['monitor_format']){logger[_0xf8fb('0x20')](_0xf8fb('0x5d'),_0xf8fb('0x5e'));_0x436a45[_0xf8fb('0x5f')]=util['format'](_0xf8fb('0x60'),_0x573710[_0xf8fb('0x5b')],_0x436a45['uniqueid'],md5(_0x436a45['uniqueid']));}else{_0x436a45[_0xf8fb('0x5f')]='';}return getConnection(_0x573710)[_0xf8fb('0x1e')](function(_0x3b15ea){_0x221989=_0x3b15ea;return getUser(_0x573710,_0x2e2d55['email'],_0x221989);})[_0xf8fb('0x1e')](function(_0x9181d4){_0x29b2ad=_0x9181d4;return getEndUser(_0x573710,_0x1efd3b,_0x436a45[_0xf8fb('0x61')],_0x436a45[_0xf8fb('0x62')],_0x221989);})[_0xf8fb('0x1e')](function(_0x4fa4d4){_0x540826=_0x4fa4d4;return getTicket(_0x573710,_0x29b2ad,_0x540826,_0x1efd3b,_0x436a45,_0x1efd3b[_0xf8fb('0x63')],_0x221989,_0xf8fb('0x5a'));})[_0xf8fb('0x1e')](function(_0x219162){_0x43a287=_0x219162;logger[_0xf8fb('0x20')](_0xf8fb('0x64'),_0x43a287['id']);logger[_0xf8fb('0x20')](_0xf8fb('0x65'),_0x43a287['id'],_0x2e2d55[_0xf8fb('0x4f')],_0x573710['type']);switch(_0x573710['type']){case _0xf8fb('0x66'):emit(util[_0xf8fb('0x40')](_0xf8fb('0x67'),_0x2e2d55['name']),_0xf8fb('0x68'),{'recordId':_0x43a287['id']});break;case _0xf8fb('0x69'):emit(util[_0xf8fb('0x40')](_0xf8fb('0x67'),_0x2e2d55[_0xf8fb('0x4f')]),_0xf8fb('0x6a'),{'uri':util[_0xf8fb('0x40')](_0xf8fb('0x6b'),_0x221989[_0xf8fb('0x6c')],_0x43a287['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xf8fb('0x6d')](function(_0x111177){logger[_0xf8fb('0x6e')]('[QUEUE]',_0x111177);});};exports[_0xf8fb('0x6f')]=function(_0x2fae8c,_0x465acf,_0x17d03a,_0x2bccdb,_0x39b808,_0x3e7cd1,_0x576456){var _0x270859,_0x37d394,_0x35d75d,_0x2ac7ff;_0x3e7cd1[_0xf8fb('0x5b')]=intUtil[_0xf8fb('0x5c')](_0x3e7cd1[_0xf8fb('0x5b')]);_0x3e7cd1[_0xf8fb('0x53')]=intUtil['stripTrailingSlash'](_0x3e7cd1['remoteUri']);if(_0x576456&&_0x576456[_0xf8fb('0x70')]&&_0x576456[_0xf8fb('0x70')]!==_0xf8fb('0x71')){logger[_0xf8fb('0x20')](_0xf8fb('0x72'),'Recording\x20is\x20enabled!');_0x465acf[_0xf8fb('0x5f')]=util[_0xf8fb('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e7cd1[_0xf8fb('0x5b')],_0x465acf['uniqueid'],md5(_0x465acf[_0xf8fb('0x73')]));}return getConnection(_0x3e7cd1)[_0xf8fb('0x1e')](function(_0x399439){_0x2ac7ff=_0x399439;return getUser(_0x3e7cd1,_0x2bccdb[_0xf8fb('0x74')],_0x2ac7ff);})['then'](function(_0x310b07){_0x270859=_0x310b07;return getEndUser(_0x3e7cd1,_0x17d03a,_0x465acf[_0xf8fb('0x75')],_0x465acf[_0xf8fb('0x76')],_0x2ac7ff);})[_0xf8fb('0x1e')](function(_0xb15477){_0x37d394=_0xb15477;return getTicket(_0x3e7cd1,_0x270859,_0x37d394,_0x17d03a,_0x465acf,_0x17d03a[_0xf8fb('0x63')],_0x2ac7ff,_0xf8fb('0x6f'));})[_0xf8fb('0x1e')](function(_0x5c9e65){_0x35d75d=_0x5c9e65;logger[_0xf8fb('0x20')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x35d75d['id']);logger[_0xf8fb('0x20')](_0xf8fb('0x77'),_0x35d75d['id'],_0x2bccdb[_0xf8fb('0x4f')],_0x3e7cd1['type']);switch(_0x3e7cd1[_0xf8fb('0x38')]){case _0xf8fb('0x66'):emit(util[_0xf8fb('0x40')](_0xf8fb('0x67'),_0x2bccdb[_0xf8fb('0x4f')]),_0xf8fb('0x68'),{'recordId':_0x35d75d['id']});break;case'newTab':emit(util[_0xf8fb('0x40')](_0xf8fb('0x67'),_0x2bccdb['name']),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x2ac7ff[_0xf8fb('0x6c')],_0x35d75d['id'])});break;default:logger[_0xf8fb('0x6e')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xf8fb('0x6d')](function(_0x179f16){logger['error'](_0xf8fb('0x72'),_0x179f16);});};exports[_0xf8fb('0x78')]=function(_0x40a29b,_0x21d15a,_0x4eaa7f,_0x36fd75,_0x4fc705,_0x15eed4){var _0xf90580,_0x4d2ec0,_0x2b8c95,_0x2d00ae;_0x15eed4[_0xf8fb('0x5b')]=intUtil[_0xf8fb('0x5c')](_0x15eed4[_0xf8fb('0x5b')]);_0x15eed4[_0xf8fb('0x53')]=intUtil['stripTrailingSlash'](_0x15eed4[_0xf8fb('0x53')]);if(_0x4fc705&&_0x4fc705[_0xf8fb('0x79')]){logger['info']('['+_0x21d15a[_0xf8fb('0x7a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x21d15a[_0xf8fb('0x5f')]=util[_0xf8fb('0x40')](_0xf8fb('0x60'),_0x15eed4['serverUrl'],_0x21d15a[_0xf8fb('0x73')],md5(_0x21d15a[_0xf8fb('0x73')]));}else{_0x21d15a[_0xf8fb('0x5f')]='';}return getConnection(_0x15eed4)[_0xf8fb('0x1e')](function(_0x428265){_0x2d00ae=_0x428265;if(!_[_0xf8fb('0x1a')](_0x36fd75)){return getUser(_0x15eed4,_0x36fd75[_0xf8fb('0x4f')],_0x2d00ae);}else{return getUser(_0x15eed4,null,_0x2d00ae);}})[_0xf8fb('0x1e')](function(_0x153b32){_0xf90580=_0x153b32;return getEndUser(_0x15eed4,_0x4eaa7f,_0x21d15a['calleridname'],_0x21d15a[_0xf8fb('0x62')],_0x2d00ae);})[_0xf8fb('0x1e')](function(_0x190c08){_0x4d2ec0=_0x190c08;return getTicket(_0x15eed4,_0xf90580,_0x4d2ec0,_0x4eaa7f,_0x21d15a,_0x4eaa7f[_0xf8fb('0x63')],_0x2d00ae);})[_0xf8fb('0x1e')](function(_0x1ccfe4){_0x2b8c95=_0x1ccfe4;logger['info']('['+_0x21d15a[_0xf8fb('0x7a')][_0xf8fb('0x7b')]()+_0xf8fb('0x7c'),_0x2b8c95['id']);logger[_0xf8fb('0x20')]('['+_0x21d15a['lastevent'][_0xf8fb('0x7b')]()+_0xf8fb('0x7d'),_0x15eed4[_0xf8fb('0x38')]);})[_0xf8fb('0x6d')](function(_0x570646){logger[_0xf8fb('0x6e')]('['+_0x21d15a[_0xf8fb('0x7a')][_0xf8fb('0x7b')]()+']',_0x570646);});}; \ No newline at end of file +var _0x6d7a=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','email','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','calleridname','calleridnum',']\x20Integration\x20account\x20type\x20%s.','lastevent','lodash','moment','bluebird','md5','util','ioredis','./util','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','account','WhatId','contact','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','identity','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','first','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','password','concat','Connection','remoteUri','clientId','clientSecret','login','username','queue','stripTrailingSlash','serverUrl'];(function(_0x5a873c,_0x2a9b6c){var _0x30fa1b=function(_0x203225){while(--_0x203225){_0x5a873c['push'](_0x5a873c['shift']());}};_0x30fa1b(++_0x2a9b6c);}(_0x6d7a,0x121));var _0xa6d7=function(_0x4b6968,_0x4c535d){_0x4b6968=_0x4b6968-0x0;var _0x89879c=_0x6d7a[_0x4b6968];return _0x89879c;};'use strict';var _=require(_0xa6d7('0x0'));var rp=require('request-promise');var moment=require(_0xa6d7('0x1'));var BPromise=require(_0xa6d7('0x2'));var md5=require(_0xa6d7('0x3'));var jsforce=require('jsforce');var util=require(_0xa6d7('0x4'));var Redis=require(_0xa6d7('0x5'));var intUtil=require(_0xa6d7('0x6'));var config=require('../../../../config/environment');var logger=require(_0xa6d7('0x7'))(_0xa6d7('0x8'));config['redis']=_[_0xa6d7('0x9')](config[_0xa6d7('0xa')],{'host':_0xa6d7('0xb'),'port':0x18eb});var io=require(_0xa6d7('0xc'))(new Redis(config[_0xa6d7('0xa')]));function emit(_0x3e3284,_0x59c830,_0x3635ec){io['to'](_0x3e3284)[_0xa6d7('0xd')](_0x59c830,_0x3635ec);}function getTicket(_0x549f2b,_0x155dd9,_0x4675af,_0x4a05ee,_0x46c825,_0x16221f,_0x2394e0,_0x519b44){var _0x266e4c=Object[_0xa6d7('0xe')]({},{'OwnerId':_0x155dd9['id'],'Subject':intUtil[_0xa6d7('0xf')](_0x4a05ee[_0xa6d7('0x10')],_0x46c825,'\x20'),'Description':intUtil[_0xa6d7('0xf')](_0x4a05ee[_0xa6d7('0x11')],_0x46c825,'\x0a')},getCustomFields(_0x16221f,_0x46c825));if(_0x4675af){if(_0x4a05ee[_0xa6d7('0x12')]==='Task'){_0x266e4c['ActivityDate']=moment[_0xa6d7('0x13')]();_0x266e4c[_0xa6d7('0x14')]=![];_0x266e4c[_0xa6d7('0x15')]=![];if(_0x4675af[_0xa6d7('0x16')]==='contact'||_0x4675af['endUserType']==='lead'){_0x266e4c[_0xa6d7('0x17')]=_0x4675af['id'];}else if(_0x4675af[_0xa6d7('0x16')]===_0xa6d7('0x18')){_0x266e4c[_0xa6d7('0x19')]=_0x4675af['id'];}}else if(_0x4a05ee[_0xa6d7('0x12')]==='Case'){if(_0x4675af[_0xa6d7('0x16')]===_0xa6d7('0x1a')){_0x266e4c[_0xa6d7('0x1b')]=_0x4675af['id'];}else if(_0x4675af['endUserType']===_0xa6d7('0x18')){_0x266e4c[_0xa6d7('0x1c')]=_0x4675af['id'];}else if(_0x4675af['endUserType']===_0xa6d7('0x1d')&&_0x4a05ee[_0xa6d7('0x1e')]){_0x266e4c[_0x4a05ee[_0xa6d7('0x1e')]]=_0x4675af['id'];}else{logger[_0xa6d7('0x1f')](_0xa6d7('0x20'));}}}return _0x2394e0['sobject'](_0x4a05ee[_0xa6d7('0x12')])[_0xa6d7('0x21')](_0x266e4c);}function getUser(_0x56b1e3,_0x34c3e1,_0x3b953d){if(!_[_0xa6d7('0x22')](_0x34c3e1)&&intUtil[_0xa6d7('0x23')](_0x34c3e1)){var _0x205064={'Email':_0x34c3e1};var _0x343216={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3b953d[_0xa6d7('0x24')](_0xa6d7('0x25'))[_0xa6d7('0x26')](_0x205064,_0x343216)[_0xa6d7('0x27')]()[_0xa6d7('0x28')](function(_0x902686){if(_0x902686[_0xa6d7('0x29')]){var _0xe1c989=_[_0xa6d7('0x26')](_0x902686,function(_0x163adf){return _0x163adf[_0xa6d7('0x2a')]===_0x34c3e1;});if(_0xe1c989){logger[_0xa6d7('0x1f')](_0xa6d7('0x2b'),_0x34c3e1);return BPromise[_0xa6d7('0x2c')]({'id':_0xe1c989['Id'],'name':_0xe1c989[_0xa6d7('0x2d')]});}}else{logger[_0xa6d7('0x1f')](_0xa6d7('0x2e'),_0x34c3e1);return _0x3b953d['identity']()[_0xa6d7('0x28')](function(_0x145e9d){return BPromise[_0xa6d7('0x2c')]({'id':_0x145e9d[_0xa6d7('0x2f')],'name':_0x145e9d['display_name']});});}});}else{logger[_0xa6d7('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x34c3e1);return _0x3b953d[_0xa6d7('0x30')]()['then'](function(_0x1852c8){return BPromise[_0xa6d7('0x2c')]({'id':_0x1852c8[_0xa6d7('0x2f')],'name':_0x1852c8[_0xa6d7('0x31')]});});}}function getEndUser(_0x274541,_0x236ec4,_0xcdf15e,_0x5e99aa,_0x2554f7){var _0x1f580e={'$or':{'Phone':_0x5e99aa}};var _0x5eeeef={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xa6d7('0x28')](function(){logger[_0xa6d7('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5e99aa,_0x236ec4[_0xa6d7('0x32')]);switch(_0x236ec4[_0xa6d7('0x32')]){case _0xa6d7('0x33'):var _0x87e17=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4[_0xa6d7('0x35')]){var _0x23f525={};_0x23f525[_0x236ec4['additionalSearchContact']]=_0x5e99aa;_[_0xa6d7('0x36')](_0x87e17[_0xa6d7('0x37')],_0x23f525);}return _0x2554f7[_0xa6d7('0x24')](_0xa6d7('0x38'))[_0xa6d7('0x26')](_0x87e17,_0x5eeeef)[_0xa6d7('0x27')]()[_0xa6d7('0x28')](function(_0x3077f7){if(_0x3077f7&&_0x3077f7[_0xa6d7('0x29')]){return _0x3077f7;}else{var _0x361f3c=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4['additionalSearchLead']){var _0x4d3772={};_0x4d3772[_0x236ec4[_0xa6d7('0x39')]]=_0x5e99aa;_[_0xa6d7('0x36')](_0x361f3c[_0xa6d7('0x37')],_0x4d3772);}return _0x2554f7[_0xa6d7('0x24')]('Lead')[_0xa6d7('0x26')](_0x361f3c,_0x5eeeef);}});case _0xa6d7('0x3a'):var _0x48f186=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4[_0xa6d7('0x3b')]){var _0x23f525={};_0x23f525[_0x236ec4[_0xa6d7('0x3b')]]=_0x5e99aa;_[_0xa6d7('0x36')](_0x48f186['$or'],_0x23f525);}return _0x2554f7['sobject'](_0xa6d7('0x3c'))[_0xa6d7('0x26')](_0x48f186,_0x5eeeef)['execute']()['then'](function(_0x292b55){if(_0x292b55&&_0x292b55['length']){return _0x292b55;}else{var _0xac8d55=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4[_0xa6d7('0x35')]){var _0x4f0ee6={};_0x4f0ee6[_0x236ec4[_0xa6d7('0x35')]]=_0x5e99aa;_[_0xa6d7('0x36')](_0xac8d55[_0xa6d7('0x37')],_0x4f0ee6);}return _0x2554f7[_0xa6d7('0x24')](_0xa6d7('0x38'))[_0xa6d7('0x26')](_0xac8d55,_0x5eeeef)[_0xa6d7('0x28')](function(_0x35a43f){if(_0x35a43f&&_0x35a43f[_0xa6d7('0x29')]){return _0x35a43f;}else{var _0x1fe7ca=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4[_0xa6d7('0x39')]){var _0x27a699={};_0x27a699[_0x236ec4[_0xa6d7('0x39')]]=_0x5e99aa;_[_0xa6d7('0x36')](_0x1fe7ca[_0xa6d7('0x37')],_0x27a699);}return _0x2554f7['sobject'](_0xa6d7('0x3d'))['find'](_0x1fe7ca,_0x5eeeef);}});}});case _0xa6d7('0x1a'):var _0x87e17=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4['additionalSearchContact']){var _0x23f525={};_0x23f525[_0x236ec4[_0xa6d7('0x35')]]=_0x5e99aa;_['merge'](_0x87e17['$or'],_0x23f525);}return _0x2554f7[_0xa6d7('0x24')]('Contact')[_0xa6d7('0x26')](_0x87e17,_0x5eeeef)[_0xa6d7('0x27')]();case _0xa6d7('0x1d'):var _0x30bf00=_['cloneDeep'](_0x1f580e);if(_0x236ec4['additionalSearchLead']){var _0x23f525={};_0x23f525[_0x236ec4[_0xa6d7('0x39')]]=_0x5e99aa;_[_0xa6d7('0x36')](_0x30bf00['$or'],_0x23f525);}return _0x2554f7[_0xa6d7('0x24')](_0xa6d7('0x3d'))[_0xa6d7('0x26')](_0x30bf00,_0x5eeeef);case _0xa6d7('0x18'):var _0x48f186=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4[_0xa6d7('0x3b')]){var _0x23f525={};_0x23f525[_0x236ec4[_0xa6d7('0x3b')]]=_0x5e99aa;_['merge'](_0x48f186[_0xa6d7('0x37')],_0x23f525);}return _0x2554f7[_0xa6d7('0x24')](_0xa6d7('0x3c'))[_0xa6d7('0x26')](_0x48f186,_0x5eeeef);default:return null;}})[_0xa6d7('0x28')](function(_0x417170){if(_0x417170&&_0x417170[_0xa6d7('0x29')]){var _0x250199=_[_0xa6d7('0x3e')](_0x417170);if(_0x250199){return BPromise[_0xa6d7('0x2c')]({'id':_0x250199['Id'],'name':_0x250199[_0xa6d7('0x2d')],'phone':_0x250199['Phone'],'endUserType':_0x250199[_0xa6d7('0x3f')][_0xa6d7('0x40')][_0xa6d7('0x41')]()});}}})[_0xa6d7('0x28')](function(_0x1c8ce5){if(_0x1c8ce5){logger[_0xa6d7('0x1f')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x1c8ce5[_0xa6d7('0x16')],_0x5e99aa);return BPromise[_0xa6d7('0x2c')](_0x1c8ce5);}else{logger['info'](_0xa6d7('0x42'),_0x5e99aa);var _0xeecee0={'Phone':_0x5e99aa};if(_0x236ec4[_0xa6d7('0x43')]){if(_0x236ec4['moduleCreate']==='contact'){logger[_0xa6d7('0x1f')](_0xa6d7('0x44'),_0x5e99aa,_0x236ec4[_0xa6d7('0x43')]);_0xeecee0[_0xa6d7('0x45')]=_0xcdf15e!==''?_0xcdf15e:util[_0xa6d7('0x46')](_0xa6d7('0x47'),_0x5e99aa);}else if(_0x236ec4['moduleCreate']===_0xa6d7('0x1d')){logger['info'](_0xa6d7('0x44'),_0x5e99aa,_0x236ec4['moduleCreate']);_0xeecee0[_0xa6d7('0x45')]=_0xcdf15e!==_0xa6d7('0x48')?_0xcdf15e:util[_0xa6d7('0x46')](_0xa6d7('0x47'),_0x5e99aa);_0xeecee0[_0xa6d7('0x49')]=_0xa6d7('0x4a');}else if(_0x236ec4[_0xa6d7('0x43')]===_0xa6d7('0x18')){logger['info'](_0xa6d7('0x44'),_0x5e99aa,_0x236ec4[_0xa6d7('0x43')]);_0xeecee0[_0xa6d7('0x2d')]=_0xcdf15e!==_0xa6d7('0x48')?_0xcdf15e:util[_0xa6d7('0x46')](_0xa6d7('0x47'),_0x5e99aa);}else{return null;}}return _0x2554f7[_0xa6d7('0x24')](_[_0xa6d7('0x4b')](_0x236ec4[_0xa6d7('0x43')]))[_0xa6d7('0x21')](_0xeecee0)[_0xa6d7('0x28')](function(_0x4403b8){return BPromise['resolve']({'id':_0x4403b8['id'],'endUserType':_0x236ec4['moduleCreate']});});}});}function getCustomFields(_0x3138c8,_0x484d9a){var _0x336e52={};if(_0x3138c8[_0xa6d7('0x29')]>0x0){_[_0xa6d7('0x4c')](_0x3138c8,function(_0x4bf08b){if(_[_0xa6d7('0x4d')]([_0xa6d7('0x4e'),_0xa6d7('0x4f')],_0x4bf08b[_0xa6d7('0x40')])&&_0x4bf08b['idField']){_0x336e52[_0x4bf08b[_0xa6d7('0x50')]]=_0x4bf08b[_0xa6d7('0x51')][_0xa6d7('0x52')]();}else if(_0x4bf08b['type']===_0xa6d7('0x53')&&_0x4bf08b[_0xa6d7('0x54')]&&_0x4bf08b[_0xa6d7('0x50')]){_0x484d9a[_0x4bf08b[_0xa6d7('0x54')]]&&(_0x336e52[_0x4bf08b[_0xa6d7('0x50')]]=_0x484d9a[_0x4bf08b[_0xa6d7('0x54')]][_0xa6d7('0x52')]());}else if(_0x4bf08b[_0xa6d7('0x40')]==='customVariable'&&_0x4bf08b[_0xa6d7('0x55')]&&_0x4bf08b[_0xa6d7('0x55')][_0xa6d7('0x56')]&&_0x4bf08b['idField']){_0x484d9a[_0x4bf08b[_0xa6d7('0x55')][_0xa6d7('0x56')][_0xa6d7('0x41')]()]&&(_0x336e52[_0x4bf08b[_0xa6d7('0x50')]]=_0x484d9a[_0x4bf08b['Variable'][_0xa6d7('0x56')]['toLowerCase']()][_0xa6d7('0x52')]());}});}return _0x336e52;}function getConnection(_0x448db9){var _0x26e321=_0x448db9[_0xa6d7('0x57')][_0xa6d7('0x58')](_0x448db9['securityToken']);var _0x1abb75=new jsforce[(_0xa6d7('0x59'))]({'oauth2':{'loginUrl':_0x448db9[_0xa6d7('0x5a')]||'https://login.salesforce.com','clientId':_0x448db9[_0xa6d7('0x5b')],'clientSecret':_0x448db9[_0xa6d7('0x5c')]}});return _0x1abb75[_0xa6d7('0x5d')](_0x448db9[_0xa6d7('0x5e')],_0x26e321)['then'](function(){logger[_0xa6d7('0x1f')]('Connection\x20established.');return _0x1abb75;});}exports[_0xa6d7('0x5f')]=function(_0x864b95,_0x46c38f,_0x2a541d,_0x51684a,_0x59d6aa,_0x3fb383){var _0x31bb87,_0x4b91f,_0x407b84,_0xbdbcaf;_0x3fb383['serverUrl']=intUtil[_0xa6d7('0x60')](_0x3fb383[_0xa6d7('0x61')]);_0x3fb383[_0xa6d7('0x5a')]=intUtil[_0xa6d7('0x60')](_0x3fb383[_0xa6d7('0x5a')]);if(_0x59d6aa&&_0x59d6aa['monitor_format']){logger[_0xa6d7('0x1f')](_0xa6d7('0x62'),_0xa6d7('0x63'));_0x46c38f[_0xa6d7('0x64')]=util[_0xa6d7('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3fb383[_0xa6d7('0x61')],_0x46c38f['uniqueid'],md5(_0x46c38f['uniqueid']));}else{_0x46c38f[_0xa6d7('0x64')]='';}return getConnection(_0x3fb383)[_0xa6d7('0x28')](function(_0x35831e){_0xbdbcaf=_0x35831e;return getUser(_0x3fb383,_0x51684a[_0xa6d7('0x65')],_0xbdbcaf);})['then'](function(_0x49c948){_0x31bb87=_0x49c948;return getEndUser(_0x3fb383,_0x2a541d,_0x46c38f['calleridname'],_0x46c38f['calleridnum'],_0xbdbcaf);})[_0xa6d7('0x28')](function(_0x5588e8){_0x4b91f=_0x5588e8;return getTicket(_0x3fb383,_0x31bb87,_0x4b91f,_0x2a541d,_0x46c38f,_0x2a541d[_0xa6d7('0x66')],_0xbdbcaf,'queue');})[_0xa6d7('0x28')](function(_0x4a5fc3){_0x407b84=_0x4a5fc3;logger[_0xa6d7('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x407b84['id']);logger[_0xa6d7('0x1f')](_0xa6d7('0x67'),_0x407b84['id'],_0x51684a['name'],_0x3fb383[_0xa6d7('0x40')]);switch(_0x3fb383['type']){case _0xa6d7('0x68'):emit(util['format'](_0xa6d7('0x69'),_0x51684a[_0xa6d7('0x56')]),_0xa6d7('0x6a'),{'recordId':_0x407b84['id']});break;case _0xa6d7('0x6b'):emit(util[_0xa6d7('0x46')](_0xa6d7('0x69'),_0x51684a['name']),_0xa6d7('0x6c'),{'uri':util[_0xa6d7('0x46')]('%s/%s/e',_0xbdbcaf[_0xa6d7('0x6d')],_0x407b84['id'])});break;default:logger[_0xa6d7('0x6e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xa6d7('0x6f')](function(_0x34bf6c){logger['error'](_0xa6d7('0x62'),_0x34bf6c);});};exports[_0xa6d7('0x70')]=function(_0x131265,_0x42536f,_0x486760,_0x4daa97,_0x16cab5,_0xba585f,_0x3c5f6e){var _0x401c65,_0x48aecc,_0x335cb8,_0x248bca;_0xba585f[_0xa6d7('0x61')]=intUtil['stripTrailingSlash'](_0xba585f[_0xa6d7('0x61')]);_0xba585f[_0xa6d7('0x5a')]=intUtil[_0xa6d7('0x60')](_0xba585f[_0xa6d7('0x5a')]);if(_0x3c5f6e&&_0x3c5f6e[_0xa6d7('0x71')]&&_0x3c5f6e[_0xa6d7('0x71')]!=='none'){logger[_0xa6d7('0x1f')](_0xa6d7('0x72'),'Recording\x20is\x20enabled!');_0x42536f['recordingURL']=util[_0xa6d7('0x46')](_0xa6d7('0x73'),_0xba585f['serverUrl'],_0x42536f[_0xa6d7('0x74')],md5(_0x42536f[_0xa6d7('0x74')]));}return getConnection(_0xba585f)[_0xa6d7('0x28')](function(_0x365191){_0x248bca=_0x365191;return getUser(_0xba585f,_0x4daa97[_0xa6d7('0x65')],_0x248bca);})[_0xa6d7('0x28')](function(_0x5f7b66){_0x401c65=_0x5f7b66;return getEndUser(_0xba585f,_0x486760,_0x42536f['destcalleridname'],_0x42536f[_0xa6d7('0x75')],_0x248bca);})[_0xa6d7('0x28')](function(_0x1ff01c){_0x48aecc=_0x1ff01c;return getTicket(_0xba585f,_0x401c65,_0x48aecc,_0x486760,_0x42536f,_0x486760['Fields'],_0x248bca,'outbound');})[_0xa6d7('0x28')](function(_0xdd8c16){_0x335cb8=_0xdd8c16;logger[_0xa6d7('0x1f')](_0xa6d7('0x76'),_0x335cb8['id']);logger['info'](_0xa6d7('0x77'),_0x335cb8['id'],_0x4daa97[_0xa6d7('0x56')],_0xba585f['type']);switch(_0xba585f[_0xa6d7('0x40')]){case'integrationTab':emit(util[_0xa6d7('0x46')]('user:%s',_0x4daa97[_0xa6d7('0x56')]),_0xa6d7('0x6a'),{'recordId':_0x335cb8['id']});break;case _0xa6d7('0x6b'):emit(util[_0xa6d7('0x46')](_0xa6d7('0x69'),_0x4daa97['name']),_0xa6d7('0x6c'),{'uri':util['format'](_0xa6d7('0x78'),_0x248bca[_0xa6d7('0x6d')],_0x335cb8['id'])});break;default:logger[_0xa6d7('0x6e')]('[OUTBOUND]',_0xa6d7('0x79'));}})[_0xa6d7('0x6f')](function(_0x1178e3){logger[_0xa6d7('0x6e')](_0xa6d7('0x72'),_0x1178e3);});};exports[_0xa6d7('0x7a')]=function(_0x2dea1c,_0x281837,_0x326c8e,_0x569a45,_0x3e8189,_0x4f0cd0){var _0x316de8,_0x53821d,_0x1b88e3,_0x4dee62;_0x4f0cd0['serverUrl']=intUtil[_0xa6d7('0x60')](_0x4f0cd0[_0xa6d7('0x61')]);_0x4f0cd0[_0xa6d7('0x5a')]=intUtil[_0xa6d7('0x60')](_0x4f0cd0[_0xa6d7('0x5a')]);if(_0x3e8189&&_0x3e8189[_0xa6d7('0x7b')]){logger['info']('['+_0x281837['lastevent'][_0xa6d7('0x7c')]()+']',_0xa6d7('0x63'));_0x281837['recordingURL']=util[_0xa6d7('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4f0cd0['serverUrl'],_0x281837[_0xa6d7('0x74')],md5(_0x281837['uniqueid']));}else{_0x281837[_0xa6d7('0x64')]='';}return getConnection(_0x4f0cd0)[_0xa6d7('0x28')](function(_0x3da232){_0x4dee62=_0x3da232;if(!_[_0xa6d7('0x22')](_0x569a45)){return getUser(_0x4f0cd0,_0x569a45[_0xa6d7('0x56')],_0x4dee62);}else{return getUser(_0x4f0cd0,null,_0x4dee62);}})[_0xa6d7('0x28')](function(_0x838949){_0x316de8=_0x838949;return getEndUser(_0x4f0cd0,_0x326c8e,_0x281837[_0xa6d7('0x7d')],_0x281837[_0xa6d7('0x7e')],_0x4dee62);})[_0xa6d7('0x28')](function(_0x403287){_0x53821d=_0x403287;return getTicket(_0x4f0cd0,_0x316de8,_0x53821d,_0x326c8e,_0x281837,_0x326c8e[_0xa6d7('0x66')],_0x4dee62);})[_0xa6d7('0x28')](function(_0x201522){_0x1b88e3=_0x201522;logger['info']('['+_0x281837['lastevent']['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x1b88e3['id']);logger[_0xa6d7('0x1f')]('['+_0x281837['lastevent'][_0xa6d7('0x7c')]()+_0xa6d7('0x7f'),_0x4f0cd0[_0xa6d7('0x40')]);})['catch'](function(_0x27d433){logger[_0xa6d7('0x6e')]('['+_0x281837[_0xa6d7('0x80')][_0xa6d7('0x7c')]()+']',_0x27d433);});}; \ 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 aa9e826..b34adef 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 _0xaad4=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','bluebird','request-promise','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','catch','message',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','includes','string','picklist','nameField','customField','content','type','idField','toString','variable','variableName','toLowerCase','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','callDirection','unmanaged','queue'];(function(_0x36e5ab,_0x12c541){var _0x1ce71d=function(_0x214dce){while(--_0x214dce){_0x36e5ab['push'](_0x36e5ab['shift']());}};_0x1ce71d(++_0x12c541);}(_0xaad4,0x7a));var _0x4aad=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xaad4[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var Promise=require(_0x4aad('0x0'));var rp=require(_0x4aad('0x1'));var util=require('util');var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x4aad('0x2'));var config=require(_0x4aad('0x3'));var logger=require(_0x4aad('0x4'))(_0x4aad('0x5'));config[_0x4aad('0x6')]=_['defaults'](config['redis'],{'host':_0x4aad('0x7'),'port':0x18eb});var io=require(_0x4aad('0x8'))(new Redis(config[_0x4aad('0x6')]));function getAdminUser(_0x4b1a30,_0x1c0a51,_0x4300fa,_0x53e721,_0x56a0ad,_0x3230eb){return new Promise(function(_0x56587d,_0x4198c9){var _0x2884bd={'method':_0x4aad('0x9'),'uri':_0x53e721+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x56a0ad+'&'+_0x3230eb,'auth':_0x1c0a51,'json':!![]};return rp(_0x2884bd)[_0x4aad('0xa')](function(_0x2db084){if(_0x2db084[_0x4aad('0xb')][_0x4aad('0xc')]>0x0){_0x4300fa[_0x4aad('0xd')]=_0x2db084[_0x4aad('0xb')][0x0][_0x4aad('0xe')];}logger[_0x4aad('0xf')]('['+[_0x4b1a30[_0x4aad('0x10')]()]+_0x4aad('0x11'),_0x4300fa);_0x56587d(_0x4300fa);})['catch'](function(_0x201437){logger[_0x4aad('0x12')]('['+[_0x4b1a30[_0x4aad('0x10')]()]+']',_0x201437['message']);_0x4198c9(_0x201437['message']);});});}function getUser(_0x24e16b,_0x3c7a66,_0x4082f3,_0x2d5eda,_0x4a687c){return function(_0x52ebd5){logger[_0x4aad('0xf')]('['+[_0x24e16b[_0x4aad('0x10')]()]+_0x4aad('0x13'),_0x52ebd5);return new Promise(function(_0x1e477a,_0x2f6ae1){if(intUtil[_0x4aad('0x14')](_0x52ebd5[_0x4aad('0x15')])){var _0x39f392={'method':_0x4aad('0x9'),'uri':_0x4082f3+_0x4aad('0x16')+_0x52ebd5[_0x4aad('0x15')]+'&'+_0x2d5eda+'&'+_0x4a687c,'auth':_0x3c7a66,'json':!![]};logger[_0x4aad('0xf')]('['+[_0x24e16b[_0x4aad('0x10')]()]+_0x4aad('0x17'),_0x39f392);return rp(_0x39f392)['then'](function(_0xfd91e7){logger[_0x4aad('0xf')]('['+[_0x24e16b[_0x4aad('0x10')]()]+_0x4aad('0x18'),_0xfd91e7);if(_0xfd91e7['result']['length']>0x0&&String(_0xfd91e7[_0x4aad('0xb')][0x0][_0x4aad('0x19')])===_0x4aad('0x1a')){_0x52ebd5[_0x4aad('0x1b')]=_0xfd91e7[_0x4aad('0xb')][0x0][_0x4aad('0xe')];}else{_0x52ebd5[_0x4aad('0x1b')]=_0x52ebd5[_0x4aad('0xd')];_0x52ebd5['userEmail']=_0x52ebd5[_0x4aad('0x1c')];}logger[_0x4aad('0xf')]('['+[_0x24e16b[_0x4aad('0x10')]()]+'],\x20getUser\x20crm',_0x52ebd5);_0x1e477a(_0x52ebd5);})[_0x4aad('0x1d')](function(_0x40aa88){logger[_0x4aad('0x12')]('['+[_0x24e16b[_0x4aad('0x10')]()]+']',_0x40aa88['message']);_0x2f6ae1(_0x40aa88[_0x4aad('0x1e')]);});}else{logger[_0x4aad('0xf')]('['+[_0x24e16b[_0x4aad('0x10')]()]+_0x4aad('0x1f'));_0x52ebd5['userId']=_0x52ebd5[_0x4aad('0xd')];_0x52ebd5[_0x4aad('0x15')]=_0x52ebd5[_0x4aad('0x1c')];_0x1e477a(_0x52ebd5);}});};}function createEndUser(_0x4b1b51,_0x346cdd,_0x33e461,_0x494757,_0x47329a){logger[_0x4aad('0xf')]('['+[_0x4b1b51[_0x4aad('0x10')]()]+_0x4aad('0x20'),_0x33e461);return new Promise(function(_0x52c9a5,_0x157dad){var _0x23dfe0={'method':_0x4aad('0x21'),'uri':_0x494757+_0x4aad('0x22')+_0x47329a,'body':{'user_name':_0x33e461[_0x4aad('0x23')],'roles':_0x4aad('0x24'),'first_name':_0x33e461[_0x4aad('0x23')],'active':_0x4aad('0x1a'),'date_format':'System','phone':_0x33e461[_0x4aad('0x23')]},'auth':_0x346cdd,'json':!![]};return rp(_0x23dfe0)[_0x4aad('0xa')](function(_0x520ea8){logger['info']('['+[_0x4b1b51[_0x4aad('0x10')]()]+_0x4aad('0x25'),_0x520ea8[_0x4aad('0xb')]);_0x33e461['endUserId']=_0x520ea8[_0x4aad('0xb')][_0x4aad('0xe')];_0x52c9a5(_0x33e461);})[_0x4aad('0x1d')](function(_0x3d1e98){logger['error']('['+[_0x4b1b51[_0x4aad('0x10')]()]+']',_0x3d1e98['message']);_0x157dad(_0x3d1e98[_0x4aad('0x1e')]);});});}function getEndUser(_0x15b617,_0x330576,_0x48aeec,_0x88bf76,_0x1837ae){return function(_0x149598){logger[_0x4aad('0xf')]('['+[_0x15b617[_0x4aad('0x10')]()]+_0x4aad('0x26'),_0x149598);return new Promise(function(_0x160381,_0x31f3a6){var _0x985ea7={'method':_0x4aad('0x9'),'uri':_0x48aeec+_0x4aad('0x27')+_0x149598['endUserNumber']+'&'+_0x88bf76+'&'+_0x1837ae,'auth':_0x330576,'json':!![]};return rp(_0x985ea7)[_0x4aad('0xa')](function(_0x34e671){if(_0x34e671[_0x4aad('0xb')][_0x4aad('0xc')]>0x0){_0x149598[_0x4aad('0x28')]=_0x34e671[_0x4aad('0xb')][0x0][_0x4aad('0xe')];logger[_0x4aad('0xf')]('['+[_0x15b617[_0x4aad('0x10')]()]+_0x4aad('0x29'),_0x149598);_0x160381(_0x149598);}else{return createEndUser(_0x15b617,_0x330576,_0x149598,_0x48aeec,_0x88bf76)[_0x4aad('0xa')](function(_0x4bfc84){logger[_0x4aad('0xf')]('['+[_0x15b617[_0x4aad('0x10')]()]+'],\x20createEndUser\x20crm',_0x4bfc84);_0x160381(_0x4bfc84);});}})['catch'](function(_0x477216){logger[_0x4aad('0x12')]('['+[_0x15b617[_0x4aad('0x10')]()]+']',_0x477216['message']);_0x31f3a6(_0x477216[_0x4aad('0x1e')]);});});};}function getCustomFields(_0x4def5f,_0x1b352a){var _0x539edb={};if(_0x4def5f[_0x4aad('0xc')]>0x0){_['forEach'](_0x4def5f,function(_0x5f109b){if(_[_0x4aad('0x2a')]([_0x4aad('0x2b'),_0x4aad('0x2c')],_0x5f109b['type'])&&_0x5f109b[_0x4aad('0x2d')]&&!_0x5f109b[_0x4aad('0x2e')]){_0x539edb[_0x5f109b[_0x4aad('0x2d')]['toLowerCase']()]=_0x5f109b[_0x4aad('0x2f')]['toString']();}else if(_[_0x4aad('0x2a')]([_0x4aad('0x2b'),'picklist'],_0x5f109b[_0x4aad('0x30')])&&_0x5f109b['idField']&&_0x5f109b[_0x4aad('0x2e')]){_0x539edb[_0x5f109b[_0x4aad('0x31')]['toLowerCase']()]=_0x5f109b[_0x4aad('0x2f')][_0x4aad('0x32')]();}else if(_0x5f109b[_0x4aad('0x30')]===_0x4aad('0x33')&&_0x5f109b[_0x4aad('0x34')]&&_0x5f109b[_0x4aad('0x31')]&&_0x5f109b[_0x4aad('0x2e')]){_0x539edb[_0x5f109b[_0x4aad('0x31')][_0x4aad('0x35')]()]=_0x1b352a[_0x5f109b[_0x4aad('0x34')]][_0x4aad('0x32')]();}else if(_0x5f109b[_0x4aad('0x30')]===_0x4aad('0x36')&&_0x5f109b[_0x4aad('0x37')]&&_0x5f109b[_0x4aad('0x37')]['name']&&_0x5f109b['idField']&&_0x5f109b[_0x4aad('0x2e')]){_0x539edb[_0x5f109b[_0x4aad('0x31')][_0x4aad('0x35')]()]=_0x1b352a[_0x5f109b[_0x4aad('0x37')]['name'][_0x4aad('0x35')]()][_0x4aad('0x32')]();}});}return _0x539edb;}function getTicket(_0x3dcf56,_0x440b68,_0x1a43a0,_0x3d0550,_0x518cfc,_0x5b6f68){return function(_0x5daca1){logger[_0x4aad('0xf')]('['+[_0x3dcf56[_0x4aad('0x10')]()]+_0x4aad('0x38'),_0x5daca1);return new Promise(function(_0x51a53a,_0x183eb2){var _0x5d0fff=_0x3dcf56['toLowerCase']()===_0x4aad('0x39')?_0x5daca1[_0x4aad('0x1b')]:_0x5daca1[_0x4aad('0x28')];var _0x2a39ab={'method':'POST','uri':_0x1a43a0+_0x4aad('0x3a')+'?'+_0x5b6f68,'body':Object[_0x4aad('0x3b')]({},{'active':_0x4aad('0x1a'),'caller_id':_0x5d0fff,'assigned_to':_0x5daca1[_0x4aad('0x1b')],'short_description':intUtil[_0x4aad('0x3c')](_0x3d0550['Subjects'],_0x518cfc,'\x20'),'description':intUtil[_0x4aad('0x3c')](_0x3d0550[_0x4aad('0x3d')],_0x518cfc,'\x0a')},getCustomFields(_0x3d0550[_0x4aad('0x3e')],_0x518cfc)),'auth':_0x440b68,'json':!![]};return rp(_0x2a39ab)[_0x4aad('0xa')](function(_0x560460){logger[_0x4aad('0xf')]('['+[_0x3dcf56[_0x4aad('0x10')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x560460[_0x4aad('0xb')]);_0x5daca1[_0x4aad('0x3f')]=_0x560460[_0x4aad('0xb')][_0x4aad('0xe')];_0x5daca1[_0x4aad('0x40')]=_0x560460[_0x4aad('0xb')][_0x4aad('0x41')];logger[_0x4aad('0xf')]('['+[_0x3dcf56[_0x4aad('0x10')]()]+_0x4aad('0x42'),_0x5daca1);_0x51a53a(_0x5daca1);})[_0x4aad('0x1d')](function(_0x333afa){logger[_0x4aad('0x12')]('['+[_0x3dcf56[_0x4aad('0x10')]()]+']',_0x333afa[_0x4aad('0x1e')]);_0x183eb2(_0x333afa[_0x4aad('0x1e')]);});});};}function createRemoteTag(_0x468d0a,_0x2abfe4,_0x2e2f2a,_0x4fdb8a){return new Promise(function(_0x5a4c49,_0x2d60ec){var _0x42b3fa={'method':_0x4aad('0x21'),'uri':_0x2e2f2a+_0x4aad('0x43')+'?'+_0x4fdb8a,'body':{'short_description':_0x468d0a,'global':!![],'active':!![],'name':_0x468d0a},'auth':_0x2abfe4,'json':!![]};return rp(_0x42b3fa)[_0x4aad('0xa')](function(_0x140d37){var _0x3c818a=_0x140d37[_0x4aad('0xb')][_0x4aad('0xe')];_0x5a4c49(_0x3c818a);});});}function getRemoteTag(_0x3d334e,_0x4aacd0,_0x5b0306,_0x264c0c,_0x1f61f4){return new Promise(function(_0x1c5d82,_0x2d92c8){var _0xca49={'method':'GET','uri':_0x5b0306+'label'+_0x4aad('0x44')+_0x3d334e+'&'+_0x264c0c,'auth':_0x4aacd0,'json':!![]};return rp(_0xca49)['then'](function(_0x47da4c){if(_0x47da4c[_0x4aad('0xb')][_0x4aad('0xc')]>0x0){var _0x20dd3f=_0x47da4c[_0x4aad('0xb')][0x0][_0x4aad('0xe')];_0x1c5d82(_0x20dd3f);}else{return createRemoteTag(_0x3d334e,_0x4aacd0,_0x5b0306,_0x264c0c)['then'](function(_0x307dd0){_0x1c5d82(_0x307dd0);});}});});}function assignTagToIncident(_0x30db2f,_0x1c1392,_0x3628c4,_0x2ce09b,_0x22478b){return new Promise(function(_0x32db00,_0x57ab08){var _0x3050a9={'method':_0x4aad('0x21'),'uri':_0x3628c4+_0x4aad('0x45')+'?'+_0x22478b,'body':{'label':_0x30db2f,'table':_0x4aad('0x3a'),'id_type':_0x4aad('0x46'),'table_key':_0x2ce09b[_0x4aad('0x3f')],'title':_0x4aad('0x47')+_0x2ce09b[_0x4aad('0x40')],'id_display':_0x2ce09b['ticketNumber']},'auth':_0x1c1392,'json':!![]};return rp(_0x3050a9)[_0x4aad('0xa')](function(_0x52bc0a){_0x32db00();})['catch'](function(){_0x32db00();});});}function manageTags(_0x2d61e5,_0x2f684d,_0xf073be,_0x24e754,_0x21aee7,_0x30efd7,_0x3c42c7){return new Promise(function(_0x2ca2f3,_0x105aeb){var _0x1ed867=[];_0x2f684d[_0x4aad('0x48')](function(_0x16d1ba){_0x1ed867['push'](getRemoteTag(_0x16d1ba,_0xf073be,_0x24e754,_0x30efd7,_0x3c42c7));});return Promise[_0x4aad('0x49')](_0x1ed867)[_0x4aad('0xa')](function(_0x56e5bb){if(_0x56e5bb['length']){logger[_0x4aad('0xf')]('['+[_0x2d61e5['toUpperCase']()]+_0x4aad('0x4a'),_0x56e5bb);var _0x43fcf0=[];_0x56e5bb['forEach'](function(_0x432caa){_0x43fcf0[_0x4aad('0x4b')](assignTagToIncident(_0x432caa,_0xf073be,_0x24e754,_0x21aee7,_0x30efd7));});return Promise[_0x4aad('0x49')](_0x43fcf0)[_0x4aad('0xa')](function(){_0x2ca2f3();})[_0x4aad('0x1d')](function(){_0x2ca2f3();});}else{_0x2ca2f3();}});});}function getTags(_0x342af2,_0x302426,_0x2ed6dd,_0xa192ce,_0x3c7376,_0x143a32){return function(_0x51d9e0){return new Promise(function(_0x22e5f7,_0x4b168a){var _0x26ddb1=[];var _0x20708e=_0xa192ce[_0x4aad('0x4c')];if(_0x20708e&&_0x20708e[_0x4aad('0xc')]>0x0){_0x26ddb1=_[_0x4aad('0x4d')](_0x20708e,_0x4aad('0x4e'));}if(_0x26ddb1[_0x4aad('0xc')]>0x0){return manageTags(_0x342af2,_0x26ddb1,_0x302426,_0x2ed6dd,_0x51d9e0,_0x3c7376,_0x143a32)[_0x4aad('0xa')](function(){_0x22e5f7(_0x51d9e0);});}else{_0x22e5f7(_0x51d9e0);}});};}function emit(_0x226f99,_0x21aa13,_0x4474dc){var _0x2cafea=_0x4aad('0x4f')+_0x4aad('0x50')+_0x4aad('0x51')+_0x4aad('0x52');var _0x1dc761={'uri':_0x226f99+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x4474dc+_0x2cafea};io['to'](util[_0x4aad('0x53')](_0x4aad('0x54'),_0x21aa13))[_0x4aad('0x55')](_0x4aad('0x56'),_0x1dc761);}exports['cs']=function(_0x316bf1,_0x1a1d45,_0x416c6f,_0x786835,_0x273f86,_0x46df21,_0x200136,_0x17eaa5){var _0x30aff8={};var _0x3cc01a={'user':_0x46df21['username'],'pass':_0x46df21[_0x4aad('0x57')]};var _0x28fdb0='sysparm_limit=1';var _0x463cfa=_0x4aad('0x58');_0x46df21[_0x4aad('0x59')]=intUtil[_0x4aad('0x5a')](_0x46df21[_0x4aad('0x59')]);_0x46df21[_0x4aad('0x5b')]=intUtil[_0x4aad('0x5a')](_0x46df21[_0x4aad('0x5b')]);var _0x5246a9=util[_0x4aad('0x53')](_0x4aad('0x5c'),_0x46df21['remoteUri']);_0x30aff8[_0x4aad('0x15')]=!_['isNil'](_0x786835)?_0x786835[_0x4aad('0x5d')]:null;_0x30aff8[_0x4aad('0x1c')]=_0x46df21[_0x4aad('0x5d')];_0x30aff8[_0x4aad('0x23')]=_0x17eaa5['toLowerCase']()==='outbound'?_0x1a1d45[_0x4aad('0x5e')]:_0x1a1d45['calleridnum'];_0x30aff8[_0x4aad('0x5f')]=_0x17eaa5==='queue'||_0x17eaa5===_0x4aad('0x60')?_0x4aad('0x61'):'outbound';var _0x2c0221=util[_0x4aad('0x53')](_0x4aad('0x62'),_0x46df21['serverUrl'],_0x1a1d45[_0x4aad('0x63')],md5(_0x1a1d45[_0x4aad('0x63')]));if(_0x273f86&&_0x273f86[_0x4aad('0x64')]){logger[_0x4aad('0xf')](_0x4aad('0x65'),_0x4aad('0x66'));_0x1a1d45[_0x4aad('0x67')]=_0x2c0221;}else if(_0x200136&&_0x200136['recordingFormat']&&_0x200136[_0x4aad('0x68')]!=='none'){logger[_0x4aad('0xf')](_0x4aad('0x69'),_0x4aad('0x66'));_0x1a1d45[_0x4aad('0x67')]=_0x2c0221;}else{_0x1a1d45[_0x4aad('0x67')]='';}return getAdminUser(_0x17eaa5,_0x3cc01a,_0x30aff8,_0x5246a9,_0x463cfa,_0x28fdb0)[_0x4aad('0xa')](getUser(_0x17eaa5,_0x3cc01a,_0x5246a9,_0x463cfa,_0x28fdb0))[_0x4aad('0xa')](getEndUser(_0x17eaa5,_0x3cc01a,_0x5246a9,_0x463cfa,_0x28fdb0))[_0x4aad('0xa')](getTicket(_0x17eaa5,_0x3cc01a,_0x5246a9,_0x416c6f,_0x1a1d45,_0x463cfa))[_0x4aad('0xa')](function(_0x3ca6f7){logger[_0x4aad('0xf')](util[_0x4aad('0x53')](_0x4aad('0x6a'),_0x3ca6f7['ticketId']));logger[_0x4aad('0xf')](util[_0x4aad('0x53')](_0x4aad('0x6b'),_0x17eaa5));if(_0x17eaa5!==_0x4aad('0x60')){logger['info']('['+[_0x17eaa5[_0x4aad('0x10')]()]+']',_0x4aad('0x6c'));emit(_0x46df21[_0x4aad('0x59')],_0x786835[_0x4aad('0x4e')],_0x3ca6f7[_0x4aad('0x3f')]);}})[_0x4aad('0x1d')](function(_0x4c798b){logger[_0x4aad('0x12')]('['+[_0x17eaa5[_0x4aad('0x10')]()]+_0x4aad('0x6d'),util['inspect'](_0x4c798b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x48d6=['./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','socket.io-emitter','GET','then','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','],\x20getUser\x20input\x20crm','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','length','active','true','adminEmail','],\x20getUser\x20crm','message',']\x20using\x20admin\x20profile','userId','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','content','toString','includes','string','picklist','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','POST','label_entry','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis'];(function(_0x3f7c7e,_0x1a023c){var _0x313e0d=function(_0x527225){while(--_0x527225){_0x3f7c7e['push'](_0x3f7c7e['shift']());}};_0x313e0d(++_0x1a023c);}(_0x48d6,0xd7));var _0x648d=function(_0x4a2ab7,_0x117e0e){_0x4a2ab7=_0x4a2ab7-0x0;var _0x307db4=_0x48d6[_0x4a2ab7];return _0x307db4;};'use strict';var _=require('lodash');var Promise=require(_0x648d('0x0'));var rp=require(_0x648d('0x1'));var util=require(_0x648d('0x2'));var md5=require(_0x648d('0x3'));var Redis=require(_0x648d('0x4'));var intUtil=require(_0x648d('0x5'));var config=require(_0x648d('0x6'));var logger=require(_0x648d('0x7'))(_0x648d('0x8'));config['redis']=_[_0x648d('0x9')](config[_0x648d('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x648d('0xb'))(new Redis(config[_0x648d('0xa')]));function getAdminUser(_0x3549f3,_0x293dad,_0x25e06b,_0x38e6eb,_0x493519,_0x2d5046){return new Promise(function(_0x5d5918,_0x5807ce){var _0xafa901={'method':_0x648d('0xc'),'uri':_0x38e6eb+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x493519+'&'+_0x2d5046,'auth':_0x293dad,'json':!![]};return rp(_0xafa901)[_0x648d('0xd')](function(_0x2c7532){if(_0x2c7532['result']['length']>0x0){_0x25e06b[_0x648d('0xe')]=_0x2c7532[_0x648d('0xf')][0x0][_0x648d('0x10')];}logger[_0x648d('0x11')]('['+[_0x3549f3[_0x648d('0x12')]()]+_0x648d('0x13'),_0x25e06b);_0x5d5918(_0x25e06b);})[_0x648d('0x14')](function(_0x44c901){logger[_0x648d('0x15')]('['+[_0x3549f3[_0x648d('0x12')]()]+']',_0x44c901['message']);_0x5807ce(_0x44c901['message']);});});}function getUser(_0x33f30d,_0x2fccf7,_0x5dacd2,_0x1998af,_0x1428f3){return function(_0x245688){logger[_0x648d('0x11')]('['+[_0x33f30d[_0x648d('0x12')]()]+_0x648d('0x16'),_0x245688);return new Promise(function(_0x229af3,_0x5bfc09){if(intUtil['validateEmail'](_0x245688['userEmail'])){var _0x2d88af={'method':'GET','uri':_0x5dacd2+_0x648d('0x17')+_0x245688[_0x648d('0x18')]+'&'+_0x1998af+'&'+_0x1428f3,'auth':_0x2fccf7,'json':!![]};logger['info']('['+[_0x33f30d[_0x648d('0x12')]()]+_0x648d('0x19'),_0x2d88af);return rp(_0x2d88af)[_0x648d('0xd')](function(_0x1a6ae2){logger[_0x648d('0x11')]('['+[_0x33f30d[_0x648d('0x12')]()]+'],\x20getUser\x20entity',_0x1a6ae2);if(_0x1a6ae2[_0x648d('0xf')][_0x648d('0x1a')]>0x0&&String(_0x1a6ae2[_0x648d('0xf')][0x0][_0x648d('0x1b')])===_0x648d('0x1c')){_0x245688['userId']=_0x1a6ae2[_0x648d('0xf')][0x0][_0x648d('0x10')];}else{_0x245688['userId']=_0x245688['adminId'];_0x245688[_0x648d('0x18')]=_0x245688[_0x648d('0x1d')];}logger['info']('['+[_0x33f30d[_0x648d('0x12')]()]+_0x648d('0x1e'),_0x245688);_0x229af3(_0x245688);})['catch'](function(_0x2b821f){logger['error']('['+[_0x33f30d[_0x648d('0x12')]()]+']',_0x2b821f[_0x648d('0x1f')]);_0x5bfc09(_0x2b821f[_0x648d('0x1f')]);});}else{logger[_0x648d('0x11')]('['+[_0x33f30d[_0x648d('0x12')]()]+_0x648d('0x20'));_0x245688[_0x648d('0x21')]=_0x245688['adminId'];_0x245688[_0x648d('0x18')]=_0x245688[_0x648d('0x1d')];_0x229af3(_0x245688);}});};}function createEndUser(_0x3f6da6,_0x2037c3,_0x85153c,_0x2d0349,_0x32db7c){logger[_0x648d('0x11')]('['+[_0x3f6da6[_0x648d('0x12')]()]+_0x648d('0x22'),_0x85153c);return new Promise(function(_0x30e961,_0x370dd1){var _0x18094c={'method':'POST','uri':_0x2d0349+_0x648d('0x23')+_0x32db7c,'body':{'user_name':_0x85153c[_0x648d('0x24')],'roles':_0x648d('0x25'),'first_name':_0x85153c[_0x648d('0x24')],'active':'true','date_format':_0x648d('0x26'),'phone':_0x85153c[_0x648d('0x24')]},'auth':_0x2037c3,'json':!![]};return rp(_0x18094c)[_0x648d('0xd')](function(_0x5ab24d){logger['info']('['+[_0x3f6da6[_0x648d('0x12')]()]+'],\x20EndUser\x20schema',_0x5ab24d[_0x648d('0xf')]);_0x85153c[_0x648d('0x27')]=_0x5ab24d[_0x648d('0xf')][_0x648d('0x10')];_0x30e961(_0x85153c);})[_0x648d('0x14')](function(_0x425ef3){logger[_0x648d('0x15')]('['+[_0x3f6da6[_0x648d('0x12')]()]+']',_0x425ef3['message']);_0x370dd1(_0x425ef3[_0x648d('0x1f')]);});});}function getEndUser(_0x278a4d,_0x3a4c37,_0x5e400c,_0x378984,_0x556f15){return function(_0x2d57c8){logger[_0x648d('0x11')]('['+[_0x278a4d[_0x648d('0x12')]()]+_0x648d('0x28'),_0x2d57c8);return new Promise(function(_0x7b8b47,_0x136baa){var _0x86b73f={'method':'GET','uri':_0x5e400c+'sys_user?sysparm_query=phone%3D'+_0x2d57c8[_0x648d('0x24')]+'&'+_0x378984+'&'+_0x556f15,'auth':_0x3a4c37,'json':!![]};return rp(_0x86b73f)[_0x648d('0xd')](function(_0xca853f){if(_0xca853f[_0x648d('0xf')]['length']>0x0){_0x2d57c8[_0x648d('0x27')]=_0xca853f['result'][0x0]['sys_id'];logger[_0x648d('0x11')]('['+[_0x278a4d['toUpperCase']()]+_0x648d('0x29'),_0x2d57c8);_0x7b8b47(_0x2d57c8);}else{return createEndUser(_0x278a4d,_0x3a4c37,_0x2d57c8,_0x5e400c,_0x378984)[_0x648d('0xd')](function(_0x132ec7){logger[_0x648d('0x11')]('['+[_0x278a4d[_0x648d('0x12')]()]+_0x648d('0x2a'),_0x132ec7);_0x7b8b47(_0x132ec7);});}})[_0x648d('0x14')](function(_0x4d4e44){logger['error']('['+[_0x278a4d['toUpperCase']()]+']',_0x4d4e44[_0x648d('0x1f')]);_0x136baa(_0x4d4e44['message']);});});};}function getCustomFields(_0x4ffb2b,_0x32c747){var _0x291370={};if(_0x4ffb2b[_0x648d('0x1a')]>0x0){_[_0x648d('0x2b')](_0x4ffb2b,function(_0x353d7f){if(_['includes'](['string','picklist'],_0x353d7f[_0x648d('0x2c')])&&_0x353d7f[_0x648d('0x2d')]&&!_0x353d7f[_0x648d('0x2e')]){_0x291370[_0x353d7f['nameField']['toLowerCase']()]=_0x353d7f[_0x648d('0x2f')][_0x648d('0x30')]();}else if(_[_0x648d('0x31')]([_0x648d('0x32'),_0x648d('0x33')],_0x353d7f[_0x648d('0x2c')])&&_0x353d7f[_0x648d('0x34')]&&_0x353d7f[_0x648d('0x2e')]){_0x291370[_0x353d7f[_0x648d('0x34')][_0x648d('0x35')]()]=_0x353d7f[_0x648d('0x2f')][_0x648d('0x30')]();}else if(_0x353d7f[_0x648d('0x2c')]===_0x648d('0x36')&&_0x353d7f[_0x648d('0x37')]&&_0x353d7f[_0x648d('0x34')]&&_0x353d7f[_0x648d('0x2e')]){_0x291370[_0x353d7f['idField'][_0x648d('0x35')]()]=_0x32c747[_0x353d7f[_0x648d('0x37')]]['toString']();}else if(_0x353d7f[_0x648d('0x2c')]===_0x648d('0x38')&&_0x353d7f[_0x648d('0x39')]&&_0x353d7f[_0x648d('0x39')][_0x648d('0x3a')]&&_0x353d7f['idField']&&_0x353d7f[_0x648d('0x2e')]){_0x291370[_0x353d7f[_0x648d('0x34')][_0x648d('0x35')]()]=_0x32c747[_0x353d7f[_0x648d('0x39')]['name'][_0x648d('0x35')]()]['toString']();}});}return _0x291370;}function getTicket(_0x50389b,_0x44c725,_0x220e3f,_0x4401bc,_0x247498,_0x1af8f3){return function(_0x3bd039){logger[_0x648d('0x11')]('['+[_0x50389b[_0x648d('0x12')]()]+_0x648d('0x3b'),_0x3bd039);return new Promise(function(_0x496f1e,_0x67e08c){var _0x26c3ce=_0x50389b[_0x648d('0x35')]()===_0x648d('0x3c')?_0x3bd039[_0x648d('0x21')]:_0x3bd039[_0x648d('0x27')];var _0x946fd9={'method':'POST','uri':_0x220e3f+_0x648d('0x3d')+'?'+_0x1af8f3,'body':Object[_0x648d('0x3e')]({},{'active':_0x648d('0x1c'),'caller_id':_0x26c3ce,'assigned_to':_0x3bd039[_0x648d('0x21')],'short_description':intUtil[_0x648d('0x3f')](_0x4401bc[_0x648d('0x40')],_0x247498,'\x20'),'description':intUtil[_0x648d('0x3f')](_0x4401bc[_0x648d('0x41')],_0x247498,'\x0a')},getCustomFields(_0x4401bc[_0x648d('0x42')],_0x247498)),'auth':_0x44c725,'json':!![]};return rp(_0x946fd9)[_0x648d('0xd')](function(_0x32400d){logger[_0x648d('0x11')]('['+[_0x50389b['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x32400d[_0x648d('0xf')]);_0x3bd039[_0x648d('0x43')]=_0x32400d[_0x648d('0xf')][_0x648d('0x10')];_0x3bd039[_0x648d('0x44')]=_0x32400d[_0x648d('0xf')]['number'];logger[_0x648d('0x11')]('['+[_0x50389b['toUpperCase']()]+_0x648d('0x45'),_0x3bd039);_0x496f1e(_0x3bd039);})[_0x648d('0x14')](function(_0x48ed36){logger[_0x648d('0x15')]('['+[_0x50389b[_0x648d('0x12')]()]+']',_0x48ed36['message']);_0x67e08c(_0x48ed36[_0x648d('0x1f')]);});});};}function createRemoteTag(_0x458d8a,_0x5458d9,_0x461b0c,_0x344f4c){return new Promise(function(_0x5581ef,_0x1b297c){var _0x222a8f={'method':'POST','uri':_0x461b0c+_0x648d('0x46')+'?'+_0x344f4c,'body':{'short_description':_0x458d8a,'global':!![],'active':!![],'name':_0x458d8a},'auth':_0x5458d9,'json':!![]};return rp(_0x222a8f)[_0x648d('0xd')](function(_0x19c70d){var _0x2d2b91=_0x19c70d[_0x648d('0xf')][_0x648d('0x10')];_0x5581ef(_0x2d2b91);});});}function getRemoteTag(_0x19a650,_0x3ee612,_0x57f06e,_0x45b002,_0x4773b4){return new Promise(function(_0x267822,_0x4236f4){var _0x45626a={'method':_0x648d('0xc'),'uri':_0x57f06e+_0x648d('0x46')+_0x648d('0x47')+_0x19a650+'&'+_0x45b002,'auth':_0x3ee612,'json':!![]};return rp(_0x45626a)[_0x648d('0xd')](function(_0x5de6e7){if(_0x5de6e7[_0x648d('0xf')]['length']>0x0){var _0x2544a2=_0x5de6e7['result'][0x0][_0x648d('0x10')];_0x267822(_0x2544a2);}else{return createRemoteTag(_0x19a650,_0x3ee612,_0x57f06e,_0x45b002)[_0x648d('0xd')](function(_0x1823d2){_0x267822(_0x1823d2);});}});});}function assignTagToIncident(_0x5df467,_0x35445d,_0x10f44d,_0x3b1bf0,_0x416cf0){return new Promise(function(_0x41ac6f,_0x24fdb2){var _0x3f327e={'method':_0x648d('0x48'),'uri':_0x10f44d+_0x648d('0x49')+'?'+_0x416cf0,'body':{'label':_0x5df467,'table':'incident','id_type':_0x648d('0x4a'),'table_key':_0x3b1bf0[_0x648d('0x43')],'title':_0x648d('0x4b')+_0x3b1bf0[_0x648d('0x44')],'id_display':_0x3b1bf0[_0x648d('0x44')]},'auth':_0x35445d,'json':!![]};return rp(_0x3f327e)[_0x648d('0xd')](function(_0x9e5ed3){_0x41ac6f();})[_0x648d('0x14')](function(){_0x41ac6f();});});}function manageTags(_0x58af81,_0x4c707d,_0x580f1b,_0xb63a06,_0x3953e7,_0x3298c6,_0x238b7d){return new Promise(function(_0xf760a1,_0x1527c8){var _0x5c727b=[];_0x4c707d[_0x648d('0x2b')](function(_0x4da4b8){_0x5c727b['push'](getRemoteTag(_0x4da4b8,_0x580f1b,_0xb63a06,_0x3298c6,_0x238b7d));});return Promise[_0x648d('0x4c')](_0x5c727b)[_0x648d('0xd')](function(_0x4cd5af){if(_0x4cd5af[_0x648d('0x1a')]){logger[_0x648d('0x11')]('['+[_0x58af81[_0x648d('0x12')]()]+_0x648d('0x4d'),_0x4cd5af);var _0x355c4b=[];_0x4cd5af[_0x648d('0x2b')](function(_0x591b83){_0x355c4b[_0x648d('0x4e')](assignTagToIncident(_0x591b83,_0x580f1b,_0xb63a06,_0x3953e7,_0x3298c6));});return Promise[_0x648d('0x4c')](_0x355c4b)[_0x648d('0xd')](function(){_0xf760a1();})[_0x648d('0x14')](function(){_0xf760a1();});}else{_0xf760a1();}});});}function getTags(_0x2ce18e,_0x44c6fe,_0x2269b5,_0x5cbbaf,_0x533b24,_0x45d40e){return function(_0x8c41c7){return new Promise(function(_0x5573da,_0x14a333){var _0x7f1645=[];var _0x2c0295=_0x5cbbaf['Tags'];if(_0x2c0295&&_0x2c0295[_0x648d('0x1a')]>0x0){_0x7f1645=_['map'](_0x2c0295,_0x648d('0x3a'));}if(_0x7f1645['length']>0x0){return manageTags(_0x2ce18e,_0x7f1645,_0x44c6fe,_0x2269b5,_0x8c41c7,_0x533b24,_0x45d40e)[_0x648d('0xd')](function(){_0x5573da(_0x8c41c7);});}else{_0x5573da(_0x8c41c7);}});};}function emit(_0xdeb883,_0x492111,_0x3e03fa){var _0x29432e=_0x648d('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x648d('0x50')+_0x648d('0x51');var _0x2a08b0={'uri':_0xdeb883+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x3e03fa+_0x29432e};io['to'](util[_0x648d('0x52')](_0x648d('0x53'),_0x492111))[_0x648d('0x54')](_0x648d('0x55'),_0x2a08b0);}exports['cs']=function(_0x4cba4d,_0x1b73e6,_0x39b4a1,_0x31d11c,_0x8e72d8,_0x12a9ec,_0x2ad853,_0x2a85b8){var _0x24d215={};var _0x4ae23f={'user':_0x12a9ec[_0x648d('0x56')],'pass':_0x12a9ec['password']};var _0x48ce20=_0x648d('0x57');var _0x11f239=_0x648d('0x58');_0x12a9ec[_0x648d('0x59')]=intUtil[_0x648d('0x5a')](_0x12a9ec[_0x648d('0x59')]);_0x12a9ec[_0x648d('0x5b')]=intUtil[_0x648d('0x5a')](_0x12a9ec[_0x648d('0x5b')]);var _0x540735=util['format']('%s/api/now/table/',_0x12a9ec['remoteUri']);_0x24d215[_0x648d('0x18')]=!_[_0x648d('0x5c')](_0x31d11c)?_0x31d11c[_0x648d('0x5d')]:null;_0x24d215['adminEmail']=_0x12a9ec[_0x648d('0x5d')];_0x24d215[_0x648d('0x24')]=_0x2a85b8[_0x648d('0x35')]()===_0x648d('0x3c')?_0x1b73e6['destcalleridnum']:_0x1b73e6['calleridnum'];_0x24d215[_0x648d('0x5e')]=_0x2a85b8===_0x648d('0x5f')||_0x2a85b8===_0x648d('0x60')?'queue':'outbound';var _0x2c5628=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12a9ec[_0x648d('0x5b')],_0x1b73e6[_0x648d('0x61')],md5(_0x1b73e6['uniqueid']));if(_0x8e72d8&&_0x8e72d8[_0x648d('0x62')]){logger['info'](_0x648d('0x63'),_0x648d('0x64'));_0x1b73e6[_0x648d('0x65')]=_0x2c5628;}else if(_0x2ad853&&_0x2ad853[_0x648d('0x66')]&&_0x2ad853[_0x648d('0x66')]!==_0x648d('0x67')){logger[_0x648d('0x11')](_0x648d('0x68'),'Recording\x20is\x20enabled!');_0x1b73e6[_0x648d('0x65')]=_0x2c5628;}else{_0x1b73e6[_0x648d('0x65')]='';}return getAdminUser(_0x2a85b8,_0x4ae23f,_0x24d215,_0x540735,_0x11f239,_0x48ce20)[_0x648d('0xd')](getUser(_0x2a85b8,_0x4ae23f,_0x540735,_0x11f239,_0x48ce20))['then'](getEndUser(_0x2a85b8,_0x4ae23f,_0x540735,_0x11f239,_0x48ce20))['then'](getTicket(_0x2a85b8,_0x4ae23f,_0x540735,_0x39b4a1,_0x1b73e6,_0x11f239))[_0x648d('0xd')](function(_0x17763d){logger[_0x648d('0x11')](util[_0x648d('0x52')](_0x648d('0x69'),_0x17763d['ticketId']));logger[_0x648d('0x11')](util[_0x648d('0x52')](_0x648d('0x6a'),_0x2a85b8));if(_0x2a85b8!==_0x648d('0x60')){logger[_0x648d('0x11')]('['+[_0x2a85b8[_0x648d('0x12')]()]+']',_0x648d('0x6b'));emit(_0x12a9ec[_0x648d('0x59')],_0x31d11c[_0x648d('0x3a')],_0x17763d['ticketId']);}})[_0x648d('0x14')](function(_0x9f992c){logger[_0x648d('0x15')]('['+[_0x2a85b8[_0x648d('0x12')]()]+_0x648d('0x6c'),util[_0x648d('0x6d')](_0x9f992c,{'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 f6dd5f8..65efc37 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 _0x312f=['stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','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!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','customField','toLowerCase','content','variableName','custom_fields','push','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','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','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','users','charAt','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','description','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','parent_name','length','forEach','idField','set_entry','JSON'];(function(_0x43b48b,_0x41959a){var _0x42f193=function(_0x16d9e8){while(--_0x16d9e8){_0x43b48b['push'](_0x43b48b['shift']());}};_0x42f193(++_0x41959a);}(_0x312f,0x1d1));var _0xf312=function(_0x25da1e,_0x14b6bb){_0x25da1e=_0x25da1e-0x0;var _0x1db1bd=_0x312f[_0x25da1e];return _0x1db1bd;};'use strict';var _=require(_0xf312('0x0'));var rp=require(_0xf312('0x1'));var BPromise=require(_0xf312('0x2'));var md5=require('md5');var util=require(_0xf312('0x3'));var Redis=require(_0xf312('0x4'));var intUtil=require(_0xf312('0x5'));var config=require(_0xf312('0x6'));var logger=require(_0xf312('0x7'))(_0xf312('0x8'));config['redis']=_['defaults'](config[_0xf312('0x9')],{'host':_0xf312('0xa'),'port':0x18eb});var io=require(_0xf312('0xb'))(new Redis(config[_0xf312('0x9')]));var def={'method':_0xf312('0xc'),'json':!![]};function emit(_0xe68686,_0x32870c,_0x3f582d){io['to'](_0xe68686)[_0xf312('0xd')](_0x32870c,_0x3f582d);}function getTicket(_0x27b751,_0x1bd913,_0x21af6b,_0x128dc2,_0x36150d,_0xeafecc,_0x4fe51d,_0x36c961){logger[_0xf312('0xe')](_0xf312('0xf'));var _0x55195a=new Date();var _0x71b5fc=[{'name':_0xf312('0x10'),'value':intUtil['getString'](_0x128dc2[_0xf312('0x11')],_0x36150d,'\x20')},{'name':_0xf312('0x12'),'value':_0x1bd913['id']},{'name':'created_by','value':_0x1bd913['id']},{'name':_0xf312('0x13'),'value':intUtil[_0xf312('0x14')](_0x128dc2[_0xf312('0x15')],_0x36150d,'\x0a')},{'name':_0xf312('0x16'),'value':_0x55195a[_0xf312('0x17')]()[_0xf312('0x18')](0x0,0x13)[_0xf312('0x19')]('T','\x20')},{'name':_0xf312('0x1a'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xf312('0x1b'),'value':_0x21af6b['id']},{'name':_0xf312('0x1c'),'value':'Contacts'},{'name':_0xf312('0x1d'),'value':_0x21af6b[_0xf312('0x10')]},{'name':'direction','value':_0x36c961}];if(_0xeafecc[_0xf312('0x1e')]){_[_0xf312('0x1f')](_0xeafecc,function(_0x397dc7){if(_0x36150d[_0x397dc7['variableName']]){_0x71b5fc['push']({'name':_0x397dc7[_0xf312('0x20')],'value':_0x36150d[_0x397dc7['variableName']]});}});}return request({'form':{'method':_0xf312('0x21'),'input_type':'JSON','response_type':_0xf312('0x22'),'rest_data':JSON[_0xf312('0x23')]({'session':_0x4fe51d['id'],'module_name':_0xf312('0x24'),'name_value_list':_0x71b5fc})}});}function getAuth(_0x2451fe){return util[_0xf312('0x25')](_0xf312('0x26'),new Buffer(_0x2451fe[_0xf312('0x27')]+':X')[_0xf312('0x28')]('base64'));}function getServerInfo(_0x367cba){return request({'form':{'method':_0xf312('0x29'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf312('0x23')]({'session':_0x367cba['id']})}});}function getUser(_0x521bf6,_0x1f68c6,_0x3e6bf9){if(!_[_0xf312('0x2a')](_0x1f68c6)){logger['info'](_0xf312('0x2b'),_0x1f68c6);return request({'form':{'method':_0xf312('0x2c'),'input_type':_0xf312('0x22'),'response_type':_0xf312('0x22'),'rest_data':JSON['stringify']({'session':_0x3e6bf9['id'],'module_name':'Employees','query':util[_0xf312('0x25')](_0xf312('0x2d'),_0x1f68c6),'order_by':'','offset':'0','select_fields':['id','name',_0xf312('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf312('0x2f')](function(_0x57c949){if(_0x57c949[_0xf312('0x30')]['length']){var _0x5d3f7b=_[_0xf312('0x31')](_0x57c949[_0xf312('0x30')],function(_0x4b09ca){return _0x4b09ca[_0xf312('0x32')][_0xf312('0x2e')][_0xf312('0x33')]===_0x1f68c6;});if(_0x5d3f7b){logger['info'](_0xf312('0x34'));return BPromise[_0xf312('0x35')]({'id':_0x5d3f7b[_0xf312('0x32')]['id'][_0xf312('0x33')],'name':_0x5d3f7b[_0xf312('0x32')][_0xf312('0x10')]['value']});}}logger['info'](_0xf312('0x36'));return BPromise[_0xf312('0x35')]({'id':_0x3e6bf9['name_value_list'][_0xf312('0x37')][_0xf312('0x33')],'name':_0x3e6bf9['name_value_list'][_0xf312('0x2e')][_0xf312('0x33')]});});}else{logger[_0xf312('0xe')](_0xf312('0x38'));return BPromise[_0xf312('0x35')]({'id':_0x3e6bf9[_0xf312('0x32')][_0xf312('0x37')][_0xf312('0x33')],'name':_0x3e6bf9[_0xf312('0x32')][_0xf312('0x2e')][_0xf312('0x33')]});}}function getEndUser(_0x2845d7,_0x45a860,_0x45cf22,_0x2cddec){logger[_0xf312('0xe')](_0xf312('0x39'),_0x45cf22);return request({'form':{'method':_0xf312('0x2c'),'input_type':_0xf312('0x22'),'response_type':_0xf312('0x22'),'rest_data':JSON[_0xf312('0x23')]({'session':_0x2cddec['id'],'module_name':_0xf312('0x3a'),'query':util[_0xf312('0x25')](_0xf312('0x3b'),_0x45cf22),'order_by':'','offset':'0','select_fields':['id',_0xf312('0x10'),_0xf312('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf312('0x2f')](function(_0x334780){if(_0x334780[_0xf312('0x30')][_0xf312('0x1e')]){var _0x2c237a=_[_0xf312('0x31')](_0x334780[_0xf312('0x30')],function(_0x19e943){return _0x19e943[_0xf312('0x32')][_0xf312('0x3c')][_0xf312('0x33')]===_0x45cf22;});if(_0x2c237a){logger[_0xf312('0xe')](_0xf312('0x3d'));return BPromise[_0xf312('0x35')]({'id':_0x2c237a[_0xf312('0x32')]['id'][_0xf312('0x33')],'name':_0x2c237a[_0xf312('0x32')]['name']['value'],'phone':_0x2c237a['name_value_list'][_0xf312('0x3c')][_0xf312('0x33')]});}}else{logger['info'](_0xf312('0x3e'));return request({'form':{'method':_0xf312('0x21'),'input_type':_0xf312('0x22'),'response_type':_0xf312('0x22'),'rest_data':JSON['stringify']({'session':_0x2cddec['id'],'module_name':_0xf312('0x3a'),'name_value_list':[{'name':_0xf312('0x3f'),'value':_0x45a860!==_0xf312('0x40')?_0x45a860:util['format'](_0xf312('0x41'),_0x45cf22)},{'name':'phone_home','value':_0x45cf22}]})}})[_0xf312('0x2f')](function(_0x4ef422){logger[_0xf312('0xe')](_0xf312('0x42'));return BPromise[_0xf312('0x35')]({'id':_0x4ef422['id'],'name':_0x4ef422[_0xf312('0x30')][_0xf312('0x3f')]['value'],'phone':_0x4ef422[_0xf312('0x30')][_0xf312('0x3c')][_0xf312('0x33')]});});}});}function request(_0x3c4045){logger['debug'](_0xf312('0x43'),JSON[_0xf312('0x23')](_0x3c4045));return rp(_[_0xf312('0x44')](def,_0x3c4045));}function getTags(_0x46da1b,_0x370177){var _0x3b7b09=[];if(_0x46da1b&&_0x46da1b['length']>0x0){_0x3b7b09=_[_0xf312('0x45')](_0x46da1b,_0x370177);}return _0x3b7b09;}function getCustomFields(_0x1597b2,_0x2c2f5d){var _0x4b0f5f=[];var _0x4f8f1e={'custom_fields':[]};if(_0x1597b2[_0xf312('0x1e')]>0x0){_[_0xf312('0x1f')](_0x1597b2,function(_0x1405e5){if(_0x1405e5[_0xf312('0x46')]===_0xf312('0x47')&&_0x1405e5['nameField']&&!_0x1405e5[_0xf312('0x48')]){_0x4f8f1e[_0x1405e5['nameField'][_0xf312('0x49')]()]=_0x1405e5['content']['toString']();}else if(_0x1405e5[_0xf312('0x46')]==='string'&&_0x1405e5['idField']&&_0x1405e5[_0xf312('0x48')]){_0x4f8f1e['custom_fields']['push']({'id':_0x1405e5[_0xf312('0x20')],'value':_0x1405e5[_0xf312('0x4a')][_0xf312('0x28')]()});}else if(_0x1405e5['type']==='variable'&&_0x1405e5['variableName']&&_0x1405e5['idField']&&_0x1405e5['customField']){_0x2c2f5d[_0x1405e5[_0xf312('0x4b')]]&&_0x4f8f1e[_0xf312('0x4c')][_0xf312('0x4d')]({'id':_0x1405e5[_0xf312('0x20')],'value':_0x2c2f5d[_0x1405e5[_0xf312('0x4b')]]['toString']()});}else if(_0x1405e5[_0xf312('0x46')]===_0xf312('0x4e')&&_0x1405e5['Variable']&&_0x1405e5[_0xf312('0x4f')][_0xf312('0x10')]&&_0x1405e5['idField']&&_0x1405e5[_0xf312('0x48')]){_0x2c2f5d[_0x1405e5[_0xf312('0x4f')][_0xf312('0x10')][_0xf312('0x49')]()]&&_0x4f8f1e[_0xf312('0x4c')][_0xf312('0x4d')]({'id':_0x1405e5[_0xf312('0x20')],'value':_0x2c2f5d[_0x1405e5['Variable'][_0xf312('0x10')]['toLowerCase']()][_0xf312('0x28')]()});}});}return _0x4f8f1e;}function getConnection(_0x47bc6a){return request({'method':_0xf312('0xc'),'form':{'method':_0xf312('0x50'),'input_type':_0xf312('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x47bc6a[_0xf312('0x51')],'password':_0x47bc6a[_0xf312('0x52')],'encryption':_0xf312('0x53')},'application':_0xf312('0x54')})}})[_0xf312('0x2f')](function(_0x32913d){var _0xf06a4=_0x32913d;if(_0xf06a4['id']){def['sessionID']=_0xf06a4['id'];return BPromise[_0xf312('0x35')](_0xf06a4);}else{throw new Error(util[_0xf312('0x25')](_0xf312('0x55'),_0x47bc6a['id']));}});}function setRelationship(_0x37caa8,_0x426289,_0x46c7b1,_0x5e672c){return request({'form':{'method':_0xf312('0x56'),'input_type':_0xf312('0x22'),'response_type':_0xf312('0x22'),'rest_data':JSON[_0xf312('0x23')]({'session':_0x37caa8['id'],'module_name':_0xf312('0x24'),'module_id':_0x46c7b1['id'],'link_field_name':_0x5e672c,'related_ids':[_0x426289['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf312('0x57')]=function(_0x458969,_0x5b09f3,_0x4b28ca,_0x481d4d,_0x5d2244,_0x4de8eb){var _0x17806f,_0x1d7233,_0xa0f507,_0x3f5705;_0x4de8eb[_0xf312('0x58')]=intUtil[_0xf312('0x59')](_0x4de8eb[_0xf312('0x58')]);_0x4de8eb[_0xf312('0x5a')]=intUtil['stripTrailingSlash'](_0x4de8eb[_0xf312('0x5a')]);def[_0xf312('0x5b')]=util[_0xf312('0x25')]('%s/service/v4_1/rest.php',_0x4de8eb[_0xf312('0x58')]);if(_0x5d2244&&_0x5d2244[_0xf312('0x5c')]){logger['info'](_0xf312('0x5d'),_0xf312('0x5e'));_0x5b09f3[_0xf312('0x5f')]=util['format'](_0xf312('0x60'),_0x4de8eb[_0xf312('0x5a')],_0x5b09f3[_0xf312('0x61')],md5(_0x5b09f3['uniqueid']));}else{_0x5b09f3['recordingURL']='';}return getConnection(_0x4de8eb)[_0xf312('0x2f')](function(_0x4ae337){_0x3f5705=_0x4ae337;return getUser(_0x4de8eb,_0x481d4d['name'],_0x3f5705);})[_0xf312('0x2f')](function(_0x5a9254){_0x17806f=_0x5a9254;logger['info']('The\x20User\x20ID\x20is:',_0x17806f['id']);return getEndUser(_0x4de8eb,_0x5b09f3['calleridname'],_0x5b09f3[_0xf312('0x62')],_0x3f5705);})['then'](function(_0x1815f6){_0x1d7233=_0x1815f6;logger[_0xf312('0xe')](_0xf312('0x63'),_0x1d7233['id']);return getTicket(_0x4de8eb,_0x17806f,_0x1d7233,_0x4b28ca,_0x5b09f3,_0x4b28ca['Fields'],_0x3f5705,_0xf312('0x64'));})[_0xf312('0x2f')](function(_0x172c1f){_0xa0f507=_0x172c1f;logger['info'](_0xf312('0x65'));logger['info'](_0xf312('0x66'),_0xa0f507['id']);return setRelationship(_0x3f5705,_0x17806f,_0xa0f507,'users');})[_0xf312('0x2f')](function(){return setRelationship(_0x3f5705,_0x1d7233,_0xa0f507,_0xf312('0x67'));})[_0xf312('0x2f')](function(){return getServerInfo(_0x3f5705);})[_0xf312('0x2f')](function(_0x45be21){var _0x5612c3=parseInt(_0x45be21[_0xf312('0x68')]['charAt'](0x0));var _0x213d10=util[_0xf312('0x25')](_0xf312('0x69'),_0x4de8eb[_0xf312('0x58')],_0xa0f507['id']);if(_0x5612c3>0x6){_0x213d10=util[_0xf312('0x25')](_0xf312('0x6a'),_0x4de8eb[_0xf312('0x58')],_0xa0f507['id']);}logger[_0xf312('0xe')](_0xf312('0x5d'),_0xf312('0x6b'));emit(util[_0xf312('0x25')](_0xf312('0x6c'),_0x481d4d[_0xf312('0x10')]),_0xf312('0x6d'),{'uri':_0x213d10});})[_0xf312('0x6e')](function(_0x4a14cd){logger['error'](_0xf312('0x5d'),JSON[_0xf312('0x23')](_0x4a14cd));});};exports[_0xf312('0x6f')]=function(_0x21b579,_0x41d5b3,_0x16f41a,_0x1a6bb3,_0x11b6b8,_0x4f2bdb,_0x133d18){var _0x3c671f,_0x491a0d,_0x5d724f,_0x615c91;_0x4f2bdb[_0xf312('0x58')]=intUtil[_0xf312('0x59')](_0x4f2bdb[_0xf312('0x58')]);_0x4f2bdb[_0xf312('0x5a')]=intUtil['stripTrailingSlash'](_0x4f2bdb['serverUrl']);def[_0xf312('0x5b')]=util[_0xf312('0x25')](_0xf312('0x70'),_0x4f2bdb[_0xf312('0x58')]);if(_0x133d18&&_0x133d18[_0xf312('0x71')]&&_0x133d18[_0xf312('0x71')]!=='none'){logger[_0xf312('0xe')](_0xf312('0x72'),_0xf312('0x5e'));_0x41d5b3[_0xf312('0x5f')]=util[_0xf312('0x25')](_0xf312('0x60'),_0x4f2bdb[_0xf312('0x5a')],_0x41d5b3[_0xf312('0x61')],md5(_0x41d5b3[_0xf312('0x61')]));}return getConnection(_0x4f2bdb)[_0xf312('0x2f')](function(_0x1d30b6){_0x615c91=_0x1d30b6;return getUser(_0x4f2bdb,_0x1a6bb3[_0xf312('0x10')],_0x615c91);})['then'](function(_0x4a759d){_0x3c671f=_0x4a759d;logger['info'](_0xf312('0x73'),_0x3c671f['id']);return getEndUser(_0x4f2bdb,_0x41d5b3[_0xf312('0x74')],_0x41d5b3[_0xf312('0x75')],_0x615c91);})[_0xf312('0x2f')](function(_0xfb6af9){_0x491a0d=_0xfb6af9;logger[_0xf312('0xe')]('The\x20Enduser\x20ID\x20is:',_0x491a0d['id']);return getTicket(_0x4f2bdb,_0x3c671f,_0x491a0d,_0x16f41a,_0x41d5b3,_0x16f41a[_0xf312('0x76')],_0x615c91,'Outbound');})[_0xf312('0x2f')](function(_0x29d306){_0x5d724f=_0x29d306;logger['info'](_0xf312('0x65'));logger['info'](_0xf312('0x66'),_0x5d724f['id']);return setRelationship(_0x615c91,_0x3c671f,_0x5d724f,_0xf312('0x77'));})[_0xf312('0x2f')](function(){return setRelationship(_0x615c91,_0x491a0d,_0x5d724f,'contacts');})['then'](function(){return getServerInfo(_0x615c91);})[_0xf312('0x2f')](function(_0x948731){var _0x9039c3=parseInt(_0x948731[_0xf312('0x68')][_0xf312('0x78')](0x0));var _0x2ef1cf=util[_0xf312('0x25')](_0xf312('0x69'),_0x4f2bdb[_0xf312('0x58')],_0x5d724f['id']);if(_0x9039c3>0x6){_0x2ef1cf=util[_0xf312('0x25')](_0xf312('0x6a'),_0x4f2bdb[_0xf312('0x58')],_0x5d724f['id']);}logger[_0xf312('0xe')]('[OUTBOUND]',_0xf312('0x6b'));emit(util['format'](_0xf312('0x6c'),_0x1a6bb3['name']),_0xf312('0x6d'),{'uri':_0x2ef1cf});})['catch'](function(_0x31ffd5){logger[_0xf312('0x79')]('[OUTBOUND]',JSON[_0xf312('0x23')](_0x31ffd5));});};exports[_0xf312('0x7a')]=function(_0x5f35f0,_0x14f5cf,_0x1f386f,_0x5cede0,_0xbd8aa3,_0x30d6c3){var _0x56fa5f,_0x2417cc,_0x553e00,_0x27b8bd;_0x30d6c3[_0xf312('0x58')]=intUtil[_0xf312('0x59')](_0x30d6c3[_0xf312('0x58')]);_0x30d6c3[_0xf312('0x5a')]=intUtil[_0xf312('0x59')](_0x30d6c3[_0xf312('0x5a')]);def['uri']=util['format'](_0xf312('0x70'),_0x30d6c3['remoteUri']);if(_0xbd8aa3&&_0xbd8aa3[_0xf312('0x5c')]){logger['info']('['+_0x14f5cf[_0xf312('0x7b')][_0xf312('0x7c')]()+']',_0xf312('0x5e'));_0x14f5cf[_0xf312('0x5f')]=util[_0xf312('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30d6c3['serverUrl'],_0x14f5cf['uniqueid'],md5(_0x14f5cf[_0xf312('0x61')]));}else{_0x14f5cf[_0xf312('0x5f')]='';}return getConnection(_0x30d6c3)[_0xf312('0x2f')](function(_0xc89deb){_0x27b8bd=_0xc89deb;if(!_[_0xf312('0x2a')](_0x5cede0)){return getUser(_0x30d6c3,_0x5cede0['name'],_0x27b8bd);}else{return getUser(_0x30d6c3,null,_0x27b8bd);}})[_0xf312('0x2f')](function(_0x21bb47){_0x56fa5f=_0x21bb47;logger[_0xf312('0xe')](_0xf312('0x73'),_0x56fa5f['id']);return getEndUser(_0x30d6c3,_0x14f5cf['calleridname'],_0x14f5cf[_0xf312('0x62')],_0x27b8bd);})[_0xf312('0x2f')](function(_0x340b2a){_0x2417cc=_0x340b2a;logger[_0xf312('0xe')](_0xf312('0x63'),_0x2417cc['id']);return getTicket(_0x30d6c3,_0x56fa5f,_0x2417cc,_0x1f386f,_0x14f5cf,_0x1f386f['Fields'],_0x27b8bd,_0xf312('0x64'));})['then'](function(_0x38b0b9){_0x553e00=_0x38b0b9;logger[_0xf312('0xe')](_0xf312('0x65'));logger['info'](_0xf312('0x66'),_0x553e00['id']);return setRelationship(_0x27b8bd,_0x56fa5f,_0x553e00,'users');})[_0xf312('0x2f')](function(){return setRelationship(_0x27b8bd,_0x2417cc,_0x553e00,_0xf312('0x67'));})['then'](function(){return getServerInfo(_0x27b8bd);})[_0xf312('0x6e')](function(_0x1d32f4){logger[_0xf312('0x79')]('['+_0x14f5cf['lastevent'][_0xf312('0x7c')]()+']',JSON[_0xf312('0x23')](_0x1d32f4));});}; \ No newline at end of file +var _0x3990=['user:%s','trigger:browser:url','catch','outbound','recordingFormat','[OUTBOUND]','recordingURL','The\x20User\x20ID\x20is:','destcalleridname','Outbound','Ticket\x20created!','contacts','error','unmanaged','lastevent','toUpperCase','calleridname','The\x20Enduser\x20ID\x20is:','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','Descriptions','toISOString','slice','duration_hours','parent_id','Contacts','parent_name','name','forEach','push','idField','variableName','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','get_entry_list','stringify','Employees','user_name','entry_list','find','value','Agent\x20found!','name_value_list','resolve','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','merge','string','nameField','customField','content','toString','type','custom_fields','customVariable','Variable','toLowerCase','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x270e1a,_0x1fd11c){var _0x4c0683=function(_0x4b61e0){while(--_0x4b61e0){_0x270e1a['push'](_0x270e1a['shift']());}};_0x4c0683(++_0x1fd11c);}(_0x3990,0x162));var _0x0399=function(_0x44eeb9,_0x1a5603){_0x44eeb9=_0x44eeb9-0x0;var _0x38738f=_0x3990[_0x44eeb9];return _0x38738f;};'use strict';var _=require(_0x0399('0x0'));var rp=require(_0x0399('0x1'));var BPromise=require(_0x0399('0x2'));var md5=require(_0x0399('0x3'));var util=require('util');var Redis=require(_0x0399('0x4'));var intUtil=require(_0x0399('0x5'));var config=require(_0x0399('0x6'));var logger=require('../../../../config/logger')('sugarcrm');config[_0x0399('0x7')]=_[_0x0399('0x8')](config[_0x0399('0x7')],{'host':_0x0399('0x9'),'port':0x18eb});var io=require(_0x0399('0xa'))(new Redis(config[_0x0399('0x7')]));var def={'method':'POST','json':!![]};function emit(_0xd12399,_0x5073fc,_0x7db5df){io['to'](_0xd12399)[_0x0399('0xb')](_0x5073fc,_0x7db5df);}function getTicket(_0x87ab67,_0x1d3521,_0x3edc24,_0x118ef0,_0x1fbb8a,_0x135cd3,_0x2335fb,_0xa76653){logger[_0x0399('0xc')](_0x0399('0xd'));var _0x4f6509=new Date();var _0x1de6e2=[{'name':'name','value':intUtil[_0x0399('0xe')](_0x118ef0[_0x0399('0xf')],_0x1fbb8a,'\x20')},{'name':_0x0399('0x10'),'value':_0x1d3521['id']},{'name':_0x0399('0x11'),'value':_0x1d3521['id']},{'name':'description','value':intUtil[_0x0399('0xe')](_0x118ef0[_0x0399('0x12')],_0x1fbb8a,'\x0a')},{'name':'date_start','value':_0x4f6509[_0x0399('0x13')]()[_0x0399('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0x0399('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x0399('0x16'),'value':_0x3edc24['id']},{'name':'parent_type','value':_0x0399('0x17')},{'name':_0x0399('0x18'),'value':_0x3edc24[_0x0399('0x19')]},{'name':'direction','value':_0xa76653}];if(_0x135cd3['length']){_[_0x0399('0x1a')](_0x135cd3,function(_0x1d3d4c){if(_0x1fbb8a[_0x1d3d4c['variableName']]){_0x1de6e2[_0x0399('0x1b')]({'name':_0x1d3d4c[_0x0399('0x1c')],'value':_0x1fbb8a[_0x1d3d4c[_0x0399('0x1d')]]});}});}return request({'form':{'method':_0x0399('0x1e'),'input_type':_0x0399('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2335fb['id'],'module_name':_0x0399('0x20'),'name_value_list':_0x1de6e2})}});}function getAuth(_0x3ca1ff){return util[_0x0399('0x21')](_0x0399('0x22'),new Buffer(_0x3ca1ff[_0x0399('0x23')]+':X')['toString'](_0x0399('0x24')));}function getServerInfo(_0x516332){return request({'form':{'method':_0x0399('0x25'),'input_type':_0x0399('0x1f'),'response_type':_0x0399('0x1f'),'rest_data':JSON['stringify']({'session':_0x516332['id']})}});}function getUser(_0x35c231,_0x412aac,_0x36cab0){if(!_[_0x0399('0x26')](_0x412aac)){logger['info']('Getting\x20agent\x20with\x20name',_0x412aac);return request({'form':{'method':_0x0399('0x27'),'input_type':'JSON','response_type':_0x0399('0x1f'),'rest_data':JSON[_0x0399('0x28')]({'session':_0x36cab0['id'],'module_name':_0x0399('0x29'),'query':util[_0x0399('0x21')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x412aac),'order_by':'','offset':'0','select_fields':['id',_0x0399('0x19'),_0x0399('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5c4328){if(_0x5c4328[_0x0399('0x2b')]['length']){var _0x267f9f=_[_0x0399('0x2c')](_0x5c4328[_0x0399('0x2b')],function(_0x47414c){return _0x47414c['name_value_list']['user_name'][_0x0399('0x2d')]===_0x412aac;});if(_0x267f9f){logger[_0x0399('0xc')](_0x0399('0x2e'));return BPromise['resolve']({'id':_0x267f9f[_0x0399('0x2f')]['id'][_0x0399('0x2d')],'name':_0x267f9f[_0x0399('0x2f')]['name']['value']});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0399('0x30')]({'id':_0x36cab0['name_value_list'][_0x0399('0x31')]['value'],'name':_0x36cab0[_0x0399('0x2f')][_0x0399('0x2a')][_0x0399('0x2d')]});});}else{logger[_0x0399('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x36cab0[_0x0399('0x2f')]['user_id']['value'],'name':_0x36cab0[_0x0399('0x2f')][_0x0399('0x2a')][_0x0399('0x2d')]});}}function getEndUser(_0x180fa6,_0x3e8892,_0xd02fcc,_0x27d6ab){logger['info']('Searching\x20enduser\x20with\x20phone',_0xd02fcc);return request({'form':{'method':'get_entry_list','input_type':_0x0399('0x1f'),'response_type':_0x0399('0x1f'),'rest_data':JSON[_0x0399('0x28')]({'session':_0x27d6ab['id'],'module_name':_0x0399('0x17'),'query':util[_0x0399('0x21')](_0x0399('0x32'),_0xd02fcc),'order_by':'','offset':'0','select_fields':['id',_0x0399('0x19'),_0x0399('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0399('0x34')](function(_0x3838e2){if(_0x3838e2['entry_list'][_0x0399('0x35')]){var _0xbac506=_['find'](_0x3838e2['entry_list'],function(_0x59037b){return _0x59037b[_0x0399('0x2f')][_0x0399('0x33')][_0x0399('0x2d')]===_0xd02fcc;});if(_0xbac506){logger[_0x0399('0xc')]('Enduser\x20found!');return BPromise[_0x0399('0x30')]({'id':_0xbac506[_0x0399('0x2f')]['id'][_0x0399('0x2d')],'name':_0xbac506[_0x0399('0x2f')][_0x0399('0x19')]['value'],'phone':_0xbac506[_0x0399('0x2f')]['phone_home'][_0x0399('0x2d')]});}}else{logger[_0x0399('0xc')](_0x0399('0x36'));return request({'form':{'method':_0x0399('0x1e'),'input_type':_0x0399('0x1f'),'response_type':_0x0399('0x1f'),'rest_data':JSON[_0x0399('0x28')]({'session':_0x27d6ab['id'],'module_name':'Contacts','name_value_list':[{'name':_0x0399('0x37'),'value':_0x3e8892!==_0x0399('0x38')?_0x3e8892:util[_0x0399('0x21')](_0x0399('0x39'),_0xd02fcc)},{'name':'phone_home','value':_0xd02fcc}]})}})[_0x0399('0x34')](function(_0xa0462b){logger[_0x0399('0xc')](_0x0399('0x3a'));return BPromise['resolve']({'id':_0xa0462b['id'],'name':_0xa0462b[_0x0399('0x2b')][_0x0399('0x37')]['value'],'phone':_0xa0462b[_0x0399('0x2b')][_0x0399('0x33')][_0x0399('0x2d')]});});}});}function request(_0x2f7a60){logger['debug']('[HTTP]',JSON[_0x0399('0x28')](_0x2f7a60));return rp(_[_0x0399('0x3b')](def,_0x2f7a60));}function getTags(_0x1ccf91,_0x598a1c){var _0x52aafd=[];if(_0x1ccf91&&_0x1ccf91[_0x0399('0x35')]>0x0){_0x52aafd=_['map'](_0x1ccf91,_0x598a1c);}return _0x52aafd;}function getCustomFields(_0x2f70e5,_0x4b404e){var _0x48c2ba=[];var _0x1d74aa={'custom_fields':[]};if(_0x2f70e5['length']>0x0){_[_0x0399('0x1a')](_0x2f70e5,function(_0x56fc87){if(_0x56fc87['type']===_0x0399('0x3c')&&_0x56fc87[_0x0399('0x3d')]&&!_0x56fc87[_0x0399('0x3e')]){_0x1d74aa[_0x56fc87[_0x0399('0x3d')]['toLowerCase']()]=_0x56fc87[_0x0399('0x3f')][_0x0399('0x40')]();}else if(_0x56fc87[_0x0399('0x41')]===_0x0399('0x3c')&&_0x56fc87[_0x0399('0x1c')]&&_0x56fc87[_0x0399('0x3e')]){_0x1d74aa[_0x0399('0x42')][_0x0399('0x1b')]({'id':_0x56fc87[_0x0399('0x1c')],'value':_0x56fc87['content']['toString']()});}else if(_0x56fc87[_0x0399('0x41')]==='variable'&&_0x56fc87[_0x0399('0x1d')]&&_0x56fc87['idField']&&_0x56fc87[_0x0399('0x3e')]){_0x4b404e[_0x56fc87['variableName']]&&_0x1d74aa[_0x0399('0x42')][_0x0399('0x1b')]({'id':_0x56fc87[_0x0399('0x1c')],'value':_0x4b404e[_0x56fc87[_0x0399('0x1d')]][_0x0399('0x40')]()});}else if(_0x56fc87[_0x0399('0x41')]===_0x0399('0x43')&&_0x56fc87[_0x0399('0x44')]&&_0x56fc87[_0x0399('0x44')][_0x0399('0x19')]&&_0x56fc87[_0x0399('0x1c')]&&_0x56fc87[_0x0399('0x3e')]){_0x4b404e[_0x56fc87[_0x0399('0x44')][_0x0399('0x19')][_0x0399('0x45')]()]&&_0x1d74aa[_0x0399('0x42')]['push']({'id':_0x56fc87[_0x0399('0x1c')],'value':_0x4b404e[_0x56fc87['Variable'][_0x0399('0x19')][_0x0399('0x45')]()]['toString']()});}});}return _0x1d74aa;}function getConnection(_0x4c567c){return request({'method':'POST','form':{'method':'login','input_type':'JSON','response_type':_0x0399('0x1f'),'rest_data':JSON[_0x0399('0x28')]({'user_auth':{'user_name':_0x4c567c['username'],'password':_0x4c567c[_0x0399('0x46')],'encryption':_0x0399('0x47')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x0399('0x34')](function(_0x5973f3){var _0x4d5265=_0x5973f3;if(_0x4d5265['id']){def[_0x0399('0x48')]=_0x4d5265['id'];return BPromise['resolve'](_0x4d5265);}else{throw new Error(util[_0x0399('0x21')](_0x0399('0x49'),_0x4c567c['id']));}});}function setRelationship(_0x571f32,_0x496609,_0x483ee6,_0x31b0b6){return request({'form':{'method':'set_relationship','input_type':_0x0399('0x1f'),'response_type':_0x0399('0x1f'),'rest_data':JSON[_0x0399('0x28')]({'session':_0x571f32['id'],'module_name':_0x0399('0x20'),'module_id':_0x483ee6['id'],'link_field_name':_0x31b0b6,'related_ids':[_0x496609['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0399('0x4a')]=function(_0x8a5d06,_0x29994d,_0x49da1f,_0x4ff150,_0x32dff7,_0x2cb670){var _0x5613cf,_0x1ee294,_0x39076a,_0x5778be;_0x2cb670[_0x0399('0x4b')]=intUtil[_0x0399('0x4c')](_0x2cb670['remoteUri']);_0x2cb670[_0x0399('0x4d')]=intUtil[_0x0399('0x4c')](_0x2cb670[_0x0399('0x4d')]);def[_0x0399('0x4e')]=util[_0x0399('0x21')](_0x0399('0x4f'),_0x2cb670['remoteUri']);if(_0x32dff7&&_0x32dff7[_0x0399('0x50')]){logger[_0x0399('0xc')]('[QUEUE]',_0x0399('0x51'));_0x29994d['recordingURL']=util[_0x0399('0x21')](_0x0399('0x52'),_0x2cb670[_0x0399('0x4d')],_0x29994d[_0x0399('0x53')],md5(_0x29994d[_0x0399('0x53')]));}else{_0x29994d['recordingURL']='';}return getConnection(_0x2cb670)[_0x0399('0x34')](function(_0x20a9ee){_0x5778be=_0x20a9ee;return getUser(_0x2cb670,_0x4ff150[_0x0399('0x19')],_0x5778be);})[_0x0399('0x34')](function(_0x5b8c0a){_0x5613cf=_0x5b8c0a;logger[_0x0399('0xc')]('The\x20User\x20ID\x20is:',_0x5613cf['id']);return getEndUser(_0x2cb670,_0x29994d['calleridname'],_0x29994d[_0x0399('0x54')],_0x5778be);})[_0x0399('0x34')](function(_0x4fc3f9){_0x1ee294=_0x4fc3f9;logger[_0x0399('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1ee294['id']);return getTicket(_0x2cb670,_0x5613cf,_0x1ee294,_0x49da1f,_0x29994d,_0x49da1f[_0x0399('0x55')],_0x5778be,'Inbound');})[_0x0399('0x34')](function(_0x45cb4b){_0x39076a=_0x45cb4b;logger[_0x0399('0xc')]('Ticket\x20created!');logger[_0x0399('0xc')](_0x0399('0x56'),_0x39076a['id']);return setRelationship(_0x5778be,_0x5613cf,_0x39076a,_0x0399('0x57'));})[_0x0399('0x34')](function(){return setRelationship(_0x5778be,_0x1ee294,_0x39076a,'contacts');})[_0x0399('0x34')](function(){return getServerInfo(_0x5778be);})['then'](function(_0x4c489e){var _0x4825ce=parseInt(_0x4c489e[_0x0399('0x58')][_0x0399('0x59')](0x0));var _0x13b1f2=util[_0x0399('0x21')](_0x0399('0x5a'),_0x2cb670[_0x0399('0x4b')],_0x39076a['id']);if(_0x4825ce>0x6){_0x13b1f2=util[_0x0399('0x21')](_0x0399('0x5b'),_0x2cb670[_0x0399('0x4b')],_0x39076a['id']);}logger['info'](_0x0399('0x5c'),_0x0399('0x5d'));emit(util[_0x0399('0x21')](_0x0399('0x5e'),_0x4ff150[_0x0399('0x19')]),_0x0399('0x5f'),{'uri':_0x13b1f2});})[_0x0399('0x60')](function(_0x598fbc){logger['error'](_0x0399('0x5c'),JSON[_0x0399('0x28')](_0x598fbc));});};exports[_0x0399('0x61')]=function(_0x3cabce,_0x3051e6,_0x18c049,_0x14d9ee,_0x1b871f,_0xb8df98,_0x352ac7){var _0x528f77,_0x565c46,_0x59552d,_0x36b798;_0xb8df98[_0x0399('0x4b')]=intUtil[_0x0399('0x4c')](_0xb8df98['remoteUri']);_0xb8df98[_0x0399('0x4d')]=intUtil[_0x0399('0x4c')](_0xb8df98[_0x0399('0x4d')]);def[_0x0399('0x4e')]=util['format']('%s/service/v4_1/rest.php',_0xb8df98[_0x0399('0x4b')]);if(_0x352ac7&&_0x352ac7[_0x0399('0x62')]&&_0x352ac7['recordingFormat']!=='none'){logger[_0x0399('0xc')](_0x0399('0x63'),_0x0399('0x51'));_0x3051e6[_0x0399('0x64')]=util[_0x0399('0x21')](_0x0399('0x52'),_0xb8df98['serverUrl'],_0x3051e6[_0x0399('0x53')],md5(_0x3051e6[_0x0399('0x53')]));}return getConnection(_0xb8df98)[_0x0399('0x34')](function(_0x19ce7c){_0x36b798=_0x19ce7c;return getUser(_0xb8df98,_0x14d9ee[_0x0399('0x19')],_0x36b798);})['then'](function(_0x319282){_0x528f77=_0x319282;logger[_0x0399('0xc')](_0x0399('0x65'),_0x528f77['id']);return getEndUser(_0xb8df98,_0x3051e6[_0x0399('0x66')],_0x3051e6['destcalleridnum'],_0x36b798);})[_0x0399('0x34')](function(_0x5b25e3){_0x565c46=_0x5b25e3;logger[_0x0399('0xc')]('The\x20Enduser\x20ID\x20is:',_0x565c46['id']);return getTicket(_0xb8df98,_0x528f77,_0x565c46,_0x18c049,_0x3051e6,_0x18c049['Fields'],_0x36b798,_0x0399('0x67'));})[_0x0399('0x34')](function(_0x171438){_0x59552d=_0x171438;logger[_0x0399('0xc')](_0x0399('0x68'));logger[_0x0399('0xc')](_0x0399('0x56'),_0x59552d['id']);return setRelationship(_0x36b798,_0x528f77,_0x59552d,_0x0399('0x57'));})[_0x0399('0x34')](function(){return setRelationship(_0x36b798,_0x565c46,_0x59552d,_0x0399('0x69'));})[_0x0399('0x34')](function(){return getServerInfo(_0x36b798);})[_0x0399('0x34')](function(_0x51b509){var _0x5df119=parseInt(_0x51b509['version'][_0x0399('0x59')](0x0));var _0x45622b=util['format'](_0x0399('0x5a'),_0xb8df98[_0x0399('0x4b')],_0x59552d['id']);if(_0x5df119>0x6){_0x45622b=util['format'](_0x0399('0x5b'),_0xb8df98[_0x0399('0x4b')],_0x59552d['id']);}logger[_0x0399('0xc')]('[OUTBOUND]',_0x0399('0x5d'));emit(util['format'](_0x0399('0x5e'),_0x14d9ee['name']),'trigger:browser:url',{'uri':_0x45622b});})[_0x0399('0x60')](function(_0x551fb0){logger[_0x0399('0x6a')](_0x0399('0x63'),JSON['stringify'](_0x551fb0));});};exports[_0x0399('0x6b')]=function(_0x15d3a6,_0x521a6c,_0x49f7b1,_0x29ed64,_0x122ac7,_0x2d8340){var _0x5c4c83,_0x5919ac,_0x34e32b,_0x142a7d;_0x2d8340['remoteUri']=intUtil['stripTrailingSlash'](_0x2d8340[_0x0399('0x4b')]);_0x2d8340[_0x0399('0x4d')]=intUtil[_0x0399('0x4c')](_0x2d8340[_0x0399('0x4d')]);def[_0x0399('0x4e')]=util['format'](_0x0399('0x4f'),_0x2d8340[_0x0399('0x4b')]);if(_0x122ac7&&_0x122ac7['monitor_format']){logger[_0x0399('0xc')]('['+_0x521a6c[_0x0399('0x6c')][_0x0399('0x6d')]()+']',_0x0399('0x51'));_0x521a6c[_0x0399('0x64')]=util[_0x0399('0x21')](_0x0399('0x52'),_0x2d8340['serverUrl'],_0x521a6c[_0x0399('0x53')],md5(_0x521a6c['uniqueid']));}else{_0x521a6c[_0x0399('0x64')]='';}return getConnection(_0x2d8340)[_0x0399('0x34')](function(_0x1e3c46){_0x142a7d=_0x1e3c46;if(!_[_0x0399('0x26')](_0x29ed64)){return getUser(_0x2d8340,_0x29ed64['name'],_0x142a7d);}else{return getUser(_0x2d8340,null,_0x142a7d);}})[_0x0399('0x34')](function(_0x548f6d){_0x5c4c83=_0x548f6d;logger[_0x0399('0xc')]('The\x20User\x20ID\x20is:',_0x5c4c83['id']);return getEndUser(_0x2d8340,_0x521a6c[_0x0399('0x6e')],_0x521a6c[_0x0399('0x54')],_0x142a7d);})[_0x0399('0x34')](function(_0x30bdbc){_0x5919ac=_0x30bdbc;logger[_0x0399('0xc')](_0x0399('0x6f'),_0x5919ac['id']);return getTicket(_0x2d8340,_0x5c4c83,_0x5919ac,_0x49f7b1,_0x521a6c,_0x49f7b1['Fields'],_0x142a7d,'Inbound');})[_0x0399('0x34')](function(_0x25345c){_0x34e32b=_0x25345c;logger[_0x0399('0xc')](_0x0399('0x68'));logger[_0x0399('0xc')](_0x0399('0x56'),_0x34e32b['id']);return setRelationship(_0x142a7d,_0x5c4c83,_0x34e32b,_0x0399('0x57'));})[_0x0399('0x34')](function(){return setRelationship(_0x142a7d,_0x5919ac,_0x34e32b,_0x0399('0x69'));})[_0x0399('0x34')](function(){return getServerInfo(_0x142a7d);})[_0x0399('0x60')](function(_0xa72abd){logger[_0x0399('0x6a')]('['+_0x521a6c[_0x0399('0x6c')][_0x0399('0x6d')]()+']',JSON[_0x0399('0x28')](_0xa72abd));});}; \ 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 7815897..619e2e9 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 _0xcb45=['length','sortBy','type','string','push','variableName','toString','customVariable','name','Variable','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','slice','lastIndexOf','isNil','lodash','util','getString'];(function(_0x58ffb3,_0x5b67aa){var _0x4d8ddd=function(_0x240ca8){while(--_0x240ca8){_0x58ffb3['push'](_0x58ffb3['shift']());}};_0x4d8ddd(++_0x5b67aa);}(_0xcb45,0x195));var _0x5cb4=function(_0x51c1cf,_0x362cdc){_0x51c1cf=_0x51c1cf-0x0;var _0x198c72=_0xcb45[_0x51c1cf];return _0x198c72;};'use strict';var _=require(_0x5cb4('0x0'));var util=require(_0x5cb4('0x1'));exports[_0x5cb4('0x2')]=function(_0x53bdfa,_0x79fec5,_0x34ddc7){var _0x2e1436=[];if(_0x53bdfa[_0x5cb4('0x3')]>0x0){var _0x160b62=_[_0x5cb4('0x4')](_0x53bdfa,['id']);for(var _0x13641d=0x0;_0x13641d<_0x160b62[_0x5cb4('0x3')];_0x13641d++){var _0x8308b5=_0x160b62[_0x13641d];if(_0x8308b5[_0x5cb4('0x5')]===_0x5cb4('0x6')){_0x2e1436[_0x5cb4('0x7')](_0x8308b5['content']);}else if(_0x8308b5['type']==='variable'&&_0x8308b5[_0x5cb4('0x8')]){_0x79fec5[_0x8308b5[_0x5cb4('0x8')]]&&_0x2e1436['push'](_0x79fec5[_0x8308b5[_0x5cb4('0x8')]][_0x5cb4('0x9')]());}else if(_0x8308b5[_0x5cb4('0x5')]===_0x5cb4('0xa')&&_0x8308b5['Variable']&&_0x8308b5['Variable'][_0x5cb4('0xb')]){_0x79fec5[_0x8308b5[_0x5cb4('0xc')][_0x5cb4('0xb')][_0x5cb4('0xd')]()]&&_0x2e1436[_0x5cb4('0x7')](_0x79fec5[_0x8308b5[_0x5cb4('0xc')][_0x5cb4('0xb')][_0x5cb4('0xd')]()][_0x5cb4('0x9')]());}else if(_0x8308b5['type']===_0x5cb4('0xe')){if(_0x8308b5[_0x5cb4('0xf')]===_0x5cb4('0x6')&&_0x8308b5[_0x5cb4('0x10')]){_0x2e1436[_0x5cb4('0x7')](util[_0x5cb4('0x11')](_0x5cb4('0x12'),_0x8308b5['key'],_0x8308b5['keyContent']));}else if(_0x8308b5[_0x5cb4('0xf')]==='variable'&&_0x8308b5['variableName']&&_0x8308b5[_0x5cb4('0x10')]){_0x79fec5[_0x8308b5['variableName']]&&_0x2e1436[_0x5cb4('0x7')](util[_0x5cb4('0x11')](_0x5cb4('0x12'),_0x8308b5[_0x5cb4('0x10')],_0x79fec5[_0x8308b5[_0x5cb4('0x8')]]));}else if(_0x8308b5[_0x5cb4('0xf')]==='customVariable'&&_0x8308b5[_0x5cb4('0xc')]&&_0x8308b5[_0x5cb4('0xc')]['name']&&_0x8308b5[_0x5cb4('0x10')]){_0x79fec5[_0x8308b5['Variable'][_0x5cb4('0xb')][_0x5cb4('0xd')]()]&&_0x2e1436[_0x5cb4('0x7')](util['format']('%s:\x20%s',_0x8308b5['key'],_0x79fec5[_0x8308b5[_0x5cb4('0xc')]['name'][_0x5cb4('0xd')]()]));}}}}return _0x2e1436[_0x5cb4('0x13')](_0x34ddc7);};exports[_0x5cb4('0x14')]=function(_0x1c4267){var _0x2251ce=_0x1c4267[_0x5cb4('0x15')](-0x1);if(_0x2251ce==='/'){_0x1c4267=_0x1c4267['substring'](0x0,_0x1c4267[_0x5cb4('0x16')](_0x2251ce));}return _0x1c4267;};exports['validateEmail']=function(_0x31a68c){if(!_[_0x5cb4('0x17')](_0x31a68c)&&_0x31a68c!==''){var _0x3fb4f6=/^(([^<>()\[\]\\.,;:\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 _0x3fb4f6['test'](String(_0x31a68c)[_0x5cb4('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x79be=['type','string','push','content','variable','toString','customVariable','name','Variable','toLowerCase','keyType','format','%s:\x20%s','key','keyContent','variableName','join','stripTrailingSlash','slice','substring','validateEmail','lodash','util','length','sortBy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x79be,0x1a5));var _0xe79b=function(_0x3aab98,_0x19112a){_0x3aab98=_0x3aab98-0x0;var _0x5b0b06=_0x79be[_0x3aab98];return _0x5b0b06;};'use strict';var _=require(_0xe79b('0x0'));var util=require(_0xe79b('0x1'));exports['getString']=function(_0x33b8fd,_0x175908,_0x348543){var _0x1c5ba6=[];if(_0x33b8fd[_0xe79b('0x2')]>0x0){var _0x242cd5=_[_0xe79b('0x3')](_0x33b8fd,['id']);for(var _0xb6a047=0x0;_0xb6a047<_0x242cd5['length'];_0xb6a047++){var _0x499933=_0x242cd5[_0xb6a047];if(_0x499933[_0xe79b('0x4')]===_0xe79b('0x5')){_0x1c5ba6[_0xe79b('0x6')](_0x499933[_0xe79b('0x7')]);}else if(_0x499933[_0xe79b('0x4')]===_0xe79b('0x8')&&_0x499933['variableName']){_0x175908[_0x499933['variableName']]&&_0x1c5ba6[_0xe79b('0x6')](_0x175908[_0x499933['variableName']][_0xe79b('0x9')]());}else if(_0x499933[_0xe79b('0x4')]===_0xe79b('0xa')&&_0x499933['Variable']&&_0x499933['Variable'][_0xe79b('0xb')]){_0x175908[_0x499933[_0xe79b('0xc')][_0xe79b('0xb')][_0xe79b('0xd')]()]&&_0x1c5ba6[_0xe79b('0x6')](_0x175908[_0x499933[_0xe79b('0xc')][_0xe79b('0xb')]['toLowerCase']()][_0xe79b('0x9')]());}else if(_0x499933[_0xe79b('0x4')]==='keyValue'){if(_0x499933[_0xe79b('0xe')]===_0xe79b('0x5')&&_0x499933['key']){_0x1c5ba6['push'](util[_0xe79b('0xf')](_0xe79b('0x10'),_0x499933[_0xe79b('0x11')],_0x499933[_0xe79b('0x12')]));}else if(_0x499933['keyType']===_0xe79b('0x8')&&_0x499933[_0xe79b('0x13')]&&_0x499933['key']){_0x175908[_0x499933[_0xe79b('0x13')]]&&_0x1c5ba6[_0xe79b('0x6')](util[_0xe79b('0xf')]('%s:\x20%s',_0x499933['key'],_0x175908[_0x499933[_0xe79b('0x13')]]));}else if(_0x499933[_0xe79b('0xe')]===_0xe79b('0xa')&&_0x499933[_0xe79b('0xc')]&&_0x499933['Variable'][_0xe79b('0xb')]&&_0x499933[_0xe79b('0x11')]){_0x175908[_0x499933['Variable'][_0xe79b('0xb')][_0xe79b('0xd')]()]&&_0x1c5ba6[_0xe79b('0x6')](util['format'](_0xe79b('0x10'),_0x499933['key'],_0x175908[_0x499933[_0xe79b('0xc')]['name'][_0xe79b('0xd')]()]));}}}}return _0x1c5ba6[_0xe79b('0x14')](_0x348543);};exports[_0xe79b('0x15')]=function(_0x78c2d1){var _0x4ba88d=_0x78c2d1[_0xe79b('0x16')](-0x1);if(_0x4ba88d==='/'){_0x78c2d1=_0x78c2d1[_0xe79b('0x17')](0x0,_0x78c2d1['lastIndexOf'](_0x4ba88d));}return _0x78c2d1;};exports[_0xe79b('0x18')]=function(_0x4e67d2){if(!_['isNil'](_0x4e67d2)&&_0x4e67d2!==''){var _0xd64caa=/^(([^<>()\[\]\\.,;:\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 _0xd64caa['test'](String(_0x4e67d2)['toLowerCase']());}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 d937216..4689039 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0xf50bbe,_0x5dbff9){var _0x444a77=function(_0x1a3a4c){while(--_0x1a3a4c){_0xf50bbe['push'](_0xf50bbe['shift']());}};_0x444a77(++_0x5dbff9);}(_0x34e8,0x12c));var _0x834e=function(_0x8f9c17,_0x3ca1fa){_0x8f9c17=_0x8f9c17-0x0;var _0x1356cc=_0x34e8[_0x8f9c17];return _0x1356cc;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _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(_0x23e4c6,_0x548b3e){var _0x4aaee0=function(_0x19f8f4){while(--_0x19f8f4){_0x23e4c6['push'](_0x23e4c6['shift']());}};_0x4aaee0(++_0x548b3e);}(_0xe706,0xa3));var _0x6e70=function(_0x252550,_0x1ffe4d){_0x252550=_0x252550-0x0;var _0x352629=_0xe706[_0x252550];return _0x352629;};'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 ff79bf1..8162c55 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 _0xc108=['./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%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','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','toString','base64','debug','[HTTP]','stringify','GET','length','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','push','idField','variable','variableName','Variable','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Authorization','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','Recording\x20is\x20enabled!','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc108,0x6e));var _0x8c10=function(_0x175fb4,_0x405edc){_0x175fb4=_0x175fb4-0x0;var _0x20e6f9=_0xc108[_0x175fb4];return _0x20e6f9;};'use strict';var _=require(_0x8c10('0x0'));var rp=require(_0x8c10('0x1'));var md5=require(_0x8c10('0x2'));var util=require(_0x8c10('0x3'));var Redis=require(_0x8c10('0x4'));var intUtil=require(_0x8c10('0x5'));var config=require(_0x8c10('0x6'));var logger=require(_0x8c10('0x7'))(_0x8c10('0x8'));config[_0x8c10('0x9')]=_[_0x8c10('0xa')](config[_0x8c10('0x9')],{'host':_0x8c10('0xb'),'port':0x18eb});var io=require(_0x8c10('0xc'))(new Redis(config[_0x8c10('0x9')]));function emit(_0x28d009,_0x2fe3bb,_0x219a0c){io['to'](_0x28d009)[_0x8c10('0xd')](_0x2fe3bb,_0x219a0c);}var headers={'Content-Type':_0x8c10('0xe'),'Accept':'application/json'};function getTicket(_0x43534b,_0x17a2af,_0x5d2af2,_0x321eff,_0x3d0b9f){logger[_0x8c10('0xf')](_0x8c10('0x10'));return request({'uri':util['format'](_0x8c10('0x11'),_0x43534b[_0x8c10('0x12')]),'method':_0x8c10('0x13'),'body':{'ticket':_[_0x8c10('0x14')]({'requester_id':_0x5d2af2['id'],'submitter_id':_0x17a2af?_0x17a2af['id']:undefined,'assignee_id':_0x17a2af?_0x17a2af['id']:undefined,'tags':getTags(_0x321eff[_0x8c10('0x15')],_0x8c10('0x16')),'subject':intUtil[_0x8c10('0x17')](_0x321eff[_0x8c10('0x18')],_0x3d0b9f,'\x20'),'description':intUtil[_0x8c10('0x17')](_0x321eff[_0x8c10('0x19')],_0x3d0b9f,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8c10('0x17')](_0x321eff['Descriptions'],_0x3d0b9f,'\x0a')}},getCustomFields(_0x321eff['Fields'],_0x3d0b9f))}})[_0x8c10('0x1a')](function(_0x353724){logger[_0x8c10('0xf')](_0x8c10('0x1b'));return _0x353724[_0x8c10('0x1c')];});}function getUser(_0x38df27,_0x1fffd6){if(intUtil['validateEmail'](_0x1fffd6)){logger[_0x8c10('0xf')](_0x8c10('0x1d'),_0x1fffd6);return request({'uri':util[_0x8c10('0x1e')](_0x8c10('0x1f'),_0x38df27[_0x8c10('0x12')]),'qs':{'query':util[_0x8c10('0x1e')](_0x8c10('0x20'),_0x1fffd6)}})['then'](function(_0x32a303){if(_0x32a303[_0x8c10('0x21')]){logger['info'](_0x8c10('0x22'));return _[_0x8c10('0x23')](_0x32a303[_0x8c10('0x24')],{'email':_0x1fffd6,'role':_0x8c10('0x25')});}else{logger[_0x8c10('0xf')](_0x8c10('0x26'));return request({'uri':util[_0x8c10('0x1e')](_0x8c10('0x27'),_0x38df27[_0x8c10('0x12')])})[_0x8c10('0x1a')](function(_0x154bff){logger[_0x8c10('0xf')](_0x8c10('0x28'));return _0x154bff[_0x8c10('0x29')];});}});}else{logger['info'](_0x8c10('0x26'));return request({'uri':util[_0x8c10('0x1e')](_0x8c10('0x27'),_0x38df27[_0x8c10('0x12')])})[_0x8c10('0x1a')](function(_0x18d65f){logger[_0x8c10('0xf')](_0x8c10('0x28'));return _0x18d65f[_0x8c10('0x29')];});}}function getEndUser(_0x41fb08,_0x55b36e,_0x1937df){logger['info'](_0x8c10('0x2a'),_0x1937df);return request({'uri':util['format'](_0x8c10('0x1f'),_0x41fb08[_0x8c10('0x12')]),'qs':{'query':util[_0x8c10('0x1e')]('type:user\x20role:end-user\x20phone:%s',_0x1937df)}})['then'](function(_0x1f2412){var _0x3edad4;if(_0x1f2412['results']['length']){_0x1f2412[_0x8c10('0x24')]=_['filter'](_0x1f2412[_0x8c10('0x24')],{'suspended':![],'role':'end-user'});if(_0x1f2412[_0x8c10('0x24')]['length']){_0x3edad4=_['first'](_0x1f2412[_0x8c10('0x24')]);}}if(_0x3edad4){logger[_0x8c10('0xf')]('Enduser\x20found!');return _0x3edad4;}else{logger[_0x8c10('0xf')](_0x8c10('0x2b'));return request({'uri':util[_0x8c10('0x1e')](_0x8c10('0x2c'),_0x41fb08[_0x8c10('0x12')]),'method':_0x8c10('0x13'),'body':{'user':{'role':_0x8c10('0x2d'),'name':util['format'](_0x8c10('0x2e'),_0x55b36e||_0x1937df),'phone':_0x1937df}}})[_0x8c10('0x1a')](function(_0x3ca466){logger[_0x8c10('0xf')](_0x8c10('0x2f'));return _0x3ca466[_0x8c10('0x29')];});}});}function getAuth(_0x2e6ef3){var _0x2e131c;if(_0x2e6ef3[_0x8c10('0x30')]===_0x8c10('0x31')){_0x2e131c=util[_0x8c10('0x1e')](_0x8c10('0x32'),_0x2e6ef3['username'],_0x2e6ef3['password']);}else if(_0x2e6ef3[_0x8c10('0x30')]===_0x8c10('0x33')){_0x2e131c=util[_0x8c10('0x1e')](_0x8c10('0x34'),_0x2e6ef3[_0x8c10('0x35')],_0x2e6ef3['token']);}return util[_0x8c10('0x1e')]('Basic\x20%s',new Buffer(_0x2e131c)[_0x8c10('0x36')](_0x8c10('0x37')));}function request(_0x4e4fd1){logger[_0x8c10('0x38')](_0x8c10('0x39'),JSON[_0x8c10('0x3a')](_0x4e4fd1));return rp(_[_0x8c10('0xa')](_0x4e4fd1,{'method':_0x8c10('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x48fcb4,_0x2cc3e4){var _0x3a8c3e=[];if(_0x48fcb4&&_0x48fcb4[_0x8c10('0x3c')]>0x0){_0x3a8c3e=_[_0x8c10('0x3d')](_0x48fcb4,_0x2cc3e4);}return _0x3a8c3e;}function getCustomFields(_0x55deb7,_0x409455){var _0x18336f=[];var _0x320ed6={'custom_fields':[]};if(_0x55deb7['length']>0x0){_['forEach'](_0x55deb7,function(_0xc526f8){if(_[_0x8c10('0x3e')]([_0x8c10('0x3f'),_0x8c10('0x40')],_0xc526f8[_0x8c10('0x41')])&&_0xc526f8[_0x8c10('0x42')]&&!_0xc526f8[_0x8c10('0x43')]){_0x320ed6[_0xc526f8[_0x8c10('0x42')][_0x8c10('0x44')]()]=_0xc526f8[_0x8c10('0x45')][_0x8c10('0x36')]();}else if(_['includes']([_0x8c10('0x3f'),_0x8c10('0x40')],_0xc526f8[_0x8c10('0x41')])&&_0xc526f8['idField']&&_0xc526f8['customField']){_0x320ed6[_0x8c10('0x46')][_0x8c10('0x47')]({'id':_0xc526f8[_0x8c10('0x48')],'value':_0xc526f8['content'][_0x8c10('0x36')]()});}else if(_0xc526f8['type']===_0x8c10('0x49')&&_0xc526f8[_0x8c10('0x4a')]&&_0xc526f8[_0x8c10('0x48')]&&_0xc526f8[_0x8c10('0x43')]){_0x409455[_0xc526f8['variableName']]&&_0x320ed6[_0x8c10('0x46')][_0x8c10('0x47')]({'id':_0xc526f8[_0x8c10('0x48')],'value':_0x409455[_0xc526f8['variableName']][_0x8c10('0x36')]()});}else if(_0xc526f8[_0x8c10('0x41')]==='customVariable'&&_0xc526f8[_0x8c10('0x4b')]&&_0xc526f8[_0x8c10('0x4b')]['name']&&_0xc526f8[_0x8c10('0x48')]&&_0xc526f8[_0x8c10('0x43')]){_0x409455[_0xc526f8[_0x8c10('0x4b')]['name'][_0x8c10('0x44')]()]&&_0x320ed6[_0x8c10('0x46')][_0x8c10('0x47')]({'id':_0xc526f8[_0x8c10('0x48')],'value':_0x409455[_0xc526f8['Variable'][_0x8c10('0x16')][_0x8c10('0x44')]()]['toString']()});}});}return _0x320ed6;}exports['queue']=function(_0x11762a,_0x1b5cc5,_0x2eec93,_0x381118,_0x1a6975,_0x94fdfb){var _0x171327,_0x2d8253;_0x94fdfb['remoteUri']=intUtil[_0x8c10('0x4c')](_0x94fdfb['remoteUri']);_0x94fdfb[_0x8c10('0x4d')]=intUtil['stripTrailingSlash'](_0x94fdfb[_0x8c10('0x4d')]);if(_0x1a6975&&_0x1a6975['monitor_format']){logger['info'](_0x8c10('0x4e'),'Recording\x20is\x20enabled!');_0x1b5cc5[_0x8c10('0x4f')]=util[_0x8c10('0x1e')](_0x8c10('0x50'),_0x94fdfb[_0x8c10('0x4d')],_0x1b5cc5[_0x8c10('0x51')],md5(_0x1b5cc5['uniqueid']));}else{_0x1b5cc5[_0x8c10('0x4f')]='';}headers['Authorization']=getAuth(_0x94fdfb);return getUser(_0x94fdfb,_0x381118[_0x8c10('0x52')])[_0x8c10('0x1a')](function(_0x2aec15){_0x171327=_0x2aec15;logger['info'](_0x8c10('0x53'),_0x171327['id']);return getEndUser(_0x94fdfb,_0x1b5cc5[_0x8c10('0x54')],_0x1b5cc5[_0x8c10('0x55')]);})[_0x8c10('0x1a')](function(_0x95c6e3){_0x2d8253=_0x95c6e3;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2d8253['id']);return getTicket(_0x94fdfb,_0x171327,_0x2d8253,_0x2eec93,_0x1b5cc5);})[_0x8c10('0x1a')](function(_0x5f57e8){if(_0x5f57e8){logger['info'](_0x8c10('0x56'),_0x5f57e8['id']);switch(_0x94fdfb['type']){case _0x8c10('0x57'):logger[_0x8c10('0xf')]('[QUEUE]',_0x8c10('0x58'));return request({'uri':util[_0x8c10('0x1e')](_0x8c10('0x59'),_0x94fdfb[_0x8c10('0x12')],_0x171327['id'],_0x5f57e8['id']),'method':_0x8c10('0x13')});case _0x8c10('0x5a'):logger[_0x8c10('0xf')](_0x8c10('0x4e'),_0x8c10('0x5b'));emit(util[_0x8c10('0x1e')](_0x8c10('0x5c'),_0x381118['name']),_0x8c10('0x5d'),{'uri':util['format'](_0x8c10('0x5e'),_0x94fdfb[_0x8c10('0x12')]['replace'](_0x8c10('0x5f'),''),_0x5f57e8['id'])});break;default:logger['error'](_0x8c10('0x4e'),_0x8c10('0x60'));}}})[_0x8c10('0x61')](function(_0x50b8fc){logger[_0x8c10('0x62')](_0x8c10('0x63'),util[_0x8c10('0x64')](_0x50b8fc,{'showHidden':!![],'depth':null}));});};exports[_0x8c10('0x65')]=function(_0xf13676,_0x5e8e5d,_0x4be6ea,_0x49ca12,_0x2f815c,_0x38cf3c,_0x4c34ae){var _0x405c41,_0x2d6c4b;_0x38cf3c[_0x8c10('0x12')]=intUtil['stripTrailingSlash'](_0x38cf3c[_0x8c10('0x12')]);_0x38cf3c['serverUrl']=intUtil[_0x8c10('0x4c')](_0x38cf3c['serverUrl']);if(_0x4c34ae&&_0x4c34ae[_0x8c10('0x66')]&&_0x4c34ae[_0x8c10('0x66')]!==_0x8c10('0x67')){logger[_0x8c10('0xf')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5e8e5d[_0x8c10('0x4f')]=util[_0x8c10('0x1e')](_0x8c10('0x50'),_0x38cf3c[_0x8c10('0x4d')],_0x5e8e5d[_0x8c10('0x51')],md5(_0x5e8e5d['uniqueid']));}headers[_0x8c10('0x68')]=getAuth(_0x38cf3c);return getUser(_0x38cf3c,_0x49ca12[_0x8c10('0x52')])[_0x8c10('0x1a')](function(_0xe8f033){_0x405c41=_0xe8f033;logger[_0x8c10('0xf')](_0x8c10('0x53'),_0x405c41['id']);return getEndUser(_0x38cf3c,_0x5e8e5d['destcalleridname'],_0x5e8e5d[_0x8c10('0x69')]);})[_0x8c10('0x1a')](function(_0x4d7e53){_0x2d6c4b=_0x4d7e53;logger['info'](_0x8c10('0x6a'),_0x2d6c4b['id']);return getTicket(_0x38cf3c,_0x405c41,_0x2d6c4b,_0x4be6ea,_0x5e8e5d);})[_0x8c10('0x1a')](function(_0x3fcb35){if(_0x3fcb35){logger[_0x8c10('0xf')](_0x8c10('0x56'),_0x3fcb35['id']);switch(_0x38cf3c[_0x8c10('0x41')]){case _0x8c10('0x57'):logger[_0x8c10('0xf')](_0x8c10('0x6b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8c10('0x1e')](_0x8c10('0x59'),_0x38cf3c[_0x8c10('0x12')],_0x405c41['id'],_0x3fcb35['id']),'method':_0x8c10('0x13')});case _0x8c10('0x5a'):logger[_0x8c10('0xf')]('[OUTBOUND]',_0x8c10('0x5b'));emit(util[_0x8c10('0x1e')](_0x8c10('0x5c'),_0x49ca12[_0x8c10('0x16')]),_0x8c10('0x5d'),{'uri':util[_0x8c10('0x1e')]('%s/agent/tickets/%s',_0x38cf3c[_0x8c10('0x12')][_0x8c10('0x6c')](_0x8c10('0x5f'),''),_0x3fcb35['id'])});break;default:logger[_0x8c10('0x62')](_0x8c10('0x6b'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x8c10('0x61')](function(_0x9a6dfb){logger['error'](_0x8c10('0x6d'),util['inspect'](_0x9a6dfb,{'showHidden':!![],'depth':null}));});};exports[_0x8c10('0x6e')]=function(_0x7a5d3c,_0x27cfa1,_0x94c09a,_0x3add93,_0x212953,_0x4f7088){var _0xd8c28c,_0xe911b5;_0x4f7088[_0x8c10('0x12')]=intUtil[_0x8c10('0x4c')](_0x4f7088[_0x8c10('0x12')]);_0x4f7088['serverUrl']=intUtil['stripTrailingSlash'](_0x4f7088['serverUrl']);if(_0x212953&&_0x212953['monitor_format']){logger[_0x8c10('0xf')]('['+_0x27cfa1[_0x8c10('0x6f')]['toUpperCase']()+']',_0x8c10('0x70'));_0x27cfa1[_0x8c10('0x4f')]=util[_0x8c10('0x1e')](_0x8c10('0x50'),_0x4f7088['serverUrl'],_0x27cfa1['uniqueid'],md5(_0x27cfa1[_0x8c10('0x51')]));}else{_0x27cfa1['recordingURL']='';}headers[_0x8c10('0x68')]=getAuth(_0x4f7088);return getUser(_0x4f7088)[_0x8c10('0x1a')](function(_0x1ab632){_0xd8c28c=_0x1ab632;logger[_0x8c10('0xf')](_0x8c10('0x53'),_0xd8c28c['id']);return getEndUser(_0x4f7088,_0x27cfa1[_0x8c10('0x54')],_0x27cfa1[_0x8c10('0x55')]);})[_0x8c10('0x1a')](function(_0x3da2a8){_0xe911b5=_0x3da2a8;logger['info'](_0x8c10('0x6a'),_0xe911b5['id']);return getTicket(_0x4f7088,_0xd8c28c,_0xe911b5,_0x94c09a,_0x27cfa1);})[_0x8c10('0x1a')](function(_0x5a4b3f){if(_0x5a4b3f){logger['info'](_0x8c10('0x56'),_0x5a4b3f['id']);}})[_0x8c10('0x61')](function(_0x598870){logger[_0x8c10('0x62')]('['+_0x27cfa1[_0x8c10('0x6f')][_0x8c10('0x71')]()+']'+_0x8c10('0x72'),util[_0x8c10('0x64')](_0x598870,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5c36=['integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','name','getString','Subjects','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','results','agent','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','%s/token:%s','Basic\x20%s','toString','[HTTP]','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','customVariable','Variable','custom_fields','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:'];(function(_0x31c469,_0x82a9ca){var _0x3d69b6=function(_0x8ec19f){while(--_0x8ec19f){_0x31c469['push'](_0x31c469['shift']());}};_0x3d69b6(++_0x82a9ca);}(_0x5c36,0xf2));var _0x65c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5c36[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x65c3('0x0'));var rp=require(_0x65c3('0x1'));var md5=require(_0x65c3('0x2'));var util=require(_0x65c3('0x3'));var Redis=require(_0x65c3('0x4'));var intUtil=require(_0x65c3('0x5'));var config=require(_0x65c3('0x6'));var logger=require(_0x65c3('0x7'))(_0x65c3('0x8'));config[_0x65c3('0x9')]=_[_0x65c3('0xa')](config[_0x65c3('0x9')],{'host':_0x65c3('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x15ca8a,_0x5bc8d8,_0x235ba8){io['to'](_0x15ca8a)[_0x65c3('0xc')](_0x5bc8d8,_0x235ba8);}var headers={'Content-Type':_0x65c3('0xd'),'Accept':_0x65c3('0xd')};function getTicket(_0x4f43f7,_0x5aee0f,_0x1362a9,_0x288189,_0xe814d8){logger['info'](_0x65c3('0xe'));return request({'uri':util[_0x65c3('0xf')]('%s/tickets.json',_0x4f43f7[_0x65c3('0x10')]),'method':_0x65c3('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x1362a9['id'],'submitter_id':_0x5aee0f?_0x5aee0f['id']:undefined,'assignee_id':_0x5aee0f?_0x5aee0f['id']:undefined,'tags':getTags(_0x288189[_0x65c3('0x12')],_0x65c3('0x13')),'subject':intUtil[_0x65c3('0x14')](_0x288189[_0x65c3('0x15')],_0xe814d8,'\x20'),'description':intUtil[_0x65c3('0x14')](_0x288189['Descriptions'],_0xe814d8,'\x0a'),'comment':{'public':![],'body':intUtil[_0x65c3('0x14')](_0x288189['Descriptions'],_0xe814d8,'\x0a')}},getCustomFields(_0x288189[_0x65c3('0x16')],_0xe814d8))}})[_0x65c3('0x17')](function(_0x4abad2){logger[_0x65c3('0x18')](_0x65c3('0x19'));return _0x4abad2[_0x65c3('0x1a')];});}function getUser(_0x263a35,_0x29301f){if(intUtil[_0x65c3('0x1b')](_0x29301f)){logger[_0x65c3('0x18')](_0x65c3('0x1c'),_0x29301f);return request({'uri':util[_0x65c3('0xf')](_0x65c3('0x1d'),_0x263a35[_0x65c3('0x10')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x29301f)}})[_0x65c3('0x17')](function(_0x4bf9d4){if(_0x4bf9d4[_0x65c3('0x1e')]){logger[_0x65c3('0x18')](_0x65c3('0x1f'));return _[_0x65c3('0x20')](_0x4bf9d4[_0x65c3('0x21')],{'email':_0x29301f,'role':_0x65c3('0x22')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x65c3('0xf')](_0x65c3('0x23'),_0x263a35['remoteUri'])})['then'](function(_0x15fcef){logger[_0x65c3('0x18')]('Admin\x20account\x20selected.');return _0x15fcef[_0x65c3('0x24')];});}});}else{logger[_0x65c3('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x65c3('0xf')](_0x65c3('0x23'),_0x263a35[_0x65c3('0x10')])})[_0x65c3('0x17')](function(_0x23c9c4){logger[_0x65c3('0x18')]('Admin\x20account\x20selected.');return _0x23c9c4[_0x65c3('0x24')];});}}function getEndUser(_0x2ab410,_0x522b1b,_0x5006b6){logger[_0x65c3('0x18')](_0x65c3('0x25'),_0x5006b6);return request({'uri':util[_0x65c3('0xf')](_0x65c3('0x1d'),_0x2ab410[_0x65c3('0x10')]),'qs':{'query':util['format'](_0x65c3('0x26'),_0x5006b6)}})[_0x65c3('0x17')](function(_0x1e94a5){var _0x9a015d;if(_0x1e94a5['results'][_0x65c3('0x27')]){_0x1e94a5[_0x65c3('0x21')]=_[_0x65c3('0x28')](_0x1e94a5['results'],{'suspended':![],'role':_0x65c3('0x29')});if(_0x1e94a5[_0x65c3('0x21')][_0x65c3('0x27')]){_0x9a015d=_[_0x65c3('0x2a')](_0x1e94a5[_0x65c3('0x21')]);}}if(_0x9a015d){logger[_0x65c3('0x18')](_0x65c3('0x2b'));return _0x9a015d;}else{logger['info'](_0x65c3('0x2c'));return request({'uri':util[_0x65c3('0xf')](_0x65c3('0x2d'),_0x2ab410[_0x65c3('0x10')]),'method':_0x65c3('0x11'),'body':{'user':{'role':_0x65c3('0x29'),'name':util['format'](_0x65c3('0x2e'),_0x522b1b||_0x5006b6),'phone':_0x5006b6}}})[_0x65c3('0x17')](function(_0x41117b){logger['info'](_0x65c3('0x2f'));return _0x41117b['user'];});}});}function getAuth(_0x4af04e){var _0x40710c;if(_0x4af04e['authType']===_0x65c3('0x30')){_0x40710c=util[_0x65c3('0xf')](_0x65c3('0x31'),_0x4af04e[_0x65c3('0x32')],_0x4af04e[_0x65c3('0x30')]);}else if(_0x4af04e[_0x65c3('0x33')]==='token'){_0x40710c=util[_0x65c3('0xf')](_0x65c3('0x34'),_0x4af04e[_0x65c3('0x32')],_0x4af04e['token']);}return util[_0x65c3('0xf')](_0x65c3('0x35'),new Buffer(_0x40710c)[_0x65c3('0x36')]('base64'));}function request(_0x561057){logger['debug'](_0x65c3('0x37'),JSON['stringify'](_0x561057));return rp(_[_0x65c3('0xa')](_0x561057,{'method':_0x65c3('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x30729c,_0x236aa3){var _0x516fa1=[];if(_0x30729c&&_0x30729c['length']>0x0){_0x516fa1=_[_0x65c3('0x39')](_0x30729c,_0x236aa3);}return _0x516fa1;}function getCustomFields(_0x27ab65,_0x7d123){var _0x3d2d77=[];var _0x508314={'custom_fields':[]};if(_0x27ab65[_0x65c3('0x27')]>0x0){_[_0x65c3('0x3a')](_0x27ab65,function(_0x488c64){if(_[_0x65c3('0x3b')](['string',_0x65c3('0x3c')],_0x488c64[_0x65c3('0x3d')])&&_0x488c64[_0x65c3('0x3e')]&&!_0x488c64[_0x65c3('0x3f')]){_0x508314[_0x488c64['nameField'][_0x65c3('0x40')]()]=_0x488c64[_0x65c3('0x41')][_0x65c3('0x36')]();}else if(_['includes'](['string',_0x65c3('0x3c')],_0x488c64[_0x65c3('0x3d')])&&_0x488c64[_0x65c3('0x42')]&&_0x488c64[_0x65c3('0x3f')]){_0x508314['custom_fields'][_0x65c3('0x43')]({'id':_0x488c64[_0x65c3('0x42')],'value':_0x488c64[_0x65c3('0x41')][_0x65c3('0x36')]()});}else if(_0x488c64[_0x65c3('0x3d')]==='variable'&&_0x488c64[_0x65c3('0x44')]&&_0x488c64[_0x65c3('0x42')]&&_0x488c64[_0x65c3('0x3f')]){_0x7d123[_0x488c64[_0x65c3('0x44')]]&&_0x508314['custom_fields'][_0x65c3('0x43')]({'id':_0x488c64[_0x65c3('0x42')],'value':_0x7d123[_0x488c64[_0x65c3('0x44')]][_0x65c3('0x36')]()});}else if(_0x488c64[_0x65c3('0x3d')]===_0x65c3('0x45')&&_0x488c64['Variable']&&_0x488c64[_0x65c3('0x46')][_0x65c3('0x13')]&&_0x488c64['idField']&&_0x488c64[_0x65c3('0x3f')]){_0x7d123[_0x488c64[_0x65c3('0x46')]['name'][_0x65c3('0x40')]()]&&_0x508314[_0x65c3('0x47')][_0x65c3('0x43')]({'id':_0x488c64[_0x65c3('0x42')],'value':_0x7d123[_0x488c64[_0x65c3('0x46')][_0x65c3('0x13')][_0x65c3('0x40')]()][_0x65c3('0x36')]()});}});}return _0x508314;}exports[_0x65c3('0x48')]=function(_0x42b0ce,_0x4df5f6,_0x22977c,_0x5c4afd,_0x5d2a0f,_0x1297de){var _0x12271d,_0x1cf215;_0x1297de[_0x65c3('0x10')]=intUtil[_0x65c3('0x49')](_0x1297de[_0x65c3('0x10')]);_0x1297de[_0x65c3('0x4a')]=intUtil['stripTrailingSlash'](_0x1297de[_0x65c3('0x4a')]);if(_0x5d2a0f&&_0x5d2a0f['monitor_format']){logger[_0x65c3('0x18')](_0x65c3('0x4b'),'Recording\x20is\x20enabled!');_0x4df5f6[_0x65c3('0x4c')]=util[_0x65c3('0xf')](_0x65c3('0x4d'),_0x1297de[_0x65c3('0x4a')],_0x4df5f6['uniqueid'],md5(_0x4df5f6[_0x65c3('0x4e')]));}else{_0x4df5f6['recordingURL']='';}headers['Authorization']=getAuth(_0x1297de);return getUser(_0x1297de,_0x5c4afd[_0x65c3('0x4f')])[_0x65c3('0x17')](function(_0x26b669){_0x12271d=_0x26b669;logger[_0x65c3('0x18')](_0x65c3('0x50'),_0x12271d['id']);return getEndUser(_0x1297de,_0x4df5f6[_0x65c3('0x51')],_0x4df5f6[_0x65c3('0x52')]);})[_0x65c3('0x17')](function(_0x34defe){_0x1cf215=_0x34defe;logger[_0x65c3('0x18')](_0x65c3('0x53'),_0x1cf215['id']);return getTicket(_0x1297de,_0x12271d,_0x1cf215,_0x22977c,_0x4df5f6);})[_0x65c3('0x17')](function(_0x5b8590){if(_0x5b8590){logger[_0x65c3('0x18')](_0x65c3('0x54'),_0x5b8590['id']);switch(_0x1297de[_0x65c3('0x3d')]){case _0x65c3('0x55'):logger[_0x65c3('0x18')](_0x65c3('0x4b'),_0x65c3('0x56'));return request({'uri':util[_0x65c3('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1297de[_0x65c3('0x10')],_0x12271d['id'],_0x5b8590['id']),'method':_0x65c3('0x11')});case _0x65c3('0x57'):logger[_0x65c3('0x18')]('[QUEUE]',_0x65c3('0x58'));emit(util[_0x65c3('0xf')]('user:%s',_0x5c4afd['name']),_0x65c3('0x59'),{'uri':util[_0x65c3('0xf')](_0x65c3('0x5a'),_0x1297de[_0x65c3('0x10')][_0x65c3('0x5b')](_0x65c3('0x5c'),''),_0x5b8590['id'])});break;default:logger[_0x65c3('0x5d')](_0x65c3('0x4b'),_0x65c3('0x5e'));}}})[_0x65c3('0x5f')](function(_0x56f4b7){logger[_0x65c3('0x5d')](_0x65c3('0x60'),util[_0x65c3('0x61')](_0x56f4b7,{'showHidden':!![],'depth':null}));});};exports[_0x65c3('0x62')]=function(_0x15bdbf,_0x182211,_0x2a7e77,_0x41d59d,_0x2b6f5b,_0x12c242,_0x4b6442){var _0x3405dd,_0x371e14;_0x12c242[_0x65c3('0x10')]=intUtil['stripTrailingSlash'](_0x12c242[_0x65c3('0x10')]);_0x12c242[_0x65c3('0x4a')]=intUtil[_0x65c3('0x49')](_0x12c242[_0x65c3('0x4a')]);if(_0x4b6442&&_0x4b6442['recordingFormat']&&_0x4b6442[_0x65c3('0x63')]!=='none'){logger[_0x65c3('0x18')](_0x65c3('0x64'),_0x65c3('0x65'));_0x182211[_0x65c3('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12c242[_0x65c3('0x4a')],_0x182211[_0x65c3('0x4e')],md5(_0x182211['uniqueid']));}headers['Authorization']=getAuth(_0x12c242);return getUser(_0x12c242,_0x41d59d[_0x65c3('0x4f')])[_0x65c3('0x17')](function(_0x35afa1){_0x3405dd=_0x35afa1;logger['info']('The\x20User\x20ID\x20is:',_0x3405dd['id']);return getEndUser(_0x12c242,_0x182211[_0x65c3('0x66')],_0x182211[_0x65c3('0x67')]);})[_0x65c3('0x17')](function(_0x143860){_0x371e14=_0x143860;logger['info'](_0x65c3('0x53'),_0x371e14['id']);return getTicket(_0x12c242,_0x3405dd,_0x371e14,_0x2a7e77,_0x182211);})[_0x65c3('0x17')](function(_0x250870){if(_0x250870){logger[_0x65c3('0x18')](_0x65c3('0x54'),_0x250870['id']);switch(_0x12c242[_0x65c3('0x3d')]){case'integrationTab':logger[_0x65c3('0x18')](_0x65c3('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x65c3('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x12c242['remoteUri'],_0x3405dd['id'],_0x250870['id']),'method':_0x65c3('0x11')});case'newTab':logger['info'](_0x65c3('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x65c3('0xf')]('user:%s',_0x41d59d[_0x65c3('0x13')]),_0x65c3('0x59'),{'uri':util[_0x65c3('0xf')](_0x65c3('0x5a'),_0x12c242[_0x65c3('0x10')][_0x65c3('0x5b')]('/api/v2',''),_0x250870['id'])});break;default:logger[_0x65c3('0x5d')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x65c3('0x5f')](function(_0xf640ee){logger[_0x65c3('0x5d')](_0x65c3('0x68'),util[_0x65c3('0x61')](_0xf640ee,{'showHidden':!![],'depth':null}));});};exports[_0x65c3('0x69')]=function(_0x20cde9,_0x69af80,_0x330e88,_0x5ea43c,_0x59f6e0,_0x40d0c6){var _0x516c62,_0x297cc2;_0x40d0c6[_0x65c3('0x10')]=intUtil[_0x65c3('0x49')](_0x40d0c6[_0x65c3('0x10')]);_0x40d0c6[_0x65c3('0x4a')]=intUtil[_0x65c3('0x49')](_0x40d0c6[_0x65c3('0x4a')]);if(_0x59f6e0&&_0x59f6e0[_0x65c3('0x6a')]){logger[_0x65c3('0x18')]('['+_0x69af80[_0x65c3('0x6b')]['toUpperCase']()+']',_0x65c3('0x65'));_0x69af80[_0x65c3('0x4c')]=util[_0x65c3('0xf')](_0x65c3('0x4d'),_0x40d0c6[_0x65c3('0x4a')],_0x69af80[_0x65c3('0x4e')],md5(_0x69af80[_0x65c3('0x4e')]));}else{_0x69af80[_0x65c3('0x4c')]='';}headers['Authorization']=getAuth(_0x40d0c6);return getUser(_0x40d0c6)[_0x65c3('0x17')](function(_0x849c97){_0x516c62=_0x849c97;logger[_0x65c3('0x18')](_0x65c3('0x50'),_0x516c62['id']);return getEndUser(_0x40d0c6,_0x69af80[_0x65c3('0x51')],_0x69af80[_0x65c3('0x52')]);})[_0x65c3('0x17')](function(_0x1bd03d){_0x297cc2=_0x1bd03d;logger[_0x65c3('0x18')](_0x65c3('0x53'),_0x297cc2['id']);return getTicket(_0x40d0c6,_0x516c62,_0x297cc2,_0x330e88,_0x69af80);})[_0x65c3('0x17')](function(_0x40b4f0){if(_0x40b4f0){logger['info'](_0x65c3('0x54'),_0x40b4f0['id']);}})['catch'](function(_0x25957e){logger['error']('['+_0x69af80[_0x65c3('0x6b')]['toUpperCase']()+']'+_0x65c3('0x6c'),util[_0x65c3('0x61')](_0x25957e,{'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 b041458..65c89b2 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 _0x5212=['SUCCESS','Error:\x20','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Owner','administrator','Subject','Subjects','Description','Descriptions','enduserType','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','mm:ss','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','stack','err','host','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','serverUrl','recordingFormat','none','[OUTBOUND]','email','The\x20User\x20ID\x20is:','destcalleridname','Outbound','monitor_format','/api/voice/recordings/','toUpperCase','lodash','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','includes','string','picklist','type','idField','content','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','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','Failing\x20creating\x20the\x20access_token','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','Agent\x20found!','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','error','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code'];(function(_0x5be056,_0x2ea34d){var _0x4b7503=function(_0x26db8c){while(--_0x26db8c){_0x5be056['push'](_0x5be056['shift']());}};_0x4b7503(++_0x2ea34d);}(_0x5212,0x187));var _0x2521=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x5212[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x2521('0x0'));var rp=require('request-promise');var md5=require(_0x2521('0x1'));var util=require(_0x2521('0x2'));var intUtil=require(_0x2521('0x3'));var moment=require(_0x2521('0x4'));var Redis=require('ioredis');var BPromise=require(_0x2521('0x5'));var config=require(_0x2521('0x6'));var logger=require(_0x2521('0x7'))(_0x2521('0x8'));config[_0x2521('0x9')]=_[_0x2521('0xa')](config[_0x2521('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x2521('0xb'))(new Redis(config[_0x2521('0x9')]));function emit(_0x5eafb2,_0x269f28,_0x4eb956){io['to'](_0x5eafb2)[_0x2521('0xc')](_0x269f28,_0x4eb956);}function request(_0x44c430){logger[_0x2521('0xd')](_0x2521('0xe'),JSON[_0x2521('0xf')](_0x44c430));return rp(_0x44c430);}function getCustomFields(_0x1387fa,_0x5247a2){var _0x532f17={};if(_0x1387fa[_0x2521('0x10')]>0x0){_['forEach'](_0x1387fa,function(_0x292dd8){if(_[_0x2521('0x11')]([_0x2521('0x12'),_0x2521('0x13')],_0x292dd8[_0x2521('0x14')])&&_0x292dd8[_0x2521('0x15')]){_0x532f17[_0x292dd8['idField']]=_0x292dd8[_0x2521('0x16')][_0x2521('0x17')]();}else if(_0x292dd8[_0x2521('0x14')]===_0x2521('0x18')&&_0x292dd8['variableName']&&_0x292dd8['idField']&&_0x5247a2[_0x292dd8['variableName']]){_0x532f17[_0x292dd8[_0x2521('0x15')]]=_0x5247a2[_0x292dd8[_0x2521('0x19')]]['toString']();}else if(_0x292dd8[_0x2521('0x14')]===_0x2521('0x1a')&&_0x292dd8[_0x2521('0x1b')]&&_0x292dd8[_0x2521('0x1b')][_0x2521('0x1c')]&&_0x292dd8[_0x2521('0x15')]&&_0x5247a2[_0x292dd8['Variable'][_0x2521('0x1c')][_0x2521('0x1d')]()]){_0x532f17[_0x292dd8[_0x2521('0x15')]]=_0x5247a2[_0x292dd8[_0x2521('0x1b')][_0x2521('0x1c')]['toLowerCase']()][_0x2521('0x17')]();}});}return _0x532f17;}function getName(_0x2b4074){if(_0x2b4074[_0x2521('0x1e')]('\x20')>0x0){var _0x39aa75=_0x2b4074[_0x2521('0x1f')](/ (.+)/);if(_0x39aa75[0x1]){return _0x39aa75;}}return[_0x2b4074,_0x2b4074];}var accountsTokens={};function getAccessToken(_0x5cab3f){return new Promise(function(_0x4cea3e,_0x4434e0){if(!_[_0x2521('0x20')](accountsTokens[_0x5cab3f['id']])&&!_[_0x2521('0x20')](accountsTokens[_0x5cab3f['id']][_0x2521('0x21')])){if(moment()[_0x2521('0x22')](accountsTokens[_0x5cab3f['id']][_0x2521('0x23')])){_0x4cea3e(accountsTokens[_0x5cab3f['id']]['access_token']);}}var _0x50dffd;switch(_0x5cab3f[_0x2521('0x24')]){case'US':_0x50dffd=_0x2521('0x25');break;case'AU':_0x50dffd=_0x2521('0x26');break;case'EU':_0x50dffd=_0x2521('0x27');break;case'IN':_0x50dffd=_0x2521('0x28');break;case'CN':_0x50dffd='https://accounts.zoho.com.cn';break;default:_0x50dffd=_0x2521('0x27');break;}var _0x14c701={'method':'POST','uri':_0x50dffd+_0x2521('0x29'),'qs':{'refresh_token':_0x5cab3f[_0x2521('0x2a')],'client_id':_0x5cab3f[_0x2521('0x2b')],'client_secret':_0x5cab3f[_0x2521('0x2c')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x14c701)[_0x2521('0x2d')](function(_0x5be0c5){accountsTokens[_0x5cab3f['id']]={'access_token':_0x5be0c5[_0x2521('0x21')],'expires_in':moment()[_0x2521('0x2e')](_0x5be0c5[_0x2521('0x23')],_0x2521('0x2f'))};_0x4cea3e(_0x5be0c5[_0x2521('0x21')]);})['catch'](function(_0xda3681){logger['error'](_0x2521('0x30'),_0xda3681['stack']);_0x4434e0(_0xda3681);});});}function getUser(_0x3e50af,_0x3f5d77,_0x1b05f9,_0xad3e81){logger[_0x2521('0x31')](_0x2521('0x32'));return request({'method':'GET','uri':util[_0x2521('0x33')](_0x2521('0x34'),_0x3f5d77),'qs':{'type':_0x2521('0x35')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3e50af},'json':!![]})[_0x2521('0x2d')](function(_0x216656){if(_0x216656[_0x2521('0x36')]){var _0x1e24d3=-0x1;if(_[_0x2521('0x37')](_0x216656[_0x2521('0x36')])){if(!_[_0x2521('0x20')](_0xad3e81)){_0x1e24d3=_[_0x2521('0x38')](_0x216656['users'],function(_0x248df0){return _0x248df0['email']===_0xad3e81;});}if(_0x1e24d3>=0x0){logger[_0x2521('0x31')](_0x2521('0x39'));}else{logger[_0x2521('0x31')]('Using\x20the\x20admin\x20account!');_0x1e24d3=_[_0x2521('0x38')](_0x216656[_0x2521('0x36')],function(_0x489419){return _0x489419[_0x2521('0x3a')][_0x2521('0x1c')]===_0x2521('0x3b');});}return _0x216656[_0x2521('0x36')][_0x1e24d3];}else{if(_0x216656['user'][_0x2521('0x3a')][_0x2521('0x1c')]===_0x2521('0x3b')){logger[_0x2521('0x31')](_0x2521('0x3c'));user=_0x216656[_0x2521('0x3d')];return user;}else{logger['error'](_0x2521('0x3e'),JSON[_0x2521('0xf')](_0x216656));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x216656));}}}else{logger['error'](_0x2521('0x3e'),JSON[_0x2521('0xf')](_0x216656));throw new Error(_0x2521('0x3f')+JSON[_0x2521('0xf')](_0x216656));}})[_0x2521('0x40')](function(_0x1c4f01){console[_0x2521('0x41')](_0x1c4f01);});}function getZohoUser(_0x261baa,_0x25e582){return new BPromise(function(_0xebe5bc,_0x5d66c6){request(_0x261baa)[_0x2521('0x2d')](function(_0x2f4cd0){var _0xf43c31=null;if(_0x2f4cd0){_0xf43c31=_0x2f4cd0[_0x2521('0x42')][0x0];_0xf43c31['enduserType']=_0x25e582;}_0xebe5bc(_0xf43c31);})[_0x2521('0x40')](function(_0x289dd5){_0x5d66c6(_0x289dd5);});});}function createEndUser(_0x59bde6,_0x761dd7,_0x525f42,_0x4b9127,_0x514f4c,_0x3a376e){var _0x525f42=getName(_0x525f42);return request({'method':_0x2521('0x43'),'uri':_0x2521('0x44')+_0x761dd7+_0x2521('0x45')+_[_0x2521('0x46')](_0x3a376e[_0x2521('0x47')])+'s','body':{'data':[{'Last_Name':_0x525f42[0x1],'First_Name':_0x525f42[0x0],'Phone':_0x4b9127,'Owner':{'name':!_[_0x2521('0x20')](_0x514f4c[_0x2521('0x48')]['name'])?_0x514f4c['role'][_0x2521('0x1c')]:!_[_0x2521('0x20')](_0x514f4c[_0x2521('0x49')])?_0x514f4c['first_name']+'\x20'+_0x514f4c[_0x2521('0x4a')]:_0x514f4c[_0x2521('0x4a')],'id':_0x514f4c['id']}}]},'headers':{'Authorization':_0x2521('0x4b')+_0x59bde6},'json':!![]})[_0x2521('0x2d')](function(_0x1313a2){if(_0x1313a2&&_0x1313a2[_0x2521('0x42')][0x0][_0x2521('0x4c')]===_0x2521('0x4d')){var _0x3d253c=_0x1313a2[_0x2521('0x42')][0x0]['details'];_0x3d253c['enduserType']=_['startCase'](_0x3a376e[_0x2521('0x47')])+'s';return _0x3d253c;}logger[_0x2521('0x41')](_0x2521('0x3e'),JSON['stringify'](data));throw new Error(_0x2521('0x4e')+JSON['stringify'](data));})[_0x2521('0x40')](function(_0x39f279){console['log'](_0x2521('0x4f'),_0x39f279);});}function getEndUser(_0x55fad3,_0x3524fe,_0x3c05e9,_0x503aa8,_0x2858d0,_0x597d97,_0x5f1620){var _0x14a89f={'method':_0x2521('0x50'),'uri':'','headers':{'Authorization':_0x2521('0x4b')+_0x55fad3},'json':!![]};switch(_0x5f1620[_0x2521('0x51')]){case _0x2521('0x52'):_0x14a89f[_0x2521('0x53')]=_0x2521('0x44')+_0x3524fe+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2858d0+'))';return getZohoUser(_0x14a89f,_0x2521('0x54'))['then'](function(_0x339f99){if(_0x339f99)return _0x339f99;_0x14a89f['uri']=_0x2521('0x44')+_0x3524fe+_0x2521('0x55')+_0x2858d0+'))';return getZohoUser(_0x14a89f,_0x2521('0x56'))[_0x2521('0x2d')](function(_0x1e8e90){if(_0x1e8e90)return _0x1e8e90;if(_0x5f1620[_0x2521('0x47')]!=_0x2521('0x57')){return createEndUser(_0x55fad3,_0x3524fe,_0x503aa8,_0x2858d0,_0x597d97,_0x5f1620);}else{return{};}});});break;case _0x2521('0x58'):_0x14a89f[_0x2521('0x53')]=_0x2521('0x44')+_0x3524fe+_0x2521('0x59')+_0x2858d0+'))';return getZohoUser(_0x14a89f,_0x2521('0x54'))[_0x2521('0x2d')](function(_0x3f67b0){if(_0x3f67b0)return _0x3f67b0;if(_0x5f1620[_0x2521('0x47')]!=_0x2521('0x57')){return createEndUser(_0x55fad3,_0x3524fe,_0x503aa8,_0x2858d0,_0x597d97,_0x5f1620);}else{return{};}});break;case'lead':_0x14a89f[_0x2521('0x53')]=_0x2521('0x44')+_0x3524fe+_0x2521('0x55')+_0x2858d0+'))';return getZohoUser(_0x14a89f,'Leads')[_0x2521('0x2d')](function(_0x3cd67c){if(_0x3cd67c)return _0x3cd67c;if(_0x5f1620[_0x2521('0x47')]!=_0x2521('0x57')){return createEndUser(_0x55fad3,_0x3524fe,_0x503aa8,_0x2858d0,_0x597d97,_0x5f1620);}else{return{};}});break;}}function getCall(_0x135be4,_0x62a44d,_0x5971b0,_0xd9c70,_0x41ab0c,_0x37f851,_0x2274e5,_0x4ea3f6){logger[_0x2521('0x31')]('Creating\x20new\x20call...');var _0x4a6996={};_0x4a6996[_0x2521('0x5a')]={'name':!_['isNil'](_0xd9c70[_0x2521('0x48')][_0x2521('0x1c')])&&!_[_0x2521('0x20')](_0xd9c70['profile'][_0x2521('0x1c')])&&_0xd9c70[_0x2521('0x3a')][_0x2521('0x1c')]===_0x2521('0x5b')?_0xd9c70[_0x2521('0x48')][_0x2521('0x1c')]:!_[_0x2521('0x20')](_0xd9c70[_0x2521('0x49')])?_0xd9c70[_0x2521('0x49')]+'\x20'+_0xd9c70['last_name']:_0xd9c70[_0x2521('0x4a')],'id':_0xd9c70['id']};_0x4a6996[_0x2521('0x5c')]=intUtil['getString'](_0x37f851[_0x2521('0x5d')],_0x2274e5,'\x20');_0x4a6996[_0x2521('0x5e')]=intUtil['getString'](_0x37f851[_0x2521('0x5f')],_0x2274e5,'\x0a');if(_0x41ab0c[_0x2521('0x60')]===_0x2521('0x54')){_0x4a6996['Who_Id']={'name':!_[_0x2521('0x20')](_0x41ab0c[_0x2521('0x61')])?_0x41ab0c[_0x2521('0x61')]:!_[_0x2521('0x20')](_0x41ab0c[_0x2521('0x62')])?_0x41ab0c[_0x2521('0x62')]+'\x20'+_0x41ab0c[_0x2521('0x63')]:_0x41ab0c[_0x2521('0x63')],'id':_0x41ab0c['id']};}if(_0x41ab0c[_0x2521('0x60')]===_0x2521('0x56')){_0x4a6996[_0x2521('0x64')]={'name':!_[_0x2521('0x20')](_0x41ab0c[_0x2521('0x61')])?_0x41ab0c[_0x2521('0x61')]:!_['isNil'](_0x41ab0c[_0x2521('0x62')])?_0x41ab0c[_0x2521('0x62')]+'\x20'+_0x41ab0c[_0x2521('0x63')]:_0x41ab0c['Last_Name'],'id':_0x41ab0c['id']};_0x4a6996['$se_module']=_[_0x2521('0x46')](_0x41ab0c[_0x2521('0x60')]);}if(_0x2274e5[_0x2521('0x65')]){_0x4a6996[_0x2521('0x66')]=moment['utc'](parseInt(_0x2274e5[_0x2521('0x65')])*0x3e8)[_0x2521('0x33')](_0x2521('0x67'));}else if(_0x2274e5['answertime']&&_0x2274e5[_0x2521('0x68')]){_0x4a6996['Call_Duration']=moment[_0x2521('0x69')](moment(_0x2274e5[_0x2521('0x68')],_0x2521('0x6a'))[_0x2521('0x6b')](moment(_0x2274e5[_0x2521('0x6c')],_0x2521('0x6a'))))[_0x2521('0x33')](_0x2521('0x67'));}switch(_0x2274e5[_0x2521('0x6d')]){case _0x2521('0x6e'):_0x4a6996[_0x2521('0x6f')]=_0x2521('0x70');break;case _0x2521('0x71'):case _0x2521('0x72'):_0x4a6996[_0x2521('0x6f')]=_0x2521('0x73');break;case _0x2521('0x74'):_0x4a6996[_0x2521('0x6f')]=_0x2521('0x75');break;case _0x2521('0x76'):_0x4a6996[_0x2521('0x6f')]=_0x2521('0x77');break;case'timeout':_0x4a6996['Call_Result']='Timeout';default:}_0x4a6996['Call_Start_Time']=(_0x4ea3f6===_0x2521('0x78')?moment(_0x2274e5['starttime'])[_0x2521('0x33')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x2274e5[_0x2521('0x79')])[_0x2521('0x33')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x4a6996[_0x2521('0x7a')]=_0x4ea3f6||_0x2521('0x7b');_0x4a6996=_[_0x2521('0x7c')](_0x4a6996,getCustomFields(_0x37f851[_0x2521('0x7d')],_0x2274e5));return request({'method':_0x2521('0x43'),'uri':_0x2521('0x44')+_0x62a44d+_0x2521('0x7e'),'headers':{'Authorization':_0x2521('0x4b')+_0x135be4},'body':{'data':[_0x4a6996]},'json':!![]})[_0x2521('0x2d')](function(_0x4df3b1){if(_0x4df3b1&&_0x4df3b1['data'][0x0]['code']==='SUCCESS'){logger['info']('Call\x20created!');return{'id':_0x4df3b1['data'][0x0]['details']['id']};}})[_0x2521('0x40')](function(_0x431249){logger[_0x2521('0x31')]('err',_0x431249[_0x2521('0x7f')]);console['log'](_0x2521('0x80'),_0x431249);});}exports['queue']=function(_0x9b5460,_0x58d459,_0x585b41,_0xc4f9f1,_0x3fa8aa,_0x51ad77){var _0x2162d8,_0x310658,_0x147c51;_0x51ad77[_0x2521('0x81')]=intUtil[_0x2521('0x82')](_0x51ad77[_0x2521('0x81')]);_0x51ad77['serverUrl']=intUtil[_0x2521('0x82')](_0x51ad77['serverUrl']);if(_0x3fa8aa&&_0x3fa8aa['monitor_format']){logger['info']('[QUEUE]',_0x2521('0x83'));_0x58d459[_0x2521('0x84')]=_0x51ad77['serverUrl']+'/api/voice/recordings/'+_0x58d459[_0x2521('0x85')]+_0x2521('0x86')+md5(_0x58d459['uniqueid']);}else{_0x58d459['recordingURL']='';}var _0x592764=_0x51ad77[_0x2521('0x81')]===_0x2521('0x87')?'eu':_0x2521('0x88');return getAccessToken(_0x51ad77)[_0x2521('0x2d')](function(_0x4814ee){_0x147c51=_0x4814ee;return getUser(_0x147c51,_0x592764,_0x51ad77,_0xc4f9f1['email']);})[_0x2521('0x2d')](function(_0x4e83c9){_0x2162d8=_0x4e83c9;logger[_0x2521('0x31')]('The\x20User\x20ID\x20is:',_0x2162d8['id']);return getEndUser(_0x147c51,_0x592764,_0x51ad77,_0x58d459[_0x2521('0x89')],_0x58d459[_0x2521('0x8a')],_0x2162d8,_0x585b41);})['then'](function(_0x1fa631){_0x310658=_0x1fa631;return getCall(_0x147c51,_0x592764,_0x51ad77,_0x2162d8,_0x310658,_0x585b41,_0x58d459,_0x2521('0x7b'));})[_0x2521('0x2d')](function(_0x1fb8c7){if(_0x1fb8c7){logger['info'](_0x2521('0x8b'),_0x1fb8c7['id']);logger[_0x2521('0x31')](_0x2521('0x8c'),_0x2521('0x8d'));emit(util['format']('user:%s',_0xc4f9f1[_0x2521('0x1c')]),_0x2521('0x8e'),{'uri':_0x2521('0x8f')+_0x51ad77[_0x2521('0x81')]+_0x2521('0x90')+_0x1fb8c7['id']});}})[_0x2521('0x40')](function(_0xa92a8f){logger[_0x2521('0x41')](_0x2521('0x8c'),JSON[_0x2521('0xf')](_0xa92a8f));});};exports['outbound']=function(_0x374332,_0x221735,_0x1eaee0,_0x5cd536,_0xe58a1c,_0x2810e7,_0x1ed390){var _0x191c80,_0x45fb11,_0x4357d0;_0x2810e7['host']=intUtil[_0x2521('0x82')](_0x2810e7[_0x2521('0x81')]);_0x2810e7[_0x2521('0x91')]=intUtil[_0x2521('0x82')](_0x2810e7[_0x2521('0x91')]);if(_0x1ed390&&_0x1ed390[_0x2521('0x92')]&&_0x1ed390[_0x2521('0x92')]!==_0x2521('0x93')){logger['info'](_0x2521('0x94'),_0x2521('0x83'));_0x221735[_0x2521('0x84')]=_0x2810e7[_0x2521('0x91')]+'/api/voice/recordings/'+_0x221735['uniqueid']+_0x2521('0x86')+md5(_0x221735[_0x2521('0x85')]);}var _0x2fa4c7=_0x2810e7[_0x2521('0x81')]===_0x2521('0x87')?'eu':_0x2521('0x88');return getAccessToken(_0x2810e7)[_0x2521('0x2d')](function(_0xa1fe31){_0x4357d0=_0xa1fe31;return getUser(_0x4357d0,_0x2fa4c7,_0x2810e7,_0x5cd536[_0x2521('0x95')]);})[_0x2521('0x2d')](function(_0x93c14b){_0x191c80=_0x93c14b;logger['info'](_0x2521('0x96'),_0x191c80['id']);return getEndUser(_0x4357d0,_0x2fa4c7,_0x2810e7,_0x221735[_0x2521('0x97')],_0x221735['destcalleridnum'],_0x191c80,_0x1eaee0);})[_0x2521('0x2d')](function(_0x23162b){_0x45fb11=_0x23162b;return getCall(_0x4357d0,_0x2fa4c7,_0x2810e7,_0x191c80,_0x45fb11,_0x1eaee0,_0x221735,_0x2521('0x98'));})[_0x2521('0x2d')](function(_0x47e250){if(_0x47e250){logger[_0x2521('0x31')](_0x2521('0x8b'),_0x47e250['id']);logger['info'](_0x2521('0x94'),_0x2521('0x8d'));emit(util['format']('user:%s',_0x5cd536[_0x2521('0x1c')]),_0x2521('0x8e'),{'uri':_0x2521('0x8f')+_0x2810e7[_0x2521('0x81')]+_0x2521('0x90')+_0x47e250['id']});}})['catch'](function(_0x5ba822){logger['error'](_0x2521('0x94'),JSON[_0x2521('0xf')](_0x5ba822));});};exports['unmanaged']=function(_0x12e9d0,_0x891b7f,_0x13573f,_0x233e9f,_0x211c78,_0x2efb05){var _0x13ea5b,_0x7f1047,_0x29c6e6;_0x2efb05[_0x2521('0x81')]=intUtil[_0x2521('0x82')](_0x2efb05[_0x2521('0x81')]);_0x2efb05['serverUrl']=intUtil[_0x2521('0x82')](_0x2efb05[_0x2521('0x91')]);if(_0x211c78&&_0x211c78[_0x2521('0x99')]){logger[_0x2521('0x31')]('['+_0x891b7f['lastevent']['toUpperCase']()+']',_0x2521('0x83'));_0x891b7f[_0x2521('0x84')]=_0x2efb05[_0x2521('0x91')]+_0x2521('0x9a')+_0x891b7f[_0x2521('0x85')]+_0x2521('0x86')+md5(_0x891b7f[_0x2521('0x85')]);}else{_0x891b7f[_0x2521('0x84')]='';}var _0xcca901=_0x2efb05[_0x2521('0x81')]==='zoho.eu'?'eu':_0x2521('0x88');return getAccessToken(_0x2efb05)[_0x2521('0x2d')](function(_0x5c94b9){_0x29c6e6=_0x5c94b9;return getUser(_0x29c6e6,_0xcca901,_0x2efb05);})[_0x2521('0x2d')](function(_0x3e0c49){_0x13ea5b=_0x3e0c49;logger[_0x2521('0x31')](_0x2521('0x96'),_0x13ea5b['id']);return getEndUser(_0x29c6e6,_0xcca901,_0x2efb05,_0x891b7f[_0x2521('0x89')],_0x891b7f[_0x2521('0x8a')],_0x13ea5b,_0x13573f);})['then'](function(_0x3832e5){_0x7f1047=_0x3832e5;return getCall(_0x29c6e6,_0xcca901,_0x2efb05,_0x13ea5b,_0x7f1047,_0x13573f,_0x891b7f,'Inbound');})['then'](function(_0x414bea){if(_0x414bea){logger[_0x2521('0x31')](_0x2521('0x8b'),_0x414bea['id']);}})[_0x2521('0x40')](function(_0x3813a4){logger[_0x2521('0x41')]('['+_0x891b7f[_0x2521('0x6d')][_0x2521('0x9b')]()+']',JSON[_0x2521('0xf')](_0x3813a4));});}; \ No newline at end of file +var _0x7623=['toLowerCase','indexOf','split','isNil','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','expires_in','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','stringify','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','/crm/v2/','startCase','role','first_name','last_name','data','code','Error:\x20','log','CREATE\x20ERROR','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','moduleCreate','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','diff','starttime','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','Call_Type','Inbound','/crm/v2/Calls','SUCCESS','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','Recording\x20is\x20enabled!','/api/voice/recordings/','Outbound','trigger:browser:url','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','calleridnum','lodash','request-promise','md5','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','emit','debug','[HTTP]','length','forEach','includes','picklist','type','idField','variableName','toString','Variable','name'];(function(_0x49c008,_0x15dfd1){var _0x2626e4=function(_0xc1bfbd){while(--_0xc1bfbd){_0x49c008['push'](_0x49c008['shift']());}};_0x2626e4(++_0x15dfd1);}(_0x7623,0x80));var _0x3762=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x7623[_0x2dc343];return _0x51eac5;};'use strict';var _=require(_0x3762('0x0'));var rp=require(_0x3762('0x1'));var md5=require(_0x3762('0x2'));var util=require('util');var intUtil=require('./util');var moment=require(_0x3762('0x3'));var Redis=require(_0x3762('0x4'));var BPromise=require('bluebird');var config=require(_0x3762('0x5'));var logger=require(_0x3762('0x6'))('zoho');config[_0x3762('0x7')]=_[_0x3762('0x8')](config[_0x3762('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3762('0x7')]));function emit(_0xdb5d70,_0x418e15,_0x523b44){io['to'](_0xdb5d70)[_0x3762('0x9')](_0x418e15,_0x523b44);}function request(_0x20272d){logger[_0x3762('0xa')](_0x3762('0xb'),JSON['stringify'](_0x20272d));return rp(_0x20272d);}function getCustomFields(_0x402772,_0x2a8d05){var _0xfe5843={};if(_0x402772[_0x3762('0xc')]>0x0){_[_0x3762('0xd')](_0x402772,function(_0x3d5941){if(_[_0x3762('0xe')](['string',_0x3762('0xf')],_0x3d5941[_0x3762('0x10')])&&_0x3d5941[_0x3762('0x11')]){_0xfe5843[_0x3d5941[_0x3762('0x11')]]=_0x3d5941['content']['toString']();}else if(_0x3d5941[_0x3762('0x10')]==='variable'&&_0x3d5941[_0x3762('0x12')]&&_0x3d5941[_0x3762('0x11')]&&_0x2a8d05[_0x3d5941[_0x3762('0x12')]]){_0xfe5843[_0x3d5941[_0x3762('0x11')]]=_0x2a8d05[_0x3d5941[_0x3762('0x12')]][_0x3762('0x13')]();}else if(_0x3d5941[_0x3762('0x10')]==='customVariable'&&_0x3d5941['Variable']&&_0x3d5941[_0x3762('0x14')]['name']&&_0x3d5941[_0x3762('0x11')]&&_0x2a8d05[_0x3d5941[_0x3762('0x14')][_0x3762('0x15')][_0x3762('0x16')]()]){_0xfe5843[_0x3d5941['idField']]=_0x2a8d05[_0x3d5941[_0x3762('0x14')][_0x3762('0x15')][_0x3762('0x16')]()][_0x3762('0x13')]();}});}return _0xfe5843;}function getName(_0x4e05c2){if(_0x4e05c2[_0x3762('0x17')]('\x20')>0x0){var _0x32ac84=_0x4e05c2[_0x3762('0x18')](/ (.+)/);if(_0x32ac84[0x1]){return _0x32ac84;}}return[_0x4e05c2,_0x4e05c2];}var accountsTokens={};function getAccessToken(_0x509c12){return new Promise(function(_0x58e895,_0x3b0d52){if(!_[_0x3762('0x19')](accountsTokens[_0x509c12['id']])&&!_[_0x3762('0x19')](accountsTokens[_0x509c12['id']][_0x3762('0x1a')])){if(moment()[_0x3762('0x1b')](accountsTokens[_0x509c12['id']]['expires_in'])){_0x58e895(accountsTokens[_0x509c12['id']]['access_token']);}}var _0x1e20f7;switch(_0x509c12['zone']){case'US':_0x1e20f7=_0x3762('0x1c');break;case'AU':_0x1e20f7=_0x3762('0x1d');break;case'EU':_0x1e20f7=_0x3762('0x1e');break;case'IN':_0x1e20f7=_0x3762('0x1f');break;case'CN':_0x1e20f7=_0x3762('0x20');break;default:_0x1e20f7=_0x3762('0x1e');break;}var _0x2b4a66={'method':_0x3762('0x21'),'uri':_0x1e20f7+'/oauth/v2/token','qs':{'refresh_token':_0x509c12[_0x3762('0x22')],'client_id':_0x509c12[_0x3762('0x23')],'client_secret':_0x509c12[_0x3762('0x24')],'grant_type':_0x3762('0x25')},'json':!![]};return rp(_0x2b4a66)[_0x3762('0x26')](function(_0x413dd8){accountsTokens[_0x509c12['id']]={'access_token':_0x413dd8[_0x3762('0x1a')],'expires_in':moment()['add'](_0x413dd8[_0x3762('0x27')],'seconds')};_0x58e895(_0x413dd8[_0x3762('0x1a')]);})[_0x3762('0x28')](function(_0x144c41){logger[_0x3762('0x29')](_0x3762('0x2a'),_0x144c41[_0x3762('0x2b')]);_0x3b0d52(_0x144c41);});});}function getUser(_0x3c8f75,_0x3330d4,_0x33afac,_0x596daf){logger[_0x3762('0x2c')](_0x3762('0x2d'));return request({'method':_0x3762('0x2e'),'uri':util[_0x3762('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x3330d4),'qs':{'type':_0x3762('0x30')},'headers':{'Authorization':_0x3762('0x31')+_0x3c8f75},'json':!![]})['then'](function(_0x2bfc64){if(_0x2bfc64[_0x3762('0x32')]){var _0x2ffb00=-0x1;if(_[_0x3762('0x33')](_0x2bfc64[_0x3762('0x32')])){if(!_['isNil'](_0x596daf)){_0x2ffb00=_[_0x3762('0x34')](_0x2bfc64[_0x3762('0x32')],function(_0xd13e76){return _0xd13e76[_0x3762('0x35')]===_0x596daf;});}if(_0x2ffb00>=0x0){logger['info'](_0x3762('0x36'));}else{logger[_0x3762('0x2c')](_0x3762('0x37'));_0x2ffb00=_['findIndex'](_0x2bfc64[_0x3762('0x32')],function(_0x1a1b4b){return _0x1a1b4b[_0x3762('0x38')]['name']===_0x3762('0x39');});}return _0x2bfc64[_0x3762('0x32')][_0x2ffb00];}else{if(_0x2bfc64[_0x3762('0x3a')][_0x3762('0x38')][_0x3762('0x15')]===_0x3762('0x39')){logger[_0x3762('0x2c')]('Using\x20the\x20admin\x20account!');user=_0x2bfc64[_0x3762('0x3a')];return user;}else{logger[_0x3762('0x29')]('The\x20failing\x20result\x20is',JSON[_0x3762('0x3b')](_0x2bfc64));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x2bfc64));}}}else{logger[_0x3762('0x29')](_0x3762('0x3c'),JSON['stringify'](_0x2bfc64));throw new Error(_0x3762('0x3d')+JSON[_0x3762('0x3b')](_0x2bfc64));}})[_0x3762('0x28')](function(_0x20746a){console[_0x3762('0x29')](_0x20746a);});}function getZohoUser(_0x533939,_0x23c97e){return new BPromise(function(_0x2a80d2,_0x83593c){request(_0x533939)['then'](function(_0x23c1d5){var _0x4737c7=null;if(_0x23c1d5){_0x4737c7=_0x23c1d5['data'][0x0];_0x4737c7[_0x3762('0x3e')]=_0x23c97e;}_0x2a80d2(_0x4737c7);})['catch'](function(_0x25e23a){_0x83593c(_0x25e23a);});});}function createEndUser(_0x2ceba3,_0x3d5673,_0x4b8a93,_0x4909a3,_0x51288f,_0x307df1){var _0x4b8a93=getName(_0x4b8a93);return request({'method':_0x3762('0x21'),'uri':'https://www.zohoapis.'+_0x3d5673+_0x3762('0x3f')+_[_0x3762('0x40')](_0x307df1['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4b8a93[0x1],'First_Name':_0x4b8a93[0x0],'Phone':_0x4909a3,'Owner':{'name':!_['isNil'](_0x51288f[_0x3762('0x41')]['name'])?_0x51288f[_0x3762('0x41')][_0x3762('0x15')]:!_[_0x3762('0x19')](_0x51288f[_0x3762('0x42')])?_0x51288f[_0x3762('0x42')]+'\x20'+_0x51288f[_0x3762('0x43')]:_0x51288f[_0x3762('0x43')],'id':_0x51288f['id']}}]},'headers':{'Authorization':_0x3762('0x31')+_0x2ceba3},'json':!![]})[_0x3762('0x26')](function(_0x5a3165){if(_0x5a3165&&_0x5a3165[_0x3762('0x44')][0x0][_0x3762('0x45')]==='SUCCESS'){var _0x36e493=_0x5a3165['data'][0x0]['details'];_0x36e493[_0x3762('0x3e')]=_['startCase'](_0x307df1['moduleCreate'])+'s';return _0x36e493;}logger[_0x3762('0x29')](_0x3762('0x3c'),JSON['stringify'](data));throw new Error(_0x3762('0x46')+JSON[_0x3762('0x3b')](data));})['catch'](function(_0x1ed815){console[_0x3762('0x47')](_0x3762('0x48'),_0x1ed815);});}function getEndUser(_0x566c5c,_0x5630de,_0x199b89,_0x2a0a33,_0x19f058,_0x417940,_0x6bc528){var _0x37e55b={'method':_0x3762('0x2e'),'uri':'','headers':{'Authorization':_0x3762('0x31')+_0x566c5c},'json':!![]};switch(_0x6bc528['moduleSearch']){case'contact_lead':_0x37e55b[_0x3762('0x49')]=_0x3762('0x4a')+_0x5630de+_0x3762('0x4b')+_0x19f058+'))';return getZohoUser(_0x37e55b,_0x3762('0x4c'))['then'](function(_0x3ce377){if(_0x3ce377)return _0x3ce377;_0x37e55b[_0x3762('0x49')]='https://www.zohoapis.'+_0x5630de+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x19f058+'))';return getZohoUser(_0x37e55b,_0x3762('0x4d'))['then'](function(_0x5a3355){if(_0x5a3355)return _0x5a3355;if(_0x6bc528[_0x3762('0x4e')]!=_0x3762('0x4f')){return createEndUser(_0x566c5c,_0x5630de,_0x2a0a33,_0x19f058,_0x417940,_0x6bc528);}else{return{};}});});break;case'contact':_0x37e55b[_0x3762('0x49')]=_0x3762('0x4a')+_0x5630de+_0x3762('0x4b')+_0x19f058+'))';return getZohoUser(_0x37e55b,'Contacts')['then'](function(_0x54fbb5){if(_0x54fbb5)return _0x54fbb5;if(_0x6bc528['moduleCreate']!=_0x3762('0x4f')){return createEndUser(_0x566c5c,_0x5630de,_0x2a0a33,_0x19f058,_0x417940,_0x6bc528);}else{return{};}});break;case _0x3762('0x50'):_0x37e55b['uri']=_0x3762('0x4a')+_0x5630de+_0x3762('0x51')+_0x19f058+'))';return getZohoUser(_0x37e55b,_0x3762('0x4d'))[_0x3762('0x26')](function(_0x57ce06){if(_0x57ce06)return _0x57ce06;if(_0x6bc528['moduleCreate']!=_0x3762('0x4f')){return createEndUser(_0x566c5c,_0x5630de,_0x2a0a33,_0x19f058,_0x417940,_0x6bc528);}else{return{};}});break;}}function getCall(_0x34f775,_0xbcf4ce,_0x4c18a5,_0x3ae71b,_0x299893,_0x20de5b,_0x2fbc1e,_0x2d5f59){logger[_0x3762('0x2c')](_0x3762('0x52'));var _0x539484={};_0x539484[_0x3762('0x53')]={'name':!_['isNil'](_0x3ae71b['role']['name'])&&!_['isNil'](_0x3ae71b['profile']['name'])&&_0x3ae71b[_0x3762('0x38')][_0x3762('0x15')]===_0x3762('0x54')?_0x3ae71b[_0x3762('0x41')][_0x3762('0x15')]:!_[_0x3762('0x19')](_0x3ae71b[_0x3762('0x42')])?_0x3ae71b[_0x3762('0x42')]+'\x20'+_0x3ae71b['last_name']:_0x3ae71b[_0x3762('0x43')],'id':_0x3ae71b['id']};_0x539484[_0x3762('0x55')]=intUtil[_0x3762('0x56')](_0x20de5b[_0x3762('0x57')],_0x2fbc1e,'\x20');_0x539484[_0x3762('0x58')]=intUtil[_0x3762('0x56')](_0x20de5b['Descriptions'],_0x2fbc1e,'\x0a');if(_0x299893['enduserType']===_0x3762('0x4c')){_0x539484['Who_Id']={'name':!_[_0x3762('0x19')](_0x299893['Full_Name'])?_0x299893[_0x3762('0x59')]:!_[_0x3762('0x19')](_0x299893['First_Name'])?_0x299893['First_Name']+'\x20'+_0x299893[_0x3762('0x5a')]:_0x299893['Last_Name'],'id':_0x299893['id']};}if(_0x299893['enduserType']==='Leads'){_0x539484[_0x3762('0x5b')]={'name':!_[_0x3762('0x19')](_0x299893[_0x3762('0x59')])?_0x299893[_0x3762('0x59')]:!_['isNil'](_0x299893[_0x3762('0x5c')])?_0x299893[_0x3762('0x5c')]+'\x20'+_0x299893[_0x3762('0x5a')]:_0x299893[_0x3762('0x5a')],'id':_0x299893['id']};_0x539484[_0x3762('0x5d')]=_[_0x3762('0x40')](_0x299893[_0x3762('0x3e')]);}if(_0x2fbc1e[_0x3762('0x5e')]){_0x539484['Call_Duration']=moment[_0x3762('0x5f')](parseInt(_0x2fbc1e['talktime'])*0x3e8)[_0x3762('0x2f')](_0x3762('0x60'));}else if(_0x2fbc1e[_0x3762('0x61')]&&_0x2fbc1e[_0x3762('0x62')]){_0x539484[_0x3762('0x63')]=moment['utc'](moment(_0x2fbc1e[_0x3762('0x62')],'YYYY-MM-DDTHH:mm:ss')[_0x3762('0x64')](moment(_0x2fbc1e[_0x3762('0x65')],'YYYY-MM-DDTHH:mm:ss')))[_0x3762('0x2f')]('mm:ss');}switch(_0x2fbc1e[_0x3762('0x66')]){case _0x3762('0x67'):_0x539484['Call_Result']=_0x3762('0x68');break;case _0x3762('0x69'):case _0x3762('0x6a'):_0x539484[_0x3762('0x6b')]=_0x3762('0x6c');break;case _0x3762('0x6d'):_0x539484[_0x3762('0x6b')]=_0x3762('0x6e');break;case'abandoned':_0x539484[_0x3762('0x6b')]=_0x3762('0x6f');break;case _0x3762('0x70'):_0x539484[_0x3762('0x6b')]=_0x3762('0x71');default:}_0x539484[_0x3762('0x72')]=(_0x2d5f59===_0x3762('0x73')?moment(_0x2fbc1e[_0x3762('0x65')])[_0x3762('0x2f')](_0x3762('0x74')):moment(_0x2fbc1e['agentcalledAt'])[_0x3762('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x3762('0x2f')](_0x3762('0x74'));_0x539484[_0x3762('0x75')]=_0x2d5f59||_0x3762('0x76');_0x539484=_['merge'](_0x539484,getCustomFields(_0x20de5b['Fields'],_0x2fbc1e));return request({'method':_0x3762('0x21'),'uri':_0x3762('0x4a')+_0xbcf4ce+_0x3762('0x77'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x34f775},'body':{'data':[_0x539484]},'json':!![]})[_0x3762('0x26')](function(_0x2b7607){if(_0x2b7607&&_0x2b7607[_0x3762('0x44')][0x0][_0x3762('0x45')]===_0x3762('0x78')){logger[_0x3762('0x2c')](_0x3762('0x79'));return{'id':_0x2b7607[_0x3762('0x44')][0x0][_0x3762('0x7a')]['id']};}})['catch'](function(_0x596e2f){logger['info'](_0x3762('0x7b'),_0x596e2f[_0x3762('0x2b')]);console[_0x3762('0x47')](_0x3762('0x7b'),_0x596e2f);});}exports[_0x3762('0x7c')]=function(_0x4ef62e,_0x3a718c,_0x225841,_0x587788,_0x97bb94,_0x1446ae){var _0xa6d172,_0x35ee22,_0x4377f7;_0x1446ae[_0x3762('0x7d')]=intUtil[_0x3762('0x7e')](_0x1446ae[_0x3762('0x7d')]);_0x1446ae[_0x3762('0x7f')]=intUtil[_0x3762('0x7e')](_0x1446ae[_0x3762('0x7f')]);if(_0x97bb94&&_0x97bb94['monitor_format']){logger[_0x3762('0x2c')](_0x3762('0x80'),'Recording\x20is\x20enabled!');_0x3a718c[_0x3762('0x81')]=_0x1446ae[_0x3762('0x7f')]+'/api/voice/recordings/'+_0x3a718c['uniqueid']+_0x3762('0x82')+md5(_0x3a718c[_0x3762('0x83')]);}else{_0x3a718c[_0x3762('0x81')]='';}var _0x2bfd2b=_0x1446ae[_0x3762('0x7d')]===_0x3762('0x84')?'eu':_0x3762('0x85');return getAccessToken(_0x1446ae)[_0x3762('0x26')](function(_0x525522){_0x4377f7=_0x525522;return getUser(_0x4377f7,_0x2bfd2b,_0x1446ae,_0x587788['email']);})[_0x3762('0x26')](function(_0x21b379){_0xa6d172=_0x21b379;logger[_0x3762('0x2c')](_0x3762('0x86'),_0xa6d172['id']);return getEndUser(_0x4377f7,_0x2bfd2b,_0x1446ae,_0x3a718c[_0x3762('0x87')],_0x3a718c['calleridnum'],_0xa6d172,_0x225841);})['then'](function(_0x5d1aa3){_0x35ee22=_0x5d1aa3;return getCall(_0x4377f7,_0x2bfd2b,_0x1446ae,_0xa6d172,_0x35ee22,_0x225841,_0x3a718c,_0x3762('0x76'));})[_0x3762('0x26')](function(_0x20a438){if(_0x20a438){logger[_0x3762('0x2c')](_0x3762('0x88'),_0x20a438['id']);logger[_0x3762('0x2c')](_0x3762('0x80'),_0x3762('0x89'));emit(util[_0x3762('0x2f')](_0x3762('0x8a'),_0x587788[_0x3762('0x15')]),'trigger:browser:url',{'uri':'https://crm.'+_0x1446ae[_0x3762('0x7d')]+_0x3762('0x8b')+_0x20a438['id']});}})[_0x3762('0x28')](function(_0xc0f6c6){logger['error'](_0x3762('0x80'),JSON[_0x3762('0x3b')](_0xc0f6c6));});};exports[_0x3762('0x73')]=function(_0x19f2a5,_0x330eb6,_0x27aa22,_0x2c2291,_0x509ce9,_0x105254,_0x17791d){var _0x5838f1,_0x4783a8,_0x5ea076;_0x105254[_0x3762('0x7d')]=intUtil[_0x3762('0x7e')](_0x105254[_0x3762('0x7d')]);_0x105254[_0x3762('0x7f')]=intUtil['stripTrailingSlash'](_0x105254[_0x3762('0x7f')]);if(_0x17791d&&_0x17791d[_0x3762('0x8c')]&&_0x17791d[_0x3762('0x8c')]!=='none'){logger[_0x3762('0x2c')]('[OUTBOUND]',_0x3762('0x8d'));_0x330eb6['recordingURL']=_0x105254['serverUrl']+_0x3762('0x8e')+_0x330eb6['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x330eb6[_0x3762('0x83')]);}var _0x2569ef=_0x105254['host']==='zoho.eu'?'eu':_0x3762('0x85');return getAccessToken(_0x105254)[_0x3762('0x26')](function(_0x73adc4){_0x5ea076=_0x73adc4;return getUser(_0x5ea076,_0x2569ef,_0x105254,_0x2c2291[_0x3762('0x35')]);})[_0x3762('0x26')](function(_0x130cf3){_0x5838f1=_0x130cf3;logger[_0x3762('0x2c')](_0x3762('0x86'),_0x5838f1['id']);return getEndUser(_0x5ea076,_0x2569ef,_0x105254,_0x330eb6['destcalleridname'],_0x330eb6['destcalleridnum'],_0x5838f1,_0x27aa22);})[_0x3762('0x26')](function(_0x26edb0){_0x4783a8=_0x26edb0;return getCall(_0x5ea076,_0x2569ef,_0x105254,_0x5838f1,_0x4783a8,_0x27aa22,_0x330eb6,_0x3762('0x8f'));})[_0x3762('0x26')](function(_0x1f8ca9){if(_0x1f8ca9){logger[_0x3762('0x2c')](_0x3762('0x88'),_0x1f8ca9['id']);logger[_0x3762('0x2c')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3762('0x2f')]('user:%s',_0x2c2291[_0x3762('0x15')]),_0x3762('0x90'),{'uri':'https://crm.'+_0x105254[_0x3762('0x7d')]+_0x3762('0x8b')+_0x1f8ca9['id']});}})[_0x3762('0x28')](function(_0x434627){logger[_0x3762('0x29')](_0x3762('0x91'),JSON['stringify'](_0x434627));});};exports[_0x3762('0x92')]=function(_0x385b93,_0x1d6554,_0x24ca44,_0x2c1cff,_0x319f33,_0x3108fb){var _0x41895f,_0x55d9f2,_0x381d99;_0x3108fb[_0x3762('0x7d')]=intUtil[_0x3762('0x7e')](_0x3108fb[_0x3762('0x7d')]);_0x3108fb['serverUrl']=intUtil['stripTrailingSlash'](_0x3108fb[_0x3762('0x7f')]);if(_0x319f33&&_0x319f33[_0x3762('0x93')]){logger['info']('['+_0x1d6554[_0x3762('0x66')][_0x3762('0x94')]()+']',_0x3762('0x8d'));_0x1d6554['recordingURL']=_0x3108fb[_0x3762('0x7f')]+'/api/voice/recordings/'+_0x1d6554[_0x3762('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x1d6554['uniqueid']);}else{_0x1d6554[_0x3762('0x81')]='';}var _0x520a3e=_0x3108fb['host']===_0x3762('0x84')?'eu':_0x3762('0x85');return getAccessToken(_0x3108fb)['then'](function(_0x12c71e){_0x381d99=_0x12c71e;return getUser(_0x381d99,_0x520a3e,_0x3108fb);})['then'](function(_0x2fb79f){_0x41895f=_0x2fb79f;logger[_0x3762('0x2c')]('The\x20User\x20ID\x20is:',_0x41895f['id']);return getEndUser(_0x381d99,_0x520a3e,_0x3108fb,_0x1d6554[_0x3762('0x87')],_0x1d6554[_0x3762('0x95')],_0x41895f,_0x24ca44);})[_0x3762('0x26')](function(_0x373b1f){_0x55d9f2=_0x373b1f;return getCall(_0x381d99,_0x520a3e,_0x3108fb,_0x41895f,_0x55d9f2,_0x24ca44,_0x1d6554,'Inbound');})[_0x3762('0x26')](function(_0x546147){if(_0x546147){logger[_0x3762('0x2c')]('The\x20Call\x20ID\x20is:',_0x546147['id']);}})[_0x3762('0x28')](function(_0x48fbca){logger[_0x3762('0x29')]('['+_0x1d6554['lastevent']['toUpperCase']()+']',JSON[_0x3762('0x3b')](_0x48fbca));});}; \ 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 967be0a..04750f1 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 _0x109c=['data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','render'];(function(_0x5091b2,_0x3d3ba){var _0x70d24e=function(_0x5a61cd){while(--_0x5a61cd){_0x5091b2['push'](_0x5091b2['shift']());}};_0x70d24e(++_0x3d3ba);}(_0x109c,0x118));var _0xc109=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x109c[_0x3b380d];return _0x54502b;};'use strict';var util=require(_0xc109('0x0'));var sh=require(_0xc109('0x1'));var Mustache=require(_0xc109('0x2'));var logger=require(_0xc109('0x3'))(_0xc109('0x4'));exports[_0xc109('0x5')]=function(_0x49709a,_0x568dc4){var _0x34004f=_0x49709a[_0xc109('0x6')]?_0x49709a[_0xc109('0x6')]:'Script';var _0x291ef9=_0x49709a['data3']?Mustache[_0xc109('0x7')](_0x49709a[_0xc109('0x8')],_0x568dc4):_0x568dc4;sh[_0xc109('0x5')](_0x291ef9,function(_0x5d91fd,_0x915c86,_0x27481d){if(_0x5d91fd!==0x0){logger['error'](util['format'](_0xc109('0x9'),_0x34004f,_0x291ef9,_0x5d91fd,_0x27481d));}else{logger[_0xc109('0xa')](util[_0xc109('0xb')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x34004f,_0x291ef9,_0x915c86));}});}; \ No newline at end of file +var _0xac64=['render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3'];(function(_0x2837fc,_0x14c840){var _0x5054dc=function(_0x552bd9){while(--_0x552bd9){_0x2837fc['push'](_0x2837fc['shift']());}};_0x5054dc(++_0x14c840);}(_0xac64,0x117));var _0x4ac6=function(_0x568df5,_0x2e23a9){_0x568df5=_0x568df5-0x0;var _0x38b4b9=_0xac64[_0x568df5];return _0x38b4b9;};'use strict';var util=require('util');var sh=require(_0x4ac6('0x0'));var Mustache=require(_0x4ac6('0x1'));var logger=require(_0x4ac6('0x2'))(_0x4ac6('0x3'));exports['exec']=function(_0x28d59b,_0x5d8354){var _0x153b81=_0x28d59b[_0x4ac6('0x4')]?_0x28d59b['data2']:_0x4ac6('0x5');var _0x388a1d=_0x28d59b[_0x4ac6('0x6')]?Mustache[_0x4ac6('0x7')](_0x28d59b[_0x4ac6('0x6')],_0x5d8354):_0x5d8354;sh['exec'](_0x388a1d,function(_0x4528a4,_0x52c8da,_0x33e3dd){if(_0x4528a4!==0x0){logger[_0x4ac6('0x8')](util[_0x4ac6('0x9')](_0x4ac6('0xa'),_0x153b81,_0x388a1d,_0x4528a4,_0x33e3dd));}else{logger[_0x4ac6('0xb')](util[_0x4ac6('0x9')](_0x4ac6('0xc'),_0x153b81,_0x388a1d,_0x52c8da));}});}; \ 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 5401d6f..87db86a 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 _0x8d51=['number','headers','data6','error','stack','data1','GET','DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','toUpperCase','render','data2','data5'];(function(_0x21bf22,_0x16172a){var _0x144ee9=function(_0x39e76c){while(--_0x39e76c){_0x21bf22['push'](_0x21bf22['shift']());}};_0x144ee9(++_0x16172a);}(_0x8d51,0x85));var _0x18d5=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x8d51[_0x4b2863];return _0x567d67;};'use strict';var rp=require(_0x18d5('0x0'));var util=require(_0x18d5('0x1'));var _=require(_0x18d5('0x2'));var Mustache=require(_0x18d5('0x3'));var logger=require(_0x18d5('0x4'))(_0x18d5('0x5'));exports[_0x18d5('0x6')]=function(_0x49dd43,_0x4e828d){var _0x3dfdc3,_0x27fef5;var _0x768f38={'method':_0x49dd43['data1'][_0x18d5('0x7')](),'uri':Mustache[_0x18d5('0x8')](_0x49dd43[_0x18d5('0x9')],_0x4e828d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x49dd43[_0x18d5('0xa')])===_0x18d5('0xb')&&parseInt(_0x49dd43['data5'])>=0x1&&parseInt(_0x49dd43[_0x18d5('0xa')])<=0xa?parseInt(_0x49dd43[_0x18d5('0xa')])*0x3e8:0x5*0x3e8};try{_0x768f38[_0x18d5('0xc')]=_0x49dd43[_0x18d5('0xd')]?JSON['parse'](Mustache[_0x18d5('0x8')](_0x49dd43[_0x18d5('0xd')],_0x4e828d)):{};}catch(_0x4a8e68){logger[_0x18d5('0xe')](_0x4a8e68[_0x18d5('0xf')]);}switch(_0x49dd43[_0x18d5('0x10')][_0x18d5('0x7')]()){case _0x18d5('0x11'):case _0x18d5('0x12'):_0x3dfdc3=null;_0x768f38['qs']=_0x4e828d;break;case _0x18d5('0x13'):case'PUT':if(_0x49dd43[_0x18d5('0x14')]){try{_0x3dfdc3=JSON['parse'](Mustache[_0x18d5('0x8')](_0x49dd43[_0x18d5('0x14')],_0x4e828d));_0x768f38[_0x18d5('0x15')]=_0x3dfdc3;}catch(_0x2f42b9){logger[_0x18d5('0xe')](_0x2f42b9['stack']);logger[_0x18d5('0xe')](_0x18d5('0x16'));}}else{_0x3dfdc3=_0x4e828d;_0x768f38['body']=_0x3dfdc3;}break;}logger[_0x18d5('0x17')](util[_0x18d5('0x18')](_0x18d5('0x19'),_0x49dd43[_0x18d5('0x10')],_0x49dd43[_0x18d5('0x9')],JSON[_0x18d5('0x1a')](_0x768f38)));rp(_0x768f38)[_0x18d5('0x1b')](function(_0x390688){_0x3dfdc3=!_[_0x18d5('0x1c')](_0x3dfdc3)?',\x20request\x20body:\x20'+_0x3dfdc3:'';_0x27fef5=typeof _0x390688[_0x18d5('0x15')]===_0x18d5('0x1d')?JSON[_0x18d5('0x1a')](_0x390688[_0x18d5('0x15')]):_0x390688[_0x18d5('0x15')];logger[_0x18d5('0x17')](util[_0x18d5('0x18')](_0x18d5('0x1e'),_0x49dd43['data1'],_0x49dd43[_0x18d5('0x9')],_0x390688[_0x18d5('0x1f')],_0x27fef5));})[_0x18d5('0x20')](function(_0x1efa6b){logger[_0x18d5('0xe')](util[_0x18d5('0x18')](_0x18d5('0x21'),_0x49dd43['data1'],_0x49dd43[_0x18d5('0x9')],_0x1efa6b[_0x18d5('0x1f')],_0x1efa6b[_0x18d5('0x22')],_0x1efa6b[_0x18d5('0x23')]));});}; \ No newline at end of file +var _0x0f03=['parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','util','lodash','mustache','../../../../config/logger','exec','data1','data5','data6','render','error','stack','toUpperCase','GET','DELETE','POST','PUT','data7'];(function(_0x17598a,_0x2c88bd){var _0x18360e=function(_0x288ff7){while(--_0x288ff7){_0x17598a['push'](_0x17598a['shift']());}};_0x18360e(++_0x2c88bd);}(_0x0f03,0x120));var _0x30f0=function(_0x539214,_0x5f1453){_0x539214=_0x539214-0x0;var _0x3ed627=_0x0f03[_0x539214];return _0x3ed627;};'use strict';var rp=require(_0x30f0('0x0'));var util=require(_0x30f0('0x1'));var _=require(_0x30f0('0x2'));var Mustache=require(_0x30f0('0x3'));var logger=require(_0x30f0('0x4'))('trigger');exports[_0x30f0('0x5')]=function(_0x16c6b0,_0x46452e){var _0x8aca7f,_0x2ce8e4;var _0xfbe391={'method':_0x16c6b0[_0x30f0('0x6')]['toUpperCase'](),'uri':Mustache['render'](_0x16c6b0['data2'],_0x46452e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x16c6b0[_0x30f0('0x7')])==='number'&&parseInt(_0x16c6b0[_0x30f0('0x7')])>=0x1&&parseInt(_0x16c6b0[_0x30f0('0x7')])<=0xa?parseInt(_0x16c6b0[_0x30f0('0x7')])*0x3e8:0x5*0x3e8};try{_0xfbe391['headers']=_0x16c6b0[_0x30f0('0x8')]?JSON['parse'](Mustache[_0x30f0('0x9')](_0x16c6b0[_0x30f0('0x8')],_0x46452e)):{};}catch(_0x1e42a9){logger[_0x30f0('0xa')](_0x1e42a9[_0x30f0('0xb')]);}switch(_0x16c6b0['data1'][_0x30f0('0xc')]()){case _0x30f0('0xd'):case _0x30f0('0xe'):_0x8aca7f=null;_0xfbe391['qs']=_0x46452e;break;case _0x30f0('0xf'):case _0x30f0('0x10'):if(_0x16c6b0[_0x30f0('0x11')]){try{_0x8aca7f=JSON[_0x30f0('0x12')](Mustache['render'](_0x16c6b0[_0x30f0('0x11')],_0x46452e));_0xfbe391[_0x30f0('0x13')]=_0x8aca7f;}catch(_0x3f175a){logger[_0x30f0('0xa')](_0x3f175a['stack']);logger[_0x30f0('0xa')](_0x30f0('0x14'));}}else{_0x8aca7f=_0x46452e;_0xfbe391[_0x30f0('0x13')]=_0x8aca7f;}break;}logger[_0x30f0('0x15')](util[_0x30f0('0x16')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x16c6b0['data1'],_0x16c6b0[_0x30f0('0x17')],JSON[_0x30f0('0x18')](_0xfbe391)));rp(_0xfbe391)[_0x30f0('0x19')](function(_0x2bb6e1){_0x8aca7f=!_[_0x30f0('0x1a')](_0x8aca7f)?_0x30f0('0x1b')+_0x8aca7f:'';_0x2ce8e4=typeof _0x2bb6e1[_0x30f0('0x13')]===_0x30f0('0x1c')?JSON[_0x30f0('0x18')](_0x2bb6e1['body']):_0x2bb6e1[_0x30f0('0x13')];logger[_0x30f0('0x15')](util[_0x30f0('0x16')](_0x30f0('0x1d'),_0x16c6b0[_0x30f0('0x6')],_0x16c6b0[_0x30f0('0x17')],_0x2bb6e1[_0x30f0('0x1e')],_0x2ce8e4));})[_0x30f0('0x1f')](function(_0x34a2ba){logger['error'](util[_0x30f0('0x16')](_0x30f0('0x20'),_0x16c6b0[_0x30f0('0x6')],_0x16c6b0[_0x30f0('0x17')],_0x34a2ba[_0x30f0('0x1e')],_0x34a2ba[_0x30f0('0x21')],_0x34a2ba['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 7dced68..139f2fb 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 _0xb146=['routing','error','rpc','message','result','catch','exports','jayson/promise','../../config/logger','client','http','Request','request','then','debug'];(function(_0x3ce61f,_0x1cbf9a){var _0x597437=function(_0x1f16eb){while(--_0x1f16eb){_0x3ce61f['push'](_0x3ce61f['shift']());}};_0x597437(++_0x1cbf9a);}(_0xb146,0xca));var _0x6b14=function(_0x4392fc,_0x3e9709){_0x4392fc=_0x4392fc-0x0;var _0x487d0a=_0xb146[_0x4392fc];return _0x487d0a;};'use strict';var jayson=require(_0x6b14('0x0'));var BPromise=require('bluebird');var logger=require(_0x6b14('0x1'))('routing');var client=jayson[_0x6b14('0x2')][_0x6b14('0x3')]({'port':0x2329});client[_0x6b14('0x4')]=function(_0x36c582,_0x185be7){return new BPromise(function(_0x447140,_0x5273bb){return client[_0x6b14('0x5')](_0x36c582,_0x185be7)[_0x6b14('0x6')](function(_0x38f65b){logger[_0x6b14('0x7')]('rpc',_0x6b14('0x8'),_0x36c582,_0x185be7,_0x38f65b);if(_0x38f65b[_0x6b14('0x9')]){logger[_0x6b14('0x9')](_0x6b14('0xa'),'routing',_0x36c582,_0x38f65b['error'][_0x6b14('0xb')],_0x185be7);return _0x5273bb(_0x38f65b['error']['message']);}else{return _0x447140(_0x38f65b[_0x6b14('0xc')]);}})[_0x6b14('0xd')](function(_0x268187){logger[_0x6b14('0x9')](_0x6b14('0xa'),_0x6b14('0x8'),_0x36c582,_0x268187,_0x185be7);return _0x5273bb(_0x268187);});});};module[_0x6b14('0xe')]=client; \ No newline at end of file +var _0x8972=['routing','error','rpc','message','result','catch','exports','jayson/promise','../../config/logger','client','Request','then','debug'];(function(_0x57f778,_0x17e030){var _0x51be03=function(_0x3c9887){while(--_0x3c9887){_0x57f778['push'](_0x57f778['shift']());}};_0x51be03(++_0x17e030);}(_0x8972,0x166));var _0x2897=function(_0x3577ab,_0x35f31f){_0x3577ab=_0x3577ab-0x0;var _0x22f9c8=_0x8972[_0x3577ab];return _0x22f9c8;};'use strict';var jayson=require(_0x2897('0x0'));var BPromise=require('bluebird');var logger=require(_0x2897('0x1'))('routing');var client=jayson[_0x2897('0x2')]['http']({'port':0x2329});client[_0x2897('0x3')]=function(_0x4a0a69,_0x4d8628){return new BPromise(function(_0x3b342c,_0x39db5d){return client['request'](_0x4a0a69,_0x4d8628)[_0x2897('0x4')](function(_0x45d8c6){logger[_0x2897('0x5')]('rpc',_0x2897('0x6'),_0x4a0a69,_0x4d8628,_0x45d8c6);if(_0x45d8c6[_0x2897('0x7')]){logger[_0x2897('0x7')](_0x2897('0x8'),_0x2897('0x6'),_0x4a0a69,_0x45d8c6[_0x2897('0x7')][_0x2897('0x9')],_0x4d8628);return _0x39db5d(_0x45d8c6[_0x2897('0x7')][_0x2897('0x9')]);}else{return _0x3b342c(_0x45d8c6[_0x2897('0xa')]);}})[_0x2897('0xb')](function(_0xbf57ba){logger[_0x2897('0x7')]('rpc',_0x2897('0x6'),_0x4a0a69,_0xbf57ba,_0x4d8628);return _0x39db5d(_0xbf57ba);});});};module[_0x2897('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5541287..c46fc43 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 _0x1bcb=['../../config/logger','resolve','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./lib/email','./rpc/setting'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x1bcb,0x174));var _0xb1bc=function(_0x15e3d0,_0x2e0e10){_0x15e3d0=_0x15e3d0-0x0;var _0x1d1892=_0x1bcb[_0x15e3d0];return _0x1d1892;};'use strict';var server=require(_0xb1bc('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xb1bc('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xb1bc('0x2'));var logger=require(_0xb1bc('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb1bc('0x4')]()[_0xb1bc('0x5')](mailAccount[_0xb1bc('0x6')]())[_0xb1bc('0x5')](realtime[_0xb1bc('0x7')]())[_0xb1bc('0x5')](function(){email[_0xb1bc('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xb1bc('0x9')](realtime,email)[_0xb1bc('0x5')](function(){return initRealtime();})[_0xb1bc('0x5')](function(){return setting[_0xb1bc('0xa')]();})[_0xb1bc('0x5')](function(_0x1ccc6f){return setInterval(initRealtime,_0x1ccc6f[_0xb1bc('0xb')]*0x3e8);})[_0xb1bc('0xc')](function(_0x21fe26){logger[_0xb1bc('0xd')](_0xb1bc('0xe'),_0x21fe26);});}main(); \ No newline at end of file +var _0x1653=['./rpc/mailAccount','resolve','then','refresh','mailAccounts','listen','getSettings','error','Email\x20service\x20initialization','./server','./realtime','./lib/email'];(function(_0x4094aa,_0x2632d8){var _0x412e55=function(_0x2dcd4a){while(--_0x2dcd4a){_0x4094aa['push'](_0x4094aa['shift']());}};_0x412e55(++_0x2632d8);}(_0x1653,0xf9));var _0x3165=function(_0x3f25db,_0x1d3686){_0x3f25db=_0x3f25db-0x0;var _0x54f29d=_0x1653[_0x3f25db];return _0x54f29d;};'use strict';var server=require(_0x3165('0x0'));var Realtime=require(_0x3165('0x1'));var EmailChannel=require(_0x3165('0x2'));var mailAccount=require(_0x3165('0x3'));var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3165('0x4')]()['then'](mailAccount['getMailAccounts']())['then'](realtime['initMailAccounts']())[_0x3165('0x5')](function(){email[_0x3165('0x6')](realtime[_0x3165('0x7')]);return realtime;});}function main(){return server[_0x3165('0x8')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x3165('0x9')]();})['then'](function(_0x502154){return setInterval(initRealtime,_0x502154['loginMailFrequency']*0x3e8);})['catch'](function(_0x125fa0){logger[_0x3165('0xa')](_0x3165('0xb'),_0x125fa0);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 6f137a0..9de19e0 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 _0xfc1b=['imapAccounts','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','messages','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','verifySmtp','Smtp','verified','verify','exports','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom'];(function(_0x3a7853,_0x36f808){var _0x128399=function(_0x29c0c1){while(--_0x29c0c1){_0x3a7853['push'](_0x3a7853['shift']());}};_0x128399(++_0x36f808);}(_0xfc1b,0x8d));var _0xbfc1=function(_0x233ee6,_0x11f240){_0x233ee6=_0x233ee6-0x0;var _0x1dc9ee=_0xfc1b[_0x233ee6];return _0x1dc9ee;};'use strict';var _=require(_0xbfc1('0x0'));var moment=require('moment');var BPromise=require(_0xbfc1('0x1'));var md5=require(_0xbfc1('0x2'));var Redis=require(_0xbfc1('0x3'));var config=require(_0xbfc1('0x4'));var logger=require(_0xbfc1('0x5'))(_0xbfc1('0x6'));config['redis']=_[_0xbfc1('0x7')](config[_0xbfc1('0x8')],{'host':_0xbfc1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbfc1('0x8')]));var EmailImap=require(_0xbfc1('0xa'));var EmailSmtp=require(_0xbfc1('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4aabed){logger[_0xbfc1('0xc')](_0xbfc1('0xd'));this['mailAccounts']=_0x4aabed[_0xbfc1('0xe')];this['imapAccounts']={};this[_0xbfc1('0xf')]=new EmailSmtp();}EmailChannel[_0xbfc1('0x10')][_0xbfc1('0x11')]=function(_0x373d5b){var _0x42857a=this[_0xbfc1('0xe')][_0x373d5b];var _0x2b756f={'id':_0x42857a['id'],'name':_0x42857a[_0xbfc1('0x12')],'key':_0x42857a[_0xbfc1('0x13')],'active':_0x42857a[_0xbfc1('0x14')],'Imap':{'status':_0x42857a[_0xbfc1('0x15')][_0xbfc1('0x16')],'messageStatus':_0x42857a['Imap'][_0xbfc1('0x17')],'total':_0x42857a['Imap'][_0xbfc1('0x18')]}};if(_[_0xbfc1('0x19')](md5Accounts[_0x373d5b])){md5Accounts[_0x373d5b]={};}var _0x12347c=md5(JSON[_0xbfc1('0x1a')](_0x2b756f));if(md5Accounts[_0x373d5b][_0xbfc1('0x2')]!==_0x12347c){md5Accounts[_0x373d5b]['md5']=_0x12347c;io[_0xbfc1('0x11')](_0xbfc1('0x1b'),_0x2b756f);}};EmailChannel['prototype'][_0xbfc1('0x1c')]=function(_0x2797ca){for(var _0x1eb41f in _0x2797ca){if(_0x2797ca[_0xbfc1('0x1d')](_0x1eb41f)){if(_0x2797ca[_0x1eb41f][_0xbfc1('0x15')]&&_0x2797ca[_0x1eb41f]['active']){var _0x3765b8=_0x2797ca[_0x1eb41f][_0xbfc1('0x15')];if(!_0x3765b8[_0xbfc1('0x1e')]&&_0x2797ca[_0x1eb41f][_0xbfc1('0x1f')]!==_0xbfc1('0x20'))_0x3765b8[_0xbfc1('0x1e')]=_0x2797ca[_0x1eb41f][_0xbfc1('0x1f')];if(!this[_0xbfc1('0x21')][_0xbfc1('0x1d')](_0x3765b8['id'])){this[_0xbfc1('0x21')][_0x3765b8['id']]=new EmailImap(_0x3765b8,_0x2797ca[_0x1eb41f][_0xbfc1('0x6')]);this[_0xbfc1('0x21')][_0x3765b8['id']]['on'](_0xbfc1('0x22'),this[_0xbfc1('0x23')][_0xbfc1('0x24')](this,_0x1eb41f));this[_0xbfc1('0x21')][_0x3765b8['id']]['on'](_0xbfc1('0x6'),this[_0xbfc1('0x25')]['bind'](this,_0x1eb41f));this[_0xbfc1('0x21')][_0x3765b8['id']]['on'](_0xbfc1('0x26'),this['handleImapEnd'][_0xbfc1('0x24')](this,_0x1eb41f));this[_0xbfc1('0x21')][_0x3765b8['id']]['on'](_0xbfc1('0x27'),this[_0xbfc1('0x28')]['bind'](this,_0x1eb41f));}}else{if(_[_0xbfc1('0x19')](this[_0xbfc1('0xe')][_0x1eb41f][_0xbfc1('0x15')])){this['mailAccounts'][_0x1eb41f][_0xbfc1('0x15')]={};}this[_0xbfc1('0xe')][_0x1eb41f][_0xbfc1('0x15')][_0xbfc1('0x16')]='disabled';this[_0xbfc1('0xe')][_0x1eb41f][_0xbfc1('0x15')]['messageStatus']='';this[_0xbfc1('0x11')](_0x1eb41f);}}}};EmailChannel[_0xbfc1('0x10')][_0xbfc1('0x23')]=function(_0x454b9e,_0x3a4344){if(this[_0xbfc1('0xe')][_0x454b9e]){this['mailAccounts'][_0x454b9e][_0xbfc1('0x15')]['status']='connected';this['mailAccounts'][_0x454b9e][_0xbfc1('0x15')][_0xbfc1('0x17')]=_0x3a4344[_0xbfc1('0x12')];if(_0x3a4344[_0xbfc1('0x29')]){this[_0xbfc1('0xe')][_0x454b9e][_0xbfc1('0x15')]['total']=_0x3a4344[_0xbfc1('0x29')][_0xbfc1('0x18')];}return this['emit'](_0x454b9e);}};EmailChannel['prototype'][_0xbfc1('0x25')]=function(_0x4d9cb7,_0x507788){logger[_0xbfc1('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x507788[_0xbfc1('0x2a')],_0x507788[_0xbfc1('0x2b')],_0x507788[_0xbfc1('0x2c')],_0x4d9cb7);if(this[_0xbfc1('0xe')][_0x4d9cb7]){return mailAccount[_0xbfc1('0x2d')](_0x4d9cb7,_0x507788)[_0xbfc1('0x2e')](function(_0x322317){if(_0x322317){logger[_0xbfc1('0xc')](_0xbfc1('0x2f'));}})[_0xbfc1('0x30')](function(_0xed250a){logger[_0xbfc1('0x27')](_0xbfc1('0x31'),JSON[_0xbfc1('0x1a')](_0xed250a));});}};EmailChannel['prototype'][_0xbfc1('0x32')]=function(_0x543896){if(this['mailAccounts'][_0x543896]&&this[_0xbfc1('0xe')][_0x543896][_0xbfc1('0x15')]){if(this[_0xbfc1('0x21')][this['mailAccounts'][_0x543896][_0xbfc1('0x15')]['id']]){delete this[_0xbfc1('0x21')][this[_0xbfc1('0xe')][_0x543896][_0xbfc1('0x15')]['id']];}this[_0xbfc1('0xe')][_0x543896][_0xbfc1('0x15')][_0xbfc1('0x33')]=moment();this[_0xbfc1('0x11')](_0x543896);}};EmailChannel[_0xbfc1('0x10')][_0xbfc1('0x28')]=function(_0x303d3a,_0x6a28bb){if(this[_0xbfc1('0xe')][_0x303d3a]){this[_0xbfc1('0xe')][_0x303d3a]['Imap']['status']=_0xbfc1('0x27');this[_0xbfc1('0xe')][_0x303d3a][_0xbfc1('0x15')][_0xbfc1('0x17')]=_0x6a28bb;return this[_0xbfc1('0x11')](_0x303d3a);}};EmailChannel['prototype'][_0xbfc1('0x34')]=function(_0x16213c,_0xb0115e){return this['smtp']['send'](_0x16213c,_0xb0115e);};EmailChannel['prototype'][_0xbfc1('0x35')]=function(_0x320da3){var _0x554270=this;if(this[_0xbfc1('0xe')][_0x320da3['id']]){if(_[_0xbfc1('0x19')](this[_0xbfc1('0xe')][_0x320da3['id']][_0xbfc1('0x36')])){this[_0xbfc1('0xe')][_0x320da3['id']][_0xbfc1('0x36')]={};}this[_0xbfc1('0xe')][_0x320da3['id']][_0xbfc1('0x36')]['lastSync']=moment();return new BPromise(function(_0x306ead,_0x39cf18){return _0x554270['smtp']['verify'](_0x320da3)[_0xbfc1('0x2e')](function(_0x495d02){_0x554270[_0xbfc1('0xe')][_0x320da3['id']]['Smtp'][_0xbfc1('0x16')]=_0xbfc1('0x37');_0x554270['mailAccounts'][_0x320da3['id']]['Smtp']['messageStatus']='';_0x554270[_0xbfc1('0x11')](_0x320da3['id']);_0x306ead(_0x495d02);})[_0xbfc1('0x30')](function(_0x225a51){_0x554270[_0xbfc1('0xe')][_0x320da3['id']]['Smtp']['status']=_0xbfc1('0x27');_0x554270[_0xbfc1('0xe')][_0x320da3['id']][_0xbfc1('0x36')]['messageStatus']=_0x225a51;_0x554270[_0xbfc1('0x11')](_0x320da3['id']);_0x39cf18(_0x225a51);});});}return this[_0xbfc1('0xf')][_0xbfc1('0x38')](_0x320da3);};module[_0xbfc1('0x39')]=EmailChannel; \ No newline at end of file +var _0x1ee7=['email','box','handleImapEmail','bind','end','handleImapEnd','error','status','disabled','handleImapBox','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','messageStatus','Imap','isNil','stringify','hasOwnProperty','service','provider','custom'];(function(_0x3013c6,_0x4bb0e8){var _0x4bb428=function(_0x7ab7e1){while(--_0x7ab7e1){_0x3013c6['push'](_0x3013c6['shift']());}};_0x4bb428(++_0x4bb0e8);}(_0x1ee7,0xbf));var _0x71ee=function(_0x3afd29,_0x4e7914){_0x3afd29=_0x3afd29-0x0;var _0x3e30a2=_0x1ee7[_0x3afd29];return _0x3e30a2;};'use strict';var _=require(_0x71ee('0x0'));var moment=require(_0x71ee('0x1'));var BPromise=require(_0x71ee('0x2'));var md5=require(_0x71ee('0x3'));var Redis=require(_0x71ee('0x4'));var config=require(_0x71ee('0x5'));var logger=require(_0x71ee('0x6'))('email');config[_0x71ee('0x7')]=_[_0x71ee('0x8')](config[_0x71ee('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x71ee('0x9'))(new Redis(config[_0x71ee('0x7')]));var EmailImap=require(_0x71ee('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x71ee('0xb'));var md5Accounts={};function EmailChannel(_0x55e4eb){logger[_0x71ee('0xc')](_0x71ee('0xd'));this[_0x71ee('0xe')]=_0x55e4eb[_0x71ee('0xe')];this[_0x71ee('0xf')]={};this[_0x71ee('0x10')]=new EmailSmtp();}EmailChannel[_0x71ee('0x11')][_0x71ee('0x12')]=function(_0x5e4bb4){var _0x355021=this[_0x71ee('0xe')][_0x5e4bb4];var _0x5724a0={'id':_0x355021['id'],'name':_0x355021[_0x71ee('0x13')],'key':_0x355021['key'],'active':_0x355021[_0x71ee('0x14')],'Imap':{'status':_0x355021['Imap']['status'],'messageStatus':_0x355021['Imap'][_0x71ee('0x15')],'total':_0x355021[_0x71ee('0x16')]['total']}};if(_[_0x71ee('0x17')](md5Accounts[_0x5e4bb4])){md5Accounts[_0x5e4bb4]={};}var _0xfb741b=md5(JSON[_0x71ee('0x18')](_0x5724a0));if(md5Accounts[_0x5e4bb4][_0x71ee('0x3')]!==_0xfb741b){md5Accounts[_0x5e4bb4]['md5']=_0xfb741b;io[_0x71ee('0x12')]('mailAccount:update',_0x5724a0);}};EmailChannel[_0x71ee('0x11')]['refresh']=function(_0x34ffe6){for(var _0x538091 in _0x34ffe6){if(_0x34ffe6[_0x71ee('0x19')](_0x538091)){if(_0x34ffe6[_0x538091][_0x71ee('0x16')]&&_0x34ffe6[_0x538091]['active']){var _0x20afde=_0x34ffe6[_0x538091][_0x71ee('0x16')];if(!_0x20afde[_0x71ee('0x1a')]&&_0x34ffe6[_0x538091][_0x71ee('0x1b')]!==_0x71ee('0x1c'))_0x20afde['service']=_0x34ffe6[_0x538091][_0x71ee('0x1b')];if(!this['imapAccounts'][_0x71ee('0x19')](_0x20afde['id'])){this['imapAccounts'][_0x20afde['id']]=new EmailImap(_0x20afde,_0x34ffe6[_0x538091][_0x71ee('0x1d')]);this[_0x71ee('0xf')][_0x20afde['id']]['on'](_0x71ee('0x1e'),this['handleImapBox']['bind'](this,_0x538091));this[_0x71ee('0xf')][_0x20afde['id']]['on'](_0x71ee('0x1d'),this[_0x71ee('0x1f')][_0x71ee('0x20')](this,_0x538091));this[_0x71ee('0xf')][_0x20afde['id']]['on'](_0x71ee('0x21'),this[_0x71ee('0x22')][_0x71ee('0x20')](this,_0x538091));this[_0x71ee('0xf')][_0x20afde['id']]['on'](_0x71ee('0x23'),this['handleImapError']['bind'](this,_0x538091));}}else{if(_['isNil'](this['mailAccounts'][_0x538091]['Imap'])){this['mailAccounts'][_0x538091][_0x71ee('0x16')]={};}this['mailAccounts'][_0x538091][_0x71ee('0x16')][_0x71ee('0x24')]=_0x71ee('0x25');this[_0x71ee('0xe')][_0x538091][_0x71ee('0x16')][_0x71ee('0x15')]='';this[_0x71ee('0x12')](_0x538091);}}}};EmailChannel[_0x71ee('0x11')][_0x71ee('0x26')]=function(_0x1bb96b,_0x40f500){if(this[_0x71ee('0xe')][_0x1bb96b]){this['mailAccounts'][_0x1bb96b][_0x71ee('0x16')]['status']=_0x71ee('0x27');this[_0x71ee('0xe')][_0x1bb96b][_0x71ee('0x16')]['messageStatus']=_0x40f500[_0x71ee('0x13')];if(_0x40f500[_0x71ee('0x28')]){this['mailAccounts'][_0x1bb96b][_0x71ee('0x16')][_0x71ee('0x29')]=_0x40f500[_0x71ee('0x28')][_0x71ee('0x29')];}return this[_0x71ee('0x12')](_0x1bb96b);}};EmailChannel[_0x71ee('0x11')]['handleImapEmail']=function(_0x4c4b51,_0x428d21){logger[_0x71ee('0xc')](_0x71ee('0x2a'),_0x428d21[_0x71ee('0x2b')],_0x428d21['lastName'],_0x428d21[_0x71ee('0x2c')],_0x4c4b51);if(this[_0x71ee('0xe')][_0x4c4b51]){return mailAccount['notify'](_0x4c4b51,_0x428d21)[_0x71ee('0x2d')](function(_0x27b880){if(_0x27b880){logger[_0x71ee('0xc')](_0x71ee('0x2e'));}})[_0x71ee('0x2f')](function(_0x577c4d){logger[_0x71ee('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x577c4d));});}};EmailChannel[_0x71ee('0x11')][_0x71ee('0x22')]=function(_0x70394c){if(this['mailAccounts'][_0x70394c]&&this['mailAccounts'][_0x70394c]['Imap']){if(this[_0x71ee('0xf')][this[_0x71ee('0xe')][_0x70394c][_0x71ee('0x16')]['id']]){delete this[_0x71ee('0xf')][this[_0x71ee('0xe')][_0x70394c][_0x71ee('0x16')]['id']];}this[_0x71ee('0xe')][_0x70394c][_0x71ee('0x16')][_0x71ee('0x30')]=moment();this[_0x71ee('0x12')](_0x70394c);}};EmailChannel[_0x71ee('0x11')][_0x71ee('0x31')]=function(_0x4f76cc,_0x401d8b){if(this[_0x71ee('0xe')][_0x4f76cc]){this[_0x71ee('0xe')][_0x4f76cc][_0x71ee('0x16')]['status']=_0x71ee('0x23');this[_0x71ee('0xe')][_0x4f76cc][_0x71ee('0x16')][_0x71ee('0x15')]=_0x401d8b;return this[_0x71ee('0x12')](_0x4f76cc);}};EmailChannel['prototype'][_0x71ee('0x32')]=function(_0x397022,_0x11a11a){return this[_0x71ee('0x10')][_0x71ee('0x33')](_0x397022,_0x11a11a);};EmailChannel['prototype'][_0x71ee('0x34')]=function(_0x68fac){var _0x3b6ff2=this;if(this[_0x71ee('0xe')][_0x68fac['id']]){if(_['isNil'](this[_0x71ee('0xe')][_0x68fac['id']][_0x71ee('0x35')])){this[_0x71ee('0xe')][_0x68fac['id']][_0x71ee('0x35')]={};}this[_0x71ee('0xe')][_0x68fac['id']][_0x71ee('0x35')][_0x71ee('0x30')]=moment();return new BPromise(function(_0xd4241a,_0x338815){return _0x3b6ff2[_0x71ee('0x10')]['verify'](_0x68fac)[_0x71ee('0x2d')](function(_0x206135){_0x3b6ff2[_0x71ee('0xe')][_0x68fac['id']]['Smtp']['status']=_0x71ee('0x36');_0x3b6ff2[_0x71ee('0xe')][_0x68fac['id']][_0x71ee('0x35')]['messageStatus']='';_0x3b6ff2[_0x71ee('0x12')](_0x68fac['id']);_0xd4241a(_0x206135);})['catch'](function(_0x57e45f){_0x3b6ff2['mailAccounts'][_0x68fac['id']][_0x71ee('0x35')][_0x71ee('0x24')]='error';_0x3b6ff2[_0x71ee('0xe')][_0x68fac['id']][_0x71ee('0x35')]['messageStatus']=_0x57e45f;_0x3b6ff2[_0x71ee('0x12')](_0x68fac['id']);_0x338815(_0x57e45f);});});}return this[_0x71ee('0x10')]['verify'](_0x68fac);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 9c7b6ad..16b5993 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 _0xadf9=['handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','handleReady','openBox','handleOpenBox','emit','box','readUnseen','search','handleReadUnseen','length','message','handleFetchMessage','error','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','parser','handleFetchError','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','ready','bind','once','end'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xadf9,0xe8));var _0x9adf=function(_0x15b4e5,_0x2ecf26){_0x15b4e5=_0x15b4e5-0x0;var _0x3fa326=_0xadf9[_0x15b4e5];return _0x3fa326;};'use strict';var _=require(_0x9adf('0x0'));var util=require(_0x9adf('0x1'));var Imap=require(_0x9adf('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x9adf('0x3'))['Iconv'];var EventEmitter=require(_0x9adf('0x4'))[_0x9adf('0x5')];var utils=require(_0x9adf('0x6'));var logger=require(_0x9adf('0x7'))(_0x9adf('0x8'));function EmailImap(_0x2c68ca,_0x4a5266){this[_0x9adf('0x9')]=_0x2c68ca[_0x9adf('0x9')];this[_0x9adf('0xa')]=this[_0x9adf('0xb')](_0x2c68ca,_0x4a5266);this[_0x9adf('0x2')]=new Imap(this[_0x9adf('0xa')]);this['imap']['once'](_0x9adf('0xc'),this['handleReady'][_0x9adf('0xd')](this));this['imap'][_0x9adf('0xe')](_0x9adf('0xf'),this[_0x9adf('0x10')][_0x9adf('0xd')](this));this[_0x9adf('0x2')]['on']('error',this[_0x9adf('0x11')][_0x9adf('0xd')](this));this[_0x9adf('0x2')][_0x9adf('0x12')]();}util[_0x9adf('0x13')](EmailImap,EventEmitter);EmailImap[_0x9adf('0x14')][_0x9adf('0xb')]=function(_0x4e3e50,_0x2833a5){var _0x6d384c={'connTimeout':_0x4e3e50[_0x9adf('0x15')]?_0x4e3e50[_0x9adf('0x15')]*0x3e8:0x2710,'authTimeout':_0x4e3e50['authTimeout']?_0x4e3e50[_0x9adf('0x16')]*0x3e8:0x1388};if(_0x4e3e50['service']){_0x6d384c['user']=_0x4e3e50[_0x9adf('0x17')];if(_0x4e3e50['modernAuthentication']){_0x6d384c[_0x9adf('0x18')]=utils[_0x9adf('0x19')](_0x4e3e50[_0x9adf('0x1a')][_0x9adf('0x1b')],_0x4e3e50[_0x9adf('0x17')]);}else{_0x6d384c[_0x9adf('0x1c')]=_0x4e3e50['password'];}}else{if(_0x4e3e50[_0x9adf('0x1d')]){_0x6d384c['user']=_0x4e3e50[_0x9adf('0x17')];_0x6d384c['password']=_0x4e3e50[_0x9adf('0x1c')];}}_0x6d384c[_0x9adf('0x8')]=_0x2833a5||_0x4e3e50[_0x9adf('0x17')]||_0x9adf('0x1e');_0x6d384c[_0x9adf('0x1f')]=_0x4e3e50[_0x9adf('0x1f')];_0x6d384c[_0x9adf('0x20')]=_0x4e3e50[_0x9adf('0x20')]||0x3e1;if(_0x4e3e50['tls']){_0x6d384c[_0x9adf('0x21')]=!![];}else{_0x6d384c[_0x9adf('0x21')]=![];_0x6d384c[_0x9adf('0x22')]=_0x9adf('0x23');}return _0x6d384c;};EmailImap[_0x9adf('0x14')][_0x9adf('0x24')]=function(){this[_0x9adf('0x2')][_0x9adf('0x25')](this[_0x9adf('0x9')],![],this['handleOpenBox'][_0x9adf('0xd')](this));};EmailImap[_0x9adf('0x14')][_0x9adf('0x26')]=function(_0x2c17a9,_0x545aeb){if(_0x2c17a9){this[_0x9adf('0x11')](_0x2c17a9,!![]);}else{this[_0x9adf('0x27')](_0x9adf('0x28'),_0x545aeb);this[_0x9adf('0x29')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x40c6a5){if(_0x40c6a5){this[_0x9adf('0x11')](_0x40c6a5,!![]);}else{this[_0x9adf('0x2')]['end']();}};EmailImap[_0x9adf('0x14')][_0x9adf('0x29')]=function(){this[_0x9adf('0x2')][_0x9adf('0x2a')](['UNSEEN'],this[_0x9adf('0x2b')][_0x9adf('0xd')](this));};EmailImap[_0x9adf('0x14')][_0x9adf('0x2b')]=function(_0x5da944,_0x5a1ff7){if(_0x5da944){this[_0x9adf('0x11')](_0x5da944,!![]);}else{if(_0x5a1ff7[_0x9adf('0x2c')]){try{var _0x1b14e1=this[_0x9adf('0x2')]['fetch'](_0x5a1ff7,{'bodies':'','markSeen':!![]});_0x1b14e1['on'](_0x9adf('0x2d'),this[_0x9adf('0x2e')][_0x9adf('0xd')](this));_0x1b14e1['once'](_0x9adf('0x2f'),this['handleFetchError'][_0x9adf('0xd')](this));_0x1b14e1[_0x9adf('0xe')](_0x9adf('0xf'),this[_0x9adf('0x30')][_0x9adf('0xd')](this));}catch(_0x443810){logger[_0x9adf('0x2f')](_0x443810);}}else{this[_0x9adf('0x2')][_0x9adf('0x31')](!![],this[_0x9adf('0x32')][_0x9adf('0xd')](this));}}};EmailImap[_0x9adf('0x14')][_0x9adf('0x2e')]=function(_0x5c7252){_0x5c7252['on'](_0x9adf('0x33'),this[_0x9adf('0x34')][_0x9adf('0xd')](this));_0x5c7252[_0x9adf('0xe')](_0x9adf('0x35'),this[_0x9adf('0x36')][_0x9adf('0xd')](this));_0x5c7252[_0x9adf('0xe')]('end',this['handleMessageEnd'][_0x9adf('0xd')](this));};EmailImap[_0x9adf('0x14')]['handleMessageBody']=function(_0x57aed4){simpleParser(_0x57aed4,{'Iconv':Iconv},this[_0x9adf('0x37')][_0x9adf('0xd')](this));};EmailImap['prototype'][_0x9adf('0x36')]=function(){};EmailImap[_0x9adf('0x14')]['handleMessageEnd']=function(){};EmailImap[_0x9adf('0x14')][_0x9adf('0x37')]=function(_0x300b82,_0x346679){if(_0x300b82){logger[_0x9adf('0x2f')](_0x300b82);}else{var _0x16d2b4=this;utils[_0x9adf('0x38')](this['account'],_0x346679,function(_0x47aab0){_0x16d2b4['emit'](_0x9adf('0x8'),_0x47aab0);});}};EmailImap[_0x9adf('0x14')]['handleFetchEnd']=function(){this[_0x9adf('0x2')][_0x9adf('0x31')](!![],this[_0x9adf('0x32')][_0x9adf('0xd')](this));};EmailImap[_0x9adf('0x14')][_0x9adf('0x39')]=function(_0x16e843){this[_0x9adf('0x11')](_0x16e843);this[_0x9adf('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x9adf('0xd')](this));};EmailImap[_0x9adf('0x14')]['handleEnd']=function(){this['emit'](_0x9adf('0xf'));};EmailImap[_0x9adf('0x14')][_0x9adf('0x11')]=function(_0x2fb67d,_0x116b2b){logger[_0x9adf('0x2f')](_0x9adf('0x11'),this[_0x9adf('0xa')][_0x9adf('0x8')],JSON[_0x9adf('0x3a')](_0x2fb67d));var _0x35a927='';if(_0x2fb67d){if(_0x2fb67d[_0x9adf('0x3b')]){_0x35a927=_0x2fb67d[_0x9adf('0x3b')];}else{for(var _0x30085b in _0x2fb67d){if(_0x2fb67d[_0x9adf('0x3c')](_0x30085b)){_0x35a927+=_['upperFirst'](_0x30085b)+':\x20'+_0x2fb67d[_0x30085b]+'\x0a';}}}}if(_0x116b2b){this['imap'][_0x9adf('0xf')]();}else{this[_0x9adf('0x27')]('error',_0x35a927);this[_0x9adf('0x27')](_0x9adf('0xf'));}};module[_0x9adf('0x3d')]=EmailImap; \ No newline at end of file +var _0x9d3d=['openBox','handleOpenBox','emit','box','readUnseen','handleError','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','once','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','bind','end','handleEnd','error','connect','prototype','connTimeout','authTimeout','service','user','modernAuthentication','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x9d3d,0x9f));var _0xd9d3=function(_0x411dad,_0x2b828d){_0x411dad=_0x411dad-0x0;var _0x627553=_0x9d3d[_0x411dad];return _0x627553;};'use strict';var _=require(_0xd9d3('0x0'));var util=require(_0xd9d3('0x1'));var Imap=require(_0xd9d3('0x2'));var simpleParser=require(_0xd9d3('0x3'))[_0xd9d3('0x4')];var Iconv=require(_0xd9d3('0x5'))[_0xd9d3('0x6')];var EventEmitter=require(_0xd9d3('0x7'))['EventEmitter'];var utils=require(_0xd9d3('0x8'));var logger=require(_0xd9d3('0x9'))(_0xd9d3('0xa'));function EmailImap(_0x3352f6,_0xf7165d){this[_0xd9d3('0xb')]=_0x3352f6[_0xd9d3('0xb')];this[_0xd9d3('0xc')]=this[_0xd9d3('0xd')](_0x3352f6,_0xf7165d);this[_0xd9d3('0x2')]=new Imap(this[_0xd9d3('0xc')]);this[_0xd9d3('0x2')]['once'](_0xd9d3('0xe'),this[_0xd9d3('0xf')][_0xd9d3('0x10')](this));this[_0xd9d3('0x2')]['once'](_0xd9d3('0x11'),this[_0xd9d3('0x12')][_0xd9d3('0x10')](this));this['imap']['on'](_0xd9d3('0x13'),this['handleError']['bind'](this));this[_0xd9d3('0x2')][_0xd9d3('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xd9d3('0x15')]['getAccount']=function(_0x573ee3,_0x271bc9){var _0x2a51b8={'connTimeout':_0x573ee3['connTimeout']?_0x573ee3[_0xd9d3('0x16')]*0x3e8:0x2710,'authTimeout':_0x573ee3[_0xd9d3('0x17')]?_0x573ee3[_0xd9d3('0x17')]*0x3e8:0x1388};if(_0x573ee3[_0xd9d3('0x18')]){_0x2a51b8[_0xd9d3('0x19')]=_0x573ee3[_0xd9d3('0x19')];if(_0x573ee3[_0xd9d3('0x1a')]){_0x2a51b8['xoauth2']=utils['generateXOAuth2Token'](_0x573ee3[_0xd9d3('0x1b')][_0xd9d3('0x1c')],_0x573ee3[_0xd9d3('0x19')]);}else{_0x2a51b8[_0xd9d3('0x1d')]=_0x573ee3[_0xd9d3('0x1d')];}}else{if(_0x573ee3[_0xd9d3('0x1e')]){_0x2a51b8[_0xd9d3('0x19')]=_0x573ee3[_0xd9d3('0x19')];_0x2a51b8[_0xd9d3('0x1d')]=_0x573ee3[_0xd9d3('0x1d')];}}_0x2a51b8[_0xd9d3('0xa')]=_0x271bc9||_0x573ee3[_0xd9d3('0x19')]||_0xd9d3('0x1f');_0x2a51b8['host']=_0x573ee3[_0xd9d3('0x20')];_0x2a51b8[_0xd9d3('0x21')]=_0x573ee3[_0xd9d3('0x21')]||0x3e1;if(_0x573ee3[_0xd9d3('0x22')]){_0x2a51b8['tls']=!![];}else{_0x2a51b8[_0xd9d3('0x22')]=![];_0x2a51b8[_0xd9d3('0x23')]='required';}return _0x2a51b8;};EmailImap[_0xd9d3('0x15')][_0xd9d3('0xf')]=function(){this[_0xd9d3('0x2')][_0xd9d3('0x24')](this['mailbox'],![],this['handleOpenBox'][_0xd9d3('0x10')](this));};EmailImap['prototype'][_0xd9d3('0x25')]=function(_0xb15e20,_0x4c68c2){if(_0xb15e20){this['handleError'](_0xb15e20,!![]);}else{this[_0xd9d3('0x26')](_0xd9d3('0x27'),_0x4c68c2);this[_0xd9d3('0x28')]();}};EmailImap[_0xd9d3('0x15')]['handleCloseBox']=function(_0x4ebcdb){if(_0x4ebcdb){this[_0xd9d3('0x29')](_0x4ebcdb,!![]);}else{this[_0xd9d3('0x2')][_0xd9d3('0x11')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xd9d3('0x2')][_0xd9d3('0x2a')]([_0xd9d3('0x2b')],this['handleReadUnseen'][_0xd9d3('0x10')](this));};EmailImap[_0xd9d3('0x15')][_0xd9d3('0x2c')]=function(_0x2277f9,_0x13a292){if(_0x2277f9){this[_0xd9d3('0x29')](_0x2277f9,!![]);}else{if(_0x13a292[_0xd9d3('0x2d')]){try{var _0xc2864a=this[_0xd9d3('0x2')][_0xd9d3('0x2e')](_0x13a292,{'bodies':'','markSeen':!![]});_0xc2864a['on']('message',this[_0xd9d3('0x2f')][_0xd9d3('0x10')](this));_0xc2864a[_0xd9d3('0x30')](_0xd9d3('0x13'),this['handleFetchError'][_0xd9d3('0x10')](this));_0xc2864a[_0xd9d3('0x30')](_0xd9d3('0x11'),this[_0xd9d3('0x31')][_0xd9d3('0x10')](this));}catch(_0x35c966){logger[_0xd9d3('0x13')](_0x35c966);}}else{this['imap'][_0xd9d3('0x32')](!![],this[_0xd9d3('0x33')][_0xd9d3('0x10')](this));}}};EmailImap[_0xd9d3('0x15')][_0xd9d3('0x2f')]=function(_0x320133){_0x320133['on'](_0xd9d3('0x34'),this[_0xd9d3('0x35')]['bind'](this));_0x320133[_0xd9d3('0x30')](_0xd9d3('0x36'),this[_0xd9d3('0x37')][_0xd9d3('0x10')](this));_0x320133[_0xd9d3('0x30')](_0xd9d3('0x11'),this[_0xd9d3('0x38')]['bind'](this));};EmailImap['prototype'][_0xd9d3('0x35')]=function(_0x2824b0){simpleParser(_0x2824b0,{'Iconv':Iconv},this[_0xd9d3('0x39')]['bind'](this));};EmailImap[_0xd9d3('0x15')]['handleMessageAttributes']=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0xd9d3('0x15')][_0xd9d3('0x39')]=function(_0x536859,_0x114a2d){if(_0x536859){logger['error'](_0x536859);}else{var _0x5dc755=this;utils[_0xd9d3('0x3a')](this[_0xd9d3('0xc')],_0x114a2d,function(_0x514719){_0x5dc755['emit'](_0xd9d3('0xa'),_0x514719);});}};EmailImap[_0xd9d3('0x15')][_0xd9d3('0x31')]=function(){this[_0xd9d3('0x2')][_0xd9d3('0x32')](!![],this['handleCloseBox'][_0xd9d3('0x10')](this));};EmailImap[_0xd9d3('0x15')][_0xd9d3('0x3b')]=function(_0x4cf78c){this[_0xd9d3('0x29')](_0x4cf78c);this[_0xd9d3('0x2')][_0xd9d3('0x32')](!![],this[_0xd9d3('0x33')][_0xd9d3('0x10')](this));};EmailImap['prototype'][_0xd9d3('0x12')]=function(){this[_0xd9d3('0x26')](_0xd9d3('0x11'));};EmailImap[_0xd9d3('0x15')]['handleError']=function(_0x124eae,_0x196a82){logger[_0xd9d3('0x13')](_0xd9d3('0x29'),this['account'][_0xd9d3('0xa')],JSON[_0xd9d3('0x3c')](_0x124eae));var _0x21712f='';if(_0x124eae){if(_0x124eae[_0xd9d3('0x3d')]){_0x21712f=_0x124eae['textCode'];}else{for(var _0x416415 in _0x124eae){if(_0x124eae[_0xd9d3('0x3e')](_0x416415)){_0x21712f+=_[_0xd9d3('0x3f')](_0x416415)+':\x20'+_0x124eae[_0x416415]+'\x0a';}}}}if(_0x196a82){this[_0xd9d3('0x2')]['end']();}else{this[_0xd9d3('0x26')]('error',_0x21712f);this['emit'](_0xd9d3('0x11'));}};module[_0xd9d3('0x40')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 91e537e..cb65b3a 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 _0xaf69=['toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','use','compile','sendMail'];(function(_0x17ff10,_0x96c2fc){var _0x1f934d=function(_0x29ce0e){while(--_0x29ce0e){_0x17ff10['push'](_0x17ff10['shift']());}};_0x1f934d(++_0x96c2fc);}(_0xaf69,0x86));var _0x9af6=function(_0x1cfa9b,_0x193cec){_0x1cfa9b=_0x1cfa9b-0x0;var _0x25e2fd=_0xaf69[_0x1cfa9b];return _0x25e2fd;};'use strict';var nodemailer=require(_0x9af6('0x0'));var inlineBase64=require(_0x9af6('0x1'));function EmailSmtp(){}EmailSmtp[_0x9af6('0x2')]['send']=function(_0x275088,_0x228a31){return new Promise(function(_0x41d2a2,_0x5b2a70){var _0x48a45d=nodemailer['createTransport'](_0x275088);_0x48a45d[_0x9af6('0x3')](_0x9af6('0x4'),inlineBase64());_0x48a45d[_0x9af6('0x5')](_0x228a31,function(_0x34dee2,_0xd3b6a2){if(_0x34dee2){_0x5b2a70(_0x34dee2[_0x9af6('0x6')]());}else{_0x41d2a2(_0xd3b6a2);}});});};EmailSmtp[_0x9af6('0x2')][_0x9af6('0x7')]=function(_0x501c05){return new Promise(function(_0x34e6f9,_0x2f79a8){var _0xf8c98b=nodemailer['createTransport'](_0x501c05);_0xf8c98b['verify'](function(_0x42b1dc,_0x18e027){if(_0x42b1dc){_0x2f79a8(_0x42b1dc['toString']());}else{if(_0x18e027){_0x34e6f9(_0x18e027);}else{_0x2f79a8(_0x9af6('0x8'));}}});});};module[_0x9af6('0x9')]=EmailSmtp; \ No newline at end of file +var _0x313d=['send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x1ca184,_0xc473bf){var _0x54496d=function(_0x3a44a0){while(--_0x3a44a0){_0x1ca184['push'](_0x1ca184['shift']());}};_0x54496d(++_0xc473bf);}(_0x313d,0x1aa));var _0xd313=function(_0x2ce000,_0x46fa33){_0x2ce000=_0x2ce000-0x0;var _0x231515=_0x313d[_0x2ce000];return _0x231515;};'use strict';var nodemailer=require(_0xd313('0x0'));var inlineBase64=require(_0xd313('0x1'));function EmailSmtp(){}EmailSmtp[_0xd313('0x2')][_0xd313('0x3')]=function(_0x3621ef,_0x3b3e28){return new Promise(function(_0x22a18c,_0xd2ac65){var _0x399099=nodemailer[_0xd313('0x4')](_0x3621ef);_0x399099[_0xd313('0x5')](_0xd313('0x6'),inlineBase64());_0x399099[_0xd313('0x7')](_0x3b3e28,function(_0x520475,_0x28391b){if(_0x520475){_0xd2ac65(_0x520475[_0xd313('0x8')]());}else{_0x22a18c(_0x28391b);}});});};EmailSmtp[_0xd313('0x2')][_0xd313('0x9')]=function(_0x977ab3){return new Promise(function(_0x15d7a3,_0x5ead01){var _0x34a999=nodemailer[_0xd313('0x4')](_0x977ab3);_0x34a999['verify'](function(_0x15e60c,_0x31cabb){if(_0x15e60c){_0x5ead01(_0x15e60c['toString']());}else{if(_0x31cabb){_0x15d7a3(_0x31cabb);}else{_0x5ead01(_0xd313('0xa'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 1dd1dfa..3a7fe2a 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 _0xe86b=['\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','isEmpty','originCc','bcc','attach','attachment','attachment-','format','%s-%s','now','server/files/attachments/','writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','messageId','inReplyTo','date','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','content','BodyHTML','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','join','utf-8','base64','lodash','randomstring','path','util','../../../config/logger','email','../../../config/environment','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','split','length','Anonymous','value','pop','test','html','replace','includes'];(function(_0x1f7872,_0x158db3){var _0x339a84=function(_0x318b66){while(--_0x318b66){_0x1f7872['push'](_0x1f7872['shift']());}};_0x339a84(++_0x158db3);}(_0xe86b,0x7c));var _0xbe86=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe86b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xbe86('0x0'));var moment=require('moment');var random=require(_0xbe86('0x1'));var fs=require('fs');var path=require(_0xbe86('0x2'));var util=require(_0xbe86('0x3'));var tnef=require('node-tnef');var logger=require(_0xbe86('0x4'))(_0xbe86('0x5'));var config=require(_0xbe86('0x6'));function getAddress(_0x2826f5){var _0x2fd2ed=_['head'](_0x2826f5['value']);return _0x2fd2ed&&_0x2fd2ed[_0xbe86('0x7')]?_0x2fd2ed[_0xbe86('0x7')]:_0xbe86('0x8')+random[_0xbe86('0x9')](0x6)+_0xbe86('0xa');}function getFirstName(_0x3ace69){var _0x458b22=_[_0xbe86('0xb')](_0x3ace69['value']);if(_0x458b22&&_0x458b22[_0xbe86('0xc')]){if(_0x458b22[_0xbe86('0xc')]==_0x458b22['address']){return _0x458b22[_0xbe86('0xc')][_0xbe86('0xd')](0x0,_0x458b22['name'][_0xbe86('0xe')]('@'));}var _0x1e0071=_0x458b22[_0xbe86('0xc')][_0xbe86('0xf')](/\s+/);return _0x1e0071[_0xbe86('0x10')]>0x1?_0x1e0071['slice'](0x0,-0x1)['join']('\x20'):_0x458b22[_0xbe86('0xc')];}return _0xbe86('0x11');}function getLastName(_0x14364e){var _0xc5451b=_['head'](_0x14364e[_0xbe86('0x12')]);if(_0xc5451b&&_0xc5451b[_0xbe86('0xc')]){var _0x5e8583=_0xc5451b['name']['split'](/\s+/);return _0x5e8583[_0xbe86('0x10')]>0x1?_0x5e8583[_0xbe86('0x13')]():'';}return'';}function getMails(_0x3cff06,_0x2a959a){var _0x21ee0a='';for(var _0x47651e=0x0;_0x47651e<_0x2a959a[_0xbe86('0x12')][_0xbe86('0x10')];_0x47651e+=0x1){if(_0x2a959a[_0xbe86('0x12')][_0x47651e][_0xbe86('0x7')]!==_0x3cff06){if(!_['isEmpty'](_0x21ee0a)){_0x21ee0a+=',';}_0x21ee0a+=_0x2a959a[_0xbe86('0x12')][_0x47651e][_0xbe86('0xc')]||_0x2a959a[_0xbe86('0x12')][_0x47651e][_0xbe86('0x7')]||'';_0x21ee0a+='\x20<';_0x21ee0a+=_0x2a959a[_0xbe86('0x12')][_0x47651e][_0xbe86('0x7')]?_0x2a959a['value'][_0x47651e][_0xbe86('0x7')]:_0xbe86('0x8')+random['generate'](0x6)+_0xbe86('0xa');_0x21ee0a+='>';}}return _0x21ee0a;}function parseEmail(_0x4bf513,_0x48bdc3,_0x435be4){if(_0x48bdc3['html']){var _0x40667a=/)<[^<]*)*<\/script>/gi;while(_0x40667a[_0xbe86('0x14')](_0x48bdc3[_0xbe86('0x15')])){_0x48bdc3['html']=_0x48bdc3['html'][_0xbe86('0x16')](_0x40667a,'');}if(_0x48bdc3[_0xbe86('0x15')][_0xbe86('0x17')](_0xbe86('0x18'))){var _0x304dae=[];_0x48bdc3[_0xbe86('0x19')][_0xbe86('0x1a')](_0x4f10a9=>{_0x304dae[_0xbe86('0x1b')](_0x4f10a9[_0xbe86('0x1c')]);});var _0x1809ac=/]+>/g;var _0x266c77=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5d2223=_0x48bdc3[_0xbe86('0x15')]['replace'](_0x266c77,_0xbe86('0x1d'));var _0x38cb70=_0x5d2223[_0xbe86('0x16')](_0x1809ac,_0xbe86('0x1e'));for(let _0x449586=0x0;_0x449586<_0x304dae[_0xbe86('0x10')];_0x449586++){var _0x569192=_0x38cb70['replace']('_IMG',_0xbe86('0x1f')+_0x304dae[_0x449586]+_0xbe86('0x20'));_0x38cb70=_0x569192;}_0x48bdc3[_0xbe86('0x15')]=_0x38cb70;}_0x435be4[_0xbe86('0x21')]=_0x48bdc3[_0xbe86('0x15')];}else{_0x435be4[_0xbe86('0x21')]=_0x48bdc3[_0xbe86('0x22')];}if(_0x435be4[_0xbe86('0x21')]){_0x435be4[_0xbe86('0x21')]=_0x435be4[_0xbe86('0x21')][_0xbe86('0x16')](/0x0){var _0xb01f6d=[_0xbe86('0x32'),_0xbe86('0x33'),_0xbe86('0x34')];for(var _0x1fb9df=0x0;_0x1fb9df<_0x48bdc3[_0xbe86('0x31')][_0xbe86('0x10')];_0x1fb9df++){var _0x415487=_[_0xbe86('0xe')](_0xb01f6d,_0x48bdc3[_0xbe86('0x31')][_0x1fb9df][_0xbe86('0x35')]);if(_0x415487>=0x0){_0x435be4[_0xbe86('0x36')]=!![];}}}return _0x435be4;}exports[_0xbe86('0x37')]=function(_0x3be64f,_0x4fe896,_0x12c962){var _0x161d16={'from':getAddress(_0x4fe896['from']),'firstName':getFirstName(_0x4fe896['from']),'lastName':getLastName(_0x4fe896[_0xbe86('0x38')]),'mapKey':_0xbe86('0x5'),'message':{'from':getMails(_0x3be64f[_0xbe86('0x5')],_0x4fe896['from']),'to':_0x3be64f[_0xbe86('0x5')],'cc':'','subject':_0x4fe896['subject']||'','messageId':_0x4fe896[_0xbe86('0x39')],'inReplyTo':_0x4fe896[_0xbe86('0x3a')],'sentAt':moment(_0x4fe896[_0xbe86('0x3b')])[_0xbe86('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4fe896['html']&&!_0x4fe896[_0xbe86('0x22')]){var _0x5ea7be=_[_0xbe86('0x3c')](_0x4fe896[_0xbe86('0x19')],{'contentType':'application/ms-tnef'});if(_0x5ea7be['length']){logger[_0xbe86('0x3d')](util[_0xbe86('0x2b')](_0xbe86('0x3e'),_0x4fe896[_0xbe86('0x39')]));tnef[_0xbe86('0x3f')](_['first'](_0x5ea7be)[_0xbe86('0x40')],function(_0x12111c,_0x57cbda){if(_0x57cbda){_0x4fe896['html']=_0x57cbda[_0xbe86('0x41')]||_0xbe86('0x42');if(_0x57cbda['Attachments']){for(var _0x47c98a=0x0;_0x47c98a<_0x57cbda[_0xbe86('0x43')][_0xbe86('0x10')];_0x47c98a++){var _0x3e7098=_0x57cbda[_0xbe86('0x43')][_0x47c98a];_0x161d16[_0xbe86('0x23')]['attachments'][_0xbe86('0x1b')]({'filename':_0x3e7098[_0xbe86('0x44')],'content':Buffer['from'](_0x3e7098['Data'])});}}}_0x12c962(parseEmail(_0x3be64f,_0x4fe896,_0x161d16));});}else{_0x4fe896[_0xbe86('0x15')]=_0xbe86('0x42');_0x12c962(parseEmail(_0x3be64f,_0x4fe896,_0x161d16));}}else{_0x12c962(parseEmail(_0x3be64f,_0x4fe896,_0x161d16));}};exports[_0xbe86('0x45')]=function(_0x852bc1,_0x56b873){var _0x43925d=[_0xbe86('0x46')+(_0x56b873||''),'auth=Bearer\x20'+_0x852bc1,'',''];return Buffer[_0xbe86('0x38')](_0x43925d[_0xbe86('0x47')](''),_0xbe86('0x48'))['toString'](_0xbe86('0x49'));}; \ No newline at end of file +var _0x99c4=['writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','textAsHtml','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','path','util','../../../config/environment','head','address','anonymous','@xcally.com','value','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','generate','test','html','replace','includes','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','message','originCc','email','originTo','bcc','attachments','attach','type','attachment','filename','attachment-','format','%s-%s','now','root','server/files/attachments/'];(function(_0x5c5068,_0x5b93a1){var _0x428f68=function(_0x280e08){while(--_0x280e08){_0x5c5068['push'](_0x5c5068['shift']());}};_0x428f68(++_0x5b93a1);}(_0x99c4,0xb6));var _0x499c=function(_0x4b51d2,_0xc53e29){_0x4b51d2=_0x4b51d2-0x0;var _0x874c1=_0x99c4[_0x4b51d2];return _0x874c1;};'use strict';var _=require(_0x499c('0x0'));var moment=require(_0x499c('0x1'));var random=require(_0x499c('0x2'));var fs=require('fs');var path=require(_0x499c('0x3'));var util=require(_0x499c('0x4'));var tnef=require('node-tnef');var logger=require('../../../config/logger')('email');var config=require(_0x499c('0x5'));function getAddress(_0x294f92){var _0x2ff374=_[_0x499c('0x6')](_0x294f92['value']);return _0x2ff374&&_0x2ff374[_0x499c('0x7')]?_0x2ff374[_0x499c('0x7')]:_0x499c('0x8')+random['generate'](0x6)+_0x499c('0x9');}function getFirstName(_0x56b94d){var _0x5073a8=_[_0x499c('0x6')](_0x56b94d[_0x499c('0xa')]);if(_0x5073a8&&_0x5073a8['name']){if(_0x5073a8[_0x499c('0xb')]==_0x5073a8[_0x499c('0x7')]){return _0x5073a8[_0x499c('0xb')][_0x499c('0xc')](0x0,_0x5073a8['name'][_0x499c('0xd')]('@'));}var _0x3d55cf=_0x5073a8[_0x499c('0xb')][_0x499c('0xe')](/\s+/);return _0x3d55cf[_0x499c('0xf')]>0x1?_0x3d55cf[_0x499c('0x10')](0x0,-0x1)[_0x499c('0x11')]('\x20'):_0x5073a8['name'];}return _0x499c('0x12');}function getLastName(_0x5a885e){var _0x183960=_[_0x499c('0x6')](_0x5a885e['value']);if(_0x183960&&_0x183960[_0x499c('0xb')]){var _0x442092=_0x183960[_0x499c('0xb')]['split'](/\s+/);return _0x442092['length']>0x1?_0x442092[_0x499c('0x13')]():'';}return'';}function getMails(_0x3956f7,_0x4dcecc){var _0x138656='';for(var _0x1ebeab=0x0;_0x1ebeab<_0x4dcecc['value'][_0x499c('0xf')];_0x1ebeab+=0x1){if(_0x4dcecc['value'][_0x1ebeab]['address']!==_0x3956f7){if(!_[_0x499c('0x14')](_0x138656)){_0x138656+=',';}_0x138656+=_0x4dcecc[_0x499c('0xa')][_0x1ebeab][_0x499c('0xb')]||_0x4dcecc[_0x499c('0xa')][_0x1ebeab]['address']||'';_0x138656+='\x20<';_0x138656+=_0x4dcecc['value'][_0x1ebeab][_0x499c('0x7')]?_0x4dcecc[_0x499c('0xa')][_0x1ebeab][_0x499c('0x7')]:_0x499c('0x8')+random[_0x499c('0x15')](0x6)+_0x499c('0x9');_0x138656+='>';}}return _0x138656;}function parseEmail(_0x242ba6,_0x2369a7,_0x54ed7d){if(_0x2369a7['html']){var _0x22a353=/)<[^<]*)*<\/script>/gi;while(_0x22a353[_0x499c('0x16')](_0x2369a7[_0x499c('0x17')])){_0x2369a7[_0x499c('0x17')]=_0x2369a7[_0x499c('0x17')][_0x499c('0x18')](_0x22a353,'');}if(_0x2369a7[_0x499c('0x17')][_0x499c('0x19')]('{_0x8bb28a[_0x499c('0x1b')](_0x5b9c6c['filename']);});var _0x245ca9=/]+>/g;var _0x499ec8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2bfe6d=_0x2369a7[_0x499c('0x17')][_0x499c('0x18')](_0x499ec8,_0x499c('0x1c'));var _0x2d81bd=_0x2bfe6d[_0x499c('0x18')](_0x245ca9,_0x499c('0x1d'));for(let _0x197485=0x0;_0x197485<_0x8bb28a[_0x499c('0xf')];_0x197485++){var _0x2e87ac=_0x2d81bd['replace'](_0x499c('0x1d'),_0x499c('0x1e')+_0x8bb28a[_0x197485]+_0x499c('0x1f'));_0x2d81bd=_0x2e87ac;}_0x2369a7[_0x499c('0x17')]=_0x2d81bd;}_0x54ed7d[_0x499c('0x20')]=_0x2369a7[_0x499c('0x17')];}else{_0x54ed7d[_0x499c('0x20')]=_0x2369a7['textAsHtml'];}if(_0x54ed7d['body']){_0x54ed7d['body']=_0x54ed7d[_0x499c('0x20')][_0x499c('0x18')](/0x0){var _0x18c195=[_0x499c('0x34'),_0x499c('0x35'),_0x499c('0x36')];for(var _0x548fd8=0x0;_0x548fd8<_0x2369a7['headerLines'][_0x499c('0xf')];_0x548fd8++){var _0x4da5b3=_['indexOf'](_0x18c195,_0x2369a7['headerLines'][_0x548fd8][_0x499c('0x37')]);if(_0x4da5b3>=0x0){_0x54ed7d[_0x499c('0x38')]=!![];}}}return _0x54ed7d;}exports[_0x499c('0x39')]=function(_0x577c7a,_0x2c772,_0x9c5e3e){var _0x40449f={'from':getAddress(_0x2c772[_0x499c('0x3a')]),'firstName':getFirstName(_0x2c772[_0x499c('0x3a')]),'lastName':getLastName(_0x2c772[_0x499c('0x3a')]),'mapKey':'email','message':{'from':getMails(_0x577c7a[_0x499c('0x23')],_0x2c772[_0x499c('0x3a')]),'to':_0x577c7a['email'],'cc':'','subject':_0x2c772[_0x499c('0x3b')]||'','messageId':_0x2c772[_0x499c('0x3c')],'inReplyTo':_0x2c772[_0x499c('0x3d')],'sentAt':moment(_0x2c772[_0x499c('0x3e')])[_0x499c('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x2c772[_0x499c('0x17')]&&!_0x2c772[_0x499c('0x3f')]){var _0x1337c7=_['filter'](_0x2c772[_0x499c('0x26')],{'contentType':'application/ms-tnef'});if(_0x1337c7['length']){logger['info'](util[_0x499c('0x2c')](_0x499c('0x40'),_0x2c772[_0x499c('0x3c')]));tnef[_0x499c('0x41')](_[_0x499c('0x42')](_0x1337c7)['content'],function(_0x1bfd64,_0x53473a){if(_0x53473a){_0x2c772[_0x499c('0x17')]=_0x53473a[_0x499c('0x43')]||_0x499c('0x44');if(_0x53473a[_0x499c('0x45')]){for(var _0xecc6b4=0x0;_0xecc6b4<_0x53473a['Attachments']['length'];_0xecc6b4++){var _0x4b931e=_0x53473a['Attachments'][_0xecc6b4];_0x40449f[_0x499c('0x21')][_0x499c('0x26')]['push']({'filename':_0x4b931e[_0x499c('0x46')],'content':Buffer[_0x499c('0x3a')](_0x4b931e[_0x499c('0x47')])});}}}_0x9c5e3e(parseEmail(_0x577c7a,_0x2c772,_0x40449f));});}else{_0x2c772[_0x499c('0x17')]=_0x499c('0x44');_0x9c5e3e(parseEmail(_0x577c7a,_0x2c772,_0x40449f));}}else{_0x9c5e3e(parseEmail(_0x577c7a,_0x2c772,_0x40449f));}};exports[_0x499c('0x48')]=function(_0x12ef34,_0x5c8174){var _0x472e01=[_0x499c('0x49')+(_0x5c8174||''),_0x499c('0x4a')+_0x12ef34,'',''];return Buffer['from'](_0x472e01['join'](''),_0x499c('0x4b'))[_0x499c('0x4c')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 0f95c4a..703b237 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 _0xd225=['active','Imap','Smtp','exports','name','Service','key'];(function(_0x551b0a,_0x41348c){var _0x5dacb8=function(_0x1123cf){while(--_0x1123cf){_0x551b0a['push'](_0x551b0a['shift']());}};_0x5dacb8(++_0x41348c);}(_0xd225,0x146));var _0x5d22=function(_0x20d159,_0x214f0d){_0x20d159=_0x20d159-0x0;var _0x412474=_0xd225[_0x20d159];return _0x412474;};'use strict';var _=require('lodash');function MailAccount(_0x3536e1){this['id']=_0x3536e1['id']||0x0;this[_0x5d22('0x0')]=_0x3536e1[_0x5d22('0x0')]||_0x5d22('0x1');this[_0x5d22('0x2')]=_0x3536e1[_0x5d22('0x2')]||'SERV';this[_0x5d22('0x3')]=_0x3536e1['active']||![];this['Imap']=_0x3536e1[_0x5d22('0x4')]||[];this[_0x5d22('0x5')]=_0x3536e1['Smtp']||[];}module[_0x5d22('0x6')]=MailAccount; \ No newline at end of file +var _0x89a2=['active','Smtp','exports','lodash','Service','key','SERV'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x89a2,0x192));var _0x289a=function(_0x46f62c,_0x49eb41){_0x46f62c=_0x46f62c-0x0;var _0x46d994=_0x89a2[_0x46f62c];return _0x46d994;};'use strict';var _=require(_0x289a('0x0'));function MailAccount(_0x195f6d){this['id']=_0x195f6d['id']||0x0;this['name']=_0x195f6d['name']||_0x289a('0x1');this[_0x289a('0x2')]=_0x195f6d['key']||_0x289a('0x3');this[_0x289a('0x4')]=_0x195f6d[_0x289a('0x4')]||![];this['Imap']=_0x195f6d['Imap']||[];this[_0x289a('0x5')]=_0x195f6d[_0x289a('0x5')]||[];}module[_0x289a('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index e07d68c..2730172 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 _0xe626=['hasOwnProperty','initMailAccounts','isUndefined','merge','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase'];(function(_0x3e2d5f,_0x118dbc){var _0x3cbdbd=function(_0x2e2424){while(--_0x2e2424){_0x3e2d5f['push'](_0x3e2d5f['shift']());}};_0x3cbdbd(++_0x118dbc);}(_0xe626,0xf7));var _0x6e62=function(_0x1d815c,_0x5992ad){_0x1d815c=_0x1d815c-0x0;var _0x254656=_0xe626[_0x1d815c];return _0x254656;};'use strict';var _=require('lodash');var MailAccount=require(_0x6e62('0x0'));var Realtime=function(){this[_0x6e62('0x1')]={};};function freeIsNotKey(_0x121043,_0x5e90e7,_0x288950){var _0x323748=_[_0x6e62('0x2')](_0x121043,function(_0x3c5b6e,_0x382706){return _0x3c5b6e[_0x288950];});for(var _0xb20276 in _0x5e90e7){if(_0x5e90e7['hasOwnProperty'](_0xb20276)){if(!_0x323748[_0xb20276]){delete _0x5e90e7[_0xb20276];}}}}Realtime[_0x6e62('0x3')][_0x6e62('0x4')]=function(_0x21e32b,_0x5fdbe6){for(var _0x118834 in _0x5fdbe6){if(_0x21e32b[_0x6e62('0x5')](_0x118834)){_0x21e32b[_0x118834]=_0x5fdbe6[_0x118834];}}};Realtime[_0x6e62('0x3')][_0x6e62('0x6')]=function(){var _0x41cf06=this;return function(_0x24ae94){if(_0x24ae94){freeIsNotKey(_0x24ae94,_0x41cf06[_0x6e62('0x1')],'id');for(var _0x5f0d5f=0x0,_0x30bd6e={},_0x36d7d6={};_0x5f0d5f<_0x24ae94['length'];_0x5f0d5f+=0x1){_0x30bd6e=_0x24ae94[_0x5f0d5f];if(_[_0x6e62('0x7')](_0x41cf06[_0x6e62('0x1')][_0x30bd6e['id']])){_0x41cf06[_0x6e62('0x1')][_0x30bd6e['id']]=new MailAccount(_0x30bd6e);}else{_[_0x6e62('0x8')](_0x41cf06[_0x6e62('0x1')][_0x30bd6e['id']],_0x30bd6e);}}}return _0x41cf06[_0x6e62('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0x93cf=['exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','mailAccounts','length','merge'];(function(_0x2be004,_0x7393c3){var _0x1722ea=function(_0x5642f9){while(--_0x5642f9){_0x2be004['push'](_0x2be004['shift']());}};_0x1722ea(++_0x7393c3);}(_0x93cf,0xfe));var _0xf93c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x93cf[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf93c('0x0'));var MailAccount=require(_0xf93c('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5f4fc5,_0xe6450c,_0x214708){var _0x42b349=_[_0xf93c('0x2')](_0x5f4fc5,function(_0x20d76f,_0x59376f){return _0x20d76f[_0x214708];});for(var _0x5f4936 in _0xe6450c){if(_0xe6450c[_0xf93c('0x3')](_0x5f4936)){if(!_0x42b349[_0x5f4936]){delete _0xe6450c[_0x5f4936];}}}}Realtime[_0xf93c('0x4')][_0xf93c('0x5')]=function(_0x406253,_0x408fb9){for(var _0x55a7f7 in _0x408fb9){if(_0x406253[_0xf93c('0x3')](_0x55a7f7)){_0x406253[_0x55a7f7]=_0x408fb9[_0x55a7f7];}}};Realtime[_0xf93c('0x4')][_0xf93c('0x6')]=function(){var _0x3c59ca=this;return function(_0x510db6){if(_0x510db6){freeIsNotKey(_0x510db6,_0x3c59ca[_0xf93c('0x7')],'id');for(var _0x569688=0x0,_0x52be65={},_0x10d3fd={};_0x569688<_0x510db6[_0xf93c('0x8')];_0x569688+=0x1){_0x52be65=_0x510db6[_0x569688];if(_['isUndefined'](_0x3c59ca[_0xf93c('0x7')][_0x52be65['id']])){_0x3c59ca[_0xf93c('0x7')][_0x52be65['id']]=new MailAccount(_0x52be65);}else{_[_0xf93c('0x9')](_0x3c59ca[_0xf93c('0x7')][_0x52be65['id']],_0x52be65);}}}return _0x3c59ca[_0xf93c('0x7')];};};module[_0xf93c('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 47c95f1..42629f8 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 _0xdccd=['key','ListId','MailServerIn','Imap','CloudProvider','type','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active'];(function(_0x5343df,_0x4fc8b4){var _0x44fe60=function(_0x576b74){while(--_0x576b74){_0x5343df['push'](_0x5343df['shift']());}};_0x44fe60(++_0x4fc8b4);}(_0xdccd,0x102));var _0xddcc=function(_0xf47d4a,_0x1dccaa){_0xf47d4a=_0xf47d4a-0x0;var _0x492542=_0xdccd[_0xf47d4a];return _0x492542;};'use strict';var client=require(_0xddcc('0x0'));exports[_0xddcc('0x1')]=function(){return function(){return client[_0xddcc('0x2')](_0xddcc('0x3'),{'options':{'attributes':['id',_0xddcc('0x4'),'provider',_0xddcc('0x5'),_0xddcc('0x6'),_0xddcc('0x7'),_0xddcc('0x8'),_0xddcc('0x9'),'TemplateId'],'raw':![],'include':[{'model':_0xddcc('0xa'),'as':_0xddcc('0xb'),'include':[{'model':_0xddcc('0xc'),'attributes':['id','name',_0xddcc('0x5'),_0xddcc('0xd'),'data5'],'as':_0xddcc('0xc')}]},{'model':_0xddcc('0xe'),'as':_0xddcc('0xf'),'include':[{'model':_0xddcc('0xc'),'attributes':['id',_0xddcc('0x4'),_0xddcc('0x5'),_0xddcc('0xd'),'data5'],'as':_0xddcc('0xc')}]}]},'log':_0xddcc('0x10')});};};exports[_0xddcc('0x11')]=function(_0x5e69d0,_0x3a2f7d){return client[_0xddcc('0x2')](_0xddcc('0x12'),{'account':{'id':_0x5e69d0},'body':_0x3a2f7d,'log':_0xddcc('0x12')});}; \ No newline at end of file +var _0x01a2=['Request','GetMailAccount','name','provider','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','getMailAccounts'];(function(_0x243d3f,_0x3f4817){var _0x573194=function(_0x7e619){while(--_0x7e619){_0x243d3f['push'](_0x243d3f['shift']());}};_0x573194(++_0x3f4817);}(_0x01a2,0x1cb));var _0x201a=function(_0x32abd6,_0x3ce007){_0x32abd6=_0x32abd6-0x0;var _0xf47cde=_0x01a2[_0x32abd6];return _0xf47cde;};'use strict';var client=require('../client');exports[_0x201a('0x0')]=function(){return function(){return client[_0x201a('0x1')](_0x201a('0x2'),{'options':{'attributes':['id',_0x201a('0x3'),_0x201a('0x4'),'service','email',_0x201a('0x5'),_0x201a('0x6'),_0x201a('0x7'),_0x201a('0x8')],'raw':![],'include':[{'model':_0x201a('0x9'),'as':_0x201a('0xa'),'include':[{'model':_0x201a('0xb'),'attributes':['id',_0x201a('0x3'),_0x201a('0xc'),_0x201a('0xd'),_0x201a('0xe')],'as':_0x201a('0xb')}]},{'model':_0x201a('0xf'),'as':_0x201a('0x10'),'include':[{'model':_0x201a('0xb'),'attributes':['id','name',_0x201a('0xc'),_0x201a('0xd'),'data5'],'as':'CloudProvider'}]}]},'log':_0x201a('0x11')});};};exports[_0x201a('0x12')]=function(_0x54eb34,_0x233c63){return client[_0x201a('0x1')](_0x201a('0x13'),{'account':{'id':_0x54eb34},'body':_0x233c63,'log':_0x201a('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index e40ccb2..8f8e657 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 _0x8b99=['loginMailFrequency','GetSettings','getSettings'];(function(_0x16e187,_0x59c43d){var _0x49ec9c=function(_0x1ef86f){while(--_0x1ef86f){_0x16e187['push'](_0x16e187['shift']());}};_0x49ec9c(++_0x59c43d);}(_0x8b99,0x89));var _0x98b9=function(_0x286bd7,_0x443dfa){_0x286bd7=_0x286bd7-0x0;var _0x40cb75=_0x8b99[_0x286bd7];return _0x40cb75;};'use strict';var client=require('../client');exports[_0x98b9('0x0')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x98b9('0x1')]},'log':_0x98b9('0x2')});}; \ No newline at end of file +var _0xc191=['getSettings','Request','ShowSetting','GetSettings','../client'];(function(_0x29f121,_0x424438){var _0x1066fc=function(_0x258af9){while(--_0x258af9){_0x29f121['push'](_0x29f121['shift']());}};_0x1066fc(++_0x424438);}(_0xc191,0xef));var _0x1c19=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0xc191[_0x3e6729];return _0x535bcd;};'use strict';var client=require(_0x1c19('0x0'));exports[_0x1c19('0x1')]=function(){return client[_0x1c19('0x2')](_0x1c19('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x1c19('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 8e82f63..62f951f 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 1410c0a..3d46a60 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 _0x32a0=['../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','ioredis','../../config/environment','createServer','listen','socket.io','websocket','redis','defaults','localhost','adapter','default','../../config/socketio'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x32a0,0x125));var _0x032a=function(_0xa6c567,_0x4d0421){_0xa6c567=_0xa6c567-0x0;var _0x181ce7=_0x32a0[_0xa6c567];return _0x181ce7;};'use strict';var _=require(_0x032a('0x0'));var http=require(_0x032a('0x1'));var express=require(_0x032a('0x2'));var sticky=require('sticky-session');var Redis=require(_0x032a('0x3'));var config=require(_0x032a('0x4'));var app=express();var server=http[_0x032a('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x032a('0x6')](server,config['port'])){var socketio=require(_0x032a('0x7'))(server,{'transports':[_0x032a('0x8'),'polling']});config[_0x032a('0x9')]=_[_0x032a('0xa')](config['redis'],{'host':_0x032a('0xb'),'port':0x18eb});socketio[_0x032a('0xc')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x032a('0xd')]();require(_0x032a('0xe'))[_0x032a('0xd')](socketio);require(_0x032a('0xf'))[_0x032a('0xd')](app);require('../../routes')[_0x032a('0xd')](app);}else{server[_0x032a('0x10')](_0x032a('0x11'),function(){console[_0x032a('0x12')](_0x032a('0x13'),config[_0x032a('0x14')]);});}exports=module[_0x032a('0x15')]=app; \ No newline at end of file +var _0x0220=['socket.io','websocket','polling','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','sticky-session','ioredis','../../config/environment','createServer','port'];(function(_0x84b9eb,_0x4a62ca){var _0x4b8adb=function(_0x1a7bda){while(--_0x1a7bda){_0x84b9eb['push'](_0x84b9eb['shift']());}};_0x4b8adb(++_0x4a62ca);}(_0x0220,0xb9));var _0x0022=function(_0x5c4b6a,_0x3e4163){_0x5c4b6a=_0x5c4b6a-0x0;var _0x2dec05=_0x0220[_0x5c4b6a];return _0x2dec05;};'use strict';var _=require('lodash');var http=require('http');var express=require('express');var sticky=require(_0x0022('0x0'));var Redis=require(_0x0022('0x1'));var config=require(_0x0022('0x2'));var app=express();var server=http[_0x0022('0x3')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x0022('0x4')])){var socketio=require(_0x0022('0x5'))(server,{'transports':[_0x0022('0x6'),_0x0022('0x7')]});config[_0x0022('0x8')]=_['defaults'](config[_0x0022('0x8')],{'host':'localhost','port':0x18eb});socketio[_0x0022('0x9')](require(_0x0022('0xa'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x0022('0x8')])}));require(_0x0022('0xb'))[_0x0022('0xc')]();require(_0x0022('0xd'))[_0x0022('0xc')](socketio);require('../../config/express')[_0x0022('0xc')](app);require('../../routes')['default'](app);}else{server[_0x0022('0xe')](_0x0022('0xf'),function(){console[_0x0022('0x10')](_0x0022('0x11'),config['port']);});}exports=module[_0x0022('0x12')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 28ca24f..c475583 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 _0x715f=['bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports'];(function(_0x72e297,_0x4ec504){var _0x37f261=function(_0x46eeac){while(--_0x46eeac){_0x72e297['push'](_0x72e297['shift']());}};_0x37f261(++_0x4ec504);}(_0x715f,0xc3));var _0xf715=function(_0x179d07,_0x29431a){_0x179d07=_0x179d07-0x0;var _0xbcbe0b=_0x715f[_0x179d07];return _0xbcbe0b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xf715('0x0'));var logger=require(_0xf715('0x1'))(_0xf715('0x2'));var client=jayson[_0xf715('0x3')][_0xf715('0x4')]({'port':0x2329});client[_0xf715('0x5')]=function(_0x2145e3,_0x234176){return new BPromise(function(_0x454a1f,_0xac831c){return client[_0xf715('0x6')](_0x2145e3,_0x234176)[_0xf715('0x7')](function(_0x4511cc){logger[_0xf715('0x8')](_0xf715('0x9'),_0xf715('0x2'),_0x2145e3,_0x234176,_0x4511cc);if(_0x4511cc[_0xf715('0xa')]){logger[_0xf715('0xa')](_0xf715('0x9'),_0xf715('0x2'),_0x2145e3,_0x4511cc['error']['message'],_0x234176);return _0xac831c(_0x4511cc[_0xf715('0xa')][_0xf715('0xb')]);}else{return _0x454a1f(_0x4511cc[_0xf715('0xc')]);}})[_0xf715('0xd')](function(_0x412de9){logger[_0xf715('0xa')]('rpc',_0xf715('0x2'),_0x2145e3,_0x412de9,_0x234176);return _0xac831c(_0x412de9);});});};module[_0xf715('0xe')]=client; \ No newline at end of file +var _0xda54=['request','then','debug','rpc','error','message','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request'];(function(_0x2505d8,_0x140bfa){var _0x1fc52e=function(_0x5d1bca){while(--_0x5d1bca){_0x2505d8['push'](_0x2505d8['shift']());}};_0x1fc52e(++_0x140bfa);}(_0xda54,0x1c8));var _0x4da5=function(_0x3c1b2d,_0x23b1b9){_0x3c1b2d=_0x3c1b2d-0x0;var _0x412475=_0xda54[_0x3c1b2d];return _0x412475;};'use strict';var jayson=require(_0x4da5('0x0'));var BPromise=require('bluebird');var logger=require(_0x4da5('0x1'))(_0x4da5('0x2'));var client=jayson[_0x4da5('0x3')][_0x4da5('0x4')]({'port':0x2329});client[_0x4da5('0x5')]=function(_0x33db7f,_0x1660d0){return new BPromise(function(_0x1a0f4b,_0xa980c3){return client[_0x4da5('0x6')](_0x33db7f,_0x1660d0)[_0x4da5('0x7')](function(_0x570bb3){logger[_0x4da5('0x8')](_0x4da5('0x9'),_0x4da5('0x2'),_0x33db7f,_0x1660d0,_0x570bb3);if(_0x570bb3[_0x4da5('0xa')]){logger[_0x4da5('0xa')](_0x4da5('0x9'),_0x4da5('0x2'),_0x33db7f,_0x570bb3[_0x4da5('0xa')][_0x4da5('0xb')],_0x1660d0);return _0xa980c3(_0x570bb3[_0x4da5('0xa')][_0x4da5('0xb')]);}else{return _0x1a0f4b(_0x570bb3['result']);}})[_0x4da5('0xc')](function(_0x43b0b7){logger['error'](_0x4da5('0x9'),'routing',_0x33db7f,_0x43b0b7,_0x1660d0);return _0xa980c3(_0x43b0b7);});});};module[_0x4da5('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index a4c93dc..64db1e0 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 _0x1e5f=['resolve','then','initAgents','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x1e5f,0x9a));var _0xf1e5=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0x1e5f[_0x594ece];return _0x471bc4;};'use strict';var BPromise=require(_0xf1e5('0x0'));var server=require(_0xf1e5('0x1'));var Realtime=require(_0xf1e5('0x2'));var user=require(_0xf1e5('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xf1e5('0x4'));var mailQueue=require(_0xf1e5('0x5'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xf1e5('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xf1e5('0x7')]()[_0xf1e5('0x8')](user['getAgents']())[_0xf1e5('0x8')](realtime[_0xf1e5('0x9')]())[_0xf1e5('0x8')](interval['getIntervals']())[_0xf1e5('0x8')](realtime['initIntervals']())[_0xf1e5('0x8')](openchannelQueue[_0xf1e5('0xa')]())[_0xf1e5('0x8')](realtime[_0xf1e5('0xb')]())[_0xf1e5('0x8')](chatQueue['getChatQueues']())['then'](realtime[_0xf1e5('0xc')]())[_0xf1e5('0x8')](smsQueue[_0xf1e5('0xd')]())[_0xf1e5('0x8')](realtime[_0xf1e5('0xe')]())[_0xf1e5('0x8')](mailQueue[_0xf1e5('0xf')]())['then'](realtime[_0xf1e5('0x10')]())[_0xf1e5('0x8')](faxQueue['getFaxQueues']())[_0xf1e5('0x8')](realtime[_0xf1e5('0x11')]())[_0xf1e5('0x8')](whatsappQueue[_0xf1e5('0x12')]())[_0xf1e5('0x8')](realtime[_0xf1e5('0x13')]())[_0xf1e5('0x8')](function(){return realtime;});}function main(){return server[_0xf1e5('0x14')](realtime)[_0xf1e5('0x8')](function(_0x1b46a1){return initRealtime();})[_0xf1e5('0x8')](function(_0x4b8411){return setInterval(initRealtime,0x1388);})[_0xf1e5('0x15')](function(_0x5d8028){console[_0xf1e5('0x16')](_0x5d8028);});}main(); \ No newline at end of file +var _0x9b7b=['initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./server','./rpc/user','./rpc/interval','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9b7b,0x1de));var _0xb9b7=function(_0x5c04b4,_0x3b7cba){_0x5c04b4=_0x5c04b4-0x0;var _0x5ae9a9=_0x9b7b[_0x5c04b4];return _0x5ae9a9;};'use strict';var BPromise=require('bluebird');var server=require(_0xb9b7('0x0'));var Realtime=require('./realtime');var user=require(_0xb9b7('0x1'));var interval=require(_0xb9b7('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xb9b7('0x3'));var mailQueue=require(_0xb9b7('0x4'));var faxQueue=require(_0xb9b7('0x5'));var whatsappQueue=require(_0xb9b7('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xb9b7('0x7')]()[_0xb9b7('0x8')](user[_0xb9b7('0x9')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0xa')]())[_0xb9b7('0x8')](interval[_0xb9b7('0xb')]())['then'](realtime[_0xb9b7('0xc')]())[_0xb9b7('0x8')](openchannelQueue[_0xb9b7('0xd')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0xe')]())['then'](chatQueue[_0xb9b7('0xf')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0x10')]())[_0xb9b7('0x8')](smsQueue[_0xb9b7('0x11')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0x12')]())['then'](mailQueue['getMailQueues']())[_0xb9b7('0x8')](realtime['initMailQueues']())[_0xb9b7('0x8')](faxQueue[_0xb9b7('0x13')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0x14')]())[_0xb9b7('0x8')](whatsappQueue[_0xb9b7('0x15')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0x16')]())[_0xb9b7('0x8')](function(){return realtime;});}function main(){return server[_0xb9b7('0x17')](realtime)[_0xb9b7('0x8')](function(_0x1e2665){return initRealtime();})[_0xb9b7('0x8')](function(_0x30584f){return setInterval(initRealtime,0x1388);})[_0xb9b7('0x18')](function(_0x3518da){console[_0xb9b7('0x19')](_0x3518da);});}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 5436c4c..13623c8 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 _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(_0x1b41a0,_0x24e232){var _0x5e5e27=function(_0x33c16f){while(--_0x33c16f){_0x1b41a0['push'](_0x1b41a0['shift']());}};_0x5e5e27(++_0x24e232);}(_0x814b,0x1a2));var _0xb814=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x814b[_0x50bf5a];return _0x4ddc1d;};'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 +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x14bab0,_0x55dbe8){var _0x5aa9bf=function(_0x56f679){while(--_0x56f679){_0x14bab0['push'](_0x14bab0['shift']());}};_0x5aa9bf(++_0x55dbe8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 0fcc618..ab05088 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 _0xf4fc=['bluebird','jayson/promise','client','http','request','error','result','catch','sendMailMessage'];(function(_0x5265a0,_0x492749){var _0x38f7a6=function(_0x2e187b){while(--_0x2e187b){_0x5265a0['push'](_0x5265a0['shift']());}};_0x38f7a6(++_0x492749);}(_0xf4fc,0x195));var _0xcf4f=function(_0x47e4e7,_0x244ac1){_0x47e4e7=_0x47e4e7-0x0;var _0x29c720=_0xf4fc[_0x47e4e7];return _0x29c720;};'use strict';var BPromise=require(_0xcf4f('0x0'));var jayson=require(_0xcf4f('0x1'));var client=jayson[_0xcf4f('0x2')][_0xcf4f('0x3')]({'port':0x232b});function request(_0x317a59,_0x193e1a){return new BPromise(function(_0x3f862b,_0x259ca5){return client[_0xcf4f('0x4')](_0x317a59,_0x193e1a)['then'](function(_0x469820){if(_0x469820[_0xcf4f('0x5')]){return _0x259ca5(_0x469820[_0xcf4f('0x5')]['message']);}else{return _0x3f862b(_0x469820[_0xcf4f('0x6')]);}})[_0xcf4f('0x7')](function(_0x407738){return _0x259ca5(_0x407738);});});}exports[_0xcf4f('0x8')]=function(_0x69aedc,_0x36ceb2){return request('SendMail',{'account':_0x69aedc,'message':_0x36ceb2});}; \ No newline at end of file +var _0x583b=['http','error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client'];(function(_0x54bb5e,_0xc9513a){var _0x2cfe75=function(_0x52ef1b){while(--_0x52ef1b){_0x54bb5e['push'](_0x54bb5e['shift']());}};_0x2cfe75(++_0xc9513a);}(_0x583b,0xba));var _0xb583=function(_0x48a825,_0x2ee6cf){_0x48a825=_0x48a825-0x0;var _0x424703=_0x583b[_0x48a825];return _0x424703;};'use strict';var BPromise=require(_0xb583('0x0'));var jayson=require(_0xb583('0x1'));var client=jayson[_0xb583('0x2')][_0xb583('0x3')]({'port':0x232b});function request(_0x3f3479,_0xb432e7){return new BPromise(function(_0x4074d5,_0x2dac87){return client['request'](_0x3f3479,_0xb432e7)['then'](function(_0x598f08){if(_0x598f08['error']){return _0x2dac87(_0x598f08[_0xb583('0x4')][_0xb583('0x5')]);}else{return _0x4074d5(_0x598f08[_0xb583('0x6')]);}})[_0xb583('0x7')](function(_0x504eb1){return _0x2dac87(_0x504eb1);});});}exports[_0xb583('0x8')]=function(_0x17445a,_0xf999ee){return request('SendMail',{'account':_0x17445a,'message':_0xf999ee});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 84a973d..1066e06 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 _0x4975=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime','Status','faxStatusTime','whatsappStatus','whatsappCurrentCapacity','mailWaitingInteractions','stringify','omit','exports','lodash','moment'];(function(_0x469aed,_0x58ae60){var _0x20b32f=function(_0x161e67){while(--_0x161e67){_0x469aed['push'](_0x469aed['shift']());}};_0x20b32f(++_0x58ae60);}(_0x4975,0x86));var _0x5497=function(_0x104c78,_0x4c29b3){_0x104c78=_0x104c78-0x0;var _0x26b843=_0x4975[_0x104c78];return _0x26b843;};'use strict';var _=require(_0x5497('0x0'));var md5=require('md5');var moment=require(_0x5497('0x1'));var Redis=require(_0x5497('0x2'));var config=require(_0x5497('0x3'));config[_0x5497('0x4')]=_[_0x5497('0x5')](config[_0x5497('0x4')],{'host':_0x5497('0x6'),'port':0x18eb});var io=require(_0x5497('0x7'))(new Redis(config[_0x5497('0x4')]));function Agent(_0x5d5272){this['id']=_0x5d5272['id']||0x0;this['name']=_0x5d5272[_0x5497('0x8')]||'';this['online']=_0x5d5272[_0x5497('0x9')]||!![];this[_0x5497('0xa')]=_0x5d5272[_0x5497('0xa')]||![];this['chatPause']=_0x5d5272[_0x5497('0xb')]||![];this['mailPause']=_0x5d5272[_0x5497('0xc')]||![];this[_0x5497('0xd')]=_0x5d5272[_0x5497('0xd')]||![];this[_0x5497('0xe')]=_0x5d5272[_0x5497('0xe')]||![];this[_0x5497('0xf')]=_0x5d5272[_0x5497('0xf')]||![];this[_0x5497('0x10')]='unknown';this['chatStatusTime']=0x0;this['chatCapacity']=_0x5d5272[_0x5497('0x11')]||0x0;this[_0x5497('0x12')]=0x0;this[_0x5497('0x13')]=_0x5497('0x14');this[_0x5497('0x15')]=0x0;this[_0x5497('0x16')]=_0x5d5272[_0x5497('0x16')]||0x0;this[_0x5497('0x17')]=0x0;this[_0x5497('0x18')]=_0x5497('0x14');this['faxStatusTime']=0x0;this[_0x5497('0x19')]=_0x5d5272['faxCapacity']||0x0;this[_0x5497('0x1a')]=0x0;this[_0x5497('0x1b')]=_0x5497('0x14');this[_0x5497('0x1c')]=0x0;this[_0x5497('0x1d')]=_0x5d5272[_0x5497('0x1d')]||0x0;this[_0x5497('0x1e')]=0x0;this['whatsappStatus']='unknown';this[_0x5497('0x1f')]=0x0;this[_0x5497('0x20')]=_0x5d5272[_0x5497('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x5497('0x21')]=_0x5497('0x14');this[_0x5497('0x22')]=0x0;this[_0x5497('0x23')]=_0x5d5272[_0x5497('0x23')]||0x0;this[_0x5497('0x24')]=0x0;this[_0x5497('0x25')]=![];this[_0x5497('0x26')]=undefined;this[_0x5497('0x27')]='';this[_0x5497('0x28')]={};this[_0x5497('0x29')]={};this['mailWaitingInteractions']={};this[_0x5497('0x2a')]={};this['smsWaitingInteractions']={};this[_0x5497('0x2b')]={};this[_0x5497('0x2c')]();}Agent[_0x5497('0x2d')][_0x5497('0x2e')]=function(_0x35ecd9){if(this[_0x35ecd9+_0x5497('0x2f')]>0x0){if(this[_0x35ecd9+'Capacity']>0x0&&this[_0x35ecd9+'CurrentCapacity']>=this[_0x35ecd9+_0x5497('0x30')]){return _0x5497('0x31');}else{return _0x5497('0x32');}}else{return _0x5497('0x33');}};Agent['prototype'][_0x5497('0x2c')]=function(){var _0x57268c=[_0x5497('0x34'),_0x5497('0x35'),_0x5497('0x36'),_0x5497('0x37'),_0x5497('0x38'),_0x5497('0x39')];for(var _0x48b835=0x0;_0x48b835<_0x57268c[_0x5497('0x3a')];_0x48b835+=0x1){var _0x5406e2=this['getChannelStatus'](_0x57268c[_0x48b835]);if(this[_0x57268c[_0x48b835]+'Status']!==_0x5406e2){this[_0x57268c[_0x48b835]+_0x5497('0x3b')]=_['toNumber'](moment()['format']('x'));}this[_0x57268c[_0x48b835]+_0x5497('0x3c')]=_0x5406e2;}var _0xb14593={'id':this['id'],'name':this[_0x5497('0x8')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x5497('0xc')],'smsPause':this[_0x5497('0xe')],'faxPause':this[_0x5497('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x5497('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x5497('0x13')],'mailStatusTime':this[_0x5497('0x15')],'mailCapacity':this[_0x5497('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x5497('0x18')],'faxStatusTime':this[_0x5497('0x3d')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x5497('0x1a')],'smsStatus':this[_0x5497('0x1b')],'smsStatusTime':this[_0x5497('0x1c')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x5497('0x1e')],'whatsappStatus':this[_0x5497('0x3e')],'whatsappStatusTime':this[_0x5497('0x1f')],'whatsappCapacity':this[_0x5497('0x20')],'whatsappCurrentCapacity':this[_0x5497('0x3f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x5497('0x22')],'openchannelCapacity':this[_0x5497('0x23')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x5497('0x25')],'busyQueue':this[_0x5497('0x26')],'chatWaitingInteractions':this[_0x5497('0x28')],'faxWaitingInteractions':this[_0x5497('0x29')],'mailWaitingInteractions':this[_0x5497('0x40')],'openchannelWaitingInteractions':this[_0x5497('0x2a')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x5497('0x2b')]};var _0x5b3990=md5(JSON[_0x5497('0x41')](_0xb14593));if(this[_0x5497('0x27')]!==_0x5b3990){this[_0x5497('0x27')]=_0x5b3990;io['emit']('user:routing:update',_[_0x5497('0x42')](_0xb14593,[_0x5497('0x9')]));}};module[_0x5497('0x43')]=Agent; \ No newline at end of file +var _0x9536=['faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','mailStatus','smsStatus','whatsappStatus','chatWaitingInteractions','stringify','user:routing:update','omit','exports','lodash','md5','moment','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime'];(function(_0x5a1577,_0x457783){var _0x205355=function(_0x3354e9){while(--_0x3354e9){_0x5a1577['push'](_0x5a1577['shift']());}};_0x205355(++_0x457783);}(_0x9536,0x179));var _0x6953=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0x9536[_0x57d370];return _0x550fd2;};'use strict';var _=require(_0x6953('0x0'));var md5=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var Redis=require(_0x6953('0x3'));var config=require('../../../config/environment');config[_0x6953('0x4')]=_['defaults'](config[_0x6953('0x4')],{'host':_0x6953('0x5'),'port':0x18eb});var io=require(_0x6953('0x6'))(new Redis(config[_0x6953('0x4')]));function Agent(_0x2f3cc3){this['id']=_0x2f3cc3['id']||0x0;this['name']=_0x2f3cc3[_0x6953('0x7')]||'';this[_0x6953('0x8')]=_0x2f3cc3[_0x6953('0x8')]||!![];this[_0x6953('0x9')]=_0x2f3cc3[_0x6953('0x9')]||![];this['chatPause']=_0x2f3cc3[_0x6953('0xa')]||![];this[_0x6953('0xb')]=_0x2f3cc3[_0x6953('0xb')]||![];this['faxPause']=_0x2f3cc3[_0x6953('0xc')]||![];this[_0x6953('0xd')]=_0x2f3cc3[_0x6953('0xd')]||![];this[_0x6953('0xe')]=_0x2f3cc3[_0x6953('0xe')]||![];this[_0x6953('0xf')]=_0x6953('0x10');this[_0x6953('0x11')]=0x0;this[_0x6953('0x12')]=_0x2f3cc3['chatCapacity']||0x0;this[_0x6953('0x13')]=0x0;this['mailStatus']=_0x6953('0x10');this[_0x6953('0x14')]=0x0;this[_0x6953('0x15')]=_0x2f3cc3[_0x6953('0x15')]||0x0;this[_0x6953('0x16')]=0x0;this[_0x6953('0x17')]=_0x6953('0x10');this[_0x6953('0x18')]=0x0;this[_0x6953('0x19')]=_0x2f3cc3[_0x6953('0x19')]||0x0;this[_0x6953('0x1a')]=0x0;this['smsStatus']='unknown';this[_0x6953('0x1b')]=0x0;this[_0x6953('0x1c')]=_0x2f3cc3[_0x6953('0x1c')]||0x0;this[_0x6953('0x1d')]=0x0;this['whatsappStatus']=_0x6953('0x10');this[_0x6953('0x1e')]=0x0;this['whatsappCapacity']=_0x2f3cc3[_0x6953('0x1f')]||0x0;this[_0x6953('0x20')]=0x0;this[_0x6953('0x21')]=_0x6953('0x10');this[_0x6953('0x22')]=0x0;this['openchannelCapacity']=_0x2f3cc3[_0x6953('0x23')]||0x0;this[_0x6953('0x24')]=0x0;this[_0x6953('0x25')]=![];this[_0x6953('0x26')]=undefined;this[_0x6953('0x1')]='';this['chatWaitingInteractions']={};this[_0x6953('0x27')]={};this[_0x6953('0x28')]={};this['openchannelWaitingInteractions']={};this[_0x6953('0x29')]={};this[_0x6953('0x2a')]={};this[_0x6953('0x2b')]();}Agent[_0x6953('0x2c')]['getChannelStatus']=function(_0x37f339){if(this[_0x37f339+_0x6953('0x2d')]>0x0){if(this[_0x37f339+_0x6953('0x2e')]>0x0&&this[_0x37f339+'CurrentCapacity']>=this[_0x37f339+'Capacity']){return'maxcapacity';}else{return _0x6953('0x2f');}}else{return _0x6953('0x30');}};Agent['prototype'][_0x6953('0x2b')]=function(){var _0x587df0=[_0x6953('0x31'),_0x6953('0x32'),_0x6953('0x33'),_0x6953('0x34'),_0x6953('0x35'),_0x6953('0x36')];for(var _0x53d3dc=0x0;_0x53d3dc<_0x587df0[_0x6953('0x37')];_0x53d3dc+=0x1){var _0x3c1075=this['getChannelStatus'](_0x587df0[_0x53d3dc]);if(this[_0x587df0[_0x53d3dc]+_0x6953('0x38')]!==_0x3c1075){this[_0x587df0[_0x53d3dc]+'StatusTime']=_[_0x6953('0x39')](moment()[_0x6953('0x3a')]('x'));}this[_0x587df0[_0x53d3dc]+_0x6953('0x38')]=_0x3c1075;}var _0x4b0325={'id':this['id'],'name':this[_0x6953('0x7')],'online':this[_0x6953('0x8')],'voicePause':this[_0x6953('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x6953('0xb')],'smsPause':this[_0x6953('0xd')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x6953('0xf')],'chatStatusTime':this[_0x6953('0x11')],'chatCapacity':this[_0x6953('0x12')],'chatCurrentCapacity':this[_0x6953('0x13')],'mailStatus':this[_0x6953('0x3b')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x6953('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x6953('0x17')],'faxStatusTime':this[_0x6953('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x6953('0x3c')],'smsStatusTime':this[_0x6953('0x1b')],'smsCapacity':this[_0x6953('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x6953('0x3d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x6953('0x22')],'openchannelCapacity':this[_0x6953('0x23')],'openchannelCurrentCapacity':this[_0x6953('0x24')],'busy':this[_0x6953('0x25')],'busyQueue':this[_0x6953('0x26')],'chatWaitingInteractions':this[_0x6953('0x3e')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x6953('0x28')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x6953('0x29')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0xc63da7=md5(JSON[_0x6953('0x3f')](_0x4b0325));if(this[_0x6953('0x1')]!==_0xc63da7){this[_0x6953('0x1')]=_0xc63da7;io['emit'](_0x6953('0x40'),_[_0x6953('0x41')](_0x4b0325,[_0x6953('0x8')]));}};module[_0x6953('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 8a29f96..b5f6ecd 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 _0x1a94=['strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x1a94,0x164));var _0x41a9=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x1a94[_0xaa0309];return _0x5de7ce;};'use strict';var _=require('lodash');var md5=require(_0x41a9('0x0'));var util=require(_0x41a9('0x1'));var Redis=require(_0x41a9('0x2'));var config=require(_0x41a9('0x3'));config[_0x41a9('0x4')]=_['defaults'](config[_0x41a9('0x4')],{'host':_0x41a9('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x41a9('0x4')]));function ChatQueue(_0x28e7bd){this['id']=_0x28e7bd['id']||0x0;this[_0x41a9('0x6')]=_0x28e7bd['name']||'';this[_0x41a9('0x7')]=_0x28e7bd['timeout']||0xa;this[_0x41a9('0x8')]=_0x28e7bd[_0x41a9('0x8')]||'beepall';this[_0x41a9('0x9')]=_0x28e7bd[_0x41a9('0x9')];this[_0x41a9('0xa')]={};this[_0x41a9('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x41a9('0xc')]();}ChatQueue[_0x41a9('0xd')]['updateRouting']=function(){var _0x1a1824=this[_0x41a9('0xa')][_0x41a9('0xe')];this[_0x41a9('0xa')]=_[_0x41a9('0xf')](this[_0x41a9('0x9')],'id');this['mapAgentsId'][_0x41a9('0xe')]=_0x1a1824;};ChatQueue[_0x41a9('0xd')][_0x41a9('0xc')]=function(){this[_0x41a9('0x10')]=0x0;this[_0x41a9('0x11')]=0x0;for(var _0x20aa77=0x0;_0x20aa77=0x0?this[_0x41a9('0x14')]:0x0;var _0x32b523={'id':this['id'],'available':this[_0x41a9('0x14')],'loggedIn':this[_0x41a9('0x10')],'name':this[_0x41a9('0x6')],'paused':this[_0x41a9('0x11')],'waiting':this[_0x41a9('0xb')]};var _0x2ca7fb=md5(JSON[_0x41a9('0x15')](_0x32b523));if(this[_0x41a9('0x0')]!==_0x2ca7fb){this[_0x41a9('0x0')]=_0x2ca7fb;io['to'](util['format'](_0x41a9('0x16'),_0x32b523[_0x41a9('0x6')]))[_0x41a9('0x17')](_0x41a9('0x18'),_0x32b523);}};module[_0x41a9('0x19')]=ChatQueue; \ No newline at end of file +var _0x002c=['Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','chatPause','available','chat:queue:%s','exports','lodash','md5','util','ioredis','redis','name','timeout','strategy','beepall'];(function(_0x12a11c,_0x444200){var _0x1c7f67=function(_0x3bd9b0){while(--_0x3bd9b0){_0x12a11c['push'](_0x12a11c['shift']());}};_0x1c7f67(++_0x444200);}(_0x002c,0xf4));var _0xc002=function(_0x259e3e,_0xa42d31){_0x259e3e=_0x259e3e-0x0;var _0x241e01=_0x002c[_0x259e3e];return _0x241e01;};'use strict';var _=require(_0xc002('0x0'));var md5=require(_0xc002('0x1'));var util=require(_0xc002('0x2'));var Redis=require(_0xc002('0x3'));var config=require('../../../config/environment');config[_0xc002('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc002('0x4')]));function ChatQueue(_0x1f7384){this['id']=_0x1f7384['id']||0x0;this[_0xc002('0x5')]=_0x1f7384['name']||'';this['timeout']=_0x1f7384[_0xc002('0x6')]||0xa;this[_0xc002('0x7')]=_0x1f7384[_0xc002('0x7')]||_0xc002('0x8');this[_0xc002('0x9')]=_0x1f7384[_0xc002('0x9')];this['mapAgentsId']={};this[_0xc002('0xa')]=0x0;this['md5']='';this[_0xc002('0xb')]();this['updateRealtime']();}ChatQueue[_0xc002('0xc')][_0xc002('0xb')]=function(){var _0x3c2742=this[_0xc002('0xd')][_0xc002('0xe')];this[_0xc002('0xd')]=_[_0xc002('0xf')](this[_0xc002('0x9')],'id');this[_0xc002('0xd')][_0xc002('0xe')]=_0x3c2742;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xc002('0x10')]=0x0;this[_0xc002('0x11')]=0x0;for(var _0x3b0778=0x0;_0x3b0778=0x0?this[_0xc002('0x14')]:0x0;var _0x1a9bc6={'id':this['id'],'available':this[_0xc002('0x14')],'loggedIn':this[_0xc002('0x10')],'name':this[_0xc002('0x5')],'paused':this['paused'],'waiting':this[_0xc002('0xa')]};var _0x1e74c7=md5(JSON['stringify'](_0x1a9bc6));if(this[_0xc002('0x1')]!==_0x1e74c7){this[_0xc002('0x1')]=_0x1e74c7;io['to'](util['format'](_0xc002('0x15'),_0x1a9bc6[_0xc002('0x5')]))['emit']('chat_queue:save',_0x1a9bc6);}};module[_0xc002('0x16')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index cf056ae..94998bf 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 _0x61c6=['lodash','md5','ioredis','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','paused','length','loggedIn','faxPause','available','waiting','fax:queue:%s','fax_queue:save'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x61c6,0x1a9));var _0x661c=function(_0x1b8b6c,_0x3dd8f6){_0x1b8b6c=_0x1b8b6c-0x0;var _0x320a2e=_0x61c6[_0x1b8b6c];return _0x320a2e;};'use strict';var _=require(_0x661c('0x0'));var md5=require(_0x661c('0x1'));var util=require('util');var Redis=require(_0x661c('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x661c('0x3')](config[_0x661c('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x661c('0x5'))(new Redis(config['redis']));function FaxQueue(_0xe35e77){this['id']=_0xe35e77['id']||0x0;this[_0x661c('0x6')]=_0xe35e77[_0x661c('0x6')]||'';this[_0x661c('0x7')]=_0xe35e77[_0x661c('0x7')]||0xa;this[_0x661c('0x8')]=_0xe35e77[_0x661c('0x8')]||_0x661c('0x9');this['Agents']=_0xe35e77[_0x661c('0xa')];this[_0x661c('0xb')]={};this['waiting']=0x0;this[_0x661c('0x1')]='';this[_0x661c('0xc')]();this[_0x661c('0xd')]();}FaxQueue[_0x661c('0xe')]['updateRouting']=function(){var _0x34aa97=this[_0x661c('0xb')]['_rr'];this[_0x661c('0xb')]=_[_0x661c('0xf')](this['Agents'],'id');this['mapAgentsId'][_0x661c('0x10')]=_0x34aa97;};FaxQueue[_0x661c('0xe')][_0x661c('0xd')]=function(){this['loggedIn']=0x0;this[_0x661c('0x11')]=0x0;for(var _0x34ed1a=0x0;_0x34ed1a=0x0?this[_0x661c('0x15')]:0x0;var _0x2033b1={'id':this['id'],'available':this['available'],'loggedIn':this[_0x661c('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x661c('0x16')]};var _0x5a8732=md5(JSON['stringify'](_0x2033b1));if(this[_0x661c('0x1')]!==_0x5a8732){this[_0x661c('0x1')]=_0x5a8732;io['to'](util['format'](_0x661c('0x17'),_0x2033b1[_0x661c('0x6')]))['emit'](_0x661c('0x18'),_0x2033b1);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x4732=['timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','faxPause','available','waiting','stringify','fax:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x4732,0x9f));var _0x2473=function(_0x278f93,_0x5d74c6){_0x278f93=_0x278f93-0x0;var _0x47d224=_0x4732[_0x278f93];return _0x47d224;};'use strict';var _=require(_0x2473('0x0'));var md5=require(_0x2473('0x1'));var util=require('util');var Redis=require(_0x2473('0x2'));var config=require(_0x2473('0x3'));config[_0x2473('0x4')]=_[_0x2473('0x5')](config[_0x2473('0x4')],{'host':_0x2473('0x6'),'port':0x18eb});var io=require(_0x2473('0x7'))(new Redis(config[_0x2473('0x4')]));function FaxQueue(_0x2df8c2){this['id']=_0x2df8c2['id']||0x0;this[_0x2473('0x8')]=_0x2df8c2[_0x2473('0x8')]||'';this['timeout']=_0x2df8c2[_0x2473('0x9')]||0xa;this[_0x2473('0xa')]=_0x2df8c2['strategy']||_0x2473('0xb');this[_0x2473('0xc')]=_0x2df8c2[_0x2473('0xc')];this[_0x2473('0xd')]={};this['waiting']=0x0;this[_0x2473('0x1')]='';this[_0x2473('0xe')]();this[_0x2473('0xf')]();}FaxQueue[_0x2473('0x10')]['updateRouting']=function(){var _0x41d6a8=this[_0x2473('0xd')][_0x2473('0x11')];this['mapAgentsId']=_[_0x2473('0x12')](this[_0x2473('0xc')],'id');this[_0x2473('0xd')][_0x2473('0x11')]=_0x41d6a8;};FaxQueue[_0x2473('0x10')]['updateRealtime']=function(){this[_0x2473('0x13')]=0x0;this[_0x2473('0x14')]=0x0;for(var _0x15977a=0x0;_0x15977a=0x0?this[_0x2473('0x16')]:0x0;var _0x2d0187={'id':this['id'],'available':this[_0x2473('0x16')],'loggedIn':this[_0x2473('0x13')],'name':this[_0x2473('0x8')],'paused':this[_0x2473('0x14')],'waiting':this[_0x2473('0x17')]};var _0x1ed409=md5(JSON[_0x2473('0x18')](_0x2d0187));if(this['md5']!==_0x1ed409){this[_0x2473('0x1')]=_0x1ed409;io['to'](util['format'](_0x2473('0x19'),_0x2d0187[_0x2473('0x8')]))[_0x2473('0x1a')]('fax_queue:save',_0x2d0187);}};module[_0x2473('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index f9c7f73..70df541 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 _0x5a6d=['name','Intervals','exports'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0x5a6d,0xf9));var _0xd5a6=function(_0x183cbf,_0x3ea333){_0x183cbf=_0x183cbf-0x0;var _0x35788f=_0x5a6d[_0x183cbf];return _0x35788f;};'use strict';function Interval(_0x4e43b3){this['id']=_0x4e43b3['id']||0x0;this[_0xd5a6('0x0')]=_0x4e43b3['name']||'';this[_0xd5a6('0x1')]=_0x4e43b3[_0xd5a6('0x1')]||{};}module[_0xd5a6('0x2')]=Interval; \ No newline at end of file +var _0xd212=['name','Intervals'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0xd212,0x1a6));var _0x2d21=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0xd212[_0x26a4ea];return _0x1b669e;};'use strict';function Interval(_0x2bc6b1){this['id']=_0x2bc6b1['id']||0x0;this[_0x2d21('0x0')]=_0x2bc6b1[_0x2d21('0x0')]||'';this[_0x2d21('0x1')]=_0x2bc6b1[_0x2d21('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index d2cf434..0e0f63e 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 _0xc72e=['map','updateRealtime','length','online','loggedIn','mailPause','paused','available','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr'];(function(_0x24c18c,_0x170f30){var _0x505a62=function(_0xdf5d4){while(--_0xdf5d4){_0x24c18c['push'](_0x24c18c['shift']());}};_0x505a62(++_0x170f30);}(_0xc72e,0x185));var _0xec72=function(_0x590bd0,_0xceb841){_0x590bd0=_0x590bd0-0x0;var _0x1512e3=_0xc72e[_0x590bd0];return _0x1512e3;};'use strict';var _=require(_0xec72('0x0'));var md5=require(_0xec72('0x1'));var util=require(_0xec72('0x2'));var Redis=require(_0xec72('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xec72('0x4')](config[_0xec72('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xec72('0x6'))(new Redis(config[_0xec72('0x5')]));function MailQueue(_0x124b2f){this['id']=_0x124b2f['id']||0x0;this['name']=_0x124b2f[_0xec72('0x7')]||'';this['timeout']=_0x124b2f[_0xec72('0x8')]||0xa;this[_0xec72('0x9')]=_0x124b2f['strategy']||_0xec72('0xa');this[_0xec72('0xb')]=_0x124b2f['Agents'];this[_0xec72('0xc')]={};this[_0xec72('0xd')]=0x0;this[_0xec72('0x1')]='';this[_0xec72('0xe')]();this['updateRealtime']();}MailQueue[_0xec72('0xf')][_0xec72('0xe')]=function(){var _0x28e0c8=this['mapAgentsId'][_0xec72('0x10')];this['mapAgentsId']=_[_0xec72('0x11')](this[_0xec72('0xb')],'id');this[_0xec72('0xc')][_0xec72('0x10')]=_0x28e0c8;};MailQueue[_0xec72('0xf')][_0xec72('0x12')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x12ab9a=0x0;_0x12ab9a=0x0?this[_0xec72('0x18')]:0x0;var _0xa1aa0={'id':this['id'],'available':this['available'],'loggedIn':this[_0xec72('0x15')],'name':this[_0xec72('0x7')],'paused':this[_0xec72('0x17')],'waiting':this['waiting']};var _0x59b382=md5(JSON['stringify'](_0xa1aa0));if(this[_0xec72('0x1')]!==_0x59b382){this[_0xec72('0x1')]=_0x59b382;io['to'](util[_0xec72('0x19')](_0xec72('0x1a'),_0xa1aa0['name']))['emit'](_0xec72('0x1b'),_0xa1aa0);}};module[_0xec72('0x1c')]=MailQueue; \ No newline at end of file +var _0xe111=['defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','mailPause','paused','available','stringify','format','mail:queue:%s','emit','lodash','md5','util','ioredis'];(function(_0x3612e6,_0x48f856){var _0x4cf7a6=function(_0x48dbfd){while(--_0x48dbfd){_0x3612e6['push'](_0x3612e6['shift']());}};_0x4cf7a6(++_0x48f856);}(_0xe111,0x1a5));var _0x1e11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe111[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e11('0x0'));var md5=require(_0x1e11('0x1'));var util=require(_0x1e11('0x2'));var Redis=require(_0x1e11('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x1e11('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1e11('0x5'))(new Redis(config['redis']));function MailQueue(_0x103b98){this['id']=_0x103b98['id']||0x0;this[_0x1e11('0x6')]=_0x103b98[_0x1e11('0x6')]||'';this[_0x1e11('0x7')]=_0x103b98['timeout']||0xa;this[_0x1e11('0x8')]=_0x103b98['strategy']||'beepall';this[_0x1e11('0x9')]=_0x103b98[_0x1e11('0x9')];this[_0x1e11('0xa')]={};this[_0x1e11('0xb')]=0x0;this['md5']='';this[_0x1e11('0xc')]();this[_0x1e11('0xd')]();}MailQueue[_0x1e11('0xe')][_0x1e11('0xc')]=function(){var _0x413183=this['mapAgentsId'][_0x1e11('0xf')];this[_0x1e11('0xa')]=_[_0x1e11('0x10')](this[_0x1e11('0x9')],'id');this[_0x1e11('0xa')]['_rr']=_0x413183;};MailQueue[_0x1e11('0xe')][_0x1e11('0xd')]=function(){this[_0x1e11('0x11')]=0x0;this['paused']=0x0;for(var _0xa482a5=0x0;_0xa482a5=0x0?this[_0x1e11('0x14')]:0x0;var _0x84dfd8={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x1e11('0x6')],'paused':this[_0x1e11('0x13')],'waiting':this['waiting']};var _0x503c37=md5(JSON[_0x1e11('0x15')](_0x84dfd8));if(this['md5']!==_0x503c37){this[_0x1e11('0x1')]=_0x503c37;io['to'](util[_0x1e11('0x16')](_0x1e11('0x17'),_0x84dfd8[_0x1e11('0x6')]))[_0x1e11('0x18')]('mail_queue:save',_0x84dfd8);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index c1b557c..f8a9972 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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x326f,0xd1));var _0xf326=function(_0x577d5f,_0x24c093){_0x577d5f=_0x577d5f-0x0;var _0x58fb61=_0x326f[_0x577d5f];return _0x58fb61;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x5b4c25,_0x32ba9d){var _0x4f0db4=function(_0xf89307){while(--_0xf89307){_0x5b4c25['push'](_0x5b4c25['shift']());}};_0x4f0db4(++_0x32ba9d);}(_0x814b,0x1a2));var _0xb814=function(_0x55e059,_0x2df2c5){_0x55e059=_0x55e059-0x0;var _0x1e6bb7=_0x814b[_0x55e059];return _0x1e6bb7;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 62eed17..c987610 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 _0xfa2f=['loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','sms_queue:save','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','_rr','map','prototype','length','online'];(function(_0x7263a3,_0x4d7ba4){var _0x50c978=function(_0x5ac4a8){while(--_0x5ac4a8){_0x7263a3['push'](_0x7263a3['shift']());}};_0x50c978(++_0x4d7ba4);}(_0xfa2f,0xe8));var _0xffa2=function(_0x2d91bb,_0x2b71e0){_0x2d91bb=_0x2d91bb-0x0;var _0x412692=_0xfa2f[_0x2d91bb];return _0x412692;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xffa2('0x0'));var Redis=require('ioredis');var config=require(_0xffa2('0x1'));config[_0xffa2('0x2')]=_[_0xffa2('0x3')](config['redis'],{'host':_0xffa2('0x4'),'port':0x18eb});var io=require(_0xffa2('0x5'))(new Redis(config[_0xffa2('0x2')]));function SmsQueue(_0x14787c){this['id']=_0x14787c['id']||0x0;this[_0xffa2('0x6')]=_0x14787c[_0xffa2('0x6')]||'';this[_0xffa2('0x7')]=_0x14787c['timeout']||0xa;this['strategy']=_0x14787c[_0xffa2('0x8')]||_0xffa2('0x9');this[_0xffa2('0xa')]=_0x14787c[_0xffa2('0xa')];this[_0xffa2('0xb')]={};this[_0xffa2('0xc')]=0x0;this[_0xffa2('0xd')]='';this['updateRouting']();this[_0xffa2('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x2eb5bb=this[_0xffa2('0xb')][_0xffa2('0xf')];this[_0xffa2('0xb')]=_[_0xffa2('0x10')](this['Agents'],'id');this[_0xffa2('0xb')][_0xffa2('0xf')]=_0x2eb5bb;};SmsQueue[_0xffa2('0x11')][_0xffa2('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32e54e=0x0;_0x32e54e=0x0?this[_0xffa2('0x17')]:0x0;var _0x2ae03f={'id':this['id'],'available':this[_0xffa2('0x17')],'loggedIn':this[_0xffa2('0x14')],'name':this[_0xffa2('0x6')],'paused':this[_0xffa2('0x16')],'waiting':this[_0xffa2('0xc')]};var _0xc10cfb=md5(JSON[_0xffa2('0x18')](_0x2ae03f));if(this[_0xffa2('0xd')]!==_0xc10cfb){this['md5']=_0xc10cfb;io['to'](util[_0xffa2('0x19')](_0xffa2('0x1a'),_0x2ae03f[_0xffa2('0x6')]))['emit'](_0xffa2('0x1b'),_0x2ae03f);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xb377=['Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','available','name','stringify','format','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall'];(function(_0x1d6828,_0x30cbb6){var _0x25fa7f=function(_0x6ede4b){while(--_0x6ede4b){_0x1d6828['push'](_0x1d6828['shift']());}};_0x25fa7f(++_0x30cbb6);}(_0xb377,0x1b6));var _0x7b37=function(_0x171f9e,_0x4c22b9){_0x171f9e=_0x171f9e-0x0;var _0x2f0b1e=_0xb377[_0x171f9e];return _0x2f0b1e;};'use strict';var _=require(_0x7b37('0x0'));var md5=require(_0x7b37('0x1'));var util=require(_0x7b37('0x2'));var Redis=require(_0x7b37('0x3'));var config=require(_0x7b37('0x4'));config[_0x7b37('0x5')]=_[_0x7b37('0x6')](config[_0x7b37('0x5')],{'host':_0x7b37('0x7'),'port':0x18eb});var io=require(_0x7b37('0x8'))(new Redis(config[_0x7b37('0x5')]));function SmsQueue(_0x38d1b4){this['id']=_0x38d1b4['id']||0x0;this['name']=_0x38d1b4['name']||'';this[_0x7b37('0x9')]=_0x38d1b4['timeout']||0xa;this['strategy']=_0x38d1b4[_0x7b37('0xa')]||_0x7b37('0xb');this[_0x7b37('0xc')]=_0x38d1b4[_0x7b37('0xc')];this[_0x7b37('0xd')]={};this[_0x7b37('0xe')]=0x0;this[_0x7b37('0x1')]='';this[_0x7b37('0xf')]();this['updateRealtime']();}SmsQueue[_0x7b37('0x10')][_0x7b37('0xf')]=function(){var _0x4a51b0=this['mapAgentsId'][_0x7b37('0x11')];this[_0x7b37('0xd')]=_[_0x7b37('0x12')](this[_0x7b37('0xc')],'id');this[_0x7b37('0xd')][_0x7b37('0x11')]=_0x4a51b0;};SmsQueue[_0x7b37('0x10')][_0x7b37('0x13')]=function(){this[_0x7b37('0x14')]=0x0;this[_0x7b37('0x15')]=0x0;for(var _0x1a381a=0x0;_0x1a381a=0x0?this[_0x7b37('0x18')]:0x0;var _0x487f5c={'id':this['id'],'available':this[_0x7b37('0x18')],'loggedIn':this[_0x7b37('0x14')],'name':this[_0x7b37('0x19')],'paused':this['paused'],'waiting':this['waiting']};var _0x6905bb=md5(JSON[_0x7b37('0x1a')](_0x487f5c));if(this[_0x7b37('0x1')]!==_0x6905bb){this[_0x7b37('0x1')]=_0x6905bb;io['to'](util[_0x7b37('0x1b')]('sms:queue:%s',_0x487f5c['name']))['emit'](_0x7b37('0x1c'),_0x487f5c);}};module[_0x7b37('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 553ed06..f1e1a52 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 _0x9e85=['format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','whatsappPause','paused','available','waiting','stringify'];(function(_0x58dc03,_0x1c0b28){var _0x2f14bb=function(_0x29e209){while(--_0x29e209){_0x58dc03['push'](_0x58dc03['shift']());}};_0x2f14bb(++_0x1c0b28);}(_0x9e85,0x1d3));var _0x59e8=function(_0xf25c17,_0x288f2c){_0xf25c17=_0xf25c17-0x0;var _0x429736=_0x9e85[_0xf25c17];return _0x429736;};'use strict';var _=require(_0x59e8('0x0'));var md5=require(_0x59e8('0x1'));var util=require(_0x59e8('0x2'));var Redis=require(_0x59e8('0x3'));var config=require(_0x59e8('0x4'));config[_0x59e8('0x5')]=_[_0x59e8('0x6')](config[_0x59e8('0x5')],{'host':_0x59e8('0x7'),'port':0x18eb});var io=require(_0x59e8('0x8'))(new Redis(config[_0x59e8('0x5')]));function WhatsappQueue(_0xca33cd){this['id']=_0xca33cd['id']||0x0;this[_0x59e8('0x9')]=_0xca33cd[_0x59e8('0x9')]||'';this[_0x59e8('0xa')]=_0xca33cd[_0x59e8('0xa')]||0xa;this[_0x59e8('0xb')]=_0xca33cd[_0x59e8('0xb')]||_0x59e8('0xc');this[_0x59e8('0xd')]=_0xca33cd['Agents'];this[_0x59e8('0xe')]={};this['waiting']=0x0;this['md5']='';this[_0x59e8('0xf')]();this[_0x59e8('0x10')]();}WhatsappQueue[_0x59e8('0x11')][_0x59e8('0xf')]=function(){var _0x4b8be4=this[_0x59e8('0xe')][_0x59e8('0x12')];this[_0x59e8('0xe')]=_[_0x59e8('0x13')](this[_0x59e8('0xd')],'id');this[_0x59e8('0xe')][_0x59e8('0x12')]=_0x4b8be4;};WhatsappQueue['prototype'][_0x59e8('0x10')]=function(){this[_0x59e8('0x14')]=0x0;this['paused']=0x0;for(var _0x399cad=0x0;_0x399cad=0x0?this['available']:0x0;var _0x21c661={'id':this['id'],'available':this[_0x59e8('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x59e8('0x18')],'waiting':this[_0x59e8('0x1a')]};var _0x17fda0=md5(JSON[_0x59e8('0x1b')](_0x21c661));if(this[_0x59e8('0x1')]!==_0x17fda0){this[_0x59e8('0x1')]=_0x17fda0;io['to'](util[_0x59e8('0x1c')](_0x59e8('0x1d'),_0x21c661[_0x59e8('0x9')]))[_0x59e8('0x1e')](_0x59e8('0x1f'),_0x21c661);}};module[_0x59e8('0x20')]=WhatsappQueue; \ No newline at end of file +var _0x7923=['format','whatsapp:queue:%s','emit','whatsapp_queue:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','paused','length','online','whatsappPause','available','loggedIn','stringify'];(function(_0x23e8d4,_0xa3b304){var _0x27772e=function(_0x4c02cf){while(--_0x4c02cf){_0x23e8d4['push'](_0x23e8d4['shift']());}};_0x27772e(++_0xa3b304);}(_0x7923,0xc1));var _0x3792=function(_0x38526a,_0x548fa6){_0x38526a=_0x38526a-0x0;var _0x539de7=_0x7923[_0x38526a];return _0x539de7;};'use strict';var _=require('lodash');var md5=require(_0x3792('0x0'));var util=require('util');var Redis=require(_0x3792('0x1'));var config=require(_0x3792('0x2'));config[_0x3792('0x3')]=_[_0x3792('0x4')](config['redis'],{'host':_0x3792('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3792('0x3')]));function WhatsappQueue(_0x392c7d){this['id']=_0x392c7d['id']||0x0;this[_0x3792('0x6')]=_0x392c7d[_0x3792('0x6')]||'';this[_0x3792('0x7')]=_0x392c7d[_0x3792('0x7')]||0xa;this[_0x3792('0x8')]=_0x392c7d[_0x3792('0x8')]||'beepall';this[_0x3792('0x9')]=_0x392c7d['Agents'];this['mapAgentsId']={};this[_0x3792('0xa')]=0x0;this[_0x3792('0x0')]='';this[_0x3792('0xb')]();this[_0x3792('0xc')]();}WhatsappQueue[_0x3792('0xd')][_0x3792('0xb')]=function(){var _0x391202=this[_0x3792('0xe')]['_rr'];this[_0x3792('0xe')]=_[_0x3792('0xf')](this[_0x3792('0x9')],'id');this[_0x3792('0xe')]['_rr']=_0x391202;};WhatsappQueue[_0x3792('0xd')][_0x3792('0xc')]=function(){this['loggedIn']=0x0;this[_0x3792('0x10')]=0x0;for(var _0x19e526=0x0;_0x19e526=0x0?this[_0x3792('0x14')]:0x0;var _0x48f4fc={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3792('0x15')],'name':this[_0x3792('0x6')],'paused':this['paused'],'waiting':this[_0x3792('0xa')]};var _0x1374ef=md5(JSON[_0x3792('0x16')](_0x48f4fc));if(this[_0x3792('0x0')]!==_0x1374ef){this[_0x3792('0x0')]=_0x1374ef;io['to'](util[_0x3792('0x17')](_0x3792('0x18'),_0x48f4fc[_0x3792('0x6')]))[_0x3792('0x19')](_0x3792('0x1a'),_0x48f4fc);}};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 e241a4d..f77b36a 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(_0x435eee,_0x1ff634){var _0x1ec6e4=function(_0xd69dbf){while(--_0xd69dbf){_0x435eee['push'](_0x435eee['shift']());}};_0x1ec6e4(++_0x1ff634);}(_0xb10b,0x12a));var _0xbb10=function(_0x137556,_0x253216){_0x137556=_0x137556-0x0;var _0x41dc31=_0xb10b[_0x137556];return _0x41dc31;};'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(_0x9d7afe,_0x3feea4){var _0x1109c2=function(_0x4d787a){while(--_0x4d787a){_0x9d7afe['push'](_0x9d7afe['shift']());}};_0x1109c2(++_0x3feea4);}(_0xb10b,0x12a));var _0xbb10=function(_0x41c99a,_0x12414d){_0x41c99a=_0x41c99a-0x0;var _0x303bf9=_0xb10b[_0x41c99a];return _0x303bf9;};'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 65aba51..169f2cb 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 _0xb4fb=['UpdateChatInteraction','updateChatInteraction','addTags','Request','update'];(function(_0x462ff9,_0x698993){var _0x205aab=function(_0x3919ef){while(--_0x3919ef){_0x462ff9['push'](_0x462ff9['shift']());}};_0x205aab(++_0x698993);}(_0xb4fb,0x108));var _0xbb4f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb4fb[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xbb4f('0x0')]=function(_0x33a784,_0x552f20){return client['Request'](_0xbb4f('0x1'),{'body':_0x552f20,'options':{'where':{'id':_0x33a784}},'log':_0xbb4f('0x2')});};exports[_0xbb4f('0x3')]=function(_0x2f0c23,_0x5ce48b){return client[_0xbb4f('0x4')]('AddTagsToChatInteraction',{'body':_0x5ce48b,'options':{'where':{'id':_0x2f0c23}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x9dc2=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x9dc2,0xa2));var _0x29dc=function(_0x5b597d,_0xfab835){_0x5b597d=_0x5b597d-0x0;var _0x2d86f8=_0x9dc2[_0x5b597d];return _0x2d86f8;};'use strict';var client=require('../client');exports[_0x29dc('0x0')]=function(_0x27d4b0,_0xae41a5){return client[_0x29dc('0x1')](_0x29dc('0x2'),{'body':_0xae41a5,'options':{'where':{'id':_0x27d4b0}},'log':_0x29dc('0x3')});};exports[_0x29dc('0x4')]=function(_0x56ab2c,_0x29de30){return client[_0x29dc('0x1')](_0x29dc('0x5'),{'body':_0x29de30,'options':{'where':{'id':_0x56ab2c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index d0129f6..1adec82 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 _0x9849=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x3adafa,_0x1ff5ea){var _0x229947=function(_0x3ad71b){while(--_0x3ad71b){_0x3adafa['push'](_0x3adafa['shift']());}};_0x229947(++_0x1ff5ea);}(_0x9849,0x18e));var _0x9984=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x9849[_0x580576];return _0x3f55a0;};'use strict';var client=require(_0x9984('0x0'));exports[_0x9984('0x1')]=function(_0xd43c4a){return client[_0x9984('0x2')](_0x9984('0x3'),{'body':_0xd43c4a,'log':_0x9984('0x4')});}; \ No newline at end of file +var _0xaac0=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x4cb733,_0x1de296){var _0x195e93=function(_0x9de906){while(--_0x9de906){_0x4cb733['push'](_0x4cb733['shift']());}};_0x195e93(++_0x1de296);}(_0xaac0,0x83));var _0x0aac=function(_0x4baa11,_0x7c6290){_0x4baa11=_0x4baa11-0x0;var _0x219273=_0xaac0[_0x4baa11];return _0x219273;};'use strict';var client=require(_0x0aac('0x0'));exports[_0x0aac('0x1')]=function(_0x4526f0){return client[_0x0aac('0x2')](_0x0aac('0x3'),{'body':_0x4526f0,'log':_0x0aac('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 2bd9bee..1e34ef0 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 _0x2e3b=['Request','GetChatQueue','name','timeout','strategy','User','Agents','online','chatPause','getChatQueues'];(function(_0x33e92f,_0x32e636){var _0x514b30=function(_0xdc6a66){while(--_0xdc6a66){_0x33e92f['push'](_0x33e92f['shift']());}};_0x514b30(++_0x32e636);}(_0x2e3b,0x81));var _0xb2e3=function(_0x3205bc,_0x5c5f8c){_0x3205bc=_0x3205bc-0x0;var _0x1800c5=_0x2e3b[_0x3205bc];return _0x1800c5;};'use strict';var client=require('../client');exports[_0xb2e3('0x0')]=function(){return function(){return client[_0xb2e3('0x1')](_0xb2e3('0x2'),{'options':{'raw':![],'attributes':['id',_0xb2e3('0x3'),_0xb2e3('0x4'),_0xb2e3('0x5')],'include':[{'model':_0xb2e3('0x6'),'as':_0xb2e3('0x7'),'attributes':['id','name',_0xb2e3('0x8'),_0xb2e3('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xbeea=['name','strategy','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x57ee21,_0x5cc6be){var _0x58492b=function(_0x5cfcb5){while(--_0x5cfcb5){_0x57ee21['push'](_0x57ee21['shift']());}};_0x58492b(++_0x5cc6be);}(_0xbeea,0xb1));var _0xabee=function(_0x1d7e99,_0xd29d19){_0x1d7e99=_0x1d7e99-0x0;var _0xd3e019=_0xbeea[_0x1d7e99];return _0xd3e019;};'use strict';var client=require(_0xabee('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xabee('0x1')](_0xabee('0x2'),{'options':{'raw':![],'attributes':['id',_0xabee('0x3'),'timeout',_0xabee('0x4')],'include':[{'model':'User','as':_0xabee('0x5'),'attributes':['id',_0xabee('0x3'),_0xabee('0x6'),_0xabee('0x7')]}]},'log':_0xabee('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 015afcf..0cc7c50 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 _0x3fec=['CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client','Request'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xc3fe('0x0'));exports['create']=function(_0x502342){return client[_0xc3fe('0x1')](_0xc3fe('0x2'),{'body':_0x502342,'log':'CreateChatQueueReport'});};exports[_0xc3fe('0x3')]=function(_0x4f85a4,_0x53a208){return client[_0xc3fe('0x1')]('UpdateChatQueueReport',{'body':_0x53a208,'options':{'where':{'uniqueid':_0x4f85a4},'order':[['id',_0xc3fe('0x4')]],'limit':0x1},'log':_0xc3fe('0x5')});}; \ No newline at end of file +var _0xfdb5=['update','Request','DESC','../client','create','CreateChatQueueReport'];(function(_0x1e8a20,_0x76e809){var _0x1d54f1=function(_0x2a45d6){while(--_0x2a45d6){_0x1e8a20['push'](_0x1e8a20['shift']());}};_0x1d54f1(++_0x76e809);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xfdb5[_0x44946b];return _0x249bc4;};'use strict';var client=require(_0x5fdb('0x0'));exports[_0x5fdb('0x1')]=function(_0x18abfe){return client['Request'](_0x5fdb('0x2'),{'body':_0x18abfe,'log':_0x5fdb('0x2')});};exports[_0x5fdb('0x3')]=function(_0x49fd4d,_0x55124b){return client[_0x5fdb('0x4')]('UpdateChatQueueReport',{'body':_0x55124b,'options':{'where':{'uniqueid':_0x49fd4d},'order':[['id',_0x5fdb('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 8fff4fb..92d1b6f 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x23ca4d,_0x5c2a32){var _0x435432=function(_0xe1a5e5){while(--_0xe1a5e5){_0x23ca4d['push'](_0x23ca4d['shift']());}};_0x435432(++_0x5c2a32);}(_0x7a54,0x106));var _0x47a5=function(_0x1efc77,_0x424131){_0x1efc77=_0x1efc77-0x0;var _0x4d618b=_0x7a54[_0x1efc77];return _0x4d618b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x7a54,0x106));var _0x47a5=function(_0x3bfaec,_0x19f428){_0x3bfaec=_0x3bfaec-0x0;var _0x4f492e=_0x7a54[_0x3bfaec];return _0x4f492e;};'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 9a68733..051a512 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 _0x0dc7=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0x3bbb4c,_0x42a6fb){var _0x5684a8=function(_0x329948){while(--_0x329948){_0x3bbb4c['push'](_0x3bbb4c['shift']());}};_0x5684a8(++_0x42a6fb);}(_0x0dc7,0x114));var _0x70dc=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0x0dc7[_0x51ab83];return _0x14b6de;};'use strict';var client=require(_0x70dc('0x0'));exports[_0x70dc('0x1')]=function(_0x288a5c){return client['Request'](_0x70dc('0x2'),{'body':_0x288a5c,'log':_0x70dc('0x3')});}; \ No newline at end of file +var _0xfe6d=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xfe6d,0x1d2));var _0xdfe6=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0xfe6d[_0x191154];return _0x3dcd73;};'use strict';var client=require(_0xdfe6('0x0'));exports[_0xdfe6('0x1')]=function(_0x294d90){return client[_0xdfe6('0x2')](_0xdfe6('0x3'),{'body':_0x294d90,'log':_0xdfe6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 41ffd03..a53c3ba 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 _0x683e=['faxPause','getFaxQueues','../client','Request','GetFaxQueue','name','timeout','User','Agents'];(function(_0x515dfa,_0x5e6fe){var _0x263fc=function(_0x4fa5bc){while(--_0x4fa5bc){_0x515dfa['push'](_0x515dfa['shift']());}};_0x263fc(++_0x5e6fe);}(_0x683e,0x134));var _0xe683=function(_0x16a14c,_0x2dbe5c){_0x16a14c=_0x16a14c-0x0;var _0x12d727=_0x683e[_0x16a14c];return _0x12d727;};'use strict';var client=require(_0xe683('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xe683('0x1')](_0xe683('0x2'),{'options':{'raw':![],'attributes':['id',_0xe683('0x3'),_0xe683('0x4'),'strategy'],'include':[{'model':_0xe683('0x5'),'as':_0xe683('0x6'),'attributes':['id','name','online',_0xe683('0x7')]}]},'log':_0xe683('0x8')});};}; \ No newline at end of file +var _0x6435=['name','timeout','strategy','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0x30e7f4,_0x2ef143){var _0x5c24da=function(_0x283d39){while(--_0x283d39){_0x30e7f4['push'](_0x30e7f4['shift']());}};_0x5c24da(++_0x2ef143);}(_0x6435,0x114));var _0x5643=function(_0x20ba56,_0x54edf3){_0x20ba56=_0x20ba56-0x0;var _0x561e8d=_0x6435[_0x20ba56];return _0x561e8d;};'use strict';var client=require(_0x5643('0x0'));exports[_0x5643('0x1')]=function(){return function(){return client[_0x5643('0x2')](_0x5643('0x3'),{'options':{'raw':![],'attributes':['id',_0x5643('0x4'),_0x5643('0x5'),_0x5643('0x6')],'include':[{'model':'User','as':_0x5643('0x7'),'attributes':['id',_0x5643('0x4'),_0x5643('0x8'),_0x5643('0x9')]}]},'log':_0x5643('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 71cbe2b..341c302 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 _0xb8b7=['CreateFaxQueueReport','update','Request','UpdateFaxQueueReport'];(function(_0x24930b,_0x5c8a31){var _0x253551=function(_0x1620ea){while(--_0x1620ea){_0x24930b['push'](_0x24930b['shift']());}};_0x253551(++_0x5c8a31);}(_0xb8b7,0x114));var _0x7b8b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb8b7[_0x17d9e3];return _0x14192d;};'use strict';var client=require('../client');exports['create']=function(_0x5f4131){return client['Request']('CreateFaxQueueReport',{'body':_0x5f4131,'log':_0x7b8b('0x0')});};exports[_0x7b8b('0x1')]=function(_0x423ff4,_0x5739f6){return client[_0x7b8b('0x2')](_0x7b8b('0x3'),{'body':_0x5739f6,'options':{'where':{'uniqueid':_0x423ff4},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x31ee=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x3de8b5,_0x2f1b53){var _0x378df9=function(_0x3316ec){while(--_0x3316ec){_0x3de8b5['push'](_0x3de8b5['shift']());}};_0x378df9(++_0x2f1b53);}(_0x31ee,0xaa));var _0xe31e=function(_0xbc2760,_0x22f739){_0xbc2760=_0xbc2760-0x0;var _0x1515f6=_0x31ee[_0xbc2760];return _0x1515f6;};'use strict';var client=require(_0xe31e('0x0'));exports[_0xe31e('0x1')]=function(_0x53d29e){return client[_0xe31e('0x2')]('CreateFaxQueueReport',{'body':_0x53d29e,'log':_0xe31e('0x3')});};exports['update']=function(_0x18ebe5,_0x490d5c){return client[_0xe31e('0x2')](_0xe31e('0x4'),{'body':_0x490d5c,'options':{'where':{'uniqueid':_0x18ebe5},'order':[['id',_0xe31e('0x5')]],'limit':0x1},'log':_0xe31e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2ae7768..bacc841 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 _0x3c95=['Intervals','getIntervals','Request'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0x3c95,0xfd));var _0x53c9=function(_0xbf3a4b,_0x40f71f){_0xbf3a4b=_0xbf3a4b-0x0;var _0x39a362=_0x3c95[_0xbf3a4b];return _0x39a362;};'use strict';var client=require('../client');exports[_0x53c9('0x0')]=function(){return function(){return client[_0x53c9('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x53c9('0x2'),'attributes':['id','name','interval']}]},'log':_0x53c9('0x0')});};}; \ No newline at end of file +var _0x1b50=['Interval','Intervals','interval','../client','getIntervals','GetInterval','name'];(function(_0x4e6cbb,_0x3450f0){var _0x15ced4=function(_0x248dd2){while(--_0x248dd2){_0x4e6cbb['push'](_0x4e6cbb['shift']());}};_0x15ced4(++_0x3450f0);}(_0x1b50,0x1a7));var _0x01b5=function(_0x36547c,_0x49f530){_0x36547c=_0x36547c-0x0;var _0x409167=_0x1b50[_0x36547c];return _0x409167;};'use strict';var client=require(_0x01b5('0x0'));exports[_0x01b5('0x1')]=function(){return function(){return client['Request'](_0x01b5('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x01b5('0x3')],'include':[{'model':_0x01b5('0x4'),'as':_0x01b5('0x5'),'attributes':['id',_0x01b5('0x3'),_0x01b5('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 3a0c6da..cf8ffc8 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 _0x8603=['update','updateMailInteraction','addTags','Request','addTagsToChatInteraction'];(function(_0x282571,_0x58eb84){var _0x45fbe0=function(_0x41c8f0){while(--_0x41c8f0){_0x282571['push'](_0x282571['shift']());}};_0x45fbe0(++_0x58eb84);}(_0x8603,0x190));var _0x3860=function(_0x50844d,_0x586c1e){_0x50844d=_0x50844d-0x0;var _0x1aef1c=_0x8603[_0x50844d];return _0x1aef1c;};'use strict';var client=require('../client');exports[_0x3860('0x0')]=function(_0x3b9c54,_0x96d2bc){return client['Request']('UpdateMailInteraction',{'body':_0x96d2bc,'options':{'where':{'id':_0x3b9c54}},'log':_0x3860('0x1')});};exports[_0x3860('0x2')]=function(_0x2f56a3,_0x490262){return client[_0x3860('0x3')]('AddTagsToMailInteraction',{'body':_0x490262,'options':{'where':{'id':_0x2f56a3}},'log':_0x3860('0x4')});}; \ No newline at end of file +var _0x5204=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0x5204,0xdf));var _0x4520=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x5204[_0x2a55f8];return _0x245efd;};'use strict';var client=require(_0x4520('0x0'));exports[_0x4520('0x1')]=function(_0x53b1ab,_0x12a3a1){return client[_0x4520('0x2')](_0x4520('0x3'),{'body':_0x12a3a1,'options':{'where':{'id':_0x53b1ab}},'log':_0x4520('0x4')});};exports[_0x4520('0x5')]=function(_0x592fe0,_0x41d89c){return client['Request'](_0x4520('0x6'),{'body':_0x41d89c,'options':{'where':{'id':_0x592fe0}},'log':_0x4520('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 6589d25..490adbe 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 _0x06ec=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x1d2c4a,_0x54c283){var _0x23e15d=function(_0x2baca1){while(--_0x2baca1){_0x1d2c4a['push'](_0x1d2c4a['shift']());}};_0x23e15d(++_0x54c283);}(_0x06ec,0x87));var _0xc06e=function(_0x29fde7,_0x7c0a35){_0x29fde7=_0x29fde7-0x0;var _0x412590=_0x06ec[_0x29fde7];return _0x412590;};'use strict';var client=require(_0xc06e('0x0'));exports[_0xc06e('0x1')]=function(_0x2bf4b9){return client[_0xc06e('0x2')](_0xc06e('0x3'),{'body':_0x2bf4b9,'log':_0xc06e('0x4')});}; \ No newline at end of file +var _0xd27c=['createMailMessage','../client','create','Request'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd27c,0xf1));var _0xcd27=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0xd27c[_0x3f8743];return _0x1f844c;};'use strict';var client=require(_0xcd27('0x0'));exports[_0xcd27('0x1')]=function(_0x2e68da){return client[_0xcd27('0x2')]('CreateMailMessage',{'body':_0x2e68da,'log':_0xcd27('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 6c8f44b..f99ab1d 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 _0x8ad3=['GetMailQueue','name','online','getMailQueues','../client','Request'];(function(_0xb70d87,_0x431c88){var _0x32e4bd=function(_0x357339){while(--_0x357339){_0xb70d87['push'](_0xb70d87['shift']());}};_0x32e4bd(++_0x431c88);}(_0x8ad3,0xe8));var _0x38ad=function(_0x2b3c75,_0x8995c6){_0x2b3c75=_0x2b3c75-0x0;var _0x289c7a=_0x8ad3[_0x2b3c75];return _0x289c7a;};'use strict';var client=require(_0x38ad('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x38ad('0x1')](_0x38ad('0x2'),{'options':{'raw':![],'attributes':['id',_0x38ad('0x3'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x38ad('0x4'),'mailPause']}]},'log':_0x38ad('0x5')});};}; \ No newline at end of file +var _0xa177=['mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','online'];(function(_0xf05dd,_0x35f3a2){var _0x40fe13=function(_0x4ed094){while(--_0x4ed094){_0xf05dd['push'](_0xf05dd['shift']());}};_0x40fe13(++_0x35f3a2);}(_0xa177,0xca));var _0x7a17=function(_0x3e291f,_0x1118eb){_0x3e291f=_0x3e291f-0x0;var _0x57d9c1=_0xa177[_0x3e291f];return _0x57d9c1;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x7a17('0x0')](_0x7a17('0x1'),{'options':{'raw':![],'attributes':['id',_0x7a17('0x2'),_0x7a17('0x3'),_0x7a17('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x7a17('0x2'),_0x7a17('0x5'),_0x7a17('0x6')]}]},'log':_0x7a17('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 5d56571..db2c1f7 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 _0x2bd2=['DESC','UpdateMailQueueReport','Request','CreateMailQueueReport','update'];(function(_0xdbf400,_0x462a37){var _0x2fcc54=function(_0x6d5755){while(--_0x6d5755){_0xdbf400['push'](_0xdbf400['shift']());}};_0x2fcc54(++_0x462a37);}(_0x2bd2,0x1e7));var _0x22bd=function(_0x617d72,_0x578aac){_0x617d72=_0x617d72-0x0;var _0x592bd2=_0x2bd2[_0x617d72];return _0x592bd2;};'use strict';var client=require('../client');exports['create']=function(_0x15075f){return client[_0x22bd('0x0')]('CreateMailQueueReport',{'body':_0x15075f,'log':_0x22bd('0x1')});};exports[_0x22bd('0x2')]=function(_0x51d2ef,_0x476005){return client[_0x22bd('0x0')]('UpdateMailQueueReport',{'body':_0x476005,'options':{'where':{'uniqueid':_0x51d2ef},'order':[['id',_0x22bd('0x3')]],'limit':0x1},'log':_0x22bd('0x4')});}; \ No newline at end of file +var _0xa182=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x534279,_0x327fb4){var _0x3ca369=function(_0x314bbd){while(--_0x314bbd){_0x534279['push'](_0x534279['shift']());}};_0x3ca369(++_0x327fb4);}(_0xa182,0xae));var _0x2a18=function(_0x944c79,_0x4f6e91){_0x944c79=_0x944c79-0x0;var _0x1fe449=_0xa182[_0x944c79];return _0x1fe449;};'use strict';var client=require(_0x2a18('0x0'));exports[_0x2a18('0x1')]=function(_0xd4f137){return client[_0x2a18('0x2')](_0x2a18('0x3'),{'body':_0xd4f137,'log':_0x2a18('0x3')});};exports[_0x2a18('0x4')]=function(_0x1a67a4,_0x8f6f44){return client[_0x2a18('0x2')](_0x2a18('0x5'),{'body':_0x8f6f44,'options':{'where':{'uniqueid':_0x1a67a4},'order':[['id','DESC']],'limit':0x1},'log':_0x2a18('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index a678d68..78e03c2 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 _0x4dc7=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','addTags','Request'];(function(_0x1e69e9,_0x5c47ba){var _0x4d4a14=function(_0x5ae945){while(--_0x5ae945){_0x1e69e9['push'](_0x1e69e9['shift']());}};_0x4d4a14(++_0x5c47ba);}(_0x4dc7,0x191));var _0x74dc=function(_0x52956b,_0x2c9fa1){_0x52956b=_0x52956b-0x0;var _0x239122=_0x4dc7[_0x52956b];return _0x239122;};'use strict';var client=require(_0x74dc('0x0'));exports[_0x74dc('0x1')]=function(_0x3b766b,_0x532170){return client['Request'](_0x74dc('0x2'),{'body':_0x532170,'options':{'where':{'id':_0x3b766b}},'log':'updateOpenchannelInteraction'});};exports[_0x74dc('0x3')]=function(_0x453824,_0xf93a2f){return client[_0x74dc('0x4')](_0x74dc('0x5'),{'body':_0xf93a2f,'options':{'where':{'id':_0x453824}},'log':_0x74dc('0x6')});}; \ No newline at end of file +var _0xbd99=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction'];(function(_0x2e775c,_0x5ead94){var _0xffcb62=function(_0xae6ff1){while(--_0xae6ff1){_0x2e775c['push'](_0x2e775c['shift']());}};_0xffcb62(++_0x5ead94);}(_0xbd99,0x1df));var _0x9bd9=function(_0x22a621,_0x388265){_0x22a621=_0x22a621-0x0;var _0x973807=_0xbd99[_0x22a621];return _0x973807;};'use strict';var client=require(_0x9bd9('0x0'));exports[_0x9bd9('0x1')]=function(_0x4af32e,_0x5f1b5f){return client[_0x9bd9('0x2')]('UpdateOpenchannelInteraction',{'body':_0x5f1b5f,'options':{'where':{'id':_0x4af32e}},'log':_0x9bd9('0x3')});};exports[_0x9bd9('0x4')]=function(_0x1369ea,_0x25acc7){return client[_0x9bd9('0x2')](_0x9bd9('0x5'),{'body':_0x25acc7,'options':{'where':{'id':_0x1369ea}},'log':_0x9bd9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index ba8d110..773c896 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 _0xe10a=['Request','createOpenchannelMessage'];(function(_0x4bcfcd,_0x5cf858){var _0x5e3bd8=function(_0x1730e2){while(--_0x1730e2){_0x4bcfcd['push'](_0x4bcfcd['shift']());}};_0x5e3bd8(++_0x5cf858);}(_0xe10a,0x1a4));var _0xae10=function(_0x4b3d37,_0x38c25e){_0x4b3d37=_0x4b3d37-0x0;var _0x48dbec=_0xe10a[_0x4b3d37];return _0x48dbec;};'use strict';var client=require('../client');exports['create']=function(_0x101d3c){return client[_0xae10('0x0')]('CreateOpenchannelMessage',{'body':_0x101d3c,'log':_0xae10('0x1')});}; \ No newline at end of file +var _0x44db=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x1fb772,_0xfa4715){var _0x3a0f45=function(_0x1ea764){while(--_0x1ea764){_0x1fb772['push'](_0x1fb772['shift']());}};_0x3a0f45(++_0xfa4715);}(_0x44db,0x7b));var _0xb44d=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0x44db[_0x2c5255];return _0x30d0ea;};'use strict';var client=require(_0xb44d('0x0'));exports[_0xb44d('0x1')]=function(_0xab51a7){return client[_0xb44d('0x2')](_0xb44d('0x3'),{'body':_0xab51a7,'log':_0xb44d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 7b1b427..e77f19e 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 _0x5480=['openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','Agents'];(function(_0x2eee2a,_0x58524c){var _0x3557e8=function(_0x2bf0d7){while(--_0x2bf0d7){_0x2eee2a['push'](_0x2eee2a['shift']());}};_0x3557e8(++_0x58524c);}(_0x5480,0x16d));var _0x0548=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x5480[_0x5447fd];return _0x15b28a;};'use strict';var client=require('../client');exports[_0x0548('0x0')]=function(){return function(){return client[_0x0548('0x1')](_0x0548('0x2'),{'options':{'raw':![],'attributes':['id',_0x0548('0x3'),_0x0548('0x4'),'strategy'],'include':[{'model':'User','as':_0x0548('0x5'),'attributes':['id','name','online',_0x0548('0x6')]}]},'log':_0x0548('0x0')});};}; \ No newline at end of file +var _0xcc34=['User','Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcc34,0x112));var _0x4cc3=function(_0x20a38d,_0x22768c){_0x20a38d=_0x20a38d-0x0;var _0x5480f8=_0xcc34[_0x20a38d];return _0x5480f8;};'use strict';var client=require('../client');exports[_0x4cc3('0x0')]=function(){return function(){return client[_0x4cc3('0x1')](_0x4cc3('0x2'),{'options':{'raw':![],'attributes':['id',_0x4cc3('0x3'),_0x4cc3('0x4'),_0x4cc3('0x5')],'include':[{'model':_0x4cc3('0x6'),'as':_0x4cc3('0x7'),'attributes':['id',_0x4cc3('0x3'),_0x4cc3('0x8'),_0x4cc3('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index d8b3708..053c805 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 _0x4458=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create'];(function(_0x37f5b1,_0x5649d7){var _0x1d2df9=function(_0x11aaaa){while(--_0x11aaaa){_0x37f5b1['push'](_0x37f5b1['shift']());}};_0x1d2df9(++_0x5649d7);}(_0x4458,0x1e4));var _0x8445=function(_0x44b434,_0x2dc916){_0x44b434=_0x44b434-0x0;var _0x5dc7c5=_0x4458[_0x44b434];return _0x5dc7c5;};'use strict';var client=require(_0x8445('0x0'));exports[_0x8445('0x1')]=function(_0x298ae1){return client[_0x8445('0x2')](_0x8445('0x3'),{'body':_0x298ae1,'log':_0x8445('0x3')});};exports[_0x8445('0x4')]=function(_0xdd7438,_0xb4d5cd){return client[_0x8445('0x2')](_0x8445('0x5'),{'body':_0xb4d5cd,'options':{'where':{'uniqueid':_0xdd7438},'order':[['id','DESC']],'limit':0x1},'log':_0x8445('0x5')});}; \ No newline at end of file +var _0xc0ea=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xc0ea,0x12a));var _0xac0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0ea[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xac0e('0x0'));exports[_0xac0e('0x1')]=function(_0x39e4ff){return client[_0xac0e('0x2')](_0xac0e('0x3'),{'body':_0x39e4ff,'log':_0xac0e('0x3')});};exports['update']=function(_0x4be80d,_0x170232){return client[_0xac0e('0x2')](_0xac0e('0x4'),{'body':_0x170232,'options':{'where':{'uniqueid':_0x4be80d},'order':[['id',_0xac0e('0x5')]],'limit':0x1},'log':_0xac0e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index d6887f0..933e4e7 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 _0x447b=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x3748ab,_0x13059e){var _0x3aca73=function(_0x164a6b){while(--_0x164a6b){_0x3748ab['push'](_0x3748ab['shift']());}};_0x3aca73(++_0x13059e);}(_0x447b,0xe4));var _0xb447=function(_0x5d9ceb,_0x1a49f5){_0x5d9ceb=_0x5d9ceb-0x0;var _0x33ce82=_0x447b[_0x5d9ceb];return _0x33ce82;};'use strict';var client=require(_0xb447('0x0'));exports[_0xb447('0x1')]=function(_0x5ea4fc,_0x2063ef){return client[_0xb447('0x2')](_0xb447('0x3'),{'body':_0x2063ef,'options':{'where':{'id':_0x5ea4fc}},'log':_0xb447('0x4')});};exports[_0xb447('0x5')]=function(_0xf8a88b,_0x161c5d){return client[_0xb447('0x2')](_0xb447('0x6'),{'body':_0x161c5d,'options':{'where':{'id':_0xf8a88b}},'log':_0xb447('0x7')});}; \ No newline at end of file +var _0x3435=['Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x2e7025,_0x187270){var _0x5373ed=function(_0x3405f2){while(--_0x3405f2){_0x2e7025['push'](_0x2e7025['shift']());}};_0x5373ed(++_0x187270);}(_0x3435,0xfa));var _0x5343=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x3435[_0x2070da];return _0x4f9fe1;};'use strict';var client=require(_0x5343('0x0'));exports[_0x5343('0x1')]=function(_0x84fe04,_0x9ab4a3){return client[_0x5343('0x2')](_0x5343('0x3'),{'body':_0x9ab4a3,'options':{'where':{'id':_0x84fe04}},'log':'updateSmsInteraction'});};exports[_0x5343('0x4')]=function(_0x3ae07e,_0x578a24){return client['Request'](_0x5343('0x5'),{'body':_0x578a24,'options':{'where':{'id':_0x3ae07e}},'log':_0x5343('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 039e671..44c6395 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 _0xc489=['createSmsMessage','create','Request','CreateSmsMessage'];(function(_0x3d3d9b,_0x201305){var _0x20ceae=function(_0x2d94bc){while(--_0x2d94bc){_0x3d3d9b['push'](_0x3d3d9b['shift']());}};_0x20ceae(++_0x201305);}(_0xc489,0x105));var _0x9c48=function(_0x3b76ae,_0x1f110e){_0x3b76ae=_0x3b76ae-0x0;var _0x11ab0f=_0xc489[_0x3b76ae];return _0x11ab0f;};'use strict';var client=require('../client');exports[_0x9c48('0x0')]=function(_0x2b2421){return client[_0x9c48('0x1')](_0x9c48('0x2'),{'body':_0x2b2421,'log':_0x9c48('0x3')});}; \ No newline at end of file +var _0x0e18=['create','Request'];(function(_0x432486,_0x5a6b72){var _0x2ec3e4=function(_0x16068c){while(--_0x16068c){_0x432486['push'](_0x432486['shift']());}};_0x2ec3e4(++_0x5a6b72);}(_0x0e18,0xa8));var _0x80e1=function(_0xb28acd,_0x400230){_0xb28acd=_0xb28acd-0x0;var _0x50b827=_0x0e18[_0xb28acd];return _0x50b827;};'use strict';var client=require('../client');exports[_0x80e1('0x0')]=function(_0x5bd82e){return client[_0x80e1('0x1')]('CreateSmsMessage',{'body':_0x5bd82e,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index aa1e839..daf7648 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(_0x2f6b9c,_0x470b69){var _0x2300c1=function(_0x2da29e){while(--_0x2da29e){_0x2f6b9c['push'](_0x2f6b9c['shift']());}};_0x2300c1(++_0x470b69);}(_0x70e0,0x17b));var _0x070e=function(_0x3b6e81,_0xda7c7e){_0x3b6e81=_0x3b6e81-0x0;var _0x6b9898=_0x70e0[_0x3b6e81];return _0x6b9898;};'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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x3c9b9e,_0xf6fe69){var _0x22f52d=function(_0x16f863){while(--_0x16f863){_0x3c9b9e['push'](_0x3c9b9e['shift']());}};_0x22f52d(++_0xf6fe69);}(_0x70e0,0x17b));var _0x070e=function(_0x57543c,_0x124aff){_0x57543c=_0x57543c-0x0;var _0x4114b2=_0x70e0[_0x57543c];return _0x4114b2;};'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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 7bc59c9..03a94a8 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 _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xedd9,0xfc));var _0x9edd=function(_0x12c17e,_0x36bd60){_0x12c17e=_0x12c17e-0x0;var _0x5de4d0=_0xedd9[_0x12c17e];return _0x5de4d0;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0xedd9,0xfc));var _0x9edd=function(_0x403c00,_0x14a828){_0x403c00=_0x403c00-0x0;var _0x57985c=_0xedd9[_0x403c00];return _0x57985c;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 218167a..c84cb5f 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(_0x3d359c,_0x17a3d6){var _0x5d6677=function(_0x2edd36){while(--_0x2edd36){_0x3d359c['push'](_0x3d359c['shift']());}};_0x5d6677(++_0x17a3d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x332ded,_0x201a0a){var _0x30e8d2=function(_0x32a99b){while(--_0x32a99b){_0x332ded['push'](_0x332ded['shift']());}};_0x30e8d2(++_0x201a0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'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 df63608..eafef3a 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 _0x49c1=['Request','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client'];(function(_0x4e19c4,_0x317cbc){var _0x41856a=function(_0x2fa327){while(--_0x2fa327){_0x4e19c4['push'](_0x4e19c4['shift']());}};_0x41856a(++_0x317cbc);}(_0x49c1,0xef));var _0x149c=function(_0x468f03,_0x5e28f5){_0x468f03=_0x468f03-0x0;var _0x10c47c=_0x49c1[_0x468f03];return _0x10c47c;};'use strict';var client=require(_0x149c('0x0'));exports['update']=function(_0x466227,_0x2f0c65){return client[_0x149c('0x1')]('UpdateWhatsappInteraction',{'body':_0x2f0c65,'options':{'where':{'id':_0x466227}},'log':_0x149c('0x2')});};exports[_0x149c('0x3')]=function(_0x4c3294,_0xdb4fdf){return client[_0x149c('0x1')]('AddTagsToWhatsappInteraction',{'body':_0xdb4fdf,'options':{'where':{'id':_0x4c3294}},'log':_0x149c('0x4')});}; \ No newline at end of file +var _0xdfa0=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x1765dc,_0x17d194){var _0x5e7800=function(_0x6d8197){while(--_0x6d8197){_0x1765dc['push'](_0x1765dc['shift']());}};_0x5e7800(++_0x17d194);}(_0xdfa0,0x69));var _0x0dfa=function(_0x5ff16f,_0x4d53fb){_0x5ff16f=_0x5ff16f-0x0;var _0x3f6bc4=_0xdfa0[_0x5ff16f];return _0x3f6bc4;};'use strict';var client=require(_0x0dfa('0x0'));exports['update']=function(_0x277084,_0x37ab88){return client['Request'](_0x0dfa('0x1'),{'body':_0x37ab88,'options':{'where':{'id':_0x277084}},'log':_0x0dfa('0x2')});};exports[_0x0dfa('0x3')]=function(_0x4dbbab,_0x373c4e){return client['Request'](_0x0dfa('0x4'),{'body':_0x373c4e,'options':{'where':{'id':_0x4dbbab}},'log':_0x0dfa('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2c6bdcb..c96b6c1 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 _0xad10=['CreateWhatsappMessage','create'];(function(_0x1e05b0,_0x64dbc5){var _0x11ab66=function(_0x1fa91a){while(--_0x1fa91a){_0x1e05b0['push'](_0x1e05b0['shift']());}};_0x11ab66(++_0x64dbc5);}(_0xad10,0x93));var _0x0ad1=function(_0x411d3e,_0x38c5c5){_0x411d3e=_0x411d3e-0x0;var _0x96c54d=_0xad10[_0x411d3e];return _0x96c54d;};'use strict';var client=require('../client');exports[_0x0ad1('0x0')]=function(_0x4fc9b4){return client['Request'](_0x0ad1('0x1'),{'body':_0x4fc9b4,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x5923=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x5923,0xc3));var _0x3592=function(_0x5ab238,_0x4ddda9){_0x5ab238=_0x5ab238-0x0;var _0x236db6=_0x5923[_0x5ab238];return _0x236db6;};'use strict';var client=require(_0x3592('0x0'));exports[_0x3592('0x1')]=function(_0x596b68){return client[_0x3592('0x2')](_0x3592('0x3'),{'body':_0x596b68,'log':_0x3592('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 0dda13c..606bc52 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 _0x37b8=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x3cee22,_0x54ad32){var _0x286fa5=function(_0x3026e5){while(--_0x3026e5){_0x3cee22['push'](_0x3cee22['shift']());}};_0x286fa5(++_0x54ad32);}(_0x37b8,0x81));var _0x837b=function(_0x3611ef,_0x4fbb05){_0x3611ef=_0x3611ef-0x0;var _0x246a54=_0x37b8[_0x3611ef];return _0x246a54;};'use strict';var client=require(_0x837b('0x0'));exports[_0x837b('0x1')]=function(){return function(){return client[_0x837b('0x2')](_0x837b('0x3'),{'options':{'raw':![],'attributes':['id',_0x837b('0x4'),_0x837b('0x5'),_0x837b('0x6')],'include':[{'model':_0x837b('0x7'),'as':_0x837b('0x8'),'attributes':['id',_0x837b('0x4'),_0x837b('0x9'),_0x837b('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x10ff=['strategy','User','Agents','name','online','../client','getWhatsappQueues','Request','timeout'];(function(_0x418b2b,_0xe25672){var _0x374ea6=function(_0x1b31b6){while(--_0x1b31b6){_0x418b2b['push'](_0x418b2b['shift']());}};_0x374ea6(++_0xe25672);}(_0x10ff,0x1f4));var _0xf10f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x10ff[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xf10f('0x0'));exports[_0xf10f('0x1')]=function(){return function(){return client[_0xf10f('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xf10f('0x3'),_0xf10f('0x4')],'include':[{'model':_0xf10f('0x5'),'as':_0xf10f('0x6'),'attributes':['id',_0xf10f('0x7'),_0xf10f('0x8'),'whatsappPause']}]},'log':_0xf10f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3d6e722..b25e917 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 _0xa733=['Request','CreateWhatsappQueueReport','update','DESC','../client','create'];(function(_0x47d232,_0x98aa4c){var _0xbda2d=function(_0x3e7b28){while(--_0x3e7b28){_0x47d232['push'](_0x47d232['shift']());}};_0xbda2d(++_0x98aa4c);}(_0xa733,0xb2));var _0x3a73=function(_0xdc40f,_0x417b12){_0xdc40f=_0xdc40f-0x0;var _0x2e84dd=_0xa733[_0xdc40f];return _0x2e84dd;};'use strict';var client=require(_0x3a73('0x0'));exports[_0x3a73('0x1')]=function(_0x1503f2){return client[_0x3a73('0x2')](_0x3a73('0x3'),{'body':_0x1503f2,'log':'CreateWhatsappQueueReport'});};exports[_0x3a73('0x4')]=function(_0x3cc1ce,_0x428c27){return client[_0x3a73('0x2')]('UpdateWhatsappQueueReport',{'body':_0x428c27,'options':{'where':{'uniqueid':_0x3cc1ce},'order':[['id',_0x3a73('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xe9c5=['update','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0xfa775,_0xac95e0){var _0x515801=function(_0xf9c694){while(--_0xf9c694){_0xfa775['push'](_0xfa775['shift']());}};_0x515801(++_0xac95e0);}(_0xe9c5,0x116));var _0x5e9c=function(_0x6ea75,_0x306a90){_0x6ea75=_0x6ea75-0x0;var _0x2080ff=_0xe9c5[_0x6ea75];return _0x2080ff;};'use strict';var client=require(_0x5e9c('0x0'));exports[_0x5e9c('0x1')]=function(_0x5d4e15){return client[_0x5e9c('0x2')]('CreateWhatsappQueueReport',{'body':_0x5d4e15,'log':_0x5e9c('0x3')});};exports[_0x5e9c('0x4')]=function(_0x3eb62a,_0x1e9d14){return client[_0x5e9c('0x2')]('UpdateWhatsappQueueReport',{'body':_0x1e9d14,'options':{'where':{'uniqueid':_0x3eb62a},'order':[['id','DESC']],'limit':0x1},'log':_0x5e9c('0x5')});}; \ 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 8e17cc6..b6daec1 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 _0xebab=['routing','string','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','length','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger'];(function(_0x3efd24,_0x307e53){var _0x5df6f2=function(_0x52503d){while(--_0x52503d){_0x3efd24['push'](_0x3efd24['shift']());}};_0x5df6f2(++_0x307e53);}(_0xebab,0x124));var _0xbeba=function(_0xab1e97,_0x4d772d){_0xab1e97=_0xab1e97-0x0;var _0x1f16dd=_0xebab[_0xab1e97];return _0x1f16dd;};'use strict';var schema=require(_0xbeba('0x0'));var _=require(_0xbeba('0x1'));var util=require(_0xbeba('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xbeba('0x3'))(_0xbeba('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xbeba('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xbeba('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x42641f,_0x177443,_0x294018){return logger[_0xbeba('0x7')](util[_0xbeba('0x8')](_0xbeba('0x9'),_0x42641f,_0x177443[_0xbeba('0xa')],_0x294018));}function handleFindAgent(_0x209568){return function(_0x38b31a){return _0x38b31a[_0xbeba('0xa')]['toLowerCase']()===_0x209568['toLowerCase']();};}exports[_0xbeba('0xb')]=function(_0x2f8dab,_0x13c2b5,_0x1f4f1f,_0x59259b){return function(_0x19898b){try{var _0x1a2346={'name':_0x13c2b5[0x0],'timeout':_0x13c2b5[0x1]};var _0x2a28b9=queue[_0xbeba('0x0')](_0x1a2346,{'typecast':!![]});if(_0x2a28b9[_0xbeba('0xc')]){logger['error'](_0xbeba('0xd'),_0x2f8dab,_[_0xbeba('0xe')](_0x2a28b9,_0xbeba('0xf'))[_0xbeba('0x10')](',\x20'));_0x19898b[_0xbeba('0x11')]();}else{var _0x7513fc=_[_0xbeba('0x12')](_0x1f4f1f[_0xbeba('0x13')],handleFindAgent(_0x1a2346[_0xbeba('0xa')]));if(_0x7513fc){var _0x33916a=(_0x1a2346[_0xbeba('0x14')]||0xa)*0x3e8;var _0x1d66f0,_0x1ddfef;var _0x25f6ae=seqqueue[_0xbeba('0x15')](_0x33916a);_0x25f6ae['id']=_0x2f8dab;_0x25f6ae[_0xbeba('0x16')]=_0x33916a;_0x25f6ae['channel']=_0x59259b[_0xbeba('0x17')];writeLog(_0x2f8dab,_0x7513fc,util[_0xbeba('0x8')](_0xbeba('0x18'),_0x33916a));_0x1f4f1f[_0xbeba('0x19')][_0x2f8dab]['on'](_0xbeba('0x1a'),function(){logger['info'](_0xbeba('0x1b'),_0x2f8dab);clearTimeout(_0x1ddfef);_0x1ddfef=undefined;_0x25f6ae[_0xbeba('0x1c')]();if(_0x1f4f1f[_0xbeba('0x19')][_0x2f8dab]){delete _0x1f4f1f[_0xbeba('0x19')][_0x2f8dab];}_0x19898b['stop']();});_0x1f4f1f['rules'][_0x2f8dab]['on'](_0xbeba('0x1d'),function(){if(_0x1f4f1f['rules'][_0x2f8dab]){delete _0x1f4f1f['rules'][_0x2f8dab];}});_0x1ddfef=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x2f8dab);clearTimeout(_0x1ddfef);_0x25f6ae['close']();_0x19898b[_0xbeba('0x1e')]();},_0x33916a);strategy[_0xbeba('0x1f')](_0x25f6ae,_0x7513fc,_0x1f4f1f,_0x59259b);}else{logger[_0xbeba('0x20')](_0xbeba('0x21'),_0x2f8dab,_0x1a2346[_0xbeba('0xa')]);_0x19898b['stop']();}}}catch(_0x2c32a3){console[_0xbeba('0x22')](_0x2c32a3);logger['error'](_0xbeba('0x23'),_0x2f8dab,_0x2c32a3[_0xbeba('0x24')]);_0x19898b[_0xbeba('0x11')]();}};}; \ No newline at end of file +var _0x008e=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','join','stop','agents','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format'];(function(_0x1305e3,_0x43a724){var _0x1068e9=function(_0x1bc555){while(--_0x1bc555){_0x1305e3['push'](_0x1305e3['shift']());}};_0x1068e9(++_0x43a724);}(_0x008e,0x1a5));var _0xe008=function(_0x576781,_0x3482a6){_0x576781=_0x576781-0x0;var _0x4d761b=_0x008e[_0x576781];return _0x4d761b;};'use strict';var schema=require(_0xe008('0x0'));var _=require(_0xe008('0x1'));var util=require(_0xe008('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xe008('0x3'))('routing');var strategy=require(_0xe008('0x4'));var queue=schema({'name':{'type':_0xe008('0x5'),'required':!![],'message':_0xe008('0x6')},'timeout':{'type':_0xe008('0x7'),'message':_0xe008('0x8')}});function writeLog(_0x589f04,_0x2a11f2,_0x27e76c){return logger[_0xe008('0x9')](util[_0xe008('0xa')](_0xe008('0xb'),_0x589f04,_0x2a11f2[_0xe008('0xc')],_0x27e76c));}function handleFindAgent(_0x49d34e){return function(_0x3d9ad5){return _0x3d9ad5[_0xe008('0xc')][_0xe008('0xd')]()===_0x49d34e[_0xe008('0xd')]();};}exports[_0xe008('0xe')]=function(_0x1be8ba,_0x4e629b,_0x2ad800,_0x39180b){return function(_0x554854){try{var _0x90d067={'name':_0x4e629b[0x0],'timeout':_0x4e629b[0x1]};var _0x56c0dd=queue[_0xe008('0x0')](_0x90d067,{'typecast':!![]});if(_0x56c0dd[_0xe008('0xf')]){logger[_0xe008('0x10')](_0xe008('0x11'),_0x1be8ba,_[_0xe008('0x12')](_0x56c0dd,'message')[_0xe008('0x13')](',\x20'));_0x554854[_0xe008('0x14')]();}else{var _0x4e0bd8=_['find'](_0x2ad800[_0xe008('0x15')],handleFindAgent(_0x90d067[_0xe008('0xc')]));if(_0x4e0bd8){var _0x5e6ab1=(_0x90d067[_0xe008('0x16')]||0xa)*0x3e8;var _0x3042c6,_0x44d93a;var _0xaa48f6=seqqueue['createQueue'](_0x5e6ab1);_0xaa48f6['id']=_0x1be8ba;_0xaa48f6[_0xe008('0x17')]=_0x5e6ab1;_0xaa48f6[_0xe008('0x18')]=_0x39180b['channel'];writeLog(_0x1be8ba,_0x4e0bd8,util['format'](_0xe008('0x19'),_0x5e6ab1));_0x2ad800[_0xe008('0x1a')][_0x1be8ba]['on'](_0xe008('0x1b'),function(){logger[_0xe008('0x9')](_0xe008('0x1c'),_0x1be8ba);clearTimeout(_0x44d93a);_0x44d93a=undefined;_0xaa48f6[_0xe008('0x1d')]();if(_0x2ad800[_0xe008('0x1a')][_0x1be8ba]){delete _0x2ad800[_0xe008('0x1a')][_0x1be8ba];}_0x554854[_0xe008('0x14')]();});_0x2ad800[_0xe008('0x1a')][_0x1be8ba]['on'](_0xe008('0x1e'),function(){if(_0x2ad800[_0xe008('0x1a')][_0x1be8ba]){delete _0x2ad800[_0xe008('0x1a')][_0x1be8ba];}});_0x44d93a=setTimeout(function(){logger[_0xe008('0x9')](_0xe008('0x1f'),_0x1be8ba);clearTimeout(_0x44d93a);_0xaa48f6[_0xe008('0x1d')]();_0x554854['next']();},_0x5e6ab1);strategy['agent'](_0xaa48f6,_0x4e0bd8,_0x2ad800,_0x39180b);}else{logger['error'](_0xe008('0x20'),_0x1be8ba,_0x90d067[_0xe008('0xc')]);_0x554854['stop']();}}}catch(_0x1c99a6){console[_0xe008('0x21')](_0x1c99a6);logger[_0xe008('0x10')](_0xe008('0x22'),_0x1be8ba,_0x1c99a6[_0xe008('0x23')]);_0x554854[_0xe008('0x14')]();}};}; \ 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 a319afe..82cdddd 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 _0x6d08=['../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','InteractionId','created','body','getMustacheRender','Message','then','info','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','channel','toString','next','amazonlex','providerName','stringify','create','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage'];(function(_0x1ee41b,_0x1874af){var _0x1f5200=function(_0xdfe7b){while(--_0xdfe7b){_0x1ee41b['push'](_0x1ee41b['shift']());}};_0x1f5200(++_0x1874af);}(_0x6d08,0x109));var _0x86d0=function(_0xac7dd5,_0x28219f){_0xac7dd5=_0xac7dd5-0x0;var _0x1a17b9=_0x6d08[_0xac7dd5];return _0x1a17b9;};'use strict';var _=require(_0x86d0('0x0'));var moment=require(_0x86d0('0x1'));var AWS=require('aws-sdk');var utils=require(_0x86d0('0x2'));var logger=require(_0x86d0('0x3'))('routing');var rpc={'chatMessage':require(_0x86d0('0x4')),'openchannelMessage':require(_0x86d0('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x86d0('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x86d0('0x7'))};exports[_0x86d0('0x8')]=function(_0x17c5fb,_0x725e6c){return function(_0x38dfe1){try{if(!_[_0x86d0('0x9')](this[_0x86d0('0xa')]['UserId'])){logger['info'](_0x86d0('0xb'),_0x17c5fb,_0x86d0('0xc'));return _0x38dfe1['next']();}var _0x43c48b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x86d0('0xd')](_0x86d0('0xe')),'direction':_0x86d0('0xf')};if(this['channel']==='sms'||this['channel']===_0x86d0('0x10')){_0x43c48b[_0x86d0('0x11')]=this[_0x86d0('0xa')][_0x86d0('0x11')];}var _0x557904=this['channel'];if(_0x557904===_0x86d0('0x12')){_0x43c48b[_0x86d0('0x13')]=this[_0x86d0('0x14')]['id'];}else{_0x43c48b[_['upperFirst'](_0x557904)+_0x86d0('0x15')]=this[_0x86d0('0x14')]['id'];}_0x43c48b[_['upperFirst'](_0x557904)+_0x86d0('0x16')]=this[_0x86d0('0xa')]['id'];if(this['interaction'][_0x86d0('0x17')]){var _0x50f578=_0x725e6c[0x4];if(!_['isEmpty'](_0x50f578)){_0x43c48b[_0x86d0('0x18')]=utils[_0x86d0('0x19')](_0x50f578,this);return rpc[_0x557904+_0x86d0('0x1a')]['create'](_0x43c48b)[_0x86d0('0x1b')](function(_0x4382c2){logger[_0x86d0('0x1c')](_0x86d0('0xb'),_0x17c5fb,_0x43c48b[_0x86d0('0x18')]);})[_0x86d0('0x1d')](function(_0x508fa5){logger[_0x86d0('0x1e')](_0x86d0('0xb'),_0x17c5fb,JSON['stringify'](_0x508fa5));})['finally'](function(){logger['info'](_0x86d0('0x1f'),_0x17c5fb);_0x38dfe1[_0x86d0('0x20')]();});}else{logger['info'](_0x86d0('0x21'),_0x17c5fb);_0x38dfe1[_0x86d0('0x20')]();}}else{var _0x4f9a8b=this;var _0x3ba21a=new AWS['LexRuntime']({'accessKeyId':_0x725e6c[0x0],'secretAccessKey':_0x725e6c[0x1],'region':_0x725e6c[0x2]});var _0x5f2d76={'botAlias':_0x86d0('0x22'),'botName':_0x725e6c[0x3],'inputText':this[_0x86d0('0x23')]['body'],'userId':this[_0x86d0('0x24')]+':'+this[_0x86d0('0xa')]['id'][_0x86d0('0x25')]()};_0x3ba21a['postText'](_0x5f2d76,function(_0x3418b0,_0x5cd0ae){if(_0x3418b0){logger[_0x86d0('0x1e')](_0x86d0('0xb'),_0x17c5fb,_0x3418b0[_0x86d0('0x23')]);_0x38dfe1[_0x86d0('0x26')]();}else if(_0x5cd0ae&&_0x5cd0ae['message']){_0x4f9a8b[_0x86d0('0x18')][_0x86d0('0x27')]=_0x5cd0ae;_0x43c48b[_0x86d0('0x18')]=_0x5cd0ae['message'];_0x43c48b[_0x86d0('0x28')]=_0x86d0('0x27');_0x43c48b['providerResponse']=JSON[_0x86d0('0x29')](_0x5cd0ae);return rpc[_0x557904+'Message'][_0x86d0('0x2a')](_0x43c48b)[_0x86d0('0x1b')](function(_0x172112){logger['info']('[%s][AMAZONLEX]\x20%s',_0x17c5fb,_0x43c48b[_0x86d0('0x18')]);if(_0x5cd0ae[_0x86d0('0x2b')]==_0x86d0('0x2c')){_0x38dfe1['next']();}else{_0x38dfe1[_0x86d0('0x20')]();}})['catch'](function(_0x537ff9){logger[_0x86d0('0x1e')](_0x86d0('0xb'),_0x17c5fb,JSON['stringify'](_0x537ff9));_0x38dfe1[_0x86d0('0x26')]();});}else{_0x38dfe1[_0x86d0('0x26')]();}});}}catch(_0x55422e){logger[_0x86d0('0x1e')](_0x86d0('0xb'),_0x17c5fb,JSON[_0x86d0('0x29')](_0x55422e));_0x38dfe1[_0x86d0('0x20')]();}};}; \ No newline at end of file +var _0xa97d=['stringify','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','[%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','providerName'];(function(_0x491422,_0xcdc0ca){var _0xa0bd55=function(_0x3dc7e6){while(--_0x3dc7e6){_0x491422['push'](_0x491422['shift']());}};_0xa0bd55(++_0xcdc0ca);}(_0xa97d,0x1c4));var _0xda97=function(_0x49f368,_0xf070e2){_0x49f368=_0x49f368-0x0;var _0x3923f3=_0xa97d[_0x49f368];return _0x3923f3;};'use strict';var _=require(_0xda97('0x0'));var moment=require('moment');var AWS=require(_0xda97('0x1'));var utils=require(_0xda97('0x2'));var logger=require(_0xda97('0x3'))(_0xda97('0x4'));var rpc={'chatMessage':require(_0xda97('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xda97('0x6')),'smsMessage':require(_0xda97('0x7')),'faxMessage':require(_0xda97('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xda97('0x9')]=function(_0x3526f0,_0xebd28f){return function(_0x526bf8){try{if(!_[_0xda97('0xa')](this[_0xda97('0xb')][_0xda97('0xc')])){logger[_0xda97('0xd')](_0xda97('0xe'),_0x3526f0,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x526bf8[_0xda97('0xf')]();}var _0x41ef45={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xda97('0x10')),'direction':_0xda97('0x11')};if(this[_0xda97('0x12')]==='sms'||this[_0xda97('0x12')]===_0xda97('0x13')){_0x41ef45[_0xda97('0x14')]=this['interaction'][_0xda97('0x14')];}var _0x34063a=this[_0xda97('0x12')];if(_0x34063a===_0xda97('0x15')){_0x41ef45[_0xda97('0x16')]=this[_0xda97('0x17')]['id'];}else{_0x41ef45[_[_0xda97('0x18')](_0x34063a)+_0xda97('0x19')]=this[_0xda97('0x17')]['id'];}_0x41ef45[_[_0xda97('0x18')](_0x34063a)+_0xda97('0x1a')]=this[_0xda97('0xb')]['id'];if(this[_0xda97('0xb')][_0xda97('0x1b')]){var _0x1509a2=_0xebd28f[0x4];if(!_[_0xda97('0x1c')](_0x1509a2)){_0x41ef45[_0xda97('0x1d')]=utils[_0xda97('0x1e')](_0x1509a2,this);return rpc[_0x34063a+_0xda97('0x1f')][_0xda97('0x20')](_0x41ef45)[_0xda97('0x21')](function(_0x585634){logger['info'](_0xda97('0xe'),_0x3526f0,_0x41ef45[_0xda97('0x1d')]);})[_0xda97('0x22')](function(_0x5dccf6){logger[_0xda97('0x23')]('[%s][AMAZONLEX]\x20%s',_0x3526f0,JSON['stringify'](_0x5dccf6));})['finally'](function(){logger[_0xda97('0xd')](_0xda97('0x24'),_0x3526f0);_0x526bf8['stop']();});}else{logger['info'](_0xda97('0x25'),_0x3526f0);_0x526bf8[_0xda97('0x26')]();}}else{var _0x158b62=this;var _0x7943fc=new AWS[(_0xda97('0x27'))]({'accessKeyId':_0xebd28f[0x0],'secretAccessKey':_0xebd28f[0x1],'region':_0xebd28f[0x2]});var _0x521297={'botAlias':_0xda97('0x28'),'botName':_0xebd28f[0x3],'inputText':this[_0xda97('0x29')][_0xda97('0x1d')],'userId':this[_0xda97('0x12')]+':'+this[_0xda97('0xb')]['id']['toString']()};_0x7943fc['postText'](_0x521297,function(_0x325e8b,_0x5f2683){if(_0x325e8b){logger[_0xda97('0x23')](_0xda97('0xe'),_0x3526f0,_0x325e8b[_0xda97('0x29')]);_0x526bf8[_0xda97('0xf')]();}else if(_0x5f2683&&_0x5f2683[_0xda97('0x29')]){_0x158b62[_0xda97('0x1d')]['amazonlex']=_0x5f2683;_0x41ef45[_0xda97('0x1d')]=_0x5f2683['message'];_0x41ef45[_0xda97('0x2a')]='amazonlex';_0x41ef45['providerResponse']=JSON[_0xda97('0x2b')](_0x5f2683);return rpc[_0x34063a+_0xda97('0x1f')]['create'](_0x41ef45)['then'](function(_0xe2c4aa){logger[_0xda97('0xd')](_0xda97('0xe'),_0x3526f0,_0x41ef45[_0xda97('0x1d')]);if(_0x5f2683['dialogState']==_0xda97('0x2c')){_0x526bf8[_0xda97('0xf')]();}else{_0x526bf8[_0xda97('0x26')]();}})['catch'](function(_0x354c42){logger[_0xda97('0x23')](_0xda97('0xe'),_0x3526f0,JSON[_0xda97('0x2b')](_0x354c42));_0x526bf8[_0xda97('0xf')]();});}else{_0x526bf8['next']();}});}}catch(_0x4e13ed){logger[_0xda97('0x23')](_0xda97('0xe'),_0x3526f0,JSON['stringify'](_0x4e13ed));_0x526bf8[_0xda97('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 91199f4..2d60c90 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 _0xddc7=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','Interaction','stop','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x3b3017,_0x531959){var _0xd8fd8d=function(_0x537d8f){while(--_0x537d8f){_0x3b3017['push'](_0x3b3017['shift']());}};_0xd8fd8d(++_0x531959);}(_0xddc7,0x15e));var _0x7ddc=function(_0x5c1b26,_0x356a45){_0x5c1b26=_0x5c1b26-0x0;var _0x5253de=_0xddc7[_0x5c1b26];return _0x5253de;};'use strict';var _=require('lodash');var moment=require(_0x7ddc('0x0'));var utils=require(_0x7ddc('0x1'));var logger=require(_0x7ddc('0x2'))('routing');var rpc={'chatMessage':require(_0x7ddc('0x3')),'openchannelMessage':require(_0x7ddc('0x4')),'mailMessage':require(_0x7ddc('0x5')),'smsMessage':require(_0x7ddc('0x6')),'faxMessage':require(_0x7ddc('0x7')),'whatsappMessage':require(_0x7ddc('0x8')),'chatInteraction':require(_0x7ddc('0x9')),'openchannelInteraction':require(_0x7ddc('0xa')),'mailInteraction':require(_0x7ddc('0xb')),'smsInteraction':require(_0x7ddc('0xc')),'faxInteraction':require(_0x7ddc('0xd')),'whatsappInteraction':require(_0x7ddc('0xe'))};var mailRpc=require(_0x7ddc('0xf'));exports[_0x7ddc('0x10')]=function(_0x396f55,_0x2570a7,_0x544540,_0x40c0dd){return function(_0x192bd6){try{var _0xb97439=this[_0x7ddc('0x11')];if(_0xb97439===_0x7ddc('0x12')&&_0x40c0dd[_0x7ddc('0x13')][_0x7ddc('0x14')]){logger[_0x7ddc('0x15')](_0x7ddc('0x16'),_0x396f55,_0x7ddc('0x17'));return _0x192bd6[_0x7ddc('0x18')]();}if(_0x2570a7[0x0]==='1'&&(_['isNil'](this[_0x7ddc('0x19')][_0x7ddc('0x1a')])||!this['interaction']['created'])){logger[_0x7ddc('0x15')](_0x7ddc('0x16'),_0x396f55,_0x7ddc('0x1b'));return _0x192bd6[_0x7ddc('0x18')]();}if(_0x2570a7[0x0]==='2'&&this['interaction'][_0x7ddc('0x1c')]){logger[_0x7ddc('0x15')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x396f55,_0x7ddc('0x1d'));return _0x192bd6[_0x7ddc('0x18')]();}var _0x4b5f93={'ContactId':this[_0x7ddc('0x1e')]['id'],'sentAt':moment()['format'](_0x7ddc('0x1f')),'direction':'out'};if(this[_0x7ddc('0x11')]===_0x7ddc('0x12')){_0x4b5f93[_0x7ddc('0x13')]=utils['getMustacheRender'](_0x2570a7[0x2],this);}else{_0x4b5f93[_0x7ddc('0x13')]=utils[_0x7ddc('0x20')](_0x2570a7[0x1],this);}if(this[_0x7ddc('0x21')]){_0x4b5f93['to']=this[_0x7ddc('0x21')][_0x7ddc('0x22')]||'';if(this[_0x7ddc('0x11')]===_0x7ddc('0x12')&&_0x2570a7[0x1]==='1'){_0x4b5f93['cc']=this[_0x7ddc('0x21')]['cc']||'';}_0x4b5f93['from']=this[_0x7ddc('0x21')]['to']||'';_0x4b5f93[_0x7ddc('0x23')]=this[_0x7ddc('0x21')][_0x7ddc('0x23')]||'';_0x4b5f93['read']=!![];if(this[_0x7ddc('0x21')]['subject']){_0x4b5f93[_0x7ddc('0x24')]='';_0x4b5f93[_0x7ddc('0x24')]+=_[_0x7ddc('0x25')](this[_0x7ddc('0x21')][_0x7ddc('0x24')],_0x7ddc('0x26'))?'':'Re:\x20';_0x4b5f93[_0x7ddc('0x24')]+=this[_0x7ddc('0x21')]['subject'];}}if(this[_0x7ddc('0x11')]===_0x7ddc('0x27')){_0x4b5f93[_0x7ddc('0x28')]=this[_0x7ddc('0x29')]['id'];}else{_0x4b5f93[_[_0x7ddc('0x2a')](this[_0x7ddc('0x11')])+'AccountId']=this[_0x7ddc('0x29')]['id'];}_0x4b5f93[_[_0x7ddc('0x2a')](this['channel'])+_0x7ddc('0x2b')]=this['interaction']['id'];var _0x4978e6=this[_0x7ddc('0x19')];if(rpc[this[_0x7ddc('0x11')]+_0x7ddc('0x2c')]){if(this[_0x7ddc('0x11')]===_0x7ddc('0x12')){_0x4b5f93['inReplyTo']=this[_0x7ddc('0x21')][_0x7ddc('0x2d')];_0x4b5f93[_0x7ddc('0x2e')]=_0x7ddc('0x2f')+_[_0x7ddc('0x30')](_0x4b5f93[_0x7ddc('0x13')],_0x7ddc('0x31'),_0x7ddc('0x32'))+_0x7ddc('0x33');_0x4b5f93[_0x7ddc('0x34')]={'Auto-Submitted':_0x7ddc('0x35'),'X-Auto-Response-Suppress':_0x7ddc('0x36'),'Precedence':_0x7ddc('0x37')};return mailRpc[_0x7ddc('0x38')](this[_0x7ddc('0x29')][_0x7ddc('0x39')],_0x4b5f93)[_0x7ddc('0x3a')](function(_0x3e465d){logger[_0x7ddc('0x15')](_0x7ddc('0x3b'),_0x396f55);_0x4b5f93['messageId']=_0x3e465d[_0x7ddc('0x21')][_0x7ddc('0x2d')];return rpc[_0xb97439+_0x7ddc('0x2c')][_0x7ddc('0x3c')](_0x4b5f93);})[_0x7ddc('0x3a')](function(_0x630eda){logger['info'](_0x7ddc('0x16'),_0x396f55,JSON['stringify'](_0x630eda));})['catch'](function(_0xaa83a7){logger[_0x7ddc('0x3d')](_0x7ddc('0x3e'),_0x396f55,JSON[_0x7ddc('0x3f')](_0xaa83a7));})[_0x7ddc('0x40')](function(){Promise[_0x7ddc('0x41')]()[_0x7ddc('0x3a')](function(){if(_0x2570a7[0x0]!=='2'||_0x4978e6['autoreplyExecuted'])return;return rpc[_0xb97439+'Interaction'][_0x7ddc('0x42')](_0x4978e6['id'],{'autoreplyExecuted':!![]})['then'](function(_0x58951f){logger[_0x7ddc('0x15')](_0x7ddc('0x43'),_0x396f55,JSON[_0x7ddc('0x3f')](_0x58951f));})[_0x7ddc('0x44')](function(_0x2a4bc4){logger[_0x7ddc('0x3d')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x396f55,JSON[_0x7ddc('0x3f')](_0x2a4bc4));});})['then'](function(){_0x192bd6[_0x7ddc('0x18')]();});});}else{return rpc[this[_0x7ddc('0x11')]+_0x7ddc('0x2c')]['create'](_0x4b5f93)['then'](function(){logger['info'](_0x7ddc('0x16'),_0x396f55,_0x4b5f93[_0x7ddc('0x13')]);})[_0x7ddc('0x44')](function(_0x3bfa2c){logger[_0x7ddc('0x3d')]('[%s][AUTOREPLY]\x20%s',_0x396f55,JSON['stringify'](_0x3bfa2c));})[_0x7ddc('0x40')](function(){Promise['resolve']()[_0x7ddc('0x3a')](function(){if(_0x2570a7[0x0]!=='2'||_0x4978e6[_0x7ddc('0x1c')])return;return rpc[_0xb97439+_0x7ddc('0x45')]['update'](_0x4978e6['id'],{'autoreplyExecuted':!![]})[_0x7ddc('0x3a')](function(_0x3ee0c6){logger[_0x7ddc('0x15')](_0x7ddc('0x43'),_0x396f55,JSON['stringify'](_0x3ee0c6));})[_0x7ddc('0x44')](function(_0x16cb56){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x396f55,JSON[_0x7ddc('0x3f')](_0x16cb56));});})[_0x7ddc('0x3a')](function(){_0x192bd6[_0x7ddc('0x18')]();});});}}}catch(_0x10d66d){logger['error']('[%s][AUTOREPLY]\x20%s',_0x396f55,JSON[_0x7ddc('0x3f')](_0x10d66d));_0x192bd6[_0x7ddc('0x46')]();}};}; \ No newline at end of file +var _0x6663=['finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','[%s][AUTOREPLY]\x20%s','stop','lodash','moment','routing','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info','interaction','created','next','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','InteractionId','Message','inReplyTo','html','','headers','auto-replied','All','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s'];(function(_0x45b0e3,_0xc943ce){var _0x159c44=function(_0x5f86cd){while(--_0x5f86cd){_0x45b0e3['push'](_0x45b0e3['shift']());}};_0x159c44(++_0xc943ce);}(_0x6663,0xb6));var _0x3666=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x6663[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0x3666('0x0'));var moment=require(_0x3666('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x3666('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3666('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3666('0x4')),'whatsappMessage':require(_0x3666('0x5')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x3666('0x6')),'mailInteraction':require(_0x3666('0x7')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x3666('0x8'))};var mailRpc=require(_0x3666('0x9'));exports['consequence']=function(_0x1dcf19,_0xd1ede9,_0x1bc214,_0x1b178c){return function(_0x5030d7){try{var _0xf22559=this[_0x3666('0xa')];if(_0xf22559==='mail'&&_0x1b178c[_0x3666('0xb')][_0x3666('0xc')]){logger[_0x3666('0xd')]('[%s][AUTOREPLY]\x20%s',_0x1dcf19,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x5030d7['next']();}if(_0xd1ede9[0x0]==='1'&&(_['isNil'](this[_0x3666('0xe')][_0x3666('0xf')])||!this[_0x3666('0xe')][_0x3666('0xf')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x1dcf19,'Autoreply\x20already\x20sent');return _0x5030d7[_0x3666('0x10')]();}if(_0xd1ede9[0x0]==='2'&&this[_0x3666('0xe')][_0x3666('0x11')]){logger[_0x3666('0xd')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1dcf19,_0x3666('0x12'));return _0x5030d7[_0x3666('0x10')]();}var _0x2f2fdd={'ContactId':this[_0x3666('0x13')]['id'],'sentAt':moment()['format'](_0x3666('0x14')),'direction':_0x3666('0x15')};if(this[_0x3666('0xa')]===_0x3666('0x16')){_0x2f2fdd[_0x3666('0xb')]=utils[_0x3666('0x17')](_0xd1ede9[0x2],this);}else{_0x2f2fdd[_0x3666('0xb')]=utils[_0x3666('0x17')](_0xd1ede9[0x1],this);}if(this[_0x3666('0x18')]){_0x2f2fdd['to']=this['message'][_0x3666('0x19')]||'';if(this[_0x3666('0xa')]===_0x3666('0x16')&&_0xd1ede9[0x1]==='1'){_0x2f2fdd['cc']=this[_0x3666('0x18')]['cc']||'';}_0x2f2fdd[_0x3666('0x19')]=this[_0x3666('0x18')]['to']||'';_0x2f2fdd['phone']=this[_0x3666('0x18')]['phone']||'';_0x2f2fdd['read']=!![];if(this['message']['subject']){_0x2f2fdd[_0x3666('0x1a')]='';_0x2f2fdd['subject']+=_[_0x3666('0x1b')](this[_0x3666('0x18')][_0x3666('0x1a')],_0x3666('0x1c'))?'':_0x3666('0x1d');_0x2f2fdd[_0x3666('0x1a')]+=this[_0x3666('0x18')][_0x3666('0x1a')];}}if(this[_0x3666('0xa')]===_0x3666('0x1e')){_0x2f2fdd['ChatWebsiteId']=this[_0x3666('0x1f')]['id'];}else{_0x2f2fdd[_[_0x3666('0x20')](this[_0x3666('0xa')])+'AccountId']=this['account']['id'];}_0x2f2fdd[_[_0x3666('0x20')](this[_0x3666('0xa')])+_0x3666('0x21')]=this[_0x3666('0xe')]['id'];var _0x5c42da=this[_0x3666('0xe')];if(rpc[this[_0x3666('0xa')]+_0x3666('0x22')]){if(this[_0x3666('0xa')]===_0x3666('0x16')){_0x2f2fdd[_0x3666('0x23')]=this['message']['messageId'];_0x2f2fdd[_0x3666('0x24')]=''+_['replace'](_0x2f2fdd[_0x3666('0xb')],_0x3666('0x25'),']+(>|$)/g,''),'priorityTrue':_0x2ea6ce[0x1],'priorityFalse':_0x2ea6ce[0x2]};var _0x403d85=gotoif[_0xb3e5('0x0')](_0x2829c4,{'typecast':!![]});if(_0x403d85[_0xb3e5('0xd')]){logger['error'](_0xb3e5('0xe'),_0x43126c,_['map'](_0x403d85,'message')[_0xb3e5('0xf')](',\x20'));_0x543c19[_0xb3e5('0x10')]();}else{try{var _0x1d03a2=eval('('+_0x2829c4['condition']+')');var _0x568b23=_0x1d03a2?_0x2829c4[_0xb3e5('0x11')]:_0x2829c4[_0xb3e5('0x12')];logger[_0xb3e5('0x13')](_0xb3e5('0x14'),_0x43126c,_0x2829c4[_0xb3e5('0x15')],_0x1d03a2,_0x568b23||_0xb3e5('0x16'));if(_0x568b23){var _0x5db94c=_[_0xb3e5('0x17')](_0x543c19['rules'](),{'p':_0x568b23});if(_0x5db94c>=0x0){logger['info'](_0xb3e5('0x18'),_0x43126c,_0x568b23||_0xb3e5('0x16'),_0x5db94c);_0x543c19[_0xb3e5('0x16')](_0x5db94c);}else{logger[_0xb3e5('0x13')](_0xb3e5('0x19'),_0x43126c,_0x568b23||'next');_0x543c19['stop']();}}else{_0x543c19[_0xb3e5('0x16')]();}}catch(_0x52f221){logger[_0xb3e5('0x1a')](_0xb3e5('0x1b'),_0x43126c,_0x52f221[_0xb3e5('0x1c')]);_0x543c19[_0xb3e5('0x10')]();}}}catch(_0x2c827d){logger['error']('[%s][GOTOIF]\x20%s',_0x43126c,JSON[_0xb3e5('0x1d')](_0x2c827d));_0x543c19[_0xb3e5('0x10')]();}};}; \ No newline at end of file +var _0x6762=['[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6762,0x11a));var _0x2676=function(_0x2f8dd9,_0x31b477){_0x2f8dd9=_0x2f8dd9-0x0;var _0x2e8139=_0x6762[_0x2f8dd9];return _0x2e8139;};'use strict';var schema=require(_0x2676('0x0'));var _=require(_0x2676('0x1'));var htmlToText=require(_0x2676('0x2'));var utils=require(_0x2676('0x3'));var logger=require(_0x2676('0x4'))(_0x2676('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x2676('0x6')},'priorityTrue':{'type':_0x2676('0x7'),'message':_0x2676('0x8')},'priorityFalse':{'type':_0x2676('0x7'),'message':_0x2676('0x9')}});exports['consequence']=function(_0x20a1a6,_0x1b1e64){return function(_0x365e34){try{var _0x15f713={'condition':htmlToText[_0x2676('0xa')](utils[_0x2676('0xb')](_0x1b1e64[0x0],this),{'wordwrap':![]})[_0x2676('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1b1e64[0x1],'priorityFalse':_0x1b1e64[0x2]};var _0xe72a32=gotoif[_0x2676('0x0')](_0x15f713,{'typecast':!![]});if(_0xe72a32[_0x2676('0xd')]){logger['error'](_0x2676('0xe'),_0x20a1a6,_[_0x2676('0xf')](_0xe72a32,'message')[_0x2676('0x10')](',\x20'));_0x365e34[_0x2676('0x11')]();}else{try{var _0x17bd49=eval('('+_0x15f713[_0x2676('0x12')]+')');var _0x229de3=_0x17bd49?_0x15f713[_0x2676('0x13')]:_0x15f713[_0x2676('0x14')];logger[_0x2676('0x15')](_0x2676('0x16'),_0x20a1a6,_0x15f713[_0x2676('0x12')],_0x17bd49,_0x229de3||_0x2676('0x17'));if(_0x229de3){var _0x1f508c=_[_0x2676('0x18')](_0x365e34[_0x2676('0x19')](),{'p':_0x229de3});if(_0x1f508c>=0x0){logger[_0x2676('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x20a1a6,_0x229de3||_0x2676('0x17'),_0x1f508c);_0x365e34['next'](_0x1f508c);}else{logger[_0x2676('0x15')](_0x2676('0x1a'),_0x20a1a6,_0x229de3||_0x2676('0x17'));_0x365e34[_0x2676('0x11')]();}}else{_0x365e34[_0x2676('0x17')]();}}catch(_0x58a050){logger[_0x2676('0x1b')](_0x2676('0x1c'),_0x20a1a6,_0x58a050[_0x2676('0x1d')]);_0x365e34[_0x2676('0x11')]();}}}catch(_0x5bfb38){logger[_0x2676('0x1b')]('[%s][GOTOIF]\x20%s',_0x20a1a6,JSON[_0x2676('0x1e')](_0x5bfb38));_0x365e34[_0x2676('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index b46cd6f..6bd199c 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 _0x1764=['lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','map','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOP]\x20%s','validate'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0x1764,0x18e));var _0x4176=function(_0x6be432,_0x439a8f){_0x6be432=_0x6be432-0x0;var _0x21c028=_0x1764[_0x6be432];return _0x21c028;};'use strict';var schema=require(_0x4176('0x0'));var _=require(_0x4176('0x1'));var logger=require(_0x4176('0x2'))(_0x4176('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x4176('0x4')}});exports[_0x4176('0x5')]=function(_0x1b98d7,_0x3293a4){return function(_0x26cf7b){try{var _0x4f56c5={'priority':_0x3293a4[0x0]};var _0x3ea370=gotop['validate'](_0x4f56c5,{'typecast':!![]});if(_0x3ea370['length']){logger['error']('[%s][GOTOP]\x20%s',_0x1b98d7,_[_0x4176('0x6')](_0x3ea370,'message')[_0x4176('0x7')](',\x20'));_0x26cf7b[_0x4176('0x8')]();}else{logger['info'](_0x4176('0x9'),_0x1b98d7,_0x4f56c5[_0x4176('0xa')]);if(_0x4f56c5[_0x4176('0xa')]){var _0x44df11=_[_0x4176('0xb')](_0x26cf7b[_0x4176('0xc')](),{'p':_0x4f56c5[_0x4176('0xa')]});if(_0x44df11>=0x0){logger['info'](_0x4176('0xd'),_0x1b98d7,_0x4f56c5[_0x4176('0xa')]||_0x4176('0xe'),_0x44df11);_0x26cf7b[_0x4176('0xe')](_0x44df11);}else{logger[_0x4176('0xf')](_0x4176('0x10'),_0x1b98d7,_0x4f56c5['priority']||_0x4176('0xe'));_0x26cf7b['stop']();}}else{_0x26cf7b[_0x4176('0xe')]();}}}catch(_0x511836){logger[_0x4176('0x11')](_0x4176('0x12'),_0x1b98d7,JSON['stringify'](_0x511836));_0x26cf7b[_0x4176('0x8')]();}};}; \ No newline at end of file +var _0x0116=['message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0116,0x13a));var _0x6011=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0116[_0x1cc8fe];return _0x230054;};'use strict';var schema=require(_0x6011('0x0'));var _=require('lodash');var logger=require(_0x6011('0x1'))(_0x6011('0x2'));var gotop=schema({'priority':{'type':_0x6011('0x3'),'required':!![],'message':_0x6011('0x4')}});exports[_0x6011('0x5')]=function(_0xcb38a5,_0x24369a){return function(_0x4d14aa){try{var _0x264aea={'priority':_0x24369a[0x0]};var _0x29ae8a=gotop[_0x6011('0x0')](_0x264aea,{'typecast':!![]});if(_0x29ae8a['length']){logger[_0x6011('0x6')](_0x6011('0x7'),_0xcb38a5,_[_0x6011('0x8')](_0x29ae8a,_0x6011('0x9'))['join'](',\x20'));_0x4d14aa[_0x6011('0xa')]();}else{logger[_0x6011('0xb')](_0x6011('0xc'),_0xcb38a5,_0x264aea[_0x6011('0xd')]);if(_0x264aea[_0x6011('0xd')]){var _0xc132a0=_['findIndex'](_0x4d14aa[_0x6011('0xe')](),{'p':_0x264aea[_0x6011('0xd')]});if(_0xc132a0>=0x0){logger[_0x6011('0xb')](_0x6011('0xf'),_0xcb38a5,_0x264aea[_0x6011('0xd')]||_0x6011('0x10'),_0xc132a0);_0x4d14aa['next'](_0xc132a0);}else{logger[_0x6011('0xb')](_0x6011('0x11'),_0xcb38a5,_0x264aea[_0x6011('0xd')]||_0x6011('0x10'));_0x4d14aa[_0x6011('0xa')]();}}else{_0x4d14aa[_0x6011('0x10')]();}}}catch(_0x4faf2d){logger[_0x6011('0x6')](_0x6011('0x7'),_0xcb38a5,JSON[_0x6011('0x12')](_0x4faf2d));_0x4d14aa[_0x6011('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index a99177c..1ebbbab 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 _0xc674=['then','body','next','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','ChatWebsiteId','account','channel','InteractionId','interaction','Message','create'];(function(_0x3d2b2c,_0xb6cfc6){var _0x1761cd=function(_0x235a92){while(--_0x235a92){_0x3d2b2c['push'](_0x3d2b2c['shift']());}};_0x1761cd(++_0xb6cfc6);}(_0xc674,0xe8));var _0x4c67=function(_0x483102,_0x54e93d){_0x483102=_0x483102-0x0;var _0x5cc885=_0xc674[_0x483102];return _0x5cc885;};'use strict';var _=require(_0x4c67('0x0'));var utils=require(_0x4c67('0x1'));var logger=require(_0x4c67('0x2'))(_0x4c67('0x3'));var rpc={'chatMessage':require(_0x4c67('0x4')),'openchannelMessage':require(_0x4c67('0x5')),'mailMessage':require(_0x4c67('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4c67('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4c67('0x8')]=function(_0x179fcd,_0x313811){return function(_0x4ee900){try{var _0x4ff0e0={'body':utils[_0x4c67('0x9')](_0x313811[0x0],this),'ContactId':this[_0x4c67('0xa')]['id']};if(this['channel']==='chat'){_0x4ff0e0[_0x4c67('0xb')]=this[_0x4c67('0xc')]['id'];}else{_0x4ff0e0[_['upperFirst'](this[_0x4c67('0xd')])+'AccountId']=this[_0x4c67('0xc')]['id'];}_0x4ff0e0[_['upperFirst'](this[_0x4c67('0xd')])+_0x4c67('0xe')]=this[_0x4c67('0xf')]['id'];if(rpc[this[_0x4c67('0xd')]+_0x4c67('0x10')]){return rpc[this[_0x4c67('0xd')]+'Message'][_0x4c67('0x11')](_0x4ff0e0)[_0x4c67('0x12')](function(_0x382563){logger['info']('[%s][MESSAGE]\x20%s',_0x179fcd,_0x4ff0e0[_0x4c67('0x13')]);_0x4ee900[_0x4c67('0x14')]();})['catch'](function(_0x497eab){logger[_0x4c67('0x15')](_0x4c67('0x16'),_0x179fcd,JSON[_0x4c67('0x17')](_0x497eab));_0x4ee900[_0x4c67('0x18')]();});}}catch(_0x42fdb7){logger[_0x4c67('0x15')](_0x4c67('0x16'),_0x179fcd,JSON[_0x4c67('0x17')](_0x42fdb7));_0x4ee900[_0x4c67('0x18')]();}};}; \ No newline at end of file +var _0xe12f=['[%s][MESSAGE]\x20%s','next','catch','error','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','ChatWebsiteId','upperFirst','AccountId','account','channel','InteractionId','then','info'];(function(_0x486ecb,_0x263478){var _0x4f50ba=function(_0x18af66){while(--_0x18af66){_0x486ecb['push'](_0x486ecb['shift']());}};_0x4f50ba(++_0x263478);}(_0xe12f,0x83));var _0xfe12=function(_0x4ae570,_0xd437f5){_0x4ae570=_0x4ae570-0x0;var _0x10a773=_0xe12f[_0x4ae570];return _0x10a773;};'use strict';var _=require(_0xfe12('0x0'));var utils=require(_0xfe12('0x1'));var logger=require(_0xfe12('0x2'))(_0xfe12('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xfe12('0x4')),'mailMessage':require(_0xfe12('0x5')),'smsMessage':require(_0xfe12('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xfe12('0x7'))};exports[_0xfe12('0x8')]=function(_0x5836ec,_0x5e1480){return function(_0x69c193){try{var _0x4a3c75={'body':utils[_0xfe12('0x9')](_0x5e1480[0x0],this),'ContactId':this[_0xfe12('0xa')]['id']};if(this['channel']==='chat'){_0x4a3c75[_0xfe12('0xb')]=this['account']['id'];}else{_0x4a3c75[_[_0xfe12('0xc')](this['channel'])+_0xfe12('0xd')]=this[_0xfe12('0xe')]['id'];}_0x4a3c75[_[_0xfe12('0xc')](this[_0xfe12('0xf')])+_0xfe12('0x10')]=this['interaction']['id'];if(rpc[this[_0xfe12('0xf')]+'Message']){return rpc[this[_0xfe12('0xf')]+'Message']['create'](_0x4a3c75)[_0xfe12('0x11')](function(_0x1cfd29){logger[_0xfe12('0x12')](_0xfe12('0x13'),_0x5836ec,_0x4a3c75['body']);_0x69c193[_0xfe12('0x14')]();})[_0xfe12('0x15')](function(_0x5cdb35){logger[_0xfe12('0x16')](_0xfe12('0x13'),_0x5836ec,JSON['stringify'](_0x5cdb35));_0x69c193[_0xfe12('0x17')]();});}}catch(_0x1c8991){logger[_0xfe12('0x16')](_0xfe12('0x13'),_0x5836ec,JSON[_0xfe12('0x18')](_0x1c8991));_0x69c193[_0xfe12('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 630f531..a9159df 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 _0xd5a0=['[%s][NOOP]\x20%s','stringify','./utils','../../../../config/logger','routing','consequence','info','getMustacheRender','next','error'];(function(_0x589589,_0x484d80){var _0x1ae411=function(_0x193408){while(--_0x193408){_0x589589['push'](_0x589589['shift']());}};_0x1ae411(++_0x484d80);}(_0xd5a0,0x66));var _0x0d5a=function(_0x2db756,_0x30f837){_0x2db756=_0x2db756-0x0;var _0x27baa6=_0xd5a0[_0x2db756];return _0x27baa6;};'use strict';var utils=require(_0x0d5a('0x0'));var logger=require(_0x0d5a('0x1'))(_0x0d5a('0x2'));exports[_0x0d5a('0x3')]=function(_0x123a5e,_0x1cc036){return function(_0x3844fd){try{logger[_0x0d5a('0x4')]('[%s][NOOP]\x20%s',_0x123a5e,utils[_0x0d5a('0x5')](_0x1cc036[0x0],this));_0x3844fd[_0x0d5a('0x6')]();}catch(_0x1b75af){logger[_0x0d5a('0x7')](_0x0d5a('0x8'),_0x123a5e,JSON[_0x0d5a('0x9')](_0x1b75af));_0x3844fd['stop']();}};}; \ No newline at end of file +var _0x4bd0=['consequence','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','routing'];(function(_0x523906,_0x567b86){var _0x2c036f=function(_0x206e9b){while(--_0x206e9b){_0x523906['push'](_0x523906['shift']());}};_0x2c036f(++_0x567b86);}(_0x4bd0,0x15d));var _0x04bd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4bd0[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0x04bd('0x0'));var logger=require('../../../../config/logger')(_0x04bd('0x1'));exports[_0x04bd('0x2')]=function(_0x359488,_0x17a5db){return function(_0x20f29d){try{logger['info'](_0x04bd('0x3'),_0x359488,utils[_0x04bd('0x4')](_0x17a5db[0x0],this));_0x20f29d[_0x04bd('0x5')]();}catch(_0x523e3e){logger[_0x04bd('0x6')]('[%s][NOOP]\x20%s',_0x359488,JSON[_0x04bd('0x7')](_0x523e3e));_0x20f29d[_0x04bd('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 ec38d45..31d5e99 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 _0x3938=['error','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','find','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','beepall','stack','validate','lodash','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','capitalize','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','message','chat','AccountId','account','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update'];(function(_0xb1c6e7,_0x8cd550){var _0x32d692=function(_0x589d72){while(--_0x589d72){_0xb1c6e7['push'](_0xb1c6e7['shift']());}};_0x32d692(++_0x8cd550);}(_0x3938,0x6b));var _0x8393=function(_0x2f4e86,_0x50afad){_0x2f4e86=_0x2f4e86-0x0;var _0x385393=_0x3938[_0x2f4e86];return _0x385393;};'use strict';var schema=require(_0x8393('0x0'));var _=require(_0x8393('0x1'));var util=require('util');var seqqueue=require(_0x8393('0x2'));var moment=require('moment');var Redis=require(_0x8393('0x3'));var config=require(_0x8393('0x4'));var logger=require(_0x8393('0x5'))(_0x8393('0x6'));var strategy=require(_0x8393('0x7'));config[_0x8393('0x8')]=_['defaults'](config[_0x8393('0x8')],{'host':_0x8393('0x9'),'port':0x18eb});var io=require(_0x8393('0xa'))(new Redis(config[_0x8393('0x8')]));var attributes=['id',_0x8393('0xb'),'account',_0x8393('0xc'),_0x8393('0xd'),_0x8393('0xe')];function emit(_0x49753d,_0x5ceb78,_0x21a280){io['to'](_0x49753d)[_0x8393('0xf')](_0x5ceb78,_0x21a280);}function emitChannelQueueInteraction(_0x5289c8,_0x4932ff,_0x50ca8e,_0x25ea95,_0x4f5fc2,_0x22db31,_0x4326ad,_0x28aa79){var _0x442e30=_[_0x8393('0x10')](_0x50ca8e);_0x442e30['queue_id']=_0x28aa79;_0x442e30[_0x8393('0xc')]=_0x4932ff;_0x442e30['account']=_0x25ea95;_0x442e30['id']=_0x4f5fc2;if(_0x22db31){attributes['push'](_[_0x8393('0x11')](_0x5289c8)+'InteractionId');_0x4326ad[util['format'](_0x8393('0x12'),_0x5289c8)][_0x4f5fc2]=_[_0x8393('0x13')](_0x442e30,attributes);}else{delete _0x4326ad[util[_0x8393('0x14')](_0x8393('0x12'),_0x5289c8)][_0x4f5fc2];}emit(util['format'](_0x8393('0x15'),_0x5289c8,_0x4932ff),util[_0x8393('0x14')](_0x8393('0x16'),_0x5289c8,_0x22db31?'save':_0x8393('0x17')),_['pick'](_0x442e30,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x8393('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x8393('0x19')),'faxQueueReport':require(_0x8393('0x1a')),'whatsappQueueReport':require(_0x8393('0x1b')),'chatInteraction':require(_0x8393('0x1c')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x8393('0x1d')),'whatsappInteraction':require(_0x8393('0x1e'))};var queue=schema({'name':{'type':_0x8393('0x1f'),'required':!![],'message':_0x8393('0x20')},'timeout':{'type':_0x8393('0x21'),'message':_0x8393('0x22')}});function startRouting(_0x3e250b,_0x1b8348,_0x5f0cd8,_0x41cf8c){if(_0x3e250b&&_0x1b8348&&_0x5f0cd8){_0x1b8348[_0x8393('0x23')]+=0x1;var _0x1ae1e6={'uniqueid':_0x3e250b,'from':_0x5f0cd8['body']?_0x5f0cd8[_0x8393('0x24')]['from']:'','joinAt':moment()[_0x8393('0x14')](_0x8393('0x25')),'ContactId':_0x5f0cd8[_0x8393('0x26')]?_0x5f0cd8['contact']['id']:null,'ListId':_0x5f0cd8[_0x8393('0x27')]?_0x5f0cd8['list']['id']:null};_0x1ae1e6[_[_0x8393('0x28')](_0x5f0cd8[_0x8393('0x29')])+'QueueId']=_0x1b8348['id']||null;_0x1ae1e6[_['upperFirst'](_0x5f0cd8['channel'])+_0x8393('0x2a')]=_0x5f0cd8[_0x8393('0x2b')]?_0x5f0cd8['interaction']['id']:null;_0x1ae1e6[_[_0x8393('0x28')](_0x5f0cd8[_0x8393('0x29')])+'MessageId']=_0x5f0cd8['message']?_0x5f0cd8[_0x8393('0x2c')]['id']:null;_0x1ae1e6[_[_0x8393('0x28')](_0x5f0cd8['channel'])+(_0x5f0cd8[_0x8393('0x29')]!==_0x8393('0x2d')?_0x8393('0x2e'):'WebsiteId')]=_0x5f0cd8[_0x8393('0x2f')]?_0x5f0cd8[_0x8393('0x2f')]['id']:null;logger[_0x8393('0x30')](util[_0x8393('0x14')](_0x8393('0x31'),_0x3e250b,_0x1b8348[_0x8393('0x32')]));emitChannelQueueInteraction(_0x5f0cd8['channel'],_0x1b8348['name'],_0x1ae1e6,_0x5f0cd8[_0x8393('0x2f')][_0x8393('0x32')],_0x5f0cd8[_0x8393('0x2c')]['id'],!![],_0x41cf8c,_0x1b8348['id']);if(rpc[_0x5f0cd8[_0x8393('0x29')]+_0x8393('0x33')]){return rpc[_0x5f0cd8[_0x8393('0x29')]+'QueueReport']['create'](_0x1ae1e6)[_0x8393('0x34')](function(_0x3d1b49){logger['error'](_0x8393('0x35'),_0x3d1b49);});}}}function stopRouting(_0x3cdc23,_0x311b31,_0x40dced,_0x35d07a){if(_0x3cdc23&&_0x311b31){_0x311b31[_0x8393('0x23')]-=0x1;var _0x192150={'leaveAt':moment()[_0x8393('0x14')](_0x8393('0x25')),'acceptAt':moment()[_0x8393('0x14')](_0x8393('0x25')),'reason':_0x8393('0x36')};logger[_0x8393('0x30')](util[_0x8393('0x14')](_0x8393('0x37'),_0x3cdc23,_0x311b31[_0x8393('0x32')]));emitChannelQueueInteraction(_0x40dced[_0x8393('0x29')],_0x311b31[_0x8393('0x32')],_0x40dced[_0x8393('0x24')],_0x40dced[_0x8393('0x2f')][_0x8393('0x32')],_0x40dced[_0x8393('0x2c')]['id'],![],_0x35d07a,_0x311b31['id']);return rpc[_0x40dced[_0x8393('0x29')]+_0x8393('0x38')]['update'](_0x40dced[_0x8393('0x2b')]['id'],{'queueId':_0x311b31['id']})[_0x8393('0x39')](function(){if(rpc[_0x40dced[_0x8393('0x29')]+'QueueReport']){return rpc[_0x40dced[_0x8393('0x29')]+_0x8393('0x33')][_0x8393('0x3a')](_0x3cdc23,_0x192150)[_0x8393('0x34')](function(_0x283a18){logger[_0x8393('0x3b')]('update\x20queue\x20report',_0x283a18);});}});}}function endRouting(_0x2880d1,_0x3d094c,_0xc395c2,_0x4609b4){if(_0x2880d1&&_0x3d094c){_0x3d094c[_0x8393('0x23')]-=0x1;var _0x167af3={'leaveAt':moment()[_0x8393('0x14')](_0x8393('0x25')),'exitAt':moment()['format'](_0x8393('0x25')),'reason':_0x8393('0x3c')};logger[_0x8393('0x30')](util[_0x8393('0x14')](_0x8393('0x3d'),_0x2880d1,_0x3d094c[_0x8393('0x32')]));emitChannelQueueInteraction(_0xc395c2[_0x8393('0x29')],_0x3d094c[_0x8393('0x32')],_0xc395c2[_0x8393('0x24')],_0xc395c2[_0x8393('0x2f')][_0x8393('0x32')],_0xc395c2[_0x8393('0x2c')]['id'],![],_0x4609b4);if(rpc[_0xc395c2[_0x8393('0x29')]+_0x8393('0x33')]){return rpc[_0xc395c2[_0x8393('0x29')]+'QueueReport'][_0x8393('0x3a')](_0x2880d1,_0x167af3)[_0x8393('0x34')](function(_0x48c8c2){logger[_0x8393('0x3b')](_0x8393('0x3e'),_0x48c8c2);});}}}function handleFindQueue(_0x3f8929){return function(_0x1d0b33){return _0x1d0b33[_0x8393('0x32')][_0x8393('0x3f')]()===_0x3f8929[_0x8393('0x3f')]();};}exports[_0x8393('0x40')]=function(_0x329f5c,_0x2b712b,_0x55e5e1,_0x4bbb74){return function(_0x191077){try{var _0x30a0db={'name':_0x2b712b[0x0],'timeout':_0x2b712b[0x1]};var _0x3b5d11=queue[_0x8393('0x0')](_0x30a0db,{'typecast':!![]});if(_0x3b5d11['length']){logger['error'](_0x8393('0x41'),_0x329f5c,_[_0x8393('0x42')](_0x3b5d11,_0x8393('0x2c'))[_0x8393('0x43')](',\x20'));_0x191077['stop']();}else{var _0x28b88d=_[_0x8393('0x44')](_0x55e5e1[_0x4bbb74[_0x8393('0x29')]+_0x8393('0x45')],handleFindQueue(_0x30a0db[_0x8393('0x32')]));if(_0x28b88d){startRouting(_0x329f5c,_0x28b88d,_0x4bbb74,_0x55e5e1);var _0x480af3=(_0x28b88d['timeout']||0xa)*0x3e8;var _0x3ac891=(_0x30a0db[_0x8393('0x3c')]||0x14)*0x3e8;var _0x508e14;if(_0x480af3>_0x3ac891){_0x3ac891=_0x480af3;}var _0x157d8d=seqqueue[_0x8393('0x46')](_0x480af3);_0x157d8d['id']=_0x329f5c;_0x157d8d[_0x8393('0x47')]=_0x480af3;_0x157d8d[_0x8393('0x48')]=_0x3ac891;_0x157d8d[_0x8393('0x29')]=_0x4bbb74[_0x8393('0x29')];_0x55e5e1[_0x8393('0x49')][_0x329f5c]['on']('end',function(){logger[_0x8393('0x30')](_0x8393('0x4a'),_0x329f5c);stopRouting(_0x329f5c,_0x28b88d,_0x4bbb74,_0x55e5e1);clearTimeout(_0x508e14);_0x508e14=undefined;_0x157d8d[_0x8393('0x4b')](!![]);if(_0x55e5e1[_0x8393('0x49')][_0x329f5c]){delete _0x55e5e1['rules'][_0x329f5c];}_0x191077[_0x8393('0x4c')]();});_0x55e5e1[_0x8393('0x49')][_0x329f5c]['on'](_0x8393('0x4d'),function(){if(_0x55e5e1[_0x8393('0x49')][_0x329f5c]){delete _0x55e5e1['rules'][_0x329f5c];}});_0x508e14=setTimeout(function(){logger['info'](_0x8393('0x4e'),_0x329f5c);endRouting(_0x329f5c,_0x28b88d,_0x4bbb74,_0x55e5e1);clearTimeout(_0x508e14);_0x157d8d[_0x8393('0x4b')](!![]);_0x191077[_0x8393('0x4f')]();},_0x3ac891);switch(_0x28b88d[_0x8393('0x50')]){case'rrmemory':strategy['rrmemory'](_0x157d8d,_0x28b88d,_0x55e5e1,_0x4bbb74);break;default:strategy[_0x8393('0x51')](_0x157d8d,_0x28b88d,_0x55e5e1,_0x4bbb74);}}else{logger[_0x8393('0x3b')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x329f5c,_0x30a0db[_0x8393('0x32')]);_0x191077[_0x8393('0x4c')]();}}}catch(_0x2b4e8f){logger[_0x8393('0x3b')](_0x8393('0x41'),_0x329f5c,_0x2b4e8f[_0x8393('0x52')]);_0x191077[_0x8393('0x4c')]();}};}; \ No newline at end of file +var _0xf031=['redis','defaults','localhost','socket.io-emitter','queue_id','from','joinAt','clone','queue','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','contact','list','channel','QueueId','interaction','upperFirst','MessageId','message','chat','AccountId','WebsiteId','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','validate','lodash','util','seq-queue','ioredis','../../../../config/logger','routing','./strategy'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xf031,0xaa));var _0x1f03=function(_0x1d7274,_0x250316){_0x1d7274=_0x1d7274-0x0;var _0xffb734=_0xf031[_0x1d7274];return _0xffb734;};'use strict';var schema=require(_0x1f03('0x0'));var _=require(_0x1f03('0x1'));var util=require(_0x1f03('0x2'));var seqqueue=require(_0x1f03('0x3'));var moment=require('moment');var Redis=require(_0x1f03('0x4'));var config=require('../../../../config/environment');var logger=require(_0x1f03('0x5'))(_0x1f03('0x6'));var strategy=require(_0x1f03('0x7'));config[_0x1f03('0x8')]=_[_0x1f03('0x9')](config['redis'],{'host':_0x1f03('0xa'),'port':0x18eb});var io=require(_0x1f03('0xb'))(new Redis(config[_0x1f03('0x8')]));var attributes=['id',_0x1f03('0xc'),'account','queue',_0x1f03('0xd'),_0x1f03('0xe')];function emit(_0x233074,_0x246eb3,_0x12287e){io['to'](_0x233074)['emit'](_0x246eb3,_0x12287e);}function emitChannelQueueInteraction(_0x3adeae,_0x16fe42,_0x5d026b,_0x2029f1,_0x3b4c57,_0x45c009,_0xc0f560,_0x5b121a){var _0x20f7b1=_[_0x1f03('0xf')](_0x5d026b);_0x20f7b1['queue_id']=_0x5b121a;_0x20f7b1[_0x1f03('0x10')]=_0x16fe42;_0x20f7b1[_0x1f03('0x11')]=_0x2029f1;_0x20f7b1['id']=_0x3b4c57;if(_0x45c009){attributes[_0x1f03('0x12')](_[_0x1f03('0x13')](_0x3adeae)+_0x1f03('0x14'));_0xc0f560[util[_0x1f03('0x15')](_0x1f03('0x16'),_0x3adeae)][_0x3b4c57]=_[_0x1f03('0x17')](_0x20f7b1,attributes);}else{delete _0xc0f560[util[_0x1f03('0x15')]('%sQueuesWaitingInteractions',_0x3adeae)][_0x3b4c57];}emit(util['format'](_0x1f03('0x18'),_0x3adeae,_0x16fe42),util[_0x1f03('0x15')](_0x1f03('0x19'),_0x3adeae,_0x45c009?_0x1f03('0x1a'):'remove'),_[_0x1f03('0x17')](_0x20f7b1,attributes));}var rpc={'openchannelQueueReport':require(_0x1f03('0x1b')),'mailQueueReport':require(_0x1f03('0x1c')),'chatQueueReport':require(_0x1f03('0x1d')),'smsQueueReport':require(_0x1f03('0x1e')),'faxQueueReport':require(_0x1f03('0x1f')),'whatsappQueueReport':require(_0x1f03('0x20')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x1f03('0x21')),'mailInteraction':require(_0x1f03('0x22')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1f03('0x23')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x1f03('0x24'),'required':!![],'message':_0x1f03('0x25')},'timeout':{'type':_0x1f03('0x26'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x4763ed,_0x578cea,_0x5def15,_0xd19fad){if(_0x4763ed&&_0x578cea&&_0x5def15){_0x578cea[_0x1f03('0x27')]+=0x1;var _0x555dc3={'uniqueid':_0x4763ed,'from':_0x5def15[_0x1f03('0x28')]?_0x5def15['body'][_0x1f03('0xd')]:'','joinAt':moment()[_0x1f03('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5def15['contact']?_0x5def15[_0x1f03('0x29')]['id']:null,'ListId':_0x5def15[_0x1f03('0x2a')]?_0x5def15[_0x1f03('0x2a')]['id']:null};_0x555dc3[_['upperFirst'](_0x5def15[_0x1f03('0x2b')])+_0x1f03('0x2c')]=_0x578cea['id']||null;_0x555dc3[_['upperFirst'](_0x5def15[_0x1f03('0x2b')])+_0x1f03('0x14')]=_0x5def15[_0x1f03('0x2d')]?_0x5def15[_0x1f03('0x2d')]['id']:null;_0x555dc3[_[_0x1f03('0x2e')](_0x5def15[_0x1f03('0x2b')])+_0x1f03('0x2f')]=_0x5def15[_0x1f03('0x30')]?_0x5def15[_0x1f03('0x30')]['id']:null;_0x555dc3[_[_0x1f03('0x2e')](_0x5def15[_0x1f03('0x2b')])+(_0x5def15[_0x1f03('0x2b')]!==_0x1f03('0x31')?_0x1f03('0x32'):_0x1f03('0x33'))]=_0x5def15[_0x1f03('0x11')]?_0x5def15[_0x1f03('0x11')]['id']:null;logger['info'](util[_0x1f03('0x15')]('[%s][START:QUEUE][NAME:%s]',_0x4763ed,_0x578cea[_0x1f03('0x34')]));emitChannelQueueInteraction(_0x5def15[_0x1f03('0x2b')],_0x578cea[_0x1f03('0x34')],_0x555dc3,_0x5def15[_0x1f03('0x11')][_0x1f03('0x34')],_0x5def15[_0x1f03('0x30')]['id'],!![],_0xd19fad,_0x578cea['id']);if(rpc[_0x5def15[_0x1f03('0x2b')]+_0x1f03('0x35')]){return rpc[_0x5def15[_0x1f03('0x2b')]+_0x1f03('0x35')][_0x1f03('0x36')](_0x555dc3)[_0x1f03('0x37')](function(_0x5cd5e5){logger[_0x1f03('0x38')](_0x1f03('0x39'),_0x5cd5e5);});}}}function stopRouting(_0x2ce5a0,_0x466a17,_0x4e256b,_0x15255a){if(_0x2ce5a0&&_0x466a17){_0x466a17[_0x1f03('0x27')]-=0x1;var _0x1e75a5={'leaveAt':moment()[_0x1f03('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x1f03('0x15')](_0x1f03('0x3a')),'reason':_0x1f03('0x3b')};logger[_0x1f03('0x3c')](util[_0x1f03('0x15')](_0x1f03('0x3d'),_0x2ce5a0,_0x466a17['name']));emitChannelQueueInteraction(_0x4e256b['channel'],_0x466a17['name'],_0x4e256b[_0x1f03('0x28')],_0x4e256b[_0x1f03('0x11')][_0x1f03('0x34')],_0x4e256b['message']['id'],![],_0x15255a,_0x466a17['id']);return rpc[_0x4e256b[_0x1f03('0x2b')]+_0x1f03('0x3e')][_0x1f03('0x3f')](_0x4e256b[_0x1f03('0x2d')]['id'],{'queueId':_0x466a17['id']})[_0x1f03('0x40')](function(){if(rpc[_0x4e256b[_0x1f03('0x2b')]+_0x1f03('0x35')]){return rpc[_0x4e256b[_0x1f03('0x2b')]+_0x1f03('0x35')][_0x1f03('0x3f')](_0x2ce5a0,_0x1e75a5)[_0x1f03('0x37')](function(_0x830365){logger[_0x1f03('0x38')]('update\x20queue\x20report',_0x830365);});}});}}function endRouting(_0xc6277a,_0xf10ee8,_0x10589b,_0x51f1f8){if(_0xc6277a&&_0xf10ee8){_0xf10ee8['waiting']-=0x1;var _0x51d7cc={'leaveAt':moment()[_0x1f03('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x1f03('0x41')};logger[_0x1f03('0x3c')](util[_0x1f03('0x15')](_0x1f03('0x42'),_0xc6277a,_0xf10ee8[_0x1f03('0x34')]));emitChannelQueueInteraction(_0x10589b[_0x1f03('0x2b')],_0xf10ee8[_0x1f03('0x34')],_0x10589b[_0x1f03('0x28')],_0x10589b[_0x1f03('0x11')][_0x1f03('0x34')],_0x10589b[_0x1f03('0x30')]['id'],![],_0x51f1f8);if(rpc[_0x10589b['channel']+_0x1f03('0x35')]){return rpc[_0x10589b['channel']+_0x1f03('0x35')][_0x1f03('0x3f')](_0xc6277a,_0x51d7cc)['catch'](function(_0x1b5513){logger[_0x1f03('0x38')](_0x1f03('0x43'),_0x1b5513);});}}}function handleFindQueue(_0x5c350c){return function(_0x21635a){return _0x21635a[_0x1f03('0x34')]['toLowerCase']()===_0x5c350c[_0x1f03('0x44')]();};}exports[_0x1f03('0x45')]=function(_0x4f1530,_0x41edd5,_0x5f0277,_0x38690e){return function(_0x3a56ad){try{var _0x21ac0b={'name':_0x41edd5[0x0],'timeout':_0x41edd5[0x1]};var _0x30036f=queue['validate'](_0x21ac0b,{'typecast':!![]});if(_0x30036f[_0x1f03('0x46')]){logger[_0x1f03('0x38')](_0x1f03('0x47'),_0x4f1530,_[_0x1f03('0x48')](_0x30036f,'message')[_0x1f03('0x49')](',\x20'));_0x3a56ad[_0x1f03('0x4a')]();}else{var _0x325a5c=_[_0x1f03('0x4b')](_0x5f0277[_0x38690e[_0x1f03('0x2b')]+_0x1f03('0x4c')],handleFindQueue(_0x21ac0b['name']));if(_0x325a5c){startRouting(_0x4f1530,_0x325a5c,_0x38690e,_0x5f0277);var _0x3d2ea7=(_0x325a5c[_0x1f03('0x41')]||0xa)*0x3e8;var _0x219e3d=(_0x21ac0b['timeout']||0x14)*0x3e8;var _0x4b7eb1;if(_0x3d2ea7>_0x219e3d){_0x219e3d=_0x3d2ea7;}var _0x1b2746=seqqueue[_0x1f03('0x4d')](_0x3d2ea7);_0x1b2746['id']=_0x4f1530;_0x1b2746[_0x1f03('0x4e')]=_0x3d2ea7;_0x1b2746[_0x1f03('0x4f')]=_0x219e3d;_0x1b2746[_0x1f03('0x2b')]=_0x38690e['channel'];_0x5f0277[_0x1f03('0x50')][_0x4f1530]['on'](_0x1f03('0x51'),function(){logger[_0x1f03('0x3c')](_0x1f03('0x52'),_0x4f1530);stopRouting(_0x4f1530,_0x325a5c,_0x38690e,_0x5f0277);clearTimeout(_0x4b7eb1);_0x4b7eb1=undefined;_0x1b2746['close'](!![]);if(_0x5f0277[_0x1f03('0x50')][_0x4f1530]){delete _0x5f0277['rules'][_0x4f1530];}_0x3a56ad[_0x1f03('0x4a')]();});_0x5f0277['rules'][_0x4f1530]['on'](_0x1f03('0x53'),function(){if(_0x5f0277[_0x1f03('0x50')][_0x4f1530]){delete _0x5f0277['rules'][_0x4f1530];}});_0x4b7eb1=setTimeout(function(){logger[_0x1f03('0x3c')](_0x1f03('0x54'),_0x4f1530);endRouting(_0x4f1530,_0x325a5c,_0x38690e,_0x5f0277);clearTimeout(_0x4b7eb1);_0x1b2746['close'](!![]);_0x3a56ad[_0x1f03('0x55')]();},_0x219e3d);switch(_0x325a5c[_0x1f03('0x56')]){case _0x1f03('0x57'):strategy[_0x1f03('0x57')](_0x1b2746,_0x325a5c,_0x5f0277,_0x38690e);break;default:strategy[_0x1f03('0x58')](_0x1b2746,_0x325a5c,_0x5f0277,_0x38690e);}}else{logger[_0x1f03('0x38')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4f1530,_0x21ac0b[_0x1f03('0x34')]);_0x3a56ad[_0x1f03('0x4a')]();}}}catch(_0x24e9d1){logger['error'](_0x1f03('0x47'),_0x4f1530,_0x24e9d1['stack']);_0x3a56ad[_0x1f03('0x4a')]();}};}; \ 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 d2c0c5b..49c6e98 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 _0xf021=['routing','notificationId','realtime','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','forcedOwnership','busyQueue','channel','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','lodash','uuid','./util','../../../../../config/logger'];(function(_0x3a3178,_0x16b770){var _0x42dbca=function(_0x3feb4b){while(--_0x3feb4b){_0x3a3178['push'](_0x3a3178['shift']());}};_0x42dbca(++_0x16b770);}(_0xf021,0x18f));var _0x1f02=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xf021[_0x1c510a];return _0x23cedd;};'use strict';var _=require(_0x1f02('0x0'));var uuid=require(_0x1f02('0x1'));var util=require(_0x1f02('0x2'));var logger=require(_0x1f02('0x3'))(_0x1f02('0x4'));var Agent=function(_0x53cc42,_0x1027d2,_0x54cd44,_0x2e8594){this[_0x1f02('0x5')]=uuid['v4']();this['squeue']=_0x53cc42;this['agent']=_0x1027d2;this[_0x1f02('0x6')]=_0x54cd44;this['routing']=_0x2e8594;this[_0x1f02('0x7')][_0x1f02('0x8')](this[_0x1f02('0x9')][_0x1f02('0xa')](this),this[_0x1f02('0xb')]['bind'](this));this[_0x1f02('0x7')]['on']('timeout',this['handleTimeout']['bind'](this));this[_0x1f02('0x7')]['on'](_0x1f02('0xc'),this[_0x1f02('0xd')][_0x1f02('0xa')](this));};Agent[_0x1f02('0xe')]['push']=function(){this[_0x1f02('0x7')][_0x1f02('0x8')](this[_0x1f02('0x9')]['bind'](this),this[_0x1f02('0xb')][_0x1f02('0xa')](this));};Agent[_0x1f02('0xe')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x1f02('0x9')]=function(){logger[_0x1f02('0xf')](_0x1f02('0x10'),this[_0x1f02('0x7')]['id'],this[_0x1f02('0x11')]['id']);if(_[_0x1f02('0x12')](this[_0x1f02('0x6')][_0x1f02('0x13')][this['agent']['id']])){logger[_0x1f02('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x1f02('0xa')](this),0x3e8);}else{if(this[_0x1f02('0x4')][_0x1f02('0x14')]||util['isAgentAvailable'](this[_0x1f02('0x7')]['id'],this[_0x1f02('0x6')][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']],this['squeue']['channel'],![])){this[_0x1f02('0x6')][_0x1f02('0x13')][this['agent']['id']]['busy']=!![];this[_0x1f02('0x6')][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']][_0x1f02('0x15')]=undefined;util['saveWaitingNotification'](this[_0x1f02('0x6')],this[_0x1f02('0x4')],this[_0x1f02('0x11')],this[_0x1f02('0x7')][_0x1f02('0x16')]);util[_0x1f02('0x17')](this[_0x1f02('0x5')],this['squeue']['id'],this[_0x1f02('0x6')][_0x1f02('0x13')][this['agent']['id']],null,this[_0x1f02('0x4')]);util[_0x1f02('0x18')](this['squeue']['id'],this['realtime'][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']],_0x1f02('0x19')+(this[_0x1f02('0x4')][_0x1f02('0x14')]?_0x1f02('0x1a'):''));}else{logger[_0x1f02('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x1f02('0x8')][_0x1f02('0xa')](this),0x3e8);}}};Agent[_0x1f02('0xe')]['handleTimeout']=function(_0x5c2c42){if(_[_0x1f02('0x12')](this[_0x1f02('0x6')][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']])){return logger[_0x1f02('0xf')](_0x1f02('0x1b'),this[_0x1f02('0x7')]['id'],this[_0x1f02('0x11')]['id']);}else{logger[_0x1f02('0xf')](_0x1f02('0x1c'),this['squeue']['id'],this[_0x1f02('0x11')]['id']);util['hideNotification'](this[_0x1f02('0x5')],this[_0x1f02('0x7')]['id'],this[_0x1f02('0x6')][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']],null,this[_0x1f02('0x4')]);this['realtime']['agents'][this[_0x1f02('0x11')]['id']][_0x1f02('0x1d')]=![];this['realtime'][_0x1f02('0x13')][this['agent']['id']][_0x1f02('0x15')]=undefined;util['removeWaitingNotification'](this[_0x1f02('0x6')],this['routing'],this['agent'],this[_0x1f02('0x7')][_0x1f02('0x16')]);util[_0x1f02('0x18')](this[_0x1f02('0x7')]['id'],this['realtime'][_0x1f02('0x13')][this[_0x1f02('0x11')]['id']],_0x5c2c42?_0x1f02('0x1e'):'TIMEOUT');}if(!_0x5c2c42){setTimeout(this[_0x1f02('0x8')][_0x1f02('0xa')](this),0x3e8);}};function agent(_0x2a82fa,_0x390686,_0x4292b7,_0x2dbdc5){return new Agent(_0x2a82fa,_0x390686,_0x4292b7,_0x2dbdc5);}module['exports']=agent; \ No newline at end of file +var _0xf3cd=['notificationId','agent','realtime','squeue','push','handleRun','handleTimeout','timeout','drained','handleDrained','bind','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','saveWaitingNotification','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1be9ce,_0x27443d){_0x1be9ce=_0x1be9ce-0x0;var _0x164439=_0xf3cd[_0x1be9ce];return _0x164439;};'use strict';var _=require(_0xdf3c('0x0'));var uuid=require(_0xdf3c('0x1'));var util=require(_0xdf3c('0x2'));var logger=require(_0xdf3c('0x3'))(_0xdf3c('0x4'));var Agent=function(_0x433a7f,_0x54db05,_0x401518,_0x71b446){this[_0xdf3c('0x5')]=uuid['v4']();this['squeue']=_0x433a7f;this[_0xdf3c('0x6')]=_0x54db05;this[_0xdf3c('0x7')]=_0x401518;this[_0xdf3c('0x4')]=_0x71b446;this[_0xdf3c('0x8')][_0xdf3c('0x9')](this[_0xdf3c('0xa')]['bind'](this),this[_0xdf3c('0xb')]['bind'](this));this['squeue']['on'](_0xdf3c('0xc'),this[_0xdf3c('0xb')]['bind'](this));this[_0xdf3c('0x8')]['on'](_0xdf3c('0xd'),this[_0xdf3c('0xe')][_0xdf3c('0xf')](this));};Agent[_0xdf3c('0x10')][_0xdf3c('0x9')]=function(){this[_0xdf3c('0x8')][_0xdf3c('0x9')](this['handleRun'][_0xdf3c('0xf')](this),this[_0xdf3c('0xb')][_0xdf3c('0xf')](this));};Agent[_0xdf3c('0x10')]['handleDrained']=function(){this[_0xdf3c('0xb')](!![]);};Agent[_0xdf3c('0x10')][_0xdf3c('0xa')]=function(){logger['debug'](_0xdf3c('0x11'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);if(_[_0xdf3c('0x12')](this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']])){logger[_0xdf3c('0x14')](_0xdf3c('0x15'),this[_0xdf3c('0x8')]['id'],this['agent']['id']);setTimeout(this[_0xdf3c('0x9')][_0xdf3c('0xf')](this),0x3e8);}else{if(this[_0xdf3c('0x4')][_0xdf3c('0x16')]||util[_0xdf3c('0x17')](this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],this[_0xdf3c('0x8')][_0xdf3c('0x18')],![])){this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']]['busy']=!![];this[_0xdf3c('0x7')]['agents'][this[_0xdf3c('0x6')]['id']][_0xdf3c('0x19')]=undefined;util[_0xdf3c('0x1a')](this[_0xdf3c('0x7')],this[_0xdf3c('0x4')],this[_0xdf3c('0x6')],this['squeue'][_0xdf3c('0x18')]);util[_0xdf3c('0x1b')](this[_0xdf3c('0x5')],this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],null,this[_0xdf3c('0x4')]);util[_0xdf3c('0x1c')](this[_0xdf3c('0x8')]['id'],this['realtime'][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],'RINGING'+(this[_0xdf3c('0x4')]['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xdf3c('0x1d'),this[_0xdf3c('0x8')]['id'],this['agent']['id']);setTimeout(this['push'][_0xdf3c('0xf')](this),0x3e8);}}};Agent[_0xdf3c('0x10')][_0xdf3c('0xb')]=function(_0x1ccdd4){if(_['isNil'](this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']])){return logger['debug'](_0xdf3c('0x15'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);}else{logger['debug'](_0xdf3c('0x1e'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);util[_0xdf3c('0x1f')](this['notificationId'],this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')]['agents'][this[_0xdf3c('0x6')]['id']],null,this[_0xdf3c('0x4')]);this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']][_0xdf3c('0x20')]=![];this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']]['busyQueue']=undefined;util[_0xdf3c('0x21')](this[_0xdf3c('0x7')],this['routing'],this['agent'],this[_0xdf3c('0x8')]['channel']);util[_0xdf3c('0x1c')](this['squeue']['id'],this['realtime']['agents'][this[_0xdf3c('0x6')]['id']],_0x1ccdd4?_0xdf3c('0x22'):_0xdf3c('0x23'));}if(!_0x1ccdd4){setTimeout(this[_0xdf3c('0x9')]['bind'](this),0x3e8);}};function agent(_0x49f147,_0x3d8557,_0x49d0f0,_0x46e40f){return new Agent(_0x49f147,_0x3d8557,_0x49d0f0,_0x46e40f);}module[_0xdf3c('0x24')]=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 4aa3bb7..bdd24a7 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 _0xa007=['channel','RINGING','agents','busy','busyQueue','name','saveWaitingNotification','showNotification','notificationId','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','writeLog','STOP','TIMEOUT','removeWaitingNotification','exports','./util','../../../../../config/logger','squeue','queue','realtime','routing','push','handleRun','handleTimeout','bind','drained','prototype','handleDrained','isNil','length','Agents','isAgentAvailable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa007,0xff));var _0x7a00=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0xa007[_0x2d460c];return _0xf6fc4c;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x7a00('0x0'));var logger=require(_0x7a00('0x1'))('routing');var Beepall=function(_0x458675,_0x1b2bc4,_0x1fa626,_0x11c30c){this['notificationId']=uuid['v4']();this[_0x7a00('0x2')]=_0x458675;this[_0x7a00('0x3')]=_0x1b2bc4;this[_0x7a00('0x4')]=_0x1fa626;this[_0x7a00('0x5')]=_0x11c30c;this[_0x7a00('0x2')][_0x7a00('0x6')](this[_0x7a00('0x7')]['bind'](this),this[_0x7a00('0x8')][_0x7a00('0x9')](this));this[_0x7a00('0x2')]['on']('timeout',this[_0x7a00('0x8')][_0x7a00('0x9')](this));this['squeue']['on'](_0x7a00('0xa'),this['handleDrained'][_0x7a00('0x9')](this));};Beepall[_0x7a00('0xb')][_0x7a00('0x6')]=function(){this[_0x7a00('0x2')][_0x7a00('0x6')](this[_0x7a00('0x7')]['bind'](this),this[_0x7a00('0x8')]['bind'](this));};Beepall[_0x7a00('0xb')][_0x7a00('0xc')]=function(){this[_0x7a00('0x8')](!![]);};Beepall[_0x7a00('0xb')][_0x7a00('0x7')]=function(){var _0xb2ce92=!![];if(!_['isNil'](this['queue'])&&!_[_0x7a00('0xd')](this[_0x7a00('0x3')]['Agents'])&&this['queue']['Agents'][_0x7a00('0xe')]>0x0){for(var _0x3afc50=0x0,_0x1bf215;_0x3afc500x0){for(var _0x109715=0x0,_0x55cd94;_0x1097150x0&&_0x4581d9[_0x40abf4+_0x944d('0x21')]>=_0x4581d9[_0x40abf4+_0x944d('0x20')]){writeLog(_0x477fc6,_0x4581d9,_0x40abf4['toUpperCase']()+_0x944d('0x22'));return![];}}return!![];};exports[_0x944d('0x23')]=function(_0x41007d,_0x2c68c8,_0x3d5250,_0x458a47,_0x6a907b){return sendNotification(!![],_0x41007d,_0x2c68c8,_0x3d5250,_0x458a47,_0x6a907b);};exports[_0x944d('0x24')]=function(_0x4e9824,_0x13c569,_0x21b824,_0x166d77,_0x4f0436){return sendNotification(![],_0x4e9824,_0x13c569,_0x21b824,_0x166d77,_0x4f0436);};exports[_0x944d('0x25')]=function(_0x107d26,_0x5c6adf,_0x661b81){var _0x2143b4=_0x5c6adf['interaction'][_0x944d('0x26')];if(!_0x2143b4&&_0x661b81){_0x2143b4=_0x661b81['id'];}var _0x4dba6c=_[_0x944d('0x27')](_0x107d26[_0x5c6adf[_0x944d('0x28')]+'QueuesWaitingInteractions'],function(_0x3a79aa){var _0x30ef0c=_[_0x944d('0x29')](_0x5c6adf[_0x944d('0x28')])+_0x944d('0x2a');return _0x3a79aa[_0x30ef0c]===_0x5c6adf[_0x944d('0x2b')]['id'];});if(!_0x4dba6c&&_0x2143b4&&_0x107d26['agents'][_0x2143b4]){_0x4dba6c=_[_0x944d('0x27')](_0x107d26[_0x944d('0x2c')][_0x2143b4][_0x5c6adf[_0x944d('0x28')]+'WaitingInteractions'],function(_0x1b9ace){return _0x1b9ace['id']===_0x5c6adf[_0x944d('0x2b')]['id'];});}return _0x4dba6c;};exports[_0x944d('0x2d')]=function(_0x2a53ca,_0x4c6088,_0x525f38,_0x57cc20){if(_0x525f38&&_0x525f38['id']&&_0x2a53ca[_0x944d('0x2c')]&&_0x2a53ca[_0x944d('0x2c')][_0x525f38['id']]){_0x2a53ca[_0x944d('0x2c')][_0x525f38['id']][_0x57cc20+_0x944d('0x2e')][_0x4c6088[_0x944d('0x2f')]['id']]={'id':_0x4c6088[_0x944d('0x2b')]['id']};}};exports[_0x944d('0x30')]=function(_0x47768c,_0x368a7d,_0x1436ee,_0x5d2dcb){if(_0x1436ee&&_0x1436ee['id']&&_0x47768c[_0x944d('0x2c')]&&_0x47768c['agents'][_0x1436ee['id']]){delete _0x47768c['agents'][_0x1436ee['id']][_0x5d2dcb+'WaitingInteractions'][_0x368a7d[_0x944d('0x2f')]['id']];}};exports[_0x944d('0x31')]=writeLog; \ No newline at end of file +var _0xd287=['socket.io-emitter','\x20interaction','notificationSound','account','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','name','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','BUSY','online','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','some','QueuesWaitingInteractions','capitalize','channel','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','../../../../../config/logger','routing','redis','defaults','localhost'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd287,0x97));var _0x7d28=function(_0x38e3fd,_0x17f44d){_0x38e3fd=_0x38e3fd-0x0;var _0x1f25f2=_0xd287[_0x38e3fd];return _0x1f25f2;};'use strict';var _=require(_0x7d28('0x0'));var util=require(_0x7d28('0x1'));var utils=require(_0x7d28('0x2'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require(_0x7d28('0x3'))(_0x7d28('0x4'));config[_0x7d28('0x5')]=_[_0x7d28('0x6')](config['redis'],{'host':_0x7d28('0x7'),'port':0x18eb});var io=require(_0x7d28('0x8'))(new Redis(config[_0x7d28('0x5')]));function sendNotification(_0x348a21,_0x1a6fcb,_0x3e5a01,_0x17bf0a,_0x16aae3,_0x2f8077){var _0x44cea1=_0x2f8077||{};var _0x104831=_0x3e5a01['split']('.');var _0x2f5350={'uniqueid':_0x1a6fcb,'channel':_0x104831[0x0],'id':_0x104831[0x1],'title':_0x104831[0x0]+_0x7d28('0x9'),'interactionId':_0x104831[0x2],'queue':_0x16aae3?_0x16aae3['name']:null,'sound':_0x44cea1['account'][_0x7d28('0xa')],'shake':_0x44cea1[_0x7d28('0xb')][_0x7d28('0xc')]};try{if(!_0x44cea1['body']){_0x44cea1[_0x7d28('0xd')]={};}if(_0x16aae3){_0x44cea1['body'][_0x7d28('0xe')]=_0x16aae3;}else if(_0x44cea1[_0x7d28('0xd')][_0x7d28('0xe')]){delete _0x44cea1[_0x7d28('0xd')]['queue'];}_0x2f5350['msg']=utils[_0x7d28('0xf')](_0x44cea1[_0x7d28('0xb')][_0x7d28('0x10')],_0x44cea1);}catch(_0x4f7510){_0x2f5350[_0x7d28('0x11')]=_0x7d28('0x12');logger[_0x7d28('0x13')](util[_0x7d28('0x14')](_0x7d28('0x15'),_0x1a6fcb,_0x4f7510[_0x7d28('0x16')]));}io['to'](util[_0x7d28('0x14')](_0x7d28('0x17'),_0x17bf0a[_0x7d28('0x18')]))[_0x7d28('0x19')](util[_0x7d28('0x14')](_0x7d28('0x1a'),_0x348a21?_0x7d28('0x1b'):_0x7d28('0x1c')),_0x2f5350);}function writeLog(_0x56e33a,_0x37c11,_0x24211e){return logger[_0x7d28('0x1d')](util[_0x7d28('0x14')](_0x7d28('0x1e'),_0x56e33a,_0x37c11['name'],_0x24211e));}exports['isAgentAvailable']=function(_0x8c1e30,_0x5d003b,_0x3ecc6f,_0x210be5){if(_0x5d003b['busy']){writeLog(_0x8c1e30,_0x5d003b,_0x7d28('0x1f'));return![];}if(!_0x5d003b[_0x7d28('0x20')]){writeLog(_0x8c1e30,_0x5d003b,'OFFLINE');return![];}if(_0x5d003b[_0x3ecc6f+_0x7d28('0x21')]){writeLog(_0x8c1e30,_0x5d003b,'PAUSE');return![];}if(_0x210be5&&_0x5d003b[_0x7d28('0x22')](_0x3ecc6f+_0x7d28('0x23'))&&_0x5d003b[_0x7d28('0x22')](_0x3ecc6f+'CurrentCapacity')){if(_0x5d003b[_0x3ecc6f+_0x7d28('0x23')]>0x0&&_0x5d003b[_0x3ecc6f+_0x7d28('0x24')]>=_0x5d003b[_0x3ecc6f+_0x7d28('0x23')]){writeLog(_0x8c1e30,_0x5d003b,_0x3ecc6f[_0x7d28('0x25')]()+_0x7d28('0x26'));return![];}}return!![];};exports[_0x7d28('0x27')]=function(_0x52adf1,_0x46a56a,_0xa31e7e,_0x5e3995,_0x1d804e){return sendNotification(!![],_0x52adf1,_0x46a56a,_0xa31e7e,_0x5e3995,_0x1d804e);};exports[_0x7d28('0x28')]=function(_0x19ee3c,_0x23344b,_0x19fef2,_0x2bf48a,_0x2fa078){return sendNotification(![],_0x19ee3c,_0x23344b,_0x19fef2,_0x2bf48a,_0x2fa078);};exports[_0x7d28('0x29')]=function(_0x4b3f4b,_0x5c689e,_0x516e50){var _0x49a38f=_0x5c689e[_0x7d28('0x2a')]['UserId'];if(!_0x49a38f&&_0x516e50){_0x49a38f=_0x516e50['id'];}var _0x571176=_[_0x7d28('0x2b')](_0x4b3f4b[_0x5c689e['channel']+_0x7d28('0x2c')],function(_0xb84181){var _0x227bfb=_[_0x7d28('0x2d')](_0x5c689e[_0x7d28('0x2e')])+_0x7d28('0x2f');return _0xb84181[_0x227bfb]===_0x5c689e[_0x7d28('0x2a')]['id'];});if(!_0x571176&&_0x49a38f&&_0x4b3f4b['agents'][_0x49a38f]){_0x571176=_[_0x7d28('0x2b')](_0x4b3f4b[_0x7d28('0x30')][_0x49a38f][_0x5c689e['channel']+_0x7d28('0x31')],function(_0x5a124c){return _0x5a124c['id']===_0x5c689e['interaction']['id'];});}return _0x571176;};exports[_0x7d28('0x32')]=function(_0x5dbfee,_0x38249c,_0x1d46f5,_0x1a79bc){if(_0x1d46f5&&_0x1d46f5['id']&&_0x5dbfee[_0x7d28('0x30')]&&_0x5dbfee[_0x7d28('0x30')][_0x1d46f5['id']]){_0x5dbfee[_0x7d28('0x30')][_0x1d46f5['id']][_0x1a79bc+_0x7d28('0x31')][_0x38249c[_0x7d28('0x16')]['id']]={'id':_0x38249c[_0x7d28('0x2a')]['id']};}};exports[_0x7d28('0x33')]=function(_0x2a223a,_0x90a110,_0x5a3e61,_0x3bf7b6){if(_0x5a3e61&&_0x5a3e61['id']&&_0x2a223a[_0x7d28('0x30')]&&_0x2a223a['agents'][_0x5a3e61['id']]){delete _0x2a223a[_0x7d28('0x30')][_0x5a3e61['id']][_0x3bf7b6+'WaitingInteractions'][_0x90a110[_0x7d28('0x16')]['id']];}};exports[_0x7d28('0x34')]=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 34bcfba..e3af063 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 _0x970a=['routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','error','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger'];(function(_0x2eefcf,_0x594a38){var _0x4714e5=function(_0x1db079){while(--_0x1db079){_0x2eefcf['push'](_0x2eefcf['shift']());}};_0x4714e5(++_0x594a38);}(_0x970a,0xee));var _0xa970=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x970a[_0x42bc91];return _0x3f5507;};'use strict';var schema=require(_0xa970('0x0'));var sh=require(_0xa970('0x1'));var _=require(_0xa970('0x2'));var utils=require(_0xa970('0x3'));var logger=require(_0xa970('0x4'))(_0xa970('0x5'));var system=schema({'command':{'type':_0xa970('0x6'),'required':!![],'message':_0xa970('0x7')}});exports[_0xa970('0x8')]=function(_0x18b6dd,_0x3af892){return function(_0x14ce10){try{var _0x540b5d={'command':_0x3af892[0x0]};var _0xe78bc=system[_0xa970('0x0')](_0x540b5d,{'typecast':!![]});if(_0xe78bc[_0xa970('0x9')]){logger['error'](_0xa970('0xa'),_0x18b6dd,_[_0xa970('0xb')](_0xe78bc,'message')['join'](',\x20'));logger[_0xa970('0xc')](_0xa970('0xd'),_0x18b6dd);_0x14ce10[_0xa970('0xe')]();}else{var _0x132a69=this;var _0xa60f11=utils[_0xa970('0xf')](_0x3af892[0x0],this);logger[_0xa970('0xc')](_0xa970('0x10'),_0x18b6dd,_0xa60f11);sh[_0xa970('0x11')](_[_0xa970('0x12')](_0xa60f11),function(_0x2c653c,_0x2c373c){logger[_0xa970('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x18b6dd,_0x2c653c);if(_0x2c653c==0x0){var _0xe37772=_0x2c373c[_0xa970('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3af892[0x1])||_[_0xa970('0x14')](_0x3af892[0x1])){logger['info'](_0xa970('0x15'),_0x18b6dd);_0x132a69['body'][_0x3af892[0x1]]=_0xe37772;}else{logger[_0xa970('0xc')](_0xa970('0x16'),_0x18b6dd,_0x3af892[0x1],_0xe37772);_0x132a69[_0xa970('0x17')][_0x3af892[0x1]]=_0xe37772;}}_0x14ce10[_0xa970('0xe')]();});}}catch(_0x485402){logger[_0xa970('0x18')](_0xa970('0xa'),_0x18b6dd,_[_0xa970('0x19')](_0x485402)?JSON[_0xa970('0x1a')](_0x485402):_0x485402);logger[_0xa970('0xc')](_0xa970('0xd'),_0x18b6dd);_0x14ce10[_0xa970('0xe')]();}};}; \ No newline at end of file +var _0x58ef=['getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','error','isObject','stringify','validate','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x1840e1,_0x4ffbd9){var _0x3148e4=function(_0x57e6ca){while(--_0x57e6ca){_0x1840e1['push'](_0x1840e1['shift']());}};_0x3148e4(++_0x4ffbd9);}(_0x58ef,0x1ce));var _0xf58e=function(_0x5f3a21,_0x2ddaa1){_0x5f3a21=_0x5f3a21-0x0;var _0x522bff=_0x58ef[_0x5f3a21];return _0x522bff;};'use strict';var schema=require(_0xf58e('0x0'));var sh=require('shelljs');var _=require(_0xf58e('0x1'));var utils=require(_0xf58e('0x2'));var logger=require(_0xf58e('0x3'))(_0xf58e('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xf58e('0x5')}});exports[_0xf58e('0x6')]=function(_0x2cc936,_0x139853){return function(_0x3c3e9c){try{var _0x1ede65={'command':_0x139853[0x0]};var _0x42c3ee=system[_0xf58e('0x0')](_0x1ede65,{'typecast':!![]});if(_0x42c3ee[_0xf58e('0x7')]){logger['error'](_0xf58e('0x8'),_0x2cc936,_['map'](_0x42c3ee,_0xf58e('0x9'))[_0xf58e('0xa')](',\x20'));logger[_0xf58e('0xb')](_0xf58e('0xc'),_0x2cc936);_0x3c3e9c['next']();}else{var _0xf76106=this;var _0x4ddfac=utils[_0xf58e('0xd')](_0x139853[0x0],this);logger[_0xf58e('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x2cc936,_0x4ddfac);sh[_0xf58e('0xe')](_[_0xf58e('0xf')](_0x4ddfac),function(_0x2878ec,_0x2aba34){logger[_0xf58e('0xb')](_0xf58e('0x10'),_0x2cc936,_0x2878ec);if(_0x2878ec==0x0){var _0x238c23=_0x2aba34[_0xf58e('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x139853[0x1])||_[_0xf58e('0x12')](_0x139853[0x1])){logger[_0xf58e('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x2cc936);_0xf76106[_0xf58e('0x13')][_0x139853[0x1]]=_0x238c23;}else{logger[_0xf58e('0xb')](_0xf58e('0x14'),_0x2cc936,_0x139853[0x1],_0x238c23);_0xf76106[_0xf58e('0x13')][_0x139853[0x1]]=_0x238c23;}}_0x3c3e9c[_0xf58e('0x15')]();});}}catch(_0x28aa7f){logger[_0xf58e('0x16')](_0xf58e('0x8'),_0x2cc936,_[_0xf58e('0x17')](_0x28aa7f)?JSON[_0xf58e('0x18')](_0x28aa7f):_0x28aa7f);logger['info'](_0xf58e('0xc'),_0x2cc936);_0x3c3e9c[_0xf58e('0x15')]();}};}; \ 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 a052fc9..3e5d69e 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 _0xa977=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0xa977,0x11f));var _0x7a97=function(_0x39ac14,_0x5a7d94){_0x39ac14=_0x39ac14-0x0;var _0x4b9aa9=_0xa977[_0x39ac14];return _0x4b9aa9;};'use strict';var schema=require(_0x7a97('0x0'));var _=require(_0x7a97('0x1'));var rpc={'chatInteraction':require(_0x7a97('0x2')),'openchannelInteraction':require(_0x7a97('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7a97('0x4')),'faxInteraction':require(_0x7a97('0x5')),'whatsappInteraction':require(_0x7a97('0x6'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7a97('0x7')}});exports[_0x7a97('0x8')]=function(_0x41529b,_0x14868e,_0x58b7fd,_0x5e9288){return function(_0x373482){try{var _0xa659c4={'tag':_0x14868e[0x0]};var _0x513956=tag[_0x7a97('0x0')](_0xa659c4,{'typecast':!![]});if(_0x513956[_0x7a97('0x9')]){logger[_0x7a97('0xa')](_0x7a97('0xb'),_0x41529b,_[_0x7a97('0xc')](_0x513956,'message')['join'](',\x20'));logger['info'](_0x7a97('0xd'),_0x41529b);_0x373482[_0x7a97('0xe')]();}else{var _0x37f82a={'ids':[_0x14868e[0x0]]};if(rpc[_0x5e9288[_0x7a97('0xf')]+'Interaction']){rpc[_0x5e9288[_0x7a97('0xf')]+_0x7a97('0x10')]['addTags'](_0x5e9288['interaction']['id'],_0x37f82a)['then'](function(_0x262610){logger[_0x7a97('0x11')](_0x7a97('0x12'),_0x41529b,_0x14868e[0x1],_0x5e9288[_0x7a97('0xf')],_0x5e9288['interaction']['id']);})['catch'](function(_0x2dfdee){logger[_0x7a97('0xa')](_0x7a97('0xb'),_0x41529b,JSON['stringify'](_0x2dfdee));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x41529b);})['finally'](function(){_0x373482[_0x7a97('0xe')]();});}}}catch(_0x5af1e5){logger['error'](_0x7a97('0xb'),_0x41529b,_[_0x7a97('0x13')](_0x5af1e5)?JSON[_0x7a97('0x14')](_0x5af1e5):_0x5af1e5);logger[_0x7a97('0x11')](_0x7a97('0xd'),_0x41529b);_0x373482[_0x7a97('0xe')]();}};}; \ No newline at end of file +var _0xed58=['catch','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x345163,_0xba4c3d){var _0x11d1f8=function(_0x44b719){while(--_0x44b719){_0x345163['push'](_0x345163['shift']());}};_0x11d1f8(++_0xba4c3d);}(_0xed58,0xe5));var _0x8ed5=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xed58[_0x4cf98e];return _0x1623ac;};'use strict';var schema=require(_0x8ed5('0x0'));var _=require(_0x8ed5('0x1'));var rpc={'chatInteraction':require(_0x8ed5('0x2')),'openchannelInteraction':require(_0x8ed5('0x3')),'smsInteraction':require(_0x8ed5('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x8ed5('0x5')),'whatsappInteraction':require(_0x8ed5('0x6'))};var logger=require(_0x8ed5('0x7'))(_0x8ed5('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x8ed5('0x9')}});exports[_0x8ed5('0xa')]=function(_0x11b203,_0x519f94,_0x43fc88,_0x5694c0){return function(_0x5ca31e){try{var _0x394489={'tag':_0x519f94[0x0]};var _0x24905f=tag[_0x8ed5('0x0')](_0x394489,{'typecast':!![]});if(_0x24905f['length']){logger[_0x8ed5('0xb')](_0x8ed5('0xc'),_0x11b203,_[_0x8ed5('0xd')](_0x24905f,'message')[_0x8ed5('0xe')](',\x20'));logger[_0x8ed5('0xf')](_0x8ed5('0x10'),_0x11b203);_0x5ca31e['next']();}else{var _0xd77460={'ids':[_0x519f94[0x0]]};if(rpc[_0x5694c0[_0x8ed5('0x11')]+_0x8ed5('0x12')]){rpc[_0x5694c0[_0x8ed5('0x11')]+_0x8ed5('0x12')][_0x8ed5('0x13')](_0x5694c0[_0x8ed5('0x14')]['id'],_0xd77460)[_0x8ed5('0x15')](function(_0x4221dc){logger[_0x8ed5('0xf')](_0x8ed5('0x16'),_0x11b203,_0x519f94[0x1],_0x5694c0[_0x8ed5('0x11')],_0x5694c0[_0x8ed5('0x14')]['id']);})[_0x8ed5('0x17')](function(_0x213341){logger[_0x8ed5('0xb')]('[%s][TAG]\x20%s',_0x11b203,JSON[_0x8ed5('0x18')](_0x213341));logger[_0x8ed5('0xf')](_0x8ed5('0x10'),_0x11b203);})[_0x8ed5('0x19')](function(){_0x5ca31e[_0x8ed5('0x1a')]();});}}}catch(_0x274dda){logger[_0x8ed5('0xb')](_0x8ed5('0xc'),_0x11b203,_[_0x8ed5('0x1b')](_0x274dda)?JSON[_0x8ed5('0x18')](_0x274dda):_0x274dda);logger[_0x8ed5('0xf')](_0x8ed5('0x10'),_0x11b203);_0x5ca31e[_0x8ed5('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 1385a71..d723639 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 _0xae15=['push','?params=','urlOnRing','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','consequence','replace'];(function(_0x4454a6,_0x100a0a){var _0x312529=function(_0x2ac5ec){while(--_0x2ac5ec){_0x4454a6['push'](_0x4454a6['shift']());}};_0x312529(++_0x100a0a);}(_0xae15,0x1bc));var _0x5ae1=function(_0x117985,_0x2d4b0c){_0x117985=_0x117985-0x0;var _0x25f7c4=_0xae15[_0x117985];return _0x25f7c4;};'use strict';var rp=require(_0x5ae1('0x0'));var logger=require('../../../../config/logger')(_0x5ae1('0x1'));var _=require('lodash');var arr=[];exports[_0x5ae1('0x2')]=function(_0x23d64d,_0x173196){return function(_0x480ec2){var _0x5dbfa1=_0x173196[0xa];var _0x51b660=_0x173196[0xb];var _0x15f6eb=_0x173196[0xc];var _0x56ebe4=_0x173196[0xd];var _0x9b7931=_0x173196[0xe];var _0x32719d=_0x173196[0xf][_0x5ae1('0x3')](/\n/g,'\x20-\x20');var _0x43c0e4=_0x173196[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x51b660)){arr[_0x5ae1('0x4')](_0x51b660);var _0x124426=_0x173196[0x3];var _0x850ff1=_0x173196[0x4];var _0x445cbe=_0x173196[0x1];var _0x4d1cd9=_0x173196[0x0];var _0x375440={};_0x375440['urlOnAnswer']=_0x173196[0x8]+_0x5ae1('0x5')+_0x15f6eb+'|'+_0x5dbfa1+'|'+_0x56ebe4+'|'+_0x51b660+'|'+_0x9b7931;_0x375440[_0x5ae1('0x6')]=_0x173196[0x7]+_0x5ae1('0x5')+_0x15f6eb+'|'+_0x5dbfa1+'|'+_0x56ebe4+'|'+_0x51b660+'|'+_0x9b7931+'|'+_0x32719d+'|'+_0x43c0e4;_0x375440['title']=_0x173196[0x9];var _0x4f3552={};_0x4f3552['jsonrpc']='2.0';_0x4f3552[_0x5ae1('0x7')]=_0x5ae1('0x8');var _0x48697f=[];_0x48697f[_0x5ae1('0x4')](_0x173196[0x2]);_0x48697f[_0x5ae1('0x4')](_0x173196[0x5]);_0x48697f[_0x5ae1('0x4')](_0x173196[0x6]);_0x4f3552[_0x5ae1('0x9')]=_0x48697f;_0x4f3552['id']=0x1;var _0x2d9720=JSON[_0x5ae1('0xa')](_0x4f3552);var _0xf79cec={'encoding':_0x5ae1('0xb'),'method':_0x5ae1('0xc'),'timeout':0x2710,'url':_0x124426,'headers':{'Content-Type':_0x5ae1('0xd')},'body':_0x2d9720};return rp(_0xf79cec)[_0x5ae1('0xe')](function(_0x5b8e1b){const _0x1d072a=JSON[_0x5ae1('0xf')](_0x5b8e1b);if(!_0x1d072a[_0x5ae1('0x10')][_0x5ae1('0x11')]){throw new Error(_0x5ae1('0x12'));}var _0x21c4a3=_0x51b660;var _0x525d37='channelId='+_0x445cbe+_0x5ae1('0x13')+_0x4d1cd9+'&sessionId='+_0x21c4a3+_0x5ae1('0x14')+JSON[_0x5ae1('0xa')](_0x375440);var _0x3948ef=_0x850ff1+'?'+_0x525d37;return rp(_0x3948ef);})[_0x5ae1('0xe')](function(_0x489619){logger['info'](_0x5ae1('0x15'),_0x23d64d,_0x489619);_0x480ec2[_0x5ae1('0x16')]();})[_0x5ae1('0x17')](function(_0x396c3f){logger['error']('[%s][TVOX]\x20%s',_0x23d64d,_[_0x5ae1('0x18')](_0x396c3f)?JSON[_0x5ae1('0xa')](_0x396c3f):_0x396c3f);_0x480ec2[_0x5ae1('0x16')]();});}else{logger[_0x5ae1('0x19')](_0x5ae1('0x1a'),_0x23d64d);_0x480ec2[_0x5ae1('0x1b')]();}};}; \ No newline at end of file +var _0xfea8=['then','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','method','login','params','utf8','POST','application/json-rpc'];(function(_0x4ccce2,_0xf1f16f){var _0x57bd36=function(_0x1dd74d){while(--_0x1dd74d){_0x4ccce2['push'](_0x4ccce2['shift']());}};_0x57bd36(++_0xf1f16f);}(_0xfea8,0xfd));var _0x8fea=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0xfea8[_0x3de7e0];return _0x11d0b3;};'use strict';var rp=require(_0x8fea('0x0'));var logger=require(_0x8fea('0x1'))(_0x8fea('0x2'));var _=require(_0x8fea('0x3'));var arr=[];exports[_0x8fea('0x4')]=function(_0x58f6c9,_0x535a6e){return function(_0x558dce){var _0x7f8b6a=_0x535a6e[0xa];var _0x419596=_0x535a6e[0xb];var _0x2eaa03=_0x535a6e[0xc];var _0x314e0c=_0x535a6e[0xd];var _0x54d9c5=_0x535a6e[0xe];var _0x4b4a34=_0x535a6e[0xf][_0x8fea('0x5')](/\n/g,'\x20-\x20');var _0x1440f8=_0x535a6e[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x8fea('0x6')](_0x419596)){arr[_0x8fea('0x7')](_0x419596);var _0x40d142=_0x535a6e[0x3];var _0x348e3b=_0x535a6e[0x4];var _0x22a1dd=_0x535a6e[0x1];var _0x3dd081=_0x535a6e[0x0];var _0x307034={};_0x307034[_0x8fea('0x8')]=_0x535a6e[0x8]+_0x8fea('0x9')+_0x2eaa03+'|'+_0x7f8b6a+'|'+_0x314e0c+'|'+_0x419596+'|'+_0x54d9c5;_0x307034[_0x8fea('0xa')]=_0x535a6e[0x7]+_0x8fea('0x9')+_0x2eaa03+'|'+_0x7f8b6a+'|'+_0x314e0c+'|'+_0x419596+'|'+_0x54d9c5+'|'+_0x4b4a34+'|'+_0x1440f8;_0x307034[_0x8fea('0xb')]=_0x535a6e[0x9];var _0x51f262={};_0x51f262['jsonrpc']=_0x8fea('0xc');_0x51f262[_0x8fea('0xd')]=_0x8fea('0xe');var _0x12be15=[];_0x12be15[_0x8fea('0x7')](_0x535a6e[0x2]);_0x12be15[_0x8fea('0x7')](_0x535a6e[0x5]);_0x12be15['push'](_0x535a6e[0x6]);_0x51f262[_0x8fea('0xf')]=_0x12be15;_0x51f262['id']=0x1;var _0x41e5fd=JSON['stringify'](_0x51f262);var _0x2ae0bb={'encoding':_0x8fea('0x10'),'method':_0x8fea('0x11'),'timeout':0x2710,'url':_0x40d142,'headers':{'Content-Type':_0x8fea('0x12')},'body':_0x41e5fd};return rp(_0x2ae0bb)[_0x8fea('0x13')](function(_0x34e544){const _0x1b3bf2=JSON['parse'](_0x34e544);if(!_0x1b3bf2['result'][_0x8fea('0x14')]){throw new Error(_0x8fea('0x15'));}var _0x31941d=_0x419596;var _0x477020='channelId='+_0x22a1dd+'&serviceId='+_0x3dd081+_0x8fea('0x16')+_0x31941d+_0x8fea('0x17')+JSON[_0x8fea('0x18')](_0x307034);var _0x17d028=_0x348e3b+'?'+_0x477020;return rp(_0x17d028);})['then'](function(_0x59c12d){logger[_0x8fea('0x19')](_0x8fea('0x1a'),_0x58f6c9,_0x59c12d);_0x558dce['stop']();})[_0x8fea('0x1b')](function(_0x59da91){logger[_0x8fea('0x1c')](_0x8fea('0x1d'),_0x58f6c9,_[_0x8fea('0x1e')](_0x59da91)?JSON[_0x8fea('0x18')](_0x59da91):_0x59da91);_0x558dce[_0x8fea('0x1f')]();});}else{logger['info'](_0x8fea('0x20'),_0x58f6c9);_0x558dce[_0x8fea('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 4455634..7c0d448 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x54dcc9,_0xab713c){var _0x20107a=function(_0x3f4408){while(--_0x3f4408){_0x54dcc9['push'](_0x54dcc9['shift']());}};_0x20107a(++_0xab713c);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x15c521,_0x999f22){var _0x34d42a=function(_0x1d2493){while(--_0x1d2493){_0x15c521['push'](_0x15c521['shift']());}};_0x34d42a(++_0x999f22);}(_0xe706,0xa3));var _0x6e70=function(_0x4b85a3,_0x55a93f){_0x4b85a3=_0x4b85a3-0x0;var _0xcf8bc7=_0xe706[_0x4b85a3];return _0xcf8bc7;};'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 9fe6957..56ad67e 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 _0xed5c=['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','server','http','stringify','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','amazonlex','tag','TagId','tvox','account','ContactId','body','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','message\x20is\x20empty'];(function(_0x3269c5,_0x32f3b4){var _0x3c567c=function(_0x3bbcba){while(--_0x3bbcba){_0x3269c5['push'](_0x3269c5['shift']());}};_0x3c567c(++_0x32f3b4);}(_0xed5c,0x81));var _0xced5=function(_0x7e5477,_0x151932){_0x7e5477=_0x7e5477-0x0;var _0x3b0dff=_0xed5c[_0x7e5477];return _0x3b0dff;};'use strict';var _=require(_0xced5('0x0'));var util=require(_0xced5('0x1'));var path=require(_0xced5('0x2'));var fs=require('fs');var jayson=require(_0xced5('0x3'));var BPromise=require(_0xced5('0x4'));var utils=require(_0xced5('0x5'));var sUtils=require(_0xced5('0x6'));var logger=require(_0xced5('0x7'))(_0xced5('0x8'));var rpc={'openchannelQueueReport':require(_0xced5('0x9')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xced5('0xa')),'smsQueueReport':require(_0xced5('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xced5('0xc'));function getId(_0xc738da,_0x2857d8,_0x2113e4){return util[_0xced5('0xd')]('%s.%s.%s',_0xc738da,_0x2857d8||0x0,_0x2113e4||0x0);}function getIntervals(_0x50d620,_0x708a5a){var _0x2f2606=[];if(!_[_0xced5('0xe')](_0x708a5a[_0xced5('0xf')])&&!_['isNil'](_0x50d620[_0x708a5a[_0xced5('0xf')]])&&!_['isNil'](_0x50d620[_0x708a5a[_0xced5('0xf')]][_0xced5('0x10')])){_0x2f2606=_['map'](_0x50d620[_0x708a5a[_0xced5('0xf')]]['Intervals'],_0xced5('0x11'));}else if(!_[_0xced5('0xe')](_0x708a5a[_0xced5('0x11')])){_0x2f2606=[_0x708a5a[_0xced5('0x11')]];}return _0x2f2606;}exports[_0xced5('0x12')]=function(_0x14341d){_0x14341d[_0xced5('0x13')]={};return new BPromise(function(_0x4bee02,_0x4b2533){var _0x23ca09={'Start':function(_0x292fe){var _0x2f4e9a=this;return new Promise(function(_0x5e5346,_0x4fa2a3){if(_0x292fe){try{var _0x456843=[];var _0x1c8c90=getId(_0x292fe[_0xced5('0x14')],_0x292fe[_0xced5('0x15')]?_0x292fe[_0xced5('0x15')]['id']:0x0,_0x292fe[_0xced5('0x16')]?_0x292fe['interaction']['id']:0x0);var _0x29a3ba=sUtils[_0xced5('0x17')](_0x14341d,_0x292fe);if(_0x292fe['transfer']||!_0x29a3ba&&_0x292fe[_0xced5('0x18')]&&_[_0xced5('0x19')](_0x292fe[_0xced5('0x18')])&&_0x292fe['applications'][_0xced5('0x1a')]){for(var _0x353071=0x0;_0x353071<_0x292fe[_0xced5('0x18')]['length'];_0x353071+=0x1){var _0x2d854a=_0x292fe[_0xced5('0x18')][_0x353071];if(fs[_0xced5('0x1b')](path[_0xced5('0x1c')](__dirname,_0xced5('0x18'),_0x2d854a[_0xced5('0x1d')]+'.js'))){var _0x1ba520=[];switch(_0x2d854a[_0xced5('0x1d')][_0xced5('0x1e')]()){case _0xced5('0x1f'):var _0x4495c6=_0x2d854a[_0xced5('0x20')][_0xced5('0x21')](',');if(_0x292fe[_0xced5('0x14')]===_0xced5('0x22')){_0x1ba520[_0xced5('0x23')](_0x4495c6[0x0]);_0x1ba520[_0xced5('0x23')](_0x4495c6[0x1]);_0x1ba520[_0xced5('0x23')](_0x4495c6[_0xced5('0x24')](0x2,_0x4495c6[_0xced5('0x1a')])['join'](','));}else{_0x1ba520['push'](_0x4495c6[0x0]);_0x1ba520[_0xced5('0x23')](_0x4495c6[_0xced5('0x24')](0x1,_0x4495c6[_0xced5('0x1a')])[_0xced5('0x1c')](','));}break;case _0xced5('0x25'):var _0x26790a=_0x2d854a[_0xced5('0x20')][_0xced5('0x21')](',');_0x1ba520[_0xced5('0x23')](_0x26790a[0x0]);_0x1ba520[_0xced5('0x23')](_0x26790a[0x1]);_0x1ba520[_0xced5('0x23')](_0x26790a['slice'](0x2,_0x26790a[_0xced5('0x1a')])[_0xced5('0x1c')](','));break;case'dialogflowv2':var _0x48b6d1=_0x2d854a['appdata']['split'](',');_0x1ba520[_0xced5('0x23')](_0x48b6d1[0x0]);_0x1ba520[_0xced5('0x23')](_0x48b6d1[0x1]);_0x1ba520[_0xced5('0x23')](_0x48b6d1[0x2]);_0x1ba520[_0xced5('0x23')](_0x48b6d1[0x3]);_0x1ba520[_0xced5('0x23')](_0x48b6d1['slice'](0x4,_0x48b6d1[_0xced5('0x1a')])['join'](','));break;case _0xced5('0x26'):var _0x1fa141=_0x2d854a['appdata']['split'](',');_0x1ba520[_0xced5('0x23')](_0x1fa141[0x0]);_0x1ba520['push'](_0x1fa141[0x1]);_0x1ba520[_0xced5('0x23')](_0x1fa141[0x2]);_0x1ba520[_0xced5('0x23')](_0x1fa141[0x3]);_0x1ba520[_0xced5('0x23')](_0x1fa141[_0xced5('0x24')](0x4,_0x1fa141[_0xced5('0x1a')])[_0xced5('0x1c')](','));break;case _0xced5('0x15'):_0x1ba520['push'](_0x2d854a[_0xced5('0x20')]);break;case _0xced5('0x27'):_0x1ba520['push'](_0x2d854a[_0xced5('0x28')]);_0x1ba520[_0xced5('0x23')](_0x2d854a['appdata']);break;case _0xced5('0x29'):var _0x4701b6=utils['getMustacheRender'](_0x292fe[_0xced5('0x2a')]['notificationTemplate'],_0x292fe);var _0x280281=_0x2d854a['appdata'][_0xced5('0x21')](',');_0x1ba520[_0xced5('0x23')](_0x280281[0x0]);_0x1ba520['push'](_0x280281[0x1]);_0x1ba520['push'](_0x280281[0x2]);_0x1ba520[_0xced5('0x23')](_0x280281[0x3]);_0x1ba520[_0xced5('0x23')](_0x280281[0x4]);_0x1ba520['push'](_0x280281[0x5]);_0x1ba520[_0xced5('0x23')](_0x280281[0x6]);_0x1ba520[_0xced5('0x23')](_0x280281[0x7]);_0x1ba520['push'](_0x280281[0x8]);_0x1ba520[_0xced5('0x23')](_0x280281[0x9]);_0x1ba520[_0xced5('0x23')](_0x280281[0xa]);_0x1ba520[_0xced5('0x23')](_0x292fe['interaction']['id']);_0x1ba520[_0xced5('0x23')](_0x292fe[_0xced5('0x15')]['id']);_0x1ba520[_0xced5('0x23')](_0x2d854a['ChatWebsiteId']);_0x1ba520[_0xced5('0x23')](_0x292fe[_0xced5('0x16')][_0xced5('0x2b')]);_0x1ba520['push'](_0x292fe[_0xced5('0x2c')]['body']);_0x1ba520[_0xced5('0x23')](_0x4701b6);break;default:_0x1ba520=_[_0xced5('0xe')](_0x2d854a[_0xced5('0x20')])?[]:_0x2d854a[_0xced5('0x20')][_0xced5('0x21')](',');}var _0x30dd8e={'id':util[_0xced5('0xd')]('%s:%s:%s',_0x1c8c90,_0x2d854a['id'],_0x2d854a[_0xced5('0x1d')]),'condition':require(_0xced5('0x2d'))[_0xced5('0x2e')](_0x1c8c90,getIntervals(_0x14341d['intervals'],_0x2d854a),_0x14341d),'consequence':require(_0xced5('0x2f')+_0x2d854a['app'])[_0xced5('0x30')](_0x1c8c90,_0x1ba520,_0x14341d,_0x292fe),'p':_0x2d854a[_0xced5('0x31')]||0x0};logger[_0xced5('0x32')](_0xced5('0x33'),_0x30dd8e['id'],_0xced5('0x34'),getIntervals(_0x14341d[_0xced5('0x35')],_0x2d854a)[_0xced5('0x1c')]('\x20|\x20'));_0x456843[_0xced5('0x23')](_0x30dd8e);}else{logger['error'](_0xced5('0x36'),path[_0xced5('0x1c')](__dirname,'applications',_0x2d854a[_0xced5('0x1d')]+_0xced5('0x37')));}}_0x14341d[_0xced5('0x13')][_0x1c8c90]=new RuleEngine(_0x456843);_0x14341d[_0xced5('0x13')][_0x1c8c90][_0xced5('0x38')](_0x292fe,function(_0x55880c){logger['info'](_0xced5('0x39'),JSON['stringify'](_0x55880c[_0xced5('0x3a')]));if(_0x14341d[_0xced5('0x13')][_0x1c8c90]){_0x14341d[_0xced5('0x13')][_0x1c8c90][_0xced5('0x3b')](_0xced5('0x3c'));}});return _0x5e5346({'code':0xc8,'message':_0x292fe});}else{if(_0x29a3ba){logger[_0xced5('0x32')](util[_0xced5('0xd')](_0xced5('0x3d'),_0x1c8c90));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x5e5346({'code':0xc8,'message':_0x292fe});}}catch(_0x5c8a1c){logger[_0xced5('0x3e')](_0x5c8a1c[_0xced5('0x3f')]);return _0x4fa2a3(_0x2f4e9a[_0xced5('0x3e')](0x1f4,_0x5c8a1c));}}return _0x4fa2a3(_0xced5('0x40'));});},'AcceptMessage':function(_0x1849b9){var _0x1539a2=this;return new Promise(function(_0xeb8839,_0x1cab90){if(_0x1849b9[_0xced5('0x41')]&&_0x1849b9[_0xced5('0x41')]['id']){if(_0x14341d[_0xced5('0x42')][_0x1849b9['agent']['id']]){_0x14341d[_0xced5('0x42')][_0x1849b9[_0xced5('0x41')]['id']][_0xced5('0x43')]=![];_0x14341d[_0xced5('0x42')][_0x1849b9[_0xced5('0x41')]['id']][_0xced5('0x44')]=undefined;}}if(_0x1849b9['message']&&_0x1849b9[_0xced5('0x15')]['id']){try{var _0x334faf=getId(_0x1849b9[_0xced5('0x14')],_0x1849b9[_0xced5('0x15')]?_0x1849b9[_0xced5('0x15')]['id']:0x0,_0x1849b9[_0xced5('0x16')]?_0x1849b9[_0xced5('0x16')]['id']:0x0);if(_0x14341d[_0xced5('0x13')][_0x334faf]){_0x14341d['rules'][_0x334faf][_0xced5('0x3b')](_0xced5('0x45'));if(rpc[_0x1849b9[_0xced5('0x14')]+_0xced5('0x46')]){rpc[_0x1849b9[_0xced5('0x14')]+_0xced5('0x46')]['update'](_0x334faf,{'UserId':_0x1849b9['message'][_0xced5('0x47')]})['catch'](function(){logger[_0xced5('0x3e')]('error\x20update\x20queue\x20report');});}}return _0xeb8839({'code':0xc8,'message':_0x1849b9});}catch(_0x1825b8){logger['error'](_0x1825b8[_0xced5('0x3f')]);return _0x1cab90(_0x1539a2[_0xced5('0x3e')](0x1f4,_0x1825b8));}}logger[_0xced5('0x3e')](_0xced5('0x48'));return _0x1cab90(_0x1539a2[_0xced5('0x3e')](0x1f4,_0xced5('0x48')));});},'RejectMessage':function(_0xcb1ec1){var _0x3a958f=this;return new Promise(function(_0x56af57,_0x2ca0e7){if(_0xcb1ec1['agent']&&_0xcb1ec1[_0xced5('0x41')]['id']){try{if(_0x14341d[_0xced5('0x42')][_0xcb1ec1['agent']['id']]){_0x14341d[_0xced5('0x42')][_0xcb1ec1['agent']['id']][_0xced5('0x43')]=![];_0x14341d[_0xced5('0x42')][_0xcb1ec1[_0xced5('0x41')]['id']][_0xced5('0x44')]=undefined;}return _0x56af57({'code':0xc8,'message':_0xcb1ec1});}catch(_0x590def){logger[_0xced5('0x3e')](_0x590def[_0xced5('0x3f')]);return _0x2ca0e7(_0x3a958f[_0xced5('0x3e')](0x1f4,_0x590def));}}logger[_0xced5('0x3e')](_0xced5('0x48'));return _0x2ca0e7(_0x3a958f['error'](0x1f4,_0xced5('0x48')));});},'AbandonInteraction':function(_0x22a13c){var _0xd6315d=this;return new Promise(function(_0x25827d,_0x44e2b4){if(_0x22a13c[_0xced5('0x14')]&&_0x22a13c[_0xced5('0x16')]&&_0x22a13c[_0xced5('0x16')]['id']){try{var _0x30d172=getId(_0x22a13c[_0xced5('0x14')],_0x22a13c[_0xced5('0x15')]?_0x22a13c[_0xced5('0x15')]['id']:0x0,_0x22a13c[_0xced5('0x16')]?_0x22a13c[_0xced5('0x16')]['id']:0x0);if(_0x14341d[_0xced5('0x13')][_0x30d172]){_0x14341d[_0xced5('0x13')][_0x30d172][_0xced5('0x3b')]('end');}return _0x25827d({'code':0xc8,'message':_0x22a13c});}catch(_0x44cb19){logger[_0xced5('0x3e')](_0x44cb19[_0xced5('0x3f')]);return _0x44e2b4(_0xd6315d[_0xced5('0x3e')](0x1f4,_0x44cb19));}}logger[_0xced5('0x3e')](_0xced5('0x48'));return _0x44e2b4(_0xd6315d['error'](0x1f4,_0xced5('0x48')));});},'AgentCapacity':function(_0x5e4796){var _0x151667=this;return new Promise(function(_0x21d3d9,_0x394d65){if(_0x14341d[_0xced5('0x42')][_0xced5('0x49')](_0x5e4796['id'])){for(var _0x35963f in _0x5e4796['capacity']){if(_0x5e4796[_0xced5('0x4a')][_0xced5('0x49')](_0x35963f)){if(_0x14341d['agents'][_0x5e4796['id']][_0xced5('0x49')](_0x35963f+'CurrentCapacity')){_0x14341d['agents'][_0x5e4796['id']][_0x35963f+_0xced5('0x4b')]=parseInt(_0x5e4796[_0xced5('0x4a')][_0x35963f],0xa);}}}_0x14341d[_0xced5('0x42')][_0x5e4796['id']][_0xced5('0x4c')]();return _0x21d3d9({'code':0xc8,'message':_0x14341d['agents'][_0x5e4796['id']]});}else{return _0x394d65(_0x151667[_0xced5('0x3e')](0x1f4,_0xced5('0x4d')));}});},'Agents':function(_0x8f01d2){return new Promise(function(_0x5b0776){var _0x1a70d9=_[_0xced5('0x4e')](_0x14341d['agents']);if(_0x8f01d2&&_0x8f01d2['id']){var _0x5bb57e=_[_0xced5('0x4f')](_0x1a70d9,function(_0x366134){return _0x366134['id']===_0x8f01d2['id'];});_0x5b0776(_0x5bb57e);}else{_0x5b0776({'count':_0x1a70d9['length'],'rows':_0x1a70d9});}});},'ChatQueues':function(){return new Promise(function(_0x5ad4fa){var _0x2760d2=[];for(var _0x165dac in _0x14341d[_0xced5('0x50')]){if(_0x14341d['chatQueues']['hasOwnProperty'](_0x165dac)){var _0x553a41=_0x14341d[_0xced5('0x50')][_0x165dac];var _0x599327={'id':_0x553a41['id'],'available':_0x553a41[_0xced5('0x51')],'loggedIn':_0x553a41[_0xced5('0x52')],'name':_0x553a41[_0xced5('0x53')],'paused':_0x553a41[_0xced5('0x54')],'waiting':_0x553a41[_0xced5('0x55')]};_0x2760d2['push'](_0x599327);}}_0x5ad4fa({'count':_0x2760d2[_0xced5('0x1a')],'rows':_0x2760d2});});},'MailQueues':function(){return new Promise(function(_0x448a33){var _0x19dce8=[];for(var _0x5b5a26 in _0x14341d['mailQueues']){if(_0x14341d[_0xced5('0x56')]['hasOwnProperty'](_0x5b5a26)){var _0x4a88c7=_0x14341d[_0xced5('0x56')][_0x5b5a26];var _0x4bc168={'id':_0x4a88c7['id'],'available':_0x4a88c7[_0xced5('0x51')],'loggedIn':_0x4a88c7['loggedIn'],'name':_0x4a88c7[_0xced5('0x53')],'paused':_0x4a88c7[_0xced5('0x54')],'waiting':_0x4a88c7[_0xced5('0x55')]};_0x19dce8[_0xced5('0x23')](_0x4bc168);}}_0x448a33({'count':_0x19dce8[_0xced5('0x1a')],'rows':_0x19dce8});});},'OpenchannelQueues':function(){return new Promise(function(_0x4a6cfa){var _0x19153f=[];for(var _0x113b63 in _0x14341d['openchannelQueues']){if(_0x14341d[_0xced5('0x57')][_0xced5('0x49')](_0x113b63)){var _0x546420=_0x14341d['openchannelQueues'][_0x113b63];var _0x53f71a={'id':_0x546420['id'],'available':_0x546420[_0xced5('0x51')],'loggedIn':_0x546420[_0xced5('0x52')],'name':_0x546420[_0xced5('0x53')],'paused':_0x546420[_0xced5('0x54')],'waiting':_0x546420[_0xced5('0x55')]};_0x19153f[_0xced5('0x23')](_0x53f71a);}}_0x4a6cfa({'count':_0x19153f[_0xced5('0x1a')],'rows':_0x19153f});});},'SmsQueues':function(){return new Promise(function(_0x122919){var _0x562c59=[];for(var _0x275d89 in _0x14341d[_0xced5('0x58')]){if(_0x14341d[_0xced5('0x58')][_0xced5('0x49')](_0x275d89)){var _0x8e4abf=_0x14341d[_0xced5('0x58')][_0x275d89];var _0x2aa1c3={'id':_0x8e4abf['id'],'available':_0x8e4abf[_0xced5('0x51')],'loggedIn':_0x8e4abf[_0xced5('0x52')],'name':_0x8e4abf[_0xced5('0x53')],'paused':_0x8e4abf['paused'],'waiting':_0x8e4abf['waiting']};_0x562c59[_0xced5('0x23')](_0x2aa1c3);}}_0x122919({'count':_0x562c59[_0xced5('0x1a')],'rows':_0x562c59});});},'FaxQueues':function(){return new Promise(function(_0x27f4d7){var _0x38fefb=[];for(var _0x43abb9 in _0x14341d[_0xced5('0x59')]){if(_0x14341d['faxQueues'][_0xced5('0x49')](_0x43abb9)){var _0x216223=_0x14341d[_0xced5('0x59')][_0x43abb9];var _0x160220={'id':_0x216223['id'],'available':_0x216223[_0xced5('0x51')],'loggedIn':_0x216223['loggedIn'],'name':_0x216223[_0xced5('0x53')],'paused':_0x216223[_0xced5('0x54')],'waiting':_0x216223['waiting']};_0x38fefb[_0xced5('0x23')](_0x160220);}}_0x27f4d7({'count':_0x38fefb[_0xced5('0x1a')],'rows':_0x38fefb});});},'WhatsappQueues':function(){return new Promise(function(_0xbf5ffa){var _0x368521=[];for(var _0x4ccca3 in _0x14341d[_0xced5('0x5a')]){if(_0x14341d[_0xced5('0x5a')]['hasOwnProperty'](_0x4ccca3)){var _0x3be6f0=_0x14341d[_0xced5('0x5a')][_0x4ccca3];var _0xfd6c22={'id':_0x3be6f0['id'],'available':_0x3be6f0[_0xced5('0x51')],'loggedIn':_0x3be6f0[_0xced5('0x52')],'name':_0x3be6f0[_0xced5('0x53')],'paused':_0x3be6f0[_0xced5('0x54')],'waiting':_0x3be6f0[_0xced5('0x55')]};_0x368521['push'](_0xfd6c22);}}_0xbf5ffa({'count':_0x368521[_0xced5('0x1a')],'rows':_0x368521});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x307c72){var _0x5defa0=_[_0xced5('0x4e')](_0x14341d[_0xced5('0x5b')]);_0x307c72({'count':_0x5defa0['length'],'rows':_0x5defa0});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x23466e){var _0x42471c=_['values'](_0x14341d[_0xced5('0x5c')]);_0x23466e({'count':_0x42471c[_0xced5('0x1a')],'rows':_0x42471c});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4d9002){var _0x397d2e=_[_0xced5('0x4e')](_0x14341d[_0xced5('0x5d')]);_0x4d9002({'count':_0x397d2e[_0xced5('0x1a')],'rows':_0x397d2e});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x119c42){var _0x2ad3c6=_[_0xced5('0x4e')](_0x14341d[_0xced5('0x5e')]);_0x119c42({'count':_0x2ad3c6[_0xced5('0x1a')],'rows':_0x2ad3c6});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x567ca4){var _0x1147d2=_[_0xced5('0x4e')](_0x14341d[_0xced5('0x5f')]);_0x567ca4({'count':_0x1147d2[_0xced5('0x1a')],'rows':_0x1147d2});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x96a96){var _0x30e93f=_[_0xced5('0x4e')](_0x14341d[_0xced5('0x60')]);_0x96a96({'count':_0x30e93f['length'],'rows':_0x30e93f});});}};var _0x5df050=jayson[_0xced5('0x61')](_0x23ca09)[_0xced5('0x62')]();_0x5df050['on'](_0xced5('0x3e'),function(_0x262d48){logger[_0xced5('0x3e')](JSON[_0xced5('0x63')](_0x262d48));return _0x4b2533(_0x262d48);});_0x5df050[_0xced5('0x12')](0x232c,'127.0.0.1',function(){console['log'](_0xced5('0x64'),0x232c);return _0x4bee02('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x7939=['IntervalId','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','isArray','length','applications','existsSync','app','toLowerCase','autoreply','split','mail','push','slice','join','dialogflow','appdata','dialogflowv2','tag','TagId','account','ChatWebsiteId','body','%s:%s:%s','./interval','condition','./applications/','priority','info','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','values','find','chatQueues','available','loggedIn','paused','mailQueues','name','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil'];(function(_0x3cd8b6,_0x11cd40){var _0x121234=function(_0x401eeb){while(--_0x401eeb){_0x3cd8b6['push'](_0x3cd8b6['shift']());}};_0x121234(++_0x11cd40);}(_0x7939,0x11c));var _0x9793=function(_0x5f4c49,_0x1aacaa){_0x5f4c49=_0x5f4c49-0x0;var _0x12b19e=_0x7939[_0x5f4c49];return _0x12b19e;};'use strict';var _=require('lodash');var util=require(_0x9793('0x0'));var path=require(_0x9793('0x1'));var fs=require('fs');var jayson=require(_0x9793('0x2'));var BPromise=require(_0x9793('0x3'));var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require('../../../config/logger')(_0x9793('0x4'));var rpc={'openchannelQueueReport':require(_0x9793('0x5')),'mailQueueReport':require(_0x9793('0x6')),'chatQueueReport':require(_0x9793('0x7')),'smsQueueReport':require(_0x9793('0x8')),'faxQueueReport':require(_0x9793('0x9')),'whatsappQueueReport':require(_0x9793('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x1a2859,_0x8ab0eb,_0x45bbff){return util[_0x9793('0xb')]('%s.%s.%s',_0x1a2859,_0x8ab0eb||0x0,_0x45bbff||0x0);}function getIntervals(_0x3901f3,_0x59f48e){var _0x30cc8c=[];if(!_[_0x9793('0xc')](_0x59f48e['IntervalId'])&&!_[_0x9793('0xc')](_0x3901f3[_0x59f48e[_0x9793('0xd')]])&&!_[_0x9793('0xc')](_0x3901f3[_0x59f48e[_0x9793('0xd')]][_0x9793('0xe')])){_0x30cc8c=_['map'](_0x3901f3[_0x59f48e['IntervalId']][_0x9793('0xe')],_0x9793('0xf'));}else if(!_[_0x9793('0xc')](_0x59f48e[_0x9793('0xf')])){_0x30cc8c=[_0x59f48e[_0x9793('0xf')]];}return _0x30cc8c;}exports[_0x9793('0x10')]=function(_0x1b7b8a){_0x1b7b8a[_0x9793('0x11')]={};return new BPromise(function(_0x377012,_0x210588){var _0x2467ae={'Start':function(_0x265da2){var _0x4f0d68=this;return new Promise(function(_0x277e9b,_0x2953f9){if(_0x265da2){try{var _0x54cacc=[];var _0x5cf237=getId(_0x265da2[_0x9793('0x12')],_0x265da2['message']?_0x265da2[_0x9793('0x13')]['id']:0x0,_0x265da2['interaction']?_0x265da2[_0x9793('0x14')]['id']:0x0);var _0x41617c=sUtils[_0x9793('0x15')](_0x1b7b8a,_0x265da2);if(_0x265da2['transfer']||!_0x41617c&&_0x265da2['applications']&&_[_0x9793('0x16')](_0x265da2['applications'])&&_0x265da2['applications'][_0x9793('0x17')]){for(var _0x4d1769=0x0;_0x4d1769<_0x265da2[_0x9793('0x18')][_0x9793('0x17')];_0x4d1769+=0x1){var _0xe3cd5d=_0x265da2[_0x9793('0x18')][_0x4d1769];if(fs[_0x9793('0x19')](path['join'](__dirname,_0x9793('0x18'),_0xe3cd5d[_0x9793('0x1a')]+'.js'))){var _0x167bf0=[];switch(_0xe3cd5d['app'][_0x9793('0x1b')]()){case _0x9793('0x1c'):var _0x566c92=_0xe3cd5d['appdata'][_0x9793('0x1d')](',');if(_0x265da2[_0x9793('0x12')]===_0x9793('0x1e')){_0x167bf0['push'](_0x566c92[0x0]);_0x167bf0[_0x9793('0x1f')](_0x566c92[0x1]);_0x167bf0[_0x9793('0x1f')](_0x566c92[_0x9793('0x20')](0x2,_0x566c92[_0x9793('0x17')])[_0x9793('0x21')](','));}else{_0x167bf0[_0x9793('0x1f')](_0x566c92[0x0]);_0x167bf0[_0x9793('0x1f')](_0x566c92[_0x9793('0x20')](0x1,_0x566c92[_0x9793('0x17')])[_0x9793('0x21')](','));}break;case _0x9793('0x22'):var _0xf8e48d=_0xe3cd5d[_0x9793('0x23')]['split'](',');_0x167bf0[_0x9793('0x1f')](_0xf8e48d[0x0]);_0x167bf0[_0x9793('0x1f')](_0xf8e48d[0x1]);_0x167bf0[_0x9793('0x1f')](_0xf8e48d[_0x9793('0x20')](0x2,_0xf8e48d['length'])[_0x9793('0x21')](','));break;case _0x9793('0x24'):var _0x563d54=_0xe3cd5d[_0x9793('0x23')][_0x9793('0x1d')](',');_0x167bf0[_0x9793('0x1f')](_0x563d54[0x0]);_0x167bf0['push'](_0x563d54[0x1]);_0x167bf0[_0x9793('0x1f')](_0x563d54[0x2]);_0x167bf0[_0x9793('0x1f')](_0x563d54[0x3]);_0x167bf0[_0x9793('0x1f')](_0x563d54['slice'](0x4,_0x563d54[_0x9793('0x17')])[_0x9793('0x21')](','));break;case'amazonlex':var _0x6d0706=_0xe3cd5d[_0x9793('0x23')]['split'](',');_0x167bf0[_0x9793('0x1f')](_0x6d0706[0x0]);_0x167bf0[_0x9793('0x1f')](_0x6d0706[0x1]);_0x167bf0[_0x9793('0x1f')](_0x6d0706[0x2]);_0x167bf0[_0x9793('0x1f')](_0x6d0706[0x3]);_0x167bf0[_0x9793('0x1f')](_0x6d0706[_0x9793('0x20')](0x4,_0x6d0706[_0x9793('0x17')])[_0x9793('0x21')](','));break;case _0x9793('0x13'):_0x167bf0[_0x9793('0x1f')](_0xe3cd5d[_0x9793('0x23')]);break;case _0x9793('0x25'):_0x167bf0['push'](_0xe3cd5d[_0x9793('0x26')]);_0x167bf0[_0x9793('0x1f')](_0xe3cd5d[_0x9793('0x23')]);break;case'tvox':var _0x4d7548=utils['getMustacheRender'](_0x265da2[_0x9793('0x27')]['notificationTemplate'],_0x265da2);var _0x36eab2=_0xe3cd5d[_0x9793('0x23')][_0x9793('0x1d')](',');_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x0]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x1]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x2]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x3]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x4]);_0x167bf0['push'](_0x36eab2[0x5]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x6]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x7]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x8]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x9]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0xa]);_0x167bf0['push'](_0x265da2['interaction']['id']);_0x167bf0[_0x9793('0x1f')](_0x265da2[_0x9793('0x13')]['id']);_0x167bf0[_0x9793('0x1f')](_0xe3cd5d[_0x9793('0x28')]);_0x167bf0[_0x9793('0x1f')](_0x265da2[_0x9793('0x14')]['ContactId']);_0x167bf0[_0x9793('0x1f')](_0x265da2[_0x9793('0x29')][_0x9793('0x29')]);_0x167bf0['push'](_0x4d7548);break;default:_0x167bf0=_[_0x9793('0xc')](_0xe3cd5d['appdata'])?[]:_0xe3cd5d[_0x9793('0x23')][_0x9793('0x1d')](',');}var _0x4b56e0={'id':util['format'](_0x9793('0x2a'),_0x5cf237,_0xe3cd5d['id'],_0xe3cd5d[_0x9793('0x1a')]),'condition':require(_0x9793('0x2b'))[_0x9793('0x2c')](_0x5cf237,getIntervals(_0x1b7b8a['intervals'],_0xe3cd5d),_0x1b7b8a),'consequence':require(_0x9793('0x2d')+_0xe3cd5d['app'])['consequence'](_0x5cf237,_0x167bf0,_0x1b7b8a,_0x265da2),'p':_0xe3cd5d[_0x9793('0x2e')]||0x0};logger[_0x9793('0x2f')]('Push\x20new\x20rule',_0x4b56e0['id'],'on\x20interval',getIntervals(_0x1b7b8a[_0x9793('0x30')],_0xe3cd5d)[_0x9793('0x21')](_0x9793('0x31')));_0x54cacc[_0x9793('0x1f')](_0x4b56e0);}else{logger['error'](_0x9793('0x32'),path['join'](__dirname,_0x9793('0x18'),_0xe3cd5d[_0x9793('0x1a')]+_0x9793('0x33')));}}_0x1b7b8a[_0x9793('0x11')][_0x5cf237]=new RuleEngine(_0x54cacc);_0x1b7b8a[_0x9793('0x11')][_0x5cf237][_0x9793('0x34')](_0x265da2,function(_0x2e494b){logger[_0x9793('0x2f')](_0x9793('0x35'),JSON[_0x9793('0x36')](_0x2e494b[_0x9793('0x37')]));if(_0x1b7b8a['rules'][_0x5cf237]){_0x1b7b8a[_0x9793('0x11')][_0x5cf237][_0x9793('0x38')](_0x9793('0x39'));}});return _0x277e9b({'code':0xc8,'message':_0x265da2});}else{if(_0x41617c){logger['info'](util[_0x9793('0xb')](_0x9793('0x3a'),_0x5cf237));}else{logger[_0x9793('0x2f')](_0x9793('0x3b'));}return _0x277e9b({'code':0xc8,'message':_0x265da2});}}catch(_0x4a5ef5){logger[_0x9793('0x3c')](_0x4a5ef5[_0x9793('0x3d')]);return _0x2953f9(_0x4f0d68['error'](0x1f4,_0x4a5ef5));}}return _0x2953f9(_0x9793('0x3e'));});},'AcceptMessage':function(_0x56fd4f){var _0xe4171c=this;return new Promise(function(_0x511f35,_0x6c8092){if(_0x56fd4f[_0x9793('0x3f')]&&_0x56fd4f[_0x9793('0x3f')]['id']){if(_0x1b7b8a[_0x9793('0x40')][_0x56fd4f[_0x9793('0x3f')]['id']]){_0x1b7b8a[_0x9793('0x40')][_0x56fd4f[_0x9793('0x3f')]['id']][_0x9793('0x41')]=![];_0x1b7b8a[_0x9793('0x40')][_0x56fd4f['agent']['id']]['busyQueue']=undefined;}}if(_0x56fd4f['message']&&_0x56fd4f['message']['id']){try{var _0x2bb0c9=getId(_0x56fd4f[_0x9793('0x12')],_0x56fd4f['message']?_0x56fd4f[_0x9793('0x13')]['id']:0x0,_0x56fd4f[_0x9793('0x14')]?_0x56fd4f[_0x9793('0x14')]['id']:0x0);if(_0x1b7b8a[_0x9793('0x11')][_0x2bb0c9]){_0x1b7b8a[_0x9793('0x11')][_0x2bb0c9]['emit']('end');if(rpc[_0x56fd4f[_0x9793('0x12')]+'QueueReport']){rpc[_0x56fd4f['channel']+_0x9793('0x42')][_0x9793('0x43')](_0x2bb0c9,{'UserId':_0x56fd4f['message'][_0x9793('0x44')]})[_0x9793('0x45')](function(){logger[_0x9793('0x3c')](_0x9793('0x46'));});}}return _0x511f35({'code':0xc8,'message':_0x56fd4f});}catch(_0x5703e9){logger[_0x9793('0x3c')](_0x5703e9[_0x9793('0x3d')]);return _0x6c8092(_0xe4171c[_0x9793('0x3c')](0x1f4,_0x5703e9));}}logger[_0x9793('0x3c')](_0x9793('0x47'));return _0x6c8092(_0xe4171c['error'](0x1f4,_0x9793('0x47')));});},'RejectMessage':function(_0x470992){var _0x260dae=this;return new Promise(function(_0xed9987,_0x4afaf0){if(_0x470992['agent']&&_0x470992[_0x9793('0x3f')]['id']){try{if(_0x1b7b8a[_0x9793('0x40')][_0x470992[_0x9793('0x3f')]['id']]){_0x1b7b8a['agents'][_0x470992['agent']['id']][_0x9793('0x41')]=![];_0x1b7b8a[_0x9793('0x40')][_0x470992[_0x9793('0x3f')]['id']][_0x9793('0x48')]=undefined;}return _0xed9987({'code':0xc8,'message':_0x470992});}catch(_0x562193){logger[_0x9793('0x3c')](_0x562193[_0x9793('0x3d')]);return _0x4afaf0(_0x260dae[_0x9793('0x3c')](0x1f4,_0x562193));}}logger[_0x9793('0x3c')]('message\x20is\x20empty');return _0x4afaf0(_0x260dae['error'](0x1f4,_0x9793('0x47')));});},'AbandonInteraction':function(_0x16e599){var _0x1a7974=this;return new Promise(function(_0x40c043,_0x4a8f6e){if(_0x16e599['channel']&&_0x16e599[_0x9793('0x14')]&&_0x16e599[_0x9793('0x14')]['id']){try{var _0x1ffe3d=getId(_0x16e599[_0x9793('0x12')],_0x16e599[_0x9793('0x13')]?_0x16e599[_0x9793('0x13')]['id']:0x0,_0x16e599[_0x9793('0x14')]?_0x16e599['interaction']['id']:0x0);if(_0x1b7b8a[_0x9793('0x11')][_0x1ffe3d]){_0x1b7b8a[_0x9793('0x11')][_0x1ffe3d]['emit'](_0x9793('0x49'));}return _0x40c043({'code':0xc8,'message':_0x16e599});}catch(_0x1b021e){logger[_0x9793('0x3c')](_0x1b021e[_0x9793('0x3d')]);return _0x4a8f6e(_0x1a7974[_0x9793('0x3c')](0x1f4,_0x1b021e));}}logger[_0x9793('0x3c')]('message\x20is\x20empty');return _0x4a8f6e(_0x1a7974[_0x9793('0x3c')](0x1f4,_0x9793('0x47')));});},'AgentCapacity':function(_0x7f0a6b){var _0x4041e6=this;return new Promise(function(_0x1ad4fd,_0x1834e6){if(_0x1b7b8a['agents'][_0x9793('0x4a')](_0x7f0a6b['id'])){for(var _0x25c455 in _0x7f0a6b['capacity']){if(_0x7f0a6b['capacity'][_0x9793('0x4a')](_0x25c455)){if(_0x1b7b8a['agents'][_0x7f0a6b['id']][_0x9793('0x4a')](_0x25c455+_0x9793('0x4b'))){_0x1b7b8a[_0x9793('0x40')][_0x7f0a6b['id']][_0x25c455+_0x9793('0x4b')]=parseInt(_0x7f0a6b[_0x9793('0x4c')][_0x25c455],0xa);}}}_0x1b7b8a[_0x9793('0x40')][_0x7f0a6b['id']][_0x9793('0x4d')]();return _0x1ad4fd({'code':0xc8,'message':_0x1b7b8a[_0x9793('0x40')][_0x7f0a6b['id']]});}else{return _0x1834e6(_0x4041e6[_0x9793('0x3c')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x58d308){return new Promise(function(_0x33322b){var _0x5a8824=_[_0x9793('0x4e')](_0x1b7b8a[_0x9793('0x40')]);if(_0x58d308&&_0x58d308['id']){var _0x8fb95c=_[_0x9793('0x4f')](_0x5a8824,function(_0x175ba3){return _0x175ba3['id']===_0x58d308['id'];});_0x33322b(_0x8fb95c);}else{_0x33322b({'count':_0x5a8824['length'],'rows':_0x5a8824});}});},'ChatQueues':function(){return new Promise(function(_0x23dccc){var _0x14208c=[];for(var _0x3d9e5b in _0x1b7b8a[_0x9793('0x50')]){if(_0x1b7b8a[_0x9793('0x50')][_0x9793('0x4a')](_0x3d9e5b)){var _0x278a19=_0x1b7b8a[_0x9793('0x50')][_0x3d9e5b];var _0x36e61d={'id':_0x278a19['id'],'available':_0x278a19[_0x9793('0x51')],'loggedIn':_0x278a19[_0x9793('0x52')],'name':_0x278a19['name'],'paused':_0x278a19[_0x9793('0x53')],'waiting':_0x278a19['waiting']};_0x14208c[_0x9793('0x1f')](_0x36e61d);}}_0x23dccc({'count':_0x14208c[_0x9793('0x17')],'rows':_0x14208c});});},'MailQueues':function(){return new Promise(function(_0x48c066){var _0x9f8611=[];for(var _0x46083e in _0x1b7b8a[_0x9793('0x54')]){if(_0x1b7b8a['mailQueues'][_0x9793('0x4a')](_0x46083e)){var _0x260060=_0x1b7b8a[_0x9793('0x54')][_0x46083e];var _0xfca06e={'id':_0x260060['id'],'available':_0x260060[_0x9793('0x51')],'loggedIn':_0x260060['loggedIn'],'name':_0x260060[_0x9793('0x55')],'paused':_0x260060[_0x9793('0x53')],'waiting':_0x260060['waiting']};_0x9f8611['push'](_0xfca06e);}}_0x48c066({'count':_0x9f8611[_0x9793('0x17')],'rows':_0x9f8611});});},'OpenchannelQueues':function(){return new Promise(function(_0x1a21c8){var _0x4f540b=[];for(var _0x5be589 in _0x1b7b8a[_0x9793('0x56')]){if(_0x1b7b8a[_0x9793('0x56')]['hasOwnProperty'](_0x5be589)){var _0xaf0712=_0x1b7b8a[_0x9793('0x56')][_0x5be589];var _0x33a834={'id':_0xaf0712['id'],'available':_0xaf0712[_0x9793('0x51')],'loggedIn':_0xaf0712[_0x9793('0x52')],'name':_0xaf0712['name'],'paused':_0xaf0712[_0x9793('0x53')],'waiting':_0xaf0712[_0x9793('0x57')]};_0x4f540b[_0x9793('0x1f')](_0x33a834);}}_0x1a21c8({'count':_0x4f540b[_0x9793('0x17')],'rows':_0x4f540b});});},'SmsQueues':function(){return new Promise(function(_0x54e938){var _0x20e6a2=[];for(var _0x57dfd2 in _0x1b7b8a[_0x9793('0x58')]){if(_0x1b7b8a[_0x9793('0x58')][_0x9793('0x4a')](_0x57dfd2)){var _0x380427=_0x1b7b8a[_0x9793('0x58')][_0x57dfd2];var _0x486709={'id':_0x380427['id'],'available':_0x380427[_0x9793('0x51')],'loggedIn':_0x380427[_0x9793('0x52')],'name':_0x380427[_0x9793('0x55')],'paused':_0x380427[_0x9793('0x53')],'waiting':_0x380427[_0x9793('0x57')]};_0x20e6a2['push'](_0x486709);}}_0x54e938({'count':_0x20e6a2[_0x9793('0x17')],'rows':_0x20e6a2});});},'FaxQueues':function(){return new Promise(function(_0x5495e4){var _0x43d502=[];for(var _0x322c03 in _0x1b7b8a[_0x9793('0x59')]){if(_0x1b7b8a[_0x9793('0x59')][_0x9793('0x4a')](_0x322c03)){var _0x5c7e0a=_0x1b7b8a[_0x9793('0x59')][_0x322c03];var _0x2343be={'id':_0x5c7e0a['id'],'available':_0x5c7e0a[_0x9793('0x51')],'loggedIn':_0x5c7e0a[_0x9793('0x52')],'name':_0x5c7e0a[_0x9793('0x55')],'paused':_0x5c7e0a[_0x9793('0x53')],'waiting':_0x5c7e0a[_0x9793('0x57')]};_0x43d502[_0x9793('0x1f')](_0x2343be);}}_0x5495e4({'count':_0x43d502[_0x9793('0x17')],'rows':_0x43d502});});},'WhatsappQueues':function(){return new Promise(function(_0x38b554){var _0x4f7d65=[];for(var _0x5d29d4 in _0x1b7b8a['whatsappQueues']){if(_0x1b7b8a[_0x9793('0x5a')][_0x9793('0x4a')](_0x5d29d4)){var _0x994eb0=_0x1b7b8a['whatsappQueues'][_0x5d29d4];var _0x43768f={'id':_0x994eb0['id'],'available':_0x994eb0['available'],'loggedIn':_0x994eb0[_0x9793('0x52')],'name':_0x994eb0[_0x9793('0x55')],'paused':_0x994eb0[_0x9793('0x53')],'waiting':_0x994eb0[_0x9793('0x57')]};_0x4f7d65['push'](_0x43768f);}}_0x38b554({'count':_0x4f7d65['length'],'rows':_0x4f7d65});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x189d5b){var _0x3e1244=_['values'](_0x1b7b8a['chatQueuesWaitingInteractions']);_0x189d5b({'count':_0x3e1244[_0x9793('0x17')],'rows':_0x3e1244});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1229c6){var _0x423eaa=_[_0x9793('0x4e')](_0x1b7b8a[_0x9793('0x5b')]);_0x1229c6({'count':_0x423eaa[_0x9793('0x17')],'rows':_0x423eaa});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3547db){var _0x4842a9=_[_0x9793('0x4e')](_0x1b7b8a[_0x9793('0x5c')]);_0x3547db({'count':_0x4842a9['length'],'rows':_0x4842a9});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xf4fdda){var _0x174afd=_[_0x9793('0x4e')](_0x1b7b8a[_0x9793('0x5d')]);_0xf4fdda({'count':_0x174afd[_0x9793('0x17')],'rows':_0x174afd});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xb20d96){var _0xadcabb=_[_0x9793('0x4e')](_0x1b7b8a[_0x9793('0x5e')]);_0xb20d96({'count':_0xadcabb['length'],'rows':_0xadcabb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x567815){var _0x323a13=_[_0x9793('0x4e')](_0x1b7b8a['whatsappQueuesWaitingInteractions']);_0x567815({'count':_0x323a13[_0x9793('0x17')],'rows':_0x323a13});});}};var _0x198243=jayson[_0x9793('0x5f')](_0x2467ae)['http']();_0x198243['on'](_0x9793('0x3c'),function(_0x1f57aa){logger[_0x9793('0x3c')](JSON['stringify'](_0x1f57aa));return _0x210588(_0x1f57aa);});_0x198243['listen'](0x232c,_0x9793('0x60'),function(){console['log'](_0x9793('0x61'),0x232c);return _0x377012(_0x9793('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 497f819..d06bf28 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 _0x4ced=['indexOf','true','[%s][INTERVAL]\x20%s','all','some','\x20|\x20','catch','[%s][INTERVAL]\x20%s\x20%s','join','stack','util','jayson/promise','routing','client','http','request','then','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ced,0xfa));var _0xd4ce=function(_0x2ab6d2,_0x32a99c){_0x2ab6d2=_0x2ab6d2-0x0;var _0x5c87fc=_0x4ced[_0x2ab6d2];return _0x5c87fc;};'use strict';var util=require(_0xd4ce('0x0'));var BPromise=require('bluebird');var jayson=require(_0xd4ce('0x1'));var _=require('lodash');var logger=require('../../../config/logger')(_0xd4ce('0x2'));var client=jayson[_0xd4ce('0x3')][_0xd4ce('0x4')]({'port':0x232a});function request(_0x29d1dd,_0x5245a2){return new BPromise(function(_0x2fcb4d,_0x2da552){return client[_0xd4ce('0x5')](_0x29d1dd,_0x5245a2)[_0xd4ce('0x6')](function(_0x3d2696){if(_0x3d2696[_0xd4ce('0x7')]){return _0x2da552(_0x3d2696[_0xd4ce('0x7')][_0xd4ce('0x8')]);}else{return _0x2fcb4d(_0x3d2696[_0xd4ce('0x9')]);}})['catch'](function(_0x4947b0){return _0x2da552(_0x4947b0);});});}exports[_0xd4ce('0xa')]=function(_0x2442fb,_0x22dac4,_0x51c85f){return function(_0x48d04f){if(_0x51c85f['rules']&&!_0x51c85f[_0xd4ce('0xb')][_0x2442fb]){logger[_0xd4ce('0xc')](_0xd4ce('0xd'),_0x2442fb);return _0x48d04f[_0xd4ce('0xe')]();}var _0x4f5449=[];for(var _0xde5aa8=0x0;_0xde5aa8<_0x22dac4[_0xd4ce('0xf')];_0xde5aa8+=0x1){_0x4f5449[_0xd4ce('0x10')](request(_0xd4ce('0x11'),{'command':util[_0xd4ce('0x12')](_0xd4ce('0x13'),_0x22dac4[_0xde5aa8])})['then'](function(_0x13f0f7){return _0x13f0f7&&_0x13f0f7[_0xd4ce('0x8')]&&_0x13f0f7[_0xd4ce('0x8')][_0xd4ce('0x14')](_0xd4ce('0x15'))>=0x0?!![]:![];})['catch'](function(){logger[_0xd4ce('0x7')](_0xd4ce('0x16'),_0x2442fb,_0x22dac4[_0xde5aa8]);}));}BPromise[_0xd4ce('0x17')](_0x4f5449)['then'](function(_0xd02649){var _0x6049ea=_[_0xd4ce('0x18')](_0xd02649);logger[_0xd4ce('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x2442fb,_0x22dac4['join'](_0xd4ce('0x19')),_0x6049ea);_0x48d04f['when'](_0x6049ea);})[_0xd4ce('0x1a')](function(_0x372740){logger[_0xd4ce('0x7')](_0xd4ce('0x1b'),_0x2442fb,_0x22dac4[_0xd4ce('0x1c')](_0xd4ce('0x19')),_0x372740[_0xd4ce('0x1d')]);_0x48d04f['stop']();});};}; \ No newline at end of file +var _0xd90b=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','format','iftime\x20%s','then','indexOf','true','catch','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','jayson/promise','lodash','../../../config/logger','client','http','request','error','message','result','condition'];(function(_0x581c4f,_0x58e1d4){var _0x4abb3b=function(_0x56d598){while(--_0x56d598){_0x581c4f['push'](_0x581c4f['shift']());}};_0x4abb3b(++_0x58e1d4);}(_0xd90b,0x161));var _0xbd90=function(_0x14aa05,_0x24c113){_0x14aa05=_0x14aa05-0x0;var _0x4d2f48=_0xd90b[_0x14aa05];return _0x4d2f48;};'use strict';var util=require(_0xbd90('0x0'));var BPromise=require('bluebird');var jayson=require(_0xbd90('0x1'));var _=require(_0xbd90('0x2'));var logger=require(_0xbd90('0x3'))('routing');var client=jayson[_0xbd90('0x4')][_0xbd90('0x5')]({'port':0x232a});function request(_0x4e1ace,_0x37d770){return new BPromise(function(_0x276d65,_0xca69d4){return client[_0xbd90('0x6')](_0x4e1ace,_0x37d770)['then'](function(_0x47bbff){if(_0x47bbff['error']){return _0xca69d4(_0x47bbff[_0xbd90('0x7')][_0xbd90('0x8')]);}else{return _0x276d65(_0x47bbff[_0xbd90('0x9')]);}})['catch'](function(_0x431ad4){return _0xca69d4(_0x431ad4);});});}exports[_0xbd90('0xa')]=function(_0x2e5a25,_0x33e6b9,_0x1fc040){return function(_0x480f96){if(_0x1fc040[_0xbd90('0xb')]&&!_0x1fc040[_0xbd90('0xb')][_0x2e5a25]){logger[_0xbd90('0xc')](_0xbd90('0xd'),_0x2e5a25);return _0x480f96[_0xbd90('0xe')]();}var _0x3b959b=[];for(var _0x13aca6=0x0;_0x13aca6<_0x33e6b9['length'];_0x13aca6+=0x1){_0x3b959b['push'](request('Command',{'command':util[_0xbd90('0xf')](_0xbd90('0x10'),_0x33e6b9[_0x13aca6])})[_0xbd90('0x11')](function(_0x4b913e){return _0x4b913e&&_0x4b913e[_0xbd90('0x8')]&&_0x4b913e[_0xbd90('0x8')][_0xbd90('0x12')](_0xbd90('0x13'))>=0x0?!![]:![];})[_0xbd90('0x14')](function(){logger[_0xbd90('0x7')]('[%s][INTERVAL]\x20%s',_0x2e5a25,_0x33e6b9[_0x13aca6]);}));}BPromise[_0xbd90('0x15')](_0x3b959b)['then'](function(_0x5088b0){var _0x4a6059=_['some'](_0x5088b0);logger[_0xbd90('0xc')](_0xbd90('0x16'),_0x2e5a25,_0x33e6b9[_0xbd90('0x17')](_0xbd90('0x18')),_0x4a6059);_0x480f96['when'](_0x4a6059);})[_0xbd90('0x14')](function(_0x5208ec){logger[_0xbd90('0x7')](_0xbd90('0x16'),_0x2e5a25,_0x33e6b9['join']('\x20|\x20'),_0x5208ec[_0xbd90('0x19')]);_0x480f96[_0xbd90('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 6e44c60..7b38a5e 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 _0xd4f4=['holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','agentconnectAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','transferexten','origtransfererexten','transfereeuniqueid','clone','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','isNil','ATTENDED','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','error','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','membername','agentringnoanswer','agentringnoanswerAt','reason','timeout'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x22537b,_0x438c90){_0x22537b=_0x22537b-0x0;var _0x1b9291=_0xd4f4[_0x22537b];return _0x1b9291;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var utils=require(_0x4d4f('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3c9311,_0x2fc384){utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x5'),_0x3c9311[_0x4d4f('0x6')],_0x3c9311[_0x4d4f('0x7')],_0x3c9311[_0x4d4f('0x8')],_0x3c9311['membername'],_0x3c9311['interface'],_0x3c9311['calleridnum'],_0x3c9311[_0x4d4f('0x9')],_0x3c9311[_0x4d4f('0xa')]));if(_0x3c9311[_0x4d4f('0x8')]){utils[_0x4d4f('0xb')](_0x3c9311[_0x4d4f('0x8')])[_0x4d4f('0xc')](function(_0x1bd887){if(_0x1bd887){_0x3c9311[_0x4d4f('0xd')]=_0x1bd887[_0x4d4f('0xd')];_0x3c9311[_0x4d4f('0xe')]=_0x3c9311[_0x4d4f('0xf')]?_0x1bd887[_0x4d4f('0x10')]:![];_0x3c9311[_0x4d4f('0x11')]=_0x3c9311[_0x4d4f('0xe')]?_0x1bd887[_0x4d4f('0x12')]:0x0;}utils[_0x4d4f('0x13')](_0x4d4f('0x14'),_0x3c9311);});}else{utils[_0x4d4f('0x13')]('CreateVoiceAgentReport',_0x3c9311);}if(_0x2fc384){delete transfers[_0x3c9311['uniqueid']];}else{delete agents[_0x3c9311['destuniqueid']];}}exports[_0x4d4f('0x15')]=function(_0xe9b7a6){try{utils['debug'](util[_0x4d4f('0x4')](_0x4d4f('0x16'),_0xe9b7a6[_0x4d4f('0x6')]),_0xe9b7a6);agents[_0xe9b7a6['destuniqueid']]=_0xe9b7a6;agents[_0xe9b7a6[_0x4d4f('0x17')]][_0x4d4f('0x18')]=utils[_0x4d4f('0x19')]();agents[_0xe9b7a6['destuniqueid']][_0x4d4f('0xa')]='called';agents[_0xe9b7a6[_0x4d4f('0x17')]][_0x4d4f('0x9')]=null;agents[_0xe9b7a6[_0x4d4f('0x17')]]['connectedlinename']=null;utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xe9b7a6['uniqueid'],agents[_0xe9b7a6['destuniqueid']]['membername'],_0xe9b7a6['destuniqueid']));}catch(_0x34429e){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')](_0x4d4f('0x16'),_0xe9b7a6['uniqueid']),_0x34429e);}};exports['agentringnoanswer']=function(_0x1e1ae2){try{if(!_['isNil'](agents[_0x1e1ae2[_0x4d4f('0x17')]])){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x1c'),_0x1e1ae2[_0x4d4f('0x6')]),_0x1e1ae2);utils['info'](util['format'](_0x4d4f('0x1d'),_0x1e1ae2['uniqueid'],agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x1e')],_0x1e1ae2[_0x4d4f('0x17')]));agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x1f')]=!![];agents[_0x1e1ae2['destuniqueid']][_0x4d4f('0x20')]=utils[_0x4d4f('0x19')]();agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0xa')]='timeout';agents[_0x1e1ae2['destuniqueid']][_0x4d4f('0x21')]=_0x4d4f('0x22');agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x23')]=_0x1e1ae2['ringtime']?parseInt(_0x1e1ae2[_0x4d4f('0x24')])/0x3e8:0x0;agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x25')]=0x0;unanswered[_0x4d4f('0x26')](_0x1e1ae2['destuniqueid']);}}catch(_0x338ba2){utils['error'](util[_0x4d4f('0x4')](_0x4d4f('0x1c'),_0x1e1ae2['uniqueid']),_0x338ba2);}};exports[_0x4d4f('0x27')]=function(_0x123383){try{_[_0x4d4f('0x28')](agents,function(_0x3d7f14,_0x19a502){if(_0x3d7f14[_0x4d4f('0x6')]==_0x123383['uniqueid']&&!_[_0x4d4f('0x29')](unanswered,_0x3d7f14[_0x4d4f('0x17')])){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x2a'),_0x123383['uniqueid']),_0x123383);utils[_0x4d4f('0x3')](util['format'](_0x4d4f('0x2b'),_0x123383['uniqueid'],_0x3d7f14['membername'],_0x3d7f14['destuniqueid']));_0x3d7f14[_0x4d4f('0x1f')]=!![];_0x3d7f14['agentringnoanswerAt']=utils[_0x4d4f('0x19')]();_0x3d7f14[_0x4d4f('0xa')]=_0x4d4f('0x2c');_0x3d7f14['reason']=_0x4d4f('0x2c');_0x3d7f14[_0x4d4f('0x23')]=_0x123383[_0x4d4f('0x23')];_0x3d7f14['talktime']=0x0;writeDB(_0x3d7f14);}});}catch(_0x6a30c4){utils['error'](util[_0x4d4f('0x4')](_0x4d4f('0x2a'),_0x123383[_0x4d4f('0x6')]),_0x6a30c4);}};exports[_0x4d4f('0x2d')]=function(_0x2448f3){try{if(agents[_0x2448f3[_0x4d4f('0x17')]]){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')]('[%s][agents][agentconnect]',_0x2448f3['uniqueid']),_0x2448f3);utils[_0x4d4f('0x3')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2448f3[_0x4d4f('0x6')],agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0x1e')],_0x2448f3[_0x4d4f('0x17')]));agents[_0x2448f3[_0x4d4f('0x17')]]['agentconnectAt']=utils[_0x4d4f('0x19')]();agents[_0x2448f3[_0x4d4f('0x17')]]['connectedlinenum']=_0x2448f3[_0x4d4f('0x9')];agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0x2e')]=_0x2448f3[_0x4d4f('0x2e')];agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0x23')]=_0x2448f3[_0x4d4f('0x24')];agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0xa')]='connect';_['forIn'](agents,function(_0x1cb919,_0x324a3c){if(_0x1cb919[_0x4d4f('0x17')]!=_0x2448f3[_0x4d4f('0x17')]&&_0x1cb919['uniqueid']==_0x2448f3['uniqueid']){_0x1cb919[_0x4d4f('0x25')]=0x0;_0x1cb919[_0x4d4f('0x23')]=_0x2448f3['ringtime'];_0x1cb919['agentringnoanswer']=!![];_0x1cb919[_0x4d4f('0x20')]=utils[_0x4d4f('0x19')]();_0x1cb919['lastevent']=_0x4d4f('0x2f');_0x1cb919[_0x4d4f('0x21')]=_0x4d4f('0x2f');_0x1cb919[_0x4d4f('0x30')]=_0x2448f3[_0x4d4f('0x17')];_0x1cb919['answeredelsewheremembername']=_0x2448f3[_0x4d4f('0x1e')];writeDB(_0x1cb919);}});}}catch(_0x4c7c24){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')]('[%s][agents][agentconnect]',_0x2448f3[_0x4d4f('0x6')]),_0x4c7c24);}};exports[_0x4d4f('0xf')]=function(_0x1f7169){try{if(!_['isNil'](agents[_0x1f7169[_0x4d4f('0x17')]])){utils['debug'](util[_0x4d4f('0x4')]('[%s][agents][agentcomplete]',_0x1f7169[_0x4d4f('0x6')]),_0x1f7169);utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x31'),_0x1f7169[_0x4d4f('0x6')],agents[_0x1f7169['destuniqueid']]['membername'],_0x1f7169[_0x4d4f('0x17')]));agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0xf')]=!![];agents[_0x1f7169[_0x4d4f('0x17')]]['agentcompleteAt']=utils['now']();agents[_0x1f7169['destuniqueid']][_0x4d4f('0x25')]=utils[_0x4d4f('0x32')](agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0x33')],agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0x34')]);agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0x21')]=_0x1f7169[_0x4d4f('0x21')];agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0xa')]=_0x4d4f('0x35');writeDB(agents[_0x1f7169['destuniqueid']]);}}catch(_0xb0937d){utils[_0x4d4f('0x1a')](util['format'](_0x4d4f('0x36'),_0x1f7169['uniqueid']),_0xb0937d);}};exports[_0x4d4f('0x37')]=function(_0x401466){try{if(!_['isNil'](agents[_0x401466[_0x4d4f('0x38')]])){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x39'),_0x401466[_0x4d4f('0x6')]),_0x401466);utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x3a'),_0x401466[_0x4d4f('0x6')],agents[_0x401466[_0x4d4f('0x38')]][_0x4d4f('0x1e')],agents[_0x401466[_0x4d4f('0x38')]]['uniqueid']));agents[_0x401466[_0x4d4f('0x38')]]['transfer']=!![];agents[_0x401466['transfereruniqueid']]['transfertype']=_0x4d4f('0x3b');agents[_0x401466[_0x4d4f('0x38')]]['transferexten']=_0x401466['extension'];agents[_0x401466[_0x4d4f('0x38')]][_0x4d4f('0x3c')]=agents[_0x401466['transfereruniqueid']][_0x4d4f('0x6')];}}catch(_0x528573){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')](_0x4d4f('0x39'),_0x401466[_0x4d4f('0x6')]),_0x528573);}};exports['attendedtransfer']=function(_0x224b83){try{utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x3d'),_0x224b83[_0x4d4f('0x3e')]),_0x224b83);if(_0x224b83['origtransfereruniqueid']==_0x224b83[_0x4d4f('0x3f')]){if(!_['isNil'](agents[_0x224b83[_0x4d4f('0x40')]])){utils['info'](util[_0x4d4f('0x4')](_0x4d4f('0x41'),_0x224b83['origtransfereruniqueid'],agents[_0x224b83[_0x4d4f('0x40')]][_0x4d4f('0x1e')]));agents[_0x224b83['secondtransfereruniqueid']][_0x4d4f('0x42')]=!![];agents[_0x224b83['secondtransfereruniqueid']][_0x4d4f('0x43')]='ATTENDED';agents[_0x224b83['secondtransfereruniqueid']][_0x4d4f('0x44')]=_0x224b83[_0x4d4f('0x45')];agents[_0x224b83[_0x4d4f('0x40')]][_0x4d4f('0x3c')]=_0x224b83[_0x4d4f('0x3e')];}if(_0x224b83['transfereeuniqueid']&&agents[_0x224b83['transfereeuniqueid']]){agents[_0x224b83[_0x4d4f('0x46')]]['agententerreason']=0x1;transfers[_0x224b83[_0x4d4f('0x46')]]=_[_0x4d4f('0x47')](agents[_0x224b83[_0x4d4f('0x46')]]);transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x48')]=agents[_0x224b83[_0x4d4f('0x40')]]['calleridnum'];transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x49')]=agents[_0x224b83[_0x4d4f('0x40')]]['calleridname'];transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x18')]=utils[_0x4d4f('0x19')]();transfers[_0x224b83['transfereeuniqueid']][_0x4d4f('0x34')]=utils['now']();transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x23')]=0x0;transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x4a')]=0x2;}}else if(_0x224b83[_0x4d4f('0x40')]==_0x224b83[_0x4d4f('0x4b')]){if(!_[_0x4d4f('0x4c')](agents[_0x224b83[_0x4d4f('0x3e')]])){utils[_0x4d4f('0x3')](util['format'](_0x4d4f('0x41'),_0x224b83[_0x4d4f('0x3e')],agents[_0x224b83['origtransfereruniqueid']][_0x4d4f('0x1e')]));agents[_0x224b83[_0x4d4f('0x3e')]][_0x4d4f('0x42')]=!![];agents[_0x224b83[_0x4d4f('0x3e')]]['transfertype']=_0x4d4f('0x4d');agents[_0x224b83[_0x4d4f('0x3e')]]['transferexten']=_0x224b83['secondtransfererexten'];agents[_0x224b83[_0x4d4f('0x3e')]][_0x4d4f('0x3c')]=_0x224b83['secondtransfereruniqueid'];}if(_0x224b83['transfertargetuniqueid']&&agents[_0x224b83['transfertargetuniqueid']]){agents[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x4a')]=0x1;transfers[_0x224b83['transfertargetuniqueid']]=_[_0x4d4f('0x47')](agents[_0x224b83[_0x4d4f('0x4e')]]);transfers[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x48')]=agents[_0x224b83[_0x4d4f('0x3e')]][_0x4d4f('0x48')];transfers[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x49')]=agents[_0x224b83['origtransfereruniqueid']][_0x4d4f('0x49')];transfers[_0x224b83['transfertargetuniqueid']][_0x4d4f('0x18')]=utils[_0x4d4f('0x19')]();transfers[_0x224b83[_0x4d4f('0x4e')]]['agentconnectAt']=utils[_0x4d4f('0x19')]();transfers[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x23')]=0x0;transfers[_0x224b83[_0x4d4f('0x4e')]]['agententerreason']=0x2;}}}catch(_0x4184fa){utils['error'](util[_0x4d4f('0x4')]('[%s][agents][attendedtransfer]',_0x224b83['origtransfereruniqueid']),_0x4184fa);}};exports[_0x4d4f('0x4f')]=function(_0x2d99e4){try{utils['debug'](util[_0x4d4f('0x4')]('[%s][agents][hangup]',_0x2d99e4[_0x4d4f('0x6')]),_0x2d99e4);if(agents[_0x2d99e4[_0x4d4f('0x6')]]&&agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x21')]==='timeout'){if(_0x2d99e4[_0x4d4f('0x50')]==='21'){agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x21')]='rejected';agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]=_0x4d4f('0x51');}utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x52'),_0x2d99e4['uniqueid'],agents[_0x2d99e4['uniqueid']][_0x4d4f('0x1e')],agents[_0x2d99e4[_0x4d4f('0x6')]]['reason'],agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]));writeDB(agents[_0x2d99e4[_0x4d4f('0x6')]]);var _0x133fc5=unanswered[_0x4d4f('0x53')](_0x2d99e4[_0x4d4f('0x6')]);if(_0x133fc5>-0x1){unanswered[_0x4d4f('0x54')](_0x133fc5,0x1);}}if(transfers[_0x2d99e4[_0x4d4f('0x6')]]){transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xf')]=!![];transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')]=utils[_0x4d4f('0x19')]();transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x25')]=utils['diffTime'](transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')],transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x34')]);transfers[_0x2d99e4['uniqueid']]['reason']=_0x4d4f('0x55');transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]=_0x4d4f('0x35');utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x52'),_0x2d99e4[_0x4d4f('0x6')],transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x1e')],transfers[_0x2d99e4['uniqueid']][_0x4d4f('0x21')],transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]));writeDB(transfers[_0x2d99e4[_0x4d4f('0x6')]],!![]);}if(agents[_0x2d99e4['uniqueid']]&&agents[_0x2d99e4['uniqueid']]['agentconnectAt']){agents[_0x2d99e4[_0x4d4f('0x6')]]['agentcomplete']=!![];agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')]=utils[_0x4d4f('0x19')]();agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x25')]=utils[_0x4d4f('0x32')](agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')],agents[_0x2d99e4['uniqueid']]['agentconnectAt']);agents[_0x2d99e4[_0x4d4f('0x6')]]['reason']=agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x42')]?_0x4d4f('0x42'):'agent';agents[_0x2d99e4['uniqueid']]['lastevent']=_0x4d4f('0x35');utils['info'](util[_0x4d4f('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2d99e4[_0x4d4f('0x6')],agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x1e')],agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x21')],agents[_0x2d99e4[_0x4d4f('0x6')]]['lastevent']));writeDB(agents[_0x2d99e4[_0x4d4f('0x6')]]);}}catch(_0x3beacf){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')](_0x4d4f('0x56'),_0x2d99e4['uniqueid']),_0x3beacf);}}; \ No newline at end of file +var _0xbaf0=['includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','[%s][agents][hangup]','util','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinename','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','forIn'];(function(_0x706091,_0x5e07d9){var _0x4aee6f=function(_0xf8d0f6){while(--_0xf8d0f6){_0x706091['push'](_0x706091['shift']());}};_0x4aee6f(++_0x5e07d9);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var utils=require(_0x0baf('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e212d,_0x263f79){utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1e212d[_0x0baf('0x4')],_0x1e212d[_0x0baf('0x5')],_0x1e212d[_0x0baf('0x6')],_0x1e212d[_0x0baf('0x7')],_0x1e212d[_0x0baf('0x8')],_0x1e212d[_0x0baf('0x9')],_0x1e212d[_0x0baf('0xa')],_0x1e212d[_0x0baf('0xb')]));if(_0x1e212d[_0x0baf('0x6')]){utils['getVoiceQueueByName'](_0x1e212d[_0x0baf('0x6')])['then'](function(_0x4605c3){if(_0x4605c3){_0x1e212d[_0x0baf('0xc')]=_0x4605c3[_0x0baf('0xc')];_0x1e212d[_0x0baf('0xd')]=_0x1e212d[_0x0baf('0xe')]?_0x4605c3[_0x0baf('0xf')]:![];_0x1e212d[_0x0baf('0x10')]=_0x1e212d[_0x0baf('0xd')]?_0x4605c3[_0x0baf('0x11')]:0x0;}utils[_0x0baf('0x12')](_0x0baf('0x13'),_0x1e212d);});}else{utils['request']('CreateVoiceAgentReport',_0x1e212d);}if(_0x263f79){delete transfers[_0x1e212d[_0x0baf('0x4')]];}else{delete agents[_0x1e212d[_0x0baf('0x14')]];}}exports[_0x0baf('0x15')]=function(_0x13df17){try{utils['debug'](util[_0x0baf('0x3')]('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x13df17);agents[_0x13df17[_0x0baf('0x14')]]=_0x13df17;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();agents[_0x13df17[_0x0baf('0x14')]]['lastevent']='called';agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0xa')]=null;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x18')]=null;utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x13df17[_0x0baf('0x4')],agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x7')],_0x13df17[_0x0baf('0x14')]));}catch(_0x47070d){utils[_0x0baf('0x19')](util['format']('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x47070d);}};exports[_0x0baf('0x1a')]=function(_0x32e839){try{if(!_[_0x0baf('0x1b')](agents[_0x32e839[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0x32e839);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x1e'),_0x32e839['uniqueid'],agents[_0x32e839[_0x0baf('0x14')]]['membername'],_0x32e839['destuniqueid']));agents[_0x32e839[_0x0baf('0x14')]]['agentringnoanswer']=!![];agents[_0x32e839['destuniqueid']][_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x20');agents[_0x32e839['destuniqueid']][_0x0baf('0x21')]=_0x0baf('0x20');agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x32e839[_0x0baf('0x23')]?parseInt(_0x32e839[_0x0baf('0x23')])/0x3e8:0x0;agents[_0x32e839[_0x0baf('0x14')]]['talktime']=0x0;unanswered[_0x0baf('0x24')](_0x32e839[_0x0baf('0x14')]);}}catch(_0xcaf13d){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0xcaf13d);}};exports['queuecallerabandon']=function(_0x44ec31){try{_[_0x0baf('0x25')](agents,function(_0x478ce8,_0xb4dbb1){if(_0x478ce8[_0x0baf('0x4')]==_0x44ec31[_0x0baf('0x4')]&&!_[_0x0baf('0x26')](unanswered,_0x478ce8['destuniqueid'])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31[_0x0baf('0x4')]),_0x44ec31);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x28'),_0x44ec31[_0x0baf('0x4')],_0x478ce8[_0x0baf('0x7')],_0x478ce8[_0x0baf('0x14')]));_0x478ce8[_0x0baf('0x1a')]=!![];_0x478ce8[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x478ce8[_0x0baf('0xb')]='abandoned';_0x478ce8[_0x0baf('0x21')]='abandoned';_0x478ce8[_0x0baf('0x22')]=_0x44ec31[_0x0baf('0x22')];_0x478ce8[_0x0baf('0x29')]=0x0;writeDB(_0x478ce8);}});}catch(_0x3d65f2){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31['uniqueid']),_0x3d65f2);}};exports[_0x0baf('0x2a')]=function(_0x2447c2){try{if(agents[_0x2447c2[_0x0baf('0x14')]]){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x2447c2);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x2c'),_0x2447c2[_0x0baf('0x4')],agents[_0x2447c2['destuniqueid']][_0x0baf('0x7')],_0x2447c2['destuniqueid']));agents[_0x2447c2['destuniqueid']][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();agents[_0x2447c2['destuniqueid']]['connectedlinenum']=_0x2447c2[_0x0baf('0xa')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x18')]=_0x2447c2[_0x0baf('0x18')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x2e');_[_0x0baf('0x25')](agents,function(_0x148540,_0x354cb1){if(_0x148540[_0x0baf('0x14')]!=_0x2447c2['destuniqueid']&&_0x148540[_0x0baf('0x4')]==_0x2447c2[_0x0baf('0x4')]){_0x148540['talktime']=0x0;_0x148540[_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];_0x148540[_0x0baf('0x1a')]=!![];_0x148540[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x148540[_0x0baf('0xb')]='answered_elsewhere';_0x148540[_0x0baf('0x21')]=_0x0baf('0x2f');_0x148540['answeredelsewheredestinationuniqueid']=_0x2447c2[_0x0baf('0x14')];_0x148540[_0x0baf('0x30')]=_0x2447c2[_0x0baf('0x7')];writeDB(_0x148540);}});}}catch(_0x57903e){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x57903e);}};exports[_0x0baf('0xe')]=function(_0x2b6d54){try{if(!_[_0x0baf('0x1b')](agents[_0x2b6d54[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54['uniqueid']),_0x2b6d54);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x32'),_0x2b6d54[_0x0baf('0x4')],agents[_0x2b6d54[_0x0baf('0x14')]]['membername'],_0x2b6d54[_0x0baf('0x14')]));agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0xe')]=!![];agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')]=utils['now']();agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')],agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x2d')]);agents[_0x2b6d54['destuniqueid']][_0x0baf('0x21')]=_0x2b6d54[_0x0baf('0x21')];agents[_0x2b6d54[_0x0baf('0x14')]]['lastevent']=_0x0baf('0x35');writeDB(agents[_0x2b6d54[_0x0baf('0x14')]]);}}catch(_0x10fa62){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54[_0x0baf('0x4')]),_0x10fa62);}};exports['blindtransfer']=function(_0x22c451){try{if(!_[_0x0baf('0x1b')](agents[_0x22c451[_0x0baf('0x36')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x37'),_0x22c451[_0x0baf('0x4')]),_0x22c451);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x38'),_0x22c451[_0x0baf('0x4')],agents[_0x22c451['transfereruniqueid']]['membername'],agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')]));agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x39')]=!![];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3a')]=_0x0baf('0x3b');agents[_0x22c451['transfereruniqueid']][_0x0baf('0x3c')]=_0x22c451[_0x0baf('0x3d')];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3e')]=agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')];}}catch(_0x5e1849){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x37'),_0x22c451['uniqueid']),_0x5e1849);}};exports[_0x0baf('0x3f')]=function(_0x5eaeb2){try{utils[_0x0baf('0x1c')](util['format'](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5eaeb2);if(_0x5eaeb2[_0x0baf('0x41')]==_0x5eaeb2[_0x0baf('0x42')]){if(!_[_0x0baf('0x1b')](agents[_0x5eaeb2['secondtransfereruniqueid']])){utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x43'),_0x5eaeb2[_0x0baf('0x41')],agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x7')]));agents[_0x5eaeb2['secondtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3a')]=_0x0baf('0x45');agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x46')];agents[_0x5eaeb2['secondtransfereruniqueid']]['transferuniqueid']=_0x5eaeb2[_0x0baf('0x41')];}if(_0x5eaeb2[_0x0baf('0x47')]&&agents[_0x5eaeb2[_0x0baf('0x47')]]){agents[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x1;transfers[_0x5eaeb2[_0x0baf('0x47')]]=_[_0x0baf('0x49')](agents[_0x5eaeb2[_0x0baf('0x47')]]);transfers[_0x5eaeb2[_0x0baf('0x47')]]['calleridnum']=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x4a')];transfers[_0x5eaeb2[_0x0baf('0x47')]]['agentcalledAt']=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x2;}}else if(_0x5eaeb2['secondtransfereruniqueid']==_0x5eaeb2[_0x0baf('0x4b')]){if(!_['isNil'](agents[_0x5eaeb2[_0x0baf('0x41')]])){utils['info'](util['format'](_0x0baf('0x43'),_0x5eaeb2['origtransfereruniqueid'],agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x7')]));agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3a')]='ATTENDED';agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x4c')];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3e')]=_0x5eaeb2[_0x0baf('0x44')];}if(_0x5eaeb2['transfertargetuniqueid']&&agents[_0x5eaeb2[_0x0baf('0x4d')]]){agents[_0x5eaeb2['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x5eaeb2['transfertargetuniqueid']]=_[_0x0baf('0x49')](agents[_0x5eaeb2['transfertargetuniqueid']]);transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x9')]=agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x41')]]['calleridname'];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x48')]=0x2;}}}catch(_0x5d4053){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5d4053);}};exports[_0x0baf('0x4e')]=function(_0x27a959){try{utils[_0x0baf('0x1c')](util['format']('[%s][agents][hangup]',_0x27a959['uniqueid']),_0x27a959);if(agents[_0x27a959[_0x0baf('0x4')]]&&agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]===_0x0baf('0x20')){if(_0x27a959[_0x0baf('0x4f')]==='21'){agents[_0x27a959[_0x0baf('0x4')]]['reason']='rejected';agents[_0x27a959[_0x0baf('0x4')]]['lastevent']=_0x0baf('0x50');}utils[_0x0baf('0x2')](util['format'](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);var _0x5ea0f3=unanswered['indexOf'](_0x27a959['uniqueid']);if(_0x5ea0f3>-0x1){unanswered['splice'](_0x5ea0f3,0x1);}}if(transfers[_0x27a959['uniqueid']]){transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xe')]=!![];transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils['now']();transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x29')]=utils['diffTime'](transfers[_0x27a959['uniqueid']][_0x0baf('0x33')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x2d')]);transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=_0x0baf('0x52');transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27a959[_0x0baf('0x4')],transfers[_0x27a959[_0x0baf('0x4')]]['membername'],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(transfers[_0x27a959[_0x0baf('0x4')]],!![]);}if(agents[_0x27a959['uniqueid']]&&agents[_0x27a959['uniqueid']][_0x0baf('0x2d')]){agents[_0x27a959[_0x0baf('0x4')]]['agentcomplete']=!![];agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils[_0x0baf('0x17')]();agents[_0x27a959['uniqueid']][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x27a959[_0x0baf('0x4')]]['agentcompleteAt'],agents[_0x27a959[_0x0baf('0x4')]]['agentconnectAt']);agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x39')]?_0x0baf('0x39'):'agent';agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);}}catch(_0x2c2f09){utils['error'](util['format'](_0x0baf('0x53'),_0x27a959[_0x0baf('0x4')]),_0x2c2f09);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c5b88ca..61e1a5f 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 _0xb459=['ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','channel','isNil','systemanswertime','transfer','destinationchannel','disposition','toNumber','callerid','calleridname','cause-txt','duration','diffTime','endtime','starttime','answertime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','queue','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','application','appdata','toLowerCase','startsWith','lastIndexOf','noop','execif','lastapplication','lastdata','[%s][calls][newexten]','lodash','./utils','FAILED','NO\x20ANSWER'];(function(_0x8b639,_0x25b9eb){var _0x41a1f7=function(_0x3bab41){while(--_0x3bab41){_0x8b639['push'](_0x8b639['shift']());}};_0x41a1f7(++_0x25b9eb);}(_0xb459,0x1eb));var _0x9b45=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0xb459[_0x5a7f64];return _0x3d30f1;};'use strict';var _=require(_0x9b45('0x0'));var util=require('util');var utils=require(_0x9b45('0x1'));var dispositions=['NO\x20ANSWER',_0x9b45('0x2'),_0x9b45('0x2'),_0x9b45('0x3'),_0x9b45('0x3'),'NO\x20ANSWER',_0x9b45('0x4'),_0x9b45('0x5'),_0x9b45('0x2'),_0x9b45('0x2'),'FAILED'];var channels={};function writeDB(_0x29b268){utils[_0x9b45('0x6')](util[_0x9b45('0x7')](_0x9b45('0x8'),_0x29b268[_0x9b45('0x9')],_0x29b268['channel'],_0x29b268['queue'],_0x29b268[_0x9b45('0xa')],_0x29b268[_0x9b45('0xb')],_0x29b268[_0x9b45('0xc')],_0x29b268['connectedlinenum'],_0x29b268[_0x9b45('0xd')]));if(_0x29b268[_0x9b45('0xe')]){utils[_0x9b45('0xf')](_0x29b268[_0x9b45('0xe')])[_0x9b45('0x10')](function(_0x2be9ac){if(_0x2be9ac){_0x29b268['UserId']=_0x2be9ac['id'];}utils[_0x9b45('0x11')](_0x9b45('0x12'),_0x29b268);});}else{utils[_0x9b45('0x11')](_0x9b45('0x12'),_0x29b268);}if(channels[_0x29b268[_0x9b45('0x9')]]){delete channels[_0x29b268[_0x9b45('0x9')]];}}exports[_0x9b45('0x13')]=function(_0x4206f2){try{utils[_0x9b45('0x14')](util['format']('[%s][calls][newchannel]',_0x4206f2['uniqueid']),_0x4206f2);if(_0x4206f2[_0x9b45('0x9')]==_0x4206f2[_0x9b45('0x15')]&&_0x4206f2['channel']!='OutgoingSpoolFailed'){utils[_0x9b45('0x6')](util['format'](_0x9b45('0x16'),_0x4206f2[_0x9b45('0x9')],_0x4206f2[_0x9b45('0x17')],_0x4206f2['exten']));channels[_0x4206f2[_0x9b45('0x9')]]={'uniqueid':_0x4206f2[_0x9b45('0x9')],'accountcode':_0x4206f2[_0x9b45('0xe')],'source':_0x4206f2[_0x9b45('0xc')],'destination':_0x4206f2[_0x9b45('0x18')],'destinationcontext':_0x4206f2[_0x9b45('0x17')],'channel':_0x4206f2['channel'],'starttime':utils[_0x9b45('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9b45('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x1b5d8a){utils[_0x9b45('0x1a')](util[_0x9b45('0x7')](_0x9b45('0x1b'),_0x4206f2[_0x9b45('0x9')]),_0x1b5d8a);}};exports[_0x9b45('0x1c')]=function(_0x1cede1){try{utils[_0x9b45('0x14')](util[_0x9b45('0x7')](_0x9b45('0x1d'),_0x1cede1[_0x9b45('0x9')]),_0x1cede1);if(!_['isNil'](channels[_0x1cede1[_0x9b45('0x9')]])&&_0x1cede1[_0x9b45('0x1e')]==0x6){utils[_0x9b45('0x6')](util[_0x9b45('0x7')](_0x9b45('0x1f'),_0x1cede1[_0x9b45('0x9')],_0x1cede1[_0x9b45('0x17')],_0x1cede1[_0x9b45('0x20')]));if(_[_0x9b45('0x21')](channels[_0x1cede1[_0x9b45('0x9')]][_0x9b45('0x22')])){channels[_0x1cede1[_0x9b45('0x9')]][_0x9b45('0x22')]=utils['now']();}}else if(!_[_0x9b45('0x21')](channels[_0x1cede1['linkedid']])&&_0x1cede1[_0x9b45('0x1e')]==0x6&&_0x1cede1['context']!=_0x9b45('0x23')){utils['info'](util[_0x9b45('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1cede1['uniqueid'],_0x1cede1['linkedid'],_0x1cede1[_0x9b45('0x17')],_0x1cede1[_0x9b45('0x20')]));channels[_0x1cede1['linkedid']][_0x9b45('0xe')]=_0x1cede1[_0x9b45('0xe')];channels[_0x1cede1[_0x9b45('0x15')]][_0x9b45('0x24')]=_0x1cede1['channel'];if(_['isNil'](channels[_0x1cede1[_0x9b45('0x15')]]['answertime'])){channels[_0x1cede1[_0x9b45('0x15')]]['answertime']=utils[_0x9b45('0x19')]();}channels[_0x1cede1['linkedid']][_0x9b45('0x25')]=dispositions[_[_0x9b45('0x26')](_0x1cede1[_0x9b45('0x1e')])]||_0x9b45('0x4');}}catch(_0x51afd6){utils[_0x9b45('0x1a')](util[_0x9b45('0x7')](_0x9b45('0x1d'),_0x1cede1[_0x9b45('0x9')]),_0x51afd6);}};exports['hangup']=function(_0x15b1a9){try{if(!_[_0x9b45('0x21')](channels[_0x15b1a9[_0x9b45('0x9')]])){utils['debug'](util[_0x9b45('0x7')]('[%s][calls][hangup]',_0x15b1a9[_0x9b45('0x9')]),_0x15b1a9);if(_[_0x9b45('0x21')](channels[_0x15b1a9[_0x9b45('0x9')]][_0x9b45('0x27')])){channels[_0x15b1a9['uniqueid']][_0x9b45('0x27')]=_0x15b1a9[_0x9b45('0x28')]+'\x20<'+_0x15b1a9[_0x9b45('0xc')]+'>';}utils[_0x9b45('0x6')](util[_0x9b45('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x15b1a9['uniqueid'],channels[_0x15b1a9[_0x9b45('0x9')]][_0x9b45('0x27')],_0x15b1a9[_0x9b45('0x29')]));channels[_0x15b1a9[_0x9b45('0x9')]]['endtime']=utils[_0x9b45('0x19')]();channels[_0x15b1a9[_0x9b45('0x9')]][_0x9b45('0x2a')]=utils[_0x9b45('0x2b')](channels[_0x15b1a9['uniqueid']][_0x9b45('0x2c')],channels[_0x15b1a9[_0x9b45('0x9')]][_0x9b45('0x2d')]);channels[_0x15b1a9[_0x9b45('0x9')]]['billableseconds']=channels[_0x15b1a9[_0x9b45('0x9')]][_0x9b45('0x2e')]?utils[_0x9b45('0x2b')](channels[_0x15b1a9[_0x9b45('0x9')]]['endtime'],channels[_0x15b1a9['uniqueid']][_0x9b45('0x2e')]):0x0;writeDB(channels[_0x15b1a9['uniqueid']]);}}catch(_0x389226){utils['error'](util['format'](_0x9b45('0x2f'),_0x15b1a9[_0x9b45('0x9')]),_0x389226);}};exports[_0x9b45('0x30')]=function(_0x207682){try{if(!_['isNil'](channels[_0x207682[_0x9b45('0x31')]])){utils['debug'](util['format'](_0x9b45('0x32'),_0x207682['origtransfereruniqueid']),_0x207682);if(channels[_0x207682[_0x9b45('0x31')]][_0x9b45('0x20')]==_0x207682['transfereechannel']){utils[_0x9b45('0x6')](util[_0x9b45('0x7')](_0x9b45('0x33'),_0x207682[_0x9b45('0x34')],_0x207682['localtwolinkedid'],_0x207682[_0x9b45('0x35')]));channels[_0x207682[_0x9b45('0x31')]][_0x9b45('0x24')]=_0x207682[_0x9b45('0x35')];channels[_0x207682[_0x9b45('0x31')]][_0x9b45('0x36')]=_0x9b45('0x37');}else if(channels[_0x207682[_0x9b45('0x31')]]['channel']=_0x207682['transfertargetchannel']){utils[_0x9b45('0x6')](util[_0x9b45('0x7')](_0x9b45('0x33'),_0x207682[_0x9b45('0x34')],_0x207682[_0x9b45('0x31')],_0x207682[_0x9b45('0x38')]));channels[_0x207682['localtwolinkedid']][_0x9b45('0x24')]=_0x207682[_0x9b45('0x38')];channels[_0x207682[_0x9b45('0x31')]]['userfield']=_0x9b45('0x37');}}}catch(_0x234398){utils[_0x9b45('0x1a')](util[_0x9b45('0x7')](_0x9b45('0x32'),_0x207682[_0x9b45('0x34')]),_0x234398);}};exports[_0x9b45('0x39')]=function(_0xe25733){try{if(!_[_0x9b45('0x21')](channels[_0xe25733[_0x9b45('0x9')]])){utils['debug'](util[_0x9b45('0x7')](_0x9b45('0x3a'),_0xe25733[_0x9b45('0x9')]),_0xe25733);channels[_0xe25733[_0x9b45('0x9')]]['musiconholdstartAt']=utils[_0x9b45('0x19')]();utils[_0x9b45('0x6')](util[_0x9b45('0x7')](_0x9b45('0x3b'),_0xe25733[_0x9b45('0x9')],channels[_0xe25733[_0x9b45('0x9')]][_0x9b45('0x3c')]));}}catch(_0x424f6f){utils[_0x9b45('0x1a')](util[_0x9b45('0x7')](_0x9b45('0x3a'),_0xe25733[_0x9b45('0x9')]),_0x424f6f);}};exports[_0x9b45('0x3d')]=function(_0x100508){try{if(!_['isNil'](channels[_0x100508['uniqueid']])){utils['debug'](util[_0x9b45('0x7')](_0x9b45('0x3e'),_0x100508[_0x9b45('0x9')]),_0x100508);if(!_[_0x9b45('0x21')](channels[_0x100508[_0x9b45('0x9')]]['musiconholdstartAt'])){channels[_0x100508['uniqueid']][_0x9b45('0x3f')]+=utils[_0x9b45('0x2b')](utils['now'](),channels[_0x100508['uniqueid']][_0x9b45('0x3c')]);utils[_0x9b45('0x6')](util[_0x9b45('0x7')](_0x9b45('0x40'),_0x100508[_0x9b45('0x9')],channels[_0x100508[_0x9b45('0x9')]]['mohtime']));delete channels[_0x100508[_0x9b45('0x9')]][_0x9b45('0x3c')];}}}catch(_0x2839d3){utils[_0x9b45('0x1a')](util[_0x9b45('0x7')](_0x9b45('0x3e'),_0x100508['uniqueid']),_0x2839d3);}};exports[_0x9b45('0x41')]=function(_0xaa3acd){try{if(!_[_0x9b45('0x21')](channels[_0xaa3acd[_0x9b45('0x9')]])){utils[_0x9b45('0x14')](util[_0x9b45('0x7')](_0x9b45('0x42'),_0xaa3acd[_0x9b45('0x9')]),_0xaa3acd);if(!_[_0x9b45('0x21')](_0xaa3acd['variable'][_0x9b45('0x43')])){utils['info'](util['format'](_0x9b45('0x44'),_0xaa3acd[_0x9b45('0x9')],_0xaa3acd[_0x9b45('0x45')]));channels[_0xaa3acd[_0x9b45('0x9')]][_0x9b45('0x46')]=_0xaa3acd['value'];}if(!_[_0x9b45('0x21')](_0xaa3acd[_0x9b45('0x47')]['xmd-phone'])){utils['info'](util['format'](_0x9b45('0x48'),_0xaa3acd[_0x9b45('0x9')],_0xaa3acd['value']));channels[_0xaa3acd[_0x9b45('0x9')]][_0x9b45('0x49')]=_0xaa3acd['value'];channels[_0xaa3acd[_0x9b45('0x9')]][_0x9b45('0x27')]='\x22'+_0xaa3acd[_0x9b45('0x45')]+_0x9b45('0x4a')+_0xaa3acd['value']+'>';}if(!_[_0x9b45('0x21')](_0xaa3acd['variable'][_0x9b45('0x4b')])||!_['isNil'](_0xaa3acd[_0x9b45('0x47')][_0x9b45('0x4c')])){utils['info'](util[_0x9b45('0x7')](_0x9b45('0x4d'),_0xaa3acd[_0x9b45('0x9')],!_['isNil'](_0xaa3acd[_0x9b45('0x47')][_0x9b45('0x4b')])?_0x9b45('0x4b'):_0x9b45('0x4c'),_0xaa3acd[_0x9b45('0x45')]));channels[_0xaa3acd[_0x9b45('0x9')]][_0x9b45('0x27')]=_0xaa3acd[_0x9b45('0x45')];}if(!_[_0x9b45('0x21')](_0xaa3acd['variable'][_0x9b45('0x4e')])||!_[_0x9b45('0x21')](_0xaa3acd[_0x9b45('0x47')][_0x9b45('0x4f')])){utils[_0x9b45('0x6')](util['format'](_0x9b45('0x4d'),_0xaa3acd[_0x9b45('0x9')],!_[_0x9b45('0x21')](_0xaa3acd[_0x9b45('0x47')][_0x9b45('0x4e')])?_0x9b45('0x4e'):_0x9b45('0x4f'),_0xaa3acd[_0x9b45('0x45')]));channels[_0xaa3acd['uniqueid']]['lastapplication']=_0x9b45('0x50');channels[_0xaa3acd[_0x9b45('0x9')]]['lastdata']=_0xaa3acd['value'];channels[_0xaa3acd[_0x9b45('0x9')]][_0x9b45('0x51')]=!![];}if(!_[_0x9b45('0x21')](_0xaa3acd['variable']['xmd-contactid'])){utils[_0x9b45('0x6')](util[_0x9b45('0x7')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xaa3acd[_0x9b45('0x9')],_0xaa3acd[_0x9b45('0x45')]));channels[_0xaa3acd[_0x9b45('0x9')]][_0x9b45('0x52')]=_0xaa3acd[_0x9b45('0x45')];}if(!_[_0x9b45('0x21')](_0xaa3acd[_0x9b45('0x47')]['xmd-cdrtype'])){utils[_0x9b45('0x6')](util['format'](_0x9b45('0x53'),_0xaa3acd[_0x9b45('0x9')],_0xaa3acd[_0x9b45('0x45')]));channels[_0xaa3acd[_0x9b45('0x9')]][_0x9b45('0x54')]=_0xaa3acd[_0x9b45('0x45')];}if(!_[_0x9b45('0x21')](_0xaa3acd['variable'][_0x9b45('0x55')])){utils[_0x9b45('0x6')](util[_0x9b45('0x7')](_0x9b45('0x56'),_0xaa3acd[_0x9b45('0x9')],_0xaa3acd[_0x9b45('0x45')]));channels[_0xaa3acd[_0x9b45('0x9')]]['routeid']=_0xaa3acd['value'];}if(!_[_0x9b45('0x21')](_0xaa3acd[_0x9b45('0x47')]['sipcallid'])){utils[_0x9b45('0x6')](util[_0x9b45('0x7')](_0x9b45('0x57'),_0xaa3acd[_0x9b45('0x9')],_0xaa3acd[_0x9b45('0x45')]));channels[_0xaa3acd[_0x9b45('0x9')]][_0x9b45('0x58')]=_0xaa3acd[_0x9b45('0x45')];}}}catch(_0x5389f1){utils[_0x9b45('0x1a')](util[_0x9b45('0x7')](_0x9b45('0x42'),_0xaa3acd[_0x9b45('0x9')]),_0x5389f1);}};exports['newexten']=function(_0x2928f7){try{if(!_[_0x9b45('0x21')](channels[_0x2928f7['uniqueid']])){utils[_0x9b45('0x14')](util[_0x9b45('0x7')]('[%s][calls][newexten]',_0x2928f7['uniqueid']),_0x2928f7);utils[_0x9b45('0x6')](util[_0x9b45('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x2928f7[_0x9b45('0x9')],_0x2928f7[_0x9b45('0x59')],_0x2928f7[_0x9b45('0x5a')]));if(_0x2928f7[_0x9b45('0x59')][_0x9b45('0x5b')]()=='set'&&_[_0x9b45('0x5c')](_0x2928f7[_0x9b45('0x5a')][_0x9b45('0x5b')](),'cdr')){var _0x5de9e1=_0x2928f7[_0x9b45('0x5a')]['split']('=');var _0x1f8eae=_0x5de9e1[0x0]['substring'](_0x5de9e1[0x0][_0x9b45('0x5d')]('(')+0x1,_0x5de9e1[0x0][_0x9b45('0x5d')](')'));var _0x101fb7=_0x5de9e1[0x1];channels[_0x2928f7[_0x9b45('0x9')]][_0x1f8eae]=_0x101fb7;}if(!_['includes'](['hangup',_0x9b45('0x5e'),_0x9b45('0x5f'),'set','gotoif'],_0x2928f7['application'][_0x9b45('0x5b')]())){channels[_0x2928f7[_0x9b45('0x9')]][_0x9b45('0x60')]=_0x2928f7['application'];channels[_0x2928f7[_0x9b45('0x9')]][_0x9b45('0x61')]=_0x2928f7['appdata'];}}}catch(_0x3a4223){utils[_0x9b45('0x1a')](util[_0x9b45('0x7')](_0x9b45('0x62'),_0x2928f7[_0x9b45('0x9')]),_0x3a4223);}}; \ No newline at end of file +var _0x13ad=['[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','noop','gotoif','lastapplication','lastdata','appdata','lodash','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','queue','membername','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','then','UserId','CreateVoiceCallReport','request','uniqueid','newchannel','debug','[%s][calls][newchannel]','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','transfer','destinationchannel','answertime','disposition','toNumber','ANSWERED','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset'];(function(_0x94a721,_0xd2b989){var _0x353bfe=function(_0x500580){while(--_0x500580){_0x94a721['push'](_0x94a721['shift']());}};_0x353bfe(++_0xd2b989);}(_0x13ad,0x1c8));var _0xd13a=function(_0x20cd22,_0x1441e0){_0x20cd22=_0x20cd22-0x0;var _0x20c18b=_0x13ad[_0x20cd22];return _0x20c18b;};'use strict';var _=require(_0xd13a('0x0'));var util=require('util');var utils=require(_0xd13a('0x1'));var dispositions=[_0xd13a('0x2'),_0xd13a('0x3'),'FAILED',_0xd13a('0x2'),_0xd13a('0x2'),_0xd13a('0x2'),'ANSWERED',_0xd13a('0x4'),_0xd13a('0x3'),_0xd13a('0x3'),_0xd13a('0x3')];var channels={};function writeDB(_0x488967){utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x488967['uniqueid'],_0x488967['channel'],_0x488967[_0xd13a('0x7')],_0x488967[_0xd13a('0x8')],_0x488967[_0xd13a('0x9')],_0x488967[_0xd13a('0xa')],_0x488967[_0xd13a('0xb')],_0x488967['lastevent']));if(_0x488967['accountcode']){utils[_0xd13a('0xc')](_0x488967[_0xd13a('0xd')])[_0xd13a('0xe')](function(_0x26f1ca){if(_0x26f1ca){_0x488967[_0xd13a('0xf')]=_0x26f1ca['id'];}utils['request'](_0xd13a('0x10'),_0x488967);});}else{utils[_0xd13a('0x11')](_0xd13a('0x10'),_0x488967);}if(channels[_0x488967[_0xd13a('0x12')]]){delete channels[_0x488967[_0xd13a('0x12')]];}}exports[_0xd13a('0x13')]=function(_0x991aba){try{utils[_0xd13a('0x14')](util[_0xd13a('0x6')](_0xd13a('0x15'),_0x991aba[_0xd13a('0x12')]),_0x991aba);if(_0x991aba[_0xd13a('0x12')]==_0x991aba['linkedid']&&_0x991aba[_0xd13a('0x16')]!=_0xd13a('0x17')){utils['info'](util[_0xd13a('0x6')](_0xd13a('0x18'),_0x991aba['uniqueid'],_0x991aba[_0xd13a('0x19')],_0x991aba[_0xd13a('0x1a')]));channels[_0x991aba['uniqueid']]={'uniqueid':_0x991aba[_0xd13a('0x12')],'accountcode':_0x991aba[_0xd13a('0xd')],'source':_0x991aba['calleridnum'],'destination':_0x991aba['exten'],'destinationcontext':_0x991aba[_0xd13a('0x19')],'channel':_0x991aba[_0xd13a('0x16')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd13a('0x2'),'amaflags':_0xd13a('0x1b')};}}catch(_0x3f2f24){utils[_0xd13a('0x1c')](util[_0xd13a('0x6')](_0xd13a('0x15'),_0x991aba[_0xd13a('0x12')]),_0x3f2f24);}};exports['newstate']=function(_0xb9b92c){try{utils[_0xd13a('0x14')](util[_0xd13a('0x6')]('[%s][calls][newstate]',_0xb9b92c[_0xd13a('0x12')]),_0xb9b92c);if(!_[_0xd13a('0x1d')](channels[_0xb9b92c['uniqueid']])&&_0xb9b92c[_0xd13a('0x1e')]==0x6){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x1f'),_0xb9b92c[_0xd13a('0x12')],_0xb9b92c[_0xd13a('0x19')],_0xb9b92c[_0xd13a('0x16')]));if(_[_0xd13a('0x1d')](channels[_0xb9b92c[_0xd13a('0x12')]][_0xd13a('0x20')])){channels[_0xb9b92c[_0xd13a('0x12')]][_0xd13a('0x20')]=utils[_0xd13a('0x21')]();}}else if(!_[_0xd13a('0x1d')](channels[_0xb9b92c[_0xd13a('0x22')]])&&_0xb9b92c[_0xd13a('0x1e')]==0x6&&_0xb9b92c[_0xd13a('0x19')]!=_0xd13a('0x23')){utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0xb9b92c[_0xd13a('0x12')],_0xb9b92c[_0xd13a('0x22')],_0xb9b92c[_0xd13a('0x19')],_0xb9b92c[_0xd13a('0x16')]));channels[_0xb9b92c['linkedid']]['accountcode']=_0xb9b92c[_0xd13a('0xd')];channels[_0xb9b92c[_0xd13a('0x22')]][_0xd13a('0x24')]=_0xb9b92c[_0xd13a('0x16')];if(_['isNil'](channels[_0xb9b92c[_0xd13a('0x22')]][_0xd13a('0x25')])){channels[_0xb9b92c[_0xd13a('0x22')]][_0xd13a('0x25')]=utils[_0xd13a('0x21')]();}channels[_0xb9b92c[_0xd13a('0x22')]][_0xd13a('0x26')]=dispositions[_[_0xd13a('0x27')](_0xb9b92c['channelstate'])]||_0xd13a('0x28');}}catch(_0x4773f1){utils[_0xd13a('0x1c')](util[_0xd13a('0x6')](_0xd13a('0x29'),_0xb9b92c[_0xd13a('0x12')]),_0x4773f1);}};exports[_0xd13a('0x2a')]=function(_0x3608b9){try{if(!_[_0xd13a('0x1d')](channels[_0x3608b9['uniqueid']])){utils[_0xd13a('0x14')](util[_0xd13a('0x6')](_0xd13a('0x2b'),_0x3608b9['uniqueid']),_0x3608b9);if(_[_0xd13a('0x1d')](channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x2c')])){channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x2c')]=_0x3608b9[_0xd13a('0x2d')]+'\x20<'+_0x3608b9['calleridnum']+'>';}utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x2e'),_0x3608b9[_0xd13a('0x12')],channels[_0x3608b9['uniqueid']][_0xd13a('0x2c')],_0x3608b9['cause-txt']));channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x2f')]=utils['now']();channels[_0x3608b9[_0xd13a('0x12')]]['duration']=utils[_0xd13a('0x30')](channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x2f')],channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x31')]);channels[_0x3608b9[_0xd13a('0x12')]]['billableseconds']=channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x25')]?utils[_0xd13a('0x30')](channels[_0x3608b9['uniqueid']][_0xd13a('0x2f')],channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x25')]):0x0;writeDB(channels[_0x3608b9[_0xd13a('0x12')]]);}}catch(_0x3120e9){utils[_0xd13a('0x1c')](util[_0xd13a('0x6')](_0xd13a('0x2b'),_0x3608b9['uniqueid']),_0x3120e9);}};exports[_0xd13a('0x32')]=function(_0x5df661){try{if(!_[_0xd13a('0x1d')](channels[_0x5df661[_0xd13a('0x33')]])){utils[_0xd13a('0x14')](util[_0xd13a('0x6')](_0xd13a('0x34'),_0x5df661[_0xd13a('0x35')]),_0x5df661);if(channels[_0x5df661[_0xd13a('0x33')]]['channel']==_0x5df661[_0xd13a('0x36')]){utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5df661['origtransfereruniqueid'],_0x5df661[_0xd13a('0x33')],_0x5df661[_0xd13a('0x37')]));channels[_0x5df661[_0xd13a('0x33')]]['destinationchannel']=_0x5df661[_0xd13a('0x37')];channels[_0x5df661[_0xd13a('0x33')]][_0xd13a('0x38')]=_0xd13a('0x39');}else if(channels[_0x5df661[_0xd13a('0x33')]][_0xd13a('0x16')]=_0x5df661[_0xd13a('0x3a')]){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x3b'),_0x5df661[_0xd13a('0x35')],_0x5df661[_0xd13a('0x33')],_0x5df661['origtransfererchannel']));channels[_0x5df661[_0xd13a('0x33')]]['destinationchannel']=_0x5df661[_0xd13a('0x3c')];channels[_0x5df661[_0xd13a('0x33')]]['userfield']=_0xd13a('0x39');}}}catch(_0x20ebfa){utils[_0xd13a('0x1c')](util[_0xd13a('0x6')](_0xd13a('0x34'),_0x5df661[_0xd13a('0x35')]),_0x20ebfa);}};exports[_0xd13a('0x3d')]=function(_0x29b897){try{if(!_[_0xd13a('0x1d')](channels[_0x29b897[_0xd13a('0x12')]])){utils['debug'](util['format'](_0xd13a('0x3e'),_0x29b897[_0xd13a('0x12')]),_0x29b897);channels[_0x29b897[_0xd13a('0x12')]]['musiconholdstartAt']=utils[_0xd13a('0x21')]();utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x29b897[_0xd13a('0x12')],channels[_0x29b897[_0xd13a('0x12')]][_0xd13a('0x3f')]));}}catch(_0x4cc411){utils['error'](util[_0xd13a('0x6')](_0xd13a('0x3e'),_0x29b897['uniqueid']),_0x4cc411);}};exports[_0xd13a('0x40')]=function(_0xeb43af){try{if(!_[_0xd13a('0x1d')](channels[_0xeb43af[_0xd13a('0x12')]])){utils[_0xd13a('0x14')](util['format']('[%s][calls][musiconholdstop]',_0xeb43af[_0xd13a('0x12')]),_0xeb43af);if(!_['isNil'](channels[_0xeb43af[_0xd13a('0x12')]][_0xd13a('0x3f')])){channels[_0xeb43af[_0xd13a('0x12')]][_0xd13a('0x41')]+=utils[_0xd13a('0x30')](utils[_0xd13a('0x21')](),channels[_0xeb43af[_0xd13a('0x12')]][_0xd13a('0x3f')]);utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x42'),_0xeb43af[_0xd13a('0x12')],channels[_0xeb43af[_0xd13a('0x12')]][_0xd13a('0x41')]));delete channels[_0xeb43af[_0xd13a('0x12')]][_0xd13a('0x3f')];}}}catch(_0x5d1ceb){utils[_0xd13a('0x1c')](util['format'](_0xd13a('0x43'),_0xeb43af['uniqueid']),_0x5d1ceb);}};exports[_0xd13a('0x44')]=function(_0x4f327c){try{if(!_[_0xd13a('0x1d')](channels[_0x4f327c['uniqueid']])){utils['debug'](util[_0xd13a('0x6')](_0xd13a('0x45'),_0x4f327c['uniqueid']),_0x4f327c);if(!_[_0xd13a('0x1d')](_0x4f327c['variable'][_0xd13a('0x46')])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x47'),_0x4f327c[_0xd13a('0x12')],_0x4f327c['value']));channels[_0x4f327c[_0xd13a('0x12')]]['source']=_0x4f327c[_0xd13a('0x48')];}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x4a')])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x4f327c[_0xd13a('0x12')],_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c[_0xd13a('0x12')]][_0xd13a('0x4b')]=_0x4f327c[_0xd13a('0x48')];channels[_0x4f327c[_0xd13a('0x12')]][_0xd13a('0x2c')]='\x22'+_0x4f327c[_0xd13a('0x48')]+'\x22\x20<'+_0x4f327c[_0xd13a('0x48')]+'>';}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x4c')])||!_[_0xd13a('0x1d')](_0x4f327c['variable'][_0xd13a('0x4d')])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x4e'),_0x4f327c[_0xd13a('0x12')],!_[_0xd13a('0x1d')](_0x4f327c['variable'][_0xd13a('0x4c')])?_0xd13a('0x4c'):_0xd13a('0x4d'),_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c[_0xd13a('0x12')]][_0xd13a('0x2c')]=_0x4f327c[_0xd13a('0x48')];}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x4f')])||!_[_0xd13a('0x1d')](_0x4f327c['variable'][_0xd13a('0x50')])){utils['info'](util[_0xd13a('0x6')](_0xd13a('0x4e'),_0x4f327c[_0xd13a('0x12')],!_['isNil'](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x4f')])?_0xd13a('0x4f'):'xmcs-queue',_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c['uniqueid']]['lastapplication']=_0xd13a('0x51');channels[_0x4f327c[_0xd13a('0x12')]]['lastdata']=_0x4f327c['value'];channels[_0x4f327c[_0xd13a('0x12')]]['queue']=!![];}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x52')])){utils[_0xd13a('0x5')](util['format'](_0xd13a('0x53'),_0x4f327c[_0xd13a('0x12')],_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c[_0xd13a('0x12')]][_0xd13a('0x54')]=_0x4f327c['value'];}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x55')])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4f327c[_0xd13a('0x12')],_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c['uniqueid']][_0xd13a('0x56')]=_0x4f327c[_0xd13a('0x48')];}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')]['outboundrouteid'])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x57'),_0x4f327c['uniqueid'],_0x4f327c['value']));channels[_0x4f327c[_0xd13a('0x12')]]['routeid']=_0x4f327c[_0xd13a('0x48')];}if(!_[_0xd13a('0x1d')](_0x4f327c['variable']['sipcallid'])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x58'),_0x4f327c[_0xd13a('0x12')],_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c[_0xd13a('0x12')]][_0xd13a('0x59')]=_0x4f327c[_0xd13a('0x48')];}}}catch(_0x5be871){utils['error'](util['format'](_0xd13a('0x45'),_0x4f327c['uniqueid']),_0x5be871);}};exports['newexten']=function(_0x2028f1){try{if(!_[_0xd13a('0x1d')](channels[_0x2028f1['uniqueid']])){utils[_0xd13a('0x14')](util[_0xd13a('0x6')](_0xd13a('0x5a'),_0x2028f1[_0xd13a('0x12')]),_0x2028f1);utils['info'](util[_0xd13a('0x6')](_0xd13a('0x5b'),_0x2028f1['uniqueid'],_0x2028f1[_0xd13a('0x5c')],_0x2028f1['appdata']));if(_0x2028f1[_0xd13a('0x5c')][_0xd13a('0x5d')]()==_0xd13a('0x5e')&&_[_0xd13a('0x5f')](_0x2028f1['appdata'][_0xd13a('0x5d')](),_0xd13a('0x60'))){var _0x578e69=_0x2028f1['appdata']['split']('=');var _0x2b7940=_0x578e69[0x0][_0xd13a('0x61')](_0x578e69[0x0][_0xd13a('0x62')]('(')+0x1,_0x578e69[0x0][_0xd13a('0x62')](')'));var _0x44c896=_0x578e69[0x1];channels[_0x2028f1[_0xd13a('0x12')]][_0x2b7940]=_0x44c896;}if(!_[_0xd13a('0x63')]([_0xd13a('0x2a'),_0xd13a('0x64'),'execif',_0xd13a('0x5e'),_0xd13a('0x65')],_0x2028f1[_0xd13a('0x5c')][_0xd13a('0x5d')]())){channels[_0x2028f1[_0xd13a('0x12')]][_0xd13a('0x66')]=_0x2028f1[_0xd13a('0x5c')];channels[_0x2028f1[_0xd13a('0x12')]][_0xd13a('0x67')]=_0x2028f1[_0xd13a('0x68')];}}}catch(_0x51ca65){utils[_0xd13a('0x1c')](util['format'](_0xd13a('0x5a'),_0x2028f1['uniqueid']),_0x51ca65);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 4a9fb8b..52c5a80 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 _0x53f7=['info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect'];(function(_0x40991a,_0xabf8d9){var _0x5a2fc9=function(_0x4aa9c1){while(--_0x4aa9c1){_0x40991a['push'](_0x40991a['shift']());}};_0x5a2fc9(++_0xabf8d9);}(_0x53f7,0x80));var _0x753f=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0x53f7[_0x347471];return _0x422b6a;};'use strict';var utils=require(_0x753f('0x0'));exports[_0x753f('0x1')]=function(){utils[_0x753f('0x2')](_0x753f('0x3'));};exports[_0x753f('0x4')]=function(){utils[_0x753f('0x2')](_0x753f('0x5'));};exports[_0x753f('0x6')]=function(){utils[_0x753f('0x2')](_0x753f('0x7'));};exports[_0x753f('0x8')]=function(_0x708cb){utils[_0x753f('0x8')](_0x753f('0x9'),_0x708cb);};exports[_0x753f('0xa')]=function(){utils[_0x753f('0x2')](_0x753f('0xb'));};exports[_0x753f('0xc')]=function(_0xa839c0){}; \ No newline at end of file +var _0x1f4f=['info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils','connect'];(function(_0x16acb7,_0x23f034){var _0x39bf39=function(_0x21281e){while(--_0x21281e){_0x16acb7['push'](_0x16acb7['shift']());}};_0x39bf39(++_0x23f034);}(_0x1f4f,0x1d7));var _0xf1f4=function(_0x46d54d,_0x105c39){_0x46d54d=_0x46d54d-0x0;var _0x5a8e5a=_0x1f4f[_0x46d54d];return _0x5a8e5a;};'use strict';var utils=require(_0xf1f4('0x0'));exports[_0xf1f4('0x1')]=function(){utils[_0xf1f4('0x2')](_0xf1f4('0x3'));};exports[_0xf1f4('0x4')]=function(){utils[_0xf1f4('0x2')]('[core]\x20shutdown');};exports[_0xf1f4('0x5')]=function(){utils[_0xf1f4('0x2')](_0xf1f4('0x6'));};exports[_0xf1f4('0x7')]=function(_0x35917d){utils['error'](_0xf1f4('0x8'),_0x35917d);};exports[_0xf1f4('0x9')]=function(){utils['info']('[core]\x20close');};exports[_0xf1f4('0xa')]=function(_0x5a433c){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b679205..3d83f7a 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 _0x35d4=['variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','holdtime','billableseconds','diffTime','endtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil'];(function(_0x2f3e6e,_0x16b0fc){var _0x1ef80d=function(_0x5ee966){while(--_0x5ee966){_0x2f3e6e['push'](_0x2f3e6e['shift']());}};_0x1ef80d(++_0x16b0fc);}(_0x35d4,0x87));var _0x435d=function(_0x14ab73,_0x5a4339){_0x14ab73=_0x14ab73-0x0;var _0x676aba=_0x35d4[_0x14ab73];return _0x676aba;};'use strict';var _=require(_0x435d('0x0'));var util=require(_0x435d('0x1'));var utils=require(_0x435d('0x2'));var dials={};function writeDB(_0x48a45c){utils[_0x435d('0x3')](util[_0x435d('0x4')](_0x435d('0x5'),_0x48a45c[_0x435d('0x6')],_0x48a45c[_0x435d('0x7')],_0x48a45c['dialstring'],_0x48a45c[_0x435d('0x8')],_0x48a45c[_0x435d('0x9')],_0x48a45c['dialstatus']));utils[_0x435d('0xa')](_0x435d('0xb'),_0x48a45c);delete dials[_0x48a45c[_0x435d('0x6')]];}exports[_0x435d('0xc')]=function(_0x42a5ae){try{utils[_0x435d('0xd')](util['format']('[%s][dials][newexten]',_0x42a5ae[_0x435d('0x6')]),_0x42a5ae);utils[_0x435d('0x3')](util[_0x435d('0x4')](_0x435d('0xe'),_0x42a5ae[_0x435d('0x6')],_0x42a5ae[_0x435d('0xf')],_0x42a5ae[_0x435d('0x10')]));if(_0x42a5ae[_0x435d('0xf')][_0x435d('0x11')]()==_0x435d('0x12')&&_[_0x435d('0x13')](_0x42a5ae[_0x435d('0x10')][_0x435d('0x11')](),_0x435d('0x14'))){var _0x471066=_0x42a5ae['appdata'][_0x435d('0x15')]('=');dials[_0x42a5ae[_0x435d('0x6')]]={'routeId':_0x471066[0x1]};}}catch(_0x1fb648){utils[_0x435d('0x16')](util[_0x435d('0x4')](_0x435d('0x17'),_0x42a5ae[_0x435d('0x6')]),_0x1fb648);}};exports[_0x435d('0x18')]=function(_0x45518e){try{utils['debug'](util[_0x435d('0x4')](_0x435d('0x19'),_0x45518e[_0x435d('0x6')]),_0x45518e);if(!_[_0x435d('0x1a')](_0x45518e[_0x435d('0x1b')]['outboundrouteid'])){utils['info'](util[_0x435d('0x4')](_0x435d('0x1c'),_0x45518e[_0x435d('0x6')],_0x45518e[_0x435d('0x1d')]));dials[_0x45518e['uniqueid']]={'routeId':_0x45518e['value']};}}catch(_0x40dad4){utils[_0x435d('0x16')](util[_0x435d('0x4')](_0x435d('0x19'),_0x45518e[_0x435d('0x6')]),_0x40dad4);}};exports[_0x435d('0x1e')]=function(_0x1118b7){try{if(!_[_0x435d('0x1a')](dials[_0x1118b7['uniqueid']])){utils[_0x435d('0xd')](util[_0x435d('0x4')]('[%s][dials][dialbegin]',_0x1118b7[_0x435d('0x6')]),_0x1118b7);dials[_0x1118b7[_0x435d('0x6')]]=_[_0x435d('0x1f')](dials[_0x1118b7[_0x435d('0x6')]],_0x1118b7);dials[_0x1118b7[_0x435d('0x6')]][_0x435d('0x20')]=utils[_0x435d('0x21')]();dials[_0x1118b7[_0x435d('0x6')]]['lastevent']='called';utils[_0x435d('0x3')](util['format'](_0x435d('0x22'),_0x1118b7[_0x435d('0x6')],dials[_0x1118b7[_0x435d('0x6')]]['starttime']));}}catch(_0x243fa7){utils[_0x435d('0x16')](util[_0x435d('0x4')]('[%s][dials][dialbegin]',_0x1118b7[_0x435d('0x6')]),_0x243fa7);}};exports[_0x435d('0x23')]=function(_0x17d89b){try{if(!_[_0x435d('0x1a')](dials[_0x17d89b[_0x435d('0x6')]])){utils[_0x435d('0xd')](util['format'](_0x435d('0x24'),_0x17d89b[_0x435d('0x6')]),_0x17d89b);dials[_0x17d89b['uniqueid']][_0x435d('0x25')]=_0x17d89b[_0x435d('0x25')];if(_0x17d89b['dialstatus']==_0x435d('0x26')){dials[_0x17d89b[_0x435d('0x6')]]=_[_0x435d('0x1f')](dials[_0x17d89b[_0x435d('0x6')]],_0x17d89b);dials[_0x17d89b[_0x435d('0x6')]][_0x435d('0x27')]=utils[_0x435d('0x21')]();dials[_0x17d89b['uniqueid']][_0x435d('0x28')]=_0x435d('0x29');utils[_0x435d('0x3')](util[_0x435d('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x17d89b[_0x435d('0x6')],_0x17d89b[_0x435d('0x25')],dials[_0x17d89b[_0x435d('0x6')]]['answertime']));}else{utils[_0x435d('0x3')](util['format'](_0x435d('0x2a'),_0x17d89b[_0x435d('0x6')],_0x17d89b[_0x435d('0x25')]));}}}catch(_0x1546bb){utils[_0x435d('0x16')](util[_0x435d('0x4')](_0x435d('0x24'),_0x17d89b[_0x435d('0x6')]),_0x1546bb);}};exports[_0x435d('0x2b')]=function(_0x4c36d9){try{if(!_[_0x435d('0x1a')](dials[_0x4c36d9[_0x435d('0x6')]])){utils['debug'](util[_0x435d('0x4')](_0x435d('0x2c'),_0x4c36d9[_0x435d('0x6')]),_0x4c36d9);utils[_0x435d('0x3')](util[_0x435d('0x4')](_0x435d('0x2d'),_0x4c36d9['uniqueid'],_0x4c36d9[_0x435d('0x8')],_0x4c36d9[_0x435d('0x2e')],_0x4c36d9[_0x435d('0x2f')]));dials[_0x4c36d9[_0x435d('0x6')]]=_[_0x435d('0x1f')](dials[_0x4c36d9[_0x435d('0x6')]],{'endtime':utils['now'](),'lastevent':_0x435d('0x30')});dials[_0x4c36d9[_0x435d('0x6')]][_0x435d('0x31')]=utils['diffTime'](dials[_0x4c36d9['uniqueid']]['endtime'],dials[_0x4c36d9[_0x435d('0x6')]]['starttime']);dials[_0x4c36d9[_0x435d('0x6')]][_0x435d('0x32')]=utils['diffTime'](dials[_0x4c36d9['uniqueid']][_0x435d('0x27')]||dials[_0x4c36d9['uniqueid']]['endtime'],dials[_0x4c36d9[_0x435d('0x6')]]['starttime']);dials[_0x4c36d9[_0x435d('0x6')]][_0x435d('0x33')]=dials[_0x4c36d9[_0x435d('0x6')]][_0x435d('0x27')]?utils[_0x435d('0x34')](dials[_0x4c36d9[_0x435d('0x6')]][_0x435d('0x35')],dials[_0x4c36d9[_0x435d('0x6')]]['answertime']):0x0;writeDB(dials[_0x4c36d9['uniqueid']]);}}catch(_0x413325){utils['error'](util[_0x435d('0x4')](_0x435d('0x2c'),_0x4c36d9['uniqueid']),_0x413325);}}; \ No newline at end of file +var _0xc546=['starttime','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','complete','duration','diffTime','endtime','holdtime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','value','assign','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called'];(function(_0x546a31,_0x49f1d7){var _0x3c2f19=function(_0x2cf5ae){while(--_0x2cf5ae){_0x546a31['push'](_0x546a31['shift']());}};_0x3c2f19(++_0x49f1d7);}(_0xc546,0x169));var _0x6c54=function(_0x1c98c4,_0x52f5f9){_0x1c98c4=_0x1c98c4-0x0;var _0x4ccfe5=_0xc546[_0x1c98c4];return _0x4ccfe5;};'use strict';var _=require(_0x6c54('0x0'));var util=require('util');var utils=require(_0x6c54('0x1'));var dials={};function writeDB(_0x25d53e){utils[_0x6c54('0x2')](util[_0x6c54('0x3')](_0x6c54('0x4'),_0x25d53e[_0x6c54('0x5')],_0x25d53e[_0x6c54('0x6')],_0x25d53e[_0x6c54('0x7')],_0x25d53e['calleridnum'],_0x25d53e[_0x6c54('0x8')],_0x25d53e['dialstatus']));utils[_0x6c54('0x9')](_0x6c54('0xa'),_0x25d53e);delete dials[_0x25d53e[_0x6c54('0x5')]];}exports[_0x6c54('0xb')]=function(_0x47de9f){try{utils[_0x6c54('0xc')](util[_0x6c54('0x3')](_0x6c54('0xd'),_0x47de9f[_0x6c54('0x5')]),_0x47de9f);utils[_0x6c54('0x2')](util[_0x6c54('0x3')](_0x6c54('0xe'),_0x47de9f[_0x6c54('0x5')],_0x47de9f[_0x6c54('0xf')],_0x47de9f[_0x6c54('0x10')]));if(_0x47de9f['application'][_0x6c54('0x11')]()=='set'&&_[_0x6c54('0x12')](_0x47de9f[_0x6c54('0x10')][_0x6c54('0x11')](),_0x6c54('0x13'))){var _0x5e851b=_0x47de9f[_0x6c54('0x10')][_0x6c54('0x14')]('=');dials[_0x47de9f[_0x6c54('0x5')]]={'routeId':_0x5e851b[0x1]};}}catch(_0x459bcf){utils[_0x6c54('0x15')](util['format'](_0x6c54('0xd'),_0x47de9f['uniqueid']),_0x459bcf);}};exports[_0x6c54('0x16')]=function(_0x358e19){try{utils[_0x6c54('0xc')](util[_0x6c54('0x3')](_0x6c54('0x17'),_0x358e19[_0x6c54('0x5')]),_0x358e19);if(!_[_0x6c54('0x18')](_0x358e19['variable'][_0x6c54('0x19')])){utils['info'](util[_0x6c54('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x358e19[_0x6c54('0x5')],_0x358e19[_0x6c54('0x1a')]));dials[_0x358e19[_0x6c54('0x5')]]={'routeId':_0x358e19['value']};}}catch(_0x278f3e){utils[_0x6c54('0x15')](util['format'](_0x6c54('0x17'),_0x358e19[_0x6c54('0x5')]),_0x278f3e);}};exports['dialbegin']=function(_0x4683c6){try{if(!_[_0x6c54('0x18')](dials[_0x4683c6['uniqueid']])){utils[_0x6c54('0xc')](util[_0x6c54('0x3')]('[%s][dials][dialbegin]',_0x4683c6[_0x6c54('0x5')]),_0x4683c6);dials[_0x4683c6[_0x6c54('0x5')]]=_[_0x6c54('0x1b')](dials[_0x4683c6[_0x6c54('0x5')]],_0x4683c6);dials[_0x4683c6[_0x6c54('0x5')]]['starttime']=utils[_0x6c54('0x1c')]();dials[_0x4683c6[_0x6c54('0x5')]]['lastevent']=_0x6c54('0x1d');utils['info'](util[_0x6c54('0x3')](_0x6c54('0x1e'),_0x4683c6[_0x6c54('0x5')],dials[_0x4683c6['uniqueid']][_0x6c54('0x1f')]));}}catch(_0x3e01aa){utils[_0x6c54('0x15')](util[_0x6c54('0x3')](_0x6c54('0x20'),_0x4683c6[_0x6c54('0x5')]),_0x3e01aa);}};exports[_0x6c54('0x21')]=function(_0x4ed1a5){try{if(!_[_0x6c54('0x18')](dials[_0x4ed1a5[_0x6c54('0x5')]])){utils[_0x6c54('0xc')](util[_0x6c54('0x3')](_0x6c54('0x22'),_0x4ed1a5[_0x6c54('0x5')]),_0x4ed1a5);dials[_0x4ed1a5[_0x6c54('0x5')]]['dialstatus']=_0x4ed1a5['dialstatus'];if(_0x4ed1a5[_0x6c54('0x23')]=='ANSWER'){dials[_0x4ed1a5[_0x6c54('0x5')]]=_[_0x6c54('0x1b')](dials[_0x4ed1a5[_0x6c54('0x5')]],_0x4ed1a5);dials[_0x4ed1a5[_0x6c54('0x5')]][_0x6c54('0x24')]=utils['now']();dials[_0x4ed1a5[_0x6c54('0x5')]][_0x6c54('0x25')]=_0x6c54('0x26');utils[_0x6c54('0x2')](util[_0x6c54('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x4ed1a5[_0x6c54('0x5')],_0x4ed1a5['dialstatus'],dials[_0x4ed1a5[_0x6c54('0x5')]]['answertime']));}else{utils[_0x6c54('0x2')](util[_0x6c54('0x3')](_0x6c54('0x27'),_0x4ed1a5[_0x6c54('0x5')],_0x4ed1a5[_0x6c54('0x23')]));}}}catch(_0x3c4048){utils[_0x6c54('0x15')](util['format'](_0x6c54('0x22'),_0x4ed1a5[_0x6c54('0x5')]),_0x3c4048);}};exports['hangup']=function(_0x2b51ac){try{if(!_[_0x6c54('0x18')](dials[_0x2b51ac['uniqueid']])){utils['debug'](util[_0x6c54('0x3')](_0x6c54('0x28'),_0x2b51ac[_0x6c54('0x5')]),_0x2b51ac);utils[_0x6c54('0x2')](util[_0x6c54('0x3')](_0x6c54('0x29'),_0x2b51ac[_0x6c54('0x5')],_0x2b51ac[_0x6c54('0x2a')],_0x2b51ac['calleridname'],_0x2b51ac[_0x6c54('0x2b')]));dials[_0x2b51ac['uniqueid']]=_[_0x6c54('0x1b')](dials[_0x2b51ac[_0x6c54('0x5')]],{'endtime':utils[_0x6c54('0x1c')](),'lastevent':_0x6c54('0x2c')});dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x2d')]=utils[_0x6c54('0x2e')](dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x2f')],dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x1f')]);dials[_0x2b51ac['uniqueid']][_0x6c54('0x30')]=utils[_0x6c54('0x2e')](dials[_0x2b51ac['uniqueid']][_0x6c54('0x24')]||dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x2f')],dials[_0x2b51ac[_0x6c54('0x5')]]['starttime']);dials[_0x2b51ac['uniqueid']]['billableseconds']=dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x24')]?utils[_0x6c54('0x2e')](dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x2f')],dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x24')]):0x0;writeDB(dials[_0x2b51ac[_0x6c54('0x5')]]);}}catch(_0xf29472){utils[_0x6c54('0x15')](util['format'](_0x6c54('0x28'),_0x2b51ac[_0x6c54('0x5')]),_0xf29472);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 56aec87..839b1e3 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 _0x196d=['newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]'];(function(_0xa3cddf,_0x565a53){var _0xd18139=function(_0x2b0e05){while(--_0x2b0e05){_0xa3cddf['push'](_0xa3cddf['shift']());}};_0xd18139(++_0x565a53);}(_0x196d,0x1ec));var _0xd196=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x196d[_0x1b6c6d];return _0x290d9d;};var AsteriskManager=require(_0xd196('0x0'));var config=require(_0xd196('0x1'));var utils=require(_0xd196('0x2'));var util=require(_0xd196('0x3'));var isXDREnabled=config['xdr']&&config[_0xd196('0x4')][_0xd196('0x5')]?!config[_0xd196('0x4')]['disabled']:!![];var isProduction=config[_0xd196('0x6')]===_0xd196('0x7')||![];var isLocalAsterisk=config[_0xd196('0x4')]&&config['xdr'][_0xd196('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0xd196('0x9')]['port'],config[_0xd196('0x9')]['ip'],config[_0xd196('0x9')][_0xd196('0xa')],config['asterisk'][_0xd196('0xb')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xd196('0xc')](_0xd196('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xd196('0xc')](_0xd196('0xe'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0xd196('0xf'));var members=require(_0xd196('0x10'));var dials=require(_0xd196('0x11'));var transfers=require(_0xd196('0x12'));var core=require('./core.controller');ami['on'](_0xd196('0x13'),core['connect']);ami['on'](_0xd196('0x14'),core[_0xd196('0x14')]);ami['on'](_0xd196('0x15'),core[_0xd196('0x15')]);ami['on'](_0xd196('0x16'),core[_0xd196('0x16')]);ami['on'](_0xd196('0x17'),core[_0xd196('0x17')]);ami['on'](_0xd196('0x18'),core['managerevent']);ami['on'](_0xd196('0x19'),function(_0x56ff16){try{utils['debug'](util['format'](_0xd196('0x1a'),_0x56ff16[_0xd196('0x1b')]),_0x56ff16);members[_0xd196('0x19')](_0x56ff16);}catch(_0x11e180){utils[_0xd196('0x16')](util[_0xd196('0x1c')](_0xd196('0x1a'),_0x56ff16[_0xd196('0x1b')]),_0x11e180);}});ami['on'](_0xd196('0x1d'),function(_0x5c868a){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')]('[%s][index][agentcalled]',_0x5c868a['uniqueid']),_0x5c868a);agents['agentcalled'](_0x5c868a);}catch(_0x183883){utils[_0xd196('0x16')](util[_0xd196('0x1c')](_0xd196('0x1f'),_0x5c868a[_0xd196('0x20')]),_0x183883);}});ami['on'](_0xd196('0x21'),function(_0x438e40){try{utils[_0xd196('0x1e')](util['format']('[%s][index][agentringnoanswer]',_0x438e40[_0xd196('0x20')]),_0x438e40);agents[_0xd196('0x21')](_0x438e40);}catch(_0x3f2366){utils[_0xd196('0x16')](util[_0xd196('0x1c')](_0xd196('0x22'),_0x438e40['uniqueid']),_0x3f2366);}});ami['on']('agentconnect',function(_0x4b6207){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')]('[%s][index][agentconnect]',_0x4b6207['uniqueid']),_0x4b6207);agents['agentconnect'](_0x4b6207);queues[_0xd196('0x23')](_0x4b6207);}catch(_0x24ce25){utils[_0xd196('0x16')](util['format']('[%s][index][agentconnect]',_0x4b6207[_0xd196('0x20')]),_0x24ce25);}});ami['on'](_0xd196('0x24'),function(_0x253ebd){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')](_0xd196('0x25'),_0x253ebd['uniqueid']),_0x253ebd);agents[_0xd196('0x24')](_0x253ebd);queues[_0xd196('0x24')](_0x253ebd);members[_0xd196('0x24')](_0x253ebd);}catch(_0xce58cb){utils[_0xd196('0x16')](util['format']('[%s][index][agentcomplete]',_0x253ebd['uniqueid']),_0xce58cb);}});ami['on'](_0xd196('0x26'),function(_0x57b6b9){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')](_0xd196('0x27'),_0x57b6b9[_0xd196('0x20')]),_0x57b6b9);agents[_0xd196('0x26')](_0x57b6b9);queues[_0xd196('0x26')](_0x57b6b9);}catch(_0x4693cf){utils[_0xd196('0x16')](util['format'](_0xd196('0x27'),_0x57b6b9[_0xd196('0x20')]),_0x4693cf);}});ami['on'](_0xd196('0x28'),function(_0x1c09d4){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')](_0xd196('0x29'),_0x1c09d4[_0xd196('0x20')]),_0x1c09d4);queues[_0xd196('0x28')](_0x1c09d4);recordings[_0xd196('0x28')](_0x1c09d4);}catch(_0x3a4c2e){utils['error'](util[_0xd196('0x1c')]('[%s][index][queuecallerjoin]',_0x1c09d4[_0xd196('0x20')]),_0x3a4c2e);}});ami['on']('queuecallerleave',function(_0x158eff){try{utils[_0xd196('0x1e')](util['format']('[%s][index][queuecallerleave]',_0x158eff[_0xd196('0x20')]),_0x158eff);queues['queuecallerleave'](_0x158eff);}catch(_0x1f95b8){utils[_0xd196('0x16')](util[_0xd196('0x1c')](_0xd196('0x2a'),_0x158eff[_0xd196('0x20')]),_0x1f95b8);}});ami['on'](_0xd196('0x2b'),function(_0x2720f6){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')](_0xd196('0x2c'),_0x2720f6[_0xd196('0x20')]),_0x2720f6);queues[_0xd196('0x2b')](_0x2720f6);calls[_0xd196('0x2b')](_0x2720f6);}catch(_0x4f4b4c){utils[_0xd196('0x16')](util[_0xd196('0x1c')](_0xd196('0x2c'),_0x2720f6[_0xd196('0x20')]),_0x4f4b4c);}});ami['on'](_0xd196('0x2d'),function(_0x5df02c){try{utils[_0xd196('0x1e')](util['format']('[%s][index][musiconholdstop]',_0x5df02c[_0xd196('0x20')]),_0x5df02c);queues[_0xd196('0x2d')](_0x5df02c);calls[_0xd196('0x2d')](_0x5df02c);}catch(_0x42bbc1){utils['error'](util['format'](_0xd196('0x2e'),_0x5df02c[_0xd196('0x20')]),_0x42bbc1);}});ami['on'](_0xd196('0x2f'),function(_0x537a7a){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')](_0xd196('0x30'),_0x537a7a[_0xd196('0x20')]),_0x537a7a);calls[_0xd196('0x2f')](_0x537a7a);recordings[_0xd196('0x2f')](_0x537a7a);}catch(_0x318a89){utils['error'](util[_0xd196('0x1c')](_0xd196('0x30'),_0x537a7a[_0xd196('0x20')]),_0x318a89);}});ami['on'](_0xd196('0x31'),function(_0x56ac58){try{utils[_0xd196('0x1e')](util['format'](_0xd196('0x32'),_0x56ac58['uniqueid']),_0x56ac58);calls[_0xd196('0x31')](_0x56ac58);recordings[_0xd196('0x31')](_0x56ac58);dials[_0xd196('0x31')](_0x56ac58);agents[_0xd196('0x31')](_0x56ac58);queues[_0xd196('0x31')](_0x56ac58);}catch(_0x20ee9f){utils[_0xd196('0x16')](util['format']('[%s][index][hangup]',_0x56ac58[_0xd196('0x20')]),_0x20ee9f);}});ami['on'](_0xd196('0x33'),function(_0x461aa0){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')]('[%s][index][cdr]',_0x461aa0[_0xd196('0x20')]),_0x461aa0);members['cdr'](_0x461aa0);}catch(_0x12be9a){utils['error'](util[_0xd196('0x1c')](_0xd196('0x34'),_0x461aa0['uniqueid']),_0x12be9a);}});ami['on'](_0xd196('0x35'),function(_0x5199c4){try{utils['debug'](util['format'](_0xd196('0x36'),_0x5199c4[_0xd196('0x20')]),_0x5199c4);queues[_0xd196('0x35')](_0x5199c4);agents[_0xd196('0x35')](_0x5199c4);transfers[_0xd196('0x35')](_0x5199c4);}catch(_0x54569d){utils['error'](util[_0xd196('0x1c')](_0xd196('0x36'),_0x5199c4[_0xd196('0x20')]),_0x54569d);}});ami['on'](_0xd196('0x37'),function(_0x2a0642){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')](_0xd196('0x38'),_0x2a0642['origtransfereruniqueid']),_0x2a0642);queues[_0xd196('0x37')](_0x2a0642);transfers[_0xd196('0x37')](_0x2a0642);agents[_0xd196('0x37')](_0x2a0642);calls['attendedtransfer'](_0x2a0642);}catch(_0x2fea20){utils['error'](util[_0xd196('0x1c')](_0xd196('0x38'),_0x2a0642[_0xd196('0x39')]),_0x2fea20);}});ami['on'](_0xd196('0x3a'),function(_0x269458){try{utils['debug'](util['format'](_0xd196('0x3b'),_0x269458[_0xd196('0x20')]),_0x269458);queues[_0xd196('0x3a')](_0x269458);recordings[_0xd196('0x3a')](_0x269458);calls[_0xd196('0x3a')](_0x269458);dials[_0xd196('0x3a')](_0x269458);}catch(_0x43bfd1){utils[_0xd196('0x16')](util[_0xd196('0x1c')](_0xd196('0x3b'),_0x269458[_0xd196('0x20')]),_0x43bfd1);}});ami['on'](_0xd196('0x3c'),function(_0x29ffd4){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')]('[%s][index][newexten]',_0x29ffd4[_0xd196('0x20')]),_0x29ffd4);calls[_0xd196('0x3c')](_0x29ffd4);recordings[_0xd196('0x3c')](_0x29ffd4);dials[_0xd196('0x3c')](_0x29ffd4);}catch(_0x2bca21){utils[_0xd196('0x16')](util['format'](_0xd196('0x3d'),_0x29ffd4[_0xd196('0x20')]),_0x2bca21);}});ami['on'](_0xd196('0x3e'),function(_0xef619b){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')](_0xd196('0x3f'),_0xef619b[_0xd196('0x20')]),_0xef619b);calls[_0xd196('0x3e')](_0xef619b);recordings[_0xd196('0x3e')](_0xef619b);}catch(_0x3d21c7){utils[_0xd196('0x16')](util['format'](_0xd196('0x3f'),_0xef619b['uniqueid']),_0x3d21c7);}});ami['on']('dialbegin',function(_0x471cb5){try{utils['debug'](util['format'](_0xd196('0x40'),_0x471cb5['uniqueid']),_0x471cb5);dials[_0xd196('0x41')](_0x471cb5);}catch(_0x5f59){utils[_0xd196('0x16')](util[_0xd196('0x1c')](_0xd196('0x42'),_0x471cb5[_0xd196('0x20')]),_0x5f59);}});ami['on'](_0xd196('0x43'),function(_0x351a3a){try{utils[_0xd196('0x1e')](util[_0xd196('0x1c')](_0xd196('0x44'),_0x351a3a[_0xd196('0x20')]),_0x351a3a);dials['dialend'](_0x351a3a);}catch(_0x4b74a8){utils[_0xd196('0x16')](util['format'](_0xd196('0x44'),_0x351a3a[_0xd196('0x20')]),_0x4b74a8);}});} \ No newline at end of file +var _0x0a48=['attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','production','local','port','asterisk','username','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]'];(function(_0x2062ba,_0x3b1f1a){var _0x2de719=function(_0x49f485){while(--_0x49f485){_0x2062ba['push'](_0x2062ba['shift']());}};_0x2de719(++_0x3b1f1a);}(_0x0a48,0x95));var _0x80a4=function(_0x5d275e,_0x3c595b){_0x5d275e=_0x5d275e-0x0;var _0x3462e1=_0x0a48[_0x5d275e];return _0x3462e1;};var AsteriskManager=require(_0x80a4('0x0'));var config=require(_0x80a4('0x1'));var utils=require('./utils');var util=require(_0x80a4('0x2'));var isXDREnabled=config[_0x80a4('0x3')]&&config[_0x80a4('0x3')][_0x80a4('0x4')]?!config[_0x80a4('0x3')]['disabled']:!![];var isProduction=config['env']===_0x80a4('0x5')||![];var isLocalAsterisk=config[_0x80a4('0x3')]&&config[_0x80a4('0x3')][_0x80a4('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x80a4('0x7')],config['asterisk']['ip'],config[_0x80a4('0x8')][_0x80a4('0x9')],config[_0x80a4('0x8')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x80a4('0xa')](_0x80a4('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x80a4('0xa')](_0x80a4('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0x80a4('0xd'));var queues=require('./queues.controller');var recordings=require(_0x80a4('0xe'));var members=require('./members.controller');var dials=require(_0x80a4('0xf'));var transfers=require(_0x80a4('0x10'));var core=require('./core.controller');ami['on'](_0x80a4('0x11'),core[_0x80a4('0x11')]);ami['on'](_0x80a4('0x12'),core[_0x80a4('0x12')]);ami['on'](_0x80a4('0x13'),core[_0x80a4('0x13')]);ami['on'](_0x80a4('0x14'),core['error']);ami['on']('close',core[_0x80a4('0x15')]);ami['on'](_0x80a4('0x16'),core[_0x80a4('0x16')]);ami['on'](_0x80a4('0x17'),function(_0x55923c){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x1a'),_0x55923c[_0x80a4('0x1b')]),_0x55923c);members[_0x80a4('0x17')](_0x55923c);}catch(_0x2df8f1){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x1a'),_0x55923c[_0x80a4('0x1b')]),_0x2df8f1);}});ami['on'](_0x80a4('0x1c'),function(_0x23ac8b){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x1d'),_0x23ac8b['uniqueid']),_0x23ac8b);agents[_0x80a4('0x1c')](_0x23ac8b);}catch(_0x26c3d3){utils['error'](util[_0x80a4('0x19')](_0x80a4('0x1d'),_0x23ac8b['uniqueid']),_0x26c3d3);}});ami['on'](_0x80a4('0x1e'),function(_0x5b110c){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x1f'),_0x5b110c[_0x80a4('0x20')]),_0x5b110c);agents[_0x80a4('0x1e')](_0x5b110c);}catch(_0x88de42){utils[_0x80a4('0x14')](util[_0x80a4('0x19')]('[%s][index][agentringnoanswer]',_0x5b110c[_0x80a4('0x20')]),_0x88de42);}});ami['on'](_0x80a4('0x21'),function(_0x239ef6){try{utils['debug'](util['format'](_0x80a4('0x22'),_0x239ef6[_0x80a4('0x20')]),_0x239ef6);agents['agentconnect'](_0x239ef6);queues[_0x80a4('0x21')](_0x239ef6);}catch(_0x158ab2){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x22'),_0x239ef6[_0x80a4('0x20')]),_0x158ab2);}});ami['on'](_0x80a4('0x23'),function(_0x57822c){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x24'),_0x57822c[_0x80a4('0x20')]),_0x57822c);agents[_0x80a4('0x23')](_0x57822c);queues[_0x80a4('0x23')](_0x57822c);members[_0x80a4('0x23')](_0x57822c);}catch(_0x18fd40){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x24'),_0x57822c[_0x80a4('0x20')]),_0x18fd40);}});ami['on'](_0x80a4('0x25'),function(_0x5894b9){try{utils['debug'](util['format'](_0x80a4('0x26'),_0x5894b9[_0x80a4('0x20')]),_0x5894b9);agents[_0x80a4('0x25')](_0x5894b9);queues[_0x80a4('0x25')](_0x5894b9);}catch(_0x150031){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x26'),_0x5894b9[_0x80a4('0x20')]),_0x150031);}});ami['on'](_0x80a4('0x27'),function(_0x54958d){try{utils[_0x80a4('0x18')](util['format'](_0x80a4('0x28'),_0x54958d['uniqueid']),_0x54958d);queues[_0x80a4('0x27')](_0x54958d);recordings[_0x80a4('0x27')](_0x54958d);}catch(_0x190a1e){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x28'),_0x54958d[_0x80a4('0x20')]),_0x190a1e);}});ami['on']('queuecallerleave',function(_0x7e92fb){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x29'),_0x7e92fb[_0x80a4('0x20')]),_0x7e92fb);queues[_0x80a4('0x2a')](_0x7e92fb);}catch(_0x3143f1){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x29'),_0x7e92fb[_0x80a4('0x20')]),_0x3143f1);}});ami['on'](_0x80a4('0x2b'),function(_0x420d28){try{utils['debug'](util['format']('[%s][index][musiconholdstart]',_0x420d28[_0x80a4('0x20')]),_0x420d28);queues[_0x80a4('0x2b')](_0x420d28);calls[_0x80a4('0x2b')](_0x420d28);}catch(_0x54a34d){utils['error'](util[_0x80a4('0x19')](_0x80a4('0x2c'),_0x420d28['uniqueid']),_0x54a34d);}});ami['on']('musiconholdstop',function(_0xc5215){try{utils['debug'](util[_0x80a4('0x19')](_0x80a4('0x2d'),_0xc5215[_0x80a4('0x20')]),_0xc5215);queues[_0x80a4('0x2e')](_0xc5215);calls[_0x80a4('0x2e')](_0xc5215);}catch(_0x186d5a){utils[_0x80a4('0x14')](util[_0x80a4('0x19')]('[%s][index][musiconholdstop]',_0xc5215['uniqueid']),_0x186d5a);}});ami['on']('newstate',function(_0xe5495b){try{utils['debug'](util[_0x80a4('0x19')]('[%s][index][newstate]',_0xe5495b['uniqueid']),_0xe5495b);calls[_0x80a4('0x2f')](_0xe5495b);recordings[_0x80a4('0x2f')](_0xe5495b);}catch(_0x508d7e){utils['error'](util[_0x80a4('0x19')](_0x80a4('0x30'),_0xe5495b['uniqueid']),_0x508d7e);}});ami['on'](_0x80a4('0x31'),function(_0x571182){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x32'),_0x571182[_0x80a4('0x20')]),_0x571182);calls[_0x80a4('0x31')](_0x571182);recordings[_0x80a4('0x31')](_0x571182);dials[_0x80a4('0x31')](_0x571182);agents[_0x80a4('0x31')](_0x571182);queues[_0x80a4('0x31')](_0x571182);}catch(_0x58d71e){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x32'),_0x571182[_0x80a4('0x20')]),_0x58d71e);}});ami['on'](_0x80a4('0x33'),function(_0x3d1c2e){try{utils['debug'](util['format'](_0x80a4('0x34'),_0x3d1c2e[_0x80a4('0x20')]),_0x3d1c2e);members[_0x80a4('0x33')](_0x3d1c2e);}catch(_0x464a13){utils[_0x80a4('0x14')](util[_0x80a4('0x19')]('[%s][index][cdr]',_0x3d1c2e[_0x80a4('0x20')]),_0x464a13);}});ami['on'](_0x80a4('0x35'),function(_0x220974){try{utils[_0x80a4('0x18')](util['format'](_0x80a4('0x36'),_0x220974['uniqueid']),_0x220974);queues[_0x80a4('0x35')](_0x220974);agents[_0x80a4('0x35')](_0x220974);transfers[_0x80a4('0x35')](_0x220974);}catch(_0x38bb97){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x36'),_0x220974[_0x80a4('0x20')]),_0x38bb97);}});ami['on'](_0x80a4('0x37'),function(_0x26f9d4){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x38'),_0x26f9d4[_0x80a4('0x39')]),_0x26f9d4);queues['attendedtransfer'](_0x26f9d4);transfers[_0x80a4('0x37')](_0x26f9d4);agents[_0x80a4('0x37')](_0x26f9d4);calls[_0x80a4('0x37')](_0x26f9d4);}catch(_0x3d20e2){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x38'),_0x26f9d4[_0x80a4('0x39')]),_0x3d20e2);}});ami['on']('varset',function(_0x3c2450){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x3a'),_0x3c2450[_0x80a4('0x20')]),_0x3c2450);queues[_0x80a4('0x3b')](_0x3c2450);recordings['varset'](_0x3c2450);calls[_0x80a4('0x3b')](_0x3c2450);dials[_0x80a4('0x3b')](_0x3c2450);}catch(_0x25bfa1){utils[_0x80a4('0x14')](util['format'](_0x80a4('0x3a'),_0x3c2450[_0x80a4('0x20')]),_0x25bfa1);}});ami['on'](_0x80a4('0x3c'),function(_0x21807d){try{utils['debug'](util[_0x80a4('0x19')](_0x80a4('0x3d'),_0x21807d[_0x80a4('0x20')]),_0x21807d);calls[_0x80a4('0x3c')](_0x21807d);recordings['newexten'](_0x21807d);dials[_0x80a4('0x3c')](_0x21807d);}catch(_0x19c6ed){utils['error'](util[_0x80a4('0x19')]('[%s][index][newexten]',_0x21807d[_0x80a4('0x20')]),_0x19c6ed);}});ami['on']('newchannel',function(_0x8ab25f){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x3e'),_0x8ab25f['uniqueid']),_0x8ab25f);calls[_0x80a4('0x3f')](_0x8ab25f);recordings[_0x80a4('0x3f')](_0x8ab25f);}catch(_0x42f9d0){utils['error'](util[_0x80a4('0x19')](_0x80a4('0x3e'),_0x8ab25f[_0x80a4('0x20')]),_0x42f9d0);}});ami['on'](_0x80a4('0x40'),function(_0x3c3674){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')]('[%s][index][dialbegin]',_0x3c3674[_0x80a4('0x20')]),_0x3c3674);dials['dialbegin'](_0x3c3674);}catch(_0x12b03c){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x41'),_0x3c3674[_0x80a4('0x20')]),_0x12b03c);}});ami['on'](_0x80a4('0x42'),function(_0x308d3a){try{utils[_0x80a4('0x18')](util['format'](_0x80a4('0x43'),_0x308d3a[_0x80a4('0x20')]),_0x308d3a);dials[_0x80a4('0x42')](_0x308d3a);}catch(_0x5327b3){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x43'),_0x308d3a['uniqueid']),_0x5327b3);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 9e5b19f..56bdabb 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 _0xb7fc=['[%s][members][devicestatechange]\x20state:%s\x20interface:%s','INUSE','BUSY','voice','TALKING','now','agent','exitAt','duration','agentcomplete','isNil','[%s][members][agentcomplete]','info','queue','assign','cdr','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','Local/_attended@transfer','Queue:','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','getUserByInterface','internal','CreateMemberReport','getUserByName','split','then','name','request','catch','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device'];(function(_0x141256,_0x189f1e){var _0x2be033=function(_0x28c8e7){while(--_0x28c8e7){_0x141256['push'](_0x141256['shift']());}};_0x2be033(++_0x189f1e);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0xba37ef,_0x555be8){_0xba37ef=_0xba37ef-0x0;var _0x4440c2=_0xb7fc[_0xba37ef];return _0x4440c2;};'use strict';var _=require(_0xcb7f('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0xcb7f('0x1'),_0xcb7f('0x2')];function writeDB(_0x12656f){utils['info'](util['format'](_0xcb7f('0x3'),_0x12656f[_0xcb7f('0x4')],_0x12656f[_0xcb7f('0x5')],_0x12656f[_0xcb7f('0x6')],_0x12656f[_0xcb7f('0x7')],_0x12656f[_0xcb7f('0x8')],_0x12656f['type']));if(_0x12656f[_0xcb7f('0x5')]){utils[_0xcb7f('0x9')](_0x12656f[_0xcb7f('0x5')])['then'](function(_0x160c70){if(_0x160c70){_0x12656f[_0xcb7f('0x8')]=_0x160c70['name'];_0x12656f[_0xcb7f('0xa')]=_0x160c70[_0xcb7f('0xa')];utils['request'](_0xcb7f('0xb'),_0x12656f);}else{utils[_0xcb7f('0xc')](_0x12656f[_0xcb7f('0x5')][_0xcb7f('0xd')]('/')[0x1])[_0xcb7f('0xe')](function(_0x5a0206){if(_0x5a0206){_0x12656f['membername']=_0x5a0206[_0xcb7f('0xf')];_0x12656f[_0xcb7f('0xa')]=_0x5a0206[_0xcb7f('0xa')];utils[_0xcb7f('0x10')](_0xcb7f('0xb'),_0x12656f);}});}})[_0xcb7f('0x11')](function(_0xebcf14){utils[_0xcb7f('0x12')](util[_0xcb7f('0x13')](_0xcb7f('0x14'),_0x12656f[_0xcb7f('0x4')]),_0xebcf14);});}delete members[_0x12656f[_0xcb7f('0x5')]];}function startsWith(_0x3a20c0,_0x281d98){return _[_0xcb7f('0x15')](_0x3a20c0,function(_0x45189d){return _[_0xcb7f('0x16')](_0x281d98,_0x45189d);});}exports[_0xcb7f('0x17')]=function(_0x2c2799){try{utils[_0xcb7f('0x18')](util[_0xcb7f('0x13')](_0xcb7f('0x19'),members[_0x2c2799['device']]?members[_0x2c2799[_0xcb7f('0x1a')]][_0xcb7f('0x4')]:_0x2c2799['device']),_0x2c2799);utils['info'](util[_0xcb7f('0x13')](_0xcb7f('0x1b'),members[_0x2c2799[_0xcb7f('0x1a')]]?members[_0x2c2799['device']]['uniqueid']:_0x2c2799[_0xcb7f('0x1a')],_0x2c2799['state'],_0x2c2799['device']));switch(_0x2c2799['state']){case _0xcb7f('0x1c'):case _0xcb7f('0x1d'):if(!startsWith(exclude,_0x2c2799['device'])){members[_0x2c2799[_0xcb7f('0x1a')]]={'channel':_0xcb7f('0x1e'),'interface':_0x2c2799[_0xcb7f('0x1a')],'type':_0xcb7f('0x1f'),'enterAt':utils[_0xcb7f('0x20')](),'role':_0xcb7f('0x21')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x2c2799[_0xcb7f('0x1a')]])){members[_0x2c2799[_0xcb7f('0x1a')]][_0xcb7f('0x22')]=utils[_0xcb7f('0x20')]();members[_0x2c2799[_0xcb7f('0x1a')]][_0xcb7f('0x23')]=utils['diffTime'](members[_0x2c2799[_0xcb7f('0x1a')]][_0xcb7f('0x22')],members[_0x2c2799[_0xcb7f('0x1a')]]['enterAt']);if(members[_0x2c2799[_0xcb7f('0x1a')]][_0xcb7f('0x4')]){writeDB(members[_0x2c2799[_0xcb7f('0x1a')]]);}}break;default:break;}}catch(_0x57796f){utils[_0xcb7f('0x12')](util['format'](_0xcb7f('0x19'),members[_0x2c2799['device']]?members[_0x2c2799[_0xcb7f('0x1a')]][_0xcb7f('0x4')]:_0x2c2799['device']),_0x57796f);}};exports[_0xcb7f('0x24')]=function(_0x5c0e90){try{if(!_[_0xcb7f('0x25')](members[_0x5c0e90[_0xcb7f('0x5')]])){utils['debug'](util[_0xcb7f('0x13')](_0xcb7f('0x26'),_0x5c0e90[_0xcb7f('0x4')]),_0x5c0e90);utils[_0xcb7f('0x27')](util[_0xcb7f('0x13')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x5c0e90[_0xcb7f('0x4')],_0x5c0e90[_0xcb7f('0x5')],_0x5c0e90[_0xcb7f('0x28')]));members[_0x5c0e90[_0xcb7f('0x5')]]=_[_0xcb7f('0x29')](members[_0x5c0e90[_0xcb7f('0x5')]],{'data4':_0x5c0e90[_0xcb7f('0x28')],'uniqueid':_0x5c0e90[_0xcb7f('0x4')]});}}catch(_0x401f59){utils['error'](util[_0xcb7f('0x13')](_0xcb7f('0x26'),_0x5c0e90['uniqueid']),_0x401f59);}};exports[_0xcb7f('0x2a')]=function(_0x9ec81){try{utils[_0xcb7f('0x18')](util[_0xcb7f('0x13')]('[%s][members][cdr]',_0x9ec81['uniqueid']),_0x9ec81);if(_0x9ec81['channel']){var _0x50c17e=_0x9ec81[_0xcb7f('0x6')][_0xcb7f('0xd')]('-')[0x0];if(!_[_0xcb7f('0x25')](members[_0x50c17e])){members[_0x50c17e]=_[_0xcb7f('0x29')](members[_0x50c17e],{'data1':members[_0x50c17e][_0xcb7f('0x2b')]||_0x9ec81[_0xcb7f('0x2c')],'data2':members[_0x50c17e]['data2']||_0x9ec81[_0xcb7f('0x2d')],'data3':members[_0x50c17e][_0xcb7f('0x2e')]||_0x9ec81[_0xcb7f('0x2f')],'uniqueid':members[_0x50c17e][_0xcb7f('0x4')]||_0x9ec81[_0xcb7f('0x4')]});utils[_0xcb7f('0x27')](util[_0xcb7f('0x13')](_0xcb7f('0x30'),_0x9ec81['uniqueid'],members[_0x50c17e][_0xcb7f('0x2b')],members[_0x50c17e][_0xcb7f('0x7')],members[_0x50c17e]['data3']));if(members[_0x50c17e][_0xcb7f('0x22')]){writeDB(members[_0x50c17e]);}}}if(_0x9ec81['destinationchannel']){var _0x1359ed=_0x9ec81[_0xcb7f('0x31')][_0xcb7f('0xd')]('-')[0x0];if(!_[_0xcb7f('0x25')](members[_0x1359ed])){members[_0x1359ed]=_[_0xcb7f('0x29')](members[_0x1359ed],{'data1':members[_0x1359ed][_0xcb7f('0x2b')]||_0x9ec81[_0xcb7f('0x2c')],'data2':members[_0x1359ed][_0xcb7f('0x7')]||_0x9ec81['source'],'data3':members[_0x1359ed][_0xcb7f('0x2e')]||_0x9ec81[_0xcb7f('0x2f')],'uniqueid':members[_0x1359ed][_0xcb7f('0x4')]||_0x9ec81['uniqueid']});utils[_0xcb7f('0x27')](util[_0xcb7f('0x13')](_0xcb7f('0x30'),_0x9ec81[_0xcb7f('0x4')],members[_0x1359ed][_0xcb7f('0x2b')],members[_0x1359ed][_0xcb7f('0x7')],members[_0x1359ed][_0xcb7f('0x2e')]));if(members[_0x1359ed]['exitAt']){writeDB(members[_0x1359ed]);}}}}catch(_0x7988c){utils['error'](util['format'](_0xcb7f('0x32'),_0x9ec81[_0xcb7f('0x4')]),_0x7988c);}}; \ No newline at end of file +var _0x0851=['internal','request','getUserByName','split','then','CreateMemberReport','[%s][members][writeDB]','some','devicestatechange','debug','[%s][members][devicestatechange]','device','INUSE','BUSY','voice','now','NOT_INUSE','exitAt','duration','diffTime','enterAt','error','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','data3','lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0851,0x8a));var _0x1085=function(_0x2fda94,_0x5ca752){_0x2fda94=_0x2fda94-0x0;var _0x3f769c=_0x0851[_0x2fda94];return _0x3f769c;};'use strict';var _=require(_0x1085('0x0'));var util=require(_0x1085('0x1'));var utils=require(_0x1085('0x2'));var members={};var exclude=[_0x1085('0x3'),'Queue:'];function writeDB(_0x2a93c7){utils[_0x1085('0x4')](util[_0x1085('0x5')](_0x1085('0x6'),_0x2a93c7[_0x1085('0x7')],_0x2a93c7[_0x1085('0x8')],_0x2a93c7[_0x1085('0x9')],_0x2a93c7[_0x1085('0xa')],_0x2a93c7[_0x1085('0xb')],_0x2a93c7[_0x1085('0xc')]));if(_0x2a93c7[_0x1085('0x8')]){utils[_0x1085('0xd')](_0x2a93c7['interface'])['then'](function(_0x114b8b){if(_0x114b8b){_0x2a93c7[_0x1085('0xb')]=_0x114b8b[_0x1085('0xe')];_0x2a93c7[_0x1085('0xf')]=_0x114b8b[_0x1085('0xf')];utils[_0x1085('0x10')]('CreateMemberReport',_0x2a93c7);}else{utils[_0x1085('0x11')](_0x2a93c7[_0x1085('0x8')][_0x1085('0x12')]('/')[0x1])[_0x1085('0x13')](function(_0x43e536){if(_0x43e536){_0x2a93c7[_0x1085('0xb')]=_0x43e536[_0x1085('0xe')];_0x2a93c7[_0x1085('0xf')]=_0x43e536[_0x1085('0xf')];utils[_0x1085('0x10')](_0x1085('0x14'),_0x2a93c7);}});}})['catch'](function(_0xf5fd55){utils['error'](util[_0x1085('0x5')](_0x1085('0x15'),_0x2a93c7[_0x1085('0x7')]),_0xf5fd55);});}delete members[_0x2a93c7['interface']];}function startsWith(_0x334c3a,_0x27b8d9){return _[_0x1085('0x16')](_0x334c3a,function(_0x41e4d7){return _['startsWith'](_0x27b8d9,_0x41e4d7);});}exports[_0x1085('0x17')]=function(_0x4ac3b0){try{utils[_0x1085('0x18')](util['format'](_0x1085('0x19'),members[_0x4ac3b0[_0x1085('0x1a')]]?members[_0x4ac3b0[_0x1085('0x1a')]]['uniqueid']:_0x4ac3b0[_0x1085('0x1a')]),_0x4ac3b0);utils['info'](util[_0x1085('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4ac3b0['device']]?members[_0x4ac3b0['device']]['uniqueid']:_0x4ac3b0[_0x1085('0x1a')],_0x4ac3b0['state'],_0x4ac3b0['device']));switch(_0x4ac3b0['state']){case _0x1085('0x1b'):case _0x1085('0x1c'):if(!startsWith(exclude,_0x4ac3b0[_0x1085('0x1a')])){members[_0x4ac3b0['device']]={'channel':_0x1085('0x1d'),'interface':_0x4ac3b0[_0x1085('0x1a')],'type':'TALKING','enterAt':utils[_0x1085('0x1e')](),'role':'agent'};}break;case _0x1085('0x1f'):if(!_['isNil'](members[_0x4ac3b0[_0x1085('0x1a')]])){members[_0x4ac3b0[_0x1085('0x1a')]][_0x1085('0x20')]=utils['now']();members[_0x4ac3b0[_0x1085('0x1a')]][_0x1085('0x21')]=utils[_0x1085('0x22')](members[_0x4ac3b0['device']][_0x1085('0x20')],members[_0x4ac3b0[_0x1085('0x1a')]][_0x1085('0x23')]);if(members[_0x4ac3b0['device']][_0x1085('0x7')]){writeDB(members[_0x4ac3b0[_0x1085('0x1a')]]);}}break;default:break;}}catch(_0x42d121){utils[_0x1085('0x24')](util[_0x1085('0x5')](_0x1085('0x19'),members[_0x4ac3b0[_0x1085('0x1a')]]?members[_0x4ac3b0[_0x1085('0x1a')]][_0x1085('0x7')]:_0x4ac3b0[_0x1085('0x1a')]),_0x42d121);}};exports[_0x1085('0x25')]=function(_0x5c5ed1){try{if(!_[_0x1085('0x26')](members[_0x5c5ed1[_0x1085('0x8')]])){utils[_0x1085('0x18')](util[_0x1085('0x5')](_0x1085('0x27'),_0x5c5ed1[_0x1085('0x7')]),_0x5c5ed1);utils[_0x1085('0x4')](util[_0x1085('0x5')](_0x1085('0x28'),_0x5c5ed1[_0x1085('0x7')],_0x5c5ed1[_0x1085('0x8')],_0x5c5ed1[_0x1085('0x29')]));members[_0x5c5ed1['interface']]=_[_0x1085('0x2a')](members[_0x5c5ed1[_0x1085('0x8')]],{'data4':_0x5c5ed1['queue'],'uniqueid':_0x5c5ed1[_0x1085('0x7')]});}}catch(_0x1c2d21){utils[_0x1085('0x24')](util[_0x1085('0x5')](_0x1085('0x27'),_0x5c5ed1['uniqueid']),_0x1c2d21);}};exports[_0x1085('0x2b')]=function(_0x26a483){try{utils['debug'](util[_0x1085('0x5')](_0x1085('0x2c'),_0x26a483[_0x1085('0x7')]),_0x26a483);if(_0x26a483[_0x1085('0x9')]){var _0x4f29ea=_0x26a483[_0x1085('0x9')][_0x1085('0x12')]('-')[0x0];if(!_[_0x1085('0x26')](members[_0x4f29ea])){members[_0x4f29ea]=_[_0x1085('0x2a')](members[_0x4f29ea],{'data1':members[_0x4f29ea]['data1']||_0x26a483[_0x1085('0xc')],'data2':members[_0x4f29ea][_0x1085('0xa')]||_0x26a483[_0x1085('0x2d')],'data3':members[_0x4f29ea]['data3']||_0x26a483[_0x1085('0x2e')],'uniqueid':members[_0x4f29ea]['uniqueid']||_0x26a483[_0x1085('0x7')]});utils['info'](util[_0x1085('0x5')](_0x1085('0x2f'),_0x26a483['uniqueid'],members[_0x4f29ea][_0x1085('0x30')],members[_0x4f29ea][_0x1085('0xa')],members[_0x4f29ea]['data3']));if(members[_0x4f29ea][_0x1085('0x20')]){writeDB(members[_0x4f29ea]);}}}if(_0x26a483['destinationchannel']){var _0x4a3efd=_0x26a483[_0x1085('0x31')][_0x1085('0x12')]('-')[0x0];if(!_['isNil'](members[_0x4a3efd])){members[_0x4a3efd]=_[_0x1085('0x2a')](members[_0x4a3efd],{'data1':members[_0x4a3efd][_0x1085('0x30')]||_0x26a483[_0x1085('0xc')],'data2':members[_0x4a3efd][_0x1085('0xa')]||_0x26a483['source'],'data3':members[_0x4a3efd][_0x1085('0x32')]||_0x26a483[_0x1085('0x2e')],'uniqueid':members[_0x4a3efd][_0x1085('0x7')]||_0x26a483[_0x1085('0x7')]});utils[_0x1085('0x4')](util['format'](_0x1085('0x2f'),_0x26a483['uniqueid'],members[_0x4a3efd]['data1'],members[_0x4a3efd][_0x1085('0xa')],members[_0x4a3efd]['data3']));if(members[_0x4a3efd]['exitAt']){writeDB(members[_0x4a3efd]);}}}}catch(_0x502b4d){utils[_0x1085('0x24')](util[_0x1085('0x5')](_0x1085('0x2c'),_0x26a483[_0x1085('0x7')]),_0x502b4d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 7f56669..37e02a7 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 _0x8a46=['count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','accountcode','lastAssignedTo','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','assigned','membername','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt'];(function(_0xbd2a8d,_0x451894){var _0x5dc929=function(_0x19ab60){while(--_0x19ab60){_0xbd2a8d['push'](_0xbd2a8d['shift']());}};_0x5dc929(++_0x451894);}(_0x8a46,0x10f));var _0x68a4=function(_0xeed502,_0x2433bb){_0xeed502=_0xeed502-0x0;var _0x5de0b1=_0x8a46[_0xeed502];return _0x5de0b1;};'use strict';var _=require(_0x68a4('0x0'));var util=require(_0x68a4('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x83e148){utils[_0x68a4('0x2')](util['format'](_0x68a4('0x3'),_0x83e148[_0x68a4('0x4')],_0x83e148[_0x68a4('0x5')],_0x83e148[_0x68a4('0x6')],_0x83e148['lastAssignedTo'],_0x83e148[_0x68a4('0x7')],_0x83e148['accountcode'],_0x83e148[_0x68a4('0x8')]));if(_0x83e148[_0x68a4('0x6')]){utils['getVoiceQueueByName'](_0x83e148['queue'])[_0x68a4('0x9')](function(_0x1d3c64){if(_0x1d3c64){_0x83e148[_0x68a4('0xa')]=_0x1d3c64[_0x68a4('0xa')];}utils[_0x68a4('0xb')](_0x68a4('0xc'),_0x83e148);});}else{utils['request']('CreateVoiceQueueReport',_0x83e148);}if(_0x83e148['transfereduniqueid']){delete queues[_0x83e148[_0x68a4('0xd')]];}else{delete queues[_0x83e148[_0x68a4('0x4')]];}}exports[_0x68a4('0xe')]=function(_0x411628){try{utils['debug'](util[_0x68a4('0xf')](_0x68a4('0x10'),_0x411628[_0x68a4('0x4')]),_0x411628);utils[_0x68a4('0x2')](util[_0x68a4('0xf')](_0x68a4('0x11'),_0x411628[_0x68a4('0x4')],_0x411628['queue'],_0x411628[_0x68a4('0x12')]));queues[_0x411628[_0x68a4('0x4')]]=_[_0x68a4('0x13')](_0x411628,{'originalposition':_0x411628[_0x68a4('0x12')],'queuecallerjoinAt':utils[_0x68a4('0x14')](),'mohtime':0x0});}catch(_0x583b92){utils[_0x68a4('0x15')](util['format'](_0x68a4('0x10'),_0x411628[_0x68a4('0x4')]),_0x583b92);}};exports['hangup']=function(_0x520981){try{if(!_[_0x68a4('0x16')](queues[_0x520981[_0x68a4('0x4')]])){utils[_0x68a4('0x17')](util[_0x68a4('0xf')](_0x68a4('0x18'),_0x520981['uniqueid']),_0x520981);if(queues[_0x520981[_0x68a4('0x4')]][_0x68a4('0x19')]){if(!queues[_0x520981[_0x68a4('0x4')]]['queuecallerabandon']&&!queues[_0x520981[_0x68a4('0x4')]][_0x68a4('0x1a')]){queues[_0x520981[_0x68a4('0x4')]][_0x68a4('0x1b')]=!![];queues[_0x520981[_0x68a4('0x4')]][_0x68a4('0x1c')]=utils[_0x68a4('0x14')]();queues[_0x520981['uniqueid']][_0x68a4('0x8')]=_0x68a4('0x1d');}utils[_0x68a4('0x2')](util[_0x68a4('0xf')](_0x68a4('0x1e'),_0x520981[_0x68a4('0x4')],queues[_0x520981[_0x68a4('0x4')]][_0x68a4('0x1f')],queues[_0x520981['uniqueid']][_0x68a4('0x8')]));writeDB(queues[_0x520981['uniqueid']]);}else if(queues[_0x520981[_0x68a4('0x4')]]['transfereduniqueid']){utils[_0x68a4('0x2')](util['format'](_0x68a4('0x20'),_0x520981[_0x68a4('0x4')],queues[_0x520981[_0x68a4('0x4')]]['name'],queues[_0x520981[_0x68a4('0x4')]]['transfereduniqueid']));queues[queues[_0x520981[_0x68a4('0x4')]][_0x68a4('0xd')]]=queues[_0x520981[_0x68a4('0x4')]];queues[queues[_0x520981[_0x68a4('0x4')]][_0x68a4('0xd')]][_0x68a4('0x21')]=0x2;delete queues[_0x520981['uniqueid']];}}}catch(_0x3d2a0a){utils[_0x68a4('0x15')](util['format'](_0x68a4('0x18'),_0x520981['uniqueid']),_0x3d2a0a);}};exports[_0x68a4('0x22')]=function(_0xe64068){try{utils['debug'](util[_0x68a4('0xf')](_0x68a4('0x23'),_0xe64068[_0x68a4('0x4')]),_0xe64068);if(!_[_0x68a4('0x16')](_0xe64068['variable'][_0x68a4('0x24')])&&_0xe64068[_0x68a4('0x25')][_0x68a4('0x26')]()!==_0x68a4('0x27')){if(!_[_0x68a4('0x16')](queues[_0xe64068[_0x68a4('0x4')]])){queues[_0xe64068[_0x68a4('0x4')]][_0x68a4('0x28')]=![];queues[_0xe64068[_0x68a4('0x4')]][_0x68a4('0x29')]=null;queues[_0xe64068[_0x68a4('0x4')]][_0x68a4('0x1a')]=!![];queues[_0xe64068[_0x68a4('0x4')]][_0x68a4('0x2a')]=utils['now']();queues[_0xe64068[_0x68a4('0x4')]][_0x68a4('0x8')]=_0xe64068[_0x68a4('0x25')][_0x68a4('0x26')]();utils[_0x68a4('0x2')](util[_0x68a4('0xf')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0xe64068[_0x68a4('0x4')],queues[_0xe64068['uniqueid']][_0x68a4('0x1f')],_0xe64068['value'],queues[_0xe64068[_0x68a4('0x4')]][_0x68a4('0x8')]));writeDB(queues[_0xe64068[_0x68a4('0x4')]]);}}else if(!_[_0x68a4('0x16')](_0xe64068['variable'][_0x68a4('0x2b')])){if(!_[_0x68a4('0x16')](queues[_0xe64068[_0x68a4('0x4')]])&&!queues[_0xe64068[_0x68a4('0x4')]]['queuecallerabandon']){queues[_0xe64068[_0x68a4('0x4')]][_0x68a4('0x28')]=![];queues[_0xe64068['uniqueid']][_0x68a4('0x29')]=null;queues[_0xe64068[_0x68a4('0x4')]][_0x68a4('0x1a')]=!![];queues[_0xe64068[_0x68a4('0x4')]]['queuecallerexitAt']=utils[_0x68a4('0x14')]();queues[_0xe64068['uniqueid']][_0x68a4('0x8')]=_0x68a4('0x2c');utils[_0x68a4('0x2')](util[_0x68a4('0xf')](_0x68a4('0x2d'),_0xe64068['uniqueid'],queues[_0xe64068[_0x68a4('0x4')]][_0x68a4('0x1f')],_0xe64068[_0x68a4('0x25')],queues[_0xe64068[_0x68a4('0x4')]][_0x68a4('0x8')]));}}}catch(_0x12bd17){utils['error'](util[_0x68a4('0xf')](_0x68a4('0x23'),_0xe64068[_0x68a4('0x4')]),_0x12bd17);}};exports[_0x68a4('0x28')]=function(_0x31de37){try{if(!_['isNil'](queues[_0x31de37[_0x68a4('0x4')]])){utils[_0x68a4('0x17')](util[_0x68a4('0xf')](_0x68a4('0x2e'),_0x31de37['uniqueid']),_0x31de37);queues[_0x31de37[_0x68a4('0x4')]]['queuecallerexit']=![];queues[_0x31de37[_0x68a4('0x4')]][_0x68a4('0x2a')]=null;queues[_0x31de37[_0x68a4('0x4')]][_0x68a4('0x28')]=!![];queues[_0x31de37[_0x68a4('0x4')]][_0x68a4('0x29')]=utils[_0x68a4('0x14')]();queues[_0x31de37[_0x68a4('0x4')]][_0x68a4('0x8')]='ABANDONED';utils[_0x68a4('0x2')](util['format'](_0x68a4('0x2f'),_0x31de37[_0x68a4('0x4')],queues[_0x31de37[_0x68a4('0x4')]][_0x68a4('0x1f')],queues[_0x31de37[_0x68a4('0x4')]][_0x68a4('0x8')]));}}catch(_0x3ccee6){utils['error'](util[_0x68a4('0xf')](_0x68a4('0x2e'),_0x31de37[_0x68a4('0x4')]),_0x3ccee6);}};exports['queuecallerleave']=function(_0x2e448e){try{if(!_[_0x68a4('0x16')](queues[_0x2e448e[_0x68a4('0x4')]])){utils[_0x68a4('0x17')](util[_0x68a4('0xf')](_0x68a4('0x30'),_0x2e448e['uniqueid']),_0x2e448e);utils[_0x68a4('0x2')](util[_0x68a4('0xf')](_0x68a4('0x31'),_0x2e448e[_0x68a4('0x4')],queues[_0x2e448e[_0x68a4('0x4')]]['name'],_0x2e448e[_0x68a4('0x32')],_0x2e448e[_0x68a4('0x33')]));queues[_0x2e448e[_0x68a4('0x4')]][_0x68a4('0x34')]=!![];queues[_0x2e448e[_0x68a4('0x4')]][_0x68a4('0x19')]=utils[_0x68a4('0x14')]();queues[_0x2e448e[_0x68a4('0x4')]][_0x68a4('0x35')]=utils[_0x68a4('0x36')](queues[_0x2e448e[_0x68a4('0x4')]][_0x68a4('0x19')],queues[_0x2e448e[_0x68a4('0x4')]][_0x68a4('0x37')]);queues[_0x2e448e[_0x68a4('0x4')]][_0x68a4('0x12')]=_0x2e448e[_0x68a4('0x12')];queues[_0x2e448e['uniqueid']][_0x68a4('0x38')]=_0x2e448e['count'];queues[_0x2e448e[_0x68a4('0x4')]][_0x68a4('0x32')]=_0x2e448e[_0x68a4('0x32')];queues[_0x2e448e['uniqueid']]['connectedlinename']=_0x2e448e[_0x68a4('0x33')];}}catch(_0x4da9b0){utils['error'](util['format'](_0x68a4('0x30'),_0x2e448e[_0x68a4('0x4')]),_0x4da9b0);}};exports[_0x68a4('0x39')]=function(_0x3522a0){try{if(!_[_0x68a4('0x16')](queues[_0x3522a0[_0x68a4('0x4')]])){utils[_0x68a4('0x17')](util['format']('[%s][queues][agentconnect]',_0x3522a0['uniqueid']),_0x3522a0);utils[_0x68a4('0x2')](util[_0x68a4('0xf')](_0x68a4('0x3a'),_0x3522a0[_0x68a4('0x4')],queues[_0x3522a0['uniqueid']][_0x68a4('0x1f')],_0x3522a0['membername'],_0x3522a0[_0x68a4('0x3b')]));queues[_0x3522a0['uniqueid']]['queuecallerabandon']=![];queues[_0x3522a0[_0x68a4('0x4')]][_0x68a4('0x28')]=![];queues[_0x3522a0[_0x68a4('0x4')]]['queuecallerabandonAt']=null;queues[_0x3522a0[_0x68a4('0x4')]][_0x68a4('0x1a')]=![];queues[_0x3522a0[_0x68a4('0x4')]][_0x68a4('0x8')]=null;queues[_0x3522a0['uniqueid']][_0x68a4('0x2a')]=null;queues[_0x3522a0[_0x68a4('0x4')]]['assigned']=!![];queues[_0x3522a0[_0x68a4('0x4')]][_0x68a4('0x3c')]=_0x3522a0[_0x68a4('0x3b')];queues[_0x3522a0[_0x68a4('0x4')]][_0x68a4('0x3d')]=_0x3522a0['membername'];}}catch(_0x23d8dc){utils[_0x68a4('0x15')](util[_0x68a4('0xf')](_0x68a4('0x3e'),_0x3522a0['uniqueid']),_0x23d8dc);}};exports[_0x68a4('0x3f')]=function(_0x21a011){try{if(!_[_0x68a4('0x16')](queues[_0x21a011[_0x68a4('0x4')]])){if(queues[_0x21a011[_0x68a4('0x4')]][_0x68a4('0x19')]){utils[_0x68a4('0x17')](util[_0x68a4('0xf')](_0x68a4('0x40'),_0x21a011[_0x68a4('0x4')]),_0x21a011);queues[_0x21a011[_0x68a4('0x4')]][_0x68a4('0x28')]=![];queues[_0x21a011['uniqueid']][_0x68a4('0x28')]=![];queues[_0x21a011[_0x68a4('0x4')]]['queuecallerabandonAt']=null;queues[_0x21a011[_0x68a4('0x4')]][_0x68a4('0x1a')]=![];queues[_0x21a011['uniqueid']][_0x68a4('0x2a')]=null;queues[_0x21a011[_0x68a4('0x4')]][_0x68a4('0x41')]=!![];queues[_0x21a011[_0x68a4('0x4')]][_0x68a4('0x3d')]=_0x21a011[_0x68a4('0x42')];queues[_0x21a011[_0x68a4('0x4')]][_0x68a4('0x1b')]=!![];queues[_0x21a011[_0x68a4('0x4')]][_0x68a4('0x1c')]=utils[_0x68a4('0x14')]();if(_0x21a011[_0x68a4('0x43')]=='transfer'){if(!queues[_0x21a011[_0x68a4('0x4')]][_0x68a4('0x44')]){queues[_0x21a011['uniqueid']]['queuecallerexitreason']=_0x68a4('0x45');}}else{queues[_0x21a011[_0x68a4('0x4')]][_0x68a4('0x8')]='COMPLETEDBY'+_0x21a011[_0x68a4('0x43')][_0x68a4('0x26')]();}utils[_0x68a4('0x2')](util[_0x68a4('0xf')](_0x68a4('0x46'),_0x21a011[_0x68a4('0x4')],queues[_0x21a011[_0x68a4('0x4')]]['name'],_0x21a011[_0x68a4('0x42')],queues[_0x21a011['uniqueid']][_0x68a4('0x8')]));writeDB(queues[_0x21a011[_0x68a4('0x4')]]);}}}catch(_0xe4d253){utils[_0x68a4('0x15')](util[_0x68a4('0xf')](_0x68a4('0x40'),_0x21a011[_0x68a4('0x4')]),_0xe4d253);}};exports[_0x68a4('0x47')]=function(_0xba24c2){try{if(!_['isNil'](queues[_0xba24c2[_0x68a4('0x48')]])){utils[_0x68a4('0x17')](util['format'](_0x68a4('0x49'),_0xba24c2[_0x68a4('0x4')]),_0xba24c2);queues[_0xba24c2[_0x68a4('0x48')]][_0x68a4('0x44')]=!![];queues[_0xba24c2['transfereeuniqueid']][_0x68a4('0x4a')]=_0x68a4('0x4b');queues[_0xba24c2[_0x68a4('0x48')]][_0x68a4('0x4c')]=_0xba24c2[_0x68a4('0x4d')];queues[_0xba24c2[_0x68a4('0x48')]][_0x68a4('0x4e')]=_0xba24c2[_0x68a4('0x48')];queues[_0xba24c2[_0x68a4('0x48')]][_0x68a4('0x8')]=_0x68a4('0x4f');utils[_0x68a4('0x2')](util[_0x68a4('0xf')](_0x68a4('0x50'),_0xba24c2[_0x68a4('0x4')],queues[_0xba24c2['transfereeuniqueid']][_0x68a4('0x1f')],_0xba24c2[_0x68a4('0x48')],_0xba24c2[_0x68a4('0x4d')]));}}catch(_0x2ecd47){utils[_0x68a4('0x15')](util[_0x68a4('0xf')](_0x68a4('0x49'),_0xba24c2[_0x68a4('0x4')]),_0x2ecd47);}};exports[_0x68a4('0x51')]=function(_0x5a5b37){try{utils[_0x68a4('0x17')](util[_0x68a4('0xf')](_0x68a4('0x52'),_0x5a5b37[_0x68a4('0x53')]),_0x5a5b37);if(_0x5a5b37['origtransfereruniqueid']==_0x5a5b37[_0x68a4('0x54')]){if(!_['isNil'](queues[_0x5a5b37[_0x68a4('0x55')]])){utils[_0x68a4('0x2')](util[_0x68a4('0xf')](_0x68a4('0x56'),_0x5a5b37[_0x68a4('0x53')],queues[_0x5a5b37[_0x68a4('0x55')]][_0x68a4('0x1f')],_0x5a5b37[_0x68a4('0x57')]));queues[_0x5a5b37['secondtransfererlinkedid']][_0x68a4('0x44')]=!![];queues[_0x5a5b37[_0x68a4('0x55')]][_0x68a4('0x4a')]='ATTENDED';queues[_0x5a5b37[_0x68a4('0x55')]]['transferexten']=_0x5a5b37[_0x68a4('0x57')];queues[_0x5a5b37['secondtransfererlinkedid']][_0x68a4('0x4e')]=_0x5a5b37['origtransfereruniqueid'];queues[_0x5a5b37[_0x68a4('0x55')]][_0x68a4('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x68a4('0x16')](queues[_0x5a5b37[_0x68a4('0x54')]])){if(_0x5a5b37[_0x68a4('0x58')]&&queues[_0x5a5b37[_0x68a4('0x58')]]){queues[_0x5a5b37[_0x68a4('0x58')]][_0x68a4('0x21')]=0x1;queues[_0x5a5b37[_0x68a4('0x48')]]=_[_0x68a4('0x59')](queues[_0x5a5b37['transfereelinkedid']]);queues[_0x5a5b37[_0x68a4('0x48')]][_0x68a4('0xd')]=_0x5a5b37[_0x68a4('0x5a')];queues[_0x5a5b37[_0x68a4('0x48')]][_0x68a4('0x21')]=0x2;queues[_0x5a5b37[_0x68a4('0x48')]][_0x68a4('0x7')]=queues[_0x5a5b37['secondtransfererlinkedid']][_0x68a4('0x7')];queues[_0x5a5b37[_0x68a4('0x48')]][_0x68a4('0x5b')]=queues[_0x5a5b37[_0x68a4('0x55')]][_0x68a4('0x5b')];queues[_0x5a5b37['transfereeuniqueid']][_0x68a4('0x37')]=utils['now']();queues[_0x5a5b37[_0x68a4('0x48')]][_0x68a4('0x19')]=utils[_0x68a4('0x14')]();queues[_0x5a5b37[_0x68a4('0x48')]][_0x68a4('0x35')]=0x0;queues[_0x5a5b37[_0x68a4('0x48')]][_0x68a4('0x5c')]=0x0;utils[_0x68a4('0x2')](util[_0x68a4('0xf')](_0x68a4('0x5d'),_0x5a5b37[_0x68a4('0x53')],queues[_0x5a5b37[_0x68a4('0x48')]][_0x68a4('0x1f')],queues[_0x5a5b37[_0x68a4('0x48')]][_0x68a4('0x7')],queues[_0x5a5b37[_0x68a4('0x48')]]['calleridname']));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5a5b37[_0x68a4('0x53')],queues[_0x5a5b37[_0x68a4('0x54')]][_0x68a4('0x1f')],_0x5a5b37['secondtransfererlinkedid']));queues[_0x5a5b37[_0x68a4('0x54')]][_0x68a4('0xd')]=_0x5a5b37['secondtransfererlinkedid'];}}}else if(_0x5a5b37['secondtransfereruniqueid']==_0x5a5b37[_0x68a4('0x55')]){if(!_['isNil'](queues[_0x5a5b37[_0x68a4('0x54')]])){utils[_0x68a4('0x2')](util['format'](_0x68a4('0x5e'),_0x5a5b37[_0x68a4('0x53')],queues[_0x5a5b37[_0x68a4('0x54')]][_0x68a4('0x1f')],_0x5a5b37[_0x68a4('0x5f')],_0x5a5b37[_0x68a4('0x60')]));queues[_0x5a5b37[_0x68a4('0x54')]][_0x68a4('0x44')]=!![];queues[_0x5a5b37[_0x68a4('0x54')]][_0x68a4('0x4a')]=_0x68a4('0x61');queues[_0x5a5b37[_0x68a4('0x54')]][_0x68a4('0x4c')]=_0x5a5b37[_0x68a4('0x60')];queues[_0x5a5b37[_0x68a4('0x54')]][_0x68a4('0x4e')]=_0x5a5b37[_0x68a4('0x5f')];queues[_0x5a5b37['origtransfererlinkedid']][_0x68a4('0x8')]=_0x68a4('0x62');}if(!_['isNil'](queues[_0x5a5b37['secondtransfererlinkedid']])){if(_0x5a5b37['transfertargetlinkedid']&&queues[_0x5a5b37[_0x68a4('0x63')]]){queues[_0x5a5b37['transfertargetlinkedid']][_0x68a4('0x21')]=0x1;queues[_0x5a5b37[_0x68a4('0x5a')]]=_[_0x68a4('0x59')](queues[_0x5a5b37[_0x68a4('0x63')]]);queues[_0x5a5b37[_0x68a4('0x5a')]][_0x68a4('0xd')]=_0x5a5b37[_0x68a4('0x5a')];queues[_0x5a5b37[_0x68a4('0x5a')]][_0x68a4('0x21')]=0x2;queues[_0x5a5b37[_0x68a4('0x5a')]][_0x68a4('0x7')]=queues[_0x5a5b37[_0x68a4('0x54')]][_0x68a4('0x7')];queues[_0x5a5b37[_0x68a4('0x5a')]]['calleridname']=queues[_0x5a5b37[_0x68a4('0x54')]]['calleridname'];queues[_0x5a5b37['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x68a4('0x14')]();queues[_0x5a5b37[_0x68a4('0x5a')]][_0x68a4('0x19')]=utils['now']();queues[_0x5a5b37[_0x68a4('0x5a')]][_0x68a4('0x35')]=0x0;queues[_0x5a5b37['transfertargetuniqueid']][_0x68a4('0x5c')]=0x0;utils[_0x68a4('0x2')](util['format'](_0x68a4('0x64'),_0x5a5b37[_0x68a4('0x53')],queues[_0x5a5b37[_0x68a4('0x5a')]]['name'],queues[_0x5a5b37['transfertargetuniqueid']][_0x68a4('0xd')],queues[_0x5a5b37['transfertargetuniqueid']][_0x68a4('0x7')],queues[_0x5a5b37[_0x68a4('0x5a')]][_0x68a4('0x5b')]));}else{utils['info'](util[_0x68a4('0xf')](_0x68a4('0x65'),_0x5a5b37[_0x68a4('0x53')],queues[_0x5a5b37[_0x68a4('0x55')]][_0x68a4('0x1f')],_0x5a5b37[_0x68a4('0x54')]));queues[_0x5a5b37[_0x68a4('0x55')]][_0x68a4('0xd')]=_0x5a5b37['origtransfererlinkedid'];}}}}catch(_0x3609b7){utils[_0x68a4('0x15')](util[_0x68a4('0xf')]('[%s][queues][attendedtransfer]',_0x5a5b37[_0x68a4('0x53')]),_0x3609b7);}};exports[_0x68a4('0x66')]=function(_0x258715){try{if(!_[_0x68a4('0x16')](queues[_0x258715[_0x68a4('0x4')]])){utils['debug'](util[_0x68a4('0xf')](_0x68a4('0x67'),_0x258715[_0x68a4('0x4')]),_0x258715);queues[_0x258715[_0x68a4('0x4')]][_0x68a4('0x68')]=utils[_0x68a4('0x14')]();utils[_0x68a4('0x2')](util[_0x68a4('0xf')](_0x68a4('0x69'),_0x258715[_0x68a4('0x4')],queues[_0x258715['uniqueid']][_0x68a4('0x1f')],queues[_0x258715[_0x68a4('0x4')]][_0x68a4('0x68')]));}}catch(_0x23736f){utils[_0x68a4('0x15')](util[_0x68a4('0xf')](_0x68a4('0x67'),_0x258715[_0x68a4('0x4')]),_0x23736f);}};exports[_0x68a4('0x6a')]=function(_0x3d13ac){try{if(!_[_0x68a4('0x16')](queues[_0x3d13ac[_0x68a4('0x4')]])){if(!_[_0x68a4('0x16')](queues[_0x3d13ac['uniqueid']]['musiconholdstartAt'])){utils[_0x68a4('0x17')](util['format']('[%s][queues][musiconholdstop]',_0x3d13ac['uniqueid']),_0x3d13ac);queues[_0x3d13ac['uniqueid']][_0x68a4('0x5c')]+=utils[_0x68a4('0x36')](utils['now'](),queues[_0x3d13ac['uniqueid']][_0x68a4('0x68')]);utils['info'](util[_0x68a4('0xf')](_0x68a4('0x6b'),_0x3d13ac[_0x68a4('0x4')],queues[_0x3d13ac[_0x68a4('0x4')]][_0x68a4('0x1f')],queues[_0x3d13ac[_0x68a4('0x4')]][_0x68a4('0x5c')]));delete queues[_0x3d13ac[_0x68a4('0x4')]]['musiconholdstartAt'];}}}catch(_0x38e215){utils[_0x68a4('0x15')](util[_0x68a4('0xf')](_0x68a4('0x6c'),_0x3d13ac[_0x68a4('0x4')]),_0x38e215);}}; \ No newline at end of file +var _0x550c=['[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','[%s][queues][varset]','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','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','ATTENDED','transfertargetlinkedid'];(function(_0x5d6cfe,_0x348c1c){var _0x1addde=function(_0x63aee9){while(--_0x63aee9){_0x5d6cfe['push'](_0x5d6cfe['shift']());}};_0x1addde(++_0x348c1c);}(_0x550c,0x71));var _0xc550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc550('0x0'));var util=require(_0xc550('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x24eaeb){utils['info'](util['format'](_0xc550('0x2'),_0x24eaeb[_0xc550('0x3')],_0x24eaeb['channel'],_0x24eaeb[_0xc550('0x4')],_0x24eaeb[_0xc550('0x5')],_0x24eaeb[_0xc550('0x6')],_0x24eaeb[_0xc550('0x7')],_0x24eaeb[_0xc550('0x8')]));if(_0x24eaeb['queue']){utils[_0xc550('0x9')](_0x24eaeb[_0xc550('0x4')])[_0xc550('0xa')](function(_0x3e8461){if(_0x3e8461){_0x24eaeb[_0xc550('0xb')]=_0x3e8461[_0xc550('0xb')];}utils[_0xc550('0xc')](_0xc550('0xd'),_0x24eaeb);});}else{utils['request']('CreateVoiceQueueReport',_0x24eaeb);}if(_0x24eaeb[_0xc550('0xe')]){delete queues[_0x24eaeb['transfereduniqueid']];}else{delete queues[_0x24eaeb['uniqueid']];}}exports[_0xc550('0xf')]=function(_0x3da3a5){try{utils[_0xc550('0x10')](util[_0xc550('0x11')](_0xc550('0x12'),_0x3da3a5['uniqueid']),_0x3da3a5);utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x14'),_0x3da3a5[_0xc550('0x3')],_0x3da3a5['queue'],_0x3da3a5[_0xc550('0x15')]));queues[_0x3da3a5[_0xc550('0x3')]]=_[_0xc550('0x16')](_0x3da3a5,{'originalposition':_0x3da3a5[_0xc550('0x15')],'queuecallerjoinAt':utils[_0xc550('0x17')](),'mohtime':0x0});}catch(_0x2f9dff){utils['error'](util[_0xc550('0x11')]('[%s][queues][queuecallerjoin]',_0x3da3a5[_0xc550('0x3')]),_0x2f9dff);}};exports[_0xc550('0x18')]=function(_0x46cbdc){try{if(!_[_0xc550('0x19')](queues[_0x46cbdc[_0xc550('0x3')]])){utils[_0xc550('0x10')](util[_0xc550('0x11')](_0xc550('0x1a'),_0x46cbdc[_0xc550('0x3')]),_0x46cbdc);if(queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x1b')]){if(!queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x1c')]&&!queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x1d')]){queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x1e')]=!![];queues[_0x46cbdc['uniqueid']][_0xc550('0x1f')]=utils[_0xc550('0x17')]();queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x8')]=_0xc550('0x20');}utils[_0xc550('0x13')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x46cbdc[_0xc550('0x3')],queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x21')],queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x8')]));writeDB(queues[_0x46cbdc[_0xc550('0x3')]]);}else if(queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0xe')]){utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x22'),_0x46cbdc[_0xc550('0x3')],queues[_0x46cbdc['uniqueid']][_0xc550('0x21')],queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0xe')]));queues[queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0xe')]]=queues[_0x46cbdc['uniqueid']];queues[queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0xe')]][_0xc550('0x23')]=0x2;delete queues[_0x46cbdc[_0xc550('0x3')]];}}}catch(_0x42084d){utils[_0xc550('0x24')](util[_0xc550('0x11')](_0xc550('0x1a'),_0x46cbdc[_0xc550('0x3')]),_0x42084d);}};exports['varset']=function(_0x382dd8){try{utils['debug'](util['format'](_0xc550('0x25'),_0x382dd8[_0xc550('0x3')]),_0x382dd8);if(!_[_0xc550('0x19')](_0x382dd8['variable']['queuestatus'])&&_0x382dd8[_0xc550('0x26')][_0xc550('0x27')]()!==_0xc550('0x28')){if(!_[_0xc550('0x19')](queues[_0x382dd8[_0xc550('0x3')]])){queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x1c')]=![];queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x29')]=null;queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x1d')]=!![];queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x2a')]=utils[_0xc550('0x17')]();queues[_0x382dd8['uniqueid']][_0xc550('0x8')]=_0x382dd8['value'][_0xc550('0x27')]();utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x2b'),_0x382dd8[_0xc550('0x3')],queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x21')],_0x382dd8[_0xc550('0x26')],queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x8')]));writeDB(queues[_0x382dd8[_0xc550('0x3')]]);}}else if(!_[_0xc550('0x19')](_0x382dd8[_0xc550('0x2c')][_0xc550('0x2d')])){if(!_[_0xc550('0x19')](queues[_0x382dd8[_0xc550('0x3')]])&&!queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x1c')]){queues[_0x382dd8['uniqueid']][_0xc550('0x1c')]=![];queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x29')]=null;queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x1d')]=!![];queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x2a')]=utils['now']();queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x8')]=_0xc550('0x2e');utils['info'](util[_0xc550('0x11')](_0xc550('0x2f'),_0x382dd8['uniqueid'],queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x21')],_0x382dd8[_0xc550('0x26')],queues[_0x382dd8['uniqueid']][_0xc550('0x8')]));}}}catch(_0x13fef0){utils[_0xc550('0x24')](util['format'](_0xc550('0x25'),_0x382dd8[_0xc550('0x3')]),_0x13fef0);}};exports[_0xc550('0x1c')]=function(_0x287fd6){try{if(!_[_0xc550('0x19')](queues[_0x287fd6[_0xc550('0x3')]])){utils[_0xc550('0x10')](util[_0xc550('0x11')]('[%s][queues][queuecallerabandon]',_0x287fd6[_0xc550('0x3')]),_0x287fd6);queues[_0x287fd6[_0xc550('0x3')]][_0xc550('0x1d')]=![];queues[_0x287fd6[_0xc550('0x3')]][_0xc550('0x2a')]=null;queues[_0x287fd6[_0xc550('0x3')]][_0xc550('0x1c')]=!![];queues[_0x287fd6['uniqueid']][_0xc550('0x29')]=utils[_0xc550('0x17')]();queues[_0x287fd6[_0xc550('0x3')]][_0xc550('0x8')]=_0xc550('0x30');utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x31'),_0x287fd6[_0xc550('0x3')],queues[_0x287fd6[_0xc550('0x3')]]['name'],queues[_0x287fd6[_0xc550('0x3')]]['queuecallerexitreason']));}}catch(_0x649b52){utils[_0xc550('0x24')](util[_0xc550('0x11')](_0xc550('0x32'),_0x287fd6[_0xc550('0x3')]),_0x649b52);}};exports[_0xc550('0x33')]=function(_0x47852a){try{if(!_[_0xc550('0x19')](queues[_0x47852a[_0xc550('0x3')]])){utils[_0xc550('0x10')](util[_0xc550('0x11')]('[%s][queues][queuecallerleave]',_0x47852a[_0xc550('0x3')]),_0x47852a);utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x34'),_0x47852a[_0xc550('0x3')],queues[_0x47852a['uniqueid']][_0xc550('0x21')],_0x47852a[_0xc550('0x35')],_0x47852a[_0xc550('0x36')]));queues[_0x47852a[_0xc550('0x3')]][_0xc550('0x33')]=!![];queues[_0x47852a[_0xc550('0x3')]][_0xc550('0x1b')]=utils['now']();queues[_0x47852a['uniqueid']][_0xc550('0x37')]=utils[_0xc550('0x38')](queues[_0x47852a[_0xc550('0x3')]]['queuecallerleaveAt'],queues[_0x47852a[_0xc550('0x3')]][_0xc550('0x39')]);queues[_0x47852a['uniqueid']]['position']=_0x47852a[_0xc550('0x15')];queues[_0x47852a[_0xc550('0x3')]]['count']=_0x47852a[_0xc550('0x3a')];queues[_0x47852a['uniqueid']][_0xc550('0x35')]=_0x47852a['connectedlinenum'];queues[_0x47852a[_0xc550('0x3')]][_0xc550('0x36')]=_0x47852a[_0xc550('0x36')];}}catch(_0x5319b4){utils[_0xc550('0x24')](util['format']('[%s][queues][queuecallerleave]',_0x47852a[_0xc550('0x3')]),_0x5319b4);}};exports[_0xc550('0x3b')]=function(_0x36a3ec){try{if(!_[_0xc550('0x19')](queues[_0x36a3ec[_0xc550('0x3')]])){utils[_0xc550('0x10')](util[_0xc550('0x11')](_0xc550('0x3c'),_0x36a3ec['uniqueid']),_0x36a3ec);utils[_0xc550('0x13')](util['format'](_0xc550('0x3d'),_0x36a3ec['uniqueid'],queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x21')],_0x36a3ec[_0xc550('0x3e')],_0x36a3ec[_0xc550('0x3f')]));queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x1c')]=![];queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x1c')]=![];queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x29')]=null;queues[_0x36a3ec['uniqueid']]['queuecallerexit']=![];queues[_0x36a3ec[_0xc550('0x3')]]['queuecallerexitreason']=null;queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x2a')]=null;queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x40')]=!![];queues[_0x36a3ec[_0xc550('0x3')]]['accountcode']=_0x36a3ec[_0xc550('0x3f')];queues[_0x36a3ec['uniqueid']][_0xc550('0x5')]=_0x36a3ec[_0xc550('0x3e')];}}catch(_0x52025a){utils[_0xc550('0x24')](util[_0xc550('0x11')](_0xc550('0x3c'),_0x36a3ec['uniqueid']),_0x52025a);}};exports[_0xc550('0x41')]=function(_0x88afff){try{if(!_['isNil'](queues[_0x88afff['uniqueid']])){if(queues[_0x88afff[_0xc550('0x3')]]['queuecallerleaveAt']){utils['debug'](util[_0xc550('0x11')](_0xc550('0x42'),_0x88afff[_0xc550('0x3')]),_0x88afff);queues[_0x88afff[_0xc550('0x3')]]['queuecallerabandon']=![];queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x1c')]=![];queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x29')]=null;queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x1d')]=![];queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x2a')]=null;queues[_0x88afff[_0xc550('0x3')]]['assigned']=!![];queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x5')]=_0x88afff[_0xc550('0x3e')];queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x1e')]=!![];queues[_0x88afff[_0xc550('0x3')]]['queuecallercompleteAt']=utils[_0xc550('0x17')]();if(_0x88afff[_0xc550('0x43')]==_0xc550('0x44')){if(!queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x44')]){queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x8')]=_0xc550('0x45');}}else{queues[_0x88afff[_0xc550('0x3')]]['queuecallerexitreason']='COMPLETEDBY'+_0x88afff[_0xc550('0x43')][_0xc550('0x27')]();}utils['info'](util['format'](_0xc550('0x46'),_0x88afff[_0xc550('0x3')],queues[_0x88afff['uniqueid']][_0xc550('0x21')],_0x88afff[_0xc550('0x3e')],queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x8')]));writeDB(queues[_0x88afff['uniqueid']]);}}}catch(_0x53a2a3){utils[_0xc550('0x24')](util[_0xc550('0x11')](_0xc550('0x42'),_0x88afff['uniqueid']),_0x53a2a3);}};exports[_0xc550('0x47')]=function(_0x3a4cac){try{if(!_['isNil'](queues[_0x3a4cac[_0xc550('0x48')]])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x3a4cac[_0xc550('0x3')]),_0x3a4cac);queues[_0x3a4cac[_0xc550('0x48')]][_0xc550('0x44')]=!![];queues[_0x3a4cac[_0xc550('0x48')]][_0xc550('0x49')]='BLIND';queues[_0x3a4cac[_0xc550('0x48')]][_0xc550('0x4a')]=_0x3a4cac[_0xc550('0x4b')];queues[_0x3a4cac[_0xc550('0x48')]]['transferuniqueid']=_0x3a4cac[_0xc550('0x48')];queues[_0x3a4cac[_0xc550('0x48')]][_0xc550('0x8')]=_0xc550('0x4c');utils[_0xc550('0x13')](util[_0xc550('0x11')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3a4cac[_0xc550('0x3')],queues[_0x3a4cac[_0xc550('0x48')]][_0xc550('0x21')],_0x3a4cac[_0xc550('0x48')],_0x3a4cac[_0xc550('0x4b')]));}}catch(_0x578636){utils[_0xc550('0x24')](util[_0xc550('0x11')]('[%s][queues][blindtransfer]',_0x3a4cac['uniqueid']),_0x578636);}};exports[_0xc550('0x4d')]=function(_0x1741f7){try{utils[_0xc550('0x10')](util[_0xc550('0x11')]('[%s][queues][attendedtransfer]',_0x1741f7[_0xc550('0x4e')]),_0x1741f7);if(_0x1741f7[_0xc550('0x4e')]==_0x1741f7[_0xc550('0x4f')]){if(!_['isNil'](queues[_0x1741f7['secondtransfererlinkedid']])){utils[_0xc550('0x13')](util['format'](_0xc550('0x50'),_0x1741f7[_0xc550('0x4e')],queues[_0x1741f7[_0xc550('0x51')]]['name'],_0x1741f7[_0xc550('0x52')]));queues[_0x1741f7['secondtransfererlinkedid']][_0xc550('0x44')]=!![];queues[_0x1741f7[_0xc550('0x51')]][_0xc550('0x49')]='ATTENDED';queues[_0x1741f7[_0xc550('0x51')]]['transferexten']=_0x1741f7['origtransfererexten'];queues[_0x1741f7[_0xc550('0x51')]][_0xc550('0x53')]=_0x1741f7[_0xc550('0x4e')];queues[_0x1741f7['secondtransfererlinkedid']][_0xc550('0x8')]=_0xc550('0x54');}if(!_[_0xc550('0x19')](queues[_0x1741f7[_0xc550('0x4f')]])){if(_0x1741f7[_0xc550('0x55')]&&queues[_0x1741f7[_0xc550('0x55')]]){queues[_0x1741f7['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x1741f7[_0xc550('0x48')]]=_[_0xc550('0x56')](queues[_0x1741f7[_0xc550('0x55')]]);queues[_0x1741f7['transfereeuniqueid']][_0xc550('0xe')]=_0x1741f7[_0xc550('0x57')];queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x23')]=0x2;queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x6')]=queues[_0x1741f7[_0xc550('0x51')]][_0xc550('0x6')];queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x58')]=queues[_0x1741f7[_0xc550('0x51')]][_0xc550('0x58')];queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x39')]=utils[_0xc550('0x17')]();queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x1b')]=utils[_0xc550('0x17')]();queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x37')]=0x0;queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x59')]=0x0;utils[_0xc550('0x13')](util['format'](_0xc550('0x5a'),_0x1741f7[_0xc550('0x4e')],queues[_0x1741f7['transfereeuniqueid']][_0xc550('0x21')],queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x6')],queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x58')]));}else{utils['info'](util[_0xc550('0x11')](_0xc550('0x5b'),_0x1741f7['origtransfereruniqueid'],queues[_0x1741f7['origtransfererlinkedid']][_0xc550('0x21')],_0x1741f7[_0xc550('0x51')]));queues[_0x1741f7['origtransfererlinkedid']][_0xc550('0xe')]=_0x1741f7[_0xc550('0x51')];}}}else if(_0x1741f7[_0xc550('0x5c')]==_0x1741f7[_0xc550('0x51')]){if(!_[_0xc550('0x19')](queues[_0x1741f7[_0xc550('0x4f')]])){utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x5d'),_0x1741f7[_0xc550('0x4e')],queues[_0x1741f7[_0xc550('0x4f')]]['name'],_0x1741f7[_0xc550('0x5c')],_0x1741f7[_0xc550('0x5e')]));queues[_0x1741f7[_0xc550('0x4f')]][_0xc550('0x44')]=!![];queues[_0x1741f7[_0xc550('0x4f')]][_0xc550('0x49')]=_0xc550('0x5f');queues[_0x1741f7[_0xc550('0x4f')]][_0xc550('0x4a')]=_0x1741f7[_0xc550('0x5e')];queues[_0x1741f7[_0xc550('0x4f')]][_0xc550('0x53')]=_0x1741f7[_0xc550('0x5c')];queues[_0x1741f7[_0xc550('0x4f')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x1741f7[_0xc550('0x51')]])){if(_0x1741f7[_0xc550('0x60')]&&queues[_0x1741f7[_0xc550('0x60')]]){queues[_0x1741f7[_0xc550('0x60')]][_0xc550('0x23')]=0x1;queues[_0x1741f7['transfertargetuniqueid']]=_[_0xc550('0x56')](queues[_0x1741f7[_0xc550('0x60')]]);queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0xe')]=_0x1741f7['transfertargetuniqueid'];queues[_0x1741f7[_0xc550('0x57')]]['queuecallerenterreason']=0x2;queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x6')]=queues[_0x1741f7[_0xc550('0x4f')]][_0xc550('0x6')];queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x58')]=queues[_0x1741f7['origtransfererlinkedid']][_0xc550('0x58')];queues[_0x1741f7['transfertargetuniqueid']][_0xc550('0x39')]=utils['now']();queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x1b')]=utils['now']();queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x37')]=0x0;queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x59')]=0x0;utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x61'),_0x1741f7[_0xc550('0x4e')],queues[_0x1741f7[_0xc550('0x57')]]['name'],queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0xe')],queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x6')],queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x58')]));}else{utils[_0xc550('0x13')](util['format'](_0xc550('0x5b'),_0x1741f7[_0xc550('0x4e')],queues[_0x1741f7['secondtransfererlinkedid']][_0xc550('0x21')],_0x1741f7[_0xc550('0x4f')]));queues[_0x1741f7[_0xc550('0x51')]]['transfereduniqueid']=_0x1741f7[_0xc550('0x4f')];}}}}catch(_0x41e5c8){utils[_0xc550('0x24')](util['format'](_0xc550('0x62'),_0x1741f7['origtransfereruniqueid']),_0x41e5c8);}};exports[_0xc550('0x63')]=function(_0x58d9f9){try{if(!_[_0xc550('0x19')](queues[_0x58d9f9['uniqueid']])){utils[_0xc550('0x10')](util[_0xc550('0x11')](_0xc550('0x64'),_0x58d9f9[_0xc550('0x3')]),_0x58d9f9);queues[_0x58d9f9[_0xc550('0x3')]][_0xc550('0x65')]=utils[_0xc550('0x17')]();utils[_0xc550('0x13')](util['format'](_0xc550('0x66'),_0x58d9f9[_0xc550('0x3')],queues[_0x58d9f9['uniqueid']]['name'],queues[_0x58d9f9[_0xc550('0x3')]][_0xc550('0x65')]));}}catch(_0xd1a84e){utils[_0xc550('0x24')](util[_0xc550('0x11')](_0xc550('0x64'),_0x58d9f9['uniqueid']),_0xd1a84e);}};exports[_0xc550('0x67')]=function(_0x266429){try{if(!_[_0xc550('0x19')](queues[_0x266429['uniqueid']])){if(!_[_0xc550('0x19')](queues[_0x266429[_0xc550('0x3')]][_0xc550('0x65')])){utils[_0xc550('0x10')](util[_0xc550('0x11')](_0xc550('0x68'),_0x266429['uniqueid']),_0x266429);queues[_0x266429[_0xc550('0x3')]]['mohtime']+=utils[_0xc550('0x38')](utils[_0xc550('0x17')](),queues[_0x266429[_0xc550('0x3')]][_0xc550('0x65')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x266429[_0xc550('0x3')],queues[_0x266429['uniqueid']]['name'],queues[_0x266429[_0xc550('0x3')]][_0xc550('0x59')]));delete queues[_0x266429[_0xc550('0x3')]][_0xc550('0x65')];}}}catch(_0xa4ce7e){utils[_0xc550('0x24')](util['format'](_0xc550('0x68'),_0x266429[_0xc550('0x3')]),_0xa4ce7e);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 3ff1a51..985d19f 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 _0x9733=['getUserByInternal','then','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','channel','transfer','variable','mixmonitor_filename','endsWith','value','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','appdata','toLowerCase','set','split','substring','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','accountcode'];(function(_0x1f0375,_0x38d149){var _0x42e446=function(_0x464208){while(--_0x464208){_0x1f0375['push'](_0x1f0375['shift']());}};_0x42e446(++_0x38d149);}(_0x9733,0xd5));var _0x3973=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9733[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3973('0x0'));var util=require(_0x3973('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x5f25cf){utils[_0x3973('0x2')](util[_0x3973('0x3')](_0x3973('0x4'),_0x5f25cf[_0x3973('0x5')]));if(_0x5f25cf[_0x3973('0x6')]){utils[_0x3973('0x7')](_0x5f25cf['accountcode'])[_0x3973('0x8')](function(_0x463fe9){if(_0x463fe9){_0x5f25cf['membername']=_0x463fe9['name'];_0x5f25cf[_0x3973('0x9')]=_0x463fe9['id'];}utils[_0x3973('0xa')]('CreateVoiceRecording',_0x5f25cf);});}else{utils[_0x3973('0xa')](_0x3973('0xb'),_0x5f25cf);}}exports[_0x3973('0xc')]=function(_0x2334b0){try{utils[_0x3973('0xd')](util[_0x3973('0x3')](_0x3973('0xe'),_0x2334b0['uniqueid']),_0x2334b0);if(_0x2334b0[_0x3973('0x5')]==_0x2334b0[_0x3973('0xf')]){utils[_0x3973('0x2')](util[_0x3973('0x3')](_0x3973('0x10'),_0x2334b0['uniqueid'],_0x2334b0[_0x3973('0x11')],_0x2334b0['exten']));recordings[_0x2334b0[_0x3973('0x5')]]={'uniqueid':_0x2334b0[_0x3973('0x5')],'accountcode':_0x2334b0['accountcode'],'exten':_0x2334b0[_0x3973('0x12')],'context':_0x2334b0[_0x3973('0x11')],'channel':_0x2334b0['channel'],'monitors':[]};}}catch(_0x2f240b){utils[_0x3973('0x13')](util['format'](_0x3973('0xe'),_0x2334b0[_0x3973('0x5')]),_0x2f240b);}};exports[_0x3973('0x14')]=function(_0x58a528){try{utils[_0x3973('0xd')](util[_0x3973('0x3')](_0x3973('0x15'),_0x58a528[_0x3973('0x5')]),_0x58a528);if(!_[_0x3973('0x16')](recordings[_0x58a528[_0x3973('0x5')]])&&_0x58a528[_0x3973('0x17')]==0x6){utils[_0x3973('0x2')](util[_0x3973('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x58a528[_0x3973('0x5')],_0x58a528['context'],_0x58a528[_0x3973('0x18')]));}else if(!_[_0x3973('0x16')](recordings[_0x58a528[_0x3973('0xf')]])&&_0x58a528[_0x3973('0x17')]==0x6&&_0x58a528[_0x3973('0x11')]!=_0x3973('0x19')){utils[_0x3973('0x2')](util[_0x3973('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x58a528[_0x3973('0x5')],_0x58a528[_0x3973('0xf')],_0x58a528['context'],_0x58a528['channel']));recordings[_0x58a528['linkedid']][_0x3973('0x6')]=_0x58a528[_0x3973('0x6')];}}catch(_0x375dd2){utils['error'](util[_0x3973('0x3')]('[%s][recordings][newstate]',_0x58a528[_0x3973('0x5')]),_0x375dd2);}};exports['varset']=function(_0x8fbfba){try{if(!_[_0x3973('0x16')](_0x8fbfba[_0x3973('0x1a')])&&!_['isNil'](_0x8fbfba[_0x3973('0x1a')][_0x3973('0x1b')])){utils[_0x3973('0xd')](util[_0x3973('0x3')]('[%s][recordings][varset]',_0x8fbfba[_0x3973('0x5')]),_0x8fbfba);utils[_0x3973('0x2')](util[_0x3973('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x8fbfba[_0x3973('0x5')],_0x8fbfba['variable'],_0x8fbfba['value']));if(_[_0x3973('0x1c')](_0x8fbfba[_0x3973('0x1d')],'.wav49')){_0x8fbfba['value']=_0x8fbfba['value'][_0x3973('0x1e')]('.wav49',_0x3973('0x1f'));}if(recordings[_0x8fbfba[_0x3973('0xf')]]){var _0x33c34e=_[_0x3973('0x20')](recordings[_0x8fbfba['linkedid']][_0x3973('0x21')],{'value':_0x8fbfba[_0x3973('0x1d')]});if(_['isNil'](_0x33c34e)){recordings[_0x8fbfba[_0x3973('0xf')]][_0x3973('0x21')]['push']({'value':_0x8fbfba[_0x3973('0x1d')]});}}}}catch(_0x56cfbe){utils['error'](util[_0x3973('0x3')]('[%s][recordings][varset]',_0x8fbfba[_0x3973('0x5')]),_0x56cfbe);}};exports[_0x3973('0x22')]=function(_0x19cfc7){try{if(!_[_0x3973('0x16')](recordings[_0x19cfc7[_0x3973('0x5')]])){utils[_0x3973('0xd')](util['format'](_0x3973('0x23'),_0x19cfc7[_0x3973('0x5')]),_0x19cfc7);utils['info'](util['format'](_0x3973('0x24'),_0x19cfc7['uniqueid'],_0x19cfc7[_0x3973('0x25')],_0x19cfc7['calleridname'],_0x19cfc7[_0x3973('0x26')]));recordings[_0x19cfc7[_0x3973('0x5')]][_0x3973('0x25')]=_0x19cfc7[_0x3973('0x25')];recordings[_0x19cfc7['uniqueid']][_0x3973('0x27')]=_0x19cfc7[_0x3973('0x27')];recordings[_0x19cfc7[_0x3973('0x5')]][_0x3973('0x28')]=_0x19cfc7[_0x3973('0x28')];recordings[_0x19cfc7['uniqueid']][_0x3973('0x29')]=_0x19cfc7[_0x3973('0x29')];if(recordings[_0x19cfc7[_0x3973('0x5')]]['type']=='outbound'&&recordings[_0x19cfc7[_0x3973('0x5')]][_0x3973('0x6')]){recordings[_0x19cfc7[_0x3973('0x5')]][_0x3973('0x28')]=recordings[_0x19cfc7[_0x3973('0x5')]][_0x3973('0x6')];recordings[_0x19cfc7[_0x3973('0x5')]][_0x3973('0x29')]='';}recordings[_0x19cfc7[_0x3973('0x5')]][_0x3973('0x21')][_0x3973('0x2a')](function(_0x3a952f){var _0x7caa51=_[_0x3973('0x2b')](recordings[_0x19cfc7[_0x3973('0x5')]]);_0x7caa51[_0x3973('0x1d')]=_0x3a952f['value'];writeDB(_0x7caa51);});delete recordings[_0x19cfc7[_0x3973('0x5')]];}}catch(_0x86de73){utils['error'](util[_0x3973('0x3')]('[%s][recordings][hangup]',_0x19cfc7[_0x3973('0x5')]),_0x86de73);}};exports[_0x3973('0x2c')]=function(_0x442a50){try{if(!_[_0x3973('0x16')](recordings[_0x442a50[_0x3973('0x5')]])){utils[_0x3973('0xd')](util['format']('[%s][recordings][newexten]',_0x442a50[_0x3973('0x5')]),_0x442a50);utils['info'](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x442a50[_0x3973('0x5')],_0x442a50[_0x3973('0x2d')],_0x442a50[_0x3973('0x2e')]));if(_0x442a50[_0x3973('0x2d')][_0x3973('0x2f')]()==_0x3973('0x30')&&_['startsWith'](_0x442a50[_0x3973('0x2e')][_0x3973('0x2f')](),'cdr')){var _0x388158=_0x442a50[_0x3973('0x2e')][_0x3973('0x31')]('=');var _0x3290d0=_0x388158[0x0][_0x3973('0x32')](_0x388158[0x0][_0x3973('0x33')]('(')+0x1,_0x388158[0x0][_0x3973('0x33')](')'));var _0xaf08c8=_0x388158[0x1];recordings[_0x442a50[_0x3973('0x5')]][_0x3290d0]=_0xaf08c8;}}}catch(_0x14a06e){utils[_0x3973('0x13')](util[_0x3973('0x3')]('[%s][recordings][newexten]',_0x442a50[_0x3973('0x5')]),_0x14a06e);}};exports[_0x3973('0x34')]=function(_0x16ba38){try{if(!_[_0x3973('0x16')](recordings[_0x16ba38[_0x3973('0x5')]])){utils[_0x3973('0xd')](util[_0x3973('0x3')]('[%s][recordings][queuecallerjoin]',_0x16ba38[_0x3973('0x5')]),_0x16ba38);utils['info'](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x16ba38['uniqueid'],_0x16ba38[_0x3973('0x35')]));recordings[_0x16ba38[_0x3973('0x5')]][_0x3973('0x35')]=_0x16ba38['queue'];}}catch(_0x264df5){utils[_0x3973('0x13')](util['format'](_0x3973('0x36'),_0x16ba38['uniqueid']),_0x264df5);}}; \ No newline at end of file +var _0x3913=['[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','info','format','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','uniqueid','channel','error','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','isNil','variable','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','monitors','push','hangup'];(function(_0x5b67c9,_0x958f62){var _0x3a3363=function(_0x12774a){while(--_0x12774a){_0x5b67c9['push'](_0x5b67c9['shift']());}};_0x3a3363(++_0x958f62);}(_0x3913,0x8a));var _0x3391=function(_0x12a8cf,_0x41d6bb){_0x12a8cf=_0x12a8cf-0x0;var _0xabc603=_0x3913[_0x12a8cf];return _0xabc603;};'use strict';var _=require('lodash');var util=require(_0x3391('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x41b475){utils[_0x3391('0x1')](util[_0x3391('0x2')]('[%s][recordings][writeDB]',_0x41b475['uniqueid']));if(_0x41b475['accountcode']){utils[_0x3391('0x3')](_0x41b475[_0x3391('0x4')])[_0x3391('0x5')](function(_0x5a2d78){if(_0x5a2d78){_0x41b475[_0x3391('0x6')]=_0x5a2d78[_0x3391('0x7')];_0x41b475[_0x3391('0x8')]=_0x5a2d78['id'];}utils[_0x3391('0x9')](_0x3391('0xa'),_0x41b475);});}else{utils[_0x3391('0x9')](_0x3391('0xa'),_0x41b475);}}exports[_0x3391('0xb')]=function(_0x35d0d8){try{utils['debug'](util[_0x3391('0x2')](_0x3391('0xc'),_0x35d0d8['uniqueid']),_0x35d0d8);if(_0x35d0d8['uniqueid']==_0x35d0d8[_0x3391('0xd')]){utils[_0x3391('0x1')](util[_0x3391('0x2')](_0x3391('0xe'),_0x35d0d8['uniqueid'],_0x35d0d8[_0x3391('0xf')],_0x35d0d8[_0x3391('0x10')]));recordings[_0x35d0d8[_0x3391('0x11')]]={'uniqueid':_0x35d0d8[_0x3391('0x11')],'accountcode':_0x35d0d8[_0x3391('0x4')],'exten':_0x35d0d8['exten'],'context':_0x35d0d8[_0x3391('0xf')],'channel':_0x35d0d8[_0x3391('0x12')],'monitors':[]};}}catch(_0x783414){utils[_0x3391('0x13')](util[_0x3391('0x2')](_0x3391('0xc'),_0x35d0d8[_0x3391('0x11')]),_0x783414);}};exports['newstate']=function(_0x517d0a){try{utils['debug'](util['format'](_0x3391('0x14'),_0x517d0a[_0x3391('0x11')]),_0x517d0a);if(!_['isNil'](recordings[_0x517d0a['uniqueid']])&&_0x517d0a[_0x3391('0x15')]==0x6){utils[_0x3391('0x1')](util[_0x3391('0x2')](_0x3391('0x16'),_0x517d0a[_0x3391('0x11')],_0x517d0a['context'],_0x517d0a[_0x3391('0x12')]));}else if(!_['isNil'](recordings[_0x517d0a[_0x3391('0xd')]])&&_0x517d0a[_0x3391('0x15')]==0x6&&_0x517d0a[_0x3391('0xf')]!='transfer'){utils[_0x3391('0x1')](util[_0x3391('0x2')](_0x3391('0x17'),_0x517d0a[_0x3391('0x11')],_0x517d0a['linkedid'],_0x517d0a['context'],_0x517d0a[_0x3391('0x12')]));recordings[_0x517d0a[_0x3391('0xd')]]['accountcode']=_0x517d0a[_0x3391('0x4')];}}catch(_0x18de53){utils[_0x3391('0x13')](util[_0x3391('0x2')](_0x3391('0x14'),_0x517d0a['uniqueid']),_0x18de53);}};exports[_0x3391('0x18')]=function(_0x56ef5c){try{if(!_[_0x3391('0x19')](_0x56ef5c[_0x3391('0x1a')])&&!_[_0x3391('0x19')](_0x56ef5c[_0x3391('0x1a')]['mixmonitor_filename'])){utils[_0x3391('0x1b')](util[_0x3391('0x2')](_0x3391('0x1c'),_0x56ef5c[_0x3391('0x11')]),_0x56ef5c);utils[_0x3391('0x1')](util['format'](_0x3391('0x1d'),_0x56ef5c[_0x3391('0x11')],_0x56ef5c[_0x3391('0x1a')],_0x56ef5c[_0x3391('0x1e')]));if(_['endsWith'](_0x56ef5c[_0x3391('0x1e')],_0x3391('0x1f'))){_0x56ef5c['value']=_0x56ef5c[_0x3391('0x1e')][_0x3391('0x20')](_0x3391('0x1f'),'.WAV');}if(recordings[_0x56ef5c[_0x3391('0xd')]]){var _0x171b96=_['find'](recordings[_0x56ef5c[_0x3391('0xd')]][_0x3391('0x21')],{'value':_0x56ef5c[_0x3391('0x1e')]});if(_[_0x3391('0x19')](_0x171b96)){recordings[_0x56ef5c[_0x3391('0xd')]]['monitors'][_0x3391('0x22')]({'value':_0x56ef5c[_0x3391('0x1e')]});}}}}catch(_0x103097){utils[_0x3391('0x13')](util['format'](_0x3391('0x1c'),_0x56ef5c[_0x3391('0x11')]),_0x103097);}};exports[_0x3391('0x23')]=function(_0x156e3f){try{if(!_['isNil'](recordings[_0x156e3f[_0x3391('0x11')]])){utils['debug'](util[_0x3391('0x2')](_0x3391('0x24'),_0x156e3f[_0x3391('0x11')]),_0x156e3f);utils[_0x3391('0x1')](util[_0x3391('0x2')](_0x3391('0x25'),_0x156e3f['uniqueid'],_0x156e3f[_0x3391('0x26')],_0x156e3f['calleridname'],_0x156e3f[_0x3391('0x27')]));recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x26')]=_0x156e3f[_0x3391('0x26')];recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x28')]=_0x156e3f['calleridname'];recordings[_0x156e3f[_0x3391('0x11')]]['connectedlinenum']=_0x156e3f[_0x3391('0x29')];recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x2a')]=_0x156e3f[_0x3391('0x2a')];if(recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x2b')]=='outbound'&&recordings[_0x156e3f['uniqueid']][_0x3391('0x4')]){recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x29')]=recordings[_0x156e3f['uniqueid']][_0x3391('0x4')];recordings[_0x156e3f['uniqueid']][_0x3391('0x2a')]='';}recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x21')]['forEach'](function(_0x40b90d){var _0x4f138b=_[_0x3391('0x2c')](recordings[_0x156e3f[_0x3391('0x11')]]);_0x4f138b[_0x3391('0x1e')]=_0x40b90d[_0x3391('0x1e')];writeDB(_0x4f138b);});delete recordings[_0x156e3f['uniqueid']];}}catch(_0x1627a8){utils[_0x3391('0x13')](util[_0x3391('0x2')](_0x3391('0x24'),_0x156e3f[_0x3391('0x11')]),_0x1627a8);}};exports['newexten']=function(_0x36ef22){try{if(!_[_0x3391('0x19')](recordings[_0x36ef22['uniqueid']])){utils['debug'](util[_0x3391('0x2')](_0x3391('0x2d'),_0x36ef22['uniqueid']),_0x36ef22);utils['info'](util['format'](_0x3391('0x2e'),_0x36ef22['uniqueid'],_0x36ef22[_0x3391('0x2f')],_0x36ef22[_0x3391('0x30')]));if(_0x36ef22[_0x3391('0x2f')][_0x3391('0x31')]()=='set'&&_[_0x3391('0x32')](_0x36ef22[_0x3391('0x30')][_0x3391('0x31')](),_0x3391('0x33'))){var _0x505e61=_0x36ef22[_0x3391('0x30')][_0x3391('0x34')]('=');var _0x388d4c=_0x505e61[0x0][_0x3391('0x35')](_0x505e61[0x0][_0x3391('0x36')]('(')+0x1,_0x505e61[0x0][_0x3391('0x36')](')'));var _0x2b89a6=_0x505e61[0x1];recordings[_0x36ef22[_0x3391('0x11')]][_0x388d4c]=_0x2b89a6;}}}catch(_0x29ba4a){utils['error'](util[_0x3391('0x2')](_0x3391('0x2d'),_0x36ef22[_0x3391('0x11')]),_0x29ba4a);}};exports['queuecallerjoin']=function(_0x8bc5f1){try{if(!_['isNil'](recordings[_0x8bc5f1[_0x3391('0x11')]])){utils[_0x3391('0x1b')](util[_0x3391('0x2')](_0x3391('0x37'),_0x8bc5f1[_0x3391('0x11')]),_0x8bc5f1);utils[_0x3391('0x1')](util[_0x3391('0x2')](_0x3391('0x38'),_0x8bc5f1[_0x3391('0x11')],_0x8bc5f1[_0x3391('0x39')]));recordings[_0x8bc5f1[_0x3391('0x11')]][_0x3391('0x39')]=_0x8bc5f1[_0x3391('0x39')];}}catch(_0x473416){utils[_0x3391('0x13')](util[_0x3391('0x2')](_0x3391('0x37'),_0x8bc5f1[_0x3391('0x11')]),_0x473416);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9fdef8c..1e7b38b 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 _0x1eda=['blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','CreateVoiceTransferReport'];(function(_0x3c2785,_0x515b59){var _0x10590e=function(_0x16d79d){while(--_0x16d79d){_0x3c2785['push'](_0x3c2785['shift']());}};_0x10590e(++_0x515b59);}(_0x1eda,0x69));var _0xa1ed=function(_0x57c86c,_0x349f7a){_0x57c86c=_0x57c86c-0x0;var _0x3f3707=_0x1eda[_0x57c86c];return _0x3f3707;};'use strict';var _=require('lodash');var util=require(_0xa1ed('0x0'));var utils=require(_0xa1ed('0x1'));function writeDB(_0x3491af){utils[_0xa1ed('0x2')](util[_0xa1ed('0x3')](_0xa1ed('0x4'),_0x3491af[_0xa1ed('0x5')]==='attended'?_0x3491af[_0xa1ed('0x6')]:_0x3491af['uniqueid'],_0x3491af[_0xa1ed('0x5')]));utils[_0xa1ed('0x7')](_0xa1ed('0x8'),_0x3491af);}exports[_0xa1ed('0x9')]=function(_0x2cf5c8){try{utils[_0xa1ed('0xa')](util[_0xa1ed('0x3')](_0xa1ed('0xb'),_0x2cf5c8[_0xa1ed('0xc')]),_0x2cf5c8);utils[_0xa1ed('0x2')](util[_0xa1ed('0x3')](_0xa1ed('0xd'),_0x2cf5c8[_0xa1ed('0xc')],_0x2cf5c8[_0xa1ed('0xe')],_0x2cf5c8['transferercalleridname'],_0x2cf5c8[_0xa1ed('0xf')],_0x2cf5c8[_0xa1ed('0x10')]));_0x2cf5c8[_0xa1ed('0x5')]=_0xa1ed('0x11');writeDB(_0x2cf5c8);}catch(_0x12ba12){utils[_0xa1ed('0x12')](util['format'](_0xa1ed('0xb'),_0x2cf5c8['uniqueid']),_0x12ba12);}};exports['attendedtransfer']=function(_0x6ee361){try{utils['debug'](util[_0xa1ed('0x3')](_0xa1ed('0x13'),_0x6ee361[_0xa1ed('0x6')]),_0x6ee361);utils[_0xa1ed('0x2')](util[_0xa1ed('0x3')](_0xa1ed('0x14'),_0x6ee361[_0xa1ed('0x6')],_0x6ee361[_0xa1ed('0x15')],_0x6ee361[_0xa1ed('0x16')],_0x6ee361[_0xa1ed('0x17')],_0x6ee361[_0xa1ed('0x18')]));_0x6ee361=_[_0xa1ed('0x19')](_0x6ee361,{'transfererchannel':_0x6ee361[_0xa1ed('0x1a')],'transferercalleridnum':_0x6ee361[_0xa1ed('0x15')],'transferercalleridname':_0x6ee361[_0xa1ed('0x16')],'transfererconnectedlinenum':_0x6ee361[_0xa1ed('0x1b')],'transfererconnectedlinename':_0x6ee361[_0xa1ed('0x1c')],'transfereraccountcode':_0x6ee361['origtransfereraccountcode'],'transferercontext':_0x6ee361['secondtransferercontext'],'transfererexten':_0x6ee361['secondtransfererexten'],'transfererlinkedid':_0x6ee361['origtransfererlinkedid'],'context':_0x6ee361['origtransferercontext'],'extension':_0x6ee361[_0xa1ed('0x1d')],'type':_0xa1ed('0x1e')});if(_[_0xa1ed('0x1f')](_0x6ee361['transfereechannel'])){_0x6ee361=_[_0xa1ed('0x19')](_0x6ee361,{'transfereechannel':_0x6ee361[_0xa1ed('0x20')],'transfereecalleridnum':_0x6ee361[_0xa1ed('0x17')],'transfereecalleridname':_0x6ee361[_0xa1ed('0x18')],'transfereeconnectedlinenum':_0x6ee361[_0xa1ed('0x21')],'transfereeconnectedlinename':_0x6ee361[_0xa1ed('0x22')],'transfereeaccountcode':_0x6ee361['transfertargetaccountcode'],'transfereecontext':_0x6ee361[_0xa1ed('0x23')],'transfereeexten':_0x6ee361[_0xa1ed('0x24')],'transfereelinkedid':_0x6ee361[_0xa1ed('0x25')]});}writeDB(_0x6ee361);}catch(_0x3a5dff){utils[_0xa1ed('0x12')](util['format'](_0xa1ed('0x13'),_0x6ee361[_0xa1ed('0x6')]),_0x3a5dff);}}; \ No newline at end of file +var _0x0d36=['blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','uniqueid','type','CreateVoiceTransferReport'];(function(_0x3a1e93,_0x3d6b9c){var _0x24b998=function(_0x5817e9){while(--_0x5817e9){_0x3a1e93['push'](_0x3a1e93['shift']());}};_0x24b998(++_0x3d6b9c);}(_0x0d36,0xfc));var _0x60d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0d36[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x60d3('0x0'));var utils=require(_0x60d3('0x1'));function writeDB(_0x24b371){utils[_0x60d3('0x2')](util[_0x60d3('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x24b371['type']==='attended'?_0x24b371['origtransfereruniqueid']:_0x24b371[_0x60d3('0x4')],_0x24b371[_0x60d3('0x5')]));utils['request'](_0x60d3('0x6'),_0x24b371);}exports[_0x60d3('0x7')]=function(_0x5026a1){try{utils['debug'](util['format'](_0x60d3('0x8'),_0x5026a1[_0x60d3('0x4')]),_0x5026a1);utils[_0x60d3('0x2')](util[_0x60d3('0x3')](_0x60d3('0x9'),_0x5026a1[_0x60d3('0x4')],_0x5026a1[_0x60d3('0xa')],_0x5026a1[_0x60d3('0xb')],_0x5026a1['transfereecalleridnum'],_0x5026a1[_0x60d3('0xc')]));_0x5026a1[_0x60d3('0x5')]='blind';writeDB(_0x5026a1);}catch(_0x2d1470){utils['error'](util[_0x60d3('0x3')](_0x60d3('0x8'),_0x5026a1[_0x60d3('0x4')]),_0x2d1470);}};exports[_0x60d3('0xd')]=function(_0x2ff761){try{utils[_0x60d3('0xe')](util[_0x60d3('0x3')](_0x60d3('0xf'),_0x2ff761[_0x60d3('0x10')]),_0x2ff761);utils[_0x60d3('0x2')](util[_0x60d3('0x3')](_0x60d3('0x11'),_0x2ff761[_0x60d3('0x10')],_0x2ff761['origtransferercalleridnum'],_0x2ff761[_0x60d3('0x12')],_0x2ff761[_0x60d3('0x13')],_0x2ff761[_0x60d3('0x14')]));_0x2ff761=_[_0x60d3('0x15')](_0x2ff761,{'transfererchannel':_0x2ff761[_0x60d3('0x16')],'transferercalleridnum':_0x2ff761[_0x60d3('0x17')],'transferercalleridname':_0x2ff761[_0x60d3('0x12')],'transfererconnectedlinenum':_0x2ff761[_0x60d3('0x18')],'transfererconnectedlinename':_0x2ff761[_0x60d3('0x19')],'transfereraccountcode':_0x2ff761[_0x60d3('0x1a')],'transferercontext':_0x2ff761['secondtransferercontext'],'transfererexten':_0x2ff761[_0x60d3('0x1b')],'transfererlinkedid':_0x2ff761[_0x60d3('0x1c')],'context':_0x2ff761['origtransferercontext'],'extension':_0x2ff761[_0x60d3('0x1d')],'type':'attended'});if(_[_0x60d3('0x1e')](_0x2ff761[_0x60d3('0x1f')])){_0x2ff761=_['assign'](_0x2ff761,{'transfereechannel':_0x2ff761[_0x60d3('0x20')],'transfereecalleridnum':_0x2ff761[_0x60d3('0x13')],'transfereecalleridname':_0x2ff761['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2ff761['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2ff761[_0x60d3('0x21')],'transfereeaccountcode':_0x2ff761['transfertargetaccountcode'],'transfereecontext':_0x2ff761[_0x60d3('0x22')],'transfereeexten':_0x2ff761[_0x60d3('0x23')],'transfereelinkedid':_0x2ff761[_0x60d3('0x24')]});}writeDB(_0x2ff761);}catch(_0x2d9187){utils['error'](util['format'](_0x60d3('0xf'),_0x2ff761['origtransfereruniqueid']),_0x2d9187);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ba40cb6..a902432 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 _0x351f=['now','isAfter','isBefore','bluebird','jayson/promise','moment','client','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','name','interface','then','[utils][getUser]\x20where:%s','result','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','length','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtract','seconds','diffTime'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x351f,0xd5));var _0xf351=function(_0x32b155,_0x501d59){_0x32b155=_0x32b155-0x0;var _0xe80bb8=_0x351f[_0x32b155];return _0xe80bb8;};'use strict';var BPromise=require(_0xf351('0x0'));var jayson=require(_0xf351('0x1'));var moment=require(_0xf351('0x2'));var util=require('util');var client=jayson[_0xf351('0x3')]['http']({'port':0x2329});var logger=require(_0xf351('0x4'))(_0xf351('0x5'));exports[_0xf351('0x6')]=function(_0x59a390,_0x471c33){logger['info'](_0x59a390,_0x471c33?util[_0xf351('0x7')](_0x471c33,{'showHidden':![],'depth':null}):'');};exports[_0xf351('0x8')]=function(_0x361542,_0x325c0a){logger[_0xf351('0x8')](_0x361542,_0x325c0a?util[_0xf351('0x7')](_0x325c0a,{'showHidden':![],'depth':null}):'');};exports[_0xf351('0x9')]=function(_0x4443f9,_0x26d628){logger['error'](_0x4443f9,_0x26d628?util[_0xf351('0x7')](_0x26d628,{'showHidden':![],'depth':null}):'');};exports[_0xf351('0xa')]=function(_0x4db80c,_0x251058){return client[_0xf351('0xa')](_0x4db80c,{'body':_0x251058})['then'](function(_0x5e92dd){logger[_0xf351('0x8')](_0xf351('0xb'),_0x4db80c,_0x5e92dd?util['inspect'](_0x5e92dd,{'showHidden':![],'depth':null}):'');})[_0xf351('0xc')](function(_0x3caf75){logger[_0xf351('0x9')](_0xf351('0xb'),_0x4db80c,_0x3caf75?util[_0xf351('0x7')](_0x3caf75,{'showHidden':![],'depth':null}):'');});};function getUser(_0x222866){return client['request'](_0xf351('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0xf351('0xe'),_0xf351('0xf')],'where':_0x222866,'limit':0x1}})[_0xf351('0x10')](function(_0x441656){logger[_0xf351('0x8')](_0xf351('0x11'),JSON['stringify'](_0x222866),_0x441656?util[_0xf351('0x7')](_0x441656,{'showHidden':![],'depth':null}):'');return _0x441656['result']['length']?_0x441656[_0xf351('0x12')][0x0]:null;});}exports[_0xf351('0x13')]=function(_0x320866){return new BPromise(function(_0x3bdbb4,_0x46e78c){if(_0x320866){return getUser({'internal':_0x320866})['then'](function(_0x263734){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x320866,_0x263734?_0xf351('0x14'):_0xf351('0x15'));return _0x3bdbb4(_0x263734);})['catch'](function(_0x5ad57d){logger['error'](_0xf351('0x16'),_0x5ad57d?util[_0xf351('0x7')](_0x5ad57d,{'showHidden':![],'depth':null}):'');return _0x3bdbb4(null);});}return _0x3bdbb4(null);});};exports[_0xf351('0x17')]=function(_0x81193f){return new BPromise(function(_0x1cdfc7,_0xbffe95){if(_0x81193f){return getUser({'interface':_0x81193f})['then'](function(_0x13426c){logger[_0xf351('0x6')](_0xf351('0x18'),_0x81193f,_0x13426c?_0xf351('0x14'):'notfound');return _0x1cdfc7(_0x13426c);})[_0xf351('0xc')](function(_0x454c56){logger['error'](_0xf351('0x19'),_0x454c56?util['inspect'](_0x454c56,{'showHidden':![],'depth':null}):'');return _0x1cdfc7(null);});}return _0x1cdfc7(null);});};exports[_0xf351('0x1a')]=function(_0x474e57){return new BPromise(function(_0x14da18,_0x3c7d1a){if(_0x474e57){return getUser({'name':_0x474e57})['then'](function(_0x3353e4){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x474e57,_0x3353e4?'found':_0xf351('0x15'));return _0x14da18(_0x3353e4);})[_0xf351('0xc')](function(_0x48a4c0){logger[_0xf351('0x9')](_0xf351('0x1b'),_0x48a4c0?util[_0xf351('0x7')](_0x48a4c0,{'showHidden':![],'depth':null}):'');return _0x14da18(null);});}return _0x14da18(null);});};exports[_0xf351('0x1c')]=function(_0x3c537d){return new BPromise(function(_0x452b05,_0x2b8e14){if(_0x3c537d){return client[_0xf351('0xa')](_0xf351('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xf351('0xe'),_0xf351('0x1e'),'acw','acwTimeout'],'where':{'name':_0x3c537d},'limit':0x1}})['then'](function(_0x2042c3){logger[_0xf351('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x3c537d,_0x2042c3?util[_0xf351('0x7')](_0x2042c3,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x3c537d,_0x2042c3?_0xf351('0x14'):_0xf351('0x15'));return _0x452b05(_0x2042c3[_0xf351('0x12')][_0xf351('0x1f')]?_0x2042c3[_0xf351('0x12')][0x0]:null);})[_0xf351('0xc')](function(_0x152604){logger['error']('[utils][getVoiceQueueByName]',_0x152604?util[_0xf351('0x7')](_0x152604,{'showHidden':![],'depth':null}):'');return _0x452b05(null);});}return _0x452b05(null);});};exports[_0xf351('0x20')]=function(_0x77d71d,_0x3d738b){return moment(_0x77d71d)[_0xf351('0x21')](_0x3d738b,'seconds')[_0xf351('0x22')](_0xf351('0x23'));};exports['subtractTime']=function(_0xa3ee4c,_0x2b311e){return moment(_0xa3ee4c)[_0xf351('0x24')](_0x2b311e,_0xf351('0x25'))[_0xf351('0x22')](_0xf351('0x23'));};exports[_0xf351('0x26')]=function(_0x54d72a,_0x17e45d){return moment(_0x54d72a)['diff'](moment(_0x17e45d),'seconds');};exports['sumTime']=function(_0x5e9cce,_0x5e76b5){return parseInt(_0x5e9cce,0xa)+parseInt(_0x5e76b5,0xa);};exports[_0xf351('0x27')]=function(){return moment()['format'](_0xf351('0x23'));};exports[_0xf351('0x28')]=function(_0x1e4630,_0x5ecd6c){if(_0x5ecd6c){return moment(_0x1e4630)[_0xf351('0x28')](_0x5ecd6c);}return!![];};exports[_0xf351('0x29')]=function(_0x27f098,_0x10fcc0){if(_0x10fcc0){return moment(_0x27f098)[_0xf351('0x29')](_0x10fcc0);}else if(_0x27f098){return!![];}return![];}; \ No newline at end of file +var _0x4351=['GetUser','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','then','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','add','format','subtractTime','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request'];(function(_0x1d2ab8,_0x2db0f9){var _0x5df751=function(_0x16952e){while(--_0x16952e){_0x1d2ab8['push'](_0x1d2ab8['shift']());}};_0x5df751(++_0x2db0f9);}(_0x4351,0x1b5));var _0x1435=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x4351[_0x1d9aa0];return _0x226868;};'use strict';var BPromise=require(_0x1435('0x0'));var jayson=require(_0x1435('0x1'));var moment=require(_0x1435('0x2'));var util=require(_0x1435('0x3'));var client=jayson[_0x1435('0x4')][_0x1435('0x5')]({'port':0x2329});var logger=require(_0x1435('0x6'))(_0x1435('0x7'));exports[_0x1435('0x8')]=function(_0x2fa227,_0x111bc6){logger[_0x1435('0x8')](_0x2fa227,_0x111bc6?util[_0x1435('0x9')](_0x111bc6,{'showHidden':![],'depth':null}):'');};exports[_0x1435('0xa')]=function(_0x337fd6,_0x56ce86){logger[_0x1435('0xa')](_0x337fd6,_0x56ce86?util['inspect'](_0x56ce86,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3d0e0b,_0x22a221){logger[_0x1435('0xb')](_0x3d0e0b,_0x22a221?util[_0x1435('0x9')](_0x22a221,{'showHidden':![],'depth':null}):'');};exports[_0x1435('0xc')]=function(_0x55cd88,_0x1628ca){return client[_0x1435('0xc')](_0x55cd88,{'body':_0x1628ca})['then'](function(_0x58531b){logger[_0x1435('0xa')]('[utils][request]\x20name:%s',_0x55cd88,_0x58531b?util[_0x1435('0x9')](_0x58531b,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1632ac){logger['error']('[utils][request]\x20name:%s',_0x55cd88,_0x1632ac?util['inspect'](_0x1632ac,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3a4a62){return client[_0x1435('0xc')](_0x1435('0xd'),{'options':{'raw':!![],'attributes':['id','internal','name',_0x1435('0xe')],'where':_0x3a4a62,'limit':0x1}})['then'](function(_0x39405c){logger[_0x1435('0xa')](_0x1435('0xf'),JSON[_0x1435('0x10')](_0x3a4a62),_0x39405c?util[_0x1435('0x9')](_0x39405c,{'showHidden':![],'depth':null}):'');return _0x39405c[_0x1435('0x11')][_0x1435('0x12')]?_0x39405c[_0x1435('0x11')][0x0]:null;});}exports[_0x1435('0x13')]=function(_0x189f4a){return new BPromise(function(_0x430367,_0x19c9fe){if(_0x189f4a){return getUser({'internal':_0x189f4a})[_0x1435('0x14')](function(_0xb6995b){logger[_0x1435('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x189f4a,_0xb6995b?_0x1435('0x15'):_0x1435('0x16'));return _0x430367(_0xb6995b);})['catch'](function(_0x4694cb){logger['error'](_0x1435('0x17'),_0x4694cb?util[_0x1435('0x9')](_0x4694cb,{'showHidden':![],'depth':null}):'');return _0x430367(null);});}return _0x430367(null);});};exports[_0x1435('0x18')]=function(_0x28bc0a){return new BPromise(function(_0x2551d5,_0x1213a7){if(_0x28bc0a){return getUser({'interface':_0x28bc0a})['then'](function(_0x17ed76){logger[_0x1435('0x8')](_0x1435('0x19'),_0x28bc0a,_0x17ed76?_0x1435('0x15'):_0x1435('0x16'));return _0x2551d5(_0x17ed76);})[_0x1435('0x1a')](function(_0x302831){logger[_0x1435('0xb')](_0x1435('0x1b'),_0x302831?util[_0x1435('0x9')](_0x302831,{'showHidden':![],'depth':null}):'');return _0x2551d5(null);});}return _0x2551d5(null);});};exports[_0x1435('0x1c')]=function(_0x5f0e15){return new BPromise(function(_0x523792,_0x22241f){if(_0x5f0e15){return getUser({'name':_0x5f0e15})[_0x1435('0x14')](function(_0x3d452f){logger['info'](_0x1435('0x1d'),_0x5f0e15,_0x3d452f?_0x1435('0x15'):_0x1435('0x16'));return _0x523792(_0x3d452f);})[_0x1435('0x1a')](function(_0x24f328){logger['error'](_0x1435('0x1e'),_0x24f328?util[_0x1435('0x9')](_0x24f328,{'showHidden':![],'depth':null}):'');return _0x523792(null);});}return _0x523792(null);});};exports[_0x1435('0x1f')]=function(_0x453d68){return new BPromise(function(_0x1c3b7e,_0x108c25){if(_0x453d68){return client[_0x1435('0xc')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x1435('0x20'),_0x1435('0x21'),_0x1435('0x22'),_0x1435('0x23')],'where':{'name':_0x453d68},'limit':0x1}})[_0x1435('0x14')](function(_0x49649f){logger[_0x1435('0xa')](_0x1435('0x24'),_0x453d68,_0x49649f?util[_0x1435('0x9')](_0x49649f,{'showHidden':![],'depth':null}):'');logger[_0x1435('0x8')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x453d68,_0x49649f?_0x1435('0x15'):_0x1435('0x16'));return _0x1c3b7e(_0x49649f['result'][_0x1435('0x12')]?_0x49649f['result'][0x0]:null);})[_0x1435('0x1a')](function(_0x1ea6a6){logger['error'](_0x1435('0x25'),_0x1ea6a6?util[_0x1435('0x9')](_0x1ea6a6,{'showHidden':![],'depth':null}):'');return _0x1c3b7e(null);});}return _0x1c3b7e(null);});};exports['addTime']=function(_0x4e10db,_0x5c5075){return moment(_0x4e10db)[_0x1435('0x26')](_0x5c5075,'seconds')[_0x1435('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x1435('0x28')]=function(_0x48b68f,_0x1bfdfc){return moment(_0x48b68f)[_0x1435('0x29')](_0x1bfdfc,_0x1435('0x2a'))[_0x1435('0x27')](_0x1435('0x2b'));};exports[_0x1435('0x2c')]=function(_0x4a51a1,_0x1fe8dd){return moment(_0x4a51a1)[_0x1435('0x2d')](moment(_0x1fe8dd),_0x1435('0x2a'));};exports[_0x1435('0x2e')]=function(_0x310a28,_0x592e22){return parseInt(_0x310a28,0xa)+parseInt(_0x592e22,0xa);};exports[_0x1435('0x2f')]=function(){return moment()['format'](_0x1435('0x2b'));};exports[_0x1435('0x30')]=function(_0x55e16c,_0x11cf64){if(_0x11cf64){return moment(_0x55e16c)[_0x1435('0x30')](_0x11cf64);}return!![];};exports[_0x1435('0x31')]=function(_0xed44d5,_0x228238){if(_0x228238){return moment(_0xed44d5)[_0x1435('0x31')](_0x228238);}else if(_0xed44d5){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 7fd0721..d6526b1 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 _0xaac6=['logger','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','remoteAddress','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','then','catch','user','no-user','data','api','auth','set','client-side-logger','use'];(function(_0x25775f,_0x35e6fc){var _0x5595dd=function(_0x3ae67a){while(--_0x3ae67a){_0x25775f['push'](_0x25775f['shift']());}};_0x5595dd(++_0x35e6fc);}(_0xaac6,0x17c));var _0x6aac=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xaac6[_0x2ec461];return _0x28603d;};var fs=require(_0x6aac('0x0'));var _=require(_0x6aac('0x1'));var ewinston=require(_0x6aac('0x2'));var path=require(_0x6aac('0x3'));var util=require(_0x6aac('0x4'));var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require('./safe-template')[_0x6aac('0x5')];var maskSensitiveData=require(_0x6aac('0x6'))[_0x6aac('0x7')];function ClientSideLogger(){function _0x373af1(_0x2eb8f1){var _0x2d2f73=path[_0x6aac('0x8')](_0x6aac('0x9'),_0x6aac('0xa'),_0x6aac('0xb'));var _0x2815b3=path[_0x6aac('0x8')](_0x6aac('0xc'),_0x2eb8f1[_0x6aac('0xd')]+'-'+_0x2eb8f1[_0x6aac('0xe')]);return fs['ensureDir'](path['join'](_0x2d2f73,_0x2815b3))[_0x6aac('0xf')](function(){var _0x1f1059=fileLogger('client',path[_0x6aac('0x8')](_0x2d2f73,_0x2815b3));return _0x1f1059;})[_0x6aac('0x10')](function(_0x522ef0){throw _0x522ef0;});}this[_0x6aac('0xa')]=function(_0x19cf19,_0x4e5590,_0x16d633,_0x529e99){return _0x373af1(_0x19cf19['user'])[_0x6aac('0xf')](function(_0x35807a){var _0x3b46b2=_0x35807a[_0x4e5590];return _0x3b46b2;})[_0x6aac('0xf')](function(_0x28e72c){var _0x46e4e4=_0x19cf19[_0x6aac('0x11')]?_0x19cf19[_0x6aac('0x11')]['id']:_0x6aac('0x12');var _0x374fc4=_0x529e99[_0x6aac('0x13')];var _0x1b32e9=_0x529e99['timestamp'];var _0x274de1=new Date(Number(_0x1b32e9));return _0x28e72c(_0x46e4e4,_0x274de1,_0x16d633,_0x374fc4);})[_0x6aac('0x10')](function(_0x2677a3){fileLogger(_0x6aac('0xc'))['error'](_0x2677a3);});};}function setupLoggers(_0x6addf7){return new Promise(function(_0xd507be){var _0x2a0a75=new ClientSideLogger();var _0x5c897e=fileLogger(_0x6aac('0x14'));var _0x392f4b=fileLogger(_0x6aac('0x15'));_0x6addf7[_0x6aac('0x16')](_0x6aac('0x17'),_0x2a0a75);_0x6addf7[_0x6aac('0x18')](ewinston[_0x6aac('0x19')]({'winstonInstance':_0x5c897e,'meta':![],'statusLevels':!![],'msg':function(_0x5e222b,_0x4405f3){var _0x17d7d7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x6aac('0x1a')](_0x5e222b['body'])){_0x17d7d7+=_0x6aac('0x1b');var _0x15a383=_0x5e222b[_0x6aac('0x1c')];maskSensitiveData(_0x15a383);}return safeTemplate(util[_0x6aac('0x1d')](_0x17d7d7,_0x5e222b[_0x6aac('0x1e')],_0x5e222b[_0x6aac('0x1f')]['x-forwarded-for']?_0x5e222b[_0x6aac('0x1f')][_0x6aac('0x20')]:_0x5e222b['connection']['remoteAddress']||_0x5e222b['ip'],_0x5e222b['url'],_0x4405f3[_0x6aac('0x21')],_0x4405f3[_0x6aac('0x22')],_0x5e222b[_0x6aac('0x11')]?_0x5e222b[_0x6aac('0x11')]['id']:null,_0x5e222b[_0x6aac('0x11')]?_0x5e222b[_0x6aac('0x11')]['name']:null,_0x5e222b['user']?_0x5e222b[_0x6aac('0x11')][_0x6aac('0xd')]:null,_0x15a383?util[_0x6aac('0x23')](_0x15a383,![],null):''));}}));_0x6addf7[_0x6aac('0x18')](ewinston[_0x6aac('0x19')]({'winstonInstance':_0x392f4b,'meta':![],'statusLevels':!![],'msg':function(_0x4dddeb,_0x4b9175){var _0x51fba8=_0x6aac('0x24');if(_0x4dddeb[_0x6aac('0x1c')]&&_0x4dddeb[_0x6aac('0x1c')][_0x6aac('0x25')]&&_0x4dddeb[_0x6aac('0x1c')]['agent_id']){_0x51fba8=_0x6aac('0x26');}return util[_0x6aac('0x1d')](_0x51fba8,_0x4dddeb[_0x6aac('0x1e')],_0x4dddeb[_0x6aac('0x1f')]['x-forwarded-for']?_0x4dddeb[_0x6aac('0x1f')][_0x6aac('0x20')]:_0x4dddeb[_0x6aac('0x27')][_0x6aac('0x28')]||_0x4dddeb['ip'],_0x4dddeb['url'],_0x4b9175[_0x6aac('0x21')],_0x4b9175[_0x6aac('0x22')],_0x4dddeb[_0x6aac('0x11')]?_0x4dddeb[_0x6aac('0x11')]['id']:null,_0x4dddeb['user']?_0x4dddeb[_0x6aac('0x11')][_0x6aac('0xe')]:null,_0x4dddeb[_0x6aac('0x11')]?_0x4dddeb['user'][_0x6aac('0xd')]:null,_0x4dddeb[_0x6aac('0x1c')]&&_0x4dddeb[_0x6aac('0x1c')]['device']?_0x4dddeb[_0x6aac('0x1c')]['device']:'other',_0x4dddeb[_0x6aac('0x1c')]&&_0x4dddeb[_0x6aac('0x1c')][_0x6aac('0x29')]?_0x4dddeb['body'][_0x6aac('0x29')]:'',_0x4dddeb[_0x6aac('0x1c')]&&_0x4dddeb[_0x6aac('0x1c')][_0x6aac('0x2a')]?_0x4dddeb[_0x6aac('0x1c')][_0x6aac('0x2a')]:'');},'ignoreRoute':function(_0x2f443e){var _0x23d6cb=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x23d6cb[_0x6aac('0x2b')](_0x2f443e['url']);}}));return _0xd507be();});}exports[_0x6aac('0x2c')]=setupLoggers; \ No newline at end of file +var _0x3bc3=['method','connection','name','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','safeTemplate','maskSensitiveData','join','/var','log','xcally','role','then','client','catch','user','timestamp','api','client-side-logger','use','logger','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id'];(function(_0x4d7dac,_0x296dcf){var _0x3d6782=function(_0x288c09){while(--_0x288c09){_0x4d7dac['push'](_0x4d7dac['shift']());}};_0x3d6782(++_0x296dcf);}(_0x3bc3,0xb3));var _0x33bc=function(_0x2f9062,_0xb1f10d){_0x2f9062=_0x2f9062-0x0;var _0x17307c=_0x3bc3[_0x2f9062];return _0x17307c;};var fs=require(_0x33bc('0x0'));var _=require(_0x33bc('0x1'));var ewinston=require(_0x33bc('0x2'));var path=require('path');var util=require(_0x33bc('0x3'));var fileLogger=require(_0x33bc('0x4'))[_0x33bc('0x5')];var safeTemplate=require('./safe-template')[_0x33bc('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x33bc('0x7')];function ClientSideLogger(){function _0x2f4487(_0x84e283){var _0x440403=path[_0x33bc('0x8')](_0x33bc('0x9'),_0x33bc('0xa'),_0x33bc('0xb'));var _0xb9897b=path['join']('client',_0x84e283[_0x33bc('0xc')]+'-'+_0x84e283['name']);return fs['ensureDir'](path[_0x33bc('0x8')](_0x440403,_0xb9897b))[_0x33bc('0xd')](function(){var _0x3e99b5=fileLogger(_0x33bc('0xe'),path[_0x33bc('0x8')](_0x440403,_0xb9897b));return _0x3e99b5;})[_0x33bc('0xf')](function(_0x3fb08d){throw _0x3fb08d;});}this[_0x33bc('0xa')]=function(_0x26dd65,_0x5941f5,_0x17f34f,_0x3d2517){return _0x2f4487(_0x26dd65[_0x33bc('0x10')])[_0x33bc('0xd')](function(_0x8e65a3){var _0x555610=_0x8e65a3[_0x5941f5];return _0x555610;})[_0x33bc('0xd')](function(_0x4dcff1){var _0x3a7a8b=_0x26dd65[_0x33bc('0x10')]?_0x26dd65[_0x33bc('0x10')]['id']:'no-user';var _0x58112a=_0x3d2517['data'];var _0x4abde7=_0x3d2517[_0x33bc('0x11')];var _0x1417c3=new Date(Number(_0x4abde7));return _0x4dcff1(_0x3a7a8b,_0x1417c3,_0x17f34f,_0x58112a);})[_0x33bc('0xf')](function(_0xaaa743){fileLogger(_0x33bc('0xe'))['error'](_0xaaa743);});};}function setupLoggers(_0x5c6168){return new Promise(function(_0x137e53){var _0x59ff2f=new ClientSideLogger();var _0x9f3b26=fileLogger(_0x33bc('0x12'));var _0x546f7a=fileLogger('auth');_0x5c6168['set'](_0x33bc('0x13'),_0x59ff2f);_0x5c6168[_0x33bc('0x14')](ewinston[_0x33bc('0x15')]({'winstonInstance':_0x9f3b26,'meta':![],'statusLevels':!![],'msg':function(_0x3ba13b,_0x1bffbf){var _0x1739a4='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x33bc('0x16')](_0x3ba13b[_0x33bc('0x17')])){_0x1739a4+=_0x33bc('0x18');var _0x143d6a=_0x3ba13b['body'];maskSensitiveData(_0x143d6a);}return safeTemplate(util[_0x33bc('0x19')](_0x1739a4,_0x3ba13b['method'],_0x3ba13b[_0x33bc('0x1a')][_0x33bc('0x1b')]?_0x3ba13b[_0x33bc('0x1a')][_0x33bc('0x1b')]:_0x3ba13b['connection'][_0x33bc('0x1c')]||_0x3ba13b['ip'],_0x3ba13b[_0x33bc('0x1d')],_0x1bffbf[_0x33bc('0x1e')],_0x1bffbf[_0x33bc('0x1f')],_0x3ba13b['user']?_0x3ba13b['user']['id']:null,_0x3ba13b[_0x33bc('0x10')]?_0x3ba13b[_0x33bc('0x10')]['name']:null,_0x3ba13b['user']?_0x3ba13b['user'][_0x33bc('0xc')]:null,_0x143d6a?util[_0x33bc('0x20')](_0x143d6a,![],null):''));}}));_0x5c6168[_0x33bc('0x14')](ewinston['logger']({'winstonInstance':_0x546f7a,'meta':![],'statusLevels':!![],'msg':function(_0x47f733,_0x337a24){var _0xe16903=_0x33bc('0x21');if(_0x47f733[_0x33bc('0x17')]&&_0x47f733[_0x33bc('0x17')][_0x33bc('0x22')]&&_0x47f733[_0x33bc('0x17')][_0x33bc('0x23')]){_0xe16903='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x33bc('0x19')](_0xe16903,_0x47f733[_0x33bc('0x24')],_0x47f733[_0x33bc('0x1a')][_0x33bc('0x1b')]?_0x47f733[_0x33bc('0x1a')][_0x33bc('0x1b')]:_0x47f733[_0x33bc('0x25')]['remoteAddress']||_0x47f733['ip'],_0x47f733['url'],_0x337a24[_0x33bc('0x1e')],_0x337a24[_0x33bc('0x1f')],_0x47f733[_0x33bc('0x10')]?_0x47f733[_0x33bc('0x10')]['id']:null,_0x47f733[_0x33bc('0x10')]?_0x47f733[_0x33bc('0x10')][_0x33bc('0x26')]:null,_0x47f733['user']?_0x47f733[_0x33bc('0x10')][_0x33bc('0xc')]:null,_0x47f733[_0x33bc('0x17')]&&_0x47f733[_0x33bc('0x17')][_0x33bc('0x22')]?_0x47f733[_0x33bc('0x17')][_0x33bc('0x22')]:_0x33bc('0x27'),_0x47f733[_0x33bc('0x17')]&&_0x47f733['body'][_0x33bc('0x23')]?_0x47f733[_0x33bc('0x17')][_0x33bc('0x23')]:'',_0x47f733[_0x33bc('0x17')]&&_0x47f733[_0x33bc('0x17')][_0x33bc('0x28')]?_0x47f733['body'][_0x33bc('0x28')]:'');},'ignoreRoute':function(_0x52241d){var _0x2c616a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2c616a[_0x33bc('0x29')](_0x52241d['url']);}}));return _0x137e53();});}exports[_0x33bc('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 6048e17..e8cc5f5 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeccf=['source','join','Interval\x20string\x20not\x20valid','isValid','split','locale','toLowerCase','indexOf','slice','exports','circularDoWInterval','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','date','max','min','domCompare','MMM','monthCompare','guess','isMoment','length','iftime','moment-timezone','map'];(function(_0x1820ba,_0x5c5f6a){var _0xfde62a=function(_0x5b686e){while(--_0x5b686e){_0x1820ba['push'](_0x1820ba['shift']());}};_0xfde62a(++_0x5c5f6a);}(_0xeccf,0xfa));var _0xfecc=function(_0xcf1190,_0x57d683){_0xcf1190=_0xcf1190-0x0;var _0x3d5fec=_0xeccf[_0xcf1190];return _0x3d5fec;};var _=require('lodash');var moment=require(_0xfecc('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xfecc('0x1')](function(_0x529be4){return _0x529be4[_0xfecc('0x2')];})[_0xfecc('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xfecc('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x4ab35e){if(!_0x4ab35e[_0xfecc('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2ecbe8){var _0x50ced6=_0x2ecbe8[_0xfecc('0x6')](':')[_0xfecc('0x1')](function(_0xdf7439){return parseInt(_0xdf7439,0xa);});var _0x1ef2c0=_0x50ced6[0x0];var _0x9cf8e3=_0x50ced6[0x1];if(_0x1ef2c0<0x0||_0x1ef2c0>0x17||_0x9cf8e3<0x0||_0x9cf8e3>0x3b){throw new Error(EINVALID_DATE);}return[_0x1ef2c0,_0x9cf8e3];}function circularDoWInterval(_0x5b611a,_0x4be806){if(_0x5b611a===_0x4be806){return[_0x5b611a];}else{var _0x47ec10=moment['locale']();moment[_0xfecc('0x7')]('en');var _0x2c4758=moment['weekdaysShort']()['map'](function(_0x524ec6){return _0x524ec6[_0xfecc('0x8')]();});moment[_0xfecc('0x7')](_0x47ec10);var _0x2271e0=_0x2c4758[_0xfecc('0x9')](_0x5b611a);var _0x12e7f6=_0x2c4758['indexOf'](_0x4be806);if(_0x12e7f6>_0x2271e0){return _0x2c4758[_0xfecc('0xa')](_0x2271e0,_0x12e7f6+0x1);}else{var _0x1d2022=_0x2c4758[_0xfecc('0xa')](0x0,_0x12e7f6+0x1);var _0x51675e=_0x2c4758[_0xfecc('0xa')](_0x2271e0);return _0x51675e['concat'](_0x1d2022);}}}module[_0xfecc('0xb')][_0xfecc('0xc')]=circularDoWInterval;function circularMonthInterval(_0x43c386,_0x35d02f){if(_0x43c386===_0x35d02f){return[_0x43c386];}else{var _0x4c22c0=moment[_0xfecc('0x7')]();moment[_0xfecc('0x7')]('en');var _0x5dec6d=moment['monthsShort']()[_0xfecc('0x1')](function(_0x4eef5b){return _0x4eef5b[_0xfecc('0x8')]();});moment[_0xfecc('0x7')](_0x4c22c0);var _0xb88f8e=_0x5dec6d[_0xfecc('0x9')](_0x43c386);var _0x8e1c6e=_0x5dec6d['indexOf'](_0x35d02f);if(_0x8e1c6e>_0xb88f8e){return _0x5dec6d['slice'](_0xb88f8e,_0x8e1c6e+0x1);}else{var _0x528a9b=_0x5dec6d[_0xfecc('0xa')](0x0,_0x8e1c6e+0x1);var _0x37bf62=_0x5dec6d[_0xfecc('0xa')](_0xb88f8e);return _0x37bf62['concat'](_0x528a9b);}}}module[_0xfecc('0xb')][_0xfecc('0xd')]=circularMonthInterval;function parseDom(_0xf967ea){var _0x4a2b56=parseInt(_0xf967ea,0xa);if(_0x4a2b56<0x1||_0x4a2b56>0x1f){throw new Error(EINVALID_DATE);}return _0x4a2b56;}function timeCompare(_0x590e18,_0x50640a,_0x280e29){var _0x135e09=_0x590e18[_0xfecc('0xe')]();var _0x459199=extractTime(_0x50640a);var _0x49eb05=_0x459199[0x0];var _0x13fd91=_0x459199[0x1];var _0x2be212=_0x590e18['clone']()[_0xfecc('0xf')](_0x49eb05)[_0xfecc('0x10')](_0x13fd91);throwIfDateNotValid(_0x2be212);var _0x51e8df=extractTime(_0x280e29);var _0x13bcb2=_0x51e8df[0x0];var _0xbf39b9=_0x51e8df[0x1];var _0x58d2e7=_0x590e18[_0xfecc('0xe')]()[_0xfecc('0xf')](_0x13bcb2)['minutes'](_0xbf39b9);throwIfDateNotValid(_0x58d2e7);if(_0x58d2e7[_0xfecc('0x11')](_0x2be212)){var _0x365bd2=_0x135e09[_0xfecc('0xe')]()[_0xfecc('0x12')](_0xfecc('0x13'));var _0x2d2e17=_0x135e09[_0xfecc('0xe')]()[_0xfecc('0x14')](_0xfecc('0x13'));return _0x135e09[_0xfecc('0x15')](_0x2be212,_0x2d2e17,undefined,'[]')||_0x135e09[_0xfecc('0x15')](_0x365bd2,_0x58d2e7,undefined,'[]');}else{return _0x135e09['isBetween'](_0x2be212,_0x58d2e7,undefined,'[]');}}module[_0xfecc('0xb')][_0xfecc('0x16')]=timeCompare;function dowCompare(_0x368547,_0x5c871d,_0x3c35ae){var _0x7d4e60=_0x368547[_0xfecc('0x7')]('en')[_0xfecc('0x17')](_0xfecc('0x18'))['toLowerCase']();return circularDoWInterval(_0x5c871d,_0x3c35ae)[_0xfecc('0x19')](_0x7d4e60);}module[_0xfecc('0xb')]['dowCompare']=dowCompare;function domCompare(_0x5a1fdf,_0x8625cd,_0x4d3fc6){var _0x21576f=_0x5a1fdf[_0xfecc('0x1a')]();if(_0x8625cd===_0x4d3fc6){return _0x21576f===_0x8625cd;}else{var _0x2dfd67=_0x5a1fdf['daysInMonth']();var _0x5933aa=_0x8625cd<_0x4d3fc6;let _0x343b4f=![];var _0x5b7536=0x0;var _0x520cc0=0x0;if(_0x5933aa){_0x5b7536=Math[_0xfecc('0x1b')](0x1,_0x8625cd);_0x520cc0=Math['min'](_0x4d3fc6,_0x2dfd67);_0x343b4f=_0x21576f>=_0x5b7536&&_0x21576f<=_0x520cc0;}else{_0x5b7536=Math[_0xfecc('0x1c')](_0x8625cd,_0x2dfd67);_0x520cc0=Math[_0xfecc('0x1b')](0x1,_0x4d3fc6);_0x343b4f=_0x21576f>=_0x5b7536||_0x21576f<=_0x520cc0;}return _0x343b4f;}}module['exports'][_0xfecc('0x1d')]=domCompare;function monthCompare(_0x133f1e,_0x1aa575,_0xbcb4ab){var _0x157dfc=_0x133f1e['locale']('en')[_0xfecc('0x17')](_0xfecc('0x1e'))[_0xfecc('0x8')]();return circularMonthInterval(_0x1aa575,_0xbcb4ab)['includes'](_0x157dfc);}module[_0xfecc('0xb')][_0xfecc('0x1f')]=monthCompare;function iftime(_0x12a766,_0x15d58d=moment['tz'][_0xfecc('0x20')](),_0x2b80e0=moment()){if(!validateRx['test'](_0x12a766)){throw new Error(EINVALID_STRING);}else{var _0xc950c2=(moment[_0xfecc('0x21')](_0x2b80e0)?_0x2b80e0[_0xfecc('0xe')]():moment(_0x2b80e0))['tz'](_0x15d58d)[_0xfecc('0x7')]('en');throwIfDateNotValid(_0xc950c2);var _0x5368d3=_0x12a766[_0xfecc('0x6')](',');var _0x450e53=_0x5368d3[0x0];var _0x52c56b=_0x5368d3[0x1];var _0x207c97=_0x5368d3[0x2];var _0x1adadc=_0x5368d3[0x3];let _0x514384=!![];if(_0x450e53!=='*'){var _0x1e881b=_0x450e53[_0xfecc('0x6')]('-');var _0x41fdbd=_['padStart'](_0x1e881b[0x0],0x5,'0');var _0x445831=_0x1e881b[_0xfecc('0x22')]===0x2?_['padStart'](_0x1e881b[0x1],0x5,'0'):_0x41fdbd;_0x514384=timeCompare(_0xc950c2,_0x41fdbd,_0x445831);}let _0x151132=!![];if(_0x52c56b!=='*'){var _0x2a2902=_0x52c56b['split']('-');var _0x25d9de=_0x2a2902[0x0];var _0x13c505=_0x2a2902['length']===0x2?_0x2a2902[0x1]:_0x25d9de;_0x151132=dowCompare(_0xc950c2,_0x25d9de,_0x13c505);}let _0x2f26a3=!![];if(_0x207c97!=='*'){var _0x7ec4d4=_0x207c97[_0xfecc('0x6')]('-');var _0x3affd6=parseDom(_0x7ec4d4[0x0]);var _0x1f7eb9=_0x7ec4d4[_0xfecc('0x22')]===0x2?parseDom(_0x7ec4d4[0x1]):_0x3affd6;_0x2f26a3=domCompare(_0xc950c2,_0x3affd6,_0x1f7eb9);}let _0x13d27f=!![];if(_0x1adadc!=='*'){var _0x13fdca=_0x1adadc['split']('-');var _0x460817=_0x13fdca[0x0];var _0x36f312=_0x13fdca['length']===0x2?_0x13fdca[0x1]:_0x13fdca[0x0];_0x13d27f=monthCompare(_0xc950c2,_0x460817,_0x36f312);}return _0x514384&&_0x151132&&_0x2f26a3&&_0x13d27f;}}module[_0xfecc('0xb')][_0xfecc('0x23')]=iftime; \ No newline at end of file +var _0xc481=['locale','weekdaysShort','toLowerCase','indexOf','slice','monthsShort','concat','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','isBetween','timeCompare','format','includes','dowCompare','date','max','min','domCompare','MMM','monthCompare','guess','isMoment','length','iftime','map','source','join','Interval\x20string\x20not\x20valid','isValid','split'];(function(_0x106b08,_0xf1ad34){var _0x2835c9=function(_0xfcab73){while(--_0xfcab73){_0x106b08['push'](_0x106b08['shift']());}};_0x2835c9(++_0xf1ad34);}(_0xc481,0x8a));var _0x1c48=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0xc481[_0x8abd64];return _0xd2511e;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x1c48('0x0')](function(_0x309812){return _0x309812[_0x1c48('0x1')];})[_0x1c48('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x1c48('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x2cee93){if(!_0x2cee93[_0x1c48('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x123253){var _0x16269b=_0x123253[_0x1c48('0x5')](':')['map'](function(_0x45e3f3){return parseInt(_0x45e3f3,0xa);});var _0xc9f185=_0x16269b[0x0];var _0x56b38c=_0x16269b[0x1];if(_0xc9f185<0x0||_0xc9f185>0x17||_0x56b38c<0x0||_0x56b38c>0x3b){throw new Error(EINVALID_DATE);}return[_0xc9f185,_0x56b38c];}function circularDoWInterval(_0x1bad22,_0x216acb){if(_0x1bad22===_0x216acb){return[_0x1bad22];}else{var _0x4ac3e9=moment['locale']();moment[_0x1c48('0x6')]('en');var _0x23c873=moment[_0x1c48('0x7')]()['map'](function(_0x3be0fb){return _0x3be0fb[_0x1c48('0x8')]();});moment[_0x1c48('0x6')](_0x4ac3e9);var _0x44731f=_0x23c873[_0x1c48('0x9')](_0x1bad22);var _0x349b11=_0x23c873['indexOf'](_0x216acb);if(_0x349b11>_0x44731f){return _0x23c873[_0x1c48('0xa')](_0x44731f,_0x349b11+0x1);}else{var _0x34361e=_0x23c873[_0x1c48('0xa')](0x0,_0x349b11+0x1);var _0x2d7b52=_0x23c873[_0x1c48('0xa')](_0x44731f);return _0x2d7b52['concat'](_0x34361e);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0xa95525,_0x2b4790){if(_0xa95525===_0x2b4790){return[_0xa95525];}else{var _0x40518c=moment['locale']();moment[_0x1c48('0x6')]('en');var _0x2e0fb6=moment[_0x1c48('0xb')]()[_0x1c48('0x0')](function(_0x5de825){return _0x5de825[_0x1c48('0x8')]();});moment[_0x1c48('0x6')](_0x40518c);var _0x593f20=_0x2e0fb6[_0x1c48('0x9')](_0xa95525);var _0x222c3a=_0x2e0fb6['indexOf'](_0x2b4790);if(_0x222c3a>_0x593f20){return _0x2e0fb6[_0x1c48('0xa')](_0x593f20,_0x222c3a+0x1);}else{var _0x3f9926=_0x2e0fb6[_0x1c48('0xa')](0x0,_0x222c3a+0x1);var _0x16f319=_0x2e0fb6['slice'](_0x593f20);return _0x16f319[_0x1c48('0xc')](_0x3f9926);}}}module[_0x1c48('0xd')][_0x1c48('0xe')]=circularMonthInterval;function parseDom(_0x3fbf76){var _0x2c0e9e=parseInt(_0x3fbf76,0xa);if(_0x2c0e9e<0x1||_0x2c0e9e>0x1f){throw new Error(EINVALID_DATE);}return _0x2c0e9e;}function timeCompare(_0x33fba5,_0x35f7fa,_0x57f6de){var _0x3c1508=_0x33fba5[_0x1c48('0xf')]();var _0x3709d0=extractTime(_0x35f7fa);var _0x44b4e1=_0x3709d0[0x0];var _0x5b325b=_0x3709d0[0x1];var _0x1b95e4=_0x33fba5[_0x1c48('0xf')]()[_0x1c48('0x10')](_0x44b4e1)[_0x1c48('0x11')](_0x5b325b);throwIfDateNotValid(_0x1b95e4);var _0x193128=extractTime(_0x57f6de);var _0x5983d1=_0x193128[0x0];var _0x288c34=_0x193128[0x1];var _0x1ed139=_0x33fba5[_0x1c48('0xf')]()[_0x1c48('0x10')](_0x5983d1)['minutes'](_0x288c34);throwIfDateNotValid(_0x1ed139);if(_0x1ed139[_0x1c48('0x12')](_0x1b95e4)){var _0x3f54ce=_0x3c1508[_0x1c48('0xf')]()[_0x1c48('0x13')]('day');var _0x7d7242=_0x3c1508[_0x1c48('0xf')]()[_0x1c48('0x14')]('day');return _0x3c1508[_0x1c48('0x15')](_0x1b95e4,_0x7d7242,undefined,'[]')||_0x3c1508[_0x1c48('0x15')](_0x3f54ce,_0x1ed139,undefined,'[]');}else{return _0x3c1508[_0x1c48('0x15')](_0x1b95e4,_0x1ed139,undefined,'[]');}}module['exports'][_0x1c48('0x16')]=timeCompare;function dowCompare(_0x47dfff,_0x392a76,_0x4dda1b){var _0x3333d3=_0x47dfff[_0x1c48('0x6')]('en')[_0x1c48('0x17')]('ddd')[_0x1c48('0x8')]();return circularDoWInterval(_0x392a76,_0x4dda1b)[_0x1c48('0x18')](_0x3333d3);}module[_0x1c48('0xd')][_0x1c48('0x19')]=dowCompare;function domCompare(_0x1e4318,_0x5d1305,_0x4ef4c9){var _0x1d31a9=_0x1e4318[_0x1c48('0x1a')]();if(_0x5d1305===_0x4ef4c9){return _0x1d31a9===_0x5d1305;}else{var _0x594be5=_0x1e4318['daysInMonth']();var _0x3530cc=_0x5d1305<_0x4ef4c9;let _0x3cc478=![];var _0x3f312b=0x0;var _0x56eb15=0x0;if(_0x3530cc){_0x3f312b=Math[_0x1c48('0x1b')](0x1,_0x5d1305);_0x56eb15=Math[_0x1c48('0x1c')](_0x4ef4c9,_0x594be5);_0x3cc478=_0x1d31a9>=_0x3f312b&&_0x1d31a9<=_0x56eb15;}else{_0x3f312b=Math[_0x1c48('0x1c')](_0x5d1305,_0x594be5);_0x56eb15=Math[_0x1c48('0x1b')](0x1,_0x4ef4c9);_0x3cc478=_0x1d31a9>=_0x3f312b||_0x1d31a9<=_0x56eb15;}return _0x3cc478;}}module[_0x1c48('0xd')][_0x1c48('0x1d')]=domCompare;function monthCompare(_0x556bfe,_0x2071c7,_0x5eb51b){var _0x5023fe=_0x556bfe[_0x1c48('0x6')]('en')[_0x1c48('0x17')](_0x1c48('0x1e'))[_0x1c48('0x8')]();return circularMonthInterval(_0x2071c7,_0x5eb51b)[_0x1c48('0x18')](_0x5023fe);}module[_0x1c48('0xd')][_0x1c48('0x1f')]=monthCompare;function iftime(_0x3c6c07,_0xdb0756=moment['tz'][_0x1c48('0x20')](),_0x4a151c=moment()){if(!validateRx['test'](_0x3c6c07)){throw new Error(EINVALID_STRING);}else{var _0x2e13ff=(moment[_0x1c48('0x21')](_0x4a151c)?_0x4a151c[_0x1c48('0xf')]():moment(_0x4a151c))['tz'](_0xdb0756)[_0x1c48('0x6')]('en');throwIfDateNotValid(_0x2e13ff);var _0x4455e4=_0x3c6c07[_0x1c48('0x5')](',');var _0x3e8fec=_0x4455e4[0x0];var _0x5b8e44=_0x4455e4[0x1];var _0x1fe100=_0x4455e4[0x2];var _0x1ff0b7=_0x4455e4[0x3];let _0x16011b=!![];if(_0x3e8fec!=='*'){var _0x433dba=_0x3e8fec['split']('-');var _0x2e0ba6=_['padStart'](_0x433dba[0x0],0x5,'0');var _0xa19566=_0x433dba[_0x1c48('0x22')]===0x2?_['padStart'](_0x433dba[0x1],0x5,'0'):_0x2e0ba6;_0x16011b=timeCompare(_0x2e13ff,_0x2e0ba6,_0xa19566);}let _0x80cc39=!![];if(_0x5b8e44!=='*'){var _0x92c23c=_0x5b8e44[_0x1c48('0x5')]('-');var _0x1c23d9=_0x92c23c[0x0];var _0x280a50=_0x92c23c[_0x1c48('0x22')]===0x2?_0x92c23c[0x1]:_0x1c23d9;_0x80cc39=dowCompare(_0x2e13ff,_0x1c23d9,_0x280a50);}let _0x3b2ea7=!![];if(_0x1fe100!=='*'){var _0x2db08e=_0x1fe100[_0x1c48('0x5')]('-');var _0x545273=parseDom(_0x2db08e[0x0]);var _0x5478b0=_0x2db08e['length']===0x2?parseDom(_0x2db08e[0x1]):_0x545273;_0x3b2ea7=domCompare(_0x2e13ff,_0x545273,_0x5478b0);}let _0x20c0e4=!![];if(_0x1ff0b7!=='*'){var _0x478606=_0x1ff0b7[_0x1c48('0x5')]('-');var _0x4ac50=_0x478606[0x0];var _0x544fa2=_0x478606['length']===0x2?_0x478606[0x1]:_0x478606[0x0];_0x20c0e4=monthCompare(_0x2e13ff,_0x4ac50,_0x544fa2);}return _0x16011b&&_0x80cc39&&_0x3b2ea7&&_0x20c0e4;}}module[_0x1c48('0xd')][_0x1c48('0x23')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 889b023..2691e58 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75ed=['path','util','winston','../config/environment','debugLevel','toLowerCase','info','red','white','bold\x20green','gray','bold\x20cyan','/var/log/xcally','format','%s-%s.log','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','message','{{{','}}}','meta','keys','length','stringify','transports','Console','warn','Logger','error','%s-%s','consoleLogger','fileLogger'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x75ed,0x110));var _0xd75e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x75ed[_0x501510];return _0x1e6ee5;};'use strict';var path=require(_0xd75e('0x0'));var util=require(_0xd75e('0x1'));var moment=require('moment');var winston=require(_0xd75e('0x2'));var config=require(_0xd75e('0x3'));var debugLevel=config[_0xd75e('0x4')]?config['debugLevel'][_0xd75e('0x5')]():_0xd75e('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':'redBG\x20white','error':_0xd75e('0x7'),'warn':'bold\x20yellow','info':_0xd75e('0x8'),'print':'bold\x20white','success':_0xd75e('0x9'),'http':_0xd75e('0xa'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0xd75e('0xb')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x19c810,_0x1a1b83,_0x45a898){var _0xf3bbea=_0x19c810||_0xd75e('0xc');return path['join'](_0xf3bbea,util[_0xd75e('0xd')](_0xd75e('0xe'),_0x1a1b83,_0x45a898));}function formatter(_0x980811,_0x85e87b){_0x85e87b['message']=_0x85e87b['message']['replace'](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')[_0xd75e('0xf')](/@{/g,'{{')[_0xd75e('0xf')](/}@/g,'}}');return util[_0xd75e('0xd')](_0xd75e('0x10'),moment()[_0xd75e('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),_0x85e87b[_0xd75e('0x11')][_0xd75e('0x12')](),_0x980811,_0x85e87b[_0xd75e('0x13')]);}function fileFormat(_0x592706,_0x15ef52){_0x15ef52[_0xd75e('0x13')]=_0x15ef52[_0xd75e('0x13')][_0xd75e('0xf')](/@@{/g,_0xd75e('0x14'))[_0xd75e('0xf')](/}@@/g,_0xd75e('0x15'))[_0xd75e('0xf')](/@{/g,'{{')[_0xd75e('0xf')](/}@/g,'}}');var _0x1ae068=_0x15ef52[_0xd75e('0x16')]&&Object[_0xd75e('0x17')](_0x15ef52[_0xd75e('0x16')])[_0xd75e('0x18')]?'\x0a\x09'+JSON[_0xd75e('0x19')](_0x15ef52['meta']):'';return util[_0xd75e('0xd')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xd75e('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),_0x15ef52[_0xd75e('0x11')]['toUpperCase'](),_0x592706,_0x15ef52['message'],_0x1ae068);}function consoleLogger(){var _0xe9ca35=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd75e('0x1a'))][(_0xd75e('0x1b'))]({'level':_0xd75e('0x1c'),'json':![],'formatter':function(_0x5a92de){return formatter('',_0x5a92de);}})]});return _0xe9ca35;}function fileLogger(_0xc08dc8,_0x15c77f){var _0x209508=new winston[(_0xd75e('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd75e('0x1a'))]['File']({'name':util[_0xd75e('0xd')]('%s-%s',_0xc08dc8,_0xd75e('0x1e')),'filename':getLogFileName(_0x15c77f,_0xc08dc8,_0xd75e('0x1e')),'level':_0xd75e('0x1e'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x517f51){return fileFormat(_0xc08dc8,_0x517f51);}}),new winston['transports']['File']({'name':util[_0xd75e('0xd')](_0xd75e('0x1f'),_0xc08dc8,debugLevel),'filename':getLogFileName(_0x15c77f,_0xc08dc8,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x98e6fa){return fileFormat(_0xc08dc8,_0x98e6fa);}}),new winston[(_0xd75e('0x1a'))][(_0xd75e('0x1b'))]({'level':_0xd75e('0x1c'),'json':![],'formatter':function(_0x232179){return fileFormat(_0xc08dc8,_0x232179);}})]});return _0x209508;}exports[_0xd75e('0x20')]=consoleLogger;exports[_0xd75e('0x21')]=fileLogger; \ No newline at end of file +var _0x0d89=['warn','File','%s-%s','error','Console','consoleLogger','fileLogger','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0d89,0xcf));var _0x90d8=function(_0x43c48c,_0x287e91){_0x43c48c=_0x43c48c-0x0;var _0x595280=_0x0d89[_0x43c48c];return _0x595280;};'use strict';var path=require('path');var util=require(_0x90d8('0x0'));var moment=require(_0x90d8('0x1'));var winston=require(_0x90d8('0x2'));var config=require(_0x90d8('0x3'));var debugLevel=config[_0x90d8('0x4')]?config['debugLevel'][_0x90d8('0x5')]():_0x90d8('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':'redBG\x20white','error':_0x90d8('0x7'),'warn':_0x90d8('0x8'),'info':_0x90d8('0x9'),'print':_0x90d8('0xa'),'success':'bold\x20green','http':_0x90d8('0xb'),'verbose':'bold\x20magenta','debug':_0x90d8('0xc'),'silly':_0x90d8('0xd')};winston[_0x90d8('0xe')](XC_LOG_COLORS);function getLogFileName(_0x344b04,_0xd10624,_0x301a8e){var _0x119bfb=_0x344b04||_0x90d8('0xf');return path[_0x90d8('0x10')](_0x119bfb,util[_0x90d8('0x11')](_0x90d8('0x12'),_0xd10624,_0x301a8e));}function formatter(_0x3b34b6,_0x9ff63a){_0x9ff63a[_0x90d8('0x13')]=_0x9ff63a[_0x90d8('0x13')][_0x90d8('0x14')](/@@{/g,_0x90d8('0x15'))[_0x90d8('0x14')](/}@@/g,_0x90d8('0x16'))['replace'](/@{/g,'{{')[_0x90d8('0x14')](/}@/g,'}}');return util[_0x90d8('0x11')](_0x90d8('0x17'),moment()[_0x90d8('0x11')](_0x90d8('0x18')),_0x9ff63a[_0x90d8('0x19')][_0x90d8('0x1a')](),_0x3b34b6,_0x9ff63a[_0x90d8('0x13')]);}function fileFormat(_0x4f2465,_0x11a81e){_0x11a81e[_0x90d8('0x13')]=_0x11a81e['message'][_0x90d8('0x14')](/@@{/g,_0x90d8('0x15'))['replace'](/}@@/g,_0x90d8('0x16'))[_0x90d8('0x14')](/@{/g,'{{')[_0x90d8('0x14')](/}@/g,'}}');var _0x51906d=_0x11a81e['meta']&&Object['keys'](_0x11a81e[_0x90d8('0x1b')])[_0x90d8('0x1c')]?'\x0a\x09'+JSON[_0x90d8('0x1d')](_0x11a81e[_0x90d8('0x1b')]):'';return util[_0x90d8('0x11')](_0x90d8('0x1e'),moment()[_0x90d8('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x11a81e['level'][_0x90d8('0x1a')](),_0x4f2465,_0x11a81e[_0x90d8('0x13')],_0x51906d);}function consoleLogger(){var _0x4f2be1=new winston[(_0x90d8('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x90d8('0x20'))]['Console']({'level':_0x90d8('0x21'),'json':![],'formatter':function(_0xf29b8f){return formatter('',_0xf29b8f);}})]});return _0x4f2be1;}function fileLogger(_0x42e5d5,_0x4b9b64){var _0x8134ac=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x90d8('0x20'))][(_0x90d8('0x22'))]({'name':util[_0x90d8('0x11')](_0x90d8('0x23'),_0x42e5d5,_0x90d8('0x24')),'filename':getLogFileName(_0x4b9b64,_0x42e5d5,'error'),'level':_0x90d8('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x19ad0c){return fileFormat(_0x42e5d5,_0x19ad0c);}}),new winston[(_0x90d8('0x20'))][(_0x90d8('0x22'))]({'name':util[_0x90d8('0x11')](_0x90d8('0x23'),_0x42e5d5,debugLevel),'filename':getLogFileName(_0x4b9b64,_0x42e5d5,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1fb58e){return fileFormat(_0x42e5d5,_0x1fb58e);}}),new winston['transports'][(_0x90d8('0x25'))]({'level':'warn','json':![],'formatter':function(_0xafae12){return fileFormat(_0x42e5d5,_0xafae12);}})]});return _0x8134ac;}exports[_0x90d8('0x26')]=consoleLogger;exports[_0x90d8('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index bf85c64..4884311 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(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x0295,0x1f0));var _0x5029=function(_0xc2c0c3,_0x2bf8a9){_0xc2c0c3=_0xc2c0c3-0x0;var _0x292acf=_0x0295[_0xc2c0c3];return _0x292acf;};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 _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x3f5f7c,_0x14078d){_0x3f5f7c=_0x3f5f7c-0x0;var _0x46aec7=_0x7a54[_0x3f5f7c];return _0x46aec7;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index c6d63d1..ad333f0 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['replace','\x5c$&','exports'];(function(_0xdfb73f,_0xa03dde){var _0x4cd17f=function(_0x3de3de){while(--_0x3de3de){_0xdfb73f['push'](_0xdfb73f['shift']());}};_0x4cd17f(++_0xa03dde);}(_0x326f,0xd1));var _0xf326=function(_0xe515a6,_0x59eca5){_0xe515a6=_0xe515a6-0x0;var _0x3b41c9=_0x326f[_0xe515a6];return _0x3b41c9;};module[_0xf326('0x0')]={'escapeRegExp'(_0x55c50e,_0x5452cc=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x55c50e[_0xf326('0x1')](_0x5452cc,_0xf326('0x2'));}}; \ No newline at end of file +var _0x53ec=['exports','replace','\x5c$&'];(function(_0x1bf828,_0xd3919d){var _0x5deba2=function(_0x19d70d){while(--_0x19d70d){_0x1bf828['push'](_0x1bf828['shift']());}};_0x5deba2(++_0xd3919d);}(_0x53ec,0x192));var _0xc53e=function(_0x5811e5,_0x946ee2){_0x5811e5=_0x5811e5-0x0;var _0x1642da=_0x53ec[_0x5811e5];return _0x1642da;};module[_0xc53e('0x0')]={'escapeRegExp'(_0x173f4d,_0x2d5f51=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x173f4d[_0xc53e('0x1')](_0x2d5f51,_0xc53e('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 290bf86..d7c4f5a 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 _0xdd4f=['isArray','map','isPlainObject','keys','reduce','safeTemplate','lodash','replace'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xa3bf2f,_0x42c22b){_0xa3bf2f=_0xa3bf2f-0x0;var _0x569ca0=_0xdd4f[_0xa3bf2f];return _0x569ca0;};var _=require(_0xfdd4('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x51d240){return _0x51d240==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0x291ae7){var _0x19cda7=_0x291ae7;if(typeof _0x291ae7==='string'){_0x19cda7=_0x291ae7[_0xfdd4('0x1')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfdd4('0x2')](_0x291ae7)){_0x19cda7=_0x291ae7[_0xfdd4('0x3')](function(_0x554e44){return safeTemplate(_0x554e44);});}else if(_[_0xfdd4('0x4')](_0x291ae7)){_0x19cda7=Object[_0xfdd4('0x5')](_0x291ae7)[_0xfdd4('0x6')](function(_0x307ac6,_0x3c72d4){_0x307ac6[_0x3c72d4]=safeTemplate(_0x291ae7[_0x3c72d4]);return _0x307ac6;},{});}return _0x19cda7;}module['exports'][_0xfdd4('0x7')]=safeTemplate; \ No newline at end of file +var _0x5c3c=['\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce','safeTemplate','lodash','{\x20{\x20'];(function(_0x231854,_0x161ebe){var _0x42a303=function(_0x53c587){while(--_0x53c587){_0x231854['push'](_0x231854['shift']());}};_0x42a303(++_0x161ebe);}(_0x5c3c,0x132));var _0xc5c3=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x5c3c[_0x513aa5];return _0x1a1a7c;};var _=require(_0xc5c3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x40ad71){return _0x40ad71==='{{'?_0xc5c3('0x1'):_0xc5c3('0x2');}function safeTemplate(_0x4b9233){var _0x400726=_0x4b9233;if(typeof _0x4b9233===_0xc5c3('0x3')){_0x400726=_0x4b9233[_0xc5c3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xc5c3('0x5')](_0x4b9233)){_0x400726=_0x4b9233[_0xc5c3('0x6')](function(_0x36525d){return safeTemplate(_0x36525d);});}else if(_[_0xc5c3('0x7')](_0x4b9233)){_0x400726=Object[_0xc5c3('0x8')](_0x4b9233)[_0xc5c3('0x9')](function(_0x5a392b,_0x4b8404){_0x5a392b[_0x4b8404]=safeTemplate(_0x4b9233[_0x4b8404]);return _0x5a392b;},{});}return _0x400726;}module['exports'][_0xc5c3('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index f98aa1e..f2aeb9d 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a0e=['server/app.json','apps','findIndex','name','env','pathExists','then','readJSON','info','writeJSON','fs-extra','path','../config/environment','resolve'];(function(_0x6a21f4,_0x220ad8){var _0x4c15ac=function(_0x52f4dd){while(--_0x52f4dd){_0x6a21f4['push'](_0x6a21f4['shift']());}};_0x4c15ac(++_0x220ad8);}(_0x3a0e,0xce));var _0xe3a0=function(_0x30b5ef,_0x53a436){_0x30b5ef=_0x30b5ef-0x0;var _0x15325d=_0x3a0e[_0x30b5ef];return _0x15325d;};var fs=require(_0xe3a0('0x0'));var path=require(_0xe3a0('0x1'));var config=require(_0xe3a0('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0xe3a0('0x3')](root,_0xe3a0('0x4'));var NODEPATH=path[_0xe3a0('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x39f70d){let _0x5dfcdb=![];if(Array['isArray'](_0x39f70d[_0xe3a0('0x5')])){var _0x473308=_0x39f70d[_0xe3a0('0x5')][_0xe3a0('0x6')](function(_0x586df7){return _0x586df7[_0xe3a0('0x7')]==='motion2';});if(_0x473308>-0x1){var _0x318919=_0x39f70d['apps'][_0x473308];if(typeof _0x318919[_0xe3a0('0x8')]['NODE_PATH']!=='string'){_0x318919[_0xe3a0('0x8')]['NODE_PATH']=NODEPATH;_0x5dfcdb=!![];}}return{'appConfig':_0x39f70d,'updated':_0x5dfcdb};}}function updateAppConfig(_0xd69763){return fs[_0xe3a0('0x9')](APP_JSON_PATH)[_0xe3a0('0xa')](function(_0x5b5eb5){if(_0x5b5eb5){return fs[_0xe3a0('0xb')](APP_JSON_PATH)['then'](function(_0x5b8a80){var _0x4f1ce5=setLegacyLibsNodeEnvPath(_0x5b8a80);if(_0x4f1ce5['updated']){_0xd69763[_0xe3a0('0xc')]('Updating\x20app.json');return fs[_0xe3a0('0xd')](APP_JSON_PATH,_0x5b8a80,{'spaces':0x2});}else{return Promise[_0xe3a0('0x3')]();}});}else{return Promise['resolve']();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0x430a=['name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','root','resolve','server/app.json','legacy-libs','apps'];(function(_0x114e51,_0x160ac7){var _0x446de9=function(_0x1275e0){while(--_0x1275e0){_0x114e51['push'](_0x114e51['shift']());}};_0x446de9(++_0x160ac7);}(_0x430a,0xaf));var _0xa430=function(_0x315b01,_0x583ac1){_0x315b01=_0x315b01-0x0;var _0x37c9c4=_0x430a[_0x315b01];return _0x37c9c4;};var fs=require('fs-extra');var path=require('path');var config=require('../config/environment');var root=config[_0xa430('0x0')];var APP_JSON_PATH=path[_0xa430('0x1')](root,_0xa430('0x2'));var NODEPATH=path['resolve'](root,_0xa430('0x3'));function setLegacyLibsNodeEnvPath(_0x2b69fa){let _0x2c356e=![];if(Array['isArray'](_0x2b69fa[_0xa430('0x4')])){var _0x18f4bb=_0x2b69fa[_0xa430('0x4')]['findIndex'](function(_0x284ef3){return _0x284ef3[_0xa430('0x5')]===_0xa430('0x6');});if(_0x18f4bb>-0x1){var _0x3b0be5=_0x2b69fa[_0xa430('0x4')][_0x18f4bb];if(typeof _0x3b0be5[_0xa430('0x7')][_0xa430('0x8')]!==_0xa430('0x9')){_0x3b0be5[_0xa430('0x7')][_0xa430('0x8')]=NODEPATH;_0x2c356e=!![];}}return{'appConfig':_0x2b69fa,'updated':_0x2c356e};}}function updateAppConfig(_0x5aea2d){return fs[_0xa430('0xa')](APP_JSON_PATH)[_0xa430('0xb')](function(_0x324e4c){if(_0x324e4c){return fs[_0xa430('0xc')](APP_JSON_PATH)['then'](function(_0x40485a){var _0xb14684=setLegacyLibsNodeEnvPath(_0x40485a);if(_0xb14684[_0xa430('0xd')]){_0x5aea2d[_0xa430('0xe')](_0xa430('0xf'));return fs[_0xa430('0x10')](APP_JSON_PATH,_0x40485a,{'spaces':0x2});}else{return Promise[_0xa430('0x1')]();}});}else{return Promise['resolve']();}});}module[_0xa430('0x11')]=updateAppConfig; \ No newline at end of file